From: Cris Di Sclafani Date: Thu, 27 Aug 2020 15:11:56 +0000 (+0200) Subject: Built motion from commit (unavailable).|2.5.0 X-Git-Url: http://repos.xcallymotion.com/base//%22http:/www.gravatar.com/avatar/%7B%7Bhash%7D%7D/%22?a=commitdiff_plain;h=9cad99ce64cb2503fd90a73652eee9a2f4b5ba07;p=motion2.git Built motion from commit (unavailable).|2.5.0 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 8434ace..2d10e0f 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.0", "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-08-27T14:50:42.865Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); +define({ "name": "xCALLY Motion API", "version": "2.5.0", "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-08-27T15:05:14.218Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index c13c651..f3cfe04 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "xCALLY Motion API", "version": "2.5.0", "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-08-27T14:50:42.865Z", "url": "http://apidocjs.com", "version": "0.19.0" } } +{ "name": "xCALLY Motion API", "version": "2.5.0", "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-08-27T15:05:14.218Z", "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 609d49f..f1a0020 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 _0x511c=['contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','motionbar[NULL,NULL,WinAppArguments]','TEXT','action','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING'];(function(_0x3031b3,_0x94535b){var _0x3618f2=function(_0x3479bc){while(--_0x3479bc){_0x3031b3['push'](_0x3031b3['shift']());}};_0x3618f2(++_0x94535b);}(_0x511c,0x1b0));var _0xc511=function(_0x46b579,_0x566d72){_0x46b579=_0x46b579-0x0;var _0x373a12=_0x511c[_0x46b579];return _0x373a12;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x3b8ca7){return this['getDataValue'](_0xc511('0x0'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xc511('0x1'),_0xc511('0x2'),_0xc511('0x3'),_0xc511('0x4'),_0xc511('0x5'),_0xc511('0x6'),_0xc511('0x7'),'script']],'msg':_0xc511('0x8')}},'comment':_0xc511('0x8')},'data1':{'type':Sequelize[_0xc511('0x9')](0x1000),'comment':_0xc511('0xa')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0xc511('0x9')](0x1000),'comment':_0xc511('0xb')},'data4':{'type':Sequelize[_0xc511('0x9')](0x1000)},'data5':{'type':Sequelize[_0xc511('0x9')](0x1000)},'data6':{'type':Sequelize[_0xc511('0x9')]},'data7':{'type':Sequelize[_0xc511('0xc')]}}; \ No newline at end of file +var _0x7ecb=['TEXT','exports','VIRTUAL','getDataValue','action','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]'];(function(_0x545337,_0x503910){var _0x49ad82=function(_0x521829){while(--_0x521829){_0x545337['push'](_0x545337['shift']());}};_0x49ad82(++_0x503910);}(_0x7ecb,0x161));var _0xb7ec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7ecb[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xb7ec('0x0')]={'name':{'type':Sequelize[_0xb7ec('0x1')],'get':function(_0x353415){return this[_0xb7ec('0x2')](_0xb7ec('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration',_0xb7ec('0x4'),_0xb7ec('0x5'),_0xb7ec('0x6'),_0xb7ec('0x7'),_0xb7ec('0x8'),_0xb7ec('0x9')]],'msg':_0xb7ec('0xa')}},'comment':_0xb7ec('0xa')},'data1':{'type':Sequelize[_0xb7ec('0xb')](0x1000),'comment':_0xb7ec('0xc')},'data2':{'type':Sequelize[_0xb7ec('0xb')](0x1000),'comment':_0xb7ec('0xd')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xb7ec('0xe')},'data4':{'type':Sequelize[_0xb7ec('0xb')](0x1000)},'data5':{'type':Sequelize[_0xb7ec('0xb')](0x1000)},'data6':{'type':Sequelize[_0xb7ec('0xb')]},'data7':{'type':Sequelize[_0xb7ec('0xf')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 4e7ae48..d5e0453 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 _0x39fc=['update','then','destroy','error','stack','name','send','body','Action','find','catch','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x1e744a,_0x586731){var _0x1a3e04=function(_0x542c69){while(--_0x542c69){_0x1e744a['push'](_0x1e744a['shift']());}};_0x1a3e04(++_0x586731);}(_0x39fc,0x197));var _0xc39f=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x39fc[_0x31e29a];return _0x32d892;};'use strict';var pdf=require(_0xc39f('0x0'));var emlformat=require(_0xc39f('0x1'));var rimraf=require(_0xc39f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc39f('0x3'));var moment=require('moment');var BPromise=require(_0xc39f('0x4'));var Mustache=require(_0xc39f('0x5'));var util=require(_0xc39f('0x6'));var path=require('path');var sox=require(_0xc39f('0x7'));var csv=require('to-csv');var ejs=require(_0xc39f('0x8'));var fs=require('fs');var _=require(_0xc39f('0x9'));var squel=require(_0xc39f('0xa'));var crypto=require(_0xc39f('0xb'));var jsforce=require(_0xc39f('0xc'));var deskjs=require(_0xc39f('0xd'));var toCsv=require(_0xc39f('0xe'));var querystring=require(_0xc39f('0xf'));var Papa=require(_0xc39f('0x10'));var Redis=require(_0xc39f('0x11'));var authService=require(_0xc39f('0x12'));var qs=require(_0xc39f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc39f('0x14'));var utils=require(_0xc39f('0x15'));var config=require(_0xc39f('0x16'));var db=require(_0xc39f('0x17'))['db'];function respondWithStatusCode(_0x5167bf,_0x362fb7){_0x362fb7=_0x362fb7||0xcc;return function(_0xcb2ad6){if(_0xcb2ad6){return _0x5167bf['sendStatus'](_0x362fb7);}return _0x5167bf[_0xc39f('0x18')](_0x362fb7)['end']();};}function respondWithResult(_0x56e821,_0x5c288b){_0x5c288b=_0x5c288b||0xc8;return function(_0x5de0ae){if(_0x5de0ae){return _0x56e821[_0xc39f('0x18')](_0x5c288b)[_0xc39f('0x19')](_0x5de0ae);}};}function respondWithFilteredResult(_0x1f2c30,_0x225e46){return function(_0x29c20c){if(_0x29c20c){var _0x3b129f=_0x29c20c['count'],_0x4339a0=_0x225e46[_0xc39f('0x1a')],_0x3782b1=_0x225e46[_0xc39f('0x1a')]+_0x225e46[_0xc39f('0x1b')],_0x1f2428;if(_0x3782b1>=_0x3b129f){_0x3782b1=_0x3b129f;_0x1f2428=0xc8;}else{_0x1f2428=0xce;}_0x1f2c30[_0xc39f('0x18')](_0x1f2428);return _0x1f2c30[_0xc39f('0x1c')](_0xc39f('0x1d'),_0x4339a0+'-'+_0x3782b1+'/'+_0x3b129f)[_0xc39f('0x19')](_0x29c20c);}return null;};}function patchUpdates(_0x3c05d1){return function(_0x18346d){try{jsonpatch[_0xc39f('0x1e')](_0x18346d,_0x3c05d1,!![]);}catch(_0x5d4d73){return BPromise[_0xc39f('0x1f')](_0x5d4d73);}return _0x18346d[_0xc39f('0x20')]();};}function saveUpdates(_0x3b680a,_0x2256ad){return function(_0x1881a7){if(_0x1881a7){return _0x1881a7[_0xc39f('0x21')](_0x3b680a)[_0xc39f('0x22')](function(_0x59327f){return _0x59327f;});}return null;};}function removeEntity(_0x4d4968,_0x3ba638){return function(_0x3efc65){if(_0x3efc65){return _0x3efc65[_0xc39f('0x23')]()['then'](function(){_0x4d4968['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23d231,_0x14c30f){return function(_0x2c4c0c){if(!_0x2c4c0c){_0x23d231['sendStatus'](0x194);}return _0x2c4c0c;};}function handleError(_0x1e4840,_0xbe93d1){_0xbe93d1=_0xbe93d1||0x1f4;return function(_0x4c7bc1){logger[_0xc39f('0x24')](_0x4c7bc1[_0xc39f('0x25')]);if(_0x4c7bc1[_0xc39f('0x26')]){delete _0x4c7bc1[_0xc39f('0x26')];}_0x1e4840[_0xc39f('0x18')](_0xbe93d1)[_0xc39f('0x27')](_0x4c7bc1);};}exports['update']=function(_0x35a9ae,_0x38d375){if(_0x35a9ae[_0xc39f('0x28')]['id']){delete _0x35a9ae[_0xc39f('0x28')]['id'];}return db[_0xc39f('0x29')]['find']({'where':{'id':_0x35a9ae['params']['id']}})[_0xc39f('0x22')](handleEntityNotFound(_0x38d375,null))[_0xc39f('0x22')](saveUpdates(_0x35a9ae[_0xc39f('0x28')],null))[_0xc39f('0x22')](respondWithResult(_0x38d375,null))['catch'](handleError(_0x38d375,null));};exports[_0xc39f('0x23')]=function(_0x3f33d2,_0x2877e7){return db[_0xc39f('0x29')][_0xc39f('0x2a')]({'where':{'id':_0x3f33d2['params']['id']}})[_0xc39f('0x22')](handleEntityNotFound(_0x2877e7,null))[_0xc39f('0x22')](removeEntity(_0x2877e7,null))[_0xc39f('0x2b')](handleError(_0x2877e7,null));}; \ No newline at end of file +var _0x0203=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','body','Action','find','params','catch','rimraf','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x50ea52,_0x49021a){var _0x13e634=function(_0x2ad7a6){while(--_0x2ad7a6){_0x50ea52['push'](_0x50ea52['shift']());}};_0x13e634(++_0x49021a);}(_0x0203,0x74));var _0x3020=function(_0x3d2efc,_0x490dfd){_0x3d2efc=_0x3d2efc-0x0;var _0x5b2191=_0x0203[_0x3d2efc];return _0x5b2191;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3020('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3020('0x1'));var BPromise=require(_0x3020('0x2'));var Mustache=require('mustache');var util=require(_0x3020('0x3'));var path=require(_0x3020('0x4'));var sox=require('sox');var csv=require(_0x3020('0x5'));var ejs=require(_0x3020('0x6'));var fs=require('fs');var _=require(_0x3020('0x7'));var squel=require('squel');var crypto=require(_0x3020('0x8'));var jsforce=require(_0x3020('0x9'));var deskjs=require(_0x3020('0xa'));var toCsv=require(_0x3020('0x5'));var querystring=require(_0x3020('0xb'));var Papa=require(_0x3020('0xc'));var Redis=require(_0x3020('0xd'));var authService=require(_0x3020('0xe'));var qs=require(_0x3020('0xf'));var as=require(_0x3020('0x10'));var hardwareService=require(_0x3020('0x11'));var logger=require(_0x3020('0x12'))(_0x3020('0x13'));var utils=require(_0x3020('0x14'));var config=require(_0x3020('0x15'));var db=require(_0x3020('0x16'))['db'];function respondWithStatusCode(_0x1413d0,_0x1350d5){_0x1350d5=_0x1350d5||0xcc;return function(_0x49c7c4){if(_0x49c7c4){return _0x1413d0[_0x3020('0x17')](_0x1350d5);}return _0x1413d0[_0x3020('0x18')](_0x1350d5)['end']();};}function respondWithResult(_0x270b37,_0xd9f7ce){_0xd9f7ce=_0xd9f7ce||0xc8;return function(_0xd2ab2b){if(_0xd2ab2b){return _0x270b37[_0x3020('0x18')](_0xd9f7ce)[_0x3020('0x19')](_0xd2ab2b);}};}function respondWithFilteredResult(_0x4b402f,_0x48ed6b){return function(_0x179c88){if(_0x179c88){var _0x132b45=_0x179c88[_0x3020('0x1a')],_0x445c43=_0x48ed6b[_0x3020('0x1b')],_0x3a693d=_0x48ed6b[_0x3020('0x1b')]+_0x48ed6b[_0x3020('0x1c')],_0x2231ab;if(_0x3a693d>=_0x132b45){_0x3a693d=_0x132b45;_0x2231ab=0xc8;}else{_0x2231ab=0xce;}_0x4b402f[_0x3020('0x18')](_0x2231ab);return _0x4b402f[_0x3020('0x1d')]('Content-Range',_0x445c43+'-'+_0x3a693d+'/'+_0x132b45)[_0x3020('0x19')](_0x179c88);}return null;};}function patchUpdates(_0x17c0d9){return function(_0x316778){try{jsonpatch[_0x3020('0x1e')](_0x316778,_0x17c0d9,!![]);}catch(_0x72932c){return BPromise[_0x3020('0x1f')](_0x72932c);}return _0x316778[_0x3020('0x20')]();};}function saveUpdates(_0x3cc1a7,_0x4767d5){return function(_0x3d571a){if(_0x3d571a){return _0x3d571a[_0x3020('0x21')](_0x3cc1a7)[_0x3020('0x22')](function(_0x153c30){return _0x153c30;});}return null;};}function removeEntity(_0x56d8ef,_0x558be7){return function(_0xe0167b){if(_0xe0167b){return _0xe0167b[_0x3020('0x23')]()[_0x3020('0x22')](function(){_0x56d8ef[_0x3020('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ea465,_0x4ef238){return function(_0x43e1b1){if(!_0x43e1b1){_0x4ea465[_0x3020('0x17')](0x194);}return _0x43e1b1;};}function handleError(_0x49921c,_0x32b340){_0x32b340=_0x32b340||0x1f4;return function(_0x991699){logger[_0x3020('0x24')](_0x991699[_0x3020('0x25')]);if(_0x991699[_0x3020('0x26')]){delete _0x991699['name'];}_0x49921c[_0x3020('0x18')](_0x32b340)[_0x3020('0x27')](_0x991699);};}exports[_0x3020('0x21')]=function(_0x262d2f,_0xaf90e8){if(_0x262d2f[_0x3020('0x28')]['id']){delete _0x262d2f['body']['id'];}return db[_0x3020('0x29')][_0x3020('0x2a')]({'where':{'id':_0x262d2f[_0x3020('0x2b')]['id']}})[_0x3020('0x22')](handleEntityNotFound(_0xaf90e8,null))[_0x3020('0x22')](saveUpdates(_0x262d2f[_0x3020('0x28')],null))['then'](respondWithResult(_0xaf90e8,null))[_0x3020('0x2c')](handleError(_0xaf90e8,null));};exports[_0x3020('0x23')]=function(_0x421aec,_0x417adc){return db[_0x3020('0x29')][_0x3020('0x2a')]({'where':{'id':_0x421aec[_0x3020('0x2b')]['id']}})[_0x3020('0x22')](handleEntityNotFound(_0x417adc,null))['then'](removeEntity(_0x417adc,null))['catch'](handleError(_0x417adc,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 59b9946..3cbbe64 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 _0x2cfa=['request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','api'];(function(_0x3ddc1c,_0x3ec9aa){var _0xe4194=function(_0x5936be){while(--_0x5936be){_0x3ddc1c['push'](_0x3ddc1c['shift']());}};_0xe4194(++_0x3ec9aa);}(_0x2cfa,0xbf));var _0xa2cf=function(_0x3cf053,_0x7a9947){_0x3cf053=_0x3cf053-0x0;var _0x3b55a0=_0x2cfa[_0x3cf053];return _0x3b55a0;};'use strict';var _=require(_0xa2cf('0x0'));var util=require(_0xa2cf('0x1'));var logger=require(_0xa2cf('0x2'))(_0xa2cf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa2cf('0x4'));var fs=require('fs');var path=require(_0xa2cf('0x5'));var rimraf=require(_0xa2cf('0x6'));var config=require(_0xa2cf('0x7'));var attributes=require(_0xa2cf('0x8'));module[_0xa2cf('0x9')]=function(_0x2bb1b8,_0x1274dc){return _0x2bb1b8[_0xa2cf('0xa')](_0xa2cf('0xb'),attributes,{'tableName':_0xa2cf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b97=['rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1b0c8c,_0x486222){var _0x2e67c9=function(_0x4f27c6){while(--_0x4f27c6){_0x1b0c8c['push'](_0x1b0c8c['shift']());}};_0x2e67c9(++_0x486222);}(_0x7b97,0x10b));var _0x77b9=function(_0x3340c8,_0x3d67d7){_0x3340c8=_0x3340c8-0x0;var _0x30ca8a=_0x7b97[_0x3340c8];return _0x30ca8a;};'use strict';var _=require(_0x77b9('0x0'));var util=require('util');var logger=require(_0x77b9('0x1'))('api');var moment=require(_0x77b9('0x2'));var BPromise=require(_0x77b9('0x3'));var rp=require(_0x77b9('0x4'));var fs=require('fs');var path=require(_0x77b9('0x5'));var rimraf=require(_0x77b9('0x6'));var config=require(_0x77b9('0x7'));var attributes=require(_0x77b9('0x8'));module[_0x77b9('0x9')]=function(_0x1646e8,_0x24aa79){return _0x1646e8[_0x77b9('0xa')](_0x77b9('0xb'),attributes,{'tableName':_0x77b9('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 bb85b9e..6c1c00c 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 _0x0713=['Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1e2be8,_0x5c0372){var _0x2b0d65=function(_0x3dc215){while(--_0x3dc215){_0x1e2be8['push'](_0x1e2be8['shift']());}};_0x2b0d65(++_0x5c0372);}(_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')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('Action,\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')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0x70e0=['code','Action,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3b862c,_0x4be6f3){var _0x44b9ba=function(_0x538704){while(--_0x538704){_0x3b862c['push'](_0x3b862c['shift']());}};_0x44b9ba(++_0x4be6f3);}(_0x70e0,0x17b));var _0x070e=function(_0x109049,_0xec8462){_0x109049=_0x109049-0x0;var _0xd36a47=_0x70e0[_0x109049];return _0xd36a47;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('Action,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('Action,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index c5652b0..a4c7248 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 _0xc70f=['/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','./action.controller','put'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0xc70f,0x1c6));var _0xfc70=function(_0x1403cf,_0x1fa43e){_0x1403cf=_0x1403cf-0x0;var _0x169bf1=_0xc70f[_0x1403cf];return _0x169bf1;};'use strict';var multer=require(_0xfc70('0x0'));var util=require(_0xfc70('0x1'));var path=require(_0xfc70('0x2'));var timeout=require(_0xfc70('0x3'));var express=require(_0xfc70('0x4'));var router=express[_0xfc70('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfc70('0x6'));router[_0xfc70('0x7')](_0xfc70('0x8'),auth[_0xfc70('0x9')](),controller[_0xfc70('0xa')]);router[_0xfc70('0xb')](_0xfc70('0x8'),auth[_0xfc70('0x9')](),controller[_0xfc70('0xc')]);module[_0xfc70('0xd')]=router; \ No newline at end of file +var _0x3f4d=['delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0x3f4d,0x1f1));var _0xd3f4=function(_0x51786e,_0x5ee24e){_0x51786e=_0x51786e-0x0;var _0x25b5e2=_0x3f4d[_0x51786e];return _0x25b5e2;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd3f4('0x0'));var express=require(_0xd3f4('0x1'));var router=express[_0xd3f4('0x2')]();var auth=require(_0xd3f4('0x3'));var interaction=require(_0xd3f4('0x4'));var config=require(_0xd3f4('0x5'));var controller=require(_0xd3f4('0x6'));router[_0xd3f4('0x7')](_0xd3f4('0x8'),auth[_0xd3f4('0x9')](),controller['update']);router[_0xd3f4('0xa')](_0xd3f4('0x8'),auth[_0xd3f4('0x9')](),controller[_0xd3f4('0xb')]);module[_0xd3f4('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index eabcc9a..b7c81bf 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 _0x7777=['TEXT','exports','STRING'];(function(_0x32e805,_0x5e0785){var _0x159da9=function(_0x460f87){while(--_0x460f87){_0x32e805['push'](_0x32e805['shift']());}};_0x159da9(++_0x5e0785);}(_0x7777,0x76));var _0x7777=function(_0x56a616,_0x5a3c7c){_0x56a616=_0x56a616-0x0;var _0xe94844=_0x7777[_0x56a616];return _0xe94844;};'use strict';var Sequelize=require('sequelize');module[_0x7777('0x0')]={'name':{'type':Sequelize[_0x7777('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7777('0x1')]},'parent':{'type':Sequelize[_0x7777('0x1')]},'table':{'type':Sequelize[_0x7777('0x1')]},'conditions':{'type':Sequelize[_0x7777('0x2')]},'joins':{'type':Sequelize[_0x7777('0x2')]}}; \ No newline at end of file +var _0x7a58=['STRING','TEXT','sequelize'];(function(_0x10042b,_0x39757b){var _0x55a7e4=function(_0x442995){while(--_0x442995){_0x10042b['push'](_0x10042b['shift']());}};_0x55a7e4(++_0x39757b);}(_0x7a58,0x149));var _0x87a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a58[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x87a5('0x0'));module['exports']={'name':{'type':Sequelize[_0x87a5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x87a5('0x1')]},'parent':{'type':Sequelize[_0x87a5('0x1')]},'table':{'type':Sequelize[_0x87a5('0x1')]},'conditions':{'type':Sequelize[_0x87a5('0x2')]},'joins':{'type':Sequelize[_0x87a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index f5a3404..4a65c4f 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 _0x303f=['right_join','HOUR(%s)','UNIX_TIMESTAMP(%s)','Please\x20insert\x20at\x20least\x20one\x20field','select','debug','No\x20available\x20data','output','web','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','../../files/reports','savename','countTable','COUNT(*)','run','runReport','Limited\x20Query:','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','save','update','then','destroy','get','CustomReports','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','toString','sequelize','QueryTypes','SELECT'];(function(_0x20cb4b,_0x2c4d33){var _0x1f73e7=function(_0x28c619){while(--_0x28c619){_0x20cb4b['push'](_0x20cb4b['shift']());}};_0x1f73e7(++_0x2c4d33);}(_0x303f,0xbe));var _0xf303=function(_0x2d158e,_0x146002){_0x2d158e=_0x2d158e-0x0;var _0x2e1768=_0x303f[_0x2d158e];return _0x2e1768;};'use strict';var pdf=require(_0xf303('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf303('0x1'));var jsonpatch=require(_0xf303('0x2'));var rp=require(_0xf303('0x3'));var moment=require(_0xf303('0x4'));var BPromise=require(_0xf303('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf303('0x6'));var sox=require(_0xf303('0x7'));var csv=require(_0xf303('0x8'));var ejs=require(_0xf303('0x9'));var fs=require('fs');var _=require(_0xf303('0xa'));var squel=require(_0xf303('0xb'));var crypto=require('crypto');var jsforce=require(_0xf303('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf303('0xd'));var Papa=require(_0xf303('0xe'));var Redis=require('ioredis');var authService=require(_0xf303('0xf'));var qs=require(_0xf303('0x10'));var as=require(_0xf303('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf303('0x12'))(_0xf303('0x13'));var utils=require(_0xf303('0x14'));var config=require('../../config/environment');var db=require(_0xf303('0x15'))['db'];function respondWithStatusCode(_0x18482d,_0x19d3c6){_0x19d3c6=_0x19d3c6||0xcc;return function(_0x219e0f){if(_0x219e0f){return _0x18482d[_0xf303('0x16')](_0x19d3c6);}return _0x18482d[_0xf303('0x17')](_0x19d3c6)[_0xf303('0x18')]();};}function respondWithResult(_0x42b50e,_0x37075d){_0x37075d=_0x37075d||0xc8;return function(_0x11af1b){if(_0x11af1b){return _0x42b50e[_0xf303('0x17')](_0x37075d)[_0xf303('0x19')](_0x11af1b);}};}function respondWithFilteredResult(_0x23d8d9,_0x58df2c){return function(_0x4602da){if(_0x4602da){var _0x2444cf=_0x4602da[_0xf303('0x1a')],_0xacad3e=_0x58df2c['offset'],_0x29e16c=_0x58df2c[_0xf303('0x1b')]+_0x58df2c[_0xf303('0x1c')],_0x23c581;if(_0x29e16c>=_0x2444cf){_0x29e16c=_0x2444cf;_0x23c581=0xc8;}else{_0x23c581=0xce;}_0x23d8d9[_0xf303('0x17')](_0x23c581);return _0x23d8d9['set'](_0xf303('0x1d'),_0xacad3e+'-'+_0x29e16c+'/'+_0x2444cf)[_0xf303('0x19')](_0x4602da);}return null;};}function patchUpdates(_0x366b49){return function(_0x3ede41){try{jsonpatch['apply'](_0x3ede41,_0x366b49,!![]);}catch(_0x1c60bb){return BPromise['reject'](_0x1c60bb);}return _0x3ede41[_0xf303('0x1e')]();};}function saveUpdates(_0x3c0083,_0x2e33d0){return function(_0x4662cb){if(_0x4662cb){return _0x4662cb[_0xf303('0x1f')](_0x3c0083)[_0xf303('0x20')](function(_0x4f7234){return _0x4f7234;});}return null;};}function removeEntity(_0x31a3e4,_0x2d277e){return function(_0xb0e551){if(_0xb0e551){return _0xb0e551[_0xf303('0x21')]()['then'](function(){var _0x467127=_0xb0e551[_0xf303('0x22')]({'plain':!![]});var _0x1b2532=_0xf303('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x1b2532,'resourceId':_0x467127['id']}})[_0xf303('0x20')](function(){return _0xb0e551;});})['then'](function(){_0x31a3e4[_0xf303('0x17')](0xcc)[_0xf303('0x18')]();});}};}function handleEntityNotFound(_0x15e21b,_0x4af46f){return function(_0x5a8a85){if(!_0x5a8a85){_0x15e21b[_0xf303('0x16')](0x194);}return _0x5a8a85;};}function handleError(_0x566e31,_0x5edff7){_0x5edff7=_0x5edff7||0x1f4;return function(_0x3e9958){logger[_0xf303('0x24')](_0x3e9958[_0xf303('0x25')]);if(_0x3e9958[_0xf303('0x26')]){delete _0x3e9958['name'];}_0x566e31[_0xf303('0x17')](_0x5edff7)[_0xf303('0x27')](_0x3e9958);};}exports[_0xf303('0x28')]=function(_0x31434f,_0x214a53){var _0x10c56a={},_0x4d7bb2={},_0x5694c6={'count':0x0,'rows':[]};var _0x310a1b=_[_0xf303('0x29')](db[_0xf303('0x2a')][_0xf303('0x2b')],function(_0x54cdf1){return{'name':_0x54cdf1[_0xf303('0x2c')],'type':_0x54cdf1['type']['key']};});_0x4d7bb2['model']=_['map'](_0x310a1b,_0xf303('0x26'));_0x4d7bb2[_0xf303('0x2d')]=_['keys'](_0x31434f[_0xf303('0x2d')]);_0x4d7bb2[_0xf303('0x2e')]=_[_0xf303('0x2f')](_0x4d7bb2[_0xf303('0x30')],_0x4d7bb2[_0xf303('0x2d')]);_0x10c56a[_0xf303('0x31')]=_[_0xf303('0x2f')](_0x4d7bb2[_0xf303('0x30')],qs[_0xf303('0x32')](_0x31434f[_0xf303('0x2d')]['fields']));_0x10c56a[_0xf303('0x31')]=_0x10c56a[_0xf303('0x31')][_0xf303('0x33')]?_0x10c56a[_0xf303('0x31')]:_0x4d7bb2[_0xf303('0x30')];if(!_0x31434f[_0xf303('0x2d')]['hasOwnProperty'](_0xf303('0x34'))){_0x10c56a[_0xf303('0x1c')]=qs[_0xf303('0x1c')](_0x31434f[_0xf303('0x2d')][_0xf303('0x1c')]);_0x10c56a['offset']=qs[_0xf303('0x1b')](_0x31434f[_0xf303('0x2d')][_0xf303('0x1b')]);}_0x10c56a[_0xf303('0x35')]=qs[_0xf303('0x36')](_0x31434f['query'][_0xf303('0x36')]);_0x10c56a[_0xf303('0x37')]=qs[_0xf303('0x2e')](_[_0xf303('0x38')](_0x31434f[_0xf303('0x2d')],_0x4d7bb2[_0xf303('0x2e')]));if(_0x31434f[_0xf303('0x2d')][_0xf303('0x39')]){_0x10c56a['where']=_[_0xf303('0x3a')](_0x10c56a[_0xf303('0x37')],{'$or':_['map'](_0x310a1b,function(_0x1395d2){if(_0x1395d2['type']!==_0xf303('0x3b')){var _0x275eb1={};_0x275eb1[_0x1395d2['name']]={'$like':'%'+_0x31434f[_0xf303('0x2d')]['filter']+'%'};return _0x275eb1;}})});}_0x10c56a=_[_0xf303('0x3a')]({},_0x10c56a,_0x31434f[_0xf303('0x3c')]);var _0x3decc0={'where':_0x10c56a[_0xf303('0x37')]};return db[_0xf303('0x2a')][_0xf303('0x1a')](_0x3decc0)[_0xf303('0x20')](function(_0x336297){_0x5694c6[_0xf303('0x1a')]=_0x336297;if(_0x31434f[_0xf303('0x2d')]['includeAll']){_0x10c56a[_0xf303('0x3d')]=[{'all':!![]}];}return db[_0xf303('0x2a')][_0xf303('0x3e')](_0x10c56a);})[_0xf303('0x20')](function(_0x52fcae){_0x5694c6[_0xf303('0x3f')]=_0x52fcae;return _0x5694c6;})[_0xf303('0x20')](respondWithFilteredResult(_0x214a53,_0x10c56a))[_0xf303('0x40')](handleError(_0x214a53,null));};exports[_0xf303('0x41')]=function(_0x1ba26f,_0xd23fdf){var _0x4598dd={'raw':![],'where':{'id':_0x1ba26f[_0xf303('0x42')]['id']}},_0x945d2={};_0x945d2[_0xf303('0x30')]=_[_0xf303('0x43')](db[_0xf303('0x2a')][_0xf303('0x2b')]);_0x945d2['query']=_['keys'](_0x1ba26f['query']);_0x945d2['filters']=_[_0xf303('0x2f')](_0x945d2[_0xf303('0x30')],_0x945d2[_0xf303('0x2d')]);_0x4598dd[_0xf303('0x31')]=_[_0xf303('0x2f')](_0x945d2[_0xf303('0x30')],qs[_0xf303('0x32')](_0x1ba26f[_0xf303('0x2d')][_0xf303('0x32')]));_0x4598dd[_0xf303('0x31')]=_0x4598dd['attributes']['length']?_0x4598dd['attributes']:_0x945d2['model'];if(_0x1ba26f[_0xf303('0x2d')][_0xf303('0x44')]){_0x4598dd[_0xf303('0x3d')]=[{'all':!![]}];}_0x4598dd=_[_0xf303('0x3a')]({},_0x4598dd,_0x1ba26f[_0xf303('0x3c')]);return db[_0xf303('0x2a')][_0xf303('0x45')](_0x4598dd)[_0xf303('0x20')](handleEntityNotFound(_0xd23fdf,null))[_0xf303('0x20')](respondWithResult(_0xd23fdf,null))[_0xf303('0x40')](handleError(_0xd23fdf,null));};exports[_0xf303('0x46')]=function(_0x390823,_0x4471bd){return db['AnalyticCustomReport'][_0xf303('0x46')](_0x390823[_0xf303('0x47')],{})['then'](function(_0x397b52){var _0x53f5da=_0x390823[_0xf303('0x48')][_0xf303('0x22')]({'plain':!![]});if(!_0x53f5da)throw new Error(_0xf303('0x49'));if(_0x53f5da['role']===_0xf303('0x48')){var _0x1a15ee=_0x397b52['get']({'plain':!![]});var _0x5c4a40=_0xf303('0x4a');return db[_0xf303('0x4b')][_0xf303('0x45')]({'where':{'name':_0x5c4a40,'userProfileId':_0x53f5da['userProfileId']},'raw':!![]})['then'](function(_0x25164f){if(_0x25164f&&_0x25164f[_0xf303('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x1a15ee['name'],'resourceId':_0x1a15ee['id'],'type':_0xf303('0x23'),'sectionId':_0x25164f['id']},{})[_0xf303('0x20')](function(){return _0x397b52;});}else{return _0x397b52;}})['catch'](function(_0x3d2365){logger[_0xf303('0x24')](_0xf303('0x4d'),_0x3d2365);throw _0x3d2365;});}return _0x397b52;})['then'](respondWithResult(_0x4471bd,0xc9))[_0xf303('0x40')](handleError(_0x4471bd,null));};exports[_0xf303('0x1f')]=function(_0x400eae,_0x36f8fb){if(_0x400eae['body']['id']){delete _0x400eae[_0xf303('0x47')]['id'];}return db[_0xf303('0x2a')][_0xf303('0x45')]({'where':{'id':_0x400eae['params']['id']}})[_0xf303('0x20')](handleEntityNotFound(_0x36f8fb,null))['then'](saveUpdates(_0x400eae[_0xf303('0x47')],null))[_0xf303('0x20')](respondWithResult(_0x36f8fb,null))[_0xf303('0x40')](handleError(_0x36f8fb,null));};exports[_0xf303('0x21')]=function(_0x56ce21,_0x5c0ca9){return db['AnalyticCustomReport'][_0xf303('0x45')]({'where':{'id':_0x56ce21[_0xf303('0x42')]['id']}})[_0xf303('0x20')](handleEntityNotFound(_0x5c0ca9,null))[_0xf303('0x20')](removeEntity(_0x5c0ca9,null))[_0xf303('0x40')](handleError(_0x5c0ca9,null));};exports[_0xf303('0x4e')]=function(_0x5563af,_0x73fca6){var _0x140e2a=0xa;var _0x8f3e94=[_0xf303('0x4f'),_0xf303('0x50'),'right_join',_0xf303('0x51')];var _0x464953={'SUM':_0xf303('0x52'),'COUNT':_0xf303('0x53'),'COUNT DISTINCT':_0xf303('0x54'),'MAX':_0xf303('0x55'),'MIN':_0xf303('0x56'),'AVG':_0xf303('0x57'),'GROUP_CONCAT':_0xf303('0x58'),'GROUP_CONCAT ASC':_0xf303('0x59'),'GROUP_CONCAT DESC':_0xf303('0x5a')};var _0x35d69a={'SEC_TO_TIME':_0xf303('0x5b'),'DATE':_0xf303('0x5c'),'HOUR':'HOUR(%s)','ROUND':_0xf303('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x540897=function(_0x59fca5){return!_[_0xf303('0x5e')]([_0xf303('0x5f'),_0xf303('0x60'),_0xf303('0x61'),_0xf303('0x62')],_0x59fca5);};var _0x3915d6=function(_0x1fb974){if(!_0x1fb974||!_0x1fb974['rules'][_0xf303('0x33')]){return'';}for(var _0x156988='(',_0x46d0f3=0x0;_0x46d0f3<_0x1fb974['rules'][_0xf303('0x33')];_0x46d0f3+=0x1){_0x46d0f3>0x0&&(_0x156988+='\x20'+_0x1fb974[_0xf303('0x63')]+'\x20');_0x156988+=_0x1fb974['rules'][_0x46d0f3]['group']?_0x3915d6(_0x1fb974[_0xf303('0x64')][_0x46d0f3][_0xf303('0x65')]):_0x1fb974['rules'][_0x46d0f3][_0xf303('0x66')]+'\x20'+_0x1fb974['rules'][_0x46d0f3][_0xf303('0x67')]+(_0x540897(_0x1fb974['rules'][_0x46d0f3][_0xf303('0x67')])?'\x20'+_0x1fb974[_0xf303('0x64')][_0x46d0f3][_0xf303('0x68')]:'');}return _0x156988+')';};var _0x107771={'where':{'id':_0x5563af[_0xf303('0x42')]['id']}},_0x384698,_0x2460d5,_0x12d547,_0x4dd43a,_0x2494c4;_0x107771=_[_0xf303('0x3a')]({},_0x107771,_0x5563af[_0xf303('0x3c')]);return db[_0xf303('0x2a')][_0xf303('0x45')](_0x107771)[_0xf303('0x20')](function(_0x413253){if(_0x413253){_0x384698=_0x413253;return _0x413253[_0xf303('0x69')]();}return null;})['then'](function(_0x4e6593){if(_0x4e6593){if(!_0x4e6593[_0xf303('0x33')]){throw new db[(_0xf303('0x6a'))][(_0xf303('0x6b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2460d5=_0x4e6593;return db[_0xf303('0x6c')]['findAll']({'raw':!![]});}return null;})[_0xf303('0x20')](function(_0x44fce4){if(_0x44fce4){_0x12d547=_[_0xf303('0x6d')](_0x44fce4,'id');var _0x5c2fb1;var _0xdf6c7e=squel['select']();_0xdf6c7e[_0xf303('0x6e')](_0x384698[_0xf303('0x6f')]);for(var _0x15644a=0x0;_0x15644a<_0x2460d5[_0xf303('0x33')];_0x15644a+=0x1){_0x5c2fb1=_0x2460d5[_0x15644a][_0xf303('0x70')]?_0x12d547[_0x2460d5[_0x15644a]['MetricId']][_0xf303('0x71')]:_0x2460d5[_0x15644a][_0xf303('0x66')];_0x5c2fb1=_0x2460d5[_0x15644a][_0xf303('0x72')]?_[_0xf303('0x73')](_0x464953[_0x2460d5[_0x15644a][_0xf303('0x72')]],'%s',_0x5c2fb1):_0x5c2fb1;_0x5c2fb1=_0x2460d5[_0x15644a][_0xf303('0x74')]?_['replace'](_0x35d69a[_0x2460d5[_0x15644a][_0xf303('0x74')]],'%s',_0x5c2fb1):_0x5c2fb1;if(_0x2460d5[_0x15644a][_0xf303('0x75')]){_0xdf6c7e[_0xf303('0x65')](_0x5c2fb1);}_0x2460d5[_0x15644a][_0xf303('0x76')]&&_0xdf6c7e[_0xf303('0x35')](_0x5c2fb1,_0x2460d5[_0x15644a][_0xf303('0x76')]===_0xf303('0x77')?![]:!![]);_0xdf6c7e[_0xf303('0x66')](_0x5c2fb1,_0x2460d5[_0x15644a][_0xf303('0x78')]||_0x5c2fb1);}if(_0x384698[_0xf303('0x79')]){_0x384698[_0xf303('0x79')]=JSON[_0xf303('0x7a')](_0x384698['joins']);for(var _0x157328=0x0;_0x157328<_0x384698[_0xf303('0x79')][_0xf303('0x33')];_0x157328+=0x1){if(_0x384698[_0xf303('0x79')][_0x157328]['type']&&_['includes'](_0x8f3e94,_0x384698[_0xf303('0x79')][_0x157328][_0xf303('0x7b')])&&_0x384698[_0xf303('0x79')][_0x157328][_0xf303('0x7c')]&&_0x384698['joins'][_0x157328][_0xf303('0x7d')]&&_0x384698[_0xf303('0x79')][_0x157328][_0xf303('0x7e')]){_0xdf6c7e[_0x384698[_0xf303('0x79')][_0x157328][_0xf303('0x7b')]](_0x384698['joins'][_0x157328][_0xf303('0x7d')],null,util['format'](_0xf303('0x7f'),_0x384698[_0xf303('0x6f')],_0x384698[_0xf303('0x79')][_0x157328][_0xf303('0x7c')],_0x384698['joins'][_0x157328][_0xf303('0x7d')],_0x384698[_0xf303('0x79')][_0x157328]['foreignKey']));}}}if(_0x384698[_0xf303('0x80')]){_0x384698[_0xf303('0x80')]=JSON[_0xf303('0x7a')](_0x384698['conditions']);_0xdf6c7e[_0xf303('0x37')](_0x3915d6(_0x384698[_0xf303('0x80')]['group']));}_0x2494c4=_0xdf6c7e[_0xf303('0x81')]();_0xdf6c7e['limit'](_0x140e2a);_0xdf6c7e['offset'](0x0);logger['debug']('Limited\x20Query:',_0xdf6c7e[_0xf303('0x82')]());return db['sequelize']['query'](_0xdf6c7e[_0xf303('0x82')](),{'type':db[_0xf303('0x83')][_0xf303('0x84')][_0xf303('0x85')]});}})[_0xf303('0x20')](respondWithResult(_0x73fca6,null))[_0xf303('0x40')](handleError(_0x73fca6,null));};function runReport(_0x257be9,_0x4f47d9,_0x117533){var _0x44f6d0=_0x4f47d9[_0xf303('0x26')];var _0x3b46c2=0xa;var _0x140630=[_0xf303('0x4f'),_0xf303('0x50'),_0xf303('0x86'),_0xf303('0x51')];var _0x48555={'SUM':_0xf303('0x52'),'COUNT':_0xf303('0x53'),'COUNT DISTINCT':_0xf303('0x54'),'MAX':_0xf303('0x55'),'MIN':_0xf303('0x56'),'AVG':_0xf303('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xf303('0x5a')};var _0x28d081={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xf303('0x87'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xf303('0x88')};var _0x34c63e=function(_0x5d2e15){return!_[_0xf303('0x5e')](['IS\x20NULL','IS\x20NOT\x20NULL',_0xf303('0x61'),_0xf303('0x62')],_0x5d2e15);};var _0x3c55c2=function(_0xdf2842){if(!_0xdf2842||!_0xdf2842[_0xf303('0x64')][_0xf303('0x33')]){return'';}for(var _0x2d054f='(',_0x255e45=0x0;_0x255e45<_0xdf2842[_0xf303('0x64')][_0xf303('0x33')];_0x255e45+=0x1){_0x255e45>0x0&&(_0x2d054f+='\x20'+_0xdf2842[_0xf303('0x63')]+'\x20');_0x2d054f+=_0xdf2842[_0xf303('0x64')][_0x255e45]['group']?_0x3c55c2(_0xdf2842[_0xf303('0x64')][_0x255e45][_0xf303('0x65')]):_0xdf2842[_0xf303('0x64')][_0x255e45][_0xf303('0x66')]+'\x20'+_0xdf2842[_0xf303('0x64')][_0x255e45][_0xf303('0x67')]+(_0x34c63e(_0xdf2842['rules'][_0x255e45][_0xf303('0x67')])?'\x20'+_0xdf2842[_0xf303('0x64')][_0x255e45][_0xf303('0x68')]:'');}return _0x2d054f+')';};var _0x6b536a={'where':{'id':_0x257be9['id']}},_0x5d112c,_0x59cf24,_0x8872e8,_0x3a7631,_0x1c6361;_0x6b536a=_[_0xf303('0x3a')]({},_0x6b536a,_0x117533);return db[_0xf303('0x2a')][_0xf303('0x45')](_0x6b536a)[_0xf303('0x20')](function(_0x530d37){if(_0x530d37){_0x5d112c=_0x530d37;return _0x530d37[_0xf303('0x69')]();}return null;})['then'](function(_0x220f9d){if(_0x220f9d){if(!_0x220f9d[_0xf303('0x33')]){throw new db[(_0xf303('0x6a'))]['ValidationErrorItem'](_0xf303('0x89'),0x193);}_0x59cf24=_0x220f9d;return db[_0xf303('0x6c')][_0xf303('0x3e')]({'raw':!![]});}return null;})[_0xf303('0x20')](function(_0x19cb6e){if(_0x19cb6e){_0x8872e8=_[_0xf303('0x6d')](_0x19cb6e,'id');var _0x2f51f8;var _0x2b35a4=squel[_0xf303('0x8a')]();_0x2b35a4['from'](_0x5d112c['table']);for(var _0x588838=0x0;_0x588838<_0x59cf24['length'];_0x588838+=0x1){_0x2f51f8=_0x59cf24[_0x588838][_0xf303('0x70')]?_0x8872e8[_0x59cf24[_0x588838][_0xf303('0x70')]]['metric']:_0x59cf24[_0x588838][_0xf303('0x66')];_0x2f51f8=_0x59cf24[_0x588838]['function']?_[_0xf303('0x73')](_0x48555[_0x59cf24[_0x588838][_0xf303('0x72')]],'%s',_0x2f51f8):_0x2f51f8;_0x2f51f8=_0x59cf24[_0x588838][_0xf303('0x74')]?_[_0xf303('0x73')](_0x28d081[_0x59cf24[_0x588838]['format']],'%s',_0x2f51f8):_0x2f51f8;if(_0x59cf24[_0x588838][_0xf303('0x75')]){_0x2b35a4[_0xf303('0x65')](_0x2f51f8);}_0x59cf24[_0x588838][_0xf303('0x76')]&&_0x2b35a4[_0xf303('0x35')](_0x2f51f8,_0x59cf24[_0x588838][_0xf303('0x76')]===_0xf303('0x77')?![]:!![]);_0x2b35a4[_0xf303('0x66')](_0x2f51f8,_0x59cf24[_0x588838][_0xf303('0x78')]||_0x2f51f8);}if(_0x5d112c[_0xf303('0x79')]){_0x5d112c['joins']=JSON[_0xf303('0x7a')](_0x5d112c[_0xf303('0x79')]);for(var _0x892efb=0x0;_0x892efb<_0x5d112c[_0xf303('0x79')][_0xf303('0x33')];_0x892efb+=0x1){if(_0x5d112c['joins'][_0x892efb][_0xf303('0x7b')]&&_[_0xf303('0x5e')](_0x140630,_0x5d112c['joins'][_0x892efb][_0xf303('0x7b')])&&_0x5d112c[_0xf303('0x79')][_0x892efb][_0xf303('0x7c')]&&_0x5d112c[_0xf303('0x79')][_0x892efb]['foreignTable']&&_0x5d112c[_0xf303('0x79')][_0x892efb][_0xf303('0x7e')]){_0x2b35a4[_0x5d112c['joins'][_0x892efb]['type']](_0x5d112c[_0xf303('0x79')][_0x892efb][_0xf303('0x7d')],null,util[_0xf303('0x74')](_0xf303('0x7f'),_0x5d112c[_0xf303('0x6f')],_0x5d112c[_0xf303('0x79')][_0x892efb][_0xf303('0x7c')],_0x5d112c[_0xf303('0x79')][_0x892efb][_0xf303('0x7d')],_0x5d112c[_0xf303('0x79')][_0x892efb][_0xf303('0x7e')]));}}}if(_0x5d112c[_0xf303('0x80')]){_0x5d112c[_0xf303('0x80')]=JSON['parse'](_0x5d112c['conditions']);_0x2b35a4[_0xf303('0x37')](_0x3c55c2(_0x5d112c[_0xf303('0x80')]['group']));}_0x1c6361=_0x2b35a4[_0xf303('0x81')]();_0x2b35a4[_0xf303('0x1c')](_0x3b46c2);_0x2b35a4[_0xf303('0x1b')](0x0);logger[_0xf303('0x8b')]('Limited\x20Query:',_0x2b35a4[_0xf303('0x82')]());return db[_0xf303('0x83')][_0xf303('0x2d')](_0x2b35a4[_0xf303('0x82')](),{'type':db[_0xf303('0x83')][_0xf303('0x84')][_0xf303('0x85')]});}})[_0xf303('0x20')](function(_0x33e588){if(!_0x33e588[_0xf303('0x33')]){throw new db[(_0xf303('0x6a'))][(_0xf303('0x6b'))](_0xf303('0x8c'),0xcc);}if(_0x4f47d9[_0xf303('0x8d')]===_0xf303('0x8e')){return null;}var _0x75bfd5=_[_0xf303('0x3a')](_0x4f47d9,{'name':_0x4f47d9['fullPath']||_0x4f47d9[_0xf303('0x26')]||_0x5d112c[_0xf303('0x26')],'basename':_0x44f6d0,'savename':util[_0xf303('0x74')](_0xf303('0x8f'),_0x4f47d9[_0xf303('0x26')]||_0x5d112c[_0xf303('0x26')],require(_0xf303('0x90'))[_0xf303('0x91')](0x4),_0x4f47d9['output']||_0xf303('0x92')),'reportId':_0x5d112c['id'],'reportType':_0xf303('0x93')});return db[_0xf303('0x94')][_0xf303('0x46')](_0x75bfd5,{'raw':!![]});})[_0xf303('0x20')](function(_0x80dcf8){if(_0x5d112c[_0xf303('0x6f')]===_0xf303('0x95')){_0x1c6361[_0xf303('0x37')](_0x5d112c[_0xf303('0x6f')]+_0xf303('0x96'),_0x4f47d9[_0xf303('0x97')],_0x4f47d9[_0xf303('0x98')]);}else{_0x1c6361[_0xf303('0x37')](_0x5d112c[_0xf303('0x6f')]+_0xf303('0x99'),_0x4f47d9[_0xf303('0x97')],_0x4f47d9[_0xf303('0x98')]);}if(_0x80dcf8){logger[_0xf303('0x9a')]('Run\x20Query:',_0x1c6361[_0xf303('0x82')]());require('child_process')['fork'](path[_0xf303('0x4f')](__dirname,'../../components/export/',_0x80dcf8[_0xf303('0x8d')]),[_0x80dcf8['id'],_0x1c6361[_0xf303('0x82')](),path['join'](__dirname,_0xf303('0x9b'),_0x80dcf8[_0xf303('0x9c')]),_0x44f6d0]);return _0x80dcf8;}else{var _0x16d2a7=squel['select']();_0x16d2a7[_0xf303('0x6e')]('('+_0x1c6361[_0xf303('0x82')]()+')',_0xf303('0x9d'));_0x16d2a7[_0xf303('0x66')](_0xf303('0x9e'),_0xf303('0x1a'));_0x1c6361[_0xf303('0x1c')](_0x4f47d9[_0xf303('0x1c')]||_0x3b46c2);_0x1c6361[_0xf303('0x1b')](_0x4f47d9[_0xf303('0x1b')]||0x0);return db[_0xf303('0x83')][_0xf303('0x2d')](_0x16d2a7[_0xf303('0x82')](),{'type':db['sequelize'][_0xf303('0x84')][_0xf303('0x85')]})[_0xf303('0x20')](function(_0x1b2d40){if(!_0x1b2d40['length']){_0x3a7631=0x0;}else{_0x3a7631=_0x1b2d40[0x0][_0xf303('0x1a')]||0x0;}return db[_0xf303('0x83')][_0xf303('0x2d')](_0x1c6361[_0xf303('0x82')](),{'type':db[_0xf303('0x83')][_0xf303('0x84')][_0xf303('0x85')]});})[_0xf303('0x20')](function(_0x5275f8){return{'rows':_0x5275f8||[],'count':_0x3a7631};});}});}exports[_0xf303('0x9f')]=function(_0x4e925b,_0x443bb2){return runReport(_0x4e925b['params'],_0x4e925b['query'],_0x4e925b[_0xf303('0x3c')])['then'](respondWithResult(_0x443bb2,null))[_0xf303('0x40')](handleError(_0x443bb2,null));};exports[_0xf303('0xa0')]=runReport;exports[_0xf303('0x2d')]=function(_0xfb379,_0x31bac6){var _0xe9d31e=0xa;var _0x3906ac=[_0xf303('0x4f'),_0xf303('0x50'),_0xf303('0x86'),'cross_join'];var _0xe43834={'SUM':_0xf303('0x52'),'COUNT':_0xf303('0x53'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xf303('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xf303('0x59'),'GROUP_CONCAT DESC':_0xf303('0x5a')};var _0x12c2bd={'SEC_TO_TIME':_0xf303('0x5b'),'DATE':_0xf303('0x5c'),'HOUR':_0xf303('0x87'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xf303('0x88')};var _0x149441=function(_0x68dc0){return!_[_0xf303('0x5e')]([_0xf303('0x5f'),'IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x68dc0);};var _0x3dad9c=function(_0x206c4b){if(!_0x206c4b||!_0x206c4b['rules'][_0xf303('0x33')]){return'';}for(var _0x127352='(',_0x4f2673=0x0;_0x4f2673<_0x206c4b[_0xf303('0x64')]['length'];_0x4f2673+=0x1){_0x4f2673>0x0&&(_0x127352+='\x20'+_0x206c4b[_0xf303('0x63')]+'\x20');_0x127352+=_0x206c4b['rules'][_0x4f2673][_0xf303('0x65')]?_0x3dad9c(_0x206c4b['rules'][_0x4f2673][_0xf303('0x65')]):_0x206c4b[_0xf303('0x64')][_0x4f2673][_0xf303('0x66')]+'\x20'+_0x206c4b[_0xf303('0x64')][_0x4f2673][_0xf303('0x67')]+(_0x149441(_0x206c4b[_0xf303('0x64')][_0x4f2673][_0xf303('0x67')])?'\x20'+_0x206c4b[_0xf303('0x64')][_0x4f2673]['value']:'');}return _0x127352+')';};var _0x258f97={'where':{'id':_0xfb379['params']['id']}},_0xc302c0,_0x59e875,_0x22b0a3,_0x2f6910,_0x340d31;_0x258f97=_['merge']({},_0x258f97,_0xfb379[_0xf303('0x3c')]);return db['AnalyticCustomReport'][_0xf303('0x45')](_0x258f97)['then'](function(_0x14373c){if(_0x14373c){_0xc302c0=_0x14373c;return _0x14373c['getFields']();}return null;})[_0xf303('0x20')](function(_0x201ff7){if(_0x201ff7){if(!_0x201ff7[_0xf303('0x33')]){throw new db[(_0xf303('0x6a'))][(_0xf303('0x6b'))](_0xf303('0x89'),0x193);}_0x59e875=_0x201ff7;return db['AnalyticMetric'][_0xf303('0x3e')]({'raw':!![]});}return null;})[_0xf303('0x20')](function(_0x54792c){if(_0x54792c){_0x22b0a3=_[_0xf303('0x6d')](_0x54792c,'id');var _0x20cfdc;var _0x5db197=squel[_0xf303('0x8a')]();_0x5db197[_0xf303('0x6e')](_0xc302c0[_0xf303('0x6f')]);for(var _0x509151=0x0;_0x509151<_0x59e875['length'];_0x509151+=0x1){_0x20cfdc=_0x59e875[_0x509151]['MetricId']?_0x22b0a3[_0x59e875[_0x509151][_0xf303('0x70')]][_0xf303('0x71')]:_0x59e875[_0x509151]['field'];_0x20cfdc=_0x59e875[_0x509151]['function']?_['replace'](_0xe43834[_0x59e875[_0x509151][_0xf303('0x72')]],'%s',_0x20cfdc):_0x20cfdc;_0x20cfdc=_0x59e875[_0x509151][_0xf303('0x74')]?_[_0xf303('0x73')](_0x12c2bd[_0x59e875[_0x509151][_0xf303('0x74')]],'%s',_0x20cfdc):_0x20cfdc;if(_0x59e875[_0x509151][_0xf303('0x75')]){_0x5db197['group'](_0x20cfdc);}_0x59e875[_0x509151][_0xf303('0x76')]&&_0x5db197[_0xf303('0x35')](_0x20cfdc,_0x59e875[_0x509151][_0xf303('0x76')]===_0xf303('0x77')?![]:!![]);_0x5db197[_0xf303('0x66')](_0x20cfdc,_0x59e875[_0x509151][_0xf303('0x78')]||_0x20cfdc);}if(_0xc302c0['joins']){_0xc302c0[_0xf303('0x79')]=JSON[_0xf303('0x7a')](_0xc302c0[_0xf303('0x79')]);for(var _0x2955a3=0x0;_0x2955a3<_0xc302c0[_0xf303('0x79')][_0xf303('0x33')];_0x2955a3+=0x1){if(_0xc302c0[_0xf303('0x79')][_0x2955a3][_0xf303('0x7b')]&&_[_0xf303('0x5e')](_0x3906ac,_0xc302c0[_0xf303('0x79')][_0x2955a3][_0xf303('0x7b')])&&_0xc302c0[_0xf303('0x79')][_0x2955a3][_0xf303('0x7c')]&&_0xc302c0[_0xf303('0x79')][_0x2955a3]['foreignTable']&&_0xc302c0['joins'][_0x2955a3][_0xf303('0x7e')]){_0x5db197[_0xc302c0[_0xf303('0x79')][_0x2955a3][_0xf303('0x7b')]](_0xc302c0[_0xf303('0x79')][_0x2955a3][_0xf303('0x7d')],null,util[_0xf303('0x74')](_0xf303('0x7f'),_0xc302c0[_0xf303('0x6f')],_0xc302c0[_0xf303('0x79')][_0x2955a3][_0xf303('0x7c')],_0xc302c0[_0xf303('0x79')][_0x2955a3][_0xf303('0x7d')],_0xc302c0['joins'][_0x2955a3][_0xf303('0x7e')]));}}}if(_0xc302c0[_0xf303('0x80')]){_0xc302c0[_0xf303('0x80')]=JSON[_0xf303('0x7a')](_0xc302c0['conditions']);_0x5db197[_0xf303('0x37')](_0x3dad9c(_0xc302c0[_0xf303('0x80')]['group']));}_0x340d31=_0x5db197[_0xf303('0x81')]();_0x5db197[_0xf303('0x1c')](_0xe9d31e);_0x5db197[_0xf303('0x1b')](0x0);logger[_0xf303('0x8b')](_0xf303('0xa1'),_0x5db197[_0xf303('0x82')]());return db[_0xf303('0x83')][_0xf303('0x2d')](_0x5db197[_0xf303('0x82')](),{'type':db[_0xf303('0x83')]['QueryTypes'][_0xf303('0x85')]});}})[_0xf303('0x20')](function(){return{'sql':_0x340d31['toString']()};})[_0xf303('0x20')](respondWithResult(_0x31bac6,null))['catch'](handleError(_0x31bac6,null));}; \ No newline at end of file +var _0xc70a=['rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','options','include','findAll','rows','catch','show','params','attributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','table','MetricId','metric','replace','function','format','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','COUNT(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','operator','condition','keyBy','select','debug','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','run','runReport','right_join','UNIX_TIMESTAMP(%s)','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','CustomReports','UserProfileResource','error','stack','name','index','map','AnalyticCustomReport'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xc70a,0x78));var _0xac70=function(_0x2a84b3,_0x5d9e86){_0x2a84b3=_0x2a84b3-0x0;var _0x31c578=_0xc70a[_0x2a84b3];return _0x31c578;};'use strict';var pdf=require(_0xac70('0x0'));var emlformat=require(_0xac70('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xac70('0x2'));var rp=require(_0xac70('0x3'));var moment=require(_0xac70('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xac70('0x5'));var util=require(_0xac70('0x6'));var path=require(_0xac70('0x7'));var sox=require(_0xac70('0x8'));var csv=require(_0xac70('0x9'));var ejs=require(_0xac70('0xa'));var fs=require('fs');var _=require(_0xac70('0xb'));var squel=require(_0xac70('0xc'));var crypto=require(_0xac70('0xd'));var jsforce=require(_0xac70('0xe'));var deskjs=require(_0xac70('0xf'));var toCsv=require(_0xac70('0x9'));var querystring=require(_0xac70('0x10'));var Papa=require(_0xac70('0x11'));var Redis=require(_0xac70('0x12'));var authService=require(_0xac70('0x13'));var qs=require(_0xac70('0x14'));var as=require(_0xac70('0x15'));var hardwareService=require(_0xac70('0x16'));var logger=require('../../config/logger')(_0xac70('0x17'));var utils=require(_0xac70('0x18'));var config=require(_0xac70('0x19'));var db=require(_0xac70('0x1a'))['db'];function respondWithStatusCode(_0x2aad90,_0x101628){_0x101628=_0x101628||0xcc;return function(_0x4223cf){if(_0x4223cf){return _0x2aad90[_0xac70('0x1b')](_0x101628);}return _0x2aad90[_0xac70('0x1c')](_0x101628)[_0xac70('0x1d')]();};}function respondWithResult(_0x3a40d7,_0x44a782){_0x44a782=_0x44a782||0xc8;return function(_0x558445){if(_0x558445){return _0x3a40d7[_0xac70('0x1c')](_0x44a782)[_0xac70('0x1e')](_0x558445);}};}function respondWithFilteredResult(_0x2f714f,_0x55ace2){return function(_0x33147a){if(_0x33147a){var _0x184f76=_0x33147a[_0xac70('0x1f')],_0x38336a=_0x55ace2[_0xac70('0x20')],_0x229d26=_0x55ace2[_0xac70('0x20')]+_0x55ace2[_0xac70('0x21')],_0x4ac46a;if(_0x229d26>=_0x184f76){_0x229d26=_0x184f76;_0x4ac46a=0xc8;}else{_0x4ac46a=0xce;}_0x2f714f[_0xac70('0x1c')](_0x4ac46a);return _0x2f714f[_0xac70('0x22')](_0xac70('0x23'),_0x38336a+'-'+_0x229d26+'/'+_0x184f76)[_0xac70('0x1e')](_0x33147a);}return null;};}function patchUpdates(_0x26924f){return function(_0x4a8bd2){try{jsonpatch['apply'](_0x4a8bd2,_0x26924f,!![]);}catch(_0x1d988c){return BPromise[_0xac70('0x24')](_0x1d988c);}return _0x4a8bd2[_0xac70('0x25')]();};}function saveUpdates(_0x5c04e3,_0x1aed38){return function(_0x420ed4){if(_0x420ed4){return _0x420ed4[_0xac70('0x26')](_0x5c04e3)[_0xac70('0x27')](function(_0x56b186){return _0x56b186;});}return null;};}function removeEntity(_0x4338de,_0x3a8df6){return function(_0x4591d7){if(_0x4591d7){return _0x4591d7[_0xac70('0x28')]()[_0xac70('0x27')](function(){var _0x16aa1d=_0x4591d7['get']({'plain':!![]});var _0x577c65=_0xac70('0x29');return db[_0xac70('0x2a')]['destroy']({'where':{'type':_0x577c65,'resourceId':_0x16aa1d['id']}})[_0xac70('0x27')](function(){return _0x4591d7;});})[_0xac70('0x27')](function(){_0x4338de[_0xac70('0x1c')](0xcc)[_0xac70('0x1d')]();});}};}function handleEntityNotFound(_0x2be991,_0x567906){return function(_0x18044b){if(!_0x18044b){_0x2be991[_0xac70('0x1b')](0x194);}return _0x18044b;};}function handleError(_0x456ed0,_0x3c95fc){_0x3c95fc=_0x3c95fc||0x1f4;return function(_0x6d4a92){logger[_0xac70('0x2b')](_0x6d4a92[_0xac70('0x2c')]);if(_0x6d4a92[_0xac70('0x2d')]){delete _0x6d4a92['name'];}_0x456ed0[_0xac70('0x1c')](_0x3c95fc)['send'](_0x6d4a92);};}exports[_0xac70('0x2e')]=function(_0x2ada49,_0x2036d5){var _0x14f1fd={},_0xfb33b2={},_0x22684c={'count':0x0,'rows':[]};var _0x166106=_[_0xac70('0x2f')](db[_0xac70('0x30')][_0xac70('0x31')],function(_0x23df5e){return{'name':_0x23df5e[_0xac70('0x32')],'type':_0x23df5e[_0xac70('0x33')][_0xac70('0x34')]};});_0xfb33b2[_0xac70('0x35')]=_[_0xac70('0x2f')](_0x166106,_0xac70('0x2d'));_0xfb33b2[_0xac70('0x36')]=_['keys'](_0x2ada49[_0xac70('0x36')]);_0xfb33b2[_0xac70('0x37')]=_[_0xac70('0x38')](_0xfb33b2[_0xac70('0x35')],_0xfb33b2[_0xac70('0x36')]);_0x14f1fd['attributes']=_[_0xac70('0x38')](_0xfb33b2[_0xac70('0x35')],qs['fields'](_0x2ada49[_0xac70('0x36')][_0xac70('0x39')]));_0x14f1fd['attributes']=_0x14f1fd['attributes'][_0xac70('0x3a')]?_0x14f1fd['attributes']:_0xfb33b2[_0xac70('0x35')];if(!_0x2ada49['query'][_0xac70('0x3b')](_0xac70('0x3c'))){_0x14f1fd[_0xac70('0x21')]=qs[_0xac70('0x21')](_0x2ada49['query']['limit']);_0x14f1fd[_0xac70('0x20')]=qs['offset'](_0x2ada49[_0xac70('0x36')][_0xac70('0x20')]);}_0x14f1fd['order']=qs[_0xac70('0x3d')](_0x2ada49[_0xac70('0x36')][_0xac70('0x3d')]);_0x14f1fd['where']=qs['filters'](_[_0xac70('0x3e')](_0x2ada49['query'],_0xfb33b2[_0xac70('0x37')]));if(_0x2ada49[_0xac70('0x36')][_0xac70('0x3f')]){_0x14f1fd['where']=_[_0xac70('0x40')](_0x14f1fd[_0xac70('0x41')],{'$or':_['map'](_0x166106,function(_0x1e20b0){if(_0x1e20b0[_0xac70('0x33')]!=='VIRTUAL'){var _0x3f7e29={};_0x3f7e29[_0x1e20b0['name']]={'$like':'%'+_0x2ada49[_0xac70('0x36')]['filter']+'%'};return _0x3f7e29;}})});}_0x14f1fd=_[_0xac70('0x40')]({},_0x14f1fd,_0x2ada49[_0xac70('0x42')]);var _0x5dce7b={'where':_0x14f1fd['where']};return db[_0xac70('0x30')][_0xac70('0x1f')](_0x5dce7b)[_0xac70('0x27')](function(_0x2d99dc){_0x22684c[_0xac70('0x1f')]=_0x2d99dc;if(_0x2ada49[_0xac70('0x36')]['includeAll']){_0x14f1fd[_0xac70('0x43')]=[{'all':!![]}];}return db[_0xac70('0x30')][_0xac70('0x44')](_0x14f1fd);})[_0xac70('0x27')](function(_0xa4b11f){_0x22684c[_0xac70('0x45')]=_0xa4b11f;return _0x22684c;})[_0xac70('0x27')](respondWithFilteredResult(_0x2036d5,_0x14f1fd))[_0xac70('0x46')](handleError(_0x2036d5,null));};exports[_0xac70('0x47')]=function(_0x24052f,_0x1e92c5){var _0x2e1e7b={'raw':![],'where':{'id':_0x24052f[_0xac70('0x48')]['id']}},_0x2c6db7={};_0x2c6db7[_0xac70('0x35')]=_['keys'](db[_0xac70('0x30')][_0xac70('0x31')]);_0x2c6db7[_0xac70('0x36')]=_['keys'](_0x24052f[_0xac70('0x36')]);_0x2c6db7[_0xac70('0x37')]=_['intersection'](_0x2c6db7[_0xac70('0x35')],_0x2c6db7[_0xac70('0x36')]);_0x2e1e7b[_0xac70('0x49')]=_[_0xac70('0x38')](_0x2c6db7['model'],qs[_0xac70('0x39')](_0x24052f[_0xac70('0x36')][_0xac70('0x39')]));_0x2e1e7b['attributes']=_0x2e1e7b[_0xac70('0x49')][_0xac70('0x3a')]?_0x2e1e7b[_0xac70('0x49')]:_0x2c6db7[_0xac70('0x35')];if(_0x24052f[_0xac70('0x36')][_0xac70('0x4a')]){_0x2e1e7b[_0xac70('0x43')]=[{'all':!![]}];}_0x2e1e7b=_['merge']({},_0x2e1e7b,_0x24052f[_0xac70('0x42')]);return db[_0xac70('0x30')][_0xac70('0x4b')](_0x2e1e7b)[_0xac70('0x27')](handleEntityNotFound(_0x1e92c5,null))[_0xac70('0x27')](respondWithResult(_0x1e92c5,null))[_0xac70('0x46')](handleError(_0x1e92c5,null));};exports[_0xac70('0x4c')]=function(_0x314138,_0x3a14c1){return db[_0xac70('0x30')][_0xac70('0x4c')](_0x314138[_0xac70('0x4d')],{})[_0xac70('0x27')](function(_0x359d4d){var _0x3ca267=_0x314138[_0xac70('0x4e')]['get']({'plain':!![]});if(!_0x3ca267)throw new Error(_0xac70('0x4f'));if(_0x3ca267[_0xac70('0x50')]===_0xac70('0x4e')){var _0x5cdc68=_0x359d4d['get']({'plain':!![]});var _0x2bf011=_0xac70('0x51');return db[_0xac70('0x52')][_0xac70('0x4b')]({'where':{'name':_0x2bf011,'userProfileId':_0x3ca267[_0xac70('0x53')]},'raw':!![]})[_0xac70('0x27')](function(_0x156837){if(_0x156837&&_0x156837[_0xac70('0x54')]===0x0){return db['UserProfileResource'][_0xac70('0x4c')]({'name':_0x5cdc68[_0xac70('0x2d')],'resourceId':_0x5cdc68['id'],'type':_0xac70('0x29'),'sectionId':_0x156837['id']},{})[_0xac70('0x27')](function(){return _0x359d4d;});}else{return _0x359d4d;}})[_0xac70('0x46')](function(_0x442d79){logger[_0xac70('0x2b')](_0xac70('0x55'),_0x442d79);throw _0x442d79;});}return _0x359d4d;})[_0xac70('0x27')](respondWithResult(_0x3a14c1,0xc9))[_0xac70('0x46')](handleError(_0x3a14c1,null));};exports[_0xac70('0x26')]=function(_0x18e5f0,_0x173e72){if(_0x18e5f0[_0xac70('0x4d')]['id']){delete _0x18e5f0['body']['id'];}return db[_0xac70('0x30')][_0xac70('0x4b')]({'where':{'id':_0x18e5f0[_0xac70('0x48')]['id']}})['then'](handleEntityNotFound(_0x173e72,null))[_0xac70('0x27')](saveUpdates(_0x18e5f0[_0xac70('0x4d')],null))[_0xac70('0x27')](respondWithResult(_0x173e72,null))['catch'](handleError(_0x173e72,null));};exports['destroy']=function(_0x246571,_0x42c641){return db[_0xac70('0x30')]['find']({'where':{'id':_0x246571[_0xac70('0x48')]['id']}})['then'](handleEntityNotFound(_0x42c641,null))[_0xac70('0x27')](removeEntity(_0x42c641,null))[_0xac70('0x46')](handleError(_0x42c641,null));};exports['preview']=function(_0x1ac7fd,_0x376c6f){var _0x57d034=0xa;var _0x35da1a=[_0xac70('0x56'),'left_join','right_join','cross_join'];var _0x456053={'SUM':_0xac70('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xac70('0x58'),'MAX':_0xac70('0x59'),'MIN':_0xac70('0x5a'),'AVG':_0xac70('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xac70('0x5c')};var _0x20c48c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xac70('0x5d'),'HOUR':_0xac70('0x5e'),'ROUND':_0xac70('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x175a3a=function(_0xf28bba){return!_[_0xac70('0x60')]([_0xac70('0x61'),_0xac70('0x62'),_0xac70('0x63'),_0xac70('0x64')],_0xf28bba);};var _0x2f9cec=function(_0x48e6c6){if(!_0x48e6c6||!_0x48e6c6[_0xac70('0x65')][_0xac70('0x3a')]){return'';}for(var _0x5dd88b='(',_0x1ada2d=0x0;_0x1ada2d<_0x48e6c6['rules'][_0xac70('0x3a')];_0x1ada2d+=0x1){_0x1ada2d>0x0&&(_0x5dd88b+='\x20'+_0x48e6c6['operator']+'\x20');_0x5dd88b+=_0x48e6c6[_0xac70('0x65')][_0x1ada2d][_0xac70('0x66')]?_0x2f9cec(_0x48e6c6['rules'][_0x1ada2d][_0xac70('0x66')]):_0x48e6c6['rules'][_0x1ada2d][_0xac70('0x67')]+'\x20'+_0x48e6c6[_0xac70('0x65')][_0x1ada2d]['condition']+(_0x175a3a(_0x48e6c6[_0xac70('0x65')][_0x1ada2d]['condition'])?'\x20'+_0x48e6c6[_0xac70('0x65')][_0x1ada2d][_0xac70('0x68')]:'');}return _0x5dd88b+')';};var _0x1253ce={'where':{'id':_0x1ac7fd['params']['id']}},_0x470a6e,_0x2d4ef7,_0x4b2d96,_0x50eae6,_0x161ca3;_0x1253ce=_['merge']({},_0x1253ce,_0x1ac7fd[_0xac70('0x42')]);return db[_0xac70('0x30')][_0xac70('0x4b')](_0x1253ce)[_0xac70('0x27')](function(_0xd3cc5f){if(_0xd3cc5f){_0x470a6e=_0xd3cc5f;return _0xd3cc5f[_0xac70('0x69')]();}return null;})['then'](function(_0x4ce87e){if(_0x4ce87e){if(!_0x4ce87e['length']){throw new db[(_0xac70('0x6a'))][(_0xac70('0x6b'))](_0xac70('0x6c'),0x193);}_0x2d4ef7=_0x4ce87e;return db[_0xac70('0x6d')]['findAll']({'raw':!![]});}return null;})[_0xac70('0x27')](function(_0x24403c){if(_0x24403c){_0x4b2d96=_['keyBy'](_0x24403c,'id');var _0x46a564;var _0x23690c=squel['select']();_0x23690c[_0xac70('0x6e')](_0x470a6e[_0xac70('0x6f')]);for(var _0x254c0e=0x0;_0x254c0e<_0x2d4ef7[_0xac70('0x3a')];_0x254c0e+=0x1){_0x46a564=_0x2d4ef7[_0x254c0e][_0xac70('0x70')]?_0x4b2d96[_0x2d4ef7[_0x254c0e][_0xac70('0x70')]][_0xac70('0x71')]:_0x2d4ef7[_0x254c0e]['field'];_0x46a564=_0x2d4ef7[_0x254c0e]['function']?_[_0xac70('0x72')](_0x456053[_0x2d4ef7[_0x254c0e][_0xac70('0x73')]],'%s',_0x46a564):_0x46a564;_0x46a564=_0x2d4ef7[_0x254c0e][_0xac70('0x74')]?_[_0xac70('0x72')](_0x20c48c[_0x2d4ef7[_0x254c0e]['format']],'%s',_0x46a564):_0x46a564;if(_0x2d4ef7[_0x254c0e][_0xac70('0x75')]){_0x23690c['group'](_0x46a564);}_0x2d4ef7[_0x254c0e][_0xac70('0x76')]&&_0x23690c[_0xac70('0x77')](_0x46a564,_0x2d4ef7[_0x254c0e][_0xac70('0x76')]===_0xac70('0x78')?![]:!![]);_0x23690c['field'](_0x46a564,_0x2d4ef7[_0x254c0e][_0xac70('0x79')]||_0x46a564);}if(_0x470a6e[_0xac70('0x7a')]){_0x470a6e[_0xac70('0x7a')]=JSON[_0xac70('0x7b')](_0x470a6e[_0xac70('0x7a')]);for(var _0x5520ce=0x0;_0x5520ce<_0x470a6e[_0xac70('0x7a')][_0xac70('0x3a')];_0x5520ce+=0x1){if(_0x470a6e[_0xac70('0x7a')][_0x5520ce]['type']&&_[_0xac70('0x60')](_0x35da1a,_0x470a6e['joins'][_0x5520ce]['type'])&&_0x470a6e[_0xac70('0x7a')][_0x5520ce][_0xac70('0x7c')]&&_0x470a6e[_0xac70('0x7a')][_0x5520ce][_0xac70('0x7d')]&&_0x470a6e['joins'][_0x5520ce][_0xac70('0x7e')]){_0x23690c[_0x470a6e['joins'][_0x5520ce][_0xac70('0x33')]](_0x470a6e[_0xac70('0x7a')][_0x5520ce][_0xac70('0x7d')],null,util[_0xac70('0x74')](_0xac70('0x7f'),_0x470a6e[_0xac70('0x6f')],_0x470a6e[_0xac70('0x7a')][_0x5520ce][_0xac70('0x7c')],_0x470a6e[_0xac70('0x7a')][_0x5520ce]['foreignTable'],_0x470a6e[_0xac70('0x7a')][_0x5520ce][_0xac70('0x7e')]));}}}if(_0x470a6e[_0xac70('0x80')]){_0x470a6e[_0xac70('0x80')]=JSON[_0xac70('0x7b')](_0x470a6e[_0xac70('0x80')]);_0x23690c['where'](_0x2f9cec(_0x470a6e[_0xac70('0x80')][_0xac70('0x66')]));}_0x161ca3=_0x23690c[_0xac70('0x81')]();_0x23690c[_0xac70('0x21')](_0x57d034);_0x23690c[_0xac70('0x20')](0x0);logger['debug'](_0xac70('0x82'),_0x23690c[_0xac70('0x83')]());return db['sequelize'][_0xac70('0x36')](_0x23690c[_0xac70('0x83')](),{'type':db[_0xac70('0x84')][_0xac70('0x85')][_0xac70('0x86')]});}})['then'](respondWithResult(_0x376c6f,null))[_0xac70('0x46')](handleError(_0x376c6f,null));};function runReport(_0x2461ca,_0x9fa968,_0x18c947){var _0x3ebf49=_0x9fa968[_0xac70('0x2d')];var _0x543c21=0xa;var _0x5d931c=[_0xac70('0x56'),_0xac70('0x87'),'right_join','cross_join'];var _0x2dad0a={'SUM':_0xac70('0x57'),'COUNT':_0xac70('0x88'),'COUNT DISTINCT':_0xac70('0x58'),'MAX':_0xac70('0x59'),'MIN':_0xac70('0x5a'),'AVG':_0xac70('0x5b'),'GROUP_CONCAT':_0xac70('0x89'),'GROUP_CONCAT ASC':_0xac70('0x8a'),'GROUP_CONCAT DESC':_0xac70('0x5c')};var _0x596c31={'SEC_TO_TIME':_0xac70('0x8b'),'DATE':_0xac70('0x5d'),'HOUR':_0xac70('0x5e'),'ROUND':_0xac70('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5e122=function(_0x2a70dc){return!_[_0xac70('0x60')](['IS\x20NULL',_0xac70('0x62'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x2a70dc);};var _0x21ec54=function(_0x1cbab6){if(!_0x1cbab6||!_0x1cbab6[_0xac70('0x65')]['length']){return'';}for(var _0x2f9b87='(',_0x2a1fc0=0x0;_0x2a1fc0<_0x1cbab6[_0xac70('0x65')][_0xac70('0x3a')];_0x2a1fc0+=0x1){_0x2a1fc0>0x0&&(_0x2f9b87+='\x20'+_0x1cbab6[_0xac70('0x8c')]+'\x20');_0x2f9b87+=_0x1cbab6[_0xac70('0x65')][_0x2a1fc0][_0xac70('0x66')]?_0x21ec54(_0x1cbab6[_0xac70('0x65')][_0x2a1fc0][_0xac70('0x66')]):_0x1cbab6['rules'][_0x2a1fc0]['field']+'\x20'+_0x1cbab6[_0xac70('0x65')][_0x2a1fc0][_0xac70('0x8d')]+(_0x5e122(_0x1cbab6[_0xac70('0x65')][_0x2a1fc0]['condition'])?'\x20'+_0x1cbab6[_0xac70('0x65')][_0x2a1fc0]['value']:'');}return _0x2f9b87+')';};var _0x67f5d0={'where':{'id':_0x2461ca['id']}},_0x2b808f,_0x54761a,_0x1883fb,_0x1c564f,_0x199cdd;_0x67f5d0=_[_0xac70('0x40')]({},_0x67f5d0,_0x18c947);return db[_0xac70('0x30')][_0xac70('0x4b')](_0x67f5d0)[_0xac70('0x27')](function(_0x24098c){if(_0x24098c){_0x2b808f=_0x24098c;return _0x24098c[_0xac70('0x69')]();}return null;})['then'](function(_0x5aded1){if(_0x5aded1){if(!_0x5aded1['length']){throw new db[(_0xac70('0x6a'))][(_0xac70('0x6b'))](_0xac70('0x6c'),0x193);}_0x54761a=_0x5aded1;return db[_0xac70('0x6d')]['findAll']({'raw':!![]});}return null;})[_0xac70('0x27')](function(_0x3c1a64){if(_0x3c1a64){_0x1883fb=_[_0xac70('0x8e')](_0x3c1a64,'id');var _0x5da7e8;var _0x4a0ebf=squel[_0xac70('0x8f')]();_0x4a0ebf[_0xac70('0x6e')](_0x2b808f['table']);for(var _0x513190=0x0;_0x513190<_0x54761a[_0xac70('0x3a')];_0x513190+=0x1){_0x5da7e8=_0x54761a[_0x513190][_0xac70('0x70')]?_0x1883fb[_0x54761a[_0x513190][_0xac70('0x70')]][_0xac70('0x71')]:_0x54761a[_0x513190][_0xac70('0x67')];_0x5da7e8=_0x54761a[_0x513190][_0xac70('0x73')]?_['replace'](_0x2dad0a[_0x54761a[_0x513190][_0xac70('0x73')]],'%s',_0x5da7e8):_0x5da7e8;_0x5da7e8=_0x54761a[_0x513190][_0xac70('0x74')]?_[_0xac70('0x72')](_0x596c31[_0x54761a[_0x513190][_0xac70('0x74')]],'%s',_0x5da7e8):_0x5da7e8;if(_0x54761a[_0x513190][_0xac70('0x75')]){_0x4a0ebf[_0xac70('0x66')](_0x5da7e8);}_0x54761a[_0x513190]['orderBy']&&_0x4a0ebf[_0xac70('0x77')](_0x5da7e8,_0x54761a[_0x513190][_0xac70('0x76')]===_0xac70('0x78')?![]:!![]);_0x4a0ebf[_0xac70('0x67')](_0x5da7e8,_0x54761a[_0x513190][_0xac70('0x79')]||_0x5da7e8);}if(_0x2b808f[_0xac70('0x7a')]){_0x2b808f[_0xac70('0x7a')]=JSON[_0xac70('0x7b')](_0x2b808f[_0xac70('0x7a')]);for(var _0x4e120b=0x0;_0x4e120b<_0x2b808f[_0xac70('0x7a')][_0xac70('0x3a')];_0x4e120b+=0x1){if(_0x2b808f[_0xac70('0x7a')][_0x4e120b]['type']&&_[_0xac70('0x60')](_0x5d931c,_0x2b808f['joins'][_0x4e120b][_0xac70('0x33')])&&_0x2b808f['joins'][_0x4e120b][_0xac70('0x7c')]&&_0x2b808f['joins'][_0x4e120b][_0xac70('0x7d')]&&_0x2b808f[_0xac70('0x7a')][_0x4e120b][_0xac70('0x7e')]){_0x4a0ebf[_0x2b808f['joins'][_0x4e120b][_0xac70('0x33')]](_0x2b808f[_0xac70('0x7a')][_0x4e120b][_0xac70('0x7d')],null,util[_0xac70('0x74')](_0xac70('0x7f'),_0x2b808f[_0xac70('0x6f')],_0x2b808f[_0xac70('0x7a')][_0x4e120b]['parentKey'],_0x2b808f[_0xac70('0x7a')][_0x4e120b][_0xac70('0x7d')],_0x2b808f[_0xac70('0x7a')][_0x4e120b][_0xac70('0x7e')]));}}}if(_0x2b808f[_0xac70('0x80')]){_0x2b808f[_0xac70('0x80')]=JSON[_0xac70('0x7b')](_0x2b808f[_0xac70('0x80')]);_0x4a0ebf[_0xac70('0x41')](_0x21ec54(_0x2b808f[_0xac70('0x80')]['group']));}_0x199cdd=_0x4a0ebf['clone']();_0x4a0ebf[_0xac70('0x21')](_0x543c21);_0x4a0ebf[_0xac70('0x20')](0x0);logger[_0xac70('0x90')](_0xac70('0x82'),_0x4a0ebf[_0xac70('0x83')]());return db['sequelize'][_0xac70('0x36')](_0x4a0ebf[_0xac70('0x83')](),{'type':db[_0xac70('0x84')][_0xac70('0x85')][_0xac70('0x86')]});}})[_0xac70('0x27')](function(_0x2e6bb1){if(!_0x2e6bb1[_0xac70('0x3a')]){throw new db[(_0xac70('0x6a'))]['ValidationErrorItem'](_0xac70('0x91'),0xcc);}if(_0x9fa968[_0xac70('0x92')]===_0xac70('0x93')){return null;}var _0x4754f7=_[_0xac70('0x40')](_0x9fa968,{'name':_0x9fa968[_0xac70('0x94')]||_0x9fa968['name']||_0x2b808f[_0xac70('0x2d')],'basename':_0x3ebf49,'savename':util[_0xac70('0x74')](_0xac70('0x95'),_0x9fa968[_0xac70('0x2d')]||_0x2b808f[_0xac70('0x2d')],require(_0xac70('0x96'))[_0xac70('0x97')](0x4),_0x9fa968[_0xac70('0x92')]||_0xac70('0x98')),'reportId':_0x2b808f['id'],'reportType':_0xac70('0x99')});return db[_0xac70('0x9a')][_0xac70('0x4c')](_0x4754f7,{'raw':!![]});})[_0xac70('0x27')](function(_0x1b600f){if(_0x2b808f[_0xac70('0x6f')]==='cdr'){_0x199cdd[_0xac70('0x41')](_0x2b808f[_0xac70('0x6f')]+_0xac70('0x9b'),_0x9fa968[_0xac70('0x9c')],_0x9fa968['endDate']);}else{_0x199cdd[_0xac70('0x41')](_0x2b808f[_0xac70('0x6f')]+_0xac70('0x9d'),_0x9fa968[_0xac70('0x9c')],_0x9fa968['endDate']);}if(_0x1b600f){logger[_0xac70('0x9e')](_0xac70('0x9f'),_0x199cdd[_0xac70('0x83')]());require(_0xac70('0xa0'))['fork'](path[_0xac70('0x56')](__dirname,_0xac70('0xa1'),_0x1b600f['output']),[_0x1b600f['id'],_0x199cdd['toString'](),path[_0xac70('0x56')](__dirname,_0xac70('0xa2'),_0x1b600f[_0xac70('0xa3')]),_0x3ebf49]);return _0x1b600f;}else{var _0x4a39ff=squel[_0xac70('0x8f')]();_0x4a39ff[_0xac70('0x6e')]('('+_0x199cdd[_0xac70('0x83')]()+')',_0xac70('0xa4'));_0x4a39ff[_0xac70('0x67')]('COUNT(*)',_0xac70('0x1f'));_0x199cdd[_0xac70('0x21')](_0x9fa968[_0xac70('0x21')]||_0x543c21);_0x199cdd[_0xac70('0x20')](_0x9fa968['offset']||0x0);return db[_0xac70('0x84')]['query'](_0x4a39ff[_0xac70('0x83')](),{'type':db[_0xac70('0x84')][_0xac70('0x85')][_0xac70('0x86')]})['then'](function(_0xe31029){if(!_0xe31029[_0xac70('0x3a')]){_0x1c564f=0x0;}else{_0x1c564f=_0xe31029[0x0][_0xac70('0x1f')]||0x0;}return db['sequelize'][_0xac70('0x36')](_0x199cdd[_0xac70('0x83')](),{'type':db['sequelize']['QueryTypes'][_0xac70('0x86')]});})[_0xac70('0x27')](function(_0x430f47){return{'rows':_0x430f47||[],'count':_0x1c564f};});}});}exports[_0xac70('0xa5')]=function(_0x3db92d,_0x18559e){return runReport(_0x3db92d[_0xac70('0x48')],_0x3db92d[_0xac70('0x36')],_0x3db92d[_0xac70('0x42')])[_0xac70('0x27')](respondWithResult(_0x18559e,null))[_0xac70('0x46')](handleError(_0x18559e,null));};exports[_0xac70('0xa6')]=runReport;exports[_0xac70('0x36')]=function(_0x50d96a,_0x2ce938){var _0xeec31=0xa;var _0x14d223=[_0xac70('0x56'),_0xac70('0x87'),_0xac70('0xa7'),'cross_join'];var _0xd64c5={'SUM':'SUM(%s)','COUNT':_0xac70('0x88'),'COUNT DISTINCT':_0xac70('0x58'),'MAX':_0xac70('0x59'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xac70('0x89'),'GROUP_CONCAT ASC':_0xac70('0x8a'),'GROUP_CONCAT DESC':_0xac70('0x5c')};var _0x1a928e={'SEC_TO_TIME':_0xac70('0x8b'),'DATE':_0xac70('0x5d'),'HOUR':_0xac70('0x5e'),'ROUND':_0xac70('0x5f'),'UNIX_TIMESTAMP':_0xac70('0xa8')};var _0x536d12=function(_0x1e0baa){return!_[_0xac70('0x60')]([_0xac70('0x61'),'IS\x20NOT\x20NULL',_0xac70('0x63'),_0xac70('0x64')],_0x1e0baa);};var _0x348138=function(_0x15419a){if(!_0x15419a||!_0x15419a['rules']['length']){return'';}for(var _0x432548='(',_0x6bd7ac=0x0;_0x6bd7ac<_0x15419a[_0xac70('0x65')][_0xac70('0x3a')];_0x6bd7ac+=0x1){_0x6bd7ac>0x0&&(_0x432548+='\x20'+_0x15419a[_0xac70('0x8c')]+'\x20');_0x432548+=_0x15419a[_0xac70('0x65')][_0x6bd7ac][_0xac70('0x66')]?_0x348138(_0x15419a[_0xac70('0x65')][_0x6bd7ac][_0xac70('0x66')]):_0x15419a[_0xac70('0x65')][_0x6bd7ac][_0xac70('0x67')]+'\x20'+_0x15419a[_0xac70('0x65')][_0x6bd7ac][_0xac70('0x8d')]+(_0x536d12(_0x15419a['rules'][_0x6bd7ac][_0xac70('0x8d')])?'\x20'+_0x15419a[_0xac70('0x65')][_0x6bd7ac]['value']:'');}return _0x432548+')';};var _0x5a132e={'where':{'id':_0x50d96a[_0xac70('0x48')]['id']}},_0x30516d,_0x33fe99,_0x4012a0,_0x3a40b1,_0x5ca3f5;_0x5a132e=_[_0xac70('0x40')]({},_0x5a132e,_0x50d96a['options']);return db[_0xac70('0x30')][_0xac70('0x4b')](_0x5a132e)[_0xac70('0x27')](function(_0x7c81a8){if(_0x7c81a8){_0x30516d=_0x7c81a8;return _0x7c81a8['getFields']();}return null;})['then'](function(_0x1eec0f){if(_0x1eec0f){if(!_0x1eec0f['length']){throw new db[(_0xac70('0x6a'))][(_0xac70('0x6b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x33fe99=_0x1eec0f;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xac70('0x27')](function(_0x1496df){if(_0x1496df){_0x4012a0=_['keyBy'](_0x1496df,'id');var _0x750364;var _0x281fdc=squel[_0xac70('0x8f')]();_0x281fdc[_0xac70('0x6e')](_0x30516d['table']);for(var _0x264c6f=0x0;_0x264c6f<_0x33fe99[_0xac70('0x3a')];_0x264c6f+=0x1){_0x750364=_0x33fe99[_0x264c6f][_0xac70('0x70')]?_0x4012a0[_0x33fe99[_0x264c6f][_0xac70('0x70')]][_0xac70('0x71')]:_0x33fe99[_0x264c6f][_0xac70('0x67')];_0x750364=_0x33fe99[_0x264c6f][_0xac70('0x73')]?_[_0xac70('0x72')](_0xd64c5[_0x33fe99[_0x264c6f]['function']],'%s',_0x750364):_0x750364;_0x750364=_0x33fe99[_0x264c6f][_0xac70('0x74')]?_[_0xac70('0x72')](_0x1a928e[_0x33fe99[_0x264c6f]['format']],'%s',_0x750364):_0x750364;if(_0x33fe99[_0x264c6f][_0xac70('0x75')]){_0x281fdc[_0xac70('0x66')](_0x750364);}_0x33fe99[_0x264c6f][_0xac70('0x76')]&&_0x281fdc['order'](_0x750364,_0x33fe99[_0x264c6f][_0xac70('0x76')]==='DESC'?![]:!![]);_0x281fdc['field'](_0x750364,_0x33fe99[_0x264c6f][_0xac70('0x79')]||_0x750364);}if(_0x30516d[_0xac70('0x7a')]){_0x30516d[_0xac70('0x7a')]=JSON[_0xac70('0x7b')](_0x30516d[_0xac70('0x7a')]);for(var _0x5d5a0d=0x0;_0x5d5a0d<_0x30516d[_0xac70('0x7a')][_0xac70('0x3a')];_0x5d5a0d+=0x1){if(_0x30516d[_0xac70('0x7a')][_0x5d5a0d][_0xac70('0x33')]&&_['includes'](_0x14d223,_0x30516d[_0xac70('0x7a')][_0x5d5a0d][_0xac70('0x33')])&&_0x30516d[_0xac70('0x7a')][_0x5d5a0d][_0xac70('0x7c')]&&_0x30516d[_0xac70('0x7a')][_0x5d5a0d][_0xac70('0x7d')]&&_0x30516d[_0xac70('0x7a')][_0x5d5a0d][_0xac70('0x7e')]){_0x281fdc[_0x30516d[_0xac70('0x7a')][_0x5d5a0d]['type']](_0x30516d[_0xac70('0x7a')][_0x5d5a0d][_0xac70('0x7d')],null,util[_0xac70('0x74')](_0xac70('0x7f'),_0x30516d[_0xac70('0x6f')],_0x30516d[_0xac70('0x7a')][_0x5d5a0d]['parentKey'],_0x30516d['joins'][_0x5d5a0d][_0xac70('0x7d')],_0x30516d[_0xac70('0x7a')][_0x5d5a0d][_0xac70('0x7e')]));}}}if(_0x30516d['conditions']){_0x30516d[_0xac70('0x80')]=JSON[_0xac70('0x7b')](_0x30516d['conditions']);_0x281fdc[_0xac70('0x41')](_0x348138(_0x30516d[_0xac70('0x80')][_0xac70('0x66')]));}_0x5ca3f5=_0x281fdc[_0xac70('0x81')]();_0x281fdc[_0xac70('0x21')](_0xeec31);_0x281fdc[_0xac70('0x20')](0x0);logger[_0xac70('0x90')]('Limited\x20Query:',_0x281fdc[_0xac70('0x83')]());return db[_0xac70('0x84')][_0xac70('0x36')](_0x281fdc[_0xac70('0x83')](),{'type':db[_0xac70('0x84')][_0xac70('0x85')][_0xac70('0x86')]});}})['then'](function(){return{'sql':_0x5ca3f5[_0xac70('0x83')]()};})['then'](respondWithResult(_0x2ce938,null))[_0xac70('0x46')](handleError(_0x2ce938,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index a5f5eb3..27fcd1b 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 _0x2177=['./analyticCustomReport.attributes','exports','analytics_custom_reports','lodash','api','bluebird','path','rimraf','../../config/environment'];(function(_0x4e4ba0,_0x4a2a0c){var _0x58fab5=function(_0x34233b){while(--_0x34233b){_0x4e4ba0['push'](_0x4e4ba0['shift']());}};_0x58fab5(++_0x4a2a0c);}(_0x2177,0xae));var _0x7217=function(_0x531cb8,_0x8ef36f){_0x531cb8=_0x531cb8-0x0;var _0x5cf297=_0x2177[_0x531cb8];return _0x5cf297;};'use strict';var _=require(_0x7217('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7217('0x1'));var moment=require('moment');var BPromise=require(_0x7217('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7217('0x3'));var rimraf=require(_0x7217('0x4'));var config=require(_0x7217('0x5'));var attributes=require(_0x7217('0x6'));module[_0x7217('0x7')]=function(_0x4327b2,_0x216aa0){return _0x4327b2['define']('AnalyticCustomReport',attributes,{'tableName':_0x7217('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x769e=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./analyticCustomReport.attributes','define','analytics_custom_reports'];(function(_0x5b36bd,_0x4dfb36){var _0x1614fe=function(_0x559b7c){while(--_0x559b7c){_0x5b36bd['push'](_0x5b36bd['shift']());}};_0x1614fe(++_0x4dfb36);}(_0x769e,0x1ce));var _0xe769=function(_0x44e5d5,_0x4ea86b){_0x44e5d5=_0x44e5d5-0x0;var _0x78e719=_0x769e[_0x44e5d5];return _0x78e719;};'use strict';var _=require(_0xe769('0x0'));var util=require(_0xe769('0x1'));var logger=require(_0xe769('0x2'))('api');var moment=require(_0xe769('0x3'));var BPromise=require(_0xe769('0x4'));var rp=require(_0xe769('0x5'));var fs=require('fs');var path=require(_0xe769('0x6'));var rimraf=require(_0xe769('0x7'));var config=require('../../config/environment');var attributes=require(_0xe769('0x8'));module['exports']=function(_0x129eca,_0x170879){return _0x129eca[_0xe769('0x9')]('AnalyticCustomReport',attributes,{'tableName':_0xe769('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 01d18f6..69983d9 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 _0x9555=['rpc','jayson/promise','client','http','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x21e49f,_0x47679e){var _0x3ef8e5=function(_0x296a7e){while(--_0x296a7e){_0x21e49f['push'](_0x21e49f['shift']());}};_0x3ef8e5(++_0x47679e);}(_0x9555,0x1a0));var _0x5955=function(_0x111c00,_0x19906c){_0x111c00=_0x111c00-0x0;var _0x1314ad=_0x9555[_0x111c00];return _0x1314ad;};'use strict';var _=require(_0x5955('0x0'));var util=require(_0x5955('0x1'));var moment=require(_0x5955('0x2'));var BPromise=require(_0x5955('0x3'));var rs=require(_0x5955('0x4'));var fs=require('fs');var Redis=require(_0x5955('0x5'));var db=require(_0x5955('0x6'))['db'];var utils=require(_0x5955('0x7'));var logger=require(_0x5955('0x8'))(_0x5955('0x9'));var config=require('../../config/environment');var jayson=require(_0x5955('0xa'));var client=jayson[_0x5955('0xb')][_0x5955('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c0dd6,_0x39fb20,_0x50cd45){return new BPromise(function(_0xfdb3ac,_0x48dda7){return client['request'](_0x5c0dd6,_0x50cd45)[_0x5955('0xd')](function(_0x5ca2bb){logger[_0x5955('0xe')](_0x5955('0xf'),_0x39fb20,_0x5955('0x10'));logger[_0x5955('0x11')](_0x5955('0x12'),_0x39fb20,_0x5955('0x10'),JSON[_0x5955('0x13')](_0x5ca2bb));if(_0x5ca2bb[_0x5955('0x14')]){if(_0x5ca2bb[_0x5955('0x14')][_0x5955('0x15')]===0x1f4){logger[_0x5955('0x14')](_0x5955('0xf'),_0x39fb20,_0x5ca2bb[_0x5955('0x14')][_0x5955('0x16')]);return _0x48dda7(_0x5ca2bb[_0x5955('0x14')][_0x5955('0x16')]);}logger[_0x5955('0x14')](_0x5955('0xf'),_0x39fb20,_0x5ca2bb[_0x5955('0x14')][_0x5955('0x16')]);return _0xfdb3ac(_0x5ca2bb[_0x5955('0x14')][_0x5955('0x16')]);}else{logger[_0x5955('0xe')](_0x5955('0xf'),_0x39fb20,'request\x20sent');_0xfdb3ac(_0x5ca2bb[_0x5955('0x17')][_0x5955('0x16')]);}})[_0x5955('0x18')](function(_0x47f770){logger[_0x5955('0x14')](_0x5955('0xf'),_0x39fb20,_0x47f770);_0x48dda7(_0x47f770);});});} \ No newline at end of file +var _0xf37d=['error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf37d,0x123));var _0xdf37=function(_0x2cacef,_0xba1573){_0x2cacef=_0x2cacef-0x0;var _0x289ba6=_0xf37d[_0x2cacef];return _0x289ba6;};'use strict';var _=require(_0xdf37('0x0'));var util=require(_0xdf37('0x1'));var moment=require(_0xdf37('0x2'));var BPromise=require(_0xdf37('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf37('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdf37('0x5'))('rpc');var config=require(_0xdf37('0x6'));var jayson=require(_0xdf37('0x7'));var client=jayson[_0xdf37('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15883a,_0xd45787,_0x2fc252){return new BPromise(function(_0x4f306f,_0x4081cc){return client[_0xdf37('0x9')](_0x15883a,_0x2fc252)[_0xdf37('0xa')](function(_0x3e0b1f){logger[_0xdf37('0xb')](_0xdf37('0xc'),_0xd45787,_0xdf37('0xd'));logger[_0xdf37('0xe')](_0xdf37('0xf'),_0xd45787,_0xdf37('0xd'),JSON[_0xdf37('0x10')](_0x3e0b1f));if(_0x3e0b1f[_0xdf37('0x11')]){if(_0x3e0b1f[_0xdf37('0x11')][_0xdf37('0x12')]===0x1f4){logger[_0xdf37('0x11')](_0xdf37('0xc'),_0xd45787,_0x3e0b1f[_0xdf37('0x11')][_0xdf37('0x13')]);return _0x4081cc(_0x3e0b1f['error'][_0xdf37('0x13')]);}logger['error'](_0xdf37('0xc'),_0xd45787,_0x3e0b1f[_0xdf37('0x11')]['message']);return _0x4f306f(_0x3e0b1f['error']['message']);}else{logger['info'](_0xdf37('0xc'),_0xd45787,_0xdf37('0xd'));_0x4f306f(_0x3e0b1f[_0xdf37('0x14')][_0xdf37('0x13')]);}})[_0xdf37('0x15')](function(_0x644f93){logger[_0xdf37('0x11')](_0xdf37('0xc'),_0xd45787,_0x644f93);_0x4081cc(_0x644f93);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index de70ab8..863419c 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 _0xf497=['post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','query'];(function(_0x19dff3,_0x9ebd26){var _0x777195=function(_0x3b9da4){while(--_0x3b9da4){_0x19dff3['push'](_0x19dff3['shift']());}};_0x777195(++_0x9ebd26);}(_0xf497,0x1e9));var _0x7f49=function(_0x168731,_0x4098de){_0x168731=_0x168731-0x0;var _0x5b3cf2=_0xf497[_0x168731];return _0x5b3cf2;};'use strict';var multer=require(_0x7f49('0x0'));var util=require(_0x7f49('0x1'));var path=require(_0x7f49('0x2'));var timeout=require(_0x7f49('0x3'));var express=require(_0x7f49('0x4'));var router=express[_0x7f49('0x5')]();var auth=require(_0x7f49('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7f49('0x7'));var controller=require('./analyticCustomReport.controller');router[_0x7f49('0x8')]('/',auth[_0x7f49('0x9')](),controller[_0x7f49('0xa')]);router[_0x7f49('0x8')](_0x7f49('0xb'),auth['isAuthenticated'](),controller[_0x7f49('0xc')]);router[_0x7f49('0x8')](_0x7f49('0xd'),auth['isAuthenticated'](),controller[_0x7f49('0xe')]);router[_0x7f49('0x8')]('/:id/run',auth[_0x7f49('0x9')](),controller[_0x7f49('0xf')]);router[_0x7f49('0x8')]('/:id/query',auth[_0x7f49('0x9')](),controller[_0x7f49('0x10')]);router[_0x7f49('0x11')]('/',auth[_0x7f49('0x9')](),controller[_0x7f49('0x12')]);router[_0x7f49('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x7f49('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7f49('0x15')]=router; \ No newline at end of file +var _0x9899=['/:id/query','query','post','create','put','delete','destroy','multer','util','connect-timeout','express','Router','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview'];(function(_0x1b6aec,_0x5b9987){var _0x3270fc=function(_0x3e2e6e){while(--_0x3e2e6e){_0x1b6aec['push'](_0x1b6aec['shift']());}};_0x3270fc(++_0x5b9987);}(_0x9899,0x70));var _0x9989=function(_0x168055,_0x59a112){_0x168055=_0x168055-0x0;var _0x55808f=_0x9899[_0x168055];return _0x55808f;};'use strict';var multer=require(_0x9989('0x0'));var util=require(_0x9989('0x1'));var path=require('path');var timeout=require(_0x9989('0x2'));var express=require(_0x9989('0x3'));var router=express[_0x9989('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9989('0x5'));var controller=require(_0x9989('0x6'));router[_0x9989('0x7')]('/',auth[_0x9989('0x8')](),controller[_0x9989('0x9')]);router['get'](_0x9989('0xa'),auth[_0x9989('0x8')](),controller[_0x9989('0xb')]);router[_0x9989('0x7')](_0x9989('0xc'),auth[_0x9989('0x8')](),controller[_0x9989('0xd')]);router[_0x9989('0x7')]('/:id/run',auth[_0x9989('0x8')](),controller['run']);router[_0x9989('0x7')](_0x9989('0xe'),auth[_0x9989('0x8')](),controller[_0x9989('0xf')]);router[_0x9989('0x10')]('/',auth[_0x9989('0x8')](),controller[_0x9989('0x11')]);router[_0x9989('0x12')](_0x9989('0xa'),auth[_0x9989('0x8')](),controller['update']);router[_0x9989('0x13')](_0x9989('0xa'),auth['isAuthenticated'](),controller[_0x9989('0x14')]);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 c1b02d6..24ecf99 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 _0x1ab8=['TEXT','STRING'];(function(_0x3e7df5,_0x54328e){var _0x226da5=function(_0x3c602d){while(--_0x3c602d){_0x3e7df5['push'](_0x3e7df5['shift']());}};_0x226da5(++_0x54328e);}(_0x1ab8,0x9d));var _0x81ab=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x1ab8[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x81ab('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x81ab('0x0')]},'table':{'type':Sequelize[_0x81ab('0x0')]},'conditions':{'type':Sequelize[_0x81ab('0x1')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xad18=['TEXT','sequelize','exports','STRING'];(function(_0x499f93,_0x189132){var _0x2decf4=function(_0xa53e62){while(--_0xa53e62){_0x499f93['push'](_0x499f93['shift']());}};_0x2decf4(++_0x189132);}(_0xad18,0x99));var _0x8ad1=function(_0xf734c7,_0x2dc079){_0xf734c7=_0xf734c7-0x0;var _0xea90c6=_0xad18[_0xf734c7];return _0xea90c6;};'use strict';var Sequelize=require(_0x8ad1('0x0'));module[_0x8ad1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8ad1('0x2')]},'parent':{'type':Sequelize[_0x8ad1('0x2')]},'table':{'type':Sequelize[_0x8ad1('0x2')]},'conditions':{'type':Sequelize[_0x8ad1('0x3')]},'joins':{'type':Sequelize[_0x8ad1('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 26247a1..e7101e6 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 _0x256d=['query','keys','filters','attributes','model','fields','length','nolimit','limit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','intersection','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','keyBy','table','MetricId','metric','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','AVG(%s)','HOUR(%s)','includes','IS\x20NULL','IS\x20NOT\x20EMPTY','AnalyticMetric','select','from','function','replace','No\x20available\x20data','output','web','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','COUNT(*)','SELECT','run','runReport','getFields','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','DefaultReports','error','stack','name','send','index','map','AnalyticDefaultReport','fieldName','type','key'];(function(_0x3496ec,_0x36a47f){var _0x4aa3db=function(_0x28ba66){while(--_0x28ba66){_0x3496ec['push'](_0x3496ec['shift']());}};_0x4aa3db(++_0x36a47f);}(_0x256d,0x70));var _0xd256=function(_0x15e6fe,_0x1a5c39){_0x15e6fe=_0x15e6fe-0x0;var _0x34894d=_0x256d[_0x15e6fe];return _0x34894d;};'use strict';var pdf=require(_0xd256('0x0'));var emlformat=require(_0xd256('0x1'));var rimraf=require(_0xd256('0x2'));var zipdir=require(_0xd256('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd256('0x4'));var moment=require(_0xd256('0x5'));var BPromise=require(_0xd256('0x6'));var Mustache=require(_0xd256('0x7'));var util=require(_0xd256('0x8'));var path=require('path');var sox=require(_0xd256('0x9'));var csv=require(_0xd256('0xa'));var ejs=require(_0xd256('0xb'));var fs=require('fs');var _=require(_0xd256('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd256('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd256('0xa'));var querystring=require(_0xd256('0xe'));var Papa=require(_0xd256('0xf'));var Redis=require(_0xd256('0x10'));var authService=require(_0xd256('0x11'));var qs=require(_0xd256('0x12'));var as=require(_0xd256('0x13'));var hardwareService=require(_0xd256('0x14'));var logger=require(_0xd256('0x15'))(_0xd256('0x16'));var utils=require(_0xd256('0x17'));var config=require(_0xd256('0x18'));var db=require(_0xd256('0x19'))['db'];function respondWithStatusCode(_0x14cd70,_0x28e9d6){_0x28e9d6=_0x28e9d6||0xcc;return function(_0x452a82){if(_0x452a82){return _0x14cd70['sendStatus'](_0x28e9d6);}return _0x14cd70[_0xd256('0x1a')](_0x28e9d6)[_0xd256('0x1b')]();};}function respondWithResult(_0x14ceba,_0x470942){_0x470942=_0x470942||0xc8;return function(_0x450fe6){if(_0x450fe6){return _0x14ceba['status'](_0x470942)[_0xd256('0x1c')](_0x450fe6);}};}function respondWithFilteredResult(_0x9e9e,_0x8cae19){return function(_0xcb6f6b){if(_0xcb6f6b){var _0x5cdef5=_0xcb6f6b[_0xd256('0x1d')],_0x48387f=_0x8cae19[_0xd256('0x1e')],_0x80288f=_0x8cae19[_0xd256('0x1e')]+_0x8cae19['limit'],_0x2a4fe8;if(_0x80288f>=_0x5cdef5){_0x80288f=_0x5cdef5;_0x2a4fe8=0xc8;}else{_0x2a4fe8=0xce;}_0x9e9e[_0xd256('0x1a')](_0x2a4fe8);return _0x9e9e[_0xd256('0x1f')](_0xd256('0x20'),_0x48387f+'-'+_0x80288f+'/'+_0x5cdef5)[_0xd256('0x1c')](_0xcb6f6b);}return null;};}function patchUpdates(_0x549ee3){return function(_0x120d74){try{jsonpatch[_0xd256('0x21')](_0x120d74,_0x549ee3,!![]);}catch(_0x3fcd6d){return BPromise[_0xd256('0x22')](_0x3fcd6d);}return _0x120d74[_0xd256('0x23')]();};}function saveUpdates(_0x482fe1,_0x3b2281){return function(_0x37f10b){if(_0x37f10b){return _0x37f10b[_0xd256('0x24')](_0x482fe1)[_0xd256('0x25')](function(_0x333380){return _0x333380;});}return null;};}function removeEntity(_0x1df189,_0x20d100){return function(_0x4872bc){if(_0x4872bc){return _0x4872bc[_0xd256('0x26')]()[_0xd256('0x25')](function(){var _0x5494c4=_0x4872bc[_0xd256('0x27')]({'plain':!![]});var _0x1f159d=_0xd256('0x28');return db['UserProfileResource'][_0xd256('0x26')]({'where':{'type':_0x1f159d,'resourceId':_0x5494c4['id']}})[_0xd256('0x25')](function(){return _0x4872bc;});})[_0xd256('0x25')](function(){_0x1df189[_0xd256('0x1a')](0xcc)[_0xd256('0x1b')]();});}};}function handleEntityNotFound(_0x2d4ca7,_0x27a816){return function(_0xa77a3a){if(!_0xa77a3a){_0x2d4ca7['sendStatus'](0x194);}return _0xa77a3a;};}function handleError(_0x3a4792,_0x4042de){_0x4042de=_0x4042de||0x1f4;return function(_0x272826){logger[_0xd256('0x29')](_0x272826[_0xd256('0x2a')]);if(_0x272826[_0xd256('0x2b')]){delete _0x272826[_0xd256('0x2b')];}_0x3a4792['status'](_0x4042de)[_0xd256('0x2c')](_0x272826);};}exports[_0xd256('0x2d')]=function(_0x4abca6,_0x564281){var _0x53cc59={},_0x116a7e={},_0xe8d2d0={'count':0x0,'rows':[]};var _0x11ff7b=_[_0xd256('0x2e')](db[_0xd256('0x2f')]['rawAttributes'],function(_0x592aab){return{'name':_0x592aab[_0xd256('0x30')],'type':_0x592aab[_0xd256('0x31')][_0xd256('0x32')]};});_0x116a7e['model']=_[_0xd256('0x2e')](_0x11ff7b,'name');_0x116a7e[_0xd256('0x33')]=_[_0xd256('0x34')](_0x4abca6[_0xd256('0x33')]);_0x116a7e[_0xd256('0x35')]=_['intersection'](_0x116a7e['model'],_0x116a7e[_0xd256('0x33')]);_0x53cc59[_0xd256('0x36')]=_['intersection'](_0x116a7e[_0xd256('0x37')],qs[_0xd256('0x38')](_0x4abca6[_0xd256('0x33')][_0xd256('0x38')]));_0x53cc59[_0xd256('0x36')]=_0x53cc59[_0xd256('0x36')][_0xd256('0x39')]?_0x53cc59[_0xd256('0x36')]:_0x116a7e[_0xd256('0x37')];if(!_0x4abca6[_0xd256('0x33')]['hasOwnProperty'](_0xd256('0x3a'))){_0x53cc59[_0xd256('0x3b')]=qs[_0xd256('0x3b')](_0x4abca6['query'][_0xd256('0x3b')]);_0x53cc59[_0xd256('0x1e')]=qs[_0xd256('0x1e')](_0x4abca6[_0xd256('0x33')][_0xd256('0x1e')]);}_0x53cc59[_0xd256('0x3c')]=qs[_0xd256('0x3d')](_0x4abca6['query'][_0xd256('0x3d')]);_0x53cc59[_0xd256('0x3e')]=qs[_0xd256('0x35')](_['pick'](_0x4abca6[_0xd256('0x33')],_0x116a7e[_0xd256('0x35')]));if(_0x4abca6['query'][_0xd256('0x3f')]){_0x53cc59[_0xd256('0x3e')]=_[_0xd256('0x40')](_0x53cc59[_0xd256('0x3e')],{'$or':_[_0xd256('0x2e')](_0x11ff7b,function(_0x5635e4){if(_0x5635e4[_0xd256('0x31')]!=='VIRTUAL'){var _0x55901a={};_0x55901a[_0x5635e4[_0xd256('0x2b')]]={'$like':'%'+_0x4abca6[_0xd256('0x33')][_0xd256('0x3f')]+'%'};return _0x55901a;}})});}_0x53cc59=_[_0xd256('0x40')]({},_0x53cc59,_0x4abca6[_0xd256('0x41')]);var _0x489a01={'where':_0x53cc59[_0xd256('0x3e')]};return db[_0xd256('0x2f')][_0xd256('0x1d')](_0x489a01)['then'](function(_0x666eb9){_0xe8d2d0[_0xd256('0x1d')]=_0x666eb9;if(_0x4abca6[_0xd256('0x33')][_0xd256('0x42')]){_0x53cc59[_0xd256('0x43')]=[{'all':!![]}];}return db[_0xd256('0x2f')]['findAll'](_0x53cc59);})[_0xd256('0x25')](function(_0x1adccc){_0xe8d2d0[_0xd256('0x44')]=_0x1adccc;return _0xe8d2d0;})[_0xd256('0x25')](respondWithFilteredResult(_0x564281,_0x53cc59))[_0xd256('0x45')](handleError(_0x564281,null));};exports[_0xd256('0x46')]=function(_0xcfeb50,_0x3cfede){var _0x5c44fd={'raw':!![],'where':{'id':_0xcfeb50[_0xd256('0x47')]['id']}},_0x3f76ac={};_0x3f76ac[_0xd256('0x37')]=_[_0xd256('0x34')](db[_0xd256('0x2f')][_0xd256('0x48')]);_0x3f76ac['query']=_['keys'](_0xcfeb50[_0xd256('0x33')]);_0x3f76ac[_0xd256('0x35')]=_[_0xd256('0x49')](_0x3f76ac[_0xd256('0x37')],_0x3f76ac['query']);_0x5c44fd['attributes']=_[_0xd256('0x49')](_0x3f76ac[_0xd256('0x37')],qs[_0xd256('0x38')](_0xcfeb50['query'][_0xd256('0x38')]));_0x5c44fd['attributes']=_0x5c44fd[_0xd256('0x36')]['length']?_0x5c44fd[_0xd256('0x36')]:_0x3f76ac[_0xd256('0x37')];if(_0xcfeb50[_0xd256('0x33')][_0xd256('0x42')]){_0x5c44fd['include']=[{'all':!![]}];}_0x5c44fd=_[_0xd256('0x40')]({},_0x5c44fd,_0xcfeb50[_0xd256('0x41')]);return db[_0xd256('0x2f')][_0xd256('0x4a')](_0x5c44fd)[_0xd256('0x25')](handleEntityNotFound(_0x3cfede,null))[_0xd256('0x25')](respondWithResult(_0x3cfede,null))[_0xd256('0x45')](handleError(_0x3cfede,null));};exports[_0xd256('0x4b')]=function(_0x215be9,_0x4a85c9){return db[_0xd256('0x2f')][_0xd256('0x4b')](_0x215be9[_0xd256('0x4c')],{})['then'](function(_0x49a6f3){var _0x9b4c45=_0x215be9['user'][_0xd256('0x27')]({'plain':!![]});if(!_0x9b4c45)throw new Error(_0xd256('0x4d'));if(_0x9b4c45['role']===_0xd256('0x4e')){var _0x52aaf5=_0x49a6f3[_0xd256('0x27')]({'plain':!![]});var _0x567502='Reports';return db[_0xd256('0x4f')][_0xd256('0x4a')]({'where':{'name':_0x567502,'userProfileId':_0x9b4c45['userProfileId']},'raw':!![]})[_0xd256('0x25')](function(_0x540875){if(_0x540875&&_0x540875[_0xd256('0x50')]===0x0){return db['UserProfileResource'][_0xd256('0x4b')]({'name':_0x52aaf5[_0xd256('0x2b')],'resourceId':_0x52aaf5['id'],'type':_0xd256('0x28'),'sectionId':_0x540875['id']},{})['then'](function(){return _0x49a6f3;});}else{return _0x49a6f3;}})[_0xd256('0x45')](function(_0x2b2213){logger['error'](_0xd256('0x51'),_0x2b2213);throw _0x2b2213;});}return _0x49a6f3;})[_0xd256('0x25')](respondWithResult(_0x4a85c9,0xc9))[_0xd256('0x45')](handleError(_0x4a85c9,null));};exports[_0xd256('0x24')]=function(_0x2a72aa,_0x471d92){if(_0x2a72aa[_0xd256('0x4c')]['id']){delete _0x2a72aa[_0xd256('0x4c')]['id'];}return db[_0xd256('0x2f')][_0xd256('0x4a')]({'where':{'id':_0x2a72aa[_0xd256('0x47')]['id']}})[_0xd256('0x25')](handleEntityNotFound(_0x471d92,null))[_0xd256('0x25')](saveUpdates(_0x2a72aa[_0xd256('0x4c')],null))[_0xd256('0x25')](respondWithResult(_0x471d92,null))[_0xd256('0x45')](handleError(_0x471d92,null));};exports[_0xd256('0x26')]=function(_0x30b2f7,_0x366970){return db['AnalyticDefaultReport'][_0xd256('0x4a')]({'where':{'id':_0x30b2f7['params']['id']}})[_0xd256('0x25')](handleEntityNotFound(_0x366970,null))[_0xd256('0x25')](removeEntity(_0x366970,null))[_0xd256('0x45')](handleError(_0x366970,null));};exports['preview']=function(_0x5ad601,_0x10d867){var _0x136947=0xa;var _0x49e0bb=[_0xd256('0x52'),_0xd256('0x53'),_0xd256('0x54'),_0xd256('0x55')];var _0x58dbea={'SUM':_0xd256('0x56'),'COUNT':_0xd256('0x57'),'COUNT DISTINCT':_0xd256('0x58'),'MAX':_0xd256('0x59'),'MIN':_0xd256('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xd256('0x5b'),'GROUP_CONCAT ASC':_0xd256('0x5c'),'GROUP_CONCAT DESC':_0xd256('0x5d')};var _0x232035={'SEC_TO_TIME':_0xd256('0x5e'),'DATE':_0xd256('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0xd256('0x60'),'UNIX_TIMESTAMP':_0xd256('0x61')};var _0x34b7c7=function(_0x2e4827){return!_['includes'](['IS\x20NULL',_0xd256('0x62'),_0xd256('0x63'),'IS\x20NOT\x20EMPTY'],_0x2e4827);};var _0x5c1830=function(_0x4b486d){if(!_0x4b486d||!_0x4b486d[_0xd256('0x64')][_0xd256('0x39')]){return'';}for(var _0x3bd6a9='(',_0x150a9d=0x0;_0x150a9d<_0x4b486d[_0xd256('0x64')]['length'];_0x150a9d+=0x1){_0x150a9d>0x0&&(_0x3bd6a9+='\x20'+_0x4b486d[_0xd256('0x65')]+'\x20');_0x3bd6a9+=_0x4b486d[_0xd256('0x64')][_0x150a9d][_0xd256('0x66')]?_0x5c1830(_0x4b486d[_0xd256('0x64')][_0x150a9d]['group']):_0x4b486d[_0xd256('0x64')][_0x150a9d][_0xd256('0x67')]+'\x20'+_0x4b486d[_0xd256('0x64')][_0x150a9d][_0xd256('0x68')]+(_0x34b7c7(_0x4b486d[_0xd256('0x64')][_0x150a9d][_0xd256('0x68')])?'\x20'+_0x4b486d['rules'][_0x150a9d][_0xd256('0x69')]:'');}return _0x3bd6a9+')';};var _0x4ef13f={'where':{'id':_0x5ad601['params']['id']}},_0x1523c6,_0x44695b,_0x258bef,_0xd0009f,_0x18830a;_0x4ef13f=_[_0xd256('0x40')]({},_0x4ef13f,_0x5ad601['options']);return db['AnalyticDefaultReport']['find'](_0x4ef13f)['then'](function(_0x482c48){if(_0x482c48){_0x1523c6=_0x482c48;return _0x482c48['getFields']();}return null;})[_0xd256('0x25')](function(_0x13bb00){if(_0x13bb00){if(!_0x13bb00[_0xd256('0x39')]){throw new db[(_0xd256('0x6a'))][(_0xd256('0x6b'))](_0xd256('0x6c'),0x193);}_0x44695b=_0x13bb00;return db['AnalyticMetric'][_0xd256('0x6d')]({'raw':!![]});}return null;})[_0xd256('0x25')](function(_0x141ec7){if(_0x141ec7){_0x258bef=_[_0xd256('0x6e')](_0x141ec7,'id');var _0x557d42;var _0x120efd=squel['select']();_0x120efd['from'](_0x1523c6[_0xd256('0x6f')]);for(var _0x3cfad5=0x0;_0x3cfad5<_0x44695b[_0xd256('0x39')];_0x3cfad5+=0x1){_0x557d42=_0x44695b[_0x3cfad5][_0xd256('0x70')]?_0x258bef[_0x44695b[_0x3cfad5][_0xd256('0x70')]][_0xd256('0x71')]:_0x44695b[_0x3cfad5][_0xd256('0x67')];_0x557d42=_0x44695b[_0x3cfad5]['function']?_['replace'](_0x58dbea[_0x44695b[_0x3cfad5]['function']],'%s',_0x557d42):_0x557d42;_0x557d42=_0x44695b[_0x3cfad5][_0xd256('0x72')]?_['replace'](_0x232035[_0x44695b[_0x3cfad5]['format']],'%s',_0x557d42):_0x557d42;if(_0x44695b[_0x3cfad5][_0xd256('0x73')]){_0x120efd[_0xd256('0x66')](_0x557d42);}_0x44695b[_0x3cfad5][_0xd256('0x74')]&&_0x120efd[_0xd256('0x3c')](_0x557d42,_0x44695b[_0x3cfad5][_0xd256('0x74')]===_0xd256('0x75')?![]:!![]);_0x120efd[_0xd256('0x67')](_0x557d42,_0x44695b[_0x3cfad5][_0xd256('0x76')]||_0x557d42);}if(_0x1523c6[_0xd256('0x77')]){_0x1523c6[_0xd256('0x77')]=JSON[_0xd256('0x78')](_0x1523c6['joins']);for(var _0x4bb287=0x0;_0x4bb287<_0x1523c6[_0xd256('0x77')]['length'];_0x4bb287+=0x1){if(_0x1523c6['joins'][_0x4bb287][_0xd256('0x31')]&&_['includes'](_0x49e0bb,_0x1523c6[_0xd256('0x77')][_0x4bb287][_0xd256('0x31')])&&_0x1523c6['joins'][_0x4bb287][_0xd256('0x79')]&&_0x1523c6[_0xd256('0x77')][_0x4bb287]['foreignTable']&&_0x1523c6[_0xd256('0x77')][_0x4bb287][_0xd256('0x7a')]){_0x120efd[_0x1523c6['joins'][_0x4bb287][_0xd256('0x31')]](_0x1523c6['joins'][_0x4bb287][_0xd256('0x7b')],null,util[_0xd256('0x72')](_0xd256('0x7c'),_0x1523c6[_0xd256('0x6f')],_0x1523c6[_0xd256('0x77')][_0x4bb287][_0xd256('0x79')],_0x1523c6['joins'][_0x4bb287]['foreignTable'],_0x1523c6['joins'][_0x4bb287]['foreignKey']));}}}if(_0x1523c6[_0xd256('0x7d')]){_0x1523c6['conditions']=JSON[_0xd256('0x78')](_0x1523c6['conditions']);_0x120efd[_0xd256('0x3e')](_0x5c1830(_0x1523c6[_0xd256('0x7d')]['group']));}_0x18830a=_0x120efd[_0xd256('0x7e')]();_0x120efd[_0xd256('0x3b')](_0x136947);_0x120efd['offset'](0x0);logger['debug'](_0xd256('0x7f'),_0x120efd[_0xd256('0x80')]());return db[_0xd256('0x81')]['query'](_0x120efd[_0xd256('0x80')](),{'type':db[_0xd256('0x81')][_0xd256('0x82')]['SELECT']});}})[_0xd256('0x25')](respondWithResult(_0x10d867,null))[_0xd256('0x45')](handleError(_0x10d867,null));};function runReport(_0x411fa9,_0x500c6b,_0x2330bf){var _0x456cab=_0x500c6b[_0xd256('0x2b')];var _0x26b7b5=0xa;var _0x55c4d6=[_0xd256('0x52'),_0xd256('0x53'),_0xd256('0x54'),_0xd256('0x55')];var _0x4798a6={'SUM':_0xd256('0x56'),'COUNT':_0xd256('0x57'),'COUNT DISTINCT':_0xd256('0x58'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xd256('0x83'),'GROUP_CONCAT':_0xd256('0x5b'),'GROUP_CONCAT ASC':_0xd256('0x5c'),'GROUP_CONCAT DESC':_0xd256('0x5d')};var _0x3b6351={'SEC_TO_TIME':_0xd256('0x5e'),'DATE':_0xd256('0x5f'),'HOUR':_0xd256('0x84'),'ROUND':_0xd256('0x60'),'UNIX_TIMESTAMP':_0xd256('0x61')};var _0x3d636c=function(_0x2ae78f){return!_[_0xd256('0x85')]([_0xd256('0x86'),_0xd256('0x62'),'IS\x20EMPTY',_0xd256('0x87')],_0x2ae78f);};var _0x5edb2c=function(_0x16283c){if(!_0x16283c||!_0x16283c['rules'][_0xd256('0x39')]){return'';}for(var _0x25db91='(',_0x2ba004=0x0;_0x2ba004<_0x16283c[_0xd256('0x64')][_0xd256('0x39')];_0x2ba004+=0x1){_0x2ba004>0x0&&(_0x25db91+='\x20'+_0x16283c[_0xd256('0x65')]+'\x20');_0x25db91+=_0x16283c[_0xd256('0x64')][_0x2ba004][_0xd256('0x66')]?_0x5edb2c(_0x16283c[_0xd256('0x64')][_0x2ba004][_0xd256('0x66')]):_0x16283c[_0xd256('0x64')][_0x2ba004][_0xd256('0x67')]+'\x20'+_0x16283c[_0xd256('0x64')][_0x2ba004][_0xd256('0x68')]+(_0x3d636c(_0x16283c['rules'][_0x2ba004][_0xd256('0x68')])?'\x20'+_0x16283c[_0xd256('0x64')][_0x2ba004][_0xd256('0x69')]:'');}return _0x25db91+')';};var _0x1a453b={'where':{'id':_0x411fa9['id']}},_0x247bed,_0x8b5761,_0x480a14,_0x5b683c,_0x7ffb6f;_0x1a453b=_[_0xd256('0x40')]({},_0x1a453b,_0x2330bf);return db['AnalyticDefaultReport'][_0xd256('0x4a')](_0x1a453b)['then'](function(_0x198a55){if(_0x198a55){_0x247bed=_0x198a55;return _0x198a55['getFields']();}return null;})['then'](function(_0x12692f){if(_0x12692f){if(!_0x12692f[_0xd256('0x39')]){throw new db['Sequelize'][(_0xd256('0x6b'))](_0xd256('0x6c'),0x193);}_0x8b5761=_0x12692f;return db[_0xd256('0x88')][_0xd256('0x6d')]({'raw':!![]});}return null;})[_0xd256('0x25')](function(_0x1b4eb8){if(_0x1b4eb8){_0x480a14=_[_0xd256('0x6e')](_0x1b4eb8,'id');var _0x2b3515;var _0x206db5=squel[_0xd256('0x89')]();_0x206db5[_0xd256('0x8a')](_0x247bed['table']);for(var _0x56fc0b=0x0;_0x56fc0b<_0x8b5761[_0xd256('0x39')];_0x56fc0b+=0x1){_0x2b3515=_0x8b5761[_0x56fc0b][_0xd256('0x70')]?_0x480a14[_0x8b5761[_0x56fc0b][_0xd256('0x70')]][_0xd256('0x71')]:_0x8b5761[_0x56fc0b]['field'];_0x2b3515=_0x8b5761[_0x56fc0b][_0xd256('0x8b')]?_[_0xd256('0x8c')](_0x4798a6[_0x8b5761[_0x56fc0b][_0xd256('0x8b')]],'%s',_0x2b3515):_0x2b3515;_0x2b3515=_0x8b5761[_0x56fc0b]['format']?_[_0xd256('0x8c')](_0x3b6351[_0x8b5761[_0x56fc0b][_0xd256('0x72')]],'%s',_0x2b3515):_0x2b3515;if(_0x8b5761[_0x56fc0b]['groupBy']){_0x206db5['group'](_0x2b3515);}_0x8b5761[_0x56fc0b]['orderBy']&&_0x206db5[_0xd256('0x3c')](_0x2b3515,_0x8b5761[_0x56fc0b][_0xd256('0x74')]===_0xd256('0x75')?![]:!![]);_0x206db5[_0xd256('0x67')](_0x2b3515,_0x8b5761[_0x56fc0b][_0xd256('0x76')]||_0x2b3515);}if(_0x247bed[_0xd256('0x77')]){_0x247bed[_0xd256('0x77')]=JSON[_0xd256('0x78')](_0x247bed[_0xd256('0x77')]);for(var _0x215a55=0x0;_0x215a55<_0x247bed[_0xd256('0x77')]['length'];_0x215a55+=0x1){if(_0x247bed[_0xd256('0x77')][_0x215a55][_0xd256('0x31')]&&_[_0xd256('0x85')](_0x55c4d6,_0x247bed[_0xd256('0x77')][_0x215a55]['type'])&&_0x247bed[_0xd256('0x77')][_0x215a55][_0xd256('0x79')]&&_0x247bed['joins'][_0x215a55]['foreignTable']&&_0x247bed['joins'][_0x215a55]['foreignKey']){_0x206db5[_0x247bed[_0xd256('0x77')][_0x215a55][_0xd256('0x31')]](_0x247bed[_0xd256('0x77')][_0x215a55][_0xd256('0x7b')],null,util[_0xd256('0x72')](_0xd256('0x7c'),_0x247bed[_0xd256('0x6f')],_0x247bed[_0xd256('0x77')][_0x215a55]['parentKey'],_0x247bed[_0xd256('0x77')][_0x215a55][_0xd256('0x7b')],_0x247bed[_0xd256('0x77')][_0x215a55]['foreignKey']));}}}if(_0x247bed[_0xd256('0x7d')]){_0x247bed[_0xd256('0x7d')]=JSON[_0xd256('0x78')](_0x247bed[_0xd256('0x7d')]);_0x206db5[_0xd256('0x3e')](_0x5edb2c(_0x247bed['conditions'][_0xd256('0x66')]));}_0x7ffb6f=_0x206db5['clone']();_0x206db5[_0xd256('0x3b')](_0x26b7b5);_0x206db5[_0xd256('0x1e')](0x0);logger['debug'](_0xd256('0x7f'),_0x206db5[_0xd256('0x80')]());return db[_0xd256('0x81')]['query'](_0x206db5['toString'](),{'type':db[_0xd256('0x81')][_0xd256('0x82')]['SELECT']});}})[_0xd256('0x25')](function(_0x12b33c){if(!_0x12b33c[_0xd256('0x39')]){throw new db[(_0xd256('0x6a'))][(_0xd256('0x6b'))](_0xd256('0x8d'),0xcc);}if(_0x500c6b[_0xd256('0x8e')]===_0xd256('0x8f')){return null;}var _0x54037a=_[_0xd256('0x40')](_0x500c6b,{'name':_0x500c6b['fullPath']||_0x500c6b['name']||_0x247bed[_0xd256('0x2b')],'basename':_0x456cab,'savename':util[_0xd256('0x72')]('%s-%s.%s',_0x500c6b['name']||_0x247bed[_0xd256('0x2b')],require(_0xd256('0x90'))[_0xd256('0x91')](0x4),_0x500c6b[_0xd256('0x8e')]||_0xd256('0x92')),'reportId':_0x247bed['id'],'reportType':_0xd256('0x93')});return db[_0xd256('0x94')][_0xd256('0x4b')](_0x54037a,{'raw':!![]});})[_0xd256('0x25')](function(_0x5020cd){if(_0x247bed['table']===_0xd256('0x95')){_0x7ffb6f['where'](_0x247bed[_0xd256('0x6f')]+_0xd256('0x96'),_0x500c6b[_0xd256('0x97')],_0x500c6b['endDate']);}else{_0x7ffb6f[_0xd256('0x3e')](_0x247bed[_0xd256('0x6f')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x500c6b[_0xd256('0x97')],_0x500c6b['endDate']);}if(_0x5020cd){logger[_0xd256('0x98')](_0xd256('0x99'),_0x7ffb6f['toString']());require(_0xd256('0x9a'))[_0xd256('0x9b')](path['join'](__dirname,'../../components/export/',_0x5020cd['output']),[_0x5020cd['id'],_0x7ffb6f[_0xd256('0x80')](),path[_0xd256('0x52')](__dirname,_0xd256('0x9c'),_0x5020cd[_0xd256('0x9d')]),_0x456cab]);return _0x5020cd;}else{var _0x4312a3=squel[_0xd256('0x89')]();_0x4312a3[_0xd256('0x8a')]('('+_0x7ffb6f[_0xd256('0x80')]()+')','countTable');_0x4312a3[_0xd256('0x67')](_0xd256('0x9e'),'count');_0x7ffb6f[_0xd256('0x3b')](_0x500c6b[_0xd256('0x3b')]||_0x26b7b5);_0x7ffb6f[_0xd256('0x1e')](_0x500c6b[_0xd256('0x1e')]||0x0);return db['sequelize'][_0xd256('0x33')](_0x4312a3[_0xd256('0x80')](),{'type':db['sequelize'][_0xd256('0x82')][_0xd256('0x9f')]})[_0xd256('0x25')](function(_0x3712c5){if(!_0x3712c5[_0xd256('0x39')]){_0x5b683c=0x0;}else{_0x5b683c=_0x3712c5[0x0]['count']||0x0;}return db[_0xd256('0x81')][_0xd256('0x33')](_0x7ffb6f[_0xd256('0x80')](),{'type':db['sequelize']['QueryTypes'][_0xd256('0x9f')]});})[_0xd256('0x25')](function(_0x4aa90e){return{'rows':_0x4aa90e||[],'count':_0x5b683c};});}});}exports[_0xd256('0xa0')]=function(_0x375b50,_0x347703){return runReport(_0x375b50[_0xd256('0x47')],_0x375b50['query'],_0x375b50[_0xd256('0x41')])[_0xd256('0x25')](respondWithResult(_0x347703,null))[_0xd256('0x45')](handleError(_0x347703,null));};exports[_0xd256('0xa1')]=runReport;exports[_0xd256('0x33')]=function(_0x26b417,_0x34c6a0){var _0x2c20fe=0xa;var _0xae387=['join','left_join','right_join','cross_join'];var _0x50a371={'SUM':_0xd256('0x56'),'COUNT':_0xd256('0x57'),'COUNT DISTINCT':_0xd256('0x58'),'MAX':_0xd256('0x59'),'MIN':_0xd256('0x5a'),'AVG':_0xd256('0x83'),'GROUP_CONCAT':_0xd256('0x5b'),'GROUP_CONCAT ASC':_0xd256('0x5c'),'GROUP_CONCAT DESC':_0xd256('0x5d')};var _0x3981ef={'SEC_TO_TIME':_0xd256('0x5e'),'DATE':'DATE(%s)','HOUR':_0xd256('0x84'),'ROUND':_0xd256('0x60'),'UNIX_TIMESTAMP':_0xd256('0x61')};var _0x98ddc4=function(_0x11ad98){return!_[_0xd256('0x85')]([_0xd256('0x86'),_0xd256('0x62'),_0xd256('0x63'),_0xd256('0x87')],_0x11ad98);};var _0x4c8aac=function(_0x24a70a){if(!_0x24a70a||!_0x24a70a[_0xd256('0x64')][_0xd256('0x39')]){return'';}for(var _0x4abd5a='(',_0x241778=0x0;_0x241778<_0x24a70a[_0xd256('0x64')][_0xd256('0x39')];_0x241778+=0x1){_0x241778>0x0&&(_0x4abd5a+='\x20'+_0x24a70a['operator']+'\x20');_0x4abd5a+=_0x24a70a[_0xd256('0x64')][_0x241778]['group']?_0x4c8aac(_0x24a70a[_0xd256('0x64')][_0x241778][_0xd256('0x66')]):_0x24a70a[_0xd256('0x64')][_0x241778][_0xd256('0x67')]+'\x20'+_0x24a70a[_0xd256('0x64')][_0x241778][_0xd256('0x68')]+(_0x98ddc4(_0x24a70a['rules'][_0x241778][_0xd256('0x68')])?'\x20'+_0x24a70a['rules'][_0x241778][_0xd256('0x69')]:'');}return _0x4abd5a+')';};var _0x15b505={'where':{'id':_0x26b417[_0xd256('0x47')]['id']}},_0x2940f2,_0x345bdd,_0x369ad0,_0x385249,_0x37d191;_0x15b505=_[_0xd256('0x40')]({},_0x15b505,_0x26b417[_0xd256('0x41')]);return db['AnalyticDefaultReport']['find'](_0x15b505)[_0xd256('0x25')](function(_0x22fc44){if(_0x22fc44){_0x2940f2=_0x22fc44;return _0x22fc44[_0xd256('0xa2')]();}return null;})[_0xd256('0x25')](function(_0x4a0fa6){if(_0x4a0fa6){if(!_0x4a0fa6[_0xd256('0x39')]){throw new db[(_0xd256('0x6a'))][(_0xd256('0x6b'))](_0xd256('0x6c'),0x193);}_0x345bdd=_0x4a0fa6;return db['AnalyticMetric'][_0xd256('0x6d')]({'raw':!![]});}return null;})[_0xd256('0x25')](function(_0xf78f7e){if(_0xf78f7e){_0x369ad0=_[_0xd256('0x6e')](_0xf78f7e,'id');var _0x5b4442;var _0x587fb3=squel[_0xd256('0x89')]();_0x587fb3['from'](_0x2940f2[_0xd256('0x6f')]);for(var _0x316e59=0x0;_0x316e59<_0x345bdd[_0xd256('0x39')];_0x316e59+=0x1){_0x5b4442=_0x345bdd[_0x316e59][_0xd256('0x70')]?_0x369ad0[_0x345bdd[_0x316e59][_0xd256('0x70')]][_0xd256('0x71')]:_0x345bdd[_0x316e59][_0xd256('0x67')];_0x5b4442=_0x345bdd[_0x316e59][_0xd256('0x8b')]?_[_0xd256('0x8c')](_0x50a371[_0x345bdd[_0x316e59]['function']],'%s',_0x5b4442):_0x5b4442;_0x5b4442=_0x345bdd[_0x316e59][_0xd256('0x72')]?_[_0xd256('0x8c')](_0x3981ef[_0x345bdd[_0x316e59][_0xd256('0x72')]],'%s',_0x5b4442):_0x5b4442;if(_0x345bdd[_0x316e59][_0xd256('0x73')]){_0x587fb3[_0xd256('0x66')](_0x5b4442);}_0x345bdd[_0x316e59][_0xd256('0x74')]&&_0x587fb3[_0xd256('0x3c')](_0x5b4442,_0x345bdd[_0x316e59][_0xd256('0x74')]===_0xd256('0x75')?![]:!![]);_0x587fb3[_0xd256('0x67')](_0x5b4442,_0x345bdd[_0x316e59][_0xd256('0x76')]||_0x5b4442);}if(_0x2940f2[_0xd256('0x77')]){_0x2940f2[_0xd256('0x77')]=JSON[_0xd256('0x78')](_0x2940f2['joins']);for(var _0x463a71=0x0;_0x463a71<_0x2940f2[_0xd256('0x77')][_0xd256('0x39')];_0x463a71+=0x1){if(_0x2940f2['joins'][_0x463a71][_0xd256('0x31')]&&_[_0xd256('0x85')](_0xae387,_0x2940f2[_0xd256('0x77')][_0x463a71][_0xd256('0x31')])&&_0x2940f2[_0xd256('0x77')][_0x463a71][_0xd256('0x79')]&&_0x2940f2[_0xd256('0x77')][_0x463a71]['foreignTable']&&_0x2940f2[_0xd256('0x77')][_0x463a71]['foreignKey']){_0x587fb3[_0x2940f2['joins'][_0x463a71][_0xd256('0x31')]](_0x2940f2[_0xd256('0x77')][_0x463a71][_0xd256('0x7b')],null,util[_0xd256('0x72')](_0xd256('0x7c'),_0x2940f2[_0xd256('0x6f')],_0x2940f2[_0xd256('0x77')][_0x463a71][_0xd256('0x79')],_0x2940f2[_0xd256('0x77')][_0x463a71][_0xd256('0x7b')],_0x2940f2[_0xd256('0x77')][_0x463a71][_0xd256('0x7a')]));}}}if(_0x2940f2[_0xd256('0x7d')]){_0x2940f2['conditions']=JSON[_0xd256('0x78')](_0x2940f2[_0xd256('0x7d')]);_0x587fb3[_0xd256('0x3e')](_0x4c8aac(_0x2940f2[_0xd256('0x7d')][_0xd256('0x66')]));}_0x37d191=_0x587fb3[_0xd256('0x7e')]();_0x587fb3[_0xd256('0x3b')](_0x2c20fe);_0x587fb3[_0xd256('0x1e')](0x0);logger['debug']('Limited\x20Query:',_0x587fb3[_0xd256('0x80')]());return db[_0xd256('0x81')][_0xd256('0x33')](_0x587fb3[_0xd256('0x80')](),{'type':db[_0xd256('0x81')][_0xd256('0x82')]['SELECT']});}})[_0xd256('0x25')](function(){return{'sql':_0x37d191['toString']()};})[_0xd256('0x25')](respondWithResult(_0x34c6a0,null))[_0xd256('0x45')](handleError(_0x34c6a0,null));}; \ No newline at end of file +var _0xe988=['MetricId','replace','format','groupBy','orderBy','DESC','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','Limited\x20Query:','toString','QueryTypes','SELECT','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','HOUR(%s)','Sequelize','select','from','function','clone','debug','sequelize','ValidationErrorItem','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','../../files/reports','savename','COUNT(*)','SEC_TO_TIME(%s)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','metric','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','end','error','name','index','map','AnalyticDefaultReport','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','type','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','SUM(%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)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','table'];(function(_0x266c6f,_0x1edfcb){var _0x1384ae=function(_0x16eb3f){while(--_0x16eb3f){_0x266c6f['push'](_0x266c6f['shift']());}};_0x1384ae(++_0x1edfcb);}(_0xe988,0x17b));var _0x8e98=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xe988[_0x46aff0];return _0x9d78cf;};'use strict';var pdf=require(_0x8e98('0x0'));var emlformat=require(_0x8e98('0x1'));var rimraf=require(_0x8e98('0x2'));var zipdir=require(_0x8e98('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8e98('0x4'));var moment=require(_0x8e98('0x5'));var BPromise=require(_0x8e98('0x6'));var Mustache=require(_0x8e98('0x7'));var util=require(_0x8e98('0x8'));var path=require(_0x8e98('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8e98('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8e98('0xb'));var crypto=require('crypto');var jsforce=require(_0x8e98('0xc'));var deskjs=require(_0x8e98('0xd'));var toCsv=require(_0x8e98('0xe'));var querystring=require(_0x8e98('0xf'));var Papa=require(_0x8e98('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8e98('0x11'));var hardwareService=require(_0x8e98('0x12'));var logger=require(_0x8e98('0x13'))(_0x8e98('0x14'));var utils=require(_0x8e98('0x15'));var config=require(_0x8e98('0x16'));var db=require(_0x8e98('0x17'))['db'];function respondWithStatusCode(_0x58dd31,_0x262ca7){_0x262ca7=_0x262ca7||0xcc;return function(_0x4ce4de){if(_0x4ce4de){return _0x58dd31[_0x8e98('0x18')](_0x262ca7);}return _0x58dd31[_0x8e98('0x19')](_0x262ca7)['end']();};}function respondWithResult(_0x54b434,_0x32a512){_0x32a512=_0x32a512||0xc8;return function(_0x447147){if(_0x447147){return _0x54b434[_0x8e98('0x19')](_0x32a512)[_0x8e98('0x1a')](_0x447147);}};}function respondWithFilteredResult(_0x21da7e,_0x5c5c36){return function(_0x33fa6f){if(_0x33fa6f){var _0xbd6142=_0x33fa6f[_0x8e98('0x1b')],_0x555572=_0x5c5c36[_0x8e98('0x1c')],_0x10ad90=_0x5c5c36[_0x8e98('0x1c')]+_0x5c5c36['limit'],_0x16fd1;if(_0x10ad90>=_0xbd6142){_0x10ad90=_0xbd6142;_0x16fd1=0xc8;}else{_0x16fd1=0xce;}_0x21da7e[_0x8e98('0x19')](_0x16fd1);return _0x21da7e[_0x8e98('0x1d')](_0x8e98('0x1e'),_0x555572+'-'+_0x10ad90+'/'+_0xbd6142)['json'](_0x33fa6f);}return null;};}function patchUpdates(_0x2e5d7e){return function(_0x3d8c89){try{jsonpatch[_0x8e98('0x1f')](_0x3d8c89,_0x2e5d7e,!![]);}catch(_0x25ab4d){return BPromise[_0x8e98('0x20')](_0x25ab4d);}return _0x3d8c89['save']();};}function saveUpdates(_0x2e0a38,_0x2d5d14){return function(_0x1c5fc4){if(_0x1c5fc4){return _0x1c5fc4[_0x8e98('0x21')](_0x2e0a38)[_0x8e98('0x22')](function(_0x4a2361){return _0x4a2361;});}return null;};}function removeEntity(_0x193725,_0x4236e0){return function(_0x41257e){if(_0x41257e){return _0x41257e[_0x8e98('0x23')]()[_0x8e98('0x22')](function(){var _0x5204b1=_0x41257e[_0x8e98('0x24')]({'plain':!![]});var _0x55b6fe='DefaultReports';return db[_0x8e98('0x25')][_0x8e98('0x23')]({'where':{'type':_0x55b6fe,'resourceId':_0x5204b1['id']}})[_0x8e98('0x22')](function(){return _0x41257e;});})[_0x8e98('0x22')](function(){_0x193725[_0x8e98('0x19')](0xcc)[_0x8e98('0x26')]();});}};}function handleEntityNotFound(_0x343e0f,_0x13d8ab){return function(_0x467d5e){if(!_0x467d5e){_0x343e0f['sendStatus'](0x194);}return _0x467d5e;};}function handleError(_0x4afc4a,_0xfb54c2){_0xfb54c2=_0xfb54c2||0x1f4;return function(_0x6d38b6){logger[_0x8e98('0x27')](_0x6d38b6['stack']);if(_0x6d38b6[_0x8e98('0x28')]){delete _0x6d38b6['name'];}_0x4afc4a[_0x8e98('0x19')](_0xfb54c2)['send'](_0x6d38b6);};}exports[_0x8e98('0x29')]=function(_0x158106,_0x170d7d){var _0x21e416={},_0x5b8521={},_0x5da141={'count':0x0,'rows':[]};var _0xc2504c=_[_0x8e98('0x2a')](db[_0x8e98('0x2b')]['rawAttributes'],function(_0x592997){return{'name':_0x592997[_0x8e98('0x2c')],'type':_0x592997['type'][_0x8e98('0x2d')]};});_0x5b8521['model']=_[_0x8e98('0x2a')](_0xc2504c,_0x8e98('0x28'));_0x5b8521[_0x8e98('0x2e')]=_[_0x8e98('0x2f')](_0x158106[_0x8e98('0x2e')]);_0x5b8521[_0x8e98('0x30')]=_[_0x8e98('0x31')](_0x5b8521['model'],_0x5b8521[_0x8e98('0x2e')]);_0x21e416[_0x8e98('0x32')]=_['intersection'](_0x5b8521[_0x8e98('0x33')],qs[_0x8e98('0x34')](_0x158106[_0x8e98('0x2e')][_0x8e98('0x34')]));_0x21e416[_0x8e98('0x32')]=_0x21e416[_0x8e98('0x32')][_0x8e98('0x35')]?_0x21e416[_0x8e98('0x32')]:_0x5b8521['model'];if(!_0x158106[_0x8e98('0x2e')][_0x8e98('0x36')](_0x8e98('0x37'))){_0x21e416['limit']=qs[_0x8e98('0x38')](_0x158106[_0x8e98('0x2e')][_0x8e98('0x38')]);_0x21e416[_0x8e98('0x1c')]=qs[_0x8e98('0x1c')](_0x158106[_0x8e98('0x2e')][_0x8e98('0x1c')]);}_0x21e416[_0x8e98('0x39')]=qs[_0x8e98('0x3a')](_0x158106['query'][_0x8e98('0x3a')]);_0x21e416[_0x8e98('0x3b')]=qs[_0x8e98('0x30')](_['pick'](_0x158106['query'],_0x5b8521[_0x8e98('0x30')]));if(_0x158106[_0x8e98('0x2e')][_0x8e98('0x3c')]){_0x21e416[_0x8e98('0x3b')]=_['merge'](_0x21e416[_0x8e98('0x3b')],{'$or':_[_0x8e98('0x2a')](_0xc2504c,function(_0x43caaa){if(_0x43caaa[_0x8e98('0x3d')]!=='VIRTUAL'){var _0x17ffd3={};_0x17ffd3[_0x43caaa[_0x8e98('0x28')]]={'$like':'%'+_0x158106[_0x8e98('0x2e')][_0x8e98('0x3c')]+'%'};return _0x17ffd3;}})});}_0x21e416=_[_0x8e98('0x3e')]({},_0x21e416,_0x158106[_0x8e98('0x3f')]);var _0x5514c3={'where':_0x21e416[_0x8e98('0x3b')]};return db[_0x8e98('0x2b')][_0x8e98('0x1b')](_0x5514c3)[_0x8e98('0x22')](function(_0x25b78b){_0x5da141[_0x8e98('0x1b')]=_0x25b78b;if(_0x158106[_0x8e98('0x2e')][_0x8e98('0x40')]){_0x21e416[_0x8e98('0x41')]=[{'all':!![]}];}return db[_0x8e98('0x2b')][_0x8e98('0x42')](_0x21e416);})[_0x8e98('0x22')](function(_0x7d0354){_0x5da141[_0x8e98('0x43')]=_0x7d0354;return _0x5da141;})['then'](respondWithFilteredResult(_0x170d7d,_0x21e416))[_0x8e98('0x44')](handleError(_0x170d7d,null));};exports['show']=function(_0x481ba5,_0x593f5a){var _0x33093e={'raw':!![],'where':{'id':_0x481ba5[_0x8e98('0x45')]['id']}},_0x29ced6={};_0x29ced6[_0x8e98('0x33')]=_[_0x8e98('0x2f')](db[_0x8e98('0x2b')][_0x8e98('0x46')]);_0x29ced6[_0x8e98('0x2e')]=_[_0x8e98('0x2f')](_0x481ba5[_0x8e98('0x2e')]);_0x29ced6[_0x8e98('0x30')]=_['intersection'](_0x29ced6[_0x8e98('0x33')],_0x29ced6[_0x8e98('0x2e')]);_0x33093e[_0x8e98('0x32')]=_[_0x8e98('0x31')](_0x29ced6['model'],qs[_0x8e98('0x34')](_0x481ba5[_0x8e98('0x2e')]['fields']));_0x33093e[_0x8e98('0x32')]=_0x33093e[_0x8e98('0x32')][_0x8e98('0x35')]?_0x33093e[_0x8e98('0x32')]:_0x29ced6[_0x8e98('0x33')];if(_0x481ba5[_0x8e98('0x2e')][_0x8e98('0x40')]){_0x33093e[_0x8e98('0x41')]=[{'all':!![]}];}_0x33093e=_[_0x8e98('0x3e')]({},_0x33093e,_0x481ba5[_0x8e98('0x3f')]);return db[_0x8e98('0x2b')][_0x8e98('0x47')](_0x33093e)[_0x8e98('0x22')](handleEntityNotFound(_0x593f5a,null))[_0x8e98('0x22')](respondWithResult(_0x593f5a,null))[_0x8e98('0x44')](handleError(_0x593f5a,null));};exports[_0x8e98('0x48')]=function(_0x56ea7c,_0x5d2bdc){return db[_0x8e98('0x2b')]['create'](_0x56ea7c[_0x8e98('0x49')],{})[_0x8e98('0x22')](function(_0xddb244){var _0x58674d=_0x56ea7c[_0x8e98('0x4a')][_0x8e98('0x24')]({'plain':!![]});if(!_0x58674d)throw new Error(_0x8e98('0x4b'));if(_0x58674d['role']===_0x8e98('0x4a')){var _0x3d49c2=_0xddb244[_0x8e98('0x24')]({'plain':!![]});var _0x3b9404='Reports';return db[_0x8e98('0x4c')][_0x8e98('0x47')]({'where':{'name':_0x3b9404,'userProfileId':_0x58674d[_0x8e98('0x4d')]},'raw':!![]})[_0x8e98('0x22')](function(_0x35332e){if(_0x35332e&&_0x35332e[_0x8e98('0x4e')]===0x0){return db[_0x8e98('0x25')][_0x8e98('0x48')]({'name':_0x3d49c2['name'],'resourceId':_0x3d49c2['id'],'type':_0x8e98('0x4f'),'sectionId':_0x35332e['id']},{})[_0x8e98('0x22')](function(){return _0xddb244;});}else{return _0xddb244;}})['catch'](function(_0x2c5344){logger[_0x8e98('0x27')](_0x8e98('0x50'),_0x2c5344);throw _0x2c5344;});}return _0xddb244;})[_0x8e98('0x22')](respondWithResult(_0x5d2bdc,0xc9))['catch'](handleError(_0x5d2bdc,null));};exports[_0x8e98('0x21')]=function(_0x4c1c8a,_0x56473a){if(_0x4c1c8a['body']['id']){delete _0x4c1c8a[_0x8e98('0x49')]['id'];}return db['AnalyticDefaultReport'][_0x8e98('0x47')]({'where':{'id':_0x4c1c8a[_0x8e98('0x45')]['id']}})['then'](handleEntityNotFound(_0x56473a,null))[_0x8e98('0x22')](saveUpdates(_0x4c1c8a[_0x8e98('0x49')],null))[_0x8e98('0x22')](respondWithResult(_0x56473a,null))[_0x8e98('0x44')](handleError(_0x56473a,null));};exports[_0x8e98('0x23')]=function(_0x542174,_0xc9668c){return db['AnalyticDefaultReport'][_0x8e98('0x47')]({'where':{'id':_0x542174['params']['id']}})[_0x8e98('0x22')](handleEntityNotFound(_0xc9668c,null))['then'](removeEntity(_0xc9668c,null))[_0x8e98('0x44')](handleError(_0xc9668c,null));};exports[_0x8e98('0x51')]=function(_0x3a83db,_0x4c4175){var _0x238a08=0xa;var _0x27bff8=[_0x8e98('0x52'),'left_join','right_join','cross_join'];var _0x2c293d={'SUM':_0x8e98('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x8e98('0x54'),'MIN':_0x8e98('0x55'),'AVG':_0x8e98('0x56'),'GROUP_CONCAT':_0x8e98('0x57'),'GROUP_CONCAT ASC':_0x8e98('0x58'),'GROUP_CONCAT DESC':_0x8e98('0x59')};var _0x5b8586={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x8e98('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x8e98('0x5b'),'UNIX_TIMESTAMP':_0x8e98('0x5c')};var _0x16258d=function(_0xd81b0e){return!_[_0x8e98('0x5d')]([_0x8e98('0x5e'),_0x8e98('0x5f'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xd81b0e);};var _0x23e96c=function(_0x3d6b33){if(!_0x3d6b33||!_0x3d6b33[_0x8e98('0x60')][_0x8e98('0x35')]){return'';}for(var _0x225d90='(',_0x27f1cf=0x0;_0x27f1cf<_0x3d6b33[_0x8e98('0x60')][_0x8e98('0x35')];_0x27f1cf+=0x1){_0x27f1cf>0x0&&(_0x225d90+='\x20'+_0x3d6b33[_0x8e98('0x61')]+'\x20');_0x225d90+=_0x3d6b33['rules'][_0x27f1cf]['group']?_0x23e96c(_0x3d6b33[_0x8e98('0x60')][_0x27f1cf][_0x8e98('0x62')]):_0x3d6b33[_0x8e98('0x60')][_0x27f1cf][_0x8e98('0x63')]+'\x20'+_0x3d6b33[_0x8e98('0x60')][_0x27f1cf][_0x8e98('0x64')]+(_0x16258d(_0x3d6b33[_0x8e98('0x60')][_0x27f1cf][_0x8e98('0x64')])?'\x20'+_0x3d6b33['rules'][_0x27f1cf][_0x8e98('0x65')]:'');}return _0x225d90+')';};var _0x2c2b2c={'where':{'id':_0x3a83db[_0x8e98('0x45')]['id']}},_0x55a483,_0x5ab728,_0x2acdfa,_0x4e861a,_0x192ae3;_0x2c2b2c=_[_0x8e98('0x3e')]({},_0x2c2b2c,_0x3a83db[_0x8e98('0x3f')]);return db[_0x8e98('0x2b')][_0x8e98('0x47')](_0x2c2b2c)[_0x8e98('0x22')](function(_0x194254){if(_0x194254){_0x55a483=_0x194254;return _0x194254[_0x8e98('0x66')]();}return null;})[_0x8e98('0x22')](function(_0x378e07){if(_0x378e07){if(!_0x378e07[_0x8e98('0x35')]){throw new db['Sequelize']['ValidationErrorItem'](_0x8e98('0x67'),0x193);}_0x5ab728=_0x378e07;return db[_0x8e98('0x68')][_0x8e98('0x42')]({'raw':!![]});}return null;})[_0x8e98('0x22')](function(_0x3fa013){if(_0x3fa013){_0x2acdfa=_[_0x8e98('0x69')](_0x3fa013,'id');var _0x5b9c61;var _0x3095d8=squel['select']();_0x3095d8['from'](_0x55a483[_0x8e98('0x6a')]);for(var _0x5bb053=0x0;_0x5bb053<_0x5ab728['length'];_0x5bb053+=0x1){_0x5b9c61=_0x5ab728[_0x5bb053][_0x8e98('0x6b')]?_0x2acdfa[_0x5ab728[_0x5bb053][_0x8e98('0x6b')]]['metric']:_0x5ab728[_0x5bb053]['field'];_0x5b9c61=_0x5ab728[_0x5bb053]['function']?_[_0x8e98('0x6c')](_0x2c293d[_0x5ab728[_0x5bb053]['function']],'%s',_0x5b9c61):_0x5b9c61;_0x5b9c61=_0x5ab728[_0x5bb053][_0x8e98('0x6d')]?_[_0x8e98('0x6c')](_0x5b8586[_0x5ab728[_0x5bb053]['format']],'%s',_0x5b9c61):_0x5b9c61;if(_0x5ab728[_0x5bb053][_0x8e98('0x6e')]){_0x3095d8[_0x8e98('0x62')](_0x5b9c61);}_0x5ab728[_0x5bb053][_0x8e98('0x6f')]&&_0x3095d8['order'](_0x5b9c61,_0x5ab728[_0x5bb053][_0x8e98('0x6f')]===_0x8e98('0x70')?![]:!![]);_0x3095d8[_0x8e98('0x63')](_0x5b9c61,_0x5ab728[_0x5bb053]['alias']||_0x5b9c61);}if(_0x55a483['joins']){_0x55a483[_0x8e98('0x71')]=JSON[_0x8e98('0x72')](_0x55a483['joins']);for(var _0x177767=0x0;_0x177767<_0x55a483[_0x8e98('0x71')]['length'];_0x177767+=0x1){if(_0x55a483[_0x8e98('0x71')][_0x177767]['type']&&_[_0x8e98('0x5d')](_0x27bff8,_0x55a483[_0x8e98('0x71')][_0x177767][_0x8e98('0x3d')])&&_0x55a483['joins'][_0x177767]['parentKey']&&_0x55a483[_0x8e98('0x71')][_0x177767][_0x8e98('0x73')]&&_0x55a483['joins'][_0x177767][_0x8e98('0x74')]){_0x3095d8[_0x55a483['joins'][_0x177767]['type']](_0x55a483['joins'][_0x177767][_0x8e98('0x73')],null,util['format'](_0x8e98('0x75'),_0x55a483['table'],_0x55a483[_0x8e98('0x71')][_0x177767][_0x8e98('0x76')],_0x55a483[_0x8e98('0x71')][_0x177767][_0x8e98('0x73')],_0x55a483['joins'][_0x177767][_0x8e98('0x74')]));}}}if(_0x55a483[_0x8e98('0x77')]){_0x55a483[_0x8e98('0x77')]=JSON['parse'](_0x55a483[_0x8e98('0x77')]);_0x3095d8[_0x8e98('0x3b')](_0x23e96c(_0x55a483[_0x8e98('0x77')][_0x8e98('0x62')]));}_0x192ae3=_0x3095d8['clone']();_0x3095d8[_0x8e98('0x38')](_0x238a08);_0x3095d8[_0x8e98('0x1c')](0x0);logger['debug'](_0x8e98('0x78'),_0x3095d8[_0x8e98('0x79')]());return db['sequelize'][_0x8e98('0x2e')](_0x3095d8[_0x8e98('0x79')](),{'type':db['sequelize'][_0x8e98('0x7a')][_0x8e98('0x7b')]});}})[_0x8e98('0x22')](respondWithResult(_0x4c4175,null))[_0x8e98('0x44')](handleError(_0x4c4175,null));};function runReport(_0x5175b7,_0x165d89,_0x11ee36){var _0x3a1eaf=_0x165d89[_0x8e98('0x28')];var _0xdc8176=0xa;var _0x58d403=['join',_0x8e98('0x7c'),_0x8e98('0x7d'),_0x8e98('0x7e')];var _0xa190f7={'SUM':'SUM(%s)','COUNT':_0x8e98('0x7f'),'COUNT DISTINCT':_0x8e98('0x80'),'MAX':_0x8e98('0x54'),'MIN':'MIN(%s)','AVG':_0x8e98('0x56'),'GROUP_CONCAT':_0x8e98('0x57'),'GROUP_CONCAT ASC':_0x8e98('0x58'),'GROUP_CONCAT DESC':_0x8e98('0x59')};var _0x3f3162={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x8e98('0x5a'),'HOUR':_0x8e98('0x81'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x8e98('0x5c')};var _0x3ad340=function(_0x5288da){return!_[_0x8e98('0x5d')]([_0x8e98('0x5e'),_0x8e98('0x5f'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x5288da);};var _0x3b71a6=function(_0x107d94){if(!_0x107d94||!_0x107d94[_0x8e98('0x60')]['length']){return'';}for(var _0x1caaa6='(',_0x78bcc0=0x0;_0x78bcc0<_0x107d94[_0x8e98('0x60')]['length'];_0x78bcc0+=0x1){_0x78bcc0>0x0&&(_0x1caaa6+='\x20'+_0x107d94['operator']+'\x20');_0x1caaa6+=_0x107d94[_0x8e98('0x60')][_0x78bcc0][_0x8e98('0x62')]?_0x3b71a6(_0x107d94[_0x8e98('0x60')][_0x78bcc0]['group']):_0x107d94[_0x8e98('0x60')][_0x78bcc0][_0x8e98('0x63')]+'\x20'+_0x107d94[_0x8e98('0x60')][_0x78bcc0][_0x8e98('0x64')]+(_0x3ad340(_0x107d94[_0x8e98('0x60')][_0x78bcc0][_0x8e98('0x64')])?'\x20'+_0x107d94[_0x8e98('0x60')][_0x78bcc0]['value']:'');}return _0x1caaa6+')';};var _0x1e3c7a={'where':{'id':_0x5175b7['id']}},_0x24530,_0x1cfdd7,_0x3d54d8,_0x5d9031,_0xc95c55;_0x1e3c7a=_[_0x8e98('0x3e')]({},_0x1e3c7a,_0x11ee36);return db[_0x8e98('0x2b')]['find'](_0x1e3c7a)[_0x8e98('0x22')](function(_0x3cf3e9){if(_0x3cf3e9){_0x24530=_0x3cf3e9;return _0x3cf3e9[_0x8e98('0x66')]();}return null;})[_0x8e98('0x22')](function(_0x4669e0){if(_0x4669e0){if(!_0x4669e0[_0x8e98('0x35')]){throw new db[(_0x8e98('0x82'))]['ValidationErrorItem'](_0x8e98('0x67'),0x193);}_0x1cfdd7=_0x4669e0;return db[_0x8e98('0x68')][_0x8e98('0x42')]({'raw':!![]});}return null;})[_0x8e98('0x22')](function(_0x1d9c2b){if(_0x1d9c2b){_0x3d54d8=_[_0x8e98('0x69')](_0x1d9c2b,'id');var _0x31a98a;var _0x4a5b6a=squel[_0x8e98('0x83')]();_0x4a5b6a[_0x8e98('0x84')](_0x24530[_0x8e98('0x6a')]);for(var _0x2103e4=0x0;_0x2103e4<_0x1cfdd7[_0x8e98('0x35')];_0x2103e4+=0x1){_0x31a98a=_0x1cfdd7[_0x2103e4][_0x8e98('0x6b')]?_0x3d54d8[_0x1cfdd7[_0x2103e4][_0x8e98('0x6b')]]['metric']:_0x1cfdd7[_0x2103e4][_0x8e98('0x63')];_0x31a98a=_0x1cfdd7[_0x2103e4][_0x8e98('0x85')]?_['replace'](_0xa190f7[_0x1cfdd7[_0x2103e4][_0x8e98('0x85')]],'%s',_0x31a98a):_0x31a98a;_0x31a98a=_0x1cfdd7[_0x2103e4]['format']?_['replace'](_0x3f3162[_0x1cfdd7[_0x2103e4][_0x8e98('0x6d')]],'%s',_0x31a98a):_0x31a98a;if(_0x1cfdd7[_0x2103e4][_0x8e98('0x6e')]){_0x4a5b6a['group'](_0x31a98a);}_0x1cfdd7[_0x2103e4][_0x8e98('0x6f')]&&_0x4a5b6a[_0x8e98('0x39')](_0x31a98a,_0x1cfdd7[_0x2103e4][_0x8e98('0x6f')]==='DESC'?![]:!![]);_0x4a5b6a['field'](_0x31a98a,_0x1cfdd7[_0x2103e4]['alias']||_0x31a98a);}if(_0x24530['joins']){_0x24530[_0x8e98('0x71')]=JSON['parse'](_0x24530[_0x8e98('0x71')]);for(var _0x291f57=0x0;_0x291f57<_0x24530[_0x8e98('0x71')]['length'];_0x291f57+=0x1){if(_0x24530[_0x8e98('0x71')][_0x291f57][_0x8e98('0x3d')]&&_['includes'](_0x58d403,_0x24530[_0x8e98('0x71')][_0x291f57]['type'])&&_0x24530[_0x8e98('0x71')][_0x291f57][_0x8e98('0x76')]&&_0x24530[_0x8e98('0x71')][_0x291f57][_0x8e98('0x73')]&&_0x24530['joins'][_0x291f57][_0x8e98('0x74')]){_0x4a5b6a[_0x24530[_0x8e98('0x71')][_0x291f57]['type']](_0x24530[_0x8e98('0x71')][_0x291f57][_0x8e98('0x73')],null,util[_0x8e98('0x6d')]('%s.%s\x20=\x20%s.%s',_0x24530[_0x8e98('0x6a')],_0x24530['joins'][_0x291f57][_0x8e98('0x76')],_0x24530['joins'][_0x291f57][_0x8e98('0x73')],_0x24530[_0x8e98('0x71')][_0x291f57]['foreignKey']));}}}if(_0x24530[_0x8e98('0x77')]){_0x24530[_0x8e98('0x77')]=JSON['parse'](_0x24530[_0x8e98('0x77')]);_0x4a5b6a[_0x8e98('0x3b')](_0x3b71a6(_0x24530['conditions']['group']));}_0xc95c55=_0x4a5b6a[_0x8e98('0x86')]();_0x4a5b6a['limit'](_0xdc8176);_0x4a5b6a['offset'](0x0);logger[_0x8e98('0x87')]('Limited\x20Query:',_0x4a5b6a[_0x8e98('0x79')]());return db[_0x8e98('0x88')][_0x8e98('0x2e')](_0x4a5b6a[_0x8e98('0x79')](),{'type':db[_0x8e98('0x88')][_0x8e98('0x7a')][_0x8e98('0x7b')]});}})[_0x8e98('0x22')](function(_0x1e044){if(!_0x1e044[_0x8e98('0x35')]){throw new db[(_0x8e98('0x82'))][(_0x8e98('0x89'))](_0x8e98('0x8a'),0xcc);}if(_0x165d89[_0x8e98('0x8b')]===_0x8e98('0x8c')){return null;}var _0xe2c4bb=_[_0x8e98('0x3e')](_0x165d89,{'name':_0x165d89[_0x8e98('0x8d')]||_0x165d89[_0x8e98('0x28')]||_0x24530['name'],'basename':_0x3a1eaf,'savename':util[_0x8e98('0x6d')](_0x8e98('0x8e'),_0x165d89[_0x8e98('0x28')]||_0x24530[_0x8e98('0x28')],require(_0x8e98('0x8f'))[_0x8e98('0x90')](0x4),_0x165d89[_0x8e98('0x8b')]||_0x8e98('0x91')),'reportId':_0x24530['id'],'reportType':_0x8e98('0x92')});return db[_0x8e98('0x93')][_0x8e98('0x48')](_0xe2c4bb,{'raw':!![]});})['then'](function(_0x5ca1b4){if(_0x24530[_0x8e98('0x6a')]===_0x8e98('0x94')){_0xc95c55[_0x8e98('0x3b')](_0x24530[_0x8e98('0x6a')]+_0x8e98('0x95'),_0x165d89[_0x8e98('0x96')],_0x165d89[_0x8e98('0x97')]);}else{_0xc95c55[_0x8e98('0x3b')](_0x24530[_0x8e98('0x6a')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x165d89[_0x8e98('0x96')],_0x165d89[_0x8e98('0x97')]);}if(_0x5ca1b4){logger[_0x8e98('0x98')](_0x8e98('0x99'),_0xc95c55[_0x8e98('0x79')]());require(_0x8e98('0x9a'))['fork'](path[_0x8e98('0x52')](__dirname,'../../components/export/',_0x5ca1b4[_0x8e98('0x8b')]),[_0x5ca1b4['id'],_0xc95c55[_0x8e98('0x79')](),path[_0x8e98('0x52')](__dirname,_0x8e98('0x9b'),_0x5ca1b4[_0x8e98('0x9c')]),_0x3a1eaf]);return _0x5ca1b4;}else{var _0xf7eee7=squel[_0x8e98('0x83')]();_0xf7eee7[_0x8e98('0x84')]('('+_0xc95c55[_0x8e98('0x79')]()+')','countTable');_0xf7eee7['field'](_0x8e98('0x9d'),_0x8e98('0x1b'));_0xc95c55[_0x8e98('0x38')](_0x165d89['limit']||_0xdc8176);_0xc95c55[_0x8e98('0x1c')](_0x165d89[_0x8e98('0x1c')]||0x0);return db['sequelize'][_0x8e98('0x2e')](_0xf7eee7['toString'](),{'type':db[_0x8e98('0x88')]['QueryTypes']['SELECT']})['then'](function(_0xe03198){if(!_0xe03198[_0x8e98('0x35')]){_0x5d9031=0x0;}else{_0x5d9031=_0xe03198[0x0]['count']||0x0;}return db[_0x8e98('0x88')][_0x8e98('0x2e')](_0xc95c55[_0x8e98('0x79')](),{'type':db[_0x8e98('0x88')]['QueryTypes']['SELECT']});})['then'](function(_0xeab4b0){return{'rows':_0xeab4b0||[],'count':_0x5d9031};});}});}exports['run']=function(_0x2a9a8a,_0x2a9dc5){return runReport(_0x2a9a8a[_0x8e98('0x45')],_0x2a9a8a[_0x8e98('0x2e')],_0x2a9a8a[_0x8e98('0x3f')])[_0x8e98('0x22')](respondWithResult(_0x2a9dc5,null))[_0x8e98('0x44')](handleError(_0x2a9dc5,null));};exports['runReport']=runReport;exports[_0x8e98('0x2e')]=function(_0x29f29e,_0x2270bf){var _0x1fa3e5=0xa;var _0x4854ae=[_0x8e98('0x52'),_0x8e98('0x7c'),_0x8e98('0x7d'),'cross_join'];var _0x12e655={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x8e98('0x80'),'MAX':_0x8e98('0x54'),'MIN':_0x8e98('0x55'),'AVG':_0x8e98('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x8e98('0x59')};var _0x387e15={'SEC_TO_TIME':_0x8e98('0x9e'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x8e98('0x5b'),'UNIX_TIMESTAMP':_0x8e98('0x5c')};var _0x37c5e6=function(_0x140b7c){return!_['includes']([_0x8e98('0x5e'),'IS\x20NOT\x20NULL',_0x8e98('0x9f'),_0x8e98('0xa0')],_0x140b7c);};var _0x27ce65=function(_0x56b903){if(!_0x56b903||!_0x56b903[_0x8e98('0x60')]['length']){return'';}for(var _0x171559='(',_0x57e84e=0x0;_0x57e84e<_0x56b903['rules'][_0x8e98('0x35')];_0x57e84e+=0x1){_0x57e84e>0x0&&(_0x171559+='\x20'+_0x56b903[_0x8e98('0x61')]+'\x20');_0x171559+=_0x56b903[_0x8e98('0x60')][_0x57e84e][_0x8e98('0x62')]?_0x27ce65(_0x56b903['rules'][_0x57e84e][_0x8e98('0x62')]):_0x56b903[_0x8e98('0x60')][_0x57e84e][_0x8e98('0x63')]+'\x20'+_0x56b903[_0x8e98('0x60')][_0x57e84e][_0x8e98('0x64')]+(_0x37c5e6(_0x56b903[_0x8e98('0x60')][_0x57e84e][_0x8e98('0x64')])?'\x20'+_0x56b903[_0x8e98('0x60')][_0x57e84e]['value']:'');}return _0x171559+')';};var _0x3ace97={'where':{'id':_0x29f29e[_0x8e98('0x45')]['id']}},_0x5258ca,_0x346e92,_0x2d6ec6,_0x13f50d,_0x874f7c;_0x3ace97=_[_0x8e98('0x3e')]({},_0x3ace97,_0x29f29e[_0x8e98('0x3f')]);return db['AnalyticDefaultReport']['find'](_0x3ace97)[_0x8e98('0x22')](function(_0x43cf18){if(_0x43cf18){_0x5258ca=_0x43cf18;return _0x43cf18['getFields']();}return null;})['then'](function(_0x3c98ae){if(_0x3c98ae){if(!_0x3c98ae[_0x8e98('0x35')]){throw new db['Sequelize'][(_0x8e98('0x89'))](_0x8e98('0x67'),0x193);}_0x346e92=_0x3c98ae;return db[_0x8e98('0x68')][_0x8e98('0x42')]({'raw':!![]});}return null;})['then'](function(_0x3c6d80){if(_0x3c6d80){_0x2d6ec6=_[_0x8e98('0x69')](_0x3c6d80,'id');var _0x142147;var _0x2e5773=squel['select']();_0x2e5773[_0x8e98('0x84')](_0x5258ca['table']);for(var _0x3c6761=0x0;_0x3c6761<_0x346e92[_0x8e98('0x35')];_0x3c6761+=0x1){_0x142147=_0x346e92[_0x3c6761][_0x8e98('0x6b')]?_0x2d6ec6[_0x346e92[_0x3c6761][_0x8e98('0x6b')]][_0x8e98('0xa1')]:_0x346e92[_0x3c6761][_0x8e98('0x63')];_0x142147=_0x346e92[_0x3c6761][_0x8e98('0x85')]?_[_0x8e98('0x6c')](_0x12e655[_0x346e92[_0x3c6761][_0x8e98('0x85')]],'%s',_0x142147):_0x142147;_0x142147=_0x346e92[_0x3c6761][_0x8e98('0x6d')]?_['replace'](_0x387e15[_0x346e92[_0x3c6761]['format']],'%s',_0x142147):_0x142147;if(_0x346e92[_0x3c6761]['groupBy']){_0x2e5773[_0x8e98('0x62')](_0x142147);}_0x346e92[_0x3c6761][_0x8e98('0x6f')]&&_0x2e5773[_0x8e98('0x39')](_0x142147,_0x346e92[_0x3c6761][_0x8e98('0x6f')]===_0x8e98('0x70')?![]:!![]);_0x2e5773[_0x8e98('0x63')](_0x142147,_0x346e92[_0x3c6761]['alias']||_0x142147);}if(_0x5258ca[_0x8e98('0x71')]){_0x5258ca[_0x8e98('0x71')]=JSON['parse'](_0x5258ca['joins']);for(var _0xae3e61=0x0;_0xae3e61<_0x5258ca[_0x8e98('0x71')][_0x8e98('0x35')];_0xae3e61+=0x1){if(_0x5258ca['joins'][_0xae3e61]['type']&&_[_0x8e98('0x5d')](_0x4854ae,_0x5258ca[_0x8e98('0x71')][_0xae3e61]['type'])&&_0x5258ca[_0x8e98('0x71')][_0xae3e61][_0x8e98('0x76')]&&_0x5258ca[_0x8e98('0x71')][_0xae3e61][_0x8e98('0x73')]&&_0x5258ca[_0x8e98('0x71')][_0xae3e61][_0x8e98('0x74')]){_0x2e5773[_0x5258ca[_0x8e98('0x71')][_0xae3e61]['type']](_0x5258ca[_0x8e98('0x71')][_0xae3e61][_0x8e98('0x73')],null,util['format'](_0x8e98('0x75'),_0x5258ca['table'],_0x5258ca[_0x8e98('0x71')][_0xae3e61][_0x8e98('0x76')],_0x5258ca[_0x8e98('0x71')][_0xae3e61]['foreignTable'],_0x5258ca[_0x8e98('0x71')][_0xae3e61][_0x8e98('0x74')]));}}}if(_0x5258ca[_0x8e98('0x77')]){_0x5258ca[_0x8e98('0x77')]=JSON[_0x8e98('0x72')](_0x5258ca[_0x8e98('0x77')]);_0x2e5773[_0x8e98('0x3b')](_0x27ce65(_0x5258ca[_0x8e98('0x77')][_0x8e98('0x62')]));}_0x874f7c=_0x2e5773[_0x8e98('0x86')]();_0x2e5773[_0x8e98('0x38')](_0x1fa3e5);_0x2e5773[_0x8e98('0x1c')](0x0);logger[_0x8e98('0x87')]('Limited\x20Query:',_0x2e5773[_0x8e98('0x79')]());return db[_0x8e98('0x88')]['query'](_0x2e5773[_0x8e98('0x79')](),{'type':db['sequelize']['QueryTypes'][_0x8e98('0x7b')]});}})[_0x8e98('0x22')](function(){return{'sql':_0x874f7c[_0x8e98('0x79')]()};})['then'](respondWithResult(_0x2270bf,null))[_0x8e98('0x44')](handleError(_0x2270bf,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 02010df..0e8e551 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 _0x3e42=['rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4388f6,_0x87722e){var _0x3f31b7=function(_0x3ba380){while(--_0x3ba380){_0x4388f6['push'](_0x4388f6['shift']());}};_0x3f31b7(++_0x87722e);}(_0x3e42,0xf5));var _0x23e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e42[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x23e4('0x0'));var util=require('util');var logger=require(_0x23e4('0x1'))(_0x23e4('0x2'));var moment=require(_0x23e4('0x3'));var BPromise=require(_0x23e4('0x4'));var rp=require(_0x23e4('0x5'));var fs=require('fs');var path=require(_0x23e4('0x6'));var rimraf=require(_0x23e4('0x7'));var config=require(_0x23e4('0x8'));var attributes=require(_0x23e4('0x9'));module[_0x23e4('0xa')]=function(_0x494e54,_0x58d31a){return _0x494e54[_0x23e4('0xb')](_0x23e4('0xc'),attributes,{'tableName':_0x23e4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2fb5=['AnalyticDefaultReport','analytics_default_reports','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define'];(function(_0x1fd7d5,_0x31ac26){var _0x419de5=function(_0x49fdc8){while(--_0x49fdc8){_0x1fd7d5['push'](_0x1fd7d5['shift']());}};_0x419de5(++_0x31ac26);}(_0x2fb5,0xff));var _0x52fb=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x2fb5[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0x52fb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x52fb('0x1'));var moment=require(_0x52fb('0x2'));var BPromise=require(_0x52fb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x52fb('0x4'));var rimraf=require(_0x52fb('0x5'));var config=require(_0x52fb('0x6'));var attributes=require(_0x52fb('0x7'));module['exports']=function(_0x148eab,_0x520f30){return _0x148eab[_0x52fb('0x8')](_0x52fb('0x9'),attributes,{'tableName':_0x52fb('0xa'),'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 5b30182..2bc9aaa 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 _0xa71c=['../../config/utils','rpc','../../config/environment','client','http','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa71c,0x12a));var _0xca71=function(_0x3e4a63,_0x5078db){_0x3e4a63=_0x3e4a63-0x0;var _0x527e2c=_0xa71c[_0x3e4a63];return _0x527e2c;};'use strict';var _=require(_0xca71('0x0'));var util=require(_0xca71('0x1'));var moment=require(_0xca71('0x2'));var BPromise=require(_0xca71('0x3'));var rs=require(_0xca71('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca71('0x5'))['db'];var utils=require(_0xca71('0x6'));var logger=require('../../config/logger')(_0xca71('0x7'));var config=require(_0xca71('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xca71('0x9')][_0xca71('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe41976,_0x13c902,_0x4d5604){return new BPromise(function(_0x56e7be,_0x630f67){return client['request'](_0xe41976,_0x4d5604)['then'](function(_0x44eb51){logger[_0xca71('0xb')](_0xca71('0xc'),_0x13c902,_0xca71('0xd'));logger[_0xca71('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x13c902,_0xca71('0xd'),JSON[_0xca71('0xf')](_0x44eb51));if(_0x44eb51[_0xca71('0x10')]){if(_0x44eb51['error']['code']===0x1f4){logger[_0xca71('0x10')](_0xca71('0xc'),_0x13c902,_0x44eb51[_0xca71('0x10')]['message']);return _0x630f67(_0x44eb51[_0xca71('0x10')][_0xca71('0x11')]);}logger[_0xca71('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x13c902,_0x44eb51[_0xca71('0x10')][_0xca71('0x11')]);return _0x56e7be(_0x44eb51['error'][_0xca71('0x11')]);}else{logger[_0xca71('0xb')](_0xca71('0xc'),_0x13c902,_0xca71('0xd'));_0x56e7be(_0x44eb51['result'][_0xca71('0x11')]);}})[_0xca71('0x12')](function(_0x1d8349){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x13c902,_0x1d8349);_0x630f67(_0x1d8349);});});} \ No newline at end of file +var _0x5c00=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x5c00,0x17e));var _0x05c0=function(_0x47d12e,_0x2d0ada){_0x47d12e=_0x47d12e-0x0;var _0x1250dc=_0x5c00[_0x47d12e];return _0x1250dc;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var moment=require(_0x05c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x05c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05c0('0x4'))['db'];var utils=require(_0x05c0('0x5'));var logger=require(_0x05c0('0x6'))(_0x05c0('0x7'));var config=require('../../config/environment');var jayson=require(_0x05c0('0x8'));var client=jayson[_0x05c0('0x9')][_0x05c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27dc10,_0x5b9f09,_0x3a3b1b){return new BPromise(function(_0x34eb5f,_0x3ad5b7){return client['request'](_0x27dc10,_0x3a3b1b)[_0x05c0('0xb')](function(_0x32cdfa){logger[_0x05c0('0xc')](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));logger[_0x05c0('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x5b9f09,'request\x20sent',JSON[_0x05c0('0x10')](_0x32cdfa));if(_0x32cdfa['error']){if(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x12')]===0x1f4){logger[_0x05c0('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5b9f09,_0x32cdfa[_0x05c0('0x11')]['message']);return _0x3ad5b7(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);return _0x34eb5f(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}else{logger['info'](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));_0x34eb5f(_0x32cdfa[_0x05c0('0x14')][_0x05c0('0x13')]);}})[_0x05c0('0x15')](function(_0x40153e){logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x40153e);_0x3ad5b7(_0x40153e);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 66ba0b2..c77fa94 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 _0x5c18=['put','/:id','update','delete','destroy','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/preview','preview','/:id/run','/:id/query','query','create'];(function(_0x10497f,_0x83332a){var _0x381690=function(_0x25608c){while(--_0x25608c){_0x10497f['push'](_0x10497f['shift']());}};_0x381690(++_0x83332a);}(_0x5c18,0xb9));var _0x85c1=function(_0x56dd6b,_0x115741){_0x56dd6b=_0x56dd6b-0x0;var _0x54c13b=_0x5c18[_0x56dd6b];return _0x54c13b;};'use strict';var multer=require(_0x85c1('0x0'));var util=require(_0x85c1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x85c1('0x2'));var router=express['Router']();var auth=require(_0x85c1('0x3'));var interaction=require(_0x85c1('0x4'));var config=require(_0x85c1('0x5'));var controller=require('./analyticDefaultReport.controller');router[_0x85c1('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x85c1('0x6')]('/:id',auth[_0x85c1('0x7')](),controller[_0x85c1('0x8')]);router['get'](_0x85c1('0x9'),auth[_0x85c1('0x7')](),controller[_0x85c1('0xa')]);router[_0x85c1('0x6')](_0x85c1('0xb'),auth[_0x85c1('0x7')](),controller['run']);router['get'](_0x85c1('0xc'),auth[_0x85c1('0x7')](),controller[_0x85c1('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x85c1('0xe')]);router[_0x85c1('0xf')](_0x85c1('0x10'),auth[_0x85c1('0x7')](),controller[_0x85c1('0x11')]);router[_0x85c1('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x85c1('0x13')]);module['exports']=router; \ No newline at end of file +var _0xce5f=['/:id/preview','preview','/:id/run','/:id/query','query','post','create','/:id','update','destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','isAuthenticated','get','show'];(function(_0x332d05,_0x3f1e9f){var _0x1f58ae=function(_0x298929){while(--_0x298929){_0x332d05['push'](_0x332d05['shift']());}};_0x1f58ae(++_0x3f1e9f);}(_0xce5f,0xfa));var _0xfce5=function(_0x393884,_0x259c7a){_0x393884=_0x393884-0x0;var _0x261be5=_0xce5f[_0x393884];return _0x261be5;};'use strict';var multer=require(_0xfce5('0x0'));var util=require(_0xfce5('0x1'));var path=require('path');var timeout=require(_0xfce5('0x2'));var express=require('express');var router=express[_0xfce5('0x3')]();var auth=require(_0xfce5('0x4'));var interaction=require(_0xfce5('0x5'));var config=require('../../config/environment');var controller=require(_0xfce5('0x6'));router['get']('/',auth[_0xfce5('0x7')](),controller['index']);router[_0xfce5('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xfce5('0x9')]);router[_0xfce5('0x8')](_0xfce5('0xa'),auth[_0xfce5('0x7')](),controller[_0xfce5('0xb')]);router[_0xfce5('0x8')](_0xfce5('0xc'),auth[_0xfce5('0x7')](),controller['run']);router['get'](_0xfce5('0xd'),auth[_0xfce5('0x7')](),controller[_0xfce5('0xe')]);router[_0xfce5('0xf')]('/',auth[_0xfce5('0x7')](),controller[_0xfce5('0x10')]);router['put'](_0xfce5('0x11'),auth[_0xfce5('0x7')](),controller[_0xfce5('0x12')]);router['delete'](_0xfce5('0x11'),auth[_0xfce5('0x7')](),controller[_0xfce5('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index e2ed7e2..212163f 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 _0x0e7c=['xlsx','DATE','ENUM','scheduled','manual','INTEGER','UNSIGNED','sequelize','moment','STRING'];(function(_0x5a6de2,_0x5c8b10){var _0x2c0525=function(_0x59d072){while(--_0x59d072){_0x5a6de2['push'](_0x5a6de2['shift']());}};_0x2c0525(++_0x5c8b10);}(_0x0e7c,0x197));var _0xc0e7=function(_0x7261e6,_0x3e3bf7){_0x7261e6=_0x7261e6-0x0;var _0x20d5ed=_0x0e7c[_0x7261e6];return _0x20d5ed;};'use strict';var Sequelize=require(_0xc0e7('0x0'));var moment=require(_0xc0e7('0x1'));module['exports']={'name':{'type':Sequelize[_0xc0e7('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv','pdf',_0xc0e7('0x3')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xc0e7('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xc0e7('0x4')]},'endDate':{'type':Sequelize[_0xc0e7('0x4')]},'status':{'type':Sequelize[_0xc0e7('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xc0e7('0x5')]('manual',_0xc0e7('0x6')),'allowNull':![],'defaultValue':_0xc0e7('0x7')},'reportId':{'type':Sequelize[_0xc0e7('0x8')](0xb)[_0xc0e7('0x9')]},'reportType':{'type':Sequelize[_0xc0e7('0x2')]}}; \ No newline at end of file +var _0xde8a=['Loading','manual','INTEGER','sequelize','exports','STRING','ENUM','csv','pdf','xlsx','DATE'];(function(_0x143f9b,_0x3a95fb){var _0x4f453f=function(_0x385072){while(--_0x385072){_0x143f9b['push'](_0x143f9b['shift']());}};_0x4f453f(++_0x3a95fb);}(_0xde8a,0x71));var _0xade8=function(_0xc66173,_0x354878){_0xc66173=_0xc66173-0x0;var _0x424b76=_0xde8a[_0xc66173];return _0x424b76;};'use strict';var Sequelize=require(_0xade8('0x0'));var moment=require('moment');module[_0xade8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xade8('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xade8('0x3')](_0xade8('0x4'),_0xade8('0x5'),_0xade8('0x6')),'allowNull':![],'defaultValue':_0xade8('0x4')},'savename':{'type':Sequelize[_0xade8('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xade8('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xade8('0x2')],'defaultValue':_0xade8('0x8')},'type':{'type':Sequelize[_0xade8('0x3')](_0xade8('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0xade8('0x9')},'reportId':{'type':Sequelize[_0xade8('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xade8('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 142be26..837e64c 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 _0x3402=['existsSync','join','root','server/files/reports','ValidationError','exists','savename','format','%s.%s','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','end','sendStatus','stack','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','filters','filter','options','includeAll','include','catch','params','length','find','create','body','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','output'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3402,0x15e));var _0x2340=function(_0x5268b9,_0x585255){_0x5268b9=_0x5268b9-0x0;var _0x57baa5=_0x3402[_0x5268b9];return _0x57baa5;};'use strict';var pdf=require(_0x2340('0x0'));var emlformat=require(_0x2340('0x1'));var rimraf=require(_0x2340('0x2'));var zipdir=require(_0x2340('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2340('0x4'));var moment=require(_0x2340('0x5'));var BPromise=require(_0x2340('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2340('0x7'));var sox=require('sox');var csv=require(_0x2340('0x8'));var ejs=require(_0x2340('0x9'));var fs=require('fs');var _=require(_0x2340('0xa'));var squel=require(_0x2340('0xb'));var crypto=require(_0x2340('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2340('0xd'));var toCsv=require(_0x2340('0x8'));var querystring=require(_0x2340('0xe'));var Papa=require(_0x2340('0xf'));var Redis=require(_0x2340('0x10'));var authService=require(_0x2340('0x11'));var qs=require(_0x2340('0x12'));var as=require(_0x2340('0x13'));var hardwareService=require(_0x2340('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x2340('0x15'));var config=require(_0x2340('0x16'));var db=require(_0x2340('0x17'))['db'];function respondWithStatusCode(_0x1784af,_0x4608e9){_0x4608e9=_0x4608e9||0xcc;return function(_0x4f67f6){if(_0x4f67f6){return _0x1784af['sendStatus'](_0x4608e9);}return _0x1784af[_0x2340('0x18')](_0x4608e9)['end']();};}function respondWithResult(_0x332826,_0x2dd8a2){_0x2dd8a2=_0x2dd8a2||0xc8;return function(_0x316302){if(_0x316302){return _0x332826['status'](_0x2dd8a2)[_0x2340('0x19')](_0x316302);}};}function respondWithFilteredResult(_0x279e39,_0x17046a){return function(_0x25390a){if(_0x25390a){var _0x5ad568=_0x25390a[_0x2340('0x1a')],_0x8cd6f0=_0x17046a['offset'],_0x2745d6=_0x17046a['offset']+_0x17046a[_0x2340('0x1b')],_0x775008;if(_0x2745d6>=_0x5ad568){_0x2745d6=_0x5ad568;_0x775008=0xc8;}else{_0x775008=0xce;}_0x279e39[_0x2340('0x18')](_0x775008);return _0x279e39[_0x2340('0x1c')](_0x2340('0x1d'),_0x8cd6f0+'-'+_0x2745d6+'/'+_0x5ad568)[_0x2340('0x19')](_0x25390a);}return null;};}function patchUpdates(_0x4f7a4e){return function(_0x4f7558){try{jsonpatch[_0x2340('0x1e')](_0x4f7558,_0x4f7a4e,!![]);}catch(_0x1f93b1){return BPromise[_0x2340('0x1f')](_0x1f93b1);}return _0x4f7558[_0x2340('0x20')]();};}function saveUpdates(_0x1f43ac,_0x4ccf13){return function(_0x3610b5){if(_0x3610b5){return _0x3610b5[_0x2340('0x21')](_0x1f43ac)[_0x2340('0x22')](function(_0x2c8bd8){return _0x2c8bd8;});}return null;};}function removeEntity(_0x865404,_0x1e2520){return function(_0x112e33){if(_0x112e33){return _0x112e33[_0x2340('0x23')]()['then'](function(){var _0x452507=_0x112e33[_0x2340('0x24')]({'plain':!![]});var _0x295a74=_0x2340('0x25');return db['UserProfileResource'][_0x2340('0x23')]({'where':{'type':_0x295a74,'resourceId':_0x452507['id']}})[_0x2340('0x22')](function(){return _0x112e33;});})[_0x2340('0x22')](function(){_0x865404[_0x2340('0x18')](0xcc)[_0x2340('0x26')]();});}};}function handleEntityNotFound(_0x1cb5c4,_0x5e565d){return function(_0x56550b){if(!_0x56550b){_0x1cb5c4[_0x2340('0x27')](0x194);}return _0x56550b;};}function handleError(_0x27af56,_0x39b106){_0x39b106=_0x39b106||0x1f4;return function(_0x5ef686){logger['error'](_0x5ef686[_0x2340('0x28')]);if(_0x5ef686[_0x2340('0x29')]){delete _0x5ef686[_0x2340('0x29')];}_0x27af56[_0x2340('0x18')](_0x39b106)[_0x2340('0x2a')](_0x5ef686);};}exports['index']=function(_0x2f3a75,_0x111413){var _0x7fe9c5={},_0x478a83={},_0xa36492={'count':0x0,'rows':[]};var _0x1d5fcb=_[_0x2340('0x2b')](db[_0x2340('0x2c')][_0x2340('0x2d')],function(_0x53666b){return{'name':_0x53666b[_0x2340('0x2e')],'type':_0x53666b['type']['key']};});_0x478a83[_0x2340('0x2f')]=_[_0x2340('0x2b')](_0x1d5fcb,'name');_0x478a83[_0x2340('0x30')]=_[_0x2340('0x31')](_0x2f3a75[_0x2340('0x30')]);_0x478a83['filters']=_[_0x2340('0x32')](_0x478a83[_0x2340('0x2f')],_0x478a83[_0x2340('0x30')]);_0x7fe9c5['attributes']=_[_0x2340('0x32')](_0x478a83[_0x2340('0x2f')],qs[_0x2340('0x33')](_0x2f3a75[_0x2340('0x30')][_0x2340('0x33')]));_0x7fe9c5[_0x2340('0x34')]=_0x7fe9c5[_0x2340('0x34')]['length']?_0x7fe9c5[_0x2340('0x34')]:_0x478a83[_0x2340('0x2f')];if(!_0x2f3a75[_0x2340('0x30')][_0x2340('0x35')](_0x2340('0x36'))){_0x7fe9c5[_0x2340('0x1b')]=qs[_0x2340('0x1b')](_0x2f3a75['query'][_0x2340('0x1b')]);_0x7fe9c5['offset']=qs[_0x2340('0x37')](_0x2f3a75[_0x2340('0x30')]['offset']);}_0x7fe9c5[_0x2340('0x38')]=qs[_0x2340('0x39')](_0x2f3a75[_0x2340('0x30')][_0x2340('0x39')]);_0x7fe9c5[_0x2340('0x3a')]=qs[_0x2340('0x3b')](_['pick'](_0x2f3a75['query'],_0x478a83[_0x2340('0x3b')]));if(_0x2f3a75[_0x2340('0x30')][_0x2340('0x3c')]){_0x7fe9c5[_0x2340('0x3a')]=_['merge'](_0x7fe9c5[_0x2340('0x3a')],{'$or':_['map'](_0x1d5fcb,function(_0xdc652c){if(_0xdc652c['type']!=='VIRTUAL'){var _0x51c28f={};_0x51c28f[_0xdc652c[_0x2340('0x29')]]={'$like':'%'+_0x2f3a75[_0x2340('0x30')][_0x2340('0x3c')]+'%'};return _0x51c28f;}})});}_0x7fe9c5=_['merge']({},_0x7fe9c5,_0x2f3a75[_0x2340('0x3d')]);var _0x289979={'where':_0x7fe9c5[_0x2340('0x3a')]};return db['AnalyticExtractedReport'][_0x2340('0x1a')](_0x289979)[_0x2340('0x22')](function(_0x525a3e){_0xa36492[_0x2340('0x1a')]=_0x525a3e;if(_0x2f3a75[_0x2340('0x30')][_0x2340('0x3e')]){_0x7fe9c5[_0x2340('0x3f')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x7fe9c5);})[_0x2340('0x22')](function(_0x916697){_0xa36492['rows']=_0x916697;return _0xa36492;})[_0x2340('0x22')](respondWithFilteredResult(_0x111413,_0x7fe9c5))[_0x2340('0x40')](handleError(_0x111413,null));};exports['show']=function(_0x1829bc,_0x19d271){var _0x523160={'raw':!![],'where':{'id':_0x1829bc[_0x2340('0x41')]['id']}},_0x101b38={};_0x101b38[_0x2340('0x2f')]=_[_0x2340('0x31')](db[_0x2340('0x2c')][_0x2340('0x2d')]);_0x101b38[_0x2340('0x30')]=_[_0x2340('0x31')](_0x1829bc[_0x2340('0x30')]);_0x101b38[_0x2340('0x3b')]=_[_0x2340('0x32')](_0x101b38[_0x2340('0x2f')],_0x101b38[_0x2340('0x30')]);_0x523160['attributes']=_[_0x2340('0x32')](_0x101b38[_0x2340('0x2f')],qs[_0x2340('0x33')](_0x1829bc[_0x2340('0x30')][_0x2340('0x33')]));_0x523160[_0x2340('0x34')]=_0x523160['attributes'][_0x2340('0x42')]?_0x523160['attributes']:_0x101b38['model'];if(_0x1829bc[_0x2340('0x30')]['includeAll']){_0x523160[_0x2340('0x3f')]=[{'all':!![]}];}_0x523160=_['merge']({},_0x523160,_0x1829bc['options']);return db[_0x2340('0x2c')][_0x2340('0x43')](_0x523160)[_0x2340('0x22')](handleEntityNotFound(_0x19d271,null))[_0x2340('0x22')](respondWithResult(_0x19d271,null))[_0x2340('0x40')](handleError(_0x19d271,null));};exports[_0x2340('0x44')]=function(_0x43dab9,_0x5dd5b0){return db[_0x2340('0x2c')][_0x2340('0x44')](_0x43dab9[_0x2340('0x45')],{})['then'](function(_0x5b9ade){var _0x19118a=_0x43dab9[_0x2340('0x46')][_0x2340('0x24')]({'plain':!![]});if(!_0x19118a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19118a['role']===_0x2340('0x46')){var _0x210a58=_0x5b9ade[_0x2340('0x24')]({'plain':!![]});var _0x56b4f8=_0x2340('0x25');return db['UserProfileSection'][_0x2340('0x43')]({'where':{'name':_0x56b4f8,'userProfileId':_0x19118a['userProfileId']},'raw':!![]})[_0x2340('0x22')](function(_0x37e6ff){if(_0x37e6ff&&_0x37e6ff['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x210a58[_0x2340('0x29')],'resourceId':_0x210a58['id'],'type':_0x37e6ff['name'],'sectionId':_0x37e6ff['id']},{})[_0x2340('0x22')](function(){return _0x5b9ade;});}else{return _0x5b9ade;}})[_0x2340('0x40')](function(_0x4056bd){logger['error'](_0x2340('0x47'),_0x4056bd);throw _0x4056bd;});}return _0x5b9ade;})['then'](respondWithResult(_0x5dd5b0,0xc9))['catch'](handleError(_0x5dd5b0,null));};exports[_0x2340('0x21')]=function(_0x4012b8,_0x214e8c){if(_0x4012b8[_0x2340('0x45')]['id']){delete _0x4012b8[_0x2340('0x45')]['id'];}return db[_0x2340('0x2c')]['find']({'where':{'id':_0x4012b8['params']['id']}})[_0x2340('0x22')](handleEntityNotFound(_0x214e8c,null))[_0x2340('0x22')](saveUpdates(_0x4012b8[_0x2340('0x45')],null))[_0x2340('0x22')](respondWithResult(_0x214e8c,null))['catch'](handleError(_0x214e8c,null));};exports[_0x2340('0x23')]=function(_0x10c166,_0x5691c9){return db[_0x2340('0x2c')][_0x2340('0x43')]({'where':{'id':_0x10c166['params']['id']}})['then'](handleEntityNotFound(_0x5691c9,null))[_0x2340('0x22')](removeEntity(_0x5691c9,null))[_0x2340('0x40')](handleError(_0x5691c9,null));};exports[_0x2340('0x48')]=function(_0x32ca61,_0x3e1de6,_0x1af719){return db[_0x2340('0x2c')]['find']({'where':{'id':_0x32ca61['params']['id']},'attributes':[_0x2340('0x29'),_0x2340('0x49'),'savename',_0x2340('0x4a')],'raw':!![]})[_0x2340('0x22')](handleEntityNotFound(_0x3e1de6,null))[_0x2340('0x22')](function(_0x1aa773){if(_0x1aa773){if(!fs[_0x2340('0x4b')](path[_0x2340('0x4c')](config[_0x2340('0x4d')],_0x2340('0x4e'),_0x1aa773['savename']))){throw new db['Sequelize'][(_0x2340('0x4f'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x32ca61['query'][_0x2340('0x50')]){return _0x3e1de6[_0x2340('0x27')](0xc8);}return _0x3e1de6[_0x2340('0x48')](path['join'](config['root'],'server/files/reports',_0x1aa773[_0x2340('0x51')]),util[_0x2340('0x52')](_0x2340('0x53'),_0x1aa773[_0x2340('0x49')]||_0x1aa773['name'],_0x1aa773['output'][_0x2340('0x54')]()));}})[_0x2340('0x40')](handleError(_0x3e1de6,null));}; \ No newline at end of file +var _0x9361=['status','json','count','offset','limit','set','Content-Range','reject','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','send','index','AnalyticExtractedReport','rawAttributes','fieldName','key','model','map','name','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','show','params','keys','length','find','catch','body','user','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','root','server/files/reports','Report\x20not\x20found\x20or\x20empty','exists','join','format','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end'];(function(_0x30f897,_0x37455e){var _0x40bfff=function(_0x5530bf){while(--_0x5530bf){_0x30f897['push'](_0x30f897['shift']());}};_0x40bfff(++_0x37455e);}(_0x9361,0x15c));var _0x1936=function(_0x13feec,_0x503b3f){_0x13feec=_0x13feec-0x0;var _0x3d4661=_0x9361[_0x13feec];return _0x3d4661;};'use strict';var pdf=require(_0x1936('0x0'));var emlformat=require(_0x1936('0x1'));var rimraf=require(_0x1936('0x2'));var zipdir=require(_0x1936('0x3'));var jsonpatch=require(_0x1936('0x4'));var rp=require('request-promise');var moment=require(_0x1936('0x5'));var BPromise=require(_0x1936('0x6'));var Mustache=require(_0x1936('0x7'));var util=require(_0x1936('0x8'));var path=require(_0x1936('0x9'));var sox=require(_0x1936('0xa'));var csv=require(_0x1936('0xb'));var ejs=require(_0x1936('0xc'));var fs=require('fs');var _=require(_0x1936('0xd'));var squel=require(_0x1936('0xe'));var crypto=require(_0x1936('0xf'));var jsforce=require(_0x1936('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x1936('0xb'));var querystring=require(_0x1936('0x11'));var Papa=require('papaparse');var Redis=require(_0x1936('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1936('0x13'));var as=require(_0x1936('0x14'));var hardwareService=require(_0x1936('0x15'));var logger=require(_0x1936('0x16'))(_0x1936('0x17'));var utils=require(_0x1936('0x18'));var config=require(_0x1936('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x441991,_0x531549){_0x531549=_0x531549||0xcc;return function(_0x1526b6){if(_0x1526b6){return _0x441991[_0x1936('0x1a')](_0x531549);}return _0x441991['status'](_0x531549)[_0x1936('0x1b')]();};}function respondWithResult(_0x46047c,_0x232dc8){_0x232dc8=_0x232dc8||0xc8;return function(_0xb7cd77){if(_0xb7cd77){return _0x46047c[_0x1936('0x1c')](_0x232dc8)[_0x1936('0x1d')](_0xb7cd77);}};}function respondWithFilteredResult(_0x269c62,_0x5347bc){return function(_0x571368){if(_0x571368){var _0x4032fa=_0x571368[_0x1936('0x1e')],_0x130bd3=_0x5347bc['offset'],_0x5c4f40=_0x5347bc[_0x1936('0x1f')]+_0x5347bc[_0x1936('0x20')],_0x4cc2c7;if(_0x5c4f40>=_0x4032fa){_0x5c4f40=_0x4032fa;_0x4cc2c7=0xc8;}else{_0x4cc2c7=0xce;}_0x269c62[_0x1936('0x1c')](_0x4cc2c7);return _0x269c62[_0x1936('0x21')](_0x1936('0x22'),_0x130bd3+'-'+_0x5c4f40+'/'+_0x4032fa)['json'](_0x571368);}return null;};}function patchUpdates(_0x341941){return function(_0x4b8143){try{jsonpatch['apply'](_0x4b8143,_0x341941,!![]);}catch(_0x5d9818){return BPromise[_0x1936('0x23')](_0x5d9818);}return _0x4b8143['save']();};}function saveUpdates(_0x564ad1,_0x5405f4){return function(_0x1fe113){if(_0x1fe113){return _0x1fe113['update'](_0x564ad1)[_0x1936('0x24')](function(_0xe75ed9){return _0xe75ed9;});}return null;};}function removeEntity(_0xcbc948,_0x44e845){return function(_0x248f0b){if(_0x248f0b){return _0x248f0b[_0x1936('0x25')]()['then'](function(){var _0x41d940=_0x248f0b[_0x1936('0x26')]({'plain':!![]});var _0x3d4f33=_0x1936('0x27');return db[_0x1936('0x28')]['destroy']({'where':{'type':_0x3d4f33,'resourceId':_0x41d940['id']}})['then'](function(){return _0x248f0b;});})[_0x1936('0x24')](function(){_0xcbc948[_0x1936('0x1c')](0xcc)[_0x1936('0x1b')]();});}};}function handleEntityNotFound(_0x384f29,_0x4ebf4d){return function(_0x27a398){if(!_0x27a398){_0x384f29[_0x1936('0x1a')](0x194);}return _0x27a398;};}function handleError(_0xa505a2,_0x198c6a){_0x198c6a=_0x198c6a||0x1f4;return function(_0x56bdde){logger[_0x1936('0x29')](_0x56bdde[_0x1936('0x2a')]);if(_0x56bdde['name']){delete _0x56bdde['name'];}_0xa505a2['status'](_0x198c6a)[_0x1936('0x2b')](_0x56bdde);};}exports[_0x1936('0x2c')]=function(_0x3a51db,_0x44cdf2){var _0x41607f={},_0x3ce0d1={},_0x269b28={'count':0x0,'rows':[]};var _0x507f1c=_['map'](db[_0x1936('0x2d')][_0x1936('0x2e')],function(_0x46a8ba){return{'name':_0x46a8ba[_0x1936('0x2f')],'type':_0x46a8ba['type'][_0x1936('0x30')]};});_0x3ce0d1[_0x1936('0x31')]=_[_0x1936('0x32')](_0x507f1c,_0x1936('0x33'));_0x3ce0d1['query']=_['keys'](_0x3a51db[_0x1936('0x34')]);_0x3ce0d1[_0x1936('0x35')]=_[_0x1936('0x36')](_0x3ce0d1[_0x1936('0x31')],_0x3ce0d1['query']);_0x41607f['attributes']=_['intersection'](_0x3ce0d1[_0x1936('0x31')],qs[_0x1936('0x37')](_0x3a51db[_0x1936('0x34')][_0x1936('0x37')]));_0x41607f[_0x1936('0x38')]=_0x41607f['attributes']['length']?_0x41607f['attributes']:_0x3ce0d1['model'];if(!_0x3a51db[_0x1936('0x34')][_0x1936('0x39')](_0x1936('0x3a'))){_0x41607f['limit']=qs[_0x1936('0x20')](_0x3a51db[_0x1936('0x34')][_0x1936('0x20')]);_0x41607f[_0x1936('0x1f')]=qs[_0x1936('0x1f')](_0x3a51db['query']['offset']);}_0x41607f[_0x1936('0x3b')]=qs[_0x1936('0x3c')](_0x3a51db[_0x1936('0x34')]['sort']);_0x41607f[_0x1936('0x3d')]=qs[_0x1936('0x35')](_[_0x1936('0x3e')](_0x3a51db[_0x1936('0x34')],_0x3ce0d1[_0x1936('0x35')]));if(_0x3a51db[_0x1936('0x34')][_0x1936('0x3f')]){_0x41607f[_0x1936('0x3d')]=_[_0x1936('0x40')](_0x41607f[_0x1936('0x3d')],{'$or':_[_0x1936('0x32')](_0x507f1c,function(_0x267335){if(_0x267335[_0x1936('0x41')]!=='VIRTUAL'){var _0x296c76={};_0x296c76[_0x267335['name']]={'$like':'%'+_0x3a51db['query'][_0x1936('0x3f')]+'%'};return _0x296c76;}})});}_0x41607f=_[_0x1936('0x40')]({},_0x41607f,_0x3a51db[_0x1936('0x42')]);var _0x240ca4={'where':_0x41607f['where']};return db[_0x1936('0x2d')][_0x1936('0x1e')](_0x240ca4)['then'](function(_0x241e21){_0x269b28[_0x1936('0x1e')]=_0x241e21;if(_0x3a51db[_0x1936('0x34')][_0x1936('0x43')]){_0x41607f[_0x1936('0x44')]=[{'all':!![]}];}return db[_0x1936('0x2d')]['findAll'](_0x41607f);})[_0x1936('0x24')](function(_0x18140f){_0x269b28[_0x1936('0x45')]=_0x18140f;return _0x269b28;})[_0x1936('0x24')](respondWithFilteredResult(_0x44cdf2,_0x41607f))['catch'](handleError(_0x44cdf2,null));};exports[_0x1936('0x46')]=function(_0x3760fd,_0x54170f){var _0x32991d={'raw':!![],'where':{'id':_0x3760fd[_0x1936('0x47')]['id']}},_0x129de0={};_0x129de0[_0x1936('0x31')]=_['keys'](db['AnalyticExtractedReport'][_0x1936('0x2e')]);_0x129de0[_0x1936('0x34')]=_[_0x1936('0x48')](_0x3760fd[_0x1936('0x34')]);_0x129de0[_0x1936('0x35')]=_['intersection'](_0x129de0[_0x1936('0x31')],_0x129de0[_0x1936('0x34')]);_0x32991d['attributes']=_[_0x1936('0x36')](_0x129de0[_0x1936('0x31')],qs[_0x1936('0x37')](_0x3760fd[_0x1936('0x34')][_0x1936('0x37')]));_0x32991d[_0x1936('0x38')]=_0x32991d['attributes'][_0x1936('0x49')]?_0x32991d[_0x1936('0x38')]:_0x129de0['model'];if(_0x3760fd['query'][_0x1936('0x43')]){_0x32991d[_0x1936('0x44')]=[{'all':!![]}];}_0x32991d=_[_0x1936('0x40')]({},_0x32991d,_0x3760fd[_0x1936('0x42')]);return db['AnalyticExtractedReport'][_0x1936('0x4a')](_0x32991d)[_0x1936('0x24')](handleEntityNotFound(_0x54170f,null))['then'](respondWithResult(_0x54170f,null))[_0x1936('0x4b')](handleError(_0x54170f,null));};exports['create']=function(_0xcf8c8c,_0x19973d){return db[_0x1936('0x2d')]['create'](_0xcf8c8c[_0x1936('0x4c')],{})[_0x1936('0x24')](function(_0x28a460){var _0x5f5d9f=_0xcf8c8c[_0x1936('0x4d')][_0x1936('0x26')]({'plain':!![]});if(!_0x5f5d9f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f5d9f['role']===_0x1936('0x4d')){var _0x1cb3f5=_0x28a460[_0x1936('0x26')]({'plain':!![]});var _0xec559e=_0x1936('0x27');return db[_0x1936('0x4e')][_0x1936('0x4a')]({'where':{'name':_0xec559e,'userProfileId':_0x5f5d9f[_0x1936('0x4f')]},'raw':!![]})['then'](function(_0x1dc969){if(_0x1dc969&&_0x1dc969['autoAssociation']===0x0){return db[_0x1936('0x28')][_0x1936('0x50')]({'name':_0x1cb3f5[_0x1936('0x33')],'resourceId':_0x1cb3f5['id'],'type':_0x1dc969[_0x1936('0x33')],'sectionId':_0x1dc969['id']},{})[_0x1936('0x24')](function(){return _0x28a460;});}else{return _0x28a460;}})[_0x1936('0x4b')](function(_0x454b67){logger[_0x1936('0x29')](_0x1936('0x51'),_0x454b67);throw _0x454b67;});}return _0x28a460;})['then'](respondWithResult(_0x19973d,0xc9))[_0x1936('0x4b')](handleError(_0x19973d,null));};exports['update']=function(_0x680f51,_0x38a27b){if(_0x680f51[_0x1936('0x4c')]['id']){delete _0x680f51['body']['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x680f51[_0x1936('0x47')]['id']}})[_0x1936('0x24')](handleEntityNotFound(_0x38a27b,null))[_0x1936('0x24')](saveUpdates(_0x680f51[_0x1936('0x4c')],null))[_0x1936('0x24')](respondWithResult(_0x38a27b,null))[_0x1936('0x4b')](handleError(_0x38a27b,null));};exports[_0x1936('0x25')]=function(_0x60fd1e,_0x5a38c4){return db[_0x1936('0x2d')][_0x1936('0x4a')]({'where':{'id':_0x60fd1e[_0x1936('0x47')]['id']}})[_0x1936('0x24')](handleEntityNotFound(_0x5a38c4,null))[_0x1936('0x24')](removeEntity(_0x5a38c4,null))[_0x1936('0x4b')](handleError(_0x5a38c4,null));};exports[_0x1936('0x52')]=function(_0x27980a,_0x386ade,_0x510e7b){return db['AnalyticExtractedReport'][_0x1936('0x4a')]({'where':{'id':_0x27980a[_0x1936('0x47')]['id']},'attributes':[_0x1936('0x33'),_0x1936('0x53'),_0x1936('0x54'),_0x1936('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0x386ade,null))[_0x1936('0x24')](function(_0x4f1bf8){if(_0x4f1bf8){if(!fs[_0x1936('0x56')](path['join'](config[_0x1936('0x57')],_0x1936('0x58'),_0x4f1bf8[_0x1936('0x54')]))){throw new db['Sequelize']['ValidationError'](_0x1936('0x59'));}if(_0x27980a[_0x1936('0x34')][_0x1936('0x5a')]){return _0x386ade[_0x1936('0x1a')](0xc8);}return _0x386ade[_0x1936('0x52')](path[_0x1936('0x5b')](config[_0x1936('0x57')],_0x1936('0x58'),_0x4f1bf8['savename']),util[_0x1936('0x5c')]('%s.%s',_0x4f1bf8[_0x1936('0x53')]||_0x4f1bf8[_0x1936('0x33')],_0x4f1bf8[_0x1936('0x55')][_0x1936('0x5d')]()));}})[_0x1936('0x4b')](handleError(_0x386ade,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 151aa69..d175c49 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 _0x612f=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','util','../../config/logger'];(function(_0x11f4b5,_0x279f0d){var _0x59d5e0=function(_0x224edd){while(--_0x224edd){_0x11f4b5['push'](_0x11f4b5['shift']());}};_0x59d5e0(++_0x279f0d);}(_0x612f,0xda));var _0xf612=function(_0x3f32e4,_0x4681c7){_0x3f32e4=_0x3f32e4-0x0;var _0x18fbef=_0x612f[_0x3f32e4];return _0x18fbef;};'use strict';var _=require(_0xf612('0x0'));var util=require(_0xf612('0x1'));var logger=require(_0xf612('0x2'))(_0xf612('0x3'));var moment=require(_0xf612('0x4'));var BPromise=require(_0xf612('0x5'));var rp=require(_0xf612('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf612('0x7'));var config=require(_0xf612('0x8'));var attributes=require(_0xf612('0x9'));module[_0xf612('0xa')]=function(_0x9aec1a,_0x2026f1){return _0x9aec1a[_0xf612('0xb')](_0xf612('0xc'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3aa=['../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x3d6459,_0x4c72bb){var _0x389455=function(_0x401ee4){while(--_0x401ee4){_0x3d6459['push'](_0x3d6459['shift']());}};_0x389455(++_0x4c72bb);}(_0xb3aa,0x1f3));var _0xab3a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3aa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xab3a('0x0'));var util=require(_0xab3a('0x1'));var logger=require(_0xab3a('0x2'))(_0xab3a('0x3'));var moment=require('moment');var BPromise=require(_0xab3a('0x4'));var rp=require(_0xab3a('0x5'));var fs=require('fs');var path=require(_0xab3a('0x6'));var rimraf=require(_0xab3a('0x7'));var config=require(_0xab3a('0x8'));var attributes=require(_0xab3a('0x9'));module[_0xab3a('0xa')]=function(_0x4a77c3,_0xa209a0){return _0x4a77c3[_0xab3a('0xb')](_0xab3a('0xc'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index d762148..1105c63 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 _0x888f=['message','result','catch','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','AnalyticExtractedReport,\x20%s,\x20%s'];(function(_0x118f89,_0x129cc1){var _0x24caa5=function(_0x334cc7){while(--_0x334cc7){_0x118f89['push'](_0x118f89['shift']());}};_0x24caa5(++_0x129cc1);}(_0x888f,0x129));var _0xf888=function(_0x4470b0,_0x562818){_0x4470b0=_0x4470b0-0x0;var _0x5a0fad=_0x888f[_0x4470b0];return _0x5a0fad;};'use strict';var _=require(_0xf888('0x0'));var util=require(_0xf888('0x1'));var moment=require(_0xf888('0x2'));var BPromise=require('bluebird');var rs=require(_0xf888('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf888('0x4'))(_0xf888('0x5'));var config=require(_0xf888('0x6'));var jayson=require(_0xf888('0x7'));var client=jayson[_0xf888('0x8')][_0xf888('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa81aaa,_0x4a6da7,_0x5d23d4){return new BPromise(function(_0x4594d1,_0x3273a6){return client[_0xf888('0xa')](_0xa81aaa,_0x5d23d4)[_0xf888('0xb')](function(_0x4eb9b9){logger[_0xf888('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4a6da7,_0xf888('0xd'));logger[_0xf888('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x4a6da7,_0xf888('0xd'),JSON[_0xf888('0xf')](_0x4eb9b9));if(_0x4eb9b9['error']){if(_0x4eb9b9[_0xf888('0x10')]['code']===0x1f4){logger[_0xf888('0x10')](_0xf888('0x11'),_0x4a6da7,_0x4eb9b9[_0xf888('0x10')][_0xf888('0x12')]);return _0x3273a6(_0x4eb9b9['error']['message']);}logger[_0xf888('0x10')](_0xf888('0x11'),_0x4a6da7,_0x4eb9b9[_0xf888('0x10')][_0xf888('0x12')]);return _0x4594d1(_0x4eb9b9['error'][_0xf888('0x12')]);}else{logger['info'](_0xf888('0x11'),_0x4a6da7,'request\x20sent');_0x4594d1(_0x4eb9b9[_0xf888('0x13')]['message']);}})[_0xf888('0x14')](function(_0x1b899a){logger[_0xf888('0x10')](_0xf888('0x11'),_0x4a6da7,_0x1b899a);_0x3273a6(_0x1b899a);});});} \ No newline at end of file +var _0xeb28=['then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x55a066,_0x8e9bd3){var _0x13288f=function(_0x295f89){while(--_0x295f89){_0x55a066['push'](_0x55a066['shift']());}};_0x13288f(++_0x8e9bd3);}(_0xeb28,0xa9));var _0x8eb2=function(_0x3d70a5,_0x33b93c){_0x3d70a5=_0x3d70a5-0x0;var _0x9c306c=_0xeb28[_0x3d70a5];return _0x9c306c;};'use strict';var _=require(_0x8eb2('0x0'));var util=require(_0x8eb2('0x1'));var moment=require(_0x8eb2('0x2'));var BPromise=require(_0x8eb2('0x3'));var rs=require(_0x8eb2('0x4'));var fs=require('fs');var Redis=require(_0x8eb2('0x5'));var db=require(_0x8eb2('0x6'))['db'];var utils=require(_0x8eb2('0x7'));var logger=require(_0x8eb2('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8eb2('0x9'));var client=jayson[_0x8eb2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x590a82,_0x5141ee,_0x305376){return new BPromise(function(_0x41e71e,_0x4013f9){return client['request'](_0x590a82,_0x305376)[_0x8eb2('0xb')](function(_0xdd55af){logger[_0x8eb2('0xc')](_0x8eb2('0xd'),_0x5141ee,_0x8eb2('0xe'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x5141ee,_0x8eb2('0xe'),JSON['stringify'](_0xdd55af));if(_0xdd55af['error']){if(_0xdd55af[_0x8eb2('0xf')][_0x8eb2('0x10')]===0x1f4){logger[_0x8eb2('0xf')](_0x8eb2('0xd'),_0x5141ee,_0xdd55af[_0x8eb2('0xf')][_0x8eb2('0x11')]);return _0x4013f9(_0xdd55af[_0x8eb2('0xf')][_0x8eb2('0x11')]);}logger[_0x8eb2('0xf')](_0x8eb2('0xd'),_0x5141ee,_0xdd55af[_0x8eb2('0xf')][_0x8eb2('0x11')]);return _0x41e71e(_0xdd55af[_0x8eb2('0xf')][_0x8eb2('0x11')]);}else{logger[_0x8eb2('0xc')](_0x8eb2('0xd'),_0x5141ee,'request\x20sent');_0x41e71e(_0xdd55af['result']['message']);}})['catch'](function(_0x57cec4){logger[_0x8eb2('0xf')](_0x8eb2('0xd'),_0x5141ee,_0x57cec4);_0x4013f9(_0x57cec4);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index cdeded8..3051e7f 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 _0xdfaa=['/:id','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index'];(function(_0x1deee5,_0x1d4485){var _0x1d6c3a=function(_0x433abf){while(--_0x433abf){_0x1deee5['push'](_0x1deee5['shift']());}};_0x1d6c3a(++_0x1d4485);}(_0xdfaa,0x14a));var _0xadfa=function(_0x570356,_0x44de76){_0x570356=_0x570356-0x0;var _0x33a8f8=_0xdfaa[_0x570356];return _0x33a8f8;};'use strict';var multer=require(_0xadfa('0x0'));var util=require(_0xadfa('0x1'));var path=require(_0xadfa('0x2'));var timeout=require(_0xadfa('0x3'));var express=require(_0xadfa('0x4'));var router=express['Router']();var auth=require(_0xadfa('0x5'));var interaction=require(_0xadfa('0x6'));var config=require(_0xadfa('0x7'));var controller=require(_0xadfa('0x8'));router[_0xadfa('0x9')]('/',auth[_0xadfa('0xa')](),controller[_0xadfa('0xb')]);router[_0xadfa('0x9')](_0xadfa('0xc'),auth[_0xadfa('0xa')](),controller[_0xadfa('0xd')]);router[_0xadfa('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xadfa('0xa')](),controller[_0xadfa('0xe')]);router[_0xadfa('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xadfa('0x10')](_0xadfa('0xc'),auth[_0xadfa('0xa')](),controller[_0xadfa('0x11')]);module[_0xadfa('0x12')]=router; \ No newline at end of file +var _0xf6ed=['connect-timeout','express','../../components/interaction/service','get','index','/:id','isAuthenticated','show','download','post','create','update','destroy','exports','multer','path'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xf6ed,0x1ce));var _0xdf6e=function(_0x39dd89,_0x5e054a){_0x39dd89=_0x39dd89-0x0;var _0x4dcbc4=_0xf6ed[_0x39dd89];return _0x4dcbc4;};'use strict';var multer=require(_0xdf6e('0x0'));var util=require('util');var path=require(_0xdf6e('0x1'));var timeout=require(_0xdf6e('0x2'));var express=require(_0xdf6e('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xdf6e('0x4'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0xdf6e('0x5')]('/',auth['isAuthenticated'](),controller[_0xdf6e('0x6')]);router['get'](_0xdf6e('0x7'),auth[_0xdf6e('0x8')](),controller[_0xdf6e('0x9')]);router[_0xdf6e('0x5')]('/:id/download',auth[_0xdf6e('0x8')](),controller[_0xdf6e('0xa')]);router[_0xdf6e('0xb')]('/',auth[_0xdf6e('0x8')](),controller[_0xdf6e('0xc')]);router['put'](_0xdf6e('0x7'),auth['isAuthenticated'](),controller[_0xdf6e('0xd')]);router['delete'](_0xdf6e('0x7'),auth['isAuthenticated'](),controller[_0xdf6e('0xe')]);module[_0xdf6e('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 457fae5..42a2bbd 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x24abf0,_0xa8d0f2){var _0x1b79c7=function(_0x5b5e8c){while(--_0x5b5e8c){_0x24abf0['push'](_0x24abf0['shift']());}};_0x1b79c7(++_0xa8d0f2);}(_0x7217,0x19e));var _0x7721=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x7217[_0x1ddedd];return _0xa3e1ac;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'field':{'type':Sequelize[_0x7721('0x1')]},'alias':{'type':Sequelize[_0x7721('0x2')]},'function':{'type':Sequelize[_0x7721('0x2')]},'format':{'type':Sequelize[_0x7721('0x2')]},'groupBy':{'type':Sequelize[_0x7721('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x814b=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x41dfac,_0x278319){var _0x12900b=function(_0x3324cd){while(--_0x3324cd){_0x41dfac['push'](_0x41dfac['shift']());}};_0x12900b(++_0x278319);}(_0x814b,0x1a2));var _0xb814=function(_0x2b55b5,_0x78505e){_0x2b55b5=_0x2b55b5-0x0;var _0x103d28=_0x814b[_0x2b55b5];return _0x103d28;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'field':{'type':Sequelize[_0xb814('0x2')]},'alias':{'type':Sequelize[_0xb814('0x3')]},'function':{'type':Sequelize[_0xb814('0x3')]},'format':{'type':Sequelize[_0xb814('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb814('0x3')]},'custom':{'type':Sequelize[_0xb814('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 7ca4008..731e7d2 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 _0x90ec=['ids','addFields','findOne','sequelize','transaction','CustomReportId','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','status','end','json','offset','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','VIRTUAL','merge','options','count','include','AnalyticFieldReport','params','keys','catch','body','bulkCreate','update','find','bulkDestroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x90ec,0x1d4));var _0xc90e=function(_0x56310b,_0x3ef42b){_0x56310b=_0x56310b-0x0;var _0x5b6948=_0x90ec[_0x56310b];return _0x5b6948;};'use strict';var pdf=require(_0xc90e('0x0'));var emlformat=require(_0xc90e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc90e('0x2'));var jsonpatch=require(_0xc90e('0x3'));var rp=require(_0xc90e('0x4'));var moment=require(_0xc90e('0x5'));var BPromise=require(_0xc90e('0x6'));var Mustache=require('mustache');var util=require(_0xc90e('0x7'));var path=require(_0xc90e('0x8'));var sox=require(_0xc90e('0x9'));var csv=require('to-csv');var ejs=require(_0xc90e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc90e('0xb'));var crypto=require(_0xc90e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc90e('0xd'));var toCsv=require(_0xc90e('0xe'));var querystring=require(_0xc90e('0xf'));var Papa=require(_0xc90e('0x10'));var Redis=require(_0xc90e('0x11'));var authService=require(_0xc90e('0x12'));var qs=require(_0xc90e('0x13'));var as=require(_0xc90e('0x14'));var hardwareService=require(_0xc90e('0x15'));var logger=require('../../config/logger')(_0xc90e('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4faa0a,_0x30b4bd){_0x30b4bd=_0x30b4bd||0xcc;return function(_0x41d560){if(_0x41d560){return _0x4faa0a['sendStatus'](_0x30b4bd);}return _0x4faa0a[_0xc90e('0x17')](_0x30b4bd)[_0xc90e('0x18')]();};}function respondWithResult(_0x52beef,_0x1ab6fb){_0x1ab6fb=_0x1ab6fb||0xc8;return function(_0x40e989){if(_0x40e989){return _0x52beef[_0xc90e('0x17')](_0x1ab6fb)[_0xc90e('0x19')](_0x40e989);}};}function respondWithFilteredResult(_0x1de265,_0x13334c){return function(_0x53e2e1){if(_0x53e2e1){var _0x16050f=_0x53e2e1['count'],_0x2ada5a=_0x13334c[_0xc90e('0x1a')],_0x4ff295=_0x13334c[_0xc90e('0x1a')]+_0x13334c['limit'],_0xd16172;if(_0x4ff295>=_0x16050f){_0x4ff295=_0x16050f;_0xd16172=0xc8;}else{_0xd16172=0xce;}_0x1de265[_0xc90e('0x17')](_0xd16172);return _0x1de265[_0xc90e('0x1b')](_0xc90e('0x1c'),_0x2ada5a+'-'+_0x4ff295+'/'+_0x16050f)['json'](_0x53e2e1);}return null;};}function patchUpdates(_0x5cf3f5){return function(_0x486725){try{jsonpatch[_0xc90e('0x1d')](_0x486725,_0x5cf3f5,!![]);}catch(_0x147120){return BPromise[_0xc90e('0x1e')](_0x147120);}return _0x486725[_0xc90e('0x1f')]();};}function saveUpdates(_0x8fb1ef,_0x50d0a2){return function(_0x469f0d){if(_0x469f0d){return _0x469f0d['update'](_0x8fb1ef)[_0xc90e('0x20')](function(_0x3cf47c){return _0x3cf47c;});}return null;};}function removeEntity(_0x5e6bb1,_0x20b839){return function(_0x134760){if(_0x134760){return _0x134760[_0xc90e('0x21')]()[_0xc90e('0x20')](function(){_0x5e6bb1[_0xc90e('0x17')](0xcc)[_0xc90e('0x18')]();});}};}function handleEntityNotFound(_0x1a25bc,_0x136187){return function(_0x1cff73){if(!_0x1cff73){_0x1a25bc['sendStatus'](0x194);}return _0x1cff73;};}function handleError(_0x1d700a,_0x41deea){_0x41deea=_0x41deea||0x1f4;return function(_0x25223e){logger[_0xc90e('0x22')](_0x25223e[_0xc90e('0x23')]);if(_0x25223e['name']){delete _0x25223e[_0xc90e('0x24')];}_0x1d700a[_0xc90e('0x17')](_0x41deea)[_0xc90e('0x25')](_0x25223e);};}exports['index']=function(_0x3a30c7,_0x2ea6e6){var _0x45ac61={},_0x136da6={},_0x18cdc4={'count':0x0,'rows':[]};var _0x270040=_['map'](db['AnalyticFieldReport'][_0xc90e('0x26')],function(_0x550e8f){return{'name':_0x550e8f[_0xc90e('0x27')],'type':_0x550e8f[_0xc90e('0x28')][_0xc90e('0x29')]};});_0x136da6[_0xc90e('0x2a')]=_[_0xc90e('0x2b')](_0x270040,_0xc90e('0x24'));_0x136da6[_0xc90e('0x2c')]=_['keys'](_0x3a30c7[_0xc90e('0x2c')]);_0x136da6[_0xc90e('0x2d')]=_['intersection'](_0x136da6[_0xc90e('0x2a')],_0x136da6['query']);_0x45ac61[_0xc90e('0x2e')]=_[_0xc90e('0x2f')](_0x136da6[_0xc90e('0x2a')],qs[_0xc90e('0x30')](_0x3a30c7[_0xc90e('0x2c')][_0xc90e('0x30')]));_0x45ac61[_0xc90e('0x2e')]=_0x45ac61[_0xc90e('0x2e')][_0xc90e('0x31')]?_0x45ac61['attributes']:_0x136da6['model'];if(!_0x3a30c7[_0xc90e('0x2c')][_0xc90e('0x32')](_0xc90e('0x33'))){_0x45ac61[_0xc90e('0x34')]=qs[_0xc90e('0x34')](_0x3a30c7[_0xc90e('0x2c')][_0xc90e('0x34')]);_0x45ac61[_0xc90e('0x1a')]=qs[_0xc90e('0x1a')](_0x3a30c7[_0xc90e('0x2c')]['offset']);}_0x45ac61[_0xc90e('0x35')]=qs[_0xc90e('0x36')](_0x3a30c7[_0xc90e('0x2c')][_0xc90e('0x36')]);_0x45ac61['where']=qs['filters'](_['pick'](_0x3a30c7[_0xc90e('0x2c')],_0x136da6[_0xc90e('0x2d')]));if(_0x3a30c7[_0xc90e('0x2c')][_0xc90e('0x37')]){_0x45ac61[_0xc90e('0x38')]=_['merge'](_0x45ac61[_0xc90e('0x38')],{'$or':_[_0xc90e('0x2b')](_0x270040,function(_0x1139eb){if(_0x1139eb[_0xc90e('0x28')]!==_0xc90e('0x39')){var _0x24c5bd={};_0x24c5bd[_0x1139eb[_0xc90e('0x24')]]={'$like':'%'+_0x3a30c7[_0xc90e('0x2c')][_0xc90e('0x37')]+'%'};return _0x24c5bd;}})});}_0x45ac61=_[_0xc90e('0x3a')]({},_0x45ac61,_0x3a30c7[_0xc90e('0x3b')]);var _0x5feb0c={'where':_0x45ac61[_0xc90e('0x38')]};return db['AnalyticFieldReport'][_0xc90e('0x3c')](_0x5feb0c)[_0xc90e('0x20')](function(_0x4acd33){_0x18cdc4['count']=_0x4acd33;if(_0x3a30c7[_0xc90e('0x2c')]['includeAll']){_0x45ac61[_0xc90e('0x3d')]=[{'all':!![]}];}return db[_0xc90e('0x3e')]['findAll'](_0x45ac61);})[_0xc90e('0x20')](function(_0x4d7911){_0x18cdc4['rows']=_0x4d7911;return _0x18cdc4;})[_0xc90e('0x20')](respondWithFilteredResult(_0x2ea6e6,_0x45ac61))['catch'](handleError(_0x2ea6e6,null));};exports['show']=function(_0x28bb9f,_0x226a12){var _0x584647={'raw':![],'where':{'id':_0x28bb9f[_0xc90e('0x3f')]['id']}},_0x3f1de7={};_0x3f1de7[_0xc90e('0x2a')]=_[_0xc90e('0x40')](db[_0xc90e('0x3e')][_0xc90e('0x26')]);_0x3f1de7[_0xc90e('0x2c')]=_[_0xc90e('0x40')](_0x28bb9f['query']);_0x3f1de7[_0xc90e('0x2d')]=_['intersection'](_0x3f1de7['model'],_0x3f1de7[_0xc90e('0x2c')]);_0x584647['attributes']=_[_0xc90e('0x2f')](_0x3f1de7['model'],qs[_0xc90e('0x30')](_0x28bb9f[_0xc90e('0x2c')][_0xc90e('0x30')]));_0x584647[_0xc90e('0x2e')]=_0x584647[_0xc90e('0x2e')][_0xc90e('0x31')]?_0x584647[_0xc90e('0x2e')]:_0x3f1de7[_0xc90e('0x2a')];if(_0x28bb9f[_0xc90e('0x2c')]['includeAll']){_0x584647[_0xc90e('0x3d')]=[{'all':!![]}];}_0x584647=_[_0xc90e('0x3a')]({},_0x584647,_0x28bb9f[_0xc90e('0x3b')]);return db[_0xc90e('0x3e')]['find'](_0x584647)[_0xc90e('0x20')](handleEntityNotFound(_0x226a12,null))[_0xc90e('0x20')](respondWithResult(_0x226a12,null))[_0xc90e('0x41')](handleError(_0x226a12,null));};exports['create']=function(_0x2d4e07,_0x49c8ab){return db[_0xc90e('0x3e')]['create'](_0x2d4e07[_0xc90e('0x42')],{})['then'](respondWithResult(_0x49c8ab,0xc9))[_0xc90e('0x41')](handleError(_0x49c8ab,null));};exports[_0xc90e('0x43')]=function(_0x3812ed,_0x324a04){return db[_0xc90e('0x3e')][_0xc90e('0x43')](_0x3812ed[_0xc90e('0x42')],{'raw':![],'individualHooks':!![]})[_0xc90e('0x20')](respondWithResult(_0x324a04,0xc9))['catch'](handleError(_0x324a04,null));};exports[_0xc90e('0x44')]=function(_0x3de64f,_0x58eed6){if(_0x3de64f['body']['id']){delete _0x3de64f[_0xc90e('0x42')]['id'];}return db['AnalyticFieldReport'][_0xc90e('0x45')]({'where':{'id':_0x3de64f[_0xc90e('0x3f')]['id']}})[_0xc90e('0x20')](handleEntityNotFound(_0x58eed6,null))[_0xc90e('0x20')](saveUpdates(_0x3de64f[_0xc90e('0x42')],null))['then'](respondWithResult(_0x58eed6,null))[_0xc90e('0x41')](handleError(_0x58eed6,null));};exports[_0xc90e('0x21')]=function(_0x496b00,_0x2f6d54){return db['AnalyticFieldReport'][_0xc90e('0x45')]({'where':{'id':_0x496b00['params']['id']}})[_0xc90e('0x20')](handleEntityNotFound(_0x2f6d54,null))[_0xc90e('0x20')](removeEntity(_0x2f6d54,null))[_0xc90e('0x41')](handleError(_0x2f6d54,null));};exports[_0xc90e('0x46')]=function(_0xc7d60f,_0x3b8ec8){return db[_0xc90e('0x3e')][_0xc90e('0x21')]({'where':{'id':_0xc7d60f[_0xc90e('0x2c')][_0xc90e('0x47')]||[]},'raw':![],'individualHooks':!![]})[_0xc90e('0x20')](respondWithResult(_0x3b8ec8,0xcc))[_0xc90e('0x41')](handleError(_0x3b8ec8,null));};exports[_0xc90e('0x48')]=function(_0x6d0a9d,_0x358568,_0x3f104b){return db['AnalyticCustomReport'][_0xc90e('0x49')]({'where':{'id':_0x6d0a9d[_0xc90e('0x3f')]['id']}})[_0xc90e('0x20')](handleEntityNotFound(_0x358568,null))[_0xc90e('0x20')](function(_0x9934cc){if(_0x9934cc){return db[_0xc90e('0x4a')][_0xc90e('0x4b')](function(_0x567b09){return db[_0xc90e('0x3e')]['destroy']({'where':{'CustomReportId':_0x6d0a9d[_0xc90e('0x3f')]['id']},'transaction':_0x567b09})[_0xc90e('0x20')](function(_0x31e1da){var _0x22f0b2=_[_0xc90e('0x2b')](_0x6d0a9d['body'],function(_0x32559b){delete _0x32559b['id'];_0x32559b[_0xc90e('0x4c')]=_0x6d0a9d['params']['id'];return _0x32559b;});return db[_0xc90e('0x3e')][_0xc90e('0x43')](_0x22f0b2,{'transaction':_0x567b09});});})[_0xc90e('0x20')](function(){return db[_0xc90e('0x3e')]['findAll']({'where':{'CustomReportId':_0x6d0a9d['params']['id']}});});}})[_0xc90e('0x20')](respondWithResult(_0x358568,null))[_0xc90e('0x41')](handleError(_0x358568,null));}; \ No newline at end of file +var _0xa6b0=['filter','merge','VIRTUAL','options','includeAll','include','findAll','params','keys','find','catch','create','body','bulkCreate','ids','AnalyticCustomReport','transaction','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick'];(function(_0x1cc961,_0x2c42ee){var _0x471d86=function(_0x44e422){while(--_0x44e422){_0x1cc961['push'](_0x1cc961['shift']());}};_0x471d86(++_0x2c42ee);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x267ca2,_0xe2a4fd){_0x267ca2=_0x267ca2-0x0;var _0x3fd412=_0xa6b0[_0x267ca2];return _0x3fd412;};'use strict';var pdf=require(_0x0a6b('0x0'));var emlformat=require(_0x0a6b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0a6b('0x2'));var rp=require(_0x0a6b('0x3'));var moment=require(_0x0a6b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0a6b('0x5'));var util=require(_0x0a6b('0x6'));var path=require(_0x0a6b('0x7'));var sox=require(_0x0a6b('0x8'));var csv=require(_0x0a6b('0x9'));var ejs=require(_0x0a6b('0xa'));var fs=require('fs');var _=require(_0x0a6b('0xb'));var squel=require(_0x0a6b('0xc'));var crypto=require(_0x0a6b('0xd'));var jsforce=require(_0x0a6b('0xe'));var deskjs=require(_0x0a6b('0xf'));var toCsv=require(_0x0a6b('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0a6b('0x10'));var authService=require(_0x0a6b('0x11'));var qs=require(_0x0a6b('0x12'));var as=require(_0x0a6b('0x13'));var hardwareService=require(_0x0a6b('0x14'));var logger=require(_0x0a6b('0x15'))(_0x0a6b('0x16'));var utils=require(_0x0a6b('0x17'));var config=require(_0x0a6b('0x18'));var db=require(_0x0a6b('0x19'))['db'];function respondWithStatusCode(_0x391fe6,_0x890493){_0x890493=_0x890493||0xcc;return function(_0x244a7d){if(_0x244a7d){return _0x391fe6[_0x0a6b('0x1a')](_0x890493);}return _0x391fe6['status'](_0x890493)['end']();};}function respondWithResult(_0x9afc84,_0x2f27d6){_0x2f27d6=_0x2f27d6||0xc8;return function(_0x2abc4e){if(_0x2abc4e){return _0x9afc84[_0x0a6b('0x1b')](_0x2f27d6)[_0x0a6b('0x1c')](_0x2abc4e);}};}function respondWithFilteredResult(_0x45fc9f,_0x9bb98e){return function(_0x19e84c){if(_0x19e84c){var _0x1205a3=_0x19e84c[_0x0a6b('0x1d')],_0x9d7aba=_0x9bb98e['offset'],_0x4797d1=_0x9bb98e[_0x0a6b('0x1e')]+_0x9bb98e['limit'],_0xa36d75;if(_0x4797d1>=_0x1205a3){_0x4797d1=_0x1205a3;_0xa36d75=0xc8;}else{_0xa36d75=0xce;}_0x45fc9f[_0x0a6b('0x1b')](_0xa36d75);return _0x45fc9f[_0x0a6b('0x1f')](_0x0a6b('0x20'),_0x9d7aba+'-'+_0x4797d1+'/'+_0x1205a3)[_0x0a6b('0x1c')](_0x19e84c);}return null;};}function patchUpdates(_0x5c512a){return function(_0x33c278){try{jsonpatch[_0x0a6b('0x21')](_0x33c278,_0x5c512a,!![]);}catch(_0x4aadfe){return BPromise[_0x0a6b('0x22')](_0x4aadfe);}return _0x33c278[_0x0a6b('0x23')]();};}function saveUpdates(_0x1feb47,_0x491936){return function(_0x3ae3f4){if(_0x3ae3f4){return _0x3ae3f4[_0x0a6b('0x24')](_0x1feb47)[_0x0a6b('0x25')](function(_0x48681f){return _0x48681f;});}return null;};}function removeEntity(_0x220d3e,_0x531e4c){return function(_0xe4c2b9){if(_0xe4c2b9){return _0xe4c2b9[_0x0a6b('0x26')]()[_0x0a6b('0x25')](function(){_0x220d3e['status'](0xcc)[_0x0a6b('0x27')]();});}};}function handleEntityNotFound(_0xdda188,_0x3d153f){return function(_0x5c77fb){if(!_0x5c77fb){_0xdda188[_0x0a6b('0x1a')](0x194);}return _0x5c77fb;};}function handleError(_0x2e58fd,_0x1bbb0f){_0x1bbb0f=_0x1bbb0f||0x1f4;return function(_0x1b8b78){logger[_0x0a6b('0x28')](_0x1b8b78['stack']);if(_0x1b8b78[_0x0a6b('0x29')]){delete _0x1b8b78[_0x0a6b('0x29')];}_0x2e58fd[_0x0a6b('0x1b')](_0x1bbb0f)['send'](_0x1b8b78);};}exports[_0x0a6b('0x2a')]=function(_0x51e760,_0xecbf0c){var _0x2ef965={},_0x45ae97={},_0x4884a1={'count':0x0,'rows':[]};var _0x526fdc=_[_0x0a6b('0x2b')](db[_0x0a6b('0x2c')][_0x0a6b('0x2d')],function(_0x3d649e){return{'name':_0x3d649e[_0x0a6b('0x2e')],'type':_0x3d649e[_0x0a6b('0x2f')]['key']};});_0x45ae97[_0x0a6b('0x30')]=_[_0x0a6b('0x2b')](_0x526fdc,'name');_0x45ae97[_0x0a6b('0x31')]=_['keys'](_0x51e760['query']);_0x45ae97[_0x0a6b('0x32')]=_[_0x0a6b('0x33')](_0x45ae97[_0x0a6b('0x30')],_0x45ae97[_0x0a6b('0x31')]);_0x2ef965[_0x0a6b('0x34')]=_['intersection'](_0x45ae97['model'],qs[_0x0a6b('0x35')](_0x51e760[_0x0a6b('0x31')][_0x0a6b('0x35')]));_0x2ef965[_0x0a6b('0x34')]=_0x2ef965['attributes'][_0x0a6b('0x36')]?_0x2ef965[_0x0a6b('0x34')]:_0x45ae97['model'];if(!_0x51e760['query'][_0x0a6b('0x37')](_0x0a6b('0x38'))){_0x2ef965['limit']=qs[_0x0a6b('0x39')](_0x51e760[_0x0a6b('0x31')][_0x0a6b('0x39')]);_0x2ef965[_0x0a6b('0x1e')]=qs[_0x0a6b('0x1e')](_0x51e760[_0x0a6b('0x31')][_0x0a6b('0x1e')]);}_0x2ef965[_0x0a6b('0x3a')]=qs[_0x0a6b('0x3b')](_0x51e760[_0x0a6b('0x31')][_0x0a6b('0x3b')]);_0x2ef965[_0x0a6b('0x3c')]=qs['filters'](_[_0x0a6b('0x3d')](_0x51e760[_0x0a6b('0x31')],_0x45ae97['filters']));if(_0x51e760[_0x0a6b('0x31')][_0x0a6b('0x3e')]){_0x2ef965[_0x0a6b('0x3c')]=_[_0x0a6b('0x3f')](_0x2ef965[_0x0a6b('0x3c')],{'$or':_[_0x0a6b('0x2b')](_0x526fdc,function(_0x28bc13){if(_0x28bc13[_0x0a6b('0x2f')]!==_0x0a6b('0x40')){var _0x5d0a6a={};_0x5d0a6a[_0x28bc13[_0x0a6b('0x29')]]={'$like':'%'+_0x51e760[_0x0a6b('0x31')][_0x0a6b('0x3e')]+'%'};return _0x5d0a6a;}})});}_0x2ef965=_[_0x0a6b('0x3f')]({},_0x2ef965,_0x51e760[_0x0a6b('0x41')]);var _0x3f2449={'where':_0x2ef965[_0x0a6b('0x3c')]};return db[_0x0a6b('0x2c')][_0x0a6b('0x1d')](_0x3f2449)['then'](function(_0x1ee446){_0x4884a1[_0x0a6b('0x1d')]=_0x1ee446;if(_0x51e760[_0x0a6b('0x31')][_0x0a6b('0x42')]){_0x2ef965[_0x0a6b('0x43')]=[{'all':!![]}];}return db[_0x0a6b('0x2c')][_0x0a6b('0x44')](_0x2ef965);})[_0x0a6b('0x25')](function(_0xd1474b){_0x4884a1['rows']=_0xd1474b;return _0x4884a1;})[_0x0a6b('0x25')](respondWithFilteredResult(_0xecbf0c,_0x2ef965))['catch'](handleError(_0xecbf0c,null));};exports['show']=function(_0xb7a7d8,_0x4ea499){var _0x556a28={'raw':![],'where':{'id':_0xb7a7d8[_0x0a6b('0x45')]['id']}},_0x2f1221={};_0x2f1221[_0x0a6b('0x30')]=_['keys'](db[_0x0a6b('0x2c')]['rawAttributes']);_0x2f1221['query']=_[_0x0a6b('0x46')](_0xb7a7d8['query']);_0x2f1221[_0x0a6b('0x32')]=_['intersection'](_0x2f1221[_0x0a6b('0x30')],_0x2f1221['query']);_0x556a28['attributes']=_[_0x0a6b('0x33')](_0x2f1221[_0x0a6b('0x30')],qs[_0x0a6b('0x35')](_0xb7a7d8[_0x0a6b('0x31')]['fields']));_0x556a28[_0x0a6b('0x34')]=_0x556a28[_0x0a6b('0x34')][_0x0a6b('0x36')]?_0x556a28[_0x0a6b('0x34')]:_0x2f1221[_0x0a6b('0x30')];if(_0xb7a7d8[_0x0a6b('0x31')][_0x0a6b('0x42')]){_0x556a28['include']=[{'all':!![]}];}_0x556a28=_[_0x0a6b('0x3f')]({},_0x556a28,_0xb7a7d8[_0x0a6b('0x41')]);return db[_0x0a6b('0x2c')][_0x0a6b('0x47')](_0x556a28)[_0x0a6b('0x25')](handleEntityNotFound(_0x4ea499,null))[_0x0a6b('0x25')](respondWithResult(_0x4ea499,null))[_0x0a6b('0x48')](handleError(_0x4ea499,null));};exports[_0x0a6b('0x49')]=function(_0xa20567,_0x5ab75f){return db[_0x0a6b('0x2c')][_0x0a6b('0x49')](_0xa20567[_0x0a6b('0x4a')],{})[_0x0a6b('0x25')](respondWithResult(_0x5ab75f,0xc9))[_0x0a6b('0x48')](handleError(_0x5ab75f,null));};exports[_0x0a6b('0x4b')]=function(_0x8f1372,_0x5d2631){return db['AnalyticFieldReport'][_0x0a6b('0x4b')](_0x8f1372[_0x0a6b('0x4a')],{'raw':![],'individualHooks':!![]})[_0x0a6b('0x25')](respondWithResult(_0x5d2631,0xc9))[_0x0a6b('0x48')](handleError(_0x5d2631,null));};exports[_0x0a6b('0x24')]=function(_0x446187,_0x10fb77){if(_0x446187[_0x0a6b('0x4a')]['id']){delete _0x446187[_0x0a6b('0x4a')]['id'];}return db['AnalyticFieldReport'][_0x0a6b('0x47')]({'where':{'id':_0x446187[_0x0a6b('0x45')]['id']}})[_0x0a6b('0x25')](handleEntityNotFound(_0x10fb77,null))[_0x0a6b('0x25')](saveUpdates(_0x446187[_0x0a6b('0x4a')],null))['then'](respondWithResult(_0x10fb77,null))[_0x0a6b('0x48')](handleError(_0x10fb77,null));};exports[_0x0a6b('0x26')]=function(_0x3aa85f,_0x5fb0c3){return db[_0x0a6b('0x2c')][_0x0a6b('0x47')]({'where':{'id':_0x3aa85f[_0x0a6b('0x45')]['id']}})[_0x0a6b('0x25')](handleEntityNotFound(_0x5fb0c3,null))[_0x0a6b('0x25')](removeEntity(_0x5fb0c3,null))[_0x0a6b('0x48')](handleError(_0x5fb0c3,null));};exports['bulkDestroy']=function(_0x4c81a7,_0x488195){return db['AnalyticFieldReport'][_0x0a6b('0x26')]({'where':{'id':_0x4c81a7['query'][_0x0a6b('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x0a6b('0x25')](respondWithResult(_0x488195,0xcc))[_0x0a6b('0x48')](handleError(_0x488195,null));};exports['addFields']=function(_0x4473de,_0x2a0e28,_0x5e5fd8){return db[_0x0a6b('0x4d')]['findOne']({'where':{'id':_0x4473de[_0x0a6b('0x45')]['id']}})[_0x0a6b('0x25')](handleEntityNotFound(_0x2a0e28,null))['then'](function(_0x37bc1a){if(_0x37bc1a){return db['sequelize'][_0x0a6b('0x4e')](function(_0x37957a){return db[_0x0a6b('0x2c')]['destroy']({'where':{'CustomReportId':_0x4473de[_0x0a6b('0x45')]['id']},'transaction':_0x37957a})[_0x0a6b('0x25')](function(_0x18927f){var _0x167c08=_[_0x0a6b('0x2b')](_0x4473de[_0x0a6b('0x4a')],function(_0x479777){delete _0x479777['id'];_0x479777['CustomReportId']=_0x4473de['params']['id'];return _0x479777;});return db[_0x0a6b('0x2c')]['bulkCreate'](_0x167c08,{'transaction':_0x37957a});});})[_0x0a6b('0x25')](function(){return db[_0x0a6b('0x2c')]['findAll']({'where':{'CustomReportId':_0x4473de['params']['id']}});});}})['then'](respondWithResult(_0x2a0e28,null))[_0x0a6b('0x48')](handleError(_0x2a0e28,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index cf95b6e..76bd248 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 _0xd254=['analytics_report_fields','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd254,0x1d5));var _0x4d25=function(_0x5d7647,_0x57ba89){_0x5d7647=_0x5d7647-0x0;var _0x428374=_0xd254[_0x5d7647];return _0x428374;};'use strict';var _=require('lodash');var util=require(_0x4d25('0x0'));var logger=require(_0x4d25('0x1'))(_0x4d25('0x2'));var moment=require(_0x4d25('0x3'));var BPromise=require(_0x4d25('0x4'));var rp=require(_0x4d25('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4d25('0x6'));var config=require(_0x4d25('0x7'));var attributes=require(_0x4d25('0x8'));module[_0x4d25('0x9')]=function(_0x5218dd,_0x1e537b){return _0x5218dd['define'](_0x4d25('0xa'),attributes,{'tableName':_0x4d25('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdde8=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0x15289d,_0x278888){var _0x3c0f26=function(_0x1de498){while(--_0x1de498){_0x15289d['push'](_0x15289d['shift']());}};_0x3c0f26(++_0x278888);}(_0xdde8,0x1ed));var _0x8dde=function(_0x5fd016,_0x2d9cf4){_0x5fd016=_0x5fd016-0x0;var _0x92e1be=_0xdde8[_0x5fd016];return _0x92e1be;};'use strict';var _=require(_0x8dde('0x0'));var util=require(_0x8dde('0x1'));var logger=require(_0x8dde('0x2'))(_0x8dde('0x3'));var moment=require(_0x8dde('0x4'));var BPromise=require(_0x8dde('0x5'));var rp=require(_0x8dde('0x6'));var fs=require('fs');var path=require(_0x8dde('0x7'));var rimraf=require(_0x8dde('0x8'));var config=require(_0x8dde('0x9'));var attributes=require(_0x8dde('0xa'));module['exports']=function(_0x14a9d8,_0x4910ca){return _0x14a9d8['define'](_0x8dde('0xb'),attributes,{'tableName':_0x8dde('0xc'),'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 3456429..3b5adc6 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 _0xc301=['http','then','info','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x305524,_0x4c55f9){var _0x53c833=function(_0x5290db){while(--_0x5290db){_0x305524['push'](_0x305524['shift']());}};_0x53c833(++_0x4c55f9);}(_0xc301,0xc9));var _0x1c30=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xc301[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var util=require(_0x1c30('0x0'));var moment=require(_0x1c30('0x1'));var BPromise=require(_0x1c30('0x2'));var rs=require(_0x1c30('0x3'));var fs=require('fs');var Redis=require(_0x1c30('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1c30('0x5'));var logger=require(_0x1c30('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1c30('0x7'));var client=jayson[_0x1c30('0x8')][_0x1c30('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26fdcd,_0x48527e,_0x391fbe){return new BPromise(function(_0xdb3dec,_0x448339){return client['request'](_0x26fdcd,_0x391fbe)[_0x1c30('0xa')](function(_0x3298a3){logger[_0x1c30('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x48527e,'request\x20sent');logger[_0x1c30('0xc')](_0x1c30('0xd'),_0x48527e,_0x1c30('0xe'),JSON['stringify'](_0x3298a3));if(_0x3298a3['error']){if(_0x3298a3[_0x1c30('0xf')][_0x1c30('0x10')]===0x1f4){logger[_0x1c30('0xf')](_0x1c30('0x11'),_0x48527e,_0x3298a3[_0x1c30('0xf')][_0x1c30('0x12')]);return _0x448339(_0x3298a3[_0x1c30('0xf')][_0x1c30('0x12')]);}logger[_0x1c30('0xf')](_0x1c30('0x11'),_0x48527e,_0x3298a3[_0x1c30('0xf')]['message']);return _0xdb3dec(_0x3298a3[_0x1c30('0xf')][_0x1c30('0x12')]);}else{logger[_0x1c30('0xb')](_0x1c30('0x11'),_0x48527e,_0x1c30('0xe'));_0xdb3dec(_0x3298a3[_0x1c30('0x13')][_0x1c30('0x12')]);}})[_0x1c30('0x14')](function(_0x13cc8b){logger[_0x1c30('0xf')](_0x1c30('0x11'),_0x48527e,_0x13cc8b);_0x448339(_0x13cc8b);});});} \ No newline at end of file +var _0x4887=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4887,0x1cb));var _0x7488=function(_0x4d5111,_0x3b55bf){_0x4d5111=_0x4d5111-0x0;var _0x3003cb=_0x4887[_0x4d5111];return _0x3003cb;};'use strict';var _=require(_0x7488('0x0'));var util=require(_0x7488('0x1'));var moment=require(_0x7488('0x2'));var BPromise=require(_0x7488('0x3'));var rs=require(_0x7488('0x4'));var fs=require('fs');var Redis=require(_0x7488('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7488('0x6'));var logger=require(_0x7488('0x7'))(_0x7488('0x8'));var config=require(_0x7488('0x9'));var jayson=require(_0x7488('0xa'));var client=jayson[_0x7488('0xb')][_0x7488('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x51919f,_0x269844,_0x2913d8){return new BPromise(function(_0x301073,_0x5b5891){return client[_0x7488('0xd')](_0x51919f,_0x2913d8)[_0x7488('0xe')](function(_0x4d4503){logger[_0x7488('0xf')](_0x7488('0x10'),_0x269844,_0x7488('0x11'));logger['debug'](_0x7488('0x12'),_0x269844,_0x7488('0x11'),JSON[_0x7488('0x13')](_0x4d4503));if(_0x4d4503[_0x7488('0x14')]){if(_0x4d4503['error']['code']===0x1f4){logger[_0x7488('0x14')]('AnalyticFieldReport,\x20%s,\x20%s',_0x269844,_0x4d4503[_0x7488('0x14')][_0x7488('0x15')]);return _0x5b5891(_0x4d4503[_0x7488('0x14')][_0x7488('0x15')]);}logger[_0x7488('0x14')](_0x7488('0x10'),_0x269844,_0x4d4503['error']['message']);return _0x301073(_0x4d4503[_0x7488('0x14')]['message']);}else{logger[_0x7488('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x269844,_0x7488('0x11'));_0x301073(_0x4d4503[_0x7488('0x16')][_0x7488('0x15')]);}})[_0x7488('0x17')](function(_0x4200a7){logger[_0x7488('0x14')](_0x7488('0x10'),_0x269844,_0x4200a7);_0x5b5891(_0x4200a7);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 3592dbe..ca3e562 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['/:id/create_many','addFields','put','update','delete','bulkDestroy','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','bulkCreate'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x55ca,0x126));var _0xa55c=function(_0x27b3df,_0x34a01a){_0x27b3df=_0x27b3df-0x0;var _0x275390=_0x55ca[_0x27b3df];return _0x275390;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0xb')]('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xb')]('/create_many',auth['isAuthenticated'](),controller[_0xa55c('0xd')]);router[_0xa55c('0xb')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x10')](_0xa55c('0x9'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/destroy_many',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('0x15')]=router; \ No newline at end of file +var _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(_0x3ff058,_0x3c8653){var _0x5ed2e7=function(_0x25abd8){while(--_0x25abd8){_0x3ff058['push'](_0x3ff058['shift']());}};_0x5ed2e7(++_0x3c8653);}(_0x814b,0x1a2));var _0xb814=function(_0x53fe97,_0x544271){_0x53fe97=_0x53fe97-0x0;var _0x5c49a2=_0x814b[_0x53fe97];return _0x5c49a2;};'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 d0dbab4..c083c9a 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 _0x280b=['exports','STRING','TEXT'];(function(_0x13d29b,_0x3629a6){var _0x81f9b0=function(_0x5819f3){while(--_0x5819f3){_0x13d29b['push'](_0x13d29b['shift']());}};_0x81f9b0(++_0x3629a6);}(_0x280b,0x1bf));var _0xb280=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x280b[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0xb280('0x0')]={'name':{'type':Sequelize[_0xb280('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xb280('0x2')]},'description':{'type':Sequelize[_0xb280('0x1')]}}; \ No newline at end of file +var _0xf603=['exports','STRING','TEXT','sequelize'];(function(_0x144883,_0x10c865){var _0x199b14=function(_0x2dd2aa){while(--_0x2dd2aa){_0x144883['push'](_0x144883['shift']());}};_0x199b14(++_0x10c865);}(_0xf603,0xeb));var _0x3f60=function(_0x22269b,_0x319b56){_0x22269b=_0x22269b-0x0;var _0x5039dd=_0xf603[_0x22269b];return _0x5039dd;};'use strict';var Sequelize=require(_0x3f60('0x0'));module[_0x3f60('0x1')]={'name':{'type':Sequelize[_0x3f60('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x3f60('0x2')]},'metric':{'type':Sequelize[_0x3f60('0x3')]},'description':{'type':Sequelize[_0x3f60('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 5407ed8..27fec6e 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 _0xdb03=['sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','get','Metrics','UserProfileResource','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','length','sort','pick','filter','merge','where','options','includeAll','include','findAll','catch','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path'];(function(_0x34af74,_0x59ab9d){var _0x12d74b=function(_0x51a854){while(--_0x51a854){_0x34af74['push'](_0x34af74['shift']());}};_0x12d74b(++_0x59ab9d);}(_0xdb03,0x1cc));var _0x3db0=function(_0x4fa37c,_0x4ce3e7){_0x4fa37c=_0x4fa37c-0x0;var _0x1c670a=_0xdb03[_0x4fa37c];return _0x1c670a;};'use strict';var pdf=require(_0x3db0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3db0('0x1'));var zipdir=require(_0x3db0('0x2'));var jsonpatch=require(_0x3db0('0x3'));var rp=require(_0x3db0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3db0('0x5'));var util=require(_0x3db0('0x6'));var path=require(_0x3db0('0x7'));var sox=require(_0x3db0('0x8'));var csv=require(_0x3db0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3db0('0xa'));var squel=require(_0x3db0('0xb'));var crypto=require(_0x3db0('0xc'));var jsforce=require(_0x3db0('0xd'));var deskjs=require(_0x3db0('0xe'));var toCsv=require(_0x3db0('0x9'));var querystring=require(_0x3db0('0xf'));var Papa=require(_0x3db0('0x10'));var Redis=require('ioredis');var authService=require(_0x3db0('0x11'));var qs=require(_0x3db0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3db0('0x13'));var logger=require(_0x3db0('0x14'))(_0x3db0('0x15'));var utils=require(_0x3db0('0x16'));var config=require(_0x3db0('0x17'));var db=require(_0x3db0('0x18'))['db'];function respondWithStatusCode(_0x28da05,_0xd94656){_0xd94656=_0xd94656||0xcc;return function(_0x567d29){if(_0x567d29){return _0x28da05[_0x3db0('0x19')](_0xd94656);}return _0x28da05[_0x3db0('0x1a')](_0xd94656)[_0x3db0('0x1b')]();};}function respondWithResult(_0x2d0de6,_0x25fc14){_0x25fc14=_0x25fc14||0xc8;return function(_0x26aad4){if(_0x26aad4){return _0x2d0de6[_0x3db0('0x1a')](_0x25fc14)['json'](_0x26aad4);}};}function respondWithFilteredResult(_0x39f951,_0x8d272e){return function(_0x3b47e1){if(_0x3b47e1){var _0x374785=_0x3b47e1[_0x3db0('0x1c')],_0x11aad9=_0x8d272e[_0x3db0('0x1d')],_0x241c2b=_0x8d272e[_0x3db0('0x1d')]+_0x8d272e[_0x3db0('0x1e')],_0x5bf98a;if(_0x241c2b>=_0x374785){_0x241c2b=_0x374785;_0x5bf98a=0xc8;}else{_0x5bf98a=0xce;}_0x39f951['status'](_0x5bf98a);return _0x39f951[_0x3db0('0x1f')](_0x3db0('0x20'),_0x11aad9+'-'+_0x241c2b+'/'+_0x374785)[_0x3db0('0x21')](_0x3b47e1);}return null;};}function patchUpdates(_0x443838){return function(_0x462f84){try{jsonpatch['apply'](_0x462f84,_0x443838,!![]);}catch(_0x2f7c6a){return BPromise[_0x3db0('0x22')](_0x2f7c6a);}return _0x462f84[_0x3db0('0x23')]();};}function saveUpdates(_0x37f380,_0x141a28){return function(_0x30811b){if(_0x30811b){return _0x30811b[_0x3db0('0x24')](_0x37f380)[_0x3db0('0x25')](function(_0x1e6c38){return _0x1e6c38;});}return null;};}function removeEntity(_0x5a6108,_0x597837){return function(_0x4620b){if(_0x4620b){return _0x4620b[_0x3db0('0x26')]()['then'](function(){var _0x59d57a=_0x4620b[_0x3db0('0x27')]({'plain':!![]});var _0x2448ec=_0x3db0('0x28');return db[_0x3db0('0x29')][_0x3db0('0x26')]({'where':{'type':_0x2448ec,'resourceId':_0x59d57a['id']}})[_0x3db0('0x25')](function(){return _0x4620b;});})[_0x3db0('0x25')](function(){_0x5a6108[_0x3db0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ccef1,_0x493a08){return function(_0x470580){if(!_0x470580){_0x2ccef1['sendStatus'](0x194);}return _0x470580;};}function handleError(_0x4e883d,_0x356995){_0x356995=_0x356995||0x1f4;return function(_0x48c0aa){logger['error'](_0x48c0aa['stack']);if(_0x48c0aa[_0x3db0('0x2a')]){delete _0x48c0aa['name'];}_0x4e883d[_0x3db0('0x1a')](_0x356995)[_0x3db0('0x2b')](_0x48c0aa);};}exports['index']=function(_0x12aaa6,_0xff5b11){var _0x29d249={},_0x333bc1={},_0xc888b3={'count':0x0,'rows':[]};var _0xfcfb26=_[_0x3db0('0x2c')](db[_0x3db0('0x2d')][_0x3db0('0x2e')],function(_0x44583b){return{'name':_0x44583b[_0x3db0('0x2f')],'type':_0x44583b[_0x3db0('0x30')][_0x3db0('0x31')]};});_0x333bc1['model']=_[_0x3db0('0x2c')](_0xfcfb26,_0x3db0('0x2a'));_0x333bc1['query']=_[_0x3db0('0x32')](_0x12aaa6[_0x3db0('0x33')]);_0x333bc1[_0x3db0('0x34')]=_[_0x3db0('0x35')](_0x333bc1[_0x3db0('0x36')],_0x333bc1[_0x3db0('0x33')]);_0x29d249[_0x3db0('0x37')]=_[_0x3db0('0x35')](_0x333bc1[_0x3db0('0x36')],qs['fields'](_0x12aaa6[_0x3db0('0x33')]['fields']));_0x29d249['attributes']=_0x29d249['attributes'][_0x3db0('0x38')]?_0x29d249[_0x3db0('0x37')]:_0x333bc1['model'];if(!_0x12aaa6[_0x3db0('0x33')]['hasOwnProperty']('nolimit')){_0x29d249['limit']=qs[_0x3db0('0x1e')](_0x12aaa6[_0x3db0('0x33')][_0x3db0('0x1e')]);_0x29d249[_0x3db0('0x1d')]=qs[_0x3db0('0x1d')](_0x12aaa6[_0x3db0('0x33')][_0x3db0('0x1d')]);}_0x29d249['order']=qs[_0x3db0('0x39')](_0x12aaa6[_0x3db0('0x33')]['sort']);_0x29d249['where']=qs['filters'](_[_0x3db0('0x3a')](_0x12aaa6[_0x3db0('0x33')],_0x333bc1[_0x3db0('0x34')]));if(_0x12aaa6[_0x3db0('0x33')][_0x3db0('0x3b')]){_0x29d249['where']=_[_0x3db0('0x3c')](_0x29d249[_0x3db0('0x3d')],{'$or':_[_0x3db0('0x2c')](_0xfcfb26,function(_0x4547ed){if(_0x4547ed[_0x3db0('0x30')]!=='VIRTUAL'){var _0x127465={};_0x127465[_0x4547ed[_0x3db0('0x2a')]]={'$like':'%'+_0x12aaa6[_0x3db0('0x33')][_0x3db0('0x3b')]+'%'};return _0x127465;}})});}_0x29d249=_[_0x3db0('0x3c')]({},_0x29d249,_0x12aaa6[_0x3db0('0x3e')]);var _0x20a484={'where':_0x29d249[_0x3db0('0x3d')]};return db[_0x3db0('0x2d')][_0x3db0('0x1c')](_0x20a484)['then'](function(_0x43748e){_0xc888b3[_0x3db0('0x1c')]=_0x43748e;if(_0x12aaa6[_0x3db0('0x33')][_0x3db0('0x3f')]){_0x29d249[_0x3db0('0x40')]=[{'all':!![]}];}return db[_0x3db0('0x2d')][_0x3db0('0x41')](_0x29d249);})['then'](function(_0x4af61e){_0xc888b3['rows']=_0x4af61e;return _0xc888b3;})[_0x3db0('0x25')](respondWithFilteredResult(_0xff5b11,_0x29d249))[_0x3db0('0x42')](handleError(_0xff5b11,null));};exports['show']=function(_0x50b966,_0x2a8b35){var _0x354ff0={'raw':!![],'where':{'id':_0x50b966['params']['id']}},_0x1a1d49={};_0x1a1d49[_0x3db0('0x36')]=_[_0x3db0('0x32')](db['AnalyticMetric'][_0x3db0('0x2e')]);_0x1a1d49[_0x3db0('0x33')]=_['keys'](_0x50b966[_0x3db0('0x33')]);_0x1a1d49[_0x3db0('0x34')]=_['intersection'](_0x1a1d49[_0x3db0('0x36')],_0x1a1d49[_0x3db0('0x33')]);_0x354ff0[_0x3db0('0x37')]=_[_0x3db0('0x35')](_0x1a1d49[_0x3db0('0x36')],qs[_0x3db0('0x43')](_0x50b966['query'][_0x3db0('0x43')]));_0x354ff0[_0x3db0('0x37')]=_0x354ff0[_0x3db0('0x37')][_0x3db0('0x38')]?_0x354ff0[_0x3db0('0x37')]:_0x1a1d49[_0x3db0('0x36')];if(_0x50b966[_0x3db0('0x33')]['includeAll']){_0x354ff0[_0x3db0('0x40')]=[{'all':!![]}];}_0x354ff0=_[_0x3db0('0x3c')]({},_0x354ff0,_0x50b966['options']);return db[_0x3db0('0x2d')]['find'](_0x354ff0)['then'](handleEntityNotFound(_0x2a8b35,null))['then'](respondWithResult(_0x2a8b35,null))['catch'](handleError(_0x2a8b35,null));};exports['create']=function(_0x5552c0,_0x513fbf){return db[_0x3db0('0x2d')][_0x3db0('0x44')](_0x5552c0[_0x3db0('0x45')],{})[_0x3db0('0x25')](function(_0x5fe61d){var _0xe20ed1=_0x5552c0[_0x3db0('0x46')]['get']({'plain':!![]});if(!_0xe20ed1)throw new Error(_0x3db0('0x47'));if(_0xe20ed1[_0x3db0('0x48')]===_0x3db0('0x46')){var _0x52f264=_0x5fe61d[_0x3db0('0x27')]({'plain':!![]});var _0x4705e2=_0x3db0('0x28');return db[_0x3db0('0x49')][_0x3db0('0x4a')]({'where':{'name':_0x4705e2,'userProfileId':_0xe20ed1['userProfileId']},'raw':!![]})[_0x3db0('0x25')](function(_0x35d4ee){if(_0x35d4ee&&_0x35d4ee['autoAssociation']===0x0){return db[_0x3db0('0x29')][_0x3db0('0x44')]({'name':_0x52f264['name'],'resourceId':_0x52f264['id'],'type':_0x35d4ee['name'],'sectionId':_0x35d4ee['id']},{})['then'](function(){return _0x5fe61d;});}else{return _0x5fe61d;}})[_0x3db0('0x42')](function(_0x262d5b){logger[_0x3db0('0x4b')](_0x3db0('0x4c'),_0x262d5b);throw _0x262d5b;});}return _0x5fe61d;})[_0x3db0('0x25')](respondWithResult(_0x513fbf,0xc9))[_0x3db0('0x42')](handleError(_0x513fbf,null));};exports[_0x3db0('0x24')]=function(_0x59cfb5,_0x539307){if(_0x59cfb5['body']['id']){delete _0x59cfb5[_0x3db0('0x45')]['id'];}return db['AnalyticMetric'][_0x3db0('0x4a')]({'where':{'id':_0x59cfb5[_0x3db0('0x4d')]['id']}})[_0x3db0('0x25')](handleEntityNotFound(_0x539307,null))[_0x3db0('0x25')](saveUpdates(_0x59cfb5[_0x3db0('0x45')],null))[_0x3db0('0x25')](respondWithResult(_0x539307,null))[_0x3db0('0x42')](handleError(_0x539307,null));};exports[_0x3db0('0x26')]=function(_0x1af320,_0x1cf9b8){return db['AnalyticMetric'][_0x3db0('0x4a')]({'where':{'id':_0x1af320[_0x3db0('0x4d')]['id']}})[_0x3db0('0x25')](handleEntityNotFound(_0x1cf9b8,null))[_0x3db0('0x25')](removeEntity(_0x1cf9b8,null))[_0x3db0('0x42')](handleError(_0x1cf9b8,null));}; \ No newline at end of file +var _0xb731=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Metrics','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','options','AnalyticMetric','include','rows','catch','show','merge','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x479143,_0x4e798d){var _0x3a47f5=function(_0x27c154){while(--_0x27c154){_0x479143['push'](_0x479143['shift']());}};_0x3a47f5(++_0x4e798d);}(_0xb731,0xea));var _0x1b73=function(_0x250bbc,_0x3297f3){_0x250bbc=_0x250bbc-0x0;var _0x489e34=_0xb731[_0x250bbc];return _0x489e34;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1b73('0x0'));var rimraf=require(_0x1b73('0x1'));var zipdir=require(_0x1b73('0x2'));var jsonpatch=require(_0x1b73('0x3'));var rp=require(_0x1b73('0x4'));var moment=require(_0x1b73('0x5'));var BPromise=require(_0x1b73('0x6'));var Mustache=require(_0x1b73('0x7'));var util=require('util');var path=require(_0x1b73('0x8'));var sox=require('sox');var csv=require(_0x1b73('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1b73('0xa'));var squel=require(_0x1b73('0xb'));var crypto=require(_0x1b73('0xc'));var jsforce=require(_0x1b73('0xd'));var deskjs=require(_0x1b73('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1b73('0xf'));var Papa=require(_0x1b73('0x10'));var Redis=require(_0x1b73('0x11'));var authService=require(_0x1b73('0x12'));var qs=require(_0x1b73('0x13'));var as=require(_0x1b73('0x14'));var hardwareService=require(_0x1b73('0x15'));var logger=require(_0x1b73('0x16'))(_0x1b73('0x17'));var utils=require(_0x1b73('0x18'));var config=require(_0x1b73('0x19'));var db=require(_0x1b73('0x1a'))['db'];function respondWithStatusCode(_0x2d9d96,_0x512a37){_0x512a37=_0x512a37||0xcc;return function(_0x66aec){if(_0x66aec){return _0x2d9d96[_0x1b73('0x1b')](_0x512a37);}return _0x2d9d96[_0x1b73('0x1c')](_0x512a37)[_0x1b73('0x1d')]();};}function respondWithResult(_0x55d4b7,_0x5ea054){_0x5ea054=_0x5ea054||0xc8;return function(_0x28adc6){if(_0x28adc6){return _0x55d4b7[_0x1b73('0x1c')](_0x5ea054)['json'](_0x28adc6);}};}function respondWithFilteredResult(_0x43a2ed,_0x2cab7c){return function(_0x475187){if(_0x475187){var _0x5fa490=_0x475187[_0x1b73('0x1e')],_0x21f6fa=_0x2cab7c[_0x1b73('0x1f')],_0x474a57=_0x2cab7c['offset']+_0x2cab7c[_0x1b73('0x20')],_0x596f9e;if(_0x474a57>=_0x5fa490){_0x474a57=_0x5fa490;_0x596f9e=0xc8;}else{_0x596f9e=0xce;}_0x43a2ed[_0x1b73('0x1c')](_0x596f9e);return _0x43a2ed[_0x1b73('0x21')](_0x1b73('0x22'),_0x21f6fa+'-'+_0x474a57+'/'+_0x5fa490)[_0x1b73('0x23')](_0x475187);}return null;};}function patchUpdates(_0x3f52f0){return function(_0x455b00){try{jsonpatch[_0x1b73('0x24')](_0x455b00,_0x3f52f0,!![]);}catch(_0x5988cb){return BPromise[_0x1b73('0x25')](_0x5988cb);}return _0x455b00[_0x1b73('0x26')]();};}function saveUpdates(_0x3e6f09,_0x423b80){return function(_0x50e655){if(_0x50e655){return _0x50e655[_0x1b73('0x27')](_0x3e6f09)[_0x1b73('0x28')](function(_0x2599f8){return _0x2599f8;});}return null;};}function removeEntity(_0x1a8d82,_0x540138){return function(_0x18a1f1){if(_0x18a1f1){return _0x18a1f1[_0x1b73('0x29')]()['then'](function(){var _0x4a72da=_0x18a1f1[_0x1b73('0x2a')]({'plain':!![]});var _0xea2b96=_0x1b73('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0xea2b96,'resourceId':_0x4a72da['id']}})[_0x1b73('0x28')](function(){return _0x18a1f1;});})[_0x1b73('0x28')](function(){_0x1a8d82[_0x1b73('0x1c')](0xcc)[_0x1b73('0x1d')]();});}};}function handleEntityNotFound(_0x1602fb,_0x504b65){return function(_0x17fc48){if(!_0x17fc48){_0x1602fb[_0x1b73('0x1b')](0x194);}return _0x17fc48;};}function handleError(_0x43a10c,_0x1f7ae8){_0x1f7ae8=_0x1f7ae8||0x1f4;return function(_0x94538a){logger[_0x1b73('0x2c')](_0x94538a['stack']);if(_0x94538a[_0x1b73('0x2d')]){delete _0x94538a[_0x1b73('0x2d')];}_0x43a10c[_0x1b73('0x1c')](_0x1f7ae8)[_0x1b73('0x2e')](_0x94538a);};}exports[_0x1b73('0x2f')]=function(_0x1000b8,_0x1fadcc){var _0x3ea5c2={},_0x170fd1={},_0x9c2c4f={'count':0x0,'rows':[]};var _0xb458=_[_0x1b73('0x30')](db['AnalyticMetric'][_0x1b73('0x31')],function(_0x1288f6){return{'name':_0x1288f6[_0x1b73('0x32')],'type':_0x1288f6[_0x1b73('0x33')][_0x1b73('0x34')]};});_0x170fd1[_0x1b73('0x35')]=_['map'](_0xb458,_0x1b73('0x2d'));_0x170fd1[_0x1b73('0x36')]=_[_0x1b73('0x37')](_0x1000b8[_0x1b73('0x36')]);_0x170fd1[_0x1b73('0x38')]=_[_0x1b73('0x39')](_0x170fd1[_0x1b73('0x35')],_0x170fd1[_0x1b73('0x36')]);_0x3ea5c2[_0x1b73('0x3a')]=_[_0x1b73('0x39')](_0x170fd1[_0x1b73('0x35')],qs[_0x1b73('0x3b')](_0x1000b8['query'][_0x1b73('0x3b')]));_0x3ea5c2[_0x1b73('0x3a')]=_0x3ea5c2[_0x1b73('0x3a')][_0x1b73('0x3c')]?_0x3ea5c2[_0x1b73('0x3a')]:_0x170fd1['model'];if(!_0x1000b8['query']['hasOwnProperty'](_0x1b73('0x3d'))){_0x3ea5c2['limit']=qs['limit'](_0x1000b8[_0x1b73('0x36')][_0x1b73('0x20')]);_0x3ea5c2[_0x1b73('0x1f')]=qs[_0x1b73('0x1f')](_0x1000b8['query']['offset']);}_0x3ea5c2[_0x1b73('0x3e')]=qs[_0x1b73('0x3f')](_0x1000b8[_0x1b73('0x36')][_0x1b73('0x3f')]);_0x3ea5c2['where']=qs[_0x1b73('0x38')](_[_0x1b73('0x40')](_0x1000b8[_0x1b73('0x36')],_0x170fd1[_0x1b73('0x38')]));if(_0x1000b8[_0x1b73('0x36')]['filter']){_0x3ea5c2['where']=_['merge'](_0x3ea5c2[_0x1b73('0x41')],{'$or':_[_0x1b73('0x30')](_0xb458,function(_0x44ae1f){if(_0x44ae1f['type']!=='VIRTUAL'){var _0x48fa62={};_0x48fa62[_0x44ae1f[_0x1b73('0x2d')]]={'$like':'%'+_0x1000b8['query']['filter']+'%'};return _0x48fa62;}})});}_0x3ea5c2=_['merge']({},_0x3ea5c2,_0x1000b8[_0x1b73('0x42')]);var _0x4ef64e={'where':_0x3ea5c2[_0x1b73('0x41')]};return db[_0x1b73('0x43')]['count'](_0x4ef64e)[_0x1b73('0x28')](function(_0x341124){_0x9c2c4f[_0x1b73('0x1e')]=_0x341124;if(_0x1000b8[_0x1b73('0x36')]['includeAll']){_0x3ea5c2[_0x1b73('0x44')]=[{'all':!![]}];}return db[_0x1b73('0x43')]['findAll'](_0x3ea5c2);})[_0x1b73('0x28')](function(_0x5b54d0){_0x9c2c4f[_0x1b73('0x45')]=_0x5b54d0;return _0x9c2c4f;})[_0x1b73('0x28')](respondWithFilteredResult(_0x1fadcc,_0x3ea5c2))[_0x1b73('0x46')](handleError(_0x1fadcc,null));};exports[_0x1b73('0x47')]=function(_0x42a707,_0x4a68bd){var _0x4b4b22={'raw':!![],'where':{'id':_0x42a707['params']['id']}},_0x4f258f={};_0x4f258f[_0x1b73('0x35')]=_['keys'](db[_0x1b73('0x43')]['rawAttributes']);_0x4f258f['query']=_['keys'](_0x42a707[_0x1b73('0x36')]);_0x4f258f[_0x1b73('0x38')]=_[_0x1b73('0x39')](_0x4f258f[_0x1b73('0x35')],_0x4f258f[_0x1b73('0x36')]);_0x4b4b22[_0x1b73('0x3a')]=_[_0x1b73('0x39')](_0x4f258f[_0x1b73('0x35')],qs[_0x1b73('0x3b')](_0x42a707[_0x1b73('0x36')][_0x1b73('0x3b')]));_0x4b4b22[_0x1b73('0x3a')]=_0x4b4b22[_0x1b73('0x3a')][_0x1b73('0x3c')]?_0x4b4b22['attributes']:_0x4f258f['model'];if(_0x42a707[_0x1b73('0x36')]['includeAll']){_0x4b4b22[_0x1b73('0x44')]=[{'all':!![]}];}_0x4b4b22=_[_0x1b73('0x48')]({},_0x4b4b22,_0x42a707[_0x1b73('0x42')]);return db[_0x1b73('0x43')][_0x1b73('0x49')](_0x4b4b22)[_0x1b73('0x28')](handleEntityNotFound(_0x4a68bd,null))[_0x1b73('0x28')](respondWithResult(_0x4a68bd,null))[_0x1b73('0x46')](handleError(_0x4a68bd,null));};exports['create']=function(_0x25eeb8,_0x2135b2){return db['AnalyticMetric']['create'](_0x25eeb8['body'],{})[_0x1b73('0x28')](function(_0x95eb12){var _0x19cde8=_0x25eeb8[_0x1b73('0x4a')][_0x1b73('0x2a')]({'plain':!![]});if(!_0x19cde8)throw new Error(_0x1b73('0x4b'));if(_0x19cde8[_0x1b73('0x4c')]==='user'){var _0x12fd69=_0x95eb12[_0x1b73('0x2a')]({'plain':!![]});var _0x1b1c18=_0x1b73('0x2b');return db[_0x1b73('0x4d')][_0x1b73('0x49')]({'where':{'name':_0x1b1c18,'userProfileId':_0x19cde8[_0x1b73('0x4e')]},'raw':!![]})[_0x1b73('0x28')](function(_0x1e1333){if(_0x1e1333&&_0x1e1333[_0x1b73('0x4f')]===0x0){return db[_0x1b73('0x50')][_0x1b73('0x51')]({'name':_0x12fd69[_0x1b73('0x2d')],'resourceId':_0x12fd69['id'],'type':_0x1e1333[_0x1b73('0x2d')],'sectionId':_0x1e1333['id']},{})[_0x1b73('0x28')](function(){return _0x95eb12;});}else{return _0x95eb12;}})['catch'](function(_0x10baec){logger[_0x1b73('0x2c')](_0x1b73('0x52'),_0x10baec);throw _0x10baec;});}return _0x95eb12;})[_0x1b73('0x28')](respondWithResult(_0x2135b2,0xc9))[_0x1b73('0x46')](handleError(_0x2135b2,null));};exports[_0x1b73('0x27')]=function(_0x3e67a9,_0x4aba16){if(_0x3e67a9[_0x1b73('0x53')]['id']){delete _0x3e67a9[_0x1b73('0x53')]['id'];}return db[_0x1b73('0x43')][_0x1b73('0x49')]({'where':{'id':_0x3e67a9[_0x1b73('0x54')]['id']}})['then'](handleEntityNotFound(_0x4aba16,null))[_0x1b73('0x28')](saveUpdates(_0x3e67a9[_0x1b73('0x53')],null))[_0x1b73('0x28')](respondWithResult(_0x4aba16,null))[_0x1b73('0x46')](handleError(_0x4aba16,null));};exports['destroy']=function(_0x4c686b,_0x421e8){return db[_0x1b73('0x43')][_0x1b73('0x49')]({'where':{'id':_0x4c686b[_0x1b73('0x54')]['id']}})[_0x1b73('0x28')](handleEntityNotFound(_0x421e8,null))[_0x1b73('0x28')](removeEntity(_0x421e8,null))['catch'](handleError(_0x421e8,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 89c3d9a..360a1bb 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 _0x6f4a=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger'];(function(_0x573c9e,_0xd4ab71){var _0x5d0714=function(_0x127a2a){while(--_0x127a2a){_0x573c9e['push'](_0x573c9e['shift']());}};_0x5d0714(++_0xd4ab71);}(_0x6f4a,0x72));var _0xa6f4=function(_0x18277c,_0x40b24e){_0x18277c=_0x18277c-0x0;var _0x2a1744=_0x6f4a[_0x18277c];return _0x2a1744;};'use strict';var _=require(_0xa6f4('0x0'));var util=require(_0xa6f4('0x1'));var logger=require(_0xa6f4('0x2'))(_0xa6f4('0x3'));var moment=require('moment');var BPromise=require(_0xa6f4('0x4'));var rp=require(_0xa6f4('0x5'));var fs=require('fs');var path=require(_0xa6f4('0x6'));var rimraf=require(_0xa6f4('0x7'));var config=require(_0xa6f4('0x8'));var attributes=require('./analyticMetric.attributes');module[_0xa6f4('0x9')]=function(_0x573e60,_0x14715e){return _0x573e60[_0xa6f4('0xa')](_0xa6f4('0xb'),attributes,{'tableName':_0xa6f4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98e4=['../../config/logger','api','request-promise','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util'];(function(_0x29f505,_0xcb61f7){var _0xc28f12=function(_0xfe8878){while(--_0xfe8878){_0x29f505['push'](_0x29f505['shift']());}};_0xc28f12(++_0xcb61f7);}(_0x98e4,0xee));var _0x498e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x98e4[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x498e('0x0'));var util=require(_0x498e('0x1'));var logger=require(_0x498e('0x2'))(_0x498e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x498e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x498e('0x5'));var config=require(_0x498e('0x6'));var attributes=require(_0x498e('0x7'));module[_0x498e('0x8')]=function(_0x4ec1aa,_0x27c2f1){return _0x4ec1aa[_0x498e('0x9')](_0x498e('0xa'),attributes,{'tableName':_0x498e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 0427d18..1154c55 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 _0x5d00=['then','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticMetric,\x20%s,\x20%s','message','info','catch','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','request'];(function(_0x28c0df,_0x4ff141){var _0x210835=function(_0x3f985c){while(--_0x3f985c){_0x28c0df['push'](_0x28c0df['shift']());}};_0x210835(++_0x4ff141);}(_0x5d00,0xa2));var _0x05d0=function(_0x412342,_0x180734){_0x412342=_0x412342-0x0;var _0x3e62cb=_0x5d00[_0x412342];return _0x3e62cb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x05d0('0x0'));var BPromise=require(_0x05d0('0x1'));var rs=require(_0x05d0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05d0('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x05d0('0x4'));var config=require(_0x05d0('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x05d0('0x6')][_0x05d0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x396116,_0x3db0a8,_0x1cd536){return new BPromise(function(_0x5d5487,_0x147dca){return client[_0x05d0('0x8')](_0x396116,_0x1cd536)[_0x05d0('0x9')](function(_0x130ae9){logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x3db0a8,_0x05d0('0xa'));logger[_0x05d0('0xb')](_0x05d0('0xc'),_0x3db0a8,_0x05d0('0xa'),JSON[_0x05d0('0xd')](_0x130ae9));if(_0x130ae9[_0x05d0('0xe')]){if(_0x130ae9['error']['code']===0x1f4){logger[_0x05d0('0xe')](_0x05d0('0xf'),_0x3db0a8,_0x130ae9[_0x05d0('0xe')][_0x05d0('0x10')]);return _0x147dca(_0x130ae9[_0x05d0('0xe')]['message']);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x3db0a8,_0x130ae9[_0x05d0('0xe')][_0x05d0('0x10')]);return _0x5d5487(_0x130ae9['error']['message']);}else{logger[_0x05d0('0x11')](_0x05d0('0xf'),_0x3db0a8,_0x05d0('0xa'));_0x5d5487(_0x130ae9['result']['message']);}})[_0x05d0('0x12')](function(_0xa0af69){logger[_0x05d0('0xe')](_0x05d0('0xf'),_0x3db0a8,_0xa0af69);_0x147dca(_0xa0af69);});});} \ No newline at end of file +var _0xac91=['AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14dfe0,_0x2e6727){var _0x8fe235=function(_0x353d96){while(--_0x353d96){_0x14dfe0['push'](_0x14dfe0['shift']());}};_0x8fe235(++_0x2e6727);}(_0xac91,0x104));var _0x1ac9=function(_0x48e86c,_0x9f034d){_0x48e86c=_0x48e86c-0x0;var _0x54fa11=_0xac91[_0x48e86c];return _0x54fa11;};'use strict';var _=require(_0x1ac9('0x0'));var util=require(_0x1ac9('0x1'));var moment=require(_0x1ac9('0x2'));var BPromise=require(_0x1ac9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1ac9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ac9('0x5'))(_0x1ac9('0x6'));var config=require(_0x1ac9('0x7'));var jayson=require(_0x1ac9('0x8'));var client=jayson[_0x1ac9('0x9')][_0x1ac9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13d2b0,_0x37941b,_0x3d38d5){return new BPromise(function(_0x20e4af,_0x5ba6e1){return client[_0x1ac9('0xb')](_0x13d2b0,_0x3d38d5)[_0x1ac9('0xc')](function(_0x1916ec){logger['info'](_0x1ac9('0xd'),_0x37941b,_0x1ac9('0xe'));logger[_0x1ac9('0xf')](_0x1ac9('0x10'),_0x37941b,_0x1ac9('0xe'),JSON[_0x1ac9('0x11')](_0x1916ec));if(_0x1916ec['error']){if(_0x1916ec[_0x1ac9('0x12')][_0x1ac9('0x13')]===0x1f4){logger['error'](_0x1ac9('0xd'),_0x37941b,_0x1916ec[_0x1ac9('0x12')][_0x1ac9('0x14')]);return _0x5ba6e1(_0x1916ec['error']['message']);}logger[_0x1ac9('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x37941b,_0x1916ec[_0x1ac9('0x12')]['message']);return _0x20e4af(_0x1916ec['error'][_0x1ac9('0x14')]);}else{logger[_0x1ac9('0x15')](_0x1ac9('0xd'),_0x37941b,_0x1ac9('0xe'));_0x20e4af(_0x1916ec[_0x1ac9('0x16')][_0x1ac9('0x14')]);}})['catch'](function(_0x556cdd){logger['error'](_0x1ac9('0xd'),_0x37941b,_0x556cdd);_0x5ba6e1(_0x556cdd);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index f7081b2..5e412f3 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 _0x2ef3=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x2f9a4a,_0x93573e){var _0x1529f7=function(_0x206bfe){while(--_0x206bfe){_0x2f9a4a['push'](_0x2f9a4a['shift']());}};_0x1529f7(++_0x93573e);}(_0x2ef3,0xba));var _0x32ef=function(_0x599525,_0x53f3ca){_0x599525=_0x599525-0x0;var _0x5972fd=_0x2ef3[_0x599525];return _0x5972fd;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var controller=require('./analyticMetric.controller');router[_0x32ef('0x8')]('/',auth[_0x32ef('0x9')](),controller['index']);router['get'](_0x32ef('0xa'),auth[_0x32ef('0x9')](),controller[_0x32ef('0xb')]);router[_0x32ef('0xc')]('/',auth[_0x32ef('0x9')](),controller[_0x32ef('0xd')]);router[_0x32ef('0xe')](_0x32ef('0xa'),auth[_0x32ef('0x9')](),controller[_0x32ef('0xf')]);router['delete']('/:id',auth[_0x32ef('0x9')](),controller[_0x32ef('0x10')]);module[_0x32ef('0x11')]=router; \ No newline at end of file +var _0x687b=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id'];(function(_0x15bbf1,_0x40ef96){var _0x5c4b47=function(_0x303b4f){while(--_0x303b4f){_0x15bbf1['push'](_0x15bbf1['shift']());}};_0x5c4b47(++_0x40ef96);}(_0x687b,0x14a));var _0xb687=function(_0x53bde7,_0xe2ca44){_0x53bde7=_0x53bde7-0x0;var _0x52d7f1=_0x687b[_0x53bde7];return _0x52d7f1;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb687('0x4'));var interaction=require(_0xb687('0x5'));var config=require(_0xb687('0x6'));var controller=require(_0xb687('0x7'));router[_0xb687('0x8')]('/',auth[_0xb687('0x9')](),controller[_0xb687('0xa')]);router[_0xb687('0x8')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller['show']);router[_0xb687('0xc')]('/',auth[_0xb687('0x9')](),controller['create']);router[_0xb687('0xd')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0xe')]);router[_0xb687('0xf')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0x10')]);module[_0xb687('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 6a48735..27d035f 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 _0x1100=['sequelize','exports','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1100,0x75));var _0x0110=function(_0x174f46,_0x32a941){_0x174f46=_0x174f46-0x0;var _0x223953=_0x1100[_0x174f46];return _0x223953;};'use strict';var Sequelize=require(_0x0110('0x0'));module[_0x0110('0x1')]={'tree':{'type':Sequelize[_0x0110('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x4787=['exports','TEXT','sequelize'];(function(_0x105697,_0x4c16c1){var _0x32bf68=function(_0x2aecf4){while(--_0x2aecf4){_0x105697['push'](_0x105697['shift']());}};_0x32bf68(++_0x4c16c1);}(_0x4787,0x1c7));var _0x7478=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x4787[_0x59c301];return _0x3866b9;};'use strict';var Sequelize=require(_0x7478('0x0'));module[_0x7478('0x1')]={'tree':{'type':Sequelize[_0x7478('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 79d5566..69334fc 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 _0xe5b5=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','limit','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','include','rows','catch','show','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x30173c,_0x599eb2){var _0x210c49=function(_0x3f0159){while(--_0x3f0159){_0x30173c['push'](_0x30173c['shift']());}};_0x210c49(++_0x599eb2);}(_0xe5b5,0x12b));var _0x5e5b=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0xe5b5[_0xf0bc07];return _0x1c50c2;};'use strict';var pdf=require(_0x5e5b('0x0'));var emlformat=require(_0x5e5b('0x1'));var rimraf=require(_0x5e5b('0x2'));var zipdir=require(_0x5e5b('0x3'));var jsonpatch=require(_0x5e5b('0x4'));var rp=require(_0x5e5b('0x5'));var moment=require(_0x5e5b('0x6'));var BPromise=require(_0x5e5b('0x7'));var Mustache=require(_0x5e5b('0x8'));var util=require(_0x5e5b('0x9'));var path=require(_0x5e5b('0xa'));var sox=require(_0x5e5b('0xb'));var csv=require(_0x5e5b('0xc'));var ejs=require(_0x5e5b('0xd'));var fs=require('fs');var _=require(_0x5e5b('0xe'));var squel=require(_0x5e5b('0xf'));var crypto=require(_0x5e5b('0x10'));var jsforce=require(_0x5e5b('0x11'));var deskjs=require(_0x5e5b('0x12'));var toCsv=require(_0x5e5b('0xc'));var querystring=require(_0x5e5b('0x13'));var Papa=require(_0x5e5b('0x14'));var Redis=require(_0x5e5b('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x5e5b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e5b('0x17'));var logger=require(_0x5e5b('0x18'))(_0x5e5b('0x19'));var utils=require(_0x5e5b('0x1a'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ebf65,_0x310f71){_0x310f71=_0x310f71||0xcc;return function(_0x18434e){if(_0x18434e){return _0x5ebf65[_0x5e5b('0x1b')](_0x310f71);}return _0x5ebf65[_0x5e5b('0x1c')](_0x310f71)[_0x5e5b('0x1d')]();};}function respondWithResult(_0x1e3483,_0x2e331d){_0x2e331d=_0x2e331d||0xc8;return function(_0x49edd0){if(_0x49edd0){return _0x1e3483[_0x5e5b('0x1c')](_0x2e331d)[_0x5e5b('0x1e')](_0x49edd0);}};}function respondWithFilteredResult(_0x4ff37b,_0x227417){return function(_0x578c14){if(_0x578c14){var _0x4e9509=_0x578c14['count'],_0x13a1cb=_0x227417[_0x5e5b('0x1f')],_0x444435=_0x227417['offset']+_0x227417[_0x5e5b('0x20')],_0xaf9ace;if(_0x444435>=_0x4e9509){_0x444435=_0x4e9509;_0xaf9ace=0xc8;}else{_0xaf9ace=0xce;}_0x4ff37b[_0x5e5b('0x1c')](_0xaf9ace);return _0x4ff37b['set'](_0x5e5b('0x21'),_0x13a1cb+'-'+_0x444435+'/'+_0x4e9509)[_0x5e5b('0x1e')](_0x578c14);}return null;};}function patchUpdates(_0x2281c8){return function(_0x538074){try{jsonpatch[_0x5e5b('0x22')](_0x538074,_0x2281c8,!![]);}catch(_0x3f1103){return BPromise['reject'](_0x3f1103);}return _0x538074[_0x5e5b('0x23')]();};}function saveUpdates(_0x1aa0c2,_0x3c488e){return function(_0x2d8252){if(_0x2d8252){return _0x2d8252[_0x5e5b('0x24')](_0x1aa0c2)[_0x5e5b('0x25')](function(_0x93df5c){return _0x93df5c;});}return null;};}function removeEntity(_0x37552c,_0x4a78e3){return function(_0x512e46){if(_0x512e46){return _0x512e46[_0x5e5b('0x26')]()[_0x5e5b('0x25')](function(){_0x37552c[_0x5e5b('0x1c')](0xcc)[_0x5e5b('0x1d')]();});}};}function handleEntityNotFound(_0x2e38ed,_0x28cd95){return function(_0x135c6c){if(!_0x135c6c){_0x2e38ed[_0x5e5b('0x1b')](0x194);}return _0x135c6c;};}function handleError(_0x161599,_0x26bc02){_0x26bc02=_0x26bc02||0x1f4;return function(_0x1788fd){logger['error'](_0x1788fd[_0x5e5b('0x27')]);if(_0x1788fd[_0x5e5b('0x28')]){delete _0x1788fd[_0x5e5b('0x28')];}_0x161599['status'](_0x26bc02)[_0x5e5b('0x29')](_0x1788fd);};}exports[_0x5e5b('0x2a')]=function(_0x5ee866,_0x13ff91){var _0x21c74b={},_0x39ce16={},_0x36b595={'count':0x0,'rows':[]};var _0x31af09=_[_0x5e5b('0x2b')](db[_0x5e5b('0x2c')][_0x5e5b('0x2d')],function(_0x3f6b25){return{'name':_0x3f6b25[_0x5e5b('0x2e')],'type':_0x3f6b25[_0x5e5b('0x2f')][_0x5e5b('0x30')]};});_0x39ce16['model']=_['map'](_0x31af09,_0x5e5b('0x28'));_0x39ce16[_0x5e5b('0x31')]=_[_0x5e5b('0x32')](_0x5ee866[_0x5e5b('0x31')]);_0x39ce16[_0x5e5b('0x33')]=_['intersection'](_0x39ce16[_0x5e5b('0x34')],_0x39ce16['query']);_0x21c74b[_0x5e5b('0x35')]=_[_0x5e5b('0x36')](_0x39ce16[_0x5e5b('0x34')],qs[_0x5e5b('0x37')](_0x5ee866['query'][_0x5e5b('0x37')]));_0x21c74b[_0x5e5b('0x35')]=_0x21c74b['attributes'][_0x5e5b('0x38')]?_0x21c74b[_0x5e5b('0x35')]:_0x39ce16[_0x5e5b('0x34')];if(!_0x5ee866[_0x5e5b('0x31')][_0x5e5b('0x39')](_0x5e5b('0x3a'))){_0x21c74b[_0x5e5b('0x20')]=qs[_0x5e5b('0x20')](_0x5ee866['query'][_0x5e5b('0x20')]);_0x21c74b[_0x5e5b('0x1f')]=qs[_0x5e5b('0x1f')](_0x5ee866[_0x5e5b('0x31')][_0x5e5b('0x1f')]);}_0x21c74b[_0x5e5b('0x3b')]=qs['sort'](_0x5ee866['query'][_0x5e5b('0x3c')]);_0x21c74b[_0x5e5b('0x3d')]=qs[_0x5e5b('0x33')](_['pick'](_0x5ee866[_0x5e5b('0x31')],_0x39ce16[_0x5e5b('0x33')]));if(_0x5ee866[_0x5e5b('0x31')][_0x5e5b('0x3e')]){_0x21c74b['where']=_[_0x5e5b('0x3f')](_0x21c74b[_0x5e5b('0x3d')],{'$or':_['map'](_0x31af09,function(_0x5ad9a6){if(_0x5ad9a6[_0x5e5b('0x2f')]!==_0x5e5b('0x40')){var _0xee3e6f={};_0xee3e6f[_0x5ad9a6['name']]={'$like':'%'+_0x5ee866[_0x5e5b('0x31')]['filter']+'%'};return _0xee3e6f;}})});}_0x21c74b=_['merge']({},_0x21c74b,_0x5ee866[_0x5e5b('0x41')]);var _0x2bcfaa={'where':_0x21c74b[_0x5e5b('0x3d')]};return db[_0x5e5b('0x2c')][_0x5e5b('0x42')](_0x2bcfaa)[_0x5e5b('0x25')](function(_0x2c1eb1){_0x36b595[_0x5e5b('0x42')]=_0x2c1eb1;if(_0x5ee866[_0x5e5b('0x31')]['includeAll']){_0x21c74b[_0x5e5b('0x43')]=[{'all':!![]}];}return db[_0x5e5b('0x2c')]['findAll'](_0x21c74b);})[_0x5e5b('0x25')](function(_0x4b54b0){_0x36b595[_0x5e5b('0x44')]=_0x4b54b0;return _0x36b595;})[_0x5e5b('0x25')](respondWithFilteredResult(_0x13ff91,_0x21c74b))[_0x5e5b('0x45')](handleError(_0x13ff91,null));};exports[_0x5e5b('0x46')]=function(_0x1659d5,_0xbe8b1d){var _0x371550={'raw':!![],'where':{'id':_0x1659d5[_0x5e5b('0x47')]['id']}},_0x24d81f={};_0x24d81f[_0x5e5b('0x34')]=_[_0x5e5b('0x32')](db['AnalyticTreeReport'][_0x5e5b('0x2d')]);_0x24d81f[_0x5e5b('0x31')]=_[_0x5e5b('0x32')](_0x1659d5['query']);_0x24d81f[_0x5e5b('0x33')]=_[_0x5e5b('0x36')](_0x24d81f['model'],_0x24d81f[_0x5e5b('0x31')]);_0x371550[_0x5e5b('0x35')]=_['intersection'](_0x24d81f[_0x5e5b('0x34')],qs['fields'](_0x1659d5['query']['fields']));_0x371550[_0x5e5b('0x35')]=_0x371550['attributes'][_0x5e5b('0x38')]?_0x371550['attributes']:_0x24d81f[_0x5e5b('0x34')];if(_0x1659d5[_0x5e5b('0x31')][_0x5e5b('0x48')]){_0x371550[_0x5e5b('0x43')]=[{'all':!![]}];}_0x371550=_[_0x5e5b('0x3f')]({},_0x371550,_0x1659d5[_0x5e5b('0x41')]);return db[_0x5e5b('0x2c')]['find'](_0x371550)['then'](handleEntityNotFound(_0xbe8b1d,null))[_0x5e5b('0x25')](respondWithResult(_0xbe8b1d,null))['catch'](handleError(_0xbe8b1d,null));};exports['create']=function(_0x4e83eb,_0x249922){return db['AnalyticTreeReport'][_0x5e5b('0x49')](_0x4e83eb[_0x5e5b('0x4a')],{})[_0x5e5b('0x25')](respondWithResult(_0x249922,0xc9))[_0x5e5b('0x45')](handleError(_0x249922,null));};exports[_0x5e5b('0x24')]=function(_0x192445,_0x4fd265){if(_0x192445[_0x5e5b('0x4a')]['id']){delete _0x192445[_0x5e5b('0x4a')]['id'];}return db['AnalyticTreeReport'][_0x5e5b('0x4b')]({'where':{'id':_0x192445['params']['id']}})[_0x5e5b('0x25')](handleEntityNotFound(_0x4fd265,null))[_0x5e5b('0x25')](saveUpdates(_0x192445[_0x5e5b('0x4a')],null))[_0x5e5b('0x25')](respondWithResult(_0x4fd265,null))['catch'](handleError(_0x4fd265,null));};exports[_0x5e5b('0x26')]=function(_0x1c4efe,_0x4f4ea3){return db[_0x5e5b('0x2c')][_0x5e5b('0x4b')]({'where':{'id':_0x1c4efe[_0x5e5b('0x47')]['id']}})[_0x5e5b('0x25')](handleEntityNotFound(_0x4f4ea3,null))[_0x5e5b('0x25')](removeEntity(_0x4f4ea3,null))[_0x5e5b('0x45')](handleError(_0x4f4ea3,null));}; \ No newline at end of file +var _0xda3f=['pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','keys','includeAll','find','create','body','params','eml-format','rimraf','moment','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2d0e53,_0x540dd4){var _0x18fdcb=function(_0x12113f){while(--_0x12113f){_0x2d0e53['push'](_0x2d0e53['shift']());}};_0x18fdcb(++_0x540dd4);}(_0xda3f,0xec));var _0xfda3=function(_0x53b217,_0x5cb12b){_0x53b217=_0x53b217-0x0;var _0x51f895=_0xda3f[_0x53b217];return _0x51f895;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfda3('0x0'));var rimraf=require(_0xfda3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfda3('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfda3('0x3'));var util=require(_0xfda3('0x4'));var path=require('path');var sox=require(_0xfda3('0x5'));var csv=require(_0xfda3('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x6'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var db=require(_0xfda3('0x15'))['db'];function respondWithStatusCode(_0x1443f4,_0x4b77ea){_0x4b77ea=_0x4b77ea||0xcc;return function(_0x583125){if(_0x583125){return _0x1443f4['sendStatus'](_0x4b77ea);}return _0x1443f4[_0xfda3('0x16')](_0x4b77ea)[_0xfda3('0x17')]();};}function respondWithResult(_0x4929fa,_0x501588){_0x501588=_0x501588||0xc8;return function(_0x587e9b){if(_0x587e9b){return _0x4929fa[_0xfda3('0x16')](_0x501588)[_0xfda3('0x18')](_0x587e9b);}};}function respondWithFilteredResult(_0x5ea793,_0x57a229){return function(_0x533365){if(_0x533365){var _0x80ea80=_0x533365[_0xfda3('0x19')],_0x474707=_0x57a229[_0xfda3('0x1a')],_0x249dc6=_0x57a229[_0xfda3('0x1a')]+_0x57a229[_0xfda3('0x1b')],_0x3d8bcd;if(_0x249dc6>=_0x80ea80){_0x249dc6=_0x80ea80;_0x3d8bcd=0xc8;}else{_0x3d8bcd=0xce;}_0x5ea793[_0xfda3('0x16')](_0x3d8bcd);return _0x5ea793[_0xfda3('0x1c')]('Content-Range',_0x474707+'-'+_0x249dc6+'/'+_0x80ea80)[_0xfda3('0x18')](_0x533365);}return null;};}function patchUpdates(_0x1bbdda){return function(_0x12d568){try{jsonpatch[_0xfda3('0x1d')](_0x12d568,_0x1bbdda,!![]);}catch(_0x59a887){return BPromise[_0xfda3('0x1e')](_0x59a887);}return _0x12d568[_0xfda3('0x1f')]();};}function saveUpdates(_0x2ee74c,_0x51e731){return function(_0x5ad52a){if(_0x5ad52a){return _0x5ad52a[_0xfda3('0x20')](_0x2ee74c)[_0xfda3('0x21')](function(_0x4ea9f5){return _0x4ea9f5;});}return null;};}function removeEntity(_0x545320,_0x3cf5a9){return function(_0xef2535){if(_0xef2535){return _0xef2535[_0xfda3('0x22')]()[_0xfda3('0x21')](function(){_0x545320[_0xfda3('0x16')](0xcc)[_0xfda3('0x17')]();});}};}function handleEntityNotFound(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(!_0x16eaa6){_0x2677f6['sendStatus'](0x194);}return _0x16eaa6;};}function handleError(_0x82341b,_0x2d5b44){_0x2d5b44=_0x2d5b44||0x1f4;return function(_0x2e8bf8){logger['error'](_0x2e8bf8[_0xfda3('0x23')]);if(_0x2e8bf8[_0xfda3('0x24')]){delete _0x2e8bf8[_0xfda3('0x24')];}_0x82341b[_0xfda3('0x16')](_0x2d5b44)[_0xfda3('0x25')](_0x2e8bf8);};}exports[_0xfda3('0x26')]=function(_0x514d2a,_0x3c6d7d){var _0x1e87fe={},_0x2bef2b={},_0x1f2884={'count':0x0,'rows':[]};var _0x33ffd4=_['map'](db[_0xfda3('0x27')][_0xfda3('0x28')],function(_0x301509){return{'name':_0x301509[_0xfda3('0x29')],'type':_0x301509[_0xfda3('0x2a')][_0xfda3('0x2b')]};});_0x2bef2b[_0xfda3('0x2c')]=_['map'](_0x33ffd4,'name');_0x2bef2b[_0xfda3('0x2d')]=_['keys'](_0x514d2a['query']);_0x2bef2b[_0xfda3('0x2e')]=_[_0xfda3('0x2f')](_0x2bef2b[_0xfda3('0x2c')],_0x2bef2b[_0xfda3('0x2d')]);_0x1e87fe[_0xfda3('0x30')]=_[_0xfda3('0x2f')](_0x2bef2b[_0xfda3('0x2c')],qs[_0xfda3('0x31')](_0x514d2a[_0xfda3('0x2d')]['fields']));_0x1e87fe[_0xfda3('0x30')]=_0x1e87fe[_0xfda3('0x30')][_0xfda3('0x32')]?_0x1e87fe[_0xfda3('0x30')]:_0x2bef2b[_0xfda3('0x2c')];if(!_0x514d2a[_0xfda3('0x2d')][_0xfda3('0x33')](_0xfda3('0x34'))){_0x1e87fe[_0xfda3('0x1b')]=qs['limit'](_0x514d2a['query'][_0xfda3('0x1b')]);_0x1e87fe[_0xfda3('0x1a')]=qs['offset'](_0x514d2a[_0xfda3('0x2d')][_0xfda3('0x1a')]);}_0x1e87fe[_0xfda3('0x35')]=qs['sort'](_0x514d2a[_0xfda3('0x2d')][_0xfda3('0x36')]);_0x1e87fe[_0xfda3('0x37')]=qs[_0xfda3('0x2e')](_[_0xfda3('0x38')](_0x514d2a['query'],_0x2bef2b[_0xfda3('0x2e')]));if(_0x514d2a[_0xfda3('0x2d')][_0xfda3('0x39')]){_0x1e87fe['where']=_[_0xfda3('0x3a')](_0x1e87fe['where'],{'$or':_[_0xfda3('0x3b')](_0x33ffd4,function(_0x5469df){if(_0x5469df[_0xfda3('0x2a')]!==_0xfda3('0x3c')){var _0x21c5cc={};_0x21c5cc[_0x5469df[_0xfda3('0x24')]]={'$like':'%'+_0x514d2a[_0xfda3('0x2d')][_0xfda3('0x39')]+'%'};return _0x21c5cc;}})});}_0x1e87fe=_['merge']({},_0x1e87fe,_0x514d2a[_0xfda3('0x3d')]);var _0xbfbc01={'where':_0x1e87fe[_0xfda3('0x37')]};return db[_0xfda3('0x27')]['count'](_0xbfbc01)[_0xfda3('0x21')](function(_0xf0a183){_0x1f2884[_0xfda3('0x19')]=_0xf0a183;if(_0x514d2a['query']['includeAll']){_0x1e87fe[_0xfda3('0x3e')]=[{'all':!![]}];}return db[_0xfda3('0x27')][_0xfda3('0x3f')](_0x1e87fe);})[_0xfda3('0x21')](function(_0x2b415d){_0x1f2884[_0xfda3('0x40')]=_0x2b415d;return _0x1f2884;})[_0xfda3('0x21')](respondWithFilteredResult(_0x3c6d7d,_0x1e87fe))[_0xfda3('0x41')](handleError(_0x3c6d7d,null));};exports[_0xfda3('0x42')]=function(_0x272d65,_0x4d3b1c){var _0x27200f={'raw':!![],'where':{'id':_0x272d65['params']['id']}},_0x22b848={};_0x22b848[_0xfda3('0x2c')]=_['keys'](db['AnalyticTreeReport']['rawAttributes']);_0x22b848[_0xfda3('0x2d')]=_[_0xfda3('0x43')](_0x272d65[_0xfda3('0x2d')]);_0x22b848[_0xfda3('0x2e')]=_['intersection'](_0x22b848[_0xfda3('0x2c')],_0x22b848[_0xfda3('0x2d')]);_0x27200f[_0xfda3('0x30')]=_[_0xfda3('0x2f')](_0x22b848['model'],qs[_0xfda3('0x31')](_0x272d65[_0xfda3('0x2d')][_0xfda3('0x31')]));_0x27200f['attributes']=_0x27200f['attributes'][_0xfda3('0x32')]?_0x27200f[_0xfda3('0x30')]:_0x22b848[_0xfda3('0x2c')];if(_0x272d65[_0xfda3('0x2d')][_0xfda3('0x44')]){_0x27200f[_0xfda3('0x3e')]=[{'all':!![]}];}_0x27200f=_[_0xfda3('0x3a')]({},_0x27200f,_0x272d65[_0xfda3('0x3d')]);return db[_0xfda3('0x27')][_0xfda3('0x45')](_0x27200f)[_0xfda3('0x21')](handleEntityNotFound(_0x4d3b1c,null))[_0xfda3('0x21')](respondWithResult(_0x4d3b1c,null))[_0xfda3('0x41')](handleError(_0x4d3b1c,null));};exports[_0xfda3('0x46')]=function(_0x57013b,_0x4a0cbd){return db[_0xfda3('0x27')][_0xfda3('0x46')](_0x57013b[_0xfda3('0x47')],{})[_0xfda3('0x21')](respondWithResult(_0x4a0cbd,0xc9))[_0xfda3('0x41')](handleError(_0x4a0cbd,null));};exports[_0xfda3('0x20')]=function(_0x192133,_0x125f5a){if(_0x192133[_0xfda3('0x47')]['id']){delete _0x192133[_0xfda3('0x47')]['id'];}return db['AnalyticTreeReport'][_0xfda3('0x45')]({'where':{'id':_0x192133[_0xfda3('0x48')]['id']}})[_0xfda3('0x21')](handleEntityNotFound(_0x125f5a,null))[_0xfda3('0x21')](saveUpdates(_0x192133[_0xfda3('0x47')],null))['then'](respondWithResult(_0x125f5a,null))[_0xfda3('0x41')](handleError(_0x125f5a,null));};exports[_0xfda3('0x22')]=function(_0x15eb87,_0x4bcd2b){return db[_0xfda3('0x27')][_0xfda3('0x45')]({'where':{'id':_0x15eb87[_0xfda3('0x48')]['id']}})['then'](handleEntityNotFound(_0x4bcd2b,null))[_0xfda3('0x21')](removeEntity(_0x4bcd2b,null))[_0xfda3('0x41')](handleError(_0x4bcd2b,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 20eb056..8d6e7e8 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 _0xaaee=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xaaee,0x132));var _0xeaae=function(_0x4f9a9c,_0x3c932a){_0x4f9a9c=_0x4f9a9c-0x0;var _0x352e64=_0xaaee[_0x4f9a9c];return _0x352e64;};'use strict';var _=require(_0xeaae('0x0'));var util=require(_0xeaae('0x1'));var logger=require(_0xeaae('0x2'))(_0xeaae('0x3'));var moment=require(_0xeaae('0x4'));var BPromise=require('bluebird');var rp=require(_0xeaae('0x5'));var fs=require('fs');var path=require(_0xeaae('0x6'));var rimraf=require(_0xeaae('0x7'));var config=require(_0xeaae('0x8'));var attributes=require(_0xeaae('0x9'));module[_0xeaae('0xa')]=function(_0xb5ad89,_0x491e4){return _0xb5ad89[_0xeaae('0xb')](_0xeaae('0xc'),attributes,{'tableName':_0xeaae('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82d8=['define','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','bluebird','path','./analyticTreeReport.attributes','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x82d8,0xff));var _0x882d=function(_0x3af669,_0x56fc4a){_0x3af669=_0x3af669-0x0;var _0x30ebcb=_0x82d8[_0x3af669];return _0x30ebcb;};'use strict';var _=require(_0x882d('0x0'));var util=require('util');var logger=require(_0x882d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x882d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x882d('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x882d('0x4'));module[_0x882d('0x5')]=function(_0x19f644,_0xa928f7){return _0x19f644[_0x882d('0x6')](_0x882d('0x7'),attributes,{'tableName':_0x882d('0x8'),'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 73afff5..2e02e8c 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 _0x8b64=['AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x2956e2,_0x270e25){var _0x17f819=function(_0x58b857){while(--_0x58b857){_0x2956e2['push'](_0x2956e2['shift']());}};_0x17f819(++_0x270e25);}(_0x8b64,0x8c));var _0x48b6=function(_0x32f654,_0x161892){_0x32f654=_0x32f654-0x0;var _0x247dc7=_0x8b64[_0x32f654];return _0x247dc7;};'use strict';var _=require(_0x48b6('0x0'));var util=require(_0x48b6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x48b6('0x2'));var fs=require('fs');var Redis=require(_0x48b6('0x3'));var db=require(_0x48b6('0x4'))['db'];var utils=require(_0x48b6('0x5'));var logger=require(_0x48b6('0x6'))(_0x48b6('0x7'));var config=require(_0x48b6('0x8'));var jayson=require(_0x48b6('0x9'));var client=jayson['client'][_0x48b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23a45c,_0x12a214,_0x119d3b){return new BPromise(function(_0x28456b,_0x57b737){return client[_0x48b6('0xb')](_0x23a45c,_0x119d3b)[_0x48b6('0xc')](function(_0x326233){logger[_0x48b6('0xd')](_0x48b6('0xe'),_0x12a214,_0x48b6('0xf'));logger['debug'](_0x48b6('0x10'),_0x12a214,_0x48b6('0xf'),JSON[_0x48b6('0x11')](_0x326233));if(_0x326233[_0x48b6('0x12')]){if(_0x326233[_0x48b6('0x12')]['code']===0x1f4){logger[_0x48b6('0x12')](_0x48b6('0xe'),_0x12a214,_0x326233[_0x48b6('0x12')][_0x48b6('0x13')]);return _0x57b737(_0x326233[_0x48b6('0x12')][_0x48b6('0x13')]);}logger[_0x48b6('0x12')](_0x48b6('0xe'),_0x12a214,_0x326233[_0x48b6('0x12')][_0x48b6('0x13')]);return _0x28456b(_0x326233[_0x48b6('0x12')][_0x48b6('0x13')]);}else{logger[_0x48b6('0xd')](_0x48b6('0xe'),_0x12a214,_0x48b6('0xf'));_0x28456b(_0x326233[_0x48b6('0x14')]['message']);}})[_0x48b6('0x15')](function(_0x49a2f1){logger['error'](_0x48b6('0xe'),_0x12a214,_0x49a2f1);_0x57b737(_0x49a2f1);});});} \ No newline at end of file +var _0x74bc=['request\x20sent','stringify','error','code','message','info','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','AnalyticTreeReport,\x20%s,\x20%s','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x74bc,0x119));var _0xc74b=function(_0x2550f2,_0x4cf9ec){_0x2550f2=_0x2550f2-0x0;var _0xf3341c=_0x74bc[_0x2550f2];return _0xf3341c;};'use strict';var _=require(_0xc74b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc74b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc74b('0x2'));var db=require(_0xc74b('0x3'))['db'];var utils=require(_0xc74b('0x4'));var logger=require(_0xc74b('0x5'))(_0xc74b('0x6'));var config=require(_0xc74b('0x7'));var jayson=require(_0xc74b('0x8'));var client=jayson['client'][_0xc74b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21b61a,_0x22d9b1,_0x117643){return new BPromise(function(_0x18ba7b,_0x1aca3f){return client['request'](_0x21b61a,_0x117643)['then'](function(_0x53fdc4){logger['info'](_0xc74b('0xa'),_0x22d9b1,'request\x20sent');logger[_0xc74b('0xb')](_0xc74b('0xc'),_0x22d9b1,_0xc74b('0xd'),JSON[_0xc74b('0xe')](_0x53fdc4));if(_0x53fdc4[_0xc74b('0xf')]){if(_0x53fdc4[_0xc74b('0xf')][_0xc74b('0x10')]===0x1f4){logger[_0xc74b('0xf')](_0xc74b('0xa'),_0x22d9b1,_0x53fdc4['error'][_0xc74b('0x11')]);return _0x1aca3f(_0x53fdc4[_0xc74b('0xf')]['message']);}logger[_0xc74b('0xf')](_0xc74b('0xa'),_0x22d9b1,_0x53fdc4[_0xc74b('0xf')][_0xc74b('0x11')]);return _0x18ba7b(_0x53fdc4['error'][_0xc74b('0x11')]);}else{logger[_0xc74b('0x12')](_0xc74b('0xa'),_0x22d9b1,_0xc74b('0xd'));_0x18ba7b(_0x53fdc4[_0xc74b('0x13')][_0xc74b('0x11')]);}})[_0xc74b('0x14')](function(_0x5479a8){logger['error'](_0xc74b('0xa'),_0x22d9b1,_0x5479a8);_0x1aca3f(_0x5479a8);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 838ae0a..9a4d0e9 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 _0xead3=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xead3,0x1a2));var _0x3ead=function(_0x5e8b4d,_0x4e5ba1){_0x5e8b4d=_0x5e8b4d-0x0;var _0x5d0091=_0xead3[_0x5e8b4d];return _0x5d0091;};'use strict';var multer=require(_0x3ead('0x0'));var util=require(_0x3ead('0x1'));var path=require(_0x3ead('0x2'));var timeout=require(_0x3ead('0x3'));var express=require(_0x3ead('0x4'));var router=express[_0x3ead('0x5')]();var auth=require(_0x3ead('0x6'));var interaction=require(_0x3ead('0x7'));var config=require(_0x3ead('0x8'));var controller=require(_0x3ead('0x9'));router[_0x3ead('0xa')]('/',auth[_0x3ead('0xb')](),controller['index']);router[_0x3ead('0xa')](_0x3ead('0xc'),auth['isAuthenticated'](),controller[_0x3ead('0xd')]);router[_0x3ead('0xe')]('/',auth['isAuthenticated'](),controller[_0x3ead('0xf')]);router[_0x3ead('0x10')](_0x3ead('0xc'),auth[_0x3ead('0xb')](),controller[_0x3ead('0x11')]);router[_0x3ead('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x3ead('0x13')]=router; \ No newline at end of file +var _0x2185=['put','/:id','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','post','create'];(function(_0x159caa,_0x26cc40){var _0x19385b=function(_0x11be05){while(--_0x11be05){_0x159caa['push'](_0x159caa['shift']());}};_0x19385b(++_0x26cc40);}(_0x2185,0x1a6));var _0x5218=function(_0x316139,_0x32882a){_0x316139=_0x316139-0x0;var _0x2ff6c9=_0x2185[_0x316139];return _0x2ff6c9;};'use strict';var multer=require(_0x5218('0x0'));var util=require(_0x5218('0x1'));var path=require('path');var timeout=require(_0x5218('0x2'));var express=require(_0x5218('0x3'));var router=express[_0x5218('0x4')]();var auth=require(_0x5218('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5218('0x6'));var controller=require(_0x5218('0x7'));router[_0x5218('0x8')]('/',auth[_0x5218('0x9')](),controller[_0x5218('0xa')]);router[_0x5218('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5218('0xb')]('/',auth['isAuthenticated'](),controller[_0x5218('0xc')]);router[_0x5218('0xd')](_0x5218('0xe'),auth[_0x5218('0x9')](),controller['update']);router['delete'](_0x5218('0xe'),auth[_0x5218('0x9')](),controller['destroy']);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 cf7ee68..b2ced20 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 _0x6fd0=['STRING'];(function(_0x5f50eb,_0x3e7d18){var _0xb912b6=function(_0x19d99d){while(--_0x19d99d){_0x5f50eb['push'](_0x5f50eb['shift']());}};_0xb912b6(++_0x3e7d18);}(_0x6fd0,0x1ba));var _0x06fd=function(_0x3b8e26,_0x2ae5ce){_0x3b8e26=_0x3b8e26-0x0;var _0x52ffe4=_0x6fd0[_0x3b8e26];return _0x52ffe4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x06fd('0x0')]},'type':{'type':Sequelize[_0x06fd('0x0')]}}; \ No newline at end of file +var _0xc4cf=['sequelize','STRING'];(function(_0x5c6022,_0x5cd10b){var _0x4ab5af=function(_0x988aff){while(--_0x988aff){_0x5c6022['push'](_0x5c6022['shift']());}};_0x4ab5af(++_0x5cd10b);}(_0xc4cf,0x1d6));var _0xfc4c=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xc4cf[_0x29d915];return _0x160f86;};'use strict';var Sequelize=require(_0xfc4c('0x0'));module['exports']={'name':{'type':Sequelize[_0xfc4c('0x1')]},'basename':{'type':Sequelize[_0xfc4c('0x1')]},'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 62681f9..b112cc7 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 _0x85f9=['path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','Attachment','includeAll','include','rows','catch','show','omit','updatedAt','body','create','find','params','file','originalname','basename','mimetype','download','findOne','server/files/attachments/','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x4f3d37,_0x390591){var _0x190e46=function(_0x30104e){while(--_0x30104e){_0x4f3d37['push'](_0x4f3d37['shift']());}};_0x190e46(++_0x390591);}(_0x85f9,0x18e));var _0x985f=function(_0x228668,_0x43e0c4){_0x228668=_0x228668-0x0;var _0x569214=_0x85f9[_0x228668];return _0x569214;};'use strict';var pdf=require(_0x985f('0x0'));var emlformat=require(_0x985f('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x985f('0x2'));var rp=require('request-promise');var moment=require(_0x985f('0x3'));var BPromise=require(_0x985f('0x4'));var Mustache=require(_0x985f('0x5'));var util=require(_0x985f('0x6'));var path=require(_0x985f('0x7'));var sox=require(_0x985f('0x8'));var csv=require(_0x985f('0x9'));var ejs=require(_0x985f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x985f('0xb'));var crypto=require(_0x985f('0xc'));var jsforce=require(_0x985f('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x985f('0xe'));var Papa=require('papaparse');var Redis=require(_0x985f('0xf'));var authService=require(_0x985f('0x10'));var qs=require(_0x985f('0x11'));var as=require(_0x985f('0x12'));var hardwareService=require(_0x985f('0x13'));var logger=require(_0x985f('0x14'))(_0x985f('0x15'));var utils=require(_0x985f('0x16'));var config=require(_0x985f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x217cfa,_0xc858a){_0xc858a=_0xc858a||0xcc;return function(_0x3844e1){if(_0x3844e1){return _0x217cfa['sendStatus'](_0xc858a);}return _0x217cfa[_0x985f('0x18')](_0xc858a)[_0x985f('0x19')]();};}function respondWithResult(_0x57934f,_0x1c3b75){_0x1c3b75=_0x1c3b75||0xc8;return function(_0x86cd95){if(_0x86cd95){return _0x57934f[_0x985f('0x18')](_0x1c3b75)[_0x985f('0x1a')](_0x86cd95);}};}function respondWithFilteredResult(_0x202299,_0x437f79){return function(_0x34077f){if(_0x34077f){var _0x2590e0=_0x34077f[_0x985f('0x1b')],_0x1b1683=_0x437f79['offset'],_0x2afa14=_0x437f79[_0x985f('0x1c')]+_0x437f79[_0x985f('0x1d')],_0x180e65;if(_0x2afa14>=_0x2590e0){_0x2afa14=_0x2590e0;_0x180e65=0xc8;}else{_0x180e65=0xce;}_0x202299[_0x985f('0x18')](_0x180e65);return _0x202299[_0x985f('0x1e')](_0x985f('0x1f'),_0x1b1683+'-'+_0x2afa14+'/'+_0x2590e0)[_0x985f('0x1a')](_0x34077f);}return null;};}function patchUpdates(_0x54cbce){return function(_0x111b86){try{jsonpatch[_0x985f('0x20')](_0x111b86,_0x54cbce,!![]);}catch(_0x1900c1){return BPromise[_0x985f('0x21')](_0x1900c1);}return _0x111b86[_0x985f('0x22')]();};}function saveUpdates(_0x2bf742,_0x20f872){return function(_0x214425){if(_0x214425){return _0x214425[_0x985f('0x23')](_0x2bf742)[_0x985f('0x24')](function(_0x108143){return _0x108143;});}return null;};}function removeEntity(_0x3d6f24,_0xb78423){return function(_0x1d89e1){if(_0x1d89e1){return _0x1d89e1[_0x985f('0x25')]()['then'](function(){_0x3d6f24[_0x985f('0x18')](0xcc)[_0x985f('0x19')]();});}};}function handleEntityNotFound(_0x334220,_0x34bfd3){return function(_0x4f273e){if(!_0x4f273e){_0x334220[_0x985f('0x26')](0x194);}return _0x4f273e;};}function handleError(_0x5b1f3c,_0x1475f5){_0x1475f5=_0x1475f5||0x1f4;return function(_0x234e26){logger[_0x985f('0x27')](_0x234e26['stack']);if(_0x234e26[_0x985f('0x28')]){delete _0x234e26[_0x985f('0x28')];}_0x5b1f3c[_0x985f('0x18')](_0x1475f5)[_0x985f('0x29')](_0x234e26);};}exports['index']=function(_0xb59c65,_0x2518c3){var _0x370aeb={},_0x350157={},_0x5434c5={'count':0x0,'rows':[]};var _0x2263b7=_[_0x985f('0x2a')](db['Attachment'][_0x985f('0x2b')],function(_0x43629d){return{'name':_0x43629d['fieldName'],'type':_0x43629d[_0x985f('0x2c')][_0x985f('0x2d')]};});_0x350157['model']=_[_0x985f('0x2a')](_0x2263b7,_0x985f('0x28'));_0x350157[_0x985f('0x2e')]=_[_0x985f('0x2f')](_0xb59c65['query']);_0x350157[_0x985f('0x30')]=_[_0x985f('0x31')](_0x350157[_0x985f('0x32')],_0x350157[_0x985f('0x2e')]);_0x370aeb['attributes']=_[_0x985f('0x31')](_0x350157[_0x985f('0x32')],qs[_0x985f('0x33')](_0xb59c65[_0x985f('0x2e')][_0x985f('0x33')]));_0x370aeb[_0x985f('0x34')]=_0x370aeb['attributes'][_0x985f('0x35')]?_0x370aeb[_0x985f('0x34')]:_0x350157[_0x985f('0x32')];if(!_0xb59c65[_0x985f('0x2e')][_0x985f('0x36')](_0x985f('0x37'))){_0x370aeb[_0x985f('0x1d')]=qs[_0x985f('0x1d')](_0xb59c65[_0x985f('0x2e')][_0x985f('0x1d')]);_0x370aeb[_0x985f('0x1c')]=qs[_0x985f('0x1c')](_0xb59c65['query'][_0x985f('0x1c')]);}_0x370aeb['order']=qs[_0x985f('0x38')](_0xb59c65[_0x985f('0x2e')]['sort']);_0x370aeb[_0x985f('0x39')]=qs['filters'](_[_0x985f('0x3a')](_0xb59c65[_0x985f('0x2e')],_0x350157[_0x985f('0x30')]));if(_0xb59c65[_0x985f('0x2e')][_0x985f('0x3b')]){_0x370aeb[_0x985f('0x39')]=_[_0x985f('0x3c')](_0x370aeb['where'],{'$or':_[_0x985f('0x2a')](_0x2263b7,function(_0x6bc729){if(_0x6bc729[_0x985f('0x2c')]!=='VIRTUAL'){var _0x5607f8={};_0x5607f8[_0x6bc729[_0x985f('0x28')]]={'$like':'%'+_0xb59c65['query']['filter']+'%'};return _0x5607f8;}})});}_0x370aeb=_[_0x985f('0x3c')]({},_0x370aeb,_0xb59c65[_0x985f('0x3d')]);var _0x46df88={'where':_0x370aeb['where']};return db[_0x985f('0x3e')]['count'](_0x46df88)[_0x985f('0x24')](function(_0x14ce83){_0x5434c5['count']=_0x14ce83;if(_0xb59c65[_0x985f('0x2e')][_0x985f('0x3f')]){_0x370aeb[_0x985f('0x40')]=[{'all':!![]}];}return db[_0x985f('0x3e')]['findAll'](_0x370aeb);})['then'](function(_0x5e481c){_0x5434c5[_0x985f('0x41')]=_0x5e481c;return _0x5434c5;})[_0x985f('0x24')](respondWithFilteredResult(_0x2518c3,_0x370aeb))[_0x985f('0x42')](handleError(_0x2518c3,null));};exports[_0x985f('0x43')]=function(_0x540bd2,_0x3cade9){var _0x26f4d5={'raw':!![],'where':{'id':_0x540bd2['params']['id']}},_0x3247b5={};_0x3247b5[_0x985f('0x32')]=_[_0x985f('0x2f')](db[_0x985f('0x3e')][_0x985f('0x2b')]);_0x3247b5[_0x985f('0x2e')]=_[_0x985f('0x2f')](_0x540bd2[_0x985f('0x2e')]);_0x3247b5[_0x985f('0x30')]=_[_0x985f('0x31')](_0x3247b5[_0x985f('0x32')],_0x3247b5['query']);_0x26f4d5[_0x985f('0x34')]=_[_0x985f('0x31')](_0x3247b5[_0x985f('0x32')],qs[_0x985f('0x33')](_0x540bd2[_0x985f('0x2e')][_0x985f('0x33')]));_0x26f4d5[_0x985f('0x34')]=_0x26f4d5[_0x985f('0x34')][_0x985f('0x35')]?_0x26f4d5['attributes']:_0x3247b5[_0x985f('0x32')];if(_0x540bd2[_0x985f('0x2e')][_0x985f('0x3f')]){_0x26f4d5[_0x985f('0x40')]=[{'all':!![]}];}_0x26f4d5=_[_0x985f('0x3c')]({},_0x26f4d5,_0x540bd2[_0x985f('0x3d')]);return db['Attachment']['find'](_0x26f4d5)[_0x985f('0x24')](handleEntityNotFound(_0x3cade9,null))[_0x985f('0x24')](respondWithResult(_0x3cade9,null))[_0x985f('0x42')](handleError(_0x3cade9,null));};exports['clone']=function(_0x46f70d,_0x187870){var _0x41ca91={'where':{'id':_0x46f70d['params']['id']}},_0x30cdca={};_0x30cdca[_0x985f('0x32')]=_[_0x985f('0x2f')](db[_0x985f('0x3e')][_0x985f('0x2b')]);_0x41ca91['attributes']=_[_0x985f('0x31')](_0x30cdca['model'],qs[_0x985f('0x33')](_0x46f70d[_0x985f('0x2e')][_0x985f('0x33')]));_0x41ca91[_0x985f('0x34')]=_0x41ca91[_0x985f('0x34')][_0x985f('0x35')]?_0x41ca91[_0x985f('0x34')]:_0x30cdca[_0x985f('0x32')];if(_0x46f70d[_0x985f('0x2e')][_0x985f('0x3f')]){_0x41ca91[_0x985f('0x40')]=[{'all':!![]}];}_0x41ca91=_[_0x985f('0x3c')]({},_0x41ca91,_0x46f70d[_0x985f('0x3d')]);return db[_0x985f('0x3e')]['find'](_0x41ca91)[_0x985f('0x24')](handleEntityNotFound(_0x187870,null))[_0x985f('0x24')](function(_0x2d9ba9){if(_0x2d9ba9){var _0x92c5d=_0x2d9ba9['get']({'plain':!![]});_0x92c5d=qs[_0x985f('0x44')](_0x92c5d,['id','createdAt',_0x985f('0x45')]);_0x46f70d[_0x985f('0x46')]=_[_0x985f('0x44')](_0x46f70d[_0x985f('0x46')],['id','createdAt','updatedAt']);return db[_0x985f('0x3e')][_0x985f('0x47')](_[_0x985f('0x3c')](_0x92c5d,_0x46f70d[_0x985f('0x46')]),{'include':_0x46f70d[_0x985f('0x2e')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x985f('0x24')](respondWithResult(_0x187870,0xc9))[_0x985f('0x42')](handleError(_0x187870,null));};exports[_0x985f('0x23')]=function(_0xddb2bd,_0x39dcb9){if(_0xddb2bd[_0x985f('0x46')]['id']){delete _0xddb2bd[_0x985f('0x46')]['id'];}return db[_0x985f('0x3e')][_0x985f('0x48')]({'where':{'id':_0xddb2bd[_0x985f('0x49')]['id']}})[_0x985f('0x24')](handleEntityNotFound(_0x39dcb9,null))['then'](saveUpdates(_0xddb2bd[_0x985f('0x46')],null))['then'](respondWithResult(_0x39dcb9,null))[_0x985f('0x42')](handleError(_0x39dcb9,null));};exports['destroy']=function(_0x1355b6,_0x1aa482){return db[_0x985f('0x3e')][_0x985f('0x48')]({'where':{'id':_0x1355b6[_0x985f('0x49')]['id']}})[_0x985f('0x24')](handleEntityNotFound(_0x1aa482,null))['then'](removeEntity(_0x1aa482,null))[_0x985f('0x42')](handleError(_0x1aa482,null));};exports[_0x985f('0x47')]=function(_0x1aaa8a,_0x5961ce,_0x2d5d60){_0x1aaa8a[_0x985f('0x46')][_0x985f('0x28')]=_0x1aaa8a[_0x985f('0x4a')][_0x985f('0x4b')];_0x1aaa8a[_0x985f('0x46')][_0x985f('0x4c')]=_0x1aaa8a[_0x985f('0x4a')]['filename'];_0x1aaa8a[_0x985f('0x46')][_0x985f('0x2c')]=_0x1aaa8a['file'][_0x985f('0x4d')];return db[_0x985f('0x3e')][_0x985f('0x47')](_0x1aaa8a[_0x985f('0x46')])[_0x985f('0x24')](respondWithResult(_0x5961ce,0xc9))[_0x985f('0x42')](handleError(_0x5961ce,null));};exports[_0x985f('0x4e')]=function(_0x116baa,_0x27516e,_0x402e2a){return db[_0x985f('0x3e')][_0x985f('0x4f')]({'where':{'id':_0x116baa[_0x985f('0x49')]['id']},'raw':!![]})[_0x985f('0x24')](handleEntityNotFound(_0x27516e,null))['then'](function(_0x174fdd){if(_0x174fdd){return _0x27516e[_0x985f('0x4e')](path['join'](config['root'],_0x985f('0x50'),_0x174fdd['basename']));}})['catch'](handleError(_0x27516e,null));}; \ No newline at end of file +var _0x1d26=['Attachment','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','find','clone','length','includeAll','get','omit','createdAt','updatedAt','create','body','destroy','originalname','file','filename','download','findOne','join','root','server/files/attachments/','basename','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','apply','reject','save','update','then','error','name','send','index','map'];(function(_0x9d139f,_0x1d6ed5){var _0x48c321=function(_0x8ffb35){while(--_0x8ffb35){_0x9d139f['push'](_0x9d139f['shift']());}};_0x48c321(++_0x1d6ed5);}(_0x1d26,0xd7));var _0x61d2=function(_0x4b1b3a,_0x239438){_0x4b1b3a=_0x4b1b3a-0x0;var _0x203002=_0x1d26[_0x4b1b3a];return _0x203002;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x61d2('0x0'));var rimraf=require(_0x61d2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x61d2('0x2'));var rp=require(_0x61d2('0x3'));var moment=require(_0x61d2('0x4'));var BPromise=require(_0x61d2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x61d2('0x6'));var sox=require(_0x61d2('0x7'));var csv=require(_0x61d2('0x8'));var ejs=require(_0x61d2('0x9'));var fs=require('fs');var _=require(_0x61d2('0xa'));var squel=require(_0x61d2('0xb'));var crypto=require('crypto');var jsforce=require(_0x61d2('0xc'));var deskjs=require(_0x61d2('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x61d2('0xe'));var Redis=require(_0x61d2('0xf'));var authService=require(_0x61d2('0x10'));var qs=require(_0x61d2('0x11'));var as=require(_0x61d2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61d2('0x13'))(_0x61d2('0x14'));var utils=require(_0x61d2('0x15'));var config=require(_0x61d2('0x16'));var db=require(_0x61d2('0x17'))['db'];function respondWithStatusCode(_0x423494,_0x249aa3){_0x249aa3=_0x249aa3||0xcc;return function(_0x4ab583){if(_0x4ab583){return _0x423494[_0x61d2('0x18')](_0x249aa3);}return _0x423494[_0x61d2('0x19')](_0x249aa3)['end']();};}function respondWithResult(_0x568166,_0x1e7d03){_0x1e7d03=_0x1e7d03||0xc8;return function(_0x2da054){if(_0x2da054){return _0x568166[_0x61d2('0x19')](_0x1e7d03)[_0x61d2('0x1a')](_0x2da054);}};}function respondWithFilteredResult(_0x2cfbba,_0x2a24cc){return function(_0xfe168e){if(_0xfe168e){var _0x1cabf7=_0xfe168e[_0x61d2('0x1b')],_0x22eb3d=_0x2a24cc[_0x61d2('0x1c')],_0x2d58a1=_0x2a24cc['offset']+_0x2a24cc['limit'],_0x99e69f;if(_0x2d58a1>=_0x1cabf7){_0x2d58a1=_0x1cabf7;_0x99e69f=0xc8;}else{_0x99e69f=0xce;}_0x2cfbba[_0x61d2('0x19')](_0x99e69f);return _0x2cfbba['set'](_0x61d2('0x1d'),_0x22eb3d+'-'+_0x2d58a1+'/'+_0x1cabf7)[_0x61d2('0x1a')](_0xfe168e);}return null;};}function patchUpdates(_0xf2089e){return function(_0x16f863){try{jsonpatch[_0x61d2('0x1e')](_0x16f863,_0xf2089e,!![]);}catch(_0x44f8f3){return BPromise[_0x61d2('0x1f')](_0x44f8f3);}return _0x16f863[_0x61d2('0x20')]();};}function saveUpdates(_0x2c8f88,_0x518b32){return function(_0x3e927a){if(_0x3e927a){return _0x3e927a[_0x61d2('0x21')](_0x2c8f88)[_0x61d2('0x22')](function(_0x27ca1a){return _0x27ca1a;});}return null;};}function removeEntity(_0x4a5a34,_0x5158b7){return function(_0x5e3449){if(_0x5e3449){return _0x5e3449['destroy']()[_0x61d2('0x22')](function(){_0x4a5a34['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4da4fd,_0x321c93){return function(_0x428b64){if(!_0x428b64){_0x4da4fd[_0x61d2('0x18')](0x194);}return _0x428b64;};}function handleError(_0xa653ae,_0x2ec5be){_0x2ec5be=_0x2ec5be||0x1f4;return function(_0x433963){logger[_0x61d2('0x23')](_0x433963['stack']);if(_0x433963['name']){delete _0x433963[_0x61d2('0x24')];}_0xa653ae[_0x61d2('0x19')](_0x2ec5be)[_0x61d2('0x25')](_0x433963);};}exports[_0x61d2('0x26')]=function(_0x41df18,_0x382471){var _0x2a2d4a={},_0x3e08c7={},_0x5599e0={'count':0x0,'rows':[]};var _0x4fbb6c=_[_0x61d2('0x27')](db[_0x61d2('0x28')][_0x61d2('0x29')],function(_0x3223e2){return{'name':_0x3223e2['fieldName'],'type':_0x3223e2[_0x61d2('0x2a')]['key']};});_0x3e08c7[_0x61d2('0x2b')]=_[_0x61d2('0x27')](_0x4fbb6c,_0x61d2('0x24'));_0x3e08c7[_0x61d2('0x2c')]=_[_0x61d2('0x2d')](_0x41df18[_0x61d2('0x2c')]);_0x3e08c7[_0x61d2('0x2e')]=_[_0x61d2('0x2f')](_0x3e08c7[_0x61d2('0x2b')],_0x3e08c7[_0x61d2('0x2c')]);_0x2a2d4a[_0x61d2('0x30')]=_[_0x61d2('0x2f')](_0x3e08c7[_0x61d2('0x2b')],qs[_0x61d2('0x31')](_0x41df18[_0x61d2('0x2c')][_0x61d2('0x31')]));_0x2a2d4a[_0x61d2('0x30')]=_0x2a2d4a['attributes']['length']?_0x2a2d4a[_0x61d2('0x30')]:_0x3e08c7[_0x61d2('0x2b')];if(!_0x41df18['query']['hasOwnProperty'](_0x61d2('0x32'))){_0x2a2d4a[_0x61d2('0x33')]=qs[_0x61d2('0x33')](_0x41df18[_0x61d2('0x2c')]['limit']);_0x2a2d4a[_0x61d2('0x1c')]=qs[_0x61d2('0x1c')](_0x41df18['query'][_0x61d2('0x1c')]);}_0x2a2d4a[_0x61d2('0x34')]=qs[_0x61d2('0x35')](_0x41df18[_0x61d2('0x2c')][_0x61d2('0x35')]);_0x2a2d4a['where']=qs[_0x61d2('0x2e')](_[_0x61d2('0x36')](_0x41df18[_0x61d2('0x2c')],_0x3e08c7[_0x61d2('0x2e')]));if(_0x41df18[_0x61d2('0x2c')][_0x61d2('0x37')]){_0x2a2d4a[_0x61d2('0x38')]=_[_0x61d2('0x39')](_0x2a2d4a[_0x61d2('0x38')],{'$or':_[_0x61d2('0x27')](_0x4fbb6c,function(_0x54feae){if(_0x54feae[_0x61d2('0x2a')]!==_0x61d2('0x3a')){var _0x754575={};_0x754575[_0x54feae['name']]={'$like':'%'+_0x41df18[_0x61d2('0x2c')][_0x61d2('0x37')]+'%'};return _0x754575;}})});}_0x2a2d4a=_['merge']({},_0x2a2d4a,_0x41df18['options']);var _0x2b88db={'where':_0x2a2d4a['where']};return db['Attachment'][_0x61d2('0x1b')](_0x2b88db)[_0x61d2('0x22')](function(_0x194f05){_0x5599e0[_0x61d2('0x1b')]=_0x194f05;if(_0x41df18[_0x61d2('0x2c')]['includeAll']){_0x2a2d4a[_0x61d2('0x3b')]=[{'all':!![]}];}return db[_0x61d2('0x28')][_0x61d2('0x3c')](_0x2a2d4a);})[_0x61d2('0x22')](function(_0x2f98ef){_0x5599e0[_0x61d2('0x3d')]=_0x2f98ef;return _0x5599e0;})[_0x61d2('0x22')](respondWithFilteredResult(_0x382471,_0x2a2d4a))[_0x61d2('0x3e')](handleError(_0x382471,null));};exports[_0x61d2('0x3f')]=function(_0x11ff05,_0x4f5dc7){var _0x52468a={'raw':!![],'where':{'id':_0x11ff05[_0x61d2('0x40')]['id']}},_0x16aef9={};_0x16aef9[_0x61d2('0x2b')]=_['keys'](db[_0x61d2('0x28')]['rawAttributes']);_0x16aef9[_0x61d2('0x2c')]=_[_0x61d2('0x2d')](_0x11ff05['query']);_0x16aef9['filters']=_[_0x61d2('0x2f')](_0x16aef9[_0x61d2('0x2b')],_0x16aef9[_0x61d2('0x2c')]);_0x52468a[_0x61d2('0x30')]=_['intersection'](_0x16aef9['model'],qs['fields'](_0x11ff05[_0x61d2('0x2c')]['fields']));_0x52468a[_0x61d2('0x30')]=_0x52468a[_0x61d2('0x30')]['length']?_0x52468a['attributes']:_0x16aef9['model'];if(_0x11ff05['query']['includeAll']){_0x52468a[_0x61d2('0x3b')]=[{'all':!![]}];}_0x52468a=_[_0x61d2('0x39')]({},_0x52468a,_0x11ff05['options']);return db[_0x61d2('0x28')][_0x61d2('0x41')](_0x52468a)[_0x61d2('0x22')](handleEntityNotFound(_0x4f5dc7,null))['then'](respondWithResult(_0x4f5dc7,null))[_0x61d2('0x3e')](handleError(_0x4f5dc7,null));};exports[_0x61d2('0x42')]=function(_0x5d3839,_0x2283a9){var _0x4d1a26={'where':{'id':_0x5d3839['params']['id']}},_0x64798c={};_0x64798c[_0x61d2('0x2b')]=_[_0x61d2('0x2d')](db[_0x61d2('0x28')][_0x61d2('0x29')]);_0x4d1a26['attributes']=_[_0x61d2('0x2f')](_0x64798c[_0x61d2('0x2b')],qs['fields'](_0x5d3839['query'][_0x61d2('0x31')]));_0x4d1a26[_0x61d2('0x30')]=_0x4d1a26[_0x61d2('0x30')][_0x61d2('0x43')]?_0x4d1a26[_0x61d2('0x30')]:_0x64798c[_0x61d2('0x2b')];if(_0x5d3839[_0x61d2('0x2c')][_0x61d2('0x44')]){_0x4d1a26[_0x61d2('0x3b')]=[{'all':!![]}];}_0x4d1a26=_['merge']({},_0x4d1a26,_0x5d3839['options']);return db[_0x61d2('0x28')][_0x61d2('0x41')](_0x4d1a26)['then'](handleEntityNotFound(_0x2283a9,null))['then'](function(_0x2d07cc){if(_0x2d07cc){var _0x3f8cd0=_0x2d07cc[_0x61d2('0x45')]({'plain':!![]});_0x3f8cd0=qs[_0x61d2('0x46')](_0x3f8cd0,['id',_0x61d2('0x47'),_0x61d2('0x48')]);_0x5d3839['body']=_['omit'](_0x5d3839['body'],['id',_0x61d2('0x47'),'updatedAt']);return db['Attachment'][_0x61d2('0x49')](_[_0x61d2('0x39')](_0x3f8cd0,_0x5d3839[_0x61d2('0x4a')]),{'include':_0x5d3839[_0x61d2('0x2c')][_0x61d2('0x44')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x2283a9,0xc9))[_0x61d2('0x3e')](handleError(_0x2283a9,null));};exports[_0x61d2('0x21')]=function(_0x54757b,_0x239d8){if(_0x54757b[_0x61d2('0x4a')]['id']){delete _0x54757b[_0x61d2('0x4a')]['id'];}return db[_0x61d2('0x28')][_0x61d2('0x41')]({'where':{'id':_0x54757b[_0x61d2('0x40')]['id']}})['then'](handleEntityNotFound(_0x239d8,null))[_0x61d2('0x22')](saveUpdates(_0x54757b[_0x61d2('0x4a')],null))[_0x61d2('0x22')](respondWithResult(_0x239d8,null))[_0x61d2('0x3e')](handleError(_0x239d8,null));};exports[_0x61d2('0x4b')]=function(_0x2cf478,_0x16514e){return db[_0x61d2('0x28')][_0x61d2('0x41')]({'where':{'id':_0x2cf478['params']['id']}})['then'](handleEntityNotFound(_0x16514e,null))[_0x61d2('0x22')](removeEntity(_0x16514e,null))[_0x61d2('0x3e')](handleError(_0x16514e,null));};exports[_0x61d2('0x49')]=function(_0x9c6aba,_0x1f0936,_0x4f89de){_0x9c6aba['body'][_0x61d2('0x24')]=_0x9c6aba['file'][_0x61d2('0x4c')];_0x9c6aba[_0x61d2('0x4a')]['basename']=_0x9c6aba[_0x61d2('0x4d')][_0x61d2('0x4e')];_0x9c6aba[_0x61d2('0x4a')][_0x61d2('0x2a')]=_0x9c6aba[_0x61d2('0x4d')]['mimetype'];return db[_0x61d2('0x28')][_0x61d2('0x49')](_0x9c6aba['body'])[_0x61d2('0x22')](respondWithResult(_0x1f0936,0xc9))[_0x61d2('0x3e')](handleError(_0x1f0936,null));};exports[_0x61d2('0x4f')]=function(_0x5ed774,_0x5f0c81,_0x3c3ced){return db[_0x61d2('0x28')][_0x61d2('0x50')]({'where':{'id':_0x5ed774['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5f0c81,null))['then'](function(_0x1a11f0){if(_0x1a11f0){return _0x5f0c81[_0x61d2('0x4f')](path[_0x61d2('0x51')](config[_0x61d2('0x52')],_0x61d2('0x53'),_0x1a11f0[_0x61d2('0x54')]));}})[_0x61d2('0x3e')](handleError(_0x5f0c81,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 887dc90..c895080 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 _0x7e05=['../../config/environment','./attachment.attributes','exports','define','attachments','lodash','util','api','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e05,0x69));var _0x57e0=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7e05[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x57e0('0x0'));var util=require(_0x57e0('0x1'));var logger=require('../../config/logger')(_0x57e0('0x2'));var moment=require('moment');var BPromise=require(_0x57e0('0x3'));var rp=require(_0x57e0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x57e0('0x5'));var attributes=require(_0x57e0('0x6'));module[_0x57e0('0x7')]=function(_0x327596,_0x5f4f7e){return _0x327596[_0x57e0('0x8')]('Attachment',attributes,{'tableName':_0x57e0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x288a=['define','Attachment','util','../../config/logger','api','moment','path','../../config/environment','./attachment.attributes','exports'];(function(_0x10b48a,_0x1a0a3f){var _0x2c4533=function(_0x5e4be6){while(--_0x5e4be6){_0x10b48a['push'](_0x10b48a['shift']());}};_0x2c4533(++_0x1a0a3f);}(_0x288a,0x188));var _0xa288=function(_0x403e7c,_0x350084){_0x403e7c=_0x403e7c-0x0;var _0x1c054b=_0x288a[_0x403e7c];return _0x1c054b;};'use strict';var _=require('lodash');var util=require(_0xa288('0x0'));var logger=require(_0xa288('0x1'))(_0xa288('0x2'));var moment=require(_0xa288('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa288('0x4'));var rimraf=require('rimraf');var config=require(_0xa288('0x5'));var attributes=require(_0xa288('0x6'));module[_0xa288('0x7')]=function(_0x4ad8fb,_0x1e2c4b){return _0x4ad8fb[_0xa288('0x8')](_0xa288('0x9'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index b7c3737..421dabd 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 _0x9dfa=['request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateAttachment','create','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','Attachment,\x20%s,\x20%s'];(function(_0x31dd7e,_0x72d5da){var _0x2a6bfd=function(_0x34a241){while(--_0x34a241){_0x31dd7e['push'](_0x31dd7e['shift']());}};_0x2a6bfd(++_0x72d5da);}(_0x9dfa,0x1a2));var _0xa9df=function(_0xc865d9,_0x48bb87){_0xc865d9=_0xc865d9-0x0;var _0x1f2681=_0x9dfa[_0xc865d9];return _0x1f2681;};'use strict';var _=require(_0xa9df('0x0'));var util=require(_0xa9df('0x1'));var moment=require(_0xa9df('0x2'));var BPromise=require(_0xa9df('0x3'));var rs=require(_0xa9df('0x4'));var fs=require('fs');var Redis=require(_0xa9df('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa9df('0x6'))(_0xa9df('0x7'));var config=require(_0xa9df('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa9df('0x9')][_0xa9df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28ce73,_0x4d4026,_0x12d564){return new BPromise(function(_0x310687,_0x4a63e8){return client['request'](_0x28ce73,_0x12d564)[_0xa9df('0xb')](function(_0x4b65c6){logger[_0xa9df('0xc')](_0xa9df('0xd'),_0x4d4026,_0xa9df('0xe'));logger['debug'](_0xa9df('0xf'),_0x4d4026,'request\x20sent',JSON[_0xa9df('0x10')](_0x4b65c6));if(_0x4b65c6['error']){if(_0x4b65c6[_0xa9df('0x11')][_0xa9df('0x12')]===0x1f4){logger[_0xa9df('0x11')](_0xa9df('0xd'),_0x4d4026,_0x4b65c6['error'][_0xa9df('0x13')]);return _0x4a63e8(_0x4b65c6[_0xa9df('0x11')][_0xa9df('0x13')]);}logger[_0xa9df('0x11')](_0xa9df('0xd'),_0x4d4026,_0x4b65c6[_0xa9df('0x11')][_0xa9df('0x13')]);return _0x310687(_0x4b65c6[_0xa9df('0x11')][_0xa9df('0x13')]);}else{logger['info'](_0xa9df('0xd'),_0x4d4026,_0xa9df('0xe'));_0x310687(_0x4b65c6[_0xa9df('0x14')][_0xa9df('0x13')]);}})[_0xa9df('0x15')](function(_0x4ce996){logger['error'](_0xa9df('0xd'),_0x4d4026,_0x4ce996);_0x4a63e8(_0x4ce996);});});}exports[_0xa9df('0x16')]=function(_0x8fdf88){var _0x137748=this;return new Promise(function(_0x2df671,_0x2e0497){return db['Attachment'][_0xa9df('0x17')](_0x8fdf88['body'],{'raw':_0x8fdf88[_0xa9df('0x18')]?_0x8fdf88['options'][_0xa9df('0x19')]===undefined?!![]:![]:!![]})[_0xa9df('0xb')](function(_0x2a40eb){logger[_0xa9df('0xc')](_0xa9df('0x16'),_0x8fdf88);logger[_0xa9df('0x1a')](_0xa9df('0x16'),_0x8fdf88,JSON[_0xa9df('0x10')](_0x2a40eb));_0x2df671(_0x2a40eb);})[_0xa9df('0x15')](function(_0x59078e){logger[_0xa9df('0x11')]('CreateAttachment',_0x59078e[_0xa9df('0x13')],_0x8fdf88);_0x2e0497(_0x137748[_0xa9df('0x11')](0x1f4,_0x59078e[_0xa9df('0x13')]));});});}; \ No newline at end of file +var _0xcb77=['then','CreateAttachment','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Attachment','create','body','options','raw'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xcb77,0x122));var _0x7cb7=function(_0x919445,_0x5467dc){_0x919445=_0x919445-0x0;var _0x511b3e=_0xcb77[_0x919445];return _0x511b3e;};'use strict';var _=require(_0x7cb7('0x0'));var util=require(_0x7cb7('0x1'));var moment=require(_0x7cb7('0x2'));var BPromise=require('bluebird');var rs=require(_0x7cb7('0x3'));var fs=require('fs');var Redis=require(_0x7cb7('0x4'));var db=require(_0x7cb7('0x5'))['db'];var utils=require(_0x7cb7('0x6'));var logger=require(_0x7cb7('0x7'))(_0x7cb7('0x8'));var config=require(_0x7cb7('0x9'));var jayson=require(_0x7cb7('0xa'));var client=jayson[_0x7cb7('0xb')][_0x7cb7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2a8c88,_0x1ca945,_0x88df78){return new BPromise(function(_0x45c202,_0x46f83d){return client[_0x7cb7('0xd')](_0x2a8c88,_0x88df78)['then'](function(_0x471d2a){logger[_0x7cb7('0xe')](_0x7cb7('0xf'),_0x1ca945,_0x7cb7('0x10'));logger[_0x7cb7('0x11')](_0x7cb7('0x12'),_0x1ca945,_0x7cb7('0x10'),JSON[_0x7cb7('0x13')](_0x471d2a));if(_0x471d2a[_0x7cb7('0x14')]){if(_0x471d2a['error'][_0x7cb7('0x15')]===0x1f4){logger[_0x7cb7('0x14')](_0x7cb7('0xf'),_0x1ca945,_0x471d2a[_0x7cb7('0x14')][_0x7cb7('0x16')]);return _0x46f83d(_0x471d2a[_0x7cb7('0x14')][_0x7cb7('0x16')]);}logger[_0x7cb7('0x14')](_0x7cb7('0xf'),_0x1ca945,_0x471d2a[_0x7cb7('0x14')][_0x7cb7('0x16')]);return _0x45c202(_0x471d2a[_0x7cb7('0x14')][_0x7cb7('0x16')]);}else{logger['info'](_0x7cb7('0xf'),_0x1ca945,_0x7cb7('0x10'));_0x45c202(_0x471d2a[_0x7cb7('0x17')][_0x7cb7('0x16')]);}})[_0x7cb7('0x18')](function(_0x4bc5b2){logger['error'](_0x7cb7('0xf'),_0x1ca945,_0x4bc5b2);_0x46f83d(_0x4bc5b2);});});}exports['CreateAttachment']=function(_0x1971b6){var _0x41301c=this;return new Promise(function(_0x18e087,_0x148807){return db[_0x7cb7('0x19')][_0x7cb7('0x1a')](_0x1971b6[_0x7cb7('0x1b')],{'raw':_0x1971b6[_0x7cb7('0x1c')]?_0x1971b6[_0x7cb7('0x1c')][_0x7cb7('0x1d')]===undefined?!![]:![]:!![]})[_0x7cb7('0x1e')](function(_0x41fa36){logger[_0x7cb7('0xe')](_0x7cb7('0x1f'),_0x1971b6);logger[_0x7cb7('0x11')](_0x7cb7('0x1f'),_0x1971b6,JSON[_0x7cb7('0x13')](_0x41fa36));_0x18e087(_0x41fa36);})[_0x7cb7('0x18')](function(_0x15737b){logger['error'](_0x7cb7('0x1f'),_0x15737b[_0x7cb7('0x16')],_0x1971b6);_0x148807(_0x41301c[_0x7cb7('0x14')](0x1f4,_0x15737b[_0x7cb7('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 3d744ff..aa266d9 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 _0xe8b1=['util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','/:id/download','post','clone','diskStorage','join','root','format','%s-%s','now','replace','single','file','create','put','/:id','update','delete','exports','multer'];(function(_0x3a2531,_0x2fba2d){var _0x361d84=function(_0x5107a1){while(--_0x5107a1){_0x3a2531['push'](_0x3a2531['shift']());}};_0x361d84(++_0x2fba2d);}(_0xe8b1,0x104));var _0x1e8b=function(_0x2c1aee,_0x1a494f){_0x2c1aee=_0x2c1aee-0x0;var _0x5e3b51=_0xe8b1[_0x2c1aee];return _0x5e3b51;};'use strict';var multer=require(_0x1e8b('0x0'));var util=require(_0x1e8b('0x1'));var path=require('path');var timeout=require(_0x1e8b('0x2'));var express=require(_0x1e8b('0x3'));var router=express[_0x1e8b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1e8b('0x5'));var config=require(_0x1e8b('0x6'));var controller=require(_0x1e8b('0x7'));router[_0x1e8b('0x8')]('/',auth[_0x1e8b('0x9')](),controller[_0x1e8b('0xa')]);router[_0x1e8b('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1e8b('0x8')](_0x1e8b('0xb'),auth[_0x1e8b('0x9')](),controller['download']);router[_0x1e8b('0xc')]('/:id/clone',auth['isAuthenticated'](),controller[_0x1e8b('0xd')]);var upload=multer({'storage':multer[_0x1e8b('0xe')]({'destination':function(_0x3e897c,_0x29c870,_0x56d33d){_0x56d33d(null,path[_0x1e8b('0xf')](config[_0x1e8b('0x10')],'server/files/attachments/'));},'filename':function(_0x4a8193,_0x58adda,_0x4bb3d5){_0x4bb3d5(null,util[_0x1e8b('0x11')](_0x1e8b('0x12'),Date[_0x1e8b('0x13')](),_0x58adda['originalname'][_0x1e8b('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x1e8b('0xc')]('/',upload[_0x1e8b('0x15')](_0x1e8b('0x16')),controller[_0x1e8b('0x17')]);router[_0x1e8b('0x18')](_0x1e8b('0x19'),auth[_0x1e8b('0x9')](),controller[_0x1e8b('0x1a')]);router[_0x1e8b('0x1b')](_0x1e8b('0x19'),auth[_0x1e8b('0x9')](),controller['destroy']);module[_0x1e8b('0x1c')]=router; \ No newline at end of file +var _0xc97a=['../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','clone','diskStorage','join','root','server/files/attachments/','format','%s-%s','originalname','replace','single','create','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x931081,_0x351467){var _0x5bf54d=function(_0x2bf2ca){while(--_0x2bf2ca){_0x931081['push'](_0x931081['shift']());}};_0x5bf54d(++_0x351467);}(_0xc97a,0x1d9));var _0xac97=function(_0x162bc1,_0x5cd1c6){_0x162bc1=_0x162bc1-0x0;var _0x2dc459=_0xc97a[_0x162bc1];return _0x2dc459;};'use strict';var multer=require(_0xac97('0x0'));var util=require(_0xac97('0x1'));var path=require(_0xac97('0x2'));var timeout=require('connect-timeout');var express=require(_0xac97('0x3'));var router=express[_0xac97('0x4')]();var auth=require(_0xac97('0x5'));var interaction=require(_0xac97('0x6'));var config=require(_0xac97('0x7'));var controller=require('./attachment.controller');router[_0xac97('0x8')]('/',auth[_0xac97('0x9')](),controller[_0xac97('0xa')]);router[_0xac97('0x8')](_0xac97('0xb'),auth['isAuthenticated'](),controller[_0xac97('0xc')]);router[_0xac97('0x8')](_0xac97('0xd'),auth[_0xac97('0x9')](),controller[_0xac97('0xe')]);router[_0xac97('0xf')]('/:id/clone',auth[_0xac97('0x9')](),controller[_0xac97('0x10')]);var upload=multer({'storage':multer[_0xac97('0x11')]({'destination':function(_0x31df17,_0x30b0fe,_0xf2a3ed){_0xf2a3ed(null,path[_0xac97('0x12')](config[_0xac97('0x13')],_0xac97('0x14')));},'filename':function(_0x32ec1b,_0x56845e,_0x4659b7){_0x4659b7(null,util[_0xac97('0x15')](_0xac97('0x16'),Date['now'](),_0x56845e[_0xac97('0x17')][_0xac97('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload[_0xac97('0x19')]('file'),controller[_0xac97('0x1a')]);router['put']('/:id',auth[_0xac97('0x9')](),controller[_0xac97('0x1b')]);router[_0xac97('0x1c')](_0xac97('0xb'),auth[_0xac97('0x9')](),controller[_0xac97('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index e67ef55..8b03b6f 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 _0x1f2d=['clientSecret','callbackURL','Setting','findOne','allowedLoginAttempts','then','find','map','emails','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','minutes','clearBlockUser','getLicense','catch','lodash','../../mysqldb','../../config/environment','signToken','../../config/utils','login','authenticate','google','/login','profile','email','callback','use'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x1f2d,0x15b));var _0xd1f2=function(_0x1d3a5d,_0x17fc32){_0x1d3a5d=_0x1d3a5d-0x0;var _0x257078=_0x1f2d[_0x1d3a5d];return _0x257078;};'use strict';var _=require(_0xd1f2('0x0'));var passport=require('passport');var GoogleStrategy=require('passport-google-oauth20')['Strategy'];var moment=require('moment');var db=require(_0xd1f2('0x1'))['db'];var config=require(_0xd1f2('0x2'));var signToken=require('../../components/auth/service')[_0xd1f2('0x3')];var utils=require(_0xd1f2('0x4'));exports[_0xd1f2('0x5')]=passport[_0xd1f2('0x6')](_0xd1f2('0x7'),{'failureRedirect':_0xd1f2('0x8'),'scope':[_0xd1f2('0x9'),_0xd1f2('0xa')],'session':![]});exports[_0xd1f2('0xb')]=passport[_0xd1f2('0x6')](_0xd1f2('0x7'),{'failureRedirect':_0xd1f2('0x8'),'session':![]});passport[_0xd1f2('0xc')](new GoogleStrategy({'clientID':config[_0xd1f2('0x7')]?config[_0xd1f2('0x7')]['clientID']:'id','clientSecret':config['google']?config[_0xd1f2('0x7')][_0xd1f2('0xd')]:'secret','callbackURL':config[_0xd1f2('0x7')]?config['google'][_0xd1f2('0xe')]:''},function(_0x6167a0,_0x4d9f36,_0x12b392,_0x19072e){var _0x451773,_0x15e5bb;return db[_0xd1f2('0xf')][_0xd1f2('0x10')]({'where':{'id':0x1},'attributes':[_0xd1f2('0x11'),'blockDuration'],'raw':!![]})[_0xd1f2('0x12')](function(_0x4a14cf){_0x451773=_0x4a14cf;return db['User'][_0xd1f2('0x13')]({'where':{'email':_[_0xd1f2('0x14')](_0x12b392[_0xd1f2('0x15')],'value'),'role':{'$or':['admin','user',_0xd1f2('0x16')]}}});})[_0xd1f2('0x12')](function(_0x58772d){_0x15e5bb=_0x58772d;if(_0x15e5bb){if(_0x15e5bb[_0xd1f2('0x17')]){return _0x19072e(_0xd1f2('0x18'));}else if(_0x451773[_0xd1f2('0x19')]>0x0){if(_0x15e5bb['blocked']){if(moment(_0x15e5bb['blockedAt'])['add'](_0x451773['blockDuration'],_0xd1f2('0x1a'))>moment()){return _0x19072e(_0xd1f2('0x18'));}else{return utils[_0xd1f2('0x1b')](_0x15e5bb,0x0,![],null)['then'](function(){return utils[_0xd1f2('0x1c')](_0x15e5bb);})['then'](function(){return _0x19072e(null,_0x15e5bb);});}}else{return utils[_0xd1f2('0x1c')](_0x15e5bb)[_0xd1f2('0x12')](function(){return _0x19072e(null,_0x15e5bb);});}}else{return utils['getLicense'](_0x15e5bb)[_0xd1f2('0x12')](function(){return _0x19072e(null,_0x15e5bb);});}}return _0x19072e(_0xd1f2('0x18'));})[_0xd1f2('0x1d')](function(_0x5a63b4){_0x19072e(_0x5a63b4);});})); \ No newline at end of file +var _0x90bb=['lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','then','User','find','value','admin','user','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','add','clearBlockUser','getLicense'];(function(_0x251912,_0x6e0bde){var _0xa5729c=function(_0x4c56fe){while(--_0x4c56fe){_0x251912['push'](_0x251912['shift']());}};_0xa5729c(++_0x6e0bde);}(_0x90bb,0x168));var _0xb90b=function(_0x375b6d,_0x52a457){_0x375b6d=_0x375b6d-0x0;var _0x509e2a=_0x90bb[_0x375b6d];return _0x509e2a;};'use strict';var _=require(_0xb90b('0x0'));var passport=require(_0xb90b('0x1'));var GoogleStrategy=require(_0xb90b('0x2'))['Strategy'];var moment=require(_0xb90b('0x3'));var db=require(_0xb90b('0x4'))['db'];var config=require(_0xb90b('0x5'));var signToken=require(_0xb90b('0x6'))[_0xb90b('0x7')];var utils=require(_0xb90b('0x8'));exports['login']=passport['authenticate'](_0xb90b('0x9'),{'failureRedirect':_0xb90b('0xa'),'scope':[_0xb90b('0xb'),_0xb90b('0xc')],'session':![]});exports[_0xb90b('0xd')]=passport[_0xb90b('0xe')](_0xb90b('0x9'),{'failureRedirect':_0xb90b('0xa'),'session':![]});passport[_0xb90b('0xf')](new GoogleStrategy({'clientID':config[_0xb90b('0x9')]?config[_0xb90b('0x9')][_0xb90b('0x10')]:'id','clientSecret':config[_0xb90b('0x9')]?config[_0xb90b('0x9')][_0xb90b('0x11')]:_0xb90b('0x12'),'callbackURL':config['google']?config['google'][_0xb90b('0x13')]:''},function(_0x18b350,_0x2872e4,_0x1647d1,_0x45eb6c){var _0x583155,_0xb1b045;return db[_0xb90b('0x14')][_0xb90b('0x15')]({'where':{'id':0x1},'attributes':[_0xb90b('0x16'),'blockDuration'],'raw':!![]})[_0xb90b('0x17')](function(_0x203005){_0x583155=_0x203005;return db[_0xb90b('0x18')][_0xb90b('0x19')]({'where':{'email':_['map'](_0x1647d1['emails'],_0xb90b('0x1a')),'role':{'$or':[_0xb90b('0x1b'),_0xb90b('0x1c'),'agent']}}});})[_0xb90b('0x17')](function(_0x38cb7d){_0xb1b045=_0x38cb7d;if(_0xb1b045){if(_0xb1b045[_0xb90b('0x1d')]){return _0x45eb6c(_0xb90b('0x1e'));}else if(_0x583155[_0xb90b('0x1f')]>0x0){if(_0xb1b045[_0xb90b('0x20')]){if(moment(_0xb1b045['blockedAt'])[_0xb90b('0x21')](_0x583155[_0xb90b('0x1f')],'minutes')>moment()){return _0x45eb6c(_0xb90b('0x1e'));}else{return utils[_0xb90b('0x22')](_0xb1b045,0x0,![],null)[_0xb90b('0x17')](function(){return utils[_0xb90b('0x23')](_0xb1b045);})[_0xb90b('0x17')](function(){return _0x45eb6c(null,_0xb1b045);});}}else{return utils['getLicense'](_0xb1b045)['then'](function(){return _0x45eb6c(null,_0xb1b045);});}}else{return utils[_0xb90b('0x23')](_0xb1b045)[_0xb90b('0x17')](function(){return _0x45eb6c(null,_0xb1b045);});}}return _0x45eb6c(_0xb90b('0x1e'));})['catch'](function(_0x4e68bd){_0x45eb6c(_0x4e68bd);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 9519782..9eb3117 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 _0x780f=['Router','./authGoogle.controller','../user/user.controller.js','login','get','/callback','callback','exports','express','passport'];(function(_0x2b0f81,_0x3917f0){var _0x5ce74c=function(_0x12dc0d){while(--_0x12dc0d){_0x2b0f81['push'](_0x2b0f81['shift']());}};_0x5ce74c(++_0x3917f0);}(_0x780f,0x6c));var _0xf780=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x780f[_0x4a747d];return _0x3a5b5c;};'use strict';var express=require(_0xf780('0x0'));var passport=require(_0xf780('0x1'));var router=express[_0xf780('0x2')]();var controller=require(_0xf780('0x3'));var userController=require(_0xf780('0x4'));var authService=require('../../components/auth/service');router['get']('/',controller[_0xf780('0x5')]);router[_0xf780('0x6')](_0xf780('0x7'),controller[_0xf780('0x8')],authService['isMiddleware'],userController[_0xf780('0x5')],authService['setTokenCookie']);module[_0xf780('0x9')]=router; \ No newline at end of file +var _0x6b19=['express','passport','./authGoogle.controller','get','login','/callback','callback','exports'];(function(_0x16a223,_0x31b6e8){var _0x5ded66=function(_0x25eb5f){while(--_0x25eb5f){_0x16a223['push'](_0x16a223['shift']());}};_0x5ded66(++_0x31b6e8);}(_0x6b19,0xe8));var _0x96b1=function(_0x1fac87,_0x526e4d){_0x1fac87=_0x1fac87-0x0;var _0x10177f=_0x6b19[_0x1fac87];return _0x10177f;};'use strict';var express=require(_0x96b1('0x0'));var passport=require(_0x96b1('0x1'));var router=express['Router']();var controller=require(_0x96b1('0x2'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router[_0x96b1('0x3')]('/',controller[_0x96b1('0x4')]);router[_0x96b1('0x3')](_0x96b1('0x5'),controller[_0x96b1('0x6')],authService['isMiddleware'],userController[_0x96b1('0x4')],authService['setTokenCookie']);module[_0x96b1('0x7')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 7729955..6e3db09 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 _0x48ce=['params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','password','save','Password\x20reset!','use','passport','passport-local','jayson/promise','moment','../../mysqldb','../../config/utils','client','Setting','findOne','allowedLoginAttempts','name','salt','role','disabled','blocked','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','authenticate','add','minutes','clearBlockUser','blockDuration','blockedAt','getLicense','catch','find','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','auth','pass','merge','email','request','SendMail','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','stringify','status','send','test','signToken','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x48ce,0x13f));var _0xe48c=function(_0x5038,_0x3bb205){_0x5038=_0x5038-0x0;var _0x3721a9=_0x48ce[_0x5038];return _0x3721a9;};'use strict';var util=require('util');var passport=require(_0xe48c('0x0'));var LocalStrategy=require(_0xe48c('0x1'))['Strategy'];var jayson=require(_0xe48c('0x2'));var _=require('lodash');var rs=require('randomstring');var moment=require(_0xe48c('0x3'));var db=require(_0xe48c('0x4'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xe48c('0x5'));var client=jayson[_0xe48c('0x6')]['http']({'port':0x232b});function localAuthenticate(_0x2f9d40,_0x242fb6,_0x2f16ac,_0x51251b){var _0x5e2196,_0x59e54a;return db[_0xe48c('0x7')][_0xe48c('0x8')]({'where':{'id':0x1},'attributes':[_0xe48c('0x9'),'blockDuration'],'raw':!![]})['then'](function(_0x27dd89){_0x5e2196=_0x27dd89;return _0x2f9d40[_0xe48c('0x8')]({'attributes':['id',_0xe48c('0xa'),'password',_0xe48c('0xb'),_0xe48c('0xc'),_0xe48c('0xd'),_0xe48c('0xe'),'blockedAt','loginAttempts'],'where':{'name':_0x242fb6,'role':{'$or':[_0xe48c('0xf'),_0xe48c('0x10'),_0xe48c('0x11')]}}});})['then'](function(_0x1ddc35){if(!_0x1ddc35||_0x1ddc35&&_0x1ddc35['name']!==_0x242fb6){throw new Error(_0xe48c('0x12'));}else{_0x59e54a=_0x1ddc35;return _0x59e54a;}})[_0xe48c('0x13')](function(){_0x59e54a[_0xe48c('0x14')](_0x2f16ac,function(_0x4a1ef0,_0xdf5c66){var _0x5201c8=_0x59e54a['loginAttempts']+0x1;if(_0x4a1ef0){return _0x51251b(_0x4a1ef0);}else if(!_0xdf5c66){if(_0x59e54a[_0xe48c('0xd')]){return _0x51251b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x5e2196[_0xe48c('0x9')]>0x0){if(_0x59e54a['blocked']){if(_0x5e2196['blockDuration']>0x0){if(moment(_0x59e54a['blockedAt'])[_0xe48c('0x15')](_0x5e2196['blockDuration'],_0xe48c('0x16'))>moment()){return _0x51251b(null,![],{'message':_0xe48c('0x12')});}else{return utils['clearBlockUser'](_0x59e54a,_0x5201c8,![],null)[_0xe48c('0x13')](function(){return _0x51251b(null,![],{'message':_0xe48c('0x12')});});}}else{return _0x51251b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x5201c8>=_0x5e2196[_0xe48c('0x9')]){return utils[_0xe48c('0x17')](_0x59e54a,0x0,!![],moment())[_0xe48c('0x13')](function(){return _0x51251b(null,![],{'message':_0xe48c('0x12')});});}else{return utils[_0xe48c('0x17')](_0x59e54a,_0x5201c8,![],null)[_0xe48c('0x13')](function(){return _0x51251b(null,![],{'message':_0xe48c('0x12')});});}}}else{return _0x51251b(null,![],{'message':_0xe48c('0x12')});}}else{if(_0x59e54a[_0xe48c('0xd')]){return _0x51251b(null,![],{'message':_0xe48c('0x12')});}else if(_0x5e2196[_0xe48c('0x9')]>0x0){if(_0x59e54a[_0xe48c('0xe')]){if(_0x5e2196[_0xe48c('0x18')]>0x0){if(moment(_0x59e54a[_0xe48c('0x19')])[_0xe48c('0x15')](_0x5e2196['blockDuration'],'minutes')>moment()){return _0x51251b(null,![],{'message':_0xe48c('0x12')});}else{return utils['clearBlockUser'](_0x59e54a,0x0,![],null)[_0xe48c('0x13')](function(){return utils[_0xe48c('0x1a')](_0x59e54a);})['then'](function(){return _0x51251b(null,_0x59e54a);});}}else{return _0x51251b(null,![],{'message':_0xe48c('0x12')});}}else{return utils['clearBlockUser'](_0x59e54a,0x0,![],null)[_0xe48c('0x13')](function(){return utils[_0xe48c('0x1a')](_0x59e54a);})[_0xe48c('0x13')](function(){return _0x51251b(null,_0x59e54a);})['catch'](function(_0x1d5f59){return _0x51251b(null,![],_0x1d5f59);});}}else{if(_0x59e54a[_0xe48c('0xe')]){return _0x51251b(null,![],{'message':_0xe48c('0x12')});}else{return utils['getLicense'](_0x59e54a)[_0xe48c('0x13')](function(){return _0x51251b(null,_0x59e54a);});}}}});})[_0xe48c('0x1b')](function(_0x224e7f){return _0x51251b(null,![],_0x224e7f);});}function sendServiceMail(_0x1d7221){return db['MailAccount'][_0xe48c('0x1c')]({'where':{'service':!![]},'attributes':['id',_0xe48c('0xa'),'email'],'include':[{'model':db[_0xe48c('0x1d')],'as':_0xe48c('0x1e')}]})[_0xe48c('0x13')](function(_0x43596d){if(!_0x43596d){throw new Error(_0xe48c('0x1f'));}var _0x54094d={'tls':{'rejectUnauthorized':![]}};if(_0x43596d[_0xe48c('0x1e')][_0xe48c('0x20')]){_0x54094d['service']=_0x43596d['Smtp'][_0xe48c('0x20')];}else{_0x54094d[_0xe48c('0x21')]=_0x43596d[_0xe48c('0x1e')][_0xe48c('0x21')];_0x54094d[_0xe48c('0x22')]=_0x43596d[_0xe48c('0x1e')][_0xe48c('0x22')];_0x54094d['secure']=_0x43596d[_0xe48c('0x1e')][_0xe48c('0x23')];}if(_0x43596d['Smtp']['authentication']){_0x54094d[_0xe48c('0x24')]={'user':_0x43596d[_0xe48c('0x1e')][_0xe48c('0x10')],'pass':_0x43596d[_0xe48c('0x1e')][_0xe48c('0x25')]};}var _0x531a6f={'account':_0x54094d,'message':_[_0xe48c('0x26')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x43596d['name'],_0x43596d[_0xe48c('0x27')]||_0x43596d[_0xe48c('0x1e')][_0xe48c('0x10')])},_0x1d7221)};return client[_0xe48c('0x28')](_0xe48c('0x29'),_0x531a6f);})[_0xe48c('0x13')](function(_0x3cebff){if(_0x3cebff['error']){throw new Error(util[_0xe48c('0x2a')](_0xe48c('0x2b'),_0x3cebff[_0xe48c('0x2c')]['message']||JSON[_0xe48c('0x2d')](_0x3cebff[_0xe48c('0x2c')])));}return!![];});}function handleError(_0x386ba4,_0x3de8bd,_0x5ac21d){return _0x386ba4[_0xe48c('0x2e')](_0x3de8bd||0x1f4)[_0xe48c('0x2f')]({'message':_0x5ac21d?_0x5ac21d['message']||_0x5ac21d:''});}function checkPasswordPattern(_0x7688a1,_0x1299c3,_0x5dfb35){if(_0x5dfb35){var _0x301499=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x301499[_0xe48c('0x30')](_0x1299c3)){return _0x7688a1;}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 _0x7688a1;}}exports['login']=function(_0x44795f,_0x2891a9,_0x4cd52e){passport[_0xe48c('0x14')]('local',function(_0x5a99cf,_0x326a00,_0x3a37ab){var _0x38aee2=_0x5a99cf||_0x3a37ab;if(_0x38aee2){return handleError(_0x2891a9,0x191,_0x38aee2);}if(!_0x326a00){return handleError(_0x2891a9,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x5e86ae={'payload':{'id':_0x326a00['id'],'role':_0x326a00[_0xe48c('0xc')]},'options':{'expiresIn':0x15180}};return authService[_0xe48c('0x31')](_0x5e86ae)[_0xe48c('0x13')](function(_0x27323c){_0x2891a9[_0xe48c('0x32')]({'id':_0x326a00['id'],'token':_0x27323c,'statusCall':'','isAlreadyLogged':_0x326a00[_0xe48c('0x33')]});});}})(_0x44795f,_0x2891a9,_0x4cd52e);};exports['forgot']=function(_0xa5e10c,_0x3c7c04,_0x13ab8e){if(!_0xa5e10c[_0xe48c('0x34')]['email']){return handleError(_0x3c7c04,0x1f4,{'message':_0xe48c('0x35')});}var _0x253660=rs[_0xe48c('0x36')]();_0xa5e10c['body'][_0xe48c('0x27')]=_0xa5e10c[_0xe48c('0x34')][_0xe48c('0x27')][_0xe48c('0x37')]()[_0xe48c('0x38')]();var _0x45f7a4;return db[_0xe48c('0x7')][_0xe48c('0x8')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0xe48c('0x13')](function(_0x2eb065){_0x45f7a4=_0x2eb065;return db[_0xe48c('0x39')][_0xe48c('0x1c')]({'where':{'email':_0xa5e10c[_0xe48c('0x34')][_0xe48c('0x27')]}});})[_0xe48c('0x13')](function(_0x3bd82e){if(!_0x3bd82e){throw new Error(_0xe48c('0x3a'));}if(_0x3bd82e[_0xe48c('0xd')]){throw new Error(_0xe48c('0x3b'));}if(_0x3bd82e[_0xe48c('0xe')]){if(moment(_0x3bd82e[_0xe48c('0x19')])[_0xe48c('0x15')](_0x45f7a4['blockDuration'],'minutes')>moment()){throw new Error(_0xe48c('0x3c'));}else{_0x3bd82e[_0xe48c('0xe')]=![];_0x3bd82e['blockedAt']=null;}}_0x3bd82e[_0xe48c('0x3d')]=_0x253660;_0x3bd82e[_0xe48c('0x3e')]=Date[_0xe48c('0x3f')]()+0x36ee80;return _0x3bd82e['save']();})[_0xe48c('0x13')](function(){return sendServiceMail({'to':_0xa5e10c[_0xe48c('0x34')][_0xe48c('0x27')],'subject':_0xe48c('0x40'),'text':_0xe48c('0x41')+_0xe48c('0x42')+_0xe48c('0x43')+_0xa5e10c[_0xe48c('0x44')][_0xe48c('0x21')]+'/reset/'+_0x253660+'\x0a\x0a'+_0xe48c('0x45')});})[_0xe48c('0x13')](function(){_0x3c7c04[_0xe48c('0x2e')](0xc8)[_0xe48c('0x2f')]({'message':'Reset\x20Email\x20sent!'});})[_0xe48c('0x1b')](function(_0x4cf323){return handleError(_0x3c7c04,0x1f4,_0x4cf323);});};exports[_0xe48c('0x46')]=function(_0x5050da,_0x540324,_0x3c5e69){var _0x258402;return db[_0xe48c('0x39')]['find']({'where':{'resetPasswordToken':_0x5050da[_0xe48c('0x47')]['token'],'resetPasswordExpires':{'$gt':Date[_0xe48c('0x3f')]()}}})[_0xe48c('0x13')](function(_0x35186d){_0x258402=_0x35186d;if(!_0x258402){throw new Error(_0xe48c('0x48'));}return db[_0xe48c('0x7')][_0xe48c('0x8')]({'attributes':['id',_0xe48c('0x49')]});})[_0xe48c('0x13')](function(_0x2553f2){return checkPasswordPattern(_0x2553f2,_0x5050da[_0xe48c('0x34')][_0xe48c('0x4a')],_0x2553f2[_0xe48c('0x49')]);})[_0xe48c('0x13')](function(){_0x258402['password']=_0x5050da[_0xe48c('0x34')][_0xe48c('0x4a')];_0x258402[_0xe48c('0x3d')]=null;_0x258402[_0xe48c('0x3e')]=null;return _0x258402[_0xe48c('0x4b')]();})[_0xe48c('0x13')](function(){_0x540324[_0xe48c('0x2e')](0xc8)['send']({'message':_0xe48c('0x4c')});})[_0xe48c('0x1b')](function(_0x2e4b2b){return handleError(_0x540324,0x1f4,_0x2e4b2b);});};passport[_0xe48c('0x4d')](new LocalStrategy({'usernameField':_0xe48c('0xa'),'passwordField':_0xe48c('0x4a')},function(_0x4646c4,_0x1ca6cf,_0x2f5977){return localAuthenticate(db[_0xe48c('0x39')],_0x4646c4,_0x1ca6cf,_0x2f5977);})); \ No newline at end of file +var _0x2635=['../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','loginAttempts','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockedAt','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','\x22%s\x22\x20<%s>','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','test','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','findOne','securePassword','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x2635,0x148));var _0x5263=function(_0x1bb88,_0x2512bc){_0x1bb88=_0x1bb88-0x0;var _0x260c20=_0x2635[_0x1bb88];return _0x260c20;};'use strict';var util=require(_0x5263('0x0'));var passport=require(_0x5263('0x1'));var LocalStrategy=require(_0x5263('0x2'))[_0x5263('0x3')];var jayson=require(_0x5263('0x4'));var _=require(_0x5263('0x5'));var rs=require(_0x5263('0x6'));var moment=require(_0x5263('0x7'));var db=require(_0x5263('0x8'))['db'];var authService=require(_0x5263('0x9'));var utils=require(_0x5263('0xa'));var client=jayson[_0x5263('0xb')][_0x5263('0xc')]({'port':0x232b});function localAuthenticate(_0x2edd24,_0x789367,_0x2870b1,_0x223325){var _0x264c23,_0x3335db;return db[_0x5263('0xd')]['findOne']({'where':{'id':0x1},'attributes':[_0x5263('0xe'),_0x5263('0xf')],'raw':!![]})[_0x5263('0x10')](function(_0x353b84){_0x264c23=_0x353b84;return _0x2edd24['findOne']({'attributes':['id',_0x5263('0x11'),_0x5263('0x12'),_0x5263('0x13'),_0x5263('0x14'),_0x5263('0x15'),_0x5263('0x16'),'blockedAt',_0x5263('0x17')],'where':{'name':_0x789367,'role':{'$or':['admin',_0x5263('0x18'),'agent']}}});})['then'](function(_0x5df9bc){if(!_0x5df9bc||_0x5df9bc&&_0x5df9bc[_0x5263('0x11')]!==_0x789367){throw new Error(_0x5263('0x19'));}else{_0x3335db=_0x5df9bc;return _0x3335db;}})[_0x5263('0x10')](function(){_0x3335db[_0x5263('0x1a')](_0x2870b1,function(_0x1090f8,_0x3f2e33){var _0x15d7aa=_0x3335db[_0x5263('0x17')]+0x1;if(_0x1090f8){return _0x223325(_0x1090f8);}else if(!_0x3f2e33){if(_0x3335db[_0x5263('0x15')]){return _0x223325(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x264c23['allowedLoginAttempts']>0x0){if(_0x3335db[_0x5263('0x16')]){if(_0x264c23[_0x5263('0xf')]>0x0){if(moment(_0x3335db[_0x5263('0x1b')])[_0x5263('0x1c')](_0x264c23[_0x5263('0xf')],_0x5263('0x1d'))>moment()){return _0x223325(null,![],{'message':_0x5263('0x19')});}else{return utils['clearBlockUser'](_0x3335db,_0x15d7aa,![],null)[_0x5263('0x10')](function(){return _0x223325(null,![],{'message':_0x5263('0x19')});});}}else{return _0x223325(null,![],{'message':_0x5263('0x19')});}}else{if(_0x15d7aa>=_0x264c23[_0x5263('0xe')]){return utils[_0x5263('0x1e')](_0x3335db,0x0,!![],moment())['then'](function(){return _0x223325(null,![],{'message':_0x5263('0x19')});});}else{return utils[_0x5263('0x1e')](_0x3335db,_0x15d7aa,![],null)['then'](function(){return _0x223325(null,![],{'message':_0x5263('0x19')});});}}}else{return _0x223325(null,![],{'message':_0x5263('0x19')});}}else{if(_0x3335db['disabled']){return _0x223325(null,![],{'message':_0x5263('0x19')});}else if(_0x264c23['allowedLoginAttempts']>0x0){if(_0x3335db[_0x5263('0x16')]){if(_0x264c23[_0x5263('0xf')]>0x0){if(moment(_0x3335db['blockedAt'])[_0x5263('0x1c')](_0x264c23[_0x5263('0xf')],'minutes')>moment()){return _0x223325(null,![],{'message':_0x5263('0x19')});}else{return utils[_0x5263('0x1e')](_0x3335db,0x0,![],null)[_0x5263('0x10')](function(){return utils[_0x5263('0x1f')](_0x3335db);})['then'](function(){return _0x223325(null,_0x3335db);});}}else{return _0x223325(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x5263('0x1e')](_0x3335db,0x0,![],null)[_0x5263('0x10')](function(){return utils['getLicense'](_0x3335db);})[_0x5263('0x10')](function(){return _0x223325(null,_0x3335db);})['catch'](function(_0x48aaf0){return _0x223325(null,![],_0x48aaf0);});}}else{if(_0x3335db['blocked']){return _0x223325(null,![],{'message':_0x5263('0x19')});}else{return utils[_0x5263('0x1f')](_0x3335db)[_0x5263('0x10')](function(){return _0x223325(null,_0x3335db);});}}}});})[_0x5263('0x20')](function(_0x4fdd9e){return _0x223325(null,![],_0x4fdd9e);});}function sendServiceMail(_0x4bfd22){return db[_0x5263('0x21')][_0x5263('0x22')]({'where':{'service':!![]},'attributes':['id','name',_0x5263('0x23')],'include':[{'model':db['MailServerOut'],'as':_0x5263('0x24')}]})[_0x5263('0x10')](function(_0x1e8322){if(!_0x1e8322){throw new Error(_0x5263('0x25'));}var _0xb4e455={'tls':{'rejectUnauthorized':![]}};if(_0x1e8322['Smtp']['service']){_0xb4e455[_0x5263('0x26')]=_0x1e8322[_0x5263('0x24')]['service'];}else{_0xb4e455[_0x5263('0x27')]=_0x1e8322[_0x5263('0x24')]['host'];_0xb4e455[_0x5263('0x28')]=_0x1e8322[_0x5263('0x24')][_0x5263('0x28')];_0xb4e455[_0x5263('0x29')]=_0x1e8322[_0x5263('0x24')]['secure'];}if(_0x1e8322[_0x5263('0x24')][_0x5263('0x2a')]){_0xb4e455[_0x5263('0x2b')]={'user':_0x1e8322[_0x5263('0x24')][_0x5263('0x18')],'pass':_0x1e8322[_0x5263('0x24')][_0x5263('0x2c')]};}var _0x15460c={'account':_0xb4e455,'message':_[_0x5263('0x2d')]({'from':util['format'](_0x5263('0x2e'),_0x1e8322['name'],_0x1e8322['email']||_0x1e8322[_0x5263('0x24')][_0x5263('0x18')])},_0x4bfd22)};return client[_0x5263('0x2f')](_0x5263('0x30'),_0x15460c);})['then'](function(_0x57a473){if(_0x57a473[_0x5263('0x31')]){throw new Error(util[_0x5263('0x32')](_0x5263('0x33'),_0x57a473['error'][_0x5263('0x34')]||JSON['stringify'](_0x57a473['error'])));}return!![];});}function handleError(_0x552671,_0x4139b1,_0x3599d6){return _0x552671[_0x5263('0x35')](_0x4139b1||0x1f4)[_0x5263('0x36')]({'message':_0x3599d6?_0x3599d6[_0x5263('0x34')]||_0x3599d6:''});}function checkPasswordPattern(_0x203c99,_0x716548,_0x590ab8){if(_0x590ab8){var _0x4f7270=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4f7270[_0x5263('0x37')](_0x716548)){return _0x203c99;}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 _0x203c99;}}exports[_0x5263('0x38')]=function(_0x50d4c5,_0x39dc2f,_0x1bb9a5){passport[_0x5263('0x1a')](_0x5263('0x39'),function(_0x16437e,_0x4b7632,_0x30bb49){var _0x3941f9=_0x16437e||_0x30bb49;if(_0x3941f9){return handleError(_0x39dc2f,0x191,_0x3941f9);}if(!_0x4b7632){return handleError(_0x39dc2f,0x194,{'message':_0x5263('0x3a')});}else{var _0x227022={'payload':{'id':_0x4b7632['id'],'role':_0x4b7632[_0x5263('0x14')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x227022)[_0x5263('0x10')](function(_0x5b4b1f){_0x39dc2f[_0x5263('0x3b')]({'id':_0x4b7632['id'],'token':_0x5b4b1f,'statusCall':'','isAlreadyLogged':_0x4b7632['online']});});}})(_0x50d4c5,_0x39dc2f,_0x1bb9a5);};exports[_0x5263('0x3c')]=function(_0x435b1f,_0x483dec,_0x51943a){if(!_0x435b1f[_0x5263('0x3d')][_0x5263('0x23')]){return handleError(_0x483dec,0x1f4,{'message':_0x5263('0x3e')});}var _0x522278=rs[_0x5263('0x3f')]();_0x435b1f[_0x5263('0x3d')][_0x5263('0x23')]=_0x435b1f[_0x5263('0x3d')][_0x5263('0x23')][_0x5263('0x40')]()[_0x5263('0x41')]();var _0x24c7e2;return db[_0x5263('0xd')]['findOne']({'where':{'id':0x1},'attributes':[_0x5263('0xe'),_0x5263('0xf')],'raw':!![]})[_0x5263('0x10')](function(_0x58db13){_0x24c7e2=_0x58db13;return db['User'][_0x5263('0x22')]({'where':{'email':_0x435b1f['body']['email']}});})[_0x5263('0x10')](function(_0x3d8668){if(!_0x3d8668){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x3d8668[_0x5263('0x15')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x3d8668[_0x5263('0x16')]){if(moment(_0x3d8668[_0x5263('0x1b')])['add'](_0x24c7e2[_0x5263('0xf')],_0x5263('0x1d'))>moment()){throw new Error(_0x5263('0x42'));}else{_0x3d8668[_0x5263('0x16')]=![];_0x3d8668[_0x5263('0x1b')]=null;}}_0x3d8668[_0x5263('0x43')]=_0x522278;_0x3d8668[_0x5263('0x44')]=Date[_0x5263('0x45')]()+0x36ee80;return _0x3d8668[_0x5263('0x46')]();})[_0x5263('0x10')](function(){return sendServiceMail({'to':_0x435b1f[_0x5263('0x3d')][_0x5263('0x23')],'subject':_0x5263('0x47'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x5263('0x48')+_0x5263('0x49')+_0x435b1f[_0x5263('0x4a')][_0x5263('0x27')]+'/reset/'+_0x522278+'\x0a\x0a'+_0x5263('0x4b')});})['then'](function(){_0x483dec[_0x5263('0x35')](0xc8)['send']({'message':_0x5263('0x4c')});})[_0x5263('0x20')](function(_0x29a44a){return handleError(_0x483dec,0x1f4,_0x29a44a);});};exports[_0x5263('0x4d')]=function(_0xe91acd,_0xbeda73,_0x44078b){var _0x4f716a;return db[_0x5263('0x4e')][_0x5263('0x22')]({'where':{'resetPasswordToken':_0xe91acd['params']['token'],'resetPasswordExpires':{'$gt':Date[_0x5263('0x45')]()}}})[_0x5263('0x10')](function(_0x3a7df4){_0x4f716a=_0x3a7df4;if(!_0x4f716a){throw new Error(_0x5263('0x4f'));}return db['Setting'][_0x5263('0x50')]({'attributes':['id',_0x5263('0x51')]});})[_0x5263('0x10')](function(_0x5ad074){return checkPasswordPattern(_0x5ad074,_0xe91acd['body'][_0x5263('0x12')],_0x5ad074[_0x5263('0x51')]);})['then'](function(){_0x4f716a['password']=_0xe91acd[_0x5263('0x3d')]['password'];_0x4f716a[_0x5263('0x43')]=null;_0x4f716a[_0x5263('0x44')]=null;return _0x4f716a[_0x5263('0x46')]();})['then'](function(){_0xbeda73['status'](0xc8)['send']({'message':_0x5263('0x52')});})[_0x5263('0x20')](function(_0x2f7504){return handleError(_0xbeda73,0x1f4,_0x2f7504);});};passport[_0x5263('0x53')](new LocalStrategy({'usernameField':_0x5263('0x11'),'passwordField':_0x5263('0x12')},function(_0x152e87,_0x7e3aae,_0x32eca8){return localAuthenticate(db[_0x5263('0x4e')],_0x152e87,_0x7e3aae,_0x32eca8);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index fb39f0c..66a8196 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 _0xeb32=['forgot','/reset/:token','reset','Router','./authLocal.controller','login','post','/forgot'];(function(_0x514260,_0x1891e1){var _0x4ac81b=function(_0x53cab1){while(--_0x53cab1){_0x514260['push'](_0x514260['shift']());}};_0x4ac81b(++_0x1891e1);}(_0xeb32,0x6b));var _0x2eb3=function(_0x46107f,_0x4bb4e0){_0x46107f=_0x46107f-0x0;var _0x43504a=_0xeb32[_0x46107f];return _0x43504a;};'use strict';var express=require('express');var router=express[_0x2eb3('0x0')]();var controller=require(_0x2eb3('0x1'));router['post']('/',controller[_0x2eb3('0x2')]);router[_0x2eb3('0x3')](_0x2eb3('0x4'),controller[_0x2eb3('0x5')]);router[_0x2eb3('0x3')](_0x2eb3('0x6'),controller[_0x2eb3('0x7')]);module['exports']=router; \ No newline at end of file +var _0xf0f7=['express','Router','post','/forgot','forgot','/reset/:token','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf0f7,0xb6));var _0x7f0f=function(_0x5dc789,_0x16991b){_0x5dc789=_0x5dc789-0x0;var _0x4ea114=_0xf0f7[_0x5dc789];return _0x4ea114;};'use strict';var express=require(_0x7f0f('0x0'));var router=express[_0x7f0f('0x1')]();var controller=require('./authLocal.controller');router[_0x7f0f('0x2')]('/',controller['login']);router[_0x7f0f('0x2')](_0x7f0f('0x3'),controller[_0x7f0f('0x4')]);router[_0x7f0f('0x2')](_0x7f0f('0x5'),controller['reset']);module[_0x7f0f('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index c2d4417..da656ea 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 _0x661e=['STRING','INTEGER','sequelize'];(function(_0x346bbd,_0x5d273a){var _0xb18ab9=function(_0x16357e){while(--_0x16357e){_0x346bbd['push'](_0x346bbd['shift']());}};_0xb18ab9(++_0x5d273a);}(_0x661e,0x1c1));var _0xe661=function(_0xc45fad,_0x36eac2){_0xc45fad=_0xc45fad-0x0;var _0x18170d=_0x661e[_0xc45fad];return _0x18170d;};'use strict';var Sequelize=require(_0xe661('0x0'));module['exports']={'name':{'type':Sequelize[_0xe661('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xe661('0x1')]},'description':{'type':Sequelize[_0xe661('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xe661('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x0c78=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x3a6670,_0x7dcb45){var _0x1811a5=function(_0x487dfa){while(--_0x487dfa){_0x3a6670['push'](_0x3a6670['shift']());}};_0x1811a5(++_0x7dcb45);}(_0x0c78,0x1ac));var _0x80c7=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x0c78[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require(_0x80c7('0x0'));module[_0x80c7('0x1')]={'name':{'type':Sequelize[_0x80c7('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x80c7('0x2')]},'status':{'type':Sequelize[_0x80c7('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x80c7('0x4')],'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 fd14f21..6f98f05 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 _0xd91c=['intersection','model','fields','attributes','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','options','Automation','includeAll','include','findAll','catch','show','params','keys','length','create','body','find','addConditions','Condition','ids','getConditions','findOne','order','pick','nolimit','addActions','Action','omit','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','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','index','map','rawAttributes','fieldName','type','key','name','query'];(function(_0x22712a,_0x1d70f7){var _0x37baff=function(_0x2f9036){while(--_0x2f9036){_0x22712a['push'](_0x22712a['shift']());}};_0x37baff(++_0x1d70f7);}(_0xd91c,0x174));var _0xcd91=function(_0x58ac20,_0x5698c2){_0x58ac20=_0x58ac20-0x0;var _0x58fa57=_0xd91c[_0x58ac20];return _0x58fa57;};'use strict';var pdf=require(_0xcd91('0x0'));var emlformat=require(_0xcd91('0x1'));var rimraf=require(_0xcd91('0x2'));var zipdir=require(_0xcd91('0x3'));var jsonpatch=require(_0xcd91('0x4'));var rp=require(_0xcd91('0x5'));var moment=require(_0xcd91('0x6'));var BPromise=require(_0xcd91('0x7'));var Mustache=require(_0xcd91('0x8'));var util=require('util');var path=require(_0xcd91('0x9'));var sox=require(_0xcd91('0xa'));var csv=require(_0xcd91('0xb'));var ejs=require(_0xcd91('0xc'));var fs=require('fs');var _=require(_0xcd91('0xd'));var squel=require(_0xcd91('0xe'));var crypto=require(_0xcd91('0xf'));var jsforce=require(_0xcd91('0x10'));var deskjs=require(_0xcd91('0x11'));var toCsv=require('to-csv');var querystring=require(_0xcd91('0x12'));var Papa=require('papaparse');var Redis=require(_0xcd91('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xcd91('0x14'));var as=require(_0xcd91('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd91('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xcd91('0x17'));var db=require(_0xcd91('0x18'))['db'];function respondWithStatusCode(_0x2b3e67,_0x20d996){_0x20d996=_0x20d996||0xcc;return function(_0x7c83fa){if(_0x7c83fa){return _0x2b3e67['sendStatus'](_0x20d996);}return _0x2b3e67[_0xcd91('0x19')](_0x20d996)[_0xcd91('0x1a')]();};}function respondWithResult(_0x599a99,_0x30d9f5){_0x30d9f5=_0x30d9f5||0xc8;return function(_0x5b07eb){if(_0x5b07eb){return _0x599a99['status'](_0x30d9f5)[_0xcd91('0x1b')](_0x5b07eb);}};}function respondWithFilteredResult(_0x5643c0,_0x50ac77){return function(_0x64ab5e){if(_0x64ab5e){var _0x155fea=_0x64ab5e[_0xcd91('0x1c')],_0x59acd2=_0x50ac77[_0xcd91('0x1d')],_0x504c08=_0x50ac77[_0xcd91('0x1d')]+_0x50ac77[_0xcd91('0x1e')],_0x2e6bd1;if(_0x504c08>=_0x155fea){_0x504c08=_0x155fea;_0x2e6bd1=0xc8;}else{_0x2e6bd1=0xce;}_0x5643c0[_0xcd91('0x19')](_0x2e6bd1);return _0x5643c0[_0xcd91('0x1f')](_0xcd91('0x20'),_0x59acd2+'-'+_0x504c08+'/'+_0x155fea)[_0xcd91('0x1b')](_0x64ab5e);}return null;};}function patchUpdates(_0x19375f){return function(_0x63b6f5){try{jsonpatch['apply'](_0x63b6f5,_0x19375f,!![]);}catch(_0x2a6e11){return BPromise[_0xcd91('0x21')](_0x2a6e11);}return _0x63b6f5[_0xcd91('0x22')]();};}function saveUpdates(_0x1bb751,_0x2c5beb){return function(_0xf0af4c){if(_0xf0af4c){return _0xf0af4c[_0xcd91('0x23')](_0x1bb751)[_0xcd91('0x24')](function(_0x21b2a3){return _0x21b2a3;});}return null;};}function removeEntity(_0x3d61ff,_0x497aba){return function(_0x41ccfd){if(_0x41ccfd){return _0x41ccfd[_0xcd91('0x25')]()[_0xcd91('0x24')](function(){_0x3d61ff[_0xcd91('0x19')](0xcc)[_0xcd91('0x1a')]();});}};}function handleEntityNotFound(_0x146839,_0x576b30){return function(_0x2992bb){if(!_0x2992bb){_0x146839[_0xcd91('0x26')](0x194);}return _0x2992bb;};}function handleError(_0x559eee,_0x4adb6c){_0x4adb6c=_0x4adb6c||0x1f4;return function(_0x667f6a){logger['error'](_0x667f6a[_0xcd91('0x27')]);if(_0x667f6a['name']){delete _0x667f6a['name'];}_0x559eee['status'](_0x4adb6c)['send'](_0x667f6a);};}exports[_0xcd91('0x28')]=function(_0x17cde0,_0xc78be){var _0x4c2011={},_0x5593df={},_0x19cda6={'count':0x0,'rows':[]};var _0x171b1b=_[_0xcd91('0x29')](db['Automation'][_0xcd91('0x2a')],function(_0x8b399){return{'name':_0x8b399[_0xcd91('0x2b')],'type':_0x8b399[_0xcd91('0x2c')][_0xcd91('0x2d')]};});_0x5593df['model']=_['map'](_0x171b1b,_0xcd91('0x2e'));_0x5593df[_0xcd91('0x2f')]=_['keys'](_0x17cde0[_0xcd91('0x2f')]);_0x5593df['filters']=_[_0xcd91('0x30')](_0x5593df[_0xcd91('0x31')],_0x5593df[_0xcd91('0x2f')]);_0x4c2011['attributes']=_['intersection'](_0x5593df[_0xcd91('0x31')],qs[_0xcd91('0x32')](_0x17cde0[_0xcd91('0x2f')]['fields']));_0x4c2011[_0xcd91('0x33')]=_0x4c2011[_0xcd91('0x33')]['length']?_0x4c2011[_0xcd91('0x33')]:_0x5593df[_0xcd91('0x31')];if(!_0x17cde0[_0xcd91('0x2f')][_0xcd91('0x34')]('nolimit')){_0x4c2011['limit']=qs[_0xcd91('0x1e')](_0x17cde0['query'][_0xcd91('0x1e')]);_0x4c2011[_0xcd91('0x1d')]=qs[_0xcd91('0x1d')](_0x17cde0[_0xcd91('0x2f')][_0xcd91('0x1d')]);}_0x4c2011['order']=qs[_0xcd91('0x35')](_0x17cde0[_0xcd91('0x2f')][_0xcd91('0x35')]);_0x4c2011[_0xcd91('0x36')]=qs[_0xcd91('0x37')](_['pick'](_0x17cde0[_0xcd91('0x2f')],_0x5593df['filters']));if(_0x17cde0[_0xcd91('0x2f')][_0xcd91('0x38')]){_0x4c2011[_0xcd91('0x36')]=_[_0xcd91('0x39')](_0x4c2011['where'],{'$or':_[_0xcd91('0x29')](_0x171b1b,function(_0x15ab4e){if(_0x15ab4e[_0xcd91('0x2c')]!==_0xcd91('0x3a')){var _0x18f90e={};_0x18f90e[_0x15ab4e[_0xcd91('0x2e')]]={'$like':'%'+_0x17cde0['query'][_0xcd91('0x38')]+'%'};return _0x18f90e;}})});}_0x4c2011=_[_0xcd91('0x39')]({},_0x4c2011,_0x17cde0[_0xcd91('0x3b')]);var _0x2572f8={'where':_0x4c2011[_0xcd91('0x36')]};return db[_0xcd91('0x3c')][_0xcd91('0x1c')](_0x2572f8)[_0xcd91('0x24')](function(_0x410652){_0x19cda6[_0xcd91('0x1c')]=_0x410652;if(_0x17cde0[_0xcd91('0x2f')][_0xcd91('0x3d')]){_0x4c2011[_0xcd91('0x3e')]=[{'all':!![]}];}return db[_0xcd91('0x3c')][_0xcd91('0x3f')](_0x4c2011);})['then'](function(_0x5f1e70){_0x19cda6['rows']=_0x5f1e70;return _0x19cda6;})['then'](respondWithFilteredResult(_0xc78be,_0x4c2011))[_0xcd91('0x40')](handleError(_0xc78be,null));};exports[_0xcd91('0x41')]=function(_0x389ad5,_0x2db871){var _0x2a3404={'raw':![],'where':{'id':_0x389ad5[_0xcd91('0x42')]['id']}},_0x44cf7b={};_0x44cf7b[_0xcd91('0x31')]=_[_0xcd91('0x43')](db[_0xcd91('0x3c')][_0xcd91('0x2a')]);_0x44cf7b['query']=_[_0xcd91('0x43')](_0x389ad5[_0xcd91('0x2f')]);_0x44cf7b[_0xcd91('0x37')]=_['intersection'](_0x44cf7b[_0xcd91('0x31')],_0x44cf7b['query']);_0x2a3404[_0xcd91('0x33')]=_[_0xcd91('0x30')](_0x44cf7b[_0xcd91('0x31')],qs[_0xcd91('0x32')](_0x389ad5[_0xcd91('0x2f')][_0xcd91('0x32')]));_0x2a3404[_0xcd91('0x33')]=_0x2a3404[_0xcd91('0x33')][_0xcd91('0x44')]?_0x2a3404['attributes']:_0x44cf7b[_0xcd91('0x31')];if(_0x389ad5[_0xcd91('0x2f')][_0xcd91('0x3d')]){_0x2a3404[_0xcd91('0x3e')]=[{'all':!![]}];}_0x2a3404=_['merge']({},_0x2a3404,_0x389ad5[_0xcd91('0x3b')]);return db[_0xcd91('0x3c')]['find'](_0x2a3404)['then'](handleEntityNotFound(_0x2db871,null))['then'](respondWithResult(_0x2db871,null))['catch'](handleError(_0x2db871,null));};exports[_0xcd91('0x45')]=function(_0x4ccac1,_0x59ba8f){return db['Automation'][_0xcd91('0x45')](_0x4ccac1[_0xcd91('0x46')],{})[_0xcd91('0x24')](respondWithResult(_0x59ba8f,0xc9))[_0xcd91('0x40')](handleError(_0x59ba8f,null));};exports[_0xcd91('0x23')]=function(_0x2c4928,_0x2bf2e8){if(_0x2c4928[_0xcd91('0x46')]['id']){delete _0x2c4928[_0xcd91('0x46')]['id'];}return db['Automation'][_0xcd91('0x47')]({'where':{'id':_0x2c4928[_0xcd91('0x42')]['id']}})[_0xcd91('0x24')](handleEntityNotFound(_0x2bf2e8,null))[_0xcd91('0x24')](saveUpdates(_0x2c4928['body'],null))[_0xcd91('0x24')](respondWithResult(_0x2bf2e8,null))[_0xcd91('0x40')](handleError(_0x2bf2e8,null));};exports['destroy']=function(_0x39ee00,_0x49812a){return db[_0xcd91('0x3c')]['find']({'where':{'id':_0x39ee00[_0xcd91('0x42')]['id']}})[_0xcd91('0x24')](handleEntityNotFound(_0x49812a,null))['then'](removeEntity(_0x49812a,null))[_0xcd91('0x40')](handleError(_0x49812a,null));};exports[_0xcd91('0x48')]=function(_0x22e543,_0x4b0f70,_0x33ab7c){return db[_0xcd91('0x49')]['find']({'where':{'id':_0x22e543[_0xcd91('0x42')]['id']}})[_0xcd91('0x24')](handleEntityNotFound(_0x4b0f70,null))[_0xcd91('0x24')](function(_0x5f3fe4){if(_0x5f3fe4){return _0x5f3fe4[_0xcd91('0x48')](_0x22e543['body']['ids'],_['omit'](_0x22e543[_0xcd91('0x46')],[_0xcd91('0x4a'),'id'])||{});}})[_0xcd91('0x24')](respondWithResult(_0x4b0f70,null))[_0xcd91('0x40')](handleError(_0x4b0f70,null));};exports[_0xcd91('0x4b')]=function(_0x5e6cec,_0x40aec0,_0x1d2c91){var _0x9805b={};var _0x31043b={};var _0x42924d;var _0x2dfc43;return db[_0xcd91('0x3c')][_0xcd91('0x4c')]({'where':{'id':_0x5e6cec[_0xcd91('0x42')]['id']}})[_0xcd91('0x24')](handleEntityNotFound(_0x40aec0,null))[_0xcd91('0x24')](function(_0x49720f){if(_0x49720f){_0x42924d=_0x49720f;_0x31043b[_0xcd91('0x31')]=_['keys'](db['Condition'][_0xcd91('0x2a')]);_0x31043b[_0xcd91('0x2f')]=_[_0xcd91('0x43')](_0x5e6cec[_0xcd91('0x2f')]);_0x31043b[_0xcd91('0x37')]=_[_0xcd91('0x30')](_0x31043b[_0xcd91('0x31')],_0x31043b['query']);_0x9805b['attributes']=_[_0xcd91('0x30')](_0x31043b[_0xcd91('0x31')],qs['fields'](_0x5e6cec[_0xcd91('0x2f')][_0xcd91('0x32')]));_0x9805b[_0xcd91('0x33')]=_0x9805b['attributes']['length']?_0x9805b[_0xcd91('0x33')]:_0x31043b[_0xcd91('0x31')];_0x9805b[_0xcd91('0x4d')]=qs[_0xcd91('0x35')](_0x5e6cec[_0xcd91('0x2f')][_0xcd91('0x35')]);_0x9805b[_0xcd91('0x36')]=qs['filters'](_[_0xcd91('0x4e')](_0x5e6cec[_0xcd91('0x2f')],_0x31043b['filters']));if(_0x5e6cec['query'][_0xcd91('0x38')]){_0x9805b['where']=_['merge'](_0x9805b[_0xcd91('0x36')],{'$or':_['map'](_0x9805b['attributes'],function(_0x55a0c0){var _0x5f3c81={};_0x5f3c81[_0x55a0c0]={'$like':'%'+_0x5e6cec[_0xcd91('0x2f')][_0xcd91('0x38')]+'%'};return _0x5f3c81;})});}_0x9805b=_[_0xcd91('0x39')]({},_0x9805b,_0x5e6cec[_0xcd91('0x3b')]);return _0x42924d[_0xcd91('0x4b')](_0x9805b);}})[_0xcd91('0x24')](function(_0x4dc49f){if(_0x4dc49f){_0x2dfc43=_0x4dc49f[_0xcd91('0x44')];if(!_0x5e6cec[_0xcd91('0x2f')][_0xcd91('0x34')](_0xcd91('0x4f'))){_0x9805b[_0xcd91('0x1e')]=qs['limit'](_0x5e6cec[_0xcd91('0x2f')][_0xcd91('0x1e')]);_0x9805b['offset']=qs[_0xcd91('0x1d')](_0x5e6cec['query']['offset']);}return _0x42924d[_0xcd91('0x4b')](_0x9805b);}})[_0xcd91('0x24')](function(_0x34dec0){if(_0x34dec0){return _0x34dec0?{'count':_0x2dfc43,'rows':_0x34dec0}:null;}})[_0xcd91('0x24')](respondWithResult(_0x40aec0,null))[_0xcd91('0x40')](handleError(_0x40aec0,null));};exports[_0xcd91('0x50')]=function(_0xd2acf3,_0x308117,_0x1ae950){return db[_0xcd91('0x51')][_0xcd91('0x47')]({'where':{'id':_0xd2acf3[_0xcd91('0x42')]['id']}})[_0xcd91('0x24')](handleEntityNotFound(_0x308117,null))[_0xcd91('0x24')](function(_0x1ac42b){if(_0x1ac42b){return _0x1ac42b[_0xcd91('0x50')](_0xd2acf3[_0xcd91('0x46')][_0xcd91('0x4a')],_[_0xcd91('0x52')](_0xd2acf3[_0xcd91('0x46')],[_0xcd91('0x4a'),'id'])||{});}})[_0xcd91('0x24')](respondWithResult(_0x308117,null))[_0xcd91('0x40')](handleError(_0x308117,null));};exports['getActions']=function(_0x463b21,_0x12deb6,_0x3f1c47){var _0x3d640a={};var _0x316d98={};var _0x371db4;var _0x35d3f2;return db[_0xcd91('0x3c')]['findOne']({'where':{'id':_0x463b21[_0xcd91('0x42')]['id']}})[_0xcd91('0x24')](handleEntityNotFound(_0x12deb6,null))[_0xcd91('0x24')](function(_0x113356){if(_0x113356){_0x371db4=_0x113356;_0x316d98[_0xcd91('0x31')]=_[_0xcd91('0x43')](db[_0xcd91('0x51')][_0xcd91('0x2a')]);_0x316d98[_0xcd91('0x2f')]=_[_0xcd91('0x43')](_0x463b21['query']);_0x316d98['filters']=_[_0xcd91('0x30')](_0x316d98['model'],_0x316d98[_0xcd91('0x2f')]);_0x3d640a[_0xcd91('0x33')]=_[_0xcd91('0x30')](_0x316d98[_0xcd91('0x31')],qs[_0xcd91('0x32')](_0x463b21[_0xcd91('0x2f')]['fields']));_0x3d640a[_0xcd91('0x33')]=_0x3d640a['attributes'][_0xcd91('0x44')]?_0x3d640a[_0xcd91('0x33')]:_0x316d98[_0xcd91('0x31')];_0x3d640a[_0xcd91('0x4d')]=qs['sort'](_0x463b21['query'][_0xcd91('0x35')]);_0x3d640a['where']=qs[_0xcd91('0x37')](_['pick'](_0x463b21[_0xcd91('0x2f')],_0x316d98[_0xcd91('0x37')]));if(_0x463b21[_0xcd91('0x2f')][_0xcd91('0x38')]){_0x3d640a[_0xcd91('0x36')]=_[_0xcd91('0x39')](_0x3d640a[_0xcd91('0x36')],{'$or':_[_0xcd91('0x29')](_0x3d640a[_0xcd91('0x33')],function(_0x1edee9){var _0x198fe0={};_0x198fe0[_0x1edee9]={'$like':'%'+_0x463b21['query'][_0xcd91('0x38')]+'%'};return _0x198fe0;})});}_0x3d640a=_[_0xcd91('0x39')]({},_0x3d640a,_0x463b21[_0xcd91('0x3b')]);return _0x371db4[_0xcd91('0x53')](_0x3d640a);}})[_0xcd91('0x24')](function(_0xe1dbd9){if(_0xe1dbd9){_0x35d3f2=_0xe1dbd9['length'];if(!_0x463b21[_0xcd91('0x2f')]['hasOwnProperty'](_0xcd91('0x4f'))){_0x3d640a[_0xcd91('0x1e')]=qs['limit'](_0x463b21[_0xcd91('0x2f')]['limit']);_0x3d640a['offset']=qs[_0xcd91('0x1d')](_0x463b21[_0xcd91('0x2f')][_0xcd91('0x1d')]);}return _0x371db4[_0xcd91('0x53')](_0x3d640a);}})[_0xcd91('0x24')](function(_0x124c22){if(_0x124c22){return _0x124c22?{'count':_0x35d3f2,'rows':_0x124c22}:null;}})['then'](respondWithResult(_0x12deb6,null))[_0xcd91('0x40')](handleError(_0x12deb6,null));}; \ No newline at end of file +var _0x0642=['addConditions','Condition','ids','findOne','getConditions','addActions','Action','omit','getActions','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Automation','includeAll','findAll','rows','catch','params','intersection','include','find','body'];(function(_0x4ec7a7,_0x3ea80d){var _0x121228=function(_0x264332){while(--_0x264332){_0x4ec7a7['push'](_0x4ec7a7['shift']());}};_0x121228(++_0x3ea80d);}(_0x0642,0x18f));var _0x2064=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0x0642[_0x4dcc2d];return _0x1bbd79;};'use strict';var pdf=require(_0x2064('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2064('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2064('0x2'));var moment=require(_0x2064('0x3'));var BPromise=require(_0x2064('0x4'));var Mustache=require(_0x2064('0x5'));var util=require(_0x2064('0x6'));var path=require('path');var sox=require(_0x2064('0x7'));var csv=require(_0x2064('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2064('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x2064('0xa'));var toCsv=require(_0x2064('0x8'));var querystring=require(_0x2064('0xb'));var Papa=require('papaparse');var Redis=require(_0x2064('0xc'));var authService=require(_0x2064('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x2064('0xe'));var hardwareService=require(_0x2064('0xf'));var logger=require(_0x2064('0x10'))(_0x2064('0x11'));var utils=require(_0x2064('0x12'));var config=require(_0x2064('0x13'));var db=require(_0x2064('0x14'))['db'];function respondWithStatusCode(_0x70d176,_0x5a7553){_0x5a7553=_0x5a7553||0xcc;return function(_0x2d7bec){if(_0x2d7bec){return _0x70d176[_0x2064('0x15')](_0x5a7553);}return _0x70d176[_0x2064('0x16')](_0x5a7553)['end']();};}function respondWithResult(_0x5e3822,_0x2e141f){_0x2e141f=_0x2e141f||0xc8;return function(_0x577483){if(_0x577483){return _0x5e3822[_0x2064('0x16')](_0x2e141f)['json'](_0x577483);}};}function respondWithFilteredResult(_0x7a1cf8,_0x2b8f36){return function(_0x36d37b){if(_0x36d37b){var _0x106323=_0x36d37b[_0x2064('0x17')],_0x15c91e=_0x2b8f36[_0x2064('0x18')],_0x598155=_0x2b8f36[_0x2064('0x18')]+_0x2b8f36[_0x2064('0x19')],_0x20ddad;if(_0x598155>=_0x106323){_0x598155=_0x106323;_0x20ddad=0xc8;}else{_0x20ddad=0xce;}_0x7a1cf8[_0x2064('0x16')](_0x20ddad);return _0x7a1cf8[_0x2064('0x1a')](_0x2064('0x1b'),_0x15c91e+'-'+_0x598155+'/'+_0x106323)['json'](_0x36d37b);}return null;};}function patchUpdates(_0x4cb23e){return function(_0x28d042){try{jsonpatch[_0x2064('0x1c')](_0x28d042,_0x4cb23e,!![]);}catch(_0x183465){return BPromise[_0x2064('0x1d')](_0x183465);}return _0x28d042['save']();};}function saveUpdates(_0x1eb5fa,_0x4e3674){return function(_0x4aa8da){if(_0x4aa8da){return _0x4aa8da[_0x2064('0x1e')](_0x1eb5fa)[_0x2064('0x1f')](function(_0x13ceb6){return _0x13ceb6;});}return null;};}function removeEntity(_0x29bd55,_0xe54d19){return function(_0x33a7fb){if(_0x33a7fb){return _0x33a7fb[_0x2064('0x20')]()['then'](function(){_0x29bd55[_0x2064('0x16')](0xcc)[_0x2064('0x21')]();});}};}function handleEntityNotFound(_0x474398,_0x1e33b7){return function(_0x4c4a56){if(!_0x4c4a56){_0x474398[_0x2064('0x15')](0x194);}return _0x4c4a56;};}function handleError(_0x2a183c,_0x3bed15){_0x3bed15=_0x3bed15||0x1f4;return function(_0x4e8439){logger[_0x2064('0x22')](_0x4e8439[_0x2064('0x23')]);if(_0x4e8439[_0x2064('0x24')]){delete _0x4e8439[_0x2064('0x24')];}_0x2a183c[_0x2064('0x16')](_0x3bed15)['send'](_0x4e8439);};}exports['index']=function(_0x258de4,_0x4af214){var _0x29712d={},_0x59b08c={},_0x4d333d={'count':0x0,'rows':[]};var _0x57bd12=_[_0x2064('0x25')](db['Automation'][_0x2064('0x26')],function(_0x269cf9){return{'name':_0x269cf9[_0x2064('0x27')],'type':_0x269cf9[_0x2064('0x28')][_0x2064('0x29')]};});_0x59b08c[_0x2064('0x2a')]=_[_0x2064('0x25')](_0x57bd12,_0x2064('0x24'));_0x59b08c[_0x2064('0x2b')]=_[_0x2064('0x2c')](_0x258de4['query']);_0x59b08c[_0x2064('0x2d')]=_['intersection'](_0x59b08c['model'],_0x59b08c[_0x2064('0x2b')]);_0x29712d['attributes']=_['intersection'](_0x59b08c[_0x2064('0x2a')],qs[_0x2064('0x2e')](_0x258de4[_0x2064('0x2b')][_0x2064('0x2e')]));_0x29712d['attributes']=_0x29712d[_0x2064('0x2f')][_0x2064('0x30')]?_0x29712d[_0x2064('0x2f')]:_0x59b08c[_0x2064('0x2a')];if(!_0x258de4[_0x2064('0x2b')][_0x2064('0x31')](_0x2064('0x32'))){_0x29712d['limit']=qs[_0x2064('0x19')](_0x258de4['query'][_0x2064('0x19')]);_0x29712d[_0x2064('0x18')]=qs['offset'](_0x258de4[_0x2064('0x2b')]['offset']);}_0x29712d[_0x2064('0x33')]=qs[_0x2064('0x34')](_0x258de4[_0x2064('0x2b')][_0x2064('0x34')]);_0x29712d[_0x2064('0x35')]=qs[_0x2064('0x2d')](_[_0x2064('0x36')](_0x258de4[_0x2064('0x2b')],_0x59b08c[_0x2064('0x2d')]));if(_0x258de4[_0x2064('0x2b')][_0x2064('0x37')]){_0x29712d[_0x2064('0x35')]=_[_0x2064('0x38')](_0x29712d[_0x2064('0x35')],{'$or':_[_0x2064('0x25')](_0x57bd12,function(_0x3ac751){if(_0x3ac751[_0x2064('0x28')]!==_0x2064('0x39')){var _0x454b07={};_0x454b07[_0x3ac751[_0x2064('0x24')]]={'$like':'%'+_0x258de4[_0x2064('0x2b')][_0x2064('0x37')]+'%'};return _0x454b07;}})});}_0x29712d=_[_0x2064('0x38')]({},_0x29712d,_0x258de4[_0x2064('0x3a')]);var _0x2022c2={'where':_0x29712d['where']};return db[_0x2064('0x3b')][_0x2064('0x17')](_0x2022c2)[_0x2064('0x1f')](function(_0xdd670e){_0x4d333d[_0x2064('0x17')]=_0xdd670e;if(_0x258de4[_0x2064('0x2b')][_0x2064('0x3c')]){_0x29712d['include']=[{'all':!![]}];}return db['Automation'][_0x2064('0x3d')](_0x29712d);})[_0x2064('0x1f')](function(_0x5abc2b){_0x4d333d[_0x2064('0x3e')]=_0x5abc2b;return _0x4d333d;})[_0x2064('0x1f')](respondWithFilteredResult(_0x4af214,_0x29712d))[_0x2064('0x3f')](handleError(_0x4af214,null));};exports['show']=function(_0x37a461,_0x21d4d3){var _0x48609b={'raw':![],'where':{'id':_0x37a461[_0x2064('0x40')]['id']}},_0x2bc209={};_0x2bc209[_0x2064('0x2a')]=_['keys'](db[_0x2064('0x3b')]['rawAttributes']);_0x2bc209[_0x2064('0x2b')]=_['keys'](_0x37a461[_0x2064('0x2b')]);_0x2bc209['filters']=_['intersection'](_0x2bc209['model'],_0x2bc209[_0x2064('0x2b')]);_0x48609b['attributes']=_[_0x2064('0x41')](_0x2bc209['model'],qs[_0x2064('0x2e')](_0x37a461[_0x2064('0x2b')][_0x2064('0x2e')]));_0x48609b[_0x2064('0x2f')]=_0x48609b[_0x2064('0x2f')][_0x2064('0x30')]?_0x48609b[_0x2064('0x2f')]:_0x2bc209[_0x2064('0x2a')];if(_0x37a461[_0x2064('0x2b')][_0x2064('0x3c')]){_0x48609b[_0x2064('0x42')]=[{'all':!![]}];}_0x48609b=_[_0x2064('0x38')]({},_0x48609b,_0x37a461[_0x2064('0x3a')]);return db[_0x2064('0x3b')][_0x2064('0x43')](_0x48609b)[_0x2064('0x1f')](handleEntityNotFound(_0x21d4d3,null))['then'](respondWithResult(_0x21d4d3,null))[_0x2064('0x3f')](handleError(_0x21d4d3,null));};exports['create']=function(_0x316c60,_0x5af5d7){return db['Automation']['create'](_0x316c60[_0x2064('0x44')],{})[_0x2064('0x1f')](respondWithResult(_0x5af5d7,0xc9))[_0x2064('0x3f')](handleError(_0x5af5d7,null));};exports[_0x2064('0x1e')]=function(_0x347c19,_0x4b698c){if(_0x347c19[_0x2064('0x44')]['id']){delete _0x347c19[_0x2064('0x44')]['id'];}return db[_0x2064('0x3b')][_0x2064('0x43')]({'where':{'id':_0x347c19[_0x2064('0x40')]['id']}})[_0x2064('0x1f')](handleEntityNotFound(_0x4b698c,null))[_0x2064('0x1f')](saveUpdates(_0x347c19[_0x2064('0x44')],null))[_0x2064('0x1f')](respondWithResult(_0x4b698c,null))[_0x2064('0x3f')](handleError(_0x4b698c,null));};exports['destroy']=function(_0x44b263,_0xfebdf2){return db[_0x2064('0x3b')]['find']({'where':{'id':_0x44b263[_0x2064('0x40')]['id']}})[_0x2064('0x1f')](handleEntityNotFound(_0xfebdf2,null))[_0x2064('0x1f')](removeEntity(_0xfebdf2,null))[_0x2064('0x3f')](handleError(_0xfebdf2,null));};exports[_0x2064('0x45')]=function(_0x3badd3,_0x5bb84a,_0x332f73){return db[_0x2064('0x46')][_0x2064('0x43')]({'where':{'id':_0x3badd3[_0x2064('0x40')]['id']}})[_0x2064('0x1f')](handleEntityNotFound(_0x5bb84a,null))[_0x2064('0x1f')](function(_0x38131a){if(_0x38131a){return _0x38131a[_0x2064('0x45')](_0x3badd3[_0x2064('0x44')][_0x2064('0x47')],_['omit'](_0x3badd3[_0x2064('0x44')],[_0x2064('0x47'),'id'])||{});}})[_0x2064('0x1f')](respondWithResult(_0x5bb84a,null))[_0x2064('0x3f')](handleError(_0x5bb84a,null));};exports['getConditions']=function(_0x4d5fdb,_0x59efb3,_0x332c2f){var _0x4e116b={};var _0x1c5cdd={};var _0x58f1d1;var _0x200b9a;return db[_0x2064('0x3b')][_0x2064('0x48')]({'where':{'id':_0x4d5fdb[_0x2064('0x40')]['id']}})['then'](handleEntityNotFound(_0x59efb3,null))['then'](function(_0x3e6419){if(_0x3e6419){_0x58f1d1=_0x3e6419;_0x1c5cdd[_0x2064('0x2a')]=_[_0x2064('0x2c')](db[_0x2064('0x46')]['rawAttributes']);_0x1c5cdd[_0x2064('0x2b')]=_[_0x2064('0x2c')](_0x4d5fdb['query']);_0x1c5cdd['filters']=_[_0x2064('0x41')](_0x1c5cdd['model'],_0x1c5cdd['query']);_0x4e116b['attributes']=_['intersection'](_0x1c5cdd[_0x2064('0x2a')],qs['fields'](_0x4d5fdb[_0x2064('0x2b')][_0x2064('0x2e')]));_0x4e116b[_0x2064('0x2f')]=_0x4e116b[_0x2064('0x2f')]['length']?_0x4e116b['attributes']:_0x1c5cdd[_0x2064('0x2a')];_0x4e116b[_0x2064('0x33')]=qs[_0x2064('0x34')](_0x4d5fdb[_0x2064('0x2b')][_0x2064('0x34')]);_0x4e116b[_0x2064('0x35')]=qs['filters'](_['pick'](_0x4d5fdb['query'],_0x1c5cdd[_0x2064('0x2d')]));if(_0x4d5fdb[_0x2064('0x2b')][_0x2064('0x37')]){_0x4e116b[_0x2064('0x35')]=_[_0x2064('0x38')](_0x4e116b[_0x2064('0x35')],{'$or':_[_0x2064('0x25')](_0x4e116b['attributes'],function(_0x2b5b0a){var _0x36799f={};_0x36799f[_0x2b5b0a]={'$like':'%'+_0x4d5fdb['query'][_0x2064('0x37')]+'%'};return _0x36799f;})});}_0x4e116b=_['merge']({},_0x4e116b,_0x4d5fdb['options']);return _0x58f1d1[_0x2064('0x49')](_0x4e116b);}})['then'](function(_0x265a1e){if(_0x265a1e){_0x200b9a=_0x265a1e[_0x2064('0x30')];if(!_0x4d5fdb[_0x2064('0x2b')][_0x2064('0x31')](_0x2064('0x32'))){_0x4e116b[_0x2064('0x19')]=qs['limit'](_0x4d5fdb['query'][_0x2064('0x19')]);_0x4e116b[_0x2064('0x18')]=qs['offset'](_0x4d5fdb[_0x2064('0x2b')][_0x2064('0x18')]);}return _0x58f1d1[_0x2064('0x49')](_0x4e116b);}})[_0x2064('0x1f')](function(_0x766f18){if(_0x766f18){return _0x766f18?{'count':_0x200b9a,'rows':_0x766f18}:null;}})[_0x2064('0x1f')](respondWithResult(_0x59efb3,null))[_0x2064('0x3f')](handleError(_0x59efb3,null));};exports[_0x2064('0x4a')]=function(_0x353fe4,_0x442cf5,_0xfac9e1){return db[_0x2064('0x4b')][_0x2064('0x43')]({'where':{'id':_0x353fe4[_0x2064('0x40')]['id']}})[_0x2064('0x1f')](handleEntityNotFound(_0x442cf5,null))[_0x2064('0x1f')](function(_0x171264){if(_0x171264){return _0x171264[_0x2064('0x4a')](_0x353fe4[_0x2064('0x44')]['ids'],_[_0x2064('0x4c')](_0x353fe4[_0x2064('0x44')],[_0x2064('0x47'),'id'])||{});}})['then'](respondWithResult(_0x442cf5,null))[_0x2064('0x3f')](handleError(_0x442cf5,null));};exports[_0x2064('0x4d')]=function(_0xe58d6d,_0x2d2195,_0x44e89f){var _0x46529c={};var _0x4a1ef9={};var _0xdedb8;var _0x2c8a28;return db[_0x2064('0x3b')][_0x2064('0x48')]({'where':{'id':_0xe58d6d[_0x2064('0x40')]['id']}})[_0x2064('0x1f')](handleEntityNotFound(_0x2d2195,null))[_0x2064('0x1f')](function(_0x46824c){if(_0x46824c){_0xdedb8=_0x46824c;_0x4a1ef9[_0x2064('0x2a')]=_[_0x2064('0x2c')](db[_0x2064('0x4b')]['rawAttributes']);_0x4a1ef9[_0x2064('0x2b')]=_[_0x2064('0x2c')](_0xe58d6d[_0x2064('0x2b')]);_0x4a1ef9['filters']=_['intersection'](_0x4a1ef9[_0x2064('0x2a')],_0x4a1ef9[_0x2064('0x2b')]);_0x46529c[_0x2064('0x2f')]=_[_0x2064('0x41')](_0x4a1ef9[_0x2064('0x2a')],qs[_0x2064('0x2e')](_0xe58d6d[_0x2064('0x2b')][_0x2064('0x2e')]));_0x46529c['attributes']=_0x46529c[_0x2064('0x2f')][_0x2064('0x30')]?_0x46529c[_0x2064('0x2f')]:_0x4a1ef9[_0x2064('0x2a')];_0x46529c[_0x2064('0x33')]=qs[_0x2064('0x34')](_0xe58d6d[_0x2064('0x2b')]['sort']);_0x46529c[_0x2064('0x35')]=qs[_0x2064('0x2d')](_[_0x2064('0x36')](_0xe58d6d['query'],_0x4a1ef9[_0x2064('0x2d')]));if(_0xe58d6d[_0x2064('0x2b')][_0x2064('0x37')]){_0x46529c[_0x2064('0x35')]=_[_0x2064('0x38')](_0x46529c[_0x2064('0x35')],{'$or':_['map'](_0x46529c[_0x2064('0x2f')],function(_0x181add){var _0x48e3e6={};_0x48e3e6[_0x181add]={'$like':'%'+_0xe58d6d['query'][_0x2064('0x37')]+'%'};return _0x48e3e6;})});}_0x46529c=_['merge']({},_0x46529c,_0xe58d6d[_0x2064('0x3a')]);return _0xdedb8[_0x2064('0x4d')](_0x46529c);}})[_0x2064('0x1f')](function(_0x21bd27){if(_0x21bd27){_0x2c8a28=_0x21bd27[_0x2064('0x30')];if(!_0xe58d6d[_0x2064('0x2b')]['hasOwnProperty'](_0x2064('0x32'))){_0x46529c[_0x2064('0x19')]=qs[_0x2064('0x19')](_0xe58d6d[_0x2064('0x2b')][_0x2064('0x19')]);_0x46529c[_0x2064('0x18')]=qs[_0x2064('0x18')](_0xe58d6d['query']['offset']);}return _0xdedb8['getActions'](_0x46529c);}})['then'](function(_0x31bf49){if(_0x31bf49){return _0x31bf49?{'count':_0x2c8a28,'rows':_0x31bf49}:null;}})['then'](respondWithResult(_0x2d2195,null))[_0x2064('0x3f')](handleError(_0x2d2195,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 26b0bf0..446685f 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 _0x0c71=['api','moment','bluebird','rimraf','./automation.attributes','exports','define','Automation','util'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x0c71,0xfb));var _0x10c7=function(_0x5a10b8,_0x118092){_0x5a10b8=_0x5a10b8-0x0;var _0x25b85f=_0x0c71[_0x5a10b8];return _0x25b85f;};'use strict';var _=require('lodash');var util=require(_0x10c7('0x0'));var logger=require('../../config/logger')(_0x10c7('0x1'));var moment=require(_0x10c7('0x2'));var BPromise=require(_0x10c7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x10c7('0x4'));var config=require('../../config/environment');var attributes=require(_0x10c7('0x5'));module[_0x10c7('0x6')]=function(_0x21da60,_0x4480c2){return _0x21da60[_0x10c7('0x7')](_0x10c7('0x8'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe451=['exports','Automation','tools_automations','lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','./automation.attributes'];(function(_0x4c10dd,_0x255657){var _0x3236bc=function(_0x3e888c){while(--_0x3e888c){_0x4c10dd['push'](_0x4c10dd['shift']());}};_0x3236bc(++_0x255657);}(_0xe451,0x143));var _0x1e45=function(_0x4eb908,_0x264f97){_0x4eb908=_0x4eb908-0x0;var _0x1aa572=_0xe451[_0x4eb908];return _0x1aa572;};'use strict';var _=require(_0x1e45('0x0'));var util=require('util');var logger=require(_0x1e45('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1e45('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e45('0x3'));var rimraf=require(_0x1e45('0x4'));var config=require(_0x1e45('0x5'));var attributes=require(_0x1e45('0x6'));module[_0x1e45('0x7')]=function(_0x2ba97b,_0xda70d0){return _0x2ba97b['define'](_0x1e45('0x8'),attributes,{'tableName':_0x1e45('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 8641cf8..ccf6101 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 _0xfe6e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','info','lodash','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfe6e,0x1a2));var _0xefe6=function(_0x3683cb,_0x567533){_0x3683cb=_0x3683cb-0x0;var _0x17d00f=_0xfe6e[_0x3683cb];return _0x17d00f;};'use strict';var _=require(_0xefe6('0x0'));var util=require('util');var moment=require(_0xefe6('0x1'));var BPromise=require(_0xefe6('0x2'));var rs=require(_0xefe6('0x3'));var fs=require('fs');var Redis=require(_0xefe6('0x4'));var db=require(_0xefe6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xefe6('0x6'))(_0xefe6('0x7'));var config=require(_0xefe6('0x8'));var jayson=require(_0xefe6('0x9'));var client=jayson[_0xefe6('0xa')][_0xefe6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x504c11,_0x4246e0,_0x344c7f){return new BPromise(function(_0x392974,_0x5dd333){return client['request'](_0x504c11,_0x344c7f)['then'](function(_0x3f6ff1){logger['info'](_0xefe6('0xc'),_0x4246e0,_0xefe6('0xd'));logger[_0xefe6('0xe')](_0xefe6('0xf'),_0x4246e0,'request\x20sent',JSON[_0xefe6('0x10')](_0x3f6ff1));if(_0x3f6ff1[_0xefe6('0x11')]){if(_0x3f6ff1[_0xefe6('0x11')]['code']===0x1f4){logger[_0xefe6('0x11')](_0xefe6('0xc'),_0x4246e0,_0x3f6ff1[_0xefe6('0x11')][_0xefe6('0x12')]);return _0x5dd333(_0x3f6ff1['error']['message']);}logger[_0xefe6('0x11')](_0xefe6('0xc'),_0x4246e0,_0x3f6ff1[_0xefe6('0x11')][_0xefe6('0x12')]);return _0x392974(_0x3f6ff1['error'][_0xefe6('0x12')]);}else{logger[_0xefe6('0x13')](_0xefe6('0xc'),_0x4246e0,'request\x20sent');_0x392974(_0x3f6ff1['result'][_0xefe6('0x12')]);}})['catch'](function(_0x3e15a8){logger[_0xefe6('0x11')](_0xefe6('0xc'),_0x4246e0,_0x3e15a8);_0x5dd333(_0x3e15a8);});});} \ No newline at end of file +var _0xd12f=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Automation,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util'];(function(_0x1ce8f5,_0x5b1472){var _0x3347c4=function(_0x56cf37){while(--_0x56cf37){_0x1ce8f5['push'](_0x1ce8f5['shift']());}};_0x3347c4(++_0x5b1472);}(_0xd12f,0x15e));var _0xfd12=function(_0x1b42cd,_0x4483b5){_0x1b42cd=_0x1b42cd-0x0;var _0x41e9df=_0xd12f[_0x1b42cd];return _0x41e9df;};'use strict';var _=require(_0xfd12('0x0'));var util=require(_0xfd12('0x1'));var moment=require(_0xfd12('0x2'));var BPromise=require(_0xfd12('0x3'));var rs=require(_0xfd12('0x4'));var fs=require('fs');var Redis=require(_0xfd12('0x5'));var db=require(_0xfd12('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfd12('0x7'))(_0xfd12('0x8'));var config=require(_0xfd12('0x9'));var jayson=require(_0xfd12('0xa'));var client=jayson[_0xfd12('0xb')][_0xfd12('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x129571,_0x3e2a26,_0x49c645){return new BPromise(function(_0x296384,_0x5927c3){return client['request'](_0x129571,_0x49c645)['then'](function(_0x37d8fb){logger[_0xfd12('0xd')](_0xfd12('0xe'),_0x3e2a26,'request\x20sent');logger[_0xfd12('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x3e2a26,_0xfd12('0x10'),JSON[_0xfd12('0x11')](_0x37d8fb));if(_0x37d8fb[_0xfd12('0x12')]){if(_0x37d8fb[_0xfd12('0x12')][_0xfd12('0x13')]===0x1f4){logger['error'](_0xfd12('0xe'),_0x3e2a26,_0x37d8fb[_0xfd12('0x12')][_0xfd12('0x14')]);return _0x5927c3(_0x37d8fb['error']['message']);}logger[_0xfd12('0x12')](_0xfd12('0xe'),_0x3e2a26,_0x37d8fb[_0xfd12('0x12')][_0xfd12('0x14')]);return _0x296384(_0x37d8fb[_0xfd12('0x12')][_0xfd12('0x14')]);}else{logger[_0xfd12('0xd')](_0xfd12('0xe'),_0x3e2a26,_0xfd12('0x10'));_0x296384(_0x37d8fb[_0xfd12('0x15')][_0xfd12('0x14')]);}})['catch'](function(_0x1900df){logger[_0xfd12('0x12')]('Automation,\x20%s,\x20%s',_0x3e2a26,_0x1900df);_0x5927c3(_0x1900df);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 84a17a4..cd3e7eb 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 _0x1de7=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','put','/:id','update','delete','exports','multer','util'];(function(_0x48019f,_0x182f77){var _0x23badf=function(_0x123418){while(--_0x123418){_0x48019f['push'](_0x48019f['shift']());}};_0x23badf(++_0x182f77);}(_0x1de7,0x1de));var _0x71de=function(_0x1d92f1,_0x434f64){_0x1d92f1=_0x1d92f1-0x0;var _0x53ac8d=_0x1de7[_0x1d92f1];return _0x53ac8d;};'use strict';var multer=require(_0x71de('0x0'));var util=require(_0x71de('0x1'));var path=require(_0x71de('0x2'));var timeout=require('connect-timeout');var express=require(_0x71de('0x3'));var router=express[_0x71de('0x4')]();var auth=require(_0x71de('0x5'));var interaction=require(_0x71de('0x6'));var config=require(_0x71de('0x7'));var controller=require(_0x71de('0x8'));router[_0x71de('0x9')]('/',auth[_0x71de('0xa')](),controller['index']);router['get']('/:id',auth[_0x71de('0xa')](),controller[_0x71de('0xb')]);router[_0x71de('0x9')](_0x71de('0xc'),auth['isAuthenticated'](),controller[_0x71de('0xd')]);router[_0x71de('0x9')](_0x71de('0xe'),auth[_0x71de('0xa')](),controller[_0x71de('0xf')]);router[_0x71de('0x10')]('/',auth[_0x71de('0xa')](),controller[_0x71de('0x11')]);router[_0x71de('0x10')](_0x71de('0xc'),auth['isAuthenticated'](),controller[_0x71de('0x12')]);router[_0x71de('0x10')](_0x71de('0xe'),auth['isAuthenticated'](),controller['addActions']);router[_0x71de('0x13')](_0x71de('0x14'),auth[_0x71de('0xa')](),controller[_0x71de('0x15')]);router[_0x71de('0x16')](_0x71de('0x14'),auth[_0x71de('0xa')](),controller['destroy']);module[_0x71de('0x17')]=router; \ No newline at end of file +var _0x5a1a=['getConditions','/:id/actions','getActions','post','create','/:id/conditions','put','update','/:id','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','get','show'];(function(_0x62d20d,_0x329013){var _0x4ab84b=function(_0x4f39cb){while(--_0x4f39cb){_0x62d20d['push'](_0x62d20d['shift']());}};_0x4ab84b(++_0x329013);}(_0x5a1a,0xa4));var _0xa5a1=function(_0x5406ab,_0x10ddda){_0x5406ab=_0x5406ab-0x0;var _0x47e633=_0x5a1a[_0x5406ab];return _0x47e633;};'use strict';var multer=require(_0xa5a1('0x0'));var util=require(_0xa5a1('0x1'));var path=require(_0xa5a1('0x2'));var timeout=require(_0xa5a1('0x3'));var express=require(_0xa5a1('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa5a1('0x5'));var config=require(_0xa5a1('0x6'));var controller=require(_0xa5a1('0x7'));router['get']('/',auth[_0xa5a1('0x8')](),controller[_0xa5a1('0x9')]);router[_0xa5a1('0xa')]('/:id',auth[_0xa5a1('0x8')](),controller[_0xa5a1('0xb')]);router[_0xa5a1('0xa')]('/:id/conditions',auth['isAuthenticated'](),controller[_0xa5a1('0xc')]);router[_0xa5a1('0xa')](_0xa5a1('0xd'),auth[_0xa5a1('0x8')](),controller[_0xa5a1('0xe')]);router[_0xa5a1('0xf')]('/',auth['isAuthenticated'](),controller[_0xa5a1('0x10')]);router[_0xa5a1('0xf')](_0xa5a1('0x11'),auth[_0xa5a1('0x8')](),controller['addConditions']);router['post'](_0xa5a1('0xd'),auth[_0xa5a1('0x8')](),controller['addActions']);router[_0xa5a1('0x12')]('/:id',auth[_0xa5a1('0x8')](),controller[_0xa5a1('0x13')]);router['delete'](_0xa5a1('0x14'),auth[_0xa5a1('0x8')](),controller['destroy']);module[_0xa5a1('0x15')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index f96728e..6724ff3 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 _0x200a=['Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED'];(function(_0x30ab5c,_0x19c0a3){var _0x3b5265=function(_0x4fc871){while(--_0x4fc871){_0x30ab5c['push'](_0x30ab5c['shift']());}};_0x3b5265(++_0x19c0a3);}(_0x200a,0x1e4));var _0xa200=function(_0x43b08,_0x15f967){_0x43b08=_0x43b08-0x0;var _0x5e05f4=_0x200a[_0x43b08];return _0x5e05f4;};'use strict';var Sequelize=require(_0xa200('0x0'));module[_0xa200('0x1')]={'name':{'type':Sequelize[_0xa200('0x2')],'unique':_0xa200('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xa200('0x4')](_0xa200('0x5')),'allowNull':![],'defaultValue':_0xa200('0x5')},'description':{'type':Sequelize[_0xa200('0x2')]},'active':{'type':Sequelize[_0xa200('0x6')],'defaultValue':0x0,'comment':_0xa200('0x7')},'limitCalls':{'type':Sequelize[_0xa200('0x8')](0x4)[_0xa200('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xa200('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0xa200('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xa200('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xa200('0x8')](0x3)[_0xa200('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa200('0xb')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xa200('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa200('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0xa200('0x8')](0x3)[_0xa200('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa200('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0xa200('0x8')](0x5)[_0xa200('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa200('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa200('0x8')](0x3)[_0xa200('0x9')],'defaultValue':0x3,'comment':_0xa200('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xa200('0x8')](0x5)[_0xa200('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xa200('0x8')](0x3)[_0xa200('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa200('0x10')},'dialTimezone':{'type':Sequelize[_0xa200('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xa200('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0xa200('0x4')](_0xa200('0x12'),'never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xa200('0x6')],'defaultValue':0x0,'comment':_0xa200('0x13')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa200('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa200('0x14')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xa200('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xa200('0x8')](0x9)[_0xa200('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xa200('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa200('0x8')](0x9)[_0xa200('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa200('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xa200('0x8')](0x9)[_0xa200('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa200('0x8')](0x9)[_0xa200('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa200('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xa200('0x9')],'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':_0xa200('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa200('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa200('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xa200('0x4')]('DESC',_0xa200('0x1b')),'defaultValue':_0xa200('0x1c')},'dialPrefix':{'type':Sequelize[_0xa200('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa200('0x8')](0x3)[_0xa200('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xa200('0x8')](0x3)[_0xa200('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa200('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xa200('0x8')](0x3)[_0xa200('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa200('0x8')](0x5)[_0xa200('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa200('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0xa200('0x8')](0x3)[_0xa200('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa200('0x1f')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xa200('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa200('0x8')](0x3)[_0xa200('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa200('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa200('0x8')](0x5)[_0xa200('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa200('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0xa200('0x8')](0x3)[_0xa200('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa200('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0xa200('0x8')](0x5)[_0xa200('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa200('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa200('0x8')](0x3)[_0xa200('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa200('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xa200('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa200('0x25')}}; \ No newline at end of file +var _0x198c=['#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','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\x20(min:1,\x20max:999)'];(function(_0x303875,_0x29fc7f){var _0x507814=function(_0x23baf2){while(--_0x23baf2){_0x303875['push'](_0x303875['shift']());}};_0x507814(++_0x29fc7f);}(_0x198c,0x1f1));var _0xc198=function(_0x56ad94,_0x9982e3){_0x56ad94=_0x56ad94-0x0;var _0x49d187=_0x198c[_0x56ad94];return _0x49d187;};'use strict';var Sequelize=require(_0xc198('0x0'));module[_0xc198('0x1')]={'name':{'type':Sequelize[_0xc198('0x2')],'unique':_0xc198('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xc198('0x4')),'allowNull':![],'defaultValue':_0xc198('0x4')},'description':{'type':Sequelize[_0xc198('0x2')]},'active':{'type':Sequelize[_0xc198('0x5')],'defaultValue':0x0,'comment':_0xc198('0x6')},'limitCalls':{'type':Sequelize[_0xc198('0x7')](0x4)[_0xc198('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc198('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc198('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc198('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xc198('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc198('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc198('0x7')](0x3)[_0xc198('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc198('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc198('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc198('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0xc198('0x7')](0x3)[_0xc198('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xc198('0x7')](0x5)[_0xc198('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc198('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc198('0x7')](0x5)[_0xc198('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc198('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc198('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc198('0xe')},'dialTimezone':{'type':Sequelize[_0xc198('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc198('0x2')],'defaultValue':_0xc198('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0xc198('0x10')](_0xc198('0x11'),_0xc198('0x12'),_0xc198('0x13')),'defaultValue':_0xc198('0x11')},'dialAMDActive':{'type':Sequelize[_0xc198('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xc198('0x7')](0x9)[_0xc198('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc198('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xc198('0x7')](0x9)[_0xc198('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc198('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc198('0x7')](0x9)[_0xc198('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc198('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc198('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xc198('0x7')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc198('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc198('0x7')](0x9)[_0xc198('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc198('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc198('0x7')](0x9)[_0xc198('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc198('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xc198('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc198('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xc198('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xc198('0x10')](_0xc198('0x1b'),_0xc198('0x1c')),'defaultValue':_0xc198('0x1b')},'dialPrefix':{'type':Sequelize[_0xc198('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xc198('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc198('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc198('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc198('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc198('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc198('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xc198('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc198('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0xc198('0x7')](0x5)[_0xc198('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc198('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc198('0x7')](0x3)[_0xc198('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc198('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc198('0x7')](0x5)[_0xc198('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xc198('0x7')](0x3)[_0xc198('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc198('0x23')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc198('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc198('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc198('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc198('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 14e3fc7..bf7d72b 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 _0xa74f=['NOW()','scheduledAt','CmListId','ListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','into','cm_contacts','phone\x20IS\x20NOT\x20NULL','ContactId','push','all','removeLists','addBlackLists','cm_hopper_black','sequelize','removeBlackLists','rimraf','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','destroy','get','then','stack','name','index','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Campaign','findAll','rows','params','length','find','catch','create','body','user','role','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','error','update','getHoppers','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','select','field'];(function(_0x1073ad,_0x44bf0b){var _0x528474=function(_0x3450f7){while(--_0x3450f7){_0x1073ad['push'](_0x1073ad['shift']());}};_0x528474(++_0x44bf0b);}(_0xa74f,0x9a));var _0xfa74=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0xa74f[_0x5eaa0b];return _0x28b295;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xfa74('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfa74('0x1'));var moment=require(_0xfa74('0x2'));var BPromise=require(_0xfa74('0x3'));var Mustache=require(_0xfa74('0x4'));var util=require('util');var path=require(_0xfa74('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfa74('0x6'));var fs=require('fs');var _=require(_0xfa74('0x7'));var squel=require(_0xfa74('0x8'));var crypto=require(_0xfa74('0x9'));var jsforce=require(_0xfa74('0xa'));var deskjs=require(_0xfa74('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfa74('0xc'));var Papa=require(_0xfa74('0xd'));var Redis=require(_0xfa74('0xe'));var authService=require(_0xfa74('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfa74('0x10'));var hardwareService=require(_0xfa74('0x11'));var logger=require('../../config/logger')(_0xfa74('0x12'));var utils=require(_0xfa74('0x13'));var config=require(_0xfa74('0x14'));var db=require(_0xfa74('0x15'))['db'];function respondWithStatusCode(_0x5bc6b7,_0x23591a){_0x23591a=_0x23591a||0xcc;return function(_0x998585){if(_0x998585){return _0x5bc6b7[_0xfa74('0x16')](_0x23591a);}return _0x5bc6b7[_0xfa74('0x17')](_0x23591a)['end']();};}function respondWithResult(_0x3553e7,_0x33cda3){_0x33cda3=_0x33cda3||0xc8;return function(_0x3eb49b){if(_0x3eb49b){return _0x3553e7[_0xfa74('0x17')](_0x33cda3)[_0xfa74('0x18')](_0x3eb49b);}};}function respondWithFilteredResult(_0x47c8fb,_0x199d20){return function(_0x13d911){if(_0x13d911){var _0x947da6=_0x13d911[_0xfa74('0x19')],_0x1f1de0=_0x199d20['offset'],_0x3867f8=_0x199d20[_0xfa74('0x1a')]+_0x199d20[_0xfa74('0x1b')],_0x40af70;if(_0x3867f8>=_0x947da6){_0x3867f8=_0x947da6;_0x40af70=0xc8;}else{_0x40af70=0xce;}_0x47c8fb['status'](_0x40af70);return _0x47c8fb['set'](_0xfa74('0x1c'),_0x1f1de0+'-'+_0x3867f8+'/'+_0x947da6)[_0xfa74('0x18')](_0x13d911);}return null;};}function patchUpdates(_0xb8fe6b){return function(_0x5a863f){try{jsonpatch[_0xfa74('0x1d')](_0x5a863f,_0xb8fe6b,!![]);}catch(_0x2edebb){return BPromise[_0xfa74('0x1e')](_0x2edebb);}return _0x5a863f['save']();};}function saveUpdates(_0xd35110,_0x302eb4){return function(_0x2e6c33){if(_0x2e6c33){return _0x2e6c33['update'](_0xd35110)['then'](function(_0x100851){return _0x100851;});}return null;};}function removeEntity(_0x2257a0,_0x9932db){return function(_0xeaaa19){if(_0xeaaa19){return _0xeaaa19[_0xfa74('0x1f')]()['then'](function(){var _0x4802a3=_0xeaaa19[_0xfa74('0x20')]({'plain':!![]});var _0x5aa8a7='IvrCampaigns';return db['UserProfileResource'][_0xfa74('0x1f')]({'where':{'type':_0x5aa8a7,'resourceId':_0x4802a3['id']}})[_0xfa74('0x21')](function(){return _0xeaaa19;});})[_0xfa74('0x21')](function(){_0x2257a0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x9eb68c,_0xeb6c11){return function(_0x5ed1c8){if(!_0x5ed1c8){_0x9eb68c[_0xfa74('0x16')](0x194);}return _0x5ed1c8;};}function handleError(_0x5d3b26,_0x1a8cf7){_0x1a8cf7=_0x1a8cf7||0x1f4;return function(_0x153b2a){logger['error'](_0x153b2a[_0xfa74('0x22')]);if(_0x153b2a[_0xfa74('0x23')]){delete _0x153b2a[_0xfa74('0x23')];}_0x5d3b26[_0xfa74('0x17')](_0x1a8cf7)['send'](_0x153b2a);};}exports[_0xfa74('0x24')]=function(_0x2f7cd7,_0x204e01){var _0x57d90e={},_0x4d4bed={},_0x1322a4={'count':0x0,'rows':[]};var _0x8b706e=_['map'](db['Campaign'][_0xfa74('0x25')],function(_0x564060){return{'name':_0x564060[_0xfa74('0x26')],'type':_0x564060['type'][_0xfa74('0x27')]};});_0x4d4bed[_0xfa74('0x28')]=_[_0xfa74('0x29')](_0x8b706e,_0xfa74('0x23'));_0x4d4bed['query']=_[_0xfa74('0x2a')](_0x2f7cd7[_0xfa74('0x2b')]);_0x4d4bed[_0xfa74('0x2c')]=_[_0xfa74('0x2d')](_0x4d4bed[_0xfa74('0x28')],_0x4d4bed[_0xfa74('0x2b')]);_0x57d90e[_0xfa74('0x2e')]=_['intersection'](_0x4d4bed[_0xfa74('0x28')],qs['fields'](_0x2f7cd7[_0xfa74('0x2b')][_0xfa74('0x2f')]));_0x57d90e[_0xfa74('0x2e')]=_0x57d90e[_0xfa74('0x2e')]['length']?_0x57d90e['attributes']:_0x4d4bed[_0xfa74('0x28')];if(!_0x2f7cd7[_0xfa74('0x2b')][_0xfa74('0x30')](_0xfa74('0x31'))){_0x57d90e['limit']=qs[_0xfa74('0x1b')](_0x2f7cd7[_0xfa74('0x2b')]['limit']);_0x57d90e['offset']=qs['offset'](_0x2f7cd7['query']['offset']);}_0x57d90e[_0xfa74('0x32')]=qs[_0xfa74('0x33')](_0x2f7cd7[_0xfa74('0x2b')][_0xfa74('0x33')]);_0x57d90e[_0xfa74('0x34')]=qs[_0xfa74('0x2c')](_[_0xfa74('0x35')](_0x2f7cd7[_0xfa74('0x2b')],_0x4d4bed[_0xfa74('0x2c')]));if(_0x2f7cd7['query'][_0xfa74('0x36')]){_0x57d90e[_0xfa74('0x34')]=_[_0xfa74('0x37')](_0x57d90e[_0xfa74('0x34')],{'$or':_[_0xfa74('0x29')](_0x8b706e,function(_0x186126){if(_0x186126['type']!==_0xfa74('0x38')){var _0x1f0806={};_0x1f0806[_0x186126[_0xfa74('0x23')]]={'$like':'%'+_0x2f7cd7[_0xfa74('0x2b')]['filter']+'%'};return _0x1f0806;}})});}_0x57d90e=_[_0xfa74('0x37')]({},_0x57d90e,_0x2f7cd7[_0xfa74('0x39')]);var _0xe8491b={'where':_0x57d90e[_0xfa74('0x34')]};return db['Campaign'][_0xfa74('0x19')](_0xe8491b)[_0xfa74('0x21')](function(_0x3dacc2){_0x1322a4['count']=_0x3dacc2;if(_0x2f7cd7['query'][_0xfa74('0x3a')]){_0x57d90e[_0xfa74('0x3b')]=[{'all':!![]}];}return db[_0xfa74('0x3c')][_0xfa74('0x3d')](_0x57d90e);})['then'](function(_0x1ab026){_0x1322a4[_0xfa74('0x3e')]=_0x1ab026;return _0x1322a4;})['then'](respondWithFilteredResult(_0x204e01,_0x57d90e))['catch'](handleError(_0x204e01,null));};exports['show']=function(_0x492c7d,_0x95c891){var _0x3098ca={'raw':![],'where':{'id':_0x492c7d[_0xfa74('0x3f')]['id']}},_0x3f92b2={};_0x3f92b2[_0xfa74('0x28')]=_[_0xfa74('0x2a')](db[_0xfa74('0x3c')]['rawAttributes']);_0x3f92b2[_0xfa74('0x2b')]=_[_0xfa74('0x2a')](_0x492c7d[_0xfa74('0x2b')]);_0x3f92b2[_0xfa74('0x2c')]=_[_0xfa74('0x2d')](_0x3f92b2['model'],_0x3f92b2[_0xfa74('0x2b')]);_0x3098ca[_0xfa74('0x2e')]=_[_0xfa74('0x2d')](_0x3f92b2[_0xfa74('0x28')],qs[_0xfa74('0x2f')](_0x492c7d[_0xfa74('0x2b')][_0xfa74('0x2f')]));_0x3098ca[_0xfa74('0x2e')]=_0x3098ca[_0xfa74('0x2e')][_0xfa74('0x40')]?_0x3098ca['attributes']:_0x3f92b2[_0xfa74('0x28')];if(_0x492c7d['query'][_0xfa74('0x3a')]){_0x3098ca[_0xfa74('0x3b')]=[{'all':!![]}];}_0x3098ca=_[_0xfa74('0x37')]({},_0x3098ca,_0x492c7d[_0xfa74('0x39')]);return db['Campaign'][_0xfa74('0x41')](_0x3098ca)[_0xfa74('0x21')](handleEntityNotFound(_0x95c891,null))['then'](respondWithResult(_0x95c891,null))[_0xfa74('0x42')](handleError(_0x95c891,null));};exports[_0xfa74('0x43')]=function(_0x5cbb70,_0x2be89f){return db[_0xfa74('0x3c')][_0xfa74('0x43')](_0x5cbb70[_0xfa74('0x44')],{})[_0xfa74('0x21')](function(_0x5e116b){var _0x54e06c=_0x5cbb70[_0xfa74('0x45')][_0xfa74('0x20')]({'plain':!![]});if(!_0x54e06c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54e06c[_0xfa74('0x46')]===_0xfa74('0x45')){var _0x3100f2=_0x5e116b['get']({'plain':!![]});var _0x4af9ea=_0xfa74('0x47');return db[_0xfa74('0x48')][_0xfa74('0x41')]({'where':{'name':_0x4af9ea,'userProfileId':_0x54e06c[_0xfa74('0x49')]},'raw':!![]})[_0xfa74('0x21')](function(_0x3cb23d){if(_0x3cb23d&&_0x3cb23d[_0xfa74('0x4a')]===0x0){return db[_0xfa74('0x4b')]['create']({'name':_0x3100f2[_0xfa74('0x23')],'resourceId':_0x3100f2['id'],'type':_0x3cb23d[_0xfa74('0x23')],'sectionId':_0x3cb23d['id']},{})[_0xfa74('0x21')](function(){return _0x5e116b;});}else{return _0x5e116b;}})[_0xfa74('0x42')](function(_0x569801){logger['error'](_0xfa74('0x4c'),_0x569801);throw _0x569801;});}return _0x5e116b;})['then'](respondWithResult(_0x2be89f,0xc9))[_0xfa74('0x42')](handleError(_0x2be89f,null));};exports[_0xfa74('0x4d')]=function(_0x427469,_0x33e31e){var _0x262f75={'where':{'id':_0x427469[_0xfa74('0x3f')]['id']}},_0x144c80={};_0x144c80['model']=_[_0xfa74('0x2a')](db['Campaign'][_0xfa74('0x25')]);_0x262f75['attributes']=_['intersection'](_0x144c80[_0xfa74('0x28')],qs[_0xfa74('0x2f')](_0x427469['query']['fields']));_0x262f75[_0xfa74('0x2e')]=_0x262f75[_0xfa74('0x2e')][_0xfa74('0x40')]?_0x262f75[_0xfa74('0x2e')]:_0x144c80[_0xfa74('0x28')];if(_0x427469[_0xfa74('0x2b')][_0xfa74('0x3a')]){_0x262f75[_0xfa74('0x3b')]=[{'all':!![]}];}_0x262f75=_[_0xfa74('0x37')]({},_0x262f75,_0x427469[_0xfa74('0x39')]);return db['Campaign'][_0xfa74('0x41')](_0x262f75)[_0xfa74('0x21')](handleEntityNotFound(_0x33e31e,null))['then'](function(_0x550974){if(_0x550974){var _0x3d88dc=_0x550974[_0xfa74('0x20')]({'plain':!![]});_0x3d88dc=qs[_0xfa74('0x4e')](_0x3d88dc,['id',_0xfa74('0x4f'),_0xfa74('0x50')]);_0x427469['body']=_[_0xfa74('0x4e')](_0x427469['body'],['id',_0xfa74('0x4f'),_0xfa74('0x50')]);return db[_0xfa74('0x3c')]['create'](_['merge'](_0x3d88dc,_0x427469[_0xfa74('0x44')]),{'include':_0x427469[_0xfa74('0x2b')][_0xfa74('0x3a')]?[{'all':!![]}]:undefined})[_0xfa74('0x21')](function(_0x53eca4){var _0xe87727=_0x427469[_0xfa74('0x45')]['get']({'plain':!![]});if(!_0xe87727)throw new Error(_0xfa74('0x51'));if(_0xe87727[_0xfa74('0x46')]===_0xfa74('0x45')){var _0x1681e7=_0x53eca4['get']({'plain':!![]});var _0x2e6eb7='IvrCampaigns';return db[_0xfa74('0x48')][_0xfa74('0x41')]({'where':{'name':_0x2e6eb7,'userProfileId':_0xe87727[_0xfa74('0x49')]},'raw':!![]})[_0xfa74('0x21')](function(_0x2230b4){if(_0x2230b4&&_0x2230b4[_0xfa74('0x4a')]===0x0){return db[_0xfa74('0x4b')][_0xfa74('0x43')]({'name':_0x1681e7[_0xfa74('0x23')],'resourceId':_0x1681e7['id'],'type':_0x2230b4[_0xfa74('0x23')],'sectionId':_0x2230b4['id']},{})[_0xfa74('0x21')](function(){return _0x53eca4;});}else{return _0x53eca4;}})[_0xfa74('0x42')](function(_0x42aafd){logger[_0xfa74('0x52')](_0xfa74('0x4c'),_0x42aafd);throw _0x42aafd;});}return _0x53eca4;});}})['then'](respondWithResult(_0x33e31e,0xc9))[_0xfa74('0x42')](handleError(_0x33e31e,null));};exports[_0xfa74('0x53')]=function(_0x5035dd,_0x57a923){if(_0x5035dd[_0xfa74('0x44')]['id']){delete _0x5035dd['body']['id'];}return db[_0xfa74('0x3c')][_0xfa74('0x41')]({'where':{'id':_0x5035dd[_0xfa74('0x3f')]['id']}})['then'](handleEntityNotFound(_0x57a923,null))[_0xfa74('0x21')](saveUpdates(_0x5035dd['body'],null))['then'](respondWithResult(_0x57a923,null))[_0xfa74('0x42')](handleError(_0x57a923,null));};exports[_0xfa74('0x1f')]=function(_0x1e3450,_0x414e31){return db[_0xfa74('0x3c')][_0xfa74('0x41')]({'where':{'id':_0x1e3450[_0xfa74('0x3f')]['id']}})[_0xfa74('0x21')](handleEntityNotFound(_0x414e31,null))[_0xfa74('0x21')](removeEntity(_0x414e31,null))[_0xfa74('0x42')](handleError(_0x414e31,null));};exports[_0xfa74('0x54')]=function(_0x4fde10,_0x3ed6e4,_0x5c8b0f){var _0x2a672d={'raw':!![],'where':{}};var _0x19189d={};var _0x15b586={'count':0x0,'rows':[]};return db['Campaign'][_0xfa74('0x55')]({'where':{'id':_0x4fde10[_0xfa74('0x3f')]['id']}})[_0xfa74('0x21')](handleEntityNotFound(_0x3ed6e4,null))['then'](function(_0x1b8c06){if(_0x1b8c06){_0x19189d[_0xfa74('0x28')]=_[_0xfa74('0x2a')](db[_0xfa74('0x56')][_0xfa74('0x25')]);_0x19189d['query']=_[_0xfa74('0x2a')](_0x4fde10[_0xfa74('0x2b')]);_0x19189d[_0xfa74('0x2c')]=_[_0xfa74('0x2d')](_0x19189d[_0xfa74('0x28')],_0x19189d[_0xfa74('0x2b')]);_0x2a672d[_0xfa74('0x2e')]=_[_0xfa74('0x2d')](_0x19189d[_0xfa74('0x28')],qs[_0xfa74('0x2f')](_0x4fde10[_0xfa74('0x2b')][_0xfa74('0x2f')]));_0x2a672d['attributes']=_0x2a672d[_0xfa74('0x2e')][_0xfa74('0x40')]?_0x2a672d[_0xfa74('0x2e')]:_0x19189d[_0xfa74('0x28')];if(!_0x4fde10[_0xfa74('0x2b')][_0xfa74('0x30')](_0xfa74('0x31'))){_0x2a672d[_0xfa74('0x1b')]=qs['limit'](_0x4fde10[_0xfa74('0x2b')][_0xfa74('0x1b')]);_0x2a672d[_0xfa74('0x1a')]=qs[_0xfa74('0x1a')](_0x4fde10['query'][_0xfa74('0x1a')]);}_0x2a672d[_0xfa74('0x32')]=qs[_0xfa74('0x33')](_0x4fde10[_0xfa74('0x2b')]['sort']);_0x2a672d[_0xfa74('0x34')]=qs['filters'](_['pick'](_0x4fde10[_0xfa74('0x2b')],_0x19189d['filters']));_0x2a672d[_0xfa74('0x34')][_0xfa74('0x57')]=_0x1b8c06['id'];if(_0x4fde10['query']['filter']){_0x2a672d[_0xfa74('0x34')]=_[_0xfa74('0x37')](_0x2a672d[_0xfa74('0x34')],{'$or':_[_0xfa74('0x29')](_0x2a672d['attributes'],function(_0x5acb9b){var _0x534f02={};_0x534f02[_0x5acb9b]={'$like':'%'+_0x4fde10[_0xfa74('0x2b')][_0xfa74('0x36')]+'%'};return _0x534f02;})});}_0x2a672d=_[_0xfa74('0x37')]({},_0x2a672d,_0x4fde10[_0xfa74('0x39')]);return db[_0xfa74('0x56')]['count']({'where':_0x2a672d[_0xfa74('0x34')]})[_0xfa74('0x21')](function(_0x33122d){_0x15b586[_0xfa74('0x19')]=_0x33122d;if(_0x4fde10[_0xfa74('0x2b')][_0xfa74('0x3a')]){_0x2a672d[_0xfa74('0x3b')]=[{'all':!![]}];}return db[_0xfa74('0x56')][_0xfa74('0x3d')](_0x2a672d);})['then'](function(_0x47ad3f){_0x15b586['rows']=_0x47ad3f;return _0x15b586;});}})[_0xfa74('0x21')](respondWithFilteredResult(_0x3ed6e4,_0x2a672d))[_0xfa74('0x42')](handleError(_0x3ed6e4,null));};exports[_0xfa74('0x58')]=function(_0x119604,_0x2f14b2,_0x533649){var _0x3e4323={'raw':!![],'where':{}};var _0x3ace03={};var _0x5d4ab4={'count':0x0,'rows':[]};return db[_0xfa74('0x3c')]['findOne']({'where':{'id':_0x119604[_0xfa74('0x3f')]['id']}})[_0xfa74('0x21')](handleEntityNotFound(_0x2f14b2,null))[_0xfa74('0x21')](function(_0x431573){if(_0x431573){_0x3ace03[_0xfa74('0x28')]=_[_0xfa74('0x2a')](db[_0xfa74('0x59')][_0xfa74('0x25')]);_0x3ace03['query']=_['keys'](_0x119604['query']);_0x3ace03[_0xfa74('0x2c')]=_[_0xfa74('0x2d')](_0x3ace03['model'],_0x3ace03[_0xfa74('0x2b')]);_0x3e4323[_0xfa74('0x2e')]=_[_0xfa74('0x2d')](_0x3ace03[_0xfa74('0x28')],qs['fields'](_0x119604[_0xfa74('0x2b')]['fields']));_0x3e4323['attributes']=_0x3e4323[_0xfa74('0x2e')][_0xfa74('0x40')]?_0x3e4323[_0xfa74('0x2e')]:_0x3ace03['model'];if(!_0x119604[_0xfa74('0x2b')][_0xfa74('0x30')]('nolimit')){_0x3e4323[_0xfa74('0x1b')]=qs['limit'](_0x119604['query']['limit']);_0x3e4323[_0xfa74('0x1a')]=qs[_0xfa74('0x1a')](_0x119604[_0xfa74('0x2b')][_0xfa74('0x1a')]);}_0x3e4323[_0xfa74('0x32')]=qs['sort'](_0x119604['query'][_0xfa74('0x33')]);_0x3e4323['where']=qs[_0xfa74('0x2c')](_[_0xfa74('0x35')](_0x119604[_0xfa74('0x2b')],_0x3ace03[_0xfa74('0x2c')]));_0x3e4323[_0xfa74('0x34')][_0xfa74('0x57')]=_0x431573['id'];if(_0x119604[_0xfa74('0x2b')][_0xfa74('0x36')]){_0x3e4323[_0xfa74('0x34')]=_['merge'](_0x3e4323[_0xfa74('0x34')],{'$or':_[_0xfa74('0x29')](_0x3e4323[_0xfa74('0x2e')],function(_0x1bd090){var _0x293eec={};_0x293eec[_0x1bd090]={'$like':'%'+_0x119604[_0xfa74('0x2b')][_0xfa74('0x36')]+'%'};return _0x293eec;})});}_0x3e4323=_[_0xfa74('0x37')]({},_0x3e4323,_0x119604[_0xfa74('0x39')]);return db[_0xfa74('0x59')][_0xfa74('0x19')]({'where':_0x3e4323['where']})['then'](function(_0x106534){_0x5d4ab4[_0xfa74('0x19')]=_0x106534;if(_0x119604[_0xfa74('0x2b')]['includeAll']){_0x3e4323['include']=[{'all':!![]}];}return db[_0xfa74('0x59')][_0xfa74('0x3d')](_0x3e4323);})[_0xfa74('0x21')](function(_0x3823dc){_0x5d4ab4[_0xfa74('0x3e')]=_0x3823dc;return _0x5d4ab4;});}})[_0xfa74('0x21')](respondWithFilteredResult(_0x2f14b2,_0x3e4323))[_0xfa74('0x42')](handleError(_0x2f14b2,null));};exports['getHopperFinals']=function(_0x41de25,_0x5ad3bd,_0x4a9a73){var _0x3d50af={'raw':!![],'where':{}};var _0x2a0982={};var _0x16b18f={'count':0x0,'rows':[]};return db['Campaign'][_0xfa74('0x55')]({'where':{'id':_0x41de25['params']['id']}})['then'](handleEntityNotFound(_0x5ad3bd,null))[_0xfa74('0x21')](function(_0x14046e){if(_0x14046e){_0x2a0982[_0xfa74('0x28')]=_[_0xfa74('0x2a')](db[_0xfa74('0x5a')][_0xfa74('0x25')]);_0x2a0982['query']=_[_0xfa74('0x2a')](_0x41de25[_0xfa74('0x2b')]);_0x2a0982['filters']=_[_0xfa74('0x2d')](_0x2a0982[_0xfa74('0x28')],_0x2a0982[_0xfa74('0x2b')]);_0x3d50af['attributes']=_[_0xfa74('0x2d')](_0x2a0982[_0xfa74('0x28')],qs['fields'](_0x41de25[_0xfa74('0x2b')][_0xfa74('0x2f')]));_0x3d50af[_0xfa74('0x2e')]=_0x3d50af['attributes'][_0xfa74('0x40')]?_0x3d50af['attributes']:_0x2a0982['model'];if(!_0x41de25[_0xfa74('0x2b')]['hasOwnProperty'](_0xfa74('0x31'))){_0x3d50af[_0xfa74('0x1b')]=qs[_0xfa74('0x1b')](_0x41de25[_0xfa74('0x2b')][_0xfa74('0x1b')]);_0x3d50af[_0xfa74('0x1a')]=qs[_0xfa74('0x1a')](_0x41de25[_0xfa74('0x2b')][_0xfa74('0x1a')]);}_0x3d50af[_0xfa74('0x32')]=qs['sort'](_0x41de25['query']['sort']);_0x3d50af['where']=qs[_0xfa74('0x2c')](_[_0xfa74('0x35')](_0x41de25['query'],_0x2a0982[_0xfa74('0x2c')]));_0x3d50af['where'][_0xfa74('0x57')]=_0x14046e['id'];if(_0x41de25[_0xfa74('0x2b')][_0xfa74('0x36')]){_0x3d50af[_0xfa74('0x34')]=_[_0xfa74('0x37')](_0x3d50af[_0xfa74('0x34')],{'$or':_[_0xfa74('0x29')](_0x3d50af[_0xfa74('0x2e')],function(_0x37fd85){var _0x3a2611={};_0x3a2611[_0x37fd85]={'$like':'%'+_0x41de25[_0xfa74('0x2b')]['filter']+'%'};return _0x3a2611;})});}_0x3d50af=_[_0xfa74('0x37')]({},_0x3d50af,_0x41de25['options']);return db[_0xfa74('0x5a')]['count']({'where':_0x3d50af[_0xfa74('0x34')]})[_0xfa74('0x21')](function(_0xbf723e){_0x16b18f['count']=_0xbf723e;if(_0x41de25[_0xfa74('0x2b')][_0xfa74('0x3a')]){_0x3d50af[_0xfa74('0x3b')]=[{'all':!![]}];}return db[_0xfa74('0x5a')][_0xfa74('0x3d')](_0x3d50af);})['then'](function(_0x17e39e){_0x16b18f[_0xfa74('0x3e')]=_0x17e39e;return _0x16b18f;});}})[_0xfa74('0x21')](respondWithFilteredResult(_0x5ad3bd,_0x3d50af))['catch'](handleError(_0x5ad3bd,null));};exports[_0xfa74('0x5b')]=function(_0x2f32a2,_0x5ac9ec,_0x450a97){var _0x18d905={'raw':!![],'where':{}};var _0x1acc48={};var _0x900248={'count':0x0,'rows':[]};return db[_0xfa74('0x3c')][_0xfa74('0x55')]({'where':{'id':_0x2f32a2['params']['id']}})[_0xfa74('0x21')](handleEntityNotFound(_0x5ac9ec,null))[_0xfa74('0x21')](function(_0x1042ff){if(_0x1042ff){_0x1acc48[_0xfa74('0x28')]=_[_0xfa74('0x2a')](db[_0xfa74('0x5c')][_0xfa74('0x25')]);_0x1acc48[_0xfa74('0x2b')]=_['keys'](_0x2f32a2[_0xfa74('0x2b')]);_0x1acc48['filters']=_[_0xfa74('0x2d')](_0x1acc48['model'],_0x1acc48[_0xfa74('0x2b')]);_0x18d905[_0xfa74('0x2e')]=_[_0xfa74('0x2d')](_0x1acc48['model'],qs[_0xfa74('0x2f')](_0x2f32a2['query'][_0xfa74('0x2f')]));_0x18d905[_0xfa74('0x2e')]=_0x18d905[_0xfa74('0x2e')][_0xfa74('0x40')]?_0x18d905['attributes']:_0x1acc48[_0xfa74('0x28')];if(!_0x2f32a2[_0xfa74('0x2b')][_0xfa74('0x30')](_0xfa74('0x31'))){_0x18d905[_0xfa74('0x1b')]=qs[_0xfa74('0x1b')](_0x2f32a2[_0xfa74('0x2b')][_0xfa74('0x1b')]);_0x18d905[_0xfa74('0x1a')]=qs[_0xfa74('0x1a')](_0x2f32a2[_0xfa74('0x2b')]['offset']);}_0x18d905[_0xfa74('0x32')]=qs[_0xfa74('0x33')](_0x2f32a2[_0xfa74('0x2b')]['sort']);_0x18d905[_0xfa74('0x34')]=qs[_0xfa74('0x2c')](_['pick'](_0x2f32a2[_0xfa74('0x2b')],_0x1acc48[_0xfa74('0x2c')]));_0x18d905[_0xfa74('0x34')]['CampaignId']=_0x1042ff['id'];if(_0x2f32a2['query'][_0xfa74('0x36')]){_0x18d905[_0xfa74('0x34')]=_[_0xfa74('0x37')](_0x18d905['where'],{'$or':_[_0xfa74('0x29')](_0x18d905['attributes'],function(_0x25f332){var _0x13a69f={};_0x13a69f[_0x25f332]={'$like':'%'+_0x2f32a2[_0xfa74('0x2b')][_0xfa74('0x36')]+'%'};return _0x13a69f;})});}_0x18d905=_[_0xfa74('0x37')]({},_0x18d905,_0x2f32a2['options']);return db[_0xfa74('0x5c')][_0xfa74('0x19')]({'where':_0x18d905[_0xfa74('0x34')]})[_0xfa74('0x21')](function(_0x5a2552){_0x900248[_0xfa74('0x19')]=_0x5a2552;if(_0x2f32a2[_0xfa74('0x2b')]['includeAll']){_0x18d905[_0xfa74('0x3b')]=[{'all':!![]}];}return db[_0xfa74('0x5c')][_0xfa74('0x3d')](_0x18d905);})[_0xfa74('0x21')](function(_0x3768e2){_0x900248[_0xfa74('0x3e')]=_0x3768e2;return _0x900248;});}})[_0xfa74('0x21')](respondWithFilteredResult(_0x5ac9ec,_0x18d905))[_0xfa74('0x42')](handleError(_0x5ac9ec,null));};exports[_0xfa74('0x5d')]=function(_0x33b706,_0x1726ae,_0x38e45d){var _0x25f917={};var _0x14b2f6={};var _0x5052f0;var _0x397fdb;return db[_0xfa74('0x3c')][_0xfa74('0x55')]({'where':{'id':_0x33b706['params']['id']}})[_0xfa74('0x21')](handleEntityNotFound(_0x1726ae,null))['then'](function(_0x155518){if(_0x155518){_0x5052f0=_0x155518;_0x14b2f6[_0xfa74('0x28')]=_[_0xfa74('0x2a')](db[_0xfa74('0x5e')][_0xfa74('0x25')]);_0x14b2f6['query']=_['keys'](_0x33b706[_0xfa74('0x2b')]);_0x14b2f6[_0xfa74('0x2c')]=_[_0xfa74('0x2d')](_0x14b2f6[_0xfa74('0x28')],_0x14b2f6[_0xfa74('0x2b')]);_0x25f917[_0xfa74('0x2e')]=_[_0xfa74('0x2d')](_0x14b2f6[_0xfa74('0x28')],qs[_0xfa74('0x2f')](_0x33b706['query']['fields']));_0x25f917[_0xfa74('0x2e')]=_0x25f917[_0xfa74('0x2e')][_0xfa74('0x40')]?_0x25f917[_0xfa74('0x2e')]:_0x14b2f6[_0xfa74('0x28')];_0x25f917[_0xfa74('0x32')]=qs['sort'](_0x33b706[_0xfa74('0x2b')][_0xfa74('0x33')]);_0x25f917['where']=qs[_0xfa74('0x2c')](_[_0xfa74('0x35')](_0x33b706[_0xfa74('0x2b')],_0x14b2f6[_0xfa74('0x2c')]));if(_0x33b706['query'][_0xfa74('0x36')]){_0x25f917[_0xfa74('0x34')]=_[_0xfa74('0x37')](_0x25f917['where'],{'$or':_[_0xfa74('0x29')](_0x25f917[_0xfa74('0x2e')],function(_0x20d7d0){var _0x4a64a7={};_0x4a64a7[_0x20d7d0]={'$like':'%'+_0x33b706[_0xfa74('0x2b')]['filter']+'%'};return _0x4a64a7;})});}_0x25f917=_[_0xfa74('0x37')]({},_0x25f917,_0x33b706['options']);return _0x5052f0[_0xfa74('0x5d')](_0x25f917);}})[_0xfa74('0x21')](function(_0x285b0c){if(_0x285b0c){_0x397fdb=_0x285b0c[_0xfa74('0x40')];if(!_0x33b706[_0xfa74('0x2b')][_0xfa74('0x30')](_0xfa74('0x31'))){_0x25f917[_0xfa74('0x1b')]=qs[_0xfa74('0x1b')](_0x33b706[_0xfa74('0x2b')]['limit']);_0x25f917[_0xfa74('0x1a')]=qs[_0xfa74('0x1a')](_0x33b706[_0xfa74('0x2b')][_0xfa74('0x1a')]);}return _0x5052f0[_0xfa74('0x5d')](_0x25f917);}})['then'](function(_0xe32ec7){if(_0xe32ec7){return _0xe32ec7?{'count':_0x397fdb,'rows':_0xe32ec7}:null;}})[_0xfa74('0x21')](respondWithResult(_0x1726ae,null))['catch'](handleError(_0x1726ae,null));};exports[_0xfa74('0x5f')]=function(_0x33f55b,_0x4d4a92,_0x2c32fd){var _0x44f45a,_0x534810;return db['Campaign'][_0xfa74('0x41')]({'where':{'id':_0x33f55b[_0xfa74('0x3f')]['id']}})[_0xfa74('0x21')](handleEntityNotFound(_0x4d4a92,null))['then'](function(_0x44dec0){if(_0x44dec0){_0x534810=_0x44dec0;return _0x44dec0[_0xfa74('0x5f')](_0x33f55b[_0xfa74('0x44')]['ids'],_[_0xfa74('0x4e')](_0x33f55b[_0xfa74('0x44')],[_0xfa74('0x60'),'id'])||{});}return null;})[_0xfa74('0x61')](function(_0x42c0bd){var _0x5222b8;_0x44f45a=_0x42c0bd||[];var _0xced7ad=[];if(_0x42c0bd){for(var _0x377c0e=0x0;_0x377c0e<_0x42c0bd[_0xfa74('0x40')];_0x377c0e+=0x1){var _0x4ae63e=_0x42c0bd[_0x377c0e][_0xfa74('0x20')]({'plain':!![]});_0x534810[_0xfa74('0x62')]=_0x33f55b[_0xfa74('0x44')][_0xfa74('0x62')]?_0x33f55b[_0xfa74('0x44')][_0xfa74('0x62')]:_0x534810['dialCheckDuplicateType'];switch(_0x534810[_0xfa74('0x62')]){case _0xfa74('0x63'):_0x5222b8=squel[_0xfa74('0x64')]()['into'](_0xfa74('0x65'))[_0xfa74('0x66')]([_0xfa74('0x67'),'scheduledAt','ContactId','ListId',_0xfa74('0x57'),'createdAt',_0xfa74('0x50')],squel[_0xfa74('0x68')]()['field'](_0xfa74('0x67'),_0xfa74('0x67'))[_0xfa74('0x69')](_0xfa74('0x6a'),_0xfa74('0x6b'))[_0xfa74('0x69')]('id','ContactId')[_0xfa74('0x69')](_0x4ae63e[_0xfa74('0x6c')]['toString'](),_0xfa74('0x6d'))['field'](_0x33f55b[_0xfa74('0x3f')]['id'][_0xfa74('0x6e')](),'CampaignId')[_0xfa74('0x69')](_0xfa74('0x6a'),_0xfa74('0x4f'))[_0xfa74('0x69')]('NOW()',_0xfa74('0x50'))[_0xfa74('0x6f')]('cm_contacts')[_0xfa74('0x34')](_0xfa74('0x70'))[_0xfa74('0x34')](_0xfa74('0x71'),_0x4ae63e['CmListId']['toString']())[_0xfa74('0x34')]('phone\x20IS\x20NOT\x20NULL')[_0xfa74('0x34')]('phone\x20NOT\x20IN\x20(?)',squel[_0xfa74('0x68')]()[_0xfa74('0x69')](_0xfa74('0x72'))[_0xfa74('0x6f')]('cm_hopper_final')[_0xfa74('0x34')](_0xfa74('0x73'),_0x33f55b[_0xfa74('0x3f')]['id'][_0xfa74('0x6e')]()))[_0xfa74('0x34')](_0xfa74('0x74'),squel[_0xfa74('0x68')]()['field'](_0xfa74('0x75'))[_0xfa74('0x6f')](_0xfa74('0x65'))[_0xfa74('0x34')](_0xfa74('0x73'),_0x33f55b[_0xfa74('0x3f')]['id'][_0xfa74('0x6e')]())))[_0xfa74('0x6e')]();break;case _0xfa74('0x76'):_0x5222b8=squel[_0xfa74('0x64')]()[_0xfa74('0x77')](_0xfa74('0x65'))[_0xfa74('0x66')](['phone',_0xfa74('0x6b'),'ContactId',_0xfa74('0x6d'),_0xfa74('0x57'),'createdAt',_0xfa74('0x50')],squel[_0xfa74('0x68')]()[_0xfa74('0x69')]('phone',_0xfa74('0x67'))[_0xfa74('0x69')](_0xfa74('0x6a'),_0xfa74('0x6b'))[_0xfa74('0x69')]('id','ContactId')[_0xfa74('0x69')](_0x4ae63e['CmListId']['toString'](),_0xfa74('0x6d'))[_0xfa74('0x69')](_0x33f55b[_0xfa74('0x3f')]['id']['toString'](),'CampaignId')[_0xfa74('0x69')](_0xfa74('0x6a'),_0xfa74('0x4f'))[_0xfa74('0x69')](_0xfa74('0x6a'),'updatedAt')[_0xfa74('0x6f')](_0xfa74('0x78'))['where'](_0xfa74('0x70'))[_0xfa74('0x34')]('ListId\x20=\x20?',_0x4ae63e[_0xfa74('0x6c')]['toString']())[_0xfa74('0x34')](_0xfa74('0x79'))[_0xfa74('0x34')](_0xfa74('0x74'),squel[_0xfa74('0x68')]()['field'](_0xfa74('0x75'))[_0xfa74('0x6f')](_0xfa74('0x65'))[_0xfa74('0x34')]('CampaignId\x20=\x20?',_0x33f55b['params']['id'][_0xfa74('0x6e')]())))['toString']();break;default:_0x5222b8=squel[_0xfa74('0x64')]()[_0xfa74('0x77')](_0xfa74('0x65'))[_0xfa74('0x66')](['phone',_0xfa74('0x6b'),'ContactId',_0xfa74('0x6d'),_0xfa74('0x57'),_0xfa74('0x4f'),_0xfa74('0x50')],squel[_0xfa74('0x68')]()['field'](_0xfa74('0x67'),'phone')[_0xfa74('0x69')]('NOW()',_0xfa74('0x6b'))['field']('id',_0xfa74('0x7a'))['field'](_0x4ae63e[_0xfa74('0x6c')]['toString'](),_0xfa74('0x6d'))[_0xfa74('0x69')](_0x33f55b[_0xfa74('0x3f')]['id']['toString'](),'CampaignId')[_0xfa74('0x69')](_0xfa74('0x6a'),_0xfa74('0x4f'))[_0xfa74('0x69')]('NOW()',_0xfa74('0x50'))[_0xfa74('0x6f')](_0xfa74('0x78'))['where'](_0xfa74('0x70'))[_0xfa74('0x34')](_0xfa74('0x71'),_0x4ae63e[_0xfa74('0x6c')]['toString']())[_0xfa74('0x34')](_0xfa74('0x79')))[_0xfa74('0x6e')]();}_0xced7ad[_0xfa74('0x7b')](db['sequelize']['query'](_0x5222b8));}return BPromise[_0xfa74('0x7c')](_0xced7ad);}})['then'](function(){return _0x44f45a;})['then'](respondWithResult(_0x4d4a92,null))['catch'](handleError(_0x4d4a92,null));};exports['removeLists']=function(_0x43b948,_0x21e930,_0x9533bb){return db[_0xfa74('0x3c')][_0xfa74('0x41')]({'where':{'id':_0x43b948[_0xfa74('0x3f')]['id']}})[_0xfa74('0x21')](handleEntityNotFound(_0x21e930,null))[_0xfa74('0x21')](function(_0x4229d8){if(_0x4229d8){return _0x4229d8[_0xfa74('0x7d')](_0x43b948[_0xfa74('0x2b')]['ids']);}})[_0xfa74('0x21')](function(_0x2684c4){if(_0x2684c4){return db[_0xfa74('0x56')]['destroy']({'where':{'ListId':_0x43b948[_0xfa74('0x2b')][_0xfa74('0x60')],'CampaignId':_0x43b948[_0xfa74('0x3f')]['id']}})[_0xfa74('0x21')](function(){return _0x2684c4;});}})[_0xfa74('0x21')](respondWithStatusCode(_0x21e930,null))['catch'](handleError(_0x21e930,null));};exports['getBlackLists']=function(_0x10a6ed,_0x15da40,_0x4f4a9d){var _0x1f3c77={'raw':!![],'where':{}};var _0x10c33c={};var _0x2e6b73={'count':0x0,'rows':[]};return db[_0xfa74('0x3c')][_0xfa74('0x55')]({'where':{'id':_0x10a6ed['params']['id']}})[_0xfa74('0x21')](handleEntityNotFound(_0x15da40,null))[_0xfa74('0x21')](function(_0x1765e4){if(_0x1765e4){_0x10c33c[_0xfa74('0x28')]=_[_0xfa74('0x2a')](db['CmList']['rawAttributes']);_0x10c33c[_0xfa74('0x2b')]=_[_0xfa74('0x2a')](_0x10a6ed['query']);_0x10c33c[_0xfa74('0x2c')]=_[_0xfa74('0x2d')](_0x10c33c[_0xfa74('0x28')],_0x10c33c[_0xfa74('0x2b')]);_0x1f3c77[_0xfa74('0x2e')]=_[_0xfa74('0x2d')](_0x10c33c['model'],qs[_0xfa74('0x2f')](_0x10a6ed['query'][_0xfa74('0x2f')]));_0x1f3c77['attributes']=_0x1f3c77['attributes'][_0xfa74('0x40')]?_0x1f3c77[_0xfa74('0x2e')]:_0x10c33c[_0xfa74('0x28')];if(!_0x10a6ed[_0xfa74('0x2b')]['hasOwnProperty'](_0xfa74('0x31'))){_0x1f3c77[_0xfa74('0x1b')]=qs[_0xfa74('0x1b')](_0x10a6ed[_0xfa74('0x2b')][_0xfa74('0x1b')]);_0x1f3c77[_0xfa74('0x1a')]=qs[_0xfa74('0x1a')](_0x10a6ed[_0xfa74('0x2b')][_0xfa74('0x1a')]);}_0x1f3c77[_0xfa74('0x32')]=qs[_0xfa74('0x33')](_0x10a6ed[_0xfa74('0x2b')][_0xfa74('0x33')]);_0x1f3c77['where']=qs[_0xfa74('0x2c')](_[_0xfa74('0x35')](_0x10a6ed['query'],_0x10c33c[_0xfa74('0x2c')]));_0x1f3c77[_0xfa74('0x34')][_0xfa74('0x57')]=_0x1765e4['id'];if(_0x10a6ed[_0xfa74('0x2b')][_0xfa74('0x36')]){_0x1f3c77[_0xfa74('0x34')]=_[_0xfa74('0x37')](_0x1f3c77[_0xfa74('0x34')],{'$or':_[_0xfa74('0x29')](_0x1f3c77[_0xfa74('0x2e')],function(_0x47e509){var _0x3d7de6={};_0x3d7de6[_0x47e509]={'$like':'%'+_0x10a6ed[_0xfa74('0x2b')][_0xfa74('0x36')]+'%'};return _0x3d7de6;})});}_0x1f3c77=_[_0xfa74('0x37')]({},_0x1f3c77,_0x10a6ed[_0xfa74('0x39')]);return db[_0xfa74('0x5e')][_0xfa74('0x19')]({'where':_0x1f3c77[_0xfa74('0x34')]})[_0xfa74('0x21')](function(_0xa4f5ee){_0x2e6b73[_0xfa74('0x19')]=_0xa4f5ee;if(_0x10a6ed[_0xfa74('0x2b')][_0xfa74('0x3a')]){_0x1f3c77[_0xfa74('0x3b')]=[{'all':!![]}];}return db[_0xfa74('0x5e')]['findAll'](_0x1f3c77);})[_0xfa74('0x21')](function(_0x164aad){_0x2e6b73['rows']=_0x164aad;return _0x2e6b73;});}})[_0xfa74('0x21')](respondWithFilteredResult(_0x15da40,_0x1f3c77))[_0xfa74('0x42')](handleError(_0x15da40,null));};exports[_0xfa74('0x7e')]=function(_0x24ad29,_0x288975,_0x22e125){var _0x1488cd,_0x148c39;return db[_0xfa74('0x3c')][_0xfa74('0x41')]({'where':{'id':_0x24ad29[_0xfa74('0x3f')]['id']}})['then'](handleEntityNotFound(_0x288975,null))[_0xfa74('0x21')](function(_0x900ae7){if(_0x900ae7){_0x148c39=_0x900ae7;return _0x900ae7[_0xfa74('0x7e')](_0x24ad29[_0xfa74('0x44')][_0xfa74('0x60')],_[_0xfa74('0x4e')](_0x24ad29[_0xfa74('0x44')],[_0xfa74('0x60'),'id'])||{});}return null;})[_0xfa74('0x61')](function(_0x44c13a){var _0x420638;_0x1488cd=_0x44c13a||[];var _0x1168f1=[];if(_0x44c13a){for(var _0x41391a=0x0;_0x41391a<_0x44c13a[_0xfa74('0x40')];_0x41391a+=0x1){var _0x41eb6b=_0x44c13a[_0x41391a][_0xfa74('0x20')]({'plain':!![]});_0x420638=squel[_0xfa74('0x64')]()[_0xfa74('0x77')](_0xfa74('0x7f'))['fromQuery']([_0xfa74('0x67'),_0xfa74('0x7a'),_0xfa74('0x6d'),_0xfa74('0x57'),'createdAt',_0xfa74('0x50')],squel[_0xfa74('0x68')]()['field'](_0xfa74('0x67'),_0xfa74('0x67'))['field']('id',_0xfa74('0x7a'))[_0xfa74('0x69')](_0x41eb6b[_0xfa74('0x6c')][_0xfa74('0x6e')](),'ListId')['field'](_0x24ad29[_0xfa74('0x3f')]['id'][_0xfa74('0x6e')](),'CampaignId')[_0xfa74('0x69')](_0xfa74('0x6a'),_0xfa74('0x4f'))[_0xfa74('0x69')](_0xfa74('0x6a'),_0xfa74('0x50'))[_0xfa74('0x6f')]('cm_contacts')['where'](_0xfa74('0x70'))[_0xfa74('0x34')]('ListId\x20=\x20?',_0x41eb6b[_0xfa74('0x6c')][_0xfa74('0x6e')]())[_0xfa74('0x34')](_0xfa74('0x79')))['toString']();_0x1168f1['push'](db[_0xfa74('0x80')][_0xfa74('0x2b')](_0x420638));}return BPromise[_0xfa74('0x7c')](_0x1168f1);}})['then'](function(){return _0x1488cd;})[_0xfa74('0x21')](respondWithResult(_0x288975,null))[_0xfa74('0x42')](handleError(_0x288975,null));};exports[_0xfa74('0x81')]=function(_0x9a8e1a,_0x26c49a,_0x2cbaa8){return db[_0xfa74('0x3c')][_0xfa74('0x41')]({'where':{'id':_0x9a8e1a[_0xfa74('0x3f')]['id']}})[_0xfa74('0x21')](handleEntityNotFound(_0x26c49a,null))[_0xfa74('0x21')](function(_0x476d1b){if(_0x476d1b){return _0x476d1b[_0xfa74('0x81')](_0x9a8e1a[_0xfa74('0x2b')][_0xfa74('0x60')]);}})[_0xfa74('0x21')](function(_0x129c20){if(_0x129c20){return db[_0xfa74('0x5c')][_0xfa74('0x1f')]({'where':{'ListId':_0x9a8e1a[_0xfa74('0x2b')][_0xfa74('0x60')],'CampaignId':_0x9a8e1a[_0xfa74('0x3f')]['id']}})[_0xfa74('0x21')](function(){return _0x129c20;});}})[_0xfa74('0x21')](respondWithStatusCode(_0x26c49a,null))[_0xfa74('0x42')](handleError(_0x26c49a,null));}; \ No newline at end of file +var _0x668b=['CmHopper','order','pick','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','push','sequelize','removeBlackLists','html-pdf','eml-format','zip-dir','fast-json-patch','moment','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','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','update','then','get','IvrCampaigns','UserProfileResource','destroy','error','name','map','Campaign','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','rawAttributes','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','updatedAt','omit','create','getHoppers','findOne'];(function(_0x1deee5,_0x1d4485){var _0x1d6c3a=function(_0x433abf){while(--_0x433abf){_0x1deee5['push'](_0x1deee5['shift']());}};_0x1d6c3a(++_0x1d4485);}(_0x668b,0x140));var _0xb668=function(_0x2f227c,_0x360c3a){_0x2f227c=_0x2f227c-0x0;var _0x5032bc=_0x668b[_0x2f227c];return _0x5032bc;};'use strict';var pdf=require(_0xb668('0x0'));var emlformat=require(_0xb668('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb668('0x2'));var jsonpatch=require(_0xb668('0x3'));var rp=require('request-promise');var moment=require(_0xb668('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb668('0x5'));var util=require(_0xb668('0x6'));var path=require(_0xb668('0x7'));var sox=require('sox');var csv=require(_0xb668('0x8'));var ejs=require(_0xb668('0x9'));var fs=require('fs');var _=require(_0xb668('0xa'));var squel=require(_0xb668('0xb'));var crypto=require(_0xb668('0xc'));var jsforce=require(_0xb668('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb668('0x8'));var querystring=require(_0xb668('0xe'));var Papa=require(_0xb668('0xf'));var Redis=require(_0xb668('0x10'));var authService=require(_0xb668('0x11'));var qs=require(_0xb668('0x12'));var as=require(_0xb668('0x13'));var hardwareService=require(_0xb668('0x14'));var logger=require('../../config/logger')(_0xb668('0x15'));var utils=require(_0xb668('0x16'));var config=require(_0xb668('0x17'));var db=require(_0xb668('0x18'))['db'];function respondWithStatusCode(_0x16ca75,_0x167057){_0x167057=_0x167057||0xcc;return function(_0x1d111a){if(_0x1d111a){return _0x16ca75[_0xb668('0x19')](_0x167057);}return _0x16ca75[_0xb668('0x1a')](_0x167057)[_0xb668('0x1b')]();};}function respondWithResult(_0x1af935,_0x3b7556){_0x3b7556=_0x3b7556||0xc8;return function(_0x3aed25){if(_0x3aed25){return _0x1af935[_0xb668('0x1a')](_0x3b7556)[_0xb668('0x1c')](_0x3aed25);}};}function respondWithFilteredResult(_0x3b0c84,_0x1ca6e7){return function(_0x222cad){if(_0x222cad){var _0x4fa32a=_0x222cad['count'],_0x4a755b=_0x1ca6e7[_0xb668('0x1d')],_0xd3e39f=_0x1ca6e7['offset']+_0x1ca6e7[_0xb668('0x1e')],_0x27bbfa;if(_0xd3e39f>=_0x4fa32a){_0xd3e39f=_0x4fa32a;_0x27bbfa=0xc8;}else{_0x27bbfa=0xce;}_0x3b0c84[_0xb668('0x1a')](_0x27bbfa);return _0x3b0c84['set'](_0xb668('0x1f'),_0x4a755b+'-'+_0xd3e39f+'/'+_0x4fa32a)[_0xb668('0x1c')](_0x222cad);}return null;};}function patchUpdates(_0x53ff78){return function(_0x458c6a){try{jsonpatch['apply'](_0x458c6a,_0x53ff78,!![]);}catch(_0x12fb3f){return BPromise[_0xb668('0x20')](_0x12fb3f);}return _0x458c6a[_0xb668('0x21')]();};}function saveUpdates(_0x12805a,_0x5d33ae){return function(_0x2b7f96){if(_0x2b7f96){return _0x2b7f96[_0xb668('0x22')](_0x12805a)[_0xb668('0x23')](function(_0x52de83){return _0x52de83;});}return null;};}function removeEntity(_0x5a2f74,_0x43a70b){return function(_0x1e5620){if(_0x1e5620){return _0x1e5620['destroy']()[_0xb668('0x23')](function(){var _0x4bf863=_0x1e5620[_0xb668('0x24')]({'plain':!![]});var _0x4bd365=_0xb668('0x25');return db[_0xb668('0x26')][_0xb668('0x27')]({'where':{'type':_0x4bd365,'resourceId':_0x4bf863['id']}})[_0xb668('0x23')](function(){return _0x1e5620;});})[_0xb668('0x23')](function(){_0x5a2f74[_0xb668('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23084d,_0x10d767){return function(_0x2ab8c2){if(!_0x2ab8c2){_0x23084d['sendStatus'](0x194);}return _0x2ab8c2;};}function handleError(_0x5e0cee,_0xe62fce){_0xe62fce=_0xe62fce||0x1f4;return function(_0x2a826d){logger[_0xb668('0x28')](_0x2a826d['stack']);if(_0x2a826d[_0xb668('0x29')]){delete _0x2a826d[_0xb668('0x29')];}_0x5e0cee[_0xb668('0x1a')](_0xe62fce)['send'](_0x2a826d);};}exports['index']=function(_0x12919c,_0x2619a4){var _0x589c58={},_0x2e5857={},_0x1791ff={'count':0x0,'rows':[]};var _0x26918a=_[_0xb668('0x2a')](db[_0xb668('0x2b')]['rawAttributes'],function(_0x138ee5){return{'name':_0x138ee5[_0xb668('0x2c')],'type':_0x138ee5['type'][_0xb668('0x2d')]};});_0x2e5857['model']=_[_0xb668('0x2a')](_0x26918a,_0xb668('0x29'));_0x2e5857[_0xb668('0x2e')]=_[_0xb668('0x2f')](_0x12919c[_0xb668('0x2e')]);_0x2e5857[_0xb668('0x30')]=_[_0xb668('0x31')](_0x2e5857[_0xb668('0x32')],_0x2e5857[_0xb668('0x2e')]);_0x589c58['attributes']=_[_0xb668('0x31')](_0x2e5857[_0xb668('0x32')],qs[_0xb668('0x33')](_0x12919c['query'][_0xb668('0x33')]));_0x589c58[_0xb668('0x34')]=_0x589c58[_0xb668('0x34')][_0xb668('0x35')]?_0x589c58['attributes']:_0x2e5857[_0xb668('0x32')];if(!_0x12919c[_0xb668('0x2e')][_0xb668('0x36')](_0xb668('0x37'))){_0x589c58[_0xb668('0x1e')]=qs[_0xb668('0x1e')](_0x12919c[_0xb668('0x2e')]['limit']);_0x589c58[_0xb668('0x1d')]=qs[_0xb668('0x1d')](_0x12919c['query'][_0xb668('0x1d')]);}_0x589c58['order']=qs['sort'](_0x12919c[_0xb668('0x2e')][_0xb668('0x38')]);_0x589c58['where']=qs[_0xb668('0x30')](_['pick'](_0x12919c[_0xb668('0x2e')],_0x2e5857['filters']));if(_0x12919c['query'][_0xb668('0x39')]){_0x589c58[_0xb668('0x3a')]=_['merge'](_0x589c58['where'],{'$or':_[_0xb668('0x2a')](_0x26918a,function(_0x32bc61){if(_0x32bc61[_0xb668('0x3b')]!==_0xb668('0x3c')){var _0xdd79f5={};_0xdd79f5[_0x32bc61['name']]={'$like':'%'+_0x12919c['query'][_0xb668('0x39')]+'%'};return _0xdd79f5;}})});}_0x589c58=_[_0xb668('0x3d')]({},_0x589c58,_0x12919c[_0xb668('0x3e')]);var _0x38d9c9={'where':_0x589c58[_0xb668('0x3a')]};return db[_0xb668('0x2b')]['count'](_0x38d9c9)['then'](function(_0x2715a4){_0x1791ff[_0xb668('0x3f')]=_0x2715a4;if(_0x12919c[_0xb668('0x2e')][_0xb668('0x40')]){_0x589c58[_0xb668('0x41')]=[{'all':!![]}];}return db['Campaign'][_0xb668('0x42')](_0x589c58);})[_0xb668('0x23')](function(_0x503b33){_0x1791ff[_0xb668('0x43')]=_0x503b33;return _0x1791ff;})[_0xb668('0x23')](respondWithFilteredResult(_0x2619a4,_0x589c58))[_0xb668('0x44')](handleError(_0x2619a4,null));};exports[_0xb668('0x45')]=function(_0x5273e8,_0x583a61){var _0x4b7192={'raw':![],'where':{'id':_0x5273e8['params']['id']}},_0x311c59={};_0x311c59['model']=_['keys'](db['Campaign'][_0xb668('0x46')]);_0x311c59['query']=_[_0xb668('0x2f')](_0x5273e8[_0xb668('0x2e')]);_0x311c59[_0xb668('0x30')]=_[_0xb668('0x31')](_0x311c59[_0xb668('0x32')],_0x311c59['query']);_0x4b7192[_0xb668('0x34')]=_[_0xb668('0x31')](_0x311c59[_0xb668('0x32')],qs[_0xb668('0x33')](_0x5273e8[_0xb668('0x2e')][_0xb668('0x33')]));_0x4b7192[_0xb668('0x34')]=_0x4b7192[_0xb668('0x34')][_0xb668('0x35')]?_0x4b7192[_0xb668('0x34')]:_0x311c59[_0xb668('0x32')];if(_0x5273e8['query'][_0xb668('0x40')]){_0x4b7192[_0xb668('0x41')]=[{'all':!![]}];}_0x4b7192=_[_0xb668('0x3d')]({},_0x4b7192,_0x5273e8['options']);return db['Campaign'][_0xb668('0x47')](_0x4b7192)['then'](handleEntityNotFound(_0x583a61,null))[_0xb668('0x23')](respondWithResult(_0x583a61,null))['catch'](handleError(_0x583a61,null));};exports['create']=function(_0x4e2853,_0x470415){return db[_0xb668('0x2b')]['create'](_0x4e2853[_0xb668('0x48')],{})[_0xb668('0x23')](function(_0x1a7936){var _0x1b649f=_0x4e2853[_0xb668('0x49')][_0xb668('0x24')]({'plain':!![]});if(!_0x1b649f)throw new Error(_0xb668('0x4a'));if(_0x1b649f[_0xb668('0x4b')]===_0xb668('0x49')){var _0x4065f7=_0x1a7936['get']({'plain':!![]});var _0x3c6c8a=_0xb668('0x25');return db[_0xb668('0x4c')][_0xb668('0x47')]({'where':{'name':_0x3c6c8a,'userProfileId':_0x1b649f[_0xb668('0x4d')]},'raw':!![]})[_0xb668('0x23')](function(_0x381694){if(_0x381694&&_0x381694[_0xb668('0x4e')]===0x0){return db[_0xb668('0x26')]['create']({'name':_0x4065f7[_0xb668('0x29')],'resourceId':_0x4065f7['id'],'type':_0x381694[_0xb668('0x29')],'sectionId':_0x381694['id']},{})[_0xb668('0x23')](function(){return _0x1a7936;});}else{return _0x1a7936;}})['catch'](function(_0x5c4e1a){logger[_0xb668('0x28')](_0xb668('0x4f'),_0x5c4e1a);throw _0x5c4e1a;});}return _0x1a7936;})[_0xb668('0x23')](respondWithResult(_0x470415,0xc9))['catch'](handleError(_0x470415,null));};exports[_0xb668('0x50')]=function(_0x5ad4cd,_0x51a5d3){var _0x36667a={'where':{'id':_0x5ad4cd[_0xb668('0x51')]['id']}},_0x100fcf={};_0x100fcf[_0xb668('0x32')]=_[_0xb668('0x2f')](db[_0xb668('0x2b')][_0xb668('0x46')]);_0x36667a[_0xb668('0x34')]=_[_0xb668('0x31')](_0x100fcf[_0xb668('0x32')],qs[_0xb668('0x33')](_0x5ad4cd[_0xb668('0x2e')][_0xb668('0x33')]));_0x36667a[_0xb668('0x34')]=_0x36667a[_0xb668('0x34')][_0xb668('0x35')]?_0x36667a[_0xb668('0x34')]:_0x100fcf[_0xb668('0x32')];if(_0x5ad4cd[_0xb668('0x2e')][_0xb668('0x40')]){_0x36667a[_0xb668('0x41')]=[{'all':!![]}];}_0x36667a=_[_0xb668('0x3d')]({},_0x36667a,_0x5ad4cd[_0xb668('0x3e')]);return db[_0xb668('0x2b')][_0xb668('0x47')](_0x36667a)[_0xb668('0x23')](handleEntityNotFound(_0x51a5d3,null))[_0xb668('0x23')](function(_0x46abfb){if(_0x46abfb){var _0x3368a6=_0x46abfb[_0xb668('0x24')]({'plain':!![]});_0x3368a6=qs['omit'](_0x3368a6,['id',_0xb668('0x52'),_0xb668('0x53')]);_0x5ad4cd[_0xb668('0x48')]=_[_0xb668('0x54')](_0x5ad4cd[_0xb668('0x48')],['id',_0xb668('0x52'),_0xb668('0x53')]);return db[_0xb668('0x2b')][_0xb668('0x55')](_[_0xb668('0x3d')](_0x3368a6,_0x5ad4cd[_0xb668('0x48')]),{'include':_0x5ad4cd[_0xb668('0x2e')][_0xb668('0x40')]?[{'all':!![]}]:undefined})['then'](function(_0x263040){var _0x4632ec=_0x5ad4cd['user'][_0xb668('0x24')]({'plain':!![]});if(!_0x4632ec)throw new Error(_0xb668('0x4a'));if(_0x4632ec['role']===_0xb668('0x49')){var _0xd9be5b=_0x263040['get']({'plain':!![]});var _0x2ea7b8='IvrCampaigns';return db[_0xb668('0x4c')][_0xb668('0x47')]({'where':{'name':_0x2ea7b8,'userProfileId':_0x4632ec['userProfileId']},'raw':!![]})[_0xb668('0x23')](function(_0x3f4433){if(_0x3f4433&&_0x3f4433[_0xb668('0x4e')]===0x0){return db[_0xb668('0x26')][_0xb668('0x55')]({'name':_0xd9be5b[_0xb668('0x29')],'resourceId':_0xd9be5b['id'],'type':_0x3f4433[_0xb668('0x29')],'sectionId':_0x3f4433['id']},{})[_0xb668('0x23')](function(){return _0x263040;});}else{return _0x263040;}})[_0xb668('0x44')](function(_0x58385f){logger[_0xb668('0x28')](_0xb668('0x4f'),_0x58385f);throw _0x58385f;});}return _0x263040;});}})[_0xb668('0x23')](respondWithResult(_0x51a5d3,0xc9))[_0xb668('0x44')](handleError(_0x51a5d3,null));};exports[_0xb668('0x22')]=function(_0x51fcc6,_0x30d6d4){if(_0x51fcc6[_0xb668('0x48')]['id']){delete _0x51fcc6[_0xb668('0x48')]['id'];}return db['Campaign'][_0xb668('0x47')]({'where':{'id':_0x51fcc6[_0xb668('0x51')]['id']}})[_0xb668('0x23')](handleEntityNotFound(_0x30d6d4,null))[_0xb668('0x23')](saveUpdates(_0x51fcc6['body'],null))[_0xb668('0x23')](respondWithResult(_0x30d6d4,null))[_0xb668('0x44')](handleError(_0x30d6d4,null));};exports[_0xb668('0x27')]=function(_0x4b5f9d,_0xfaafb5){return db[_0xb668('0x2b')][_0xb668('0x47')]({'where':{'id':_0x4b5f9d[_0xb668('0x51')]['id']}})[_0xb668('0x23')](handleEntityNotFound(_0xfaafb5,null))[_0xb668('0x23')](removeEntity(_0xfaafb5,null))[_0xb668('0x44')](handleError(_0xfaafb5,null));};exports[_0xb668('0x56')]=function(_0x2e97b9,_0x53937a,_0x16ff0f){var _0x5a9c76={'raw':!![],'where':{}};var _0x16db8f={};var _0x5db6ac={'count':0x0,'rows':[]};return db[_0xb668('0x2b')][_0xb668('0x57')]({'where':{'id':_0x2e97b9[_0xb668('0x51')]['id']}})['then'](handleEntityNotFound(_0x53937a,null))[_0xb668('0x23')](function(_0x3749fa){if(_0x3749fa){_0x16db8f[_0xb668('0x32')]=_[_0xb668('0x2f')](db[_0xb668('0x58')][_0xb668('0x46')]);_0x16db8f[_0xb668('0x2e')]=_[_0xb668('0x2f')](_0x2e97b9[_0xb668('0x2e')]);_0x16db8f[_0xb668('0x30')]=_[_0xb668('0x31')](_0x16db8f[_0xb668('0x32')],_0x16db8f[_0xb668('0x2e')]);_0x5a9c76[_0xb668('0x34')]=_[_0xb668('0x31')](_0x16db8f[_0xb668('0x32')],qs[_0xb668('0x33')](_0x2e97b9[_0xb668('0x2e')][_0xb668('0x33')]));_0x5a9c76[_0xb668('0x34')]=_0x5a9c76['attributes'][_0xb668('0x35')]?_0x5a9c76[_0xb668('0x34')]:_0x16db8f['model'];if(!_0x2e97b9[_0xb668('0x2e')]['hasOwnProperty'](_0xb668('0x37'))){_0x5a9c76[_0xb668('0x1e')]=qs['limit'](_0x2e97b9['query'][_0xb668('0x1e')]);_0x5a9c76[_0xb668('0x1d')]=qs[_0xb668('0x1d')](_0x2e97b9['query'][_0xb668('0x1d')]);}_0x5a9c76[_0xb668('0x59')]=qs[_0xb668('0x38')](_0x2e97b9['query'][_0xb668('0x38')]);_0x5a9c76[_0xb668('0x3a')]=qs[_0xb668('0x30')](_[_0xb668('0x5a')](_0x2e97b9[_0xb668('0x2e')],_0x16db8f[_0xb668('0x30')]));_0x5a9c76[_0xb668('0x3a')][_0xb668('0x5b')]=_0x3749fa['id'];if(_0x2e97b9[_0xb668('0x2e')][_0xb668('0x39')]){_0x5a9c76[_0xb668('0x3a')]=_['merge'](_0x5a9c76[_0xb668('0x3a')],{'$or':_['map'](_0x5a9c76['attributes'],function(_0x1e1fe2){var _0x72c926={};_0x72c926[_0x1e1fe2]={'$like':'%'+_0x2e97b9[_0xb668('0x2e')][_0xb668('0x39')]+'%'};return _0x72c926;})});}_0x5a9c76=_['merge']({},_0x5a9c76,_0x2e97b9[_0xb668('0x3e')]);return db['CmHopper'][_0xb668('0x3f')]({'where':_0x5a9c76[_0xb668('0x3a')]})[_0xb668('0x23')](function(_0x488e93){_0x5db6ac[_0xb668('0x3f')]=_0x488e93;if(_0x2e97b9[_0xb668('0x2e')][_0xb668('0x40')]){_0x5a9c76['include']=[{'all':!![]}];}return db[_0xb668('0x58')][_0xb668('0x42')](_0x5a9c76);})[_0xb668('0x23')](function(_0x13709b){_0x5db6ac['rows']=_0x13709b;return _0x5db6ac;});}})[_0xb668('0x23')](respondWithFilteredResult(_0x53937a,_0x5a9c76))[_0xb668('0x44')](handleError(_0x53937a,null));};exports['getHopperHistories']=function(_0x4433c6,_0x5cfaa0,_0xc4cea7){var _0x35648d={'raw':!![],'where':{}};var _0x8dfda5={};var _0x28f58b={'count':0x0,'rows':[]};return db[_0xb668('0x2b')]['findOne']({'where':{'id':_0x4433c6['params']['id']}})[_0xb668('0x23')](handleEntityNotFound(_0x5cfaa0,null))[_0xb668('0x23')](function(_0x392d0e){if(_0x392d0e){_0x8dfda5[_0xb668('0x32')]=_[_0xb668('0x2f')](db[_0xb668('0x5c')][_0xb668('0x46')]);_0x8dfda5[_0xb668('0x2e')]=_[_0xb668('0x2f')](_0x4433c6[_0xb668('0x2e')]);_0x8dfda5[_0xb668('0x30')]=_['intersection'](_0x8dfda5[_0xb668('0x32')],_0x8dfda5[_0xb668('0x2e')]);_0x35648d['attributes']=_[_0xb668('0x31')](_0x8dfda5[_0xb668('0x32')],qs[_0xb668('0x33')](_0x4433c6[_0xb668('0x2e')][_0xb668('0x33')]));_0x35648d[_0xb668('0x34')]=_0x35648d[_0xb668('0x34')]['length']?_0x35648d[_0xb668('0x34')]:_0x8dfda5['model'];if(!_0x4433c6[_0xb668('0x2e')][_0xb668('0x36')](_0xb668('0x37'))){_0x35648d[_0xb668('0x1e')]=qs[_0xb668('0x1e')](_0x4433c6['query'][_0xb668('0x1e')]);_0x35648d[_0xb668('0x1d')]=qs[_0xb668('0x1d')](_0x4433c6[_0xb668('0x2e')][_0xb668('0x1d')]);}_0x35648d[_0xb668('0x59')]=qs['sort'](_0x4433c6[_0xb668('0x2e')][_0xb668('0x38')]);_0x35648d[_0xb668('0x3a')]=qs[_0xb668('0x30')](_[_0xb668('0x5a')](_0x4433c6[_0xb668('0x2e')],_0x8dfda5[_0xb668('0x30')]));_0x35648d[_0xb668('0x3a')]['CampaignId']=_0x392d0e['id'];if(_0x4433c6[_0xb668('0x2e')][_0xb668('0x39')]){_0x35648d[_0xb668('0x3a')]=_['merge'](_0x35648d[_0xb668('0x3a')],{'$or':_['map'](_0x35648d[_0xb668('0x34')],function(_0x487c1f){var _0x3d4c8f={};_0x3d4c8f[_0x487c1f]={'$like':'%'+_0x4433c6[_0xb668('0x2e')][_0xb668('0x39')]+'%'};return _0x3d4c8f;})});}_0x35648d=_[_0xb668('0x3d')]({},_0x35648d,_0x4433c6[_0xb668('0x3e')]);return db['CmHopperHistory']['count']({'where':_0x35648d[_0xb668('0x3a')]})[_0xb668('0x23')](function(_0x6ba35f){_0x28f58b[_0xb668('0x3f')]=_0x6ba35f;if(_0x4433c6[_0xb668('0x2e')][_0xb668('0x40')]){_0x35648d[_0xb668('0x41')]=[{'all':!![]}];}return db[_0xb668('0x5c')][_0xb668('0x42')](_0x35648d);})[_0xb668('0x23')](function(_0x32ec00){_0x28f58b[_0xb668('0x43')]=_0x32ec00;return _0x28f58b;});}})[_0xb668('0x23')](respondWithFilteredResult(_0x5cfaa0,_0x35648d))['catch'](handleError(_0x5cfaa0,null));};exports[_0xb668('0x5d')]=function(_0x157258,_0x318c4e,_0xf3e51b){var _0x1bd67b={'raw':!![],'where':{}};var _0xa3bdc3={};var _0x26d3b9={'count':0x0,'rows':[]};return db[_0xb668('0x2b')]['findOne']({'where':{'id':_0x157258[_0xb668('0x51')]['id']}})['then'](handleEntityNotFound(_0x318c4e,null))['then'](function(_0x980229){if(_0x980229){_0xa3bdc3[_0xb668('0x32')]=_['keys'](db[_0xb668('0x5e')]['rawAttributes']);_0xa3bdc3[_0xb668('0x2e')]=_[_0xb668('0x2f')](_0x157258[_0xb668('0x2e')]);_0xa3bdc3['filters']=_[_0xb668('0x31')](_0xa3bdc3[_0xb668('0x32')],_0xa3bdc3[_0xb668('0x2e')]);_0x1bd67b[_0xb668('0x34')]=_['intersection'](_0xa3bdc3['model'],qs[_0xb668('0x33')](_0x157258[_0xb668('0x2e')]['fields']));_0x1bd67b[_0xb668('0x34')]=_0x1bd67b['attributes'][_0xb668('0x35')]?_0x1bd67b[_0xb668('0x34')]:_0xa3bdc3[_0xb668('0x32')];if(!_0x157258[_0xb668('0x2e')]['hasOwnProperty']('nolimit')){_0x1bd67b[_0xb668('0x1e')]=qs[_0xb668('0x1e')](_0x157258[_0xb668('0x2e')]['limit']);_0x1bd67b[_0xb668('0x1d')]=qs[_0xb668('0x1d')](_0x157258[_0xb668('0x2e')]['offset']);}_0x1bd67b[_0xb668('0x59')]=qs['sort'](_0x157258[_0xb668('0x2e')][_0xb668('0x38')]);_0x1bd67b[_0xb668('0x3a')]=qs[_0xb668('0x30')](_[_0xb668('0x5a')](_0x157258['query'],_0xa3bdc3['filters']));_0x1bd67b[_0xb668('0x3a')][_0xb668('0x5b')]=_0x980229['id'];if(_0x157258[_0xb668('0x2e')][_0xb668('0x39')]){_0x1bd67b['where']=_['merge'](_0x1bd67b[_0xb668('0x3a')],{'$or':_[_0xb668('0x2a')](_0x1bd67b['attributes'],function(_0x229583){var _0x35c6a9={};_0x35c6a9[_0x229583]={'$like':'%'+_0x157258[_0xb668('0x2e')][_0xb668('0x39')]+'%'};return _0x35c6a9;})});}_0x1bd67b=_[_0xb668('0x3d')]({},_0x1bd67b,_0x157258[_0xb668('0x3e')]);return db[_0xb668('0x5e')][_0xb668('0x3f')]({'where':_0x1bd67b[_0xb668('0x3a')]})[_0xb668('0x23')](function(_0x4b9faa){_0x26d3b9[_0xb668('0x3f')]=_0x4b9faa;if(_0x157258[_0xb668('0x2e')][_0xb668('0x40')]){_0x1bd67b[_0xb668('0x41')]=[{'all':!![]}];}return db[_0xb668('0x5e')][_0xb668('0x42')](_0x1bd67b);})[_0xb668('0x23')](function(_0x40ec49){_0x26d3b9[_0xb668('0x43')]=_0x40ec49;return _0x26d3b9;});}})[_0xb668('0x23')](respondWithFilteredResult(_0x318c4e,_0x1bd67b))['catch'](handleError(_0x318c4e,null));};exports[_0xb668('0x5f')]=function(_0x111501,_0x4ef43e,_0x13d434){var _0x3488b0={'raw':!![],'where':{}};var _0x10d45d={};var _0x4c599d={'count':0x0,'rows':[]};return db[_0xb668('0x2b')][_0xb668('0x57')]({'where':{'id':_0x111501['params']['id']}})['then'](handleEntityNotFound(_0x4ef43e,null))[_0xb668('0x23')](function(_0x3cb765){if(_0x3cb765){_0x10d45d['model']=_[_0xb668('0x2f')](db['CmHopperBlack'][_0xb668('0x46')]);_0x10d45d['query']=_[_0xb668('0x2f')](_0x111501[_0xb668('0x2e')]);_0x10d45d[_0xb668('0x30')]=_[_0xb668('0x31')](_0x10d45d['model'],_0x10d45d[_0xb668('0x2e')]);_0x3488b0[_0xb668('0x34')]=_[_0xb668('0x31')](_0x10d45d['model'],qs['fields'](_0x111501[_0xb668('0x2e')][_0xb668('0x33')]));_0x3488b0[_0xb668('0x34')]=_0x3488b0[_0xb668('0x34')]['length']?_0x3488b0[_0xb668('0x34')]:_0x10d45d[_0xb668('0x32')];if(!_0x111501[_0xb668('0x2e')]['hasOwnProperty'](_0xb668('0x37'))){_0x3488b0[_0xb668('0x1e')]=qs[_0xb668('0x1e')](_0x111501['query'][_0xb668('0x1e')]);_0x3488b0[_0xb668('0x1d')]=qs[_0xb668('0x1d')](_0x111501[_0xb668('0x2e')][_0xb668('0x1d')]);}_0x3488b0[_0xb668('0x59')]=qs[_0xb668('0x38')](_0x111501[_0xb668('0x2e')][_0xb668('0x38')]);_0x3488b0['where']=qs[_0xb668('0x30')](_['pick'](_0x111501[_0xb668('0x2e')],_0x10d45d['filters']));_0x3488b0[_0xb668('0x3a')][_0xb668('0x5b')]=_0x3cb765['id'];if(_0x111501[_0xb668('0x2e')][_0xb668('0x39')]){_0x3488b0[_0xb668('0x3a')]=_[_0xb668('0x3d')](_0x3488b0[_0xb668('0x3a')],{'$or':_[_0xb668('0x2a')](_0x3488b0[_0xb668('0x34')],function(_0x534662){var _0x245b6a={};_0x245b6a[_0x534662]={'$like':'%'+_0x111501[_0xb668('0x2e')]['filter']+'%'};return _0x245b6a;})});}_0x3488b0=_[_0xb668('0x3d')]({},_0x3488b0,_0x111501['options']);return db[_0xb668('0x60')][_0xb668('0x3f')]({'where':_0x3488b0[_0xb668('0x3a')]})['then'](function(_0x214a4b){_0x4c599d[_0xb668('0x3f')]=_0x214a4b;if(_0x111501[_0xb668('0x2e')]['includeAll']){_0x3488b0['include']=[{'all':!![]}];}return db[_0xb668('0x60')][_0xb668('0x42')](_0x3488b0);})[_0xb668('0x23')](function(_0x17d9d3){_0x4c599d[_0xb668('0x43')]=_0x17d9d3;return _0x4c599d;});}})[_0xb668('0x23')](respondWithFilteredResult(_0x4ef43e,_0x3488b0))[_0xb668('0x44')](handleError(_0x4ef43e,null));};exports[_0xb668('0x61')]=function(_0x53e5a3,_0x3082f8,_0x302e68){var _0x47785f={};var _0x46ff02={};var _0x526fbc;var _0x4d71f1;return db[_0xb668('0x2b')][_0xb668('0x57')]({'where':{'id':_0x53e5a3[_0xb668('0x51')]['id']}})['then'](handleEntityNotFound(_0x3082f8,null))[_0xb668('0x23')](function(_0x177909){if(_0x177909){_0x526fbc=_0x177909;_0x46ff02[_0xb668('0x32')]=_['keys'](db[_0xb668('0x62')][_0xb668('0x46')]);_0x46ff02[_0xb668('0x2e')]=_[_0xb668('0x2f')](_0x53e5a3[_0xb668('0x2e')]);_0x46ff02[_0xb668('0x30')]=_[_0xb668('0x31')](_0x46ff02[_0xb668('0x32')],_0x46ff02[_0xb668('0x2e')]);_0x47785f[_0xb668('0x34')]=_[_0xb668('0x31')](_0x46ff02[_0xb668('0x32')],qs[_0xb668('0x33')](_0x53e5a3[_0xb668('0x2e')][_0xb668('0x33')]));_0x47785f[_0xb668('0x34')]=_0x47785f[_0xb668('0x34')][_0xb668('0x35')]?_0x47785f[_0xb668('0x34')]:_0x46ff02[_0xb668('0x32')];_0x47785f[_0xb668('0x59')]=qs['sort'](_0x53e5a3['query']['sort']);_0x47785f[_0xb668('0x3a')]=qs[_0xb668('0x30')](_[_0xb668('0x5a')](_0x53e5a3[_0xb668('0x2e')],_0x46ff02[_0xb668('0x30')]));if(_0x53e5a3['query'][_0xb668('0x39')]){_0x47785f[_0xb668('0x3a')]=_[_0xb668('0x3d')](_0x47785f[_0xb668('0x3a')],{'$or':_[_0xb668('0x2a')](_0x47785f[_0xb668('0x34')],function(_0x36bd15){var _0xdbcdbb={};_0xdbcdbb[_0x36bd15]={'$like':'%'+_0x53e5a3[_0xb668('0x2e')][_0xb668('0x39')]+'%'};return _0xdbcdbb;})});}_0x47785f=_[_0xb668('0x3d')]({},_0x47785f,_0x53e5a3[_0xb668('0x3e')]);return _0x526fbc[_0xb668('0x61')](_0x47785f);}})[_0xb668('0x23')](function(_0x524534){if(_0x524534){_0x4d71f1=_0x524534[_0xb668('0x35')];if(!_0x53e5a3[_0xb668('0x2e')]['hasOwnProperty'](_0xb668('0x37'))){_0x47785f['limit']=qs[_0xb668('0x1e')](_0x53e5a3['query'][_0xb668('0x1e')]);_0x47785f[_0xb668('0x1d')]=qs[_0xb668('0x1d')](_0x53e5a3[_0xb668('0x2e')][_0xb668('0x1d')]);}return _0x526fbc[_0xb668('0x61')](_0x47785f);}})[_0xb668('0x23')](function(_0x304e6c){if(_0x304e6c){return _0x304e6c?{'count':_0x4d71f1,'rows':_0x304e6c}:null;}})['then'](respondWithResult(_0x3082f8,null))[_0xb668('0x44')](handleError(_0x3082f8,null));};exports['addLists']=function(_0x3c57d1,_0x2b3cca,_0x11795c){var _0x3aaff9,_0x42a8c7;return db[_0xb668('0x2b')]['find']({'where':{'id':_0x3c57d1[_0xb668('0x51')]['id']}})['then'](handleEntityNotFound(_0x2b3cca,null))[_0xb668('0x23')](function(_0x1f7ce1){if(_0x1f7ce1){_0x42a8c7=_0x1f7ce1;return _0x1f7ce1[_0xb668('0x63')](_0x3c57d1[_0xb668('0x48')][_0xb668('0x64')],_[_0xb668('0x54')](_0x3c57d1['body'],[_0xb668('0x64'),'id'])||{});}return null;})[_0xb668('0x65')](function(_0xba1137){var _0x43b986;_0x3aaff9=_0xba1137||[];var _0x205e7b=[];if(_0xba1137){for(var _0x4e6ce1=0x0;_0x4e6ce1<_0xba1137[_0xb668('0x35')];_0x4e6ce1+=0x1){var _0x412c0d=_0xba1137[_0x4e6ce1]['get']({'plain':!![]});_0x42a8c7[_0xb668('0x66')]=_0x3c57d1[_0xb668('0x48')][_0xb668('0x66')]?_0x3c57d1[_0xb668('0x48')][_0xb668('0x66')]:_0x42a8c7[_0xb668('0x66')];switch(_0x42a8c7[_0xb668('0x66')]){case _0xb668('0x67'):_0x43b986=squel[_0xb668('0x68')]()[_0xb668('0x69')](_0xb668('0x6a'))[_0xb668('0x6b')]([_0xb668('0x6c'),_0xb668('0x6d'),_0xb668('0x6e'),_0xb668('0x6f'),_0xb668('0x5b'),_0xb668('0x52'),_0xb668('0x53')],squel['select']()[_0xb668('0x70')](_0xb668('0x6c'),_0xb668('0x6c'))['field'](_0xb668('0x71'),_0xb668('0x6d'))['field']('id','ContactId')[_0xb668('0x70')](_0x412c0d['CmListId']['toString'](),_0xb668('0x6f'))[_0xb668('0x70')](_0x3c57d1[_0xb668('0x51')]['id'][_0xb668('0x72')](),_0xb668('0x5b'))[_0xb668('0x70')](_0xb668('0x71'),_0xb668('0x52'))[_0xb668('0x70')](_0xb668('0x71'),_0xb668('0x53'))[_0xb668('0x73')](_0xb668('0x74'))[_0xb668('0x3a')](_0xb668('0x75'))[_0xb668('0x3a')](_0xb668('0x76'),_0x412c0d[_0xb668('0x77')][_0xb668('0x72')]())['where'](_0xb668('0x78'))['where'](_0xb668('0x79'),squel[_0xb668('0x7a')]()[_0xb668('0x70')](_0xb668('0x7b'))[_0xb668('0x73')](_0xb668('0x7c'))[_0xb668('0x3a')]('CampaignId\x20=\x20?',_0x3c57d1['params']['id'][_0xb668('0x72')]()))['where'](_0xb668('0x79'),squel['select']()[_0xb668('0x70')](_0xb668('0x7d'))['from'](_0xb668('0x6a'))[_0xb668('0x3a')](_0xb668('0x7e'),_0x3c57d1[_0xb668('0x51')]['id'][_0xb668('0x72')]())))[_0xb668('0x72')]();break;case _0xb668('0x7f'):_0x43b986=squel[_0xb668('0x68')]()[_0xb668('0x69')](_0xb668('0x6a'))[_0xb668('0x6b')]([_0xb668('0x6c'),_0xb668('0x6d'),'ContactId',_0xb668('0x6f'),_0xb668('0x5b'),'createdAt','updatedAt'],squel[_0xb668('0x7a')]()[_0xb668('0x70')](_0xb668('0x6c'),_0xb668('0x6c'))[_0xb668('0x70')](_0xb668('0x71'),_0xb668('0x6d'))['field']('id',_0xb668('0x6e'))[_0xb668('0x70')](_0x412c0d[_0xb668('0x77')][_0xb668('0x72')](),'ListId')[_0xb668('0x70')](_0x3c57d1[_0xb668('0x51')]['id'][_0xb668('0x72')](),_0xb668('0x5b'))[_0xb668('0x70')](_0xb668('0x71'),_0xb668('0x52'))['field'](_0xb668('0x71'),_0xb668('0x53'))[_0xb668('0x73')](_0xb668('0x74'))[_0xb668('0x3a')](_0xb668('0x75'))[_0xb668('0x3a')](_0xb668('0x76'),_0x412c0d[_0xb668('0x77')][_0xb668('0x72')]())[_0xb668('0x3a')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xb668('0x79'),squel[_0xb668('0x7a')]()[_0xb668('0x70')](_0xb668('0x7d'))[_0xb668('0x73')](_0xb668('0x6a'))['where'](_0xb668('0x7e'),_0x3c57d1[_0xb668('0x51')]['id'][_0xb668('0x72')]())))[_0xb668('0x72')]();break;default:_0x43b986=squel[_0xb668('0x68')]()['into'](_0xb668('0x6a'))[_0xb668('0x6b')]([_0xb668('0x6c'),_0xb668('0x6d'),_0xb668('0x6e'),_0xb668('0x6f'),_0xb668('0x5b'),_0xb668('0x52'),'updatedAt'],squel[_0xb668('0x7a')]()['field'](_0xb668('0x6c'),_0xb668('0x6c'))[_0xb668('0x70')](_0xb668('0x71'),_0xb668('0x6d'))[_0xb668('0x70')]('id',_0xb668('0x6e'))[_0xb668('0x70')](_0x412c0d[_0xb668('0x77')]['toString'](),'ListId')[_0xb668('0x70')](_0x3c57d1[_0xb668('0x51')]['id'][_0xb668('0x72')](),_0xb668('0x5b'))[_0xb668('0x70')]('NOW()',_0xb668('0x52'))[_0xb668('0x70')](_0xb668('0x71'),_0xb668('0x53'))[_0xb668('0x73')]('cm_contacts')[_0xb668('0x3a')]('deletedAt\x20IS\x20NULL')[_0xb668('0x3a')](_0xb668('0x76'),_0x412c0d[_0xb668('0x77')]['toString']())[_0xb668('0x3a')](_0xb668('0x78')))[_0xb668('0x72')]();}_0x205e7b['push'](db['sequelize'][_0xb668('0x2e')](_0x43b986));}return BPromise[_0xb668('0x80')](_0x205e7b);}})[_0xb668('0x23')](function(){return _0x3aaff9;})['then'](respondWithResult(_0x2b3cca,null))['catch'](handleError(_0x2b3cca,null));};exports['removeLists']=function(_0x1b8db5,_0x487b12,_0x57b1e8){return db['Campaign'][_0xb668('0x47')]({'where':{'id':_0x1b8db5['params']['id']}})[_0xb668('0x23')](handleEntityNotFound(_0x487b12,null))['then'](function(_0x5b170a){if(_0x5b170a){return _0x5b170a[_0xb668('0x81')](_0x1b8db5[_0xb668('0x2e')][_0xb668('0x64')]);}})['then'](function(_0x24b99d){if(_0x24b99d){return db['CmHopper']['destroy']({'where':{'ListId':_0x1b8db5[_0xb668('0x2e')][_0xb668('0x64')],'CampaignId':_0x1b8db5[_0xb668('0x51')]['id']}})[_0xb668('0x23')](function(){return _0x24b99d;});}})[_0xb668('0x23')](respondWithStatusCode(_0x487b12,null))['catch'](handleError(_0x487b12,null));};exports[_0xb668('0x82')]=function(_0x407639,_0x71eae5,_0x9000a){var _0x19efaf={'raw':!![],'where':{}};var _0x52336a={};var _0x5156cb={'count':0x0,'rows':[]};return db['Campaign'][_0xb668('0x57')]({'where':{'id':_0x407639['params']['id']}})[_0xb668('0x23')](handleEntityNotFound(_0x71eae5,null))[_0xb668('0x23')](function(_0x245f62){if(_0x245f62){_0x52336a['model']=_[_0xb668('0x2f')](db['CmList'][_0xb668('0x46')]);_0x52336a['query']=_[_0xb668('0x2f')](_0x407639[_0xb668('0x2e')]);_0x52336a[_0xb668('0x30')]=_[_0xb668('0x31')](_0x52336a['model'],_0x52336a[_0xb668('0x2e')]);_0x19efaf[_0xb668('0x34')]=_['intersection'](_0x52336a[_0xb668('0x32')],qs[_0xb668('0x33')](_0x407639['query']['fields']));_0x19efaf[_0xb668('0x34')]=_0x19efaf[_0xb668('0x34')][_0xb668('0x35')]?_0x19efaf[_0xb668('0x34')]:_0x52336a[_0xb668('0x32')];if(!_0x407639['query'][_0xb668('0x36')](_0xb668('0x37'))){_0x19efaf[_0xb668('0x1e')]=qs['limit'](_0x407639[_0xb668('0x2e')]['limit']);_0x19efaf['offset']=qs['offset'](_0x407639[_0xb668('0x2e')][_0xb668('0x1d')]);}_0x19efaf[_0xb668('0x59')]=qs['sort'](_0x407639['query']['sort']);_0x19efaf[_0xb668('0x3a')]=qs[_0xb668('0x30')](_['pick'](_0x407639[_0xb668('0x2e')],_0x52336a[_0xb668('0x30')]));_0x19efaf['where'][_0xb668('0x5b')]=_0x245f62['id'];if(_0x407639[_0xb668('0x2e')]['filter']){_0x19efaf[_0xb668('0x3a')]=_[_0xb668('0x3d')](_0x19efaf[_0xb668('0x3a')],{'$or':_[_0xb668('0x2a')](_0x19efaf[_0xb668('0x34')],function(_0xeee7fd){var _0x221b38={};_0x221b38[_0xeee7fd]={'$like':'%'+_0x407639['query'][_0xb668('0x39')]+'%'};return _0x221b38;})});}_0x19efaf=_[_0xb668('0x3d')]({},_0x19efaf,_0x407639[_0xb668('0x3e')]);return db[_0xb668('0x62')][_0xb668('0x3f')]({'where':_0x19efaf[_0xb668('0x3a')]})[_0xb668('0x23')](function(_0x304058){_0x5156cb[_0xb668('0x3f')]=_0x304058;if(_0x407639[_0xb668('0x2e')]['includeAll']){_0x19efaf[_0xb668('0x41')]=[{'all':!![]}];}return db[_0xb668('0x62')][_0xb668('0x42')](_0x19efaf);})[_0xb668('0x23')](function(_0xf5ca6d){_0x5156cb[_0xb668('0x43')]=_0xf5ca6d;return _0x5156cb;});}})[_0xb668('0x23')](respondWithFilteredResult(_0x71eae5,_0x19efaf))['catch'](handleError(_0x71eae5,null));};exports[_0xb668('0x83')]=function(_0xc5b56c,_0x2ab6ed,_0x2fe0a5){var _0x12668b,_0x2fb042;return db[_0xb668('0x2b')]['find']({'where':{'id':_0xc5b56c[_0xb668('0x51')]['id']}})[_0xb668('0x23')](handleEntityNotFound(_0x2ab6ed,null))[_0xb668('0x23')](function(_0x56f90e){if(_0x56f90e){_0x2fb042=_0x56f90e;return _0x56f90e[_0xb668('0x83')](_0xc5b56c[_0xb668('0x48')][_0xb668('0x64')],_[_0xb668('0x54')](_0xc5b56c['body'],[_0xb668('0x64'),'id'])||{});}return null;})[_0xb668('0x65')](function(_0x1897b6){var _0x2a3568;_0x12668b=_0x1897b6||[];var _0x5320bb=[];if(_0x1897b6){for(var _0x3e4756=0x0;_0x3e4756<_0x1897b6['length'];_0x3e4756+=0x1){var _0x17b6f9=_0x1897b6[_0x3e4756][_0xb668('0x24')]({'plain':!![]});_0x2a3568=squel[_0xb668('0x68')]()['into'](_0xb668('0x84'))['fromQuery']([_0xb668('0x6c'),_0xb668('0x6e'),_0xb668('0x6f'),'CampaignId',_0xb668('0x52'),_0xb668('0x53')],squel['select']()[_0xb668('0x70')]('phone',_0xb668('0x6c'))[_0xb668('0x70')]('id','ContactId')[_0xb668('0x70')](_0x17b6f9[_0xb668('0x77')][_0xb668('0x72')](),_0xb668('0x6f'))[_0xb668('0x70')](_0xc5b56c[_0xb668('0x51')]['id'][_0xb668('0x72')](),_0xb668('0x5b'))['field']('NOW()','createdAt')[_0xb668('0x70')](_0xb668('0x71'),_0xb668('0x53'))[_0xb668('0x73')]('cm_contacts')[_0xb668('0x3a')](_0xb668('0x75'))[_0xb668('0x3a')](_0xb668('0x76'),_0x17b6f9['CmListId']['toString']())[_0xb668('0x3a')](_0xb668('0x78')))[_0xb668('0x72')]();_0x5320bb[_0xb668('0x85')](db[_0xb668('0x86')][_0xb668('0x2e')](_0x2a3568));}return BPromise[_0xb668('0x80')](_0x5320bb);}})[_0xb668('0x23')](function(){return _0x12668b;})['then'](respondWithResult(_0x2ab6ed,null))[_0xb668('0x44')](handleError(_0x2ab6ed,null));};exports[_0xb668('0x87')]=function(_0x5f5911,_0x42bba2,_0x3b9df5){return db[_0xb668('0x2b')][_0xb668('0x47')]({'where':{'id':_0x5f5911[_0xb668('0x51')]['id']}})[_0xb668('0x23')](handleEntityNotFound(_0x42bba2,null))['then'](function(_0x54ffa6){if(_0x54ffa6){return _0x54ffa6[_0xb668('0x87')](_0x5f5911[_0xb668('0x2e')][_0xb668('0x64')]);}})[_0xb668('0x23')](function(_0x276e92){if(_0x276e92){return db[_0xb668('0x60')][_0xb668('0x27')]({'where':{'ListId':_0x5f5911[_0xb668('0x2e')][_0xb668('0x64')],'CampaignId':_0x5f5911[_0xb668('0x51')]['id']}})[_0xb668('0x23')](function(){return _0x276e92;});}})[_0xb668('0x23')](respondWithStatusCode(_0x42bba2,null))[_0xb668('0x44')](handleError(_0x42bba2,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 62c05ef..d0e76b9 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 _0x5feb=['Campaign','util','../../config/logger','api','path','rimraf','define'];(function(_0x5ad0d7,_0x2645f8){var _0xd83bd=function(_0x33d3bd){while(--_0x33d3bd){_0x5ad0d7['push'](_0x5ad0d7['shift']());}};_0xd83bd(++_0x2645f8);}(_0x5feb,0x104));var _0xb5fe=function(_0x48e6c1,_0x2c5211){_0x48e6c1=_0x48e6c1-0x0;var _0x1521e2=_0x5feb[_0x48e6c1];return _0x1521e2;};'use strict';var _=require('lodash');var util=require(_0xb5fe('0x0'));var logger=require(_0xb5fe('0x1'))(_0xb5fe('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb5fe('0x3'));var rimraf=require(_0xb5fe('0x4'));var config=require('../../config/environment');var attributes=require('./campaign.attributes');module['exports']=function(_0x2927d5,_0x382944){return _0x2927d5[_0xb5fe('0x5')](_0xb5fe('0x6'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x877e=['campaigns','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./campaign.attributes','define'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x877e,0x1a3));var _0xe877=function(_0x34ce38,_0xd033ac){_0x34ce38=_0x34ce38-0x0;var _0xfd08fb=_0x877e[_0x34ce38];return _0xfd08fb;};'use strict';var _=require('lodash');var util=require(_0xe877('0x0'));var logger=require(_0xe877('0x1'))(_0xe877('0x2'));var moment=require(_0xe877('0x3'));var BPromise=require(_0xe877('0x4'));var rp=require(_0xe877('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe877('0x6'));var config=require(_0xe877('0x7'));var attributes=require(_0xe877('0x8'));module['exports']=function(_0x142e79,_0x1baf7){return _0x142e79[_0xe877('0x9')]('Campaign',attributes,{'tableName':_0xe877('0xa'),'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 f006ce0..a039f3b 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x506e4e,_0x1e893b){var _0x23719c=function(_0x33e3c0){while(--_0x33e3c0){_0x506e4e['push'](_0x506e4e['shift']());}};_0x23719c(++_0x1e893b);}(_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 moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x574548,_0x5a9399){var _0x31b678=function(_0x253212){while(--_0x253212){_0x574548['push'](_0x574548['shift']());}};_0x31b678(++_0x5a9399);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 1eda333..627d542 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 _0xd1a3=['getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','addLists','addBlackLists','update','delete','destroy','removeLists','removeBlackLists','exports','util','path','connect-timeout','express','Router','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories'];(function(_0x56b18a,_0xb6a4c9){var _0x2b0cf8=function(_0x3078b1){while(--_0x3078b1){_0x56b18a['push'](_0x56b18a['shift']());}};_0x2b0cf8(++_0xb6a4c9);}(_0xd1a3,0xc3));var _0x3d1a=function(_0x1d0ba0,_0x4e04a7){_0x1d0ba0=_0x1d0ba0-0x0;var _0x6d04ff=_0xd1a3[_0x1d0ba0];return _0x6d04ff;};'use strict';var multer=require('multer');var util=require(_0x3d1a('0x0'));var path=require(_0x3d1a('0x1'));var timeout=require(_0x3d1a('0x2'));var express=require(_0x3d1a('0x3'));var router=express[_0x3d1a('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3d1a('0x5'));var controller=require(_0x3d1a('0x6'));router[_0x3d1a('0x7')]('/',auth[_0x3d1a('0x8')](),controller[_0x3d1a('0x9')]);router[_0x3d1a('0x7')](_0x3d1a('0xa'),auth['isAuthenticated'](),controller[_0x3d1a('0xb')]);router['get'](_0x3d1a('0xc'),auth[_0x3d1a('0x8')](),controller[_0x3d1a('0xd')]);router['get'](_0x3d1a('0xe'),auth['isAuthenticated'](),controller[_0x3d1a('0xf')]);router[_0x3d1a('0x7')](_0x3d1a('0x10'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0x3d1a('0x7')](_0x3d1a('0x11'),auth[_0x3d1a('0x8')](),controller[_0x3d1a('0x12')]);router[_0x3d1a('0x7')](_0x3d1a('0x13'),auth[_0x3d1a('0x8')](),controller[_0x3d1a('0x14')]);router[_0x3d1a('0x7')](_0x3d1a('0x15'),auth[_0x3d1a('0x8')](),controller[_0x3d1a('0x16')]);router['post']('/',auth[_0x3d1a('0x8')](),controller[_0x3d1a('0x17')]);router[_0x3d1a('0x18')](_0x3d1a('0x19'),auth[_0x3d1a('0x8')](),controller[_0x3d1a('0x1a')]);router[_0x3d1a('0x18')](_0x3d1a('0x13'),auth[_0x3d1a('0x8')](),controller[_0x3d1a('0x1b')]);router[_0x3d1a('0x18')]('/:id/blacklists',auth[_0x3d1a('0x8')](),controller[_0x3d1a('0x1c')]);router['put'](_0x3d1a('0xa'),auth[_0x3d1a('0x8')](),controller[_0x3d1a('0x1d')]);router[_0x3d1a('0x1e')](_0x3d1a('0xa'),auth[_0x3d1a('0x8')](),controller[_0x3d1a('0x1f')]);router['delete'](_0x3d1a('0x13'),auth['isAuthenticated'](),controller[_0x3d1a('0x20')]);router[_0x3d1a('0x1e')](_0x3d1a('0x15'),auth[_0x3d1a('0x8')](),controller[_0x3d1a('0x21')]);module[_0x3d1a('0x22')]=router; \ No newline at end of file +var _0xb3e6=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','show','get','/:id/hoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','post','create','clone','addLists','/:id','destroy','delete','removeLists','removeBlackLists','exports','util'];(function(_0x557d94,_0x101666){var _0x246b21=function(_0x39b582){while(--_0x39b582){_0x557d94['push'](_0x557d94['shift']());}};_0x246b21(++_0x101666);}(_0xb3e6,0x73));var _0x6b3e=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xb3e6[_0xa148b7];return _0x51efd3;};'use strict';var multer=require('multer');var util=require(_0x6b3e('0x0'));var path=require(_0x6b3e('0x1'));var timeout=require(_0x6b3e('0x2'));var express=require(_0x6b3e('0x3'));var router=express[_0x6b3e('0x4')]();var auth=require(_0x6b3e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6b3e('0x6'));var controller=require('./campaign.controller');router['get']('/',auth[_0x6b3e('0x7')](),controller[_0x6b3e('0x8')]);router['get']('/:id',auth[_0x6b3e('0x7')](),controller[_0x6b3e('0x9')]);router[_0x6b3e('0xa')](_0x6b3e('0xb'),auth[_0x6b3e('0x7')](),controller['getHoppers']);router[_0x6b3e('0xa')](_0x6b3e('0xc'),auth[_0x6b3e('0x7')](),controller['getHopperHistories']);router['get']('/:id/hopper_finals',auth[_0x6b3e('0x7')](),controller[_0x6b3e('0xd')]);router[_0x6b3e('0xa')](_0x6b3e('0xe'),auth[_0x6b3e('0x7')](),controller[_0x6b3e('0xf')]);router[_0x6b3e('0xa')](_0x6b3e('0x10'),auth['isAuthenticated'](),controller['getLists']);router[_0x6b3e('0xa')](_0x6b3e('0x11'),auth[_0x6b3e('0x7')](),controller[_0x6b3e('0x12')]);router[_0x6b3e('0x13')]('/',auth[_0x6b3e('0x7')](),controller[_0x6b3e('0x14')]);router[_0x6b3e('0x13')]('/:id/clone',auth[_0x6b3e('0x7')](),controller[_0x6b3e('0x15')]);router[_0x6b3e('0x13')](_0x6b3e('0x10'),auth[_0x6b3e('0x7')](),controller[_0x6b3e('0x16')]);router[_0x6b3e('0x13')](_0x6b3e('0x11'),auth['isAuthenticated'](),controller['addBlackLists']);router['put'](_0x6b3e('0x17'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6b3e('0x17'),auth['isAuthenticated'](),controller[_0x6b3e('0x18')]);router[_0x6b3e('0x19')](_0x6b3e('0x10'),auth[_0x6b3e('0x7')](),controller[_0x6b3e('0x1a')]);router[_0x6b3e('0x19')](_0x6b3e('0x11'),auth[_0x6b3e('0x7')](),controller[_0x6b3e('0x1b')]);module[_0x6b3e('0x1c')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index df28103..d110c08 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 _0x3522=['TEXT','VIRTUAL','getDataValue','key','sequelize','exports'];(function(_0x43c3f9,_0x1861cb){var _0x4f4f54=function(_0x53ac81){while(--_0x53ac81){_0x43c3f9['push'](_0x43c3f9['shift']());}};_0x4f4f54(++_0x1861cb);}(_0x3522,0x1c6));var _0x2352=function(_0x35021f,_0x451349){_0x35021f=_0x35021f-0x0;var _0x1044e9=_0x3522[_0x35021f];return _0x1044e9;};'use strict';var Sequelize=require(_0x2352('0x0'));module[_0x2352('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x2352('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x2352('0x3')],'get':function(){return this[_0x2352('0x4')](_0x2352('0x5'));}}}; \ No newline at end of file +var _0xdb72=['STRING','TEXT','getDataValue','exports'];(function(_0x9d7e1b,_0x16020f){var _0x542f59=function(_0x32dbc3){while(--_0x32dbc3){_0x9d7e1b['push'](_0x9d7e1b['shift']());}};_0x542f59(++_0x16020f);}(_0xdb72,0xb7));var _0x2db7=function(_0x4bedce,_0x265ebf){_0x4bedce=_0x4bedce-0x0;var _0x4fd2fb=_0xdb72[_0x4bedce];return _0x4fd2fb;};'use strict';var Sequelize=require('sequelize');module[_0x2db7('0x0')]={'key':{'type':Sequelize[_0x2db7('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x2db7('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2db7('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x2db7('0x3')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 1aa43c6..5b18cbd 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 _0x34e8=['filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','options','include','findAll','catch','show','includeAll','find','body','params','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','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','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','CannedAnswers','destroy','sendStatus','error','stack','name','map','CannedAnswer','rawAttributes','fieldName','type','key','model','keys','query'];(function(_0x447146,_0x2fd48a){var _0x1fbe3c=function(_0x45602c){while(--_0x45602c){_0x447146['push'](_0x447146['shift']());}};_0x1fbe3c(++_0x2fd48a);}(_0x34e8,0x12c));var _0x834e=function(_0x168374,_0x464a12){_0x168374=_0x168374-0x0;var _0x33ad68=_0x34e8[_0x168374];return _0x33ad68;};'use strict';var pdf=require(_0x834e('0x0'));var emlformat=require(_0x834e('0x1'));var rimraf=require(_0x834e('0x2'));var zipdir=require(_0x834e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x834e('0x4'));var moment=require(_0x834e('0x5'));var BPromise=require(_0x834e('0x6'));var Mustache=require(_0x834e('0x7'));var util=require(_0x834e('0x8'));var path=require(_0x834e('0x9'));var sox=require(_0x834e('0xa'));var csv=require('to-csv');var ejs=require(_0x834e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0x10'));var querystring=require(_0x834e('0x11'));var Papa=require(_0x834e('0x12'));var Redis=require(_0x834e('0x13'));var authService=require(_0x834e('0x14'));var qs=require(_0x834e('0x15'));var as=require(_0x834e('0x16'));var hardwareService=require(_0x834e('0x17'));var logger=require(_0x834e('0x18'))(_0x834e('0x19'));var utils=require(_0x834e('0x1a'));var config=require(_0x834e('0x1b'));var db=require(_0x834e('0x1c'))['db'];function respondWithStatusCode(_0x538bb3,_0x5e5b6d){_0x5e5b6d=_0x5e5b6d||0xcc;return function(_0x6cd9b9){if(_0x6cd9b9){return _0x538bb3['sendStatus'](_0x5e5b6d);}return _0x538bb3[_0x834e('0x1d')](_0x5e5b6d)[_0x834e('0x1e')]();};}function respondWithResult(_0x28e659,_0x21cc0a){_0x21cc0a=_0x21cc0a||0xc8;return function(_0x50e860){if(_0x50e860){return _0x28e659[_0x834e('0x1d')](_0x21cc0a)[_0x834e('0x1f')](_0x50e860);}};}function respondWithFilteredResult(_0x57274a,_0x316205){return function(_0x4a9cdc){if(_0x4a9cdc){var _0x38a8cd=_0x4a9cdc[_0x834e('0x20')],_0x36d443=_0x316205[_0x834e('0x21')],_0x478afe=_0x316205['offset']+_0x316205[_0x834e('0x22')],_0x43ac41;if(_0x478afe>=_0x38a8cd){_0x478afe=_0x38a8cd;_0x43ac41=0xc8;}else{_0x43ac41=0xce;}_0x57274a[_0x834e('0x1d')](_0x43ac41);return _0x57274a[_0x834e('0x23')](_0x834e('0x24'),_0x36d443+'-'+_0x478afe+'/'+_0x38a8cd)[_0x834e('0x1f')](_0x4a9cdc);}return null;};}function patchUpdates(_0x254677){return function(_0x1dd214){try{jsonpatch['apply'](_0x1dd214,_0x254677,!![]);}catch(_0x2545b4){return BPromise[_0x834e('0x25')](_0x2545b4);}return _0x1dd214[_0x834e('0x26')]();};}function saveUpdates(_0x325a99,_0x4ab05d){return function(_0x45a630){if(_0x45a630){return _0x45a630[_0x834e('0x27')](_0x325a99)['then'](function(_0x1b4bdf){return _0x1b4bdf;});}return null;};}function removeEntity(_0x28d687,_0x8d406e){return function(_0x5c55ca){if(_0x5c55ca){return _0x5c55ca['destroy']()[_0x834e('0x28')](function(){var _0x34563b=_0x5c55ca['get']({'plain':!![]});var _0x25ee1d=_0x834e('0x29');return db['UserProfileResource'][_0x834e('0x2a')]({'where':{'type':_0x25ee1d,'resourceId':_0x34563b['id']}})[_0x834e('0x28')](function(){return _0x5c55ca;});})[_0x834e('0x28')](function(){_0x28d687['status'](0xcc)[_0x834e('0x1e')]();});}};}function handleEntityNotFound(_0x3e310f,_0x5e1cc5){return function(_0x5bef62){if(!_0x5bef62){_0x3e310f[_0x834e('0x2b')](0x194);}return _0x5bef62;};}function handleError(_0x508a1d,_0x2826ec){_0x2826ec=_0x2826ec||0x1f4;return function(_0x3f1b0b){logger[_0x834e('0x2c')](_0x3f1b0b[_0x834e('0x2d')]);if(_0x3f1b0b[_0x834e('0x2e')]){delete _0x3f1b0b[_0x834e('0x2e')];}_0x508a1d['status'](_0x2826ec)['send'](_0x3f1b0b);};}exports['index']=function(_0x58c1d7,_0x2c7a8d){var _0x567cea={},_0x106d6a={},_0x5dacc1={'count':0x0,'rows':[]};var _0xb5bc06=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x4551f5){return{'name':_0x4551f5[_0x834e('0x32')],'type':_0x4551f5[_0x834e('0x33')][_0x834e('0x34')]};});_0x106d6a[_0x834e('0x35')]=_['map'](_0xb5bc06,_0x834e('0x2e'));_0x106d6a['query']=_[_0x834e('0x36')](_0x58c1d7[_0x834e('0x37')]);_0x106d6a[_0x834e('0x38')]=_[_0x834e('0x39')](_0x106d6a[_0x834e('0x35')],_0x106d6a[_0x834e('0x37')]);_0x567cea[_0x834e('0x3a')]=_[_0x834e('0x39')](_0x106d6a[_0x834e('0x35')],qs[_0x834e('0x3b')](_0x58c1d7['query'][_0x834e('0x3b')]));_0x567cea[_0x834e('0x3a')]=_0x567cea[_0x834e('0x3a')][_0x834e('0x3c')]?_0x567cea['attributes']:_0x106d6a[_0x834e('0x35')];if(!_0x58c1d7[_0x834e('0x37')]['hasOwnProperty']('nolimit')){_0x567cea['limit']=qs[_0x834e('0x22')](_0x58c1d7[_0x834e('0x37')][_0x834e('0x22')]);_0x567cea[_0x834e('0x21')]=qs[_0x834e('0x21')](_0x58c1d7[_0x834e('0x37')]['offset']);}_0x567cea[_0x834e('0x3d')]=qs['sort'](_0x58c1d7[_0x834e('0x37')][_0x834e('0x3e')]);_0x567cea['where']=qs[_0x834e('0x38')](_[_0x834e('0x3f')](_0x58c1d7['query'],_0x106d6a['filters']));if(_0x58c1d7[_0x834e('0x37')][_0x834e('0x40')]){_0x567cea[_0x834e('0x41')]=_[_0x834e('0x42')](_0x567cea[_0x834e('0x41')],{'$or':_['map'](_0xb5bc06,function(_0x1c5ed6){if(_0x1c5ed6['type']!=='VIRTUAL'){var _0x1b2edf={};_0x1b2edf[_0x1c5ed6['name']]={'$like':'%'+_0x58c1d7[_0x834e('0x37')][_0x834e('0x40')]+'%'};return _0x1b2edf;}})});}_0x567cea=_[_0x834e('0x42')]({},_0x567cea,_0x58c1d7[_0x834e('0x43')]);var _0x2b7933={'where':_0x567cea['where']};return db[_0x834e('0x30')][_0x834e('0x20')](_0x2b7933)[_0x834e('0x28')](function(_0x58c5fb){_0x5dacc1[_0x834e('0x20')]=_0x58c5fb;if(_0x58c1d7[_0x834e('0x37')]['includeAll']){_0x567cea[_0x834e('0x44')]=[{'all':!![]}];}return db['CannedAnswer'][_0x834e('0x45')](_0x567cea);})[_0x834e('0x28')](function(_0x4a18bb){_0x5dacc1['rows']=_0x4a18bb;return _0x5dacc1;})[_0x834e('0x28')](respondWithFilteredResult(_0x2c7a8d,_0x567cea))[_0x834e('0x46')](handleError(_0x2c7a8d,null));};exports[_0x834e('0x47')]=function(_0xbc1571,_0x8ad264){var _0x23feea={'raw':!![],'where':{'id':_0xbc1571['params']['id']}},_0x195204={};_0x195204[_0x834e('0x35')]=_['keys'](db[_0x834e('0x30')]['rawAttributes']);_0x195204[_0x834e('0x37')]=_['keys'](_0xbc1571[_0x834e('0x37')]);_0x195204[_0x834e('0x38')]=_['intersection'](_0x195204[_0x834e('0x35')],_0x195204[_0x834e('0x37')]);_0x23feea[_0x834e('0x3a')]=_[_0x834e('0x39')](_0x195204[_0x834e('0x35')],qs[_0x834e('0x3b')](_0xbc1571[_0x834e('0x37')][_0x834e('0x3b')]));_0x23feea[_0x834e('0x3a')]=_0x23feea[_0x834e('0x3a')]['length']?_0x23feea[_0x834e('0x3a')]:_0x195204[_0x834e('0x35')];if(_0xbc1571['query'][_0x834e('0x48')]){_0x23feea[_0x834e('0x44')]=[{'all':!![]}];}_0x23feea=_[_0x834e('0x42')]({},_0x23feea,_0xbc1571[_0x834e('0x43')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x23feea)['then'](handleEntityNotFound(_0x8ad264,null))['then'](respondWithResult(_0x8ad264,null))[_0x834e('0x46')](handleError(_0x8ad264,null));};exports[_0x834e('0x27')]=function(_0x30568e,_0x40ff5a){if(_0x30568e[_0x834e('0x4a')]['id']){delete _0x30568e[_0x834e('0x4a')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x30568e[_0x834e('0x4b')]['id']}})[_0x834e('0x28')](handleEntityNotFound(_0x40ff5a,null))[_0x834e('0x28')](saveUpdates(_0x30568e[_0x834e('0x4a')],null))[_0x834e('0x28')](respondWithResult(_0x40ff5a,null))[_0x834e('0x46')](handleError(_0x40ff5a,null));};exports[_0x834e('0x2a')]=function(_0x1a3855,_0x3df078){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1a3855[_0x834e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3df078,null))[_0x834e('0x28')](removeEntity(_0x3df078,null))[_0x834e('0x46')](handleError(_0x3df078,null));};exports['create']=function(_0x3c00a3,_0x3b0988){var _0x55d491={'key':_0x3c00a3[_0x834e('0x4a')][_0x834e('0x34')]};if(_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4c')]){_0x55d491[_0x834e('0x4c')]=_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4c')];}else if(_0x3c00a3['body'][_0x834e('0x4d')]){_0x55d491[_0x834e('0x4d')]=_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4d')];}else if(_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4e')]){_0x55d491[_0x834e('0x4e')]=_0x3c00a3[_0x834e('0x4a')]['OpenchannelAccountId'];}else if(_0x3c00a3[_0x834e('0x4a')]['ChatWebsiteId']){_0x55d491[_0x834e('0x4f')]=_0x3c00a3['body'][_0x834e('0x4f')];}return db['CannedAnswer']['find']({'where':_0x55d491})[_0x834e('0x28')](function(_0x3e1bee){if(_0x3e1bee){throw new db['Sequelize']['ValidationError'](_0x834e('0x50'));}return db[_0x834e('0x30')][_0x834e('0x51')](_0x3c00a3[_0x834e('0x4a')]);})[_0x834e('0x28')](function(_0x315858){var _0x3d3f2b=_0x3c00a3[_0x834e('0x52')]['get']({'plain':!![]});if(!_0x3d3f2b)throw new Error(_0x834e('0x53'));if(_0x3d3f2b[_0x834e('0x54')]==='user'){var _0x281342=_0x315858['get']({'plain':!![]});return db[_0x834e('0x55')][_0x834e('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x3d3f2b[_0x834e('0x56')]},'raw':!![]})[_0x834e('0x28')](function(_0x2de29a){if(_0x2de29a&&_0x2de29a[_0x834e('0x57')]===0x0){return db['UserProfileResource'][_0x834e('0x51')]({'name':_0x281342[_0x834e('0x2e')],'resourceId':_0x281342['id'],'type':_0x2de29a[_0x834e('0x2e')],'sectionId':_0x2de29a['id']},{})['then'](function(){return _0x315858;});}else{return _0x315858;}})[_0x834e('0x46')](function(_0x1fcae9){logger[_0x834e('0x2c')](_0x834e('0x58'),_0x1fcae9);throw _0x1fcae9;});}return _0x315858;})[_0x834e('0x28')](respondWithResult(_0x3b0988,0xc9))[_0x834e('0x46')](handleError(_0x3b0988,null));}; \ No newline at end of file +var _0xa9e0=['filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','end','error','name','send','index','map','CannedAnswer','rawAttributes','type','key','model','query','keys'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){var _0x38e7c4=_0x588269[_0x0a9e('0x21')]({'plain':!![]});var _0x4abc77=_0x0a9e('0x22');return db[_0x0a9e('0x23')][_0x0a9e('0x20')]({'where':{'type':_0x4abc77,'resourceId':_0x38e7c4['id']}})[_0x0a9e('0x1f')](function(){return _0x588269;});})[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x24')]();});}};}function handleEntityNotFound(_0x5ea472,_0x59181e){return function(_0x197ec0){if(!_0x197ec0){_0x5ea472[_0x0a9e('0x14')](0x194);}return _0x197ec0;};}function handleError(_0x40c424,_0x33161b){_0x33161b=_0x33161b||0x1f4;return function(_0x526cf3){logger[_0x0a9e('0x25')](_0x526cf3['stack']);if(_0x526cf3[_0x0a9e('0x26')]){delete _0x526cf3['name'];}_0x40c424[_0x0a9e('0x15')](_0x33161b)[_0x0a9e('0x27')](_0x526cf3);};}exports[_0x0a9e('0x28')]=function(_0x14433c,_0x140511){var _0x1538a4={},_0x11c3b6={},_0x14de77={'count':0x0,'rows':[]};var _0x5a101a=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x2ec755){return{'name':_0x2ec755['fieldName'],'type':_0x2ec755[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x11c3b6[_0x0a9e('0x2e')]=_[_0x0a9e('0x29')](_0x5a101a,_0x0a9e('0x26'));_0x11c3b6[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x14433c[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x31')]=_['intersection'](_0x11c3b6[_0x0a9e('0x2e')],_0x11c3b6['query']);_0x1538a4[_0x0a9e('0x32')]=_[_0x0a9e('0x33')](_0x11c3b6[_0x0a9e('0x2e')],qs[_0x0a9e('0x34')](_0x14433c[_0x0a9e('0x2f')]['fields']));_0x1538a4[_0x0a9e('0x32')]=_0x1538a4[_0x0a9e('0x32')][_0x0a9e('0x35')]?_0x1538a4[_0x0a9e('0x32')]:_0x11c3b6[_0x0a9e('0x2e')];if(!_0x14433c[_0x0a9e('0x2f')][_0x0a9e('0x36')](_0x0a9e('0x37'))){_0x1538a4['limit']=qs[_0x0a9e('0x38')](_0x14433c['query'][_0x0a9e('0x38')]);_0x1538a4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x14433c[_0x0a9e('0x2f')]['offset']);}_0x1538a4[_0x0a9e('0x39')]=qs[_0x0a9e('0x3a')](_0x14433c[_0x0a9e('0x2f')][_0x0a9e('0x3a')]);_0x1538a4['where']=qs['filters'](_[_0x0a9e('0x3b')](_0x14433c['query'],_0x11c3b6[_0x0a9e('0x31')]));if(_0x14433c[_0x0a9e('0x2f')][_0x0a9e('0x3c')]){_0x1538a4[_0x0a9e('0x3d')]=_['merge'](_0x1538a4[_0x0a9e('0x3d')],{'$or':_[_0x0a9e('0x29')](_0x5a101a,function(_0x3cae){if(_0x3cae['type']!==_0x0a9e('0x3e')){var _0x1a180b={};_0x1a180b[_0x3cae[_0x0a9e('0x26')]]={'$like':'%'+_0x14433c['query']['filter']+'%'};return _0x1a180b;}})});}_0x1538a4=_[_0x0a9e('0x3f')]({},_0x1538a4,_0x14433c[_0x0a9e('0x40')]);var _0x5adda1={'where':_0x1538a4[_0x0a9e('0x3d')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x17')](_0x5adda1)[_0x0a9e('0x1f')](function(_0x4b38d9){_0x14de77['count']=_0x4b38d9;if(_0x14433c[_0x0a9e('0x2f')][_0x0a9e('0x41')]){_0x1538a4['include']=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x42')](_0x1538a4);})[_0x0a9e('0x1f')](function(_0x5b4f5e){_0x14de77[_0x0a9e('0x43')]=_0x5b4f5e;return _0x14de77;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x140511,_0x1538a4))[_0x0a9e('0x44')](handleError(_0x140511,null));};exports[_0x0a9e('0x45')]=function(_0x13cb1f,_0xeaa5e5){var _0x2881b3={'raw':!![],'where':{'id':_0x13cb1f[_0x0a9e('0x46')]['id']}},_0x45a9b8={};_0x45a9b8[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x45a9b8[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x13cb1f['query']);_0x45a9b8['filters']=_[_0x0a9e('0x33')](_0x45a9b8[_0x0a9e('0x2e')],_0x45a9b8[_0x0a9e('0x2f')]);_0x2881b3[_0x0a9e('0x32')]=_[_0x0a9e('0x33')](_0x45a9b8[_0x0a9e('0x2e')],qs[_0x0a9e('0x34')](_0x13cb1f[_0x0a9e('0x2f')][_0x0a9e('0x34')]));_0x2881b3[_0x0a9e('0x32')]=_0x2881b3[_0x0a9e('0x32')][_0x0a9e('0x35')]?_0x2881b3['attributes']:_0x45a9b8[_0x0a9e('0x2e')];if(_0x13cb1f[_0x0a9e('0x2f')][_0x0a9e('0x41')]){_0x2881b3[_0x0a9e('0x47')]=[{'all':!![]}];}_0x2881b3=_[_0x0a9e('0x3f')]({},_0x2881b3,_0x13cb1f[_0x0a9e('0x40')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x48')](_0x2881b3)['then'](handleEntityNotFound(_0xeaa5e5,null))[_0x0a9e('0x1f')](respondWithResult(_0xeaa5e5,null))['catch'](handleError(_0xeaa5e5,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x49')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x476688[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x49')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x44')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x1b5e80[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));};exports[_0x0a9e('0x4a')]=function(_0x3fe430,_0x4f7240){var _0x4ae14b={'key':_0x3fe430['body'][_0x0a9e('0x2d')]};if(_0x3fe430[_0x0a9e('0x49')][_0x0a9e('0x4b')]){_0x4ae14b[_0x0a9e('0x4b')]=_0x3fe430[_0x0a9e('0x49')][_0x0a9e('0x4b')];}else if(_0x3fe430[_0x0a9e('0x49')][_0x0a9e('0x4c')]){_0x4ae14b['SmsAccountId']=_0x3fe430['body']['SmsAccountId'];}else if(_0x3fe430[_0x0a9e('0x49')][_0x0a9e('0x4d')]){_0x4ae14b[_0x0a9e('0x4d')]=_0x3fe430['body'][_0x0a9e('0x4d')];}else if(_0x3fe430[_0x0a9e('0x49')]['ChatWebsiteId']){_0x4ae14b['ChatWebsiteId']=_0x3fe430[_0x0a9e('0x49')]['ChatWebsiteId'];}return db[_0x0a9e('0x2a')]['find']({'where':_0x4ae14b})[_0x0a9e('0x1f')](function(_0x3c20b2){if(_0x3c20b2){throw new db[(_0x0a9e('0x4e'))]['ValidationError'](_0x0a9e('0x4f'));}return db[_0x0a9e('0x2a')]['create'](_0x3fe430['body']);})[_0x0a9e('0x1f')](function(_0x3aedd0){var _0x49c095=_0x3fe430[_0x0a9e('0x50')]['get']({'plain':!![]});if(!_0x49c095)throw new Error(_0x0a9e('0x51'));if(_0x49c095['role']===_0x0a9e('0x50')){var _0x4a6deb=_0x3aedd0['get']({'plain':!![]});return db['UserProfileSection'][_0x0a9e('0x48')]({'where':{'name':'CannedAnswers','userProfileId':_0x49c095[_0x0a9e('0x52')]},'raw':!![]})[_0x0a9e('0x1f')](function(_0x3cfd00){if(_0x3cfd00&&_0x3cfd00[_0x0a9e('0x53')]===0x0){return db[_0x0a9e('0x23')][_0x0a9e('0x4a')]({'name':_0x4a6deb[_0x0a9e('0x26')],'resourceId':_0x4a6deb['id'],'type':_0x3cfd00[_0x0a9e('0x26')],'sectionId':_0x3cfd00['id']},{})['then'](function(){return _0x3aedd0;});}else{return _0x3aedd0;}})[_0x0a9e('0x44')](function(_0x121cef){logger[_0x0a9e('0x25')](_0x0a9e('0x54'),_0x121cef);throw _0x121cef;});}return _0x3aedd0;})[_0x0a9e('0x1f')](respondWithResult(_0x4f7240,0xc9))[_0x0a9e('0x44')](handleError(_0x4f7240,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 28124ea..ae2c5be 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 _0x0e24=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api'];(function(_0x39609a,_0x28a563){var _0xecd92=function(_0x57241a){while(--_0x57241a){_0x39609a['push'](_0x39609a['shift']());}};_0xecd92(++_0x28a563);}(_0x0e24,0x1da));var _0x40e2=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x0e24[_0x3511d3];return _0x5d6321;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x40e2('0x0'))(_0x40e2('0x1'));var moment=require(_0x40e2('0x2'));var BPromise=require(_0x40e2('0x3'));var rp=require(_0x40e2('0x4'));var fs=require('fs');var path=require(_0x40e2('0x5'));var rimraf=require(_0x40e2('0x6'));var config=require(_0x40e2('0x7'));var attributes=require(_0x40e2('0x8'));module[_0x40e2('0x9')]=function(_0x2c4fc1,_0x38f499){return _0x2c4fc1[_0x40e2('0xa')](_0x40e2('0xb'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x40e2('0xc'),'collate':_0x40e2('0xd')});}; \ No newline at end of file +var _0x0194=['utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','utf8mb4'];(function(_0x129ef1,_0x45995a){var _0x56b549=function(_0x50d5b4){while(--_0x50d5b4){_0x129ef1['push'](_0x129ef1['shift']());}};_0x56b549(++_0x45995a);}(_0x0194,0xf1));var _0x4019=function(_0x182d9d,_0xd18418){_0x182d9d=_0x182d9d-0x0;var _0xe1fe3b=_0x0194[_0x182d9d];return _0xe1fe3b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4019('0x0'))(_0x4019('0x1'));var moment=require(_0x4019('0x2'));var BPromise=require('bluebird');var rp=require(_0x4019('0x3'));var fs=require('fs');var path=require(_0x4019('0x4'));var rimraf=require(_0x4019('0x5'));var config=require(_0x4019('0x6'));var attributes=require(_0x4019('0x7'));module['exports']=function(_0x17ab91,_0x2803a5){return _0x17ab91[_0x4019('0x8')](_0x4019('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4019('0xa'),'collate':_0x4019('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 810f1e3..bb329c5 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 _0x2f0b=['jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','CannedAnswer,\x20%s,\x20%s','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4ffd61,_0x4bf2b9){var _0x5f91e0=function(_0x1fe97d){while(--_0x1fe97d){_0x4ffd61['push'](_0x4ffd61['shift']());}};_0x5f91e0(++_0x4bf2b9);}(_0x2f0b,0x1c3));var _0xb2f0=function(_0x160ad7,_0x402c7a){_0x160ad7=_0x160ad7-0x0;var _0x52c992=_0x2f0b[_0x160ad7];return _0x52c992;};'use strict';var _=require(_0xb2f0('0x0'));var util=require('util');var moment=require(_0xb2f0('0x1'));var BPromise=require('bluebird');var rs=require(_0xb2f0('0x2'));var fs=require('fs');var Redis=require(_0xb2f0('0x3'));var db=require(_0xb2f0('0x4'))['db'];var utils=require(_0xb2f0('0x5'));var logger=require(_0xb2f0('0x6'))(_0xb2f0('0x7'));var config=require(_0xb2f0('0x8'));var jayson=require(_0xb2f0('0x9'));var client=jayson[_0xb2f0('0xa')][_0xb2f0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dca61,_0x563faa,_0x5b6bd7){return new BPromise(function(_0x269f50,_0x52b62f){return client[_0xb2f0('0xc')](_0x5dca61,_0x5b6bd7)[_0xb2f0('0xd')](function(_0x5e8b04){logger[_0xb2f0('0xe')]('CannedAnswer,\x20%s,\x20%s',_0x563faa,_0xb2f0('0xf'));logger[_0xb2f0('0x10')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x563faa,'request\x20sent',JSON[_0xb2f0('0x11')](_0x5e8b04));if(_0x5e8b04[_0xb2f0('0x12')]){if(_0x5e8b04['error'][_0xb2f0('0x13')]===0x1f4){logger['error'](_0xb2f0('0x14'),_0x563faa,_0x5e8b04[_0xb2f0('0x12')][_0xb2f0('0x15')]);return _0x52b62f(_0x5e8b04[_0xb2f0('0x12')][_0xb2f0('0x15')]);}logger['error'](_0xb2f0('0x14'),_0x563faa,_0x5e8b04[_0xb2f0('0x12')][_0xb2f0('0x15')]);return _0x269f50(_0x5e8b04[_0xb2f0('0x12')][_0xb2f0('0x15')]);}else{logger[_0xb2f0('0xe')](_0xb2f0('0x14'),_0x563faa,_0xb2f0('0xf'));_0x269f50(_0x5e8b04['result'][_0xb2f0('0x15')]);}})[_0xb2f0('0x16')](function(_0x22ae50){logger[_0xb2f0('0x12')](_0xb2f0('0x14'),_0x563faa,_0x22ae50);_0x52b62f(_0x22ae50);});});} \ No newline at end of file +var _0x0c80=['request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','CannedAnswer,\x20%s,\x20%s'];(function(_0x2a2afa,_0x3b91e3){var _0x4fd359=function(_0x1dcc23){while(--_0x1dcc23){_0x2a2afa['push'](_0x2a2afa['shift']());}};_0x4fd359(++_0x3b91e3);}(_0x0c80,0x7f));var _0x00c8=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x0c80[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x00c8('0x0'));var util=require(_0x00c8('0x1'));var moment=require(_0x00c8('0x2'));var BPromise=require('bluebird');var rs=require(_0x00c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x00c8('0x4'));var logger=require('../../config/logger')(_0x00c8('0x5'));var config=require(_0x00c8('0x6'));var jayson=require(_0x00c8('0x7'));var client=jayson['client'][_0x00c8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29d444,_0x5cc66b,_0x3fb387){return new BPromise(function(_0x3bb1e9,_0x3e6cb7){return client[_0x00c8('0x9')](_0x29d444,_0x3fb387)[_0x00c8('0xa')](function(_0x144070){logger[_0x00c8('0xb')](_0x00c8('0xc'),_0x5cc66b,_0x00c8('0xd'));logger[_0x00c8('0xe')](_0x00c8('0xf'),_0x5cc66b,'request\x20sent',JSON[_0x00c8('0x10')](_0x144070));if(_0x144070[_0x00c8('0x11')]){if(_0x144070[_0x00c8('0x11')][_0x00c8('0x12')]===0x1f4){logger[_0x00c8('0x11')](_0x00c8('0xc'),_0x5cc66b,_0x144070[_0x00c8('0x11')][_0x00c8('0x13')]);return _0x3e6cb7(_0x144070[_0x00c8('0x11')][_0x00c8('0x13')]);}logger['error'](_0x00c8('0xc'),_0x5cc66b,_0x144070['error'][_0x00c8('0x13')]);return _0x3bb1e9(_0x144070[_0x00c8('0x11')][_0x00c8('0x13')]);}else{logger[_0x00c8('0xb')](_0x00c8('0xc'),_0x5cc66b,'request\x20sent');_0x3bb1e9(_0x144070['result'][_0x00c8('0x13')]);}})['catch'](function(_0xbad783){logger[_0x00c8('0x11')](_0x00c8('0xc'),_0x5cc66b,_0xbad783);_0x3e6cb7(_0xbad783);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 39c1b8e..1b15c9f 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 _0x3713=['isAuthenticated','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./cannedAnswer.controller','get','index','/:id','show','post'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x3713,0x192));var _0x3371=function(_0x7aea70,_0x4c89e1){_0x7aea70=_0x7aea70-0x0;var _0x358c35=_0x3713[_0x7aea70];return _0x358c35;};'use strict';var multer=require(_0x3371('0x0'));var util=require(_0x3371('0x1'));var path=require('path');var timeout=require(_0x3371('0x2'));var express=require(_0x3371('0x3'));var router=express[_0x3371('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3371('0x5'));var config=require('../../config/environment');var controller=require(_0x3371('0x6'));router[_0x3371('0x7')]('/',auth['isAuthenticated'](),controller[_0x3371('0x8')]);router['get'](_0x3371('0x9'),auth['isAuthenticated'](),controller[_0x3371('0xa')]);router[_0x3371('0xb')]('/',auth[_0x3371('0xc')](),controller[_0x3371('0xd')]);router[_0x3371('0xe')]('/:id',auth[_0x3371('0xc')](),controller[_0x3371('0xf')]);router[_0x3371('0x10')](_0x3371('0x9'),auth[_0x3371('0xc')](),controller['destroy']);module[_0x3371('0x11')]=router; \ No newline at end of file +var _0x9c03=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','index','/:id','create','put','isAuthenticated','delete','destroy','multer','util','path','connect-timeout'];(function(_0xb9c1fd,_0x3858f2){var _0x2ba9b6=function(_0x3ed308){while(--_0x3ed308){_0xb9c1fd['push'](_0xb9c1fd['shift']());}};_0x2ba9b6(++_0x3858f2);}(_0x9c03,0x1d8));var _0x39c0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9c03[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x39c0('0x0'));var util=require(_0x39c0('0x1'));var path=require(_0x39c0('0x2'));var timeout=require(_0x39c0('0x3'));var express=require('express');var router=express[_0x39c0('0x4')]();var auth=require(_0x39c0('0x5'));var interaction=require(_0x39c0('0x6'));var config=require(_0x39c0('0x7'));var controller=require(_0x39c0('0x8'));router[_0x39c0('0x9')]('/',auth['isAuthenticated'](),controller[_0x39c0('0xa')]);router[_0x39c0('0x9')](_0x39c0('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x39c0('0xc')]);router[_0x39c0('0xd')](_0x39c0('0xb'),auth[_0x39c0('0xe')](),controller['update']);router[_0x39c0('0xf')](_0x39c0('0xb'),auth[_0x39c0('0xe')](),controller[_0x39c0('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index f4b5894..f0b44ae 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 _0x9063=['INTEGER','sequelize','exports','1970-01-01\x2000:00:01','STRING'];(function(_0x7be938,_0x24b3db){var _0x2ab3ab=function(_0x490534){while(--_0x490534){_0x7be938['push'](_0x7be938['shift']());}};_0x2ab3ab(++_0x24b3db);}(_0x9063,0x100));var _0x3906=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x9063[_0x521929];return _0x632436;};'use strict';var Sequelize=require(_0x3906('0x0'));module[_0x3906('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x3906('0x2')},'clid':{'type':Sequelize[_0x3906('0x3')]},'src':{'type':Sequelize[_0x3906('0x3')]},'dst':{'type':Sequelize[_0x3906('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3906('0x3')]},'dstchannel':{'type':Sequelize[_0x3906('0x3')]},'lastapp':{'type':Sequelize[_0x3906('0x3')]},'lastdata':{'type':Sequelize[_0x3906('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x3906('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3906('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x3906('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x3906('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x3906('0x3')]},'type':{'type':Sequelize[_0x3906('0x3')]},'tag':{'type':Sequelize[_0x3906('0x3')]}}; \ No newline at end of file +var _0x5123=['INTEGER','sequelize','exports','1970-01-01\x2000:00:01','STRING'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x5123,0x191));var _0x3512=function(_0x1df8e0,_0xcb306e){_0x1df8e0=_0x1df8e0-0x0;var _0x153d7c=_0x5123[_0x1df8e0];return _0x153d7c;};'use strict';var Sequelize=require(_0x3512('0x0'));module[_0x3512('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x3512('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x3512('0x3')]},'dst':{'type':Sequelize[_0x3512('0x3')]},'dcontext':{'type':Sequelize[_0x3512('0x3')]},'channel':{'type':Sequelize[_0x3512('0x3')]},'dstchannel':{'type':Sequelize[_0x3512('0x3')]},'lastapp':{'type':Sequelize[_0x3512('0x3')]},'lastdata':{'type':Sequelize[_0x3512('0x3')]},'duration':{'type':Sequelize[_0x3512('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x3512('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x3512('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x3512('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x3512('0x3')]},'sequence':{'type':Sequelize[_0x3512('0x3')]},'peeraccount':{'type':Sequelize[_0x3512('0x3')]},'type':{'type':Sequelize[_0x3512('0x3')]},'tag':{'type':Sequelize[_0x3512('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 55a8cd4..7d09bc9 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 _0x5745=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','send','index','Cdr','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x3f7879,_0x32cca7){var _0x2817ac=function(_0x5e963e){while(--_0x5e963e){_0x3f7879['push'](_0x3f7879['shift']());}};_0x2817ac(++_0x32cca7);}(_0x5745,0x1bf));var _0x5574=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5745[_0x2b4411];return _0x8e41ef;};'use strict';var pdf=require(_0x5574('0x0'));var emlformat=require(_0x5574('0x1'));var rimraf=require(_0x5574('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5574('0x3'));var moment=require(_0x5574('0x4'));var BPromise=require(_0x5574('0x5'));var Mustache=require(_0x5574('0x6'));var util=require(_0x5574('0x7'));var path=require(_0x5574('0x8'));var sox=require('sox');var csv=require(_0x5574('0x9'));var ejs=require(_0x5574('0xa'));var fs=require('fs');var _=require(_0x5574('0xb'));var squel=require(_0x5574('0xc'));var crypto=require(_0x5574('0xd'));var jsforce=require(_0x5574('0xe'));var deskjs=require(_0x5574('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5574('0x10'));var Papa=require(_0x5574('0x11'));var Redis=require(_0x5574('0x12'));var authService=require(_0x5574('0x13'));var qs=require(_0x5574('0x14'));var as=require(_0x5574('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5574('0x16'))(_0x5574('0x17'));var utils=require(_0x5574('0x18'));var config=require(_0x5574('0x19'));var db=require(_0x5574('0x1a'))['db'];function respondWithStatusCode(_0x1c15ea,_0x3ef38a){_0x3ef38a=_0x3ef38a||0xcc;return function(_0xc11986){if(_0xc11986){return _0x1c15ea[_0x5574('0x1b')](_0x3ef38a);}return _0x1c15ea['status'](_0x3ef38a)[_0x5574('0x1c')]();};}function respondWithResult(_0x52a148,_0x4d64ef){_0x4d64ef=_0x4d64ef||0xc8;return function(_0x13db20){if(_0x13db20){return _0x52a148[_0x5574('0x1d')](_0x4d64ef)['json'](_0x13db20);}};}function respondWithFilteredResult(_0x207ffa,_0x16c2a8){return function(_0x557e83){if(_0x557e83){var _0x2a2ab0=_0x557e83[_0x5574('0x1e')],_0x11dba7=_0x16c2a8[_0x5574('0x1f')],_0x262c8e=_0x16c2a8['offset']+_0x16c2a8[_0x5574('0x20')],_0x243285;if(_0x262c8e>=_0x2a2ab0){_0x262c8e=_0x2a2ab0;_0x243285=0xc8;}else{_0x243285=0xce;}_0x207ffa[_0x5574('0x1d')](_0x243285);return _0x207ffa['set'](_0x5574('0x21'),_0x11dba7+'-'+_0x262c8e+'/'+_0x2a2ab0)[_0x5574('0x22')](_0x557e83);}return null;};}function patchUpdates(_0x577d73){return function(_0x26c100){try{jsonpatch[_0x5574('0x23')](_0x26c100,_0x577d73,!![]);}catch(_0x3a71a8){return BPromise[_0x5574('0x24')](_0x3a71a8);}return _0x26c100[_0x5574('0x25')]();};}function saveUpdates(_0x452ebb,_0x13ca1d){return function(_0x50013f){if(_0x50013f){return _0x50013f[_0x5574('0x26')](_0x452ebb)[_0x5574('0x27')](function(_0xc0969b){return _0xc0969b;});}return null;};}function removeEntity(_0x1a29c7,_0x2d09e4){return function(_0xe0b4fc){if(_0xe0b4fc){return _0xe0b4fc[_0x5574('0x28')]()[_0x5574('0x27')](function(){_0x1a29c7['status'](0xcc)[_0x5574('0x1c')]();});}};}function handleEntityNotFound(_0x4ad2d9,_0x541e05){return function(_0x227591){if(!_0x227591){_0x4ad2d9['sendStatus'](0x194);}return _0x227591;};}function handleError(_0x11e60c,_0xa3f022){_0xa3f022=_0xa3f022||0x1f4;return function(_0x40d564){logger['error'](_0x40d564['stack']);if(_0x40d564['name']){delete _0x40d564['name'];}_0x11e60c[_0x5574('0x1d')](_0xa3f022)[_0x5574('0x29')](_0x40d564);};}exports[_0x5574('0x2a')]=function(_0x3ababa,_0x30406b){var _0x66bad1={},_0x2da854={},_0xea649d={'count':0x0,'rows':[]};var _0x5b9f83=_['map'](db[_0x5574('0x2b')]['rawAttributes'],function(_0x15c85d){return{'name':_0x15c85d[_0x5574('0x2c')],'type':_0x15c85d[_0x5574('0x2d')][_0x5574('0x2e')]};});_0x2da854[_0x5574('0x2f')]=_[_0x5574('0x30')](_0x5b9f83,'name');_0x2da854['query']=_[_0x5574('0x31')](_0x3ababa[_0x5574('0x32')]);_0x2da854[_0x5574('0x33')]=_[_0x5574('0x34')](_0x2da854[_0x5574('0x2f')],_0x2da854[_0x5574('0x32')]);_0x66bad1[_0x5574('0x35')]=_[_0x5574('0x34')](_0x2da854[_0x5574('0x2f')],qs[_0x5574('0x36')](_0x3ababa[_0x5574('0x32')]['fields']));_0x66bad1['attributes']=_0x66bad1[_0x5574('0x35')][_0x5574('0x37')]?_0x66bad1['attributes']:_0x2da854[_0x5574('0x2f')];if(!_0x3ababa['query'][_0x5574('0x38')](_0x5574('0x39'))){_0x66bad1[_0x5574('0x20')]=qs[_0x5574('0x20')](_0x3ababa[_0x5574('0x32')]['limit']);_0x66bad1[_0x5574('0x1f')]=qs['offset'](_0x3ababa[_0x5574('0x32')][_0x5574('0x1f')]);}_0x66bad1[_0x5574('0x3a')]=qs[_0x5574('0x3b')](_0x3ababa[_0x5574('0x32')]['sort']);_0x66bad1[_0x5574('0x3c')]=qs['filters'](_[_0x5574('0x3d')](_0x3ababa[_0x5574('0x32')],_0x2da854[_0x5574('0x33')]));if(_0x3ababa[_0x5574('0x32')][_0x5574('0x3e')]){_0x66bad1[_0x5574('0x3c')]=_[_0x5574('0x3f')](_0x66bad1[_0x5574('0x3c')],{'$or':_[_0x5574('0x30')](_0x5b9f83,function(_0x3273be){if(_0x3273be[_0x5574('0x2d')]!==_0x5574('0x40')){var _0x791298={};_0x791298[_0x3273be['name']]={'$like':'%'+_0x3ababa[_0x5574('0x32')]['filter']+'%'};return _0x791298;}})});}_0x66bad1=_[_0x5574('0x3f')]({},_0x66bad1,_0x3ababa[_0x5574('0x41')]);var _0x37d6ee={'where':_0x66bad1[_0x5574('0x3c')]};return db['Cdr'][_0x5574('0x1e')](_0x37d6ee)[_0x5574('0x27')](function(_0x1cb366){_0xea649d[_0x5574('0x1e')]=_0x1cb366;if(_0x3ababa['query']['includeAll']){_0x66bad1[_0x5574('0x42')]=[{'all':!![]}];}return db[_0x5574('0x2b')][_0x5574('0x43')](_0x66bad1);})[_0x5574('0x27')](function(_0x38e474){_0xea649d[_0x5574('0x44')]=_0x38e474;return _0xea649d;})[_0x5574('0x27')](respondWithFilteredResult(_0x30406b,_0x66bad1))[_0x5574('0x45')](handleError(_0x30406b,null));};exports['show']=function(_0x5230ba,_0x2dedce){var _0x360c63={'raw':!![],'where':{'id':_0x5230ba[_0x5574('0x46')]['id']}},_0x4369aa={};_0x4369aa[_0x5574('0x2f')]=_[_0x5574('0x31')](db['Cdr'][_0x5574('0x47')]);_0x4369aa[_0x5574('0x32')]=_[_0x5574('0x31')](_0x5230ba[_0x5574('0x32')]);_0x4369aa[_0x5574('0x33')]=_['intersection'](_0x4369aa[_0x5574('0x2f')],_0x4369aa[_0x5574('0x32')]);_0x360c63[_0x5574('0x35')]=_['intersection'](_0x4369aa[_0x5574('0x2f')],qs[_0x5574('0x36')](_0x5230ba[_0x5574('0x32')][_0x5574('0x36')]));_0x360c63[_0x5574('0x35')]=_0x360c63['attributes']['length']?_0x360c63[_0x5574('0x35')]:_0x4369aa[_0x5574('0x2f')];if(_0x5230ba[_0x5574('0x32')][_0x5574('0x48')]){_0x360c63[_0x5574('0x42')]=[{'all':!![]}];}_0x360c63=_[_0x5574('0x3f')]({},_0x360c63,_0x5230ba['options']);return db['Cdr'][_0x5574('0x49')](_0x360c63)['then'](handleEntityNotFound(_0x2dedce,null))['then'](respondWithResult(_0x2dedce,null))['catch'](handleError(_0x2dedce,null));};exports['create']=function(_0x1e986f,_0x948432){return db[_0x5574('0x2b')][_0x5574('0x4a')](_0x1e986f['body'],{})[_0x5574('0x27')](respondWithResult(_0x948432,0xc9))['catch'](handleError(_0x948432,null));};exports[_0x5574('0x26')]=function(_0x5ec3e0,_0x1523c8){if(_0x5ec3e0[_0x5574('0x4b')]['id']){delete _0x5ec3e0[_0x5574('0x4b')]['id'];}return db[_0x5574('0x2b')][_0x5574('0x49')]({'where':{'id':_0x5ec3e0['params']['id']}})[_0x5574('0x27')](handleEntityNotFound(_0x1523c8,null))[_0x5574('0x27')](saveUpdates(_0x5ec3e0[_0x5574('0x4b')],null))['then'](respondWithResult(_0x1523c8,null))['catch'](handleError(_0x1523c8,null));};exports[_0x5574('0x28')]=function(_0x9d6796,_0x2567ff){return db[_0x5574('0x2b')]['find']({'where':{'id':_0x9d6796[_0x5574('0x46')]['id']}})[_0x5574('0x27')](handleEntityNotFound(_0x2567ff,null))[_0x5574('0x27')](removeEntity(_0x2567ff,null))[_0x5574('0x45')](handleError(_0x2567ff,null));};exports['describe']=function(_0x22d12b,_0x2a70af){return db['Cdr'][_0x5574('0x4c')]()['then'](respondWithResult(_0x2a70af,null))['catch'](handleError(_0x2a70af,null));}; \ No newline at end of file +var _0x38c7=['then','destroy','error','stack','name','send','index','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','Cdr','includeAll','include','params','keys','rawAttributes','merge','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','request-promise','moment','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','../../mysqldb','sendStatus','status','count','offset','limit','set','json','apply','reject','save'];(function(_0x2e4ac3,_0x148fd8){var _0x454914=function(_0x2bf591){while(--_0x2bf591){_0x2e4ac3['push'](_0x2e4ac3['shift']());}};_0x454914(++_0x148fd8);}(_0x38c7,0x106));var _0x738c=function(_0x2a4dad,_0xde224d){_0x2a4dad=_0x2a4dad-0x0;var _0x406010=_0x38c7[_0x2a4dad];return _0x406010;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x738c('0x0'));var rimraf=require(_0x738c('0x1'));var zipdir=require(_0x738c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x738c('0x3'));var moment=require(_0x738c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x738c('0x5'));var util=require('util');var path=require(_0x738c('0x6'));var sox=require(_0x738c('0x7'));var csv=require(_0x738c('0x8'));var ejs=require(_0x738c('0x9'));var fs=require('fs');var _=require(_0x738c('0xa'));var squel=require('squel');var crypto=require(_0x738c('0xb'));var jsforce=require(_0x738c('0xc'));var deskjs=require(_0x738c('0xd'));var toCsv=require(_0x738c('0x8'));var querystring=require('querystring');var Papa=require(_0x738c('0xe'));var Redis=require(_0x738c('0xf'));var authService=require(_0x738c('0x10'));var qs=require(_0x738c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x738c('0x12'));var logger=require(_0x738c('0x13'))(_0x738c('0x14'));var utils=require(_0x738c('0x15'));var config=require(_0x738c('0x16'));var db=require(_0x738c('0x17'))['db'];function respondWithStatusCode(_0x27c36d,_0x22d712){_0x22d712=_0x22d712||0xcc;return function(_0x271c7a){if(_0x271c7a){return _0x27c36d[_0x738c('0x18')](_0x22d712);}return _0x27c36d[_0x738c('0x19')](_0x22d712)['end']();};}function respondWithResult(_0x140001,_0x4ce8de){_0x4ce8de=_0x4ce8de||0xc8;return function(_0x213642){if(_0x213642){return _0x140001[_0x738c('0x19')](_0x4ce8de)['json'](_0x213642);}};}function respondWithFilteredResult(_0x485aa1,_0x5cdf24){return function(_0x34af2e){if(_0x34af2e){var _0x564ab3=_0x34af2e[_0x738c('0x1a')],_0xcc465d=_0x5cdf24['offset'],_0x710635=_0x5cdf24[_0x738c('0x1b')]+_0x5cdf24[_0x738c('0x1c')],_0x2069ba;if(_0x710635>=_0x564ab3){_0x710635=_0x564ab3;_0x2069ba=0xc8;}else{_0x2069ba=0xce;}_0x485aa1[_0x738c('0x19')](_0x2069ba);return _0x485aa1[_0x738c('0x1d')]('Content-Range',_0xcc465d+'-'+_0x710635+'/'+_0x564ab3)[_0x738c('0x1e')](_0x34af2e);}return null;};}function patchUpdates(_0x153103){return function(_0x2b5406){try{jsonpatch[_0x738c('0x1f')](_0x2b5406,_0x153103,!![]);}catch(_0x3934e6){return BPromise[_0x738c('0x20')](_0x3934e6);}return _0x2b5406[_0x738c('0x21')]();};}function saveUpdates(_0x46c43b,_0x25585b){return function(_0x240eba){if(_0x240eba){return _0x240eba['update'](_0x46c43b)[_0x738c('0x22')](function(_0x588cda){return _0x588cda;});}return null;};}function removeEntity(_0x3e7ce8,_0x468c1f){return function(_0xd7799a){if(_0xd7799a){return _0xd7799a[_0x738c('0x23')]()[_0x738c('0x22')](function(){_0x3e7ce8[_0x738c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e7cac,_0x4f4176){return function(_0x367cf1){if(!_0x367cf1){_0x1e7cac[_0x738c('0x18')](0x194);}return _0x367cf1;};}function handleError(_0x1722de,_0x3512ab){_0x3512ab=_0x3512ab||0x1f4;return function(_0x8503c2){logger[_0x738c('0x24')](_0x8503c2[_0x738c('0x25')]);if(_0x8503c2[_0x738c('0x26')]){delete _0x8503c2[_0x738c('0x26')];}_0x1722de[_0x738c('0x19')](_0x3512ab)[_0x738c('0x27')](_0x8503c2);};}exports[_0x738c('0x28')]=function(_0x48f2cd,_0x46fd7a){var _0x3e0ad4={},_0x104689={},_0x27d9f7={'count':0x0,'rows':[]};var _0x29455b=_['map'](db['Cdr']['rawAttributes'],function(_0x3e6604){return{'name':_0x3e6604[_0x738c('0x29')],'type':_0x3e6604[_0x738c('0x2a')][_0x738c('0x2b')]};});_0x104689[_0x738c('0x2c')]=_[_0x738c('0x2d')](_0x29455b,_0x738c('0x26'));_0x104689[_0x738c('0x2e')]=_['keys'](_0x48f2cd[_0x738c('0x2e')]);_0x104689[_0x738c('0x2f')]=_['intersection'](_0x104689[_0x738c('0x2c')],_0x104689[_0x738c('0x2e')]);_0x3e0ad4['attributes']=_[_0x738c('0x30')](_0x104689[_0x738c('0x2c')],qs[_0x738c('0x31')](_0x48f2cd[_0x738c('0x2e')]['fields']));_0x3e0ad4[_0x738c('0x32')]=_0x3e0ad4[_0x738c('0x32')][_0x738c('0x33')]?_0x3e0ad4[_0x738c('0x32')]:_0x104689[_0x738c('0x2c')];if(!_0x48f2cd['query'][_0x738c('0x34')](_0x738c('0x35'))){_0x3e0ad4[_0x738c('0x1c')]=qs[_0x738c('0x1c')](_0x48f2cd[_0x738c('0x2e')][_0x738c('0x1c')]);_0x3e0ad4[_0x738c('0x1b')]=qs[_0x738c('0x1b')](_0x48f2cd['query'][_0x738c('0x1b')]);}_0x3e0ad4[_0x738c('0x36')]=qs['sort'](_0x48f2cd[_0x738c('0x2e')][_0x738c('0x37')]);_0x3e0ad4[_0x738c('0x38')]=qs['filters'](_[_0x738c('0x39')](_0x48f2cd['query'],_0x104689[_0x738c('0x2f')]));if(_0x48f2cd['query'][_0x738c('0x3a')]){_0x3e0ad4[_0x738c('0x38')]=_['merge'](_0x3e0ad4['where'],{'$or':_['map'](_0x29455b,function(_0x461d1e){if(_0x461d1e[_0x738c('0x2a')]!==_0x738c('0x3b')){var _0x4c7fe1={};_0x4c7fe1[_0x461d1e['name']]={'$like':'%'+_0x48f2cd[_0x738c('0x2e')][_0x738c('0x3a')]+'%'};return _0x4c7fe1;}})});}_0x3e0ad4=_['merge']({},_0x3e0ad4,_0x48f2cd[_0x738c('0x3c')]);var _0x28cd26={'where':_0x3e0ad4[_0x738c('0x38')]};return db[_0x738c('0x3d')][_0x738c('0x1a')](_0x28cd26)[_0x738c('0x22')](function(_0x2f9c21){_0x27d9f7[_0x738c('0x1a')]=_0x2f9c21;if(_0x48f2cd[_0x738c('0x2e')][_0x738c('0x3e')]){_0x3e0ad4[_0x738c('0x3f')]=[{'all':!![]}];}return db[_0x738c('0x3d')]['findAll'](_0x3e0ad4);})[_0x738c('0x22')](function(_0x3e6236){_0x27d9f7['rows']=_0x3e6236;return _0x27d9f7;})[_0x738c('0x22')](respondWithFilteredResult(_0x46fd7a,_0x3e0ad4))['catch'](handleError(_0x46fd7a,null));};exports['show']=function(_0x58a2a5,_0x235d0e){var _0x41d265={'raw':!![],'where':{'id':_0x58a2a5[_0x738c('0x40')]['id']}},_0x44188a={};_0x44188a[_0x738c('0x2c')]=_[_0x738c('0x41')](db[_0x738c('0x3d')][_0x738c('0x42')]);_0x44188a['query']=_['keys'](_0x58a2a5[_0x738c('0x2e')]);_0x44188a[_0x738c('0x2f')]=_[_0x738c('0x30')](_0x44188a[_0x738c('0x2c')],_0x44188a[_0x738c('0x2e')]);_0x41d265['attributes']=_[_0x738c('0x30')](_0x44188a[_0x738c('0x2c')],qs['fields'](_0x58a2a5[_0x738c('0x2e')][_0x738c('0x31')]));_0x41d265[_0x738c('0x32')]=_0x41d265[_0x738c('0x32')][_0x738c('0x33')]?_0x41d265[_0x738c('0x32')]:_0x44188a[_0x738c('0x2c')];if(_0x58a2a5[_0x738c('0x2e')][_0x738c('0x3e')]){_0x41d265['include']=[{'all':!![]}];}_0x41d265=_[_0x738c('0x43')]({},_0x41d265,_0x58a2a5[_0x738c('0x3c')]);return db['Cdr'][_0x738c('0x44')](_0x41d265)[_0x738c('0x22')](handleEntityNotFound(_0x235d0e,null))[_0x738c('0x22')](respondWithResult(_0x235d0e,null))[_0x738c('0x45')](handleError(_0x235d0e,null));};exports['create']=function(_0x5e7727,_0x11c195){return db['Cdr'][_0x738c('0x46')](_0x5e7727[_0x738c('0x47')],{})['then'](respondWithResult(_0x11c195,0xc9))[_0x738c('0x45')](handleError(_0x11c195,null));};exports[_0x738c('0x48')]=function(_0xeb72d0,_0x3190fa){if(_0xeb72d0['body']['id']){delete _0xeb72d0[_0x738c('0x47')]['id'];}return db[_0x738c('0x3d')][_0x738c('0x44')]({'where':{'id':_0xeb72d0[_0x738c('0x40')]['id']}})[_0x738c('0x22')](handleEntityNotFound(_0x3190fa,null))[_0x738c('0x22')](saveUpdates(_0xeb72d0[_0x738c('0x47')],null))[_0x738c('0x22')](respondWithResult(_0x3190fa,null))[_0x738c('0x45')](handleError(_0x3190fa,null));};exports[_0x738c('0x23')]=function(_0x98297a,_0x4fa976){return db[_0x738c('0x3d')][_0x738c('0x44')]({'where':{'id':_0x98297a[_0x738c('0x40')]['id']}})[_0x738c('0x22')](handleEntityNotFound(_0x4fa976,null))[_0x738c('0x22')](removeEntity(_0x4fa976,null))[_0x738c('0x45')](handleError(_0x4fa976,null));};exports[_0x738c('0x49')]=function(_0xbbee9e,_0x36b607){return db[_0x738c('0x3d')]['describe']()[_0x738c('0x22')](respondWithResult(_0x36b607,null))[_0x738c('0x45')](handleError(_0x36b607,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 9cb35a8..befb029 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 _0x326f=['../../config/environment','./cdr.attributes','exports','define','Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x326f,0xd1));var _0xf326=function(_0x2810db,_0x148dd0){_0x2810db=_0x2810db-0x0;var _0x348d0e=_0x326f[_0x2810db];return _0x348d0e;};'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':[{'name':_0xf326('0xd'),'fields':['accountcode']},{'name':'calldate','fields':['calldate']},{'name':_0xf326('0xe'),'fields':[_0xf326('0xe')]},{'name':_0xf326('0xf'),'fields':[_0xf326('0xf')]},{'name':_0xf326('0x10'),'fields':['src']},{'name':_0xf326('0x11'),'fields':['uniqueid']}],'timestamps':![]});}; \ No newline at end of file +var _0xeda8=['exports','define','cdr','accountcode','calldate','dst','src','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes'];(function(_0x4c1ae8,_0x1a3775){var _0x27dd31=function(_0xdf364a){while(--_0xdf364a){_0x4c1ae8['push'](_0x4c1ae8['shift']());}};_0x27dd31(++_0x1a3775);}(_0xeda8,0x104));var _0x8eda=function(_0x2f15ab,_0x2f1dd4){_0x2f15ab=_0x2f15ab-0x0;var _0x433b6b=_0xeda8[_0x2f15ab];return _0x433b6b;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var logger=require('../../config/logger')(_0x8eda('0x2'));var moment=require(_0x8eda('0x3'));var BPromise=require(_0x8eda('0x4'));var rp=require(_0x8eda('0x5'));var fs=require('fs');var path=require(_0x8eda('0x6'));var rimraf=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var attributes=require(_0x8eda('0x9'));module[_0x8eda('0xa')]=function(_0x1f3556,_0x349361){return _0x1f3556[_0x8eda('0xb')]('Cdr',attributes,{'tableName':_0x8eda('0xc'),'paranoid':![],'indexes':[{'name':_0x8eda('0xd'),'fields':[_0x8eda('0xd')]},{'name':_0x8eda('0xe'),'fields':['calldate']},{'name':'disposition','fields':['disposition']},{'name':'dst','fields':[_0x8eda('0xf')]},{'name':_0x8eda('0x10'),'fields':[_0x8eda('0x10')]},{'name':'uniqueid','fields':[_0x8eda('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index b41b6a5..a01e792 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 _0xbb96=['request\x20sent','debug','code','error','Cdr,\x20%s,\x20%s','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x43d9d3,_0x131ba7){var _0x469bff=function(_0x18fd42){while(--_0x18fd42){_0x43d9d3['push'](_0x43d9d3['shift']());}};_0x469bff(++_0x131ba7);}(_0xbb96,0xcd));var _0x6bb9=function(_0x4aa4af,_0x210cde){_0x4aa4af=_0x4aa4af-0x0;var _0x3bf44a=_0xbb96[_0x4aa4af];return _0x3bf44a;};'use strict';var _=require(_0x6bb9('0x0'));var util=require('util');var moment=require(_0x6bb9('0x1'));var BPromise=require('bluebird');var rs=require(_0x6bb9('0x2'));var fs=require('fs');var Redis=require(_0x6bb9('0x3'));var db=require(_0x6bb9('0x4'))['db'];var utils=require(_0x6bb9('0x5'));var logger=require(_0x6bb9('0x6'))(_0x6bb9('0x7'));var config=require(_0x6bb9('0x8'));var jayson=require(_0x6bb9('0x9'));var client=jayson[_0x6bb9('0xa')][_0x6bb9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4277dc,_0x3eca76,_0x48c86f){return new BPromise(function(_0x26244c,_0x43b30e){return client[_0x6bb9('0xc')](_0x4277dc,_0x48c86f)[_0x6bb9('0xd')](function(_0x2e6f51){logger[_0x6bb9('0xe')]('Cdr,\x20%s,\x20%s',_0x3eca76,_0x6bb9('0xf'));logger[_0x6bb9('0x10')]('Cdr,\x20%s,\x20%s,\x20%s',_0x3eca76,_0x6bb9('0xf'),JSON['stringify'](_0x2e6f51));if(_0x2e6f51['error']){if(_0x2e6f51['error'][_0x6bb9('0x11')]===0x1f4){logger[_0x6bb9('0x12')](_0x6bb9('0x13'),_0x3eca76,_0x2e6f51[_0x6bb9('0x12')][_0x6bb9('0x14')]);return _0x43b30e(_0x2e6f51['error'][_0x6bb9('0x14')]);}logger[_0x6bb9('0x12')]('Cdr,\x20%s,\x20%s',_0x3eca76,_0x2e6f51[_0x6bb9('0x12')][_0x6bb9('0x14')]);return _0x26244c(_0x2e6f51[_0x6bb9('0x12')][_0x6bb9('0x14')]);}else{logger[_0x6bb9('0xe')](_0x6bb9('0x13'),_0x3eca76,_0x6bb9('0xf'));_0x26244c(_0x2e6f51['result'][_0x6bb9('0x14')]);}})[_0x6bb9('0x15')](function(_0x35af12){logger['error']('Cdr,\x20%s,\x20%s',_0x3eca76,_0x35af12);_0x43b30e(_0x35af12);});});} \ No newline at end of file +var _0x2c25=['Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x59b6dc,_0x43a1d4){var _0x3a6955=function(_0x8c5a01){while(--_0x8c5a01){_0x59b6dc['push'](_0x59b6dc['shift']());}};_0x3a6955(++_0x43a1d4);}(_0x2c25,0x7c));var _0x52c2=function(_0x5ca72f,_0xccbe4e){_0x5ca72f=_0x5ca72f-0x0;var _0x406089=_0x2c25[_0x5ca72f];return _0x406089;};'use strict';var _=require(_0x52c2('0x0'));var util=require(_0x52c2('0x1'));var moment=require('moment');var BPromise=require(_0x52c2('0x2'));var rs=require(_0x52c2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x52c2('0x4'))['db'];var utils=require(_0x52c2('0x5'));var logger=require(_0x52c2('0x6'))(_0x52c2('0x7'));var config=require(_0x52c2('0x8'));var jayson=require(_0x52c2('0x9'));var client=jayson[_0x52c2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x436ea2,_0x27babb,_0xf233bf){return new BPromise(function(_0x2e215d,_0xf20420){return client[_0x52c2('0xb')](_0x436ea2,_0xf233bf)[_0x52c2('0xc')](function(_0x36571c){logger[_0x52c2('0xd')](_0x52c2('0xe'),_0x27babb,_0x52c2('0xf'));logger[_0x52c2('0x10')]('Cdr,\x20%s,\x20%s,\x20%s',_0x27babb,_0x52c2('0xf'),JSON[_0x52c2('0x11')](_0x36571c));if(_0x36571c[_0x52c2('0x12')]){if(_0x36571c[_0x52c2('0x12')][_0x52c2('0x13')]===0x1f4){logger[_0x52c2('0x12')](_0x52c2('0xe'),_0x27babb,_0x36571c[_0x52c2('0x12')]['message']);return _0xf20420(_0x36571c[_0x52c2('0x12')][_0x52c2('0x14')]);}logger['error'](_0x52c2('0xe'),_0x27babb,_0x36571c[_0x52c2('0x12')][_0x52c2('0x14')]);return _0x2e215d(_0x36571c[_0x52c2('0x12')][_0x52c2('0x14')]);}else{logger[_0x52c2('0xd')](_0x52c2('0xe'),_0x27babb,_0x52c2('0xf'));_0x2e215d(_0x36571c[_0x52c2('0x15')][_0x52c2('0x14')]);}})[_0x52c2('0x16')](function(_0x3207e2){logger['error']('Cdr,\x20%s,\x20%s',_0x27babb,_0x3207e2);_0xf20420(_0x3207e2);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 92db720..cf28181 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 _0x4b01=['put','/:id','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cdr.controller','isAuthenticated','index','get','describe','show','post'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4b01,0x95));var _0x14b0=function(_0x14d03f,_0x1e26ee){_0x14d03f=_0x14d03f-0x0;var _0x2db785=_0x4b01[_0x14d03f];return _0x2db785;};'use strict';var multer=require('multer');var util=require(_0x14b0('0x0'));var path=require('path');var timeout=require(_0x14b0('0x1'));var express=require(_0x14b0('0x2'));var router=express[_0x14b0('0x3')]();var auth=require(_0x14b0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x14b0('0x5'));var controller=require(_0x14b0('0x6'));router['get']('/',auth[_0x14b0('0x7')](),controller[_0x14b0('0x8')]);router[_0x14b0('0x9')]('/describe',auth[_0x14b0('0x7')](),controller[_0x14b0('0xa')]);router[_0x14b0('0x9')]('/:id',auth[_0x14b0('0x7')](),controller[_0x14b0('0xb')]);router[_0x14b0('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x14b0('0xd')](_0x14b0('0xe'),auth[_0x14b0('0x7')](),controller['update']);router[_0x14b0('0xf')](_0x14b0('0xe'),auth['isAuthenticated'](),controller[_0x14b0('0x10')]);module[_0x14b0('0x11')]=router; \ No newline at end of file +var _0x428e=['post','create','/:id','update','destroy','exports','multer','express','Router','./cdr.controller','get','isAuthenticated','index','/describe'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0x428e,0x156));var _0xe428=function(_0x225f50,_0x48a77d){_0x225f50=_0x225f50-0x0;var _0x19d003=_0x428e[_0x225f50];return _0x19d003;};'use strict';var multer=require(_0xe428('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe428('0x1'));var router=express[_0xe428('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe428('0x3'));router[_0xe428('0x4')]('/',auth[_0xe428('0x5')](),controller[_0xe428('0x6')]);router[_0xe428('0x4')](_0xe428('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0xe428('0x4')]('/:id',auth[_0xe428('0x5')](),controller['show']);router[_0xe428('0x8')]('/',auth[_0xe428('0x5')](),controller[_0xe428('0x9')]);router['put'](_0xe428('0xa'),auth['isAuthenticated'](),controller[_0xe428('0xb')]);router['delete']('/:id',auth[_0xe428('0x5')](),controller[_0xe428('0xc')]);module[_0xe428('0xd')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index d8dfcdc..a039787 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 _0xcfb7=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xcfb7,0x81));var _0x7cfb=function(_0x35b18a,_0x6b2fbe){_0x35b18a=_0x35b18a-0x0;var _0x4db1bd=_0xcfb7[_0x35b18a];return _0x4db1bd;};'use strict';var Sequelize=require(_0x7cfb('0x0'));module[_0x7cfb('0x1')]={'priority':{'type':Sequelize[_0x7cfb('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7cfb('0x3')],'allowNull':![],'defaultValue':_0x7cfb('0x4')},'appdata':{'type':Sequelize[_0x7cfb('0x5')]()},'description':{'type':Sequelize[_0x7cfb('0x3')]},'interval':{'type':Sequelize[_0x7cfb('0x3')],'defaultValue':_0x7cfb('0x6')}}; \ No newline at end of file +var _0x438c=['sequelize','exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x438c,0xc0));var _0xc438=function(_0x424d45,_0x1412db){_0x424d45=_0x424d45-0x0;var _0x25a22d=_0x438c[_0x424d45];return _0x25a22d;};'use strict';var Sequelize=require(_0xc438('0x0'));module[_0xc438('0x1')]={'priority':{'type':Sequelize[_0xc438('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc438('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xc438('0x4')]()},'description':{'type':Sequelize[_0xc438('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xc438('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 7d63d48..60a1efe 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 _0xb6ba=['attributes','length','includeAll','merge','options','find','body','params','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','update','then','destroy','error','stack','name','send','model','keys','ChatApplication','rawAttributes','query','filters','intersection','fields'];(function(_0x1fee5e,_0x1e6070){var _0x239173=function(_0x2b4608){while(--_0x2b4608){_0x1fee5e['push'](_0x1fee5e['shift']());}};_0x239173(++_0x1e6070);}(_0xb6ba,0xb4));var _0xab6b=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0xb6ba[_0x43776a];return _0x18eb8f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xab6b('0x0'));var rimraf=require(_0xab6b('0x1'));var zipdir=require(_0xab6b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab6b('0x3'));var moment=require(_0xab6b('0x4'));var BPromise=require(_0xab6b('0x5'));var Mustache=require(_0xab6b('0x6'));var util=require(_0xab6b('0x7'));var path=require(_0xab6b('0x8'));var sox=require('sox');var csv=require(_0xab6b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xab6b('0xa'));var crypto=require(_0xab6b('0xb'));var jsforce=require(_0xab6b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xab6b('0x9'));var querystring=require(_0xab6b('0xd'));var Papa=require(_0xab6b('0xe'));var Redis=require(_0xab6b('0xf'));var authService=require(_0xab6b('0x10'));var qs=require(_0xab6b('0x11'));var as=require(_0xab6b('0x12'));var hardwareService=require(_0xab6b('0x13'));var logger=require(_0xab6b('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xab6b('0x15'));var db=require(_0xab6b('0x16'))['db'];function respondWithStatusCode(_0x150385,_0x308a6c){_0x308a6c=_0x308a6c||0xcc;return function(_0x575f82){if(_0x575f82){return _0x150385[_0xab6b('0x17')](_0x308a6c);}return _0x150385[_0xab6b('0x18')](_0x308a6c)[_0xab6b('0x19')]();};}function respondWithResult(_0x384770,_0xabee70){_0xabee70=_0xabee70||0xc8;return function(_0x1ef918){if(_0x1ef918){return _0x384770['status'](_0xabee70)['json'](_0x1ef918);}};}function respondWithFilteredResult(_0x1f14bf,_0x124771){return function(_0xdbe6d){if(_0xdbe6d){var _0xa441f0=_0xdbe6d[_0xab6b('0x1a')],_0x1c2fe3=_0x124771['offset'],_0x5ee110=_0x124771[_0xab6b('0x1b')]+_0x124771[_0xab6b('0x1c')],_0x230b79;if(_0x5ee110>=_0xa441f0){_0x5ee110=_0xa441f0;_0x230b79=0xc8;}else{_0x230b79=0xce;}_0x1f14bf[_0xab6b('0x18')](_0x230b79);return _0x1f14bf[_0xab6b('0x1d')](_0xab6b('0x1e'),_0x1c2fe3+'-'+_0x5ee110+'/'+_0xa441f0)[_0xab6b('0x1f')](_0xdbe6d);}return null;};}function patchUpdates(_0x10d1a1){return function(_0x3518aa){try{jsonpatch[_0xab6b('0x20')](_0x3518aa,_0x10d1a1,!![]);}catch(_0x37c417){return BPromise['reject'](_0x37c417);}return _0x3518aa['save']();};}function saveUpdates(_0x11220f,_0x54cd29){return function(_0x2a376c){if(_0x2a376c){return _0x2a376c[_0xab6b('0x21')](_0x11220f)[_0xab6b('0x22')](function(_0x440094){return _0x440094;});}return null;};}function removeEntity(_0x4d2bc7,_0x292456){return function(_0x5b9f27){if(_0x5b9f27){return _0x5b9f27[_0xab6b('0x23')]()[_0xab6b('0x22')](function(){_0x4d2bc7['status'](0xcc)[_0xab6b('0x19')]();});}};}function handleEntityNotFound(_0x162268,_0x80d7f4){return function(_0x5746ee){if(!_0x5746ee){_0x162268[_0xab6b('0x17')](0x194);}return _0x5746ee;};}function handleError(_0x3eefbb,_0x4521ba){_0x4521ba=_0x4521ba||0x1f4;return function(_0x541d37){logger[_0xab6b('0x24')](_0x541d37[_0xab6b('0x25')]);if(_0x541d37['name']){delete _0x541d37[_0xab6b('0x26')];}_0x3eefbb[_0xab6b('0x18')](_0x4521ba)[_0xab6b('0x27')](_0x541d37);};}exports['show']=function(_0x1d03c2,_0x210c08){var _0x5daad4={'raw':!![],'where':{'id':_0x1d03c2['params']['id']}},_0x4b269a={};_0x4b269a[_0xab6b('0x28')]=_[_0xab6b('0x29')](db[_0xab6b('0x2a')][_0xab6b('0x2b')]);_0x4b269a['query']=_[_0xab6b('0x29')](_0x1d03c2[_0xab6b('0x2c')]);_0x4b269a[_0xab6b('0x2d')]=_['intersection'](_0x4b269a['model'],_0x4b269a[_0xab6b('0x2c')]);_0x5daad4['attributes']=_[_0xab6b('0x2e')](_0x4b269a[_0xab6b('0x28')],qs[_0xab6b('0x2f')](_0x1d03c2['query'][_0xab6b('0x2f')]));_0x5daad4[_0xab6b('0x30')]=_0x5daad4[_0xab6b('0x30')][_0xab6b('0x31')]?_0x5daad4[_0xab6b('0x30')]:_0x4b269a[_0xab6b('0x28')];if(_0x1d03c2['query'][_0xab6b('0x32')]){_0x5daad4['include']=[{'all':!![]}];}_0x5daad4=_[_0xab6b('0x33')]({},_0x5daad4,_0x1d03c2[_0xab6b('0x34')]);return db[_0xab6b('0x2a')][_0xab6b('0x35')](_0x5daad4)[_0xab6b('0x22')](handleEntityNotFound(_0x210c08,null))[_0xab6b('0x22')](respondWithResult(_0x210c08,null))['catch'](handleError(_0x210c08,null));};exports[_0xab6b('0x21')]=function(_0x50bf34,_0x3a7a25){if(_0x50bf34[_0xab6b('0x36')]['id']){delete _0x50bf34[_0xab6b('0x36')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x50bf34[_0xab6b('0x37')]['id']}})['then'](handleEntityNotFound(_0x3a7a25,null))['then'](saveUpdates(_0x50bf34[_0xab6b('0x36')],null))[_0xab6b('0x22')](respondWithResult(_0x3a7a25,null))[_0xab6b('0x38')](handleError(_0x3a7a25,null));};exports[_0xab6b('0x23')]=function(_0x37ce98,_0x2a1617){return db[_0xab6b('0x2a')]['find']({'where':{'id':_0x37ce98['params']['id']}})['then'](handleEntityNotFound(_0x2a1617,null))['then'](removeEntity(_0x2a1617,null))[_0xab6b('0x38')](handleError(_0x2a1617,null));}; \ No newline at end of file +var _0x512c=['bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','find','catch','body','params','html-pdf','rimraf','zip-dir','request-promise','moment'];(function(_0x45bdcf,_0x46fb13){var _0x4debed=function(_0x4f9103){while(--_0x4f9103){_0x45bdcf['push'](_0x45bdcf['shift']());}};_0x4debed(++_0x46fb13);}(_0x512c,0xa3));var _0xc512=function(_0x519ce9,_0x20073d){_0x519ce9=_0x519ce9-0x0;var _0x486fc2=_0x512c[_0x519ce9];return _0x486fc2;};'use strict';var pdf=require(_0xc512('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc512('0x1'));var zipdir=require(_0xc512('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc512('0x3'));var moment=require(_0xc512('0x4'));var BPromise=require(_0xc512('0x5'));var Mustache=require(_0xc512('0x6'));var util=require(_0xc512('0x7'));var path=require(_0xc512('0x8'));var sox=require(_0xc512('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc512('0xa'));var crypto=require(_0xc512('0xb'));var jsforce=require(_0xc512('0xc'));var deskjs=require(_0xc512('0xd'));var toCsv=require(_0xc512('0xe'));var querystring=require('querystring');var Papa=require(_0xc512('0xf'));var Redis=require(_0xc512('0x10'));var authService=require(_0xc512('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc512('0x12'));var hardwareService=require(_0xc512('0x13'));var logger=require('../../config/logger')(_0xc512('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xc512('0x15'))['db'];function respondWithStatusCode(_0x311318,_0x53c449){_0x53c449=_0x53c449||0xcc;return function(_0x32c93c){if(_0x32c93c){return _0x311318[_0xc512('0x16')](_0x53c449);}return _0x311318[_0xc512('0x17')](_0x53c449)[_0xc512('0x18')]();};}function respondWithResult(_0x36ae25,_0x25eb1b){_0x25eb1b=_0x25eb1b||0xc8;return function(_0x55c0b3){if(_0x55c0b3){return _0x36ae25[_0xc512('0x17')](_0x25eb1b)[_0xc512('0x19')](_0x55c0b3);}};}function respondWithFilteredResult(_0x4bfb35,_0x1a039e){return function(_0x4e35d5){if(_0x4e35d5){var _0x47c787=_0x4e35d5[_0xc512('0x1a')],_0x1df8ec=_0x1a039e[_0xc512('0x1b')],_0x22c0d9=_0x1a039e['offset']+_0x1a039e[_0xc512('0x1c')],_0x25fdd4;if(_0x22c0d9>=_0x47c787){_0x22c0d9=_0x47c787;_0x25fdd4=0xc8;}else{_0x25fdd4=0xce;}_0x4bfb35['status'](_0x25fdd4);return _0x4bfb35['set'](_0xc512('0x1d'),_0x1df8ec+'-'+_0x22c0d9+'/'+_0x47c787)[_0xc512('0x19')](_0x4e35d5);}return null;};}function patchUpdates(_0x381d99){return function(_0x5b496a){try{jsonpatch[_0xc512('0x1e')](_0x5b496a,_0x381d99,!![]);}catch(_0x5ba563){return BPromise[_0xc512('0x1f')](_0x5ba563);}return _0x5b496a[_0xc512('0x20')]();};}function saveUpdates(_0x348c01,_0x475618){return function(_0x23d267){if(_0x23d267){return _0x23d267[_0xc512('0x21')](_0x348c01)[_0xc512('0x22')](function(_0x14460a){return _0x14460a;});}return null;};}function removeEntity(_0xa90224,_0xf61120){return function(_0x3ad98a){if(_0x3ad98a){return _0x3ad98a[_0xc512('0x23')]()['then'](function(){_0xa90224['status'](0xcc)[_0xc512('0x18')]();});}};}function handleEntityNotFound(_0x2a6274,_0x1e1a69){return function(_0xf74dba){if(!_0xf74dba){_0x2a6274['sendStatus'](0x194);}return _0xf74dba;};}function handleError(_0x190175,_0x12cbf3){_0x12cbf3=_0x12cbf3||0x1f4;return function(_0x4175b1){logger[_0xc512('0x24')](_0x4175b1[_0xc512('0x25')]);if(_0x4175b1[_0xc512('0x26')]){delete _0x4175b1['name'];}_0x190175[_0xc512('0x17')](_0x12cbf3)[_0xc512('0x27')](_0x4175b1);};}exports['show']=function(_0x4d1df5,_0x21e7db){var _0x95eec2={'raw':!![],'where':{'id':_0x4d1df5['params']['id']}},_0x311544={};_0x311544[_0xc512('0x28')]=_[_0xc512('0x29')](db[_0xc512('0x2a')][_0xc512('0x2b')]);_0x311544['query']=_[_0xc512('0x29')](_0x4d1df5[_0xc512('0x2c')]);_0x311544[_0xc512('0x2d')]=_[_0xc512('0x2e')](_0x311544[_0xc512('0x28')],_0x311544[_0xc512('0x2c')]);_0x95eec2[_0xc512('0x2f')]=_[_0xc512('0x2e')](_0x311544[_0xc512('0x28')],qs['fields'](_0x4d1df5[_0xc512('0x2c')][_0xc512('0x30')]));_0x95eec2[_0xc512('0x2f')]=_0x95eec2['attributes'][_0xc512('0x31')]?_0x95eec2[_0xc512('0x2f')]:_0x311544[_0xc512('0x28')];if(_0x4d1df5[_0xc512('0x2c')][_0xc512('0x32')]){_0x95eec2[_0xc512('0x33')]=[{'all':!![]}];}_0x95eec2=_['merge']({},_0x95eec2,_0x4d1df5['options']);return db[_0xc512('0x2a')][_0xc512('0x34')](_0x95eec2)[_0xc512('0x22')](handleEntityNotFound(_0x21e7db,null))[_0xc512('0x22')](respondWithResult(_0x21e7db,null))[_0xc512('0x35')](handleError(_0x21e7db,null));};exports['update']=function(_0x2a6e3b,_0x1f3091){if(_0x2a6e3b[_0xc512('0x36')]['id']){delete _0x2a6e3b['body']['id'];}return db[_0xc512('0x2a')]['find']({'where':{'id':_0x2a6e3b[_0xc512('0x37')]['id']}})['then'](handleEntityNotFound(_0x1f3091,null))[_0xc512('0x22')](saveUpdates(_0x2a6e3b['body'],null))['then'](respondWithResult(_0x1f3091,null))['catch'](handleError(_0x1f3091,null));};exports[_0xc512('0x23')]=function(_0x1e1789,_0x259220){return db[_0xc512('0x2a')][_0xc512('0x34')]({'where':{'id':_0x1e1789[_0xc512('0x37')]['id']}})[_0xc512('0x22')](handleEntityNotFound(_0x259220,null))['then'](removeEntity(_0x259220,null))['catch'](handleError(_0x259220,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 4149efa..2315b33 100644 --- a/server/api/chatApplication/chatApplication.model.js +++ b/server/api/chatApplication/chatApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_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 logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 1b0cc4f..9e22c97 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 _0xe5c2=['debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','ChatApplication,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','request\x20sent'];(function(_0x577bb5,_0x408572){var _0x20c386=function(_0x55311f){while(--_0x55311f){_0x577bb5['push'](_0x577bb5['shift']());}};_0x20c386(++_0x408572);}(_0xe5c2,0x104));var _0x2e5c=function(_0x1d7a96,_0xe6f09c){_0x1d7a96=_0x1d7a96-0x0;var _0x414986=_0xe5c2[_0x1d7a96];return _0x414986;};'use strict';var _=require('lodash');var util=require(_0x2e5c('0x0'));var moment=require(_0x2e5c('0x1'));var BPromise=require(_0x2e5c('0x2'));var rs=require(_0x2e5c('0x3'));var fs=require('fs');var Redis=require(_0x2e5c('0x4'));var db=require(_0x2e5c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e5c('0x6'))('rpc');var config=require(_0x2e5c('0x7'));var jayson=require(_0x2e5c('0x8'));var client=jayson['client'][_0x2e5c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20e531,_0x189699,_0x4d9212){return new BPromise(function(_0x4d73f1,_0x216508){return client['request'](_0x20e531,_0x4d9212)[_0x2e5c('0xa')](function(_0x8fa4a0){logger[_0x2e5c('0xb')]('ChatApplication,\x20%s,\x20%s',_0x189699,_0x2e5c('0xc'));logger[_0x2e5c('0xd')](_0x2e5c('0xe'),_0x189699,_0x2e5c('0xc'),JSON[_0x2e5c('0xf')](_0x8fa4a0));if(_0x8fa4a0[_0x2e5c('0x10')]){if(_0x8fa4a0[_0x2e5c('0x10')]['code']===0x1f4){logger[_0x2e5c('0x10')](_0x2e5c('0x11'),_0x189699,_0x8fa4a0[_0x2e5c('0x10')]['message']);return _0x216508(_0x8fa4a0['error'][_0x2e5c('0x12')]);}logger['error'](_0x2e5c('0x11'),_0x189699,_0x8fa4a0[_0x2e5c('0x10')][_0x2e5c('0x12')]);return _0x4d73f1(_0x8fa4a0['error']['message']);}else{logger[_0x2e5c('0xb')](_0x2e5c('0x11'),_0x189699,'request\x20sent');_0x4d73f1(_0x8fa4a0[_0x2e5c('0x13')][_0x2e5c('0x12')]);}})[_0x2e5c('0x14')](function(_0x1daedf){logger[_0x2e5c('0x10')](_0x2e5c('0x11'),_0x189699,_0x1daedf);_0x216508(_0x1daedf);});});} \ No newline at end of file +var _0xaa06=['catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','info','request\x20sent','stringify','error','message','ChatApplication,\x20%s,\x20%s','result'];(function(_0x4dfa20,_0x35afb5){var _0x146afc=function(_0x5a4344){while(--_0x5a4344){_0x4dfa20['push'](_0x4dfa20['shift']());}};_0x146afc(++_0x35afb5);}(_0xaa06,0x78));var _0x6aa0=function(_0x9f1bf5,_0x3cff60){_0x9f1bf5=_0x9f1bf5-0x0;var _0x295b5f=_0xaa06[_0x9f1bf5];return _0x295b5f;};'use strict';var _=require('lodash');var util=require(_0x6aa0('0x0'));var moment=require(_0x6aa0('0x1'));var BPromise=require('bluebird');var rs=require(_0x6aa0('0x2'));var fs=require('fs');var Redis=require(_0x6aa0('0x3'));var db=require(_0x6aa0('0x4'))['db'];var utils=require(_0x6aa0('0x5'));var logger=require('../../config/logger')(_0x6aa0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6aa0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x49fca9,_0x20b12c,_0x2df97a){return new BPromise(function(_0x361e01,_0xc37fd7){return client[_0x6aa0('0x8')](_0x49fca9,_0x2df97a)['then'](function(_0x291280){logger[_0x6aa0('0x9')]('ChatApplication,\x20%s,\x20%s',_0x20b12c,_0x6aa0('0xa'));logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x20b12c,_0x6aa0('0xa'),JSON[_0x6aa0('0xb')](_0x291280));if(_0x291280['error']){if(_0x291280[_0x6aa0('0xc')]['code']===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x20b12c,_0x291280[_0x6aa0('0xc')][_0x6aa0('0xd')]);return _0xc37fd7(_0x291280[_0x6aa0('0xc')][_0x6aa0('0xd')]);}logger[_0x6aa0('0xc')]('ChatApplication,\x20%s,\x20%s',_0x20b12c,_0x291280[_0x6aa0('0xc')]['message']);return _0x361e01(_0x291280['error'][_0x6aa0('0xd')]);}else{logger[_0x6aa0('0x9')](_0x6aa0('0xe'),_0x20b12c,_0x6aa0('0xa'));_0x361e01(_0x291280[_0x6aa0('0xf')][_0x6aa0('0xd')]);}})[_0x6aa0('0x10')](function(_0x4a0874){logger[_0x6aa0('0xc')](_0x6aa0('0xe'),_0x20b12c,_0x4a0874);_0xc37fd7(_0x4a0874);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 800fbf1..4d1a232 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 _0x02c6=['util','express','Router','../../components/auth/service','../../components/interaction/service','/:id','isAuthenticated','show','update','delete','destroy','multer'];(function(_0x1a8577,_0x4d5461){var _0x45f5cd=function(_0x4008f3){while(--_0x4008f3){_0x1a8577['push'](_0x1a8577['shift']());}};_0x45f5cd(++_0x4d5461);}(_0x02c6,0xbf));var _0x602c=function(_0x35f5a5,_0x3f8a65){_0x35f5a5=_0x35f5a5-0x0;var _0x143dce=_0x02c6[_0x35f5a5];return _0x143dce;};'use strict';var multer=require(_0x602c('0x0'));var util=require(_0x602c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x602c('0x2'));var router=express[_0x602c('0x3')]();var auth=require(_0x602c('0x4'));var interaction=require(_0x602c('0x5'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router['get'](_0x602c('0x6'),auth[_0x602c('0x7')](),controller[_0x602c('0x8')]);router['put'](_0x602c('0x6'),auth['isAuthenticated'](),controller[_0x602c('0x9')]);router[_0x602c('0xa')](_0x602c('0x6'),auth[_0x602c('0x7')](),controller[_0x602c('0xb')]);module['exports']=router; \ No newline at end of file +var _0x71aa=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','put','update'];(function(_0x280c30,_0x4e9b6c){var _0x1acafb=function(_0x43b502){while(--_0x43b502){_0x280c30['push'](_0x280c30['shift']());}};_0x1acafb(++_0x4e9b6c);}(_0x71aa,0xe0));var _0xa71a=function(_0x4d6e55,_0x59afcc){_0x4d6e55=_0x4d6e55-0x0;var _0x2184c6=_0x71aa[_0x4d6e55];return _0x2184c6;};'use strict';var multer=require(_0xa71a('0x0'));var util=require(_0xa71a('0x1'));var path=require(_0xa71a('0x2'));var timeout=require(_0xa71a('0x3'));var express=require('express');var router=express[_0xa71a('0x4')]();var auth=require(_0xa71a('0x5'));var interaction=require(_0xa71a('0x6'));var config=require(_0xa71a('0x7'));var controller=require('./chatApplication.controller');router[_0xa71a('0x8')](_0xa71a('0x9'),auth[_0xa71a('0xa')](),controller[_0xa71a('0xb')]);router[_0xa71a('0xc')](_0xa71a('0x9'),auth[_0xa71a('0xa')](),controller[_0xa71a('0xd')]);router[_0xa71a('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xa71a('0xf')]);module[_0xa71a('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 365e88d..add9be1 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 _0x8fe3=['exports','STRING','BOOLEAN','sequelize'];(function(_0x1b7ee3,_0x42ef36){var _0x2ebf29=function(_0x1e8ed6){while(--_0x1e8ed6){_0x1b7ee3['push'](_0x1b7ee3['shift']());}};_0x2ebf29(++_0x42ef36);}(_0x8fe3,0x14f));var _0x38fe=function(_0x2638f8,_0x30e0c2){_0x2638f8=_0x2638f8-0x0;var _0x160878=_0x8fe3[_0x2638f8];return _0x160878;};'use strict';var Sequelize=require(_0x38fe('0x0'));module[_0x38fe('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x38fe('0x2')]},'write':{'type':Sequelize[_0x38fe('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x94a0=['exports','STRING'];(function(_0xee405c,_0x135503){var _0x12a589=function(_0x48bffa){while(--_0x48bffa){_0xee405c['push'](_0xee405c['shift']());}};_0x12a589(++_0x135503);}(_0x94a0,0x128));var _0x094a=function(_0xe9fdc4,_0x1cc454){_0xe9fdc4=_0xe9fdc4-0x0;var _0x529cdd=_0x94a0[_0xe9fdc4];return _0x529cdd;};'use strict';var Sequelize=require('sequelize');module[_0x094a('0x0')]={'name':{'type':Sequelize[_0x094a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x094a('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 40a4a15..4519e54 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 _0xf82f=['key','model','query','keys','filters','attributes','intersection','order','sort','where','pick','filter','merge','VIRTUAL','ChatGroup','count','includeAll','include','findAll','params','rawAttributes','fields','length','find','create','body','getUnread','toInteger','addMembers','ids','getMembers','User','options','hasOwnProperty','nolimit','removeMembers','addMessage','ChatInternalMessage','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','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','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','jayson/promise','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','request\x20sent','debug','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','index','map','fieldName','type'];(function(_0x1b25c1,_0x2c6ce6){var _0x1e4447=function(_0xaaafca){while(--_0xaaafca){_0x1b25c1['push'](_0x1b25c1['shift']());}};_0x1e4447(++_0x2c6ce6);}(_0xf82f,0x108));var _0xff82=function(_0x430389,_0xea880a){_0x430389=_0x430389-0x0;var _0x4b92ef=_0xf82f[_0x430389];return _0x4b92ef;};'use strict';var pdf=require(_0xff82('0x0'));var emlformat=require(_0xff82('0x1'));var rimraf=require(_0xff82('0x2'));var zipdir=require(_0xff82('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xff82('0x4'));var moment=require(_0xff82('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xff82('0x6'));var util=require(_0xff82('0x7'));var path=require(_0xff82('0x8'));var sox=require('sox');var csv=require(_0xff82('0x9'));var ejs=require(_0xff82('0xa'));var fs=require('fs');var _=require(_0xff82('0xb'));var squel=require('squel');var crypto=require(_0xff82('0xc'));var jsforce=require(_0xff82('0xd'));var deskjs=require(_0xff82('0xe'));var toCsv=require(_0xff82('0x9'));var querystring=require(_0xff82('0xf'));var Papa=require(_0xff82('0x10'));var Redis=require(_0xff82('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xff82('0x12'));var as=require(_0xff82('0x13'));var hardwareService=require(_0xff82('0x14'));var logger=require(_0xff82('0x15'))(_0xff82('0x16'));var utils=require(_0xff82('0x17'));var config=require(_0xff82('0x18'));var db=require(_0xff82('0x19'))['db'];config[_0xff82('0x1a')]=_[_0xff82('0x1b')](config[_0xff82('0x1a')],{'host':_0xff82('0x1c'),'port':0x18eb});var socket=require(_0xff82('0x1d'))(new Redis(config['redis']));require(_0xff82('0x1e'))['register'](socket);var jayson=require(_0xff82('0x1f'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x4083e7,_0x56a982,_0x26567c){if(_0x26567c){var _0x569002=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x569002[_0xff82('0x20')](_0x56a982)){return _0x4083e7;}else{throw new db[(_0xff82('0x21'))]['ValidationError'](_0xff82('0x22'));}}else{return _0x4083e7;}}function respondWithRpcPromise(_0xec57a5,_0x5bd23c,_0x51623b,_0x4ebff6){return new BPromise(function(_0x2ebb40,_0x5643a3){var _0x756be9=_0x4ebff6||client;return _0x756be9[_0xff82('0x23')](_0xec57a5,_0x51623b)[_0xff82('0x24')](function(_0x4cfb28){logger[_0xff82('0x25')]('ChatGroup,\x20%s,\x20%s',_0x5bd23c,_0xff82('0x26'));logger[_0xff82('0x27')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x5bd23c,_0xff82('0x26'),JSON[_0xff82('0x28')](_0x4cfb28));if(_0x4cfb28[_0xff82('0x29')]){if(_0x4cfb28[_0xff82('0x29')][_0xff82('0x2a')]===0x1f4){logger[_0xff82('0x29')](_0xff82('0x2b'),_0x5bd23c,_0x4cfb28[_0xff82('0x29')][_0xff82('0x2c')]);return _0x5643a3(_0x4cfb28[_0xff82('0x29')][_0xff82('0x2c')]);}logger['error'](_0xff82('0x2b'),_0x5bd23c,_0x4cfb28[_0xff82('0x29')]['message']);return _0x2ebb40(_0x4cfb28['error'][_0xff82('0x2c')]);}else{logger[_0xff82('0x25')](_0xff82('0x2b'),_0x5bd23c,_0xff82('0x26'));_0x2ebb40(_0x4cfb28[_0xff82('0x2d')][_0xff82('0x2c')]);}})[_0xff82('0x2e')](function(_0xb1180a){logger[_0xff82('0x29')](_0xff82('0x2b'),_0x5bd23c,_0xb1180a);_0x5643a3(_0xb1180a);});});}function respondWithStatusCode(_0x237a85,_0x152fe9){_0x152fe9=_0x152fe9||0xcc;return function(_0x21a9ae){if(_0x21a9ae){return _0x237a85[_0xff82('0x2f')](_0x152fe9);}return _0x237a85[_0xff82('0x30')](_0x152fe9)[_0xff82('0x31')]();};}function respondWithResult(_0xb6fbff,_0xa4c2d9){_0xa4c2d9=_0xa4c2d9||0xc8;return function(_0x369e42){if(_0x369e42){return _0xb6fbff['status'](_0xa4c2d9)['json'](_0x369e42);}};}function respondWithFilteredResult(_0x238737,_0x129914){return function(_0xb4af8e){if(_0xb4af8e){var _0x1cdcb7=_0xb4af8e['count'],_0x50ab33=_0x129914[_0xff82('0x32')],_0x4f401d=_0x129914[_0xff82('0x32')]+_0x129914[_0xff82('0x33')],_0xccbe00;if(_0x4f401d>=_0x1cdcb7){_0x4f401d=_0x1cdcb7;_0xccbe00=0xc8;}else{_0xccbe00=0xce;}_0x238737[_0xff82('0x30')](_0xccbe00);return _0x238737[_0xff82('0x34')](_0xff82('0x35'),_0x50ab33+'-'+_0x4f401d+'/'+_0x1cdcb7)[_0xff82('0x36')](_0xb4af8e);}return null;};}function patchUpdates(_0x5a0614){return function(_0x3bc743){try{jsonpatch[_0xff82('0x37')](_0x3bc743,_0x5a0614,!![]);}catch(_0xc6ea90){return BPromise[_0xff82('0x38')](_0xc6ea90);}return _0x3bc743[_0xff82('0x39')]();};}function saveUpdates(_0x53689d,_0x4b8b88){return function(_0x1f5fa6){if(_0x1f5fa6){return _0x1f5fa6[_0xff82('0x3a')](_0x53689d)[_0xff82('0x24')](function(_0x15a0d7){return _0x15a0d7;});}return null;};}function removeEntity(_0x56abe5,_0x74996b){return function(_0x39f82b){if(_0x39f82b){return _0x39f82b[_0xff82('0x3b')]()['then'](function(){_0x56abe5[_0xff82('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1885fb,_0x139ead){return function(_0x19ccae){if(!_0x19ccae){_0x1885fb[_0xff82('0x2f')](0x194);}return _0x19ccae;};}function handleError(_0x454c7a,_0x546c25){_0x546c25=_0x546c25||0x1f4;return function(_0x4b106b){logger[_0xff82('0x29')](_0x4b106b[_0xff82('0x3c')]);if(_0x4b106b[_0xff82('0x3d')]){delete _0x4b106b[_0xff82('0x3d')];}_0x454c7a[_0xff82('0x30')](_0x546c25)['send'](_0x4b106b);};}exports[_0xff82('0x3e')]=function(_0x4cf12b,_0x232f0d){var _0xd18343={},_0x423bf4={},_0x461dd5={'count':0x0,'rows':[]};var _0x4d9b51=_[_0xff82('0x3f')](db['ChatGroup']['rawAttributes'],function(_0x2bf101){return{'name':_0x2bf101[_0xff82('0x40')],'type':_0x2bf101[_0xff82('0x41')][_0xff82('0x42')]};});_0x423bf4[_0xff82('0x43')]=_[_0xff82('0x3f')](_0x4d9b51,'name');_0x423bf4[_0xff82('0x44')]=_[_0xff82('0x45')](_0x4cf12b[_0xff82('0x44')]);_0x423bf4[_0xff82('0x46')]=_['intersection'](_0x423bf4[_0xff82('0x43')],_0x423bf4[_0xff82('0x44')]);_0xd18343[_0xff82('0x47')]=_[_0xff82('0x48')](_0x423bf4['model'],qs['fields'](_0x4cf12b[_0xff82('0x44')]['fields']));_0xd18343[_0xff82('0x47')]=_0xd18343[_0xff82('0x47')]['length']?_0xd18343[_0xff82('0x47')]:_0x423bf4[_0xff82('0x43')];if(!_0x4cf12b['query']['hasOwnProperty']('nolimit')){_0xd18343[_0xff82('0x33')]=qs[_0xff82('0x33')](_0x4cf12b[_0xff82('0x44')][_0xff82('0x33')]);_0xd18343[_0xff82('0x32')]=qs[_0xff82('0x32')](_0x4cf12b[_0xff82('0x44')][_0xff82('0x32')]);}_0xd18343[_0xff82('0x49')]=qs[_0xff82('0x4a')](_0x4cf12b[_0xff82('0x44')]['sort']);_0xd18343[_0xff82('0x4b')]=qs[_0xff82('0x46')](_[_0xff82('0x4c')](_0x4cf12b[_0xff82('0x44')],_0x423bf4[_0xff82('0x46')]));if(_0x4cf12b['query'][_0xff82('0x4d')]){_0xd18343['where']=_[_0xff82('0x4e')](_0xd18343[_0xff82('0x4b')],{'$or':_[_0xff82('0x3f')](_0x4d9b51,function(_0x56117f){if(_0x56117f[_0xff82('0x41')]!==_0xff82('0x4f')){var _0x15ab26={};_0x15ab26[_0x56117f[_0xff82('0x3d')]]={'$like':'%'+_0x4cf12b[_0xff82('0x44')][_0xff82('0x4d')]+'%'};return _0x15ab26;}})});}_0xd18343=_[_0xff82('0x4e')]({},_0xd18343,_0x4cf12b['options']);var _0xe9ad4b={'where':_0xd18343[_0xff82('0x4b')]};return db[_0xff82('0x50')][_0xff82('0x51')](_0xe9ad4b)['then'](function(_0x274e1b){_0x461dd5[_0xff82('0x51')]=_0x274e1b;if(_0x4cf12b['query'][_0xff82('0x52')]){_0xd18343[_0xff82('0x53')]=[{'all':!![]}];}return db[_0xff82('0x50')][_0xff82('0x54')](_0xd18343);})[_0xff82('0x24')](function(_0x7b0497){_0x461dd5['rows']=_0x7b0497;return _0x461dd5;})[_0xff82('0x24')](respondWithFilteredResult(_0x232f0d,_0xd18343))[_0xff82('0x2e')](handleError(_0x232f0d,null));};exports['show']=function(_0x44fff0,_0x49b7fa){var _0x1e1469={'raw':!![],'where':{'id':_0x44fff0[_0xff82('0x55')]['id']}},_0x1d0932={};_0x1d0932[_0xff82('0x43')]=_[_0xff82('0x45')](db[_0xff82('0x50')][_0xff82('0x56')]);_0x1d0932[_0xff82('0x44')]=_[_0xff82('0x45')](_0x44fff0[_0xff82('0x44')]);_0x1d0932[_0xff82('0x46')]=_[_0xff82('0x48')](_0x1d0932[_0xff82('0x43')],_0x1d0932[_0xff82('0x44')]);_0x1e1469[_0xff82('0x47')]=_['intersection'](_0x1d0932[_0xff82('0x43')],qs['fields'](_0x44fff0[_0xff82('0x44')][_0xff82('0x57')]));_0x1e1469[_0xff82('0x47')]=_0x1e1469[_0xff82('0x47')][_0xff82('0x58')]?_0x1e1469[_0xff82('0x47')]:_0x1d0932[_0xff82('0x43')];if(_0x44fff0['query'][_0xff82('0x52')]){_0x1e1469[_0xff82('0x53')]=[{'all':!![]}];}_0x1e1469=_[_0xff82('0x4e')]({},_0x1e1469,_0x44fff0['options']);return db[_0xff82('0x50')][_0xff82('0x59')](_0x1e1469)[_0xff82('0x24')](handleEntityNotFound(_0x49b7fa,null))['then'](respondWithResult(_0x49b7fa,null))[_0xff82('0x2e')](handleError(_0x49b7fa,null));};exports[_0xff82('0x5a')]=function(_0x357a23,_0x29c614){return db[_0xff82('0x50')]['create'](_0x357a23[_0xff82('0x5b')],{})['then'](respondWithResult(_0x29c614,0xc9))[_0xff82('0x2e')](handleError(_0x29c614,null));};exports[_0xff82('0x3a')]=function(_0x26c05c,_0x20270f){if(_0x26c05c[_0xff82('0x5b')]['id']){delete _0x26c05c[_0xff82('0x5b')]['id'];}return db[_0xff82('0x50')][_0xff82('0x59')]({'where':{'id':_0x26c05c[_0xff82('0x55')]['id']}})[_0xff82('0x24')](handleEntityNotFound(_0x20270f,null))[_0xff82('0x24')](saveUpdates(_0x26c05c[_0xff82('0x5b')],null))[_0xff82('0x24')](respondWithResult(_0x20270f,null))[_0xff82('0x2e')](handleError(_0x20270f,null));};exports[_0xff82('0x3b')]=function(_0x229242,_0x90e2cc){return db[_0xff82('0x50')]['find']({'where':{'id':_0x229242[_0xff82('0x55')]['id']}})[_0xff82('0x24')](handleEntityNotFound(_0x90e2cc,null))['then'](removeEntity(_0x90e2cc,null))[_0xff82('0x2e')](handleError(_0x90e2cc,null));};exports['describe']=function(_0x318857,_0x52d468){return db[_0xff82('0x50')]['describe']()[_0xff82('0x24')](respondWithResult(_0x52d468,null))['catch'](handleError(_0x52d468,null));};exports[_0xff82('0x5c')]=function(_0x2926f9,_0x268b2a,_0x39d367){return db['ChatInternalMessage'][_0xff82('0x51')]({'where':{'ChatGroupId':_0x2926f9[_0xff82('0x55')]['id'],'ToId':_0x2926f9['user']['id'],'read':![]}})[_0xff82('0x24')](function(_0x4180ce){return{'id':_[_0xff82('0x5d')](_0x2926f9[_0xff82('0x55')]['id']),'count':_0x4180ce};})[_0xff82('0x24')](respondWithResult(_0x268b2a,null))['catch'](handleError(_0x268b2a,null));};exports[_0xff82('0x5e')]=function(_0x347b09,_0x4663e3,_0xc1efa4){return db['ChatGroup']['find']({'where':{'id':_0x347b09['params']['id']}})[_0xff82('0x24')](handleEntityNotFound(_0x4663e3,null))['then'](function(_0x17a978){if(_0x17a978){return _0x17a978['addMembers'](_0x347b09[_0xff82('0x5b')][_0xff82('0x5f')],_['omit'](_0x347b09[_0xff82('0x5b')],[_0xff82('0x5f'),'id'])||{});}})[_0xff82('0x24')](respondWithResult(_0x4663e3,null))[_0xff82('0x2e')](handleError(_0x4663e3,null));};exports[_0xff82('0x60')]=function(_0x4c1ac8,_0x2ad9cc,_0x30b8e6){var _0x3b77a6={};var _0x3830af={};var _0x2324c2;var _0xf848f0;return db[_0xff82('0x50')]['findOne']({'where':{'id':_0x4c1ac8['params']['id']}})[_0xff82('0x24')](handleEntityNotFound(_0x2ad9cc,null))['then'](function(_0x126991){if(_0x126991){_0x2324c2=_0x126991;_0x3830af[_0xff82('0x43')]=_[_0xff82('0x45')](db[_0xff82('0x61')]['rawAttributes']);_0x3830af[_0xff82('0x44')]=_[_0xff82('0x45')](_0x4c1ac8[_0xff82('0x44')]);_0x3830af[_0xff82('0x46')]=_['intersection'](_0x3830af[_0xff82('0x43')],_0x3830af['query']);_0x3b77a6[_0xff82('0x47')]=_[_0xff82('0x48')](_0x3830af[_0xff82('0x43')],qs[_0xff82('0x57')](_0x4c1ac8[_0xff82('0x44')]['fields']));_0x3b77a6[_0xff82('0x47')]=_0x3b77a6[_0xff82('0x47')][_0xff82('0x58')]?_0x3b77a6[_0xff82('0x47')]:_0x3830af[_0xff82('0x43')];_0x3b77a6[_0xff82('0x49')]=qs[_0xff82('0x4a')](_0x4c1ac8[_0xff82('0x44')]['sort']);_0x3b77a6['where']=qs[_0xff82('0x46')](_['pick'](_0x4c1ac8[_0xff82('0x44')],_0x3830af[_0xff82('0x46')]));if(_0x4c1ac8[_0xff82('0x44')]['filter']){_0x3b77a6['where']=_[_0xff82('0x4e')](_0x3b77a6[_0xff82('0x4b')],{'$or':_[_0xff82('0x3f')](_0x3b77a6[_0xff82('0x47')],function(_0x5c7373){var _0x29e85a={};_0x29e85a[_0x5c7373]={'$like':'%'+_0x4c1ac8[_0xff82('0x44')][_0xff82('0x4d')]+'%'};return _0x29e85a;})});}_0x3b77a6=_['merge']({},_0x3b77a6,_0x4c1ac8[_0xff82('0x62')]);return _0x2324c2[_0xff82('0x60')](_0x3b77a6);}})['then'](function(_0xc61dd6){if(_0xc61dd6){_0xf848f0=_0xc61dd6[_0xff82('0x58')];if(!_0x4c1ac8[_0xff82('0x44')][_0xff82('0x63')](_0xff82('0x64'))){_0x3b77a6[_0xff82('0x33')]=qs[_0xff82('0x33')](_0x4c1ac8[_0xff82('0x44')]['limit']);_0x3b77a6[_0xff82('0x32')]=qs['offset'](_0x4c1ac8[_0xff82('0x44')]['offset']);}return _0x2324c2['getMembers'](_0x3b77a6);}})[_0xff82('0x24')](function(_0x5ef460){if(_0x5ef460){return _0x5ef460?{'count':_0xf848f0,'rows':_0x5ef460}:null;}})[_0xff82('0x24')](respondWithResult(_0x2ad9cc,null))['catch'](handleError(_0x2ad9cc,null));};exports[_0xff82('0x65')]=function(_0x468dce,_0x24bf22,_0x350aed){return db[_0xff82('0x50')][_0xff82('0x59')]({'where':{'id':_0x468dce['params']['id']}})[_0xff82('0x24')](handleEntityNotFound(_0x24bf22,null))['then'](function(_0x436735){if(_0x436735){return _0x436735[_0xff82('0x65')](_0x468dce[_0xff82('0x44')][_0xff82('0x5f')]);}})[_0xff82('0x24')](respondWithStatusCode(_0x24bf22,null))[_0xff82('0x2e')](handleError(_0x24bf22,null));};exports[_0xff82('0x66')]=function(_0x4d74a6,_0x23fee5,_0x4c83e4){if(_0x4d74a6[_0xff82('0x5b')]['id']){delete _0x4d74a6[_0xff82('0x5b')]['id'];}return db[_0xff82('0x50')][_0xff82('0x59')]({'where':{'id':_0x4d74a6['params']['id']}})['then'](handleEntityNotFound(_0x23fee5,null))['then'](function(_0x1cbdde){if(_0x1cbdde){_0x4d74a6['body']['ChatGroupId']=_0x1cbdde['id'];return db[_0xff82('0x67')][_0xff82('0x5a')](_0x4d74a6[_0xff82('0x5b')]);}})[_0xff82('0x24')](respondWithResult(_0x23fee5,null))['catch'](handleError(_0x23fee5,null));};exports[_0xff82('0x68')]=function(_0x4d12e1,_0x339415,_0xa786c3){var _0x46801c={};var _0x26d5ae={};var _0x2a20e8;var _0x24af04;return db['ChatGroup'][_0xff82('0x69')]({'where':{'id':_0x4d12e1[_0xff82('0x55')]['id']}})[_0xff82('0x24')](handleEntityNotFound(_0x339415,null))[_0xff82('0x24')](function(_0x55828c){if(_0x55828c){_0x2a20e8=_0x55828c;_0x26d5ae[_0xff82('0x43')]=_[_0xff82('0x45')](db[_0xff82('0x67')][_0xff82('0x56')]);_0x26d5ae[_0xff82('0x44')]=_[_0xff82('0x45')](_0x4d12e1[_0xff82('0x44')]);_0x26d5ae[_0xff82('0x46')]=_['intersection'](_0x26d5ae['model'],_0x26d5ae['query']);_0x46801c[_0xff82('0x47')]=_['intersection'](_0x26d5ae[_0xff82('0x43')],qs[_0xff82('0x57')](_0x4d12e1[_0xff82('0x44')][_0xff82('0x57')]));_0x46801c[_0xff82('0x47')]=_0x46801c[_0xff82('0x47')][_0xff82('0x58')]?_0x46801c[_0xff82('0x47')]:_0x26d5ae[_0xff82('0x43')];_0x46801c[_0xff82('0x49')]=qs[_0xff82('0x4a')](_0x4d12e1[_0xff82('0x44')][_0xff82('0x4a')]);_0x46801c[_0xff82('0x4b')]=qs['filters'](_['pick'](_0x4d12e1[_0xff82('0x44')],_0x26d5ae[_0xff82('0x46')]));if(_0x4d12e1[_0xff82('0x44')][_0xff82('0x4d')]){_0x46801c['where']=_[_0xff82('0x4e')](_0x46801c[_0xff82('0x4b')],{'$or':_[_0xff82('0x3f')](_0x46801c[_0xff82('0x47')],function(_0x2f3daf){var _0x529e0a={};_0x529e0a[_0x2f3daf]={'$like':'%'+_0x4d12e1[_0xff82('0x44')][_0xff82('0x4d')]+'%'};return _0x529e0a;})});}if(_0x4d12e1[_0xff82('0x44')]['$gte']){var _0x1c04c3=_0x4d12e1[_0xff82('0x44')][_0xff82('0x6a')][_0xff82('0x6b')](',');var _0x126728={};_0x126728[_0x1c04c3[0x0]]={'$gte':moment(_0x1c04c3[0x1])[_0xff82('0x6c')](_0xff82('0x6d'))};_0x46801c[_0xff82('0x4b')]=_[_0xff82('0x4e')](_0x46801c['where'],_0x126728);}_0x46801c=_[_0xff82('0x4e')]({},_0x46801c,_0x4d12e1[_0xff82('0x62')]);return _0x2a20e8[_0xff82('0x68')](_0x46801c);}})['then'](function(_0x4eff14){if(_0x4eff14){_0x24af04=_0x4eff14[_0xff82('0x58')];if(!_0x4d12e1[_0xff82('0x44')]['hasOwnProperty'](_0xff82('0x64'))){_0x46801c['limit']=qs['limit'](_0x4d12e1[_0xff82('0x44')][_0xff82('0x33')]);_0x46801c[_0xff82('0x32')]=qs[_0xff82('0x32')](_0x4d12e1[_0xff82('0x44')][_0xff82('0x32')]);}return _0x2a20e8[_0xff82('0x68')](_0x46801c);}})[_0xff82('0x24')](function(_0x524e50){if(_0x524e50){return _0x524e50?{'count':_0x24af04,'rows':_0x524e50}:null;}})[_0xff82('0x24')](respondWithResult(_0x339415,null))[_0xff82('0x2e')](handleError(_0x339415,null));}; \ No newline at end of file +var _0x1dd6=['reject','save','update','then','destroy','end','stack','name','send','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','filters','pick','filter','where','VIRTUAL','merge','options','count','include','rows','show','params','includeAll','create','body','find','describe','getUnread','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','order','removeMembers','ChatGroupId','ChatInternalMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','nolimit','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ChatGroup,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','offset','limit','set','Content-Range','json','apply'];(function(_0x2435b0,_0x5d0196){var _0x4090c9=function(_0x2952a8){while(--_0x2952a8){_0x2435b0['push'](_0x2435b0['shift']());}};_0x4090c9(++_0x5d0196);}(_0x1dd6,0x116));var _0x61dd=function(_0x1dce4a,_0x45dc6d){_0x1dce4a=_0x1dce4a-0x0;var _0x1231eb=_0x1dd6[_0x1dce4a];return _0x1231eb;};'use strict';var pdf=require(_0x61dd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x61dd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x61dd('0x2'));var rp=require(_0x61dd('0x3'));var moment=require(_0x61dd('0x4'));var BPromise=require(_0x61dd('0x5'));var Mustache=require('mustache');var util=require(_0x61dd('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x61dd('0x7'));var ejs=require(_0x61dd('0x8'));var fs=require('fs');var _=require(_0x61dd('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x61dd('0xa'));var deskjs=require(_0x61dd('0xb'));var toCsv=require(_0x61dd('0x7'));var querystring=require('querystring');var Papa=require(_0x61dd('0xc'));var Redis=require(_0x61dd('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x61dd('0xe'));var as=require(_0x61dd('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x61dd('0x10'))('api');var utils=require(_0x61dd('0x11'));var config=require('../../config/environment');var db=require(_0x61dd('0x12'))['db'];config[_0x61dd('0x13')]=_[_0x61dd('0x14')](config['redis'],{'host':_0x61dd('0x15'),'port':0x18eb});var socket=require(_0x61dd('0x16'))(new Redis(config[_0x61dd('0x13')]));require(_0x61dd('0x17'))[_0x61dd('0x18')](socket);var jayson=require(_0x61dd('0x19'));var client=jayson['client'][_0x61dd('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x90d93f,_0x31c718,_0x656347){if(_0x656347){var _0x257f88=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x257f88[_0x61dd('0x1b')](_0x31c718)){return _0x90d93f;}else{throw new db[(_0x61dd('0x1c'))][(_0x61dd('0x1d'))](_0x61dd('0x1e'));}}else{return _0x90d93f;}}function respondWithRpcPromise(_0x48c109,_0x4abd47,_0x552ca5,_0x535486){return new BPromise(function(_0x207f95,_0xeeabc6){var _0x303669=_0x535486||client;return _0x303669[_0x61dd('0x1f')](_0x48c109,_0x552ca5)['then'](function(_0x2a388d){logger[_0x61dd('0x20')](_0x61dd('0x21'),_0x4abd47,'request\x20sent');logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x4abd47,'request\x20sent',JSON[_0x61dd('0x22')](_0x2a388d));if(_0x2a388d[_0x61dd('0x23')]){if(_0x2a388d[_0x61dd('0x23')][_0x61dd('0x24')]===0x1f4){logger[_0x61dd('0x23')]('ChatGroup,\x20%s,\x20%s',_0x4abd47,_0x2a388d[_0x61dd('0x23')][_0x61dd('0x25')]);return _0xeeabc6(_0x2a388d[_0x61dd('0x23')][_0x61dd('0x25')]);}logger[_0x61dd('0x23')](_0x61dd('0x21'),_0x4abd47,_0x2a388d[_0x61dd('0x23')]['message']);return _0x207f95(_0x2a388d[_0x61dd('0x23')][_0x61dd('0x25')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x4abd47,_0x61dd('0x26'));_0x207f95(_0x2a388d[_0x61dd('0x27')][_0x61dd('0x25')]);}})[_0x61dd('0x28')](function(_0x370d5e){logger[_0x61dd('0x23')](_0x61dd('0x21'),_0x4abd47,_0x370d5e);_0xeeabc6(_0x370d5e);});});}function respondWithStatusCode(_0x572954,_0x43c56c){_0x43c56c=_0x43c56c||0xcc;return function(_0x5121f5){if(_0x5121f5){return _0x572954[_0x61dd('0x29')](_0x43c56c);}return _0x572954[_0x61dd('0x2a')](_0x43c56c)['end']();};}function respondWithResult(_0x2d5d5c,_0x577550){_0x577550=_0x577550||0xc8;return function(_0x32fa0c){if(_0x32fa0c){return _0x2d5d5c[_0x61dd('0x2a')](_0x577550)['json'](_0x32fa0c);}};}function respondWithFilteredResult(_0x38ec8c,_0x2dbcac){return function(_0x2aeb67){if(_0x2aeb67){var _0x14dfce=_0x2aeb67['count'],_0x1eb475=_0x2dbcac[_0x61dd('0x2b')],_0x490335=_0x2dbcac[_0x61dd('0x2b')]+_0x2dbcac[_0x61dd('0x2c')],_0x55112d;if(_0x490335>=_0x14dfce){_0x490335=_0x14dfce;_0x55112d=0xc8;}else{_0x55112d=0xce;}_0x38ec8c[_0x61dd('0x2a')](_0x55112d);return _0x38ec8c[_0x61dd('0x2d')](_0x61dd('0x2e'),_0x1eb475+'-'+_0x490335+'/'+_0x14dfce)[_0x61dd('0x2f')](_0x2aeb67);}return null;};}function patchUpdates(_0x428b8f){return function(_0x93c62e){try{jsonpatch[_0x61dd('0x30')](_0x93c62e,_0x428b8f,!![]);}catch(_0x2bc4cd){return BPromise[_0x61dd('0x31')](_0x2bc4cd);}return _0x93c62e[_0x61dd('0x32')]();};}function saveUpdates(_0x88df41,_0x5b43ba){return function(_0x15abf6){if(_0x15abf6){return _0x15abf6[_0x61dd('0x33')](_0x88df41)[_0x61dd('0x34')](function(_0x592dd7){return _0x592dd7;});}return null;};}function removeEntity(_0x2b8f50,_0x521f49){return function(_0x2aaab3){if(_0x2aaab3){return _0x2aaab3[_0x61dd('0x35')]()[_0x61dd('0x34')](function(){_0x2b8f50[_0x61dd('0x2a')](0xcc)[_0x61dd('0x36')]();});}};}function handleEntityNotFound(_0x1afe40,_0x2a9267){return function(_0x29989a){if(!_0x29989a){_0x1afe40[_0x61dd('0x29')](0x194);}return _0x29989a;};}function handleError(_0x4fe512,_0x8392f1){_0x8392f1=_0x8392f1||0x1f4;return function(_0x12f2b5){logger['error'](_0x12f2b5[_0x61dd('0x37')]);if(_0x12f2b5[_0x61dd('0x38')]){delete _0x12f2b5['name'];}_0x4fe512[_0x61dd('0x2a')](_0x8392f1)[_0x61dd('0x39')](_0x12f2b5);};}exports['index']=function(_0x22947b,_0x39412d){var _0x3650c5={},_0x310aec={},_0x572420={'count':0x0,'rows':[]};var _0x4242ab=_[_0x61dd('0x3a')](db[_0x61dd('0x3b')][_0x61dd('0x3c')],function(_0x57a1a4){return{'name':_0x57a1a4[_0x61dd('0x3d')],'type':_0x57a1a4[_0x61dd('0x3e')][_0x61dd('0x3f')]};});_0x310aec[_0x61dd('0x40')]=_['map'](_0x4242ab,_0x61dd('0x38'));_0x310aec[_0x61dd('0x41')]=_[_0x61dd('0x42')](_0x22947b[_0x61dd('0x41')]);_0x310aec['filters']=_[_0x61dd('0x43')](_0x310aec[_0x61dd('0x40')],_0x310aec[_0x61dd('0x41')]);_0x3650c5['attributes']=_[_0x61dd('0x43')](_0x310aec[_0x61dd('0x40')],qs['fields'](_0x22947b['query'][_0x61dd('0x44')]));_0x3650c5[_0x61dd('0x45')]=_0x3650c5[_0x61dd('0x45')][_0x61dd('0x46')]?_0x3650c5[_0x61dd('0x45')]:_0x310aec['model'];if(!_0x22947b[_0x61dd('0x41')][_0x61dd('0x47')]('nolimit')){_0x3650c5[_0x61dd('0x2c')]=qs[_0x61dd('0x2c')](_0x22947b[_0x61dd('0x41')]['limit']);_0x3650c5[_0x61dd('0x2b')]=qs[_0x61dd('0x2b')](_0x22947b[_0x61dd('0x41')][_0x61dd('0x2b')]);}_0x3650c5['order']=qs[_0x61dd('0x48')](_0x22947b['query'][_0x61dd('0x48')]);_0x3650c5['where']=qs[_0x61dd('0x49')](_[_0x61dd('0x4a')](_0x22947b[_0x61dd('0x41')],_0x310aec[_0x61dd('0x49')]));if(_0x22947b[_0x61dd('0x41')][_0x61dd('0x4b')]){_0x3650c5[_0x61dd('0x4c')]=_['merge'](_0x3650c5[_0x61dd('0x4c')],{'$or':_[_0x61dd('0x3a')](_0x4242ab,function(_0x139a67){if(_0x139a67[_0x61dd('0x3e')]!==_0x61dd('0x4d')){var _0x165700={};_0x165700[_0x139a67[_0x61dd('0x38')]]={'$like':'%'+_0x22947b[_0x61dd('0x41')][_0x61dd('0x4b')]+'%'};return _0x165700;}})});}_0x3650c5=_[_0x61dd('0x4e')]({},_0x3650c5,_0x22947b[_0x61dd('0x4f')]);var _0x4fa317={'where':_0x3650c5[_0x61dd('0x4c')]};return db[_0x61dd('0x3b')]['count'](_0x4fa317)[_0x61dd('0x34')](function(_0x5e950e){_0x572420[_0x61dd('0x50')]=_0x5e950e;if(_0x22947b[_0x61dd('0x41')]['includeAll']){_0x3650c5[_0x61dd('0x51')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x3650c5);})[_0x61dd('0x34')](function(_0x432109){_0x572420[_0x61dd('0x52')]=_0x432109;return _0x572420;})['then'](respondWithFilteredResult(_0x39412d,_0x3650c5))[_0x61dd('0x28')](handleError(_0x39412d,null));};exports[_0x61dd('0x53')]=function(_0xd902df,_0x325885){var _0x20ccb3={'raw':!![],'where':{'id':_0xd902df[_0x61dd('0x54')]['id']}},_0x4d60a8={};_0x4d60a8[_0x61dd('0x40')]=_[_0x61dd('0x42')](db[_0x61dd('0x3b')][_0x61dd('0x3c')]);_0x4d60a8[_0x61dd('0x41')]=_['keys'](_0xd902df['query']);_0x4d60a8[_0x61dd('0x49')]=_['intersection'](_0x4d60a8['model'],_0x4d60a8[_0x61dd('0x41')]);_0x20ccb3['attributes']=_[_0x61dd('0x43')](_0x4d60a8[_0x61dd('0x40')],qs['fields'](_0xd902df[_0x61dd('0x41')][_0x61dd('0x44')]));_0x20ccb3[_0x61dd('0x45')]=_0x20ccb3[_0x61dd('0x45')]['length']?_0x20ccb3[_0x61dd('0x45')]:_0x4d60a8['model'];if(_0xd902df['query'][_0x61dd('0x55')]){_0x20ccb3[_0x61dd('0x51')]=[{'all':!![]}];}_0x20ccb3=_[_0x61dd('0x4e')]({},_0x20ccb3,_0xd902df[_0x61dd('0x4f')]);return db[_0x61dd('0x3b')]['find'](_0x20ccb3)[_0x61dd('0x34')](handleEntityNotFound(_0x325885,null))[_0x61dd('0x34')](respondWithResult(_0x325885,null))['catch'](handleError(_0x325885,null));};exports[_0x61dd('0x56')]=function(_0x2b2680,_0x26d6be){return db[_0x61dd('0x3b')][_0x61dd('0x56')](_0x2b2680['body'],{})['then'](respondWithResult(_0x26d6be,0xc9))[_0x61dd('0x28')](handleError(_0x26d6be,null));};exports[_0x61dd('0x33')]=function(_0x8a9a00,_0x4b712d){if(_0x8a9a00['body']['id']){delete _0x8a9a00[_0x61dd('0x57')]['id'];}return db[_0x61dd('0x3b')][_0x61dd('0x58')]({'where':{'id':_0x8a9a00['params']['id']}})[_0x61dd('0x34')](handleEntityNotFound(_0x4b712d,null))[_0x61dd('0x34')](saveUpdates(_0x8a9a00['body'],null))[_0x61dd('0x34')](respondWithResult(_0x4b712d,null))['catch'](handleError(_0x4b712d,null));};exports[_0x61dd('0x35')]=function(_0x499275,_0x466795){return db[_0x61dd('0x3b')]['find']({'where':{'id':_0x499275[_0x61dd('0x54')]['id']}})['then'](handleEntityNotFound(_0x466795,null))['then'](removeEntity(_0x466795,null))['catch'](handleError(_0x466795,null));};exports[_0x61dd('0x59')]=function(_0x423e95,_0x4c2a22){return db[_0x61dd('0x3b')][_0x61dd('0x59')]()[_0x61dd('0x34')](respondWithResult(_0x4c2a22,null))[_0x61dd('0x28')](handleError(_0x4c2a22,null));};exports[_0x61dd('0x5a')]=function(_0x14a25e,_0x3eb216,_0xf31b19){return db['ChatInternalMessage'][_0x61dd('0x50')]({'where':{'ChatGroupId':_0x14a25e['params']['id'],'ToId':_0x14a25e[_0x61dd('0x5b')]['id'],'read':![]}})[_0x61dd('0x34')](function(_0x205c5e){return{'id':_[_0x61dd('0x5c')](_0x14a25e['params']['id']),'count':_0x205c5e};})[_0x61dd('0x34')](respondWithResult(_0x3eb216,null))['catch'](handleError(_0x3eb216,null));};exports[_0x61dd('0x5d')]=function(_0x40ba6d,_0x4276d4,_0x66c2cd){return db[_0x61dd('0x3b')][_0x61dd('0x58')]({'where':{'id':_0x40ba6d[_0x61dd('0x54')]['id']}})[_0x61dd('0x34')](handleEntityNotFound(_0x4276d4,null))[_0x61dd('0x34')](function(_0x12dc25){if(_0x12dc25){return _0x12dc25[_0x61dd('0x5d')](_0x40ba6d[_0x61dd('0x57')][_0x61dd('0x5e')],_[_0x61dd('0x5f')](_0x40ba6d[_0x61dd('0x57')],['ids','id'])||{});}})[_0x61dd('0x34')](respondWithResult(_0x4276d4,null))[_0x61dd('0x28')](handleError(_0x4276d4,null));};exports[_0x61dd('0x60')]=function(_0x58f307,_0x495bbe,_0x1643e1){var _0x7bf749={};var _0x4936e1={};var _0x321e79;var _0x5c4c2f;return db[_0x61dd('0x3b')][_0x61dd('0x61')]({'where':{'id':_0x58f307['params']['id']}})[_0x61dd('0x34')](handleEntityNotFound(_0x495bbe,null))[_0x61dd('0x34')](function(_0x59bd5b){if(_0x59bd5b){_0x321e79=_0x59bd5b;_0x4936e1['model']=_[_0x61dd('0x42')](db[_0x61dd('0x62')]['rawAttributes']);_0x4936e1[_0x61dd('0x41')]=_[_0x61dd('0x42')](_0x58f307['query']);_0x4936e1[_0x61dd('0x49')]=_[_0x61dd('0x43')](_0x4936e1[_0x61dd('0x40')],_0x4936e1[_0x61dd('0x41')]);_0x7bf749[_0x61dd('0x45')]=_[_0x61dd('0x43')](_0x4936e1['model'],qs[_0x61dd('0x44')](_0x58f307['query'][_0x61dd('0x44')]));_0x7bf749[_0x61dd('0x45')]=_0x7bf749[_0x61dd('0x45')][_0x61dd('0x46')]?_0x7bf749['attributes']:_0x4936e1[_0x61dd('0x40')];_0x7bf749[_0x61dd('0x63')]=qs['sort'](_0x58f307[_0x61dd('0x41')][_0x61dd('0x48')]);_0x7bf749[_0x61dd('0x4c')]=qs[_0x61dd('0x49')](_[_0x61dd('0x4a')](_0x58f307[_0x61dd('0x41')],_0x4936e1[_0x61dd('0x49')]));if(_0x58f307['query'][_0x61dd('0x4b')]){_0x7bf749[_0x61dd('0x4c')]=_[_0x61dd('0x4e')](_0x7bf749[_0x61dd('0x4c')],{'$or':_['map'](_0x7bf749[_0x61dd('0x45')],function(_0x1b4495){var _0x49b6d8={};_0x49b6d8[_0x1b4495]={'$like':'%'+_0x58f307['query']['filter']+'%'};return _0x49b6d8;})});}_0x7bf749=_['merge']({},_0x7bf749,_0x58f307[_0x61dd('0x4f')]);return _0x321e79[_0x61dd('0x60')](_0x7bf749);}})[_0x61dd('0x34')](function(_0x597297){if(_0x597297){_0x5c4c2f=_0x597297[_0x61dd('0x46')];if(!_0x58f307[_0x61dd('0x41')][_0x61dd('0x47')]('nolimit')){_0x7bf749[_0x61dd('0x2c')]=qs[_0x61dd('0x2c')](_0x58f307[_0x61dd('0x41')][_0x61dd('0x2c')]);_0x7bf749['offset']=qs[_0x61dd('0x2b')](_0x58f307[_0x61dd('0x41')][_0x61dd('0x2b')]);}return _0x321e79[_0x61dd('0x60')](_0x7bf749);}})[_0x61dd('0x34')](function(_0x4ec0fe){if(_0x4ec0fe){return _0x4ec0fe?{'count':_0x5c4c2f,'rows':_0x4ec0fe}:null;}})[_0x61dd('0x34')](respondWithResult(_0x495bbe,null))['catch'](handleError(_0x495bbe,null));};exports[_0x61dd('0x64')]=function(_0x32b364,_0x1ad6f2,_0x1f5bb7){return db[_0x61dd('0x3b')]['find']({'where':{'id':_0x32b364['params']['id']}})['then'](handleEntityNotFound(_0x1ad6f2,null))[_0x61dd('0x34')](function(_0xa1950b){if(_0xa1950b){return _0xa1950b[_0x61dd('0x64')](_0x32b364[_0x61dd('0x41')][_0x61dd('0x5e')]);}})[_0x61dd('0x34')](respondWithStatusCode(_0x1ad6f2,null))[_0x61dd('0x28')](handleError(_0x1ad6f2,null));};exports['addMessage']=function(_0x58c7fe,_0xca5b61,_0x35a5a4){if(_0x58c7fe[_0x61dd('0x57')]['id']){delete _0x58c7fe[_0x61dd('0x57')]['id'];}return db[_0x61dd('0x3b')]['find']({'where':{'id':_0x58c7fe['params']['id']}})[_0x61dd('0x34')](handleEntityNotFound(_0xca5b61,null))[_0x61dd('0x34')](function(_0x3f75c3){if(_0x3f75c3){_0x58c7fe[_0x61dd('0x57')][_0x61dd('0x65')]=_0x3f75c3['id'];return db[_0x61dd('0x66')]['create'](_0x58c7fe['body']);}})[_0x61dd('0x34')](respondWithResult(_0xca5b61,null))[_0x61dd('0x28')](handleError(_0xca5b61,null));};exports[_0x61dd('0x67')]=function(_0x2614e1,_0x4c8a14,_0x542ed7){var _0x1297cf={};var _0x34c5eb={};var _0x43e09e;var _0x388530;return db[_0x61dd('0x3b')][_0x61dd('0x61')]({'where':{'id':_0x2614e1[_0x61dd('0x54')]['id']}})[_0x61dd('0x34')](handleEntityNotFound(_0x4c8a14,null))[_0x61dd('0x34')](function(_0x55cd9a){if(_0x55cd9a){_0x43e09e=_0x55cd9a;_0x34c5eb[_0x61dd('0x40')]=_[_0x61dd('0x42')](db[_0x61dd('0x66')][_0x61dd('0x3c')]);_0x34c5eb[_0x61dd('0x41')]=_[_0x61dd('0x42')](_0x2614e1[_0x61dd('0x41')]);_0x34c5eb[_0x61dd('0x49')]=_[_0x61dd('0x43')](_0x34c5eb['model'],_0x34c5eb[_0x61dd('0x41')]);_0x1297cf[_0x61dd('0x45')]=_[_0x61dd('0x43')](_0x34c5eb[_0x61dd('0x40')],qs['fields'](_0x2614e1[_0x61dd('0x41')][_0x61dd('0x44')]));_0x1297cf[_0x61dd('0x45')]=_0x1297cf[_0x61dd('0x45')][_0x61dd('0x46')]?_0x1297cf[_0x61dd('0x45')]:_0x34c5eb['model'];_0x1297cf[_0x61dd('0x63')]=qs[_0x61dd('0x48')](_0x2614e1[_0x61dd('0x41')][_0x61dd('0x48')]);_0x1297cf[_0x61dd('0x4c')]=qs[_0x61dd('0x49')](_[_0x61dd('0x4a')](_0x2614e1[_0x61dd('0x41')],_0x34c5eb[_0x61dd('0x49')]));if(_0x2614e1[_0x61dd('0x41')][_0x61dd('0x4b')]){_0x1297cf[_0x61dd('0x4c')]=_['merge'](_0x1297cf[_0x61dd('0x4c')],{'$or':_['map'](_0x1297cf[_0x61dd('0x45')],function(_0x336fad){var _0x27342b={};_0x27342b[_0x336fad]={'$like':'%'+_0x2614e1[_0x61dd('0x41')]['filter']+'%'};return _0x27342b;})});}if(_0x2614e1[_0x61dd('0x41')]['$gte']){var _0xfb4b42=_0x2614e1['query'][_0x61dd('0x68')][_0x61dd('0x69')](',');var _0x5eb8d1={};_0x5eb8d1[_0xfb4b42[0x0]]={'$gte':moment(_0xfb4b42[0x1])[_0x61dd('0x6a')](_0x61dd('0x6b'))};_0x1297cf['where']=_['merge'](_0x1297cf[_0x61dd('0x4c')],_0x5eb8d1);}_0x1297cf=_[_0x61dd('0x4e')]({},_0x1297cf,_0x2614e1['options']);return _0x43e09e['getMessages'](_0x1297cf);}})[_0x61dd('0x34')](function(_0x35cbbc){if(_0x35cbbc){_0x388530=_0x35cbbc[_0x61dd('0x46')];if(!_0x2614e1[_0x61dd('0x41')]['hasOwnProperty'](_0x61dd('0x6c'))){_0x1297cf[_0x61dd('0x2c')]=qs[_0x61dd('0x2c')](_0x2614e1[_0x61dd('0x41')][_0x61dd('0x2c')]);_0x1297cf[_0x61dd('0x2b')]=qs[_0x61dd('0x2b')](_0x2614e1[_0x61dd('0x41')][_0x61dd('0x2b')]);}return _0x43e09e[_0x61dd('0x67')](_0x1297cf);}})[_0x61dd('0x34')](function(_0x313eb5){if(_0x313eb5){return _0x313eb5?{'count':_0x388530,'rows':_0x313eb5}:null;}})['then'](respondWithResult(_0x4c8a14,null))[_0x61dd('0x28')](handleError(_0x4c8a14,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 147c0c3..108c4e6 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(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xadb5,0xad));var _0x5adb=function(_0x385df3,_0x1ac3bc){_0x385df3=_0x385df3-0x0;var _0x240544=_0xadb5[_0x385df3];return _0x240544;};'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 _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x5bcc04,_0x46a7cc){var _0x2ff09a=function(_0x3a1c65){while(--_0x3a1c65){_0x5bcc04['push'](_0x5bcc04['shift']());}};_0x2ff09a(++_0x46a7cc);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x65f6('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){ChatGroupEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);ChatGroupEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 8a50055..e7168f0 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 _0xe700=['../../config/environment','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x49e97c,_0xf2b0d0){var _0x5aa4b3=function(_0x3bd52c){while(--_0x3bd52c){_0x49e97c['push'](_0x49e97c['shift']());}};_0x5aa4b3(++_0xf2b0d0);}(_0xe700,0x75));var _0x0e70=function(_0x2c0f65,_0x59dee3){_0x2c0f65=_0x2c0f65-0x0;var _0x185497=_0xe700[_0x2c0f65];return _0x185497;};'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('./chatGroup.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 _0x1738=['exports','define','ChatGroup','chat_groups','lodash','util','moment','bluebird','request-promise','../../config/environment','./chatGroup.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1738,0x1bc));var _0x8173=function(_0x16f4b6,_0x555536){_0x16f4b6=_0x16f4b6-0x0;var _0xd0b6b0=_0x1738[_0x16f4b6];return _0xd0b6b0;};'use strict';var _=require(_0x8173('0x0'));var util=require(_0x8173('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8173('0x2'));var BPromise=require(_0x8173('0x3'));var rp=require(_0x8173('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8173('0x5'));var attributes=require(_0x8173('0x6'));module[_0x8173('0x7')]=function(_0x3cf9ac,_0x2220fd){return _0x3cf9ac[_0x8173('0x8')](_0x8173('0x9'),attributes,{'tableName':_0x8173('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index b274d61..f24f407 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 _0x8a9e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util'];(function(_0x3f9e1e,_0x532a32){var _0x564a8e=function(_0x5c8d20){while(--_0x5c8d20){_0x3f9e1e['push'](_0x3f9e1e['shift']());}};_0x564a8e(++_0x532a32);}(_0x8a9e,0x6e));var _0xe8a9=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x8a9e[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0xe8a9('0x0'));var util=require(_0xe8a9('0x1'));var moment=require('moment');var BPromise=require(_0xe8a9('0x2'));var rs=require(_0xe8a9('0x3'));var fs=require('fs');var Redis=require(_0xe8a9('0x4'));var db=require(_0xe8a9('0x5'))['db'];var utils=require(_0xe8a9('0x6'));var logger=require(_0xe8a9('0x7'))(_0xe8a9('0x8'));var config=require(_0xe8a9('0x9'));var jayson=require(_0xe8a9('0xa'));var client=jayson[_0xe8a9('0xb')][_0xe8a9('0xc')]({'port':0x232a});config['redis']=_[_0xe8a9('0xd')](config[_0xe8a9('0xe')],{'host':_0xe8a9('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe8a9('0xe')]));require(_0xe8a9('0x10'))[_0xe8a9('0x11')](socket);function respondWithRpcPromise(_0x5aee3a,_0x2489ff,_0x41d233){return new BPromise(function(_0x47f49a,_0x5ab2a5){return client[_0xe8a9('0x12')](_0x5aee3a,_0x41d233)['then'](function(_0x358056){logger[_0xe8a9('0x13')](_0xe8a9('0x14'),_0x2489ff,'request\x20sent');logger[_0xe8a9('0x15')](_0xe8a9('0x16'),_0x2489ff,_0xe8a9('0x17'),JSON[_0xe8a9('0x18')](_0x358056));if(_0x358056['error']){if(_0x358056['error']['code']===0x1f4){logger[_0xe8a9('0x19')](_0xe8a9('0x14'),_0x2489ff,_0x358056[_0xe8a9('0x19')]['message']);return _0x5ab2a5(_0x358056[_0xe8a9('0x19')][_0xe8a9('0x1a')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x2489ff,_0x358056['error']['message']);return _0x47f49a(_0x358056['error'][_0xe8a9('0x1a')]);}else{logger['info'](_0xe8a9('0x14'),_0x2489ff,'request\x20sent');_0x47f49a(_0x358056[_0xe8a9('0x1b')][_0xe8a9('0x1a')]);}})['catch'](function(_0x3027f){logger[_0xe8a9('0x19')]('ChatGroup,\x20%s,\x20%s',_0x2489ff,_0x3027f);_0x5ab2a5(_0x3027f);});});} \ No newline at end of file +var _0x327f=['./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter'];(function(_0x40576b,_0x280b79){var _0x39d545=function(_0x3d6c28){while(--_0x3d6c28){_0x40576b['push'](_0x40576b['shift']());}};_0x39d545(++_0x280b79);}(_0x327f,0x15d));var _0xf327=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x327f[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf327('0x0'));var BPromise=require(_0xf327('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf327('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xf327('0x3'))('rpc');var config=require(_0xf327('0x4'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xf327('0x5')]=_['defaults'](config[_0xf327('0x5')],{'host':_0xf327('0x6'),'port':0x18eb});var socket=require(_0xf327('0x7'))(new Redis(config['redis']));require(_0xf327('0x8'))[_0xf327('0x9')](socket);function respondWithRpcPromise(_0x42d6e2,_0x2d1e17,_0x20c02a){return new BPromise(function(_0x36e530,_0x27566c){return client[_0xf327('0xa')](_0x42d6e2,_0x20c02a)[_0xf327('0xb')](function(_0x418393){logger[_0xf327('0xc')](_0xf327('0xd'),_0x2d1e17,'request\x20sent');logger[_0xf327('0xe')](_0xf327('0xf'),_0x2d1e17,_0xf327('0x10'),JSON[_0xf327('0x11')](_0x418393));if(_0x418393['error']){if(_0x418393[_0xf327('0x12')][_0xf327('0x13')]===0x1f4){logger[_0xf327('0x12')](_0xf327('0xd'),_0x2d1e17,_0x418393[_0xf327('0x12')][_0xf327('0x14')]);return _0x27566c(_0x418393['error'][_0xf327('0x14')]);}logger['error'](_0xf327('0xd'),_0x2d1e17,_0x418393[_0xf327('0x12')][_0xf327('0x14')]);return _0x36e530(_0x418393[_0xf327('0x12')][_0xf327('0x14')]);}else{logger[_0xf327('0xc')]('ChatGroup,\x20%s,\x20%s',_0x2d1e17,'request\x20sent');_0x36e530(_0x418393['result'][_0xf327('0x14')]);}})['catch'](function(_0x54db0b){logger[_0xf327('0x12')](_0xf327('0xd'),_0x2d1e17,_0x54db0b);_0x27566c(_0x54db0b);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 1938f92..29a89c5 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 _0xbfb1=['register','length','chatGroup:','./chatGroup.events','remove','update','emit','removeListener'];(function(_0x1efbe0,_0x596125){var _0x5b02b8=function(_0x517738){while(--_0x517738){_0x1efbe0['push'](_0x1efbe0['shift']());}};_0x5b02b8(++_0x596125);}(_0xbfb1,0x73));var _0x1bfb=function(_0x19c5f2,_0x44ed13){_0x19c5f2=_0x19c5f2-0x0;var _0xb94caf=_0xbfb1[_0x19c5f2];return _0xb94caf;};'use strict';var ChatGroupEvents=require(_0x1bfb('0x0'));var events=['save',_0x1bfb('0x1'),_0x1bfb('0x2')];function createListener(_0x43a4e3,_0xa0afe1){return function(_0x4f4828){_0xa0afe1[_0x1bfb('0x3')](_0x43a4e3,_0x4f4828);};}function removeListener(_0x5d3f19,_0x1ca713){return function(){ChatGroupEvents[_0x1bfb('0x4')](_0x5d3f19,_0x1ca713);};}exports[_0x1bfb('0x5')]=function(_0x5da88a){for(var _0xe1bbef=0x0,_0x4d5e27=events[_0x1bfb('0x6')];_0xe1bbef<_0x4d5e27;_0xe1bbef++){var _0x18514e=events[_0xe1bbef];var _0x2ccc49=createListener(_0x1bfb('0x7')+_0x18514e,_0x5da88a);ChatGroupEvents['on'](_0x18514e,_0x2ccc49);}}; \ No newline at end of file +var _0x2722=['length','chatGroup:','save','remove','update','removeListener','register'];(function(_0xda53b6,_0x9f12cd){var _0xf867b8=function(_0x4498db){while(--_0x4498db){_0xda53b6['push'](_0xda53b6['shift']());}};_0xf867b8(++_0x9f12cd);}(_0x2722,0xfe));var _0x2272=function(_0x2b1480,_0x234e3a){_0x2b1480=_0x2b1480-0x0;var _0x2d8304=_0x2722[_0x2b1480];return _0x2d8304;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x2272('0x0'),_0x2272('0x1'),_0x2272('0x2')];function createListener(_0x5eb6b0,_0x2c5fdb){return function(_0x475750){_0x2c5fdb['emit'](_0x5eb6b0,_0x475750);};}function removeListener(_0x31f97b,_0x3e110e){return function(){ChatGroupEvents[_0x2272('0x3')](_0x31f97b,_0x3e110e);};}exports[_0x2272('0x4')]=function(_0x118fec){for(var _0x468bc6=0x0,_0x536c07=events[_0x2272('0x5')];_0x468bc6<_0x536c07;_0x468bc6++){var _0x1dcc98=events[_0x468bc6];var _0x4bb56a=createListener(_0x2272('0x6')+_0x1dcc98,_0x118fec);ChatGroupEvents['on'](_0x1dcc98,_0x4bb56a);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 83f5059..3d63580 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 _0x9d50=['describe','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','addMessage','put','/:id','delete','destroy','removeMembers','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','index','/describe','isAuthenticated'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0x9d50,0xd4));var _0x09d5=function(_0x7f8f4b,_0xe5c967){_0x7f8f4b=_0x7f8f4b-0x0;var _0x403b34=_0x9d50[_0x7f8f4b];return _0x403b34;};'use strict';var multer=require('multer');var util=require(_0x09d5('0x0'));var path=require('path');var timeout=require(_0x09d5('0x1'));var express=require(_0x09d5('0x2'));var router=express[_0x09d5('0x3')]();var auth=require(_0x09d5('0x4'));var interaction=require(_0x09d5('0x5'));var config=require(_0x09d5('0x6'));var controller=require(_0x09d5('0x7'));router[_0x09d5('0x8')]('/',auth['isAuthenticated'](),controller[_0x09d5('0x9')]);router['get'](_0x09d5('0xa'),auth[_0x09d5('0xb')](),controller[_0x09d5('0xc')]);router['get']('/:id',auth[_0x09d5('0xb')](),controller['show']);router['get'](_0x09d5('0xd'),auth[_0x09d5('0xb')](),controller[_0x09d5('0xe')]);router[_0x09d5('0x8')](_0x09d5('0xf'),auth['isAuthenticated'](),controller[_0x09d5('0x10')]);router[_0x09d5('0x8')](_0x09d5('0x11'),auth[_0x09d5('0xb')](),controller['getMessages']);router[_0x09d5('0x12')]('/',auth[_0x09d5('0xb')](),controller[_0x09d5('0x13')]);router['post']('/:id/members',auth[_0x09d5('0xb')](),controller[_0x09d5('0x14')]);router[_0x09d5('0x12')](_0x09d5('0x11'),auth['isAuthenticated'](),controller[_0x09d5('0x15')]);router[_0x09d5('0x16')](_0x09d5('0x17'),auth['isAuthenticated'](),controller['update']);router[_0x09d5('0x18')](_0x09d5('0x17'),auth[_0x09d5('0xb')](),controller[_0x09d5('0x19')]);router[_0x09d5('0x18')](_0x09d5('0xf'),auth[_0x09d5('0xb')](),controller[_0x09d5('0x1a')]);module[_0x09d5('0x1b')]=router; \ No newline at end of file +var _0xdc13=['getMembers','post','create','addMembers','addMessage','/:id','update','delete','destroy','removeMembers','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','/describe','describe','show','/:id/unread','getUnread','/:id/members'];(function(_0x1ad7a6,_0x11de9c){var _0x434762=function(_0x2559ad){while(--_0x2559ad){_0x1ad7a6['push'](_0x1ad7a6['shift']());}};_0x434762(++_0x11de9c);}(_0xdc13,0x185));var _0x3dc1=function(_0x2ca515,_0x2f0654){_0x2ca515=_0x2ca515-0x0;var _0x2f7701=_0xdc13[_0x2ca515];return _0x2f7701;};'use strict';var multer=require(_0x3dc1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3dc1('0x1'));var express=require(_0x3dc1('0x2'));var router=express[_0x3dc1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3dc1('0x4'));var config=require(_0x3dc1('0x5'));var controller=require(_0x3dc1('0x6'));router['get']('/',auth[_0x3dc1('0x7')](),controller[_0x3dc1('0x8')]);router[_0x3dc1('0x9')](_0x3dc1('0xa'),auth[_0x3dc1('0x7')](),controller[_0x3dc1('0xb')]);router[_0x3dc1('0x9')]('/:id',auth[_0x3dc1('0x7')](),controller[_0x3dc1('0xc')]);router[_0x3dc1('0x9')](_0x3dc1('0xd'),auth['isAuthenticated'](),controller[_0x3dc1('0xe')]);router[_0x3dc1('0x9')](_0x3dc1('0xf'),auth[_0x3dc1('0x7')](),controller[_0x3dc1('0x10')]);router[_0x3dc1('0x9')]('/:id/messages',auth[_0x3dc1('0x7')](),controller['getMessages']);router[_0x3dc1('0x11')]('/',auth[_0x3dc1('0x7')](),controller[_0x3dc1('0x12')]);router[_0x3dc1('0x11')](_0x3dc1('0xf'),auth['isAuthenticated'](),controller[_0x3dc1('0x13')]);router[_0x3dc1('0x11')]('/:id/messages',auth[_0x3dc1('0x7')](),controller[_0x3dc1('0x14')]);router['put'](_0x3dc1('0x15'),auth['isAuthenticated'](),controller[_0x3dc1('0x16')]);router[_0x3dc1('0x17')](_0x3dc1('0x15'),auth['isAuthenticated'](),controller[_0x3dc1('0x18')]);router[_0x3dc1('0x17')](_0x3dc1('0xf'),auth[_0x3dc1('0x7')](),controller[_0x3dc1('0x19')]);module[_0x3dc1('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 1f1d1da..a07328e 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 _0x5ff0=['STRING','DATE','long','out','exports','INTEGER','ENUM','star','thumb','TEXT'];(function(_0x4169d8,_0x3d7cd4){var _0x32084a=function(_0x5f59c6){while(--_0x5f59c6){_0x4169d8['push'](_0x4169d8['shift']());}};_0x32084a(++_0x3d7cd4);}(_0x5ff0,0x72));var _0x05ff=function(_0xab896,_0xab9755){_0xab896=_0xab896-0x0;var _0x4c4c97=_0x5ff0[_0xab896];return _0x4c4c97;};'use strict';var Sequelize=require('sequelize');module[_0x05ff('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x05ff('0x1')]},'ratingType':{'type':Sequelize[_0x05ff('0x2')](_0x05ff('0x3'),_0x05ff('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x05ff('0x5')]},'pathTranscript':{'type':Sequelize[_0x05ff('0x5')]},'mailTranscript':{'type':Sequelize[_0x05ff('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x05ff('0x7')]},'disposition':{'type':Sequelize[_0x05ff('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x05ff('0x6')]},'osName':{'type':Sequelize[_0x05ff('0x6')]},'osVersion':{'type':Sequelize[_0x05ff('0x6')]},'deviceModel':{'type':Sequelize[_0x05ff('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x05ff('0x6')]},'referer':{'type':Sequelize[_0x05ff('0x5')]},'customerIp':{'type':Sequelize[_0x05ff('0x6')]},'formData':{'type':Sequelize['TEXT'](_0x05ff('0x8'))},'read1stAt':{'type':Sequelize[_0x05ff('0x7')]},'lastMsgAt':{'type':Sequelize[_0x05ff('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x05ff('0x2')]('in',_0x05ff('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x05ff('0x6')]},'customerPort':{'type':Sequelize[_0x05ff('0x6')]}}; \ No newline at end of file +var _0x6f6c=['out','sequelize','exports','BOOLEAN','star','thumb','TEXT','STRING','DATE','ENUM'];(function(_0x439316,_0x33a806){var _0xe9f2f2=function(_0x57ecc6){while(--_0x57ecc6){_0x439316['push'](_0x439316['shift']());}};_0xe9f2f2(++_0x33a806);}(_0x6f6c,0x19b));var _0xc6f6=function(_0x107b57,_0x5d1691){_0x107b57=_0x107b57-0x0;var _0x56ad6c=_0x6f6c[_0x107b57];return _0x56ad6c;};'use strict';var Sequelize=require(_0xc6f6('0x0'));module[_0xc6f6('0x1')]={'closed':{'type':Sequelize[_0xc6f6('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM'](_0xc6f6('0x3'),_0xc6f6('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xc6f6('0x5')]},'pathTranscript':{'type':Sequelize[_0xc6f6('0x5')]},'mailTranscript':{'type':Sequelize[_0xc6f6('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xc6f6('0x7')]},'disposition':{'type':Sequelize[_0xc6f6('0x6')]},'note':{'type':Sequelize[_0xc6f6('0x6')]},'browserName':{'type':Sequelize[_0xc6f6('0x6')]},'browserVersion':{'type':Sequelize[_0xc6f6('0x6')]},'osName':{'type':Sequelize[_0xc6f6('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xc6f6('0x6')]},'deviceType':{'type':Sequelize[_0xc6f6('0x6')]},'referer':{'type':Sequelize[_0xc6f6('0x5')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xc6f6('0x5')]('long')},'read1stAt':{'type':Sequelize[_0xc6f6('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xc6f6('0x8')]('in',_0xc6f6('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xc6f6('0x6')]},'customerPort':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index c83bd57..093d866 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 _0x5162=['ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','limit','set','save','update','destroy','end','stack','name','map','TagIds','Tags','split','forEach','push','index','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','field','color','from','ui.ChatInteractionId','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','select','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','union','UserId','buildExpression','body','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','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','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','ChatInteraction','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','ChatInteractionId','all','rows','show','params','keys','includeAll','include','options','create','describe','customUpdate','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','originalname','basename','filename','mimetype','attachmentDownload','Unauthorized','Attachment','findOne','download','root','server/files/attachments/','close','mailTranscript','join','format','transcript-%s.txt','now','pathTranscript','Messages','User','ChatWebsite','agentAlias','System','customer','agentIdentifier','%s%d','agent_alias','alias','agent_fullname','fullname','[%s]\x20%s:\x20%s\x0a','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ChatMessage','ids','filter','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','includeAgent','findAll','setTags','omit','spread','Tag','emit','chatInteractionTags:save','removeTags','server','files','tmp','transcript-%d-%s.zip','lastName','Account','Owner','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','%s\x20#%d','Chat','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','out','firstName','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','html-pdf','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.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','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xe8f0cd,_0x363b56){var _0x37e962=function(_0x3065f1){while(--_0x3065f1){_0xe8f0cd['push'](_0xe8f0cd['shift']());}};_0x37e962(++_0x363b56);}(_0x5162,0x103));var _0x2516=function(_0x1499c4,_0x57c5c3){_0x1499c4=_0x1499c4-0x0;var _0x3cf45a=_0x5162[_0x1499c4];return _0x3cf45a;};'use strict';var pdf=require(_0x2516('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2516('0x1'));var moment=require(_0x2516('0x2'));var BPromise=require(_0x2516('0x3'));var Mustache=require(_0x2516('0x4'));var util=require(_0x2516('0x5'));var path=require(_0x2516('0x6'));var sox=require(_0x2516('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2516('0x8'));var crypto=require(_0x2516('0x9'));var jsforce=require(_0x2516('0xa'));var deskjs=require(_0x2516('0xb'));var toCsv=require(_0x2516('0xc'));var querystring=require(_0x2516('0xd'));var Papa=require(_0x2516('0xe'));var Redis=require('ioredis');var authService=require(_0x2516('0xf'));var qs=require(_0x2516('0x10'));var as=require(_0x2516('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2516('0x12'));var db=require(_0x2516('0x13'))['db'];config[_0x2516('0x14')]=_[_0x2516('0x15')](config['redis'],{'host':_0x2516('0x16'),'port':0x18eb});var socket=require(_0x2516('0x17'))(new Redis(config[_0x2516('0x14')]));require(_0x2516('0x18'))[_0x2516('0x19')](socket);var jayson=require(_0x2516('0x1a'));var client=jayson[_0x2516('0x1b')][_0x2516('0x1c')]({'port':0x232b});var client9004=jayson[_0x2516('0x1b')][_0x2516('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x2637e8,_0x2ec31f,_0x19aacb){if(_0x19aacb){var _0x5dee15=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5dee15[_0x2516('0x1d')](_0x2ec31f)){return _0x2637e8;}else{throw new db['Sequelize'][(_0x2516('0x1e'))](_0x2516('0x1f'));}}else{return _0x2637e8;}}function respondWithRpcPromise(_0x1a1005,_0x564d05,_0x1979d7,_0x5e96c7){return new BPromise(function(_0x532d46,_0x31a817){var _0x3583cf=_0x5e96c7||client;return _0x3583cf[_0x2516('0x20')](_0x1a1005,_0x1979d7)[_0x2516('0x21')](function(_0x198b93){logger[_0x2516('0x22')](_0x2516('0x23'),_0x564d05,_0x2516('0x24'));logger[_0x2516('0x25')](_0x2516('0x26'),_0x564d05,_0x2516('0x24'),JSON[_0x2516('0x27')](_0x198b93));if(_0x198b93[_0x2516('0x28')]){if(_0x198b93['error']['code']===0x1f4){logger[_0x2516('0x28')](_0x2516('0x23'),_0x564d05,_0x198b93[_0x2516('0x28')][_0x2516('0x29')]);return _0x31a817(_0x198b93[_0x2516('0x28')][_0x2516('0x29')]);}logger[_0x2516('0x28')](_0x2516('0x23'),_0x564d05,_0x198b93['error'][_0x2516('0x29')]);return _0x532d46(_0x198b93[_0x2516('0x28')][_0x2516('0x29')]);}else{logger[_0x2516('0x22')]('ChatInteraction,\x20%s,\x20%s',_0x564d05,_0x2516('0x24'));_0x532d46(_0x198b93[_0x2516('0x2a')][_0x2516('0x29')]);}})[_0x2516('0x2b')](function(_0xd84b29){logger['error'](_0x2516('0x23'),_0x564d05,_0xd84b29);_0x31a817(_0xd84b29);});});}function respondWithStatusCode(_0x1750e7,_0x935035){_0x935035=_0x935035||0xcc;return function(_0x2cb847){if(_0x2cb847){return _0x1750e7[_0x2516('0x2c')](_0x935035);}return _0x1750e7[_0x2516('0x2d')](_0x935035)['end']();};}function respondWithResult(_0x136893,_0x20dc9f){_0x20dc9f=_0x20dc9f||0xc8;return function(_0x493a3e){if(_0x493a3e){return _0x136893[_0x2516('0x2d')](_0x20dc9f)[_0x2516('0x2e')](_0x493a3e);}};}function respondWithFilteredResult(_0x4527f1,_0x3b1aa6){return function(_0x539704){if(_0x539704){var _0x170324=_0x539704[_0x2516('0x2f')],_0x2e92f2=_0x3b1aa6[_0x2516('0x30')],_0x3c1daf=_0x3b1aa6[_0x2516('0x30')]+_0x3b1aa6[_0x2516('0x31')],_0x10f9ec;if(_0x3c1daf>=_0x170324){_0x3c1daf=_0x170324;_0x10f9ec=0xc8;}else{_0x10f9ec=0xce;}_0x4527f1[_0x2516('0x2d')](_0x10f9ec);return _0x4527f1[_0x2516('0x32')]('Content-Range',_0x2e92f2+'-'+_0x3c1daf+'/'+_0x170324)[_0x2516('0x2e')](_0x539704);}return null;};}function patchUpdates(_0x54147b){return function(_0x35fdf8){try{jsonpatch['apply'](_0x35fdf8,_0x54147b,!![]);}catch(_0x121574){return BPromise['reject'](_0x121574);}return _0x35fdf8[_0x2516('0x33')]();};}function saveUpdates(_0x9133f8,_0x1c26ca){return function(_0x261cff){if(_0x261cff){return _0x261cff[_0x2516('0x34')](_0x9133f8)[_0x2516('0x21')](function(_0x38e50a){return _0x38e50a;});}return null;};}function removeEntity(_0x1c74ca,_0x1ad634){return function(_0x5e67bc){if(_0x5e67bc){return _0x5e67bc[_0x2516('0x35')]()[_0x2516('0x21')](function(){_0x1c74ca[_0x2516('0x2d')](0xcc)[_0x2516('0x36')]();});}};}function handleEntityNotFound(_0x5bbb3c,_0x4de820){return function(_0x3f505f){if(!_0x3f505f){_0x5bbb3c[_0x2516('0x2c')](0x194);}return _0x3f505f;};}function handleError(_0x2b0a76,_0x1d9b16){_0x1d9b16=_0x1d9b16||0x1f4;return function(_0x45c12e){logger[_0x2516('0x28')](_0x45c12e[_0x2516('0x37')]);if(_0x45c12e[_0x2516('0x38')]){delete _0x45c12e[_0x2516('0x38')];}_0x2b0a76[_0x2516('0x2d')](_0x1d9b16)['send'](_0x45c12e);};}function getInteractionUsers(_0x4844a1,_0x24f64f){return new BPromise(function(_0x322021,_0x494b51){try{if(_0x24f64f[_0x4844a1['id']]){_0x4844a1['Users']=_[_0x2516('0x39')](_0x24f64f[_0x4844a1['id']],function(_0x3b310f){return{'id':_0x3b310f['id'],'fullname':_0x3b310f['fullname']};});}}catch(_0x3982ca){_0x494b51(_0x3982ca);}_0x322021(_0x4844a1);});}function getInteractionTags(_0x52ef6b,_0x322fb7){return new BPromise(function(_0x4412cf,_0x550ca5){try{if(_0x52ef6b[_0x2516('0x3a')]){_0x52ef6b[_0x2516('0x3b')]=[];_0x52ef6b[_0x2516('0x3a')][_0x2516('0x3c')](',')[_0x2516('0x3d')](function(_0x25c33a){_0x52ef6b[_0x2516('0x3b')][_0x2516('0x3e')](_0x322fb7[_0x25c33a]);});}delete _0x52ef6b[_0x2516('0x3a')];}catch(_0xc1c0fb){_0x550ca5(_0xc1c0fb);}_0x4412cf(_0x52ef6b);});}function updateChatInteraction(_0x38ca2e,_0x431512,_0x89b14c){return new BPromise(function(_0x4c832b,_0x1b72cd){return getInteractionUsers(_0x38ca2e,_0x89b14c)[_0x2516('0x21')](function(_0x5debf2){return getInteractionTags(_0x5debf2,_0x431512);})[_0x2516('0x21')](function(_0x2161c0){_0x4c832b(_0x2161c0);})[_0x2516('0x2b')](function(_0x1afefb){_0x1b72cd(_0x1afefb);});});}exports[_0x2516('0x3f')]=function(_0x582cb6,_0x1a8d2d){var _0xe5bc76={},_0x160801={},_0x1447de={'count':0x0,'rows':[]};var _0x2f980d=_[_0x2516('0x39')](db['ChatInteraction'][_0x2516('0x40')],function(_0x30fb17){return{'name':_0x30fb17[_0x2516('0x41')],'type':_0x30fb17[_0x2516('0x42')][_0x2516('0x43')]};});_0x160801[_0x2516('0x44')]=_[_0x2516('0x39')](_0x2f980d,'name');_0x160801[_0x2516('0x45')]=_['keys'](_0x582cb6[_0x2516('0x45')]);_0x160801['filters']=_[_0x2516('0x46')](_0x160801[_0x2516('0x44')],_0x160801[_0x2516('0x45')]);_0xe5bc76['attributes']=_['intersection'](_0x160801[_0x2516('0x44')],qs[_0x2516('0x47')](_0x582cb6['query']['fields']));_0xe5bc76[_0x2516('0x48')]=_0xe5bc76[_0x2516('0x48')][_0x2516('0x49')]?_0xe5bc76['attributes']:_0x160801[_0x2516('0x44')];if(!_0x582cb6['query'][_0x2516('0x4a')](_0x2516('0x4b'))){_0xe5bc76[_0x2516('0x31')]=qs[_0x2516('0x31')](_0x582cb6['query'][_0x2516('0x31')]);_0xe5bc76[_0x2516('0x30')]=qs[_0x2516('0x30')](_0x582cb6[_0x2516('0x45')][_0x2516('0x30')]);}_0xe5bc76['order']=qs[_0x2516('0x4c')](_0x582cb6[_0x2516('0x45')][_0x2516('0x4c')]);_0xe5bc76[_0x2516('0x4d')]=qs['filters'](_[_0x2516('0x4e')](_0x582cb6[_0x2516('0x45')],_0x160801[_0x2516('0x4f')]));var _0x41b716=[];var _0xdeb59b=squel['select']()[_0x2516('0x50')]('id')[_0x2516('0x50')](_0x2516('0x38'))[_0x2516('0x50')](_0x2516('0x51'))[_0x2516('0x52')]('tools_tags');var _0x4f3eba=squel['select']()[_0x2516('0x50')]('u.id')['field']('u.fullname')[_0x2516('0x50')](_0x2516('0x53'))[_0x2516('0x52')](_0x2516('0x54'),'ui')[_0x2516('0x55')]('users','u',_0x2516('0x56'));var _0x32b432=squel[_0x2516('0x57')]()['from'](_0x2516('0x58'),'i')[_0x2516('0x55')]('cm_contacts','c',_0x2516('0x59'))[_0x2516('0x55')](_0x2516('0x5a'),'o',_0x2516('0x5b'))[_0x2516('0x55')]('chat_websites','a','a.id\x20=\x20i.ChatWebsiteId')[_0x2516('0x55')]('chat_messages','me',_0x2516('0x5c'))['left_join'](_0x2516('0x5d'),'it',_0x2516('0x5e'))[_0x2516('0x55')](_0x2516('0x5f'),'t',_0x2516('0x60'));var _0x4751fd=squel[_0x2516('0x61')]();var _0xf9c375=[];var _0x424027=squel[_0x2516('0x61')]();var _0x3f2a6e;if(_0x582cb6['query'][_0x2516('0x62')]){_0x3f2a6e=as[_0x2516('0x63')](_0x582cb6[_0x2516('0x45')]['search']);var _0x26715c=_0x3f2a6e['sqlOperator'];for(var _0x435450=0x0;_0x435450<_0x3f2a6e[_0x2516('0x64')][_0x2516('0x49')];_0x435450++){var _0x505ccd=_0x3f2a6e['conditions'][_0x435450];var _0x5a51c6='i';var _0x388ec7=_[_0x2516('0x65')](_0x2f980d,[_0x2516('0x38'),_0x505ccd[_0x2516('0x50')]]);if(!_0x388ec7){switch(_0x505ccd['field']){case _0x2516('0x66'):if(_0x505ccd[_0x2516('0x67')]==0x1){_0x32b432[_0x2516('0x68')]('`'+_0x505ccd['field']+_0x2516('0x69'));}else{_0x32b432[_0x2516('0x68')]('`'+_0x505ccd[_0x2516('0x50')]+_0x2516('0x6a'));}break;case _0x2516('0x6b'):if(_0x505ccd[_0x2516('0x6c')]===_0x2516('0x6d')){if(_0x505ccd[_0x2516('0x67')][_0x2516('0x3c')]('\x20')[_0x2516('0x49')]>0x1){_0x4751fd[_0x26715c](_0x2516('0x6e'),qs[_0x2516('0x6f')](_0x505ccd[_0x2516('0x67')]),null);}else{var _0x47f211='%'+_0x505ccd[_0x2516('0x67')]+'%';_0x4751fd[_0x26715c](_0x2516('0x70'),_0x47f211,_0x47f211,_0x47f211);}}else{_0x388ec7=_[_0x2516('0x65')](_0x2f980d,[_0x2516('0x38'),_0x2516('0x71')]);_0x505ccd[_0x2516('0x50')]=_0x2516('0x71');_0x274420=as['buildExpression'](_0x5a51c6,_0x388ec7[_0x2516('0x42')],_0x505ccd);_0x4751fd[_0x26715c](_0x274420[_0x2516('0x72')],_0x274420[_0x2516('0x67')][_0x2516('0x73')],_0x274420[_0x2516('0x67')][_0x2516('0x36')]);}break;case'Tag':var _0x53b427=_0x505ccd['value'][_0x2516('0x3c')](',')[_0x2516('0x39')](function(_0x3f188d){return Number(_0x3f188d);});_0x53b427[_0x2516('0x3d')](function(_0x58730b){_0x424027['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x58730b+',%');});_0xf9c375=_[_0x2516('0x74')](_0xf9c375,_0x53b427);break;case'User':if(_0x505ccd[_0x2516('0x6c')]===_0x2516('0x6d')){_0x4751fd[_0x26715c]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x505ccd[_0x2516('0x67')]+'%',null);}else{_0x388ec7=_[_0x2516('0x65')](_0x2f980d,[_0x2516('0x38'),_0x2516('0x75')]);_0x505ccd[_0x2516('0x50')]=_0x2516('0x75');_0x274420=as[_0x2516('0x76')](_0x5a51c6,_0x388ec7[_0x2516('0x42')],_0x505ccd);_0x4751fd[_0x26715c](_0x274420[_0x2516('0x72')],_0x274420['value']['start'],_0x274420[_0x2516('0x67')][_0x2516('0x36')]);}break;case _0x2516('0x77'):_0x274420=as['buildExpression']('me',null,_0x505ccd);_0x4751fd[_0x26715c](_0x274420[_0x2516('0x72')],_0x274420['value'][_0x2516('0x73')],_0x274420[_0x2516('0x67')][_0x2516('0x36')]);break;}}else{var _0x274420=as[_0x2516('0x76')](_0x5a51c6,_0x388ec7[_0x2516('0x42')],_0x505ccd);_0x4751fd[_0x26715c](_0x274420[_0x2516('0x72')],_0x274420[_0x2516('0x67')][_0x2516('0x73')],_0x274420[_0x2516('0x67')]['end']);}}}else{var _0x4eac04=_(_0x582cb6[_0x2516('0x45')])['keys']()['map'](function(_0x12e768){return _[_0x2516('0x78')](_0x2f980d,[_0x2516('0x38'),_0x12e768])?_0x12e768:undefined;})[_0x2516('0x79')]()[_0x2516('0x67')]();if(!_[_0x2516('0x7a')](_0x4eac04)){_0x4eac04[_0x2516('0x3d')](function(_0x2081a8){if(_0x2081a8===_0x2516('0x7b')){_0x32b432['where'](_0x2516('0x7c'),[][_0x2516('0x7d')](_0x582cb6[_0x2516('0x45')][_0x2081a8]));}else if(_0x2081a8===_0x2516('0x7e')){var _0x5dca12=JSON[_0x2516('0x7f')](_0x582cb6[_0x2516('0x45')][_0x2081a8])[_0x2516('0x80')];var _0x2cb00e=JSON[_0x2516('0x7f')](_0x582cb6[_0x2516('0x45')][_0x2081a8])['$lte'];_0x32b432[_0x2516('0x4d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5dca12,_0x2cb00e);}else{if(_0x582cb6['query'][_0x2081a8]===_0x2516('0x81')){_0x32b432[_0x2516('0x4d')]('i.'+_0x2081a8+_0x2516('0x82'));}else{_0x32b432['where']('i.'+_0x2081a8+_0x2516('0x83'),_0x582cb6[_0x2516('0x45')][_0x2081a8]);}}});}if(_0x582cb6[_0x2516('0x45')][_0x2516('0x84')]){if(_0x582cb6['query'][_0x2516('0x84')]==0x1){_0x32b432[_0x2516('0x68')](_0x2516('0x85'));}else{_0x32b432[_0x2516('0x68')]('`unreadMessages`\x20>\x200');}}if(_0x582cb6[_0x2516('0x45')][_0x2516('0x86')]){_0xf9c375=_[_0x2516('0x87')](_0x582cb6['query'][_0x2516('0x86')])?_0x582cb6['query'][_0x2516('0x86')]:new Array(_0x582cb6[_0x2516('0x45')][_0x2516('0x86')]);_0xf9c375[_0x2516('0x3d')](function(_0x322df6){_0x424027['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x322df6+',%');});}if(_0x582cb6['query']['filter']){var _0x3d8389=_0x582cb6[_0x2516('0x45')]['filter'][_0x2516('0x88')]('\x5c','\x5c\x5c')[_0x2516('0x88')]('\x27\x27',_0x2516('0x89'));if(qs[_0x2516('0x8a')](_0x3d8389)){_0x4751fd['or'](_0x2516('0x8b'),_0x3d8389+'%');}else{_0x4751fd['or'](_0x2516('0x8c'),qs['getFullTextValue'](_0x3d8389))['or'](_0x2516('0x8d'),_0x3d8389+'%');}}}_0x32b432[_0x2516('0x4d')](_0x4751fd);_0x32b432[_0x2516('0x8e')]('i.id');var _0x51308d={'type':db['Sequelize'][_0x2516('0x8f')][_0x2516('0x90')],'raw':!![]};var _0x14d4db=_0x32b432[_0x2516('0x91')]();_0x14d4db['field']('i.id');_0x14d4db['field'](_0x2516('0x92'),_0x2516('0x66'));if(_0xe5bc76[_0x2516('0x93')]){_0xe5bc76[_0x2516('0x93')][_0x2516('0x3d')](function(_0x2ba6e4){_0x32b432[_0x2516('0x93')]('i.'+_0x2ba6e4[0x0],_0x2ba6e4[0x1]===_0x2516('0x94')?![]:!![]);});}if(!_['isEmpty'](_0xf9c375)){_0x32b432[_0x2516('0x68')](_0x424027);_0x14d4db[_0x2516('0x4d')](_0x2516('0x95'),_0xf9c375);}BPromise[_0x2516('0x96')]()[_0x2516('0x21')](function(){if(!_0x3f2a6e){if(_0x582cb6['query'][_0x2516('0x7b')]||_0x582cb6[_0x2516('0x45')]['journey'])return;_0x14d4db[_0x2516('0x4d')](_0x2516('0x97'));_0x32b432[_0x2516('0x4d')](_0x2516('0x97'));return;}return _0x582cb6[_0x2516('0x98')][_0x2516('0x99')]({'attributes':['id'],'raw':!![]})['then'](function(_0x165a2e){if(_[_0x2516('0x7a')](_0x165a2e)){_0x14d4db[_0x2516('0x4d')](_0x2516('0x9a'));_0x32b432[_0x2516('0x4d')](_0x2516('0x9a'));}else{_0x14d4db[_0x2516('0x4d')](_0x2516('0x7c'),_[_0x2516('0x39')](_0x165a2e,'id'));_0x32b432['where'](_0x2516('0x7c'),_['map'](_0x165a2e,'id'));}});})[_0x2516('0x21')](function(){db[_0x2516('0x9b')]['query'](_0x14d4db['toString'](),_0x51308d)[_0x2516('0x21')](function(_0x1d2e2f){_0x1447de[_0x2516('0x2f')]=_0x1d2e2f[_0x2516('0x49')];if(_0x1447de[_0x2516('0x2f')]===0x0)return[];return db[_0x2516('0x9b')][_0x2516('0x45')](_0xdeb59b[_0x2516('0x9c')](),_0x51308d)[_0x2516('0x21')](function(_0x36eab7){_0x41b716=_[_0x2516('0x9d')](_0x36eab7,'id');_0x51308d=_[_0x2516('0x9e')](_0x51308d,{'model':db[_0x2516('0x9f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x582cb6[_0x2516('0x45')][_0x2516('0x47')]){_0xe5bc76['attributes']['forEach'](function(_0xabb346){_0x32b432[_0x2516('0x50')]('i.'+_0xabb346);});}else{_0x32b432[_0x2516('0x50')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x2516('0x66'));_0x32b432[_0x2516('0x50')](_0x2516('0xa0'),_0x2516('0xa1'));_0x32b432[_0x2516('0x50')](_0x2516('0xa2'),'Account.mandatoryDisposition');_0x32b432[_0x2516('0x50')](_0x2516('0xa3'));_0x32b432[_0x2516('0x50')](_0x2516('0xa4'),_0x2516('0xa5'));_0x32b432[_0x2516('0x50')](_0x2516('0xa6'),_0x2516('0xa7'));_0x32b432[_0x2516('0x50')](_0x2516('0xa8'),_0x2516('0xa9'));_0x32b432[_0x2516('0x50')](_0x2516('0xaa'),_0x2516('0xab'));_0x32b432[_0x2516('0x50')](_0x2516('0xac'),'Contact.mobile');_0x32b432['field'](_0x2516('0xad'),_0x2516('0xae'));_0x32b432[_0x2516('0x50')](_0x2516('0xaf'),_0x2516('0xb0'));_0x32b432[_0x2516('0x50')](_0x2516('0xb1'),_0x2516('0xb2'));_0x32b432['field'](_0x2516('0xb3'),_0x2516('0x3a'));}_0x32b432[_0x2516('0x31')](_0xe5bc76['limit']);_0x32b432[_0x2516('0x30')](_0xe5bc76['offset']);return db[_0x2516('0x9b')]['query'](_0x32b432[_0x2516('0x9c')](),_0x51308d);})[_0x2516('0x21')](function(_0x5f037e){_0x4f3eba[_0x2516('0x4d')]('ui.ChatInteractionId\x20IN\x20?',_[_0x2516('0x39')](_0x5f037e,'id'));return db[_0x2516('0x9b')][_0x2516('0x45')](_0x4f3eba[_0x2516('0x9c')](),_0x51308d)[_0x2516('0x21')](function(_0x130058){var _0x3a8f28=_[_0x2516('0xb4')](_0x130058,_0x2516('0xb5'));var _0x5a6f3d=[];_0x5f037e[_0x2516('0x3d')](function(_0x23581f){_0x5a6f3d[_0x2516('0x3e')](updateChatInteraction(_0x23581f,_0x41b716,_0x3a8f28));});return BPromise[_0x2516('0xb6')](_0x5a6f3d);});});})['then'](function(_0x1c5c46){_0x1447de[_0x2516('0xb7')]=_0x1c5c46;return _0x1447de;})[_0x2516('0x21')](respondWithFilteredResult(_0x1a8d2d,_0xe5bc76));})[_0x2516('0x2b')](handleError(_0x1a8d2d,null));};exports[_0x2516('0xb8')]=function(_0x5ab495,_0x21e596){var _0x2e2dac={'raw':![],'where':{'id':_0x5ab495[_0x2516('0xb9')]['id']}},_0x39d344={};_0x39d344[_0x2516('0x44')]=_[_0x2516('0xba')](db['ChatInteraction'][_0x2516('0x40')]);_0x39d344['query']=_[_0x2516('0xba')](_0x5ab495['query']);_0x39d344['filters']=_[_0x2516('0x46')](_0x39d344[_0x2516('0x44')],_0x39d344[_0x2516('0x45')]);_0x2e2dac['attributes']=_[_0x2516('0x46')](_0x39d344[_0x2516('0x44')],qs['fields'](_0x5ab495[_0x2516('0x45')][_0x2516('0x47')]));_0x2e2dac['attributes']=_0x2e2dac['attributes'][_0x2516('0x49')]?_0x2e2dac[_0x2516('0x48')]:_0x39d344[_0x2516('0x44')];if(_0x5ab495[_0x2516('0x45')][_0x2516('0xbb')]){_0x2e2dac[_0x2516('0xbc')]=[{'all':!![]}];}_0x2e2dac=_['merge']({},_0x2e2dac,_0x5ab495[_0x2516('0xbd')]);return db[_0x2516('0x9f')][_0x2516('0x65')](_0x2e2dac)[_0x2516('0x21')](handleEntityNotFound(_0x21e596,null))['then'](respondWithResult(_0x21e596,null))[_0x2516('0x2b')](handleError(_0x21e596,null));};exports[_0x2516('0xbe')]=function(_0x1fc3e7,_0x33d66b){return db['ChatInteraction'][_0x2516('0xbe')](_0x1fc3e7[_0x2516('0x77')],{})[_0x2516('0x21')](respondWithResult(_0x33d66b,0xc9))['catch'](handleError(_0x33d66b,null));};exports[_0x2516('0x34')]=function(_0x1b817f,_0x182822){if(_0x1b817f[_0x2516('0x77')]['id']){delete _0x1b817f['body']['id'];}return db[_0x2516('0x9f')][_0x2516('0x65')]({'where':{'id':_0x1b817f[_0x2516('0xb9')]['id']}})[_0x2516('0x21')](handleEntityNotFound(_0x182822,null))[_0x2516('0x21')](saveUpdates(_0x1b817f[_0x2516('0x77')],null))['then'](respondWithResult(_0x182822,null))[_0x2516('0x2b')](handleError(_0x182822,null));};exports[_0x2516('0x35')]=function(_0x202298,_0x516d85){return db[_0x2516('0x9f')][_0x2516('0x65')]({'where':{'id':_0x202298['params']['id']}})['then'](handleEntityNotFound(_0x516d85,null))[_0x2516('0x21')](removeEntity(_0x516d85,null))[_0x2516('0x2b')](handleError(_0x516d85,null));};exports[_0x2516('0xbf')]=function(_0x1ab796,_0x112c76){return db[_0x2516('0x9f')][_0x2516('0xbf')]()['then'](respondWithResult(_0x112c76,null))[_0x2516('0x2b')](handleError(_0x112c76,null));};exports[_0x2516('0xc0')]=function(_0x1354d3,_0x2afcab){if(_0x1354d3[_0x2516('0x77')]['id']){delete _0x1354d3[_0x2516('0x77')]['id'];}return db[_0x2516('0x9f')][_0x2516('0x65')]({'where':{'id':_0x1354d3[_0x2516('0xb9')]['id']}})[_0x2516('0x21')](handleEntityNotFound(_0x2afcab,null))[_0x2516('0x21')](saveUpdates(_0x1354d3[_0x2516('0x77')],null))['then'](respondWithResult(_0x2afcab,null))[_0x2516('0x2b')](handleError(_0x2afcab,null));};exports[_0x2516('0xc1')]=function(_0x5d46cb,_0x3f680b,_0x5416ee){if(_0x5d46cb[_0x2516('0x77')]['id']){delete _0x5d46cb[_0x2516('0x77')]['id'];}return db[_0x2516('0x9f')]['find']({'where':{'id':_0x5d46cb[_0x2516('0xb9')]['id']}})[_0x2516('0x21')](function(_0x4e9f76){if(!_0x4e9f76){logger[_0x2516('0x28')]('abandonInteraction,\x20%s,\x20%s,\x20%s','abandon',0x194,_0x2516('0xc2'));_0x3f680b[_0x2516('0x2c')](0x194);}else{if(_0x4e9f76[_0x2516('0x75')]){throw new db['Sequelize'][(_0x2516('0x1e'))](_0x2516('0xc3'));}}return _0x4e9f76;})['then'](function(_0x543092){if(_0x543092){return _0x543092[_0x2516('0x34')]({'closed':_0x5d46cb[_0x2516('0x77')][_0x2516('0xc4')],'disposition':_0x5d46cb[_0x2516('0x77')][_0x2516('0xc5')]})[_0x2516('0x21')](function(_0x43ef7c){return _0x43ef7c;});}})[_0x2516('0x21')](function(_0x326a86){return respondWithRpcPromise('AbandonInteraction',_0x2516('0xc1'),_0x5d46cb[_0x2516('0x77')],client9004);})[_0x2516('0x21')](respondWithResult(_0x3f680b,null))[_0x2516('0x2b')](handleError(_0x3f680b,null));};exports[_0x2516('0xc6')]=function(_0x3d7ebd,_0x5dd88d,_0x29dbe6){_0x3d7ebd[_0x2516('0x77')][_0x2516('0x38')]=_0x3d7ebd[_0x2516('0xc7')][_0x2516('0xc8')];_0x3d7ebd[_0x2516('0x77')][_0x2516('0xc9')]=_0x3d7ebd[_0x2516('0xc7')][_0x2516('0xca')];_0x3d7ebd[_0x2516('0x77')][_0x2516('0x42')]=_0x3d7ebd[_0x2516('0xc7')][_0x2516('0xcb')];return db['Attachment'][_0x2516('0xbe')](_0x3d7ebd[_0x2516('0x77')])['then'](respondWithResult(_0x5dd88d,0xc9))['catch'](handleError(_0x5dd88d,null));};exports[_0x2516('0xcc')]=function(_0x1930b0,_0x2fb9c1,_0x429101){return db[_0x2516('0x9f')]['findOne']({'where':{'id':_0x1930b0[_0x2516('0xb9')]['id']},'raw':!![]})[_0x2516('0x21')](handleEntityNotFound(_0x2fb9c1,null))[_0x2516('0x21')](function(_0x109029){if(_0x109029){if(_0x109029['closed']){return _0x2fb9c1['status'](0x193)['json']({'status':0x193,'message':_0x2516('0xcd')});}return db[_0x2516('0xce')][_0x2516('0xcf')]({'where':{'id':_0x1930b0[_0x2516('0x45')]['attachId']},'raw':!![]})[_0x2516('0x21')](handleEntityNotFound(_0x2fb9c1,null));}})['then'](function(_0x182fc9){if(_0x182fc9){return _0x2fb9c1[_0x2516('0xd0')](path['join'](config[_0x2516('0xd1')],_0x2516('0xd2'),_0x182fc9[_0x2516('0xc9')]));}})[_0x2516('0x2b')](handleError(_0x2fb9c1,null));};exports[_0x2516('0xd3')]=function(_0x320029,_0xae5eab){var _0xa7ab36=null;var _0xe3bd00=null;var _0x3725eb=null;var _0x1d9d09=null;if(_0x320029[_0x2516('0x77')]['id']){delete _0x320029[_0x2516('0x77')]['id'];}if(_0x320029['body'][_0x2516('0xd4')]){_0x1d9d09=path[_0x2516('0xd5')](config[_0x2516('0xd1')],'server/files/chat/upload/',util[_0x2516('0xd6')](_0x2516('0xd7'),Date[_0x2516('0xd8')]()));_0x320029[_0x2516('0x77')][_0x2516('0xd9')]=_0x1d9d09;}return db[_0x2516('0x9f')][_0x2516('0x65')]({'where':{'id':_0x320029['params']['id']},'include':[{'model':db['ChatMessage'],'as':_0x2516('0xda'),'include':[{'model':db[_0x2516('0xdb')],'as':_0x2516('0xdb')}]}]})[_0x2516('0x21')](handleEntityNotFound(_0xae5eab,null))[_0x2516('0x21')](saveUpdates(_0x320029[_0x2516('0x77')],null))['then'](function(_0x5ae53a){if(_0x5ae53a){_0xa7ab36=_0x5ae53a;return db[_0x2516('0xdc')][_0x2516('0x65')]({'where':{'id':_0xa7ab36[_0x2516('0x7b')]}});}})[_0x2516('0x21')](function(_0x2f776d){if(_0x2f776d){_0x3725eb=_0x2f776d;return db['CmContact'][_0x2516('0x65')]({'where':{'id':_0xa7ab36[_0x2516('0x71')]}});}})[_0x2516('0x21')](function(_0x23b235){if(_0x23b235){_0xe3bd00=_0x23b235;if(_0x1d9d09){var _0x5296b8=null;for(var _0x1f0a18=0x1;_0x1f0a18<_0xa7ab36['Messages'][_0x2516('0x49')];++_0x1f0a18){_0x5296b8=_0xa7ab36['Messages'][_0x1f0a18];var _0x56aecc=_0x5296b8[_0x2516('0x75')]?util[_0x2516('0xd6')]('%s%d',_0x3725eb[_0x2516('0xdd')],_0x5296b8['UserId']):_0x2516('0xde');var _0xc2cd53=_0x320029['body'][_0x2516('0xdf')]||util[_0x2516('0xd6')]('%s%d','Visitor',_0x5296b8[_0x2516('0x71')]);switch(_0x3725eb[_0x2516('0xe0')]){case'website_alias':_0x56aecc=_0x5296b8[_0x2516('0x75')]?util[_0x2516('0xd6')](_0x2516('0xe1'),_0x3725eb[_0x2516('0xdd')],_0x5296b8[_0x2516('0x75')]):_0x2516('0xde');break;case _0x2516('0xe2'):_0x56aecc=_0x5296b8[_0x2516('0x75')]?_0x5296b8[_0x2516('0xdb')][_0x2516('0xe3')]||_0x5296b8['User']['fullname']:'System';break;case _0x2516('0xe4'):_0x56aecc=_0x5296b8[_0x2516('0x75')]?_0x5296b8['User'][_0x2516('0xe5')]:_0x2516('0xde');break;default:_0x56aecc=_0x5296b8[_0x2516('0x75')]?util['format'](_0x2516('0xe1'),_0x3725eb[_0x2516('0xdd')],_0x5296b8[_0x2516('0x75')]):_0x2516('0xde');}var _0x37d226=util[_0x2516('0xd6')](_0x2516('0xe6'),moment(_0x5296b8[_0x2516('0x7e')])[_0x2516('0xd6')]('MM/DD/YYYY\x20HH:mm:ss'),_0x5296b8[_0x2516('0xe7')]==='in'?_0xc2cd53:_0x56aecc,_0x5296b8[_0x2516('0x77')]);if(!_0x5296b8[_0x2516('0xe8')]){fs[_0x2516('0xe9')](_0x1d9d09,_0x37d226);}}return db[_0x2516('0xea')][_0x2516('0xcf')]({'where':{'service':!![]},'include':[{'model':db[_0x2516('0xeb')],'as':_0x2516('0xec'),'raw':!![]}]});}}})['then'](function(_0x551b13){if(_0x551b13&&_0x551b13[_0x2516('0xec')]&&_0x320029[_0x2516('0x77')]){var _0x623d00={'tls':{'rejectUnauthorized':![]}};if(_0x551b13[_0x2516('0xec')]['service']){_0x623d00[_0x2516('0xed')]=_0x551b13['Smtp'][_0x2516('0xed')];}else{_0x623d00['host']=_0x551b13[_0x2516('0xec')][_0x2516('0xee')];_0x623d00[_0x2516('0xef')]=_0x551b13[_0x2516('0xec')][_0x2516('0xef')];_0x623d00[_0x2516('0xf0')]=_0x551b13[_0x2516('0xec')][_0x2516('0xf0')];}if(_0x551b13[_0x2516('0xec')][_0x2516('0xf1')]){_0x623d00[_0x2516('0xf2')]={'user':_0x551b13['Smtp'][_0x2516('0x98')],'pass':_0x551b13[_0x2516('0xec')][_0x2516('0xf3')]};}return respondWithRpcPromise(_0x2516('0xf4'),'sendMail',{'account':_0x623d00,'message':{'from':util[_0x2516('0xd6')](_0x2516('0xf5'),_0x551b13[_0x2516('0x38')],_0x551b13[_0x2516('0xf6')]||_0x551b13['Smtp'][_0x2516('0x98')]),'to':_0x320029[_0x2516('0x77')][_0x2516('0xd4')],'subject':_0x2516('0xf7'),'text':util[_0x2516('0xd6')](_0x2516('0xf8'),_0x320029[_0x2516('0x77')][_0x2516('0xd4')]),'attachments':[{'path':_0x1d9d09}]}})[_0x2516('0x21')](function(){return _0xa7ab36;})[_0x2516('0x2b')](function(_0x326574){console[_0x2516('0x28')](_0x326574);});}else{return _0xa7ab36;}})[_0x2516('0x21')](respondWithStatusCode(_0xae5eab,0xc8))[_0x2516('0x2b')](handleError(_0xae5eab,null));};exports[_0x2516('0xf9')]=function(_0x38bd44,_0x56ae20,_0xeeea8b){return db[_0x2516('0xfa')]['find']({'where':{'id':_0x38bd44[_0x2516('0xb9')]['id']}})[_0x2516('0x21')](handleEntityNotFound(_0x56ae20,null))[_0x2516('0x21')](function(_0x45559b){if(_0x45559b){return _0x45559b[_0x2516('0xf9')](_0x38bd44[_0x2516('0x77')][_0x2516('0xfb')],_['omit'](_0x38bd44[_0x2516('0x77')],['ids','id'])||{});}})[_0x2516('0x21')](respondWithResult(_0x56ae20,null))[_0x2516('0x2b')](handleError(_0x56ae20,null));};exports['getMessages']=function(_0x119782,_0x2c631b,_0x7ba682){var _0x479f81={'raw':![],'where':{}};var _0x2aecab={};var _0x14eee7={'count':0x0,'rows':[]};return db[_0x2516('0x9f')][_0x2516('0xcf')]({'where':{'id':_0x119782[_0x2516('0xb9')]['id']}})[_0x2516('0x21')](handleEntityNotFound(_0x2c631b,null))[_0x2516('0x21')](function(_0x255292){if(_0x255292){_0x2aecab[_0x2516('0x44')]=_['keys'](db['ChatMessage'][_0x2516('0x40')]);_0x2aecab[_0x2516('0x45')]=_[_0x2516('0xba')](_0x119782[_0x2516('0x45')]);_0x2aecab[_0x2516('0x4f')]=_['intersection'](_0x2aecab[_0x2516('0x44')],_0x2aecab[_0x2516('0x45')]);_0x479f81[_0x2516('0x48')]=_['intersection'](_0x2aecab[_0x2516('0x44')],qs[_0x2516('0x47')](_0x119782[_0x2516('0x45')][_0x2516('0x47')]));_0x479f81['attributes']=_0x479f81['attributes']['length']?_0x479f81['attributes']:_0x2aecab[_0x2516('0x44')];if(!_0x119782['query'][_0x2516('0x4a')](_0x2516('0x4b'))){_0x479f81['limit']=qs[_0x2516('0x31')](_0x119782[_0x2516('0x45')][_0x2516('0x31')]);_0x479f81[_0x2516('0x30')]=qs[_0x2516('0x30')](_0x119782[_0x2516('0x45')][_0x2516('0x30')]);}_0x479f81['order']=qs[_0x2516('0x4c')](_0x119782[_0x2516('0x45')][_0x2516('0x4c')]);_0x479f81['where']=qs[_0x2516('0x4f')](_['pick'](_0x119782[_0x2516('0x45')],_0x2aecab[_0x2516('0x4f')]));_0x479f81[_0x2516('0x4d')]['ChatInteractionId']=_0x255292['id'];if(_0x119782[_0x2516('0x45')][_0x2516('0xfc')]){_0x479f81['where']=_[_0x2516('0x9e')](_0x479f81[_0x2516('0x4d')],{'$or':_[_0x2516('0x39')](_0x479f81[_0x2516('0x48')],function(_0x4cb6db){var _0x34b506={};_0x34b506[_0x4cb6db]={'$like':'%'+_0x119782['query'][_0x2516('0xfc')]+'%'};return _0x34b506;})});}if(_0x119782[_0x2516('0x45')][_0x2516('0x80')]){var _0x398825=_0x119782[_0x2516('0x45')][_0x2516('0x80')]['split'](',');var _0x3d7868={};_0x3d7868[_0x398825[0x0]]={'$gte':moment(_0x398825[0x1])['format'](_0x2516('0xfd'))};_0x479f81['where']=_[_0x2516('0x9e')](_0x479f81[_0x2516('0x4d')],_0x3d7868);}_0x479f81=_[_0x2516('0x9e')]({},_0x479f81,_0x119782[_0x2516('0xbd')]);return db[_0x2516('0xfa')][_0x2516('0x2f')]({'where':_0x479f81['where']})[_0x2516('0x21')](function(_0x2af7fc){_0x14eee7[_0x2516('0x2f')]=_0x2af7fc;if(_0x119782[_0x2516('0x45')]['includeAll']){_0x479f81[_0x2516('0xbc')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x479f81);})['then'](function(_0x48261d){_0x14eee7['rows']=_0x48261d;return _0x14eee7;});}})['then'](respondWithFilteredResult(_0x2c631b,_0x479f81))['catch'](handleError(_0x2c631b,null));};exports[_0x2516('0xfe')]=function(_0x9c82fc,_0x5a7bed,_0x12b31f){var _0x397d45={'where':{}},_0x197ba3={},_0x5c39c8={'count':0x0,'rows':[]};return db['ChatInteraction']['findOne']({'where':{'id':_0x9c82fc[_0x2516('0xb9')]['id']}})[_0x2516('0x21')](handleEntityNotFound(_0x5a7bed,null))['then'](function(_0x5cacc7){if(_0x5cacc7){_0x197ba3['model']=_['keys'](db[_0x2516('0xfa')][_0x2516('0x40')]);_0x197ba3['query']=_[_0x2516('0xba')](_0x9c82fc[_0x2516('0x45')]);_0x197ba3['filters']=_[_0x2516('0x46')](_0x197ba3['model'],_0x197ba3[_0x2516('0x45')]);_0x397d45['attributes']=_['intersection'](_0x197ba3[_0x2516('0x44')],qs[_0x2516('0x47')](_0x9c82fc['query'][_0x2516('0x47')]));_0x397d45['attributes']=_0x397d45[_0x2516('0x48')][_0x2516('0x49')]?_0x397d45[_0x2516('0x48')]:_0x197ba3[_0x2516('0x44')];if(!_0x9c82fc[_0x2516('0x45')]['hasOwnProperty'](_0x2516('0x4b'))){_0x397d45['limit']=qs[_0x2516('0x31')](_0x9c82fc[_0x2516('0x45')][_0x2516('0x31')]);_0x397d45[_0x2516('0x30')]=qs[_0x2516('0x30')](_0x9c82fc['query']['offset']);}_0x397d45[_0x2516('0x93')]=qs['sort'](_0x9c82fc[_0x2516('0x45')][_0x2516('0x4c')]);_0x397d45[_0x2516('0x4d')]=qs['filters'](_[_0x2516('0x4e')](_0x9c82fc[_0x2516('0x45')],_0x197ba3[_0x2516('0x4f')]));_0x397d45[_0x2516('0x4d')][_0x2516('0xb5')]=_0x5cacc7['id'];if(_0x9c82fc[_0x2516('0x45')][_0x2516('0xfc')]){_0x397d45[_0x2516('0x4d')]=_[_0x2516('0x9e')](_0x397d45[_0x2516('0x4d')],{'$or':_[_0x2516('0x39')](_0x397d45[_0x2516('0x48')],function(_0x4c1cd8){var _0x2db19d={};_0x2db19d[_0x4c1cd8]={'$like':'%'+_0x9c82fc['query'][_0x2516('0xfc')]+'%'};return _0x2db19d;})});}_0x397d45[_0x2516('0x4d')][_0x2516('0xe8')]=![];if(_0x9c82fc[_0x2516('0x45')]['id']){_0x397d45['where']['id']={'$gt':_0x9c82fc['query']['id']};}_0x397d45=_['merge']({},_0x397d45,_0x9c82fc[_0x2516('0xbd')]);return db[_0x2516('0xfa')][_0x2516('0x2f')]({'where':_0x397d45[_0x2516('0x4d')]})[_0x2516('0x21')](function(_0x14d76c){_0x5c39c8[_0x2516('0x2f')]=_0x14d76c;_0x397d45[_0x2516('0xbc')]=[];if(_0x9c82fc['query'][_0x2516('0xff')]){_0x397d45['include']['push']({'model':db['User'],'as':_0x2516('0xdb'),'attributes':['id',_0x2516('0xe5'),'alias']});}if(_0x9c82fc[_0x2516('0x45')][_0x2516('0xbb')]){_0x397d45[_0x2516('0xbc')]=[{'all':!![]}];}return db['ChatMessage'][_0x2516('0x100')](_0x397d45);})[_0x2516('0x21')](function(_0x5ef3e8){_0x5c39c8['rows']=_0x5ef3e8;return _0x5c39c8;});}})[_0x2516('0x21')](respondWithFilteredResult(_0x5a7bed,_0x397d45))[_0x2516('0x2b')](handleError(_0x5a7bed,null));};exports['addTags']=function(_0x5ee24b,_0x31b27f,_0x3a95b8){return db['ChatInteraction'][_0x2516('0x65')]({'where':{'id':_0x5ee24b[_0x2516('0xb9')]['id']}})[_0x2516('0x21')](handleEntityNotFound(_0x31b27f,null))['then'](function(_0x57457c){if(_0x57457c){return _0x57457c[_0x2516('0x101')](_0x5ee24b['body'][_0x2516('0xfb')],_[_0x2516('0x102')](_0x5ee24b[_0x2516('0x77')],['ids','id'])||{})[_0x2516('0x103')](function(){return db[_0x2516('0x104')][_0x2516('0x100')]({'attributes':['id',_0x2516('0x38'),_0x2516('0x51')],'where':{'id':_0x5ee24b[_0x2516('0x77')][_0x2516('0xfb')]}});})[_0x2516('0x21')](function(_0x398862){socket[_0x2516('0x105')](_0x2516('0x106'),{'id':Number(_0x5ee24b[_0x2516('0xb9')]['id']),'tags':_0x398862||[]});return{'id':Number(_0x5ee24b[_0x2516('0xb9')]['id']),'tags':_0x398862||[]};});}})['then'](respondWithResult(_0x31b27f,null))[_0x2516('0x2b')](handleError(_0x31b27f,null));};exports[_0x2516('0x107')]=function(_0x2eb41f,_0x59b4e6,_0x18f4e4){return db[_0x2516('0x9f')][_0x2516('0x65')]({'where':{'id':_0x2eb41f['params']['id']}})[_0x2516('0x21')](handleEntityNotFound(_0x59b4e6,null))['then'](function(_0x4ac666){if(_0x4ac666){return _0x4ac666[_0x2516('0x107')](_0x2eb41f[_0x2516('0x45')]['ids']);}})[_0x2516('0x21')](respondWithStatusCode(_0x59b4e6,null))[_0x2516('0x2b')](handleError(_0x59b4e6,null));};exports[_0x2516('0xd0')]=function(_0x1d52ed,_0x543ac8){var _0x116f67=moment()['unix']()[_0x2516('0x9c')]();var _0x12a4fc=path[_0x2516('0xd5')](config[_0x2516('0xd1')],_0x2516('0x108'),_0x2516('0x109'),_0x2516('0x10a'));var _0x58bffa=path[_0x2516('0xd5')](config[_0x2516('0xd1')],_0x2516('0x108'),_0x2516('0x109'),'attachments');var _0x2046b9=path[_0x2516('0xd5')](_0x12a4fc,_0x116f67);var _0x2ac70e=util['format'](_0x2516('0x10b'),_0x1d52ed[_0x2516('0xb9')]['id'],_0x116f67);var _0x5696dd=path[_0x2516('0xd5')](_0x12a4fc,_0x2ac70e);var _0x2d6d06=[];_0x2d6d06[_0x2516('0x3e')]({'model':db[_0x2516('0xdb')],'as':_0x2516('0xdb'),'attributes':['id',_0x2516('0xe5')],'raw':!![]});_0x2d6d06[_0x2516('0x3e')]({'model':db['CmContact'],'as':_0x2516('0x6b'),'attributes':['id','firstName',_0x2516('0x10c')],'raw':!![]});if(_0x1d52ed[_0x2516('0x45')]['attachments']){_0x2d6d06[_0x2516('0x3e')]({'model':db[_0x2516('0xce')],'as':_0x2516('0xce'),'raw':!![]});}var _0x4bd666=[{'model':db[_0x2516('0xfa')],'as':_0x2516('0xda'),'attributes':['id',_0x2516('0x77'),_0x2516('0x7e'),_0x2516('0xe7'),'secret',_0x2516('0x84')],'include':_0x2d6d06}];_0x4bd666[_0x2516('0x3e')]({'model':db[_0x2516('0xdc')],'as':_0x2516('0x10d'),'attributes':['id',_0x2516('0x38')]});_0x4bd666['push']({'model':db[_0x2516('0xdb')],'as':_0x2516('0x10e'),'attributes':['id',_0x2516('0xe5')]});return db[_0x2516('0x9f')][_0x2516('0x65')]({'where':{'id':_0x1d52ed[_0x2516('0xb9')]['id']},'include':_0x4bd666})[_0x2516('0x21')](handleEntityNotFound(_0x543ac8,null))[_0x2516('0x21')](function(_0x184b8e){if(_0x184b8e){var _0x2988c5=_0x184b8e[_0x2516('0x10f')]({'plain':!![]});fs[_0x2516('0x110')](_0x2046b9);var _0x3f1b2b={'format':'A4','border':'10px','header':{'height':_0x2516('0x111'),'contents':{'first':_0x2516('0x112')}},'footer':{'height':_0x2516('0x113'),'contents':{'default':util[_0x2516('0xd6')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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[_0x2516('0xd6')](_0x2516('0x114'),_0x2516('0x115'),_0x2988c5['id']),moment()['format']('YYYY-MM-DD')['toString']())}}};var _0x5a3662={'channel':'Chat','account':_0x2988c5[_0x2516('0x10d')]['name'],'agent':_0x2988c5['Owner']?_0x2988c5[_0x2516('0x10e')][_0x2516('0xe5')]:_0x2516('0x116'),'createdAt':moment(_0x2988c5[_0x2516('0x7e')])['format'](_0x2516('0xfd'))[_0x2516('0x9c')](),'closedAt':_0x2988c5[_0x2516('0xc4')]?moment(_0x2988c5[_0x2516('0x117')])[_0x2516('0xd6')](_0x2516('0xfd'))[_0x2516('0x9c')]():'','disposition':_0x2988c5[_0x2516('0xc5')],'chatInfo':{'browser':_0x2988c5[_0x2516('0x118')],'os':_0x2988c5[_0x2516('0x119')],'referer':_0x2988c5[_0x2516('0x11a')],'customerIp':_0x2988c5[_0x2516('0x11b')],'customerPort':_0x2988c5['customerPort']?_0x2988c5[_0x2516('0x11c')]:_0x2516('0x116')},'messages':_(_0x2988c5['Messages'])[_0x2516('0x11d')]()['filter']({'secret':![]})[_0x2516('0x39')](function(_0x2687a7){if(_0x2687a7[_0x2516('0xce')]){var _0x576b57=path[_0x2516('0xd5')](_0x58bffa,_0x2687a7[_0x2516('0xce')]['basename']);if(fs[_0x2516('0x11e')](_0x576b57)){fs[_0x2516('0x11f')](_0x576b57)['pipe'](fs['createWriteStream'](path[_0x2516('0xd5')](_0x2046b9,_0x2687a7[_0x2516('0xce')][_0x2516('0xc9')])));}}return{'date':moment(_0x2687a7['createdAt'])[_0x2516('0xd6')](_0x2516('0xfd'))[_0x2516('0x9c')](),'sender':_0x2687a7['direction']===_0x2516('0x120')?_0x2687a7[_0x2516('0xdb')]?_0x2687a7['User'][_0x2516('0xe5')]:_0x2516('0xde'):_0x2687a7[_0x2516('0x6b')][_0x2516('0x121')]+(_0x2687a7[_0x2516('0x6b')]['lastName']?'\x20'+_0x2687a7[_0x2516('0x6b')][_0x2516('0x10c')]:''),'body':_0x2687a7[_0x2516('0xce')]?_0x2687a7[_0x2516('0xce')][_0x2516('0xc9')]:_0x2687a7[_0x2516('0x77')],'direction':_0x2687a7[_0x2516('0xe7')]==='out'?'A':'C','secret':_0x2687a7[_0x2516('0xe8')],'read':_0x2687a7[_0x2516('0x84')],'attachment':_0x2687a7[_0x2516('0xce')]};})[_0x2516('0x67')]()};return ejs[_0x2516('0x122')](path[_0x2516('0xd5')](config[_0x2516('0xd1')],_0x2516('0x108'),_0x2516('0x123'),_0x2516('0x124')),{'interaction':_0x5a3662})['then'](function(_0x1af7be){return new BPromise(function(_0x47fc2b,_0x160e97){pdf[_0x2516('0xbe')](_0x1af7be,_0x3f1b2b)[_0x2516('0x125')](path[_0x2516('0xd5')](_0x2046b9,_0x2516('0x126')+_0x2988c5['id']+'-'+_0x116f67+_0x2516('0x127')),function(_0x12b004,_0x2aff77){if(_0x12b004)return _0x160e97(_0x12b004);_0x47fc2b(_0x2aff77);});});})['then'](function(){return new BPromise(function(_0x24c961,_0x591e5d){zipdir(_0x2046b9,{'saveTo':_0x5696dd},function(_0x4159c4,_0x278f4a){if(_0x4159c4)return _0x591e5d(_0x4159c4);return _0x24c961(_0x278f4a);});})[_0x2516('0x21')](function(){return new BPromise(function(_0x3a1362,_0x2e273b){rimraf(_0x2046b9,function(_0x1b4f5c){if(_0x1b4f5c)_0x2e273b(_0x1b4f5c);return _0x3a1362();});});})[_0x2516('0x21')](function(){return _0x543ac8['download'](_0x5696dd,_0x2ac70e,function(_0x351d23){if(_0x351d23){console[_0x2516('0x128')]('err',_0x351d23);}else{fs['unlinkSync'](_0x5696dd);}});});});}else{return _0x543ac8[_0x2516('0x2c')](0xc8);}})[_0x2516('0x2b')](handleError(_0x543ac8,null));}; \ No newline at end of file +var _0x55ca=['downloadInteraction.html','toFile','transcript-','.pdf','log','err','html-pdf','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','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','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','destroy','end','name','send','map','forEach','Tags','push','TagIds','index','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','select','field','color','tools_tags','u.id','from','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20>\x200','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','i.ChatWebsiteId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','a.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.fax','o.fullname','Owner.fullname','o.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','all','show','params','options','create','ChatInteraction','update','describe','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','originalname','mimetype','Attachment','attachmentDownload','findOne','attachId','download','join','root','server/files/attachments/','basename','close','server/files/chat/upload/','transcript-%s.txt','now','ChatWebsite','Messages','%s%d','System','format','Visitor','agentIdentifier','website_alias','agent_alias','alias','fullname','[%s]\x20%s:\x20%s\x0a','direction','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','mailTranscript','addMessage','ChatMessage','ids','omit','getMessages','pick','ChatInteractionId','include','findAll','getMyMessages','includeAgent','includeAll','rows','setTags','spread','emit','chatInteractionTags:save','removeTags','server','files','tmp','Contact','firstName','attachments','Account','Owner','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','%s\x20#%d','Chat','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','osName','customerIp','customerPort','tail','createReadStream','pipe','createWriteStream','out','lastName','renderFile'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x55ca,0x126));var _0xa55c=function(_0x339eaa,_0xbc2f72){_0x339eaa=_0x339eaa-0x0;var _0x4985b6=_0x55ca[_0x339eaa];return _0x4985b6;};'use strict';var pdf=require(_0xa55c('0x0'));var emlformat=require(_0xa55c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa55c('0x2'));var moment=require(_0xa55c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa55c('0x4'));var util=require(_0xa55c('0x5'));var path=require(_0xa55c('0x6'));var sox=require(_0xa55c('0x7'));var csv=require(_0xa55c('0x8'));var ejs=require(_0xa55c('0x9'));var fs=require('fs');var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x8'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var db=require(_0xa55c('0x16'))['db'];config[_0xa55c('0x17')]=_['defaults'](config['redis'],{'host':_0xa55c('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInteraction.socket')[_0xa55c('0x19')](socket);var jayson=require(_0xa55c('0x1a'));var client=jayson[_0xa55c('0x1b')][_0xa55c('0x1c')]({'port':0x232b});var client9004=jayson[_0xa55c('0x1b')][_0xa55c('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x4e0b2f,_0x3ccf65,_0x3dcf4f){if(_0x3dcf4f){var _0x25934f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x25934f[_0xa55c('0x1d')](_0x3ccf65)){return _0x4e0b2f;}else{throw new db[(_0xa55c('0x1e'))][(_0xa55c('0x1f'))](_0xa55c('0x20'));}}else{return _0x4e0b2f;}}function respondWithRpcPromise(_0x2d09d8,_0x24783b,_0x4cee3c,_0x3d4c9e){return new BPromise(function(_0x104a99,_0x461284){var _0x358b61=_0x3d4c9e||client;return _0x358b61[_0xa55c('0x21')](_0x2d09d8,_0x4cee3c)[_0xa55c('0x22')](function(_0x4c0daf){logger['info'](_0xa55c('0x23'),_0x24783b,_0xa55c('0x24'));logger[_0xa55c('0x25')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x24783b,_0xa55c('0x24'),JSON[_0xa55c('0x26')](_0x4c0daf));if(_0x4c0daf['error']){if(_0x4c0daf[_0xa55c('0x27')][_0xa55c('0x28')]===0x1f4){logger[_0xa55c('0x27')](_0xa55c('0x23'),_0x24783b,_0x4c0daf[_0xa55c('0x27')]['message']);return _0x461284(_0x4c0daf[_0xa55c('0x27')]['message']);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x24783b,_0x4c0daf[_0xa55c('0x27')]['message']);return _0x104a99(_0x4c0daf[_0xa55c('0x27')][_0xa55c('0x29')]);}else{logger[_0xa55c('0x2a')](_0xa55c('0x23'),_0x24783b,_0xa55c('0x24'));_0x104a99(_0x4c0daf[_0xa55c('0x2b')][_0xa55c('0x29')]);}})[_0xa55c('0x2c')](function(_0x192df2){logger[_0xa55c('0x27')](_0xa55c('0x23'),_0x24783b,_0x192df2);_0x461284(_0x192df2);});});}function respondWithStatusCode(_0x57f271,_0x430d55){_0x430d55=_0x430d55||0xcc;return function(_0x28814f){if(_0x28814f){return _0x57f271[_0xa55c('0x2d')](_0x430d55);}return _0x57f271[_0xa55c('0x2e')](_0x430d55)['end']();};}function respondWithResult(_0x1377b0,_0x22f6b6){_0x22f6b6=_0x22f6b6||0xc8;return function(_0x1b8388){if(_0x1b8388){return _0x1377b0[_0xa55c('0x2e')](_0x22f6b6)[_0xa55c('0x2f')](_0x1b8388);}};}function respondWithFilteredResult(_0x3c3cb5,_0x52d37f){return function(_0x23e698){if(_0x23e698){var _0x490b7d=_0x23e698[_0xa55c('0x30')],_0x35c9c2=_0x52d37f['offset'],_0x1d730b=_0x52d37f[_0xa55c('0x31')]+_0x52d37f[_0xa55c('0x32')],_0x1cc53e;if(_0x1d730b>=_0x490b7d){_0x1d730b=_0x490b7d;_0x1cc53e=0xc8;}else{_0x1cc53e=0xce;}_0x3c3cb5[_0xa55c('0x2e')](_0x1cc53e);return _0x3c3cb5[_0xa55c('0x33')](_0xa55c('0x34'),_0x35c9c2+'-'+_0x1d730b+'/'+_0x490b7d)[_0xa55c('0x2f')](_0x23e698);}return null;};}function patchUpdates(_0x29748a){return function(_0x24d44d){try{jsonpatch[_0xa55c('0x35')](_0x24d44d,_0x29748a,!![]);}catch(_0xcbaf2e){return BPromise[_0xa55c('0x36')](_0xcbaf2e);}return _0x24d44d['save']();};}function saveUpdates(_0x54ca97,_0x4146f3){return function(_0x19733e){if(_0x19733e){return _0x19733e['update'](_0x54ca97)[_0xa55c('0x22')](function(_0x2f0110){return _0x2f0110;});}return null;};}function removeEntity(_0x2e9623,_0x1839ac){return function(_0x30d4f8){if(_0x30d4f8){return _0x30d4f8[_0xa55c('0x37')]()[_0xa55c('0x22')](function(){_0x2e9623[_0xa55c('0x2e')](0xcc)[_0xa55c('0x38')]();});}};}function handleEntityNotFound(_0x53590c,_0x5f3e99){return function(_0x4b23d3){if(!_0x4b23d3){_0x53590c[_0xa55c('0x2d')](0x194);}return _0x4b23d3;};}function handleError(_0x18e00e,_0x2bb4f0){_0x2bb4f0=_0x2bb4f0||0x1f4;return function(_0x5802e4){logger[_0xa55c('0x27')](_0x5802e4['stack']);if(_0x5802e4[_0xa55c('0x39')]){delete _0x5802e4['name'];}_0x18e00e[_0xa55c('0x2e')](_0x2bb4f0)[_0xa55c('0x3a')](_0x5802e4);};}function getInteractionUsers(_0x3c0ec1,_0x4d3eb5){return new BPromise(function(_0x7c4a47,_0x30f23b){try{if(_0x4d3eb5[_0x3c0ec1['id']]){_0x3c0ec1['Users']=_[_0xa55c('0x3b')](_0x4d3eb5[_0x3c0ec1['id']],function(_0x194e78){return{'id':_0x194e78['id'],'fullname':_0x194e78['fullname']};});}}catch(_0x529ff8){_0x30f23b(_0x529ff8);}_0x7c4a47(_0x3c0ec1);});}function getInteractionTags(_0x235f6b,_0x5d3960){return new BPromise(function(_0x1e75dc,_0x284bcf){try{if(_0x235f6b['TagIds']){_0x235f6b['Tags']=[];_0x235f6b['TagIds']['split'](',')[_0xa55c('0x3c')](function(_0x45bd15){_0x235f6b[_0xa55c('0x3d')][_0xa55c('0x3e')](_0x5d3960[_0x45bd15]);});}delete _0x235f6b[_0xa55c('0x3f')];}catch(_0x56d17c){_0x284bcf(_0x56d17c);}_0x1e75dc(_0x235f6b);});}function updateChatInteraction(_0x3d52d8,_0x7cc363,_0x77d623){return new BPromise(function(_0x317f6b,_0x43bac0){return getInteractionUsers(_0x3d52d8,_0x77d623)[_0xa55c('0x22')](function(_0x554620){return getInteractionTags(_0x554620,_0x7cc363);})[_0xa55c('0x22')](function(_0x5ee63d){_0x317f6b(_0x5ee63d);})['catch'](function(_0x404e7f){_0x43bac0(_0x404e7f);});});}exports[_0xa55c('0x40')]=function(_0x496920,_0x2bd98b){var _0x508bd3={},_0x5f25f7={},_0x2f8449={'count':0x0,'rows':[]};var _0x3fea03=_[_0xa55c('0x3b')](db['ChatInteraction'][_0xa55c('0x41')],function(_0xd5a006){return{'name':_0xd5a006['fieldName'],'type':_0xd5a006[_0xa55c('0x42')]['key']};});_0x5f25f7[_0xa55c('0x43')]=_[_0xa55c('0x3b')](_0x3fea03,'name');_0x5f25f7[_0xa55c('0x44')]=_[_0xa55c('0x45')](_0x496920['query']);_0x5f25f7[_0xa55c('0x46')]=_[_0xa55c('0x47')](_0x5f25f7[_0xa55c('0x43')],_0x5f25f7['query']);_0x508bd3[_0xa55c('0x48')]=_['intersection'](_0x5f25f7[_0xa55c('0x43')],qs[_0xa55c('0x49')](_0x496920[_0xa55c('0x44')]['fields']));_0x508bd3[_0xa55c('0x48')]=_0x508bd3[_0xa55c('0x48')]['length']?_0x508bd3[_0xa55c('0x48')]:_0x5f25f7[_0xa55c('0x43')];if(!_0x496920['query'][_0xa55c('0x4a')](_0xa55c('0x4b'))){_0x508bd3['limit']=qs[_0xa55c('0x32')](_0x496920[_0xa55c('0x44')][_0xa55c('0x32')]);_0x508bd3[_0xa55c('0x31')]=qs['offset'](_0x496920[_0xa55c('0x44')]['offset']);}_0x508bd3[_0xa55c('0x4c')]=qs[_0xa55c('0x4d')](_0x496920[_0xa55c('0x44')]['sort']);_0x508bd3[_0xa55c('0x4e')]=qs[_0xa55c('0x46')](_['pick'](_0x496920[_0xa55c('0x44')],_0x5f25f7[_0xa55c('0x46')]));var _0x3822b7=[];var _0xcd78c5=squel[_0xa55c('0x4f')]()[_0xa55c('0x50')]('id')[_0xa55c('0x50')](_0xa55c('0x39'))[_0xa55c('0x50')](_0xa55c('0x51'))['from'](_0xa55c('0x52'));var _0x46e27d=squel[_0xa55c('0x4f')]()['field'](_0xa55c('0x53'))[_0xa55c('0x50')]('u.fullname')[_0xa55c('0x50')]('ui.ChatInteractionId')[_0xa55c('0x54')](_0xa55c('0x55'),'ui')[_0xa55c('0x56')](_0xa55c('0x57'),'u',_0xa55c('0x58'));var _0x5b1cf3=squel[_0xa55c('0x4f')]()[_0xa55c('0x54')]('chat_interactions','i')[_0xa55c('0x56')](_0xa55c('0x59'),'c',_0xa55c('0x5a'))[_0xa55c('0x56')]('users','o','o.id\x20=\x20i.UserId')[_0xa55c('0x56')](_0xa55c('0x5b'),'a',_0xa55c('0x5c'))[_0xa55c('0x56')]('chat_messages','me',_0xa55c('0x5d'))['left_join'](_0xa55c('0x5e'),'it',_0xa55c('0x5f'))[_0xa55c('0x56')](_0xa55c('0x52'),'t',_0xa55c('0x60'));var _0x53b2f7=squel[_0xa55c('0x61')]();var _0x54f776=[];var _0x23f67f=squel[_0xa55c('0x61')]();var _0x2cfe08;if(_0x496920[_0xa55c('0x44')][_0xa55c('0x62')]){_0x2cfe08=as[_0xa55c('0x63')](_0x496920[_0xa55c('0x44')]['search']);var _0x450567=_0x2cfe08[_0xa55c('0x64')];for(var _0x2f2d21=0x0;_0x2f2d21<_0x2cfe08[_0xa55c('0x65')][_0xa55c('0x66')];_0x2f2d21++){var _0x5ba2b0=_0x2cfe08[_0xa55c('0x65')][_0x2f2d21];var _0x3cd40d='i';var _0x28bac4=_[_0xa55c('0x67')](_0x3fea03,[_0xa55c('0x39'),_0x5ba2b0['field']]);if(!_0x28bac4){switch(_0x5ba2b0[_0xa55c('0x50')]){case _0xa55c('0x68'):if(_0x5ba2b0[_0xa55c('0x69')]==0x1){_0x5b1cf3[_0xa55c('0x6a')]('`'+_0x5ba2b0[_0xa55c('0x50')]+'`\x20=\x200');}else{_0x5b1cf3[_0xa55c('0x6a')]('`'+_0x5ba2b0['field']+_0xa55c('0x6b'));}break;case'Contact':if(_0x5ba2b0[_0xa55c('0x6c')]==='$substring'){if(_0x5ba2b0[_0xa55c('0x69')][_0xa55c('0x6d')]('\x20')[_0xa55c('0x66')]>0x1){_0x53b2f7[_0x450567](_0xa55c('0x6e'),qs[_0xa55c('0x6f')](_0x5ba2b0[_0xa55c('0x69')]),null);}else{var _0xafaf8c='%'+_0x5ba2b0[_0xa55c('0x69')]+'%';_0x53b2f7[_0x450567](_0xa55c('0x70'),_0xafaf8c,_0xafaf8c,_0xafaf8c);}}else{_0x28bac4=_[_0xa55c('0x67')](_0x3fea03,['name',_0xa55c('0x71')]);_0x5ba2b0[_0xa55c('0x50')]='ContactId';_0x42529f=as[_0xa55c('0x72')](_0x3cd40d,_0x28bac4[_0xa55c('0x42')],_0x5ba2b0);_0x53b2f7[_0x450567](_0x42529f[_0xa55c('0x73')],_0x42529f[_0xa55c('0x69')][_0xa55c('0x74')],_0x42529f[_0xa55c('0x69')][_0xa55c('0x38')]);}break;case _0xa55c('0x75'):var _0x47de0a=_0x5ba2b0[_0xa55c('0x69')][_0xa55c('0x6d')](',')[_0xa55c('0x3b')](function(_0xd309a9){return Number(_0xd309a9);});_0x47de0a[_0xa55c('0x3c')](function(_0x1bcb40){_0x23f67f['or'](_0xa55c('0x76'),'%,'+_0x1bcb40+',%');});_0x54f776=_[_0xa55c('0x77')](_0x54f776,_0x47de0a);break;case _0xa55c('0x78'):if(_0x5ba2b0['operator']===_0xa55c('0x79')){_0x53b2f7[_0x450567](_0xa55c('0x7a'),'%'+_0x5ba2b0[_0xa55c('0x69')]+'%',null);}else{_0x28bac4=_[_0xa55c('0x67')](_0x3fea03,[_0xa55c('0x39'),_0xa55c('0x7b')]);_0x5ba2b0[_0xa55c('0x50')]=_0xa55c('0x7b');_0x42529f=as[_0xa55c('0x72')](_0x3cd40d,_0x28bac4[_0xa55c('0x42')],_0x5ba2b0);_0x53b2f7[_0x450567](_0x42529f[_0xa55c('0x73')],_0x42529f['value'][_0xa55c('0x74')],_0x42529f['value'][_0xa55c('0x38')]);}break;case _0xa55c('0x7c'):_0x42529f=as[_0xa55c('0x72')]('me',null,_0x5ba2b0);_0x53b2f7[_0x450567](_0x42529f['text'],_0x42529f['value'][_0xa55c('0x74')],_0x42529f[_0xa55c('0x69')][_0xa55c('0x38')]);break;}}else{var _0x42529f=as['buildExpression'](_0x3cd40d,_0x28bac4[_0xa55c('0x42')],_0x5ba2b0);_0x53b2f7[_0x450567](_0x42529f[_0xa55c('0x73')],_0x42529f[_0xa55c('0x69')][_0xa55c('0x74')],_0x42529f[_0xa55c('0x69')]['end']);}}}else{var _0x4b090c=_(_0x496920[_0xa55c('0x44')])[_0xa55c('0x45')]()[_0xa55c('0x3b')](function(_0x36ee32){return _[_0xa55c('0x7d')](_0x3fea03,['name',_0x36ee32])?_0x36ee32:undefined;})[_0xa55c('0x7e')]()[_0xa55c('0x69')]();if(!_['isEmpty'](_0x4b090c)){_0x4b090c[_0xa55c('0x3c')](function(_0x1ab28b){if(_0x1ab28b===_0xa55c('0x7f')){_0x5b1cf3['where'](_0xa55c('0x80'),[][_0xa55c('0x81')](_0x496920[_0xa55c('0x44')][_0x1ab28b]));}else if(_0x1ab28b===_0xa55c('0x82')){var _0x232143=JSON['parse'](_0x496920[_0xa55c('0x44')][_0x1ab28b])[_0xa55c('0x83')];var _0x4bf233=JSON['parse'](_0x496920[_0xa55c('0x44')][_0x1ab28b])['$lte'];_0x5b1cf3[_0xa55c('0x4e')](_0xa55c('0x84'),_0x232143,_0x4bf233);}else{if(_0x496920[_0xa55c('0x44')][_0x1ab28b]===_0xa55c('0x85')){_0x5b1cf3[_0xa55c('0x4e')]('i.'+_0x1ab28b+_0xa55c('0x86'));}else{_0x5b1cf3[_0xa55c('0x4e')]('i.'+_0x1ab28b+_0xa55c('0x87'),_0x496920[_0xa55c('0x44')][_0x1ab28b]);}}});}if(_0x496920['query'][_0xa55c('0x88')]){if(_0x496920[_0xa55c('0x44')][_0xa55c('0x88')]==0x1){_0x5b1cf3[_0xa55c('0x6a')]('`unreadMessages`\x20=\x200');}else{_0x5b1cf3[_0xa55c('0x6a')](_0xa55c('0x89'));}}if(_0x496920[_0xa55c('0x44')][_0xa55c('0x8a')]){_0x54f776=_['isArray'](_0x496920['query'][_0xa55c('0x8a')])?_0x496920[_0xa55c('0x44')][_0xa55c('0x8a')]:new Array(_0x496920[_0xa55c('0x44')]['tag']);_0x54f776['forEach'](function(_0x40663){_0x23f67f['or'](_0xa55c('0x76'),'%,'+_0x40663+',%');});}if(_0x496920[_0xa55c('0x44')][_0xa55c('0x8b')]){var _0x2e90a6=_0x496920[_0xa55c('0x44')][_0xa55c('0x8b')]['replace']('\x5c','\x5c\x5c')[_0xa55c('0x8c')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0xa55c('0x8d')](_0x2e90a6)){_0x53b2f7['or']('i.id\x20LIKE\x20?',_0x2e90a6+'%');}else{_0x53b2f7['or'](_0xa55c('0x8e'),qs[_0xa55c('0x6f')](_0x2e90a6))['or'](_0xa55c('0x8f'),_0x2e90a6+'%');}}}_0x5b1cf3[_0xa55c('0x4e')](_0x53b2f7);_0x5b1cf3[_0xa55c('0x90')](_0xa55c('0x91'));var _0x1ea5b6={'type':db[_0xa55c('0x1e')]['QueryTypes']['SELECT'],'raw':!![]};var _0x14cb74=_0x5b1cf3[_0xa55c('0x92')]();_0x14cb74[_0xa55c('0x50')](_0xa55c('0x91'));_0x14cb74[_0xa55c('0x50')](_0xa55c('0x93'),'unreadMessages');if(_0x508bd3[_0xa55c('0x4c')]){_0x508bd3[_0xa55c('0x4c')][_0xa55c('0x3c')](function(_0x3b117e){_0x5b1cf3[_0xa55c('0x4c')]('i.'+_0x3b117e[0x0],_0x3b117e[0x1]===_0xa55c('0x94')?![]:!![]);});}if(!_[_0xa55c('0x95')](_0x54f776)){_0x5b1cf3[_0xa55c('0x6a')](_0x23f67f);_0x14cb74['where'](_0xa55c('0x96'),_0x54f776);}BPromise[_0xa55c('0x97')]()[_0xa55c('0x22')](function(){if(!_0x2cfe08){if(_0x496920[_0xa55c('0x44')][_0xa55c('0x7f')]||_0x496920['query'][_0xa55c('0x98')])return;_0x14cb74[_0xa55c('0x4e')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x5b1cf3['where'](_0xa55c('0x99'));return;}return _0x496920[_0xa55c('0x9a')]['getChatWebsites']({'attributes':['id'],'raw':!![]})['then'](function(_0x579726){if(_['isEmpty'](_0x579726)){_0x14cb74[_0xa55c('0x4e')](_0xa55c('0x9b'));_0x5b1cf3[_0xa55c('0x4e')](_0xa55c('0x9b'));}else{_0x14cb74[_0xa55c('0x4e')](_0xa55c('0x80'),_['map'](_0x579726,'id'));_0x5b1cf3[_0xa55c('0x4e')](_0xa55c('0x80'),_[_0xa55c('0x3b')](_0x579726,'id'));}});})[_0xa55c('0x22')](function(){db['sequelize'][_0xa55c('0x44')](_0x14cb74[_0xa55c('0x9c')](),_0x1ea5b6)[_0xa55c('0x22')](function(_0x4cc104){_0x2f8449[_0xa55c('0x30')]=_0x4cc104['length'];if(_0x2f8449['count']===0x0)return[];return db[_0xa55c('0x9d')][_0xa55c('0x44')](_0xcd78c5[_0xa55c('0x9c')](),_0x1ea5b6)[_0xa55c('0x22')](function(_0x2544c1){_0x3822b7=_[_0xa55c('0x9e')](_0x2544c1,'id');_0x1ea5b6=_[_0xa55c('0x9f')](_0x1ea5b6,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x496920['query'][_0xa55c('0x49')]){_0x508bd3[_0xa55c('0x48')][_0xa55c('0x3c')](function(_0x1f4bc8){_0x5b1cf3[_0xa55c('0x50')]('i.'+_0x1f4bc8);});}else{_0x5b1cf3[_0xa55c('0x50')](_0xa55c('0x93'),_0xa55c('0x68'));_0x5b1cf3[_0xa55c('0x50')](_0xa55c('0xa0'),'Account.key');_0x5b1cf3[_0xa55c('0x50')](_0xa55c('0xa1'),'Account.mandatoryDisposition');_0x5b1cf3[_0xa55c('0x50')]('i.*');_0x5b1cf3[_0xa55c('0x50')](_0xa55c('0xa2'),_0xa55c('0xa3'));_0x5b1cf3[_0xa55c('0x50')](_0xa55c('0xa4'),'Contact.lastName');_0x5b1cf3[_0xa55c('0x50')](_0xa55c('0xa5'),_0xa55c('0xa6'));_0x5b1cf3[_0xa55c('0x50')](_0xa55c('0xa7'),_0xa55c('0xa8'));_0x5b1cf3[_0xa55c('0x50')]('c.mobile','Contact.mobile');_0x5b1cf3['field'](_0xa55c('0xa9'),'Contact.fax');_0x5b1cf3[_0xa55c('0x50')](_0xa55c('0xaa'),_0xa55c('0xab'));_0x5b1cf3[_0xa55c('0x50')](_0xa55c('0xac'),'Owner.internal');_0x5b1cf3[_0xa55c('0x50')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xa55c('0x3f'));}_0x5b1cf3[_0xa55c('0x32')](_0x508bd3[_0xa55c('0x32')]);_0x5b1cf3[_0xa55c('0x31')](_0x508bd3['offset']);return db[_0xa55c('0x9d')][_0xa55c('0x44')](_0x5b1cf3[_0xa55c('0x9c')](),_0x1ea5b6);})[_0xa55c('0x22')](function(_0xc58a3){_0x46e27d[_0xa55c('0x4e')](_0xa55c('0xad'),_[_0xa55c('0x3b')](_0xc58a3,'id'));return db['sequelize'][_0xa55c('0x44')](_0x46e27d[_0xa55c('0x9c')](),_0x1ea5b6)[_0xa55c('0x22')](function(_0x3135e0){var _0x15561b=_[_0xa55c('0xae')](_0x3135e0,'ChatInteractionId');var _0x46124b=[];_0xc58a3['forEach'](function(_0x3b9712){_0x46124b['push'](updateChatInteraction(_0x3b9712,_0x3822b7,_0x15561b));});return BPromise[_0xa55c('0xaf')](_0x46124b);});});})[_0xa55c('0x22')](function(_0x17312b){_0x2f8449['rows']=_0x17312b;return _0x2f8449;})[_0xa55c('0x22')](respondWithFilteredResult(_0x2bd98b,_0x508bd3));})[_0xa55c('0x2c')](handleError(_0x2bd98b,null));};exports[_0xa55c('0xb0')]=function(_0x5133bd,_0x230614){var _0x4c0c82={'raw':![],'where':{'id':_0x5133bd[_0xa55c('0xb1')]['id']}},_0x777c32={};_0x777c32['model']=_[_0xa55c('0x45')](db['ChatInteraction'][_0xa55c('0x41')]);_0x777c32[_0xa55c('0x44')]=_['keys'](_0x5133bd[_0xa55c('0x44')]);_0x777c32[_0xa55c('0x46')]=_['intersection'](_0x777c32[_0xa55c('0x43')],_0x777c32[_0xa55c('0x44')]);_0x4c0c82['attributes']=_[_0xa55c('0x47')](_0x777c32['model'],qs['fields'](_0x5133bd[_0xa55c('0x44')][_0xa55c('0x49')]));_0x4c0c82[_0xa55c('0x48')]=_0x4c0c82[_0xa55c('0x48')]['length']?_0x4c0c82[_0xa55c('0x48')]:_0x777c32['model'];if(_0x5133bd[_0xa55c('0x44')]['includeAll']){_0x4c0c82['include']=[{'all':!![]}];}_0x4c0c82=_['merge']({},_0x4c0c82,_0x5133bd[_0xa55c('0xb2')]);return db['ChatInteraction']['find'](_0x4c0c82)[_0xa55c('0x22')](handleEntityNotFound(_0x230614,null))[_0xa55c('0x22')](respondWithResult(_0x230614,null))[_0xa55c('0x2c')](handleError(_0x230614,null));};exports[_0xa55c('0xb3')]=function(_0x1c50a1,_0x106a58){return db[_0xa55c('0xb4')][_0xa55c('0xb3')](_0x1c50a1[_0xa55c('0x7c')],{})[_0xa55c('0x22')](respondWithResult(_0x106a58,0xc9))[_0xa55c('0x2c')](handleError(_0x106a58,null));};exports[_0xa55c('0xb5')]=function(_0x2175df,_0x5d9504){if(_0x2175df[_0xa55c('0x7c')]['id']){delete _0x2175df['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x2175df[_0xa55c('0xb1')]['id']}})['then'](handleEntityNotFound(_0x5d9504,null))[_0xa55c('0x22')](saveUpdates(_0x2175df['body'],null))[_0xa55c('0x22')](respondWithResult(_0x5d9504,null))['catch'](handleError(_0x5d9504,null));};exports['destroy']=function(_0xfb1954,_0x4e7680){return db['ChatInteraction'][_0xa55c('0x67')]({'where':{'id':_0xfb1954[_0xa55c('0xb1')]['id']}})['then'](handleEntityNotFound(_0x4e7680,null))[_0xa55c('0x22')](removeEntity(_0x4e7680,null))['catch'](handleError(_0x4e7680,null));};exports[_0xa55c('0xb6')]=function(_0x403dff,_0x1dcd8a){return db['ChatInteraction']['describe']()[_0xa55c('0x22')](respondWithResult(_0x1dcd8a,null))[_0xa55c('0x2c')](handleError(_0x1dcd8a,null));};exports[_0xa55c('0xb7')]=function(_0xfda07f,_0x4297bf){if(_0xfda07f[_0xa55c('0x7c')]['id']){delete _0xfda07f[_0xa55c('0x7c')]['id'];}return db[_0xa55c('0xb4')]['find']({'where':{'id':_0xfda07f[_0xa55c('0xb1')]['id']}})[_0xa55c('0x22')](handleEntityNotFound(_0x4297bf,null))[_0xa55c('0x22')](saveUpdates(_0xfda07f[_0xa55c('0x7c')],null))[_0xa55c('0x22')](respondWithResult(_0x4297bf,null))[_0xa55c('0x2c')](handleError(_0x4297bf,null));};exports[_0xa55c('0xb8')]=function(_0x129a4d,_0x3e67b4,_0x54db98){if(_0x129a4d[_0xa55c('0x7c')]['id']){delete _0x129a4d[_0xa55c('0x7c')]['id'];}return db[_0xa55c('0xb4')]['find']({'where':{'id':_0x129a4d['params']['id']}})['then'](function(_0x33ceaf){if(!_0x33ceaf){logger['error'](_0xa55c('0xb9'),_0xa55c('0xb8'),0x194,_0xa55c('0xba'));_0x3e67b4[_0xa55c('0x2d')](0x194);}else{if(_0x33ceaf[_0xa55c('0x7b')]){throw new db[(_0xa55c('0x1e'))][(_0xa55c('0x1f'))](_0xa55c('0xbb'));}}return _0x33ceaf;})[_0xa55c('0x22')](function(_0x3890d3){if(_0x3890d3){return _0x3890d3[_0xa55c('0xb5')]({'closed':_0x129a4d[_0xa55c('0x7c')][_0xa55c('0xbc')],'disposition':_0x129a4d[_0xa55c('0x7c')][_0xa55c('0xbd')]})[_0xa55c('0x22')](function(_0xf0bcac){return _0xf0bcac;});}})[_0xa55c('0x22')](function(_0x20a7fc){return respondWithRpcPromise(_0xa55c('0xbe'),_0xa55c('0xb8'),_0x129a4d[_0xa55c('0x7c')],client9004);})[_0xa55c('0x22')](respondWithResult(_0x3e67b4,null))[_0xa55c('0x2c')](handleError(_0x3e67b4,null));};exports['attachmentUpload']=function(_0x423095,_0xda6e68,_0x49e8f2){_0x423095[_0xa55c('0x7c')][_0xa55c('0x39')]=_0x423095[_0xa55c('0xbf')][_0xa55c('0xc0')];_0x423095[_0xa55c('0x7c')]['basename']=_0x423095[_0xa55c('0xbf')]['filename'];_0x423095['body'][_0xa55c('0x42')]=_0x423095[_0xa55c('0xbf')][_0xa55c('0xc1')];return db[_0xa55c('0xc2')][_0xa55c('0xb3')](_0x423095[_0xa55c('0x7c')])[_0xa55c('0x22')](respondWithResult(_0xda6e68,0xc9))[_0xa55c('0x2c')](handleError(_0xda6e68,null));};exports[_0xa55c('0xc3')]=function(_0xf1d118,_0x1036b3,_0x2e72c2){return db[_0xa55c('0xb4')][_0xa55c('0xc4')]({'where':{'id':_0xf1d118[_0xa55c('0xb1')]['id']},'raw':!![]})[_0xa55c('0x22')](handleEntityNotFound(_0x1036b3,null))[_0xa55c('0x22')](function(_0x222fd9){if(_0x222fd9){if(_0x222fd9[_0xa55c('0xbc')]){return _0x1036b3['status'](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0xa55c('0xc2')][_0xa55c('0xc4')]({'where':{'id':_0xf1d118['query'][_0xa55c('0xc5')]},'raw':!![]})['then'](handleEntityNotFound(_0x1036b3,null));}})[_0xa55c('0x22')](function(_0x49e02c){if(_0x49e02c){return _0x1036b3[_0xa55c('0xc6')](path[_0xa55c('0xc7')](config[_0xa55c('0xc8')],_0xa55c('0xc9'),_0x49e02c[_0xa55c('0xca')]));}})[_0xa55c('0x2c')](handleError(_0x1036b3,null));};exports[_0xa55c('0xcb')]=function(_0x41aa56,_0x120615){var _0x665054=null;var _0x13c5ac=null;var _0x53f209=null;var _0x59f3a4=null;if(_0x41aa56[_0xa55c('0x7c')]['id']){delete _0x41aa56['body']['id'];}if(_0x41aa56[_0xa55c('0x7c')]['mailTranscript']){_0x59f3a4=path[_0xa55c('0xc7')](config[_0xa55c('0xc8')],_0xa55c('0xcc'),util['format'](_0xa55c('0xcd'),Date[_0xa55c('0xce')]()));_0x41aa56[_0xa55c('0x7c')]['pathTranscript']=_0x59f3a4;}return db[_0xa55c('0xb4')]['find']({'where':{'id':_0x41aa56[_0xa55c('0xb1')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0xa55c('0x78')],'as':_0xa55c('0x78')}]}]})[_0xa55c('0x22')](handleEntityNotFound(_0x120615,null))['then'](saveUpdates(_0x41aa56[_0xa55c('0x7c')],null))[_0xa55c('0x22')](function(_0x40d3bd){if(_0x40d3bd){_0x665054=_0x40d3bd;return db[_0xa55c('0xcf')][_0xa55c('0x67')]({'where':{'id':_0x665054[_0xa55c('0x7f')]}});}})[_0xa55c('0x22')](function(_0x24db74){if(_0x24db74){_0x53f209=_0x24db74;return db['CmContact'][_0xa55c('0x67')]({'where':{'id':_0x665054[_0xa55c('0x71')]}});}})[_0xa55c('0x22')](function(_0x151533){if(_0x151533){_0x13c5ac=_0x151533;if(_0x59f3a4){var _0x2f09d0=null;for(var _0x104be8=0x1;_0x104be8<_0x665054[_0xa55c('0xd0')][_0xa55c('0x66')];++_0x104be8){_0x2f09d0=_0x665054[_0xa55c('0xd0')][_0x104be8];var _0x261087=_0x2f09d0[_0xa55c('0x7b')]?util['format'](_0xa55c('0xd1'),_0x53f209['agentAlias'],_0x2f09d0['UserId']):_0xa55c('0xd2');var _0x5ebb00=_0x41aa56[_0xa55c('0x7c')]['customer']||util[_0xa55c('0xd3')](_0xa55c('0xd1'),_0xa55c('0xd4'),_0x2f09d0[_0xa55c('0x71')]);switch(_0x53f209[_0xa55c('0xd5')]){case _0xa55c('0xd6'):_0x261087=_0x2f09d0[_0xa55c('0x7b')]?util['format'](_0xa55c('0xd1'),_0x53f209['agentAlias'],_0x2f09d0['UserId']):_0xa55c('0xd2');break;case _0xa55c('0xd7'):_0x261087=_0x2f09d0['UserId']?_0x2f09d0[_0xa55c('0x78')][_0xa55c('0xd8')]||_0x2f09d0[_0xa55c('0x78')]['fullname']:'System';break;case'agent_fullname':_0x261087=_0x2f09d0['UserId']?_0x2f09d0[_0xa55c('0x78')][_0xa55c('0xd9')]:'System';break;default:_0x261087=_0x2f09d0[_0xa55c('0x7b')]?util[_0xa55c('0xd3')](_0xa55c('0xd1'),_0x53f209['agentAlias'],_0x2f09d0[_0xa55c('0x7b')]):'System';}var _0x4d870c=util['format'](_0xa55c('0xda'),moment(_0x2f09d0['createdAt'])[_0xa55c('0xd3')]('MM/DD/YYYY\x20HH:mm:ss'),_0x2f09d0[_0xa55c('0xdb')]==='in'?_0x5ebb00:_0x261087,_0x2f09d0[_0xa55c('0x7c')]);if(!_0x2f09d0[_0xa55c('0xdc')]){fs['appendFileSync'](_0x59f3a4,_0x4d870c);}}return db[_0xa55c('0xdd')][_0xa55c('0xc4')]({'where':{'service':!![]},'include':[{'model':db[_0xa55c('0xde')],'as':_0xa55c('0xdf'),'raw':!![]}]});}}})[_0xa55c('0x22')](function(_0x44190a){if(_0x44190a&&_0x44190a[_0xa55c('0xdf')]&&_0x41aa56[_0xa55c('0x7c')]){var _0xfb7289={'tls':{'rejectUnauthorized':![]}};if(_0x44190a['Smtp'][_0xa55c('0xe0')]){_0xfb7289[_0xa55c('0xe0')]=_0x44190a[_0xa55c('0xdf')][_0xa55c('0xe0')];}else{_0xfb7289[_0xa55c('0xe1')]=_0x44190a[_0xa55c('0xdf')]['host'];_0xfb7289[_0xa55c('0xe2')]=_0x44190a['Smtp'][_0xa55c('0xe2')];_0xfb7289[_0xa55c('0xe3')]=_0x44190a['Smtp'][_0xa55c('0xe3')];}if(_0x44190a[_0xa55c('0xdf')]['authentication']){_0xfb7289['auth']={'user':_0x44190a[_0xa55c('0xdf')][_0xa55c('0x9a')],'pass':_0x44190a[_0xa55c('0xdf')][_0xa55c('0xe4')]};}return respondWithRpcPromise(_0xa55c('0xe5'),_0xa55c('0xe6'),{'account':_0xfb7289,'message':{'from':util[_0xa55c('0xd3')](_0xa55c('0xe7'),_0x44190a['name'],_0x44190a[_0xa55c('0xe8')]||_0x44190a[_0xa55c('0xdf')][_0xa55c('0x9a')]),'to':_0x41aa56[_0xa55c('0x7c')][_0xa55c('0xe9')],'subject':'Mail\x20Transcript','text':util[_0xa55c('0xd3')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x41aa56['body'][_0xa55c('0xe9')]),'attachments':[{'path':_0x59f3a4}]}})[_0xa55c('0x22')](function(){return _0x665054;})[_0xa55c('0x2c')](function(_0x2631b7){console['error'](_0x2631b7);});}else{return _0x665054;}})[_0xa55c('0x22')](respondWithStatusCode(_0x120615,0xc8))[_0xa55c('0x2c')](handleError(_0x120615,null));};exports[_0xa55c('0xea')]=function(_0x1c7506,_0x3b76df,_0x4295c1){return db[_0xa55c('0xeb')][_0xa55c('0x67')]({'where':{'id':_0x1c7506['params']['id']}})[_0xa55c('0x22')](handleEntityNotFound(_0x3b76df,null))[_0xa55c('0x22')](function(_0x2639cc){if(_0x2639cc){return _0x2639cc[_0xa55c('0xea')](_0x1c7506['body'][_0xa55c('0xec')],_[_0xa55c('0xed')](_0x1c7506[_0xa55c('0x7c')],['ids','id'])||{});}})[_0xa55c('0x22')](respondWithResult(_0x3b76df,null))[_0xa55c('0x2c')](handleError(_0x3b76df,null));};exports[_0xa55c('0xee')]=function(_0xf6fdf5,_0x19e506,_0x125352){var _0x127c2f={'raw':![],'where':{}};var _0x492144={};var _0xcd4f3a={'count':0x0,'rows':[]};return db[_0xa55c('0xb4')]['findOne']({'where':{'id':_0xf6fdf5[_0xa55c('0xb1')]['id']}})[_0xa55c('0x22')](handleEntityNotFound(_0x19e506,null))[_0xa55c('0x22')](function(_0x4f32d1){if(_0x4f32d1){_0x492144['model']=_['keys'](db[_0xa55c('0xeb')][_0xa55c('0x41')]);_0x492144['query']=_['keys'](_0xf6fdf5[_0xa55c('0x44')]);_0x492144[_0xa55c('0x46')]=_['intersection'](_0x492144['model'],_0x492144[_0xa55c('0x44')]);_0x127c2f[_0xa55c('0x48')]=_[_0xa55c('0x47')](_0x492144['model'],qs['fields'](_0xf6fdf5[_0xa55c('0x44')]['fields']));_0x127c2f[_0xa55c('0x48')]=_0x127c2f[_0xa55c('0x48')]['length']?_0x127c2f[_0xa55c('0x48')]:_0x492144['model'];if(!_0xf6fdf5['query']['hasOwnProperty']('nolimit')){_0x127c2f['limit']=qs[_0xa55c('0x32')](_0xf6fdf5['query'][_0xa55c('0x32')]);_0x127c2f[_0xa55c('0x31')]=qs[_0xa55c('0x31')](_0xf6fdf5['query'][_0xa55c('0x31')]);}_0x127c2f[_0xa55c('0x4c')]=qs[_0xa55c('0x4d')](_0xf6fdf5[_0xa55c('0x44')][_0xa55c('0x4d')]);_0x127c2f[_0xa55c('0x4e')]=qs[_0xa55c('0x46')](_[_0xa55c('0xef')](_0xf6fdf5[_0xa55c('0x44')],_0x492144[_0xa55c('0x46')]));_0x127c2f['where'][_0xa55c('0xf0')]=_0x4f32d1['id'];if(_0xf6fdf5[_0xa55c('0x44')]['filter']){_0x127c2f[_0xa55c('0x4e')]=_[_0xa55c('0x9f')](_0x127c2f[_0xa55c('0x4e')],{'$or':_[_0xa55c('0x3b')](_0x127c2f[_0xa55c('0x48')],function(_0x12430e){var _0x1d5978={};_0x1d5978[_0x12430e]={'$like':'%'+_0xf6fdf5[_0xa55c('0x44')][_0xa55c('0x8b')]+'%'};return _0x1d5978;})});}if(_0xf6fdf5[_0xa55c('0x44')][_0xa55c('0x83')]){var _0x197953=_0xf6fdf5[_0xa55c('0x44')][_0xa55c('0x83')][_0xa55c('0x6d')](',');var _0x5c8713={};_0x5c8713[_0x197953[0x0]]={'$gte':moment(_0x197953[0x1])[_0xa55c('0xd3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x127c2f[_0xa55c('0x4e')]=_[_0xa55c('0x9f')](_0x127c2f[_0xa55c('0x4e')],_0x5c8713);}_0x127c2f=_[_0xa55c('0x9f')]({},_0x127c2f,_0xf6fdf5['options']);return db[_0xa55c('0xeb')][_0xa55c('0x30')]({'where':_0x127c2f[_0xa55c('0x4e')]})['then'](function(_0x2774f9){_0xcd4f3a[_0xa55c('0x30')]=_0x2774f9;if(_0xf6fdf5[_0xa55c('0x44')]['includeAll']){_0x127c2f[_0xa55c('0xf1')]=[{'all':!![]}];}return db[_0xa55c('0xeb')][_0xa55c('0xf2')](_0x127c2f);})['then'](function(_0x9181c6){_0xcd4f3a['rows']=_0x9181c6;return _0xcd4f3a;});}})[_0xa55c('0x22')](respondWithFilteredResult(_0x19e506,_0x127c2f))[_0xa55c('0x2c')](handleError(_0x19e506,null));};exports[_0xa55c('0xf3')]=function(_0x1fe072,_0x9654ac,_0x528955){var _0x46c0ac={'where':{}},_0x2a890b={},_0x451609={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xa55c('0xc4')]({'where':{'id':_0x1fe072[_0xa55c('0xb1')]['id']}})[_0xa55c('0x22')](handleEntityNotFound(_0x9654ac,null))['then'](function(_0xc2e255){if(_0xc2e255){_0x2a890b[_0xa55c('0x43')]=_[_0xa55c('0x45')](db[_0xa55c('0xeb')][_0xa55c('0x41')]);_0x2a890b[_0xa55c('0x44')]=_[_0xa55c('0x45')](_0x1fe072['query']);_0x2a890b[_0xa55c('0x46')]=_[_0xa55c('0x47')](_0x2a890b[_0xa55c('0x43')],_0x2a890b[_0xa55c('0x44')]);_0x46c0ac['attributes']=_[_0xa55c('0x47')](_0x2a890b[_0xa55c('0x43')],qs[_0xa55c('0x49')](_0x1fe072[_0xa55c('0x44')][_0xa55c('0x49')]));_0x46c0ac[_0xa55c('0x48')]=_0x46c0ac[_0xa55c('0x48')]['length']?_0x46c0ac[_0xa55c('0x48')]:_0x2a890b[_0xa55c('0x43')];if(!_0x1fe072[_0xa55c('0x44')][_0xa55c('0x4a')](_0xa55c('0x4b'))){_0x46c0ac['limit']=qs['limit'](_0x1fe072['query'][_0xa55c('0x32')]);_0x46c0ac[_0xa55c('0x31')]=qs[_0xa55c('0x31')](_0x1fe072[_0xa55c('0x44')][_0xa55c('0x31')]);}_0x46c0ac[_0xa55c('0x4c')]=qs[_0xa55c('0x4d')](_0x1fe072[_0xa55c('0x44')]['sort']);_0x46c0ac[_0xa55c('0x4e')]=qs[_0xa55c('0x46')](_[_0xa55c('0xef')](_0x1fe072[_0xa55c('0x44')],_0x2a890b[_0xa55c('0x46')]));_0x46c0ac[_0xa55c('0x4e')]['ChatInteractionId']=_0xc2e255['id'];if(_0x1fe072[_0xa55c('0x44')]['filter']){_0x46c0ac['where']=_['merge'](_0x46c0ac['where'],{'$or':_[_0xa55c('0x3b')](_0x46c0ac[_0xa55c('0x48')],function(_0x4732b4){var _0x317157={};_0x317157[_0x4732b4]={'$like':'%'+_0x1fe072[_0xa55c('0x44')][_0xa55c('0x8b')]+'%'};return _0x317157;})});}_0x46c0ac[_0xa55c('0x4e')][_0xa55c('0xdc')]=![];if(_0x1fe072[_0xa55c('0x44')]['id']){_0x46c0ac[_0xa55c('0x4e')]['id']={'$gt':_0x1fe072[_0xa55c('0x44')]['id']};}_0x46c0ac=_['merge']({},_0x46c0ac,_0x1fe072['options']);return db[_0xa55c('0xeb')]['count']({'where':_0x46c0ac[_0xa55c('0x4e')]})[_0xa55c('0x22')](function(_0x2ef7de){_0x451609[_0xa55c('0x30')]=_0x2ef7de;_0x46c0ac[_0xa55c('0xf1')]=[];if(_0x1fe072[_0xa55c('0x44')][_0xa55c('0xf4')]){_0x46c0ac[_0xa55c('0xf1')][_0xa55c('0x3e')]({'model':db['User'],'as':_0xa55c('0x78'),'attributes':['id',_0xa55c('0xd9'),'alias']});}if(_0x1fe072['query'][_0xa55c('0xf5')]){_0x46c0ac[_0xa55c('0xf1')]=[{'all':!![]}];}return db[_0xa55c('0xeb')]['findAll'](_0x46c0ac);})[_0xa55c('0x22')](function(_0x3622dd){_0x451609[_0xa55c('0xf6')]=_0x3622dd;return _0x451609;});}})[_0xa55c('0x22')](respondWithFilteredResult(_0x9654ac,_0x46c0ac))['catch'](handleError(_0x9654ac,null));};exports['addTags']=function(_0x33d58c,_0x540825,_0x4c560f){return db[_0xa55c('0xb4')][_0xa55c('0x67')]({'where':{'id':_0x33d58c[_0xa55c('0xb1')]['id']}})[_0xa55c('0x22')](handleEntityNotFound(_0x540825,null))['then'](function(_0x19d2aa){if(_0x19d2aa){return _0x19d2aa[_0xa55c('0xf7')](_0x33d58c[_0xa55c('0x7c')][_0xa55c('0xec')],_[_0xa55c('0xed')](_0x33d58c['body'],[_0xa55c('0xec'),'id'])||{})[_0xa55c('0xf8')](function(){return db[_0xa55c('0x75')][_0xa55c('0xf2')]({'attributes':['id',_0xa55c('0x39'),_0xa55c('0x51')],'where':{'id':_0x33d58c[_0xa55c('0x7c')]['ids']}});})[_0xa55c('0x22')](function(_0x58b366){socket[_0xa55c('0xf9')](_0xa55c('0xfa'),{'id':Number(_0x33d58c[_0xa55c('0xb1')]['id']),'tags':_0x58b366||[]});return{'id':Number(_0x33d58c['params']['id']),'tags':_0x58b366||[]};});}})['then'](respondWithResult(_0x540825,null))[_0xa55c('0x2c')](handleError(_0x540825,null));};exports[_0xa55c('0xfb')]=function(_0x536e1d,_0x49b283,_0x62f09){return db[_0xa55c('0xb4')]['find']({'where':{'id':_0x536e1d[_0xa55c('0xb1')]['id']}})['then'](handleEntityNotFound(_0x49b283,null))[_0xa55c('0x22')](function(_0x260349){if(_0x260349){return _0x260349[_0xa55c('0xfb')](_0x536e1d[_0xa55c('0x44')]['ids']);}})[_0xa55c('0x22')](respondWithStatusCode(_0x49b283,null))[_0xa55c('0x2c')](handleError(_0x49b283,null));};exports[_0xa55c('0xc6')]=function(_0x4f7e05,_0x4986fa){var _0x1f0527=moment()['unix']()['toString']();var _0x2b89f4=path[_0xa55c('0xc7')](config[_0xa55c('0xc8')],_0xa55c('0xfc'),_0xa55c('0xfd'),_0xa55c('0xfe'));var _0x450be7=path[_0xa55c('0xc7')](config[_0xa55c('0xc8')],_0xa55c('0xfc'),'files','attachments');var _0x2b6738=path[_0xa55c('0xc7')](_0x2b89f4,_0x1f0527);var _0x2fa997=util[_0xa55c('0xd3')]('transcript-%d-%s.zip',_0x4f7e05[_0xa55c('0xb1')]['id'],_0x1f0527);var _0x3249f8=path[_0xa55c('0xc7')](_0x2b89f4,_0x2fa997);var _0x269e3b=[];_0x269e3b['push']({'model':db[_0xa55c('0x78')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x269e3b['push']({'model':db['CmContact'],'as':_0xa55c('0xff'),'attributes':['id',_0xa55c('0x100'),'lastName'],'raw':!![]});if(_0x4f7e05[_0xa55c('0x44')][_0xa55c('0x101')]){_0x269e3b[_0xa55c('0x3e')]({'model':db[_0xa55c('0xc2')],'as':_0xa55c('0xc2'),'raw':!![]});}var _0x38a5c3=[{'model':db['ChatMessage'],'as':_0xa55c('0xd0'),'attributes':['id',_0xa55c('0x7c'),_0xa55c('0x82'),_0xa55c('0xdb'),'secret','read'],'include':_0x269e3b}];_0x38a5c3['push']({'model':db[_0xa55c('0xcf')],'as':_0xa55c('0x102'),'attributes':['id',_0xa55c('0x39')]});_0x38a5c3[_0xa55c('0x3e')]({'model':db[_0xa55c('0x78')],'as':_0xa55c('0x103'),'attributes':['id',_0xa55c('0xd9')]});return db[_0xa55c('0xb4')]['find']({'where':{'id':_0x4f7e05['params']['id']},'include':_0x38a5c3})[_0xa55c('0x22')](handleEntityNotFound(_0x4986fa,null))[_0xa55c('0x22')](function(_0x5d70de){if(_0x5d70de){var _0x1e19d6=_0x5d70de[_0xa55c('0x104')]({'plain':!![]});fs['mkdirSync'](_0x2b6738);var _0x4e6d28={'format':'A4','border':_0xa55c('0x105'),'header':{'height':_0xa55c('0x106'),'contents':{'first':_0xa55c('0x107')}},'footer':{'height':_0xa55c('0x108'),'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[_0xa55c('0xd3')](_0xa55c('0x109'),_0xa55c('0x10a'),_0x1e19d6['id']),moment()[_0xa55c('0xd3')](_0xa55c('0x10b'))[_0xa55c('0x9c')]())}}};var _0x185c5b={'channel':_0xa55c('0x10a'),'account':_0x1e19d6[_0xa55c('0x102')][_0xa55c('0x39')],'agent':_0x1e19d6['Owner']?_0x1e19d6[_0xa55c('0x103')]['fullname']:_0xa55c('0x10c'),'createdAt':moment(_0x1e19d6[_0xa55c('0x82')])[_0xa55c('0xd3')](_0xa55c('0x10d'))[_0xa55c('0x9c')](),'closedAt':_0x1e19d6[_0xa55c('0xbc')]?moment(_0x1e19d6[_0xa55c('0x10e')])[_0xa55c('0xd3')](_0xa55c('0x10d'))[_0xa55c('0x9c')]():'','disposition':_0x1e19d6[_0xa55c('0xbd')],'chatInfo':{'browser':_0x1e19d6[_0xa55c('0x10f')],'os':_0x1e19d6[_0xa55c('0x110')],'referer':_0x1e19d6['referer'],'customerIp':_0x1e19d6[_0xa55c('0x111')],'customerPort':_0x1e19d6[_0xa55c('0x112')]?_0x1e19d6['customerPort']:_0xa55c('0x10c')},'messages':_(_0x1e19d6[_0xa55c('0xd0')])[_0xa55c('0x113')]()['filter']({'secret':![]})[_0xa55c('0x3b')](function(_0x2311fa){if(_0x2311fa['Attachment']){var _0x2931d5=path[_0xa55c('0xc7')](_0x450be7,_0x2311fa['Attachment'][_0xa55c('0xca')]);if(fs['existsSync'](_0x2931d5)){fs[_0xa55c('0x114')](_0x2931d5)[_0xa55c('0x115')](fs[_0xa55c('0x116')](path[_0xa55c('0xc7')](_0x2b6738,_0x2311fa[_0xa55c('0xc2')][_0xa55c('0xca')])));}}return{'date':moment(_0x2311fa[_0xa55c('0x82')])[_0xa55c('0xd3')](_0xa55c('0x10d'))[_0xa55c('0x9c')](),'sender':_0x2311fa[_0xa55c('0xdb')]===_0xa55c('0x117')?_0x2311fa[_0xa55c('0x78')]?_0x2311fa[_0xa55c('0x78')][_0xa55c('0xd9')]:_0xa55c('0xd2'):_0x2311fa['Contact'][_0xa55c('0x100')]+(_0x2311fa['Contact'][_0xa55c('0x118')]?'\x20'+_0x2311fa[_0xa55c('0xff')][_0xa55c('0x118')]:''),'body':_0x2311fa['Attachment']?_0x2311fa[_0xa55c('0xc2')][_0xa55c('0xca')]:_0x2311fa[_0xa55c('0x7c')],'direction':_0x2311fa[_0xa55c('0xdb')]==='out'?'A':'C','secret':_0x2311fa['secret'],'read':_0x2311fa[_0xa55c('0x88')],'attachment':_0x2311fa['Attachment']};})['value']()};return ejs[_0xa55c('0x119')](path[_0xa55c('0xc7')](config['root'],'server','views',_0xa55c('0x11a')),{'interaction':_0x185c5b})[_0xa55c('0x22')](function(_0x506c74){return new BPromise(function(_0x440a9c,_0x3fc772){pdf[_0xa55c('0xb3')](_0x506c74,_0x4e6d28)[_0xa55c('0x11b')](path[_0xa55c('0xc7')](_0x2b6738,_0xa55c('0x11c')+_0x1e19d6['id']+'-'+_0x1f0527+_0xa55c('0x11d')),function(_0x35831d,_0x131515){if(_0x35831d)return _0x3fc772(_0x35831d);_0x440a9c(_0x131515);});});})[_0xa55c('0x22')](function(){return new BPromise(function(_0x31c6e0,_0x94f2b4){zipdir(_0x2b6738,{'saveTo':_0x3249f8},function(_0x59851c,_0x843326){if(_0x59851c)return _0x94f2b4(_0x59851c);return _0x31c6e0(_0x843326);});})[_0xa55c('0x22')](function(){return new BPromise(function(_0x20c551,_0x25a4f3){rimraf(_0x2b6738,function(_0x1b2287){if(_0x1b2287)_0x25a4f3(_0x1b2287);return _0x20c551();});});})[_0xa55c('0x22')](function(){return _0x4986fa[_0xa55c('0xc6')](_0x3249f8,_0x2fa997,function(_0x24fc26){if(_0x24fc26){console[_0xa55c('0x11e')](_0xa55c('0x11f'),_0x24fc26);}else{fs['unlinkSync'](_0x3249f8);}});});});}else{return _0x4986fa['sendStatus'](0xc8);}})[_0xa55c('0x2c')](handleError(_0x4986fa,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index c79ba3d..42ac461 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 _0xcb95=['exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xcb95,0xb5));var _0x5cb9=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xcb95[_0x5834bc];return _0x3e183a;};'use strict';var EventEmitter=require(_0x5cb9('0x0'));var ChatInteraction=require(_0x5cb9('0x1'))['db'][_0x5cb9('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x5cb9('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x5cb9('0x4')](0x0);var events={'afterCreate':_0x5cb9('0x5'),'afterUpdate':_0x5cb9('0x6'),'afterDestroy':_0x5cb9('0x7')};function emitEvent(_0x3c22be){return function(_0x4be219,_0x423939,_0x1bdedb){_0x4be219['getUsers']({'attributes':['id'],'raw':!![]})[_0x5cb9('0x8')](function(_0x374b78){_0x4be219[_0x5cb9('0x9')](_0x5cb9('0xa'),_0x374b78[_0x5cb9('0xb')](function(_0x3911b2){return{'id':_0x3911b2['id']};}));return ChatMessage[_0x5cb9('0xc')]({'where':{'ChatInteractionId':_0x4be219['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5cb9('0x8')](function(_0xe0d19b){_0x4be219[_0x5cb9('0x9')](_0x5cb9('0xd'),_0xe0d19b[_0x5cb9('0xe')]);ChatInteractionEvents[_0x5cb9('0xf')](_0x3c22be+':'+_0x4be219['id'],_0x4be219);ChatInteractionEvents[_0x5cb9('0xf')](_0x3c22be,_0x4be219);_0x1bdedb(null);})[_0x5cb9('0x10')](_0x1bdedb(null));};}for(var e in events){if(events[_0x5cb9('0x11')](e)){var event=events[e];ChatInteraction[_0x5cb9('0x12')](e,emitEvent(event));}}module[_0x5cb9('0x13')]=ChatInteractionEvents; \ No newline at end of file +var _0x1cff=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','save','update','remove','then','setDataValue','Users','map','findAll'];(function(_0x3522c8,_0x1e7c82){var _0x22f498=function(_0x5bf143){while(--_0x5bf143){_0x3522c8['push'](_0x3522c8['shift']());}};_0x22f498(++_0x1e7c82);}(_0x1cff,0x72));var _0xf1cf=function(_0x15d2e2,_0x204f8b){_0x15d2e2=_0x15d2e2-0x0;var _0x1c3989=_0x1cff[_0x15d2e2];return _0x1c3989;};'use strict';var EventEmitter=require(_0xf1cf('0x0'));var ChatInteraction=require(_0xf1cf('0x1'))['db'][_0xf1cf('0x2')];var ChatMessage=require(_0xf1cf('0x1'))['db'][_0xf1cf('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf1cf('0x4'),'afterUpdate':_0xf1cf('0x5'),'afterDestroy':_0xf1cf('0x6')};function emitEvent(_0x5b57c8){return function(_0x521e8a,_0x36fbff,_0x166929){_0x521e8a['getUsers']({'attributes':['id'],'raw':!![]})[_0xf1cf('0x7')](function(_0x235842){_0x521e8a[_0xf1cf('0x8')](_0xf1cf('0x9'),_0x235842[_0xf1cf('0xa')](function(_0x1207e0){return{'id':_0x1207e0['id']};}));return ChatMessage[_0xf1cf('0xb')]({'where':{'ChatInteractionId':_0x521e8a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x41606f){_0x521e8a[_0xf1cf('0x8')]('unreadMessages',_0x41606f[_0xf1cf('0xc')]);ChatInteractionEvents['emit'](_0x5b57c8+':'+_0x521e8a['id'],_0x521e8a);ChatInteractionEvents[_0xf1cf('0xd')](_0x5b57c8,_0x521e8a);_0x166929(null);})[_0xf1cf('0xe')](_0x166929(null));};}for(var e in events){if(events[_0xf1cf('0xf')](e)){var event=events[e];ChatInteraction[_0xf1cf('0x10')](e,emitEvent(event));}}module[_0xf1cf('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 1cf6ba4..93419e4 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 _0xb025=['./chatInteraction.attributes','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3c947d,_0xa66132){var _0x32d9c4=function(_0x17feea){while(--_0x17feea){_0x3c947d['push'](_0x3c947d['shift']());}};_0x32d9c4(++_0xa66132);}(_0xb025,0xd3));var _0x5b02=function(_0x2f55f0,_0x4850c9){_0x2f55f0=_0x2f55f0-0x0;var _0xc7a0c7=_0xb025[_0x2f55f0];return _0xc7a0c7;};'use strict';var _=require(_0x5b02('0x0'));var util=require('util');var logger=require(_0x5b02('0x1'))(_0x5b02('0x2'));var moment=require(_0x5b02('0x3'));var BPromise=require(_0x5b02('0x4'));var rp=require(_0x5b02('0x5'));var fs=require('fs');var path=require(_0x5b02('0x6'));var rimraf=require(_0x5b02('0x7'));var config=require(_0x5b02('0x8'));var attributes=require(_0x5b02('0x9'));module['exports']=function(_0x15a34b,_0x2f46e2){return _0x15a34b[_0x5b02('0xa')](_0x5b02('0xb'),attributes,{'tableName':_0x5b02('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1daf4c,_0x5452b5,_0x27e7ad){if(_0x1daf4c[_0x5b02('0xd')](_0x5b02('0xe'))){_0x1daf4c[_0x5b02('0xf')]=moment()[_0x5b02('0x10')](_0x5b02('0x11'));}_0x27e7ad(null,_0x1daf4c);}},'charset':_0x5b02('0x12'),'collate':_0x5b02('0x13')});}; \ No newline at end of file +var _0xc869=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x2b2ac8,_0x22f79a){var _0x5cd081=function(_0x31155d){while(--_0x31155d){_0x2b2ac8['push'](_0x2b2ac8['shift']());}};_0x5cd081(++_0x22f79a);}(_0xc869,0x13f));var _0x9c86=function(_0x38e427,_0x3028d8){_0x38e427=_0x38e427-0x0;var _0x218fb2=_0xc869[_0x38e427];return _0x218fb2;};'use strict';var _=require(_0x9c86('0x0'));var util=require(_0x9c86('0x1'));var logger=require(_0x9c86('0x2'))('api');var moment=require(_0x9c86('0x3'));var BPromise=require(_0x9c86('0x4'));var rp=require(_0x9c86('0x5'));var fs=require('fs');var path=require(_0x9c86('0x6'));var rimraf=require('rimraf');var config=require(_0x9c86('0x7'));var attributes=require(_0x9c86('0x8'));module[_0x9c86('0x9')]=function(_0x5687fd,_0x26cd34){return _0x5687fd[_0x9c86('0xa')](_0x9c86('0xb'),attributes,{'tableName':_0x9c86('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x59a148,_0x453e44,_0x5e5f98){if(_0x59a148[_0x9c86('0xd')](_0x9c86('0xe'))){_0x59a148[_0x9c86('0xf')]=moment()[_0x9c86('0x10')](_0x9c86('0x11'));}_0x5e5f98(null,_0x59a148);}},'charset':_0x9c86('0x12'),'collate':_0x9c86('0x13')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 1537a9b..aaa9754 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 _0x7df5=['socket.io-emitter','./chatInteraction.socket','register','request','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatInteraction,\x20%s,\x20%s','UpdateChatInteraction','update','body','options','raw','where','attributes','limit','then','catch','AddTagsToChatInteraction','ChatInteraction','find','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0x7df5,0x70));var _0x57df=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x7df5[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0x57df('0x0'));var util=require('util');var moment=require(_0x57df('0x1'));var BPromise=require(_0x57df('0x2'));var rs=require(_0x57df('0x3'));var fs=require('fs');var Redis=require(_0x57df('0x4'));var db=require(_0x57df('0x5'))['db'];var utils=require(_0x57df('0x6'));var logger=require(_0x57df('0x7'))('rpc');var config=require(_0x57df('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x57df('0x9')][_0x57df('0xa')]({'port':0x232a});config[_0x57df('0xb')]=_[_0x57df('0xc')](config[_0x57df('0xb')],{'host':_0x57df('0xd'),'port':0x18eb});var socket=require(_0x57df('0xe'))(new Redis(config[_0x57df('0xb')]));require(_0x57df('0xf'))[_0x57df('0x10')](socket);function respondWithRpcPromise(_0x2ed795,_0x328c54,_0x30b7a5){return new BPromise(function(_0x137195,_0x1dadb4){return client[_0x57df('0x11')](_0x2ed795,_0x30b7a5)['then'](function(_0x1a0a3){logger[_0x57df('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x328c54,_0x57df('0x13'));logger['debug'](_0x57df('0x14'),_0x328c54,'request\x20sent',JSON[_0x57df('0x15')](_0x1a0a3));if(_0x1a0a3[_0x57df('0x16')]){if(_0x1a0a3[_0x57df('0x16')]['code']===0x1f4){logger[_0x57df('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x328c54,_0x1a0a3['error'][_0x57df('0x17')]);return _0x1dadb4(_0x1a0a3[_0x57df('0x16')][_0x57df('0x17')]);}logger[_0x57df('0x16')](_0x57df('0x18'),_0x328c54,_0x1a0a3[_0x57df('0x16')]['message']);return _0x137195(_0x1a0a3['error'][_0x57df('0x17')]);}else{logger[_0x57df('0x12')](_0x57df('0x18'),_0x328c54,_0x57df('0x13'));_0x137195(_0x1a0a3['result']['message']);}})['catch'](function(_0x53d70c){logger[_0x57df('0x16')](_0x57df('0x18'),_0x328c54,_0x53d70c);_0x1dadb4(_0x53d70c);});});}exports[_0x57df('0x19')]=function(_0x10a88d){var _0x385ea7=this;return new Promise(function(_0x52aa5c,_0x41a05d){return db['ChatInteraction'][_0x57df('0x1a')](_0x10a88d[_0x57df('0x1b')],{'raw':_0x10a88d['options']?_0x10a88d[_0x57df('0x1c')][_0x57df('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10a88d['options']?_0x10a88d['options'][_0x57df('0x1e')]||null:null,'attributes':_0x10a88d['options']?_0x10a88d[_0x57df('0x1c')][_0x57df('0x1f')]||null:null,'limit':_0x10a88d[_0x57df('0x1c')]?_0x10a88d[_0x57df('0x1c')][_0x57df('0x20')]||null:null})[_0x57df('0x21')](function(_0x377e11){logger[_0x57df('0x12')]('UpdateChatInteraction',_0x10a88d);logger['debug'](_0x57df('0x19'),_0x10a88d,JSON[_0x57df('0x15')](_0x377e11));_0x52aa5c(_0x377e11);})[_0x57df('0x22')](function(_0x123dfb){logger[_0x57df('0x16')](_0x57df('0x19'),_0x123dfb[_0x57df('0x17')],_0x10a88d);_0x41a05d(_0x385ea7[_0x57df('0x16')](0x1f4,_0x123dfb[_0x57df('0x17')]));});});};exports[_0x57df('0x23')]=function(_0x447bf6){return new Promise(function(_0x5b437e,_0x3569b7){return db[_0x57df('0x24')][_0x57df('0x25')]({'where':_0x447bf6[_0x57df('0x1c')]?_0x447bf6[_0x57df('0x1c')][_0x57df('0x1e')]||null:null})[_0x57df('0x21')](function(_0x224060){if(_0x224060){return _0x224060['addTags'](_0x447bf6[_0x57df('0x1b')][_0x57df('0x26')],_[_0x57df('0x27')](_0x447bf6[_0x57df('0x1b')],[_0x57df('0x26'),'id'])||{});}})[_0x57df('0x28')](function(_0x2b8b1a){logger[_0x57df('0x12')](_0x57df('0x29'),_0x447bf6);logger['debug'](_0x57df('0x29'),_0x447bf6,JSON[_0x57df('0x15')](_0x2b8b1a));_0x5b437e(_0x2b8b1a);})['catch'](function(_0x11f910){logger[_0x57df('0x16')](_0x57df('0x29'),_0x11f910[_0x57df('0x17')],_0x447bf6);_0x3569b7(_this[_0x57df('0x16')](0x1f4,_0x11f910[_0x57df('0x17')]));});});}; \ No newline at end of file +var _0xb31e=['catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','AddTagsToChatInteraction','find','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x539567,_0x2abfdc){var _0x404c7d=function(_0x17df81){while(--_0x17df81){_0x539567['push'](_0x539567['shift']());}};_0x404c7d(++_0x2abfdc);}(_0xb31e,0x1e8));var _0xeb31=function(_0x2c187c,_0x401daf){_0x2c187c=_0x2c187c-0x0;var _0x182075=_0xb31e[_0x2c187c];return _0x182075;};'use strict';var _=require(_0xeb31('0x0'));var util=require(_0xeb31('0x1'));var moment=require(_0xeb31('0x2'));var BPromise=require(_0xeb31('0x3'));var rs=require(_0xeb31('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeb31('0x5'));var logger=require(_0xeb31('0x6'))(_0xeb31('0x7'));var config=require(_0xeb31('0x8'));var jayson=require(_0xeb31('0x9'));var client=jayson[_0xeb31('0xa')][_0xeb31('0xb')]({'port':0x232a});config[_0xeb31('0xc')]=_[_0xeb31('0xd')](config['redis'],{'host':_0xeb31('0xe'),'port':0x18eb});var socket=require(_0xeb31('0xf'))(new Redis(config[_0xeb31('0xc')]));require(_0xeb31('0x10'))[_0xeb31('0x11')](socket);function respondWithRpcPromise(_0x1fe7e3,_0x3e5af7,_0x12d008){return new BPromise(function(_0x53f120,_0x2e3900){return client['request'](_0x1fe7e3,_0x12d008)[_0xeb31('0x12')](function(_0x232780){logger['info'](_0xeb31('0x13'),_0x3e5af7,_0xeb31('0x14'));logger[_0xeb31('0x15')](_0xeb31('0x16'),_0x3e5af7,_0xeb31('0x14'),JSON[_0xeb31('0x17')](_0x232780));if(_0x232780[_0xeb31('0x18')]){if(_0x232780['error'][_0xeb31('0x19')]===0x1f4){logger[_0xeb31('0x18')](_0xeb31('0x13'),_0x3e5af7,_0x232780[_0xeb31('0x18')][_0xeb31('0x1a')]);return _0x2e3900(_0x232780['error'][_0xeb31('0x1a')]);}logger[_0xeb31('0x18')](_0xeb31('0x13'),_0x3e5af7,_0x232780[_0xeb31('0x18')]['message']);return _0x53f120(_0x232780[_0xeb31('0x18')][_0xeb31('0x1a')]);}else{logger[_0xeb31('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x3e5af7,'request\x20sent');_0x53f120(_0x232780['result'][_0xeb31('0x1a')]);}})[_0xeb31('0x1c')](function(_0x3af4fd){logger[_0xeb31('0x18')](_0xeb31('0x13'),_0x3e5af7,_0x3af4fd);_0x2e3900(_0x3af4fd);});});}exports[_0xeb31('0x1d')]=function(_0x17f66f){var _0xae85fb=this;return new Promise(function(_0x12c68e,_0x14b702){return db[_0xeb31('0x1e')][_0xeb31('0x1f')](_0x17f66f[_0xeb31('0x20')],{'raw':_0x17f66f[_0xeb31('0x21')]?_0x17f66f['options'][_0xeb31('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17f66f[_0xeb31('0x21')]?_0x17f66f[_0xeb31('0x21')][_0xeb31('0x23')]||null:null,'attributes':_0x17f66f['options']?_0x17f66f[_0xeb31('0x21')][_0xeb31('0x24')]||null:null,'limit':_0x17f66f[_0xeb31('0x21')]?_0x17f66f[_0xeb31('0x21')][_0xeb31('0x25')]||null:null})['then'](function(_0x40db49){logger['info'](_0xeb31('0x1d'),_0x17f66f);logger[_0xeb31('0x15')](_0xeb31('0x1d'),_0x17f66f,JSON[_0xeb31('0x17')](_0x40db49));_0x12c68e(_0x40db49);})['catch'](function(_0x4e03c6){logger['error'](_0xeb31('0x1d'),_0x4e03c6[_0xeb31('0x1a')],_0x17f66f);_0x14b702(_0xae85fb[_0xeb31('0x18')](0x1f4,_0x4e03c6[_0xeb31('0x1a')]));});});};exports[_0xeb31('0x26')]=function(_0x3f151b){return new Promise(function(_0x170d42,_0x2c97fd){return db[_0xeb31('0x1e')][_0xeb31('0x27')]({'where':_0x3f151b['options']?_0x3f151b[_0xeb31('0x21')][_0xeb31('0x23')]||null:null})[_0xeb31('0x12')](function(_0x75a4f5){if(_0x75a4f5){return _0x75a4f5['addTags'](_0x3f151b[_0xeb31('0x20')]['ids'],_[_0xeb31('0x28')](_0x3f151b[_0xeb31('0x20')],['ids','id'])||{});}})[_0xeb31('0x29')](function(_0x3d459c){logger[_0xeb31('0x1b')]('AddTags',_0x3f151b);logger[_0xeb31('0x15')]('AddTags',_0x3f151b,JSON[_0xeb31('0x17')](_0x3d459c));_0x170d42(_0x3d459c);})[_0xeb31('0x1c')](function(_0xb4eb07){logger[_0xeb31('0x18')](_0xeb31('0x2a'),_0xb4eb07['message'],_0x3f151b);_0x2c97fd(_this[_0xeb31('0x18')](0x1f4,_0xb4eb07[_0xeb31('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 0ec9cbe..2f6f9d9 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 _0x54f1=['save','remove','emit','removeListener','length','chatInteraction:','./chatInteraction.events'];(function(_0x30c604,_0x421bac){var _0x49b673=function(_0x420886){while(--_0x420886){_0x30c604['push'](_0x30c604['shift']());}};_0x49b673(++_0x421bac);}(_0x54f1,0x15d));var _0x154f=function(_0x3469bf,_0x555d52){_0x3469bf=_0x3469bf-0x0;var _0x12ce64=_0x54f1[_0x3469bf];return _0x12ce64;};'use strict';var ChatInteractionEvents=require(_0x154f('0x0'));var events=[_0x154f('0x1'),_0x154f('0x2'),'update'];function createListener(_0x1d11cb,_0x4b2874){return function(_0x3eed01){_0x4b2874[_0x154f('0x3')](_0x1d11cb,_0x3eed01);};}function removeListener(_0x4166ea,_0x1f9ed9){return function(){ChatInteractionEvents[_0x154f('0x4')](_0x4166ea,_0x1f9ed9);};}exports['register']=function(_0x17e8b8){for(var _0x3798c5=0x0,_0x2adc95=events[_0x154f('0x5')];_0x3798c5<_0x2adc95;_0x3798c5++){var _0x2768c1=events[_0x3798c5];var _0x1e1202=createListener(_0x154f('0x6')+_0x2768c1,_0x17e8b8);ChatInteractionEvents['on'](_0x2768c1,_0x1e1202);}}; \ No newline at end of file +var _0xe067=['save','update','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x4c0e5c,_0x32eb6a){var _0x5eceb3=function(_0x2a9bcf){while(--_0x2a9bcf){_0x4c0e5c['push'](_0x4c0e5c['shift']());}};_0x5eceb3(++_0x32eb6a);}(_0xe067,0x157));var _0x7e06=function(_0x5ded96,_0x35805c){_0x5ded96=_0x5ded96-0x0;var _0x3cd145=_0xe067[_0x5ded96];return _0x3cd145;};'use strict';var ChatInteractionEvents=require(_0x7e06('0x0'));var events=[_0x7e06('0x1'),'remove',_0x7e06('0x2')];function createListener(_0x1397e4,_0x5ee9ba){return function(_0x4acff4){_0x5ee9ba[_0x7e06('0x3')](_0x1397e4,_0x4acff4);};}function removeListener(_0x3aa842,_0x3f33fe){return function(){ChatInteractionEvents[_0x7e06('0x4')](_0x3aa842,_0x3f33fe);};}exports[_0x7e06('0x5')]=function(_0x40435e){for(var _0x582574=0x0,_0x1e82c6=events[_0x7e06('0x6')];_0x582574<_0x1e82c6;_0x582574++){var _0x4113de=events[_0x582574];var _0x36837d=createListener(_0x7e06('0x7')+_0x4113de,_0x40435e);ChatInteractionEvents['on'](_0x4113de,_0x36837d);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index db0c6ae..cd71a61 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 _0x3389=['getMessages','getMyMessages','/:id/download','download','post','create','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','tracked','chat','chatinteraction:addtags','addTags','chatinteraction:update','update','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','/:id','chatinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages'];(function(_0xb6dbe5,_0x2b3c0){var _0x29fa17=function(_0x421876){while(--_0x421876){_0xb6dbe5['push'](_0xb6dbe5['shift']());}};_0x29fa17(++_0x2b3c0);}(_0x3389,0x101));var _0x9338=function(_0x5d70db,_0x3dc126){_0x5d70db=_0x5d70db-0x0;var _0x270926=_0x3389[_0x5d70db];return _0x270926;};'use strict';var multer=require(_0x9338('0x0'));var util=require(_0x9338('0x1'));var path=require(_0x9338('0x2'));var timeout=require(_0x9338('0x3'));var express=require(_0x9338('0x4'));var router=express[_0x9338('0x5')]();var auth=require(_0x9338('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9338('0x7'));var controller=require('./chatInteraction.controller');router[_0x9338('0x8')]('/',auth['isAuthenticated'](),controller[_0x9338('0x9')]);router[_0x9338('0x8')](_0x9338('0xa'),auth[_0x9338('0xb')](),controller[_0x9338('0xc')]);router[_0x9338('0x8')]('/:id',auth['isChatInteractionAuthorized'](),controller[_0x9338('0xd')]);router[_0x9338('0x8')](_0x9338('0xe'),auth[_0x9338('0xf')](),controller[_0x9338('0x10')]);router[_0x9338('0x8')](_0x9338('0x11'),auth[_0x9338('0xb')](),controller[_0x9338('0x12')]);router[_0x9338('0x8')]('/:id/my_messages',auth[_0x9338('0xf')](),controller[_0x9338('0x13')]);router[_0x9338('0x8')](_0x9338('0x14'),auth[_0x9338('0xb')](),controller[_0x9338('0x15')]);router[_0x9338('0x16')]('/',auth['isAuthenticated'](),controller[_0x9338('0x17')]);var upload=multer({'storage':multer[_0x9338('0x18')]({'destination':function(_0x5cc782,_0x2c8cd1,_0x43da31){_0x43da31(null,path[_0x9338('0x19')](config[_0x9338('0x1a')],_0x9338('0x1b')));},'filename':function(_0x3b6055,_0x23e79d,_0x519bc6){_0x519bc6(null,util[_0x9338('0x1c')](_0x9338('0x1d'),Date[_0x9338('0x1e')](),_0x23e79d[_0x9338('0x1f')][_0x9338('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x9338('0x21'),upload[_0x9338('0x22')](_0x9338('0x23')),controller[_0x9338('0x24')]);router[_0x9338('0x16')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0x9338('0x16')]('/:id/tags',auth[_0x9338('0xb')](),interaction[_0x9338('0x25')](_0x9338('0x26'),_0x9338('0x27')),controller[_0x9338('0x28')]);router['put']('/:id',auth['isAuthenticated'](),interaction[_0x9338('0x25')](_0x9338('0x26'),_0x9338('0x29')),controller[_0x9338('0x2a')]);router[_0x9338('0x2b')](_0x9338('0x2c'),controller[_0x9338('0x2d')]);router['put'](_0x9338('0x2e'),auth[_0x9338('0xf')](),controller[_0x9338('0x2f')]);router['put'](_0x9338('0x30'),controller[_0x9338('0x31')]);router[_0x9338('0x32')](_0x9338('0x33'),auth[_0x9338('0xb')](),interaction[_0x9338('0x25')](_0x9338('0x26'),_0x9338('0x34')),controller[_0x9338('0x35')]);router[_0x9338('0x32')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module[_0x9338('0x36')]=router; \ No newline at end of file +var _0xc456=['exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatInteraction.controller','index','get','isAuthenticated','describe','/:id','show','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','post','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','addTags','chatinteraction:update','update','/:id/custom_update','customUpdate','put','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags'];(function(_0x5a78e2,_0x1c21bb){var _0x51286d=function(_0x253aa3){while(--_0x253aa3){_0x5a78e2['push'](_0x5a78e2['shift']());}};_0x51286d(++_0x1c21bb);}(_0xc456,0x133));var _0x6c45=function(_0x1c7b5f,_0x5b3050){_0x1c7b5f=_0x1c7b5f-0x0;var _0x37f62f=_0xc456[_0x1c7b5f];return _0x37f62f;};'use strict';var multer=require(_0x6c45('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6c45('0x1'));var express=require(_0x6c45('0x2'));var router=express[_0x6c45('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6c45('0x4'));var config=require(_0x6c45('0x5'));var controller=require(_0x6c45('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x6c45('0x7')]);router[_0x6c45('0x8')]('/describe',auth[_0x6c45('0x9')](),controller[_0x6c45('0xa')]);router[_0x6c45('0x8')](_0x6c45('0xb'),auth['isChatInteractionAuthorized'](),controller[_0x6c45('0xc')]);router[_0x6c45('0x8')]('/:id/attachment_download',auth[_0x6c45('0xd')](),controller[_0x6c45('0xe')]);router[_0x6c45('0x8')](_0x6c45('0xf'),auth['isAuthenticated'](),controller[_0x6c45('0x10')]);router[_0x6c45('0x8')](_0x6c45('0x11'),auth[_0x6c45('0xd')](),controller['getMyMessages']);router[_0x6c45('0x8')](_0x6c45('0x12'),auth['isAuthenticated'](),controller[_0x6c45('0x13')]);router[_0x6c45('0x14')]('/',auth[_0x6c45('0x9')](),controller['create']);var upload=multer({'storage':multer[_0x6c45('0x15')]({'destination':function(_0x3b7caa,_0x3b99f5,_0x24e640){_0x24e640(null,path['join'](config[_0x6c45('0x16')],_0x6c45('0x17')));},'filename':function(_0x3bfd3a,_0x2d063f,_0x1df5a0){_0x1df5a0(null,util[_0x6c45('0x18')](_0x6c45('0x19'),Date[_0x6c45('0x1a')](),_0x2d063f[_0x6c45('0x1b')][_0x6c45('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x6c45('0x14')](_0x6c45('0x1d'),upload[_0x6c45('0x1e')](_0x6c45('0x1f')),controller[_0x6c45('0x20')]);router['post']('/:id/messages',auth[_0x6c45('0xd')](),controller[_0x6c45('0x21')]);router['post'](_0x6c45('0x22'),auth['isAuthenticated'](),interaction[_0x6c45('0x23')](_0x6c45('0x24'),'chatinteraction:addtags'),controller[_0x6c45('0x25')]);router['put'](_0x6c45('0xb'),auth['isAuthenticated'](),interaction[_0x6c45('0x23')](_0x6c45('0x24'),_0x6c45('0x26')),controller[_0x6c45('0x27')]);router['put'](_0x6c45('0x28'),controller[_0x6c45('0x29')]);router[_0x6c45('0x2a')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0x6c45('0x2b')]);router['put'](_0x6c45('0x2c'),controller[_0x6c45('0x2d')]);router[_0x6c45('0x2e')](_0x6c45('0xb'),auth[_0x6c45('0x9')](),interaction[_0x6c45('0x23')](_0x6c45('0x24'),_0x6c45('0x2f')),controller[_0x6c45('0x30')]);router[_0x6c45('0x2e')](_0x6c45('0x22'),auth['isAuthenticated'](),controller[_0x6c45('0x31')]);module[_0x6c45('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 2830fc8..ebae0b4 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 _0x5f66=['exports','medium','BOOLEAN','INTEGER'];(function(_0x110563,_0x2f9226){var _0x18eec2=function(_0x1b1225){while(--_0x1b1225){_0x110563['push'](_0x110563['shift']());}};_0x18eec2(++_0x2f9226);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x65f6('0x3')]}}; \ No newline at end of file +var _0xdb28=['medium','INTEGER','sequelize','exports','TEXT'];(function(_0x381895,_0x914b55){var _0x3e8037=function(_0x4a376d){while(--_0x4a376d){_0x381895['push'](_0x381895['shift']());}};_0x3e8037(++_0x914b55);}(_0xdb28,0x106));var _0x8db2=function(_0x40f45a,_0x2d0112){_0x40f45a=_0x40f45a-0x0;var _0x2fe026=_0xdb28[_0x40f45a];return _0x2fe026;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8db2('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 67e478d..f269d85 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 _0x7bfa=['api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','error','name','send','index','map','ChatInternalMessage','rawAttributes','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','VIRTUAL','filter','merge','options','includeAll','findAll','rows','show','params','keys','include','find','catch','create','body','describe','get','messages','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','type','UserProfileSection','Agents','UserProfileResource','resourceId','push','createdAt','FromId','ToId','read','-createdAt','all','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x35d43c,_0x3b92af){var _0x54aaec=function(_0x52caaf){while(--_0x52caaf){_0x35d43c['push'](_0x35d43c['shift']());}};_0x54aaec(++_0x3b92af);}(_0x7bfa,0x1b6));var _0xa7bf=function(_0x1352f0,_0x4cd565){_0x1352f0=_0x1352f0-0x0;var _0x1c2a82=_0x7bfa[_0x1352f0];return _0x1c2a82;};'use strict';var pdf=require(_0xa7bf('0x0'));var emlformat=require(_0xa7bf('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa7bf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa7bf('0x3'));var moment=require(_0xa7bf('0x4'));var BPromise=require(_0xa7bf('0x5'));var Mustache=require(_0xa7bf('0x6'));var util=require('util');var path=require(_0xa7bf('0x7'));var sox=require(_0xa7bf('0x8'));var csv=require('to-csv');var ejs=require(_0xa7bf('0x9'));var fs=require('fs');var _=require(_0xa7bf('0xa'));var squel=require(_0xa7bf('0xb'));var crypto=require(_0xa7bf('0xc'));var jsforce=require(_0xa7bf('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa7bf('0xe'));var querystring=require(_0xa7bf('0xf'));var Papa=require(_0xa7bf('0x10'));var Redis=require(_0xa7bf('0x11'));var authService=require(_0xa7bf('0x12'));var qs=require(_0xa7bf('0x13'));var as=require(_0xa7bf('0x14'));var hardwareService=require(_0xa7bf('0x15'));var logger=require('../../config/logger')(_0xa7bf('0x16'));var utils=require(_0xa7bf('0x17'));var config=require(_0xa7bf('0x18'));var db=require(_0xa7bf('0x19'))['db'];config[_0xa7bf('0x1a')]=_[_0xa7bf('0x1b')](config[_0xa7bf('0x1a')],{'host':_0xa7bf('0x1c'),'port':0x18eb});var socket=require(_0xa7bf('0x1d'))(new Redis(config['redis']));require(_0xa7bf('0x1e'))[_0xa7bf('0x1f')](socket);function respondWithStatusCode(_0x1737c8,_0x552316){_0x552316=_0x552316||0xcc;return function(_0x953446){if(_0x953446){return _0x1737c8[_0xa7bf('0x20')](_0x552316);}return _0x1737c8[_0xa7bf('0x21')](_0x552316)[_0xa7bf('0x22')]();};}function respondWithResult(_0xaa23b9,_0x302c4c){_0x302c4c=_0x302c4c||0xc8;return function(_0x4adbf3){if(_0x4adbf3){return _0xaa23b9[_0xa7bf('0x21')](_0x302c4c)[_0xa7bf('0x23')](_0x4adbf3);}};}function respondWithFilteredResult(_0x4f030f,_0x314eeb){return function(_0x16226a){if(_0x16226a){var _0x573fcc=_0x16226a[_0xa7bf('0x24')],_0x489e39=_0x314eeb[_0xa7bf('0x25')],_0x37ac42=_0x314eeb[_0xa7bf('0x25')]+_0x314eeb[_0xa7bf('0x26')],_0x1e2cc7;if(_0x37ac42>=_0x573fcc){_0x37ac42=_0x573fcc;_0x1e2cc7=0xc8;}else{_0x1e2cc7=0xce;}_0x4f030f[_0xa7bf('0x21')](_0x1e2cc7);return _0x4f030f[_0xa7bf('0x27')](_0xa7bf('0x28'),_0x489e39+'-'+_0x37ac42+'/'+_0x573fcc)[_0xa7bf('0x23')](_0x16226a);}return null;};}function patchUpdates(_0x1abc59){return function(_0x590557){try{jsonpatch[_0xa7bf('0x29')](_0x590557,_0x1abc59,!![]);}catch(_0x3c3ac7){return BPromise['reject'](_0x3c3ac7);}return _0x590557[_0xa7bf('0x2a')]();};}function saveUpdates(_0x4c07e0,_0x2c0d75){return function(_0x2b2d05){if(_0x2b2d05){return _0x2b2d05['update'](_0x4c07e0)[_0xa7bf('0x2b')](function(_0x5b9b0b){return _0x5b9b0b;});}return null;};}function removeEntity(_0x5d3626,_0x10a0f0){return function(_0xe7ef72){if(_0xe7ef72){return _0xe7ef72[_0xa7bf('0x2c')]()['then'](function(){_0x5d3626[_0xa7bf('0x21')](0xcc)[_0xa7bf('0x22')]();});}};}function handleEntityNotFound(_0x33372e,_0x3dd0bc){return function(_0xf24f17){if(!_0xf24f17){_0x33372e[_0xa7bf('0x20')](0x194);}return _0xf24f17;};}function handleError(_0x6a5731,_0x4f546c){_0x4f546c=_0x4f546c||0x1f4;return function(_0x5a947b){logger[_0xa7bf('0x2d')](_0x5a947b['stack']);if(_0x5a947b['name']){delete _0x5a947b[_0xa7bf('0x2e')];}_0x6a5731[_0xa7bf('0x21')](_0x4f546c)[_0xa7bf('0x2f')](_0x5a947b);};}exports[_0xa7bf('0x30')]=function(_0x524243,_0x3877c3){var _0x35b540={},_0x99596a={},_0x57cdd5={'count':0x0,'rows':[]};var _0x163c2b=_[_0xa7bf('0x31')](db[_0xa7bf('0x32')][_0xa7bf('0x33')],function(_0x6770d0){return{'name':_0x6770d0['fieldName'],'type':_0x6770d0['type']['key']};});_0x99596a[_0xa7bf('0x34')]=_[_0xa7bf('0x31')](_0x163c2b,_0xa7bf('0x2e'));_0x99596a['query']=_['keys'](_0x524243[_0xa7bf('0x35')]);_0x99596a['filters']=_[_0xa7bf('0x36')](_0x99596a['model'],_0x99596a[_0xa7bf('0x35')]);_0x35b540[_0xa7bf('0x37')]=_[_0xa7bf('0x36')](_0x99596a['model'],qs[_0xa7bf('0x38')](_0x524243['query'][_0xa7bf('0x38')]));_0x35b540[_0xa7bf('0x37')]=_0x35b540[_0xa7bf('0x37')][_0xa7bf('0x39')]?_0x35b540[_0xa7bf('0x37')]:_0x99596a[_0xa7bf('0x34')];if(!_0x524243[_0xa7bf('0x35')][_0xa7bf('0x3a')](_0xa7bf('0x3b'))){_0x35b540[_0xa7bf('0x26')]=qs[_0xa7bf('0x26')](_0x524243[_0xa7bf('0x35')][_0xa7bf('0x26')]);_0x35b540[_0xa7bf('0x25')]=qs[_0xa7bf('0x25')](_0x524243[_0xa7bf('0x35')][_0xa7bf('0x25')]);}_0x35b540[_0xa7bf('0x3c')]=qs[_0xa7bf('0x3d')](_0x524243[_0xa7bf('0x35')][_0xa7bf('0x3d')]);_0x35b540['where']=qs[_0xa7bf('0x3e')](_[_0xa7bf('0x3f')](_0x524243[_0xa7bf('0x35')],_0x99596a['filters']));if(_0x524243[_0xa7bf('0x35')]['filter']){_0x35b540['where']=_['merge'](_0x35b540[_0xa7bf('0x40')],{'$or':_[_0xa7bf('0x31')](_0x163c2b,function(_0x1eb452){if(_0x1eb452['type']!==_0xa7bf('0x41')){var _0x375b57={};_0x375b57[_0x1eb452[_0xa7bf('0x2e')]]={'$like':'%'+_0x524243[_0xa7bf('0x35')][_0xa7bf('0x42')]+'%'};return _0x375b57;}})});}_0x35b540=_[_0xa7bf('0x43')]({},_0x35b540,_0x524243[_0xa7bf('0x44')]);var _0x30e76f={'where':_0x35b540[_0xa7bf('0x40')]};return db[_0xa7bf('0x32')][_0xa7bf('0x24')](_0x30e76f)[_0xa7bf('0x2b')](function(_0x1ca8a4){_0x57cdd5[_0xa7bf('0x24')]=_0x1ca8a4;if(_0x524243[_0xa7bf('0x35')][_0xa7bf('0x45')]){_0x35b540['include']=[{'all':!![]}];}return db[_0xa7bf('0x32')][_0xa7bf('0x46')](_0x35b540);})[_0xa7bf('0x2b')](function(_0x35d2f9){_0x57cdd5[_0xa7bf('0x47')]=_0x35d2f9;return _0x57cdd5;})[_0xa7bf('0x2b')](respondWithFilteredResult(_0x3877c3,_0x35b540))['catch'](handleError(_0x3877c3,null));};exports[_0xa7bf('0x48')]=function(_0x2f7381,_0x4847b3){var _0x30c72d={'raw':!![],'where':{'id':_0x2f7381[_0xa7bf('0x49')]['id']}},_0x38e657={};_0x38e657[_0xa7bf('0x34')]=_[_0xa7bf('0x4a')](db['ChatInternalMessage'][_0xa7bf('0x33')]);_0x38e657[_0xa7bf('0x35')]=_[_0xa7bf('0x4a')](_0x2f7381[_0xa7bf('0x35')]);_0x38e657[_0xa7bf('0x3e')]=_[_0xa7bf('0x36')](_0x38e657[_0xa7bf('0x34')],_0x38e657[_0xa7bf('0x35')]);_0x30c72d['attributes']=_[_0xa7bf('0x36')](_0x38e657[_0xa7bf('0x34')],qs[_0xa7bf('0x38')](_0x2f7381[_0xa7bf('0x35')][_0xa7bf('0x38')]));_0x30c72d[_0xa7bf('0x37')]=_0x30c72d['attributes'][_0xa7bf('0x39')]?_0x30c72d['attributes']:_0x38e657[_0xa7bf('0x34')];if(_0x2f7381[_0xa7bf('0x35')]['includeAll']){_0x30c72d[_0xa7bf('0x4b')]=[{'all':!![]}];}_0x30c72d=_[_0xa7bf('0x43')]({},_0x30c72d,_0x2f7381['options']);return db['ChatInternalMessage'][_0xa7bf('0x4c')](_0x30c72d)['then'](handleEntityNotFound(_0x4847b3,null))['then'](respondWithResult(_0x4847b3,null))[_0xa7bf('0x4d')](handleError(_0x4847b3,null));};exports[_0xa7bf('0x4e')]=function(_0x5155e7,_0xf18ffe){return db[_0xa7bf('0x32')][_0xa7bf('0x4e')](_0x5155e7['body'],{})[_0xa7bf('0x2b')](respondWithResult(_0xf18ffe,0xc9))[_0xa7bf('0x4d')](handleError(_0xf18ffe,null));};exports['update']=function(_0x1a3495,_0x13c1fc){if(_0x1a3495[_0xa7bf('0x4f')]['id']){delete _0x1a3495[_0xa7bf('0x4f')]['id'];}return db[_0xa7bf('0x32')][_0xa7bf('0x4c')]({'where':{'id':_0x1a3495[_0xa7bf('0x49')]['id']}})[_0xa7bf('0x2b')](handleEntityNotFound(_0x13c1fc,null))[_0xa7bf('0x2b')](saveUpdates(_0x1a3495[_0xa7bf('0x4f')],null))[_0xa7bf('0x2b')](respondWithResult(_0x13c1fc,null))[_0xa7bf('0x4d')](handleError(_0x13c1fc,null));};exports[_0xa7bf('0x2c')]=function(_0x1939de,_0x4457a7){return db[_0xa7bf('0x32')][_0xa7bf('0x4c')]({'where':{'id':_0x1939de[_0xa7bf('0x49')]['id']}})[_0xa7bf('0x2b')](handleEntityNotFound(_0x4457a7,null))[_0xa7bf('0x2b')](removeEntity(_0x4457a7,null))[_0xa7bf('0x4d')](handleError(_0x4457a7,null));};exports[_0xa7bf('0x50')]=function(_0x3c6ef7,_0x5b718b){return db[_0xa7bf('0x32')]['describe']()[_0xa7bf('0x2b')](respondWithResult(_0x5b718b,null))['catch'](handleError(_0x5b718b,null));};function wrapUser(_0x30f6d2){return function(_0x5a6a97){var _0x351230=_0x30f6d2[_0xa7bf('0x51')]({'plain':!![]});_0x351230[_0xa7bf('0x52')]=[];if(_0x5a6a97){_0x351230['lastMessageAt']=_0x5a6a97['createdAt'];_0x351230[_0xa7bf('0x53')]=_0x5a6a97;}else{_0x351230[_0xa7bf('0x54')]=moment(0x0)[_0xa7bf('0x55')](_0xa7bf('0x56'));_0x351230[_0xa7bf('0x53')]={};}return _0x351230;};}exports[_0xa7bf('0x57')]=function(_0x27dd9e,_0x2980cd,_0x22cb0e){var _0x45038d=[];return db[_0xa7bf('0x58')][_0xa7bf('0x46')]({'where':{'role':[_0xa7bf('0x59'),_0xa7bf('0x5a'),_0xa7bf('0x5b')]},'attributes':['id',_0xa7bf('0x5c'),'name',_0xa7bf('0x5d'),_0xa7bf('0x5e'),_0xa7bf('0x5f'),_0xa7bf('0x60'),_0xa7bf('0x61'),_0xa7bf('0x62'),_0xa7bf('0x63')],'order':qs['sort'](_0xa7bf('0x64')),'include':[{'model':db[_0xa7bf('0x65')],'as':_0xa7bf('0x66'),'attributes':['id',_0xa7bf('0x2e'),_0xa7bf('0x67')],'through':{'attributes':[]}}]})[_0xa7bf('0x2b')](function(_0x3691d3){if(_0x3691d3){var _0x5cd934=_0x27dd9e[_0xa7bf('0x5b')][_0xa7bf('0x51')]({'plain':!![]});if(!_0x5cd934)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cd934[_0xa7bf('0x5d')]===_0xa7bf('0x5b')){return db[_0xa7bf('0x68')][_0xa7bf('0x4c')]({'where':{'name':_0xa7bf('0x69'),'userProfileId':_0x5cd934['userProfileId']},'raw':!![]})['then'](function(_0x578e3c){if(_0x578e3c){if(_0x578e3c['autoAssociation']===0x0){return db[_0xa7bf('0x6a')]['findAll']({'where':{'sectionId':_0x578e3c['id']},'raw':!![]})[_0xa7bf('0x2b')](function(_0x164192){var _0x2bc442=[];if(_['isEmpty'](_0x164192)){_0x2bc442=_[_0xa7bf('0x42')](_0x3691d3,function(_0x436b7a){if(_0x436b7a[_0xa7bf('0x5d')]!==_0xa7bf('0x59')){return _0x436b7a;}});return _0x2bc442;}else{for(var _0x52cb92=0x0;_0x52cb92<_0x3691d3[_0xa7bf('0x39')];_0x52cb92++){var _0x2708bc=_0x3691d3[_0x52cb92];if(_0x2708bc[_0xa7bf('0x5d')]===_0xa7bf('0x59')){var _0x28fcfc=_[_0xa7bf('0x4c')](_0x164192,function(_0x2f5153){return _0x2f5153[_0xa7bf('0x6b')]===_0x2708bc['id'];});if(_0x28fcfc)_0x2bc442[_0xa7bf('0x6c')](_0x2708bc);}else{_0x2bc442[_0xa7bf('0x6c')](_0x2708bc);}}return _0x2bc442;}});}else{return _0x3691d3;}}else{var _0x52cba5=_[_0xa7bf('0x42')](_0x3691d3,function(_0x436a6c){if(_0x436a6c[_0xa7bf('0x5d')]!==_0xa7bf('0x59')){return _0x436a6c;}});return _0x52cba5;}});}else{return _0x3691d3;}}})[_0xa7bf('0x2b')](function(_0x4631d3){var _0x4ce661=[];if(_0x4631d3){_0x45038d=_0x4631d3;for(var _0x257606=0x0;_0x257606<_0x4631d3[_0xa7bf('0x39')];_0x257606+=0x1){_0x45038d[_0x257606][_0xa7bf('0x52')]=[];_0x4ce661[_0xa7bf('0x6c')](db[_0xa7bf('0x32')][_0xa7bf('0x4c')]({'where':{'FromId':[_0x27dd9e['user']['id'],_0x4631d3[_0x257606]['id']],'ToId':[_0x27dd9e['user']['id'],_0x4631d3[_0x257606]['id']],'ChatGroupId':null},'attributes':['id',_0xa7bf('0x6d'),_0xa7bf('0x6e'),_0xa7bf('0x6f'),_0xa7bf('0x70'),_0xa7bf('0x4f')],'order':qs[_0xa7bf('0x3d')](_0xa7bf('0x71')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x4631d3[_0x257606])));}return BPromise[_0xa7bf('0x72')](_0x4ce661);}return[];})[_0xa7bf('0x2b')](function(_0x327cab){return{'rows':_0x327cab,'count':_0x327cab[_0xa7bf('0x39')]};})['then'](respondWithResult(_0x2980cd,null))[_0xa7bf('0x4d')](handleError(_0x2980cd,null));}; \ No newline at end of file +var _0x1fba=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','count','include','rows','catch','show','includeAll','options','find','create','body','params','describe','get','messages','lastMessage','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','User','findAll','agent','admin','fullname','role','userpic','internal','online','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','push','createdAt','FromId','ToId','read','-createdAt','all','html-pdf','zip-dir','bluebird','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','ChatInternalMessage'];(function(_0x4f1e23,_0x166b91){var _0x4354b1=function(_0x1a3b71){while(--_0x1a3b71){_0x4f1e23['push'](_0x4f1e23['shift']());}};_0x4354b1(++_0x166b91);}(_0x1fba,0xb0));var _0xa1fb=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0x1fba[_0x47e549];return _0x251374;};'use strict';var pdf=require(_0xa1fb('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa1fb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa1fb('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa1fb('0x3'));var sox=require(_0xa1fb('0x4'));var csv=require(_0xa1fb('0x5'));var ejs=require(_0xa1fb('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa1fb('0x7'));var crypto=require(_0xa1fb('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xa1fb('0x9'));var toCsv=require(_0xa1fb('0x5'));var querystring=require(_0xa1fb('0xa'));var Papa=require(_0xa1fb('0xb'));var Redis=require(_0xa1fb('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa1fb('0xd'));var hardwareService=require(_0xa1fb('0xe'));var logger=require('../../config/logger')(_0xa1fb('0xf'));var utils=require(_0xa1fb('0x10'));var config=require(_0xa1fb('0x11'));var db=require(_0xa1fb('0x12'))['db'];config[_0xa1fb('0x13')]=_['defaults'](config[_0xa1fb('0x13')],{'host':_0xa1fb('0x14'),'port':0x18eb});var socket=require(_0xa1fb('0x15'))(new Redis(config['redis']));require(_0xa1fb('0x16'))[_0xa1fb('0x17')](socket);function respondWithStatusCode(_0xe07e52,_0x20c084){_0x20c084=_0x20c084||0xcc;return function(_0x4b46a2){if(_0x4b46a2){return _0xe07e52[_0xa1fb('0x18')](_0x20c084);}return _0xe07e52[_0xa1fb('0x19')](_0x20c084)[_0xa1fb('0x1a')]();};}function respondWithResult(_0x12c74c,_0x26d7ae){_0x26d7ae=_0x26d7ae||0xc8;return function(_0x3bcd8e){if(_0x3bcd8e){return _0x12c74c[_0xa1fb('0x19')](_0x26d7ae)[_0xa1fb('0x1b')](_0x3bcd8e);}};}function respondWithFilteredResult(_0x13f701,_0x2f5939){return function(_0x28c031){if(_0x28c031){var _0x372a96=_0x28c031['count'],_0x2b7dd7=_0x2f5939[_0xa1fb('0x1c')],_0x3a5d93=_0x2f5939[_0xa1fb('0x1c')]+_0x2f5939['limit'],_0x260265;if(_0x3a5d93>=_0x372a96){_0x3a5d93=_0x372a96;_0x260265=0xc8;}else{_0x260265=0xce;}_0x13f701[_0xa1fb('0x19')](_0x260265);return _0x13f701['set'](_0xa1fb('0x1d'),_0x2b7dd7+'-'+_0x3a5d93+'/'+_0x372a96)[_0xa1fb('0x1b')](_0x28c031);}return null;};}function patchUpdates(_0x4596a1){return function(_0x21b436){try{jsonpatch[_0xa1fb('0x1e')](_0x21b436,_0x4596a1,!![]);}catch(_0xfc43){return BPromise[_0xa1fb('0x1f')](_0xfc43);}return _0x21b436[_0xa1fb('0x20')]();};}function saveUpdates(_0x43ec80,_0x43fac5){return function(_0x1e141f){if(_0x1e141f){return _0x1e141f[_0xa1fb('0x21')](_0x43ec80)[_0xa1fb('0x22')](function(_0x377cde){return _0x377cde;});}return null;};}function removeEntity(_0x2d3f65,_0x52425b){return function(_0x15b3a7){if(_0x15b3a7){return _0x15b3a7[_0xa1fb('0x23')]()[_0xa1fb('0x22')](function(){_0x2d3f65[_0xa1fb('0x19')](0xcc)[_0xa1fb('0x1a')]();});}};}function handleEntityNotFound(_0x1c91ae,_0x5dc204){return function(_0x56ef02){if(!_0x56ef02){_0x1c91ae['sendStatus'](0x194);}return _0x56ef02;};}function handleError(_0x10f5bd,_0x359dca){_0x359dca=_0x359dca||0x1f4;return function(_0x6b1199){logger[_0xa1fb('0x24')](_0x6b1199['stack']);if(_0x6b1199[_0xa1fb('0x25')]){delete _0x6b1199['name'];}_0x10f5bd[_0xa1fb('0x19')](_0x359dca)[_0xa1fb('0x26')](_0x6b1199);};}exports[_0xa1fb('0x27')]=function(_0x171c3c,_0x2b82f9){var _0x58c012={},_0x3269c1={},_0xc3ce12={'count':0x0,'rows':[]};var _0x3e7f23=_[_0xa1fb('0x28')](db[_0xa1fb('0x29')][_0xa1fb('0x2a')],function(_0x16104b){return{'name':_0x16104b[_0xa1fb('0x2b')],'type':_0x16104b[_0xa1fb('0x2c')][_0xa1fb('0x2d')]};});_0x3269c1[_0xa1fb('0x2e')]=_[_0xa1fb('0x28')](_0x3e7f23,'name');_0x3269c1[_0xa1fb('0x2f')]=_[_0xa1fb('0x30')](_0x171c3c[_0xa1fb('0x2f')]);_0x3269c1[_0xa1fb('0x31')]=_[_0xa1fb('0x32')](_0x3269c1[_0xa1fb('0x2e')],_0x3269c1[_0xa1fb('0x2f')]);_0x58c012['attributes']=_[_0xa1fb('0x32')](_0x3269c1[_0xa1fb('0x2e')],qs[_0xa1fb('0x33')](_0x171c3c[_0xa1fb('0x2f')][_0xa1fb('0x33')]));_0x58c012[_0xa1fb('0x34')]=_0x58c012[_0xa1fb('0x34')][_0xa1fb('0x35')]?_0x58c012[_0xa1fb('0x34')]:_0x3269c1[_0xa1fb('0x2e')];if(!_0x171c3c[_0xa1fb('0x2f')][_0xa1fb('0x36')](_0xa1fb('0x37'))){_0x58c012[_0xa1fb('0x38')]=qs[_0xa1fb('0x38')](_0x171c3c['query'][_0xa1fb('0x38')]);_0x58c012[_0xa1fb('0x1c')]=qs[_0xa1fb('0x1c')](_0x171c3c[_0xa1fb('0x2f')][_0xa1fb('0x1c')]);}_0x58c012[_0xa1fb('0x39')]=qs[_0xa1fb('0x3a')](_0x171c3c['query'][_0xa1fb('0x3a')]);_0x58c012[_0xa1fb('0x3b')]=qs[_0xa1fb('0x31')](_[_0xa1fb('0x3c')](_0x171c3c['query'],_0x3269c1[_0xa1fb('0x31')]));if(_0x171c3c['query'][_0xa1fb('0x3d')]){_0x58c012[_0xa1fb('0x3b')]=_[_0xa1fb('0x3e')](_0x58c012[_0xa1fb('0x3b')],{'$or':_[_0xa1fb('0x28')](_0x3e7f23,function(_0x20ceb2){if(_0x20ceb2[_0xa1fb('0x2c')]!==_0xa1fb('0x3f')){var _0xac6d93={};_0xac6d93[_0x20ceb2[_0xa1fb('0x25')]]={'$like':'%'+_0x171c3c[_0xa1fb('0x2f')][_0xa1fb('0x3d')]+'%'};return _0xac6d93;}})});}_0x58c012=_[_0xa1fb('0x3e')]({},_0x58c012,_0x171c3c['options']);var _0x39b55f={'where':_0x58c012['where']};return db[_0xa1fb('0x29')]['count'](_0x39b55f)[_0xa1fb('0x22')](function(_0x511259){_0xc3ce12[_0xa1fb('0x40')]=_0x511259;if(_0x171c3c[_0xa1fb('0x2f')]['includeAll']){_0x58c012[_0xa1fb('0x41')]=[{'all':!![]}];}return db[_0xa1fb('0x29')]['findAll'](_0x58c012);})[_0xa1fb('0x22')](function(_0x163b4b){_0xc3ce12[_0xa1fb('0x42')]=_0x163b4b;return _0xc3ce12;})[_0xa1fb('0x22')](respondWithFilteredResult(_0x2b82f9,_0x58c012))[_0xa1fb('0x43')](handleError(_0x2b82f9,null));};exports[_0xa1fb('0x44')]=function(_0x3a12b3,_0x1bf6f6){var _0x223990={'raw':!![],'where':{'id':_0x3a12b3['params']['id']}},_0x1e3c0a={};_0x1e3c0a[_0xa1fb('0x2e')]=_['keys'](db[_0xa1fb('0x29')][_0xa1fb('0x2a')]);_0x1e3c0a[_0xa1fb('0x2f')]=_[_0xa1fb('0x30')](_0x3a12b3['query']);_0x1e3c0a[_0xa1fb('0x31')]=_['intersection'](_0x1e3c0a[_0xa1fb('0x2e')],_0x1e3c0a[_0xa1fb('0x2f')]);_0x223990['attributes']=_[_0xa1fb('0x32')](_0x1e3c0a['model'],qs[_0xa1fb('0x33')](_0x3a12b3['query'][_0xa1fb('0x33')]));_0x223990[_0xa1fb('0x34')]=_0x223990['attributes'][_0xa1fb('0x35')]?_0x223990[_0xa1fb('0x34')]:_0x1e3c0a[_0xa1fb('0x2e')];if(_0x3a12b3['query'][_0xa1fb('0x45')]){_0x223990[_0xa1fb('0x41')]=[{'all':!![]}];}_0x223990=_[_0xa1fb('0x3e')]({},_0x223990,_0x3a12b3[_0xa1fb('0x46')]);return db[_0xa1fb('0x29')][_0xa1fb('0x47')](_0x223990)[_0xa1fb('0x22')](handleEntityNotFound(_0x1bf6f6,null))[_0xa1fb('0x22')](respondWithResult(_0x1bf6f6,null))[_0xa1fb('0x43')](handleError(_0x1bf6f6,null));};exports['create']=function(_0x55920e,_0x1c1133){return db['ChatInternalMessage'][_0xa1fb('0x48')](_0x55920e[_0xa1fb('0x49')],{})[_0xa1fb('0x22')](respondWithResult(_0x1c1133,0xc9))['catch'](handleError(_0x1c1133,null));};exports['update']=function(_0x54a6a5,_0x1e3a5b){if(_0x54a6a5[_0xa1fb('0x49')]['id']){delete _0x54a6a5[_0xa1fb('0x49')]['id'];}return db[_0xa1fb('0x29')][_0xa1fb('0x47')]({'where':{'id':_0x54a6a5['params']['id']}})['then'](handleEntityNotFound(_0x1e3a5b,null))[_0xa1fb('0x22')](saveUpdates(_0x54a6a5[_0xa1fb('0x49')],null))['then'](respondWithResult(_0x1e3a5b,null))[_0xa1fb('0x43')](handleError(_0x1e3a5b,null));};exports['destroy']=function(_0x27cd13,_0x46e74f){return db[_0xa1fb('0x29')][_0xa1fb('0x47')]({'where':{'id':_0x27cd13[_0xa1fb('0x4a')]['id']}})[_0xa1fb('0x22')](handleEntityNotFound(_0x46e74f,null))['then'](removeEntity(_0x46e74f,null))[_0xa1fb('0x43')](handleError(_0x46e74f,null));};exports['describe']=function(_0x43b212,_0x35a2e5){return db[_0xa1fb('0x29')][_0xa1fb('0x4b')]()['then'](respondWithResult(_0x35a2e5,null))[_0xa1fb('0x43')](handleError(_0x35a2e5,null));};function wrapUser(_0xaf1e87){return function(_0x4dfa09){var _0x5867e6=_0xaf1e87[_0xa1fb('0x4c')]({'plain':!![]});_0x5867e6[_0xa1fb('0x4d')]=[];if(_0x4dfa09){_0x5867e6['lastMessageAt']=_0x4dfa09['createdAt'];_0x5867e6[_0xa1fb('0x4e')]=_0x4dfa09;}else{_0x5867e6[_0xa1fb('0x4f')]=moment(0x0)['format'](_0xa1fb('0x50'));_0x5867e6[_0xa1fb('0x4e')]={};}return _0x5867e6;};}exports['getUsers']=function(_0x54ac99,_0x25b323,_0x1395c2){var _0x2189fd=[];return db[_0xa1fb('0x51')][_0xa1fb('0x52')]({'where':{'role':[_0xa1fb('0x53'),_0xa1fb('0x54'),'user']},'attributes':['id',_0xa1fb('0x55'),_0xa1fb('0x25'),_0xa1fb('0x56'),_0xa1fb('0x57'),_0xa1fb('0x58'),_0xa1fb('0x59'),'lastLoginAt',_0xa1fb('0x5a'),_0xa1fb('0x5b')],'order':qs[_0xa1fb('0x3a')](_0xa1fb('0x5c')),'include':[{'model':db[_0xa1fb('0x5d')],'as':_0xa1fb('0x5e'),'attributes':['id',_0xa1fb('0x25'),'type'],'through':{'attributes':[]}}]})[_0xa1fb('0x22')](function(_0x21dcc0){if(_0x21dcc0){var _0x326314=_0x54ac99['user'][_0xa1fb('0x4c')]({'plain':!![]});if(!_0x326314)throw new Error(_0xa1fb('0x5f'));if(_0x326314[_0xa1fb('0x56')]===_0xa1fb('0x60')){return db[_0xa1fb('0x61')]['find']({'where':{'name':_0xa1fb('0x62'),'userProfileId':_0x326314[_0xa1fb('0x63')]},'raw':!![]})[_0xa1fb('0x22')](function(_0x36cb8b){if(_0x36cb8b){if(_0x36cb8b['autoAssociation']===0x0){return db[_0xa1fb('0x64')][_0xa1fb('0x52')]({'where':{'sectionId':_0x36cb8b['id']},'raw':!![]})[_0xa1fb('0x22')](function(_0x12a025){var _0x13faec=[];if(_[_0xa1fb('0x65')](_0x12a025)){_0x13faec=_['filter'](_0x21dcc0,function(_0x398750){if(_0x398750[_0xa1fb('0x56')]!==_0xa1fb('0x53')){return _0x398750;}});return _0x13faec;}else{for(var _0x1a8ea4=0x0;_0x1a8ea4<_0x21dcc0['length'];_0x1a8ea4++){var _0x28de9b=_0x21dcc0[_0x1a8ea4];if(_0x28de9b['role']==='agent'){var _0x477204=_[_0xa1fb('0x47')](_0x12a025,function(_0x3687f8){return _0x3687f8['resourceId']===_0x28de9b['id'];});if(_0x477204)_0x13faec[_0xa1fb('0x66')](_0x28de9b);}else{_0x13faec[_0xa1fb('0x66')](_0x28de9b);}}return _0x13faec;}});}else{return _0x21dcc0;}}else{var _0xcfd428=_[_0xa1fb('0x3d')](_0x21dcc0,function(_0x441446){if(_0x441446[_0xa1fb('0x56')]!==_0xa1fb('0x53')){return _0x441446;}});return _0xcfd428;}});}else{return _0x21dcc0;}}})[_0xa1fb('0x22')](function(_0x3e8aa2){var _0xa2f48=[];if(_0x3e8aa2){_0x2189fd=_0x3e8aa2;for(var _0x41b354=0x0;_0x41b354<_0x3e8aa2[_0xa1fb('0x35')];_0x41b354+=0x1){_0x2189fd[_0x41b354][_0xa1fb('0x4d')]=[];_0xa2f48[_0xa1fb('0x66')](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x54ac99[_0xa1fb('0x60')]['id'],_0x3e8aa2[_0x41b354]['id']],'ToId':[_0x54ac99['user']['id'],_0x3e8aa2[_0x41b354]['id']],'ChatGroupId':null},'attributes':['id',_0xa1fb('0x67'),_0xa1fb('0x68'),_0xa1fb('0x69'),_0xa1fb('0x6a'),_0xa1fb('0x49')],'order':qs[_0xa1fb('0x3a')](_0xa1fb('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xa1fb('0x22')](wrapUser(_0x3e8aa2[_0x41b354])));}return BPromise[_0xa1fb('0x6c')](_0xa2f48);}return[];})['then'](function(_0x5dd05a){return{'rows':_0x5dd05a,'count':_0x5dd05a['length']};})[_0xa1fb('0x22')](respondWithResult(_0x25b323,null))[_0xa1fb('0x43')](handleError(_0x25b323,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index e179081..befe20b 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 _0xccdc=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','save','update'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xccdc,0x1c4));var _0xcccd=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xccdc[_0x17b6e3];return _0x3906f3;};'use strict';var EventEmitter=require(_0xcccd('0x0'));var ChatInternalMessage=require(_0xcccd('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcccd('0x2'),'afterUpdate':_0xcccd('0x3'),'afterDestroy':_0xcccd('0x4')};function emitEvent(_0x183a99){return function(_0x41cab2,_0x2ec68c,_0x1d015d){ChatInternalMessageEvents[_0xcccd('0x5')](_0x183a99+':'+_0x41cab2['id'],_0x41cab2);ChatInternalMessageEvents[_0xcccd('0x5')](_0x183a99,_0x41cab2);_0x1d015d(null);};}for(var e in events){if(events[_0xcccd('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xcccd('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xbd50=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','save'];(function(_0x11bb7e,_0x126d14){var _0x53d275=function(_0x3a7de3){while(--_0x3a7de3){_0x11bb7e['push'](_0x11bb7e['shift']());}};_0x53d275(++_0x126d14);}(_0xbd50,0x196));var _0x0bd5=function(_0x364308,_0x2957be){_0x364308=_0x364308-0x0;var _0x52aa3e=_0xbd50[_0x364308];return _0x52aa3e;};'use strict';var EventEmitter=require(_0x0bd5('0x0'));var ChatInternalMessage=require(_0x0bd5('0x1'))['db'][_0x0bd5('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0bd5('0x3'),'afterUpdate':_0x0bd5('0x4'),'afterDestroy':_0x0bd5('0x5')};function emitEvent(_0x1e9877){return function(_0x15620d,_0x4c17ee,_0x558e89){ChatInternalMessageEvents['emit'](_0x1e9877+':'+_0x15620d['id'],_0x15620d);ChatInternalMessageEvents[_0x0bd5('0x6')](_0x1e9877,_0x15620d);_0x558e89(null);};}for(var e in events){if(events[_0x0bd5('0x7')](e)){var event=events[e];ChatInternalMessage[_0x0bd5('0x8')](e,emitEvent(event));}}module[_0x0bd5('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 3b72813..c8af3c2 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 _0xbaf0=['define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0xa51a69,_0x14b966){var _0x5b00d4=function(_0x5ca8b6){while(--_0x5ca8b6){_0xa51a69['push'](_0xa51a69['shift']());}};_0x5b00d4(++_0x14b966);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0baf('0xd')});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','../../config/logger','api','moment','bluebird'];(function(_0x641f22,_0x1b49f5){var _0x31c537=function(_0x2e6219){while(--_0x2e6219){_0x641f22['push'](_0x641f22['shift']());}};_0x31c537(++_0x1b49f5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2e58c7,_0x23d092){_0x2e58c7=_0x2e58c7-0x0;var _0x26eb00=_0xcb91[_0x2e58c7];return _0x26eb00;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatInternalMessage',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1cb9('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index dfa5f0a..344ae4a 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 _0x8c86=['moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x41018f,_0x50ddac){var _0x4e0f1f=function(_0x3bbb08){while(--_0x3bbb08){_0x41018f['push'](_0x41018f['shift']());}};_0x4e0f1f(++_0x50ddac);}(_0x8c86,0x16a));var _0x68c8=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8c86[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x68c8('0x0'));var util=require(_0x68c8('0x1'));var moment=require(_0x68c8('0x2'));var BPromise=require(_0x68c8('0x3'));var rs=require(_0x68c8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x68c8('0x5'));var logger=require('../../config/logger')(_0x68c8('0x6'));var config=require(_0x68c8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x68c8('0x8')][_0x68c8('0x9')]({'port':0x232a});config[_0x68c8('0xa')]=_[_0x68c8('0xb')](config[_0x68c8('0xa')],{'host':_0x68c8('0xc'),'port':0x18eb});var socket=require(_0x68c8('0xd'))(new Redis(config[_0x68c8('0xa')]));require(_0x68c8('0xe'))[_0x68c8('0xf')](socket);function respondWithRpcPromise(_0x5bad94,_0x15dc76,_0x4ad6b7){return new BPromise(function(_0x4b9471,_0x49b600){return client[_0x68c8('0x10')](_0x5bad94,_0x4ad6b7)[_0x68c8('0x11')](function(_0x542eee){logger[_0x68c8('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x15dc76,_0x68c8('0x13'));logger[_0x68c8('0x14')](_0x68c8('0x15'),_0x15dc76,_0x68c8('0x13'),JSON[_0x68c8('0x16')](_0x542eee));if(_0x542eee[_0x68c8('0x17')]){if(_0x542eee[_0x68c8('0x17')]['code']===0x1f4){logger[_0x68c8('0x17')](_0x68c8('0x18'),_0x15dc76,_0x542eee[_0x68c8('0x17')][_0x68c8('0x19')]);return _0x49b600(_0x542eee[_0x68c8('0x17')][_0x68c8('0x19')]);}logger['error'](_0x68c8('0x18'),_0x15dc76,_0x542eee[_0x68c8('0x17')][_0x68c8('0x19')]);return _0x4b9471(_0x542eee[_0x68c8('0x17')][_0x68c8('0x19')]);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x15dc76,_0x68c8('0x13'));_0x4b9471(_0x542eee[_0x68c8('0x1a')]['message']);}})[_0x68c8('0x1b')](function(_0x8eeb5a){logger[_0x68c8('0x17')](_0x68c8('0x18'),_0x15dc76,_0x8eeb5a);_0x49b600(_0x8eeb5a);});});} \ No newline at end of file +var _0x9d71=['message','result','ChatInternalMessage,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./chatInternalMessage.socket','register','request','info','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4e22ca,_0x5439e4){var _0xe419dc=function(_0x337fbc){while(--_0x337fbc){_0x4e22ca['push'](_0x4e22ca['shift']());}};_0xe419dc(++_0x5439e4);}(_0x9d71,0x153));var _0x19d7=function(_0x31b40b,_0x5c038a){_0x31b40b=_0x31b40b-0x0;var _0x1fc372=_0x9d71[_0x31b40b];return _0x1fc372;};'use strict';var _=require(_0x19d7('0x0'));var util=require(_0x19d7('0x1'));var moment=require(_0x19d7('0x2'));var BPromise=require(_0x19d7('0x3'));var rs=require(_0x19d7('0x4'));var fs=require('fs');var Redis=require(_0x19d7('0x5'));var db=require(_0x19d7('0x6'))['db'];var utils=require(_0x19d7('0x7'));var logger=require('../../config/logger')(_0x19d7('0x8'));var config=require(_0x19d7('0x9'));var jayson=require(_0x19d7('0xa'));var client=jayson[_0x19d7('0xb')][_0x19d7('0xc')]({'port':0x232a});config['redis']=_[_0x19d7('0xd')](config[_0x19d7('0xe')],{'host':_0x19d7('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x19d7('0xe')]));require(_0x19d7('0x10'))[_0x19d7('0x11')](socket);function respondWithRpcPromise(_0x32e45a,_0x1a1b02,_0x57ddb6){return new BPromise(function(_0x4eedd5,_0x4c5b26){return client[_0x19d7('0x12')](_0x32e45a,_0x57ddb6)['then'](function(_0x20d393){logger[_0x19d7('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x1a1b02,'request\x20sent');logger[_0x19d7('0x14')](_0x19d7('0x15'),_0x1a1b02,_0x19d7('0x16'),JSON[_0x19d7('0x17')](_0x20d393));if(_0x20d393[_0x19d7('0x18')]){if(_0x20d393[_0x19d7('0x18')]['code']===0x1f4){logger[_0x19d7('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x1a1b02,_0x20d393[_0x19d7('0x18')][_0x19d7('0x19')]);return _0x4c5b26(_0x20d393[_0x19d7('0x18')][_0x19d7('0x19')]);}logger[_0x19d7('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x1a1b02,_0x20d393[_0x19d7('0x18')][_0x19d7('0x19')]);return _0x4eedd5(_0x20d393[_0x19d7('0x18')][_0x19d7('0x19')]);}else{logger[_0x19d7('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x1a1b02,_0x19d7('0x16'));_0x4eedd5(_0x20d393[_0x19d7('0x1a')][_0x19d7('0x19')]);}})['catch'](function(_0x41b079){logger[_0x19d7('0x18')](_0x19d7('0x1b'),_0x1a1b02,_0x41b079);_0x4c5b26(_0x41b079);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index b27c8ac..fd7dc34 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 _0x94b1=['save','update','emit','removeListener','length','chatInternalMessage:'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x94b1,0x102));var _0x194b=function(_0x2cc510,_0x338acc){_0x2cc510=_0x2cc510-0x0;var _0x43989a=_0x94b1[_0x2cc510];return _0x43989a;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x194b('0x0'),'remove',_0x194b('0x1')];function createListener(_0x1d079d,_0x3a7445){return function(_0x5949d2){_0x3a7445[_0x194b('0x2')](_0x1d079d,_0x5949d2);};}function removeListener(_0x3a21be,_0x32586a){return function(){ChatInternalMessageEvents[_0x194b('0x3')](_0x3a21be,_0x32586a);};}exports['register']=function(_0x3a15fb){for(var _0x31b63d=0x0,_0x5213ad=events[_0x194b('0x4')];_0x31b63d<_0x5213ad;_0x31b63d++){var _0x4e82ac=events[_0x31b63d];var _0x24b450=createListener(_0x194b('0x5')+_0x4e82ac,_0x3a15fb);ChatInternalMessageEvents['on'](_0x4e82ac,_0x24b450);}}; \ No newline at end of file +var _0xd51f=['length','chatInternalMessage:','./chatInternalMessage.events','save','update','emit','removeListener'];(function(_0x23a299,_0x30e49c){var _0x560bb3=function(_0x1c8073){while(--_0x1c8073){_0x23a299['push'](_0x23a299['shift']());}};_0x560bb3(++_0x30e49c);}(_0xd51f,0xf0));var _0xfd51=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xd51f[_0x4e676e];return _0x336a3c;};'use strict';var ChatInternalMessageEvents=require(_0xfd51('0x0'));var events=[_0xfd51('0x1'),'remove',_0xfd51('0x2')];function createListener(_0x2745b5,_0x583496){return function(_0x1fa890){_0x583496[_0xfd51('0x3')](_0x2745b5,_0x1fa890);};}function removeListener(_0x49bb3e,_0x3efc9b){return function(){ChatInternalMessageEvents[_0xfd51('0x4')](_0x49bb3e,_0x3efc9b);};}exports['register']=function(_0x3e3517){for(var _0x3a2cd4=0x0,_0x5dc337=events[_0xfd51('0x5')];_0x3a2cd4<_0x5dc337;_0x3a2cd4++){var _0x155f37=events[_0x3a2cd4];var _0x2c3fb2=createListener(_0xfd51('0x6')+_0x155f37,_0x3e3517);ChatInternalMessageEvents['on'](_0x155f37,_0x2c3fb2);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index c1e9543..9a284b0 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 _0xcb91=['isAuthenticated','/describe','describe','/:id','show','post','put','update','delete','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x2f57fb,_0x1d5e0e){var _0x28657d=function(_0x1712b7){while(--_0x1712b7){_0x2f57fb['push'](_0x2f57fb['shift']());}};_0x28657d(++_0x1d5e0e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3ec122,_0x55150a){_0x3ec122=_0x3ec122-0x0;var _0x4ecf41=_0xcb91[_0x3ec122];return _0x4ecf41;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./chatInternalMessage.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0x6')]('/users',auth[_0x1cb9('0x7')](),controller['getUsers']);router['get'](_0x1cb9('0xa'),auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xb')]);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x7')](),controller['create']);router[_0x1cb9('0xd')](_0x1cb9('0xa'),controller[_0x1cb9('0xe')]);router[_0x1cb9('0xf')](_0x1cb9('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa9e0=['destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','/users','/:id','show','post','delete'];(function(_0x22197b,_0x3a8533){var _0x49d868=function(_0x499b13){while(--_0x499b13){_0x22197b['push'](_0x22197b['shift']());}};_0x49d868(++_0x3a8533);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getUsers']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['put']('/:id',controller['update']);router[_0x0a9e('0xe')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xf')]);module[_0x0a9e('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index f069f75..c3db280 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 _0x6c7b=['DATE','sequelize','exports','TEXT','BOOLEAN','out'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6c7b,0x7f));var _0xb6c7=function(_0x7d20a1,_0x1eb4b0){_0x7d20a1=_0x7d20a1-0x0;var _0x4abebe=_0x6c7b[_0x7d20a1];return _0x4abebe;};'use strict';var Sequelize=require(_0xb6c7('0x0'));module[_0xb6c7('0x1')]={'body':{'type':Sequelize[_0xb6c7('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xb6c7('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb6c7('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb6c7('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xb6c7('0x5')]}}; \ No newline at end of file +var _0x62f7=['medium','ENUM','exports'];(function(_0x46f989,_0x2f9695){var _0x53d23f=function(_0x281970){while(--_0x281970){_0x46f989['push'](_0x46f989['shift']());}};_0x53d23f(++_0x2f9695);}(_0x62f7,0x161));var _0x762f=function(_0xaea509,_0x199ade){_0xaea509=_0xaea509-0x0;var _0x2a9312=_0x62f7[_0xaea509];return _0x2a9312;};'use strict';var Sequelize=require('sequelize');module[_0x762f('0x0')]={'body':{'type':Sequelize['TEXT'](_0x762f('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x762f('0x2')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 55470a6..94565cd 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 _0x3ea5=['../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','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','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','limit','set','apply','save','destroy','end','name','send','index','map','ChatMessage','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','params','includeAll','find','create','body','update','describe','chat-interactions','accept','chat','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','ChatInteraction','ChatInteractionId','isNil','read1stAt','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','parse','formData','reject','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x3ea5,0x15b));var _0x53ea=function(_0x1b4883,_0xcdea06){_0x1b4883=_0x1b4883-0x0;var _0x459420=_0x3ea5[_0x1b4883];return _0x459420;};'use strict';var pdf=require(_0x53ea('0x0'));var emlformat=require(_0x53ea('0x1'));var rimraf=require(_0x53ea('0x2'));var zipdir=require(_0x53ea('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x53ea('0x4'));var moment=require(_0x53ea('0x5'));var BPromise=require(_0x53ea('0x6'));var Mustache=require(_0x53ea('0x7'));var util=require(_0x53ea('0x8'));var path=require(_0x53ea('0x9'));var sox=require(_0x53ea('0xa'));var csv=require(_0x53ea('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x53ea('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x53ea('0xd'));var toCsv=require(_0x53ea('0xb'));var querystring=require(_0x53ea('0xe'));var Papa=require(_0x53ea('0xf'));var Redis=require('ioredis');var authService=require(_0x53ea('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x53ea('0x11'));var hardwareService=require(_0x53ea('0x12'));var logger=require(_0x53ea('0x13'))(_0x53ea('0x14'));var utils=require(_0x53ea('0x15'));var config=require(_0x53ea('0x16'));var db=require(_0x53ea('0x17'))['db'];config[_0x53ea('0x18')]=_[_0x53ea('0x19')](config[_0x53ea('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x53ea('0x1a'))(new Redis(config[_0x53ea('0x18')]));require('./chatMessage.socket')[_0x53ea('0x1b')](socket);var jayson=require(_0x53ea('0x1c'));var client=jayson[_0x53ea('0x1d')][_0x53ea('0x1e')]({'port':0x232c});var client9002=jayson[_0x53ea('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x478ccd,_0x37c191,_0x495dc3){if(_0x495dc3){var _0x4b79ee=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b79ee['test'](_0x37c191)){return _0x478ccd;}else{throw new db['Sequelize'][(_0x53ea('0x1f'))](_0x53ea('0x20'));}}else{return _0x478ccd;}}function respondWithRpcPromise(_0x31f17f,_0x5ea9ea,_0x603c7c,_0x191fea){return new BPromise(function(_0x4cbdb9,_0x15ed7e){var _0x32c6c6=_0x191fea||client;return _0x32c6c6[_0x53ea('0x21')](_0x31f17f,_0x603c7c)[_0x53ea('0x22')](function(_0x48ed5b){logger[_0x53ea('0x23')]('ChatMessage,\x20%s,\x20%s',_0x5ea9ea,_0x53ea('0x24'));logger[_0x53ea('0x25')](_0x53ea('0x26'),_0x5ea9ea,_0x53ea('0x24'),JSON[_0x53ea('0x27')](_0x48ed5b));if(_0x48ed5b[_0x53ea('0x28')]){if(_0x48ed5b[_0x53ea('0x28')]['code']===0x1f4){logger[_0x53ea('0x28')](_0x53ea('0x29'),_0x5ea9ea,_0x48ed5b[_0x53ea('0x28')][_0x53ea('0x2a')]);return _0x15ed7e(_0x48ed5b[_0x53ea('0x28')][_0x53ea('0x2a')]);}logger['error'](_0x53ea('0x29'),_0x5ea9ea,_0x48ed5b[_0x53ea('0x28')][_0x53ea('0x2a')]);return _0x4cbdb9(_0x48ed5b[_0x53ea('0x28')][_0x53ea('0x2a')]);}else{logger[_0x53ea('0x23')](_0x53ea('0x29'),_0x5ea9ea,_0x53ea('0x24'));_0x4cbdb9(_0x48ed5b['result'][_0x53ea('0x2a')]);}})[_0x53ea('0x2b')](function(_0x3ccc03){logger['error'](_0x53ea('0x29'),_0x5ea9ea,_0x3ccc03);_0x15ed7e(_0x3ccc03);});});}function respondWithStatusCode(_0x30e2b6,_0x54d4b8){_0x54d4b8=_0x54d4b8||0xcc;return function(_0x2dd538){if(_0x2dd538){return _0x30e2b6[_0x53ea('0x2c')](_0x54d4b8);}return _0x30e2b6['status'](_0x54d4b8)['end']();};}function respondWithResult(_0x436156,_0x63584e){_0x63584e=_0x63584e||0xc8;return function(_0x95ff1f){if(_0x95ff1f){return _0x436156[_0x53ea('0x2d')](_0x63584e)[_0x53ea('0x2e')](_0x95ff1f);}};}function respondWithFilteredResult(_0x29e6bb,_0x4d9457){return function(_0x4b249b){if(_0x4b249b){var _0x5699a4=_0x4b249b['count'],_0x108174=_0x4d9457['offset'],_0x3a1d80=_0x4d9457[_0x53ea('0x2f')]+_0x4d9457[_0x53ea('0x30')],_0x54e9ce;if(_0x3a1d80>=_0x5699a4){_0x3a1d80=_0x5699a4;_0x54e9ce=0xc8;}else{_0x54e9ce=0xce;}_0x29e6bb[_0x53ea('0x2d')](_0x54e9ce);return _0x29e6bb[_0x53ea('0x31')]('Content-Range',_0x108174+'-'+_0x3a1d80+'/'+_0x5699a4)['json'](_0x4b249b);}return null;};}function patchUpdates(_0x4307c4){return function(_0x284a85){try{jsonpatch[_0x53ea('0x32')](_0x284a85,_0x4307c4,!![]);}catch(_0x17be04){return BPromise['reject'](_0x17be04);}return _0x284a85[_0x53ea('0x33')]();};}function saveUpdates(_0x504da7,_0x162efd){return function(_0x2fe9ac){if(_0x2fe9ac){return _0x2fe9ac['update'](_0x504da7)['then'](function(_0x3e4cb0){return _0x3e4cb0;});}return null;};}function removeEntity(_0x5961f8,_0x139d6d){return function(_0x1b60c1){if(_0x1b60c1){return _0x1b60c1[_0x53ea('0x34')]()[_0x53ea('0x22')](function(){_0x5961f8[_0x53ea('0x2d')](0xcc)[_0x53ea('0x35')]();});}};}function handleEntityNotFound(_0x11d11f,_0x1e7e95){return function(_0x4a6aea){if(!_0x4a6aea){_0x11d11f['sendStatus'](0x194);}return _0x4a6aea;};}function handleError(_0x2e49ac,_0x4013a2){_0x4013a2=_0x4013a2||0x1f4;return function(_0x495c20){logger[_0x53ea('0x28')](_0x495c20['stack']);if(_0x495c20[_0x53ea('0x36')]){delete _0x495c20[_0x53ea('0x36')];}_0x2e49ac[_0x53ea('0x2d')](_0x4013a2)[_0x53ea('0x37')](_0x495c20);};}exports[_0x53ea('0x38')]=function(_0x882145,_0x24d9d3){var _0x14bab2={},_0x343ffc={},_0x53d2cc={'count':0x0,'rows':[]};var _0x375aa3=_[_0x53ea('0x39')](db[_0x53ea('0x3a')]['rawAttributes'],function(_0x24b3bd){return{'name':_0x24b3bd['fieldName'],'type':_0x24b3bd[_0x53ea('0x3b')][_0x53ea('0x3c')]};});_0x343ffc[_0x53ea('0x3d')]=_['map'](_0x375aa3,'name');_0x343ffc[_0x53ea('0x3e')]=_[_0x53ea('0x3f')](_0x882145[_0x53ea('0x3e')]);_0x343ffc[_0x53ea('0x40')]=_[_0x53ea('0x41')](_0x343ffc[_0x53ea('0x3d')],_0x343ffc[_0x53ea('0x3e')]);_0x14bab2['attributes']=_[_0x53ea('0x41')](_0x343ffc[_0x53ea('0x3d')],qs[_0x53ea('0x42')](_0x882145['query'][_0x53ea('0x42')]));_0x14bab2['attributes']=_0x14bab2[_0x53ea('0x43')][_0x53ea('0x44')]?_0x14bab2[_0x53ea('0x43')]:_0x343ffc[_0x53ea('0x3d')];if(!_0x882145['query'][_0x53ea('0x45')](_0x53ea('0x46'))){_0x14bab2['limit']=qs[_0x53ea('0x30')](_0x882145[_0x53ea('0x3e')][_0x53ea('0x30')]);_0x14bab2[_0x53ea('0x2f')]=qs['offset'](_0x882145[_0x53ea('0x3e')][_0x53ea('0x2f')]);}_0x14bab2['order']=qs[_0x53ea('0x47')](_0x882145[_0x53ea('0x3e')][_0x53ea('0x47')]);_0x14bab2[_0x53ea('0x48')]=qs[_0x53ea('0x40')](_[_0x53ea('0x49')](_0x882145['query'],_0x343ffc[_0x53ea('0x40')]));if(_0x882145['query'][_0x53ea('0x4a')]){_0x14bab2[_0x53ea('0x48')]=_[_0x53ea('0x4b')](_0x14bab2[_0x53ea('0x48')],{'$or':_[_0x53ea('0x39')](_0x375aa3,function(_0x5c3324){if(_0x5c3324['type']!==_0x53ea('0x4c')){var _0x477afa={};_0x477afa[_0x5c3324[_0x53ea('0x36')]]={'$like':'%'+_0x882145[_0x53ea('0x3e')][_0x53ea('0x4a')]+'%'};return _0x477afa;}})});}_0x14bab2=_[_0x53ea('0x4b')]({},_0x14bab2,_0x882145[_0x53ea('0x4d')]);var _0x31b898={'where':_0x14bab2[_0x53ea('0x48')]};return db['ChatMessage']['count'](_0x31b898)[_0x53ea('0x22')](function(_0x1e895d){_0x53d2cc[_0x53ea('0x4e')]=_0x1e895d;if(_0x882145['query']['includeAll']){_0x14bab2[_0x53ea('0x4f')]=[{'all':!![]}];}return db[_0x53ea('0x3a')][_0x53ea('0x50')](_0x14bab2);})[_0x53ea('0x22')](function(_0x5ce6a8){_0x53d2cc[_0x53ea('0x51')]=_0x5ce6a8;return _0x53d2cc;})[_0x53ea('0x22')](respondWithFilteredResult(_0x24d9d3,_0x14bab2))['catch'](handleError(_0x24d9d3,null));};exports[_0x53ea('0x52')]=function(_0x5211f7,_0x3634d0){var _0x137da6={'raw':!![],'where':{'id':_0x5211f7[_0x53ea('0x53')]['id']}},_0x70b6b8={};_0x70b6b8[_0x53ea('0x3d')]=_[_0x53ea('0x3f')](db[_0x53ea('0x3a')]['rawAttributes']);_0x70b6b8['query']=_[_0x53ea('0x3f')](_0x5211f7[_0x53ea('0x3e')]);_0x70b6b8[_0x53ea('0x40')]=_['intersection'](_0x70b6b8[_0x53ea('0x3d')],_0x70b6b8[_0x53ea('0x3e')]);_0x137da6[_0x53ea('0x43')]=_[_0x53ea('0x41')](_0x70b6b8[_0x53ea('0x3d')],qs[_0x53ea('0x42')](_0x5211f7[_0x53ea('0x3e')][_0x53ea('0x42')]));_0x137da6[_0x53ea('0x43')]=_0x137da6['attributes'][_0x53ea('0x44')]?_0x137da6['attributes']:_0x70b6b8[_0x53ea('0x3d')];if(_0x5211f7['query'][_0x53ea('0x54')]){_0x137da6['include']=[{'all':!![]}];}_0x137da6=_[_0x53ea('0x4b')]({},_0x137da6,_0x5211f7[_0x53ea('0x4d')]);return db[_0x53ea('0x3a')][_0x53ea('0x55')](_0x137da6)[_0x53ea('0x22')](handleEntityNotFound(_0x3634d0,null))[_0x53ea('0x22')](respondWithResult(_0x3634d0,null))[_0x53ea('0x2b')](handleError(_0x3634d0,null));};exports[_0x53ea('0x56')]=function(_0x688d26,_0x1daae9){return db[_0x53ea('0x3a')]['create'](_0x688d26[_0x53ea('0x57')],{})[_0x53ea('0x22')](respondWithResult(_0x1daae9,0xc9))[_0x53ea('0x2b')](handleError(_0x1daae9,null));};exports[_0x53ea('0x58')]=function(_0x3f4025,_0x3469d5){if(_0x3f4025[_0x53ea('0x57')]['id']){delete _0x3f4025[_0x53ea('0x57')]['id'];}return db[_0x53ea('0x3a')][_0x53ea('0x55')]({'where':{'id':_0x3f4025['params']['id']}})[_0x53ea('0x22')](handleEntityNotFound(_0x3469d5,null))[_0x53ea('0x22')](saveUpdates(_0x3f4025[_0x53ea('0x57')],null))['then'](respondWithResult(_0x3469d5,null))[_0x53ea('0x2b')](handleError(_0x3469d5,null));};exports[_0x53ea('0x34')]=function(_0x3042dc,_0x2b24c4){return db[_0x53ea('0x3a')][_0x53ea('0x55')]({'where':{'id':_0x3042dc[_0x53ea('0x53')]['id']}})[_0x53ea('0x22')](handleEntityNotFound(_0x2b24c4,null))[_0x53ea('0x22')](removeEntity(_0x2b24c4,null))[_0x53ea('0x2b')](handleError(_0x2b24c4,null));};exports[_0x53ea('0x59')]=function(_0x397c5d,_0x4a89aa){return db[_0x53ea('0x3a')][_0x53ea('0x59')]()['then'](respondWithResult(_0x4a89aa,null))['catch'](handleError(_0x4a89aa,null));};var interaction_log=require(_0x53ea('0x13'))(_0x53ea('0x5a'));exports[_0x53ea('0x5b')]=function(_0x111c4a,_0x12b860,_0x10fb76){var _0x3c8c5e={'channel':_0x53ea('0x5c')};if(_0x111c4a[_0x53ea('0x57')]['id']){delete _0x111c4a['body']['id'];}_0x111c4a[_0x53ea('0x57')]['read']=!![];_0x111c4a[_0x53ea('0x57')]['readAt']=moment()[_0x53ea('0x5d')](_0x53ea('0x5e'));_0x111c4a[_0x53ea('0x57')]['UserId']=_0x111c4a[_0x53ea('0x57')][_0x53ea('0x5f')]||_0x111c4a[_0x53ea('0x60')]['id'];return db[_0x53ea('0x3a')][_0x53ea('0x55')]({'where':{'id':_0x111c4a[_0x53ea('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x53ea('0x61')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x12b860,null))[_0x53ea('0x22')](saveUpdates(_0x111c4a[_0x53ea('0x57')],null))[_0x53ea('0x22')](function(_0x54aacd){if(_0x54aacd){_0x3c8c5e[_0x53ea('0x2a')]=_0x54aacd['get']({'plain':!![]});return db[_0x53ea('0x62')][_0x53ea('0x55')]({'where':{'id':_0x54aacd[_0x53ea('0x63')]}});}return null;})[_0x53ea('0x22')](handleEntityNotFound(_0x12b860,null))[_0x53ea('0x22')](function(_0x220b88){if(_0x220b88){return _0x220b88['update']({'UserId':_0x111c4a[_0x53ea('0x57')][_0x53ea('0x5f')],'read1stAt':_[_0x53ea('0x64')](_0x220b88[_0x53ea('0x65')])?moment()[_0x53ea('0x5d')](_0x53ea('0x5e')):undefined});}return null;})[_0x53ea('0x22')](function(_0x1d5d67){if(_0x1d5d67){_0x3c8c5e['interaction']=_0x1d5d67[_0x53ea('0x66')]({'plain':!![]});interaction_log[_0x53ea('0x23')](_0x53ea('0x67'),_0x111c4a[_0x53ea('0x60')]['id'],_0x111c4a['user'][_0x53ea('0x36')],_0x111c4a[_0x53ea('0x60')][_0x53ea('0x68')],_0x3c8c5e[_0x53ea('0x69')]['id'],_0x111c4a[_0x53ea('0x57')]?JSON[_0x53ea('0x27')](_0x111c4a[_0x53ea('0x57')]):_0x53ea('0x6a'));return respondWithRpcPromise(_0x53ea('0x6b'),_0x53ea('0x6c'),_0x3c8c5e);}return null;})['then'](function(_0x5ba72f){if(_0x5ba72f){if(_0x111c4a[_0x53ea('0x57')][_0x53ea('0x6d')]){_0x3c8c5e[_0x53ea('0x2a')]['interface']=util['format'](_0x53ea('0x6e'),_0x111c4a[_0x53ea('0x60')]['name']);_0x3c8c5e['message'][_0x53ea('0x6f')]=_0x3c8c5e[_0x53ea('0x6f')];_0x3c8c5e[_0x53ea('0x2a')][_0x53ea('0x70')]=_0x53ea('0x5b');return respondWithRpcPromise(_0x53ea('0x71'),_0x53ea('0x71'),{'event':'acceptmessage','message':_[_0x53ea('0x4b')](_0x3c8c5e[_0x53ea('0x2a')],JSON[_0x53ea('0x72')](_0x3c8c5e[_0x53ea('0x69')][_0x53ea('0x73')]))},client9002)[_0x53ea('0x22')](function(){return _0x3c8c5e;});}return _0x3c8c5e;}return null;})[_0x53ea('0x22')](respondWithResult(_0x12b860,null))[_0x53ea('0x2b')](handleError(_0x12b860,null));};var interaction_log=require(_0x53ea('0x13'))(_0x53ea('0x5a'));exports[_0x53ea('0x74')]=function(_0xc63285,_0x1ccc0a,_0x84a37e){var _0x131002={'agent':{},'channel':'chat'};if(_0xc63285['body']['id']){delete _0xc63285[_0x53ea('0x57')]['id'];}_0xc63285[_0x53ea('0x57')][_0x53ea('0x5f')]=_0xc63285[_0x53ea('0x57')][_0x53ea('0x5f')]||_0xc63285['user']['id'];_0x131002[_0x53ea('0x75')]['id']=_0xc63285[_0x53ea('0x57')][_0x53ea('0x5f')];return db[_0x53ea('0x3a')]['find']({'where':{'id':_0xc63285[_0x53ea('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1ccc0a,null))[_0x53ea('0x22')](function(_0x4ae1d5){if(_0x4ae1d5){_0x131002[_0x53ea('0x2a')]=_0x4ae1d5[_0x53ea('0x66')]({'plain':!![]});return db[_0x53ea('0x62')][_0x53ea('0x55')]({'where':{'id':_0x4ae1d5[_0x53ea('0x63')]}});}return null;})[_0x53ea('0x22')](handleEntityNotFound(_0x1ccc0a,null))[_0x53ea('0x22')](function(_0x5bba21){if(_0x5bba21){_0x131002[_0x53ea('0x69')]=_0x5bba21[_0x53ea('0x66')]({'plain':!![]});interaction_log[_0x53ea('0x23')](_0x53ea('0x76'),_0xc63285[_0x53ea('0x60')]['id'],_0xc63285[_0x53ea('0x60')][_0x53ea('0x36')],_0xc63285[_0x53ea('0x60')][_0x53ea('0x68')],_0x131002['interaction']['id'],_0xc63285[_0x53ea('0x57')]?JSON[_0x53ea('0x27')](_0xc63285['body']):_0x53ea('0x6a'));return respondWithRpcPromise(_0x53ea('0x77'),_0x53ea('0x78'),_0x131002);}return null;})['then'](function(_0x2d7c3c){if(_0x2d7c3c){_0x2d7c3c[_0x53ea('0x2a')][_0x53ea('0x79')]=util[_0x53ea('0x5d')](_0x53ea('0x6e'),_0xc63285[_0x53ea('0x60')]['name']);_0x2d7c3c[_0x53ea('0x2a')][_0x53ea('0x6f')]=_0x131002[_0x53ea('0x6f')];_0x2d7c3c['message']['event']=_0x53ea('0x74');respondWithRpcPromise(_0x53ea('0x71'),'EventManager',{'event':_0x53ea('0x7a'),'message':_0x2d7c3c[_0x53ea('0x2a')]},client9002);return _0x131002;}return null;})[_0x53ea('0x22')](respondWithResult(_0x1ccc0a,null))[_0x53ea('0x2b')](handleError(_0x1ccc0a,null));}; \ No newline at end of file +var _0x394d=['ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','http','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','stack','name','send','index','ChatMessage','fieldName','type','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','intersection','options','find','create','body','update','params','destroy','describe','../../config/logger','chat-interactions','accept','read','readAt','format','user','ChatInteraction','ChatInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','role','null','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','formData','chat','UserId','agent','get','RejectMessage','rejectMessage','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0x394d,0x1e5));var _0xd394=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x394d[_0x599f41];return _0x2e4d58;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd394('0x0'));var rimraf=require(_0xd394('0x1'));var zipdir=require(_0xd394('0x2'));var jsonpatch=require(_0xd394('0x3'));var rp=require(_0xd394('0x4'));var moment=require('moment');var BPromise=require(_0xd394('0x5'));var Mustache=require(_0xd394('0x6'));var util=require(_0xd394('0x7'));var path=require(_0xd394('0x8'));var sox=require(_0xd394('0x9'));var csv=require(_0xd394('0xa'));var ejs=require(_0xd394('0xb'));var fs=require('fs');var _=require(_0xd394('0xc'));var squel=require(_0xd394('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd394('0xe'));var toCsv=require(_0xd394('0xa'));var querystring=require(_0xd394('0xf'));var Papa=require(_0xd394('0x10'));var Redis=require(_0xd394('0x11'));var authService=require(_0xd394('0x12'));var qs=require(_0xd394('0x13'));var as=require(_0xd394('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd394('0x15'));var utils=require(_0xd394('0x16'));var config=require(_0xd394('0x17'));var db=require('../../mysqldb')['db'];config[_0xd394('0x18')]=_[_0xd394('0x19')](config[_0xd394('0x18')],{'host':_0xd394('0x1a'),'port':0x18eb});var socket=require(_0xd394('0x1b'))(new Redis(config[_0xd394('0x18')]));require(_0xd394('0x1c'))[_0xd394('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xd394('0x1e')]({'port':0x232c});var client9002=jayson[_0xd394('0x1f')][_0xd394('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x55e4ea,_0x486ca4,_0x1f7a87){if(_0x1f7a87){var _0x21db54=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x21db54[_0xd394('0x20')](_0x486ca4)){return _0x55e4ea;}else{throw new db[(_0xd394('0x21'))][(_0xd394('0x22'))](_0xd394('0x23'));}}else{return _0x55e4ea;}}function respondWithRpcPromise(_0x53a49a,_0x372d87,_0x4a0f4e,_0x3174b9){return new BPromise(function(_0x5380a5,_0x380abd){var _0x465b90=_0x3174b9||client;return _0x465b90[_0xd394('0x24')](_0x53a49a,_0x4a0f4e)[_0xd394('0x25')](function(_0x3fec3b){logger[_0xd394('0x26')](_0xd394('0x27'),_0x372d87,_0xd394('0x28'));logger['debug'](_0xd394('0x29'),_0x372d87,_0xd394('0x28'),JSON[_0xd394('0x2a')](_0x3fec3b));if(_0x3fec3b[_0xd394('0x2b')]){if(_0x3fec3b[_0xd394('0x2b')][_0xd394('0x2c')]===0x1f4){logger[_0xd394('0x2b')](_0xd394('0x27'),_0x372d87,_0x3fec3b['error']['message']);return _0x380abd(_0x3fec3b['error'][_0xd394('0x2d')]);}logger[_0xd394('0x2b')](_0xd394('0x27'),_0x372d87,_0x3fec3b['error'][_0xd394('0x2d')]);return _0x5380a5(_0x3fec3b[_0xd394('0x2b')]['message']);}else{logger[_0xd394('0x26')](_0xd394('0x27'),_0x372d87,_0xd394('0x28'));_0x5380a5(_0x3fec3b['result']['message']);}})['catch'](function(_0x263727){logger[_0xd394('0x2b')](_0xd394('0x27'),_0x372d87,_0x263727);_0x380abd(_0x263727);});});}function respondWithStatusCode(_0x577ba7,_0x1fc8c8){_0x1fc8c8=_0x1fc8c8||0xcc;return function(_0x27c520){if(_0x27c520){return _0x577ba7[_0xd394('0x2e')](_0x1fc8c8);}return _0x577ba7[_0xd394('0x2f')](_0x1fc8c8)[_0xd394('0x30')]();};}function respondWithResult(_0x43dd79,_0x1f170a){_0x1f170a=_0x1f170a||0xc8;return function(_0x2213ad){if(_0x2213ad){return _0x43dd79['status'](_0x1f170a)[_0xd394('0x31')](_0x2213ad);}};}function respondWithFilteredResult(_0x3da5b2,_0x2bec35){return function(_0x476eac){if(_0x476eac){var _0xbb2f95=_0x476eac[_0xd394('0x32')],_0xfde97f=_0x2bec35[_0xd394('0x33')],_0x11dba5=_0x2bec35['offset']+_0x2bec35[_0xd394('0x34')],_0x5849a1;if(_0x11dba5>=_0xbb2f95){_0x11dba5=_0xbb2f95;_0x5849a1=0xc8;}else{_0x5849a1=0xce;}_0x3da5b2[_0xd394('0x2f')](_0x5849a1);return _0x3da5b2['set'](_0xd394('0x35'),_0xfde97f+'-'+_0x11dba5+'/'+_0xbb2f95)['json'](_0x476eac);}return null;};}function patchUpdates(_0x2a94b6){return function(_0x472554){try{jsonpatch[_0xd394('0x36')](_0x472554,_0x2a94b6,!![]);}catch(_0x378e16){return BPromise[_0xd394('0x37')](_0x378e16);}return _0x472554['save']();};}function saveUpdates(_0x2644a2,_0x1f8f38){return function(_0x563a7a){if(_0x563a7a){return _0x563a7a['update'](_0x2644a2)[_0xd394('0x25')](function(_0x21e589){return _0x21e589;});}return null;};}function removeEntity(_0x5cd717,_0x933537){return function(_0x1377c8){if(_0x1377c8){return _0x1377c8['destroy']()['then'](function(){_0x5cd717[_0xd394('0x2f')](0xcc)[_0xd394('0x30')]();});}};}function handleEntityNotFound(_0x30d2cd,_0x3c8687){return function(_0x1e702b){if(!_0x1e702b){_0x30d2cd[_0xd394('0x2e')](0x194);}return _0x1e702b;};}function handleError(_0x1fea3a,_0x23a0ca){_0x23a0ca=_0x23a0ca||0x1f4;return function(_0xb41f68){logger[_0xd394('0x2b')](_0xb41f68[_0xd394('0x38')]);if(_0xb41f68[_0xd394('0x39')]){delete _0xb41f68[_0xd394('0x39')];}_0x1fea3a[_0xd394('0x2f')](_0x23a0ca)[_0xd394('0x3a')](_0xb41f68);};}exports[_0xd394('0x3b')]=function(_0x122c41,_0xcbc0e8){var _0x35144a={},_0x2f0486={},_0x4d10b6={'count':0x0,'rows':[]};var _0x581bba=_['map'](db[_0xd394('0x3c')]['rawAttributes'],function(_0x1db7d7){return{'name':_0x1db7d7[_0xd394('0x3d')],'type':_0x1db7d7[_0xd394('0x3e')][_0xd394('0x3f')]};});_0x2f0486[_0xd394('0x40')]=_[_0xd394('0x41')](_0x581bba,_0xd394('0x39'));_0x2f0486[_0xd394('0x42')]=_['keys'](_0x122c41[_0xd394('0x42')]);_0x2f0486[_0xd394('0x43')]=_['intersection'](_0x2f0486[_0xd394('0x40')],_0x2f0486[_0xd394('0x42')]);_0x35144a[_0xd394('0x44')]=_['intersection'](_0x2f0486[_0xd394('0x40')],qs['fields'](_0x122c41[_0xd394('0x42')][_0xd394('0x45')]));_0x35144a['attributes']=_0x35144a[_0xd394('0x44')][_0xd394('0x46')]?_0x35144a[_0xd394('0x44')]:_0x2f0486[_0xd394('0x40')];if(!_0x122c41['query'][_0xd394('0x47')]('nolimit')){_0x35144a[_0xd394('0x34')]=qs['limit'](_0x122c41[_0xd394('0x42')]['limit']);_0x35144a[_0xd394('0x33')]=qs[_0xd394('0x33')](_0x122c41[_0xd394('0x42')]['offset']);}_0x35144a[_0xd394('0x48')]=qs[_0xd394('0x49')](_0x122c41[_0xd394('0x42')][_0xd394('0x49')]);_0x35144a['where']=qs['filters'](_['pick'](_0x122c41[_0xd394('0x42')],_0x2f0486['filters']));if(_0x122c41['query'][_0xd394('0x4a')]){_0x35144a['where']=_['merge'](_0x35144a[_0xd394('0x4b')],{'$or':_['map'](_0x581bba,function(_0x5267f4){if(_0x5267f4[_0xd394('0x3e')]!==_0xd394('0x4c')){var _0x41654b={};_0x41654b[_0x5267f4[_0xd394('0x39')]]={'$like':'%'+_0x122c41[_0xd394('0x42')][_0xd394('0x4a')]+'%'};return _0x41654b;}})});}_0x35144a=_[_0xd394('0x4d')]({},_0x35144a,_0x122c41['options']);var _0x3b4747={'where':_0x35144a['where']};return db[_0xd394('0x3c')]['count'](_0x3b4747)[_0xd394('0x25')](function(_0xb237fc){_0x4d10b6[_0xd394('0x32')]=_0xb237fc;if(_0x122c41[_0xd394('0x42')][_0xd394('0x4e')]){_0x35144a[_0xd394('0x4f')]=[{'all':!![]}];}return db['ChatMessage'][_0xd394('0x50')](_0x35144a);})['then'](function(_0x340a70){_0x4d10b6[_0xd394('0x51')]=_0x340a70;return _0x4d10b6;})[_0xd394('0x25')](respondWithFilteredResult(_0xcbc0e8,_0x35144a))[_0xd394('0x52')](handleError(_0xcbc0e8,null));};exports[_0xd394('0x53')]=function(_0x3a305a,_0xb0c885){var _0x1c6de2={'raw':!![],'where':{'id':_0x3a305a['params']['id']}},_0x1dbf3d={};_0x1dbf3d[_0xd394('0x40')]=_[_0xd394('0x54')](db[_0xd394('0x3c')][_0xd394('0x55')]);_0x1dbf3d[_0xd394('0x42')]=_[_0xd394('0x54')](_0x3a305a[_0xd394('0x42')]);_0x1dbf3d[_0xd394('0x43')]=_[_0xd394('0x56')](_0x1dbf3d[_0xd394('0x40')],_0x1dbf3d[_0xd394('0x42')]);_0x1c6de2[_0xd394('0x44')]=_[_0xd394('0x56')](_0x1dbf3d[_0xd394('0x40')],qs['fields'](_0x3a305a[_0xd394('0x42')][_0xd394('0x45')]));_0x1c6de2[_0xd394('0x44')]=_0x1c6de2[_0xd394('0x44')][_0xd394('0x46')]?_0x1c6de2[_0xd394('0x44')]:_0x1dbf3d[_0xd394('0x40')];if(_0x3a305a[_0xd394('0x42')][_0xd394('0x4e')]){_0x1c6de2[_0xd394('0x4f')]=[{'all':!![]}];}_0x1c6de2=_['merge']({},_0x1c6de2,_0x3a305a[_0xd394('0x57')]);return db[_0xd394('0x3c')][_0xd394('0x58')](_0x1c6de2)[_0xd394('0x25')](handleEntityNotFound(_0xb0c885,null))[_0xd394('0x25')](respondWithResult(_0xb0c885,null))[_0xd394('0x52')](handleError(_0xb0c885,null));};exports[_0xd394('0x59')]=function(_0x27cfd5,_0x3c2ba2){return db[_0xd394('0x3c')][_0xd394('0x59')](_0x27cfd5[_0xd394('0x5a')],{})['then'](respondWithResult(_0x3c2ba2,0xc9))[_0xd394('0x52')](handleError(_0x3c2ba2,null));};exports[_0xd394('0x5b')]=function(_0x2c3256,_0x2d9fc1){if(_0x2c3256[_0xd394('0x5a')]['id']){delete _0x2c3256[_0xd394('0x5a')]['id'];}return db[_0xd394('0x3c')][_0xd394('0x58')]({'where':{'id':_0x2c3256[_0xd394('0x5c')]['id']}})[_0xd394('0x25')](handleEntityNotFound(_0x2d9fc1,null))['then'](saveUpdates(_0x2c3256[_0xd394('0x5a')],null))[_0xd394('0x25')](respondWithResult(_0x2d9fc1,null))['catch'](handleError(_0x2d9fc1,null));};exports[_0xd394('0x5d')]=function(_0x3f29e8,_0x45156f){return db['ChatMessage'][_0xd394('0x58')]({'where':{'id':_0x3f29e8['params']['id']}})[_0xd394('0x25')](handleEntityNotFound(_0x45156f,null))[_0xd394('0x25')](removeEntity(_0x45156f,null))[_0xd394('0x52')](handleError(_0x45156f,null));};exports[_0xd394('0x5e')]=function(_0x1bd217,_0x1f307d){return db['ChatMessage'][_0xd394('0x5e')]()[_0xd394('0x25')](respondWithResult(_0x1f307d,null))[_0xd394('0x52')](handleError(_0x1f307d,null));};var interaction_log=require(_0xd394('0x5f'))(_0xd394('0x60'));exports[_0xd394('0x61')]=function(_0x4a73ce,_0xf66f7d,_0x36cb4f){var _0x3e380b={'channel':'chat'};if(_0x4a73ce[_0xd394('0x5a')]['id']){delete _0x4a73ce[_0xd394('0x5a')]['id'];}_0x4a73ce[_0xd394('0x5a')][_0xd394('0x62')]=!![];_0x4a73ce[_0xd394('0x5a')][_0xd394('0x63')]=moment()[_0xd394('0x64')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a73ce[_0xd394('0x5a')]['UserId']=_0x4a73ce[_0xd394('0x5a')]['UserId']||_0x4a73ce[_0xd394('0x65')]['id'];return db['ChatMessage'][_0xd394('0x58')]({'where':{'id':_0x4a73ce[_0xd394('0x5c')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xd394('0x25')](handleEntityNotFound(_0xf66f7d,null))['then'](saveUpdates(_0x4a73ce['body'],null))[_0xd394('0x25')](function(_0x274a77){if(_0x274a77){_0x3e380b[_0xd394('0x2d')]=_0x274a77['get']({'plain':!![]});return db[_0xd394('0x66')][_0xd394('0x58')]({'where':{'id':_0x274a77[_0xd394('0x67')]}});}return null;})[_0xd394('0x25')](handleEntityNotFound(_0xf66f7d,null))[_0xd394('0x25')](function(_0x59f1e6){if(_0x59f1e6){return _0x59f1e6[_0xd394('0x5b')]({'UserId':_0x4a73ce['body']['UserId'],'read1stAt':_[_0xd394('0x68')](_0x59f1e6['read1stAt'])?moment()[_0xd394('0x64')](_0xd394('0x69')):undefined});}return null;})[_0xd394('0x25')](function(_0x37f878){if(_0x37f878){_0x3e380b[_0xd394('0x6a')]=_0x37f878['get']({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4a73ce[_0xd394('0x65')]['id'],_0x4a73ce[_0xd394('0x65')][_0xd394('0x39')],_0x4a73ce['user'][_0xd394('0x6b')],_0x3e380b[_0xd394('0x6a')]['id'],_0x4a73ce[_0xd394('0x5a')]?JSON['stringify'](_0x4a73ce[_0xd394('0x5a')]):_0xd394('0x6c'));return respondWithRpcPromise('AcceptMessage',_0xd394('0x6d'),_0x3e380b);}return null;})[_0xd394('0x25')](function(_0xde6317){if(_0xde6317){if(_0x4a73ce['body'][_0xd394('0x6e')]){_0x3e380b[_0xd394('0x2d')][_0xd394('0x6f')]=util[_0xd394('0x64')](_0xd394('0x70'),_0x4a73ce[_0xd394('0x65')][_0xd394('0x39')]);_0x3e380b[_0xd394('0x2d')][_0xd394('0x71')]=_0x3e380b['channel'];_0x3e380b[_0xd394('0x2d')][_0xd394('0x72')]=_0xd394('0x61');return respondWithRpcPromise(_0xd394('0x73'),_0xd394('0x73'),{'event':'acceptmessage','message':_[_0xd394('0x4d')](_0x3e380b[_0xd394('0x2d')],JSON['parse'](_0x3e380b[_0xd394('0x6a')][_0xd394('0x74')]))},client9002)[_0xd394('0x25')](function(){return _0x3e380b;});}return _0x3e380b;}return null;})[_0xd394('0x25')](respondWithResult(_0xf66f7d,null))[_0xd394('0x52')](handleError(_0xf66f7d,null));};var interaction_log=require(_0xd394('0x5f'))(_0xd394('0x60'));exports[_0xd394('0x37')]=function(_0x2a23d8,_0x369571,_0x2a2a53){var _0x2bf86e={'agent':{},'channel':_0xd394('0x75')};if(_0x2a23d8[_0xd394('0x5a')]['id']){delete _0x2a23d8[_0xd394('0x5a')]['id'];}_0x2a23d8[_0xd394('0x5a')][_0xd394('0x76')]=_0x2a23d8['body'][_0xd394('0x76')]||_0x2a23d8[_0xd394('0x65')]['id'];_0x2bf86e[_0xd394('0x77')]['id']=_0x2a23d8[_0xd394('0x5a')][_0xd394('0x76')];return db[_0xd394('0x3c')][_0xd394('0x58')]({'where':{'id':_0x2a23d8[_0xd394('0x5c')]['id'],'UserId':null}})[_0xd394('0x25')](handleEntityNotFound(_0x369571,null))[_0xd394('0x25')](function(_0x2deee){if(_0x2deee){_0x2bf86e[_0xd394('0x2d')]=_0x2deee[_0xd394('0x78')]({'plain':!![]});return db[_0xd394('0x66')][_0xd394('0x58')]({'where':{'id':_0x2deee[_0xd394('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x369571,null))[_0xd394('0x25')](function(_0x143433){if(_0x143433){_0x2bf86e[_0xd394('0x6a')]=_0x143433['get']({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2a23d8[_0xd394('0x65')]['id'],_0x2a23d8[_0xd394('0x65')][_0xd394('0x39')],_0x2a23d8['user'][_0xd394('0x6b')],_0x2bf86e[_0xd394('0x6a')]['id'],_0x2a23d8[_0xd394('0x5a')]?JSON[_0xd394('0x2a')](_0x2a23d8[_0xd394('0x5a')]):_0xd394('0x6c'));return respondWithRpcPromise(_0xd394('0x79'),_0xd394('0x7a'),_0x2bf86e);}return null;})[_0xd394('0x25')](function(_0x4595d0){if(_0x4595d0){_0x4595d0[_0xd394('0x2d')][_0xd394('0x6f')]=util['format'](_0xd394('0x70'),_0x2a23d8['user'][_0xd394('0x39')]);_0x4595d0['message']['channel']=_0x2bf86e[_0xd394('0x71')];_0x4595d0[_0xd394('0x2d')][_0xd394('0x72')]=_0xd394('0x37');respondWithRpcPromise(_0xd394('0x73'),'EventManager',{'event':_0xd394('0x7b'),'message':_0x4595d0[_0xd394('0x2d')]},client9002);return _0x2bf86e;}return null;})['then'](respondWithResult(_0x369571,null))['catch'](handleError(_0x369571,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 2c2b56e..f3102a4 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 _0xf827=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x2bdbd4,_0x424bcf){var _0x5f54a6=function(_0x1786e5){while(--_0x1786e5){_0x2bdbd4['push'](_0x2bdbd4['shift']());}};_0x5f54a6(++_0x424bcf);}(_0xf827,0x1d0));var _0x7f82=function(_0x3fb930,_0x25817f){_0x3fb930=_0x3fb930-0x0;var _0x5f1eb5=_0xf827[_0x3fb930];return _0x5f1eb5;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x7f82('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x7f82('0x1')](0x0);var events={'afterCreate':_0x7f82('0x2'),'afterUpdate':_0x7f82('0x3'),'afterDestroy':_0x7f82('0x4')};function emitEvent(_0x1fd9f0){return function(_0x4d0725,_0x535b26,_0x5d82e4){ChatMessageEvents['emit'](_0x1fd9f0+':'+_0x4d0725['id'],_0x4d0725);ChatMessageEvents[_0x7f82('0x5')](_0x1fd9f0,_0x4d0725);_0x5d82e4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x7f82('0x6')](e,emitEvent(event));}}module[_0x7f82('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0x1185=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5cc8d2,_0x36d42a){var _0x1f9dda=function(_0x2fdb6e){while(--_0x2fdb6e){_0x5cc8d2['push'](_0x5cc8d2['shift']());}};_0x1f9dda(++_0x36d42a);}(_0x1185,0x170));var _0x5118=function(_0x316fe6,_0x201ab4){_0x316fe6=_0x316fe6-0x0;var _0x5de2f5=_0x1185[_0x316fe6];return _0x5de2f5;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x5118('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x5118('0x1')](0x0);var events={'afterCreate':_0x5118('0x2'),'afterUpdate':_0x5118('0x3'),'afterDestroy':_0x5118('0x4')};function emitEvent(_0x28dc04){return function(_0x49b175,_0x482273,_0x433bf4){ChatMessageEvents[_0x5118('0x5')](_0x28dc04+':'+_0x49b175['id'],_0x49b175);ChatMessageEvents[_0x5118('0x5')](_0x28dc04,_0x49b175);_0x433bf4(null);};}for(var e in events){if(events[_0x5118('0x6')](e)){var event=events[e];ChatMessage[_0x5118('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index c7a5059..b059f74 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 _0xd216=['update','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','ChatInteraction','findOne'];(function(_0x3fe137,_0x5a1094){var _0xc6e30=function(_0x49af04){while(--_0x49af04){_0x3fe137['push'](_0x3fe137['shift']());}};_0xc6e30(++_0x5a1094);}(_0xd216,0x64));var _0x6d21=function(_0x2a2fe5,_0x312bc3){_0x2a2fe5=_0x2a2fe5-0x0;var _0x1c5f1d=_0xd216[_0x2a2fe5];return _0x1c5f1d;};'use strict';var _=require(_0x6d21('0x0'));var util=require('util');var logger=require(_0x6d21('0x1'))(_0x6d21('0x2'));var moment=require(_0x6d21('0x3'));var BPromise=require('bluebird');var rp=require(_0x6d21('0x4'));var fs=require('fs');var path=require(_0x6d21('0x5'));var rimraf=require(_0x6d21('0x6'));var config=require(_0x6d21('0x7'));var attributes=require(_0x6d21('0x8'));module[_0x6d21('0x9')]=function(_0x55a03a,_0x5ea81d){return _0x55a03a['define']('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x6d21('0xa')],'type':_0x6d21('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x51853f,_0x140b73,_0x831677){var _0x5b15d5=_0x55a03a['models'];var _0xc4dfd9=_0x51853f[_0x6d21('0xc')]({'plain':!![]});if(_0xc4dfd9[_0x6d21('0xd')][_0x6d21('0xe')]()==='in'||_0xc4dfd9['direction'][_0x6d21('0xe')]()===_0x6d21('0xf')&&!_0xc4dfd9['secret']&&!_[_0x6d21('0x10')](_0xc4dfd9[_0x6d21('0x11')])){_0x5b15d5[_0x6d21('0x12')][_0x6d21('0x13')]({'where':{'id':_0xc4dfd9['ChatInteractionId']}})['then'](function(_0x4a158a){if(_0x4a158a){_0x4a158a[_0x6d21('0x14')]({'lastMsgAt':_0xc4dfd9[_0x6d21('0x15')],'lastMsgDirection':_0xc4dfd9['direction'][_0x6d21('0xe')]()});}})['catch'](function(_0x9f8a78){console['error'](_0x9f8a78);});}_0x831677();}},'charset':_0x6d21('0x16'),'collate':_0x6d21('0x17')});}; \ No newline at end of file +var _0x0bfe=['request-promise','rimraf','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','findOne','ChatInteractionId','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xb65f15,_0xd554fd){var _0x3718be=function(_0x2bb4aa){while(--_0x2bb4aa){_0xb65f15['push'](_0xb65f15['shift']());}};_0x3718be(++_0xd554fd);}(_0x0bfe,0xbe));var _0xe0bf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0bfe[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xe0bf('0x0'));var util=require(_0xe0bf('0x1'));var logger=require(_0xe0bf('0x2'))(_0xe0bf('0x3'));var moment=require(_0xe0bf('0x4'));var BPromise=require(_0xe0bf('0x5'));var rp=require(_0xe0bf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe0bf('0x7'));var config=require('../../config/environment');var attributes=require(_0xe0bf('0x8'));module[_0xe0bf('0x9')]=function(_0x11f68b,_0x3d00c5){return _0x11f68b[_0xe0bf('0xa')](_0xe0bf('0xb'),attributes,{'tableName':_0xe0bf('0xc'),'paranoid':![],'indexes':[{'name':_0xe0bf('0xd'),'fields':['body'],'type':_0xe0bf('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x392a35,_0x27e83e,_0x142e9b){var _0x22d7e7=_0x11f68b[_0xe0bf('0xf')];var _0xfc39d8=_0x392a35[_0xe0bf('0x10')]({'plain':!![]});if(_0xfc39d8[_0xe0bf('0x11')][_0xe0bf('0x12')]()==='in'||_0xfc39d8['direction'][_0xe0bf('0x12')]()===_0xe0bf('0x13')&&!_0xfc39d8[_0xe0bf('0x14')]&&!_['isNil'](_0xfc39d8['UserId'])){_0x22d7e7['ChatInteraction'][_0xe0bf('0x15')]({'where':{'id':_0xfc39d8[_0xe0bf('0x16')]}})['then'](function(_0x50ac2a){if(_0x50ac2a){_0x50ac2a[_0xe0bf('0x17')]({'lastMsgAt':_0xfc39d8[_0xe0bf('0x18')],'lastMsgDirection':_0xfc39d8[_0xe0bf('0x11')]['toLowerCase']()});}})[_0xe0bf('0x19')](function(_0x56f5a5){console['error'](_0x56f5a5);});}_0x142e9b();}},'charset':_0xe0bf('0x1a'),'collate':_0xe0bf('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 975cd3e..bce1755 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 _0x74b9=['ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','CreateChatMessage','ChatMessage','create','options','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','debug'];(function(_0x2072db,_0x1de682){var _0x4b8f6a=function(_0x36da5e){while(--_0x36da5e){_0x2072db['push'](_0x2072db['shift']());}};_0x4b8f6a(++_0x1de682);}(_0x74b9,0x110));var _0x974b=function(_0x2c7325,_0x41a967){_0x2c7325=_0x2c7325-0x0;var _0x145715=_0x74b9[_0x2c7325];return _0x145715;};'use strict';var _=require('lodash');var util=require(_0x974b('0x0'));var moment=require('moment');var BPromise=require(_0x974b('0x1'));var rs=require(_0x974b('0x2'));var fs=require('fs');var Redis=require(_0x974b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x974b('0x4'));var logger=require(_0x974b('0x5'))('rpc');var config=require(_0x974b('0x6'));var jayson=require(_0x974b('0x7'));var client=jayson[_0x974b('0x8')]['http']({'port':0x232a});config[_0x974b('0x9')]=_['defaults'](config[_0x974b('0x9')],{'host':_0x974b('0xa'),'port':0x18eb});var socket=require(_0x974b('0xb'))(new Redis(config['redis']));require(_0x974b('0xc'))['register'](socket);function respondWithRpcPromise(_0x41e76b,_0xbe9eab,_0x376087){return new BPromise(function(_0x74b4d3,_0x1bac68){return client[_0x974b('0xd')](_0x41e76b,_0x376087)[_0x974b('0xe')](function(_0x405323){logger[_0x974b('0xf')](_0x974b('0x10'),_0xbe9eab,'request\x20sent');logger[_0x974b('0x11')](_0x974b('0x12'),_0xbe9eab,'request\x20sent',JSON[_0x974b('0x13')](_0x405323));if(_0x405323[_0x974b('0x14')]){if(_0x405323[_0x974b('0x14')][_0x974b('0x15')]===0x1f4){logger[_0x974b('0x14')](_0x974b('0x10'),_0xbe9eab,_0x405323[_0x974b('0x14')][_0x974b('0x16')]);return _0x1bac68(_0x405323[_0x974b('0x14')]['message']);}logger['error'](_0x974b('0x10'),_0xbe9eab,_0x405323[_0x974b('0x14')][_0x974b('0x16')]);return _0x74b4d3(_0x405323[_0x974b('0x14')][_0x974b('0x16')]);}else{logger[_0x974b('0xf')]('ChatMessage,\x20%s,\x20%s',_0xbe9eab,_0x974b('0x17'));_0x74b4d3(_0x405323[_0x974b('0x18')][_0x974b('0x16')]);}})['catch'](function(_0x1a9e43){logger[_0x974b('0x14')](_0x974b('0x10'),_0xbe9eab,_0x1a9e43);_0x1bac68(_0x1a9e43);});});}exports[_0x974b('0x19')]=function(_0x285a64){var _0x1dc5d0=this;return new Promise(function(_0x4e7b2d,_0x3344ee){return db[_0x974b('0x1a')][_0x974b('0x1b')](_0x285a64['body'],{'raw':_0x285a64[_0x974b('0x1c')]?_0x285a64['options']['raw']===undefined?!![]:![]:!![]})[_0x974b('0xe')](function(_0x3cc5f7){logger['info'](_0x974b('0x19'),_0x285a64);logger['debug'](_0x974b('0x19'),_0x285a64,JSON[_0x974b('0x13')](_0x3cc5f7));_0x4e7b2d(_0x3cc5f7);})['catch'](function(_0x23d5e0){logger[_0x974b('0x14')]('CreateChatMessage',_0x23d5e0[_0x974b('0x16')],_0x285a64);_0x3344ee(_0x1dc5d0['error'](0x1f4,_0x23d5e0[_0x974b('0x16')]));});});}; \ No newline at end of file +var _0x84ed=['then','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateChatMessage','ChatMessage','options','debug','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request'];(function(_0x57e56d,_0x2a3b18){var _0x164071=function(_0x2645a8){while(--_0x2645a8){_0x57e56d['push'](_0x57e56d['shift']());}};_0x164071(++_0x2a3b18);}(_0x84ed,0x145));var _0xd84e=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x84ed[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xd84e('0x0'));var util=require(_0xd84e('0x1'));var moment=require(_0xd84e('0x2'));var BPromise=require(_0xd84e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd84e('0x4'));var db=require(_0xd84e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd84e('0x6'))('rpc');var config=require(_0xd84e('0x7'));var jayson=require(_0xd84e('0x8'));var client=jayson['client'][_0xd84e('0x9')]({'port':0x232a});config[_0xd84e('0xa')]=_[_0xd84e('0xb')](config['redis'],{'host':_0xd84e('0xc'),'port':0x18eb});var socket=require(_0xd84e('0xd'))(new Redis(config[_0xd84e('0xa')]));require('./chatMessage.socket')[_0xd84e('0xe')](socket);function respondWithRpcPromise(_0x3d8f12,_0x3b4221,_0x2ab7a7){return new BPromise(function(_0x1858ef,_0x3a4384){return client[_0xd84e('0xf')](_0x3d8f12,_0x2ab7a7)[_0xd84e('0x10')](function(_0x1e7040){logger['info'](_0xd84e('0x11'),_0x3b4221,_0xd84e('0x12'));logger['debug'](_0xd84e('0x13'),_0x3b4221,'request\x20sent',JSON['stringify'](_0x1e7040));if(_0x1e7040[_0xd84e('0x14')]){if(_0x1e7040['error'][_0xd84e('0x15')]===0x1f4){logger[_0xd84e('0x14')]('ChatMessage,\x20%s,\x20%s',_0x3b4221,_0x1e7040[_0xd84e('0x14')][_0xd84e('0x16')]);return _0x3a4384(_0x1e7040[_0xd84e('0x14')]['message']);}logger[_0xd84e('0x14')](_0xd84e('0x11'),_0x3b4221,_0x1e7040[_0xd84e('0x14')]['message']);return _0x1858ef(_0x1e7040[_0xd84e('0x14')][_0xd84e('0x16')]);}else{logger[_0xd84e('0x17')](_0xd84e('0x11'),_0x3b4221,'request\x20sent');_0x1858ef(_0x1e7040[_0xd84e('0x18')][_0xd84e('0x16')]);}})[_0xd84e('0x19')](function(_0x5a0f21){logger[_0xd84e('0x14')]('ChatMessage,\x20%s,\x20%s',_0x3b4221,_0x5a0f21);_0x3a4384(_0x5a0f21);});});}exports[_0xd84e('0x1a')]=function(_0x901f){var _0x1f0368=this;return new Promise(function(_0x27079c,_0x53246e){return db[_0xd84e('0x1b')]['create'](_0x901f['body'],{'raw':_0x901f['options']?_0x901f[_0xd84e('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xd84e('0x10')](function(_0x5712b3){logger[_0xd84e('0x17')](_0xd84e('0x1a'),_0x901f);logger[_0xd84e('0x1d')](_0xd84e('0x1a'),_0x901f,JSON[_0xd84e('0x1e')](_0x5712b3));_0x27079c(_0x5712b3);})[_0xd84e('0x19')](function(_0x28d5c3){logger[_0xd84e('0x14')](_0xd84e('0x1a'),_0x28d5c3[_0xd84e('0x16')],_0x901f);_0x53246e(_0x1f0368[_0xd84e('0x14')](0x1f4,_0x28d5c3[_0xd84e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 4dd69d3..d7871f5 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 _0x5f2f=['remove','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events','save'];(function(_0xcc26d2,_0x20c921){var _0x3841e2=function(_0x1ba4ea){while(--_0x1ba4ea){_0xcc26d2['push'](_0xcc26d2['shift']());}};_0x3841e2(++_0x20c921);}(_0x5f2f,0x73));var _0xf5f2=function(_0x47ac4d,_0x3a8754){_0x47ac4d=_0x47ac4d-0x0;var _0x53418d=_0x5f2f[_0x47ac4d];return _0x53418d;};'use strict';var ChatMessageEvents=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(){ChatMessageEvents[_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);ChatMessageEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0xfcf0=['removeListener','register','length','chatMessage:','./chatMessage.events','save','update'];(function(_0x3e1c03,_0x297560){var _0x48c1c0=function(_0x88b8b4){while(--_0x88b8b4){_0x3e1c03['push'](_0x3e1c03['shift']());}};_0x48c1c0(++_0x297560);}(_0xfcf0,0x138));var _0x0fcf=function(_0x330723,_0x8de382){_0x330723=_0x330723-0x0;var _0x60c546=_0xfcf0[_0x330723];return _0x60c546;};'use strict';var ChatMessageEvents=require(_0x0fcf('0x0'));var events=[_0x0fcf('0x1'),'remove',_0x0fcf('0x2')];function createListener(_0x3d8e0f,_0x366cfa){return function(_0xd744d1){_0x366cfa['emit'](_0x3d8e0f,_0xd744d1);};}function removeListener(_0x2fe6d8,_0x265968){return function(){ChatMessageEvents[_0x0fcf('0x3')](_0x2fe6d8,_0x265968);};}exports[_0x0fcf('0x4')]=function(_0x1bace8){for(var _0x1a7b03=0x0,_0x61bbb9=events[_0x0fcf('0x5')];_0x1a7b03<_0x61bbb9;_0x1a7b03++){var _0x50c575=events[_0x1a7b03];var _0x1388d1=createListener(_0x0fcf('0x6')+_0x50c575,_0x1bace8);ChatMessageEvents['on'](_0x50c575,_0x1388d1);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 0872f9c..aa68b7e 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 _0xfc9f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','post','tracked','chatmessage:create','put','update','/:id/reject','util','path','express'];(function(_0xa87ba0,_0x3468c1){var _0x4c809c=function(_0x587d6e){while(--_0x587d6e){_0xa87ba0['push'](_0xa87ba0['shift']());}};_0x4c809c(++_0x3468c1);}(_0xfc9f,0x166));var _0xffc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfc9f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xffc9('0x0'));var path=require(_0xffc9('0x1'));var timeout=require('connect-timeout');var express=require(_0xffc9('0x2'));var router=express[_0xffc9('0x3')]();var auth=require(_0xffc9('0x4'));var interaction=require(_0xffc9('0x5'));var config=require(_0xffc9('0x6'));var controller=require('./chatMessage.controller');router[_0xffc9('0x7')]('/',auth['isAuthenticated'](),controller[_0xffc9('0x8')]);router[_0xffc9('0x7')](_0xffc9('0x9'),auth['isAuthenticated'](),controller[_0xffc9('0xa')]);router[_0xffc9('0x7')](_0xffc9('0xb'),auth[_0xffc9('0xc')](),controller['show']);router[_0xffc9('0xd')]('/',auth[_0xffc9('0xc')](),interaction[_0xffc9('0xe')]('chat',_0xffc9('0xf')),controller['create']);router[_0xffc9('0x10')](_0xffc9('0xb'),controller[_0xffc9('0x11')]);router[_0xffc9('0x10')]('/:id/accept',auth[_0xffc9('0xc')](),controller['accept']);router[_0xffc9('0x10')](_0xffc9('0x12'),auth['isAuthenticated'](),controller['reject']);router['delete']('/:id',auth[_0xffc9('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1449=['chatmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','post','tracked','chat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1449,0xc7));var _0x9144=function(_0x4ea955,_0x1eda76){_0x4ea955=_0x4ea955-0x0;var _0x558561=_0x1449[_0x4ea955];return _0x558561;};'use strict';var multer=require('multer');var util=require(_0x9144('0x0'));var path=require(_0x9144('0x1'));var timeout=require(_0x9144('0x2'));var express=require(_0x9144('0x3'));var router=express[_0x9144('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9144('0x5'));var config=require(_0x9144('0x6'));var controller=require(_0x9144('0x7'));router[_0x9144('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9144('0x8')](_0x9144('0x9'),auth[_0x9144('0xa')](),controller[_0x9144('0xb')]);router['get'](_0x9144('0xc'),auth[_0x9144('0xa')](),controller[_0x9144('0xd')]);router[_0x9144('0xe')]('/',auth[_0x9144('0xa')](),interaction[_0x9144('0xf')](_0x9144('0x10'),_0x9144('0x11')),controller['create']);router[_0x9144('0x12')](_0x9144('0xc'),controller[_0x9144('0x13')]);router['put'](_0x9144('0x14'),auth[_0x9144('0xa')](),controller[_0x9144('0x15')]);router[_0x9144('0x12')](_0x9144('0x16'),auth[_0x9144('0xa')](),controller[_0x9144('0x17')]);router[_0x9144('0x18')]('/:id',auth[_0x9144('0xa')](),controller[_0x9144('0x19')]);module[_0x9144('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 39807e7..ac184c3 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 _0x309e=['sequelize','exports','TEXT'];(function(_0x4f9923,_0x5961fe){var _0x5ddd68=function(_0x225b23){while(--_0x225b23){_0x4f9923['push'](_0x4f9923['shift']());}};_0x5ddd68(++_0x5961fe);}(_0x309e,0x1d1));var _0xe309=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x309e[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0xe309('0x0'));module[_0xe309('0x1')]={'body':{'type':Sequelize[_0xe309('0x2')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0xb884=['TEXT','medium'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0xb884,0xb8));var _0x4b88=function(_0x333bb9,_0x334274){_0x333bb9=_0x333bb9-0x0;var _0xfa004a=_0xb884[_0x333bb9];return _0xfa004a;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x4b88('0x0')](_0x4b88('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index d95f741..513c5d8 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 _0x9ccd=['order','sort','where','pick','filter','merge','options','ChatOfflineMessage','includeAll','include','rows','catch','show','create','body','find','params','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','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','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x210bd0,_0x13ac96){var _0x4d8943=function(_0x1354a1){while(--_0x1354a1){_0x210bd0['push'](_0x210bd0['shift']());}};_0x4d8943(++_0x13ac96);}(_0x9ccd,0x1c7));var _0xd9cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ccd[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xd9cc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd9cc('0x1'));var zipdir=require(_0xd9cc('0x2'));var jsonpatch=require(_0xd9cc('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd9cc('0x4'));var Mustache=require(_0xd9cc('0x5'));var util=require(_0xd9cc('0x6'));var path=require(_0xd9cc('0x7'));var sox=require(_0xd9cc('0x8'));var csv=require(_0xd9cc('0x9'));var ejs=require(_0xd9cc('0xa'));var fs=require('fs');var _=require(_0xd9cc('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd9cc('0xc'));var toCsv=require(_0xd9cc('0x9'));var querystring=require(_0xd9cc('0xd'));var Papa=require(_0xd9cc('0xe'));var Redis=require(_0xd9cc('0xf'));var authService=require(_0xd9cc('0x10'));var qs=require(_0xd9cc('0x11'));var as=require(_0xd9cc('0x12'));var hardwareService=require(_0xd9cc('0x13'));var logger=require(_0xd9cc('0x14'))(_0xd9cc('0x15'));var utils=require(_0xd9cc('0x16'));var config=require(_0xd9cc('0x17'));var db=require(_0xd9cc('0x18'))['db'];function respondWithStatusCode(_0x1a6f94,_0x50abf6){_0x50abf6=_0x50abf6||0xcc;return function(_0x5b720e){if(_0x5b720e){return _0x1a6f94[_0xd9cc('0x19')](_0x50abf6);}return _0x1a6f94['status'](_0x50abf6)[_0xd9cc('0x1a')]();};}function respondWithResult(_0x459ad5,_0x153aa1){_0x153aa1=_0x153aa1||0xc8;return function(_0x1ecc7a){if(_0x1ecc7a){return _0x459ad5[_0xd9cc('0x1b')](_0x153aa1)[_0xd9cc('0x1c')](_0x1ecc7a);}};}function respondWithFilteredResult(_0x9547e6,_0xb10323){return function(_0x33558f){if(_0x33558f){var _0x41ee72=_0x33558f[_0xd9cc('0x1d')],_0xe13297=_0xb10323[_0xd9cc('0x1e')],_0x27cf3c=_0xb10323['offset']+_0xb10323[_0xd9cc('0x1f')],_0x6e68e7;if(_0x27cf3c>=_0x41ee72){_0x27cf3c=_0x41ee72;_0x6e68e7=0xc8;}else{_0x6e68e7=0xce;}_0x9547e6[_0xd9cc('0x1b')](_0x6e68e7);return _0x9547e6[_0xd9cc('0x20')](_0xd9cc('0x21'),_0xe13297+'-'+_0x27cf3c+'/'+_0x41ee72)[_0xd9cc('0x1c')](_0x33558f);}return null;};}function patchUpdates(_0x5730e6){return function(_0x2c4122){try{jsonpatch[_0xd9cc('0x22')](_0x2c4122,_0x5730e6,!![]);}catch(_0x26881c){return BPromise[_0xd9cc('0x23')](_0x26881c);}return _0x2c4122[_0xd9cc('0x24')]();};}function saveUpdates(_0xc9bf34,_0x223100){return function(_0xfe8693){if(_0xfe8693){return _0xfe8693['update'](_0xc9bf34)[_0xd9cc('0x25')](function(_0x5a8a21){return _0x5a8a21;});}return null;};}function removeEntity(_0x55d6ef,_0x5579bd){return function(_0x3a526e){if(_0x3a526e){return _0x3a526e[_0xd9cc('0x26')]()['then'](function(){_0x55d6ef[_0xd9cc('0x1b')](0xcc)[_0xd9cc('0x1a')]();});}};}function handleEntityNotFound(_0x37e03a,_0x2cffdd){return function(_0x1c3a38){if(!_0x1c3a38){_0x37e03a[_0xd9cc('0x19')](0x194);}return _0x1c3a38;};}function handleError(_0x3bdeef,_0x5e8e0c){_0x5e8e0c=_0x5e8e0c||0x1f4;return function(_0x19bf0d){logger[_0xd9cc('0x27')](_0x19bf0d[_0xd9cc('0x28')]);if(_0x19bf0d[_0xd9cc('0x29')]){delete _0x19bf0d['name'];}_0x3bdeef['status'](_0x5e8e0c)[_0xd9cc('0x2a')](_0x19bf0d);};}exports['index']=function(_0x197e53,_0x91a6b7){var _0x54c451={},_0x4403c0={},_0x5b2e15={'count':0x0,'rows':[]};var _0x555816=_[_0xd9cc('0x2b')](db['ChatOfflineMessage'][_0xd9cc('0x2c')],function(_0x3ded6f){return{'name':_0x3ded6f[_0xd9cc('0x2d')],'type':_0x3ded6f[_0xd9cc('0x2e')]['key']};});_0x4403c0[_0xd9cc('0x2f')]=_[_0xd9cc('0x2b')](_0x555816,_0xd9cc('0x29'));_0x4403c0[_0xd9cc('0x30')]=_[_0xd9cc('0x31')](_0x197e53[_0xd9cc('0x30')]);_0x4403c0[_0xd9cc('0x32')]=_[_0xd9cc('0x33')](_0x4403c0[_0xd9cc('0x2f')],_0x4403c0[_0xd9cc('0x30')]);_0x54c451[_0xd9cc('0x34')]=_['intersection'](_0x4403c0['model'],qs[_0xd9cc('0x35')](_0x197e53[_0xd9cc('0x30')][_0xd9cc('0x35')]));_0x54c451[_0xd9cc('0x34')]=_0x54c451[_0xd9cc('0x34')][_0xd9cc('0x36')]?_0x54c451[_0xd9cc('0x34')]:_0x4403c0['model'];if(!_0x197e53['query'][_0xd9cc('0x37')]('nolimit')){_0x54c451[_0xd9cc('0x1f')]=qs[_0xd9cc('0x1f')](_0x197e53['query'][_0xd9cc('0x1f')]);_0x54c451[_0xd9cc('0x1e')]=qs[_0xd9cc('0x1e')](_0x197e53[_0xd9cc('0x30')][_0xd9cc('0x1e')]);}_0x54c451[_0xd9cc('0x38')]=qs[_0xd9cc('0x39')](_0x197e53['query'][_0xd9cc('0x39')]);_0x54c451[_0xd9cc('0x3a')]=qs['filters'](_[_0xd9cc('0x3b')](_0x197e53[_0xd9cc('0x30')],_0x4403c0['filters']));if(_0x197e53['query'][_0xd9cc('0x3c')]){_0x54c451[_0xd9cc('0x3a')]=_[_0xd9cc('0x3d')](_0x54c451[_0xd9cc('0x3a')],{'$or':_[_0xd9cc('0x2b')](_0x555816,function(_0xe64ddf){if(_0xe64ddf['type']!=='VIRTUAL'){var _0x13237b={};_0x13237b[_0xe64ddf['name']]={'$like':'%'+_0x197e53['query'][_0xd9cc('0x3c')]+'%'};return _0x13237b;}})});}_0x54c451=_[_0xd9cc('0x3d')]({},_0x54c451,_0x197e53[_0xd9cc('0x3e')]);var _0xe72dd2={'where':_0x54c451['where']};return db[_0xd9cc('0x3f')][_0xd9cc('0x1d')](_0xe72dd2)[_0xd9cc('0x25')](function(_0x2f0eef){_0x5b2e15[_0xd9cc('0x1d')]=_0x2f0eef;if(_0x197e53[_0xd9cc('0x30')][_0xd9cc('0x40')]){_0x54c451[_0xd9cc('0x41')]=[{'all':!![]}];}return db[_0xd9cc('0x3f')]['findAll'](_0x54c451);})[_0xd9cc('0x25')](function(_0x58d394){_0x5b2e15[_0xd9cc('0x42')]=_0x58d394;return _0x5b2e15;})['then'](respondWithFilteredResult(_0x91a6b7,_0x54c451))[_0xd9cc('0x43')](handleError(_0x91a6b7,null));};exports[_0xd9cc('0x44')]=function(_0x5acd23,_0x2047c2){var _0x525f27={'raw':!![],'where':{'id':_0x5acd23['params']['id']}},_0x466545={};_0x466545[_0xd9cc('0x2f')]=_[_0xd9cc('0x31')](db[_0xd9cc('0x3f')]['rawAttributes']);_0x466545['query']=_[_0xd9cc('0x31')](_0x5acd23[_0xd9cc('0x30')]);_0x466545[_0xd9cc('0x32')]=_[_0xd9cc('0x33')](_0x466545[_0xd9cc('0x2f')],_0x466545[_0xd9cc('0x30')]);_0x525f27[_0xd9cc('0x34')]=_[_0xd9cc('0x33')](_0x466545[_0xd9cc('0x2f')],qs[_0xd9cc('0x35')](_0x5acd23[_0xd9cc('0x30')][_0xd9cc('0x35')]));_0x525f27[_0xd9cc('0x34')]=_0x525f27[_0xd9cc('0x34')][_0xd9cc('0x36')]?_0x525f27[_0xd9cc('0x34')]:_0x466545['model'];if(_0x5acd23[_0xd9cc('0x30')][_0xd9cc('0x40')]){_0x525f27['include']=[{'all':!![]}];}_0x525f27=_[_0xd9cc('0x3d')]({},_0x525f27,_0x5acd23['options']);return db[_0xd9cc('0x3f')]['find'](_0x525f27)['then'](handleEntityNotFound(_0x2047c2,null))[_0xd9cc('0x25')](respondWithResult(_0x2047c2,null))[_0xd9cc('0x43')](handleError(_0x2047c2,null));};exports[_0xd9cc('0x45')]=function(_0x42578d,_0x5b3f6c){return db[_0xd9cc('0x3f')][_0xd9cc('0x45')](_0x42578d[_0xd9cc('0x46')],{})[_0xd9cc('0x25')](respondWithResult(_0x5b3f6c,0xc9))['catch'](handleError(_0x5b3f6c,null));};exports['update']=function(_0x57b5f9,_0xb2ae77){if(_0x57b5f9[_0xd9cc('0x46')]['id']){delete _0x57b5f9['body']['id'];}return db[_0xd9cc('0x3f')][_0xd9cc('0x47')]({'where':{'id':_0x57b5f9[_0xd9cc('0x48')]['id']}})['then'](handleEntityNotFound(_0xb2ae77,null))['then'](saveUpdates(_0x57b5f9[_0xd9cc('0x46')],null))[_0xd9cc('0x25')](respondWithResult(_0xb2ae77,null))['catch'](handleError(_0xb2ae77,null));};exports[_0xd9cc('0x26')]=function(_0x583317,_0x1cc851){return db[_0xd9cc('0x3f')][_0xd9cc('0x47')]({'where':{'id':_0x583317[_0xd9cc('0x48')]['id']}})[_0xd9cc('0x25')](handleEntityNotFound(_0x1cc851,null))[_0xd9cc('0x25')](removeEntity(_0x1cc851,null))['catch'](handleError(_0x1cc851,null));};exports['describe']=function(_0x3f6652,_0x17fcb2){return db[_0xd9cc('0x3f')]['describe']()[_0xd9cc('0x25')](respondWithResult(_0x17fcb2,null))[_0xd9cc('0x43')](handleError(_0x17fcb2,null));}; \ No newline at end of file +var _0x5494=['merge','options','includeAll','include','ChatOfflineMessage','findAll','rows','catch','show','params','fields','find','create','body','describe','html-pdf','eml-format','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','count','offset','status','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter'];(function(_0x546ffb,_0x4350f8){var _0x4ca62a=function(_0x5e549c){while(--_0x5e549c){_0x546ffb['push'](_0x546ffb['shift']());}};_0x4ca62a(++_0x4350f8);}(_0x5494,0xe4));var _0x4549=function(_0x43e97d,_0x56a06b){_0x43e97d=_0x43e97d-0x0;var _0x424cd9=_0x5494[_0x43e97d];return _0x424cd9;};'use strict';var pdf=require(_0x4549('0x0'));var emlformat=require(_0x4549('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4549('0x2'));var BPromise=require(_0x4549('0x3'));var Mustache=require(_0x4549('0x4'));var util=require(_0x4549('0x5'));var path=require('path');var sox=require(_0x4549('0x6'));var csv=require(_0x4549('0x7'));var ejs=require(_0x4549('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4549('0x9'));var crypto=require(_0x4549('0xa'));var jsforce=require(_0x4549('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4549('0x7'));var querystring=require(_0x4549('0xc'));var Papa=require(_0x4549('0xd'));var Redis=require(_0x4549('0xe'));var authService=require(_0x4549('0xf'));var qs=require(_0x4549('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4549('0x11'));var logger=require(_0x4549('0x12'))('api');var utils=require(_0x4549('0x13'));var config=require('../../config/environment');var db=require(_0x4549('0x14'))['db'];function respondWithStatusCode(_0x1a11e0,_0x4312e6){_0x4312e6=_0x4312e6||0xcc;return function(_0x5a490c){if(_0x5a490c){return _0x1a11e0[_0x4549('0x15')](_0x4312e6);}return _0x1a11e0['status'](_0x4312e6)[_0x4549('0x16')]();};}function respondWithResult(_0x26a607,_0x345859){_0x345859=_0x345859||0xc8;return function(_0x11eef3){if(_0x11eef3){return _0x26a607['status'](_0x345859)['json'](_0x11eef3);}};}function respondWithFilteredResult(_0x39b989,_0x37ea44){return function(_0x472f1f){if(_0x472f1f){var _0x18770a=_0x472f1f[_0x4549('0x17')],_0x284f3c=_0x37ea44[_0x4549('0x18')],_0x472178=_0x37ea44[_0x4549('0x18')]+_0x37ea44['limit'],_0x16d3c3;if(_0x472178>=_0x18770a){_0x472178=_0x18770a;_0x16d3c3=0xc8;}else{_0x16d3c3=0xce;}_0x39b989[_0x4549('0x19')](_0x16d3c3);return _0x39b989[_0x4549('0x1a')](_0x4549('0x1b'),_0x284f3c+'-'+_0x472178+'/'+_0x18770a)['json'](_0x472f1f);}return null;};}function patchUpdates(_0x23518a){return function(_0x42b5f2){try{jsonpatch[_0x4549('0x1c')](_0x42b5f2,_0x23518a,!![]);}catch(_0x39b856){return BPromise[_0x4549('0x1d')](_0x39b856);}return _0x42b5f2['save']();};}function saveUpdates(_0x4d27dc,_0x374ea7){return function(_0x4d649f){if(_0x4d649f){return _0x4d649f[_0x4549('0x1e')](_0x4d27dc)[_0x4549('0x1f')](function(_0x6e0a6d){return _0x6e0a6d;});}return null;};}function removeEntity(_0x36bb14,_0x1565e7){return function(_0x452c6f){if(_0x452c6f){return _0x452c6f[_0x4549('0x20')]()[_0x4549('0x1f')](function(){_0x36bb14[_0x4549('0x19')](0xcc)[_0x4549('0x16')]();});}};}function handleEntityNotFound(_0x57bc5e,_0x12aef2){return function(_0xf1555c){if(!_0xf1555c){_0x57bc5e[_0x4549('0x15')](0x194);}return _0xf1555c;};}function handleError(_0x239f04,_0x3e6d74){_0x3e6d74=_0x3e6d74||0x1f4;return function(_0x538e4b){logger[_0x4549('0x21')](_0x538e4b['stack']);if(_0x538e4b['name']){delete _0x538e4b[_0x4549('0x22')];}_0x239f04[_0x4549('0x19')](_0x3e6d74)[_0x4549('0x23')](_0x538e4b);};}exports[_0x4549('0x24')]=function(_0x68a2e2,_0x1d597f){var _0x2c9112={},_0x4fc4f8={},_0x21a623={'count':0x0,'rows':[]};var _0xf9c4e8=_['map'](db['ChatOfflineMessage'][_0x4549('0x25')],function(_0x498450){return{'name':_0x498450[_0x4549('0x26')],'type':_0x498450[_0x4549('0x27')][_0x4549('0x28')]};});_0x4fc4f8[_0x4549('0x29')]=_[_0x4549('0x2a')](_0xf9c4e8,'name');_0x4fc4f8[_0x4549('0x2b')]=_[_0x4549('0x2c')](_0x68a2e2['query']);_0x4fc4f8[_0x4549('0x2d')]=_[_0x4549('0x2e')](_0x4fc4f8['model'],_0x4fc4f8[_0x4549('0x2b')]);_0x2c9112[_0x4549('0x2f')]=_[_0x4549('0x2e')](_0x4fc4f8[_0x4549('0x29')],qs['fields'](_0x68a2e2[_0x4549('0x2b')]['fields']));_0x2c9112['attributes']=_0x2c9112['attributes'][_0x4549('0x30')]?_0x2c9112[_0x4549('0x2f')]:_0x4fc4f8[_0x4549('0x29')];if(!_0x68a2e2[_0x4549('0x2b')][_0x4549('0x31')](_0x4549('0x32'))){_0x2c9112[_0x4549('0x33')]=qs[_0x4549('0x33')](_0x68a2e2[_0x4549('0x2b')]['limit']);_0x2c9112[_0x4549('0x18')]=qs[_0x4549('0x18')](_0x68a2e2[_0x4549('0x2b')][_0x4549('0x18')]);}_0x2c9112['order']=qs[_0x4549('0x34')](_0x68a2e2[_0x4549('0x2b')][_0x4549('0x34')]);_0x2c9112[_0x4549('0x35')]=qs['filters'](_[_0x4549('0x36')](_0x68a2e2[_0x4549('0x2b')],_0x4fc4f8[_0x4549('0x2d')]));if(_0x68a2e2['query'][_0x4549('0x37')]){_0x2c9112[_0x4549('0x35')]=_[_0x4549('0x38')](_0x2c9112['where'],{'$or':_[_0x4549('0x2a')](_0xf9c4e8,function(_0x277e9b){if(_0x277e9b[_0x4549('0x27')]!=='VIRTUAL'){var _0x38c464={};_0x38c464[_0x277e9b[_0x4549('0x22')]]={'$like':'%'+_0x68a2e2[_0x4549('0x2b')]['filter']+'%'};return _0x38c464;}})});}_0x2c9112=_[_0x4549('0x38')]({},_0x2c9112,_0x68a2e2[_0x4549('0x39')]);var _0x597ec4={'where':_0x2c9112[_0x4549('0x35')]};return db['ChatOfflineMessage'][_0x4549('0x17')](_0x597ec4)['then'](function(_0x5f2168){_0x21a623[_0x4549('0x17')]=_0x5f2168;if(_0x68a2e2[_0x4549('0x2b')][_0x4549('0x3a')]){_0x2c9112[_0x4549('0x3b')]=[{'all':!![]}];}return db[_0x4549('0x3c')][_0x4549('0x3d')](_0x2c9112);})[_0x4549('0x1f')](function(_0x440ff9){_0x21a623[_0x4549('0x3e')]=_0x440ff9;return _0x21a623;})[_0x4549('0x1f')](respondWithFilteredResult(_0x1d597f,_0x2c9112))[_0x4549('0x3f')](handleError(_0x1d597f,null));};exports[_0x4549('0x40')]=function(_0x182f0a,_0x7b256a){var _0x530d27={'raw':!![],'where':{'id':_0x182f0a[_0x4549('0x41')]['id']}},_0x521c78={};_0x521c78['model']=_[_0x4549('0x2c')](db[_0x4549('0x3c')][_0x4549('0x25')]);_0x521c78[_0x4549('0x2b')]=_['keys'](_0x182f0a[_0x4549('0x2b')]);_0x521c78[_0x4549('0x2d')]=_[_0x4549('0x2e')](_0x521c78[_0x4549('0x29')],_0x521c78[_0x4549('0x2b')]);_0x530d27['attributes']=_['intersection'](_0x521c78[_0x4549('0x29')],qs[_0x4549('0x42')](_0x182f0a[_0x4549('0x2b')][_0x4549('0x42')]));_0x530d27[_0x4549('0x2f')]=_0x530d27[_0x4549('0x2f')][_0x4549('0x30')]?_0x530d27[_0x4549('0x2f')]:_0x521c78[_0x4549('0x29')];if(_0x182f0a[_0x4549('0x2b')][_0x4549('0x3a')]){_0x530d27['include']=[{'all':!![]}];}_0x530d27=_[_0x4549('0x38')]({},_0x530d27,_0x182f0a[_0x4549('0x39')]);return db[_0x4549('0x3c')][_0x4549('0x43')](_0x530d27)[_0x4549('0x1f')](handleEntityNotFound(_0x7b256a,null))[_0x4549('0x1f')](respondWithResult(_0x7b256a,null))[_0x4549('0x3f')](handleError(_0x7b256a,null));};exports[_0x4549('0x44')]=function(_0x4053d8,_0xd63215){return db['ChatOfflineMessage'][_0x4549('0x44')](_0x4053d8['body'],{})[_0x4549('0x1f')](respondWithResult(_0xd63215,0xc9))[_0x4549('0x3f')](handleError(_0xd63215,null));};exports['update']=function(_0x1a6a25,_0x2f113c){if(_0x1a6a25[_0x4549('0x45')]['id']){delete _0x1a6a25[_0x4549('0x45')]['id'];}return db[_0x4549('0x3c')][_0x4549('0x43')]({'where':{'id':_0x1a6a25[_0x4549('0x41')]['id']}})[_0x4549('0x1f')](handleEntityNotFound(_0x2f113c,null))[_0x4549('0x1f')](saveUpdates(_0x1a6a25[_0x4549('0x45')],null))['then'](respondWithResult(_0x2f113c,null))[_0x4549('0x3f')](handleError(_0x2f113c,null));};exports[_0x4549('0x20')]=function(_0x1d8a48,_0x4404b0){return db[_0x4549('0x3c')][_0x4549('0x43')]({'where':{'id':_0x1d8a48[_0x4549('0x41')]['id']}})[_0x4549('0x1f')](handleEntityNotFound(_0x4404b0,null))[_0x4549('0x1f')](removeEntity(_0x4404b0,null))[_0x4549('0x3f')](handleError(_0x4404b0,null));};exports[_0x4549('0x46')]=function(_0x137527,_0x2b0c22){return db['ChatOfflineMessage'][_0x4549('0x46')]()[_0x4549('0x1f')](respondWithResult(_0x2b0c22,null))['catch'](handleError(_0x2b0c22,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 2b659f2..da1164c 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 _0xeec6=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','ChatOfflineMessage','chat_offline_messages'];(function(_0x5cc556,_0x158710){var _0x12103b=function(_0x13ff4a){while(--_0x13ff4a){_0x5cc556['push'](_0x5cc556['shift']());}};_0x12103b(++_0x158710);}(_0xeec6,0x1c2));var _0x6eec=function(_0x5a26f5,_0x196300){_0x5a26f5=_0x5a26f5-0x0;var _0x2e9ef7=_0xeec6[_0x5a26f5];return _0x2e9ef7;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var logger=require(_0x6eec('0x2'))(_0x6eec('0x3'));var moment=require('moment');var BPromise=require(_0x6eec('0x4'));var rp=require(_0x6eec('0x5'));var fs=require('fs');var path=require(_0x6eec('0x6'));var rimraf=require(_0x6eec('0x7'));var config=require(_0x6eec('0x8'));var attributes=require(_0x6eec('0x9'));module['exports']=function(_0x185f31,_0x3c6eda){return _0x185f31['define'](_0x6eec('0xa'),attributes,{'tableName':_0x6eec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6eec('0xc'),'collate':_0x6eec('0xd')});}; \ No newline at end of file +var _0xb7c8=['bluebird','request-promise','path','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0x2b3bdf,_0xf0242c){var _0x962e0f=function(_0x559525){while(--_0x559525){_0x2b3bdf['push'](_0x2b3bdf['shift']());}};_0x962e0f(++_0xf0242c);}(_0xb7c8,0x119));var _0x8b7c=function(_0x408405,_0x55b51f){_0x408405=_0x408405-0x0;var _0x3a10d9=_0xb7c8[_0x408405];return _0x3a10d9;};'use strict';var _=require('lodash');var util=require(_0x8b7c('0x0'));var logger=require(_0x8b7c('0x1'))(_0x8b7c('0x2'));var moment=require(_0x8b7c('0x3'));var BPromise=require(_0x8b7c('0x4'));var rp=require(_0x8b7c('0x5'));var fs=require('fs');var path=require(_0x8b7c('0x6'));var rimraf=require('rimraf');var config=require(_0x8b7c('0x7'));var attributes=require(_0x8b7c('0x8'));module[_0x8b7c('0x9')]=function(_0x440900,_0x107428){return _0x440900[_0x8b7c('0xa')](_0x8b7c('0xb'),attributes,{'tableName':_0x8b7c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8b7c('0xd'),'collate':_0x8b7c('0xe')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index acc5aa6..c66c773 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 _0x5483=['error','code','message','result','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s'];(function(_0x494beb,_0x466d22){var _0x4b7676=function(_0xb26a32){while(--_0xb26a32){_0x494beb['push'](_0x494beb['shift']());}};_0x4b7676(++_0x466d22);}(_0x5483,0xae));var _0x3548=function(_0x352d28,_0x444033){_0x352d28=_0x352d28-0x0;var _0x387d7e=_0x5483[_0x352d28];return _0x387d7e;};'use strict';var _=require('lodash');var util=require(_0x3548('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3548('0x1'));var fs=require('fs');var Redis=require(_0x3548('0x2'));var db=require(_0x3548('0x3'))['db'];var utils=require(_0x3548('0x4'));var logger=require('../../config/logger')(_0x3548('0x5'));var config=require('../../config/environment');var jayson=require(_0x3548('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x44580b,_0x1762b7,_0x5dff4b){return new BPromise(function(_0x2c1f19,_0x3b34df){return client['request'](_0x44580b,_0x5dff4b)[_0x3548('0x7')](function(_0x3d0292){logger[_0x3548('0x8')](_0x3548('0x9'),_0x1762b7,_0x3548('0xa'));logger[_0x3548('0xb')](_0x3548('0xc'),_0x1762b7,_0x3548('0xa'),JSON['stringify'](_0x3d0292));if(_0x3d0292[_0x3548('0xd')]){if(_0x3d0292['error'][_0x3548('0xe')]===0x1f4){logger[_0x3548('0xd')](_0x3548('0x9'),_0x1762b7,_0x3d0292[_0x3548('0xd')][_0x3548('0xf')]);return _0x3b34df(_0x3d0292['error'][_0x3548('0xf')]);}logger[_0x3548('0xd')](_0x3548('0x9'),_0x1762b7,_0x3d0292[_0x3548('0xd')][_0x3548('0xf')]);return _0x2c1f19(_0x3d0292[_0x3548('0xd')]['message']);}else{logger[_0x3548('0x8')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1762b7,'request\x20sent');_0x2c1f19(_0x3d0292[_0x3548('0x10')][_0x3548('0xf')]);}})['catch'](function(_0x556862){logger[_0x3548('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1762b7,_0x556862);_0x3b34df(_0x556862);});});} \ No newline at end of file +var _0x3de6=['jayson/promise','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1cc70e,_0x106bf5){var _0x452e79=function(_0x88550e){while(--_0x88550e){_0x1cc70e['push'](_0x1cc70e['shift']());}};_0x452e79(++_0x106bf5);}(_0x3de6,0x9f));var _0x63de=function(_0x5645ce,_0xd8fc71){_0x5645ce=_0x5645ce-0x0;var _0x16c1b3=_0x3de6[_0x5645ce];return _0x16c1b3;};'use strict';var _=require(_0x63de('0x0'));var util=require(_0x63de('0x1'));var moment=require(_0x63de('0x2'));var BPromise=require(_0x63de('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x63de('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x63de('0x5'));var logger=require(_0x63de('0x6'))(_0x63de('0x7'));var config=require(_0x63de('0x8'));var jayson=require(_0x63de('0x9'));var client=jayson['client'][_0x63de('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x418baf,_0x190167,_0x462091){return new BPromise(function(_0x5d936d,_0x33bd61){return client['request'](_0x418baf,_0x462091)[_0x63de('0xb')](function(_0x10b5c7){logger[_0x63de('0xc')](_0x63de('0xd'),_0x190167,_0x63de('0xe'));logger[_0x63de('0xf')](_0x63de('0x10'),_0x190167,'request\x20sent',JSON[_0x63de('0x11')](_0x10b5c7));if(_0x10b5c7['error']){if(_0x10b5c7['error']['code']===0x1f4){logger[_0x63de('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x190167,_0x10b5c7[_0x63de('0x12')]['message']);return _0x33bd61(_0x10b5c7['error']['message']);}logger['error'](_0x63de('0xd'),_0x190167,_0x10b5c7[_0x63de('0x12')][_0x63de('0x13')]);return _0x5d936d(_0x10b5c7[_0x63de('0x12')][_0x63de('0x13')]);}else{logger[_0x63de('0xc')](_0x63de('0xd'),_0x190167,_0x63de('0xe'));_0x5d936d(_0x10b5c7[_0x63de('0x14')][_0x63de('0x13')]);}})['catch'](function(_0x52fc9d){logger[_0x63de('0x12')](_0x63de('0xd'),_0x190167,_0x52fc9d);_0x33bd61(_0x52fc9d);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index a2cd096..d1d7730 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 _0x6b89=['update','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x2a16d3,_0x116950){var _0xcf121b=function(_0x1d50c3){while(--_0x1d50c3){_0x2a16d3['push'](_0x2a16d3['shift']());}};_0xcf121b(++_0x116950);}(_0x6b89,0xed));var _0x96b8=function(_0x22ec54,_0x272372){_0x22ec54=_0x22ec54-0x0;var _0x63de4f=_0x6b89[_0x22ec54];return _0x63de4f;};'use strict';var multer=require(_0x96b8('0x0'));var util=require(_0x96b8('0x1'));var path=require(_0x96b8('0x2'));var timeout=require(_0x96b8('0x3'));var express=require('express');var router=express[_0x96b8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x96b8('0x5'));var config=require(_0x96b8('0x6'));var controller=require('./chatOfflineMessage.controller');router[_0x96b8('0x7')]('/',auth[_0x96b8('0x8')](),controller[_0x96b8('0x9')]);router[_0x96b8('0x7')](_0x96b8('0xa'),auth['isAuthenticated'](),controller[_0x96b8('0xb')]);router[_0x96b8('0x7')](_0x96b8('0xc'),auth[_0x96b8('0x8')](),controller[_0x96b8('0xd')]);router[_0x96b8('0xe')]('/',auth[_0x96b8('0x8')](),controller['create']);router['put'](_0x96b8('0xc'),auth[_0x96b8('0x8')](),controller[_0x96b8('0xf')]);router[_0x96b8('0x10')](_0x96b8('0xc'),auth[_0x96b8('0x8')](),controller['destroy']);module[_0x96b8('0x11')]=router; \ No newline at end of file +var _0x6c84=['multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','get','describe','/:id','post','create','put','delete','destroy','exports'];(function(_0x484880,_0x3e1510){var _0x13042f=function(_0x5a6fca){while(--_0x5a6fca){_0x484880['push'](_0x484880['shift']());}};_0x13042f(++_0x3e1510);}(_0x6c84,0xfc));var _0x46c8=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x6c84[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x46c8('0x0'));var util=require(_0x46c8('0x1'));var path=require(_0x46c8('0x2'));var timeout=require(_0x46c8('0x3'));var express=require('express');var router=express[_0x46c8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x46c8('0x5'));var config=require(_0x46c8('0x6'));var controller=require(_0x46c8('0x7'));router['get']('/',auth[_0x46c8('0x8')](),controller['index']);router[_0x46c8('0x9')]('/describe',auth[_0x46c8('0x8')](),controller[_0x46c8('0xa')]);router['get'](_0x46c8('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x46c8('0xc')]('/',auth['isAuthenticated'](),controller[_0x46c8('0xd')]);router[_0x46c8('0xe')]('/:id',auth[_0x46c8('0x8')](),controller['update']);router[_0x46c8('0xf')](_0x46c8('0xb'),auth[_0x46c8('0x8')](),controller[_0x46c8('0x10')]);module[_0x46c8('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 1327858..8c34a19 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 _0x33b0=['STRING','ENUM','timeout','INTEGER','sequelize','exports'];(function(_0x20cf60,_0x19e3a9){var _0x3b28e7=function(_0x22c132){while(--_0x22c132){_0x20cf60['push'](_0x20cf60['shift']());}};_0x3b28e7(++_0x19e3a9);}(_0x33b0,0x82));var _0x033b=function(_0x264088,_0xc9ca59){_0x264088=_0x264088-0x0;var _0x9ae1a7=_0x33b0[_0x264088];return _0x9ae1a7;};'use strict';var Sequelize=require(_0x033b('0x0'));module[_0x033b('0x1')]={'name':{'type':Sequelize[_0x033b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x033b('0x3')]('mouseOver',_0x033b('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x033b('0x2')]},'timeout':{'type':Sequelize[_0x033b('0x5')]}}; \ No newline at end of file +var _0xc679=['exports','ENUM','mouseOver','timeout','STRING','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc679,0xa0));var _0x9c67=function(_0x4f0c45,_0x4045c8){_0x4f0c45=_0x4f0c45-0x0;var _0x30e0a1=_0xc679[_0x4f0c45];return _0x30e0a1;};'use strict';var Sequelize=require(_0x9c67('0x0'));module[_0x9c67('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x9c67('0x2')](_0x9c67('0x3'),_0x9c67('0x4')),'defaultValue':_0x9c67('0x3')},'selector':{'type':Sequelize[_0x9c67('0x5')]},'timeout':{'type':Sequelize[_0x9c67('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index d4de4de..789206c 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 _0x9c44=['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','params','model','keys','rawAttributes','query','filters','intersection','attributes','length','includeAll','include','merge','options','catch','create','ChatProactiveAction','body','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs'];(function(_0x1513a1,_0x1bd2d3){var _0x284410=function(_0x3addfe){while(--_0x3addfe){_0x1513a1['push'](_0x1513a1['shift']());}};_0x284410(++_0x1bd2d3);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'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['show']=function(_0x543ea2,_0x449960){var _0x53c199={'raw':!![],'where':{'id':_0x543ea2[_0x49c4('0x24')]['id']}},_0x3800b7={};_0x3800b7[_0x49c4('0x25')]=_[_0x49c4('0x26')](db['ChatProactiveAction'][_0x49c4('0x27')]);_0x3800b7[_0x49c4('0x28')]=_[_0x49c4('0x26')](_0x543ea2[_0x49c4('0x28')]);_0x3800b7[_0x49c4('0x29')]=_[_0x49c4('0x2a')](_0x3800b7[_0x49c4('0x25')],_0x3800b7[_0x49c4('0x28')]);_0x53c199[_0x49c4('0x2b')]=_[_0x49c4('0x2a')](_0x3800b7[_0x49c4('0x25')],qs['fields'](_0x543ea2['query']['fields']));_0x53c199[_0x49c4('0x2b')]=_0x53c199[_0x49c4('0x2b')][_0x49c4('0x2c')]?_0x53c199[_0x49c4('0x2b')]:_0x3800b7[_0x49c4('0x25')];if(_0x543ea2['query'][_0x49c4('0x2d')]){_0x53c199[_0x49c4('0x2e')]=[{'all':!![]}];}_0x53c199=_[_0x49c4('0x2f')]({},_0x53c199,_0x543ea2[_0x49c4('0x30')]);return db['ChatProactiveAction']['find'](_0x53c199)[_0x49c4('0x20')](handleEntityNotFound(_0x449960,null))[_0x49c4('0x20')](respondWithResult(_0x449960,null))[_0x49c4('0x31')](handleError(_0x449960,null));};exports[_0x49c4('0x32')]=function(_0xd38540,_0x4a0c7a){return db[_0x49c4('0x33')][_0x49c4('0x32')](_0xd38540[_0x49c4('0x34')],{})['then'](respondWithResult(_0x4a0c7a,0xc9))['catch'](handleError(_0x4a0c7a,null));};exports[_0x49c4('0x1f')]=function(_0x1991e9,_0x3bec0a){if(_0x1991e9[_0x49c4('0x34')]['id']){delete _0x1991e9[_0x49c4('0x34')]['id'];}return db[_0x49c4('0x33')][_0x49c4('0x35')]({'where':{'id':_0x1991e9[_0x49c4('0x24')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x3bec0a,null))['then'](saveUpdates(_0x1991e9[_0x49c4('0x34')],null))['then'](respondWithResult(_0x3bec0a,null))[_0x49c4('0x31')](handleError(_0x3bec0a,null));};exports[_0x49c4('0x36')]=function(_0x2625a6,_0x1c2830){return db['ChatProactiveAction'][_0x49c4('0x35')]({'where':{'id':_0x2625a6[_0x49c4('0x24')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x1c2830,null))['then'](removeEntity(_0x1c2830,null))[_0x49c4('0x31')](handleError(_0x1c2830,null));}; \ No newline at end of file +var _0xcb91=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','length','includeAll','merge','options','find','catch','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3fe6df,_0x5a04d4){_0x3fe6df=_0x3fe6df-0x0;var _0x372a0e=_0xcb91[_0x3fe6df];return _0x372a0e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x46af58,_0x5445e1){_0x5445e1=_0x5445e1||0xcc;return function(_0x5e3c19){if(_0x5e3c19){return _0x46af58['sendStatus'](_0x5445e1);}return _0x46af58[_0x1cb9('0x16')](_0x5445e1)[_0x1cb9('0x17')]();};}function respondWithResult(_0x384496,_0x1c714f){_0x1c714f=_0x1c714f||0xc8;return function(_0x56884d){if(_0x56884d){return _0x384496[_0x1cb9('0x16')](_0x1c714f)[_0x1cb9('0x18')](_0x56884d);}};}function respondWithFilteredResult(_0x1b3cd7,_0x8dfa55){return function(_0x3e2d11){if(_0x3e2d11){var _0x5806d8=_0x3e2d11[_0x1cb9('0x19')],_0x5572cb=_0x8dfa55[_0x1cb9('0x1a')],_0xd446a3=_0x8dfa55[_0x1cb9('0x1a')]+_0x8dfa55[_0x1cb9('0x1b')],_0x3cc765;if(_0xd446a3>=_0x5806d8){_0xd446a3=_0x5806d8;_0x3cc765=0xc8;}else{_0x3cc765=0xce;}_0x1b3cd7[_0x1cb9('0x16')](_0x3cc765);return _0x1b3cd7['set']('Content-Range',_0x5572cb+'-'+_0xd446a3+'/'+_0x5806d8)[_0x1cb9('0x18')](_0x3e2d11);}return null;};}function patchUpdates(_0x41ac41){return function(_0x2b2669){try{jsonpatch[_0x1cb9('0x1c')](_0x2b2669,_0x41ac41,!![]);}catch(_0x280a84){return BPromise[_0x1cb9('0x1d')](_0x280a84);}return _0x2b2669[_0x1cb9('0x1e')]();};}function saveUpdates(_0x4ac422,_0x559bcc){return function(_0x1a5a72){if(_0x1a5a72){return _0x1a5a72['update'](_0x4ac422)[_0x1cb9('0x1f')](function(_0x2265ea){return _0x2265ea;});}return null;};}function removeEntity(_0x523b26,_0x599275){return function(_0x2e3854){if(_0x2e3854){return _0x2e3854[_0x1cb9('0x20')]()[_0x1cb9('0x1f')](function(){_0x523b26[_0x1cb9('0x16')](0xcc)[_0x1cb9('0x17')]();});}};}function handleEntityNotFound(_0x27db16,_0x59ebea){return function(_0x55b232){if(!_0x55b232){_0x27db16[_0x1cb9('0x21')](0x194);}return _0x55b232;};}function handleError(_0x557199,_0x10a419){_0x10a419=_0x10a419||0x1f4;return function(_0x2b1275){logger[_0x1cb9('0x22')](_0x2b1275[_0x1cb9('0x23')]);if(_0x2b1275[_0x1cb9('0x24')]){delete _0x2b1275['name'];}_0x557199[_0x1cb9('0x16')](_0x10a419)[_0x1cb9('0x25')](_0x2b1275);};}exports['show']=function(_0xd6891c,_0x21effa){var _0x41a9a0={'raw':!![],'where':{'id':_0xd6891c[_0x1cb9('0x26')]['id']}},_0x1804fd={};_0x1804fd[_0x1cb9('0x27')]=_[_0x1cb9('0x28')](db[_0x1cb9('0x29')][_0x1cb9('0x2a')]);_0x1804fd[_0x1cb9('0x2b')]=_['keys'](_0xd6891c[_0x1cb9('0x2b')]);_0x1804fd['filters']=_[_0x1cb9('0x2c')](_0x1804fd['model'],_0x1804fd[_0x1cb9('0x2b')]);_0x41a9a0[_0x1cb9('0x2d')]=_[_0x1cb9('0x2c')](_0x1804fd[_0x1cb9('0x27')],qs['fields'](_0xd6891c[_0x1cb9('0x2b')]['fields']));_0x41a9a0[_0x1cb9('0x2d')]=_0x41a9a0[_0x1cb9('0x2d')][_0x1cb9('0x2e')]?_0x41a9a0['attributes']:_0x1804fd[_0x1cb9('0x27')];if(_0xd6891c['query'][_0x1cb9('0x2f')]){_0x41a9a0['include']=[{'all':!![]}];}_0x41a9a0=_[_0x1cb9('0x30')]({},_0x41a9a0,_0xd6891c[_0x1cb9('0x31')]);return db[_0x1cb9('0x29')][_0x1cb9('0x32')](_0x41a9a0)['then'](handleEntityNotFound(_0x21effa,null))[_0x1cb9('0x1f')](respondWithResult(_0x21effa,null))[_0x1cb9('0x33')](handleError(_0x21effa,null));};exports[_0x1cb9('0x34')]=function(_0x91a1db,_0xc6784c){return db[_0x1cb9('0x29')][_0x1cb9('0x34')](_0x91a1db[_0x1cb9('0x35')],{})[_0x1cb9('0x1f')](respondWithResult(_0xc6784c,0xc9))[_0x1cb9('0x33')](handleError(_0xc6784c,null));};exports[_0x1cb9('0x36')]=function(_0x26b950,_0x29f149){if(_0x26b950['body']['id']){delete _0x26b950['body']['id'];}return db[_0x1cb9('0x29')][_0x1cb9('0x32')]({'where':{'id':_0x26b950[_0x1cb9('0x26')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x29f149,null))[_0x1cb9('0x1f')](saveUpdates(_0x26b950[_0x1cb9('0x35')],null))[_0x1cb9('0x1f')](respondWithResult(_0x29f149,null))[_0x1cb9('0x33')](handleError(_0x29f149,null));};exports['destroy']=function(_0x2aa59b,_0x1482c4){return db[_0x1cb9('0x29')]['find']({'where':{'id':_0x2aa59b[_0x1cb9('0x26')]['id']}})['then'](handleEntityNotFound(_0x1482c4,null))[_0x1cb9('0x1f')](removeEntity(_0x1482c4,null))['catch'](handleError(_0x1482c4,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 1b7989f..fcb222d 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 _0xa0b4=['./chatProactiveAction.attributes','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0b4,0xe7));var _0x4a0b=function(_0x3b5fda,_0x64bcfd){_0x3b5fda=_0x3b5fda-0x0;var _0x1c87cd=_0xa0b4[_0x3b5fda];return _0x1c87cd;};'use strict';var _=require(_0x4a0b('0x0'));var util=require(_0x4a0b('0x1'));var logger=require(_0x4a0b('0x2'))('api');var moment=require(_0x4a0b('0x3'));var BPromise=require(_0x4a0b('0x4'));var rp=require(_0x4a0b('0x5'));var fs=require('fs');var path=require(_0x4a0b('0x6'));var rimraf=require(_0x4a0b('0x7'));var config=require(_0x4a0b('0x8'));var attributes=require(_0x4a0b('0x9'));module['exports']=function(_0x37e5b4,_0x36a625){return _0x37e5b4['define'](_0x4a0b('0xa'),attributes,{'tableName':_0x4a0b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c7f=['ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./chatProactiveAction.attributes','exports','define'];(function(_0x13b524,_0x1bbdc4){var _0x2babdb=function(_0x55d190){while(--_0x55d190){_0x13b524['push'](_0x13b524['shift']());}};_0x2babdb(++_0x1bbdc4);}(_0x4c7f,0x9e));var _0xf4c7=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x4c7f[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0xf4c7('0x0'));var util=require(_0xf4c7('0x1'));var logger=require(_0xf4c7('0x2'))('api');var moment=require(_0xf4c7('0x3'));var BPromise=require('bluebird');var rp=require(_0xf4c7('0x4'));var fs=require('fs');var path=require(_0xf4c7('0x5'));var rimraf=require(_0xf4c7('0x6'));var config=require('../../config/environment');var attributes=require(_0xf4c7('0x7'));module[_0xf4c7('0x8')]=function(_0x52920d,_0x1906b6){return _0x52920d[_0xf4c7('0x9')](_0xf4c7('0xa'),attributes,{'tableName':_0xf4c7('0xb'),'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 2f78182..2f56a5b 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 _0x9190=['message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2345b3,_0x4077fa){var _0x4cf6d7=function(_0x2c6138){while(--_0x2c6138){_0x2345b3['push'](_0x2345b3['shift']());}};_0x4cf6d7(++_0x4077fa);}(_0x9190,0x162));var _0x0919=function(_0x4d26d3,_0x26e211){_0x4d26d3=_0x4d26d3-0x0;var _0x3a949e=_0x9190[_0x4d26d3];return _0x3a949e;};'use strict';var _=require(_0x0919('0x0'));var util=require('util');var moment=require(_0x0919('0x1'));var BPromise=require(_0x0919('0x2'));var rs=require(_0x0919('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0919('0x4'))['db'];var utils=require(_0x0919('0x5'));var logger=require(_0x0919('0x6'))(_0x0919('0x7'));var config=require(_0x0919('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0919('0x9')][_0x0919('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x569f68,_0x521bed,_0x4afce2){return new BPromise(function(_0x1dd53f,_0x22bfdb){return client[_0x0919('0xb')](_0x569f68,_0x4afce2)[_0x0919('0xc')](function(_0x457f2e){logger[_0x0919('0xd')](_0x0919('0xe'),_0x521bed,_0x0919('0xf'));logger['debug'](_0x0919('0x10'),_0x521bed,_0x0919('0xf'),JSON[_0x0919('0x11')](_0x457f2e));if(_0x457f2e[_0x0919('0x12')]){if(_0x457f2e[_0x0919('0x12')][_0x0919('0x13')]===0x1f4){logger[_0x0919('0x12')](_0x0919('0xe'),_0x521bed,_0x457f2e['error'][_0x0919('0x14')]);return _0x22bfdb(_0x457f2e[_0x0919('0x12')]['message']);}logger[_0x0919('0x12')](_0x0919('0xe'),_0x521bed,_0x457f2e[_0x0919('0x12')]['message']);return _0x1dd53f(_0x457f2e[_0x0919('0x12')][_0x0919('0x14')]);}else{logger[_0x0919('0xd')](_0x0919('0xe'),_0x521bed,_0x0919('0xf'));_0x1dd53f(_0x457f2e['result'][_0x0919('0x14')]);}})[_0x0919('0x15')](function(_0x390871){logger[_0x0919('0x12')](_0x0919('0xe'),_0x521bed,_0x390871);_0x22bfdb(_0x390871);});});} \ No newline at end of file +var _0xcc8a=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','lodash','util'];(function(_0x24b8c9,_0x23e1fc){var _0x2958c1=function(_0x1e987e){while(--_0x1e987e){_0x24b8c9['push'](_0x24b8c9['shift']());}};_0x2958c1(++_0x23e1fc);}(_0xcc8a,0xc6));var _0xacc8=function(_0x1e6110,_0x26f4fb){_0x1e6110=_0x1e6110-0x0;var _0x463c9a=_0xcc8a[_0x1e6110];return _0x463c9a;};'use strict';var _=require(_0xacc8('0x0'));var util=require(_0xacc8('0x1'));var moment=require(_0xacc8('0x2'));var BPromise=require(_0xacc8('0x3'));var rs=require(_0xacc8('0x4'));var fs=require('fs');var Redis=require(_0xacc8('0x5'));var db=require(_0xacc8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xacc8('0x7'))(_0xacc8('0x8'));var config=require(_0xacc8('0x9'));var jayson=require(_0xacc8('0xa'));var client=jayson[_0xacc8('0xb')][_0xacc8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x26daf9,_0x31c273,_0x1f3125){return new BPromise(function(_0x3d59b6,_0x4c9092){return client[_0xacc8('0xd')](_0x26daf9,_0x1f3125)[_0xacc8('0xe')](function(_0x5eabd3){logger['info'](_0xacc8('0xf'),_0x31c273,_0xacc8('0x10'));logger['debug'](_0xacc8('0x11'),_0x31c273,_0xacc8('0x10'),JSON[_0xacc8('0x12')](_0x5eabd3));if(_0x5eabd3['error']){if(_0x5eabd3['error'][_0xacc8('0x13')]===0x1f4){logger[_0xacc8('0x14')](_0xacc8('0xf'),_0x31c273,_0x5eabd3[_0xacc8('0x14')][_0xacc8('0x15')]);return _0x4c9092(_0x5eabd3[_0xacc8('0x14')][_0xacc8('0x15')]);}logger[_0xacc8('0x14')](_0xacc8('0xf'),_0x31c273,_0x5eabd3[_0xacc8('0x14')][_0xacc8('0x15')]);return _0x3d59b6(_0x5eabd3['error']['message']);}else{logger[_0xacc8('0x16')]('ChatProactiveAction,\x20%s,\x20%s',_0x31c273,_0xacc8('0x10'));_0x3d59b6(_0x5eabd3[_0xacc8('0x17')][_0xacc8('0x15')]);}})[_0xacc8('0x18')](function(_0x38d529){logger[_0xacc8('0x14')](_0xacc8('0xf'),_0x31c273,_0x38d529);_0x4c9092(_0x38d529);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index b52908a..180e1b5 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 _0x9839=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer','util'];(function(_0x4e6a61,_0x352026){var _0x33f4c6=function(_0x48350c){while(--_0x48350c){_0x4e6a61['push'](_0x4e6a61['shift']());}};_0x33f4c6(++_0x352026);}(_0x9839,0x163));var _0x9983=function(_0x3a3c5a,_0xda91ab){_0x3a3c5a=_0x3a3c5a-0x0;var _0x499da7=_0x9839[_0x3a3c5a];return _0x499da7;};'use strict';var multer=require(_0x9983('0x0'));var util=require(_0x9983('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9983('0x2'));var router=express[_0x9983('0x3')]();var auth=require(_0x9983('0x4'));var interaction=require(_0x9983('0x5'));var config=require(_0x9983('0x6'));var controller=require(_0x9983('0x7'));router[_0x9983('0x8')](_0x9983('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x9983('0xa')](),controller[_0x9983('0xb')]);router[_0x9983('0xc')](_0x9983('0x9'),auth['isAuthenticated'](),controller[_0x9983('0xd')]);router[_0x9983('0xe')](_0x9983('0x9'),auth[_0x9983('0xa')](),controller[_0x9983('0xf')]);module[_0x9983('0x10')]=router; \ No newline at end of file +var _0xf6d1=['/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get'];(function(_0x1af66d,_0x1f2013){var _0x28e8bf=function(_0x318e1c){while(--_0x318e1c){_0x1af66d['push'](_0x1af66d['shift']());}};_0x28e8bf(++_0x1f2013);}(_0xf6d1,0x99));var _0x1f6d=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xf6d1[_0x42245d];return _0x4b211a;};'use strict';var multer=require(_0x1f6d('0x0'));var util=require(_0x1f6d('0x1'));var path=require(_0x1f6d('0x2'));var timeout=require(_0x1f6d('0x3'));var express=require(_0x1f6d('0x4'));var router=express[_0x1f6d('0x5')]();var auth=require(_0x1f6d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1f6d('0x7'));var controller=require('./chatProactiveAction.controller');router[_0x1f6d('0x8')](_0x1f6d('0x9'),auth[_0x1f6d('0xa')](),controller[_0x1f6d('0xb')]);router[_0x1f6d('0xc')]('/',auth[_0x1f6d('0xa')](),controller[_0x1f6d('0xd')]);router[_0x1f6d('0xe')](_0x1f6d('0x9'),auth[_0x1f6d('0xa')](),controller[_0x1f6d('0xf')]);router[_0x1f6d('0x10')]('/:id',auth[_0x1f6d('0xa')](),controller['destroy']);module[_0x1f6d('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 64ed438..4333220 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 _0x2f1a=['STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x1e7aea,_0x4e0c68){var _0x2d34d3=function(_0x5e6e2f){while(--_0x5e6e2f){_0x1e7aea['push'](_0x1e7aea['shift']());}};_0x2d34d3(++_0x4e0c68);}(_0x2f1a,0xcc));var _0xa2f1=function(_0x586aa0,_0x3f4b42){_0x586aa0=_0x586aa0-0x0;var _0xc91e96=_0x2f1a[_0x586aa0];return _0xc91e96;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa2f1('0x0')],'unique':_0xa2f1('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa2f1('0x0')]},'timeout':{'type':Sequelize[_0xa2f1('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa2f1('0x3')](_0xa2f1('0x4'),_0xa2f1('0x5'),'roundrobin')}}; \ No newline at end of file +var _0xaa8b=['sequelize','name','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x1b7d19,_0x3c510f){var _0x27f52a=function(_0xeb7a7a){while(--_0xeb7a7a){_0x1b7d19['push'](_0x1b7d19['shift']());}};_0x27f52a(++_0x3c510f);}(_0xaa8b,0x1f2));var _0xbaa8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa8b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xbaa8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xbaa8('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xbaa8('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbaa8('0x3')](_0xbaa8('0x4'),'beepall',_0xbaa8('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 8ca5733..fbe20f2 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 _0xb89c=['catch','sendStatus','end','status','json','count','limit','Content-Range','apply','save','update','get','ChatQueues','UserProfileResource','name','send','index','map','ChatQueue','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','offset','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','destroy','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','pick','ChatQueueId','User','findAndCountAll','chatPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','interface','flatMap','transaction','each','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','jayson/promise','client','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','info','result'];(function(_0x538a56,_0x512683){var _0x545789=function(_0x5c11ff){while(--_0x5c11ff){_0x538a56['push'](_0x538a56['shift']());}};_0x545789(++_0x512683);}(_0xb89c,0x198));var _0xcb89=function(_0x4d8bff,_0x2b2276){_0x4d8bff=_0x4d8bff-0x0;var _0x1f50e8=_0xb89c[_0x4d8bff];return _0x1f50e8;};'use strict';var pdf=require(_0xcb89('0x0'));var emlformat=require(_0xcb89('0x1'));var rimraf=require(_0xcb89('0x2'));var zipdir=require(_0xcb89('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcb89('0x4'));var moment=require(_0xcb89('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcb89('0x6'));var util=require(_0xcb89('0x7'));var path=require(_0xcb89('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcb89('0x9'));var fs=require('fs');var _=require(_0xcb89('0xa'));var squel=require(_0xcb89('0xb'));var crypto=require('crypto');var jsforce=require(_0xcb89('0xc'));var deskjs=require(_0xcb89('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcb89('0xe'));var Redis=require('ioredis');var authService=require(_0xcb89('0xf'));var qs=require(_0xcb89('0x10'));var as=require(_0xcb89('0x11'));var hardwareService=require(_0xcb89('0x12'));var logger=require(_0xcb89('0x13'))(_0xcb89('0x14'));var utils=require('../../config/utils');var config=require(_0xcb89('0x15'));var db=require('../../mysqldb')['db'];config[_0xcb89('0x16')]=_[_0xcb89('0x17')](config[_0xcb89('0x16')],{'host':_0xcb89('0x18'),'port':0x18eb});var socket=require(_0xcb89('0x19'))(new Redis(config[_0xcb89('0x16')]));require(_0xcb89('0x1a'))['register'](socket);var jayson=require(_0xcb89('0x1b'));var client=jayson[_0xcb89('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x335236,_0x15c35e,_0x1805fa){if(_0x1805fa){var _0x50a395=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x50a395[_0xcb89('0x1d')](_0x15c35e)){return _0x335236;}else{throw new db['Sequelize']['ValidationError'](_0xcb89('0x1e'));}}else{return _0x335236;}}function respondWithRpcPromise(_0x21ca3f,_0x254d38,_0xd9fec8,_0x3ace69){return new BPromise(function(_0x37aece,_0x1d99bd){var _0x12e608=_0x3ace69||client;return _0x12e608['request'](_0x21ca3f,_0xd9fec8)[_0xcb89('0x1f')](function(_0x2bcb0b){logger['info']('ChatQueue,\x20%s,\x20%s',_0x254d38,_0xcb89('0x20'));logger[_0xcb89('0x21')](_0xcb89('0x22'),_0x254d38,_0xcb89('0x20'),JSON[_0xcb89('0x23')](_0x2bcb0b));if(_0x2bcb0b[_0xcb89('0x24')]){if(_0x2bcb0b[_0xcb89('0x24')][_0xcb89('0x25')]===0x1f4){logger['error'](_0xcb89('0x26'),_0x254d38,_0x2bcb0b[_0xcb89('0x24')][_0xcb89('0x27')]);return _0x1d99bd(_0x2bcb0b[_0xcb89('0x24')]['message']);}logger[_0xcb89('0x24')]('ChatQueue,\x20%s,\x20%s',_0x254d38,_0x2bcb0b[_0xcb89('0x24')]['message']);return _0x37aece(_0x2bcb0b[_0xcb89('0x24')][_0xcb89('0x27')]);}else{logger[_0xcb89('0x28')]('ChatQueue,\x20%s,\x20%s',_0x254d38,_0xcb89('0x20'));_0x37aece(_0x2bcb0b[_0xcb89('0x29')][_0xcb89('0x27')]);}})[_0xcb89('0x2a')](function(_0x7dc2d2){logger[_0xcb89('0x24')](_0xcb89('0x26'),_0x254d38,_0x7dc2d2);_0x1d99bd(_0x7dc2d2);});});}function respondWithStatusCode(_0x21b739,_0x2eb18f){_0x2eb18f=_0x2eb18f||0xcc;return function(_0x52ec43){if(_0x52ec43){return _0x21b739[_0xcb89('0x2b')](_0x2eb18f);}return _0x21b739['status'](_0x2eb18f)[_0xcb89('0x2c')]();};}function respondWithResult(_0x557dd4,_0x52eb25){_0x52eb25=_0x52eb25||0xc8;return function(_0x185676){if(_0x185676){return _0x557dd4[_0xcb89('0x2d')](_0x52eb25)[_0xcb89('0x2e')](_0x185676);}};}function respondWithFilteredResult(_0x16059d,_0x2175f4){return function(_0x12ec9c){if(_0x12ec9c){var _0xb5eae=_0x12ec9c[_0xcb89('0x2f')],_0x240258=_0x2175f4['offset'],_0x1d545a=_0x2175f4['offset']+_0x2175f4[_0xcb89('0x30')],_0x850eb1;if(_0x1d545a>=_0xb5eae){_0x1d545a=_0xb5eae;_0x850eb1=0xc8;}else{_0x850eb1=0xce;}_0x16059d[_0xcb89('0x2d')](_0x850eb1);return _0x16059d['set'](_0xcb89('0x31'),_0x240258+'-'+_0x1d545a+'/'+_0xb5eae)[_0xcb89('0x2e')](_0x12ec9c);}return null;};}function patchUpdates(_0x593c34){return function(_0x29a087){try{jsonpatch[_0xcb89('0x32')](_0x29a087,_0x593c34,!![]);}catch(_0xab6d80){return BPromise['reject'](_0xab6d80);}return _0x29a087[_0xcb89('0x33')]();};}function saveUpdates(_0x5e54e2,_0x4efcfa){return function(_0xd5790c){if(_0xd5790c){return _0xd5790c[_0xcb89('0x34')](_0x5e54e2)[_0xcb89('0x1f')](function(_0x561c8b){return _0x561c8b;});}return null;};}function removeEntity(_0x1d4d85,_0x38f131){return function(_0x153b77){if(_0x153b77){return _0x153b77['destroy']()[_0xcb89('0x1f')](function(){var _0xec5fd4=_0x153b77[_0xcb89('0x35')]({'plain':!![]});var _0x2b94a8=_0xcb89('0x36');return db[_0xcb89('0x37')]['destroy']({'where':{'type':_0x2b94a8,'resourceId':_0xec5fd4['id']}})[_0xcb89('0x1f')](function(){return _0x153b77;});})[_0xcb89('0x1f')](function(){_0x1d4d85['status'](0xcc)[_0xcb89('0x2c')]();});}};}function handleEntityNotFound(_0x3d5bb7,_0x33d734){return function(_0x5bead2){if(!_0x5bead2){_0x3d5bb7[_0xcb89('0x2b')](0x194);}return _0x5bead2;};}function handleError(_0x35fe07,_0x23e49b){_0x23e49b=_0x23e49b||0x1f4;return function(_0x31a9c1){logger[_0xcb89('0x24')](_0x31a9c1['stack']);if(_0x31a9c1['name']){delete _0x31a9c1[_0xcb89('0x38')];}_0x35fe07[_0xcb89('0x2d')](_0x23e49b)[_0xcb89('0x39')](_0x31a9c1);};}exports[_0xcb89('0x3a')]=function(_0x4cbc43,_0x54128c){var _0x1890e1={},_0x4ed881={},_0x2a2bb5={'count':0x0,'rows':[]};var _0x17cf19=_[_0xcb89('0x3b')](db[_0xcb89('0x3c')]['rawAttributes'],function(_0x1dac5c){return{'name':_0x1dac5c[_0xcb89('0x3d')],'type':_0x1dac5c[_0xcb89('0x3e')][_0xcb89('0x3f')]};});_0x4ed881[_0xcb89('0x40')]=_[_0xcb89('0x3b')](_0x17cf19,_0xcb89('0x38'));_0x4ed881['query']=_[_0xcb89('0x41')](_0x4cbc43[_0xcb89('0x42')]);_0x4ed881['filters']=_[_0xcb89('0x43')](_0x4ed881['model'],_0x4ed881[_0xcb89('0x42')]);_0x1890e1[_0xcb89('0x44')]=_[_0xcb89('0x43')](_0x4ed881[_0xcb89('0x40')],qs[_0xcb89('0x45')](_0x4cbc43[_0xcb89('0x42')]['fields']));_0x1890e1['attributes']=_0x1890e1['attributes'][_0xcb89('0x46')]?_0x1890e1[_0xcb89('0x44')]:_0x4ed881[_0xcb89('0x40')];if(!_0x4cbc43[_0xcb89('0x42')]['hasOwnProperty'](_0xcb89('0x47'))){_0x1890e1[_0xcb89('0x30')]=qs['limit'](_0x4cbc43['query'][_0xcb89('0x30')]);_0x1890e1[_0xcb89('0x48')]=qs[_0xcb89('0x48')](_0x4cbc43[_0xcb89('0x42')]['offset']);}_0x1890e1[_0xcb89('0x49')]=qs[_0xcb89('0x4a')](_0x4cbc43[_0xcb89('0x42')][_0xcb89('0x4a')]);_0x1890e1['where']=qs[_0xcb89('0x4b')](_['pick'](_0x4cbc43[_0xcb89('0x42')],_0x4ed881[_0xcb89('0x4b')]));if(_0x4cbc43[_0xcb89('0x42')][_0xcb89('0x4c')]){_0x1890e1[_0xcb89('0x4d')]=_['merge'](_0x1890e1[_0xcb89('0x4d')],{'$or':_[_0xcb89('0x3b')](_0x17cf19,function(_0x58fe70){if(_0x58fe70[_0xcb89('0x3e')]!==_0xcb89('0x4e')){var _0x511841={};_0x511841[_0x58fe70['name']]={'$like':'%'+_0x4cbc43[_0xcb89('0x42')][_0xcb89('0x4c')]+'%'};return _0x511841;}})});}_0x1890e1=_[_0xcb89('0x4f')]({},_0x1890e1,_0x4cbc43[_0xcb89('0x50')]);var _0x220971={'where':_0x1890e1[_0xcb89('0x4d')]};return db[_0xcb89('0x3c')][_0xcb89('0x2f')](_0x220971)['then'](function(_0x375c17){_0x2a2bb5[_0xcb89('0x2f')]=_0x375c17;if(_0x4cbc43['query'][_0xcb89('0x51')]){_0x1890e1['include']=[{'all':!![]}];}return db[_0xcb89('0x3c')][_0xcb89('0x52')](_0x1890e1);})[_0xcb89('0x1f')](function(_0x35aade){_0x2a2bb5['rows']=_0x35aade;return _0x2a2bb5;})['then'](respondWithFilteredResult(_0x54128c,_0x1890e1))[_0xcb89('0x2a')](handleError(_0x54128c,null));};exports[_0xcb89('0x53')]=function(_0x18807e,_0x174acf){var _0x2893f5={'raw':!![],'where':{'id':_0x18807e[_0xcb89('0x54')]['id']}},_0x32bbb8={};_0x32bbb8[_0xcb89('0x40')]=_[_0xcb89('0x41')](db['ChatQueue'][_0xcb89('0x55')]);_0x32bbb8[_0xcb89('0x42')]=_[_0xcb89('0x41')](_0x18807e['query']);_0x32bbb8[_0xcb89('0x4b')]=_['intersection'](_0x32bbb8[_0xcb89('0x40')],_0x32bbb8[_0xcb89('0x42')]);_0x2893f5[_0xcb89('0x44')]=_[_0xcb89('0x43')](_0x32bbb8[_0xcb89('0x40')],qs[_0xcb89('0x45')](_0x18807e[_0xcb89('0x42')][_0xcb89('0x45')]));_0x2893f5[_0xcb89('0x44')]=_0x2893f5[_0xcb89('0x44')][_0xcb89('0x46')]?_0x2893f5[_0xcb89('0x44')]:_0x32bbb8[_0xcb89('0x40')];if(_0x18807e[_0xcb89('0x42')][_0xcb89('0x51')]){_0x2893f5['include']=[{'all':!![]}];}_0x2893f5=_['merge']({},_0x2893f5,_0x18807e[_0xcb89('0x50')]);return db[_0xcb89('0x3c')]['find'](_0x2893f5)['then'](handleEntityNotFound(_0x174acf,null))[_0xcb89('0x1f')](respondWithResult(_0x174acf,null))[_0xcb89('0x2a')](handleError(_0x174acf,null));};exports[_0xcb89('0x56')]=function(_0xbb34bc,_0x422e01){return db[_0xcb89('0x3c')][_0xcb89('0x56')](_0xbb34bc[_0xcb89('0x57')],{})[_0xcb89('0x1f')](function(_0x1c7de1){var _0x3f68e2=_0xbb34bc[_0xcb89('0x58')]['get']({'plain':!![]});if(!_0x3f68e2)throw new Error(_0xcb89('0x59'));if(_0x3f68e2[_0xcb89('0x5a')]==='user'){var _0x43d3a9=_0x1c7de1[_0xcb89('0x35')]({'plain':!![]});var _0x57b4db=_0xcb89('0x36');return db[_0xcb89('0x5b')][_0xcb89('0x5c')]({'where':{'name':_0x57b4db,'userProfileId':_0x3f68e2['userProfileId']},'raw':!![]})[_0xcb89('0x1f')](function(_0x2fbd06){if(_0x2fbd06&&_0x2fbd06[_0xcb89('0x5d')]===0x0){return db[_0xcb89('0x37')][_0xcb89('0x56')]({'name':_0x43d3a9['name'],'resourceId':_0x43d3a9['id'],'type':_0x2fbd06['name'],'sectionId':_0x2fbd06['id']},{})[_0xcb89('0x1f')](function(){return _0x1c7de1;});}else{return _0x1c7de1;}})[_0xcb89('0x2a')](function(_0x2181f0){logger[_0xcb89('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2181f0);throw _0x2181f0;});}return _0x1c7de1;})[_0xcb89('0x1f')](respondWithResult(_0x422e01,0xc9))[_0xcb89('0x2a')](handleError(_0x422e01,null));};exports[_0xcb89('0x34')]=function(_0x33a9ce,_0x57cd89){if(_0x33a9ce[_0xcb89('0x57')]['id']){delete _0x33a9ce[_0xcb89('0x57')]['id'];}return db[_0xcb89('0x3c')][_0xcb89('0x5c')]({'where':{'id':_0x33a9ce[_0xcb89('0x54')]['id']}})[_0xcb89('0x1f')](handleEntityNotFound(_0x57cd89,null))['then'](saveUpdates(_0x33a9ce[_0xcb89('0x57')],null))['then'](respondWithResult(_0x57cd89,null))[_0xcb89('0x2a')](handleError(_0x57cd89,null));};exports[_0xcb89('0x5e')]=function(_0x1e8065,_0x48525f){return db[_0xcb89('0x3c')]['find']({'where':{'id':_0x1e8065[_0xcb89('0x54')]['id']}})[_0xcb89('0x1f')](handleEntityNotFound(_0x48525f,null))[_0xcb89('0x1f')](removeEntity(_0x48525f,null))[_0xcb89('0x2a')](handleError(_0x48525f,null));};exports[_0xcb89('0x5f')]=function(_0x13b49f,_0x52067d){return db['ChatQueue'][_0xcb89('0x5f')]()['then'](respondWithResult(_0x52067d,null))[_0xcb89('0x2a')](handleError(_0x52067d,null));};exports[_0xcb89('0x60')]=function(_0x1717f9,_0x28391c,_0x4ae3fa){var _0x234989={'raw':!![],'where':{}},_0xb740cb={},_0x261b10;return db[_0xcb89('0x3c')][_0xcb89('0x61')]({'where':{'id':_0x1717f9[_0xcb89('0x54')]['id']}})[_0xcb89('0x1f')](handleEntityNotFound(_0x28391c,null))[_0xcb89('0x1f')](function(_0x16b5c7){if(_0x16b5c7){_0x261b10=_0x16b5c7['get']({'plain':!![]});_0xb740cb[_0xcb89('0x40')]=_[_0xcb89('0x41')](db[_0xcb89('0x62')][_0xcb89('0x55')]);_0xb740cb[_0xcb89('0x42')]=_[_0xcb89('0x41')](_0x1717f9[_0xcb89('0x42')]);_0xb740cb[_0xcb89('0x4b')]=_[_0xcb89('0x43')](_0xb740cb[_0xcb89('0x40')],_0xb740cb[_0xcb89('0x42')]);_0x234989[_0xcb89('0x44')]=_[_0xcb89('0x43')](_0xb740cb[_0xcb89('0x40')],qs[_0xcb89('0x45')](_0x1717f9['query']['fields']));_0x234989[_0xcb89('0x44')]=_0x234989[_0xcb89('0x44')]['length']?_0x234989['attributes']:_0xb740cb[_0xcb89('0x40')];if(!_0x1717f9[_0xcb89('0x42')][_0xcb89('0x63')](_0xcb89('0x47'))){_0x234989[_0xcb89('0x30')]=qs[_0xcb89('0x30')](_0x1717f9[_0xcb89('0x42')][_0xcb89('0x30')]);_0x234989[_0xcb89('0x48')]=qs[_0xcb89('0x48')](_0x1717f9[_0xcb89('0x42')]['offset']);}_0x234989[_0xcb89('0x49')]=qs['sort'](_0x1717f9[_0xcb89('0x42')][_0xcb89('0x4a')]);_0x234989[_0xcb89('0x4d')]=qs[_0xcb89('0x4b')](_[_0xcb89('0x64')](_0x1717f9[_0xcb89('0x42')],_0xb740cb['filters']));_0x234989[_0xcb89('0x4d')][_0xcb89('0x65')]=_0x16b5c7['id'];if(_0x1717f9[_0xcb89('0x42')][_0xcb89('0x4c')]){_0x234989[_0xcb89('0x4d')]=_[_0xcb89('0x4f')](_0x234989['where'],{'$or':_[_0xcb89('0x3b')](_0x234989['attributes'],function(_0xf63765){var _0x3cd099={};_0x3cd099[_0xf63765]={'$like':'%'+_0x1717f9[_0xcb89('0x42')][_0xcb89('0x4c')]+'%'};return _0x3cd099;})});}_0x234989=_[_0xcb89('0x4f')]({},_0x234989,_0x1717f9['options']);return db['UserChatQueue']['findAll'](_0x234989);}})[_0xcb89('0x1f')](function(_0x99b0df){if(_0x99b0df){return db[_0xcb89('0x66')][_0xcb89('0x67')]({'where':{'id':_[_0xcb89('0x3b')](_0x99b0df,'UserId'),'role':'agent'},'attributes':['id',_0xcb89('0x38'),_0xcb89('0x68'),_0xcb89('0x69'),_0xcb89('0x6a')]});}})[_0xcb89('0x1f')](function(_0x365c00){if(_0x365c00){return{'count':_0x365c00[_0xcb89('0x2f')],'rows':_[_0xcb89('0x3b')](_0x365c00[_0xcb89('0x6b')],function(_0x5cee4f){return{'membername':_0x5cee4f['name'],'UserId':_0x5cee4f['id'],'queue_name':_0x261b10[_0xcb89('0x38')],'ChatQueueId':_0x261b10['id'],'interface':util[_0xcb89('0x6c')](_0xcb89('0x6d'),_0xcb89('0x6e'),_0x5cee4f['name']),'penalty':0x0,'paused':_0x5cee4f[_0xcb89('0x68')],'createdAt':_0x5cee4f[_0xcb89('0x6a')],'updatedAt':_0x5cee4f[_0xcb89('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcb89('0x1f')](respondWithFilteredResult(_0x28391c,_0x234989))[_0xcb89('0x2a')](handleError(_0x28391c,null));};exports[_0xcb89('0x6f')]=function(_0x225b72,_0x17d28b,_0x5ca492){var _0x305c9f={};var _0x50497e={};var _0x4be3c7;var _0x2861ac;return db[_0xcb89('0x3c')][_0xcb89('0x61')]({'where':{'id':_0x225b72[_0xcb89('0x54')]['id']}})[_0xcb89('0x1f')](handleEntityNotFound(_0x17d28b,null))[_0xcb89('0x1f')](function(_0x128cfd){if(_0x128cfd){_0x4be3c7=_0x128cfd;_0x50497e[_0xcb89('0x40')]=_[_0xcb89('0x41')](db[_0xcb89('0x70')][_0xcb89('0x55')]);_0x50497e[_0xcb89('0x42')]=_['keys'](_0x225b72['query']);_0x50497e['filters']=_['intersection'](_0x50497e[_0xcb89('0x40')],_0x50497e[_0xcb89('0x42')]);_0x305c9f[_0xcb89('0x44')]=_['intersection'](_0x50497e[_0xcb89('0x40')],qs[_0xcb89('0x45')](_0x225b72[_0xcb89('0x42')][_0xcb89('0x45')]));_0x305c9f[_0xcb89('0x44')]=_0x305c9f['attributes']['length']?_0x305c9f[_0xcb89('0x44')]:_0x50497e[_0xcb89('0x40')];_0x305c9f[_0xcb89('0x49')]=qs[_0xcb89('0x4a')](_0x225b72[_0xcb89('0x42')][_0xcb89('0x4a')]);_0x305c9f[_0xcb89('0x4d')]=qs[_0xcb89('0x4b')](_[_0xcb89('0x64')](_0x225b72[_0xcb89('0x42')],_0x50497e[_0xcb89('0x4b')]));if(_0x225b72['query'][_0xcb89('0x4c')]){_0x305c9f[_0xcb89('0x4d')]=_[_0xcb89('0x4f')](_0x305c9f[_0xcb89('0x4d')],{'$or':_[_0xcb89('0x3b')](_0x305c9f[_0xcb89('0x44')],function(_0x3b722d){var _0xe07641={};_0xe07641[_0x3b722d]={'$like':'%'+_0x225b72[_0xcb89('0x42')][_0xcb89('0x4c')]+'%'};return _0xe07641;})});}_0x305c9f=_[_0xcb89('0x4f')]({},_0x305c9f,_0x225b72[_0xcb89('0x50')]);return _0x4be3c7[_0xcb89('0x6f')](_0x305c9f);}})[_0xcb89('0x1f')](function(_0xdeb838){if(_0xdeb838){_0x2861ac=_0xdeb838[_0xcb89('0x46')];if(!_0x225b72[_0xcb89('0x42')]['hasOwnProperty'](_0xcb89('0x47'))){_0x305c9f['limit']=qs[_0xcb89('0x30')](_0x225b72['query'][_0xcb89('0x30')]);_0x305c9f['offset']=qs['offset'](_0x225b72[_0xcb89('0x42')]['offset']);}return _0x4be3c7[_0xcb89('0x6f')](_0x305c9f);}})[_0xcb89('0x1f')](function(_0x535858){if(_0x535858){return _0x535858?{'count':_0x2861ac,'rows':_0x535858}:null;}})['then'](respondWithResult(_0x17d28b,null))[_0xcb89('0x2a')](handleError(_0x17d28b,null));};exports[_0xcb89('0x71')]=function(_0x227e93,_0x2595cf,_0x441ba0){var _0x263915=_0x227e93[_0xcb89('0x57')][_0xcb89('0x72')];return db[_0xcb89('0x70')]['findAll']({'where':{'id':_0x263915},'attributes':['id'],'include':[{'model':db['User'],'as':_0xcb89('0x73'),'attributes':['id','name','online','voicePause',_0xcb89('0x74')],'raw':!![]}]})[_0xcb89('0x1f')](function(_0x864323){if(_0x864323){var _0x314a39=_[_0xcb89('0x75')](_0x864323,function(_0x523a83){var _0xa5312e=_0x523a83[_0xcb89('0x35')]({'plain':!![]});return _0xa5312e[_0xcb89('0x73')];});return db['ChatQueue']['find']({'where':{'id':_0x227e93['params']['id']}})[_0xcb89('0x1f')](function(_0x602018){return db['sequelize'][_0xcb89('0x76')](function(_0x2a58a3){return _0x602018[_0xcb89('0x71')](_0x263915,{'transaction':_0x2a58a3})[_0xcb89('0x1f')](function(){return BPromise[_0xcb89('0x77')](_0x314a39,function(_0x3c24e5){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x3c24e5['id'],'ChatQueueId':_0x227e93[_0xcb89('0x54')]['id']},'transaction':_0x2a58a3});});})['then'](function(){_0x314a39[_0xcb89('0x78')](function(_0x32187b){socket[_0xcb89('0x79')](_0xcb89('0x7a'),{'UserId':_0x32187b['id'],'ChatQueueId':_0x602018['id']});});});});});}})['then'](respondWithStatusCode(_0x2595cf,null))['catch'](handleError(_0x2595cf,null));};exports[_0xcb89('0x7b')]=function(_0x425cc0,_0x58806f,_0x1dfc93){return db[_0xcb89('0x70')][_0xcb89('0x52')]({'where':{'id':_0x425cc0['query'][_0xcb89('0x72')]},'attributes':['id'],'include':[{'model':db[_0xcb89('0x66')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x58806f,null))[_0xcb89('0x1f')](function(_0x461074){var _0x1824b6=_[_0xcb89('0x3b')](_0x461074,'id');var _0xe732d8=[];var _0x57703c=[];var _0x5ae98f=squel[_0xcb89('0x7c')]();_0x5ae98f[_0xcb89('0x7d')](_0xcb89('0x7e'))['from'](_0xcb89('0x7f'),'tq')[_0xcb89('0x80')](_0xcb89('0x81'),'ut',_0xcb89('0x82'))[_0xcb89('0x4d')](_0xcb89('0x83'),_0x425cc0['params']['id']);for(var _0x1c157d=0x0;_0x1c157d<_0x461074[_0xcb89('0x46')];_0x1c157d+=0x1){let _0x118087=_0x461074[_0x1c157d];for(var _0x1137d4=0x0;_0x1137d4<_0x118087[_0xcb89('0x73')][_0xcb89('0x46')];_0x1137d4+=0x1){let _0x51bfb9=_0x118087[_0xcb89('0x73')][_0x1137d4];var _0x245b70=_0x5ae98f[_0xcb89('0x84')]();_0x245b70['where'](_0xcb89('0x85'),_0x51bfb9['id']);_0x57703c['push'](db[_0xcb89('0x86')]['query'](_0x245b70['toString'](),{'type':db[_0xcb89('0x86')][_0xcb89('0x87')][_0xcb89('0x88')]})[_0xcb89('0x1f')](function(_0x2796a2){if(_0x2796a2[_0xcb89('0x46')]===0x1){return _0x51bfb9['id'];}else{var _0x835cad=_[_0xcb89('0x89')](_[_0xcb89('0x3b')](_0x2796a2,_0xcb89('0x8a')),function(_0x4aa13c){return _[_0xcb89('0x8b')](_0x1824b6,_0x4aa13c);});if(_0x835cad){return _0x51bfb9['id'];}}}));}}return BPromise[_0xcb89('0x8c')](_0x57703c)[_0xcb89('0x1f')](function(_0x25e044){_0xe732d8=_(_0xe732d8)['union'](_0x25e044)['compact']()[_0xcb89('0x8d')]();return db['ChatQueue'][_0xcb89('0x5c')]({'where':{'id':_0x425cc0[_0xcb89('0x54')]['id']}})['then'](function(_0x252563){return db[_0xcb89('0x86')][_0xcb89('0x76')](function(_0x16897f){return _0x252563['removeTeams'](_0x425cc0['query']['ids'],{'transaction':_0x16897f})[_0xcb89('0x1f')](function(){if(!_[_0xcb89('0x8e')](_0xe732d8)){return _0x252563[_0xcb89('0x8f')](_0xe732d8,{'transaction':_0x16897f});}})['then'](function(){_0xe732d8[_0xcb89('0x78')](function(_0x3baf52){socket[_0xcb89('0x79')](_0xcb89('0x90'),{'UserId':_0x3baf52,'ChatQueueId':_0x252563['id']});});});});});});})[_0xcb89('0x1f')](respondWithStatusCode(_0x58806f,null))['catch'](handleError(_0x58806f,null));};exports[_0xcb89('0x91')]=function(_0x5864a7,_0x58d0d5,_0x5b19f7){return db[_0xcb89('0x3c')][_0xcb89('0x5c')]({'where':{'id':_0x5864a7[_0xcb89('0x54')]['id']}})[_0xcb89('0x1f')](handleEntityNotFound(_0x58d0d5,null))[_0xcb89('0x1f')](function(_0x15500d){if(_0x15500d){return _0x15500d[_0xcb89('0x91')](_0x5864a7[_0xcb89('0x57')][_0xcb89('0x72')],_[_0xcb89('0x92')](_0x5864a7['body'],[_0xcb89('0x72'),'id'])||{})[_0xcb89('0x93')](function(_0x2a771e){for(var _0x2293da=0x0;_0x2293da<_0x5864a7[_0xcb89('0x57')][_0xcb89('0x72')][_0xcb89('0x46')];_0x2293da+=0x1){socket[_0xcb89('0x79')](_0xcb89('0x7a'),{'UserId':_0x5864a7['body'][_0xcb89('0x72')][_0x2293da],'ChatQueueId':_0x5864a7['params']['id']});}return _0x2a771e;});}})[_0xcb89('0x1f')](respondWithResult(_0x58d0d5,null))['catch'](handleError(_0x58d0d5,null));};exports[_0xcb89('0x8f')]=function(_0x20b543,_0x54ee00,_0x1371b0){return db[_0xcb89('0x3c')][_0xcb89('0x5c')]({'where':{'id':_0x20b543[_0xcb89('0x54')]['id']}})[_0xcb89('0x1f')](handleEntityNotFound(_0x54ee00,null))['then'](function(_0xc81571){if(_0xc81571){return _0xc81571[_0xcb89('0x8f')](_0x20b543[_0xcb89('0x42')][_0xcb89('0x72')])[_0xcb89('0x1f')](function(){if(_[_0xcb89('0x94')](_0x20b543[_0xcb89('0x42')][_0xcb89('0x72')])){for(var _0x45f1b0=0x0;_0x45f1b0<_0x20b543[_0xcb89('0x42')][_0xcb89('0x72')][_0xcb89('0x46')];_0x45f1b0+=0x1){socket[_0xcb89('0x79')](_0xcb89('0x90'),{'UserId':Number(_0x20b543[_0xcb89('0x42')][_0xcb89('0x72')][_0x45f1b0]),'ChatQueueId':Number(_0x20b543[_0xcb89('0x54')]['id'])});}}else{socket[_0xcb89('0x79')]('userChatQueue:remove',{'UserId':Number(_0x20b543[_0xcb89('0x42')][_0xcb89('0x72')]),'ChatQueueId':Number(_0x20b543[_0xcb89('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x54ee00,null))[_0xcb89('0x2a')](handleError(_0x54ee00,null));};exports[_0xcb89('0x95')]=function(_0x671a09,_0x3f1da,_0x2542f6){var _0x34bf70={};var _0x5c5904={};var _0xa4452f;var _0x4595d9;return db[_0xcb89('0x3c')]['findOne']({'where':{'id':_0x671a09[_0xcb89('0x54')]['id']}})[_0xcb89('0x1f')](handleEntityNotFound(_0x3f1da,null))[_0xcb89('0x1f')](function(_0x31e0df){if(_0x31e0df){_0xa4452f=_0x31e0df;_0x5c5904['model']=_['keys'](db[_0xcb89('0x66')][_0xcb89('0x55')]);_0x5c5904['query']=_['keys'](_0x671a09[_0xcb89('0x42')]);_0x5c5904[_0xcb89('0x4b')]=_['intersection'](_0x5c5904['model'],_0x5c5904['query']);_0x34bf70['attributes']=_['intersection'](_0x5c5904[_0xcb89('0x40')],qs[_0xcb89('0x45')](_0x671a09[_0xcb89('0x42')][_0xcb89('0x45')]));_0x34bf70[_0xcb89('0x44')]=_0x34bf70[_0xcb89('0x44')][_0xcb89('0x46')]?_0x34bf70[_0xcb89('0x44')]:_0x5c5904[_0xcb89('0x40')];_0x34bf70['order']=qs[_0xcb89('0x4a')](_0x671a09[_0xcb89('0x42')][_0xcb89('0x4a')]);_0x34bf70[_0xcb89('0x4d')]=qs[_0xcb89('0x4b')](_[_0xcb89('0x64')](_0x671a09[_0xcb89('0x42')],_0x5c5904[_0xcb89('0x4b')]));if(_0x671a09[_0xcb89('0x42')][_0xcb89('0x4c')]){_0x34bf70['where']=_['merge'](_0x34bf70[_0xcb89('0x4d')],{'$or':_[_0xcb89('0x3b')](_0x34bf70[_0xcb89('0x44')],function(_0x324a8d){var _0x5697d8={};_0x5697d8[_0x324a8d]={'$like':'%'+_0x671a09['query']['filter']+'%'};return _0x5697d8;})});}_0x34bf70=_[_0xcb89('0x4f')]({},_0x34bf70,_0x671a09[_0xcb89('0x50')]);return _0xa4452f[_0xcb89('0x95')](_0x34bf70);}})['then'](function(_0x5da4ec){if(_0x5da4ec){_0x4595d9=_0x5da4ec[_0xcb89('0x46')];if(!_0x671a09[_0xcb89('0x42')][_0xcb89('0x63')](_0xcb89('0x47'))){_0x34bf70[_0xcb89('0x30')]=qs[_0xcb89('0x30')](_0x671a09[_0xcb89('0x42')]['limit']);_0x34bf70['offset']=qs[_0xcb89('0x48')](_0x671a09[_0xcb89('0x42')][_0xcb89('0x48')]);}return _0xa4452f['getAgents'](_0x34bf70);}})[_0xcb89('0x1f')](function(_0x5ab095){if(_0x5ab095){return _0x5ab095?{'count':_0x4595d9,'rows':_0x5ab095}:null;}})['then'](respondWithResult(_0x3f1da,null))[_0xcb89('0x2a')](handleError(_0x3f1da,null));}; \ No newline at end of file +var _0x7ed1=['findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','ids','online','voicePause','interface','flatMap','Agents','sequelize','addTeams','findOrCreate','emit','removeTeams','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','QueryTypes','SELECT','TeamId','includes','union','compact','value','transaction','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','jayson/promise','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','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','sendStatus','status','count','offset','limit','set','json','apply','reject','save','update','destroy','ChatQueues','end','name','send','index','map','ChatQueue','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','describe','getMembers','findOne','UserChatQueue','ChatQueueId','filter','User'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ed1,0xca));var _0x17ed=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x7ed1[_0x45d55e];return _0x29812a;};'use strict';var pdf=require(_0x17ed('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x17ed('0x1'));var zipdir=require(_0x17ed('0x2'));var jsonpatch=require(_0x17ed('0x3'));var rp=require(_0x17ed('0x4'));var moment=require(_0x17ed('0x5'));var BPromise=require(_0x17ed('0x6'));var Mustache=require('mustache');var util=require(_0x17ed('0x7'));var path=require(_0x17ed('0x8'));var sox=require(_0x17ed('0x9'));var csv=require(_0x17ed('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x17ed('0xb'));var crypto=require(_0x17ed('0xc'));var jsforce=require(_0x17ed('0xd'));var deskjs=require(_0x17ed('0xe'));var toCsv=require('to-csv');var querystring=require(_0x17ed('0xf'));var Papa=require(_0x17ed('0x10'));var Redis=require(_0x17ed('0x11'));var authService=require(_0x17ed('0x12'));var qs=require(_0x17ed('0x13'));var as=require(_0x17ed('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x17ed('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x17ed('0x16'));var db=require(_0x17ed('0x17'))['db'];config[_0x17ed('0x18')]=_[_0x17ed('0x19')](config[_0x17ed('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x17ed('0x1a'))(new Redis(config[_0x17ed('0x18')]));require(_0x17ed('0x1b'))['register'](socket);var jayson=require(_0x17ed('0x1c'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x30a0c6,_0x570d98,_0x41b741){if(_0x41b741){var _0x4782c3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4782c3[_0x17ed('0x1d')](_0x570d98)){return _0x30a0c6;}else{throw new db[(_0x17ed('0x1e'))]['ValidationError'](_0x17ed('0x1f'));}}else{return _0x30a0c6;}}function respondWithRpcPromise(_0x172ae9,_0x20b6d2,_0x5ade66,_0x52518e){return new BPromise(function(_0x81e1a6,_0x2903f3){var _0x933215=_0x52518e||client;return _0x933215[_0x17ed('0x20')](_0x172ae9,_0x5ade66)[_0x17ed('0x21')](function(_0x49340f){logger[_0x17ed('0x22')](_0x17ed('0x23'),_0x20b6d2,'request\x20sent');logger[_0x17ed('0x24')](_0x17ed('0x25'),_0x20b6d2,'request\x20sent',JSON[_0x17ed('0x26')](_0x49340f));if(_0x49340f[_0x17ed('0x27')]){if(_0x49340f[_0x17ed('0x27')][_0x17ed('0x28')]===0x1f4){logger[_0x17ed('0x27')](_0x17ed('0x23'),_0x20b6d2,_0x49340f[_0x17ed('0x27')]['message']);return _0x2903f3(_0x49340f[_0x17ed('0x27')][_0x17ed('0x29')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x20b6d2,_0x49340f[_0x17ed('0x27')]['message']);return _0x81e1a6(_0x49340f['error']['message']);}else{logger[_0x17ed('0x22')]('ChatQueue,\x20%s,\x20%s',_0x20b6d2,_0x17ed('0x2a'));_0x81e1a6(_0x49340f[_0x17ed('0x2b')][_0x17ed('0x29')]);}})['catch'](function(_0x294c46){logger[_0x17ed('0x27')](_0x17ed('0x23'),_0x20b6d2,_0x294c46);_0x2903f3(_0x294c46);});});}function respondWithStatusCode(_0x4d1de9,_0x57470d){_0x57470d=_0x57470d||0xcc;return function(_0x170d4f){if(_0x170d4f){return _0x4d1de9[_0x17ed('0x2c')](_0x57470d);}return _0x4d1de9[_0x17ed('0x2d')](_0x57470d)['end']();};}function respondWithResult(_0x38bb50,_0x2ca36a){_0x2ca36a=_0x2ca36a||0xc8;return function(_0x20ece2){if(_0x20ece2){return _0x38bb50[_0x17ed('0x2d')](_0x2ca36a)['json'](_0x20ece2);}};}function respondWithFilteredResult(_0x3cc924,_0x2aa89e){return function(_0x4dbfe3){if(_0x4dbfe3){var _0x35c300=_0x4dbfe3[_0x17ed('0x2e')],_0xd0289=_0x2aa89e[_0x17ed('0x2f')],_0xf325ed=_0x2aa89e[_0x17ed('0x2f')]+_0x2aa89e[_0x17ed('0x30')],_0x529966;if(_0xf325ed>=_0x35c300){_0xf325ed=_0x35c300;_0x529966=0xc8;}else{_0x529966=0xce;}_0x3cc924['status'](_0x529966);return _0x3cc924[_0x17ed('0x31')]('Content-Range',_0xd0289+'-'+_0xf325ed+'/'+_0x35c300)[_0x17ed('0x32')](_0x4dbfe3);}return null;};}function patchUpdates(_0x3f516f){return function(_0x1f091d){try{jsonpatch[_0x17ed('0x33')](_0x1f091d,_0x3f516f,!![]);}catch(_0x5415a2){return BPromise[_0x17ed('0x34')](_0x5415a2);}return _0x1f091d[_0x17ed('0x35')]();};}function saveUpdates(_0x8e1f33,_0x2bd7a6){return function(_0x3f25dc){if(_0x3f25dc){return _0x3f25dc[_0x17ed('0x36')](_0x8e1f33)[_0x17ed('0x21')](function(_0x1c8bf1){return _0x1c8bf1;});}return null;};}function removeEntity(_0x5c9796,_0x38be86){return function(_0x24e411){if(_0x24e411){return _0x24e411[_0x17ed('0x37')]()[_0x17ed('0x21')](function(){var _0x428ea0=_0x24e411['get']({'plain':!![]});var _0x2e6705=_0x17ed('0x38');return db['UserProfileResource']['destroy']({'where':{'type':_0x2e6705,'resourceId':_0x428ea0['id']}})['then'](function(){return _0x24e411;});})[_0x17ed('0x21')](function(){_0x5c9796['status'](0xcc)[_0x17ed('0x39')]();});}};}function handleEntityNotFound(_0x1c76c4,_0x40ba00){return function(_0x50a56a){if(!_0x50a56a){_0x1c76c4[_0x17ed('0x2c')](0x194);}return _0x50a56a;};}function handleError(_0x3c6547,_0x241c0b){_0x241c0b=_0x241c0b||0x1f4;return function(_0x471b09){logger[_0x17ed('0x27')](_0x471b09['stack']);if(_0x471b09[_0x17ed('0x3a')]){delete _0x471b09[_0x17ed('0x3a')];}_0x3c6547[_0x17ed('0x2d')](_0x241c0b)[_0x17ed('0x3b')](_0x471b09);};}exports[_0x17ed('0x3c')]=function(_0x12b49b,_0x54d037){var _0x5c1270={},_0x55874e={},_0x2f19cc={'count':0x0,'rows':[]};var _0x5639df=_[_0x17ed('0x3d')](db[_0x17ed('0x3e')]['rawAttributes'],function(_0x796a7d){return{'name':_0x796a7d[_0x17ed('0x3f')],'type':_0x796a7d[_0x17ed('0x40')][_0x17ed('0x41')]};});_0x55874e[_0x17ed('0x42')]=_[_0x17ed('0x3d')](_0x5639df,_0x17ed('0x3a'));_0x55874e[_0x17ed('0x43')]=_['keys'](_0x12b49b[_0x17ed('0x43')]);_0x55874e[_0x17ed('0x44')]=_[_0x17ed('0x45')](_0x55874e[_0x17ed('0x42')],_0x55874e[_0x17ed('0x43')]);_0x5c1270[_0x17ed('0x46')]=_[_0x17ed('0x45')](_0x55874e[_0x17ed('0x42')],qs[_0x17ed('0x47')](_0x12b49b[_0x17ed('0x43')][_0x17ed('0x47')]));_0x5c1270[_0x17ed('0x46')]=_0x5c1270[_0x17ed('0x46')][_0x17ed('0x48')]?_0x5c1270[_0x17ed('0x46')]:_0x55874e[_0x17ed('0x42')];if(!_0x12b49b[_0x17ed('0x43')][_0x17ed('0x49')](_0x17ed('0x4a'))){_0x5c1270['limit']=qs[_0x17ed('0x30')](_0x12b49b[_0x17ed('0x43')][_0x17ed('0x30')]);_0x5c1270[_0x17ed('0x2f')]=qs[_0x17ed('0x2f')](_0x12b49b['query'][_0x17ed('0x2f')]);}_0x5c1270[_0x17ed('0x4b')]=qs[_0x17ed('0x4c')](_0x12b49b[_0x17ed('0x43')][_0x17ed('0x4c')]);_0x5c1270[_0x17ed('0x4d')]=qs[_0x17ed('0x44')](_[_0x17ed('0x4e')](_0x12b49b[_0x17ed('0x43')],_0x55874e[_0x17ed('0x44')]));if(_0x12b49b[_0x17ed('0x43')]['filter']){_0x5c1270['where']=_[_0x17ed('0x4f')](_0x5c1270[_0x17ed('0x4d')],{'$or':_[_0x17ed('0x3d')](_0x5639df,function(_0x1e681c){if(_0x1e681c[_0x17ed('0x40')]!==_0x17ed('0x50')){var _0x1a26da={};_0x1a26da[_0x1e681c[_0x17ed('0x3a')]]={'$like':'%'+_0x12b49b[_0x17ed('0x43')]['filter']+'%'};return _0x1a26da;}})});}_0x5c1270=_[_0x17ed('0x4f')]({},_0x5c1270,_0x12b49b[_0x17ed('0x51')]);var _0x3fbcfd={'where':_0x5c1270['where']};return db['ChatQueue'][_0x17ed('0x2e')](_0x3fbcfd)[_0x17ed('0x21')](function(_0x504279){_0x2f19cc['count']=_0x504279;if(_0x12b49b['query'][_0x17ed('0x52')]){_0x5c1270[_0x17ed('0x53')]=[{'all':!![]}];}return db[_0x17ed('0x3e')][_0x17ed('0x54')](_0x5c1270);})[_0x17ed('0x21')](function(_0x1449c5){_0x2f19cc[_0x17ed('0x55')]=_0x1449c5;return _0x2f19cc;})[_0x17ed('0x21')](respondWithFilteredResult(_0x54d037,_0x5c1270))[_0x17ed('0x56')](handleError(_0x54d037,null));};exports[_0x17ed('0x57')]=function(_0x2a64d1,_0xbeff00){var _0x58e211={'raw':!![],'where':{'id':_0x2a64d1[_0x17ed('0x58')]['id']}},_0x23359a={};_0x23359a['model']=_[_0x17ed('0x59')](db[_0x17ed('0x3e')][_0x17ed('0x5a')]);_0x23359a[_0x17ed('0x43')]=_[_0x17ed('0x59')](_0x2a64d1[_0x17ed('0x43')]);_0x23359a['filters']=_[_0x17ed('0x45')](_0x23359a['model'],_0x23359a[_0x17ed('0x43')]);_0x58e211['attributes']=_[_0x17ed('0x45')](_0x23359a[_0x17ed('0x42')],qs[_0x17ed('0x47')](_0x2a64d1['query']['fields']));_0x58e211[_0x17ed('0x46')]=_0x58e211[_0x17ed('0x46')][_0x17ed('0x48')]?_0x58e211[_0x17ed('0x46')]:_0x23359a[_0x17ed('0x42')];if(_0x2a64d1[_0x17ed('0x43')]['includeAll']){_0x58e211['include']=[{'all':!![]}];}_0x58e211=_[_0x17ed('0x4f')]({},_0x58e211,_0x2a64d1[_0x17ed('0x51')]);return db[_0x17ed('0x3e')][_0x17ed('0x5b')](_0x58e211)['then'](handleEntityNotFound(_0xbeff00,null))['then'](respondWithResult(_0xbeff00,null))[_0x17ed('0x56')](handleError(_0xbeff00,null));};exports[_0x17ed('0x5c')]=function(_0x21ea2a,_0x215e6c){return db[_0x17ed('0x3e')][_0x17ed('0x5c')](_0x21ea2a['body'],{})['then'](function(_0x4211a7){var _0x57568b=_0x21ea2a[_0x17ed('0x5d')]['get']({'plain':!![]});if(!_0x57568b)throw new Error(_0x17ed('0x5e'));if(_0x57568b['role']===_0x17ed('0x5d')){var _0x1251fb=_0x4211a7[_0x17ed('0x5f')]({'plain':!![]});var _0xb16079='ChatQueues';return db[_0x17ed('0x60')][_0x17ed('0x5b')]({'where':{'name':_0xb16079,'userProfileId':_0x57568b[_0x17ed('0x61')]},'raw':!![]})['then'](function(_0x10821b){if(_0x10821b&&_0x10821b[_0x17ed('0x62')]===0x0){return db[_0x17ed('0x63')][_0x17ed('0x5c')]({'name':_0x1251fb['name'],'resourceId':_0x1251fb['id'],'type':_0x10821b[_0x17ed('0x3a')],'sectionId':_0x10821b['id']},{})['then'](function(){return _0x4211a7;});}else{return _0x4211a7;}})[_0x17ed('0x56')](function(_0x3c2e9f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c2e9f);throw _0x3c2e9f;});}return _0x4211a7;})[_0x17ed('0x21')](respondWithResult(_0x215e6c,0xc9))[_0x17ed('0x56')](handleError(_0x215e6c,null));};exports[_0x17ed('0x36')]=function(_0x5f3850,_0x2a7f3f){if(_0x5f3850[_0x17ed('0x64')]['id']){delete _0x5f3850['body']['id'];}return db['ChatQueue'][_0x17ed('0x5b')]({'where':{'id':_0x5f3850[_0x17ed('0x58')]['id']}})[_0x17ed('0x21')](handleEntityNotFound(_0x2a7f3f,null))[_0x17ed('0x21')](saveUpdates(_0x5f3850[_0x17ed('0x64')],null))[_0x17ed('0x21')](respondWithResult(_0x2a7f3f,null))[_0x17ed('0x56')](handleError(_0x2a7f3f,null));};exports['destroy']=function(_0x570ee4,_0xde5a9d){return db[_0x17ed('0x3e')]['find']({'where':{'id':_0x570ee4['params']['id']}})[_0x17ed('0x21')](handleEntityNotFound(_0xde5a9d,null))['then'](removeEntity(_0xde5a9d,null))['catch'](handleError(_0xde5a9d,null));};exports[_0x17ed('0x65')]=function(_0x5368d5,_0x5619c4){return db[_0x17ed('0x3e')][_0x17ed('0x65')]()['then'](respondWithResult(_0x5619c4,null))[_0x17ed('0x56')](handleError(_0x5619c4,null));};exports[_0x17ed('0x66')]=function(_0x15ef76,_0x2cdaf8,_0xe4a0c0){var _0x3f81c3={'raw':!![],'where':{}},_0x26e2f3={},_0x5ee1b6;return db[_0x17ed('0x3e')][_0x17ed('0x67')]({'where':{'id':_0x15ef76[_0x17ed('0x58')]['id']}})[_0x17ed('0x21')](handleEntityNotFound(_0x2cdaf8,null))[_0x17ed('0x21')](function(_0x3bb729){if(_0x3bb729){_0x5ee1b6=_0x3bb729[_0x17ed('0x5f')]({'plain':!![]});_0x26e2f3[_0x17ed('0x42')]=_[_0x17ed('0x59')](db[_0x17ed('0x68')][_0x17ed('0x5a')]);_0x26e2f3[_0x17ed('0x43')]=_['keys'](_0x15ef76[_0x17ed('0x43')]);_0x26e2f3['filters']=_['intersection'](_0x26e2f3['model'],_0x26e2f3[_0x17ed('0x43')]);_0x3f81c3[_0x17ed('0x46')]=_[_0x17ed('0x45')](_0x26e2f3[_0x17ed('0x42')],qs['fields'](_0x15ef76[_0x17ed('0x43')][_0x17ed('0x47')]));_0x3f81c3[_0x17ed('0x46')]=_0x3f81c3[_0x17ed('0x46')][_0x17ed('0x48')]?_0x3f81c3[_0x17ed('0x46')]:_0x26e2f3[_0x17ed('0x42')];if(!_0x15ef76[_0x17ed('0x43')]['hasOwnProperty']('nolimit')){_0x3f81c3['limit']=qs['limit'](_0x15ef76['query']['limit']);_0x3f81c3[_0x17ed('0x2f')]=qs[_0x17ed('0x2f')](_0x15ef76[_0x17ed('0x43')][_0x17ed('0x2f')]);}_0x3f81c3[_0x17ed('0x4b')]=qs[_0x17ed('0x4c')](_0x15ef76[_0x17ed('0x43')][_0x17ed('0x4c')]);_0x3f81c3['where']=qs['filters'](_[_0x17ed('0x4e')](_0x15ef76[_0x17ed('0x43')],_0x26e2f3[_0x17ed('0x44')]));_0x3f81c3[_0x17ed('0x4d')][_0x17ed('0x69')]=_0x3bb729['id'];if(_0x15ef76[_0x17ed('0x43')][_0x17ed('0x6a')]){_0x3f81c3[_0x17ed('0x4d')]=_[_0x17ed('0x4f')](_0x3f81c3['where'],{'$or':_[_0x17ed('0x3d')](_0x3f81c3[_0x17ed('0x46')],function(_0xd72793){var _0x3d3d2b={};_0x3d3d2b[_0xd72793]={'$like':'%'+_0x15ef76['query'][_0x17ed('0x6a')]+'%'};return _0x3d3d2b;})});}_0x3f81c3=_['merge']({},_0x3f81c3,_0x15ef76['options']);return db[_0x17ed('0x68')]['findAll'](_0x3f81c3);}})['then'](function(_0x192f95){if(_0x192f95){return db[_0x17ed('0x6b')][_0x17ed('0x6c')]({'where':{'id':_[_0x17ed('0x3d')](_0x192f95,_0x17ed('0x6d')),'role':_0x17ed('0x6e')},'attributes':['id',_0x17ed('0x3a'),_0x17ed('0x6f'),_0x17ed('0x70'),_0x17ed('0x71')]});}})[_0x17ed('0x21')](function(_0x19b159){if(_0x19b159){return{'count':_0x19b159[_0x17ed('0x2e')],'rows':_[_0x17ed('0x3d')](_0x19b159[_0x17ed('0x55')],function(_0x15c552){return{'membername':_0x15c552[_0x17ed('0x3a')],'UserId':_0x15c552['id'],'queue_name':_0x5ee1b6[_0x17ed('0x3a')],'ChatQueueId':_0x5ee1b6['id'],'interface':util[_0x17ed('0x72')](_0x17ed('0x73'),_0x17ed('0x74'),_0x15c552[_0x17ed('0x3a')]),'penalty':0x0,'paused':_0x15c552[_0x17ed('0x6f')],'createdAt':_0x15c552['createdAt'],'updatedAt':_0x15c552[_0x17ed('0x70')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x17ed('0x21')](respondWithFilteredResult(_0x2cdaf8,_0x3f81c3))['catch'](handleError(_0x2cdaf8,null));};exports[_0x17ed('0x75')]=function(_0x8dc4d8,_0x8dd920,_0x1d1abf){var _0x326847={};var _0x1e4ee7={};var _0x56cee3;var _0x46e9c5;return db['ChatQueue']['findOne']({'where':{'id':_0x8dc4d8[_0x17ed('0x58')]['id']}})[_0x17ed('0x21')](handleEntityNotFound(_0x8dd920,null))[_0x17ed('0x21')](function(_0xf9b37b){if(_0xf9b37b){_0x56cee3=_0xf9b37b;_0x1e4ee7[_0x17ed('0x42')]=_[_0x17ed('0x59')](db[_0x17ed('0x76')][_0x17ed('0x5a')]);_0x1e4ee7[_0x17ed('0x43')]=_[_0x17ed('0x59')](_0x8dc4d8[_0x17ed('0x43')]);_0x1e4ee7[_0x17ed('0x44')]=_[_0x17ed('0x45')](_0x1e4ee7['model'],_0x1e4ee7['query']);_0x326847[_0x17ed('0x46')]=_[_0x17ed('0x45')](_0x1e4ee7[_0x17ed('0x42')],qs[_0x17ed('0x47')](_0x8dc4d8['query'][_0x17ed('0x47')]));_0x326847[_0x17ed('0x46')]=_0x326847[_0x17ed('0x46')][_0x17ed('0x48')]?_0x326847[_0x17ed('0x46')]:_0x1e4ee7[_0x17ed('0x42')];_0x326847[_0x17ed('0x4b')]=qs[_0x17ed('0x4c')](_0x8dc4d8[_0x17ed('0x43')][_0x17ed('0x4c')]);_0x326847[_0x17ed('0x4d')]=qs[_0x17ed('0x44')](_[_0x17ed('0x4e')](_0x8dc4d8[_0x17ed('0x43')],_0x1e4ee7[_0x17ed('0x44')]));if(_0x8dc4d8['query'][_0x17ed('0x6a')]){_0x326847[_0x17ed('0x4d')]=_[_0x17ed('0x4f')](_0x326847[_0x17ed('0x4d')],{'$or':_[_0x17ed('0x3d')](_0x326847['attributes'],function(_0x37d6f9){var _0x390b64={};_0x390b64[_0x37d6f9]={'$like':'%'+_0x8dc4d8['query']['filter']+'%'};return _0x390b64;})});}_0x326847=_['merge']({},_0x326847,_0x8dc4d8[_0x17ed('0x51')]);return _0x56cee3['getTeams'](_0x326847);}})[_0x17ed('0x21')](function(_0x1892bd){if(_0x1892bd){_0x46e9c5=_0x1892bd['length'];if(!_0x8dc4d8[_0x17ed('0x43')][_0x17ed('0x49')](_0x17ed('0x4a'))){_0x326847[_0x17ed('0x30')]=qs[_0x17ed('0x30')](_0x8dc4d8[_0x17ed('0x43')][_0x17ed('0x30')]);_0x326847[_0x17ed('0x2f')]=qs[_0x17ed('0x2f')](_0x8dc4d8[_0x17ed('0x43')]['offset']);}return _0x56cee3[_0x17ed('0x75')](_0x326847);}})[_0x17ed('0x21')](function(_0x35f73f){if(_0x35f73f){return _0x35f73f?{'count':_0x46e9c5,'rows':_0x35f73f}:null;}})[_0x17ed('0x21')](respondWithResult(_0x8dd920,null))[_0x17ed('0x56')](handleError(_0x8dd920,null));};exports['addTeams']=function(_0x5cdb9d,_0x5739b4,_0x3fb0ad){var _0x15561c=_0x5cdb9d[_0x17ed('0x64')][_0x17ed('0x77')];return db['Team']['findAll']({'where':{'id':_0x15561c},'attributes':['id'],'include':[{'model':db[_0x17ed('0x6b')],'as':'Agents','attributes':['id',_0x17ed('0x3a'),_0x17ed('0x78'),_0x17ed('0x79'),_0x17ed('0x7a')],'raw':!![]}]})['then'](function(_0xb39c36){if(_0xb39c36){var _0x16c1a8=_[_0x17ed('0x7b')](_0xb39c36,function(_0x58e343){var _0xa43beb=_0x58e343['get']({'plain':!![]});return _0xa43beb[_0x17ed('0x7c')];});return db[_0x17ed('0x3e')][_0x17ed('0x5b')]({'where':{'id':_0x5cdb9d[_0x17ed('0x58')]['id']}})['then'](function(_0x5d08ea){return db[_0x17ed('0x7d')]['transaction'](function(_0x12845c){return _0x5d08ea[_0x17ed('0x7e')](_0x15561c,{'transaction':_0x12845c})[_0x17ed('0x21')](function(){return BPromise['each'](_0x16c1a8,function(_0x1c7fa8){return db['UserChatQueue'][_0x17ed('0x7f')]({'where':{'UserId':_0x1c7fa8['id'],'ChatQueueId':_0x5cdb9d[_0x17ed('0x58')]['id']},'transaction':_0x12845c});});})[_0x17ed('0x21')](function(){_0x16c1a8['forEach'](function(_0x4660c6){socket[_0x17ed('0x80')]('userChatQueue:save',{'UserId':_0x4660c6['id'],'ChatQueueId':_0x5d08ea['id']});});});});});}})['then'](respondWithStatusCode(_0x5739b4,null))[_0x17ed('0x56')](handleError(_0x5739b4,null));};exports[_0x17ed('0x81')]=function(_0x53fa80,_0x303f8c,_0x2e045f){return db[_0x17ed('0x76')][_0x17ed('0x54')]({'where':{'id':_0x53fa80['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x17ed('0x6b')],'as':_0x17ed('0x7c'),'attributes':['id'],'raw':!![]}]})[_0x17ed('0x21')](handleEntityNotFound(_0x303f8c,null))[_0x17ed('0x21')](function(_0xfacf77){var _0x101a31=_['map'](_0xfacf77,'id');var _0x2f686b=[];var _0x31f7c3=[];var _0x4cbed2=squel[_0x17ed('0x82')]();_0x4cbed2[_0x17ed('0x83')](_0x17ed('0x84'))[_0x17ed('0x85')]('team_has_chat_queues','tq')[_0x17ed('0x86')]('user_has_teams','ut',_0x17ed('0x87'))['where']('ChatQueueId\x20=\x20?',_0x53fa80['params']['id']);for(var _0xfa28ef=0x0;_0xfa28ef<_0xfacf77[_0x17ed('0x48')];_0xfa28ef+=0x1){let _0x37ba94=_0xfacf77[_0xfa28ef];for(var _0x4e70db=0x0;_0x4e70db<_0x37ba94[_0x17ed('0x7c')][_0x17ed('0x48')];_0x4e70db+=0x1){let _0xae1617=_0x37ba94['Agents'][_0x4e70db];var _0x5ed83d=_0x4cbed2['clone']();_0x5ed83d[_0x17ed('0x4d')](_0x17ed('0x88'),_0xae1617['id']);_0x31f7c3['push'](db[_0x17ed('0x7d')][_0x17ed('0x43')](_0x5ed83d['toString'](),{'type':db['sequelize'][_0x17ed('0x89')][_0x17ed('0x8a')]})[_0x17ed('0x21')](function(_0x44b0a4){if(_0x44b0a4['length']===0x1){return _0xae1617['id'];}else{var _0x48c235=_['every'](_['map'](_0x44b0a4,_0x17ed('0x8b')),function(_0x12bf35){return _[_0x17ed('0x8c')](_0x101a31,_0x12bf35);});if(_0x48c235){return _0xae1617['id'];}}}));}}return BPromise['all'](_0x31f7c3)['then'](function(_0x1db6bc){_0x2f686b=_(_0x2f686b)[_0x17ed('0x8d')](_0x1db6bc)[_0x17ed('0x8e')]()[_0x17ed('0x8f')]();return db[_0x17ed('0x3e')][_0x17ed('0x5b')]({'where':{'id':_0x53fa80['params']['id']}})['then'](function(_0x5d856b){return db[_0x17ed('0x7d')][_0x17ed('0x90')](function(_0x5d677e){return _0x5d856b[_0x17ed('0x81')](_0x53fa80[_0x17ed('0x43')][_0x17ed('0x77')],{'transaction':_0x5d677e})[_0x17ed('0x21')](function(){if(!_[_0x17ed('0x91')](_0x2f686b)){return _0x5d856b[_0x17ed('0x92')](_0x2f686b,{'transaction':_0x5d677e});}})[_0x17ed('0x21')](function(){_0x2f686b[_0x17ed('0x93')](function(_0x2ea773){socket[_0x17ed('0x80')](_0x17ed('0x94'),{'UserId':_0x2ea773,'ChatQueueId':_0x5d856b['id']});});});});});});})[_0x17ed('0x21')](respondWithStatusCode(_0x303f8c,null))[_0x17ed('0x56')](handleError(_0x303f8c,null));};exports[_0x17ed('0x95')]=function(_0x55892d,_0x14b06e,_0x426865){return db['ChatQueue'][_0x17ed('0x5b')]({'where':{'id':_0x55892d[_0x17ed('0x58')]['id']}})[_0x17ed('0x21')](handleEntityNotFound(_0x14b06e,null))['then'](function(_0x289022){if(_0x289022){return _0x289022[_0x17ed('0x95')](_0x55892d[_0x17ed('0x64')]['ids'],_[_0x17ed('0x96')](_0x55892d[_0x17ed('0x64')],[_0x17ed('0x77'),'id'])||{})[_0x17ed('0x97')](function(_0x1388f0){for(var _0x2f7fda=0x0;_0x2f7fda<_0x55892d[_0x17ed('0x64')][_0x17ed('0x77')][_0x17ed('0x48')];_0x2f7fda+=0x1){socket[_0x17ed('0x80')](_0x17ed('0x98'),{'UserId':_0x55892d[_0x17ed('0x64')][_0x17ed('0x77')][_0x2f7fda],'ChatQueueId':_0x55892d[_0x17ed('0x58')]['id']});}return _0x1388f0;});}})['then'](respondWithResult(_0x14b06e,null))[_0x17ed('0x56')](handleError(_0x14b06e,null));};exports[_0x17ed('0x92')]=function(_0x5502a0,_0x12c5f2,_0x3e7464){return db[_0x17ed('0x3e')]['find']({'where':{'id':_0x5502a0[_0x17ed('0x58')]['id']}})['then'](handleEntityNotFound(_0x12c5f2,null))['then'](function(_0x4ed59d){if(_0x4ed59d){return _0x4ed59d['removeAgents'](_0x5502a0['query']['ids'])['then'](function(){if(_[_0x17ed('0x99')](_0x5502a0['query'][_0x17ed('0x77')])){for(var _0x211d56=0x0;_0x211d56<_0x5502a0['query']['ids'][_0x17ed('0x48')];_0x211d56+=0x1){socket[_0x17ed('0x80')](_0x17ed('0x94'),{'UserId':Number(_0x5502a0[_0x17ed('0x43')][_0x17ed('0x77')][_0x211d56]),'ChatQueueId':Number(_0x5502a0['params']['id'])});}}else{socket[_0x17ed('0x80')](_0x17ed('0x94'),{'UserId':Number(_0x5502a0[_0x17ed('0x43')][_0x17ed('0x77')]),'ChatQueueId':Number(_0x5502a0['params']['id'])});}});}})[_0x17ed('0x21')](respondWithStatusCode(_0x12c5f2,null))[_0x17ed('0x56')](handleError(_0x12c5f2,null));};exports[_0x17ed('0x9a')]=function(_0x41135f,_0x563c45,_0x5c7909){var _0x5078ea={};var _0xb6b6ae={};var _0x1ed072;var _0x2c1e98;return db[_0x17ed('0x3e')][_0x17ed('0x67')]({'where':{'id':_0x41135f[_0x17ed('0x58')]['id']}})[_0x17ed('0x21')](handleEntityNotFound(_0x563c45,null))['then'](function(_0x26d707){if(_0x26d707){_0x1ed072=_0x26d707;_0xb6b6ae[_0x17ed('0x42')]=_[_0x17ed('0x59')](db[_0x17ed('0x6b')][_0x17ed('0x5a')]);_0xb6b6ae[_0x17ed('0x43')]=_['keys'](_0x41135f['query']);_0xb6b6ae[_0x17ed('0x44')]=_['intersection'](_0xb6b6ae[_0x17ed('0x42')],_0xb6b6ae[_0x17ed('0x43')]);_0x5078ea[_0x17ed('0x46')]=_[_0x17ed('0x45')](_0xb6b6ae[_0x17ed('0x42')],qs[_0x17ed('0x47')](_0x41135f[_0x17ed('0x43')][_0x17ed('0x47')]));_0x5078ea[_0x17ed('0x46')]=_0x5078ea[_0x17ed('0x46')][_0x17ed('0x48')]?_0x5078ea[_0x17ed('0x46')]:_0xb6b6ae[_0x17ed('0x42')];_0x5078ea['order']=qs[_0x17ed('0x4c')](_0x41135f[_0x17ed('0x43')]['sort']);_0x5078ea[_0x17ed('0x4d')]=qs[_0x17ed('0x44')](_[_0x17ed('0x4e')](_0x41135f['query'],_0xb6b6ae[_0x17ed('0x44')]));if(_0x41135f[_0x17ed('0x43')][_0x17ed('0x6a')]){_0x5078ea[_0x17ed('0x4d')]=_[_0x17ed('0x4f')](_0x5078ea[_0x17ed('0x4d')],{'$or':_[_0x17ed('0x3d')](_0x5078ea[_0x17ed('0x46')],function(_0x3f5d97){var _0x3bd0fd={};_0x3bd0fd[_0x3f5d97]={'$like':'%'+_0x41135f[_0x17ed('0x43')][_0x17ed('0x6a')]+'%'};return _0x3bd0fd;})});}_0x5078ea=_[_0x17ed('0x4f')]({},_0x5078ea,_0x41135f[_0x17ed('0x51')]);return _0x1ed072[_0x17ed('0x9a')](_0x5078ea);}})[_0x17ed('0x21')](function(_0x439769){if(_0x439769){_0x2c1e98=_0x439769['length'];if(!_0x41135f['query']['hasOwnProperty'](_0x17ed('0x4a'))){_0x5078ea[_0x17ed('0x30')]=qs[_0x17ed('0x30')](_0x41135f['query'][_0x17ed('0x30')]);_0x5078ea[_0x17ed('0x2f')]=qs[_0x17ed('0x2f')](_0x41135f[_0x17ed('0x43')][_0x17ed('0x2f')]);}return _0x1ed072[_0x17ed('0x9a')](_0x5078ea);}})[_0x17ed('0x21')](function(_0x42fcdc){if(_0x42fcdc){return _0x42fcdc?{'count':_0x2c1e98,'rows':_0x42fcdc}:null;}})['then'](respondWithResult(_0x563c45,null))[_0x17ed('0x56')](handleError(_0x563c45,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index a2da615..d958351 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 _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x467d3c,_0x12870a){var _0x17f422=function(_0x27d485){while(--_0x27d485){_0x467d3c['push'](_0x467d3c['shift']());}};_0x17f422(++_0x12870a);}(_0xb10b,0x12a));var _0xbb10=function(_0x1b925b,_0x1ab3c9){_0x1b925b=_0x1b925b-0x0;var _0x275f07=_0xb10b[_0x1b925b];return _0x275f07;};'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 +var _0x0b0e=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x88cb8c,_0x5f371e){var _0x50c472=function(_0x5aac39){while(--_0x5aac39){_0x88cb8c['push'](_0x88cb8c['shift']());}};_0x50c472(++_0x5f371e);}(_0x0b0e,0x187));var _0xe0b0=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0x0b0e[_0x18cac4];return _0x2227c6;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatQueueEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatQueueEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatQueue[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 8dd6c8b..e46d3df 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 _0xbbe5=['chat_queues','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x3f09e9,_0x8cbc4a){var _0x5ebd26=function(_0x57580c){while(--_0x57580c){_0x3f09e9['push'](_0x3f09e9['shift']());}};_0x5ebd26(++_0x8cbc4a);}(_0xbbe5,0xc9));var _0x5bbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbe5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x5bbe('0x0'));var logger=require(_0x5bbe('0x1'))(_0x5bbe('0x2'));var moment=require(_0x5bbe('0x3'));var BPromise=require(_0x5bbe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5bbe('0x5'));var rimraf=require('rimraf');var config=require(_0x5bbe('0x6'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x50699a,_0xc5dc5e){return _0x50699a['define']('ChatQueue',attributes,{'tableName':_0x5bbe('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa475=['./chatQueue.attributes','define','ChatQueue','chat_queues','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3cf99c,_0x4a7728){var _0x2d8087=function(_0x5acecf){while(--_0x5acecf){_0x3cf99c['push'](_0x3cf99c['shift']());}};_0x2d8087(++_0x4a7728);}(_0xa475,0x10c));var _0x5a47=function(_0x4f9d10,_0x339740){_0x4f9d10=_0x4f9d10-0x0;var _0xd0af70=_0xa475[_0x4f9d10];return _0xd0af70;};'use strict';var _=require(_0x5a47('0x0'));var util=require(_0x5a47('0x1'));var logger=require('../../config/logger')(_0x5a47('0x2'));var moment=require(_0x5a47('0x3'));var BPromise=require('bluebird');var rp=require(_0x5a47('0x4'));var fs=require('fs');var path=require(_0x5a47('0x5'));var rimraf=require(_0x5a47('0x6'));var config=require(_0x5a47('0x7'));var attributes=require(_0x5a47('0x8'));module['exports']=function(_0x70558f,_0x2e7796){return _0x70558f[_0x5a47('0x9')](_0x5a47('0xa'),attributes,{'tableName':_0x5a47('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 1b12e30..447f3ad 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 _0xf15d=['info','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatQueue,\x20%s,\x20%s','message','result','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','map','include','model','ShowChatQueue','find'];(function(_0x223a35,_0x5bd3ba){var _0xbaf9d7=function(_0x486e96){while(--_0x486e96){_0x223a35['push'](_0x223a35['shift']());}};_0xbaf9d7(++_0x5bd3ba);}(_0xf15d,0x113));var _0xdf15=function(_0x17ef86,_0x21c63f){_0x17ef86=_0x17ef86-0x0;var _0x10cc89=_0xf15d[_0x17ef86];return _0x10cc89;};'use strict';var _=require(_0xdf15('0x0'));var util=require('util');var moment=require(_0xdf15('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdf15('0x2'));var db=require(_0xdf15('0x3'))['db'];var utils=require(_0xdf15('0x4'));var logger=require(_0xdf15('0x5'))('rpc');var config=require(_0xdf15('0x6'));var jayson=require(_0xdf15('0x7'));var client=jayson[_0xdf15('0x8')]['http']({'port':0x232a});config[_0xdf15('0x9')]=_[_0xdf15('0xa')](config[_0xdf15('0x9')],{'host':_0xdf15('0xb'),'port':0x18eb});var socket=require(_0xdf15('0xc'))(new Redis(config[_0xdf15('0x9')]));require(_0xdf15('0xd'))[_0xdf15('0xe')](socket);function respondWithRpcPromise(_0x327cad,_0x43f5ea,_0x790130){return new BPromise(function(_0x5d7666,_0x1075dd){return client[_0xdf15('0xf')](_0x327cad,_0x790130)[_0xdf15('0x10')](function(_0x427fd7){logger['info']('ChatQueue,\x20%s,\x20%s',_0x43f5ea,'request\x20sent');logger[_0xdf15('0x11')](_0xdf15('0x12'),_0x43f5ea,_0xdf15('0x13'),JSON[_0xdf15('0x14')](_0x427fd7));if(_0x427fd7[_0xdf15('0x15')]){if(_0x427fd7[_0xdf15('0x15')]['code']===0x1f4){logger[_0xdf15('0x15')](_0xdf15('0x16'),_0x43f5ea,_0x427fd7['error'][_0xdf15('0x17')]);return _0x1075dd(_0x427fd7['error'][_0xdf15('0x17')]);}logger['error'](_0xdf15('0x16'),_0x43f5ea,_0x427fd7['error'][_0xdf15('0x17')]);return _0x5d7666(_0x427fd7[_0xdf15('0x15')][_0xdf15('0x17')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x43f5ea,_0xdf15('0x13'));_0x5d7666(_0x427fd7[_0xdf15('0x18')][_0xdf15('0x17')]);}})['catch'](function(_0x32b4af){logger[_0xdf15('0x15')](_0xdf15('0x16'),_0x43f5ea,_0x32b4af);_0x1075dd(_0x32b4af);});});}exports[_0xdf15('0x19')]=function(_0x2cc5a5){var _0x6c5b93=this;return new Promise(function(_0x485449,_0x32f2f4){return db[_0xdf15('0x1a')][_0xdf15('0x1b')]({'raw':_0x2cc5a5[_0xdf15('0x1c')]?_0x2cc5a5['options'][_0xdf15('0x1d')]===undefined?!![]:![]:!![],'where':_0x2cc5a5['options']?_0x2cc5a5[_0xdf15('0x1c')][_0xdf15('0x1e')]||null:null,'attributes':_0x2cc5a5[_0xdf15('0x1c')]?_0x2cc5a5['options'][_0xdf15('0x1f')]||null:null,'limit':_0x2cc5a5['options']?_0x2cc5a5[_0xdf15('0x1c')]['limit']||null:null,'include':_0x2cc5a5['options']?_0x2cc5a5[_0xdf15('0x1c')]['include']?_[_0xdf15('0x20')](_0x2cc5a5['options'][_0xdf15('0x21')],function(_0x4142fc){return{'model':db[_0x4142fc[_0xdf15('0x22')]],'as':_0x4142fc['as'],'attributes':_0x4142fc[_0xdf15('0x1f')],'include':_0x4142fc[_0xdf15('0x21')]?_[_0xdf15('0x20')](_0x4142fc['include'],function(_0x518101){return{'model':db[_0x518101[_0xdf15('0x22')]],'as':_0x518101['as'],'attributes':_0x518101[_0xdf15('0x1f')],'include':_0x518101[_0xdf15('0x21')]?_[_0xdf15('0x20')](_0x518101[_0xdf15('0x21')],function(_0x5e95b1){return{'model':db[_0x5e95b1['model']],'as':_0x5e95b1['as'],'attributes':_0x5e95b1[_0xdf15('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdf15('0x10')](function(_0xac3af6){logger['info'](_0xdf15('0x19'),_0x2cc5a5);logger[_0xdf15('0x11')](_0xdf15('0x19'),_0x2cc5a5,JSON[_0xdf15('0x14')](_0xac3af6));_0x485449(_0xac3af6);})['catch'](function(_0x1a4e26){logger[_0xdf15('0x15')](_0xdf15('0x19'),_0x1a4e26['message'],_0x2cc5a5);_0x32f2f4(_0x6c5b93[_0xdf15('0x15')](0x1f4,_0x1a4e26[_0xdf15('0x17')]));});});};exports[_0xdf15('0x23')]=function(_0x7bf825){var _0x26b73b=this;return new Promise(function(_0x2670b5,_0x4a071c){return db[_0xdf15('0x1a')][_0xdf15('0x24')]({'raw':_0x7bf825[_0xdf15('0x1c')]?_0x7bf825['options'][_0xdf15('0x1d')]===undefined?!![]:![]:!![],'where':_0x7bf825[_0xdf15('0x1c')]?_0x7bf825[_0xdf15('0x1c')]['where']||null:null,'attributes':_0x7bf825[_0xdf15('0x1c')]?_0x7bf825[_0xdf15('0x1c')][_0xdf15('0x1f')]||null:null,'include':_0x7bf825[_0xdf15('0x1c')]?_0x7bf825[_0xdf15('0x1c')][_0xdf15('0x21')]?_['map'](_0x7bf825[_0xdf15('0x1c')][_0xdf15('0x21')],function(_0x2d2dca){return{'model':db[_0x2d2dca[_0xdf15('0x22')]],'as':_0x2d2dca['as'],'attributes':_0x2d2dca[_0xdf15('0x1f')],'include':_0x2d2dca[_0xdf15('0x21')]?_[_0xdf15('0x20')](_0x2d2dca[_0xdf15('0x21')],function(_0x1f9851){return{'model':db[_0x1f9851[_0xdf15('0x22')]],'as':_0x1f9851['as'],'attributes':_0x1f9851[_0xdf15('0x1f')],'include':_0x1f9851['include']?_[_0xdf15('0x20')](_0x1f9851[_0xdf15('0x21')],function(_0x5c4f2e){return{'model':db[_0x5c4f2e[_0xdf15('0x22')]],'as':_0x5c4f2e['as'],'attributes':_0x5c4f2e[_0xdf15('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdf15('0x10')](function(_0x1399e3){logger[_0xdf15('0x25')](_0xdf15('0x23'),_0x7bf825);logger[_0xdf15('0x11')]('ShowChatQueue',_0x7bf825,JSON[_0xdf15('0x14')](_0x1399e3));_0x2670b5(_0x1399e3);})[_0xdf15('0x26')](function(_0x221a5a){logger['error'](_0xdf15('0x23'),_0x221a5a[_0xdf15('0x17')],_0x7bf825);_0x4a071c(_0x26b73b[_0xdf15('0x15')](0x1f4,_0x221a5a[_0xdf15('0x17')]));});});}; \ No newline at end of file +var _0x082b=['ChatQueue','findAll','options','where','limit','include','map','attributes','model','ShowChatQueue','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetChatQueue'];(function(_0x1f1e4b,_0x3330f1){var _0x36c267=function(_0x232eac){while(--_0x232eac){_0x1f1e4b['push'](_0x1f1e4b['shift']());}};_0x36c267(++_0x3330f1);}(_0x082b,0x1ec));var _0xb082=function(_0x1c5b1a,_0x3db3fe){_0x1c5b1a=_0x1c5b1a-0x0;var _0x351b48=_0x082b[_0x1c5b1a];return _0x351b48;};'use strict';var _=require(_0xb082('0x0'));var util=require(_0xb082('0x1'));var moment=require(_0xb082('0x2'));var BPromise=require(_0xb082('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb082('0x4'));var db=require(_0xb082('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb082('0x6'))(_0xb082('0x7'));var config=require('../../config/environment');var jayson=require(_0xb082('0x8'));var client=jayson[_0xb082('0x9')][_0xb082('0xa')]({'port':0x232a});config[_0xb082('0xb')]=_['defaults'](config[_0xb082('0xb')],{'host':_0xb082('0xc'),'port':0x18eb});var socket=require(_0xb082('0xd'))(new Redis(config['redis']));require(_0xb082('0xe'))[_0xb082('0xf')](socket);function respondWithRpcPromise(_0x2cea94,_0x362f97,_0x52d0ef){return new BPromise(function(_0x3b87d9,_0x4d95a4){return client[_0xb082('0x10')](_0x2cea94,_0x52d0ef)[_0xb082('0x11')](function(_0x5307a2){logger['info'](_0xb082('0x12'),_0x362f97,_0xb082('0x13'));logger[_0xb082('0x14')](_0xb082('0x15'),_0x362f97,_0xb082('0x13'),JSON[_0xb082('0x16')](_0x5307a2));if(_0x5307a2[_0xb082('0x17')]){if(_0x5307a2[_0xb082('0x17')]['code']===0x1f4){logger[_0xb082('0x17')](_0xb082('0x12'),_0x362f97,_0x5307a2[_0xb082('0x17')][_0xb082('0x18')]);return _0x4d95a4(_0x5307a2[_0xb082('0x17')]['message']);}logger[_0xb082('0x17')](_0xb082('0x12'),_0x362f97,_0x5307a2[_0xb082('0x17')][_0xb082('0x18')]);return _0x3b87d9(_0x5307a2[_0xb082('0x17')][_0xb082('0x18')]);}else{logger[_0xb082('0x19')]('ChatQueue,\x20%s,\x20%s',_0x362f97,'request\x20sent');_0x3b87d9(_0x5307a2['result'][_0xb082('0x18')]);}})[_0xb082('0x1a')](function(_0x569c86){logger[_0xb082('0x17')](_0xb082('0x12'),_0x362f97,_0x569c86);_0x4d95a4(_0x569c86);});});}exports[_0xb082('0x1b')]=function(_0x239794){var _0x566551=this;return new Promise(function(_0x138a40,_0x428160){return db[_0xb082('0x1c')][_0xb082('0x1d')]({'raw':_0x239794['options']?_0x239794[_0xb082('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x239794[_0xb082('0x1e')]?_0x239794[_0xb082('0x1e')][_0xb082('0x1f')]||null:null,'attributes':_0x239794[_0xb082('0x1e')]?_0x239794[_0xb082('0x1e')]['attributes']||null:null,'limit':_0x239794[_0xb082('0x1e')]?_0x239794[_0xb082('0x1e')][_0xb082('0x20')]||null:null,'include':_0x239794['options']?_0x239794[_0xb082('0x1e')][_0xb082('0x21')]?_[_0xb082('0x22')](_0x239794[_0xb082('0x1e')]['include'],function(_0x5ca741){return{'model':db[_0x5ca741['model']],'as':_0x5ca741['as'],'attributes':_0x5ca741[_0xb082('0x23')],'include':_0x5ca741[_0xb082('0x21')]?_[_0xb082('0x22')](_0x5ca741[_0xb082('0x21')],function(_0x4b39eb){return{'model':db[_0x4b39eb[_0xb082('0x24')]],'as':_0x4b39eb['as'],'attributes':_0x4b39eb[_0xb082('0x23')],'include':_0x4b39eb[_0xb082('0x21')]?_[_0xb082('0x22')](_0x4b39eb[_0xb082('0x21')],function(_0x45ff35){return{'model':db[_0x45ff35['model']],'as':_0x45ff35['as'],'attributes':_0x45ff35[_0xb082('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x569978){logger['info'](_0xb082('0x1b'),_0x239794);logger[_0xb082('0x14')](_0xb082('0x1b'),_0x239794,JSON['stringify'](_0x569978));_0x138a40(_0x569978);})[_0xb082('0x1a')](function(_0x1a5e6c){logger[_0xb082('0x17')](_0xb082('0x1b'),_0x1a5e6c[_0xb082('0x18')],_0x239794);_0x428160(_0x566551[_0xb082('0x17')](0x1f4,_0x1a5e6c[_0xb082('0x18')]));});});};exports[_0xb082('0x25')]=function(_0x5c5214){var _0x8dabd9=this;return new Promise(function(_0x192eff,_0x3ba20b){return db[_0xb082('0x1c')][_0xb082('0x26')]({'raw':_0x5c5214[_0xb082('0x1e')]?_0x5c5214[_0xb082('0x1e')][_0xb082('0x27')]===undefined?!![]:![]:!![],'where':_0x5c5214[_0xb082('0x1e')]?_0x5c5214[_0xb082('0x1e')][_0xb082('0x1f')]||null:null,'attributes':_0x5c5214[_0xb082('0x1e')]?_0x5c5214[_0xb082('0x1e')][_0xb082('0x23')]||null:null,'include':_0x5c5214[_0xb082('0x1e')]?_0x5c5214[_0xb082('0x1e')]['include']?_['map'](_0x5c5214[_0xb082('0x1e')][_0xb082('0x21')],function(_0x1cdffa){return{'model':db[_0x1cdffa[_0xb082('0x24')]],'as':_0x1cdffa['as'],'attributes':_0x1cdffa['attributes'],'include':_0x1cdffa['include']?_['map'](_0x1cdffa[_0xb082('0x21')],function(_0x275453){return{'model':db[_0x275453[_0xb082('0x24')]],'as':_0x275453['as'],'attributes':_0x275453['attributes'],'include':_0x275453[_0xb082('0x21')]?_['map'](_0x275453[_0xb082('0x21')],function(_0x48d9b7){return{'model':db[_0x48d9b7[_0xb082('0x24')]],'as':_0x48d9b7['as'],'attributes':_0x48d9b7[_0xb082('0x23')]};}):[]};}):[]};}):[]:[]})[_0xb082('0x11')](function(_0x3b7338){logger['info'](_0xb082('0x25'),_0x5c5214);logger[_0xb082('0x14')](_0xb082('0x25'),_0x5c5214,JSON[_0xb082('0x16')](_0x3b7338));_0x192eff(_0x3b7338);})['catch'](function(_0x521769){logger[_0xb082('0x17')]('ShowChatQueue',_0x521769[_0xb082('0x18')],_0x5c5214);_0x3ba20b(_0x8dabd9[_0xb082('0x17')](0x1f4,_0x521769[_0xb082('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index b02f516..d47d0f2 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(_0x21aafd,_0x1f0fa6){var _0x9f2800=function(_0xf23734){while(--_0xf23734){_0x21aafd['push'](_0x21aafd['shift']());}};_0x9f2800(++_0x1f0fa6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x31f9f2,_0x1290be){_0x31f9f2=_0x31f9f2-0x0;var _0x16b768=_0x5f2f[_0x31f9f2];return _0x16b768;};'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 _0xadb5=['update','emit','register','length','chatQueue:','save'];(function(_0x55d269,_0x2bd2b5){var _0x430689=function(_0x7075f6){while(--_0x7075f6){_0x55d269['push'](_0x55d269['shift']());}};_0x430689(++_0x2bd2b5);}(_0xadb5,0xad));var _0x5adb=function(_0x29e3bf,_0x854d88){_0x29e3bf=_0x29e3bf-0x0;var _0x2d9fe0=_0xadb5[_0x29e3bf];return _0x2d9fe0;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x5adb('0x0'),'remove',_0x5adb('0x1')];function createListener(_0x38f67f,_0x3129c3){return function(_0x4aecec){_0x3129c3[_0x5adb('0x2')](_0x38f67f,_0x4aecec);};}function removeListener(_0x31457,_0x2e3ef4){return function(){ChatQueueEvents['removeListener'](_0x31457,_0x2e3ef4);};}exports[_0x5adb('0x3')]=function(_0x168d89){for(var _0x3e2555=0x0,_0x3213e8=events[_0x5adb('0x4')];_0x3e2555<_0x3213e8;_0x3e2555++){var _0x353885=events[_0x3e2555];var _0x47228a=createListener(_0x5adb('0x5')+_0x353885,_0x168d89);ChatQueueEvents['on'](_0x353885,_0x47228a);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 46e3331..af84e4b 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 _0x77f0=['get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','create','post','addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatQueue.controller'];(function(_0x25292a,_0x4d8ca6){var _0xc58efe=function(_0x176802){while(--_0x176802){_0x25292a['push'](_0x25292a['shift']());}};_0xc58efe(++_0x4d8ca6);}(_0x77f0,0x105));var _0x077f=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0x77f0[_0x1e3c16];return _0x47a0c9;};'use strict';var multer=require(_0x077f('0x0'));var util=require(_0x077f('0x1'));var path=require(_0x077f('0x2'));var timeout=require(_0x077f('0x3'));var express=require(_0x077f('0x4'));var router=express[_0x077f('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x077f('0x6'));var config=require(_0x077f('0x7'));var controller=require(_0x077f('0x8'));router[_0x077f('0x9')]('/',auth[_0x077f('0xa')](),controller[_0x077f('0xb')]);router[_0x077f('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x077f('0xc')]);router[_0x077f('0x9')](_0x077f('0xd'),auth['isAuthenticated'](),controller[_0x077f('0xe')]);router[_0x077f('0x9')](_0x077f('0xf'),auth[_0x077f('0xa')](),controller[_0x077f('0x10')]);router[_0x077f('0x9')](_0x077f('0x11'),auth[_0x077f('0xa')](),controller[_0x077f('0x12')]);router['get'](_0x077f('0x13'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x077f('0xa')](),controller[_0x077f('0x14')]);router[_0x077f('0x15')](_0x077f('0x11'),auth[_0x077f('0xa')](),controller[_0x077f('0x16')]);router[_0x077f('0x15')](_0x077f('0x13'),auth['isAuthenticated'](),controller['addAgents']);router[_0x077f('0x17')](_0x077f('0xd'),auth[_0x077f('0xa')](),controller[_0x077f('0x18')]);router[_0x077f('0x19')](_0x077f('0xd'),auth['isAuthenticated'](),controller[_0x077f('0x1a')]);router['delete'](_0x077f('0x11'),auth['isAuthenticated'](),controller[_0x077f('0x1b')]);router[_0x077f('0x19')](_0x077f('0x13'),auth['isAuthenticated'](),controller[_0x077f('0x1c')]);module[_0x077f('0x1d')]=router; \ No newline at end of file +var _0x16a1=['../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','/describe','isAuthenticated','describe','/:id','/:id/teams','getTeams','/:id/users','create','post','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','Router'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x16a1,0x194));var _0x116a=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x16a1[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x116a('0x0'));var util=require('util');var path=require(_0x116a('0x1'));var timeout=require(_0x116a('0x2'));var express=require('express');var router=express[_0x116a('0x3')]();var auth=require(_0x116a('0x4'));var interaction=require(_0x116a('0x5'));var config=require('../../config/environment');var controller=require(_0x116a('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x116a('0x7')](_0x116a('0x8'),auth[_0x116a('0x9')](),controller[_0x116a('0xa')]);router[_0x116a('0x7')](_0x116a('0xb'),auth[_0x116a('0x9')](),controller['show']);router[_0x116a('0x7')]('/:id/members',auth[_0x116a('0x9')](),controller['getMembers']);router[_0x116a('0x7')](_0x116a('0xc'),auth['isAuthenticated'](),controller[_0x116a('0xd')]);router[_0x116a('0x7')](_0x116a('0xe'),auth[_0x116a('0x9')](),controller['getAgents']);router['post']('/',auth[_0x116a('0x9')](),controller[_0x116a('0xf')]);router[_0x116a('0x10')](_0x116a('0xc'),auth[_0x116a('0x9')](),controller['addTeams']);router[_0x116a('0x10')](_0x116a('0xe'),auth[_0x116a('0x9')](),controller[_0x116a('0x11')]);router[_0x116a('0x12')](_0x116a('0xb'),auth[_0x116a('0x9')](),controller[_0x116a('0x13')]);router[_0x116a('0x14')](_0x116a('0xb'),auth[_0x116a('0x9')](),controller['destroy']);router[_0x116a('0x14')](_0x116a('0xc'),auth[_0x116a('0x9')](),controller[_0x116a('0x15')]);router[_0x116a('0x14')](_0x116a('0xe'),auth[_0x116a('0x9')](),controller[_0x116a('0x16')]);module[_0x116a('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index c611031..8a9f2ad 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 _0xfaa5=['moment','sequelize','exports','STRING','DATE'];(function(_0x5ef35b,_0x3af430){var _0x95faa=function(_0x251cd9){while(--_0x251cd9){_0x5ef35b['push'](_0x5ef35b['shift']());}};_0x95faa(++_0x3af430);}(_0xfaa5,0x186));var _0x5faa=function(_0x29d2d2,_0x3344){_0x29d2d2=_0x29d2d2-0x0;var _0x3f6476=_0xfaa5[_0x29d2d2];return _0x3f6476;};'use strict';var moment=require(_0x5faa('0x0'));var Sequelize=require(_0x5faa('0x1'));module[_0x5faa('0x2')]={'uniqueid':{'type':Sequelize[_0x5faa('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x5faa('0x3')]},'joinAt':{'type':Sequelize[_0x5faa('0x4')]},'leaveAt':{'type':Sequelize[_0x5faa('0x4')]},'acceptAt':{'type':Sequelize[_0x5faa('0x4')]},'exitAt':{'type':Sequelize[_0x5faa('0x4')]},'reason':{'type':Sequelize[_0x5faa('0x3')]}}; \ No newline at end of file +var _0xccd8=['exports','STRING','DATE','moment','sequelize'];(function(_0x1b820f,_0x425eb4){var _0x423354=function(_0x3a8426){while(--_0x3a8426){_0x1b820f['push'](_0x1b820f['shift']());}};_0x423354(++_0x425eb4);}(_0xccd8,0x67));var _0x8ccd=function(_0x484b91,_0x3ad43d){_0x484b91=_0x484b91-0x0;var _0x561175=_0xccd8[_0x484b91];return _0x561175;};'use strict';var moment=require(_0x8ccd('0x0'));var Sequelize=require(_0x8ccd('0x1'));module[_0x8ccd('0x2')]={'uniqueid':{'type':Sequelize[_0x8ccd('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8ccd('0x3')]},'joinAt':{'type':Sequelize[_0x8ccd('0x4')]},'leaveAt':{'type':Sequelize[_0x8ccd('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x8ccd('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index d85be49..9558987 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 _0x9179=['squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','count','offset','set','apply','reject','save','destroy','then','end','error','name','send','index','map','ChatQueueReport','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','nolimit','limit','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','find','create','body','update','params','describe','html-pdf','eml-format','rimraf','moment','bluebird','mustache','sox','to-csv','ejs','lodash'];(function(_0x2a0c1a,_0x2f1b2e){var _0x487f9b=function(_0x5e7088){while(--_0x5e7088){_0x2a0c1a['push'](_0x2a0c1a['shift']());}};_0x487f9b(++_0x2f1b2e);}(_0x9179,0x17c));var _0x9917=function(_0x3e33cf,_0xd5b878){_0x3e33cf=_0x3e33cf-0x0;var _0x3c8b1a=_0x9179[_0x3e33cf];return _0x3c8b1a;};'use strict';var pdf=require(_0x9917('0x0'));var emlformat=require(_0x9917('0x1'));var rimraf=require(_0x9917('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9917('0x3'));var BPromise=require(_0x9917('0x4'));var Mustache=require(_0x9917('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9917('0x6'));var csv=require(_0x9917('0x7'));var ejs=require(_0x9917('0x8'));var fs=require('fs');var _=require(_0x9917('0x9'));var squel=require(_0x9917('0xa'));var crypto=require('crypto');var jsforce=require(_0x9917('0xb'));var deskjs=require(_0x9917('0xc'));var toCsv=require(_0x9917('0x7'));var querystring=require(_0x9917('0xd'));var Papa=require(_0x9917('0xe'));var Redis=require(_0x9917('0xf'));var authService=require(_0x9917('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9917('0x11'));var hardwareService=require(_0x9917('0x12'));var logger=require('../../config/logger')(_0x9917('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x9917('0x14'))['db'];function respondWithStatusCode(_0x4aa31a,_0x566275){_0x566275=_0x566275||0xcc;return function(_0x1f2afc){if(_0x1f2afc){return _0x4aa31a[_0x9917('0x15')](_0x566275);}return _0x4aa31a[_0x9917('0x16')](_0x566275)['end']();};}function respondWithResult(_0x51c29b,_0x503857){_0x503857=_0x503857||0xc8;return function(_0x3e7e61){if(_0x3e7e61){return _0x51c29b['status'](_0x503857)['json'](_0x3e7e61);}};}function respondWithFilteredResult(_0x2a6227,_0x258bf3){return function(_0x49753e){if(_0x49753e){var _0xa9e649=_0x49753e[_0x9917('0x17')],_0xa32af8=_0x258bf3['offset'],_0x2a5c0c=_0x258bf3[_0x9917('0x18')]+_0x258bf3['limit'],_0x1090d7;if(_0x2a5c0c>=_0xa9e649){_0x2a5c0c=_0xa9e649;_0x1090d7=0xc8;}else{_0x1090d7=0xce;}_0x2a6227['status'](_0x1090d7);return _0x2a6227[_0x9917('0x19')]('Content-Range',_0xa32af8+'-'+_0x2a5c0c+'/'+_0xa9e649)['json'](_0x49753e);}return null;};}function patchUpdates(_0x58e702){return function(_0x44a04d){try{jsonpatch[_0x9917('0x1a')](_0x44a04d,_0x58e702,!![]);}catch(_0x814529){return BPromise[_0x9917('0x1b')](_0x814529);}return _0x44a04d[_0x9917('0x1c')]();};}function saveUpdates(_0x3c3bd2,_0x1fb4b9){return function(_0x24ca67){if(_0x24ca67){return _0x24ca67['update'](_0x3c3bd2)['then'](function(_0x3bc5a0){return _0x3bc5a0;});}return null;};}function removeEntity(_0x5a6bd7,_0x7b6c22){return function(_0x1ec265){if(_0x1ec265){return _0x1ec265[_0x9917('0x1d')]()[_0x9917('0x1e')](function(){_0x5a6bd7[_0x9917('0x16')](0xcc)[_0x9917('0x1f')]();});}};}function handleEntityNotFound(_0x2dd3eb,_0x3a43ed){return function(_0xd59a24){if(!_0xd59a24){_0x2dd3eb[_0x9917('0x15')](0x194);}return _0xd59a24;};}function handleError(_0x40637d,_0x30bc23){_0x30bc23=_0x30bc23||0x1f4;return function(_0x356366){logger[_0x9917('0x20')](_0x356366['stack']);if(_0x356366[_0x9917('0x21')]){delete _0x356366['name'];}_0x40637d[_0x9917('0x16')](_0x30bc23)[_0x9917('0x22')](_0x356366);};}exports[_0x9917('0x23')]=function(_0x548f68,_0x1d9dff){var _0xd35372={},_0xfb5aad={},_0x7360f0={'count':0x0,'rows':[]};var _0x2e62d7=_[_0x9917('0x24')](db[_0x9917('0x25')][_0x9917('0x26')],function(_0x29a1b0){return{'name':_0x29a1b0['fieldName'],'type':_0x29a1b0[_0x9917('0x27')][_0x9917('0x28')]};});_0xfb5aad[_0x9917('0x29')]=_[_0x9917('0x24')](_0x2e62d7,'name');_0xfb5aad['query']=_[_0x9917('0x2a')](_0x548f68[_0x9917('0x2b')]);_0xfb5aad['filters']=_[_0x9917('0x2c')](_0xfb5aad[_0x9917('0x29')],_0xfb5aad[_0x9917('0x2b')]);_0xd35372[_0x9917('0x2d')]=_['intersection'](_0xfb5aad[_0x9917('0x29')],qs[_0x9917('0x2e')](_0x548f68[_0x9917('0x2b')]['fields']));_0xd35372['attributes']=_0xd35372[_0x9917('0x2d')]['length']?_0xd35372[_0x9917('0x2d')]:_0xfb5aad[_0x9917('0x29')];if(!_0x548f68[_0x9917('0x2b')]['hasOwnProperty'](_0x9917('0x2f'))){_0xd35372[_0x9917('0x30')]=qs[_0x9917('0x30')](_0x548f68[_0x9917('0x2b')][_0x9917('0x30')]);_0xd35372[_0x9917('0x18')]=qs[_0x9917('0x18')](_0x548f68[_0x9917('0x2b')][_0x9917('0x18')]);}_0xd35372['order']=qs[_0x9917('0x31')](_0x548f68[_0x9917('0x2b')]['sort']);_0xd35372['where']=qs['filters'](_[_0x9917('0x32')](_0x548f68['query'],_0xfb5aad['filters']));if(_0x548f68[_0x9917('0x2b')][_0x9917('0x33')]){_0xd35372[_0x9917('0x34')]=_[_0x9917('0x35')](_0xd35372['where'],{'$or':_[_0x9917('0x24')](_0x2e62d7,function(_0x319bef){if(_0x319bef[_0x9917('0x27')]!=='VIRTUAL'){var _0x37c8db={};_0x37c8db[_0x319bef[_0x9917('0x21')]]={'$like':'%'+_0x548f68[_0x9917('0x2b')][_0x9917('0x33')]+'%'};return _0x37c8db;}})});}_0xd35372=_[_0x9917('0x35')]({},_0xd35372,_0x548f68[_0x9917('0x36')]);var _0x30a169={'where':_0xd35372['where']};return db[_0x9917('0x25')][_0x9917('0x17')](_0x30a169)[_0x9917('0x1e')](function(_0x39e577){_0x7360f0[_0x9917('0x17')]=_0x39e577;if(_0x548f68[_0x9917('0x2b')][_0x9917('0x37')]){_0xd35372[_0x9917('0x38')]=[{'all':!![]}];}return db[_0x9917('0x25')]['findAll'](_0xd35372);})[_0x9917('0x1e')](function(_0x590d44){_0x7360f0[_0x9917('0x39')]=_0x590d44;return _0x7360f0;})[_0x9917('0x1e')](respondWithFilteredResult(_0x1d9dff,_0xd35372))[_0x9917('0x3a')](handleError(_0x1d9dff,null));};exports['show']=function(_0x18b706,_0x2a34cc){var _0x58d1f9={'raw':!![],'where':{'id':_0x18b706['params']['id']}},_0x289b59={};_0x289b59[_0x9917('0x29')]=_['keys'](db[_0x9917('0x25')][_0x9917('0x26')]);_0x289b59['query']=_['keys'](_0x18b706['query']);_0x289b59['filters']=_[_0x9917('0x2c')](_0x289b59[_0x9917('0x29')],_0x289b59[_0x9917('0x2b')]);_0x58d1f9[_0x9917('0x2d')]=_['intersection'](_0x289b59[_0x9917('0x29')],qs[_0x9917('0x2e')](_0x18b706['query'][_0x9917('0x2e')]));_0x58d1f9[_0x9917('0x2d')]=_0x58d1f9['attributes']['length']?_0x58d1f9['attributes']:_0x289b59[_0x9917('0x29')];if(_0x18b706[_0x9917('0x2b')][_0x9917('0x37')]){_0x58d1f9[_0x9917('0x38')]=[{'all':!![]}];}_0x58d1f9=_['merge']({},_0x58d1f9,_0x18b706[_0x9917('0x36')]);return db[_0x9917('0x25')][_0x9917('0x3b')](_0x58d1f9)[_0x9917('0x1e')](handleEntityNotFound(_0x2a34cc,null))[_0x9917('0x1e')](respondWithResult(_0x2a34cc,null))['catch'](handleError(_0x2a34cc,null));};exports[_0x9917('0x3c')]=function(_0x258650,_0xf4c33){return db[_0x9917('0x25')]['create'](_0x258650[_0x9917('0x3d')],{})['then'](respondWithResult(_0xf4c33,0xc9))[_0x9917('0x3a')](handleError(_0xf4c33,null));};exports[_0x9917('0x3e')]=function(_0x12d82c,_0x201970){if(_0x12d82c[_0x9917('0x3d')]['id']){delete _0x12d82c['body']['id'];}return db['ChatQueueReport'][_0x9917('0x3b')]({'where':{'id':_0x12d82c[_0x9917('0x3f')]['id']}})[_0x9917('0x1e')](handleEntityNotFound(_0x201970,null))['then'](saveUpdates(_0x12d82c[_0x9917('0x3d')],null))[_0x9917('0x1e')](respondWithResult(_0x201970,null))[_0x9917('0x3a')](handleError(_0x201970,null));};exports['destroy']=function(_0x55534a,_0x5cc763){return db['ChatQueueReport'][_0x9917('0x3b')]({'where':{'id':_0x55534a[_0x9917('0x3f')]['id']}})[_0x9917('0x1e')](handleEntityNotFound(_0x5cc763,null))[_0x9917('0x1e')](removeEntity(_0x5cc763,null))[_0x9917('0x3a')](handleError(_0x5cc763,null));};exports[_0x9917('0x40')]=function(_0x336117,_0x4c6357){return db[_0x9917('0x25')][_0x9917('0x40')]()['then'](respondWithResult(_0x4c6357,null))[_0x9917('0x3a')](handleError(_0x4c6357,null));}; \ No newline at end of file +var _0xdce4=['sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','findAll','params','rawAttributes','include','find','catch','create','update','body','describe','eml-format','zip-dir','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','json','apply','save','destroy','then','error','stack','send','index','map','ChatQueueReport','fieldName','type','key','name','query','keys','intersection','model','fields','attributes','length','nolimit','order'];(function(_0x59dc0b,_0xceb983){var _0x37de48=function(_0x571c9b){while(--_0x571c9b){_0x59dc0b['push'](_0x59dc0b['shift']());}};_0x37de48(++_0xceb983);}(_0xdce4,0x12b));var _0x4dce=function(_0x57dc69,_0x1481b0){_0x57dc69=_0x57dc69-0x0;var _0xdbeb4b=_0xdce4[_0x57dc69];return _0xdbeb4b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4dce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4dce('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4dce('0x2'));var moment=require(_0x4dce('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4dce('0x4'));var util=require('util');var path=require(_0x4dce('0x5'));var sox=require('sox');var csv=require(_0x4dce('0x6'));var ejs=require(_0x4dce('0x7'));var fs=require('fs');var _=require(_0x4dce('0x8'));var squel=require(_0x4dce('0x9'));var crypto=require('crypto');var jsforce=require(_0x4dce('0xa'));var deskjs=require(_0x4dce('0xb'));var toCsv=require(_0x4dce('0x6'));var querystring=require('querystring');var Papa=require(_0x4dce('0xc'));var Redis=require(_0x4dce('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4dce('0xe'));var hardwareService=require(_0x4dce('0xf'));var logger=require(_0x4dce('0x10'))(_0x4dce('0x11'));var utils=require(_0x4dce('0x12'));var config=require(_0x4dce('0x13'));var db=require(_0x4dce('0x14'))['db'];function respondWithStatusCode(_0x31f570,_0x3ca7a8){_0x3ca7a8=_0x3ca7a8||0xcc;return function(_0x4cd965){if(_0x4cd965){return _0x31f570[_0x4dce('0x15')](_0x3ca7a8);}return _0x31f570[_0x4dce('0x16')](_0x3ca7a8)[_0x4dce('0x17')]();};}function respondWithResult(_0x5224bb,_0x4ef475){_0x4ef475=_0x4ef475||0xc8;return function(_0x58a8a1){if(_0x58a8a1){return _0x5224bb['status'](_0x4ef475)['json'](_0x58a8a1);}};}function respondWithFilteredResult(_0x1a0978,_0x4e4783){return function(_0x125e3b){if(_0x125e3b){var _0x547774=_0x125e3b['count'],_0x4ea96b=_0x4e4783['offset'],_0x271090=_0x4e4783[_0x4dce('0x18')]+_0x4e4783[_0x4dce('0x19')],_0x218e96;if(_0x271090>=_0x547774){_0x271090=_0x547774;_0x218e96=0xc8;}else{_0x218e96=0xce;}_0x1a0978[_0x4dce('0x16')](_0x218e96);return _0x1a0978[_0x4dce('0x1a')]('Content-Range',_0x4ea96b+'-'+_0x271090+'/'+_0x547774)[_0x4dce('0x1b')](_0x125e3b);}return null;};}function patchUpdates(_0xa0e8e3){return function(_0x2beda8){try{jsonpatch[_0x4dce('0x1c')](_0x2beda8,_0xa0e8e3,!![]);}catch(_0x233c8c){return BPromise['reject'](_0x233c8c);}return _0x2beda8[_0x4dce('0x1d')]();};}function saveUpdates(_0x580e4d,_0x3d5546){return function(_0x1255d8){if(_0x1255d8){return _0x1255d8['update'](_0x580e4d)['then'](function(_0xac61ee){return _0xac61ee;});}return null;};}function removeEntity(_0x58b8fe,_0x195fbb){return function(_0x57de78){if(_0x57de78){return _0x57de78[_0x4dce('0x1e')]()[_0x4dce('0x1f')](function(){_0x58b8fe[_0x4dce('0x16')](0xcc)[_0x4dce('0x17')]();});}};}function handleEntityNotFound(_0x12b66e,_0x308435){return function(_0x3d7f38){if(!_0x3d7f38){_0x12b66e[_0x4dce('0x15')](0x194);}return _0x3d7f38;};}function handleError(_0x44257c,_0x561ca7){_0x561ca7=_0x561ca7||0x1f4;return function(_0x3b6dc3){logger[_0x4dce('0x20')](_0x3b6dc3[_0x4dce('0x21')]);if(_0x3b6dc3['name']){delete _0x3b6dc3['name'];}_0x44257c[_0x4dce('0x16')](_0x561ca7)[_0x4dce('0x22')](_0x3b6dc3);};}exports[_0x4dce('0x23')]=function(_0x481fdd,_0xef3f09){var _0x11fbac={},_0x3f4df6={},_0x52d9e0={'count':0x0,'rows':[]};var _0x5a2ab8=_[_0x4dce('0x24')](db[_0x4dce('0x25')]['rawAttributes'],function(_0x1079df){return{'name':_0x1079df[_0x4dce('0x26')],'type':_0x1079df[_0x4dce('0x27')][_0x4dce('0x28')]};});_0x3f4df6['model']=_['map'](_0x5a2ab8,_0x4dce('0x29'));_0x3f4df6[_0x4dce('0x2a')]=_[_0x4dce('0x2b')](_0x481fdd[_0x4dce('0x2a')]);_0x3f4df6['filters']=_[_0x4dce('0x2c')](_0x3f4df6[_0x4dce('0x2d')],_0x3f4df6[_0x4dce('0x2a')]);_0x11fbac['attributes']=_['intersection'](_0x3f4df6['model'],qs['fields'](_0x481fdd[_0x4dce('0x2a')][_0x4dce('0x2e')]));_0x11fbac[_0x4dce('0x2f')]=_0x11fbac['attributes'][_0x4dce('0x30')]?_0x11fbac[_0x4dce('0x2f')]:_0x3f4df6[_0x4dce('0x2d')];if(!_0x481fdd['query']['hasOwnProperty'](_0x4dce('0x31'))){_0x11fbac[_0x4dce('0x19')]=qs['limit'](_0x481fdd[_0x4dce('0x2a')][_0x4dce('0x19')]);_0x11fbac['offset']=qs[_0x4dce('0x18')](_0x481fdd['query']['offset']);}_0x11fbac[_0x4dce('0x32')]=qs['sort'](_0x481fdd[_0x4dce('0x2a')][_0x4dce('0x33')]);_0x11fbac[_0x4dce('0x34')]=qs[_0x4dce('0x35')](_['pick'](_0x481fdd[_0x4dce('0x2a')],_0x3f4df6[_0x4dce('0x35')]));if(_0x481fdd[_0x4dce('0x2a')][_0x4dce('0x36')]){_0x11fbac[_0x4dce('0x34')]=_[_0x4dce('0x37')](_0x11fbac[_0x4dce('0x34')],{'$or':_[_0x4dce('0x24')](_0x5a2ab8,function(_0x1444b6){if(_0x1444b6[_0x4dce('0x27')]!==_0x4dce('0x38')){var _0x21bf70={};_0x21bf70[_0x1444b6[_0x4dce('0x29')]]={'$like':'%'+_0x481fdd[_0x4dce('0x2a')][_0x4dce('0x36')]+'%'};return _0x21bf70;}})});}_0x11fbac=_[_0x4dce('0x37')]({},_0x11fbac,_0x481fdd[_0x4dce('0x39')]);var _0x5be2e7={'where':_0x11fbac[_0x4dce('0x34')]};return db['ChatQueueReport'][_0x4dce('0x3a')](_0x5be2e7)[_0x4dce('0x1f')](function(_0x2d15fb){_0x52d9e0[_0x4dce('0x3a')]=_0x2d15fb;if(_0x481fdd[_0x4dce('0x2a')][_0x4dce('0x3b')]){_0x11fbac['include']=[{'all':!![]}];}return db[_0x4dce('0x25')][_0x4dce('0x3c')](_0x11fbac);})[_0x4dce('0x1f')](function(_0x464b17){_0x52d9e0['rows']=_0x464b17;return _0x52d9e0;})[_0x4dce('0x1f')](respondWithFilteredResult(_0xef3f09,_0x11fbac))['catch'](handleError(_0xef3f09,null));};exports['show']=function(_0x1ac111,_0x22b994){var _0x66e7f4={'raw':!![],'where':{'id':_0x1ac111[_0x4dce('0x3d')]['id']}},_0x2546b7={};_0x2546b7[_0x4dce('0x2d')]=_['keys'](db[_0x4dce('0x25')][_0x4dce('0x3e')]);_0x2546b7[_0x4dce('0x2a')]=_[_0x4dce('0x2b')](_0x1ac111[_0x4dce('0x2a')]);_0x2546b7[_0x4dce('0x35')]=_[_0x4dce('0x2c')](_0x2546b7[_0x4dce('0x2d')],_0x2546b7[_0x4dce('0x2a')]);_0x66e7f4['attributes']=_[_0x4dce('0x2c')](_0x2546b7[_0x4dce('0x2d')],qs[_0x4dce('0x2e')](_0x1ac111['query']['fields']));_0x66e7f4[_0x4dce('0x2f')]=_0x66e7f4[_0x4dce('0x2f')]['length']?_0x66e7f4['attributes']:_0x2546b7[_0x4dce('0x2d')];if(_0x1ac111[_0x4dce('0x2a')][_0x4dce('0x3b')]){_0x66e7f4[_0x4dce('0x3f')]=[{'all':!![]}];}_0x66e7f4=_[_0x4dce('0x37')]({},_0x66e7f4,_0x1ac111[_0x4dce('0x39')]);return db[_0x4dce('0x25')][_0x4dce('0x40')](_0x66e7f4)[_0x4dce('0x1f')](handleEntityNotFound(_0x22b994,null))[_0x4dce('0x1f')](respondWithResult(_0x22b994,null))[_0x4dce('0x41')](handleError(_0x22b994,null));};exports[_0x4dce('0x42')]=function(_0x3c5074,_0x4967da){return db[_0x4dce('0x25')][_0x4dce('0x42')](_0x3c5074['body'],{})['then'](respondWithResult(_0x4967da,0xc9))[_0x4dce('0x41')](handleError(_0x4967da,null));};exports[_0x4dce('0x43')]=function(_0xca8d1b,_0x2a2c7a){if(_0xca8d1b[_0x4dce('0x44')]['id']){delete _0xca8d1b[_0x4dce('0x44')]['id'];}return db[_0x4dce('0x25')]['find']({'where':{'id':_0xca8d1b['params']['id']}})[_0x4dce('0x1f')](handleEntityNotFound(_0x2a2c7a,null))[_0x4dce('0x1f')](saveUpdates(_0xca8d1b['body'],null))['then'](respondWithResult(_0x2a2c7a,null))[_0x4dce('0x41')](handleError(_0x2a2c7a,null));};exports[_0x4dce('0x1e')]=function(_0x34f524,_0x48032f){return db[_0x4dce('0x25')][_0x4dce('0x40')]({'where':{'id':_0x34f524['params']['id']}})[_0x4dce('0x1f')](handleEntityNotFound(_0x48032f,null))[_0x4dce('0x1f')](removeEntity(_0x48032f,null))[_0x4dce('0x41')](handleError(_0x48032f,null));};exports[_0x4dce('0x45')]=function(_0x51a97f,_0x29c0b0){return db[_0x4dce('0x25')]['describe']()[_0x4dce('0x1f')](respondWithResult(_0x29c0b0,null))[_0x4dce('0x41')](handleError(_0x29c0b0,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index af1f0ef..5cfa6b2 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 _0xb951=['lodash','util','../../config/logger','api','bluebird','request-promise','path','./chatQueueReport.attributes','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x2650e9,_0xb91cc){var _0x3511c8=function(_0x5069cf){while(--_0x5069cf){_0x2650e9['push'](_0x2650e9['shift']());}};_0x3511c8(++_0xb91cc);}(_0xb951,0x1d4));var _0x1b95=function(_0x582598,_0x311dc5){_0x582598=_0x582598-0x0;var _0x1de137=_0xb951[_0x582598];return _0x1de137;};'use strict';var _=require(_0x1b95('0x0'));var util=require(_0x1b95('0x1'));var logger=require(_0x1b95('0x2'))(_0x1b95('0x3'));var moment=require('moment');var BPromise=require(_0x1b95('0x4'));var rp=require(_0x1b95('0x5'));var fs=require('fs');var path=require(_0x1b95('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1b95('0x7'));module['exports']=function(_0x51a71e,_0x4c0ba5){return _0x51a71e[_0x1b95('0x8')](_0x1b95('0x9'),attributes,{'tableName':_0x1b95('0xa'),'paranoid':![],'indexes':[{'name':_0x1b95('0xb'),'fields':[_0x1b95('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x60ce=['exports','define','report_chat_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes'];(function(_0x57829d,_0x26e8e1){var _0x5d7af2=function(_0x4dd139){while(--_0x4dd139){_0x57829d['push'](_0x57829d['shift']());}};_0x5d7af2(++_0x26e8e1);}(_0x60ce,0x66));var _0xe60c=function(_0x12779c,_0x2bac29){_0x12779c=_0x12779c-0x0;var _0x3dd41a=_0x60ce[_0x12779c];return _0x3dd41a;};'use strict';var _=require(_0xe60c('0x0'));var util=require(_0xe60c('0x1'));var logger=require(_0xe60c('0x2'))(_0xe60c('0x3'));var moment=require(_0xe60c('0x4'));var BPromise=require('bluebird');var rp=require(_0xe60c('0x5'));var fs=require('fs');var path=require(_0xe60c('0x6'));var rimraf=require(_0xe60c('0x7'));var config=require(_0xe60c('0x8'));var attributes=require(_0xe60c('0x9'));module[_0xe60c('0xa')]=function(_0x6b884f,_0x46b4d7){return _0x6b884f[_0xe60c('0xb')]('ChatQueueReport',attributes,{'tableName':_0xe60c('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe60c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 7b70c6a..17a1bf2 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 _0x7f20=['limit','util','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','debug','UpdateChatQueueReport','where','attributes'];(function(_0x3189e6,_0x5c6560){var _0x2838c6=function(_0xac63e8){while(--_0xac63e8){_0x3189e6['push'](_0x3189e6['shift']());}};_0x2838c6(++_0x5c6560);}(_0x7f20,0x12d));var _0x07f2=function(_0x1e5344,_0x56bd22){_0x1e5344=_0x1e5344-0x0;var _0x3a2639=_0x7f20[_0x1e5344];return _0x3a2639;};'use strict';var _=require('lodash');var util=require(_0x07f2('0x0'));var moment=require('moment');var BPromise=require(_0x07f2('0x1'));var rs=require(_0x07f2('0x2'));var fs=require('fs');var Redis=require(_0x07f2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x07f2('0x4'));var config=require(_0x07f2('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x07f2('0x6')][_0x07f2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xe53c2e,_0x421f5b,_0xea5df1){return new BPromise(function(_0x1e2104,_0x115211){return client['request'](_0xe53c2e,_0xea5df1)[_0x07f2('0x8')](function(_0x5307d2){logger[_0x07f2('0x9')](_0x07f2('0xa'),_0x421f5b,_0x07f2('0xb'));logger['debug'](_0x07f2('0xc'),_0x421f5b,_0x07f2('0xb'),JSON[_0x07f2('0xd')](_0x5307d2));if(_0x5307d2[_0x07f2('0xe')]){if(_0x5307d2[_0x07f2('0xe')][_0x07f2('0xf')]===0x1f4){logger[_0x07f2('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x421f5b,_0x5307d2[_0x07f2('0xe')][_0x07f2('0x10')]);return _0x115211(_0x5307d2['error'][_0x07f2('0x10')]);}logger[_0x07f2('0xe')](_0x07f2('0xa'),_0x421f5b,_0x5307d2['error'][_0x07f2('0x10')]);return _0x1e2104(_0x5307d2['error'][_0x07f2('0x10')]);}else{logger[_0x07f2('0x9')](_0x07f2('0xa'),_0x421f5b,_0x07f2('0xb'));_0x1e2104(_0x5307d2[_0x07f2('0x11')][_0x07f2('0x10')]);}})[_0x07f2('0x12')](function(_0x1a8497){logger[_0x07f2('0xe')](_0x07f2('0xa'),_0x421f5b,_0x1a8497);_0x115211(_0x1a8497);});});}exports[_0x07f2('0x13')]=function(_0x19a238){var _0x1e4ed8=this;return new Promise(function(_0x120e04,_0x5f1c18){return db[_0x07f2('0x14')][_0x07f2('0x15')](_0x19a238[_0x07f2('0x16')],{'raw':_0x19a238[_0x07f2('0x17')]?_0x19a238[_0x07f2('0x17')][_0x07f2('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x3067f9){logger[_0x07f2('0x9')](_0x07f2('0x13'),_0x19a238);logger[_0x07f2('0x19')](_0x07f2('0x13'),_0x19a238,JSON[_0x07f2('0xd')](_0x3067f9));_0x120e04(_0x3067f9);})['catch'](function(_0x22717d){logger[_0x07f2('0xe')]('CreateChatQueueReport',_0x22717d['message'],_0x19a238);_0x5f1c18(_0x1e4ed8[_0x07f2('0xe')](0x1f4,_0x22717d[_0x07f2('0x10')]));});});};exports[_0x07f2('0x1a')]=function(_0x82cb97){var _0x7629ab=this;return new Promise(function(_0x1f06ed,_0x1a86a6){return db[_0x07f2('0x14')]['update'](_0x82cb97[_0x07f2('0x16')],{'raw':_0x82cb97[_0x07f2('0x17')]?_0x82cb97[_0x07f2('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x82cb97['options']?_0x82cb97[_0x07f2('0x17')][_0x07f2('0x1b')]||null:null,'attributes':_0x82cb97[_0x07f2('0x17')]?_0x82cb97[_0x07f2('0x17')][_0x07f2('0x1c')]||null:null,'limit':_0x82cb97['options']?_0x82cb97[_0x07f2('0x17')][_0x07f2('0x1d')]||null:null})[_0x07f2('0x8')](function(_0x2327c7){logger['info'](_0x07f2('0x1a'),_0x82cb97);logger['debug'](_0x07f2('0x1a'),_0x82cb97,JSON['stringify'](_0x2327c7));_0x1f06ed(_0x2327c7);})['catch'](function(_0x15aeff){logger[_0x07f2('0xe')](_0x07f2('0x1a'),_0x15aeff[_0x07f2('0x10')],_0x82cb97);_0x1a86a6(_0x7629ab[_0x07f2('0xe')](0x1f4,_0x15aeff[_0x07f2('0x10')]));});});}; \ No newline at end of file +var _0x744b=['request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','info','catch','CreateChatQueueReport','ChatQueueReport','create','options','then','UpdateChatQueueReport','update','raw','where','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x536853,_0x336224){var _0x59fb62=function(_0x578b60){while(--_0x578b60){_0x536853['push'](_0x536853['shift']());}};_0x59fb62(++_0x336224);}(_0x744b,0x72));var _0xb744=function(_0x46c91d,_0x1c57a5){_0x46c91d=_0x46c91d-0x0;var _0x8d029e=_0x744b[_0x46c91d];return _0x8d029e;};'use strict';var _=require('lodash');var util=require(_0xb744('0x0'));var moment=require(_0xb744('0x1'));var BPromise=require(_0xb744('0x2'));var rs=require(_0xb744('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb744('0x4'))['db'];var utils=require(_0xb744('0x5'));var logger=require(_0xb744('0x6'))(_0xb744('0x7'));var config=require(_0xb744('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb744('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23e85c,_0x1723aa,_0x5b33e0){return new BPromise(function(_0x490d89,_0x5ed0a6){return client['request'](_0x23e85c,_0x5b33e0)['then'](function(_0x18b51b){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x1723aa,_0xb744('0xa'));logger[_0xb744('0xb')](_0xb744('0xc'),_0x1723aa,'request\x20sent',JSON[_0xb744('0xd')](_0x18b51b));if(_0x18b51b[_0xb744('0xe')]){if(_0x18b51b['error'][_0xb744('0xf')]===0x1f4){logger[_0xb744('0xe')](_0xb744('0x10'),_0x1723aa,_0x18b51b['error'][_0xb744('0x11')]);return _0x5ed0a6(_0x18b51b['error'][_0xb744('0x11')]);}logger[_0xb744('0xe')](_0xb744('0x10'),_0x1723aa,_0x18b51b[_0xb744('0xe')]['message']);return _0x490d89(_0x18b51b[_0xb744('0xe')][_0xb744('0x11')]);}else{logger[_0xb744('0x12')](_0xb744('0x10'),_0x1723aa,_0xb744('0xa'));_0x490d89(_0x18b51b['result']['message']);}})[_0xb744('0x13')](function(_0x4c3275){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x1723aa,_0x4c3275);_0x5ed0a6(_0x4c3275);});});}exports[_0xb744('0x14')]=function(_0x29bc74){var _0x4ec557=this;return new Promise(function(_0x229a8b,_0x241e53){return db[_0xb744('0x15')][_0xb744('0x16')](_0x29bc74['body'],{'raw':_0x29bc74[_0xb744('0x17')]?_0x29bc74[_0xb744('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xb744('0x18')](function(_0x25d09a){logger[_0xb744('0x12')](_0xb744('0x14'),_0x29bc74);logger[_0xb744('0xb')](_0xb744('0x14'),_0x29bc74,JSON['stringify'](_0x25d09a));_0x229a8b(_0x25d09a);})[_0xb744('0x13')](function(_0x59d170){logger[_0xb744('0xe')](_0xb744('0x14'),_0x59d170[_0xb744('0x11')],_0x29bc74);_0x241e53(_0x4ec557[_0xb744('0xe')](0x1f4,_0x59d170[_0xb744('0x11')]));});});};exports[_0xb744('0x19')]=function(_0x52810d){var _0x13cafc=this;return new Promise(function(_0x1e7451,_0x32b3cb){return db[_0xb744('0x15')][_0xb744('0x1a')](_0x52810d['body'],{'raw':_0x52810d['options']?_0x52810d['options'][_0xb744('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52810d[_0xb744('0x17')]?_0x52810d[_0xb744('0x17')][_0xb744('0x1c')]||null:null,'attributes':_0x52810d[_0xb744('0x17')]?_0x52810d[_0xb744('0x17')][_0xb744('0x1d')]||null:null,'limit':_0x52810d[_0xb744('0x17')]?_0x52810d[_0xb744('0x17')][_0xb744('0x1e')]||null:null})[_0xb744('0x18')](function(_0x2d4ff3){logger[_0xb744('0x12')](_0xb744('0x19'),_0x52810d);logger['debug'](_0xb744('0x19'),_0x52810d,JSON[_0xb744('0xd')](_0x2d4ff3));_0x1e7451(_0x2d4ff3);})['catch'](function(_0x42939c){logger[_0xb744('0xe')](_0xb744('0x19'),_0x42939c[_0xb744('0x11')],_0x52810d);_0x32b3cb(_0x13cafc[_0xb744('0xe')](0x1f4,_0x42939c['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index b0cc6dd..7e2eba0 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 _0x97dd=['/describe','describe','get','/:id','post','create','put','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','isAuthenticated'];(function(_0x31fd44,_0x2a1b7f){var _0x2f1760=function(_0x3a8786){while(--_0x3a8786){_0x31fd44['push'](_0x31fd44['shift']());}};_0x2f1760(++_0x2a1b7f);}(_0x97dd,0xc4));var _0xd97d=function(_0x21d16b,_0xc392a5){_0x21d16b=_0x21d16b-0x0;var _0x24f79b=_0x97dd[_0x21d16b];return _0x24f79b;};'use strict';var multer=require(_0xd97d('0x0'));var util=require('util');var path=require(_0xd97d('0x1'));var timeout=require(_0xd97d('0x2'));var express=require(_0xd97d('0x3'));var router=express['Router']();var auth=require(_0xd97d('0x4'));var interaction=require(_0xd97d('0x5'));var config=require('../../config/environment');var controller=require(_0xd97d('0x6'));router['get']('/',auth[_0xd97d('0x7')](),controller['index']);router['get'](_0xd97d('0x8'),auth[_0xd97d('0x7')](),controller[_0xd97d('0x9')]);router[_0xd97d('0xa')](_0xd97d('0xb'),auth[_0xd97d('0x7')](),controller['show']);router[_0xd97d('0xc')]('/',auth[_0xd97d('0x7')](),controller[_0xd97d('0xd')]);router[_0xd97d('0xe')]('/:id',auth[_0xd97d('0x7')](),controller['update']);router[_0xd97d('0xf')](_0xd97d('0xb'),auth[_0xd97d('0x7')](),controller['destroy']);module[_0xd97d('0x10')]=router; \ No newline at end of file +var _0xed53=['index','/describe','describe','/:id','isAuthenticated','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get'];(function(_0xf1aa45,_0x53a3eb){var _0x89e39b=function(_0x6f6541){while(--_0x6f6541){_0xf1aa45['push'](_0xf1aa45['shift']());}};_0x89e39b(++_0x53a3eb);}(_0xed53,0x19a));var _0x3ed5=function(_0x3f918b,_0x31a173){_0x3f918b=_0x3f918b-0x0;var _0x2f2f3e=_0xed53[_0x3f918b];return _0x2f2f3e;};'use strict';var multer=require(_0x3ed5('0x0'));var util=require(_0x3ed5('0x1'));var path=require(_0x3ed5('0x2'));var timeout=require(_0x3ed5('0x3'));var express=require(_0x3ed5('0x4'));var router=express['Router']();var auth=require(_0x3ed5('0x5'));var interaction=require(_0x3ed5('0x6'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x3ed5('0x7')]('/',auth['isAuthenticated'](),controller[_0x3ed5('0x8')]);router['get'](_0x3ed5('0x9'),auth['isAuthenticated'](),controller[_0x3ed5('0xa')]);router['get'](_0x3ed5('0xb'),auth[_0x3ed5('0xc')](),controller[_0x3ed5('0xd')]);router[_0x3ed5('0xe')]('/',auth['isAuthenticated'](),controller[_0x3ed5('0xf')]);router['put'](_0x3ed5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x3ed5('0x10')](_0x3ed5('0xb'),auth['isAuthenticated'](),controller[_0x3ed5('0x11')]);module[_0x3ed5('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 4871fab..e41ae9f 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 _0x57eb=['account','queue','NOW','moment','sequelize','exports','ENUM'];(function(_0x23232e,_0x4af7d9){var _0xec3c9f=function(_0x553a81){while(--_0x553a81){_0x23232e['push'](_0x23232e['shift']());}};_0xec3c9f(++_0x4af7d9);}(_0x57eb,0xa4));var _0xb57e=function(_0x743701,_0x3e67bb){_0x743701=_0x743701-0x0;var _0x5a141d=_0x57eb[_0x743701];return _0x5a141d;};'use strict';var moment=require(_0xb57e('0x0'));var Sequelize=require(_0xb57e('0x1'));module[_0xb57e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb57e('0x3')](_0xb57e('0x4'),'agent',_0xb57e('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xb57e('0x6')]}}; \ No newline at end of file +var _0xff26=['moment','sequelize','exports','STRING','ENUM','agent','queue','NOW'];(function(_0x301b2b,_0x16af0d){var _0x8cedf9=function(_0x54d068){while(--_0x54d068){_0x301b2b['push'](_0x301b2b['shift']());}};_0x8cedf9(++_0x16af0d);}(_0xff26,0xb0));var _0x6ff2=function(_0x1f146c,_0xfb86d6){_0x1f146c=_0x1f146c-0x0;var _0x2354fb=_0xff26[_0x1f146c];return _0x2354fb;};'use strict';var moment=require(_0x6ff2('0x0'));var Sequelize=require(_0x6ff2('0x1'));module[_0x6ff2('0x2')]={'uniqueid':{'type':Sequelize[_0x6ff2('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x6ff2('0x4')]('account',_0x6ff2('0x5'),'queue'),'allowNull':![],'defaultValue':_0x6ff2('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x6ff2('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 93bcb43..d5c11d2 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 _0x5048=['rows','catch','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','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','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll'];(function(_0x357601,_0x3669fa){var _0x2e9828=function(_0x47b883){while(--_0x47b883){_0x357601['push'](_0x357601['shift']());}};_0x2e9828(++_0x3669fa);}(_0x5048,0x97));var _0x8504=function(_0x272203,_0x3284c3){_0x272203=_0x272203-0x0;var _0x93944b=_0x5048[_0x272203];return _0x93944b;};'use strict';var pdf=require(_0x8504('0x0'));var emlformat=require(_0x8504('0x1'));var rimraf=require(_0x8504('0x2'));var zipdir=require(_0x8504('0x3'));var jsonpatch=require(_0x8504('0x4'));var rp=require(_0x8504('0x5'));var moment=require(_0x8504('0x6'));var BPromise=require(_0x8504('0x7'));var Mustache=require(_0x8504('0x8'));var util=require(_0x8504('0x9'));var path=require(_0x8504('0xa'));var sox=require('sox');var csv=require(_0x8504('0xb'));var ejs=require(_0x8504('0xc'));var fs=require('fs');var _=require(_0x8504('0xd'));var squel=require(_0x8504('0xe'));var crypto=require(_0x8504('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8504('0xb'));var querystring=require(_0x8504('0x10'));var Papa=require(_0x8504('0x11'));var Redis=require(_0x8504('0x12'));var authService=require(_0x8504('0x13'));var qs=require(_0x8504('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8504('0x15'))(_0x8504('0x16'));var utils=require(_0x8504('0x17'));var config=require('../../config/environment');var db=require(_0x8504('0x18'))['db'];function respondWithStatusCode(_0x2515c1,_0x1d634c){_0x1d634c=_0x1d634c||0xcc;return function(_0x4245a0){if(_0x4245a0){return _0x2515c1['sendStatus'](_0x1d634c);}return _0x2515c1[_0x8504('0x19')](_0x1d634c)[_0x8504('0x1a')]();};}function respondWithResult(_0x1c7647,_0x24e872){_0x24e872=_0x24e872||0xc8;return function(_0x5c1b69){if(_0x5c1b69){return _0x1c7647[_0x8504('0x19')](_0x24e872)[_0x8504('0x1b')](_0x5c1b69);}};}function respondWithFilteredResult(_0x3f2ac6,_0x2ca9e7){return function(_0x13b8b0){if(_0x13b8b0){var _0x160f4d=_0x13b8b0['count'],_0x1ac5df=_0x2ca9e7['offset'],_0x2e3614=_0x2ca9e7[_0x8504('0x1c')]+_0x2ca9e7[_0x8504('0x1d')],_0x47a244;if(_0x2e3614>=_0x160f4d){_0x2e3614=_0x160f4d;_0x47a244=0xc8;}else{_0x47a244=0xce;}_0x3f2ac6[_0x8504('0x19')](_0x47a244);return _0x3f2ac6['set'](_0x8504('0x1e'),_0x1ac5df+'-'+_0x2e3614+'/'+_0x160f4d)['json'](_0x13b8b0);}return null;};}function patchUpdates(_0x5e23be){return function(_0x5c5b3a){try{jsonpatch[_0x8504('0x1f')](_0x5c5b3a,_0x5e23be,!![]);}catch(_0x20b458){return BPromise[_0x8504('0x20')](_0x20b458);}return _0x5c5b3a[_0x8504('0x21')]();};}function saveUpdates(_0x1014f9,_0x229140){return function(_0x2f21bc){if(_0x2f21bc){return _0x2f21bc[_0x8504('0x22')](_0x1014f9)['then'](function(_0x364382){return _0x364382;});}return null;};}function removeEntity(_0x3b7595,_0xf05f0a){return function(_0x110d19){if(_0x110d19){return _0x110d19['destroy']()[_0x8504('0x23')](function(){_0x3b7595[_0x8504('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x316910,_0x2b64c5){return function(_0x46e5ae){if(!_0x46e5ae){_0x316910[_0x8504('0x24')](0x194);}return _0x46e5ae;};}function handleError(_0x16add0,_0x50eaf5){_0x50eaf5=_0x50eaf5||0x1f4;return function(_0x8a01a5){logger[_0x8504('0x25')](_0x8a01a5[_0x8504('0x26')]);if(_0x8a01a5[_0x8504('0x27')]){delete _0x8a01a5[_0x8504('0x27')];}_0x16add0[_0x8504('0x19')](_0x50eaf5)[_0x8504('0x28')](_0x8a01a5);};}exports[_0x8504('0x29')]=function(_0x5a84c6,_0x3a0efc){var _0x4cb58f={},_0x5f3132={},_0xcc5629={'count':0x0,'rows':[]};var _0xfe3e58=_[_0x8504('0x2a')](db[_0x8504('0x2b')][_0x8504('0x2c')],function(_0x8697d6){return{'name':_0x8697d6['fieldName'],'type':_0x8697d6[_0x8504('0x2d')][_0x8504('0x2e')]};});_0x5f3132['model']=_[_0x8504('0x2a')](_0xfe3e58,_0x8504('0x27'));_0x5f3132['query']=_[_0x8504('0x2f')](_0x5a84c6[_0x8504('0x30')]);_0x5f3132[_0x8504('0x31')]=_[_0x8504('0x32')](_0x5f3132[_0x8504('0x33')],_0x5f3132[_0x8504('0x30')]);_0x4cb58f['attributes']=_[_0x8504('0x32')](_0x5f3132['model'],qs[_0x8504('0x34')](_0x5a84c6['query'][_0x8504('0x34')]));_0x4cb58f[_0x8504('0x35')]=_0x4cb58f[_0x8504('0x35')][_0x8504('0x36')]?_0x4cb58f['attributes']:_0x5f3132[_0x8504('0x33')];if(!_0x5a84c6[_0x8504('0x30')][_0x8504('0x37')]('nolimit')){_0x4cb58f[_0x8504('0x1d')]=qs[_0x8504('0x1d')](_0x5a84c6['query'][_0x8504('0x1d')]);_0x4cb58f[_0x8504('0x1c')]=qs['offset'](_0x5a84c6[_0x8504('0x30')][_0x8504('0x1c')]);}_0x4cb58f['order']=qs[_0x8504('0x38')](_0x5a84c6['query'][_0x8504('0x38')]);_0x4cb58f[_0x8504('0x39')]=qs[_0x8504('0x31')](_[_0x8504('0x3a')](_0x5a84c6[_0x8504('0x30')],_0x5f3132[_0x8504('0x31')]));if(_0x5a84c6['query'][_0x8504('0x3b')]){_0x4cb58f[_0x8504('0x39')]=_[_0x8504('0x3c')](_0x4cb58f[_0x8504('0x39')],{'$or':_[_0x8504('0x2a')](_0xfe3e58,function(_0x408114){if(_0x408114[_0x8504('0x2d')]!==_0x8504('0x3d')){var _0x4c73a2={};_0x4c73a2[_0x408114[_0x8504('0x27')]]={'$like':'%'+_0x5a84c6['query']['filter']+'%'};return _0x4c73a2;}})});}_0x4cb58f=_[_0x8504('0x3c')]({},_0x4cb58f,_0x5a84c6[_0x8504('0x3e')]);var _0x4f4f65={'where':_0x4cb58f[_0x8504('0x39')]};return db[_0x8504('0x2b')][_0x8504('0x3f')](_0x4f4f65)[_0x8504('0x23')](function(_0x400dd9){_0xcc5629['count']=_0x400dd9;if(_0x5a84c6[_0x8504('0x30')][_0x8504('0x40')]){_0x4cb58f['include']=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0x4cb58f);})['then'](function(_0x265437){_0xcc5629[_0x8504('0x41')]=_0x265437;return _0xcc5629;})[_0x8504('0x23')](respondWithFilteredResult(_0x3a0efc,_0x4cb58f))[_0x8504('0x42')](handleError(_0x3a0efc,null));};exports['show']=function(_0x4f6f5d,_0x3a9c5d){var _0x10e369={'raw':!![],'where':{'id':_0x4f6f5d[_0x8504('0x43')]['id']}},_0x5d226e={};_0x5d226e[_0x8504('0x33')]=_['keys'](db[_0x8504('0x2b')]['rawAttributes']);_0x5d226e['query']=_['keys'](_0x4f6f5d[_0x8504('0x30')]);_0x5d226e['filters']=_['intersection'](_0x5d226e[_0x8504('0x33')],_0x5d226e[_0x8504('0x30')]);_0x10e369[_0x8504('0x35')]=_[_0x8504('0x32')](_0x5d226e[_0x8504('0x33')],qs['fields'](_0x4f6f5d['query'][_0x8504('0x34')]));_0x10e369[_0x8504('0x35')]=_0x10e369[_0x8504('0x35')][_0x8504('0x36')]?_0x10e369[_0x8504('0x35')]:_0x5d226e[_0x8504('0x33')];if(_0x4f6f5d[_0x8504('0x30')][_0x8504('0x40')]){_0x10e369['include']=[{'all':!![]}];}_0x10e369=_[_0x8504('0x3c')]({},_0x10e369,_0x4f6f5d[_0x8504('0x3e')]);return db[_0x8504('0x2b')][_0x8504('0x44')](_0x10e369)[_0x8504('0x23')](handleEntityNotFound(_0x3a9c5d,null))[_0x8504('0x23')](respondWithResult(_0x3a9c5d,null))[_0x8504('0x42')](handleError(_0x3a9c5d,null));};exports[_0x8504('0x45')]=function(_0x230682,_0x33a7b2){return db[_0x8504('0x2b')]['create'](_0x230682['body'],{})[_0x8504('0x23')](respondWithResult(_0x33a7b2,0xc9))['catch'](handleError(_0x33a7b2,null));};exports[_0x8504('0x22')]=function(_0x2349bd,_0x314542){if(_0x2349bd[_0x8504('0x46')]['id']){delete _0x2349bd[_0x8504('0x46')]['id'];}return db[_0x8504('0x2b')][_0x8504('0x44')]({'where':{'id':_0x2349bd[_0x8504('0x43')]['id']}})[_0x8504('0x23')](handleEntityNotFound(_0x314542,null))[_0x8504('0x23')](saveUpdates(_0x2349bd[_0x8504('0x46')],null))[_0x8504('0x23')](respondWithResult(_0x314542,null))[_0x8504('0x42')](handleError(_0x314542,null));};exports['destroy']=function(_0x306c28,_0xcc68f1){return db[_0x8504('0x2b')][_0x8504('0x44')]({'where':{'id':_0x306c28['params']['id']}})[_0x8504('0x23')](handleEntityNotFound(_0xcc68f1,null))[_0x8504('0x23')](removeEntity(_0xcc68f1,null))[_0x8504('0x42')](handleError(_0xcc68f1,null));};exports['describe']=function(_0x4d1f1a,_0x1d42a4){return db[_0x8504('0x2b')][_0x8504('0x47')]()['then'](respondWithResult(_0x1d42a4,null))[_0x8504('0x42')](handleError(_0x1d42a4,null));}; \ No newline at end of file +var _0x34ce=['params','includeAll','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','update','then','error','stack','name','send','map','ChatTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','count','include','catch','show'];(function(_0x106a84,_0x374f33){var _0x10dda8=function(_0x3bd84e){while(--_0x3bd84e){_0x106a84['push'](_0x106a84['shift']());}};_0x10dda8(++_0x374f33);}(_0x34ce,0x98));var _0xe34c=function(_0x16b992,_0x43d74c){_0x16b992=_0x16b992-0x0;var _0x385c78=_0x34ce[_0x16b992];return _0x385c78;};'use strict';var pdf=require(_0xe34c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe34c('0x1'));var zipdir=require(_0xe34c('0x2'));var jsonpatch=require(_0xe34c('0x3'));var rp=require(_0xe34c('0x4'));var moment=require('moment');var BPromise=require(_0xe34c('0x5'));var Mustache=require(_0xe34c('0x6'));var util=require(_0xe34c('0x7'));var path=require(_0xe34c('0x8'));var sox=require(_0xe34c('0x9'));var csv=require(_0xe34c('0xa'));var ejs=require(_0xe34c('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe34c('0xc'));var jsforce=require(_0xe34c('0xd'));var deskjs=require(_0xe34c('0xe'));var toCsv=require(_0xe34c('0xa'));var querystring=require(_0xe34c('0xf'));var Papa=require(_0xe34c('0x10'));var Redis=require(_0xe34c('0x11'));var authService=require(_0xe34c('0x12'));var qs=require(_0xe34c('0x13'));var as=require(_0xe34c('0x14'));var hardwareService=require(_0xe34c('0x15'));var logger=require(_0xe34c('0x16'))(_0xe34c('0x17'));var utils=require(_0xe34c('0x18'));var config=require(_0xe34c('0x19'));var db=require(_0xe34c('0x1a'))['db'];function respondWithStatusCode(_0x172802,_0x4c2f3c){_0x4c2f3c=_0x4c2f3c||0xcc;return function(_0x810537){if(_0x810537){return _0x172802[_0xe34c('0x1b')](_0x4c2f3c);}return _0x172802[_0xe34c('0x1c')](_0x4c2f3c)[_0xe34c('0x1d')]();};}function respondWithResult(_0x5330c9,_0x44e051){_0x44e051=_0x44e051||0xc8;return function(_0xb33ed5){if(_0xb33ed5){return _0x5330c9['status'](_0x44e051)[_0xe34c('0x1e')](_0xb33ed5);}};}function respondWithFilteredResult(_0x2283a4,_0x654d41){return function(_0x4fad32){if(_0x4fad32){var _0x3a5f10=_0x4fad32['count'],_0x40efb3=_0x654d41[_0xe34c('0x1f')],_0x1a05c6=_0x654d41[_0xe34c('0x1f')]+_0x654d41[_0xe34c('0x20')],_0x5ba9be;if(_0x1a05c6>=_0x3a5f10){_0x1a05c6=_0x3a5f10;_0x5ba9be=0xc8;}else{_0x5ba9be=0xce;}_0x2283a4[_0xe34c('0x1c')](_0x5ba9be);return _0x2283a4[_0xe34c('0x21')](_0xe34c('0x22'),_0x40efb3+'-'+_0x1a05c6+'/'+_0x3a5f10)[_0xe34c('0x1e')](_0x4fad32);}return null;};}function patchUpdates(_0x17b522){return function(_0x1c954d){try{jsonpatch['apply'](_0x1c954d,_0x17b522,!![]);}catch(_0x5251d9){return BPromise[_0xe34c('0x23')](_0x5251d9);}return _0x1c954d['save']();};}function saveUpdates(_0xfabaf8,_0x1d6abf){return function(_0x5d8c0d){if(_0x5d8c0d){return _0x5d8c0d[_0xe34c('0x24')](_0xfabaf8)[_0xe34c('0x25')](function(_0x3c6f2b){return _0x3c6f2b;});}return null;};}function removeEntity(_0xd508a4,_0x33502d){return function(_0x5e3525){if(_0x5e3525){return _0x5e3525['destroy']()[_0xe34c('0x25')](function(){_0xd508a4[_0xe34c('0x1c')](0xcc)[_0xe34c('0x1d')]();});}};}function handleEntityNotFound(_0x3a3bae,_0x37022b){return function(_0x1125c4){if(!_0x1125c4){_0x3a3bae[_0xe34c('0x1b')](0x194);}return _0x1125c4;};}function handleError(_0x2671d7,_0x49ac31){_0x49ac31=_0x49ac31||0x1f4;return function(_0x11a256){logger[_0xe34c('0x26')](_0x11a256[_0xe34c('0x27')]);if(_0x11a256[_0xe34c('0x28')]){delete _0x11a256[_0xe34c('0x28')];}_0x2671d7['status'](_0x49ac31)[_0xe34c('0x29')](_0x11a256);};}exports['index']=function(_0x425bc6,_0x2e997c){var _0x56cc76={},_0x4a4aad={},_0x4452da={'count':0x0,'rows':[]};var _0x157d07=_[_0xe34c('0x2a')](db[_0xe34c('0x2b')][_0xe34c('0x2c')],function(_0x1ed56e){return{'name':_0x1ed56e[_0xe34c('0x2d')],'type':_0x1ed56e['type'][_0xe34c('0x2e')]};});_0x4a4aad[_0xe34c('0x2f')]=_['map'](_0x157d07,'name');_0x4a4aad[_0xe34c('0x30')]=_[_0xe34c('0x31')](_0x425bc6[_0xe34c('0x30')]);_0x4a4aad[_0xe34c('0x32')]=_[_0xe34c('0x33')](_0x4a4aad[_0xe34c('0x2f')],_0x4a4aad[_0xe34c('0x30')]);_0x56cc76[_0xe34c('0x34')]=_[_0xe34c('0x33')](_0x4a4aad['model'],qs[_0xe34c('0x35')](_0x425bc6['query'][_0xe34c('0x35')]));_0x56cc76['attributes']=_0x56cc76[_0xe34c('0x34')][_0xe34c('0x36')]?_0x56cc76['attributes']:_0x4a4aad[_0xe34c('0x2f')];if(!_0x425bc6[_0xe34c('0x30')]['hasOwnProperty'](_0xe34c('0x37'))){_0x56cc76[_0xe34c('0x20')]=qs['limit'](_0x425bc6[_0xe34c('0x30')]['limit']);_0x56cc76[_0xe34c('0x1f')]=qs[_0xe34c('0x1f')](_0x425bc6[_0xe34c('0x30')][_0xe34c('0x1f')]);}_0x56cc76[_0xe34c('0x38')]=qs[_0xe34c('0x39')](_0x425bc6[_0xe34c('0x30')]['sort']);_0x56cc76[_0xe34c('0x3a')]=qs['filters'](_[_0xe34c('0x3b')](_0x425bc6['query'],_0x4a4aad[_0xe34c('0x32')]));if(_0x425bc6[_0xe34c('0x30')][_0xe34c('0x3c')]){_0x56cc76[_0xe34c('0x3a')]=_[_0xe34c('0x3d')](_0x56cc76['where'],{'$or':_[_0xe34c('0x2a')](_0x157d07,function(_0x12e888){if(_0x12e888['type']!=='VIRTUAL'){var _0x6fcab4={};_0x6fcab4[_0x12e888[_0xe34c('0x28')]]={'$like':'%'+_0x425bc6[_0xe34c('0x30')][_0xe34c('0x3c')]+'%'};return _0x6fcab4;}})});}_0x56cc76=_[_0xe34c('0x3d')]({},_0x56cc76,_0x425bc6[_0xe34c('0x3e')]);var _0x20df18={'where':_0x56cc76[_0xe34c('0x3a')]};return db['ChatTransferReport'][_0xe34c('0x3f')](_0x20df18)[_0xe34c('0x25')](function(_0x48f77c){_0x4452da[_0xe34c('0x3f')]=_0x48f77c;if(_0x425bc6[_0xe34c('0x30')]['includeAll']){_0x56cc76[_0xe34c('0x40')]=[{'all':!![]}];}return db[_0xe34c('0x2b')]['findAll'](_0x56cc76);})[_0xe34c('0x25')](function(_0x465a5b){_0x4452da['rows']=_0x465a5b;return _0x4452da;})['then'](respondWithFilteredResult(_0x2e997c,_0x56cc76))[_0xe34c('0x41')](handleError(_0x2e997c,null));};exports[_0xe34c('0x42')]=function(_0x174320,_0x1a46c5){var _0x3a7f42={'raw':!![],'where':{'id':_0x174320[_0xe34c('0x43')]['id']}},_0x11ee3a={};_0x11ee3a[_0xe34c('0x2f')]=_['keys'](db[_0xe34c('0x2b')][_0xe34c('0x2c')]);_0x11ee3a[_0xe34c('0x30')]=_[_0xe34c('0x31')](_0x174320['query']);_0x11ee3a[_0xe34c('0x32')]=_['intersection'](_0x11ee3a[_0xe34c('0x2f')],_0x11ee3a[_0xe34c('0x30')]);_0x3a7f42['attributes']=_[_0xe34c('0x33')](_0x11ee3a[_0xe34c('0x2f')],qs['fields'](_0x174320['query'][_0xe34c('0x35')]));_0x3a7f42[_0xe34c('0x34')]=_0x3a7f42['attributes']['length']?_0x3a7f42['attributes']:_0x11ee3a['model'];if(_0x174320[_0xe34c('0x30')][_0xe34c('0x44')]){_0x3a7f42[_0xe34c('0x40')]=[{'all':!![]}];}_0x3a7f42=_['merge']({},_0x3a7f42,_0x174320[_0xe34c('0x3e')]);return db[_0xe34c('0x2b')][_0xe34c('0x45')](_0x3a7f42)['then'](handleEntityNotFound(_0x1a46c5,null))['then'](respondWithResult(_0x1a46c5,null))[_0xe34c('0x41')](handleError(_0x1a46c5,null));};exports[_0xe34c('0x46')]=function(_0x5b15ce,_0xfccbcc){return db[_0xe34c('0x2b')][_0xe34c('0x46')](_0x5b15ce['body'],{})[_0xe34c('0x25')](respondWithResult(_0xfccbcc,0xc9))[_0xe34c('0x41')](handleError(_0xfccbcc,null));};exports['update']=function(_0x1527bc,_0x586e1d){if(_0x1527bc['body']['id']){delete _0x1527bc[_0xe34c('0x47')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x1527bc['params']['id']}})[_0xe34c('0x25')](handleEntityNotFound(_0x586e1d,null))[_0xe34c('0x25')](saveUpdates(_0x1527bc['body'],null))[_0xe34c('0x25')](respondWithResult(_0x586e1d,null))[_0xe34c('0x41')](handleError(_0x586e1d,null));};exports['destroy']=function(_0x2fefe5,_0x73a409){return db[_0xe34c('0x2b')][_0xe34c('0x45')]({'where':{'id':_0x2fefe5[_0xe34c('0x43')]['id']}})[_0xe34c('0x25')](handleEntityNotFound(_0x73a409,null))[_0xe34c('0x25')](removeEntity(_0x73a409,null))[_0xe34c('0x41')](handleError(_0x73a409,null));};exports[_0xe34c('0x48')]=function(_0x2ef493,_0x1454fa){return db[_0xe34c('0x2b')][_0xe34c('0x48')]()['then'](respondWithResult(_0x1454fa,null))[_0xe34c('0x41')](handleError(_0x1454fa,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 40d3084..66a4325 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 _0x2d1b=['api','moment','bluebird','request-promise','path','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','uniqueid','util','../../config/logger'];(function(_0x1ebc6c,_0x58a00b){var _0x3a826d=function(_0x27d7eb){while(--_0x27d7eb){_0x1ebc6c['push'](_0x1ebc6c['shift']());}};_0x3a826d(++_0x58a00b);}(_0x2d1b,0x1c6));var _0xb2d1=function(_0x34b3a2,_0x450812){_0x34b3a2=_0x34b3a2-0x0;var _0x3a2aff=_0x2d1b[_0x34b3a2];return _0x3a2aff;};'use strict';var _=require('lodash');var util=require(_0xb2d1('0x0'));var logger=require(_0xb2d1('0x1'))(_0xb2d1('0x2'));var moment=require(_0xb2d1('0x3'));var BPromise=require(_0xb2d1('0x4'));var rp=require(_0xb2d1('0x5'));var fs=require('fs');var path=require(_0xb2d1('0x6'));var rimraf=require('rimraf');var config=require(_0xb2d1('0x7'));var attributes=require(_0xb2d1('0x8'));module[_0xb2d1('0x9')]=function(_0x5d155d,_0x353fc0){return _0x5d155d['define'](_0xb2d1('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xb2d1('0xb'),'fields':[_0xb2d1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf759=['api','rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x3fa107,_0x5e4174){var _0x36a5b5=function(_0x240dd3){while(--_0x240dd3){_0x3fa107['push'](_0x3fa107['shift']());}};_0x36a5b5(++_0x5e4174);}(_0xf759,0x1e1));var _0x9f75=function(_0x4c1a80,_0x1fb6c3){_0x4c1a80=_0x4c1a80-0x0;var _0x4967c=_0xf759[_0x4c1a80];return _0x4967c;};'use strict';var _=require(_0x9f75('0x0'));var util=require(_0x9f75('0x1'));var logger=require(_0x9f75('0x2'))(_0x9f75('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9f75('0x4'));var config=require(_0x9f75('0x5'));var attributes=require(_0x9f75('0x6'));module['exports']=function(_0x171ef1,_0x2ed8ce){return _0x171ef1[_0x9f75('0x7')](_0x9f75('0x8'),attributes,{'tableName':_0x9f75('0x9'),'paranoid':![],'indexes':[{'name':_0x9f75('0xa'),'fields':[_0x9f75('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 0a11958..0c5e37d 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 _0xf60e=['then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xf60e,0x185));var _0xef60=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xf60e[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0xef60('0x0'));var util=require(_0xef60('0x1'));var moment=require(_0xef60('0x2'));var BPromise=require(_0xef60('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xef60('0x4'));var logger=require(_0xef60('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xef60('0x6'));var client=jayson[_0xef60('0x7')][_0xef60('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2cd705,_0xe1eeb0,_0x489778){return new BPromise(function(_0x24d1ab,_0x104fae){return client[_0xef60('0x9')](_0x2cd705,_0x489778)[_0xef60('0xa')](function(_0x3344f5){logger['info'](_0xef60('0xb'),_0xe1eeb0,_0xef60('0xc'));logger['debug'](_0xef60('0xd'),_0xe1eeb0,_0xef60('0xc'),JSON[_0xef60('0xe')](_0x3344f5));if(_0x3344f5[_0xef60('0xf')]){if(_0x3344f5[_0xef60('0xf')][_0xef60('0x10')]===0x1f4){logger[_0xef60('0xf')](_0xef60('0xb'),_0xe1eeb0,_0x3344f5[_0xef60('0xf')][_0xef60('0x11')]);return _0x104fae(_0x3344f5[_0xef60('0xf')][_0xef60('0x11')]);}logger[_0xef60('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0xe1eeb0,_0x3344f5[_0xef60('0xf')][_0xef60('0x11')]);return _0x24d1ab(_0x3344f5[_0xef60('0xf')][_0xef60('0x11')]);}else{logger[_0xef60('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0xe1eeb0,_0xef60('0xc'));_0x24d1ab(_0x3344f5[_0xef60('0x13')]['message']);}})[_0xef60('0x14')](function(_0x4867b2){logger[_0xef60('0xf')](_0xef60('0xb'),_0xe1eeb0,_0x4867b2);_0x104fae(_0x4867b2);});});} \ No newline at end of file +var _0xa201=['stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5272b2,_0x59f060){var _0x2ca6c5=function(_0x53aebe){while(--_0x53aebe){_0x5272b2['push'](_0x5272b2['shift']());}};_0x2ca6c5(++_0x59f060);}(_0xa201,0x155));var _0x1a20=function(_0x1d1096,_0x358751){_0x1d1096=_0x1d1096-0x0;var _0x45d9a5=_0xa201[_0x1d1096];return _0x45d9a5;};'use strict';var _=require(_0x1a20('0x0'));var util=require(_0x1a20('0x1'));var moment=require(_0x1a20('0x2'));var BPromise=require(_0x1a20('0x3'));var rs=require(_0x1a20('0x4'));var fs=require('fs');var Redis=require(_0x1a20('0x5'));var db=require(_0x1a20('0x6'))['db'];var utils=require(_0x1a20('0x7'));var logger=require(_0x1a20('0x8'))(_0x1a20('0x9'));var config=require(_0x1a20('0xa'));var jayson=require(_0x1a20('0xb'));var client=jayson['client'][_0x1a20('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x328dc5,_0x1f68d4,_0x171602){return new BPromise(function(_0x511cd6,_0x183375){return client[_0x1a20('0xd')](_0x328dc5,_0x171602)[_0x1a20('0xe')](function(_0x2a8920){logger[_0x1a20('0xf')](_0x1a20('0x10'),_0x1f68d4,_0x1a20('0x11'));logger[_0x1a20('0x12')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x1f68d4,_0x1a20('0x11'),JSON[_0x1a20('0x13')](_0x2a8920));if(_0x2a8920['error']){if(_0x2a8920['error'][_0x1a20('0x14')]===0x1f4){logger[_0x1a20('0x15')](_0x1a20('0x10'),_0x1f68d4,_0x2a8920[_0x1a20('0x15')][_0x1a20('0x16')]);return _0x183375(_0x2a8920[_0x1a20('0x15')][_0x1a20('0x16')]);}logger[_0x1a20('0x15')](_0x1a20('0x10'),_0x1f68d4,_0x2a8920[_0x1a20('0x15')][_0x1a20('0x16')]);return _0x511cd6(_0x2a8920[_0x1a20('0x15')][_0x1a20('0x16')]);}else{logger['info'](_0x1a20('0x10'),_0x1f68d4,_0x1a20('0x11'));_0x511cd6(_0x2a8920[_0x1a20('0x17')][_0x1a20('0x16')]);}})['catch'](function(_0x1ad955){logger[_0x1a20('0x15')](_0x1a20('0x10'),_0x1f68d4,_0x1ad955);_0x183375(_0x1ad955);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 065f26e..0fcee8b 100644 --- a/server/api/chatTransferReport/index.js +++ b/server/api/chatTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['describe','get','/:id','show','create','put','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','isAuthenticated','index'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var auth=require(_0x65f6('0x4'));var interaction=require(_0x65f6('0x5'));var config=require('../../config/environment');var controller=require(_0x65f6('0x6'));router['get']('/',auth[_0x65f6('0x7')](),controller[_0x65f6('0x8')]);router['get']('/describe',auth[_0x65f6('0x7')](),controller[_0x65f6('0x9')]);router[_0x65f6('0xa')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller[_0x65f6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x65f6('0xd')]);router[_0x65f6('0xe')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller['update']);router[_0x65f6('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x65f6('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb10b=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x5de83e,_0x58dc33){var _0x20559a=function(_0x15af49){while(--_0x15af49){_0x5de83e['push'](_0x5de83e['shift']());}};_0x20559a(++_0x58dc33);}(_0xb10b,0x12a));var _0xbb10=function(_0x3f807d,_0x32a3b1){_0x3f807d=_0x3f807d-0x0;var _0x45ad62=_0xb10b[_0x3f807d];return _0x45ad62;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0xe')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0xf')]);router['put']('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router[_0xbb10('0x11')]('/:id',auth[_0xbb10('0x9')](),controller['destroy']);module[_0xbb10('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 4de5767..9c5c22e 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 _0xc036=['star','thumb','stringify','input','name','text','getDataValue','parse','onlineForm','setDataValue','textarea','Comments','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','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Send','website_alias','bottom_right','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','sequelize','randomstring','exports','address','STRING','email','Agent','#9f946a','#ffffff','INTEGER','ENUM','rounded','squared','We\x20are\x20here!','Chat','Powered\x20by\x20xCALLY','BOOLEAN','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Feedback'];(function(_0x1a69d5,_0x458d36){var _0x138967=function(_0x2f81b8){while(--_0x2f81b8){_0x1a69d5['push'](_0x1a69d5['shift']());}};_0x138967(++_0x458d36);}(_0xc036,0x7c));var _0x6c03=function(_0xae01dd,_0xbd8a3c){_0xae01dd=_0xae01dd-0x0;var _0x8c26df=_0xc036[_0xae01dd];return _0x8c26df;};'use strict';var Sequelize=require(_0x6c03('0x0'));var rs=require(_0x6c03('0x1'));module[_0x6c03('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6c03('0x3')},'description':{'type':Sequelize[_0x6c03('0x4')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x6c03('0x5')},'mapKeyOffline':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':'email'},'key':{'type':Sequelize[_0x6c03('0x4')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':_0x6c03('0x6')},'customerAlias':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6c03('0x4')],'allowNull':![],'defaultValue':_0x6c03('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x6c03('0x4')],'allowNull':![],'defaultValue':_0x6c03('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6c03('0x4')],'allowNull':![],'defaultValue':_0x6c03('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x6c03('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x6c03('0x4')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x6c03('0xa')](_0x6c03('0xb'),_0x6c03('0xc')),'defaultValue':_0x6c03('0xb')},'header_online':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':_0x6c03('0xd')},'start_chat_button':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':_0x6c03('0xe')},'offline_chat_button':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x6c03('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x6c03('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x6c03('0x10')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x6c03('0x11')]},'closingQuestion':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':_0x6c03('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':_0x6c03('0x13')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x6c03('0x14')},'placeholderMessage':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':_0x6c03('0x15')},'closingMessage':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x6c03('0x10')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x6c03('0x10')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':_0x6c03('0x16')},'ratingType':{'type':Sequelize[_0x6c03('0xa')](_0x6c03('0x17'),_0x6c03('0x18')),'defaultValue':_0x6c03('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x6c03('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6c03('0x11')],'defaultValue':function(){return JSON[_0x6c03('0x19')]({'items':[{'type':_0x6c03('0x1a'),'variable':null,'config':{'placeholder':_0x6c03('0x1b'),'type':_0x6c03('0x1c'),'required':!![]},'props':{'title':_0x6c03('0x1b'),'helpText':''}},{'type':'input','props':{'title':_0x6c03('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x6c03('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x6c03('0x1d')]('onlineForm')?JSON[_0x6c03('0x1e')](this[_0x6c03('0x1d')](_0x6c03('0x1f'))):{};},'set':function(_0x10c833){return this[_0x6c03('0x20')]('onlineForm',JSON[_0x6c03('0x19')](_0x10c833));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x6c03('0x19')]({'items':[{'type':'input','props':{'title':_0x6c03('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x6c03('0x5'),'type':_0x6c03('0x5')},'variable':null},{'type':_0x6c03('0x21'),'config':{'placeholder':'Comments'},'props':{'title':_0x6c03('0x22'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x6c03('0x1d')](_0x6c03('0x23'))?JSON[_0x6c03('0x1e')](this[_0x6c03('0x1d')](_0x6c03('0x23'))):{};},'set':function(_0x13211a){return this[_0x6c03('0x20')]('offlineForm',JSON['stringify'](_0x13211a));}},'token':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':function(){return rs[_0x6c03('0x24')]();}},'autoclose':{'type':Sequelize[_0x6c03('0x10')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6c03('0x10')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x6c03('0x10')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x6c03('0x4')]},'forwardOffline':{'type':Sequelize[_0x6c03('0x10')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x6c03('0x4')]},'waitingTitle':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':_0x6c03('0x25')},'waitingMessage':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':_0x6c03('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':_0x6c03('0x27')},'offlineMessageBody':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x6c03('0x10')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':_0x6c03('0x28')},'skipUnmanaged':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':_0x6c03('0x29')},'sendUnmanaged':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':_0x6c03('0x2a')},'enableCustomerAttachment':{'type':Sequelize[_0x6c03('0x10')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x6c03('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x6c03('0x10')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x6c03('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x6c03('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6c03('0x10')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':_0x6c03('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x6c03('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x6c03('0x2c')},'verticalAlignment':{'type':Sequelize[_0x6c03('0x9')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':_0x6c03('0x2d')},'defaultTitle':{'type':Sequelize[_0x6c03('0x4')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x6c03('0x10')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x6c03('0x4')],'allowNull':![],'defaultValue':_0x6c03('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x6c03('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6c03('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6c03('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x6c03('0x4')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x6c03('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6c03('0x9')],'comment':_0x6c03('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0x6c03('0x10')],'defaultValue':![],'comment':_0x6c03('0x30'),'set':function(_0x5bbbe6){if(!_0x5bbbe6)this[_0x6c03('0x20')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x5bbbe6);}}}; \ No newline at end of file +var _0x40f3=['Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Skip','Feedback','ENUM','star','stringify','input','name','text','getDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','setDataValue','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','#fafafa','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','address','email','Agent','#ffffff','INTEGER','BOOLEAN','squared','rounded','We\x20are\x20here!'];(function(_0x483d58,_0x43e486){var _0x1c405a=function(_0xb4dabb){while(--_0xb4dabb){_0x483d58['push'](_0x483d58['shift']());}};_0x1c405a(++_0x43e486);}(_0x40f3,0x1cd));var _0x340f=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x40f3[_0x39096d];return _0x13da4f;};'use strict';var Sequelize=require(_0x340f('0x0'));var rs=require('randomstring');module[_0x340f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x340f('0x2')],'allowNull':![],'unique':_0x340f('0x3')},'description':{'type':Sequelize[_0x340f('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x340f('0x4')},'mapKeyOffline':{'type':Sequelize[_0x340f('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0x340f('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x340f('0x2')],'defaultValue':_0x340f('0x5')},'customerAlias':{'type':Sequelize[_0x340f('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x340f('0x2')],'allowNull':![],'defaultValue':'#9f946a','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x340f('0x2')],'allowNull':![],'defaultValue':'#9f946a','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x340f('0x2')],'allowNull':![],'defaultValue':_0x340f('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x340f('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x340f('0x2')]},'animation':{'type':Sequelize[_0x340f('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0x340f('0x9')),'defaultValue':_0x340f('0xa')},'header_online':{'type':Sequelize[_0x340f('0x2')],'defaultValue':_0x340f('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x340f('0xc')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x340f('0xd')},'header_offline':{'type':Sequelize[_0x340f('0x2')],'defaultValue':_0x340f('0xe')},'download_transcript':{'type':Sequelize[_0x340f('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x340f('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x340f('0x2')],'defaultValue':_0x340f('0xf')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x340f('0x10')]},'closingQuestion':{'type':Sequelize[_0x340f('0x2')],'defaultValue':_0x340f('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x340f('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x340f('0x13')},'noteTitle':{'type':Sequelize[_0x340f('0x2')],'defaultValue':_0x340f('0x14')},'placeholderMessage':{'type':Sequelize[_0x340f('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x340f('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x340f('0x2')],'defaultValue':_0x340f('0xd')},'skipMessageButton':{'type':Sequelize[_0x340f('0x2')],'defaultValue':_0x340f('0x15')},'conditionAgreement':{'type':Sequelize[_0x340f('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x340f('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x340f('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x340f('0x2')],'defaultValue':_0x340f('0x16')},'ratingType':{'type':Sequelize[_0x340f('0x17')](_0x340f('0x18'),'thumb'),'defaultValue':_0x340f('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x340f('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x340f('0x19')]({'items':[{'type':_0x340f('0x1a'),'variable':null,'config':{'placeholder':_0x340f('0x1b'),'type':_0x340f('0x1c'),'required':!![]},'props':{'title':_0x340f('0x1b'),'helpText':''}},{'type':_0x340f('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x340f('0x4'),'type':_0x340f('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x340f('0x1d')]('onlineForm')?JSON['parse'](this[_0x340f('0x1d')]('onlineForm')):{};},'set':function(_0x72fbe6){return this['setDataValue'](_0x340f('0x1e'),JSON[_0x340f('0x19')](_0x72fbe6));}},'offlineForm':{'type':Sequelize[_0x340f('0x10')],'defaultValue':function(){return JSON[_0x340f('0x19')]({'items':[{'type':_0x340f('0x1a'),'props':{'title':_0x340f('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x340f('0x4'),'type':_0x340f('0x4')},'variable':null},{'type':_0x340f('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':_0x340f('0x20'),'helpText':_0x340f('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x340f('0x1d')](_0x340f('0x22'))?JSON[_0x340f('0x23')](this[_0x340f('0x1d')](_0x340f('0x22'))):{};},'set':function(_0x33daf2){return this[_0x340f('0x24')]('offlineForm',JSON[_0x340f('0x19')](_0x33daf2));}},'token':{'type':Sequelize[_0x340f('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x340f('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x340f('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x340f('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x340f('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x340f('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x340f('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0x340f('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x340f('0x2')],'defaultValue':_0x340f('0x26')},'skipUnmanaged':{'type':Sequelize[_0x340f('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x340f('0x2')],'defaultValue':_0x340f('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x340f('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x340f('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x340f('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x340f('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x340f('0x2')]},'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[_0x340f('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x340f('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x340f('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x340f('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x340f('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x340f('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x340f('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x340f('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x340f('0x2')],'allowNull':![],'defaultValue':_0x340f('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x340f('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x340f('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x340f('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x340f('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x340f('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5f1ad1){if(!_0x5f1ad1)this[_0x340f('0x24')](_0x340f('0x29'),null);this['setDataValue'](_0x340f('0x2a'),_0x5f1ad1);}}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 1eab4d2..52f11d3 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 _0xa865=['lastName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','timezone','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','getSnippet','Interval','getProactiveActions','../../config/license/util','License','increment','chatLicenseExceeded','some','server/files/chat/iframe.js','remote','x-real-ip','connection','virtual','replace','verticalAlignment','textColor','addApplications','sequelize','transaction','bulkCreate','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','online','offlineForm','items','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','test','ValidationError','info','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','sendStatus','end','json','offset','status','apply','reject','update','then','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','count','include','rows','catch','show','params','keys','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','body','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','agentAvatar','filename','addCustomerAvatar','customerAvatar','file','addSystemAvatar','join','server/files/images/logos/default_logo.png','sitepic','getLicense','custom','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','setUA','user-agent','getResult','chat','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','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','from','CmList','List','CmContact','DESC','ChatApplication','Applications','applications','orderBy','priority','asc','account','Contacts','ListId','contact','customerIp','cf-connecting-ip','headers','x-forwarded-for','split','firstName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread'];(function(_0x505a25,_0x424a9a){var _0x5701e6=function(_0x2107e6){while(--_0x2107e6){_0x505a25['push'](_0x505a25['shift']());}};_0x5701e6(++_0x424a9a);}(_0xa865,0x188));var _0x5a86=function(_0x59e88c,_0x515e3f){_0x59e88c=_0x59e88c-0x0;var _0x4fbe50=_0xa865[_0x59e88c];return _0x4fbe50;};'use strict';var pdf=require(_0x5a86('0x0'));var emlformat=require(_0x5a86('0x1'));var rimraf=require(_0x5a86('0x2'));var zipdir=require(_0x5a86('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5a86('0x4'));var moment=require(_0x5a86('0x5'));var BPromise=require(_0x5a86('0x6'));var Mustache=require(_0x5a86('0x7'));var util=require(_0x5a86('0x8'));var path=require('path');var sox=require(_0x5a86('0x9'));var csv=require('to-csv');var ejs=require(_0x5a86('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5a86('0xb'));var crypto=require(_0x5a86('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5a86('0xd'));var toCsv=require(_0x5a86('0xe'));var querystring=require(_0x5a86('0xf'));var Papa=require('papaparse');var Redis=require(_0x5a86('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5a86('0x11'));var as=require(_0x5a86('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a86('0x13'))('api');var utils=require(_0x5a86('0x14'));var config=require(_0x5a86('0x15'));var db=require(_0x5a86('0x16'))['db'];config[_0x5a86('0x17')]=_[_0x5a86('0x18')](config[_0x5a86('0x17')],{'host':_0x5a86('0x19'),'port':0x18eb});var socket=require(_0x5a86('0x1a'))(new Redis(config[_0x5a86('0x17')]));require('./chatWebsite.socket')[_0x5a86('0x1b')](socket);var jayson=require(_0x5a86('0x1c'));var client=jayson[_0x5a86('0x1d')][_0x5a86('0x1e')]({'port':0x232c});var client9002=jayson[_0x5a86('0x1d')][_0x5a86('0x1e')]({'port':0x232a});var client9003=jayson[_0x5a86('0x1d')][_0x5a86('0x1e')]({'port':0x232b});function checkPasswordPattern(_0x5bc1e1,_0x1fb4a8,_0x46fbf4){if(_0x46fbf4){var _0x1a2043=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a2043[_0x5a86('0x1f')](_0x1fb4a8)){return _0x5bc1e1;}else{throw new db['Sequelize'][(_0x5a86('0x20'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5bc1e1;}}function respondWithRpcPromise(_0x42c931,_0x36bb18,_0x475a76,_0x2ee6ed){return new BPromise(function(_0x455fdb,_0x3a0446){var _0x48794f=_0x2ee6ed||client;return _0x48794f['request'](_0x42c931,_0x475a76)['then'](function(_0x102b7e){logger[_0x5a86('0x21')](_0x5a86('0x22'),_0x36bb18,'request\x20sent');logger[_0x5a86('0x23')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x36bb18,_0x5a86('0x24'),JSON[_0x5a86('0x25')](_0x102b7e));if(_0x102b7e[_0x5a86('0x26')]){if(_0x102b7e[_0x5a86('0x26')][_0x5a86('0x27')]===0x1f4){logger[_0x5a86('0x26')](_0x5a86('0x22'),_0x36bb18,_0x102b7e[_0x5a86('0x26')]['message']);return _0x3a0446(_0x102b7e['error']['message']);}logger['error'](_0x5a86('0x22'),_0x36bb18,_0x102b7e[_0x5a86('0x26')]['message']);return _0x455fdb(_0x102b7e['error'][_0x5a86('0x28')]);}else{logger['info'](_0x5a86('0x22'),_0x36bb18,_0x5a86('0x24'));_0x455fdb(_0x102b7e[_0x5a86('0x29')]['message']);}})['catch'](function(_0x4d131d){logger[_0x5a86('0x26')](_0x5a86('0x22'),_0x36bb18,_0x4d131d);_0x3a0446(_0x4d131d);});});}function respondWithStatusCode(_0x344c2f,_0x185d3d){_0x185d3d=_0x185d3d||0xcc;return function(_0x36a393){if(_0x36a393){return _0x344c2f[_0x5a86('0x2a')](_0x185d3d);}return _0x344c2f['status'](_0x185d3d)[_0x5a86('0x2b')]();};}function respondWithResult(_0x444ca2,_0x54130b){_0x54130b=_0x54130b||0xc8;return function(_0x528872){if(_0x528872){return _0x444ca2['status'](_0x54130b)[_0x5a86('0x2c')](_0x528872);}};}function respondWithFilteredResult(_0x3806f5,_0x82bbcf){return function(_0x20d5f1){if(_0x20d5f1){var _0x3fa421=_0x20d5f1['count'],_0xd5bb38=_0x82bbcf[_0x5a86('0x2d')],_0xf90073=_0x82bbcf[_0x5a86('0x2d')]+_0x82bbcf['limit'],_0x32e913;if(_0xf90073>=_0x3fa421){_0xf90073=_0x3fa421;_0x32e913=0xc8;}else{_0x32e913=0xce;}_0x3806f5[_0x5a86('0x2e')](_0x32e913);return _0x3806f5['set']('Content-Range',_0xd5bb38+'-'+_0xf90073+'/'+_0x3fa421)['json'](_0x20d5f1);}return null;};}function patchUpdates(_0x36eb60){return function(_0x3e818b){try{jsonpatch[_0x5a86('0x2f')](_0x3e818b,_0x36eb60,!![]);}catch(_0xfaae90){return BPromise[_0x5a86('0x30')](_0xfaae90);}return _0x3e818b['save']();};}function saveUpdates(_0x165f31,_0x29097f){return function(_0x81db77){if(_0x81db77){return _0x81db77[_0x5a86('0x31')](_0x165f31)[_0x5a86('0x32')](function(_0x51f5a4){return _0x51f5a4;});}return null;};}function removeEntity(_0x3d9079,_0x5a5913){return function(_0x2c4d92){if(_0x2c4d92){return _0x2c4d92[_0x5a86('0x33')]()['then'](function(){var _0x23f313=_0x2c4d92[_0x5a86('0x34')]({'plain':!![]});var _0x1aed81=_0x5a86('0x35');return db[_0x5a86('0x36')][_0x5a86('0x33')]({'where':{'type':_0x1aed81,'resourceId':_0x23f313['id']}})[_0x5a86('0x32')](function(){return _0x2c4d92;});})[_0x5a86('0x32')](function(){_0x3d9079['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x158e32,_0x4e27e7){return function(_0x2b4780){if(!_0x2b4780){_0x158e32['sendStatus'](0x194);}return _0x2b4780;};}function handleError(_0x20da8d,_0x2e0a06){_0x2e0a06=_0x2e0a06||0x1f4;return function(_0x31d3a0){logger[_0x5a86('0x26')](_0x31d3a0[_0x5a86('0x37')]);if(_0x31d3a0['name']){delete _0x31d3a0[_0x5a86('0x38')];}_0x20da8d['status'](_0x2e0a06)[_0x5a86('0x39')](_0x31d3a0);};}exports[_0x5a86('0x3a')]=function(_0x273fb5,_0x288c81){var _0x2f0498={'include':[{'model':db[_0x5a86('0x3b')],'as':_0x5a86('0x3c')}]},_0x4568bd={},_0x2c63c8={'count':0x0,'rows':[]};var _0x11b571=_[_0x5a86('0x3d')](db[_0x5a86('0x3e')][_0x5a86('0x3f')],function(_0x26039f){return{'name':_0x26039f[_0x5a86('0x40')],'type':_0x26039f[_0x5a86('0x41')][_0x5a86('0x42')]};});_0x4568bd[_0x5a86('0x43')]=_[_0x5a86('0x3d')](_0x11b571,_0x5a86('0x38'));_0x4568bd[_0x5a86('0x44')]=_['keys'](_0x273fb5[_0x5a86('0x44')]);_0x4568bd[_0x5a86('0x45')]=_[_0x5a86('0x46')](_0x4568bd[_0x5a86('0x43')],_0x4568bd[_0x5a86('0x44')]);_0x2f0498['attributes']=_[_0x5a86('0x46')](_0x4568bd[_0x5a86('0x43')],qs[_0x5a86('0x47')](_0x273fb5['query'][_0x5a86('0x47')]));_0x2f0498[_0x5a86('0x48')]=_0x2f0498['attributes'][_0x5a86('0x49')]?_0x2f0498[_0x5a86('0x48')]:_0x4568bd['model'];if(!_0x273fb5[_0x5a86('0x44')][_0x5a86('0x4a')](_0x5a86('0x4b'))){_0x2f0498[_0x5a86('0x4c')]=qs['limit'](_0x273fb5['query'][_0x5a86('0x4c')]);_0x2f0498[_0x5a86('0x2d')]=qs[_0x5a86('0x2d')](_0x273fb5['query'][_0x5a86('0x2d')]);}_0x2f0498[_0x5a86('0x4d')]=qs[_0x5a86('0x4e')](_0x273fb5['query'][_0x5a86('0x4e')]);_0x2f0498[_0x5a86('0x4f')]=qs['filters'](_['pick'](_0x273fb5[_0x5a86('0x44')],_0x4568bd[_0x5a86('0x45')]));if(_0x273fb5[_0x5a86('0x44')][_0x5a86('0x50')]){_0x2f0498[_0x5a86('0x4f')]=_['merge'](_0x2f0498[_0x5a86('0x4f')],{'$or':_['map'](_0x11b571,function(_0x2c66ef){if(_0x2c66ef['type']!==_0x5a86('0x51')){var _0x1d31c6={};_0x1d31c6[_0x2c66ef[_0x5a86('0x38')]]={'$like':'%'+_0x273fb5[_0x5a86('0x44')][_0x5a86('0x50')]+'%'};return _0x1d31c6;}})});}_0x2f0498=_[_0x5a86('0x52')]({},_0x2f0498,_0x273fb5[_0x5a86('0x53')]);var _0x399f99={'where':_0x2f0498[_0x5a86('0x4f')]};return db[_0x5a86('0x3e')][_0x5a86('0x54')](_0x399f99)[_0x5a86('0x32')](function(_0x4eda6c){_0x2c63c8[_0x5a86('0x54')]=_0x4eda6c;if(_0x273fb5[_0x5a86('0x44')]['includeAll']){_0x2f0498[_0x5a86('0x55')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x2f0498);})[_0x5a86('0x32')](function(_0xd2e919){_0x2c63c8[_0x5a86('0x56')]=_0xd2e919;return _0x2c63c8;})[_0x5a86('0x32')](respondWithFilteredResult(_0x288c81,_0x2f0498))[_0x5a86('0x57')](handleError(_0x288c81,null));};exports[_0x5a86('0x58')]=function(_0x146430,_0x5f1fbd){var _0x416aec={'raw':![],'where':{'id':_0x146430[_0x5a86('0x59')]['id']},'include':[{'model':db[_0x5a86('0x3b')],'as':_0x5a86('0x3c')}]},_0x81cc14={};_0x81cc14[_0x5a86('0x43')]=_[_0x5a86('0x5a')](db[_0x5a86('0x3e')]['rawAttributes']);_0x81cc14[_0x5a86('0x44')]=_[_0x5a86('0x5a')](_0x146430[_0x5a86('0x44')]);_0x81cc14[_0x5a86('0x45')]=_[_0x5a86('0x46')](_0x81cc14[_0x5a86('0x43')],_0x81cc14[_0x5a86('0x44')]);_0x416aec[_0x5a86('0x48')]=_[_0x5a86('0x46')](_0x81cc14[_0x5a86('0x43')],qs[_0x5a86('0x47')](_0x146430[_0x5a86('0x44')][_0x5a86('0x47')]));_0x416aec['attributes']=_0x416aec['attributes'][_0x5a86('0x49')]?_0x416aec[_0x5a86('0x48')]:_0x81cc14[_0x5a86('0x43')];if(_0x146430['query'][_0x5a86('0x5b')]){_0x416aec[_0x5a86('0x55')]=[{'all':!![]}];}_0x416aec=_[_0x5a86('0x52')]({},_0x416aec,_0x146430['options']);return db['ChatWebsite'][_0x5a86('0x5c')](_0x416aec)[_0x5a86('0x32')](handleEntityNotFound(_0x5f1fbd,null))['then'](respondWithResult(_0x5f1fbd,null))[_0x5a86('0x57')](handleError(_0x5f1fbd,null));};exports[_0x5a86('0x5d')]=function(_0x328752,_0x5cc372){return db[_0x5a86('0x3e')]['create'](_0x328752['body'],{})['then'](function(_0x14dda6){var _0x511fcd=_0x328752['user'][_0x5a86('0x34')]({'plain':!![]});if(!_0x511fcd)throw new Error(_0x5a86('0x5e'));if(_0x511fcd[_0x5a86('0x5f')]===_0x5a86('0x60')){var _0x12a26e=_0x14dda6[_0x5a86('0x34')]({'plain':!![]});var _0x99bd02=_0x5a86('0x35');return db['UserProfileSection'][_0x5a86('0x5c')]({'where':{'name':_0x99bd02,'userProfileId':_0x511fcd[_0x5a86('0x61')]},'raw':!![]})['then'](function(_0x5027d0){if(_0x5027d0&&_0x5027d0[_0x5a86('0x62')]===0x0){return db[_0x5a86('0x36')][_0x5a86('0x5d')]({'name':_0x12a26e['name'],'resourceId':_0x12a26e['id'],'type':_0x5027d0[_0x5a86('0x38')],'sectionId':_0x5027d0['id']},{})[_0x5a86('0x32')](function(){return _0x14dda6;});}else{return _0x14dda6;}})[_0x5a86('0x57')](function(_0x3358f4){logger[_0x5a86('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3358f4);throw _0x3358f4;});}return _0x14dda6;})[_0x5a86('0x32')](respondWithResult(_0x5cc372,0xc9))[_0x5a86('0x57')](handleError(_0x5cc372,null));};exports['update']=function(_0x2162a4,_0x514d47){if(_0x2162a4[_0x5a86('0x63')]['id']){delete _0x2162a4[_0x5a86('0x63')]['id'];}return db[_0x5a86('0x3e')][_0x5a86('0x5c')]({'where':{'id':_0x2162a4[_0x5a86('0x59')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x514d47,null))[_0x5a86('0x32')](saveUpdates(_0x2162a4[_0x5a86('0x63')],null))[_0x5a86('0x32')](respondWithResult(_0x514d47,null))[_0x5a86('0x57')](handleError(_0x514d47,null));};exports[_0x5a86('0x33')]=function(_0x2ac2d0,_0x2c1836){return db[_0x5a86('0x3e')][_0x5a86('0x5c')]({'where':{'id':_0x2ac2d0['params']['id']}})[_0x5a86('0x32')](handleEntityNotFound(_0x2c1836,null))[_0x5a86('0x32')](removeEntity(_0x2c1836,null))[_0x5a86('0x57')](handleError(_0x2c1836,null));};exports[_0x5a86('0x64')]=function(_0x41a564,_0xc731d7){return db[_0x5a86('0x3e')][_0x5a86('0x64')]()[_0x5a86('0x32')](respondWithResult(_0xc731d7,null))[_0x5a86('0x57')](handleError(_0xc731d7,null));};exports[_0x5a86('0x65')]=function(_0x12e62f,_0x1e10ec,_0x498455){if(_0x12e62f[_0x5a86('0x63')]['id']){delete _0x12e62f['body']['id'];}return db[_0x5a86('0x3e')][_0x5a86('0x5c')]({'where':{'id':_0x12e62f[_0x5a86('0x59')]['id']}})[_0x5a86('0x32')](handleEntityNotFound(_0x1e10ec,null))[_0x5a86('0x32')](function(_0x4778a4){if(_0x4778a4){_0x12e62f[_0x5a86('0x63')][_0x5a86('0x66')]=_0x4778a4['id'];return db[_0x5a86('0x67')]['create'](_0x12e62f[_0x5a86('0x63')]);}})[_0x5a86('0x32')](respondWithResult(_0x1e10ec,null))[_0x5a86('0x57')](handleError(_0x1e10ec,null));};exports[_0x5a86('0x68')]=function(_0x2c6a4b,_0x506d42,_0x5edd91){var _0xaee441={'raw':![],'where':{}};var _0x4b8659={};var _0x1318f5={'count':0x0,'rows':[]};return db[_0x5a86('0x3e')]['findOne']({'where':{'id':_0x2c6a4b[_0x5a86('0x59')]['id']}})['then'](handleEntityNotFound(_0x506d42,null))[_0x5a86('0x32')](function(_0x101c2e){if(_0x101c2e){_0x4b8659[_0x5a86('0x43')]=_['keys'](db['Disposition'][_0x5a86('0x3f')]);_0x4b8659[_0x5a86('0x44')]=_[_0x5a86('0x5a')](_0x2c6a4b[_0x5a86('0x44')]);_0x4b8659[_0x5a86('0x45')]=_[_0x5a86('0x46')](_0x4b8659[_0x5a86('0x43')],_0x4b8659['query']);_0xaee441[_0x5a86('0x48')]=_[_0x5a86('0x46')](_0x4b8659['model'],qs['fields'](_0x2c6a4b[_0x5a86('0x44')][_0x5a86('0x47')]));_0xaee441[_0x5a86('0x48')]=_0xaee441[_0x5a86('0x48')][_0x5a86('0x49')]?_0xaee441['attributes']:_0x4b8659['model'];if(!_0x2c6a4b[_0x5a86('0x44')]['hasOwnProperty'](_0x5a86('0x4b'))){_0xaee441[_0x5a86('0x4c')]=qs[_0x5a86('0x4c')](_0x2c6a4b[_0x5a86('0x44')][_0x5a86('0x4c')]);_0xaee441[_0x5a86('0x2d')]=qs[_0x5a86('0x2d')](_0x2c6a4b['query'][_0x5a86('0x2d')]);}_0xaee441[_0x5a86('0x4d')]=qs[_0x5a86('0x4e')](_0x2c6a4b[_0x5a86('0x44')][_0x5a86('0x4e')]);_0xaee441[_0x5a86('0x4f')]=qs[_0x5a86('0x45')](_[_0x5a86('0x69')](_0x2c6a4b['query'],_0x4b8659[_0x5a86('0x45')]));_0xaee441[_0x5a86('0x4f')][_0x5a86('0x66')]=_0x101c2e['id'];if(_0x2c6a4b['query']['filter']){_0xaee441[_0x5a86('0x4f')]=_[_0x5a86('0x52')](_0xaee441[_0x5a86('0x4f')],{'$or':_[_0x5a86('0x3d')](_0xaee441['attributes'],function(_0xa9da09){var _0x16f457={};_0x16f457[_0xa9da09]={'$like':'%'+_0x2c6a4b[_0x5a86('0x44')][_0x5a86('0x50')]+'%'};return _0x16f457;})});}_0xaee441=_[_0x5a86('0x52')]({},_0xaee441,_0x2c6a4b[_0x5a86('0x53')]);return db['Disposition'][_0x5a86('0x54')]({'where':_0xaee441[_0x5a86('0x4f')]})[_0x5a86('0x32')](function(_0x403575){_0x1318f5[_0x5a86('0x54')]=_0x403575;if(_0x2c6a4b['query'][_0x5a86('0x5b')]){_0xaee441[_0x5a86('0x55')]=[{'all':!![]}];}return db[_0x5a86('0x67')][_0x5a86('0x6a')](_0xaee441);})[_0x5a86('0x32')](function(_0x1609f1){_0x1318f5['rows']=_0x1609f1;return _0x1318f5;});}})[_0x5a86('0x32')](respondWithFilteredResult(_0x506d42,_0xaee441))[_0x5a86('0x57')](handleError(_0x506d42,null));};exports['removeDispositions']=function(_0x35a9dd,_0x469367,_0x337d0d){return db[_0x5a86('0x3e')][_0x5a86('0x5c')]({'where':{'id':_0x35a9dd[_0x5a86('0x59')]['id']}})['then'](handleEntityNotFound(_0x469367,null))[_0x5a86('0x32')](function(_0x2a75ef){if(_0x2a75ef){return _0x2a75ef[_0x5a86('0x6b')](_0x35a9dd[_0x5a86('0x44')][_0x5a86('0x6c')]);}})['then'](respondWithStatusCode(_0x469367,null))['catch'](handleError(_0x469367,null));};exports[_0x5a86('0x6d')]=function(_0x2adb9a,_0x3fcec3,_0x158979){if(_0x2adb9a[_0x5a86('0x63')]['id']){delete _0x2adb9a['body']['id'];}return db[_0x5a86('0x3e')][_0x5a86('0x5c')]({'where':{'id':_0x2adb9a[_0x5a86('0x59')]['id']}})['then'](handleEntityNotFound(_0x3fcec3,null))[_0x5a86('0x32')](function(_0x5138f6){if(_0x5138f6){_0x2adb9a['body'][_0x5a86('0x66')]=_0x5138f6['id'];return db[_0x5a86('0x6e')][_0x5a86('0x5d')](_0x2adb9a[_0x5a86('0x63')]);}})[_0x5a86('0x32')](respondWithResult(_0x3fcec3,null))[_0x5a86('0x57')](handleError(_0x3fcec3,null));};exports[_0x5a86('0x6f')]=function(_0x5df7a2,_0x53fe87,_0x5bcbba){var _0x40392f={'raw':![],'where':{}};var _0x1e2a28={};var _0x3634a9={'count':0x0,'rows':[]};return db[_0x5a86('0x3e')][_0x5a86('0x70')]({'where':{'id':_0x5df7a2[_0x5a86('0x59')]['id']}})[_0x5a86('0x32')](handleEntityNotFound(_0x53fe87,null))[_0x5a86('0x32')](function(_0x198412){if(_0x198412){_0x1e2a28[_0x5a86('0x43')]=_[_0x5a86('0x5a')](db[_0x5a86('0x6e')][_0x5a86('0x3f')]);_0x1e2a28[_0x5a86('0x44')]=_[_0x5a86('0x5a')](_0x5df7a2[_0x5a86('0x44')]);_0x1e2a28['filters']=_['intersection'](_0x1e2a28[_0x5a86('0x43')],_0x1e2a28[_0x5a86('0x44')]);_0x40392f['attributes']=_[_0x5a86('0x46')](_0x1e2a28['model'],qs[_0x5a86('0x47')](_0x5df7a2[_0x5a86('0x44')]['fields']));_0x40392f['attributes']=_0x40392f[_0x5a86('0x48')]['length']?_0x40392f[_0x5a86('0x48')]:_0x1e2a28[_0x5a86('0x43')];if(!_0x5df7a2[_0x5a86('0x44')][_0x5a86('0x4a')](_0x5a86('0x4b'))){_0x40392f[_0x5a86('0x4c')]=qs[_0x5a86('0x4c')](_0x5df7a2[_0x5a86('0x44')][_0x5a86('0x4c')]);_0x40392f[_0x5a86('0x2d')]=qs[_0x5a86('0x2d')](_0x5df7a2['query'][_0x5a86('0x2d')]);}_0x40392f[_0x5a86('0x4d')]=qs[_0x5a86('0x4e')](_0x5df7a2['query'][_0x5a86('0x4e')]);_0x40392f['where']=qs[_0x5a86('0x45')](_[_0x5a86('0x69')](_0x5df7a2['query'],_0x1e2a28[_0x5a86('0x45')]));_0x40392f['where'][_0x5a86('0x66')]=_0x198412['id'];if(_0x5df7a2[_0x5a86('0x44')][_0x5a86('0x50')]){_0x40392f['where']=_[_0x5a86('0x52')](_0x40392f[_0x5a86('0x4f')],{'$or':_[_0x5a86('0x3d')](_0x40392f['attributes'],function(_0x44e215){var _0x2936ad={};_0x2936ad[_0x44e215]={'$like':'%'+_0x5df7a2[_0x5a86('0x44')]['filter']+'%'};return _0x2936ad;})});}_0x40392f=_[_0x5a86('0x52')]({},_0x40392f,_0x5df7a2[_0x5a86('0x53')]);return db[_0x5a86('0x6e')][_0x5a86('0x54')]({'where':_0x40392f[_0x5a86('0x4f')]})[_0x5a86('0x32')](function(_0x4fbccb){_0x3634a9[_0x5a86('0x54')]=_0x4fbccb;if(_0x5df7a2['query'][_0x5a86('0x5b')]){_0x40392f['include']=[{'all':!![]}];}return db[_0x5a86('0x6e')][_0x5a86('0x6a')](_0x40392f);})['then'](function(_0x1c84ed){_0x3634a9[_0x5a86('0x56')]=_0x1c84ed;return _0x3634a9;});}})['then'](respondWithFilteredResult(_0x53fe87,_0x40392f))[_0x5a86('0x57')](handleError(_0x53fe87,null));};exports[_0x5a86('0x71')]=function(_0x3c37d0,_0x535ac9,_0x57aa22){return db[_0x5a86('0x3e')][_0x5a86('0x5c')]({'where':{'id':_0x3c37d0[_0x5a86('0x59')]['id']}})['then'](handleEntityNotFound(_0x535ac9,null))[_0x5a86('0x32')](function(_0x3aa93e){if(_0x3aa93e){return _0x3aa93e['removeAnswers'](_0x3c37d0[_0x5a86('0x44')][_0x5a86('0x6c')]);}})[_0x5a86('0x32')](respondWithStatusCode(_0x535ac9,null))[_0x5a86('0x57')](handleError(_0x535ac9,null));};exports['addLogo']=function(_0x46a7ca,_0x2ee955,_0x21df8a){_0x46a7ca['body']['sitepic']=_0x46a7ca['file']['filename'];return db[_0x5a86('0x3e')][_0x5a86('0x5c')]({'where':{'id':_0x46a7ca['params']['id']}})[_0x5a86('0x32')](handleEntityNotFound(_0x2ee955,null))[_0x5a86('0x32')](saveUpdates(_0x46a7ca['body'],null))[_0x5a86('0x32')](respondWithResult(_0x2ee955,null))[_0x5a86('0x57')](handleError(_0x2ee955,null));};exports['addAvatar']=function(_0x5befe9,_0x30d181,_0x39a7b0){_0x5befe9[_0x5a86('0x63')][_0x5a86('0x72')]=_0x5befe9['file'][_0x5a86('0x73')];return db['ChatWebsite']['find']({'where':{'id':_0x5befe9[_0x5a86('0x59')]['id']}})[_0x5a86('0x32')](handleEntityNotFound(_0x30d181,null))[_0x5a86('0x32')](saveUpdates(_0x5befe9[_0x5a86('0x63')],null))[_0x5a86('0x32')](respondWithResult(_0x30d181,null))['catch'](handleError(_0x30d181,null));};exports[_0x5a86('0x74')]=function(_0x4b48df,_0x4bcd47,_0x5b6bc0){_0x4b48df[_0x5a86('0x63')][_0x5a86('0x75')]=_0x4b48df[_0x5a86('0x76')]['filename'];return db[_0x5a86('0x3e')][_0x5a86('0x5c')]({'where':{'id':_0x4b48df[_0x5a86('0x59')]['id']}})[_0x5a86('0x32')](handleEntityNotFound(_0x4bcd47,null))[_0x5a86('0x32')](saveUpdates(_0x4b48df[_0x5a86('0x63')],null))['then'](respondWithResult(_0x4bcd47,null))[_0x5a86('0x57')](handleError(_0x4bcd47,null));};exports[_0x5a86('0x77')]=function(_0x5bf504,_0x4495cc,_0x4a89b2){_0x5bf504['body']['systemAvatar']=_0x5bf504[_0x5a86('0x76')][_0x5a86('0x73')];return db[_0x5a86('0x3e')][_0x5a86('0x5c')]({'where':{'id':_0x5bf504[_0x5a86('0x59')]['id']}})[_0x5a86('0x32')](handleEntityNotFound(_0x4495cc,null))[_0x5a86('0x32')](saveUpdates(_0x5bf504[_0x5a86('0x63')],null))[_0x5a86('0x32')](respondWithResult(_0x4495cc,null))[_0x5a86('0x57')](handleError(_0x4495cc,null));};exports['getLogo']=function(_0x26286b,_0x333bd6,_0x4efcfe){var _0xec9069=path[_0x5a86('0x78')](config['root'],_0x5a86('0x79'));var _0x1590a0={'where':{'id':_0x26286b['params']['id']},'attributes':['id',_0x5a86('0x7a')],'raw':!![]};var _0x131964=![];return require('../../config/license/util')[_0x5a86('0x7b')]()['then'](function(_0x1508ce){if(_0x1508ce){_0x131964=_0x1508ce[_0x5a86('0x7c')];}})['then'](function(){return db[_0x5a86('0x3e')][_0x5a86('0x5c')](_0x1590a0);})['then'](handleEntityNotFound(_0x333bd6,null))[_0x5a86('0x32')](function(_0x354425){if(_0x354425){if(!_['isNil'](_0x354425['sitepic'])){if(fs[_0x5a86('0x7d')](path[_0x5a86('0x78')](config[_0x5a86('0x7e')],_0x5a86('0x7f'),_0x354425[_0x5a86('0x7a')]))&&_0x131964){_0xec9069=path['join'](config[_0x5a86('0x7e')],_0x5a86('0x7f'),_0x354425['sitepic']);}}return _0x333bd6[_0x5a86('0x80')](_0xec9069);}})['catch'](handleError(_0x333bd6,null));};exports[_0x5a86('0x81')]=function(_0x4bc0b7,_0xc5bd5d,_0x5ef2bb){var _0x2a7247=path[_0x5a86('0x78')](config[_0x5a86('0x7e')],_0x5a86('0x82'));var _0x42bb3d={'where':{'id':_0x4bc0b7[_0x5a86('0x59')]['id']},'attributes':['id',_0x5a86('0x72')],'raw':!![]};return db[_0x5a86('0x3e')]['find'](_0x42bb3d)[_0x5a86('0x32')](handleEntityNotFound(_0xc5bd5d,null))[_0x5a86('0x32')](function(_0x377fd1){if(_0x377fd1){if(!_[_0x5a86('0x83')](_0x377fd1[_0x5a86('0x72')])){if(fs['existsSync'](path[_0x5a86('0x78')](config[_0x5a86('0x7e')],_0x5a86('0x84'),_0x377fd1['agentAvatar']))){_0x2a7247=path[_0x5a86('0x78')](config[_0x5a86('0x7e')],'server/files/images/avatars/',_0x377fd1[_0x5a86('0x72')]);}}return _0xc5bd5d[_0x5a86('0x80')](_0x2a7247);}})['catch'](handleError(_0xc5bd5d,null));};exports[_0x5a86('0x85')]=function(_0x14b31d,_0x26643f,_0x394a31){var _0x228a9b=path[_0x5a86('0x78')](config[_0x5a86('0x7e')],_0x5a86('0x86'));var _0x1eb7c2={'where':{'id':_0x14b31d[_0x5a86('0x59')]['id']},'attributes':['id',_0x5a86('0x75'),_0x5a86('0x87')],'raw':!![]};return db[_0x5a86('0x3e')]['find'](_0x1eb7c2)[_0x5a86('0x32')](handleEntityNotFound(_0x26643f,null))[_0x5a86('0x32')](function(_0x4a6aa3){if(_0x4a6aa3){if(!_[_0x5a86('0x83')](_0x4a6aa3[_0x5a86('0x75')])){if(fs[_0x5a86('0x7d')](path[_0x5a86('0x78')](config[_0x5a86('0x7e')],_0x5a86('0x84'),_0x4a6aa3[_0x5a86('0x75')]))&&_0x4a6aa3[_0x5a86('0x87')]){_0x228a9b=path[_0x5a86('0x78')](config[_0x5a86('0x7e')],_0x5a86('0x84'),_0x4a6aa3[_0x5a86('0x75')]);}}return _0x26643f[_0x5a86('0x80')](_0x228a9b);}})['catch'](handleError(_0x26643f,null));};exports[_0x5a86('0x88')]=function(_0x2d624d,_0x35bd23,_0x364d03){var _0x4b58ba=path['join'](config[_0x5a86('0x7e')],_0x5a86('0x89'));var _0x1eca5c={'where':{'id':_0x2d624d[_0x5a86('0x59')]['id']},'attributes':['id',_0x5a86('0x8a')],'raw':!![]};return db[_0x5a86('0x3e')]['find'](_0x1eca5c)['then'](handleEntityNotFound(_0x35bd23,null))[_0x5a86('0x32')](function(_0x8c3985){if(_0x8c3985){if(!_[_0x5a86('0x83')](_0x8c3985[_0x5a86('0x8a')])){if(fs[_0x5a86('0x7d')](path[_0x5a86('0x78')](config[_0x5a86('0x7e')],_0x5a86('0x84'),_0x8c3985[_0x5a86('0x8a')]))){_0x4b58ba=path[_0x5a86('0x78')](config[_0x5a86('0x7e')],_0x5a86('0x84'),_0x8c3985[_0x5a86('0x8a')]);}}return _0x35bd23[_0x5a86('0x80')](_0x4b58ba);}})[_0x5a86('0x57')](handleError(_0x35bd23,null));};exports[_0x5a86('0x8b')]=function(_0x27e11b,_0x19e8dd,_0x5a5a8e){var _0x5a3f80=require('user-agent-parser');var _0x377818=new _0x5a3f80();var _0x3881ec=_0x377818[_0x5a86('0x8c')](_0x27e11b['headers'][_0x5a86('0x8d')])[_0x5a86('0x8e')]();var _0x351ff1={'body':_0x27e11b[_0x5a86('0x63')],'channel':_0x5a86('0x8f')};var _0x41daf9=[];var _0x924a13=[];var _0x5403c8={};var _0x5779b2=![];return db['CmContact'][_0x5a86('0x64')]()[_0x5a86('0x32')](function(_0x5996c1){if(!_0x5996c1){throw new db[(_0x5a86('0x90'))][(_0x5a86('0x20'))](_0x5a86('0x91'));}_0x41daf9=_[_0x5a86('0x92')](_['keys'](_0x5996c1),[_0x5a86('0x93'),'updatedAt']);_0x924a13=_[_0x5a86('0x92')](_[_0x5a86('0x5a')](_0x5996c1),[_0x5a86('0x93'),_0x5a86('0x94'),_0x5a86('0x95'),'ListId']);if(_0x27e11b[_0x5a86('0x63')]['id']){delete _0x27e11b[_0x5a86('0x63')]['id'];}if(_[_0x5a86('0x83')](_0x27e11b[_0x5a86('0x63')]['from'])){throw new db['Sequelize'][(_0x5a86('0x20'))](_0x5a86('0x96'));}if(_[_0x5a86('0x83')](_0x27e11b['body'][_0x5a86('0x63')])||_0x27e11b['body'][_0x5a86('0x63')]===''){throw new db['Sequelize'][(_0x5a86('0x20'))](_0x5a86('0x97'));}if(_[_0x5a86('0x83')](_0x27e11b[_0x5a86('0x63')]['mapKey'])){throw new db[(_0x5a86('0x90'))][(_0x5a86('0x20'))](_0x5a86('0x98')+_0x924a13);}if(!_[_0x5a86('0x99')](_0x924a13,_0x27e11b[_0x5a86('0x63')][_0x5a86('0x9a')])){throw new db[(_0x5a86('0x90'))][(_0x5a86('0x20'))](_0x5a86('0x9b')+_0x924a13);}_0x5403c8[_0x27e11b[_0x5a86('0x63')][_0x5a86('0x9a')]]=_0x27e11b[_0x5a86('0x63')][_0x5a86('0x9c')];})['then'](function(){return db[_0x5a86('0x3e')][_0x5a86('0x5c')]({'where':{'id':_0x27e11b[_0x5a86('0x59')]['id']},'include':[{'model':db[_0x5a86('0x9d')],'as':_0x5a86('0x9e'),'include':[{'model':db[_0x5a86('0x9f')],'as':'Contacts','where':_0x5403c8,'limit':0x1,'order':[[_0x5a86('0x94'),_0x5a86('0xa0')]]}]},{'model':db[_0x5a86('0xa1')],'as':_0x5a86('0xa2')}]});})[_0x5a86('0x32')](handleEntityNotFound(_0x19e8dd,null))[_0x5a86('0x32')](function(_0x101ac5){if(_0x101ac5&&_0x101ac5[_0x5a86('0x9e')]){_0x351ff1['account']=_0x101ac5;_0x351ff1[_0x5a86('0xa3')]=_0x101ac5[_0x5a86('0xa2')];_0x351ff1['list']=_0x101ac5['List'];_0x351ff1[_0x5a86('0xa3')]=_[_0x5a86('0xa4')](_0x351ff1[_0x5a86('0xa3')],[_0x5a86('0xa5')],[_0x5a86('0xa6')]);if(_0x351ff1[_0x5a86('0xa7')][_0x5a86('0xa2')]){delete _0x351ff1[_0x5a86('0xa7')][_0x5a86('0xa2')];}if(_0x351ff1[_0x5a86('0xa7')][_0x5a86('0x9e')]&&_0x351ff1[_0x5a86('0xa7')][_0x5a86('0x9e')][_0x5a86('0xa8')][_0x5a86('0x49')]){return _0x351ff1[_0x5a86('0xa7')][_0x5a86('0x9e')]['Contacts'][0x0];}var _0x3e54bf=_[_0x5a86('0x18')](_0x27e11b[_0x5a86('0x63')],{'firstName':_0x27e11b['body'][_0x5a86('0x9c')],'ListId':_0x101ac5[_0x5a86('0xa9')]});_0x3e54bf[_0x27e11b['body']['mapKey']]=_0x27e11b['body'][_0x5a86('0x9c')];return db['CmContact'][_0x5a86('0x5d')](_0x3e54bf,{'fields':_0x41daf9,'raw':!![]});}})[_0x5a86('0x32')](handleEntityNotFound(_0x19e8dd,null))[_0x5a86('0x32')](function(_0x5ba6f7){_0x351ff1[_0x5a86('0xaa')]=_0x5ba6f7;var _0x4b0cdf=_0x27e11b[_0x5a86('0x63')][_0x5a86('0xab')];if(_0x27e11b['headers'][_0x5a86('0xac')]){_0x4b0cdf=_0x27e11b[_0x5a86('0xad')][_0x5a86('0xac')];}else if(_0x27e11b[_0x5a86('0xad')][_0x5a86('0xae')]){_0x4b0cdf=_['first'](_0x27e11b[_0x5a86('0xad')][_0x5a86('0xae')][_0x5a86('0xaf')](','));}if(_0x5ba6f7){var _0x5c7acd={'ContactId':_0x5ba6f7['id'],'ChatWebsiteId':_0x27e11b[_0x5a86('0x59')]['id'],'from':(_0x5ba6f7[_0x5a86('0xb0')]||'')+'\x20'+(_0x5ba6f7['lastName']||''),'customerIp':_0x4b0cdf,'customerPort':_0x27e11b['headers']['x-real-port']?_0x27e11b[_0x5a86('0xad')][_0x5a86('0xb1')]:null,'referer':_0x27e11b[_0x5a86('0x63')][_0x5a86('0xb2')],'browserName':_0x3881ec[_0x5a86('0xb3')]['name']&&_0x3881ec[_0x5a86('0xb3')][_0x5a86('0xb4')]?util[_0x5a86('0xb5')](_0x5a86('0xb6'),_0x3881ec[_0x5a86('0xb3')][_0x5a86('0x38')],_0x3881ec[_0x5a86('0xb3')][_0x5a86('0xb4')]):_0x5a86('0xb7'),'browserVersion':_0x3881ec[_0x5a86('0xb3')][_0x5a86('0xb4')]||_0x5a86('0xb7'),'osName':util['format']('%s\x20%s',_0x3881ec['os']['name'],_0x3881ec['os'][_0x5a86('0xb4')]),'osVersion':_0x3881ec['os'][_0x5a86('0xb4')],'deviceModel':_0x3881ec[_0x5a86('0xb8')][_0x5a86('0x43')]&&_0x3881ec[_0x5a86('0xb8')][_0x5a86('0xb9')]?util[_0x5a86('0xb5')]('%s\x20%s\x20%s',_0x3881ec[_0x5a86('0xb8')][_0x5a86('0x43')],_0x3881ec[_0x5a86('0xb8')][_0x5a86('0xb9')],_0x3881ec[_0x5a86('0xb8')][_0x5a86('0x41')]):null,'deviceVendor':_0x3881ec['device'][_0x5a86('0xb9')],'deviceType':_0x3881ec[_0x5a86('0xb8')][_0x5a86('0x41')],'formData':JSON[_0x5a86('0x25')](_0x27e11b[_0x5a86('0x63')])};var _0x14856b={'ChatWebsiteId':_0x27e11b[_0x5a86('0x59')]['id'],'closed':![]};if(_0x27e11b[_0x5a86('0x63')][_0x5a86('0xba')]){_0x14856b[_0x5a86('0xba')]=_0x27e11b['body'][_0x5a86('0xba')];return db[_0x5a86('0xbb')][_0x5a86('0x5c')]({'where':_0x14856b})[_0x5a86('0x32')](function(_0x2a05e8){if(_0x2a05e8){return[_0x2a05e8,![]];}_0x5c7acd[_0x5a86('0xba')]=_0x27e11b[_0x5a86('0x63')][_0x5a86('0xba')];_0x5c7acd[_0x5a86('0xbc')]=_0x27e11b['body'][_0x5a86('0xbc')];return db[_0x5a86('0xbb')][_0x5a86('0x5d')](_0x5c7acd)[_0x5a86('0x32')](function(_0x507925){return[_0x507925,!![]];});});}_0x14856b[_0x5a86('0xbd')]=_0x5ba6f7['id'];if(_0x27e11b[_0x5a86('0x63')][_0x5a86('0xbe')]&&_0x27e11b[_0x5a86('0x63')][_0x5a86('0xbe')]['id']){_0x14856b['id']=_0x27e11b[_0x5a86('0x63')]['interaction']['id'];return db[_0x5a86('0xbb')][_0x5a86('0x5c')]({'where':_0x14856b})['then'](function(_0x193594){if(_0x193594){return[_0x193594,![]];}return db[_0x5a86('0xbb')]['create'](_0x5c7acd)[_0x5a86('0x32')](function(_0x207dfe){return[_0x207dfe,!![]];});});}return db[_0x5a86('0xbb')][_0x5a86('0x5d')](_0x5c7acd)['then'](function(_0x1dbc74){return[_0x1dbc74,!![]];});}})[_0x5a86('0xbf')](function(_0x3026d4,_0x18409a){if(_0x3026d4){_0x5779b2=_0x18409a;if(!_0x18409a){var _0x11599b={'from':(_0x351ff1['contact']['firstName']||'')+'\x20'+(_0x351ff1[_0x5a86('0xaa')][_0x5a86('0xc0')]||'')};if(_0x27e11b['body']['threadId']&&_0x27e11b[_0x5a86('0x63')]['messageId']&&_0x27e11b['body']['threadId']!=_0x27e11b[_0x5a86('0x63')][_0x5a86('0xc1')]){_0x11599b[_0x5a86('0xba')]=_0x27e11b[_0x5a86('0x63')]['messageId'];}return _0x3026d4[_0x5a86('0x31')](_0x11599b);}else{return _0x3026d4;}}})[_0x5a86('0x32')](function(_0x3b1ddb){_0x351ff1[_0x5a86('0xbe')]=_0x3b1ddb[_0x5a86('0x34')]({'plain':!![]});_0x351ff1[_0x5a86('0xbe')]['created']=_0x5779b2;if(_0x351ff1[_0x5a86('0xbe')][_0x5a86('0xc2')]){if(_0x351ff1['account'][_0x5a86('0xc3')]){_0x351ff1['applications'][_0x5a86('0xc4')]({'id':0x0,'priority':_0x351ff1[_0x5a86('0xa3')][_0x5a86('0x49')]+0x1,'app':_0x5a86('0xc5'),'appdata':_0x5a86('0xc6'),'interval':_0x5a86('0xc7')});}}return db[_0x5a86('0xc8')][_0x5a86('0x5d')]({'body':_0x27e11b[_0x5a86('0x63')][_0x5a86('0x63')],'ChatWebsiteId':_0x27e11b[_0x5a86('0x59')]['id'],'ChatInteractionId':_0x3b1ddb['id'],'direction':'in','ContactId':_0x351ff1[_0x5a86('0xaa')]['id'],'AttachmentId':_0x27e11b['body'][_0x5a86('0xc9')]});})[_0x5a86('0x32')](function(_0x2c0759){_0x351ff1[_0x5a86('0x28')]=_0x2c0759;if(_0x351ff1[_0x5a86('0xbe')][_0x5a86('0xca')]){return db[_0x5a86('0xcb')][_0x5a86('0x5c')]({'attributes':['id','name'],'where':{'id':_0x351ff1[_0x5a86('0xbe')][_0x5a86('0xca')]}})[_0x5a86('0x32')](function(_0x3fc2c9){if(_0x3fc2c9){_0x351ff1[_0x5a86('0xa3')][_0x5a86('0xcc')]({'id':0x0,'priority':0x0,'app':_0x5a86('0xcd'),'appdata':_0x3fc2c9[_0x5a86('0x38')]+','+(_0x351ff1['account'][_0x5a86('0xce')]||0xa),'interval':_0x5a86('0xc7')});_0x351ff1['forcedOwnership']=!![];}return respondWithRpcPromise(_0x5a86('0xcf'),_0x5a86('0xd0'),_0x351ff1);});}return respondWithRpcPromise(_0x5a86('0xcf'),'startRouting',_0x351ff1);})['then'](function(_0x546e03){respondWithRpcPromise('EventManager',_0x5a86('0xd1'),{'event':'notify','message':_0x546e03},client9002);return _0x546e03;})[_0x5a86('0x32')](respondWithResult(_0x19e8dd,null))['catch'](handleError(_0x19e8dd,null));};exports['offline']=function(_0x584cd3,_0x597afe,_0x35f64b){var _0x25103d,_0x356456,_0x2134a1;var _0x5368f2=[];var _0x184f48=[];var _0x31adbd={};return db[_0x5a86('0x9f')]['describe']()[_0x5a86('0x32')](function(_0x9ce636){if(!_0x9ce636){throw new db[(_0x5a86('0x90'))]['ValidationError']('no\x20available\x20attributes');}_0x184f48=_[_0x5a86('0x92')](_[_0x5a86('0x5a')](_0x9ce636),[_0x5a86('0x93'),_0x5a86('0x94')]);_0x5368f2=_[_0x5a86('0x92')](_[_0x5a86('0x5a')](_0x9ce636),[_0x5a86('0x93'),_0x5a86('0x94'),_0x5a86('0x95'),_0x5a86('0xa9')]);if(_0x584cd3[_0x5a86('0x63')]['id']){delete _0x584cd3[_0x5a86('0x63')]['id'];}if(_['isNil'](_0x584cd3['body'][_0x5a86('0x9c')])){throw _0x597afe['status'](0x1f4)[_0x5a86('0x39')](new db['Sequelize'][(_0x5a86('0x20'))](_0x5a86('0x96')));}if(_['isNil'](_0x584cd3['body'][_0x5a86('0x63')])||_0x584cd3['body'][_0x5a86('0x63')]===''){throw _0x597afe[_0x5a86('0x2e')](0x1f4)['send'](new db[(_0x5a86('0x90'))][(_0x5a86('0x20'))](_0x5a86('0x97')));}if(_[_0x5a86('0x83')](_0x584cd3[_0x5a86('0x63')][_0x5a86('0xd2')])){throw _0x597afe['status'](0x1f4)[_0x5a86('0x39')](new db[(_0x5a86('0x90'))][(_0x5a86('0x20'))](_0x5a86('0xd3')+_0x5368f2));}if(!_['includes'](_0x5368f2,_0x584cd3[_0x5a86('0x63')][_0x5a86('0xd2')])){throw _0x597afe[_0x5a86('0x2e')](0x1f4)[_0x5a86('0x39')](new db[(_0x5a86('0x90'))][(_0x5a86('0x20'))](_0x5a86('0xd4')+_0x5368f2));}_0x31adbd[_0x584cd3[_0x5a86('0x63')][_0x5a86('0xd2')]]=_0x584cd3[_0x5a86('0x63')][_0x5a86('0x9c')];})[_0x5a86('0x32')](function(){return db[_0x5a86('0x3e')][_0x5a86('0x5c')]({'where':{'id':_0x584cd3[_0x5a86('0x59')]['id']},'include':[{'model':db[_0x5a86('0x9d')],'as':_0x5a86('0x9e')}]});})[_0x5a86('0x32')](handleEntityNotFound(_0x597afe,null))[_0x5a86('0x32')](function(_0x58b25c){if(_0x58b25c&&_0x58b25c[_0x5a86('0x9e')]){_0x356456=_0x58b25c;var _0xfb7c95=_[_0x5a86('0x18')](_0x584cd3[_0x5a86('0x63')],{'firstName':_0x584cd3[_0x5a86('0x63')][_0x5a86('0x9c')],'phone':_0x584cd3[_0x5a86('0x63')][_0x5a86('0x9c')],'ListId':_0x58b25c[_0x5a86('0xa9')]});_0xfb7c95[_0x584cd3[_0x5a86('0x63')][_0x5a86('0xd2')]]=_0x584cd3[_0x5a86('0x63')][_0x5a86('0x9c')];return db['CmContact']['findOrCreate']({'where':_0x31adbd,'defaults':_0xfb7c95});}})[_0x5a86('0xbf')](function(_0x52b740){if(_0x52b740){_0x2134a1=_0x52b740;var _0x19eacc=fs[_0x5a86('0xd5')](path[_0x5a86('0x78')](config[_0x5a86('0x7e')],_0x5a86('0xd6')),_0x5a86('0xd7'));var _0x2030c5=ejs[_0x5a86('0xd8')](_0x19eacc,{'body':_[_0x5a86('0xd9')](_0x584cd3[_0x5a86('0x63')][_0x5a86('0x63')]),'bodyTitle':_0x356456['offlineMessageBody']});return db[_0x5a86('0xda')]['create']({'body':_0x2030c5,'ContactId':_0x52b740['id'],'ChatWebsiteId':_0x356456['id']});}})[_0x5a86('0x32')](function(_0x1b6e0f){if(_0x1b6e0f){_0x25103d=_0x1b6e0f;return db[_0x5a86('0xdb')][_0x5a86('0x70')]({'where':{'service':!![]},'include':[{'model':db[_0x5a86('0xdc')],'as':'Smtp','raw':!![]}]});}})[_0x5a86('0x32')](function(_0x1b1ee3){if(_0x1b1ee3&&_0x1b1ee3[_0x5a86('0xdd')]&&_0x356456[_0x5a86('0xde')]){var _0x486093={'tls':{'rejectUnauthorized':![]}};if(_0x1b1ee3[_0x5a86('0xdd')][_0x5a86('0xdf')]){_0x486093[_0x5a86('0xdf')]=_0x1b1ee3[_0x5a86('0xdd')][_0x5a86('0xdf')];}else{_0x486093[_0x5a86('0xe0')]=_0x1b1ee3[_0x5a86('0xdd')][_0x5a86('0xe0')];_0x486093[_0x5a86('0xe1')]=_0x1b1ee3[_0x5a86('0xdd')][_0x5a86('0xe1')];_0x486093[_0x5a86('0xe2')]=_0x1b1ee3[_0x5a86('0xdd')][_0x5a86('0xe2')];}if(_0x1b1ee3['Smtp'][_0x5a86('0xe3')]){_0x486093[_0x5a86('0xe4')]={'user':_0x1b1ee3['Smtp'][_0x5a86('0x60')],'pass':_0x1b1ee3[_0x5a86('0xdd')][_0x5a86('0xe5')]};}return respondWithRpcPromise(_0x5a86('0xe6'),_0x5a86('0xe7'),{'account':_0x486093,'message':{'from':util[_0x5a86('0xb5')](_0x5a86('0xe8'),_0x1b1ee3[_0x5a86('0x38')],_0x1b1ee3[_0x5a86('0xe9')]||_0x1b1ee3['Smtp'][_0x5a86('0x60')]),'to':_0x356456['forwardOfflineAddress'],'subject':_0x356456[_0x5a86('0xea')],'text':_0x25103d[_0x5a86('0x63')]}},client9003)[_0x5a86('0x32')](function(){return _0x25103d;})[_0x5a86('0x57')](function(_0x54417c){console[_0x5a86('0x26')](_0x54417c);});}})[_0x5a86('0x32')](function(){if(_0x25103d){return _0x25103d;}})[_0x5a86('0x32')](respondWithResult(_0x597afe,null))[_0x5a86('0x57')](handleError(_0x597afe,null));};exports[_0x5a86('0xeb')]=function(_0x3cfb2e,_0x4c7467,_0x5821df){return db[_0x5a86('0xbb')][_0x5a86('0x5c')]({'where':{'id':_0x3cfb2e['params']['id']}})[_0x5a86('0x32')](handleEntityNotFound(_0x4c7467,null))[_0x5a86('0x32')](function(_0x3973a4){if(_0x3973a4){return _0x3973a4[_0x5a86('0xeb')](_0x3cfb2e['body'][_0x5a86('0x6c')],_[_0x5a86('0xec')](_0x3cfb2e[_0x5a86('0x63')],['ids','id'])||{});}})['then'](respondWithResult(_0x4c7467,null))[_0x5a86('0x57')](handleError(_0x4c7467,null));};exports[_0x5a86('0xed')]=function(_0x473f3a,_0x2191f4,_0x4ea922){var _0x445e28={'raw':![],'where':{}};var _0x595ac7={};var _0x1a59da={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x5a86('0x70')]({'where':{'id':_0x473f3a[_0x5a86('0x59')]['id']}})['then'](handleEntityNotFound(_0x2191f4,null))[_0x5a86('0x32')](function(_0x53f9e8){if(_0x53f9e8){_0x595ac7[_0x5a86('0x43')]=_[_0x5a86('0x5a')](db[_0x5a86('0xbb')][_0x5a86('0x3f')]);_0x595ac7[_0x5a86('0x44')]=_[_0x5a86('0x5a')](_0x473f3a[_0x5a86('0x44')]);_0x595ac7[_0x5a86('0x45')]=_['intersection'](_0x595ac7[_0x5a86('0x43')],_0x595ac7[_0x5a86('0x44')]);_0x445e28['attributes']=_[_0x5a86('0x46')](_0x595ac7[_0x5a86('0x43')],qs[_0x5a86('0x47')](_0x473f3a['query'][_0x5a86('0x47')]));_0x445e28[_0x5a86('0x48')]=_0x445e28[_0x5a86('0x48')][_0x5a86('0x49')]?_0x445e28[_0x5a86('0x48')]:_0x595ac7[_0x5a86('0x43')];if(!_0x473f3a[_0x5a86('0x44')][_0x5a86('0x4a')]('nolimit')){_0x445e28[_0x5a86('0x4c')]=qs[_0x5a86('0x4c')](_0x473f3a[_0x5a86('0x44')]['limit']);_0x445e28[_0x5a86('0x2d')]=qs[_0x5a86('0x2d')](_0x473f3a[_0x5a86('0x44')]['offset']);}_0x445e28[_0x5a86('0x4d')]=qs['sort'](_0x473f3a[_0x5a86('0x44')][_0x5a86('0x4e')]);_0x445e28[_0x5a86('0x4f')]=qs[_0x5a86('0x45')](_[_0x5a86('0x69')](_0x473f3a[_0x5a86('0x44')],_0x595ac7[_0x5a86('0x45')]));_0x445e28[_0x5a86('0x4f')]['ChatWebsiteId']=_0x53f9e8['id'];if(_0x473f3a['query'][_0x5a86('0x50')]){_0x445e28[_0x5a86('0x4f')]=_[_0x5a86('0x52')](_0x445e28[_0x5a86('0x4f')],{'$or':_[_0x5a86('0x3d')](_0x445e28['attributes'],function(_0x264fd6){var _0x547ffa={};_0x547ffa[_0x264fd6]={'$like':'%'+_0x473f3a[_0x5a86('0x44')][_0x5a86('0x50')]+'%'};return _0x547ffa;})});}_0x445e28=_[_0x5a86('0x52')]({},_0x445e28,_0x473f3a[_0x5a86('0x53')]);return db[_0x5a86('0xbb')]['count']({'where':_0x445e28['where']})['then'](function(_0x5de4d1){_0x1a59da[_0x5a86('0x54')]=_0x5de4d1;if(_0x473f3a[_0x5a86('0x44')]['includeAll']){_0x445e28[_0x5a86('0x55')]=[{'model':db[_0x5a86('0x9f')],'as':_0x5a86('0xee'),'required':![]},{'model':db[_0x5a86('0xcb')],'as':_0x5a86('0xef'),'attributes':[_0x5a86('0x38'),_0x5a86('0xf0'),_0x5a86('0xf1')],'required':![]},{'model':db[_0x5a86('0xf2')],'as':_0x5a86('0xf3'),'attributes':['id','name',_0x5a86('0xf4')],'where':_0x473f3a[_0x5a86('0x44')]['tag']?{'id':_0x473f3a[_0x5a86('0x44')][_0x5a86('0xf5')]}:undefined,'required':_0x473f3a[_0x5a86('0x44')][_0x5a86('0xf5')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x445e28);})[_0x5a86('0x32')](function(_0x5a33ce){_0x1a59da[_0x5a86('0x56')]=_0x5a33ce;return _0x1a59da;});}})[_0x5a86('0x32')](respondWithFilteredResult(_0x2191f4,_0x445e28))[_0x5a86('0x57')](handleError(_0x2191f4,null));};function iftimePromise(_0x5a473f,_0xc58a04){return respondWithRpcPromise(_0x5a86('0xf6'),'getSnippet',{'command':_0xc58a04[_0x5a86('0xf7')]?util[_0x5a86('0xb5')]('iftime\x20%s,%s',_0x5a473f[_0x5a86('0xf8')],_0xc58a04[_0x5a86('0xf7')]):util[_0x5a86('0xb5')](_0x5a86('0xf9'),_0x5a473f['interval'])},client9002)['then'](function(_0x3258d5){var _0x55c823=_0x3258d5&&_0x3258d5[_0x5a86('0xfa')](_0x5a86('0xfb'))>=0x0?!![]:![];logger['info'](_0x5a86('0xfc'),_0xc58a04['id'],_0x5a473f['id'],_0x5a473f['interval'],_0x55c823?_0x5a86('0xfd'):_0x5a86('0xfe'),_0xc58a04[_0x5a86('0xf7')]?_0xc58a04[_0x5a86('0xf7')]:_0x5a86('0xff'));return _0x55c823;})[_0x5a86('0x57')](function(_0x278218){logger[_0x5a86('0x26')](_0x5a86('0xfc'),_0xc58a04['id'],_0x5a473f['id'],_0x5a473f[_0x5a86('0xf8')],util['inspect'](_0x278218,{'showHidden':![],'depth':null}),_0xc58a04[_0x5a86('0xf7')]?_0xc58a04[_0x5a86('0xf7')]:'No\x20timezone');return![];});}exports[_0x5a86('0x100')]=function(_0x13ff54,_0x194928,_0x2cdd97){var _0x52ee1d=0x0;var _0x1bace8=0x0;var _0x5b46de=![];var _0x2f31ac;var _0x2ca7a9;return db[_0x5a86('0x3e')][_0x5a86('0x5c')]({'where':{'id':_0x13ff54[_0x5a86('0x59')]['id']},'include':[{'model':db[_0x5a86('0x101')],'as':'Interval','include':[{'model':db[_0x5a86('0x101')],'as':'Intervals','attributes':['id',_0x5a86('0xf8')],'raw':!![]}]}]})[_0x5a86('0x32')](handleEntityNotFound(_0x194928,null))[_0x5a86('0x32')](function(_0x10269b){if(_0x10269b){_0x2f31ac=_0x10269b;return _0x10269b[_0x5a86('0x102')]({'raw':!![]});}})[_0x5a86('0x32')](function(_0x4fa39f){if(_0x2f31ac){if(_0x4fa39f){_0x2ca7a9=_0x4fa39f;}}return require(_0x5a86('0x103'))[_0x5a86('0x7b')]();})['then'](function(_0x43d787){if(_0x43d787){_0x1bace8=_0x43d787['virtual'];_0x5b46de=_0x43d787[_0x5a86('0x7c')];}})['then'](function(){return db[_0x5a86('0xbb')][_0x5a86('0x54')]({'where':{'closed':![]}});})['then'](function(_0x2d96f0){_0x52ee1d=_0x2d96f0;if(_0x1bace8&&_0x2d96f0>_0x1bace8){return db[_0x5a86('0x104')][_0x5a86('0x70')]({'where':{'id':0x1}})['then'](function(_0x1881b1){if(_0x1881b1){_0x1881b1[_0x5a86('0x105')](_0x5a86('0x106'));}});}})[_0x5a86('0x32')](function(){if(_0x2f31ac['Interval']&&_0x2f31ac[_0x5a86('0x101')]['Intervals']){var _0x622bd3=[];for(var _0x3a78c8=0x0;_0x3a78c8<_0x2f31ac[_0x5a86('0x101')]['Intervals'][_0x5a86('0x49')];_0x3a78c8++){var _0x1a782f=_0x2f31ac['Interval']['Intervals'][_0x3a78c8][_0x5a86('0x34')]({'plain':!![]});_0x622bd3[_0x5a86('0xc4')](iftimePromise(_0x1a782f,_0x2f31ac));}return BPromise['all'](_0x622bd3)[_0x5a86('0x32')](function(_0x1bb191){return _[_0x5a86('0x107')](_0x1bb191);});}else{return!![];}})[_0x5a86('0x32')](function(_0x24e62d){var _0x330237=fs[_0x5a86('0xd5')](path[_0x5a86('0x78')](config[_0x5a86('0x7e')],_0x5a86('0x108')),_0x5a86('0xd7'));var _0x123266={'remote':_0x2f31ac[_0x5a86('0x109')],'query':querystring[_0x5a86('0x25')](_[_0x5a86('0x52')](_0x2f31ac[_0x5a86('0x34')]({'plain':!![]}),{'customerIp':_0x13ff54[_0x5a86('0xad')]['x-forwarded-for']||_0x13ff54['headers'][_0x5a86('0x10a')]||_0x13ff54[_0x5a86('0x10b')]['remoteAddress']||_0x13ff54['ip'],'referer':_0x13ff54[_0x5a86('0xad')][_0x5a86('0xb2')],'openedInteractions':_0x52ee1d,'maxInteractions':_0x1bace8,'virtual':_0x5b46de[_0x5a86('0x10c')],'online':_0x24e62d,'custom':_0x5b46de}))[_0x5a86('0x10d')](/'/g,'\x5c\x27')};_0x194928[_0x5a86('0x39')](ejs['render'](Mustache['render'](_0x330237,_0x123266),{'proactiveActions':_0x2ca7a9,'alignment':_0x2f31ac['alignment'],'verticalAlignment':_0x2f31ac[_0x5a86('0x10e')],'div_color':_0x2f31ac[_0x5a86('0xf4')],'text_color':_0x2f31ac[_0x5a86('0x10f')]}));})[_0x5a86('0x57')](handleError(_0x194928,null));};exports[_0x5a86('0x110')]=function(_0x2a9175,_0x3bf566,_0x15d8cf){return db['ChatWebsite']['findOne']({'where':{'id':_0x2a9175[_0x5a86('0x59')]['id']}})['then'](handleEntityNotFound(_0x3bf566,null))['then'](function(_0x325c2f){if(_0x325c2f){return db[_0x5a86('0x111')][_0x5a86('0x112')](function(_0x15d0ee){return db[_0x5a86('0xa1')][_0x5a86('0x33')]({'where':{'ChatWebsiteId':_0x2a9175[_0x5a86('0x59')]['id']},'transaction':_0x15d0ee})[_0x5a86('0x32')](function(_0x49f3ba){var _0x544159=_['map'](_0x2a9175[_0x5a86('0x63')],function(_0x1e949e){_0x1e949e[_0x5a86('0x66')]=_0x2a9175[_0x5a86('0x59')]['id'];return _0x1e949e;});return db['ChatApplication'][_0x5a86('0x113')](_0x544159,{'transaction':_0x15d0ee});});})['then'](function(){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x2a9175[_0x5a86('0x59')]['id']},'order':_0x5a86('0xa5')});});}})[_0x5a86('0x32')](respondWithResult(_0x3bf566,null))[_0x5a86('0x57')](handleError(_0x3bf566,null));};exports[_0x5a86('0x114')]=function(_0xbb4d65,_0x54edb4,_0x4fab39){var _0x46fa90={};var _0x27defe={};var _0xb9495b;var _0x4b639f;return db['ChatWebsite'][_0x5a86('0x70')]({'where':{'id':_0xbb4d65['params']['id']}})['then'](handleEntityNotFound(_0x54edb4,null))['then'](function(_0x179ddf){if(_0x179ddf){_0xb9495b=_0x179ddf;_0x27defe[_0x5a86('0x43')]=_[_0x5a86('0x5a')](db[_0x5a86('0xa1')][_0x5a86('0x3f')]);_0x27defe[_0x5a86('0x44')]=_['keys'](_0xbb4d65[_0x5a86('0x44')]);_0x27defe['filters']=_[_0x5a86('0x46')](_0x27defe[_0x5a86('0x43')],_0x27defe[_0x5a86('0x44')]);_0x46fa90['attributes']=_[_0x5a86('0x46')](_0x27defe[_0x5a86('0x43')],qs['fields'](_0xbb4d65['query'][_0x5a86('0x47')]));_0x46fa90['attributes']=_0x46fa90[_0x5a86('0x48')][_0x5a86('0x49')]?_0x46fa90[_0x5a86('0x48')]:_0x27defe[_0x5a86('0x43')];_0x46fa90['order']=qs[_0x5a86('0x4e')](_0xbb4d65[_0x5a86('0x44')][_0x5a86('0x4e')]);_0x46fa90[_0x5a86('0x4f')]=qs[_0x5a86('0x45')](_[_0x5a86('0x69')](_0xbb4d65[_0x5a86('0x44')],_0x27defe[_0x5a86('0x45')]));if(_0xbb4d65[_0x5a86('0x44')][_0x5a86('0x50')]){_0x46fa90[_0x5a86('0x4f')]=_[_0x5a86('0x52')](_0x46fa90[_0x5a86('0x4f')],{'$or':_['map'](_0x46fa90[_0x5a86('0x48')],function(_0x4914ca){var _0x180a69={};_0x180a69[_0x4914ca]={'$like':'%'+_0xbb4d65['query'][_0x5a86('0x50')]+'%'};return _0x180a69;})});}_0x46fa90=_[_0x5a86('0x52')]({},_0x46fa90,_0xbb4d65[_0x5a86('0x53')]);return _0xb9495b[_0x5a86('0x114')](_0x46fa90);}})[_0x5a86('0x32')](function(_0xfc878a){if(_0xfc878a){_0x4b639f=_0xfc878a['length'];if(!_0xbb4d65[_0x5a86('0x44')][_0x5a86('0x4a')]('nolimit')){_0x46fa90[_0x5a86('0x4c')]=qs[_0x5a86('0x4c')](_0xbb4d65[_0x5a86('0x44')]['limit']);_0x46fa90['offset']=qs[_0x5a86('0x2d')](_0xbb4d65[_0x5a86('0x44')][_0x5a86('0x2d')]);}return _0xb9495b[_0x5a86('0x114')](_0x46fa90);}})[_0x5a86('0x32')](function(_0x14925f){if(_0x14925f){return _0x14925f?{'count':_0x4b639f,'rows':_0x14925f}:null;}})[_0x5a86('0x32')](respondWithResult(_0x54edb4,null))['catch'](handleError(_0x54edb4,null));};exports['addProactiveActions']=function(_0x46de4e,_0x2369e0,_0x89e9dc){return db[_0x5a86('0x115')][_0x5a86('0x5c')]({'where':{'id':_0x46de4e[_0x5a86('0x59')]['id']}})[_0x5a86('0x32')](handleEntityNotFound(_0x2369e0,null))[_0x5a86('0x32')](function(_0x269db7){if(_0x269db7){return _0x269db7[_0x5a86('0x116')](_0x46de4e[_0x5a86('0x63')][_0x5a86('0x6c')],_['omit'](_0x46de4e[_0x5a86('0x63')],[_0x5a86('0x6c'),'id'])||{});}})['then'](respondWithResult(_0x2369e0,null))[_0x5a86('0x57')](handleError(_0x2369e0,null));};exports[_0x5a86('0x102')]=function(_0x4a944e,_0x8b82b5,_0x37a473){var _0x2c4e10={};var _0x91f11e={};var _0x189a9f;var _0x43cc75;return db[_0x5a86('0x3e')]['findOne']({'where':{'id':_0x4a944e[_0x5a86('0x59')]['id']}})[_0x5a86('0x32')](handleEntityNotFound(_0x8b82b5,null))[_0x5a86('0x32')](function(_0x4f8650){if(_0x4f8650){_0x189a9f=_0x4f8650;_0x91f11e[_0x5a86('0x43')]=_[_0x5a86('0x5a')](db[_0x5a86('0x117')][_0x5a86('0x3f')]);_0x91f11e[_0x5a86('0x44')]=_[_0x5a86('0x5a')](_0x4a944e[_0x5a86('0x44')]);_0x91f11e[_0x5a86('0x45')]=_['intersection'](_0x91f11e[_0x5a86('0x43')],_0x91f11e[_0x5a86('0x44')]);_0x2c4e10[_0x5a86('0x48')]=_['intersection'](_0x91f11e[_0x5a86('0x43')],qs[_0x5a86('0x47')](_0x4a944e[_0x5a86('0x44')][_0x5a86('0x47')]));_0x2c4e10['attributes']=_0x2c4e10[_0x5a86('0x48')]['length']?_0x2c4e10['attributes']:_0x91f11e[_0x5a86('0x43')];_0x2c4e10[_0x5a86('0x4d')]=qs[_0x5a86('0x4e')](_0x4a944e[_0x5a86('0x44')][_0x5a86('0x4e')]);_0x2c4e10[_0x5a86('0x4f')]=qs[_0x5a86('0x45')](_['pick'](_0x4a944e[_0x5a86('0x44')],_0x91f11e[_0x5a86('0x45')]));if(_0x4a944e['query'][_0x5a86('0x50')]){_0x2c4e10[_0x5a86('0x4f')]=_[_0x5a86('0x52')](_0x2c4e10[_0x5a86('0x4f')],{'$or':_[_0x5a86('0x3d')](_0x2c4e10[_0x5a86('0x48')],function(_0x414f74){var _0x4a8a3e={};_0x4a8a3e[_0x414f74]={'$like':'%'+_0x4a944e['query'][_0x5a86('0x50')]+'%'};return _0x4a8a3e;})});}_0x2c4e10=_[_0x5a86('0x52')]({},_0x2c4e10,_0x4a944e[_0x5a86('0x53')]);return _0x189a9f[_0x5a86('0x102')](_0x2c4e10);}})[_0x5a86('0x32')](function(_0x1515c6){if(_0x1515c6){_0x43cc75=_0x1515c6['length'];if(!_0x4a944e[_0x5a86('0x44')][_0x5a86('0x4a')](_0x5a86('0x4b'))){_0x2c4e10[_0x5a86('0x4c')]=qs['limit'](_0x4a944e[_0x5a86('0x44')]['limit']);_0x2c4e10[_0x5a86('0x2d')]=qs['offset'](_0x4a944e[_0x5a86('0x44')][_0x5a86('0x2d')]);}return _0x189a9f['getProactiveActions'](_0x2c4e10);}})[_0x5a86('0x32')](function(_0x3e78ec){if(_0x3e78ec){return _0x3e78ec?{'count':_0x43cc75,'rows':_0x3e78ec}:null;}})[_0x5a86('0x32')](respondWithResult(_0x8b82b5,null))[_0x5a86('0x57')](handleError(_0x8b82b5,null));};exports[_0x5a86('0x118')]=function(_0x34aba1,_0x1c2013,_0x1c0e1a){var _0x36be4e=_0x34aba1[_0x5a86('0x44')][_0x5a86('0x119')]==='false'?_0x5a86('0x11a'):'onlineForm';return db[_0x5a86('0x3e')][_0x5a86('0x5c')]({'attributes':['id',_0x36be4e],'where':{'id':_0x34aba1[_0x5a86('0x59')]['id']}})[_0x5a86('0x32')](handleEntityNotFound(_0x1c2013,null))[_0x5a86('0x32')](function(_0x57c1c4){if(_0x57c1c4){var _0xd6a5f8=_0x57c1c4[_0x36be4e];var _0x1c59b9=_0xd6a5f8&&_0xd6a5f8[_0x5a86('0x11b')]?_0xd6a5f8[_0x5a86('0x11b')]:[];_0x1c2013[_0x5a86('0x39')]({'fromKey':_[_0x5a86('0x83')](_0xd6a5f8['fromKey'])?undefined:_0xd6a5f8['fromKey'],'count':_0x1c59b9['length'],'rows':_0x1c59b9});}})[_0x5a86('0x57')](handleError(_0x1c2013,null));};exports[_0x5a86('0x11c')]=function(_0x537bbe,_0x4047b9,_0x580b6c){var _0x68ad01={'raw':![],'where':{}};var _0x415567={};var _0x37a404={'count':0x0,'rows':[]};return db[_0x5a86('0x3e')][_0x5a86('0x70')]({'where':{'id':_0x537bbe[_0x5a86('0x59')]['id']}})[_0x5a86('0x32')](handleEntityNotFound(_0x4047b9,null))[_0x5a86('0x32')](function(_0x378743){if(_0x378743){_0x415567[_0x5a86('0x43')]=_[_0x5a86('0x5a')](db[_0x5a86('0xda')][_0x5a86('0x3f')]);_0x415567['query']=_[_0x5a86('0x5a')](_0x537bbe[_0x5a86('0x44')]);_0x415567[_0x5a86('0x45')]=_['intersection'](_0x415567[_0x5a86('0x43')],_0x415567[_0x5a86('0x44')]);_0x68ad01['attributes']=_[_0x5a86('0x46')](_0x415567[_0x5a86('0x43')],qs[_0x5a86('0x47')](_0x537bbe[_0x5a86('0x44')]['fields']));_0x68ad01[_0x5a86('0x48')]=_0x68ad01['attributes'][_0x5a86('0x49')]?_0x68ad01[_0x5a86('0x48')]:_0x415567[_0x5a86('0x43')];if(!_0x537bbe[_0x5a86('0x44')]['hasOwnProperty'](_0x5a86('0x4b'))){_0x68ad01[_0x5a86('0x4c')]=qs[_0x5a86('0x4c')](_0x537bbe[_0x5a86('0x44')][_0x5a86('0x4c')]);_0x68ad01[_0x5a86('0x2d')]=qs[_0x5a86('0x2d')](_0x537bbe[_0x5a86('0x44')][_0x5a86('0x2d')]);}_0x68ad01[_0x5a86('0x4d')]=qs[_0x5a86('0x4e')](_0x537bbe[_0x5a86('0x44')][_0x5a86('0x4e')]);_0x68ad01['where']=qs[_0x5a86('0x45')](_[_0x5a86('0x69')](_0x537bbe[_0x5a86('0x44')],_0x415567[_0x5a86('0x45')]));_0x68ad01[_0x5a86('0x4f')][_0x5a86('0x66')]=_0x378743['id'];if(_0x537bbe[_0x5a86('0x44')][_0x5a86('0x50')]){_0x68ad01['where']=_[_0x5a86('0x52')](_0x68ad01['where'],{'$or':_[_0x5a86('0x3d')](_0x68ad01[_0x5a86('0x48')],function(_0x201881){var _0x4bc699={};_0x4bc699[_0x201881]={'$like':'%'+_0x537bbe[_0x5a86('0x44')]['filter']+'%'};return _0x4bc699;})});}_0x68ad01=_['merge']({},_0x68ad01,_0x537bbe[_0x5a86('0x53')]);return db[_0x5a86('0xda')][_0x5a86('0x54')]({'where':_0x68ad01['where']})[_0x5a86('0x32')](function(_0x326eba){_0x37a404['count']=_0x326eba;if(_0x537bbe['query'][_0x5a86('0x5b')]){_0x68ad01[_0x5a86('0x55')]=[{'all':!![]}];}else{_0x68ad01[_0x5a86('0x55')]=[{'model':db[_0x5a86('0x9f')],'as':_0x5a86('0xee'),'required':![]}];}return db[_0x5a86('0xda')][_0x5a86('0x6a')](_0x68ad01);})[_0x5a86('0x32')](function(_0x312cdc){_0x37a404[_0x5a86('0x56')]=_0x312cdc;return _0x37a404;});}})['then'](respondWithFilteredResult(_0x4047b9,_0x68ad01))[_0x5a86('0x57')](handleError(_0x4047b9,null));};exports[_0x5a86('0x11d')]=function(_0x3df974,_0x2da589,_0x564510){return db[_0x5a86('0x3e')]['find']({'where':{'id':_0x3df974[_0x5a86('0x59')]['id']}})[_0x5a86('0x32')](handleEntityNotFound(_0x2da589,null))[_0x5a86('0x32')](function(_0x58c264){if(_0x58c264){return _0x58c264[_0x5a86('0x11d')](_0x3df974[_0x5a86('0x63')][_0x5a86('0x6c')],_['omit'](_0x3df974[_0x5a86('0x63')],[_0x5a86('0x6c'),'id'])||{})[_0x5a86('0xbf')](function(_0x17fada){for(var _0x5a2d07=0x0;_0x5a2d07<_0x3df974[_0x5a86('0x63')][_0x5a86('0x6c')][_0x5a86('0x49')];_0x5a2d07+=0x1){socket[_0x5a86('0x11e')](_0x5a86('0x11f'),{'UserId':_0x3df974[_0x5a86('0x63')][_0x5a86('0x6c')][_0x5a2d07],'ChatWebsiteId':_0x3df974[_0x5a86('0x59')]['id']});}return _0x17fada;});}})[_0x5a86('0x32')](respondWithResult(_0x2da589,null))[_0x5a86('0x57')](handleError(_0x2da589,null));};exports[_0x5a86('0x120')]=function(_0x599ab8,_0x32d75d,_0x38f176){return db[_0x5a86('0x3e')]['find']({'where':{'id':_0x599ab8[_0x5a86('0x59')]['id']}})[_0x5a86('0x32')](handleEntityNotFound(_0x32d75d,null))[_0x5a86('0x32')](function(_0x5bc889){if(_0x5bc889){return _0x5bc889[_0x5a86('0x120')](_0x599ab8[_0x5a86('0x44')]['ids'])[_0x5a86('0x32')](function(){if(_[_0x5a86('0x121')](_0x599ab8[_0x5a86('0x44')][_0x5a86('0x6c')])){for(var _0x861b9e=0x0;_0x861b9e<_0x599ab8[_0x5a86('0x44')]['ids'][_0x5a86('0x49')];_0x861b9e+=0x1){socket[_0x5a86('0x11e')](_0x5a86('0x122'),{'UserId':Number(_0x599ab8[_0x5a86('0x44')][_0x5a86('0x6c')][_0x861b9e]),'ChatWebsiteId':Number(_0x599ab8[_0x5a86('0x59')]['id'])});}}else{socket[_0x5a86('0x11e')](_0x5a86('0x122'),{'UserId':Number(_0x599ab8[_0x5a86('0x44')]['ids']),'ChatWebsiteId':Number(_0x599ab8['params']['id'])});}});}})[_0x5a86('0x32')](respondWithStatusCode(_0x32d75d,null))[_0x5a86('0x57')](handleError(_0x32d75d,null));};exports[_0x5a86('0x123')]=function(_0x138056,_0x1543ad,_0x594308){var _0xf51166={};var _0x1dc915={};var _0x24fc6b;var _0x3d4f6a;return db[_0x5a86('0x3e')][_0x5a86('0x70')]({'where':{'id':_0x138056['params']['id']}})[_0x5a86('0x32')](handleEntityNotFound(_0x1543ad,null))[_0x5a86('0x32')](function(_0x155b6c){if(_0x155b6c){_0x24fc6b=_0x155b6c;_0x1dc915['model']=_[_0x5a86('0x5a')](db[_0x5a86('0xcb')][_0x5a86('0x3f')]);_0x1dc915[_0x5a86('0x44')]=_['keys'](_0x138056[_0x5a86('0x44')]);_0x1dc915['filters']=_[_0x5a86('0x46')](_0x1dc915[_0x5a86('0x43')],_0x1dc915[_0x5a86('0x44')]);_0xf51166[_0x5a86('0x48')]=_[_0x5a86('0x46')](_0x1dc915['model'],qs[_0x5a86('0x47')](_0x138056['query'][_0x5a86('0x47')]));_0xf51166[_0x5a86('0x48')]=_0xf51166['attributes'][_0x5a86('0x49')]?_0xf51166[_0x5a86('0x48')]:_0x1dc915[_0x5a86('0x43')];_0xf51166['order']=qs['sort'](_0x138056['query'][_0x5a86('0x4e')]);_0xf51166['where']=qs[_0x5a86('0x45')](_[_0x5a86('0x69')](_0x138056[_0x5a86('0x44')],_0x1dc915[_0x5a86('0x45')]));if(_0x138056['query'][_0x5a86('0x50')]){_0xf51166[_0x5a86('0x4f')]=_[_0x5a86('0x52')](_0xf51166[_0x5a86('0x4f')],{'$or':_[_0x5a86('0x3d')](_0xf51166[_0x5a86('0x48')],function(_0x358aa9){var _0x4e1ceb={};_0x4e1ceb[_0x358aa9]={'$like':'%'+_0x138056[_0x5a86('0x44')][_0x5a86('0x50')]+'%'};return _0x4e1ceb;})});}_0xf51166=_[_0x5a86('0x52')]({},_0xf51166,_0x138056['options']);return _0x24fc6b[_0x5a86('0x123')](_0xf51166);}})[_0x5a86('0x32')](function(_0x301eba){if(_0x301eba){_0x3d4f6a=_0x301eba[_0x5a86('0x49')];if(!_0x138056[_0x5a86('0x44')]['hasOwnProperty'](_0x5a86('0x4b'))){_0xf51166['limit']=qs['limit'](_0x138056[_0x5a86('0x44')][_0x5a86('0x4c')]);_0xf51166[_0x5a86('0x2d')]=qs[_0x5a86('0x2d')](_0x138056['query'][_0x5a86('0x2d')]);}return _0x24fc6b[_0x5a86('0x123')](_0xf51166);}})[_0x5a86('0x32')](function(_0x210364){if(_0x210364){return _0x210364?{'count':_0x3d4f6a,'rows':_0x210364}:null;}})[_0x5a86('0x32')](respondWithResult(_0x1543ad,null))[_0x5a86('0x57')](handleError(_0x1543ad,null));}; \ No newline at end of file +var _0x099c=['ChatInteraction','interaction','spread','messageId','created','autoclose','close','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','Start','EventManager','notify','offline','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','readFileSync','server/files/templates/chatOfflineMessage.ejs','toPairs','offlineMessageBody','ChatOfflineMessage','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','addInteraction','omit','getInteractions','options','Contact','Owner','fullname','Tag','Tags','color','tag','Command','getSnippet','timezone','interval','iftime\x20%s','indexOf','true','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','License','push','all','some','server/files/chat/iframe.js','utf8','remote','x-real-ip','remoteAddress','render','verticalAlignment','textColor','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','hasOwnProperty','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','to-csv','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','./chatWebsite.socket','register','client','http','test','Sequelize','ValidationError','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','ChatWebsite,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','then','get','ChatWebsites','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','type','key','query','filters','model','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','keys','intersection','create','body','role','user','UserProfileSection','find','UserProfileResource','params','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','Disposition','rawAttributes','removeDispositions','ids','addAnswer','CannedAnswer','pick','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','headers','user-agent','getResult','chat','no\x20available\x20attributes','difference','createdAt','updatedAt','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','CmContact','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','List','ListId','contact','customerIp','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','format','device','vendor','%s\x20%s\x20%s','threadId'];(function(_0x2aa254,_0x2bbb11){var _0x100510=function(_0x17f87d){while(--_0x17f87d){_0x2aa254['push'](_0x2aa254['shift']());}};_0x100510(++_0x2bbb11);}(_0x099c,0x67));var _0xc099=function(_0x1b96c6,_0x45e55a){_0x1b96c6=_0x1b96c6-0x0;var _0x4a20fa=_0x099c[_0x1b96c6];return _0x4a20fa;};'use strict';var pdf=require(_0xc099('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc099('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc099('0x2'));var moment=require(_0xc099('0x3'));var BPromise=require(_0xc099('0x4'));var Mustache=require(_0xc099('0x5'));var util=require(_0xc099('0x6'));var path=require('path');var sox=require(_0xc099('0x7'));var csv=require('to-csv');var ejs=require(_0xc099('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc099('0x9'));var crypto=require(_0xc099('0xa'));var jsforce=require(_0xc099('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc099('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc099('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc099('0xe'));var hardwareService=require(_0xc099('0xf'));var logger=require(_0xc099('0x10'))(_0xc099('0x11'));var utils=require(_0xc099('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xc099('0x13')]=_[_0xc099('0x14')](config[_0xc099('0x13')],{'host':_0xc099('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc099('0x16'))[_0xc099('0x17')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xc099('0x18')][_0xc099('0x19')]({'port':0x232a});var client9003=jayson[_0xc099('0x18')][_0xc099('0x19')]({'port':0x232b});function checkPasswordPattern(_0x292009,_0x105bec,_0x48aab4){if(_0x48aab4){var _0x3248b5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3248b5[_0xc099('0x1a')](_0x105bec)){return _0x292009;}else{throw new db[(_0xc099('0x1b'))][(_0xc099('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x292009;}}function respondWithRpcPromise(_0x290a85,_0x49b8a8,_0x2f6a74,_0x133772){return new BPromise(function(_0x482987,_0x3be104){var _0x41b287=_0x133772||client;return _0x41b287['request'](_0x290a85,_0x2f6a74)['then'](function(_0x118db9){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x49b8a8,_0xc099('0x1d'));logger[_0xc099('0x1e')](_0xc099('0x1f'),_0x49b8a8,_0xc099('0x1d'),JSON[_0xc099('0x20')](_0x118db9));if(_0x118db9[_0xc099('0x21')]){if(_0x118db9[_0xc099('0x21')]['code']===0x1f4){logger[_0xc099('0x21')](_0xc099('0x22'),_0x49b8a8,_0x118db9[_0xc099('0x21')][_0xc099('0x23')]);return _0x3be104(_0x118db9[_0xc099('0x21')][_0xc099('0x23')]);}logger[_0xc099('0x21')](_0xc099('0x22'),_0x49b8a8,_0x118db9[_0xc099('0x21')][_0xc099('0x23')]);return _0x482987(_0x118db9[_0xc099('0x21')][_0xc099('0x23')]);}else{logger[_0xc099('0x24')]('ChatWebsite,\x20%s,\x20%s',_0x49b8a8,_0xc099('0x1d'));_0x482987(_0x118db9['result'][_0xc099('0x23')]);}})[_0xc099('0x25')](function(_0x4f9cec){logger[_0xc099('0x21')]('ChatWebsite,\x20%s,\x20%s',_0x49b8a8,_0x4f9cec);_0x3be104(_0x4f9cec);});});}function respondWithStatusCode(_0x52b921,_0x32ad46){_0x32ad46=_0x32ad46||0xcc;return function(_0x12cee8){if(_0x12cee8){return _0x52b921[_0xc099('0x26')](_0x32ad46);}return _0x52b921[_0xc099('0x27')](_0x32ad46)[_0xc099('0x28')]();};}function respondWithResult(_0x12cdb1,_0x560f1b){_0x560f1b=_0x560f1b||0xc8;return function(_0x326ffc){if(_0x326ffc){return _0x12cdb1['status'](_0x560f1b)['json'](_0x326ffc);}};}function respondWithFilteredResult(_0x5a6411,_0x529a27){return function(_0x5170c5){if(_0x5170c5){var _0x4b2ca0=_0x5170c5[_0xc099('0x29')],_0x44d57b=_0x529a27[_0xc099('0x2a')],_0x45bca3=_0x529a27[_0xc099('0x2a')]+_0x529a27[_0xc099('0x2b')],_0x1623ee;if(_0x45bca3>=_0x4b2ca0){_0x45bca3=_0x4b2ca0;_0x1623ee=0xc8;}else{_0x1623ee=0xce;}_0x5a6411['status'](_0x1623ee);return _0x5a6411['set'](_0xc099('0x2c'),_0x44d57b+'-'+_0x45bca3+'/'+_0x4b2ca0)[_0xc099('0x2d')](_0x5170c5);}return null;};}function patchUpdates(_0x57713d){return function(_0x4a6a98){try{jsonpatch[_0xc099('0x2e')](_0x4a6a98,_0x57713d,!![]);}catch(_0x37ef7f){return BPromise[_0xc099('0x2f')](_0x37ef7f);}return _0x4a6a98[_0xc099('0x30')]();};}function saveUpdates(_0x103a28,_0x19c576){return function(_0x553f19){if(_0x553f19){return _0x553f19[_0xc099('0x31')](_0x103a28)['then'](function(_0x1ce494){return _0x1ce494;});}return null;};}function removeEntity(_0x4f872b,_0x95cc4b){return function(_0x38d2fb){if(_0x38d2fb){return _0x38d2fb[_0xc099('0x32')]()[_0xc099('0x33')](function(){var _0x344891=_0x38d2fb[_0xc099('0x34')]({'plain':!![]});var _0x42547e=_0xc099('0x35');return db['UserProfileResource']['destroy']({'where':{'type':_0x42547e,'resourceId':_0x344891['id']}})[_0xc099('0x33')](function(){return _0x38d2fb;});})['then'](function(){_0x4f872b[_0xc099('0x27')](0xcc)[_0xc099('0x28')]();});}};}function handleEntityNotFound(_0x437ef4,_0x7270d6){return function(_0x5f5074){if(!_0x5f5074){_0x437ef4[_0xc099('0x26')](0x194);}return _0x5f5074;};}function handleError(_0x165309,_0x31cc5a){_0x31cc5a=_0x31cc5a||0x1f4;return function(_0x505723){logger[_0xc099('0x21')](_0x505723[_0xc099('0x36')]);if(_0x505723[_0xc099('0x37')]){delete _0x505723[_0xc099('0x37')];}_0x165309[_0xc099('0x27')](_0x31cc5a)[_0xc099('0x38')](_0x505723);};}exports[_0xc099('0x39')]=function(_0x30a57d,_0x505ef0){var _0x3a59dc={'include':[{'model':db[_0xc099('0x3a')],'as':_0xc099('0x3b')}]},_0x61c884={},_0x5b0236={'count':0x0,'rows':[]};var _0x5ee515=_[_0xc099('0x3c')](db[_0xc099('0x3d')]['rawAttributes'],function(_0x3a45b3){return{'name':_0x3a45b3['fieldName'],'type':_0x3a45b3[_0xc099('0x3e')][_0xc099('0x3f')]};});_0x61c884['model']=_[_0xc099('0x3c')](_0x5ee515,_0xc099('0x37'));_0x61c884['query']=_['keys'](_0x30a57d[_0xc099('0x40')]);_0x61c884[_0xc099('0x41')]=_['intersection'](_0x61c884[_0xc099('0x42')],_0x61c884[_0xc099('0x40')]);_0x3a59dc[_0xc099('0x43')]=_['intersection'](_0x61c884[_0xc099('0x42')],qs['fields'](_0x30a57d[_0xc099('0x40')][_0xc099('0x44')]));_0x3a59dc['attributes']=_0x3a59dc[_0xc099('0x43')][_0xc099('0x45')]?_0x3a59dc[_0xc099('0x43')]:_0x61c884[_0xc099('0x42')];if(!_0x30a57d[_0xc099('0x40')]['hasOwnProperty'](_0xc099('0x46'))){_0x3a59dc[_0xc099('0x2b')]=qs['limit'](_0x30a57d[_0xc099('0x40')]['limit']);_0x3a59dc['offset']=qs[_0xc099('0x2a')](_0x30a57d[_0xc099('0x40')][_0xc099('0x2a')]);}_0x3a59dc[_0xc099('0x47')]=qs[_0xc099('0x48')](_0x30a57d[_0xc099('0x40')]['sort']);_0x3a59dc[_0xc099('0x49')]=qs[_0xc099('0x41')](_['pick'](_0x30a57d[_0xc099('0x40')],_0x61c884[_0xc099('0x41')]));if(_0x30a57d[_0xc099('0x40')][_0xc099('0x4a')]){_0x3a59dc[_0xc099('0x49')]=_['merge'](_0x3a59dc[_0xc099('0x49')],{'$or':_['map'](_0x5ee515,function(_0x378402){if(_0x378402[_0xc099('0x3e')]!==_0xc099('0x4b')){var _0x2a4d89={};_0x2a4d89[_0x378402[_0xc099('0x37')]]={'$like':'%'+_0x30a57d[_0xc099('0x40')][_0xc099('0x4a')]+'%'};return _0x2a4d89;}})});}_0x3a59dc=_[_0xc099('0x4c')]({},_0x3a59dc,_0x30a57d['options']);var _0x3aaa4c={'where':_0x3a59dc[_0xc099('0x49')]};return db[_0xc099('0x3d')][_0xc099('0x29')](_0x3aaa4c)[_0xc099('0x33')](function(_0x1fe3ea){_0x5b0236[_0xc099('0x29')]=_0x1fe3ea;if(_0x30a57d['query'][_0xc099('0x4d')]){_0x3a59dc[_0xc099('0x4e')]=[{'all':!![]}];}return db[_0xc099('0x3d')][_0xc099('0x4f')](_0x3a59dc);})[_0xc099('0x33')](function(_0x27b715){_0x5b0236[_0xc099('0x50')]=_0x27b715;return _0x5b0236;})[_0xc099('0x33')](respondWithFilteredResult(_0x505ef0,_0x3a59dc))[_0xc099('0x25')](handleError(_0x505ef0,null));};exports[_0xc099('0x51')]=function(_0x2c35d4,_0x3231dd){var _0x479071={'raw':![],'where':{'id':_0x2c35d4['params']['id']},'include':[{'model':db['Pause'],'as':_0xc099('0x3b')}]},_0x165bb3={};_0x165bb3[_0xc099('0x42')]=_[_0xc099('0x52')](db[_0xc099('0x3d')]['rawAttributes']);_0x165bb3[_0xc099('0x40')]=_[_0xc099('0x52')](_0x2c35d4[_0xc099('0x40')]);_0x165bb3[_0xc099('0x41')]=_[_0xc099('0x53')](_0x165bb3[_0xc099('0x42')],_0x165bb3['query']);_0x479071['attributes']=_[_0xc099('0x53')](_0x165bb3[_0xc099('0x42')],qs[_0xc099('0x44')](_0x2c35d4[_0xc099('0x40')][_0xc099('0x44')]));_0x479071[_0xc099('0x43')]=_0x479071[_0xc099('0x43')]['length']?_0x479071[_0xc099('0x43')]:_0x165bb3[_0xc099('0x42')];if(_0x2c35d4[_0xc099('0x40')][_0xc099('0x4d')]){_0x479071[_0xc099('0x4e')]=[{'all':!![]}];}_0x479071=_[_0xc099('0x4c')]({},_0x479071,_0x2c35d4['options']);return db[_0xc099('0x3d')]['find'](_0x479071)['then'](handleEntityNotFound(_0x3231dd,null))['then'](respondWithResult(_0x3231dd,null))[_0xc099('0x25')](handleError(_0x3231dd,null));};exports[_0xc099('0x54')]=function(_0x21da5a,_0x36da9d){return db['ChatWebsite'][_0xc099('0x54')](_0x21da5a[_0xc099('0x55')],{})[_0xc099('0x33')](function(_0x17ed6d){var _0x5aec47=_0x21da5a['user']['get']({'plain':!![]});if(!_0x5aec47)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5aec47[_0xc099('0x56')]===_0xc099('0x57')){var _0x4b71c4=_0x17ed6d[_0xc099('0x34')]({'plain':!![]});var _0x1c1902='ChatWebsites';return db[_0xc099('0x58')][_0xc099('0x59')]({'where':{'name':_0x1c1902,'userProfileId':_0x5aec47['userProfileId']},'raw':!![]})[_0xc099('0x33')](function(_0x35489f){if(_0x35489f&&_0x35489f['autoAssociation']===0x0){return db[_0xc099('0x5a')][_0xc099('0x54')]({'name':_0x4b71c4[_0xc099('0x37')],'resourceId':_0x4b71c4['id'],'type':_0x35489f[_0xc099('0x37')],'sectionId':_0x35489f['id']},{})['then'](function(){return _0x17ed6d;});}else{return _0x17ed6d;}})[_0xc099('0x25')](function(_0x2778bd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2778bd);throw _0x2778bd;});}return _0x17ed6d;})[_0xc099('0x33')](respondWithResult(_0x36da9d,0xc9))[_0xc099('0x25')](handleError(_0x36da9d,null));};exports[_0xc099('0x31')]=function(_0x4d8494,_0x4faeb9){if(_0x4d8494['body']['id']){delete _0x4d8494[_0xc099('0x55')]['id'];}return db[_0xc099('0x3d')][_0xc099('0x59')]({'where':{'id':_0x4d8494[_0xc099('0x5b')]['id']},'include':[{'model':db[_0xc099('0x3a')],'as':_0xc099('0x3b')}]})[_0xc099('0x33')](handleEntityNotFound(_0x4faeb9,null))[_0xc099('0x33')](saveUpdates(_0x4d8494[_0xc099('0x55')],null))[_0xc099('0x33')](respondWithResult(_0x4faeb9,null))[_0xc099('0x25')](handleError(_0x4faeb9,null));};exports[_0xc099('0x32')]=function(_0x43a725,_0x39ce23){return db[_0xc099('0x3d')]['find']({'where':{'id':_0x43a725[_0xc099('0x5b')]['id']}})[_0xc099('0x33')](handleEntityNotFound(_0x39ce23,null))[_0xc099('0x33')](removeEntity(_0x39ce23,null))['catch'](handleError(_0x39ce23,null));};exports['describe']=function(_0x19b0ec,_0x7fa054){return db[_0xc099('0x3d')][_0xc099('0x5c')]()[_0xc099('0x33')](respondWithResult(_0x7fa054,null))[_0xc099('0x25')](handleError(_0x7fa054,null));};exports[_0xc099('0x5d')]=function(_0x2650b8,_0x8c34cc,_0x1c9da9){if(_0x2650b8[_0xc099('0x55')]['id']){delete _0x2650b8['body']['id'];}return db[_0xc099('0x3d')][_0xc099('0x59')]({'where':{'id':_0x2650b8[_0xc099('0x5b')]['id']}})[_0xc099('0x33')](handleEntityNotFound(_0x8c34cc,null))[_0xc099('0x33')](function(_0x1d0dd9){if(_0x1d0dd9){_0x2650b8[_0xc099('0x55')][_0xc099('0x5e')]=_0x1d0dd9['id'];return db['Disposition']['create'](_0x2650b8[_0xc099('0x55')]);}})[_0xc099('0x33')](respondWithResult(_0x8c34cc,null))['catch'](handleError(_0x8c34cc,null));};exports[_0xc099('0x5f')]=function(_0x3196a4,_0x20e6b4,_0x573fd8){var _0x3a819e={'raw':![],'where':{}};var _0x285c2f={};var _0xc1990d={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xc099('0x60')]({'where':{'id':_0x3196a4[_0xc099('0x5b')]['id']}})[_0xc099('0x33')](handleEntityNotFound(_0x20e6b4,null))[_0xc099('0x33')](function(_0x43a41f){if(_0x43a41f){_0x285c2f[_0xc099('0x42')]=_['keys'](db[_0xc099('0x61')][_0xc099('0x62')]);_0x285c2f['query']=_[_0xc099('0x52')](_0x3196a4[_0xc099('0x40')]);_0x285c2f[_0xc099('0x41')]=_[_0xc099('0x53')](_0x285c2f[_0xc099('0x42')],_0x285c2f['query']);_0x3a819e['attributes']=_[_0xc099('0x53')](_0x285c2f[_0xc099('0x42')],qs[_0xc099('0x44')](_0x3196a4['query'][_0xc099('0x44')]));_0x3a819e[_0xc099('0x43')]=_0x3a819e['attributes'][_0xc099('0x45')]?_0x3a819e['attributes']:_0x285c2f[_0xc099('0x42')];if(!_0x3196a4[_0xc099('0x40')]['hasOwnProperty'](_0xc099('0x46'))){_0x3a819e[_0xc099('0x2b')]=qs[_0xc099('0x2b')](_0x3196a4[_0xc099('0x40')][_0xc099('0x2b')]);_0x3a819e[_0xc099('0x2a')]=qs[_0xc099('0x2a')](_0x3196a4[_0xc099('0x40')][_0xc099('0x2a')]);}_0x3a819e[_0xc099('0x47')]=qs[_0xc099('0x48')](_0x3196a4[_0xc099('0x40')][_0xc099('0x48')]);_0x3a819e['where']=qs[_0xc099('0x41')](_['pick'](_0x3196a4[_0xc099('0x40')],_0x285c2f['filters']));_0x3a819e[_0xc099('0x49')][_0xc099('0x5e')]=_0x43a41f['id'];if(_0x3196a4['query']['filter']){_0x3a819e[_0xc099('0x49')]=_[_0xc099('0x4c')](_0x3a819e[_0xc099('0x49')],{'$or':_[_0xc099('0x3c')](_0x3a819e[_0xc099('0x43')],function(_0x153d35){var _0x4e682f={};_0x4e682f[_0x153d35]={'$like':'%'+_0x3196a4[_0xc099('0x40')][_0xc099('0x4a')]+'%'};return _0x4e682f;})});}_0x3a819e=_[_0xc099('0x4c')]({},_0x3a819e,_0x3196a4['options']);return db['Disposition'][_0xc099('0x29')]({'where':_0x3a819e['where']})[_0xc099('0x33')](function(_0x2761d3){_0xc1990d[_0xc099('0x29')]=_0x2761d3;if(_0x3196a4[_0xc099('0x40')][_0xc099('0x4d')]){_0x3a819e[_0xc099('0x4e')]=[{'all':!![]}];}return db[_0xc099('0x61')][_0xc099('0x4f')](_0x3a819e);})[_0xc099('0x33')](function(_0x4bb236){_0xc1990d[_0xc099('0x50')]=_0x4bb236;return _0xc1990d;});}})['then'](respondWithFilteredResult(_0x20e6b4,_0x3a819e))['catch'](handleError(_0x20e6b4,null));};exports['removeDispositions']=function(_0x1cbf73,_0x5d7629,_0x50cd89){return db[_0xc099('0x3d')]['find']({'where':{'id':_0x1cbf73[_0xc099('0x5b')]['id']}})[_0xc099('0x33')](handleEntityNotFound(_0x5d7629,null))[_0xc099('0x33')](function(_0x4d40c8){if(_0x4d40c8){return _0x4d40c8[_0xc099('0x63')](_0x1cbf73[_0xc099('0x40')][_0xc099('0x64')]);}})[_0xc099('0x33')](respondWithStatusCode(_0x5d7629,null))[_0xc099('0x25')](handleError(_0x5d7629,null));};exports[_0xc099('0x65')]=function(_0x3e4577,_0x288f15,_0x5c24e7){if(_0x3e4577[_0xc099('0x55')]['id']){delete _0x3e4577['body']['id'];}return db[_0xc099('0x3d')]['find']({'where':{'id':_0x3e4577['params']['id']}})[_0xc099('0x33')](handleEntityNotFound(_0x288f15,null))[_0xc099('0x33')](function(_0x5cb67b){if(_0x5cb67b){_0x3e4577[_0xc099('0x55')][_0xc099('0x5e')]=_0x5cb67b['id'];return db[_0xc099('0x66')]['create'](_0x3e4577[_0xc099('0x55')]);}})[_0xc099('0x33')](respondWithResult(_0x288f15,null))[_0xc099('0x25')](handleError(_0x288f15,null));};exports['getAnswers']=function(_0x5deb90,_0x38b271,_0x3b5069){var _0xa301e8={'raw':![],'where':{}};var _0x2f81a9={};var _0x575d0d={'count':0x0,'rows':[]};return db[_0xc099('0x3d')][_0xc099('0x60')]({'where':{'id':_0x5deb90[_0xc099('0x5b')]['id']}})[_0xc099('0x33')](handleEntityNotFound(_0x38b271,null))[_0xc099('0x33')](function(_0x17ae3d){if(_0x17ae3d){_0x2f81a9[_0xc099('0x42')]=_[_0xc099('0x52')](db['CannedAnswer']['rawAttributes']);_0x2f81a9['query']=_[_0xc099('0x52')](_0x5deb90[_0xc099('0x40')]);_0x2f81a9['filters']=_[_0xc099('0x53')](_0x2f81a9[_0xc099('0x42')],_0x2f81a9[_0xc099('0x40')]);_0xa301e8[_0xc099('0x43')]=_[_0xc099('0x53')](_0x2f81a9[_0xc099('0x42')],qs[_0xc099('0x44')](_0x5deb90[_0xc099('0x40')]['fields']));_0xa301e8[_0xc099('0x43')]=_0xa301e8[_0xc099('0x43')][_0xc099('0x45')]?_0xa301e8[_0xc099('0x43')]:_0x2f81a9[_0xc099('0x42')];if(!_0x5deb90['query']['hasOwnProperty'](_0xc099('0x46'))){_0xa301e8['limit']=qs[_0xc099('0x2b')](_0x5deb90['query'][_0xc099('0x2b')]);_0xa301e8[_0xc099('0x2a')]=qs['offset'](_0x5deb90[_0xc099('0x40')][_0xc099('0x2a')]);}_0xa301e8[_0xc099('0x47')]=qs[_0xc099('0x48')](_0x5deb90[_0xc099('0x40')]['sort']);_0xa301e8['where']=qs[_0xc099('0x41')](_[_0xc099('0x67')](_0x5deb90[_0xc099('0x40')],_0x2f81a9['filters']));_0xa301e8[_0xc099('0x49')][_0xc099('0x5e')]=_0x17ae3d['id'];if(_0x5deb90[_0xc099('0x40')]['filter']){_0xa301e8[_0xc099('0x49')]=_['merge'](_0xa301e8[_0xc099('0x49')],{'$or':_['map'](_0xa301e8[_0xc099('0x43')],function(_0x439f16){var _0x545e4b={};_0x545e4b[_0x439f16]={'$like':'%'+_0x5deb90[_0xc099('0x40')]['filter']+'%'};return _0x545e4b;})});}_0xa301e8=_[_0xc099('0x4c')]({},_0xa301e8,_0x5deb90['options']);return db[_0xc099('0x66')]['count']({'where':_0xa301e8[_0xc099('0x49')]})['then'](function(_0x5020d2){_0x575d0d[_0xc099('0x29')]=_0x5020d2;if(_0x5deb90[_0xc099('0x40')][_0xc099('0x4d')]){_0xa301e8[_0xc099('0x4e')]=[{'all':!![]}];}return db[_0xc099('0x66')]['findAll'](_0xa301e8);})[_0xc099('0x33')](function(_0xb719de){_0x575d0d['rows']=_0xb719de;return _0x575d0d;});}})['then'](respondWithFilteredResult(_0x38b271,_0xa301e8))['catch'](handleError(_0x38b271,null));};exports[_0xc099('0x68')]=function(_0x4e0cbd,_0x26e933,_0xe6c4df){return db['ChatWebsite'][_0xc099('0x59')]({'where':{'id':_0x4e0cbd[_0xc099('0x5b')]['id']}})[_0xc099('0x33')](handleEntityNotFound(_0x26e933,null))[_0xc099('0x33')](function(_0x4b7488){if(_0x4b7488){return _0x4b7488['removeAnswers'](_0x4e0cbd[_0xc099('0x40')]['ids']);}})[_0xc099('0x33')](respondWithStatusCode(_0x26e933,null))[_0xc099('0x25')](handleError(_0x26e933,null));};exports[_0xc099('0x69')]=function(_0x4a463e,_0x383d61,_0x57a60f){_0x4a463e[_0xc099('0x55')][_0xc099('0x6a')]=_0x4a463e['file'][_0xc099('0x6b')];return db['ChatWebsite'][_0xc099('0x59')]({'where':{'id':_0x4a463e[_0xc099('0x5b')]['id']}})['then'](handleEntityNotFound(_0x383d61,null))[_0xc099('0x33')](saveUpdates(_0x4a463e['body'],null))[_0xc099('0x33')](respondWithResult(_0x383d61,null))[_0xc099('0x25')](handleError(_0x383d61,null));};exports[_0xc099('0x6c')]=function(_0x25ce7a,_0x1ae4b6,_0x28651a){_0x25ce7a[_0xc099('0x55')][_0xc099('0x6d')]=_0x25ce7a[_0xc099('0x6e')][_0xc099('0x6b')];return db[_0xc099('0x3d')][_0xc099('0x59')]({'where':{'id':_0x25ce7a[_0xc099('0x5b')]['id']}})[_0xc099('0x33')](handleEntityNotFound(_0x1ae4b6,null))[_0xc099('0x33')](saveUpdates(_0x25ce7a['body'],null))[_0xc099('0x33')](respondWithResult(_0x1ae4b6,null))[_0xc099('0x25')](handleError(_0x1ae4b6,null));};exports[_0xc099('0x6f')]=function(_0x465617,_0x30b1c7,_0x27eae1){_0x465617[_0xc099('0x55')]['customerAvatar']=_0x465617['file'][_0xc099('0x6b')];return db[_0xc099('0x3d')][_0xc099('0x59')]({'where':{'id':_0x465617[_0xc099('0x5b')]['id']}})[_0xc099('0x33')](handleEntityNotFound(_0x30b1c7,null))[_0xc099('0x33')](saveUpdates(_0x465617[_0xc099('0x55')],null))['then'](respondWithResult(_0x30b1c7,null))[_0xc099('0x25')](handleError(_0x30b1c7,null));};exports[_0xc099('0x70')]=function(_0x4f07f9,_0xc38076,_0x301ede){_0x4f07f9['body'][_0xc099('0x71')]=_0x4f07f9['file'][_0xc099('0x6b')];return db['ChatWebsite'][_0xc099('0x59')]({'where':{'id':_0x4f07f9[_0xc099('0x5b')]['id']}})[_0xc099('0x33')](handleEntityNotFound(_0xc38076,null))[_0xc099('0x33')](saveUpdates(_0x4f07f9[_0xc099('0x55')],null))[_0xc099('0x33')](respondWithResult(_0xc38076,null))['catch'](handleError(_0xc38076,null));};exports[_0xc099('0x72')]=function(_0x1cef9e,_0x291fc8,_0xad830a){var _0x1321ac=path[_0xc099('0x73')](config[_0xc099('0x74')],'server/files/images/logos/default_logo.png');var _0x3bdb00={'where':{'id':_0x1cef9e['params']['id']},'attributes':['id',_0xc099('0x6a')],'raw':!![]};var _0x46f8b9=![];return require(_0xc099('0x75'))[_0xc099('0x76')]()[_0xc099('0x33')](function(_0x1047fb){if(_0x1047fb){_0x46f8b9=_0x1047fb[_0xc099('0x77')];}})[_0xc099('0x33')](function(){return db[_0xc099('0x3d')][_0xc099('0x59')](_0x3bdb00);})[_0xc099('0x33')](handleEntityNotFound(_0x291fc8,null))[_0xc099('0x33')](function(_0x16190f){if(_0x16190f){if(!_[_0xc099('0x78')](_0x16190f[_0xc099('0x6a')])){if(fs[_0xc099('0x79')](path[_0xc099('0x73')](config[_0xc099('0x74')],'server/files/images/logos/',_0x16190f['sitepic']))&&_0x46f8b9){_0x1321ac=path[_0xc099('0x73')](config[_0xc099('0x74')],_0xc099('0x7a'),_0x16190f[_0xc099('0x6a')]);}}return _0x291fc8[_0xc099('0x7b')](_0x1321ac);}})[_0xc099('0x25')](handleError(_0x291fc8,null));};exports[_0xc099('0x7c')]=function(_0x3a3e05,_0x140656,_0x1d9006){var _0x373e24=path[_0xc099('0x73')](config[_0xc099('0x74')],_0xc099('0x7d'));var _0x31aaf1={'where':{'id':_0x3a3e05[_0xc099('0x5b')]['id']},'attributes':['id',_0xc099('0x6d')],'raw':!![]};return db[_0xc099('0x3d')][_0xc099('0x59')](_0x31aaf1)[_0xc099('0x33')](handleEntityNotFound(_0x140656,null))[_0xc099('0x33')](function(_0x12717b){if(_0x12717b){if(!_[_0xc099('0x78')](_0x12717b['agentAvatar'])){if(fs[_0xc099('0x79')](path['join'](config[_0xc099('0x74')],_0xc099('0x7e'),_0x12717b[_0xc099('0x6d')]))){_0x373e24=path[_0xc099('0x73')](config[_0xc099('0x74')],_0xc099('0x7e'),_0x12717b[_0xc099('0x6d')]);}}return _0x140656['download'](_0x373e24);}})[_0xc099('0x25')](handleError(_0x140656,null));};exports[_0xc099('0x7f')]=function(_0x1c3adf,_0x21461b,_0x505dc7){var _0x2e77d8=path[_0xc099('0x73')](config[_0xc099('0x74')],_0xc099('0x80'));var _0x451ae9={'where':{'id':_0x1c3adf['params']['id']},'attributes':['id',_0xc099('0x81'),'showCustomerAvatar'],'raw':!![]};return db[_0xc099('0x3d')]['find'](_0x451ae9)[_0xc099('0x33')](handleEntityNotFound(_0x21461b,null))['then'](function(_0x1c8d64){if(_0x1c8d64){if(!_[_0xc099('0x78')](_0x1c8d64['customerAvatar'])){if(fs['existsSync'](path['join'](config[_0xc099('0x74')],_0xc099('0x7e'),_0x1c8d64['customerAvatar']))&&_0x1c8d64['showCustomerAvatar']){_0x2e77d8=path[_0xc099('0x73')](config[_0xc099('0x74')],'server/files/images/avatars/',_0x1c8d64['customerAvatar']);}}return _0x21461b[_0xc099('0x7b')](_0x2e77d8);}})['catch'](handleError(_0x21461b,null));};exports[_0xc099('0x82')]=function(_0x2f4782,_0xb732c8,_0x27edcc){var _0x1a72b3=path[_0xc099('0x73')](config[_0xc099('0x74')],_0xc099('0x83'));var _0x3b43b9={'where':{'id':_0x2f4782[_0xc099('0x5b')]['id']},'attributes':['id',_0xc099('0x71')],'raw':!![]};return db[_0xc099('0x3d')][_0xc099('0x59')](_0x3b43b9)[_0xc099('0x33')](handleEntityNotFound(_0xb732c8,null))['then'](function(_0x4ff1a4){if(_0x4ff1a4){if(!_[_0xc099('0x78')](_0x4ff1a4[_0xc099('0x71')])){if(fs[_0xc099('0x79')](path[_0xc099('0x73')](config[_0xc099('0x74')],'server/files/images/avatars/',_0x4ff1a4['systemAvatar']))){_0x1a72b3=path[_0xc099('0x73')](config[_0xc099('0x74')],_0xc099('0x7e'),_0x4ff1a4[_0xc099('0x71')]);}}return _0xb732c8['download'](_0x1a72b3);}})['catch'](handleError(_0xb732c8,null));};exports['notify']=function(_0x2c2a92,_0x12b9ca,_0x432f26){var _0x26fd4d=require('user-agent-parser');var _0x1a0bc0=new _0x26fd4d();var _0x48fa72=_0x1a0bc0['setUA'](_0x2c2a92[_0xc099('0x84')][_0xc099('0x85')])[_0xc099('0x86')]();var _0x49a482={'body':_0x2c2a92[_0xc099('0x55')],'channel':_0xc099('0x87')};var _0x1e8d15=[];var _0x1f9d34=[];var _0x4bb03f={};var _0x21c7c5=![];return db['CmContact'][_0xc099('0x5c')]()[_0xc099('0x33')](function(_0x754d00){if(!_0x754d00){throw new db['Sequelize'][(_0xc099('0x1c'))](_0xc099('0x88'));}_0x1e8d15=_[_0xc099('0x89')](_[_0xc099('0x52')](_0x754d00),[_0xc099('0x8a'),_0xc099('0x8b')]);_0x1f9d34=_[_0xc099('0x89')](_[_0xc099('0x52')](_0x754d00),[_0xc099('0x8a'),_0xc099('0x8b'),'CompanyId','ListId']);if(_0x2c2a92[_0xc099('0x55')]['id']){delete _0x2c2a92[_0xc099('0x55')]['id'];}if(_[_0xc099('0x78')](_0x2c2a92['body']['from'])){throw new db[(_0xc099('0x1b'))][(_0xc099('0x1c'))](_0xc099('0x8c'));}if(_['isNil'](_0x2c2a92[_0xc099('0x55')]['body'])||_0x2c2a92[_0xc099('0x55')][_0xc099('0x55')]===''){throw new db[(_0xc099('0x1b'))][(_0xc099('0x1c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc099('0x78')](_0x2c2a92['body']['mapKey'])){throw new db['Sequelize'][(_0xc099('0x1c'))](_0xc099('0x8d')+_0x1f9d34);}if(!_['includes'](_0x1f9d34,_0x2c2a92['body'][_0xc099('0x8e')])){throw new db[(_0xc099('0x1b'))][(_0xc099('0x1c'))](_0xc099('0x8f')+_0x1f9d34);}_0x4bb03f[_0x2c2a92[_0xc099('0x55')]['mapKey']]=_0x2c2a92[_0xc099('0x55')][_0xc099('0x90')];})['then'](function(){return db[_0xc099('0x3d')]['find']({'where':{'id':_0x2c2a92[_0xc099('0x5b')]['id']},'include':[{'model':db[_0xc099('0x91')],'as':'List','include':[{'model':db[_0xc099('0x92')],'as':_0xc099('0x93'),'where':_0x4bb03f,'limit':0x1,'order':[['updatedAt',_0xc099('0x94')]]}]},{'model':db[_0xc099('0x95')],'as':_0xc099('0x96')}]});})[_0xc099('0x33')](handleEntityNotFound(_0x12b9ca,null))['then'](function(_0x3db37f){if(_0x3db37f&&_0x3db37f['List']){_0x49a482[_0xc099('0x97')]=_0x3db37f;_0x49a482[_0xc099('0x98')]=_0x3db37f[_0xc099('0x96')];_0x49a482[_0xc099('0x99')]=_0x3db37f['List'];_0x49a482[_0xc099('0x98')]=_[_0xc099('0x9a')](_0x49a482['applications'],[_0xc099('0x9b')],[_0xc099('0x9c')]);if(_0x49a482[_0xc099('0x97')][_0xc099('0x96')]){delete _0x49a482['account'][_0xc099('0x96')];}if(_0x49a482['account'][_0xc099('0x9d')]&&_0x49a482[_0xc099('0x97')][_0xc099('0x9d')][_0xc099('0x93')][_0xc099('0x45')]){return _0x49a482[_0xc099('0x97')][_0xc099('0x9d')][_0xc099('0x93')][0x0];}var _0x490a51=_['defaults'](_0x2c2a92[_0xc099('0x55')],{'firstName':_0x2c2a92[_0xc099('0x55')]['from'],'ListId':_0x3db37f[_0xc099('0x9e')]});_0x490a51[_0x2c2a92[_0xc099('0x55')][_0xc099('0x8e')]]=_0x2c2a92[_0xc099('0x55')][_0xc099('0x90')];return db[_0xc099('0x92')][_0xc099('0x54')](_0x490a51,{'fields':_0x1e8d15,'raw':!![]});}})[_0xc099('0x33')](handleEntityNotFound(_0x12b9ca,null))[_0xc099('0x33')](function(_0x5debdb){_0x49a482[_0xc099('0x9f')]=_0x5debdb;var _0x4dc723=_0x2c2a92[_0xc099('0x55')][_0xc099('0xa0')];if(_0x2c2a92[_0xc099('0x84')]['cf-connecting-ip']){_0x4dc723=_0x2c2a92[_0xc099('0x84')]['cf-connecting-ip'];}else if(_0x2c2a92[_0xc099('0x84')][_0xc099('0xa1')]){_0x4dc723=_[_0xc099('0xa2')](_0x2c2a92[_0xc099('0x84')][_0xc099('0xa1')]['split'](','));}if(_0x5debdb){var _0x45ee2c={'ContactId':_0x5debdb['id'],'ChatWebsiteId':_0x2c2a92[_0xc099('0x5b')]['id'],'from':(_0x5debdb[_0xc099('0xa3')]||'')+'\x20'+(_0x5debdb[_0xc099('0xa4')]||''),'customerIp':_0x4dc723,'customerPort':_0x2c2a92[_0xc099('0x84')][_0xc099('0xa5')]?_0x2c2a92[_0xc099('0x84')][_0xc099('0xa5')]:null,'referer':_0x2c2a92['body'][_0xc099('0xa6')],'browserName':_0x48fa72[_0xc099('0xa7')]['name']&&_0x48fa72[_0xc099('0xa7')][_0xc099('0xa8')]?util['format'](_0xc099('0xa9'),_0x48fa72['browser'][_0xc099('0x37')],_0x48fa72[_0xc099('0xa7')][_0xc099('0xa8')]):_0xc099('0xaa'),'browserVersion':_0x48fa72[_0xc099('0xa7')][_0xc099('0xa8')]||'unknown','osName':util[_0xc099('0xab')](_0xc099('0xa9'),_0x48fa72['os']['name'],_0x48fa72['os'][_0xc099('0xa8')]),'osVersion':_0x48fa72['os'][_0xc099('0xa8')],'deviceModel':_0x48fa72[_0xc099('0xac')]['model']&&_0x48fa72[_0xc099('0xac')][_0xc099('0xad')]?util['format'](_0xc099('0xae'),_0x48fa72['device']['model'],_0x48fa72[_0xc099('0xac')][_0xc099('0xad')],_0x48fa72[_0xc099('0xac')][_0xc099('0x3e')]):null,'deviceVendor':_0x48fa72['device'][_0xc099('0xad')],'deviceType':_0x48fa72[_0xc099('0xac')][_0xc099('0x3e')],'formData':JSON[_0xc099('0x20')](_0x2c2a92[_0xc099('0x55')])};var _0xf497e0={'ChatWebsiteId':_0x2c2a92[_0xc099('0x5b')]['id'],'closed':![]};if(_0x2c2a92[_0xc099('0x55')][_0xc099('0xaf')]){_0xf497e0[_0xc099('0xaf')]=_0x2c2a92[_0xc099('0x55')]['threadId'];return db[_0xc099('0xb0')][_0xc099('0x59')]({'where':_0xf497e0})[_0xc099('0x33')](function(_0x47ab82){if(_0x47ab82){return[_0x47ab82,![]];}_0x45ee2c[_0xc099('0xaf')]=_0x2c2a92[_0xc099('0x55')][_0xc099('0xaf')];_0x45ee2c['externalUrl']=_0x2c2a92[_0xc099('0x55')]['externalUrl'];return db[_0xc099('0xb0')]['create'](_0x45ee2c)[_0xc099('0x33')](function(_0x36704c){return[_0x36704c,!![]];});});}_0xf497e0['ContactId']=_0x5debdb['id'];if(_0x2c2a92[_0xc099('0x55')][_0xc099('0xb1')]&&_0x2c2a92[_0xc099('0x55')][_0xc099('0xb1')]['id']){_0xf497e0['id']=_0x2c2a92[_0xc099('0x55')]['interaction']['id'];return db['ChatInteraction']['find']({'where':_0xf497e0})[_0xc099('0x33')](function(_0x47276f){if(_0x47276f){return[_0x47276f,![]];}return db[_0xc099('0xb0')][_0xc099('0x54')](_0x45ee2c)[_0xc099('0x33')](function(_0x88f339){return[_0x88f339,!![]];});});}return db[_0xc099('0xb0')][_0xc099('0x54')](_0x45ee2c)['then'](function(_0x25b1d7){return[_0x25b1d7,!![]];});}})[_0xc099('0xb2')](function(_0x49bca6,_0xd43f74){if(_0x49bca6){_0x21c7c5=_0xd43f74;if(!_0xd43f74){var _0x1c7490={'from':(_0x49a482[_0xc099('0x9f')]['firstName']||'')+'\x20'+(_0x49a482[_0xc099('0x9f')]['lastName']||'')};if(_0x2c2a92[_0xc099('0x55')][_0xc099('0xaf')]&&_0x2c2a92[_0xc099('0x55')][_0xc099('0xb3')]&&_0x2c2a92['body']['threadId']!=_0x2c2a92[_0xc099('0x55')][_0xc099('0xb3')]){_0x1c7490[_0xc099('0xaf')]=_0x2c2a92['body']['messageId'];}return _0x49bca6[_0xc099('0x31')](_0x1c7490);}else{return _0x49bca6;}}})[_0xc099('0x33')](function(_0x2921f2){_0x49a482[_0xc099('0xb1')]=_0x2921f2[_0xc099('0x34')]({'plain':!![]});_0x49a482[_0xc099('0xb1')]['created']=_0x21c7c5;if(_0x49a482['interaction'][_0xc099('0xb4')]){if(_0x49a482[_0xc099('0x97')][_0xc099('0xb5')]){_0x49a482[_0xc099('0x98')]['push']({'id':0x0,'priority':_0x49a482[_0xc099('0x98')]['length']+0x1,'app':_0xc099('0xb6'),'appdata':'unmanaged','interval':_0xc099('0xb7')});}}return db[_0xc099('0xb8')]['create']({'body':_0x2c2a92[_0xc099('0x55')][_0xc099('0x55')],'ChatWebsiteId':_0x2c2a92[_0xc099('0x5b')]['id'],'ChatInteractionId':_0x2921f2['id'],'direction':'in','ContactId':_0x49a482[_0xc099('0x9f')]['id'],'AttachmentId':_0x2c2a92['body'][_0xc099('0xb9')]});})[_0xc099('0x33')](function(_0x96e156){_0x49a482[_0xc099('0x23')]=_0x96e156;if(_0x49a482[_0xc099('0xb1')][_0xc099('0xba')]){return db[_0xc099('0xbb')][_0xc099('0x59')]({'attributes':['id',_0xc099('0x37')],'where':{'id':_0x49a482[_0xc099('0xb1')][_0xc099('0xba')]}})[_0xc099('0x33')](function(_0x4dba41){if(_0x4dba41){_0x49a482[_0xc099('0x98')][_0xc099('0xbc')]({'id':0x0,'priority':0x0,'app':_0xc099('0xbd'),'appdata':_0x4dba41[_0xc099('0x37')]+','+(_0x49a482['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x49a482[_0xc099('0xbe')]=!![];}return respondWithRpcPromise(_0xc099('0xbf'),'startRouting',_0x49a482);});}return respondWithRpcPromise('Start','startRouting',_0x49a482);})['then'](function(_0xf25ff9){respondWithRpcPromise(_0xc099('0xc0'),'EventManager',{'event':_0xc099('0xc1'),'message':_0xf25ff9},client9002);return _0xf25ff9;})[_0xc099('0x33')](respondWithResult(_0x12b9ca,null))[_0xc099('0x25')](handleError(_0x12b9ca,null));};exports[_0xc099('0xc2')]=function(_0x12ea0d,_0x4b90e0,_0x12d10a){var _0x2ff79f,_0x225739,_0x2f55b3;var _0x2bccca=[];var _0x231dab=[];var _0x60584c={};return db[_0xc099('0x92')][_0xc099('0x5c')]()[_0xc099('0x33')](function(_0x10072a){if(!_0x10072a){throw new db[(_0xc099('0x1b'))][(_0xc099('0x1c'))]('no\x20available\x20attributes');}_0x231dab=_['difference'](_['keys'](_0x10072a),[_0xc099('0x8a'),_0xc099('0x8b')]);_0x2bccca=_[_0xc099('0x89')](_['keys'](_0x10072a),[_0xc099('0x8a'),'updatedAt','CompanyId',_0xc099('0x9e')]);if(_0x12ea0d[_0xc099('0x55')]['id']){delete _0x12ea0d['body']['id'];}if(_['isNil'](_0x12ea0d['body'][_0xc099('0x90')])){throw _0x4b90e0[_0xc099('0x27')](0x1f4)[_0xc099('0x38')](new db[(_0xc099('0x1b'))]['ValidationError'](_0xc099('0x8c')));}if(_[_0xc099('0x78')](_0x12ea0d['body']['body'])||_0x12ea0d[_0xc099('0x55')][_0xc099('0x55')]===''){throw _0x4b90e0[_0xc099('0x27')](0x1f4)[_0xc099('0x38')](new db['Sequelize']['ValidationError'](_0xc099('0xc3')));}if(_[_0xc099('0x78')](_0x12ea0d[_0xc099('0x55')][_0xc099('0xc4')])){throw _0x4b90e0[_0xc099('0x27')](0x1f4)[_0xc099('0x38')](new db[(_0xc099('0x1b'))][(_0xc099('0x1c'))](_0xc099('0xc5')+_0x2bccca));}if(!_['includes'](_0x2bccca,_0x12ea0d[_0xc099('0x55')][_0xc099('0xc4')])){throw _0x4b90e0[_0xc099('0x27')](0x1f4)[_0xc099('0x38')](new db[(_0xc099('0x1b'))][(_0xc099('0x1c'))](_0xc099('0xc6')+_0x2bccca));}_0x60584c[_0x12ea0d[_0xc099('0x55')][_0xc099('0xc4')]]=_0x12ea0d[_0xc099('0x55')][_0xc099('0x90')];})[_0xc099('0x33')](function(){return db[_0xc099('0x3d')][_0xc099('0x59')]({'where':{'id':_0x12ea0d[_0xc099('0x5b')]['id']},'include':[{'model':db[_0xc099('0x91')],'as':_0xc099('0x9d')}]});})['then'](handleEntityNotFound(_0x4b90e0,null))[_0xc099('0x33')](function(_0x2fffdd){if(_0x2fffdd&&_0x2fffdd['List']){_0x225739=_0x2fffdd;var _0x4487fc=_[_0xc099('0x14')](_0x12ea0d[_0xc099('0x55')],{'firstName':_0x12ea0d[_0xc099('0x55')]['from'],'phone':_0x12ea0d['body'][_0xc099('0x90')],'ListId':_0x2fffdd[_0xc099('0x9e')]});_0x4487fc[_0x12ea0d[_0xc099('0x55')][_0xc099('0xc4')]]=_0x12ea0d[_0xc099('0x55')][_0xc099('0x90')];return db[_0xc099('0x92')]['findOrCreate']({'where':_0x60584c,'defaults':_0x4487fc});}})[_0xc099('0xb2')](function(_0x23e322){if(_0x23e322){_0x2f55b3=_0x23e322;var _0x536802=fs[_0xc099('0xc7')](path[_0xc099('0x73')](config[_0xc099('0x74')],_0xc099('0xc8')),'utf8');var _0x20acaa=ejs['render'](_0x536802,{'body':_[_0xc099('0xc9')](_0x12ea0d[_0xc099('0x55')][_0xc099('0x55')]),'bodyTitle':_0x225739[_0xc099('0xca')]});return db[_0xc099('0xcb')]['create']({'body':_0x20acaa,'ContactId':_0x23e322['id'],'ChatWebsiteId':_0x225739['id']});}})[_0xc099('0x33')](function(_0x3bcfde){if(_0x3bcfde){_0x2ff79f=_0x3bcfde;return db['MailAccount'][_0xc099('0x60')]({'where':{'service':!![]},'include':[{'model':db[_0xc099('0xcc')],'as':_0xc099('0xcd'),'raw':!![]}]});}})[_0xc099('0x33')](function(_0x55807f){if(_0x55807f&&_0x55807f['Smtp']&&_0x225739[_0xc099('0xce')]){var _0x5011a4={'tls':{'rejectUnauthorized':![]}};if(_0x55807f[_0xc099('0xcd')]['service']){_0x5011a4[_0xc099('0xcf')]=_0x55807f[_0xc099('0xcd')][_0xc099('0xcf')];}else{_0x5011a4[_0xc099('0xd0')]=_0x55807f[_0xc099('0xcd')][_0xc099('0xd0')];_0x5011a4[_0xc099('0xd1')]=_0x55807f[_0xc099('0xcd')][_0xc099('0xd1')];_0x5011a4[_0xc099('0xd2')]=_0x55807f[_0xc099('0xcd')][_0xc099('0xd2')];}if(_0x55807f[_0xc099('0xcd')]['authentication']){_0x5011a4[_0xc099('0xd3')]={'user':_0x55807f['Smtp'][_0xc099('0x57')],'pass':_0x55807f[_0xc099('0xcd')][_0xc099('0xd4')]};}return respondWithRpcPromise(_0xc099('0xd5'),_0xc099('0xd6'),{'account':_0x5011a4,'message':{'from':util[_0xc099('0xab')](_0xc099('0xd7'),_0x55807f[_0xc099('0x37')],_0x55807f['email']||_0x55807f[_0xc099('0xcd')][_0xc099('0x57')]),'to':_0x225739[_0xc099('0xce')],'subject':_0x225739[_0xc099('0xd8')],'text':_0x2ff79f[_0xc099('0x55')]}},client9003)[_0xc099('0x33')](function(){return _0x2ff79f;})['catch'](function(_0x3c4c94){console[_0xc099('0x21')](_0x3c4c94);});}})[_0xc099('0x33')](function(){if(_0x2ff79f){return _0x2ff79f;}})[_0xc099('0x33')](respondWithResult(_0x4b90e0,null))[_0xc099('0x25')](handleError(_0x4b90e0,null));};exports['addInteraction']=function(_0x5b4c5b,_0x4468fa,_0xe9b3bf){return db[_0xc099('0xb0')][_0xc099('0x59')]({'where':{'id':_0x5b4c5b[_0xc099('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4468fa,null))[_0xc099('0x33')](function(_0x54034d){if(_0x54034d){return _0x54034d[_0xc099('0xd9')](_0x5b4c5b[_0xc099('0x55')]['ids'],_[_0xc099('0xda')](_0x5b4c5b['body'],['ids','id'])||{});}})[_0xc099('0x33')](respondWithResult(_0x4468fa,null))[_0xc099('0x25')](handleError(_0x4468fa,null));};exports[_0xc099('0xdb')]=function(_0x172663,_0xba3cf0,_0x4cfb05){var _0x2f8909={'raw':![],'where':{}};var _0x50c3e7={};var _0xfdb79d={'count':0x0,'rows':[]};return db[_0xc099('0x3d')][_0xc099('0x60')]({'where':{'id':_0x172663[_0xc099('0x5b')]['id']}})['then'](handleEntityNotFound(_0xba3cf0,null))[_0xc099('0x33')](function(_0x4d7bd2){if(_0x4d7bd2){_0x50c3e7[_0xc099('0x42')]=_[_0xc099('0x52')](db[_0xc099('0xb0')]['rawAttributes']);_0x50c3e7[_0xc099('0x40')]=_[_0xc099('0x52')](_0x172663[_0xc099('0x40')]);_0x50c3e7[_0xc099('0x41')]=_['intersection'](_0x50c3e7['model'],_0x50c3e7[_0xc099('0x40')]);_0x2f8909[_0xc099('0x43')]=_['intersection'](_0x50c3e7['model'],qs[_0xc099('0x44')](_0x172663[_0xc099('0x40')][_0xc099('0x44')]));_0x2f8909[_0xc099('0x43')]=_0x2f8909[_0xc099('0x43')][_0xc099('0x45')]?_0x2f8909['attributes']:_0x50c3e7[_0xc099('0x42')];if(!_0x172663[_0xc099('0x40')]['hasOwnProperty']('nolimit')){_0x2f8909[_0xc099('0x2b')]=qs['limit'](_0x172663[_0xc099('0x40')]['limit']);_0x2f8909[_0xc099('0x2a')]=qs[_0xc099('0x2a')](_0x172663[_0xc099('0x40')][_0xc099('0x2a')]);}_0x2f8909[_0xc099('0x47')]=qs[_0xc099('0x48')](_0x172663[_0xc099('0x40')][_0xc099('0x48')]);_0x2f8909[_0xc099('0x49')]=qs[_0xc099('0x41')](_['pick'](_0x172663[_0xc099('0x40')],_0x50c3e7[_0xc099('0x41')]));_0x2f8909[_0xc099('0x49')][_0xc099('0x5e')]=_0x4d7bd2['id'];if(_0x172663[_0xc099('0x40')][_0xc099('0x4a')]){_0x2f8909['where']=_[_0xc099('0x4c')](_0x2f8909[_0xc099('0x49')],{'$or':_['map'](_0x2f8909[_0xc099('0x43')],function(_0xaa4f1a){var _0x450fee={};_0x450fee[_0xaa4f1a]={'$like':'%'+_0x172663[_0xc099('0x40')][_0xc099('0x4a')]+'%'};return _0x450fee;})});}_0x2f8909=_[_0xc099('0x4c')]({},_0x2f8909,_0x172663[_0xc099('0xdc')]);return db['ChatInteraction']['count']({'where':_0x2f8909['where']})[_0xc099('0x33')](function(_0x29b46b){_0xfdb79d[_0xc099('0x29')]=_0x29b46b;if(_0x172663[_0xc099('0x40')]['includeAll']){_0x2f8909[_0xc099('0x4e')]=[{'model':db[_0xc099('0x92')],'as':_0xc099('0xdd'),'required':![]},{'model':db[_0xc099('0xbb')],'as':_0xc099('0xde'),'attributes':[_0xc099('0x37'),_0xc099('0xdf'),'internal'],'required':![]},{'model':db[_0xc099('0xe0')],'as':_0xc099('0xe1'),'attributes':['id',_0xc099('0x37'),_0xc099('0xe2')],'where':_0x172663[_0xc099('0x40')][_0xc099('0xe3')]?{'id':_0x172663[_0xc099('0x40')][_0xc099('0xe3')]}:undefined,'required':_0x172663[_0xc099('0x40')][_0xc099('0xe3')]?!![]:![]}];}return db['ChatInteraction'][_0xc099('0x4f')](_0x2f8909);})['then'](function(_0x28abc6){_0xfdb79d[_0xc099('0x50')]=_0x28abc6;return _0xfdb79d;});}})[_0xc099('0x33')](respondWithFilteredResult(_0xba3cf0,_0x2f8909))['catch'](handleError(_0xba3cf0,null));};function iftimePromise(_0x50c178,_0x4c9f59){return respondWithRpcPromise(_0xc099('0xe4'),_0xc099('0xe5'),{'command':_0x4c9f59[_0xc099('0xe6')]?util[_0xc099('0xab')]('iftime\x20%s,%s',_0x50c178[_0xc099('0xe7')],_0x4c9f59['timezone']):util['format'](_0xc099('0xe8'),_0x50c178[_0xc099('0xe7')])},client9002)['then'](function(_0x13903e){var _0x587f46=_0x13903e&&_0x13903e[_0xc099('0xe9')](_0xc099('0xea'))>=0x0?!![]:![];logger[_0xc099('0x24')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x4c9f59['id'],_0x50c178['id'],_0x50c178[_0xc099('0xe7')],_0x587f46?_0xc099('0xeb'):_0xc099('0xec'),_0x4c9f59[_0xc099('0xe6')]?_0x4c9f59[_0xc099('0xe6')]:_0xc099('0xed'));return _0x587f46;})['catch'](function(_0x3dc4d7){logger['error']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x4c9f59['id'],_0x50c178['id'],_0x50c178[_0xc099('0xe7')],util[_0xc099('0xee')](_0x3dc4d7,{'showHidden':![],'depth':null}),_0x4c9f59[_0xc099('0xe6')]?_0x4c9f59[_0xc099('0xe6')]:_0xc099('0xed'));return![];});}exports[_0xc099('0xe5')]=function(_0x694fb2,_0x3a349f,_0x32d62){var _0x15c95a=0x0;var _0xa7942a=0x0;var _0x2389ea=![];var _0x2acb3f;var _0x2eeba0;return db['ChatWebsite'][_0xc099('0x59')]({'where':{'id':_0x694fb2['params']['id']},'include':[{'model':db[_0xc099('0xef')],'as':_0xc099('0xef'),'include':[{'model':db[_0xc099('0xef')],'as':_0xc099('0xf0'),'attributes':['id',_0xc099('0xe7')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3a349f,null))[_0xc099('0x33')](function(_0x9e63b){if(_0x9e63b){_0x2acb3f=_0x9e63b;return _0x9e63b[_0xc099('0xf1')]({'raw':!![]});}})[_0xc099('0x33')](function(_0x1b436e){if(_0x2acb3f){if(_0x1b436e){_0x2eeba0=_0x1b436e;}}return require(_0xc099('0x75'))[_0xc099('0x76')]();})[_0xc099('0x33')](function(_0x1d351c){if(_0x1d351c){_0xa7942a=_0x1d351c[_0xc099('0xf2')];_0x2389ea=_0x1d351c[_0xc099('0x77')];}})[_0xc099('0x33')](function(){return db[_0xc099('0xb0')][_0xc099('0x29')]({'where':{'closed':![]}});})[_0xc099('0x33')](function(_0x4a4ff6){_0x15c95a=_0x4a4ff6;if(_0xa7942a&&_0x4a4ff6>_0xa7942a){return db[_0xc099('0xf3')][_0xc099('0x60')]({'where':{'id':0x1}})[_0xc099('0x33')](function(_0x9662af){if(_0x9662af){_0x9662af['increment']('chatLicenseExceeded');}});}})[_0xc099('0x33')](function(){if(_0x2acb3f['Interval']&&_0x2acb3f[_0xc099('0xef')][_0xc099('0xf0')]){var _0x3b0349=[];for(var _0x2e38ac=0x0;_0x2e38ac<_0x2acb3f[_0xc099('0xef')][_0xc099('0xf0')][_0xc099('0x45')];_0x2e38ac++){var _0x203900=_0x2acb3f[_0xc099('0xef')][_0xc099('0xf0')][_0x2e38ac][_0xc099('0x34')]({'plain':!![]});_0x3b0349[_0xc099('0xf4')](iftimePromise(_0x203900,_0x2acb3f));}return BPromise[_0xc099('0xf5')](_0x3b0349)['then'](function(_0x4081cf){return _[_0xc099('0xf6')](_0x4081cf);});}else{return!![];}})[_0xc099('0x33')](function(_0x298469){var _0x2ffa6f=fs[_0xc099('0xc7')](path['join'](config[_0xc099('0x74')],_0xc099('0xf7')),_0xc099('0xf8'));var _0x321d87={'remote':_0x2acb3f[_0xc099('0xf9')],'query':querystring[_0xc099('0x20')](_['merge'](_0x2acb3f[_0xc099('0x34')]({'plain':!![]}),{'customerIp':_0x694fb2[_0xc099('0x84')][_0xc099('0xa1')]||_0x694fb2[_0xc099('0x84')][_0xc099('0xfa')]||_0x694fb2['connection'][_0xc099('0xfb')]||_0x694fb2['ip'],'referer':_0x694fb2[_0xc099('0x84')]['referer'],'openedInteractions':_0x15c95a,'maxInteractions':_0xa7942a,'virtual':_0x2389ea[_0xc099('0xf2')],'online':_0x298469,'custom':_0x2389ea}))['replace'](/'/g,'\x5c\x27')};_0x3a349f[_0xc099('0x38')](ejs[_0xc099('0xfc')](Mustache[_0xc099('0xfc')](_0x2ffa6f,_0x321d87),{'proactiveActions':_0x2eeba0,'alignment':_0x2acb3f['alignment'],'verticalAlignment':_0x2acb3f[_0xc099('0xfd')],'div_color':_0x2acb3f[_0xc099('0xe2')],'text_color':_0x2acb3f[_0xc099('0xfe')]}));})[_0xc099('0x25')](handleError(_0x3a349f,null));};exports['addApplications']=function(_0x5437e3,_0x39b83d,_0xdeea65){return db[_0xc099('0x3d')][_0xc099('0x60')]({'where':{'id':_0x5437e3[_0xc099('0x5b')]['id']}})[_0xc099('0x33')](handleEntityNotFound(_0x39b83d,null))[_0xc099('0x33')](function(_0x83ddc9){if(_0x83ddc9){return db[_0xc099('0xff')][_0xc099('0x100')](function(_0x469981){return db['ChatApplication'][_0xc099('0x32')]({'where':{'ChatWebsiteId':_0x5437e3[_0xc099('0x5b')]['id']},'transaction':_0x469981})[_0xc099('0x33')](function(_0xe0980b){var _0x751773=_['map'](_0x5437e3[_0xc099('0x55')],function(_0x53193e){_0x53193e[_0xc099('0x5e')]=_0x5437e3[_0xc099('0x5b')]['id'];return _0x53193e;});return db[_0xc099('0x95')][_0xc099('0x101')](_0x751773,{'transaction':_0x469981});});})['then'](function(){return db[_0xc099('0x95')][_0xc099('0x102')]({'where':{'ChatWebsiteId':_0x5437e3[_0xc099('0x5b')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x39b83d,null))[_0xc099('0x25')](handleError(_0x39b83d,null));};exports[_0xc099('0x103')]=function(_0x11fe6d,_0x21f2fc,_0x678e6e){var _0x22ba6b={};var _0x4e9c82={};var _0x209377;var _0x5dc06f;return db[_0xc099('0x3d')][_0xc099('0x60')]({'where':{'id':_0x11fe6d[_0xc099('0x5b')]['id']}})[_0xc099('0x33')](handleEntityNotFound(_0x21f2fc,null))[_0xc099('0x33')](function(_0x2d0634){if(_0x2d0634){_0x209377=_0x2d0634;_0x4e9c82[_0xc099('0x42')]=_[_0xc099('0x52')](db[_0xc099('0x95')]['rawAttributes']);_0x4e9c82['query']=_[_0xc099('0x52')](_0x11fe6d['query']);_0x4e9c82[_0xc099('0x41')]=_[_0xc099('0x53')](_0x4e9c82['model'],_0x4e9c82[_0xc099('0x40')]);_0x22ba6b[_0xc099('0x43')]=_[_0xc099('0x53')](_0x4e9c82[_0xc099('0x42')],qs['fields'](_0x11fe6d[_0xc099('0x40')]['fields']));_0x22ba6b['attributes']=_0x22ba6b[_0xc099('0x43')]['length']?_0x22ba6b['attributes']:_0x4e9c82[_0xc099('0x42')];_0x22ba6b[_0xc099('0x47')]=qs['sort'](_0x11fe6d[_0xc099('0x40')][_0xc099('0x48')]);_0x22ba6b[_0xc099('0x49')]=qs[_0xc099('0x41')](_[_0xc099('0x67')](_0x11fe6d[_0xc099('0x40')],_0x4e9c82[_0xc099('0x41')]));if(_0x11fe6d[_0xc099('0x40')][_0xc099('0x4a')]){_0x22ba6b[_0xc099('0x49')]=_[_0xc099('0x4c')](_0x22ba6b[_0xc099('0x49')],{'$or':_['map'](_0x22ba6b[_0xc099('0x43')],function(_0x52a7a3){var _0xc5e33={};_0xc5e33[_0x52a7a3]={'$like':'%'+_0x11fe6d[_0xc099('0x40')]['filter']+'%'};return _0xc5e33;})});}_0x22ba6b=_[_0xc099('0x4c')]({},_0x22ba6b,_0x11fe6d['options']);return _0x209377[_0xc099('0x103')](_0x22ba6b);}})['then'](function(_0x315980){if(_0x315980){_0x5dc06f=_0x315980[_0xc099('0x45')];if(!_0x11fe6d[_0xc099('0x40')][_0xc099('0x104')](_0xc099('0x46'))){_0x22ba6b[_0xc099('0x2b')]=qs['limit'](_0x11fe6d[_0xc099('0x40')][_0xc099('0x2b')]);_0x22ba6b[_0xc099('0x2a')]=qs[_0xc099('0x2a')](_0x11fe6d[_0xc099('0x40')][_0xc099('0x2a')]);}return _0x209377[_0xc099('0x103')](_0x22ba6b);}})[_0xc099('0x33')](function(_0x4815e4){if(_0x4815e4){return _0x4815e4?{'count':_0x5dc06f,'rows':_0x4815e4}:null;}})[_0xc099('0x33')](respondWithResult(_0x21f2fc,null))[_0xc099('0x25')](handleError(_0x21f2fc,null));};exports[_0xc099('0x105')]=function(_0xf3f31a,_0x330e76,_0x208668){return db[_0xc099('0x106')]['find']({'where':{'id':_0xf3f31a[_0xc099('0x5b')]['id']}})[_0xc099('0x33')](handleEntityNotFound(_0x330e76,null))[_0xc099('0x33')](function(_0x4de2b8){if(_0x4de2b8){return _0x4de2b8['addProactiveActions'](_0xf3f31a[_0xc099('0x55')]['ids'],_[_0xc099('0xda')](_0xf3f31a[_0xc099('0x55')],[_0xc099('0x64'),'id'])||{});}})[_0xc099('0x33')](respondWithResult(_0x330e76,null))[_0xc099('0x25')](handleError(_0x330e76,null));};exports[_0xc099('0xf1')]=function(_0x531cba,_0x3a3b7e,_0x43e95b){var _0x49b2d3={};var _0x481fc9={};var _0x65507f;var _0xbe6608;return db[_0xc099('0x3d')][_0xc099('0x60')]({'where':{'id':_0x531cba[_0xc099('0x5b')]['id']}})[_0xc099('0x33')](handleEntityNotFound(_0x3a3b7e,null))[_0xc099('0x33')](function(_0x1f5b2f){if(_0x1f5b2f){_0x65507f=_0x1f5b2f;_0x481fc9[_0xc099('0x42')]=_[_0xc099('0x52')](db[_0xc099('0x107')]['rawAttributes']);_0x481fc9[_0xc099('0x40')]=_['keys'](_0x531cba[_0xc099('0x40')]);_0x481fc9[_0xc099('0x41')]=_[_0xc099('0x53')](_0x481fc9[_0xc099('0x42')],_0x481fc9[_0xc099('0x40')]);_0x49b2d3['attributes']=_[_0xc099('0x53')](_0x481fc9['model'],qs[_0xc099('0x44')](_0x531cba[_0xc099('0x40')][_0xc099('0x44')]));_0x49b2d3['attributes']=_0x49b2d3[_0xc099('0x43')][_0xc099('0x45')]?_0x49b2d3[_0xc099('0x43')]:_0x481fc9[_0xc099('0x42')];_0x49b2d3[_0xc099('0x47')]=qs[_0xc099('0x48')](_0x531cba[_0xc099('0x40')]['sort']);_0x49b2d3['where']=qs['filters'](_[_0xc099('0x67')](_0x531cba['query'],_0x481fc9[_0xc099('0x41')]));if(_0x531cba[_0xc099('0x40')][_0xc099('0x4a')]){_0x49b2d3[_0xc099('0x49')]=_[_0xc099('0x4c')](_0x49b2d3[_0xc099('0x49')],{'$or':_['map'](_0x49b2d3[_0xc099('0x43')],function(_0x2f5b5a){var _0x45d122={};_0x45d122[_0x2f5b5a]={'$like':'%'+_0x531cba[_0xc099('0x40')][_0xc099('0x4a')]+'%'};return _0x45d122;})});}_0x49b2d3=_[_0xc099('0x4c')]({},_0x49b2d3,_0x531cba['options']);return _0x65507f['getProactiveActions'](_0x49b2d3);}})['then'](function(_0x5ea5e4){if(_0x5ea5e4){_0xbe6608=_0x5ea5e4[_0xc099('0x45')];if(!_0x531cba['query'][_0xc099('0x104')]('nolimit')){_0x49b2d3[_0xc099('0x2b')]=qs[_0xc099('0x2b')](_0x531cba['query'][_0xc099('0x2b')]);_0x49b2d3[_0xc099('0x2a')]=qs[_0xc099('0x2a')](_0x531cba[_0xc099('0x40')][_0xc099('0x2a')]);}return _0x65507f[_0xc099('0xf1')](_0x49b2d3);}})['then'](function(_0x5d4315){if(_0x5d4315){return _0x5d4315?{'count':_0xbe6608,'rows':_0x5d4315}:null;}})[_0xc099('0x33')](respondWithResult(_0x3a3b7e,null))[_0xc099('0x25')](handleError(_0x3a3b7e,null));};exports[_0xc099('0x108')]=function(_0x5b7aca,_0x316c26,_0x5ca8bc){var _0x5e9af6=_0x5b7aca[_0xc099('0x40')][_0xc099('0x109')]===_0xc099('0x10a')?_0xc099('0x10b'):_0xc099('0x10c');return db[_0xc099('0x3d')][_0xc099('0x59')]({'attributes':['id',_0x5e9af6],'where':{'id':_0x5b7aca[_0xc099('0x5b')]['id']}})[_0xc099('0x33')](handleEntityNotFound(_0x316c26,null))['then'](function(_0x18991b){if(_0x18991b){var _0x220706=_0x18991b[_0x5e9af6];var _0x314f85=_0x220706&&_0x220706['items']?_0x220706[_0xc099('0x10d')]:[];_0x316c26[_0xc099('0x38')]({'fromKey':_[_0xc099('0x78')](_0x220706[_0xc099('0x10e')])?undefined:_0x220706[_0xc099('0x10e')],'count':_0x314f85['length'],'rows':_0x314f85});}})['catch'](handleError(_0x316c26,null));};exports[_0xc099('0x10f')]=function(_0x2d31d9,_0x28b905,_0x551000){var _0x552df1={'raw':![],'where':{}};var _0x277de2={};var _0x560488={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xc099('0x60')]({'where':{'id':_0x2d31d9[_0xc099('0x5b')]['id']}})[_0xc099('0x33')](handleEntityNotFound(_0x28b905,null))['then'](function(_0xa3e012){if(_0xa3e012){_0x277de2['model']=_[_0xc099('0x52')](db[_0xc099('0xcb')]['rawAttributes']);_0x277de2[_0xc099('0x40')]=_['keys'](_0x2d31d9[_0xc099('0x40')]);_0x277de2[_0xc099('0x41')]=_[_0xc099('0x53')](_0x277de2[_0xc099('0x42')],_0x277de2[_0xc099('0x40')]);_0x552df1['attributes']=_[_0xc099('0x53')](_0x277de2[_0xc099('0x42')],qs[_0xc099('0x44')](_0x2d31d9['query']['fields']));_0x552df1['attributes']=_0x552df1[_0xc099('0x43')][_0xc099('0x45')]?_0x552df1[_0xc099('0x43')]:_0x277de2[_0xc099('0x42')];if(!_0x2d31d9[_0xc099('0x40')][_0xc099('0x104')](_0xc099('0x46'))){_0x552df1['limit']=qs[_0xc099('0x2b')](_0x2d31d9[_0xc099('0x40')][_0xc099('0x2b')]);_0x552df1['offset']=qs['offset'](_0x2d31d9[_0xc099('0x40')][_0xc099('0x2a')]);}_0x552df1[_0xc099('0x47')]=qs[_0xc099('0x48')](_0x2d31d9[_0xc099('0x40')][_0xc099('0x48')]);_0x552df1[_0xc099('0x49')]=qs['filters'](_[_0xc099('0x67')](_0x2d31d9[_0xc099('0x40')],_0x277de2[_0xc099('0x41')]));_0x552df1[_0xc099('0x49')][_0xc099('0x5e')]=_0xa3e012['id'];if(_0x2d31d9[_0xc099('0x40')]['filter']){_0x552df1[_0xc099('0x49')]=_[_0xc099('0x4c')](_0x552df1[_0xc099('0x49')],{'$or':_[_0xc099('0x3c')](_0x552df1[_0xc099('0x43')],function(_0x22f3d2){var _0x542967={};_0x542967[_0x22f3d2]={'$like':'%'+_0x2d31d9[_0xc099('0x40')][_0xc099('0x4a')]+'%'};return _0x542967;})});}_0x552df1=_[_0xc099('0x4c')]({},_0x552df1,_0x2d31d9[_0xc099('0xdc')]);return db[_0xc099('0xcb')][_0xc099('0x29')]({'where':_0x552df1[_0xc099('0x49')]})[_0xc099('0x33')](function(_0x1dd4ef){_0x560488[_0xc099('0x29')]=_0x1dd4ef;if(_0x2d31d9[_0xc099('0x40')][_0xc099('0x4d')]){_0x552df1[_0xc099('0x4e')]=[{'all':!![]}];}else{_0x552df1[_0xc099('0x4e')]=[{'model':db[_0xc099('0x92')],'as':_0xc099('0xdd'),'required':![]}];}return db[_0xc099('0xcb')][_0xc099('0x4f')](_0x552df1);})['then'](function(_0x2428af){_0x560488[_0xc099('0x50')]=_0x2428af;return _0x560488;});}})['then'](respondWithFilteredResult(_0x28b905,_0x552df1))[_0xc099('0x25')](handleError(_0x28b905,null));};exports[_0xc099('0x110')]=function(_0x2f71d8,_0x5c8c0f,_0x73aabc){return db[_0xc099('0x3d')][_0xc099('0x59')]({'where':{'id':_0x2f71d8[_0xc099('0x5b')]['id']}})[_0xc099('0x33')](handleEntityNotFound(_0x5c8c0f,null))[_0xc099('0x33')](function(_0x3093f3){if(_0x3093f3){return _0x3093f3[_0xc099('0x110')](_0x2f71d8['body'][_0xc099('0x64')],_[_0xc099('0xda')](_0x2f71d8[_0xc099('0x55')],['ids','id'])||{})[_0xc099('0xb2')](function(_0x18354a){for(var _0x1e36d2=0x0;_0x1e36d2<_0x2f71d8[_0xc099('0x55')][_0xc099('0x64')][_0xc099('0x45')];_0x1e36d2+=0x1){socket[_0xc099('0x111')](_0xc099('0x112'),{'UserId':_0x2f71d8['body'][_0xc099('0x64')][_0x1e36d2],'ChatWebsiteId':_0x2f71d8['params']['id']});}return _0x18354a;});}})[_0xc099('0x33')](respondWithResult(_0x5c8c0f,null))[_0xc099('0x25')](handleError(_0x5c8c0f,null));};exports[_0xc099('0x113')]=function(_0x4d217b,_0x24f93a,_0xab8b57){return db[_0xc099('0x3d')][_0xc099('0x59')]({'where':{'id':_0x4d217b['params']['id']}})[_0xc099('0x33')](handleEntityNotFound(_0x24f93a,null))['then'](function(_0x73bc3c){if(_0x73bc3c){return _0x73bc3c['removeAgents'](_0x4d217b[_0xc099('0x40')][_0xc099('0x64')])[_0xc099('0x33')](function(){if(_[_0xc099('0x114')](_0x4d217b['query']['ids'])){for(var _0x198a4b=0x0;_0x198a4b<_0x4d217b[_0xc099('0x40')][_0xc099('0x64')]['length'];_0x198a4b+=0x1){socket[_0xc099('0x111')](_0xc099('0x115'),{'UserId':Number(_0x4d217b['query'][_0xc099('0x64')][_0x198a4b]),'ChatWebsiteId':Number(_0x4d217b['params']['id'])});}}else{socket[_0xc099('0x111')](_0xc099('0x115'),{'UserId':Number(_0x4d217b[_0xc099('0x40')][_0xc099('0x64')]),'ChatWebsiteId':Number(_0x4d217b[_0xc099('0x5b')]['id'])});}});}})[_0xc099('0x33')](respondWithStatusCode(_0x24f93a,null))[_0xc099('0x25')](handleError(_0x24f93a,null));};exports[_0xc099('0x116')]=function(_0x261ee9,_0x1b2416,_0x4c64ed){var _0x164dc0={};var _0x4f2ee4={};var _0x1bed70;var _0x43ca6f;return db[_0xc099('0x3d')]['findOne']({'where':{'id':_0x261ee9['params']['id']}})['then'](handleEntityNotFound(_0x1b2416,null))['then'](function(_0x470c85){if(_0x470c85){_0x1bed70=_0x470c85;_0x4f2ee4[_0xc099('0x42')]=_[_0xc099('0x52')](db[_0xc099('0xbb')][_0xc099('0x62')]);_0x4f2ee4[_0xc099('0x40')]=_[_0xc099('0x52')](_0x261ee9['query']);_0x4f2ee4[_0xc099('0x41')]=_[_0xc099('0x53')](_0x4f2ee4['model'],_0x4f2ee4['query']);_0x164dc0[_0xc099('0x43')]=_[_0xc099('0x53')](_0x4f2ee4[_0xc099('0x42')],qs['fields'](_0x261ee9['query'][_0xc099('0x44')]));_0x164dc0[_0xc099('0x43')]=_0x164dc0[_0xc099('0x43')][_0xc099('0x45')]?_0x164dc0[_0xc099('0x43')]:_0x4f2ee4[_0xc099('0x42')];_0x164dc0[_0xc099('0x47')]=qs[_0xc099('0x48')](_0x261ee9[_0xc099('0x40')]['sort']);_0x164dc0['where']=qs[_0xc099('0x41')](_[_0xc099('0x67')](_0x261ee9['query'],_0x4f2ee4[_0xc099('0x41')]));if(_0x261ee9[_0xc099('0x40')][_0xc099('0x4a')]){_0x164dc0[_0xc099('0x49')]=_[_0xc099('0x4c')](_0x164dc0[_0xc099('0x49')],{'$or':_[_0xc099('0x3c')](_0x164dc0['attributes'],function(_0x4558d1){var _0x2fe513={};_0x2fe513[_0x4558d1]={'$like':'%'+_0x261ee9[_0xc099('0x40')][_0xc099('0x4a')]+'%'};return _0x2fe513;})});}_0x164dc0=_[_0xc099('0x4c')]({},_0x164dc0,_0x261ee9['options']);return _0x1bed70[_0xc099('0x116')](_0x164dc0);}})[_0xc099('0x33')](function(_0x1f4576){if(_0x1f4576){_0x43ca6f=_0x1f4576[_0xc099('0x45')];if(!_0x261ee9['query'][_0xc099('0x104')](_0xc099('0x46'))){_0x164dc0['limit']=qs[_0xc099('0x2b')](_0x261ee9[_0xc099('0x40')][_0xc099('0x2b')]);_0x164dc0['offset']=qs[_0xc099('0x2a')](_0x261ee9[_0xc099('0x40')]['offset']);}return _0x1bed70[_0xc099('0x116')](_0x164dc0);}})[_0xc099('0x33')](function(_0x6a9e20){if(_0x6a9e20){return _0x6a9e20?{'count':_0x43ca6f,'rows':_0x6a9e20}:null;}})[_0xc099('0x33')](respondWithResult(_0x1b2416,null))[_0xc099('0x25')](handleError(_0x1b2416,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index c3144ad..bb97074 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 _0x6ede=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x6ede,0x140));var _0xe6ed=function(_0x5e8460,_0x2003b5){_0x5e8460=_0x5e8460-0x0;var _0x3d50fd=_0x6ede[_0x5e8460];return _0x3d50fd;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xe6ed('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xe6ed('0x1')](0x0);var events={'afterCreate':_0xe6ed('0x2'),'afterUpdate':_0xe6ed('0x3'),'afterDestroy':_0xe6ed('0x4')};function emitEvent(_0x3c1457){return function(_0xe5da87,_0x4720f0,_0x49b442){ChatWebsiteEvents[_0xe6ed('0x5')](_0x3c1457+':'+_0xe5da87['id'],_0xe5da87);ChatWebsiteEvents[_0xe6ed('0x5')](_0x3c1457,_0xe5da87);_0x49b442(null);};}for(var e in events){if(events[_0xe6ed('0x6')](e)){var event=events[e];ChatWebsite[_0xe6ed('0x7')](e,emitEvent(event));}}module[_0xe6ed('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x010a=['emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','save','remove'];(function(_0x46827d,_0x1c6b7a){var _0x38d03e=function(_0xdc86ec){while(--_0xdc86ec){_0x46827d['push'](_0x46827d['shift']());}};_0x38d03e(++_0x1c6b7a);}(_0x010a,0x1f4));var _0xa010=function(_0x1ba2f8,_0x478bc3){_0x1ba2f8=_0x1ba2f8-0x0;var _0x65264e=_0x010a[_0x1ba2f8];return _0x65264e;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xa010('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xa010('0x1')](0x0);var events={'afterCreate':_0xa010('0x2'),'afterUpdate':'update','afterDestroy':_0xa010('0x3')};function emitEvent(_0x5d7cf4){return function(_0x2c0c40,_0x17fe51,_0xee0649){ChatWebsiteEvents[_0xa010('0x4')](_0x5d7cf4+':'+_0x2c0c40['id'],_0x2c0c40);ChatWebsiteEvents[_0xa010('0x4')](_0x5d7cf4,_0x2c0c40);_0xee0649(null);};}for(var e in events){if(events[_0xa010('0x5')](e)){var event=events[e];ChatWebsite[_0xa010('0x6')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index add76a8..1c1154c 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 _0x4ded=['path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x267954,_0x3ce857){var _0x319f84=function(_0x377cfe){while(--_0x377cfe){_0x267954['push'](_0x267954['shift']());}};_0x319f84(++_0x3ce857);}(_0x4ded,0x116));var _0xd4de=function(_0x3ae4f5,_0x1a22e2){_0x3ae4f5=_0x3ae4f5-0x0;var _0x30262f=_0x4ded[_0x3ae4f5];return _0x30262f;};'use strict';var _=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var logger=require(_0xd4de('0x2'))(_0xd4de('0x3'));var moment=require(_0xd4de('0x4'));var BPromise=require(_0xd4de('0x5'));var rp=require(_0xd4de('0x6'));var fs=require('fs');var path=require(_0xd4de('0x7'));var rimraf=require(_0xd4de('0x8'));var config=require(_0xd4de('0x9'));var attributes=require(_0xd4de('0xa'));module[_0xd4de('0xb')]=function(_0x554a51,_0x23e5b9){return _0x554a51[_0xd4de('0xc')](_0xd4de('0xd'),attributes,{'tableName':_0xd4de('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x579c=['define','chat_websites','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatWebsite.attributes','exports'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x579c,0xda));var _0xc579=function(_0x4aea9e,_0x224afc){_0x4aea9e=_0x4aea9e-0x0;var _0x2ccf56=_0x579c[_0x4aea9e];return _0x2ccf56;};'use strict';var _=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var logger=require(_0xc579('0x2'))(_0xc579('0x3'));var moment=require(_0xc579('0x4'));var BPromise=require('bluebird');var rp=require(_0xc579('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc579('0x6'));var config=require(_0xc579('0x7'));var attributes=require(_0xc579('0x8'));module[_0xc579('0x9')]=function(_0x124ee5,_0x1bd276){return _0x124ee5[_0xc579('0xa')]('ChatWebsite',attributes,{'tableName':_0xc579('0xb'),'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 527478f..31ce0f7 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 _0x9536=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash'];(function(_0x1ecae9,_0x3d5fb9){var _0x5518e1=function(_0x1fcef5){while(--_0x1fcef5){_0x1ecae9['push'](_0x1ecae9['shift']());}};_0x5518e1(++_0x3d5fb9);}(_0x9536,0x179));var _0x6953=function(_0x3b0912,_0x39d739){_0x3b0912=_0x3b0912-0x0;var _0xa8f339=_0x9536[_0x3b0912];return _0xa8f339;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});config[_0x6953('0xb')]=_[_0x6953('0xc')](config[_0x6953('0xb')],{'host':_0x6953('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6953('0xb')]));require(_0x6953('0xe'))[_0x6953('0xf')](socket);function respondWithRpcPromise(_0x4b505f,_0x41f41b,_0x465761){return new BPromise(function(_0x300c48,_0xb13f2c){return client[_0x6953('0x10')](_0x4b505f,_0x465761)[_0x6953('0x11')](function(_0x246534){logger[_0x6953('0x12')](_0x6953('0x13'),_0x41f41b,'request\x20sent');logger[_0x6953('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x41f41b,_0x6953('0x15'),JSON[_0x6953('0x16')](_0x246534));if(_0x246534[_0x6953('0x17')]){if(_0x246534[_0x6953('0x17')][_0x6953('0x18')]===0x1f4){logger[_0x6953('0x17')](_0x6953('0x13'),_0x41f41b,_0x246534[_0x6953('0x17')][_0x6953('0x19')]);return _0xb13f2c(_0x246534[_0x6953('0x17')][_0x6953('0x19')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x41f41b,_0x246534[_0x6953('0x17')][_0x6953('0x19')]);return _0x300c48(_0x246534[_0x6953('0x17')][_0x6953('0x19')]);}else{logger['info'](_0x6953('0x13'),_0x41f41b,_0x6953('0x15'));_0x300c48(_0x246534['result'][_0x6953('0x19')]);}})[_0x6953('0x1a')](function(_0x283cf4){logger[_0x6953('0x17')](_0x6953('0x13'),_0x41f41b,_0x283cf4);_0xb13f2c(_0x283cf4);});});} \ No newline at end of file +var _0x2542=['register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket'];(function(_0x505529,_0xb77f0d){var _0x4e7ee3=function(_0x232d83){while(--_0x232d83){_0x505529['push'](_0x505529['shift']());}};_0x4e7ee3(++_0xb77f0d);}(_0x2542,0x169));var _0x2254=function(_0x2d62ed,_0x286b68){_0x2d62ed=_0x2d62ed-0x0;var _0x267fb2=_0x2542[_0x2d62ed];return _0x267fb2;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});config[_0x2254('0xb')]=_[_0x2254('0xc')](config[_0x2254('0xb')],{'host':_0x2254('0xd'),'port':0x18eb});var socket=require(_0x2254('0xe'))(new Redis(config[_0x2254('0xb')]));require(_0x2254('0xf'))[_0x2254('0x10')](socket);function respondWithRpcPromise(_0x1ae415,_0x38fb2b,_0x5b1ab9){return new BPromise(function(_0x336e14,_0x2655ea){return client[_0x2254('0x11')](_0x1ae415,_0x5b1ab9)[_0x2254('0x12')](function(_0x575d58){logger['info'](_0x2254('0x13'),_0x38fb2b,_0x2254('0x14'));logger[_0x2254('0x15')](_0x2254('0x16'),_0x38fb2b,_0x2254('0x14'),JSON[_0x2254('0x17')](_0x575d58));if(_0x575d58['error']){if(_0x575d58[_0x2254('0x18')][_0x2254('0x19')]===0x1f4){logger['error'](_0x2254('0x13'),_0x38fb2b,_0x575d58[_0x2254('0x18')][_0x2254('0x1a')]);return _0x2655ea(_0x575d58[_0x2254('0x18')][_0x2254('0x1a')]);}logger[_0x2254('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x38fb2b,_0x575d58[_0x2254('0x18')]['message']);return _0x336e14(_0x575d58[_0x2254('0x18')][_0x2254('0x1a')]);}else{logger[_0x2254('0x1b')](_0x2254('0x13'),_0x38fb2b,_0x2254('0x14'));_0x336e14(_0x575d58[_0x2254('0x1c')]['message']);}})['catch'](function(_0x5ec98d){logger[_0x2254('0x18')](_0x2254('0x13'),_0x38fb2b,_0x5ec98d);_0x2655ea(_0x5ec98d);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 17df143..474c30f 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(_0x227bfa,_0x51bedc){var _0x331aba=function(_0x36e65b){while(--_0x36e65b){_0x227bfa['push'](_0x227bfa['shift']());}};_0x331aba(++_0x51bedc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3ed49a,_0xf2cfe7){_0x3ed49a=_0x3ed49a-0x0;var _0xc7022e=_0x5f2f[_0x3ed49a];return _0xc7022e;};'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 _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0xb10b,0x12a));var _0xbb10=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0xb10b[_0x164af1];return _0x5d81a2;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 922e445..b4b70ed 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 _0x5078=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','single','file','addLogo','server/files/images/avatars/','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','/:id/interactions','addInteraction','/:id/applications','addApplications','addProactiveActions','addAgents','put','/:id','update','delete','destroy','removeDispositions','/:id/users','exports'];(function(_0x323c4b,_0x281826){var _0x5264dd=function(_0x1b0214){while(--_0x1b0214){_0x323c4b['push'](_0x323c4b['shift']());}};_0x5264dd(++_0x281826);}(_0x5078,0x8c));var _0x8507=function(_0x7ec78e,_0x31931f){_0x7ec78e=_0x7ec78e-0x0;var _0x3ab195=_0x5078[_0x7ec78e];return _0x3ab195;};'use strict';var multer=require(_0x8507('0x0'));var util=require('util');var path=require(_0x8507('0x1'));var timeout=require(_0x8507('0x2'));var express=require(_0x8507('0x3'));var router=express[_0x8507('0x4')]();var auth=require(_0x8507('0x5'));var interaction=require(_0x8507('0x6'));var config=require(_0x8507('0x7'));var controller=require(_0x8507('0x8'));router[_0x8507('0x9')]('/',auth[_0x8507('0xa')](),controller[_0x8507('0xb')]);router[_0x8507('0x9')](_0x8507('0xc'),auth[_0x8507('0xa')](),controller[_0x8507('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8507('0xe')]);router['get'](_0x8507('0xf'),auth[_0x8507('0xa')](),controller[_0x8507('0x10')]);router[_0x8507('0x9')](_0x8507('0x11'),auth[_0x8507('0xa')](),controller['getAnswers']);router['get']('/:id/logo',controller[_0x8507('0x12')]);router['get'](_0x8507('0x13'),controller[_0x8507('0x14')]);router[_0x8507('0x9')](_0x8507('0x15'),controller[_0x8507('0x16')]);router[_0x8507('0x9')]('/:id/system_avatar',controller[_0x8507('0x17')]);router[_0x8507('0x9')]('/:id/interactions',auth[_0x8507('0xa')](),controller[_0x8507('0x18')]);router['get'](_0x8507('0x19'),controller[_0x8507('0x1a')]);router[_0x8507('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0x8507('0x1b')]);router['get'](_0x8507('0x1c'),auth[_0x8507('0xa')](),controller[_0x8507('0x1d')]);router['get'](_0x8507('0x1e'),controller[_0x8507('0x1f')]);router[_0x8507('0x9')]('/:id/offline_messages',auth[_0x8507('0xa')](),controller['getOfflineMessages']);router[_0x8507('0x9')]('/:id/users',auth[_0x8507('0xa')](),controller[_0x8507('0x20')]);router[_0x8507('0x21')]('/',auth[_0x8507('0xa')](),controller[_0x8507('0x22')]);router[_0x8507('0x21')](_0x8507('0xf'),auth[_0x8507('0xa')](),controller[_0x8507('0x23')]);router[_0x8507('0x21')](_0x8507('0x11'),auth[_0x8507('0xa')](),controller[_0x8507('0x24')]);var upload=multer({'storage':multer[_0x8507('0x25')]({'destination':function(_0x456e96,_0x491771,_0x2155b8){_0x2155b8(null,path[_0x8507('0x26')](config[_0x8507('0x27')],_0x8507('0x28')));},'filename':function(_0x3cf01c,_0x14ae5e,_0x2e3066){_0x2e3066(null,util[_0x8507('0x29')](_0x8507('0x2a'),Date[_0x8507('0x2b')](),_0x14ae5e[_0x8507('0x2c')]));}})});router[_0x8507('0x21')](_0x8507('0x2d'),upload[_0x8507('0x2e')](_0x8507('0x2f')),controller[_0x8507('0x30')]);var upload=multer({'storage':multer[_0x8507('0x25')]({'destination':function(_0x16736b,_0x5c49a2,_0x4b4db1){_0x4b4db1(null,path[_0x8507('0x26')](config[_0x8507('0x27')],_0x8507('0x31')));},'filename':function(_0x43927a,_0x2179a7,_0x4e5266){_0x4e5266(null,util[_0x8507('0x29')]('%s-%s',Date[_0x8507('0x2b')](),_0x2179a7['originalname']));}})});router[_0x8507('0x21')](_0x8507('0x13'),upload[_0x8507('0x2e')](_0x8507('0x2f')),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x109341,_0x23a21f,_0x43bf24){_0x43bf24(null,path[_0x8507('0x26')](config[_0x8507('0x27')],_0x8507('0x31')));},'filename':function(_0x17f6d9,_0x2be0d1,_0x3016c1){_0x3016c1(null,util['format'](_0x8507('0x2a'),Date['now'](),_0x2be0d1[_0x8507('0x2c')]));}})});router['post'](_0x8507('0x15'),upload[_0x8507('0x2e')](_0x8507('0x2f')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x8507('0x25')]({'destination':function(_0x47e2db,_0x463e4d,_0x3bfdbf){_0x3bfdbf(null,path[_0x8507('0x26')](config[_0x8507('0x27')],_0x8507('0x31')));},'filename':function(_0x1ecee6,_0x5c8f3d,_0x5de2b9){_0x5de2b9(null,util[_0x8507('0x29')]('%s-%s',Date['now'](),_0x5c8f3d[_0x8507('0x2c')]));}})});router['post'](_0x8507('0x32'),upload[_0x8507('0x2e')](_0x8507('0x2f')),controller[_0x8507('0x33')]);router['post'](_0x8507('0x34'),controller[_0x8507('0x35')]);router['post'](_0x8507('0x36'),controller[_0x8507('0x37')]);router['post'](_0x8507('0x38'),auth[_0x8507('0xa')](),controller[_0x8507('0x39')]);router['post'](_0x8507('0x3a'),auth['isAuthenticated'](),controller[_0x8507('0x3b')]);router['post']('/:id/proactive_actions',auth[_0x8507('0xa')](),controller[_0x8507('0x3c')]);router[_0x8507('0x21')]('/:id/users',auth[_0x8507('0xa')](),controller[_0x8507('0x3d')]);router[_0x8507('0x3e')](_0x8507('0x3f'),auth[_0x8507('0xa')](),controller[_0x8507('0x40')]);router[_0x8507('0x41')]('/:id',auth[_0x8507('0xa')](),controller[_0x8507('0x42')]);router[_0x8507('0x41')](_0x8507('0xf'),auth[_0x8507('0xa')](),controller[_0x8507('0x43')]);router[_0x8507('0x41')](_0x8507('0x11'),auth[_0x8507('0xa')](),controller['removeAnswers']);router['delete'](_0x8507('0x44'),auth[_0x8507('0xa')](),controller['removeAgents']);module[_0x8507('0x45')]=router; \ No newline at end of file +var _0x3f3e=['getAgents','post','create','addDisposition','diskStorage','join','server/files/images/logos/','%s-%s','now','single','file','addLogo','root','format','/:id/avatar','addAvatar','server/files/images/avatars/','addCustomerAvatar','originalname','/:id/notify','notify','/:id/offline','addInteraction','addApplications','addProactiveActions','addAgents','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users'];(function(_0x254171,_0x3d9fdc){var _0xcc7c1e=function(_0x522741){while(--_0x522741){_0x254171['push'](_0x254171['shift']());}};_0xcc7c1e(++_0x3d9fdc);}(_0x3f3e,0x1b8));var _0xe3f3=function(_0x103e7b,_0x13d933){_0x103e7b=_0x103e7b-0x0;var _0x1f67dc=_0x3f3e[_0x103e7b];return _0x1f67dc;};'use strict';var multer=require(_0xe3f3('0x0'));var util=require(_0xe3f3('0x1'));var path=require(_0xe3f3('0x2'));var timeout=require(_0xe3f3('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xe3f3('0x4'));var interaction=require(_0xe3f3('0x5'));var config=require(_0xe3f3('0x6'));var controller=require(_0xe3f3('0x7'));router[_0xe3f3('0x8')]('/',auth[_0xe3f3('0x9')](),controller[_0xe3f3('0xa')]);router[_0xe3f3('0x8')](_0xe3f3('0xb'),auth['isAuthenticated'](),controller[_0xe3f3('0xc')]);router[_0xe3f3('0x8')](_0xe3f3('0xd'),auth[_0xe3f3('0x9')](),controller['show']);router['get'](_0xe3f3('0xe'),auth[_0xe3f3('0x9')](),controller[_0xe3f3('0xf')]);router[_0xe3f3('0x8')](_0xe3f3('0x10'),auth[_0xe3f3('0x9')](),controller['getAnswers']);router[_0xe3f3('0x8')](_0xe3f3('0x11'),controller[_0xe3f3('0x12')]);router[_0xe3f3('0x8')]('/:id/avatar',controller[_0xe3f3('0x13')]);router[_0xe3f3('0x8')](_0xe3f3('0x14'),controller[_0xe3f3('0x15')]);router[_0xe3f3('0x8')](_0xe3f3('0x16'),controller[_0xe3f3('0x17')]);router[_0xe3f3('0x8')](_0xe3f3('0x18'),auth[_0xe3f3('0x9')](),controller[_0xe3f3('0x19')]);router[_0xe3f3('0x8')](_0xe3f3('0x1a'),controller[_0xe3f3('0x1b')]);router['get'](_0xe3f3('0x1c'),auth['isAuthenticated'](),controller[_0xe3f3('0x1d')]);router[_0xe3f3('0x8')](_0xe3f3('0x1e'),auth[_0xe3f3('0x9')](),controller[_0xe3f3('0x1f')]);router[_0xe3f3('0x8')]('/:id/fields',controller[_0xe3f3('0x20')]);router[_0xe3f3('0x8')](_0xe3f3('0x21'),auth['isAuthenticated'](),controller[_0xe3f3('0x22')]);router[_0xe3f3('0x8')](_0xe3f3('0x23'),auth[_0xe3f3('0x9')](),controller[_0xe3f3('0x24')]);router[_0xe3f3('0x25')]('/',auth[_0xe3f3('0x9')](),controller[_0xe3f3('0x26')]);router[_0xe3f3('0x25')](_0xe3f3('0xe'),auth['isAuthenticated'](),controller[_0xe3f3('0x27')]);router['post'](_0xe3f3('0x10'),auth[_0xe3f3('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xe3f3('0x28')]({'destination':function(_0x4f3b1e,_0x4e74cf,_0x2c47f8){_0x2c47f8(null,path[_0xe3f3('0x29')](config['root'],_0xe3f3('0x2a')));},'filename':function(_0xe3f678,_0x20d223,_0x36e3be){_0x36e3be(null,util['format'](_0xe3f3('0x2b'),Date[_0xe3f3('0x2c')](),_0x20d223['originalname']));}})});router['post']('/:id/logo',upload[_0xe3f3('0x2d')](_0xe3f3('0x2e')),controller[_0xe3f3('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x335588,_0xcf684e,_0x92f38b){_0x92f38b(null,path[_0xe3f3('0x29')](config[_0xe3f3('0x30')],'server/files/images/avatars/'));},'filename':function(_0x25150d,_0x585f4c,_0x45481a){_0x45481a(null,util[_0xe3f3('0x31')]('%s-%s',Date[_0xe3f3('0x2c')](),_0x585f4c['originalname']));}})});router[_0xe3f3('0x25')](_0xe3f3('0x32'),upload[_0xe3f3('0x2d')](_0xe3f3('0x2e')),controller[_0xe3f3('0x33')]);var upload=multer({'storage':multer[_0xe3f3('0x28')]({'destination':function(_0x4a464d,_0x314773,_0x184bcb){_0x184bcb(null,path[_0xe3f3('0x29')](config[_0xe3f3('0x30')],_0xe3f3('0x34')));},'filename':function(_0x331206,_0x44dd59,_0x1fb550){_0x1fb550(null,util['format'](_0xe3f3('0x2b'),Date[_0xe3f3('0x2c')](),_0x44dd59['originalname']));}})});router[_0xe3f3('0x25')]('/:id/customer_avatar',upload[_0xe3f3('0x2d')](_0xe3f3('0x2e')),controller[_0xe3f3('0x35')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xeeee02,_0x133302,_0x7d41bf){_0x7d41bf(null,path[_0xe3f3('0x29')](config['root'],_0xe3f3('0x34')));},'filename':function(_0x1ce563,_0xec0b41,_0x27d37f){_0x27d37f(null,util[_0xe3f3('0x31')]('%s-%s',Date['now'](),_0xec0b41[_0xe3f3('0x36')]));}})});router[_0xe3f3('0x25')]('/:id/system_avatar',upload[_0xe3f3('0x2d')]('file'),controller['addSystemAvatar']);router[_0xe3f3('0x25')](_0xe3f3('0x37'),controller[_0xe3f3('0x38')]);router[_0xe3f3('0x25')](_0xe3f3('0x39'),controller['offline']);router[_0xe3f3('0x25')](_0xe3f3('0x18'),auth[_0xe3f3('0x9')](),controller[_0xe3f3('0x3a')]);router[_0xe3f3('0x25')](_0xe3f3('0x1c'),auth[_0xe3f3('0x9')](),controller[_0xe3f3('0x3b')]);router[_0xe3f3('0x25')](_0xe3f3('0x1e'),auth[_0xe3f3('0x9')](),controller[_0xe3f3('0x3c')]);router[_0xe3f3('0x25')](_0xe3f3('0x23'),auth['isAuthenticated'](),controller[_0xe3f3('0x3d')]);router['put'](_0xe3f3('0xd'),auth[_0xe3f3('0x9')](),controller[_0xe3f3('0x3e')]);router[_0xe3f3('0x3f')](_0xe3f3('0xd'),auth[_0xe3f3('0x9')](),controller[_0xe3f3('0x40')]);router[_0xe3f3('0x3f')](_0xe3f3('0xe'),auth[_0xe3f3('0x9')](),controller['removeDispositions']);router[_0xe3f3('0x3f')]('/:id/canned_answers',auth[_0xe3f3('0x9')](),controller[_0xe3f3('0x41')]);router['delete'](_0xe3f3('0x23'),auth[_0xe3f3('0x9')](),controller[_0xe3f3('0x42')]);module[_0xe3f3('0x43')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 8be5306..179f2fc 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 _0x741c=['STRING','ENUM','AmazonAWS','Google','sequelize','exports'];(function(_0x31ab46,_0x5382c4){var _0x99cff5=function(_0x43bc06){while(--_0x43bc06){_0x31ab46['push'](_0x31ab46['shift']());}};_0x99cff5(++_0x5382c4);}(_0x741c,0x196));var _0xc741=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x741c[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0xc741('0x0'));module[_0xc741('0x1')]={'name':{'type':Sequelize[_0xc741('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc741('0x3')](_0xc741('0x4'),_0xc741('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x869e=['STRING','AmazonAWS','Google','sequelize','exports'];(function(_0x188993,_0x33d346){var _0x59d3db=function(_0x3632db){while(--_0x3632db){_0x188993['push'](_0x188993['shift']());}};_0x59d3db(++_0x33d346);}(_0x869e,0x15c));var _0xe869=function(_0x59b230,_0x52697e){_0x59b230=_0x59b230-0x0;var _0x56aeb3=_0x869e[_0x59b230];return _0x56aeb3;};'use strict';var Sequelize=require(_0xe869('0x0'));module[_0xe869('0x1')]={'name':{'type':Sequelize[_0xe869('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0xe869('0x3'),_0xe869('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xe869('0x2')]},'data2':{'type':Sequelize[_0xe869('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index a80f7da..885ee8e 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 _0x48f8=['findAll','rows','catch','show','intersection','include','create','body','update','find','params','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','limit','Content-Range','reject','save','then','destroy','error','stack','name','index','CloudProvider','rawAttributes','fieldName','type','key','model','map','query','keys','filters','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x48f8,0x127));var _0x848f=function(_0x595807,_0x2ea7cd){_0x595807=_0x595807-0x0;var _0x24ffcc=_0x48f8[_0x595807];return _0x24ffcc;};'use strict';var pdf=require(_0x848f('0x0'));var emlformat=require(_0x848f('0x1'));var rimraf=require(_0x848f('0x2'));var zipdir=require(_0x848f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x848f('0x4'));var BPromise=require(_0x848f('0x5'));var Mustache=require('mustache');var util=require(_0x848f('0x6'));var path=require('path');var sox=require(_0x848f('0x7'));var csv=require(_0x848f('0x8'));var ejs=require(_0x848f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x848f('0xa'));var jsforce=require(_0x848f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x848f('0x8'));var querystring=require(_0x848f('0xc'));var Papa=require('papaparse');var Redis=require(_0x848f('0xd'));var authService=require(_0x848f('0xe'));var qs=require(_0x848f('0xf'));var as=require(_0x848f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x848f('0x11'))(_0x848f('0x12'));var utils=require('../../config/utils');var config=require(_0x848f('0x13'));var db=require(_0x848f('0x14'))['db'];function respondWithStatusCode(_0x3c6af8,_0x1d37a8){_0x1d37a8=_0x1d37a8||0xcc;return function(_0x1ae7ab){if(_0x1ae7ab){return _0x3c6af8['sendStatus'](_0x1d37a8);}return _0x3c6af8[_0x848f('0x15')](_0x1d37a8)[_0x848f('0x16')]();};}function respondWithResult(_0x2ef24b,_0x5c5f32){_0x5c5f32=_0x5c5f32||0xc8;return function(_0x32d657){if(_0x32d657){return _0x2ef24b['status'](_0x5c5f32)[_0x848f('0x17')](_0x32d657);}};}function respondWithFilteredResult(_0x292144,_0x5981bb){return function(_0x289623){if(_0x289623){var _0x126d7e=_0x289623['count'],_0x70e3d4=_0x5981bb['offset'],_0xaf8c96=_0x5981bb[_0x848f('0x18')]+_0x5981bb[_0x848f('0x19')],_0x247849;if(_0xaf8c96>=_0x126d7e){_0xaf8c96=_0x126d7e;_0x247849=0xc8;}else{_0x247849=0xce;}_0x292144[_0x848f('0x15')](_0x247849);return _0x292144['set'](_0x848f('0x1a'),_0x70e3d4+'-'+_0xaf8c96+'/'+_0x126d7e)['json'](_0x289623);}return null;};}function patchUpdates(_0x46876a){return function(_0x507771){try{jsonpatch['apply'](_0x507771,_0x46876a,!![]);}catch(_0x4232f4){return BPromise[_0x848f('0x1b')](_0x4232f4);}return _0x507771[_0x848f('0x1c')]();};}function saveUpdates(_0x43df5f,_0x46372b){return function(_0x93a5ca){if(_0x93a5ca){return _0x93a5ca['update'](_0x43df5f)[_0x848f('0x1d')](function(_0x3fb602){return _0x3fb602;});}return null;};}function removeEntity(_0x336454,_0x6fd604){return function(_0x6c2d25){if(_0x6c2d25){return _0x6c2d25[_0x848f('0x1e')]()[_0x848f('0x1d')](function(){_0x336454[_0x848f('0x15')](0xcc)[_0x848f('0x16')]();});}};}function handleEntityNotFound(_0x5d68b5,_0x30bd78){return function(_0x5ece6b){if(!_0x5ece6b){_0x5d68b5['sendStatus'](0x194);}return _0x5ece6b;};}function handleError(_0x4466d5,_0x1b2c1a){_0x1b2c1a=_0x1b2c1a||0x1f4;return function(_0x3aa340){logger[_0x848f('0x1f')](_0x3aa340[_0x848f('0x20')]);if(_0x3aa340[_0x848f('0x21')]){delete _0x3aa340[_0x848f('0x21')];}_0x4466d5[_0x848f('0x15')](_0x1b2c1a)['send'](_0x3aa340);};}exports[_0x848f('0x22')]=function(_0x29b084,_0x46e265){var _0x4f19f3={},_0x38e037={},_0x520590={'count':0x0,'rows':[]};var _0x34955a=_['map'](db[_0x848f('0x23')][_0x848f('0x24')],function(_0x5e8737){return{'name':_0x5e8737[_0x848f('0x25')],'type':_0x5e8737[_0x848f('0x26')][_0x848f('0x27')]};});_0x38e037[_0x848f('0x28')]=_[_0x848f('0x29')](_0x34955a,_0x848f('0x21'));_0x38e037[_0x848f('0x2a')]=_[_0x848f('0x2b')](_0x29b084['query']);_0x38e037[_0x848f('0x2c')]=_['intersection'](_0x38e037[_0x848f('0x28')],_0x38e037['query']);_0x4f19f3['attributes']=_['intersection'](_0x38e037[_0x848f('0x28')],qs[_0x848f('0x2d')](_0x29b084[_0x848f('0x2a')][_0x848f('0x2d')]));_0x4f19f3['attributes']=_0x4f19f3['attributes'][_0x848f('0x2e')]?_0x4f19f3[_0x848f('0x2f')]:_0x38e037[_0x848f('0x28')];if(!_0x29b084['query'][_0x848f('0x30')](_0x848f('0x31'))){_0x4f19f3[_0x848f('0x19')]=qs['limit'](_0x29b084['query']['limit']);_0x4f19f3['offset']=qs[_0x848f('0x18')](_0x29b084['query'][_0x848f('0x18')]);}_0x4f19f3[_0x848f('0x32')]=qs[_0x848f('0x33')](_0x29b084[_0x848f('0x2a')][_0x848f('0x33')]);_0x4f19f3[_0x848f('0x34')]=qs[_0x848f('0x2c')](_[_0x848f('0x35')](_0x29b084[_0x848f('0x2a')],_0x38e037[_0x848f('0x2c')]),_0x34955a);if(_0x29b084[_0x848f('0x2a')][_0x848f('0x36')]){_0x4f19f3['where']=_[_0x848f('0x37')](_0x4f19f3['where'],{'$or':_[_0x848f('0x29')](_0x34955a,function(_0x24d93b){if(_0x24d93b['type']!==_0x848f('0x38')){var _0x89b243={};_0x89b243[_0x24d93b[_0x848f('0x21')]]={'$like':'%'+_0x29b084['query'][_0x848f('0x36')]+'%'};return _0x89b243;}})});}_0x4f19f3=_['merge']({},_0x4f19f3,_0x29b084[_0x848f('0x39')]);var _0x1974fe={'where':_0x4f19f3['where']};return db[_0x848f('0x23')][_0x848f('0x3a')](_0x1974fe)[_0x848f('0x1d')](function(_0x49d85f){_0x520590[_0x848f('0x3a')]=_0x49d85f;if(_0x29b084['query'][_0x848f('0x3b')]){_0x4f19f3['include']=[{'all':!![]}];}return db['CloudProvider'][_0x848f('0x3c')](_0x4f19f3);})[_0x848f('0x1d')](function(_0x181ee7){_0x520590[_0x848f('0x3d')]=_0x181ee7;return _0x520590;})[_0x848f('0x1d')](respondWithFilteredResult(_0x46e265,_0x4f19f3))[_0x848f('0x3e')](handleError(_0x46e265,null));};exports[_0x848f('0x3f')]=function(_0x1c56e7,_0x4cdf1a){var _0x563d8e={'raw':!![],'where':{'id':_0x1c56e7['params']['id']}},_0x3e8246={};_0x3e8246['model']=_[_0x848f('0x2b')](db['CloudProvider'][_0x848f('0x24')]);_0x3e8246[_0x848f('0x2a')]=_['keys'](_0x1c56e7[_0x848f('0x2a')]);_0x3e8246[_0x848f('0x2c')]=_[_0x848f('0x40')](_0x3e8246[_0x848f('0x28')],_0x3e8246[_0x848f('0x2a')]);_0x563d8e[_0x848f('0x2f')]=_[_0x848f('0x40')](_0x3e8246['model'],qs['fields'](_0x1c56e7['query']['fields']));_0x563d8e[_0x848f('0x2f')]=_0x563d8e[_0x848f('0x2f')][_0x848f('0x2e')]?_0x563d8e['attributes']:_0x3e8246[_0x848f('0x28')];if(_0x1c56e7[_0x848f('0x2a')][_0x848f('0x3b')]){_0x563d8e[_0x848f('0x41')]=[{'all':!![]}];}_0x563d8e=_[_0x848f('0x37')]({},_0x563d8e,_0x1c56e7['options']);return db[_0x848f('0x23')]['find'](_0x563d8e)[_0x848f('0x1d')](handleEntityNotFound(_0x4cdf1a,null))[_0x848f('0x1d')](respondWithResult(_0x4cdf1a,null))[_0x848f('0x3e')](handleError(_0x4cdf1a,null));};exports[_0x848f('0x42')]=function(_0x31d369,_0x3de532){return db[_0x848f('0x23')][_0x848f('0x42')](_0x31d369[_0x848f('0x43')],{})[_0x848f('0x1d')](respondWithResult(_0x3de532,0xc9))[_0x848f('0x3e')](handleError(_0x3de532,null));};exports[_0x848f('0x44')]=function(_0x206922,_0x9d3fef){if(_0x206922['body']['id']){delete _0x206922[_0x848f('0x43')]['id'];}return db[_0x848f('0x23')][_0x848f('0x45')]({'where':{'id':_0x206922[_0x848f('0x46')]['id']}})['then'](handleEntityNotFound(_0x9d3fef,null))[_0x848f('0x1d')](saveUpdates(_0x206922[_0x848f('0x43')],null))[_0x848f('0x1d')](respondWithResult(_0x9d3fef,null))[_0x848f('0x3e')](handleError(_0x9d3fef,null));};exports[_0x848f('0x1e')]=function(_0x22e062,_0x3a7cf6){return db[_0x848f('0x23')][_0x848f('0x45')]({'where':{'id':_0x22e062[_0x848f('0x46')]['id']}})[_0x848f('0x1d')](handleEntityNotFound(_0x3a7cf6,null))[_0x848f('0x1d')](removeEntity(_0x3a7cf6,null))[_0x848f('0x3e')](handleError(_0x3a7cf6,null));}; \ No newline at end of file +var _0x5a25=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','destroy','then','stack','name','send','map','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','CloudProvider','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','update','body','params','eml-format','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x23a1d1,_0x2525f4){var _0x2c242a=function(_0x7821fa){while(--_0x7821fa){_0x23a1d1['push'](_0x23a1d1['shift']());}};_0x2c242a(++_0x2525f4);}(_0x5a25,0x1d9));var _0x55a2=function(_0x9b7a64,_0x38d4a8){_0x9b7a64=_0x9b7a64-0x0;var _0x33fd98=_0x5a25[_0x9b7a64];return _0x33fd98;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x55a2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x55a2('0x1'));var rp=require('request-promise');var moment=require(_0x55a2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x55a2('0x3'));var util=require('util');var path=require(_0x55a2('0x4'));var sox=require(_0x55a2('0x5'));var csv=require(_0x55a2('0x6'));var ejs=require(_0x55a2('0x7'));var fs=require('fs');var _=require(_0x55a2('0x8'));var squel=require(_0x55a2('0x9'));var crypto=require('crypto');var jsforce=require(_0x55a2('0xa'));var deskjs=require(_0x55a2('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x55a2('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x55a2('0xd'));var as=require(_0x55a2('0xe'));var hardwareService=require(_0x55a2('0xf'));var logger=require(_0x55a2('0x10'))(_0x55a2('0x11'));var utils=require(_0x55a2('0x12'));var config=require(_0x55a2('0x13'));var db=require(_0x55a2('0x14'))['db'];function respondWithStatusCode(_0x18b8c4,_0x4dc73a){_0x4dc73a=_0x4dc73a||0xcc;return function(_0x4911c4){if(_0x4911c4){return _0x18b8c4[_0x55a2('0x15')](_0x4dc73a);}return _0x18b8c4['status'](_0x4dc73a)[_0x55a2('0x16')]();};}function respondWithResult(_0x514885,_0x2b92cf){_0x2b92cf=_0x2b92cf||0xc8;return function(_0x2c10cc){if(_0x2c10cc){return _0x514885[_0x55a2('0x17')](_0x2b92cf)[_0x55a2('0x18')](_0x2c10cc);}};}function respondWithFilteredResult(_0x53498c,_0x2607ee){return function(_0x1097ef){if(_0x1097ef){var _0x2aecdf=_0x1097ef[_0x55a2('0x19')],_0x463810=_0x2607ee[_0x55a2('0x1a')],_0x1eda88=_0x2607ee['offset']+_0x2607ee[_0x55a2('0x1b')],_0xbb74e;if(_0x1eda88>=_0x2aecdf){_0x1eda88=_0x2aecdf;_0xbb74e=0xc8;}else{_0xbb74e=0xce;}_0x53498c[_0x55a2('0x17')](_0xbb74e);return _0x53498c['set'](_0x55a2('0x1c'),_0x463810+'-'+_0x1eda88+'/'+_0x2aecdf)[_0x55a2('0x18')](_0x1097ef);}return null;};}function patchUpdates(_0x438e64){return function(_0x1d390d){try{jsonpatch[_0x55a2('0x1d')](_0x1d390d,_0x438e64,!![]);}catch(_0xfee79b){return BPromise[_0x55a2('0x1e')](_0xfee79b);}return _0x1d390d[_0x55a2('0x1f')]();};}function saveUpdates(_0xfd0589,_0x1497c8){return function(_0x25e8af){if(_0x25e8af){return _0x25e8af['update'](_0xfd0589)['then'](function(_0x279a0e){return _0x279a0e;});}return null;};}function removeEntity(_0x53b631,_0x27cc78){return function(_0x50c5b2){if(_0x50c5b2){return _0x50c5b2[_0x55a2('0x20')]()[_0x55a2('0x21')](function(){_0x53b631['status'](0xcc)[_0x55a2('0x16')]();});}};}function handleEntityNotFound(_0x3adcbd,_0x4b373e){return function(_0x3c3185){if(!_0x3c3185){_0x3adcbd[_0x55a2('0x15')](0x194);}return _0x3c3185;};}function handleError(_0x6bc91f,_0x2326e5){_0x2326e5=_0x2326e5||0x1f4;return function(_0x4c55fb){logger['error'](_0x4c55fb[_0x55a2('0x22')]);if(_0x4c55fb[_0x55a2('0x23')]){delete _0x4c55fb[_0x55a2('0x23')];}_0x6bc91f[_0x55a2('0x17')](_0x2326e5)[_0x55a2('0x24')](_0x4c55fb);};}exports['index']=function(_0xdcdb6c,_0xbda58){var _0x1c74d6={},_0xa9201={},_0x29ca06={'count':0x0,'rows':[]};var _0x4b5309=_[_0x55a2('0x25')](db['CloudProvider']['rawAttributes'],function(_0x5df971){return{'name':_0x5df971['fieldName'],'type':_0x5df971[_0x55a2('0x26')][_0x55a2('0x27')]};});_0xa9201[_0x55a2('0x28')]=_['map'](_0x4b5309,'name');_0xa9201[_0x55a2('0x29')]=_['keys'](_0xdcdb6c['query']);_0xa9201[_0x55a2('0x2a')]=_[_0x55a2('0x2b')](_0xa9201[_0x55a2('0x28')],_0xa9201['query']);_0x1c74d6['attributes']=_[_0x55a2('0x2b')](_0xa9201['model'],qs[_0x55a2('0x2c')](_0xdcdb6c[_0x55a2('0x29')][_0x55a2('0x2c')]));_0x1c74d6[_0x55a2('0x2d')]=_0x1c74d6[_0x55a2('0x2d')][_0x55a2('0x2e')]?_0x1c74d6[_0x55a2('0x2d')]:_0xa9201[_0x55a2('0x28')];if(!_0xdcdb6c['query'][_0x55a2('0x2f')](_0x55a2('0x30'))){_0x1c74d6['limit']=qs[_0x55a2('0x1b')](_0xdcdb6c[_0x55a2('0x29')][_0x55a2('0x1b')]);_0x1c74d6[_0x55a2('0x1a')]=qs[_0x55a2('0x1a')](_0xdcdb6c[_0x55a2('0x29')][_0x55a2('0x1a')]);}_0x1c74d6[_0x55a2('0x31')]=qs[_0x55a2('0x32')](_0xdcdb6c[_0x55a2('0x29')]['sort']);_0x1c74d6['where']=qs[_0x55a2('0x2a')](_['pick'](_0xdcdb6c['query'],_0xa9201[_0x55a2('0x2a')]),_0x4b5309);if(_0xdcdb6c[_0x55a2('0x29')][_0x55a2('0x33')]){_0x1c74d6['where']=_[_0x55a2('0x34')](_0x1c74d6[_0x55a2('0x35')],{'$or':_[_0x55a2('0x25')](_0x4b5309,function(_0x491f80){if(_0x491f80[_0x55a2('0x26')]!==_0x55a2('0x36')){var _0x398f1d={};_0x398f1d[_0x491f80[_0x55a2('0x23')]]={'$like':'%'+_0xdcdb6c['query'][_0x55a2('0x33')]+'%'};return _0x398f1d;}})});}_0x1c74d6=_['merge']({},_0x1c74d6,_0xdcdb6c[_0x55a2('0x37')]);var _0x403f20={'where':_0x1c74d6[_0x55a2('0x35')]};return db[_0x55a2('0x38')]['count'](_0x403f20)[_0x55a2('0x21')](function(_0x13c569){_0x29ca06[_0x55a2('0x19')]=_0x13c569;if(_0xdcdb6c[_0x55a2('0x29')][_0x55a2('0x39')]){_0x1c74d6[_0x55a2('0x3a')]=[{'all':!![]}];}return db['CloudProvider'][_0x55a2('0x3b')](_0x1c74d6);})['then'](function(_0x40f629){_0x29ca06[_0x55a2('0x3c')]=_0x40f629;return _0x29ca06;})[_0x55a2('0x21')](respondWithFilteredResult(_0xbda58,_0x1c74d6))[_0x55a2('0x3d')](handleError(_0xbda58,null));};exports[_0x55a2('0x3e')]=function(_0x3a1978,_0x50b32e){var _0x54a0d8={'raw':!![],'where':{'id':_0x3a1978['params']['id']}},_0x26e880={};_0x26e880[_0x55a2('0x28')]=_[_0x55a2('0x3f')](db[_0x55a2('0x38')][_0x55a2('0x40')]);_0x26e880[_0x55a2('0x29')]=_[_0x55a2('0x3f')](_0x3a1978[_0x55a2('0x29')]);_0x26e880[_0x55a2('0x2a')]=_[_0x55a2('0x2b')](_0x26e880[_0x55a2('0x28')],_0x26e880[_0x55a2('0x29')]);_0x54a0d8[_0x55a2('0x2d')]=_[_0x55a2('0x2b')](_0x26e880[_0x55a2('0x28')],qs[_0x55a2('0x2c')](_0x3a1978[_0x55a2('0x29')][_0x55a2('0x2c')]));_0x54a0d8[_0x55a2('0x2d')]=_0x54a0d8[_0x55a2('0x2d')][_0x55a2('0x2e')]?_0x54a0d8['attributes']:_0x26e880['model'];if(_0x3a1978['query'][_0x55a2('0x39')]){_0x54a0d8['include']=[{'all':!![]}];}_0x54a0d8=_[_0x55a2('0x34')]({},_0x54a0d8,_0x3a1978[_0x55a2('0x37')]);return db[_0x55a2('0x38')][_0x55a2('0x41')](_0x54a0d8)['then'](handleEntityNotFound(_0x50b32e,null))[_0x55a2('0x21')](respondWithResult(_0x50b32e,null))[_0x55a2('0x3d')](handleError(_0x50b32e,null));};exports[_0x55a2('0x42')]=function(_0x58aea,_0x4afcc4){return db[_0x55a2('0x38')][_0x55a2('0x42')](_0x58aea['body'],{})[_0x55a2('0x21')](respondWithResult(_0x4afcc4,0xc9))['catch'](handleError(_0x4afcc4,null));};exports[_0x55a2('0x43')]=function(_0x35d32b,_0x266050){if(_0x35d32b[_0x55a2('0x44')]['id']){delete _0x35d32b['body']['id'];}return db[_0x55a2('0x38')][_0x55a2('0x41')]({'where':{'id':_0x35d32b[_0x55a2('0x45')]['id']}})['then'](handleEntityNotFound(_0x266050,null))['then'](saveUpdates(_0x35d32b['body'],null))[_0x55a2('0x21')](respondWithResult(_0x266050,null))['catch'](handleError(_0x266050,null));};exports[_0x55a2('0x20')]=function(_0x122e0f,_0x5acf1f){return db[_0x55a2('0x38')][_0x55a2('0x41')]({'where':{'id':_0x122e0f[_0x55a2('0x45')]['id']}})[_0x55a2('0x21')](handleEntityNotFound(_0x5acf1f,null))[_0x55a2('0x21')](removeEntity(_0x5acf1f,null))['catch'](handleError(_0x5acf1f,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 3323923..eff6001 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 _0x8a9a=['exports','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./cloudProvider.attributes'];(function(_0x6168c6,_0x343301){var _0x32a0a6=function(_0x22d006){while(--_0x22d006){_0x6168c6['push'](_0x6168c6['shift']());}};_0x32a0a6(++_0x343301);}(_0x8a9a,0x1d7));var _0xa8a9=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x8a9a[_0x550d12];return _0x12103d;};'use strict';var _=require(_0xa8a9('0x0'));var util=require(_0xa8a9('0x1'));var logger=require(_0xa8a9('0x2'))(_0xa8a9('0x3'));var moment=require(_0xa8a9('0x4'));var BPromise=require('bluebird');var rp=require(_0xa8a9('0x5'));var fs=require('fs');var path=require(_0xa8a9('0x6'));var rimraf=require(_0xa8a9('0x7'));var config=require('../../config/environment');var attributes=require(_0xa8a9('0x8'));module[_0xa8a9('0x9')]=function(_0x5b148b,_0x2341e1){return _0x5b148b['define'](_0xa8a9('0xa'),attributes,{'tableName':_0xa8a9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c0d=['exports','define','CloudProvider','cloud_providers','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x115621,_0x341cde){var _0x5ef5ce=function(_0x2ca3f2){while(--_0x2ca3f2){_0x115621['push'](_0x115621['shift']());}};_0x5ef5ce(++_0x341cde);}(_0x3c0d,0x148));var _0xd3c0=function(_0x4cfb59,_0x5befdc){_0x4cfb59=_0x4cfb59-0x0;var _0x31a61c=_0x3c0d[_0x4cfb59];return _0x31a61c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd3c0('0x0'))('api');var moment=require(_0xd3c0('0x1'));var BPromise=require('bluebird');var rp=require(_0xd3c0('0x2'));var fs=require('fs');var path=require(_0xd3c0('0x3'));var rimraf=require(_0xd3c0('0x4'));var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0xd3c0('0x5')]=function(_0x3becdf,_0x2143c3){return _0x3becdf[_0xd3c0('0x6')](_0xd3c0('0x7'),attributes,{'tableName':_0xd3c0('0x8'),'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 106c987..166c91f 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 _0xe80e=['rpc','jayson/promise','client','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x320164,_0x35889f){var _0x571827=function(_0x289c1e){while(--_0x289c1e){_0x320164['push'](_0x320164['shift']());}};_0x571827(++_0x35889f);}(_0xe80e,0x116));var _0xee80=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xe80e[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0xee80('0x0'));var util=require(_0xee80('0x1'));var moment=require(_0xee80('0x2'));var BPromise=require(_0xee80('0x3'));var rs=require(_0xee80('0x4'));var fs=require('fs');var Redis=require(_0xee80('0x5'));var db=require(_0xee80('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xee80('0x7'))(_0xee80('0x8'));var config=require('../../config/environment');var jayson=require(_0xee80('0x9'));var client=jayson[_0xee80('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x379c03,_0x134cb7,_0x56fc24){return new BPromise(function(_0x4e37da,_0x109c03){return client['request'](_0x379c03,_0x56fc24)[_0xee80('0xb')](function(_0x19ea92){logger[_0xee80('0xc')](_0xee80('0xd'),_0x134cb7,_0xee80('0xe'));logger['debug'](_0xee80('0xf'),_0x134cb7,_0xee80('0xe'),JSON[_0xee80('0x10')](_0x19ea92));if(_0x19ea92[_0xee80('0x11')]){if(_0x19ea92['error'][_0xee80('0x12')]===0x1f4){logger[_0xee80('0x11')](_0xee80('0xd'),_0x134cb7,_0x19ea92[_0xee80('0x11')][_0xee80('0x13')]);return _0x109c03(_0x19ea92['error'][_0xee80('0x13')]);}logger[_0xee80('0x11')](_0xee80('0xd'),_0x134cb7,_0x19ea92[_0xee80('0x11')][_0xee80('0x13')]);return _0x4e37da(_0x19ea92[_0xee80('0x11')]['message']);}else{logger[_0xee80('0xc')](_0xee80('0xd'),_0x134cb7,_0xee80('0xe'));_0x4e37da(_0x19ea92[_0xee80('0x14')][_0xee80('0x13')]);}})[_0xee80('0x15')](function(_0x4d73ae){logger['error'](_0xee80('0xd'),_0x134cb7,_0x4d73ae);_0x109c03(_0x4d73ae);});});} \ No newline at end of file +var _0x9b58=['error','code','message','result','catch','util','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x434a1f,_0x44434d){var _0x10333a=function(_0x762cc6){while(--_0x762cc6){_0x434a1f['push'](_0x434a1f['shift']());}};_0x10333a(++_0x44434d);}(_0x9b58,0x1e5));var _0x89b5=function(_0x844353,_0x560724){_0x844353=_0x844353-0x0;var _0x2d6e1c=_0x9b58[_0x844353];return _0x2d6e1c;};'use strict';var _=require('lodash');var util=require(_0x89b5('0x0'));var moment=require('moment');var BPromise=require(_0x89b5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89b5('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x89b5('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x89b5('0x4'));var jayson=require(_0x89b5('0x5'));var client=jayson[_0x89b5('0x6')][_0x89b5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x193765,_0x5843f7,_0x5b295e){return new BPromise(function(_0xeee9ba,_0x423a06){return client['request'](_0x193765,_0x5b295e)[_0x89b5('0x8')](function(_0x40723a){logger[_0x89b5('0x9')](_0x89b5('0xa'),_0x5843f7,_0x89b5('0xb'));logger[_0x89b5('0xc')](_0x89b5('0xd'),_0x5843f7,_0x89b5('0xb'),JSON[_0x89b5('0xe')](_0x40723a));if(_0x40723a[_0x89b5('0xf')]){if(_0x40723a[_0x89b5('0xf')][_0x89b5('0x10')]===0x1f4){logger[_0x89b5('0xf')]('CloudProvider,\x20%s,\x20%s',_0x5843f7,_0x40723a[_0x89b5('0xf')][_0x89b5('0x11')]);return _0x423a06(_0x40723a[_0x89b5('0xf')][_0x89b5('0x11')]);}logger[_0x89b5('0xf')]('CloudProvider,\x20%s,\x20%s',_0x5843f7,_0x40723a[_0x89b5('0xf')][_0x89b5('0x11')]);return _0xeee9ba(_0x40723a[_0x89b5('0xf')]['message']);}else{logger[_0x89b5('0x9')]('CloudProvider,\x20%s,\x20%s',_0x5843f7,_0x89b5('0xb'));_0xeee9ba(_0x40723a[_0x89b5('0x12')][_0x89b5('0x11')]);}})[_0x89b5('0x13')](function(_0x51b192){logger[_0x89b5('0xf')](_0x89b5('0xa'),_0x5843f7,_0x51b192);_0x423a06(_0x51b192);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index da3f248..150ee08 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 _0x8ed6=['../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x504691,_0x2d34f4){var _0x24364c=function(_0x5cb917){while(--_0x5cb917){_0x504691['push'](_0x504691['shift']());}};_0x24364c(++_0x2d34f4);}(_0x8ed6,0xec));var _0x68ed=function(_0x5657c2,_0x159172){_0x5657c2=_0x5657c2-0x0;var _0x1ebe00=_0x8ed6[_0x5657c2];return _0x1ebe00;};'use strict';var multer=require('multer');var util=require(_0x68ed('0x0'));var path=require('path');var timeout=require(_0x68ed('0x1'));var express=require(_0x68ed('0x2'));var router=express[_0x68ed('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x68ed('0x4'));var controller=require('./cloudProvider.controller');router[_0x68ed('0x5')]('/',auth[_0x68ed('0x6')](),controller[_0x68ed('0x7')]);router[_0x68ed('0x5')](_0x68ed('0x8'),auth[_0x68ed('0x6')](),controller[_0x68ed('0x9')]);router['post']('/',auth[_0x68ed('0x6')](),controller[_0x68ed('0xa')]);router[_0x68ed('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x68ed('0xc')]);router[_0x68ed('0xd')](_0x68ed('0x8'),auth[_0x68ed('0x6')](),controller[_0x68ed('0xe')]);module[_0x68ed('0xf')]=router; \ No newline at end of file +var _0xf55b=['../../components/auth/service','../../config/environment','./cloudProvider.controller','get','index','/:id','isAuthenticated','create','delete','multer','util','path','Router'];(function(_0x2d1665,_0x4f5001){var _0xd44742=function(_0x26a436){while(--_0x26a436){_0x2d1665['push'](_0x2d1665['shift']());}};_0xd44742(++_0x4f5001);}(_0xf55b,0xcc));var _0xbf55=function(_0x1337b1,_0x5011ef){_0x1337b1=_0x1337b1-0x0;var _0x1cf17b=_0xf55b[_0x1337b1];return _0x1cf17b;};'use strict';var multer=require(_0xbf55('0x0'));var util=require(_0xbf55('0x1'));var path=require(_0xbf55('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf55('0x3')]();var auth=require(_0xbf55('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbf55('0x5'));var controller=require(_0xbf55('0x6'));router[_0xbf55('0x7')]('/',auth['isAuthenticated'](),controller[_0xbf55('0x8')]);router[_0xbf55('0x7')](_0xbf55('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xbf55('0xa')](),controller[_0xbf55('0xb')]);router['put'](_0xbf55('0x9'),auth[_0xbf55('0xa')](),controller['update']);router[_0xbf55('0xc')](_0xbf55('0x9'),auth[_0xbf55('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 99d303f..815a8ae 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 _0x3716=['STRING','sequelize','name'];(function(_0x4ffe34,_0x5092ab){var _0x320d88=function(_0x101095){while(--_0x101095){_0x4ffe34['push'](_0x4ffe34['shift']());}};_0x320d88(++_0x5092ab);}(_0x3716,0xe8));var _0x6371=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0x3716[_0x35f7f5];return _0x5567a4;};'use strict';var Sequelize=require(_0x6371('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x6371('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x6371('0x2')]},'companyId':{'type':Sequelize[_0x6371('0x2')]},'website':{'type':Sequelize[_0x6371('0x2')]},'phone':{'type':Sequelize[_0x6371('0x2')]},'fax':{'type':Sequelize[_0x6371('0x2')]},'type':{'type':Sequelize[_0x6371('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x6371('0x2')]},'city':{'type':Sequelize[_0x6371('0x2')]},'country':{'type':Sequelize[_0x6371('0x2')]},'email':{'type':Sequelize[_0x6371('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x6371('0x2')]},'sPostalCode':{'type':Sequelize[_0x6371('0x2')]},'sCity':{'type':Sequelize[_0x6371('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6371('0x2')]}}; \ No newline at end of file +var _0xd548=['STRING','exports'];(function(_0x55538a,_0x5c0fea){var _0x4ca181=function(_0x1c98bc){while(--_0x1c98bc){_0x55538a['push'](_0x55538a['shift']());}};_0x4ca181(++_0x5c0fea);}(_0xd548,0x1df));var _0x8d54=function(_0x53dc28,_0x7b5ea){_0x53dc28=_0x53dc28-0x0;var _0x12b34e=_0xd548[_0x53dc28];return _0x12b34e;};'use strict';var Sequelize=require('sequelize');module[_0x8d54('0x0')]={'name':{'type':Sequelize[_0x8d54('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x8d54('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x8d54('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8d54('0x1')]},'street':{'type':Sequelize[_0x8d54('0x1')]},'postalCode':{'type':Sequelize[_0x8d54('0x1')]},'city':{'type':Sequelize[_0x8d54('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x8d54('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x8d54('0x1')]},'sPostalCode':{'type':Sequelize[_0x8d54('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index f8927a8..218e949 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 _0x084d=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','update','then','get','Companies','destroy','end','error','stack','name','send','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','map','merge','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','addContacts','ids','omit','getContacts','findOne','CmContact','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring'];(function(_0x1e3671,_0x9ae4fc){var _0x48d5f5=function(_0xfab713){while(--_0xfab713){_0x1e3671['push'](_0x1e3671['shift']());}};_0x48d5f5(++_0x9ae4fc);}(_0x084d,0x14f));var _0xd084=function(_0x10c13f,_0x41a1f8){_0x10c13f=_0x10c13f-0x0;var _0x2f9471=_0x084d[_0x10c13f];return _0x2f9471;};'use strict';var pdf=require(_0xd084('0x0'));var emlformat=require(_0xd084('0x1'));var rimraf=require(_0xd084('0x2'));var zipdir=require(_0xd084('0x3'));var jsonpatch=require(_0xd084('0x4'));var rp=require(_0xd084('0x5'));var moment=require(_0xd084('0x6'));var BPromise=require(_0xd084('0x7'));var Mustache=require(_0xd084('0x8'));var util=require('util');var path=require(_0xd084('0x9'));var sox=require(_0xd084('0xa'));var csv=require('to-csv');var ejs=require(_0xd084('0xb'));var fs=require('fs');var _=require(_0xd084('0xc'));var squel=require(_0xd084('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd084('0xe'));var toCsv=require(_0xd084('0xf'));var querystring=require(_0xd084('0x10'));var Papa=require('papaparse');var Redis=require(_0xd084('0x11'));var authService=require(_0xd084('0x12'));var qs=require(_0xd084('0x13'));var as=require(_0xd084('0x14'));var hardwareService=require(_0xd084('0x15'));var logger=require(_0xd084('0x16'))(_0xd084('0x17'));var utils=require(_0xd084('0x18'));var config=require('../../config/environment');var db=require(_0xd084('0x19'))['db'];function respondWithStatusCode(_0x249a79,_0x2c6f1d){_0x2c6f1d=_0x2c6f1d||0xcc;return function(_0x3b788a){if(_0x3b788a){return _0x249a79[_0xd084('0x1a')](_0x2c6f1d);}return _0x249a79[_0xd084('0x1b')](_0x2c6f1d)['end']();};}function respondWithResult(_0x15f4fb,_0x25aa1c){_0x25aa1c=_0x25aa1c||0xc8;return function(_0x1d2eaa){if(_0x1d2eaa){return _0x15f4fb['status'](_0x25aa1c)[_0xd084('0x1c')](_0x1d2eaa);}};}function respondWithFilteredResult(_0x472b27,_0x5d4508){return function(_0x1863fb){if(_0x1863fb){var _0x56df2b=_0x1863fb[_0xd084('0x1d')],_0x411095=_0x5d4508[_0xd084('0x1e')],_0x15f5ae=_0x5d4508[_0xd084('0x1e')]+_0x5d4508[_0xd084('0x1f')],_0x27b0c2;if(_0x15f5ae>=_0x56df2b){_0x15f5ae=_0x56df2b;_0x27b0c2=0xc8;}else{_0x27b0c2=0xce;}_0x472b27[_0xd084('0x1b')](_0x27b0c2);return _0x472b27[_0xd084('0x20')]('Content-Range',_0x411095+'-'+_0x15f5ae+'/'+_0x56df2b)[_0xd084('0x1c')](_0x1863fb);}return null;};}function patchUpdates(_0x10420b){return function(_0x304b7b){try{jsonpatch[_0xd084('0x21')](_0x304b7b,_0x10420b,!![]);}catch(_0x3eaa57){return BPromise[_0xd084('0x22')](_0x3eaa57);}return _0x304b7b['save']();};}function saveUpdates(_0x27b5ac,_0x139f86){return function(_0x94d68b){if(_0x94d68b){return _0x94d68b[_0xd084('0x23')](_0x27b5ac)[_0xd084('0x24')](function(_0x5676d0){return _0x5676d0;});}return null;};}function removeEntity(_0x456481,_0x2bcbc1){return function(_0x2d4032){if(_0x2d4032){return _0x2d4032['destroy']()['then'](function(){var _0x5a8850=_0x2d4032[_0xd084('0x25')]({'plain':!![]});var _0x11b817=_0xd084('0x26');return db['UserProfileResource'][_0xd084('0x27')]({'where':{'type':_0x11b817,'resourceId':_0x5a8850['id']}})[_0xd084('0x24')](function(){return _0x2d4032;});})['then'](function(){_0x456481[_0xd084('0x1b')](0xcc)[_0xd084('0x28')]();});}};}function handleEntityNotFound(_0x4e56c9,_0x20b4b5){return function(_0x128e3f){if(!_0x128e3f){_0x4e56c9[_0xd084('0x1a')](0x194);}return _0x128e3f;};}function handleError(_0x1083f8,_0x59c717){_0x59c717=_0x59c717||0x1f4;return function(_0x30bfb4){logger[_0xd084('0x29')](_0x30bfb4[_0xd084('0x2a')]);if(_0x30bfb4[_0xd084('0x2b')]){delete _0x30bfb4[_0xd084('0x2b')];}_0x1083f8[_0xd084('0x1b')](_0x59c717)[_0xd084('0x2c')](_0x30bfb4);};}exports['index']=function(_0x465bcc,_0x24de35){var _0x2fb61a={},_0x564015={},_0xfea3d5={'count':0x0,'rows':[]};return db[_0xd084('0x2d')][_0xd084('0x2e')]()[_0xd084('0x24')](function(_0x16c60c){_0x564015[_0xd084('0x2f')]=_[_0xd084('0x30')](_0x16c60c);_0x564015[_0xd084('0x31')]=_['keys'](_0x465bcc['query']);_0x564015[_0xd084('0x32')]=_[_0xd084('0x33')](_0x564015[_0xd084('0x2f')],_0x564015[_0xd084('0x31')]);_0x2fb61a[_0xd084('0x34')]=_['intersection'](_0x564015['model'],qs[_0xd084('0x35')](_0x465bcc[_0xd084('0x31')]['fields']));_0x2fb61a[_0xd084('0x34')]=_0x2fb61a[_0xd084('0x34')]['length']?_0x2fb61a[_0xd084('0x34')]:_0x564015['model'];if(!_0x465bcc['query']['hasOwnProperty'](_0xd084('0x36'))){_0x2fb61a[_0xd084('0x1f')]=qs[_0xd084('0x1f')](_0x465bcc[_0xd084('0x31')][_0xd084('0x1f')]);_0x2fb61a[_0xd084('0x1e')]=qs[_0xd084('0x1e')](_0x465bcc[_0xd084('0x31')]['offset']);}_0x2fb61a[_0xd084('0x37')]=qs[_0xd084('0x38')](_0x465bcc['query'][_0xd084('0x38')]);_0x2fb61a[_0xd084('0x39')]=qs[_0xd084('0x32')](_[_0xd084('0x3a')](_0x465bcc[_0xd084('0x31')],_0x564015['filters']));if(_0x465bcc[_0xd084('0x31')][_0xd084('0x3b')]){_0x2fb61a['where']=_['merge'](_0x2fb61a[_0xd084('0x39')],{'$or':_[_0xd084('0x3c')](_0x2fb61a[_0xd084('0x34')],function(_0x59ae6c){var _0x1ca4cb={};_0x1ca4cb[_0x59ae6c]={'$like':'%'+_0x465bcc[_0xd084('0x31')]['filter']+'%'};return _0x1ca4cb;})});}_0x2fb61a=_[_0xd084('0x3d')]({},_0x2fb61a,_0x465bcc[_0xd084('0x3e')]);var _0xe7604={'where':_0x2fb61a[_0xd084('0x39')]};return db['CmCompany'][_0xd084('0x1d')](_0xe7604)[_0xd084('0x24')](function(_0x1e1fbd){_0xfea3d5[_0xd084('0x1d')]=_0x1e1fbd;if(_0x465bcc['query']['includeAll']){_0x2fb61a[_0xd084('0x3f')]=[{'all':!![]}];}return db['CmCompany'][_0xd084('0x40')](_0x2fb61a);})['then'](function(_0x434171){_0xfea3d5[_0xd084('0x41')]=_0x434171;return _0xfea3d5;})['then'](respondWithFilteredResult(_0x24de35,_0x2fb61a))[_0xd084('0x42')](handleError(_0x24de35,null));})[_0xd084('0x42')](handleError(_0x24de35,null));};exports[_0xd084('0x43')]=function(_0x5cacf5,_0x6c989e){var _0x149f94={'raw':![],'where':{'id':_0x5cacf5[_0xd084('0x44')]['id']}},_0x13f7ff={};_0x13f7ff['model']=_[_0xd084('0x30')](db[_0xd084('0x2d')][_0xd084('0x45')]);_0x13f7ff[_0xd084('0x31')]=_['keys'](_0x5cacf5[_0xd084('0x31')]);_0x13f7ff[_0xd084('0x32')]=_[_0xd084('0x33')](_0x13f7ff[_0xd084('0x2f')],_0x13f7ff['query']);_0x149f94[_0xd084('0x34')]=_[_0xd084('0x33')](_0x13f7ff[_0xd084('0x2f')],qs[_0xd084('0x35')](_0x5cacf5[_0xd084('0x31')][_0xd084('0x35')]));_0x149f94['attributes']=_0x149f94[_0xd084('0x34')][_0xd084('0x46')]?_0x149f94[_0xd084('0x34')]:_0x13f7ff['model'];if(_0x5cacf5['query'][_0xd084('0x47')]){_0x149f94[_0xd084('0x3f')]=[{'all':!![]}];}_0x149f94=_['merge']({},_0x149f94,_0x5cacf5['options']);return db[_0xd084('0x2d')][_0xd084('0x48')](_0x149f94)[_0xd084('0x24')](handleEntityNotFound(_0x6c989e,null))[_0xd084('0x24')](respondWithResult(_0x6c989e,null))[_0xd084('0x42')](handleError(_0x6c989e,null));};exports[_0xd084('0x49')]=function(_0xe39940,_0x2deed0){return db[_0xd084('0x2d')]['create'](_0xe39940[_0xd084('0x4a')],{})[_0xd084('0x24')](function(_0xce4e6c){var _0x3af0f4=_0xe39940[_0xd084('0x4b')][_0xd084('0x25')]({'plain':!![]});if(!_0x3af0f4)throw new Error(_0xd084('0x4c'));if(_0x3af0f4['role']===_0xd084('0x4b')){var _0x5bd083=_0xce4e6c['get']({'plain':!![]});var _0x4cd464=_0xd084('0x26');return db[_0xd084('0x4d')]['find']({'where':{'name':_0x4cd464,'userProfileId':_0x3af0f4[_0xd084('0x4e')]},'raw':!![]})['then'](function(_0x51e6f7){if(_0x51e6f7&&_0x51e6f7[_0xd084('0x4f')]===0x0){return db[_0xd084('0x50')][_0xd084('0x49')]({'name':_0x5bd083['name'],'resourceId':_0x5bd083['id'],'type':_0x51e6f7[_0xd084('0x2b')],'sectionId':_0x51e6f7['id']},{})[_0xd084('0x24')](function(){return _0xce4e6c;});}else{return _0xce4e6c;}})[_0xd084('0x42')](function(_0x20cc6a){logger[_0xd084('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20cc6a);throw _0x20cc6a;});}return _0xce4e6c;})['then'](respondWithResult(_0x2deed0,0xc9))[_0xd084('0x42')](handleError(_0x2deed0,null));};exports[_0xd084('0x23')]=function(_0x38186e,_0x11426b){if(_0x38186e[_0xd084('0x4a')]['id']){delete _0x38186e[_0xd084('0x4a')]['id'];}return db[_0xd084('0x2d')][_0xd084('0x48')]({'where':{'id':_0x38186e['params']['id']}})[_0xd084('0x24')](handleEntityNotFound(_0x11426b,null))['then'](saveUpdates(_0x38186e[_0xd084('0x4a')],null))[_0xd084('0x24')](respondWithResult(_0x11426b,null))[_0xd084('0x42')](handleError(_0x11426b,null));};exports['destroy']=function(_0x474a1b,_0x45eb86){return db[_0xd084('0x2d')][_0xd084('0x48')]({'where':{'id':_0x474a1b['params']['id']}})[_0xd084('0x24')](handleEntityNotFound(_0x45eb86,null))['then'](removeEntity(_0x45eb86,null))[_0xd084('0x42')](handleError(_0x45eb86,null));};exports[_0xd084('0x2e')]=function(_0xfa5c74,_0x106af2){return db[_0xd084('0x2d')]['describe']()[_0xd084('0x24')](respondWithResult(_0x106af2,null))[_0xd084('0x42')](handleError(_0x106af2,null));};exports[_0xd084('0x51')]=function(_0x1626f9,_0x13cdc6,_0xcb9f89){return db['CmContact']['find']({'where':{'id':_0x1626f9[_0xd084('0x44')]['id']}})['then'](handleEntityNotFound(_0x13cdc6,null))['then'](function(_0x4fae26){if(_0x4fae26){return _0x4fae26[_0xd084('0x51')](_0x1626f9[_0xd084('0x4a')][_0xd084('0x52')],_[_0xd084('0x53')](_0x1626f9[_0xd084('0x4a')],['ids','id'])||{});}})[_0xd084('0x24')](respondWithResult(_0x13cdc6,null))[_0xd084('0x42')](handleError(_0x13cdc6,null));};exports[_0xd084('0x54')]=function(_0x2b976d,_0x20b369,_0x32252a){var _0x33a4a3={};var _0x39089d={};var _0x1d0b38;var _0x39aa5c;return db[_0xd084('0x2d')][_0xd084('0x55')]({'where':{'id':_0x2b976d[_0xd084('0x44')]['id']}})['then'](handleEntityNotFound(_0x20b369,null))[_0xd084('0x24')](function(_0x47e339){if(_0x47e339){_0x1d0b38=_0x47e339;_0x39089d[_0xd084('0x2f')]=_[_0xd084('0x30')](db[_0xd084('0x56')][_0xd084('0x45')]);_0x39089d[_0xd084('0x31')]=_[_0xd084('0x30')](_0x2b976d[_0xd084('0x31')]);_0x39089d['filters']=_[_0xd084('0x33')](_0x39089d[_0xd084('0x2f')],_0x39089d['query']);_0x33a4a3[_0xd084('0x34')]=_[_0xd084('0x33')](_0x39089d[_0xd084('0x2f')],qs[_0xd084('0x35')](_0x2b976d[_0xd084('0x31')]['fields']));_0x33a4a3['attributes']=_0x33a4a3[_0xd084('0x34')]['length']?_0x33a4a3['attributes']:_0x39089d[_0xd084('0x2f')];_0x33a4a3['order']=qs[_0xd084('0x38')](_0x2b976d[_0xd084('0x31')][_0xd084('0x38')]);_0x33a4a3[_0xd084('0x39')]=qs[_0xd084('0x32')](_['pick'](_0x2b976d['query'],_0x39089d[_0xd084('0x32')]));if(_0x2b976d[_0xd084('0x31')][_0xd084('0x3b')]){_0x33a4a3[_0xd084('0x39')]=_['merge'](_0x33a4a3[_0xd084('0x39')],{'$or':_[_0xd084('0x3c')](_0x33a4a3['attributes'],function(_0x3d452d){var _0x214c04={};_0x214c04[_0x3d452d]={'$like':'%'+_0x2b976d['query']['filter']+'%'};return _0x214c04;})});}_0x33a4a3=_[_0xd084('0x3d')]({},_0x33a4a3,_0x2b976d['options']);return _0x1d0b38[_0xd084('0x54')](_0x33a4a3);}})[_0xd084('0x24')](function(_0x4dc6ad){if(_0x4dc6ad){_0x39aa5c=_0x4dc6ad[_0xd084('0x46')];if(!_0x2b976d[_0xd084('0x31')][_0xd084('0x57')](_0xd084('0x36'))){_0x33a4a3[_0xd084('0x1f')]=qs[_0xd084('0x1f')](_0x2b976d['query'][_0xd084('0x1f')]);_0x33a4a3['offset']=qs[_0xd084('0x1e')](_0x2b976d[_0xd084('0x31')][_0xd084('0x1e')]);}return _0x1d0b38[_0xd084('0x54')](_0x33a4a3);}})['then'](function(_0x5e0d8b){if(_0x5e0d8b){return _0x5e0d8b?{'count':_0x39aa5c,'rows':_0x5e0d8b}:null;}})[_0xd084('0x24')](respondWithResult(_0x20b369,null))[_0xd084('0x42')](handleError(_0x20b369,null));}; \ No newline at end of file +var _0x1882=['nolimit','order','sort','where','map','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','fields','length','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','find','params','CmContact','ids','omit','getContacts','findOne','pick','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','get','Companies','error','stack','name','index','CmCompany','describe','keys','query','filters','model','attributes','intersection','hasOwnProperty'];(function(_0x18a296,_0x26edb6){var _0x12eb16=function(_0x123142){while(--_0x123142){_0x18a296['push'](_0x18a296['shift']());}};_0x12eb16(++_0x26edb6);}(_0x1882,0x126));var _0x2188=function(_0x311800,_0x129237){_0x311800=_0x311800-0x0;var _0x1f8346=_0x1882[_0x311800];return _0x1f8346;};'use strict';var pdf=require(_0x2188('0x0'));var emlformat=require(_0x2188('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2188('0x2'));var jsonpatch=require(_0x2188('0x3'));var rp=require(_0x2188('0x4'));var moment=require(_0x2188('0x5'));var BPromise=require(_0x2188('0x6'));var Mustache=require(_0x2188('0x7'));var util=require('util');var path=require(_0x2188('0x8'));var sox=require(_0x2188('0x9'));var csv=require(_0x2188('0xa'));var ejs=require(_0x2188('0xb'));var fs=require('fs');var _=require(_0x2188('0xc'));var squel=require(_0x2188('0xd'));var crypto=require(_0x2188('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2188('0xf'));var toCsv=require(_0x2188('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2188('0x10'));var authService=require(_0x2188('0x11'));var qs=require(_0x2188('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2188('0x13'))('api');var utils=require(_0x2188('0x14'));var config=require(_0x2188('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b1170,_0x465d85){_0x465d85=_0x465d85||0xcc;return function(_0x31b0af){if(_0x31b0af){return _0x3b1170[_0x2188('0x16')](_0x465d85);}return _0x3b1170['status'](_0x465d85)[_0x2188('0x17')]();};}function respondWithResult(_0x4be016,_0x3e007a){_0x3e007a=_0x3e007a||0xc8;return function(_0x301c6c){if(_0x301c6c){return _0x4be016[_0x2188('0x18')](_0x3e007a)[_0x2188('0x19')](_0x301c6c);}};}function respondWithFilteredResult(_0xe74e0d,_0x1e4acc){return function(_0x593ce5){if(_0x593ce5){var _0x4c61c4=_0x593ce5[_0x2188('0x1a')],_0x405398=_0x1e4acc[_0x2188('0x1b')],_0x465f56=_0x1e4acc[_0x2188('0x1b')]+_0x1e4acc[_0x2188('0x1c')],_0xbc1cf4;if(_0x465f56>=_0x4c61c4){_0x465f56=_0x4c61c4;_0xbc1cf4=0xc8;}else{_0xbc1cf4=0xce;}_0xe74e0d[_0x2188('0x18')](_0xbc1cf4);return _0xe74e0d[_0x2188('0x1d')](_0x2188('0x1e'),_0x405398+'-'+_0x465f56+'/'+_0x4c61c4)['json'](_0x593ce5);}return null;};}function patchUpdates(_0x220eaf){return function(_0x49eb4e){try{jsonpatch[_0x2188('0x1f')](_0x49eb4e,_0x220eaf,!![]);}catch(_0x5f1e83){return BPromise[_0x2188('0x20')](_0x5f1e83);}return _0x49eb4e['save']();};}function saveUpdates(_0x50be8b,_0x2c6b64){return function(_0x1a1155){if(_0x1a1155){return _0x1a1155['update'](_0x50be8b)[_0x2188('0x21')](function(_0x2c3630){return _0x2c3630;});}return null;};}function removeEntity(_0x4e5331,_0x4559a3){return function(_0xbd547a){if(_0xbd547a){return _0xbd547a[_0x2188('0x22')]()[_0x2188('0x21')](function(){var _0x44d5ae=_0xbd547a[_0x2188('0x23')]({'plain':!![]});var _0x5de2d8=_0x2188('0x24');return db['UserProfileResource'][_0x2188('0x22')]({'where':{'type':_0x5de2d8,'resourceId':_0x44d5ae['id']}})[_0x2188('0x21')](function(){return _0xbd547a;});})['then'](function(){_0x4e5331[_0x2188('0x18')](0xcc)[_0x2188('0x17')]();});}};}function handleEntityNotFound(_0xfc66b3,_0x270bf4){return function(_0x1689f8){if(!_0x1689f8){_0xfc66b3[_0x2188('0x16')](0x194);}return _0x1689f8;};}function handleError(_0x2eb1ca,_0x23f548){_0x23f548=_0x23f548||0x1f4;return function(_0x2edb38){logger[_0x2188('0x25')](_0x2edb38[_0x2188('0x26')]);if(_0x2edb38[_0x2188('0x27')]){delete _0x2edb38[_0x2188('0x27')];}_0x2eb1ca[_0x2188('0x18')](_0x23f548)['send'](_0x2edb38);};}exports[_0x2188('0x28')]=function(_0x5a80ed,_0x557e24){var _0x2dee2e={},_0x133d27={},_0x1f2e2d={'count':0x0,'rows':[]};return db[_0x2188('0x29')][_0x2188('0x2a')]()[_0x2188('0x21')](function(_0x16babc){_0x133d27['model']=_[_0x2188('0x2b')](_0x16babc);_0x133d27[_0x2188('0x2c')]=_[_0x2188('0x2b')](_0x5a80ed[_0x2188('0x2c')]);_0x133d27[_0x2188('0x2d')]=_['intersection'](_0x133d27[_0x2188('0x2e')],_0x133d27[_0x2188('0x2c')]);_0x2dee2e[_0x2188('0x2f')]=_[_0x2188('0x30')](_0x133d27[_0x2188('0x2e')],qs['fields'](_0x5a80ed['query']['fields']));_0x2dee2e[_0x2188('0x2f')]=_0x2dee2e[_0x2188('0x2f')]['length']?_0x2dee2e[_0x2188('0x2f')]:_0x133d27[_0x2188('0x2e')];if(!_0x5a80ed[_0x2188('0x2c')][_0x2188('0x31')](_0x2188('0x32'))){_0x2dee2e['limit']=qs['limit'](_0x5a80ed[_0x2188('0x2c')][_0x2188('0x1c')]);_0x2dee2e[_0x2188('0x1b')]=qs[_0x2188('0x1b')](_0x5a80ed['query']['offset']);}_0x2dee2e[_0x2188('0x33')]=qs['sort'](_0x5a80ed[_0x2188('0x2c')][_0x2188('0x34')]);_0x2dee2e[_0x2188('0x35')]=qs['filters'](_['pick'](_0x5a80ed[_0x2188('0x2c')],_0x133d27[_0x2188('0x2d')]));if(_0x5a80ed['query']['filter']){_0x2dee2e[_0x2188('0x35')]=_['merge'](_0x2dee2e[_0x2188('0x35')],{'$or':_[_0x2188('0x36')](_0x2dee2e['attributes'],function(_0x393cf){var _0x180fc2={};_0x180fc2[_0x393cf]={'$like':'%'+_0x5a80ed[_0x2188('0x2c')][_0x2188('0x37')]+'%'};return _0x180fc2;})});}_0x2dee2e=_[_0x2188('0x38')]({},_0x2dee2e,_0x5a80ed[_0x2188('0x39')]);var _0x5ed313={'where':_0x2dee2e[_0x2188('0x35')]};return db['CmCompany'][_0x2188('0x1a')](_0x5ed313)[_0x2188('0x21')](function(_0x31a49a){_0x1f2e2d['count']=_0x31a49a;if(_0x5a80ed[_0x2188('0x2c')][_0x2188('0x3a')]){_0x2dee2e[_0x2188('0x3b')]=[{'all':!![]}];}return db[_0x2188('0x29')][_0x2188('0x3c')](_0x2dee2e);})['then'](function(_0x3d827a){_0x1f2e2d[_0x2188('0x3d')]=_0x3d827a;return _0x1f2e2d;})[_0x2188('0x21')](respondWithFilteredResult(_0x557e24,_0x2dee2e))['catch'](handleError(_0x557e24,null));})[_0x2188('0x3e')](handleError(_0x557e24,null));};exports[_0x2188('0x3f')]=function(_0x47ac83,_0x2cc681){var _0x4d3d0a={'raw':![],'where':{'id':_0x47ac83['params']['id']}},_0x3243a7={};_0x3243a7['model']=_[_0x2188('0x2b')](db[_0x2188('0x29')][_0x2188('0x40')]);_0x3243a7[_0x2188('0x2c')]=_[_0x2188('0x2b')](_0x47ac83[_0x2188('0x2c')]);_0x3243a7[_0x2188('0x2d')]=_[_0x2188('0x30')](_0x3243a7[_0x2188('0x2e')],_0x3243a7[_0x2188('0x2c')]);_0x4d3d0a[_0x2188('0x2f')]=_['intersection'](_0x3243a7[_0x2188('0x2e')],qs[_0x2188('0x41')](_0x47ac83['query'][_0x2188('0x41')]));_0x4d3d0a[_0x2188('0x2f')]=_0x4d3d0a[_0x2188('0x2f')][_0x2188('0x42')]?_0x4d3d0a[_0x2188('0x2f')]:_0x3243a7[_0x2188('0x2e')];if(_0x47ac83[_0x2188('0x2c')][_0x2188('0x3a')]){_0x4d3d0a[_0x2188('0x3b')]=[{'all':!![]}];}_0x4d3d0a=_[_0x2188('0x38')]({},_0x4d3d0a,_0x47ac83[_0x2188('0x39')]);return db[_0x2188('0x29')]['find'](_0x4d3d0a)[_0x2188('0x21')](handleEntityNotFound(_0x2cc681,null))['then'](respondWithResult(_0x2cc681,null))[_0x2188('0x3e')](handleError(_0x2cc681,null));};exports[_0x2188('0x43')]=function(_0x56d436,_0x217971){return db[_0x2188('0x29')][_0x2188('0x43')](_0x56d436[_0x2188('0x44')],{})[_0x2188('0x21')](function(_0x8cbaa1){var _0x2e5790=_0x56d436[_0x2188('0x45')][_0x2188('0x23')]({'plain':!![]});if(!_0x2e5790)throw new Error(_0x2188('0x46'));if(_0x2e5790[_0x2188('0x47')]===_0x2188('0x45')){var _0x36457f=_0x8cbaa1[_0x2188('0x23')]({'plain':!![]});var _0xe6f294='Companies';return db[_0x2188('0x48')]['find']({'where':{'name':_0xe6f294,'userProfileId':_0x2e5790[_0x2188('0x49')]},'raw':!![]})[_0x2188('0x21')](function(_0x468f42){if(_0x468f42&&_0x468f42[_0x2188('0x4a')]===0x0){return db[_0x2188('0x4b')]['create']({'name':_0x36457f[_0x2188('0x27')],'resourceId':_0x36457f['id'],'type':_0x468f42['name'],'sectionId':_0x468f42['id']},{})[_0x2188('0x21')](function(){return _0x8cbaa1;});}else{return _0x8cbaa1;}})[_0x2188('0x3e')](function(_0x215eb3){logger['error'](_0x2188('0x4c'),_0x215eb3);throw _0x215eb3;});}return _0x8cbaa1;})[_0x2188('0x21')](respondWithResult(_0x217971,0xc9))[_0x2188('0x3e')](handleError(_0x217971,null));};exports[_0x2188('0x4d')]=function(_0x1859f4,_0x2498a8){if(_0x1859f4[_0x2188('0x44')]['id']){delete _0x1859f4[_0x2188('0x44')]['id'];}return db[_0x2188('0x29')][_0x2188('0x4e')]({'where':{'id':_0x1859f4[_0x2188('0x4f')]['id']}})[_0x2188('0x21')](handleEntityNotFound(_0x2498a8,null))[_0x2188('0x21')](saveUpdates(_0x1859f4[_0x2188('0x44')],null))[_0x2188('0x21')](respondWithResult(_0x2498a8,null))[_0x2188('0x3e')](handleError(_0x2498a8,null));};exports[_0x2188('0x22')]=function(_0x43f4ae,_0x3be270){return db['CmCompany'][_0x2188('0x4e')]({'where':{'id':_0x43f4ae[_0x2188('0x4f')]['id']}})[_0x2188('0x21')](handleEntityNotFound(_0x3be270,null))[_0x2188('0x21')](removeEntity(_0x3be270,null))[_0x2188('0x3e')](handleError(_0x3be270,null));};exports[_0x2188('0x2a')]=function(_0xaf755d,_0x139cb6){return db[_0x2188('0x29')][_0x2188('0x2a')]()[_0x2188('0x21')](respondWithResult(_0x139cb6,null))[_0x2188('0x3e')](handleError(_0x139cb6,null));};exports['addContacts']=function(_0x287912,_0x208433,_0x2c9a68){return db[_0x2188('0x50')]['find']({'where':{'id':_0x287912[_0x2188('0x4f')]['id']}})[_0x2188('0x21')](handleEntityNotFound(_0x208433,null))['then'](function(_0x3f927){if(_0x3f927){return _0x3f927['addContacts'](_0x287912[_0x2188('0x44')][_0x2188('0x51')],_[_0x2188('0x52')](_0x287912[_0x2188('0x44')],['ids','id'])||{});}})[_0x2188('0x21')](respondWithResult(_0x208433,null))['catch'](handleError(_0x208433,null));};exports[_0x2188('0x53')]=function(_0x21fb75,_0x408f12,_0x424a10){var _0x49adce={};var _0x364a96={};var _0x5b083a;var _0x4ab5de;return db[_0x2188('0x29')][_0x2188('0x54')]({'where':{'id':_0x21fb75[_0x2188('0x4f')]['id']}})[_0x2188('0x21')](handleEntityNotFound(_0x408f12,null))[_0x2188('0x21')](function(_0x1411d4){if(_0x1411d4){_0x5b083a=_0x1411d4;_0x364a96[_0x2188('0x2e')]=_[_0x2188('0x2b')](db[_0x2188('0x50')][_0x2188('0x40')]);_0x364a96['query']=_[_0x2188('0x2b')](_0x21fb75[_0x2188('0x2c')]);_0x364a96[_0x2188('0x2d')]=_['intersection'](_0x364a96[_0x2188('0x2e')],_0x364a96[_0x2188('0x2c')]);_0x49adce[_0x2188('0x2f')]=_[_0x2188('0x30')](_0x364a96['model'],qs['fields'](_0x21fb75['query']['fields']));_0x49adce['attributes']=_0x49adce[_0x2188('0x2f')][_0x2188('0x42')]?_0x49adce[_0x2188('0x2f')]:_0x364a96[_0x2188('0x2e')];_0x49adce[_0x2188('0x33')]=qs[_0x2188('0x34')](_0x21fb75[_0x2188('0x2c')][_0x2188('0x34')]);_0x49adce[_0x2188('0x35')]=qs[_0x2188('0x2d')](_[_0x2188('0x55')](_0x21fb75['query'],_0x364a96[_0x2188('0x2d')]));if(_0x21fb75[_0x2188('0x2c')][_0x2188('0x37')]){_0x49adce[_0x2188('0x35')]=_['merge'](_0x49adce[_0x2188('0x35')],{'$or':_[_0x2188('0x36')](_0x49adce['attributes'],function(_0x4d8ddd){var _0x1a3aab={};_0x1a3aab[_0x4d8ddd]={'$like':'%'+_0x21fb75[_0x2188('0x2c')][_0x2188('0x37')]+'%'};return _0x1a3aab;})});}_0x49adce=_['merge']({},_0x49adce,_0x21fb75[_0x2188('0x39')]);return _0x5b083a[_0x2188('0x53')](_0x49adce);}})['then'](function(_0x2532ff){if(_0x2532ff){_0x4ab5de=_0x2532ff[_0x2188('0x42')];if(!_0x21fb75[_0x2188('0x2c')][_0x2188('0x31')](_0x2188('0x32'))){_0x49adce[_0x2188('0x1c')]=qs[_0x2188('0x1c')](_0x21fb75[_0x2188('0x2c')][_0x2188('0x1c')]);_0x49adce[_0x2188('0x1b')]=qs[_0x2188('0x1b')](_0x21fb75[_0x2188('0x2c')][_0x2188('0x1b')]);}return _0x5b083a[_0x2188('0x53')](_0x49adce);}})[_0x2188('0x21')](function(_0x34533b){if(_0x34533b){return _0x34533b?{'count':_0x4ab5de,'rows':_0x34533b}:null;}})['then'](respondWithResult(_0x408f12,null))['catch'](handleError(_0x408f12,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 27d5681..c77de6f 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 _0xcb99=['../../config/logger','bluebird','request-promise','path','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies','lodash'];(function(_0x2c6814,_0x45d59a){var _0xa41250=function(_0x3df792){while(--_0x3df792){_0x2c6814['push'](_0x2c6814['shift']());}};_0xa41250(++_0x45d59a);}(_0xcb99,0x8b));var _0x9cb9=function(_0x51fb3c,_0x28a763){_0x51fb3c=_0x51fb3c-0x0;var _0x941d96=_0xcb99[_0x51fb3c];return _0x941d96;};'use strict';var _=require(_0x9cb9('0x0'));var util=require('util');var logger=require(_0x9cb9('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9cb9('0x2'));var rp=require(_0x9cb9('0x3'));var fs=require('fs');var path=require(_0x9cb9('0x4'));var rimraf=require('rimraf');var config=require(_0x9cb9('0x5'));var attributes=require(_0x9cb9('0x6'));module['exports']=function(_0x214b72,_0x509cfc){return _0x214b72[_0x9cb9('0x7')](_0x9cb9('0x8'),attributes,{'tableName':_0x9cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6379=['exports','define','lodash','util','../../config/logger','api','moment','request-promise','path','./cmCompany.attributes'];(function(_0x54e092,_0x5b6255){var _0x45e6ec=function(_0x24eda8){while(--_0x24eda8){_0x54e092['push'](_0x54e092['shift']());}};_0x45e6ec(++_0x5b6255);}(_0x6379,0x84));var _0x9637=function(_0x2dc069,_0x9fe901){_0x2dc069=_0x2dc069-0x0;var _0x24a59d=_0x6379[_0x2dc069];return _0x24a59d;};'use strict';var _=require(_0x9637('0x0'));var util=require(_0x9637('0x1'));var logger=require(_0x9637('0x2'))(_0x9637('0x3'));var moment=require(_0x9637('0x4'));var BPromise=require('bluebird');var rp=require(_0x9637('0x5'));var fs=require('fs');var path=require(_0x9637('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9637('0x7'));module[_0x9637('0x8')]=function(_0x19f7d0,_0x25087c){return _0x19f7d0[_0x9637('0x9')]('CmCompany',attributes,{'tableName':'cm_companies','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 145a491..17ee681 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 _0x2009=['error','code','CmCompany,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x27856c,_0x1e63f5){var _0x469da7=function(_0x12f354){while(--_0x12f354){_0x27856c['push'](_0x27856c['shift']());}};_0x469da7(++_0x1e63f5);}(_0x2009,0xba));var _0x9200=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2009[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9200('0x0'));var util=require(_0x9200('0x1'));var moment=require(_0x9200('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9200('0x3'));var db=require(_0x9200('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9200('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9200('0x6'));var client=jayson[_0x9200('0x7')][_0x9200('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x37170a,_0xd933a,_0x454177){return new BPromise(function(_0x1ba4d5,_0x248382){return client[_0x9200('0x9')](_0x37170a,_0x454177)[_0x9200('0xa')](function(_0x2ab1db){logger[_0x9200('0xb')]('CmCompany,\x20%s,\x20%s',_0xd933a,'request\x20sent');logger['debug'](_0x9200('0xc'),_0xd933a,'request\x20sent',JSON[_0x9200('0xd')](_0x2ab1db));if(_0x2ab1db['error']){if(_0x2ab1db[_0x9200('0xe')][_0x9200('0xf')]===0x1f4){logger[_0x9200('0xe')](_0x9200('0x10'),_0xd933a,_0x2ab1db[_0x9200('0xe')][_0x9200('0x11')]);return _0x248382(_0x2ab1db[_0x9200('0xe')][_0x9200('0x11')]);}logger[_0x9200('0xe')](_0x9200('0x10'),_0xd933a,_0x2ab1db[_0x9200('0xe')][_0x9200('0x11')]);return _0x1ba4d5(_0x2ab1db[_0x9200('0xe')][_0x9200('0x11')]);}else{logger[_0x9200('0xb')](_0x9200('0x10'),_0xd933a,'request\x20sent');_0x1ba4d5(_0x2ab1db[_0x9200('0x12')]['message']);}})[_0x9200('0x13')](function(_0x1b2e31){logger[_0x9200('0xe')](_0x9200('0x10'),_0xd933a,_0x1b2e31);_0x248382(_0x1b2e31);});});} \ No newline at end of file +var _0xd23d=['../../config/utils','../../config/environment','jayson/promise','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd23d,0x1c3));var _0xdd23=function(_0x56756b,_0x3e8cc7){_0x56756b=_0x56756b-0x0;var _0xa3002=_0xd23d[_0x56756b];return _0xa3002;};'use strict';var _=require(_0xdd23('0x0'));var util=require('util');var moment=require(_0xdd23('0x1'));var BPromise=require(_0xdd23('0x2'));var rs=require(_0xdd23('0x3'));var fs=require('fs');var Redis=require(_0xdd23('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdd23('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xdd23('0x6'));var jayson=require(_0xdd23('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x44b9a7,_0x134d5d,_0x3c5249){return new BPromise(function(_0x4bf304,_0x54acc0){return client[_0xdd23('0x8')](_0x44b9a7,_0x3c5249)['then'](function(_0x38bb79){logger[_0xdd23('0x9')](_0xdd23('0xa'),_0x134d5d,_0xdd23('0xb'));logger[_0xdd23('0xc')](_0xdd23('0xd'),_0x134d5d,_0xdd23('0xb'),JSON[_0xdd23('0xe')](_0x38bb79));if(_0x38bb79[_0xdd23('0xf')]){if(_0x38bb79[_0xdd23('0xf')][_0xdd23('0x10')]===0x1f4){logger['error'](_0xdd23('0xa'),_0x134d5d,_0x38bb79['error'][_0xdd23('0x11')]);return _0x54acc0(_0x38bb79[_0xdd23('0xf')][_0xdd23('0x11')]);}logger[_0xdd23('0xf')]('CmCompany,\x20%s,\x20%s',_0x134d5d,_0x38bb79[_0xdd23('0xf')][_0xdd23('0x11')]);return _0x4bf304(_0x38bb79[_0xdd23('0xf')]['message']);}else{logger[_0xdd23('0x9')](_0xdd23('0xa'),_0x134d5d,_0xdd23('0xb'));_0x4bf304(_0x38bb79['result'][_0xdd23('0x11')]);}})[_0xdd23('0x12')](function(_0x2091df){logger[_0xdd23('0xf')](_0xdd23('0xa'),_0x134d5d,_0x2091df);_0x54acc0(_0x2091df);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 8596052..55268ce 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 _0xdb28=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','describe','get','/:id','show','getContacts','post','create','addContacts','put','destroy','exports','multer','util'];(function(_0x7391fb,_0x5f8133){var _0x55dbfd=function(_0x3fdd65){while(--_0x3fdd65){_0x7391fb['push'](_0x7391fb['shift']());}};_0x55dbfd(++_0x5f8133);}(_0xdb28,0x106));var _0x8db2=function(_0xa2f3fe,_0x1d5c29){_0xa2f3fe=_0xa2f3fe-0x0;var _0xd47571=_0xdb28[_0xa2f3fe];return _0xd47571;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var auth=require(_0x8db2('0x5'));var interaction=require(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var controller=require(_0x8db2('0x8'));router['get']('/',auth[_0x8db2('0x9')](),controller[_0x8db2('0xa')]);router['get']('/describe',auth[_0x8db2('0x9')](),controller[_0x8db2('0xb')]);router[_0x8db2('0xc')](_0x8db2('0xd'),auth[_0x8db2('0x9')](),controller[_0x8db2('0xe')]);router[_0x8db2('0xc')]('/:id/contacts',auth[_0x8db2('0x9')](),controller[_0x8db2('0xf')]);router[_0x8db2('0x10')]('/',auth['isAuthenticated'](),controller[_0x8db2('0x11')]);router[_0x8db2('0x10')]('/:id/contacts',auth[_0x8db2('0x9')](),controller[_0x8db2('0x12')]);router[_0x8db2('0x13')](_0x8db2('0xd'),auth[_0x8db2('0x9')](),controller['update']);router['delete'](_0x8db2('0xd'),auth[_0x8db2('0x9')](),controller[_0x8db2('0x14')]);module[_0x8db2('0x15')]=router; \ No newline at end of file +var _0x5c3c=['get','isAuthenticated','index','/:id','show','getContacts','create','post','addContacts','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller'];(function(_0x3d9468,_0x344121){var _0x5449a4=function(_0x777861){while(--_0x777861){_0x3d9468['push'](_0x3d9468['shift']());}};_0x5449a4(++_0x344121);}(_0x5c3c,0x132));var _0xc5c3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5c3c[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var path=require(_0xc5c3('0x2'));var timeout=require(_0xc5c3('0x3'));var express=require('express');var router=express[_0xc5c3('0x4')]();var auth=require(_0xc5c3('0x5'));var interaction=require(_0xc5c3('0x6'));var config=require(_0xc5c3('0x7'));var controller=require(_0xc5c3('0x8'));router[_0xc5c3('0x9')]('/',auth[_0xc5c3('0xa')](),controller[_0xc5c3('0xb')]);router[_0xc5c3('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc5c3('0x9')](_0xc5c3('0xc'),auth['isAuthenticated'](),controller[_0xc5c3('0xd')]);router[_0xc5c3('0x9')]('/:id/contacts',auth[_0xc5c3('0xa')](),controller[_0xc5c3('0xe')]);router['post']('/',auth[_0xc5c3('0xa')](),controller[_0xc5c3('0xf')]);router[_0xc5c3('0x10')]('/:id/contacts',auth[_0xc5c3('0xa')](),controller[_0xc5c3('0x11')]);router['put'](_0xc5c3('0xc'),auth[_0xc5c3('0xa')](),controller[_0xc5c3('0x12')]);router['delete'](_0xc5c3('0xc'),auth[_0xc5c3('0xa')](),controller[_0xc5c3('0x13')]);module[_0xc5c3('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 7ea9a54..4400fa7 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 _0x787d=['TEXT','INTEGER','UNSIGNED','lodash','exports','STRING'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x787d,0xab));var _0xd787=function(_0x3d4ef1,_0x5a957c){_0x3d4ef1=_0x3d4ef1-0x0;var _0x409423=_0x787d[_0x3d4ef1];return _0x409423;};'use strict';var _=require(_0xd787('0x0'));var Sequelize=require('sequelize');module[_0xd787('0x1')]={'firstName':{'type':Sequelize[_0xd787('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xd787('0x2')]},'postalCode':{'type':Sequelize[_0xd787('0x2')]},'city':{'type':Sequelize[_0xd787('0x2')]},'country':{'type':Sequelize[_0xd787('0x2')]},'dateOfBirth':{'type':Sequelize[_0xd787('0x2')]},'description':{'type':Sequelize[_0xd787('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xd787('0x2')]},'fax':{'type':Sequelize[_0xd787('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xd787('0x2')]},'facebook':{'type':Sequelize[_0xd787('0x2')]},'fb_data':{'type':Sequelize[_0xd787('0x2')]},'twitter':{'type':Sequelize[_0xd787('0x2')]},'skype':{'type':Sequelize[_0xd787('0x2')]},'teams':{'type':Sequelize[_0xd787('0x2')]},'viber':{'type':Sequelize[_0xd787('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xd787('0x2')]},'UserId':{'type':Sequelize[_0xd787('0x4')]},'priority':{'type':Sequelize[_0xd787('0x4')](0x2)[_0xd787('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x3d62=['DATE','NOW','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x18a4b6,_0x105565){var _0x5a972c=function(_0x1f2d37){while(--_0x1f2d37){_0x18a4b6['push'](_0x18a4b6['shift']());}};_0x5a972c(++_0x105565);}(_0x3d62,0x128));var _0x23d6=function(_0x4c9885,_0x3a60d3){_0x4c9885=_0x4c9885-0x0;var _0x1f5e5d=_0x3d62[_0x4c9885];return _0x1f5e5d;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0x23d6('0x0')]={'firstName':{'type':Sequelize[_0x23d6('0x1')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x23d6('0x1')]},'postalCode':{'type':Sequelize[_0x23d6('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x23d6('0x1')]},'dateOfBirth':{'type':Sequelize[_0x23d6('0x1')]},'description':{'type':Sequelize[_0x23d6('0x2')]},'phone':{'type':Sequelize[_0x23d6('0x1')]},'mobile':{'type':Sequelize[_0x23d6('0x1')]},'fax':{'type':Sequelize[_0x23d6('0x1')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x23d6('0x1')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x23d6('0x1')]},'teams':{'type':Sequelize[_0x23d6('0x1')]},'viber':{'type':Sequelize[_0x23d6('0x1')]},'line':{'type':Sequelize[_0x23d6('0x1')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x23d6('0x1')]},'UserId':{'type':Sequelize[_0x23d6('0x3')]},'priority':{'type':Sequelize[_0x23d6('0x3')](0x2)[_0x23d6('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x23d6('0x5')],'defaultValue':Sequelize[_0x23d6('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index c87237e..71a3549 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 _0x6d4d=['html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','defaults','redis','socket.io-emitter','./cmContact.socket','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','CmContact','length','keys','startsWith','cf_','push','CmCustomField','findOne','trimStart','all','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','select','field','color','from','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','tools_tags','t.id\x20=\x20ct.TagId','where','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','conditions','find','value','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','DATE','buildExpression','start','Contact','isEmpty','forEach','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','filter','replace','\x27\x27\x27\x27','split','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?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','QueryTypes','clone','DESC','having','t.id\x20IN\x20?','some','user','getLists','c.ListId\x20IS\x20NULL','toString','keyBy','merge','c.phone','c.fax','c.email','c.ListId','c.deletedAt','TagIds','sequelize','Tags','rows','catch','destroy','params','describe','tags','columnName','displayName','findAll','alias','values','body','get','mergeWith','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatInteraction','ChatOfflineMessage','MailMessage','MailInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','duplicates','$or','ListId','findOrCreate','show','$and','format','cf_%d','omit','table','cm_contacts','setFields','id\x20=\x20?','toParam','text','phone','getTags','rawAttributes','setTags','ids','getHoppers','ContactId','options','includeAll','include','getJscriptySessions','uploadCsv','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','firstName','server/files/tmp','file','chmodSync','0777','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','meta','import','binding','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','child_process','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process'];(function(_0xdb42fc,_0x15da61){var _0x1a0952=function(_0x279361){while(--_0x279361){_0xdb42fc['push'](_0xdb42fc['shift']());}};_0x1a0952(++_0x15da61);}(_0x6d4d,0xe6));var _0xd6d4=function(_0x48d2f9,_0x2e4981){_0x48d2f9=_0x48d2f9-0x0;var _0x2d9527=_0x6d4d[_0x48d2f9];return _0x2d9527;};'use strict';var pdf=require(_0xd6d4('0x0'));var emlformat=require(_0xd6d4('0x1'));var rimraf=require(_0xd6d4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd6d4('0x3'));var rp=require(_0xd6d4('0x4'));var moment=require(_0xd6d4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd6d4('0x6'));var util=require(_0xd6d4('0x7'));var path=require(_0xd6d4('0x8'));var sox=require(_0xd6d4('0x9'));var csv=require(_0xd6d4('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd6d4('0xb'));var squel=require('squel');var crypto=require(_0xd6d4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd6d4('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd6d4('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd6d4('0xf'));var qs=require(_0xd6d4('0x10'));var as=require(_0xd6d4('0x11'));var hardwareService=require(_0xd6d4('0x12'));var logger=require(_0xd6d4('0x13'))('api');var utils=require(_0xd6d4('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0xd6d4('0x15')](config[_0xd6d4('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xd6d4('0x17'))(new Redis(config[_0xd6d4('0x16')]));require(_0xd6d4('0x18'))['register'](socket);function respondWithStatusCode(_0x1ec23f,_0x5854d3){_0x5854d3=_0x5854d3||0xcc;return function(_0x1281f1){if(_0x1281f1){return _0x1ec23f['sendStatus'](_0x5854d3);}return _0x1ec23f[_0xd6d4('0x19')](_0x5854d3)[_0xd6d4('0x1a')]();};}function respondWithResult(_0x4b6296,_0x14a345){_0x14a345=_0x14a345||0xc8;return function(_0x4e554f){if(_0x4e554f){return _0x4b6296['status'](_0x14a345)[_0xd6d4('0x1b')](_0x4e554f);}};}function respondWithFilteredResult(_0x498d01,_0x1b5c33){return function(_0x5d6682){if(_0x5d6682){var _0x557ddc=_0x5d6682[_0xd6d4('0x1c')],_0x1c5286=_0x1b5c33['offset'],_0x51cf42=_0x1b5c33[_0xd6d4('0x1d')]+_0x1b5c33['limit'],_0x4bd38c;if(_0x51cf42>=_0x557ddc){_0x51cf42=_0x557ddc;_0x4bd38c=0xc8;}else{_0x4bd38c=0xce;}_0x498d01[_0xd6d4('0x19')](_0x4bd38c);return _0x498d01['set'](_0xd6d4('0x1e'),_0x1c5286+'-'+_0x51cf42+'/'+_0x557ddc)[_0xd6d4('0x1b')](_0x5d6682);}return null;};}function patchUpdates(_0x1c3b70){return function(_0x1d9ecd){try{jsonpatch[_0xd6d4('0x1f')](_0x1d9ecd,_0x1c3b70,!![]);}catch(_0x2f6618){return BPromise[_0xd6d4('0x20')](_0x2f6618);}return _0x1d9ecd[_0xd6d4('0x21')]();};}function saveUpdates(_0x1b98ea,_0x581ffe){return function(_0x3de548){if(_0x3de548){return _0x3de548[_0xd6d4('0x22')](_0x1b98ea)[_0xd6d4('0x23')](function(_0x4c31f2){return _0x4c31f2;});}return null;};}function removeEntity(_0x54de43,_0xd15b49){return function(_0x5b672f){if(_0x5b672f){return _0x5b672f['destroy']()[_0xd6d4('0x23')](function(){_0x54de43[_0xd6d4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x509f97,_0x56cf02){return function(_0x5902e0){if(!_0x5902e0){_0x509f97[_0xd6d4('0x24')](0x194);}return _0x5902e0;};}function handleError(_0x3e2508,_0x17ba16){_0x17ba16=_0x17ba16||0x1f4;return function(_0x48963d){logger[_0xd6d4('0x25')](_0x48963d[_0xd6d4('0x26')]);if(_0x48963d[_0xd6d4('0x27')]){delete _0x48963d[_0xd6d4('0x27')];}_0x3e2508['status'](_0x17ba16)[_0xd6d4('0x28')](_0x48963d);};}exports[_0xd6d4('0x29')]=function(_0x1166d4,_0x1f9f9a){var _0x4f395f={},_0x5d0bb8={},_0x26b8fc={'count':0x0,'rows':[]};return db[_0xd6d4('0x2a')]['describe']()[_0xd6d4('0x23')](function(_0x1ab93f){var _0xdd8ff1=[];for(var _0x68d7e8=0x0;_0x68d7e80x1){_0x466780['or'](_0xd6d4('0x6a'),qs[_0xd6d4('0x6b')](_0xab701b),null);}else{if(qs['isNumeric'](_0xab701b)){_0x466780['or'](_0xd6d4('0x6c'),_0xab701b+'%');_0x466780['or']('c.phone\x20LIKE\x20?',_0xab701b+'%');_0x466780['or'](_0xd6d4('0x6d'),_0xab701b+'%');_0x466780['or'](_0xd6d4('0x6e'),_0xab701b+'%');}else if(qs[_0xd6d4('0x6f')](_0xab701b)){_0x466780['or'](_0xd6d4('0x70'),_0xab701b+'%');}else{_0x466780['or'](_0xd6d4('0x71'),'%'+_0xab701b+'%');_0x466780['or'](_0xd6d4('0x72'),'%'+_0xab701b+'%');_0x466780['or'](_0xd6d4('0x70'),'%'+_0xab701b+'%');}}}}_0x3daf33[_0xd6d4('0x4b')](_0x466780);_0x3daf33[_0xd6d4('0x73')](_0xd6d4('0x74'));var _0x47067f={'type':db['Sequelize'][_0xd6d4('0x75')]['SELECT'],'raw':!![]};var _0x3df2e5=_0x3daf33[_0xd6d4('0x76')]()[_0xd6d4('0x43')](_0xd6d4('0x74'));if(_0x4f395f['order']){_0x4f395f['order']['forEach'](function(_0x5d4cb3){_0x3daf33['order']('c.'+_0x5d4cb3[0x0],_0x5d4cb3[0x1]===_0xd6d4('0x77')?![]:!![]);});}if(!_['isEmpty'](_0x25e034)){_0x3daf33[_0xd6d4('0x78')](_0x3af1f1);_0x3df2e5[_0xd6d4('0x4b')](_0xd6d4('0x79'),_0x25e034);}BPromise['resolve']()[_0xd6d4('0x23')](function(){if(_0x4f064d&&!_[_0xd6d4('0x7a')](_0x4f064d[_0xd6d4('0x50')],[_0xd6d4('0x43'),_0xd6d4('0x56')])){return _0x1166d4[_0xd6d4('0x7b')][_0xd6d4('0x7c')]({'attributes':['id'],'raw':!![]})[_0xd6d4('0x23')](function(_0x2291a8){if(_[_0xd6d4('0x60')](_0x2291a8)){_0x3df2e5[_0xd6d4('0x4b')](_0xd6d4('0x7d'));_0x3daf33[_0xd6d4('0x4b')](_0xd6d4('0x7d'));}else{_0x3df2e5[_0xd6d4('0x4b')]('c.ListId\x20IN\x20?',_['map'](_0x2291a8,'id'));_0x3daf33[_0xd6d4('0x4b')](_0xd6d4('0x62'),_['map'](_0x2291a8,'id'));}});}else{return;}})[_0xd6d4('0x23')](function(){db['sequelize'][_0xd6d4('0x37')](_0x3df2e5['toString'](),_0x47067f)[_0xd6d4('0x23')](function(_0x56867a){_0x26b8fc['count']=_0x56867a[_0xd6d4('0x2b')];if(_0x26b8fc[_0xd6d4('0x1c')]===0x0)return[];return db['sequelize'][_0xd6d4('0x37')](_0x51c6b5[_0xd6d4('0x7e')](),_0x47067f);})[_0xd6d4('0x23')](function(_0x52101d){_0x4ff6f1=_[_0xd6d4('0x7f')](_0x52101d,'id');_0x47067f=_[_0xd6d4('0x80')](_0x47067f,{'model':db[_0xd6d4('0x2a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1166d4[_0xd6d4('0x37')]['fields']){_0x4f395f[_0xd6d4('0x3a')][_0xd6d4('0x61')](function(_0xa2588d){_0x3daf33[_0xd6d4('0x43')]('c.'+_0xa2588d);});}else{_0x3daf33[_0xd6d4('0x43')](_0xd6d4('0x74'));_0x3daf33[_0xd6d4('0x43')]('c.firstName');_0x3daf33[_0xd6d4('0x43')]('c.lastName');_0x3daf33[_0xd6d4('0x43')](_0xd6d4('0x81'));_0x3daf33['field']('c.mobile');_0x3daf33[_0xd6d4('0x43')](_0xd6d4('0x82'));_0x3daf33[_0xd6d4('0x43')](_0xd6d4('0x83'));_0x3daf33[_0xd6d4('0x43')](_0xd6d4('0x84'));_0x3daf33[_0xd6d4('0x43')](_0xd6d4('0x85'));_0x3daf33[_0xd6d4('0x43')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xd6d4('0x86'));}if(_0x4f395f[_0xd6d4('0x3e')])_0x3daf33[_0xd6d4('0x3e')](_0x4f395f[_0xd6d4('0x3e')]);if(_0x4f395f['offset'])_0x3daf33[_0xd6d4('0x1d')](_0x4f395f[_0xd6d4('0x1d')]);return db[_0xd6d4('0x87')][_0xd6d4('0x37')](_0x3daf33[_0xd6d4('0x7e')](),_0x47067f);})[_0xd6d4('0x23')](function(_0xc3629d){_0xc3629d['forEach'](function(_0x46147a){if(_0x46147a[_0xd6d4('0x86')]){_0x46147a[_0xd6d4('0x88')]=[];_0x46147a[_0xd6d4('0x86')][_0xd6d4('0x69')](',')[_0xd6d4('0x61')](function(_0x127969){_0x46147a[_0xd6d4('0x88')][_0xd6d4('0x2f')](_0x4ff6f1[_0x127969]);});}delete _0x46147a['TagIds'];});_0x26b8fc[_0xd6d4('0x89')]=_0xc3629d;return _0x26b8fc;})[_0xd6d4('0x23')](respondWithFilteredResult(_0x1f9f9a,_0x4f395f));});})[_0xd6d4('0x8a')](handleError(_0x1f9f9a,null));};exports[_0xd6d4('0x8b')]=function(_0x5e6c09,_0x4f914c){return db['CmContact'][_0xd6d4('0x51')]({'where':{'id':_0x5e6c09[_0xd6d4('0x8c')]['id']}})[_0xd6d4('0x23')](handleEntityNotFound(_0x4f914c,null))['then'](removeEntity(_0x4f914c,null))[_0xd6d4('0x8a')](handleError(_0x4f914c,null));};exports['describe']=function(_0x5a1959,_0x48fc3e){return db[_0xd6d4('0x2a')][_0xd6d4('0x8d')]()[_0xd6d4('0x23')](function(_0x34ab06){delete _0x34ab06[_0xd6d4('0x8e')];for(var _0x2f8b69=0x0;_0x2f8b69=_0x47a969){_0x1cd4b8=_0x47a969;_0x1ac1b3=0xc8;}else{_0x1ac1b3=0xce;}_0x46bfb2[_0x081b('0x1f')](_0x1ac1b3);return _0x46bfb2[_0x081b('0x23')](_0x081b('0x24'),_0x4e39fc+'-'+_0x1cd4b8+'/'+_0x47a969)[_0x081b('0x25')](_0x5e11c3);}return null;};}function patchUpdates(_0x95c8a){return function(_0x5b3b8e){try{jsonpatch['apply'](_0x5b3b8e,_0x95c8a,!![]);}catch(_0x2bd35e){return BPromise[_0x081b('0x26')](_0x2bd35e);}return _0x5b3b8e[_0x081b('0x27')]();};}function saveUpdates(_0x2c517c,_0x2e6f54){return function(_0x14c520){if(_0x14c520){return _0x14c520[_0x081b('0x28')](_0x2c517c)[_0x081b('0x29')](function(_0x4114e8){return _0x4114e8;});}return null;};}function removeEntity(_0x4b458f,_0x2e3ff3){return function(_0x561b42){if(_0x561b42){return _0x561b42['destroy']()[_0x081b('0x29')](function(){_0x4b458f[_0x081b('0x1f')](0xcc)[_0x081b('0x1e')]();});}};}function handleEntityNotFound(_0x1981f1,_0x461839){return function(_0x101404){if(!_0x101404){_0x1981f1[_0x081b('0x2a')](0x194);}return _0x101404;};}function handleError(_0x439ec6,_0x47c16c){_0x47c16c=_0x47c16c||0x1f4;return function(_0x2fd65d){logger[_0x081b('0x2b')](_0x2fd65d[_0x081b('0x2c')]);if(_0x2fd65d[_0x081b('0x2d')]){delete _0x2fd65d['name'];}_0x439ec6[_0x081b('0x1f')](_0x47c16c)[_0x081b('0x2e')](_0x2fd65d);};}exports[_0x081b('0x2f')]=function(_0x5295a6,_0x4bbc17){var _0xdf56df={},_0x2fec49={},_0x18155a={'count':0x0,'rows':[]};return db[_0x081b('0x30')][_0x081b('0x31')]()[_0x081b('0x29')](function(_0x5e5653){var _0x39d012=[];for(var _0x2ac563=0x0;_0x2ac5630x1){_0x23fe20['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x29561a),null);}else{if(qs['isNumeric'](_0x29561a)){_0x23fe20['or'](_0x081b('0x70'),_0x29561a+'%');_0x23fe20['or'](_0x081b('0x71'),_0x29561a+'%');_0x23fe20['or'](_0x081b('0x72'),_0x29561a+'%');_0x23fe20['or'](_0x081b('0x73'),_0x29561a+'%');}else if(qs[_0x081b('0x74')](_0x29561a)){_0x23fe20['or'](_0x081b('0x75'),_0x29561a+'%');}else{_0x23fe20['or'](_0x081b('0x76'),'%'+_0x29561a+'%');_0x23fe20['or'](_0x081b('0x77'),'%'+_0x29561a+'%');_0x23fe20['or'](_0x081b('0x75'),'%'+_0x29561a+'%');}}}}_0x30be7a['where'](_0x23fe20);_0x30be7a[_0x081b('0x78')](_0x081b('0x79'));var _0x2d19b8={'type':db[_0x081b('0x7a')]['QueryTypes'][_0x081b('0x7b')],'raw':!![]};var _0xba0235=_0x30be7a[_0x081b('0x7c')]()['field'](_0x081b('0x79'));if(_0xdf56df[_0x081b('0x41')]){_0xdf56df['order'][_0x081b('0x58')](function(_0xf8c053){_0x30be7a['order']('c.'+_0xf8c053[0x0],_0xf8c053[0x1]==='DESC'?![]:!![]);});}if(!_[_0x081b('0x7d')](_0x10adf3)){_0x30be7a['having'](_0x1a6fae);_0xba0235[_0x081b('0x43')](_0x081b('0x7e'),_0x10adf3);}BPromise[_0x081b('0x7f')]()[_0x081b('0x29')](function(){if(_0x435e4f&&!_['some'](_0x435e4f[_0x081b('0x53')],[_0x081b('0x46'),_0x081b('0x80')])){return _0x5295a6[_0x081b('0x81')][_0x081b('0x82')]({'attributes':['id'],'raw':!![]})[_0x081b('0x29')](function(_0x590458){if(_[_0x081b('0x7d')](_0x590458)){_0xba0235['where'](_0x081b('0x83'));_0x30be7a['where'](_0x081b('0x83'));}else{_0xba0235[_0x081b('0x43')](_0x081b('0x84'),_[_0x081b('0x63')](_0x590458,'id'));_0x30be7a['where'](_0x081b('0x84'),_[_0x081b('0x63')](_0x590458,'id'));}});}else{return;}})[_0x081b('0x29')](function(){db['sequelize'][_0x081b('0x3c')](_0xba0235[_0x081b('0x85')](),_0x2d19b8)[_0x081b('0x29')](function(_0x588498){_0x18155a[_0x081b('0x20')]=_0x588498[_0x081b('0x38')];if(_0x18155a[_0x081b('0x20')]===0x0)return[];return db[_0x081b('0x86')][_0x081b('0x3c')](_0x449fc3[_0x081b('0x85')](),_0x2d19b8);})[_0x081b('0x29')](function(_0x4b5924){_0x5976f2=_['keyBy'](_0x4b5924,'id');_0x2d19b8=_['merge'](_0x2d19b8,{'model':db[_0x081b('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5295a6['query'][_0x081b('0x3e')]){_0xdf56df[_0x081b('0x3d')]['forEach'](function(_0x6f1169){_0x30be7a['field']('c.'+_0x6f1169);});}else{_0x30be7a[_0x081b('0x46')](_0x081b('0x79'));_0x30be7a['field'](_0x081b('0x87'));_0x30be7a['field'](_0x081b('0x88'));_0x30be7a[_0x081b('0x46')](_0x081b('0x89'));_0x30be7a[_0x081b('0x46')]('c.mobile');_0x30be7a[_0x081b('0x46')](_0x081b('0x8a'));_0x30be7a[_0x081b('0x46')]('c.email');_0x30be7a[_0x081b('0x46')](_0x081b('0x8b'));_0x30be7a[_0x081b('0x46')](_0x081b('0x8c'));_0x30be7a[_0x081b('0x46')](_0x081b('0x8d'),'TagIds');}if(_0xdf56df[_0x081b('0x22')])_0x30be7a['limit'](_0xdf56df[_0x081b('0x22')]);if(_0xdf56df['offset'])_0x30be7a['offset'](_0xdf56df[_0x081b('0x21')]);return db['sequelize'][_0x081b('0x3c')](_0x30be7a[_0x081b('0x85')](),_0x2d19b8);})['then'](function(_0x5d92c4){_0x5d92c4[_0x081b('0x58')](function(_0x2c71ea){if(_0x2c71ea['TagIds']){_0x2c71ea[_0x081b('0x8e')]=[];_0x2c71ea[_0x081b('0x8f')][_0x081b('0x57')](',')['forEach'](function(_0xc3eef2){_0x2c71ea['Tags'][_0x081b('0x67')](_0x5976f2[_0xc3eef2]);});}delete _0x2c71ea[_0x081b('0x8f')];});_0x18155a[_0x081b('0x90')]=_0x5d92c4;return _0x18155a;})[_0x081b('0x29')](respondWithFilteredResult(_0x4bbc17,_0xdf56df));});})['catch'](handleError(_0x4bbc17,null));};exports['destroy']=function(_0x3f7aeb,_0xaf8924){return db[_0x081b('0x30')][_0x081b('0x54')]({'where':{'id':_0x3f7aeb[_0x081b('0x91')]['id']}})['then'](handleEntityNotFound(_0xaf8924,null))[_0x081b('0x29')](removeEntity(_0xaf8924,null))[_0x081b('0x92')](handleError(_0xaf8924,null));};exports[_0x081b('0x31')]=function(_0x2d9f50,_0x191aa1){return db[_0x081b('0x30')][_0x081b('0x31')]()['then'](function(_0x19245b){delete _0x19245b[_0x081b('0x93')];for(var _0x3b1761=0x0;_0x3b1761{}\s\\|]/g,'-');_0x3f0257(null,util[_0xe032('0x21')]('%s-%s%s',path[_0xe032('0x22')](_0x4608e4[_0xe032('0x1f')],path[_0xe032('0x23')](_0x4608e4[_0xe032('0x1f')])),Date[_0xe032('0x24')](),path[_0xe032('0x23')](_0x4608e4[_0xe032('0x1f')])));}})});router[_0xe032('0x16')]('/csv',upload['single']('file'),controller[_0xe032('0x25')]);var upload=multer({'storage':multer[_0xe032('0x1d')]({'destination':function(_0x302559,_0x2a56e5,_0x2bfe8f){_0x2bfe8f(null,path[_0xe032('0x26')](config[_0xe032('0x1e')],_0xe032('0x27')));},'filename':function(_0x4dcbf1,_0x1ac20b,_0x5bb36a){_0x1ac20b[_0xe032('0x1f')]=_0x1ac20b[_0xe032('0x1f')][_0xe032('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5bb36a(null,util[_0xe032('0x21')]('%s-%s%s',path['basename'](_0x1ac20b[_0xe032('0x1f')],path[_0xe032('0x23')](_0x1ac20b[_0xe032('0x1f')])),Date[_0xe032('0x24')](),path['extname'](_0x1ac20b['originalname'])));}})});router['post'](_0xe032('0x28'),upload[_0xe032('0x29')](_0xe032('0x2a')),controller[_0xe032('0x2b')]);router['post'](_0xe032('0x2c'),auth[_0xe032('0x8')](),controller[_0xe032('0x2d')]);router[_0xe032('0x2e')](_0xe032('0xc'),auth['isAuthenticated'](),controller[_0xe032('0x2f')]);router[_0xe032('0x30')](_0xe032('0xc'),auth[_0xe032('0x8')](),controller['destroy']);module[_0xe032('0x31')]=router; \ No newline at end of file +var _0x24ca=['update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/jscripty_sessions','getJscriptySessions','post','/merge','create','bulkCreate','setTags','diskStorage','join','root','server/files/tmp','originalname','replace','format','%s-%s%s','now','/csv','single','file','basename','extname','/upload','import','put'];(function(_0x1486b9,_0x4bb5e7){var _0x442774=function(_0x4c4da8){while(--_0x4c4da8){_0x1486b9['push'](_0x1486b9['shift']());}};_0x442774(++_0x4bb5e7);}(_0x24ca,0x1bc));var _0xa24c=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0x24ca[_0x245afe];return _0x4eefde;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var auth=require(_0xa24c('0x4'));var interaction=require(_0xa24c('0x5'));var config=require(_0xa24c('0x6'));var controller=require(_0xa24c('0x7'));router[_0xa24c('0x8')]('/',auth[_0xa24c('0x9')](),controller[_0xa24c('0xa')]);router[_0xa24c('0x8')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xc')]);router['get'](_0xa24c('0xd'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xe')]);router['get'](_0xa24c('0xf'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x10')]);router[_0xa24c('0x8')](_0xa24c('0x11'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x12')]);router[_0xa24c('0x8')](_0xa24c('0x13'),auth['isAuthenticated'](),controller[_0xa24c('0x14')]);router[_0xa24c('0x8')](_0xa24c('0x15'),auth[_0xa24c('0x9')](),controller['getHopperFinals']);router[_0xa24c('0x8')](_0xa24c('0x16'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x17')]);router[_0xa24c('0x18')](_0xa24c('0x19'),auth[_0xa24c('0x9')](),controller['merge']);router['post']('/',auth[_0xa24c('0x9')](),controller[_0xa24c('0x1a')]);router['post']('/create_many',auth[_0xa24c('0x9')](),controller[_0xa24c('0x1b')]);router['post'](_0xa24c('0xf'),auth['isAuthenticated'](),controller[_0xa24c('0x1c')]);var upload=multer({'storage':multer[_0xa24c('0x1d')]({'destination':function(_0x1fcd4b,_0xefdbd9,_0x4ff97c){_0x4ff97c(null,path[_0xa24c('0x1e')](config[_0xa24c('0x1f')],_0xa24c('0x20')));},'filename':function(_0x4d4bab,_0x48a768,_0x506424){_0x48a768['originalname']=_0x48a768[_0xa24c('0x21')][_0xa24c('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x506424(null,util[_0xa24c('0x23')](_0xa24c('0x24'),path['basename'](_0x48a768[_0xa24c('0x21')],path['extname'](_0x48a768[_0xa24c('0x21')])),Date[_0xa24c('0x25')](),path['extname'](_0x48a768[_0xa24c('0x21')])));}})});router[_0xa24c('0x18')](_0xa24c('0x26'),upload[_0xa24c('0x27')](_0xa24c('0x28')),controller['uploadCsv']);var upload=multer({'storage':multer[_0xa24c('0x1d')]({'destination':function(_0x5cc9cb,_0x2365f9,_0x3951ae){_0x3951ae(null,path[_0xa24c('0x1e')](config['root'],_0xa24c('0x20')));},'filename':function(_0x31c4d9,_0x14fd5a,_0x314121){_0x14fd5a[_0xa24c('0x21')]=_0x14fd5a[_0xa24c('0x21')][_0xa24c('0x22')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x314121(null,util['format'](_0xa24c('0x24'),path[_0xa24c('0x29')](_0x14fd5a[_0xa24c('0x21')],path[_0xa24c('0x2a')](_0x14fd5a['originalname'])),Date[_0xa24c('0x25')](),path[_0xa24c('0x2a')](_0x14fd5a[_0xa24c('0x21')])));}})});router['post'](_0xa24c('0x2b'),upload[_0xa24c('0x27')](_0xa24c('0x28')),controller['upload']);router[_0xa24c('0x18')]('/upload/:id',auth[_0xa24c('0x9')](),controller[_0xa24c('0x2c')]);router[_0xa24c('0x2d')]('/:id',auth[_0xa24c('0x9')](),controller[_0xa24c('0x2e')]);router[_0xa24c('0x2f')]('/:id',auth[_0xa24c('0x9')](),controller['destroy']);module[_0xa24c('0x30')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 99a18b7..3a3d8a8 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 _0xa8a3=['select','parse','values','isArray','BOOLEAN','sequelize','lodash','exports','alias','STRING','setDataValue','TEXT','long','getDataValue'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xa8a3,0x91));var _0x3a8a=function(_0x481c4d,_0x5aa6d8){_0x481c4d=_0x481c4d-0x0;var _0x5ba457=_0xa8a3[_0x481c4d];return _0x5ba457;};'use strict';var Sequelize=require(_0x3a8a('0x0'));var _=require(_0x3a8a('0x1'));module[_0x3a8a('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x44e293){return this['getDataValue'](_0x3a8a('0x3'));}},'alias':{'type':Sequelize[_0x3a8a('0x4')],'allowNull':![],'set':function(_0x2d0253){this[_0x3a8a('0x5')](_0x3a8a('0x3'),_0x2d0253?_0x2d0253:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x3a8a('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x3a8a('0x6')](_0x3a8a('0x7')),'get':function(){if(this[_0x3a8a('0x8')]('type')===_0x3a8a('0x9')){return JSON[_0x3a8a('0xa')](this[_0x3a8a('0x8')](_0x3a8a('0xb')));}else{return this[_0x3a8a('0x8')](_0x3a8a('0xb'));}},'set':function(_0x40ab0f){if(Array[_0x3a8a('0xc')](_0x40ab0f)){this[_0x3a8a('0x5')]('values',JSON['stringify'](_0x40ab0f));}else{this[_0x3a8a('0x5')](_0x3a8a('0xb'),_0x40ab0f);}}},'required':{'type':Sequelize[_0x3a8a('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x06b1=['type','parse','values','isArray','stringify','BOOLEAN','sequelize','lodash','exports','getDataValue','alias','setDataValue','name','TEXT','long'];(function(_0x44b7b7,_0x4d15dc){var _0x5c2cfa=function(_0x3d1d3e){while(--_0x3d1d3e){_0x44b7b7['push'](_0x44b7b7['shift']());}};_0x5c2cfa(++_0x4d15dc);}(_0x06b1,0x1b9));var _0x106b=function(_0x2402a2,_0xcfa397){_0x2402a2=_0x2402a2-0x0;var _0x3002fc=_0x06b1[_0x2402a2];return _0x3002fc;};'use strict';var Sequelize=require(_0x106b('0x0'));var _=require(_0x106b('0x1'));module[_0x106b('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x653830){return this[_0x106b('0x3')](_0x106b('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x52e328){this[_0x106b('0x5')]('alias',_0x52e328?_0x52e328:this[_0x106b('0x3')](_0x106b('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x106b('0x7')](_0x106b('0x8')),'get':function(){if(this[_0x106b('0x3')](_0x106b('0x9'))==='select'){return JSON[_0x106b('0xa')](this[_0x106b('0x3')](_0x106b('0xb')));}else{return this[_0x106b('0x3')]('values');}},'set':function(_0x46ef3a){if(Array[_0x106b('0xc')](_0x46ef3a)){this[_0x106b('0x5')](_0x106b('0xb'),JSON[_0x106b('0xd')](_0x46ef3a));}else{this['setDataValue']('values',_0x46ef3a);}}},'required':{'type':Sequelize[_0x106b('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index a5f88b1..86dff2d 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 _0x4b47=['index','map','CmCustomField','fieldName','type','key','model','differenceBy','name','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','filter','VIRTUAL','merge','include','findAll','show','params','rawAttributes','includeAll','find','body','catch','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','format','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','apply','reject','save','then','error','stack'];(function(_0x352713,_0x737610){var _0x46a4ea=function(_0x379929){while(--_0x379929){_0x352713['push'](_0x352713['shift']());}};_0x46a4ea(++_0x737610);}(_0x4b47,0x1d8));var _0x74b4=function(_0x64de5f,_0x581672){_0x64de5f=_0x64de5f-0x0;var _0x30e076=_0x4b47[_0x64de5f];return _0x30e076;};'use strict';var pdf=require(_0x74b4('0x0'));var emlformat=require(_0x74b4('0x1'));var rimraf=require(_0x74b4('0x2'));var zipdir=require(_0x74b4('0x3'));var jsonpatch=require(_0x74b4('0x4'));var rp=require(_0x74b4('0x5'));var moment=require('moment');var BPromise=require(_0x74b4('0x6'));var Mustache=require('mustache');var util=require(_0x74b4('0x7'));var path=require(_0x74b4('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x74b4('0x9'));var fs=require('fs');var _=require(_0x74b4('0xa'));var squel=require(_0x74b4('0xb'));var crypto=require('crypto');var jsforce=require(_0x74b4('0xc'));var deskjs=require(_0x74b4('0xd'));var toCsv=require(_0x74b4('0xe'));var querystring=require(_0x74b4('0xf'));var Papa=require(_0x74b4('0x10'));var Redis=require(_0x74b4('0x11'));var authService=require(_0x74b4('0x12'));var qs=require(_0x74b4('0x13'));var as=require(_0x74b4('0x14'));var hardwareService=require(_0x74b4('0x15'));var logger=require(_0x74b4('0x16'))(_0x74b4('0x17'));var utils=require('../../config/utils');var config=require(_0x74b4('0x18'));var db=require(_0x74b4('0x19'))['db'];function respondWithStatusCode(_0x37d686,_0x1cd304){_0x1cd304=_0x1cd304||0xcc;return function(_0x847ace){if(_0x847ace){return _0x37d686[_0x74b4('0x1a')](_0x1cd304);}return _0x37d686[_0x74b4('0x1b')](_0x1cd304)[_0x74b4('0x1c')]();};}function respondWithResult(_0x1756c2,_0x1cb215){_0x1cb215=_0x1cb215||0xc8;return function(_0x38b7c9){if(_0x38b7c9){return _0x1756c2[_0x74b4('0x1b')](_0x1cb215)[_0x74b4('0x1d')](_0x38b7c9);}};}function respondWithFilteredResult(_0x3f2c1d,_0x5562ef){return function(_0x49a6e8){if(_0x49a6e8){var _0x123867=_0x49a6e8[_0x74b4('0x1e')],_0x1c3bd6=_0x5562ef[_0x74b4('0x1f')],_0x41fb85=_0x5562ef[_0x74b4('0x1f')]+_0x5562ef['limit'],_0x14dbc2;if(_0x41fb85>=_0x123867){_0x41fb85=_0x123867;_0x14dbc2=0xc8;}else{_0x14dbc2=0xce;}_0x3f2c1d[_0x74b4('0x1b')](_0x14dbc2);return _0x3f2c1d['set']('Content-Range',_0x1c3bd6+'-'+_0x41fb85+'/'+_0x123867)[_0x74b4('0x1d')](_0x49a6e8);}return null;};}function patchUpdates(_0x1dc4fa){return function(_0xccbe9e){try{jsonpatch[_0x74b4('0x20')](_0xccbe9e,_0x1dc4fa,!![]);}catch(_0x5cd84c){return BPromise[_0x74b4('0x21')](_0x5cd84c);}return _0xccbe9e[_0x74b4('0x22')]();};}function saveUpdates(_0x312876,_0x4f0cc5){return function(_0x17cc10){if(_0x17cc10){return _0x17cc10['update'](_0x312876)[_0x74b4('0x23')](function(_0x1f8540){return _0x1f8540;});}return null;};}function removeEntity(_0x5908eb,_0x2f1305){return function(_0x399bc2){if(_0x399bc2){return _0x399bc2['destroy']()['then'](function(){_0x5908eb[_0x74b4('0x1b')](0xcc)[_0x74b4('0x1c')]();});}};}function handleEntityNotFound(_0x54db20,_0x27493a){return function(_0x43b911){if(!_0x43b911){_0x54db20['sendStatus'](0x194);}return _0x43b911;};}function handleError(_0x3ef444,_0x1c7e72){_0x1c7e72=_0x1c7e72||0x1f4;return function(_0x31045e){logger[_0x74b4('0x24')](_0x31045e[_0x74b4('0x25')]);if(_0x31045e['name']){delete _0x31045e['name'];}_0x3ef444[_0x74b4('0x1b')](_0x1c7e72)['send'](_0x31045e);};}exports[_0x74b4('0x26')]=function(_0x38c77e,_0x537d8e){var _0x5a6dec={},_0xb9b5bf={},_0x2f6f1d={'count':0x0,'rows':[]};var _0x35f81b=_[_0x74b4('0x27')](db[_0x74b4('0x28')]['rawAttributes'],function(_0x2139ac){return{'name':_0x2139ac[_0x74b4('0x29')],'type':_0x2139ac[_0x74b4('0x2a')][_0x74b4('0x2b')]};});_0xb9b5bf[_0x74b4('0x2c')]=_[_0x74b4('0x2d')](_[_0x74b4('0x27')](_0x35f81b,'name'),[_0x74b4('0x2e')]);_0xb9b5bf[_0x74b4('0x2f')]=_[_0x74b4('0x30')](_0x38c77e[_0x74b4('0x2f')]);_0xb9b5bf['filters']=_[_0x74b4('0x31')](_0xb9b5bf[_0x74b4('0x2c')],_0xb9b5bf[_0x74b4('0x2f')]);_0x5a6dec[_0x74b4('0x32')]=_[_0x74b4('0x31')](_0xb9b5bf[_0x74b4('0x2c')],qs['fields'](_0x38c77e['query'][_0x74b4('0x33')]));_0x5a6dec[_0x74b4('0x32')]=_0x5a6dec['attributes'][_0x74b4('0x34')]?_0x5a6dec['attributes']:_0xb9b5bf['model'];if(!_0x38c77e['query']['hasOwnProperty'](_0x74b4('0x35'))){_0x5a6dec[_0x74b4('0x36')]=qs[_0x74b4('0x36')](_0x38c77e['query']['limit']);_0x5a6dec['offset']=qs[_0x74b4('0x1f')](_0x38c77e[_0x74b4('0x2f')]['offset']);}_0x5a6dec[_0x74b4('0x37')]=qs[_0x74b4('0x38')](_0x38c77e['query'][_0x74b4('0x38')]);_0x5a6dec[_0x74b4('0x39')]=qs['filters'](_['pick'](_0x38c77e[_0x74b4('0x2f')],_0xb9b5bf[_0x74b4('0x3a')]));if(_0x38c77e[_0x74b4('0x2f')][_0x74b4('0x3b')]){_0x5a6dec[_0x74b4('0x39')]=_['merge'](_0x5a6dec['where'],{'$or':_['map'](_0x35f81b,function(_0x55f60b){if(_0x55f60b['type']!==_0x74b4('0x3c')){var _0x353226={};_0x353226[_0x55f60b[_0x74b4('0x2e')]]={'$like':'%'+_0x38c77e['query'][_0x74b4('0x3b')]+'%'};return _0x353226;}})});}_0x5a6dec=_[_0x74b4('0x3d')]({},_0x5a6dec,_0x38c77e['options']);var _0x3d6a98={'where':_0x5a6dec[_0x74b4('0x39')]};return db['CmCustomField']['count'](_0x3d6a98)[_0x74b4('0x23')](function(_0x3664a2){_0x2f6f1d[_0x74b4('0x1e')]=_0x3664a2;if(_0x38c77e[_0x74b4('0x2f')]['includeAll']){_0x5a6dec[_0x74b4('0x3e')]=[{'all':!![]}];}return db['CmCustomField'][_0x74b4('0x3f')](_0x5a6dec);})['then'](function(_0x290092){_0x2f6f1d['rows']=_0x290092;return _0x2f6f1d;})[_0x74b4('0x23')](respondWithFilteredResult(_0x537d8e,_0x5a6dec))['catch'](handleError(_0x537d8e,null));};exports[_0x74b4('0x40')]=function(_0x29852e,_0x574c48){var _0x30d020={'raw':!![],'where':{'id':_0x29852e[_0x74b4('0x41')]['id']}},_0x458286={};_0x458286['model']=_[_0x74b4('0x30')](db[_0x74b4('0x28')][_0x74b4('0x42')]);_0x458286[_0x74b4('0x2f')]=_[_0x74b4('0x30')](_0x29852e[_0x74b4('0x2f')]);_0x458286[_0x74b4('0x3a')]=_[_0x74b4('0x31')](_0x458286[_0x74b4('0x2c')],_0x458286['query']);_0x30d020[_0x74b4('0x32')]=_[_0x74b4('0x31')](_0x458286['model'],qs[_0x74b4('0x33')](_0x29852e[_0x74b4('0x2f')]['fields']));_0x30d020['attributes']=_0x30d020[_0x74b4('0x32')][_0x74b4('0x34')]?_0x30d020[_0x74b4('0x32')]:_0x458286[_0x74b4('0x2c')];if(_0x29852e[_0x74b4('0x2f')][_0x74b4('0x43')]){_0x30d020[_0x74b4('0x3e')]=[{'all':!![]}];}_0x30d020=_['merge']({},_0x30d020,_0x29852e['options']);return db[_0x74b4('0x28')][_0x74b4('0x44')](_0x30d020)['then'](handleEntityNotFound(_0x574c48,null))[_0x74b4('0x23')](respondWithResult(_0x574c48,null))['catch'](handleError(_0x574c48,null));};exports['update']=function(_0x4f7121,_0x211fed){if(_0x4f7121['body']['id']){delete _0x4f7121['body']['id'];}return db[_0x74b4('0x28')][_0x74b4('0x44')]({'where':{'id':_0x4f7121[_0x74b4('0x41')]['id']}})[_0x74b4('0x23')](handleEntityNotFound(_0x211fed,null))[_0x74b4('0x23')](saveUpdates(_0x4f7121[_0x74b4('0x45')],null))[_0x74b4('0x23')](respondWithResult(_0x211fed,null))[_0x74b4('0x46')](handleError(_0x211fed,null));};exports['destroy']=function(_0x37f6a1,_0x28b6fd){return db['CmCustomField'][_0x74b4('0x44')]({'where':{'id':_0x37f6a1[_0x74b4('0x41')]['id']}})[_0x74b4('0x23')](handleEntityNotFound(_0x28b6fd,null))[_0x74b4('0x23')](removeEntity(_0x28b6fd,null))['catch'](handleError(_0x28b6fd,null));};exports[_0x74b4('0x47')]=function(_0x589607,_0x16800f){var _0x272809;return db[_0x74b4('0x48')][_0x74b4('0x49')](function(_0x46dc12){return db[_0x74b4('0x28')][_0x74b4('0x47')](_0x589607[_0x74b4('0x45')],{'transaction':_0x46dc12})['then'](function(_0x3340dc){_0x272809=_0x3340dc;var _0xe2a788={'type':db[_0x74b4('0x4a')][_0x74b4('0x4b')],'transaction':_0x46dc12};switch(_0x589607[_0x74b4('0x45')][_0x74b4('0x2a')]){case _0x74b4('0x4c'):_0xe2a788[_0x74b4('0x2a')]=db['Sequelize'][_0x74b4('0x4b')];break;case _0x74b4('0x4d'):_0xe2a788[_0x74b4('0x2a')]=db[_0x74b4('0x4a')][_0x74b4('0x4e')];break;case _0x74b4('0x4f'):_0xe2a788[_0x74b4('0x2a')]=db[_0x74b4('0x4a')][_0x74b4('0x50')];_0xe2a788[_0x74b4('0x51')]=![];break;default:}return db[_0x74b4('0x48')][_0x74b4('0x52')][_0x74b4('0x53')]('cm_contacts',util[_0x74b4('0x54')]('cf_%d',_0x272809['id']),_0xe2a788);})[_0x74b4('0x23')](function(){return _0x272809;});})[_0x74b4('0x23')](respondWithResult(_0x16800f,0xc9))[_0x74b4('0x46')](handleError(_0x16800f,null));}; \ No newline at end of file +var _0xa250=['sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','CmCustomField','rawAttributes','fieldName','key','model','differenceBy','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','type','options','includeAll','include','findAll','rows','catch','show','params','length','merge','body','find','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','BOOLEAN','defaultValue','queryInterface','cm_contacts','format','cf_%d','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/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x4c153f,_0xf272e6){var _0x1f6c07=function(_0x48284c){while(--_0x48284c){_0x4c153f['push'](_0x4c153f['shift']());}};_0x1f6c07(++_0xf272e6);}(_0xa250,0x1b3));var _0x0a25=function(_0xc971a4,_0x5b381c){_0xc971a4=_0xc971a4-0x0;var _0x4ebd6b=_0xa250[_0xc971a4];return _0x4ebd6b;};'use strict';var pdf=require(_0x0a25('0x0'));var emlformat=require(_0x0a25('0x1'));var rimraf=require(_0x0a25('0x2'));var zipdir=require(_0x0a25('0x3'));var jsonpatch=require(_0x0a25('0x4'));var rp=require(_0x0a25('0x5'));var moment=require(_0x0a25('0x6'));var BPromise=require(_0x0a25('0x7'));var Mustache=require(_0x0a25('0x8'));var util=require(_0x0a25('0x9'));var path=require(_0x0a25('0xa'));var sox=require(_0x0a25('0xb'));var csv=require(_0x0a25('0xc'));var ejs=require(_0x0a25('0xd'));var fs=require('fs');var _=require(_0x0a25('0xe'));var squel=require(_0x0a25('0xf'));var crypto=require(_0x0a25('0x10'));var jsforce=require(_0x0a25('0x11'));var deskjs=require(_0x0a25('0x12'));var toCsv=require(_0x0a25('0xc'));var querystring=require(_0x0a25('0x13'));var Papa=require(_0x0a25('0x14'));var Redis=require(_0x0a25('0x15'));var authService=require(_0x0a25('0x16'));var qs=require(_0x0a25('0x17'));var as=require(_0x0a25('0x18'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0a25('0x19'))(_0x0a25('0x1a'));var utils=require(_0x0a25('0x1b'));var config=require(_0x0a25('0x1c'));var db=require(_0x0a25('0x1d'))['db'];function respondWithStatusCode(_0x431c15,_0xf7e86a){_0xf7e86a=_0xf7e86a||0xcc;return function(_0x2bda66){if(_0x2bda66){return _0x431c15[_0x0a25('0x1e')](_0xf7e86a);}return _0x431c15['status'](_0xf7e86a)[_0x0a25('0x1f')]();};}function respondWithResult(_0x3d0001,_0x4d5c56){_0x4d5c56=_0x4d5c56||0xc8;return function(_0x40e6d5){if(_0x40e6d5){return _0x3d0001[_0x0a25('0x20')](_0x4d5c56)[_0x0a25('0x21')](_0x40e6d5);}};}function respondWithFilteredResult(_0x1f7f01,_0x141999){return function(_0x4df19c){if(_0x4df19c){var _0x5c0e5d=_0x4df19c[_0x0a25('0x22')],_0x1adfb5=_0x141999[_0x0a25('0x23')],_0x39a6b8=_0x141999['offset']+_0x141999[_0x0a25('0x24')],_0x4ed5cf;if(_0x39a6b8>=_0x5c0e5d){_0x39a6b8=_0x5c0e5d;_0x4ed5cf=0xc8;}else{_0x4ed5cf=0xce;}_0x1f7f01[_0x0a25('0x20')](_0x4ed5cf);return _0x1f7f01[_0x0a25('0x25')](_0x0a25('0x26'),_0x1adfb5+'-'+_0x39a6b8+'/'+_0x5c0e5d)[_0x0a25('0x21')](_0x4df19c);}return null;};}function patchUpdates(_0x1c1ff9){return function(_0x3b5514){try{jsonpatch[_0x0a25('0x27')](_0x3b5514,_0x1c1ff9,!![]);}catch(_0x1dcc6c){return BPromise[_0x0a25('0x28')](_0x1dcc6c);}return _0x3b5514[_0x0a25('0x29')]();};}function saveUpdates(_0x159de0,_0x24bd4d){return function(_0xdd296b){if(_0xdd296b){return _0xdd296b[_0x0a25('0x2a')](_0x159de0)[_0x0a25('0x2b')](function(_0x2c260f){return _0x2c260f;});}return null;};}function removeEntity(_0x2a3865,_0x3dee71){return function(_0x313a53){if(_0x313a53){return _0x313a53[_0x0a25('0x2c')]()[_0x0a25('0x2b')](function(){_0x2a3865['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55fd10,_0x37924a){return function(_0x1e6b45){if(!_0x1e6b45){_0x55fd10[_0x0a25('0x1e')](0x194);}return _0x1e6b45;};}function handleError(_0x362373,_0x5c2c3a){_0x5c2c3a=_0x5c2c3a||0x1f4;return function(_0x30ceff){logger[_0x0a25('0x2d')](_0x30ceff[_0x0a25('0x2e')]);if(_0x30ceff[_0x0a25('0x2f')]){delete _0x30ceff[_0x0a25('0x2f')];}_0x362373[_0x0a25('0x20')](_0x5c2c3a)[_0x0a25('0x30')](_0x30ceff);};}exports['index']=function(_0x5c9fd8,_0x31f4da){var _0x32c150={},_0x23c9c5={},_0x4d0971={'count':0x0,'rows':[]};var _0x3f8687=_[_0x0a25('0x31')](db[_0x0a25('0x32')][_0x0a25('0x33')],function(_0x13eb67){return{'name':_0x13eb67[_0x0a25('0x34')],'type':_0x13eb67['type'][_0x0a25('0x35')]};});_0x23c9c5[_0x0a25('0x36')]=_[_0x0a25('0x37')](_[_0x0a25('0x31')](_0x3f8687,_0x0a25('0x2f')),[_0x0a25('0x2f')]);_0x23c9c5['query']=_[_0x0a25('0x38')](_0x5c9fd8[_0x0a25('0x39')]);_0x23c9c5[_0x0a25('0x3a')]=_[_0x0a25('0x3b')](_0x23c9c5['model'],_0x23c9c5[_0x0a25('0x39')]);_0x32c150[_0x0a25('0x3c')]=_[_0x0a25('0x3b')](_0x23c9c5['model'],qs['fields'](_0x5c9fd8[_0x0a25('0x39')][_0x0a25('0x3d')]));_0x32c150[_0x0a25('0x3c')]=_0x32c150[_0x0a25('0x3c')]['length']?_0x32c150['attributes']:_0x23c9c5[_0x0a25('0x36')];if(!_0x5c9fd8[_0x0a25('0x39')][_0x0a25('0x3e')]('nolimit')){_0x32c150[_0x0a25('0x24')]=qs[_0x0a25('0x24')](_0x5c9fd8[_0x0a25('0x39')][_0x0a25('0x24')]);_0x32c150[_0x0a25('0x23')]=qs[_0x0a25('0x23')](_0x5c9fd8[_0x0a25('0x39')][_0x0a25('0x23')]);}_0x32c150[_0x0a25('0x3f')]=qs[_0x0a25('0x40')](_0x5c9fd8[_0x0a25('0x39')]['sort']);_0x32c150[_0x0a25('0x41')]=qs[_0x0a25('0x3a')](_['pick'](_0x5c9fd8[_0x0a25('0x39')],_0x23c9c5[_0x0a25('0x3a')]));if(_0x5c9fd8[_0x0a25('0x39')][_0x0a25('0x42')]){_0x32c150[_0x0a25('0x41')]=_['merge'](_0x32c150[_0x0a25('0x41')],{'$or':_[_0x0a25('0x31')](_0x3f8687,function(_0x1bcc9b){if(_0x1bcc9b[_0x0a25('0x43')]!=='VIRTUAL'){var _0x4f49ec={};_0x4f49ec[_0x1bcc9b[_0x0a25('0x2f')]]={'$like':'%'+_0x5c9fd8[_0x0a25('0x39')]['filter']+'%'};return _0x4f49ec;}})});}_0x32c150=_['merge']({},_0x32c150,_0x5c9fd8[_0x0a25('0x44')]);var _0x968126={'where':_0x32c150[_0x0a25('0x41')]};return db[_0x0a25('0x32')][_0x0a25('0x22')](_0x968126)['then'](function(_0x295c06){_0x4d0971['count']=_0x295c06;if(_0x5c9fd8[_0x0a25('0x39')][_0x0a25('0x45')]){_0x32c150[_0x0a25('0x46')]=[{'all':!![]}];}return db[_0x0a25('0x32')][_0x0a25('0x47')](_0x32c150);})[_0x0a25('0x2b')](function(_0x5b6c88){_0x4d0971[_0x0a25('0x48')]=_0x5b6c88;return _0x4d0971;})[_0x0a25('0x2b')](respondWithFilteredResult(_0x31f4da,_0x32c150))[_0x0a25('0x49')](handleError(_0x31f4da,null));};exports[_0x0a25('0x4a')]=function(_0x2c32e3,_0x5e3949){var _0x1fb4d3={'raw':!![],'where':{'id':_0x2c32e3[_0x0a25('0x4b')]['id']}},_0x56fab1={};_0x56fab1[_0x0a25('0x36')]=_[_0x0a25('0x38')](db[_0x0a25('0x32')]['rawAttributes']);_0x56fab1['query']=_['keys'](_0x2c32e3[_0x0a25('0x39')]);_0x56fab1[_0x0a25('0x3a')]=_[_0x0a25('0x3b')](_0x56fab1[_0x0a25('0x36')],_0x56fab1['query']);_0x1fb4d3[_0x0a25('0x3c')]=_[_0x0a25('0x3b')](_0x56fab1[_0x0a25('0x36')],qs[_0x0a25('0x3d')](_0x2c32e3[_0x0a25('0x39')][_0x0a25('0x3d')]));_0x1fb4d3['attributes']=_0x1fb4d3[_0x0a25('0x3c')][_0x0a25('0x4c')]?_0x1fb4d3['attributes']:_0x56fab1[_0x0a25('0x36')];if(_0x2c32e3[_0x0a25('0x39')][_0x0a25('0x45')]){_0x1fb4d3[_0x0a25('0x46')]=[{'all':!![]}];}_0x1fb4d3=_[_0x0a25('0x4d')]({},_0x1fb4d3,_0x2c32e3[_0x0a25('0x44')]);return db['CmCustomField']['find'](_0x1fb4d3)[_0x0a25('0x2b')](handleEntityNotFound(_0x5e3949,null))['then'](respondWithResult(_0x5e3949,null))[_0x0a25('0x49')](handleError(_0x5e3949,null));};exports[_0x0a25('0x2a')]=function(_0xf9bd98,_0x367197){if(_0xf9bd98[_0x0a25('0x4e')]['id']){delete _0xf9bd98[_0x0a25('0x4e')]['id'];}return db[_0x0a25('0x32')][_0x0a25('0x4f')]({'where':{'id':_0xf9bd98['params']['id']}})[_0x0a25('0x2b')](handleEntityNotFound(_0x367197,null))[_0x0a25('0x2b')](saveUpdates(_0xf9bd98[_0x0a25('0x4e')],null))[_0x0a25('0x2b')](respondWithResult(_0x367197,null))[_0x0a25('0x49')](handleError(_0x367197,null));};exports[_0x0a25('0x2c')]=function(_0x3552d1,_0x3e52ea){return db['CmCustomField']['find']({'where':{'id':_0x3552d1[_0x0a25('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3e52ea,null))['then'](removeEntity(_0x3e52ea,null))[_0x0a25('0x49')](handleError(_0x3e52ea,null));};exports[_0x0a25('0x50')]=function(_0x1a3e1d,_0x39ab18){var _0x1fe5e9;return db[_0x0a25('0x51')][_0x0a25('0x52')](function(_0x10fb40){return db[_0x0a25('0x32')][_0x0a25('0x50')](_0x1a3e1d['body'],{'transaction':_0x10fb40})[_0x0a25('0x2b')](function(_0x3f776a){_0x1fe5e9=_0x3f776a;var _0x13f33b={'type':db[_0x0a25('0x53')]['TEXT'],'transaction':_0x10fb40};switch(_0x1a3e1d['body'][_0x0a25('0x43')]){case'text':_0x13f33b['type']=db['Sequelize'][_0x0a25('0x54')];break;case _0x0a25('0x55'):_0x13f33b[_0x0a25('0x43')]=db['Sequelize'][_0x0a25('0x56')];break;case'switch':_0x13f33b[_0x0a25('0x43')]=db[_0x0a25('0x53')][_0x0a25('0x57')];_0x13f33b[_0x0a25('0x58')]=![];break;default:}return db['sequelize'][_0x0a25('0x59')]['addColumn'](_0x0a25('0x5a'),util[_0x0a25('0x5b')](_0x0a25('0x5c'),_0x1fe5e9['id']),_0x13f33b);})[_0x0a25('0x2b')](function(){return _0x1fe5e9;});})[_0x0a25('0x2b')](respondWithResult(_0x39ab18,0xc9))[_0x0a25('0x49')](handleError(_0x39ab18,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 4577caf..e1f5a1d 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 _0x9643=['CmCustomField','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x2c1aa8,_0x3e0609){var _0x4019f5=function(_0x916eac){while(--_0x916eac){_0x2c1aa8['push'](_0x2c1aa8['shift']());}};_0x4019f5(++_0x3e0609);}(_0x9643,0x1da));var _0x3964=function(_0x1ce81a,_0x374b46){_0x1ce81a=_0x1ce81a-0x0;var _0x393125=_0x9643[_0x1ce81a];return _0x393125;};'use strict';var _=require('lodash');var util=require(_0x3964('0x0'));var logger=require(_0x3964('0x1'))(_0x3964('0x2'));var moment=require(_0x3964('0x3'));var BPromise=require(_0x3964('0x4'));var rp=require(_0x3964('0x5'));var fs=require('fs');var path=require(_0x3964('0x6'));var rimraf=require(_0x3964('0x7'));var config=require(_0x3964('0x8'));var attributes=require('./cmCustomField.attributes');module[_0x3964('0x9')]=function(_0x4265d3,_0x17f75d){return _0x4265d3['define'](_0x3964('0xa'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85a6=['CmCustomField','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x85a6,0x1cd));var _0x685a=function(_0x1da43c,_0x4a1061){_0x1da43c=_0x1da43c-0x0;var _0x4c1f41=_0x85a6[_0x1da43c];return _0x4c1f41;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x685a('0x0'))('api');var moment=require('moment');var BPromise=require(_0x685a('0x1'));var rp=require(_0x685a('0x2'));var fs=require('fs');var path=require(_0x685a('0x3'));var rimraf=require(_0x685a('0x4'));var config=require(_0x685a('0x5'));var attributes=require(_0x685a('0x6'));module[_0x685a('0x7')]=function(_0x31ff90,_0x4b784f){return _0x31ff90[_0x685a('0x8')](_0x685a('0x9'),attributes,{'tableName':'cm_custom_fields','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 ef663c8..7416b85 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 _0x5b02=['client','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x24c57b,_0x2ab0c0){var _0x1d0146=function(_0x420e86){while(--_0x420e86){_0x24c57b['push'](_0x24c57b['shift']());}};_0x1d0146(++_0x2ab0c0);}(_0x5b02,0xe9));var _0x25b0=function(_0x30f506,_0xb40dcb){_0x30f506=_0x30f506-0x0;var _0x5e564f=_0x5b02[_0x30f506];return _0x5e564f;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var moment=require(_0x25b0('0x2'));var BPromise=require(_0x25b0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x25b0('0x5'))(_0x25b0('0x6'));var config=require(_0x25b0('0x7'));var jayson=require(_0x25b0('0x8'));var client=jayson[_0x25b0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d82c6,_0xd8276d,_0x49ef3a){return new BPromise(function(_0x412954,_0x4d3e71){return client['request'](_0x1d82c6,_0x49ef3a)[_0x25b0('0xa')](function(_0x45429b){logger[_0x25b0('0xb')]('CmCustomField,\x20%s,\x20%s',_0xd8276d,_0x25b0('0xc'));logger[_0x25b0('0xd')](_0x25b0('0xe'),_0xd8276d,_0x25b0('0xc'),JSON[_0x25b0('0xf')](_0x45429b));if(_0x45429b[_0x25b0('0x10')]){if(_0x45429b[_0x25b0('0x10')][_0x25b0('0x11')]===0x1f4){logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);return _0x4d3e71(_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);}logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);return _0x412954(_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);}else{logger[_0x25b0('0xb')]('CmCustomField,\x20%s,\x20%s',_0xd8276d,'request\x20sent');_0x412954(_0x45429b[_0x25b0('0x14')]['message']);}})[_0x25b0('0x15')](function(_0x1d009f){logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x1d009f);_0x4d3e71(_0x1d009f);});});} \ No newline at end of file +var _0x2750=['jayson/promise','http','request','then','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x226a89,_0x55c004){var _0x2c58ed=function(_0x1226ee){while(--_0x1226ee){_0x226a89['push'](_0x226a89['shift']());}};_0x2c58ed(++_0x55c004);}(_0x2750,0x13b));var _0x0275=function(_0x9a8af2,_0x1ea185){_0x9a8af2=_0x9a8af2-0x0;var _0x304c12=_0x2750[_0x9a8af2];return _0x304c12;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var moment=require(_0x0275('0x1'));var BPromise=require(_0x0275('0x2'));var rs=require(_0x0275('0x3'));var fs=require('fs');var Redis=require(_0x0275('0x4'));var db=require(_0x0275('0x5'))['db'];var utils=require(_0x0275('0x6'));var logger=require(_0x0275('0x7'))(_0x0275('0x8'));var config=require(_0x0275('0x9'));var jayson=require(_0x0275('0xa'));var client=jayson['client'][_0x0275('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2421fd,_0x2fa0eb,_0x2e4b5c){return new BPromise(function(_0x4dffd1,_0x1f7c4a){return client[_0x0275('0xc')](_0x2421fd,_0x2e4b5c)[_0x0275('0xd')](function(_0x5e0e4a){logger['info'](_0x0275('0xe'),_0x2fa0eb,'request\x20sent');logger[_0x0275('0xf')](_0x0275('0x10'),_0x2fa0eb,_0x0275('0x11'),JSON[_0x0275('0x12')](_0x5e0e4a));if(_0x5e0e4a[_0x0275('0x13')]){if(_0x5e0e4a['error'][_0x0275('0x14')]===0x1f4){logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a['error']['message']);return _0x1f7c4a(_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);}logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);return _0x4dffd1(_0x5e0e4a['error'][_0x0275('0x15')]);}else{logger[_0x0275('0x16')]('CmCustomField,\x20%s,\x20%s',_0x2fa0eb,_0x0275('0x11'));_0x4dffd1(_0x5e0e4a[_0x0275('0x17')]['message']);}})[_0x0275('0x18')](function(_0x31c76b){logger['error']('CmCustomField,\x20%s,\x20%s',_0x2fa0eb,_0x31c76b);_0x1f7c4a(_0x31c76b);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 79778d8..b0d18e2 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 _0xaada=['isAuthenticated','index','/:id','show','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller'];(function(_0x5b0c3a,_0x133e0b){var _0x547655=function(_0x3da464){while(--_0x3da464){_0x5b0c3a['push'](_0x5b0c3a['shift']());}};_0x547655(++_0x133e0b);}(_0xaada,0x1d7));var _0xaaad=function(_0x5deb2d,_0x16ea89){_0x5deb2d=_0x5deb2d-0x0;var _0x45b63a=_0xaada[_0x5deb2d];return _0x45b63a;};'use strict';var multer=require(_0xaaad('0x0'));var util=require('util');var path=require(_0xaaad('0x1'));var timeout=require(_0xaaad('0x2'));var express=require(_0xaaad('0x3'));var router=express[_0xaaad('0x4')]();var auth=require(_0xaaad('0x5'));var interaction=require(_0xaaad('0x6'));var config=require(_0xaaad('0x7'));var controller=require(_0xaaad('0x8'));router['get']('/',auth[_0xaaad('0x9')](),controller[_0xaaad('0xa')]);router['get'](_0xaaad('0xb'),auth['isAuthenticated'](),controller[_0xaaad('0xc')]);router['post']('/',auth[_0xaaad('0x9')](),controller['create']);router['put'](_0xaaad('0xb'),auth[_0xaaad('0x9')](),controller['update']);router[_0xaaad('0xd')]('/:id',auth[_0xaaad('0x9')](),controller[_0xaaad('0xe')]);module[_0xaaad('0xf')]=router; \ No newline at end of file +var _0x9a6b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','show','post','put','/:id','update','delete','destroy','exports','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a6b,0x13e));var _0xb9a6=function(_0x576abb,_0xf86689){_0x576abb=_0x576abb-0x0;var _0xa4b48d=_0x9a6b[_0x576abb];return _0xa4b48d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb9a6('0x0'));var router=express[_0xb9a6('0x1')]();var auth=require(_0xb9a6('0x2'));var interaction=require(_0xb9a6('0x3'));var config=require(_0xb9a6('0x4'));var controller=require(_0xb9a6('0x5'));router[_0xb9a6('0x6')]('/',auth[_0xb9a6('0x7')](),controller['index']);router['get']('/:id',auth[_0xb9a6('0x7')](),controller[_0xb9a6('0x8')]);router[_0xb9a6('0x9')]('/',auth[_0xb9a6('0x7')](),controller['create']);router[_0xb9a6('0xa')](_0xb9a6('0xb'),auth['isAuthenticated'](),controller[_0xb9a6('0xc')]);router[_0xb9a6('0xd')](_0xb9a6('0xb'),auth[_0xb9a6('0x7')](),controller[_0xb9a6('0xe')]);module[_0xb9a6('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 42fc2fb..8101d93 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 _0x2123=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','format'];(function(_0x4b53d3,_0x19db52){var _0x15b95d=function(_0x379926){while(--_0x379926){_0x4b53d3['push'](_0x4b53d3['shift']());}};_0x15b95d(++_0x19db52);}(_0x2123,0x190));var _0x3212=function(_0x235f9c,_0x3cd957){_0x235f9c=_0x235f9c-0x0;var _0x2d363b=_0x2123[_0x235f9c];return _0x2d363b;};'use strict';var moment=require(_0x3212('0x0'));var Sequelize=require(_0x3212('0x1'));module[_0x3212('0x2')]={'phone':{'type':Sequelize[_0x3212('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x3212('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x3212('0x5')],'defaultValue':moment()[_0x3212('0x6')](_0x3212('0x7'))},'countbusyretry':{'type':Sequelize[_0x3212('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3212('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3212('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x3212('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3212('0x5')]},'priority':{'type':Sequelize[_0x3212('0x8')](0x2)[_0x3212('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x3212('0x8')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x3212('0x8')],'unique':_0x3212('0xa')},'UserId':{'type':Sequelize[_0x3212('0x8')]},'VoiceQueueId':{'type':Sequelize[_0x3212('0x8')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x3212('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3212('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3212('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3212('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3212('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe0ae=['contactListQueue','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','BOOLEAN'];(function(_0x42bafd,_0x3f0fe3){var _0x2ed705=function(_0x4311ea){while(--_0x4311ea){_0x42bafd['push'](_0x42bafd['shift']());}};_0x2ed705(++_0x3f0fe3);}(_0xe0ae,0xa1));var _0xee0a=function(_0x54f3e8,_0x3ed493){_0x54f3e8=_0x54f3e8-0x0;var _0x267b37=_0xe0ae[_0x54f3e8];return _0x267b37;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xee0a('0x0')]={'phone':{'type':Sequelize[_0xee0a('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xee0a('0x2')],'defaultValue':moment()['format'](_0xee0a('0x3'))},'countbusyretry':{'type':Sequelize[_0xee0a('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xee0a('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xee0a('0x2')]},'priority':{'type':Sequelize[_0xee0a('0x4')](0x2)[_0xee0a('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xee0a('0x6')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xee0a('0x7')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0xee0a('0x4')]},'VoiceQueueId':{'type':Sequelize[_0xee0a('0x4')],'unique':_0xee0a('0x7')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xee0a('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xee0a('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xee0a('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 0de433e..fb58052 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 _0x842d=['user','UserId','format','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','create','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','priority','scheduledAt','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledat','UPDATE','Contact','Company','CmList','List','Queue','update','getOpenContacts','isNumber','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','json','apply','reject','save','then','destroy','error','stack','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','concat','$and','$or','$gt','$ne','$eq','$not','$between','$in','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','CmHopper','findAll','rows','show','params','includeAll','find','catch','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','state','deleted','campaign','membername'];(function(_0x83b05d,_0x4bea86){var _0x5d9f2c=function(_0x377866){while(--_0x377866){_0x83b05d['push'](_0x83b05d['shift']());}};_0x5d9f2c(++_0x4bea86);}(_0x842d,0x156));var _0xd842=function(_0x4e93a9,_0x413f30){_0x4e93a9=_0x4e93a9-0x0;var _0x43013c=_0x842d[_0x4e93a9];return _0x43013c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd842('0x0'));var rimraf=require(_0xd842('0x1'));var zipdir=require(_0xd842('0x2'));var jsonpatch=require(_0xd842('0x3'));var rp=require(_0xd842('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd842('0x5'));var util=require(_0xd842('0x6'));var path=require(_0xd842('0x7'));var sox=require(_0xd842('0x8'));var csv=require('to-csv');var ejs=require(_0xd842('0x9'));var fs=require('fs');var _=require(_0xd842('0xa'));var squel=require('squel');var crypto=require(_0xd842('0xb'));var jsforce=require(_0xd842('0xc'));var deskjs=require(_0xd842('0xd'));var toCsv=require(_0xd842('0xe'));var querystring=require(_0xd842('0xf'));var Papa=require('papaparse');var Redis=require(_0xd842('0x10'));var authService=require(_0xd842('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd842('0x12'));var hardwareService=require(_0xd842('0x13'));var logger=require(_0xd842('0x14'))(_0xd842('0x15'));var utils=require(_0xd842('0x16'));var config=require(_0xd842('0x17'));var db=require(_0xd842('0x18'))['db'];function respondWithStatusCode(_0x4f56a7,_0xbd2e6c){_0xbd2e6c=_0xbd2e6c||0xcc;return function(_0x75e1c1){if(_0x75e1c1){return _0x4f56a7[_0xd842('0x19')](_0xbd2e6c);}return _0x4f56a7[_0xd842('0x1a')](_0xbd2e6c)[_0xd842('0x1b')]();};}function respondWithResult(_0x3ebfc8,_0x10fb9d){_0x10fb9d=_0x10fb9d||0xc8;return function(_0x567f51){if(_0x567f51){return _0x3ebfc8['status'](_0x10fb9d)['json'](_0x567f51);}};}function respondWithFilteredResult(_0x461ca0,_0x2f9610){return function(_0x1ad1f9){if(_0x1ad1f9){var _0x54a9cd=_0x1ad1f9[_0xd842('0x1c')],_0x5e0d17=_0x2f9610[_0xd842('0x1d')],_0x2df5eb=_0x2f9610[_0xd842('0x1d')]+_0x2f9610['limit'],_0x769cb9;if(_0x2df5eb>=_0x54a9cd){_0x2df5eb=_0x54a9cd;_0x769cb9=0xc8;}else{_0x769cb9=0xce;}_0x461ca0[_0xd842('0x1a')](_0x769cb9);return _0x461ca0[_0xd842('0x1e')]('Content-Range',_0x5e0d17+'-'+_0x2df5eb+'/'+_0x54a9cd)[_0xd842('0x1f')](_0x1ad1f9);}return null;};}function patchUpdates(_0x59b01c){return function(_0x1e110e){try{jsonpatch[_0xd842('0x20')](_0x1e110e,_0x59b01c,!![]);}catch(_0x1ea826){return BPromise[_0xd842('0x21')](_0x1ea826);}return _0x1e110e[_0xd842('0x22')]();};}function saveUpdates(_0x3df042,_0x281f45){return function(_0x1a3105){if(_0x1a3105){return _0x1a3105['update'](_0x3df042)[_0xd842('0x23')](function(_0x4ca2a5){return _0x4ca2a5;});}return null;};}function removeEntity(_0x5df74c,_0x3f29b5){return function(_0x2a83ce){if(_0x2a83ce){return _0x2a83ce[_0xd842('0x24')]()[_0xd842('0x23')](function(){_0x5df74c[_0xd842('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f6da2,_0x4dd4b7){return function(_0x73b6ff){if(!_0x73b6ff){_0x2f6da2[_0xd842('0x19')](0x194);}return _0x73b6ff;};}function handleError(_0x4ea7a2,_0x30a931){_0x30a931=_0x30a931||0x1f4;return function(_0x5f8bd1){logger[_0xd842('0x25')](_0x5f8bd1[_0xd842('0x26')]);if(_0x5f8bd1[_0xd842('0x27')]){delete _0x5f8bd1[_0xd842('0x27')];}_0x4ea7a2[_0xd842('0x1a')](_0x30a931)['send'](_0x5f8bd1);};}exports[_0xd842('0x28')]=function(_0x513ac8,_0x4463f6){var _0x119102={},_0x48deb1={},_0x64da9e={'count':0x0,'rows':[]};var _0x191d27=_['map'](db['CmHopper'][_0xd842('0x29')],function(_0x4e2fa6){return{'name':_0x4e2fa6[_0xd842('0x2a')],'type':_0x4e2fa6['type'][_0xd842('0x2b')]};});_0x48deb1[_0xd842('0x2c')]=_[_0xd842('0x2d')](_0x191d27,_0xd842('0x27'));_0x48deb1[_0xd842('0x2e')]=_[_0xd842('0x2f')](_0x513ac8[_0xd842('0x2e')]);_0x48deb1[_0xd842('0x30')]=_['intersection'](_0x48deb1[_0xd842('0x2c')],_0x48deb1['query']);_0x48deb1[_0xd842('0x30')]=_[_0xd842('0x31')](_0x48deb1[_0xd842('0x30')],[_0xd842('0x32'),_0xd842('0x33'),_0xd842('0x34'),'$gte','$lt','$lte',_0xd842('0x35'),_0xd842('0x36'),_0xd842('0x37'),_0xd842('0x38'),'$notBetween',_0xd842('0x39'),'$notIn',_0xd842('0x3a'),_0xd842('0x3b'),_0xd842('0x3c'),_0xd842('0x3d'),_0xd842('0x3a'),_0xd842('0x3e'),_0xd842('0x3f'),_0xd842('0x40'),_0xd842('0x41')]);_0x119102[_0xd842('0x42')]=_[_0xd842('0x43')](_0x48deb1[_0xd842('0x2c')],qs[_0xd842('0x44')](_0x513ac8[_0xd842('0x2e')][_0xd842('0x44')]));_0x119102['attributes']=_0x119102[_0xd842('0x42')][_0xd842('0x45')]?_0x119102['attributes']:_0x48deb1[_0xd842('0x2c')];if(!_0x513ac8[_0xd842('0x2e')][_0xd842('0x46')]('nolimit')){_0x119102['limit']=qs[_0xd842('0x47')](_0x513ac8['query'][_0xd842('0x47')]);_0x119102[_0xd842('0x1d')]=qs[_0xd842('0x1d')](_0x513ac8['query'][_0xd842('0x1d')]);}_0x119102[_0xd842('0x48')]=qs[_0xd842('0x49')](_0x513ac8[_0xd842('0x2e')][_0xd842('0x49')]);_0x119102[_0xd842('0x4a')]=qs[_0xd842('0x30')](_[_0xd842('0x4b')](_0x513ac8[_0xd842('0x2e')],_0x48deb1[_0xd842('0x30')]));if(_0x513ac8[_0xd842('0x2e')][_0xd842('0x4c')]){_0x119102[_0xd842('0x4a')]=_['merge'](_0x119102[_0xd842('0x4a')],{'$or':_[_0xd842('0x2d')](_0x191d27,function(_0x850950){if(_0x850950['type']!==_0xd842('0x4d')){var _0x466872={};_0x466872[_0x850950[_0xd842('0x27')]]={'$like':'%'+_0x513ac8[_0xd842('0x2e')][_0xd842('0x4c')]+'%'};return _0x466872;}})});}_0x119102=_[_0xd842('0x4e')]({},_0x119102,_0x513ac8[_0xd842('0x4f')]);var _0x1850ed={'where':_0x119102['where']};return db['CmHopper'][_0xd842('0x1c')](_0x1850ed)['then'](function(_0x36e88b){_0x64da9e[_0xd842('0x1c')]=_0x36e88b;if(_0x513ac8[_0xd842('0x2e')]['includeAll']){_0x119102[_0xd842('0x50')]=[{'all':!![]}];}return db[_0xd842('0x51')][_0xd842('0x52')](_0x119102);})[_0xd842('0x23')](function(_0x2077b2){_0x64da9e[_0xd842('0x53')]=_0x2077b2;return _0x64da9e;})[_0xd842('0x23')](respondWithFilteredResult(_0x4463f6,_0x119102))['catch'](handleError(_0x4463f6,null));};exports[_0xd842('0x54')]=function(_0x50144d,_0x3e65f4){var _0x53a64a={'raw':!![],'where':{'id':_0x50144d[_0xd842('0x55')]['id']}},_0x813b65={};_0x813b65[_0xd842('0x2c')]=_[_0xd842('0x2f')](db[_0xd842('0x51')][_0xd842('0x29')]);_0x813b65[_0xd842('0x2e')]=_['keys'](_0x50144d[_0xd842('0x2e')]);_0x813b65[_0xd842('0x30')]=_[_0xd842('0x43')](_0x813b65[_0xd842('0x2c')],_0x813b65[_0xd842('0x2e')]);_0x53a64a['attributes']=_[_0xd842('0x43')](_0x813b65[_0xd842('0x2c')],qs[_0xd842('0x44')](_0x50144d[_0xd842('0x2e')][_0xd842('0x44')]));_0x53a64a[_0xd842('0x42')]=_0x53a64a[_0xd842('0x42')][_0xd842('0x45')]?_0x53a64a['attributes']:_0x813b65[_0xd842('0x2c')];if(_0x50144d[_0xd842('0x2e')][_0xd842('0x56')]){_0x53a64a['include']=[{'all':!![]}];}_0x53a64a=_['merge']({},_0x53a64a,_0x50144d[_0xd842('0x4f')]);return db[_0xd842('0x51')][_0xd842('0x57')](_0x53a64a)[_0xd842('0x23')](handleEntityNotFound(_0x3e65f4,null))['then'](respondWithResult(_0x3e65f4,null))[_0xd842('0x58')](handleError(_0x3e65f4,null));};exports['create']=function(_0x3aa5ab,_0x5a6fab){return db[_0xd842('0x51')]['create'](_0x3aa5ab[_0xd842('0x59')],{})['then'](respondWithResult(_0x5a6fab,0xc9))[_0xd842('0x58')](handleError(_0x5a6fab,null));};exports['update']=function(_0x5205ed,_0x3e06f9){if(_0x5205ed[_0xd842('0x59')]['id']){delete _0x5205ed[_0xd842('0x59')]['id'];}return db[_0xd842('0x51')][_0xd842('0x57')]({'where':{'id':_0x5205ed[_0xd842('0x55')]['id']}})[_0xd842('0x23')](handleEntityNotFound(_0x3e06f9,null))[_0xd842('0x23')](saveUpdates(_0x5205ed['body'],null))[_0xd842('0x23')](respondWithResult(_0x3e06f9,null))[_0xd842('0x58')](handleError(_0x3e06f9,null));};exports['describe']=function(_0x253657,_0x7692e0){return db['CmHopper'][_0xd842('0x5a')]()['then'](respondWithResult(_0x7692e0,null))[_0xd842('0x58')](handleError(_0x7692e0,null));};exports[_0xd842('0x24')]=function(_0x245df5,_0x58276f){var _0x367bb1;return db[_0xd842('0x51')][_0xd842('0x57')]({'where':{'id':_0x245df5[_0xd842('0x55')]['id']}})['then'](handleEntityNotFound(_0x58276f,null))[_0xd842('0x23')](function(_0x51b8e9){if(_0x51b8e9){return _0x51b8e9[_0xd842('0x24')]()[_0xd842('0x23')](function(_0x366766){return _0x366766;});}})['then'](function(_0x36672d){_0x367bb1=_0x36672d;if(_0x36672d){if(_0x36672d[_0xd842('0x5b')]||_0x36672d[_0xd842('0x5c')]){return db[_0x36672d[_0xd842('0x5b')]?_0xd842('0x5d'):_0xd842('0x5e')][_0xd842('0x57')]({'where':{'id':_0x36672d[_0xd842('0x5b')]?_0x36672d[_0xd842('0x5b')]:_0x36672d[_0xd842('0x5c')]},'attributes':['id',_0xd842('0x27')],'raw':!![]});}}})[_0xd842('0x23')](function(_0x7c4599){var _0x5264f8={};if(_0x7c4599){_[_0xd842('0x4e')](_0x5264f8,_[_0xd842('0x5f')](_0x367bb1[_0xd842('0x60')],[_0xd842('0x61'),'updatedAt','id']));_0x5264f8[_0xd842('0x62')]=0x15;_0x5264f8['statedesc']=_0xd842('0x63');_0x5264f8[_0xd842('0x64')]=_0x7c4599[_0xd842('0x27')];_0x5264f8[_0xd842('0x65')]=_0x245df5[_0xd842('0x66')][_0xd842('0x27')];_0x5264f8[_0xd842('0x67')]=_0x245df5[_0xd842('0x66')]['id'];_0x5264f8[_0xd842('0x63')]=!![];_0x5264f8['deletedat']=moment()[_0xd842('0x68')]('YYYY-MM-DD\x20HH:mm:ss');_0x5264f8[_0xd842('0x69')]=_0x367bb1[_0xd842('0x6a')];_0x5264f8[_0xd842('0x6b')]=_0x367bb1['VoiceQueueId']?_0xd842('0x6c'):_0xd842('0x6d');return db[_0xd842('0x6e')][_0xd842('0x57')]({'where':{'id':_0x5264f8[_0xd842('0x6f')]},'attributes':[_0xd842('0x70'),_0xd842('0x71')]})[_0xd842('0x23')](function(_0x42f975){if(!_[_0xd842('0x72')](_0x58276f)&&!_[_0xd842('0x72')](_0x42f975[_0xd842('0x70')])){_0x5264f8['calleridname']=_0x42f975[_0xd842('0x70')];if(!_[_0xd842('0x72')](_0x42f975[_0xd842('0x71')])){_0x5264f8[_0xd842('0x73')]+='\x20'+_0x42f975[_0xd842('0x71')];}}})[_0xd842('0x74')](function(){return db[_0xd842('0x75')][_0xd842('0x76')](_0x5264f8);});}})[_0xd842('0x23')](function(){return _0x58276f[_0xd842('0x1a')](0xcc)[_0xd842('0x1b')]();})[_0xd842('0x58')](handleError(_0x58276f,null));};exports[_0xd842('0x77')]=function(_0x232db3,_0x2f8e73,_0x410607){var _0x1a286f=[];return db[_0xd842('0x6e')][_0xd842('0x5a')]()[_0xd842('0x23')](function(_0x11cf5f){_0x1a286f=_[_0xd842('0x2f')](_0x11cf5f);return _0x232db3[_0xd842('0x66')][_0xd842('0x78')]({'where':{'type':_0xd842('0x79'),'dialActive':!![],'dialMethod':_0xd842('0x7a')},'attributes':['id',_0xd842('0x7b')],'raw':!![]});})[_0xd842('0x23')](function(_0x1783c7){if(_0x1783c7&&_0x1783c7[_0xd842('0x45')]){return db[_0xd842('0x7c')][_0xd842('0x7d')](function(_0xafd91f){var _0x394efb={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xd842('0x68')](_0xd842('0x7e'))},'VoiceQueueId':{'$in':_[_0xd842('0x2d')](_0x1783c7,'id')},'$or':[{'UserId':null},{'UserId':_0x232db3[_0xd842('0x66')]['id']}]};var _0x51e395=[];if(_0x232db3['body'][_0xd842('0x7f')]&&_0x232db3[_0xd842('0x59')][_0xd842('0x7f')]===_0xd842('0x80')){if(!_[_0xd842('0x81')](_0x232db3['body'][_0xd842('0x82')])){_0x394efb['id']={'$in':_0x232db3['body'][_0xd842('0x82')]};}_0x51e395=[[_0xd842('0x83'),'ASC'],[_0xd842('0x84'),_0x1783c7[0x0][_0xd842('0x7b')]===_0xd842('0x85')?_0xd842('0x86'):_0xd842('0x85')],db[_0xd842('0x7c')][_0xd842('0x87')](_0xd842('0x88')),['id','DESC']];}else{if(!_['isEmpty'](_0x232db3[_0xd842('0x59')][_0xd842('0x82')])){_0x394efb['id']={'$notIn':_0x232db3[_0xd842('0x59')][_0xd842('0x82')]};}_0x51e395=[[_0xd842('0x83'),_0xd842('0x86')],[_0xd842('0x84'),_0x1783c7[0x0][_0xd842('0x7b')]],db[_0xd842('0x7c')][_0xd842('0x87')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xd842('0x85')]];}return db['CmHopper']['findOne']({'attributes':['id',_0xd842('0x89')],'where':_0x394efb,'order':_0x51e395,'transaction':_0xafd91f,'lock':_0xafd91f['LOCK'][_0xd842('0x8a')],'include':[{'model':db['CmContact'],'as':_0xd842('0x8b'),'attributes':_0x1a286f,'include':[{'model':db['CmCompany'],'as':_0xd842('0x8c'),'attributes':['id',_0xd842('0x27')]}]},{'model':db[_0xd842('0x8d')],'as':_0xd842('0x8e'),'attributes':['id',_0xd842('0x27')]},{'model':db[_0xd842('0x5d')],'as':_0xd842('0x8f'),'attributes':['id','name','dialActive']}]})[_0xd842('0x23')](function(_0x4f28c0){if(_0x4f28c0){return _0x4f28c0[_0xd842('0x90')]({'UserId':_0x232db3['user']['id']},{'transaction':_0xafd91f});}});});}})[_0xd842('0x23')](handleEntityNotFound(_0x2f8e73,null))['then'](respondWithResult(_0x2f8e73,null))[_0xd842('0x58')](handleError(_0x2f8e73,null));};exports[_0xd842('0x91')]=function(_0x41da8f,_0x11bdb1,_0x255258){return _0x41da8f[_0xd842('0x66')][_0xd842('0x78')]({'where':{'type':_0xd842('0x79'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xd842('0x23')](function(_0x17d418){if(_0x17d418&&_0x17d418['length']){return db[_0xd842('0x51')][_0xd842('0x1c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xd842('0x68')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xd842('0x2d')](_0x17d418,'id')},'$or':[{'UserId':null},{'UserId':_0x41da8f[_0xd842('0x66')]['id']}]}});}return 0x0;})[_0xd842('0x23')](function(_0x3280fa){if(!_[_0xd842('0x72')](_0x3280fa)&&_[_0xd842('0x92')](_0x3280fa)){return _0x11bdb1[_0xd842('0x1a')](0xc8)['json']({'contacts':_0x3280fa});}else{logger[_0xd842('0x25')]('CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts',0x194,_0xd842('0x93'));_0x11bdb1['sendStatus'](0x194);}})[_0xd842('0x58')](handleError(_0x11bdb1,null));}; \ No newline at end of file +var _0xb8f4=['describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','createdAt','updatedAt','statedesc','deleted','campaign','user','deletedat','format','phone','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','finally','CmHopperFinal','create','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','YYYY-MM-DD\x20HH:mm:ss','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','Queue','dialActive','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','concat','$and','$or','$gt','$lt','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$contains','$contained','$any','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopper','count','includeAll','include','findAll','rows','catch','show','params','keys','body','find'];(function(_0x1a769c,_0x1551bc){var _0x1d792a=function(_0x593989){while(--_0x593989){_0x1a769c['push'](_0x1a769c['shift']());}};_0x1d792a(++_0x1551bc);}(_0xb8f4,0x15c));var _0x4b8f=function(_0x4560c3,_0xdd187f){_0x4560c3=_0x4560c3-0x0;var _0x5400a1=_0xb8f4[_0x4560c3];return _0x5400a1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4b8f('0x0'));var rimraf=require(_0x4b8f('0x1'));var zipdir=require(_0x4b8f('0x2'));var jsonpatch=require(_0x4b8f('0x3'));var rp=require('request-promise');var moment=require(_0x4b8f('0x4'));var BPromise=require(_0x4b8f('0x5'));var Mustache=require(_0x4b8f('0x6'));var util=require(_0x4b8f('0x7'));var path=require(_0x4b8f('0x8'));var sox=require(_0x4b8f('0x9'));var csv=require('to-csv');var ejs=require(_0x4b8f('0xa'));var fs=require('fs');var _=require(_0x4b8f('0xb'));var squel=require(_0x4b8f('0xc'));var crypto=require(_0x4b8f('0xd'));var jsforce=require(_0x4b8f('0xe'));var deskjs=require(_0x4b8f('0xf'));var toCsv=require(_0x4b8f('0x10'));var querystring=require(_0x4b8f('0x11'));var Papa=require('papaparse');var Redis=require(_0x4b8f('0x12'));var authService=require(_0x4b8f('0x13'));var qs=require(_0x4b8f('0x14'));var as=require(_0x4b8f('0x15'));var hardwareService=require(_0x4b8f('0x16'));var logger=require(_0x4b8f('0x17'))(_0x4b8f('0x18'));var utils=require('../../config/utils');var config=require(_0x4b8f('0x19'));var db=require(_0x4b8f('0x1a'))['db'];function respondWithStatusCode(_0x343a31,_0x49a924){_0x49a924=_0x49a924||0xcc;return function(_0x52875e){if(_0x52875e){return _0x343a31[_0x4b8f('0x1b')](_0x49a924);}return _0x343a31[_0x4b8f('0x1c')](_0x49a924)[_0x4b8f('0x1d')]();};}function respondWithResult(_0x47992c,_0x4115d8){_0x4115d8=_0x4115d8||0xc8;return function(_0x5c24dc){if(_0x5c24dc){return _0x47992c[_0x4b8f('0x1c')](_0x4115d8)[_0x4b8f('0x1e')](_0x5c24dc);}};}function respondWithFilteredResult(_0x5325fb,_0x2c9330){return function(_0x454f6b){if(_0x454f6b){var _0x3323c0=_0x454f6b['count'],_0x4c6296=_0x2c9330[_0x4b8f('0x1f')],_0x3e9027=_0x2c9330['offset']+_0x2c9330['limit'],_0x21de97;if(_0x3e9027>=_0x3323c0){_0x3e9027=_0x3323c0;_0x21de97=0xc8;}else{_0x21de97=0xce;}_0x5325fb[_0x4b8f('0x1c')](_0x21de97);return _0x5325fb[_0x4b8f('0x20')](_0x4b8f('0x21'),_0x4c6296+'-'+_0x3e9027+'/'+_0x3323c0)[_0x4b8f('0x1e')](_0x454f6b);}return null;};}function patchUpdates(_0x4f6366){return function(_0x2a7e5b){try{jsonpatch[_0x4b8f('0x22')](_0x2a7e5b,_0x4f6366,!![]);}catch(_0x312be5){return BPromise[_0x4b8f('0x23')](_0x312be5);}return _0x2a7e5b[_0x4b8f('0x24')]();};}function saveUpdates(_0x3b6599,_0x5c9805){return function(_0x11f6b3){if(_0x11f6b3){return _0x11f6b3['update'](_0x3b6599)[_0x4b8f('0x25')](function(_0x5351c4){return _0x5351c4;});}return null;};}function removeEntity(_0x2b2d08,_0x46ee21){return function(_0x13154a){if(_0x13154a){return _0x13154a[_0x4b8f('0x26')]()[_0x4b8f('0x25')](function(){_0x2b2d08[_0x4b8f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a7ad7,_0x5628b3){return function(_0x480239){if(!_0x480239){_0x5a7ad7[_0x4b8f('0x1b')](0x194);}return _0x480239;};}function handleError(_0x2a6c63,_0x50dde5){_0x50dde5=_0x50dde5||0x1f4;return function(_0x16dbb9){logger[_0x4b8f('0x27')](_0x16dbb9['stack']);if(_0x16dbb9['name']){delete _0x16dbb9[_0x4b8f('0x28')];}_0x2a6c63[_0x4b8f('0x1c')](_0x50dde5)['send'](_0x16dbb9);};}exports[_0x4b8f('0x29')]=function(_0x3caf29,_0x4b27f4){var _0x381afa={},_0x116b0d={},_0x292bc1={'count':0x0,'rows':[]};var _0x2af9aa=_[_0x4b8f('0x2a')](db['CmHopper'][_0x4b8f('0x2b')],function(_0x3fd792){return{'name':_0x3fd792[_0x4b8f('0x2c')],'type':_0x3fd792[_0x4b8f('0x2d')][_0x4b8f('0x2e')]};});_0x116b0d[_0x4b8f('0x2f')]=_['map'](_0x2af9aa,_0x4b8f('0x28'));_0x116b0d[_0x4b8f('0x30')]=_['keys'](_0x3caf29[_0x4b8f('0x30')]);_0x116b0d[_0x4b8f('0x31')]=_[_0x4b8f('0x32')](_0x116b0d['model'],_0x116b0d[_0x4b8f('0x30')]);_0x116b0d['filters']=_[_0x4b8f('0x33')](_0x116b0d[_0x4b8f('0x31')],[_0x4b8f('0x34'),_0x4b8f('0x35'),_0x4b8f('0x36'),'$gte',_0x4b8f('0x37'),'$lte',_0x4b8f('0x38'),_0x4b8f('0x39'),_0x4b8f('0x3a'),_0x4b8f('0x3b'),_0x4b8f('0x3c'),_0x4b8f('0x3d'),_0x4b8f('0x3e'),_0x4b8f('0x3f'),_0x4b8f('0x40'),'$iLike','$notILike',_0x4b8f('0x3f'),'$overlap',_0x4b8f('0x41'),_0x4b8f('0x42'),_0x4b8f('0x43')]);_0x381afa[_0x4b8f('0x44')]=_[_0x4b8f('0x32')](_0x116b0d['model'],qs['fields'](_0x3caf29[_0x4b8f('0x30')][_0x4b8f('0x45')]));_0x381afa['attributes']=_0x381afa[_0x4b8f('0x44')][_0x4b8f('0x46')]?_0x381afa[_0x4b8f('0x44')]:_0x116b0d[_0x4b8f('0x2f')];if(!_0x3caf29[_0x4b8f('0x30')]['hasOwnProperty'](_0x4b8f('0x47'))){_0x381afa[_0x4b8f('0x48')]=qs[_0x4b8f('0x48')](_0x3caf29[_0x4b8f('0x30')][_0x4b8f('0x48')]);_0x381afa[_0x4b8f('0x1f')]=qs[_0x4b8f('0x1f')](_0x3caf29['query']['offset']);}_0x381afa[_0x4b8f('0x49')]=qs[_0x4b8f('0x4a')](_0x3caf29[_0x4b8f('0x30')][_0x4b8f('0x4a')]);_0x381afa[_0x4b8f('0x4b')]=qs[_0x4b8f('0x31')](_[_0x4b8f('0x4c')](_0x3caf29[_0x4b8f('0x30')],_0x116b0d['filters']));if(_0x3caf29['query'][_0x4b8f('0x4d')]){_0x381afa[_0x4b8f('0x4b')]=_[_0x4b8f('0x4e')](_0x381afa[_0x4b8f('0x4b')],{'$or':_[_0x4b8f('0x2a')](_0x2af9aa,function(_0x3007b3){if(_0x3007b3['type']!==_0x4b8f('0x4f')){var _0x12da50={};_0x12da50[_0x3007b3[_0x4b8f('0x28')]]={'$like':'%'+_0x3caf29[_0x4b8f('0x30')][_0x4b8f('0x4d')]+'%'};return _0x12da50;}})});}_0x381afa=_[_0x4b8f('0x4e')]({},_0x381afa,_0x3caf29[_0x4b8f('0x50')]);var _0x4f2eba={'where':_0x381afa[_0x4b8f('0x4b')]};return db[_0x4b8f('0x51')][_0x4b8f('0x52')](_0x4f2eba)[_0x4b8f('0x25')](function(_0x431fbb){_0x292bc1[_0x4b8f('0x52')]=_0x431fbb;if(_0x3caf29[_0x4b8f('0x30')][_0x4b8f('0x53')]){_0x381afa[_0x4b8f('0x54')]=[{'all':!![]}];}return db['CmHopper'][_0x4b8f('0x55')](_0x381afa);})[_0x4b8f('0x25')](function(_0x10a7ad){_0x292bc1[_0x4b8f('0x56')]=_0x10a7ad;return _0x292bc1;})[_0x4b8f('0x25')](respondWithFilteredResult(_0x4b27f4,_0x381afa))[_0x4b8f('0x57')](handleError(_0x4b27f4,null));};exports[_0x4b8f('0x58')]=function(_0x3ed8fe,_0x51a135){var _0x5e275d={'raw':!![],'where':{'id':_0x3ed8fe[_0x4b8f('0x59')]['id']}},_0x456d1c={};_0x456d1c[_0x4b8f('0x2f')]=_['keys'](db['CmHopper'][_0x4b8f('0x2b')]);_0x456d1c[_0x4b8f('0x30')]=_[_0x4b8f('0x5a')](_0x3ed8fe[_0x4b8f('0x30')]);_0x456d1c[_0x4b8f('0x31')]=_[_0x4b8f('0x32')](_0x456d1c[_0x4b8f('0x2f')],_0x456d1c[_0x4b8f('0x30')]);_0x5e275d[_0x4b8f('0x44')]=_[_0x4b8f('0x32')](_0x456d1c[_0x4b8f('0x2f')],qs[_0x4b8f('0x45')](_0x3ed8fe[_0x4b8f('0x30')]['fields']));_0x5e275d['attributes']=_0x5e275d['attributes'][_0x4b8f('0x46')]?_0x5e275d[_0x4b8f('0x44')]:_0x456d1c['model'];if(_0x3ed8fe[_0x4b8f('0x30')][_0x4b8f('0x53')]){_0x5e275d[_0x4b8f('0x54')]=[{'all':!![]}];}_0x5e275d=_[_0x4b8f('0x4e')]({},_0x5e275d,_0x3ed8fe[_0x4b8f('0x50')]);return db[_0x4b8f('0x51')]['find'](_0x5e275d)[_0x4b8f('0x25')](handleEntityNotFound(_0x51a135,null))[_0x4b8f('0x25')](respondWithResult(_0x51a135,null))[_0x4b8f('0x57')](handleError(_0x51a135,null));};exports['create']=function(_0x284d79,_0x421942){return db['CmHopper']['create'](_0x284d79[_0x4b8f('0x5b')],{})[_0x4b8f('0x25')](respondWithResult(_0x421942,0xc9))[_0x4b8f('0x57')](handleError(_0x421942,null));};exports['update']=function(_0x405e92,_0x169982){if(_0x405e92[_0x4b8f('0x5b')]['id']){delete _0x405e92[_0x4b8f('0x5b')]['id'];}return db[_0x4b8f('0x51')][_0x4b8f('0x5c')]({'where':{'id':_0x405e92[_0x4b8f('0x59')]['id']}})[_0x4b8f('0x25')](handleEntityNotFound(_0x169982,null))[_0x4b8f('0x25')](saveUpdates(_0x405e92[_0x4b8f('0x5b')],null))[_0x4b8f('0x25')](respondWithResult(_0x169982,null))[_0x4b8f('0x57')](handleError(_0x169982,null));};exports[_0x4b8f('0x5d')]=function(_0x235426,_0x1fc97b){return db[_0x4b8f('0x51')][_0x4b8f('0x5d')]()[_0x4b8f('0x25')](respondWithResult(_0x1fc97b,null))['catch'](handleError(_0x1fc97b,null));};exports[_0x4b8f('0x26')]=function(_0x126b30,_0x462998){var _0x201fd2;return db[_0x4b8f('0x51')][_0x4b8f('0x5c')]({'where':{'id':_0x126b30[_0x4b8f('0x59')]['id']}})['then'](handleEntityNotFound(_0x462998,null))[_0x4b8f('0x25')](function(_0x57259c){if(_0x57259c){return _0x57259c['destroy']()[_0x4b8f('0x25')](function(_0x57bb2e){return _0x57bb2e;});}})['then'](function(_0x147a96){_0x201fd2=_0x147a96;if(_0x147a96){if(_0x147a96[_0x4b8f('0x5e')]||_0x147a96['CampaignId']){return db[_0x147a96[_0x4b8f('0x5e')]?_0x4b8f('0x5f'):_0x4b8f('0x60')][_0x4b8f('0x5c')]({'where':{'id':_0x147a96[_0x4b8f('0x5e')]?_0x147a96[_0x4b8f('0x5e')]:_0x147a96[_0x4b8f('0x61')]},'attributes':['id',_0x4b8f('0x28')],'raw':!![]});}}})[_0x4b8f('0x25')](function(_0x370ed9){var _0x4ef0ad={};if(_0x370ed9){_[_0x4b8f('0x4e')](_0x4ef0ad,_['omit'](_0x201fd2['dataValues'],[_0x4b8f('0x62'),_0x4b8f('0x63'),'id']));_0x4ef0ad['state']=0x15;_0x4ef0ad[_0x4b8f('0x64')]=_0x4b8f('0x65');_0x4ef0ad[_0x4b8f('0x66')]=_0x370ed9[_0x4b8f('0x28')];_0x4ef0ad['membername']=_0x126b30[_0x4b8f('0x67')][_0x4b8f('0x28')];_0x4ef0ad['UserId']=_0x126b30[_0x4b8f('0x67')]['id'];_0x4ef0ad[_0x4b8f('0x65')]=!![];_0x4ef0ad[_0x4b8f('0x68')]=moment()[_0x4b8f('0x69')]('YYYY-MM-DD\x20HH:mm:ss');_0x4ef0ad['calleridnum']=_0x201fd2[_0x4b8f('0x6a')];_0x4ef0ad['campaigntype']=_0x201fd2[_0x4b8f('0x5e')]?_0x4b8f('0x6b'):_0x4b8f('0x6c');return db[_0x4b8f('0x6d')][_0x4b8f('0x5c')]({'where':{'id':_0x4ef0ad[_0x4b8f('0x6e')]},'attributes':[_0x4b8f('0x6f'),_0x4b8f('0x70')]})[_0x4b8f('0x25')](function(_0x4a44a5){if(!_[_0x4b8f('0x71')](_0x462998)&&!_[_0x4b8f('0x71')](_0x4a44a5[_0x4b8f('0x6f')])){_0x4ef0ad['calleridname']=_0x4a44a5[_0x4b8f('0x6f')];if(!_[_0x4b8f('0x71')](_0x4a44a5[_0x4b8f('0x70')])){_0x4ef0ad['calleridname']+='\x20'+_0x4a44a5[_0x4b8f('0x70')];}}})[_0x4b8f('0x72')](function(){return db[_0x4b8f('0x73')][_0x4b8f('0x74')](_0x4ef0ad);});}})[_0x4b8f('0x25')](function(){return _0x462998[_0x4b8f('0x1c')](0xcc)[_0x4b8f('0x1d')]();})[_0x4b8f('0x57')](handleError(_0x462998,null));};exports[_0x4b8f('0x75')]=function(_0x44edad,_0x3fa8d4,_0xea33cb){var _0x53cb94=[];return db[_0x4b8f('0x6d')][_0x4b8f('0x5d')]()[_0x4b8f('0x25')](function(_0x17e00b){_0x53cb94=_['keys'](_0x17e00b);return _0x44edad[_0x4b8f('0x67')][_0x4b8f('0x76')]({'where':{'type':_0x4b8f('0x77'),'dialActive':!![],'dialMethod':_0x4b8f('0x78')},'attributes':['id',_0x4b8f('0x79')],'raw':!![]});})['then'](function(_0xf04896){if(_0xf04896&&_0xf04896['length']){return db[_0x4b8f('0x7a')]['transaction'](function(_0x5752c9){var _0x3b50ee={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x4b8f('0x69')](_0x4b8f('0x7b'))},'VoiceQueueId':{'$in':_[_0x4b8f('0x2a')](_0xf04896,'id')},'$or':[{'UserId':null},{'UserId':_0x44edad[_0x4b8f('0x67')]['id']}]};var _0x8ee740=[];if(_0x44edad[_0x4b8f('0x5b')]['direction']&&_0x44edad[_0x4b8f('0x5b')]['direction']===_0x4b8f('0x7c')){if(!_[_0x4b8f('0x7d')](_0x44edad[_0x4b8f('0x5b')]['hopperIds'])){_0x3b50ee['id']={'$in':_0x44edad['body'][_0x4b8f('0x7e')]};}_0x8ee740=[[_0x4b8f('0x7f'),_0x4b8f('0x80')],[_0x4b8f('0x81'),_0xf04896[0x0][_0x4b8f('0x79')]===_0x4b8f('0x80')?'DESC':_0x4b8f('0x80')],db['sequelize'][_0x4b8f('0x82')](_0x4b8f('0x83')),['id',_0x4b8f('0x84')]];}else{if(!_['isEmpty'](_0x44edad[_0x4b8f('0x5b')][_0x4b8f('0x7e')])){_0x3b50ee['id']={'$notIn':_0x44edad[_0x4b8f('0x5b')][_0x4b8f('0x7e')]};}_0x8ee740=[['priority',_0x4b8f('0x84')],[_0x4b8f('0x81'),_0xf04896[0x0][_0x4b8f('0x79')]],db[_0x4b8f('0x7a')][_0x4b8f('0x82')](_0x4b8f('0x85')),['id','ASC']];}return db[_0x4b8f('0x51')][_0x4b8f('0x86')]({'attributes':['id',_0x4b8f('0x87')],'where':_0x3b50ee,'order':_0x8ee740,'transaction':_0x5752c9,'lock':_0x5752c9[_0x4b8f('0x88')][_0x4b8f('0x89')],'include':[{'model':db[_0x4b8f('0x6d')],'as':_0x4b8f('0x8a'),'attributes':_0x53cb94,'include':[{'model':db[_0x4b8f('0x8b')],'as':_0x4b8f('0x8c'),'attributes':['id',_0x4b8f('0x28')]}]},{'model':db[_0x4b8f('0x8d')],'as':'List','attributes':['id',_0x4b8f('0x28')]},{'model':db[_0x4b8f('0x5f')],'as':_0x4b8f('0x8e'),'attributes':['id','name',_0x4b8f('0x8f')]}]})['then'](function(_0x25b5f3){if(_0x25b5f3){return _0x25b5f3['update']({'UserId':_0x44edad['user']['id']},{'transaction':_0x5752c9});}});});}})[_0x4b8f('0x25')](handleEntityNotFound(_0x3fa8d4,null))[_0x4b8f('0x25')](respondWithResult(_0x3fa8d4,null))[_0x4b8f('0x57')](handleError(_0x3fa8d4,null));};exports[_0x4b8f('0x90')]=function(_0x52f00f,_0x44abef,_0x50b305){return _0x52f00f[_0x4b8f('0x67')][_0x4b8f('0x76')]({'where':{'type':_0x4b8f('0x77'),'dialActive':!![],'dialMethod':_0x4b8f('0x78')},'attributes':['id'],'raw':!![]})[_0x4b8f('0x25')](function(_0x4c7f68){if(_0x4c7f68&&_0x4c7f68[_0x4b8f('0x46')]){return db[_0x4b8f('0x51')][_0x4b8f('0x52')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x4b8f('0x7b'))},'VoiceQueueId':{'$in':_['map'](_0x4c7f68,'id')},'$or':[{'UserId':null},{'UserId':_0x52f00f[_0x4b8f('0x67')]['id']}]}});}return 0x0;})[_0x4b8f('0x25')](function(_0xe21e70){if(!_[_0x4b8f('0x71')](_0xe21e70)&&_['isNumber'](_0xe21e70)){return _0x44abef[_0x4b8f('0x1c')](0xc8)[_0x4b8f('0x1e')]({'contacts':_0xe21e70});}else{logger[_0x4b8f('0x27')](_0x4b8f('0x91'),_0x4b8f('0x90'),0x194,_0x4b8f('0x92'));_0x44abef[_0x4b8f('0x1b')](0x194);}})[_0x4b8f('0x57')](handleError(_0x44abef,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 919b2c4..044f431 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 _0x2e7d=['util','api','moment','bluebird','path','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','priority'];(function(_0xe72d4,_0x2429ef){var _0x49fa9c=function(_0x231394){while(--_0x231394){_0xe72d4['push'](_0xe72d4['shift']());}};_0x49fa9c(++_0x2429ef);}(_0x2e7d,0x129));var _0xd2e7=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x2e7d[_0x2235bf];return _0x4c3a64;};'use strict';var _=require('lodash');var util=require(_0xd2e7('0x0'));var logger=require('../../config/logger')(_0xd2e7('0x1'));var moment=require(_0xd2e7('0x2'));var BPromise=require(_0xd2e7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd2e7('0x4'));var rimraf=require('rimraf');var config=require(_0xd2e7('0x5'));var attributes=require(_0xd2e7('0x6'));module['exports']=function(_0x11ce6c,_0x18f364){return _0x11ce6c[_0xd2e7('0x7')]('CmHopper',attributes,{'tableName':_0xd2e7('0x8'),'paranoid':![],'indexes':[{'name':_0xd2e7('0x9'),'fields':[_0xd2e7('0x9')]},{'name':'phone','fields':['phone']},{'name':_0xd2e7('0xa'),'fields':[_0xd2e7('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6c52=['rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6c52,0x163));var _0x26c5=function(_0xa547d2,_0x49810e){_0xa547d2=_0xa547d2-0x0;var _0x4c61eb=_0x6c52[_0xa547d2];return _0x4c61eb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x26c5('0x0'))(_0x26c5('0x1'));var moment=require(_0x26c5('0x2'));var BPromise=require(_0x26c5('0x3'));var rp=require(_0x26c5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x26c5('0x5'));var config=require(_0x26c5('0x6'));var attributes=require(_0x26c5('0x7'));module[_0x26c5('0x8')]=function(_0x7aeaab,_0x1862c4){return _0x7aeaab[_0x26c5('0x9')](_0x26c5('0xa'),attributes,{'tableName':_0x26c5('0xb'),'paranoid':![],'indexes':[{'name':_0x26c5('0xc'),'fields':['scheduledat']},{'name':_0x26c5('0xd'),'fields':[_0x26c5('0xd')]},{'name':_0x26c5('0xe'),'fields':[_0x26c5('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 4d2a1f9..f96090a 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 _0x7a54=['stringify','error','code','message','request\x20sent','result','catch','CmHopper','findAll','options','raw','where','attributes','include','map','model','then','GetCmHopper','ShowCmHopper','find','CreateCmHopper','create','update','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','limit','order','LOCK','UPDATE','keys','User','Agent','name','voicePause','length','body','all','MoveContactManagedDialer','transaction','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UserId','push','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','CmHopper,\x20%s,\x20%s','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7a54,0x106));var _0x47a5=function(_0x314abe,_0x2d4ca3){_0x314abe=_0x314abe-0x0;var _0x301fd3=_0x7a54[_0x314abe];return _0x301fd3;};'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')]('CmHopper,\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);});});}exports['GetCmHopper']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'limit':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['limit']||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x5247fd['options'][_0x47a5('0x1b')],function(_0x385687){return{'model':db[_0x385687['model']],'as':_0x385687['as'],'attributes':_0x385687[_0x47a5('0x1a')],'include':_0x385687[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x385687[_0x47a5('0x1b')],function(_0x3abd6a){return{'model':db[_0x3abd6a['model']],'as':_0x3abd6a['as'],'attributes':_0x3abd6a['attributes'],'include':_0x3abd6a[_0x47a5('0x1b')]?_['map'](_0x3abd6a[_0x47a5('0x1b')],function(_0x5b6c4e){return{'model':db[_0x5b6c4e[_0x47a5('0x1d')]],'as':_0x5b6c4e['as'],'attributes':_0x5b6c4e[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x1dac65){logger[_0x47a5('0xb')](_0x47a5('0x1f'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1f'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1dac65));_0xaf70a6(_0x1dac65);})[_0x47a5('0x14')](function(_0x1127f8){logger[_0x47a5('0xf')](_0x47a5('0x1f'),_0x1127f8['message'],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x1127f8['message']));});});};exports[_0x47a5('0x20')]=function(_0x9ac908){var _0x16901f=this;return new Promise(function(_0x4d6b57,_0x256650){return db[_0x47a5('0x15')][_0x47a5('0x21')]({'raw':_0x9ac908[_0x47a5('0x17')]?_0x9ac908['options']['raw']===undefined?!![]:![]:!![],'where':_0x9ac908[_0x47a5('0x17')]?_0x9ac908[_0x47a5('0x17')]['where']||null:null,'attributes':_0x9ac908['options']?_0x9ac908[_0x47a5('0x17')][_0x47a5('0x1a')]||null:null,'include':_0x9ac908['options']?_0x9ac908[_0x47a5('0x17')]['include']?_[_0x47a5('0x1c')](_0x9ac908[_0x47a5('0x17')]['include'],function(_0x4843c0){return{'model':db[_0x4843c0[_0x47a5('0x1d')]],'as':_0x4843c0['as'],'attributes':_0x4843c0['attributes'],'include':_0x4843c0[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x4843c0[_0x47a5('0x1b')],function(_0x52749b){return{'model':db[_0x52749b[_0x47a5('0x1d')]],'as':_0x52749b['as'],'attributes':_0x52749b['attributes'],'include':_0x52749b['include']?_[_0x47a5('0x1c')](_0x52749b['include'],function(_0x25cce0){return{'model':db[_0x25cce0['model']],'as':_0x25cce0['as'],'attributes':_0x25cce0[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x38c8d4){logger[_0x47a5('0xb')](_0x47a5('0x20'),_0x9ac908);logger[_0x47a5('0xd')](_0x47a5('0x20'),_0x9ac908,JSON[_0x47a5('0xe')](_0x38c8d4));_0x4d6b57(_0x38c8d4);})[_0x47a5('0x14')](function(_0x4caed5){logger[_0x47a5('0xf')](_0x47a5('0x20'),_0x4caed5['message'],_0x9ac908);_0x256650(_0x16901f[_0x47a5('0xf')](0x1f4,_0x4caed5[_0x47a5('0x11')]));});});};exports[_0x47a5('0x22')]=function(_0x49c4b5){var _0x101f70=this;return new Promise(function(_0x10f660,_0x596097){return db[_0x47a5('0x15')][_0x47a5('0x23')](_0x49c4b5['body'],{'raw':_0x49c4b5['options']?_0x49c4b5['options'][_0x47a5('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x9b5eaf){logger[_0x47a5('0xb')](_0x47a5('0x22'),_0x49c4b5);logger[_0x47a5('0xd')](_0x47a5('0x22'),_0x49c4b5,JSON[_0x47a5('0xe')](_0x9b5eaf));_0x10f660(_0x9b5eaf);})[_0x47a5('0x14')](function(_0x1f3d01){logger[_0x47a5('0xf')](_0x47a5('0x22'),_0x1f3d01[_0x47a5('0x11')],_0x49c4b5);_0x596097(_0x101f70[_0x47a5('0xf')](0x1f4,_0x1f3d01[_0x47a5('0x11')]));});});};exports['UpdateCmHopper']=function(_0x1fbece){var _0x1c36fa=this;return new Promise(function(_0x331474,_0x23bd8d){return db['CmHopper'][_0x47a5('0x24')](_0x1fbece['body'],{'raw':_0x1fbece['options']?_0x1fbece['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fbece[_0x47a5('0x17')]?_0x1fbece['options'][_0x47a5('0x19')]||null:null,'attributes':_0x1fbece[_0x47a5('0x17')]?_0x1fbece[_0x47a5('0x17')]['attributes']||null:null,'limit':_0x1fbece[_0x47a5('0x17')]?_0x1fbece[_0x47a5('0x17')]['limit']||null:null})['then'](function(_0xbe21d9){logger['info'](_0x47a5('0x25'),_0x1fbece);logger[_0x47a5('0xd')](_0x47a5('0x25'),_0x1fbece,JSON[_0x47a5('0xe')](_0xbe21d9));_0x331474(_0xbe21d9);})[_0x47a5('0x14')](function(_0xf0edbb){logger[_0x47a5('0xf')](_0x47a5('0x25'),_0xf0edbb[_0x47a5('0x11')],_0x1fbece);_0x23bd8d(_0x1c36fa[_0x47a5('0xf')](0x1f4,_0xf0edbb[_0x47a5('0x11')]));});});};exports[_0x47a5('0x26')]=function(_0xe28d76){var _0x3574d4=this;return new Promise(function(_0x4e5e7,_0x3a2b38){return db['CmHopper'][_0x47a5('0x27')]({'where':_0xe28d76[_0x47a5('0x17')]?_0xe28d76['options']['where']||null:null})[_0x47a5('0x1e')](function(_0x560e4e){logger[_0x47a5('0xb')](_0x47a5('0x26'),_0xe28d76);logger['debug']('DestroyCmHopper',_0xe28d76,JSON[_0x47a5('0xe')](_0x560e4e));_0x4e5e7(_0x560e4e);})['catch'](function(_0x2d147c){logger[_0x47a5('0xf')](_0x47a5('0x26'),_0x2d147c[_0x47a5('0x11')],_0xe28d76);_0x3a2b38(_0x3574d4[_0x47a5('0xf')](0x1f4,_0x2d147c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x28')]=function(_0x53e994){var _0x48a0ef=this;return new Promise(function(_0x2dd1db,_0x411230){return db[_0x47a5('0x29')][_0x47a5('0x2a')]()[_0x47a5('0x1e')](function(_0x2c0c86){return db[_0x47a5('0x2b')]['transaction'](function(_0x45cca5){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'where':_0x53e994['options']?_0x53e994[_0x47a5('0x17')]['where']||null:null,'attributes':_0x53e994[_0x47a5('0x17')]?_0x53e994[_0x47a5('0x17')][_0x47a5('0x1a')]||null:null,'limit':_0x53e994[_0x47a5('0x17')]?_0x53e994['options'][_0x47a5('0x2c')]||null:null,'order':_0x53e994[_0x47a5('0x17')]?_0x53e994[_0x47a5('0x17')][_0x47a5('0x2d')]||null:null,'transaction':_0x45cca5,'lock':_0x45cca5[_0x47a5('0x2e')][_0x47a5('0x2f')],'include':[{'model':db[_0x47a5('0x29')],'as':'Contact','attributes':_[_0x47a5('0x30')](_0x2c0c86)},{'model':db[_0x47a5('0x31')],'as':_0x47a5('0x32'),'attributes':['id',_0x47a5('0x33'),_0x47a5('0x34')]}]})[_0x47a5('0x1e')](function(_0x572233){var _0x1ad6a9=[];for(var _0x245a15=0x0;_0x245a15<_0x572233[_0x47a5('0x35')];_0x245a15+=0x1){_0x1ad6a9['push'](_0x572233[_0x245a15][_0x47a5('0x24')](_0x53e994[_0x47a5('0x36')],{'transaction':_0x45cca5}));}return BPromise[_0x47a5('0x37')](_0x1ad6a9);});})['then'](function(_0x57641e){logger[_0x47a5('0xb')](_0x47a5('0x28'),_0x53e994);logger['debug']('GetContactDialer',_0x53e994,JSON[_0x47a5('0xe')](_0x57641e));_0x2dd1db(_0x57641e);})['catch'](function(_0x16bb8a){logger['error']('GetContactDialer',_0x16bb8a[_0x47a5('0x11')],_0x53e994);_0x411230(_0x48a0ef[_0x47a5('0xf')](0x1f4,_0x16bb8a['message']));});});});};exports[_0x47a5('0x38')]=function(_0x72fe){var _0x4b706a=this;return new Promise(function(_0x5b6127,_0x16b4fd){return db[_0x47a5('0x2b')][_0x47a5('0x39')](function(_0x2931e4){return db['CmHopperFinal'][_0x47a5('0x23')](_0x72fe[_0x47a5('0x36')],{'raw':_0x72fe[_0x47a5('0x17')]?_0x72fe['options'][_0x47a5('0x18')]===undefined?!![]:![]:!![],'transaction':_0x2931e4})['then'](function(){return db[_0x47a5('0x15')][_0x47a5('0x27')]({'where':_0x72fe[_0x47a5('0x17')]?_0x72fe[_0x47a5('0x17')][_0x47a5('0x19')]||null:null,'transaction':_0x2931e4});});})['then'](function(_0x144af9){logger['info']('MoveContactManagedDialer',_0x72fe);logger['debug']('MoveContactManagedDialer',_0x72fe,JSON[_0x47a5('0xe')](_0x144af9));_0x5b6127(_0x144af9);})[_0x47a5('0x14')](function(_0x1e2bb4){logger['error']('MoveContactManagedDialer',_0x1e2bb4[_0x47a5('0x11')],_0x72fe);_0x16b4fd(_0x4b706a[_0x47a5('0xf')](0x1f4,_0x1e2bb4[_0x47a5('0x11')]));});});};exports[_0x47a5('0x3a')]=function(_0xc45e25){var _0x4b5d0c=this;return new Promise(function(_0x3474b7,_0x519e9e){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0xc45e25['options']?_0xc45e25[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0xc45e25[_0x47a5('0x17')]?_0xc45e25[_0x47a5('0x17')][_0x47a5('0x19')]||null:null,'attributes':[[db[_0x47a5('0x2b')]['fn'](_0x47a5('0x3b'),db[_0x47a5('0x2b')]['fn']('IF',db['sequelize'][_0x47a5('0x3c')](_0x47a5('0x3d')+util[_0x47a5('0x3e')](_0x47a5('0x3f'),moment()[_0x47a5('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x47a5('0x40')))),_0x47a5('0x41')]]})[_0x47a5('0x1e')](function(_0x144aaa){logger[_0x47a5('0xb')](_0x47a5('0x3a'),_0xc45e25);logger[_0x47a5('0xd')](_0x47a5('0x3a'),_0xc45e25,JSON[_0x47a5('0xe')](_0x144aaa));_0x3474b7(_0x144aaa);})[_0x47a5('0x14')](function(_0x1d56f3){logger[_0x47a5('0xf')](_0x47a5('0x3a'),_0x1d56f3[_0x47a5('0x11')],_0xc45e25);_0x519e9e(_0x4b5d0c[_0x47a5('0xf')](0x1f4,_0x1d56f3['message']));});});};exports[_0x47a5('0x42')]=function(_0x284fb8){var _0x30504e=this;return new Promise(function(_0x4b42f3,_0x37ac59){return db[_0x47a5('0x29')][_0x47a5('0x2a')]()[_0x47a5('0x1e')](function(_0x5d9822){return db[_0x47a5('0x2b')]['transaction'](function(_0x2d5ee6){return db['CmHopper'][_0x47a5('0x16')]({'where':_0x284fb8['options']?_0x284fb8[_0x47a5('0x17')][_0x47a5('0x19')]||null:null,'attributes':_0x284fb8[_0x47a5('0x17')]?_0x284fb8['options']['attributes']||null:null,'limit':0x1,'order':_0x284fb8['options']?_0x284fb8[_0x47a5('0x17')][_0x47a5('0x2d')]||null:null,'group':db[_0x47a5('0x15')][_0x47a5('0x43')],'transaction':_0x2d5ee6,'lock':_0x2d5ee6['LOCK'][_0x47a5('0x2f')],'include':_0x284fb8[_0x47a5('0x17')]?_0x284fb8[_0x47a5('0x17')][_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x284fb8[_0x47a5('0x17')][_0x47a5('0x1b')],function(_0x39939a){return{'model':db[_0x39939a[_0x47a5('0x1d')]],'as':_0x39939a['as'],'attributes':_0x39939a[_0x47a5('0x1a')],'include':_0x39939a[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x39939a['include'],function(_0x1e3212){return{'model':db[_0x1e3212['model']],'as':_0x1e3212['as'],'attributes':_0x1e3212[_0x47a5('0x1a')],'include':_0x1e3212[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x1e3212[_0x47a5('0x1b')],function(_0x40e584){return{'model':db[_0x40e584[_0x47a5('0x1d')]],'as':_0x40e584['as'],'attributes':_0x40e584[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x11c1db){var _0x254049=[];for(var _0x1cfb37=0x0;_0x1cfb37<_0x11c1db[_0x47a5('0x35')];_0x1cfb37+=0x1){_0x254049[_0x47a5('0x44')](_0x11c1db[_0x1cfb37][_0x47a5('0x24')](_0x284fb8[_0x47a5('0x36')],{'transaction':_0x2d5ee6}));}return BPromise['all'](_0x254049);});})['then'](function(_0x5ccc89){logger['info'](_0x47a5('0x42'),_0x284fb8);logger[_0x47a5('0xd')]('GetContactRecallMe',_0x284fb8,JSON[_0x47a5('0xe')](_0x5ccc89));_0x4b42f3(_0x5ccc89);})[_0x47a5('0x14')](function(_0x1baa5a){logger[_0x47a5('0xf')](_0x47a5('0x42'),_0x1baa5a[_0x47a5('0x11')],_0x284fb8);_0x37ac59(_0x30504e[_0x47a5('0xf')](0x1f4,_0x1baa5a[_0x47a5('0x11')]));});});});}; \ No newline at end of file +var _0xb10b=['order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','push','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','all','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','map','model','debug','catch','ShowCmHopper','CreateCmHopper','create','body','update','limit','UpdateCmHopper','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb10b,0x12a));var _0xbb10=function(_0x3f8ca7,_0x1cfd75){_0x3f8ca7=_0x3f8ca7-0x0;var _0x2ef97e=_0xb10b[_0x3f8ca7];return _0x2ef97e;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'limit':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['limit']||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x407cb4){return{'model':db[_0x407cb4[_0xbb10('0x1e')]],'as':_0x407cb4['as'],'attributes':_0x407cb4[_0xbb10('0x1b')],'include':_0x407cb4[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x407cb4[_0xbb10('0x1c')],function(_0x537898){return{'model':db[_0x537898['model']],'as':_0x537898['as'],'attributes':_0x537898['attributes'],'include':_0x537898[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x537898[_0xbb10('0x1c')],function(_0x4e25ff){return{'model':db[_0x4e25ff[_0xbb10('0x1e')]],'as':_0x4e25ff['as'],'attributes':_0x4e25ff[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x1d5e95){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')]('GetCmHopper',_0x378da8,JSON[_0xbb10('0x11')](_0x1d5e95));_0x575cca(_0x1d5e95);})[_0xbb10('0x20')](function(_0xfc3595){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0xfc3595[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0xfc3595[_0xbb10('0x13')]));});});};exports['ShowCmHopper']=function(_0x448d5c){var _0x56f2da=this;return new Promise(function(_0x16ad2a,_0x1dcc9c){return db[_0xbb10('0x16')]['find']({'raw':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'include':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x8c1ce6){return{'model':db[_0x8c1ce6[_0xbb10('0x1e')]],'as':_0x8c1ce6['as'],'attributes':_0x8c1ce6[_0xbb10('0x1b')],'include':_0x8c1ce6[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x8c1ce6[_0xbb10('0x1c')],function(_0x56943c){return{'model':db[_0x56943c[_0xbb10('0x1e')]],'as':_0x56943c['as'],'attributes':_0x56943c[_0xbb10('0x1b')],'include':_0x56943c[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x56943c['include'],function(_0x111762){return{'model':db[_0x111762['model']],'as':_0x111762['as'],'attributes':_0x111762['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x40c164){logger[_0xbb10('0xd')](_0xbb10('0x21'),_0x448d5c);logger[_0xbb10('0x1f')](_0xbb10('0x21'),_0x448d5c,JSON['stringify'](_0x40c164));_0x16ad2a(_0x40c164);})[_0xbb10('0x20')](function(_0x25d72f){logger['error']('ShowCmHopper',_0x25d72f['message'],_0x448d5c);_0x1dcc9c(_0x56f2da[_0xbb10('0x12')](0x1f4,_0x25d72f[_0xbb10('0x13')]));});});};exports[_0xbb10('0x22')]=function(_0x4d5a9b){var _0x3c0cd7=this;return new Promise(function(_0x3e8538,_0x4345f3){return db['CmHopper'][_0xbb10('0x23')](_0x4d5a9b[_0xbb10('0x24')],{'raw':_0x4d5a9b[_0xbb10('0x18')]?_0x4d5a9b[_0xbb10('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0x110eb5){logger['info'](_0xbb10('0x22'),_0x4d5a9b);logger[_0xbb10('0x1f')](_0xbb10('0x22'),_0x4d5a9b,JSON[_0xbb10('0x11')](_0x110eb5));_0x3e8538(_0x110eb5);})[_0xbb10('0x20')](function(_0x185a52){logger['error'](_0xbb10('0x22'),_0x185a52[_0xbb10('0x13')],_0x4d5a9b);_0x4345f3(_0x3c0cd7[_0xbb10('0x12')](0x1f4,_0x185a52[_0xbb10('0x13')]));});});};exports['UpdateCmHopper']=function(_0x3fff6c){var _0x331751=this;return new Promise(function(_0x23dc18,_0x403beb){return db['CmHopper'][_0xbb10('0x25')](_0x3fff6c[_0xbb10('0x24')],{'raw':_0x3fff6c['options']?_0x3fff6c['options'][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fff6c['options']?_0x3fff6c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x3fff6c['options']?_0x3fff6c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x3fff6c[_0xbb10('0x18')]?_0x3fff6c['options'][_0xbb10('0x26')]||null:null})[_0xbb10('0xc')](function(_0x3b9fdf){logger[_0xbb10('0xd')](_0xbb10('0x27'),_0x3fff6c);logger[_0xbb10('0x1f')](_0xbb10('0x27'),_0x3fff6c,JSON[_0xbb10('0x11')](_0x3b9fdf));_0x23dc18(_0x3b9fdf);})[_0xbb10('0x20')](function(_0x43b948){logger[_0xbb10('0x12')](_0xbb10('0x27'),_0x43b948['message'],_0x3fff6c);_0x403beb(_0x331751[_0xbb10('0x12')](0x1f4,_0x43b948[_0xbb10('0x13')]));});});};exports['DestroyCmHopper']=function(_0x14e1cb){var _0x2f5027=this;return new Promise(function(_0x1a7df6,_0x5a5226){return db[_0xbb10('0x16')][_0xbb10('0x28')]({'where':_0x14e1cb[_0xbb10('0x18')]?_0x14e1cb['options']['where']||null:null})[_0xbb10('0xc')](function(_0x76a208){logger[_0xbb10('0xd')]('DestroyCmHopper',_0x14e1cb);logger['debug'](_0xbb10('0x29'),_0x14e1cb,JSON[_0xbb10('0x11')](_0x76a208));_0x1a7df6(_0x76a208);})[_0xbb10('0x20')](function(_0xf820fe){logger[_0xbb10('0x12')](_0xbb10('0x29'),_0xf820fe[_0xbb10('0x13')],_0x14e1cb);_0x5a5226(_0x2f5027[_0xbb10('0x12')](0x1f4,_0xf820fe[_0xbb10('0x13')]));});});};exports[_0xbb10('0x2a')]=function(_0x550111){var _0x5eafac=this;return new Promise(function(_0x412e13,_0x467dba){return db[_0xbb10('0x2b')][_0xbb10('0x2c')]()[_0xbb10('0xc')](function(_0x440f9e){return db[_0xbb10('0x2d')][_0xbb10('0x2e')](function(_0x1c0d8f){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'where':_0x550111[_0xbb10('0x18')]?_0x550111[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x550111[_0xbb10('0x18')]?_0x550111['options'][_0xbb10('0x1b')]||null:null,'limit':_0x550111['options']?_0x550111[_0xbb10('0x18')][_0xbb10('0x26')]||null:null,'order':_0x550111[_0xbb10('0x18')]?_0x550111[_0xbb10('0x18')][_0xbb10('0x2f')]||null:null,'transaction':_0x1c0d8f,'lock':_0x1c0d8f[_0xbb10('0x30')][_0xbb10('0x31')],'include':[{'model':db[_0xbb10('0x2b')],'as':_0xbb10('0x32'),'attributes':_[_0xbb10('0x33')](_0x440f9e)},{'model':db[_0xbb10('0x34')],'as':_0xbb10('0x35'),'attributes':['id',_0xbb10('0x36'),_0xbb10('0x37')]}]})[_0xbb10('0xc')](function(_0x5de0cc){var _0x4571b6=[];for(var _0x466eb7=0x0;_0x466eb7<_0x5de0cc[_0xbb10('0x38')];_0x466eb7+=0x1){_0x4571b6[_0xbb10('0x39')](_0x5de0cc[_0x466eb7][_0xbb10('0x25')](_0x550111[_0xbb10('0x24')],{'transaction':_0x1c0d8f}));}return BPromise['all'](_0x4571b6);});})[_0xbb10('0xc')](function(_0x4731ce){logger[_0xbb10('0xd')](_0xbb10('0x2a'),_0x550111);logger[_0xbb10('0x1f')](_0xbb10('0x2a'),_0x550111,JSON[_0xbb10('0x11')](_0x4731ce));_0x412e13(_0x4731ce);})[_0xbb10('0x20')](function(_0x205e01){logger[_0xbb10('0x12')](_0xbb10('0x2a'),_0x205e01[_0xbb10('0x13')],_0x550111);_0x467dba(_0x5eafac[_0xbb10('0x12')](0x1f4,_0x205e01['message']));});});});};exports['MoveContactManagedDialer']=function(_0x16272d){var _0x3e6338=this;return new Promise(function(_0x3d0cb7,_0x8b0a7d){return db['sequelize']['transaction'](function(_0x79411e){return db[_0xbb10('0x3a')][_0xbb10('0x23')](_0x16272d[_0xbb10('0x24')],{'raw':_0x16272d[_0xbb10('0x18')]?_0x16272d[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'transaction':_0x79411e})['then'](function(){return db[_0xbb10('0x16')][_0xbb10('0x28')]({'where':_0x16272d['options']?_0x16272d['options']['where']||null:null,'transaction':_0x79411e});});})[_0xbb10('0xc')](function(_0x31c727){logger[_0xbb10('0xd')]('MoveContactManagedDialer',_0x16272d);logger['debug']('MoveContactManagedDialer',_0x16272d,JSON[_0xbb10('0x11')](_0x31c727));_0x3d0cb7(_0x31c727);})[_0xbb10('0x20')](function(_0x45167a){logger['error'](_0xbb10('0x3b'),_0x45167a[_0xbb10('0x13')],_0x16272d);_0x8b0a7d(_0x3e6338['error'](0x1f4,_0x45167a['message']));});});};exports[_0xbb10('0x3c')]=function(_0x308896){var _0xd77753=this;return new Promise(function(_0x237246,_0x54b7c5){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x308896[_0xbb10('0x18')]?_0x308896['options'][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x308896[_0xbb10('0x18')]?_0x308896[_0xbb10('0x18')]['where']||null:null,'attributes':[[db[_0xbb10('0x2d')]['fn'](_0xbb10('0x3d'),db[_0xbb10('0x2d')]['fn']('IF',db[_0xbb10('0x2d')]['literal'](_0xbb10('0x3e')+util[_0xbb10('0x3f')](_0xbb10('0x40'),moment()[_0xbb10('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xbb10('0x41')))),_0xbb10('0x42')]]})[_0xbb10('0xc')](function(_0x2ceb3e){logger[_0xbb10('0xd')](_0xbb10('0x3c'),_0x308896);logger[_0xbb10('0x1f')]('CountReScheduled',_0x308896,JSON['stringify'](_0x2ceb3e));_0x237246(_0x2ceb3e);})['catch'](function(_0xdfbc0b){logger[_0xbb10('0x12')](_0xbb10('0x3c'),_0xdfbc0b['message'],_0x308896);_0x54b7c5(_0xd77753['error'](0x1f4,_0xdfbc0b[_0xbb10('0x13')]));});});};exports[_0xbb10('0x43')]=function(_0xd9e743){var _0x3a9677=this;return new Promise(function(_0x260e06,_0x1ad2ed){return db['CmContact'][_0xbb10('0x2c')]()[_0xbb10('0xc')](function(_0x270fdb){return db[_0xbb10('0x2d')][_0xbb10('0x2e')](function(_0x5bfc68){return db['CmHopper']['findAll']({'where':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':0x1,'order':_0xd9e743['options']?_0xd9e743[_0xbb10('0x18')]['order']||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x5bfc68,'lock':_0x5bfc68[_0xbb10('0x30')][_0xbb10('0x31')],'include':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0xd9e743['options']['include'],function(_0x165fe9){return{'model':db[_0x165fe9[_0xbb10('0x1e')]],'as':_0x165fe9['as'],'attributes':_0x165fe9[_0xbb10('0x1b')],'include':_0x165fe9[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x165fe9['include'],function(_0x2d52ea){return{'model':db[_0x2d52ea[_0xbb10('0x1e')]],'as':_0x2d52ea['as'],'attributes':_0x2d52ea[_0xbb10('0x1b')],'include':_0x2d52ea[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x2d52ea[_0xbb10('0x1c')],function(_0x174395){return{'model':db[_0x174395['model']],'as':_0x174395['as'],'attributes':_0x174395[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x30f3ea){var _0x322b41=[];for(var _0x37b20e=0x0;_0x37b20e<_0x30f3ea[_0xbb10('0x38')];_0x37b20e+=0x1){_0x322b41[_0xbb10('0x39')](_0x30f3ea[_0x37b20e][_0xbb10('0x25')](_0xd9e743['body'],{'transaction':_0x5bfc68}));}return BPromise[_0xbb10('0x44')](_0x322b41);});})[_0xbb10('0xc')](function(_0x145baf){logger['info']('GetContactRecallMe',_0xd9e743);logger['debug'](_0xbb10('0x43'),_0xd9e743,JSON['stringify'](_0x145baf));_0x260e06(_0x145baf);})['catch'](function(_0x1701c5){logger[_0xbb10('0x12')](_0xbb10('0x43'),_0x1701c5[_0xbb10('0x13')],_0xd9e743);_0x1ad2ed(_0x3a9677[_0xbb10('0x12')](0x1f4,_0x1701c5[_0xbb10('0x13')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index bb324bf..2e0ced3 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 _0x93e9=['connect-timeout','express','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/:id','show','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x93e9,0xcc));var _0x993e=function(_0x22f7a8,_0x11a6e9){_0x22f7a8=_0x22f7a8-0x0;var _0x3b7021=_0x93e9[_0x22f7a8];return _0x3b7021;};'use strict';var multer=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var path=require(_0x993e('0x2'));var timeout=require(_0x993e('0x3'));var express=require(_0x993e('0x4'));var router=express[_0x993e('0x5')]();var auth=require(_0x993e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x993e('0x7'));router[_0x993e('0x8')]('/',auth[_0x993e('0x9')](),controller[_0x993e('0xa')]);router[_0x993e('0x8')](_0x993e('0xb'),auth[_0x993e('0x9')](),controller[_0x993e('0xc')]);router['get'](_0x993e('0xd'),auth[_0x993e('0x9')](),controller[_0x993e('0xe')]);router[_0x993e('0x8')](_0x993e('0xf'),auth[_0x993e('0x9')](),controller[_0x993e('0x10')]);router['post']('/',auth[_0x993e('0x9')](),controller[_0x993e('0x11')]);router['post']('/preview',auth[_0x993e('0x9')](),controller['getPreview']);router[_0x993e('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x993e('0x13')]);router[_0x993e('0x14')](_0x993e('0xf'),auth[_0x993e('0x9')](),controller[_0x993e('0x15')]);module[_0x993e('0x16')]=router; \ No newline at end of file +var _0x76d2=['Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/opencontacts','/:id','show','post','/preview','getPreview','put','destroy','exports','multer','util','path','express'];(function(_0x495551,_0x960ada){var _0xc87698=function(_0x31c370){while(--_0x31c370){_0x495551['push'](_0x495551['shift']());}};_0xc87698(++_0x960ada);}(_0x76d2,0xf8));var _0x276d=function(_0x5d758e,_0x31e319){_0x5d758e=_0x5d758e-0x0;var _0x227809=_0x76d2[_0x5d758e];return _0x227809;};'use strict';var multer=require(_0x276d('0x0'));var util=require(_0x276d('0x1'));var path=require(_0x276d('0x2'));var timeout=require('connect-timeout');var express=require(_0x276d('0x3'));var router=express[_0x276d('0x4')]();var auth=require(_0x276d('0x5'));var interaction=require(_0x276d('0x6'));var config=require('../../config/environment');var controller=require('./cmHopper.controller');router[_0x276d('0x7')]('/',auth[_0x276d('0x8')](),controller[_0x276d('0x9')]);router[_0x276d('0x7')](_0x276d('0xa'),auth[_0x276d('0x8')](),controller[_0x276d('0xb')]);router[_0x276d('0x7')](_0x276d('0xc'),auth['isAuthenticated'](),controller['getOpenContacts']);router[_0x276d('0x7')](_0x276d('0xd'),auth[_0x276d('0x8')](),controller[_0x276d('0xe')]);router[_0x276d('0xf')]('/',auth[_0x276d('0x8')](),controller['create']);router['post'](_0x276d('0x10'),auth[_0x276d('0x8')](),controller[_0x276d('0x11')]);router[_0x276d('0x12')](_0x276d('0xd'),auth[_0x276d('0x8')](),controller['update']);router['delete'](_0x276d('0xd'),auth[_0x276d('0x8')](),controller[_0x276d('0x13')]);module[_0x276d('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 63ae3bb..fc27a1c 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 _0x3332=['STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x3fe6df,_0x5a04d4){var _0x372a0e=function(_0x144b98){while(--_0x144b98){_0x3fe6df['push'](_0x3fe6df['shift']());}};_0x372a0e(++_0x5a04d4);}(_0x3332,0xb7));var _0x2333=function(_0xce1a87,_0x372c44){_0xce1a87=_0xce1a87-0x0;var _0x26669d=_0x3332[_0xce1a87];return _0x26669d;};'use strict';var moment=require(_0x2333('0x0'));var Sequelize=require(_0x2333('0x1'));module['exports']={'phone':{'type':Sequelize[_0x2333('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x2333('0x3')],'unique':_0x2333('0x4')},'ListId':{'type':Sequelize[_0x2333('0x3')],'unique':_0x2333('0x4')},'VoiceQueueId':{'type':Sequelize[_0x2333('0x3')],'unique':_0x2333('0x4')}}; \ No newline at end of file +var _0xc7f6=['contactListQueue','moment','STRING','INTEGER'];(function(_0x41d954,_0x5b1e28){var _0x13be64=function(_0x500b01){while(--_0x500b01){_0x41d954['push'](_0x41d954['shift']());}};_0x13be64(++_0x5b1e28);}(_0xc7f6,0x161));var _0x6c7f=function(_0x41af5f,_0x501090){_0x41af5f=_0x41af5f-0x0;var _0x192035=_0xc7f6[_0x41af5f];return _0x192035;};'use strict';var moment=require(_0x6c7f('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x6c7f('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x6c7f('0x2')],'unique':_0x6c7f('0x3')},'ListId':{'type':Sequelize[_0x6c7f('0x2')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x6c7f('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 93fea33..0847d70 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 _0x57b7=['reject','save','update','then','destroy','error','send','index','map','rawAttributes','fieldName','type','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','CmHopperBlack','count','includeAll','include','findAll','rows','catch','show','params','options','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','json','offset','status','set','Content-Range','apply'];(function(_0x1bf754,_0x525e30){var _0xde86cc=function(_0x18ca71){while(--_0x18ca71){_0x1bf754['push'](_0x1bf754['shift']());}};_0xde86cc(++_0x525e30);}(_0x57b7,0x160));var _0x757b=function(_0x595c3a,_0x1e0e8c){_0x595c3a=_0x595c3a-0x0;var _0x5ec0cf=_0x57b7[_0x595c3a];return _0x5ec0cf;};'use strict';var pdf=require(_0x757b('0x0'));var emlformat=require(_0x757b('0x1'));var rimraf=require(_0x757b('0x2'));var zipdir=require(_0x757b('0x3'));var jsonpatch=require(_0x757b('0x4'));var rp=require(_0x757b('0x5'));var moment=require(_0x757b('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x757b('0x7'));var util=require(_0x757b('0x8'));var path=require(_0x757b('0x9'));var sox=require(_0x757b('0xa'));var csv=require('to-csv');var ejs=require(_0x757b('0xb'));var fs=require('fs');var _=require(_0x757b('0xc'));var squel=require(_0x757b('0xd'));var crypto=require(_0x757b('0xe'));var jsforce=require(_0x757b('0xf'));var deskjs=require(_0x757b('0x10'));var toCsv=require(_0x757b('0x11'));var querystring=require(_0x757b('0x12'));var Papa=require('papaparse');var Redis=require(_0x757b('0x13'));var authService=require(_0x757b('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x757b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x757b('0x16'))('api');var utils=require(_0x757b('0x17'));var config=require(_0x757b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2af9cb,_0xf94550){_0xf94550=_0xf94550||0xcc;return function(_0x5d6f0e){if(_0x5d6f0e){return _0x2af9cb[_0x757b('0x19')](_0xf94550);}return _0x2af9cb['status'](_0xf94550)[_0x757b('0x1a')]();};}function respondWithResult(_0x282354,_0x55438b){_0x55438b=_0x55438b||0xc8;return function(_0x2671a5){if(_0x2671a5){return _0x282354['status'](_0x55438b)[_0x757b('0x1b')](_0x2671a5);}};}function respondWithFilteredResult(_0x10abf4,_0x1a4c30){return function(_0x47e990){if(_0x47e990){var _0x1336e0=_0x47e990['count'],_0x585943=_0x1a4c30['offset'],_0x5c338e=_0x1a4c30[_0x757b('0x1c')]+_0x1a4c30['limit'],_0x268a27;if(_0x5c338e>=_0x1336e0){_0x5c338e=_0x1336e0;_0x268a27=0xc8;}else{_0x268a27=0xce;}_0x10abf4[_0x757b('0x1d')](_0x268a27);return _0x10abf4[_0x757b('0x1e')](_0x757b('0x1f'),_0x585943+'-'+_0x5c338e+'/'+_0x1336e0)['json'](_0x47e990);}return null;};}function patchUpdates(_0x5c86f8){return function(_0x26e20b){try{jsonpatch[_0x757b('0x20')](_0x26e20b,_0x5c86f8,!![]);}catch(_0x401182){return BPromise[_0x757b('0x21')](_0x401182);}return _0x26e20b[_0x757b('0x22')]();};}function saveUpdates(_0x9f4476,_0x4680e9){return function(_0x3e788a){if(_0x3e788a){return _0x3e788a[_0x757b('0x23')](_0x9f4476)[_0x757b('0x24')](function(_0x5ee3f8){return _0x5ee3f8;});}return null;};}function removeEntity(_0x6d680,_0x3a7c32){return function(_0x1f3cb5){if(_0x1f3cb5){return _0x1f3cb5[_0x757b('0x25')]()[_0x757b('0x24')](function(){_0x6d680[_0x757b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x200891,_0x4f7d6a){return function(_0x1b2803){if(!_0x1b2803){_0x200891[_0x757b('0x19')](0x194);}return _0x1b2803;};}function handleError(_0x2985ca,_0x110063){_0x110063=_0x110063||0x1f4;return function(_0x27a749){logger[_0x757b('0x26')](_0x27a749['stack']);if(_0x27a749['name']){delete _0x27a749['name'];}_0x2985ca[_0x757b('0x1d')](_0x110063)[_0x757b('0x27')](_0x27a749);};}exports[_0x757b('0x28')]=function(_0x583dde,_0x29be76){var _0x108022={},_0x1ef05b={},_0x1f9312={'count':0x0,'rows':[]};var _0x12ede3=_[_0x757b('0x29')](db['CmHopperBlack'][_0x757b('0x2a')],function(_0x33d887){return{'name':_0x33d887[_0x757b('0x2b')],'type':_0x33d887[_0x757b('0x2c')]['key']};});_0x1ef05b['model']=_['map'](_0x12ede3,_0x757b('0x2d'));_0x1ef05b[_0x757b('0x2e')]=_[_0x757b('0x2f')](_0x583dde[_0x757b('0x2e')]);_0x1ef05b[_0x757b('0x30')]=_[_0x757b('0x31')](_0x1ef05b[_0x757b('0x32')],_0x1ef05b[_0x757b('0x2e')]);_0x108022[_0x757b('0x33')]=_[_0x757b('0x31')](_0x1ef05b[_0x757b('0x32')],qs[_0x757b('0x34')](_0x583dde[_0x757b('0x2e')][_0x757b('0x34')]));_0x108022['attributes']=_0x108022['attributes'][_0x757b('0x35')]?_0x108022[_0x757b('0x33')]:_0x1ef05b[_0x757b('0x32')];if(!_0x583dde[_0x757b('0x2e')][_0x757b('0x36')](_0x757b('0x37'))){_0x108022['limit']=qs['limit'](_0x583dde[_0x757b('0x2e')][_0x757b('0x38')]);_0x108022[_0x757b('0x1c')]=qs['offset'](_0x583dde['query'][_0x757b('0x1c')]);}_0x108022[_0x757b('0x39')]=qs['sort'](_0x583dde[_0x757b('0x2e')][_0x757b('0x3a')]);_0x108022[_0x757b('0x3b')]=qs[_0x757b('0x30')](_[_0x757b('0x3c')](_0x583dde[_0x757b('0x2e')],_0x1ef05b[_0x757b('0x30')]));if(_0x583dde[_0x757b('0x2e')][_0x757b('0x3d')]){_0x108022[_0x757b('0x3b')]=_[_0x757b('0x3e')](_0x108022[_0x757b('0x3b')],{'$or':_[_0x757b('0x29')](_0x12ede3,function(_0x232a0a){if(_0x232a0a['type']!==_0x757b('0x3f')){var _0x56f89e={};_0x56f89e[_0x232a0a['name']]={'$like':'%'+_0x583dde[_0x757b('0x2e')][_0x757b('0x3d')]+'%'};return _0x56f89e;}})});}_0x108022=_[_0x757b('0x3e')]({},_0x108022,_0x583dde['options']);var _0x4e8d1a={'where':_0x108022[_0x757b('0x3b')]};return db[_0x757b('0x40')][_0x757b('0x41')](_0x4e8d1a)['then'](function(_0x42ff3e){_0x1f9312[_0x757b('0x41')]=_0x42ff3e;if(_0x583dde['query'][_0x757b('0x42')]){_0x108022[_0x757b('0x43')]=[{'all':!![]}];}return db[_0x757b('0x40')][_0x757b('0x44')](_0x108022);})['then'](function(_0x295ade){_0x1f9312[_0x757b('0x45')]=_0x295ade;return _0x1f9312;})[_0x757b('0x24')](respondWithFilteredResult(_0x29be76,_0x108022))[_0x757b('0x46')](handleError(_0x29be76,null));};exports[_0x757b('0x47')]=function(_0x35f1b8,_0x1bfbac){var _0x1c228b={'raw':!![],'where':{'id':_0x35f1b8[_0x757b('0x48')]['id']}},_0x325aed={};_0x325aed[_0x757b('0x32')]=_[_0x757b('0x2f')](db['CmHopperBlack'][_0x757b('0x2a')]);_0x325aed['query']=_[_0x757b('0x2f')](_0x35f1b8[_0x757b('0x2e')]);_0x325aed['filters']=_['intersection'](_0x325aed[_0x757b('0x32')],_0x325aed[_0x757b('0x2e')]);_0x1c228b[_0x757b('0x33')]=_[_0x757b('0x31')](_0x325aed['model'],qs[_0x757b('0x34')](_0x35f1b8['query'][_0x757b('0x34')]));_0x1c228b[_0x757b('0x33')]=_0x1c228b[_0x757b('0x33')][_0x757b('0x35')]?_0x1c228b['attributes']:_0x325aed[_0x757b('0x32')];if(_0x35f1b8[_0x757b('0x2e')]['includeAll']){_0x1c228b[_0x757b('0x43')]=[{'all':!![]}];}_0x1c228b=_['merge']({},_0x1c228b,_0x35f1b8[_0x757b('0x49')]);return db[_0x757b('0x40')]['find'](_0x1c228b)[_0x757b('0x24')](handleEntityNotFound(_0x1bfbac,null))[_0x757b('0x24')](respondWithResult(_0x1bfbac,null))[_0x757b('0x46')](handleError(_0x1bfbac,null));};exports['update']=function(_0x42374a,_0xb0486d){if(_0x42374a['body']['id']){delete _0x42374a['body']['id'];}return db[_0x757b('0x40')]['find']({'where':{'id':_0x42374a['params']['id']}})[_0x757b('0x24')](handleEntityNotFound(_0xb0486d,null))[_0x757b('0x24')](saveUpdates(_0x42374a[_0x757b('0x4a')],null))[_0x757b('0x24')](respondWithResult(_0xb0486d,null))['catch'](handleError(_0xb0486d,null));};exports[_0x757b('0x25')]=function(_0xc20797,_0x3881e0){return db[_0x757b('0x40')][_0x757b('0x4b')]({'where':{'id':_0xc20797[_0x757b('0x48')]['id']}})[_0x757b('0x24')](handleEntityNotFound(_0x3881e0,null))[_0x757b('0x24')](removeEntity(_0x3881e0,null))[_0x757b('0x46')](handleError(_0x3881e0,null));};exports[_0x757b('0x4c')]=function(_0x469025,_0x32034b){return db['CmHopperBlack'][_0x757b('0x4c')]()['then'](respondWithResult(_0x32034b,null))[_0x757b('0x46')](handleError(_0x32034b,null));}; \ No newline at end of file +var _0x583c=['merge','VIRTUAL','filter','options','includeAll','CmHopperBlack','findAll','rows','catch','show','params','include','find','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick'];(function(_0x965d58,_0x29d76d){var _0x735e15=function(_0x5072f1){while(--_0x5072f1){_0x965d58['push'](_0x965d58['shift']());}};_0x735e15(++_0x29d76d);}(_0x583c,0x12b));var _0xc583=function(_0x187718,_0x427383){_0x187718=_0x187718-0x0;var _0x29ddf4=_0x583c[_0x187718];return _0x29ddf4;};'use strict';var pdf=require(_0xc583('0x0'));var emlformat=require(_0xc583('0x1'));var rimraf=require(_0xc583('0x2'));var zipdir=require(_0xc583('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc583('0x4'));var moment=require(_0xc583('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc583('0x6'));var path=require(_0xc583('0x7'));var sox=require('sox');var csv=require(_0xc583('0x8'));var ejs=require(_0xc583('0x9'));var fs=require('fs');var _=require(_0xc583('0xa'));var squel=require(_0xc583('0xb'));var crypto=require('crypto');var jsforce=require(_0xc583('0xc'));var deskjs=require(_0xc583('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc583('0xe'));var Papa=require(_0xc583('0xf'));var Redis=require(_0xc583('0x10'));var authService=require(_0xc583('0x11'));var qs=require(_0xc583('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc583('0x13'));var logger=require(_0xc583('0x14'))('api');var utils=require(_0xc583('0x15'));var config=require(_0xc583('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c2424,_0x87632d){_0x87632d=_0x87632d||0xcc;return function(_0x24343b){if(_0x24343b){return _0x2c2424[_0xc583('0x17')](_0x87632d);}return _0x2c2424[_0xc583('0x18')](_0x87632d)[_0xc583('0x19')]();};}function respondWithResult(_0x183cca,_0xf81809){_0xf81809=_0xf81809||0xc8;return function(_0x1c6b79){if(_0x1c6b79){return _0x183cca['status'](_0xf81809)[_0xc583('0x1a')](_0x1c6b79);}};}function respondWithFilteredResult(_0x51ecd7,_0x19f46a){return function(_0x299fa1){if(_0x299fa1){var _0x510090=_0x299fa1[_0xc583('0x1b')],_0x263552=_0x19f46a[_0xc583('0x1c')],_0x311ad5=_0x19f46a['offset']+_0x19f46a[_0xc583('0x1d')],_0x5b1871;if(_0x311ad5>=_0x510090){_0x311ad5=_0x510090;_0x5b1871=0xc8;}else{_0x5b1871=0xce;}_0x51ecd7[_0xc583('0x18')](_0x5b1871);return _0x51ecd7[_0xc583('0x1e')](_0xc583('0x1f'),_0x263552+'-'+_0x311ad5+'/'+_0x510090)['json'](_0x299fa1);}return null;};}function patchUpdates(_0x3dd3cc){return function(_0x48a65a){try{jsonpatch[_0xc583('0x20')](_0x48a65a,_0x3dd3cc,!![]);}catch(_0x471db2){return BPromise[_0xc583('0x21')](_0x471db2);}return _0x48a65a[_0xc583('0x22')]();};}function saveUpdates(_0x1052b5,_0x12b910){return function(_0x3ce81b){if(_0x3ce81b){return _0x3ce81b[_0xc583('0x23')](_0x1052b5)[_0xc583('0x24')](function(_0x197b0a){return _0x197b0a;});}return null;};}function removeEntity(_0x29a9be,_0x3b31bc){return function(_0x21466f){if(_0x21466f){return _0x21466f['destroy']()['then'](function(){_0x29a9be[_0xc583('0x18')](0xcc)[_0xc583('0x19')]();});}};}function handleEntityNotFound(_0x8443dc,_0x5ceef1){return function(_0x1521e2){if(!_0x1521e2){_0x8443dc[_0xc583('0x17')](0x194);}return _0x1521e2;};}function handleError(_0x37f156,_0x4688bd){_0x4688bd=_0x4688bd||0x1f4;return function(_0x25c5af){logger['error'](_0x25c5af['stack']);if(_0x25c5af[_0xc583('0x25')]){delete _0x25c5af['name'];}_0x37f156[_0xc583('0x18')](_0x4688bd)[_0xc583('0x26')](_0x25c5af);};}exports[_0xc583('0x27')]=function(_0x1e7809,_0x24aab5){var _0x4b1c18={},_0x2dafb4={},_0x44f76a={'count':0x0,'rows':[]};var _0x4adde3=_[_0xc583('0x28')](db['CmHopperBlack'][_0xc583('0x29')],function(_0x8d4ecb){return{'name':_0x8d4ecb[_0xc583('0x2a')],'type':_0x8d4ecb[_0xc583('0x2b')][_0xc583('0x2c')]};});_0x2dafb4[_0xc583('0x2d')]=_[_0xc583('0x28')](_0x4adde3,'name');_0x2dafb4[_0xc583('0x2e')]=_[_0xc583('0x2f')](_0x1e7809[_0xc583('0x2e')]);_0x2dafb4[_0xc583('0x30')]=_[_0xc583('0x31')](_0x2dafb4[_0xc583('0x2d')],_0x2dafb4['query']);_0x4b1c18[_0xc583('0x32')]=_['intersection'](_0x2dafb4['model'],qs[_0xc583('0x33')](_0x1e7809[_0xc583('0x2e')][_0xc583('0x33')]));_0x4b1c18[_0xc583('0x32')]=_0x4b1c18[_0xc583('0x32')]['length']?_0x4b1c18[_0xc583('0x32')]:_0x2dafb4[_0xc583('0x2d')];if(!_0x1e7809[_0xc583('0x2e')]['hasOwnProperty'](_0xc583('0x34'))){_0x4b1c18['limit']=qs[_0xc583('0x1d')](_0x1e7809[_0xc583('0x2e')][_0xc583('0x1d')]);_0x4b1c18[_0xc583('0x1c')]=qs[_0xc583('0x1c')](_0x1e7809['query'][_0xc583('0x1c')]);}_0x4b1c18['order']=qs[_0xc583('0x35')](_0x1e7809['query'][_0xc583('0x35')]);_0x4b1c18[_0xc583('0x36')]=qs[_0xc583('0x30')](_[_0xc583('0x37')](_0x1e7809[_0xc583('0x2e')],_0x2dafb4[_0xc583('0x30')]));if(_0x1e7809['query']['filter']){_0x4b1c18[_0xc583('0x36')]=_[_0xc583('0x38')](_0x4b1c18['where'],{'$or':_[_0xc583('0x28')](_0x4adde3,function(_0x16efcc){if(_0x16efcc[_0xc583('0x2b')]!==_0xc583('0x39')){var _0x37b8c7={};_0x37b8c7[_0x16efcc[_0xc583('0x25')]]={'$like':'%'+_0x1e7809['query'][_0xc583('0x3a')]+'%'};return _0x37b8c7;}})});}_0x4b1c18=_['merge']({},_0x4b1c18,_0x1e7809[_0xc583('0x3b')]);var _0x22cc57={'where':_0x4b1c18[_0xc583('0x36')]};return db['CmHopperBlack']['count'](_0x22cc57)['then'](function(_0x26a348){_0x44f76a[_0xc583('0x1b')]=_0x26a348;if(_0x1e7809[_0xc583('0x2e')][_0xc583('0x3c')]){_0x4b1c18['include']=[{'all':!![]}];}return db[_0xc583('0x3d')][_0xc583('0x3e')](_0x4b1c18);})['then'](function(_0x48930a){_0x44f76a[_0xc583('0x3f')]=_0x48930a;return _0x44f76a;})['then'](respondWithFilteredResult(_0x24aab5,_0x4b1c18))[_0xc583('0x40')](handleError(_0x24aab5,null));};exports[_0xc583('0x41')]=function(_0xe73752,_0x40b888){var _0x58553e={'raw':!![],'where':{'id':_0xe73752[_0xc583('0x42')]['id']}},_0x44c22f={};_0x44c22f[_0xc583('0x2d')]=_[_0xc583('0x2f')](db[_0xc583('0x3d')]['rawAttributes']);_0x44c22f[_0xc583('0x2e')]=_['keys'](_0xe73752['query']);_0x44c22f[_0xc583('0x30')]=_[_0xc583('0x31')](_0x44c22f['model'],_0x44c22f['query']);_0x58553e[_0xc583('0x32')]=_[_0xc583('0x31')](_0x44c22f[_0xc583('0x2d')],qs[_0xc583('0x33')](_0xe73752['query'][_0xc583('0x33')]));_0x58553e['attributes']=_0x58553e[_0xc583('0x32')]['length']?_0x58553e[_0xc583('0x32')]:_0x44c22f[_0xc583('0x2d')];if(_0xe73752[_0xc583('0x2e')][_0xc583('0x3c')]){_0x58553e[_0xc583('0x43')]=[{'all':!![]}];}_0x58553e=_['merge']({},_0x58553e,_0xe73752[_0xc583('0x3b')]);return db[_0xc583('0x3d')][_0xc583('0x44')](_0x58553e)['then'](handleEntityNotFound(_0x40b888,null))['then'](respondWithResult(_0x40b888,null))['catch'](handleError(_0x40b888,null));};exports[_0xc583('0x23')]=function(_0x571ddf,_0x27a7c2){if(_0x571ddf[_0xc583('0x45')]['id']){delete _0x571ddf[_0xc583('0x45')]['id'];}return db[_0xc583('0x3d')][_0xc583('0x44')]({'where':{'id':_0x571ddf[_0xc583('0x42')]['id']}})[_0xc583('0x24')](handleEntityNotFound(_0x27a7c2,null))[_0xc583('0x24')](saveUpdates(_0x571ddf[_0xc583('0x45')],null))[_0xc583('0x24')](respondWithResult(_0x27a7c2,null))[_0xc583('0x40')](handleError(_0x27a7c2,null));};exports['destroy']=function(_0x37e7f7,_0x121262){return db[_0xc583('0x3d')][_0xc583('0x44')]({'where':{'id':_0x37e7f7['params']['id']}})[_0xc583('0x24')](handleEntityNotFound(_0x121262,null))[_0xc583('0x24')](removeEntity(_0x121262,null))[_0xc583('0x40')](handleError(_0x121262,null));};exports[_0xc583('0x46')]=function(_0x35ff5e,_0x22da88){return db[_0xc583('0x3d')][_0xc583('0x46')]()[_0xc583('0x24')](respondWithResult(_0x22da88,null))['catch'](handleError(_0x22da88,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index fe3abdc..bb56f45 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 _0x1909=['cm_hopper_black','util','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack'];(function(_0x33f7b6,_0x8ce322){var _0x2cec9f=function(_0x3a8e0d){while(--_0x3a8e0d){_0x33f7b6['push'](_0x33f7b6['shift']());}};_0x2cec9f(++_0x8ce322);}(_0x1909,0xcd));var _0x9190=function(_0xad3197,_0x116aeb){_0xad3197=_0xad3197-0x0;var _0xc0530c=_0x1909[_0xad3197];return _0xc0530c;};'use strict';var _=require('lodash');var util=require(_0x9190('0x0'));var logger=require('../../config/logger')(_0x9190('0x1'));var moment=require(_0x9190('0x2'));var BPromise=require('bluebird');var rp=require(_0x9190('0x3'));var fs=require('fs');var path=require(_0x9190('0x4'));var rimraf=require(_0x9190('0x5'));var config=require(_0x9190('0x6'));var attributes=require(_0x9190('0x7'));module[_0x9190('0x8')]=function(_0x243032,_0xa7b168){return _0x243032[_0x9190('0x9')](_0x9190('0xa'),attributes,{'tableName':_0x9190('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7683=['./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7683,0x1b3));var _0x3768=function(_0x1a72b8,_0x1e4f4b){_0x1a72b8=_0x1a72b8-0x0;var _0x39f72d=_0x7683[_0x1a72b8];return _0x39f72d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3768('0x0'))(_0x3768('0x1'));var moment=require('moment');var BPromise=require(_0x3768('0x2'));var rp=require(_0x3768('0x3'));var fs=require('fs');var path=require(_0x3768('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3768('0x5'));module[_0x3768('0x6')]=function(_0x1a60ce,_0x1a4ecf){return _0x1a60ce[_0x3768('0x7')](_0x3768('0x8'),attributes,{'tableName':_0x3768('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 045d7a3..21821d0 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 _0xec8a=['moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetCmHopperBlack','CmHopperBlack','update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash'];(function(_0x36ecd0,_0x96a33d){var _0x26d9c8=function(_0x11485e){while(--_0x11485e){_0x36ecd0['push'](_0x36ecd0['shift']());}};_0x26d9c8(++_0x96a33d);}(_0xec8a,0xfb));var _0xaec8=function(_0x2db965,_0x4a6339){_0x2db965=_0x2db965-0x0;var _0x28809e=_0xec8a[_0x2db965];return _0x28809e;};'use strict';var _=require(_0xaec8('0x0'));var util=require('util');var moment=require(_0xaec8('0x1'));var BPromise=require('bluebird');var rs=require(_0xaec8('0x2'));var fs=require('fs');var Redis=require(_0xaec8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xaec8('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xaec8('0x5'));var jayson=require(_0xaec8('0x6'));var client=jayson[_0xaec8('0x7')][_0xaec8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d7bcb,_0x3d56d6,_0x221b28){return new BPromise(function(_0x5a526f,_0x5d20de){return client['request'](_0x1d7bcb,_0x221b28)[_0xaec8('0x9')](function(_0x5ec193){logger['info'](_0xaec8('0xa'),_0x3d56d6,_0xaec8('0xb'));logger[_0xaec8('0xc')](_0xaec8('0xd'),_0x3d56d6,_0xaec8('0xb'),JSON[_0xaec8('0xe')](_0x5ec193));if(_0x5ec193[_0xaec8('0xf')]){if(_0x5ec193[_0xaec8('0xf')][_0xaec8('0x10')]===0x1f4){logger[_0xaec8('0xf')](_0xaec8('0xa'),_0x3d56d6,_0x5ec193[_0xaec8('0xf')][_0xaec8('0x11')]);return _0x5d20de(_0x5ec193[_0xaec8('0xf')][_0xaec8('0x11')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x3d56d6,_0x5ec193[_0xaec8('0xf')][_0xaec8('0x11')]);return _0x5a526f(_0x5ec193[_0xaec8('0xf')]['message']);}else{logger[_0xaec8('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x3d56d6,_0xaec8('0xb'));_0x5a526f(_0x5ec193['result'][_0xaec8('0x11')]);}})[_0xaec8('0x13')](function(_0x3505e7){logger[_0xaec8('0xf')](_0xaec8('0xa'),_0x3d56d6,_0x3505e7);_0x5d20de(_0x3505e7);});});}exports['GetCmHopperBlack']=function(_0x55f792){var _0x40d5c8=this;return new Promise(function(_0x7a9fe8,_0x30e8e2){return db['CmHopperBlack'][_0xaec8('0x14')]({'raw':_0x55f792[_0xaec8('0x15')]?_0x55f792['options'][_0xaec8('0x16')]===undefined?!![]:![]:!![],'where':_0x55f792['options']?_0x55f792['options'][_0xaec8('0x17')]||null:null,'attributes':_0x55f792['options']?_0x55f792[_0xaec8('0x15')][_0xaec8('0x18')]||null:null,'limit':_0x55f792[_0xaec8('0x15')]?_0x55f792[_0xaec8('0x15')][_0xaec8('0x19')]||null:null,'include':_0x55f792[_0xaec8('0x15')]?_0x55f792[_0xaec8('0x15')][_0xaec8('0x1a')]?_[_0xaec8('0x1b')](_0x55f792[_0xaec8('0x15')]['include'],function(_0x32ec8e){return{'model':db[_0x32ec8e[_0xaec8('0x1c')]],'as':_0x32ec8e['as'],'attributes':_0x32ec8e['attributes'],'include':_0x32ec8e['include']?_['map'](_0x32ec8e[_0xaec8('0x1a')],function(_0x952d45){return{'model':db[_0x952d45[_0xaec8('0x1c')]],'as':_0x952d45['as'],'attributes':_0x952d45[_0xaec8('0x18')],'include':_0x952d45[_0xaec8('0x1a')]?_['map'](_0x952d45[_0xaec8('0x1a')],function(_0x109c36){return{'model':db[_0x109c36[_0xaec8('0x1c')]],'as':_0x109c36['as'],'attributes':_0x109c36[_0xaec8('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ec0d1){logger['info']('GetCmHopperBlack',_0x55f792);logger[_0xaec8('0xc')](_0xaec8('0x1d'),_0x55f792,JSON[_0xaec8('0xe')](_0x2ec0d1));_0x7a9fe8(_0x2ec0d1);})[_0xaec8('0x13')](function(_0x3cd0de){logger[_0xaec8('0xf')](_0xaec8('0x1d'),_0x3cd0de[_0xaec8('0x11')],_0x55f792);_0x30e8e2(_0x40d5c8[_0xaec8('0xf')](0x1f4,_0x3cd0de[_0xaec8('0x11')]));});});};exports['UpdateCmHopperBlack']=function(_0x1c3954){var _0x581f0e=this;return new Promise(function(_0x58751b,_0x30e8ef){return db[_0xaec8('0x1e')][_0xaec8('0x1f')](_0x1c3954[_0xaec8('0x20')],{'raw':_0x1c3954[_0xaec8('0x15')]?_0x1c3954[_0xaec8('0x15')][_0xaec8('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c3954[_0xaec8('0x15')]?_0x1c3954[_0xaec8('0x15')][_0xaec8('0x17')]||null:null,'attributes':_0x1c3954['options']?_0x1c3954[_0xaec8('0x15')][_0xaec8('0x18')]||null:null,'limit':_0x1c3954['options']?_0x1c3954[_0xaec8('0x15')][_0xaec8('0x19')]||null:null})[_0xaec8('0x9')](function(_0x10c63f){logger[_0xaec8('0x12')]('UpdateCmHopperBlack',_0x1c3954);logger['debug'](_0xaec8('0x21'),_0x1c3954,JSON[_0xaec8('0xe')](_0x10c63f));_0x58751b(_0x10c63f);})[_0xaec8('0x13')](function(_0x53481e){logger[_0xaec8('0xf')](_0xaec8('0x21'),_0x53481e['message'],_0x1c3954);_0x30e8ef(_0x581f0e[_0xaec8('0xf')](0x1f4,_0x53481e[_0xaec8('0x11')]));});});};exports[_0xaec8('0x22')]=function(_0x500daf){var _0x2fef42=this;return new Promise(function(_0x1daccc,_0x47381f){return db[_0xaec8('0x1e')][_0xaec8('0x23')]({'where':_0x500daf['options']?_0x500daf[_0xaec8('0x15')]['where']||null:null})[_0xaec8('0x9')](function(_0x5e7507){logger[_0xaec8('0x12')](_0xaec8('0x22'),_0x500daf);logger[_0xaec8('0xc')](_0xaec8('0x22'),_0x500daf,JSON[_0xaec8('0xe')](_0x5e7507));_0x1daccc(_0x5e7507);})['catch'](function(_0x14eba1){logger[_0xaec8('0xf')]('DestroyCmHopperBlack',_0x14eba1[_0xaec8('0x11')],_0x500daf);_0x47381f(_0x2fef42[_0xaec8('0xf')](0x1f4,_0x14eba1[_0xaec8('0x11')]));});});}; \ No newline at end of file +var _0x9fba=['info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','result','CmHopperBlack','findAll','options','raw','where','attributes','include','map','model','GetCmHopperBlack','stringify','UpdateCmHopperBlack','body','catch','DestroyCmHopperBlack','destroy','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then'];(function(_0x5eda66,_0x5d360d){var _0x443ecc=function(_0x229934){while(--_0x229934){_0x5eda66['push'](_0x5eda66['shift']());}};_0x443ecc(++_0x5d360d);}(_0x9fba,0x19a));var _0xa9fb=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x9fba[_0x2283dc];return _0x16db90;};'use strict';var _=require(_0xa9fb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa9fb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa9fb('0x2'));var db=require(_0xa9fb('0x3'))['db'];var utils=require(_0xa9fb('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa9fb('0x5'));var client=jayson[_0xa9fb('0x6')][_0xa9fb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x519a45,_0x4802ee,_0x34fb8b){return new BPromise(function(_0x162dab,_0x2bfcd0){return client[_0xa9fb('0x8')](_0x519a45,_0x34fb8b)[_0xa9fb('0x9')](function(_0x42eb75){logger[_0xa9fb('0xa')](_0xa9fb('0xb'),_0x4802ee,_0xa9fb('0xc'));logger[_0xa9fb('0xd')](_0xa9fb('0xe'),_0x4802ee,_0xa9fb('0xc'),JSON['stringify'](_0x42eb75));if(_0x42eb75[_0xa9fb('0xf')]){if(_0x42eb75[_0xa9fb('0xf')][_0xa9fb('0x10')]===0x1f4){logger['error'](_0xa9fb('0xb'),_0x4802ee,_0x42eb75[_0xa9fb('0xf')][_0xa9fb('0x11')]);return _0x2bfcd0(_0x42eb75[_0xa9fb('0xf')][_0xa9fb('0x11')]);}logger[_0xa9fb('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x4802ee,_0x42eb75['error']['message']);return _0x162dab(_0x42eb75[_0xa9fb('0xf')][_0xa9fb('0x11')]);}else{logger[_0xa9fb('0xa')](_0xa9fb('0xb'),_0x4802ee,_0xa9fb('0xc'));_0x162dab(_0x42eb75[_0xa9fb('0x12')]['message']);}})['catch'](function(_0x9e1eab){logger[_0xa9fb('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x4802ee,_0x9e1eab);_0x2bfcd0(_0x9e1eab);});});}exports['GetCmHopperBlack']=function(_0x4a4cb3){var _0x502244=this;return new Promise(function(_0x4e6f9,_0x243bbd){return db[_0xa9fb('0x13')][_0xa9fb('0x14')]({'raw':_0x4a4cb3['options']?_0x4a4cb3[_0xa9fb('0x15')][_0xa9fb('0x16')]===undefined?!![]:![]:!![],'where':_0x4a4cb3[_0xa9fb('0x15')]?_0x4a4cb3[_0xa9fb('0x15')][_0xa9fb('0x17')]||null:null,'attributes':_0x4a4cb3[_0xa9fb('0x15')]?_0x4a4cb3[_0xa9fb('0x15')][_0xa9fb('0x18')]||null:null,'limit':_0x4a4cb3[_0xa9fb('0x15')]?_0x4a4cb3['options']['limit']||null:null,'include':_0x4a4cb3[_0xa9fb('0x15')]?_0x4a4cb3[_0xa9fb('0x15')][_0xa9fb('0x19')]?_[_0xa9fb('0x1a')](_0x4a4cb3[_0xa9fb('0x15')][_0xa9fb('0x19')],function(_0x336f6e){return{'model':db[_0x336f6e[_0xa9fb('0x1b')]],'as':_0x336f6e['as'],'attributes':_0x336f6e[_0xa9fb('0x18')],'include':_0x336f6e[_0xa9fb('0x19')]?_[_0xa9fb('0x1a')](_0x336f6e[_0xa9fb('0x19')],function(_0x23dad1){return{'model':db[_0x23dad1[_0xa9fb('0x1b')]],'as':_0x23dad1['as'],'attributes':_0x23dad1[_0xa9fb('0x18')],'include':_0x23dad1[_0xa9fb('0x19')]?_[_0xa9fb('0x1a')](_0x23dad1[_0xa9fb('0x19')],function(_0x52c354){return{'model':db[_0x52c354['model']],'as':_0x52c354['as'],'attributes':_0x52c354[_0xa9fb('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa9fb('0x9')](function(_0x2b483f){logger[_0xa9fb('0xa')]('GetCmHopperBlack',_0x4a4cb3);logger[_0xa9fb('0xd')](_0xa9fb('0x1c'),_0x4a4cb3,JSON[_0xa9fb('0x1d')](_0x2b483f));_0x4e6f9(_0x2b483f);})['catch'](function(_0x120551){logger[_0xa9fb('0xf')](_0xa9fb('0x1c'),_0x120551[_0xa9fb('0x11')],_0x4a4cb3);_0x243bbd(_0x502244[_0xa9fb('0xf')](0x1f4,_0x120551[_0xa9fb('0x11')]));});});};exports[_0xa9fb('0x1e')]=function(_0x4c314e){var _0x2d156a=this;return new Promise(function(_0x4ba4f0,_0x15d79f){return db[_0xa9fb('0x13')]['update'](_0x4c314e[_0xa9fb('0x1f')],{'raw':_0x4c314e['options']?_0x4c314e[_0xa9fb('0x15')][_0xa9fb('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c314e[_0xa9fb('0x15')]?_0x4c314e[_0xa9fb('0x15')]['where']||null:null,'attributes':_0x4c314e[_0xa9fb('0x15')]?_0x4c314e[_0xa9fb('0x15')][_0xa9fb('0x18')]||null:null,'limit':_0x4c314e[_0xa9fb('0x15')]?_0x4c314e[_0xa9fb('0x15')]['limit']||null:null})[_0xa9fb('0x9')](function(_0x1d3a06){logger['info'](_0xa9fb('0x1e'),_0x4c314e);logger['debug'](_0xa9fb('0x1e'),_0x4c314e,JSON[_0xa9fb('0x1d')](_0x1d3a06));_0x4ba4f0(_0x1d3a06);})[_0xa9fb('0x20')](function(_0x3347d2){logger['error'](_0xa9fb('0x1e'),_0x3347d2[_0xa9fb('0x11')],_0x4c314e);_0x15d79f(_0x2d156a[_0xa9fb('0xf')](0x1f4,_0x3347d2[_0xa9fb('0x11')]));});});};exports[_0xa9fb('0x21')]=function(_0x154cb8){var _0x2cf87e=this;return new Promise(function(_0x2f9587,_0x2a03c6){return db['CmHopperBlack'][_0xa9fb('0x22')]({'where':_0x154cb8[_0xa9fb('0x15')]?_0x154cb8[_0xa9fb('0x15')][_0xa9fb('0x17')]||null:null})[_0xa9fb('0x9')](function(_0x248af6){logger['info']('DestroyCmHopperBlack',_0x154cb8);logger[_0xa9fb('0xd')]('DestroyCmHopperBlack',_0x154cb8,JSON['stringify'](_0x248af6));_0x2f9587(_0x248af6);})[_0xa9fb('0x20')](function(_0x183ea0){logger[_0xa9fb('0xf')](_0xa9fb('0x21'),_0x183ea0[_0xa9fb('0x11')],_0x154cb8);_0x2a03c6(_0x2cf87e[_0xa9fb('0xf')](0x1f4,_0x183ea0[_0xa9fb('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index a33cfe7..e2e94be 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 _0xf3cd=['../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','/:id','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x4ffc34,_0x5db65f){_0x4ffc34=_0x4ffc34-0x0;var _0x46b4df=_0xf3cd[_0x4ffc34];return _0x46b4df;};'use strict';var multer=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var path=require(_0xdf3c('0x2'));var timeout=require(_0xdf3c('0x3'));var express=require(_0xdf3c('0x4'));var router=express[_0xdf3c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xdf3c('0x6'));var config=require(_0xdf3c('0x7'));var controller=require(_0xdf3c('0x8'));router['get']('/',auth[_0xdf3c('0x9')](),controller[_0xdf3c('0xa')]);router[_0xdf3c('0xb')](_0xdf3c('0xc'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0xd')]);router['get'](_0xdf3c('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xdf3c('0xf')](_0xdf3c('0xe'),auth['isAuthenticated'](),controller[_0xdf3c('0x10')]);router[_0xdf3c('0x11')](_0xdf3c('0xe'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x12')]);module[_0xdf3c('0x13')]=router; \ No newline at end of file +var _0xa41a=['../../config/environment','./cmHopperBlack.controller','get','index','describe','isAuthenticated','show','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2c2af2,_0x5f2c06){var _0x4d760d=function(_0x1f2374){while(--_0x1f2374){_0x2c2af2['push'](_0x2c2af2['shift']());}};_0x4d760d(++_0x5f2c06);}(_0xa41a,0x6b));var _0xaa41=function(_0x852e38,_0x5e74a5){_0x852e38=_0x852e38-0x0;var _0x75db94=_0xa41a[_0x852e38];return _0x75db94;};'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')]('/describe',auth['isAuthenticated'](),controller[_0xaa41('0xb')]);router[_0xaa41('0x9')]('/:id',auth[_0xaa41('0xc')](),controller[_0xaa41('0xd')]);router[_0xaa41('0xe')](_0xaa41('0xf'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x10')]);router[_0xaa41('0x11')](_0xaa41('0xf'),auth[_0xaa41('0xc')](),controller['destroy']);module[_0xaa41('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index b2172cb..8538874 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 _0x4826=['sequelize','exports','STRING','DATE','INTEGER','getDataValue','endtime','diff','setDataValue','dispositionat','BOOLEAN'];(function(_0x1b69bb,_0x5ff367){var _0xc62ce6=function(_0x2d80d7){while(--_0x2d80d7){_0x1b69bb['push'](_0x1b69bb['shift']());}};_0xc62ce6(++_0x5ff367);}(_0x4826,0x1c3));var _0x6482=function(_0x3eb5d3,_0xbd0292){_0x3eb5d3=_0x3eb5d3-0x0;var _0x56b544=_0x4826[_0x3eb5d3];return _0x56b544;};'use strict';var Sequelize=require(_0x6482('0x0'));var moment=require('moment');module[_0x6482('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x6482('0x2')]},'scheduledat':{'type':Sequelize[_0x6482('0x3')]},'countbusyretry':{'type':Sequelize[_0x6482('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6482('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6482('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6482('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x6482('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6482('0x2')]},'calleridname':{'type':Sequelize[_0x6482('0x2')]},'starttime':{'type':Sequelize[_0x6482('0x3')]},'responsetime':{'type':Sequelize[_0x6482('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x6482('0x3')]},'endtime':{'type':Sequelize[_0x6482('0x3')]},'ringtime':{'type':Sequelize[_0x6482('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6482('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6482('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6482('0x2')]},'campaign':{'type':Sequelize[_0x6482('0x2')]},'campaigntype':{'type':Sequelize[_0x6482('0x2')]},'membername':{'type':Sequelize[_0x6482('0x2')]},'reason':{'type':Sequelize[_0x6482('0x2')]},'disposition':{'type':Sequelize[_0x6482('0x2')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x236573){var _0x3af7e4=this[_0x6482('0x5')](_0x6482('0x6'));if(_0x3af7e4&&_0x236573){this['setDataValue']('followuptime',moment(_0x236573)[_0x6482('0x7')](moment(_0x3af7e4),'seconds'));}return this[_0x6482('0x8')](_0x6482('0x9'),_0x236573);}},'amd':{'type':Sequelize[_0x6482('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6482('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6482('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6482('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6482('0x3')]},'deleted':{'type':Sequelize[_0x6482('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6482('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x6482('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6482('0x4')],'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 +var _0x9103=['DATE','endtime','followuptime','setDataValue','dispositionat','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x9103,0x178));var _0x3910=function(_0x3a2118,_0x31fc3c){_0x3a2118=_0x3a2118-0x0;var _0x1d181d=_0x9103[_0x3a2118];return _0x1d181d;};'use strict';var Sequelize=require(_0x3910('0x0'));var moment=require('moment');module[_0x3910('0x1')]={'state':{'type':Sequelize[_0x3910('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x3910('0x3')]},'scheduledat':{'type':Sequelize[_0x3910('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3910('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3910('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x3910('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x3910('0x3')]},'originatecalleridname':{'type':Sequelize[_0x3910('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3910('0x3')]},'starttime':{'type':Sequelize[_0x3910('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x3910('0x4')]},'droptime':{'type':Sequelize[_0x3910('0x4')]},'endtime':{'type':Sequelize[_0x3910('0x4')]},'ringtime':{'type':Sequelize[_0x3910('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3910('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3910('0x3')]},'campaign':{'type':Sequelize[_0x3910('0x3')]},'campaigntype':{'type':Sequelize[_0x3910('0x3')]},'membername':{'type':Sequelize[_0x3910('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x3910('0x4')],'set':function(_0x2e4112){var _0x467ce6=this['getDataValue'](_0x3910('0x5'));if(_0x467ce6&&_0x2e4112){this['setDataValue'](_0x3910('0x6'),moment(_0x2e4112)['diff'](moment(_0x467ce6),'seconds'));}return this[_0x3910('0x7')](_0x3910('0x8'),_0x2e4112);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x3910('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x3910('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x3910('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x3910('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3910('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3910('0x4')]},'deleted':{'type':Sequelize[_0x3910('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x3910('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x3910('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x3910('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3910('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3910('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 97ce56c..a92668a 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 _0x1dd8=['field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','state\x20=\x20?','group','checkContactHopper','findOne','html-pdf','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','limit','Content-Range','json','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','rows','catch','params','include','find','describe','body','uniqueid','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','noSuchContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','scheduledAt','ContactId','ListId','createdAt','updatedAt','select'];(function(_0x58bbcb,_0x27458a){var _0x4eea53=function(_0x51e130){while(--_0x51e130){_0x58bbcb['push'](_0x58bbcb['shift']());}};_0x4eea53(++_0x27458a);}(_0x1dd8,0x114));var _0x81dd=function(_0x30eb5b,_0x234476){_0x30eb5b=_0x30eb5b-0x0;var _0x559d73=_0x1dd8[_0x30eb5b];return _0x559d73;};'use strict';var pdf=require(_0x81dd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x81dd('0x1'));var zipdir=require(_0x81dd('0x2'));var jsonpatch=require(_0x81dd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x81dd('0x4'));var util=require(_0x81dd('0x5'));var path=require('path');var sox=require(_0x81dd('0x6'));var csv=require(_0x81dd('0x7'));var ejs=require(_0x81dd('0x8'));var fs=require('fs');var _=require(_0x81dd('0x9'));var squel=require(_0x81dd('0xa'));var crypto=require(_0x81dd('0xb'));var jsforce=require(_0x81dd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x81dd('0x7'));var querystring=require(_0x81dd('0xd'));var Papa=require(_0x81dd('0xe'));var Redis=require('ioredis');var authService=require(_0x81dd('0xf'));var qs=require(_0x81dd('0x10'));var as=require(_0x81dd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x81dd('0x12'));var utils=require(_0x81dd('0x13'));var config=require(_0x81dd('0x14'));var db=require(_0x81dd('0x15'))['db'];function respondWithStatusCode(_0x4863e8,_0x3ea282){_0x3ea282=_0x3ea282||0xcc;return function(_0x39442c){if(_0x39442c){return _0x4863e8['sendStatus'](_0x3ea282);}return _0x4863e8[_0x81dd('0x16')](_0x3ea282)['end']();};}function respondWithResult(_0x486e7d,_0x29cb1e){_0x29cb1e=_0x29cb1e||0xc8;return function(_0x5dc569){if(_0x5dc569){return _0x486e7d['status'](_0x29cb1e)['json'](_0x5dc569);}};}function respondWithFilteredResult(_0x10820f,_0x483c07){return function(_0x261b4c){if(_0x261b4c){var _0x2863b8=_0x261b4c['count'],_0x5a0657=_0x483c07[_0x81dd('0x17')],_0x4feec1=_0x483c07[_0x81dd('0x17')]+_0x483c07[_0x81dd('0x18')],_0x1c6102;if(_0x4feec1>=_0x2863b8){_0x4feec1=_0x2863b8;_0x1c6102=0xc8;}else{_0x1c6102=0xce;}_0x10820f['status'](_0x1c6102);return _0x10820f['set'](_0x81dd('0x19'),_0x5a0657+'-'+_0x4feec1+'/'+_0x2863b8)[_0x81dd('0x1a')](_0x261b4c);}return null;};}function patchUpdates(_0xe6b3ce){return function(_0x4dc411){try{jsonpatch['apply'](_0x4dc411,_0xe6b3ce,!![]);}catch(_0x3ea034){return BPromise['reject'](_0x3ea034);}return _0x4dc411[_0x81dd('0x1b')]();};}function saveUpdates(_0x291dcb,_0x20f640){return function(_0x20688a){if(_0x20688a){return _0x20688a[_0x81dd('0x1c')](_0x291dcb)[_0x81dd('0x1d')](function(_0x1e4b5a){return _0x1e4b5a;});}return null;};}function removeEntity(_0x4e723c,_0xf0baaf){return function(_0x358ccf){if(_0x358ccf){return _0x358ccf[_0x81dd('0x1e')]()[_0x81dd('0x1d')](function(){_0x4e723c[_0x81dd('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x355084,_0x636c2d){return function(_0x33412f){if(!_0x33412f){_0x355084[_0x81dd('0x1f')](0x194);}return _0x33412f;};}function handleError(_0x566381,_0x504a33){_0x504a33=_0x504a33||0x1f4;return function(_0x5e71c7){logger[_0x81dd('0x20')](_0x5e71c7[_0x81dd('0x21')]);if(_0x5e71c7['name']){delete _0x5e71c7[_0x81dd('0x22')];}_0x566381[_0x81dd('0x16')](_0x504a33)[_0x81dd('0x23')](_0x5e71c7);};}exports[_0x81dd('0x24')]=function(_0xf0920,_0x3a36ae){var _0x257dba={},_0x23fc92={},_0x83121b={'count':0x0,'rows':[]};var _0x43ed76=_[_0x81dd('0x25')](db[_0x81dd('0x26')][_0x81dd('0x27')],function(_0x1f4f0f){return{'name':_0x1f4f0f[_0x81dd('0x28')],'type':_0x1f4f0f[_0x81dd('0x29')]['key']};});_0x23fc92['model']=_['map'](_0x43ed76,_0x81dd('0x22'));_0x23fc92[_0x81dd('0x2a')]=_[_0x81dd('0x2b')](_0xf0920['query']);_0x23fc92['filters']=_[_0x81dd('0x2c')](_0x23fc92[_0x81dd('0x2d')],_0x23fc92['query']);_0x257dba[_0x81dd('0x2e')]=_[_0x81dd('0x2c')](_0x23fc92['model'],qs['fields'](_0xf0920[_0x81dd('0x2a')][_0x81dd('0x2f')]));_0x257dba[_0x81dd('0x2e')]=_0x257dba[_0x81dd('0x2e')][_0x81dd('0x30')]?_0x257dba['attributes']:_0x23fc92[_0x81dd('0x2d')];if(!_0xf0920['query'][_0x81dd('0x31')](_0x81dd('0x32'))){_0x257dba['limit']=qs[_0x81dd('0x18')](_0xf0920['query'][_0x81dd('0x18')]);_0x257dba[_0x81dd('0x17')]=qs[_0x81dd('0x17')](_0xf0920['query']['offset']);}_0x257dba[_0x81dd('0x33')]=qs[_0x81dd('0x34')](_0xf0920['query'][_0x81dd('0x34')]);_0x257dba[_0x81dd('0x35')]=qs['filters'](_['pick'](_0xf0920[_0x81dd('0x2a')],_0x23fc92['filters']));if(_0xf0920[_0x81dd('0x2a')][_0x81dd('0x36')]){_0x257dba[_0x81dd('0x35')]=_[_0x81dd('0x37')](_0x257dba[_0x81dd('0x35')],{'$or':_[_0x81dd('0x25')](_0x43ed76,function(_0x1d2e23){if(_0x1d2e23[_0x81dd('0x29')]!=='VIRTUAL'){var _0x427661={};_0x427661[_0x1d2e23[_0x81dd('0x22')]]={'$like':'%'+_0xf0920[_0x81dd('0x2a')]['filter']+'%'};return _0x427661;}})});}_0x257dba=_[_0x81dd('0x37')]({},_0x257dba,_0xf0920[_0x81dd('0x38')]);var _0x52b9fb={'where':_0x257dba[_0x81dd('0x35')]};return db[_0x81dd('0x26')][_0x81dd('0x39')](_0x52b9fb)[_0x81dd('0x1d')](function(_0x1cb32c){_0x83121b[_0x81dd('0x39')]=_0x1cb32c;if(_0xf0920[_0x81dd('0x2a')][_0x81dd('0x3a')]){_0x257dba['include']=[{'all':!![]}];}return db[_0x81dd('0x26')]['findAll'](_0x257dba);})[_0x81dd('0x1d')](function(_0x5b3a5c){_0x83121b[_0x81dd('0x3b')]=_0x5b3a5c;return _0x83121b;})[_0x81dd('0x1d')](respondWithFilteredResult(_0x3a36ae,_0x257dba))[_0x81dd('0x3c')](handleError(_0x3a36ae,null));};exports['show']=function(_0x3ab811,_0x59949a){var _0x53e40c={'raw':!![],'where':{'id':_0x3ab811[_0x81dd('0x3d')]['id']}},_0x11cc2c={};_0x11cc2c[_0x81dd('0x2d')]=_[_0x81dd('0x2b')](db[_0x81dd('0x26')][_0x81dd('0x27')]);_0x11cc2c[_0x81dd('0x2a')]=_[_0x81dd('0x2b')](_0x3ab811[_0x81dd('0x2a')]);_0x11cc2c['filters']=_[_0x81dd('0x2c')](_0x11cc2c[_0x81dd('0x2d')],_0x11cc2c[_0x81dd('0x2a')]);_0x53e40c[_0x81dd('0x2e')]=_['intersection'](_0x11cc2c[_0x81dd('0x2d')],qs[_0x81dd('0x2f')](_0x3ab811['query'][_0x81dd('0x2f')]));_0x53e40c[_0x81dd('0x2e')]=_0x53e40c[_0x81dd('0x2e')][_0x81dd('0x30')]?_0x53e40c[_0x81dd('0x2e')]:_0x11cc2c[_0x81dd('0x2d')];if(_0x3ab811[_0x81dd('0x2a')][_0x81dd('0x3a')]){_0x53e40c[_0x81dd('0x3e')]=[{'all':!![]}];}_0x53e40c=_[_0x81dd('0x37')]({},_0x53e40c,_0x3ab811['options']);return db[_0x81dd('0x26')][_0x81dd('0x3f')](_0x53e40c)[_0x81dd('0x1d')](handleEntityNotFound(_0x59949a,null))['then'](respondWithResult(_0x59949a,null))[_0x81dd('0x3c')](handleError(_0x59949a,null));};exports['describe']=function(_0x3f9f70,_0x312ee5){return db['CmHopperFinal'][_0x81dd('0x40')]()['then'](respondWithResult(_0x312ee5,null))['catch'](handleError(_0x312ee5,null));};exports[_0x81dd('0x1c')]=function(_0x1f566e,_0x25140a){if(_0x1f566e[_0x81dd('0x41')][_0x81dd('0x42')]){delete _0x1f566e[_0x81dd('0x41')][_0x81dd('0x42')];}return db[_0x81dd('0x26')][_0x81dd('0x3f')]({'where':{'uniqueid':_0x1f566e[_0x81dd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x25140a,null))[_0x81dd('0x1d')](saveUpdates(_0x1f566e[_0x81dd('0x41')],null))[_0x81dd('0x1d')](respondWithResult(_0x25140a,null))[_0x81dd('0x3c')](handleError(_0x25140a,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x17b2f0,_0x2d11bd,_0x245f2c){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x17b2f0[_0x81dd('0x3d')]['id']},'attributes':[[db['sequelize']['fn'](_0x81dd('0x43'),db[_0x81dd('0x44')]['fn']('IF',db[_0x81dd('0x44')][_0x81dd('0x45')](_0x81dd('0x46')))),'noSuchContacts'],[db[_0x81dd('0x44')]['fn'](_0x81dd('0x43'),db[_0x81dd('0x44')]['fn']('IF',db[_0x81dd('0x44')]['literal'](_0x81dd('0x47')))),_0x81dd('0x48')],[db[_0x81dd('0x44')]['fn'](_0x81dd('0x43'),db[_0x81dd('0x44')]['fn']('IF',db['sequelize'][_0x81dd('0x45')](_0x81dd('0x49')))),_0x81dd('0x4a')],[db[_0x81dd('0x44')]['fn'](_0x81dd('0x43'),db[_0x81dd('0x44')]['fn']('IF',db[_0x81dd('0x44')][_0x81dd('0x45')]('`state`\x20=\x208,\x201,\x20null'))),_0x81dd('0x4b')],[db[_0x81dd('0x44')]['fn'](_0x81dd('0x43'),db[_0x81dd('0x44')]['fn']('IF',db['sequelize'][_0x81dd('0x45')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db['sequelize']['fn'](_0x81dd('0x43'),db[_0x81dd('0x44')]['fn']('IF',db[_0x81dd('0x44')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x81dd('0x44')][_0x81dd('0x45')]('`state`\x20=\x2022,\x201,\x20null'))),_0x81dd('0x4c')],[db[_0x81dd('0x44')]['fn'](_0x81dd('0x43'),db[_0x81dd('0x44')]['fn']('IF',db[_0x81dd('0x44')][_0x81dd('0x45')](_0x81dd('0x4d')))),_0x81dd('0x4e')]]})['then'](handleEntityNotFound(_0x2d11bd,null))[_0x81dd('0x1d')](respondWithResult(_0x2d11bd,null))[_0x81dd('0x3c')](handleError(_0x2d11bd,null));};exports[_0x81dd('0x4f')]=function(_0x1b738f,_0x2a218b,_0x3c1efc){return db[_0x81dd('0x26')][_0x81dd('0x50')]({'raw':![],'where':{'CampaignId':_0x1b738f[_0x81dd('0x3d')]['id']},'attributes':[[db[_0x81dd('0x44')]['fn']('COUNT',db[_0x81dd('0x44')]['fn']('IF',db[_0x81dd('0x44')][_0x81dd('0x45')]('`state`\x20=\x200,\x201,\x20null'))),_0x81dd('0x51')],[db[_0x81dd('0x44')]['fn']('COUNT',db[_0x81dd('0x44')]['fn']('IF',db[_0x81dd('0x44')][_0x81dd('0x45')](_0x81dd('0x47')))),_0x81dd('0x48')],[db['sequelize']['fn'](_0x81dd('0x43'),db[_0x81dd('0x44')]['fn']('IF',db[_0x81dd('0x44')][_0x81dd('0x45')](_0x81dd('0x49')))),_0x81dd('0x4a')],[db[_0x81dd('0x44')]['fn']('COUNT',db[_0x81dd('0x44')]['fn']('IF',db[_0x81dd('0x44')][_0x81dd('0x45')]('`state`\x20=\x208,\x201,\x20null'))),_0x81dd('0x4b')],[db[_0x81dd('0x44')]['fn'](_0x81dd('0x43'),db['sequelize']['fn']('IF',db[_0x81dd('0x44')][_0x81dd('0x45')](_0x81dd('0x52')))),_0x81dd('0x53')],[db['sequelize']['fn'](_0x81dd('0x43'),db[_0x81dd('0x44')]['fn']('IF',db[_0x81dd('0x44')][_0x81dd('0x45')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x81dd('0x54')],[db[_0x81dd('0x44')]['fn']('COUNT',db[_0x81dd('0x44')]['fn']('IF',db['sequelize'][_0x81dd('0x45')](_0x81dd('0x55')))),_0x81dd('0x4c')],[db[_0x81dd('0x44')]['fn'](_0x81dd('0x43'),db[_0x81dd('0x44')]['fn']('IF',db[_0x81dd('0x44')]['literal'](_0x81dd('0x4d')))),_0x81dd('0x4e')]]})[_0x81dd('0x1d')](handleEntityNotFound(_0x2a218b,null))[_0x81dd('0x1d')](respondWithResult(_0x2a218b,null))['catch'](handleError(_0x2a218b,null));};exports[_0x81dd('0x56')]=function(_0x385bee,_0x5a5bdf,_0x1d967a){return db[_0x81dd('0x57')][_0x81dd('0x3f')]({'where':{'id':_0x385bee[_0x81dd('0x3d')]['id']}})[_0x81dd('0x1d')](handleEntityNotFound(_0x5a5bdf,null))[_0x81dd('0x1d')](function(_0x30131a){var _0x183484;if(_0x30131a){_0x183484=squel[_0x81dd('0x58')]()[_0x81dd('0x59')]('cm_hopper')['fromQuery'](['phone',_0x81dd('0x5a'),_0x81dd('0x5b'),_0x81dd('0x5c'),'VoiceQueueId',_0x81dd('0x5d'),_0x81dd('0x5e')],squel[_0x81dd('0x5f')]()[_0x81dd('0x60')](_0x81dd('0x61'),_0x81dd('0x62'))[_0x81dd('0x60')](_0x81dd('0x63'),'scheduledAt')[_0x81dd('0x60')](_0x81dd('0x64'),_0x81dd('0x5b'))['field'](_0x81dd('0x65'),_0x81dd('0x5c'))[_0x81dd('0x60')](_0x81dd('0x66'),_0x81dd('0x67'))[_0x81dd('0x60')](_0x81dd('0x63'),'createdAt')[_0x81dd('0x60')](_0x81dd('0x63'),_0x81dd('0x5e'))[_0x81dd('0x68')](_0x81dd('0x69'))[_0x81dd('0x35')]('VoiceQueueId\x20=\x20?',_0x385bee[_0x81dd('0x3d')]['id'][_0x81dd('0x6a')]())['where']('state\x20=\x20?',_0x385bee[_0x81dd('0x41')][_0x81dd('0x6b')][_0x81dd('0x6a')]())[_0x81dd('0x35')](_0x81dd('0x6c'))[_0x81dd('0x35')](_0x81dd('0x6d'),squel['select']()[_0x81dd('0x60')](_0x81dd('0x62'))[_0x81dd('0x68')](_0x81dd('0x6e'))[_0x81dd('0x35')](_0x81dd('0x6f'),_0x385bee['params']['id']['toString']()))['where'](_0x81dd('0x6d'),squel[_0x81dd('0x5f')]()[_0x81dd('0x60')](_0x81dd('0x70'))[_0x81dd('0x68')](_0x81dd('0x69'))[_0x81dd('0x35')](_0x81dd('0x6f'),_0x385bee[_0x81dd('0x3d')]['id'][_0x81dd('0x6a')]())[_0x81dd('0x35')](_0x81dd('0x71')))['group'](_0x81dd('0x5b')))[_0x81dd('0x6a')]();return db[_0x81dd('0x44')][_0x81dd('0x2a')](_0x183484);}return[];})[_0x81dd('0x1d')](respondWithResult(_0x5a5bdf,null))[_0x81dd('0x3c')](handleError(_0x5a5bdf,null));};exports[_0x81dd('0x72')]=function(_0x1bdd03,_0x547a28,_0x41f427){return db[_0x81dd('0x73')][_0x81dd('0x3f')]({'where':{'id':_0x1bdd03['params']['id']}})[_0x81dd('0x1d')](handleEntityNotFound(_0x547a28,null))[_0x81dd('0x1d')](function(_0x516af6){var _0x38e8c3;if(_0x516af6){_0x38e8c3=squel[_0x81dd('0x58')]()['into'](_0x81dd('0x6e'))[_0x81dd('0x74')]([_0x81dd('0x62'),_0x81dd('0x5a'),'ContactId','ListId','CampaignId',_0x81dd('0x5d'),'updatedAt'],squel[_0x81dd('0x5f')]()['field']('ANY_VALUE(calleridnum)','phone')[_0x81dd('0x60')](_0x81dd('0x63'),_0x81dd('0x5a'))[_0x81dd('0x60')](_0x81dd('0x64'),'ContactId')[_0x81dd('0x60')]('ANY_VALUE(ListId)',_0x81dd('0x5c'))[_0x81dd('0x60')](_0x81dd('0x75'),_0x81dd('0x76'))[_0x81dd('0x60')](_0x81dd('0x63'),_0x81dd('0x5d'))['field'](_0x81dd('0x63'),_0x81dd('0x5e'))[_0x81dd('0x68')](_0x81dd('0x69'))[_0x81dd('0x35')](_0x81dd('0x77'),_0x1bdd03[_0x81dd('0x3d')]['id'][_0x81dd('0x6a')]())[_0x81dd('0x35')](_0x81dd('0x78'),_0x1bdd03[_0x81dd('0x41')][_0x81dd('0x6b')]['toString']())[_0x81dd('0x35')](_0x81dd('0x6c'))[_0x81dd('0x35')](_0x81dd('0x6d'),squel[_0x81dd('0x5f')]()[_0x81dd('0x60')](_0x81dd('0x62'))[_0x81dd('0x68')](_0x81dd('0x6e'))[_0x81dd('0x35')](_0x81dd('0x77'),_0x1bdd03[_0x81dd('0x3d')]['id'][_0x81dd('0x6a')]()))[_0x81dd('0x35')](_0x81dd('0x6d'),squel[_0x81dd('0x5f')]()[_0x81dd('0x60')](_0x81dd('0x70'))[_0x81dd('0x68')](_0x81dd('0x69'))[_0x81dd('0x35')](_0x81dd('0x77'),_0x1bdd03[_0x81dd('0x3d')]['id'][_0x81dd('0x6a')]())['where']('state\x20=\x204'))[_0x81dd('0x79')](_0x81dd('0x5b')))[_0x81dd('0x6a')]();return db[_0x81dd('0x44')][_0x81dd('0x2a')](_0x38e8c3);}return[];})['then'](respondWithResult(_0x547a28,null))[_0x81dd('0x3c')](handleError(_0x547a28,null));};exports[_0x81dd('0x7a')]=function(_0x4a762b,_0x79d7dc,_0x313ae0){return db['CmHopper'][_0x81dd('0x7b')]({'where':{'VoiceQueueId':_0x4a762b[_0x81dd('0x41')][_0x81dd('0x67')],'CampaignId':_0x4a762b[_0x81dd('0x41')][_0x81dd('0x76')],'ContactId':_0x4a762b[_0x81dd('0x41')][_0x81dd('0x5b')]}})['then'](handleEntityNotFound(_0x79d7dc,null))[_0x81dd('0x1d')](function(_0x58b434){if(_0x58b434){return _0x58b434;}return null;})[_0x81dd('0x1d')](respondWithResult(_0x79d7dc,null))[_0x81dd('0x3c')](handleError(_0x79d7dc,null));}; \ No newline at end of file +var _0x4ac1=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','reject','save','update','then','end','name','index','CmHopperFinal','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','map','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','phone','scheduledAt','ContactId','VoiceQueueId','select','field','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','createdAt','NOW()','updatedAt','from','cm_hopper_final','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','cm_hopper','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','VoiceQueueId\x20=\x20?','state\x20=\x204','group','fromQuery','CampaignId','ANY_VALUE(calleridnum)','CampaignId\x20=\x20?','state','CmHopper','findOne','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1d168c,_0x5d3407){var _0x4d489b=function(_0xf0c86a){while(--_0xf0c86a){_0x1d168c['push'](_0x1d168c['shift']());}};_0x4d489b(++_0x5d3407);}(_0x4ac1,0x1ea));var _0x14ac=function(_0xb21042,_0x5c5366){_0xb21042=_0xb21042-0x0;var _0x2d7e97=_0x4ac1[_0xb21042];return _0x2d7e97;};'use strict';var pdf=require(_0x14ac('0x0'));var emlformat=require(_0x14ac('0x1'));var rimraf=require(_0x14ac('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x14ac('0x3'));var rp=require(_0x14ac('0x4'));var moment=require('moment');var BPromise=require(_0x14ac('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x14ac('0x6'));var sox=require(_0x14ac('0x7'));var csv=require('to-csv');var ejs=require(_0x14ac('0x8'));var fs=require('fs');var _=require(_0x14ac('0x9'));var squel=require('squel');var crypto=require(_0x14ac('0xa'));var jsforce=require(_0x14ac('0xb'));var deskjs=require(_0x14ac('0xc'));var toCsv=require(_0x14ac('0xd'));var querystring=require(_0x14ac('0xe'));var Papa=require(_0x14ac('0xf'));var Redis=require(_0x14ac('0x10'));var authService=require(_0x14ac('0x11'));var qs=require(_0x14ac('0x12'));var as=require(_0x14ac('0x13'));var hardwareService=require(_0x14ac('0x14'));var logger=require(_0x14ac('0x15'))(_0x14ac('0x16'));var utils=require(_0x14ac('0x17'));var config=require('../../config/environment');var db=require(_0x14ac('0x18'))['db'];function respondWithStatusCode(_0x4e114f,_0x2de15b){_0x2de15b=_0x2de15b||0xcc;return function(_0x3a4007){if(_0x3a4007){return _0x4e114f[_0x14ac('0x19')](_0x2de15b);}return _0x4e114f[_0x14ac('0x1a')](_0x2de15b)['end']();};}function respondWithResult(_0x57ff0f,_0x149df7){_0x149df7=_0x149df7||0xc8;return function(_0x4c21dc){if(_0x4c21dc){return _0x57ff0f[_0x14ac('0x1a')](_0x149df7)[_0x14ac('0x1b')](_0x4c21dc);}};}function respondWithFilteredResult(_0x4d514e,_0x32e08d){return function(_0x31ef83){if(_0x31ef83){var _0x18c775=_0x31ef83[_0x14ac('0x1c')],_0x591091=_0x32e08d[_0x14ac('0x1d')],_0x5f4686=_0x32e08d[_0x14ac('0x1d')]+_0x32e08d[_0x14ac('0x1e')],_0x33e0e0;if(_0x5f4686>=_0x18c775){_0x5f4686=_0x18c775;_0x33e0e0=0xc8;}else{_0x33e0e0=0xce;}_0x4d514e[_0x14ac('0x1a')](_0x33e0e0);return _0x4d514e['set']('Content-Range',_0x591091+'-'+_0x5f4686+'/'+_0x18c775)[_0x14ac('0x1b')](_0x31ef83);}return null;};}function patchUpdates(_0x1217f4){return function(_0x2085a7){try{jsonpatch[_0x14ac('0x1f')](_0x2085a7,_0x1217f4,!![]);}catch(_0x41cff7){return BPromise[_0x14ac('0x20')](_0x41cff7);}return _0x2085a7[_0x14ac('0x21')]();};}function saveUpdates(_0x4c8f78,_0xa7539){return function(_0x294848){if(_0x294848){return _0x294848[_0x14ac('0x22')](_0x4c8f78)[_0x14ac('0x23')](function(_0x1d4c62){return _0x1d4c62;});}return null;};}function removeEntity(_0x215b95,_0x3e2dda){return function(_0x4ff410){if(_0x4ff410){return _0x4ff410['destroy']()[_0x14ac('0x23')](function(){_0x215b95[_0x14ac('0x1a')](0xcc)[_0x14ac('0x24')]();});}};}function handleEntityNotFound(_0x5a69bb,_0x2cef92){return function(_0x1aa1cb){if(!_0x1aa1cb){_0x5a69bb[_0x14ac('0x19')](0x194);}return _0x1aa1cb;};}function handleError(_0x5267ff,_0x45b6d2){_0x45b6d2=_0x45b6d2||0x1f4;return function(_0x6043f5){logger['error'](_0x6043f5['stack']);if(_0x6043f5[_0x14ac('0x25')]){delete _0x6043f5[_0x14ac('0x25')];}_0x5267ff[_0x14ac('0x1a')](_0x45b6d2)['send'](_0x6043f5);};}exports[_0x14ac('0x26')]=function(_0x5f4406,_0x4f9447){var _0x145853={},_0x37dce8={},_0x1ebe6f={'count':0x0,'rows':[]};var _0x5efe76=_['map'](db[_0x14ac('0x27')]['rawAttributes'],function(_0x8e8a36){return{'name':_0x8e8a36[_0x14ac('0x28')],'type':_0x8e8a36[_0x14ac('0x29')][_0x14ac('0x2a')]};});_0x37dce8['model']=_['map'](_0x5efe76,_0x14ac('0x25'));_0x37dce8[_0x14ac('0x2b')]=_[_0x14ac('0x2c')](_0x5f4406[_0x14ac('0x2b')]);_0x37dce8['filters']=_[_0x14ac('0x2d')](_0x37dce8[_0x14ac('0x2e')],_0x37dce8[_0x14ac('0x2b')]);_0x145853[_0x14ac('0x2f')]=_[_0x14ac('0x2d')](_0x37dce8[_0x14ac('0x2e')],qs[_0x14ac('0x30')](_0x5f4406[_0x14ac('0x2b')][_0x14ac('0x30')]));_0x145853[_0x14ac('0x2f')]=_0x145853[_0x14ac('0x2f')][_0x14ac('0x31')]?_0x145853[_0x14ac('0x2f')]:_0x37dce8['model'];if(!_0x5f4406[_0x14ac('0x2b')]['hasOwnProperty'](_0x14ac('0x32'))){_0x145853[_0x14ac('0x1e')]=qs[_0x14ac('0x1e')](_0x5f4406['query'][_0x14ac('0x1e')]);_0x145853[_0x14ac('0x1d')]=qs['offset'](_0x5f4406[_0x14ac('0x2b')][_0x14ac('0x1d')]);}_0x145853[_0x14ac('0x33')]=qs[_0x14ac('0x34')](_0x5f4406[_0x14ac('0x2b')][_0x14ac('0x34')]);_0x145853[_0x14ac('0x35')]=qs[_0x14ac('0x36')](_[_0x14ac('0x37')](_0x5f4406[_0x14ac('0x2b')],_0x37dce8[_0x14ac('0x36')]));if(_0x5f4406[_0x14ac('0x2b')][_0x14ac('0x38')]){_0x145853['where']=_[_0x14ac('0x39')](_0x145853[_0x14ac('0x35')],{'$or':_[_0x14ac('0x3a')](_0x5efe76,function(_0x2360c1){if(_0x2360c1[_0x14ac('0x29')]!=='VIRTUAL'){var _0x4ec7a5={};_0x4ec7a5[_0x2360c1[_0x14ac('0x25')]]={'$like':'%'+_0x5f4406[_0x14ac('0x2b')][_0x14ac('0x38')]+'%'};return _0x4ec7a5;}})});}_0x145853=_[_0x14ac('0x39')]({},_0x145853,_0x5f4406['options']);var _0x5e2f18={'where':_0x145853[_0x14ac('0x35')]};return db[_0x14ac('0x27')]['count'](_0x5e2f18)[_0x14ac('0x23')](function(_0x58e6c3){_0x1ebe6f[_0x14ac('0x1c')]=_0x58e6c3;if(_0x5f4406[_0x14ac('0x2b')][_0x14ac('0x3b')]){_0x145853[_0x14ac('0x3c')]=[{'all':!![]}];}return db[_0x14ac('0x27')][_0x14ac('0x3d')](_0x145853);})[_0x14ac('0x23')](function(_0x5636c6){_0x1ebe6f[_0x14ac('0x3e')]=_0x5636c6;return _0x1ebe6f;})[_0x14ac('0x23')](respondWithFilteredResult(_0x4f9447,_0x145853))[_0x14ac('0x3f')](handleError(_0x4f9447,null));};exports[_0x14ac('0x40')]=function(_0x9ed5e,_0x1d625f){var _0x5bd4af={'raw':!![],'where':{'id':_0x9ed5e[_0x14ac('0x41')]['id']}},_0xa58ce5={};_0xa58ce5[_0x14ac('0x2e')]=_[_0x14ac('0x2c')](db[_0x14ac('0x27')][_0x14ac('0x42')]);_0xa58ce5[_0x14ac('0x2b')]=_[_0x14ac('0x2c')](_0x9ed5e[_0x14ac('0x2b')]);_0xa58ce5[_0x14ac('0x36')]=_[_0x14ac('0x2d')](_0xa58ce5['model'],_0xa58ce5[_0x14ac('0x2b')]);_0x5bd4af[_0x14ac('0x2f')]=_['intersection'](_0xa58ce5[_0x14ac('0x2e')],qs[_0x14ac('0x30')](_0x9ed5e[_0x14ac('0x2b')]['fields']));_0x5bd4af[_0x14ac('0x2f')]=_0x5bd4af[_0x14ac('0x2f')]['length']?_0x5bd4af[_0x14ac('0x2f')]:_0xa58ce5['model'];if(_0x9ed5e[_0x14ac('0x2b')][_0x14ac('0x3b')]){_0x5bd4af[_0x14ac('0x3c')]=[{'all':!![]}];}_0x5bd4af=_[_0x14ac('0x39')]({},_0x5bd4af,_0x9ed5e[_0x14ac('0x43')]);return db['CmHopperFinal'][_0x14ac('0x44')](_0x5bd4af)[_0x14ac('0x23')](handleEntityNotFound(_0x1d625f,null))[_0x14ac('0x23')](respondWithResult(_0x1d625f,null))[_0x14ac('0x3f')](handleError(_0x1d625f,null));};exports['describe']=function(_0x3dafff,_0x14a9cb){return db[_0x14ac('0x27')][_0x14ac('0x45')]()[_0x14ac('0x23')](respondWithResult(_0x14a9cb,null))[_0x14ac('0x3f')](handleError(_0x14a9cb,null));};exports[_0x14ac('0x22')]=function(_0x14a457,_0x3d8ac7){if(_0x14a457[_0x14ac('0x46')][_0x14ac('0x47')]){delete _0x14a457[_0x14ac('0x46')]['uniqueid'];}return db[_0x14ac('0x27')][_0x14ac('0x44')]({'where':{'uniqueid':_0x14a457[_0x14ac('0x41')]['id']}})['then'](handleEntityNotFound(_0x3d8ac7,null))['then'](saveUpdates(_0x14a457[_0x14ac('0x46')],null))[_0x14ac('0x23')](respondWithResult(_0x3d8ac7,null))['catch'](handleError(_0x3d8ac7,null));};exports[_0x14ac('0x48')]=function(_0x418f2d,_0x4ab731,_0xd4c76d){return db['CmHopperFinal'][_0x14ac('0x3d')]({'raw':![],'where':{'VoiceQueueId':_0x418f2d[_0x14ac('0x41')]['id']},'attributes':[[db[_0x14ac('0x49')]['fn'](_0x14ac('0x4a'),db[_0x14ac('0x49')]['fn']('IF',db['sequelize'][_0x14ac('0x4b')](_0x14ac('0x4c')))),_0x14ac('0x4d')],[db[_0x14ac('0x49')]['fn'](_0x14ac('0x4a'),db[_0x14ac('0x49')]['fn']('IF',db[_0x14ac('0x49')][_0x14ac('0x4b')](_0x14ac('0x4e')))),_0x14ac('0x4f')],[db[_0x14ac('0x49')]['fn'](_0x14ac('0x4a'),db[_0x14ac('0x49')]['fn']('IF',db['sequelize'][_0x14ac('0x4b')](_0x14ac('0x50')))),_0x14ac('0x51')],[db['sequelize']['fn'](_0x14ac('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0x14ac('0x4b')](_0x14ac('0x52')))),_0x14ac('0x53')],[db[_0x14ac('0x49')]['fn'](_0x14ac('0x4a'),db[_0x14ac('0x49')]['fn']('IF',db['sequelize'][_0x14ac('0x4b')](_0x14ac('0x54')))),_0x14ac('0x55')],[db[_0x14ac('0x49')]['fn'](_0x14ac('0x4a'),db[_0x14ac('0x49')]['fn']('IF',db[_0x14ac('0x49')][_0x14ac('0x4b')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x14ac('0x56')],[db[_0x14ac('0x49')]['fn']('COUNT',db[_0x14ac('0x49')]['fn']('IF',db[_0x14ac('0x49')]['literal'](_0x14ac('0x57')))),'reCallContacts'],[db['sequelize']['fn'](_0x14ac('0x4a'),db['sequelize']['fn']('IF',db[_0x14ac('0x49')][_0x14ac('0x4b')]('`state`\x20=\x2019,\x201,\x20null'))),_0x14ac('0x58')]]})['then'](handleEntityNotFound(_0x4ab731,null))[_0x14ac('0x23')](respondWithResult(_0x4ab731,null))['catch'](handleError(_0x4ab731,null));};exports[_0x14ac('0x59')]=function(_0x5b82e3,_0x469729,_0x14971c){return db[_0x14ac('0x27')][_0x14ac('0x3d')]({'raw':![],'where':{'CampaignId':_0x5b82e3['params']['id']},'attributes':[[db[_0x14ac('0x49')]['fn']('COUNT',db[_0x14ac('0x49')]['fn']('IF',db[_0x14ac('0x49')][_0x14ac('0x4b')](_0x14ac('0x4c')))),_0x14ac('0x4d')],[db[_0x14ac('0x49')]['fn']('COUNT',db[_0x14ac('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x14ac('0x4f')],[db[_0x14ac('0x49')]['fn'](_0x14ac('0x4a'),db[_0x14ac('0x49')]['fn']('IF',db[_0x14ac('0x49')]['literal'](_0x14ac('0x50')))),_0x14ac('0x51')],[db['sequelize']['fn'](_0x14ac('0x4a'),db[_0x14ac('0x49')]['fn']('IF',db[_0x14ac('0x49')]['literal'](_0x14ac('0x52')))),_0x14ac('0x53')],[db['sequelize']['fn'](_0x14ac('0x4a'),db['sequelize']['fn']('IF',db[_0x14ac('0x49')][_0x14ac('0x4b')](_0x14ac('0x54')))),_0x14ac('0x55')],[db[_0x14ac('0x49')]['fn'](_0x14ac('0x4a'),db[_0x14ac('0x49')]['fn']('IF',db[_0x14ac('0x49')][_0x14ac('0x4b')](_0x14ac('0x5a')))),_0x14ac('0x56')],[db[_0x14ac('0x49')]['fn'](_0x14ac('0x4a'),db[_0x14ac('0x49')]['fn']('IF',db[_0x14ac('0x49')][_0x14ac('0x4b')](_0x14ac('0x57')))),'reCallContacts'],[db[_0x14ac('0x49')]['fn']('COUNT',db[_0x14ac('0x49')]['fn']('IF',db[_0x14ac('0x49')][_0x14ac('0x4b')](_0x14ac('0x5b')))),_0x14ac('0x58')]]})[_0x14ac('0x23')](handleEntityNotFound(_0x469729,null))[_0x14ac('0x23')](respondWithResult(_0x469729,null))['catch'](handleError(_0x469729,null));};exports[_0x14ac('0x5c')]=function(_0x4ee5d6,_0x5be710,_0xad0f8){return db[_0x14ac('0x5d')][_0x14ac('0x44')]({'where':{'id':_0x4ee5d6[_0x14ac('0x41')]['id']}})['then'](handleEntityNotFound(_0x5be710,null))[_0x14ac('0x23')](function(_0x434b86){var _0x13418f;if(_0x434b86){_0x13418f=squel[_0x14ac('0x5e')]()[_0x14ac('0x5f')]('cm_hopper')['fromQuery']([_0x14ac('0x60'),_0x14ac('0x61'),_0x14ac('0x62'),'ListId',_0x14ac('0x63'),'createdAt','updatedAt'],squel[_0x14ac('0x64')]()[_0x14ac('0x65')]('ANY_VALUE(calleridnum)',_0x14ac('0x60'))[_0x14ac('0x65')]('NOW()',_0x14ac('0x61'))[_0x14ac('0x65')](_0x14ac('0x66'),_0x14ac('0x62'))[_0x14ac('0x65')](_0x14ac('0x67'),_0x14ac('0x68'))[_0x14ac('0x65')](_0x14ac('0x69'),'VoiceQueueId')['field']('NOW()',_0x14ac('0x6a'))['field'](_0x14ac('0x6b'),_0x14ac('0x6c'))[_0x14ac('0x6d')](_0x14ac('0x6e'))[_0x14ac('0x35')]('VoiceQueueId\x20=\x20?',_0x4ee5d6['params']['id'][_0x14ac('0x6f')]())[_0x14ac('0x35')](_0x14ac('0x70'),_0x4ee5d6[_0x14ac('0x46')]['state'][_0x14ac('0x6f')]())['where'](_0x14ac('0x71'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x14ac('0x64')]()['field'](_0x14ac('0x60'))[_0x14ac('0x6d')](_0x14ac('0x72'))[_0x14ac('0x35')]('VoiceQueueId\x20=\x20?',_0x4ee5d6['params']['id'][_0x14ac('0x6f')]()))[_0x14ac('0x35')](_0x14ac('0x73'),squel['select']()[_0x14ac('0x65')](_0x14ac('0x74'))[_0x14ac('0x6d')](_0x14ac('0x6e'))['where'](_0x14ac('0x75'),_0x4ee5d6[_0x14ac('0x41')]['id'][_0x14ac('0x6f')]())[_0x14ac('0x35')](_0x14ac('0x76')))[_0x14ac('0x77')](_0x14ac('0x62')))[_0x14ac('0x6f')]();return db['sequelize'][_0x14ac('0x2b')](_0x13418f);}return[];})[_0x14ac('0x23')](respondWithResult(_0x5be710,null))[_0x14ac('0x3f')](handleError(_0x5be710,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x568194,_0x129a99,_0x29fa2f){return db['Campaign'][_0x14ac('0x44')]({'where':{'id':_0x568194[_0x14ac('0x41')]['id']}})[_0x14ac('0x23')](handleEntityNotFound(_0x129a99,null))[_0x14ac('0x23')](function(_0x364cb8){var _0x6696c0;if(_0x364cb8){_0x6696c0=squel[_0x14ac('0x5e')]()['into'](_0x14ac('0x72'))[_0x14ac('0x78')](['phone','scheduledAt','ContactId',_0x14ac('0x68'),_0x14ac('0x79'),_0x14ac('0x6a'),_0x14ac('0x6c')],squel[_0x14ac('0x64')]()[_0x14ac('0x65')](_0x14ac('0x7a'),'phone')[_0x14ac('0x65')](_0x14ac('0x6b'),_0x14ac('0x61'))[_0x14ac('0x65')]('ANY_VALUE(ContactId)','ContactId')[_0x14ac('0x65')](_0x14ac('0x67'),_0x14ac('0x68'))[_0x14ac('0x65')]('ANY_VALUE(CampaignId)',_0x14ac('0x79'))[_0x14ac('0x65')]('NOW()',_0x14ac('0x6a'))[_0x14ac('0x65')](_0x14ac('0x6b'),'updatedAt')[_0x14ac('0x6d')](_0x14ac('0x6e'))['where'](_0x14ac('0x7b'),_0x568194[_0x14ac('0x41')]['id']['toString']())[_0x14ac('0x35')](_0x14ac('0x70'),_0x568194[_0x14ac('0x46')][_0x14ac('0x7c')][_0x14ac('0x6f')]())['where'](_0x14ac('0x71'))[_0x14ac('0x35')](_0x14ac('0x73'),squel[_0x14ac('0x64')]()[_0x14ac('0x65')]('phone')[_0x14ac('0x6d')]('cm_hopper')['where'](_0x14ac('0x7b'),_0x568194['params']['id'][_0x14ac('0x6f')]()))[_0x14ac('0x35')](_0x14ac('0x73'),squel[_0x14ac('0x64')]()[_0x14ac('0x65')](_0x14ac('0x74'))['from']('cm_hopper_final')['where'](_0x14ac('0x7b'),_0x568194[_0x14ac('0x41')]['id'][_0x14ac('0x6f')]())[_0x14ac('0x35')](_0x14ac('0x76')))[_0x14ac('0x77')]('ContactId'))[_0x14ac('0x6f')]();return db[_0x14ac('0x49')][_0x14ac('0x2b')](_0x6696c0);}return[];})[_0x14ac('0x23')](respondWithResult(_0x129a99,null))[_0x14ac('0x3f')](handleError(_0x129a99,null));};exports['checkContactHopper']=function(_0x395b57,_0x4231b8,_0x5f157d){return db[_0x14ac('0x7d')][_0x14ac('0x7e')]({'where':{'VoiceQueueId':_0x395b57['body']['VoiceQueueId'],'CampaignId':_0x395b57['body'][_0x14ac('0x79')],'ContactId':_0x395b57[_0x14ac('0x46')][_0x14ac('0x62')]}})[_0x14ac('0x23')](handleEntityNotFound(_0x4231b8,null))[_0x14ac('0x23')](function(_0x5bb56d){if(_0x5bb56d){return _0x5bb56d;}return null;})['then'](respondWithResult(_0x4231b8,null))[_0x14ac('0x3f')](handleError(_0x4231b8,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index ad9ffc3..bcc8487 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 _0xc26c=['exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','api','bluebird','request-promise','rimraf','./cmHopperFinal.attributes'];(function(_0x4e2c06,_0x482ecd){var _0x4f771c=function(_0x51d464){while(--_0x51d464){_0x4e2c06['push'](_0x4e2c06['shift']());}};_0x4f771c(++_0x482ecd);}(_0xc26c,0x96));var _0xcc26=function(_0xb1f5b3,_0x45c505){_0xb1f5b3=_0xb1f5b3-0x0;var _0x1d1791=_0xc26c[_0xb1f5b3];return _0x1d1791;};'use strict';var _=require('lodash');var util=require(_0xcc26('0x0'));var logger=require('../../config/logger')(_0xcc26('0x1'));var moment=require('moment');var BPromise=require(_0xcc26('0x2'));var rp=require(_0xcc26('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcc26('0x4'));var config=require('../../config/environment');var attributes=require(_0xcc26('0x5'));module[_0xcc26('0x6')]=function(_0x165043,_0x11942f){return _0x165043[_0xcc26('0x7')](_0xcc26('0x8'),attributes,{'tableName':_0xcc26('0x9'),'paranoid':![],'indexes':[{'name':_0xcc26('0xa'),'fields':[_0xcc26('0xa')]},{'name':_0xcc26('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x57f8=['util','../../config/logger','api','moment','request-promise','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash'];(function(_0x2b34ef,_0x3a2858){var _0x147008=function(_0xd72872){while(--_0xd72872){_0x2b34ef['push'](_0x2b34ef['shift']());}};_0x147008(++_0x3a2858);}(_0x57f8,0x103));var _0x857f=function(_0x3f94f9,_0x42774b){_0x3f94f9=_0x3f94f9-0x0;var _0x46f84f=_0x57f8[_0x3f94f9];return _0x46f84f;};'use strict';var _=require(_0x857f('0x0'));var util=require(_0x857f('0x1'));var logger=require(_0x857f('0x2'))(_0x857f('0x3'));var moment=require(_0x857f('0x4'));var BPromise=require('bluebird');var rp=require(_0x857f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x857f('0x6'));var attributes=require(_0x857f('0x7'));module[_0x857f('0x8')]=function(_0x3bdb25,_0x4c7b7b){return _0x3bdb25[_0x857f('0x9')](_0x857f('0xa'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x857f('0xb')]},{'name':_0x857f('0xc'),'fields':[_0x857f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 9a178ba..db41052 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 _0x5d77=['create','body','options','raw','lodash','util','bluebird','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateCmHopperFinal','CmHopperFinal'];(function(_0xfb42e6,_0x5f5d4b){var _0x27265b=function(_0x163e81){while(--_0x163e81){_0xfb42e6['push'](_0xfb42e6['shift']());}};_0x27265b(++_0x5f5d4b);}(_0x5d77,0xee));var _0x75d7=function(_0x39b69b,_0x7e3b73){_0x39b69b=_0x39b69b-0x0;var _0x1c0ab7=_0x5d77[_0x39b69b];return _0x1c0ab7;};'use strict';var _=require(_0x75d7('0x0'));var util=require(_0x75d7('0x1'));var moment=require('moment');var BPromise=require(_0x75d7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x75d7('0x3'))(_0x75d7('0x4'));var config=require('../../config/environment');var jayson=require(_0x75d7('0x5'));var client=jayson[_0x75d7('0x6')][_0x75d7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4319dc,_0x200d53,_0x484cf4){return new BPromise(function(_0x50274c,_0x45d0cf){return client[_0x75d7('0x8')](_0x4319dc,_0x484cf4)[_0x75d7('0x9')](function(_0x599e96){logger[_0x75d7('0xa')](_0x75d7('0xb'),_0x200d53,_0x75d7('0xc'));logger[_0x75d7('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x200d53,_0x75d7('0xc'),JSON[_0x75d7('0xe')](_0x599e96));if(_0x599e96[_0x75d7('0xf')]){if(_0x599e96[_0x75d7('0xf')][_0x75d7('0x10')]===0x1f4){logger[_0x75d7('0xf')](_0x75d7('0xb'),_0x200d53,_0x599e96[_0x75d7('0xf')][_0x75d7('0x11')]);return _0x45d0cf(_0x599e96[_0x75d7('0xf')]['message']);}logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x200d53,_0x599e96[_0x75d7('0xf')][_0x75d7('0x11')]);return _0x50274c(_0x599e96[_0x75d7('0xf')][_0x75d7('0x11')]);}else{logger[_0x75d7('0xa')](_0x75d7('0xb'),_0x200d53,_0x75d7('0xc'));_0x50274c(_0x599e96[_0x75d7('0x12')][_0x75d7('0x11')]);}})[_0x75d7('0x13')](function(_0x592b2d){logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x200d53,_0x592b2d);_0x45d0cf(_0x592b2d);});});}exports[_0x75d7('0x14')]=function(_0x38a0b9){var _0x1e0ffa=this;return new Promise(function(_0x477bee,_0xbc5e3b){return db[_0x75d7('0x15')][_0x75d7('0x16')](_0x38a0b9[_0x75d7('0x17')],{'raw':_0x38a0b9['options']?_0x38a0b9[_0x75d7('0x18')][_0x75d7('0x19')]===undefined?!![]:![]:!![]})[_0x75d7('0x9')](function(_0x2e06df){logger['info']('CreateCmHopperFinal',_0x38a0b9);logger[_0x75d7('0xd')](_0x75d7('0x14'),_0x38a0b9,JSON[_0x75d7('0xe')](_0x2e06df));_0x477bee(_0x2e06df);})['catch'](function(_0x1bf52b){logger[_0x75d7('0xf')]('CreateCmHopperFinal',_0x1bf52b[_0x75d7('0x11')],_0x38a0b9);_0xbc5e3b(_0x1e0ffa['error'](0x1f4,_0x1bf52b[_0x75d7('0x11')]));});});}; \ No newline at end of file +var _0xee64=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateCmHopperFinal','create','body','options','raw','lodash'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0xee64,0xa7));var _0x4ee6=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xee64[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x4ee6('0x0'));var util=require('util');var moment=require(_0x4ee6('0x1'));var BPromise=require(_0x4ee6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ee6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4ee6('0x4'));var logger=require(_0x4ee6('0x5'))(_0x4ee6('0x6'));var config=require(_0x4ee6('0x7'));var jayson=require(_0x4ee6('0x8'));var client=jayson[_0x4ee6('0x9')][_0x4ee6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57dc32,_0x256781,_0x1c05fc){return new BPromise(function(_0x402436,_0x12fbfe){return client[_0x4ee6('0xb')](_0x57dc32,_0x1c05fc)[_0x4ee6('0xc')](function(_0x3cf697){logger[_0x4ee6('0xd')](_0x4ee6('0xe'),_0x256781,_0x4ee6('0xf'));logger[_0x4ee6('0x10')](_0x4ee6('0x11'),_0x256781,_0x4ee6('0xf'),JSON[_0x4ee6('0x12')](_0x3cf697));if(_0x3cf697['error']){if(_0x3cf697[_0x4ee6('0x13')][_0x4ee6('0x14')]===0x1f4){logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x256781,_0x3cf697['error'][_0x4ee6('0x15')]);return _0x12fbfe(_0x3cf697[_0x4ee6('0x13')][_0x4ee6('0x15')]);}logger[_0x4ee6('0x13')]('CmHopperFinal,\x20%s,\x20%s',_0x256781,_0x3cf697[_0x4ee6('0x13')][_0x4ee6('0x15')]);return _0x402436(_0x3cf697['error'][_0x4ee6('0x15')]);}else{logger[_0x4ee6('0xd')]('CmHopperFinal,\x20%s,\x20%s',_0x256781,_0x4ee6('0xf'));_0x402436(_0x3cf697[_0x4ee6('0x16')][_0x4ee6('0x15')]);}})['catch'](function(_0x3196c2){logger['error'](_0x4ee6('0xe'),_0x256781,_0x3196c2);_0x12fbfe(_0x3196c2);});});}exports[_0x4ee6('0x17')]=function(_0xac51f3){var _0x48ada4=this;return new Promise(function(_0x13320c,_0x58701d){return db['CmHopperFinal'][_0x4ee6('0x18')](_0xac51f3[_0x4ee6('0x19')],{'raw':_0xac51f3[_0x4ee6('0x1a')]?_0xac51f3['options'][_0x4ee6('0x1b')]===undefined?!![]:![]:!![]})[_0x4ee6('0xc')](function(_0x4c9595){logger[_0x4ee6('0xd')](_0x4ee6('0x17'),_0xac51f3);logger[_0x4ee6('0x10')](_0x4ee6('0x17'),_0xac51f3,JSON[_0x4ee6('0x12')](_0x4c9595));_0x13320c(_0x4c9595);})['catch'](function(_0x204191){logger[_0x4ee6('0x13')](_0x4ee6('0x17'),_0x204191['message'],_0xac51f3);_0x58701d(_0x48ada4[_0x4ee6('0x13')](0x1f4,_0x204191[_0x4ee6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 53e9aa7..457939f 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 _0xd971=['/describe','describe','get','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','util','path','Router','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index'];(function(_0x27cbdf,_0x21c44a){var _0x4b7a87=function(_0xe84f96){while(--_0xe84f96){_0x27cbdf['push'](_0x27cbdf['shift']());}};_0x4b7a87(++_0x21c44a);}(_0xd971,0x178));var _0x1d97=function(_0x32b894,_0x14c458){_0x32b894=_0x32b894-0x0;var _0x1f4d76=_0xd971[_0x32b894];return _0x1f4d76;};'use strict';var multer=require('multer');var util=require(_0x1d97('0x0'));var path=require(_0x1d97('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1d97('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x1d97('0x3'));var config=require(_0x1d97('0x4'));var controller=require(_0x1d97('0x5'));router['get']('/',auth[_0x1d97('0x6')](),controller[_0x1d97('0x7')]);router['get'](_0x1d97('0x8'),auth[_0x1d97('0x6')](),controller[_0x1d97('0x9')]);router[_0x1d97('0xa')](_0x1d97('0xb'),auth[_0x1d97('0x6')](),controller[_0x1d97('0xc')]);router[_0x1d97('0xa')](_0x1d97('0xd'),auth[_0x1d97('0x6')](),controller[_0x1d97('0xe')]);router['get'](_0x1d97('0xf'),auth[_0x1d97('0x6')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x1d97('0x10')]('/voice/queue/moveContacts/:id',auth[_0x1d97('0x6')](),controller[_0x1d97('0x11')]);router[_0x1d97('0x10')](_0x1d97('0x12'),auth[_0x1d97('0x6')](),controller[_0x1d97('0x13')]);router['post'](_0x1d97('0x14'),auth[_0x1d97('0x6')](),controller[_0x1d97('0x15')]);router[_0x1d97('0x16')](_0x1d97('0xb'),auth[_0x1d97('0x6')](),controller['update']);module[_0x1d97('0x17')]=router; \ No newline at end of file +var _0xce01=['update','multer','util','path','connect-timeout','Router','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put'];(function(_0x2f8804,_0x5cb555){var _0x50eb9e=function(_0x373ad4){while(--_0x373ad4){_0x2f8804['push'](_0x2f8804['shift']());}};_0x50eb9e(++_0x5cb555);}(_0xce01,0xf1));var _0x1ce0=function(_0x53cc69,_0x3d89e2){_0x53cc69=_0x53cc69-0x0;var _0x367151=_0xce01[_0x53cc69];return _0x367151;};'use strict';var multer=require(_0x1ce0('0x0'));var util=require(_0x1ce0('0x1'));var path=require(_0x1ce0('0x2'));var timeout=require(_0x1ce0('0x3'));var express=require('express');var router=express[_0x1ce0('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1ce0('0x5'));var controller=require('./cmHopperFinal.controller');router[_0x1ce0('0x6')]('/',auth[_0x1ce0('0x7')](),controller['index']);router[_0x1ce0('0x6')](_0x1ce0('0x8'),auth['isAuthenticated'](),controller[_0x1ce0('0x9')]);router[_0x1ce0('0x6')](_0x1ce0('0xa'),auth[_0x1ce0('0x7')](),controller['show']);router[_0x1ce0('0x6')](_0x1ce0('0xb'),auth[_0x1ce0('0x7')](),controller[_0x1ce0('0xc')]);router[_0x1ce0('0x6')](_0x1ce0('0xd'),auth[_0x1ce0('0x7')](),controller[_0x1ce0('0xe')]);router[_0x1ce0('0xf')](_0x1ce0('0x10'),auth['isAuthenticated'](),controller[_0x1ce0('0x11')]);router[_0x1ce0('0xf')](_0x1ce0('0x12'),auth['isAuthenticated'](),controller[_0x1ce0('0x13')]);router[_0x1ce0('0xf')](_0x1ce0('0x14'),auth['isAuthenticated'](),controller[_0x1ce0('0x15')]);router[_0x1ce0('0x16')]('/:id',auth[_0x1ce0('0x7')](),controller[_0x1ce0('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 097ce46..fe5d1f1 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 _0xeb78=['INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0xf3f0cc,_0x5a6ff3){var _0x30935a=function(_0x180114){while(--_0x180114){_0xf3f0cc['push'](_0xf3f0cc['shift']());}};_0x30935a(++_0x5a6ff3);}(_0xeb78,0x126));var _0x8eb7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeb78[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x8eb7('0x0'));module['exports']={'state':{'type':Sequelize[_0x8eb7('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x8eb7('0x2')]},'scheduledat':{'type':Sequelize[_0x8eb7('0x3')]},'countbusyretry':{'type':Sequelize[_0x8eb7('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8eb7('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8eb7('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8eb7('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x8eb7('0x2')]},'originatecalleridname':{'type':Sequelize[_0x8eb7('0x2')]},'calleridnum':{'type':Sequelize[_0x8eb7('0x2')]},'calleridname':{'type':Sequelize[_0x8eb7('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x8eb7('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x8eb7('0x3')]},'ringtime':{'type':Sequelize[_0x8eb7('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8eb7('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8eb7('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8eb7('0x2')]},'campaign':{'type':Sequelize[_0x8eb7('0x2')]},'campaigntype':{'type':Sequelize[_0x8eb7('0x2')]},'membername':{'type':Sequelize[_0x8eb7('0x2')]},'reason':{'type':Sequelize[_0x8eb7('0x2')]},'amd':{'type':Sequelize[_0x8eb7('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8eb7('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x8eb7('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8eb7('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8eb7('0x3')]},'recallme':{'type':Sequelize[_0x8eb7('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8eb7('0x3')]},'edited':{'type':Sequelize[_0x8eb7('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x8eb7('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8eb7('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8eb7('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8eb7('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8eb7('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0c32=['INTEGER','DATE','STRING','BOOLEAN','sequelize'];(function(_0x3e682b,_0x49d6ca){var _0x3afd6f=function(_0x4d7bf8){while(--_0x4d7bf8){_0x3e682b['push'](_0x3e682b['shift']());}};_0x3afd6f(++_0x49d6ca);}(_0x0c32,0x81));var _0x20c3=function(_0x2a4b57,_0x824793){_0x2a4b57=_0x2a4b57-0x0;var _0x46ac99=_0x0c32[_0x2a4b57];return _0x46ac99;};'use strict';var Sequelize=require(_0x20c3('0x0'));module['exports']={'state':{'type':Sequelize[_0x20c3('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x20c3('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x20c3('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x20c3('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x20c3('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x20c3('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x20c3('0x2')]},'responsetime':{'type':Sequelize[_0x20c3('0x2')]},'answertime':{'type':Sequelize[_0x20c3('0x2')]},'droptime':{'type':Sequelize[_0x20c3('0x2')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x20c3('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x20c3('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x20c3('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x20c3('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x20c3('0x3')]},'membername':{'type':Sequelize[_0x20c3('0x3')]},'reason':{'type':Sequelize[_0x20c3('0x3')]},'amd':{'type':Sequelize[_0x20c3('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x20c3('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x20c3('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x20c3('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x20c3('0x2')]},'recallme':{'type':Sequelize[_0x20c3('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x20c3('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x20c3('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x20c3('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x20c3('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x20c3('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x20c3('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 5587fd8..37d227d 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 _0xcaa5=['status','set','Content-Range','apply','save','then','destroy','error','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','create','describe','update','uniqueid','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit'];(function(_0x1bfe8e,_0x4c881e){var _0x3fd294=function(_0x5c161e){while(--_0x5c161e){_0x1bfe8e['push'](_0x1bfe8e['shift']());}};_0x3fd294(++_0x4c881e);}(_0xcaa5,0x152));var _0x5caa=function(_0x30f07a,_0x98341){_0x30f07a=_0x30f07a-0x0;var _0xb38461=_0xcaa5[_0x30f07a];return _0xb38461;};'use strict';var pdf=require(_0x5caa('0x0'));var emlformat=require(_0x5caa('0x1'));var rimraf=require(_0x5caa('0x2'));var zipdir=require(_0x5caa('0x3'));var jsonpatch=require(_0x5caa('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5caa('0x5'));var Mustache=require(_0x5caa('0x6'));var util=require(_0x5caa('0x7'));var path=require('path');var sox=require(_0x5caa('0x8'));var csv=require(_0x5caa('0x9'));var ejs=require(_0x5caa('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5caa('0xb'));var deskjs=require(_0x5caa('0xc'));var toCsv=require(_0x5caa('0x9'));var querystring=require('querystring');var Papa=require(_0x5caa('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5caa('0xe'));var as=require(_0x5caa('0xf'));var hardwareService=require(_0x5caa('0x10'));var logger=require(_0x5caa('0x11'))('api');var utils=require(_0x5caa('0x12'));var config=require(_0x5caa('0x13'));var db=require(_0x5caa('0x14'))['db'];function respondWithStatusCode(_0x380fbd,_0x45bfbd){_0x45bfbd=_0x45bfbd||0xcc;return function(_0x4679fa){if(_0x4679fa){return _0x380fbd[_0x5caa('0x15')](_0x45bfbd);}return _0x380fbd['status'](_0x45bfbd)[_0x5caa('0x16')]();};}function respondWithResult(_0x24bc25,_0x4533a7){_0x4533a7=_0x4533a7||0xc8;return function(_0x4e2145){if(_0x4e2145){return _0x24bc25['status'](_0x4533a7)[_0x5caa('0x17')](_0x4e2145);}};}function respondWithFilteredResult(_0x1df2fc,_0x36cc58){return function(_0x46ae55){if(_0x46ae55){var _0x176f06=_0x46ae55[_0x5caa('0x18')],_0x147eb7=_0x36cc58[_0x5caa('0x19')],_0x5a08ab=_0x36cc58[_0x5caa('0x19')]+_0x36cc58[_0x5caa('0x1a')],_0x399b21;if(_0x5a08ab>=_0x176f06){_0x5a08ab=_0x176f06;_0x399b21=0xc8;}else{_0x399b21=0xce;}_0x1df2fc[_0x5caa('0x1b')](_0x399b21);return _0x1df2fc[_0x5caa('0x1c')](_0x5caa('0x1d'),_0x147eb7+'-'+_0x5a08ab+'/'+_0x176f06)[_0x5caa('0x17')](_0x46ae55);}return null;};}function patchUpdates(_0x5a2469){return function(_0x551e3e){try{jsonpatch[_0x5caa('0x1e')](_0x551e3e,_0x5a2469,!![]);}catch(_0x54a2a0){return BPromise['reject'](_0x54a2a0);}return _0x551e3e[_0x5caa('0x1f')]();};}function saveUpdates(_0x581efa,_0x37eb76){return function(_0x39dc8c){if(_0x39dc8c){return _0x39dc8c['update'](_0x581efa)[_0x5caa('0x20')](function(_0x248e3a){return _0x248e3a;});}return null;};}function removeEntity(_0x37d087,_0x534beb){return function(_0x3178c5){if(_0x3178c5){return _0x3178c5[_0x5caa('0x21')]()['then'](function(){_0x37d087['status'](0xcc)[_0x5caa('0x16')]();});}};}function handleEntityNotFound(_0x38fa03,_0x1a4feb){return function(_0x16bda6){if(!_0x16bda6){_0x38fa03[_0x5caa('0x15')](0x194);}return _0x16bda6;};}function handleError(_0x58232b,_0x1b76a1){_0x1b76a1=_0x1b76a1||0x1f4;return function(_0xd55429){logger[_0x5caa('0x22')](_0xd55429['stack']);if(_0xd55429[_0x5caa('0x23')]){delete _0xd55429[_0x5caa('0x23')];}_0x58232b['status'](_0x1b76a1)[_0x5caa('0x24')](_0xd55429);};}exports[_0x5caa('0x25')]=function(_0x41068d,_0x48f2e2){var _0x1501de={},_0x43c2db={},_0x1a2b19={'count':0x0,'rows':[]};var _0x3cd111=_[_0x5caa('0x26')](db[_0x5caa('0x27')][_0x5caa('0x28')],function(_0x591499){return{'name':_0x591499[_0x5caa('0x29')],'type':_0x591499[_0x5caa('0x2a')]['key']};});_0x43c2db[_0x5caa('0x2b')]=_[_0x5caa('0x26')](_0x3cd111,'name');_0x43c2db[_0x5caa('0x2c')]=_[_0x5caa('0x2d')](_0x41068d[_0x5caa('0x2c')]);_0x43c2db[_0x5caa('0x2e')]=_['intersection'](_0x43c2db['model'],_0x43c2db['query']);_0x1501de[_0x5caa('0x2f')]=_[_0x5caa('0x30')](_0x43c2db[_0x5caa('0x2b')],qs[_0x5caa('0x31')](_0x41068d[_0x5caa('0x2c')][_0x5caa('0x31')]));_0x1501de[_0x5caa('0x2f')]=_0x1501de['attributes']['length']?_0x1501de[_0x5caa('0x2f')]:_0x43c2db['model'];if(!_0x41068d['query']['hasOwnProperty'](_0x5caa('0x32'))){_0x1501de[_0x5caa('0x1a')]=qs[_0x5caa('0x1a')](_0x41068d['query'][_0x5caa('0x1a')]);_0x1501de[_0x5caa('0x19')]=qs[_0x5caa('0x19')](_0x41068d[_0x5caa('0x2c')][_0x5caa('0x19')]);}_0x1501de[_0x5caa('0x33')]=qs[_0x5caa('0x34')](_0x41068d[_0x5caa('0x2c')]['sort']);_0x1501de[_0x5caa('0x35')]=qs[_0x5caa('0x2e')](_[_0x5caa('0x36')](_0x41068d['query'],_0x43c2db['filters']));if(_0x41068d[_0x5caa('0x2c')][_0x5caa('0x37')]){_0x1501de[_0x5caa('0x35')]=_[_0x5caa('0x38')](_0x1501de['where'],{'$or':_[_0x5caa('0x26')](_0x3cd111,function(_0x5d160d){if(_0x5d160d['type']!==_0x5caa('0x39')){var _0x9194a4={};_0x9194a4[_0x5d160d[_0x5caa('0x23')]]={'$like':'%'+_0x41068d['query'][_0x5caa('0x37')]+'%'};return _0x9194a4;}})});}_0x1501de=_['merge']({},_0x1501de,_0x41068d[_0x5caa('0x3a')]);var _0x1a97f3={'where':_0x1501de['where']};return db[_0x5caa('0x27')][_0x5caa('0x18')](_0x1a97f3)[_0x5caa('0x20')](function(_0x53efa7){_0x1a2b19['count']=_0x53efa7;if(_0x41068d[_0x5caa('0x2c')][_0x5caa('0x3b')]){_0x1501de['include']=[{'all':!![]}];}return db[_0x5caa('0x27')][_0x5caa('0x3c')](_0x1501de);})[_0x5caa('0x20')](function(_0x19e56e){_0x1a2b19[_0x5caa('0x3d')]=_0x19e56e;return _0x1a2b19;})[_0x5caa('0x20')](respondWithFilteredResult(_0x48f2e2,_0x1501de))[_0x5caa('0x3e')](handleError(_0x48f2e2,null));};exports[_0x5caa('0x3f')]=function(_0x492e5a,_0x5284c0){var _0x48564b={'raw':!![],'where':{'id':_0x492e5a[_0x5caa('0x40')]['id']}},_0x1be462={};_0x1be462[_0x5caa('0x2b')]=_[_0x5caa('0x2d')](db[_0x5caa('0x27')][_0x5caa('0x28')]);_0x1be462[_0x5caa('0x2c')]=_[_0x5caa('0x2d')](_0x492e5a[_0x5caa('0x2c')]);_0x1be462[_0x5caa('0x2e')]=_[_0x5caa('0x30')](_0x1be462[_0x5caa('0x2b')],_0x1be462[_0x5caa('0x2c')]);_0x48564b[_0x5caa('0x2f')]=_['intersection'](_0x1be462[_0x5caa('0x2b')],qs['fields'](_0x492e5a[_0x5caa('0x2c')]['fields']));_0x48564b[_0x5caa('0x2f')]=_0x48564b[_0x5caa('0x2f')][_0x5caa('0x41')]?_0x48564b[_0x5caa('0x2f')]:_0x1be462[_0x5caa('0x2b')];if(_0x492e5a[_0x5caa('0x2c')][_0x5caa('0x3b')]){_0x48564b[_0x5caa('0x42')]=[{'all':!![]}];}_0x48564b=_[_0x5caa('0x38')]({},_0x48564b,_0x492e5a[_0x5caa('0x3a')]);return db[_0x5caa('0x27')]['find'](_0x48564b)[_0x5caa('0x20')](handleEntityNotFound(_0x5284c0,null))[_0x5caa('0x20')](respondWithResult(_0x5284c0,null))[_0x5caa('0x3e')](handleError(_0x5284c0,null));};exports[_0x5caa('0x43')]=function(_0x3bc8cc,_0x502a01){return db[_0x5caa('0x27')][_0x5caa('0x43')](_0x3bc8cc['body'],{})[_0x5caa('0x20')](respondWithResult(_0x502a01,0xc9))[_0x5caa('0x3e')](handleError(_0x502a01,null));};exports[_0x5caa('0x44')]=function(_0x2f54e3,_0x3b11e2){return db['CmHopperHistory'][_0x5caa('0x44')]()['then'](respondWithResult(_0x3b11e2,null))[_0x5caa('0x3e')](handleError(_0x3b11e2,null));};exports[_0x5caa('0x45')]=function(_0x34bf30,_0x4c12b7){if(_0x34bf30['body'][_0x5caa('0x46')]){delete _0x34bf30[_0x5caa('0x47')][_0x5caa('0x46')];}return db[_0x5caa('0x27')][_0x5caa('0x48')]({'where':{'uniqueid':_0x34bf30['params']['id']}})['then'](handleEntityNotFound(_0x4c12b7,null))[_0x5caa('0x20')](saveUpdates(_0x34bf30[_0x5caa('0x47')],null))['then'](respondWithResult(_0x4c12b7,null))[_0x5caa('0x3e')](handleError(_0x4c12b7,null));}; \ No newline at end of file +var _0x50c4=['CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','catch','describe','uniqueid','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','lodash','squel','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x59fffa,_0x5a61db){var _0x281d4e=function(_0x5327ca){while(--_0x5327ca){_0x59fffa['push'](_0x59fffa['shift']());}};_0x281d4e(++_0x5a61db);}(_0x50c4,0x100));var _0x450c=function(_0x4a3bd9,_0x4c6ea8){_0x4a3bd9=_0x4a3bd9-0x0;var _0x45b132=_0x50c4[_0x4a3bd9];return _0x45b132;};'use strict';var pdf=require(_0x450c('0x0'));var emlformat=require(_0x450c('0x1'));var rimraf=require(_0x450c('0x2'));var zipdir=require(_0x450c('0x3'));var jsonpatch=require(_0x450c('0x4'));var rp=require(_0x450c('0x5'));var moment=require('moment');var BPromise=require(_0x450c('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x450c('0x7'));var sox=require(_0x450c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x450c('0x9'));var squel=require(_0x450c('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x450c('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x450c('0xc'));var authService=require(_0x450c('0xd'));var qs=require(_0x450c('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x450c('0xf'))(_0x450c('0x10'));var utils=require('../../config/utils');var config=require(_0x450c('0x11'));var db=require(_0x450c('0x12'))['db'];function respondWithStatusCode(_0x58b8f5,_0x355d64){_0x355d64=_0x355d64||0xcc;return function(_0x477861){if(_0x477861){return _0x58b8f5[_0x450c('0x13')](_0x355d64);}return _0x58b8f5[_0x450c('0x14')](_0x355d64)[_0x450c('0x15')]();};}function respondWithResult(_0x2b7a7d,_0xf3bb45){_0xf3bb45=_0xf3bb45||0xc8;return function(_0x347636){if(_0x347636){return _0x2b7a7d[_0x450c('0x14')](_0xf3bb45)[_0x450c('0x16')](_0x347636);}};}function respondWithFilteredResult(_0x417cef,_0x5c95d5){return function(_0x4c61fb){if(_0x4c61fb){var _0x15fdb4=_0x4c61fb[_0x450c('0x17')],_0x4e7d5b=_0x5c95d5['offset'],_0x2f068e=_0x5c95d5[_0x450c('0x18')]+_0x5c95d5[_0x450c('0x19')],_0x4637e4;if(_0x2f068e>=_0x15fdb4){_0x2f068e=_0x15fdb4;_0x4637e4=0xc8;}else{_0x4637e4=0xce;}_0x417cef[_0x450c('0x14')](_0x4637e4);return _0x417cef[_0x450c('0x1a')](_0x450c('0x1b'),_0x4e7d5b+'-'+_0x2f068e+'/'+_0x15fdb4)[_0x450c('0x16')](_0x4c61fb);}return null;};}function patchUpdates(_0x125fcf){return function(_0x3f8cb4){try{jsonpatch[_0x450c('0x1c')](_0x3f8cb4,_0x125fcf,!![]);}catch(_0x3fa444){return BPromise[_0x450c('0x1d')](_0x3fa444);}return _0x3f8cb4[_0x450c('0x1e')]();};}function saveUpdates(_0x47cae0,_0x33cdb3){return function(_0x6a50f5){if(_0x6a50f5){return _0x6a50f5[_0x450c('0x1f')](_0x47cae0)[_0x450c('0x20')](function(_0x4e5b36){return _0x4e5b36;});}return null;};}function removeEntity(_0x1eb2a3,_0x4ddd57){return function(_0x3d0d22){if(_0x3d0d22){return _0x3d0d22[_0x450c('0x21')]()[_0x450c('0x20')](function(){_0x1eb2a3[_0x450c('0x14')](0xcc)[_0x450c('0x15')]();});}};}function handleEntityNotFound(_0x556285,_0x4d1b49){return function(_0x435656){if(!_0x435656){_0x556285[_0x450c('0x13')](0x194);}return _0x435656;};}function handleError(_0x4d94b4,_0x2034f0){_0x2034f0=_0x2034f0||0x1f4;return function(_0x4922cd){logger[_0x450c('0x22')](_0x4922cd[_0x450c('0x23')]);if(_0x4922cd[_0x450c('0x24')]){delete _0x4922cd[_0x450c('0x24')];}_0x4d94b4['status'](_0x2034f0)[_0x450c('0x25')](_0x4922cd);};}exports[_0x450c('0x26')]=function(_0x59e8fd,_0x307479){var _0x1f8cfc={},_0x21805a={},_0x828a52={'count':0x0,'rows':[]};var _0x7027e1=_[_0x450c('0x27')](db[_0x450c('0x28')][_0x450c('0x29')],function(_0x242f75){return{'name':_0x242f75[_0x450c('0x2a')],'type':_0x242f75[_0x450c('0x2b')][_0x450c('0x2c')]};});_0x21805a[_0x450c('0x2d')]=_['map'](_0x7027e1,_0x450c('0x24'));_0x21805a[_0x450c('0x2e')]=_[_0x450c('0x2f')](_0x59e8fd['query']);_0x21805a[_0x450c('0x30')]=_[_0x450c('0x31')](_0x21805a[_0x450c('0x2d')],_0x21805a[_0x450c('0x2e')]);_0x1f8cfc[_0x450c('0x32')]=_[_0x450c('0x31')](_0x21805a[_0x450c('0x2d')],qs[_0x450c('0x33')](_0x59e8fd[_0x450c('0x2e')][_0x450c('0x33')]));_0x1f8cfc[_0x450c('0x32')]=_0x1f8cfc['attributes'][_0x450c('0x34')]?_0x1f8cfc[_0x450c('0x32')]:_0x21805a[_0x450c('0x2d')];if(!_0x59e8fd['query'][_0x450c('0x35')](_0x450c('0x36'))){_0x1f8cfc['limit']=qs['limit'](_0x59e8fd[_0x450c('0x2e')][_0x450c('0x19')]);_0x1f8cfc[_0x450c('0x18')]=qs[_0x450c('0x18')](_0x59e8fd[_0x450c('0x2e')][_0x450c('0x18')]);}_0x1f8cfc['order']=qs['sort'](_0x59e8fd[_0x450c('0x2e')][_0x450c('0x37')]);_0x1f8cfc['where']=qs['filters'](_[_0x450c('0x38')](_0x59e8fd[_0x450c('0x2e')],_0x21805a[_0x450c('0x30')]));if(_0x59e8fd[_0x450c('0x2e')][_0x450c('0x39')]){_0x1f8cfc[_0x450c('0x3a')]=_[_0x450c('0x3b')](_0x1f8cfc[_0x450c('0x3a')],{'$or':_[_0x450c('0x27')](_0x7027e1,function(_0x21b616){if(_0x21b616[_0x450c('0x2b')]!==_0x450c('0x3c')){var _0x12ac0b={};_0x12ac0b[_0x21b616['name']]={'$like':'%'+_0x59e8fd[_0x450c('0x2e')][_0x450c('0x39')]+'%'};return _0x12ac0b;}})});}_0x1f8cfc=_['merge']({},_0x1f8cfc,_0x59e8fd[_0x450c('0x3d')]);var _0x51c0de={'where':_0x1f8cfc[_0x450c('0x3a')]};return db[_0x450c('0x28')]['count'](_0x51c0de)[_0x450c('0x20')](function(_0x5855ca){_0x828a52['count']=_0x5855ca;if(_0x59e8fd[_0x450c('0x2e')][_0x450c('0x3e')]){_0x1f8cfc[_0x450c('0x3f')]=[{'all':!![]}];}return db[_0x450c('0x28')][_0x450c('0x40')](_0x1f8cfc);})['then'](function(_0x274eb6){_0x828a52[_0x450c('0x41')]=_0x274eb6;return _0x828a52;})['then'](respondWithFilteredResult(_0x307479,_0x1f8cfc))['catch'](handleError(_0x307479,null));};exports[_0x450c('0x42')]=function(_0x1f15ad,_0x39e941){var _0x1ee776={'raw':!![],'where':{'id':_0x1f15ad[_0x450c('0x43')]['id']}},_0x2459a3={};_0x2459a3[_0x450c('0x2d')]=_['keys'](db[_0x450c('0x28')][_0x450c('0x29')]);_0x2459a3['query']=_[_0x450c('0x2f')](_0x1f15ad[_0x450c('0x2e')]);_0x2459a3[_0x450c('0x30')]=_['intersection'](_0x2459a3[_0x450c('0x2d')],_0x2459a3[_0x450c('0x2e')]);_0x1ee776['attributes']=_[_0x450c('0x31')](_0x2459a3[_0x450c('0x2d')],qs[_0x450c('0x33')](_0x1f15ad[_0x450c('0x2e')]['fields']));_0x1ee776[_0x450c('0x32')]=_0x1ee776['attributes'][_0x450c('0x34')]?_0x1ee776[_0x450c('0x32')]:_0x2459a3['model'];if(_0x1f15ad[_0x450c('0x2e')]['includeAll']){_0x1ee776[_0x450c('0x3f')]=[{'all':!![]}];}_0x1ee776=_[_0x450c('0x3b')]({},_0x1ee776,_0x1f15ad[_0x450c('0x3d')]);return db[_0x450c('0x28')][_0x450c('0x44')](_0x1ee776)[_0x450c('0x20')](handleEntityNotFound(_0x39e941,null))['then'](respondWithResult(_0x39e941,null))['catch'](handleError(_0x39e941,null));};exports[_0x450c('0x45')]=function(_0x1d2641,_0x4bd4c6){return db[_0x450c('0x28')][_0x450c('0x45')](_0x1d2641['body'],{})[_0x450c('0x20')](respondWithResult(_0x4bd4c6,0xc9))[_0x450c('0x46')](handleError(_0x4bd4c6,null));};exports[_0x450c('0x47')]=function(_0x55e65c,_0x293ab3){return db[_0x450c('0x28')]['describe']()[_0x450c('0x20')](respondWithResult(_0x293ab3,null))[_0x450c('0x46')](handleError(_0x293ab3,null));};exports[_0x450c('0x1f')]=function(_0x4c4330,_0x34a91f){if(_0x4c4330['body'][_0x450c('0x48')]){delete _0x4c4330[_0x450c('0x49')]['uniqueid'];}return db['CmHopperHistory'][_0x450c('0x44')]({'where':{'uniqueid':_0x4c4330[_0x450c('0x43')]['id']}})[_0x450c('0x20')](handleEntityNotFound(_0x34a91f,null))[_0x450c('0x20')](saveUpdates(_0x4c4330[_0x450c('0x49')],null))[_0x450c('0x20')](respondWithResult(_0x34a91f,null))[_0x450c('0x46')](handleError(_0x34a91f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 0060733..20d66bb 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 _0x2f97=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','cm_hopper_history','endtime','uniqueid'];(function(_0x216d45,_0x4989fe){var _0xbaac0b=function(_0x308a41){while(--_0x308a41){_0x216d45['push'](_0x216d45['shift']());}};_0xbaac0b(++_0x4989fe);}(_0x2f97,0xf2));var _0x72f9=function(_0x3564ac,_0x2486a7){_0x3564ac=_0x3564ac-0x0;var _0x54d3a2=_0x2f97[_0x3564ac];return _0x54d3a2;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x72f9('0x0'));var moment=require(_0x72f9('0x1'));var BPromise=require(_0x72f9('0x2'));var rp=require(_0x72f9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x72f9('0x4'));var config=require(_0x72f9('0x5'));var attributes=require('./cmHopperHistory.attributes');module[_0x72f9('0x6')]=function(_0x3ef14e,_0x112b90){return _0x3ef14e[_0x72f9('0x7')]('CmHopperHistory',attributes,{'tableName':_0x72f9('0x8'),'paranoid':![],'indexes':[{'name':_0x72f9('0x9'),'fields':[_0x72f9('0x9')]},{'name':_0x72f9('0xa'),'fields':[_0x72f9('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4e9f=['path','rimraf','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','api','request-promise'];(function(_0x4ef1e6,_0x1a2f35){var _0x51c7fc=function(_0x854fef){while(--_0x854fef){_0x4ef1e6['push'](_0x4ef1e6['shift']());}};_0x51c7fc(++_0x1a2f35);}(_0x4e9f,0x18f));var _0xf4e9=function(_0x4810ea,_0x1a0950){_0x4810ea=_0x4810ea-0x0;var _0xd9b571=_0x4e9f[_0x4810ea];return _0xd9b571;};'use strict';var _=require(_0xf4e9('0x0'));var util=require(_0xf4e9('0x1'));var logger=require('../../config/logger')(_0xf4e9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf4e9('0x3'));var fs=require('fs');var path=require(_0xf4e9('0x4'));var rimraf=require(_0xf4e9('0x5'));var config=require(_0xf4e9('0x6'));var attributes=require(_0xf4e9('0x7'));module['exports']=function(_0x3a15e6,_0x5eb6b3){return _0x3a15e6[_0xf4e9('0x8')](_0xf4e9('0x9'),attributes,{'tableName':_0xf4e9('0xa'),'paranoid':![],'indexes':[{'name':_0xf4e9('0xb'),'fields':[_0xf4e9('0xb')]},{'name':_0xf4e9('0xc'),'fields':[_0xf4e9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 556f6cb..e6d4405 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 _0x0abf=['`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','GetCampaignHopperHistory','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','then','AvgHandleTime','where','sequelize','COUNT','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','debug','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay'];(function(_0x5f0cd8,_0x54141e){var _0x54ff85=function(_0x2da1b9){while(--_0x2da1b9){_0x5f0cd8['push'](_0x5f0cd8['shift']());}};_0x54ff85(++_0x54141e);}(_0x0abf,0xe8));var _0xf0ab=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0abf[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var moment=require(_0xf0ab('0x1'));var BPromise=require(_0xf0ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0ab('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0ab('0x4'))(_0xf0ab('0x5'));var config=require(_0xf0ab('0x6'));var jayson=require(_0xf0ab('0x7'));var client=jayson[_0xf0ab('0x8')][_0xf0ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x233afe,_0x57ff3b,_0x2c4628){return new BPromise(function(_0x3f7e2b,_0x3ca099){return client[_0xf0ab('0xa')](_0x233afe,_0x2c4628)['then'](function(_0x472508){logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,'request\x20sent');logger['debug'](_0xf0ab('0xd'),_0x57ff3b,'request\x20sent',JSON[_0xf0ab('0xe')](_0x472508));if(_0x472508[_0xf0ab('0xf')]){if(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x10')]===0x1f4){logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')]['message']);return _0x3ca099(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);return _0x3f7e2b(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}else{logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,_0xf0ab('0x12'));_0x3f7e2b(_0x472508[_0xf0ab('0x13')][_0xf0ab('0x11')]);}})[_0xf0ab('0x14')](function(_0x230f40){logger['error'](_0xf0ab('0xc'),_0x57ff3b,_0x230f40);_0x3ca099(_0x230f40);});});}exports[_0xf0ab('0x15')]=function(_0x1803f0){var _0x1ffeb5=this;return new Promise(function(_0x776619,_0xb9a33){return db[_0xf0ab('0x16')][_0xf0ab('0x17')](_0x1803f0[_0xf0ab('0x18')],{'raw':_0x1803f0[_0xf0ab('0x19')]?_0x1803f0[_0xf0ab('0x19')][_0xf0ab('0x1a')]===undefined?!![]:![]:!![]})[_0xf0ab('0x1b')](function(_0x22a205){logger[_0xf0ab('0xb')](_0xf0ab('0x15'),_0x1803f0);logger['debug'](_0xf0ab('0x15'),_0x1803f0,JSON[_0xf0ab('0xe')](_0x22a205));_0x776619(_0x22a205);})[_0xf0ab('0x14')](function(_0x11ab3a){logger[_0xf0ab('0xf')](_0xf0ab('0x15'),_0x11ab3a[_0xf0ab('0x11')],_0x1803f0);_0xb9a33(_0x1ffeb5[_0xf0ab('0xf')](0x1f4,_0x11ab3a[_0xf0ab('0x11')]));});});};exports[_0xf0ab('0x1c')]=function(_0x43119f){var _0x5645b2=this;return new Promise(function(_0x585841,_0x4eee21){return db[_0xf0ab('0x16')]['findAll']({'raw':_0x43119f[_0xf0ab('0x19')]?_0x43119f[_0xf0ab('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x43119f[_0xf0ab('0x19')]?_0x43119f[_0xf0ab('0x19')][_0xf0ab('0x1d')]||null:null,'attributes':[[db[_0xf0ab('0x1e')]['fn'](_0xf0ab('0x1f'),db['sequelize'][_0xf0ab('0x20')]('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')]['fn']('IF',db[_0xf0ab('0x1e')][_0xf0ab('0x21')](_0xf0ab('0x22')))),_0xf0ab('0x23')],[db[_0xf0ab('0x1e')]['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')]['fn']('IF',db[_0xf0ab('0x1e')][_0xf0ab('0x21')](_0xf0ab('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xf0ab('0x1e')]['fn'](_0xf0ab('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0xf0ab('0x21')](_0xf0ab('0x25')))),_0xf0ab('0x26')],[db['sequelize']['fn']('AVG',db[_0xf0ab('0x1e')]['fn']('IF',db['sequelize'][_0xf0ab('0x21')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xf0ab('0x27')],[db[_0xf0ab('0x1e')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0xf0ab('0x1e')][_0xf0ab('0x21')](_0xf0ab('0x28')))),_0xf0ab('0x29')]]})[_0xf0ab('0x1b')](function(_0x36195d){logger[_0xf0ab('0xb')](_0xf0ab('0x1c'),_0x43119f);logger[_0xf0ab('0x2a')](_0xf0ab('0x1c'),_0x43119f,JSON[_0xf0ab('0xe')](_0x36195d));_0x585841(_0x36195d);})[_0xf0ab('0x14')](function(_0x22dcfe){logger[_0xf0ab('0xf')]('AvgHandleTime',_0x22dcfe[_0xf0ab('0x11')],_0x43119f);_0x4eee21(_0x5645b2[_0xf0ab('0xf')](0x1f4,_0x22dcfe[_0xf0ab('0x11')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x9e38af){var _0xe4d58b=this;return new Promise(function(_0x5d99e7,_0x58bc85){return db[_0xf0ab('0x16')]['findAll']({'raw':_0x9e38af[_0xf0ab('0x19')]?_0x9e38af['options'][_0xf0ab('0x1a')]===undefined?!![]:![]:!![],'where':_0x9e38af[_0xf0ab('0x19')]?_0x9e38af[_0xf0ab('0x19')][_0xf0ab('0x1d')]||null:null,'attributes':[[_0xf0ab('0x2b'),_0xf0ab('0x2c')],[db['sequelize']['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')]['fn']('IF',db['sequelize'][_0xf0ab('0x21')](_0xf0ab('0x2d')))),_0xf0ab('0x2e')],[db[_0xf0ab('0x1e')]['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')]['fn']('IF',db[_0xf0ab('0x1e')]['literal'](_0xf0ab('0x2f')))),_0xf0ab('0x30')],[db[_0xf0ab('0x1e')]['fn']('COUNT',db[_0xf0ab('0x1e')]['fn']('IF',db[_0xf0ab('0x1e')][_0xf0ab('0x21')](_0xf0ab('0x22')))),_0xf0ab('0x31')],[db['sequelize']['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')]['fn']('IF',db[_0xf0ab('0x1e')][_0xf0ab('0x21')](_0xf0ab('0x32')))),_0xf0ab('0x33')],[db[_0xf0ab('0x1e')]['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')]['fn']('IF',db[_0xf0ab('0x1e')][_0xf0ab('0x21')](_0xf0ab('0x34')))),_0xf0ab('0x35')],[db['sequelize']['fn']('COUNT',db[_0xf0ab('0x1e')]['fn']('IF',db['sequelize'][_0xf0ab('0x21')](_0xf0ab('0x36')))),'outboundDropCallsDayTimeout'],[db[_0xf0ab('0x1e')]['fn'](_0xf0ab('0x1f'),db['sequelize']['fn']('IF',db[_0xf0ab('0x1e')][_0xf0ab('0x21')](_0xf0ab('0x37')))),_0xf0ab('0x38')],[db[_0xf0ab('0x1e')]['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')]['fn']('IF',db[_0xf0ab('0x1e')][_0xf0ab('0x21')](_0xf0ab('0x39')))),_0xf0ab('0x3a')],[db[_0xf0ab('0x1e')]['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')]['fn']('IF',db['sequelize']['literal'](_0xf0ab('0x3b')))),'outboundBlacklistCallsDay'],[db['sequelize']['fn']('COUNT',db[_0xf0ab('0x1e')]['fn']('IF',db[_0xf0ab('0x1e')][_0xf0ab('0x21')](_0xf0ab('0x3c')))),_0xf0ab('0x3d')],[db[_0xf0ab('0x1e')]['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')]['fn']('IF',db[_0xf0ab('0x1e')][_0xf0ab('0x21')](_0xf0ab('0x3e')))),_0xf0ab('0x3f')],[db['sequelize']['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')]['fn']('IF',db[_0xf0ab('0x1e')][_0xf0ab('0x21')](_0xf0ab('0x40')))),_0xf0ab('0x41')],[db[_0xf0ab('0x1e')]['fn'](_0xf0ab('0x1f'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xf0ab('0x42')))),_0xf0ab('0x3f')],[db['sequelize']['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')]['fn']('IF',db['sequelize'][_0xf0ab('0x21')](_0xf0ab('0x43')))),_0xf0ab('0x44')]],'group':[_0xf0ab('0x2b')]})[_0xf0ab('0x1b')](function(_0x33112b){logger[_0xf0ab('0xb')]('GetVoiceQueueHopperHistory',_0x9e38af);logger[_0xf0ab('0x2a')]('GetVoiceQueueHopperHistory',_0x9e38af,JSON[_0xf0ab('0xe')](_0x33112b));_0x5d99e7(_0x33112b);})['catch'](function(_0x1a402b){logger['error']('GetVoiceQueueHopperHistory',_0x1a402b[_0xf0ab('0x11')],_0x9e38af);_0x58bc85(_0xe4d58b['error'](0x1f4,_0x1a402b[_0xf0ab('0x11')]));});});};exports['GetCampaignHopperHistory']=function(_0x2eff07){var _0x488001=this;return new Promise(function(_0x42331c,_0x2114f0){return db[_0xf0ab('0x16')]['findAll']({'raw':_0x2eff07['options']?_0x2eff07['options'][_0xf0ab('0x1a')]===undefined?!![]:![]:!![],'where':_0x2eff07[_0xf0ab('0x19')]?_0x2eff07['options']['where']||null:null,'attributes':[[_0xf0ab('0x2b'),_0xf0ab('0x2c')],[db[_0xf0ab('0x1e')]['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')][_0xf0ab('0x20')]('id')),_0xf0ab('0x45')],[db[_0xf0ab('0x1e')]['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')]['fn']('IF',db[_0xf0ab('0x1e')]['literal'](_0xf0ab('0x22')))),'ivrAnswerCallsDay']],'group':[_0xf0ab('0x2b')]})[_0xf0ab('0x1b')](function(_0x14e4ee){logger[_0xf0ab('0xb')](_0xf0ab('0x46'),_0x2eff07);logger[_0xf0ab('0x2a')](_0xf0ab('0x46'),_0x2eff07,JSON[_0xf0ab('0xe')](_0x14e4ee));_0x42331c(_0x14e4ee);})[_0xf0ab('0x14')](function(_0x180ee6){logger['error'](_0xf0ab('0x46'),_0x180ee6[_0xf0ab('0x11')],_0x2eff07);_0x2114f0(_0x488001[_0xf0ab('0xf')](0x1f4,_0x180ee6[_0xf0ab('0x11')]));});});}; \ No newline at end of file +var _0xa74f=['GetVoiceQueueHopperHistory','findAll','raw','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','where','sequelize','col','predictiveIntervalTotalCalls','literal','COUNT','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','AvgHandleTime'];(function(_0x1565bd,_0x4cce21){var _0x4b1fee=function(_0x38530d){while(--_0x38530d){_0x1565bd['push'](_0x1565bd['shift']());}};_0x4b1fee(++_0x4cce21);}(_0xa74f,0x9a));var _0xfa74=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xa74f[_0x599e60];return _0x468e19;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa74('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa74('0x1'));var db=require(_0xfa74('0x2'))['db'];var utils=require(_0xfa74('0x3'));var logger=require(_0xfa74('0x4'))('rpc');var config=require(_0xfa74('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfa74('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x9ddbd2,_0x3ac32e,_0x2d9fa9){return new BPromise(function(_0x287921,_0x344e04){return client['request'](_0x9ddbd2,_0x2d9fa9)[_0xfa74('0x7')](function(_0x37d4d8){logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,'request\x20sent');logger[_0xfa74('0xa')](_0xfa74('0xb'),_0x3ac32e,'request\x20sent',JSON[_0xfa74('0xc')](_0x37d4d8));if(_0x37d4d8[_0xfa74('0xd')]){if(_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xe')]===0x1f4){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x344e04(_0x37d4d8[_0xfa74('0xd')]['message']);}logger[_0xfa74('0xd')](_0xfa74('0x9'),_0x3ac32e,_0x37d4d8[_0xfa74('0xd')][_0xfa74('0xf')]);return _0x287921(_0x37d4d8[_0xfa74('0xd')]['message']);}else{logger[_0xfa74('0x8')](_0xfa74('0x9'),_0x3ac32e,_0xfa74('0x10'));_0x287921(_0x37d4d8[_0xfa74('0x11')][_0xfa74('0xf')]);}})[_0xfa74('0x12')](function(_0x3b9e32){logger['error'](_0xfa74('0x9'),_0x3ac32e,_0x3b9e32);_0x344e04(_0x3b9e32);});});}exports[_0xfa74('0x13')]=function(_0x51dda1){var _0x4928b6=this;return new Promise(function(_0x31d3c1,_0x25a36b){return db[_0xfa74('0x14')]['create'](_0x51dda1[_0xfa74('0x15')],{'raw':_0x51dda1[_0xfa74('0x16')]?_0x51dda1[_0xfa74('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xfa74('0x7')](function(_0x302eb4){logger[_0xfa74('0x8')]('CreateCmHopperHistory',_0x51dda1);logger['debug'](_0xfa74('0x13'),_0x51dda1,JSON[_0xfa74('0xc')](_0x302eb4));_0x31d3c1(_0x302eb4);})[_0xfa74('0x12')](function(_0xeaaa19){logger[_0xfa74('0xd')]('CreateCmHopperHistory',_0xeaaa19['message'],_0x51dda1);_0x25a36b(_0x4928b6[_0xfa74('0xd')](0x1f4,_0xeaaa19['message']));});});};exports['AvgHandleTime']=function(_0x529810){var _0x42c439=this;return new Promise(function(_0x286d6a,_0x42d9bf){return db['CmHopperHistory']['findAll']({'raw':_0x529810[_0xfa74('0x16')]?_0x529810[_0xfa74('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x529810[_0xfa74('0x16')]?_0x529810['options'][_0xfa74('0x17')]||null:null,'attributes':[[db[_0xfa74('0x18')]['fn']('COUNT',db[_0xfa74('0x18')][_0xfa74('0x19')]('id')),_0xfa74('0x1a')],[db[_0xfa74('0x18')]['fn']('COUNT',db[_0xfa74('0x18')]['fn']('IF',db[_0xfa74('0x18')][_0xfa74('0x1b')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0xfa74('0x18')]['fn'](_0xfa74('0x1c'),db['sequelize']['fn']('IF',db['sequelize'][_0xfa74('0x1b')]('`state`\x20=\x2010,\x201,\x20null'))),_0xfa74('0x1d')],[db['sequelize']['fn'](_0xfa74('0x1c'),db[_0xfa74('0x18')]['fn']('IF',db[_0xfa74('0x18')][_0xfa74('0x1b')]('`state`\x20=\x2011,\x201,\x20null'))),_0xfa74('0x1e')],[db[_0xfa74('0x18')]['fn'](_0xfa74('0x1f'),db[_0xfa74('0x18')]['fn']('IF',db[_0xfa74('0x18')][_0xfa74('0x1b')](_0xfa74('0x20')))),'predictiveIntervalAvgHoldtime'],[db[_0xfa74('0x18')]['fn']('AVG',db[_0xfa74('0x18')]['fn']('IF',db[_0xfa74('0x18')][_0xfa74('0x1b')](_0xfa74('0x21')))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x390ed4){logger[_0xfa74('0x8')](_0xfa74('0x22'),_0x529810);logger[_0xfa74('0xa')]('AvgHandleTime',_0x529810,JSON[_0xfa74('0xc')](_0x390ed4));_0x286d6a(_0x390ed4);})[_0xfa74('0x12')](function(_0x501a70){logger['error']('AvgHandleTime',_0x501a70['message'],_0x529810);_0x42d9bf(_0x42c439['error'](0x1f4,_0x501a70[_0xfa74('0xf')]));});});};exports[_0xfa74('0x23')]=function(_0x3dcda3){var _0x235607=this;return new Promise(function(_0x2ab5a9,_0x304f6e){return db[_0xfa74('0x14')][_0xfa74('0x24')]({'raw':_0x3dcda3[_0xfa74('0x16')]?_0x3dcda3['options'][_0xfa74('0x25')]===undefined?!![]:![]:!![],'where':_0x3dcda3[_0xfa74('0x16')]?_0x3dcda3[_0xfa74('0x16')][_0xfa74('0x17')]||null:null,'attributes':[[_0xfa74('0x26'),_0xfa74('0x27')],[db['sequelize']['fn'](_0xfa74('0x1c'),db[_0xfa74('0x18')]['fn']('IF',db[_0xfa74('0x18')][_0xfa74('0x1b')]('`state`\x20=\x200,\x201,\x20null'))),_0xfa74('0x28')],[db[_0xfa74('0x18')]['fn'](_0xfa74('0x1c'),db[_0xfa74('0x18')]['fn']('IF',db['sequelize'][_0xfa74('0x1b')](_0xfa74('0x29')))),_0xfa74('0x2a')],[db['sequelize']['fn']('COUNT',db[_0xfa74('0x18')]['fn']('IF',db[_0xfa74('0x18')][_0xfa74('0x1b')](_0xfa74('0x2b')))),'outboundAnswerCallsDay'],[db[_0xfa74('0x18')]['fn'](_0xfa74('0x1c'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xfa74('0x2c')],[db[_0xfa74('0x18')]['fn'](_0xfa74('0x1c'),db[_0xfa74('0x18')]['fn']('IF',db[_0xfa74('0x18')][_0xfa74('0x1b')](_0xfa74('0x2d')))),'outboundCongestionCallsDay'],[db[_0xfa74('0x18')]['fn'](_0xfa74('0x1c'),db[_0xfa74('0x18')]['fn']('IF',db[_0xfa74('0x18')][_0xfa74('0x1b')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xfa74('0x2e')],[db[_0xfa74('0x18')]['fn'](_0xfa74('0x1c'),db[_0xfa74('0x18')]['fn']('IF',db[_0xfa74('0x18')][_0xfa74('0x1b')](_0xfa74('0x2f')))),_0xfa74('0x30')],[db[_0xfa74('0x18')]['fn'](_0xfa74('0x1c'),db['sequelize']['fn']('IF',db[_0xfa74('0x18')]['literal'](_0xfa74('0x31')))),_0xfa74('0x32')],[db[_0xfa74('0x18')]['fn'](_0xfa74('0x1c'),db['sequelize']['fn']('IF',db[_0xfa74('0x18')][_0xfa74('0x1b')]('`state`\x20=\x2013,\x201,\x20null'))),_0xfa74('0x33')],[db[_0xfa74('0x18')]['fn']('COUNT',db[_0xfa74('0x18')]['fn']('IF',db[_0xfa74('0x18')][_0xfa74('0x1b')](_0xfa74('0x34')))),_0xfa74('0x35')],[db['sequelize']['fn']('COUNT',db[_0xfa74('0x18')]['fn']('IF',db[_0xfa74('0x18')]['literal'](_0xfa74('0x36')))),_0xfa74('0x37')],[db[_0xfa74('0x18')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xfa74('0x18')][_0xfa74('0x1b')](_0xfa74('0x38')))),_0xfa74('0x39')],[db[_0xfa74('0x18')]['fn'](_0xfa74('0x1c'),db[_0xfa74('0x18')]['fn']('IF',db[_0xfa74('0x18')]['literal'](_0xfa74('0x3a')))),_0xfa74('0x37')],[db[_0xfa74('0x18')]['fn'](_0xfa74('0x1c'),db['sequelize']['fn']('IF',db['sequelize'][_0xfa74('0x1b')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xfa74('0x3b')]],'group':[_0xfa74('0x26')]})[_0xfa74('0x7')](function(_0x33e31e){logger[_0xfa74('0x8')](_0xfa74('0x23'),_0x3dcda3);logger[_0xfa74('0xa')]('GetVoiceQueueHopperHistory',_0x3dcda3,JSON[_0xfa74('0xc')](_0x33e31e));_0x2ab5a9(_0x33e31e);})['catch'](function(_0x21d7c5){logger['error']('GetVoiceQueueHopperHistory',_0x21d7c5[_0xfa74('0xf')],_0x3dcda3);_0x304f6e(_0x235607[_0xfa74('0xd')](0x1f4,_0x21d7c5['message']));});});};exports['GetCampaignHopperHistory']=function(_0x6e588d){var _0x1ab715=this;return new Promise(function(_0x8afe72,_0x234899){return db[_0xfa74('0x14')][_0xfa74('0x24')]({'raw':_0x6e588d[_0xfa74('0x16')]?_0x6e588d[_0xfa74('0x16')][_0xfa74('0x25')]===undefined?!![]:![]:!![],'where':_0x6e588d[_0xfa74('0x16')]?_0x6e588d['options'][_0xfa74('0x17')]||null:null,'attributes':[[_0xfa74('0x26'),'name'],[db['sequelize']['fn'](_0xfa74('0x1c'),db[_0xfa74('0x18')][_0xfa74('0x19')]('id')),_0xfa74('0x3c')],[db[_0xfa74('0x18')]['fn']('COUNT',db[_0xfa74('0x18')]['fn']('IF',db['sequelize'][_0xfa74('0x1b')](_0xfa74('0x2b')))),_0xfa74('0x3d')]],'group':['campaign']})['then'](function(_0x2d300a){logger[_0xfa74('0x8')](_0xfa74('0x3e'),_0x6e588d);logger[_0xfa74('0xa')]('GetCampaignHopperHistory',_0x6e588d,JSON[_0xfa74('0xc')](_0x2d300a));_0x8afe72(_0x2d300a);})[_0xfa74('0x12')](function(_0x5a2494){logger[_0xfa74('0xd')](_0xfa74('0x3e'),_0x5a2494[_0xfa74('0xf')],_0x6e588d);_0x234899(_0x1ab715[_0xfa74('0xd')](0x1f4,_0x5a2494['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index c0d11a7..82a1640 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 _0x099f=['update','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','describe','/:id','show','post','put'];(function(_0x4a9d51,_0x477b63){var _0x2eab66=function(_0x7a2f27){while(--_0x7a2f27){_0x4a9d51['push'](_0x4a9d51['shift']());}};_0x2eab66(++_0x477b63);}(_0x099f,0x133));var _0xf099=function(_0x225d97,_0x18afe8){_0x225d97=_0x225d97-0x0;var _0x264846=_0x099f[_0x225d97];return _0x264846;};'use strict';var multer=require(_0xf099('0x0'));var util=require(_0xf099('0x1'));var path=require(_0xf099('0x2'));var timeout=require(_0xf099('0x3'));var express=require('express');var router=express[_0xf099('0x4')]();var auth=require(_0xf099('0x5'));var interaction=require(_0xf099('0x6'));var config=require(_0xf099('0x7'));var controller=require(_0xf099('0x8'));router[_0xf099('0x9')]('/',auth[_0xf099('0xa')](),controller['index']);router[_0xf099('0x9')]('/describe',auth[_0xf099('0xa')](),controller[_0xf099('0xb')]);router['get'](_0xf099('0xc'),auth[_0xf099('0xa')](),controller[_0xf099('0xd')]);router[_0xf099('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf099('0xf')](_0xf099('0xc'),auth[_0xf099('0xa')](),controller[_0xf099('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9ed7=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','update','exports','multer','util','path'];(function(_0x55d829,_0x43f06c){var _0x52163b=function(_0x493cd8){while(--_0x493cd8){_0x55d829['push'](_0x55d829['shift']());}};_0x52163b(++_0x43f06c);}(_0x9ed7,0x1a6));var _0x79ed=function(_0x2da357,_0x1f9b2f){_0x2da357=_0x2da357-0x0;var _0x138fdd=_0x9ed7[_0x2da357];return _0x138fdd;};'use strict';var multer=require(_0x79ed('0x0'));var util=require(_0x79ed('0x1'));var path=require(_0x79ed('0x2'));var timeout=require('connect-timeout');var express=require(_0x79ed('0x3'));var router=express['Router']();var auth=require(_0x79ed('0x4'));var interaction=require(_0x79ed('0x5'));var config=require(_0x79ed('0x6'));var controller=require(_0x79ed('0x7'));router[_0x79ed('0x8')]('/',auth[_0x79ed('0x9')](),controller[_0x79ed('0xa')]);router['get'](_0x79ed('0xb'),auth[_0x79ed('0x9')](),controller[_0x79ed('0xc')]);router[_0x79ed('0x8')](_0x79ed('0xd'),auth[_0x79ed('0x9')](),controller[_0x79ed('0xe')]);router['post']('/',auth[_0x79ed('0x9')](),controller['create']);router['put']('/:id',auth[_0x79ed('0x9')](),controller[_0x79ed('0xf')]);module[_0x79ed('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 5b2aaa7..d0338b4 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 _0xdbf1=['exports','STRING','sequelize'];(function(_0x2cf7aa,_0xeaba23){var _0x55d639=function(_0x15242f){while(--_0x15242f){_0x2cf7aa['push'](_0x2cf7aa['shift']());}};_0x55d639(++_0xeaba23);}(_0xdbf1,0x164));var _0x1dbf=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xdbf1[_0x138f59];return _0x3d114d;};'use strict';var Sequelize=require(_0x1dbf('0x0'));module[_0x1dbf('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1dbf('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf9d7=['exports','STRING','name'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xf9d7,0x84));var _0x7f9d=function(_0x7abcd6,_0x36548c){_0x7abcd6=_0x7abcd6-0x0;var _0x329aea=_0xf9d7[_0x7abcd6];return _0x329aea;};'use strict';var Sequelize=require('sequelize');module[_0x7f9d('0x0')]={'name':{'type':Sequelize[_0x7f9d('0x1')],'unique':_0x7f9d('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7f9d('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 11bd5f5..97b8f95 100644 --- a/server/api/cmList/cmList.controller.js +++ b/server/api/cmList/cmList.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','spread','removeAgents','emit','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','findOne','Disposition','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','errors','message','CmCustomField','CustomFields','concat','format','cf_%d','nolimit','raw','getContacts','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','TEXT','text','Sequelize','number','INTEGER','switch','defaultValue','queryInterface','cm_contacts','cf_%s','getCustomFields','findAndCountAll'];(function(_0x42cf62,_0x2ec525){var _0x2824bf=function(_0x5d9837){while(--_0x5d9837){_0x42cf62['push'](_0x42cf62['shift']());}};_0x2824bf(++_0x2ec525);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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'];config[_0x0a9e('0x14')]=_[_0x0a9e('0x15')](config[_0x0a9e('0x14')],{'host':_0x0a9e('0x16'),'port':0x18eb});var socket=require(_0x0a9e('0x17'))(new Redis(config['redis']));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x2b4227,_0x281129){_0x281129=_0x281129||0xcc;return function(_0x44dcfd){if(_0x44dcfd){return _0x2b4227[_0x0a9e('0x1a')](_0x281129);}return _0x2b4227['status'](_0x281129)[_0x0a9e('0x1b')]();};}function respondWithResult(_0x5d0880,_0x1985b6){_0x1985b6=_0x1985b6||0xc8;return function(_0x519dfd){if(_0x519dfd){return _0x5d0880[_0x0a9e('0x1c')](_0x1985b6)[_0x0a9e('0x1d')](_0x519dfd);}};}function respondWithFilteredResult(_0x48f32d,_0x225616){return function(_0x5a0a06){if(_0x5a0a06){var _0x459eb1=_0x5a0a06[_0x0a9e('0x1e')],_0x478723=_0x225616[_0x0a9e('0x1f')],_0x106033=_0x225616[_0x0a9e('0x1f')]+_0x225616[_0x0a9e('0x20')],_0x205fd6;if(_0x106033>=_0x459eb1){_0x106033=_0x459eb1;_0x205fd6=0xc8;}else{_0x205fd6=0xce;}_0x48f32d[_0x0a9e('0x1c')](_0x205fd6);return _0x48f32d[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x478723+'-'+_0x106033+'/'+_0x459eb1)[_0x0a9e('0x1d')](_0x5a0a06);}return null;};}function patchUpdates(_0x4bb1e3){return function(_0x2c3407){try{jsonpatch[_0x0a9e('0x23')](_0x2c3407,_0x4bb1e3,!![]);}catch(_0x53682f){return BPromise[_0x0a9e('0x24')](_0x53682f);}return _0x2c3407['save']();};}function saveUpdates(_0x588269,_0x3a02e1){return function(_0x432e56){if(_0x432e56){return _0x432e56[_0x0a9e('0x25')](_0x588269)[_0x0a9e('0x26')](function(_0x4abc77){return _0x4abc77;});}return null;};}function removeEntity(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(_0x3b45bc){return _0x3b45bc[_0x0a9e('0x27')]()[_0x0a9e('0x26')](function(){var _0x42ac8f=_0x3b45bc[_0x0a9e('0x28')]({'plain':!![]});var _0x5ea472='Lists';return db[_0x0a9e('0x29')][_0x0a9e('0x27')]({'where':{'type':_0x5ea472,'resourceId':_0x42ac8f['id']}})[_0x0a9e('0x26')](function(){return _0x3b45bc;});})[_0x0a9e('0x26')](function(){_0xfb6e48['status'](0xcc)[_0x0a9e('0x1b')]();});}};}function handleEntityNotFound(_0x479bc4,_0x45a1e7){return function(_0x5bfb33){if(!_0x5bfb33){_0x479bc4[_0x0a9e('0x1a')](0x194);}return _0x5bfb33;};}function handleError(_0x34dc65,_0x25fba9){_0x25fba9=_0x25fba9||0x1f4;return function(_0x14433c){logger[_0x0a9e('0x2a')](_0x14433c[_0x0a9e('0x2b')]);if(_0x14433c[_0x0a9e('0x2c')]){delete _0x14433c[_0x0a9e('0x2c')];}_0x34dc65['status'](_0x25fba9)[_0x0a9e('0x2d')](_0x14433c);};}exports[_0x0a9e('0x2e')]=function(_0x2b1f27,_0x2ec755){var _0x5c877d={},_0x15b200={},_0x40e7a3={'count':0x0,'rows':[]};var _0x1843b2=_[_0x0a9e('0x2f')](db[_0x0a9e('0x30')][_0x0a9e('0x31')],function(_0x296f41){return{'name':_0x296f41[_0x0a9e('0x32')],'type':_0x296f41[_0x0a9e('0x33')]['key']};});_0x15b200[_0x0a9e('0x34')]=_['map'](_0x1843b2,_0x0a9e('0x2c'));_0x15b200[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x2b1f27[_0x0a9e('0x35')]);_0x15b200[_0x0a9e('0x37')]=_['intersection'](_0x15b200[_0x0a9e('0x34')],_0x15b200[_0x0a9e('0x35')]);_0x5c877d[_0x0a9e('0x38')]=_[_0x0a9e('0x39')](_0x15b200[_0x0a9e('0x34')],qs[_0x0a9e('0x3a')](_0x2b1f27[_0x0a9e('0x35')][_0x0a9e('0x3a')]));_0x5c877d['attributes']=_0x5c877d[_0x0a9e('0x38')]['length']?_0x5c877d[_0x0a9e('0x38')]:_0x15b200[_0x0a9e('0x34')];if(!_0x2b1f27[_0x0a9e('0x35')][_0x0a9e('0x3b')]('nolimit')){_0x5c877d[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x2b1f27[_0x0a9e('0x35')][_0x0a9e('0x20')]);_0x5c877d['offset']=qs['offset'](_0x2b1f27[_0x0a9e('0x35')]['offset']);}_0x5c877d[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2b1f27[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x5c877d['where']=qs[_0x0a9e('0x37')](_[_0x0a9e('0x3e')](_0x2b1f27[_0x0a9e('0x35')],_0x15b200['filters']));if(_0x2b1f27[_0x0a9e('0x35')][_0x0a9e('0x3f')]){_0x5c877d[_0x0a9e('0x40')]=_['merge'](_0x5c877d['where'],{'$or':_[_0x0a9e('0x2f')](_0x1843b2,function(_0x40d766){if(_0x40d766['type']!==_0x0a9e('0x41')){var _0x419125={};_0x419125[_0x40d766[_0x0a9e('0x2c')]]={'$like':'%'+_0x2b1f27[_0x0a9e('0x35')]['filter']+'%'};return _0x419125;}})});}_0x5c877d=_['merge']({},_0x5c877d,_0x2b1f27[_0x0a9e('0x42')]);var _0x45b3d0={'where':_0x5c877d['where']};return db[_0x0a9e('0x30')][_0x0a9e('0x1e')](_0x45b3d0)[_0x0a9e('0x26')](function(_0x5b4f5e){_0x40e7a3[_0x0a9e('0x1e')]=_0x5b4f5e;if(_0x2b1f27[_0x0a9e('0x35')][_0x0a9e('0x43')]){_0x5c877d[_0x0a9e('0x44')]=[{'all':!![]}];}return db[_0x0a9e('0x30')][_0x0a9e('0x45')](_0x5c877d);})[_0x0a9e('0x26')](function(_0x45a9b8){_0x40e7a3[_0x0a9e('0x46')]=_0x45a9b8;return _0x40e7a3;})[_0x0a9e('0x26')](respondWithFilteredResult(_0x2ec755,_0x5c877d))[_0x0a9e('0x47')](handleError(_0x2ec755,null));};exports[_0x0a9e('0x48')]=function(_0x1a7bce,_0x11ca30){var _0x37f6cc={'raw':![],'where':{'id':_0x1a7bce['params']['id']}},_0x4d04c8={};_0x4d04c8[_0x0a9e('0x34')]=_[_0x0a9e('0x36')](db[_0x0a9e('0x30')][_0x0a9e('0x31')]);_0x4d04c8[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x1a7bce[_0x0a9e('0x35')]);_0x4d04c8[_0x0a9e('0x37')]=_[_0x0a9e('0x39')](_0x4d04c8[_0x0a9e('0x34')],_0x4d04c8[_0x0a9e('0x35')]);_0x37f6cc[_0x0a9e('0x38')]=_['intersection'](_0x4d04c8[_0x0a9e('0x34')],qs[_0x0a9e('0x3a')](_0x1a7bce[_0x0a9e('0x35')][_0x0a9e('0x3a')]));_0x37f6cc[_0x0a9e('0x38')]=_0x37f6cc[_0x0a9e('0x38')][_0x0a9e('0x49')]?_0x37f6cc[_0x0a9e('0x38')]:_0x4d04c8['model'];if(_0x1a7bce[_0x0a9e('0x35')]['includeAll']){_0x37f6cc[_0x0a9e('0x44')]=[{'all':!![]}];}_0x37f6cc=_[_0x0a9e('0x4a')]({},_0x37f6cc,_0x1a7bce[_0x0a9e('0x42')]);return db['CmList'][_0x0a9e('0x4b')](_0x37f6cc)[_0x0a9e('0x26')](handleEntityNotFound(_0x11ca30,null))[_0x0a9e('0x26')](respondWithResult(_0x11ca30,null))[_0x0a9e('0x47')](handleError(_0x11ca30,null));};exports[_0x0a9e('0x4c')]=function(_0x37be73,_0x45bf7f){return db['CmList'][_0x0a9e('0x4c')](_0x37be73[_0x0a9e('0x4d')],{})[_0x0a9e('0x26')](function(_0x16f976){var _0x409789=_0x37be73[_0x0a9e('0x4e')][_0x0a9e('0x28')]({'plain':!![]});if(!_0x409789)throw new Error(_0x0a9e('0x4f'));if(_0x409789[_0x0a9e('0x50')]==='user'){var _0xe401a=_0x16f976[_0x0a9e('0x28')]({'plain':!![]});var _0x4f7240='Lists';return db['UserProfileSection'][_0x0a9e('0x4b')]({'where':{'name':_0x4f7240,'userProfileId':_0x409789[_0x0a9e('0x51')]},'raw':!![]})[_0x0a9e('0x26')](function(_0x11545a){if(_0x11545a&&_0x11545a[_0x0a9e('0x52')]===0x0){return db[_0x0a9e('0x29')][_0x0a9e('0x4c')]({'name':_0xe401a[_0x0a9e('0x2c')],'resourceId':_0xe401a['id'],'type':_0x11545a['name'],'sectionId':_0x11545a['id']},{})['then'](function(){return _0x16f976;});}else{return _0x16f976;}})['catch'](function(_0x39d77d){logger[_0x0a9e('0x2a')](_0x0a9e('0x53'),_0x39d77d);throw _0x39d77d;});}return _0x16f976;})['then'](respondWithResult(_0x45bf7f,0xc9))[_0x0a9e('0x47')](handleError(_0x45bf7f,null));};exports[_0x0a9e('0x25')]=function(_0x53d113,_0x5a88da){if(_0x53d113[_0x0a9e('0x4d')]['id']){delete _0x53d113['body']['id'];}return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x53d113[_0x0a9e('0x54')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x5a88da,null))[_0x0a9e('0x26')](saveUpdates(_0x53d113['body'],null))[_0x0a9e('0x26')](respondWithResult(_0x5a88da,null))[_0x0a9e('0x47')](handleError(_0x5a88da,null));};exports['destroy']=function(_0x50f687,_0x128aa6){return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x50f687[_0x0a9e('0x54')]['id']}})['then'](handleEntityNotFound(_0x128aa6,null))[_0x0a9e('0x26')](removeEntity(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x55')]=function(_0x4a6deb,_0x5da27d){return db['CmList'][_0x0a9e('0x55')]()['then'](respondWithResult(_0x5da27d,null))[_0x0a9e('0x47')](handleError(_0x5da27d,null));};exports[_0x0a9e('0x56')]=function(_0x3cfd00,_0x19b4df,_0x232830){if(_0x3cfd00[_0x0a9e('0x4d')]['id']){delete _0x3cfd00[_0x0a9e('0x4d')]['id'];}return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x3cfd00[_0x0a9e('0x54')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x19b4df,null))[_0x0a9e('0x26')](function(_0x30c491){if(_0x30c491){_0x3cfd00[_0x0a9e('0x4d')][_0x0a9e('0x57')]=_0x30c491['id'];return db['Disposition'][_0x0a9e('0x4c')](_0x3cfd00[_0x0a9e('0x4d')]);}})['then'](respondWithResult(_0x19b4df,null))[_0x0a9e('0x47')](handleError(_0x19b4df,null));};exports['getDispositions']=function(_0x20c668,_0x5ba1f9,_0x4b3c1a){var _0x5674ee={'raw':![],'where':{}};var _0x273cb5={};var _0x49d231={'count':0x0,'rows':[]};return db[_0x0a9e('0x30')][_0x0a9e('0x58')]({'where':{'id':_0x20c668[_0x0a9e('0x54')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x5ba1f9,null))[_0x0a9e('0x26')](function(_0x26d7db){if(_0x26d7db){_0x273cb5['model']=_[_0x0a9e('0x36')](db['Disposition'][_0x0a9e('0x31')]);_0x273cb5[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x20c668['query']);_0x273cb5[_0x0a9e('0x37')]=_[_0x0a9e('0x39')](_0x273cb5[_0x0a9e('0x34')],_0x273cb5[_0x0a9e('0x35')]);_0x5674ee['attributes']=_[_0x0a9e('0x39')](_0x273cb5[_0x0a9e('0x34')],qs['fields'](_0x20c668[_0x0a9e('0x35')][_0x0a9e('0x3a')]));_0x5674ee[_0x0a9e('0x38')]=_0x5674ee[_0x0a9e('0x38')][_0x0a9e('0x49')]?_0x5674ee['attributes']:_0x273cb5[_0x0a9e('0x34')];if(!_0x20c668[_0x0a9e('0x35')][_0x0a9e('0x3b')]('nolimit')){_0x5674ee[_0x0a9e('0x20')]=qs['limit'](_0x20c668['query'][_0x0a9e('0x20')]);_0x5674ee[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x20c668[_0x0a9e('0x35')][_0x0a9e('0x1f')]);}_0x5674ee[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x20c668[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x5674ee[_0x0a9e('0x40')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x3e')](_0x20c668[_0x0a9e('0x35')],_0x273cb5[_0x0a9e('0x37')]));_0x5674ee[_0x0a9e('0x40')][_0x0a9e('0x57')]=_0x26d7db['id'];if(_0x20c668[_0x0a9e('0x35')][_0x0a9e('0x3f')]){_0x5674ee['where']=_[_0x0a9e('0x4a')](_0x5674ee[_0x0a9e('0x40')],{'$or':_[_0x0a9e('0x2f')](_0x5674ee['attributes'],function(_0x1148a1){var _0x30944e={};_0x30944e[_0x1148a1]={'$like':'%'+_0x20c668['query'][_0x0a9e('0x3f')]+'%'};return _0x30944e;})});}_0x5674ee=_[_0x0a9e('0x4a')]({},_0x5674ee,_0x20c668[_0x0a9e('0x42')]);return db[_0x0a9e('0x59')][_0x0a9e('0x1e')]({'where':_0x5674ee['where']})['then'](function(_0x4a2438){_0x49d231[_0x0a9e('0x1e')]=_0x4a2438;if(_0x20c668[_0x0a9e('0x35')][_0x0a9e('0x43')]){_0x5674ee[_0x0a9e('0x44')]=[{'all':!![]}];}return db[_0x0a9e('0x59')][_0x0a9e('0x45')](_0x5674ee);})[_0x0a9e('0x26')](function(_0x1a0677){_0x49d231['rows']=_0x1a0677;return _0x49d231;});}})[_0x0a9e('0x26')](respondWithFilteredResult(_0x5ba1f9,_0x5674ee))[_0x0a9e('0x47')](handleError(_0x5ba1f9,null));};exports[_0x0a9e('0x5a')]=function(_0x4a4fc7,_0x2bdc44,_0x583b2e){return db[_0x0a9e('0x30')][_0x0a9e('0x4b')]({'where':{'id':_0x4a4fc7['params']['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x2bdc44,null))[_0x0a9e('0x26')](function(_0x2cc7a7){if(_0x2cc7a7){return _0x2cc7a7[_0x0a9e('0x5a')](_0x4a4fc7['query'][_0x0a9e('0x5b')]);}})[_0x0a9e('0x26')](respondWithStatusCode(_0x2bdc44,null))[_0x0a9e('0x47')](handleError(_0x2bdc44,null));};exports[_0x0a9e('0x5c')]=function(_0x5b7fc3,_0x109ccb,_0x3d91db){return db[_0x0a9e('0x30')][_0x0a9e('0x4b')]({'where':{'id':_0x5b7fc3['params']['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x109ccb,null))[_0x0a9e('0x26')](function(_0x30a4c7){if(_0x30a4c7){var _0xf410e5=[];var _0x332367={'success':[],'errors':[]};return db[_0x0a9e('0x5d')][_0x0a9e('0x55')]()[_0x0a9e('0x26')](function(_0x1a7b03){if(_0x5b7fc3[_0x0a9e('0x4d')][_0x0a9e('0x5e')]&&_[_0x0a9e('0x5f')](_0x5b7fc3[_0x0a9e('0x4d')][_0x0a9e('0x5e')])){if(_0x5b7fc3['body'][_0x0a9e('0x5e')][_0x0a9e('0x49')]){_0x5b7fc3[_0x0a9e('0x4d')]['tags']=_0x5b7fc3[_0x0a9e('0x4d')][_0x0a9e('0x5e')][_0x0a9e('0x60')](';')+';';}else{_0x5b7fc3[_0x0a9e('0x4d')]['tags']=null;}}else{_0x5b7fc3['body'][_0x0a9e('0x5e')]=null;}if(_0x5b7fc3[_0x0a9e('0x4d')]&&_['isArray'](_0x5b7fc3[_0x0a9e('0x4d')])){for(var _0x53a6a1=0x0;_0x53a6a1<_0x5b7fc3[_0x0a9e('0x4d')][_0x0a9e('0x49')];_0x53a6a1+=0x1){_0x5b7fc3['body'][_0x53a6a1][_0x0a9e('0x57')]=_0x5b7fc3[_0x0a9e('0x54')]['id'];_0xf410e5[_0x0a9e('0x61')](_0x5b7fc3[_0x0a9e('0x4d')][_0x53a6a1]);}return BPromise[_0x0a9e('0x62')](_0xf410e5,function(_0x1f42a0){return db[_0x0a9e('0x5d')]['create'](_[_0x0a9e('0x63')](_0x1f42a0,[_0x0a9e('0x5b'),'id'])||{},{'fields':_[_0x0a9e('0x36')](_0x1a7b03),'raw':!![]})[_0x0a9e('0x26')](function(_0x492543){_0x332367[_0x0a9e('0x64')][_0x0a9e('0x61')](_0x492543['dataValues']);})[_0x0a9e('0x47')](function(_0x5b7940){_0x332367[_0x0a9e('0x65')][_0x0a9e('0x61')]({'data':_0x1f42a0,'error':_0x5b7940[_0x0a9e('0x66')]});});})[_0x0a9e('0x26')](function(_0x5af453){return _0x332367;})['catch'](function(_0x353384){return _0x353384;});}else{_0x109ccb[_0x0a9e('0x1c')](0x190)[_0x0a9e('0x1d')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x0a9e('0x26')](respondWithResult(_0x109ccb,null))[_0x0a9e('0x47')](handleError(_0x109ccb,null));};exports['getContacts']=function(_0x4e46b2,_0xf0a802,_0x56acca){var _0x5ea541;return db['CmList'][_0x0a9e('0x4b')]({'where':{'id':_0x4e46b2[_0x0a9e('0x54')]['id']},'include':[{'model':db[_0x0a9e('0x67')],'as':_0x0a9e('0x68')}]})[_0x0a9e('0x26')](handleEntityNotFound(_0xf0a802,null))[_0x0a9e('0x26')](function(_0x5a8854){if(_0x5a8854){_0x5ea541=_0x5a8854;return db[_0x0a9e('0x5d')]['rawAttributes'];}})[_0x0a9e('0x26')](function(_0x2aabab){if(_0x2aabab){var _0x18ad56={};var _0x4566b0={};_0x4566b0['model']=_[_0x0a9e('0x69')](_[_0x0a9e('0x36')](_0x2aabab),_[_0x0a9e('0x2f')](_0x5ea541['CustomFields'],function(_0xb6e411){return util[_0x0a9e('0x6a')](_0x0a9e('0x6b'),_0xb6e411['id']);}));_0x4566b0[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x4e46b2[_0x0a9e('0x35')]);_0x4566b0[_0x0a9e('0x37')]=_[_0x0a9e('0x39')](_0x4566b0['model'],_0x4566b0[_0x0a9e('0x35')]);_0x18ad56[_0x0a9e('0x38')]=_['intersection'](_0x4566b0[_0x0a9e('0x34')],qs[_0x0a9e('0x3a')](_0x4e46b2[_0x0a9e('0x35')]['fields']));_0x18ad56[_0x0a9e('0x38')]=_0x18ad56['attributes'][_0x0a9e('0x49')]?_0x18ad56[_0x0a9e('0x38')]:_0x4566b0[_0x0a9e('0x34')];if(!_0x4e46b2[_0x0a9e('0x35')][_0x0a9e('0x3b')](_0x0a9e('0x6c'))){_0x18ad56[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x4e46b2['query'][_0x0a9e('0x20')]);_0x18ad56[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x4e46b2[_0x0a9e('0x35')][_0x0a9e('0x1f')]);}_0x18ad56[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x4e46b2[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x18ad56[_0x0a9e('0x40')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x3e')](_0x4e46b2[_0x0a9e('0x35')],_0x4566b0['filters']));_0x18ad56[_0x0a9e('0x6d')]=!![];if(_0x4e46b2[_0x0a9e('0x35')][_0x0a9e('0x3f')]){_0x18ad56[_0x0a9e('0x40')]=_[_0x0a9e('0x4a')](_0x18ad56['where'],{'$or':_[_0x0a9e('0x2f')](_0x18ad56[_0x0a9e('0x38')],function(_0x5ce99d){var _0x23b447={};_0x23b447[_0x5ce99d]={'$like':'%'+_0x4e46b2['query'][_0x0a9e('0x3f')]+'%'};return _0x23b447;})});}_0x18ad56=_[_0x0a9e('0x4a')]({},_0x18ad56,_0x4e46b2[_0x0a9e('0x42')]);return _0x5ea541[_0x0a9e('0x6e')](_0x18ad56);}})['then'](respondWithResult(_0xf0a802,null))[_0x0a9e('0x47')](handleError(_0xf0a802,null));};exports['getContactsCsv']=function(_0x2ec396,_0x3d0a77,_0x5e5b89){var _0x231c6a;return db[_0x0a9e('0x30')][_0x0a9e('0x4b')]({'where':{'id':_0x2ec396['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x0a9e('0x68')}]})[_0x0a9e('0x26')](handleEntityNotFound(_0x3d0a77,null))[_0x0a9e('0x26')](function(_0x413190){if(_0x413190){_0x231c6a=_0x413190;return db[_0x0a9e('0x5d')][_0x0a9e('0x31')];}})[_0x0a9e('0x26')](function(_0x3c75b9){if(_0x3c75b9){var _0x3f8124={};var _0x586510={};_0x586510[_0x0a9e('0x34')]=_['concat'](_[_0x0a9e('0x36')](_0x3c75b9),_[_0x0a9e('0x2f')](_0x231c6a[_0x0a9e('0x68')],function(_0x28ce92){return util[_0x0a9e('0x6a')]('cf_%d',_0x28ce92['id']);}));_0x586510[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x2ec396[_0x0a9e('0x35')]);_0x586510[_0x0a9e('0x37')]=_[_0x0a9e('0x39')](_0x586510['model'],_0x586510['query']);_0x3f8124[_0x0a9e('0x38')]=_['intersection'](_0x586510[_0x0a9e('0x34')],qs[_0x0a9e('0x3a')](_0x2ec396[_0x0a9e('0x35')][_0x0a9e('0x3a')]));_0x3f8124[_0x0a9e('0x38')]=_0x3f8124[_0x0a9e('0x38')]['length']?_0x3f8124['attributes']:_0x586510[_0x0a9e('0x34')];if(!_0x2ec396['query'][_0x0a9e('0x3b')]('nolimit')){_0x3f8124[_0x0a9e('0x20')]=qs['limit'](_0x2ec396['query'][_0x0a9e('0x20')]);_0x3f8124[_0x0a9e('0x1f')]=qs['offset'](_0x2ec396[_0x0a9e('0x35')][_0x0a9e('0x1f')]);}_0x3f8124[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2ec396[_0x0a9e('0x35')]['sort']);_0x3f8124['where']=qs[_0x0a9e('0x37')](_[_0x0a9e('0x3e')](_0x2ec396[_0x0a9e('0x35')],_0x586510[_0x0a9e('0x37')]));_0x3f8124[_0x0a9e('0x6d')]=!![];if(_0x2ec396['query'][_0x0a9e('0x3f')]){_0x3f8124[_0x0a9e('0x40')]=_['merge'](_0x3f8124[_0x0a9e('0x40')],{'$or':_[_0x0a9e('0x2f')](_0x3f8124[_0x0a9e('0x38')],function(_0x2427d5){var _0x23b25b={};_0x23b25b[_0x2427d5]={'$like':'%'+_0x2ec396[_0x0a9e('0x35')][_0x0a9e('0x3f')]+'%'};return _0x23b25b;})});}_0x3f8124=_[_0x0a9e('0x4a')]({},_0x3f8124,_0x2ec396[_0x0a9e('0x42')]);return _0x231c6a[_0x0a9e('0x6e')](_0x3f8124);}})['then'](function(_0x1065a7){if(!_[_0x0a9e('0x6f')](_0x1065a7)){var _0x2ada60=toCsv(_0x1065a7);var _0x1c4232=Date[_0x0a9e('0x70')]();fs['writeFileSync'](util['format'](_0x0a9e('0x71'),_0x231c6a['id'],_0x1c4232),_0x2ada60);_0x3d0a77[_0x0a9e('0x72')](_0x0a9e('0x73'),_0x0a9e('0x74')+util[_0x0a9e('0x6a')]('list_%d_%s.csv',_0x231c6a['id'],_0x1c4232));_0x3d0a77[_0x0a9e('0x72')](_0x0a9e('0x75'),_0x0a9e('0x76'));return _0x3d0a77['download'](util[_0x0a9e('0x6a')]('/tmp/list_%d_%s.csv',_0x231c6a['id'],_0x1c4232));}else{return _0x3d0a77[_0x0a9e('0x1a')](0xcc);}})['catch'](handleError(_0x3d0a77,null));};exports[_0x0a9e('0x77')]=function(_0x42b833,_0xe339b1,_0x5c500c){var _0xc9529d;delete _0x42b833['body']['id'];return db[_0x0a9e('0x30')][_0x0a9e('0x58')]({'where':{'id':_0x42b833[_0x0a9e('0x54')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0xe339b1,null))[_0x0a9e('0x26')](function(_0x1bee04){if(_0x1bee04){return db[_0x0a9e('0x78')][_0x0a9e('0x79')](function(_0x2aaf07){return db[_0x0a9e('0x67')][_0x0a9e('0x4c')](_0x42b833[_0x0a9e('0x4d')],{'transaction':_0x2aaf07})[_0x0a9e('0x26')](function(_0x399def){_0xc9529d=_0x399def;return _0x1bee04[_0x0a9e('0x7a')](_0x399def,{'transaction':_0x2aaf07});})[_0x0a9e('0x26')](function(){var _0x5b93dd={'type':db['Sequelize'][_0x0a9e('0x7b')],'transaction':_0x2aaf07};switch(_0x42b833['body'][_0x0a9e('0x33')]){case _0x0a9e('0x7c'):_0x5b93dd['type']=db[_0x0a9e('0x7d')][_0x0a9e('0x7b')];break;case _0x0a9e('0x7e'):_0x5b93dd[_0x0a9e('0x33')]=db['Sequelize'][_0x0a9e('0x7f')];break;case _0x0a9e('0x80'):_0x5b93dd[_0x0a9e('0x33')]=db[_0x0a9e('0x7d')]['BOOLEAN'];_0x5b93dd[_0x0a9e('0x81')]=![];break;default:}return db[_0x0a9e('0x78')][_0x0a9e('0x82')]['addColumn'](_0x0a9e('0x83'),util[_0x0a9e('0x6a')](_0x0a9e('0x84'),_0xc9529d['id']),_0x5b93dd);})['then'](function(){return _0xc9529d;});});}})[_0x0a9e('0x26')](respondWithResult(_0xe339b1,null))[_0x0a9e('0x47')](handleError(_0xe339b1,null));};exports[_0x0a9e('0x85')]=function(_0x1a7f58,_0x2394d3,_0x555780){var _0x3211d2={};var _0x289e65={};var _0x4795ae;var _0x3bab3e;return db[_0x0a9e('0x30')][_0x0a9e('0x58')]({'where':{'id':_0x1a7f58['params']['id']}})['then'](handleEntityNotFound(_0x2394d3,null))['then'](function(_0x1015aa){if(_0x1015aa){_0x4795ae=_0x1015aa;_0x289e65[_0x0a9e('0x34')]=_['keys'](db[_0x0a9e('0x67')][_0x0a9e('0x31')]);_0x289e65[_0x0a9e('0x35')]=_['keys'](_0x1a7f58[_0x0a9e('0x35')]);_0x289e65[_0x0a9e('0x37')]=_[_0x0a9e('0x39')](_0x289e65[_0x0a9e('0x34')],_0x289e65[_0x0a9e('0x35')]);_0x3211d2[_0x0a9e('0x38')]=_[_0x0a9e('0x39')](_0x289e65[_0x0a9e('0x34')],qs[_0x0a9e('0x3a')](_0x1a7f58['query'][_0x0a9e('0x3a')]));_0x3211d2['attributes']=_0x3211d2[_0x0a9e('0x38')][_0x0a9e('0x49')]?_0x3211d2[_0x0a9e('0x38')]:_0x289e65[_0x0a9e('0x34')];_0x3211d2[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x1a7f58['query'][_0x0a9e('0x3d')]);_0x3211d2[_0x0a9e('0x40')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x3e')](_0x1a7f58['query'],_0x289e65[_0x0a9e('0x37')]));_0x3211d2[_0x0a9e('0x40')]=_[_0x0a9e('0x4a')](_0x3211d2[_0x0a9e('0x40')],{'$or':[{'ListId':_0x1015aa['id']},{'ListId':null}]});if(_0x1a7f58[_0x0a9e('0x35')][_0x0a9e('0x3f')]){_0x3211d2[_0x0a9e('0x40')]=_[_0x0a9e('0x4a')](_0x3211d2[_0x0a9e('0x40')],{'$or':_[_0x0a9e('0x2f')](_0x3211d2['attributes'],function(_0x2272bc){var _0x88b25f={};_0x88b25f[_0x2272bc]={'$like':'%'+_0x1a7f58[_0x0a9e('0x35')][_0x0a9e('0x3f')]+'%'};return _0x88b25f;})});}_0x3211d2=_[_0x0a9e('0x4a')]({},_0x3211d2,_0x1a7f58[_0x0a9e('0x42')]);return db[_0x0a9e('0x67')][_0x0a9e('0x86')](_0x3211d2);}})['then'](respondWithResult(_0x2394d3,null))[_0x0a9e('0x47')](handleError(_0x2394d3,null));};exports[_0x0a9e('0x87')]=function(_0x1a9ef1,_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x30')][_0x0a9e('0x4b')]({'where':{'id':_0x1a9ef1[_0x0a9e('0x54')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x5c65fc,null))[_0x0a9e('0x26')](function(_0x424f1b){if(_0x424f1b){return _0x424f1b[_0x0a9e('0x87')](_0x1a9ef1[_0x0a9e('0x4d')][_0x0a9e('0x5b')],_['omit'](_0x1a9ef1[_0x0a9e('0x4d')],[_0x0a9e('0x5b'),'id'])||{})[_0x0a9e('0x88')](function(_0x3db98f){for(var _0x2b624e=0x0;_0x2b624e<_0x1a9ef1[_0x0a9e('0x4d')]['ids'][_0x0a9e('0x49')];_0x2b624e+=0x1){socket['emit']('userCmList:save',{'UserId':_0x1a9ef1['body'][_0x0a9e('0x5b')][_0x2b624e],'CmListId':_0x1a9ef1[_0x0a9e('0x54')]['id']});}return _0x3db98f;});}})[_0x0a9e('0x26')](respondWithResult(_0x5c65fc,null))[_0x0a9e('0x47')](handleError(_0x5c65fc,null));};exports['removeAgents']=function(_0x4156a5,_0x309fa9,_0x3ddbc7){return db[_0x0a9e('0x30')][_0x0a9e('0x4b')]({'where':{'id':_0x4156a5['params']['id']}})['then'](handleEntityNotFound(_0x309fa9,null))[_0x0a9e('0x26')](function(_0x33bcb2){if(_0x33bcb2){return _0x33bcb2[_0x0a9e('0x89')](_0x4156a5['query'][_0x0a9e('0x5b')])[_0x0a9e('0x26')](function(){if(_[_0x0a9e('0x5f')](_0x4156a5['query'][_0x0a9e('0x5b')])){for(var _0x2bf85d=0x0;_0x2bf85d<_0x4156a5[_0x0a9e('0x35')]['ids'][_0x0a9e('0x49')];_0x2bf85d+=0x1){socket[_0x0a9e('0x8a')](_0x0a9e('0x8b'),{'UserId':Number(_0x4156a5['query']['ids'][_0x2bf85d]),'CmListId':Number(_0x4156a5['params']['id'])});}}else{socket[_0x0a9e('0x8a')](_0x0a9e('0x8b'),{'UserId':Number(_0x4156a5[_0x0a9e('0x35')][_0x0a9e('0x5b')]),'CmListId':Number(_0x4156a5['params']['id'])});}});}})[_0x0a9e('0x26')](respondWithStatusCode(_0x309fa9,null))['catch'](handleError(_0x309fa9,null));};exports[_0x0a9e('0x8c')]=function(_0x2ff2ab,_0x242f23,_0x57f673){var _0x33b4b3={};var _0x33a26c={};var _0xb8a476;var _0x580dd6;return db[_0x0a9e('0x30')]['findOne']({'where':{'id':_0x2ff2ab[_0x0a9e('0x54')]['id']}})['then'](handleEntityNotFound(_0x242f23,null))[_0x0a9e('0x26')](function(_0x57b7d4){if(_0x57b7d4){_0xb8a476=_0x57b7d4;_0x33a26c[_0x0a9e('0x34')]=_[_0x0a9e('0x36')](db[_0x0a9e('0x8d')][_0x0a9e('0x31')]);_0x33a26c[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x2ff2ab[_0x0a9e('0x35')]);_0x33a26c['filters']=_[_0x0a9e('0x39')](_0x33a26c[_0x0a9e('0x34')],_0x33a26c['query']);_0x33b4b3[_0x0a9e('0x38')]=_[_0x0a9e('0x39')](_0x33a26c['model'],qs[_0x0a9e('0x3a')](_0x2ff2ab[_0x0a9e('0x35')][_0x0a9e('0x3a')]));_0x33b4b3['attributes']=_0x33b4b3[_0x0a9e('0x38')][_0x0a9e('0x49')]?_0x33b4b3[_0x0a9e('0x38')]:_0x33a26c[_0x0a9e('0x34')];_0x33b4b3[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2ff2ab[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x33b4b3[_0x0a9e('0x40')]=qs[_0x0a9e('0x37')](_['pick'](_0x2ff2ab[_0x0a9e('0x35')],_0x33a26c['filters']));if(_0x2ff2ab[_0x0a9e('0x35')][_0x0a9e('0x3f')]){_0x33b4b3[_0x0a9e('0x40')]=_[_0x0a9e('0x4a')](_0x33b4b3[_0x0a9e('0x40')],{'$or':_[_0x0a9e('0x2f')](_0x33b4b3['attributes'],function(_0x119708){var _0x469035={};_0x469035[_0x119708]={'$like':'%'+_0x2ff2ab[_0x0a9e('0x35')]['filter']+'%'};return _0x469035;})});}_0x33b4b3=_[_0x0a9e('0x4a')]({},_0x33b4b3,_0x2ff2ab[_0x0a9e('0x42')]);return _0xb8a476[_0x0a9e('0x8c')](_0x33b4b3);}})[_0x0a9e('0x26')](function(_0x31e1e0){if(_0x31e1e0){_0x580dd6=_0x31e1e0[_0x0a9e('0x49')];if(!_0x2ff2ab[_0x0a9e('0x35')]['hasOwnProperty'](_0x0a9e('0x6c'))){_0x33b4b3[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x2ff2ab[_0x0a9e('0x35')][_0x0a9e('0x20')]);_0x33b4b3[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x2ff2ab['query']['offset']);}return _0xb8a476[_0x0a9e('0x8c')](_0x33b4b3);}})[_0x0a9e('0x26')](function(_0x1f4929){if(_0x1f4929){return _0x1f4929?{'count':_0x580dd6,'rows':_0x1f4929}:null;}})[_0x0a9e('0x26')](respondWithResult(_0x242f23,null))[_0x0a9e('0x47')](handleError(_0x242f23,null));}; \ No newline at end of file +var _0xa9e0=['addAgents','spread','removeAgents','emit','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','findOne','Disposition','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','errors','message','CmCustomField','CustomFields','concat','format','cf_%d','nolimit','raw','getContacts','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','TEXT','text','Sequelize','number','INTEGER','switch','defaultValue','queryInterface','cm_contacts','cf_%s','getCustomFields','findAndCountAll'];(function(_0x2c6053,_0x1a5641){var _0x5a7823=function(_0x50ea01){while(--_0x50ea01){_0x2c6053['push'](_0x2c6053['shift']());}};_0x5a7823(++_0x1a5641);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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'];config[_0x0a9e('0x14')]=_[_0x0a9e('0x15')](config[_0x0a9e('0x14')],{'host':_0x0a9e('0x16'),'port':0x18eb});var socket=require(_0x0a9e('0x17'))(new Redis(config['redis']));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x2b4227,_0x281129){_0x281129=_0x281129||0xcc;return function(_0x44dcfd){if(_0x44dcfd){return _0x2b4227[_0x0a9e('0x1a')](_0x281129);}return _0x2b4227['status'](_0x281129)[_0x0a9e('0x1b')]();};}function respondWithResult(_0x5d0880,_0x1985b6){_0x1985b6=_0x1985b6||0xc8;return function(_0x519dfd){if(_0x519dfd){return _0x5d0880[_0x0a9e('0x1c')](_0x1985b6)[_0x0a9e('0x1d')](_0x519dfd);}};}function respondWithFilteredResult(_0x48f32d,_0x225616){return function(_0x5a0a06){if(_0x5a0a06){var _0x459eb1=_0x5a0a06[_0x0a9e('0x1e')],_0x478723=_0x225616[_0x0a9e('0x1f')],_0x106033=_0x225616[_0x0a9e('0x1f')]+_0x225616[_0x0a9e('0x20')],_0x205fd6;if(_0x106033>=_0x459eb1){_0x106033=_0x459eb1;_0x205fd6=0xc8;}else{_0x205fd6=0xce;}_0x48f32d[_0x0a9e('0x1c')](_0x205fd6);return _0x48f32d[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x478723+'-'+_0x106033+'/'+_0x459eb1)[_0x0a9e('0x1d')](_0x5a0a06);}return null;};}function patchUpdates(_0x4bb1e3){return function(_0x2c3407){try{jsonpatch[_0x0a9e('0x23')](_0x2c3407,_0x4bb1e3,!![]);}catch(_0x53682f){return BPromise[_0x0a9e('0x24')](_0x53682f);}return _0x2c3407['save']();};}function saveUpdates(_0x588269,_0x3a02e1){return function(_0x432e56){if(_0x432e56){return _0x432e56[_0x0a9e('0x25')](_0x588269)[_0x0a9e('0x26')](function(_0x4abc77){return _0x4abc77;});}return null;};}function removeEntity(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(_0x3b45bc){return _0x3b45bc[_0x0a9e('0x27')]()[_0x0a9e('0x26')](function(){var _0x42ac8f=_0x3b45bc[_0x0a9e('0x28')]({'plain':!![]});var _0x5ea472='Lists';return db[_0x0a9e('0x29')][_0x0a9e('0x27')]({'where':{'type':_0x5ea472,'resourceId':_0x42ac8f['id']}})[_0x0a9e('0x26')](function(){return _0x3b45bc;});})[_0x0a9e('0x26')](function(){_0xfb6e48['status'](0xcc)[_0x0a9e('0x1b')]();});}};}function handleEntityNotFound(_0x479bc4,_0x45a1e7){return function(_0x5bfb33){if(!_0x5bfb33){_0x479bc4[_0x0a9e('0x1a')](0x194);}return _0x5bfb33;};}function handleError(_0x34dc65,_0x25fba9){_0x25fba9=_0x25fba9||0x1f4;return function(_0x14433c){logger[_0x0a9e('0x2a')](_0x14433c[_0x0a9e('0x2b')]);if(_0x14433c[_0x0a9e('0x2c')]){delete _0x14433c[_0x0a9e('0x2c')];}_0x34dc65['status'](_0x25fba9)[_0x0a9e('0x2d')](_0x14433c);};}exports[_0x0a9e('0x2e')]=function(_0x2b1f27,_0x2ec755){var _0x5c877d={},_0x15b200={},_0x40e7a3={'count':0x0,'rows':[]};var _0x1843b2=_[_0x0a9e('0x2f')](db[_0x0a9e('0x30')][_0x0a9e('0x31')],function(_0x296f41){return{'name':_0x296f41[_0x0a9e('0x32')],'type':_0x296f41[_0x0a9e('0x33')]['key']};});_0x15b200[_0x0a9e('0x34')]=_['map'](_0x1843b2,_0x0a9e('0x2c'));_0x15b200[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x2b1f27[_0x0a9e('0x35')]);_0x15b200[_0x0a9e('0x37')]=_['intersection'](_0x15b200[_0x0a9e('0x34')],_0x15b200[_0x0a9e('0x35')]);_0x5c877d[_0x0a9e('0x38')]=_[_0x0a9e('0x39')](_0x15b200[_0x0a9e('0x34')],qs[_0x0a9e('0x3a')](_0x2b1f27[_0x0a9e('0x35')][_0x0a9e('0x3a')]));_0x5c877d['attributes']=_0x5c877d[_0x0a9e('0x38')]['length']?_0x5c877d[_0x0a9e('0x38')]:_0x15b200[_0x0a9e('0x34')];if(!_0x2b1f27[_0x0a9e('0x35')][_0x0a9e('0x3b')]('nolimit')){_0x5c877d[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x2b1f27[_0x0a9e('0x35')][_0x0a9e('0x20')]);_0x5c877d['offset']=qs['offset'](_0x2b1f27[_0x0a9e('0x35')]['offset']);}_0x5c877d[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2b1f27[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x5c877d['where']=qs[_0x0a9e('0x37')](_[_0x0a9e('0x3e')](_0x2b1f27[_0x0a9e('0x35')],_0x15b200['filters']));if(_0x2b1f27[_0x0a9e('0x35')][_0x0a9e('0x3f')]){_0x5c877d[_0x0a9e('0x40')]=_['merge'](_0x5c877d['where'],{'$or':_[_0x0a9e('0x2f')](_0x1843b2,function(_0x40d766){if(_0x40d766['type']!==_0x0a9e('0x41')){var _0x419125={};_0x419125[_0x40d766[_0x0a9e('0x2c')]]={'$like':'%'+_0x2b1f27[_0x0a9e('0x35')]['filter']+'%'};return _0x419125;}})});}_0x5c877d=_['merge']({},_0x5c877d,_0x2b1f27[_0x0a9e('0x42')]);var _0x45b3d0={'where':_0x5c877d['where']};return db[_0x0a9e('0x30')][_0x0a9e('0x1e')](_0x45b3d0)[_0x0a9e('0x26')](function(_0x5b4f5e){_0x40e7a3[_0x0a9e('0x1e')]=_0x5b4f5e;if(_0x2b1f27[_0x0a9e('0x35')][_0x0a9e('0x43')]){_0x5c877d[_0x0a9e('0x44')]=[{'all':!![]}];}return db[_0x0a9e('0x30')][_0x0a9e('0x45')](_0x5c877d);})[_0x0a9e('0x26')](function(_0x45a9b8){_0x40e7a3[_0x0a9e('0x46')]=_0x45a9b8;return _0x40e7a3;})[_0x0a9e('0x26')](respondWithFilteredResult(_0x2ec755,_0x5c877d))[_0x0a9e('0x47')](handleError(_0x2ec755,null));};exports[_0x0a9e('0x48')]=function(_0x1a7bce,_0x11ca30){var _0x37f6cc={'raw':![],'where':{'id':_0x1a7bce['params']['id']}},_0x4d04c8={};_0x4d04c8[_0x0a9e('0x34')]=_[_0x0a9e('0x36')](db[_0x0a9e('0x30')][_0x0a9e('0x31')]);_0x4d04c8[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x1a7bce[_0x0a9e('0x35')]);_0x4d04c8[_0x0a9e('0x37')]=_[_0x0a9e('0x39')](_0x4d04c8[_0x0a9e('0x34')],_0x4d04c8[_0x0a9e('0x35')]);_0x37f6cc[_0x0a9e('0x38')]=_['intersection'](_0x4d04c8[_0x0a9e('0x34')],qs[_0x0a9e('0x3a')](_0x1a7bce[_0x0a9e('0x35')][_0x0a9e('0x3a')]));_0x37f6cc[_0x0a9e('0x38')]=_0x37f6cc[_0x0a9e('0x38')][_0x0a9e('0x49')]?_0x37f6cc[_0x0a9e('0x38')]:_0x4d04c8['model'];if(_0x1a7bce[_0x0a9e('0x35')]['includeAll']){_0x37f6cc[_0x0a9e('0x44')]=[{'all':!![]}];}_0x37f6cc=_[_0x0a9e('0x4a')]({},_0x37f6cc,_0x1a7bce[_0x0a9e('0x42')]);return db['CmList'][_0x0a9e('0x4b')](_0x37f6cc)[_0x0a9e('0x26')](handleEntityNotFound(_0x11ca30,null))[_0x0a9e('0x26')](respondWithResult(_0x11ca30,null))[_0x0a9e('0x47')](handleError(_0x11ca30,null));};exports[_0x0a9e('0x4c')]=function(_0x37be73,_0x45bf7f){return db['CmList'][_0x0a9e('0x4c')](_0x37be73[_0x0a9e('0x4d')],{})[_0x0a9e('0x26')](function(_0x16f976){var _0x409789=_0x37be73[_0x0a9e('0x4e')][_0x0a9e('0x28')]({'plain':!![]});if(!_0x409789)throw new Error(_0x0a9e('0x4f'));if(_0x409789[_0x0a9e('0x50')]==='user'){var _0xe401a=_0x16f976[_0x0a9e('0x28')]({'plain':!![]});var _0x4f7240='Lists';return db['UserProfileSection'][_0x0a9e('0x4b')]({'where':{'name':_0x4f7240,'userProfileId':_0x409789[_0x0a9e('0x51')]},'raw':!![]})[_0x0a9e('0x26')](function(_0x11545a){if(_0x11545a&&_0x11545a[_0x0a9e('0x52')]===0x0){return db[_0x0a9e('0x29')][_0x0a9e('0x4c')]({'name':_0xe401a[_0x0a9e('0x2c')],'resourceId':_0xe401a['id'],'type':_0x11545a['name'],'sectionId':_0x11545a['id']},{})['then'](function(){return _0x16f976;});}else{return _0x16f976;}})['catch'](function(_0x39d77d){logger[_0x0a9e('0x2a')](_0x0a9e('0x53'),_0x39d77d);throw _0x39d77d;});}return _0x16f976;})['then'](respondWithResult(_0x45bf7f,0xc9))[_0x0a9e('0x47')](handleError(_0x45bf7f,null));};exports[_0x0a9e('0x25')]=function(_0x53d113,_0x5a88da){if(_0x53d113[_0x0a9e('0x4d')]['id']){delete _0x53d113['body']['id'];}return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x53d113[_0x0a9e('0x54')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x5a88da,null))[_0x0a9e('0x26')](saveUpdates(_0x53d113['body'],null))[_0x0a9e('0x26')](respondWithResult(_0x5a88da,null))[_0x0a9e('0x47')](handleError(_0x5a88da,null));};exports['destroy']=function(_0x50f687,_0x128aa6){return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x50f687[_0x0a9e('0x54')]['id']}})['then'](handleEntityNotFound(_0x128aa6,null))[_0x0a9e('0x26')](removeEntity(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x55')]=function(_0x4a6deb,_0x5da27d){return db['CmList'][_0x0a9e('0x55')]()['then'](respondWithResult(_0x5da27d,null))[_0x0a9e('0x47')](handleError(_0x5da27d,null));};exports[_0x0a9e('0x56')]=function(_0x3cfd00,_0x19b4df,_0x232830){if(_0x3cfd00[_0x0a9e('0x4d')]['id']){delete _0x3cfd00[_0x0a9e('0x4d')]['id'];}return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x3cfd00[_0x0a9e('0x54')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x19b4df,null))[_0x0a9e('0x26')](function(_0x30c491){if(_0x30c491){_0x3cfd00[_0x0a9e('0x4d')][_0x0a9e('0x57')]=_0x30c491['id'];return db['Disposition'][_0x0a9e('0x4c')](_0x3cfd00[_0x0a9e('0x4d')]);}})['then'](respondWithResult(_0x19b4df,null))[_0x0a9e('0x47')](handleError(_0x19b4df,null));};exports['getDispositions']=function(_0x20c668,_0x5ba1f9,_0x4b3c1a){var _0x5674ee={'raw':![],'where':{}};var _0x273cb5={};var _0x49d231={'count':0x0,'rows':[]};return db[_0x0a9e('0x30')][_0x0a9e('0x58')]({'where':{'id':_0x20c668[_0x0a9e('0x54')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x5ba1f9,null))[_0x0a9e('0x26')](function(_0x26d7db){if(_0x26d7db){_0x273cb5['model']=_[_0x0a9e('0x36')](db['Disposition'][_0x0a9e('0x31')]);_0x273cb5[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x20c668['query']);_0x273cb5[_0x0a9e('0x37')]=_[_0x0a9e('0x39')](_0x273cb5[_0x0a9e('0x34')],_0x273cb5[_0x0a9e('0x35')]);_0x5674ee['attributes']=_[_0x0a9e('0x39')](_0x273cb5[_0x0a9e('0x34')],qs['fields'](_0x20c668[_0x0a9e('0x35')][_0x0a9e('0x3a')]));_0x5674ee[_0x0a9e('0x38')]=_0x5674ee[_0x0a9e('0x38')][_0x0a9e('0x49')]?_0x5674ee['attributes']:_0x273cb5[_0x0a9e('0x34')];if(!_0x20c668[_0x0a9e('0x35')][_0x0a9e('0x3b')]('nolimit')){_0x5674ee[_0x0a9e('0x20')]=qs['limit'](_0x20c668['query'][_0x0a9e('0x20')]);_0x5674ee[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x20c668[_0x0a9e('0x35')][_0x0a9e('0x1f')]);}_0x5674ee[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x20c668[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x5674ee[_0x0a9e('0x40')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x3e')](_0x20c668[_0x0a9e('0x35')],_0x273cb5[_0x0a9e('0x37')]));_0x5674ee[_0x0a9e('0x40')][_0x0a9e('0x57')]=_0x26d7db['id'];if(_0x20c668[_0x0a9e('0x35')][_0x0a9e('0x3f')]){_0x5674ee['where']=_[_0x0a9e('0x4a')](_0x5674ee[_0x0a9e('0x40')],{'$or':_[_0x0a9e('0x2f')](_0x5674ee['attributes'],function(_0x1148a1){var _0x30944e={};_0x30944e[_0x1148a1]={'$like':'%'+_0x20c668['query'][_0x0a9e('0x3f')]+'%'};return _0x30944e;})});}_0x5674ee=_[_0x0a9e('0x4a')]({},_0x5674ee,_0x20c668[_0x0a9e('0x42')]);return db[_0x0a9e('0x59')][_0x0a9e('0x1e')]({'where':_0x5674ee['where']})['then'](function(_0x4a2438){_0x49d231[_0x0a9e('0x1e')]=_0x4a2438;if(_0x20c668[_0x0a9e('0x35')][_0x0a9e('0x43')]){_0x5674ee[_0x0a9e('0x44')]=[{'all':!![]}];}return db[_0x0a9e('0x59')][_0x0a9e('0x45')](_0x5674ee);})[_0x0a9e('0x26')](function(_0x1a0677){_0x49d231['rows']=_0x1a0677;return _0x49d231;});}})[_0x0a9e('0x26')](respondWithFilteredResult(_0x5ba1f9,_0x5674ee))[_0x0a9e('0x47')](handleError(_0x5ba1f9,null));};exports[_0x0a9e('0x5a')]=function(_0x4a4fc7,_0x2bdc44,_0x583b2e){return db[_0x0a9e('0x30')][_0x0a9e('0x4b')]({'where':{'id':_0x4a4fc7['params']['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x2bdc44,null))[_0x0a9e('0x26')](function(_0x2cc7a7){if(_0x2cc7a7){return _0x2cc7a7[_0x0a9e('0x5a')](_0x4a4fc7['query'][_0x0a9e('0x5b')]);}})[_0x0a9e('0x26')](respondWithStatusCode(_0x2bdc44,null))[_0x0a9e('0x47')](handleError(_0x2bdc44,null));};exports[_0x0a9e('0x5c')]=function(_0x5b7fc3,_0x109ccb,_0x3d91db){return db[_0x0a9e('0x30')][_0x0a9e('0x4b')]({'where':{'id':_0x5b7fc3['params']['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x109ccb,null))[_0x0a9e('0x26')](function(_0x30a4c7){if(_0x30a4c7){var _0xf410e5=[];var _0x332367={'success':[],'errors':[]};return db[_0x0a9e('0x5d')][_0x0a9e('0x55')]()[_0x0a9e('0x26')](function(_0x1a7b03){if(_0x5b7fc3[_0x0a9e('0x4d')][_0x0a9e('0x5e')]&&_[_0x0a9e('0x5f')](_0x5b7fc3[_0x0a9e('0x4d')][_0x0a9e('0x5e')])){if(_0x5b7fc3['body'][_0x0a9e('0x5e')][_0x0a9e('0x49')]){_0x5b7fc3[_0x0a9e('0x4d')]['tags']=_0x5b7fc3[_0x0a9e('0x4d')][_0x0a9e('0x5e')][_0x0a9e('0x60')](';')+';';}else{_0x5b7fc3[_0x0a9e('0x4d')]['tags']=null;}}else{_0x5b7fc3['body'][_0x0a9e('0x5e')]=null;}if(_0x5b7fc3[_0x0a9e('0x4d')]&&_['isArray'](_0x5b7fc3[_0x0a9e('0x4d')])){for(var _0x53a6a1=0x0;_0x53a6a1<_0x5b7fc3[_0x0a9e('0x4d')][_0x0a9e('0x49')];_0x53a6a1+=0x1){_0x5b7fc3['body'][_0x53a6a1][_0x0a9e('0x57')]=_0x5b7fc3[_0x0a9e('0x54')]['id'];_0xf410e5[_0x0a9e('0x61')](_0x5b7fc3[_0x0a9e('0x4d')][_0x53a6a1]);}return BPromise[_0x0a9e('0x62')](_0xf410e5,function(_0x1f42a0){return db[_0x0a9e('0x5d')]['create'](_[_0x0a9e('0x63')](_0x1f42a0,[_0x0a9e('0x5b'),'id'])||{},{'fields':_[_0x0a9e('0x36')](_0x1a7b03),'raw':!![]})[_0x0a9e('0x26')](function(_0x492543){_0x332367[_0x0a9e('0x64')][_0x0a9e('0x61')](_0x492543['dataValues']);})[_0x0a9e('0x47')](function(_0x5b7940){_0x332367[_0x0a9e('0x65')][_0x0a9e('0x61')]({'data':_0x1f42a0,'error':_0x5b7940[_0x0a9e('0x66')]});});})[_0x0a9e('0x26')](function(_0x5af453){return _0x332367;})['catch'](function(_0x353384){return _0x353384;});}else{_0x109ccb[_0x0a9e('0x1c')](0x190)[_0x0a9e('0x1d')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x0a9e('0x26')](respondWithResult(_0x109ccb,null))[_0x0a9e('0x47')](handleError(_0x109ccb,null));};exports['getContacts']=function(_0x4e46b2,_0xf0a802,_0x56acca){var _0x5ea541;return db['CmList'][_0x0a9e('0x4b')]({'where':{'id':_0x4e46b2[_0x0a9e('0x54')]['id']},'include':[{'model':db[_0x0a9e('0x67')],'as':_0x0a9e('0x68')}]})[_0x0a9e('0x26')](handleEntityNotFound(_0xf0a802,null))[_0x0a9e('0x26')](function(_0x5a8854){if(_0x5a8854){_0x5ea541=_0x5a8854;return db[_0x0a9e('0x5d')]['rawAttributes'];}})[_0x0a9e('0x26')](function(_0x2aabab){if(_0x2aabab){var _0x18ad56={};var _0x4566b0={};_0x4566b0['model']=_[_0x0a9e('0x69')](_[_0x0a9e('0x36')](_0x2aabab),_[_0x0a9e('0x2f')](_0x5ea541['CustomFields'],function(_0xb6e411){return util[_0x0a9e('0x6a')](_0x0a9e('0x6b'),_0xb6e411['id']);}));_0x4566b0[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x4e46b2[_0x0a9e('0x35')]);_0x4566b0[_0x0a9e('0x37')]=_[_0x0a9e('0x39')](_0x4566b0['model'],_0x4566b0[_0x0a9e('0x35')]);_0x18ad56[_0x0a9e('0x38')]=_['intersection'](_0x4566b0[_0x0a9e('0x34')],qs[_0x0a9e('0x3a')](_0x4e46b2[_0x0a9e('0x35')]['fields']));_0x18ad56[_0x0a9e('0x38')]=_0x18ad56['attributes'][_0x0a9e('0x49')]?_0x18ad56[_0x0a9e('0x38')]:_0x4566b0[_0x0a9e('0x34')];if(!_0x4e46b2[_0x0a9e('0x35')][_0x0a9e('0x3b')](_0x0a9e('0x6c'))){_0x18ad56[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x4e46b2['query'][_0x0a9e('0x20')]);_0x18ad56[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x4e46b2[_0x0a9e('0x35')][_0x0a9e('0x1f')]);}_0x18ad56[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x4e46b2[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x18ad56[_0x0a9e('0x40')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x3e')](_0x4e46b2[_0x0a9e('0x35')],_0x4566b0['filters']));_0x18ad56[_0x0a9e('0x6d')]=!![];if(_0x4e46b2[_0x0a9e('0x35')][_0x0a9e('0x3f')]){_0x18ad56[_0x0a9e('0x40')]=_[_0x0a9e('0x4a')](_0x18ad56['where'],{'$or':_[_0x0a9e('0x2f')](_0x18ad56[_0x0a9e('0x38')],function(_0x5ce99d){var _0x23b447={};_0x23b447[_0x5ce99d]={'$like':'%'+_0x4e46b2['query'][_0x0a9e('0x3f')]+'%'};return _0x23b447;})});}_0x18ad56=_[_0x0a9e('0x4a')]({},_0x18ad56,_0x4e46b2[_0x0a9e('0x42')]);return _0x5ea541[_0x0a9e('0x6e')](_0x18ad56);}})['then'](respondWithResult(_0xf0a802,null))[_0x0a9e('0x47')](handleError(_0xf0a802,null));};exports['getContactsCsv']=function(_0x2ec396,_0x3d0a77,_0x5e5b89){var _0x231c6a;return db[_0x0a9e('0x30')][_0x0a9e('0x4b')]({'where':{'id':_0x2ec396['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x0a9e('0x68')}]})[_0x0a9e('0x26')](handleEntityNotFound(_0x3d0a77,null))[_0x0a9e('0x26')](function(_0x413190){if(_0x413190){_0x231c6a=_0x413190;return db[_0x0a9e('0x5d')][_0x0a9e('0x31')];}})[_0x0a9e('0x26')](function(_0x3c75b9){if(_0x3c75b9){var _0x3f8124={};var _0x586510={};_0x586510[_0x0a9e('0x34')]=_['concat'](_[_0x0a9e('0x36')](_0x3c75b9),_[_0x0a9e('0x2f')](_0x231c6a[_0x0a9e('0x68')],function(_0x28ce92){return util[_0x0a9e('0x6a')]('cf_%d',_0x28ce92['id']);}));_0x586510[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x2ec396[_0x0a9e('0x35')]);_0x586510[_0x0a9e('0x37')]=_[_0x0a9e('0x39')](_0x586510['model'],_0x586510['query']);_0x3f8124[_0x0a9e('0x38')]=_['intersection'](_0x586510[_0x0a9e('0x34')],qs[_0x0a9e('0x3a')](_0x2ec396[_0x0a9e('0x35')][_0x0a9e('0x3a')]));_0x3f8124[_0x0a9e('0x38')]=_0x3f8124[_0x0a9e('0x38')]['length']?_0x3f8124['attributes']:_0x586510[_0x0a9e('0x34')];if(!_0x2ec396['query'][_0x0a9e('0x3b')]('nolimit')){_0x3f8124[_0x0a9e('0x20')]=qs['limit'](_0x2ec396['query'][_0x0a9e('0x20')]);_0x3f8124[_0x0a9e('0x1f')]=qs['offset'](_0x2ec396[_0x0a9e('0x35')][_0x0a9e('0x1f')]);}_0x3f8124[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2ec396[_0x0a9e('0x35')]['sort']);_0x3f8124['where']=qs[_0x0a9e('0x37')](_[_0x0a9e('0x3e')](_0x2ec396[_0x0a9e('0x35')],_0x586510[_0x0a9e('0x37')]));_0x3f8124[_0x0a9e('0x6d')]=!![];if(_0x2ec396['query'][_0x0a9e('0x3f')]){_0x3f8124[_0x0a9e('0x40')]=_['merge'](_0x3f8124[_0x0a9e('0x40')],{'$or':_[_0x0a9e('0x2f')](_0x3f8124[_0x0a9e('0x38')],function(_0x2427d5){var _0x23b25b={};_0x23b25b[_0x2427d5]={'$like':'%'+_0x2ec396[_0x0a9e('0x35')][_0x0a9e('0x3f')]+'%'};return _0x23b25b;})});}_0x3f8124=_[_0x0a9e('0x4a')]({},_0x3f8124,_0x2ec396[_0x0a9e('0x42')]);return _0x231c6a[_0x0a9e('0x6e')](_0x3f8124);}})['then'](function(_0x1065a7){if(!_[_0x0a9e('0x6f')](_0x1065a7)){var _0x2ada60=toCsv(_0x1065a7);var _0x1c4232=Date[_0x0a9e('0x70')]();fs['writeFileSync'](util['format'](_0x0a9e('0x71'),_0x231c6a['id'],_0x1c4232),_0x2ada60);_0x3d0a77[_0x0a9e('0x72')](_0x0a9e('0x73'),_0x0a9e('0x74')+util[_0x0a9e('0x6a')]('list_%d_%s.csv',_0x231c6a['id'],_0x1c4232));_0x3d0a77[_0x0a9e('0x72')](_0x0a9e('0x75'),_0x0a9e('0x76'));return _0x3d0a77['download'](util[_0x0a9e('0x6a')]('/tmp/list_%d_%s.csv',_0x231c6a['id'],_0x1c4232));}else{return _0x3d0a77[_0x0a9e('0x1a')](0xcc);}})['catch'](handleError(_0x3d0a77,null));};exports[_0x0a9e('0x77')]=function(_0x42b833,_0xe339b1,_0x5c500c){var _0xc9529d;delete _0x42b833['body']['id'];return db[_0x0a9e('0x30')][_0x0a9e('0x58')]({'where':{'id':_0x42b833[_0x0a9e('0x54')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0xe339b1,null))[_0x0a9e('0x26')](function(_0x1bee04){if(_0x1bee04){return db[_0x0a9e('0x78')][_0x0a9e('0x79')](function(_0x2aaf07){return db[_0x0a9e('0x67')][_0x0a9e('0x4c')](_0x42b833[_0x0a9e('0x4d')],{'transaction':_0x2aaf07})[_0x0a9e('0x26')](function(_0x399def){_0xc9529d=_0x399def;return _0x1bee04[_0x0a9e('0x7a')](_0x399def,{'transaction':_0x2aaf07});})[_0x0a9e('0x26')](function(){var _0x5b93dd={'type':db['Sequelize'][_0x0a9e('0x7b')],'transaction':_0x2aaf07};switch(_0x42b833['body'][_0x0a9e('0x33')]){case _0x0a9e('0x7c'):_0x5b93dd['type']=db[_0x0a9e('0x7d')][_0x0a9e('0x7b')];break;case _0x0a9e('0x7e'):_0x5b93dd[_0x0a9e('0x33')]=db['Sequelize'][_0x0a9e('0x7f')];break;case _0x0a9e('0x80'):_0x5b93dd[_0x0a9e('0x33')]=db[_0x0a9e('0x7d')]['BOOLEAN'];_0x5b93dd[_0x0a9e('0x81')]=![];break;default:}return db[_0x0a9e('0x78')][_0x0a9e('0x82')]['addColumn'](_0x0a9e('0x83'),util[_0x0a9e('0x6a')](_0x0a9e('0x84'),_0xc9529d['id']),_0x5b93dd);})['then'](function(){return _0xc9529d;});});}})[_0x0a9e('0x26')](respondWithResult(_0xe339b1,null))[_0x0a9e('0x47')](handleError(_0xe339b1,null));};exports[_0x0a9e('0x85')]=function(_0x1a7f58,_0x2394d3,_0x555780){var _0x3211d2={};var _0x289e65={};var _0x4795ae;var _0x3bab3e;return db[_0x0a9e('0x30')][_0x0a9e('0x58')]({'where':{'id':_0x1a7f58['params']['id']}})['then'](handleEntityNotFound(_0x2394d3,null))['then'](function(_0x1015aa){if(_0x1015aa){_0x4795ae=_0x1015aa;_0x289e65[_0x0a9e('0x34')]=_['keys'](db[_0x0a9e('0x67')][_0x0a9e('0x31')]);_0x289e65[_0x0a9e('0x35')]=_['keys'](_0x1a7f58[_0x0a9e('0x35')]);_0x289e65[_0x0a9e('0x37')]=_[_0x0a9e('0x39')](_0x289e65[_0x0a9e('0x34')],_0x289e65[_0x0a9e('0x35')]);_0x3211d2[_0x0a9e('0x38')]=_[_0x0a9e('0x39')](_0x289e65[_0x0a9e('0x34')],qs[_0x0a9e('0x3a')](_0x1a7f58['query'][_0x0a9e('0x3a')]));_0x3211d2['attributes']=_0x3211d2[_0x0a9e('0x38')][_0x0a9e('0x49')]?_0x3211d2[_0x0a9e('0x38')]:_0x289e65[_0x0a9e('0x34')];_0x3211d2[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x1a7f58['query'][_0x0a9e('0x3d')]);_0x3211d2[_0x0a9e('0x40')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x3e')](_0x1a7f58['query'],_0x289e65[_0x0a9e('0x37')]));_0x3211d2[_0x0a9e('0x40')]=_[_0x0a9e('0x4a')](_0x3211d2[_0x0a9e('0x40')],{'$or':[{'ListId':_0x1015aa['id']},{'ListId':null}]});if(_0x1a7f58[_0x0a9e('0x35')][_0x0a9e('0x3f')]){_0x3211d2[_0x0a9e('0x40')]=_[_0x0a9e('0x4a')](_0x3211d2[_0x0a9e('0x40')],{'$or':_[_0x0a9e('0x2f')](_0x3211d2['attributes'],function(_0x2272bc){var _0x88b25f={};_0x88b25f[_0x2272bc]={'$like':'%'+_0x1a7f58[_0x0a9e('0x35')][_0x0a9e('0x3f')]+'%'};return _0x88b25f;})});}_0x3211d2=_[_0x0a9e('0x4a')]({},_0x3211d2,_0x1a7f58[_0x0a9e('0x42')]);return db[_0x0a9e('0x67')][_0x0a9e('0x86')](_0x3211d2);}})['then'](respondWithResult(_0x2394d3,null))[_0x0a9e('0x47')](handleError(_0x2394d3,null));};exports[_0x0a9e('0x87')]=function(_0x1a9ef1,_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x30')][_0x0a9e('0x4b')]({'where':{'id':_0x1a9ef1[_0x0a9e('0x54')]['id']}})[_0x0a9e('0x26')](handleEntityNotFound(_0x5c65fc,null))[_0x0a9e('0x26')](function(_0x424f1b){if(_0x424f1b){return _0x424f1b[_0x0a9e('0x87')](_0x1a9ef1[_0x0a9e('0x4d')][_0x0a9e('0x5b')],_['omit'](_0x1a9ef1[_0x0a9e('0x4d')],[_0x0a9e('0x5b'),'id'])||{})[_0x0a9e('0x88')](function(_0x3db98f){for(var _0x2b624e=0x0;_0x2b624e<_0x1a9ef1[_0x0a9e('0x4d')]['ids'][_0x0a9e('0x49')];_0x2b624e+=0x1){socket['emit']('userCmList:save',{'UserId':_0x1a9ef1['body'][_0x0a9e('0x5b')][_0x2b624e],'CmListId':_0x1a9ef1[_0x0a9e('0x54')]['id']});}return _0x3db98f;});}})[_0x0a9e('0x26')](respondWithResult(_0x5c65fc,null))[_0x0a9e('0x47')](handleError(_0x5c65fc,null));};exports['removeAgents']=function(_0x4156a5,_0x309fa9,_0x3ddbc7){return db[_0x0a9e('0x30')][_0x0a9e('0x4b')]({'where':{'id':_0x4156a5['params']['id']}})['then'](handleEntityNotFound(_0x309fa9,null))[_0x0a9e('0x26')](function(_0x33bcb2){if(_0x33bcb2){return _0x33bcb2[_0x0a9e('0x89')](_0x4156a5['query'][_0x0a9e('0x5b')])[_0x0a9e('0x26')](function(){if(_[_0x0a9e('0x5f')](_0x4156a5['query'][_0x0a9e('0x5b')])){for(var _0x2bf85d=0x0;_0x2bf85d<_0x4156a5[_0x0a9e('0x35')]['ids'][_0x0a9e('0x49')];_0x2bf85d+=0x1){socket[_0x0a9e('0x8a')](_0x0a9e('0x8b'),{'UserId':Number(_0x4156a5['query']['ids'][_0x2bf85d]),'CmListId':Number(_0x4156a5['params']['id'])});}}else{socket[_0x0a9e('0x8a')](_0x0a9e('0x8b'),{'UserId':Number(_0x4156a5[_0x0a9e('0x35')][_0x0a9e('0x5b')]),'CmListId':Number(_0x4156a5['params']['id'])});}});}})[_0x0a9e('0x26')](respondWithStatusCode(_0x309fa9,null))['catch'](handleError(_0x309fa9,null));};exports[_0x0a9e('0x8c')]=function(_0x2ff2ab,_0x242f23,_0x57f673){var _0x33b4b3={};var _0x33a26c={};var _0xb8a476;var _0x580dd6;return db[_0x0a9e('0x30')]['findOne']({'where':{'id':_0x2ff2ab[_0x0a9e('0x54')]['id']}})['then'](handleEntityNotFound(_0x242f23,null))[_0x0a9e('0x26')](function(_0x57b7d4){if(_0x57b7d4){_0xb8a476=_0x57b7d4;_0x33a26c[_0x0a9e('0x34')]=_[_0x0a9e('0x36')](db[_0x0a9e('0x8d')][_0x0a9e('0x31')]);_0x33a26c[_0x0a9e('0x35')]=_[_0x0a9e('0x36')](_0x2ff2ab[_0x0a9e('0x35')]);_0x33a26c['filters']=_[_0x0a9e('0x39')](_0x33a26c[_0x0a9e('0x34')],_0x33a26c['query']);_0x33b4b3[_0x0a9e('0x38')]=_[_0x0a9e('0x39')](_0x33a26c['model'],qs[_0x0a9e('0x3a')](_0x2ff2ab[_0x0a9e('0x35')][_0x0a9e('0x3a')]));_0x33b4b3['attributes']=_0x33b4b3[_0x0a9e('0x38')][_0x0a9e('0x49')]?_0x33b4b3[_0x0a9e('0x38')]:_0x33a26c[_0x0a9e('0x34')];_0x33b4b3[_0x0a9e('0x3c')]=qs[_0x0a9e('0x3d')](_0x2ff2ab[_0x0a9e('0x35')][_0x0a9e('0x3d')]);_0x33b4b3[_0x0a9e('0x40')]=qs[_0x0a9e('0x37')](_['pick'](_0x2ff2ab[_0x0a9e('0x35')],_0x33a26c['filters']));if(_0x2ff2ab[_0x0a9e('0x35')][_0x0a9e('0x3f')]){_0x33b4b3[_0x0a9e('0x40')]=_[_0x0a9e('0x4a')](_0x33b4b3[_0x0a9e('0x40')],{'$or':_[_0x0a9e('0x2f')](_0x33b4b3['attributes'],function(_0x119708){var _0x469035={};_0x469035[_0x119708]={'$like':'%'+_0x2ff2ab[_0x0a9e('0x35')]['filter']+'%'};return _0x469035;})});}_0x33b4b3=_[_0x0a9e('0x4a')]({},_0x33b4b3,_0x2ff2ab[_0x0a9e('0x42')]);return _0xb8a476[_0x0a9e('0x8c')](_0x33b4b3);}})[_0x0a9e('0x26')](function(_0x31e1e0){if(_0x31e1e0){_0x580dd6=_0x31e1e0[_0x0a9e('0x49')];if(!_0x2ff2ab[_0x0a9e('0x35')]['hasOwnProperty'](_0x0a9e('0x6c'))){_0x33b4b3[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x2ff2ab[_0x0a9e('0x35')][_0x0a9e('0x20')]);_0x33b4b3[_0x0a9e('0x1f')]=qs[_0x0a9e('0x1f')](_0x2ff2ab['query']['offset']);}return _0xb8a476[_0x0a9e('0x8c')](_0x33b4b3);}})[_0x0a9e('0x26')](function(_0x1f4929){if(_0x1f4929){return _0x1f4929?{'count':_0x580dd6,'rows':_0x1f4929}:null;}})[_0x0a9e('0x26')](respondWithResult(_0x242f23,null))[_0x0a9e('0x47')](handleError(_0x242f23,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 25923db..8964808 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 _0x0a26=['hook','../../mysqldb','CmList','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4fa493,_0x5c1603){var _0x4d39c7=function(_0x527a82){while(--_0x527a82){_0x4fa493['push'](_0x4fa493['shift']());}};_0x4d39c7(++_0x5c1603);}(_0x0a26,0xbe));var _0x60a2=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x0a26[_0x49ca18];return _0x145d54;};'use strict';var EventEmitter=require('events');var CmList=require(_0x60a2('0x0'))['db'][_0x60a2('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x60a2('0x2')](0x0);var events={'afterCreate':_0x60a2('0x3'),'afterUpdate':_0x60a2('0x4'),'afterDestroy':_0x60a2('0x5')};function emitEvent(_0x2e52c5){return function(_0x383e14,_0xb423b8,_0x1d3784){CmListEvents[_0x60a2('0x6')](_0x2e52c5+':'+_0x383e14['id'],_0x383e14);CmListEvents[_0x60a2('0x6')](_0x2e52c5,_0x383e14);_0x1d3784(null);};}for(var e in events){if(events[_0x60a2('0x7')](e)){var event=events[e];CmList[_0x60a2('0x8')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x48d6=['CmList','setMaxListeners','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x48d6,0x1d2));var _0x648d=function(_0x4a4219,_0x55d299){_0x4a4219=_0x4a4219-0x0;var _0x1bb2a7=_0x48d6[_0x4a4219];return _0x1bb2a7;};'use strict';var EventEmitter=require(_0x648d('0x0'));var CmList=require(_0x648d('0x1'))['db'][_0x648d('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x648d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x648d('0x4'),'afterDestroy':_0x648d('0x5')};function emitEvent(_0x3eff59){return function(_0x577662,_0xea4b98,_0x5d77e0){CmListEvents[_0x648d('0x6')](_0x3eff59+':'+_0x577662['id'],_0x577662);CmListEvents[_0x648d('0x6')](_0x3eff59,_0x577662);_0x5d77e0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x648d('0x7')](e,emitEvent(event));}}module[_0x648d('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 ed1af3c..f0bc582 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 _0xd4a5=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./cmList.attributes','define','CmList','cm_lists'];(function(_0x10b48a,_0x1a0a3f){var _0x2c4533=function(_0x5e4be6){while(--_0x5e4be6){_0x10b48a['push'](_0x10b48a['shift']());}};_0x2c4533(++_0x1a0a3f);}(_0xd4a5,0x1b0));var _0x5d4a=function(_0xe1a051,_0x521748){_0xe1a051=_0xe1a051-0x0;var _0x2a9a33=_0xd4a5[_0xe1a051];return _0x2a9a33;};'use strict';var _=require(_0x5d4a('0x0'));var util=require(_0x5d4a('0x1'));var logger=require(_0x5d4a('0x2'))(_0x5d4a('0x3'));var moment=require(_0x5d4a('0x4'));var BPromise=require(_0x5d4a('0x5'));var rp=require(_0x5d4a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5d4a('0x7'));var config=require('../../config/environment');var attributes=require(_0x5d4a('0x8'));module['exports']=function(_0x148945,_0x28b460){return _0x148945[_0x5d4a('0x9')](_0x5d4a('0xa'),attributes,{'tableName':_0x5d4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30ca=['moment','bluebird','request-promise','path','rimraf','./cmList.attributes','define','CmList','cm_lists','lodash','util','api'];(function(_0x28111f,_0x254934){var _0x5203e6=function(_0x2c639a){while(--_0x2c639a){_0x28111f['push'](_0x28111f['shift']());}};_0x5203e6(++_0x254934);}(_0x30ca,0x165));var _0xa30c=function(_0x39e1ac,_0x13af0a){_0x39e1ac=_0x39e1ac-0x0;var _0x333734=_0x30ca[_0x39e1ac];return _0x333734;};'use strict';var _=require(_0xa30c('0x0'));var util=require(_0xa30c('0x1'));var logger=require('../../config/logger')(_0xa30c('0x2'));var moment=require(_0xa30c('0x3'));var BPromise=require(_0xa30c('0x4'));var rp=require(_0xa30c('0x5'));var fs=require('fs');var path=require(_0xa30c('0x6'));var rimraf=require(_0xa30c('0x7'));var config=require('../../config/environment');var attributes=require(_0xa30c('0x8'));module['exports']=function(_0x51c721,_0x2690df){return _0x51c721[_0xa30c('0x9')](_0xa30c('0xa'),attributes,{'tableName':_0xa30c('0xb'),'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 2739f1e..12c1828 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 _0x3054=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./cmList.socket','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x33da9d,_0xf0711d){var _0x3e8991=function(_0x3877c9){while(--_0x3877c9){_0x33da9d['push'](_0x33da9d['shift']());}};_0x3e8991(++_0xf0711d);}(_0x3054,0x71));var _0x4305=function(_0x2dfabc,_0x3a3a2e){_0x2dfabc=_0x2dfabc-0x0;var _0xe1dc5e=_0x3054[_0x2dfabc];return _0xe1dc5e;};'use strict';var _=require(_0x4305('0x0'));var util=require(_0x4305('0x1'));var moment=require(_0x4305('0x2'));var BPromise=require(_0x4305('0x3'));var rs=require(_0x4305('0x4'));var fs=require('fs');var Redis=require(_0x4305('0x5'));var db=require(_0x4305('0x6'))['db'];var utils=require(_0x4305('0x7'));var logger=require(_0x4305('0x8'))(_0x4305('0x9'));var config=require('../../config/environment');var jayson=require(_0x4305('0xa'));var client=jayson[_0x4305('0xb')]['http']({'port':0x232a});config[_0x4305('0xc')]=_[_0x4305('0xd')](config[_0x4305('0xc')],{'host':_0x4305('0xe'),'port':0x18eb});var socket=require(_0x4305('0xf'))(new Redis(config[_0x4305('0xc')]));require(_0x4305('0x10'))['register'](socket);function respondWithRpcPromise(_0x248b9b,_0x32e34a,_0x276d41){return new BPromise(function(_0x2077a8,_0x45ffaa){return client[_0x4305('0x11')](_0x248b9b,_0x276d41)['then'](function(_0x425768){logger[_0x4305('0x12')](_0x4305('0x13'),_0x32e34a,_0x4305('0x14'));logger[_0x4305('0x15')]('CmList,\x20%s,\x20%s,\x20%s',_0x32e34a,_0x4305('0x14'),JSON['stringify'](_0x425768));if(_0x425768[_0x4305('0x16')]){if(_0x425768[_0x4305('0x16')][_0x4305('0x17')]===0x1f4){logger[_0x4305('0x16')]('CmList,\x20%s,\x20%s',_0x32e34a,_0x425768[_0x4305('0x16')][_0x4305('0x18')]);return _0x45ffaa(_0x425768[_0x4305('0x16')]['message']);}logger[_0x4305('0x16')](_0x4305('0x13'),_0x32e34a,_0x425768[_0x4305('0x16')][_0x4305('0x18')]);return _0x2077a8(_0x425768[_0x4305('0x16')][_0x4305('0x18')]);}else{logger['info'](_0x4305('0x13'),_0x32e34a,_0x4305('0x14'));_0x2077a8(_0x425768[_0x4305('0x19')][_0x4305('0x18')]);}})[_0x4305('0x1a')](function(_0x4fd535){logger[_0x4305('0x16')](_0x4305('0x13'),_0x32e34a,_0x4fd535);_0x45ffaa(_0x4fd535);});});} \ No newline at end of file +var _0x538e=['localhost','socket.io-emitter','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x3bb830,_0xa498c1){var _0x309778=function(_0x3e22b1){while(--_0x3e22b1){_0x3bb830['push'](_0x3bb830['shift']());}};_0x309778(++_0xa498c1);}(_0x538e,0x138));var _0xe538=function(_0x56c9ef,_0x398bd2){_0x56c9ef=_0x56c9ef-0x0;var _0x10a3d2=_0x538e[_0x56c9ef];return _0x10a3d2;};'use strict';var _=require('lodash');var util=require(_0xe538('0x0'));var moment=require(_0xe538('0x1'));var BPromise=require(_0xe538('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe538('0x3'));var db=require(_0xe538('0x4'))['db'];var utils=require(_0xe538('0x5'));var logger=require(_0xe538('0x6'))(_0xe538('0x7'));var config=require('../../config/environment');var jayson=require(_0xe538('0x8'));var client=jayson[_0xe538('0x9')][_0xe538('0xa')]({'port':0x232a});config[_0xe538('0xb')]=_['defaults'](config[_0xe538('0xb')],{'host':_0xe538('0xc'),'port':0x18eb});var socket=require(_0xe538('0xd'))(new Redis(config['redis']));require('./cmList.socket')[_0xe538('0xe')](socket);function respondWithRpcPromise(_0x3a9aa8,_0x110a1b,_0x2ea119){return new BPromise(function(_0x616ea0,_0x325704){return client[_0xe538('0xf')](_0x3a9aa8,_0x2ea119)[_0xe538('0x10')](function(_0x5e9dea){logger[_0xe538('0x11')](_0xe538('0x12'),_0x110a1b,_0xe538('0x13'));logger[_0xe538('0x14')]('CmList,\x20%s,\x20%s,\x20%s',_0x110a1b,_0xe538('0x13'),JSON[_0xe538('0x15')](_0x5e9dea));if(_0x5e9dea['error']){if(_0x5e9dea['error'][_0xe538('0x16')]===0x1f4){logger[_0xe538('0x17')](_0xe538('0x12'),_0x110a1b,_0x5e9dea[_0xe538('0x17')][_0xe538('0x18')]);return _0x325704(_0x5e9dea[_0xe538('0x17')]['message']);}logger['error'](_0xe538('0x12'),_0x110a1b,_0x5e9dea[_0xe538('0x17')][_0xe538('0x18')]);return _0x616ea0(_0x5e9dea[_0xe538('0x17')][_0xe538('0x18')]);}else{logger[_0xe538('0x11')](_0xe538('0x12'),_0x110a1b,'request\x20sent');_0x616ea0(_0x5e9dea[_0xe538('0x19')]['message']);}})[_0xe538('0x1a')](function(_0x1f2a73){logger['error'](_0xe538('0x12'),_0x110a1b,_0x1f2a73);_0x325704(_0x1f2a73);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index eafee54..f200005 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 _0x12e9=['remove','emit','removeListener','register','length','cmList:'];(function(_0x1632a1,_0x1a63b3){var _0x4730dc=function(_0x3fa0b6){while(--_0x3fa0b6){_0x1632a1['push'](_0x1632a1['shift']());}};_0x4730dc(++_0x1a63b3);}(_0x12e9,0x66));var _0x912e=function(_0x4beb07,_0x498634){_0x4beb07=_0x4beb07-0x0;var _0x27180b=_0x12e9[_0x4beb07];return _0x27180b;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0x912e('0x0'),'update'];function createListener(_0x2112f,_0x333e26){return function(_0x58c8dc){_0x333e26[_0x912e('0x1')](_0x2112f,_0x58c8dc);};}function removeListener(_0x4401ae,_0x4b7376){return function(){CmListEvents[_0x912e('0x2')](_0x4401ae,_0x4b7376);};}exports[_0x912e('0x3')]=function(_0x2a15be){for(var _0x31622c=0x0,_0x4f4dbb=events[_0x912e('0x4')];_0x31622c<_0x4f4dbb;_0x31622c++){var _0x2ccba9=events[_0x31622c];var _0x2a8fc3=createListener(_0x912e('0x5')+_0x2ccba9,_0x2a15be);CmListEvents['on'](_0x2ccba9,_0x2a8fc3);}}; \ No newline at end of file +var _0x4074=['./cmList.events','save','remove','emit','removeListener','register','length','cmList:'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x4074,0xf0));var _0x4407=function(_0x5bf2b5,_0xc2f22f){_0x5bf2b5=_0x5bf2b5-0x0;var _0x3f5839=_0x4074[_0x5bf2b5];return _0x3f5839;};'use strict';var CmListEvents=require(_0x4407('0x0'));var events=[_0x4407('0x1'),_0x4407('0x2'),'update'];function createListener(_0x1021e6,_0x2a756){return function(_0x14c0bc){_0x2a756[_0x4407('0x3')](_0x1021e6,_0x14c0bc);};}function removeListener(_0x188494,_0x3c9f5c){return function(){CmListEvents[_0x4407('0x4')](_0x188494,_0x3c9f5c);};}exports[_0x4407('0x5')]=function(_0x3f085d){for(var _0x35899d=0x0,_0x4933cf=events[_0x4407('0x6')];_0x35899d<_0x4933cf;_0x35899d++){var _0x5f0699=events[_0x35899d];var _0x414f0a=createListener(_0x4407('0x7')+_0x5f0699,_0x3f085d);CmListEvents['on'](_0x5f0699,_0x414f0a);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 7ad1dbc..e71b066 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 _0x5f08=['addCustomField','addAgents','update','delete','destroy','removeAgents','exports','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents','create','post','/:id/dispositions','addDisposition','addContacts'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x5f08,0x1b9));var _0x85f0=function(_0x5bdb86,_0x586535){_0x5bdb86=_0x5bdb86-0x0;var _0x712fc4=_0x5f08[_0x5bdb86];return _0x712fc4;};'use strict';var multer=require('multer');var util=require(_0x85f0('0x0'));var path=require(_0x85f0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x85f0('0x2'));var interaction=require(_0x85f0('0x3'));var config=require(_0x85f0('0x4'));var controller=require(_0x85f0('0x5'));router['get']('/',auth[_0x85f0('0x6')](),controller[_0x85f0('0x7')]);router[_0x85f0('0x8')](_0x85f0('0x9'),auth[_0x85f0('0x6')](),controller[_0x85f0('0xa')]);router['get'](_0x85f0('0xb'),auth['isAuthenticated'](),controller[_0x85f0('0xc')]);router['get']('/:id/dispositions',auth[_0x85f0('0x6')](),controller['getDispositions']);router[_0x85f0('0x8')](_0x85f0('0xd'),auth[_0x85f0('0x6')](),controller['getContacts']);router[_0x85f0('0x8')](_0x85f0('0xe'),auth['isAuthenticated'](),controller[_0x85f0('0xf')]);router[_0x85f0('0x8')](_0x85f0('0x10'),auth['isAuthenticated'](),controller['getCustomFields']);router[_0x85f0('0x8')](_0x85f0('0x11'),auth['isAuthenticated'](),controller[_0x85f0('0x12')]);router['post']('/',auth[_0x85f0('0x6')](),controller[_0x85f0('0x13')]);router[_0x85f0('0x14')](_0x85f0('0x15'),auth[_0x85f0('0x6')](),controller[_0x85f0('0x16')]);router['post'](_0x85f0('0xd'),auth[_0x85f0('0x6')](),controller[_0x85f0('0x17')]);router[_0x85f0('0x14')](_0x85f0('0x10'),auth[_0x85f0('0x6')](),controller[_0x85f0('0x18')]);router[_0x85f0('0x14')](_0x85f0('0x11'),auth[_0x85f0('0x6')](),controller[_0x85f0('0x19')]);router['put'](_0x85f0('0xb'),auth[_0x85f0('0x6')](),controller[_0x85f0('0x1a')]);router[_0x85f0('0x1b')](_0x85f0('0xb'),auth[_0x85f0('0x6')](),controller[_0x85f0('0x1c')]);router[_0x85f0('0x1b')](_0x85f0('0x15'),auth[_0x85f0('0x6')](),controller['removeDispositions']);router[_0x85f0('0x1b')]('/:id/users',auth[_0x85f0('0x6')](),controller[_0x85f0('0x1d')]);module[_0x85f0('0x1e')]=router; \ No newline at end of file +var _0xa048=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/fields','getCustomFields','getAgents','create','post','addCustomField','/:id/users','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports'];(function(_0xb3b452,_0x582e8e){var _0x238983=function(_0x3bc866){while(--_0x3bc866){_0xb3b452['push'](_0xb3b452['shift']());}};_0x238983(++_0x582e8e);}(_0xa048,0x176));var _0x8a04=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa048[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0x8a04('0x0'));var path=require(_0x8a04('0x1'));var timeout=require(_0x8a04('0x2'));var express=require(_0x8a04('0x3'));var router=express[_0x8a04('0x4')]();var auth=require(_0x8a04('0x5'));var interaction=require(_0x8a04('0x6'));var config=require(_0x8a04('0x7'));var controller=require(_0x8a04('0x8'));router[_0x8a04('0x9')]('/',auth[_0x8a04('0xa')](),controller[_0x8a04('0xb')]);router[_0x8a04('0x9')](_0x8a04('0xc'),auth['isAuthenticated'](),controller[_0x8a04('0xd')]);router[_0x8a04('0x9')](_0x8a04('0xe'),auth[_0x8a04('0xa')](),controller[_0x8a04('0xf')]);router[_0x8a04('0x9')](_0x8a04('0x10'),auth[_0x8a04('0xa')](),controller[_0x8a04('0x11')]);router[_0x8a04('0x9')](_0x8a04('0x12'),auth[_0x8a04('0xa')](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x8a04('0xa')](),controller['getContactsCsv']);router[_0x8a04('0x9')](_0x8a04('0x13'),auth[_0x8a04('0xa')](),controller[_0x8a04('0x14')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x8a04('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8a04('0x16')]);router['post'](_0x8a04('0x10'),auth[_0x8a04('0xa')](),controller['addDisposition']);router[_0x8a04('0x17')](_0x8a04('0x12'),auth[_0x8a04('0xa')](),controller['addContacts']);router[_0x8a04('0x17')](_0x8a04('0x13'),auth[_0x8a04('0xa')](),controller[_0x8a04('0x18')]);router[_0x8a04('0x17')](_0x8a04('0x19'),auth['isAuthenticated'](),controller[_0x8a04('0x1a')]);router[_0x8a04('0x1b')](_0x8a04('0xe'),auth['isAuthenticated'](),controller[_0x8a04('0x1c')]);router[_0x8a04('0x1d')]('/:id',auth[_0x8a04('0xa')](),controller[_0x8a04('0x1e')]);router[_0x8a04('0x1d')](_0x8a04('0x10'),auth['isAuthenticated'](),controller[_0x8a04('0x1f')]);router[_0x8a04('0x1d')](_0x8a04('0x19'),auth['isAuthenticated'](),controller[_0x8a04('0x20')]);module[_0x8a04('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index d9735d9..62e9e09 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x244188,_0x1b832c){var _0x566fd4=function(_0x55ed02){while(--_0x55ed02){_0x244188['push'](_0x244188['shift']());}};_0x566fd4(++_0x1b832c);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x251a53,_0x447e37){var _0x580d17=function(_0x3ff1b2){while(--_0x3ff1b2){_0x251a53['push'](_0x251a53['shift']());}};_0x580d17(++_0x447e37);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 632b638..d5ff4da 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 _0x2996=['end','count','offset','limit','set','Content-Range','apply','reject','destroy','then','status','stack','name','send','update','body','find','params','catch','Condition','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2996,0x1ea));var _0x6299=function(_0x351452,_0x312ff3){_0x351452=_0x351452-0x0;var _0x352610=_0x2996[_0x351452];return _0x352610;};'use strict';var pdf=require(_0x6299('0x0'));var emlformat=require(_0x6299('0x1'));var rimraf=require(_0x6299('0x2'));var zipdir=require(_0x6299('0x3'));var jsonpatch=require(_0x6299('0x4'));var rp=require(_0x6299('0x5'));var moment=require(_0x6299('0x6'));var BPromise=require(_0x6299('0x7'));var Mustache=require(_0x6299('0x8'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6299('0x9'));var ejs=require(_0x6299('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6299('0xb'));var crypto=require(_0x6299('0xc'));var jsforce=require(_0x6299('0xd'));var deskjs=require(_0x6299('0xe'));var toCsv=require(_0x6299('0x9'));var querystring=require(_0x6299('0xf'));var Papa=require('papaparse');var Redis=require(_0x6299('0x10'));var authService=require(_0x6299('0x11'));var qs=require(_0x6299('0x12'));var as=require(_0x6299('0x13'));var hardwareService=require(_0x6299('0x14'));var logger=require(_0x6299('0x15'))(_0x6299('0x16'));var utils=require(_0x6299('0x17'));var config=require(_0x6299('0x18'));var db=require(_0x6299('0x19'))['db'];function respondWithStatusCode(_0x381491,_0x954adb){_0x954adb=_0x954adb||0xcc;return function(_0x472f39){if(_0x472f39){return _0x381491[_0x6299('0x1a')](_0x954adb);}return _0x381491['status'](_0x954adb)[_0x6299('0x1b')]();};}function respondWithResult(_0x193ecc,_0x2b2bca){_0x2b2bca=_0x2b2bca||0xc8;return function(_0x115334){if(_0x115334){return _0x193ecc['status'](_0x2b2bca)['json'](_0x115334);}};}function respondWithFilteredResult(_0x495d49,_0x2273b1){return function(_0x27b316){if(_0x27b316){var _0x4ebb9d=_0x27b316[_0x6299('0x1c')],_0x318476=_0x2273b1[_0x6299('0x1d')],_0x23bf7c=_0x2273b1[_0x6299('0x1d')]+_0x2273b1[_0x6299('0x1e')],_0x133211;if(_0x23bf7c>=_0x4ebb9d){_0x23bf7c=_0x4ebb9d;_0x133211=0xc8;}else{_0x133211=0xce;}_0x495d49['status'](_0x133211);return _0x495d49[_0x6299('0x1f')](_0x6299('0x20'),_0x318476+'-'+_0x23bf7c+'/'+_0x4ebb9d)['json'](_0x27b316);}return null;};}function patchUpdates(_0x4ee8f7){return function(_0x1cb55d){try{jsonpatch[_0x6299('0x21')](_0x1cb55d,_0x4ee8f7,!![]);}catch(_0xd14578){return BPromise[_0x6299('0x22')](_0xd14578);}return _0x1cb55d['save']();};}function saveUpdates(_0x31d2bc,_0xe48d0){return function(_0x3cc3ab){if(_0x3cc3ab){return _0x3cc3ab['update'](_0x31d2bc)['then'](function(_0x294919){return _0x294919;});}return null;};}function removeEntity(_0x46f52a,_0x340ccb){return function(_0x4df553){if(_0x4df553){return _0x4df553[_0x6299('0x23')]()[_0x6299('0x24')](function(){_0x46f52a[_0x6299('0x25')](0xcc)[_0x6299('0x1b')]();});}};}function handleEntityNotFound(_0x269f3c,_0x518db6){return function(_0x3de59d){if(!_0x3de59d){_0x269f3c[_0x6299('0x1a')](0x194);}return _0x3de59d;};}function handleError(_0x3fd27f,_0x21b625){_0x21b625=_0x21b625||0x1f4;return function(_0x3270ec){logger['error'](_0x3270ec[_0x6299('0x26')]);if(_0x3270ec[_0x6299('0x27')]){delete _0x3270ec[_0x6299('0x27')];}_0x3fd27f['status'](_0x21b625)[_0x6299('0x28')](_0x3270ec);};}exports[_0x6299('0x29')]=function(_0x95b8e3,_0x21b0bb){if(_0x95b8e3[_0x6299('0x2a')]['id']){delete _0x95b8e3['body']['id'];}return db['Condition'][_0x6299('0x2b')]({'where':{'id':_0x95b8e3[_0x6299('0x2c')]['id']}})[_0x6299('0x24')](handleEntityNotFound(_0x21b0bb,null))[_0x6299('0x24')](saveUpdates(_0x95b8e3[_0x6299('0x2a')],null))[_0x6299('0x24')](respondWithResult(_0x21b0bb,null))[_0x6299('0x2d')](handleError(_0x21b0bb,null));};exports['destroy']=function(_0x2c48df,_0xef284b){return db[_0x6299('0x2e')][_0x6299('0x2b')]({'where':{'id':_0x2c48df[_0x6299('0x2c')]['id']}})['then'](handleEntityNotFound(_0xef284b,null))[_0x6299('0x24')](removeEntity(_0xef284b,null))[_0x6299('0x2d')](handleError(_0xef284b,null));}; \ No newline at end of file +var _0x5100=['to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','stack','name','body','Condition','find','params','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path'];(function(_0x1a4b2b,_0x185fbb){var _0x5dd2d0=function(_0x247b0f){while(--_0x247b0f){_0x1a4b2b['push'](_0x1a4b2b['shift']());}};_0x5dd2d0(++_0x185fbb);}(_0x5100,0x132));var _0x0510=function(_0x1a15cf,_0x420419){_0x1a15cf=_0x1a15cf-0x0;var _0x20a110=_0x5100[_0x1a15cf];return _0x20a110;};'use strict';var pdf=require(_0x0510('0x0'));var emlformat=require(_0x0510('0x1'));var rimraf=require(_0x0510('0x2'));var zipdir=require(_0x0510('0x3'));var jsonpatch=require(_0x0510('0x4'));var rp=require(_0x0510('0x5'));var moment=require('moment');var BPromise=require(_0x0510('0x6'));var Mustache=require('mustache');var util=require(_0x0510('0x7'));var path=require(_0x0510('0x8'));var sox=require('sox');var csv=require(_0x0510('0x9'));var ejs=require(_0x0510('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0510('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0510('0xc'));var toCsv=require(_0x0510('0x9'));var querystring=require(_0x0510('0xd'));var Papa=require(_0x0510('0xe'));var Redis=require(_0x0510('0xf'));var authService=require(_0x0510('0x10'));var qs=require(_0x0510('0x11'));var as=require(_0x0510('0x12'));var hardwareService=require(_0x0510('0x13'));var logger=require(_0x0510('0x14'))(_0x0510('0x15'));var utils=require(_0x0510('0x16'));var config=require(_0x0510('0x17'));var db=require(_0x0510('0x18'))['db'];function respondWithStatusCode(_0x302e15,_0x4045a0){_0x4045a0=_0x4045a0||0xcc;return function(_0xa48528){if(_0xa48528){return _0x302e15[_0x0510('0x19')](_0x4045a0);}return _0x302e15[_0x0510('0x1a')](_0x4045a0)[_0x0510('0x1b')]();};}function respondWithResult(_0x46391b,_0x5910c7){_0x5910c7=_0x5910c7||0xc8;return function(_0x350743){if(_0x350743){return _0x46391b['status'](_0x5910c7)[_0x0510('0x1c')](_0x350743);}};}function respondWithFilteredResult(_0x1ba2b2,_0x1a1b6e){return function(_0x4629d4){if(_0x4629d4){var _0x40d162=_0x4629d4[_0x0510('0x1d')],_0x5a2952=_0x1a1b6e['offset'],_0x1e5406=_0x1a1b6e[_0x0510('0x1e')]+_0x1a1b6e[_0x0510('0x1f')],_0x4f6a4d;if(_0x1e5406>=_0x40d162){_0x1e5406=_0x40d162;_0x4f6a4d=0xc8;}else{_0x4f6a4d=0xce;}_0x1ba2b2[_0x0510('0x1a')](_0x4f6a4d);return _0x1ba2b2['set'](_0x0510('0x20'),_0x5a2952+'-'+_0x1e5406+'/'+_0x40d162)[_0x0510('0x1c')](_0x4629d4);}return null;};}function patchUpdates(_0x423c89){return function(_0x52fe86){try{jsonpatch[_0x0510('0x21')](_0x52fe86,_0x423c89,!![]);}catch(_0x3573dd){return BPromise[_0x0510('0x22')](_0x3573dd);}return _0x52fe86['save']();};}function saveUpdates(_0x2b40fc,_0xedea16){return function(_0x16de01){if(_0x16de01){return _0x16de01[_0x0510('0x23')](_0x2b40fc)[_0x0510('0x24')](function(_0x4c67fa){return _0x4c67fa;});}return null;};}function removeEntity(_0x1262e0,_0x335877){return function(_0x2e1436){if(_0x2e1436){return _0x2e1436[_0x0510('0x25')]()[_0x0510('0x24')](function(){_0x1262e0['status'](0xcc)[_0x0510('0x1b')]();});}};}function handleEntityNotFound(_0x258924,_0x4e8487){return function(_0x263984){if(!_0x263984){_0x258924[_0x0510('0x19')](0x194);}return _0x263984;};}function handleError(_0x253834,_0x277b1d){_0x277b1d=_0x277b1d||0x1f4;return function(_0x2ab8f0){logger['error'](_0x2ab8f0[_0x0510('0x26')]);if(_0x2ab8f0[_0x0510('0x27')]){delete _0x2ab8f0[_0x0510('0x27')];}_0x253834[_0x0510('0x1a')](_0x277b1d)['send'](_0x2ab8f0);};}exports[_0x0510('0x23')]=function(_0x2509bc,_0x2f6816){if(_0x2509bc[_0x0510('0x28')]['id']){delete _0x2509bc[_0x0510('0x28')]['id'];}return db[_0x0510('0x29')][_0x0510('0x2a')]({'where':{'id':_0x2509bc[_0x0510('0x2b')]['id']}})[_0x0510('0x24')](handleEntityNotFound(_0x2f6816,null))[_0x0510('0x24')](saveUpdates(_0x2509bc[_0x0510('0x28')],null))['then'](respondWithResult(_0x2f6816,null))[_0x0510('0x2c')](handleError(_0x2f6816,null));};exports[_0x0510('0x25')]=function(_0x172c94,_0x2efcd1){return db[_0x0510('0x29')][_0x0510('0x2a')]({'where':{'id':_0x172c94['params']['id']}})['then'](handleEntityNotFound(_0x2efcd1,null))['then'](removeEntity(_0x2efcd1,null))[_0x0510('0x2c')](handleError(_0x2efcd1,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 46869a3..8a8d9e5 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 _0xc0d1=['Condition','tools_conditions','lodash','../../config/logger','bluebird','path','rimraf','./condition.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc0d1,0x14c));var _0x1c0d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc0d1[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x1c0d('0x0'));var util=require('util');var logger=require(_0x1c0d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1c0d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c0d('0x3'));var rimraf=require(_0x1c0d('0x4'));var config=require('../../config/environment');var attributes=require(_0x1c0d('0x5'));module[_0x1c0d('0x6')]=function(_0x5493a2,_0x27740c){return _0x5493a2[_0x1c0d('0x7')](_0x1c0d('0x8'),attributes,{'tableName':_0x1c0d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f56=['define','tools_conditions','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports'];(function(_0x5d911c,_0x4a0713){var _0x5bf841=function(_0x2de0b7){while(--_0x2de0b7){_0x5d911c['push'](_0x5d911c['shift']());}};_0x5bf841(++_0x4a0713);}(_0x3f56,0x176));var _0x63f5=function(_0x104f12,_0x3aba7a){_0x104f12=_0x104f12-0x0;var _0x4183be=_0x3f56[_0x104f12];return _0x4183be;};'use strict';var _=require(_0x63f5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x63f5('0x1'));var moment=require(_0x63f5('0x2'));var BPromise=require(_0x63f5('0x3'));var rp=require(_0x63f5('0x4'));var fs=require('fs');var path=require(_0x63f5('0x5'));var rimraf=require(_0x63f5('0x6'));var config=require(_0x63f5('0x7'));var attributes=require(_0x63f5('0x8'));module[_0x63f5('0x9')]=function(_0x34db4a,_0x21809a){return _0x34db4a[_0x63f5('0xa')]('Condition',attributes,{'tableName':_0x63f5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 2f05911..feb1da9 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 _0x0785=['request\x20sent','debug','stringify','error','code','message','result','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Condition,\x20%s,\x20%s'];(function(_0xbd068e,_0x26a76a){var _0x3e887a=function(_0x20bc86){while(--_0x20bc86){_0xbd068e['push'](_0xbd068e['shift']());}};_0x3e887a(++_0x26a76a);}(_0x0785,0x73));var _0x5078=function(_0x1a3447,_0x3fddfd){_0x1a3447=_0x1a3447-0x0;var _0x33cff5=_0x0785[_0x1a3447];return _0x33cff5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5078('0x0'));var rs=require(_0x5078('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5078('0x2'));var logger=require(_0x5078('0x3'))(_0x5078('0x4'));var config=require(_0x5078('0x5'));var jayson=require(_0x5078('0x6'));var client=jayson['client'][_0x5078('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2a9a25,_0x320eb4,_0x465de8){return new BPromise(function(_0x4b3dfd,_0x3d0c8a){return client['request'](_0x2a9a25,_0x465de8)[_0x5078('0x8')](function(_0x372d5e){logger[_0x5078('0x9')](_0x5078('0xa'),_0x320eb4,_0x5078('0xb'));logger[_0x5078('0xc')]('Condition,\x20%s,\x20%s,\x20%s',_0x320eb4,'request\x20sent',JSON[_0x5078('0xd')](_0x372d5e));if(_0x372d5e['error']){if(_0x372d5e[_0x5078('0xe')][_0x5078('0xf')]===0x1f4){logger[_0x5078('0xe')](_0x5078('0xa'),_0x320eb4,_0x372d5e[_0x5078('0xe')][_0x5078('0x10')]);return _0x3d0c8a(_0x372d5e[_0x5078('0xe')]['message']);}logger['error'](_0x5078('0xa'),_0x320eb4,_0x372d5e[_0x5078('0xe')][_0x5078('0x10')]);return _0x4b3dfd(_0x372d5e[_0x5078('0xe')][_0x5078('0x10')]);}else{logger[_0x5078('0x9')]('Condition,\x20%s,\x20%s',_0x320eb4,_0x5078('0xb'));_0x4b3dfd(_0x372d5e[_0x5078('0x11')]['message']);}})['catch'](function(_0x95d675){logger['error']('Condition,\x20%s,\x20%s',_0x320eb4,_0x95d675);_0x3d0c8a(_0x95d675);});});} \ No newline at end of file +var _0x3beb=['request','then','info','Condition,\x20%s,\x20%s','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3beb,0xd3));var _0xb3be=function(_0xe770f7,_0x421cbd){_0xe770f7=_0xe770f7-0x0;var _0xcc0ae6=_0x3beb[_0xe770f7];return _0xcc0ae6;};'use strict';var _=require(_0xb3be('0x0'));var util=require(_0xb3be('0x1'));var moment=require(_0xb3be('0x2'));var BPromise=require('bluebird');var rs=require(_0xb3be('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb3be('0x4'));var logger=require('../../config/logger')(_0xb3be('0x5'));var config=require(_0xb3be('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb3be('0x7')][_0xb3be('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x402971,_0x39b927,_0x59a5fa){return new BPromise(function(_0x31327d,_0x144118){return client[_0xb3be('0x9')](_0x402971,_0x59a5fa)[_0xb3be('0xa')](function(_0x2d4aaf){logger[_0xb3be('0xb')](_0xb3be('0xc'),_0x39b927,'request\x20sent');logger['debug'](_0xb3be('0xd'),_0x39b927,_0xb3be('0xe'),JSON['stringify'](_0x2d4aaf));if(_0x2d4aaf[_0xb3be('0xf')]){if(_0x2d4aaf[_0xb3be('0xf')][_0xb3be('0x10')]===0x1f4){logger[_0xb3be('0xf')](_0xb3be('0xc'),_0x39b927,_0x2d4aaf['error']['message']);return _0x144118(_0x2d4aaf[_0xb3be('0xf')][_0xb3be('0x11')]);}logger[_0xb3be('0xf')](_0xb3be('0xc'),_0x39b927,_0x2d4aaf[_0xb3be('0xf')][_0xb3be('0x11')]);return _0x31327d(_0x2d4aaf[_0xb3be('0xf')][_0xb3be('0x11')]);}else{logger['info'](_0xb3be('0xc'),_0x39b927,_0xb3be('0xe'));_0x31327d(_0x2d4aaf[_0xb3be('0x12')]['message']);}})[_0xb3be('0x13')](function(_0x2cb655){logger[_0xb3be('0xf')](_0xb3be('0xc'),_0x39b927,_0x2cb655);_0x144118(_0x2cb655);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index f85aea4..045e681 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 _0xad3f=['./condition.controller','put','isAuthenticated','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x622035,_0x1a4b91){var _0x326cf2=function(_0x5c3002){while(--_0x5c3002){_0x622035['push'](_0x622035['shift']());}};_0x326cf2(++_0x1a4b91);}(_0xad3f,0xb2));var _0xfad3=function(_0x454760,_0x35f9a3){_0x454760=_0x454760-0x0;var _0x4a9871=_0xad3f[_0x454760];return _0x4a9871;};'use strict';var multer=require(_0xfad3('0x0'));var util=require(_0xfad3('0x1'));var path=require(_0xfad3('0x2'));var timeout=require(_0xfad3('0x3'));var express=require(_0xfad3('0x4'));var router=express[_0xfad3('0x5')]();var auth=require(_0xfad3('0x6'));var interaction=require(_0xfad3('0x7'));var config=require(_0xfad3('0x8'));var controller=require(_0xfad3('0x9'));router[_0xfad3('0xa')]('/:id',auth[_0xfad3('0xb')](),controller[_0xfad3('0xc')]);router[_0xfad3('0xd')](_0xfad3('0xe'),auth[_0xfad3('0xb')](),controller[_0xfad3('0xf')]);module[_0xfad3('0x10')]=router; \ No newline at end of file +var _0xe53a=['update','delete','/:id','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe53a,0x1a3));var _0xae53=function(_0x25b4f4,_0x381360){_0x25b4f4=_0x25b4f4-0x0;var _0x508585=_0xe53a[_0x25b4f4];return _0x508585;};'use strict';var multer=require('multer');var util=require(_0xae53('0x0'));var path=require(_0xae53('0x1'));var timeout=require(_0xae53('0x2'));var express=require(_0xae53('0x3'));var router=express[_0xae53('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xae53('0x5'));var config=require(_0xae53('0x6'));var controller=require(_0xae53('0x7'));router[_0xae53('0x8')]('/:id',auth[_0xae53('0x9')](),controller[_0xae53('0xa')]);router[_0xae53('0xb')](_0xae53('0xc'),auth[_0xae53('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 26239df..b18d618 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 _0x7c1a=['name','sequelize','exports','STRING'];(function(_0x31ec9a,_0x1398e0){var _0x1bf996=function(_0xed27e7){while(--_0xed27e7){_0x31ec9a['push'](_0x31ec9a['shift']());}};_0x1bf996(++_0x1398e0);}(_0x7c1a,0x159));var _0xa7c1=function(_0x4d3b39,_0x4ec5ad){_0x4d3b39=_0x4d3b39-0x0;var _0x3f92ca=_0x7c1a[_0x4d3b39];return _0x3f92ca;};'use strict';var Sequelize=require(_0xa7c1('0x0'));module[_0xa7c1('0x1')]={'name':{'type':Sequelize[_0xa7c1('0x2')],'allowNull':![],'unique':_0xa7c1('0x3')},'description':{'type':Sequelize[_0xa7c1('0x2')]}}; \ No newline at end of file +var _0x580b=['sequelize','STRING'];(function(_0x2aad0d,_0x16215e){var _0x926e3a=function(_0x556798){while(--_0x556798){_0x2aad0d['push'](_0x2aad0d['shift']());}};_0x926e3a(++_0x16215e);}(_0x580b,0xf0));var _0xb580=function(_0x5a70e8,_0x43a45a){_0x5a70e8=_0x5a70e8-0x0;var _0x5351a8=_0x580b[_0x5a70e8];return _0x5351a8;};'use strict';var Sequelize=require(_0xb580('0x0'));module['exports']={'name':{'type':Sequelize[_0xb580('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0xb580('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 206f7c9..b8fb6e9 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 _0x851a=['https://','attrPath','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','query','keys','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','intersection','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','clone','params','omit','createdAt','updatedAt','iframe','attrUrl','attrs'];(function(_0x5db99b,_0xdee23a){var _0x4b2d0e=function(_0x4deee1){while(--_0x4deee1){_0x5db99b['push'](_0x5db99b['shift']());}};_0x4b2d0e(++_0xdee23a);}(_0x851a,0x19b));var _0xa851=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x851a[_0x2aea9e];return _0x430b92;};'use strict';var pdf=require(_0xa851('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa851('0x1'));var zipdir=require(_0xa851('0x2'));var jsonpatch=require(_0xa851('0x3'));var rp=require(_0xa851('0x4'));var moment=require(_0xa851('0x5'));var BPromise=require(_0xa851('0x6'));var Mustache=require(_0xa851('0x7'));var util=require(_0xa851('0x8'));var path=require('path');var sox=require(_0xa851('0x9'));var csv=require('to-csv');var ejs=require(_0xa851('0xa'));var fs=require('fs');var _=require(_0xa851('0xb'));var squel=require(_0xa851('0xc'));var crypto=require('crypto');var jsforce=require(_0xa851('0xd'));var deskjs=require(_0xa851('0xe'));var toCsv=require(_0xa851('0xf'));var querystring=require(_0xa851('0x10'));var Papa=require('papaparse');var Redis=require(_0xa851('0x11'));var authService=require(_0xa851('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa851('0x13'));var hardwareService=require(_0xa851('0x14'));var logger=require(_0xa851('0x15'))(_0xa851('0x16'));var utils=require(_0xa851('0x17'));var config=require(_0xa851('0x18'));var db=require(_0xa851('0x19'))['db'];config[_0xa851('0x1a')]=_[_0xa851('0x1b')](config[_0xa851('0x1a')],{'host':_0xa851('0x1c'),'port':0x18eb});var socket=require(_0xa851('0x1d'))(new Redis(config[_0xa851('0x1a')]));require(_0xa851('0x1e'))[_0xa851('0x1f')](socket);function respondWithStatusCode(_0x2ad4b2,_0x290272){_0x290272=_0x290272||0xcc;return function(_0x22dfc4){if(_0x22dfc4){return _0x2ad4b2['sendStatus'](_0x290272);}return _0x2ad4b2[_0xa851('0x20')](_0x290272)[_0xa851('0x21')]();};}function respondWithResult(_0xfb70b5,_0x3d4dd6){_0x3d4dd6=_0x3d4dd6||0xc8;return function(_0x5be85d){if(_0x5be85d){return _0xfb70b5[_0xa851('0x20')](_0x3d4dd6)[_0xa851('0x22')](_0x5be85d);}};}function respondWithFilteredResult(_0x12a8b1,_0xf28ac3){return function(_0x4e6ad0){if(_0x4e6ad0){var _0x51ebac=_0x4e6ad0[_0xa851('0x23')],_0x3bfd42=_0xf28ac3[_0xa851('0x24')],_0x56d28c=_0xf28ac3[_0xa851('0x24')]+_0xf28ac3[_0xa851('0x25')],_0x23d32d;if(_0x56d28c>=_0x51ebac){_0x56d28c=_0x51ebac;_0x23d32d=0xc8;}else{_0x23d32d=0xce;}_0x12a8b1[_0xa851('0x20')](_0x23d32d);return _0x12a8b1[_0xa851('0x26')](_0xa851('0x27'),_0x3bfd42+'-'+_0x56d28c+'/'+_0x51ebac)[_0xa851('0x22')](_0x4e6ad0);}return null;};}function patchUpdates(_0x5bfe0e){return function(_0x394f7d){try{jsonpatch[_0xa851('0x28')](_0x394f7d,_0x5bfe0e,!![]);}catch(_0x521f57){return BPromise[_0xa851('0x29')](_0x521f57);}return _0x394f7d[_0xa851('0x2a')]();};}function saveUpdates(_0x59cad2,_0x1ed43b){return function(_0x163b23){if(_0x163b23){return _0x163b23[_0xa851('0x2b')](_0x59cad2)[_0xa851('0x2c')](function(_0x304afd){return _0x304afd;});}return null;};}function removeEntity(_0x233cb7,_0x3d956d){return function(_0x19c9aa){if(_0x19c9aa){return _0x19c9aa[_0xa851('0x2d')]()[_0xa851('0x2c')](function(){var _0x23c3ef=_0x19c9aa[_0xa851('0x2e')]({'plain':!![]});var _0x4f728c=_0xa851('0x2f');return db[_0xa851('0x30')][_0xa851('0x2d')]({'where':{'type':_0x4f728c,'resourceId':_0x23c3ef['id']}})['then'](function(){return _0x19c9aa;});})[_0xa851('0x2c')](function(){_0x233cb7['status'](0xcc)[_0xa851('0x21')]();});}};}function handleEntityNotFound(_0x4f49fe,_0x10935d){return function(_0x455f93){if(!_0x455f93){_0x4f49fe['sendStatus'](0x194);}return _0x455f93;};}function handleError(_0x40457c,_0x1a6b2d){_0x1a6b2d=_0x1a6b2d||0x1f4;return function(_0xa06c66){logger[_0xa851('0x31')](_0xa06c66[_0xa851('0x32')]);if(_0xa06c66[_0xa851('0x33')]){delete _0xa06c66['name'];}_0x40457c[_0xa851('0x20')](_0x1a6b2d)[_0xa851('0x34')](_0xa06c66);};}exports[_0xa851('0x35')]=function(_0x4a027b,_0x1788a6){var _0x126e37={},_0x4d2018={},_0x16a34e={'count':0x0,'rows':[]};var _0x25ce47=_[_0xa851('0x36')](db[_0xa851('0x37')][_0xa851('0x38')],function(_0xfbb23a){return{'name':_0xfbb23a[_0xa851('0x39')],'type':_0xfbb23a[_0xa851('0x3a')][_0xa851('0x3b')]};});_0x4d2018['model']=_[_0xa851('0x36')](_0x25ce47,_0xa851('0x33'));_0x4d2018[_0xa851('0x3c')]=_[_0xa851('0x3d')](_0x4a027b[_0xa851('0x3c')]);_0x4d2018[_0xa851('0x3e')]=_['intersection'](_0x4d2018['model'],_0x4d2018[_0xa851('0x3c')]);_0x126e37[_0xa851('0x3f')]=_['intersection'](_0x4d2018[_0xa851('0x40')],qs[_0xa851('0x41')](_0x4a027b[_0xa851('0x3c')][_0xa851('0x41')]));_0x126e37[_0xa851('0x3f')]=_0x126e37[_0xa851('0x3f')][_0xa851('0x42')]?_0x126e37[_0xa851('0x3f')]:_0x4d2018[_0xa851('0x40')];if(!_0x4a027b['query'][_0xa851('0x43')](_0xa851('0x44'))){_0x126e37[_0xa851('0x25')]=qs[_0xa851('0x25')](_0x4a027b[_0xa851('0x3c')][_0xa851('0x25')]);_0x126e37['offset']=qs[_0xa851('0x24')](_0x4a027b[_0xa851('0x3c')]['offset']);}_0x126e37[_0xa851('0x45')]=qs['sort'](_0x4a027b[_0xa851('0x3c')][_0xa851('0x46')]);_0x126e37[_0xa851('0x47')]=qs['filters'](_[_0xa851('0x48')](_0x4a027b['query'],_0x4d2018[_0xa851('0x3e')]));if(_0x4a027b[_0xa851('0x3c')][_0xa851('0x49')]){_0x126e37[_0xa851('0x47')]=_[_0xa851('0x4a')](_0x126e37[_0xa851('0x47')],{'$or':_[_0xa851('0x36')](_0x25ce47,function(_0x431ff5){if(_0x431ff5[_0xa851('0x3a')]!==_0xa851('0x4b')){var _0x16fa69={};_0x16fa69[_0x431ff5[_0xa851('0x33')]]={'$like':'%'+_0x4a027b[_0xa851('0x3c')][_0xa851('0x49')]+'%'};return _0x16fa69;}})});}_0x126e37=_[_0xa851('0x4a')]({},_0x126e37,_0x4a027b[_0xa851('0x4c')]);var _0x3ac478={'where':_0x126e37[_0xa851('0x47')]};return db[_0xa851('0x37')]['count'](_0x3ac478)[_0xa851('0x2c')](function(_0x8c2fa2){_0x16a34e[_0xa851('0x23')]=_0x8c2fa2;if(_0x4a027b['query']['includeAll']){_0x126e37[_0xa851('0x4d')]=[{'all':!![]}];}return db[_0xa851('0x37')]['findAll'](_0x126e37);})[_0xa851('0x2c')](function(_0x46440d){_0x16a34e[_0xa851('0x4e')]=_0x46440d;return _0x16a34e;})[_0xa851('0x2c')](respondWithFilteredResult(_0x1788a6,_0x126e37))[_0xa851('0x4f')](handleError(_0x1788a6,null));};exports[_0xa851('0x50')]=function(_0xfa3a84,_0x1202c3){var _0x4ef63c={'raw':![],'where':{'id':_0xfa3a84['params']['id']}},_0x217abc={};_0x217abc[_0xa851('0x40')]=_[_0xa851('0x3d')](db['Dashboard'][_0xa851('0x38')]);_0x217abc[_0xa851('0x3c')]=_[_0xa851('0x3d')](_0xfa3a84[_0xa851('0x3c')]);_0x217abc[_0xa851('0x3e')]=_[_0xa851('0x51')](_0x217abc['model'],_0x217abc[_0xa851('0x3c')]);_0x4ef63c[_0xa851('0x3f')]=_[_0xa851('0x51')](_0x217abc[_0xa851('0x40')],qs[_0xa851('0x41')](_0xfa3a84[_0xa851('0x3c')][_0xa851('0x41')]));_0x4ef63c['attributes']=_0x4ef63c[_0xa851('0x3f')][_0xa851('0x42')]?_0x4ef63c['attributes']:_0x217abc[_0xa851('0x40')];if(_0xfa3a84[_0xa851('0x3c')][_0xa851('0x52')]){_0x4ef63c[_0xa851('0x4d')]=[{'all':!![]}];}_0x4ef63c=_[_0xa851('0x4a')]({},_0x4ef63c,_0xfa3a84['options']);return db[_0xa851('0x37')][_0xa851('0x53')](_0x4ef63c)[_0xa851('0x2c')](handleEntityNotFound(_0x1202c3,null))[_0xa851('0x2c')](respondWithResult(_0x1202c3,null))[_0xa851('0x4f')](handleError(_0x1202c3,null));};exports[_0xa851('0x54')]=function(_0x578e31,_0x327250){return db[_0xa851('0x37')]['create'](_0x578e31[_0xa851('0x55')],{})[_0xa851('0x2c')](function(_0x5709ea){var _0x8a159a=_0x578e31[_0xa851('0x56')][_0xa851('0x2e')]({'plain':!![]});if(!_0x8a159a)throw new Error(_0xa851('0x57'));if(_0x8a159a[_0xa851('0x58')]===_0xa851('0x56')){var _0x57df78=_0x5709ea[_0xa851('0x2e')]({'plain':!![]});var _0x1c5494=_0xa851('0x2f');return db[_0xa851('0x59')][_0xa851('0x53')]({'where':{'name':_0x1c5494,'userProfileId':_0x8a159a[_0xa851('0x5a')]},'raw':!![]})[_0xa851('0x2c')](function(_0x27136a){if(_0x27136a&&_0x27136a[_0xa851('0x5b')]===0x0){return db[_0xa851('0x30')][_0xa851('0x54')]({'name':_0x57df78[_0xa851('0x33')],'resourceId':_0x57df78['id'],'type':_0x27136a[_0xa851('0x33')],'sectionId':_0x27136a['id']},{})[_0xa851('0x2c')](function(){return _0x5709ea;});}else{return _0x5709ea;}})['catch'](function(_0x27d65f){logger[_0xa851('0x31')](_0xa851('0x5c'),_0x27d65f);throw _0x27d65f;});}return _0x5709ea;})[_0xa851('0x2c')](respondWithResult(_0x327250,0xc9))[_0xa851('0x4f')](handleError(_0x327250,null));};exports[_0xa851('0x5d')]=function(_0x40c297,_0x6d6b4b){var _0x4d838b={'where':{'id':_0x40c297[_0xa851('0x5e')]['id']}},_0x421b74={};_0x421b74['model']=_['keys'](db[_0xa851('0x37')][_0xa851('0x38')]);_0x4d838b[_0xa851('0x3f')]=_[_0xa851('0x51')](_0x421b74[_0xa851('0x40')],qs[_0xa851('0x41')](_0x40c297[_0xa851('0x3c')][_0xa851('0x41')]));_0x4d838b[_0xa851('0x3f')]=_0x4d838b[_0xa851('0x3f')][_0xa851('0x42')]?_0x4d838b['attributes']:_0x421b74[_0xa851('0x40')];if(_0x40c297[_0xa851('0x3c')][_0xa851('0x52')]){_0x4d838b[_0xa851('0x4d')]=[{'all':!![]}];}_0x4d838b=_[_0xa851('0x4a')]({},_0x4d838b,_0x40c297[_0xa851('0x4c')]);return db[_0xa851('0x37')][_0xa851('0x53')](_0x4d838b)['then'](handleEntityNotFound(_0x6d6b4b,null))[_0xa851('0x2c')](function(_0x4eeab1){if(_0x4eeab1){var _0x23f368=_0x4eeab1['get']({'plain':!![]});_0x23f368=qs[_0xa851('0x5f')](_0x23f368,['id',_0xa851('0x60'),_0xa851('0x61')]);_0x40c297['body']=_[_0xa851('0x5f')](_0x40c297['body'],['id','createdAt','updatedAt']);return db['Dashboard'][_0xa851('0x54')](_[_0xa851('0x4a')](_0x23f368,_0x40c297[_0xa851('0x55')]),{'include':_0x40c297[_0xa851('0x3c')][_0xa851('0x52')]?[{'all':!![]}]:undefined})[_0xa851('0x2c')](function(_0x4cec8a){var _0x166f2f=_0x40c297['user']['get']({'plain':!![]});if(!_0x166f2f)throw new Error(_0xa851('0x57'));if(_0x166f2f[_0xa851('0x58')]===_0xa851('0x56')){var _0x17dd76=_0x4cec8a[_0xa851('0x2e')]({'plain':!![]});var _0x29f98c=_0xa851('0x2f');return db[_0xa851('0x59')][_0xa851('0x53')]({'where':{'name':_0x29f98c,'userProfileId':_0x166f2f[_0xa851('0x5a')]},'raw':!![]})[_0xa851('0x2c')](function(_0x40bece){if(_0x40bece&&_0x40bece['autoAssociation']===0x0){return db[_0xa851('0x30')][_0xa851('0x54')]({'name':_0x17dd76[_0xa851('0x33')],'resourceId':_0x17dd76['id'],'type':_0x40bece['name'],'sectionId':_0x40bece['id']},{})[_0xa851('0x2c')](function(){return _0x4cec8a;});}else{return _0x4cec8a;}})[_0xa851('0x4f')](function(_0x283531){logger[_0xa851('0x31')](_0xa851('0x5c'),_0x283531);throw _0x283531;});}return _0x4cec8a;});}})[_0xa851('0x2c')](respondWithResult(_0x6d6b4b,0xc9))['catch'](handleError(_0x6d6b4b,null));};exports[_0xa851('0x2b')]=function(_0x51d9e2,_0x3215fa){if(_0x51d9e2[_0xa851('0x55')]['id']){delete _0x51d9e2[_0xa851('0x55')]['id'];}return db[_0xa851('0x37')][_0xa851('0x53')]({'where':{'id':_0x51d9e2[_0xa851('0x5e')]['id']}})[_0xa851('0x2c')](handleEntityNotFound(_0x3215fa,null))[_0xa851('0x2c')](saveUpdates(_0x51d9e2['body'],null))[_0xa851('0x2c')](respondWithResult(_0x3215fa,null))['catch'](handleError(_0x3215fa,null));};exports[_0xa851('0x2d')]=function(_0x3d44da,_0x348955){return db['Dashboard']['find']({'where':{'id':_0x3d44da[_0xa851('0x5e')]['id']}})['then'](handleEntityNotFound(_0x348955,null))['then'](removeEntity(_0x348955,null))[_0xa851('0x4f')](handleError(_0x348955,null));};function widgetAttributes(_0x296826){try{switch(_0x296826[_0xa851('0x3a')]){case _0xa851('0x62'):return[{'name':_0xa851('0x63'),'value':_0x296826[_0xa851('0x63')]||(_0x296826[_0xa851('0x64')]&&_0x296826[_0xa851('0x64')][0x0]?_0x296826[_0xa851('0x64')][0x0]['value']:undefined)||_0xa851('0x65')}];case'custom':return[{'name':_0xa851('0x66'),'value':_0x296826['attrPath']||(_0x296826[_0xa851('0x64')]&&_0x296826[_0xa851('0x64')][0x0]?_0x296826[_0xa851('0x64')][0x0][_0xa851('0x67')]:undefined)||''}];case _0xa851('0x68'):return[{'name':_0xa851('0x69'),'value':_0x296826[_0xa851('0x69')]||(_0x296826['attrs']&&_0x296826[_0xa851('0x64')][0x0]?_0x296826['attrs'][0x0]['value']:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x296826[_0xa851('0x6a')]||(_0x296826[_0xa851('0x64')]&&_0x296826[_0xa851('0x64')][0x1]?_0x296826[_0xa851('0x64')][0x1][_0xa851('0x67')]:undefined)||_0xa851('0x6b')},{'name':_0xa851('0x6c'),'value':_0x296826[_0xa851('0x6c')]||(_0x296826[_0xa851('0x64')]&&_0x296826[_0xa851('0x64')][0x2]?_0x296826['attrs'][0x2][_0xa851('0x67')]:undefined)||0xc}];case _0xa851('0x6d'):return[{'name':'attrMetric','value':_0x296826[_0xa851('0x6e')]||(_0x296826['attrs']&&_0x296826[_0xa851('0x64')][0x0]?_0x296826[_0xa851('0x64')][0x0][_0xa851('0x67')]:undefined)||_0xa851('0x6f')},{'name':_0xa851('0x70'),'value':_0x296826[_0xa851('0x70')]||(_0x296826['attrs']&&_0x296826[_0xa851('0x64')][0x1]?_0x296826[_0xa851('0x64')][0x1][_0xa851('0x67')]:undefined)||[]},{'name':_0xa851('0x6c'),'value':_0x296826['attrFontSize']||(_0x296826['attrs']&&_0x296826['attrs'][0x2]?_0x296826[_0xa851('0x64')][0x2]['value']:undefined)||0x14}];case _0xa851('0x71'):case _0xa851('0x72'):return[{'name':_0xa851('0x73'),'value':_0x296826[_0xa851('0x73')]||(_0x296826['attrs']&&_0x296826[_0xa851('0x64')][0x0]?_0x296826[_0xa851('0x64')][0x0][_0xa851('0x67')]:undefined)||'total'},{'name':_0xa851('0x74'),'value':_0x296826[_0xa851('0x74')]||(_0x296826['attrs']&&_0x296826[_0xa851('0x64')][0x1]?_0x296826[_0xa851('0x64')][0x1]['value']:undefined)||null},{'name':_0xa851('0x75'),'value':_0x296826[_0xa851('0x75')]||(_0x296826[_0xa851('0x64')]&&_0x296826['attrs'][0x2]?_0x296826['attrs'][0x2][_0xa851('0x67')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x296826[_0xa851('0x70')]||(_0x296826['attrs']&&_0x296826[_0xa851('0x64')][0x3]?_0x296826[_0xa851('0x64')][0x3][_0xa851('0x67')]:undefined)||[]}];case'web-report':return[{'name':_0xa851('0x76'),'type':_0x296826[_0xa851('0x77')]||(_0x296826[_0xa851('0x64')]&&_0x296826[_0xa851('0x64')][0x0]?_0x296826[_0xa851('0x64')][0x0][_0xa851('0x3a')]:undefined)||null,'value':_0x296826[_0xa851('0x76')]||(_0x296826[_0xa851('0x64')]&&_0x296826[_0xa851('0x64')][0x0]?_0x296826[_0xa851('0x64')][0x0][_0xa851('0x67')]:undefined)||null},{'name':_0xa851('0x78'),'value':_0x296826['attrRefresh']||(_0x296826[_0xa851('0x64')]&&_0x296826[_0xa851('0x64')][0x1]?_0x296826[_0xa851('0x64')][0x1][_0xa851('0x67')]:undefined)||0x0}];default:return[];}}catch(_0x32b906){logger[_0xa851('0x31')](_0xa851('0x79'),JSON[_0xa851('0x7a')](_0x32b906));return[];}}exports[_0xa851('0x7b')]=function(_0x5d4772,_0x438cf4,_0x101e34){if(_0x5d4772[_0xa851('0x55')]['id']){delete _0x5d4772['body']['id'];}return db['Dashboard'][_0xa851('0x53')]({'where':{'id':_0x5d4772['params']['id']}})[_0xa851('0x2c')](handleEntityNotFound(_0x438cf4,null))['then'](function(_0x1eab1d){if(_0x1eab1d){_0x5d4772[_0xa851('0x55')][_0xa851('0x7c')]=_0x1eab1d['id'];_0x5d4772['body'][_0xa851('0x64')]=widgetAttributes(_0x5d4772[_0xa851('0x55')]);return db[_0xa851('0x7d')][_0xa851('0x54')](_0x5d4772[_0xa851('0x55')]);}})[_0xa851('0x2c')](respondWithResult(_0x438cf4,null))[_0xa851('0x4f')](handleError(_0x438cf4,null));};exports[_0xa851('0x7e')]=function(_0x30350c,_0x206c44,_0x3a71d5){var _0x424554={};var _0x85c1ea={};var _0x11a1e3;var _0x280ce0;return db[_0xa851('0x37')][_0xa851('0x7f')]({'where':{'id':_0x30350c[_0xa851('0x5e')]['id']}})['then'](handleEntityNotFound(_0x206c44,null))[_0xa851('0x2c')](function(_0x51f3d5){if(_0x51f3d5){_0x11a1e3=_0x51f3d5;_0x85c1ea[_0xa851('0x40')]=_[_0xa851('0x3d')](db[_0xa851('0x7d')]['rawAttributes']);_0x85c1ea[_0xa851('0x3c')]=_[_0xa851('0x3d')](_0x30350c[_0xa851('0x3c')]);_0x85c1ea['filters']=_[_0xa851('0x51')](_0x85c1ea[_0xa851('0x40')],_0x85c1ea[_0xa851('0x3c')]);_0x424554['attributes']=_['intersection'](_0x85c1ea[_0xa851('0x40')],qs[_0xa851('0x41')](_0x30350c['query'][_0xa851('0x41')]));_0x424554[_0xa851('0x3f')]=_0x424554[_0xa851('0x3f')][_0xa851('0x42')]?_0x424554[_0xa851('0x3f')]:_0x85c1ea['model'];_0x424554[_0xa851('0x45')]=qs[_0xa851('0x46')](_0x30350c[_0xa851('0x3c')][_0xa851('0x46')]);_0x424554['where']=qs['filters'](_[_0xa851('0x48')](_0x30350c[_0xa851('0x3c')],_0x85c1ea[_0xa851('0x3e')]));if(_0x30350c[_0xa851('0x3c')][_0xa851('0x49')]){_0x424554[_0xa851('0x47')]=_[_0xa851('0x4a')](_0x424554[_0xa851('0x47')],{'$or':_['map'](_0x424554[_0xa851('0x3f')],function(_0x103d7a){var _0x4b3c8f={};_0x4b3c8f[_0x103d7a]={'$like':'%'+_0x30350c['query'][_0xa851('0x49')]+'%'};return _0x4b3c8f;})});}_0x424554=_[_0xa851('0x4a')]({},_0x424554,_0x30350c[_0xa851('0x4c')]);return _0x11a1e3[_0xa851('0x7e')](_0x424554);}})[_0xa851('0x2c')](function(_0x4e4c3d){if(_0x4e4c3d){_0x280ce0=_0x4e4c3d[_0xa851('0x42')];if(!_0x30350c[_0xa851('0x3c')][_0xa851('0x43')](_0xa851('0x44'))){_0x424554['limit']=qs[_0xa851('0x25')](_0x30350c['query'][_0xa851('0x25')]);_0x424554['offset']=qs[_0xa851('0x24')](_0x30350c[_0xa851('0x3c')]['offset']);}return _0x11a1e3[_0xa851('0x7e')](_0x424554);}})[_0xa851('0x2c')](function(_0x1e646b){if(_0x1e646b){return _0x1e646b?{'count':_0x280ce0,'rows':_0x1e646b}:null;}})[_0xa851('0x2c')](respondWithResult(_0x206c44,null))['catch'](handleError(_0x206c44,null));}; \ No newline at end of file +var _0x0b8f=['attrs','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','get','CustomDashboards','UserProfileResource','then','sendStatus','error','name','send','map','Dashboard','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','findAll','catch','params','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','updatedAt','body','omit','createdAt','iframe','attrUrl','value','https://','attrPath'];(function(_0x2935b2,_0x2aa718){var _0x58e217=function(_0x330c42){while(--_0x330c42){_0x2935b2['push'](_0x2935b2['shift']());}};_0x58e217(++_0x2aa718);}(_0x0b8f,0x174));var _0xf0b8=function(_0x39da61,_0x564f62){_0x39da61=_0x39da61-0x0;var _0x443d10=_0x0b8f[_0x39da61];return _0x443d10;};'use strict';var pdf=require(_0xf0b8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf0b8('0x1'));var zipdir=require(_0xf0b8('0x2'));var jsonpatch=require(_0xf0b8('0x3'));var rp=require(_0xf0b8('0x4'));var moment=require(_0xf0b8('0x5'));var BPromise=require(_0xf0b8('0x6'));var Mustache=require(_0xf0b8('0x7'));var util=require(_0xf0b8('0x8'));var path=require(_0xf0b8('0x9'));var sox=require(_0xf0b8('0xa'));var csv=require(_0xf0b8('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf0b8('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf0b8('0xd'));var Papa=require(_0xf0b8('0xe'));var Redis=require(_0xf0b8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf0b8('0x10'));var as=require(_0xf0b8('0x11'));var hardwareService=require(_0xf0b8('0x12'));var logger=require('../../config/logger')(_0xf0b8('0x13'));var utils=require('../../config/utils');var config=require(_0xf0b8('0x14'));var db=require(_0xf0b8('0x15'))['db'];config[_0xf0b8('0x16')]=_[_0xf0b8('0x17')](config[_0xf0b8('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xf0b8('0x18'))(new Redis(config['redis']));require(_0xf0b8('0x19'))[_0xf0b8('0x1a')](socket);function respondWithStatusCode(_0x40f1fb,_0xa504d6){_0xa504d6=_0xa504d6||0xcc;return function(_0x57b58a){if(_0x57b58a){return _0x40f1fb['sendStatus'](_0xa504d6);}return _0x40f1fb[_0xf0b8('0x1b')](_0xa504d6)['end']();};}function respondWithResult(_0x3c86dd,_0x26d0e2){_0x26d0e2=_0x26d0e2||0xc8;return function(_0x43947f){if(_0x43947f){return _0x3c86dd[_0xf0b8('0x1b')](_0x26d0e2)[_0xf0b8('0x1c')](_0x43947f);}};}function respondWithFilteredResult(_0x3647d2,_0x50adbe){return function(_0x1d0f32){if(_0x1d0f32){var _0x15ccff=_0x1d0f32[_0xf0b8('0x1d')],_0x1f7e4c=_0x50adbe[_0xf0b8('0x1e')],_0x2b1bd9=_0x50adbe[_0xf0b8('0x1e')]+_0x50adbe[_0xf0b8('0x1f')],_0x558638;if(_0x2b1bd9>=_0x15ccff){_0x2b1bd9=_0x15ccff;_0x558638=0xc8;}else{_0x558638=0xce;}_0x3647d2[_0xf0b8('0x1b')](_0x558638);return _0x3647d2[_0xf0b8('0x20')](_0xf0b8('0x21'),_0x1f7e4c+'-'+_0x2b1bd9+'/'+_0x15ccff)['json'](_0x1d0f32);}return null;};}function patchUpdates(_0x576d69){return function(_0x3c73db){try{jsonpatch[_0xf0b8('0x22')](_0x3c73db,_0x576d69,!![]);}catch(_0x25f8ea){return BPromise['reject'](_0x25f8ea);}return _0x3c73db[_0xf0b8('0x23')]();};}function saveUpdates(_0x273376,_0x34f3e1){return function(_0x2ed94a){if(_0x2ed94a){return _0x2ed94a[_0xf0b8('0x24')](_0x273376)['then'](function(_0x4c5ed0){return _0x4c5ed0;});}return null;};}function removeEntity(_0x1fde31,_0x1a8a71){return function(_0xfe40cc){if(_0xfe40cc){return _0xfe40cc[_0xf0b8('0x25')]()['then'](function(){var _0x17c805=_0xfe40cc[_0xf0b8('0x26')]({'plain':!![]});var _0x1ad930=_0xf0b8('0x27');return db[_0xf0b8('0x28')]['destroy']({'where':{'type':_0x1ad930,'resourceId':_0x17c805['id']}})[_0xf0b8('0x29')](function(){return _0xfe40cc;});})[_0xf0b8('0x29')](function(){_0x1fde31[_0xf0b8('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13457b,_0x548aa5){return function(_0x45f09f){if(!_0x45f09f){_0x13457b[_0xf0b8('0x2a')](0x194);}return _0x45f09f;};}function handleError(_0xa6c188,_0x37b8ec){_0x37b8ec=_0x37b8ec||0x1f4;return function(_0x403de1){logger[_0xf0b8('0x2b')](_0x403de1['stack']);if(_0x403de1[_0xf0b8('0x2c')]){delete _0x403de1[_0xf0b8('0x2c')];}_0xa6c188[_0xf0b8('0x1b')](_0x37b8ec)[_0xf0b8('0x2d')](_0x403de1);};}exports['index']=function(_0x3d3b78,_0x3c8e12){var _0x87b77={},_0x517f34={},_0x48f1a1={'count':0x0,'rows':[]};var _0x40d721=_[_0xf0b8('0x2e')](db[_0xf0b8('0x2f')]['rawAttributes'],function(_0x25fe06){return{'name':_0x25fe06['fieldName'],'type':_0x25fe06[_0xf0b8('0x30')][_0xf0b8('0x31')]};});_0x517f34['model']=_[_0xf0b8('0x2e')](_0x40d721,'name');_0x517f34[_0xf0b8('0x32')]=_[_0xf0b8('0x33')](_0x3d3b78[_0xf0b8('0x32')]);_0x517f34['filters']=_[_0xf0b8('0x34')](_0x517f34[_0xf0b8('0x35')],_0x517f34['query']);_0x87b77[_0xf0b8('0x36')]=_[_0xf0b8('0x34')](_0x517f34[_0xf0b8('0x35')],qs[_0xf0b8('0x37')](_0x3d3b78[_0xf0b8('0x32')][_0xf0b8('0x37')]));_0x87b77[_0xf0b8('0x36')]=_0x87b77[_0xf0b8('0x36')][_0xf0b8('0x38')]?_0x87b77['attributes']:_0x517f34[_0xf0b8('0x35')];if(!_0x3d3b78[_0xf0b8('0x32')][_0xf0b8('0x39')](_0xf0b8('0x3a'))){_0x87b77[_0xf0b8('0x1f')]=qs[_0xf0b8('0x1f')](_0x3d3b78['query'][_0xf0b8('0x1f')]);_0x87b77[_0xf0b8('0x1e')]=qs['offset'](_0x3d3b78['query'][_0xf0b8('0x1e')]);}_0x87b77[_0xf0b8('0x3b')]=qs[_0xf0b8('0x3c')](_0x3d3b78['query'][_0xf0b8('0x3c')]);_0x87b77[_0xf0b8('0x3d')]=qs[_0xf0b8('0x3e')](_[_0xf0b8('0x3f')](_0x3d3b78[_0xf0b8('0x32')],_0x517f34[_0xf0b8('0x3e')]));if(_0x3d3b78[_0xf0b8('0x32')]['filter']){_0x87b77[_0xf0b8('0x3d')]=_[_0xf0b8('0x40')](_0x87b77[_0xf0b8('0x3d')],{'$or':_['map'](_0x40d721,function(_0x319998){if(_0x319998[_0xf0b8('0x30')]!==_0xf0b8('0x41')){var _0x2be5eb={};_0x2be5eb[_0x319998['name']]={'$like':'%'+_0x3d3b78['query'][_0xf0b8('0x42')]+'%'};return _0x2be5eb;}})});}_0x87b77=_[_0xf0b8('0x40')]({},_0x87b77,_0x3d3b78[_0xf0b8('0x43')]);var _0x253ed1={'where':_0x87b77['where']};return db[_0xf0b8('0x2f')]['count'](_0x253ed1)['then'](function(_0x1e3e04){_0x48f1a1[_0xf0b8('0x1d')]=_0x1e3e04;if(_0x3d3b78[_0xf0b8('0x32')]['includeAll']){_0x87b77['include']=[{'all':!![]}];}return db[_0xf0b8('0x2f')][_0xf0b8('0x44')](_0x87b77);})[_0xf0b8('0x29')](function(_0x36cfe1){_0x48f1a1['rows']=_0x36cfe1;return _0x48f1a1;})[_0xf0b8('0x29')](respondWithFilteredResult(_0x3c8e12,_0x87b77))[_0xf0b8('0x45')](handleError(_0x3c8e12,null));};exports['show']=function(_0x3eeffb,_0xa06872){var _0x5c31a0={'raw':![],'where':{'id':_0x3eeffb[_0xf0b8('0x46')]['id']}},_0x407386={};_0x407386[_0xf0b8('0x35')]=_['keys'](db['Dashboard']['rawAttributes']);_0x407386['query']=_[_0xf0b8('0x33')](_0x3eeffb[_0xf0b8('0x32')]);_0x407386[_0xf0b8('0x3e')]=_['intersection'](_0x407386[_0xf0b8('0x35')],_0x407386['query']);_0x5c31a0['attributes']=_[_0xf0b8('0x34')](_0x407386[_0xf0b8('0x35')],qs['fields'](_0x3eeffb[_0xf0b8('0x32')][_0xf0b8('0x37')]));_0x5c31a0[_0xf0b8('0x36')]=_0x5c31a0[_0xf0b8('0x36')][_0xf0b8('0x38')]?_0x5c31a0['attributes']:_0x407386['model'];if(_0x3eeffb['query'][_0xf0b8('0x47')]){_0x5c31a0['include']=[{'all':!![]}];}_0x5c31a0=_[_0xf0b8('0x40')]({},_0x5c31a0,_0x3eeffb[_0xf0b8('0x43')]);return db['Dashboard'][_0xf0b8('0x48')](_0x5c31a0)['then'](handleEntityNotFound(_0xa06872,null))[_0xf0b8('0x29')](respondWithResult(_0xa06872,null))[_0xf0b8('0x45')](handleError(_0xa06872,null));};exports[_0xf0b8('0x49')]=function(_0x329e36,_0x24e41e){return db['Dashboard'][_0xf0b8('0x49')](_0x329e36['body'],{})['then'](function(_0x379040){var _0x39bf48=_0x329e36['user'][_0xf0b8('0x26')]({'plain':!![]});if(!_0x39bf48)throw new Error(_0xf0b8('0x4a'));if(_0x39bf48[_0xf0b8('0x4b')]===_0xf0b8('0x4c')){var _0x122685=_0x379040[_0xf0b8('0x26')]({'plain':!![]});var _0x13a9a5='CustomDashboards';return db[_0xf0b8('0x4d')]['find']({'where':{'name':_0x13a9a5,'userProfileId':_0x39bf48[_0xf0b8('0x4e')]},'raw':!![]})[_0xf0b8('0x29')](function(_0x23a712){if(_0x23a712&&_0x23a712[_0xf0b8('0x4f')]===0x0){return db[_0xf0b8('0x28')][_0xf0b8('0x49')]({'name':_0x122685[_0xf0b8('0x2c')],'resourceId':_0x122685['id'],'type':_0x23a712[_0xf0b8('0x2c')],'sectionId':_0x23a712['id']},{})[_0xf0b8('0x29')](function(){return _0x379040;});}else{return _0x379040;}})[_0xf0b8('0x45')](function(_0x1f90d2){logger['error'](_0xf0b8('0x50'),_0x1f90d2);throw _0x1f90d2;});}return _0x379040;})[_0xf0b8('0x29')](respondWithResult(_0x24e41e,0xc9))[_0xf0b8('0x45')](handleError(_0x24e41e,null));};exports[_0xf0b8('0x51')]=function(_0x35f973,_0x54d953){var _0x375494={'where':{'id':_0x35f973[_0xf0b8('0x46')]['id']}},_0x23b4ab={};_0x23b4ab[_0xf0b8('0x35')]=_[_0xf0b8('0x33')](db['Dashboard'][_0xf0b8('0x52')]);_0x375494[_0xf0b8('0x36')]=_['intersection'](_0x23b4ab[_0xf0b8('0x35')],qs[_0xf0b8('0x37')](_0x35f973['query']['fields']));_0x375494[_0xf0b8('0x36')]=_0x375494[_0xf0b8('0x36')][_0xf0b8('0x38')]?_0x375494[_0xf0b8('0x36')]:_0x23b4ab[_0xf0b8('0x35')];if(_0x35f973[_0xf0b8('0x32')]['includeAll']){_0x375494['include']=[{'all':!![]}];}_0x375494=_['merge']({},_0x375494,_0x35f973[_0xf0b8('0x43')]);return db['Dashboard'][_0xf0b8('0x48')](_0x375494)['then'](handleEntityNotFound(_0x54d953,null))[_0xf0b8('0x29')](function(_0x2b2735){if(_0x2b2735){var _0x5c125f=_0x2b2735['get']({'plain':!![]});_0x5c125f=qs['omit'](_0x5c125f,['id','createdAt',_0xf0b8('0x53')]);_0x35f973[_0xf0b8('0x54')]=_[_0xf0b8('0x55')](_0x35f973[_0xf0b8('0x54')],['id',_0xf0b8('0x56'),_0xf0b8('0x53')]);return db[_0xf0b8('0x2f')][_0xf0b8('0x49')](_['merge'](_0x5c125f,_0x35f973[_0xf0b8('0x54')]),{'include':_0x35f973[_0xf0b8('0x32')]['includeAll']?[{'all':!![]}]:undefined})[_0xf0b8('0x29')](function(_0x378cc4){var _0x4568b6=_0x35f973[_0xf0b8('0x4c')][_0xf0b8('0x26')]({'plain':!![]});if(!_0x4568b6)throw new Error(_0xf0b8('0x4a'));if(_0x4568b6[_0xf0b8('0x4b')]==='user'){var _0x9cdcb0=_0x378cc4[_0xf0b8('0x26')]({'plain':!![]});var _0x3b6849=_0xf0b8('0x27');return db[_0xf0b8('0x4d')]['find']({'where':{'name':_0x3b6849,'userProfileId':_0x4568b6['userProfileId']},'raw':!![]})[_0xf0b8('0x29')](function(_0x54e377){if(_0x54e377&&_0x54e377[_0xf0b8('0x4f')]===0x0){return db[_0xf0b8('0x28')][_0xf0b8('0x49')]({'name':_0x9cdcb0['name'],'resourceId':_0x9cdcb0['id'],'type':_0x54e377['name'],'sectionId':_0x54e377['id']},{})['then'](function(){return _0x378cc4;});}else{return _0x378cc4;}})[_0xf0b8('0x45')](function(_0x4f3456){logger[_0xf0b8('0x2b')](_0xf0b8('0x50'),_0x4f3456);throw _0x4f3456;});}return _0x378cc4;});}})[_0xf0b8('0x29')](respondWithResult(_0x54d953,0xc9))[_0xf0b8('0x45')](handleError(_0x54d953,null));};exports[_0xf0b8('0x24')]=function(_0x5b5c89,_0xc21645){if(_0x5b5c89[_0xf0b8('0x54')]['id']){delete _0x5b5c89[_0xf0b8('0x54')]['id'];}return db[_0xf0b8('0x2f')]['find']({'where':{'id':_0x5b5c89['params']['id']}})[_0xf0b8('0x29')](handleEntityNotFound(_0xc21645,null))[_0xf0b8('0x29')](saveUpdates(_0x5b5c89['body'],null))[_0xf0b8('0x29')](respondWithResult(_0xc21645,null))[_0xf0b8('0x45')](handleError(_0xc21645,null));};exports[_0xf0b8('0x25')]=function(_0x18558e,_0xaf7938){return db['Dashboard'][_0xf0b8('0x48')]({'where':{'id':_0x18558e['params']['id']}})['then'](handleEntityNotFound(_0xaf7938,null))[_0xf0b8('0x29')](removeEntity(_0xaf7938,null))[_0xf0b8('0x45')](handleError(_0xaf7938,null));};function widgetAttributes(_0x5d11fc){try{switch(_0x5d11fc['type']){case _0xf0b8('0x57'):return[{'name':_0xf0b8('0x58'),'value':_0x5d11fc[_0xf0b8('0x58')]||(_0x5d11fc['attrs']&&_0x5d11fc['attrs'][0x0]?_0x5d11fc['attrs'][0x0][_0xf0b8('0x59')]:undefined)||_0xf0b8('0x5a')}];case'custom':return[{'name':_0xf0b8('0x5b'),'value':_0x5d11fc['attrPath']||(_0x5d11fc[_0xf0b8('0x5c')]&&_0x5d11fc['attrs'][0x0]?_0x5d11fc['attrs'][0x0][_0xf0b8('0x59')]:undefined)||''}];case _0xf0b8('0x5d'):return[{'name':_0xf0b8('0x5e'),'value':_0x5d11fc[_0xf0b8('0x5e')]||(_0x5d11fc[_0xf0b8('0x5c')]&&_0x5d11fc['attrs'][0x0]?_0x5d11fc[_0xf0b8('0x5c')][0x0][_0xf0b8('0x59')]:undefined)||_0xf0b8('0x5f')},{'name':'attrTimezone','value':_0x5d11fc[_0xf0b8('0x60')]||(_0x5d11fc[_0xf0b8('0x5c')]&&_0x5d11fc[_0xf0b8('0x5c')][0x1]?_0x5d11fc[_0xf0b8('0x5c')][0x1][_0xf0b8('0x59')]:undefined)||_0xf0b8('0x61')},{'name':'attrFontSize','value':_0x5d11fc[_0xf0b8('0x62')]||(_0x5d11fc[_0xf0b8('0x5c')]&&_0x5d11fc[_0xf0b8('0x5c')][0x2]?_0x5d11fc['attrs'][0x2][_0xf0b8('0x59')]:undefined)||0xc}];case _0xf0b8('0x63'):return[{'name':_0xf0b8('0x64'),'value':_0x5d11fc[_0xf0b8('0x64')]||(_0x5d11fc[_0xf0b8('0x5c')]&&_0x5d11fc['attrs'][0x0]?_0x5d11fc[_0xf0b8('0x5c')][0x0][_0xf0b8('0x59')]:undefined)||_0xf0b8('0x65')},{'name':_0xf0b8('0x66'),'value':_0x5d11fc[_0xf0b8('0x66')]||(_0x5d11fc[_0xf0b8('0x5c')]&&_0x5d11fc[_0xf0b8('0x5c')][0x1]?_0x5d11fc[_0xf0b8('0x5c')][0x1][_0xf0b8('0x59')]:undefined)||[]},{'name':_0xf0b8('0x62'),'value':_0x5d11fc[_0xf0b8('0x62')]||(_0x5d11fc['attrs']&&_0x5d11fc['attrs'][0x2]?_0x5d11fc['attrs'][0x2][_0xf0b8('0x59')]:undefined)||0x14}];case _0xf0b8('0x67'):case _0xf0b8('0x68'):return[{'name':'attrSerie1','value':_0x5d11fc[_0xf0b8('0x69')]||(_0x5d11fc['attrs']&&_0x5d11fc[_0xf0b8('0x5c')][0x0]?_0x5d11fc[_0xf0b8('0x5c')][0x0][_0xf0b8('0x59')]:undefined)||_0xf0b8('0x65')},{'name':_0xf0b8('0x6a'),'value':_0x5d11fc[_0xf0b8('0x6a')]||(_0x5d11fc['attrs']&&_0x5d11fc[_0xf0b8('0x5c')][0x1]?_0x5d11fc[_0xf0b8('0x5c')][0x1]['value']:undefined)||null},{'name':_0xf0b8('0x6b'),'value':_0x5d11fc[_0xf0b8('0x6b')]||(_0x5d11fc['attrs']&&_0x5d11fc[_0xf0b8('0x5c')][0x2]?_0x5d11fc['attrs'][0x2]['value']:undefined)||null},{'name':_0xf0b8('0x66'),'value':_0x5d11fc[_0xf0b8('0x66')]||(_0x5d11fc[_0xf0b8('0x5c')]&&_0x5d11fc['attrs'][0x3]?_0x5d11fc[_0xf0b8('0x5c')][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':_0xf0b8('0x6c'),'type':_0x5d11fc['reportType']||(_0x5d11fc[_0xf0b8('0x5c')]&&_0x5d11fc[_0xf0b8('0x5c')][0x0]?_0x5d11fc[_0xf0b8('0x5c')][0x0][_0xf0b8('0x30')]:undefined)||null,'value':_0x5d11fc['attrReport']||(_0x5d11fc[_0xf0b8('0x5c')]&&_0x5d11fc[_0xf0b8('0x5c')][0x0]?_0x5d11fc['attrs'][0x0][_0xf0b8('0x59')]:undefined)||null},{'name':_0xf0b8('0x6d'),'value':_0x5d11fc['attrRefresh']||(_0x5d11fc[_0xf0b8('0x5c')]&&_0x5d11fc[_0xf0b8('0x5c')][0x1]?_0x5d11fc[_0xf0b8('0x5c')][0x1][_0xf0b8('0x59')]:undefined)||0x0}];default:return[];}}catch(_0x24b49e){logger[_0xf0b8('0x2b')](_0xf0b8('0x6e'),JSON[_0xf0b8('0x6f')](_0x24b49e));return[];}}exports[_0xf0b8('0x70')]=function(_0x5cad6b,_0x56aac5,_0x104e19){if(_0x5cad6b[_0xf0b8('0x54')]['id']){delete _0x5cad6b[_0xf0b8('0x54')]['id'];}return db[_0xf0b8('0x2f')][_0xf0b8('0x48')]({'where':{'id':_0x5cad6b['params']['id']}})[_0xf0b8('0x29')](handleEntityNotFound(_0x56aac5,null))[_0xf0b8('0x29')](function(_0x5c1c89){if(_0x5c1c89){_0x5cad6b[_0xf0b8('0x54')][_0xf0b8('0x71')]=_0x5c1c89['id'];_0x5cad6b[_0xf0b8('0x54')][_0xf0b8('0x5c')]=widgetAttributes(_0x5cad6b[_0xf0b8('0x54')]);return db[_0xf0b8('0x72')]['create'](_0x5cad6b[_0xf0b8('0x54')]);}})[_0xf0b8('0x29')](respondWithResult(_0x56aac5,null))[_0xf0b8('0x45')](handleError(_0x56aac5,null));};exports[_0xf0b8('0x73')]=function(_0x3d9645,_0x2f68e2,_0x1a4ed5){var _0xe1e510={};var _0xe9b95a={};var _0x355cd2;var _0x2449e0;return db[_0xf0b8('0x2f')]['findOne']({'where':{'id':_0x3d9645['params']['id']}})[_0xf0b8('0x29')](handleEntityNotFound(_0x2f68e2,null))[_0xf0b8('0x29')](function(_0x47fe5c){if(_0x47fe5c){_0x355cd2=_0x47fe5c;_0xe9b95a[_0xf0b8('0x35')]=_['keys'](db[_0xf0b8('0x72')]['rawAttributes']);_0xe9b95a[_0xf0b8('0x32')]=_[_0xf0b8('0x33')](_0x3d9645['query']);_0xe9b95a[_0xf0b8('0x3e')]=_['intersection'](_0xe9b95a[_0xf0b8('0x35')],_0xe9b95a[_0xf0b8('0x32')]);_0xe1e510['attributes']=_[_0xf0b8('0x34')](_0xe9b95a['model'],qs['fields'](_0x3d9645[_0xf0b8('0x32')][_0xf0b8('0x37')]));_0xe1e510['attributes']=_0xe1e510[_0xf0b8('0x36')][_0xf0b8('0x38')]?_0xe1e510[_0xf0b8('0x36')]:_0xe9b95a[_0xf0b8('0x35')];_0xe1e510['order']=qs[_0xf0b8('0x3c')](_0x3d9645[_0xf0b8('0x32')]['sort']);_0xe1e510['where']=qs[_0xf0b8('0x3e')](_[_0xf0b8('0x3f')](_0x3d9645[_0xf0b8('0x32')],_0xe9b95a[_0xf0b8('0x3e')]));if(_0x3d9645[_0xf0b8('0x32')][_0xf0b8('0x42')]){_0xe1e510[_0xf0b8('0x3d')]=_[_0xf0b8('0x40')](_0xe1e510[_0xf0b8('0x3d')],{'$or':_[_0xf0b8('0x2e')](_0xe1e510[_0xf0b8('0x36')],function(_0x59c291){var _0x57c9a2={};_0x57c9a2[_0x59c291]={'$like':'%'+_0x3d9645[_0xf0b8('0x32')][_0xf0b8('0x42')]+'%'};return _0x57c9a2;})});}_0xe1e510=_[_0xf0b8('0x40')]({},_0xe1e510,_0x3d9645[_0xf0b8('0x43')]);return _0x355cd2['getItems'](_0xe1e510);}})[_0xf0b8('0x29')](function(_0x4aa3e6){if(_0x4aa3e6){_0x2449e0=_0x4aa3e6['length'];if(!_0x3d9645[_0xf0b8('0x32')]['hasOwnProperty'](_0xf0b8('0x3a'))){_0xe1e510[_0xf0b8('0x1f')]=qs['limit'](_0x3d9645[_0xf0b8('0x32')][_0xf0b8('0x1f')]);_0xe1e510[_0xf0b8('0x1e')]=qs[_0xf0b8('0x1e')](_0x3d9645['query']['offset']);}return _0x355cd2[_0xf0b8('0x73')](_0xe1e510);}})[_0xf0b8('0x29')](function(_0x2b8f34){if(_0x2b8f34){return _0x2b8f34?{'count':_0x2449e0,'rows':_0x2b8f34}:null;}})[_0xf0b8('0x29')](respondWithResult(_0x2f68e2,null))[_0xf0b8('0x45')](handleError(_0x2f68e2,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index d82e74f..ee1d0dd 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 _0xc9f1=['exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hook'];(function(_0x5e96bd,_0x534a7d){var _0x2af7ba=function(_0x1cf3ab){while(--_0x1cf3ab){_0x5e96bd['push'](_0x5e96bd['shift']());}};_0x2af7ba(++_0x534a7d);}(_0xc9f1,0x69));var _0x1c9f=function(_0x86ac53,_0xb5b1d5){_0x86ac53=_0x86ac53-0x0;var _0x318153=_0xc9f1[_0x86ac53];return _0x318153;};'use strict';var EventEmitter=require(_0x1c9f('0x0'));var Dashboard=require(_0x1c9f('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x1c9f('0x2')](0x0);var events={'afterCreate':_0x1c9f('0x3'),'afterUpdate':'update','afterDestroy':_0x1c9f('0x4')};function emitEvent(_0x84bc5b){return function(_0x2f3c51,_0x2875e8,_0x14ef9f){DashboardEvents[_0x1c9f('0x5')](_0x84bc5b+':'+_0x2f3c51['id'],_0x2f3c51);DashboardEvents['emit'](_0x84bc5b,_0x2f3c51);_0x14ef9f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x1c9f('0x6')](e,emitEvent(event));}}module[_0x1c9f('0x7')]=DashboardEvents; \ No newline at end of file +var _0xc934=['remove','hasOwnProperty','exports','../../mysqldb','Dashboard','update'];(function(_0x2094eb,_0x234a56){var _0x36e9af=function(_0x2e6285){while(--_0x2e6285){_0x2094eb['push'](_0x2094eb['shift']());}};_0x36e9af(++_0x234a56);}(_0xc934,0x1a7));var _0x4c93=function(_0x218c5a,_0x1e71b4){_0x218c5a=_0x218c5a-0x0;var _0x2bde6b=_0xc934[_0x218c5a];return _0x2bde6b;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x4c93('0x0'))['db'][_0x4c93('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4c93('0x2'),'afterDestroy':_0x4c93('0x3')};function emitEvent(_0xda05e0){return function(_0x2f77d2,_0x1e1383,_0x1ab427){DashboardEvents['emit'](_0xda05e0+':'+_0x2f77d2['id'],_0x2f77d2);DashboardEvents['emit'](_0xda05e0,_0x2f77d2);_0x1ab427(null);};}for(var e in events){if(events[_0x4c93('0x4')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x4c93('0x5')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 7540042..efc7ff5 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 _0xfbbe=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','dashboards'];(function(_0x4c73d9,_0x41cac8){var _0x2f2186=function(_0x1be03d){while(--_0x1be03d){_0x4c73d9['push'](_0x4c73d9['shift']());}};_0x2f2186(++_0x41cac8);}(_0xfbbe,0x1ec));var _0xefbb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfbbe[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xefbb('0x0'));var util=require('util');var logger=require(_0xefbb('0x1'))(_0xefbb('0x2'));var moment=require(_0xefbb('0x3'));var BPromise=require(_0xefbb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xefbb('0x5'));var rimraf=require(_0xefbb('0x6'));var config=require(_0xefbb('0x7'));var attributes=require(_0xefbb('0x8'));module[_0xefbb('0x9')]=function(_0x3db355,_0x3cab54){return _0x3db355[_0xefbb('0xa')]('Dashboard',attributes,{'tableName':_0xefbb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb20d=['exports','define','Dashboard','dashboards','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes'];(function(_0x3e9672,_0x439af9){var _0xfa2aac=function(_0x62cc79){while(--_0x62cc79){_0x3e9672['push'](_0x3e9672['shift']());}};_0xfa2aac(++_0x439af9);}(_0xb20d,0x17d));var _0xdb20=function(_0x39ce5a,_0x260622){_0x39ce5a=_0x39ce5a-0x0;var _0x46cd9a=_0xb20d[_0x39ce5a];return _0x46cd9a;};'use strict';var _=require('lodash');var util=require(_0xdb20('0x0'));var logger=require(_0xdb20('0x1'))(_0xdb20('0x2'));var moment=require(_0xdb20('0x3'));var BPromise=require(_0xdb20('0x4'));var rp=require(_0xdb20('0x5'));var fs=require('fs');var path=require(_0xdb20('0x6'));var rimraf=require('rimraf');var config=require(_0xdb20('0x7'));var attributes=require(_0xdb20('0x8'));module[_0xdb20('0x9')]=function(_0x386ec3,_0x3920f0){return _0x386ec3[_0xdb20('0xa')](_0xdb20('0xb'),attributes,{'tableName':_0xdb20('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 156b99a..755e267 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 _0x4148=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util'];(function(_0x23ea5b,_0x322fa6){var _0x1c0695=function(_0x5e10a4){while(--_0x5e10a4){_0x23ea5b['push'](_0x23ea5b['shift']());}};_0x1c0695(++_0x322fa6);}(_0x4148,0xc6));var _0x8414=function(_0xdb576,_0x13705e){_0xdb576=_0xdb576-0x0;var _0x98a94b=_0x4148[_0xdb576];return _0x98a94b;};'use strict';var _=require(_0x8414('0x0'));var util=require(_0x8414('0x1'));var moment=require(_0x8414('0x2'));var BPromise=require(_0x8414('0x3'));var rs=require(_0x8414('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8414('0x5'))['db'];var utils=require(_0x8414('0x6'));var logger=require(_0x8414('0x7'))(_0x8414('0x8'));var config=require('../../config/environment');var jayson=require(_0x8414('0x9'));var client=jayson['client'][_0x8414('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x8414('0xb')],{'host':_0x8414('0xc'),'port':0x18eb});var socket=require(_0x8414('0xd'))(new Redis(config[_0x8414('0xb')]));require(_0x8414('0xe'))[_0x8414('0xf')](socket);function respondWithRpcPromise(_0x8f4e97,_0x1c102a,_0x913591){return new BPromise(function(_0x28d8b4,_0x9e85e1){return client['request'](_0x8f4e97,_0x913591)[_0x8414('0x10')](function(_0x4b2f1c){logger[_0x8414('0x11')](_0x8414('0x12'),_0x1c102a,_0x8414('0x13'));logger[_0x8414('0x14')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x1c102a,_0x8414('0x13'),JSON['stringify'](_0x4b2f1c));if(_0x4b2f1c[_0x8414('0x15')]){if(_0x4b2f1c[_0x8414('0x15')][_0x8414('0x16')]===0x1f4){logger['error'](_0x8414('0x12'),_0x1c102a,_0x4b2f1c[_0x8414('0x15')][_0x8414('0x17')]);return _0x9e85e1(_0x4b2f1c['error']['message']);}logger[_0x8414('0x15')](_0x8414('0x12'),_0x1c102a,_0x4b2f1c[_0x8414('0x15')][_0x8414('0x17')]);return _0x28d8b4(_0x4b2f1c['error'][_0x8414('0x17')]);}else{logger[_0x8414('0x11')](_0x8414('0x12'),_0x1c102a,_0x8414('0x13'));_0x28d8b4(_0x4b2f1c['result']['message']);}})[_0x8414('0x18')](function(_0x5c4b4c){logger[_0x8414('0x15')](_0x8414('0x12'),_0x1c102a,_0x5c4b4c);_0x9e85e1(_0x5c4b4c);});});} \ No newline at end of file +var _0xa5f8=['debug','stringify','code','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent'];(function(_0x243cca,_0x514c2d){var _0xf94771=function(_0x42d3de){while(--_0x42d3de){_0x243cca['push'](_0x243cca['shift']());}};_0xf94771(++_0x514c2d);}(_0xa5f8,0x1d1));var _0x8a5f=function(_0x58eb07,_0x3296bd){_0x58eb07=_0x58eb07-0x0;var _0x55d693=_0xa5f8[_0x58eb07];return _0x55d693;};'use strict';var _=require(_0x8a5f('0x0'));var util=require(_0x8a5f('0x1'));var moment=require(_0x8a5f('0x2'));var BPromise=require(_0x8a5f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a5f('0x4'));var db=require(_0x8a5f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8a5f('0x6'))(_0x8a5f('0x7'));var config=require(_0x8a5f('0x8'));var jayson=require(_0x8a5f('0x9'));var client=jayson[_0x8a5f('0xa')][_0x8a5f('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x8a5f('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8a5f('0xd'))(new Redis(config[_0x8a5f('0xc')]));require(_0x8a5f('0xe'))[_0x8a5f('0xf')](socket);function respondWithRpcPromise(_0x2a94ed,_0x39df98,_0x22f206){return new BPromise(function(_0x209fc5,_0x440401){return client[_0x8a5f('0x10')](_0x2a94ed,_0x22f206)[_0x8a5f('0x11')](function(_0x49bb0b){logger[_0x8a5f('0x12')](_0x8a5f('0x13'),_0x39df98,_0x8a5f('0x14'));logger[_0x8a5f('0x15')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x39df98,_0x8a5f('0x14'),JSON[_0x8a5f('0x16')](_0x49bb0b));if(_0x49bb0b['error']){if(_0x49bb0b['error'][_0x8a5f('0x17')]===0x1f4){logger[_0x8a5f('0x18')](_0x8a5f('0x13'),_0x39df98,_0x49bb0b[_0x8a5f('0x18')]['message']);return _0x440401(_0x49bb0b[_0x8a5f('0x18')][_0x8a5f('0x19')]);}logger[_0x8a5f('0x18')](_0x8a5f('0x13'),_0x39df98,_0x49bb0b[_0x8a5f('0x18')][_0x8a5f('0x19')]);return _0x209fc5(_0x49bb0b[_0x8a5f('0x18')][_0x8a5f('0x19')]);}else{logger['info'](_0x8a5f('0x13'),_0x39df98,_0x8a5f('0x14'));_0x209fc5(_0x49bb0b['result'][_0x8a5f('0x19')]);}})[_0x8a5f('0x1a')](function(_0x3e876b){logger[_0x8a5f('0x18')]('Dashboard,\x20%s,\x20%s',_0x39df98,_0x3e876b);_0x440401(_0x3e876b);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index e667bfb..0863c6e 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 _0x6cfd=['removeListener','length','dashboard:','./dashboard.events','save','update','emit'];(function(_0x35c1bc,_0x3452cc){var _0x224f53=function(_0x15aeb3){while(--_0x15aeb3){_0x35c1bc['push'](_0x35c1bc['shift']());}};_0x224f53(++_0x3452cc);}(_0x6cfd,0x88));var _0xd6cf=function(_0x515882,_0x238b19){_0x515882=_0x515882-0x0;var _0x49ce67=_0x6cfd[_0x515882];return _0x49ce67;};'use strict';var DashboardEvents=require(_0xd6cf('0x0'));var events=[_0xd6cf('0x1'),'remove',_0xd6cf('0x2')];function createListener(_0x2c19ff,_0x51d828){return function(_0x37b2ec){_0x51d828[_0xd6cf('0x3')](_0x2c19ff,_0x37b2ec);};}function removeListener(_0x187db8,_0x5e6f64){return function(){DashboardEvents[_0xd6cf('0x4')](_0x187db8,_0x5e6f64);};}exports['register']=function(_0x2d4b0d){for(var _0x2c8154=0x0,_0x58c672=events[_0xd6cf('0x5')];_0x2c8154<_0x58c672;_0x2c8154++){var _0x293997=events[_0x2c8154];var _0x4a4cf1=createListener(_0xd6cf('0x6')+_0x293997,_0x2d4b0d);DashboardEvents['on'](_0x293997,_0x4a4cf1);}}; \ No newline at end of file +var _0xe57c=['update','removeListener','register','./dashboard.events'];(function(_0x3ecc86,_0x4df963){var _0x2d3d31=function(_0x1e34c0){while(--_0x1e34c0){_0x3ecc86['push'](_0x3ecc86['shift']());}};_0x2d3d31(++_0x4df963);}(_0xe57c,0x1c3));var _0xce57=function(_0x426bb9,_0x2bea77){_0x426bb9=_0x426bb9-0x0;var _0x500938=_0xe57c[_0x426bb9];return _0x500938;};'use strict';var DashboardEvents=require(_0xce57('0x0'));var events=['save','remove',_0xce57('0x1')];function createListener(_0x43827c,_0x22025c){return function(_0x599fc8){_0x22025c['emit'](_0x43827c,_0x599fc8);};}function removeListener(_0x500707,_0x53ba09){return function(){DashboardEvents[_0xce57('0x2')](_0x500707,_0x53ba09);};}exports[_0xce57('0x3')]=function(_0x3377e4){for(var _0x49933b=0x0,_0x19c8bc=events['length'];_0x49933b<_0x19c8bc;_0x49933b++){var _0x267327=events[_0x49933b];var _0x141615=createListener('dashboard:'+_0x267327,_0x3377e4);DashboardEvents['on'](_0x267327,_0x141615);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 1634433..1c8a241 100644 --- a/server/api/dashboard/index.js +++ b/server/api/dashboard/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','update','delete','multer','util','path','express','Router'];(function(_0x5ba513,_0x459c3b){var _0x1132a0=function(_0x2fe943){while(--_0x2fe943){_0x5ba513['push'](_0x5ba513['shift']());}};_0x1132a0(++_0x459c3b);}(_0xe706,0xa3));var _0x6e70=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0xe706[_0x43f881];return _0x365c14;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x9')](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x10')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x10')](_0x6e70('0x12'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);router['post']('/:id/items',auth[_0x6e70('0xa')](),controller[_0x6e70('0x14')]);router[_0x6e70('0x15')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa9e0=['/:id','/:id/items','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated'];(function(_0x474078,_0x2c68b3){var _0x57ea5b=function(_0x53ab86){while(--_0x53ab86){_0x474078['push'](_0x474078['shift']());}};_0x57ea5b(++_0x2c68b3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getItems']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xb')](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['clone']);router['post']('/:id/items',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 07b5f48..3da591c 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 _0x5d2e=['lodash','exports','STRING','TEXT','long','parse','attrs','setDataValue','stringify','INTEGER','sequelize','squel'];(function(_0x403fe9,_0x4853f0){var _0x9b5e77=function(_0x5fc61b){while(--_0x5fc61b){_0x403fe9['push'](_0x403fe9['shift']());}};_0x9b5e77(++_0x4853f0);}(_0x5d2e,0xd6));var _0xe5d2=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x5d2e[_0x55f8b4];return _0x2475f9;};'use strict';var Sequelize=require(_0xe5d2('0x0'));var squel=require(_0xe5d2('0x1'));var _=require(_0xe5d2('0x2'));module[_0xe5d2('0x3')]={'title':{'type':Sequelize[_0xe5d2('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xe5d2('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xe5d2('0x5')](_0xe5d2('0x6')),'get':function(){try{return JSON[_0xe5d2('0x7')](this['getDataValue'](_0xe5d2('0x8')));}catch(_0x1e2ea0){return[];}},'set':function(_0x388254){try{this[_0xe5d2('0x9')](_0xe5d2('0x8'),JSON[_0xe5d2('0xa')](_0x388254));}catch(_0x5cda37){this['setDataValue'](_0xe5d2('0x8'),JSON[_0xe5d2('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0xe5d2('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xe5d2('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xe5d2('0x4')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xe5d2('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xe5d2('0x4')]}}; \ No newline at end of file +var _0x5a27=['attrs','stringify','setDataValue','INTEGER','#2196f3','squel','lodash','exports','STRING','TEXT','long','getDataValue'];(function(_0x3cec8c,_0x3f6c1d){var _0x38032e=function(_0x4ef75b){while(--_0x4ef75b){_0x3cec8c['push'](_0x3cec8c['shift']());}};_0x38032e(++_0x3f6c1d);}(_0x5a27,0x13d));var _0x75a2=function(_0x45cfbb,_0x412893){_0x45cfbb=_0x45cfbb-0x0;var _0x29b7fd=_0x5a27[_0x45cfbb];return _0x29b7fd;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x75a2('0x0'));var _=require(_0x75a2('0x1'));module[_0x75a2('0x2')]={'title':{'type':Sequelize[_0x75a2('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x75a2('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x75a2('0x4')](_0x75a2('0x5')),'get':function(){try{return JSON['parse'](this[_0x75a2('0x6')](_0x75a2('0x7')));}catch(_0x4a17ad){return[];}},'set':function(_0x1fdb39){try{this['setDataValue'](_0x75a2('0x7'),JSON[_0x75a2('0x8')](_0x1fdb39));}catch(_0x55e361){this[_0x75a2('0x9')](_0x75a2('0x7'),JSON[_0x75a2('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x75a2('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x75a2('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x75a2('0xa')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x75a2('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x75a2('0x3')],'allowNull':![],'defaultValue':_0x75a2('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x75a2('0x3')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index f589709..91eda19 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 _0xa4a6=['total','attrVoiceQueues','attrFontSize','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus','offset','limit','status','set','Content-Range','apply','update','then','end','error','stack','name','send','show','keys','DashboardItem','rawAttributes','query','filters','intersection','model','fields','attributes','length','includeAll','include','options','destroy','find','params','catch','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrMetric'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0xa4a6,0x10a));var _0x6a4a=function(_0x2e77a6,_0x102997){_0x2e77a6=_0x2e77a6-0x0;var _0x2df4b3=_0xa4a6[_0x2e77a6];return _0x2df4b3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x6a4a('0x0'));var zipdir=require(_0x6a4a('0x1'));var jsonpatch=require(_0x6a4a('0x2'));var rp=require(_0x6a4a('0x3'));var moment=require(_0x6a4a('0x4'));var BPromise=require(_0x6a4a('0x5'));var Mustache=require(_0x6a4a('0x6'));var util=require(_0x6a4a('0x7'));var path=require('path');var sox=require(_0x6a4a('0x8'));var csv=require(_0x6a4a('0x9'));var ejs=require(_0x6a4a('0xa'));var fs=require('fs');var _=require(_0x6a4a('0xb'));var squel=require(_0x6a4a('0xc'));var crypto=require('crypto');var jsforce=require(_0x6a4a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6a4a('0x9'));var querystring=require(_0x6a4a('0xe'));var Papa=require(_0x6a4a('0xf'));var Redis=require(_0x6a4a('0x10'));var authService=require(_0x6a4a('0x11'));var qs=require(_0x6a4a('0x12'));var as=require(_0x6a4a('0x13'));var hardwareService=require(_0x6a4a('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6a4a('0x15'));var db=require(_0x6a4a('0x16'))['db'];config[_0x6a4a('0x17')]=_['defaults'](config['redis'],{'host':_0x6a4a('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6a4a('0x17')]));require('./dashboardItem.socket')[_0x6a4a('0x19')](socket);function respondWithStatusCode(_0x18962e,_0x3dde7f){_0x3dde7f=_0x3dde7f||0xcc;return function(_0x6dc819){if(_0x6dc819){return _0x18962e[_0x6a4a('0x1a')](_0x3dde7f);}return _0x18962e['status'](_0x3dde7f)['end']();};}function respondWithResult(_0x12ab83,_0x1b4257){_0x1b4257=_0x1b4257||0xc8;return function(_0x47939e){if(_0x47939e){return _0x12ab83['status'](_0x1b4257)['json'](_0x47939e);}};}function respondWithFilteredResult(_0x2d7f06,_0x4a6a15){return function(_0x4e2680){if(_0x4e2680){var _0x2efe4c=_0x4e2680['count'],_0x50ea9f=_0x4a6a15['offset'],_0x56efa2=_0x4a6a15[_0x6a4a('0x1b')]+_0x4a6a15[_0x6a4a('0x1c')],_0xa570c9;if(_0x56efa2>=_0x2efe4c){_0x56efa2=_0x2efe4c;_0xa570c9=0xc8;}else{_0xa570c9=0xce;}_0x2d7f06[_0x6a4a('0x1d')](_0xa570c9);return _0x2d7f06[_0x6a4a('0x1e')](_0x6a4a('0x1f'),_0x50ea9f+'-'+_0x56efa2+'/'+_0x2efe4c)['json'](_0x4e2680);}return null;};}function patchUpdates(_0x4e211f){return function(_0x4d66e8){try{jsonpatch[_0x6a4a('0x20')](_0x4d66e8,_0x4e211f,!![]);}catch(_0x1d41e6){return BPromise['reject'](_0x1d41e6);}return _0x4d66e8['save']();};}function saveUpdates(_0x5a5b3d,_0x4309a1){return function(_0x54e7a1){if(_0x54e7a1){return _0x54e7a1[_0x6a4a('0x21')](_0x5a5b3d)[_0x6a4a('0x22')](function(_0x5a1756){return _0x5a1756;});}return null;};}function removeEntity(_0x20b9d5,_0x57ec24){return function(_0xb52009){if(_0xb52009){return _0xb52009['destroy']()[_0x6a4a('0x22')](function(){_0x20b9d5[_0x6a4a('0x1d')](0xcc)[_0x6a4a('0x23')]();});}};}function handleEntityNotFound(_0xf5614,_0x164965){return function(_0x61b87b){if(!_0x61b87b){_0xf5614[_0x6a4a('0x1a')](0x194);}return _0x61b87b;};}function handleError(_0x21bfbb,_0x666053){_0x666053=_0x666053||0x1f4;return function(_0x4a511b){logger[_0x6a4a('0x24')](_0x4a511b[_0x6a4a('0x25')]);if(_0x4a511b[_0x6a4a('0x26')]){delete _0x4a511b[_0x6a4a('0x26')];}_0x21bfbb['status'](_0x666053)[_0x6a4a('0x27')](_0x4a511b);};}exports[_0x6a4a('0x28')]=function(_0x4dfab6,_0x3e1c63){var _0x5645d1={'raw':![],'where':{'id':_0x4dfab6['params']['id']}},_0x28df27={};_0x28df27['model']=_[_0x6a4a('0x29')](db[_0x6a4a('0x2a')][_0x6a4a('0x2b')]);_0x28df27[_0x6a4a('0x2c')]=_['keys'](_0x4dfab6[_0x6a4a('0x2c')]);_0x28df27[_0x6a4a('0x2d')]=_[_0x6a4a('0x2e')](_0x28df27[_0x6a4a('0x2f')],_0x28df27['query']);_0x5645d1['attributes']=_[_0x6a4a('0x2e')](_0x28df27[_0x6a4a('0x2f')],qs[_0x6a4a('0x30')](_0x4dfab6[_0x6a4a('0x2c')]['fields']));_0x5645d1[_0x6a4a('0x31')]=_0x5645d1['attributes'][_0x6a4a('0x32')]?_0x5645d1[_0x6a4a('0x31')]:_0x28df27[_0x6a4a('0x2f')];if(_0x4dfab6['query'][_0x6a4a('0x33')]){_0x5645d1[_0x6a4a('0x34')]=[{'all':!![]}];}_0x5645d1=_['merge']({},_0x5645d1,_0x4dfab6[_0x6a4a('0x35')]);return db[_0x6a4a('0x2a')]['find'](_0x5645d1)[_0x6a4a('0x22')](handleEntityNotFound(_0x3e1c63,null))[_0x6a4a('0x22')](respondWithResult(_0x3e1c63,null))['catch'](handleError(_0x3e1c63,null));};exports[_0x6a4a('0x36')]=function(_0x400433,_0x28eb54){return db[_0x6a4a('0x2a')][_0x6a4a('0x37')]({'where':{'id':_0x400433[_0x6a4a('0x38')]['id']}})[_0x6a4a('0x22')](handleEntityNotFound(_0x28eb54,null))[_0x6a4a('0x22')](removeEntity(_0x28eb54,null))[_0x6a4a('0x39')](handleError(_0x28eb54,null));};function widgetAttributes(_0x3af8d0){try{switch(_0x3af8d0[_0x6a4a('0x3a')]){case _0x6a4a('0x3b'):return[{'name':'attrUrl','value':_0x3af8d0[_0x6a4a('0x3c')]||(_0x3af8d0['attrs']&&_0x3af8d0[_0x6a4a('0x3d')][0x0]?_0x3af8d0['attrs'][0x0][_0x6a4a('0x3e')]:undefined)||_0x6a4a('0x3f')}];case'custom':return[{'name':_0x6a4a('0x40'),'value':_0x3af8d0['attrPath']||(_0x3af8d0[_0x6a4a('0x3d')]&&_0x3af8d0['attrs'][0x0]?_0x3af8d0[_0x6a4a('0x3d')][0x0]['value']:undefined)||''}];case _0x6a4a('0x41'):return[{'name':_0x6a4a('0x42'),'value':_0x3af8d0[_0x6a4a('0x42')]||(_0x3af8d0[_0x6a4a('0x3d')]&&_0x3af8d0[_0x6a4a('0x3d')][0x0]?_0x3af8d0[_0x6a4a('0x3d')][0x0]['value']:undefined)||_0x6a4a('0x43')},{'name':'attrTimezone','value':_0x3af8d0[_0x6a4a('0x44')]||(_0x3af8d0[_0x6a4a('0x3d')]&&_0x3af8d0[_0x6a4a('0x3d')][0x1]?_0x3af8d0['attrs'][0x1][_0x6a4a('0x3e')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x3af8d0['attrFontSize']||(_0x3af8d0[_0x6a4a('0x3d')]&&_0x3af8d0[_0x6a4a('0x3d')][0x2]?_0x3af8d0['attrs'][0x2][_0x6a4a('0x3e')]:undefined)||0xc}];case'counter':return[{'name':_0x6a4a('0x45'),'value':_0x3af8d0[_0x6a4a('0x45')]||(_0x3af8d0[_0x6a4a('0x3d')]&&_0x3af8d0[_0x6a4a('0x3d')][0x0]?_0x3af8d0[_0x6a4a('0x3d')][0x0]['value']:undefined)||_0x6a4a('0x46')},{'name':_0x6a4a('0x47'),'value':_0x3af8d0[_0x6a4a('0x47')]||(_0x3af8d0[_0x6a4a('0x3d')]&&_0x3af8d0[_0x6a4a('0x3d')][0x1]?_0x3af8d0[_0x6a4a('0x3d')][0x1][_0x6a4a('0x3e')]:undefined)||[]},{'name':_0x6a4a('0x48'),'value':_0x3af8d0[_0x6a4a('0x48')]||(_0x3af8d0[_0x6a4a('0x3d')]&&_0x3af8d0['attrs'][0x2]?_0x3af8d0[_0x6a4a('0x3d')][0x2]['value']:undefined)||0x14}];case'multibar-chart':case _0x6a4a('0x49'):return[{'name':_0x6a4a('0x4a'),'value':_0x3af8d0[_0x6a4a('0x4a')]||(_0x3af8d0['attrs']&&_0x3af8d0[_0x6a4a('0x3d')][0x0]?_0x3af8d0[_0x6a4a('0x3d')][0x0]['value']:undefined)||_0x6a4a('0x46')},{'name':'attrSerie2','value':_0x3af8d0[_0x6a4a('0x4b')]||(_0x3af8d0['attrs']&&_0x3af8d0['attrs'][0x1]?_0x3af8d0[_0x6a4a('0x3d')][0x1][_0x6a4a('0x3e')]:undefined)||null},{'name':_0x6a4a('0x4c'),'value':_0x3af8d0[_0x6a4a('0x4c')]||(_0x3af8d0['attrs']&&_0x3af8d0[_0x6a4a('0x3d')][0x2]?_0x3af8d0[_0x6a4a('0x3d')][0x2]['value']:undefined)||null},{'name':_0x6a4a('0x47'),'value':_0x3af8d0[_0x6a4a('0x47')]||(_0x3af8d0['attrs']&&_0x3af8d0[_0x6a4a('0x3d')][0x3]?_0x3af8d0[_0x6a4a('0x3d')][0x3][_0x6a4a('0x3e')]:undefined)||[]}];case _0x6a4a('0x4d'):return[{'name':_0x6a4a('0x4e'),'type':_0x3af8d0[_0x6a4a('0x4f')]||(_0x3af8d0[_0x6a4a('0x3d')]&&_0x3af8d0[_0x6a4a('0x3d')][0x0]?_0x3af8d0['attrs'][0x0][_0x6a4a('0x3a')]:undefined)||null,'value':_0x3af8d0[_0x6a4a('0x4e')]||(_0x3af8d0[_0x6a4a('0x3d')]&&_0x3af8d0[_0x6a4a('0x3d')][0x0]?_0x3af8d0[_0x6a4a('0x3d')][0x0][_0x6a4a('0x3e')]:undefined)||null},{'name':_0x6a4a('0x50'),'value':_0x3af8d0[_0x6a4a('0x50')]||(_0x3af8d0[_0x6a4a('0x3d')]&&_0x3af8d0[_0x6a4a('0x3d')][0x1]?_0x3af8d0[_0x6a4a('0x3d')][0x1][_0x6a4a('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x2b81f4){logger[_0x6a4a('0x24')]('widgetAttributes:\x20%s',JSON[_0x6a4a('0x51')](_0x2b81f4));return[];}}exports[_0x6a4a('0x52')]=function(_0x174f20,_0x20d458){if(_0x174f20[_0x6a4a('0x53')]){_0x174f20[_0x6a4a('0x53')]['attrs']=widgetAttributes(_0x174f20[_0x6a4a('0x53')]);}return db[_0x6a4a('0x2a')][_0x6a4a('0x52')](_0x174f20[_0x6a4a('0x53')],{})[_0x6a4a('0x22')](respondWithResult(_0x20d458,0xc9))[_0x6a4a('0x39')](handleError(_0x20d458,null));};exports[_0x6a4a('0x21')]=function(_0x44a7de,_0x222079){if(_0x44a7de[_0x6a4a('0x53')]['id']){delete _0x44a7de[_0x6a4a('0x53')]['id'];}_0x44a7de['body'][_0x6a4a('0x3d')]=widgetAttributes(_0x44a7de[_0x6a4a('0x53')]);return db['DashboardItem'][_0x6a4a('0x37')]({'where':{'id':_0x44a7de[_0x6a4a('0x38')]['id']}})[_0x6a4a('0x22')](handleEntityNotFound(_0x222079,null))[_0x6a4a('0x22')](saveUpdates(_0x44a7de[_0x6a4a('0x53')],null))['then'](respondWithResult(_0x222079,null))[_0x6a4a('0x39')](handleError(_0x222079,null));}; \ No newline at end of file +var _0xb066=['../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','DashboardItem','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','catch','find','type','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x139dfd,_0x23a3b9){var _0x31d100=function(_0xeeaba8){while(--_0xeeaba8){_0x139dfd['push'](_0x139dfd['shift']());}};_0x31d100(++_0x23a3b9);}(_0xb066,0x1c0));var _0x6b06=function(_0x266b5d,_0x1d65ac){_0x266b5d=_0x266b5d-0x0;var _0x4f0766=_0xb066[_0x266b5d];return _0x4f0766;};'use strict';var pdf=require(_0x6b06('0x0'));var emlformat=require(_0x6b06('0x1'));var rimraf=require(_0x6b06('0x2'));var zipdir=require(_0x6b06('0x3'));var jsonpatch=require(_0x6b06('0x4'));var rp=require(_0x6b06('0x5'));var moment=require('moment');var BPromise=require(_0x6b06('0x6'));var Mustache=require(_0x6b06('0x7'));var util=require('util');var path=require(_0x6b06('0x8'));var sox=require(_0x6b06('0x9'));var csv=require(_0x6b06('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6b06('0xb'));var squel=require(_0x6b06('0xc'));var crypto=require('crypto');var jsforce=require(_0x6b06('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6b06('0xa'));var querystring=require(_0x6b06('0xe'));var Papa=require(_0x6b06('0xf'));var Redis=require(_0x6b06('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6b06('0x11'));var as=require(_0x6b06('0x12'));var hardwareService=require(_0x6b06('0x13'));var logger=require(_0x6b06('0x14'))(_0x6b06('0x15'));var utils=require(_0x6b06('0x16'));var config=require('../../config/environment');var db=require(_0x6b06('0x17'))['db'];config[_0x6b06('0x18')]=_[_0x6b06('0x19')](config[_0x6b06('0x18')],{'host':_0x6b06('0x1a'),'port':0x18eb});var socket=require(_0x6b06('0x1b'))(new Redis(config[_0x6b06('0x18')]));require(_0x6b06('0x1c'))[_0x6b06('0x1d')](socket);function respondWithStatusCode(_0x3e658b,_0x2e4c78){_0x2e4c78=_0x2e4c78||0xcc;return function(_0x152e59){if(_0x152e59){return _0x3e658b[_0x6b06('0x1e')](_0x2e4c78);}return _0x3e658b[_0x6b06('0x1f')](_0x2e4c78)[_0x6b06('0x20')]();};}function respondWithResult(_0x3a42ad,_0x5d96b6){_0x5d96b6=_0x5d96b6||0xc8;return function(_0x4e36d6){if(_0x4e36d6){return _0x3a42ad[_0x6b06('0x1f')](_0x5d96b6)[_0x6b06('0x21')](_0x4e36d6);}};}function respondWithFilteredResult(_0x42b149,_0x2ae19c){return function(_0x2ef077){if(_0x2ef077){var _0x49b7dd=_0x2ef077[_0x6b06('0x22')],_0x2884c5=_0x2ae19c[_0x6b06('0x23')],_0x24c043=_0x2ae19c[_0x6b06('0x23')]+_0x2ae19c[_0x6b06('0x24')],_0x4d8ff7;if(_0x24c043>=_0x49b7dd){_0x24c043=_0x49b7dd;_0x4d8ff7=0xc8;}else{_0x4d8ff7=0xce;}_0x42b149[_0x6b06('0x1f')](_0x4d8ff7);return _0x42b149[_0x6b06('0x25')](_0x6b06('0x26'),_0x2884c5+'-'+_0x24c043+'/'+_0x49b7dd)[_0x6b06('0x21')](_0x2ef077);}return null;};}function patchUpdates(_0x232bb5){return function(_0xb3b144){try{jsonpatch[_0x6b06('0x27')](_0xb3b144,_0x232bb5,!![]);}catch(_0x470da9){return BPromise[_0x6b06('0x28')](_0x470da9);}return _0xb3b144[_0x6b06('0x29')]();};}function saveUpdates(_0x1804f8,_0x3e0b2e){return function(_0x3e77b0){if(_0x3e77b0){return _0x3e77b0[_0x6b06('0x2a')](_0x1804f8)[_0x6b06('0x2b')](function(_0x166234){return _0x166234;});}return null;};}function removeEntity(_0x13f6fc,_0x57eba0){return function(_0x4fd6cb){if(_0x4fd6cb){return _0x4fd6cb[_0x6b06('0x2c')]()[_0x6b06('0x2b')](function(){_0x13f6fc[_0x6b06('0x1f')](0xcc)[_0x6b06('0x20')]();});}};}function handleEntityNotFound(_0x3ee22a,_0x5050f0){return function(_0x3004d4){if(!_0x3004d4){_0x3ee22a[_0x6b06('0x1e')](0x194);}return _0x3004d4;};}function handleError(_0x178a69,_0x513a23){_0x513a23=_0x513a23||0x1f4;return function(_0x318729){logger[_0x6b06('0x2d')](_0x318729[_0x6b06('0x2e')]);if(_0x318729[_0x6b06('0x2f')]){delete _0x318729[_0x6b06('0x2f')];}_0x178a69[_0x6b06('0x1f')](_0x513a23)[_0x6b06('0x30')](_0x318729);};}exports[_0x6b06('0x31')]=function(_0xf59a2,_0x324961){var _0xf2ca21={'raw':![],'where':{'id':_0xf59a2[_0x6b06('0x32')]['id']}},_0x1c5dca={};_0x1c5dca[_0x6b06('0x33')]=_['keys'](db[_0x6b06('0x34')][_0x6b06('0x35')]);_0x1c5dca[_0x6b06('0x36')]=_[_0x6b06('0x37')](_0xf59a2[_0x6b06('0x36')]);_0x1c5dca[_0x6b06('0x38')]=_[_0x6b06('0x39')](_0x1c5dca[_0x6b06('0x33')],_0x1c5dca['query']);_0xf2ca21[_0x6b06('0x3a')]=_[_0x6b06('0x39')](_0x1c5dca[_0x6b06('0x33')],qs['fields'](_0xf59a2[_0x6b06('0x36')][_0x6b06('0x3b')]));_0xf2ca21[_0x6b06('0x3a')]=_0xf2ca21[_0x6b06('0x3a')][_0x6b06('0x3c')]?_0xf2ca21['attributes']:_0x1c5dca[_0x6b06('0x33')];if(_0xf59a2[_0x6b06('0x36')][_0x6b06('0x3d')]){_0xf2ca21['include']=[{'all':!![]}];}_0xf2ca21=_[_0x6b06('0x3e')]({},_0xf2ca21,_0xf59a2[_0x6b06('0x3f')]);return db[_0x6b06('0x34')]['find'](_0xf2ca21)[_0x6b06('0x2b')](handleEntityNotFound(_0x324961,null))[_0x6b06('0x2b')](respondWithResult(_0x324961,null))[_0x6b06('0x40')](handleError(_0x324961,null));};exports[_0x6b06('0x2c')]=function(_0x39d713,_0x333cb1){return db[_0x6b06('0x34')][_0x6b06('0x41')]({'where':{'id':_0x39d713['params']['id']}})[_0x6b06('0x2b')](handleEntityNotFound(_0x333cb1,null))[_0x6b06('0x2b')](removeEntity(_0x333cb1,null))[_0x6b06('0x40')](handleError(_0x333cb1,null));};function widgetAttributes(_0x4bee60){try{switch(_0x4bee60[_0x6b06('0x42')]){case'iframe':return[{'name':_0x6b06('0x43'),'value':_0x4bee60[_0x6b06('0x43')]||(_0x4bee60[_0x6b06('0x44')]&&_0x4bee60[_0x6b06('0x44')][0x0]?_0x4bee60[_0x6b06('0x44')][0x0][_0x6b06('0x45')]:undefined)||_0x6b06('0x46')}];case'custom':return[{'name':_0x6b06('0x47'),'value':_0x4bee60['attrPath']||(_0x4bee60['attrs']&&_0x4bee60[_0x6b06('0x44')][0x0]?_0x4bee60[_0x6b06('0x44')][0x0][_0x6b06('0x45')]:undefined)||''}];case _0x6b06('0x48'):return[{'name':'attrHourFormat','value':_0x4bee60[_0x6b06('0x49')]||(_0x4bee60[_0x6b06('0x44')]&&_0x4bee60['attrs'][0x0]?_0x4bee60[_0x6b06('0x44')][0x0][_0x6b06('0x45')]:undefined)||_0x6b06('0x4a')},{'name':_0x6b06('0x4b'),'value':_0x4bee60[_0x6b06('0x4b')]||(_0x4bee60[_0x6b06('0x44')]&&_0x4bee60['attrs'][0x1]?_0x4bee60[_0x6b06('0x44')][0x1]['value']:undefined)||_0x6b06('0x4c')},{'name':_0x6b06('0x4d'),'value':_0x4bee60[_0x6b06('0x4d')]||(_0x4bee60[_0x6b06('0x44')]&&_0x4bee60[_0x6b06('0x44')][0x2]?_0x4bee60[_0x6b06('0x44')][0x2][_0x6b06('0x45')]:undefined)||0xc}];case _0x6b06('0x4e'):return[{'name':_0x6b06('0x4f'),'value':_0x4bee60[_0x6b06('0x4f')]||(_0x4bee60[_0x6b06('0x44')]&&_0x4bee60['attrs'][0x0]?_0x4bee60[_0x6b06('0x44')][0x0][_0x6b06('0x45')]:undefined)||'total'},{'name':_0x6b06('0x50'),'value':_0x4bee60[_0x6b06('0x50')]||(_0x4bee60['attrs']&&_0x4bee60[_0x6b06('0x44')][0x1]?_0x4bee60[_0x6b06('0x44')][0x1][_0x6b06('0x45')]:undefined)||[]},{'name':_0x6b06('0x4d'),'value':_0x4bee60['attrFontSize']||(_0x4bee60['attrs']&&_0x4bee60[_0x6b06('0x44')][0x2]?_0x4bee60['attrs'][0x2][_0x6b06('0x45')]:undefined)||0x14}];case _0x6b06('0x51'):case _0x6b06('0x52'):return[{'name':_0x6b06('0x53'),'value':_0x4bee60[_0x6b06('0x53')]||(_0x4bee60[_0x6b06('0x44')]&&_0x4bee60['attrs'][0x0]?_0x4bee60['attrs'][0x0]['value']:undefined)||_0x6b06('0x54')},{'name':_0x6b06('0x55'),'value':_0x4bee60[_0x6b06('0x55')]||(_0x4bee60['attrs']&&_0x4bee60[_0x6b06('0x44')][0x1]?_0x4bee60[_0x6b06('0x44')][0x1][_0x6b06('0x45')]:undefined)||null},{'name':_0x6b06('0x56'),'value':_0x4bee60['attrSerie3']||(_0x4bee60[_0x6b06('0x44')]&&_0x4bee60[_0x6b06('0x44')][0x2]?_0x4bee60[_0x6b06('0x44')][0x2][_0x6b06('0x45')]:undefined)||null},{'name':_0x6b06('0x50'),'value':_0x4bee60[_0x6b06('0x50')]||(_0x4bee60[_0x6b06('0x44')]&&_0x4bee60[_0x6b06('0x44')][0x3]?_0x4bee60['attrs'][0x3][_0x6b06('0x45')]:undefined)||[]}];case _0x6b06('0x57'):return[{'name':_0x6b06('0x58'),'type':_0x4bee60[_0x6b06('0x59')]||(_0x4bee60[_0x6b06('0x44')]&&_0x4bee60[_0x6b06('0x44')][0x0]?_0x4bee60['attrs'][0x0][_0x6b06('0x42')]:undefined)||null,'value':_0x4bee60[_0x6b06('0x58')]||(_0x4bee60[_0x6b06('0x44')]&&_0x4bee60[_0x6b06('0x44')][0x0]?_0x4bee60[_0x6b06('0x44')][0x0][_0x6b06('0x45')]:undefined)||null},{'name':'attrRefresh','value':_0x4bee60[_0x6b06('0x5a')]||(_0x4bee60[_0x6b06('0x44')]&&_0x4bee60[_0x6b06('0x44')][0x1]?_0x4bee60['attrs'][0x1][_0x6b06('0x45')]:undefined)||0x0}];default:return[];}}catch(_0xcf8b6){logger[_0x6b06('0x2d')](_0x6b06('0x5b'),JSON['stringify'](_0xcf8b6));return[];}}exports[_0x6b06('0x5c')]=function(_0x1562a9,_0x221921){if(_0x1562a9[_0x6b06('0x5d')]){_0x1562a9[_0x6b06('0x5d')][_0x6b06('0x44')]=widgetAttributes(_0x1562a9[_0x6b06('0x5d')]);}return db[_0x6b06('0x34')][_0x6b06('0x5c')](_0x1562a9[_0x6b06('0x5d')],{})[_0x6b06('0x2b')](respondWithResult(_0x221921,0xc9))['catch'](handleError(_0x221921,null));};exports[_0x6b06('0x2a')]=function(_0x3800cc,_0x584908){if(_0x3800cc['body']['id']){delete _0x3800cc[_0x6b06('0x5d')]['id'];}_0x3800cc['body']['attrs']=widgetAttributes(_0x3800cc[_0x6b06('0x5d')]);return db['DashboardItem'][_0x6b06('0x41')]({'where':{'id':_0x3800cc['params']['id']}})[_0x6b06('0x2b')](handleEntityNotFound(_0x584908,null))[_0x6b06('0x2b')](saveUpdates(_0x3800cc[_0x6b06('0x5d')],null))[_0x6b06('0x2b')](respondWithResult(_0x584908,null))[_0x6b06('0x40')](handleError(_0x584908,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 9a290fb..9bdc56b 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 _0x5c5d=['exports','events','DashboardItem','setMaxListeners','remove','emit'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x5c5d,0x103));var _0xd5c5=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x5c5d[_0x1ac595];return _0x455fff;};'use strict';var EventEmitter=require(_0xd5c5('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0xd5c5('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd5c5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd5c5('0x3')};function emitEvent(_0x1f030f){return function(_0x1c5f79,_0x3df3db,_0x1ce46f){DashboardItemEvents[_0xd5c5('0x4')](_0x1f030f+':'+_0x1c5f79['id'],_0x1c5f79);DashboardItemEvents[_0xd5c5('0x4')](_0x1f030f,_0x1c5f79);_0x1ce46f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xd5c5('0x5')]=DashboardItemEvents; \ No newline at end of file +var _0xefbd=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x8af54b,_0x280be5){var _0x27d8f0=function(_0x559734){while(--_0x559734){_0x8af54b['push'](_0x8af54b['shift']());}};_0x27d8f0(++_0x280be5);}(_0xefbd,0x15a));var _0xdefb=function(_0xcc0caa,_0xafadcd){_0xcc0caa=_0xcc0caa-0x0;var _0x590789=_0xefbd[_0xcc0caa];return _0x590789;};'use strict';var EventEmitter=require(_0xdefb('0x0'));var DashboardItem=require(_0xdefb('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xdefb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdefb('0x3'),'afterDestroy':_0xdefb('0x4')};function emitEvent(_0x1062d1){return function(_0x7c5dbd,_0x163ca1,_0x8eb1cd){DashboardItemEvents['emit'](_0x1062d1+':'+_0x7c5dbd['id'],_0x7c5dbd);DashboardItemEvents[_0xdefb('0x5')](_0x1062d1,_0x7c5dbd);_0x8eb1cd(null);};}for(var e in events){if(events[_0xdefb('0x6')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xdefb('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index c1dd8e1..d68e69a 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 _0x6ccd=['path','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x308c7c,_0x3e8913){var _0x131e3e=function(_0x23e5e9){while(--_0x23e5e9){_0x308c7c['push'](_0x308c7c['shift']());}};_0x131e3e(++_0x3e8913);}(_0x6ccd,0x1c2));var _0xd6cc=function(_0x301515,_0x139f30){_0x301515=_0x301515-0x0;var _0x8cd133=_0x6ccd[_0x301515];return _0x8cd133;};'use strict';var _=require(_0xd6cc('0x0'));var util=require('util');var logger=require(_0xd6cc('0x1'))(_0xd6cc('0x2'));var moment=require(_0xd6cc('0x3'));var BPromise=require(_0xd6cc('0x4'));var rp=require(_0xd6cc('0x5'));var fs=require('fs');var path=require(_0xd6cc('0x6'));var rimraf=require(_0xd6cc('0x7'));var config=require(_0xd6cc('0x8'));var attributes=require(_0xd6cc('0x9'));module[_0xd6cc('0xa')]=function(_0x4701b0,_0x56ea2e){return _0x4701b0['define'](_0xd6cc('0xb'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b35=['rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','lodash','../../config/logger','request-promise','path'];(function(_0x3f5443,_0xbc24c){var _0x5e5153=function(_0x155fde){while(--_0x155fde){_0x3f5443['push'](_0x3f5443['shift']());}};_0x5e5153(++_0xbc24c);}(_0x4b35,0x95));var _0x54b3=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0x4b35[_0x4226d6];return _0x19655b;};'use strict';var _=require(_0x54b3('0x0'));var util=require('util');var logger=require(_0x54b3('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x54b3('0x2'));var fs=require('fs');var path=require(_0x54b3('0x3'));var rimraf=require(_0x54b3('0x4'));var config=require(_0x54b3('0x5'));var attributes=require(_0x54b3('0x6'));module['exports']=function(_0xf31749,_0x9d2785){return _0xf31749[_0x54b3('0x7')](_0x54b3('0x8'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index f9493cb..535b227 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 _0x4e07=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x58582f,_0x447380){var _0x35ae78=function(_0x1db019){while(--_0x1db019){_0x58582f['push'](_0x58582f['shift']());}};_0x35ae78(++_0x447380);}(_0x4e07,0xcc));var _0x74e0=function(_0x4af713,_0x540f7d){_0x4af713=_0x4af713-0x0;var _0x41a1ec=_0x4e07[_0x4af713];return _0x41a1ec;};'use strict';var _=require(_0x74e0('0x0'));var util=require('util');var moment=require(_0x74e0('0x1'));var BPromise=require(_0x74e0('0x2'));var rs=require(_0x74e0('0x3'));var fs=require('fs');var Redis=require(_0x74e0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x74e0('0x5'));var logger=require(_0x74e0('0x6'))(_0x74e0('0x7'));var config=require(_0x74e0('0x8'));var jayson=require(_0x74e0('0x9'));var client=jayson[_0x74e0('0xa')][_0x74e0('0xb')]({'port':0x232a});config[_0x74e0('0xc')]=_['defaults'](config[_0x74e0('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x74e0('0xd'))(new Redis(config[_0x74e0('0xc')]));require(_0x74e0('0xe'))[_0x74e0('0xf')](socket);function respondWithRpcPromise(_0xc9f4d3,_0x561328,_0x568b2b){return new BPromise(function(_0x4e7903,_0x49bf50){return client[_0x74e0('0x10')](_0xc9f4d3,_0x568b2b)['then'](function(_0x117671){logger[_0x74e0('0x11')](_0x74e0('0x12'),_0x561328,_0x74e0('0x13'));logger['debug'](_0x74e0('0x14'),_0x561328,'request\x20sent',JSON[_0x74e0('0x15')](_0x117671));if(_0x117671[_0x74e0('0x16')]){if(_0x117671[_0x74e0('0x16')]['code']===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x561328,_0x117671['error']['message']);return _0x49bf50(_0x117671[_0x74e0('0x16')]['message']);}logger[_0x74e0('0x16')]('DashboardItem,\x20%s,\x20%s',_0x561328,_0x117671['error']['message']);return _0x4e7903(_0x117671['error'][_0x74e0('0x17')]);}else{logger['info'](_0x74e0('0x12'),_0x561328,'request\x20sent');_0x4e7903(_0x117671[_0x74e0('0x18')][_0x74e0('0x17')]);}})[_0x74e0('0x19')](function(_0x3b9252){logger[_0x74e0('0x16')](_0x74e0('0x12'),_0x561328,_0x3b9252);_0x49bf50(_0x3b9252);});});} \ No newline at end of file +var _0x2c65=['http','redis','defaults','localhost','socket.io-emitter','register','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','client'];(function(_0x3a94e1,_0x22e4fd){var _0x6a09d5=function(_0x2d6d1c){while(--_0x2d6d1c){_0x3a94e1['push'](_0x3a94e1['shift']());}};_0x6a09d5(++_0x22e4fd);}(_0x2c65,0x13c));var _0x52c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c65[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x52c6('0x0'));var BPromise=require('bluebird');var rs=require(_0x52c6('0x1'));var fs=require('fs');var Redis=require(_0x52c6('0x2'));var db=require(_0x52c6('0x3'))['db'];var utils=require(_0x52c6('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x52c6('0x5')][_0x52c6('0x6')]({'port':0x232a});config[_0x52c6('0x7')]=_[_0x52c6('0x8')](config['redis'],{'host':_0x52c6('0x9'),'port':0x18eb});var socket=require(_0x52c6('0xa'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0x52c6('0xb')](socket);function respondWithRpcPromise(_0x2c6fe7,_0x52ccca,_0x35055f){return new BPromise(function(_0x2c567c,_0x572211){return client['request'](_0x2c6fe7,_0x35055f)['then'](function(_0x593c84){logger[_0x52c6('0xc')](_0x52c6('0xd'),_0x52ccca,_0x52c6('0xe'));logger[_0x52c6('0xf')](_0x52c6('0x10'),_0x52ccca,'request\x20sent',JSON[_0x52c6('0x11')](_0x593c84));if(_0x593c84[_0x52c6('0x12')]){if(_0x593c84['error'][_0x52c6('0x13')]===0x1f4){logger['error'](_0x52c6('0xd'),_0x52ccca,_0x593c84[_0x52c6('0x12')]['message']);return _0x572211(_0x593c84[_0x52c6('0x12')]['message']);}logger[_0x52c6('0x12')]('DashboardItem,\x20%s,\x20%s',_0x52ccca,_0x593c84[_0x52c6('0x12')][_0x52c6('0x14')]);return _0x2c567c(_0x593c84['error'][_0x52c6('0x14')]);}else{logger[_0x52c6('0xc')](_0x52c6('0xd'),_0x52ccca,_0x52c6('0xe'));_0x2c567c(_0x593c84[_0x52c6('0x15')][_0x52c6('0x14')]);}})[_0x52c6('0x16')](function(_0x55755b){logger['error'](_0x52c6('0xd'),_0x52ccca,_0x55755b);_0x572211(_0x55755b);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 18aba84..efe3c36 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 _0x07db=['register','length','dashboardItem:','save','update'];(function(_0x12db8f,_0x2c21e7){var _0x484c17=function(_0xc93da4){while(--_0xc93da4){_0x12db8f['push'](_0x12db8f['shift']());}};_0x484c17(++_0x2c21e7);}(_0x07db,0xad));var _0xb07d=function(_0x5991d7,_0x3ca7f8){_0x5991d7=_0x5991d7-0x0;var _0x5b299d=_0x07db[_0x5991d7];return _0x5b299d;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xb07d('0x0'),'remove',_0xb07d('0x1')];function createListener(_0x2f776a,_0x136064){return function(_0x36c298){_0x136064['emit'](_0x2f776a,_0x36c298);};}function removeListener(_0x44d7b3,_0x426163){return function(){DashboardItemEvents['removeListener'](_0x44d7b3,_0x426163);};}exports[_0xb07d('0x2')]=function(_0x34fef1){for(var _0x411cd6=0x0,_0x1f679f=events[_0xb07d('0x3')];_0x411cd6<_0x1f679f;_0x411cd6++){var _0x5a96c6=events[_0x411cd6];var _0x5efacc=createListener(_0xb07d('0x4')+_0x5a96c6,_0x34fef1);DashboardItemEvents['on'](_0x5a96c6,_0x5efacc);}}; \ No newline at end of file +var _0xdb34=['removeListener','length','dashboardItem:','./dashboardItem.events','save','remove'];(function(_0x56b8eb,_0x1b90ab){var _0x31494f=function(_0x865155){while(--_0x865155){_0x56b8eb['push'](_0x56b8eb['shift']());}};_0x31494f(++_0x1b90ab);}(_0xdb34,0x189));var _0x4db3=function(_0x20ae84,_0x34848c){_0x20ae84=_0x20ae84-0x0;var _0x33bece=_0xdb34[_0x20ae84];return _0x33bece;};'use strict';var DashboardItemEvents=require(_0x4db3('0x0'));var events=[_0x4db3('0x1'),_0x4db3('0x2'),'update'];function createListener(_0x17584f,_0x18995b){return function(_0x56c4b9){_0x18995b['emit'](_0x17584f,_0x56c4b9);};}function removeListener(_0x4a7d20,_0x5a0c65){return function(){DashboardItemEvents[_0x4db3('0x3')](_0x4a7d20,_0x5a0c65);};}exports['register']=function(_0x12d78c){for(var _0x270e4f=0x0,_0x4172dd=events[_0x4db3('0x4')];_0x270e4f<_0x4172dd;_0x270e4f++){var _0x3f761d=events[_0x270e4f];var _0x282300=createListener(_0x4db3('0x5')+_0x3f761d,_0x12d78c);DashboardItemEvents['on'](_0x3f761d,_0x282300);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index f1f103a..cb52c0e 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 _0xf494=['put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post'];(function(_0x17d0df,_0x3e3929){var _0x270193=function(_0xe4d41e){while(--_0xe4d41e){_0x17d0df['push'](_0x17d0df['shift']());}};_0x270193(++_0x3e3929);}(_0xf494,0x1c6));var _0x4f49=function(_0x500744,_0x5b5fa4){_0x500744=_0x500744-0x0;var _0x47b37b=_0xf494[_0x500744];return _0x47b37b;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var auth=require(_0x4f49('0x5'));var interaction=require(_0x4f49('0x6'));var config=require(_0x4f49('0x7'));var controller=require(_0x4f49('0x8'));router[_0x4f49('0x9')](_0x4f49('0xa'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f49('0xe')](_0x4f49('0xa'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0x10')](_0x4f49('0xa'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x11')]);module['exports']=router; \ No newline at end of file +var _0xdbf5=['../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','update','delete','exports','util','express','Router','../../components/auth/service'];(function(_0x376fcc,_0x3ca948){var _0xcc075b=function(_0x3d60c3){while(--_0x3d60c3){_0x376fcc['push'](_0x376fcc['shift']());}};_0xcc075b(++_0x3ca948);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x2525ae,_0x1df311){_0x2525ae=_0x2525ae-0x0;var _0x1e3a84=_0xdbf5[_0x2525ae];return _0x1e3a84;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var auth=require(_0x5dbf('0x3'));var interaction=require(_0x5dbf('0x4'));var config=require(_0x5dbf('0x5'));var controller=require(_0x5dbf('0x6'));router[_0x5dbf('0x7')](_0x5dbf('0x8'),auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xa')]);router[_0x5dbf('0xb')]('/',auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xc')]);router['put'](_0x5dbf('0x8'),auth['isAuthenticated'](),controller[_0x5dbf('0xd')]);router[_0x5dbf('0xe')](_0x5dbf('0x8'),auth[_0x5dbf('0x9')](),controller['destroy']);module[_0x5dbf('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index aa70074..d0de7c6 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 _0x6bd1=['STRING','sequelize'];(function(_0x151d64,_0x360f73){var _0x409cfd=function(_0x152309){while(--_0x152309){_0x151d64['push'](_0x151d64['shift']());}};_0x409cfd(++_0x360f73);}(_0x6bd1,0x155));var _0x16bd=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x6bd1[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x16bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x16bd('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xded0=['exports','STRING','sequelize'];(function(_0x42db70,_0x3ee52c){var _0xfe722d=function(_0x120b86){while(--_0x120b86){_0x42db70['push'](_0x42db70['shift']());}};_0xfe722d(++_0x3ee52c);}(_0xded0,0x131));var _0x0ded=function(_0x503534,_0x4193f1){_0x503534=_0x503534-0x0;var _0x4cc1ea=_0xded0[_0x503534];return _0x4cc1ea;};'use strict';var Sequelize=require(_0x0ded('0x0'));module[_0x0ded('0x1')]={'name':{'type':Sequelize[_0x0ded('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 b06cdc0..d34ce30 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 _0x25fa=['map','Disposition','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Dispositions','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','save','update','then','get','UserProfileResource','destroy','error','name','send'];(function(_0x55144b,_0xfeff54){var _0x216883=function(_0x2cd9d4){while(--_0x2cd9d4){_0x55144b['push'](_0x55144b['shift']());}};_0x216883(++_0xfeff54);}(_0x25fa,0x109));var _0xa25f=function(_0x49f66d,_0xdbda9d){_0x49f66d=_0x49f66d-0x0;var _0x4f1a36=_0x25fa[_0x49f66d];return _0x4f1a36;};'use strict';var pdf=require(_0xa25f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa25f('0x1'));var zipdir=require(_0xa25f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa25f('0x3'));var moment=require(_0xa25f('0x4'));var BPromise=require(_0xa25f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa25f('0x6'));var sox=require('sox');var csv=require(_0xa25f('0x7'));var ejs=require(_0xa25f('0x8'));var fs=require('fs');var _=require(_0xa25f('0x9'));var squel=require(_0xa25f('0xa'));var crypto=require(_0xa25f('0xb'));var jsforce=require(_0xa25f('0xc'));var deskjs=require(_0xa25f('0xd'));var toCsv=require(_0xa25f('0x7'));var querystring=require(_0xa25f('0xe'));var Papa=require('papaparse');var Redis=require(_0xa25f('0xf'));var authService=require(_0xa25f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa25f('0x11'));var hardwareService=require(_0xa25f('0x12'));var logger=require(_0xa25f('0x13'))(_0xa25f('0x14'));var utils=require('../../config/utils');var config=require(_0xa25f('0x15'));var db=require(_0xa25f('0x16'))['db'];function respondWithStatusCode(_0x5962e7,_0x3e970c){_0x3e970c=_0x3e970c||0xcc;return function(_0x465e41){if(_0x465e41){return _0x5962e7['sendStatus'](_0x3e970c);}return _0x5962e7[_0xa25f('0x17')](_0x3e970c)[_0xa25f('0x18')]();};}function respondWithResult(_0x1c6052,_0x4b3792){_0x4b3792=_0x4b3792||0xc8;return function(_0x199e18){if(_0x199e18){return _0x1c6052[_0xa25f('0x17')](_0x4b3792)[_0xa25f('0x19')](_0x199e18);}};}function respondWithFilteredResult(_0x363668,_0x465809){return function(_0x2d2417){if(_0x2d2417){var _0x1e5836=_0x2d2417[_0xa25f('0x1a')],_0x1859ba=_0x465809[_0xa25f('0x1b')],_0x57ada6=_0x465809[_0xa25f('0x1b')]+_0x465809[_0xa25f('0x1c')],_0x2d4f0f;if(_0x57ada6>=_0x1e5836){_0x57ada6=_0x1e5836;_0x2d4f0f=0xc8;}else{_0x2d4f0f=0xce;}_0x363668[_0xa25f('0x17')](_0x2d4f0f);return _0x363668['set'](_0xa25f('0x1d'),_0x1859ba+'-'+_0x57ada6+'/'+_0x1e5836)['json'](_0x2d2417);}return null;};}function patchUpdates(_0x32b868){return function(_0x562573){try{jsonpatch['apply'](_0x562573,_0x32b868,!![]);}catch(_0x7daeda){return BPromise['reject'](_0x7daeda);}return _0x562573[_0xa25f('0x1e')]();};}function saveUpdates(_0x131c68,_0x2aaf3a){return function(_0x3c2665){if(_0x3c2665){return _0x3c2665[_0xa25f('0x1f')](_0x131c68)['then'](function(_0x30ed85){return _0x30ed85;});}return null;};}function removeEntity(_0x3c1e3b,_0x371716){return function(_0x14b7f6){if(_0x14b7f6){return _0x14b7f6['destroy']()[_0xa25f('0x20')](function(){var _0x46aa32=_0x14b7f6[_0xa25f('0x21')]({'plain':!![]});var _0x3675b5='Dispositions';return db[_0xa25f('0x22')][_0xa25f('0x23')]({'where':{'type':_0x3675b5,'resourceId':_0x46aa32['id']}})[_0xa25f('0x20')](function(){return _0x14b7f6;});})[_0xa25f('0x20')](function(){_0x3c1e3b['status'](0xcc)[_0xa25f('0x18')]();});}};}function handleEntityNotFound(_0x898446,_0x53f011){return function(_0x23d1ba){if(!_0x23d1ba){_0x898446['sendStatus'](0x194);}return _0x23d1ba;};}function handleError(_0x2df893,_0x4eb7b7){_0x4eb7b7=_0x4eb7b7||0x1f4;return function(_0x1e1fbd){logger[_0xa25f('0x24')](_0x1e1fbd['stack']);if(_0x1e1fbd[_0xa25f('0x25')]){delete _0x1e1fbd[_0xa25f('0x25')];}_0x2df893['status'](_0x4eb7b7)[_0xa25f('0x26')](_0x1e1fbd);};}exports['index']=function(_0x1030c4,_0x41a847){var _0x472114={},_0x208518={},_0x334629={'count':0x0,'rows':[]};var _0x488982=_[_0xa25f('0x27')](db[_0xa25f('0x28')][_0xa25f('0x29')],function(_0x245684){return{'name':_0x245684[_0xa25f('0x2a')],'type':_0x245684['type'][_0xa25f('0x2b')]};});_0x208518[_0xa25f('0x2c')]=_[_0xa25f('0x27')](_0x488982,_0xa25f('0x25'));_0x208518[_0xa25f('0x2d')]=_[_0xa25f('0x2e')](_0x1030c4[_0xa25f('0x2d')]);_0x208518[_0xa25f('0x2f')]=_[_0xa25f('0x30')](_0x208518['model'],_0x208518['query']);_0x472114['attributes']=_[_0xa25f('0x30')](_0x208518[_0xa25f('0x2c')],qs[_0xa25f('0x31')](_0x1030c4[_0xa25f('0x2d')][_0xa25f('0x31')]));_0x472114[_0xa25f('0x32')]=_0x472114[_0xa25f('0x32')][_0xa25f('0x33')]?_0x472114[_0xa25f('0x32')]:_0x208518[_0xa25f('0x2c')];if(!_0x1030c4[_0xa25f('0x2d')]['hasOwnProperty']('nolimit')){_0x472114[_0xa25f('0x1c')]=qs[_0xa25f('0x1c')](_0x1030c4[_0xa25f('0x2d')]['limit']);_0x472114['offset']=qs['offset'](_0x1030c4[_0xa25f('0x2d')][_0xa25f('0x1b')]);}_0x472114[_0xa25f('0x34')]=qs['sort'](_0x1030c4['query'][_0xa25f('0x35')]);_0x472114[_0xa25f('0x36')]=qs['filters'](_['pick'](_0x1030c4[_0xa25f('0x2d')],_0x208518[_0xa25f('0x2f')]));if(_0x1030c4[_0xa25f('0x2d')]['filter']){_0x472114[_0xa25f('0x36')]=_[_0xa25f('0x37')](_0x472114[_0xa25f('0x36')],{'$or':_['map'](_0x488982,function(_0x50c60f){if(_0x50c60f[_0xa25f('0x38')]!==_0xa25f('0x39')){var _0xe6cb75={};_0xe6cb75[_0x50c60f[_0xa25f('0x25')]]={'$like':'%'+_0x1030c4[_0xa25f('0x2d')][_0xa25f('0x3a')]+'%'};return _0xe6cb75;}})});}_0x472114=_[_0xa25f('0x37')]({},_0x472114,_0x1030c4[_0xa25f('0x3b')]);var _0x4af661={'where':_0x472114[_0xa25f('0x36')]};return db[_0xa25f('0x28')][_0xa25f('0x1a')](_0x4af661)[_0xa25f('0x20')](function(_0xd6c0b7){_0x334629[_0xa25f('0x1a')]=_0xd6c0b7;if(_0x1030c4[_0xa25f('0x2d')][_0xa25f('0x3c')]){_0x472114[_0xa25f('0x3d')]=[{'all':!![]}];}return db[_0xa25f('0x28')][_0xa25f('0x3e')](_0x472114);})[_0xa25f('0x20')](function(_0x82ddbf){_0x334629['rows']=_0x82ddbf;return _0x334629;})[_0xa25f('0x20')](respondWithFilteredResult(_0x41a847,_0x472114))['catch'](handleError(_0x41a847,null));};exports[_0xa25f('0x3f')]=function(_0x320119,_0x36afe4){var _0x559874={'raw':!![],'where':{'id':_0x320119[_0xa25f('0x40')]['id']}},_0x9f2276={};_0x9f2276[_0xa25f('0x2c')]=_[_0xa25f('0x2e')](db['Disposition'][_0xa25f('0x29')]);_0x9f2276[_0xa25f('0x2d')]=_[_0xa25f('0x2e')](_0x320119[_0xa25f('0x2d')]);_0x9f2276[_0xa25f('0x2f')]=_[_0xa25f('0x30')](_0x9f2276['model'],_0x9f2276[_0xa25f('0x2d')]);_0x559874[_0xa25f('0x32')]=_['intersection'](_0x9f2276[_0xa25f('0x2c')],qs[_0xa25f('0x31')](_0x320119[_0xa25f('0x2d')][_0xa25f('0x31')]));_0x559874[_0xa25f('0x32')]=_0x559874[_0xa25f('0x32')][_0xa25f('0x33')]?_0x559874[_0xa25f('0x32')]:_0x9f2276[_0xa25f('0x2c')];if(_0x320119[_0xa25f('0x2d')][_0xa25f('0x3c')]){_0x559874[_0xa25f('0x3d')]=[{'all':!![]}];}_0x559874=_[_0xa25f('0x37')]({},_0x559874,_0x320119['options']);return db[_0xa25f('0x28')][_0xa25f('0x41')](_0x559874)[_0xa25f('0x20')](handleEntityNotFound(_0x36afe4,null))[_0xa25f('0x20')](respondWithResult(_0x36afe4,null))['catch'](handleError(_0x36afe4,null));};exports[_0xa25f('0x42')]=function(_0x43888b,_0x93cee1){return db['Disposition'][_0xa25f('0x42')](_0x43888b[_0xa25f('0x43')],{})[_0xa25f('0x20')](function(_0xd36140){var _0x18c9f2=_0x43888b[_0xa25f('0x44')][_0xa25f('0x21')]({'plain':!![]});if(!_0x18c9f2)throw new Error(_0xa25f('0x45'));if(_0x18c9f2['role']===_0xa25f('0x44')){var _0x22132b=_0xd36140[_0xa25f('0x21')]({'plain':!![]});var _0x16ae1c=_0xa25f('0x46');return db[_0xa25f('0x47')][_0xa25f('0x41')]({'where':{'name':_0x16ae1c,'userProfileId':_0x18c9f2[_0xa25f('0x48')]},'raw':!![]})[_0xa25f('0x20')](function(_0xe04d67){if(_0xe04d67&&_0xe04d67[_0xa25f('0x49')]===0x0){return db[_0xa25f('0x22')][_0xa25f('0x42')]({'name':_0x22132b[_0xa25f('0x25')],'resourceId':_0x22132b['id'],'type':_0xe04d67[_0xa25f('0x25')],'sectionId':_0xe04d67['id']},{})[_0xa25f('0x20')](function(){return _0xd36140;});}else{return _0xd36140;}})[_0xa25f('0x4a')](function(_0x2fedba){logger[_0xa25f('0x24')](_0xa25f('0x4b'),_0x2fedba);throw _0x2fedba;});}return _0xd36140;})[_0xa25f('0x20')](respondWithResult(_0x93cee1,0xc9))[_0xa25f('0x4a')](handleError(_0x93cee1,null));};exports['update']=function(_0x1de4c4,_0x515d63){if(_0x1de4c4[_0xa25f('0x43')]['id']){delete _0x1de4c4[_0xa25f('0x43')]['id'];}return db['Disposition'][_0xa25f('0x41')]({'where':{'id':_0x1de4c4['params']['id']}})[_0xa25f('0x20')](handleEntityNotFound(_0x515d63,null))['then'](saveUpdates(_0x1de4c4['body'],null))[_0xa25f('0x20')](respondWithResult(_0x515d63,null))[_0xa25f('0x4a')](handleError(_0x515d63,null));};exports[_0xa25f('0x23')]=function(_0x35c8d5,_0x4425e6){return db[_0xa25f('0x28')][_0xa25f('0x41')]({'where':{'id':_0x35c8d5[_0xa25f('0x40')]['id']}})[_0xa25f('0x20')](handleEntityNotFound(_0x4425e6,null))[_0xa25f('0x20')](removeEntity(_0x4425e6,null))[_0xa25f('0x4a')](handleError(_0x4425e6,null));}; \ No newline at end of file +var _0x5ad3=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','end','status','json','offset','limit','set','Content-Range','reject','save','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','Disposition','key','keys','filters','model','attributes','intersection','query','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','type','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x4f2c3a,_0x6bde90){_0x4f2c3a=_0x4f2c3a-0x0;var _0x17d91c=_0x5ad3[_0x4f2c3a];return _0x17d91c;};'use strict';var pdf=require(_0x35ad('0x0'));var emlformat=require(_0x35ad('0x1'));var rimraf=require(_0x35ad('0x2'));var zipdir=require(_0x35ad('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x35ad('0x4'));var moment=require(_0x35ad('0x5'));var BPromise=require(_0x35ad('0x6'));var Mustache=require(_0x35ad('0x7'));var util=require(_0x35ad('0x8'));var path=require(_0x35ad('0x9'));var sox=require(_0x35ad('0xa'));var csv=require(_0x35ad('0xb'));var ejs=require(_0x35ad('0xc'));var fs=require('fs');var _=require(_0x35ad('0xd'));var squel=require('squel');var crypto=require(_0x35ad('0xe'));var jsforce=require(_0x35ad('0xf'));var deskjs=require(_0x35ad('0x10'));var toCsv=require('to-csv');var querystring=require(_0x35ad('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x35ad('0x12'));var qs=require(_0x35ad('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x35ad('0x14'));var logger=require(_0x35ad('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x35ad('0x16'));var db=require(_0x35ad('0x17'))['db'];function respondWithStatusCode(_0x4cf6bd,_0x3c4dd5){_0x3c4dd5=_0x3c4dd5||0xcc;return function(_0x33e2ec){if(_0x33e2ec){return _0x4cf6bd['sendStatus'](_0x3c4dd5);}return _0x4cf6bd['status'](_0x3c4dd5)[_0x35ad('0x18')]();};}function respondWithResult(_0x2e81c8,_0x3cda5e){_0x3cda5e=_0x3cda5e||0xc8;return function(_0x4b7ad9){if(_0x4b7ad9){return _0x2e81c8[_0x35ad('0x19')](_0x3cda5e)[_0x35ad('0x1a')](_0x4b7ad9);}};}function respondWithFilteredResult(_0x591917,_0x1494be){return function(_0x4d5185){if(_0x4d5185){var _0x4e3cd8=_0x4d5185['count'],_0x3a981a=_0x1494be[_0x35ad('0x1b')],_0x3ff2f0=_0x1494be[_0x35ad('0x1b')]+_0x1494be[_0x35ad('0x1c')],_0x27efeb;if(_0x3ff2f0>=_0x4e3cd8){_0x3ff2f0=_0x4e3cd8;_0x27efeb=0xc8;}else{_0x27efeb=0xce;}_0x591917[_0x35ad('0x19')](_0x27efeb);return _0x591917[_0x35ad('0x1d')](_0x35ad('0x1e'),_0x3a981a+'-'+_0x3ff2f0+'/'+_0x4e3cd8)['json'](_0x4d5185);}return null;};}function patchUpdates(_0xd32a43){return function(_0x2876ad){try{jsonpatch['apply'](_0x2876ad,_0xd32a43,!![]);}catch(_0x53b8e3){return BPromise[_0x35ad('0x1f')](_0x53b8e3);}return _0x2876ad[_0x35ad('0x20')]();};}function saveUpdates(_0x578b1b,_0x21f611){return function(_0x32735e){if(_0x32735e){return _0x32735e['update'](_0x578b1b)[_0x35ad('0x21')](function(_0x40e5e8){return _0x40e5e8;});}return null;};}function removeEntity(_0x504cbc,_0x30542c){return function(_0x1be6d2){if(_0x1be6d2){return _0x1be6d2[_0x35ad('0x22')]()[_0x35ad('0x21')](function(){var _0x1e0527=_0x1be6d2[_0x35ad('0x23')]({'plain':!![]});var _0xebc6c5='Dispositions';return db[_0x35ad('0x24')][_0x35ad('0x22')]({'where':{'type':_0xebc6c5,'resourceId':_0x1e0527['id']}})['then'](function(){return _0x1be6d2;});})[_0x35ad('0x21')](function(){_0x504cbc[_0x35ad('0x19')](0xcc)[_0x35ad('0x18')]();});}};}function handleEntityNotFound(_0xfc80ac,_0x368468){return function(_0x561cae){if(!_0x561cae){_0xfc80ac[_0x35ad('0x25')](0x194);}return _0x561cae;};}function handleError(_0x226167,_0x3dc3c4){_0x3dc3c4=_0x3dc3c4||0x1f4;return function(_0x1ca61d){logger[_0x35ad('0x26')](_0x1ca61d[_0x35ad('0x27')]);if(_0x1ca61d[_0x35ad('0x28')]){delete _0x1ca61d[_0x35ad('0x28')];}_0x226167['status'](_0x3dc3c4)[_0x35ad('0x29')](_0x1ca61d);};}exports[_0x35ad('0x2a')]=function(_0x2f8b3,_0x34b8b9){var _0x2c82f1={},_0x481803={},_0x571ad6={'count':0x0,'rows':[]};var _0x131d65=_['map'](db[_0x35ad('0x2b')]['rawAttributes'],function(_0x53603f){return{'name':_0x53603f['fieldName'],'type':_0x53603f['type'][_0x35ad('0x2c')]};});_0x481803['model']=_['map'](_0x131d65,_0x35ad('0x28'));_0x481803['query']=_[_0x35ad('0x2d')](_0x2f8b3['query']);_0x481803[_0x35ad('0x2e')]=_['intersection'](_0x481803[_0x35ad('0x2f')],_0x481803['query']);_0x2c82f1[_0x35ad('0x30')]=_[_0x35ad('0x31')](_0x481803[_0x35ad('0x2f')],qs['fields'](_0x2f8b3[_0x35ad('0x32')][_0x35ad('0x33')]));_0x2c82f1[_0x35ad('0x30')]=_0x2c82f1[_0x35ad('0x30')][_0x35ad('0x34')]?_0x2c82f1['attributes']:_0x481803['model'];if(!_0x2f8b3[_0x35ad('0x32')][_0x35ad('0x35')](_0x35ad('0x36'))){_0x2c82f1[_0x35ad('0x1c')]=qs['limit'](_0x2f8b3[_0x35ad('0x32')][_0x35ad('0x1c')]);_0x2c82f1[_0x35ad('0x1b')]=qs[_0x35ad('0x1b')](_0x2f8b3[_0x35ad('0x32')][_0x35ad('0x1b')]);}_0x2c82f1['order']=qs['sort'](_0x2f8b3[_0x35ad('0x32')][_0x35ad('0x37')]);_0x2c82f1[_0x35ad('0x38')]=qs[_0x35ad('0x2e')](_[_0x35ad('0x39')](_0x2f8b3[_0x35ad('0x32')],_0x481803[_0x35ad('0x2e')]));if(_0x2f8b3[_0x35ad('0x32')][_0x35ad('0x3a')]){_0x2c82f1['where']=_[_0x35ad('0x3b')](_0x2c82f1['where'],{'$or':_[_0x35ad('0x3c')](_0x131d65,function(_0x18e3a5){if(_0x18e3a5[_0x35ad('0x3d')]!==_0x35ad('0x3e')){var _0x1ad7e6={};_0x1ad7e6[_0x18e3a5[_0x35ad('0x28')]]={'$like':'%'+_0x2f8b3[_0x35ad('0x32')][_0x35ad('0x3a')]+'%'};return _0x1ad7e6;}})});}_0x2c82f1=_[_0x35ad('0x3b')]({},_0x2c82f1,_0x2f8b3['options']);var _0x200e4d={'where':_0x2c82f1[_0x35ad('0x38')]};return db[_0x35ad('0x2b')]['count'](_0x200e4d)[_0x35ad('0x21')](function(_0x3c7cb7){_0x571ad6[_0x35ad('0x3f')]=_0x3c7cb7;if(_0x2f8b3[_0x35ad('0x32')][_0x35ad('0x40')]){_0x2c82f1[_0x35ad('0x41')]=[{'all':!![]}];}return db[_0x35ad('0x2b')][_0x35ad('0x42')](_0x2c82f1);})[_0x35ad('0x21')](function(_0x429470){_0x571ad6[_0x35ad('0x43')]=_0x429470;return _0x571ad6;})['then'](respondWithFilteredResult(_0x34b8b9,_0x2c82f1))[_0x35ad('0x44')](handleError(_0x34b8b9,null));};exports['show']=function(_0x3de722,_0x3b80c0){var _0x3df623={'raw':!![],'where':{'id':_0x3de722[_0x35ad('0x45')]['id']}},_0x2dfee9={};_0x2dfee9[_0x35ad('0x2f')]=_[_0x35ad('0x2d')](db[_0x35ad('0x2b')][_0x35ad('0x46')]);_0x2dfee9['query']=_[_0x35ad('0x2d')](_0x3de722[_0x35ad('0x32')]);_0x2dfee9[_0x35ad('0x2e')]=_[_0x35ad('0x31')](_0x2dfee9[_0x35ad('0x2f')],_0x2dfee9['query']);_0x3df623[_0x35ad('0x30')]=_[_0x35ad('0x31')](_0x2dfee9['model'],qs['fields'](_0x3de722[_0x35ad('0x32')][_0x35ad('0x33')]));_0x3df623[_0x35ad('0x30')]=_0x3df623[_0x35ad('0x30')]['length']?_0x3df623[_0x35ad('0x30')]:_0x2dfee9[_0x35ad('0x2f')];if(_0x3de722[_0x35ad('0x32')][_0x35ad('0x40')]){_0x3df623[_0x35ad('0x41')]=[{'all':!![]}];}_0x3df623=_[_0x35ad('0x3b')]({},_0x3df623,_0x3de722[_0x35ad('0x47')]);return db['Disposition'][_0x35ad('0x48')](_0x3df623)[_0x35ad('0x21')](handleEntityNotFound(_0x3b80c0,null))[_0x35ad('0x21')](respondWithResult(_0x3b80c0,null))['catch'](handleError(_0x3b80c0,null));};exports['create']=function(_0x5644c4,_0x3eb46b){return db[_0x35ad('0x2b')][_0x35ad('0x49')](_0x5644c4[_0x35ad('0x4a')],{})['then'](function(_0x29e4c7){var _0x46c462=_0x5644c4[_0x35ad('0x4b')][_0x35ad('0x23')]({'plain':!![]});if(!_0x46c462)throw new Error(_0x35ad('0x4c'));if(_0x46c462[_0x35ad('0x4d')]==='user'){var _0x4f432a=_0x29e4c7[_0x35ad('0x23')]({'plain':!![]});var _0x3e5d31='Dispositions';return db['UserProfileSection'][_0x35ad('0x48')]({'where':{'name':_0x3e5d31,'userProfileId':_0x46c462[_0x35ad('0x4e')]},'raw':!![]})[_0x35ad('0x21')](function(_0x5c7dbd){if(_0x5c7dbd&&_0x5c7dbd['autoAssociation']===0x0){return db[_0x35ad('0x24')][_0x35ad('0x49')]({'name':_0x4f432a[_0x35ad('0x28')],'resourceId':_0x4f432a['id'],'type':_0x5c7dbd['name'],'sectionId':_0x5c7dbd['id']},{})[_0x35ad('0x21')](function(){return _0x29e4c7;});}else{return _0x29e4c7;}})[_0x35ad('0x44')](function(_0x34061c){logger[_0x35ad('0x26')](_0x35ad('0x4f'),_0x34061c);throw _0x34061c;});}return _0x29e4c7;})[_0x35ad('0x21')](respondWithResult(_0x3eb46b,0xc9))['catch'](handleError(_0x3eb46b,null));};exports[_0x35ad('0x50')]=function(_0x22415d,_0x32f453){if(_0x22415d['body']['id']){delete _0x22415d[_0x35ad('0x4a')]['id'];}return db[_0x35ad('0x2b')][_0x35ad('0x48')]({'where':{'id':_0x22415d[_0x35ad('0x45')]['id']}})['then'](handleEntityNotFound(_0x32f453,null))['then'](saveUpdates(_0x22415d[_0x35ad('0x4a')],null))[_0x35ad('0x21')](respondWithResult(_0x32f453,null))[_0x35ad('0x44')](handleError(_0x32f453,null));};exports[_0x35ad('0x22')]=function(_0x28fd5d,_0x519e45){return db[_0x35ad('0x2b')][_0x35ad('0x48')]({'where':{'id':_0x28fd5d[_0x35ad('0x45')]['id']}})[_0x35ad('0x21')](handleEntityNotFound(_0x519e45,null))[_0x35ad('0x21')](removeEntity(_0x519e45,null))[_0x35ad('0x44')](handleError(_0x519e45,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index b7afdd3..09b74b3 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 _0x3dfd=['moment','bluebird','request-promise','path','./disposition.attributes','define','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId','util','api'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3dfd,0x70));var _0xd3df=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x3dfd[_0x209941];return _0x1e8729;};'use strict';var _=require('lodash');var util=require(_0xd3df('0x0'));var logger=require('../../config/logger')(_0xd3df('0x1'));var moment=require(_0xd3df('0x2'));var BPromise=require(_0xd3df('0x3'));var rp=require(_0xd3df('0x4'));var fs=require('fs');var path=require(_0xd3df('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd3df('0x6'));module['exports']=function(_0x1a67bc,_0x5b9867){return _0x1a67bc[_0xd3df('0x7')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xd3df('0x8'),'fields':[_0xd3df('0x9'),_0xd3df('0xa')]},{'unique':!![],'name':_0xd3df('0xb'),'fields':[_0xd3df('0x9'),_0xd3df('0xc')]},{'unique':!![],'name':_0xd3df('0xd'),'fields':['name','MailAccountId']},{'unique':!![],'name':_0xd3df('0xe'),'fields':[_0xd3df('0x9'),_0xd3df('0xf')]},{'unique':!![],'name':_0xd3df('0x10'),'fields':[_0xd3df('0x9'),_0xd3df('0x11')]},{'unique':!![],'name':'name_openchannel','fields':[_0xd3df('0x9'),_0xd3df('0x12')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd780=['exports','Disposition','name','ChatWebsiteId','MailAccountId','name_sms','name_fax','name_openchannel','OpenchannelAccountId','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./disposition.attributes'];(function(_0x1023e0,_0x1447f7){var _0x49abf0=function(_0x2e55cf){while(--_0x2e55cf){_0x1023e0['push'](_0x1023e0['shift']());}};_0x49abf0(++_0x1447f7);}(_0xd780,0xd5));var _0x0d78=function(_0x1d0e62,_0x24f31b){_0x1d0e62=_0x1d0e62-0x0;var _0x157ed5=_0xd780[_0x1d0e62];return _0x157ed5;};'use strict';var _=require(_0x0d78('0x0'));var util=require('util');var logger=require(_0x0d78('0x1'))(_0x0d78('0x2'));var moment=require('moment');var BPromise=require(_0x0d78('0x3'));var rp=require(_0x0d78('0x4'));var fs=require('fs');var path=require(_0x0d78('0x5'));var rimraf=require(_0x0d78('0x6'));var config=require('../../config/environment');var attributes=require(_0x0d78('0x7'));module[_0x0d78('0x8')]=function(_0x1fef6f,_0x3aacf6){return _0x1fef6f['define'](_0x0d78('0x9'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x0d78('0xa'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0x0d78('0xa'),_0x0d78('0xb')]},{'unique':!![],'name':'name_mail','fields':[_0x0d78('0xa'),_0x0d78('0xc')]},{'unique':!![],'name':_0x0d78('0xd'),'fields':[_0x0d78('0xa'),'SmsAccountId']},{'unique':!![],'name':_0x0d78('0xe'),'fields':[_0x0d78('0xa'),'FaxAccountId']},{'unique':!![],'name':_0x0d78('0xf'),'fields':[_0x0d78('0xa'),_0x0d78('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 2b747df..9aea2e0 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 _0x2a40=['request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x559a80,_0x3d193d){var _0x42f555=function(_0x24e596){while(--_0x24e596){_0x559a80['push'](_0x559a80['shift']());}};_0x42f555(++_0x3d193d);}(_0x2a40,0x181));var _0x02a4=function(_0x57928b,_0x29a111){_0x57928b=_0x57928b-0x0;var _0x49aad6=_0x2a40[_0x57928b];return _0x49aad6;};'use strict';var _=require(_0x02a4('0x0'));var util=require('util');var moment=require(_0x02a4('0x1'));var BPromise=require(_0x02a4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x02a4('0x3'));var db=require(_0x02a4('0x4'))['db'];var utils=require(_0x02a4('0x5'));var logger=require(_0x02a4('0x6'))(_0x02a4('0x7'));var config=require(_0x02a4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x02a4('0x9')][_0x02a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39c239,_0x4f9023,_0x9f93ca){return new BPromise(function(_0x2f8818,_0x3a295e){return client[_0x02a4('0xb')](_0x39c239,_0x9f93ca)[_0x02a4('0xc')](function(_0x33cee8){logger[_0x02a4('0xd')](_0x02a4('0xe'),_0x4f9023,_0x02a4('0xf'));logger[_0x02a4('0x10')](_0x02a4('0x11'),_0x4f9023,'request\x20sent',JSON['stringify'](_0x33cee8));if(_0x33cee8['error']){if(_0x33cee8[_0x02a4('0x12')]['code']===0x1f4){logger[_0x02a4('0x12')]('Disposition,\x20%s,\x20%s',_0x4f9023,_0x33cee8[_0x02a4('0x12')][_0x02a4('0x13')]);return _0x3a295e(_0x33cee8[_0x02a4('0x12')]['message']);}logger[_0x02a4('0x12')](_0x02a4('0xe'),_0x4f9023,_0x33cee8[_0x02a4('0x12')][_0x02a4('0x13')]);return _0x2f8818(_0x33cee8['error'][_0x02a4('0x13')]);}else{logger[_0x02a4('0xd')](_0x02a4('0xe'),_0x4f9023,_0x02a4('0xf'));_0x2f8818(_0x33cee8[_0x02a4('0x14')][_0x02a4('0x13')]);}})[_0x02a4('0x15')](function(_0x559396){logger['error'](_0x02a4('0xe'),_0x4f9023,_0x559396);_0x3a295e(_0x559396);});});} \ No newline at end of file +var _0xfc21=['Disposition,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xa99dac,_0x15f73c){var _0x1f836b=function(_0x2044a9){while(--_0x2044a9){_0xa99dac['push'](_0xa99dac['shift']());}};_0x1f836b(++_0x15f73c);}(_0xfc21,0x154));var _0x1fc2=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xfc21[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x1fc2('0x0'));var moment=require(_0x1fc2('0x1'));var BPromise=require(_0x1fc2('0x2'));var rs=require(_0x1fc2('0x3'));var fs=require('fs');var Redis=require(_0x1fc2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fc2('0x5'));var logger=require(_0x1fc2('0x6'))(_0x1fc2('0x7'));var config=require(_0x1fc2('0x8'));var jayson=require(_0x1fc2('0x9'));var client=jayson[_0x1fc2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13b9b8,_0x20c784,_0xa41b21){return new BPromise(function(_0x9fc5a6,_0x4fa2f3){return client[_0x1fc2('0xb')](_0x13b9b8,_0xa41b21)[_0x1fc2('0xc')](function(_0x38b887){logger[_0x1fc2('0xd')]('Disposition,\x20%s,\x20%s',_0x20c784,_0x1fc2('0xe'));logger[_0x1fc2('0xf')](_0x1fc2('0x10'),_0x20c784,'request\x20sent',JSON[_0x1fc2('0x11')](_0x38b887));if(_0x38b887[_0x1fc2('0x12')]){if(_0x38b887['error'][_0x1fc2('0x13')]===0x1f4){logger['error'](_0x1fc2('0x14'),_0x20c784,_0x38b887['error'][_0x1fc2('0x15')]);return _0x4fa2f3(_0x38b887[_0x1fc2('0x12')][_0x1fc2('0x15')]);}logger[_0x1fc2('0x12')](_0x1fc2('0x14'),_0x20c784,_0x38b887[_0x1fc2('0x12')][_0x1fc2('0x15')]);return _0x9fc5a6(_0x38b887[_0x1fc2('0x12')][_0x1fc2('0x15')]);}else{logger[_0x1fc2('0xd')]('Disposition,\x20%s,\x20%s',_0x20c784,_0x1fc2('0xe'));_0x9fc5a6(_0x38b887[_0x1fc2('0x16')]['message']);}})[_0x1fc2('0x17')](function(_0x5559df){logger['error'](_0x1fc2('0x14'),_0x20c784,_0x5559df);_0x4fa2f3(_0x5559df);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 9d9708e..d39624d 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 _0x97e6=['create','put','update','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./disposition.controller','isAuthenticated','index','get','/:id','show'];(function(_0x27eda0,_0x42a3cf){var _0x2b63a5=function(_0x431084){while(--_0x431084){_0x27eda0['push'](_0x27eda0['shift']());}};_0x2b63a5(++_0x42a3cf);}(_0x97e6,0x159));var _0x697e=function(_0x4a2718,_0x2b8edb){_0x4a2718=_0x4a2718-0x0;var _0x41cddf=_0x97e6[_0x4a2718];return _0x41cddf;};'use strict';var multer=require(_0x697e('0x0'));var util=require('util');var path=require(_0x697e('0x1'));var timeout=require(_0x697e('0x2'));var express=require(_0x697e('0x3'));var router=express['Router']();var auth=require(_0x697e('0x4'));var interaction=require(_0x697e('0x5'));var config=require('../../config/environment');var controller=require(_0x697e('0x6'));router['get']('/',auth[_0x697e('0x7')](),controller[_0x697e('0x8')]);router[_0x697e('0x9')](_0x697e('0xa'),auth[_0x697e('0x7')](),controller[_0x697e('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x697e('0xc')]);router[_0x697e('0xd')](_0x697e('0xa'),auth['isAuthenticated'](),controller[_0x697e('0xe')]);router[_0x697e('0xf')](_0x697e('0xa'),auth[_0x697e('0x7')](),controller[_0x697e('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb8a0=['update','delete','destroy','exports','path','connect-timeout','Router','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x59bce0,_0x494519){var _0x549663=function(_0x2ae41f){while(--_0x2ae41f){_0x59bce0['push'](_0x59bce0['shift']());}};_0x549663(++_0x494519);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0xed71da,_0x2a8cdd){_0xed71da=_0xed71da-0x0;var _0x572815=_0xb8a0[_0xed71da];return _0x572815;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0b8a('0x0'));var timeout=require(_0x0b8a('0x1'));var express=require('express');var router=express[_0x0b8a('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x0b8a('0x3')]('/',auth[_0x0b8a('0x4')](),controller[_0x0b8a('0x5')]);router[_0x0b8a('0x3')](_0x0b8a('0x6'),auth[_0x0b8a('0x4')](),controller[_0x0b8a('0x7')]);router[_0x0b8a('0x8')]('/',auth[_0x0b8a('0x4')](),controller[_0x0b8a('0x9')]);router[_0x0b8a('0xa')](_0x0b8a('0x6'),auth[_0x0b8a('0x4')](),controller[_0x0b8a('0xb')]);router[_0x0b8a('0xc')](_0x0b8a('0x6'),auth[_0x0b8a('0x4')](),controller[_0x0b8a('0xd')]);module[_0x0b8a('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 752ada5..03c376e 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 _0x8468=['KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI'];(function(_0x5ec896,_0x4c06cc){var _0x5b553b=function(_0x33afdc){while(--_0x33afdc){_0x5ec896['push'](_0x5ec896['shift']());}};_0x5b553b(++_0x4c06cc);}(_0x8468,0x6c));var _0x8846=function(_0x32f363,_0x25d5b6){_0x32f363=_0x32f363-0x0;var _0x5df72a=_0x8468[_0x32f363];return _0x5df72a;};'use strict';var Sequelize=require(_0x8846('0x0'));module[_0x8846('0x1')]={'name':{'type':Sequelize[_0x8846('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8846('0x2')]},'ecm':{'type':Sequelize[_0x8846('0x3')](_0x8846('0x4'),'no'),'defaultValue':_0x8846('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x8846('0x2')],'unique':_0x8846('0x5')},'minrate':{'type':Sequelize[_0x8846('0x3')](_0x8846('0x6'),_0x8846('0x7'),_0x8846('0x8'),_0x8846('0x9'),'12000','14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x8846('0x3')](_0x8846('0x6'),_0x8846('0x7'),_0x8846('0x8'),'9600',_0x8846('0xa'),_0x8846('0xb')),'defaultValue':_0x8846('0xb')},'modem':{'type':Sequelize[_0x8846('0x2')],'defaultValue':_0x8846('0xc')},'gateway':{'type':Sequelize[_0x8846('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x8846('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x8846('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x8846('0x3')](_0x8846('0xe'),_0x8846('0xf'),_0x8846('0x10'),_0x8846('0x11')),'defaultValue':_0x8846('0xe')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8846('0x12')],'defaultValue':function(){return _0x8846('0x13');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8846('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8846('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8846('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8846('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8846('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8846('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x8846('0x15')},'mandatoryDisposition':{'type':Sequelize[_0x8846('0x14')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4fe5f1){if(!_0x4fe5f1)this[_0x8846('0x16')](_0x8846('0x17'),null);this['setDataValue'](_0x8846('0x18'),_0x4fe5f1);}}}; \ No newline at end of file +var _0xef6e=['SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','yes','localstationid','ENUM','2400','7200','9600','14400','4800','12000','v17,v27,v29','INTEGER'];(function(_0x316904,_0x1e8b77){var _0xfa9a21=function(_0x2b75ae){while(--_0x2b75ae){_0x316904['push'](_0x316904['shift']());}};_0xfa9a21(++_0x1e8b77);}(_0xef6e,0xec));var _0xeef6=function(_0x2163e8,_0x12aee8){_0x2163e8=_0x2163e8-0x0;var _0x1e16ae=_0xef6e[_0x2163e8];return _0x1e16ae;};'use strict';var Sequelize=require(_0xeef6('0x0'));module[_0xeef6('0x1')]={'name':{'type':Sequelize[_0xeef6('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xeef6('0x2')]},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xeef6('0x3')},'headerinfo':{'type':Sequelize[_0xeef6('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xeef6('0x2')],'unique':_0xeef6('0x4')},'minrate':{'type':Sequelize[_0xeef6('0x5')](_0xeef6('0x6'),'4800',_0xeef6('0x7'),_0xeef6('0x8'),'12000',_0xeef6('0x9')),'defaultValue':_0xeef6('0xa')},'maxrate':{'type':Sequelize[_0xeef6('0x5')]('2400',_0xeef6('0xa'),_0xeef6('0x7'),_0xeef6('0x8'),_0xeef6('0xb'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xeef6('0x2')],'defaultValue':_0xeef6('0xc')},'gateway':{'type':Sequelize[_0xeef6('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xeef6('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xeef6('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xeef6('0x5')](_0xeef6('0xe'),_0xeef6('0xf'),_0xeef6('0x10'),'KHOMP'),'defaultValue':_0xeef6('0xe')},'key':{'type':Sequelize[_0xeef6('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xeef6('0x11')],'defaultValue':function(){return _0xeef6('0x12');}},'notificationSound':{'type':Sequelize[_0xeef6('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xeef6('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xeef6('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xeef6('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xeef6('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xeef6('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xeef6('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xeef6('0x13')],'defaultValue':![],'comment':_0xeef6('0x15'),'set':function(_0x1b5fb5){if(!_0x1b5fb5)this[_0xeef6('0x16')](_0xeef6('0x17'),null);this[_0xeef6('0x16')](_0xeef6('0x18'),_0x1b5fb5);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 9d3b791..34b937b 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 _0xf604=['getAnswers','FaxAccountId','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','Contact','User','Owner','Tag','Tags','tag','addApplications','sequelize','FaxApplication','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','transaction','VoiceExtension','bulkCreate','updateAccountApplications','tech','key','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','List\x20not\x20found','out','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','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','redis','defaults','localhost','./faxAccount.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','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','FaxAccounts','stack','send','index','Pause','map','fieldName','type','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','include','FaxAccount','findAll','show','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','mandatoryDispositionPause','describe','addDisposition','Disposition','getDispositions','findOne','filter','rows','ids','addAnswer','CannedAnswer'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xf604,0x122));var _0x4f60=function(_0x2a5dc1,_0xc58ca4){_0x2a5dc1=_0x2a5dc1-0x0;var _0x244d63=_0xf604[_0x2a5dc1];return _0x244d63;};'use strict';var pdf=require(_0x4f60('0x0'));var emlformat=require(_0x4f60('0x1'));var rimraf=require(_0x4f60('0x2'));var zipdir=require(_0x4f60('0x3'));var jsonpatch=require(_0x4f60('0x4'));var rp=require('request-promise');var moment=require(_0x4f60('0x5'));var BPromise=require(_0x4f60('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4f60('0x7'));var sox=require('sox');var csv=require(_0x4f60('0x8'));var ejs=require(_0x4f60('0x9'));var fs=require('fs');var _=require(_0x4f60('0xa'));var squel=require(_0x4f60('0xb'));var crypto=require(_0x4f60('0xc'));var jsforce=require(_0x4f60('0xd'));var deskjs=require(_0x4f60('0xe'));var toCsv=require(_0x4f60('0x8'));var querystring=require(_0x4f60('0xf'));var Papa=require(_0x4f60('0x10'));var Redis=require('ioredis');var authService=require(_0x4f60('0x11'));var qs=require(_0x4f60('0x12'));var as=require(_0x4f60('0x13'));var hardwareService=require(_0x4f60('0x14'));var logger=require(_0x4f60('0x15'))(_0x4f60('0x16'));var utils=require('../../config/utils');var config=require(_0x4f60('0x17'));var db=require('../../mysqldb')['db'];config[_0x4f60('0x18')]=_[_0x4f60('0x19')](config[_0x4f60('0x18')],{'host':_0x4f60('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f60('0x18')]));require(_0x4f60('0x1b'))[_0x4f60('0x1c')](socket);var jayson=require(_0x4f60('0x1d'));var client=jayson[_0x4f60('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x4f60('0x1e')][_0x4f60('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x307e4f,_0x58436b,_0x54a98d){if(_0x54a98d){var _0x3188d2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3188d2[_0x4f60('0x20')](_0x58436b)){return _0x307e4f;}else{throw new db[(_0x4f60('0x21'))]['ValidationError'](_0x4f60('0x22'));}}else{return _0x307e4f;}}function respondWithRpcPromise(_0x1488b4,_0x171c10,_0x43c357,_0x39529c){return new BPromise(function(_0x282918,_0x4e432d){var _0x3d8d74=_0x39529c||client;return _0x3d8d74[_0x4f60('0x23')](_0x1488b4,_0x43c357)['then'](function(_0x15d8df){logger['info'](_0x4f60('0x24'),_0x171c10,_0x4f60('0x25'));logger[_0x4f60('0x26')](_0x4f60('0x27'),_0x171c10,'request\x20sent',JSON[_0x4f60('0x28')](_0x15d8df));if(_0x15d8df[_0x4f60('0x29')]){if(_0x15d8df[_0x4f60('0x29')]['code']===0x1f4){logger['error'](_0x4f60('0x24'),_0x171c10,_0x15d8df[_0x4f60('0x29')][_0x4f60('0x2a')]);return _0x4e432d(_0x15d8df[_0x4f60('0x29')][_0x4f60('0x2a')]);}logger[_0x4f60('0x29')]('FaxAccount,\x20%s,\x20%s',_0x171c10,_0x15d8df[_0x4f60('0x29')][_0x4f60('0x2a')]);return _0x282918(_0x15d8df[_0x4f60('0x29')]['message']);}else{logger[_0x4f60('0x2b')](_0x4f60('0x24'),_0x171c10,'request\x20sent');_0x282918(_0x15d8df['result'][_0x4f60('0x2a')]);}})[_0x4f60('0x2c')](function(_0x2eea09){logger[_0x4f60('0x29')](_0x4f60('0x24'),_0x171c10,_0x2eea09);_0x4e432d(_0x2eea09);});});}function respondWithStatusCode(_0x15e028,_0xbd03d1){_0xbd03d1=_0xbd03d1||0xcc;return function(_0x3128c7){if(_0x3128c7){return _0x15e028[_0x4f60('0x2d')](_0xbd03d1);}return _0x15e028[_0x4f60('0x2e')](_0xbd03d1)[_0x4f60('0x2f')]();};}function respondWithResult(_0x8c25f3,_0x45606a){_0x45606a=_0x45606a||0xc8;return function(_0x3d287c){if(_0x3d287c){return _0x8c25f3[_0x4f60('0x2e')](_0x45606a)[_0x4f60('0x30')](_0x3d287c);}};}function respondWithFilteredResult(_0x1efe22,_0x2f1274){return function(_0x365ebf){if(_0x365ebf){var _0x2dd4f1=_0x365ebf[_0x4f60('0x31')],_0x5783d2=_0x2f1274['offset'],_0x487f0f=_0x2f1274[_0x4f60('0x32')]+_0x2f1274[_0x4f60('0x33')],_0x4ca8e2;if(_0x487f0f>=_0x2dd4f1){_0x487f0f=_0x2dd4f1;_0x4ca8e2=0xc8;}else{_0x4ca8e2=0xce;}_0x1efe22[_0x4f60('0x2e')](_0x4ca8e2);return _0x1efe22[_0x4f60('0x34')](_0x4f60('0x35'),_0x5783d2+'-'+_0x487f0f+'/'+_0x2dd4f1)[_0x4f60('0x30')](_0x365ebf);}return null;};}function patchUpdates(_0x2b366e){return function(_0x463a26){try{jsonpatch[_0x4f60('0x36')](_0x463a26,_0x2b366e,!![]);}catch(_0x187a24){return BPromise[_0x4f60('0x37')](_0x187a24);}return _0x463a26['save']();};}function saveUpdates(_0x563607,_0x3867b5){return function(_0x551b92){if(_0x551b92){return _0x551b92[_0x4f60('0x38')](_0x563607)[_0x4f60('0x39')](function(_0x1ffb4c){return _0x1ffb4c;});}return null;};}function removeEntity(_0x6b62fa,_0x353b74){return function(_0x558c32){if(_0x558c32){return _0x558c32[_0x4f60('0x3a')]()[_0x4f60('0x39')](function(){var _0x59e5fc=_0x558c32[_0x4f60('0x3b')]({'plain':!![]});var _0x341d9c=_0x4f60('0x3c');return db['UserProfileResource'][_0x4f60('0x3a')]({'where':{'type':_0x341d9c,'resourceId':_0x59e5fc['id']}})[_0x4f60('0x39')](function(){return _0x558c32;});})['then'](function(){_0x6b62fa[_0x4f60('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f9a64,_0x2f63dc){return function(_0x1e55a2){if(!_0x1e55a2){_0x4f9a64[_0x4f60('0x2d')](0x194);}return _0x1e55a2;};}function handleError(_0x393aaf,_0x5cc27e){_0x5cc27e=_0x5cc27e||0x1f4;return function(_0x23ad10){logger[_0x4f60('0x29')](_0x23ad10[_0x4f60('0x3d')]);if(_0x23ad10['name']){delete _0x23ad10['name'];}_0x393aaf[_0x4f60('0x2e')](_0x5cc27e)[_0x4f60('0x3e')](_0x23ad10);};}exports[_0x4f60('0x3f')]=function(_0x1d2e6c,_0x68d00d){var _0x15b04a={'include':[{'model':db[_0x4f60('0x40')],'as':'mandatoryDispositionPause'}]},_0x159ab7={},_0x286fee={'count':0x0,'rows':[]};var _0x33cf15=_[_0x4f60('0x41')](db['FaxAccount']['rawAttributes'],function(_0x81febb){return{'name':_0x81febb[_0x4f60('0x42')],'type':_0x81febb[_0x4f60('0x43')]['key']};});_0x159ab7['model']=_[_0x4f60('0x41')](_0x33cf15,_0x4f60('0x44'));_0x159ab7[_0x4f60('0x45')]=_[_0x4f60('0x46')](_0x1d2e6c['query']);_0x159ab7[_0x4f60('0x47')]=_[_0x4f60('0x48')](_0x159ab7[_0x4f60('0x49')],_0x159ab7['query']);_0x15b04a[_0x4f60('0x4a')]=_[_0x4f60('0x48')](_0x159ab7[_0x4f60('0x49')],qs[_0x4f60('0x4b')](_0x1d2e6c[_0x4f60('0x45')][_0x4f60('0x4b')]));_0x15b04a['attributes']=_0x15b04a[_0x4f60('0x4a')][_0x4f60('0x4c')]?_0x15b04a[_0x4f60('0x4a')]:_0x159ab7['model'];if(!_0x1d2e6c['query'][_0x4f60('0x4d')](_0x4f60('0x4e'))){_0x15b04a[_0x4f60('0x33')]=qs[_0x4f60('0x33')](_0x1d2e6c[_0x4f60('0x45')][_0x4f60('0x33')]);_0x15b04a['offset']=qs[_0x4f60('0x32')](_0x1d2e6c[_0x4f60('0x45')][_0x4f60('0x32')]);}_0x15b04a[_0x4f60('0x4f')]=qs[_0x4f60('0x50')](_0x1d2e6c[_0x4f60('0x45')][_0x4f60('0x50')]);_0x15b04a[_0x4f60('0x51')]=qs[_0x4f60('0x47')](_[_0x4f60('0x52')](_0x1d2e6c['query'],_0x159ab7[_0x4f60('0x47')]));if(_0x1d2e6c['query']['filter']){_0x15b04a[_0x4f60('0x51')]=_['merge'](_0x15b04a[_0x4f60('0x51')],{'$or':_[_0x4f60('0x41')](_0x33cf15,function(_0x1be0a0){if(_0x1be0a0[_0x4f60('0x43')]!==_0x4f60('0x53')){var _0x185fe2={};_0x185fe2[_0x1be0a0[_0x4f60('0x44')]]={'$like':'%'+_0x1d2e6c['query']['filter']+'%'};return _0x185fe2;}})});}_0x15b04a=_[_0x4f60('0x54')]({},_0x15b04a,_0x1d2e6c[_0x4f60('0x55')]);var _0xd61717={'where':_0x15b04a[_0x4f60('0x51')]};return db['FaxAccount'][_0x4f60('0x31')](_0xd61717)[_0x4f60('0x39')](function(_0x1799bd){_0x286fee[_0x4f60('0x31')]=_0x1799bd;if(_0x1d2e6c[_0x4f60('0x45')]['includeAll']){_0x15b04a[_0x4f60('0x56')]=[{'all':!![]}];}return db[_0x4f60('0x57')][_0x4f60('0x58')](_0x15b04a);})[_0x4f60('0x39')](function(_0x2ac2f2){_0x286fee['rows']=_0x2ac2f2;return _0x286fee;})['then'](respondWithFilteredResult(_0x68d00d,_0x15b04a))[_0x4f60('0x2c')](handleError(_0x68d00d,null));};exports[_0x4f60('0x59')]=function(_0x216f64,_0x51831f){var _0xdcf490={'raw':![],'where':{'id':_0x216f64[_0x4f60('0x5a')]['id']},'include':[{'model':db[_0x4f60('0x40')],'as':'mandatoryDispositionPause'}]},_0x350721={};_0x350721[_0x4f60('0x49')]=_[_0x4f60('0x46')](db[_0x4f60('0x57')][_0x4f60('0x5b')]);_0x350721[_0x4f60('0x45')]=_[_0x4f60('0x46')](_0x216f64[_0x4f60('0x45')]);_0x350721[_0x4f60('0x47')]=_[_0x4f60('0x48')](_0x350721[_0x4f60('0x49')],_0x350721[_0x4f60('0x45')]);_0xdcf490[_0x4f60('0x4a')]=_[_0x4f60('0x48')](_0x350721[_0x4f60('0x49')],qs['fields'](_0x216f64[_0x4f60('0x45')][_0x4f60('0x4b')]));_0xdcf490['attributes']=_0xdcf490[_0x4f60('0x4a')]['length']?_0xdcf490[_0x4f60('0x4a')]:_0x350721[_0x4f60('0x49')];if(_0x216f64['query'][_0x4f60('0x5c')]){_0xdcf490[_0x4f60('0x56')]=[{'all':!![]}];}_0xdcf490=_[_0x4f60('0x54')]({},_0xdcf490,_0x216f64[_0x4f60('0x55')]);return db['FaxAccount'][_0x4f60('0x5d')](_0xdcf490)[_0x4f60('0x39')](handleEntityNotFound(_0x51831f,null))[_0x4f60('0x39')](respondWithResult(_0x51831f,null))[_0x4f60('0x2c')](handleError(_0x51831f,null));};exports[_0x4f60('0x5e')]=function(_0x3d7c1c,_0x4a7203){return db[_0x4f60('0x57')][_0x4f60('0x5e')](_0x3d7c1c[_0x4f60('0x5f')],{})[_0x4f60('0x39')](function(_0x9374d2){var _0x4f5561=_0x3d7c1c[_0x4f60('0x60')][_0x4f60('0x3b')]({'plain':!![]});if(!_0x4f5561)throw new Error(_0x4f60('0x61'));if(_0x4f5561['role']===_0x4f60('0x60')){var _0x4d288a=_0x9374d2['get']({'plain':!![]});var _0xb1a35a=_0x4f60('0x3c');return db[_0x4f60('0x62')][_0x4f60('0x5d')]({'where':{'name':_0xb1a35a,'userProfileId':_0x4f5561[_0x4f60('0x63')]},'raw':!![]})['then'](function(_0x4a1fcf){if(_0x4a1fcf&&_0x4a1fcf[_0x4f60('0x64')]===0x0){return db['UserProfileResource'][_0x4f60('0x5e')]({'name':_0x4d288a[_0x4f60('0x44')],'resourceId':_0x4d288a['id'],'type':_0x4a1fcf[_0x4f60('0x44')],'sectionId':_0x4a1fcf['id']},{})['then'](function(){return _0x9374d2;});}else{return _0x9374d2;}})[_0x4f60('0x2c')](function(_0x5ec09c){logger[_0x4f60('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ec09c);throw _0x5ec09c;});}return _0x9374d2;})[_0x4f60('0x39')](respondWithResult(_0x4a7203,0xc9))[_0x4f60('0x2c')](handleError(_0x4a7203,null));};exports[_0x4f60('0x38')]=function(_0x3806b6,_0x1a5103){if(_0x3806b6[_0x4f60('0x5f')]['id']){delete _0x3806b6[_0x4f60('0x5f')]['id'];}return db[_0x4f60('0x57')][_0x4f60('0x5d')]({'where':{'id':_0x3806b6[_0x4f60('0x5a')]['id']},'include':[{'model':db[_0x4f60('0x40')],'as':_0x4f60('0x65')}]})[_0x4f60('0x39')](handleEntityNotFound(_0x1a5103,null))[_0x4f60('0x39')](saveUpdates(_0x3806b6['body'],null))[_0x4f60('0x39')](respondWithResult(_0x1a5103,null))['catch'](handleError(_0x1a5103,null));};exports['destroy']=function(_0x147a54,_0x58cd42){return db[_0x4f60('0x57')][_0x4f60('0x5d')]({'where':{'id':_0x147a54['params']['id']}})['then'](handleEntityNotFound(_0x58cd42,null))[_0x4f60('0x39')](removeEntity(_0x58cd42,null))['catch'](handleError(_0x58cd42,null));};exports[_0x4f60('0x66')]=function(_0x440a80,_0x52485d){return db[_0x4f60('0x57')][_0x4f60('0x66')]()[_0x4f60('0x39')](respondWithResult(_0x52485d,null))[_0x4f60('0x2c')](handleError(_0x52485d,null));};exports[_0x4f60('0x67')]=function(_0x1fe44b,_0x2138ee,_0x4c6a05){if(_0x1fe44b['body']['id']){delete _0x1fe44b['body']['id'];}return db[_0x4f60('0x57')][_0x4f60('0x5d')]({'where':{'id':_0x1fe44b[_0x4f60('0x5a')]['id']}})[_0x4f60('0x39')](handleEntityNotFound(_0x2138ee,null))[_0x4f60('0x39')](function(_0x3c192b){if(_0x3c192b){_0x1fe44b[_0x4f60('0x5f')]['FaxAccountId']=_0x3c192b['id'];return db[_0x4f60('0x68')]['create'](_0x1fe44b['body']);}})['then'](respondWithResult(_0x2138ee,null))[_0x4f60('0x2c')](handleError(_0x2138ee,null));};exports[_0x4f60('0x69')]=function(_0x4df5ab,_0x2f658c,_0x2a6294){var _0x36281f={'raw':![],'where':{}};var _0x3efdf1={};var _0x3fa309={'count':0x0,'rows':[]};return db[_0x4f60('0x57')][_0x4f60('0x6a')]({'where':{'id':_0x4df5ab[_0x4f60('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2f658c,null))[_0x4f60('0x39')](function(_0x303eaa){if(_0x303eaa){_0x3efdf1[_0x4f60('0x49')]=_[_0x4f60('0x46')](db[_0x4f60('0x68')][_0x4f60('0x5b')]);_0x3efdf1[_0x4f60('0x45')]=_[_0x4f60('0x46')](_0x4df5ab['query']);_0x3efdf1[_0x4f60('0x47')]=_[_0x4f60('0x48')](_0x3efdf1['model'],_0x3efdf1['query']);_0x36281f[_0x4f60('0x4a')]=_[_0x4f60('0x48')](_0x3efdf1[_0x4f60('0x49')],qs[_0x4f60('0x4b')](_0x4df5ab['query'][_0x4f60('0x4b')]));_0x36281f[_0x4f60('0x4a')]=_0x36281f[_0x4f60('0x4a')][_0x4f60('0x4c')]?_0x36281f[_0x4f60('0x4a')]:_0x3efdf1[_0x4f60('0x49')];if(!_0x4df5ab['query'][_0x4f60('0x4d')](_0x4f60('0x4e'))){_0x36281f['limit']=qs[_0x4f60('0x33')](_0x4df5ab[_0x4f60('0x45')][_0x4f60('0x33')]);_0x36281f['offset']=qs[_0x4f60('0x32')](_0x4df5ab[_0x4f60('0x45')]['offset']);}_0x36281f[_0x4f60('0x4f')]=qs['sort'](_0x4df5ab[_0x4f60('0x45')][_0x4f60('0x50')]);_0x36281f[_0x4f60('0x51')]=qs['filters'](_[_0x4f60('0x52')](_0x4df5ab['query'],_0x3efdf1[_0x4f60('0x47')]));_0x36281f[_0x4f60('0x51')]['FaxAccountId']=_0x303eaa['id'];if(_0x4df5ab[_0x4f60('0x45')][_0x4f60('0x6b')]){_0x36281f[_0x4f60('0x51')]=_[_0x4f60('0x54')](_0x36281f[_0x4f60('0x51')],{'$or':_[_0x4f60('0x41')](_0x36281f[_0x4f60('0x4a')],function(_0x321b47){var _0x362465={};_0x362465[_0x321b47]={'$like':'%'+_0x4df5ab['query'][_0x4f60('0x6b')]+'%'};return _0x362465;})});}_0x36281f=_['merge']({},_0x36281f,_0x4df5ab[_0x4f60('0x55')]);return db['Disposition']['count']({'where':_0x36281f[_0x4f60('0x51')]})['then'](function(_0x2f6f5b){_0x3fa309[_0x4f60('0x31')]=_0x2f6f5b;if(_0x4df5ab[_0x4f60('0x45')]['includeAll']){_0x36281f[_0x4f60('0x56')]=[{'all':!![]}];}return db[_0x4f60('0x68')][_0x4f60('0x58')](_0x36281f);})[_0x4f60('0x39')](function(_0x123d01){_0x3fa309[_0x4f60('0x6c')]=_0x123d01;return _0x3fa309;});}})[_0x4f60('0x39')](respondWithFilteredResult(_0x2f658c,_0x36281f))[_0x4f60('0x2c')](handleError(_0x2f658c,null));};exports['removeDispositions']=function(_0x4ee892,_0x590379,_0x37d497){return db['FaxAccount'][_0x4f60('0x5d')]({'where':{'id':_0x4ee892[_0x4f60('0x5a')]['id']}})['then'](handleEntityNotFound(_0x590379,null))['then'](function(_0x386fff){if(_0x386fff){return _0x386fff['removeDispositions'](_0x4ee892[_0x4f60('0x45')][_0x4f60('0x6d')]);}})['then'](respondWithStatusCode(_0x590379,null))['catch'](handleError(_0x590379,null));};exports[_0x4f60('0x6e')]=function(_0x783588,_0x301a76,_0x7b54b8){if(_0x783588[_0x4f60('0x5f')]['id']){delete _0x783588[_0x4f60('0x5f')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x783588[_0x4f60('0x5a')]['id']}})['then'](handleEntityNotFound(_0x301a76,null))[_0x4f60('0x39')](function(_0x1e061a){if(_0x1e061a){_0x783588['body']['FaxAccountId']=_0x1e061a['id'];return db[_0x4f60('0x6f')][_0x4f60('0x5e')](_0x783588[_0x4f60('0x5f')]);}})['then'](respondWithResult(_0x301a76,null))[_0x4f60('0x2c')](handleError(_0x301a76,null));};exports[_0x4f60('0x70')]=function(_0x3807fe,_0x482c8c,_0x152820){var _0x2b6d20={'raw':![],'where':{}};var _0x25f839={};var _0x420005={'count':0x0,'rows':[]};return db[_0x4f60('0x57')][_0x4f60('0x6a')]({'where':{'id':_0x3807fe[_0x4f60('0x5a')]['id']}})['then'](handleEntityNotFound(_0x482c8c,null))[_0x4f60('0x39')](function(_0xadc399){if(_0xadc399){_0x25f839[_0x4f60('0x49')]=_[_0x4f60('0x46')](db[_0x4f60('0x6f')]['rawAttributes']);_0x25f839[_0x4f60('0x45')]=_[_0x4f60('0x46')](_0x3807fe[_0x4f60('0x45')]);_0x25f839[_0x4f60('0x47')]=_['intersection'](_0x25f839[_0x4f60('0x49')],_0x25f839['query']);_0x2b6d20['attributes']=_['intersection'](_0x25f839['model'],qs[_0x4f60('0x4b')](_0x3807fe[_0x4f60('0x45')][_0x4f60('0x4b')]));_0x2b6d20['attributes']=_0x2b6d20[_0x4f60('0x4a')][_0x4f60('0x4c')]?_0x2b6d20['attributes']:_0x25f839[_0x4f60('0x49')];if(!_0x3807fe[_0x4f60('0x45')]['hasOwnProperty']('nolimit')){_0x2b6d20[_0x4f60('0x33')]=qs[_0x4f60('0x33')](_0x3807fe[_0x4f60('0x45')][_0x4f60('0x33')]);_0x2b6d20[_0x4f60('0x32')]=qs[_0x4f60('0x32')](_0x3807fe[_0x4f60('0x45')][_0x4f60('0x32')]);}_0x2b6d20[_0x4f60('0x4f')]=qs[_0x4f60('0x50')](_0x3807fe[_0x4f60('0x45')][_0x4f60('0x50')]);_0x2b6d20[_0x4f60('0x51')]=qs['filters'](_['pick'](_0x3807fe['query'],_0x25f839['filters']));_0x2b6d20['where'][_0x4f60('0x71')]=_0xadc399['id'];if(_0x3807fe[_0x4f60('0x45')][_0x4f60('0x6b')]){_0x2b6d20[_0x4f60('0x51')]=_[_0x4f60('0x54')](_0x2b6d20[_0x4f60('0x51')],{'$or':_[_0x4f60('0x41')](_0x2b6d20['attributes'],function(_0xf70007){var _0x3a82cd={};_0x3a82cd[_0xf70007]={'$like':'%'+_0x3807fe[_0x4f60('0x45')][_0x4f60('0x6b')]+'%'};return _0x3a82cd;})});}_0x2b6d20=_[_0x4f60('0x54')]({},_0x2b6d20,_0x3807fe[_0x4f60('0x55')]);return db[_0x4f60('0x6f')][_0x4f60('0x31')]({'where':_0x2b6d20['where']})[_0x4f60('0x39')](function(_0x417e44){_0x420005[_0x4f60('0x31')]=_0x417e44;if(_0x3807fe[_0x4f60('0x45')][_0x4f60('0x5c')]){_0x2b6d20[_0x4f60('0x56')]=[{'all':!![]}];}return db[_0x4f60('0x6f')][_0x4f60('0x58')](_0x2b6d20);})[_0x4f60('0x39')](function(_0x36bde4){_0x420005[_0x4f60('0x6c')]=_0x36bde4;return _0x420005;});}})[_0x4f60('0x39')](respondWithFilteredResult(_0x482c8c,_0x2b6d20))[_0x4f60('0x2c')](handleError(_0x482c8c,null));};exports['removeAnswers']=function(_0x19b7c6,_0x44faa4,_0x2dd0c1){return db[_0x4f60('0x57')][_0x4f60('0x5d')]({'where':{'id':_0x19b7c6[_0x4f60('0x5a')]['id']}})[_0x4f60('0x39')](handleEntityNotFound(_0x44faa4,null))[_0x4f60('0x39')](function(_0x3a4263){if(_0x3a4263){return _0x3a4263[_0x4f60('0x72')](_0x19b7c6[_0x4f60('0x45')][_0x4f60('0x6d')]);}})[_0x4f60('0x39')](respondWithStatusCode(_0x44faa4,null))['catch'](handleError(_0x44faa4,null));};exports[_0x4f60('0x73')]=function(_0x5b05d0,_0x2b34e8,_0x2e70fc){return db[_0x4f60('0x74')][_0x4f60('0x5d')]({'where':{'id':_0x5b05d0['params']['id']}})['then'](handleEntityNotFound(_0x2b34e8,null))[_0x4f60('0x39')](function(_0x59c1b5){if(_0x59c1b5){return _0x59c1b5[_0x4f60('0x73')](_0x5b05d0['body'][_0x4f60('0x6d')],_[_0x4f60('0x75')](_0x5b05d0[_0x4f60('0x5f')],[_0x4f60('0x6d'),'id'])||{});}})['then'](respondWithResult(_0x2b34e8,null))[_0x4f60('0x2c')](handleError(_0x2b34e8,null));};exports[_0x4f60('0x76')]=function(_0xcdd679,_0xbacb6a,_0x36b8b1){var _0x1df849={'raw':![],'where':{}};var _0x3d8961={};var _0x32ce7d={'count':0x0,'rows':[]};return db['FaxAccount'][_0x4f60('0x6a')]({'where':{'id':_0xcdd679[_0x4f60('0x5a')]['id']}})[_0x4f60('0x39')](handleEntityNotFound(_0xbacb6a,null))['then'](function(_0x132fcb){if(_0x132fcb){_0x3d8961['model']=_[_0x4f60('0x46')](db[_0x4f60('0x74')][_0x4f60('0x5b')]);_0x3d8961[_0x4f60('0x45')]=_[_0x4f60('0x46')](_0xcdd679['query']);_0x3d8961[_0x4f60('0x47')]=_['intersection'](_0x3d8961[_0x4f60('0x49')],_0x3d8961[_0x4f60('0x45')]);_0x1df849[_0x4f60('0x4a')]=_[_0x4f60('0x48')](_0x3d8961[_0x4f60('0x49')],qs[_0x4f60('0x4b')](_0xcdd679[_0x4f60('0x45')][_0x4f60('0x4b')]));_0x1df849[_0x4f60('0x4a')]=_0x1df849[_0x4f60('0x4a')][_0x4f60('0x4c')]?_0x1df849['attributes']:_0x3d8961['model'];if(!_0xcdd679[_0x4f60('0x45')][_0x4f60('0x4d')](_0x4f60('0x4e'))){_0x1df849[_0x4f60('0x33')]=qs['limit'](_0xcdd679[_0x4f60('0x45')][_0x4f60('0x33')]);_0x1df849[_0x4f60('0x32')]=qs[_0x4f60('0x32')](_0xcdd679[_0x4f60('0x45')][_0x4f60('0x32')]);}_0x1df849['order']=qs[_0x4f60('0x50')](_0xcdd679['query'][_0x4f60('0x50')]);_0x1df849[_0x4f60('0x51')]=qs['filters'](_['pick'](_0xcdd679[_0x4f60('0x45')],_0x3d8961[_0x4f60('0x47')]));_0x1df849[_0x4f60('0x51')]['FaxAccountId']=_0x132fcb['id'];if(_0xcdd679[_0x4f60('0x45')][_0x4f60('0x6b')]){_0x1df849[_0x4f60('0x51')]=_[_0x4f60('0x54')](_0x1df849[_0x4f60('0x51')],{'$or':_['map'](_0x1df849['attributes'],function(_0x1f320f){var _0x46bcc1={};_0x46bcc1[_0x1f320f]={'$like':'%'+_0xcdd679[_0x4f60('0x45')][_0x4f60('0x6b')]+'%'};return _0x46bcc1;})});}_0x1df849=_[_0x4f60('0x54')]({},_0x1df849,_0xcdd679[_0x4f60('0x55')]);return db[_0x4f60('0x74')][_0x4f60('0x31')]({'where':_0x1df849[_0x4f60('0x51')]})[_0x4f60('0x39')](function(_0xb62db9){_0x32ce7d[_0x4f60('0x31')]=_0xb62db9;if(_0xcdd679['query']['includeAll']){_0x1df849['include']=[{'model':db['CmContact'],'as':_0x4f60('0x77'),'required':![]},{'model':db[_0x4f60('0x78')],'as':_0x4f60('0x79'),'attributes':[_0x4f60('0x44'),'fullname','internal'],'required':![]},{'model':db[_0x4f60('0x7a')],'as':_0x4f60('0x7b'),'attributes':['id',_0x4f60('0x44'),'color'],'where':_0xcdd679[_0x4f60('0x45')][_0x4f60('0x7c')]?{'id':_0xcdd679[_0x4f60('0x45')]['tag']}:undefined,'required':_0xcdd679['query'][_0x4f60('0x7c')]?!![]:![]}];}return db[_0x4f60('0x74')][_0x4f60('0x58')](_0x1df849);})['then'](function(_0x1ceacb){_0x32ce7d[_0x4f60('0x6c')]=_0x1ceacb;return _0x32ce7d;});}})[_0x4f60('0x39')](respondWithFilteredResult(_0xbacb6a,_0x1df849))[_0x4f60('0x2c')](handleError(_0xbacb6a,null));};exports[_0x4f60('0x7d')]=function(_0x5b5bf9,_0x1e1101,_0x3521f6){return db['FaxAccount'][_0x4f60('0x6a')]({'where':{'id':_0x5b5bf9['params']['id']}})[_0x4f60('0x39')](handleEntityNotFound(_0x1e1101,null))[_0x4f60('0x39')](function(_0x41d011){if(_0x41d011){return db[_0x4f60('0x7e')]['transaction'](function(_0x3b6854){return db[_0x4f60('0x7f')][_0x4f60('0x3a')]({'where':{'FaxAccountId':_0x5b5bf9[_0x4f60('0x5a')]['id']},'transaction':_0x3b6854})[_0x4f60('0x39')](function(_0x212673){var _0x3dd453=_[_0x4f60('0x41')](_0x5b5bf9['body'],function(_0x10a7cf){_0x10a7cf[_0x4f60('0x71')]=_0x5b5bf9['params']['id'];return _0x10a7cf;});return db['FaxApplication']['bulkCreate'](_0x3dd453,{'transaction':_0x3b6854});});})[_0x4f60('0x39')](function(){return db[_0x4f60('0x7f')][_0x4f60('0x80')]({'where':{'FaxAccountId':_0x5b5bf9[_0x4f60('0x5a')]['id']},'order':_0x4f60('0x81')});});}})[_0x4f60('0x39')](respondWithResult(_0x1e1101,null))[_0x4f60('0x2c')](handleError(_0x1e1101,null));};exports[_0x4f60('0x82')]=function(_0x14dcf0,_0x590027,_0x1ce1c8){var _0x11eaec={};var _0x5d9919={};var _0x5f4779;var _0xb694f7;return db[_0x4f60('0x57')]['findOne']({'where':{'id':_0x14dcf0[_0x4f60('0x5a')]['id']}})[_0x4f60('0x39')](handleEntityNotFound(_0x590027,null))['then'](function(_0x289bc6){if(_0x289bc6){_0x5f4779=_0x289bc6;_0x5d9919['model']=_[_0x4f60('0x46')](db['FaxApplication']['rawAttributes']);_0x5d9919['query']=_[_0x4f60('0x46')](_0x14dcf0['query']);_0x5d9919[_0x4f60('0x47')]=_[_0x4f60('0x48')](_0x5d9919[_0x4f60('0x49')],_0x5d9919[_0x4f60('0x45')]);_0x11eaec[_0x4f60('0x4a')]=_[_0x4f60('0x48')](_0x5d9919['model'],qs[_0x4f60('0x4b')](_0x14dcf0['query'][_0x4f60('0x4b')]));_0x11eaec['attributes']=_0x11eaec['attributes'][_0x4f60('0x4c')]?_0x11eaec[_0x4f60('0x4a')]:_0x5d9919['model'];_0x11eaec[_0x4f60('0x4f')]=qs[_0x4f60('0x50')](_0x14dcf0[_0x4f60('0x45')]['sort']);_0x11eaec[_0x4f60('0x51')]=qs[_0x4f60('0x47')](_['pick'](_0x14dcf0['query'],_0x5d9919[_0x4f60('0x47')]));if(_0x14dcf0[_0x4f60('0x45')]['filter']){_0x11eaec[_0x4f60('0x51')]=_[_0x4f60('0x54')](_0x11eaec[_0x4f60('0x51')],{'$or':_['map'](_0x11eaec[_0x4f60('0x4a')],function(_0x5910e7){var _0x466e27={};_0x466e27[_0x5910e7]={'$like':'%'+_0x14dcf0[_0x4f60('0x45')][_0x4f60('0x6b')]+'%'};return _0x466e27;})});}_0x11eaec=_[_0x4f60('0x54')]({},_0x11eaec,_0x14dcf0['options']);return _0x5f4779['getApplications'](_0x11eaec);}})[_0x4f60('0x39')](function(_0x52809c){if(_0x52809c){_0xb694f7=_0x52809c['length'];if(!_0x14dcf0['query'][_0x4f60('0x4d')](_0x4f60('0x4e'))){_0x11eaec[_0x4f60('0x33')]=qs['limit'](_0x14dcf0['query'][_0x4f60('0x33')]);_0x11eaec['offset']=qs['offset'](_0x14dcf0[_0x4f60('0x45')]['offset']);}return _0x5f4779[_0x4f60('0x82')](_0x11eaec);}})[_0x4f60('0x39')](function(_0xcd2016){if(_0xcd2016){return _0xcd2016?{'count':_0xb694f7,'rows':_0xcd2016}:null;}})[_0x4f60('0x39')](respondWithResult(_0x590027,null))[_0x4f60('0x2c')](handleError(_0x590027,null));};function Extension(_0x2472e7,_0x20fc90,_0x179c5c,_0x523ab9){this[_0x4f60('0x83')]=_0x4f60('0x84');this[_0x4f60('0x85')]=_0x2472e7[_0x4f60('0x86')];this['app']=_0x523ab9;this[_0x4f60('0x43')]=_0x4f60('0x87');this[_0x4f60('0x88')]=_0x4f60('0x89');this[_0x4f60('0x71')]=_0x2472e7['id'];this[_0x4f60('0x81')]=_0x20fc90;this[_0x4f60('0x8a')]=_0x179c5c;}function createExtensionsReciveFax(_0x39b8c9){var _0x1324e6=0x1;var _0x1f032b=[];_0x1f032b[_0x4f60('0x8b')](new Extension(_0x39b8c9,_0x1324e6,'',_0x4f60('0x8c')));_0x1324e6+=0x1;_0x1f032b[_0x4f60('0x8b')](new Extension(_0x39b8c9,_0x1324e6,_0x4f60('0x8d'),_0x4f60('0x8e')));_0x1324e6+=0x1;for(var _0x1234d5 in _0x39b8c9){if(_0x39b8c9[_0x4f60('0x4d')](_0x1234d5)&&(_0x1234d5===_0x4f60('0x8f')||_0x1234d5===_0x4f60('0x86')||_0x1234d5===_0x4f60('0x90')||_0x1234d5==='faxdetect'||_0x1234d5===_0x4f60('0x91')||_0x1234d5===_0x4f60('0x92')||_0x1234d5===_0x4f60('0x93')||_0x1234d5===_0x4f60('0x94')||_0x1234d5===_0x4f60('0x95'))){_0x1f032b['push'](new Extension(_0x39b8c9,_0x1324e6,_0x4f60('0x96')+_0x1234d5+')='+_0x39b8c9[_0x1234d5],_0x4f60('0x8e')));_0x1324e6+=0x1;}}_0x1f032b[_0x4f60('0x8b')](new Extension(_0x39b8c9,_0x1324e6,'6',_0x4f60('0x97')));_0x1324e6+=0x1;_0x1f032b['push'](new Extension(_0x39b8c9,_0x1324e6,_0x4f60('0x98'),_0x4f60('0x99')));_0x1324e6=0x0;return _0x1f032b;}exports[_0x4f60('0x9a')]=function(_0x3dfa79,_0x26b5bd,_0x565aef){var _0x357a21;return db[_0x4f60('0x7e')][_0x4f60('0x9b')](function(_0x4be91c){return db[_0x4f60('0x57')][_0x4f60('0x5e')](_0x3dfa79['body'],{'transaction':_0x4be91c})[_0x4f60('0x39')](function(_0x1a22ea){_0x357a21=_0x1a22ea[_0x4f60('0x3b')]({'plain':!![]});return db[_0x4f60('0x9c')][_0x4f60('0x9d')](createExtensionsReciveFax(_0x357a21),{'transaction':_0x4be91c});});})['then'](function(){return _0x357a21;})[_0x4f60('0x39')](respondWithResult(_0x26b5bd,null))['catch'](handleError(_0x26b5bd,null));};exports[_0x4f60('0x9e')]=function(_0x504e47,_0x388ccc,_0x500745){var _0x521042;return db[_0x4f60('0x7e')][_0x4f60('0x9b')](function(_0x541364){return db[_0x4f60('0x57')][_0x4f60('0x38')](_0x504e47[_0x4f60('0x5f')],{'where':{'id':_0x504e47[_0x4f60('0x5f')]['id']},'transaction':_0x541364})[_0x4f60('0x39')](function(_0x211cad){return db[_0x4f60('0x9c')][_0x4f60('0x3a')]({'where':{'FaxAccountId':_0x504e47[_0x4f60('0x5f')]['id']},'transaction':_0x541364})[_0x4f60('0x39')](function(_0x3dd508){return db[_0x4f60('0x9c')][_0x4f60('0x9d')](createExtensionsReciveFax(_[_0x4f60('0x75')](_0x504e47['body'],[_0x4f60('0x9f'),_0x4f60('0xa0'),'createdAt',_0x4f60('0xa1'),_0x4f60('0xa2'),_0x4f60('0xa3')])),{'transaction':_0x541364});});});})[_0x4f60('0x39')](function(){return db[_0x4f60('0x57')][_0x4f60('0xa4')](_0x504e47[_0x4f60('0x5f')]['id']);})['then'](respondWithResult(_0x388ccc,null))['catch'](handleError(_0x388ccc,null));};exports[_0x4f60('0xa5')]=function(_0x5b96c6,_0x1e476c,_0x221520){var _0xca3b60={'raw':!![],'where':{}};var _0x28513d={};var _0x4e3985={'count':0x0,'rows':[]};return db[_0x4f60('0x57')][_0x4f60('0x6a')]({'where':{'id':_0x5b96c6[_0x4f60('0x5a')]['id']}})[_0x4f60('0x39')](handleEntityNotFound(_0x1e476c,null))[_0x4f60('0x39')](function(_0x3672fb){if(_0x3672fb){_0x28513d[_0x4f60('0x49')]=_[_0x4f60('0x46')](db[_0x4f60('0xa6')]['rawAttributes']);_0x28513d[_0x4f60('0x45')]=_['keys'](_0x5b96c6[_0x4f60('0x45')]);_0x28513d['filters']=_['intersection'](_0x28513d[_0x4f60('0x49')],_0x28513d[_0x4f60('0x45')]);_0xca3b60[_0x4f60('0x4a')]=_['intersection'](_0x28513d[_0x4f60('0x49')],qs[_0x4f60('0x4b')](_0x5b96c6[_0x4f60('0x45')][_0x4f60('0x4b')]));_0xca3b60[_0x4f60('0x4a')]=_0xca3b60[_0x4f60('0x4a')][_0x4f60('0x4c')]?_0xca3b60[_0x4f60('0x4a')]:_0x28513d['model'];if(!_0x5b96c6[_0x4f60('0x45')][_0x4f60('0x4d')](_0x4f60('0x4e'))){_0xca3b60[_0x4f60('0x33')]=qs[_0x4f60('0x33')](_0x5b96c6['query'][_0x4f60('0x33')]);_0xca3b60[_0x4f60('0x32')]=qs[_0x4f60('0x32')](_0x5b96c6[_0x4f60('0x45')][_0x4f60('0x32')]);}_0xca3b60[_0x4f60('0x4f')]=qs[_0x4f60('0x50')](_0x5b96c6[_0x4f60('0x45')][_0x4f60('0x50')]);_0xca3b60[_0x4f60('0x51')]=qs[_0x4f60('0x47')](_['pick'](_0x5b96c6['query'],_0x28513d[_0x4f60('0x47')]));_0xca3b60[_0x4f60('0x51')]['FaxAccountId']=_0x3672fb['id'];if(_0x5b96c6['query'][_0x4f60('0x6b')]){_0xca3b60[_0x4f60('0x51')]=_[_0x4f60('0x54')](_0xca3b60['where'],{'$or':_[_0x4f60('0x41')](_0xca3b60[_0x4f60('0x4a')],function(_0x2bbf2f){var _0x2c1a90={};_0x2c1a90[_0x2bbf2f]={'$like':'%'+_0x5b96c6[_0x4f60('0x45')][_0x4f60('0x6b')]+'%'};return _0x2c1a90;})});}if(_0x5b96c6['query'][_0x4f60('0xa7')]){var _0x145a4f=_0x5b96c6[_0x4f60('0x45')][_0x4f60('0xa7')][_0x4f60('0xa8')](',');var _0x1b312b={};_0x1b312b[_0x145a4f[0x0]]={'$gte':moment(_0x145a4f[0x1])[_0x4f60('0xa9')](_0x4f60('0xaa'))};_0xca3b60[_0x4f60('0x51')]=_[_0x4f60('0x54')](_0xca3b60['where'],_0x1b312b);}_0xca3b60=_[_0x4f60('0x54')]({},_0xca3b60,_0x5b96c6[_0x4f60('0x55')]);return db[_0x4f60('0xa6')][_0x4f60('0x31')]({'where':_0xca3b60[_0x4f60('0x51')]})[_0x4f60('0x39')](function(_0x563b4d){_0x4e3985[_0x4f60('0x31')]=_0x563b4d;if(_0x5b96c6[_0x4f60('0x45')][_0x4f60('0x5c')]){_0xca3b60['include']=[{'all':!![]}];}return db[_0x4f60('0xa6')][_0x4f60('0x58')](_0xca3b60);})[_0x4f60('0x39')](function(_0x1835d9){_0x4e3985[_0x4f60('0x6c')]=_0x1835d9;return _0x4e3985;});}})[_0x4f60('0x39')](respondWithFilteredResult(_0x1e476c,_0xca3b60))[_0x4f60('0x2c')](handleError(_0x1e476c,null));};exports['send']=function(_0x3d7913,_0xba715d,_0x2966da){var _0xb5c5ec,_0x432e4b={},_0x46357e;if(_0x3d7913[_0x4f60('0x5f')]['to']){_0x46357e=_0x3d7913[_0x4f60('0x5f')]['to'][0x0];}return db[_0x4f60('0x57')][_0x4f60('0x5d')]({'where':{'id':_0x3d7913['params']['id']},'include':[{'model':db[_0x4f60('0xab')],'as':_0x4f60('0xac'),'include':[{'model':db[_0x4f60('0xad')],'as':'Contacts','where':{'fax':_0x46357e},'limit':0x1,'order':[[_0x4f60('0xa1'),_0x4f60('0xae')]]}]}]})['then'](handleEntityNotFound(_0xba715d,null))['then'](function(_0x428dd8){_0xb5c5ec=_0x428dd8;if(_0x3d7913[_0x4f60('0x5f')][_0x4f60('0xaf')]&&_0x3d7913['body'][_0x4f60('0xaf')][_0x4f60('0x4c')]){for(var _0x37485a=0x0;_0x37485a<_0x3d7913[_0x4f60('0x5f')][_0x4f60('0xaf')][_0x4f60('0x4c')];_0x37485a+=0x1){_0x3d7913[_0x4f60('0x5f')]['attachments'][_0x37485a]={'filename':_0x3d7913[_0x4f60('0x5f')][_0x4f60('0xaf')][_0x37485a][_0x4f60('0x44')],'id':_0x3d7913['body']['attachments'][_0x37485a]['id'],'path':path[_0x4f60('0xb0')](config[_0x4f60('0xb1')],_0x4f60('0xb2'),_0x3d7913['body'][_0x4f60('0xaf')][_0x37485a][_0x4f60('0xb3')])};}}return respondWithRpcPromise('CheckAfterSend',_0x4f60('0xb4'),{'FaxAccountId':_[_0x4f60('0xb5')](_0x3d7913['params']['id'])?undefined:_0x3d7913['params']['id'],'path':_[_0x4f60('0xb5')](_0x3d7913[_0x4f60('0x5f')][_0x4f60('0xaf')][0x0][_0x4f60('0x7')])?undefined:_0x3d7913['body'][_0x4f60('0xaf')][0x0][_0x4f60('0x7')],'fax':_['isNil'](_0x3d7913[_0x4f60('0x5f')]['to'][0x0])?undefined:_0x3d7913[_0x4f60('0x5f')]['to'][0x0]},client9002);})[_0x4f60('0x39')](function(){if(_0xb5c5ec){if(_[_0x4f60('0xb5')](_0x3d7913[_0x4f60('0x5f')][_0x4f60('0xb6')])){_0x3d7913[_0x4f60('0x5f')][_0x4f60('0xb6')]=util[_0x4f60('0xa9')](_0x4f60('0xb7'),_0xb5c5ec[_0x4f60('0x44')],_0xb5c5ec[_0x4f60('0xb8')]);}if(_0xb5c5ec[_0x4f60('0xac')]){if(_0xb5c5ec['List']['Contacts'][_0x4f60('0x4c')]){return _0xb5c5ec[_0x4f60('0xac')][_0x4f60('0xb9')][0x0];}else{return db['CmContact'][_0x4f60('0x5e')](_[_0x4f60('0x19')](_0x3d7913[_0x4f60('0x5f')],{'firstName':_0x3d7913['body']['to'][0x0],'phone':_0x3d7913[_0x4f60('0x5f')]['to'][0x0],'fax':_0x3d7913[_0x4f60('0x5f')]['to'][0x0],'ListId':_0xb5c5ec[_0x4f60('0xa3')]}));}}else{throw new Error(_0x4f60('0xba'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x4f60('0x39')](function(_0x4abda6){if(_0x4abda6){return db['FaxInteraction'][_0x4f60('0x5d')]({'where':{'ContactId':_0x4abda6['id'],'closed':![],'FaxAccountId':_0xb5c5ec['id']}})[_0x4f60('0x39')](function(_0x3009d2){if(_0x3009d2){return[_0x3009d2,![]];}return db[_0x4f60('0x74')]['create']({'UserId':_0x3d7913[_0x4f60('0x60')]['id'],'ContactId':_0x4abda6['id'],'FaxAccountId':_0xb5c5ec['id'],'fax':_0x3d7913[_0x4f60('0x5f')]['to'][0x0],'firstMsgDirection':_0x4f60('0xbb'),'Messages':[_[_0x4f60('0x54')](_0x3d7913[_0x4f60('0x5f')],{'read':![],'body':_0x3d7913[_0x4f60('0x5f')][_0x4f60('0xaf')][0x0]['filename'],'FaxAccountId':_0xb5c5ec['id'],'UserId':_0x3d7913['user']['id'],'ContactId':_0x4abda6['id'],'AttachmentId':_0x3d7913[_0x4f60('0x5f')][_0x4f60('0xaf')][0x0]['id']})]},{'include':[{'model':db[_0x4f60('0xa6')],'as':_0x4f60('0xbc')}]})[_0x4f60('0x39')](function(_0x6d8a36){return[_0x6d8a36,!![]];});});}else{throw new Error(_0x4f60('0xbd'));}})[_0x4f60('0xbe')](function(_0x1195d3,_0x49a43b){if(_0x49a43b){return _0x1195d3;}return db[_0x4f60('0xa6')]['create']({'direction':'out','read':![],'body':_0x3d7913[_0x4f60('0x5f')]['attachments'][0x0]['filename'],'FaxAccountId':_0xb5c5ec['id'],'FaxInteractionId':_0x1195d3['id'],'UserId':_0x3d7913[_0x4f60('0x60')]['id'],'ContactId':_0x1195d3[_0x4f60('0xbf')],'AttachmentId':_0x3d7913[_0x4f60('0x5f')]['attachments'][0x0]['id']})[_0x4f60('0x39')](function(_0x5cfdbe){_0x1195d3['dataValues'][_0x4f60('0xbc')]=[];_0x1195d3[_0x4f60('0xc0')][_0x4f60('0xbc')][_0x4f60('0x8b')](_0x5cfdbe[_0x4f60('0xc0')]);return _0x1195d3;});})[_0x4f60('0x39')](function(_0x1ab2b7){respondWithRpcPromise(_0x4f60('0xc1'),_0x4f60('0xc1'),{'FaxAccountId':_[_0x4f60('0xb5')](_0x3d7913[_0x4f60('0x5a')]['id'])?undefined:_0x3d7913[_0x4f60('0x5a')]['id'],'path':_[_0x4f60('0xb5')](_0x3d7913[_0x4f60('0x5f')][_0x4f60('0xaf')][0x0]['path'])?undefined:_0x3d7913['body']['attachments'][0x0][_0x4f60('0x7')],'fax':_[_0x4f60('0xb5')](_0x3d7913['body']['to'][0x0])?undefined:_0x3d7913[_0x4f60('0x5f')]['to'][0x0],'AttachmentId':_0x3d7913[_0x4f60('0x5f')][_0x4f60('0xaf')][0x0]['id']},client9002)[_0x4f60('0x39')](function(_0x1a93b5){logger['info'](_0x4f60('0xc2'),_0x1a93b5);})[_0x4f60('0x2c')](function(_0x2d19f5){logger['info'](_0x4f60('0xc2'),_0x2d19f5);});return _0x1ab2b7;})['then'](respondWithResult(_0xba715d,null))[_0x4f60('0x2c')](handleError(_0xba715d,null));};exports[_0x4f60('0xc3')]=function(_0x22d17e,_0x47d1fa,_0x4f102a){return db[_0x4f60('0x57')]['find']({'where':{'id':_0x22d17e[_0x4f60('0x5a')]['id']}})[_0x4f60('0x39')](handleEntityNotFound(_0x47d1fa,null))[_0x4f60('0x39')](function(_0x5637a0){if(_0x5637a0){return _0x5637a0[_0x4f60('0xc3')](_0x22d17e[_0x4f60('0x5f')]['ids'],_[_0x4f60('0x75')](_0x22d17e['body'],[_0x4f60('0x6d'),'id'])||{})[_0x4f60('0xbe')](function(_0x5ac46c){for(var _0x14e4bd=0x0;_0x14e4bd<_0x22d17e[_0x4f60('0x5f')]['ids'][_0x4f60('0x4c')];_0x14e4bd+=0x1){socket['emit']('userFaxAccount:save',{'UserId':_0x22d17e['body'][_0x4f60('0x6d')][_0x14e4bd],'FaxAccountId':_0x22d17e[_0x4f60('0x5a')]['id']});}return _0x5ac46c;});}})[_0x4f60('0x39')](respondWithResult(_0x47d1fa,null))[_0x4f60('0x2c')](handleError(_0x47d1fa,null));};exports[_0x4f60('0xc4')]=function(_0x5972a1,_0x2adcab,_0x51a012){return db[_0x4f60('0x57')][_0x4f60('0x5d')]({'where':{'id':_0x5972a1[_0x4f60('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2adcab,null))['then'](function(_0x38a09f){if(_0x38a09f){return _0x38a09f[_0x4f60('0xc4')](_0x5972a1[_0x4f60('0x45')][_0x4f60('0x6d')])['then'](function(){if(_[_0x4f60('0xc5')](_0x5972a1[_0x4f60('0x45')][_0x4f60('0x6d')])){for(var _0x29399f=0x0;_0x29399f<_0x5972a1['query']['ids'][_0x4f60('0x4c')];_0x29399f+=0x1){socket[_0x4f60('0xc6')](_0x4f60('0xc7'),{'UserId':Number(_0x5972a1[_0x4f60('0x45')][_0x4f60('0x6d')][_0x29399f]),'FaxAccountId':Number(_0x5972a1[_0x4f60('0x5a')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x5972a1[_0x4f60('0x45')]['ids']),'FaxAccountId':Number(_0x5972a1[_0x4f60('0x5a')]['id'])});}});}})[_0x4f60('0x39')](respondWithStatusCode(_0x2adcab,null))[_0x4f60('0x2c')](handleError(_0x2adcab,null));};exports['getAgents']=function(_0x21baec,_0x5f1474,_0x326fa7){var _0x3a94db={};var _0x57267b={};var _0x35f354;var _0x33efa3;return db[_0x4f60('0x57')][_0x4f60('0x6a')]({'where':{'id':_0x21baec[_0x4f60('0x5a')]['id']}})[_0x4f60('0x39')](handleEntityNotFound(_0x5f1474,null))[_0x4f60('0x39')](function(_0x1a7a29){if(_0x1a7a29){_0x35f354=_0x1a7a29;_0x57267b[_0x4f60('0x49')]=_[_0x4f60('0x46')](db['User']['rawAttributes']);_0x57267b[_0x4f60('0x45')]=_[_0x4f60('0x46')](_0x21baec['query']);_0x57267b[_0x4f60('0x47')]=_[_0x4f60('0x48')](_0x57267b[_0x4f60('0x49')],_0x57267b[_0x4f60('0x45')]);_0x3a94db[_0x4f60('0x4a')]=_[_0x4f60('0x48')](_0x57267b['model'],qs['fields'](_0x21baec[_0x4f60('0x45')][_0x4f60('0x4b')]));_0x3a94db[_0x4f60('0x4a')]=_0x3a94db[_0x4f60('0x4a')]['length']?_0x3a94db[_0x4f60('0x4a')]:_0x57267b[_0x4f60('0x49')];_0x3a94db['order']=qs['sort'](_0x21baec['query'][_0x4f60('0x50')]);_0x3a94db[_0x4f60('0x51')]=qs['filters'](_['pick'](_0x21baec[_0x4f60('0x45')],_0x57267b[_0x4f60('0x47')]));if(_0x21baec['query']['filter']){_0x3a94db[_0x4f60('0x51')]=_[_0x4f60('0x54')](_0x3a94db[_0x4f60('0x51')],{'$or':_['map'](_0x3a94db[_0x4f60('0x4a')],function(_0x5f29d5){var _0x2ae246={};_0x2ae246[_0x5f29d5]={'$like':'%'+_0x21baec[_0x4f60('0x45')]['filter']+'%'};return _0x2ae246;})});}_0x3a94db=_[_0x4f60('0x54')]({},_0x3a94db,_0x21baec[_0x4f60('0x55')]);return _0x35f354[_0x4f60('0xc8')](_0x3a94db);}})[_0x4f60('0x39')](function(_0x472b58){if(_0x472b58){_0x33efa3=_0x472b58[_0x4f60('0x4c')];if(!_0x21baec['query'][_0x4f60('0x4d')](_0x4f60('0x4e'))){_0x3a94db[_0x4f60('0x33')]=qs[_0x4f60('0x33')](_0x21baec[_0x4f60('0x45')]['limit']);_0x3a94db['offset']=qs['offset'](_0x21baec[_0x4f60('0x45')][_0x4f60('0x32')]);}return _0x35f354[_0x4f60('0xc8')](_0x3a94db);}})[_0x4f60('0x39')](function(_0x20188f){if(_0x20188f){return _0x20188f?{'count':_0x33efa3,'rows':_0x20188f}:null;}})[_0x4f60('0x39')](respondWithResult(_0x5f1474,null))[_0x4f60('0x2c')](handleError(_0x5f1474,null));}; \ No newline at end of file +var _0xacc1=['hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','FaxAccount','includeAll','include','rows','show','params','rawAttributes','options','find','create','body','user','role','UserProfileSection','userProfileId','describe','FaxAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','findAndCountAll','getApplications','context','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','push','CDR(type)=inbound-fax','ecm','gateway','headerinfo','minrate','modem','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','tech','createdAt','TrunkId','ListId','findById','getMessages','$gte','split','format','FaxMessage','CmList','List','updatedAt','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','Contacts','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','redis','defaults','./faxAccount.socket','register','http','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','json','count','offset','limit','apply','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','type','key','model','map','query','keys','intersection','fields','attributes','length'];(function(_0x3b328d,_0x57bb17){var _0xa50336=function(_0x8c6a1){while(--_0x8c6a1){_0x3b328d['push'](_0x3b328d['shift']());}};_0xa50336(++_0x57bb17);}(_0xacc1,0x1de));var _0x1acc=function(_0x40e32e,_0x322a2f){_0x40e32e=_0x40e32e-0x0;var _0x398a2d=_0xacc1[_0x40e32e];return _0x398a2d;};'use strict';var pdf=require(_0x1acc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1acc('0x1'));var zipdir=require(_0x1acc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1acc('0x3'));var moment=require('moment');var BPromise=require(_0x1acc('0x4'));var Mustache=require(_0x1acc('0x5'));var util=require(_0x1acc('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1acc('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1acc('0x8'));var squel=require('squel');var crypto=require(_0x1acc('0x9'));var jsforce=require(_0x1acc('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x1acc('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1acc('0xb'));var authService=require(_0x1acc('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x1acc('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1acc('0xe'));var utils=require(_0x1acc('0xf'));var config=require(_0x1acc('0x10'));var db=require('../../mysqldb')['db'];config[_0x1acc('0x11')]=_[_0x1acc('0x12')](config[_0x1acc('0x11')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1acc('0x11')]));require(_0x1acc('0x13'))[_0x1acc('0x14')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x1acc('0x15')]({'port':0x232c});var client9002=jayson[_0x1acc('0x16')][_0x1acc('0x15')]({'port':0x232a});function checkPasswordPattern(_0x2ff314,_0x15f79f,_0x705d0e){if(_0x705d0e){var _0x593da4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x593da4[_0x1acc('0x17')](_0x15f79f)){return _0x2ff314;}else{throw new db[(_0x1acc('0x18'))][(_0x1acc('0x19'))](_0x1acc('0x1a'));}}else{return _0x2ff314;}}function respondWithRpcPromise(_0x251aba,_0x796648,_0x2ce3ea,_0x33c74f){return new BPromise(function(_0x233a3b,_0x57f828){var _0x10a59e=_0x33c74f||client;return _0x10a59e[_0x1acc('0x1b')](_0x251aba,_0x2ce3ea)[_0x1acc('0x1c')](function(_0x2eee6f){logger[_0x1acc('0x1d')](_0x1acc('0x1e'),_0x796648,'request\x20sent');logger[_0x1acc('0x1f')](_0x1acc('0x20'),_0x796648,_0x1acc('0x21'),JSON['stringify'](_0x2eee6f));if(_0x2eee6f['error']){if(_0x2eee6f[_0x1acc('0x22')][_0x1acc('0x23')]===0x1f4){logger['error'](_0x1acc('0x1e'),_0x796648,_0x2eee6f[_0x1acc('0x22')]['message']);return _0x57f828(_0x2eee6f['error']['message']);}logger[_0x1acc('0x22')](_0x1acc('0x1e'),_0x796648,_0x2eee6f[_0x1acc('0x22')][_0x1acc('0x24')]);return _0x233a3b(_0x2eee6f[_0x1acc('0x22')][_0x1acc('0x24')]);}else{logger[_0x1acc('0x1d')](_0x1acc('0x1e'),_0x796648,_0x1acc('0x21'));_0x233a3b(_0x2eee6f[_0x1acc('0x25')][_0x1acc('0x24')]);}})[_0x1acc('0x26')](function(_0x586c99){logger[_0x1acc('0x22')](_0x1acc('0x1e'),_0x796648,_0x586c99);_0x57f828(_0x586c99);});});}function respondWithStatusCode(_0x568910,_0x1aec15){_0x1aec15=_0x1aec15||0xcc;return function(_0x263461){if(_0x263461){return _0x568910['sendStatus'](_0x1aec15);}return _0x568910[_0x1acc('0x27')](_0x1aec15)[_0x1acc('0x28')]();};}function respondWithResult(_0x51f0f7,_0x50034e){_0x50034e=_0x50034e||0xc8;return function(_0x25dc6e){if(_0x25dc6e){return _0x51f0f7[_0x1acc('0x27')](_0x50034e)[_0x1acc('0x29')](_0x25dc6e);}};}function respondWithFilteredResult(_0xc26ba4,_0x56ce7a){return function(_0x1ae981){if(_0x1ae981){var _0x9f98cd=_0x1ae981[_0x1acc('0x2a')],_0x414e2a=_0x56ce7a[_0x1acc('0x2b')],_0x338be8=_0x56ce7a[_0x1acc('0x2b')]+_0x56ce7a[_0x1acc('0x2c')],_0x265861;if(_0x338be8>=_0x9f98cd){_0x338be8=_0x9f98cd;_0x265861=0xc8;}else{_0x265861=0xce;}_0xc26ba4[_0x1acc('0x27')](_0x265861);return _0xc26ba4['set']('Content-Range',_0x414e2a+'-'+_0x338be8+'/'+_0x9f98cd)['json'](_0x1ae981);}return null;};}function patchUpdates(_0x4ea53a){return function(_0x43f468){try{jsonpatch[_0x1acc('0x2d')](_0x43f468,_0x4ea53a,!![]);}catch(_0x42055e){return BPromise['reject'](_0x42055e);}return _0x43f468[_0x1acc('0x2e')]();};}function saveUpdates(_0x36c2f2,_0x383619){return function(_0x5ca8a2){if(_0x5ca8a2){return _0x5ca8a2[_0x1acc('0x2f')](_0x36c2f2)[_0x1acc('0x1c')](function(_0x219746){return _0x219746;});}return null;};}function removeEntity(_0x1a7531,_0x13d360){return function(_0x1a5ec5){if(_0x1a5ec5){return _0x1a5ec5[_0x1acc('0x30')]()[_0x1acc('0x1c')](function(){var _0x1df44c=_0x1a5ec5[_0x1acc('0x31')]({'plain':!![]});var _0x584366=_0x1acc('0x32');return db[_0x1acc('0x33')][_0x1acc('0x30')]({'where':{'type':_0x584366,'resourceId':_0x1df44c['id']}})[_0x1acc('0x1c')](function(){return _0x1a5ec5;});})['then'](function(){_0x1a7531[_0x1acc('0x27')](0xcc)[_0x1acc('0x28')]();});}};}function handleEntityNotFound(_0xd9b644,_0x1de308){return function(_0x1cb7a0){if(!_0x1cb7a0){_0xd9b644['sendStatus'](0x194);}return _0x1cb7a0;};}function handleError(_0x454b3b,_0xb9cb33){_0xb9cb33=_0xb9cb33||0x1f4;return function(_0x472642){logger[_0x1acc('0x22')](_0x472642[_0x1acc('0x34')]);if(_0x472642[_0x1acc('0x35')]){delete _0x472642[_0x1acc('0x35')];}_0x454b3b['status'](_0xb9cb33)[_0x1acc('0x36')](_0x472642);};}exports[_0x1acc('0x37')]=function(_0x45bc6b,_0x2a2d53){var _0x572594={'include':[{'model':db[_0x1acc('0x38')],'as':_0x1acc('0x39')}]},_0x1aa69d={},_0x41bb04={'count':0x0,'rows':[]};var _0x358f4a=_['map'](db['FaxAccount']['rawAttributes'],function(_0x4a77d5){return{'name':_0x4a77d5['fieldName'],'type':_0x4a77d5[_0x1acc('0x3a')][_0x1acc('0x3b')]};});_0x1aa69d[_0x1acc('0x3c')]=_[_0x1acc('0x3d')](_0x358f4a,_0x1acc('0x35'));_0x1aa69d[_0x1acc('0x3e')]=_[_0x1acc('0x3f')](_0x45bc6b['query']);_0x1aa69d['filters']=_[_0x1acc('0x40')](_0x1aa69d[_0x1acc('0x3c')],_0x1aa69d[_0x1acc('0x3e')]);_0x572594['attributes']=_[_0x1acc('0x40')](_0x1aa69d[_0x1acc('0x3c')],qs[_0x1acc('0x41')](_0x45bc6b[_0x1acc('0x3e')][_0x1acc('0x41')]));_0x572594[_0x1acc('0x42')]=_0x572594[_0x1acc('0x42')][_0x1acc('0x43')]?_0x572594['attributes']:_0x1aa69d[_0x1acc('0x3c')];if(!_0x45bc6b[_0x1acc('0x3e')][_0x1acc('0x44')](_0x1acc('0x45'))){_0x572594[_0x1acc('0x2c')]=qs[_0x1acc('0x2c')](_0x45bc6b[_0x1acc('0x3e')][_0x1acc('0x2c')]);_0x572594['offset']=qs[_0x1acc('0x2b')](_0x45bc6b[_0x1acc('0x3e')][_0x1acc('0x2b')]);}_0x572594[_0x1acc('0x46')]=qs['sort'](_0x45bc6b[_0x1acc('0x3e')][_0x1acc('0x47')]);_0x572594[_0x1acc('0x48')]=qs[_0x1acc('0x49')](_[_0x1acc('0x4a')](_0x45bc6b[_0x1acc('0x3e')],_0x1aa69d[_0x1acc('0x49')]));if(_0x45bc6b[_0x1acc('0x3e')]['filter']){_0x572594[_0x1acc('0x48')]=_[_0x1acc('0x4b')](_0x572594[_0x1acc('0x48')],{'$or':_[_0x1acc('0x3d')](_0x358f4a,function(_0xb21a48){if(_0xb21a48[_0x1acc('0x3a')]!=='VIRTUAL'){var _0x597461={};_0x597461[_0xb21a48[_0x1acc('0x35')]]={'$like':'%'+_0x45bc6b[_0x1acc('0x3e')][_0x1acc('0x4c')]+'%'};return _0x597461;}})});}_0x572594=_[_0x1acc('0x4b')]({},_0x572594,_0x45bc6b['options']);var _0x4f8087={'where':_0x572594[_0x1acc('0x48')]};return db[_0x1acc('0x4d')][_0x1acc('0x2a')](_0x4f8087)[_0x1acc('0x1c')](function(_0x500316){_0x41bb04[_0x1acc('0x2a')]=_0x500316;if(_0x45bc6b[_0x1acc('0x3e')][_0x1acc('0x4e')]){_0x572594[_0x1acc('0x4f')]=[{'all':!![]}];}return db[_0x1acc('0x4d')]['findAll'](_0x572594);})['then'](function(_0x6a4616){_0x41bb04[_0x1acc('0x50')]=_0x6a4616;return _0x41bb04;})['then'](respondWithFilteredResult(_0x2a2d53,_0x572594))['catch'](handleError(_0x2a2d53,null));};exports[_0x1acc('0x51')]=function(_0x3b26f8,_0x5be23e){var _0x3a26ef={'raw':![],'where':{'id':_0x3b26f8[_0x1acc('0x52')]['id']},'include':[{'model':db[_0x1acc('0x38')],'as':_0x1acc('0x39')}]},_0x1ad46e={};_0x1ad46e['model']=_[_0x1acc('0x3f')](db[_0x1acc('0x4d')][_0x1acc('0x53')]);_0x1ad46e['query']=_[_0x1acc('0x3f')](_0x3b26f8['query']);_0x1ad46e['filters']=_[_0x1acc('0x40')](_0x1ad46e[_0x1acc('0x3c')],_0x1ad46e['query']);_0x3a26ef[_0x1acc('0x42')]=_[_0x1acc('0x40')](_0x1ad46e[_0x1acc('0x3c')],qs[_0x1acc('0x41')](_0x3b26f8[_0x1acc('0x3e')][_0x1acc('0x41')]));_0x3a26ef[_0x1acc('0x42')]=_0x3a26ef['attributes'][_0x1acc('0x43')]?_0x3a26ef[_0x1acc('0x42')]:_0x1ad46e[_0x1acc('0x3c')];if(_0x3b26f8['query']['includeAll']){_0x3a26ef[_0x1acc('0x4f')]=[{'all':!![]}];}_0x3a26ef=_[_0x1acc('0x4b')]({},_0x3a26ef,_0x3b26f8[_0x1acc('0x54')]);return db['FaxAccount'][_0x1acc('0x55')](_0x3a26ef)['then'](handleEntityNotFound(_0x5be23e,null))['then'](respondWithResult(_0x5be23e,null))[_0x1acc('0x26')](handleError(_0x5be23e,null));};exports[_0x1acc('0x56')]=function(_0x10b948,_0x4d4ab2){return db[_0x1acc('0x4d')][_0x1acc('0x56')](_0x10b948[_0x1acc('0x57')],{})[_0x1acc('0x1c')](function(_0x340d35){var _0x4034f1=_0x10b948[_0x1acc('0x58')]['get']({'plain':!![]});if(!_0x4034f1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4034f1[_0x1acc('0x59')]==='user'){var _0x230f49=_0x340d35[_0x1acc('0x31')]({'plain':!![]});var _0x1abcd3=_0x1acc('0x32');return db[_0x1acc('0x5a')][_0x1acc('0x55')]({'where':{'name':_0x1abcd3,'userProfileId':_0x4034f1[_0x1acc('0x5b')]},'raw':!![]})[_0x1acc('0x1c')](function(_0x3d1d80){if(_0x3d1d80&&_0x3d1d80['autoAssociation']===0x0){return db[_0x1acc('0x33')]['create']({'name':_0x230f49[_0x1acc('0x35')],'resourceId':_0x230f49['id'],'type':_0x3d1d80[_0x1acc('0x35')],'sectionId':_0x3d1d80['id']},{})[_0x1acc('0x1c')](function(){return _0x340d35;});}else{return _0x340d35;}})['catch'](function(_0x2b660f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2b660f);throw _0x2b660f;});}return _0x340d35;})[_0x1acc('0x1c')](respondWithResult(_0x4d4ab2,0xc9))['catch'](handleError(_0x4d4ab2,null));};exports[_0x1acc('0x2f')]=function(_0x39fd5b,_0x5d6966){if(_0x39fd5b[_0x1acc('0x57')]['id']){delete _0x39fd5b[_0x1acc('0x57')]['id'];}return db[_0x1acc('0x4d')][_0x1acc('0x55')]({'where':{'id':_0x39fd5b['params']['id']},'include':[{'model':db[_0x1acc('0x38')],'as':_0x1acc('0x39')}]})['then'](handleEntityNotFound(_0x5d6966,null))['then'](saveUpdates(_0x39fd5b['body'],null))[_0x1acc('0x1c')](respondWithResult(_0x5d6966,null))[_0x1acc('0x26')](handleError(_0x5d6966,null));};exports[_0x1acc('0x30')]=function(_0xb1ee33,_0x2a563a){return db[_0x1acc('0x4d')][_0x1acc('0x55')]({'where':{'id':_0xb1ee33[_0x1acc('0x52')]['id']}})[_0x1acc('0x1c')](handleEntityNotFound(_0x2a563a,null))[_0x1acc('0x1c')](removeEntity(_0x2a563a,null))[_0x1acc('0x26')](handleError(_0x2a563a,null));};exports[_0x1acc('0x5c')]=function(_0x331f17,_0x1aa6e6){return db['FaxAccount'][_0x1acc('0x5c')]()[_0x1acc('0x1c')](respondWithResult(_0x1aa6e6,null))[_0x1acc('0x26')](handleError(_0x1aa6e6,null));};exports['addDisposition']=function(_0x6832dc,_0x32e053,_0x3b2e67){if(_0x6832dc['body']['id']){delete _0x6832dc[_0x1acc('0x57')]['id'];}return db['FaxAccount'][_0x1acc('0x55')]({'where':{'id':_0x6832dc[_0x1acc('0x52')]['id']}})[_0x1acc('0x1c')](handleEntityNotFound(_0x32e053,null))[_0x1acc('0x1c')](function(_0x2c248c){if(_0x2c248c){_0x6832dc[_0x1acc('0x57')][_0x1acc('0x5d')]=_0x2c248c['id'];return db['Disposition'][_0x1acc('0x56')](_0x6832dc[_0x1acc('0x57')]);}})[_0x1acc('0x1c')](respondWithResult(_0x32e053,null))['catch'](handleError(_0x32e053,null));};exports[_0x1acc('0x5e')]=function(_0x2b5744,_0x1e7aff,_0x16c983){var _0x2f5ee8={'raw':![],'where':{}};var _0x24ce8d={};var _0x5964fb={'count':0x0,'rows':[]};return db[_0x1acc('0x4d')][_0x1acc('0x5f')]({'where':{'id':_0x2b5744[_0x1acc('0x52')]['id']}})[_0x1acc('0x1c')](handleEntityNotFound(_0x1e7aff,null))[_0x1acc('0x1c')](function(_0xda9ba3){if(_0xda9ba3){_0x24ce8d['model']=_[_0x1acc('0x3f')](db[_0x1acc('0x60')][_0x1acc('0x53')]);_0x24ce8d[_0x1acc('0x3e')]=_[_0x1acc('0x3f')](_0x2b5744[_0x1acc('0x3e')]);_0x24ce8d[_0x1acc('0x49')]=_[_0x1acc('0x40')](_0x24ce8d['model'],_0x24ce8d[_0x1acc('0x3e')]);_0x2f5ee8[_0x1acc('0x42')]=_['intersection'](_0x24ce8d[_0x1acc('0x3c')],qs[_0x1acc('0x41')](_0x2b5744['query']['fields']));_0x2f5ee8[_0x1acc('0x42')]=_0x2f5ee8[_0x1acc('0x42')][_0x1acc('0x43')]?_0x2f5ee8[_0x1acc('0x42')]:_0x24ce8d[_0x1acc('0x3c')];if(!_0x2b5744[_0x1acc('0x3e')]['hasOwnProperty'](_0x1acc('0x45'))){_0x2f5ee8[_0x1acc('0x2c')]=qs[_0x1acc('0x2c')](_0x2b5744[_0x1acc('0x3e')][_0x1acc('0x2c')]);_0x2f5ee8['offset']=qs[_0x1acc('0x2b')](_0x2b5744[_0x1acc('0x3e')][_0x1acc('0x2b')]);}_0x2f5ee8['order']=qs[_0x1acc('0x47')](_0x2b5744['query'][_0x1acc('0x47')]);_0x2f5ee8[_0x1acc('0x48')]=qs[_0x1acc('0x49')](_[_0x1acc('0x4a')](_0x2b5744[_0x1acc('0x3e')],_0x24ce8d[_0x1acc('0x49')]));_0x2f5ee8[_0x1acc('0x48')][_0x1acc('0x5d')]=_0xda9ba3['id'];if(_0x2b5744[_0x1acc('0x3e')][_0x1acc('0x4c')]){_0x2f5ee8[_0x1acc('0x48')]=_[_0x1acc('0x4b')](_0x2f5ee8[_0x1acc('0x48')],{'$or':_['map'](_0x2f5ee8['attributes'],function(_0x1da619){var _0x1b2e05={};_0x1b2e05[_0x1da619]={'$like':'%'+_0x2b5744['query'][_0x1acc('0x4c')]+'%'};return _0x1b2e05;})});}_0x2f5ee8=_[_0x1acc('0x4b')]({},_0x2f5ee8,_0x2b5744[_0x1acc('0x54')]);return db['Disposition'][_0x1acc('0x2a')]({'where':_0x2f5ee8[_0x1acc('0x48')]})[_0x1acc('0x1c')](function(_0x333305){_0x5964fb['count']=_0x333305;if(_0x2b5744[_0x1acc('0x3e')][_0x1acc('0x4e')]){_0x2f5ee8[_0x1acc('0x4f')]=[{'all':!![]}];}return db[_0x1acc('0x60')]['findAll'](_0x2f5ee8);})[_0x1acc('0x1c')](function(_0x3a818d){_0x5964fb[_0x1acc('0x50')]=_0x3a818d;return _0x5964fb;});}})[_0x1acc('0x1c')](respondWithFilteredResult(_0x1e7aff,_0x2f5ee8))['catch'](handleError(_0x1e7aff,null));};exports[_0x1acc('0x61')]=function(_0x450fc3,_0x44465e,_0x1b372){return db['FaxAccount'][_0x1acc('0x55')]({'where':{'id':_0x450fc3['params']['id']}})[_0x1acc('0x1c')](handleEntityNotFound(_0x44465e,null))[_0x1acc('0x1c')](function(_0x4356ea){if(_0x4356ea){return _0x4356ea[_0x1acc('0x61')](_0x450fc3[_0x1acc('0x3e')][_0x1acc('0x62')]);}})[_0x1acc('0x1c')](respondWithStatusCode(_0x44465e,null))[_0x1acc('0x26')](handleError(_0x44465e,null));};exports[_0x1acc('0x63')]=function(_0x1ab522,_0x35a2e6,_0x3ce5fd){if(_0x1ab522[_0x1acc('0x57')]['id']){delete _0x1ab522[_0x1acc('0x57')]['id'];}return db[_0x1acc('0x4d')]['find']({'where':{'id':_0x1ab522[_0x1acc('0x52')]['id']}})['then'](handleEntityNotFound(_0x35a2e6,null))[_0x1acc('0x1c')](function(_0xcbe3b){if(_0xcbe3b){_0x1ab522[_0x1acc('0x57')][_0x1acc('0x5d')]=_0xcbe3b['id'];return db[_0x1acc('0x64')][_0x1acc('0x56')](_0x1ab522['body']);}})[_0x1acc('0x1c')](respondWithResult(_0x35a2e6,null))[_0x1acc('0x26')](handleError(_0x35a2e6,null));};exports[_0x1acc('0x65')]=function(_0x2d2f51,_0x21dbbb,_0x351e4b){var _0x37539d={'raw':![],'where':{}};var _0x2f1f16={};var _0x1eb956={'count':0x0,'rows':[]};return db[_0x1acc('0x4d')][_0x1acc('0x5f')]({'where':{'id':_0x2d2f51[_0x1acc('0x52')]['id']}})[_0x1acc('0x1c')](handleEntityNotFound(_0x21dbbb,null))['then'](function(_0x2ab7be){if(_0x2ab7be){_0x2f1f16[_0x1acc('0x3c')]=_[_0x1acc('0x3f')](db[_0x1acc('0x64')][_0x1acc('0x53')]);_0x2f1f16['query']=_[_0x1acc('0x3f')](_0x2d2f51[_0x1acc('0x3e')]);_0x2f1f16[_0x1acc('0x49')]=_[_0x1acc('0x40')](_0x2f1f16[_0x1acc('0x3c')],_0x2f1f16[_0x1acc('0x3e')]);_0x37539d[_0x1acc('0x42')]=_[_0x1acc('0x40')](_0x2f1f16[_0x1acc('0x3c')],qs['fields'](_0x2d2f51[_0x1acc('0x3e')][_0x1acc('0x41')]));_0x37539d[_0x1acc('0x42')]=_0x37539d[_0x1acc('0x42')][_0x1acc('0x43')]?_0x37539d[_0x1acc('0x42')]:_0x2f1f16[_0x1acc('0x3c')];if(!_0x2d2f51['query'][_0x1acc('0x44')](_0x1acc('0x45'))){_0x37539d[_0x1acc('0x2c')]=qs[_0x1acc('0x2c')](_0x2d2f51['query']['limit']);_0x37539d[_0x1acc('0x2b')]=qs['offset'](_0x2d2f51[_0x1acc('0x3e')][_0x1acc('0x2b')]);}_0x37539d[_0x1acc('0x46')]=qs[_0x1acc('0x47')](_0x2d2f51[_0x1acc('0x3e')][_0x1acc('0x47')]);_0x37539d[_0x1acc('0x48')]=qs[_0x1acc('0x49')](_['pick'](_0x2d2f51[_0x1acc('0x3e')],_0x2f1f16[_0x1acc('0x49')]));_0x37539d[_0x1acc('0x48')][_0x1acc('0x5d')]=_0x2ab7be['id'];if(_0x2d2f51['query'][_0x1acc('0x4c')]){_0x37539d[_0x1acc('0x48')]=_[_0x1acc('0x4b')](_0x37539d[_0x1acc('0x48')],{'$or':_[_0x1acc('0x3d')](_0x37539d['attributes'],function(_0x119372){var _0x569250={};_0x569250[_0x119372]={'$like':'%'+_0x2d2f51[_0x1acc('0x3e')][_0x1acc('0x4c')]+'%'};return _0x569250;})});}_0x37539d=_[_0x1acc('0x4b')]({},_0x37539d,_0x2d2f51['options']);return db[_0x1acc('0x64')][_0x1acc('0x2a')]({'where':_0x37539d[_0x1acc('0x48')]})[_0x1acc('0x1c')](function(_0x2e2de0){_0x1eb956['count']=_0x2e2de0;if(_0x2d2f51[_0x1acc('0x3e')][_0x1acc('0x4e')]){_0x37539d[_0x1acc('0x4f')]=[{'all':!![]}];}return db[_0x1acc('0x64')][_0x1acc('0x66')](_0x37539d);})[_0x1acc('0x1c')](function(_0x408e2b){_0x1eb956[_0x1acc('0x50')]=_0x408e2b;return _0x1eb956;});}})[_0x1acc('0x1c')](respondWithFilteredResult(_0x21dbbb,_0x37539d))[_0x1acc('0x26')](handleError(_0x21dbbb,null));};exports[_0x1acc('0x67')]=function(_0x3cb231,_0x1825e8,_0xf70146){return db['FaxAccount'][_0x1acc('0x55')]({'where':{'id':_0x3cb231[_0x1acc('0x52')]['id']}})['then'](handleEntityNotFound(_0x1825e8,null))['then'](function(_0x50fece){if(_0x50fece){return _0x50fece['removeAnswers'](_0x3cb231[_0x1acc('0x3e')][_0x1acc('0x62')]);}})[_0x1acc('0x1c')](respondWithStatusCode(_0x1825e8,null))[_0x1acc('0x26')](handleError(_0x1825e8,null));};exports['addInteraction']=function(_0x2d3e43,_0x46fdbd,_0x11d6c8){return db[_0x1acc('0x68')][_0x1acc('0x55')]({'where':{'id':_0x2d3e43[_0x1acc('0x52')]['id']}})[_0x1acc('0x1c')](handleEntityNotFound(_0x46fdbd,null))['then'](function(_0x5c4421){if(_0x5c4421){return _0x5c4421[_0x1acc('0x69')](_0x2d3e43[_0x1acc('0x57')][_0x1acc('0x62')],_[_0x1acc('0x6a')](_0x2d3e43[_0x1acc('0x57')],['ids','id'])||{});}})[_0x1acc('0x1c')](respondWithResult(_0x46fdbd,null))[_0x1acc('0x26')](handleError(_0x46fdbd,null));};exports[_0x1acc('0x6b')]=function(_0x3ecad6,_0x59edcb,_0x1e607f){var _0x4413fe={'raw':![],'where':{}};var _0x413a6d={};var _0x32d1b={'count':0x0,'rows':[]};return db[_0x1acc('0x4d')][_0x1acc('0x5f')]({'where':{'id':_0x3ecad6['params']['id']}})[_0x1acc('0x1c')](handleEntityNotFound(_0x59edcb,null))[_0x1acc('0x1c')](function(_0x29af11){if(_0x29af11){_0x413a6d['model']=_[_0x1acc('0x3f')](db[_0x1acc('0x68')][_0x1acc('0x53')]);_0x413a6d[_0x1acc('0x3e')]=_[_0x1acc('0x3f')](_0x3ecad6[_0x1acc('0x3e')]);_0x413a6d[_0x1acc('0x49')]=_[_0x1acc('0x40')](_0x413a6d[_0x1acc('0x3c')],_0x413a6d[_0x1acc('0x3e')]);_0x4413fe['attributes']=_[_0x1acc('0x40')](_0x413a6d[_0x1acc('0x3c')],qs[_0x1acc('0x41')](_0x3ecad6[_0x1acc('0x3e')][_0x1acc('0x41')]));_0x4413fe[_0x1acc('0x42')]=_0x4413fe['attributes']['length']?_0x4413fe[_0x1acc('0x42')]:_0x413a6d[_0x1acc('0x3c')];if(!_0x3ecad6['query'][_0x1acc('0x44')](_0x1acc('0x45'))){_0x4413fe[_0x1acc('0x2c')]=qs[_0x1acc('0x2c')](_0x3ecad6[_0x1acc('0x3e')]['limit']);_0x4413fe[_0x1acc('0x2b')]=qs[_0x1acc('0x2b')](_0x3ecad6[_0x1acc('0x3e')][_0x1acc('0x2b')]);}_0x4413fe[_0x1acc('0x46')]=qs[_0x1acc('0x47')](_0x3ecad6['query'][_0x1acc('0x47')]);_0x4413fe[_0x1acc('0x48')]=qs[_0x1acc('0x49')](_[_0x1acc('0x4a')](_0x3ecad6['query'],_0x413a6d[_0x1acc('0x49')]));_0x4413fe[_0x1acc('0x48')][_0x1acc('0x5d')]=_0x29af11['id'];if(_0x3ecad6[_0x1acc('0x3e')]['filter']){_0x4413fe[_0x1acc('0x48')]=_[_0x1acc('0x4b')](_0x4413fe[_0x1acc('0x48')],{'$or':_['map'](_0x4413fe[_0x1acc('0x42')],function(_0x3abb2c){var _0x406da4={};_0x406da4[_0x3abb2c]={'$like':'%'+_0x3ecad6['query'][_0x1acc('0x4c')]+'%'};return _0x406da4;})});}_0x4413fe=_[_0x1acc('0x4b')]({},_0x4413fe,_0x3ecad6[_0x1acc('0x54')]);return db[_0x1acc('0x68')]['count']({'where':_0x4413fe[_0x1acc('0x48')]})['then'](function(_0x4cd07a){_0x32d1b[_0x1acc('0x2a')]=_0x4cd07a;if(_0x3ecad6[_0x1acc('0x3e')][_0x1acc('0x4e')]){_0x4413fe[_0x1acc('0x4f')]=[{'model':db[_0x1acc('0x6c')],'as':_0x1acc('0x6d'),'required':![]},{'model':db[_0x1acc('0x6e')],'as':_0x1acc('0x6f'),'attributes':[_0x1acc('0x35'),_0x1acc('0x70'),'internal'],'required':![]},{'model':db[_0x1acc('0x71')],'as':_0x1acc('0x72'),'attributes':['id',_0x1acc('0x35'),_0x1acc('0x73')],'where':_0x3ecad6['query'][_0x1acc('0x74')]?{'id':_0x3ecad6[_0x1acc('0x3e')]['tag']}:undefined,'required':_0x3ecad6['query'][_0x1acc('0x74')]?!![]:![]}];}return db['FaxInteraction'][_0x1acc('0x66')](_0x4413fe);})[_0x1acc('0x1c')](function(_0x50e684){_0x32d1b[_0x1acc('0x50')]=_0x50e684;return _0x32d1b;});}})[_0x1acc('0x1c')](respondWithFilteredResult(_0x59edcb,_0x4413fe))[_0x1acc('0x26')](handleError(_0x59edcb,null));};exports[_0x1acc('0x75')]=function(_0xd15b14,_0x8edffc,_0xca16ba){return db[_0x1acc('0x4d')]['findOne']({'where':{'id':_0xd15b14[_0x1acc('0x52')]['id']}})['then'](handleEntityNotFound(_0x8edffc,null))[_0x1acc('0x1c')](function(_0x2f422b){if(_0x2f422b){return db[_0x1acc('0x76')][_0x1acc('0x77')](function(_0x2953e2){return db[_0x1acc('0x78')]['destroy']({'where':{'FaxAccountId':_0xd15b14[_0x1acc('0x52')]['id']},'transaction':_0x2953e2})['then'](function(_0x3a7ba3){var _0x2d875e=_[_0x1acc('0x3d')](_0xd15b14[_0x1acc('0x57')],function(_0x49ee07){_0x49ee07[_0x1acc('0x5d')]=_0xd15b14[_0x1acc('0x52')]['id'];return _0x49ee07;});return db[_0x1acc('0x78')]['bulkCreate'](_0x2d875e,{'transaction':_0x2953e2});});})['then'](function(){return db[_0x1acc('0x78')][_0x1acc('0x79')]({'where':{'FaxAccountId':_0xd15b14[_0x1acc('0x52')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x8edffc,null))[_0x1acc('0x26')](handleError(_0x8edffc,null));};exports[_0x1acc('0x7a')]=function(_0xa5ff07,_0x1233b9,_0x50463a){var _0xf00e58={};var _0x517ba6={};var _0x4e73fc;var _0x5aef5f;return db['FaxAccount'][_0x1acc('0x5f')]({'where':{'id':_0xa5ff07['params']['id']}})['then'](handleEntityNotFound(_0x1233b9,null))[_0x1acc('0x1c')](function(_0x565bad){if(_0x565bad){_0x4e73fc=_0x565bad;_0x517ba6[_0x1acc('0x3c')]=_[_0x1acc('0x3f')](db[_0x1acc('0x78')][_0x1acc('0x53')]);_0x517ba6[_0x1acc('0x3e')]=_[_0x1acc('0x3f')](_0xa5ff07[_0x1acc('0x3e')]);_0x517ba6[_0x1acc('0x49')]=_[_0x1acc('0x40')](_0x517ba6['model'],_0x517ba6[_0x1acc('0x3e')]);_0xf00e58['attributes']=_[_0x1acc('0x40')](_0x517ba6[_0x1acc('0x3c')],qs[_0x1acc('0x41')](_0xa5ff07[_0x1acc('0x3e')]['fields']));_0xf00e58[_0x1acc('0x42')]=_0xf00e58[_0x1acc('0x42')][_0x1acc('0x43')]?_0xf00e58[_0x1acc('0x42')]:_0x517ba6[_0x1acc('0x3c')];_0xf00e58['order']=qs[_0x1acc('0x47')](_0xa5ff07['query'][_0x1acc('0x47')]);_0xf00e58[_0x1acc('0x48')]=qs[_0x1acc('0x49')](_[_0x1acc('0x4a')](_0xa5ff07[_0x1acc('0x3e')],_0x517ba6[_0x1acc('0x49')]));if(_0xa5ff07[_0x1acc('0x3e')][_0x1acc('0x4c')]){_0xf00e58[_0x1acc('0x48')]=_['merge'](_0xf00e58[_0x1acc('0x48')],{'$or':_['map'](_0xf00e58['attributes'],function(_0x1418e1){var _0x231fbc={};_0x231fbc[_0x1418e1]={'$like':'%'+_0xa5ff07[_0x1acc('0x3e')][_0x1acc('0x4c')]+'%'};return _0x231fbc;})});}_0xf00e58=_[_0x1acc('0x4b')]({},_0xf00e58,_0xa5ff07[_0x1acc('0x54')]);return _0x4e73fc[_0x1acc('0x7a')](_0xf00e58);}})[_0x1acc('0x1c')](function(_0x6886a4){if(_0x6886a4){_0x5aef5f=_0x6886a4[_0x1acc('0x43')];if(!_0xa5ff07[_0x1acc('0x3e')]['hasOwnProperty'](_0x1acc('0x45'))){_0xf00e58[_0x1acc('0x2c')]=qs[_0x1acc('0x2c')](_0xa5ff07[_0x1acc('0x3e')][_0x1acc('0x2c')]);_0xf00e58[_0x1acc('0x2b')]=qs[_0x1acc('0x2b')](_0xa5ff07['query']['offset']);}return _0x4e73fc[_0x1acc('0x7a')](_0xf00e58);}})[_0x1acc('0x1c')](function(_0x14c985){if(_0x14c985){return _0x14c985?{'count':_0x5aef5f,'rows':_0x14c985}:null;}})['then'](respondWithResult(_0x1233b9,null))[_0x1acc('0x26')](handleError(_0x1233b9,null));};function Extension(_0x10531c,_0x555d1f,_0x5035a2,_0x54cc95){this[_0x1acc('0x7b')]=_0x1acc('0x7c');this[_0x1acc('0x7d')]=_0x10531c[_0x1acc('0x7e')];this[_0x1acc('0x7f')]=_0x54cc95;this[_0x1acc('0x3a')]=_0x1acc('0x80');this['description']=_0x1acc('0x81');this['FaxAccountId']=_0x10531c['id'];this['priority']=_0x555d1f;this['appdata']=_0x5035a2;}function createExtensionsReciveFax(_0x379b3f){var _0x55c267=0x1;var _0x3eaef8=[];_0x3eaef8[_0x1acc('0x82')](new Extension(_0x379b3f,_0x55c267,'','Answer'));_0x55c267+=0x1;_0x3eaef8[_0x1acc('0x82')](new Extension(_0x379b3f,_0x55c267,_0x1acc('0x83'),'Set'));_0x55c267+=0x1;for(var _0x1563c3 in _0x379b3f){if(_0x379b3f[_0x1acc('0x44')](_0x1563c3)&&(_0x1563c3===_0x1acc('0x84')||_0x1563c3===_0x1acc('0x7e')||_0x1563c3===_0x1acc('0x85')||_0x1563c3==='faxdetect'||_0x1563c3===_0x1acc('0x86')||_0x1563c3==='maxrate'||_0x1563c3===_0x1acc('0x87')||_0x1563c3===_0x1acc('0x88')||_0x1563c3==='t38timeout')){_0x3eaef8[_0x1acc('0x82')](new Extension(_0x379b3f,_0x55c267,'FAXOPT('+_0x1563c3+')='+_0x379b3f[_0x1563c3],'Set'));_0x55c267+=0x1;}}_0x3eaef8['push'](new Extension(_0x379b3f,_0x55c267,'6','Wait'));_0x55c267+=0x1;_0x3eaef8[_0x1acc('0x82')](new Extension(_0x379b3f,_0x55c267,'/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',_0x1acc('0x89')));_0x55c267=0x0;return _0x3eaef8;}exports[_0x1acc('0x8a')]=function(_0x505ae8,_0x5af88d,_0x491254){var _0x53a0b9;return db[_0x1acc('0x76')][_0x1acc('0x77')](function(_0x3f1a81){return db[_0x1acc('0x4d')]['create'](_0x505ae8[_0x1acc('0x57')],{'transaction':_0x3f1a81})[_0x1acc('0x1c')](function(_0x1cb9c4){_0x53a0b9=_0x1cb9c4['get']({'plain':!![]});return db[_0x1acc('0x8b')][_0x1acc('0x8c')](createExtensionsReciveFax(_0x53a0b9),{'transaction':_0x3f1a81});});})[_0x1acc('0x1c')](function(){return _0x53a0b9;})[_0x1acc('0x1c')](respondWithResult(_0x5af88d,null))[_0x1acc('0x26')](handleError(_0x5af88d,null));};exports['updateAccountApplications']=function(_0x4ffc60,_0x492fdd,_0x365dda){var _0x3b3856;return db[_0x1acc('0x76')][_0x1acc('0x77')](function(_0x3ddb42){return db[_0x1acc('0x4d')][_0x1acc('0x2f')](_0x4ffc60[_0x1acc('0x57')],{'where':{'id':_0x4ffc60[_0x1acc('0x57')]['id']},'transaction':_0x3ddb42})[_0x1acc('0x1c')](function(_0x483e81){return db['VoiceExtension'][_0x1acc('0x30')]({'where':{'FaxAccountId':_0x4ffc60[_0x1acc('0x57')]['id']},'transaction':_0x3ddb42})[_0x1acc('0x1c')](function(_0xf75a7b){return db[_0x1acc('0x8b')][_0x1acc('0x8c')](createExtensionsReciveFax(_[_0x1acc('0x6a')](_0x4ffc60[_0x1acc('0x57')],[_0x1acc('0x8d'),_0x1acc('0x3b'),_0x1acc('0x8e'),'updatedAt',_0x1acc('0x8f'),_0x1acc('0x90')])),{'transaction':_0x3ddb42});});});})[_0x1acc('0x1c')](function(){return db[_0x1acc('0x4d')][_0x1acc('0x91')](_0x4ffc60[_0x1acc('0x57')]['id']);})['then'](respondWithResult(_0x492fdd,null))[_0x1acc('0x26')](handleError(_0x492fdd,null));};exports[_0x1acc('0x92')]=function(_0x1e2a88,_0x4420d8,_0x496e9c){var _0xfb96f6={'raw':!![],'where':{}};var _0x4e8f1a={};var _0x442994={'count':0x0,'rows':[]};return db[_0x1acc('0x4d')][_0x1acc('0x5f')]({'where':{'id':_0x1e2a88[_0x1acc('0x52')]['id']}})[_0x1acc('0x1c')](handleEntityNotFound(_0x4420d8,null))[_0x1acc('0x1c')](function(_0x2c200c){if(_0x2c200c){_0x4e8f1a['model']=_['keys'](db['FaxMessage'][_0x1acc('0x53')]);_0x4e8f1a[_0x1acc('0x3e')]=_['keys'](_0x1e2a88[_0x1acc('0x3e')]);_0x4e8f1a['filters']=_[_0x1acc('0x40')](_0x4e8f1a[_0x1acc('0x3c')],_0x4e8f1a[_0x1acc('0x3e')]);_0xfb96f6['attributes']=_[_0x1acc('0x40')](_0x4e8f1a[_0x1acc('0x3c')],qs[_0x1acc('0x41')](_0x1e2a88[_0x1acc('0x3e')][_0x1acc('0x41')]));_0xfb96f6[_0x1acc('0x42')]=_0xfb96f6[_0x1acc('0x42')]['length']?_0xfb96f6[_0x1acc('0x42')]:_0x4e8f1a[_0x1acc('0x3c')];if(!_0x1e2a88[_0x1acc('0x3e')][_0x1acc('0x44')](_0x1acc('0x45'))){_0xfb96f6[_0x1acc('0x2c')]=qs['limit'](_0x1e2a88[_0x1acc('0x3e')][_0x1acc('0x2c')]);_0xfb96f6[_0x1acc('0x2b')]=qs['offset'](_0x1e2a88[_0x1acc('0x3e')][_0x1acc('0x2b')]);}_0xfb96f6['order']=qs[_0x1acc('0x47')](_0x1e2a88[_0x1acc('0x3e')][_0x1acc('0x47')]);_0xfb96f6[_0x1acc('0x48')]=qs[_0x1acc('0x49')](_[_0x1acc('0x4a')](_0x1e2a88[_0x1acc('0x3e')],_0x4e8f1a[_0x1acc('0x49')]));_0xfb96f6[_0x1acc('0x48')][_0x1acc('0x5d')]=_0x2c200c['id'];if(_0x1e2a88[_0x1acc('0x3e')]['filter']){_0xfb96f6[_0x1acc('0x48')]=_[_0x1acc('0x4b')](_0xfb96f6[_0x1acc('0x48')],{'$or':_[_0x1acc('0x3d')](_0xfb96f6[_0x1acc('0x42')],function(_0x5c6cc7){var _0x274def={};_0x274def[_0x5c6cc7]={'$like':'%'+_0x1e2a88[_0x1acc('0x3e')][_0x1acc('0x4c')]+'%'};return _0x274def;})});}if(_0x1e2a88['query'][_0x1acc('0x93')]){var _0x1e9a9d=_0x1e2a88[_0x1acc('0x3e')]['$gte'][_0x1acc('0x94')](',');var _0x1047b5={};_0x1047b5[_0x1e9a9d[0x0]]={'$gte':moment(_0x1e9a9d[0x1])[_0x1acc('0x95')]('YYYY-MM-DD\x20HH:mm:ss')};_0xfb96f6['where']=_['merge'](_0xfb96f6[_0x1acc('0x48')],_0x1047b5);}_0xfb96f6=_['merge']({},_0xfb96f6,_0x1e2a88[_0x1acc('0x54')]);return db['FaxMessage']['count']({'where':_0xfb96f6[_0x1acc('0x48')]})['then'](function(_0x4ff0c1){_0x442994[_0x1acc('0x2a')]=_0x4ff0c1;if(_0x1e2a88[_0x1acc('0x3e')][_0x1acc('0x4e')]){_0xfb96f6[_0x1acc('0x4f')]=[{'all':!![]}];}return db[_0x1acc('0x96')][_0x1acc('0x66')](_0xfb96f6);})[_0x1acc('0x1c')](function(_0x578c8a){_0x442994[_0x1acc('0x50')]=_0x578c8a;return _0x442994;});}})[_0x1acc('0x1c')](respondWithFilteredResult(_0x4420d8,_0xfb96f6))[_0x1acc('0x26')](handleError(_0x4420d8,null));};exports[_0x1acc('0x36')]=function(_0x19646f,_0x15d78b,_0x240352){var _0x4abd7b,_0x76a9ac={},_0x1e0e59;if(_0x19646f[_0x1acc('0x57')]['to']){_0x1e0e59=_0x19646f[_0x1acc('0x57')]['to'][0x0];}return db[_0x1acc('0x4d')][_0x1acc('0x55')]({'where':{'id':_0x19646f[_0x1acc('0x52')]['id']},'include':[{'model':db[_0x1acc('0x97')],'as':_0x1acc('0x98'),'include':[{'model':db[_0x1acc('0x6c')],'as':'Contacts','where':{'fax':_0x1e0e59},'limit':0x1,'order':[[_0x1acc('0x99'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x15d78b,null))['then'](function(_0x46f0e9){_0x4abd7b=_0x46f0e9;if(_0x19646f['body'][_0x1acc('0x9a')]&&_0x19646f[_0x1acc('0x57')][_0x1acc('0x9a')][_0x1acc('0x43')]){for(var _0x27d1db=0x0;_0x27d1db<_0x19646f[_0x1acc('0x57')][_0x1acc('0x9a')][_0x1acc('0x43')];_0x27d1db+=0x1){_0x19646f[_0x1acc('0x57')][_0x1acc('0x9a')][_0x27d1db]={'filename':_0x19646f[_0x1acc('0x57')]['attachments'][_0x27d1db][_0x1acc('0x35')],'id':_0x19646f[_0x1acc('0x57')][_0x1acc('0x9a')][_0x27d1db]['id'],'path':path['join'](config[_0x1acc('0x9b')],_0x1acc('0x9c'),_0x19646f[_0x1acc('0x57')][_0x1acc('0x9a')][_0x27d1db][_0x1acc('0x9d')])};}}return respondWithRpcPromise(_0x1acc('0x9e'),'CheckAfterSend',{'FaxAccountId':_[_0x1acc('0x9f')](_0x19646f['params']['id'])?undefined:_0x19646f['params']['id'],'path':_['isNil'](_0x19646f['body'][_0x1acc('0x9a')][0x0]['path'])?undefined:_0x19646f[_0x1acc('0x57')][_0x1acc('0x9a')][0x0][_0x1acc('0xa0')],'fax':_[_0x1acc('0x9f')](_0x19646f[_0x1acc('0x57')]['to'][0x0])?undefined:_0x19646f['body']['to'][0x0]},client9002);})['then'](function(){if(_0x4abd7b){if(_[_0x1acc('0x9f')](_0x19646f['body'][_0x1acc('0xa1')])){_0x19646f[_0x1acc('0x57')][_0x1acc('0xa1')]=util['format'](_0x1acc('0xa2'),_0x4abd7b['name'],_0x4abd7b[_0x1acc('0xa3')]);}if(_0x4abd7b[_0x1acc('0x98')]){if(_0x4abd7b['List'][_0x1acc('0xa4')]['length']){return _0x4abd7b[_0x1acc('0x98')][_0x1acc('0xa4')][0x0];}else{return db['CmContact'][_0x1acc('0x56')](_[_0x1acc('0x12')](_0x19646f['body'],{'firstName':_0x19646f['body']['to'][0x0],'phone':_0x19646f['body']['to'][0x0],'fax':_0x19646f[_0x1acc('0x57')]['to'][0x0],'ListId':_0x4abd7b[_0x1acc('0x90')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x1acc('0xa5'));}})[_0x1acc('0x1c')](function(_0x57ac7e){if(_0x57ac7e){return db[_0x1acc('0x68')][_0x1acc('0x55')]({'where':{'ContactId':_0x57ac7e['id'],'closed':![],'FaxAccountId':_0x4abd7b['id']}})[_0x1acc('0x1c')](function(_0x232207){if(_0x232207){return[_0x232207,![]];}return db[_0x1acc('0x68')][_0x1acc('0x56')]({'UserId':_0x19646f[_0x1acc('0x58')]['id'],'ContactId':_0x57ac7e['id'],'FaxAccountId':_0x4abd7b['id'],'fax':_0x19646f[_0x1acc('0x57')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x1acc('0x4b')](_0x19646f[_0x1acc('0x57')],{'read':![],'body':_0x19646f[_0x1acc('0x57')][_0x1acc('0x9a')][0x0][_0x1acc('0xa6')],'FaxAccountId':_0x4abd7b['id'],'UserId':_0x19646f['user']['id'],'ContactId':_0x57ac7e['id'],'AttachmentId':_0x19646f[_0x1acc('0x57')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x1acc('0xa7')}]})[_0x1acc('0x1c')](function(_0x196d03){return[_0x196d03,!![]];});});}else{throw new Error(_0x1acc('0xa8'));}})['spread'](function(_0x25429a,_0x5153ea){if(_0x5153ea){return _0x25429a;}return db[_0x1acc('0x96')][_0x1acc('0x56')]({'direction':_0x1acc('0xa9'),'read':![],'body':_0x19646f[_0x1acc('0x57')]['attachments'][0x0][_0x1acc('0xa6')],'FaxAccountId':_0x4abd7b['id'],'FaxInteractionId':_0x25429a['id'],'UserId':_0x19646f[_0x1acc('0x58')]['id'],'ContactId':_0x25429a[_0x1acc('0xaa')],'AttachmentId':_0x19646f[_0x1acc('0x57')][_0x1acc('0x9a')][0x0]['id']})[_0x1acc('0x1c')](function(_0x5bb495){_0x25429a[_0x1acc('0xab')][_0x1acc('0xa7')]=[];_0x25429a['dataValues']['Messages'][_0x1acc('0x82')](_0x5bb495[_0x1acc('0xab')]);return _0x25429a;});})[_0x1acc('0x1c')](function(_0x5cec70){respondWithRpcPromise(_0x1acc('0xac'),_0x1acc('0xac'),{'FaxAccountId':_[_0x1acc('0x9f')](_0x19646f[_0x1acc('0x52')]['id'])?undefined:_0x19646f['params']['id'],'path':_[_0x1acc('0x9f')](_0x19646f[_0x1acc('0x57')][_0x1acc('0x9a')][0x0]['path'])?undefined:_0x19646f[_0x1acc('0x57')][_0x1acc('0x9a')][0x0][_0x1acc('0xa0')],'fax':_[_0x1acc('0x9f')](_0x19646f[_0x1acc('0x57')]['to'][0x0])?undefined:_0x19646f[_0x1acc('0x57')]['to'][0x0],'AttachmentId':_0x19646f[_0x1acc('0x57')][_0x1acc('0x9a')][0x0]['id']},client9002)[_0x1acc('0x1c')](function(_0x22b36a){logger['info'](_0x1acc('0xad'),_0x22b36a);})['catch'](function(_0xe63a29){logger[_0x1acc('0x1d')](_0x1acc('0xad'),_0xe63a29);});return _0x5cec70;})[_0x1acc('0x1c')](respondWithResult(_0x15d78b,null))[_0x1acc('0x26')](handleError(_0x15d78b,null));};exports[_0x1acc('0xae')]=function(_0x238c1a,_0x1b49b1,_0x7c53dd){return db[_0x1acc('0x4d')][_0x1acc('0x55')]({'where':{'id':_0x238c1a[_0x1acc('0x52')]['id']}})[_0x1acc('0x1c')](handleEntityNotFound(_0x1b49b1,null))['then'](function(_0x170973){if(_0x170973){return _0x170973[_0x1acc('0xae')](_0x238c1a[_0x1acc('0x57')][_0x1acc('0x62')],_[_0x1acc('0x6a')](_0x238c1a[_0x1acc('0x57')],[_0x1acc('0x62'),'id'])||{})[_0x1acc('0xaf')](function(_0x6ff1ea){for(var _0x1049a4=0x0;_0x1049a4<_0x238c1a['body'][_0x1acc('0x62')][_0x1acc('0x43')];_0x1049a4+=0x1){socket['emit'](_0x1acc('0xb0'),{'UserId':_0x238c1a[_0x1acc('0x57')][_0x1acc('0x62')][_0x1049a4],'FaxAccountId':_0x238c1a['params']['id']});}return _0x6ff1ea;});}})[_0x1acc('0x1c')](respondWithResult(_0x1b49b1,null))[_0x1acc('0x26')](handleError(_0x1b49b1,null));};exports[_0x1acc('0xb1')]=function(_0x1b99a0,_0x1fa7ec,_0x4c5f13){return db['FaxAccount'][_0x1acc('0x55')]({'where':{'id':_0x1b99a0[_0x1acc('0x52')]['id']}})[_0x1acc('0x1c')](handleEntityNotFound(_0x1fa7ec,null))[_0x1acc('0x1c')](function(_0x29a911){if(_0x29a911){return _0x29a911[_0x1acc('0xb1')](_0x1b99a0[_0x1acc('0x3e')][_0x1acc('0x62')])[_0x1acc('0x1c')](function(){if(_[_0x1acc('0xb2')](_0x1b99a0['query'][_0x1acc('0x62')])){for(var _0x4ee274=0x0;_0x4ee274<_0x1b99a0[_0x1acc('0x3e')][_0x1acc('0x62')][_0x1acc('0x43')];_0x4ee274+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x1b99a0[_0x1acc('0x3e')]['ids'][_0x4ee274]),'FaxAccountId':Number(_0x1b99a0[_0x1acc('0x52')]['id'])});}}else{socket[_0x1acc('0xb3')](_0x1acc('0xb4'),{'UserId':Number(_0x1b99a0[_0x1acc('0x3e')][_0x1acc('0x62')]),'FaxAccountId':Number(_0x1b99a0[_0x1acc('0x52')]['id'])});}});}})[_0x1acc('0x1c')](respondWithStatusCode(_0x1fa7ec,null))['catch'](handleError(_0x1fa7ec,null));};exports[_0x1acc('0xb5')]=function(_0x1920a3,_0xc00326,_0x32b0ac){var _0x1757bc={};var _0x274c10={};var _0xa3e49f;var _0x2d5bb1;return db[_0x1acc('0x4d')][_0x1acc('0x5f')]({'where':{'id':_0x1920a3[_0x1acc('0x52')]['id']}})[_0x1acc('0x1c')](handleEntityNotFound(_0xc00326,null))['then'](function(_0x1875c1){if(_0x1875c1){_0xa3e49f=_0x1875c1;_0x274c10[_0x1acc('0x3c')]=_[_0x1acc('0x3f')](db[_0x1acc('0x6e')][_0x1acc('0x53')]);_0x274c10[_0x1acc('0x3e')]=_[_0x1acc('0x3f')](_0x1920a3[_0x1acc('0x3e')]);_0x274c10[_0x1acc('0x49')]=_[_0x1acc('0x40')](_0x274c10[_0x1acc('0x3c')],_0x274c10[_0x1acc('0x3e')]);_0x1757bc[_0x1acc('0x42')]=_[_0x1acc('0x40')](_0x274c10[_0x1acc('0x3c')],qs[_0x1acc('0x41')](_0x1920a3[_0x1acc('0x3e')][_0x1acc('0x41')]));_0x1757bc[_0x1acc('0x42')]=_0x1757bc[_0x1acc('0x42')]['length']?_0x1757bc[_0x1acc('0x42')]:_0x274c10[_0x1acc('0x3c')];_0x1757bc[_0x1acc('0x46')]=qs[_0x1acc('0x47')](_0x1920a3['query'][_0x1acc('0x47')]);_0x1757bc[_0x1acc('0x48')]=qs[_0x1acc('0x49')](_[_0x1acc('0x4a')](_0x1920a3[_0x1acc('0x3e')],_0x274c10[_0x1acc('0x49')]));if(_0x1920a3[_0x1acc('0x3e')][_0x1acc('0x4c')]){_0x1757bc['where']=_[_0x1acc('0x4b')](_0x1757bc[_0x1acc('0x48')],{'$or':_[_0x1acc('0x3d')](_0x1757bc['attributes'],function(_0x4acf2c){var _0x5037d9={};_0x5037d9[_0x4acf2c]={'$like':'%'+_0x1920a3[_0x1acc('0x3e')][_0x1acc('0x4c')]+'%'};return _0x5037d9;})});}_0x1757bc=_[_0x1acc('0x4b')]({},_0x1757bc,_0x1920a3[_0x1acc('0x54')]);return _0xa3e49f['getAgents'](_0x1757bc);}})['then'](function(_0x27fb5a){if(_0x27fb5a){_0x2d5bb1=_0x27fb5a[_0x1acc('0x43')];if(!_0x1920a3[_0x1acc('0x3e')]['hasOwnProperty'](_0x1acc('0x45'))){_0x1757bc['limit']=qs[_0x1acc('0x2c')](_0x1920a3['query'][_0x1acc('0x2c')]);_0x1757bc['offset']=qs[_0x1acc('0x2b')](_0x1920a3['query'][_0x1acc('0x2b')]);}return _0xa3e49f[_0x1acc('0xb5')](_0x1757bc);}})[_0x1acc('0x1c')](function(_0x1ae108){if(_0x1ae108){return _0x1ae108?{'count':_0x2d5bb1,'rows':_0x1ae108}:null;}})[_0x1acc('0x1c')](respondWithResult(_0xc00326,null))['catch'](handleError(_0xc00326,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 1462bab..7b09d9e 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 _0x013d=['../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x013d,0x1a6));var _0xd013=function(_0x3f4027,_0x221cbb){_0x3f4027=_0x3f4027-0x0;var _0x4aea2e=_0x013d[_0x3f4027];return _0x4aea2e;};'use strict';var EventEmitter=require(_0xd013('0x0'));var FaxAccount=require(_0xd013('0x1'))['db'][_0xd013('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xd013('0x3')](0x0);var events={'afterCreate':_0xd013('0x4'),'afterUpdate':_0xd013('0x5'),'afterDestroy':_0xd013('0x6')};function emitEvent(_0x311965){return function(_0x43e7c7,_0x2857e1,_0x3dd0d2){FaxAccountEvents[_0xd013('0x7')](_0x311965+':'+_0x43e7c7['id'],_0x43e7c7);FaxAccountEvents[_0xd013('0x7')](_0x311965,_0x43e7c7);_0x3dd0d2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xd013('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0xbb4c=['setMaxListeners','save','update','emit','hook','events','FaxAccount'];(function(_0xcea3b7,_0x575f2f){var _0x4b17fd=function(_0xc1b3ff){while(--_0xc1b3ff){_0xcea3b7['push'](_0xcea3b7['shift']());}};_0x4b17fd(++_0x575f2f);}(_0xbb4c,0x1c5));var _0xcbb4=function(_0x13657e,_0x52cfdf){_0x13657e=_0x13657e-0x0;var _0x18bf36=_0xbb4c[_0x13657e];return _0x18bf36;};'use strict';var EventEmitter=require(_0xcbb4('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xcbb4('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xcbb4('0x2')](0x0);var events={'afterCreate':_0xcbb4('0x3'),'afterUpdate':_0xcbb4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x592747){return function(_0x235bd9,_0x4e1696,_0x5a5f93){FaxAccountEvents[_0xcbb4('0x5')](_0x592747+':'+_0x235bd9['id'],_0x235bd9);FaxAccountEvents[_0xcbb4('0x5')](_0x592747,_0x235bd9);_0x5a5f93(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xcbb4('0x6')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index d708300..60ede70 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 _0xb42f=['rimraf','../../config/environment','./faxAccount.attributes','exports','define','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x24cb69,_0x213088){var _0x4cdc26=function(_0x4b0553){while(--_0x4b0553){_0x24cb69['push'](_0x24cb69['shift']());}};_0x4cdc26(++_0x213088);}(_0xb42f,0x1c8));var _0xfb42=function(_0x1176d1,_0x57081d){_0x1176d1=_0x1176d1-0x0;var _0xf6768f=_0xb42f[_0x1176d1];return _0xf6768f;};'use strict';var _=require(_0xfb42('0x0'));var util=require('util');var logger=require(_0xfb42('0x1'))(_0xfb42('0x2'));var moment=require(_0xfb42('0x3'));var BPromise=require('bluebird');var rp=require(_0xfb42('0x4'));var fs=require('fs');var path=require(_0xfb42('0x5'));var rimraf=require(_0xfb42('0x6'));var config=require(_0xfb42('0x7'));var attributes=require(_0xfb42('0x8'));module[_0xfb42('0x9')]=function(_0x21ac01,_0x23d4f2){return _0x21ac01[_0xfb42('0xa')]('FaxAccount',attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7a4=['moment','bluebird','path','../../config/environment','./faxAccount.attributes','exports','FaxAccount','fax_accounts','util','../../config/logger','api'];(function(_0x37e244,_0x405f20){var _0x5ba3cc=function(_0x3807e2){while(--_0x3807e2){_0x37e244['push'](_0x37e244['shift']());}};_0x5ba3cc(++_0x405f20);}(_0xa7a4,0xb8));var _0x4a7a=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xa7a4[_0x45783c];return _0x1161da;};'use strict';var _=require('lodash');var util=require(_0x4a7a('0x0'));var logger=require(_0x4a7a('0x1'))(_0x4a7a('0x2'));var moment=require(_0x4a7a('0x3'));var BPromise=require(_0x4a7a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a7a('0x5'));var rimraf=require('rimraf');var config=require(_0x4a7a('0x6'));var attributes=require(_0x4a7a('0x7'));module[_0x4a7a('0x8')]=function(_0x15f55e,_0x730db0){return _0x15f55e['define'](_0x4a7a('0x9'),attributes,{'tableName':_0x4a7a('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 188e346..89df4be 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 _0xc8fd=['waitForTheAssignedAgent','Start','startRouting','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','limit','include','model','attributes','map','stringify','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','Contacts','Applications','List','get','applications','list','orderBy','priority','asc','contact','FaxInteraction','create','Contact\x20not\x20found','spread','autoclose','push','length','close','unmanaged','*,*,*,*','created','interaction','AttachmentId','UserId','agent','name'];(function(_0x5d5b69,_0x1111ab){var _0xf82413=function(_0x3a1f48){while(--_0x3a1f48){_0x5d5b69['push'](_0x5d5b69['shift']());}};_0xf82413(++_0x1111ab);}(_0xc8fd,0x102));var _0xdc8f=function(_0x3b23ed,_0x521eea){_0x3b23ed=_0x3b23ed-0x0;var _0x476f2e=_0xc8fd[_0x3b23ed];return _0x476f2e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdc8f('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc8f('0x1'))['db'];var utils=require(_0xdc8f('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0xdc8f('0x3'));var jayson=require(_0xdc8f('0x4'));var client=jayson[_0xdc8f('0x5')][_0xdc8f('0x6')]({'port':0x232c});config[_0xdc8f('0x7')]=_[_0xdc8f('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdc8f('0x9'))(new Redis(config[_0xdc8f('0x7')]));require(_0xdc8f('0xa'))[_0xdc8f('0xb')](socket);function respondWithRpcPromise(_0x4c1dce,_0x211cf5,_0x5c2728){return new BPromise(function(_0x43a978,_0xe86349){return client['request'](_0x4c1dce,_0x5c2728)[_0xdc8f('0xc')](function(_0xecf6bd){logger[_0xdc8f('0xd')](_0xdc8f('0xe'),_0x211cf5,'request\x20sent');logger['debug'](_0xdc8f('0xf'),_0x211cf5,'request\x20sent',JSON['stringify'](_0xecf6bd));if(_0xecf6bd['error']){if(_0xecf6bd[_0xdc8f('0x10')][_0xdc8f('0x11')]===0x1f4){logger['error'](_0xdc8f('0xe'),_0x211cf5,_0xecf6bd[_0xdc8f('0x10')][_0xdc8f('0x12')]);return _0xe86349(_0xecf6bd[_0xdc8f('0x10')][_0xdc8f('0x12')]);}logger[_0xdc8f('0x10')](_0xdc8f('0xe'),_0x211cf5,_0xecf6bd[_0xdc8f('0x10')][_0xdc8f('0x12')]);return _0x43a978(_0xecf6bd[_0xdc8f('0x10')][_0xdc8f('0x12')]);}else{logger['info'](_0xdc8f('0xe'),_0x211cf5,'request\x20sent');_0x43a978(_0xecf6bd[_0xdc8f('0x13')][_0xdc8f('0x12')]);}})[_0xdc8f('0x14')](function(_0x3e72a0){logger[_0xdc8f('0x10')](_0xdc8f('0xe'),_0x211cf5,_0x3e72a0);_0xe86349(_0x3e72a0);});});}exports[_0xdc8f('0x15')]=function(_0x1c8ab0){var _0x608a50=this;return new Promise(function(_0x4fa768,_0x6dd495){return db[_0xdc8f('0x16')][_0xdc8f('0x17')]({'raw':_0x1c8ab0[_0xdc8f('0x18')]?_0x1c8ab0['options'][_0xdc8f('0x19')]===undefined?!![]:![]:!![],'where':_0x1c8ab0[_0xdc8f('0x18')]?_0x1c8ab0['options'][_0xdc8f('0x1a')]||null:null,'attributes':_0x1c8ab0['options']?_0x1c8ab0['options']['attributes']||null:null,'limit':_0x1c8ab0['options']?_0x1c8ab0[_0xdc8f('0x18')][_0xdc8f('0x1b')]||null:null,'include':_0x1c8ab0[_0xdc8f('0x18')]?_0x1c8ab0[_0xdc8f('0x18')][_0xdc8f('0x1c')]?_['map'](_0x1c8ab0[_0xdc8f('0x18')][_0xdc8f('0x1c')],function(_0x3d91fe){return{'model':db[_0x3d91fe[_0xdc8f('0x1d')]],'as':_0x3d91fe['as'],'attributes':_0x3d91fe[_0xdc8f('0x1e')],'include':_0x3d91fe[_0xdc8f('0x1c')]?_[_0xdc8f('0x1f')](_0x3d91fe[_0xdc8f('0x1c')],function(_0x4d31fc){return{'model':db[_0x4d31fc[_0xdc8f('0x1d')]],'as':_0x4d31fc['as'],'attributes':_0x4d31fc[_0xdc8f('0x1e')],'include':_0x4d31fc['include']?_[_0xdc8f('0x1f')](_0x4d31fc[_0xdc8f('0x1c')],function(_0x44ddb1){return{'model':db[_0x44ddb1[_0xdc8f('0x1d')]],'as':_0x44ddb1['as'],'attributes':_0x44ddb1[_0xdc8f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xdc8f('0xc')](function(_0x11ae3c){logger[_0xdc8f('0xd')](_0xdc8f('0x15'),_0x1c8ab0);logger['debug'](_0xdc8f('0x15'),_0x1c8ab0,JSON[_0xdc8f('0x20')](_0x11ae3c));_0x4fa768(_0x11ae3c);})[_0xdc8f('0x14')](function(_0x52a3f0){logger['error'](_0xdc8f('0x15'),_0x52a3f0[_0xdc8f('0x12')],_0x1c8ab0);_0x6dd495(_0x608a50[_0xdc8f('0x10')](0x1f4,_0x52a3f0[_0xdc8f('0x12')]));});});};exports[_0xdc8f('0x21')]=function(_0xe8436f,_0x31bcc9,_0x20dcd5){var _0x44f16e=this;return new Promise(function(_0x13bd44,_0x3602c9){var _0x3359f9={'body':_0xe8436f[_0xdc8f('0x22')],'channel':_0xdc8f('0x23')};var _0x37ec63=[];var _0x208e0d=[];var _0x2928fd={};return db[_0xdc8f('0x24')][_0xdc8f('0x25')]()[_0xdc8f('0xc')](function(_0x2be6c8){if(!_0x2be6c8){throw new db[(_0xdc8f('0x26'))][(_0xdc8f('0x27'))]('no\x20available\x20attributes');}_0x37ec63=_[_0xdc8f('0x28')](_[_0xdc8f('0x29')](_0x2be6c8),[_0xdc8f('0x2a'),_0xdc8f('0x2b')]);_0x208e0d=_[_0xdc8f('0x28')](_['keys'](_0x2be6c8),[_0xdc8f('0x2a'),'updatedAt',_0xdc8f('0x2c'),_0xdc8f('0x2d')]);if(_0xe8436f[_0xdc8f('0x22')]['id']){delete _0xe8436f[_0xdc8f('0x22')]['id'];}if(_[_0xdc8f('0x2e')](_0xe8436f['body'][_0xdc8f('0x2f')])){throw new db[(_0xdc8f('0x26'))][(_0xdc8f('0x27'))](_0xdc8f('0x30'));}if(_[_0xdc8f('0x2e')](_0xe8436f[_0xdc8f('0x22')]['body'])||_0xe8436f[_0xdc8f('0x22')][_0xdc8f('0x22')]===''){throw new db[(_0xdc8f('0x26'))]['ValidationError'](_0xdc8f('0x31'));}if(_['isNil'](_0xe8436f[_0xdc8f('0x22')][_0xdc8f('0x32')])){throw new db[(_0xdc8f('0x26'))][(_0xdc8f('0x27'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x208e0d);}if(!_[_0xdc8f('0x33')](_0x208e0d,_0xe8436f[_0xdc8f('0x22')][_0xdc8f('0x32')])){throw new db['Sequelize'][(_0xdc8f('0x27'))](_0xdc8f('0x34')+_0x208e0d);}_0x2928fd[_0xe8436f[_0xdc8f('0x22')][_0xdc8f('0x32')]]=_0xe8436f[_0xdc8f('0x22')]['from'];})[_0xdc8f('0xc')](function(){return db['FaxAccount'][_0xdc8f('0x35')]({'where':{'id':_0xe8436f[_0xdc8f('0x36')]['id']},'include':[{'model':db[_0xdc8f('0x37')],'as':'List','include':[{'model':db[_0xdc8f('0x24')],'as':_0xdc8f('0x38'),'where':_0x2928fd,'limit':0x1,'order':[[_0xdc8f('0x2b'),'DESC']]}]},{'model':db['FaxApplication'],'as':_0xdc8f('0x39')}]});})[_0xdc8f('0xc')](function(_0x526382){if(_0x526382&&_0x526382[_0xdc8f('0x3a')]){var _0x1528d9=_0x526382[_0xdc8f('0x3b')]({'plain':!![]});_0x3359f9['account']=_0x1528d9;_0x3359f9[_0xdc8f('0x3c')]=_0x1528d9[_0xdc8f('0x39')];_0x3359f9[_0xdc8f('0x3d')]=_0x1528d9[_0xdc8f('0x3a')];_0x3359f9['applications']=_[_0xdc8f('0x3e')](_0x3359f9[_0xdc8f('0x3c')],[_0xdc8f('0x3f')],[_0xdc8f('0x40')]);if(_0x3359f9[_0xdc8f('0x36')][_0xdc8f('0x39')]){delete _0x3359f9['account'][_0xdc8f('0x39')];}if(_0x3359f9[_0xdc8f('0x36')][_0xdc8f('0x3a')]&&_0x3359f9[_0xdc8f('0x36')][_0xdc8f('0x3a')]['Contacts']['length']){return _0x3359f9[_0xdc8f('0x36')][_0xdc8f('0x3a')][_0xdc8f('0x38')][0x0];}var _0x1b7cdc=_[_0xdc8f('0x8')](_0xe8436f[_0xdc8f('0x22')],{'firstName':_0xe8436f[_0xdc8f('0x22')][_0xdc8f('0x2f')],'ListId':_0x1528d9[_0xdc8f('0x2d')]});_0x1b7cdc[_0xe8436f[_0xdc8f('0x22')][_0xdc8f('0x32')]]=_0xe8436f[_0xdc8f('0x22')][_0xdc8f('0x2f')];return db['CmContact']['create'](_0x1b7cdc,{'fields':_0x37ec63,'raw':!![]});}})[_0xdc8f('0xc')](function(_0x14a560){_0x3359f9[_0xdc8f('0x41')]=_0x14a560;if(_0x14a560){var _0x325191={'ContactId':_0x14a560['id'],'FaxAccountId':_0xe8436f[_0xdc8f('0x36')]['id'],'fax':_0x14a560[_0xdc8f('0x23')]};return db[_0xdc8f('0x42')]['find']({'where':{'ContactId':_0x14a560['id'],'closed':![],'FaxAccountId':_0xe8436f[_0xdc8f('0x36')]['id']}})[_0xdc8f('0xc')](function(_0x48546b){if(_0x48546b){return[_0x48546b,![]];}return db[_0xdc8f('0x42')][_0xdc8f('0x43')](_0x325191)['then'](function(_0x2dc4f7){return[_0x2dc4f7,!![]];});});}else{throw new Error(_0xdc8f('0x44'));}})[_0xdc8f('0x45')](function(_0x17f39f,_0x938b76){var _0x421e78=_0x17f39f[_0xdc8f('0x3b')]({'plain':!![]});if(_0x938b76){if(_0x3359f9['account'][_0xdc8f('0x46')]){_0x3359f9[_0xdc8f('0x3c')][_0xdc8f('0x47')]({'id':0x0,'priority':_0x3359f9[_0xdc8f('0x3c')][_0xdc8f('0x48')]+0x1,'app':_0xdc8f('0x49'),'appdata':_0xdc8f('0x4a'),'interval':_0xdc8f('0x4b')});}_0x421e78['created']=!![];}else{_0x421e78[_0xdc8f('0x4c')]=![];}_0x3359f9[_0xdc8f('0x4d')]=_0x421e78;return db['FaxMessage'][_0xdc8f('0x43')]({'body':_0xe8436f[_0xdc8f('0x22')][_0xdc8f('0x22')],'FaxAccountId':_0xe8436f[_0xdc8f('0x36')]['id'],'FaxInteractionId':_0x17f39f['id'],'direction':'in','ContactId':_0x17f39f['ContactId'],'AttachmentId':_0xe8436f[_0xdc8f('0x22')][_0xdc8f('0x4e')]});})[_0xdc8f('0xc')](function(_0x3d0201){_0x3359f9['message']=_0x3d0201;if(_0x3359f9[_0xdc8f('0x4d')][_0xdc8f('0x4f')]){return db['User'][_0xdc8f('0x35')]({'attributes':['id','name'],'where':{'id':_0x3359f9[_0xdc8f('0x4d')]['UserId']}})[_0xdc8f('0xc')](function(_0x177a12){if(_0x177a12){_0x3359f9[_0xdc8f('0x3c')]['unshift']({'id':0x0,'priority':0x0,'app':_0xdc8f('0x50'),'appdata':_0x177a12[_0xdc8f('0x51')]+','+(_0x3359f9[_0xdc8f('0x36')][_0xdc8f('0x52')]||0xa),'interval':_0xdc8f('0x4b')});}return respondWithRpcPromise(_0xdc8f('0x53'),_0xdc8f('0x54'),_0x3359f9);});}return respondWithRpcPromise(_0xdc8f('0x53'),_0xdc8f('0x54'),_0x3359f9);})[_0xdc8f('0xc')](function(_0x11ef2b){_0x13bd44(_0x11ef2b);})[_0xdc8f('0x14')](function(_0x39fce6){_0x3602c9(_0x44f16e[_0xdc8f('0x10')](0x1f4,_0x39fce6[_0xdc8f('0x12')]));});});}; \ No newline at end of file +var _0x0ead=['catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','include','map','model','body','fax','CmContact','describe','Sequelize','keys','createdAt','updatedAt','difference','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','List','Contacts','FaxApplication','get','account','applications','Applications','list','orderBy','priority','asc','length','defaults','ListId','create','FaxInteraction','Contact\x20not\x20found','push','close','unmanaged','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','info','result'];(function(_0x21f9fc,_0x33b8f2){var _0x1b5af9=function(_0x506f67){while(--_0x506f67){_0x21f9fc['push'](_0x21f9fc['shift']());}};_0x1b5af9(++_0x33b8f2);}(_0x0ead,0x1a1));var _0xd0ea=function(_0x34f369,_0x5d537f){_0x34f369=_0x34f369-0x0;var _0x39a295=_0x0ead[_0x34f369];return _0x39a295;};'use strict';var _=require(_0xd0ea('0x0'));var util=require('util');var moment=require(_0xd0ea('0x1'));var BPromise=require(_0xd0ea('0x2'));var rs=require(_0xd0ea('0x3'));var fs=require('fs');var Redis=require(_0xd0ea('0x4'));var db=require(_0xd0ea('0x5'))['db'];var utils=require(_0xd0ea('0x6'));var logger=require('../../config/logger')(_0xd0ea('0x7'));var config=require(_0xd0ea('0x8'));var jayson=require(_0xd0ea('0x9'));var client=jayson['client'][_0xd0ea('0xa')]({'port':0x232c});config[_0xd0ea('0xb')]=_['defaults'](config[_0xd0ea('0xb')],{'host':_0xd0ea('0xc'),'port':0x18eb});var socket=require(_0xd0ea('0xd'))(new Redis(config[_0xd0ea('0xb')]));require(_0xd0ea('0xe'))[_0xd0ea('0xf')](socket);function respondWithRpcPromise(_0x3a239c,_0x560161,_0x42491){return new BPromise(function(_0x1568fa,_0x5c7b0b){return client[_0xd0ea('0x10')](_0x3a239c,_0x42491)[_0xd0ea('0x11')](function(_0x819e2b){logger['info']('FaxAccount,\x20%s,\x20%s',_0x560161,_0xd0ea('0x12'));logger[_0xd0ea('0x13')](_0xd0ea('0x14'),_0x560161,_0xd0ea('0x12'),JSON[_0xd0ea('0x15')](_0x819e2b));if(_0x819e2b[_0xd0ea('0x16')]){if(_0x819e2b[_0xd0ea('0x16')][_0xd0ea('0x17')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x560161,_0x819e2b[_0xd0ea('0x16')][_0xd0ea('0x18')]);return _0x5c7b0b(_0x819e2b[_0xd0ea('0x16')]['message']);}logger[_0xd0ea('0x16')](_0xd0ea('0x19'),_0x560161,_0x819e2b[_0xd0ea('0x16')][_0xd0ea('0x18')]);return _0x1568fa(_0x819e2b[_0xd0ea('0x16')][_0xd0ea('0x18')]);}else{logger[_0xd0ea('0x1a')](_0xd0ea('0x19'),_0x560161,_0xd0ea('0x12'));_0x1568fa(_0x819e2b[_0xd0ea('0x1b')][_0xd0ea('0x18')]);}})[_0xd0ea('0x1c')](function(_0x2fd250){logger[_0xd0ea('0x16')](_0xd0ea('0x19'),_0x560161,_0x2fd250);_0x5c7b0b(_0x2fd250);});});}exports[_0xd0ea('0x1d')]=function(_0x465777){var _0x3fca0b=this;return new Promise(function(_0x19e955,_0x1662d8){return db[_0xd0ea('0x1e')]['findAll']({'raw':_0x465777['options']?_0x465777[_0xd0ea('0x1f')][_0xd0ea('0x20')]===undefined?!![]:![]:!![],'where':_0x465777[_0xd0ea('0x1f')]?_0x465777[_0xd0ea('0x1f')][_0xd0ea('0x21')]||null:null,'attributes':_0x465777['options']?_0x465777['options'][_0xd0ea('0x22')]||null:null,'limit':_0x465777[_0xd0ea('0x1f')]?_0x465777[_0xd0ea('0x1f')][_0xd0ea('0x23')]||null:null,'include':_0x465777[_0xd0ea('0x1f')]?_0x465777[_0xd0ea('0x1f')][_0xd0ea('0x24')]?_[_0xd0ea('0x25')](_0x465777[_0xd0ea('0x1f')][_0xd0ea('0x24')],function(_0x43eec4){return{'model':db[_0x43eec4[_0xd0ea('0x26')]],'as':_0x43eec4['as'],'attributes':_0x43eec4[_0xd0ea('0x22')],'include':_0x43eec4[_0xd0ea('0x24')]?_[_0xd0ea('0x25')](_0x43eec4[_0xd0ea('0x24')],function(_0x3211dd){return{'model':db[_0x3211dd[_0xd0ea('0x26')]],'as':_0x3211dd['as'],'attributes':_0x3211dd[_0xd0ea('0x22')],'include':_0x3211dd[_0xd0ea('0x24')]?_['map'](_0x3211dd['include'],function(_0x25f032){return{'model':db[_0x25f032[_0xd0ea('0x26')]],'as':_0x25f032['as'],'attributes':_0x25f032[_0xd0ea('0x22')]};}):[]};}):[]};}):[]:[]})[_0xd0ea('0x11')](function(_0x16c6e3){logger[_0xd0ea('0x1a')](_0xd0ea('0x1d'),_0x465777);logger[_0xd0ea('0x13')](_0xd0ea('0x1d'),_0x465777,JSON[_0xd0ea('0x15')](_0x16c6e3));_0x19e955(_0x16c6e3);})['catch'](function(_0x32adf6){logger['error']('GetFaxAccount',_0x32adf6[_0xd0ea('0x18')],_0x465777);_0x1662d8(_0x3fca0b[_0xd0ea('0x16')](0x1f4,_0x32adf6[_0xd0ea('0x18')]));});});};exports['NotifyFaxAccount']=function(_0x556877,_0x4ccf32,_0x1d359a){var _0x495c90=this;return new Promise(function(_0x4e744c,_0x19d9e6){var _0x32efca={'body':_0x556877[_0xd0ea('0x27')],'channel':_0xd0ea('0x28')};var _0x45d738=[];var _0x17b34f=[];var _0x2c9410={};return db[_0xd0ea('0x29')][_0xd0ea('0x2a')]()[_0xd0ea('0x11')](function(_0x21f290){if(!_0x21f290){throw new db[(_0xd0ea('0x2b'))]['ValidationError']('no\x20available\x20attributes');}_0x45d738=_['difference'](_[_0xd0ea('0x2c')](_0x21f290),[_0xd0ea('0x2d'),_0xd0ea('0x2e')]);_0x17b34f=_[_0xd0ea('0x2f')](_['keys'](_0x21f290),[_0xd0ea('0x2d'),'updatedAt','CompanyId','ListId']);if(_0x556877['body']['id']){delete _0x556877[_0xd0ea('0x27')]['id'];}if(_[_0xd0ea('0x30')](_0x556877[_0xd0ea('0x27')][_0xd0ea('0x31')])){throw new db[(_0xd0ea('0x2b'))]['ValidationError'](_0xd0ea('0x32'));}if(_[_0xd0ea('0x30')](_0x556877[_0xd0ea('0x27')][_0xd0ea('0x27')])||_0x556877[_0xd0ea('0x27')]['body']===''){throw new db[(_0xd0ea('0x2b'))]['ValidationError'](_0xd0ea('0x33'));}if(_['isNil'](_0x556877[_0xd0ea('0x27')][_0xd0ea('0x34')])){throw new db[(_0xd0ea('0x2b'))][(_0xd0ea('0x35'))](_0xd0ea('0x36')+_0x17b34f);}if(!_[_0xd0ea('0x37')](_0x17b34f,_0x556877['body'][_0xd0ea('0x34')])){throw new db['Sequelize'][(_0xd0ea('0x35'))](_0xd0ea('0x38')+_0x17b34f);}_0x2c9410[_0x556877[_0xd0ea('0x27')]['mapKey']]=_0x556877['body'][_0xd0ea('0x31')];})[_0xd0ea('0x11')](function(){return db['FaxAccount'][_0xd0ea('0x39')]({'where':{'id':_0x556877['account']['id']},'include':[{'model':db['CmList'],'as':_0xd0ea('0x3a'),'include':[{'model':db['CmContact'],'as':_0xd0ea('0x3b'),'where':_0x2c9410,'limit':0x1,'order':[[_0xd0ea('0x2e'),'DESC']]}]},{'model':db[_0xd0ea('0x3c')],'as':'Applications'}]});})[_0xd0ea('0x11')](function(_0x50381b){if(_0x50381b&&_0x50381b['List']){var _0x401768=_0x50381b[_0xd0ea('0x3d')]({'plain':!![]});_0x32efca[_0xd0ea('0x3e')]=_0x401768;_0x32efca[_0xd0ea('0x3f')]=_0x401768[_0xd0ea('0x40')];_0x32efca[_0xd0ea('0x41')]=_0x401768[_0xd0ea('0x3a')];_0x32efca['applications']=_[_0xd0ea('0x42')](_0x32efca[_0xd0ea('0x3f')],[_0xd0ea('0x43')],[_0xd0ea('0x44')]);if(_0x32efca[_0xd0ea('0x3e')][_0xd0ea('0x40')]){delete _0x32efca[_0xd0ea('0x3e')]['Applications'];}if(_0x32efca[_0xd0ea('0x3e')][_0xd0ea('0x3a')]&&_0x32efca[_0xd0ea('0x3e')][_0xd0ea('0x3a')]['Contacts'][_0xd0ea('0x45')]){return _0x32efca[_0xd0ea('0x3e')][_0xd0ea('0x3a')][_0xd0ea('0x3b')][0x0];}var _0x4fd51a=_[_0xd0ea('0x46')](_0x556877['body'],{'firstName':_0x556877[_0xd0ea('0x27')]['from'],'ListId':_0x401768[_0xd0ea('0x47')]});_0x4fd51a[_0x556877[_0xd0ea('0x27')]['mapKey']]=_0x556877[_0xd0ea('0x27')]['from'];return db['CmContact'][_0xd0ea('0x48')](_0x4fd51a,{'fields':_0x45d738,'raw':!![]});}})[_0xd0ea('0x11')](function(_0x328af9){_0x32efca['contact']=_0x328af9;if(_0x328af9){var _0x7976cd={'ContactId':_0x328af9['id'],'FaxAccountId':_0x556877[_0xd0ea('0x3e')]['id'],'fax':_0x328af9[_0xd0ea('0x28')]};return db[_0xd0ea('0x49')][_0xd0ea('0x39')]({'where':{'ContactId':_0x328af9['id'],'closed':![],'FaxAccountId':_0x556877['account']['id']}})[_0xd0ea('0x11')](function(_0x20ab48){if(_0x20ab48){return[_0x20ab48,![]];}return db[_0xd0ea('0x49')][_0xd0ea('0x48')](_0x7976cd)[_0xd0ea('0x11')](function(_0x4536e2){return[_0x4536e2,!![]];});});}else{throw new Error(_0xd0ea('0x4a'));}})['spread'](function(_0xe5530b,_0x124907){var _0x4875f3=_0xe5530b['get']({'plain':!![]});if(_0x124907){if(_0x32efca[_0xd0ea('0x3e')]['autoclose']){_0x32efca[_0xd0ea('0x3f')][_0xd0ea('0x4b')]({'id':0x0,'priority':_0x32efca[_0xd0ea('0x3f')]['length']+0x1,'app':_0xd0ea('0x4c'),'appdata':_0xd0ea('0x4d'),'interval':_0xd0ea('0x4e')});}_0x4875f3[_0xd0ea('0x4f')]=!![];}else{_0x4875f3[_0xd0ea('0x4f')]=![];}_0x32efca[_0xd0ea('0x50')]=_0x4875f3;return db['FaxMessage'][_0xd0ea('0x48')]({'body':_0x556877[_0xd0ea('0x27')]['body'],'FaxAccountId':_0x556877['account']['id'],'FaxInteractionId':_0xe5530b['id'],'direction':'in','ContactId':_0xe5530b[_0xd0ea('0x51')],'AttachmentId':_0x556877[_0xd0ea('0x27')][_0xd0ea('0x52')]});})[_0xd0ea('0x11')](function(_0x1b4799){_0x32efca[_0xd0ea('0x18')]=_0x1b4799;if(_0x32efca[_0xd0ea('0x50')][_0xd0ea('0x53')]){return db['User']['find']({'attributes':['id',_0xd0ea('0x54')],'where':{'id':_0x32efca[_0xd0ea('0x50')][_0xd0ea('0x53')]}})[_0xd0ea('0x11')](function(_0x2495c9){if(_0x2495c9){_0x32efca[_0xd0ea('0x3f')][_0xd0ea('0x55')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2495c9[_0xd0ea('0x54')]+','+(_0x32efca[_0xd0ea('0x3e')][_0xd0ea('0x56')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xd0ea('0x57'),_0xd0ea('0x58'),_0x32efca);});}return respondWithRpcPromise(_0xd0ea('0x57'),_0xd0ea('0x58'),_0x32efca);})['then'](function(_0x237ddc){_0x4e744c(_0x237ddc);})[_0xd0ea('0x1c')](function(_0x1459e5){_0x19d9e6(_0x495c90['error'](0x1f4,_0x1459e5['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 08d7bf8..9281035 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 _0xc2c7=['register','faxAccount:','save','remove','update','emit'];(function(_0x582dbf,_0x52d549){var _0x390120=function(_0x2347ea){while(--_0x2347ea){_0x582dbf['push'](_0x582dbf['shift']());}};_0x390120(++_0x52d549);}(_0xc2c7,0x134));var _0x7c2c=function(_0x26a5c3,_0x2936c1){_0x26a5c3=_0x26a5c3-0x0;var _0x4be041=_0xc2c7[_0x26a5c3];return _0x4be041;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x7c2c('0x0'),_0x7c2c('0x1'),_0x7c2c('0x2')];function createListener(_0x330870,_0x380d13){return function(_0x237e4d){_0x380d13[_0x7c2c('0x3')](_0x330870,_0x237e4d);};}function removeListener(_0x116f8a,_0x4bbc14){return function(){FaxAccountEvents['removeListener'](_0x116f8a,_0x4bbc14);};}exports[_0x7c2c('0x4')]=function(_0x42ecc9){for(var _0x23c038=0x0,_0x54f027=events['length'];_0x23c038<_0x54f027;_0x23c038++){var _0x5a1027=events[_0x23c038];var _0x2274cd=createListener(_0x7c2c('0x5')+_0x5a1027,_0x42ecc9);FaxAccountEvents['on'](_0x5a1027,_0x2274cd);}}; \ No newline at end of file +var _0x5f66=['length','faxAccount:','save','update','emit','register'];(function(_0x5af0e2,_0x117efe){var _0x14ecdc=function(_0x2636d8){while(--_0x2636d8){_0x5af0e2['push'](_0x5af0e2['shift']());}};_0x14ecdc(++_0x117efe);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';var FaxAccountEvents=require('./faxAccount.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(){FaxAccountEvents['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);FaxAccountEvents['on'](_0x2c6571,_0x112079);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 850cb8b..caad62e 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 _0xf52f=['create','addDisposition','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','send','/:id/users','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','post'];(function(_0x193588,_0x1170eb){var _0x9b33e4=function(_0x261e69){while(--_0x261e69){_0x193588['push'](_0x193588['shift']());}};_0x9b33e4(++_0x1170eb);}(_0xf52f,0x1d4));var _0xff52=function(_0x2668e1,_0x8d2cc0){_0x2668e1=_0x2668e1-0x0;var _0x45ceb0=_0xf52f[_0x2668e1];return _0x45ceb0;};'use strict';var multer=require(_0xff52('0x0'));var util=require('util');var path=require(_0xff52('0x1'));var timeout=require(_0xff52('0x2'));var express=require(_0xff52('0x3'));var router=express[_0xff52('0x4')]();var auth=require(_0xff52('0x5'));var interaction=require(_0xff52('0x6'));var config=require(_0xff52('0x7'));var controller=require(_0xff52('0x8'));router[_0xff52('0x9')]('/',auth['isAuthenticated'](),controller[_0xff52('0xa')]);router['get'](_0xff52('0xb'),auth[_0xff52('0xc')](),controller[_0xff52('0xd')]);router[_0xff52('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xff52('0xe')]);router[_0xff52('0x9')](_0xff52('0xf'),auth[_0xff52('0xc')](),controller[_0xff52('0x10')]);router[_0xff52('0x9')](_0xff52('0x11'),auth['isAuthenticated'](),controller[_0xff52('0x12')]);router[_0xff52('0x9')](_0xff52('0x13'),auth[_0xff52('0xc')](),controller[_0xff52('0x14')]);router['get'](_0xff52('0x15'),auth[_0xff52('0xc')](),controller[_0xff52('0x16')]);router[_0xff52('0x9')](_0xff52('0x17'),auth[_0xff52('0xc')](),controller[_0xff52('0x18')]);router[_0xff52('0x9')]('/:id/users',auth[_0xff52('0xc')](),controller[_0xff52('0x19')]);router[_0xff52('0x1a')]('/',auth[_0xff52('0xc')](),controller[_0xff52('0x1b')]);router[_0xff52('0x1a')](_0xff52('0xf'),auth['isAuthenticated'](),controller[_0xff52('0x1c')]);router[_0xff52('0x1a')](_0xff52('0x11'),auth[_0xff52('0xc')](),controller['addAnswer']);router[_0xff52('0x1a')](_0xff52('0x13'),auth[_0xff52('0xc')](),controller[_0xff52('0x1d')]);router['post'](_0xff52('0x15'),auth[_0xff52('0xc')](),controller[_0xff52('0x1e')]);router[_0xff52('0x1a')](_0xff52('0x1f'),auth[_0xff52('0xc')](),controller[_0xff52('0x20')]);router[_0xff52('0x1a')](_0xff52('0x21'),auth[_0xff52('0xc')](),controller[_0xff52('0x22')]);router[_0xff52('0x1a')]('/:id/send',auth[_0xff52('0xc')](),controller[_0xff52('0x23')]);router['post'](_0xff52('0x24'),auth[_0xff52('0xc')](),controller['addAgents']);router['put'](_0xff52('0x25'),auth[_0xff52('0xc')](),controller[_0xff52('0x26')]);router[_0xff52('0x27')]('/:id',auth['isAuthenticated'](),controller[_0xff52('0x28')]);router['delete'](_0xff52('0xf'),auth[_0xff52('0xc')](),controller[_0xff52('0x29')]);router[_0xff52('0x27')](_0xff52('0x11'),auth[_0xff52('0xc')](),controller[_0xff52('0x2a')]);router['delete'](_0xff52('0x24'),auth[_0xff52('0xc')](),controller[_0xff52('0x2b')]);module[_0xff52('0x2c')]=router; \ No newline at end of file +var _0x4789=['multer','util','path','Router','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','/:id/messages','/:id/users','getAgents','post','create','addDisposition','addAnswer','addApplications','/addaccountapplications','/updateaccountapplications','send','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports'];(function(_0x28e611,_0xbe9d05){var _0x1aded1=function(_0x4bba67){while(--_0x4bba67){_0x28e611['push'](_0x28e611['shift']());}};_0x1aded1(++_0xbe9d05);}(_0x4789,0x17c));var _0x9478=function(_0x55c1f0,_0x4f574f){_0x55c1f0=_0x55c1f0-0x0;var _0x1530fa=_0x4789[_0x55c1f0];return _0x1530fa;};'use strict';var multer=require(_0x9478('0x0'));var util=require(_0x9478('0x1'));var path=require(_0x9478('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9478('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9478('0x4'));var config=require(_0x9478('0x5'));var controller=require(_0x9478('0x6'));router[_0x9478('0x7')]('/',auth[_0x9478('0x8')](),controller[_0x9478('0x9')]);router[_0x9478('0x7')]('/describe',auth[_0x9478('0x8')](),controller[_0x9478('0xa')]);router[_0x9478('0x7')](_0x9478('0xb'),auth['isAuthenticated'](),controller[_0x9478('0xc')]);router[_0x9478('0x7')](_0x9478('0xd'),auth[_0x9478('0x8')](),controller[_0x9478('0xe')]);router['get'](_0x9478('0xf'),auth[_0x9478('0x8')](),controller[_0x9478('0x10')]);router['get'](_0x9478('0x11'),auth[_0x9478('0x8')](),controller['getInteractions']);router['get'](_0x9478('0x12'),auth[_0x9478('0x8')](),controller['getApplications']);router[_0x9478('0x7')](_0x9478('0x13'),auth['isAuthenticated'](),controller['getMessages']);router[_0x9478('0x7')](_0x9478('0x14'),auth[_0x9478('0x8')](),controller[_0x9478('0x15')]);router[_0x9478('0x16')]('/',auth[_0x9478('0x8')](),controller[_0x9478('0x17')]);router[_0x9478('0x16')]('/:id/dispositions',auth[_0x9478('0x8')](),controller[_0x9478('0x18')]);router[_0x9478('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x9478('0x19')]);router['post'](_0x9478('0x11'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x9478('0x16')](_0x9478('0x12'),auth[_0x9478('0x8')](),controller[_0x9478('0x1a')]);router[_0x9478('0x16')](_0x9478('0x1b'),auth[_0x9478('0x8')](),controller['addAccountApplications']);router[_0x9478('0x16')](_0x9478('0x1c'),auth[_0x9478('0x8')](),controller['updateAccountApplications']);router[_0x9478('0x16')]('/:id/send',auth[_0x9478('0x8')](),controller[_0x9478('0x1d')]);router['post'](_0x9478('0x14'),auth[_0x9478('0x8')](),controller[_0x9478('0x1e')]);router[_0x9478('0x1f')]('/:id',auth[_0x9478('0x8')](),controller[_0x9478('0x20')]);router[_0x9478('0x21')](_0x9478('0xb'),auth[_0x9478('0x8')](),controller[_0x9478('0x22')]);router[_0x9478('0x21')]('/:id/dispositions',auth[_0x9478('0x8')](),controller[_0x9478('0x23')]);router[_0x9478('0x21')]('/:id/canned_answers',auth[_0x9478('0x8')](),controller['removeAnswers']);router['delete'](_0x9478('0x14'),auth[_0x9478('0x8')](),controller[_0x9478('0x24')]);module[_0x9478('0x25')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index c0338b6..471d653 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 _0xed0b=['*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x4232ba,_0x2161da){var _0x2f3525=function(_0x5e5c23){while(--_0x5e5c23){_0x4232ba['push'](_0x4232ba['shift']());}};_0x2f3525(++_0x2161da);}(_0xed0b,0x15f));var _0xbed0=function(_0x4f5108,_0x46a54b){_0x4f5108=_0x4f5108-0x0;var _0x2d56ca=_0xed0b[_0x4f5108];return _0x2d56ca;};'use strict';var Sequelize=require(_0xbed0('0x0'));module['exports']={'priority':{'type':Sequelize[_0xbed0('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xbed0('0x2')],'allowNull':![],'defaultValue':_0xbed0('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xbed0('0x4')}}; \ No newline at end of file +var _0x77a9=['INTEGER','noop','TEXT','STRING','sequelize'];(function(_0x351509,_0x54725c){var _0x4e9861=function(_0x54f92c){while(--_0x54f92c){_0x351509['push'](_0x351509['shift']());}};_0x4e9861(++_0x54725c);}(_0x77a9,0x19e));var _0x977a=function(_0x38c178,_0x336c72){_0x38c178=_0x38c178-0x0;var _0x1beb1c=_0x77a9[_0x38c178];return _0x1beb1c;};'use strict';var Sequelize=require(_0x977a('0x0'));module['exports']={'priority':{'type':Sequelize[_0x977a('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x977a('0x2')},'appdata':{'type':Sequelize[_0x977a('0x3')]()},'description':{'type':Sequelize[_0x977a('0x4')]},'interval':{'type':Sequelize[_0x977a('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 6fd6d71..25cbb8b 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 _0x2263=['destroy','then','end','sendStatus','error','name','index','map','FaxApplication','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','options','includeAll','findAll','catch','show','params','keys','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','count','offset','limit','apply','reject','save','update'];(function(_0x76ced3,_0x8abc01){var _0x4fea70=function(_0x519c04){while(--_0x519c04){_0x76ced3['push'](_0x76ced3['shift']());}};_0x4fea70(++_0x8abc01);}(_0x2263,0x6e));var _0x3226=function(_0x257017,_0x330627){_0x257017=_0x257017-0x0;var _0x38536d=_0x2263[_0x257017];return _0x38536d;};'use strict';var pdf=require(_0x3226('0x0'));var emlformat=require(_0x3226('0x1'));var rimraf=require(_0x3226('0x2'));var zipdir=require(_0x3226('0x3'));var jsonpatch=require(_0x3226('0x4'));var rp=require(_0x3226('0x5'));var moment=require(_0x3226('0x6'));var BPromise=require(_0x3226('0x7'));var Mustache=require('mustache');var util=require(_0x3226('0x8'));var path=require(_0x3226('0x9'));var sox=require(_0x3226('0xa'));var csv=require(_0x3226('0xb'));var ejs=require(_0x3226('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3226('0xd'));var crypto=require(_0x3226('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3226('0xb'));var querystring=require(_0x3226('0xf'));var Papa=require('papaparse');var Redis=require(_0x3226('0x10'));var authService=require(_0x3226('0x11'));var qs=require(_0x3226('0x12'));var as=require(_0x3226('0x13'));var hardwareService=require(_0x3226('0x14'));var logger=require(_0x3226('0x15'))(_0x3226('0x16'));var utils=require('../../config/utils');var config=require(_0x3226('0x17'));var db=require(_0x3226('0x18'))['db'];function respondWithStatusCode(_0x187897,_0x58aed4){_0x58aed4=_0x58aed4||0xcc;return function(_0x4e7fab){if(_0x4e7fab){return _0x187897['sendStatus'](_0x58aed4);}return _0x187897['status'](_0x58aed4)['end']();};}function respondWithResult(_0x51db46,_0x24ffc4){_0x24ffc4=_0x24ffc4||0xc8;return function(_0x425030){if(_0x425030){return _0x51db46[_0x3226('0x19')](_0x24ffc4)[_0x3226('0x1a')](_0x425030);}};}function respondWithFilteredResult(_0x56d64c,_0x5b5c77){return function(_0x2808e5){if(_0x2808e5){var _0xfc7cb5=_0x2808e5[_0x3226('0x1b')],_0x86bb0f=_0x5b5c77[_0x3226('0x1c')],_0x5eb4a8=_0x5b5c77[_0x3226('0x1c')]+_0x5b5c77[_0x3226('0x1d')],_0x2fd0e5;if(_0x5eb4a8>=_0xfc7cb5){_0x5eb4a8=_0xfc7cb5;_0x2fd0e5=0xc8;}else{_0x2fd0e5=0xce;}_0x56d64c[_0x3226('0x19')](_0x2fd0e5);return _0x56d64c['set']('Content-Range',_0x86bb0f+'-'+_0x5eb4a8+'/'+_0xfc7cb5)[_0x3226('0x1a')](_0x2808e5);}return null;};}function patchUpdates(_0x5ac619){return function(_0x371bf6){try{jsonpatch[_0x3226('0x1e')](_0x371bf6,_0x5ac619,!![]);}catch(_0x1210ec){return BPromise[_0x3226('0x1f')](_0x1210ec);}return _0x371bf6[_0x3226('0x20')]();};}function saveUpdates(_0x1318a2,_0x4d4cd8){return function(_0x2b4d38){if(_0x2b4d38){return _0x2b4d38[_0x3226('0x21')](_0x1318a2)['then'](function(_0x411f2e){return _0x411f2e;});}return null;};}function removeEntity(_0x337884,_0x146362){return function(_0x4eb7a9){if(_0x4eb7a9){return _0x4eb7a9[_0x3226('0x22')]()[_0x3226('0x23')](function(){_0x337884[_0x3226('0x19')](0xcc)[_0x3226('0x24')]();});}};}function handleEntityNotFound(_0x3191f8,_0x1109b7){return function(_0x29be67){if(!_0x29be67){_0x3191f8[_0x3226('0x25')](0x194);}return _0x29be67;};}function handleError(_0x5850c9,_0x45fc39){_0x45fc39=_0x45fc39||0x1f4;return function(_0x5d4684){logger[_0x3226('0x26')](_0x5d4684['stack']);if(_0x5d4684[_0x3226('0x27')]){delete _0x5d4684['name'];}_0x5850c9[_0x3226('0x19')](_0x45fc39)['send'](_0x5d4684);};}exports[_0x3226('0x28')]=function(_0x11246e,_0x553639){var _0x41377c={},_0x366e71={},_0x3a4af0={'count':0x0,'rows':[]};var _0x3b44d0=_[_0x3226('0x29')](db[_0x3226('0x2a')][_0x3226('0x2b')],function(_0x4b9174){return{'name':_0x4b9174[_0x3226('0x2c')],'type':_0x4b9174['type'][_0x3226('0x2d')]};});_0x366e71[_0x3226('0x2e')]=_[_0x3226('0x29')](_0x3b44d0,'name');_0x366e71[_0x3226('0x2f')]=_['keys'](_0x11246e['query']);_0x366e71[_0x3226('0x30')]=_[_0x3226('0x31')](_0x366e71[_0x3226('0x2e')],_0x366e71[_0x3226('0x2f')]);_0x41377c[_0x3226('0x32')]=_[_0x3226('0x31')](_0x366e71[_0x3226('0x2e')],qs[_0x3226('0x33')](_0x11246e[_0x3226('0x2f')]['fields']));_0x41377c[_0x3226('0x32')]=_0x41377c[_0x3226('0x32')][_0x3226('0x34')]?_0x41377c[_0x3226('0x32')]:_0x366e71[_0x3226('0x2e')];if(!_0x11246e[_0x3226('0x2f')][_0x3226('0x35')](_0x3226('0x36'))){_0x41377c[_0x3226('0x1d')]=qs[_0x3226('0x1d')](_0x11246e[_0x3226('0x2f')][_0x3226('0x1d')]);_0x41377c[_0x3226('0x1c')]=qs[_0x3226('0x1c')](_0x11246e['query']['offset']);}_0x41377c[_0x3226('0x37')]=qs['sort'](_0x11246e[_0x3226('0x2f')]['sort']);_0x41377c[_0x3226('0x38')]=qs[_0x3226('0x30')](_[_0x3226('0x39')](_0x11246e[_0x3226('0x2f')],_0x366e71[_0x3226('0x30')]));if(_0x11246e['query'][_0x3226('0x3a')]){_0x41377c['where']=_[_0x3226('0x3b')](_0x41377c['where'],{'$or':_[_0x3226('0x29')](_0x3b44d0,function(_0x204b3b){if(_0x204b3b[_0x3226('0x3c')]!=='VIRTUAL'){var _0x33ae4a={};_0x33ae4a[_0x204b3b[_0x3226('0x27')]]={'$like':'%'+_0x11246e[_0x3226('0x2f')][_0x3226('0x3a')]+'%'};return _0x33ae4a;}})});}_0x41377c=_[_0x3226('0x3b')]({},_0x41377c,_0x11246e[_0x3226('0x3d')]);var _0x1dbd99={'where':_0x41377c[_0x3226('0x38')]};return db[_0x3226('0x2a')][_0x3226('0x1b')](_0x1dbd99)[_0x3226('0x23')](function(_0x1158c9){_0x3a4af0[_0x3226('0x1b')]=_0x1158c9;if(_0x11246e[_0x3226('0x2f')][_0x3226('0x3e')]){_0x41377c['include']=[{'all':!![]}];}return db[_0x3226('0x2a')][_0x3226('0x3f')](_0x41377c);})[_0x3226('0x23')](function(_0x1b7993){_0x3a4af0['rows']=_0x1b7993;return _0x3a4af0;})[_0x3226('0x23')](respondWithFilteredResult(_0x553639,_0x41377c))[_0x3226('0x40')](handleError(_0x553639,null));};exports[_0x3226('0x41')]=function(_0xbc6d0d,_0x89c00){var _0x60a818={'raw':!![],'where':{'id':_0xbc6d0d[_0x3226('0x42')]['id']}},_0x34fe50={};_0x34fe50[_0x3226('0x2e')]=_['keys'](db[_0x3226('0x2a')][_0x3226('0x2b')]);_0x34fe50[_0x3226('0x2f')]=_[_0x3226('0x43')](_0xbc6d0d[_0x3226('0x2f')]);_0x34fe50[_0x3226('0x30')]=_['intersection'](_0x34fe50['model'],_0x34fe50[_0x3226('0x2f')]);_0x60a818[_0x3226('0x32')]=_['intersection'](_0x34fe50[_0x3226('0x2e')],qs[_0x3226('0x33')](_0xbc6d0d[_0x3226('0x2f')][_0x3226('0x33')]));_0x60a818[_0x3226('0x32')]=_0x60a818[_0x3226('0x32')][_0x3226('0x34')]?_0x60a818[_0x3226('0x32')]:_0x34fe50['model'];if(_0xbc6d0d[_0x3226('0x2f')]['includeAll']){_0x60a818[_0x3226('0x44')]=[{'all':!![]}];}_0x60a818=_[_0x3226('0x3b')]({},_0x60a818,_0xbc6d0d['options']);return db['FaxApplication'][_0x3226('0x45')](_0x60a818)[_0x3226('0x23')](handleEntityNotFound(_0x89c00,null))[_0x3226('0x23')](respondWithResult(_0x89c00,null))[_0x3226('0x40')](handleError(_0x89c00,null));};exports['create']=function(_0x15996b,_0x424688){return db['FaxApplication'][_0x3226('0x46')](_0x15996b[_0x3226('0x47')],{})['then'](respondWithResult(_0x424688,0xc9))[_0x3226('0x40')](handleError(_0x424688,null));};exports[_0x3226('0x21')]=function(_0x218995,_0x421b47){if(_0x218995[_0x3226('0x47')]['id']){delete _0x218995['body']['id'];}return db[_0x3226('0x2a')][_0x3226('0x45')]({'where':{'id':_0x218995[_0x3226('0x42')]['id']}})[_0x3226('0x23')](handleEntityNotFound(_0x421b47,null))[_0x3226('0x23')](saveUpdates(_0x218995['body'],null))[_0x3226('0x23')](respondWithResult(_0x421b47,null))[_0x3226('0x40')](handleError(_0x421b47,null));};exports[_0x3226('0x22')]=function(_0x3be1c0,_0x346de7){return db[_0x3226('0x2a')][_0x3226('0x45')]({'where':{'id':_0x3be1c0[_0x3226('0x42')]['id']}})[_0x3226('0x23')](handleEntityNotFound(_0x346de7,null))[_0x3226('0x23')](removeEntity(_0x346de7,null))[_0x3226('0x40')](handleError(_0x346de7,null));}; \ No newline at end of file +var _0xa44a=['includeAll','include','findAll','rows','catch','show','find','create','body','params','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x176d98,_0x3e7382){var _0x47a82c=function(_0x4a74b3){while(--_0x4a74b3){_0x176d98['push'](_0x176d98['shift']());}};_0x47a82c(++_0x3e7382);}(_0xa44a,0x9a));var _0xaa44=function(_0xe645ea,_0x10c50b){_0xe645ea=_0xe645ea-0x0;var _0x988747=_0xa44a[_0xe645ea];return _0x988747;};'use strict';var pdf=require(_0xaa44('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaa44('0x1'));var jsonpatch=require(_0xaa44('0x2'));var rp=require(_0xaa44('0x3'));var moment=require(_0xaa44('0x4'));var BPromise=require(_0xaa44('0x5'));var Mustache=require(_0xaa44('0x6'));var util=require('util');var path=require('path');var sox=require(_0xaa44('0x7'));var csv=require(_0xaa44('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xaa44('0x9'));var squel=require('squel');var crypto=require(_0xaa44('0xa'));var jsforce=require(_0xaa44('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xaa44('0x8'));var querystring=require(_0xaa44('0xc'));var Papa=require('papaparse');var Redis=require(_0xaa44('0xd'));var authService=require(_0xaa44('0xe'));var qs=require(_0xaa44('0xf'));var as=require(_0xaa44('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaa44('0x11'))('api');var utils=require(_0xaa44('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53c7ba,_0x1b7e76){_0x1b7e76=_0x1b7e76||0xcc;return function(_0x14241a){if(_0x14241a){return _0x53c7ba[_0xaa44('0x13')](_0x1b7e76);}return _0x53c7ba['status'](_0x1b7e76)[_0xaa44('0x14')]();};}function respondWithResult(_0x24edf4,_0x4d1827){_0x4d1827=_0x4d1827||0xc8;return function(_0x57e11d){if(_0x57e11d){return _0x24edf4[_0xaa44('0x15')](_0x4d1827)[_0xaa44('0x16')](_0x57e11d);}};}function respondWithFilteredResult(_0x5f3587,_0x5ab5be){return function(_0xc6673b){if(_0xc6673b){var _0x5ebdb3=_0xc6673b[_0xaa44('0x17')],_0x2d7eea=_0x5ab5be[_0xaa44('0x18')],_0x5a5cab=_0x5ab5be[_0xaa44('0x18')]+_0x5ab5be[_0xaa44('0x19')],_0x1d2a80;if(_0x5a5cab>=_0x5ebdb3){_0x5a5cab=_0x5ebdb3;_0x1d2a80=0xc8;}else{_0x1d2a80=0xce;}_0x5f3587['status'](_0x1d2a80);return _0x5f3587[_0xaa44('0x1a')](_0xaa44('0x1b'),_0x2d7eea+'-'+_0x5a5cab+'/'+_0x5ebdb3)[_0xaa44('0x16')](_0xc6673b);}return null;};}function patchUpdates(_0x6358ce){return function(_0x101195){try{jsonpatch[_0xaa44('0x1c')](_0x101195,_0x6358ce,!![]);}catch(_0x2761f9){return BPromise[_0xaa44('0x1d')](_0x2761f9);}return _0x101195[_0xaa44('0x1e')]();};}function saveUpdates(_0x4b28b2,_0x27c156){return function(_0x4f4922){if(_0x4f4922){return _0x4f4922[_0xaa44('0x1f')](_0x4b28b2)[_0xaa44('0x20')](function(_0x50daeb){return _0x50daeb;});}return null;};}function removeEntity(_0x165e51,_0x3d1fc1){return function(_0x39ad8f){if(_0x39ad8f){return _0x39ad8f[_0xaa44('0x21')]()[_0xaa44('0x20')](function(){_0x165e51[_0xaa44('0x15')](0xcc)[_0xaa44('0x14')]();});}};}function handleEntityNotFound(_0xf9d46e,_0x17afa1){return function(_0x16d244){if(!_0x16d244){_0xf9d46e['sendStatus'](0x194);}return _0x16d244;};}function handleError(_0x783540,_0x2d4759){_0x2d4759=_0x2d4759||0x1f4;return function(_0x20d62e){logger[_0xaa44('0x22')](_0x20d62e[_0xaa44('0x23')]);if(_0x20d62e[_0xaa44('0x24')]){delete _0x20d62e[_0xaa44('0x24')];}_0x783540['status'](_0x2d4759)[_0xaa44('0x25')](_0x20d62e);};}exports[_0xaa44('0x26')]=function(_0x24f169,_0x1e15e5){var _0x509113={},_0x12fcca={},_0x3015ff={'count':0x0,'rows':[]};var _0x31ba00=_[_0xaa44('0x27')](db[_0xaa44('0x28')][_0xaa44('0x29')],function(_0x38c9bd){return{'name':_0x38c9bd[_0xaa44('0x2a')],'type':_0x38c9bd[_0xaa44('0x2b')][_0xaa44('0x2c')]};});_0x12fcca[_0xaa44('0x2d')]=_['map'](_0x31ba00,_0xaa44('0x24'));_0x12fcca[_0xaa44('0x2e')]=_[_0xaa44('0x2f')](_0x24f169[_0xaa44('0x2e')]);_0x12fcca[_0xaa44('0x30')]=_[_0xaa44('0x31')](_0x12fcca['model'],_0x12fcca[_0xaa44('0x2e')]);_0x509113[_0xaa44('0x32')]=_[_0xaa44('0x31')](_0x12fcca['model'],qs[_0xaa44('0x33')](_0x24f169['query'][_0xaa44('0x33')]));_0x509113[_0xaa44('0x32')]=_0x509113['attributes'][_0xaa44('0x34')]?_0x509113[_0xaa44('0x32')]:_0x12fcca[_0xaa44('0x2d')];if(!_0x24f169[_0xaa44('0x2e')]['hasOwnProperty'](_0xaa44('0x35'))){_0x509113[_0xaa44('0x19')]=qs['limit'](_0x24f169['query']['limit']);_0x509113[_0xaa44('0x18')]=qs[_0xaa44('0x18')](_0x24f169[_0xaa44('0x2e')][_0xaa44('0x18')]);}_0x509113[_0xaa44('0x36')]=qs[_0xaa44('0x37')](_0x24f169[_0xaa44('0x2e')][_0xaa44('0x37')]);_0x509113[_0xaa44('0x38')]=qs[_0xaa44('0x30')](_[_0xaa44('0x39')](_0x24f169[_0xaa44('0x2e')],_0x12fcca[_0xaa44('0x30')]));if(_0x24f169[_0xaa44('0x2e')][_0xaa44('0x3a')]){_0x509113[_0xaa44('0x38')]=_[_0xaa44('0x3b')](_0x509113['where'],{'$or':_['map'](_0x31ba00,function(_0x15c90c){if(_0x15c90c[_0xaa44('0x2b')]!==_0xaa44('0x3c')){var _0x4dcb9f={};_0x4dcb9f[_0x15c90c['name']]={'$like':'%'+_0x24f169[_0xaa44('0x2e')]['filter']+'%'};return _0x4dcb9f;}})});}_0x509113=_[_0xaa44('0x3b')]({},_0x509113,_0x24f169[_0xaa44('0x3d')]);var _0x39caa5={'where':_0x509113['where']};return db[_0xaa44('0x28')][_0xaa44('0x17')](_0x39caa5)['then'](function(_0x5a33a7){_0x3015ff[_0xaa44('0x17')]=_0x5a33a7;if(_0x24f169[_0xaa44('0x2e')][_0xaa44('0x3e')]){_0x509113[_0xaa44('0x3f')]=[{'all':!![]}];}return db[_0xaa44('0x28')][_0xaa44('0x40')](_0x509113);})['then'](function(_0x354f2a){_0x3015ff[_0xaa44('0x41')]=_0x354f2a;return _0x3015ff;})[_0xaa44('0x20')](respondWithFilteredResult(_0x1e15e5,_0x509113))[_0xaa44('0x42')](handleError(_0x1e15e5,null));};exports[_0xaa44('0x43')]=function(_0x38f501,_0x5e63cf){var _0x2f31b5={'raw':!![],'where':{'id':_0x38f501['params']['id']}},_0x341c17={};_0x341c17['model']=_[_0xaa44('0x2f')](db['FaxApplication']['rawAttributes']);_0x341c17[_0xaa44('0x2e')]=_[_0xaa44('0x2f')](_0x38f501[_0xaa44('0x2e')]);_0x341c17['filters']=_[_0xaa44('0x31')](_0x341c17[_0xaa44('0x2d')],_0x341c17['query']);_0x2f31b5[_0xaa44('0x32')]=_[_0xaa44('0x31')](_0x341c17[_0xaa44('0x2d')],qs['fields'](_0x38f501[_0xaa44('0x2e')][_0xaa44('0x33')]));_0x2f31b5[_0xaa44('0x32')]=_0x2f31b5[_0xaa44('0x32')][_0xaa44('0x34')]?_0x2f31b5['attributes']:_0x341c17[_0xaa44('0x2d')];if(_0x38f501[_0xaa44('0x2e')][_0xaa44('0x3e')]){_0x2f31b5[_0xaa44('0x3f')]=[{'all':!![]}];}_0x2f31b5=_[_0xaa44('0x3b')]({},_0x2f31b5,_0x38f501[_0xaa44('0x3d')]);return db['FaxApplication'][_0xaa44('0x44')](_0x2f31b5)['then'](handleEntityNotFound(_0x5e63cf,null))[_0xaa44('0x20')](respondWithResult(_0x5e63cf,null))['catch'](handleError(_0x5e63cf,null));};exports['create']=function(_0x23fee4,_0x430796){return db[_0xaa44('0x28')][_0xaa44('0x45')](_0x23fee4['body'],{})[_0xaa44('0x20')](respondWithResult(_0x430796,0xc9))['catch'](handleError(_0x430796,null));};exports[_0xaa44('0x1f')]=function(_0x2b34fe,_0x16678a){if(_0x2b34fe[_0xaa44('0x46')]['id']){delete _0x2b34fe[_0xaa44('0x46')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x2b34fe[_0xaa44('0x47')]['id']}})[_0xaa44('0x20')](handleEntityNotFound(_0x16678a,null))[_0xaa44('0x20')](saveUpdates(_0x2b34fe['body'],null))['then'](respondWithResult(_0x16678a,null))[_0xaa44('0x42')](handleError(_0x16678a,null));};exports[_0xaa44('0x21')]=function(_0x5c54b2,_0x2e3c9c){return db[_0xaa44('0x28')][_0xaa44('0x44')]({'where':{'id':_0x5c54b2['params']['id']}})[_0xaa44('0x20')](handleEntityNotFound(_0x2e3c9c,null))[_0xaa44('0x20')](removeEntity(_0x2e3c9c,null))[_0xaa44('0x42')](handleError(_0x2e3c9c,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index d6a7582..882bf38 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 _0x6399=['request-promise','rimraf','../../config/environment','./faxApplication.attributes','exports','utf8mb4','lodash','util','../../config/logger','moment','bluebird'];(function(_0x21bc86,_0x53c0a6){var _0x193010=function(_0x6c8678){while(--_0x6c8678){_0x21bc86['push'](_0x21bc86['shift']());}};_0x193010(++_0x53c0a6);}(_0x6399,0x12f));var _0x9639=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x6399[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x9639('0x0'));var util=require(_0x9639('0x1'));var logger=require(_0x9639('0x2'))('api');var moment=require(_0x9639('0x3'));var BPromise=require(_0x9639('0x4'));var rp=require(_0x9639('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9639('0x6'));var config=require(_0x9639('0x7'));var attributes=require(_0x9639('0x8'));module[_0x9639('0x9')]=function(_0x406596,_0x29e5ee){return _0x406596['define']('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9639('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x46d9=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./faxApplication.attributes','exports','define','fax_applications'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x46d9,0x16d));var _0x946d=function(_0x411bb4,_0x7f1a60){_0x411bb4=_0x411bb4-0x0;var _0x121b84=_0x46d9[_0x411bb4];return _0x121b84;};'use strict';var _=require(_0x946d('0x0'));var util=require(_0x946d('0x1'));var logger=require(_0x946d('0x2'))(_0x946d('0x3'));var moment=require(_0x946d('0x4'));var BPromise=require('bluebird');var rp=require(_0x946d('0x5'));var fs=require('fs');var path=require(_0x946d('0x6'));var rimraf=require('rimraf');var config=require(_0x946d('0x7'));var attributes=require(_0x946d('0x8'));module[_0x946d('0x9')]=function(_0x35bec3,_0xb4230){return _0x35bec3[_0x946d('0xa')]('FaxApplication',attributes,{'tableName':_0x946d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x946d('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 5e52467..975ee35 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 _0xacee=['FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','catch','update','options','where','attributes','UpdateFaxApplication','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug'];(function(_0x5da538,_0x5a8597){var _0x361797=function(_0x19914e){while(--_0x19914e){_0x5da538['push'](_0x5da538['shift']());}};_0x361797(++_0x5a8597);}(_0xacee,0x1f2));var _0xeace=function(_0x1bb857,_0x360f99){_0x1bb857=_0x1bb857-0x0;var _0x383368=_0xacee[_0x1bb857];return _0x383368;};'use strict';var _=require(_0xeace('0x0'));var util=require(_0xeace('0x1'));var moment=require(_0xeace('0x2'));var BPromise=require('bluebird');var rs=require(_0xeace('0x3'));var fs=require('fs');var Redis=require(_0xeace('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xeace('0x5'));var logger=require(_0xeace('0x6'))(_0xeace('0x7'));var config=require('../../config/environment');var jayson=require(_0xeace('0x8'));var client=jayson['client'][_0xeace('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x470553,_0x19daf1,_0x5ae731){return new BPromise(function(_0x57f502,_0x100637){return client[_0xeace('0xa')](_0x470553,_0x5ae731)[_0xeace('0xb')](function(_0x1c839e){logger[_0xeace('0xc')]('FaxApplication,\x20%s,\x20%s',_0x19daf1,_0xeace('0xd'));logger[_0xeace('0xe')](_0xeace('0xf'),_0x19daf1,_0xeace('0xd'),JSON[_0xeace('0x10')](_0x1c839e));if(_0x1c839e[_0xeace('0x11')]){if(_0x1c839e[_0xeace('0x11')][_0xeace('0x12')]===0x1f4){logger['error'](_0xeace('0x13'),_0x19daf1,_0x1c839e['error']['message']);return _0x100637(_0x1c839e[_0xeace('0x11')]['message']);}logger[_0xeace('0x11')](_0xeace('0x13'),_0x19daf1,_0x1c839e['error']['message']);return _0x57f502(_0x1c839e['error'][_0xeace('0x14')]);}else{logger[_0xeace('0xc')]('FaxApplication,\x20%s,\x20%s',_0x19daf1,'request\x20sent');_0x57f502(_0x1c839e['result'][_0xeace('0x14')]);}})[_0xeace('0x15')](function(_0x28d1f2){logger[_0xeace('0x11')](_0xeace('0x13'),_0x19daf1,_0x28d1f2);_0x100637(_0x28d1f2);});});}exports['UpdateFaxApplication']=function(_0x396a3b){var _0x14bd28=this;return new Promise(function(_0x2539d1,_0x51fc6f){return db['FaxApplication'][_0xeace('0x16')](_0x396a3b['body'],{'raw':_0x396a3b[_0xeace('0x17')]?_0x396a3b[_0xeace('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x396a3b[_0xeace('0x17')]?_0x396a3b[_0xeace('0x17')][_0xeace('0x18')]||null:null,'attributes':_0x396a3b[_0xeace('0x17')]?_0x396a3b[_0xeace('0x17')][_0xeace('0x19')]||null:null,'limit':_0x396a3b[_0xeace('0x17')]?_0x396a3b[_0xeace('0x17')]['limit']||null:null})[_0xeace('0xb')](function(_0x3d5b3b){logger[_0xeace('0xc')](_0xeace('0x1a'),_0x396a3b);logger[_0xeace('0xe')]('UpdateFaxApplication',_0x396a3b,JSON['stringify'](_0x3d5b3b));_0x2539d1(_0x3d5b3b);})[_0xeace('0x15')](function(_0x314ec2){logger[_0xeace('0x11')](_0xeace('0x1a'),_0x314ec2[_0xeace('0x14')],_0x396a3b);_0x51fc6f(_0x14bd28[_0xeace('0x11')](0x1f4,_0x314ec2[_0xeace('0x14')]));});});}; \ No newline at end of file +var _0x333f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','moment'];(function(_0x57062a,_0x123026){var _0xa178da=function(_0x1702d6){while(--_0x1702d6){_0x57062a['push'](_0x57062a['shift']());}};_0xa178da(++_0x123026);}(_0x333f,0x81));var _0xf333=function(_0x300318,_0x21de04){_0x300318=_0x300318-0x0;var _0x239c8b=_0x333f[_0x300318];return _0x239c8b;};'use strict';var _=require(_0xf333('0x0'));var util=require(_0xf333('0x1'));var moment=require(_0xf333('0x2'));var BPromise=require(_0xf333('0x3'));var rs=require(_0xf333('0x4'));var fs=require('fs');var Redis=require(_0xf333('0x5'));var db=require(_0xf333('0x6'))['db'];var utils=require(_0xf333('0x7'));var logger=require(_0xf333('0x8'))(_0xf333('0x9'));var config=require(_0xf333('0xa'));var jayson=require(_0xf333('0xb'));var client=jayson['client'][_0xf333('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x26fb2b,_0x461d43,_0x525161){return new BPromise(function(_0x5eec23,_0x17aaca){return client[_0xf333('0xd')](_0x26fb2b,_0x525161)['then'](function(_0x1e2562){logger[_0xf333('0xe')](_0xf333('0xf'),_0x461d43,'request\x20sent');logger[_0xf333('0x10')](_0xf333('0x11'),_0x461d43,_0xf333('0x12'),JSON[_0xf333('0x13')](_0x1e2562));if(_0x1e2562[_0xf333('0x14')]){if(_0x1e2562[_0xf333('0x14')]['code']===0x1f4){logger[_0xf333('0x14')](_0xf333('0xf'),_0x461d43,_0x1e2562[_0xf333('0x14')][_0xf333('0x15')]);return _0x17aaca(_0x1e2562['error'][_0xf333('0x15')]);}logger[_0xf333('0x14')](_0xf333('0xf'),_0x461d43,_0x1e2562[_0xf333('0x14')][_0xf333('0x15')]);return _0x5eec23(_0x1e2562[_0xf333('0x14')][_0xf333('0x15')]);}else{logger['info'](_0xf333('0xf'),_0x461d43,_0xf333('0x12'));_0x5eec23(_0x1e2562[_0xf333('0x16')]['message']);}})['catch'](function(_0x5c9908){logger['error'](_0xf333('0xf'),_0x461d43,_0x5c9908);_0x17aaca(_0x5c9908);});});}exports[_0xf333('0x17')]=function(_0x4f9f28){var _0x5175df=this;return new Promise(function(_0x37ac39,_0x21e26c){return db[_0xf333('0x18')][_0xf333('0x19')](_0x4f9f28[_0xf333('0x1a')],{'raw':_0x4f9f28[_0xf333('0x1b')]?_0x4f9f28[_0xf333('0x1b')][_0xf333('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f9f28['options']?_0x4f9f28[_0xf333('0x1b')][_0xf333('0x1d')]||null:null,'attributes':_0x4f9f28['options']?_0x4f9f28[_0xf333('0x1b')][_0xf333('0x1e')]||null:null,'limit':_0x4f9f28[_0xf333('0x1b')]?_0x4f9f28['options'][_0xf333('0x1f')]||null:null})[_0xf333('0x20')](function(_0x2d0ff2){logger[_0xf333('0xe')](_0xf333('0x17'),_0x4f9f28);logger[_0xf333('0x10')](_0xf333('0x17'),_0x4f9f28,JSON[_0xf333('0x13')](_0x2d0ff2));_0x37ac39(_0x2d0ff2);})['catch'](function(_0x42fff7){logger[_0xf333('0x14')](_0xf333('0x17'),_0x42fff7[_0xf333('0x15')],_0x4f9f28);_0x21e26c(_0x5175df[_0xf333('0x14')](0x1f4,_0x42fff7[_0xf333('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 8905cc2..4b55145 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 _0xc4aa=['connect-timeout','express','Router','./faxApplication.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer','util','path'];(function(_0x356b9e,_0x306f73){var _0x15e910=function(_0x476146){while(--_0x476146){_0x356b9e['push'](_0x356b9e['shift']());}};_0x15e910(++_0x306f73);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xc4aa[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xac4a('0x6'));router[_0xac4a('0x7')]('/',auth[_0xac4a('0x8')](),controller[_0xac4a('0x9')]);router[_0xac4a('0x7')](_0xac4a('0xa'),auth[_0xac4a('0x8')](),controller[_0xac4a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xac4a('0xc')]);router[_0xac4a('0xd')](_0xac4a('0xa'),auth['isAuthenticated'](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')](_0xac4a('0xa'),auth['isAuthenticated'](),controller[_0xac4a('0x10')]);module['exports']=router; \ No newline at end of file +var _0x7dfd=['get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller'];(function(_0x9b6f7b,_0x436e84){var _0x43f233=function(_0x3159a1){while(--_0x3159a1){_0x9b6f7b['push'](_0x9b6f7b['shift']());}};_0x43f233(++_0x436e84);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var path=require(_0xd7df('0x2'));var timeout=require(_0xd7df('0x3'));var express=require(_0xd7df('0x4'));var router=express[_0xd7df('0x5')]();var auth=require(_0xd7df('0x6'));var interaction=require(_0xd7df('0x7'));var config=require(_0xd7df('0x8'));var controller=require(_0xd7df('0x9'));router[_0xd7df('0xa')]('/',auth[_0xd7df('0xb')](),controller[_0xd7df('0xc')]);router[_0xd7df('0xa')](_0xd7df('0xd'),auth[_0xd7df('0xb')](),controller[_0xd7df('0xe')]);router['post']('/',auth[_0xd7df('0xb')](),controller[_0xd7df('0xf')]);router[_0xd7df('0x10')](_0xd7df('0xd'),auth['isAuthenticated'](),controller[_0xd7df('0x11')]);router['delete'](_0xd7df('0xd'),auth['isAuthenticated'](),controller[_0xd7df('0x12')]);module[_0xd7df('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index e7ae6b1..d95ffc3 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 _0x00b0=['sequelize','exports','STRING','DATE','out','ENUM'];(function(_0x59bb40,_0x96fe47){var _0x13ee27=function(_0x3669cc){while(--_0x3669cc){_0x59bb40['push'](_0x59bb40['shift']());}};_0x13ee27(++_0x96fe47);}(_0x00b0,0x90));var _0x000b=function(_0x156c57,_0x2b5d0b){_0x156c57=_0x156c57-0x0;var _0x4968d4=_0x00b0[_0x156c57];return _0x4968d4;};'use strict';var Sequelize=require(_0x000b('0x0'));module[_0x000b('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x000b('0x2')]},'note':{'type':Sequelize[_0x000b('0x2')]},'read1stAt':{'type':Sequelize[_0x000b('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x000b('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x000b('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x000b('0x5')]('in',_0x000b('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xcb91=['out','ENUM','exports','BOOLEAN','DATE','STRING'];(function(_0x5903da,_0x573b67){var _0x13f8bd=function(_0x4f9272){while(--_0x4f9272){_0x5903da['push'](_0x5903da['shift']());}};_0x13f8bd(++_0x573b67);}(_0xcb91,0x13a));var _0x1cb9=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0xcb91[_0x1602ef];return _0x5870ee;};'use strict';var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'closed':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1cb9('0x2')]},'disposition':{'type':Sequelize[_0x1cb9('0x3')]},'note':{'type':Sequelize[_0x1cb9('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x1cb9('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x1cb9('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1cb9('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x1cb9('0x5')]('in',_0x1cb9('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 357d987..caf474c 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 _0x4d33=['Tags','push','catch','index','FaxInteraction','fieldName','key','keys','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','field','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','select','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','buildExpression','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','DESC','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','intersection','include','options','create','body','update','describe','FaxMessage','addMessage','ids','omit','rawAttributes','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','emit','faxInteractionTags:save','removeTags','download','join','root','server','files','attachments','transcript-%d-%s.zip','Messages','get','mkdirSync','Attachment','existsSync','createWriteStream','basename','log','err','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','error','name','send','Users','map','fullname','TagIds','forEach'];(function(_0x88fab1,_0x1accff){var _0x20c571=function(_0x12de1c){while(--_0x12de1c){_0x88fab1['push'](_0x88fab1['shift']());}};_0x20c571(++_0x1accff);}(_0x4d33,0x9b));var _0x34d3=function(_0x498334,_0x27b6fe){_0x498334=_0x498334-0x0;var _0x13bb70=_0x4d33[_0x498334];return _0x13bb70;};'use strict';var pdf=require(_0x34d3('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x34d3('0x1'));var jsonpatch=require(_0x34d3('0x2'));var rp=require(_0x34d3('0x3'));var moment=require(_0x34d3('0x4'));var BPromise=require(_0x34d3('0x5'));var Mustache=require(_0x34d3('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x34d3('0x7'));var ejs=require(_0x34d3('0x8'));var fs=require('fs');var _=require(_0x34d3('0x9'));var squel=require(_0x34d3('0xa'));var crypto=require(_0x34d3('0xb'));var jsforce=require(_0x34d3('0xc'));var deskjs=require(_0x34d3('0xd'));var toCsv=require('to-csv');var querystring=require(_0x34d3('0xe'));var Papa=require(_0x34d3('0xf'));var Redis=require(_0x34d3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x34d3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x34d3('0x12'));var logger=require(_0x34d3('0x13'))(_0x34d3('0x14'));var utils=require(_0x34d3('0x15'));var config=require(_0x34d3('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x34d3('0x17')](config[_0x34d3('0x18')],{'host':_0x34d3('0x19'),'port':0x18eb});var socket=require(_0x34d3('0x1a'))(new Redis(config[_0x34d3('0x18')]));require(_0x34d3('0x1b'))[_0x34d3('0x1c')](socket);function respondWithStatusCode(_0xfea814,_0x11b7d8){_0x11b7d8=_0x11b7d8||0xcc;return function(_0x591af5){if(_0x591af5){return _0xfea814[_0x34d3('0x1d')](_0x11b7d8);}return _0xfea814[_0x34d3('0x1e')](_0x11b7d8)[_0x34d3('0x1f')]();};}function respondWithResult(_0x597cc3,_0x5ce616){_0x5ce616=_0x5ce616||0xc8;return function(_0xc70881){if(_0xc70881){return _0x597cc3[_0x34d3('0x1e')](_0x5ce616)[_0x34d3('0x20')](_0xc70881);}};}function respondWithFilteredResult(_0x4ba738,_0x52755c){return function(_0xdfdb4e){if(_0xdfdb4e){var _0x228a84=_0xdfdb4e[_0x34d3('0x21')],_0x1c85b5=_0x52755c[_0x34d3('0x22')],_0x9127a=_0x52755c['offset']+_0x52755c[_0x34d3('0x23')],_0x18d01b;if(_0x9127a>=_0x228a84){_0x9127a=_0x228a84;_0x18d01b=0xc8;}else{_0x18d01b=0xce;}_0x4ba738[_0x34d3('0x1e')](_0x18d01b);return _0x4ba738[_0x34d3('0x24')]('Content-Range',_0x1c85b5+'-'+_0x9127a+'/'+_0x228a84)[_0x34d3('0x20')](_0xdfdb4e);}return null;};}function patchUpdates(_0x480aa0){return function(_0x2d0ba0){try{jsonpatch[_0x34d3('0x25')](_0x2d0ba0,_0x480aa0,!![]);}catch(_0xf5e8e){return BPromise[_0x34d3('0x26')](_0xf5e8e);}return _0x2d0ba0[_0x34d3('0x27')]();};}function saveUpdates(_0x2ebe26,_0x4c3da7){return function(_0x46e706){if(_0x46e706){return _0x46e706['update'](_0x2ebe26)[_0x34d3('0x28')](function(_0x5b14de){return _0x5b14de;});}return null;};}function removeEntity(_0x4694be,_0x1cbfc4){return function(_0x16e789){if(_0x16e789){return _0x16e789[_0x34d3('0x29')]()[_0x34d3('0x28')](function(){_0x4694be[_0x34d3('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d99ba,_0x442642){return function(_0x52789a){if(!_0x52789a){_0x4d99ba[_0x34d3('0x1d')](0x194);}return _0x52789a;};}function handleError(_0x4cf231,_0x13171c){_0x13171c=_0x13171c||0x1f4;return function(_0x18dd1b){logger[_0x34d3('0x2a')](_0x18dd1b['stack']);if(_0x18dd1b[_0x34d3('0x2b')]){delete _0x18dd1b[_0x34d3('0x2b')];}_0x4cf231[_0x34d3('0x1e')](_0x13171c)[_0x34d3('0x2c')](_0x18dd1b);};}function getInteractionUsers(_0x14a0d6,_0x18b1c7){return new BPromise(function(_0x342826,_0x141b0c){try{if(_0x18b1c7[_0x14a0d6['id']]){_0x14a0d6[_0x34d3('0x2d')]=_[_0x34d3('0x2e')](_0x18b1c7[_0x14a0d6['id']],function(_0x5a450d){return{'id':_0x5a450d['id'],'fullname':_0x5a450d[_0x34d3('0x2f')]};});}}catch(_0x3f143e){_0x141b0c(_0x3f143e);}_0x342826(_0x14a0d6);});}function getInteractionTags(_0x500719,_0x3d2cba){return new BPromise(function(_0xa65b9d,_0x48a027){try{if(_0x500719[_0x34d3('0x30')]){_0x500719['Tags']=[];_0x500719[_0x34d3('0x30')]['split'](',')[_0x34d3('0x31')](function(_0x1c882e){_0x500719[_0x34d3('0x32')][_0x34d3('0x33')](_0x3d2cba[_0x1c882e]);});}delete _0x500719[_0x34d3('0x30')];}catch(_0x12ae90){_0x48a027(_0x12ae90);}_0xa65b9d(_0x500719);});}function updateFaxInteraction(_0xc28182,_0x285bdf,_0x470ba3){return new BPromise(function(_0x17fec3,_0x39d116){return getInteractionUsers(_0xc28182,_0x470ba3)['then'](function(_0xcbdcbf){return getInteractionTags(_0xcbdcbf,_0x285bdf);})[_0x34d3('0x28')](function(_0x1e8db3){_0x17fec3(_0x1e8db3);})[_0x34d3('0x34')](function(_0x12f8c2){_0x39d116(_0x12f8c2);});});}exports[_0x34d3('0x35')]=function(_0xc5aca5,_0xb80ef2){var _0x447eb2={},_0x493b65={},_0x11f527={'count':0x0,'rows':[]};var _0x3ab0bc=_[_0x34d3('0x2e')](db[_0x34d3('0x36')]['rawAttributes'],function(_0xaa5a25){return{'name':_0xaa5a25[_0x34d3('0x37')],'type':_0xaa5a25['type'][_0x34d3('0x38')]};});_0x493b65['model']=_[_0x34d3('0x2e')](_0x3ab0bc,_0x34d3('0x2b'));_0x493b65['query']=_[_0x34d3('0x39')](_0xc5aca5['query']);_0x493b65['filters']=_['intersection'](_0x493b65[_0x34d3('0x3a')],_0x493b65[_0x34d3('0x3b')]);_0x447eb2[_0x34d3('0x3c')]=_['intersection'](_0x493b65[_0x34d3('0x3a')],qs[_0x34d3('0x3d')](_0xc5aca5[_0x34d3('0x3b')][_0x34d3('0x3d')]));_0x447eb2[_0x34d3('0x3c')]=_0x447eb2['attributes'][_0x34d3('0x3e')]?_0x447eb2[_0x34d3('0x3c')]:_0x493b65[_0x34d3('0x3a')];if(!_0xc5aca5[_0x34d3('0x3b')][_0x34d3('0x3f')](_0x34d3('0x40'))){_0x447eb2['limit']=qs[_0x34d3('0x23')](_0xc5aca5[_0x34d3('0x3b')][_0x34d3('0x23')]);_0x447eb2['offset']=qs[_0x34d3('0x22')](_0xc5aca5[_0x34d3('0x3b')][_0x34d3('0x22')]);}_0x447eb2[_0x34d3('0x41')]=qs[_0x34d3('0x42')](_0xc5aca5[_0x34d3('0x3b')][_0x34d3('0x42')]);_0x447eb2[_0x34d3('0x43')]=qs['filters'](_['pick'](_0xc5aca5['query'],_0x493b65[_0x34d3('0x44')]));var _0x506d89=[];var _0x3e9614=squel['select']()[_0x34d3('0x45')]('id')[_0x34d3('0x45')]('name')['field']('color')[_0x34d3('0x46')](_0x34d3('0x47'));var _0xb2c578=squel['select']()[_0x34d3('0x45')](_0x34d3('0x48'))[_0x34d3('0x45')](_0x34d3('0x49'))['field'](_0x34d3('0x4a'))[_0x34d3('0x46')](_0x34d3('0x4b'),'ui')[_0x34d3('0x4c')](_0x34d3('0x4d'),'u','u.id\x20=\x20ui.UserId');var _0x142de0=squel[_0x34d3('0x4e')]()[_0x34d3('0x46')]('fax_interactions','i')['left_join']('cm_contacts','c',_0x34d3('0x4f'))[_0x34d3('0x4c')](_0x34d3('0x4d'),'o',_0x34d3('0x50'))[_0x34d3('0x4c')](_0x34d3('0x51'),'a',_0x34d3('0x52'))[_0x34d3('0x4c')]('fax_messages','me','me.FaxInteractionId\x20=\x20i.id')[_0x34d3('0x4c')]('fax_interaction_has_tags','it',_0x34d3('0x53'))[_0x34d3('0x4c')](_0x34d3('0x47'),'t',_0x34d3('0x54'));var _0x430cad=squel[_0x34d3('0x55')]();var _0x4c1410=[];var _0x2487b5=squel['expr']();var _0xb6c935;if(_0xc5aca5[_0x34d3('0x3b')][_0x34d3('0x56')]){_0xb6c935=as['parseSearch'](_0xc5aca5[_0x34d3('0x3b')][_0x34d3('0x56')]);var _0x5f0138=_0xb6c935[_0x34d3('0x57')];for(var _0x1e14a0=0x0;_0x1e14a0<_0xb6c935[_0x34d3('0x58')][_0x34d3('0x3e')];_0x1e14a0++){var _0x11d49c=_0xb6c935[_0x34d3('0x58')][_0x1e14a0];var _0x2c759f='i';var _0x24ff7f=_['find'](_0x3ab0bc,[_0x34d3('0x2b'),_0x11d49c['field']]);if(!_0x24ff7f){switch(_0x11d49c[_0x34d3('0x45')]){case _0x34d3('0x59'):if(_0x11d49c[_0x34d3('0x5a')]==0x1){_0x142de0[_0x34d3('0x5b')]('`'+_0x11d49c[_0x34d3('0x45')]+_0x34d3('0x5c'));}else{_0x142de0[_0x34d3('0x5b')]('`'+_0x11d49c['field']+_0x34d3('0x5d'));}break;case'Contact':if(_0x11d49c['operator']===_0x34d3('0x5e')){if(_0x11d49c['value']['split']('\x20')[_0x34d3('0x3e')]>0x1){_0x430cad[_0x5f0138](_0x34d3('0x5f'),qs[_0x34d3('0x60')](_0x11d49c[_0x34d3('0x5a')]),null);}else{var _0x21679e='%'+_0x11d49c['value']+'%';_0x430cad[_0x5f0138]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x21679e,_0x21679e,_0x21679e);}}else{_0x24ff7f=_[_0x34d3('0x61')](_0x3ab0bc,[_0x34d3('0x2b'),'ContactId']);_0x11d49c['field']=_0x34d3('0x62');_0x231381=as[_0x34d3('0x63')](_0x2c759f,_0x24ff7f['type'],_0x11d49c);_0x430cad[_0x5f0138](_0x231381[_0x34d3('0x64')],_0x231381[_0x34d3('0x5a')][_0x34d3('0x65')],_0x231381[_0x34d3('0x5a')]['end']);}break;case _0x34d3('0x66'):var _0x449a4d=_0x11d49c['value']['split'](',')[_0x34d3('0x2e')](function(_0x1024b7){return Number(_0x1024b7);});_0x449a4d[_0x34d3('0x31')](function(_0x429386){_0x2487b5['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x429386+',%');});_0x4c1410=_[_0x34d3('0x67')](_0x4c1410,_0x449a4d);break;case _0x34d3('0x68'):if(_0x11d49c['operator']===_0x34d3('0x5e')){_0x430cad[_0x5f0138](_0x34d3('0x69'),'%'+_0x11d49c['value']+'%',null);}else{_0x24ff7f=_[_0x34d3('0x61')](_0x3ab0bc,[_0x34d3('0x2b'),_0x34d3('0x6a')]);_0x11d49c['field']=_0x34d3('0x6a');_0x231381=as[_0x34d3('0x63')](_0x2c759f,_0x24ff7f[_0x34d3('0x6b')],_0x11d49c);_0x430cad[_0x5f0138](_0x231381[_0x34d3('0x64')],_0x231381['value'][_0x34d3('0x65')],_0x231381[_0x34d3('0x5a')]['end']);}break;case'body':_0x231381=as[_0x34d3('0x63')]('me',null,_0x11d49c);_0x430cad[_0x5f0138](_0x231381[_0x34d3('0x64')],_0x231381[_0x34d3('0x5a')][_0x34d3('0x65')],_0x231381['value'][_0x34d3('0x1f')]);break;}}else{var _0x231381=as[_0x34d3('0x63')](_0x2c759f,_0x24ff7f['type'],_0x11d49c);_0x430cad[_0x5f0138](_0x231381[_0x34d3('0x64')],_0x231381[_0x34d3('0x5a')]['start'],_0x231381[_0x34d3('0x5a')][_0x34d3('0x1f')]);}}}else{var _0xe9ff1=_(_0xc5aca5['query'])[_0x34d3('0x39')]()[_0x34d3('0x2e')](function(_0x33ea42){return _[_0x34d3('0x6c')](_0x3ab0bc,['name',_0x33ea42])?_0x33ea42:undefined;})['compact']()[_0x34d3('0x5a')]();if(!_[_0x34d3('0x6d')](_0xe9ff1)){_0xe9ff1[_0x34d3('0x31')](function(_0x2a71eb){if(_0x2a71eb===_0x34d3('0x6e')){_0x142de0[_0x34d3('0x43')](_0x34d3('0x6f'),[][_0x34d3('0x70')](_0xc5aca5[_0x34d3('0x3b')][_0x2a71eb]));}else if(_0x2a71eb==='createdAt'){var _0xdbcfbb=JSON[_0x34d3('0x71')](_0xc5aca5[_0x34d3('0x3b')][_0x2a71eb])[_0x34d3('0x72')];var _0x519406=JSON[_0x34d3('0x71')](_0xc5aca5[_0x34d3('0x3b')][_0x2a71eb])['$lte'];_0x142de0[_0x34d3('0x43')](_0x34d3('0x73'),_0xdbcfbb,_0x519406);}else{if(_0xc5aca5['query'][_0x2a71eb]===_0x34d3('0x74')){_0x142de0[_0x34d3('0x43')]('i.'+_0x2a71eb+_0x34d3('0x75'));}else{_0x142de0['where']('i.'+_0x2a71eb+'\x20=\x20?',_0xc5aca5['query'][_0x2a71eb]);}}});}if(_0xc5aca5[_0x34d3('0x3b')][_0x34d3('0x76')]){if(_0xc5aca5['query'][_0x34d3('0x76')]==0x1){_0x142de0[_0x34d3('0x5b')](_0x34d3('0x77'));}else{_0x142de0['having']('`unreadMessages`\x20>\x200');}}if(_0xc5aca5[_0x34d3('0x3b')][_0x34d3('0x78')]){_0x4c1410=_[_0x34d3('0x79')](_0xc5aca5[_0x34d3('0x3b')]['tag'])?_0xc5aca5[_0x34d3('0x3b')][_0x34d3('0x78')]:new Array(_0xc5aca5[_0x34d3('0x3b')]['tag']);_0x4c1410[_0x34d3('0x31')](function(_0x2b512c){_0x2487b5['or'](_0x34d3('0x7a'),'%,'+_0x2b512c+',%');});}if(_0xc5aca5['query'][_0x34d3('0x7b')]){var _0x385f33=_0xc5aca5[_0x34d3('0x3b')][_0x34d3('0x7b')][_0x34d3('0x7c')]('\x5c','\x5c\x5c')[_0x34d3('0x7c')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x34d3('0x7d')](_0x385f33)){_0x430cad['or'](_0x34d3('0x7e'),_0x385f33+'%')['or'](_0x34d3('0x7f'),_0x385f33+'%');}_0x430cad['or'](_0x34d3('0x80'),_0x385f33+'%');}}_0x142de0[_0x34d3('0x43')](_0x430cad);_0x142de0[_0x34d3('0x81')](_0x34d3('0x82'));var _0x15d62a={'type':db[_0x34d3('0x83')]['QueryTypes'][_0x34d3('0x84')],'raw':!![]};var _0x488cd1=_0x142de0[_0x34d3('0x85')]();_0x488cd1[_0x34d3('0x45')]('i.id');_0x488cd1['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x34d3('0x59'));if(_0x447eb2[_0x34d3('0x41')]){_0x447eb2[_0x34d3('0x41')][_0x34d3('0x31')](function(_0x12a242){_0x142de0[_0x34d3('0x41')]('i.'+_0x12a242[0x0],_0x12a242[0x1]===_0x34d3('0x86')?![]:!![]);});}if(!_['isEmpty'](_0x4c1410)){_0x142de0[_0x34d3('0x5b')](_0x2487b5);_0x488cd1[_0x34d3('0x43')](_0x34d3('0x87'),_0x4c1410);}BPromise[_0x34d3('0x88')]()[_0x34d3('0x28')](function(){if(!_0xb6c935){if(_0xc5aca5[_0x34d3('0x3b')][_0x34d3('0x6e')]||_0xc5aca5[_0x34d3('0x3b')][_0x34d3('0x89')])return;_0x488cd1[_0x34d3('0x43')](_0x34d3('0x8a'));_0x142de0[_0x34d3('0x43')](_0x34d3('0x8a'));return;}return _0xc5aca5['user'][_0x34d3('0x8b')]({'attributes':['id'],'raw':!![]})['then'](function(_0x211d11){if(_[_0x34d3('0x6d')](_0x211d11)){_0x488cd1[_0x34d3('0x43')]('i.FaxAccountId\x20IS\x20NULL');_0x142de0[_0x34d3('0x43')](_0x34d3('0x8c'));}else{_0x488cd1['where'](_0x34d3('0x6f'),_[_0x34d3('0x2e')](_0x211d11,'id'));_0x142de0[_0x34d3('0x43')](_0x34d3('0x6f'),_[_0x34d3('0x2e')](_0x211d11,'id'));}});})[_0x34d3('0x28')](function(){db[_0x34d3('0x8d')][_0x34d3('0x3b')](_0x488cd1[_0x34d3('0x8e')](),_0x15d62a)[_0x34d3('0x28')](function(_0x1fabcc){_0x11f527['count']=_0x1fabcc['length'];if(_0x11f527[_0x34d3('0x21')]===0x0)return[];return db[_0x34d3('0x8d')][_0x34d3('0x3b')](_0x3e9614[_0x34d3('0x8e')](),_0x15d62a)[_0x34d3('0x28')](function(_0x3b3638){_0x506d89=_[_0x34d3('0x8f')](_0x3b3638,'id');_0x15d62a=_[_0x34d3('0x90')](_0x15d62a,{'model':db[_0x34d3('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xc5aca5[_0x34d3('0x3b')][_0x34d3('0x3d')]){_0x447eb2[_0x34d3('0x3c')][_0x34d3('0x31')](function(_0x1fa2d4){_0x142de0['field']('i.'+_0x1fa2d4);});}else{_0x142de0[_0x34d3('0x45')](_0x34d3('0x91'),'unreadMessages');_0x142de0['field'](_0x34d3('0x92'),_0x34d3('0x93'));_0x142de0['field'](_0x34d3('0x94'),_0x34d3('0x95'));_0x142de0[_0x34d3('0x45')](_0x34d3('0x96'));_0x142de0[_0x34d3('0x45')]('c.firstName',_0x34d3('0x97'));_0x142de0['field']('c.lastName',_0x34d3('0x98'));_0x142de0['field'](_0x34d3('0x99'),_0x34d3('0x9a'));_0x142de0[_0x34d3('0x45')](_0x34d3('0x9b'),_0x34d3('0x9c'));_0x142de0['field'](_0x34d3('0x9d'),'Contact.mobile');_0x142de0[_0x34d3('0x45')]('c.fax',_0x34d3('0x9e'));_0x142de0[_0x34d3('0x45')](_0x34d3('0x9f'),_0x34d3('0xa0'));_0x142de0[_0x34d3('0x45')](_0x34d3('0xa1'),'Owner.internal');_0x142de0[_0x34d3('0x45')](_0x34d3('0xa2'),_0x34d3('0x30'));}_0x142de0[_0x34d3('0x23')](_0x447eb2['limit']);_0x142de0[_0x34d3('0x22')](_0x447eb2[_0x34d3('0x22')]);return db[_0x34d3('0x8d')][_0x34d3('0x3b')](_0x142de0[_0x34d3('0x8e')](),_0x15d62a);})[_0x34d3('0x28')](function(_0x32c131){_0xb2c578[_0x34d3('0x43')](_0x34d3('0xa3'),_[_0x34d3('0x2e')](_0x32c131,'id'));return db[_0x34d3('0x8d')][_0x34d3('0x3b')](_0xb2c578['toString'](),_0x15d62a)['then'](function(_0x44334d){var _0x3d0af4=_[_0x34d3('0xa4')](_0x44334d,_0x34d3('0xa5'));var _0xec1870=[];_0x32c131[_0x34d3('0x31')](function(_0xabfe0e){_0xec1870[_0x34d3('0x33')](updateFaxInteraction(_0xabfe0e,_0x506d89,_0x3d0af4));});return BPromise[_0x34d3('0xa6')](_0xec1870);});});})['then'](function(_0x17d505){_0x11f527[_0x34d3('0xa7')]=_0x17d505;return _0x11f527;})[_0x34d3('0x28')](respondWithFilteredResult(_0xb80ef2,_0x447eb2));})[_0x34d3('0x34')](handleError(_0xb80ef2,null));};exports[_0x34d3('0xa8')]=function(_0x55a023,_0x3d9106){var _0xd0aadc={'raw':![],'where':{'id':_0x55a023[_0x34d3('0xa9')]['id']}},_0x27fb4f={};_0x27fb4f[_0x34d3('0x3a')]=_[_0x34d3('0x39')](db[_0x34d3('0x36')]['rawAttributes']);_0x27fb4f['query']=_[_0x34d3('0x39')](_0x55a023[_0x34d3('0x3b')]);_0x27fb4f[_0x34d3('0x44')]=_[_0x34d3('0xaa')](_0x27fb4f[_0x34d3('0x3a')],_0x27fb4f[_0x34d3('0x3b')]);_0xd0aadc[_0x34d3('0x3c')]=_['intersection'](_0x27fb4f['model'],qs[_0x34d3('0x3d')](_0x55a023[_0x34d3('0x3b')][_0x34d3('0x3d')]));_0xd0aadc['attributes']=_0xd0aadc[_0x34d3('0x3c')][_0x34d3('0x3e')]?_0xd0aadc[_0x34d3('0x3c')]:_0x27fb4f['model'];if(_0x55a023['query']['includeAll']){_0xd0aadc[_0x34d3('0xab')]=[{'all':!![]}];}_0xd0aadc=_['merge']({},_0xd0aadc,_0x55a023[_0x34d3('0xac')]);return db['FaxInteraction'][_0x34d3('0x61')](_0xd0aadc)[_0x34d3('0x28')](handleEntityNotFound(_0x3d9106,null))['then'](respondWithResult(_0x3d9106,null))['catch'](handleError(_0x3d9106,null));};exports[_0x34d3('0xad')]=function(_0x1c5c84,_0x4ce319){return db['FaxInteraction'][_0x34d3('0xad')](_0x1c5c84[_0x34d3('0xae')],{})[_0x34d3('0x28')](respondWithResult(_0x4ce319,0xc9))[_0x34d3('0x34')](handleError(_0x4ce319,null));};exports[_0x34d3('0xaf')]=function(_0x2dd8cf,_0x2c17ea){if(_0x2dd8cf[_0x34d3('0xae')]['id']){delete _0x2dd8cf[_0x34d3('0xae')]['id'];}return db[_0x34d3('0x36')][_0x34d3('0x61')]({'where':{'id':_0x2dd8cf[_0x34d3('0xa9')]['id']}})[_0x34d3('0x28')](handleEntityNotFound(_0x2c17ea,null))[_0x34d3('0x28')](saveUpdates(_0x2dd8cf['body'],null))[_0x34d3('0x28')](respondWithResult(_0x2c17ea,null))['catch'](handleError(_0x2c17ea,null));};exports[_0x34d3('0x29')]=function(_0x68fb9a,_0x24c2e7){return db[_0x34d3('0x36')][_0x34d3('0x61')]({'where':{'id':_0x68fb9a[_0x34d3('0xa9')]['id']}})[_0x34d3('0x28')](handleEntityNotFound(_0x24c2e7,null))[_0x34d3('0x28')](removeEntity(_0x24c2e7,null))[_0x34d3('0x34')](handleError(_0x24c2e7,null));};exports['describe']=function(_0x38175d,_0x3aa10c){return db[_0x34d3('0x36')][_0x34d3('0xb0')]()['then'](respondWithResult(_0x3aa10c,null))['catch'](handleError(_0x3aa10c,null));};exports['addMessage']=function(_0x14f4d5,_0x3dd6b1,_0x4f3ec8){return db[_0x34d3('0xb1')][_0x34d3('0x61')]({'where':{'id':_0x14f4d5[_0x34d3('0xa9')]['id']}})[_0x34d3('0x28')](handleEntityNotFound(_0x3dd6b1,null))[_0x34d3('0x28')](function(_0x4b2567){if(_0x4b2567){return _0x4b2567[_0x34d3('0xb2')](_0x14f4d5[_0x34d3('0xae')][_0x34d3('0xb3')],_[_0x34d3('0xb4')](_0x14f4d5['body'],[_0x34d3('0xb3'),'id'])||{});}})[_0x34d3('0x28')](respondWithResult(_0x3dd6b1,null))[_0x34d3('0x34')](handleError(_0x3dd6b1,null));};exports['getMessages']=function(_0x1b1094,_0x2728fe,_0x805f2f){var _0x6f454b={'raw':![],'where':{}};var _0xa09ae3={};var _0x24d3db={'count':0x0,'rows':[]};return db[_0x34d3('0x36')]['findOne']({'where':{'id':_0x1b1094['params']['id']}})[_0x34d3('0x28')](handleEntityNotFound(_0x2728fe,null))[_0x34d3('0x28')](function(_0xa0ff96){if(_0xa0ff96){_0xa09ae3['model']=_[_0x34d3('0x39')](db[_0x34d3('0xb1')][_0x34d3('0xb5')]);_0xa09ae3[_0x34d3('0x3b')]=_[_0x34d3('0x39')](_0x1b1094['query']);_0xa09ae3[_0x34d3('0x44')]=_['intersection'](_0xa09ae3[_0x34d3('0x3a')],_0xa09ae3[_0x34d3('0x3b')]);_0x6f454b['attributes']=_[_0x34d3('0xaa')](_0xa09ae3['model'],qs[_0x34d3('0x3d')](_0x1b1094[_0x34d3('0x3b')][_0x34d3('0x3d')]));_0x6f454b[_0x34d3('0x3c')]=_0x6f454b[_0x34d3('0x3c')][_0x34d3('0x3e')]?_0x6f454b[_0x34d3('0x3c')]:_0xa09ae3[_0x34d3('0x3a')];if(!_0x1b1094[_0x34d3('0x3b')][_0x34d3('0x3f')](_0x34d3('0x40'))){_0x6f454b[_0x34d3('0x23')]=qs[_0x34d3('0x23')](_0x1b1094[_0x34d3('0x3b')][_0x34d3('0x23')]);_0x6f454b[_0x34d3('0x22')]=qs[_0x34d3('0x22')](_0x1b1094[_0x34d3('0x3b')][_0x34d3('0x22')]);}_0x6f454b[_0x34d3('0x41')]=qs[_0x34d3('0x42')](_0x1b1094[_0x34d3('0x3b')]['sort']);_0x6f454b[_0x34d3('0x43')]=qs['filters'](_['pick'](_0x1b1094[_0x34d3('0x3b')],_0xa09ae3['filters']));_0x6f454b[_0x34d3('0x43')][_0x34d3('0xa5')]=_0xa0ff96['id'];if(_0x1b1094[_0x34d3('0x3b')]['filter']){_0x6f454b[_0x34d3('0x43')]=_['merge'](_0x6f454b['where'],{'$or':_[_0x34d3('0x2e')](_0x6f454b['attributes'],function(_0x55c554){var _0x487d69={};_0x487d69[_0x55c554]={'$like':'%'+_0x1b1094[_0x34d3('0x3b')][_0x34d3('0x7b')]+'%'};return _0x487d69;})});}if(_0x1b1094['query'][_0x34d3('0x72')]){var _0x1ec503=_0x1b1094[_0x34d3('0x3b')][_0x34d3('0x72')]['split'](',');var _0x2d1936={};_0x2d1936[_0x1ec503[0x0]]={'$gte':moment(_0x1ec503[0x1])[_0x34d3('0xb6')](_0x34d3('0xb7'))};_0x6f454b[_0x34d3('0x43')]=_[_0x34d3('0x90')](_0x6f454b['where'],_0x2d1936);}_0x6f454b=_[_0x34d3('0x90')]({},_0x6f454b,_0x1b1094['options']);return db['FaxMessage']['count']({'where':_0x6f454b['where']})['then'](function(_0x1ef1e8){_0x24d3db['count']=_0x1ef1e8;if(_0x1b1094[_0x34d3('0x3b')]['includeAll']){_0x6f454b[_0x34d3('0xab')]=[{'all':!![]}];}return db[_0x34d3('0xb1')][_0x34d3('0xb8')](_0x6f454b);})[_0x34d3('0x28')](function(_0x35dd36){_0x24d3db[_0x34d3('0xa7')]=_0x35dd36;return _0x24d3db;});}})['then'](respondWithFilteredResult(_0x2728fe,_0x6f454b))[_0x34d3('0x34')](handleError(_0x2728fe,null));};exports['addTags']=function(_0xbc0fa5,_0x5a8979,_0x26677b){return db[_0x34d3('0x36')][_0x34d3('0x61')]({'where':{'id':_0xbc0fa5['params']['id']}})['then'](handleEntityNotFound(_0x5a8979,null))[_0x34d3('0x28')](function(_0x19cd51){if(_0x19cd51){return _0x19cd51[_0x34d3('0xb9')](_0xbc0fa5[_0x34d3('0xae')][_0x34d3('0xb3')],_[_0x34d3('0xb4')](_0xbc0fa5[_0x34d3('0xae')],[_0x34d3('0xb3'),'id'])||{})['spread'](function(){return db['Tag'][_0x34d3('0xb8')]({'attributes':['id',_0x34d3('0x2b'),'color'],'where':{'id':_0xbc0fa5[_0x34d3('0xae')][_0x34d3('0xb3')]}});})[_0x34d3('0x28')](function(_0x1bea07){socket[_0x34d3('0xba')](_0x34d3('0xbb'),{'id':Number(_0xbc0fa5[_0x34d3('0xa9')]['id']),'tags':_0x1bea07||[]});return{'id':Number(_0xbc0fa5[_0x34d3('0xa9')]['id']),'tags':_0x1bea07||[]};});}})[_0x34d3('0x28')](respondWithResult(_0x5a8979,null))[_0x34d3('0x34')](handleError(_0x5a8979,null));};exports[_0x34d3('0xbc')]=function(_0x36627a,_0x5eaa97,_0x575802){return db['FaxInteraction'][_0x34d3('0x61')]({'where':{'id':_0x36627a[_0x34d3('0xa9')]['id']}})[_0x34d3('0x28')](handleEntityNotFound(_0x5eaa97,null))['then'](function(_0x3ae06){if(_0x3ae06){return _0x3ae06['removeTags'](_0x36627a[_0x34d3('0x3b')]['ids']);}})['then'](respondWithStatusCode(_0x5eaa97,null))[_0x34d3('0x34')](handleError(_0x5eaa97,null));};exports[_0x34d3('0xbd')]=function(_0x14bf89,_0x4ddc42){var _0x2b767f=moment()['unix']()['toString']();var _0x512050=path[_0x34d3('0xbe')](config[_0x34d3('0xbf')],_0x34d3('0xc0'),_0x34d3('0xc1'),'tmp');var _0x307721=path[_0x34d3('0xbe')](config['root'],_0x34d3('0xc0'),'files',_0x34d3('0xc2'));var _0x483667=path[_0x34d3('0xbe')](_0x512050,_0x2b767f);var _0x3c82e2=util[_0x34d3('0xb6')](_0x34d3('0xc3'),_0x14bf89['params']['id'],_0x2b767f);var _0x55d9c0=path[_0x34d3('0xbe')](_0x512050,_0x3c82e2);var _0x502e8d=[];_0x502e8d[_0x34d3('0x33')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0xf6add9=[{'model':db[_0x34d3('0xb1')],'as':_0x34d3('0xc4'),'attributes':['id','body','createdAt'],'include':_0x502e8d}];return db[_0x34d3('0x36')][_0x34d3('0x61')]({'where':{'id':_0x14bf89[_0x34d3('0xa9')]['id']},'include':_0xf6add9})['then'](handleEntityNotFound(_0x4ddc42,null))['then'](function(_0x4c85ad){if(_0x4c85ad&&_0x4c85ad[_0x34d3('0xc4')]){var _0x3bf35e=_0x4c85ad[_0x34d3('0xc5')]({'plain':!![]});fs[_0x34d3('0xc6')](_0x483667);for(var _0x386762=0x0;_0x386762<_0x3bf35e[_0x34d3('0xc4')][_0x34d3('0x3e')];_0x386762++){var _0x504950=_0x3bf35e[_0x34d3('0xc4')][_0x386762][_0x34d3('0xc7')];if(_0x504950){var _0x2fe4f0=path['join'](_0x307721,_0x504950['basename']);if(fs[_0x34d3('0xc8')](_0x2fe4f0)){fs['createReadStream'](_0x2fe4f0)['pipe'](fs[_0x34d3('0xc9')](path[_0x34d3('0xbe')](_0x483667,_0x504950[_0x34d3('0xca')])));}}}return BPromise[_0x34d3('0x88')]()[_0x34d3('0x28')](function(){return new BPromise(function(_0x16cb45,_0x1f6aaa){zipdir(_0x483667,{'saveTo':_0x55d9c0},function(_0x170423,_0x1da036){if(_0x170423)return _0x1f6aaa(_0x170423);return _0x16cb45(_0x1da036);});})[_0x34d3('0x28')](function(){return new BPromise(function(_0x208296,_0x335a1e){rimraf(_0x483667,function(_0x2f2ef9){if(_0x2f2ef9)_0x335a1e(_0x2f2ef9);return _0x208296();});});})['then'](function(){return _0x4ddc42[_0x34d3('0xbd')](_0x55d9c0,_0x3c82e2,function(_0x50afef){if(_0x50afef){console[_0x34d3('0xcb')](_0x34d3('0xcc'),_0x50afef);}else{fs['unlinkSync'](_0x55d9c0);}});});});}else{return _0x4ddc42[_0x34d3('0x1d')](0xc8);}})[_0x34d3('0x34')](handleError(_0x4ddc42,null));}; \ No newline at end of file +var _0x67b1=['../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','offset','limit','set','json','apply','reject','update','then','error','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','index','FaxInteraction','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','u.id\x20=\x20ui.UserId','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','$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','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId','buildExpression','body','start','some','compact','isEmpty','forEach','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','parse','$gte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','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','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','toString','count','sequelize','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','params','rawAttributes','includeAll','merge','options','create','destroy','describe','FaxMessage','ids','omit','getMessages','findOne','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','spread','emit','removeTags','join','root','server','files','tmp','attachments','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','pipe','download','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x67b1,0x191));var _0x167b=function(_0x4d9bb2,_0x3db50d){_0x4d9bb2=_0x4d9bb2-0x0;var _0x3179fe=_0x67b1[_0x4d9bb2];return _0x3179fe;};'use strict';var pdf=require(_0x167b('0x0'));var emlformat=require(_0x167b('0x1'));var rimraf=require(_0x167b('0x2'));var zipdir=require(_0x167b('0x3'));var jsonpatch=require(_0x167b('0x4'));var rp=require(_0x167b('0x5'));var moment=require(_0x167b('0x6'));var BPromise=require(_0x167b('0x7'));var Mustache=require(_0x167b('0x8'));var util=require('util');var path=require('path');var sox=require(_0x167b('0x9'));var csv=require(_0x167b('0xa'));var ejs=require(_0x167b('0xb'));var fs=require('fs');var _=require(_0x167b('0xc'));var squel=require('squel');var crypto=require(_0x167b('0xd'));var jsforce=require(_0x167b('0xe'));var deskjs=require(_0x167b('0xf'));var toCsv=require(_0x167b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x167b('0x10'));var authService=require(_0x167b('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x167b('0x12'));var logger=require(_0x167b('0x13'))(_0x167b('0x14'));var utils=require('../../config/utils');var config=require(_0x167b('0x15'));var db=require(_0x167b('0x16'))['db'];config[_0x167b('0x17')]=_[_0x167b('0x18')](config[_0x167b('0x17')],{'host':_0x167b('0x19'),'port':0x18eb});var socket=require(_0x167b('0x1a'))(new Redis(config[_0x167b('0x17')]));require(_0x167b('0x1b'))[_0x167b('0x1c')](socket);function respondWithStatusCode(_0x5d453b,_0x44e5e2){_0x44e5e2=_0x44e5e2||0xcc;return function(_0x847c4e){if(_0x847c4e){return _0x5d453b[_0x167b('0x1d')](_0x44e5e2);}return _0x5d453b[_0x167b('0x1e')](_0x44e5e2)[_0x167b('0x1f')]();};}function respondWithResult(_0x39efb5,_0x1d9dc6){_0x1d9dc6=_0x1d9dc6||0xc8;return function(_0x98e61b){if(_0x98e61b){return _0x39efb5[_0x167b('0x1e')](_0x1d9dc6)['json'](_0x98e61b);}};}function respondWithFilteredResult(_0x298653,_0x57b57f){return function(_0x35024f){if(_0x35024f){var _0x3f0b6b=_0x35024f['count'],_0x5c66bd=_0x57b57f[_0x167b('0x20')],_0x20e022=_0x57b57f[_0x167b('0x20')]+_0x57b57f[_0x167b('0x21')],_0x2010e1;if(_0x20e022>=_0x3f0b6b){_0x20e022=_0x3f0b6b;_0x2010e1=0xc8;}else{_0x2010e1=0xce;}_0x298653[_0x167b('0x1e')](_0x2010e1);return _0x298653[_0x167b('0x22')]('Content-Range',_0x5c66bd+'-'+_0x20e022+'/'+_0x3f0b6b)[_0x167b('0x23')](_0x35024f);}return null;};}function patchUpdates(_0x47ceb7){return function(_0x58319d){try{jsonpatch[_0x167b('0x24')](_0x58319d,_0x47ceb7,!![]);}catch(_0x196b09){return BPromise[_0x167b('0x25')](_0x196b09);}return _0x58319d['save']();};}function saveUpdates(_0x5a7d95,_0x1a6386){return function(_0x4326b8){if(_0x4326b8){return _0x4326b8[_0x167b('0x26')](_0x5a7d95)[_0x167b('0x27')](function(_0x25054a){return _0x25054a;});}return null;};}function removeEntity(_0x1e41f7,_0x208a68){return function(_0x456adb){if(_0x456adb){return _0x456adb['destroy']()[_0x167b('0x27')](function(){_0x1e41f7['status'](0xcc)[_0x167b('0x1f')]();});}};}function handleEntityNotFound(_0xe58fac,_0x5f5165){return function(_0x2b9968){if(!_0x2b9968){_0xe58fac[_0x167b('0x1d')](0x194);}return _0x2b9968;};}function handleError(_0x212a17,_0x15d1a0){_0x15d1a0=_0x15d1a0||0x1f4;return function(_0x4b2a42){logger[_0x167b('0x28')](_0x4b2a42['stack']);if(_0x4b2a42['name']){delete _0x4b2a42[_0x167b('0x29')];}_0x212a17[_0x167b('0x1e')](_0x15d1a0)[_0x167b('0x2a')](_0x4b2a42);};}function getInteractionUsers(_0x1803eb,_0x1586ad){return new BPromise(function(_0x2742d0,_0x166165){try{if(_0x1586ad[_0x1803eb['id']]){_0x1803eb[_0x167b('0x2b')]=_[_0x167b('0x2c')](_0x1586ad[_0x1803eb['id']],function(_0xcf269e){return{'id':_0xcf269e['id'],'fullname':_0xcf269e[_0x167b('0x2d')]};});}}catch(_0x59841d){_0x166165(_0x59841d);}_0x2742d0(_0x1803eb);});}function getInteractionTags(_0x8c1808,_0x189fff){return new BPromise(function(_0xcadbed,_0x430447){try{if(_0x8c1808[_0x167b('0x2e')]){_0x8c1808[_0x167b('0x2f')]=[];_0x8c1808[_0x167b('0x2e')][_0x167b('0x30')](',')['forEach'](function(_0x2c16c4){_0x8c1808[_0x167b('0x2f')][_0x167b('0x31')](_0x189fff[_0x2c16c4]);});}delete _0x8c1808['TagIds'];}catch(_0x3e4b73){_0x430447(_0x3e4b73);}_0xcadbed(_0x8c1808);});}function updateFaxInteraction(_0x1dd267,_0x4c1f82,_0x1e007a){return new BPromise(function(_0x3939c4,_0x59b686){return getInteractionUsers(_0x1dd267,_0x1e007a)['then'](function(_0x27fef0){return getInteractionTags(_0x27fef0,_0x4c1f82);})[_0x167b('0x27')](function(_0x545488){_0x3939c4(_0x545488);})[_0x167b('0x32')](function(_0x575b05){_0x59b686(_0x575b05);});});}exports[_0x167b('0x33')]=function(_0x20f576,_0x50850d){var _0x2c477f={},_0x58cf59={},_0x3d39de={'count':0x0,'rows':[]};var _0x3cadd4=_[_0x167b('0x2c')](db[_0x167b('0x34')]['rawAttributes'],function(_0xa6f3bc){return{'name':_0xa6f3bc[_0x167b('0x35')],'type':_0xa6f3bc[_0x167b('0x36')][_0x167b('0x37')]};});_0x58cf59[_0x167b('0x38')]=_[_0x167b('0x2c')](_0x3cadd4,'name');_0x58cf59[_0x167b('0x39')]=_[_0x167b('0x3a')](_0x20f576['query']);_0x58cf59[_0x167b('0x3b')]=_['intersection'](_0x58cf59['model'],_0x58cf59[_0x167b('0x39')]);_0x2c477f[_0x167b('0x3c')]=_[_0x167b('0x3d')](_0x58cf59['model'],qs[_0x167b('0x3e')](_0x20f576[_0x167b('0x39')][_0x167b('0x3e')]));_0x2c477f['attributes']=_0x2c477f[_0x167b('0x3c')][_0x167b('0x3f')]?_0x2c477f[_0x167b('0x3c')]:_0x58cf59[_0x167b('0x38')];if(!_0x20f576[_0x167b('0x39')]['hasOwnProperty']('nolimit')){_0x2c477f['limit']=qs[_0x167b('0x21')](_0x20f576['query'][_0x167b('0x21')]);_0x2c477f['offset']=qs['offset'](_0x20f576[_0x167b('0x39')][_0x167b('0x20')]);}_0x2c477f[_0x167b('0x40')]=qs[_0x167b('0x41')](_0x20f576[_0x167b('0x39')][_0x167b('0x41')]);_0x2c477f['where']=qs['filters'](_[_0x167b('0x42')](_0x20f576['query'],_0x58cf59[_0x167b('0x3b')]));var _0x33aa33=[];var _0x85bb60=squel[_0x167b('0x43')]()[_0x167b('0x44')]('id')[_0x167b('0x44')](_0x167b('0x29'))[_0x167b('0x44')](_0x167b('0x45'))[_0x167b('0x46')](_0x167b('0x47'));var _0x570f42=squel['select']()[_0x167b('0x44')](_0x167b('0x48'))['field'](_0x167b('0x49'))['field'](_0x167b('0x4a'))[_0x167b('0x46')](_0x167b('0x4b'),'ui')['left_join']('users','u',_0x167b('0x4c'));var _0x42c2bd=squel[_0x167b('0x43')]()[_0x167b('0x46')](_0x167b('0x4d'),'i')['left_join']('cm_contacts','c',_0x167b('0x4e'))[_0x167b('0x4f')](_0x167b('0x50'),'o',_0x167b('0x51'))[_0x167b('0x4f')]('fax_accounts','a',_0x167b('0x52'))[_0x167b('0x4f')]('fax_messages','me',_0x167b('0x53'))[_0x167b('0x4f')](_0x167b('0x54'),'it',_0x167b('0x55'))[_0x167b('0x4f')](_0x167b('0x47'),'t','t.id\x20=\x20it.TagId');var _0x5218fe=squel[_0x167b('0x56')]();var _0x56bade=[];var _0x4957a4=squel[_0x167b('0x56')]();var _0x2bb437;if(_0x20f576[_0x167b('0x39')]['search']){_0x2bb437=as[_0x167b('0x57')](_0x20f576[_0x167b('0x39')][_0x167b('0x58')]);var _0x149187=_0x2bb437[_0x167b('0x59')];for(var _0x4ec0fe=0x0;_0x4ec0fe<_0x2bb437[_0x167b('0x5a')][_0x167b('0x3f')];_0x4ec0fe++){var _0x3a53ea=_0x2bb437[_0x167b('0x5a')][_0x4ec0fe];var _0x30e5e0='i';var _0x55eb5d=_[_0x167b('0x5b')](_0x3cadd4,[_0x167b('0x29'),_0x3a53ea[_0x167b('0x44')]]);if(!_0x55eb5d){switch(_0x3a53ea['field']){case _0x167b('0x5c'):if(_0x3a53ea['value']==0x1){_0x42c2bd[_0x167b('0x5d')]('`'+_0x3a53ea['field']+_0x167b('0x5e'));}else{_0x42c2bd['having']('`'+_0x3a53ea[_0x167b('0x44')]+_0x167b('0x5f'));}break;case'Contact':if(_0x3a53ea['operator']===_0x167b('0x60')){if(_0x3a53ea[_0x167b('0x61')][_0x167b('0x30')]('\x20')[_0x167b('0x3f')]>0x1){_0x5218fe[_0x149187](_0x167b('0x62'),qs[_0x167b('0x63')](_0x3a53ea[_0x167b('0x61')]),null);}else{var _0x2a811e='%'+_0x3a53ea[_0x167b('0x61')]+'%';_0x5218fe[_0x149187](_0x167b('0x64'),_0x2a811e,_0x2a811e,_0x2a811e);}}else{_0x55eb5d=_[_0x167b('0x5b')](_0x3cadd4,[_0x167b('0x29'),'ContactId']);_0x3a53ea[_0x167b('0x44')]=_0x167b('0x65');_0x5e8a8c=as['buildExpression'](_0x30e5e0,_0x55eb5d['type'],_0x3a53ea);_0x5218fe[_0x149187](_0x5e8a8c[_0x167b('0x66')],_0x5e8a8c['value']['start'],_0x5e8a8c['value']['end']);}break;case _0x167b('0x67'):var _0x26b8e8=_0x3a53ea['value'][_0x167b('0x30')](',')[_0x167b('0x2c')](function(_0x323188){return Number(_0x323188);});_0x26b8e8['forEach'](function(_0x581c93){_0x4957a4['or'](_0x167b('0x68'),'%,'+_0x581c93+',%');});_0x56bade=_[_0x167b('0x69')](_0x56bade,_0x26b8e8);break;case _0x167b('0x6a'):if(_0x3a53ea[_0x167b('0x6b')]===_0x167b('0x60')){_0x5218fe[_0x149187]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3a53ea['value']+'%',null);}else{_0x55eb5d=_[_0x167b('0x5b')](_0x3cadd4,[_0x167b('0x29'),_0x167b('0x6c')]);_0x3a53ea[_0x167b('0x44')]='UserId';_0x5e8a8c=as[_0x167b('0x6d')](_0x30e5e0,_0x55eb5d[_0x167b('0x36')],_0x3a53ea);_0x5218fe[_0x149187](_0x5e8a8c['text'],_0x5e8a8c['value']['start'],_0x5e8a8c['value'][_0x167b('0x1f')]);}break;case _0x167b('0x6e'):_0x5e8a8c=as[_0x167b('0x6d')]('me',null,_0x3a53ea);_0x5218fe[_0x149187](_0x5e8a8c[_0x167b('0x66')],_0x5e8a8c[_0x167b('0x61')]['start'],_0x5e8a8c[_0x167b('0x61')][_0x167b('0x1f')]);break;}}else{var _0x5e8a8c=as['buildExpression'](_0x30e5e0,_0x55eb5d['type'],_0x3a53ea);_0x5218fe[_0x149187](_0x5e8a8c[_0x167b('0x66')],_0x5e8a8c[_0x167b('0x61')][_0x167b('0x6f')],_0x5e8a8c[_0x167b('0x61')][_0x167b('0x1f')]);}}}else{var _0x4547cd=_(_0x20f576[_0x167b('0x39')])[_0x167b('0x3a')]()['map'](function(_0x5a8065){return _[_0x167b('0x70')](_0x3cadd4,[_0x167b('0x29'),_0x5a8065])?_0x5a8065:undefined;})[_0x167b('0x71')]()[_0x167b('0x61')]();if(!_[_0x167b('0x72')](_0x4547cd)){_0x4547cd[_0x167b('0x73')](function(_0x2b4871){if(_0x2b4871===_0x167b('0x74')){_0x42c2bd[_0x167b('0x75')](_0x167b('0x76'),[]['concat'](_0x20f576['query'][_0x2b4871]));}else if(_0x2b4871==='createdAt'){var _0x62579a=JSON[_0x167b('0x77')](_0x20f576['query'][_0x2b4871])[_0x167b('0x78')];var _0xd3ef61=JSON['parse'](_0x20f576[_0x167b('0x39')][_0x2b4871])['$lte'];_0x42c2bd[_0x167b('0x75')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x62579a,_0xd3ef61);}else{if(_0x20f576['query'][_0x2b4871]===_0x167b('0x79')){_0x42c2bd[_0x167b('0x75')]('i.'+_0x2b4871+_0x167b('0x7a'));}else{_0x42c2bd[_0x167b('0x75')]('i.'+_0x2b4871+_0x167b('0x7b'),_0x20f576['query'][_0x2b4871]);}}});}if(_0x20f576['query']['read']){if(_0x20f576['query'][_0x167b('0x7c')]==0x1){_0x42c2bd[_0x167b('0x5d')](_0x167b('0x7d'));}else{_0x42c2bd['having'](_0x167b('0x7e'));}}if(_0x20f576['query'][_0x167b('0x7f')]){_0x56bade=_[_0x167b('0x80')](_0x20f576[_0x167b('0x39')][_0x167b('0x7f')])?_0x20f576[_0x167b('0x39')][_0x167b('0x7f')]:new Array(_0x20f576[_0x167b('0x39')][_0x167b('0x7f')]);_0x56bade[_0x167b('0x73')](function(_0x4dfc66){_0x4957a4['or'](_0x167b('0x68'),'%,'+_0x4dfc66+',%');});}if(_0x20f576['query'][_0x167b('0x81')]){var _0x1a2368=_0x20f576[_0x167b('0x39')][_0x167b('0x81')][_0x167b('0x82')]('\x5c','\x5c\x5c')[_0x167b('0x82')]('\x27\x27',_0x167b('0x83'));if(qs['isNumeric'](_0x1a2368)){_0x5218fe['or'](_0x167b('0x84'),_0x1a2368+'%')['or'](_0x167b('0x85'),_0x1a2368+'%');}_0x5218fe['or'](_0x167b('0x86'),_0x1a2368+'%');}}_0x42c2bd[_0x167b('0x75')](_0x5218fe);_0x42c2bd[_0x167b('0x87')](_0x167b('0x88'));var _0x3b8b4c={'type':db[_0x167b('0x89')][_0x167b('0x8a')][_0x167b('0x8b')],'raw':!![]};var _0x2beb3a=_0x42c2bd['clone']();_0x2beb3a[_0x167b('0x44')](_0x167b('0x88'));_0x2beb3a[_0x167b('0x44')](_0x167b('0x8c'),'unreadMessages');if(_0x2c477f['order']){_0x2c477f[_0x167b('0x40')][_0x167b('0x73')](function(_0x166b62){_0x42c2bd[_0x167b('0x40')]('i.'+_0x166b62[0x0],_0x166b62[0x1]===_0x167b('0x8d')?![]:!![]);});}if(!_[_0x167b('0x72')](_0x56bade)){_0x42c2bd[_0x167b('0x5d')](_0x4957a4);_0x2beb3a[_0x167b('0x75')](_0x167b('0x8e'),_0x56bade);}BPromise[_0x167b('0x8f')]()[_0x167b('0x27')](function(){if(!_0x2bb437){if(_0x20f576[_0x167b('0x39')][_0x167b('0x74')]||_0x20f576[_0x167b('0x39')][_0x167b('0x90')])return;_0x2beb3a[_0x167b('0x75')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x42c2bd[_0x167b('0x75')](_0x167b('0x91'));return;}return _0x20f576['user'][_0x167b('0x92')]({'attributes':['id'],'raw':!![]})[_0x167b('0x27')](function(_0x2129df){if(_[_0x167b('0x72')](_0x2129df)){_0x2beb3a[_0x167b('0x75')]('i.FaxAccountId\x20IS\x20NULL');_0x42c2bd[_0x167b('0x75')](_0x167b('0x93'));}else{_0x2beb3a[_0x167b('0x75')](_0x167b('0x76'),_[_0x167b('0x2c')](_0x2129df,'id'));_0x42c2bd['where'](_0x167b('0x76'),_['map'](_0x2129df,'id'));}});})[_0x167b('0x27')](function(){db['sequelize'][_0x167b('0x39')](_0x2beb3a[_0x167b('0x94')](),_0x3b8b4c)[_0x167b('0x27')](function(_0x3f49f2){_0x3d39de['count']=_0x3f49f2['length'];if(_0x3d39de[_0x167b('0x95')]===0x0)return[];return db[_0x167b('0x96')][_0x167b('0x39')](_0x85bb60[_0x167b('0x94')](),_0x3b8b4c)[_0x167b('0x27')](function(_0x185272){_0x33aa33=_['keyBy'](_0x185272,'id');_0x3b8b4c=_['merge'](_0x3b8b4c,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x20f576['query'][_0x167b('0x3e')]){_0x2c477f['attributes'][_0x167b('0x73')](function(_0x13b271){_0x42c2bd[_0x167b('0x44')]('i.'+_0x13b271);});}else{_0x42c2bd[_0x167b('0x44')](_0x167b('0x8c'),_0x167b('0x5c'));_0x42c2bd[_0x167b('0x44')](_0x167b('0x97'),_0x167b('0x98'));_0x42c2bd[_0x167b('0x44')](_0x167b('0x99'),_0x167b('0x9a'));_0x42c2bd['field'](_0x167b('0x9b'));_0x42c2bd[_0x167b('0x44')](_0x167b('0x9c'),_0x167b('0x9d'));_0x42c2bd[_0x167b('0x44')](_0x167b('0x9e'),'Contact.lastName');_0x42c2bd['field']('c.email',_0x167b('0x9f'));_0x42c2bd[_0x167b('0x44')](_0x167b('0xa0'),_0x167b('0xa1'));_0x42c2bd[_0x167b('0x44')](_0x167b('0xa2'),_0x167b('0xa3'));_0x42c2bd[_0x167b('0x44')](_0x167b('0xa4'),_0x167b('0xa5'));_0x42c2bd[_0x167b('0x44')](_0x167b('0xa6'),_0x167b('0xa7'));_0x42c2bd['field'](_0x167b('0xa8'),'Owner.internal');_0x42c2bd[_0x167b('0x44')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}_0x42c2bd[_0x167b('0x21')](_0x2c477f['limit']);_0x42c2bd[_0x167b('0x20')](_0x2c477f[_0x167b('0x20')]);return db[_0x167b('0x96')]['query'](_0x42c2bd[_0x167b('0x94')](),_0x3b8b4c);})[_0x167b('0x27')](function(_0x2bef81){_0x570f42[_0x167b('0x75')](_0x167b('0xa9'),_['map'](_0x2bef81,'id'));return db[_0x167b('0x96')][_0x167b('0x39')](_0x570f42[_0x167b('0x94')](),_0x3b8b4c)[_0x167b('0x27')](function(_0x580242){var _0x27444b=_[_0x167b('0xaa')](_0x580242,_0x167b('0xab'));var _0x28d8d8=[];_0x2bef81[_0x167b('0x73')](function(_0x5ec53c){_0x28d8d8['push'](updateFaxInteraction(_0x5ec53c,_0x33aa33,_0x27444b));});return BPromise[_0x167b('0xac')](_0x28d8d8);});});})['then'](function(_0xc1795c){_0x3d39de['rows']=_0xc1795c;return _0x3d39de;})[_0x167b('0x27')](respondWithFilteredResult(_0x50850d,_0x2c477f));})['catch'](handleError(_0x50850d,null));};exports['show']=function(_0x282e87,_0x55be13){var _0x489d3c={'raw':![],'where':{'id':_0x282e87[_0x167b('0xad')]['id']}},_0x19488a={};_0x19488a[_0x167b('0x38')]=_[_0x167b('0x3a')](db[_0x167b('0x34')][_0x167b('0xae')]);_0x19488a[_0x167b('0x39')]=_[_0x167b('0x3a')](_0x282e87['query']);_0x19488a[_0x167b('0x3b')]=_[_0x167b('0x3d')](_0x19488a[_0x167b('0x38')],_0x19488a['query']);_0x489d3c['attributes']=_[_0x167b('0x3d')](_0x19488a[_0x167b('0x38')],qs[_0x167b('0x3e')](_0x282e87[_0x167b('0x39')][_0x167b('0x3e')]));_0x489d3c['attributes']=_0x489d3c[_0x167b('0x3c')]['length']?_0x489d3c['attributes']:_0x19488a['model'];if(_0x282e87[_0x167b('0x39')][_0x167b('0xaf')]){_0x489d3c['include']=[{'all':!![]}];}_0x489d3c=_[_0x167b('0xb0')]({},_0x489d3c,_0x282e87[_0x167b('0xb1')]);return db[_0x167b('0x34')][_0x167b('0x5b')](_0x489d3c)[_0x167b('0x27')](handleEntityNotFound(_0x55be13,null))['then'](respondWithResult(_0x55be13,null))[_0x167b('0x32')](handleError(_0x55be13,null));};exports[_0x167b('0xb2')]=function(_0x22b12c,_0x4490f4){return db[_0x167b('0x34')]['create'](_0x22b12c[_0x167b('0x6e')],{})['then'](respondWithResult(_0x4490f4,0xc9))['catch'](handleError(_0x4490f4,null));};exports['update']=function(_0x140601,_0x9f0e2e){if(_0x140601['body']['id']){delete _0x140601[_0x167b('0x6e')]['id'];}return db[_0x167b('0x34')][_0x167b('0x5b')]({'where':{'id':_0x140601[_0x167b('0xad')]['id']}})[_0x167b('0x27')](handleEntityNotFound(_0x9f0e2e,null))[_0x167b('0x27')](saveUpdates(_0x140601[_0x167b('0x6e')],null))[_0x167b('0x27')](respondWithResult(_0x9f0e2e,null))[_0x167b('0x32')](handleError(_0x9f0e2e,null));};exports[_0x167b('0xb3')]=function(_0x5e5696,_0x3c57aa){return db[_0x167b('0x34')]['find']({'where':{'id':_0x5e5696[_0x167b('0xad')]['id']}})[_0x167b('0x27')](handleEntityNotFound(_0x3c57aa,null))[_0x167b('0x27')](removeEntity(_0x3c57aa,null))[_0x167b('0x32')](handleError(_0x3c57aa,null));};exports[_0x167b('0xb4')]=function(_0x5adf9b,_0x4d6bb6){return db[_0x167b('0x34')][_0x167b('0xb4')]()[_0x167b('0x27')](respondWithResult(_0x4d6bb6,null))['catch'](handleError(_0x4d6bb6,null));};exports['addMessage']=function(_0x38a1b6,_0xcdc525,_0x275c7e){return db[_0x167b('0xb5')][_0x167b('0x5b')]({'where':{'id':_0x38a1b6[_0x167b('0xad')]['id']}})['then'](handleEntityNotFound(_0xcdc525,null))[_0x167b('0x27')](function(_0x2450f8){if(_0x2450f8){return _0x2450f8['addMessage'](_0x38a1b6[_0x167b('0x6e')][_0x167b('0xb6')],_[_0x167b('0xb7')](_0x38a1b6[_0x167b('0x6e')],[_0x167b('0xb6'),'id'])||{});}})['then'](respondWithResult(_0xcdc525,null))[_0x167b('0x32')](handleError(_0xcdc525,null));};exports[_0x167b('0xb8')]=function(_0x534d90,_0xf4eb10,_0x199fa6){var _0x224348={'raw':![],'where':{}};var _0x4300c3={};var _0x299831={'count':0x0,'rows':[]};return db[_0x167b('0x34')][_0x167b('0xb9')]({'where':{'id':_0x534d90['params']['id']}})[_0x167b('0x27')](handleEntityNotFound(_0xf4eb10,null))[_0x167b('0x27')](function(_0x3c0164){if(_0x3c0164){_0x4300c3[_0x167b('0x38')]=_['keys'](db[_0x167b('0xb5')][_0x167b('0xae')]);_0x4300c3[_0x167b('0x39')]=_[_0x167b('0x3a')](_0x534d90['query']);_0x4300c3[_0x167b('0x3b')]=_[_0x167b('0x3d')](_0x4300c3['model'],_0x4300c3[_0x167b('0x39')]);_0x224348[_0x167b('0x3c')]=_[_0x167b('0x3d')](_0x4300c3['model'],qs[_0x167b('0x3e')](_0x534d90[_0x167b('0x39')][_0x167b('0x3e')]));_0x224348[_0x167b('0x3c')]=_0x224348[_0x167b('0x3c')][_0x167b('0x3f')]?_0x224348[_0x167b('0x3c')]:_0x4300c3['model'];if(!_0x534d90['query']['hasOwnProperty'](_0x167b('0xba'))){_0x224348[_0x167b('0x21')]=qs[_0x167b('0x21')](_0x534d90[_0x167b('0x39')][_0x167b('0x21')]);_0x224348[_0x167b('0x20')]=qs['offset'](_0x534d90[_0x167b('0x39')][_0x167b('0x20')]);}_0x224348[_0x167b('0x40')]=qs[_0x167b('0x41')](_0x534d90[_0x167b('0x39')][_0x167b('0x41')]);_0x224348[_0x167b('0x75')]=qs['filters'](_[_0x167b('0x42')](_0x534d90[_0x167b('0x39')],_0x4300c3[_0x167b('0x3b')]));_0x224348['where']['FaxInteractionId']=_0x3c0164['id'];if(_0x534d90['query']['filter']){_0x224348['where']=_[_0x167b('0xb0')](_0x224348['where'],{'$or':_['map'](_0x224348['attributes'],function(_0x12695e){var _0x4e3d8b={};_0x4e3d8b[_0x12695e]={'$like':'%'+_0x534d90[_0x167b('0x39')][_0x167b('0x81')]+'%'};return _0x4e3d8b;})});}if(_0x534d90['query'][_0x167b('0x78')]){var _0x20be65=_0x534d90['query'][_0x167b('0x78')][_0x167b('0x30')](',');var _0x3ecee8={};_0x3ecee8[_0x20be65[0x0]]={'$gte':moment(_0x20be65[0x1])[_0x167b('0xbb')](_0x167b('0xbc'))};_0x224348[_0x167b('0x75')]=_[_0x167b('0xb0')](_0x224348[_0x167b('0x75')],_0x3ecee8);}_0x224348=_['merge']({},_0x224348,_0x534d90[_0x167b('0xb1')]);return db[_0x167b('0xb5')][_0x167b('0x95')]({'where':_0x224348[_0x167b('0x75')]})['then'](function(_0x4e3216){_0x299831[_0x167b('0x95')]=_0x4e3216;if(_0x534d90[_0x167b('0x39')]['includeAll']){_0x224348['include']=[{'all':!![]}];}return db[_0x167b('0xb5')]['findAll'](_0x224348);})['then'](function(_0x5bf1cb){_0x299831['rows']=_0x5bf1cb;return _0x299831;});}})[_0x167b('0x27')](respondWithFilteredResult(_0xf4eb10,_0x224348))[_0x167b('0x32')](handleError(_0xf4eb10,null));};exports['addTags']=function(_0x59cd1c,_0x2b3ea8,_0x587490){return db[_0x167b('0x34')]['find']({'where':{'id':_0x59cd1c[_0x167b('0xad')]['id']}})[_0x167b('0x27')](handleEntityNotFound(_0x2b3ea8,null))[_0x167b('0x27')](function(_0x7d3c62){if(_0x7d3c62){return _0x7d3c62['setTags'](_0x59cd1c[_0x167b('0x6e')][_0x167b('0xb6')],_[_0x167b('0xb7')](_0x59cd1c[_0x167b('0x6e')],[_0x167b('0xb6'),'id'])||{})[_0x167b('0xbd')](function(){return db[_0x167b('0x67')]['findAll']({'attributes':['id',_0x167b('0x29'),_0x167b('0x45')],'where':{'id':_0x59cd1c[_0x167b('0x6e')][_0x167b('0xb6')]}});})[_0x167b('0x27')](function(_0x1a18f2){socket[_0x167b('0xbe')]('faxInteractionTags:save',{'id':Number(_0x59cd1c[_0x167b('0xad')]['id']),'tags':_0x1a18f2||[]});return{'id':Number(_0x59cd1c[_0x167b('0xad')]['id']),'tags':_0x1a18f2||[]};});}})[_0x167b('0x27')](respondWithResult(_0x2b3ea8,null))['catch'](handleError(_0x2b3ea8,null));};exports[_0x167b('0xbf')]=function(_0xb2d6f8,_0x2e5507,_0x39235b){return db[_0x167b('0x34')][_0x167b('0x5b')]({'where':{'id':_0xb2d6f8['params']['id']}})['then'](handleEntityNotFound(_0x2e5507,null))['then'](function(_0x29287b){if(_0x29287b){return _0x29287b[_0x167b('0xbf')](_0xb2d6f8[_0x167b('0x39')][_0x167b('0xb6')]);}})['then'](respondWithStatusCode(_0x2e5507,null))[_0x167b('0x32')](handleError(_0x2e5507,null));};exports['download']=function(_0x3d9e3a,_0x29a8c3){var _0x1994ea=moment()['unix']()[_0x167b('0x94')]();var _0x50655a=path[_0x167b('0xc0')](config[_0x167b('0xc1')],_0x167b('0xc2'),_0x167b('0xc3'),_0x167b('0xc4'));var _0x30c352=path[_0x167b('0xc0')](config[_0x167b('0xc1')],_0x167b('0xc2'),_0x167b('0xc3'),_0x167b('0xc5'));var _0x5cb3ed=path[_0x167b('0xc0')](_0x50655a,_0x1994ea);var _0x960c71=util[_0x167b('0xbb')]('transcript-%d-%s.zip',_0x3d9e3a[_0x167b('0xad')]['id'],_0x1994ea);var _0x68694e=path['join'](_0x50655a,_0x960c71);var _0x59cf4a=[];_0x59cf4a[_0x167b('0x31')]({'model':db[_0x167b('0xc6')],'as':_0x167b('0xc6'),'raw':!![]});var _0x8ba59f=[{'model':db[_0x167b('0xb5')],'as':_0x167b('0xc7'),'attributes':['id',_0x167b('0x6e'),_0x167b('0xc8')],'include':_0x59cf4a}];return db[_0x167b('0x34')]['find']({'where':{'id':_0x3d9e3a[_0x167b('0xad')]['id']},'include':_0x8ba59f})['then'](handleEntityNotFound(_0x29a8c3,null))[_0x167b('0x27')](function(_0x2e96d2){if(_0x2e96d2&&_0x2e96d2[_0x167b('0xc7')]){var _0x4b39a6=_0x2e96d2[_0x167b('0xc9')]({'plain':!![]});fs[_0x167b('0xca')](_0x5cb3ed);for(var _0x22f7b7=0x0;_0x22f7b7<_0x4b39a6[_0x167b('0xc7')][_0x167b('0x3f')];_0x22f7b7++){var _0x5f3b7e=_0x4b39a6['Messages'][_0x22f7b7]['Attachment'];if(_0x5f3b7e){var _0x1cb9b1=path[_0x167b('0xc0')](_0x30c352,_0x5f3b7e[_0x167b('0xcb')]);if(fs[_0x167b('0xcc')](_0x1cb9b1)){fs[_0x167b('0xcd')](_0x1cb9b1)[_0x167b('0xce')](fs['createWriteStream'](path[_0x167b('0xc0')](_0x5cb3ed,_0x5f3b7e['basename'])));}}}return BPromise[_0x167b('0x8f')]()[_0x167b('0x27')](function(){return new BPromise(function(_0x8e7767,_0x10ca0e){zipdir(_0x5cb3ed,{'saveTo':_0x68694e},function(_0x2e40ca,_0x3396e6){if(_0x2e40ca)return _0x10ca0e(_0x2e40ca);return _0x8e7767(_0x3396e6);});})[_0x167b('0x27')](function(){return new BPromise(function(_0x5994da,_0x389ae2){rimraf(_0x5cb3ed,function(_0x409e3b){if(_0x409e3b)_0x389ae2(_0x409e3b);return _0x5994da();});});})[_0x167b('0x27')](function(){return _0x29a8c3[_0x167b('0xcf')](_0x68694e,_0x960c71,function(_0x2d5ffe){if(_0x2d5ffe){console['log']('err',_0x2d5ffe);}else{fs[_0x167b('0xd0')](_0x68694e);}});});});}else{return _0x29a8c3[_0x167b('0x1d')](0xc8);}})[_0x167b('0x32')](handleError(_0x29a8c3,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index c2ef510..a324e32 100644 --- a/server/api/faxInteraction/faxInteraction.events.js +++ b/server/api/faxInteraction/faxInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x190f7d,_0x454aab){var _0x5a80ab=function(_0x37c8ab){while(--_0x37c8ab){_0x190f7d['push'](_0x190f7d['shift']());}};_0x5a80ab(++_0x454aab);}(_0x1261,0x144));var _0x1126=function(_0x54783e,_0xe85a52){_0x54783e=_0x54783e-0x0;var _0x4b03f4=_0x1261[_0x54783e];return _0x4b03f4;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var FaxMessage=require(_0x1126('0x0'))['db'][_0x1126('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1126('0x3')](0x0);var events={'afterCreate':_0x1126('0x4'),'afterUpdate':_0x1126('0x5'),'afterDestroy':_0x1126('0x6')};function emitEvent(_0x21a480){return function(_0x75a851,_0x5a2189,_0x5c68c8){_0x75a851[_0x1126('0x7')]({'attributes':['id'],'raw':!![]})[_0x1126('0x8')](function(_0x4f239c){_0x75a851[_0x1126('0x9')](_0x1126('0xa'),_0x4f239c[_0x1126('0xb')](function(_0x3abb0b){return{'id':_0x3abb0b['id']};}));return FaxMessage[_0x1126('0xc')]({'where':{'FaxInteractionId':_0x75a851['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f09ac){_0x75a851[_0x1126('0x9')](_0x1126('0xd'),_0x3f09ac['length']);FaxInteractionEvents[_0x1126('0xe')](_0x21a480+':'+_0x75a851['id'],_0x75a851);FaxInteractionEvents['emit'](_0x21a480,_0x75a851);_0x5c68c8(null);})['catch'](_0x5c68c8(null));};}for(var e in events){if(events[_0x1126('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x1126('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x2f9e52,_0x1357e1){var _0x4c031c=function(_0xc932db){while(--_0xc932db){_0x2f9e52['push'](_0x2f9e52['shift']());}};_0x4c031c(++_0x1357e1);}(_0x1261,0x144));var _0x1126=function(_0x1bfb48,_0x2de37a){_0x1bfb48=_0x1bfb48-0x0;var _0x1f432a=_0x1261[_0x1bfb48];return _0x1f432a;};'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 fbb8e6d..1714972 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 _0x22e8=['request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird'];(function(_0x31fe38,_0x5b42a4){var _0xd5639b=function(_0x3e3742){while(--_0x3e3742){_0x31fe38['push'](_0x31fe38['shift']());}};_0xd5639b(++_0x5b42a4);}(_0x22e8,0x11c));var _0x822e=function(_0x2d42e3,_0xf7136d){_0x2d42e3=_0x2d42e3-0x0;var _0x44c382=_0x22e8[_0x2d42e3];return _0x44c382;};'use strict';var _=require(_0x822e('0x0'));var util=require('util');var logger=require(_0x822e('0x1'))(_0x822e('0x2'));var moment=require(_0x822e('0x3'));var BPromise=require(_0x822e('0x4'));var rp=require(_0x822e('0x5'));var fs=require('fs');var path=require(_0x822e('0x6'));var rimraf=require(_0x822e('0x7'));var config=require(_0x822e('0x8'));var attributes=require(_0x822e('0x9'));module['exports']=function(_0xe973,_0x4d5d85){return _0xe973[_0x822e('0xa')](_0x822e('0xb'),attributes,{'tableName':_0x822e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2db238,_0x587417,_0x3665c8){if(_0x2db238[_0x822e('0xd')](_0x822e('0xe'))){_0x2db238[_0x822e('0xf')]=moment()['format'](_0x822e('0x10'));}_0x3665c8(null,_0x2db238);}}});}; \ No newline at end of file +var _0x61e5=['lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x381716,_0x2bc3f9){var _0x1677ab=function(_0x3cff81){while(--_0x3cff81){_0x381716['push'](_0x381716['shift']());}};_0x1677ab(++_0x2bc3f9);}(_0x61e5,0x195));var _0x561e=function(_0x3b0034,_0x3493ba){_0x3b0034=_0x3b0034-0x0;var _0x3e49bc=_0x61e5[_0x3b0034];return _0x3e49bc;};'use strict';var _=require(_0x561e('0x0'));var util=require(_0x561e('0x1'));var logger=require(_0x561e('0x2'))('api');var moment=require(_0x561e('0x3'));var BPromise=require(_0x561e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x561e('0x5'));var config=require(_0x561e('0x6'));var attributes=require(_0x561e('0x7'));module[_0x561e('0x8')]=function(_0x33f2b6,_0x228557){return _0x33f2b6[_0x561e('0x9')](_0x561e('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b89e8,_0x594878,_0x28c305){if(_0x4b89e8['changed'](_0x561e('0xb'))){_0x4b89e8[_0x561e('0xc')]=moment()[_0x561e('0xd')](_0x561e('0xe'));}_0x28c305(null,_0x4b89e8);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 0b13c85..cfbaeae 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 _0x2771=['defaults','localhost','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','update','body','raw','options','where','attributes','limit','UpdateFaxInteraction','catch','AddTagsToFaxInteraction','FaxInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x37f2a7,_0x4c881c){var _0x5d6541=function(_0x5ed84a){while(--_0x5ed84a){_0x37f2a7['push'](_0x37f2a7['shift']());}};_0x5d6541(++_0x4c881c);}(_0x2771,0x177));var _0x1277=function(_0x55d100,_0x19839d){_0x55d100=_0x55d100-0x0;var _0x1756e8=_0x2771[_0x55d100];return _0x1756e8;};'use strict';var _=require(_0x1277('0x0'));var util=require(_0x1277('0x1'));var moment=require(_0x1277('0x2'));var BPromise=require('bluebird');var rs=require(_0x1277('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1277('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1277('0x5'))(_0x1277('0x6'));var config=require(_0x1277('0x7'));var jayson=require(_0x1277('0x8'));var client=jayson[_0x1277('0x9')][_0x1277('0xa')]({'port':0x232a});config[_0x1277('0xb')]=_[_0x1277('0xc')](config[_0x1277('0xb')],{'host':_0x1277('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1277('0xb')]));require(_0x1277('0xe'))[_0x1277('0xf')](socket);function respondWithRpcPromise(_0x65bd50,_0x1fce8a,_0x3437fe){return new BPromise(function(_0x2e951c,_0x4db46d){return client[_0x1277('0x10')](_0x65bd50,_0x3437fe)[_0x1277('0x11')](function(_0x40112f){logger[_0x1277('0x12')](_0x1277('0x13'),_0x1fce8a,'request\x20sent');logger[_0x1277('0x14')](_0x1277('0x15'),_0x1fce8a,_0x1277('0x16'),JSON[_0x1277('0x17')](_0x40112f));if(_0x40112f[_0x1277('0x18')]){if(_0x40112f[_0x1277('0x18')]['code']===0x1f4){logger[_0x1277('0x18')](_0x1277('0x13'),_0x1fce8a,_0x40112f[_0x1277('0x18')]['message']);return _0x4db46d(_0x40112f['error'][_0x1277('0x19')]);}logger[_0x1277('0x18')](_0x1277('0x13'),_0x1fce8a,_0x40112f[_0x1277('0x18')]['message']);return _0x2e951c(_0x40112f['error'][_0x1277('0x19')]);}else{logger[_0x1277('0x12')](_0x1277('0x13'),_0x1fce8a,_0x1277('0x16'));_0x2e951c(_0x40112f[_0x1277('0x1a')]['message']);}})['catch'](function(_0x41aea5){logger[_0x1277('0x18')](_0x1277('0x13'),_0x1fce8a,_0x41aea5);_0x4db46d(_0x41aea5);});});}exports['UpdateFaxInteraction']=function(_0x43d993){var _0x51885b=this;return new Promise(function(_0x50fecb,_0x19ed73){return db['FaxInteraction'][_0x1277('0x1b')](_0x43d993[_0x1277('0x1c')],{'raw':_0x43d993['options']?_0x43d993['options'][_0x1277('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43d993[_0x1277('0x1e')]?_0x43d993[_0x1277('0x1e')][_0x1277('0x1f')]||null:null,'attributes':_0x43d993['options']?_0x43d993['options'][_0x1277('0x20')]||null:null,'limit':_0x43d993[_0x1277('0x1e')]?_0x43d993['options'][_0x1277('0x21')]||null:null})[_0x1277('0x11')](function(_0x346bb4){logger[_0x1277('0x12')](_0x1277('0x22'),_0x43d993);logger['debug']('UpdateFaxInteraction',_0x43d993,JSON[_0x1277('0x17')](_0x346bb4));_0x50fecb(_0x346bb4);})[_0x1277('0x23')](function(_0x5dc667){logger[_0x1277('0x18')]('UpdateFaxInteraction',_0x5dc667['message'],_0x43d993);_0x19ed73(_0x51885b[_0x1277('0x18')](0x1f4,_0x5dc667['message']));});});};exports[_0x1277('0x24')]=function(_0x1099be){return new Promise(function(_0x7b1772,_0x28d60f){return db[_0x1277('0x25')][_0x1277('0x26')]({'where':_0x1099be[_0x1277('0x1e')]?_0x1099be[_0x1277('0x1e')][_0x1277('0x1f')]||null:null})['then'](function(_0x3b8d61){if(_0x3b8d61){return _0x3b8d61[_0x1277('0x27')](_0x1099be['body'][_0x1277('0x28')],_['omit'](_0x1099be[_0x1277('0x1c')],[_0x1277('0x28'),'id'])||{});}})[_0x1277('0x29')](function(_0x590d96){logger['info'](_0x1277('0x2a'),_0x1099be);logger[_0x1277('0x14')](_0x1277('0x2a'),_0x1099be,JSON['stringify'](_0x590d96));_0x7b1772(_0x590d96);})['catch'](function(_0x110a29){logger[_0x1277('0x18')](_0x1277('0x2a'),_0x110a29[_0x1277('0x19')],_0x1099be);_0x28d60f(_this[_0x1277('0x18')](0x1f4,_0x110a29['message']));});});}; \ No newline at end of file +var _0x3cdc=['catch','UpdateFaxInteraction','options','raw','where','attributes','limit','stringify','AddTagsToFaxInteraction','FaxInteraction','find','then','body','ids','omit','spread','AddTags','util','moment','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./faxInteraction.socket','request','info','request\x20sent','debug','error','code','FaxInteraction,\x20%s,\x20%s','message'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x3cdc,0x10d));var _0xc3cd=function(_0x4b8df0,_0x5c59f1){_0x4b8df0=_0x4b8df0-0x0;var _0x2ad3fe=_0x3cdc[_0x4b8df0];return _0x2ad3fe;};'use strict';var _=require('lodash');var util=require(_0xc3cd('0x0'));var moment=require(_0xc3cd('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(_0xc3cd('0x2'));var logger=require(_0xc3cd('0x3'))('rpc');var config=require(_0xc3cd('0x4'));var jayson=require(_0xc3cd('0x5'));var client=jayson[_0xc3cd('0x6')][_0xc3cd('0x7')]({'port':0x232a});config[_0xc3cd('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc3cd('0x9'))(new Redis(config[_0xc3cd('0x8')]));require(_0xc3cd('0xa'))['register'](socket);function respondWithRpcPromise(_0x5b6ed8,_0x343f82,_0x3dcf57){return new BPromise(function(_0x2393c1,_0x15c8ce){return client[_0xc3cd('0xb')](_0x5b6ed8,_0x3dcf57)['then'](function(_0x59fd04){logger[_0xc3cd('0xc')]('FaxInteraction,\x20%s,\x20%s',_0x343f82,_0xc3cd('0xd'));logger[_0xc3cd('0xe')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x343f82,_0xc3cd('0xd'),JSON['stringify'](_0x59fd04));if(_0x59fd04[_0xc3cd('0xf')]){if(_0x59fd04[_0xc3cd('0xf')][_0xc3cd('0x10')]===0x1f4){logger['error'](_0xc3cd('0x11'),_0x343f82,_0x59fd04[_0xc3cd('0xf')]['message']);return _0x15c8ce(_0x59fd04[_0xc3cd('0xf')]['message']);}logger[_0xc3cd('0xf')]('FaxInteraction,\x20%s,\x20%s',_0x343f82,_0x59fd04[_0xc3cd('0xf')][_0xc3cd('0x12')]);return _0x2393c1(_0x59fd04['error']['message']);}else{logger[_0xc3cd('0xc')](_0xc3cd('0x11'),_0x343f82,_0xc3cd('0xd'));_0x2393c1(_0x59fd04['result'][_0xc3cd('0x12')]);}})[_0xc3cd('0x13')](function(_0x495e61){logger[_0xc3cd('0xf')](_0xc3cd('0x11'),_0x343f82,_0x495e61);_0x15c8ce(_0x495e61);});});}exports[_0xc3cd('0x14')]=function(_0x2a4951){var _0x429c73=this;return new Promise(function(_0x398597,_0x154043){return db['FaxInteraction']['update'](_0x2a4951['body'],{'raw':_0x2a4951[_0xc3cd('0x15')]?_0x2a4951['options'][_0xc3cd('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a4951[_0xc3cd('0x15')]?_0x2a4951[_0xc3cd('0x15')][_0xc3cd('0x17')]||null:null,'attributes':_0x2a4951[_0xc3cd('0x15')]?_0x2a4951[_0xc3cd('0x15')][_0xc3cd('0x18')]||null:null,'limit':_0x2a4951['options']?_0x2a4951[_0xc3cd('0x15')][_0xc3cd('0x19')]||null:null})['then'](function(_0xe2c297){logger[_0xc3cd('0xc')](_0xc3cd('0x14'),_0x2a4951);logger['debug'](_0xc3cd('0x14'),_0x2a4951,JSON[_0xc3cd('0x1a')](_0xe2c297));_0x398597(_0xe2c297);})['catch'](function(_0x455d50){logger[_0xc3cd('0xf')]('UpdateFaxInteraction',_0x455d50['message'],_0x2a4951);_0x154043(_0x429c73[_0xc3cd('0xf')](0x1f4,_0x455d50['message']));});});};exports[_0xc3cd('0x1b')]=function(_0x2b4ab6){return new Promise(function(_0x43fc66,_0x4e2ad3){return db[_0xc3cd('0x1c')][_0xc3cd('0x1d')]({'where':_0x2b4ab6[_0xc3cd('0x15')]?_0x2b4ab6[_0xc3cd('0x15')][_0xc3cd('0x17')]||null:null})[_0xc3cd('0x1e')](function(_0x36bfe8){if(_0x36bfe8){return _0x36bfe8['addTags'](_0x2b4ab6[_0xc3cd('0x1f')][_0xc3cd('0x20')],_[_0xc3cd('0x21')](_0x2b4ab6[_0xc3cd('0x1f')],[_0xc3cd('0x20'),'id'])||{});}})[_0xc3cd('0x22')](function(_0x339ee1){logger[_0xc3cd('0xc')]('AddTags',_0x2b4ab6);logger['debug'](_0xc3cd('0x23'),_0x2b4ab6,JSON[_0xc3cd('0x1a')](_0x339ee1));_0x43fc66(_0x339ee1);})['catch'](function(_0x523021){logger[_0xc3cd('0xf')](_0xc3cd('0x23'),_0x523021['message'],_0x2b4ab6);_0x4e2ad3(_this['error'](0x1f4,_0x523021[_0xc3cd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 28a7ab4..976ed03 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 _0xf241=['./faxInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0x591e16,_0x5aefc1){var _0x543b35=function(_0x81e3be){while(--_0x81e3be){_0x591e16['push'](_0x591e16['shift']());}};_0x543b35(++_0x5aefc1);}(_0xf241,0x98));var _0x1f24=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf241[_0x122ef9];return _0x42fba0;};'use strict';var FaxInteractionEvents=require(_0x1f24('0x0'));var events=[_0x1f24('0x1'),_0x1f24('0x2'),_0x1f24('0x3')];function createListener(_0x3d1bae,_0x4eb72e){return function(_0x2ef6c0){_0x4eb72e[_0x1f24('0x4')](_0x3d1bae,_0x2ef6c0);};}function removeListener(_0x253868,_0x9b1f8b){return function(){FaxInteractionEvents[_0x1f24('0x5')](_0x253868,_0x9b1f8b);};}exports[_0x1f24('0x6')]=function(_0x10e038){for(var _0x15e9af=0x0,_0x254784=events[_0x1f24('0x7')];_0x15e9af<_0x254784;_0x15e9af++){var _0x32f95b=events[_0x15e9af];var _0x58b50f=createListener('faxInteraction:'+_0x32f95b,_0x10e038);FaxInteractionEvents['on'](_0x32f95b,_0x58b50f);}}; \ No newline at end of file +var _0x3886=['length','faxInteraction:','./faxInteraction.events','save','remove','update','emit','register'];(function(_0x1050a8,_0x3c4fc7){var _0xaff181=function(_0x192ec8){while(--_0x192ec8){_0x1050a8['push'](_0x1050a8['shift']());}};_0xaff181(++_0x3c4fc7);}(_0x3886,0xc2));var _0x6388=function(_0xe6d6c3,_0x32baad){_0xe6d6c3=_0xe6d6c3-0x0;var _0x5a4fbb=_0x3886[_0xe6d6c3];return _0x5a4fbb;};'use strict';var FaxInteractionEvents=require(_0x6388('0x0'));var events=[_0x6388('0x1'),_0x6388('0x2'),_0x6388('0x3')];function createListener(_0x3e6046,_0x2a0d45){return function(_0x3774ed){_0x2a0d45[_0x6388('0x4')](_0x3e6046,_0x3774ed);};}function removeListener(_0x4f0b25,_0x2fef89){return function(){FaxInteractionEvents['removeListener'](_0x4f0b25,_0x2fef89);};}exports[_0x6388('0x5')]=function(_0x5b98aa){for(var _0x18b0ed=0x0,_0x5b9533=events[_0x6388('0x6')];_0x18b0ed<_0x5b9533;_0x18b0ed++){var _0x18408c=events[_0x18b0ed];var _0x35af1f=createListener(_0x6388('0x7')+_0x18408c,_0x5b98aa);FaxInteractionEvents['on'](_0x18408c,_0x35af1f);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index b2b5b10..9eb337d 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 _0xc8d9=['isAuthenticated','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','faxinteraction:addtags','put','fax','faxinteraction:update','update','delete','destroy','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','describe','/:id'];(function(_0x1be7bf,_0x4fdcef){var _0x1c69e8=function(_0x37a066){while(--_0x37a066){_0x1be7bf['push'](_0x1be7bf['shift']());}};_0x1c69e8(++_0x4fdcef);}(_0xc8d9,0xce));var _0x9c8d=function(_0x393500,_0x1037af){_0x393500=_0x393500-0x0;var _0x120d3b=_0xc8d9[_0x393500];return _0x120d3b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9c8d('0x0'));var router=express['Router']();var auth=require(_0x9c8d('0x1'));var interaction=require(_0x9c8d('0x2'));var config=require(_0x9c8d('0x3'));var controller=require(_0x9c8d('0x4'));router[_0x9c8d('0x5')]('/',auth['isAuthenticated'](),controller[_0x9c8d('0x6')]);router[_0x9c8d('0x5')](_0x9c8d('0x7'),auth['isAuthenticated'](),controller[_0x9c8d('0x8')]);router[_0x9c8d('0x5')](_0x9c8d('0x9'),auth[_0x9c8d('0xa')](),controller[_0x9c8d('0xb')]);router['get'](_0x9c8d('0xc'),auth[_0x9c8d('0xa')](),controller[_0x9c8d('0xd')]);router['get'](_0x9c8d('0xe'),auth['isAuthenticated'](),controller[_0x9c8d('0xf')]);router[_0x9c8d('0x10')]('/',auth[_0x9c8d('0xa')](),controller[_0x9c8d('0x11')]);router[_0x9c8d('0x10')](_0x9c8d('0xc'),auth['isAuthenticated'](),controller['addMessage']);router[_0x9c8d('0x10')](_0x9c8d('0x12'),auth[_0x9c8d('0xa')](),interaction[_0x9c8d('0x13')]('fax',_0x9c8d('0x14')),controller['addTags']);router[_0x9c8d('0x15')](_0x9c8d('0x9'),auth[_0x9c8d('0xa')](),interaction['tracked'](_0x9c8d('0x16'),_0x9c8d('0x17')),controller[_0x9c8d('0x18')]);router[_0x9c8d('0x19')](_0x9c8d('0x9'),auth[_0x9c8d('0xa')](),interaction[_0x9c8d('0x13')](_0x9c8d('0x16'),'faxinteraction:destroy'),controller[_0x9c8d('0x1a')]);router['delete']('/:id/tags',auth[_0x9c8d('0xa')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xefe5=['put','faxinteraction:update','delete','destroy','removeTags','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags'];(function(_0x99868f,_0xbdb8e7){var _0x27a71b=function(_0x41feca){while(--_0x41feca){_0x99868f['push'](_0x99868f['shift']());}};_0x27a71b(++_0xbdb8e7);}(_0xefe5,0xf6));var _0x5efe=function(_0x2128c1,_0x13e12a){_0x2128c1=_0x2128c1-0x0;var _0x51d6e9=_0xefe5[_0x2128c1];return _0x51d6e9;};'use strict';var multer=require(_0x5efe('0x0'));var util=require('util');var path=require(_0x5efe('0x1'));var timeout=require(_0x5efe('0x2'));var express=require('express');var router=express[_0x5efe('0x3')]();var auth=require(_0x5efe('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5efe('0x5'));var controller=require('./faxInteraction.controller');router[_0x5efe('0x6')]('/',auth[_0x5efe('0x7')](),controller[_0x5efe('0x8')]);router[_0x5efe('0x6')](_0x5efe('0x9'),auth['isAuthenticated'](),controller[_0x5efe('0xa')]);router[_0x5efe('0x6')](_0x5efe('0xb'),auth[_0x5efe('0x7')](),controller[_0x5efe('0xc')]);router[_0x5efe('0x6')](_0x5efe('0xd'),auth[_0x5efe('0x7')](),controller[_0x5efe('0xe')]);router['get'](_0x5efe('0xf'),auth[_0x5efe('0x7')](),controller[_0x5efe('0x10')]);router[_0x5efe('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x5efe('0xd'),auth[_0x5efe('0x7')](),controller[_0x5efe('0x12')]);router[_0x5efe('0x11')](_0x5efe('0x13'),auth[_0x5efe('0x7')](),interaction[_0x5efe('0x14')](_0x5efe('0x15'),_0x5efe('0x16')),controller[_0x5efe('0x17')]);router[_0x5efe('0x18')]('/:id',auth[_0x5efe('0x7')](),interaction[_0x5efe('0x14')](_0x5efe('0x15'),_0x5efe('0x19')),controller['update']);router[_0x5efe('0x1a')](_0x5efe('0xb'),auth['isAuthenticated'](),interaction[_0x5efe('0x14')](_0x5efe('0x15'),'faxinteraction:destroy'),controller[_0x5efe('0x1b')]);router[_0x5efe('0x1a')]('/:id/tags',auth['isAuthenticated'](),controller[_0x5efe('0x1c')]);module[_0x5efe('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index a5f3370..7e2ed75 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 _0x33f5=['BOOLEAN','ENUM','out','TEXT','sequelize','exports','medium'];(function(_0x1318f8,_0x3a4626){var _0x284b66=function(_0x470f16){while(--_0x470f16){_0x1318f8['push'](_0x1318f8['shift']());}};_0x284b66(++_0x3a4626);}(_0x33f5,0x177));var _0x533f=function(_0x216447,_0x148572){_0x216447=_0x216447-0x0;var _0x4c063a=_0x33f5[_0x216447];return _0x4c063a;};'use strict';var Sequelize=require(_0x533f('0x0'));module[_0x533f('0x1')]={'body':{'type':Sequelize['TEXT'](_0x533f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x533f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x533f('0x4')]('in',_0x533f('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x533f('0x6')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x3a0e=['out','DATE','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0x5ac4d2,_0x2b0898){var _0x11a28f=function(_0x2c6e35){while(--_0x2c6e35){_0x5ac4d2['push'](_0x5ac4d2['shift']());}};_0x11a28f(++_0x2b0898);}(_0x3a0e,0xb1));var _0xe3a0=function(_0x18e9ef,_0x2943ec){_0x18e9ef=_0x18e9ef-0x0;var _0x1b9dde=_0x3a0e[_0x18e9ef];return _0x1b9dde;};'use strict';var Sequelize=require(_0xe3a0('0x0'));module[_0xe3a0('0x1')]={'body':{'type':Sequelize['TEXT'](_0xe3a0('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xe3a0('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe3a0('0x4')]('in',_0xe3a0('0x5')),'defaultValue':_0xe3a0('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xe3a0('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 5acb82e..355b15d 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 _0xa9e0=['format','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','AcceptMessage','acceptMessage','interface','channel','event','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','EventManager','rejectmessage','create','findOne','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','join','server','files','attachments','Attachment','download','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','redis','defaults','localhost','socket.io-emitter','./faxMessage.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','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','name','options','FaxMessage','includeAll','include','findAll','rows','show','intersection','find','body','params','describe','../../config/logger','fax-interactions','accept','fax','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','FaxInteraction','isNil','read1stAt'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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'];config[_0x0a9e('0x14')]=_[_0x0a9e('0x15')](config[_0x0a9e('0x14')],{'host':_0x0a9e('0x16'),'port':0x18eb});var socket=require(_0x0a9e('0x17'))(new Redis(config['redis']));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson[_0x0a9e('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x22dccb,_0x5d0880,_0x1985b6){if(_0x1985b6){var _0x519dfd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x519dfd[_0x0a9e('0x1d')](_0x5d0880)){return _0x22dccb;}else{throw new db[(_0x0a9e('0x1e'))]['ValidationError'](_0x0a9e('0x1f'));}}else{return _0x22dccb;}}function respondWithRpcPromise(_0x5a0a06,_0x459eb1,_0x478723,_0x106033){return new BPromise(function(_0x205fd6,_0x31b1ca){var _0x2eb11f=_0x106033||client;return _0x2eb11f[_0x0a9e('0x20')](_0x5a0a06,_0x478723)[_0x0a9e('0x21')](function(_0x1314ae){logger[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x459eb1,_0x0a9e('0x24'));logger['debug'](_0x0a9e('0x25'),_0x459eb1,_0x0a9e('0x24'),JSON['stringify'](_0x1314ae));if(_0x1314ae[_0x0a9e('0x26')]){if(_0x1314ae['error']['code']===0x1f4){logger[_0x0a9e('0x26')](_0x0a9e('0x23'),_0x459eb1,_0x1314ae[_0x0a9e('0x26')][_0x0a9e('0x27')]);return _0x31b1ca(_0x1314ae['error'][_0x0a9e('0x27')]);}logger[_0x0a9e('0x26')](_0x0a9e('0x23'),_0x459eb1,_0x1314ae[_0x0a9e('0x26')][_0x0a9e('0x27')]);return _0x205fd6(_0x1314ae[_0x0a9e('0x26')][_0x0a9e('0x27')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x459eb1,_0x0a9e('0x24'));_0x205fd6(_0x1314ae[_0x0a9e('0x28')][_0x0a9e('0x27')]);}})[_0x0a9e('0x29')](function(_0x526cf3){logger[_0x0a9e('0x26')]('FaxMessage,\x20%s,\x20%s',_0x459eb1,_0x526cf3);_0x31b1ca(_0x526cf3);});});}function respondWithStatusCode(_0x45a1e7,_0x5bfb33){_0x5bfb33=_0x5bfb33||0xcc;return function(_0x1dc186){if(_0x1dc186){return _0x45a1e7[_0x0a9e('0x2a')](_0x5bfb33);}return _0x45a1e7[_0x0a9e('0x2b')](_0x5bfb33)[_0x0a9e('0x2c')]();};}function respondWithResult(_0x140511,_0x1538a4){_0x1538a4=_0x1538a4||0xc8;return function(_0x11c3b6){if(_0x11c3b6){return _0x140511[_0x0a9e('0x2b')](_0x1538a4)['json'](_0x11c3b6);}};}function respondWithFilteredResult(_0x3652a7,_0x468813){return function(_0x2b1f27){if(_0x2b1f27){var _0x2ec755=_0x2b1f27[_0x0a9e('0x2d')],_0x5c877d=_0x468813[_0x0a9e('0x2e')],_0x15b200=_0x468813[_0x0a9e('0x2e')]+_0x468813[_0x0a9e('0x2f')],_0x40e7a3;if(_0x15b200>=_0x2ec755){_0x15b200=_0x2ec755;_0x40e7a3=0xc8;}else{_0x40e7a3=0xce;}_0x3652a7[_0x0a9e('0x2b')](_0x40e7a3);return _0x3652a7[_0x0a9e('0x30')](_0x0a9e('0x31'),_0x5c877d+'-'+_0x15b200+'/'+_0x2ec755)['json'](_0x2b1f27);}return null;};}function patchUpdates(_0x426950){return function(_0x5d1e0e){try{jsonpatch[_0x0a9e('0x32')](_0x5d1e0e,_0x426950,!![]);}catch(_0x3ae878){return BPromise[_0x0a9e('0x33')](_0x3ae878);}return _0x5d1e0e[_0x0a9e('0x34')]();};}function saveUpdates(_0x25ce3a,_0x5180f1){return function(_0x66c1d2){if(_0x66c1d2){return _0x66c1d2[_0x0a9e('0x35')](_0x25ce3a)[_0x0a9e('0x21')](function(_0x2da5c0){return _0x2da5c0;});}return null;};}function removeEntity(_0x2b45ea,_0x409319){return function(_0x332d35){if(_0x332d35){return _0x332d35[_0x0a9e('0x36')]()['then'](function(){_0x2b45ea[_0x0a9e('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cc7a0,_0x14b13f){return function(_0x2b7e7f){if(!_0x2b7e7f){_0x2cc7a0[_0x0a9e('0x2a')](0x194);}return _0x2b7e7f;};}function handleError(_0x567193,_0x191e91){_0x191e91=_0x191e91||0x1f4;return function(_0xd1836d){logger[_0x0a9e('0x26')](_0xd1836d[_0x0a9e('0x37')]);if(_0xd1836d['name']){delete _0xd1836d['name'];}_0x567193[_0x0a9e('0x2b')](_0x191e91)['send'](_0xd1836d);};}exports[_0x0a9e('0x38')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x39')](db['FaxMessage'][_0x0a9e('0x3a')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x3b')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x3c')]=_[_0x0a9e('0x39')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x3d9717[_0x0a9e('0x3d')]);_0x4f41ae[_0x0a9e('0x3f')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x3d')]);_0x1ef87a[_0x0a9e('0x40')]=_['intersection'](_0x4f41ae[_0x0a9e('0x3c')],qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x3d')]['fields']));_0x1ef87a[_0x0a9e('0x40')]=_0x1ef87a[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x1ef87a[_0x0a9e('0x40')]:_0x4f41ae[_0x0a9e('0x3c')];if(!_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x43')](_0x0a9e('0x44'))){_0x1ef87a[_0x0a9e('0x2f')]=qs[_0x0a9e('0x2f')](_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x2f')]);_0x1ef87a[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x3d9717[_0x0a9e('0x3d')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x45')](_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x45')]);_0x1ef87a[_0x0a9e('0x46')]=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x47')](_0x3d9717[_0x0a9e('0x3d')],_0x4f41ae[_0x0a9e('0x3f')]));if(_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x48')]){_0x1ef87a[_0x0a9e('0x46')]=_[_0x0a9e('0x49')](_0x1ef87a['where'],{'$or':_[_0x0a9e('0x39')](_0x3bfce8,function(_0x138b8b){if(_0x138b8b[_0x0a9e('0x4a')]!==_0x0a9e('0x4b')){var _0x2e8caf={};_0x2e8caf[_0x138b8b[_0x0a9e('0x4c')]]={'$like':'%'+_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x48')]+'%'};return _0x2e8caf;}})});}_0x1ef87a=_['merge']({},_0x1ef87a,_0x3d9717[_0x0a9e('0x4d')]);var _0x48fd45={'where':_0x1ef87a[_0x0a9e('0x46')]};return db[_0x0a9e('0x4e')][_0x0a9e('0x2d')](_0x48fd45)['then'](function(_0x14bec2){_0x31916f[_0x0a9e('0x2d')]=_0x14bec2;if(_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x4f')]){_0x1ef87a[_0x0a9e('0x50')]=[{'all':!![]}];}return db[_0x0a9e('0x4e')][_0x0a9e('0x51')](_0x1ef87a);})['then'](function(_0x13f44d){_0x31916f[_0x0a9e('0x52')]=_0x13f44d;return _0x31916f;})[_0x0a9e('0x21')](respondWithFilteredResult(_0x381c37,_0x1ef87a))[_0x0a9e('0x29')](handleError(_0x381c37,null));};exports[_0x0a9e('0x53')]=function(_0x992c77,_0x6054ee){var _0x19383e={'raw':!![],'where':{'id':_0x992c77['params']['id']}},_0x34febd={};_0x34febd[_0x0a9e('0x3c')]=_[_0x0a9e('0x3e')](db['FaxMessage']['rawAttributes']);_0x34febd['query']=_[_0x0a9e('0x3e')](_0x992c77[_0x0a9e('0x3d')]);_0x34febd[_0x0a9e('0x3f')]=_[_0x0a9e('0x54')](_0x34febd[_0x0a9e('0x3c')],_0x34febd[_0x0a9e('0x3d')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x54')](_0x34febd['model'],qs['fields'](_0x992c77['query'][_0x0a9e('0x41')]));_0x19383e[_0x0a9e('0x40')]=_0x19383e[_0x0a9e('0x40')]['length']?_0x19383e[_0x0a9e('0x40')]:_0x34febd[_0x0a9e('0x3c')];if(_0x992c77['query']['includeAll']){_0x19383e[_0x0a9e('0x50')]=[{'all':!![]}];}_0x19383e=_['merge']({},_0x19383e,_0x992c77[_0x0a9e('0x4d')]);return db['FaxMessage'][_0x0a9e('0x55')](_0x19383e)[_0x0a9e('0x21')](handleEntityNotFound(_0x6054ee,null))[_0x0a9e('0x21')](respondWithResult(_0x6054ee,null))['catch'](handleError(_0x6054ee,null));};exports[_0x0a9e('0x35')]=function(_0x1bf38a,_0x508b47){if(_0x1bf38a['body']['id']){delete _0x1bf38a[_0x0a9e('0x56')]['id'];}return db[_0x0a9e('0x4e')]['find']({'where':{'id':_0x1bf38a[_0x0a9e('0x57')]['id']}})['then'](handleEntityNotFound(_0x508b47,null))[_0x0a9e('0x21')](saveUpdates(_0x1bf38a['body'],null))[_0x0a9e('0x21')](respondWithResult(_0x508b47,null))['catch'](handleError(_0x508b47,null));};exports['destroy']=function(_0x5df0ad,_0x2da03c){return db['FaxMessage'][_0x0a9e('0x55')]({'where':{'id':_0x5df0ad[_0x0a9e('0x57')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x2da03c,null))[_0x0a9e('0x21')](removeEntity(_0x2da03c,null))[_0x0a9e('0x29')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x58')]=function(_0xd10662,_0x28d814){return db['FaxMessage'][_0x0a9e('0x58')]()[_0x0a9e('0x21')](respondWithResult(_0x28d814,null))[_0x0a9e('0x29')](handleError(_0x28d814,null));};var interaction_log=require(_0x0a9e('0x59'))(_0x0a9e('0x5a'));exports[_0x0a9e('0x5b')]=function(_0x5d86e9,_0x956fbe,_0x26bc80){var _0x5239ef={'channel':_0x0a9e('0x5c')};if(_0x5d86e9['body']['id']){delete _0x5d86e9[_0x0a9e('0x56')]['id'];}_0x5d86e9['body']['read']=!![];_0x5d86e9['body'][_0x0a9e('0x5d')]=moment()['format'](_0x0a9e('0x5e'));_0x5d86e9[_0x0a9e('0x56')][_0x0a9e('0x5f')]=_0x5d86e9[_0x0a9e('0x56')][_0x0a9e('0x5f')]||_0x5d86e9[_0x0a9e('0x60')]['id'];return db['FaxMessage'][_0x0a9e('0x55')]({'where':{'id':_0x5d86e9['params']['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x61')],'as':_0x0a9e('0x62')}]})[_0x0a9e('0x21')](handleEntityNotFound(_0x956fbe,null))['then'](saveUpdates(_0x5d86e9[_0x0a9e('0x56')],null))[_0x0a9e('0x21')](function(_0x119677){if(_0x119677){_0x5239ef[_0x0a9e('0x27')]=_0x119677['get']({'plain':!![]});return db[_0x0a9e('0x63')][_0x0a9e('0x55')]({'where':{'id':_0x119677['FaxInteractionId']}});}return null;})[_0x0a9e('0x21')](handleEntityNotFound(_0x956fbe,null))[_0x0a9e('0x21')](function(_0x88dcbf){if(_0x88dcbf){return _0x88dcbf[_0x0a9e('0x35')]({'UserId':_0x5d86e9[_0x0a9e('0x56')]['UserId'],'read1stAt':_[_0x0a9e('0x64')](_0x88dcbf[_0x0a9e('0x65')])?moment()[_0x0a9e('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0a9e('0x21')](function(_0x4f1e60){if(_0x4f1e60){_0x5239ef['interaction']=_0x4f1e60[_0x0a9e('0x67')]({'plain':!![]});interaction_log[_0x0a9e('0x22')](_0x0a9e('0x68'),_0x5d86e9[_0x0a9e('0x60')]['id'],_0x5d86e9[_0x0a9e('0x60')][_0x0a9e('0x4c')],_0x5d86e9[_0x0a9e('0x60')][_0x0a9e('0x69')],_0x5239ef[_0x0a9e('0x6a')]['id'],_0x5d86e9[_0x0a9e('0x56')]?JSON[_0x0a9e('0x6b')](_0x5d86e9[_0x0a9e('0x56')]):_0x0a9e('0x6c'));return respondWithRpcPromise(_0x0a9e('0x6d'),_0x0a9e('0x6e'),_0x5239ef);}return null;})[_0x0a9e('0x21')](function(_0x2a28c0){if(_0x2a28c0){if(_0x5d86e9[_0x0a9e('0x56')]['manual']){_0x5239ef[_0x0a9e('0x27')][_0x0a9e('0x6f')]=util[_0x0a9e('0x66')]('SIP/%s',_0x5d86e9[_0x0a9e('0x60')][_0x0a9e('0x4c')]);_0x5239ef['message'][_0x0a9e('0x70')]=_0x5239ef[_0x0a9e('0x70')];_0x5239ef[_0x0a9e('0x27')][_0x0a9e('0x71')]=_0x0a9e('0x5b');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x5239ef[_0x0a9e('0x27')]},client9002)[_0x0a9e('0x21')](function(){return _0x5239ef;});}return _0x5239ef;}return null;})[_0x0a9e('0x21')](respondWithResult(_0x956fbe,null))[_0x0a9e('0x29')](handleError(_0x956fbe,null));};var interaction_log=require(_0x0a9e('0x59'))(_0x0a9e('0x5a'));exports[_0x0a9e('0x33')]=function(_0x1a0677,_0x5512d1,_0x235f8f){var _0xcbc8b2={'agent':{},'channel':_0x0a9e('0x5c')};if(_0x1a0677['body']['id']){delete _0x1a0677[_0x0a9e('0x56')]['id'];}_0x1a0677['body'][_0x0a9e('0x5f')]=_0x1a0677[_0x0a9e('0x56')]['UserId']||_0x1a0677[_0x0a9e('0x60')]['id'];_0xcbc8b2[_0x0a9e('0x72')]['id']=_0x1a0677[_0x0a9e('0x56')][_0x0a9e('0x5f')];return db['FaxMessage'][_0x0a9e('0x55')]({'where':{'id':_0x1a0677[_0x0a9e('0x57')]['id'],'UserId':null}})[_0x0a9e('0x21')](handleEntityNotFound(_0x5512d1,null))[_0x0a9e('0x21')](function(_0x5b7fc3){if(_0x5b7fc3){_0xcbc8b2[_0x0a9e('0x27')]=_0x5b7fc3[_0x0a9e('0x67')]({'plain':!![]});return db[_0x0a9e('0x63')][_0x0a9e('0x55')]({'where':{'id':_0x5b7fc3['FaxInteractionId']}});}return null;})[_0x0a9e('0x21')](handleEntityNotFound(_0x5512d1,null))[_0x0a9e('0x21')](function(_0x30a4c7){if(_0x30a4c7){_0xcbc8b2[_0x0a9e('0x6a')]=_0x30a4c7[_0x0a9e('0x67')]({'plain':!![]});interaction_log[_0x0a9e('0x22')](_0x0a9e('0x73'),_0x1a0677[_0x0a9e('0x60')]['id'],_0x1a0677[_0x0a9e('0x60')][_0x0a9e('0x4c')],_0x1a0677[_0x0a9e('0x60')][_0x0a9e('0x69')],_0xcbc8b2[_0x0a9e('0x6a')]['id'],_0x1a0677[_0x0a9e('0x56')]?JSON['stringify'](_0x1a0677[_0x0a9e('0x56')]):_0x0a9e('0x6c'));return respondWithRpcPromise(_0x0a9e('0x74'),'rejectMessage',_0xcbc8b2);}return null;})[_0x0a9e('0x21')](function(_0x33dda0){if(_0x33dda0){_0x33dda0[_0x0a9e('0x27')][_0x0a9e('0x6f')]=util['format']('SIP/%s',_0x1a0677[_0x0a9e('0x60')][_0x0a9e('0x4c')]);_0x33dda0['message'][_0x0a9e('0x70')]=_0xcbc8b2['channel'];_0x33dda0[_0x0a9e('0x27')][_0x0a9e('0x71')]='reject';respondWithRpcPromise(_0x0a9e('0x75'),_0x0a9e('0x75'),{'event':_0x0a9e('0x76'),'message':_0x33dda0[_0x0a9e('0x27')]},client9002);return _0xcbc8b2;}return null;})[_0x0a9e('0x21')](respondWithResult(_0x5512d1,null))[_0x0a9e('0x29')](handleError(_0x5512d1,null));};exports[_0x0a9e('0x77')]=function(_0x482ca2,_0x2973d3){var _0x3ca9b9;return db[_0x0a9e('0x4e')][_0x0a9e('0x77')](_0x482ca2['body'],{})[_0x0a9e('0x21')](function(_0xf0db1){_0x3ca9b9=_0xf0db1;return db['CmContact'][_0x0a9e('0x78')]({'where':{'id':_0x3ca9b9['ContactId']}});})[_0x0a9e('0x21')](function(_0x2bb25a){if(_[_0x0a9e('0x64')](_0x2bb25a)){return;}else{_0x3ca9b9[_0x0a9e('0x5c')]=_0x2bb25a['fax'];return db['Attachment'][_0x0a9e('0x78')]({'where':{'id':_0x3ca9b9[_0x0a9e('0x79')]}});}})[_0x0a9e('0x21')](function(_0x5ac73d){return respondWithRpcPromise(_0x0a9e('0x7a'),_0x0a9e('0x7a'),{'FaxAccountId':_['isNil'](_0x482ca2['body'])?undefined:_0x482ca2[_0x0a9e('0x56')]['FaxAccountId'],'path':_['isNil'](_0x5ac73d)?undefined:util['format'](_0x0a9e('0x7b'),_0x5ac73d[_0x0a9e('0x7c')]),'fax':_[_0x0a9e('0x64')](_0x3ca9b9[_0x0a9e('0x5c')])?undefined:_0x3ca9b9[_0x0a9e('0x5c')],'AttachmentId':_0x3ca9b9[_0x0a9e('0x79')]},client9002);})['then'](respondWithResult(_0x2973d3,0xc9))[_0x0a9e('0x29')](handleError(_0x2973d3,null));};exports['download']=function(_0x2871c1,_0x2aabab){var _0x18ad56=path[_0x0a9e('0x7d')](config['root'],_0x0a9e('0x7e'),_0x0a9e('0x7f'),_0x0a9e('0x80'));return db['FaxMessage'][_0x0a9e('0x55')]({'where':{'id':_0x2871c1[_0x0a9e('0x57')]['id']},'include':[{'model':db[_0x0a9e('0x81')],'as':_0x0a9e('0x81')}]})[_0x0a9e('0x21')](handleEntityNotFound(_0x2aabab,null))[_0x0a9e('0x21')](function(_0x32b9bd){if(_0x32b9bd){return _0x2aabab[_0x0a9e('0x82')](path['join'](_0x18ad56,_0x32b9bd[_0x0a9e('0x81')][_0x0a9e('0x7c')]));}})['catch'](handleError(_0x2aabab,null));}; \ No newline at end of file +var _0xb10b=['read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','channel','EventManager','acceptmessage','fax','agent','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','create','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','attachments','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','redis','defaults','localhost','socket.io-emitter','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~!@#$%^&-_=+[{]}.','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','sendStatus','end','status','json','count','limit','Content-Range','apply','reject','update','stack','name','send','index','FaxMessage','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','body','destroy','describe','fax-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','FaxInteraction','isNil'];(function(_0x32a6e3,_0x47846e){var _0x45fc42=function(_0x2e5aae){while(--_0x2e5aae){_0x32a6e3['push'](_0x32a6e3['shift']());}};_0x45fc42(++_0x47846e);}(_0xb10b,0x12a));var _0xbb10=function(_0x363a2b,_0x2c51a2){_0x363a2b=_0x363a2b-0x0;var _0x2c720e=_0xb10b[_0x363a2b];return _0x2c720e;};'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'];config[_0xbb10('0x18')]=_[_0xbb10('0x19')](config[_0xbb10('0x18')],{'host':_0xbb10('0x1a'),'port':0x18eb});var socket=require(_0xbb10('0x1b'))(new Redis(config[_0xbb10('0x18')]));require('./faxMessage.socket')[_0xbb10('0x1c')](socket);var jayson=require(_0xbb10('0x1d'));var client=jayson[_0xbb10('0x1e')][_0xbb10('0x1f')]({'port':0x232c});var client9002=jayson[_0xbb10('0x1e')][_0xbb10('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x24a57b,_0x36b5e8,_0x3e26f4){if(_0x3e26f4){var _0x2b184e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2b184e['test'](_0x36b5e8)){return _0x24a57b;}else{throw new db[(_0xbb10('0x20'))][(_0xbb10('0x21'))](_0xbb10('0x22'));}}else{return _0x24a57b;}}function respondWithRpcPromise(_0x42db98,_0x378da8,_0x1682a4,_0x575cca){return new BPromise(function(_0x30efc6,_0xbf2906){var _0xe1c665=_0x575cca||client;return _0xe1c665['request'](_0x42db98,_0x1682a4)[_0xbb10('0x23')](function(_0x19f48d){logger[_0xbb10('0x24')](_0xbb10('0x25'),_0x378da8,_0xbb10('0x26'));logger[_0xbb10('0x27')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x378da8,_0xbb10('0x26'),JSON[_0xbb10('0x28')](_0x19f48d));if(_0x19f48d['error']){if(_0x19f48d['error'][_0xbb10('0x29')]===0x1f4){logger[_0xbb10('0x2a')](_0xbb10('0x25'),_0x378da8,_0x19f48d[_0xbb10('0x2a')][_0xbb10('0x2b')]);return _0xbf2906(_0x19f48d[_0xbb10('0x2a')][_0xbb10('0x2b')]);}logger[_0xbb10('0x2a')](_0xbb10('0x25'),_0x378da8,_0x19f48d[_0xbb10('0x2a')][_0xbb10('0x2b')]);return _0x30efc6(_0x19f48d[_0xbb10('0x2a')]['message']);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x378da8,_0xbb10('0x26'));_0x30efc6(_0x19f48d[_0xbb10('0x2c')][_0xbb10('0x2b')]);}})['catch'](function(_0x2fdde9){logger[_0xbb10('0x2a')](_0xbb10('0x25'),_0x378da8,_0x2fdde9);_0xbf2906(_0x2fdde9);});});}function respondWithStatusCode(_0x1d5e95,_0x1acce9){_0x1acce9=_0x1acce9||0xcc;return function(_0x20d946){if(_0x20d946){return _0x1d5e95[_0xbb10('0x2d')](_0x1acce9);}return _0x1d5e95['status'](_0x1acce9)[_0xbb10('0x2e')]();};}function respondWithResult(_0x21ac54,_0xfc3595){_0xfc3595=_0xfc3595||0xc8;return function(_0x2e0249){if(_0x2e0249){return _0x21ac54[_0xbb10('0x2f')](_0xfc3595)[_0xbb10('0x30')](_0x2e0249);}};}function respondWithFilteredResult(_0x5d5c80,_0x221624){return function(_0x4ee02e){if(_0x4ee02e){var _0x448d5c=_0x4ee02e[_0xbb10('0x31')],_0x56f2da=_0x221624['offset'],_0x16ad2a=_0x221624['offset']+_0x221624[_0xbb10('0x32')],_0x1dcc9c;if(_0x16ad2a>=_0x448d5c){_0x16ad2a=_0x448d5c;_0x1dcc9c=0xc8;}else{_0x1dcc9c=0xce;}_0x5d5c80[_0xbb10('0x2f')](_0x1dcc9c);return _0x5d5c80['set'](_0xbb10('0x33'),_0x56f2da+'-'+_0x16ad2a+'/'+_0x448d5c)[_0xbb10('0x30')](_0x4ee02e);}return null;};}function patchUpdates(_0x2f653f){return function(_0x1c0b57){try{jsonpatch[_0xbb10('0x34')](_0x1c0b57,_0x2f653f,!![]);}catch(_0x138bc6){return BPromise[_0xbb10('0x35')](_0x138bc6);}return _0x1c0b57['save']();};}function saveUpdates(_0x25acb3,_0x1da9c9){return function(_0x441d15){if(_0x441d15){return _0x441d15[_0xbb10('0x36')](_0x25acb3)[_0xbb10('0x23')](function(_0x9de708){return _0x9de708;});}return null;};}function removeEntity(_0x188cbd,_0x10202c){return function(_0x3c8d7d){if(_0x3c8d7d){return _0x3c8d7d['destroy']()[_0xbb10('0x23')](function(){_0x188cbd[_0xbb10('0x2f')](0xcc)[_0xbb10('0x2e')]();});}};}function handleEntityNotFound(_0x3c3c45,_0x570f5a){return function(_0x111762){if(!_0x111762){_0x3c3c45['sendStatus'](0x194);}return _0x111762;};}function handleError(_0x4e2754,_0x3eb3cc){_0x3eb3cc=_0x3eb3cc||0x1f4;return function(_0x40c164){logger[_0xbb10('0x2a')](_0x40c164[_0xbb10('0x37')]);if(_0x40c164[_0xbb10('0x38')]){delete _0x40c164[_0xbb10('0x38')];}_0x4e2754['status'](_0x3eb3cc)[_0xbb10('0x39')](_0x40c164);};}exports[_0xbb10('0x3a')]=function(_0x52de31,_0x5e3fbd){var _0x5cd55f={},_0x31bee3={},_0x2b0b45={'count':0x0,'rows':[]};var _0x2b658a=_['map'](db[_0xbb10('0x3b')][_0xbb10('0x3c')],function(_0x4345f3){return{'name':_0x4345f3['fieldName'],'type':_0x4345f3[_0xbb10('0x3d')][_0xbb10('0x3e')]};});_0x31bee3[_0xbb10('0x3f')]=_[_0xbb10('0x40')](_0x2b658a,'name');_0x31bee3[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x52de31['query']);_0x31bee3[_0xbb10('0x43')]=_[_0xbb10('0x44')](_0x31bee3[_0xbb10('0x3f')],_0x31bee3[_0xbb10('0x41')]);_0x5cd55f[_0xbb10('0x45')]=_[_0xbb10('0x44')](_0x31bee3['model'],qs[_0xbb10('0x46')](_0x52de31[_0xbb10('0x41')][_0xbb10('0x46')]));_0x5cd55f[_0xbb10('0x45')]=_0x5cd55f['attributes'][_0xbb10('0x47')]?_0x5cd55f[_0xbb10('0x45')]:_0x31bee3[_0xbb10('0x3f')];if(!_0x52de31[_0xbb10('0x41')]['hasOwnProperty'](_0xbb10('0x48'))){_0x5cd55f[_0xbb10('0x32')]=qs['limit'](_0x52de31['query'][_0xbb10('0x32')]);_0x5cd55f['offset']=qs[_0xbb10('0x49')](_0x52de31[_0xbb10('0x41')]['offset']);}_0x5cd55f[_0xbb10('0x4a')]=qs[_0xbb10('0x4b')](_0x52de31[_0xbb10('0x41')]['sort']);_0x5cd55f[_0xbb10('0x4c')]=qs[_0xbb10('0x43')](_[_0xbb10('0x4d')](_0x52de31[_0xbb10('0x41')],_0x31bee3[_0xbb10('0x43')]));if(_0x52de31[_0xbb10('0x41')][_0xbb10('0x4e')]){_0x5cd55f[_0xbb10('0x4c')]=_[_0xbb10('0x4f')](_0x5cd55f[_0xbb10('0x4c')],{'$or':_[_0xbb10('0x40')](_0x2b658a,function(_0x1eadd2){if(_0x1eadd2['type']!==_0xbb10('0x50')){var _0x41bbf8={};_0x41bbf8[_0x1eadd2['name']]={'$like':'%'+_0x52de31[_0xbb10('0x41')][_0xbb10('0x4e')]+'%'};return _0x41bbf8;}})});}_0x5cd55f=_[_0xbb10('0x4f')]({},_0x5cd55f,_0x52de31[_0xbb10('0x51')]);var _0x41ea91={'where':_0x5cd55f[_0xbb10('0x4c')]};return db[_0xbb10('0x3b')]['count'](_0x41ea91)['then'](function(_0xcb3354){_0x2b0b45[_0xbb10('0x31')]=_0xcb3354;if(_0x52de31[_0xbb10('0x41')]['includeAll']){_0x5cd55f['include']=[{'all':!![]}];}return db[_0xbb10('0x3b')][_0xbb10('0x52')](_0x5cd55f);})[_0xbb10('0x23')](function(_0xf820fe){_0x2b0b45[_0xbb10('0x53')]=_0xf820fe;return _0x2b0b45;})[_0xbb10('0x23')](respondWithFilteredResult(_0x5e3fbd,_0x5cd55f))[_0xbb10('0x54')](handleError(_0x5e3fbd,null));};exports[_0xbb10('0x55')]=function(_0x2626d8,_0x3d7e7e){var _0x550111={'raw':!![],'where':{'id':_0x2626d8[_0xbb10('0x56')]['id']}},_0x5eafac={};_0x5eafac[_0xbb10('0x3f')]=_[_0xbb10('0x42')](db[_0xbb10('0x3b')][_0xbb10('0x3c')]);_0x5eafac[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x2626d8[_0xbb10('0x41')]);_0x5eafac[_0xbb10('0x43')]=_[_0xbb10('0x44')](_0x5eafac[_0xbb10('0x3f')],_0x5eafac[_0xbb10('0x41')]);_0x550111[_0xbb10('0x45')]=_[_0xbb10('0x44')](_0x5eafac[_0xbb10('0x3f')],qs['fields'](_0x2626d8[_0xbb10('0x41')]['fields']));_0x550111[_0xbb10('0x45')]=_0x550111[_0xbb10('0x45')][_0xbb10('0x47')]?_0x550111[_0xbb10('0x45')]:_0x5eafac[_0xbb10('0x3f')];if(_0x2626d8[_0xbb10('0x41')][_0xbb10('0x57')]){_0x550111[_0xbb10('0x58')]=[{'all':!![]}];}_0x550111=_[_0xbb10('0x4f')]({},_0x550111,_0x2626d8[_0xbb10('0x51')]);return db[_0xbb10('0x3b')][_0xbb10('0x59')](_0x550111)[_0xbb10('0x23')](handleEntityNotFound(_0x3d7e7e,null))[_0xbb10('0x23')](respondWithResult(_0x3d7e7e,null))[_0xbb10('0x54')](handleError(_0x3d7e7e,null));};exports['update']=function(_0x4571b6,_0x466eb7){if(_0x4571b6[_0xbb10('0x5a')]['id']){delete _0x4571b6[_0xbb10('0x5a')]['id'];}return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x4571b6['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x466eb7,null))[_0xbb10('0x23')](saveUpdates(_0x4571b6[_0xbb10('0x5a')],null))[_0xbb10('0x23')](respondWithResult(_0x466eb7,null))[_0xbb10('0x54')](handleError(_0x466eb7,null));};exports[_0xbb10('0x5b')]=function(_0x175872,_0x12ec18){return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x175872[_0xbb10('0x56')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))[_0xbb10('0x23')](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['describe']=function(_0x16272d,_0x3e6338){return db[_0xbb10('0x3b')][_0xbb10('0x5c')]()['then'](respondWithResult(_0x3e6338,null))['catch'](handleError(_0x3e6338,null));};var interaction_log=require(_0xbb10('0x15'))(_0xbb10('0x5d'));exports[_0xbb10('0x5e')]=function(_0x2dd150,_0x412f13,_0x3e9753){var _0x45c0dc={'channel':'fax'};if(_0x2dd150[_0xbb10('0x5a')]['id']){delete _0x2dd150[_0xbb10('0x5a')]['id'];}_0x2dd150['body']['read']=!![];_0x2dd150['body'][_0xbb10('0x5f')]=moment()[_0xbb10('0x60')](_0xbb10('0x61'));_0x2dd150['body']['UserId']=_0x2dd150['body'][_0xbb10('0x62')]||_0x2dd150[_0xbb10('0x63')]['id'];return db[_0xbb10('0x3b')]['find']({'where':{'id':_0x2dd150[_0xbb10('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xbb10('0x64')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x412f13,null))[_0xbb10('0x23')](saveUpdates(_0x2dd150[_0xbb10('0x5a')],null))[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x45c0dc['message']=_0x237246[_0xbb10('0x65')]({'plain':!![]});return db[_0xbb10('0x66')][_0xbb10('0x59')]({'where':{'id':_0x237246['FaxInteractionId']}});}return null;})[_0xbb10('0x23')](handleEntityNotFound(_0x412f13,null))[_0xbb10('0x23')](function(_0x3e3617){if(_0x3e3617){return _0x3e3617['update']({'UserId':_0x2dd150[_0xbb10('0x5a')][_0xbb10('0x62')],'read1stAt':_[_0xbb10('0x67')](_0x3e3617[_0xbb10('0x68')])?moment()['format'](_0xbb10('0x61')):undefined});}return null;})[_0xbb10('0x23')](function(_0x108e5b){if(_0x108e5b){_0x45c0dc[_0xbb10('0x69')]=_0x108e5b['get']({'plain':!![]});interaction_log[_0xbb10('0x24')](_0xbb10('0x6a'),_0x2dd150[_0xbb10('0x63')]['id'],_0x2dd150[_0xbb10('0x63')][_0xbb10('0x38')],_0x2dd150[_0xbb10('0x63')][_0xbb10('0x6b')],_0x45c0dc['interaction']['id'],_0x2dd150['body']?JSON['stringify'](_0x2dd150[_0xbb10('0x5a')]):_0xbb10('0x6c'));return respondWithRpcPromise(_0xbb10('0x6d'),'acceptMessage',_0x45c0dc);}return null;})['then'](function(_0x46f462){if(_0x46f462){if(_0x2dd150[_0xbb10('0x5a')][_0xbb10('0x6e')]){_0x45c0dc[_0xbb10('0x2b')][_0xbb10('0x6f')]=util[_0xbb10('0x60')]('SIP/%s',_0x2dd150[_0xbb10('0x63')][_0xbb10('0x38')]);_0x45c0dc[_0xbb10('0x2b')][_0xbb10('0x70')]=_0x45c0dc[_0xbb10('0x70')];_0x45c0dc['message']['event']='accept';return respondWithRpcPromise(_0xbb10('0x71'),_0xbb10('0x71'),{'event':_0xbb10('0x72'),'message':_0x45c0dc[_0xbb10('0x2b')]},client9002)[_0xbb10('0x23')](function(){return _0x45c0dc;});}return _0x45c0dc;}return null;})[_0xbb10('0x23')](respondWithResult(_0x412f13,null))['catch'](handleError(_0x412f13,null));};var interaction_log=require(_0xbb10('0x15'))('fax-interactions');exports['reject']=function(_0x519a54,_0xdf634f,_0x13040d){var _0x23b1d5={'agent':{},'channel':_0xbb10('0x73')};if(_0x519a54['body']['id']){delete _0x519a54[_0xbb10('0x5a')]['id'];}_0x519a54['body']['UserId']=_0x519a54[_0xbb10('0x5a')][_0xbb10('0x62')]||_0x519a54[_0xbb10('0x63')]['id'];_0x23b1d5[_0xbb10('0x74')]['id']=_0x519a54[_0xbb10('0x5a')]['UserId'];return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x519a54[_0xbb10('0x56')]['id'],'UserId':null}})[_0xbb10('0x23')](handleEntityNotFound(_0xdf634f,null))[_0xbb10('0x23')](function(_0x27f42f){if(_0x27f42f){_0x23b1d5[_0xbb10('0x2b')]=_0x27f42f['get']({'plain':!![]});return db[_0xbb10('0x66')][_0xbb10('0x59')]({'where':{'id':_0x27f42f[_0xbb10('0x75')]}});}return null;})[_0xbb10('0x23')](handleEntityNotFound(_0xdf634f,null))[_0xbb10('0x23')](function(_0x172be3){if(_0x172be3){_0x23b1d5[_0xbb10('0x69')]=_0x172be3[_0xbb10('0x65')]({'plain':!![]});interaction_log['info'](_0xbb10('0x76'),_0x519a54[_0xbb10('0x63')]['id'],_0x519a54[_0xbb10('0x63')]['name'],_0x519a54['user']['role'],_0x23b1d5[_0xbb10('0x69')]['id'],_0x519a54['body']?JSON['stringify'](_0x519a54[_0xbb10('0x5a')]):_0xbb10('0x6c'));return respondWithRpcPromise(_0xbb10('0x77'),_0xbb10('0x78'),_0x23b1d5);}return null;})[_0xbb10('0x23')](function(_0x24dca6){if(_0x24dca6){_0x24dca6[_0xbb10('0x2b')][_0xbb10('0x6f')]=util[_0xbb10('0x60')]('SIP/%s',_0x519a54[_0xbb10('0x63')][_0xbb10('0x38')]);_0x24dca6[_0xbb10('0x2b')][_0xbb10('0x70')]=_0x23b1d5['channel'];_0x24dca6['message'][_0xbb10('0x79')]=_0xbb10('0x35');respondWithRpcPromise(_0xbb10('0x71'),_0xbb10('0x71'),{'event':'rejectmessage','message':_0x24dca6[_0xbb10('0x2b')]},client9002);return _0x23b1d5;}return null;})[_0xbb10('0x23')](respondWithResult(_0xdf634f,null))[_0xbb10('0x54')](handleError(_0xdf634f,null));};exports[_0xbb10('0x7a')]=function(_0x35c1e8,_0x517185){var _0x5f0691;return db[_0xbb10('0x3b')][_0xbb10('0x7a')](_0x35c1e8[_0xbb10('0x5a')],{})['then'](function(_0x256b35){_0x5f0691=_0x256b35;return db[_0xbb10('0x64')]['findOne']({'where':{'id':_0x5f0691['ContactId']}});})[_0xbb10('0x23')](function(_0x26d0dd){if(_[_0xbb10('0x67')](_0x26d0dd)){return;}else{_0x5f0691['fax']=_0x26d0dd[_0xbb10('0x73')];return db[_0xbb10('0x7b')][_0xbb10('0x7c')]({'where':{'id':_0x5f0691[_0xbb10('0x7d')]}});}})[_0xbb10('0x23')](function(_0x5de006){return respondWithRpcPromise(_0xbb10('0x7e'),_0xbb10('0x7e'),{'FaxAccountId':_[_0xbb10('0x67')](_0x35c1e8['body'])?undefined:_0x35c1e8[_0xbb10('0x5a')][_0xbb10('0x7f')],'path':_[_0xbb10('0x67')](_0x5de006)?undefined:util[_0xbb10('0x60')](_0xbb10('0x80'),_0x5de006[_0xbb10('0x81')]),'fax':_[_0xbb10('0x67')](_0x5f0691[_0xbb10('0x73')])?undefined:_0x5f0691[_0xbb10('0x73')],'AttachmentId':_0x5f0691[_0xbb10('0x7d')]},client9002);})[_0xbb10('0x23')](respondWithResult(_0x517185,0xc9))[_0xbb10('0x54')](handleError(_0x517185,null));};exports['download']=function(_0x51f106,_0xe1fc51){var _0x3fa344=path[_0xbb10('0x82')](config[_0xbb10('0x83')],_0xbb10('0x84'),'files',_0xbb10('0x85'));return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x51f106[_0xbb10('0x56')]['id']},'include':[{'model':db[_0xbb10('0x7b')],'as':_0xbb10('0x7b')}]})['then'](handleEntityNotFound(_0xe1fc51,null))[_0xbb10('0x23')](function(_0x742e10){if(_0x742e10){return _0xe1fc51['download'](path[_0xbb10('0x82')](_0x3fa344,_0x742e10['Attachment'][_0xbb10('0x81')]));}})[_0xbb10('0x54')](handleError(_0xe1fc51,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 4a7f810..5ef2db4 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 _0x7217=['emit','hasOwnProperty','hook','exports','events','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x168ad0,_0x45e98b){var _0x3596fc=function(_0x388510){while(--_0x388510){_0x168ad0['push'](_0x168ad0['shift']());}};_0x3596fc(++_0x45e98b);}(_0x7217,0x19e));var _0x7721=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x7217[_0x3ce3c];return _0x55a2c9;};'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 +var _0x7217=['emit','hasOwnProperty','hook','exports','events','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x1d32ac,_0x16f800){var _0x2e15e4=function(_0x3e36f4){while(--_0x3e36f4){_0x1d32ac['push'](_0x1d32ac['shift']());}};_0x2e15e4(++_0x16f800);}(_0x7217,0x19e));var _0x7721=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x7217[_0x5ddb1c];return _0x354adc;};'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 812246c..2412550 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 _0x27ec=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FaxMessage','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','FaxInteraction','findOne','then','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util'];(function(_0x6e7fd,_0x4db54c){var _0x805bdc=function(_0x1a7cc0){while(--_0x1a7cc0){_0x6e7fd['push'](_0x6e7fd['shift']());}};_0x805bdc(++_0x4db54c);}(_0x27ec,0x136));var _0xc27e=function(_0x661d8c,_0x3a0430){_0x661d8c=_0x661d8c-0x0;var _0x10910b=_0x27ec[_0x661d8c];return _0x10910b;};'use strict';var _=require(_0xc27e('0x0'));var util=require(_0xc27e('0x1'));var logger=require(_0xc27e('0x2'))('api');var moment=require(_0xc27e('0x3'));var BPromise=require(_0xc27e('0x4'));var rp=require(_0xc27e('0x5'));var fs=require('fs');var path=require(_0xc27e('0x6'));var rimraf=require(_0xc27e('0x7'));var config=require(_0xc27e('0x8'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x22e34e,_0x5c6d24){return _0x22e34e[_0xc27e('0x9')](_0xc27e('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xc27e('0xb')],'type':_0xc27e('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x386739,_0x53ad8c,_0x2099c5){var _0x3aeffe=_0x22e34e['models'];var _0x53d845=_0x386739[_0xc27e('0xd')]({'plain':!![]});if(_0x53d845[_0xc27e('0xe')][_0xc27e('0xf')]()==='in'||_0x53d845[_0xc27e('0xe')][_0xc27e('0xf')]()===_0xc27e('0x10')&&!_0x53d845['secret']&&!_[_0xc27e('0x11')](_0x53d845[_0xc27e('0x12')])){_0x3aeffe[_0xc27e('0x13')][_0xc27e('0x14')]({'where':{'id':_0x53d845['FaxInteractionId']}})[_0xc27e('0x15')](function(_0x160955){if(_0x160955){_0x160955['update']({'lastMsgAt':_0x53d845[_0xc27e('0x16')],'lastMsgDirection':_0x53d845[_0xc27e('0xe')][_0xc27e('0xf')]()});}})[_0xc27e('0x17')](function(_0x58db48){console[_0xc27e('0x18')](_0x58db48);});}_0x2099c5();}},'charset':'utf8mb4','collate':_0xc27e('0x19')});}; \ No newline at end of file +var _0x71be=['error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','FaxMessage','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','catch'];(function(_0x3767fb,_0x3b917c){var _0x9bd1b9=function(_0x37d2ba){while(--_0x37d2ba){_0x3767fb['push'](_0x3767fb['shift']());}};_0x9bd1b9(++_0x3b917c);}(_0x71be,0xf2));var _0xe71b=function(_0x13843f,_0x50422d){_0x13843f=_0x13843f-0x0;var _0x1063ae=_0x71be[_0x13843f];return _0x1063ae;};'use strict';var _=require(_0xe71b('0x0'));var util=require(_0xe71b('0x1'));var logger=require(_0xe71b('0x2'))(_0xe71b('0x3'));var moment=require(_0xe71b('0x4'));var BPromise=require(_0xe71b('0x5'));var rp=require(_0xe71b('0x6'));var fs=require('fs');var path=require(_0xe71b('0x7'));var rimraf=require(_0xe71b('0x8'));var config=require(_0xe71b('0x9'));var attributes=require('./faxMessage.attributes');module[_0xe71b('0xa')]=function(_0x2dd216,_0x1951e1){return _0x2dd216['define'](_0xe71b('0xb'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xe71b('0xc'),'fields':[_0xe71b('0xd')],'type':_0xe71b('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b325e,_0x288280,_0x23127c){var _0x175a07=_0x2dd216[_0xe71b('0xf')];var _0x575b25=_0x3b325e[_0xe71b('0x10')]({'plain':!![]});if(_0x575b25[_0xe71b('0x11')][_0xe71b('0x12')]()==='in'||_0x575b25[_0xe71b('0x11')][_0xe71b('0x12')]()===_0xe71b('0x13')&&!_0x575b25['secret']&&!_[_0xe71b('0x14')](_0x575b25[_0xe71b('0x15')])){_0x175a07[_0xe71b('0x16')][_0xe71b('0x17')]({'where':{'id':_0x575b25[_0xe71b('0x18')]}})[_0xe71b('0x19')](function(_0x40692b){if(_0x40692b){_0x40692b[_0xe71b('0x1a')]({'lastMsgAt':_0x575b25['createdAt'],'lastMsgDirection':_0x575b25[_0xe71b('0x11')]['toLowerCase']()});}})[_0xe71b('0x1b')](function(_0x1e6f14){console[_0xe71b('0x1c')](_0x1e6f14);});}_0x23127c();}},'charset':_0xe71b('0x1d'),'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 c85af4b..5c0a54c 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 _0x9643=['jayson/promise','client','http','defaults','redis','./faxMessage.socket','register','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','UpdateFaxMessage','update','raw','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x9643,0x119));var _0x3964=function(_0x8b8996,_0x49164f){_0x8b8996=_0x8b8996-0x0;var _0x31019f=_0x9643[_0x8b8996];return _0x31019f;};'use strict';var _=require(_0x3964('0x0'));var util=require('util');var moment=require(_0x3964('0x1'));var BPromise=require(_0x3964('0x2'));var rs=require(_0x3964('0x3'));var fs=require('fs');var Redis=require(_0x3964('0x4'));var db=require(_0x3964('0x5'))['db'];var utils=require(_0x3964('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3964('0x7'));var client=jayson[_0x3964('0x8')][_0x3964('0x9')]({'port':0x232a});config['redis']=_[_0x3964('0xa')](config[_0x3964('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3964('0xb')]));require(_0x3964('0xc'))[_0x3964('0xd')](socket);function respondWithRpcPromise(_0x42bb89,_0xf2605,_0x2db3b1){return new BPromise(function(_0x1f6d05,_0x2834b7){return client['request'](_0x42bb89,_0x2db3b1)[_0x3964('0xe')](function(_0x501aaa){logger[_0x3964('0xf')]('FaxMessage,\x20%s,\x20%s',_0xf2605,_0x3964('0x10'));logger[_0x3964('0x11')](_0x3964('0x12'),_0xf2605,_0x3964('0x10'),JSON[_0x3964('0x13')](_0x501aaa));if(_0x501aaa['error']){if(_0x501aaa['error']['code']===0x1f4){logger[_0x3964('0x14')](_0x3964('0x15'),_0xf2605,_0x501aaa['error']['message']);return _0x2834b7(_0x501aaa[_0x3964('0x14')]['message']);}logger['error'](_0x3964('0x15'),_0xf2605,_0x501aaa[_0x3964('0x14')][_0x3964('0x16')]);return _0x1f6d05(_0x501aaa[_0x3964('0x14')][_0x3964('0x16')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0xf2605,'request\x20sent');_0x1f6d05(_0x501aaa[_0x3964('0x17')][_0x3964('0x16')]);}})[_0x3964('0x18')](function(_0x377cb5){logger[_0x3964('0x14')](_0x3964('0x15'),_0xf2605,_0x377cb5);_0x2834b7(_0x377cb5);});});}exports[_0x3964('0x19')]=function(_0x1a86a2){var _0x574be5=this;return new Promise(function(_0x30251d,_0x4a7610){return db[_0x3964('0x1a')][_0x3964('0x1b')](_0x1a86a2[_0x3964('0x1c')],{'raw':_0x1a86a2[_0x3964('0x1d')]?_0x1a86a2[_0x3964('0x1d')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x548a55){logger[_0x3964('0xf')](_0x3964('0x19'),_0x1a86a2);logger['debug'](_0x3964('0x19'),_0x1a86a2,JSON[_0x3964('0x13')](_0x548a55));_0x30251d(_0x548a55);})['catch'](function(_0x46d4d2){logger[_0x3964('0x14')](_0x3964('0x19'),_0x46d4d2[_0x3964('0x16')],_0x1a86a2);_0x4a7610(_0x574be5[_0x3964('0x14')](0x1f4,_0x46d4d2[_0x3964('0x16')]));});});};exports[_0x3964('0x1e')]=function(_0x1cd552){var _0x29fc9c=this;return new Promise(function(_0x48cbed,_0x406496){return db[_0x3964('0x1a')][_0x3964('0x1f')](_0x1cd552[_0x3964('0x1c')],{'raw':_0x1cd552[_0x3964('0x1d')]?_0x1cd552[_0x3964('0x1d')][_0x3964('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cd552[_0x3964('0x1d')]?_0x1cd552['options'][_0x3964('0x21')]||null:null,'attributes':_0x1cd552[_0x3964('0x1d')]?_0x1cd552[_0x3964('0x1d')][_0x3964('0x22')]||null:null,'limit':_0x1cd552[_0x3964('0x1d')]?_0x1cd552[_0x3964('0x1d')][_0x3964('0x23')]||null:null})[_0x3964('0xe')](function(_0x5b083d){logger[_0x3964('0xf')](_0x3964('0x1e'),_0x1cd552);logger[_0x3964('0x11')]('UpdateFaxMessage',_0x1cd552,JSON[_0x3964('0x13')](_0x5b083d));_0x48cbed(_0x5b083d);})[_0x3964('0x18')](function(_0x2957db){logger[_0x3964('0x14')](_0x3964('0x1e'),_0x2957db[_0x3964('0x16')],_0x1cd552);_0x406496(_0x29fc9c['error'](0x1f4,_0x2957db[_0x3964('0x16')]));});});}; \ No newline at end of file +var _0x4443=['client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','create','options','raw','then','UpdateFaxMessage','FaxMessage','update','body','where','attributes','limit','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x4443,0x71));var _0x3444=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4443[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3444('0x0'));var util=require('util');var moment=require(_0x3444('0x1'));var BPromise=require(_0x3444('0x2'));var rs=require(_0x3444('0x3'));var fs=require('fs');var Redis=require(_0x3444('0x4'));var db=require(_0x3444('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3444('0x6'))(_0x3444('0x7'));var config=require(_0x3444('0x8'));var jayson=require(_0x3444('0x9'));var client=jayson[_0x3444('0xa')][_0x3444('0xb')]({'port':0x232a});config[_0x3444('0xc')]=_[_0x3444('0xd')](config['redis'],{'host':_0x3444('0xe'),'port':0x18eb});var socket=require(_0x3444('0xf'))(new Redis(config[_0x3444('0xc')]));require('./faxMessage.socket')[_0x3444('0x10')](socket);function respondWithRpcPromise(_0x1fddc6,_0x3d5e71,_0x166f23){return new BPromise(function(_0x1b8d50,_0x487adf){return client[_0x3444('0x11')](_0x1fddc6,_0x166f23)['then'](function(_0x41ef7a){logger[_0x3444('0x12')]('FaxMessage,\x20%s,\x20%s',_0x3d5e71,_0x3444('0x13'));logger['debug'](_0x3444('0x14'),_0x3d5e71,_0x3444('0x13'),JSON[_0x3444('0x15')](_0x41ef7a));if(_0x41ef7a['error']){if(_0x41ef7a['error'][_0x3444('0x16')]===0x1f4){logger[_0x3444('0x17')](_0x3444('0x18'),_0x3d5e71,_0x41ef7a[_0x3444('0x17')]['message']);return _0x487adf(_0x41ef7a['error']['message']);}logger[_0x3444('0x17')](_0x3444('0x18'),_0x3d5e71,_0x41ef7a[_0x3444('0x17')][_0x3444('0x19')]);return _0x1b8d50(_0x41ef7a[_0x3444('0x17')][_0x3444('0x19')]);}else{logger['info'](_0x3444('0x18'),_0x3d5e71,'request\x20sent');_0x1b8d50(_0x41ef7a[_0x3444('0x1a')][_0x3444('0x19')]);}})[_0x3444('0x1b')](function(_0x260485){logger[_0x3444('0x17')]('FaxMessage,\x20%s,\x20%s',_0x3d5e71,_0x260485);_0x487adf(_0x260485);});});}exports[_0x3444('0x1c')]=function(_0x19969a){var _0x1b4aac=this;return new Promise(function(_0x59f823,_0x16af1a){return db['FaxMessage'][_0x3444('0x1d')](_0x19969a['body'],{'raw':_0x19969a[_0x3444('0x1e')]?_0x19969a[_0x3444('0x1e')][_0x3444('0x1f')]===undefined?!![]:![]:!![]})[_0x3444('0x20')](function(_0x3c803d){logger[_0x3444('0x12')](_0x3444('0x1c'),_0x19969a);logger['debug']('CreateFaxMessage',_0x19969a,JSON[_0x3444('0x15')](_0x3c803d));_0x59f823(_0x3c803d);})['catch'](function(_0x21128f){logger[_0x3444('0x17')](_0x3444('0x1c'),_0x21128f['message'],_0x19969a);_0x16af1a(_0x1b4aac[_0x3444('0x17')](0x1f4,_0x21128f[_0x3444('0x19')]));});});};exports[_0x3444('0x21')]=function(_0x57d93f){var _0x8a256f=this;return new Promise(function(_0x5b7f97,_0x4d729b){return db[_0x3444('0x22')][_0x3444('0x23')](_0x57d93f[_0x3444('0x24')],{'raw':_0x57d93f[_0x3444('0x1e')]?_0x57d93f[_0x3444('0x1e')][_0x3444('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57d93f[_0x3444('0x1e')]?_0x57d93f[_0x3444('0x1e')][_0x3444('0x25')]||null:null,'attributes':_0x57d93f[_0x3444('0x1e')]?_0x57d93f[_0x3444('0x1e')][_0x3444('0x26')]||null:null,'limit':_0x57d93f[_0x3444('0x1e')]?_0x57d93f[_0x3444('0x1e')][_0x3444('0x27')]||null:null})[_0x3444('0x20')](function(_0x3c4160){logger[_0x3444('0x12')](_0x3444('0x21'),_0x57d93f);logger[_0x3444('0x28')](_0x3444('0x21'),_0x57d93f,JSON[_0x3444('0x15')](_0x3c4160));_0x5b7f97(_0x3c4160);})[_0x3444('0x1b')](function(_0x1ed90e){logger[_0x3444('0x17')](_0x3444('0x21'),_0x1ed90e[_0x3444('0x19')],_0x57d93f);_0x4d729b(_0x8a256f[_0x3444('0x17')](0x1f4,_0x1ed90e[_0x3444('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index e13fd4f..1b1a38f 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(_0x18b191,_0x4e0684){var _0x43e146=function(_0x4b464e){while(--_0x4b464e){_0x18b191['push'](_0x18b191['shift']());}};_0x43e146(++_0x4e0684);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file +var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 680dc87..7728153 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 _0x6add=['/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','faxmessage:create','put','update','accept'];(function(_0x235d67,_0x1c266d){var _0x15e3c9=function(_0x1c085a){while(--_0x1c085a){_0x235d67['push'](_0x235d67['shift']());}};_0x15e3c9(++_0x1c266d);}(_0x6add,0x1a2));var _0xd6ad=function(_0x502944,_0x32a768){_0x502944=_0x502944-0x0;var _0x3e9b62=_0x6add[_0x502944];return _0x3e9b62;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd6ad('0x0'));var timeout=require(_0xd6ad('0x1'));var express=require(_0xd6ad('0x2'));var router=express[_0xd6ad('0x3')]();var auth=require(_0xd6ad('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd6ad('0x5'));var controller=require(_0xd6ad('0x6'));router[_0xd6ad('0x7')]('/',auth[_0xd6ad('0x8')](),controller[_0xd6ad('0x9')]);router[_0xd6ad('0x7')](_0xd6ad('0xa'),auth[_0xd6ad('0x8')](),controller[_0xd6ad('0xb')]);router['get'](_0xd6ad('0xc'),auth[_0xd6ad('0x8')](),controller[_0xd6ad('0xd')]);router[_0xd6ad('0x7')](_0xd6ad('0xe'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xd6ad('0x8')](),interaction['tracked']('fax',_0xd6ad('0xf')),controller['create']);router[_0xd6ad('0x10')](_0xd6ad('0xc'),auth['isAuthenticated'](),controller[_0xd6ad('0x11')]);router[_0xd6ad('0x10')]('/:id/accept',auth[_0xd6ad('0x8')](),controller[_0xd6ad('0x12')]);router[_0xd6ad('0x10')](_0xd6ad('0x13'),auth[_0xd6ad('0x8')](),controller[_0xd6ad('0x14')]);router['delete'](_0xd6ad('0xc'),auth[_0xd6ad('0x8')](),controller[_0xd6ad('0x15')]);module[_0xd6ad('0x16')]=router; \ No newline at end of file +var _0x7c21=['/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','isAuthenticated','describe','/:id','show','fax','faxmessage:create','create','put'];(function(_0x5b6af8,_0x372e17){var _0x10f60f=function(_0x57cc25){while(--_0x57cc25){_0x5b6af8['push'](_0x5b6af8['shift']());}};_0x10f60f(++_0x372e17);}(_0x7c21,0x1e2));var _0x17c2=function(_0x5c8763,_0x3edcd8){_0x5c8763=_0x5c8763-0x0;var _0x50fc07=_0x7c21[_0x5c8763];return _0x50fc07;};'use strict';var multer=require(_0x17c2('0x0'));var util=require(_0x17c2('0x1'));var path=require(_0x17c2('0x2'));var timeout=require('connect-timeout');var express=require(_0x17c2('0x3'));var router=express[_0x17c2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x17c2('0x5'));var config=require(_0x17c2('0x6'));var controller=require(_0x17c2('0x7'));router[_0x17c2('0x8')]('/',auth['isAuthenticated'](),controller[_0x17c2('0x9')]);router['get']('/describe',auth[_0x17c2('0xa')](),controller[_0x17c2('0xb')]);router[_0x17c2('0x8')](_0x17c2('0xc'),auth[_0x17c2('0xa')](),controller[_0x17c2('0xd')]);router[_0x17c2('0x8')]('/:id/download',auth[_0x17c2('0xa')](),controller['download']);router['post']('/',auth[_0x17c2('0xa')](),interaction['tracked'](_0x17c2('0xe'),_0x17c2('0xf')),controller[_0x17c2('0x10')]);router['put']('/:id',auth[_0x17c2('0xa')](),controller['update']);router[_0x17c2('0x11')](_0x17c2('0x12'),auth[_0x17c2('0xa')](),controller[_0x17c2('0x13')]);router['put'](_0x17c2('0x14'),auth[_0x17c2('0xa')](),controller[_0x17c2('0x15')]);router[_0x17c2('0x16')](_0x17c2('0xc'),auth['isAuthenticated'](),controller[_0x17c2('0x17')]);module[_0x17c2('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index f28141d..86155aa 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 _0x3593=['ENUM','beepall','sequelize','exports','STRING','name','INTEGER'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3593,0xb8));var _0x3359=function(_0x1105ea,_0x1dc625){_0x1105ea=_0x1105ea-0x0;var _0x183ff4=_0x3593[_0x1105ea];return _0x183ff4;};'use strict';var Sequelize=require(_0x3359('0x0'));module[_0x3359('0x1')]={'name':{'type':Sequelize[_0x3359('0x2')],'unique':_0x3359('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3359('0x2')]},'timeout':{'type':Sequelize[_0x3359('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3359('0x5')]('rrmemory',_0x3359('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x3359('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x54b5=['exports','STRING','name','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x54b5,0x13b));var _0x554b=function(_0x21af07,_0x5d5a49){_0x21af07=_0x21af07-0x0;var _0x1fb729=_0x54b5[_0x21af07];return _0x1fb729;};'use strict';var Sequelize=require('sequelize');module[_0x554b('0x0')]={'name':{'type':Sequelize[_0x554b('0x1')],'unique':_0x554b('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x554b('0x1')]},'timeout':{'type':Sequelize[_0x554b('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x554b('0x4'),_0x554b('0x5'),_0x554b('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x554b('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 090d586..8e7bb18 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 _0xb114=['getAgents','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','end','count','offset','status','set','Content-Range','apply','reject','save','update','then','FaxQueues','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxQueue','includeAll','findAll','rows','catch','params','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','body','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','FaxQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','faxPause','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb114,0x11f));var _0x4b11=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0xb114[_0x556bb1];return _0x45455f;};'use strict';var pdf=require(_0x4b11('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4b11('0x1'));var zipdir=require(_0x4b11('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b11('0x3'));var moment=require(_0x4b11('0x4'));var BPromise=require(_0x4b11('0x5'));var Mustache=require(_0x4b11('0x6'));var util=require(_0x4b11('0x7'));var path=require(_0x4b11('0x8'));var sox=require('sox');var csv=require(_0x4b11('0x9'));var ejs=require(_0x4b11('0xa'));var fs=require('fs');var _=require(_0x4b11('0xb'));var squel=require(_0x4b11('0xc'));var crypto=require(_0x4b11('0xd'));var jsforce=require(_0x4b11('0xe'));var deskjs=require(_0x4b11('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4b11('0x10'));var Papa=require('papaparse');var Redis=require(_0x4b11('0x11'));var authService=require(_0x4b11('0x12'));var qs=require(_0x4b11('0x13'));var as=require(_0x4b11('0x14'));var hardwareService=require(_0x4b11('0x15'));var logger=require(_0x4b11('0x16'))('api');var utils=require(_0x4b11('0x17'));var config=require(_0x4b11('0x18'));var db=require(_0x4b11('0x19'))['db'];config[_0x4b11('0x1a')]=_['defaults'](config['redis'],{'host':_0x4b11('0x1b'),'port':0x18eb});var socket=require(_0x4b11('0x1c'))(new Redis(config[_0x4b11('0x1a')]));require(_0x4b11('0x1d'))[_0x4b11('0x1e')](socket);function respondWithStatusCode(_0x46ca74,_0x3f8523){_0x3f8523=_0x3f8523||0xcc;return function(_0x1981eb){if(_0x1981eb){return _0x46ca74['sendStatus'](_0x3f8523);}return _0x46ca74['status'](_0x3f8523)[_0x4b11('0x1f')]();};}function respondWithResult(_0x26c3e2,_0x3910c7){_0x3910c7=_0x3910c7||0xc8;return function(_0x591817){if(_0x591817){return _0x26c3e2['status'](_0x3910c7)['json'](_0x591817);}};}function respondWithFilteredResult(_0x3811c9,_0x4a573f){return function(_0x2eb40c){if(_0x2eb40c){var _0xf14a7f=_0x2eb40c[_0x4b11('0x20')],_0xa67776=_0x4a573f[_0x4b11('0x21')],_0x2db145=_0x4a573f[_0x4b11('0x21')]+_0x4a573f['limit'],_0x40579b;if(_0x2db145>=_0xf14a7f){_0x2db145=_0xf14a7f;_0x40579b=0xc8;}else{_0x40579b=0xce;}_0x3811c9[_0x4b11('0x22')](_0x40579b);return _0x3811c9[_0x4b11('0x23')](_0x4b11('0x24'),_0xa67776+'-'+_0x2db145+'/'+_0xf14a7f)['json'](_0x2eb40c);}return null;};}function patchUpdates(_0x30c80f){return function(_0x5aa22c){try{jsonpatch[_0x4b11('0x25')](_0x5aa22c,_0x30c80f,!![]);}catch(_0x23beab){return BPromise[_0x4b11('0x26')](_0x23beab);}return _0x5aa22c[_0x4b11('0x27')]();};}function saveUpdates(_0x113a1e,_0x28b219){return function(_0xcaeb34){if(_0xcaeb34){return _0xcaeb34[_0x4b11('0x28')](_0x113a1e)[_0x4b11('0x29')](function(_0x398b12){return _0x398b12;});}return null;};}function removeEntity(_0x3e9a73,_0x49a69c){return function(_0x34212b){if(_0x34212b){return _0x34212b['destroy']()[_0x4b11('0x29')](function(){var _0x51ab68=_0x34212b['get']({'plain':!![]});var _0x32bc7e=_0x4b11('0x2a');return db[_0x4b11('0x2b')][_0x4b11('0x2c')]({'where':{'type':_0x32bc7e,'resourceId':_0x51ab68['id']}})[_0x4b11('0x29')](function(){return _0x34212b;});})['then'](function(){_0x3e9a73[_0x4b11('0x22')](0xcc)[_0x4b11('0x1f')]();});}};}function handleEntityNotFound(_0x1aa0d4,_0x3e099f){return function(_0xcdd632){if(!_0xcdd632){_0x1aa0d4[_0x4b11('0x2d')](0x194);}return _0xcdd632;};}function handleError(_0x1eb259,_0xc3c5d0){_0xc3c5d0=_0xc3c5d0||0x1f4;return function(_0x5897ea){logger[_0x4b11('0x2e')](_0x5897ea[_0x4b11('0x2f')]);if(_0x5897ea['name']){delete _0x5897ea[_0x4b11('0x30')];}_0x1eb259[_0x4b11('0x22')](_0xc3c5d0)[_0x4b11('0x31')](_0x5897ea);};}exports[_0x4b11('0x32')]=function(_0x3a0d9e,_0x704ada){var _0x440cf5={},_0x582d54={},_0x409b01={'count':0x0,'rows':[]};var _0x23941b=_[_0x4b11('0x33')](db['FaxQueue'][_0x4b11('0x34')],function(_0x1c37fb){return{'name':_0x1c37fb[_0x4b11('0x35')],'type':_0x1c37fb[_0x4b11('0x36')][_0x4b11('0x37')]};});_0x582d54[_0x4b11('0x38')]=_['map'](_0x23941b,'name');_0x582d54[_0x4b11('0x39')]=_[_0x4b11('0x3a')](_0x3a0d9e[_0x4b11('0x39')]);_0x582d54[_0x4b11('0x3b')]=_[_0x4b11('0x3c')](_0x582d54[_0x4b11('0x38')],_0x582d54[_0x4b11('0x39')]);_0x440cf5['attributes']=_[_0x4b11('0x3c')](_0x582d54[_0x4b11('0x38')],qs[_0x4b11('0x3d')](_0x3a0d9e[_0x4b11('0x39')][_0x4b11('0x3d')]));_0x440cf5['attributes']=_0x440cf5['attributes'][_0x4b11('0x3e')]?_0x440cf5[_0x4b11('0x3f')]:_0x582d54[_0x4b11('0x38')];if(!_0x3a0d9e[_0x4b11('0x39')]['hasOwnProperty']('nolimit')){_0x440cf5['limit']=qs[_0x4b11('0x40')](_0x3a0d9e[_0x4b11('0x39')]['limit']);_0x440cf5[_0x4b11('0x21')]=qs['offset'](_0x3a0d9e[_0x4b11('0x39')][_0x4b11('0x21')]);}_0x440cf5[_0x4b11('0x41')]=qs[_0x4b11('0x42')](_0x3a0d9e[_0x4b11('0x39')][_0x4b11('0x42')]);_0x440cf5[_0x4b11('0x43')]=qs[_0x4b11('0x3b')](_[_0x4b11('0x44')](_0x3a0d9e[_0x4b11('0x39')],_0x582d54['filters']));if(_0x3a0d9e['query'][_0x4b11('0x45')]){_0x440cf5[_0x4b11('0x43')]=_[_0x4b11('0x46')](_0x440cf5[_0x4b11('0x43')],{'$or':_[_0x4b11('0x33')](_0x23941b,function(_0x1477cb){if(_0x1477cb[_0x4b11('0x36')]!==_0x4b11('0x47')){var _0x429ccf={};_0x429ccf[_0x1477cb[_0x4b11('0x30')]]={'$like':'%'+_0x3a0d9e['query']['filter']+'%'};return _0x429ccf;}})});}_0x440cf5=_['merge']({},_0x440cf5,_0x3a0d9e[_0x4b11('0x48')]);var _0x21b205={'where':_0x440cf5[_0x4b11('0x43')]};return db[_0x4b11('0x49')][_0x4b11('0x20')](_0x21b205)[_0x4b11('0x29')](function(_0x2ff797){_0x409b01[_0x4b11('0x20')]=_0x2ff797;if(_0x3a0d9e[_0x4b11('0x39')][_0x4b11('0x4a')]){_0x440cf5['include']=[{'all':!![]}];}return db[_0x4b11('0x49')][_0x4b11('0x4b')](_0x440cf5);})['then'](function(_0x3f2cdd){_0x409b01[_0x4b11('0x4c')]=_0x3f2cdd;return _0x409b01;})[_0x4b11('0x29')](respondWithFilteredResult(_0x704ada,_0x440cf5))[_0x4b11('0x4d')](handleError(_0x704ada,null));};exports['show']=function(_0x1c20a4,_0x16144c){var _0x550d4f={'raw':!![],'where':{'id':_0x1c20a4[_0x4b11('0x4e')]['id']}},_0x327388={};_0x327388['model']=_[_0x4b11('0x3a')](db[_0x4b11('0x49')][_0x4b11('0x34')]);_0x327388['query']=_[_0x4b11('0x3a')](_0x1c20a4[_0x4b11('0x39')]);_0x327388['filters']=_[_0x4b11('0x3c')](_0x327388[_0x4b11('0x38')],_0x327388[_0x4b11('0x39')]);_0x550d4f[_0x4b11('0x3f')]=_[_0x4b11('0x3c')](_0x327388[_0x4b11('0x38')],qs[_0x4b11('0x3d')](_0x1c20a4['query']['fields']));_0x550d4f[_0x4b11('0x3f')]=_0x550d4f[_0x4b11('0x3f')][_0x4b11('0x3e')]?_0x550d4f[_0x4b11('0x3f')]:_0x327388[_0x4b11('0x38')];if(_0x1c20a4[_0x4b11('0x39')]['includeAll']){_0x550d4f[_0x4b11('0x4f')]=[{'all':!![]}];}_0x550d4f=_['merge']({},_0x550d4f,_0x1c20a4[_0x4b11('0x48')]);return db[_0x4b11('0x49')][_0x4b11('0x50')](_0x550d4f)[_0x4b11('0x29')](handleEntityNotFound(_0x16144c,null))[_0x4b11('0x29')](respondWithResult(_0x16144c,null))[_0x4b11('0x4d')](handleError(_0x16144c,null));};exports[_0x4b11('0x51')]=function(_0x42a3d6,_0x3e0dd3){return db[_0x4b11('0x49')]['create'](_0x42a3d6['body'],{})[_0x4b11('0x29')](function(_0x1c1c11){var _0x194717=_0x42a3d6[_0x4b11('0x52')][_0x4b11('0x53')]({'plain':!![]});if(!_0x194717)throw new Error(_0x4b11('0x54'));if(_0x194717['role']==='user'){var _0x5b1ca6=_0x1c1c11[_0x4b11('0x53')]({'plain':!![]});var _0x361993='FaxQueues';return db[_0x4b11('0x55')][_0x4b11('0x50')]({'where':{'name':_0x361993,'userProfileId':_0x194717['userProfileId']},'raw':!![]})[_0x4b11('0x29')](function(_0x5219be){if(_0x5219be&&_0x5219be[_0x4b11('0x56')]===0x0){return db[_0x4b11('0x2b')]['create']({'name':_0x5b1ca6[_0x4b11('0x30')],'resourceId':_0x5b1ca6['id'],'type':_0x5219be[_0x4b11('0x30')],'sectionId':_0x5219be['id']},{})[_0x4b11('0x29')](function(){return _0x1c1c11;});}else{return _0x1c1c11;}})[_0x4b11('0x4d')](function(_0x5071f3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5071f3);throw _0x5071f3;});}return _0x1c1c11;})[_0x4b11('0x29')](respondWithResult(_0x3e0dd3,0xc9))['catch'](handleError(_0x3e0dd3,null));};exports[_0x4b11('0x28')]=function(_0x3eb4e4,_0x5e2cb4){if(_0x3eb4e4['body']['id']){delete _0x3eb4e4[_0x4b11('0x57')]['id'];}return db['FaxQueue'][_0x4b11('0x50')]({'where':{'id':_0x3eb4e4[_0x4b11('0x4e')]['id']}})[_0x4b11('0x29')](handleEntityNotFound(_0x5e2cb4,null))[_0x4b11('0x29')](saveUpdates(_0x3eb4e4[_0x4b11('0x57')],null))[_0x4b11('0x29')](respondWithResult(_0x5e2cb4,null))[_0x4b11('0x4d')](handleError(_0x5e2cb4,null));};exports['destroy']=function(_0x3d8c1a,_0x5136e8){return db[_0x4b11('0x49')][_0x4b11('0x50')]({'where':{'id':_0x3d8c1a[_0x4b11('0x4e')]['id']}})[_0x4b11('0x29')](handleEntityNotFound(_0x5136e8,null))[_0x4b11('0x29')](removeEntity(_0x5136e8,null))[_0x4b11('0x4d')](handleError(_0x5136e8,null));};exports[_0x4b11('0x58')]=function(_0x5b52ec,_0x207be4){return db['FaxQueue'][_0x4b11('0x58')]()[_0x4b11('0x29')](respondWithResult(_0x207be4,null))[_0x4b11('0x4d')](handleError(_0x207be4,null));};exports[_0x4b11('0x59')]=function(_0x3b732d,_0x3b8795,_0x365577){var _0x3b6e71={'raw':!![],'where':{}},_0x12e179={},_0x4c4478;return db[_0x4b11('0x49')][_0x4b11('0x5a')]({'where':{'id':_0x3b732d[_0x4b11('0x4e')]['id']}})[_0x4b11('0x29')](handleEntityNotFound(_0x3b8795,null))['then'](function(_0x57ba8d){if(_0x57ba8d){_0x4c4478=_0x57ba8d[_0x4b11('0x53')]({'plain':!![]});_0x12e179[_0x4b11('0x38')]=_[_0x4b11('0x3a')](db[_0x4b11('0x5b')]['rawAttributes']);_0x12e179[_0x4b11('0x39')]=_[_0x4b11('0x3a')](_0x3b732d[_0x4b11('0x39')]);_0x12e179[_0x4b11('0x3b')]=_['intersection'](_0x12e179['model'],_0x12e179[_0x4b11('0x39')]);_0x3b6e71[_0x4b11('0x3f')]=_[_0x4b11('0x3c')](_0x12e179[_0x4b11('0x38')],qs[_0x4b11('0x3d')](_0x3b732d[_0x4b11('0x39')]['fields']));_0x3b6e71[_0x4b11('0x3f')]=_0x3b6e71['attributes'][_0x4b11('0x3e')]?_0x3b6e71[_0x4b11('0x3f')]:_0x12e179[_0x4b11('0x38')];if(!_0x3b732d[_0x4b11('0x39')][_0x4b11('0x5c')](_0x4b11('0x5d'))){_0x3b6e71[_0x4b11('0x40')]=qs[_0x4b11('0x40')](_0x3b732d[_0x4b11('0x39')]['limit']);_0x3b6e71[_0x4b11('0x21')]=qs[_0x4b11('0x21')](_0x3b732d[_0x4b11('0x39')]['offset']);}_0x3b6e71['order']=qs[_0x4b11('0x42')](_0x3b732d[_0x4b11('0x39')][_0x4b11('0x42')]);_0x3b6e71[_0x4b11('0x43')]=qs[_0x4b11('0x3b')](_[_0x4b11('0x44')](_0x3b732d[_0x4b11('0x39')],_0x12e179[_0x4b11('0x3b')]));_0x3b6e71[_0x4b11('0x43')][_0x4b11('0x5e')]=_0x57ba8d['id'];if(_0x3b732d['query']['filter']){_0x3b6e71[_0x4b11('0x43')]=_[_0x4b11('0x46')](_0x3b6e71[_0x4b11('0x43')],{'$or':_[_0x4b11('0x33')](_0x3b6e71[_0x4b11('0x3f')],function(_0x12cfff){var _0xb8c4ea={};_0xb8c4ea[_0x12cfff]={'$like':'%'+_0x3b732d['query'][_0x4b11('0x45')]+'%'};return _0xb8c4ea;})});}_0x3b6e71=_[_0x4b11('0x46')]({},_0x3b6e71,_0x3b732d[_0x4b11('0x48')]);return db[_0x4b11('0x5b')][_0x4b11('0x4b')](_0x3b6e71);}})[_0x4b11('0x29')](function(_0x57e841){if(_0x57e841){return db[_0x4b11('0x5f')][_0x4b11('0x60')]({'where':{'id':_[_0x4b11('0x33')](_0x57e841,_0x4b11('0x61')),'role':_0x4b11('0x62')},'attributes':['id','name','faxPause',_0x4b11('0x63'),_0x4b11('0x64')]});}})[_0x4b11('0x29')](function(_0x582219){if(_0x582219){return{'count':_0x582219[_0x4b11('0x20')],'rows':_['map'](_0x582219[_0x4b11('0x4c')],function(_0x217e37){return{'membername':_0x217e37[_0x4b11('0x30')],'UserId':_0x217e37['id'],'queue_name':_0x4c4478[_0x4b11('0x30')],'FaxQueueId':_0x4c4478['id'],'interface':util[_0x4b11('0x65')]('%s/%s','SIP',_0x217e37[_0x4b11('0x30')]),'penalty':0x0,'paused':_0x217e37[_0x4b11('0x66')],'createdAt':_0x217e37[_0x4b11('0x64')],'updatedAt':_0x217e37[_0x4b11('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4b11('0x29')](respondWithFilteredResult(_0x3b8795,_0x3b6e71))[_0x4b11('0x4d')](handleError(_0x3b8795,null));};exports[_0x4b11('0x67')]=function(_0xa1fbd5,_0xffa80b,_0x2ae7b0){var _0x2885a8={};var _0x40a10c={};var _0x11743a;var _0x5d366f;return db['FaxQueue'][_0x4b11('0x5a')]({'where':{'id':_0xa1fbd5[_0x4b11('0x4e')]['id']}})[_0x4b11('0x29')](handleEntityNotFound(_0xffa80b,null))[_0x4b11('0x29')](function(_0x47efa7){if(_0x47efa7){_0x11743a=_0x47efa7;_0x40a10c[_0x4b11('0x38')]=_['keys'](db[_0x4b11('0x68')][_0x4b11('0x34')]);_0x40a10c[_0x4b11('0x39')]=_[_0x4b11('0x3a')](_0xa1fbd5['query']);_0x40a10c[_0x4b11('0x3b')]=_['intersection'](_0x40a10c[_0x4b11('0x38')],_0x40a10c[_0x4b11('0x39')]);_0x2885a8['attributes']=_[_0x4b11('0x3c')](_0x40a10c[_0x4b11('0x38')],qs[_0x4b11('0x3d')](_0xa1fbd5[_0x4b11('0x39')][_0x4b11('0x3d')]));_0x2885a8[_0x4b11('0x3f')]=_0x2885a8[_0x4b11('0x3f')]['length']?_0x2885a8['attributes']:_0x40a10c[_0x4b11('0x38')];_0x2885a8['order']=qs[_0x4b11('0x42')](_0xa1fbd5[_0x4b11('0x39')][_0x4b11('0x42')]);_0x2885a8['where']=qs[_0x4b11('0x3b')](_[_0x4b11('0x44')](_0xa1fbd5[_0x4b11('0x39')],_0x40a10c['filters']));if(_0xa1fbd5[_0x4b11('0x39')][_0x4b11('0x45')]){_0x2885a8[_0x4b11('0x43')]=_[_0x4b11('0x46')](_0x2885a8[_0x4b11('0x43')],{'$or':_[_0x4b11('0x33')](_0x2885a8[_0x4b11('0x3f')],function(_0x1157a5){var _0x4fd206={};_0x4fd206[_0x1157a5]={'$like':'%'+_0xa1fbd5['query'][_0x4b11('0x45')]+'%'};return _0x4fd206;})});}_0x2885a8=_[_0x4b11('0x46')]({},_0x2885a8,_0xa1fbd5['options']);return _0x11743a['getTeams'](_0x2885a8);}})['then'](function(_0x2245fb){if(_0x2245fb){_0x5d366f=_0x2245fb['length'];if(!_0xa1fbd5[_0x4b11('0x39')]['hasOwnProperty']('nolimit')){_0x2885a8[_0x4b11('0x40')]=qs['limit'](_0xa1fbd5[_0x4b11('0x39')][_0x4b11('0x40')]);_0x2885a8[_0x4b11('0x21')]=qs[_0x4b11('0x21')](_0xa1fbd5[_0x4b11('0x39')][_0x4b11('0x21')]);}return _0x11743a[_0x4b11('0x67')](_0x2885a8);}})[_0x4b11('0x29')](function(_0x1cfb00){if(_0x1cfb00){return _0x1cfb00?{'count':_0x5d366f,'rows':_0x1cfb00}:null;}})['then'](respondWithResult(_0xffa80b,null))['catch'](handleError(_0xffa80b,null));};exports[_0x4b11('0x69')]=function(_0x34d70a,_0x1ec505,_0x37d480){var _0x2e2562=_0x34d70a['body'][_0x4b11('0x6a')];return db[_0x4b11('0x68')][_0x4b11('0x4b')]({'where':{'id':_0x2e2562},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4b11('0x6b'),'attributes':['id',_0x4b11('0x30'),_0x4b11('0x6c'),'voicePause',_0x4b11('0x6d')],'raw':!![]}]})[_0x4b11('0x29')](function(_0x42e229){if(_0x42e229){var _0x2d25c9=_[_0x4b11('0x6e')](_0x42e229,function(_0x5e0d76){var _0x23b097=_0x5e0d76[_0x4b11('0x53')]({'plain':!![]});return _0x23b097[_0x4b11('0x6b')];});return db[_0x4b11('0x49')]['find']({'where':{'id':_0x34d70a[_0x4b11('0x4e')]['id']}})[_0x4b11('0x29')](function(_0x4c80be){return db[_0x4b11('0x6f')][_0x4b11('0x70')](function(_0x1f8189){return _0x4c80be[_0x4b11('0x69')](_0x2e2562,{'transaction':_0x1f8189})[_0x4b11('0x29')](function(){return BPromise[_0x4b11('0x71')](_0x2d25c9,function(_0x21ec59){return db[_0x4b11('0x5b')][_0x4b11('0x72')]({'where':{'UserId':_0x21ec59['id'],'FaxQueueId':_0x34d70a[_0x4b11('0x4e')]['id']},'transaction':_0x1f8189});});})['then'](function(){_0x2d25c9[_0x4b11('0x73')](function(_0x4e5574){socket[_0x4b11('0x74')](_0x4b11('0x75'),{'UserId':_0x4e5574['id'],'FaxQueueId':_0x4c80be['id']});});});});});}})[_0x4b11('0x29')](respondWithStatusCode(_0x1ec505,null))[_0x4b11('0x4d')](handleError(_0x1ec505,null));};exports[_0x4b11('0x76')]=function(_0x3f2518,_0x13a2e2,_0x4febc5){return db['Team'][_0x4b11('0x4b')]({'where':{'id':_0x3f2518[_0x4b11('0x39')][_0x4b11('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x4b11('0x5f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x4b11('0x29')](handleEntityNotFound(_0x13a2e2,null))['then'](function(_0x1cf9a5){var _0x375aa2=_[_0x4b11('0x33')](_0x1cf9a5,'id');var _0x315906=[];var _0xfa77de=[];var _0xeb5b73=squel[_0x4b11('0x77')]();_0xeb5b73['field'](_0x4b11('0x78'))[_0x4b11('0x79')](_0x4b11('0x7a'),'tq')[_0x4b11('0x7b')]('user_has_teams','ut',_0x4b11('0x7c'))[_0x4b11('0x43')](_0x4b11('0x7d'),_0x3f2518[_0x4b11('0x4e')]['id']);for(var _0x4aa92d=0x0;_0x4aa92d<_0x1cf9a5['length'];_0x4aa92d+=0x1){let _0x558fe3=_0x1cf9a5[_0x4aa92d];for(var _0x169994=0x0;_0x169994<_0x558fe3['Agents'][_0x4b11('0x3e')];_0x169994+=0x1){let _0x4ae9ea=_0x558fe3[_0x4b11('0x6b')][_0x169994];var _0x546633=_0xeb5b73[_0x4b11('0x7e')]();_0x546633[_0x4b11('0x43')]('ut.UserId\x20=\x20?',_0x4ae9ea['id']);_0xfa77de['push'](db[_0x4b11('0x6f')]['query'](_0x546633[_0x4b11('0x7f')](),{'type':db[_0x4b11('0x6f')][_0x4b11('0x80')][_0x4b11('0x81')]})[_0x4b11('0x29')](function(_0x543a21){if(_0x543a21['length']===0x1){return _0x4ae9ea['id'];}else{var _0x6568ef=_[_0x4b11('0x82')](_[_0x4b11('0x33')](_0x543a21,_0x4b11('0x83')),function(_0x122d53){return _[_0x4b11('0x84')](_0x375aa2,_0x122d53);});if(_0x6568ef){return _0x4ae9ea['id'];}}}));}}return BPromise[_0x4b11('0x85')](_0xfa77de)[_0x4b11('0x29')](function(_0xb86e45){_0x315906=_(_0x315906)[_0x4b11('0x86')](_0xb86e45)['compact']()['value']();return db['FaxQueue'][_0x4b11('0x50')]({'where':{'id':_0x3f2518['params']['id']}})[_0x4b11('0x29')](function(_0x17a36b){return db[_0x4b11('0x6f')][_0x4b11('0x70')](function(_0x2611f2){return _0x17a36b[_0x4b11('0x76')](_0x3f2518[_0x4b11('0x39')][_0x4b11('0x6a')],{'transaction':_0x2611f2})[_0x4b11('0x29')](function(){if(!_[_0x4b11('0x87')](_0x315906)){return _0x17a36b[_0x4b11('0x88')](_0x315906,{'transaction':_0x2611f2});}})['then'](function(){_0x315906[_0x4b11('0x73')](function(_0x5b6d13){socket[_0x4b11('0x74')](_0x4b11('0x89'),{'UserId':_0x5b6d13,'FaxQueueId':_0x17a36b['id']});});});});});});})[_0x4b11('0x29')](respondWithStatusCode(_0x13a2e2,null))[_0x4b11('0x4d')](handleError(_0x13a2e2,null));};exports[_0x4b11('0x8a')]=function(_0x441396,_0x131157,_0x17de86){return db['FaxQueue'][_0x4b11('0x50')]({'where':{'id':_0x441396[_0x4b11('0x4e')]['id']}})[_0x4b11('0x29')](handleEntityNotFound(_0x131157,null))[_0x4b11('0x29')](function(_0x589642){if(_0x589642){return _0x589642[_0x4b11('0x8a')](_0x441396[_0x4b11('0x57')][_0x4b11('0x6a')],_[_0x4b11('0x8b')](_0x441396[_0x4b11('0x57')],[_0x4b11('0x6a'),'id'])||{})[_0x4b11('0x8c')](function(_0x5db43a){for(var _0x11da28=0x0;_0x11da28<_0x441396[_0x4b11('0x57')][_0x4b11('0x6a')][_0x4b11('0x3e')];_0x11da28+=0x1){socket[_0x4b11('0x74')](_0x4b11('0x75'),{'UserId':_0x441396['body'][_0x4b11('0x6a')][_0x11da28],'FaxQueueId':_0x441396['params']['id']});}return _0x5db43a;});}})['then'](respondWithResult(_0x131157,null))[_0x4b11('0x4d')](handleError(_0x131157,null));};exports[_0x4b11('0x88')]=function(_0xf1ac0d,_0x28a182,_0x257425){return db[_0x4b11('0x49')][_0x4b11('0x50')]({'where':{'id':_0xf1ac0d['params']['id']}})[_0x4b11('0x29')](handleEntityNotFound(_0x28a182,null))[_0x4b11('0x29')](function(_0x40dc30){if(_0x40dc30){return _0x40dc30[_0x4b11('0x88')](_0xf1ac0d['query'][_0x4b11('0x6a')])[_0x4b11('0x29')](function(){if(_[_0x4b11('0x8d')](_0xf1ac0d[_0x4b11('0x39')][_0x4b11('0x6a')])){for(var _0xdbea2d=0x0;_0xdbea2d<_0xf1ac0d[_0x4b11('0x39')][_0x4b11('0x6a')][_0x4b11('0x3e')];_0xdbea2d+=0x1){socket[_0x4b11('0x74')]('userFaxQueue:remove',{'UserId':Number(_0xf1ac0d[_0x4b11('0x39')][_0x4b11('0x6a')][_0xdbea2d]),'FaxQueueId':Number(_0xf1ac0d['params']['id'])});}}else{socket[_0x4b11('0x74')](_0x4b11('0x89'),{'UserId':Number(_0xf1ac0d[_0x4b11('0x39')][_0x4b11('0x6a')]),'FaxQueueId':Number(_0xf1ac0d[_0x4b11('0x4e')]['id'])});}});}})[_0x4b11('0x29')](respondWithStatusCode(_0x28a182,null))[_0x4b11('0x4d')](handleError(_0x28a182,null));};exports['getAgents']=function(_0x4d372a,_0x50495e,_0x409826){var _0x3a7f74={};var _0x2d9b7e={};var _0x633e2b;var _0x4d5e42;return db[_0x4b11('0x49')][_0x4b11('0x5a')]({'where':{'id':_0x4d372a[_0x4b11('0x4e')]['id']}})[_0x4b11('0x29')](handleEntityNotFound(_0x50495e,null))['then'](function(_0x2402e4){if(_0x2402e4){_0x633e2b=_0x2402e4;_0x2d9b7e[_0x4b11('0x38')]=_['keys'](db[_0x4b11('0x5f')][_0x4b11('0x34')]);_0x2d9b7e[_0x4b11('0x39')]=_[_0x4b11('0x3a')](_0x4d372a[_0x4b11('0x39')]);_0x2d9b7e['filters']=_['intersection'](_0x2d9b7e[_0x4b11('0x38')],_0x2d9b7e[_0x4b11('0x39')]);_0x3a7f74[_0x4b11('0x3f')]=_[_0x4b11('0x3c')](_0x2d9b7e[_0x4b11('0x38')],qs[_0x4b11('0x3d')](_0x4d372a[_0x4b11('0x39')][_0x4b11('0x3d')]));_0x3a7f74[_0x4b11('0x3f')]=_0x3a7f74[_0x4b11('0x3f')][_0x4b11('0x3e')]?_0x3a7f74[_0x4b11('0x3f')]:_0x2d9b7e[_0x4b11('0x38')];_0x3a7f74[_0x4b11('0x41')]=qs[_0x4b11('0x42')](_0x4d372a[_0x4b11('0x39')]['sort']);_0x3a7f74['where']=qs[_0x4b11('0x3b')](_['pick'](_0x4d372a[_0x4b11('0x39')],_0x2d9b7e[_0x4b11('0x3b')]));if(_0x4d372a['query'][_0x4b11('0x45')]){_0x3a7f74[_0x4b11('0x43')]=_[_0x4b11('0x46')](_0x3a7f74[_0x4b11('0x43')],{'$or':_[_0x4b11('0x33')](_0x3a7f74[_0x4b11('0x3f')],function(_0x5eac9c){var _0x17a0d7={};_0x17a0d7[_0x5eac9c]={'$like':'%'+_0x4d372a['query']['filter']+'%'};return _0x17a0d7;})});}_0x3a7f74=_['merge']({},_0x3a7f74,_0x4d372a[_0x4b11('0x48')]);return _0x633e2b[_0x4b11('0x8e')](_0x3a7f74);}})[_0x4b11('0x29')](function(_0x58446e){if(_0x58446e){_0x4d5e42=_0x58446e[_0x4b11('0x3e')];if(!_0x4d372a[_0x4b11('0x39')][_0x4b11('0x5c')]('nolimit')){_0x3a7f74[_0x4b11('0x40')]=qs[_0x4b11('0x40')](_0x4d372a['query'][_0x4b11('0x40')]);_0x3a7f74[_0x4b11('0x21')]=qs['offset'](_0x4d372a[_0x4b11('0x39')][_0x4b11('0x21')]);}return _0x633e2b[_0x4b11('0x8e')](_0x3a7f74);}})['then'](function(_0x4ed1d0){if(_0x4ed1d0){return _0x4ed1d0?{'count':_0x4d5e42,'rows':_0x4ed1d0}:null;}})[_0x4b11('0x29')](respondWithResult(_0x50495e,null))['catch'](handleError(_0x50495e,null));}; \ No newline at end of file +var _0xc2af=['createdAt','%s/%s','faxPause','getTeams','nolimit','addTeams','ids','Team','online','interface','flatMap','Agents','sequelize','forEach','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','status','json','offset','apply','save','update','destroy','get','UserProfileResource','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','then','findAll','rows','params','length','includeAll','find','catch','create','body','user','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','User','findAndCountAll','UserId','agent','updatedAt'];(function(_0x8a1cc2,_0x1a4f0e){var _0x272523=function(_0x4cba5b){while(--_0x4cba5b){_0x8a1cc2['push'](_0x8a1cc2['shift']());}};_0x272523(++_0x1a4f0e);}(_0xc2af,0x1bc));var _0xfc2a=function(_0x4b3b6a,_0x26bea2){_0x4b3b6a=_0x4b3b6a-0x0;var _0x51a48c=_0xc2af[_0x4b3b6a];return _0x51a48c;};'use strict';var pdf=require(_0xfc2a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfc2a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfc2a('0x2'));var rp=require(_0xfc2a('0x3'));var moment=require(_0xfc2a('0x4'));var BPromise=require(_0xfc2a('0x5'));var Mustache=require(_0xfc2a('0x6'));var util=require(_0xfc2a('0x7'));var path=require(_0xfc2a('0x8'));var sox=require(_0xfc2a('0x9'));var csv=require('to-csv');var ejs=require(_0xfc2a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfc2a('0xb'));var crypto=require('crypto');var jsforce=require(_0xfc2a('0xc'));var deskjs=require(_0xfc2a('0xd'));var toCsv=require(_0xfc2a('0xe'));var querystring=require(_0xfc2a('0xf'));var Papa=require('papaparse');var Redis=require(_0xfc2a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfc2a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc2a('0x12'));var logger=require(_0xfc2a('0x13'))(_0xfc2a('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xfc2a('0x15'))['db'];config[_0xfc2a('0x16')]=_[_0xfc2a('0x17')](config[_0xfc2a('0x16')],{'host':_0xfc2a('0x18'),'port':0x18eb});var socket=require(_0xfc2a('0x19'))(new Redis(config[_0xfc2a('0x16')]));require(_0xfc2a('0x1a'))[_0xfc2a('0x1b')](socket);function respondWithStatusCode(_0x55574a,_0x4e6b7e){_0x4e6b7e=_0x4e6b7e||0xcc;return function(_0x2dfd07){if(_0x2dfd07){return _0x55574a[_0xfc2a('0x1c')](_0x4e6b7e);}return _0x55574a['status'](_0x4e6b7e)[_0xfc2a('0x1d')]();};}function respondWithResult(_0x2f311c,_0x21654f){_0x21654f=_0x21654f||0xc8;return function(_0xbe368b){if(_0xbe368b){return _0x2f311c[_0xfc2a('0x1e')](_0x21654f)[_0xfc2a('0x1f')](_0xbe368b);}};}function respondWithFilteredResult(_0x1e1cff,_0x678f8d){return function(_0x257020){if(_0x257020){var _0x1e1524=_0x257020['count'],_0x43edb3=_0x678f8d[_0xfc2a('0x20')],_0x39bcb2=_0x678f8d[_0xfc2a('0x20')]+_0x678f8d['limit'],_0x27fb82;if(_0x39bcb2>=_0x1e1524){_0x39bcb2=_0x1e1524;_0x27fb82=0xc8;}else{_0x27fb82=0xce;}_0x1e1cff[_0xfc2a('0x1e')](_0x27fb82);return _0x1e1cff['set']('Content-Range',_0x43edb3+'-'+_0x39bcb2+'/'+_0x1e1524)[_0xfc2a('0x1f')](_0x257020);}return null;};}function patchUpdates(_0x2b7f5c){return function(_0x1ccd08){try{jsonpatch[_0xfc2a('0x21')](_0x1ccd08,_0x2b7f5c,!![]);}catch(_0x3b931d){return BPromise['reject'](_0x3b931d);}return _0x1ccd08[_0xfc2a('0x22')]();};}function saveUpdates(_0x4908d7,_0x5432f2){return function(_0x54c154){if(_0x54c154){return _0x54c154[_0xfc2a('0x23')](_0x4908d7)['then'](function(_0x4d6b68){return _0x4d6b68;});}return null;};}function removeEntity(_0x43e237,_0x10396d){return function(_0x2c732c){if(_0x2c732c){return _0x2c732c[_0xfc2a('0x24')]()['then'](function(){var _0x1c299c=_0x2c732c[_0xfc2a('0x25')]({'plain':!![]});var _0x33574a='FaxQueues';return db[_0xfc2a('0x26')][_0xfc2a('0x24')]({'where':{'type':_0x33574a,'resourceId':_0x1c299c['id']}})['then'](function(){return _0x2c732c;});})['then'](function(){_0x43e237[_0xfc2a('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe0727b,_0x45771d){return function(_0x2e6066){if(!_0x2e6066){_0xe0727b[_0xfc2a('0x1c')](0x194);}return _0x2e6066;};}function handleError(_0x5cfda2,_0x4fe30d){_0x4fe30d=_0x4fe30d||0x1f4;return function(_0x5f4165){logger[_0xfc2a('0x27')](_0x5f4165[_0xfc2a('0x28')]);if(_0x5f4165['name']){delete _0x5f4165[_0xfc2a('0x29')];}_0x5cfda2[_0xfc2a('0x1e')](_0x4fe30d)[_0xfc2a('0x2a')](_0x5f4165);};}exports[_0xfc2a('0x2b')]=function(_0x10debd,_0x1d6fb3){var _0x24e55a={},_0x3ceaf3={},_0x33d648={'count':0x0,'rows':[]};var _0x5f05cb=_[_0xfc2a('0x2c')](db[_0xfc2a('0x2d')][_0xfc2a('0x2e')],function(_0x45ba01){return{'name':_0x45ba01[_0xfc2a('0x2f')],'type':_0x45ba01[_0xfc2a('0x30')][_0xfc2a('0x31')]};});_0x3ceaf3[_0xfc2a('0x32')]=_[_0xfc2a('0x2c')](_0x5f05cb,_0xfc2a('0x29'));_0x3ceaf3[_0xfc2a('0x33')]=_[_0xfc2a('0x34')](_0x10debd['query']);_0x3ceaf3[_0xfc2a('0x35')]=_[_0xfc2a('0x36')](_0x3ceaf3[_0xfc2a('0x32')],_0x3ceaf3[_0xfc2a('0x33')]);_0x24e55a['attributes']=_[_0xfc2a('0x36')](_0x3ceaf3['model'],qs[_0xfc2a('0x37')](_0x10debd['query'][_0xfc2a('0x37')]));_0x24e55a[_0xfc2a('0x38')]=_0x24e55a['attributes']['length']?_0x24e55a['attributes']:_0x3ceaf3['model'];if(!_0x10debd[_0xfc2a('0x33')][_0xfc2a('0x39')]('nolimit')){_0x24e55a['limit']=qs[_0xfc2a('0x3a')](_0x10debd[_0xfc2a('0x33')][_0xfc2a('0x3a')]);_0x24e55a[_0xfc2a('0x20')]=qs[_0xfc2a('0x20')](_0x10debd['query'][_0xfc2a('0x20')]);}_0x24e55a[_0xfc2a('0x3b')]=qs['sort'](_0x10debd[_0xfc2a('0x33')][_0xfc2a('0x3c')]);_0x24e55a[_0xfc2a('0x3d')]=qs['filters'](_[_0xfc2a('0x3e')](_0x10debd[_0xfc2a('0x33')],_0x3ceaf3['filters']));if(_0x10debd[_0xfc2a('0x33')][_0xfc2a('0x3f')]){_0x24e55a[_0xfc2a('0x3d')]=_[_0xfc2a('0x40')](_0x24e55a[_0xfc2a('0x3d')],{'$or':_[_0xfc2a('0x2c')](_0x5f05cb,function(_0x489324){if(_0x489324[_0xfc2a('0x30')]!==_0xfc2a('0x41')){var _0x319a67={};_0x319a67[_0x489324[_0xfc2a('0x29')]]={'$like':'%'+_0x10debd[_0xfc2a('0x33')][_0xfc2a('0x3f')]+'%'};return _0x319a67;}})});}_0x24e55a=_['merge']({},_0x24e55a,_0x10debd[_0xfc2a('0x42')]);var _0x3fdfec={'where':_0x24e55a[_0xfc2a('0x3d')]};return db[_0xfc2a('0x2d')][_0xfc2a('0x43')](_0x3fdfec)[_0xfc2a('0x44')](function(_0x491bff){_0x33d648[_0xfc2a('0x43')]=_0x491bff;if(_0x10debd[_0xfc2a('0x33')]['includeAll']){_0x24e55a['include']=[{'all':!![]}];}return db[_0xfc2a('0x2d')][_0xfc2a('0x45')](_0x24e55a);})['then'](function(_0x53a63a){_0x33d648[_0xfc2a('0x46')]=_0x53a63a;return _0x33d648;})[_0xfc2a('0x44')](respondWithFilteredResult(_0x1d6fb3,_0x24e55a))['catch'](handleError(_0x1d6fb3,null));};exports['show']=function(_0x348152,_0xdb6305){var _0x5d16e4={'raw':!![],'where':{'id':_0x348152[_0xfc2a('0x47')]['id']}},_0x368f21={};_0x368f21[_0xfc2a('0x32')]=_['keys'](db[_0xfc2a('0x2d')][_0xfc2a('0x2e')]);_0x368f21[_0xfc2a('0x33')]=_['keys'](_0x348152[_0xfc2a('0x33')]);_0x368f21[_0xfc2a('0x35')]=_[_0xfc2a('0x36')](_0x368f21['model'],_0x368f21[_0xfc2a('0x33')]);_0x5d16e4[_0xfc2a('0x38')]=_[_0xfc2a('0x36')](_0x368f21[_0xfc2a('0x32')],qs[_0xfc2a('0x37')](_0x348152[_0xfc2a('0x33')][_0xfc2a('0x37')]));_0x5d16e4['attributes']=_0x5d16e4[_0xfc2a('0x38')][_0xfc2a('0x48')]?_0x5d16e4[_0xfc2a('0x38')]:_0x368f21[_0xfc2a('0x32')];if(_0x348152[_0xfc2a('0x33')][_0xfc2a('0x49')]){_0x5d16e4['include']=[{'all':!![]}];}_0x5d16e4=_['merge']({},_0x5d16e4,_0x348152['options']);return db[_0xfc2a('0x2d')][_0xfc2a('0x4a')](_0x5d16e4)[_0xfc2a('0x44')](handleEntityNotFound(_0xdb6305,null))['then'](respondWithResult(_0xdb6305,null))[_0xfc2a('0x4b')](handleError(_0xdb6305,null));};exports['create']=function(_0xf0b6fb,_0x37ed34){return db[_0xfc2a('0x2d')][_0xfc2a('0x4c')](_0xf0b6fb[_0xfc2a('0x4d')],{})[_0xfc2a('0x44')](function(_0x2a038a){var _0x438bee=_0xf0b6fb[_0xfc2a('0x4e')][_0xfc2a('0x25')]({'plain':!![]});if(!_0x438bee)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x438bee['role']==='user'){var _0x2b2016=_0x2a038a[_0xfc2a('0x25')]({'plain':!![]});var _0x239351='FaxQueues';return db[_0xfc2a('0x4f')][_0xfc2a('0x4a')]({'where':{'name':_0x239351,'userProfileId':_0x438bee[_0xfc2a('0x50')]},'raw':!![]})[_0xfc2a('0x44')](function(_0x4273c2){if(_0x4273c2&&_0x4273c2[_0xfc2a('0x51')]===0x0){return db[_0xfc2a('0x26')][_0xfc2a('0x4c')]({'name':_0x2b2016[_0xfc2a('0x29')],'resourceId':_0x2b2016['id'],'type':_0x4273c2['name'],'sectionId':_0x4273c2['id']},{})[_0xfc2a('0x44')](function(){return _0x2a038a;});}else{return _0x2a038a;}})['catch'](function(_0x3ba453){logger[_0xfc2a('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ba453);throw _0x3ba453;});}return _0x2a038a;})[_0xfc2a('0x44')](respondWithResult(_0x37ed34,0xc9))['catch'](handleError(_0x37ed34,null));};exports[_0xfc2a('0x23')]=function(_0x517445,_0x16e6a3){if(_0x517445[_0xfc2a('0x4d')]['id']){delete _0x517445[_0xfc2a('0x4d')]['id'];}return db['FaxQueue'][_0xfc2a('0x4a')]({'where':{'id':_0x517445[_0xfc2a('0x47')]['id']}})[_0xfc2a('0x44')](handleEntityNotFound(_0x16e6a3,null))[_0xfc2a('0x44')](saveUpdates(_0x517445[_0xfc2a('0x4d')],null))[_0xfc2a('0x44')](respondWithResult(_0x16e6a3,null))['catch'](handleError(_0x16e6a3,null));};exports['destroy']=function(_0x2833c4,_0x21f9c0){return db[_0xfc2a('0x2d')][_0xfc2a('0x4a')]({'where':{'id':_0x2833c4[_0xfc2a('0x47')]['id']}})['then'](handleEntityNotFound(_0x21f9c0,null))[_0xfc2a('0x44')](removeEntity(_0x21f9c0,null))[_0xfc2a('0x4b')](handleError(_0x21f9c0,null));};exports['describe']=function(_0x583a14,_0x4d9d66){return db[_0xfc2a('0x2d')][_0xfc2a('0x52')]()[_0xfc2a('0x44')](respondWithResult(_0x4d9d66,null))[_0xfc2a('0x4b')](handleError(_0x4d9d66,null));};exports[_0xfc2a('0x53')]=function(_0x42003f,_0x175859,_0x165f5b){var _0xb7d563={'raw':!![],'where':{}},_0x50b1f3={},_0x142972;return db[_0xfc2a('0x2d')][_0xfc2a('0x54')]({'where':{'id':_0x42003f[_0xfc2a('0x47')]['id']}})['then'](handleEntityNotFound(_0x175859,null))['then'](function(_0x45d70e){if(_0x45d70e){_0x142972=_0x45d70e[_0xfc2a('0x25')]({'plain':!![]});_0x50b1f3[_0xfc2a('0x32')]=_['keys'](db[_0xfc2a('0x55')]['rawAttributes']);_0x50b1f3[_0xfc2a('0x33')]=_[_0xfc2a('0x34')](_0x42003f['query']);_0x50b1f3['filters']=_[_0xfc2a('0x36')](_0x50b1f3[_0xfc2a('0x32')],_0x50b1f3[_0xfc2a('0x33')]);_0xb7d563['attributes']=_[_0xfc2a('0x36')](_0x50b1f3[_0xfc2a('0x32')],qs['fields'](_0x42003f[_0xfc2a('0x33')]['fields']));_0xb7d563[_0xfc2a('0x38')]=_0xb7d563[_0xfc2a('0x38')]['length']?_0xb7d563[_0xfc2a('0x38')]:_0x50b1f3[_0xfc2a('0x32')];if(!_0x42003f[_0xfc2a('0x33')][_0xfc2a('0x39')]('nolimit')){_0xb7d563['limit']=qs['limit'](_0x42003f[_0xfc2a('0x33')]['limit']);_0xb7d563[_0xfc2a('0x20')]=qs[_0xfc2a('0x20')](_0x42003f['query'][_0xfc2a('0x20')]);}_0xb7d563[_0xfc2a('0x3b')]=qs[_0xfc2a('0x3c')](_0x42003f[_0xfc2a('0x33')]['sort']);_0xb7d563['where']=qs[_0xfc2a('0x35')](_[_0xfc2a('0x3e')](_0x42003f[_0xfc2a('0x33')],_0x50b1f3[_0xfc2a('0x35')]));_0xb7d563[_0xfc2a('0x3d')][_0xfc2a('0x56')]=_0x45d70e['id'];if(_0x42003f[_0xfc2a('0x33')][_0xfc2a('0x3f')]){_0xb7d563['where']=_[_0xfc2a('0x40')](_0xb7d563[_0xfc2a('0x3d')],{'$or':_[_0xfc2a('0x2c')](_0xb7d563[_0xfc2a('0x38')],function(_0x2d6bb9){var _0x1c1d71={};_0x1c1d71[_0x2d6bb9]={'$like':'%'+_0x42003f[_0xfc2a('0x33')][_0xfc2a('0x3f')]+'%'};return _0x1c1d71;})});}_0xb7d563=_[_0xfc2a('0x40')]({},_0xb7d563,_0x42003f[_0xfc2a('0x42')]);return db['UserFaxQueue'][_0xfc2a('0x45')](_0xb7d563);}})[_0xfc2a('0x44')](function(_0x410e00){if(_0x410e00){return db[_0xfc2a('0x57')][_0xfc2a('0x58')]({'where':{'id':_[_0xfc2a('0x2c')](_0x410e00,_0xfc2a('0x59')),'role':_0xfc2a('0x5a')},'attributes':['id',_0xfc2a('0x29'),'faxPause',_0xfc2a('0x5b'),_0xfc2a('0x5c')]});}})[_0xfc2a('0x44')](function(_0x2bfb4c){if(_0x2bfb4c){return{'count':_0x2bfb4c[_0xfc2a('0x43')],'rows':_[_0xfc2a('0x2c')](_0x2bfb4c[_0xfc2a('0x46')],function(_0x201152){return{'membername':_0x201152[_0xfc2a('0x29')],'UserId':_0x201152['id'],'queue_name':_0x142972[_0xfc2a('0x29')],'FaxQueueId':_0x142972['id'],'interface':util['format'](_0xfc2a('0x5d'),'SIP',_0x201152[_0xfc2a('0x29')]),'penalty':0x0,'paused':_0x201152[_0xfc2a('0x5e')],'createdAt':_0x201152[_0xfc2a('0x5c')],'updatedAt':_0x201152[_0xfc2a('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfc2a('0x44')](respondWithFilteredResult(_0x175859,_0xb7d563))[_0xfc2a('0x4b')](handleError(_0x175859,null));};exports[_0xfc2a('0x5f')]=function(_0x365e9e,_0xb90d66,_0x1c5206){var _0x38c08a={};var _0x262b0d={};var _0x19af98;var _0x32ce24;return db[_0xfc2a('0x2d')][_0xfc2a('0x54')]({'where':{'id':_0x365e9e[_0xfc2a('0x47')]['id']}})[_0xfc2a('0x44')](handleEntityNotFound(_0xb90d66,null))[_0xfc2a('0x44')](function(_0xe29e0){if(_0xe29e0){_0x19af98=_0xe29e0;_0x262b0d[_0xfc2a('0x32')]=_[_0xfc2a('0x34')](db['Team'][_0xfc2a('0x2e')]);_0x262b0d[_0xfc2a('0x33')]=_['keys'](_0x365e9e[_0xfc2a('0x33')]);_0x262b0d[_0xfc2a('0x35')]=_[_0xfc2a('0x36')](_0x262b0d['model'],_0x262b0d[_0xfc2a('0x33')]);_0x38c08a[_0xfc2a('0x38')]=_[_0xfc2a('0x36')](_0x262b0d[_0xfc2a('0x32')],qs[_0xfc2a('0x37')](_0x365e9e[_0xfc2a('0x33')][_0xfc2a('0x37')]));_0x38c08a[_0xfc2a('0x38')]=_0x38c08a[_0xfc2a('0x38')]['length']?_0x38c08a[_0xfc2a('0x38')]:_0x262b0d[_0xfc2a('0x32')];_0x38c08a[_0xfc2a('0x3b')]=qs[_0xfc2a('0x3c')](_0x365e9e[_0xfc2a('0x33')][_0xfc2a('0x3c')]);_0x38c08a[_0xfc2a('0x3d')]=qs[_0xfc2a('0x35')](_[_0xfc2a('0x3e')](_0x365e9e[_0xfc2a('0x33')],_0x262b0d[_0xfc2a('0x35')]));if(_0x365e9e[_0xfc2a('0x33')]['filter']){_0x38c08a[_0xfc2a('0x3d')]=_[_0xfc2a('0x40')](_0x38c08a[_0xfc2a('0x3d')],{'$or':_[_0xfc2a('0x2c')](_0x38c08a['attributes'],function(_0x8771fa){var _0x47b5cf={};_0x47b5cf[_0x8771fa]={'$like':'%'+_0x365e9e[_0xfc2a('0x33')][_0xfc2a('0x3f')]+'%'};return _0x47b5cf;})});}_0x38c08a=_[_0xfc2a('0x40')]({},_0x38c08a,_0x365e9e[_0xfc2a('0x42')]);return _0x19af98[_0xfc2a('0x5f')](_0x38c08a);}})['then'](function(_0xe9257f){if(_0xe9257f){_0x32ce24=_0xe9257f['length'];if(!_0x365e9e[_0xfc2a('0x33')][_0xfc2a('0x39')](_0xfc2a('0x60'))){_0x38c08a[_0xfc2a('0x3a')]=qs['limit'](_0x365e9e[_0xfc2a('0x33')][_0xfc2a('0x3a')]);_0x38c08a[_0xfc2a('0x20')]=qs[_0xfc2a('0x20')](_0x365e9e[_0xfc2a('0x33')]['offset']);}return _0x19af98[_0xfc2a('0x5f')](_0x38c08a);}})[_0xfc2a('0x44')](function(_0x3b0efe){if(_0x3b0efe){return _0x3b0efe?{'count':_0x32ce24,'rows':_0x3b0efe}:null;}})[_0xfc2a('0x44')](respondWithResult(_0xb90d66,null))[_0xfc2a('0x4b')](handleError(_0xb90d66,null));};exports[_0xfc2a('0x61')]=function(_0x457fb2,_0x45ce13,_0x1793d3){var _0x4e8279=_0x457fb2['body'][_0xfc2a('0x62')];return db[_0xfc2a('0x63')][_0xfc2a('0x45')]({'where':{'id':_0x4e8279},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0xfc2a('0x64'),'voicePause',_0xfc2a('0x65')],'raw':!![]}]})[_0xfc2a('0x44')](function(_0x50b49d){if(_0x50b49d){var _0x5a7ccb=_[_0xfc2a('0x66')](_0x50b49d,function(_0x2e58df){var _0x4a62d0=_0x2e58df[_0xfc2a('0x25')]({'plain':!![]});return _0x4a62d0[_0xfc2a('0x67')];});return db[_0xfc2a('0x2d')][_0xfc2a('0x4a')]({'where':{'id':_0x457fb2[_0xfc2a('0x47')]['id']}})[_0xfc2a('0x44')](function(_0x25f5d6){return db[_0xfc2a('0x68')]['transaction'](function(_0x294875){return _0x25f5d6[_0xfc2a('0x61')](_0x4e8279,{'transaction':_0x294875})[_0xfc2a('0x44')](function(){return BPromise['each'](_0x5a7ccb,function(_0x8cb6bb){return db[_0xfc2a('0x55')]['findOrCreate']({'where':{'UserId':_0x8cb6bb['id'],'FaxQueueId':_0x457fb2[_0xfc2a('0x47')]['id']},'transaction':_0x294875});});})[_0xfc2a('0x44')](function(){_0x5a7ccb[_0xfc2a('0x69')](function(_0x4531c){socket['emit']('userFaxQueue:save',{'UserId':_0x4531c['id'],'FaxQueueId':_0x25f5d6['id']});});});});});}})['then'](respondWithStatusCode(_0x45ce13,null))[_0xfc2a('0x4b')](handleError(_0x45ce13,null));};exports['removeTeams']=function(_0xbff48d,_0x5ac600,_0x281b56){return db[_0xfc2a('0x63')]['findAll']({'where':{'id':_0xbff48d['query'][_0xfc2a('0x62')]},'attributes':['id'],'include':[{'model':db[_0xfc2a('0x57')],'as':_0xfc2a('0x67'),'attributes':['id'],'raw':!![]}]})[_0xfc2a('0x44')](handleEntityNotFound(_0x5ac600,null))[_0xfc2a('0x44')](function(_0x5625e1){var _0x1d2765=_[_0xfc2a('0x2c')](_0x5625e1,'id');var _0x2577ea=[];var _0x3cdefd=[];var _0x48ed33=squel[_0xfc2a('0x6a')]();_0x48ed33[_0xfc2a('0x6b')](_0xfc2a('0x6c'))[_0xfc2a('0x6d')](_0xfc2a('0x6e'),'tq')[_0xfc2a('0x6f')](_0xfc2a('0x70'),'ut',_0xfc2a('0x71'))[_0xfc2a('0x3d')](_0xfc2a('0x72'),_0xbff48d[_0xfc2a('0x47')]['id']);for(var _0x51e89f=0x0;_0x51e89f<_0x5625e1[_0xfc2a('0x48')];_0x51e89f+=0x1){let _0x1fa750=_0x5625e1[_0x51e89f];for(var _0x37d36c=0x0;_0x37d36c<_0x1fa750[_0xfc2a('0x67')]['length'];_0x37d36c+=0x1){let _0x5ab94d=_0x1fa750[_0xfc2a('0x67')][_0x37d36c];var _0x38bb6f=_0x48ed33[_0xfc2a('0x73')]();_0x38bb6f['where'](_0xfc2a('0x74'),_0x5ab94d['id']);_0x3cdefd[_0xfc2a('0x75')](db[_0xfc2a('0x68')][_0xfc2a('0x33')](_0x38bb6f[_0xfc2a('0x76')](),{'type':db[_0xfc2a('0x68')][_0xfc2a('0x77')][_0xfc2a('0x78')]})[_0xfc2a('0x44')](function(_0x574c99){if(_0x574c99[_0xfc2a('0x48')]===0x1){return _0x5ab94d['id'];}else{var _0x366199=_[_0xfc2a('0x79')](_[_0xfc2a('0x2c')](_0x574c99,_0xfc2a('0x7a')),function(_0x57a13c){return _[_0xfc2a('0x7b')](_0x1d2765,_0x57a13c);});if(_0x366199){return _0x5ab94d['id'];}}}));}}return BPromise['all'](_0x3cdefd)[_0xfc2a('0x44')](function(_0x34bf1d){_0x2577ea=_(_0x2577ea)[_0xfc2a('0x7c')](_0x34bf1d)['compact']()['value']();return db[_0xfc2a('0x2d')][_0xfc2a('0x4a')]({'where':{'id':_0xbff48d['params']['id']}})[_0xfc2a('0x44')](function(_0x3b747b){return db['sequelize']['transaction'](function(_0x404343){return _0x3b747b['removeTeams'](_0xbff48d['query'][_0xfc2a('0x62')],{'transaction':_0x404343})[_0xfc2a('0x44')](function(){if(!_[_0xfc2a('0x7d')](_0x2577ea)){return _0x3b747b[_0xfc2a('0x7e')](_0x2577ea,{'transaction':_0x404343});}})[_0xfc2a('0x44')](function(){_0x2577ea[_0xfc2a('0x69')](function(_0xe59e29){socket[_0xfc2a('0x7f')](_0xfc2a('0x80'),{'UserId':_0xe59e29,'FaxQueueId':_0x3b747b['id']});});});});});});})[_0xfc2a('0x44')](respondWithStatusCode(_0x5ac600,null))[_0xfc2a('0x4b')](handleError(_0x5ac600,null));};exports[_0xfc2a('0x81')]=function(_0x399d4a,_0x237170,_0x223b02){return db[_0xfc2a('0x2d')][_0xfc2a('0x4a')]({'where':{'id':_0x399d4a['params']['id']}})[_0xfc2a('0x44')](handleEntityNotFound(_0x237170,null))['then'](function(_0x10a6f8){if(_0x10a6f8){return _0x10a6f8[_0xfc2a('0x81')](_0x399d4a['body'][_0xfc2a('0x62')],_[_0xfc2a('0x82')](_0x399d4a[_0xfc2a('0x4d')],[_0xfc2a('0x62'),'id'])||{})[_0xfc2a('0x83')](function(_0x2e0289){for(var _0x1f7745=0x0;_0x1f7745<_0x399d4a[_0xfc2a('0x4d')][_0xfc2a('0x62')][_0xfc2a('0x48')];_0x1f7745+=0x1){socket[_0xfc2a('0x7f')]('userFaxQueue:save',{'UserId':_0x399d4a['body'][_0xfc2a('0x62')][_0x1f7745],'FaxQueueId':_0x399d4a[_0xfc2a('0x47')]['id']});}return _0x2e0289;});}})[_0xfc2a('0x44')](respondWithResult(_0x237170,null))['catch'](handleError(_0x237170,null));};exports['removeAgents']=function(_0x147ed4,_0xb63dc7,_0x4e621c){return db[_0xfc2a('0x2d')][_0xfc2a('0x4a')]({'where':{'id':_0x147ed4['params']['id']}})[_0xfc2a('0x44')](handleEntityNotFound(_0xb63dc7,null))[_0xfc2a('0x44')](function(_0x24cb1e){if(_0x24cb1e){return _0x24cb1e['removeAgents'](_0x147ed4['query'][_0xfc2a('0x62')])[_0xfc2a('0x44')](function(){if(_[_0xfc2a('0x84')](_0x147ed4[_0xfc2a('0x33')][_0xfc2a('0x62')])){for(var _0x1474d4=0x0;_0x1474d4<_0x147ed4[_0xfc2a('0x33')][_0xfc2a('0x62')][_0xfc2a('0x48')];_0x1474d4+=0x1){socket['emit'](_0xfc2a('0x80'),{'UserId':Number(_0x147ed4[_0xfc2a('0x33')][_0xfc2a('0x62')][_0x1474d4]),'FaxQueueId':Number(_0x147ed4[_0xfc2a('0x47')]['id'])});}}else{socket['emit'](_0xfc2a('0x80'),{'UserId':Number(_0x147ed4[_0xfc2a('0x33')][_0xfc2a('0x62')]),'FaxQueueId':Number(_0x147ed4[_0xfc2a('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0xb63dc7,null))[_0xfc2a('0x4b')](handleError(_0xb63dc7,null));};exports[_0xfc2a('0x85')]=function(_0x1ee3aa,_0x360690,_0x3f9423){var _0x491d8d={};var _0x1a74c9={};var _0x54853d;var _0x177ea8;return db[_0xfc2a('0x2d')]['findOne']({'where':{'id':_0x1ee3aa[_0xfc2a('0x47')]['id']}})[_0xfc2a('0x44')](handleEntityNotFound(_0x360690,null))['then'](function(_0x86b3d3){if(_0x86b3d3){_0x54853d=_0x86b3d3;_0x1a74c9[_0xfc2a('0x32')]=_[_0xfc2a('0x34')](db[_0xfc2a('0x57')]['rawAttributes']);_0x1a74c9[_0xfc2a('0x33')]=_[_0xfc2a('0x34')](_0x1ee3aa[_0xfc2a('0x33')]);_0x1a74c9[_0xfc2a('0x35')]=_[_0xfc2a('0x36')](_0x1a74c9[_0xfc2a('0x32')],_0x1a74c9[_0xfc2a('0x33')]);_0x491d8d['attributes']=_['intersection'](_0x1a74c9[_0xfc2a('0x32')],qs[_0xfc2a('0x37')](_0x1ee3aa['query'][_0xfc2a('0x37')]));_0x491d8d[_0xfc2a('0x38')]=_0x491d8d['attributes'][_0xfc2a('0x48')]?_0x491d8d[_0xfc2a('0x38')]:_0x1a74c9['model'];_0x491d8d[_0xfc2a('0x3b')]=qs[_0xfc2a('0x3c')](_0x1ee3aa[_0xfc2a('0x33')][_0xfc2a('0x3c')]);_0x491d8d[_0xfc2a('0x3d')]=qs[_0xfc2a('0x35')](_[_0xfc2a('0x3e')](_0x1ee3aa['query'],_0x1a74c9['filters']));if(_0x1ee3aa[_0xfc2a('0x33')][_0xfc2a('0x3f')]){_0x491d8d[_0xfc2a('0x3d')]=_[_0xfc2a('0x40')](_0x491d8d['where'],{'$or':_[_0xfc2a('0x2c')](_0x491d8d[_0xfc2a('0x38')],function(_0x2c631e){var _0x516dca={};_0x516dca[_0x2c631e]={'$like':'%'+_0x1ee3aa[_0xfc2a('0x33')]['filter']+'%'};return _0x516dca;})});}_0x491d8d=_[_0xfc2a('0x40')]({},_0x491d8d,_0x1ee3aa[_0xfc2a('0x42')]);return _0x54853d[_0xfc2a('0x85')](_0x491d8d);}})['then'](function(_0x5aae3f){if(_0x5aae3f){_0x177ea8=_0x5aae3f[_0xfc2a('0x48')];if(!_0x1ee3aa[_0xfc2a('0x33')][_0xfc2a('0x39')](_0xfc2a('0x60'))){_0x491d8d[_0xfc2a('0x3a')]=qs[_0xfc2a('0x3a')](_0x1ee3aa[_0xfc2a('0x33')][_0xfc2a('0x3a')]);_0x491d8d['offset']=qs[_0xfc2a('0x20')](_0x1ee3aa[_0xfc2a('0x33')][_0xfc2a('0x20')]);}return _0x54853d[_0xfc2a('0x85')](_0x491d8d);}})[_0xfc2a('0x44')](function(_0x5663fe){if(_0x5663fe){return _0x5663fe?{'count':_0x177ea8,'rows':_0x5663fe}:null;}})[_0xfc2a('0x44')](respondWithResult(_0x360690,null))['catch'](handleError(_0x360690,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index fbb9216..4ee9d28 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 _0x1f3a=['hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x1f3a,0xa2));var _0xa1f3=function(_0x3863f5,_0xbabf2){_0x3863f5=_0x3863f5-0x0;var _0x178c72=_0x1f3a[_0x3863f5];return _0x178c72;};'use strict';var EventEmitter=require(_0xa1f3('0x0'));var FaxQueue=require(_0xa1f3('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xa1f3('0x2')](0x0);var events={'afterCreate':_0xa1f3('0x3'),'afterUpdate':'update','afterDestroy':_0xa1f3('0x4')};function emitEvent(_0x53621e){return function(_0x5a5b02,_0x3fc44d,_0x5f1766){FaxQueueEvents['emit'](_0x53621e+':'+_0x5a5b02['id'],_0x5a5b02);FaxQueueEvents[_0xa1f3('0x5')](_0x53621e,_0x5a5b02);_0x5f1766(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xa1f3('0x6')](e,emitEvent(event));}}module[_0xa1f3('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x9cf4=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxQueue','setMaxListeners','save','update'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x9cf4,0x1da));var _0x49cf=function(_0x3627ac,_0x163c9a){_0x3627ac=_0x3627ac-0x0;var _0x197140=_0x9cf4[_0x3627ac];return _0x197140;};'use strict';var EventEmitter=require(_0x49cf('0x0'));var FaxQueue=require(_0x49cf('0x1'))['db'][_0x49cf('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x49cf('0x3')](0x0);var events={'afterCreate':_0x49cf('0x4'),'afterUpdate':_0x49cf('0x5'),'afterDestroy':_0x49cf('0x6')};function emitEvent(_0x44ca15){return function(_0x1cb1f2,_0x145c74,_0x11bab4){FaxQueueEvents[_0x49cf('0x7')](_0x44ca15+':'+_0x1cb1f2['id'],_0x1cb1f2);FaxQueueEvents[_0x49cf('0x7')](_0x44ca15,_0x1cb1f2);_0x11bab4(null);};}for(var e in events){if(events[_0x49cf('0x8')](e)){var event=events[e];FaxQueue[_0x49cf('0x9')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 5dc8232..c4f7439 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 _0x8d3b=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash'];(function(_0xb58ab4,_0x396977){var _0x5e30a5=function(_0xfbd8fd){while(--_0xfbd8fd){_0xb58ab4['push'](_0xb58ab4['shift']());}};_0x5e30a5(++_0x396977);}(_0x8d3b,0x1e0));var _0xb8d3=function(_0x42a002,_0x210c6f){_0x42a002=_0x42a002-0x0;var _0x428abf=_0x8d3b[_0x42a002];return _0x428abf;};'use strict';var _=require(_0xb8d3('0x0'));var util=require(_0xb8d3('0x1'));var logger=require(_0xb8d3('0x2'))('api');var moment=require(_0xb8d3('0x3'));var BPromise=require(_0xb8d3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb8d3('0x5'));var rimraf=require(_0xb8d3('0x6'));var config=require(_0xb8d3('0x7'));var attributes=require(_0xb8d3('0x8'));module[_0xb8d3('0x9')]=function(_0x149600,_0x421416){return _0x149600[_0xb8d3('0xa')](_0xb8d3('0xb'),attributes,{'tableName':_0xb8d3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee7c=['api','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','../../config/logger'];(function(_0x532f4e,_0x5e35ca){var _0x48c9c4=function(_0x2204f6){while(--_0x2204f6){_0x532f4e['push'](_0x532f4e['shift']());}};_0x48c9c4(++_0x5e35ca);}(_0xee7c,0x1ea));var _0xcee7=function(_0x172fc7,_0x113566){_0x172fc7=_0x172fc7-0x0;var _0x31b308=_0xee7c[_0x172fc7];return _0x31b308;};'use strict';var _=require(_0xcee7('0x0'));var util=require('util');var logger=require(_0xcee7('0x1'))(_0xcee7('0x2'));var moment=require('moment');var BPromise=require(_0xcee7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcee7('0x4'));var rimraf=require(_0xcee7('0x5'));var config=require(_0xcee7('0x6'));var attributes=require(_0xcee7('0x7'));module[_0xcee7('0x8')]=function(_0x436cb3,_0x268443){return _0x436cb3[_0xcee7('0x9')](_0xcee7('0xa'),attributes,{'tableName':_0xcee7('0xb'),'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 d1c1915..a508e2f 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 _0xd0c3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','map','include','model','ShowFaxQueue','util','bluebird','randomstring'];(function(_0x18dd54,_0x1d8942){var _0x3450be=function(_0x1b7a00){while(--_0x1b7a00){_0x18dd54['push'](_0x18dd54['shift']());}};_0x3450be(++_0x1d8942);}(_0xd0c3,0x100));var _0x3d0c=function(_0x521c68,_0x4eeb50){_0x521c68=_0x521c68-0x0;var _0xf369e3=_0xd0c3[_0x521c68];return _0xf369e3;};'use strict';var _=require('lodash');var util=require(_0x3d0c('0x0'));var moment=require('moment');var BPromise=require(_0x3d0c('0x1'));var rs=require(_0x3d0c('0x2'));var fs=require('fs');var Redis=require(_0x3d0c('0x3'));var db=require(_0x3d0c('0x4'))['db'];var utils=require(_0x3d0c('0x5'));var logger=require(_0x3d0c('0x6'))('rpc');var config=require(_0x3d0c('0x7'));var jayson=require(_0x3d0c('0x8'));var client=jayson['client'][_0x3d0c('0x9')]({'port':0x232a});config[_0x3d0c('0xa')]=_['defaults'](config[_0x3d0c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3d0c('0xb'))(new Redis(config['redis']));require(_0x3d0c('0xc'))[_0x3d0c('0xd')](socket);function respondWithRpcPromise(_0x39dbaa,_0x18e766,_0x4877d5){return new BPromise(function(_0x1506e5,_0x4a7d0e){return client[_0x3d0c('0xe')](_0x39dbaa,_0x4877d5)[_0x3d0c('0xf')](function(_0x34999e){logger['info'](_0x3d0c('0x10'),_0x18e766,_0x3d0c('0x11'));logger[_0x3d0c('0x12')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x18e766,'request\x20sent',JSON[_0x3d0c('0x13')](_0x34999e));if(_0x34999e[_0x3d0c('0x14')]){if(_0x34999e[_0x3d0c('0x14')][_0x3d0c('0x15')]===0x1f4){logger['error'](_0x3d0c('0x10'),_0x18e766,_0x34999e['error'][_0x3d0c('0x16')]);return _0x4a7d0e(_0x34999e[_0x3d0c('0x14')]['message']);}logger['error'](_0x3d0c('0x10'),_0x18e766,_0x34999e['error'][_0x3d0c('0x16')]);return _0x1506e5(_0x34999e['error'][_0x3d0c('0x16')]);}else{logger[_0x3d0c('0x17')](_0x3d0c('0x10'),_0x18e766,_0x3d0c('0x11'));_0x1506e5(_0x34999e['result']['message']);}})[_0x3d0c('0x18')](function(_0x356dd6){logger[_0x3d0c('0x14')](_0x3d0c('0x10'),_0x18e766,_0x356dd6);_0x4a7d0e(_0x356dd6);});});}exports[_0x3d0c('0x19')]=function(_0x5c5627){var _0x5c0425=this;return new Promise(function(_0x324660,_0x5ee854){return db[_0x3d0c('0x1a')][_0x3d0c('0x1b')]({'raw':_0x5c5627['options']?_0x5c5627[_0x3d0c('0x1c')][_0x3d0c('0x1d')]===undefined?!![]:![]:!![],'where':_0x5c5627[_0x3d0c('0x1c')]?_0x5c5627['options'][_0x3d0c('0x1e')]||null:null,'attributes':_0x5c5627[_0x3d0c('0x1c')]?_0x5c5627[_0x3d0c('0x1c')][_0x3d0c('0x1f')]||null:null,'limit':_0x5c5627['options']?_0x5c5627['options'][_0x3d0c('0x20')]||null:null,'include':_0x5c5627[_0x3d0c('0x1c')]?_0x5c5627[_0x3d0c('0x1c')]['include']?_[_0x3d0c('0x21')](_0x5c5627[_0x3d0c('0x1c')][_0x3d0c('0x22')],function(_0x471d79){return{'model':db[_0x471d79[_0x3d0c('0x23')]],'as':_0x471d79['as'],'attributes':_0x471d79['attributes'],'include':_0x471d79[_0x3d0c('0x22')]?_[_0x3d0c('0x21')](_0x471d79['include'],function(_0x73d3d9){return{'model':db[_0x73d3d9[_0x3d0c('0x23')]],'as':_0x73d3d9['as'],'attributes':_0x73d3d9['attributes'],'include':_0x73d3d9[_0x3d0c('0x22')]?_[_0x3d0c('0x21')](_0x73d3d9[_0x3d0c('0x22')],function(_0x54a5da){return{'model':db[_0x54a5da[_0x3d0c('0x23')]],'as':_0x54a5da['as'],'attributes':_0x54a5da[_0x3d0c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3d0c('0xf')](function(_0x14adca){logger[_0x3d0c('0x17')]('GetFaxQueue',_0x5c5627);logger[_0x3d0c('0x12')](_0x3d0c('0x19'),_0x5c5627,JSON[_0x3d0c('0x13')](_0x14adca));_0x324660(_0x14adca);})[_0x3d0c('0x18')](function(_0x558b36){logger[_0x3d0c('0x14')]('GetFaxQueue',_0x558b36[_0x3d0c('0x16')],_0x5c5627);_0x5ee854(_0x5c0425[_0x3d0c('0x14')](0x1f4,_0x558b36[_0x3d0c('0x16')]));});});};exports[_0x3d0c('0x24')]=function(_0x2e369e){var _0x1bee75=this;return new Promise(function(_0x39d71f,_0x235dba){return db[_0x3d0c('0x1a')]['find']({'raw':_0x2e369e[_0x3d0c('0x1c')]?_0x2e369e[_0x3d0c('0x1c')][_0x3d0c('0x1d')]===undefined?!![]:![]:!![],'where':_0x2e369e[_0x3d0c('0x1c')]?_0x2e369e[_0x3d0c('0x1c')][_0x3d0c('0x1e')]||null:null,'attributes':_0x2e369e[_0x3d0c('0x1c')]?_0x2e369e[_0x3d0c('0x1c')]['attributes']||null:null,'include':_0x2e369e[_0x3d0c('0x1c')]?_0x2e369e[_0x3d0c('0x1c')][_0x3d0c('0x22')]?_[_0x3d0c('0x21')](_0x2e369e[_0x3d0c('0x1c')][_0x3d0c('0x22')],function(_0x2d239e){return{'model':db[_0x2d239e['model']],'as':_0x2d239e['as'],'attributes':_0x2d239e[_0x3d0c('0x1f')],'include':_0x2d239e[_0x3d0c('0x22')]?_['map'](_0x2d239e[_0x3d0c('0x22')],function(_0x537332){return{'model':db[_0x537332[_0x3d0c('0x23')]],'as':_0x537332['as'],'attributes':_0x537332[_0x3d0c('0x1f')],'include':_0x537332[_0x3d0c('0x22')]?_[_0x3d0c('0x21')](_0x537332['include'],function(_0x22c23e){return{'model':db[_0x22c23e[_0x3d0c('0x23')]],'as':_0x22c23e['as'],'attributes':_0x22c23e[_0x3d0c('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e697d){logger[_0x3d0c('0x17')](_0x3d0c('0x24'),_0x2e369e);logger[_0x3d0c('0x12')](_0x3d0c('0x24'),_0x2e369e,JSON[_0x3d0c('0x13')](_0x3e697d));_0x39d71f(_0x3e697d);})[_0x3d0c('0x18')](function(_0x3fd790){logger[_0x3d0c('0x14')]('ShowFaxQueue',_0x3fd790[_0x3d0c('0x16')],_0x2e369e);_0x235dba(_0x1bee75[_0x3d0c('0x14')](0x1f4,_0x3fd790[_0x3d0c('0x16')]));});});}; \ No newline at end of file +var _0x7126=['http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','map','include','model','debug','catch','ShowFaxQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client'];(function(_0x5e2091,_0x1fc7bd){var _0x3960ed=function(_0x59ccdf){while(--_0x59ccdf){_0x5e2091['push'](_0x5e2091['shift']());}};_0x3960ed(++_0x1fc7bd);}(_0x7126,0x15f));var _0x6712=function(_0x61203b,_0x3f786f){_0x61203b=_0x61203b-0x0;var _0x131721=_0x7126[_0x61203b];return _0x131721;};'use strict';var _=require(_0x6712('0x0'));var util=require(_0x6712('0x1'));var moment=require(_0x6712('0x2'));var BPromise=require('bluebird');var rs=require(_0x6712('0x3'));var fs=require('fs');var Redis=require(_0x6712('0x4'));var db=require(_0x6712('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6712('0x6'));var config=require(_0x6712('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6712('0x8')][_0x6712('0x9')]({'port':0x232a});config[_0x6712('0xa')]=_[_0x6712('0xb')](config[_0x6712('0xa')],{'host':_0x6712('0xc'),'port':0x18eb});var socket=require(_0x6712('0xd'))(new Redis(config['redis']));require(_0x6712('0xe'))[_0x6712('0xf')](socket);function respondWithRpcPromise(_0x78c218,_0x5cb976,_0x2f6166){return new BPromise(function(_0x45a5a4,_0x4d9e59){return client[_0x6712('0x10')](_0x78c218,_0x2f6166)[_0x6712('0x11')](function(_0x266df0){logger[_0x6712('0x12')](_0x6712('0x13'),_0x5cb976,'request\x20sent');logger['debug'](_0x6712('0x14'),_0x5cb976,_0x6712('0x15'),JSON[_0x6712('0x16')](_0x266df0));if(_0x266df0[_0x6712('0x17')]){if(_0x266df0[_0x6712('0x17')][_0x6712('0x18')]===0x1f4){logger[_0x6712('0x17')](_0x6712('0x13'),_0x5cb976,_0x266df0[_0x6712('0x17')][_0x6712('0x19')]);return _0x4d9e59(_0x266df0['error'][_0x6712('0x19')]);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x5cb976,_0x266df0['error']['message']);return _0x45a5a4(_0x266df0[_0x6712('0x17')][_0x6712('0x19')]);}else{logger[_0x6712('0x12')](_0x6712('0x13'),_0x5cb976,_0x6712('0x15'));_0x45a5a4(_0x266df0['result']['message']);}})['catch'](function(_0x2b476e){logger['error'](_0x6712('0x13'),_0x5cb976,_0x2b476e);_0x4d9e59(_0x2b476e);});});}exports[_0x6712('0x1a')]=function(_0x328eee){var _0x48260f=this;return new Promise(function(_0x3b8318,_0x3d9ee8){return db[_0x6712('0x1b')][_0x6712('0x1c')]({'raw':_0x328eee[_0x6712('0x1d')]?_0x328eee[_0x6712('0x1d')][_0x6712('0x1e')]===undefined?!![]:![]:!![],'where':_0x328eee[_0x6712('0x1d')]?_0x328eee[_0x6712('0x1d')][_0x6712('0x1f')]||null:null,'attributes':_0x328eee[_0x6712('0x1d')]?_0x328eee['options'][_0x6712('0x20')]||null:null,'limit':_0x328eee[_0x6712('0x1d')]?_0x328eee['options'][_0x6712('0x21')]||null:null,'include':_0x328eee[_0x6712('0x1d')]?_0x328eee[_0x6712('0x1d')]['include']?_[_0x6712('0x22')](_0x328eee[_0x6712('0x1d')][_0x6712('0x23')],function(_0x3b2ec0){return{'model':db[_0x3b2ec0[_0x6712('0x24')]],'as':_0x3b2ec0['as'],'attributes':_0x3b2ec0[_0x6712('0x20')],'include':_0x3b2ec0[_0x6712('0x23')]?_[_0x6712('0x22')](_0x3b2ec0[_0x6712('0x23')],function(_0x2b1b33){return{'model':db[_0x2b1b33[_0x6712('0x24')]],'as':_0x2b1b33['as'],'attributes':_0x2b1b33[_0x6712('0x20')],'include':_0x2b1b33[_0x6712('0x23')]?_[_0x6712('0x22')](_0x2b1b33[_0x6712('0x23')],function(_0x1c0482){return{'model':db[_0x1c0482[_0x6712('0x24')]],'as':_0x1c0482['as'],'attributes':_0x1c0482[_0x6712('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6712('0x11')](function(_0x296386){logger[_0x6712('0x12')](_0x6712('0x1a'),_0x328eee);logger[_0x6712('0x25')]('GetFaxQueue',_0x328eee,JSON[_0x6712('0x16')](_0x296386));_0x3b8318(_0x296386);})[_0x6712('0x26')](function(_0x40f5db){logger[_0x6712('0x17')](_0x6712('0x1a'),_0x40f5db[_0x6712('0x19')],_0x328eee);_0x3d9ee8(_0x48260f['error'](0x1f4,_0x40f5db[_0x6712('0x19')]));});});};exports[_0x6712('0x27')]=function(_0x4bc9ff){var _0x32e174=this;return new Promise(function(_0xd318f7,_0x5dfe44){return db[_0x6712('0x1b')]['find']({'raw':_0x4bc9ff[_0x6712('0x1d')]?_0x4bc9ff['options'][_0x6712('0x1e')]===undefined?!![]:![]:!![],'where':_0x4bc9ff['options']?_0x4bc9ff[_0x6712('0x1d')][_0x6712('0x1f')]||null:null,'attributes':_0x4bc9ff[_0x6712('0x1d')]?_0x4bc9ff[_0x6712('0x1d')][_0x6712('0x20')]||null:null,'include':_0x4bc9ff[_0x6712('0x1d')]?_0x4bc9ff[_0x6712('0x1d')][_0x6712('0x23')]?_[_0x6712('0x22')](_0x4bc9ff[_0x6712('0x1d')][_0x6712('0x23')],function(_0x4a3cf3){return{'model':db[_0x4a3cf3[_0x6712('0x24')]],'as':_0x4a3cf3['as'],'attributes':_0x4a3cf3[_0x6712('0x20')],'include':_0x4a3cf3['include']?_[_0x6712('0x22')](_0x4a3cf3[_0x6712('0x23')],function(_0x1692b4){return{'model':db[_0x1692b4[_0x6712('0x24')]],'as':_0x1692b4['as'],'attributes':_0x1692b4[_0x6712('0x20')],'include':_0x1692b4[_0x6712('0x23')]?_[_0x6712('0x22')](_0x1692b4[_0x6712('0x23')],function(_0x29f8a4){return{'model':db[_0x29f8a4[_0x6712('0x24')]],'as':_0x29f8a4['as'],'attributes':_0x29f8a4[_0x6712('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6712('0x11')](function(_0x56325e){logger[_0x6712('0x12')]('ShowFaxQueue',_0x4bc9ff);logger[_0x6712('0x25')](_0x6712('0x27'),_0x4bc9ff,JSON[_0x6712('0x16')](_0x56325e));_0xd318f7(_0x56325e);})[_0x6712('0x26')](function(_0x102fc4){logger[_0x6712('0x17')](_0x6712('0x27'),_0x102fc4[_0x6712('0x19')],_0x4bc9ff);_0x5dfe44(_0x32e174[_0x6712('0x17')](0x1f4,_0x102fc4[_0x6712('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 3731c71..06b6467 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 _0x4c34=['save','remove','update','emit','removeListener','register','length','faxQueue:','./faxQueue.events'];(function(_0x19c4cd,_0x23e490){var _0xea579c=function(_0x59246d){while(--_0x59246d){_0x19c4cd['push'](_0x19c4cd['shift']());}};_0xea579c(++_0x23e490);}(_0x4c34,0x131));var _0x44c3=function(_0x13796a,_0x2f1062){_0x13796a=_0x13796a-0x0;var _0x2c760d=_0x4c34[_0x13796a];return _0x2c760d;};'use strict';var FaxQueueEvents=require(_0x44c3('0x0'));var events=[_0x44c3('0x1'),_0x44c3('0x2'),_0x44c3('0x3')];function createListener(_0x3f170b,_0x264631){return function(_0x2cf11a){_0x264631[_0x44c3('0x4')](_0x3f170b,_0x2cf11a);};}function removeListener(_0x30d464,_0x134b93){return function(){FaxQueueEvents[_0x44c3('0x5')](_0x30d464,_0x134b93);};}exports[_0x44c3('0x6')]=function(_0x2ba488){for(var _0x56be46=0x0,_0x561423=events[_0x44c3('0x7')];_0x56be46<_0x561423;_0x56be46++){var _0x22a74a=events[_0x56be46];var _0x4eda1a=createListener(_0x44c3('0x8')+_0x22a74a,_0x2ba488);FaxQueueEvents['on'](_0x22a74a,_0x4eda1a);}}; \ No newline at end of file +var _0x6b67=['emit','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b67,0x160));var _0x76b6=function(_0x4e6eb2,_0x16a451){_0x4e6eb2=_0x4e6eb2-0x0;var _0x4e0c1c=_0x6b67[_0x4e6eb2];return _0x4e0c1c;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save','remove','update'];function createListener(_0x42522f,_0x9f523c){return function(_0x56c17b){_0x9f523c[_0x76b6('0x0')](_0x42522f,_0x56c17b);};}function removeListener(_0xa057e,_0x5aab2c){return function(){FaxQueueEvents['removeListener'](_0xa057e,_0x5aab2c);};}exports['register']=function(_0x448fa5){for(var _0x49510a=0x0,_0x458516=events[_0x76b6('0x1')];_0x49510a<_0x458516;_0x49510a++){var _0x1c88da=events[_0x49510a];var _0x18d3db=createListener('faxQueue:'+_0x1c88da,_0x448fa5);FaxQueueEvents['on'](_0x1c88da,_0x18d3db);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index a18ef66..52275ee 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 _0xd8b0=['util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','index','get','/describe','describe','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','/:id','update','delete','destroy','removeTeams','exports','multer'];(function(_0x2f641e,_0x208ac4){var _0x54dfa8=function(_0x268998){while(--_0x268998){_0x2f641e['push'](_0x2f641e['shift']());}};_0x54dfa8(++_0x208ac4);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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',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['get'](_0x0d8b('0x11'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')]('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x13')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);router[_0x0d8b('0x13')](_0x0d8b('0x11'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x16')]);router['put'](_0x0d8b('0x17'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x18')]);router[_0x0d8b('0x19')](_0x0d8b('0x17'),auth['isAuthenticated'](),controller[_0x0d8b('0x1a')]);router[_0x0d8b('0x19')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x1b')]);router[_0x0d8b('0x19')](_0x0d8b('0x11'),auth[_0x0d8b('0xb')](),controller['removeAgents']);module[_0x0d8b('0x1c')]=router; \ No newline at end of file +var _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0xb10b,0x12a));var _0xbb10=function(_0x57fa0b,_0x5df1ce){_0x57fa0b=_0x57fa0b-0x0;var _0x18669f=_0xb10b[_0x57fa0b];return _0x18669f;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 571fbbe..6bc1994 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 _0x8643=['moment','sequelize','STRING','DATE'];(function(_0x405926,_0x397b60){var _0x3374c0=function(_0x4cde95){while(--_0x4cde95){_0x405926['push'](_0x405926['shift']());}};_0x3374c0(++_0x397b60);}(_0x8643,0x100));var _0x3864=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x8643[_0x9cd4c3];return _0x4c9025;};'use strict';var moment=require(_0x3864('0x0'));var Sequelize=require(_0x3864('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x3864('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3864('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x3864('0x3')]},'exitAt':{'type':Sequelize[_0x3864('0x3')]},'reason':{'type':Sequelize[_0x3864('0x2')]}}; \ No newline at end of file +var _0xf65d=['STRING','DATE','sequelize','exports'];(function(_0x596f6e,_0x3f8857){var _0x1e0803=function(_0x31f91f){while(--_0x31f91f){_0x596f6e['push'](_0x596f6e['shift']());}};_0x1e0803(++_0x3f8857);}(_0xf65d,0x11a));var _0xdf65=function(_0x2f3ecd,_0x57976b){_0x2f3ecd=_0x2f3ecd-0x0;var _0xffdc44=_0xf65d[_0x2f3ecd];return _0xffdc44;};'use strict';var moment=require('moment');var Sequelize=require(_0xdf65('0x0'));module[_0xdf65('0x1')]={'uniqueid':{'type':Sequelize[_0xdf65('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdf65('0x2')]},'joinAt':{'type':Sequelize[_0xdf65('0x3')]},'leaveAt':{'type':Sequelize[_0xdf65('0x3')]},'acceptAt':{'type':Sequelize[_0xdf65('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xdf65('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 48e728e..cb423c6 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 _0xb36a=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','nolimit','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body'];(function(_0x570893,_0x5888e7){var _0x3cd5aa=function(_0x363185){while(--_0x363185){_0x570893['push'](_0x570893['shift']());}};_0x3cd5aa(++_0x5888e7);}(_0xb36a,0x15f));var _0xab36=function(_0x3f9176,_0x919353){_0x3f9176=_0x3f9176-0x0;var _0x59872e=_0xb36a[_0x3f9176];return _0x59872e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xab36('0x0'));var rimraf=require(_0xab36('0x1'));var zipdir=require(_0xab36('0x2'));var jsonpatch=require(_0xab36('0x3'));var rp=require(_0xab36('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xab36('0x5'));var path=require('path');var sox=require(_0xab36('0x6'));var csv=require(_0xab36('0x7'));var ejs=require(_0xab36('0x8'));var fs=require('fs');var _=require(_0xab36('0x9'));var squel=require(_0xab36('0xa'));var crypto=require(_0xab36('0xb'));var jsforce=require(_0xab36('0xc'));var deskjs=require(_0xab36('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xab36('0xe'));var authService=require(_0xab36('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab36('0x10'));var logger=require(_0xab36('0x11'))(_0xab36('0x12'));var utils=require('../../config/utils');var config=require(_0xab36('0x13'));var db=require(_0xab36('0x14'))['db'];function respondWithStatusCode(_0xc93972,_0x362657){_0x362657=_0x362657||0xcc;return function(_0x49935b){if(_0x49935b){return _0xc93972[_0xab36('0x15')](_0x362657);}return _0xc93972[_0xab36('0x16')](_0x362657)[_0xab36('0x17')]();};}function respondWithResult(_0x2568ef,_0x2e74a1){_0x2e74a1=_0x2e74a1||0xc8;return function(_0x15de82){if(_0x15de82){return _0x2568ef[_0xab36('0x16')](_0x2e74a1)['json'](_0x15de82);}};}function respondWithFilteredResult(_0x2a0f71,_0x1e0150){return function(_0x5eb356){if(_0x5eb356){var _0x25f38e=_0x5eb356[_0xab36('0x18')],_0x417666=_0x1e0150[_0xab36('0x19')],_0x328035=_0x1e0150[_0xab36('0x19')]+_0x1e0150[_0xab36('0x1a')],_0x42eda1;if(_0x328035>=_0x25f38e){_0x328035=_0x25f38e;_0x42eda1=0xc8;}else{_0x42eda1=0xce;}_0x2a0f71[_0xab36('0x16')](_0x42eda1);return _0x2a0f71[_0xab36('0x1b')](_0xab36('0x1c'),_0x417666+'-'+_0x328035+'/'+_0x25f38e)['json'](_0x5eb356);}return null;};}function patchUpdates(_0x5ac2f4){return function(_0x550654){try{jsonpatch[_0xab36('0x1d')](_0x550654,_0x5ac2f4,!![]);}catch(_0x3434c2){return BPromise[_0xab36('0x1e')](_0x3434c2);}return _0x550654[_0xab36('0x1f')]();};}function saveUpdates(_0x34d7cf,_0x1d04ee){return function(_0x297490){if(_0x297490){return _0x297490[_0xab36('0x20')](_0x34d7cf)[_0xab36('0x21')](function(_0x838358){return _0x838358;});}return null;};}function removeEntity(_0x449fa5,_0x11277d){return function(_0x880b1d){if(_0x880b1d){return _0x880b1d[_0xab36('0x22')]()[_0xab36('0x21')](function(){_0x449fa5[_0xab36('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25138d,_0x2d3e12){return function(_0x286769){if(!_0x286769){_0x25138d['sendStatus'](0x194);}return _0x286769;};}function handleError(_0x48e817,_0x165a43){_0x165a43=_0x165a43||0x1f4;return function(_0x2cc469){logger[_0xab36('0x23')](_0x2cc469[_0xab36('0x24')]);if(_0x2cc469[_0xab36('0x25')]){delete _0x2cc469[_0xab36('0x25')];}_0x48e817[_0xab36('0x16')](_0x165a43)['send'](_0x2cc469);};}exports[_0xab36('0x26')]=function(_0x2a1d77,_0x121513){var _0xf08f3={},_0x5915bc={},_0x496c3d={'count':0x0,'rows':[]};var _0xbf0ea3=_[_0xab36('0x27')](db[_0xab36('0x28')][_0xab36('0x29')],function(_0xaeddf4){return{'name':_0xaeddf4[_0xab36('0x2a')],'type':_0xaeddf4['type'][_0xab36('0x2b')]};});_0x5915bc[_0xab36('0x2c')]=_[_0xab36('0x27')](_0xbf0ea3,'name');_0x5915bc[_0xab36('0x2d')]=_[_0xab36('0x2e')](_0x2a1d77[_0xab36('0x2d')]);_0x5915bc['filters']=_[_0xab36('0x2f')](_0x5915bc[_0xab36('0x2c')],_0x5915bc[_0xab36('0x2d')]);_0xf08f3['attributes']=_['intersection'](_0x5915bc[_0xab36('0x2c')],qs[_0xab36('0x30')](_0x2a1d77[_0xab36('0x2d')][_0xab36('0x30')]));_0xf08f3['attributes']=_0xf08f3[_0xab36('0x31')][_0xab36('0x32')]?_0xf08f3[_0xab36('0x31')]:_0x5915bc[_0xab36('0x2c')];if(!_0x2a1d77[_0xab36('0x2d')]['hasOwnProperty'](_0xab36('0x33'))){_0xf08f3['limit']=qs[_0xab36('0x1a')](_0x2a1d77[_0xab36('0x2d')]['limit']);_0xf08f3[_0xab36('0x19')]=qs[_0xab36('0x19')](_0x2a1d77[_0xab36('0x2d')][_0xab36('0x19')]);}_0xf08f3['order']=qs['sort'](_0x2a1d77[_0xab36('0x2d')]['sort']);_0xf08f3[_0xab36('0x34')]=qs[_0xab36('0x35')](_[_0xab36('0x36')](_0x2a1d77[_0xab36('0x2d')],_0x5915bc[_0xab36('0x35')]));if(_0x2a1d77[_0xab36('0x2d')][_0xab36('0x37')]){_0xf08f3[_0xab36('0x34')]=_[_0xab36('0x38')](_0xf08f3['where'],{'$or':_[_0xab36('0x27')](_0xbf0ea3,function(_0x2fd765){if(_0x2fd765[_0xab36('0x39')]!==_0xab36('0x3a')){var _0x141713={};_0x141713[_0x2fd765['name']]={'$like':'%'+_0x2a1d77['query'][_0xab36('0x37')]+'%'};return _0x141713;}})});}_0xf08f3=_[_0xab36('0x38')]({},_0xf08f3,_0x2a1d77[_0xab36('0x3b')]);var _0x3000e1={'where':_0xf08f3[_0xab36('0x34')]};return db[_0xab36('0x28')][_0xab36('0x18')](_0x3000e1)[_0xab36('0x21')](function(_0x483e8){_0x496c3d[_0xab36('0x18')]=_0x483e8;if(_0x2a1d77[_0xab36('0x2d')][_0xab36('0x3c')]){_0xf08f3['include']=[{'all':!![]}];}return db['FaxQueueReport'][_0xab36('0x3d')](_0xf08f3);})[_0xab36('0x21')](function(_0x3cc1a0){_0x496c3d[_0xab36('0x3e')]=_0x3cc1a0;return _0x496c3d;})[_0xab36('0x21')](respondWithFilteredResult(_0x121513,_0xf08f3))[_0xab36('0x3f')](handleError(_0x121513,null));};exports[_0xab36('0x40')]=function(_0x279a05,_0x3608ff){var _0x445dda={'raw':!![],'where':{'id':_0x279a05[_0xab36('0x41')]['id']}},_0x121a89={};_0x121a89['model']=_[_0xab36('0x2e')](db['FaxQueueReport'][_0xab36('0x29')]);_0x121a89[_0xab36('0x2d')]=_[_0xab36('0x2e')](_0x279a05[_0xab36('0x2d')]);_0x121a89[_0xab36('0x35')]=_[_0xab36('0x2f')](_0x121a89['model'],_0x121a89[_0xab36('0x2d')]);_0x445dda[_0xab36('0x31')]=_[_0xab36('0x2f')](_0x121a89[_0xab36('0x2c')],qs[_0xab36('0x30')](_0x279a05[_0xab36('0x2d')][_0xab36('0x30')]));_0x445dda[_0xab36('0x31')]=_0x445dda[_0xab36('0x31')][_0xab36('0x32')]?_0x445dda[_0xab36('0x31')]:_0x121a89[_0xab36('0x2c')];if(_0x279a05[_0xab36('0x2d')]['includeAll']){_0x445dda['include']=[{'all':!![]}];}_0x445dda=_[_0xab36('0x38')]({},_0x445dda,_0x279a05['options']);return db[_0xab36('0x28')][_0xab36('0x42')](_0x445dda)[_0xab36('0x21')](handleEntityNotFound(_0x3608ff,null))[_0xab36('0x21')](respondWithResult(_0x3608ff,null))['catch'](handleError(_0x3608ff,null));};exports[_0xab36('0x43')]=function(_0x5401a7,_0x1c5b2a){return db[_0xab36('0x28')][_0xab36('0x43')](_0x5401a7[_0xab36('0x44')],{})[_0xab36('0x21')](respondWithResult(_0x1c5b2a,0xc9))[_0xab36('0x3f')](handleError(_0x1c5b2a,null));};exports[_0xab36('0x20')]=function(_0x4e76d7,_0xfe906e){if(_0x4e76d7[_0xab36('0x44')]['id']){delete _0x4e76d7[_0xab36('0x44')]['id'];}return db['FaxQueueReport'][_0xab36('0x42')]({'where':{'id':_0x4e76d7[_0xab36('0x41')]['id']}})['then'](handleEntityNotFound(_0xfe906e,null))[_0xab36('0x21')](saveUpdates(_0x4e76d7[_0xab36('0x44')],null))[_0xab36('0x21')](respondWithResult(_0xfe906e,null))[_0xab36('0x3f')](handleError(_0xfe906e,null));};exports[_0xab36('0x22')]=function(_0x4edb1e,_0x56b5d7){return db[_0xab36('0x28')][_0xab36('0x42')]({'where':{'id':_0x4edb1e[_0xab36('0x41')]['id']}})[_0xab36('0x21')](handleEntityNotFound(_0x56b5d7,null))['then'](removeEntity(_0x56b5d7,null))[_0xab36('0x3f')](handleError(_0x56b5d7,null));};exports[_0xab36('0x45')]=function(_0x5ae580,_0x363afe){return db[_0xab36('0x28')][_0xab36('0x45')]()['then'](respondWithResult(_0x363afe,null))[_0xab36('0x3f')](handleError(_0x363afe,null));}; \ No newline at end of file +var _0x9a89=['includeAll','include','findAll','rows','catch','show','params','find','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','update','then','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','count'];(function(_0x53c33c,_0x27223d){var _0x277750=function(_0x3446fb){while(--_0x3446fb){_0x53c33c['push'](_0x53c33c['shift']());}};_0x277750(++_0x27223d);}(_0x9a89,0x9a));var _0x99a8=function(_0x5f3e26,_0x56d045){_0x5f3e26=_0x5f3e26-0x0;var _0x288e2d=_0x9a89[_0x5f3e26];return _0x288e2d;};'use strict';var pdf=require(_0x99a8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x99a8('0x1'));var zipdir=require(_0x99a8('0x2'));var jsonpatch=require(_0x99a8('0x3'));var rp=require(_0x99a8('0x4'));var moment=require('moment');var BPromise=require(_0x99a8('0x5'));var Mustache=require(_0x99a8('0x6'));var util=require(_0x99a8('0x7'));var path=require(_0x99a8('0x8'));var sox=require(_0x99a8('0x9'));var csv=require(_0x99a8('0xa'));var ejs=require(_0x99a8('0xb'));var fs=require('fs');var _=require(_0x99a8('0xc'));var squel=require('squel');var crypto=require(_0x99a8('0xd'));var jsforce=require(_0x99a8('0xe'));var deskjs=require(_0x99a8('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x99a8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x99a8('0x12'));var logger=require(_0x99a8('0x13'))(_0x99a8('0x14'));var utils=require(_0x99a8('0x15'));var config=require(_0x99a8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcccb70,_0x8ca218){_0x8ca218=_0x8ca218||0xcc;return function(_0x5e4a9d){if(_0x5e4a9d){return _0xcccb70[_0x99a8('0x17')](_0x8ca218);}return _0xcccb70['status'](_0x8ca218)[_0x99a8('0x18')]();};}function respondWithResult(_0x1e6ea2,_0x5d7460){_0x5d7460=_0x5d7460||0xc8;return function(_0x1cf052){if(_0x1cf052){return _0x1e6ea2[_0x99a8('0x19')](_0x5d7460)[_0x99a8('0x1a')](_0x1cf052);}};}function respondWithFilteredResult(_0x25d7ef,_0x5620bc){return function(_0x30b3a2){if(_0x30b3a2){var _0x3c1b3d=_0x30b3a2['count'],_0x186b34=_0x5620bc['offset'],_0x10ef4e=_0x5620bc[_0x99a8('0x1b')]+_0x5620bc[_0x99a8('0x1c')],_0x5ca312;if(_0x10ef4e>=_0x3c1b3d){_0x10ef4e=_0x3c1b3d;_0x5ca312=0xc8;}else{_0x5ca312=0xce;}_0x25d7ef[_0x99a8('0x19')](_0x5ca312);return _0x25d7ef[_0x99a8('0x1d')](_0x99a8('0x1e'),_0x186b34+'-'+_0x10ef4e+'/'+_0x3c1b3d)[_0x99a8('0x1a')](_0x30b3a2);}return null;};}function patchUpdates(_0x2547a3){return function(_0x23f652){try{jsonpatch[_0x99a8('0x1f')](_0x23f652,_0x2547a3,!![]);}catch(_0x522351){return BPromise[_0x99a8('0x20')](_0x522351);}return _0x23f652['save']();};}function saveUpdates(_0x362e9b,_0x92daee){return function(_0x341298){if(_0x341298){return _0x341298[_0x99a8('0x21')](_0x362e9b)[_0x99a8('0x22')](function(_0x4e2527){return _0x4e2527;});}return null;};}function removeEntity(_0xd91a24,_0x3e8215){return function(_0x33ddd8){if(_0x33ddd8){return _0x33ddd8['destroy']()[_0x99a8('0x22')](function(){_0xd91a24[_0x99a8('0x19')](0xcc)[_0x99a8('0x18')]();});}};}function handleEntityNotFound(_0x84143b,_0x4b5639){return function(_0x319ead){if(!_0x319ead){_0x84143b['sendStatus'](0x194);}return _0x319ead;};}function handleError(_0x3b0a41,_0x3819e7){_0x3819e7=_0x3819e7||0x1f4;return function(_0x4d1c5d){logger['error'](_0x4d1c5d[_0x99a8('0x23')]);if(_0x4d1c5d[_0x99a8('0x24')]){delete _0x4d1c5d[_0x99a8('0x24')];}_0x3b0a41[_0x99a8('0x19')](_0x3819e7)[_0x99a8('0x25')](_0x4d1c5d);};}exports[_0x99a8('0x26')]=function(_0xddd364,_0x5090d4){var _0x44f82f={},_0x49bd8b={},_0x9757ea={'count':0x0,'rows':[]};var _0x320585=_[_0x99a8('0x27')](db[_0x99a8('0x28')][_0x99a8('0x29')],function(_0x7a17d3){return{'name':_0x7a17d3[_0x99a8('0x2a')],'type':_0x7a17d3[_0x99a8('0x2b')]['key']};});_0x49bd8b[_0x99a8('0x2c')]=_[_0x99a8('0x27')](_0x320585,_0x99a8('0x24'));_0x49bd8b['query']=_[_0x99a8('0x2d')](_0xddd364[_0x99a8('0x2e')]);_0x49bd8b['filters']=_[_0x99a8('0x2f')](_0x49bd8b[_0x99a8('0x2c')],_0x49bd8b['query']);_0x44f82f[_0x99a8('0x30')]=_[_0x99a8('0x2f')](_0x49bd8b['model'],qs[_0x99a8('0x31')](_0xddd364[_0x99a8('0x2e')][_0x99a8('0x31')]));_0x44f82f[_0x99a8('0x30')]=_0x44f82f[_0x99a8('0x30')][_0x99a8('0x32')]?_0x44f82f[_0x99a8('0x30')]:_0x49bd8b['model'];if(!_0xddd364[_0x99a8('0x2e')][_0x99a8('0x33')](_0x99a8('0x34'))){_0x44f82f[_0x99a8('0x1c')]=qs[_0x99a8('0x1c')](_0xddd364[_0x99a8('0x2e')]['limit']);_0x44f82f[_0x99a8('0x1b')]=qs['offset'](_0xddd364[_0x99a8('0x2e')]['offset']);}_0x44f82f[_0x99a8('0x35')]=qs[_0x99a8('0x36')](_0xddd364[_0x99a8('0x2e')]['sort']);_0x44f82f[_0x99a8('0x37')]=qs[_0x99a8('0x38')](_['pick'](_0xddd364[_0x99a8('0x2e')],_0x49bd8b[_0x99a8('0x38')]));if(_0xddd364[_0x99a8('0x2e')][_0x99a8('0x39')]){_0x44f82f['where']=_['merge'](_0x44f82f[_0x99a8('0x37')],{'$or':_[_0x99a8('0x27')](_0x320585,function(_0x2b50dd){if(_0x2b50dd[_0x99a8('0x2b')]!==_0x99a8('0x3a')){var _0x1e597a={};_0x1e597a[_0x2b50dd[_0x99a8('0x24')]]={'$like':'%'+_0xddd364[_0x99a8('0x2e')][_0x99a8('0x39')]+'%'};return _0x1e597a;}})});}_0x44f82f=_[_0x99a8('0x3b')]({},_0x44f82f,_0xddd364[_0x99a8('0x3c')]);var _0x3f4da3={'where':_0x44f82f['where']};return db[_0x99a8('0x28')][_0x99a8('0x3d')](_0x3f4da3)['then'](function(_0x369899){_0x9757ea[_0x99a8('0x3d')]=_0x369899;if(_0xddd364[_0x99a8('0x2e')][_0x99a8('0x3e')]){_0x44f82f[_0x99a8('0x3f')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x99a8('0x40')](_0x44f82f);})[_0x99a8('0x22')](function(_0x4f138e){_0x9757ea[_0x99a8('0x41')]=_0x4f138e;return _0x9757ea;})[_0x99a8('0x22')](respondWithFilteredResult(_0x5090d4,_0x44f82f))[_0x99a8('0x42')](handleError(_0x5090d4,null));};exports[_0x99a8('0x43')]=function(_0x259666,_0xbacf10){var _0x38f872={'raw':!![],'where':{'id':_0x259666[_0x99a8('0x44')]['id']}},_0x6974f9={};_0x6974f9['model']=_[_0x99a8('0x2d')](db[_0x99a8('0x28')]['rawAttributes']);_0x6974f9['query']=_[_0x99a8('0x2d')](_0x259666[_0x99a8('0x2e')]);_0x6974f9[_0x99a8('0x38')]=_['intersection'](_0x6974f9['model'],_0x6974f9[_0x99a8('0x2e')]);_0x38f872['attributes']=_[_0x99a8('0x2f')](_0x6974f9[_0x99a8('0x2c')],qs[_0x99a8('0x31')](_0x259666[_0x99a8('0x2e')][_0x99a8('0x31')]));_0x38f872['attributes']=_0x38f872[_0x99a8('0x30')]['length']?_0x38f872[_0x99a8('0x30')]:_0x6974f9[_0x99a8('0x2c')];if(_0x259666['query'][_0x99a8('0x3e')]){_0x38f872[_0x99a8('0x3f')]=[{'all':!![]}];}_0x38f872=_['merge']({},_0x38f872,_0x259666[_0x99a8('0x3c')]);return db[_0x99a8('0x28')][_0x99a8('0x45')](_0x38f872)[_0x99a8('0x22')](handleEntityNotFound(_0xbacf10,null))[_0x99a8('0x22')](respondWithResult(_0xbacf10,null))['catch'](handleError(_0xbacf10,null));};exports['create']=function(_0x42289c,_0x289eb0){return db[_0x99a8('0x28')]['create'](_0x42289c['body'],{})[_0x99a8('0x22')](respondWithResult(_0x289eb0,0xc9))[_0x99a8('0x42')](handleError(_0x289eb0,null));};exports['update']=function(_0x19d3f6,_0x17889){if(_0x19d3f6['body']['id']){delete _0x19d3f6[_0x99a8('0x46')]['id'];}return db['FaxQueueReport'][_0x99a8('0x45')]({'where':{'id':_0x19d3f6[_0x99a8('0x44')]['id']}})['then'](handleEntityNotFound(_0x17889,null))[_0x99a8('0x22')](saveUpdates(_0x19d3f6['body'],null))[_0x99a8('0x22')](respondWithResult(_0x17889,null))[_0x99a8('0x42')](handleError(_0x17889,null));};exports['destroy']=function(_0x130d68,_0x136443){return db[_0x99a8('0x28')][_0x99a8('0x45')]({'where':{'id':_0x130d68['params']['id']}})[_0x99a8('0x22')](handleEntityNotFound(_0x136443,null))[_0x99a8('0x22')](removeEntity(_0x136443,null))['catch'](handleError(_0x136443,null));};exports[_0x99a8('0x47')]=function(_0xbf76ac,_0x1a5731){return db[_0x99a8('0x28')][_0x99a8('0x47')]()[_0x99a8('0x22')](respondWithResult(_0x1a5731,null))[_0x99a8('0x42')](handleError(_0x1a5731,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index d1cbfc8..e3676e2 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 _0x60a8=['bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x1614c2,_0x1fccfc){var _0x182c4c=function(_0x19c361){while(--_0x19c361){_0x1614c2['push'](_0x1614c2['shift']());}};_0x182c4c(++_0x1fccfc);}(_0x60a8,0x1d8));var _0x860a=function(_0x56b180,_0xe82760){_0x56b180=_0x56b180-0x0;var _0x3b9b68=_0x60a8[_0x56b180];return _0x3b9b68;};'use strict';var _=require(_0x860a('0x0'));var util=require(_0x860a('0x1'));var logger=require(_0x860a('0x2'))('api');var moment=require(_0x860a('0x3'));var BPromise=require(_0x860a('0x4'));var rp=require(_0x860a('0x5'));var fs=require('fs');var path=require(_0x860a('0x6'));var rimraf=require(_0x860a('0x7'));var config=require(_0x860a('0x8'));var attributes=require(_0x860a('0x9'));module['exports']=function(_0x53d0e1,_0x42116b){return _0x53d0e1[_0x860a('0xa')](_0x860a('0xb'),attributes,{'tableName':_0x860a('0xc'),'paranoid':![],'indexes':[{'name':_0x860a('0xd'),'fields':[_0x860a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbf77=['exports','FaxQueueReport','report_fax_queue','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x419bd9,_0x3f6dea){var _0x6c6f1f=function(_0x55f3ab){while(--_0x55f3ab){_0x419bd9['push'](_0x419bd9['shift']());}};_0x6c6f1f(++_0x3f6dea);}(_0xbf77,0xfd));var _0x7bf7=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xbf77[_0x273c39];return _0x46d6b5;};'use strict';var _=require('lodash');var util=require(_0x7bf7('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7bf7('0x1'));var BPromise=require(_0x7bf7('0x2'));var rp=require(_0x7bf7('0x3'));var fs=require('fs');var path=require(_0x7bf7('0x4'));var rimraf=require(_0x7bf7('0x5'));var config=require(_0x7bf7('0x6'));var attributes=require('./faxQueueReport.attributes');module[_0x7bf7('0x7')]=function(_0x2c72e2,_0x3c3034){return _0x2c72e2['define'](_0x7bf7('0x8'),attributes,{'tableName':_0x7bf7('0x9'),'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 e64e315..92a98a0 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 _0x8c69=['info','UpdateFaxQueueReport','update','options','raw','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x8c69,0x189));var _0x98c6=function(_0x26737a,_0x277108){_0x26737a=_0x26737a-0x0;var _0xdc53a9=_0x8c69[_0x26737a];return _0xdc53a9;};'use strict';var _=require(_0x98c6('0x0'));var util=require('util');var moment=require(_0x98c6('0x1'));var BPromise=require(_0x98c6('0x2'));var rs=require(_0x98c6('0x3'));var fs=require('fs');var Redis=require(_0x98c6('0x4'));var db=require(_0x98c6('0x5'))['db'];var utils=require(_0x98c6('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x98c6('0x7'));var jayson=require(_0x98c6('0x8'));var client=jayson[_0x98c6('0x9')][_0x98c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a84b6,_0x303bc0,_0x2ea1e6){return new BPromise(function(_0x59970f,_0x3d7674){return client[_0x98c6('0xb')](_0x5a84b6,_0x2ea1e6)[_0x98c6('0xc')](function(_0x32b350){logger['info'](_0x98c6('0xd'),_0x303bc0,_0x98c6('0xe'));logger[_0x98c6('0xf')](_0x98c6('0x10'),_0x303bc0,_0x98c6('0xe'),JSON[_0x98c6('0x11')](_0x32b350));if(_0x32b350['error']){if(_0x32b350[_0x98c6('0x12')][_0x98c6('0x13')]===0x1f4){logger['error'](_0x98c6('0xd'),_0x303bc0,_0x32b350[_0x98c6('0x12')][_0x98c6('0x14')]);return _0x3d7674(_0x32b350['error']['message']);}logger[_0x98c6('0x12')](_0x98c6('0xd'),_0x303bc0,_0x32b350['error']['message']);return _0x59970f(_0x32b350[_0x98c6('0x12')]['message']);}else{logger['info'](_0x98c6('0xd'),_0x303bc0,'request\x20sent');_0x59970f(_0x32b350[_0x98c6('0x15')]['message']);}})[_0x98c6('0x16')](function(_0x3408c5){logger[_0x98c6('0x12')](_0x98c6('0xd'),_0x303bc0,_0x3408c5);_0x3d7674(_0x3408c5);});});}exports[_0x98c6('0x17')]=function(_0x2f3958){var _0x112478=this;return new Promise(function(_0x3e13d9,_0x2d4f91){return db[_0x98c6('0x18')][_0x98c6('0x19')](_0x2f3958[_0x98c6('0x1a')],{'raw':_0x2f3958['options']?_0x2f3958['options']['raw']===undefined?!![]:![]:!![]})[_0x98c6('0xc')](function(_0x3772df){logger[_0x98c6('0x1b')](_0x98c6('0x17'),_0x2f3958);logger[_0x98c6('0xf')](_0x98c6('0x17'),_0x2f3958,JSON[_0x98c6('0x11')](_0x3772df));_0x3e13d9(_0x3772df);})[_0x98c6('0x16')](function(_0x36de99){logger[_0x98c6('0x12')](_0x98c6('0x17'),_0x36de99['message'],_0x2f3958);_0x2d4f91(_0x112478[_0x98c6('0x12')](0x1f4,_0x36de99[_0x98c6('0x14')]));});});};exports[_0x98c6('0x1c')]=function(_0xb90d75){var _0xd39f82=this;return new Promise(function(_0x409144,_0xf46a7e){return db[_0x98c6('0x18')][_0x98c6('0x1d')](_0xb90d75[_0x98c6('0x1a')],{'raw':_0xb90d75['options']?_0xb90d75[_0x98c6('0x1e')][_0x98c6('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb90d75[_0x98c6('0x1e')]?_0xb90d75[_0x98c6('0x1e')][_0x98c6('0x20')]||null:null,'attributes':_0xb90d75[_0x98c6('0x1e')]?_0xb90d75[_0x98c6('0x1e')][_0x98c6('0x21')]||null:null,'limit':_0xb90d75[_0x98c6('0x1e')]?_0xb90d75[_0x98c6('0x1e')][_0x98c6('0x22')]||null:null})[_0x98c6('0xc')](function(_0x43d483){logger['info'](_0x98c6('0x1c'),_0xb90d75);logger['debug'](_0x98c6('0x1c'),_0xb90d75,JSON[_0x98c6('0x11')](_0x43d483));_0x409144(_0x43d483);})[_0x98c6('0x16')](function(_0x56a245){logger[_0x98c6('0x12')](_0x98c6('0x1c'),_0x56a245[_0x98c6('0x14')],_0xb90d75);_0xf46a7e(_0xd39f82['error'](0x1f4,_0x56a245['message']));});});}; \ No newline at end of file +var _0x33d3=['create','body','options','raw','CreateFaxQueueReport','debug','UpdateFaxQueueReport','update','where','limit','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','FaxQueueReport,\x20%s,\x20%s','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','FaxQueueReport'];(function(_0x256a0a,_0x1cb1b4){var _0xfb938=function(_0x3d35c0){while(--_0x3d35c0){_0x256a0a['push'](_0x256a0a['shift']());}};_0xfb938(++_0x1cb1b4);}(_0x33d3,0x6e));var _0x333d=function(_0x3d1996,_0x1f08f0){_0x3d1996=_0x3d1996-0x0;var _0x550afd=_0x33d3[_0x3d1996];return _0x550afd;};'use strict';var _=require(_0x333d('0x0'));var util=require(_0x333d('0x1'));var moment=require(_0x333d('0x2'));var BPromise=require(_0x333d('0x3'));var rs=require(_0x333d('0x4'));var fs=require('fs');var Redis=require(_0x333d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x333d('0x6'));var logger=require(_0x333d('0x7'))(_0x333d('0x8'));var config=require(_0x333d('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c2613,_0x4d04aa,_0x322b99){return new BPromise(function(_0x23645e,_0x13073c){return client[_0x333d('0xa')](_0x4c2613,_0x322b99)[_0x333d('0xb')](function(_0x24075a){logger[_0x333d('0xc')](_0x333d('0xd'),_0x4d04aa,'request\x20sent');logger['debug'](_0x333d('0xe'),_0x4d04aa,_0x333d('0xf'),JSON[_0x333d('0x10')](_0x24075a));if(_0x24075a[_0x333d('0x11')]){if(_0x24075a[_0x333d('0x11')][_0x333d('0x12')]===0x1f4){logger['error'](_0x333d('0xd'),_0x4d04aa,_0x24075a[_0x333d('0x11')][_0x333d('0x13')]);return _0x13073c(_0x24075a[_0x333d('0x11')][_0x333d('0x13')]);}logger[_0x333d('0x11')](_0x333d('0xd'),_0x4d04aa,_0x24075a[_0x333d('0x11')][_0x333d('0x13')]);return _0x23645e(_0x24075a[_0x333d('0x11')][_0x333d('0x13')]);}else{logger[_0x333d('0xc')](_0x333d('0xd'),_0x4d04aa,_0x333d('0xf'));_0x23645e(_0x24075a[_0x333d('0x14')][_0x333d('0x13')]);}})['catch'](function(_0x383f70){logger['error'](_0x333d('0xd'),_0x4d04aa,_0x383f70);_0x13073c(_0x383f70);});});}exports['CreateFaxQueueReport']=function(_0xd3f272){var _0x436145=this;return new Promise(function(_0x6b157e,_0x5aace2){return db[_0x333d('0x15')][_0x333d('0x16')](_0xd3f272[_0x333d('0x17')],{'raw':_0xd3f272['options']?_0xd3f272[_0x333d('0x18')][_0x333d('0x19')]===undefined?!![]:![]:!![]})[_0x333d('0xb')](function(_0x40ac10){logger[_0x333d('0xc')](_0x333d('0x1a'),_0xd3f272);logger[_0x333d('0x1b')](_0x333d('0x1a'),_0xd3f272,JSON[_0x333d('0x10')](_0x40ac10));_0x6b157e(_0x40ac10);})['catch'](function(_0x2fdf0f){logger['error'](_0x333d('0x1a'),_0x2fdf0f[_0x333d('0x13')],_0xd3f272);_0x5aace2(_0x436145[_0x333d('0x11')](0x1f4,_0x2fdf0f['message']));});});};exports[_0x333d('0x1c')]=function(_0x5ea10b){var _0x4758cf=this;return new Promise(function(_0x3ec75d,_0x2011e5){return db[_0x333d('0x15')][_0x333d('0x1d')](_0x5ea10b[_0x333d('0x17')],{'raw':_0x5ea10b['options']?_0x5ea10b['options'][_0x333d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ea10b[_0x333d('0x18')]?_0x5ea10b[_0x333d('0x18')][_0x333d('0x1e')]||null:null,'attributes':_0x5ea10b[_0x333d('0x18')]?_0x5ea10b[_0x333d('0x18')]['attributes']||null:null,'limit':_0x5ea10b[_0x333d('0x18')]?_0x5ea10b[_0x333d('0x18')][_0x333d('0x1f')]||null:null})[_0x333d('0xb')](function(_0x5a189d){logger[_0x333d('0xc')](_0x333d('0x1c'),_0x5ea10b);logger['debug']('UpdateFaxQueueReport',_0x5ea10b,JSON['stringify'](_0x5a189d));_0x3ec75d(_0x5a189d);})[_0x333d('0x20')](function(_0x94d345){logger[_0x333d('0x11')](_0x333d('0x1c'),_0x94d345[_0x333d('0x13')],_0x5ea10b);_0x2011e5(_0x4758cf[_0x333d('0x11')](0x1f4,_0x94d345['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index b0186c8..8031ca3 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 _0x05b5=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy'];(function(_0x109739,_0x2b35d8){var _0x3cfac2=function(_0xdeac13){while(--_0xdeac13){_0x109739['push'](_0x109739['shift']());}};_0x3cfac2(++_0x2b35d8);}(_0x05b5,0x8d));var _0x505b=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x05b5[_0x164eca];return _0x2ce562;};'use strict';var multer=require(_0x505b('0x0'));var util=require(_0x505b('0x1'));var path=require(_0x505b('0x2'));var timeout=require(_0x505b('0x3'));var express=require(_0x505b('0x4'));var router=express[_0x505b('0x5')]();var auth=require(_0x505b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x505b('0x7'));var controller=require('./faxQueueReport.controller');router[_0x505b('0x8')]('/',auth['isAuthenticated'](),controller[_0x505b('0x9')]);router[_0x505b('0x8')]('/describe',auth[_0x505b('0xa')](),controller[_0x505b('0xb')]);router[_0x505b('0x8')](_0x505b('0xc'),auth[_0x505b('0xa')](),controller['show']);router[_0x505b('0xd')]('/',auth[_0x505b('0xa')](),controller[_0x505b('0xe')]);router[_0x505b('0xf')](_0x505b('0xc'),auth[_0x505b('0xa')](),controller[_0x505b('0x10')]);router[_0x505b('0x11')]('/:id',auth[_0x505b('0xa')](),controller[_0x505b('0x12')]);module[_0x505b('0x13')]=router; \ No newline at end of file +var _0x7955=['Router','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x2d6f4e,_0x6919aa){var _0x179882=function(_0x551cb0){while(--_0x551cb0){_0x2d6f4e['push'](_0x2d6f4e['shift']());}};_0x179882(++_0x6919aa);}(_0x7955,0x128));var _0x5795=function(_0x175e54,_0x271f93){_0x175e54=_0x175e54-0x0;var _0xee9bb0=_0x7955[_0x175e54];return _0xee9bb0;};'use strict';var multer=require(_0x5795('0x0'));var util=require(_0x5795('0x1'));var path=require('path');var timeout=require(_0x5795('0x2'));var express=require(_0x5795('0x3'));var router=express[_0x5795('0x4')]();var auth=require(_0x5795('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5795('0x6'));var controller=require(_0x5795('0x7'));router[_0x5795('0x8')]('/',auth['isAuthenticated'](),controller[_0x5795('0x9')]);router['get']('/describe',auth[_0x5795('0xa')](),controller['describe']);router[_0x5795('0x8')]('/:id',auth[_0x5795('0xa')](),controller[_0x5795('0xb')]);router[_0x5795('0xc')]('/',auth[_0x5795('0xa')](),controller[_0x5795('0xd')]);router[_0x5795('0xe')](_0x5795('0xf'),auth[_0x5795('0xa')](),controller[_0x5795('0x10')]);router[_0x5795('0x11')](_0x5795('0xf'),auth['isAuthenticated'](),controller[_0x5795('0x12')]);module[_0x5795('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 4164e3b..3f4231a 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 _0x5e2f=['exports','STRING','account','agent','queue','NOW','moment','sequelize'];(function(_0x33cf66,_0x30e414){var _0x3a400b=function(_0x29130b){while(--_0x29130b){_0x33cf66['push'](_0x33cf66['shift']());}};_0x3a400b(++_0x30e414);}(_0x5e2f,0x1ee));var _0xf5e2=function(_0xb6245,_0x55bdbc){_0xb6245=_0xb6245-0x0;var _0x5c1f1d=_0x5e2f[_0xb6245];return _0x5c1f1d;};'use strict';var moment=require(_0xf5e2('0x0'));var Sequelize=require(_0xf5e2('0x1'));module[_0xf5e2('0x2')]={'uniqueid':{'type':Sequelize[_0xf5e2('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf5e2('0x4'),_0xf5e2('0x5'),_0xf5e2('0x6')),'allowNull':![],'defaultValue':_0xf5e2('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xf5e2('0x7')]}}; \ No newline at end of file +var _0x73f1=['exports','STRING','account','agent','queue','NOW','sequelize'];(function(_0x573433,_0x4a9748){var _0xc2a505=function(_0x11540c){while(--_0x11540c){_0x573433['push'](_0x573433['shift']());}};_0xc2a505(++_0x4a9748);}(_0x73f1,0x1a3));var _0x173f=function(_0x3fc6c2,_0x3acffd){_0x3fc6c2=_0x3fc6c2-0x0;var _0x1b025e=_0x73f1[_0x3fc6c2];return _0x1b025e;};'use strict';var moment=require('moment');var Sequelize=require(_0x173f('0x0'));module[_0x173f('0x1')]={'uniqueid':{'type':Sequelize[_0x173f('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x173f('0x3'),_0x173f('0x4'),'queue'),'allowNull':![],'defaultValue':_0x173f('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x173f('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index ac14001..0b8dbea 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 _0x2470=['reject','save','destroy','then','sendStatus','error','stack','name','send','index','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','map','options','includeAll','include','findAll','rows','catch','keys','find','create','body','update','params','describe','html-pdf','eml-format','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','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0xbcc7a,_0xc3c731){var _0x4c5a5c=function(_0x80b7ed){while(--_0x80b7ed){_0xbcc7a['push'](_0xbcc7a['shift']());}};_0x4c5a5c(++_0xc3c731);}(_0x2470,0xc4));var _0x0247=function(_0x476aaf,_0x457252){_0x476aaf=_0x476aaf-0x0;var _0x449809=_0x2470[_0x476aaf];return _0x449809;};'use strict';var pdf=require(_0x0247('0x0'));var emlformat=require(_0x0247('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0247('0x2'));var rp=require(_0x0247('0x3'));var moment=require(_0x0247('0x4'));var BPromise=require(_0x0247('0x5'));var Mustache=require(_0x0247('0x6'));var util=require('util');var path=require(_0x0247('0x7'));var sox=require(_0x0247('0x8'));var csv=require(_0x0247('0x9'));var ejs=require(_0x0247('0xa'));var fs=require('fs');var _=require(_0x0247('0xb'));var squel=require(_0x0247('0xc'));var crypto=require(_0x0247('0xd'));var jsforce=require(_0x0247('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0247('0x9'));var querystring=require(_0x0247('0xf'));var Papa=require(_0x0247('0x10'));var Redis=require(_0x0247('0x11'));var authService=require(_0x0247('0x12'));var qs=require(_0x0247('0x13'));var as=require(_0x0247('0x14'));var hardwareService=require(_0x0247('0x15'));var logger=require('../../config/logger')(_0x0247('0x16'));var utils=require(_0x0247('0x17'));var config=require(_0x0247('0x18'));var db=require(_0x0247('0x19'))['db'];function respondWithStatusCode(_0x2d4138,_0x536c18){_0x536c18=_0x536c18||0xcc;return function(_0x1e61aa){if(_0x1e61aa){return _0x2d4138['sendStatus'](_0x536c18);}return _0x2d4138[_0x0247('0x1a')](_0x536c18)[_0x0247('0x1b')]();};}function respondWithResult(_0x48e433,_0x1c0705){_0x1c0705=_0x1c0705||0xc8;return function(_0x24648a){if(_0x24648a){return _0x48e433[_0x0247('0x1a')](_0x1c0705)[_0x0247('0x1c')](_0x24648a);}};}function respondWithFilteredResult(_0x36c891,_0x3fb4d6){return function(_0x377b57){if(_0x377b57){var _0x5a7ff2=_0x377b57[_0x0247('0x1d')],_0x264247=_0x3fb4d6[_0x0247('0x1e')],_0x220a21=_0x3fb4d6[_0x0247('0x1e')]+_0x3fb4d6[_0x0247('0x1f')],_0x4db209;if(_0x220a21>=_0x5a7ff2){_0x220a21=_0x5a7ff2;_0x4db209=0xc8;}else{_0x4db209=0xce;}_0x36c891[_0x0247('0x1a')](_0x4db209);return _0x36c891[_0x0247('0x20')](_0x0247('0x21'),_0x264247+'-'+_0x220a21+'/'+_0x5a7ff2)[_0x0247('0x1c')](_0x377b57);}return null;};}function patchUpdates(_0x1d3264){return function(_0x4eb2fb){try{jsonpatch[_0x0247('0x22')](_0x4eb2fb,_0x1d3264,!![]);}catch(_0x1d4512){return BPromise[_0x0247('0x23')](_0x1d4512);}return _0x4eb2fb[_0x0247('0x24')]();};}function saveUpdates(_0x2dbf28,_0x4afc9a){return function(_0x3cdfe6){if(_0x3cdfe6){return _0x3cdfe6['update'](_0x2dbf28)['then'](function(_0x1091a6){return _0x1091a6;});}return null;};}function removeEntity(_0x2876d7,_0x38f181){return function(_0x37fa95){if(_0x37fa95){return _0x37fa95[_0x0247('0x25')]()[_0x0247('0x26')](function(){_0x2876d7[_0x0247('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x404a7b,_0x58cb49){return function(_0x1758b5){if(!_0x1758b5){_0x404a7b[_0x0247('0x27')](0x194);}return _0x1758b5;};}function handleError(_0x3ab81b,_0xe3caa3){_0xe3caa3=_0xe3caa3||0x1f4;return function(_0x21b8b7){logger[_0x0247('0x28')](_0x21b8b7[_0x0247('0x29')]);if(_0x21b8b7[_0x0247('0x2a')]){delete _0x21b8b7[_0x0247('0x2a')];}_0x3ab81b[_0x0247('0x1a')](_0xe3caa3)[_0x0247('0x2b')](_0x21b8b7);};}exports[_0x0247('0x2c')]=function(_0x11e615,_0xa7fec2){var _0x287abf={},_0x5e33ff={},_0x223be2={'count':0x0,'rows':[]};var _0x3ba6a2=_['map'](db[_0x0247('0x2d')][_0x0247('0x2e')],function(_0x231718){return{'name':_0x231718[_0x0247('0x2f')],'type':_0x231718[_0x0247('0x30')][_0x0247('0x31')]};});_0x5e33ff[_0x0247('0x32')]=_['map'](_0x3ba6a2,'name');_0x5e33ff[_0x0247('0x33')]=_['keys'](_0x11e615['query']);_0x5e33ff[_0x0247('0x34')]=_[_0x0247('0x35')](_0x5e33ff[_0x0247('0x32')],_0x5e33ff[_0x0247('0x33')]);_0x287abf[_0x0247('0x36')]=_[_0x0247('0x35')](_0x5e33ff[_0x0247('0x32')],qs[_0x0247('0x37')](_0x11e615[_0x0247('0x33')]['fields']));_0x287abf[_0x0247('0x36')]=_0x287abf[_0x0247('0x36')][_0x0247('0x38')]?_0x287abf['attributes']:_0x5e33ff['model'];if(!_0x11e615['query'][_0x0247('0x39')](_0x0247('0x3a'))){_0x287abf[_0x0247('0x1f')]=qs[_0x0247('0x1f')](_0x11e615['query'][_0x0247('0x1f')]);_0x287abf[_0x0247('0x1e')]=qs['offset'](_0x11e615[_0x0247('0x33')][_0x0247('0x1e')]);}_0x287abf['order']=qs['sort'](_0x11e615[_0x0247('0x33')][_0x0247('0x3b')]);_0x287abf['where']=qs['filters'](_['pick'](_0x11e615[_0x0247('0x33')],_0x5e33ff[_0x0247('0x34')]));if(_0x11e615['query'][_0x0247('0x3c')]){_0x287abf['where']=_[_0x0247('0x3d')](_0x287abf[_0x0247('0x3e')],{'$or':_[_0x0247('0x3f')](_0x3ba6a2,function(_0x18cdfe){if(_0x18cdfe['type']!=='VIRTUAL'){var _0x2f26b6={};_0x2f26b6[_0x18cdfe[_0x0247('0x2a')]]={'$like':'%'+_0x11e615['query'][_0x0247('0x3c')]+'%'};return _0x2f26b6;}})});}_0x287abf=_[_0x0247('0x3d')]({},_0x287abf,_0x11e615[_0x0247('0x40')]);var _0x4c687b={'where':_0x287abf[_0x0247('0x3e')]};return db[_0x0247('0x2d')][_0x0247('0x1d')](_0x4c687b)['then'](function(_0xd965d4){_0x223be2[_0x0247('0x1d')]=_0xd965d4;if(_0x11e615[_0x0247('0x33')][_0x0247('0x41')]){_0x287abf[_0x0247('0x42')]=[{'all':!![]}];}return db[_0x0247('0x2d')][_0x0247('0x43')](_0x287abf);})[_0x0247('0x26')](function(_0x4a575e){_0x223be2[_0x0247('0x44')]=_0x4a575e;return _0x223be2;})[_0x0247('0x26')](respondWithFilteredResult(_0xa7fec2,_0x287abf))[_0x0247('0x45')](handleError(_0xa7fec2,null));};exports['show']=function(_0x7bffea,_0x3f395e){var _0x2bdcce={'raw':!![],'where':{'id':_0x7bffea['params']['id']}},_0x195e8a={};_0x195e8a[_0x0247('0x32')]=_[_0x0247('0x46')](db[_0x0247('0x2d')][_0x0247('0x2e')]);_0x195e8a[_0x0247('0x33')]=_['keys'](_0x7bffea[_0x0247('0x33')]);_0x195e8a[_0x0247('0x34')]=_[_0x0247('0x35')](_0x195e8a[_0x0247('0x32')],_0x195e8a['query']);_0x2bdcce['attributes']=_['intersection'](_0x195e8a['model'],qs[_0x0247('0x37')](_0x7bffea['query'][_0x0247('0x37')]));_0x2bdcce[_0x0247('0x36')]=_0x2bdcce['attributes']['length']?_0x2bdcce[_0x0247('0x36')]:_0x195e8a['model'];if(_0x7bffea[_0x0247('0x33')][_0x0247('0x41')]){_0x2bdcce['include']=[{'all':!![]}];}_0x2bdcce=_[_0x0247('0x3d')]({},_0x2bdcce,_0x7bffea[_0x0247('0x40')]);return db[_0x0247('0x2d')][_0x0247('0x47')](_0x2bdcce)[_0x0247('0x26')](handleEntityNotFound(_0x3f395e,null))[_0x0247('0x26')](respondWithResult(_0x3f395e,null))[_0x0247('0x45')](handleError(_0x3f395e,null));};exports[_0x0247('0x48')]=function(_0x415fc5,_0x4b13ed){return db[_0x0247('0x2d')]['create'](_0x415fc5[_0x0247('0x49')],{})[_0x0247('0x26')](respondWithResult(_0x4b13ed,0xc9))['catch'](handleError(_0x4b13ed,null));};exports[_0x0247('0x4a')]=function(_0x285840,_0x3719dd){if(_0x285840[_0x0247('0x49')]['id']){delete _0x285840[_0x0247('0x49')]['id'];}return db[_0x0247('0x2d')][_0x0247('0x47')]({'where':{'id':_0x285840['params']['id']}})[_0x0247('0x26')](handleEntityNotFound(_0x3719dd,null))['then'](saveUpdates(_0x285840['body'],null))[_0x0247('0x26')](respondWithResult(_0x3719dd,null))[_0x0247('0x45')](handleError(_0x3719dd,null));};exports[_0x0247('0x25')]=function(_0x452624,_0x368cf2){return db[_0x0247('0x2d')][_0x0247('0x47')]({'where':{'id':_0x452624[_0x0247('0x4b')]['id']}})[_0x0247('0x26')](handleEntityNotFound(_0x368cf2,null))[_0x0247('0x26')](removeEntity(_0x368cf2,null))['catch'](handleError(_0x368cf2,null));};exports[_0x0247('0x4c')]=function(_0x12c057,_0x1fb227){return db['FaxTransferReport'][_0x0247('0x4c')]()[_0x0247('0x26')](respondWithResult(_0x1fb227,null))['catch'](handleError(_0x1fb227,null));}; \ No newline at end of file +var _0x6700=['reject','save','destroy','then','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','params','intersection','include','find','create','body','catch','update','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','status','end','json','offset','limit','set','Content-Range','apply'];(function(_0x5813f8,_0x2ac282){var _0x11dc91=function(_0x9f9cfc){while(--_0x9f9cfc){_0x5813f8['push'](_0x5813f8['shift']());}};_0x11dc91(++_0x2ac282);}(_0x6700,0xc1));var _0x0670=function(_0x3534b3,_0x22c8c7){_0x3534b3=_0x3534b3-0x0;var _0x1ce4ef=_0x6700[_0x3534b3];return _0x1ce4ef;};'use strict';var pdf=require(_0x0670('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0670('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0670('0x2'));var rp=require(_0x0670('0x3'));var moment=require(_0x0670('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0670('0x5'));var util=require('util');var path=require(_0x0670('0x6'));var sox=require(_0x0670('0x7'));var csv=require(_0x0670('0x8'));var ejs=require(_0x0670('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0670('0xa'));var crypto=require(_0x0670('0xb'));var jsforce=require(_0x0670('0xc'));var deskjs=require(_0x0670('0xd'));var toCsv=require(_0x0670('0x8'));var querystring=require(_0x0670('0xe'));var Papa=require(_0x0670('0xf'));var Redis=require('ioredis');var authService=require(_0x0670('0x10'));var qs=require(_0x0670('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0670('0x12'))('api');var utils=require(_0x0670('0x13'));var config=require(_0x0670('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f8c7d,_0x5241ba){_0x5241ba=_0x5241ba||0xcc;return function(_0x41a51f){if(_0x41a51f){return _0x4f8c7d['sendStatus'](_0x5241ba);}return _0x4f8c7d[_0x0670('0x15')](_0x5241ba)[_0x0670('0x16')]();};}function respondWithResult(_0x6a89b4,_0x31675c){_0x31675c=_0x31675c||0xc8;return function(_0x788d55){if(_0x788d55){return _0x6a89b4[_0x0670('0x15')](_0x31675c)[_0x0670('0x17')](_0x788d55);}};}function respondWithFilteredResult(_0x230394,_0x8a6603){return function(_0x2e8c3b){if(_0x2e8c3b){var _0x1f76b5=_0x2e8c3b['count'],_0x3840fa=_0x8a6603[_0x0670('0x18')],_0x5b8f72=_0x8a6603[_0x0670('0x18')]+_0x8a6603[_0x0670('0x19')],_0x556bc7;if(_0x5b8f72>=_0x1f76b5){_0x5b8f72=_0x1f76b5;_0x556bc7=0xc8;}else{_0x556bc7=0xce;}_0x230394['status'](_0x556bc7);return _0x230394[_0x0670('0x1a')](_0x0670('0x1b'),_0x3840fa+'-'+_0x5b8f72+'/'+_0x1f76b5)[_0x0670('0x17')](_0x2e8c3b);}return null;};}function patchUpdates(_0x414a5b){return function(_0x13e097){try{jsonpatch[_0x0670('0x1c')](_0x13e097,_0x414a5b,!![]);}catch(_0x39784e){return BPromise[_0x0670('0x1d')](_0x39784e);}return _0x13e097[_0x0670('0x1e')]();};}function saveUpdates(_0x5ad67c,_0x207c6d){return function(_0x5b8ea2){if(_0x5b8ea2){return _0x5b8ea2['update'](_0x5ad67c)['then'](function(_0x156091){return _0x156091;});}return null;};}function removeEntity(_0x3762ea,_0x584ef9){return function(_0x2dcb3c){if(_0x2dcb3c){return _0x2dcb3c[_0x0670('0x1f')]()[_0x0670('0x20')](function(){_0x3762ea['status'](0xcc)[_0x0670('0x16')]();});}};}function handleEntityNotFound(_0x101a5f,_0x4b5935){return function(_0x234c4f){if(!_0x234c4f){_0x101a5f['sendStatus'](0x194);}return _0x234c4f;};}function handleError(_0x165d95,_0xd5945e){_0xd5945e=_0xd5945e||0x1f4;return function(_0x34992b){logger['error'](_0x34992b[_0x0670('0x21')]);if(_0x34992b[_0x0670('0x22')]){delete _0x34992b['name'];}_0x165d95['status'](_0xd5945e)[_0x0670('0x23')](_0x34992b);};}exports[_0x0670('0x24')]=function(_0x306e3a,_0x5cdc11){var _0x18f0d4={},_0x490efe={},_0x18c241={'count':0x0,'rows':[]};var _0x10a142=_[_0x0670('0x25')](db[_0x0670('0x26')][_0x0670('0x27')],function(_0x141d11){return{'name':_0x141d11[_0x0670('0x28')],'type':_0x141d11[_0x0670('0x29')][_0x0670('0x2a')]};});_0x490efe[_0x0670('0x2b')]=_[_0x0670('0x25')](_0x10a142,_0x0670('0x22'));_0x490efe[_0x0670('0x2c')]=_[_0x0670('0x2d')](_0x306e3a[_0x0670('0x2c')]);_0x490efe[_0x0670('0x2e')]=_['intersection'](_0x490efe['model'],_0x490efe[_0x0670('0x2c')]);_0x18f0d4['attributes']=_['intersection'](_0x490efe[_0x0670('0x2b')],qs['fields'](_0x306e3a[_0x0670('0x2c')][_0x0670('0x2f')]));_0x18f0d4['attributes']=_0x18f0d4[_0x0670('0x30')][_0x0670('0x31')]?_0x18f0d4[_0x0670('0x30')]:_0x490efe[_0x0670('0x2b')];if(!_0x306e3a[_0x0670('0x2c')][_0x0670('0x32')](_0x0670('0x33'))){_0x18f0d4[_0x0670('0x19')]=qs['limit'](_0x306e3a['query'][_0x0670('0x19')]);_0x18f0d4[_0x0670('0x18')]=qs[_0x0670('0x18')](_0x306e3a[_0x0670('0x2c')][_0x0670('0x18')]);}_0x18f0d4[_0x0670('0x34')]=qs[_0x0670('0x35')](_0x306e3a[_0x0670('0x2c')][_0x0670('0x35')]);_0x18f0d4['where']=qs[_0x0670('0x2e')](_[_0x0670('0x36')](_0x306e3a[_0x0670('0x2c')],_0x490efe[_0x0670('0x2e')]));if(_0x306e3a[_0x0670('0x2c')][_0x0670('0x37')]){_0x18f0d4[_0x0670('0x38')]=_[_0x0670('0x39')](_0x18f0d4[_0x0670('0x38')],{'$or':_[_0x0670('0x25')](_0x10a142,function(_0x1a72d8){if(_0x1a72d8['type']!==_0x0670('0x3a')){var _0x4c0668={};_0x4c0668[_0x1a72d8[_0x0670('0x22')]]={'$like':'%'+_0x306e3a[_0x0670('0x2c')][_0x0670('0x37')]+'%'};return _0x4c0668;}})});}_0x18f0d4=_[_0x0670('0x39')]({},_0x18f0d4,_0x306e3a[_0x0670('0x3b')]);var _0x5b07b9={'where':_0x18f0d4[_0x0670('0x38')]};return db[_0x0670('0x26')][_0x0670('0x3c')](_0x5b07b9)[_0x0670('0x20')](function(_0x385cbd){_0x18c241[_0x0670('0x3c')]=_0x385cbd;if(_0x306e3a[_0x0670('0x2c')][_0x0670('0x3d')]){_0x18f0d4['include']=[{'all':!![]}];}return db[_0x0670('0x26')][_0x0670('0x3e')](_0x18f0d4);})[_0x0670('0x20')](function(_0x752ed0){_0x18c241[_0x0670('0x3f')]=_0x752ed0;return _0x18c241;})[_0x0670('0x20')](respondWithFilteredResult(_0x5cdc11,_0x18f0d4))['catch'](handleError(_0x5cdc11,null));};exports[_0x0670('0x40')]=function(_0x66ded7,_0x55e677){var _0x861d48={'raw':!![],'where':{'id':_0x66ded7[_0x0670('0x41')]['id']}},_0x156c6e={};_0x156c6e[_0x0670('0x2b')]=_['keys'](db[_0x0670('0x26')][_0x0670('0x27')]);_0x156c6e['query']=_['keys'](_0x66ded7['query']);_0x156c6e[_0x0670('0x2e')]=_[_0x0670('0x42')](_0x156c6e[_0x0670('0x2b')],_0x156c6e[_0x0670('0x2c')]);_0x861d48['attributes']=_[_0x0670('0x42')](_0x156c6e[_0x0670('0x2b')],qs[_0x0670('0x2f')](_0x66ded7['query'][_0x0670('0x2f')]));_0x861d48[_0x0670('0x30')]=_0x861d48['attributes']['length']?_0x861d48[_0x0670('0x30')]:_0x156c6e[_0x0670('0x2b')];if(_0x66ded7[_0x0670('0x2c')][_0x0670('0x3d')]){_0x861d48[_0x0670('0x43')]=[{'all':!![]}];}_0x861d48=_[_0x0670('0x39')]({},_0x861d48,_0x66ded7[_0x0670('0x3b')]);return db[_0x0670('0x26')][_0x0670('0x44')](_0x861d48)[_0x0670('0x20')](handleEntityNotFound(_0x55e677,null))['then'](respondWithResult(_0x55e677,null))['catch'](handleError(_0x55e677,null));};exports[_0x0670('0x45')]=function(_0x2bf198,_0x386623){return db[_0x0670('0x26')][_0x0670('0x45')](_0x2bf198[_0x0670('0x46')],{})[_0x0670('0x20')](respondWithResult(_0x386623,0xc9))[_0x0670('0x47')](handleError(_0x386623,null));};exports[_0x0670('0x48')]=function(_0x46274d,_0x2b9460){if(_0x46274d[_0x0670('0x46')]['id']){delete _0x46274d[_0x0670('0x46')]['id'];}return db[_0x0670('0x26')][_0x0670('0x44')]({'where':{'id':_0x46274d[_0x0670('0x41')]['id']}})[_0x0670('0x20')](handleEntityNotFound(_0x2b9460,null))[_0x0670('0x20')](saveUpdates(_0x46274d['body'],null))['then'](respondWithResult(_0x2b9460,null))['catch'](handleError(_0x2b9460,null));};exports[_0x0670('0x1f')]=function(_0x4b2d82,_0x3a06e1){return db[_0x0670('0x26')][_0x0670('0x44')]({'where':{'id':_0x4b2d82['params']['id']}})[_0x0670('0x20')](handleEntityNotFound(_0x3a06e1,null))[_0x0670('0x20')](removeEntity(_0x3a06e1,null))[_0x0670('0x47')](handleError(_0x3a06e1,null));};exports[_0x0670('0x49')]=function(_0x2d2213,_0x8e0547){return db[_0x0670('0x26')][_0x0670('0x49')]()['then'](respondWithResult(_0x8e0547,null))['catch'](handleError(_0x8e0547,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index e8cdbfc..d94703d 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 _0xcd51=['define','report_fax_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xcd51,0x1ca));var _0x1cd5=function(_0x1d1227,_0x2a71eb){_0x1d1227=_0x1d1227-0x0;var _0x23e9e9=_0xcd51[_0x1d1227];return _0x23e9e9;};'use strict';var _=require(_0x1cd5('0x0'));var util=require(_0x1cd5('0x1'));var logger=require('../../config/logger')(_0x1cd5('0x2'));var moment=require(_0x1cd5('0x3'));var BPromise=require(_0x1cd5('0x4'));var rp=require(_0x1cd5('0x5'));var fs=require('fs');var path=require(_0x1cd5('0x6'));var rimraf=require(_0x1cd5('0x7'));var config=require(_0x1cd5('0x8'));var attributes=require('./faxTransferReport.attributes');module[_0x1cd5('0x9')]=function(_0x217ee5,_0x36c132){return _0x217ee5[_0x1cd5('0xa')]('FaxTransferReport',attributes,{'tableName':_0x1cd5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1cd5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7c05=['uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer'];(function(_0x1d1fdf,_0x33ba5a){var _0x3521d6=function(_0x53281c){while(--_0x53281c){_0x1d1fdf['push'](_0x1d1fdf['shift']());}};_0x3521d6(++_0x33ba5a);}(_0x7c05,0x6a));var _0x57c0=function(_0x36f243,_0x188505){_0x36f243=_0x36f243-0x0;var _0x426436=_0x7c05[_0x36f243];return _0x426436;};'use strict';var _=require(_0x57c0('0x0'));var util=require('util');var logger=require(_0x57c0('0x1'))(_0x57c0('0x2'));var moment=require(_0x57c0('0x3'));var BPromise=require(_0x57c0('0x4'));var rp=require(_0x57c0('0x5'));var fs=require('fs');var path=require(_0x57c0('0x6'));var rimraf=require(_0x57c0('0x7'));var config=require(_0x57c0('0x8'));var attributes=require(_0x57c0('0x9'));module[_0x57c0('0xa')]=function(_0x57810f,_0x14d51e){return _0x57810f[_0x57c0('0xb')](_0x57c0('0xc'),attributes,{'tableName':_0x57c0('0xd'),'paranoid':![],'indexes':[{'name':_0x57c0('0xe'),'fields':[_0x57c0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index d42e33e..ddeeb0d 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 _0xb226=['message','info','result','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb226,0x7b));var _0x6b22=function(_0x191bb6,_0x1d71c4){_0x191bb6=_0x191bb6-0x0;var _0x4a6f30=_0xb226[_0x191bb6];return _0x4a6f30;};'use strict';var _=require('lodash');var util=require(_0x6b22('0x0'));var moment=require(_0x6b22('0x1'));var BPromise=require('bluebird');var rs=require(_0x6b22('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b22('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b22('0x4'))(_0x6b22('0x5'));var config=require(_0x6b22('0x6'));var jayson=require(_0x6b22('0x7'));var client=jayson['client'][_0x6b22('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x386103,_0x1ed7d2,_0x5da5a1){return new BPromise(function(_0x4c3b44,_0x2a8fc2){return client[_0x6b22('0x9')](_0x386103,_0x5da5a1)[_0x6b22('0xa')](function(_0x457e53){logger['info'](_0x6b22('0xb'),_0x1ed7d2,_0x6b22('0xc'));logger['debug'](_0x6b22('0xd'),_0x1ed7d2,_0x6b22('0xc'),JSON[_0x6b22('0xe')](_0x457e53));if(_0x457e53[_0x6b22('0xf')]){if(_0x457e53['error'][_0x6b22('0x10')]===0x1f4){logger[_0x6b22('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x1ed7d2,_0x457e53[_0x6b22('0xf')][_0x6b22('0x11')]);return _0x2a8fc2(_0x457e53[_0x6b22('0xf')][_0x6b22('0x11')]);}logger[_0x6b22('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x1ed7d2,_0x457e53[_0x6b22('0xf')][_0x6b22('0x11')]);return _0x4c3b44(_0x457e53[_0x6b22('0xf')][_0x6b22('0x11')]);}else{logger[_0x6b22('0x12')](_0x6b22('0xb'),_0x1ed7d2,'request\x20sent');_0x4c3b44(_0x457e53[_0x6b22('0x13')][_0x6b22('0x11')]);}})['catch'](function(_0x39b487){logger[_0x6b22('0xf')](_0x6b22('0xb'),_0x1ed7d2,_0x39b487);_0x2a8fc2(_0x39b487);});});} \ No newline at end of file +var _0x9dd2=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x9dd2,0x89));var _0x29dd=function(_0x31eb67,_0x9bc8c0){_0x31eb67=_0x31eb67-0x0;var _0x2a8cb8=_0x9dd2[_0x31eb67];return _0x2a8cb8;};'use strict';var _=require(_0x29dd('0x0'));var util=require('util');var moment=require(_0x29dd('0x1'));var BPromise=require(_0x29dd('0x2'));var rs=require(_0x29dd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x29dd('0x4'))['db'];var utils=require(_0x29dd('0x5'));var logger=require(_0x29dd('0x6'))(_0x29dd('0x7'));var config=require(_0x29dd('0x8'));var jayson=require(_0x29dd('0x9'));var client=jayson[_0x29dd('0xa')][_0x29dd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49051f,_0x3524d1,_0x121edd){return new BPromise(function(_0x4878e6,_0x33516a){return client[_0x29dd('0xc')](_0x49051f,_0x121edd)[_0x29dd('0xd')](function(_0x12a163){logger[_0x29dd('0xe')](_0x29dd('0xf'),_0x3524d1,_0x29dd('0x10'));logger[_0x29dd('0x11')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x3524d1,_0x29dd('0x10'),JSON[_0x29dd('0x12')](_0x12a163));if(_0x12a163[_0x29dd('0x13')]){if(_0x12a163[_0x29dd('0x13')][_0x29dd('0x14')]===0x1f4){logger[_0x29dd('0x13')](_0x29dd('0xf'),_0x3524d1,_0x12a163['error'][_0x29dd('0x15')]);return _0x33516a(_0x12a163['error'][_0x29dd('0x15')]);}logger['error'](_0x29dd('0xf'),_0x3524d1,_0x12a163[_0x29dd('0x13')][_0x29dd('0x15')]);return _0x4878e6(_0x12a163['error'][_0x29dd('0x15')]);}else{logger[_0x29dd('0xe')](_0x29dd('0xf'),_0x3524d1,_0x29dd('0x10'));_0x4878e6(_0x12a163[_0x29dd('0x16')][_0x29dd('0x15')]);}})['catch'](function(_0x12d3f4){logger[_0x29dd('0x13')](_0x29dd('0xf'),_0x3524d1,_0x12d3f4);_0x33516a(_0x12d3f4);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 4827088..bce466a 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 _0xe556=['describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./faxTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x1b28b7,_0x22f9f7){var _0x4d3e82=function(_0xe4f9b2){while(--_0xe4f9b2){_0x1b28b7['push'](_0x1b28b7['shift']());}};_0x4d3e82(++_0x22f9f7);}(_0xe556,0x12f));var _0x6e55=function(_0x3724a3,_0x1e099b){_0x3724a3=_0x3724a3-0x0;var _0x2f78a8=_0xe556[_0x3724a3];return _0x2f78a8;};'use strict';var multer=require(_0x6e55('0x0'));var util=require(_0x6e55('0x1'));var path=require(_0x6e55('0x2'));var timeout=require(_0x6e55('0x3'));var express=require(_0x6e55('0x4'));var router=express[_0x6e55('0x5')]();var auth=require(_0x6e55('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6e55('0x7'));router[_0x6e55('0x8')]('/',auth[_0x6e55('0x9')](),controller[_0x6e55('0xa')]);router[_0x6e55('0x8')](_0x6e55('0xb'),auth['isAuthenticated'](),controller[_0x6e55('0xc')]);router[_0x6e55('0x8')](_0x6e55('0xd'),auth[_0x6e55('0x9')](),controller[_0x6e55('0xe')]);router[_0x6e55('0xf')]('/',auth[_0x6e55('0x9')](),controller[_0x6e55('0x10')]);router[_0x6e55('0x11')](_0x6e55('0xd'),auth[_0x6e55('0x9')](),controller[_0x6e55('0x12')]);router[_0x6e55('0x13')]('/:id',auth[_0x6e55('0x9')](),controller['destroy']);module[_0x6e55('0x14')]=router; \ No newline at end of file +var _0x1137=['destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','create','put','update','delete'];(function(_0x17a6d0,_0x4d6623){var _0x2017c3=function(_0x40ccd0){while(--_0x40ccd0){_0x17a6d0['push'](_0x17a6d0['shift']());}};_0x2017c3(++_0x4d6623);}(_0x1137,0x1a6));var _0x7113=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0x1137[_0x2e913b];return _0x173899;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7113('0x0'));var router=express[_0x7113('0x1')]();var auth=require(_0x7113('0x2'));var interaction=require(_0x7113('0x3'));var config=require('../../config/environment');var controller=require('./faxTransferReport.controller');router[_0x7113('0x4')]('/',auth[_0x7113('0x5')](),controller[_0x7113('0x6')]);router[_0x7113('0x4')](_0x7113('0x7'),auth[_0x7113('0x5')](),controller['describe']);router['get']('/:id',auth[_0x7113('0x5')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x7113('0x8')]);router[_0x7113('0x9')]('/:id',auth[_0x7113('0x5')](),controller[_0x7113('0xa')]);router[_0x7113('0xb')]('/:id',auth[_0x7113('0x5')](),controller[_0x7113('0xc')]);module[_0x7113('0xd')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index f4e616b..b36f45a 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 _0xe5d5=['/:id/configurations','getConfigurations','post','addConfiguration','update','exports','path','express','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x184d49,_0x31018c){var _0x28f3ef=function(_0x29a474){while(--_0x29a474){_0x184d49['push'](_0x184d49['shift']());}};_0x28f3ef(++_0x31018c);}(_0xe5d5,0x156));var _0x5e5d=function(_0x414588,_0x6b3f00){_0x414588=_0x414588-0x0;var _0x11a72e=_0xe5d5[_0x414588];return _0x11a72e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5e5d('0x0'));var timeout=require('connect-timeout');var express=require(_0x5e5d('0x1'));var router=express['Router']();var auth=require(_0x5e5d('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x5e5d('0x3'));var controller=require(_0x5e5d('0x4'));router[_0x5e5d('0x5')]('/',auth[_0x5e5d('0x6')](),controller[_0x5e5d('0x7')]);router[_0x5e5d('0x5')](_0x5e5d('0x8'),auth[_0x5e5d('0x6')](),controller[_0x5e5d('0x9')]);router[_0x5e5d('0x5')](_0x5e5d('0xa'),auth[_0x5e5d('0x6')](),controller[_0x5e5d('0xb')]);router[_0x5e5d('0x5')]('/:id/fields',auth[_0x5e5d('0x6')](),controller['getFields']);router[_0x5e5d('0xc')]('/',auth[_0x5e5d('0x6')](),controller['create']);router[_0x5e5d('0xc')](_0x5e5d('0xa'),auth[_0x5e5d('0x6')](),controller[_0x5e5d('0xd')]);router['put']('/:id',auth[_0x5e5d('0x6')](),controller[_0x5e5d('0xe')]);router['delete'](_0x5e5d('0x8'),auth[_0x5e5d('0x6')](),controller['destroy']);module[_0x5e5d('0xf')]=router; \ No newline at end of file +var _0xa751=['./intDeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','post','create','put','update','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x3d49e0,_0x5c9105){var _0x40f3cc=function(_0x8ff3e1){while(--_0x8ff3e1){_0x3d49e0['push'](_0x3d49e0['shift']());}};_0x40f3cc(++_0x5c9105);}(_0xa751,0x175));var _0x1a75=function(_0x4474b6,_0x224f96){_0x4474b6=_0x4474b6-0x0;var _0x4562ef=_0xa751[_0x4474b6];return _0x4562ef;};'use strict';var multer=require(_0x1a75('0x0'));var util=require(_0x1a75('0x1'));var path=require(_0x1a75('0x2'));var timeout=require(_0x1a75('0x3'));var express=require('express');var router=express[_0x1a75('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1a75('0x5'));var config=require(_0x1a75('0x6'));var controller=require(_0x1a75('0x7'));router['get']('/',auth[_0x1a75('0x8')](),controller[_0x1a75('0x9')]);router[_0x1a75('0xa')](_0x1a75('0xb'),auth[_0x1a75('0x8')](),controller[_0x1a75('0xc')]);router[_0x1a75('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x1a75('0xa')](_0x1a75('0xd'),auth[_0x1a75('0x8')](),controller[_0x1a75('0xe')]);router[_0x1a75('0xf')]('/',auth[_0x1a75('0x8')](),controller[_0x1a75('0x10')]);router[_0x1a75('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x1a75('0x11')](_0x1a75('0xb'),auth[_0x1a75('0x8')](),controller[_0x1a75('0x12')]);router['delete']('/:id',auth[_0x1a75('0x8')](),controller[_0x1a75('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 58447bc..986aed0 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 _0xaf97=['sequelize','STRING','basic','ENUM','integrationTab'];(function(_0x15f4ad,_0xabccd2){var _0x21d9d0=function(_0x48e53e){while(--_0x48e53e){_0x15f4ad['push'](_0x15f4ad['shift']());}};_0x21d9d0(++_0xabccd2);}(_0xaf97,0x140));var _0x7af9=function(_0x52f7a3,_0x2e9088){_0x52f7a3=_0x52f7a3-0x0;var _0x8a5367=_0xaf97[_0x52f7a3];return _0x8a5367;};'use strict';var Sequelize=require(_0x7af9('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7af9('0x1')]},'remoteUri':{'type':Sequelize[_0x7af9('0x1')]},'authType':{'type':Sequelize['ENUM'](_0x7af9('0x2')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x7af9('0x1')]},'consumerKey':{'type':Sequelize[_0x7af9('0x1')]},'consumerSecret':{'type':Sequelize[_0x7af9('0x1')]},'token':{'type':Sequelize[_0x7af9('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x7af9('0x1')]},'type':{'type':Sequelize[_0x7af9('0x3')](_0x7af9('0x4'),'newTab'),'defaultValue':_0x7af9('0x4')}}; \ No newline at end of file +var _0x4935=['STRING','ENUM','basic','newTab','integrationTab','sequelize','exports'];(function(_0x2cfcbb,_0x5db0d3){var _0x15042f=function(_0x16ae62){while(--_0x16ae62){_0x2cfcbb['push'](_0x2cfcbb['shift']());}};_0x15042f(++_0x5db0d3);}(_0x4935,0x19b));var _0x5493=function(_0x38fc83,_0x17006c){_0x38fc83=_0x38fc83-0x0;var _0x415b17=_0x4935[_0x38fc83];return _0x415b17;};'use strict';var Sequelize=require(_0x5493('0x0'));module[_0x5493('0x1')]={'name':{'type':Sequelize[_0x5493('0x2')]},'description':{'type':Sequelize[_0x5493('0x2')]},'username':{'type':Sequelize[_0x5493('0x2')]},'remoteUri':{'type':Sequelize[_0x5493('0x2')]},'authType':{'type':Sequelize[_0x5493('0x3')](_0x5493('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x5493('0x2')]},'consumerKey':{'type':Sequelize[_0x5493('0x2')]},'consumerSecret':{'type':Sequelize[_0x5493('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x5493('0x2')]},'serverUrl':{'type':Sequelize[_0x5493('0x2')]},'type':{'type':Sequelize[_0x5493('0x3')]('integrationTab',_0x5493('0x5')),'defaultValue':_0x5493('0x6')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 9a62255..1ad08fb 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 _0x9979=['../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','DeskAccount','includeAll','findAll','rows','show','params','rawAttributes','find','create','body','destroy','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','username','password','consumerKey','token','tokenSecret','slice','substring','GET','%s/custom_fields','application/json','authType','basic','headers','format','Basic\x20%s','%s:%s','toString','base64','_embedded','entries','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xa9ad76,_0x36bb01){var _0x45bc4d=function(_0x4b192c){while(--_0x4b192c){_0xa9ad76['push'](_0xa9ad76['shift']());}};_0x45bc4d(++_0x36bb01);}(_0x9979,0x166));var _0x9997=function(_0x3181d7,_0x5ee974){_0x3181d7=_0x3181d7-0x0;var _0x47fae=_0x9979[_0x3181d7];return _0x47fae;};'use strict';var pdf=require(_0x9997('0x0'));var emlformat=require(_0x9997('0x1'));var rimraf=require(_0x9997('0x2'));var zipdir=require(_0x9997('0x3'));var jsonpatch=require(_0x9997('0x4'));var rp=require(_0x9997('0x5'));var moment=require('moment');var BPromise=require(_0x9997('0x6'));var Mustache=require('mustache');var util=require(_0x9997('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9997('0x8'));var squel=require(_0x9997('0x9'));var crypto=require(_0x9997('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9997('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9997('0xc'));var Papa=require('papaparse');var Redis=require(_0x9997('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x9997('0xe'));var as=require(_0x9997('0xf'));var hardwareService=require(_0x9997('0x10'));var logger=require(_0x9997('0x11'))(_0x9997('0x12'));var utils=require(_0x9997('0x13'));var config=require('../../config/environment');var db=require(_0x9997('0x14'))['db'];var integrations=require(_0x9997('0x15'));var jayson=require(_0x9997('0x16'));var client=jayson[_0x9997('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x1d2642,_0x4856f2,_0xda790b){if(_0xda790b){var _0x1512d5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1512d5['test'](_0x4856f2)){return _0x1d2642;}else{throw new db[(_0x9997('0x18'))]['ValidationError'](_0x9997('0x19'));}}else{return _0x1d2642;}}function respondWithRpcPromise(_0x583816,_0x1e77f0,_0x30effb,_0x3d7102){return new BPromise(function(_0x1439af,_0x394405){var _0x1ea457=_0x3d7102||client;return _0x1ea457[_0x9997('0x1a')](_0x583816,_0x30effb)[_0x9997('0x1b')](function(_0x1ddea2){logger[_0x9997('0x1c')](_0x9997('0x1d'),_0x1e77f0,_0x9997('0x1e'));logger[_0x9997('0x1f')](_0x9997('0x20'),_0x1e77f0,_0x9997('0x1e'),JSON[_0x9997('0x21')](_0x1ddea2));if(_0x1ddea2[_0x9997('0x22')]){if(_0x1ddea2[_0x9997('0x22')]['code']===0x1f4){logger['error'](_0x9997('0x1d'),_0x1e77f0,_0x1ddea2[_0x9997('0x22')]['message']);return _0x394405(_0x1ddea2[_0x9997('0x22')][_0x9997('0x23')]);}logger[_0x9997('0x22')]('DeskAccount,\x20%s,\x20%s',_0x1e77f0,_0x1ddea2[_0x9997('0x22')]['message']);return _0x1439af(_0x1ddea2[_0x9997('0x22')]['message']);}else{logger[_0x9997('0x1c')](_0x9997('0x1d'),_0x1e77f0,_0x9997('0x1e'));_0x1439af(_0x1ddea2[_0x9997('0x24')]['message']);}})[_0x9997('0x25')](function(_0x3736ca){logger[_0x9997('0x22')](_0x9997('0x1d'),_0x1e77f0,_0x3736ca);_0x394405(_0x3736ca);});});}function respondWithStatusCode(_0x47f237,_0x48e29c){_0x48e29c=_0x48e29c||0xcc;return function(_0x17a308){if(_0x17a308){return _0x47f237[_0x9997('0x26')](_0x48e29c);}return _0x47f237[_0x9997('0x27')](_0x48e29c)[_0x9997('0x28')]();};}function respondWithResult(_0x4b9a97,_0x286706){_0x286706=_0x286706||0xc8;return function(_0x29d79f){if(_0x29d79f){return _0x4b9a97[_0x9997('0x27')](_0x286706)[_0x9997('0x29')](_0x29d79f);}};}function respondWithFilteredResult(_0x5e866b,_0x14ad0b){return function(_0x5b5e02){if(_0x5b5e02){var _0x68f5f5=_0x5b5e02[_0x9997('0x2a')],_0x525153=_0x14ad0b[_0x9997('0x2b')],_0x3b684c=_0x14ad0b[_0x9997('0x2b')]+_0x14ad0b['limit'],_0x34472a;if(_0x3b684c>=_0x68f5f5){_0x3b684c=_0x68f5f5;_0x34472a=0xc8;}else{_0x34472a=0xce;}_0x5e866b[_0x9997('0x27')](_0x34472a);return _0x5e866b[_0x9997('0x2c')](_0x9997('0x2d'),_0x525153+'-'+_0x3b684c+'/'+_0x68f5f5)[_0x9997('0x29')](_0x5b5e02);}return null;};}function patchUpdates(_0xd36413){return function(_0x306045){try{jsonpatch[_0x9997('0x2e')](_0x306045,_0xd36413,!![]);}catch(_0x1496c1){return BPromise['reject'](_0x1496c1);}return _0x306045[_0x9997('0x2f')]();};}function saveUpdates(_0x126b1f,_0x4294a4){return function(_0x5d4007){if(_0x5d4007){return _0x5d4007[_0x9997('0x30')](_0x126b1f)[_0x9997('0x1b')](function(_0x27092e){return _0x27092e;});}return null;};}function removeEntity(_0x242842,_0x7e1f64){return function(_0x637b0d){if(_0x637b0d){return _0x637b0d['destroy']()[_0x9997('0x1b')](function(){_0x242842['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6b06aa,_0x4dfb15){return function(_0x688116){if(!_0x688116){_0x6b06aa['sendStatus'](0x194);}return _0x688116;};}function handleError(_0x3aec03,_0x23da38){_0x23da38=_0x23da38||0x1f4;return function(_0x4141ae){logger[_0x9997('0x22')](_0x4141ae[_0x9997('0x31')]);if(_0x4141ae[_0x9997('0x32')]){delete _0x4141ae[_0x9997('0x32')];}_0x3aec03[_0x9997('0x27')](_0x23da38)[_0x9997('0x33')](_0x4141ae);};}exports[_0x9997('0x34')]=function(_0x501b4b,_0x56cdc2){var _0x2e5eb7={},_0x2933f4={},_0x29a9f6={'count':0x0,'rows':[]};var _0x3bc8f1=_[_0x9997('0x35')](db['DeskAccount']['rawAttributes'],function(_0x491df1){return{'name':_0x491df1[_0x9997('0x36')],'type':_0x491df1[_0x9997('0x37')][_0x9997('0x38')]};});_0x2933f4[_0x9997('0x39')]=_[_0x9997('0x35')](_0x3bc8f1,_0x9997('0x32'));_0x2933f4[_0x9997('0x3a')]=_[_0x9997('0x3b')](_0x501b4b[_0x9997('0x3a')]);_0x2933f4[_0x9997('0x3c')]=_[_0x9997('0x3d')](_0x2933f4['model'],_0x2933f4[_0x9997('0x3a')]);_0x2e5eb7[_0x9997('0x3e')]=_['intersection'](_0x2933f4[_0x9997('0x39')],qs[_0x9997('0x3f')](_0x501b4b[_0x9997('0x3a')][_0x9997('0x3f')]));_0x2e5eb7['attributes']=_0x2e5eb7['attributes'][_0x9997('0x40')]?_0x2e5eb7['attributes']:_0x2933f4[_0x9997('0x39')];if(!_0x501b4b[_0x9997('0x3a')][_0x9997('0x41')](_0x9997('0x42'))){_0x2e5eb7['limit']=qs['limit'](_0x501b4b[_0x9997('0x3a')][_0x9997('0x43')]);_0x2e5eb7['offset']=qs['offset'](_0x501b4b[_0x9997('0x3a')][_0x9997('0x2b')]);}_0x2e5eb7[_0x9997('0x44')]=qs[_0x9997('0x45')](_0x501b4b[_0x9997('0x3a')][_0x9997('0x45')]);_0x2e5eb7[_0x9997('0x46')]=qs['filters'](_[_0x9997('0x47')](_0x501b4b[_0x9997('0x3a')],_0x2933f4[_0x9997('0x3c')]));if(_0x501b4b['query'][_0x9997('0x48')]){_0x2e5eb7[_0x9997('0x46')]=_['merge'](_0x2e5eb7[_0x9997('0x46')],{'$or':_['map'](_0x3bc8f1,function(_0x66918e){if(_0x66918e[_0x9997('0x37')]!==_0x9997('0x49')){var _0x2913be={};_0x2913be[_0x66918e[_0x9997('0x32')]]={'$like':'%'+_0x501b4b[_0x9997('0x3a')][_0x9997('0x48')]+'%'};return _0x2913be;}})});}_0x2e5eb7=_[_0x9997('0x4a')]({},_0x2e5eb7,_0x501b4b[_0x9997('0x4b')]);var _0x2fa3ac={'where':_0x2e5eb7[_0x9997('0x46')]};return db[_0x9997('0x4c')][_0x9997('0x2a')](_0x2fa3ac)['then'](function(_0x26624c){_0x29a9f6[_0x9997('0x2a')]=_0x26624c;if(_0x501b4b[_0x9997('0x3a')][_0x9997('0x4d')]){_0x2e5eb7['include']=[{'all':!![]}];}return db[_0x9997('0x4c')][_0x9997('0x4e')](_0x2e5eb7);})['then'](function(_0x163dc8){_0x29a9f6[_0x9997('0x4f')]=_0x163dc8;return _0x29a9f6;})['then'](respondWithFilteredResult(_0x56cdc2,_0x2e5eb7))[_0x9997('0x25')](handleError(_0x56cdc2,null));};exports[_0x9997('0x50')]=function(_0x2fcc86,_0x26cdf3){var _0x241d53={'raw':![],'where':{'id':_0x2fcc86[_0x9997('0x51')]['id']}},_0x89986b={};_0x89986b[_0x9997('0x39')]=_[_0x9997('0x3b')](db[_0x9997('0x4c')][_0x9997('0x52')]);_0x89986b[_0x9997('0x3a')]=_[_0x9997('0x3b')](_0x2fcc86[_0x9997('0x3a')]);_0x89986b[_0x9997('0x3c')]=_['intersection'](_0x89986b[_0x9997('0x39')],_0x89986b['query']);_0x241d53['attributes']=_['intersection'](_0x89986b[_0x9997('0x39')],qs[_0x9997('0x3f')](_0x2fcc86[_0x9997('0x3a')][_0x9997('0x3f')]));_0x241d53['attributes']=_0x241d53[_0x9997('0x3e')]['length']?_0x241d53[_0x9997('0x3e')]:_0x89986b[_0x9997('0x39')];if(_0x2fcc86['query'][_0x9997('0x4d')]){_0x241d53['include']=[{'all':!![]}];}_0x241d53=_[_0x9997('0x4a')]({},_0x241d53,_0x2fcc86[_0x9997('0x4b')]);return db[_0x9997('0x4c')][_0x9997('0x53')](_0x241d53)[_0x9997('0x1b')](handleEntityNotFound(_0x26cdf3,null))[_0x9997('0x1b')](respondWithResult(_0x26cdf3,null))[_0x9997('0x25')](handleError(_0x26cdf3,null));};exports[_0x9997('0x54')]=function(_0x4740fc,_0x878a2){return db[_0x9997('0x4c')][_0x9997('0x54')](_0x4740fc[_0x9997('0x55')],{})[_0x9997('0x1b')](respondWithResult(_0x878a2,0xc9))[_0x9997('0x25')](handleError(_0x878a2,null));};exports[_0x9997('0x30')]=function(_0x219955,_0x431669){if(_0x219955[_0x9997('0x55')]['id']){delete _0x219955[_0x9997('0x55')]['id'];}return db[_0x9997('0x4c')][_0x9997('0x53')]({'where':{'id':_0x219955['params']['id']}})[_0x9997('0x1b')](handleEntityNotFound(_0x431669,null))[_0x9997('0x1b')](saveUpdates(_0x219955['body'],null))[_0x9997('0x1b')](respondWithResult(_0x431669,null))[_0x9997('0x25')](handleError(_0x431669,null));};exports[_0x9997('0x56')]=function(_0x297a15,_0x4965e5){return db[_0x9997('0x4c')][_0x9997('0x53')]({'where':{'id':_0x297a15['params']['id']}})[_0x9997('0x1b')](handleEntityNotFound(_0x4965e5,null))[_0x9997('0x1b')](removeEntity(_0x4965e5,null))[_0x9997('0x25')](handleError(_0x4965e5,null));};exports[_0x9997('0x57')]=function(_0x12a78a,_0x1752a7,_0x30a313){var _0xcfcb40={};var _0x8339d5={};var _0x2e51d4;var _0xe0d55d;return db[_0x9997('0x4c')][_0x9997('0x58')]({'where':{'id':_0x12a78a['params']['id']}})[_0x9997('0x1b')](handleEntityNotFound(_0x1752a7,null))[_0x9997('0x1b')](function(_0x5133b4){if(_0x5133b4){_0x2e51d4=_0x5133b4;_0x8339d5[_0x9997('0x39')]=_[_0x9997('0x3b')](db[_0x9997('0x59')][_0x9997('0x52')]);_0x8339d5['query']=_[_0x9997('0x3b')](_0x12a78a[_0x9997('0x3a')]);_0x8339d5[_0x9997('0x3c')]=_[_0x9997('0x3d')](_0x8339d5[_0x9997('0x39')],_0x8339d5[_0x9997('0x3a')]);_0xcfcb40[_0x9997('0x3e')]=_['intersection'](_0x8339d5[_0x9997('0x39')],qs[_0x9997('0x3f')](_0x12a78a[_0x9997('0x3a')][_0x9997('0x3f')]));_0xcfcb40[_0x9997('0x3e')]=_0xcfcb40['attributes'][_0x9997('0x40')]?_0xcfcb40[_0x9997('0x3e')]:_0x8339d5[_0x9997('0x39')];_0xcfcb40[_0x9997('0x44')]=qs[_0x9997('0x45')](_0x12a78a['query'][_0x9997('0x45')]);_0xcfcb40[_0x9997('0x46')]=qs[_0x9997('0x3c')](_[_0x9997('0x47')](_0x12a78a[_0x9997('0x3a')],_0x8339d5[_0x9997('0x3c')]));if(_0x12a78a[_0x9997('0x3a')][_0x9997('0x48')]){_0xcfcb40[_0x9997('0x46')]=_['merge'](_0xcfcb40['where'],{'$or':_['map'](_0xcfcb40['attributes'],function(_0xd6da3a){var _0x47afd3={};_0x47afd3[_0xd6da3a]={'$like':'%'+_0x12a78a['query'][_0x9997('0x48')]+'%'};return _0x47afd3;})});}_0xcfcb40=_[_0x9997('0x4a')]({},_0xcfcb40,_0x12a78a[_0x9997('0x4b')]);return _0x2e51d4['getConfigurations'](_0xcfcb40);}})[_0x9997('0x1b')](function(_0x3d87c6){if(_0x3d87c6){_0xe0d55d=_0x3d87c6[_0x9997('0x40')];if(!_0x12a78a['query'][_0x9997('0x41')](_0x9997('0x42'))){_0xcfcb40[_0x9997('0x43')]=qs['limit'](_0x12a78a[_0x9997('0x3a')][_0x9997('0x43')]);_0xcfcb40[_0x9997('0x2b')]=qs[_0x9997('0x2b')](_0x12a78a[_0x9997('0x3a')][_0x9997('0x2b')]);}return _0x2e51d4[_0x9997('0x57')](_0xcfcb40);}})['then'](function(_0x3c7004){if(_0x3c7004){return _0x3c7004?{'count':_0xe0d55d,'rows':_0x3c7004}:null;}})[_0x9997('0x1b')](respondWithResult(_0x1752a7,null))[_0x9997('0x25')](handleError(_0x1752a7,null));};exports[_0x9997('0x5a')]=function(_0x357f81,_0x5dae51,_0x58dd9e){if(_0x357f81[_0x9997('0x55')]['id']){delete _0x357f81[_0x9997('0x55')]['id'];}return db[_0x9997('0x4c')][_0x9997('0x58')]({'where':{'id':_0x357f81['params']['id']}})[_0x9997('0x1b')](handleEntityNotFound(_0x5dae51,null))[_0x9997('0x1b')](function(_0x29a872){if(_0x29a872){_0x357f81['body'][_0x9997('0x5b')]=_0x29a872['id'];_0x357f81[_0x9997('0x55')][_0x9997('0x5c')]=integrations[_0x9997('0x5d')](_0x357f81[_0x9997('0x55')][_0x9997('0x5e')],_0x357f81[_0x9997('0x55')][_0x9997('0x37')]);_0x357f81['body'][_0x9997('0x5f')]=integrations[_0x9997('0x60')](_0x357f81['body']['channel'],_0x357f81[_0x9997('0x55')][_0x9997('0x37')]);return db[_0x9997('0x59')][_0x9997('0x54')](_0x357f81[_0x9997('0x55')],{'include':[{'model':db[_0x9997('0x61')],'as':_0x9997('0x5c')},{'model':db[_0x9997('0x61')],'as':_0x9997('0x5f')}]});}return null;})['then'](respondWithResult(_0x5dae51,null))[_0x9997('0x25')](handleError(_0x5dae51,null));};exports[_0x9997('0x62')]=function(_0x3f8526,_0x1420a2,_0x2ffca2){var _0x5e2fb6=[{'name':'priority','label':_0x9997('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 _0x250d74='';return db[_0x9997('0x4c')][_0x9997('0x58')]({'where':{'id':_0x3f8526[_0x9997('0x51')]['id']},'attributes':['id',_0x9997('0x64'),'authType',_0x9997('0x65'),_0x9997('0x66'),_0x9997('0x67'),'consumerSecret',_0x9997('0x68'),_0x9997('0x69')]})[_0x9997('0x1b')](handleEntityNotFound(_0x1420a2,null))[_0x9997('0x1b')](function(_0x8fce23){if(_0x8fce23){_0x250d74=_0x8fce23[_0x9997('0x64')];var _0xe75570=_0x250d74[_0x9997('0x6a')](-0x1);if(_0xe75570==='/'){_0x250d74=_0x250d74[_0x9997('0x6b')](0x0,_0x250d74['lastIndexOf'](_0xe75570));}var _0x186e83={'method':_0x9997('0x6c'),'uri':util['format'](_0x9997('0x6d'),_0x250d74),'headers':{'Content-Type':_0x9997('0x6e'),'Accept':_0x9997('0x6e')},'json':!![]};if(_0x8fce23[_0x9997('0x6f')]===_0x9997('0x70')){_0x186e83[_0x9997('0x71')]['Authorization']=util[_0x9997('0x72')](_0x9997('0x73'),new Buffer(util[_0x9997('0x72')](_0x9997('0x74'),_0x8fce23['username'],_0x8fce23[_0x9997('0x66')]))[_0x9997('0x75')](_0x9997('0x76')));}return rp(_0x186e83)[_0x9997('0x1b')](function(_0x1bd774){return _0x5e2fb6['concat'](_[_0x9997('0x35')](_0x1bd774[_0x9997('0x77')][_0x9997('0x78')],function(_0x132f4d){return{'id':_0x132f4d[_0x9997('0x32')],'name':_0x132f4d[_0x9997('0x32')],'type':_0x132f4d['type'],'active':_0x132f4d['active'],'label':_0x132f4d['label'],'custom':!![]};}));});}})['then'](function(_0x53cd08){return{'count':_0x53cd08['length'],'rows':_0x53cd08};})[_0x9997('0x1b')](respondWithResult(_0x1420a2,null))[_0x9997('0x25')](function(_0x3903fd){var _0x40bf11=_0x3f8526['query']['test']?0x1f4:_0x3903fd[_0x9997('0x79')]||0x1f4;logger[_0x9997('0x22')](_0x9997('0x7a'),'getFields',_0x40bf11,JSON[_0x9997('0x21')](_0x3903fd));delete _0x3903fd['name'];if(_0x40bf11===0x191){_0x40bf11=0x190;}_0x1420a2[_0x9997('0x27')](_0x40bf11)[_0x9997('0x33')](_0x3f8526[_0x9997('0x3a')][_0x9997('0x7b')]?{'message':_0x9997('0x7c'),'statusCode':_0x3903fd[_0x9997('0x79')]}:_0x3903fd);});}; \ No newline at end of file +var _0x9a15=['fields','attributes','length','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','show','params','keys','include','find','create','body','findOne','DeskConfiguration','nolimit','getConfigurations','addConfiguration','getSubjects','channel','type','Descriptions','getDescriptions','DeskField','Subjects','getFields','priority','authType','username','password','consumerSecret','token','remoteUri','substring','lastIndexOf','format','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','entries','active','label','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','end','json','offset','limit','reject','destroy','sendStatus','stack','name','send','map','DeskAccount','rawAttributes','fieldName','key','model','query','intersection'];(function(_0x4571a2,_0x34ed8f){var _0x34fd63=function(_0x262f8d){while(--_0x262f8d){_0x4571a2['push'](_0x4571a2['shift']());}};_0x34fd63(++_0x34ed8f);}(_0x9a15,0x12d));var _0x59a1=function(_0x33b153,_0x1438e3){_0x33b153=_0x33b153-0x0;var _0x4970a1=_0x9a15[_0x33b153];return _0x4970a1;};'use strict';var pdf=require(_0x59a1('0x0'));var emlformat=require(_0x59a1('0x1'));var rimraf=require(_0x59a1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x59a1('0x3'));var rp=require(_0x59a1('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x59a1('0x5'));var util=require('util');var path=require(_0x59a1('0x6'));var sox=require(_0x59a1('0x7'));var csv=require(_0x59a1('0x8'));var ejs=require(_0x59a1('0x9'));var fs=require('fs');var _=require(_0x59a1('0xa'));var squel=require(_0x59a1('0xb'));var crypto=require('crypto');var jsforce=require(_0x59a1('0xc'));var deskjs=require(_0x59a1('0xd'));var toCsv=require(_0x59a1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x59a1('0xe'));var authService=require(_0x59a1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x59a1('0x10'));var hardwareService=require(_0x59a1('0x11'));var logger=require(_0x59a1('0x12'))(_0x59a1('0x13'));var utils=require('../../config/utils');var config=require(_0x59a1('0x14'));var db=require(_0x59a1('0x15'))['db'];var integrations=require(_0x59a1('0x16'));var jayson=require(_0x59a1('0x17'));var client=jayson[_0x59a1('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x3a15ff,_0x14f1b0,_0x3cdb0e){if(_0x3cdb0e){var _0x3b58b0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3b58b0[_0x59a1('0x19')](_0x14f1b0)){return _0x3a15ff;}else{throw new db[(_0x59a1('0x1a'))][(_0x59a1('0x1b'))](_0x59a1('0x1c'));}}else{return _0x3a15ff;}}function respondWithRpcPromise(_0x335273,_0x2280f7,_0x3af626,_0x3479e9){return new BPromise(function(_0x4df066,_0x5ef97b){var _0x54e140=_0x3479e9||client;return _0x54e140['request'](_0x335273,_0x3af626)[_0x59a1('0x1d')](function(_0x2be250){logger[_0x59a1('0x1e')](_0x59a1('0x1f'),_0x2280f7,'request\x20sent');logger[_0x59a1('0x20')](_0x59a1('0x21'),_0x2280f7,_0x59a1('0x22'),JSON[_0x59a1('0x23')](_0x2be250));if(_0x2be250['error']){if(_0x2be250[_0x59a1('0x24')]['code']===0x1f4){logger[_0x59a1('0x24')](_0x59a1('0x1f'),_0x2280f7,_0x2be250[_0x59a1('0x24')][_0x59a1('0x25')]);return _0x5ef97b(_0x2be250[_0x59a1('0x24')][_0x59a1('0x25')]);}logger[_0x59a1('0x24')](_0x59a1('0x1f'),_0x2280f7,_0x2be250[_0x59a1('0x24')][_0x59a1('0x25')]);return _0x4df066(_0x2be250[_0x59a1('0x24')][_0x59a1('0x25')]);}else{logger[_0x59a1('0x1e')]('DeskAccount,\x20%s,\x20%s',_0x2280f7,_0x59a1('0x22'));_0x4df066(_0x2be250[_0x59a1('0x26')][_0x59a1('0x25')]);}})[_0x59a1('0x27')](function(_0x3bcf44){logger['error'](_0x59a1('0x1f'),_0x2280f7,_0x3bcf44);_0x5ef97b(_0x3bcf44);});});}function respondWithStatusCode(_0x481d1a,_0x6c7b36){_0x6c7b36=_0x6c7b36||0xcc;return function(_0x5af60e){if(_0x5af60e){return _0x481d1a['sendStatus'](_0x6c7b36);}return _0x481d1a[_0x59a1('0x28')](_0x6c7b36)[_0x59a1('0x29')]();};}function respondWithResult(_0x5874ea,_0x4f5680){_0x4f5680=_0x4f5680||0xc8;return function(_0x5e318e){if(_0x5e318e){return _0x5874ea[_0x59a1('0x28')](_0x4f5680)[_0x59a1('0x2a')](_0x5e318e);}};}function respondWithFilteredResult(_0x4ee297,_0x265f08){return function(_0x2f0fa9){if(_0x2f0fa9){var _0x3f0eab=_0x2f0fa9['count'],_0x92a354=_0x265f08[_0x59a1('0x2b')],_0x4b049f=_0x265f08[_0x59a1('0x2b')]+_0x265f08[_0x59a1('0x2c')],_0x572df9;if(_0x4b049f>=_0x3f0eab){_0x4b049f=_0x3f0eab;_0x572df9=0xc8;}else{_0x572df9=0xce;}_0x4ee297[_0x59a1('0x28')](_0x572df9);return _0x4ee297['set']('Content-Range',_0x92a354+'-'+_0x4b049f+'/'+_0x3f0eab)[_0x59a1('0x2a')](_0x2f0fa9);}return null;};}function patchUpdates(_0x419fcf){return function(_0x5d3209){try{jsonpatch['apply'](_0x5d3209,_0x419fcf,!![]);}catch(_0x56efe0){return BPromise[_0x59a1('0x2d')](_0x56efe0);}return _0x5d3209['save']();};}function saveUpdates(_0xefc7e2,_0x3af8ee){return function(_0x408391){if(_0x408391){return _0x408391['update'](_0xefc7e2)[_0x59a1('0x1d')](function(_0x14c54c){return _0x14c54c;});}return null;};}function removeEntity(_0x18263b,_0x3aa950){return function(_0x196335){if(_0x196335){return _0x196335[_0x59a1('0x2e')]()[_0x59a1('0x1d')](function(){_0x18263b[_0x59a1('0x28')](0xcc)[_0x59a1('0x29')]();});}};}function handleEntityNotFound(_0x44b9de,_0x4e0ef7){return function(_0x1a4ce8){if(!_0x1a4ce8){_0x44b9de[_0x59a1('0x2f')](0x194);}return _0x1a4ce8;};}function handleError(_0x55b821,_0x632bcc){_0x632bcc=_0x632bcc||0x1f4;return function(_0x10498b){logger[_0x59a1('0x24')](_0x10498b[_0x59a1('0x30')]);if(_0x10498b['name']){delete _0x10498b[_0x59a1('0x31')];}_0x55b821[_0x59a1('0x28')](_0x632bcc)[_0x59a1('0x32')](_0x10498b);};}exports['index']=function(_0x3c0a2f,_0x46cef5){var _0x4d7d6b={},_0x10be6e={},_0x521c56={'count':0x0,'rows':[]};var _0x30cd65=_[_0x59a1('0x33')](db[_0x59a1('0x34')][_0x59a1('0x35')],function(_0x122979){return{'name':_0x122979[_0x59a1('0x36')],'type':_0x122979['type'][_0x59a1('0x37')]};});_0x10be6e[_0x59a1('0x38')]=_['map'](_0x30cd65,_0x59a1('0x31'));_0x10be6e['query']=_['keys'](_0x3c0a2f[_0x59a1('0x39')]);_0x10be6e['filters']=_['intersection'](_0x10be6e[_0x59a1('0x38')],_0x10be6e[_0x59a1('0x39')]);_0x4d7d6b['attributes']=_[_0x59a1('0x3a')](_0x10be6e[_0x59a1('0x38')],qs['fields'](_0x3c0a2f[_0x59a1('0x39')][_0x59a1('0x3b')]));_0x4d7d6b[_0x59a1('0x3c')]=_0x4d7d6b[_0x59a1('0x3c')][_0x59a1('0x3d')]?_0x4d7d6b[_0x59a1('0x3c')]:_0x10be6e[_0x59a1('0x38')];if(!_0x3c0a2f[_0x59a1('0x39')][_0x59a1('0x3e')]('nolimit')){_0x4d7d6b[_0x59a1('0x2c')]=qs[_0x59a1('0x2c')](_0x3c0a2f[_0x59a1('0x39')][_0x59a1('0x2c')]);_0x4d7d6b['offset']=qs[_0x59a1('0x2b')](_0x3c0a2f[_0x59a1('0x39')]['offset']);}_0x4d7d6b[_0x59a1('0x3f')]=qs[_0x59a1('0x40')](_0x3c0a2f[_0x59a1('0x39')][_0x59a1('0x40')]);_0x4d7d6b['where']=qs[_0x59a1('0x41')](_[_0x59a1('0x42')](_0x3c0a2f[_0x59a1('0x39')],_0x10be6e[_0x59a1('0x41')]));if(_0x3c0a2f[_0x59a1('0x39')]['filter']){_0x4d7d6b[_0x59a1('0x43')]=_[_0x59a1('0x44')](_0x4d7d6b[_0x59a1('0x43')],{'$or':_['map'](_0x30cd65,function(_0x2893c8){if(_0x2893c8['type']!==_0x59a1('0x45')){var _0x488e5f={};_0x488e5f[_0x2893c8[_0x59a1('0x31')]]={'$like':'%'+_0x3c0a2f[_0x59a1('0x39')][_0x59a1('0x46')]+'%'};return _0x488e5f;}})});}_0x4d7d6b=_[_0x59a1('0x44')]({},_0x4d7d6b,_0x3c0a2f[_0x59a1('0x47')]);var _0x515157={'where':_0x4d7d6b[_0x59a1('0x43')]};return db[_0x59a1('0x34')]['count'](_0x515157)[_0x59a1('0x1d')](function(_0x5244d4){_0x521c56[_0x59a1('0x48')]=_0x5244d4;if(_0x3c0a2f[_0x59a1('0x39')][_0x59a1('0x49')]){_0x4d7d6b['include']=[{'all':!![]}];}return db[_0x59a1('0x34')][_0x59a1('0x4a')](_0x4d7d6b);})[_0x59a1('0x1d')](function(_0xf55444){_0x521c56[_0x59a1('0x4b')]=_0xf55444;return _0x521c56;})[_0x59a1('0x1d')](respondWithFilteredResult(_0x46cef5,_0x4d7d6b))[_0x59a1('0x27')](handleError(_0x46cef5,null));};exports[_0x59a1('0x4c')]=function(_0x75ec77,_0x55ed0b){var _0x5f51f0={'raw':![],'where':{'id':_0x75ec77[_0x59a1('0x4d')]['id']}},_0x498bc0={};_0x498bc0[_0x59a1('0x38')]=_[_0x59a1('0x4e')](db[_0x59a1('0x34')][_0x59a1('0x35')]);_0x498bc0[_0x59a1('0x39')]=_[_0x59a1('0x4e')](_0x75ec77['query']);_0x498bc0['filters']=_['intersection'](_0x498bc0[_0x59a1('0x38')],_0x498bc0[_0x59a1('0x39')]);_0x5f51f0[_0x59a1('0x3c')]=_['intersection'](_0x498bc0[_0x59a1('0x38')],qs[_0x59a1('0x3b')](_0x75ec77['query'][_0x59a1('0x3b')]));_0x5f51f0['attributes']=_0x5f51f0['attributes']['length']?_0x5f51f0['attributes']:_0x498bc0[_0x59a1('0x38')];if(_0x75ec77['query'][_0x59a1('0x49')]){_0x5f51f0[_0x59a1('0x4f')]=[{'all':!![]}];}_0x5f51f0=_['merge']({},_0x5f51f0,_0x75ec77[_0x59a1('0x47')]);return db[_0x59a1('0x34')][_0x59a1('0x50')](_0x5f51f0)[_0x59a1('0x1d')](handleEntityNotFound(_0x55ed0b,null))[_0x59a1('0x1d')](respondWithResult(_0x55ed0b,null))['catch'](handleError(_0x55ed0b,null));};exports[_0x59a1('0x51')]=function(_0x190330,_0x283e7f){return db[_0x59a1('0x34')][_0x59a1('0x51')](_0x190330['body'],{})[_0x59a1('0x1d')](respondWithResult(_0x283e7f,0xc9))[_0x59a1('0x27')](handleError(_0x283e7f,null));};exports['update']=function(_0x4c5e6f,_0x17fc8f){if(_0x4c5e6f['body']['id']){delete _0x4c5e6f['body']['id'];}return db[_0x59a1('0x34')][_0x59a1('0x50')]({'where':{'id':_0x4c5e6f[_0x59a1('0x4d')]['id']}})[_0x59a1('0x1d')](handleEntityNotFound(_0x17fc8f,null))['then'](saveUpdates(_0x4c5e6f[_0x59a1('0x52')],null))[_0x59a1('0x1d')](respondWithResult(_0x17fc8f,null))[_0x59a1('0x27')](handleError(_0x17fc8f,null));};exports[_0x59a1('0x2e')]=function(_0x3b4a2b,_0x4f166d){return db[_0x59a1('0x34')][_0x59a1('0x50')]({'where':{'id':_0x3b4a2b[_0x59a1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4f166d,null))['then'](removeEntity(_0x4f166d,null))['catch'](handleError(_0x4f166d,null));};exports['getConfigurations']=function(_0x576ce4,_0x369dc,_0x4aeff8){var _0x298fac={};var _0x49f3fa={};var _0x3cd1c4;var _0x1924ce;return db['DeskAccount'][_0x59a1('0x53')]({'where':{'id':_0x576ce4['params']['id']}})['then'](handleEntityNotFound(_0x369dc,null))[_0x59a1('0x1d')](function(_0x1e6ce7){if(_0x1e6ce7){_0x3cd1c4=_0x1e6ce7;_0x49f3fa[_0x59a1('0x38')]=_[_0x59a1('0x4e')](db[_0x59a1('0x54')][_0x59a1('0x35')]);_0x49f3fa[_0x59a1('0x39')]=_[_0x59a1('0x4e')](_0x576ce4[_0x59a1('0x39')]);_0x49f3fa[_0x59a1('0x41')]=_[_0x59a1('0x3a')](_0x49f3fa[_0x59a1('0x38')],_0x49f3fa['query']);_0x298fac['attributes']=_['intersection'](_0x49f3fa[_0x59a1('0x38')],qs[_0x59a1('0x3b')](_0x576ce4[_0x59a1('0x39')][_0x59a1('0x3b')]));_0x298fac[_0x59a1('0x3c')]=_0x298fac[_0x59a1('0x3c')][_0x59a1('0x3d')]?_0x298fac['attributes']:_0x49f3fa[_0x59a1('0x38')];_0x298fac[_0x59a1('0x3f')]=qs[_0x59a1('0x40')](_0x576ce4[_0x59a1('0x39')]['sort']);_0x298fac[_0x59a1('0x43')]=qs[_0x59a1('0x41')](_[_0x59a1('0x42')](_0x576ce4[_0x59a1('0x39')],_0x49f3fa[_0x59a1('0x41')]));if(_0x576ce4[_0x59a1('0x39')]['filter']){_0x298fac[_0x59a1('0x43')]=_['merge'](_0x298fac[_0x59a1('0x43')],{'$or':_[_0x59a1('0x33')](_0x298fac[_0x59a1('0x3c')],function(_0x427f0e){var _0x4d6828={};_0x4d6828[_0x427f0e]={'$like':'%'+_0x576ce4[_0x59a1('0x39')][_0x59a1('0x46')]+'%'};return _0x4d6828;})});}_0x298fac=_['merge']({},_0x298fac,_0x576ce4[_0x59a1('0x47')]);return _0x3cd1c4['getConfigurations'](_0x298fac);}})[_0x59a1('0x1d')](function(_0x155efd){if(_0x155efd){_0x1924ce=_0x155efd['length'];if(!_0x576ce4['query'][_0x59a1('0x3e')](_0x59a1('0x55'))){_0x298fac[_0x59a1('0x2c')]=qs[_0x59a1('0x2c')](_0x576ce4[_0x59a1('0x39')]['limit']);_0x298fac['offset']=qs[_0x59a1('0x2b')](_0x576ce4[_0x59a1('0x39')][_0x59a1('0x2b')]);}return _0x3cd1c4[_0x59a1('0x56')](_0x298fac);}})[_0x59a1('0x1d')](function(_0x5e7f54){if(_0x5e7f54){return _0x5e7f54?{'count':_0x1924ce,'rows':_0x5e7f54}:null;}})[_0x59a1('0x1d')](respondWithResult(_0x369dc,null))['catch'](handleError(_0x369dc,null));};exports[_0x59a1('0x57')]=function(_0x36da90,_0x13450d,_0x271268){if(_0x36da90[_0x59a1('0x52')]['id']){delete _0x36da90[_0x59a1('0x52')]['id'];}return db[_0x59a1('0x34')][_0x59a1('0x53')]({'where':{'id':_0x36da90[_0x59a1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x13450d,null))[_0x59a1('0x1d')](function(_0x2f9df8){if(_0x2f9df8){_0x36da90[_0x59a1('0x52')]['AccountId']=_0x2f9df8['id'];_0x36da90[_0x59a1('0x52')]['Subjects']=integrations[_0x59a1('0x58')](_0x36da90[_0x59a1('0x52')][_0x59a1('0x59')],_0x36da90['body'][_0x59a1('0x5a')]);_0x36da90['body'][_0x59a1('0x5b')]=integrations[_0x59a1('0x5c')](_0x36da90[_0x59a1('0x52')][_0x59a1('0x59')],_0x36da90[_0x59a1('0x52')][_0x59a1('0x5a')]);return db['DeskConfiguration'][_0x59a1('0x51')](_0x36da90['body'],{'include':[{'model':db[_0x59a1('0x5d')],'as':_0x59a1('0x5e')},{'model':db[_0x59a1('0x5d')],'as':_0x59a1('0x5b')}]});}return null;})['then'](respondWithResult(_0x13450d,null))[_0x59a1('0x27')](handleError(_0x13450d,null));};exports[_0x59a1('0x5f')]=function(_0x483818,_0x1cb11b,_0xf2db34){var _0x437c53=[{'name':_0x59a1('0x60'),'label':_0x59a1('0x60'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x55cf80='';return db['DeskAccount'][_0x59a1('0x53')]({'where':{'id':_0x483818[_0x59a1('0x4d')]['id']},'attributes':['id','remoteUri',_0x59a1('0x61'),_0x59a1('0x62'),_0x59a1('0x63'),'consumerKey',_0x59a1('0x64'),_0x59a1('0x65'),'tokenSecret']})[_0x59a1('0x1d')](handleEntityNotFound(_0x1cb11b,null))[_0x59a1('0x1d')](function(_0x284e95){if(_0x284e95){_0x55cf80=_0x284e95[_0x59a1('0x66')];var _0x1008f9=_0x55cf80['slice'](-0x1);if(_0x1008f9==='/'){_0x55cf80=_0x55cf80[_0x59a1('0x67')](0x0,_0x55cf80[_0x59a1('0x68')](_0x1008f9));}var _0x39e480={'method':'GET','uri':util[_0x59a1('0x69')]('%s/custom_fields',_0x55cf80),'headers':{'Content-Type':_0x59a1('0x6a'),'Accept':_0x59a1('0x6a')},'json':!![]};if(_0x284e95[_0x59a1('0x61')]===_0x59a1('0x6b')){_0x39e480[_0x59a1('0x6c')][_0x59a1('0x6d')]=util[_0x59a1('0x69')](_0x59a1('0x6e'),new Buffer(util[_0x59a1('0x69')](_0x59a1('0x6f'),_0x284e95[_0x59a1('0x62')],_0x284e95[_0x59a1('0x63')]))[_0x59a1('0x70')](_0x59a1('0x71')));}return rp(_0x39e480)[_0x59a1('0x1d')](function(_0x3253c7){return _0x437c53[_0x59a1('0x72')](_['map'](_0x3253c7['_embedded'][_0x59a1('0x73')],function(_0x450d6c){return{'id':_0x450d6c[_0x59a1('0x31')],'name':_0x450d6c[_0x59a1('0x31')],'type':_0x450d6c[_0x59a1('0x5a')],'active':_0x450d6c[_0x59a1('0x74')],'label':_0x450d6c[_0x59a1('0x75')],'custom':!![]};}));});}})[_0x59a1('0x1d')](function(_0xdd350a){return{'count':_0xdd350a[_0x59a1('0x3d')],'rows':_0xdd350a};})[_0x59a1('0x1d')](respondWithResult(_0x1cb11b,null))['catch'](function(_0x47747c){var _0x19e2c3=_0x483818[_0x59a1('0x39')][_0x59a1('0x19')]?0x1f4:_0x47747c['statusCode']||0x1f4;logger[_0x59a1('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x59a1('0x5f'),_0x19e2c3,JSON['stringify'](_0x47747c));delete _0x47747c['name'];if(_0x19e2c3===0x191){_0x19e2c3=0x190;}_0x1cb11b['status'](_0x19e2c3)[_0x59a1('0x32')](_0x483818[_0x59a1('0x39')]['test']?{'message':_0x59a1('0x76'),'statusCode':_0x47747c[_0x59a1('0x77')]}:_0x47747c);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index b56eea9..9a5bfe4 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 _0x9257=['exports','define','int_desk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x9257,0x162));var _0x7925=function(_0x1875c8,_0x4e5f7a){_0x1875c8=_0x1875c8-0x0;var _0x28ed91=_0x9257[_0x1875c8];return _0x28ed91;};'use strict';var _=require(_0x7925('0x0'));var util=require('util');var logger=require(_0x7925('0x1'))(_0x7925('0x2'));var moment=require(_0x7925('0x3'));var BPromise=require(_0x7925('0x4'));var rp=require(_0x7925('0x5'));var fs=require('fs');var path=require(_0x7925('0x6'));var rimraf=require(_0x7925('0x7'));var config=require(_0x7925('0x8'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x7925('0x9'));module[_0x7925('0xa')]=function(_0x424203,_0x325b2b){return _0x424203[_0x7925('0xb')]('DeskAccount',attributes,{'tableName':_0x7925('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1a6=['bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','lodash','util','../../config/logger','moment'];(function(_0xd10b2e,_0x2beb81){var _0x242daf=function(_0x35806c){while(--_0x35806c){_0xd10b2e['push'](_0xd10b2e['shift']());}};_0x242daf(++_0x2beb81);}(_0xc1a6,0xa5));var _0x6c1a=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xc1a6[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0x6c1a('0x0'));var util=require(_0x6c1a('0x1'));var logger=require(_0x6c1a('0x2'))('api');var moment=require(_0x6c1a('0x3'));var BPromise=require(_0x6c1a('0x4'));var rp=require(_0x6c1a('0x5'));var fs=require('fs');var path=require(_0x6c1a('0x6'));var rimraf=require(_0x6c1a('0x7'));var config=require(_0x6c1a('0x8'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x6c1a('0x9'));module[_0x6c1a('0xa')]=function(_0x1d8e34,_0x554670){return _0x1d8e34[_0x6c1a('0xb')](_0x6c1a('0xc'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 3ce5458..e6356e4 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 _0x1d28=['request\x20sent','stringify','error','code','message','info','result','GetDeskAccount','findAll','options','raw','where','attributes','include','map','model','then','catch','ShowDeskAccount','DeskAccount','find','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x35a0fe,_0x345546){var _0x2381f9=function(_0x532baf){while(--_0x532baf){_0x35a0fe['push'](_0x35a0fe['shift']());}};_0x2381f9(++_0x345546);}(_0x1d28,0x103));var _0x81d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d28[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x81d2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x81d2('0x1'));var rs=require(_0x81d2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81d2('0x3'))['db'];var utils=require(_0x81d2('0x4'));var logger=require(_0x81d2('0x5'))(_0x81d2('0x6'));var config=require(_0x81d2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x81d2('0x8')][_0x81d2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4eb83f,_0x2452d6,_0x3e71e6){return new BPromise(function(_0x113214,_0x2b9af7){return client['request'](_0x4eb83f,_0x3e71e6)['then'](function(_0x53e835){logger['info'](_0x81d2('0xa'),_0x2452d6,'request\x20sent');logger[_0x81d2('0xb')](_0x81d2('0xc'),_0x2452d6,_0x81d2('0xd'),JSON[_0x81d2('0xe')](_0x53e835));if(_0x53e835[_0x81d2('0xf')]){if(_0x53e835[_0x81d2('0xf')][_0x81d2('0x10')]===0x1f4){logger[_0x81d2('0xf')](_0x81d2('0xa'),_0x2452d6,_0x53e835[_0x81d2('0xf')]['message']);return _0x2b9af7(_0x53e835[_0x81d2('0xf')][_0x81d2('0x11')]);}logger[_0x81d2('0xf')](_0x81d2('0xa'),_0x2452d6,_0x53e835[_0x81d2('0xf')][_0x81d2('0x11')]);return _0x113214(_0x53e835[_0x81d2('0xf')]['message']);}else{logger[_0x81d2('0x12')](_0x81d2('0xa'),_0x2452d6,_0x81d2('0xd'));_0x113214(_0x53e835[_0x81d2('0x13')][_0x81d2('0x11')]);}})['catch'](function(_0x1344d5){logger[_0x81d2('0xf')]('DeskAccount,\x20%s,\x20%s',_0x2452d6,_0x1344d5);_0x2b9af7(_0x1344d5);});});}exports[_0x81d2('0x14')]=function(_0x3cc051){var _0x2efb8a=this;return new Promise(function(_0x5b3c14,_0x925a2a){return db['DeskAccount'][_0x81d2('0x15')]({'raw':_0x3cc051['options']?_0x3cc051[_0x81d2('0x16')][_0x81d2('0x17')]===undefined?!![]:![]:!![],'where':_0x3cc051[_0x81d2('0x16')]?_0x3cc051['options'][_0x81d2('0x18')]||null:null,'attributes':_0x3cc051['options']?_0x3cc051['options'][_0x81d2('0x19')]||null:null,'limit':_0x3cc051[_0x81d2('0x16')]?_0x3cc051[_0x81d2('0x16')]['limit']||null:null,'include':_0x3cc051[_0x81d2('0x16')]?_0x3cc051['options'][_0x81d2('0x1a')]?_[_0x81d2('0x1b')](_0x3cc051[_0x81d2('0x16')]['include'],function(_0x41177c){return{'model':db[_0x41177c[_0x81d2('0x1c')]],'as':_0x41177c['as'],'attributes':_0x41177c[_0x81d2('0x19')],'include':_0x41177c[_0x81d2('0x1a')]?_[_0x81d2('0x1b')](_0x41177c[_0x81d2('0x1a')],function(_0x4552a7){return{'model':db[_0x4552a7['model']],'as':_0x4552a7['as'],'attributes':_0x4552a7[_0x81d2('0x19')],'include':_0x4552a7['include']?_[_0x81d2('0x1b')](_0x4552a7[_0x81d2('0x1a')],function(_0x4b9d07){return{'model':db[_0x4b9d07[_0x81d2('0x1c')]],'as':_0x4b9d07['as'],'attributes':_0x4b9d07[_0x81d2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x81d2('0x1d')](function(_0x1d28a3){logger['info'](_0x81d2('0x14'),_0x3cc051);logger[_0x81d2('0xb')](_0x81d2('0x14'),_0x3cc051,JSON['stringify'](_0x1d28a3));_0x5b3c14(_0x1d28a3);})[_0x81d2('0x1e')](function(_0x4f99a3){logger[_0x81d2('0xf')]('GetDeskAccount',_0x4f99a3[_0x81d2('0x11')],_0x3cc051);_0x925a2a(_0x2efb8a[_0x81d2('0xf')](0x1f4,_0x4f99a3[_0x81d2('0x11')]));});});};exports[_0x81d2('0x1f')]=function(_0x2e30c6){var _0x3857d0=this;return new Promise(function(_0xeb8035,_0x336d39){return db[_0x81d2('0x20')][_0x81d2('0x21')]({'raw':_0x2e30c6[_0x81d2('0x16')]?_0x2e30c6[_0x81d2('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2e30c6[_0x81d2('0x16')]?_0x2e30c6[_0x81d2('0x16')][_0x81d2('0x18')]||null:null,'attributes':_0x2e30c6[_0x81d2('0x16')]?_0x2e30c6['options'][_0x81d2('0x19')]||null:null,'include':_0x2e30c6['options']?_0x2e30c6[_0x81d2('0x16')][_0x81d2('0x1a')]?_[_0x81d2('0x1b')](_0x2e30c6[_0x81d2('0x16')][_0x81d2('0x1a')],function(_0x3a909a){return{'model':db[_0x3a909a[_0x81d2('0x1c')]],'as':_0x3a909a['as'],'attributes':_0x3a909a['attributes'],'include':_0x3a909a[_0x81d2('0x1a')]?_[_0x81d2('0x1b')](_0x3a909a[_0x81d2('0x1a')],function(_0x31df60){return{'model':db[_0x31df60['model']],'as':_0x31df60['as'],'attributes':_0x31df60[_0x81d2('0x19')],'include':_0x31df60['include']?_[_0x81d2('0x1b')](_0x31df60['include'],function(_0x2cfbca){return{'model':db[_0x2cfbca['model']],'as':_0x2cfbca['as'],'attributes':_0x2cfbca[_0x81d2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x81d2('0x1d')](function(_0x49b94d){logger[_0x81d2('0x12')](_0x81d2('0x1f'),_0x2e30c6);logger['debug'](_0x81d2('0x1f'),_0x2e30c6,JSON[_0x81d2('0xe')](_0x49b94d));_0xeb8035(_0x49b94d);})[_0x81d2('0x1e')](function(_0x40a3ef){logger[_0x81d2('0xf')](_0x81d2('0x1f'),_0x40a3ef[_0x81d2('0x11')],_0x2e30c6);_0x336d39(_0x3857d0[_0x81d2('0xf')](0x1f4,_0x40a3ef['message']));});});}; \ No newline at end of file +var _0x90ce=['attributes','include','map','model','stringify','ShowDeskAccount','find','raw','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDeskAccount','DeskAccount','options'];(function(_0x265541,_0x3ea78a){var _0x3b7f17=function(_0x5bbbb4){while(--_0x5bbbb4){_0x265541['push'](_0x265541['shift']());}};_0x3b7f17(++_0x3ea78a);}(_0x90ce,0x144));var _0xe90c=function(_0x58965a,_0x2e71db){_0x58965a=_0x58965a-0x0;var _0x254efc=_0x90ce[_0x58965a];return _0x254efc;};'use strict';var _=require(_0xe90c('0x0'));var util=require(_0xe90c('0x1'));var moment=require('moment');var BPromise=require(_0xe90c('0x2'));var rs=require(_0xe90c('0x3'));var fs=require('fs');var Redis=require(_0xe90c('0x4'));var db=require(_0xe90c('0x5'))['db'];var utils=require(_0xe90c('0x6'));var logger=require(_0xe90c('0x7'))(_0xe90c('0x8'));var config=require(_0xe90c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe90c('0xa')][_0xe90c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58cb16,_0x4b1118,_0x5102ce){return new BPromise(function(_0x551ac6,_0x283908){return client['request'](_0x58cb16,_0x5102ce)[_0xe90c('0xc')](function(_0x3ed9a9){logger[_0xe90c('0xd')](_0xe90c('0xe'),_0x4b1118,_0xe90c('0xf'));logger[_0xe90c('0x10')](_0xe90c('0x11'),_0x4b1118,'request\x20sent',JSON['stringify'](_0x3ed9a9));if(_0x3ed9a9[_0xe90c('0x12')]){if(_0x3ed9a9['error'][_0xe90c('0x13')]===0x1f4){logger[_0xe90c('0x12')](_0xe90c('0xe'),_0x4b1118,_0x3ed9a9[_0xe90c('0x12')][_0xe90c('0x14')]);return _0x283908(_0x3ed9a9[_0xe90c('0x12')]['message']);}logger['error'](_0xe90c('0xe'),_0x4b1118,_0x3ed9a9[_0xe90c('0x12')][_0xe90c('0x14')]);return _0x551ac6(_0x3ed9a9[_0xe90c('0x12')][_0xe90c('0x14')]);}else{logger[_0xe90c('0xd')](_0xe90c('0xe'),_0x4b1118,_0xe90c('0xf'));_0x551ac6(_0x3ed9a9[_0xe90c('0x15')][_0xe90c('0x14')]);}})[_0xe90c('0x16')](function(_0x75c33){logger[_0xe90c('0x12')](_0xe90c('0xe'),_0x4b1118,_0x75c33);_0x283908(_0x75c33);});});}exports[_0xe90c('0x17')]=function(_0x3390e3){var _0x44549e=this;return new Promise(function(_0x58459e,_0x6fb1a0){return db[_0xe90c('0x18')]['findAll']({'raw':_0x3390e3['options']?_0x3390e3[_0xe90c('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3390e3[_0xe90c('0x19')]?_0x3390e3[_0xe90c('0x19')]['where']||null:null,'attributes':_0x3390e3[_0xe90c('0x19')]?_0x3390e3[_0xe90c('0x19')][_0xe90c('0x1a')]||null:null,'limit':_0x3390e3['options']?_0x3390e3[_0xe90c('0x19')]['limit']||null:null,'include':_0x3390e3['options']?_0x3390e3[_0xe90c('0x19')][_0xe90c('0x1b')]?_[_0xe90c('0x1c')](_0x3390e3[_0xe90c('0x19')][_0xe90c('0x1b')],function(_0x48ca96){return{'model':db[_0x48ca96['model']],'as':_0x48ca96['as'],'attributes':_0x48ca96[_0xe90c('0x1a')],'include':_0x48ca96['include']?_['map'](_0x48ca96[_0xe90c('0x1b')],function(_0xcd8b7e){return{'model':db[_0xcd8b7e[_0xe90c('0x1d')]],'as':_0xcd8b7e['as'],'attributes':_0xcd8b7e[_0xe90c('0x1a')],'include':_0xcd8b7e['include']?_['map'](_0xcd8b7e['include'],function(_0x5756e7){return{'model':db[_0x5756e7['model']],'as':_0x5756e7['as'],'attributes':_0x5756e7['attributes']};}):[]};}):[]};}):[]:[]})[_0xe90c('0xc')](function(_0x11faa2){logger[_0xe90c('0xd')](_0xe90c('0x17'),_0x3390e3);logger[_0xe90c('0x10')]('GetDeskAccount',_0x3390e3,JSON[_0xe90c('0x1e')](_0x11faa2));_0x58459e(_0x11faa2);})[_0xe90c('0x16')](function(_0xa5ef38){logger['error'](_0xe90c('0x17'),_0xa5ef38[_0xe90c('0x14')],_0x3390e3);_0x6fb1a0(_0x44549e[_0xe90c('0x12')](0x1f4,_0xa5ef38[_0xe90c('0x14')]));});});};exports[_0xe90c('0x1f')]=function(_0x491f){var _0x3b646b=this;return new Promise(function(_0x1391e7,_0x26090f){return db[_0xe90c('0x18')][_0xe90c('0x20')]({'raw':_0x491f[_0xe90c('0x19')]?_0x491f[_0xe90c('0x19')][_0xe90c('0x21')]===undefined?!![]:![]:!![],'where':_0x491f['options']?_0x491f['options'][_0xe90c('0x22')]||null:null,'attributes':_0x491f['options']?_0x491f[_0xe90c('0x19')][_0xe90c('0x1a')]||null:null,'include':_0x491f[_0xe90c('0x19')]?_0x491f[_0xe90c('0x19')][_0xe90c('0x1b')]?_[_0xe90c('0x1c')](_0x491f['options'][_0xe90c('0x1b')],function(_0x9eec63){return{'model':db[_0x9eec63[_0xe90c('0x1d')]],'as':_0x9eec63['as'],'attributes':_0x9eec63[_0xe90c('0x1a')],'include':_0x9eec63['include']?_[_0xe90c('0x1c')](_0x9eec63[_0xe90c('0x1b')],function(_0x264e76){return{'model':db[_0x264e76[_0xe90c('0x1d')]],'as':_0x264e76['as'],'attributes':_0x264e76[_0xe90c('0x1a')],'include':_0x264e76[_0xe90c('0x1b')]?_['map'](_0x264e76[_0xe90c('0x1b')],function(_0x306a1c){return{'model':db[_0x306a1c[_0xe90c('0x1d')]],'as':_0x306a1c['as'],'attributes':_0x306a1c[_0xe90c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe90c('0xc')](function(_0x575aa2){logger[_0xe90c('0xd')](_0xe90c('0x1f'),_0x491f);logger[_0xe90c('0x10')](_0xe90c('0x1f'),_0x491f,JSON[_0xe90c('0x1e')](_0x575aa2));_0x1391e7(_0x575aa2);})[_0xe90c('0x16')](function(_0x2c112e){logger[_0xe90c('0x12')](_0xe90c('0x1f'),_0x2c112e[_0xe90c('0x14')],_0x491f);_0x26090f(_0x3b646b[_0xe90c('0x12')](0x1f4,_0x2c112e[_0xe90c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index c439879..6905113 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 _0x8325=['index','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','setTags','update','delete','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller'];(function(_0x4497ad,_0x181957){var _0x3aebc9=function(_0x320474){while(--_0x320474){_0x4497ad['push'](_0x4497ad['shift']());}};_0x3aebc9(++_0x181957);}(_0x8325,0x1f1));var _0x5832=function(_0x3e326a,_0x4b93ab){_0x3e326a=_0x3e326a-0x0;var _0x1c64c7=_0x8325[_0x3e326a];return _0x1c64c7;};'use strict';var multer=require(_0x5832('0x0'));var util=require('util');var path=require(_0x5832('0x1'));var timeout=require('connect-timeout');var express=require(_0x5832('0x2'));var router=express['Router']();var auth=require(_0x5832('0x3'));var interaction=require(_0x5832('0x4'));var config=require(_0x5832('0x5'));var controller=require(_0x5832('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x5832('0x7')]);router[_0x5832('0x8')](_0x5832('0x9'),auth[_0x5832('0xa')](),controller[_0x5832('0xb')]);router[_0x5832('0x8')]('/:id/fields',auth[_0x5832('0xa')](),controller[_0x5832('0xc')]);router[_0x5832('0x8')](_0x5832('0xd'),auth[_0x5832('0xa')](),controller[_0x5832('0xe')]);router[_0x5832('0x8')](_0x5832('0xf'),auth[_0x5832('0xa')](),controller['getDescriptions']);router['get'](_0x5832('0x10'),auth[_0x5832('0xa')](),controller[_0x5832('0x11')]);router[_0x5832('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5832('0x12')](_0x5832('0x10'),auth[_0x5832('0xa')](),controller[_0x5832('0x13')]);router['put'](_0x5832('0x9'),auth[_0x5832('0xa')](),controller[_0x5832('0x14')]);router[_0x5832('0x15')]('/:id',auth[_0x5832('0xa')](),controller[_0x5832('0x16')]);module[_0x5832('0x17')]=router; \ No newline at end of file +var _0xb4b6=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','isAuthenticated','get','/:id','show','getFields'];(function(_0x187889,_0x1a815f){var _0x8d56eb=function(_0x2fe906){while(--_0x2fe906){_0x187889['push'](_0x187889['shift']());}};_0x8d56eb(++_0x1a815f);}(_0xb4b6,0x7e));var _0x6b4b=function(_0x42f336,_0x2c29f8){_0x42f336=_0x42f336-0x0;var _0x477f73=_0xb4b6[_0x42f336];return _0x477f73;};'use strict';var multer=require('multer');var util=require(_0x6b4b('0x0'));var path=require(_0x6b4b('0x1'));var timeout=require(_0x6b4b('0x2'));var express=require(_0x6b4b('0x3'));var router=express[_0x6b4b('0x4')]();var auth=require(_0x6b4b('0x5'));var interaction=require(_0x6b4b('0x6'));var config=require(_0x6b4b('0x7'));var controller=require(_0x6b4b('0x8'));router['get']('/',auth[_0x6b4b('0x9')](),controller['index']);router[_0x6b4b('0xa')](_0x6b4b('0xb'),auth[_0x6b4b('0x9')](),controller[_0x6b4b('0xc')]);router[_0x6b4b('0xa')]('/:id/fields',auth[_0x6b4b('0x9')](),controller[_0x6b4b('0xd')]);router[_0x6b4b('0xa')](_0x6b4b('0xe'),auth[_0x6b4b('0x9')](),controller[_0x6b4b('0xf')]);router[_0x6b4b('0xa')](_0x6b4b('0x10'),auth['isAuthenticated'](),controller[_0x6b4b('0x11')]);router['get'](_0x6b4b('0x12'),auth[_0x6b4b('0x9')](),controller[_0x6b4b('0x13')]);router[_0x6b4b('0x14')]('/',auth[_0x6b4b('0x9')](),controller[_0x6b4b('0x15')]);router[_0x6b4b('0x14')]('/:id/tags',auth[_0x6b4b('0x9')](),controller[_0x6b4b('0x16')]);router[_0x6b4b('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x6b4b('0x18')]);router[_0x6b4b('0x19')]('/:id',auth[_0x6b4b('0x9')](),controller[_0x6b4b('0x1a')]);module[_0x6b4b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 4dc55db..1b0abce 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 _0x65fc=['exports','sequelize'];(function(_0x102a99,_0x180e77){var _0x10c30f=function(_0x2f6abd){while(--_0x2f6abd){_0x102a99['push'](_0x102a99['shift']());}};_0x10c30f(++_0x180e77);}(_0x65fc,0x15f));var _0xc65f=function(_0x30ed86,_0x5b0cd1){_0x30ed86=_0x30ed86-0x0;var _0x5bcd4f=_0x65fc[_0x30ed86];return _0x5bcd4f;};'use strict';var Sequelize=require(_0xc65f('0x0'));module[_0xc65f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9638=['exports','STRING','sequelize'];(function(_0x3b5caa,_0x3adaeb){var _0x55d1c1=function(_0x1c047e){while(--_0x1c047e){_0x3b5caa['push'](_0x3b5caa['shift']());}};_0x55d1c1(++_0x3adaeb);}(_0x9638,0xef));var _0x8963=function(_0x197127,_0x48bbfd){_0x197127=_0x197127-0x0;var _0x558ca6=_0x9638[_0x197127];return _0x558ca6;};'use strict';var Sequelize=require(_0x8963('0x0'));module[_0x8963('0x1')]={'name':{'type':Sequelize[_0x8963('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index fd7d3d8..7669cc7 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 _0x73c5=['find','create','body','params','findOne','filter','getFields','getSubjects','DeskField','nolimit','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','DeskConfiguration,\x20%s,\x20%s','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','update','destroy','name','send','map','DeskConfiguration','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','options','include','findAll','show','includeAll'];(function(_0x17a32f,_0x5a51a){var _0x15a293=function(_0x55fbd3){while(--_0x55fbd3){_0x17a32f['push'](_0x17a32f['shift']());}};_0x15a293(++_0x5a51a);}(_0x73c5,0x6e));var _0x573c=function(_0x1a76f1,_0x25a5d6){_0x1a76f1=_0x1a76f1-0x0;var _0x3c78f6=_0x73c5[_0x1a76f1];return _0x3c78f6;};'use strict';var pdf=require(_0x573c('0x0'));var emlformat=require(_0x573c('0x1'));var rimraf=require(_0x573c('0x2'));var zipdir=require(_0x573c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x573c('0x4'));var moment=require(_0x573c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x573c('0x6'));var util=require(_0x573c('0x7'));var path=require('path');var sox=require(_0x573c('0x8'));var csv=require(_0x573c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x573c('0xa'));var squel=require(_0x573c('0xb'));var crypto=require(_0x573c('0xc'));var jsforce=require(_0x573c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x573c('0x9'));var querystring=require(_0x573c('0xe'));var Papa=require(_0x573c('0xf'));var Redis=require(_0x573c('0x10'));var authService=require(_0x573c('0x11'));var qs=require(_0x573c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x573c('0x13'));var logger=require(_0x573c('0x14'))(_0x573c('0x15'));var utils=require('../../config/utils');var config=require(_0x573c('0x16'));var db=require(_0x573c('0x17'))['db'];var jayson=require(_0x573c('0x18'));var client=jayson['client'][_0x573c('0x19')]({'port':0x232a});function checkPasswordPattern(_0x7c3a01,_0x168542,_0x2ce8dc){if(_0x2ce8dc){var _0x330cad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x330cad[_0x573c('0x1a')](_0x168542)){return _0x7c3a01;}else{throw new db[(_0x573c('0x1b'))][(_0x573c('0x1c'))](_0x573c('0x1d'));}}else{return _0x7c3a01;}}function respondWithRpcPromise(_0x491025,_0xf5e070,_0x312e44,_0x52a281){return new BPromise(function(_0xa6823e,_0x1ad410){var _0x2f537e=_0x52a281||client;return _0x2f537e[_0x573c('0x1e')](_0x491025,_0x312e44)[_0x573c('0x1f')](function(_0x3a2160){logger[_0x573c('0x20')](_0x573c('0x21'),_0xf5e070,'request\x20sent');logger['debug'](_0x573c('0x22'),_0xf5e070,_0x573c('0x23'),JSON[_0x573c('0x24')](_0x3a2160));if(_0x3a2160[_0x573c('0x25')]){if(_0x3a2160[_0x573c('0x25')][_0x573c('0x26')]===0x1f4){logger[_0x573c('0x25')](_0x573c('0x21'),_0xf5e070,_0x3a2160[_0x573c('0x25')][_0x573c('0x27')]);return _0x1ad410(_0x3a2160['error'][_0x573c('0x27')]);}logger['error'](_0x573c('0x21'),_0xf5e070,_0x3a2160['error'][_0x573c('0x27')]);return _0xa6823e(_0x3a2160[_0x573c('0x25')][_0x573c('0x27')]);}else{logger[_0x573c('0x20')]('DeskConfiguration,\x20%s,\x20%s',_0xf5e070,_0x573c('0x23'));_0xa6823e(_0x3a2160[_0x573c('0x28')][_0x573c('0x27')]);}})[_0x573c('0x29')](function(_0x89bffb){logger[_0x573c('0x25')]('DeskConfiguration,\x20%s,\x20%s',_0xf5e070,_0x89bffb);_0x1ad410(_0x89bffb);});});}function respondWithStatusCode(_0x1c075d,_0x369b8a){_0x369b8a=_0x369b8a||0xcc;return function(_0x2f2818){if(_0x2f2818){return _0x1c075d[_0x573c('0x2a')](_0x369b8a);}return _0x1c075d[_0x573c('0x2b')](_0x369b8a)[_0x573c('0x2c')]();};}function respondWithResult(_0x511d44,_0x4c5647){_0x4c5647=_0x4c5647||0xc8;return function(_0x68134){if(_0x68134){return _0x511d44[_0x573c('0x2b')](_0x4c5647)['json'](_0x68134);}};}function respondWithFilteredResult(_0x1efffa,_0x541891){return function(_0xb8e2b3){if(_0xb8e2b3){var _0x1b789f=_0xb8e2b3['count'],_0x1a29bc=_0x541891[_0x573c('0x2d')],_0x237a95=_0x541891['offset']+_0x541891[_0x573c('0x2e')],_0x47e0e1;if(_0x237a95>=_0x1b789f){_0x237a95=_0x1b789f;_0x47e0e1=0xc8;}else{_0x47e0e1=0xce;}_0x1efffa[_0x573c('0x2b')](_0x47e0e1);return _0x1efffa[_0x573c('0x2f')](_0x573c('0x30'),_0x1a29bc+'-'+_0x237a95+'/'+_0x1b789f)[_0x573c('0x31')](_0xb8e2b3);}return null;};}function patchUpdates(_0x41a0d1){return function(_0x372e92){try{jsonpatch['apply'](_0x372e92,_0x41a0d1,!![]);}catch(_0x296e94){return BPromise[_0x573c('0x32')](_0x296e94);}return _0x372e92['save']();};}function saveUpdates(_0x30069e,_0x542c35){return function(_0x23fd93){if(_0x23fd93){return _0x23fd93[_0x573c('0x33')](_0x30069e)['then'](function(_0x36fb93){return _0x36fb93;});}return null;};}function removeEntity(_0x25813c,_0x571ae6){return function(_0x591e10){if(_0x591e10){return _0x591e10[_0x573c('0x34')]()[_0x573c('0x1f')](function(){_0x25813c[_0x573c('0x2b')](0xcc)[_0x573c('0x2c')]();});}};}function handleEntityNotFound(_0x35c8ab,_0x2feac8){return function(_0x2af87b){if(!_0x2af87b){_0x35c8ab[_0x573c('0x2a')](0x194);}return _0x2af87b;};}function handleError(_0x5bac1e,_0x20357c){_0x20357c=_0x20357c||0x1f4;return function(_0x291dff){logger[_0x573c('0x25')](_0x291dff['stack']);if(_0x291dff[_0x573c('0x35')]){delete _0x291dff[_0x573c('0x35')];}_0x5bac1e[_0x573c('0x2b')](_0x20357c)[_0x573c('0x36')](_0x291dff);};}exports['index']=function(_0xdcd8ed,_0x29904c){var _0x4b58a8={},_0x1f5c23={},_0x72d50b={'count':0x0,'rows':[]};var _0x2322ea=_[_0x573c('0x37')](db[_0x573c('0x38')][_0x573c('0x39')],function(_0x332ef9){return{'name':_0x332ef9[_0x573c('0x3a')],'type':_0x332ef9[_0x573c('0x3b')][_0x573c('0x3c')]};});_0x1f5c23['model']=_[_0x573c('0x37')](_0x2322ea,_0x573c('0x35'));_0x1f5c23[_0x573c('0x3d')]=_[_0x573c('0x3e')](_0xdcd8ed[_0x573c('0x3d')]);_0x1f5c23['filters']=_[_0x573c('0x3f')](_0x1f5c23['model'],_0x1f5c23[_0x573c('0x3d')]);_0x4b58a8[_0x573c('0x40')]=_['intersection'](_0x1f5c23[_0x573c('0x41')],qs[_0x573c('0x42')](_0xdcd8ed['query'][_0x573c('0x42')]));_0x4b58a8[_0x573c('0x40')]=_0x4b58a8[_0x573c('0x40')][_0x573c('0x43')]?_0x4b58a8[_0x573c('0x40')]:_0x1f5c23[_0x573c('0x41')];if(!_0xdcd8ed['query'][_0x573c('0x44')]('nolimit')){_0x4b58a8[_0x573c('0x2e')]=qs[_0x573c('0x2e')](_0xdcd8ed[_0x573c('0x3d')]['limit']);_0x4b58a8[_0x573c('0x2d')]=qs[_0x573c('0x2d')](_0xdcd8ed[_0x573c('0x3d')]['offset']);}_0x4b58a8[_0x573c('0x45')]=qs[_0x573c('0x46')](_0xdcd8ed[_0x573c('0x3d')]['sort']);_0x4b58a8[_0x573c('0x47')]=qs[_0x573c('0x48')](_[_0x573c('0x49')](_0xdcd8ed[_0x573c('0x3d')],_0x1f5c23[_0x573c('0x48')]));if(_0xdcd8ed['query']['filter']){_0x4b58a8[_0x573c('0x47')]=_[_0x573c('0x4a')](_0x4b58a8['where'],{'$or':_['map'](_0x2322ea,function(_0x56d557){if(_0x56d557['type']!=='VIRTUAL'){var _0x15fb6c={};_0x15fb6c[_0x56d557['name']]={'$like':'%'+_0xdcd8ed[_0x573c('0x3d')]['filter']+'%'};return _0x15fb6c;}})});}_0x4b58a8=_['merge']({},_0x4b58a8,_0xdcd8ed[_0x573c('0x4b')]);var _0x5cbf78={'where':_0x4b58a8[_0x573c('0x47')]};return db[_0x573c('0x38')]['count'](_0x5cbf78)[_0x573c('0x1f')](function(_0x164ca9){_0x72d50b['count']=_0x164ca9;if(_0xdcd8ed[_0x573c('0x3d')]['includeAll']){_0x4b58a8[_0x573c('0x4c')]=[{'all':!![]}];}return db[_0x573c('0x38')][_0x573c('0x4d')](_0x4b58a8);})[_0x573c('0x1f')](function(_0x101378){_0x72d50b['rows']=_0x101378;return _0x72d50b;})[_0x573c('0x1f')](respondWithFilteredResult(_0x29904c,_0x4b58a8))[_0x573c('0x29')](handleError(_0x29904c,null));};exports[_0x573c('0x4e')]=function(_0x316042,_0x25b8f3){var _0x5a7252={'raw':![],'where':{'id':_0x316042['params']['id']}},_0x1bf00d={};_0x1bf00d[_0x573c('0x41')]=_[_0x573c('0x3e')](db[_0x573c('0x38')]['rawAttributes']);_0x1bf00d[_0x573c('0x3d')]=_[_0x573c('0x3e')](_0x316042['query']);_0x1bf00d['filters']=_[_0x573c('0x3f')](_0x1bf00d[_0x573c('0x41')],_0x1bf00d[_0x573c('0x3d')]);_0x5a7252[_0x573c('0x40')]=_[_0x573c('0x3f')](_0x1bf00d['model'],qs[_0x573c('0x42')](_0x316042[_0x573c('0x3d')][_0x573c('0x42')]));_0x5a7252[_0x573c('0x40')]=_0x5a7252[_0x573c('0x40')][_0x573c('0x43')]?_0x5a7252[_0x573c('0x40')]:_0x1bf00d[_0x573c('0x41')];if(_0x316042[_0x573c('0x3d')][_0x573c('0x4f')]){_0x5a7252[_0x573c('0x4c')]=[{'all':!![]}];}_0x5a7252=_[_0x573c('0x4a')]({},_0x5a7252,_0x316042['options']);return db[_0x573c('0x38')][_0x573c('0x50')](_0x5a7252)['then'](handleEntityNotFound(_0x25b8f3,null))['then'](respondWithResult(_0x25b8f3,null))[_0x573c('0x29')](handleError(_0x25b8f3,null));};exports[_0x573c('0x51')]=function(_0x51791e,_0x4547d7){return db[_0x573c('0x38')][_0x573c('0x51')](_0x51791e[_0x573c('0x52')],{})['then'](respondWithResult(_0x4547d7,0xc9))[_0x573c('0x29')](handleError(_0x4547d7,null));};exports[_0x573c('0x33')]=function(_0x14755e,_0x2ca4a5){if(_0x14755e[_0x573c('0x52')]['id']){delete _0x14755e[_0x573c('0x52')]['id'];}return db[_0x573c('0x38')][_0x573c('0x50')]({'where':{'id':_0x14755e[_0x573c('0x53')]['id']}})['then'](handleEntityNotFound(_0x2ca4a5,null))['then'](saveUpdates(_0x14755e[_0x573c('0x52')],null))[_0x573c('0x1f')](respondWithResult(_0x2ca4a5,null))[_0x573c('0x29')](handleError(_0x2ca4a5,null));};exports['destroy']=function(_0x204cb4,_0x2d9398){return db[_0x573c('0x38')][_0x573c('0x50')]({'where':{'id':_0x204cb4[_0x573c('0x53')]['id']}})['then'](handleEntityNotFound(_0x2d9398,null))['then'](removeEntity(_0x2d9398,null))['catch'](handleError(_0x2d9398,null));};exports['getFields']=function(_0x50383e,_0x6d385,_0x351aee){var _0x4b8341={};var _0x1a2adb={};var _0x24ba77;var _0x12ac80;return db[_0x573c('0x38')][_0x573c('0x54')]({'where':{'id':_0x50383e[_0x573c('0x53')]['id']}})[_0x573c('0x1f')](handleEntityNotFound(_0x6d385,null))[_0x573c('0x1f')](function(_0x4de18d){if(_0x4de18d){_0x24ba77=_0x4de18d;_0x1a2adb['model']=_[_0x573c('0x3e')](db['DeskField'][_0x573c('0x39')]);_0x1a2adb['query']=_[_0x573c('0x3e')](_0x50383e[_0x573c('0x3d')]);_0x1a2adb[_0x573c('0x48')]=_[_0x573c('0x3f')](_0x1a2adb['model'],_0x1a2adb['query']);_0x4b8341[_0x573c('0x40')]=_['intersection'](_0x1a2adb['model'],qs[_0x573c('0x42')](_0x50383e['query']['fields']));_0x4b8341[_0x573c('0x40')]=_0x4b8341[_0x573c('0x40')][_0x573c('0x43')]?_0x4b8341[_0x573c('0x40')]:_0x1a2adb[_0x573c('0x41')];_0x4b8341[_0x573c('0x45')]=qs[_0x573c('0x46')](_0x50383e[_0x573c('0x3d')][_0x573c('0x46')]);_0x4b8341['where']=qs[_0x573c('0x48')](_[_0x573c('0x49')](_0x50383e[_0x573c('0x3d')],_0x1a2adb[_0x573c('0x48')]));if(_0x50383e[_0x573c('0x3d')][_0x573c('0x55')]){_0x4b8341['where']=_[_0x573c('0x4a')](_0x4b8341[_0x573c('0x47')],{'$or':_[_0x573c('0x37')](_0x4b8341[_0x573c('0x40')],function(_0x5a9352){var _0x302312={};_0x302312[_0x5a9352]={'$like':'%'+_0x50383e[_0x573c('0x3d')][_0x573c('0x55')]+'%'};return _0x302312;})});}_0x4b8341=_['merge']({},_0x4b8341,_0x50383e[_0x573c('0x4b')]);return _0x24ba77[_0x573c('0x56')](_0x4b8341);}})[_0x573c('0x1f')](function(_0x15d720){if(_0x15d720){_0x12ac80=_0x15d720[_0x573c('0x43')];if(!_0x50383e[_0x573c('0x3d')][_0x573c('0x44')]('nolimit')){_0x4b8341[_0x573c('0x2e')]=qs[_0x573c('0x2e')](_0x50383e[_0x573c('0x3d')]['limit']);_0x4b8341[_0x573c('0x2d')]=qs['offset'](_0x50383e[_0x573c('0x3d')]['offset']);}return _0x24ba77[_0x573c('0x56')](_0x4b8341);}})['then'](function(_0x3b3a26){if(_0x3b3a26){return _0x3b3a26?{'count':_0x12ac80,'rows':_0x3b3a26}:null;}})['then'](respondWithResult(_0x6d385,null))[_0x573c('0x29')](handleError(_0x6d385,null));};exports[_0x573c('0x57')]=function(_0x1d5650,_0x58c8e3,_0x4226c8){var _0x25ca81={};var _0x2b8131={};var _0x4eecef;var _0x12109f;return db['DeskConfiguration'][_0x573c('0x54')]({'where':{'id':_0x1d5650[_0x573c('0x53')]['id']}})['then'](handleEntityNotFound(_0x58c8e3,null))[_0x573c('0x1f')](function(_0x34994a){if(_0x34994a){_0x4eecef=_0x34994a;_0x2b8131['model']=_[_0x573c('0x3e')](db[_0x573c('0x58')][_0x573c('0x39')]);_0x2b8131[_0x573c('0x3d')]=_['keys'](_0x1d5650[_0x573c('0x3d')]);_0x2b8131[_0x573c('0x48')]=_[_0x573c('0x3f')](_0x2b8131[_0x573c('0x41')],_0x2b8131[_0x573c('0x3d')]);_0x25ca81[_0x573c('0x40')]=_[_0x573c('0x3f')](_0x2b8131[_0x573c('0x41')],qs['fields'](_0x1d5650[_0x573c('0x3d')]['fields']));_0x25ca81[_0x573c('0x40')]=_0x25ca81[_0x573c('0x40')][_0x573c('0x43')]?_0x25ca81[_0x573c('0x40')]:_0x2b8131[_0x573c('0x41')];_0x25ca81[_0x573c('0x45')]=qs[_0x573c('0x46')](_0x1d5650[_0x573c('0x3d')][_0x573c('0x46')]);_0x25ca81['where']=qs[_0x573c('0x48')](_[_0x573c('0x49')](_0x1d5650[_0x573c('0x3d')],_0x2b8131[_0x573c('0x48')]));if(_0x1d5650[_0x573c('0x3d')][_0x573c('0x55')]){_0x25ca81['where']=_[_0x573c('0x4a')](_0x25ca81[_0x573c('0x47')],{'$or':_[_0x573c('0x37')](_0x25ca81[_0x573c('0x40')],function(_0x19d3b3){var _0xf6528={};_0xf6528[_0x19d3b3]={'$like':'%'+_0x1d5650[_0x573c('0x3d')]['filter']+'%'};return _0xf6528;})});}_0x25ca81=_['merge']({},_0x25ca81,_0x1d5650[_0x573c('0x4b')]);return _0x4eecef[_0x573c('0x57')](_0x25ca81);}})[_0x573c('0x1f')](function(_0x489e36){if(_0x489e36){_0x12109f=_0x489e36['length'];if(!_0x1d5650[_0x573c('0x3d')][_0x573c('0x44')](_0x573c('0x59'))){_0x25ca81[_0x573c('0x2e')]=qs[_0x573c('0x2e')](_0x1d5650[_0x573c('0x3d')][_0x573c('0x2e')]);_0x25ca81['offset']=qs[_0x573c('0x2d')](_0x1d5650[_0x573c('0x3d')][_0x573c('0x2d')]);}return _0x4eecef[_0x573c('0x57')](_0x25ca81);}})['then'](function(_0x322493){if(_0x322493){return _0x322493?{'count':_0x12109f,'rows':_0x322493}:null;}})[_0x573c('0x1f')](respondWithResult(_0x58c8e3,null))[_0x573c('0x29')](handleError(_0x58c8e3,null));};exports[_0x573c('0x5a')]=function(_0x279357,_0x5c5828,_0xfe526d){var _0x525217={};var _0xc635c5={};var _0x2f68a4;var _0x364780;return db[_0x573c('0x38')][_0x573c('0x54')]({'where':{'id':_0x279357[_0x573c('0x53')]['id']}})[_0x573c('0x1f')](handleEntityNotFound(_0x5c5828,null))['then'](function(_0x47a023){if(_0x47a023){_0x2f68a4=_0x47a023;_0xc635c5[_0x573c('0x41')]=_[_0x573c('0x3e')](db[_0x573c('0x58')][_0x573c('0x39')]);_0xc635c5[_0x573c('0x3d')]=_['keys'](_0x279357[_0x573c('0x3d')]);_0xc635c5[_0x573c('0x48')]=_[_0x573c('0x3f')](_0xc635c5[_0x573c('0x41')],_0xc635c5[_0x573c('0x3d')]);_0x525217['attributes']=_[_0x573c('0x3f')](_0xc635c5[_0x573c('0x41')],qs[_0x573c('0x42')](_0x279357[_0x573c('0x3d')][_0x573c('0x42')]));_0x525217[_0x573c('0x40')]=_0x525217[_0x573c('0x40')]['length']?_0x525217[_0x573c('0x40')]:_0xc635c5['model'];_0x525217['order']=qs[_0x573c('0x46')](_0x279357[_0x573c('0x3d')]['sort']);_0x525217[_0x573c('0x47')]=qs['filters'](_[_0x573c('0x49')](_0x279357[_0x573c('0x3d')],_0xc635c5[_0x573c('0x48')]));if(_0x279357[_0x573c('0x3d')][_0x573c('0x55')]){_0x525217[_0x573c('0x47')]=_[_0x573c('0x4a')](_0x525217['where'],{'$or':_[_0x573c('0x37')](_0x525217[_0x573c('0x40')],function(_0x1adc3b){var _0x5d9d6d={};_0x5d9d6d[_0x1adc3b]={'$like':'%'+_0x279357[_0x573c('0x3d')][_0x573c('0x55')]+'%'};return _0x5d9d6d;})});}_0x525217=_[_0x573c('0x4a')]({},_0x525217,_0x279357[_0x573c('0x4b')]);return _0x2f68a4[_0x573c('0x5a')](_0x525217);}})[_0x573c('0x1f')](function(_0x2e63cb){if(_0x2e63cb){_0x364780=_0x2e63cb[_0x573c('0x43')];if(!_0x279357[_0x573c('0x3d')][_0x573c('0x44')]('nolimit')){_0x525217['limit']=qs[_0x573c('0x2e')](_0x279357[_0x573c('0x3d')][_0x573c('0x2e')]);_0x525217[_0x573c('0x2d')]=qs[_0x573c('0x2d')](_0x279357[_0x573c('0x3d')][_0x573c('0x2d')]);}return _0x2f68a4[_0x573c('0x5a')](_0x525217);}})[_0x573c('0x1f')](function(_0x2dd2dc){if(_0x2dd2dc){return _0x2dd2dc?{'count':_0x364780,'rows':_0x2dd2dc}:null;}})[_0x573c('0x1f')](respondWithResult(_0x5c5828,null))[_0x573c('0x29')](handleError(_0x5c5828,null));};exports[_0x573c('0x5b')]=function(_0x17362c,_0x1aec1b,_0x127292){var _0x283f04={};var _0x261614={};var _0x47343e;var _0xd5380c;return db[_0x573c('0x38')][_0x573c('0x54')]({'where':{'id':_0x17362c[_0x573c('0x53')]['id']}})['then'](handleEntityNotFound(_0x1aec1b,null))[_0x573c('0x1f')](function(_0x36d0a6){if(_0x36d0a6){_0x47343e=_0x36d0a6;_0x261614[_0x573c('0x41')]=_[_0x573c('0x3e')](db[_0x573c('0x5c')][_0x573c('0x39')]);_0x261614[_0x573c('0x3d')]=_[_0x573c('0x3e')](_0x17362c[_0x573c('0x3d')]);_0x261614['filters']=_[_0x573c('0x3f')](_0x261614[_0x573c('0x41')],_0x261614[_0x573c('0x3d')]);_0x283f04[_0x573c('0x40')]=_[_0x573c('0x3f')](_0x261614[_0x573c('0x41')],qs[_0x573c('0x42')](_0x17362c[_0x573c('0x3d')][_0x573c('0x42')]));_0x283f04['attributes']=_0x283f04[_0x573c('0x40')][_0x573c('0x43')]?_0x283f04[_0x573c('0x40')]:_0x261614[_0x573c('0x41')];_0x283f04[_0x573c('0x45')]=qs['sort'](_0x17362c['query'][_0x573c('0x46')]);_0x283f04['where']=qs['filters'](_[_0x573c('0x49')](_0x17362c['query'],_0x261614[_0x573c('0x48')]));if(_0x17362c[_0x573c('0x3d')][_0x573c('0x55')]){_0x283f04['where']=_[_0x573c('0x4a')](_0x283f04[_0x573c('0x47')],{'$or':_[_0x573c('0x37')](_0x283f04[_0x573c('0x40')],function(_0x4de070){var _0x32f93b={};_0x32f93b[_0x4de070]={'$like':'%'+_0x17362c[_0x573c('0x3d')][_0x573c('0x55')]+'%'};return _0x32f93b;})});}_0x283f04=_['merge']({},_0x283f04,_0x17362c[_0x573c('0x4b')]);return _0x47343e[_0x573c('0x5b')](_0x283f04);}})[_0x573c('0x1f')](function(_0x1d90d3){if(_0x1d90d3){_0xd5380c=_0x1d90d3[_0x573c('0x43')];if(!_0x17362c['query'][_0x573c('0x44')](_0x573c('0x59'))){_0x283f04[_0x573c('0x2e')]=qs[_0x573c('0x2e')](_0x17362c['query'][_0x573c('0x2e')]);_0x283f04[_0x573c('0x2d')]=qs[_0x573c('0x2d')](_0x17362c[_0x573c('0x3d')][_0x573c('0x2d')]);}return _0x47343e['getTags'](_0x283f04);}})[_0x573c('0x1f')](function(_0x4afada){if(_0x4afada){return _0x4afada?{'count':_0xd5380c,'rows':_0x4afada}:null;}})[_0x573c('0x1f')](respondWithResult(_0x1aec1b,null))[_0x573c('0x29')](handleError(_0x1aec1b,null));};exports['setTags']=function(_0x9ae673,_0x3c3672,_0x20dc56){if(_0x9ae673['body']['id']){delete _0x9ae673['body']['id'];}return db[_0x573c('0x38')]['findOne']({'where':{'id':_0x9ae673[_0x573c('0x53')]['id']}})[_0x573c('0x1f')](handleEntityNotFound(_0x3c3672,null))[_0x573c('0x1f')](function(_0x5a0433){if(_0x5a0433){return _0x5a0433[_0x573c('0x5d')](_0x9ae673['body'][_0x573c('0x5e')]||[]);}return null;})['then'](respondWithResult(_0x3c3672,null))[_0x573c('0x29')](handleError(_0x3c3672,null));}; \ No newline at end of file +var _0xb161=['params','find','create','body','getFields','findOne','DeskField','nolimit','getSubjects','getDescriptions','Tag','getTags','setTags','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../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','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','Content-Range','apply','update','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','DeskConfiguration','count','includeAll','include','findAll','rows','show'];(function(_0x150219,_0x50e354){var _0x3ad58d=function(_0x323dae){while(--_0x323dae){_0x150219['push'](_0x150219['shift']());}};_0x3ad58d(++_0x50e354);}(_0xb161,0x18d));var _0x1b16=function(_0x3e8270,_0x293590){_0x3e8270=_0x3e8270-0x0;var _0x1ccde9=_0xb161[_0x3e8270];return _0x1ccde9;};'use strict';var pdf=require(_0x1b16('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1b16('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1b16('0x2'));var rp=require(_0x1b16('0x3'));var moment=require('moment');var BPromise=require(_0x1b16('0x4'));var Mustache=require(_0x1b16('0x5'));var util=require(_0x1b16('0x6'));var path=require(_0x1b16('0x7'));var sox=require(_0x1b16('0x8'));var csv=require(_0x1b16('0x9'));var ejs=require(_0x1b16('0xa'));var fs=require('fs');var _=require(_0x1b16('0xb'));var squel=require(_0x1b16('0xc'));var crypto=require('crypto');var jsforce=require(_0x1b16('0xd'));var deskjs=require(_0x1b16('0xe'));var toCsv=require(_0x1b16('0x9'));var querystring=require('querystring');var Papa=require(_0x1b16('0xf'));var Redis=require(_0x1b16('0x10'));var authService=require(_0x1b16('0x11'));var qs=require(_0x1b16('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b16('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x1b16('0x14'));var config=require(_0x1b16('0x15'));var db=require(_0x1b16('0x16'))['db'];var jayson=require(_0x1b16('0x17'));var client=jayson[_0x1b16('0x18')][_0x1b16('0x19')]({'port':0x232a});function checkPasswordPattern(_0x5e7332,_0x5099a2,_0x46846f){if(_0x46846f){var _0x4c14a7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4c14a7['test'](_0x5099a2)){return _0x5e7332;}else{throw new db[(_0x1b16('0x1a'))][(_0x1b16('0x1b'))](_0x1b16('0x1c'));}}else{return _0x5e7332;}}function respondWithRpcPromise(_0x14a663,_0x142815,_0x38e353,_0xb76800){return new BPromise(function(_0x5966af,_0x5be3a7){var _0x3f2801=_0xb76800||client;return _0x3f2801[_0x1b16('0x1d')](_0x14a663,_0x38e353)[_0x1b16('0x1e')](function(_0x1903b6){logger[_0x1b16('0x1f')](_0x1b16('0x20'),_0x142815,_0x1b16('0x21'));logger[_0x1b16('0x22')](_0x1b16('0x23'),_0x142815,_0x1b16('0x21'),JSON[_0x1b16('0x24')](_0x1903b6));if(_0x1903b6[_0x1b16('0x25')]){if(_0x1903b6[_0x1b16('0x25')][_0x1b16('0x26')]===0x1f4){logger[_0x1b16('0x25')](_0x1b16('0x20'),_0x142815,_0x1903b6[_0x1b16('0x25')][_0x1b16('0x27')]);return _0x5be3a7(_0x1903b6['error'][_0x1b16('0x27')]);}logger[_0x1b16('0x25')]('DeskConfiguration,\x20%s,\x20%s',_0x142815,_0x1903b6[_0x1b16('0x25')]['message']);return _0x5966af(_0x1903b6[_0x1b16('0x25')][_0x1b16('0x27')]);}else{logger[_0x1b16('0x1f')]('DeskConfiguration,\x20%s,\x20%s',_0x142815,_0x1b16('0x21'));_0x5966af(_0x1903b6['result'][_0x1b16('0x27')]);}})[_0x1b16('0x28')](function(_0x590e61){logger[_0x1b16('0x25')]('DeskConfiguration,\x20%s,\x20%s',_0x142815,_0x590e61);_0x5be3a7(_0x590e61);});});}function respondWithStatusCode(_0x4b01ff,_0x23d5ca){_0x23d5ca=_0x23d5ca||0xcc;return function(_0x1a601c){if(_0x1a601c){return _0x4b01ff[_0x1b16('0x29')](_0x23d5ca);}return _0x4b01ff[_0x1b16('0x2a')](_0x23d5ca)[_0x1b16('0x2b')]();};}function respondWithResult(_0x28817,_0x17fe75){_0x17fe75=_0x17fe75||0xc8;return function(_0x1d18b1){if(_0x1d18b1){return _0x28817['status'](_0x17fe75)[_0x1b16('0x2c')](_0x1d18b1);}};}function respondWithFilteredResult(_0x4b5bd4,_0x345c0d){return function(_0x548d6b){if(_0x548d6b){var _0x4fd527=_0x548d6b['count'],_0x415ccb=_0x345c0d[_0x1b16('0x2d')],_0x519b20=_0x345c0d[_0x1b16('0x2d')]+_0x345c0d['limit'],_0x13c93e;if(_0x519b20>=_0x4fd527){_0x519b20=_0x4fd527;_0x13c93e=0xc8;}else{_0x13c93e=0xce;}_0x4b5bd4[_0x1b16('0x2a')](_0x13c93e);return _0x4b5bd4['set'](_0x1b16('0x2e'),_0x415ccb+'-'+_0x519b20+'/'+_0x4fd527)[_0x1b16('0x2c')](_0x548d6b);}return null;};}function patchUpdates(_0x4fb695){return function(_0x597f2a){try{jsonpatch[_0x1b16('0x2f')](_0x597f2a,_0x4fb695,!![]);}catch(_0x10b166){return BPromise['reject'](_0x10b166);}return _0x597f2a['save']();};}function saveUpdates(_0x410853,_0x5357d){return function(_0x4bb6ab){if(_0x4bb6ab){return _0x4bb6ab[_0x1b16('0x30')](_0x410853)[_0x1b16('0x1e')](function(_0x3ba7b6){return _0x3ba7b6;});}return null;};}function removeEntity(_0x26961e,_0x3cdd04){return function(_0xd003e0){if(_0xd003e0){return _0xd003e0[_0x1b16('0x31')]()[_0x1b16('0x1e')](function(){_0x26961e['status'](0xcc)[_0x1b16('0x2b')]();});}};}function handleEntityNotFound(_0x30187e,_0x140103){return function(_0xeba768){if(!_0xeba768){_0x30187e[_0x1b16('0x29')](0x194);}return _0xeba768;};}function handleError(_0x5d14c7,_0xfa3ca9){_0xfa3ca9=_0xfa3ca9||0x1f4;return function(_0x1f8c9f){logger[_0x1b16('0x25')](_0x1f8c9f[_0x1b16('0x32')]);if(_0x1f8c9f[_0x1b16('0x33')]){delete _0x1f8c9f[_0x1b16('0x33')];}_0x5d14c7[_0x1b16('0x2a')](_0xfa3ca9)[_0x1b16('0x34')](_0x1f8c9f);};}exports[_0x1b16('0x35')]=function(_0x2c757c,_0x5db1f1){var _0x1e3691={},_0x3b983f={},_0x1b754e={'count':0x0,'rows':[]};var _0x7a29ac=_[_0x1b16('0x36')](db['DeskConfiguration'][_0x1b16('0x37')],function(_0x568e2f){return{'name':_0x568e2f['fieldName'],'type':_0x568e2f[_0x1b16('0x38')][_0x1b16('0x39')]};});_0x3b983f[_0x1b16('0x3a')]=_[_0x1b16('0x36')](_0x7a29ac,'name');_0x3b983f[_0x1b16('0x3b')]=_[_0x1b16('0x3c')](_0x2c757c[_0x1b16('0x3b')]);_0x3b983f[_0x1b16('0x3d')]=_[_0x1b16('0x3e')](_0x3b983f[_0x1b16('0x3a')],_0x3b983f[_0x1b16('0x3b')]);_0x1e3691[_0x1b16('0x3f')]=_['intersection'](_0x3b983f['model'],qs[_0x1b16('0x40')](_0x2c757c[_0x1b16('0x3b')][_0x1b16('0x40')]));_0x1e3691[_0x1b16('0x3f')]=_0x1e3691[_0x1b16('0x3f')][_0x1b16('0x41')]?_0x1e3691[_0x1b16('0x3f')]:_0x3b983f[_0x1b16('0x3a')];if(!_0x2c757c[_0x1b16('0x3b')][_0x1b16('0x42')]('nolimit')){_0x1e3691['limit']=qs[_0x1b16('0x43')](_0x2c757c['query'][_0x1b16('0x43')]);_0x1e3691[_0x1b16('0x2d')]=qs[_0x1b16('0x2d')](_0x2c757c[_0x1b16('0x3b')][_0x1b16('0x2d')]);}_0x1e3691[_0x1b16('0x44')]=qs[_0x1b16('0x45')](_0x2c757c[_0x1b16('0x3b')][_0x1b16('0x45')]);_0x1e3691[_0x1b16('0x46')]=qs[_0x1b16('0x3d')](_[_0x1b16('0x47')](_0x2c757c[_0x1b16('0x3b')],_0x3b983f[_0x1b16('0x3d')]));if(_0x2c757c['query'][_0x1b16('0x48')]){_0x1e3691[_0x1b16('0x46')]=_[_0x1b16('0x49')](_0x1e3691[_0x1b16('0x46')],{'$or':_[_0x1b16('0x36')](_0x7a29ac,function(_0x20e833){if(_0x20e833[_0x1b16('0x38')]!==_0x1b16('0x4a')){var _0x3b7cc9={};_0x3b7cc9[_0x20e833[_0x1b16('0x33')]]={'$like':'%'+_0x2c757c[_0x1b16('0x3b')][_0x1b16('0x48')]+'%'};return _0x3b7cc9;}})});}_0x1e3691=_['merge']({},_0x1e3691,_0x2c757c[_0x1b16('0x4b')]);var _0xacbe68={'where':_0x1e3691['where']};return db[_0x1b16('0x4c')][_0x1b16('0x4d')](_0xacbe68)['then'](function(_0x1e3a55){_0x1b754e[_0x1b16('0x4d')]=_0x1e3a55;if(_0x2c757c[_0x1b16('0x3b')][_0x1b16('0x4e')]){_0x1e3691[_0x1b16('0x4f')]=[{'all':!![]}];}return db[_0x1b16('0x4c')][_0x1b16('0x50')](_0x1e3691);})['then'](function(_0x5b62f5){_0x1b754e[_0x1b16('0x51')]=_0x5b62f5;return _0x1b754e;})[_0x1b16('0x1e')](respondWithFilteredResult(_0x5db1f1,_0x1e3691))[_0x1b16('0x28')](handleError(_0x5db1f1,null));};exports[_0x1b16('0x52')]=function(_0x47e708,_0x11029d){var _0x36972d={'raw':![],'where':{'id':_0x47e708[_0x1b16('0x53')]['id']}},_0x232c08={};_0x232c08[_0x1b16('0x3a')]=_['keys'](db[_0x1b16('0x4c')]['rawAttributes']);_0x232c08[_0x1b16('0x3b')]=_[_0x1b16('0x3c')](_0x47e708[_0x1b16('0x3b')]);_0x232c08[_0x1b16('0x3d')]=_[_0x1b16('0x3e')](_0x232c08[_0x1b16('0x3a')],_0x232c08[_0x1b16('0x3b')]);_0x36972d['attributes']=_[_0x1b16('0x3e')](_0x232c08['model'],qs[_0x1b16('0x40')](_0x47e708['query'][_0x1b16('0x40')]));_0x36972d['attributes']=_0x36972d[_0x1b16('0x3f')][_0x1b16('0x41')]?_0x36972d[_0x1b16('0x3f')]:_0x232c08['model'];if(_0x47e708[_0x1b16('0x3b')][_0x1b16('0x4e')]){_0x36972d['include']=[{'all':!![]}];}_0x36972d=_[_0x1b16('0x49')]({},_0x36972d,_0x47e708[_0x1b16('0x4b')]);return db['DeskConfiguration'][_0x1b16('0x54')](_0x36972d)[_0x1b16('0x1e')](handleEntityNotFound(_0x11029d,null))[_0x1b16('0x1e')](respondWithResult(_0x11029d,null))[_0x1b16('0x28')](handleError(_0x11029d,null));};exports[_0x1b16('0x55')]=function(_0x1c04d6,_0x4bef18){return db['DeskConfiguration'][_0x1b16('0x55')](_0x1c04d6['body'],{})[_0x1b16('0x1e')](respondWithResult(_0x4bef18,0xc9))['catch'](handleError(_0x4bef18,null));};exports[_0x1b16('0x30')]=function(_0x45f6c8,_0xda0b54){if(_0x45f6c8[_0x1b16('0x56')]['id']){delete _0x45f6c8[_0x1b16('0x56')]['id'];}return db[_0x1b16('0x4c')][_0x1b16('0x54')]({'where':{'id':_0x45f6c8[_0x1b16('0x53')]['id']}})[_0x1b16('0x1e')](handleEntityNotFound(_0xda0b54,null))[_0x1b16('0x1e')](saveUpdates(_0x45f6c8[_0x1b16('0x56')],null))['then'](respondWithResult(_0xda0b54,null))[_0x1b16('0x28')](handleError(_0xda0b54,null));};exports['destroy']=function(_0x57ba24,_0x47b298){return db[_0x1b16('0x4c')][_0x1b16('0x54')]({'where':{'id':_0x57ba24[_0x1b16('0x53')]['id']}})['then'](handleEntityNotFound(_0x47b298,null))[_0x1b16('0x1e')](removeEntity(_0x47b298,null))[_0x1b16('0x28')](handleError(_0x47b298,null));};exports[_0x1b16('0x57')]=function(_0xbcd701,_0x4fd382,_0x3a14b0){var _0x4b10e7={};var _0x174658={};var _0x11b0bc;var _0x3628ee;return db[_0x1b16('0x4c')][_0x1b16('0x58')]({'where':{'id':_0xbcd701[_0x1b16('0x53')]['id']}})[_0x1b16('0x1e')](handleEntityNotFound(_0x4fd382,null))[_0x1b16('0x1e')](function(_0x63ae2b){if(_0x63ae2b){_0x11b0bc=_0x63ae2b;_0x174658[_0x1b16('0x3a')]=_['keys'](db[_0x1b16('0x59')][_0x1b16('0x37')]);_0x174658[_0x1b16('0x3b')]=_['keys'](_0xbcd701[_0x1b16('0x3b')]);_0x174658['filters']=_[_0x1b16('0x3e')](_0x174658[_0x1b16('0x3a')],_0x174658[_0x1b16('0x3b')]);_0x4b10e7[_0x1b16('0x3f')]=_['intersection'](_0x174658['model'],qs['fields'](_0xbcd701[_0x1b16('0x3b')]['fields']));_0x4b10e7[_0x1b16('0x3f')]=_0x4b10e7[_0x1b16('0x3f')][_0x1b16('0x41')]?_0x4b10e7['attributes']:_0x174658['model'];_0x4b10e7[_0x1b16('0x44')]=qs[_0x1b16('0x45')](_0xbcd701[_0x1b16('0x3b')][_0x1b16('0x45')]);_0x4b10e7[_0x1b16('0x46')]=qs[_0x1b16('0x3d')](_[_0x1b16('0x47')](_0xbcd701['query'],_0x174658[_0x1b16('0x3d')]));if(_0xbcd701[_0x1b16('0x3b')][_0x1b16('0x48')]){_0x4b10e7['where']=_[_0x1b16('0x49')](_0x4b10e7[_0x1b16('0x46')],{'$or':_['map'](_0x4b10e7[_0x1b16('0x3f')],function(_0x4646cf){var _0x2147de={};_0x2147de[_0x4646cf]={'$like':'%'+_0xbcd701['query']['filter']+'%'};return _0x2147de;})});}_0x4b10e7=_[_0x1b16('0x49')]({},_0x4b10e7,_0xbcd701[_0x1b16('0x4b')]);return _0x11b0bc[_0x1b16('0x57')](_0x4b10e7);}})[_0x1b16('0x1e')](function(_0x1a1a6b){if(_0x1a1a6b){_0x3628ee=_0x1a1a6b[_0x1b16('0x41')];if(!_0xbcd701[_0x1b16('0x3b')][_0x1b16('0x42')](_0x1b16('0x5a'))){_0x4b10e7[_0x1b16('0x43')]=qs[_0x1b16('0x43')](_0xbcd701[_0x1b16('0x3b')][_0x1b16('0x43')]);_0x4b10e7[_0x1b16('0x2d')]=qs[_0x1b16('0x2d')](_0xbcd701['query']['offset']);}return _0x11b0bc[_0x1b16('0x57')](_0x4b10e7);}})[_0x1b16('0x1e')](function(_0xf21c3f){if(_0xf21c3f){return _0xf21c3f?{'count':_0x3628ee,'rows':_0xf21c3f}:null;}})['then'](respondWithResult(_0x4fd382,null))[_0x1b16('0x28')](handleError(_0x4fd382,null));};exports[_0x1b16('0x5b')]=function(_0x2c62f0,_0x57a75b,_0x24f5fa){var _0x3ccb37={};var _0x2eab76={};var _0x338a6f;var _0x52e2e7;return db[_0x1b16('0x4c')][_0x1b16('0x58')]({'where':{'id':_0x2c62f0[_0x1b16('0x53')]['id']}})['then'](handleEntityNotFound(_0x57a75b,null))[_0x1b16('0x1e')](function(_0x1da2c0){if(_0x1da2c0){_0x338a6f=_0x1da2c0;_0x2eab76[_0x1b16('0x3a')]=_[_0x1b16('0x3c')](db[_0x1b16('0x59')]['rawAttributes']);_0x2eab76[_0x1b16('0x3b')]=_[_0x1b16('0x3c')](_0x2c62f0[_0x1b16('0x3b')]);_0x2eab76[_0x1b16('0x3d')]=_['intersection'](_0x2eab76[_0x1b16('0x3a')],_0x2eab76[_0x1b16('0x3b')]);_0x3ccb37[_0x1b16('0x3f')]=_[_0x1b16('0x3e')](_0x2eab76['model'],qs[_0x1b16('0x40')](_0x2c62f0[_0x1b16('0x3b')][_0x1b16('0x40')]));_0x3ccb37[_0x1b16('0x3f')]=_0x3ccb37[_0x1b16('0x3f')][_0x1b16('0x41')]?_0x3ccb37['attributes']:_0x2eab76[_0x1b16('0x3a')];_0x3ccb37['order']=qs['sort'](_0x2c62f0[_0x1b16('0x3b')][_0x1b16('0x45')]);_0x3ccb37[_0x1b16('0x46')]=qs[_0x1b16('0x3d')](_[_0x1b16('0x47')](_0x2c62f0['query'],_0x2eab76[_0x1b16('0x3d')]));if(_0x2c62f0['query'][_0x1b16('0x48')]){_0x3ccb37[_0x1b16('0x46')]=_['merge'](_0x3ccb37[_0x1b16('0x46')],{'$or':_[_0x1b16('0x36')](_0x3ccb37[_0x1b16('0x3f')],function(_0x252faa){var _0x9fda4e={};_0x9fda4e[_0x252faa]={'$like':'%'+_0x2c62f0['query']['filter']+'%'};return _0x9fda4e;})});}_0x3ccb37=_[_0x1b16('0x49')]({},_0x3ccb37,_0x2c62f0[_0x1b16('0x4b')]);return _0x338a6f[_0x1b16('0x5b')](_0x3ccb37);}})[_0x1b16('0x1e')](function(_0x32f9c6){if(_0x32f9c6){_0x52e2e7=_0x32f9c6[_0x1b16('0x41')];if(!_0x2c62f0[_0x1b16('0x3b')][_0x1b16('0x42')]('nolimit')){_0x3ccb37[_0x1b16('0x43')]=qs[_0x1b16('0x43')](_0x2c62f0[_0x1b16('0x3b')][_0x1b16('0x43')]);_0x3ccb37['offset']=qs[_0x1b16('0x2d')](_0x2c62f0[_0x1b16('0x3b')][_0x1b16('0x2d')]);}return _0x338a6f['getSubjects'](_0x3ccb37);}})[_0x1b16('0x1e')](function(_0x1a84bf){if(_0x1a84bf){return _0x1a84bf?{'count':_0x52e2e7,'rows':_0x1a84bf}:null;}})[_0x1b16('0x1e')](respondWithResult(_0x57a75b,null))[_0x1b16('0x28')](handleError(_0x57a75b,null));};exports[_0x1b16('0x5c')]=function(_0x118210,_0x3cbdda,_0x425dd6){var _0x419572={};var _0x53faa2={};var _0x3b9517;var _0x288203;return db[_0x1b16('0x4c')][_0x1b16('0x58')]({'where':{'id':_0x118210[_0x1b16('0x53')]['id']}})[_0x1b16('0x1e')](handleEntityNotFound(_0x3cbdda,null))[_0x1b16('0x1e')](function(_0x8122bf){if(_0x8122bf){_0x3b9517=_0x8122bf;_0x53faa2[_0x1b16('0x3a')]=_['keys'](db['DeskField'][_0x1b16('0x37')]);_0x53faa2[_0x1b16('0x3b')]=_['keys'](_0x118210['query']);_0x53faa2[_0x1b16('0x3d')]=_[_0x1b16('0x3e')](_0x53faa2[_0x1b16('0x3a')],_0x53faa2[_0x1b16('0x3b')]);_0x419572[_0x1b16('0x3f')]=_[_0x1b16('0x3e')](_0x53faa2[_0x1b16('0x3a')],qs[_0x1b16('0x40')](_0x118210[_0x1b16('0x3b')][_0x1b16('0x40')]));_0x419572[_0x1b16('0x3f')]=_0x419572['attributes'][_0x1b16('0x41')]?_0x419572[_0x1b16('0x3f')]:_0x53faa2[_0x1b16('0x3a')];_0x419572[_0x1b16('0x44')]=qs[_0x1b16('0x45')](_0x118210[_0x1b16('0x3b')][_0x1b16('0x45')]);_0x419572[_0x1b16('0x46')]=qs['filters'](_[_0x1b16('0x47')](_0x118210['query'],_0x53faa2[_0x1b16('0x3d')]));if(_0x118210[_0x1b16('0x3b')][_0x1b16('0x48')]){_0x419572['where']=_['merge'](_0x419572[_0x1b16('0x46')],{'$or':_[_0x1b16('0x36')](_0x419572[_0x1b16('0x3f')],function(_0x3fde70){var _0x3fd051={};_0x3fd051[_0x3fde70]={'$like':'%'+_0x118210[_0x1b16('0x3b')][_0x1b16('0x48')]+'%'};return _0x3fd051;})});}_0x419572=_[_0x1b16('0x49')]({},_0x419572,_0x118210[_0x1b16('0x4b')]);return _0x3b9517[_0x1b16('0x5c')](_0x419572);}})[_0x1b16('0x1e')](function(_0xafc1e6){if(_0xafc1e6){_0x288203=_0xafc1e6[_0x1b16('0x41')];if(!_0x118210[_0x1b16('0x3b')][_0x1b16('0x42')](_0x1b16('0x5a'))){_0x419572[_0x1b16('0x43')]=qs[_0x1b16('0x43')](_0x118210[_0x1b16('0x3b')][_0x1b16('0x43')]);_0x419572[_0x1b16('0x2d')]=qs[_0x1b16('0x2d')](_0x118210[_0x1b16('0x3b')][_0x1b16('0x2d')]);}return _0x3b9517['getDescriptions'](_0x419572);}})[_0x1b16('0x1e')](function(_0xb237fd){if(_0xb237fd){return _0xb237fd?{'count':_0x288203,'rows':_0xb237fd}:null;}})[_0x1b16('0x1e')](respondWithResult(_0x3cbdda,null))[_0x1b16('0x28')](handleError(_0x3cbdda,null));};exports['getTags']=function(_0x95fd09,_0x1610b9,_0x387154){var _0x304479={};var _0x40e4db={};var _0x3f8990;var _0x499ac7;return db[_0x1b16('0x4c')][_0x1b16('0x58')]({'where':{'id':_0x95fd09[_0x1b16('0x53')]['id']}})[_0x1b16('0x1e')](handleEntityNotFound(_0x1610b9,null))[_0x1b16('0x1e')](function(_0x548140){if(_0x548140){_0x3f8990=_0x548140;_0x40e4db[_0x1b16('0x3a')]=_['keys'](db[_0x1b16('0x5d')]['rawAttributes']);_0x40e4db[_0x1b16('0x3b')]=_[_0x1b16('0x3c')](_0x95fd09[_0x1b16('0x3b')]);_0x40e4db[_0x1b16('0x3d')]=_[_0x1b16('0x3e')](_0x40e4db[_0x1b16('0x3a')],_0x40e4db[_0x1b16('0x3b')]);_0x304479[_0x1b16('0x3f')]=_[_0x1b16('0x3e')](_0x40e4db['model'],qs[_0x1b16('0x40')](_0x95fd09['query'][_0x1b16('0x40')]));_0x304479[_0x1b16('0x3f')]=_0x304479[_0x1b16('0x3f')][_0x1b16('0x41')]?_0x304479[_0x1b16('0x3f')]:_0x40e4db[_0x1b16('0x3a')];_0x304479[_0x1b16('0x44')]=qs['sort'](_0x95fd09[_0x1b16('0x3b')][_0x1b16('0x45')]);_0x304479[_0x1b16('0x46')]=qs[_0x1b16('0x3d')](_[_0x1b16('0x47')](_0x95fd09[_0x1b16('0x3b')],_0x40e4db['filters']));if(_0x95fd09[_0x1b16('0x3b')][_0x1b16('0x48')]){_0x304479[_0x1b16('0x46')]=_[_0x1b16('0x49')](_0x304479[_0x1b16('0x46')],{'$or':_['map'](_0x304479[_0x1b16('0x3f')],function(_0x16fdc2){var _0x2a5931={};_0x2a5931[_0x16fdc2]={'$like':'%'+_0x95fd09['query'][_0x1b16('0x48')]+'%'};return _0x2a5931;})});}_0x304479=_['merge']({},_0x304479,_0x95fd09['options']);return _0x3f8990[_0x1b16('0x5e')](_0x304479);}})[_0x1b16('0x1e')](function(_0x157a10){if(_0x157a10){_0x499ac7=_0x157a10[_0x1b16('0x41')];if(!_0x95fd09[_0x1b16('0x3b')][_0x1b16('0x42')]('nolimit')){_0x304479[_0x1b16('0x43')]=qs[_0x1b16('0x43')](_0x95fd09[_0x1b16('0x3b')][_0x1b16('0x43')]);_0x304479[_0x1b16('0x2d')]=qs[_0x1b16('0x2d')](_0x95fd09[_0x1b16('0x3b')][_0x1b16('0x2d')]);}return _0x3f8990[_0x1b16('0x5e')](_0x304479);}})[_0x1b16('0x1e')](function(_0x4b5961){if(_0x4b5961){return _0x4b5961?{'count':_0x499ac7,'rows':_0x4b5961}:null;}})['then'](respondWithResult(_0x1610b9,null))[_0x1b16('0x28')](handleError(_0x1610b9,null));};exports[_0x1b16('0x5f')]=function(_0xafc3fc,_0x428119,_0x599f80){if(_0xafc3fc['body']['id']){delete _0xafc3fc['body']['id'];}return db[_0x1b16('0x4c')][_0x1b16('0x58')]({'where':{'id':_0xafc3fc['params']['id']}})['then'](handleEntityNotFound(_0x428119,null))['then'](function(_0x1e0e89){if(_0x1e0e89){return _0x1e0e89['setTags'](_0xafc3fc['body']['ids']||[]);}return null;})[_0x1b16('0x1e')](respondWithResult(_0x428119,null))[_0x1b16('0x28')](handleError(_0x428119,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index d2dcbcb..65bbea0 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 _0x0e76=['util','../../config/logger','api','moment','request-promise','path','./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x0e76,0xf1));var _0x60e7=function(_0x60878f,_0x1166d3){_0x60878f=_0x60878f-0x0;var _0x1fbefb=_0x0e76[_0x60878f];return _0x1fbefb;};'use strict';var _=require(_0x60e7('0x0'));var util=require(_0x60e7('0x1'));var logger=require(_0x60e7('0x2'))(_0x60e7('0x3'));var moment=require(_0x60e7('0x4'));var BPromise=require('bluebird');var rp=require(_0x60e7('0x5'));var fs=require('fs');var path=require(_0x60e7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x60e7('0x7'));module['exports']=function(_0x3c2e7f,_0x219174){return _0x3c2e7f[_0x60e7('0x8')](_0x60e7('0x9'),attributes,{'tableName':_0x60e7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa946=['request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','int_desk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xa946,0xc1));var _0x6a94=function(_0x2f2cb9,_0x6e0d62){_0x2f2cb9=_0x2f2cb9-0x0;var _0x15c9c0=_0xa946[_0x2f2cb9];return _0x15c9c0;};'use strict';var _=require(_0x6a94('0x0'));var util=require(_0x6a94('0x1'));var logger=require(_0x6a94('0x2'))(_0x6a94('0x3'));var moment=require(_0x6a94('0x4'));var BPromise=require('bluebird');var rp=require(_0x6a94('0x5'));var fs=require('fs');var path=require(_0x6a94('0x6'));var rimraf=require(_0x6a94('0x7'));var config=require(_0x6a94('0x8'));var attributes=require(_0x6a94('0x9'));module['exports']=function(_0x293994,_0x5a1746){return _0x293994['define']('DeskConfiguration',attributes,{'tableName':_0x6a94('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index c5cf900..3ce3968 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 _0x149c=['info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x160d29,_0x4768e5){var _0x111b6b=function(_0x43fc3c){while(--_0x43fc3c){_0x160d29['push'](_0x160d29['shift']());}};_0x111b6b(++_0x4768e5);}(_0x149c,0x143));var _0xc149=function(_0x41e56f,_0x36ecc5){_0x41e56f=_0x41e56f-0x0;var _0x46f652=_0x149c[_0x41e56f];return _0x46f652;};'use strict';var _=require(_0xc149('0x0'));var util=require('util');var moment=require(_0xc149('0x1'));var BPromise=require(_0xc149('0x2'));var rs=require(_0xc149('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc149('0x4'))['db'];var utils=require(_0xc149('0x5'));var logger=require(_0xc149('0x6'))(_0xc149('0x7'));var config=require(_0xc149('0x8'));var jayson=require(_0xc149('0x9'));var client=jayson[_0xc149('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x578cec,_0x351b75,_0x34710e){return new BPromise(function(_0x3a1739,_0x1d9eca){return client[_0xc149('0xb')](_0x578cec,_0x34710e)[_0xc149('0xc')](function(_0x25fb58){logger[_0xc149('0xd')](_0xc149('0xe'),_0x351b75,_0xc149('0xf'));logger[_0xc149('0x10')](_0xc149('0x11'),_0x351b75,_0xc149('0xf'),JSON[_0xc149('0x12')](_0x25fb58));if(_0x25fb58[_0xc149('0x13')]){if(_0x25fb58[_0xc149('0x13')][_0xc149('0x14')]===0x1f4){logger[_0xc149('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x351b75,_0x25fb58[_0xc149('0x13')]['message']);return _0x1d9eca(_0x25fb58[_0xc149('0x13')]['message']);}logger[_0xc149('0x13')](_0xc149('0xe'),_0x351b75,_0x25fb58['error']['message']);return _0x3a1739(_0x25fb58[_0xc149('0x13')][_0xc149('0x15')]);}else{logger[_0xc149('0xd')](_0xc149('0xe'),_0x351b75,_0xc149('0xf'));_0x3a1739(_0x25fb58[_0xc149('0x16')]['message']);}})[_0xc149('0x17')](function(_0x44dcb2){logger[_0xc149('0x13')](_0xc149('0xe'),_0x351b75,_0x44dcb2);_0x1d9eca(_0x44dcb2);});});} \ No newline at end of file +var _0x5e14=['debug','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x21a0cf,_0x45c3ca){var _0x5bff83=function(_0x35d070){while(--_0x35d070){_0x21a0cf['push'](_0x21a0cf['shift']());}};_0x5bff83(++_0x45c3ca);}(_0x5e14,0x164));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x45e1('0x0'));var util=require(_0x45e1('0x1'));var moment=require(_0x45e1('0x2'));var BPromise=require(_0x45e1('0x3'));var rs=require(_0x45e1('0x4'));var fs=require('fs');var Redis=require(_0x45e1('0x5'));var db=require(_0x45e1('0x6'))['db'];var utils=require(_0x45e1('0x7'));var logger=require(_0x45e1('0x8'))(_0x45e1('0x9'));var config=require(_0x45e1('0xa'));var jayson=require(_0x45e1('0xb'));var client=jayson[_0x45e1('0xc')][_0x45e1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x26ee2e,_0xff82a2,_0x111f7c){return new BPromise(function(_0x4062de,_0x2296b3){return client[_0x45e1('0xe')](_0x26ee2e,_0x111f7c)[_0x45e1('0xf')](function(_0x1c57cf){logger['info'](_0x45e1('0x10'),_0xff82a2,_0x45e1('0x11'));logger[_0x45e1('0x12')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0xff82a2,_0x45e1('0x11'),JSON['stringify'](_0x1c57cf));if(_0x1c57cf[_0x45e1('0x13')]){if(_0x1c57cf[_0x45e1('0x13')][_0x45e1('0x14')]===0x1f4){logger[_0x45e1('0x13')](_0x45e1('0x10'),_0xff82a2,_0x1c57cf[_0x45e1('0x13')][_0x45e1('0x15')]);return _0x2296b3(_0x1c57cf['error'][_0x45e1('0x15')]);}logger[_0x45e1('0x13')](_0x45e1('0x10'),_0xff82a2,_0x1c57cf[_0x45e1('0x13')][_0x45e1('0x15')]);return _0x4062de(_0x1c57cf[_0x45e1('0x13')][_0x45e1('0x15')]);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0xff82a2,_0x45e1('0x11'));_0x4062de(_0x1c57cf['result']['message']);}})['catch'](function(_0x1f8e39){logger[_0x45e1('0x13')](_0x45e1('0x10'),_0xff82a2,_0x1f8e39);_0x2296b3(_0x1f8e39);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index d4cd7a8..df071c8 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 _0xa651=['connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x305b20,_0x5e57e9){var _0x26d64a=function(_0x2e17f0){while(--_0x2e17f0){_0x305b20['push'](_0x305b20['shift']());}};_0x26d64a(++_0x5e57e9);}(_0xa651,0x195));var _0x1a65=function(_0x5e99a5,_0x5c039e){_0x5e99a5=_0x5e99a5-0x0;var _0x58ce5d=_0xa651[_0x5e99a5];return _0x58ce5d;};'use strict';var multer=require(_0x1a65('0x0'));var util=require(_0x1a65('0x1'));var path=require(_0x1a65('0x2'));var timeout=require(_0x1a65('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1a65('0x4'));var config=require(_0x1a65('0x5'));var controller=require('./intDeskField.controller');router[_0x1a65('0x6')]('/',auth[_0x1a65('0x7')](),controller['index']);router[_0x1a65('0x6')]('/:id',auth[_0x1a65('0x7')](),controller[_0x1a65('0x8')]);router[_0x1a65('0x9')]('/',auth[_0x1a65('0x7')](),controller[_0x1a65('0xa')]);router[_0x1a65('0xb')](_0x1a65('0xc'),auth[_0x1a65('0x7')](),controller[_0x1a65('0xd')]);router[_0x1a65('0xe')]('/:id',auth[_0x1a65('0x7')](),controller[_0x1a65('0xf')]);module[_0x1a65('0x10')]=router; \ No newline at end of file +var _0x0737=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports'];(function(_0x2bfd60,_0x90839c){var _0x203273=function(_0x4fa182){while(--_0x4fa182){_0x2bfd60['push'](_0x2bfd60['shift']());}};_0x203273(++_0x90839c);}(_0x0737,0xd2));var _0x7073=function(_0xfe6db4,_0x410b4d){_0xfe6db4=_0xfe6db4-0x0;var _0x184cb9=_0x0737[_0xfe6db4];return _0x184cb9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x7073('0x0'));var express=require(_0x7073('0x1'));var router=express[_0x7073('0x2')]();var auth=require(_0x7073('0x3'));var interaction=require(_0x7073('0x4'));var config=require('../../config/environment');var controller=require(_0x7073('0x5'));router['get']('/',auth[_0x7073('0x6')](),controller[_0x7073('0x7')]);router['get'](_0x7073('0x8'),auth[_0x7073('0x6')](),controller['show']);router['post']('/',auth[_0x7073('0x6')](),controller[_0x7073('0x9')]);router[_0x7073('0xa')](_0x7073('0x8'),auth[_0x7073('0x6')](),controller[_0x7073('0xb')]);router[_0x7073('0xc')](_0x7073('0x8'),auth[_0x7073('0x6')](),controller[_0x7073('0xd')]);module[_0x7073('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 0fad9f3..b249e92 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 _0x0a0b=['customVariable','sequelize','exports','ENUM','keyValue','STRING','string','variable'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0x0a0b,0x99));var _0xb0a0=function(_0x2e2fdd,_0x6e1acc){_0x2e2fdd=_0x2e2fdd-0x0;var _0x489764=_0x0a0b[_0x2e2fdd];return _0x489764;};'use strict';var Sequelize=require(_0xb0a0('0x0'));module[_0xb0a0('0x1')]={'type':{'type':Sequelize[_0xb0a0('0x2')]('string','variable','customVariable',_0xb0a0('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb0a0('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb0a0('0x2')](_0xb0a0('0x5'),_0xb0a0('0x6'),_0xb0a0('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb0a0('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb0a0('0x4')]}}; \ No newline at end of file +var _0xaa22=['ENUM','variable','BOOLEAN','sequelize','exports','string','customVariable','keyValue','STRING'];(function(_0x3469b4,_0x4fb4a5){var _0x224db2=function(_0x49255d){while(--_0x49255d){_0x3469b4['push'](_0x3469b4['shift']());}};_0x224db2(++_0x4fb4a5);}(_0xaa22,0xc0));var _0x2aa2=function(_0x1e3585,_0x2a2894){_0x1e3585=_0x1e3585-0x0;var _0xd7019d=_0xaa22[_0x1e3585];return _0xd7019d;};'use strict';var Sequelize=require(_0x2aa2('0x0'));module[_0x2aa2('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2aa2('0x2'),'variable',_0x2aa2('0x3'),_0x2aa2('0x4')),'defaultValue':_0x2aa2('0x2')},'content':{'type':Sequelize[_0x2aa2('0x5')]},'key':{'type':Sequelize[_0x2aa2('0x5')]},'keyType':{'type':Sequelize[_0x2aa2('0x6')](_0x2aa2('0x2'),_0x2aa2('0x7'),_0x2aa2('0x3'))},'keyContent':{'type':Sequelize[_0x2aa2('0x5')]},'idField':{'type':Sequelize[_0x2aa2('0x5')]},'nameField':{'type':Sequelize[_0x2aa2('0x5')]},'customField':{'type':Sequelize[_0x2aa2('0x8')],'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 cde8768..e0b54ae 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 _0x7217=['send','index','map','DeskField','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','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','sendStatus','end','json','count','offset','status','Content-Range','apply','reject','save','update','then','error','stack','name'];(function(_0x126097,_0x478ebc){var _0x1abfd0=function(_0x477560){while(--_0x477560){_0x126097['push'](_0x126097['shift']());}};_0x1abfd0(++_0x478ebc);}(_0x7217,0x19e));var _0x7721=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x7217[_0x134c2e];return _0x2825db;};'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'];function respondWithStatusCode(_0x27b36b,_0x55b4ca){_0x55b4ca=_0x55b4ca||0xcc;return function(_0x2911ec){if(_0x2911ec){return _0x27b36b[_0x7721('0x1b')](_0x55b4ca);}return _0x27b36b['status'](_0x55b4ca)[_0x7721('0x1c')]();};}function respondWithResult(_0x30da54,_0x3f01c5){_0x3f01c5=_0x3f01c5||0xc8;return function(_0x2e9752){if(_0x2e9752){return _0x30da54['status'](_0x3f01c5)[_0x7721('0x1d')](_0x2e9752);}};}function respondWithFilteredResult(_0x25b1c0,_0x534f1b){return function(_0x4e199a){if(_0x4e199a){var _0x4b183e=_0x4e199a[_0x7721('0x1e')],_0x5ed54=_0x534f1b['offset'],_0x25a628=_0x534f1b[_0x7721('0x1f')]+_0x534f1b['limit'],_0x3cc909;if(_0x25a628>=_0x4b183e){_0x25a628=_0x4b183e;_0x3cc909=0xc8;}else{_0x3cc909=0xce;}_0x25b1c0[_0x7721('0x20')](_0x3cc909);return _0x25b1c0['set'](_0x7721('0x21'),_0x5ed54+'-'+_0x25a628+'/'+_0x4b183e)[_0x7721('0x1d')](_0x4e199a);}return null;};}function patchUpdates(_0x3ab5a5){return function(_0x3e140d){try{jsonpatch[_0x7721('0x22')](_0x3e140d,_0x3ab5a5,!![]);}catch(_0x40af90){return BPromise[_0x7721('0x23')](_0x40af90);}return _0x3e140d[_0x7721('0x24')]();};}function saveUpdates(_0x3b29ac,_0xaeccc4){return function(_0x4ce1db){if(_0x4ce1db){return _0x4ce1db[_0x7721('0x25')](_0x3b29ac)[_0x7721('0x26')](function(_0x3a053f){return _0x3a053f;});}return null;};}function removeEntity(_0xd8ad3c,_0x57140c){return function(_0x28f5a6){if(_0x28f5a6){return _0x28f5a6['destroy']()[_0x7721('0x26')](function(){_0xd8ad3c[_0x7721('0x20')](0xcc)[_0x7721('0x1c')]();});}};}function handleEntityNotFound(_0x1caad8,_0x121cc4){return function(_0x395b15){if(!_0x395b15){_0x1caad8[_0x7721('0x1b')](0x194);}return _0x395b15;};}function handleError(_0x5b4d74,_0x216f20){_0x216f20=_0x216f20||0x1f4;return function(_0x1abedb){logger[_0x7721('0x27')](_0x1abedb[_0x7721('0x28')]);if(_0x1abedb[_0x7721('0x29')]){delete _0x1abedb[_0x7721('0x29')];}_0x5b4d74[_0x7721('0x20')](_0x216f20)[_0x7721('0x2a')](_0x1abedb);};}exports[_0x7721('0x2b')]=function(_0x52316e,_0x258ddf){var _0x5b0551={},_0x499b87={},_0x315202={'count':0x0,'rows':[]};var _0x343c19=_[_0x7721('0x2c')](db[_0x7721('0x2d')][_0x7721('0x2e')],function(_0x37b9f0){return{'name':_0x37b9f0[_0x7721('0x2f')],'type':_0x37b9f0[_0x7721('0x30')]['key']};});_0x499b87[_0x7721('0x31')]=_[_0x7721('0x2c')](_0x343c19,'name');_0x499b87['query']=_[_0x7721('0x32')](_0x52316e[_0x7721('0x33')]);_0x499b87['filters']=_[_0x7721('0x34')](_0x499b87[_0x7721('0x31')],_0x499b87[_0x7721('0x33')]);_0x5b0551['attributes']=_[_0x7721('0x34')](_0x499b87[_0x7721('0x31')],qs[_0x7721('0x35')](_0x52316e[_0x7721('0x33')][_0x7721('0x35')]));_0x5b0551['attributes']=_0x5b0551[_0x7721('0x36')][_0x7721('0x37')]?_0x5b0551[_0x7721('0x36')]:_0x499b87['model'];if(!_0x52316e[_0x7721('0x33')][_0x7721('0x38')]('nolimit')){_0x5b0551[_0x7721('0x39')]=qs['limit'](_0x52316e[_0x7721('0x33')][_0x7721('0x39')]);_0x5b0551[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x52316e[_0x7721('0x33')][_0x7721('0x1f')]);}_0x5b0551[_0x7721('0x3a')]=qs[_0x7721('0x3b')](_0x52316e[_0x7721('0x33')][_0x7721('0x3b')]);_0x5b0551[_0x7721('0x3c')]=qs['filters'](_[_0x7721('0x3d')](_0x52316e['query'],_0x499b87[_0x7721('0x3e')]));if(_0x52316e[_0x7721('0x33')][_0x7721('0x3f')]){_0x5b0551[_0x7721('0x3c')]=_[_0x7721('0x40')](_0x5b0551[_0x7721('0x3c')],{'$or':_['map'](_0x343c19,function(_0x557c34){if(_0x557c34['type']!=='VIRTUAL'){var _0x18001c={};_0x18001c[_0x557c34[_0x7721('0x29')]]={'$like':'%'+_0x52316e[_0x7721('0x33')][_0x7721('0x3f')]+'%'};return _0x18001c;}})});}_0x5b0551=_['merge']({},_0x5b0551,_0x52316e[_0x7721('0x41')]);var _0x4cf659={'where':_0x5b0551[_0x7721('0x3c')]};return db[_0x7721('0x2d')]['count'](_0x4cf659)[_0x7721('0x26')](function(_0x3a47c8){_0x315202['count']=_0x3a47c8;if(_0x52316e['query'][_0x7721('0x42')]){_0x5b0551[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x2d')][_0x7721('0x44')](_0x5b0551);})['then'](function(_0x2db173){_0x315202[_0x7721('0x45')]=_0x2db173;return _0x315202;})[_0x7721('0x26')](respondWithFilteredResult(_0x258ddf,_0x5b0551))[_0x7721('0x46')](handleError(_0x258ddf,null));};exports[_0x7721('0x47')]=function(_0x52ab67,_0x490d4){var _0x4a2c28={'raw':!![],'where':{'id':_0x52ab67['params']['id']}},_0xaa3216={};_0xaa3216[_0x7721('0x31')]=_[_0x7721('0x32')](db[_0x7721('0x2d')]['rawAttributes']);_0xaa3216[_0x7721('0x33')]=_[_0x7721('0x32')](_0x52ab67[_0x7721('0x33')]);_0xaa3216['filters']=_[_0x7721('0x34')](_0xaa3216[_0x7721('0x31')],_0xaa3216[_0x7721('0x33')]);_0x4a2c28[_0x7721('0x36')]=_[_0x7721('0x34')](_0xaa3216[_0x7721('0x31')],qs[_0x7721('0x35')](_0x52ab67['query']['fields']));_0x4a2c28[_0x7721('0x36')]=_0x4a2c28[_0x7721('0x36')][_0x7721('0x37')]?_0x4a2c28[_0x7721('0x36')]:_0xaa3216[_0x7721('0x31')];if(_0x52ab67[_0x7721('0x33')][_0x7721('0x42')]){_0x4a2c28[_0x7721('0x43')]=[{'all':!![]}];}_0x4a2c28=_[_0x7721('0x40')]({},_0x4a2c28,_0x52ab67[_0x7721('0x41')]);return db['DeskField']['find'](_0x4a2c28)[_0x7721('0x26')](handleEntityNotFound(_0x490d4,null))[_0x7721('0x26')](respondWithResult(_0x490d4,null))[_0x7721('0x46')](handleError(_0x490d4,null));};exports[_0x7721('0x48')]=function(_0x589e95,_0x30107e){return db[_0x7721('0x2d')]['create'](_0x589e95[_0x7721('0x49')],{})['then'](respondWithResult(_0x30107e,0xc9))[_0x7721('0x46')](handleError(_0x30107e,null));};exports['update']=function(_0x334f23,_0x196be4){if(_0x334f23[_0x7721('0x49')]['id']){delete _0x334f23['body']['id'];}return db[_0x7721('0x2d')][_0x7721('0x4a')]({'where':{'id':_0x334f23['params']['id']}})[_0x7721('0x26')](handleEntityNotFound(_0x196be4,null))[_0x7721('0x26')](saveUpdates(_0x334f23[_0x7721('0x49')],null))['then'](respondWithResult(_0x196be4,null))[_0x7721('0x46')](handleError(_0x196be4,null));};exports['destroy']=function(_0xdb1ca8,_0x310549){return db[_0x7721('0x2d')][_0x7721('0x4a')]({'where':{'id':_0xdb1ca8[_0x7721('0x4b')]['id']}})[_0x7721('0x26')](handleEntityNotFound(_0x310549,null))[_0x7721('0x26')](removeEntity(_0x310549,null))[_0x7721('0x46')](handleError(_0x310549,null));}; \ No newline at end of file +var _0xcb81=['error','stack','name','index','map','DeskField','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','then','rows','catch','show','params','keys','include','find','create','body','destroy','html-pdf','eml-format','zip-dir','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','end'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcb81,0x154));var _0x1cb8=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0xcb81[_0x361d3f];return _0x320229;};'use strict';var pdf=require(_0x1cb8('0x0'));var emlformat=require(_0x1cb8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1cb8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1cb8('0x3'));var Mustache=require(_0x1cb8('0x4'));var util=require(_0x1cb8('0x5'));var path=require(_0x1cb8('0x6'));var sox=require(_0x1cb8('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb8('0x8'));var fs=require('fs');var _=require(_0x1cb8('0x9'));var squel=require('squel');var crypto=require(_0x1cb8('0xa'));var jsforce=require(_0x1cb8('0xb'));var deskjs=require(_0x1cb8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1cb8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1cb8('0xe'));var qs=require(_0x1cb8('0xf'));var as=require(_0x1cb8('0x10'));var hardwareService=require(_0x1cb8('0x11'));var logger=require(_0x1cb8('0x12'))(_0x1cb8('0x13'));var utils=require(_0x1cb8('0x14'));var config=require(_0x1cb8('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fb18e,_0x1ffe94){_0x1ffe94=_0x1ffe94||0xcc;return function(_0x1938ee){if(_0x1938ee){return _0x2fb18e[_0x1cb8('0x16')](_0x1ffe94);}return _0x2fb18e[_0x1cb8('0x17')](_0x1ffe94)['end']();};}function respondWithResult(_0x389c12,_0x2c600){_0x2c600=_0x2c600||0xc8;return function(_0xcb6ad1){if(_0xcb6ad1){return _0x389c12[_0x1cb8('0x17')](_0x2c600)[_0x1cb8('0x18')](_0xcb6ad1);}};}function respondWithFilteredResult(_0xe5402a,_0x339ad0){return function(_0x243930){if(_0x243930){var _0x5af4a3=_0x243930[_0x1cb8('0x19')],_0x17a95d=_0x339ad0[_0x1cb8('0x1a')],_0x4b4917=_0x339ad0[_0x1cb8('0x1a')]+_0x339ad0[_0x1cb8('0x1b')],_0xf6b347;if(_0x4b4917>=_0x5af4a3){_0x4b4917=_0x5af4a3;_0xf6b347=0xc8;}else{_0xf6b347=0xce;}_0xe5402a[_0x1cb8('0x17')](_0xf6b347);return _0xe5402a[_0x1cb8('0x1c')](_0x1cb8('0x1d'),_0x17a95d+'-'+_0x4b4917+'/'+_0x5af4a3)[_0x1cb8('0x18')](_0x243930);}return null;};}function patchUpdates(_0x1f9fd7){return function(_0x11d9f4){try{jsonpatch[_0x1cb8('0x1e')](_0x11d9f4,_0x1f9fd7,!![]);}catch(_0x5c403c){return BPromise[_0x1cb8('0x1f')](_0x5c403c);}return _0x11d9f4[_0x1cb8('0x20')]();};}function saveUpdates(_0x170f34,_0x3d1682){return function(_0x4abf3a){if(_0x4abf3a){return _0x4abf3a[_0x1cb8('0x21')](_0x170f34)['then'](function(_0x436a27){return _0x436a27;});}return null;};}function removeEntity(_0x58c78f,_0x40b914){return function(_0x38ff3a){if(_0x38ff3a){return _0x38ff3a['destroy']()['then'](function(){_0x58c78f[_0x1cb8('0x17')](0xcc)[_0x1cb8('0x22')]();});}};}function handleEntityNotFound(_0x22dafe,_0x44a00d){return function(_0x2473b8){if(!_0x2473b8){_0x22dafe[_0x1cb8('0x16')](0x194);}return _0x2473b8;};}function handleError(_0x144b66,_0x47b161){_0x47b161=_0x47b161||0x1f4;return function(_0x1ec384){logger[_0x1cb8('0x23')](_0x1ec384[_0x1cb8('0x24')]);if(_0x1ec384[_0x1cb8('0x25')]){delete _0x1ec384[_0x1cb8('0x25')];}_0x144b66[_0x1cb8('0x17')](_0x47b161)['send'](_0x1ec384);};}exports[_0x1cb8('0x26')]=function(_0x23ac21,_0xfdfb31){var _0x3c1905={},_0x272a15={},_0x4a9b74={'count':0x0,'rows':[]};var _0xed576b=_[_0x1cb8('0x27')](db[_0x1cb8('0x28')][_0x1cb8('0x29')],function(_0x4fda96){return{'name':_0x4fda96[_0x1cb8('0x2a')],'type':_0x4fda96[_0x1cb8('0x2b')][_0x1cb8('0x2c')]};});_0x272a15['model']=_[_0x1cb8('0x27')](_0xed576b,_0x1cb8('0x25'));_0x272a15[_0x1cb8('0x2d')]=_['keys'](_0x23ac21[_0x1cb8('0x2d')]);_0x272a15[_0x1cb8('0x2e')]=_[_0x1cb8('0x2f')](_0x272a15[_0x1cb8('0x30')],_0x272a15[_0x1cb8('0x2d')]);_0x3c1905['attributes']=_[_0x1cb8('0x2f')](_0x272a15[_0x1cb8('0x30')],qs[_0x1cb8('0x31')](_0x23ac21[_0x1cb8('0x2d')][_0x1cb8('0x31')]));_0x3c1905[_0x1cb8('0x32')]=_0x3c1905[_0x1cb8('0x32')][_0x1cb8('0x33')]?_0x3c1905[_0x1cb8('0x32')]:_0x272a15['model'];if(!_0x23ac21['query'][_0x1cb8('0x34')](_0x1cb8('0x35'))){_0x3c1905[_0x1cb8('0x1b')]=qs['limit'](_0x23ac21['query'][_0x1cb8('0x1b')]);_0x3c1905[_0x1cb8('0x1a')]=qs[_0x1cb8('0x1a')](_0x23ac21[_0x1cb8('0x2d')][_0x1cb8('0x1a')]);}_0x3c1905[_0x1cb8('0x36')]=qs[_0x1cb8('0x37')](_0x23ac21[_0x1cb8('0x2d')]['sort']);_0x3c1905[_0x1cb8('0x38')]=qs[_0x1cb8('0x2e')](_[_0x1cb8('0x39')](_0x23ac21[_0x1cb8('0x2d')],_0x272a15[_0x1cb8('0x2e')]));if(_0x23ac21[_0x1cb8('0x2d')][_0x1cb8('0x3a')]){_0x3c1905[_0x1cb8('0x38')]=_[_0x1cb8('0x3b')](_0x3c1905['where'],{'$or':_[_0x1cb8('0x27')](_0xed576b,function(_0x2c98a4){if(_0x2c98a4['type']!==_0x1cb8('0x3c')){var _0x3efb16={};_0x3efb16[_0x2c98a4[_0x1cb8('0x25')]]={'$like':'%'+_0x23ac21[_0x1cb8('0x2d')][_0x1cb8('0x3a')]+'%'};return _0x3efb16;}})});}_0x3c1905=_['merge']({},_0x3c1905,_0x23ac21[_0x1cb8('0x3d')]);var _0x4666bc={'where':_0x3c1905[_0x1cb8('0x38')]};return db['DeskField']['count'](_0x4666bc)['then'](function(_0xca5f83){_0x4a9b74[_0x1cb8('0x19')]=_0xca5f83;if(_0x23ac21[_0x1cb8('0x2d')][_0x1cb8('0x3e')]){_0x3c1905['include']=[{'all':!![]}];}return db['DeskField'][_0x1cb8('0x3f')](_0x3c1905);})[_0x1cb8('0x40')](function(_0xe3cd20){_0x4a9b74[_0x1cb8('0x41')]=_0xe3cd20;return _0x4a9b74;})[_0x1cb8('0x40')](respondWithFilteredResult(_0xfdfb31,_0x3c1905))[_0x1cb8('0x42')](handleError(_0xfdfb31,null));};exports[_0x1cb8('0x43')]=function(_0x465928,_0x4bb774){var _0x2044d1={'raw':!![],'where':{'id':_0x465928[_0x1cb8('0x44')]['id']}},_0x101a35={};_0x101a35[_0x1cb8('0x30')]=_['keys'](db[_0x1cb8('0x28')]['rawAttributes']);_0x101a35[_0x1cb8('0x2d')]=_[_0x1cb8('0x45')](_0x465928['query']);_0x101a35[_0x1cb8('0x2e')]=_[_0x1cb8('0x2f')](_0x101a35[_0x1cb8('0x30')],_0x101a35['query']);_0x2044d1['attributes']=_[_0x1cb8('0x2f')](_0x101a35['model'],qs[_0x1cb8('0x31')](_0x465928[_0x1cb8('0x2d')][_0x1cb8('0x31')]));_0x2044d1[_0x1cb8('0x32')]=_0x2044d1[_0x1cb8('0x32')][_0x1cb8('0x33')]?_0x2044d1[_0x1cb8('0x32')]:_0x101a35['model'];if(_0x465928[_0x1cb8('0x2d')][_0x1cb8('0x3e')]){_0x2044d1[_0x1cb8('0x46')]=[{'all':!![]}];}_0x2044d1=_[_0x1cb8('0x3b')]({},_0x2044d1,_0x465928['options']);return db[_0x1cb8('0x28')][_0x1cb8('0x47')](_0x2044d1)[_0x1cb8('0x40')](handleEntityNotFound(_0x4bb774,null))[_0x1cb8('0x40')](respondWithResult(_0x4bb774,null))[_0x1cb8('0x42')](handleError(_0x4bb774,null));};exports['create']=function(_0x10380e,_0x4452ba){return db[_0x1cb8('0x28')][_0x1cb8('0x48')](_0x10380e[_0x1cb8('0x49')],{})['then'](respondWithResult(_0x4452ba,0xc9))[_0x1cb8('0x42')](handleError(_0x4452ba,null));};exports[_0x1cb8('0x21')]=function(_0x5598b1,_0x423916){if(_0x5598b1[_0x1cb8('0x49')]['id']){delete _0x5598b1[_0x1cb8('0x49')]['id'];}return db[_0x1cb8('0x28')][_0x1cb8('0x47')]({'where':{'id':_0x5598b1[_0x1cb8('0x44')]['id']}})[_0x1cb8('0x40')](handleEntityNotFound(_0x423916,null))[_0x1cb8('0x40')](saveUpdates(_0x5598b1[_0x1cb8('0x49')],null))[_0x1cb8('0x40')](respondWithResult(_0x423916,null))[_0x1cb8('0x42')](handleError(_0x423916,null));};exports[_0x1cb8('0x4a')]=function(_0x3c9076,_0x2bbad1){return db['DeskField'][_0x1cb8('0x47')]({'where':{'id':_0x3c9076[_0x1cb8('0x44')]['id']}})[_0x1cb8('0x40')](handleEntityNotFound(_0x2bbad1,null))[_0x1cb8('0x40')](removeEntity(_0x2bbad1,null))[_0x1cb8('0x42')](handleError(_0x2bbad1,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 3a08f5a..87c35ec 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 _0x33ce=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDeskField.attributes','define','desk_unique_index','FieldId','lodash'];(function(_0x1b6db3,_0x26930b){var _0x38a71e=function(_0x21dddd){while(--_0x21dddd){_0x1b6db3['push'](_0x1b6db3['shift']());}};_0x38a71e(++_0x26930b);}(_0x33ce,0x83));var _0xe33c=function(_0x3760f2,_0x2fd43c){_0x3760f2=_0x3760f2-0x0;var _0x528064=_0x33ce[_0x3760f2];return _0x528064;};'use strict';var _=require(_0xe33c('0x0'));var util=require('util');var logger=require(_0xe33c('0x1'))(_0xe33c('0x2'));var moment=require(_0xe33c('0x3'));var BPromise=require(_0xe33c('0x4'));var rp=require(_0xe33c('0x5'));var fs=require('fs');var path=require(_0xe33c('0x6'));var rimraf=require(_0xe33c('0x7'));var config=require('../../config/environment');var attributes=require(_0xe33c('0x8'));module['exports']=function(_0x58e08c,_0x4d04da){return _0x58e08c[_0xe33c('0x9')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xe33c('0xa'),'fields':['idField',_0xe33c('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd153=['request-promise','rimraf','../../config/environment','./intDeskField.attributes','exports','DeskField','desk_unique_index','idField','../../config/logger','api','moment','bluebird'];(function(_0x5025f1,_0x1b9cc3){var _0x3e6315=function(_0x111a32){while(--_0x111a32){_0x5025f1['push'](_0x5025f1['shift']());}};_0x3e6315(++_0x1b9cc3);}(_0xd153,0x170));var _0x3d15=function(_0x558151,_0x529494){_0x558151=_0x558151-0x0;var _0x55b7b6=_0xd153[_0x558151];return _0x55b7b6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3d15('0x0'))(_0x3d15('0x1'));var moment=require(_0x3d15('0x2'));var BPromise=require(_0x3d15('0x3'));var rp=require(_0x3d15('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d15('0x5'));var config=require(_0x3d15('0x6'));var attributes=require(_0x3d15('0x7'));module[_0x3d15('0x8')]=function(_0x9f3cc5,_0xf6420b){return _0x9f3cc5['define'](_0x3d15('0x9'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x3d15('0xa'),'fields':[_0x3d15('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index d4efbb4..b00be00 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 _0xe3a2=['debug','request\x20sent','stringify','error','code','message','result','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s'];(function(_0x3a7257,_0x30b139){var _0x467d25=function(_0x25f9d1){while(--_0x25f9d1){_0x3a7257['push'](_0x3a7257['shift']());}};_0x467d25(++_0x30b139);}(_0xe3a2,0x8b));var _0x2e3a=function(_0x21ac97,_0x3bc6ef){_0x21ac97=_0x21ac97-0x0;var _0x43432b=_0xe3a2[_0x21ac97];return _0x43432b;};'use strict';var _=require(_0x2e3a('0x0'));var util=require(_0x2e3a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e3a('0x2'));var db=require(_0x2e3a('0x3'))['db'];var utils=require(_0x2e3a('0x4'));var logger=require(_0x2e3a('0x5'))(_0x2e3a('0x6'));var config=require(_0x2e3a('0x7'));var jayson=require(_0x2e3a('0x8'));var client=jayson[_0x2e3a('0x9')][_0x2e3a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e8918,_0x6fd17d,_0x42a9df){return new BPromise(function(_0x3c6633,_0x39a312){return client[_0x2e3a('0xb')](_0x2e8918,_0x42a9df)[_0x2e3a('0xc')](function(_0x249035){logger[_0x2e3a('0xd')](_0x2e3a('0xe'),_0x6fd17d,'request\x20sent');logger[_0x2e3a('0xf')]('DeskField,\x20%s,\x20%s,\x20%s',_0x6fd17d,_0x2e3a('0x10'),JSON[_0x2e3a('0x11')](_0x249035));if(_0x249035[_0x2e3a('0x12')]){if(_0x249035[_0x2e3a('0x12')][_0x2e3a('0x13')]===0x1f4){logger[_0x2e3a('0x12')]('DeskField,\x20%s,\x20%s',_0x6fd17d,_0x249035[_0x2e3a('0x12')][_0x2e3a('0x14')]);return _0x39a312(_0x249035[_0x2e3a('0x12')][_0x2e3a('0x14')]);}logger[_0x2e3a('0x12')](_0x2e3a('0xe'),_0x6fd17d,_0x249035[_0x2e3a('0x12')][_0x2e3a('0x14')]);return _0x3c6633(_0x249035[_0x2e3a('0x12')]['message']);}else{logger[_0x2e3a('0xd')](_0x2e3a('0xe'),_0x6fd17d,_0x2e3a('0x10'));_0x3c6633(_0x249035[_0x2e3a('0x15')][_0x2e3a('0x14')]);}})['catch'](function(_0x4bf54a){logger[_0x2e3a('0x12')]('DeskField,\x20%s,\x20%s',_0x6fd17d,_0x4bf54a);_0x39a312(_0x4bf54a);});});} \ No newline at end of file +var _0xdf79=['result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4efc22,_0x375721){var _0x54d82e=function(_0x12afaf){while(--_0x12afaf){_0x4efc22['push'](_0x4efc22['shift']());}};_0x54d82e(++_0x375721);}(_0xdf79,0x120));var _0x9df7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdf79[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x9df7('0x0'));var moment=require(_0x9df7('0x1'));var BPromise=require('bluebird');var rs=require(_0x9df7('0x2'));var fs=require('fs');var Redis=require(_0x9df7('0x3'));var db=require(_0x9df7('0x4'))['db'];var utils=require(_0x9df7('0x5'));var logger=require(_0x9df7('0x6'))(_0x9df7('0x7'));var config=require('../../config/environment');var jayson=require(_0x9df7('0x8'));var client=jayson['client'][_0x9df7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e42c5,_0x5f2fda,_0x19e9c5){return new BPromise(function(_0x4bda3c,_0x5489f6){return client[_0x9df7('0xa')](_0x4e42c5,_0x19e9c5)[_0x9df7('0xb')](function(_0x50c46b){logger[_0x9df7('0xc')](_0x9df7('0xd'),_0x5f2fda,_0x9df7('0xe'));logger[_0x9df7('0xf')](_0x9df7('0x10'),_0x5f2fda,_0x9df7('0xe'),JSON[_0x9df7('0x11')](_0x50c46b));if(_0x50c46b['error']){if(_0x50c46b[_0x9df7('0x12')]['code']===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x5f2fda,_0x50c46b['error'][_0x9df7('0x13')]);return _0x5489f6(_0x50c46b[_0x9df7('0x12')][_0x9df7('0x13')]);}logger[_0x9df7('0x12')](_0x9df7('0xd'),_0x5f2fda,_0x50c46b[_0x9df7('0x12')]['message']);return _0x4bda3c(_0x50c46b[_0x9df7('0x12')][_0x9df7('0x13')]);}else{logger[_0x9df7('0xc')]('DeskField,\x20%s,\x20%s',_0x5f2fda,'request\x20sent');_0x4bda3c(_0x50c46b[_0x9df7('0x14')][_0x9df7('0x13')]);}})[_0x9df7('0x15')](function(_0x4e0dc1){logger[_0x9df7('0x12')](_0x9df7('0xd'),_0x5f2fda,_0x4e0dc1);_0x5489f6(_0x4e0dc1);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 3c93a16..062f342 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 _0xed7c=['index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get'];(function(_0x1bda09,_0x1d8be5){var _0x17be2d=function(_0x637732){while(--_0x637732){_0x1bda09['push'](_0x1bda09['shift']());}};_0x17be2d(++_0x1d8be5);}(_0xed7c,0xc6));var _0xced7=function(_0x3ab147,_0x2a30ef){_0x3ab147=_0x3ab147-0x0;var _0x243fb2=_0xed7c[_0x3ab147];return _0x243fb2;};'use strict';var multer=require('multer');var util=require(_0xced7('0x0'));var path=require(_0xced7('0x1'));var timeout=require(_0xced7('0x2'));var express=require(_0xced7('0x3'));var router=express[_0xced7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xced7('0x5'));var config=require(_0xced7('0x6'));var controller=require(_0xced7('0x7'));router[_0xced7('0x8')]('/',auth['isAuthenticated'](),controller[_0xced7('0x9')]);router['get']('/:id',auth[_0xced7('0xa')](),controller[_0xced7('0xb')]);router['get'](_0xced7('0xc'),auth[_0xced7('0xa')](),controller[_0xced7('0xd')]);router[_0xced7('0x8')](_0xced7('0xe'),auth['isAuthenticated'](),controller[_0xced7('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xced7('0x10')]);router['post'](_0xced7('0xc'),auth['isAuthenticated'](),controller[_0xced7('0x11')]);router['put']('/:id',auth[_0xced7('0xa')](),controller[_0xced7('0x12')]);router[_0xced7('0x13')](_0xced7('0x14'),auth[_0xced7('0xa')](),controller[_0xced7('0x15')]);module[_0xced7('0x16')]=router; \ No newline at end of file +var _0x22c7=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','update','delete','/:id','exports','util','connect-timeout','express','Router','../../components/interaction/service','./intDynamics365Account.controller','get','isAuthenticated','index','show'];(function(_0x2181e0,_0x165371){var _0x10137e=function(_0x5dcab0){while(--_0x5dcab0){_0x2181e0['push'](_0x2181e0['shift']());}};_0x10137e(++_0x165371);}(_0x22c7,0xb4));var _0x722c=function(_0x3c37f7,_0x229f16){_0x3c37f7=_0x3c37f7-0x0;var _0xe42b4d=_0x22c7[_0x3c37f7];return _0xe42b4d;};'use strict';var multer=require('multer');var util=require(_0x722c('0x0'));var path=require('path');var timeout=require(_0x722c('0x1'));var express=require(_0x722c('0x2'));var router=express[_0x722c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x722c('0x4'));var config=require('../../config/environment');var controller=require(_0x722c('0x5'));router[_0x722c('0x6')]('/',auth[_0x722c('0x7')](),controller[_0x722c('0x8')]);router['get']('/:id',auth[_0x722c('0x7')](),controller[_0x722c('0x9')]);router[_0x722c('0x6')](_0x722c('0xa'),auth['isAuthenticated'](),controller[_0x722c('0xb')]);router[_0x722c('0x6')](_0x722c('0xc'),auth[_0x722c('0x7')](),controller[_0x722c('0xd')]);router[_0x722c('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x722c('0xe')](_0x722c('0xa'),auth[_0x722c('0x7')](),controller['addConfiguration']);router['put']('/:id',auth[_0x722c('0x7')](),controller[_0x722c('0xf')]);router[_0x722c('0x10')](_0x722c('0x11'),auth[_0x722c('0x7')](),controller['destroy']);module[_0x722c('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 34d7550..bb99626 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 _0x7409=['exports','STRING','sequelize'];(function(_0x5cf1cf,_0x3ccd01){var _0x431619=function(_0x516b5c){while(--_0x516b5c){_0x5cf1cf['push'](_0x5cf1cf['shift']());}};_0x431619(++_0x3ccd01);}(_0x7409,0x6e));var _0x9740=function(_0x2becba,_0x4ea656){_0x2becba=_0x2becba-0x0;var _0x90b5dd=_0x7409[_0x2becba];return _0x90b5dd;};'use strict';var Sequelize=require(_0x9740('0x0'));module[_0x9740('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9740('0x2')]},'password':{'type':Sequelize[_0x9740('0x2')]},'remoteUri':{'type':Sequelize[_0x9740('0x2')]},'tenantId':{'type':Sequelize[_0x9740('0x2')]},'clientId':{'type':Sequelize[_0x9740('0x2')]},'clientSecret':{'type':Sequelize[_0x9740('0x2')]},'serverUrl':{'type':Sequelize[_0x9740('0x2')]},'description':{'type':Sequelize[_0x9740('0x2')]}}; \ No newline at end of file +var _0xf761=['STRING','exports'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0xf761,0x14d));var _0x1f76=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0xf761[_0x2eb5bc];return _0x51c7b1;};'use strict';var Sequelize=require('sequelize');module[_0x1f76('0x0')]={'name':{'type':Sequelize[_0x1f76('0x1')]},'username':{'type':Sequelize[_0x1f76('0x1')]},'password':{'type':Sequelize[_0x1f76('0x1')]},'remoteUri':{'type':Sequelize[_0x1f76('0x1')]},'tenantId':{'type':Sequelize[_0x1f76('0x1')]},'clientId':{'type':Sequelize[_0x1f76('0x1')]},'clientSecret':{'type':Sequelize[_0x1f76('0x1')]},'serverUrl':{'type':Sequelize[_0x1f76('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index f396f64..b33fe7c 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 _0x361a=['where','pick','filter','merge','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','getConfigurations','addConfiguration','AccountId','getSubjects','channel','getDescriptions','Dynamics365Configuration','Dynamics365Field','Subjects','getFields','ticketType','incident','Incident','description','customerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidname','contractidname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_url','firstresponsebykpiidname','followupby','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','owneridname','owneridtype','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','socialprofileidname','statecode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','findOne','username','password','tenantId','clientSecret','remoteUri','slice','substring','lastIndexOf','%s/api/data/v9.0/','POST','/oauth2/token','clientId','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','4.0','Attributes','includes','LogicalName','@odata.type','PicklistAttributeMetadata','all','forEach','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','stack','send','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','EntityDefinitions(',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../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~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Account,\x20%s,\x20%s','result','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','name','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x4112f5,_0x304bfe){var _0x44b7e6=function(_0x4946d6){while(--_0x4946d6){_0x4112f5['push'](_0x4112f5['shift']());}};_0x44b7e6(++_0x304bfe);}(_0x361a,0x8e));var _0xa361=function(_0xd12150,_0x3e18c1){_0xd12150=_0xd12150-0x0;var _0x4cf402=_0x361a[_0xd12150];return _0x4cf402;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa361('0x0'));var jsonpatch=require(_0xa361('0x1'));var rp=require(_0xa361('0x2'));var moment=require(_0xa361('0x3'));var BPromise=require(_0xa361('0x4'));var Mustache=require(_0xa361('0x5'));var util=require(_0xa361('0x6'));var path=require(_0xa361('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa361('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa361('0x9'));var crypto=require('crypto');var jsforce=require(_0xa361('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa361('0xb'));var querystring=require(_0xa361('0xc'));var Papa=require(_0xa361('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa361('0xe'));var as=require(_0xa361('0xf'));var hardwareService=require(_0xa361('0x10'));var logger=require('../../config/logger')(_0xa361('0x11'));var utils=require(_0xa361('0x12'));var config=require(_0xa361('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa361('0x14'));var jayson=require(_0xa361('0x15'));var client=jayson[_0xa361('0x16')][_0xa361('0x17')]({'port':0x232a});function checkPasswordPattern(_0x1fc077,_0x3d9376,_0x366ea3){if(_0x366ea3){var _0x5b7e6a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b7e6a[_0xa361('0x18')](_0x3d9376)){return _0x1fc077;}else{throw new db[(_0xa361('0x19'))]['ValidationError'](_0xa361('0x1a'));}}else{return _0x1fc077;}}function respondWithRpcPromise(_0x1a4c07,_0x8077a7,_0x405698,_0x49f691){return new BPromise(function(_0x3e6385,_0x4919a5){var _0x227747=_0x49f691||client;return _0x227747[_0xa361('0x1b')](_0x1a4c07,_0x405698)[_0xa361('0x1c')](function(_0x343924){logger[_0xa361('0x1d')]('Dynamics365Account,\x20%s,\x20%s',_0x8077a7,_0xa361('0x1e'));logger['debug'](_0xa361('0x1f'),_0x8077a7,_0xa361('0x1e'),JSON[_0xa361('0x20')](_0x343924));if(_0x343924[_0xa361('0x21')]){if(_0x343924[_0xa361('0x21')][_0xa361('0x22')]===0x1f4){logger[_0xa361('0x21')]('Dynamics365Account,\x20%s,\x20%s',_0x8077a7,_0x343924[_0xa361('0x21')][_0xa361('0x23')]);return _0x4919a5(_0x343924[_0xa361('0x21')][_0xa361('0x23')]);}logger[_0xa361('0x21')]('Dynamics365Account,\x20%s,\x20%s',_0x8077a7,_0x343924['error'][_0xa361('0x23')]);return _0x3e6385(_0x343924[_0xa361('0x21')][_0xa361('0x23')]);}else{logger[_0xa361('0x1d')](_0xa361('0x24'),_0x8077a7,'request\x20sent');_0x3e6385(_0x343924[_0xa361('0x25')][_0xa361('0x23')]);}})['catch'](function(_0x5525b8){logger[_0xa361('0x21')](_0xa361('0x24'),_0x8077a7,_0x5525b8);_0x4919a5(_0x5525b8);});});}function respondWithStatusCode(_0x595eac,_0x43212f){_0x43212f=_0x43212f||0xcc;return function(_0x3d6001){if(_0x3d6001){return _0x595eac['sendStatus'](_0x43212f);}return _0x595eac[_0xa361('0x26')](_0x43212f)[_0xa361('0x27')]();};}function respondWithResult(_0x4a6b2f,_0x19c45b){_0x19c45b=_0x19c45b||0xc8;return function(_0x1d0dd0){if(_0x1d0dd0){return _0x4a6b2f[_0xa361('0x26')](_0x19c45b)[_0xa361('0x28')](_0x1d0dd0);}};}function respondWithFilteredResult(_0x5a37ee,_0x45f758){return function(_0x560936){if(_0x560936){var _0x397c42=_0x560936[_0xa361('0x29')],_0x1dd490=_0x45f758[_0xa361('0x2a')],_0x3d452f=_0x45f758[_0xa361('0x2a')]+_0x45f758[_0xa361('0x2b')],_0x192557;if(_0x3d452f>=_0x397c42){_0x3d452f=_0x397c42;_0x192557=0xc8;}else{_0x192557=0xce;}_0x5a37ee[_0xa361('0x26')](_0x192557);return _0x5a37ee[_0xa361('0x2c')](_0xa361('0x2d'),_0x1dd490+'-'+_0x3d452f+'/'+_0x397c42)[_0xa361('0x28')](_0x560936);}return null;};}function patchUpdates(_0x435509){return function(_0x17b3b3){try{jsonpatch[_0xa361('0x2e')](_0x17b3b3,_0x435509,!![]);}catch(_0x17f6dc){return BPromise[_0xa361('0x2f')](_0x17f6dc);}return _0x17b3b3['save']();};}function saveUpdates(_0x457e54,_0x13c60c){return function(_0x176281){if(_0x176281){return _0x176281[_0xa361('0x30')](_0x457e54)[_0xa361('0x1c')](function(_0x12af0e){return _0x12af0e;});}return null;};}function removeEntity(_0x2167ef,_0x17a79f){return function(_0xc296ec){if(_0xc296ec){return _0xc296ec[_0xa361('0x31')]()[_0xa361('0x1c')](function(){_0x2167ef[_0xa361('0x26')](0xcc)[_0xa361('0x27')]();});}};}function handleEntityNotFound(_0x3d7d49,_0x5c983e){return function(_0x513355){if(!_0x513355){_0x3d7d49[_0xa361('0x32')](0x194);}return _0x513355;};}function handleError(_0x56def2,_0x204cdc){_0x204cdc=_0x204cdc||0x1f4;return function(_0x1c347e){logger[_0xa361('0x21')](_0x1c347e['stack']);if(_0x1c347e[_0xa361('0x33')]){delete _0x1c347e['name'];}_0x56def2[_0xa361('0x26')](_0x204cdc)['send'](_0x1c347e);};}exports['index']=function(_0x1c45bf,_0x311524){var _0x3f58bf={},_0xeccf5={},_0x34b3b1={'count':0x0,'rows':[]};var _0x580751=_[_0xa361('0x34')](db[_0xa361('0x35')][_0xa361('0x36')],function(_0x48b8e4){return{'name':_0x48b8e4[_0xa361('0x37')],'type':_0x48b8e4[_0xa361('0x38')][_0xa361('0x39')]};});_0xeccf5[_0xa361('0x3a')]=_[_0xa361('0x34')](_0x580751,_0xa361('0x33'));_0xeccf5['query']=_['keys'](_0x1c45bf['query']);_0xeccf5[_0xa361('0x3b')]=_[_0xa361('0x3c')](_0xeccf5['model'],_0xeccf5[_0xa361('0x3d')]);_0x3f58bf[_0xa361('0x3e')]=_[_0xa361('0x3c')](_0xeccf5['model'],qs[_0xa361('0x3f')](_0x1c45bf['query'][_0xa361('0x3f')]));_0x3f58bf[_0xa361('0x3e')]=_0x3f58bf[_0xa361('0x3e')][_0xa361('0x40')]?_0x3f58bf[_0xa361('0x3e')]:_0xeccf5['model'];if(!_0x1c45bf['query'][_0xa361('0x41')](_0xa361('0x42'))){_0x3f58bf[_0xa361('0x2b')]=qs[_0xa361('0x2b')](_0x1c45bf[_0xa361('0x3d')]['limit']);_0x3f58bf[_0xa361('0x2a')]=qs[_0xa361('0x2a')](_0x1c45bf[_0xa361('0x3d')][_0xa361('0x2a')]);}_0x3f58bf[_0xa361('0x43')]=qs[_0xa361('0x44')](_0x1c45bf['query'][_0xa361('0x44')]);_0x3f58bf[_0xa361('0x45')]=qs[_0xa361('0x3b')](_[_0xa361('0x46')](_0x1c45bf[_0xa361('0x3d')],_0xeccf5[_0xa361('0x3b')]));if(_0x1c45bf['query'][_0xa361('0x47')]){_0x3f58bf[_0xa361('0x45')]=_[_0xa361('0x48')](_0x3f58bf[_0xa361('0x45')],{'$or':_['map'](_0x580751,function(_0x16049c){if(_0x16049c[_0xa361('0x38')]!=='VIRTUAL'){var _0x28bbeb={};_0x28bbeb[_0x16049c[_0xa361('0x33')]]={'$like':'%'+_0x1c45bf['query']['filter']+'%'};return _0x28bbeb;}})});}_0x3f58bf=_['merge']({},_0x3f58bf,_0x1c45bf['options']);var _0x4fb25a={'where':_0x3f58bf[_0xa361('0x45')]};return db['Dynamics365Account'][_0xa361('0x29')](_0x4fb25a)['then'](function(_0x4a9b9c){_0x34b3b1['count']=_0x4a9b9c;if(_0x1c45bf[_0xa361('0x3d')][_0xa361('0x49')]){_0x3f58bf[_0xa361('0x4a')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xa361('0x4b')](_0x3f58bf);})[_0xa361('0x1c')](function(_0x53f094){_0x34b3b1['rows']=_0x53f094;return _0x34b3b1;})[_0xa361('0x1c')](respondWithFilteredResult(_0x311524,_0x3f58bf))[_0xa361('0x4c')](handleError(_0x311524,null));};exports[_0xa361('0x4d')]=function(_0x37e184,_0x4bfc99){var _0x444778={'raw':![],'where':{'id':_0x37e184[_0xa361('0x4e')]['id']}},_0x443628={};_0x443628[_0xa361('0x3a')]=_[_0xa361('0x4f')](db[_0xa361('0x35')][_0xa361('0x36')]);_0x443628[_0xa361('0x3d')]=_['keys'](_0x37e184[_0xa361('0x3d')]);_0x443628['filters']=_['intersection'](_0x443628[_0xa361('0x3a')],_0x443628['query']);_0x444778[_0xa361('0x3e')]=_[_0xa361('0x3c')](_0x443628[_0xa361('0x3a')],qs[_0xa361('0x3f')](_0x37e184['query']['fields']));_0x444778[_0xa361('0x3e')]=_0x444778[_0xa361('0x3e')][_0xa361('0x40')]?_0x444778[_0xa361('0x3e')]:_0x443628[_0xa361('0x3a')];if(_0x37e184['query'][_0xa361('0x49')]){_0x444778[_0xa361('0x4a')]=[{'all':!![]}];}_0x444778=_[_0xa361('0x48')]({},_0x444778,_0x37e184[_0xa361('0x50')]);return db[_0xa361('0x35')][_0xa361('0x51')](_0x444778)['then'](handleEntityNotFound(_0x4bfc99,null))['then'](respondWithResult(_0x4bfc99,null))[_0xa361('0x4c')](handleError(_0x4bfc99,null));};exports[_0xa361('0x52')]=function(_0x57207c,_0x2faa16){return db['Dynamics365Account'][_0xa361('0x52')](_0x57207c['body'],{})[_0xa361('0x1c')](respondWithResult(_0x2faa16,0xc9))[_0xa361('0x4c')](handleError(_0x2faa16,null));};exports[_0xa361('0x30')]=function(_0x2a7bdd,_0x2dc692){if(_0x2a7bdd[_0xa361('0x53')]['id']){delete _0x2a7bdd[_0xa361('0x53')]['id'];}return db[_0xa361('0x35')]['find']({'where':{'id':_0x2a7bdd[_0xa361('0x4e')]['id']}})[_0xa361('0x1c')](handleEntityNotFound(_0x2dc692,null))[_0xa361('0x1c')](saveUpdates(_0x2a7bdd[_0xa361('0x53')],null))[_0xa361('0x1c')](respondWithResult(_0x2dc692,null))[_0xa361('0x4c')](handleError(_0x2dc692,null));};exports[_0xa361('0x31')]=function(_0x1934c7,_0x363a8c){return db[_0xa361('0x35')][_0xa361('0x51')]({'where':{'id':_0x1934c7['params']['id']}})[_0xa361('0x1c')](handleEntityNotFound(_0x363a8c,null))['then'](removeEntity(_0x363a8c,null))[_0xa361('0x4c')](handleError(_0x363a8c,null));};exports['getConfigurations']=function(_0x503d63,_0x24df53,_0x4d2725){var _0x20d5f4={};var _0x29feb4={};var _0x40708d;var _0x2c4729;return db['Dynamics365Account']['findOne']({'where':{'id':_0x503d63['params']['id']}})[_0xa361('0x1c')](handleEntityNotFound(_0x24df53,null))[_0xa361('0x1c')](function(_0x38f74c){if(_0x38f74c){_0x40708d=_0x38f74c;_0x29feb4[_0xa361('0x3a')]=_[_0xa361('0x4f')](db['Dynamics365Configuration'][_0xa361('0x36')]);_0x29feb4[_0xa361('0x3d')]=_['keys'](_0x503d63[_0xa361('0x3d')]);_0x29feb4[_0xa361('0x3b')]=_['intersection'](_0x29feb4['model'],_0x29feb4['query']);_0x20d5f4['attributes']=_[_0xa361('0x3c')](_0x29feb4[_0xa361('0x3a')],qs[_0xa361('0x3f')](_0x503d63[_0xa361('0x3d')][_0xa361('0x3f')]));_0x20d5f4[_0xa361('0x3e')]=_0x20d5f4['attributes']['length']?_0x20d5f4['attributes']:_0x29feb4[_0xa361('0x3a')];_0x20d5f4[_0xa361('0x43')]=qs[_0xa361('0x44')](_0x503d63[_0xa361('0x3d')][_0xa361('0x44')]);_0x20d5f4[_0xa361('0x45')]=qs['filters'](_[_0xa361('0x46')](_0x503d63[_0xa361('0x3d')],_0x29feb4[_0xa361('0x3b')]));if(_0x503d63[_0xa361('0x3d')][_0xa361('0x47')]){_0x20d5f4[_0xa361('0x45')]=_[_0xa361('0x48')](_0x20d5f4[_0xa361('0x45')],{'$or':_['map'](_0x20d5f4[_0xa361('0x3e')],function(_0x2775cb){var _0x12afc9={};_0x12afc9[_0x2775cb]={'$like':'%'+_0x503d63[_0xa361('0x3d')][_0xa361('0x47')]+'%'};return _0x12afc9;})});}_0x20d5f4=_[_0xa361('0x48')]({},_0x20d5f4,_0x503d63[_0xa361('0x50')]);return _0x40708d[_0xa361('0x54')](_0x20d5f4);}})['then'](function(_0x1611db){if(_0x1611db){_0x2c4729=_0x1611db['length'];if(!_0x503d63[_0xa361('0x3d')][_0xa361('0x41')](_0xa361('0x42'))){_0x20d5f4[_0xa361('0x2b')]=qs[_0xa361('0x2b')](_0x503d63[_0xa361('0x3d')][_0xa361('0x2b')]);_0x20d5f4['offset']=qs[_0xa361('0x2a')](_0x503d63[_0xa361('0x3d')][_0xa361('0x2a')]);}return _0x40708d[_0xa361('0x54')](_0x20d5f4);}})['then'](function(_0x2c28c2){if(_0x2c28c2){return _0x2c28c2?{'count':_0x2c4729,'rows':_0x2c28c2}:null;}})['then'](respondWithResult(_0x24df53,null))[_0xa361('0x4c')](handleError(_0x24df53,null));};exports[_0xa361('0x55')]=function(_0x404318,_0x180221,_0x25d290){if(_0x404318[_0xa361('0x53')]['id']){delete _0x404318[_0xa361('0x53')]['id'];}return db[_0xa361('0x35')]['findOne']({'where':{'id':_0x404318[_0xa361('0x4e')]['id']}})[_0xa361('0x1c')](handleEntityNotFound(_0x180221,null))[_0xa361('0x1c')](function(_0x513d09){if(_0x513d09){_0x404318['body'][_0xa361('0x56')]=_0x513d09['id'];_0x404318[_0xa361('0x53')]['Subjects']=integrations[_0xa361('0x57')](_0x404318['body'][_0xa361('0x58')],_0x404318[_0xa361('0x53')][_0xa361('0x38')]);_0x404318['body']['Descriptions']=integrations[_0xa361('0x59')](_0x404318[_0xa361('0x53')][_0xa361('0x58')],_0x404318[_0xa361('0x53')]['type']);return db[_0xa361('0x5a')][_0xa361('0x52')](_0x404318[_0xa361('0x53')],{'include':[{'model':db[_0xa361('0x5b')],'as':_0xa361('0x5c')},{'model':db[_0xa361('0x5b')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x180221,null))['catch'](handleError(_0x180221,null));};exports[_0xa361('0x5d')]=function(_0x3998ce,_0x392ce2,_0x83f6a){var _0x459fe0=_0x3998ce['query'][_0xa361('0x5e')];var _0x3a4166=_0x459fe0===_0xa361('0x5f')?_0xa361('0x60'):'PhoneCall';var _0xb87c52='';var _0xd33fd4='';var _0x418d43='';var _0x141651='';var _0x5cad66='';var _0xe1aa6d='';var _0x14b48e='';var _0x1d1a43='';var _0xed8334=['title',_0xa361('0x61'),_0xa361('0x62'),'ownerid',_0xa361('0x63'),_0xa361('0x64'),_0xa361('0x65'),_0xa361('0x66'),_0xa361('0x67'),_0xa361('0x68')];var _0x3ec932=[_0xa361('0x69'),_0xa361('0x6a'),_0xa361('0x6b'),'billedserviceunits',_0xa361('0x6c'),'contactidyominame','contractdetailidname',_0xa361('0x6d'),'createdbyexternalpartyname',_0xa361('0x6e'),'createdbyname',_0xa361('0x6f'),_0xa361('0x70'),_0xa361('0x71'),_0xa361('0x72'),_0xa361('0x73'),_0xa361('0x74'),_0xa361('0x75'),_0xa361('0x76'),'entitlementidname','entityimage_timestamp',_0xa361('0x77'),'escalatedon','exchangerate',_0xa361('0x78'),_0xa361('0x79'),'importsequencenumber','influencescore',_0xa361('0x7a'),'lastonholdtime','masteridname',_0xa361('0x7b'),_0xa361('0x7c'),_0xa361('0x7d'),'modifiedbyyominame',_0xa361('0x7e'),_0xa361('0x7f'),'modifiedonbehalfbyyominame',_0xa361('0x80'),_0xa361('0x81'),'numberofchildincidents',_0xa361('0x82'),'overriddencreatedon',_0xa361('0x83'),_0xa361('0x84'),'owneridyominame','parentcaseidname',_0xa361('0x85'),_0xa361('0x86'),_0xa361('0x87'),_0xa361('0x88'),_0xa361('0x89'),_0xa361('0x8a'),_0xa361('0x8b'),_0xa361('0x8c'),_0xa361('0x8d'),'responsiblecontactidyominame',_0xa361('0x8e'),_0xa361('0x8f'),'slaname',_0xa361('0x90'),_0xa361('0x91'),'statuscode',_0xa361('0x92'),_0xa361('0x93'),'timezoneruleversionnumber',_0xa361('0x94'),_0xa361('0x95'),_0xa361('0x96'),_0xa361('0x97')];var _0x16ce3f=_0xed8334[_0xa361('0x98')](_0x3ec932);return db[_0xa361('0x35')][_0xa361('0x99')]({'where':{'id':_0x3998ce[_0xa361('0x4e')]['id']},'attributes':['id',_0xa361('0x9a'),_0xa361('0x9b'),'remoteUri',_0xa361('0x9c'),'clientId',_0xa361('0x9d')]})[_0xa361('0x1c')](handleEntityNotFound(_0x392ce2,null))[_0xa361('0x1c')](function(_0x51b8c7){if(_0x51b8c7){_0x1d1a43=_0x51b8c7[_0xa361('0x9e')];var _0x377162=_0x1d1a43[_0xa361('0x9f')](-0x1);if(_0x377162==='/'){_0x1d1a43=_0x1d1a43[_0xa361('0xa0')](0x0,_0x1d1a43[_0xa361('0xa1')](_0x377162));}_0x14b48e=util['format'](_0xa361('0xa2'),_0x1d1a43);var _0x28e0cd={'method':_0xa361('0xa3'),'uri':'https://login.microsoftonline.com/'+_0x51b8c7['tenantId']+_0xa361('0xa4'),'form':{'client_id':_0x51b8c7[_0xa361('0xa5')],'resource':_0x1d1a43,'username':_0x51b8c7[_0xa361('0x9a')],'password':_0x51b8c7[_0xa361('0x9b')],'grant_type':_0xa361('0x9b'),'client_secret':_0x51b8c7['clientSecret']},'json':!![]};return rp(_0x28e0cd);}})[_0xa361('0x1c')](function(_0x261a11){_0xe1aa6d=_0x261a11[_0xa361('0xa6')];var _0x1d7adf={'method':_0xa361('0xa7'),'uri':encodeURI(_0x14b48e+_0xa361('0xa8')+_0x3a4166+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0xe1aa6d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1d7adf);})[_0xa361('0x1c')](function(_0x41411d){var _0x14e379=_0x41411d['value'][0x0];var _0x31b226=_0x14e379[_0xa361('0xa9')];var _0x12c8c8={'method':_0xa361('0xa7'),'uri':_0x14b48e+'EntityDefinitions('+_0x31b226+_0xa361('0xaa'),'headers':{'Authorization':_0xa361('0xab')+_0xe1aa6d,'If-None-Match':null,'OData-Version':_0xa361('0xac')},'json':!![]};return rp(_0x12c8c8);})[_0xa361('0x1c')](function(_0xf43751){_0xb87c52=_0xf43751;_0xd33fd4=_0xb87c52[_0xa361('0xad')];_0xd33fd4=_['remove'](_0xd33fd4,function(_0x417be){return!_0x16ce3f[_0xa361('0xae')](_0x417be[_0xa361('0xaf')]);});var _0x599b65=[];var _0x54fd20=[];_0xd33fd4['forEach'](function(_0x374f15){if(_0x374f15[_0xa361('0xb0')]){var _0x58c86c=_0x374f15[_0xa361('0xb0')][_0xa361('0xa0')](_0x374f15['@odata.type'][_0xa361('0xa1')]('.')+0x1);if(_0x58c86c===_0xa361('0xb1')){_0x599b65['push'](getSelectList(_0x14b48e,_0x459fe0,_0x54fd20,_0xb87c52[_0xa361('0xa9')],_0x374f15[_0xa361('0xa9')],_0xe1aa6d));}}});return Promise[_0xa361('0xb2')](_0x599b65);})[_0xa361('0x1c')](function(_0x5ccf6a){_0x418d43=_0x5ccf6a[0x0];var _0x40768e=[];var _0x4a22f8=[];_0xd33fd4[_0xa361('0xb3')](function(_0x5b2bd4){if(!_[_0xa361('0xb4')](_0x5b2bd4[_0xa361('0xb0')])){var _0x2601f4=_0x5b2bd4[_0xa361('0xb0')][_0xa361('0xa0')](_0x5b2bd4[_0xa361('0xb0')]['lastIndexOf']('.')+0x1);if(_0x2601f4===_0xa361('0xb5')){_0x40768e[_0xa361('0xb6')](getBooleanList(_0x14b48e,_0x459fe0,_0x4a22f8,_0xb87c52[_0xa361('0xa9')],_0x5b2bd4[_0xa361('0xa9')],_0xe1aa6d));}}});return Promise[_0xa361('0xb2')](_0x40768e);})['then'](function(_0x153848){_0x141651=_0x153848[0x0];var _0x219675=[];var _0x1ad550=[];_0xd33fd4['forEach'](function(_0x2efad5){if(_0x2efad5[_0xa361('0xb0')]){var _0x1622de=_0x2efad5[_0xa361('0xb0')][_0xa361('0xa0')](_0x2efad5[_0xa361('0xb0')][_0xa361('0xa1')]('.')+0x1);if(_0x1622de===_0xa361('0xb7')||_0x1622de===_0xa361('0xb8')||_0x1622de===_0xa361('0xb9')||_0x1622de===_0xa361('0xba')||_0x1622de===_0xa361('0xbb')||_0x1622de===_0xa361('0xbc')||_0x1622de==='StatusAttributeMetadata'||_0x1622de===_0xa361('0xbd')||_0x1622de===_0xa361('0xbe')||_0x1622de==='DecimalAttributeMetadata'){_0x219675['push'](getInputList(_0x14b48e,_0x459fe0,_0x1622de,_0x1ad550,_0xb87c52[_0xa361('0xa9')],_0x2efad5['MetadataId'],_0xe1aa6d));}}});return Promise[_0xa361('0xb2')](_0x219675);})[_0xa361('0x1c')](function(_0x38a0f7){_0x5cad66=_0x38a0f7[0x0];var _0x15f66f=_0x418d43[_0xa361('0x98')](_0x141651)[_0xa361('0x98')](_0x5cad66);var _0x240164={'count':_0x15f66f[_0xa361('0x40')],'rows':_0x15f66f};return _0x240164;})[_0xa361('0x1c')](respondWithResult(_0x392ce2,null))[_0xa361('0x4c')](function(_0x58eadd){var _0x4b8405=_0x3998ce[_0xa361('0x3d')][_0xa361('0x18')]?0x1f4:_0x58eadd['statusCode']||0x1f4;logger[_0xa361('0x21')](_0x58eadd[_0xa361('0xbf')]);delete _0x58eadd[_0xa361('0x33')];if(_0x4b8405===0x191){_0x4b8405=0x190;}_0x392ce2[_0xa361('0x26')](_0x4b8405)[_0xa361('0xc0')](_0x3998ce[_0xa361('0x3d')]['test']?{'message':_0xa361('0xc1'),'statusCode':_0x58eadd[_0xa361('0xc2')]}:_0x58eadd);});};function getSelectList(_0x541847,_0x2aaa98,_0x39ea3c,_0x1fdcb3,_0x4cb4c2,_0x8257d8){var _0x558889={'method':_0xa361('0xa7'),'uri':_0x541847+'EntityDefinitions('+_0x1fdcb3+_0xa361('0xc3')+_0x4cb4c2+_0xa361('0xc4')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xa361('0xab')+_0x8257d8,'If-None-Match':null,'OData-Version':_0xa361('0xac')},'json':!![]};return rp(_0x558889)[_0xa361('0x1c')](function(_0x877f33){var _0x33e2b7=[];var _0x23e694=_0x877f33[_0xa361('0xc5')][_0xa361('0xc6')];_0x23e694[_0xa361('0xb3')](function(_0x4a717c){_0x33e2b7['push']({'name':_0x4a717c[_0xa361('0xc7')][_0xa361('0xc8')][_0xa361('0xc7')],'value':String(_0x4a717c[_0xa361('0xc9')])});});var _0x1570eb={'id':_0x2aaa98+'_'+_0x877f33[_0xa361('0xaf')],'name':_0x877f33[_0xa361('0xca')][_0xa361('0xc8')][_0xa361('0xc7')],'custom':![],'options':_0x33e2b7};_0x39ea3c['push'](_0x1570eb);return _0x39ea3c;});}function getBooleanList(_0x273357,_0x347a43,_0x2eaf5f,_0x34df92,_0x28d1d1,_0x46fdce){var _0x66f17e={'method':_0xa361('0xa7'),'uri':_0x273357+'EntityDefinitions('+_0x34df92+_0xa361('0xc3')+_0x28d1d1+_0xa361('0xcb'),'headers':{'Authorization':_0xa361('0xab')+_0x46fdce,'If-None-Match':null,'OData-Version':_0xa361('0xac')},'json':!![]};return rp(_0x66f17e)[_0xa361('0x1c')](function(_0x163aca){var _0x1da56d=[];_0x1da56d[_0xa361('0xb6')]({'name':_0x163aca[_0xa361('0xc5')][_0xa361('0xcc')][_0xa361('0xc7')][_0xa361('0xc8')][_0xa361('0xc7')],'value':_0xa361('0xcd')},{'name':_0x163aca[_0xa361('0xc5')][_0xa361('0xce')][_0xa361('0xc7')]['UserLocalizedLabel'][_0xa361('0xc7')],'value':_0xa361('0xcf')});var _0x74ce82={'id':_0x347a43+'_'+_0x163aca[_0xa361('0xaf')],'name':_0x163aca[_0xa361('0xca')][_0xa361('0xc8')]['Label'],'custom':![],'options':_0x1da56d};_0x2eaf5f[_0xa361('0xb6')](_0x74ce82);return _0x2eaf5f;});}function getInputList(_0x18f47b,_0x32c928,_0x50a8c4,_0x4de036,_0x5254e8,_0x5031b3,_0x2bb8cf){var _0x45105b={'method':'GET','uri':_0x18f47b+_0xa361('0xd0')+_0x5254e8+_0xa361('0xc3')+_0x5031b3+_0xa361('0xd1')+_0x50a8c4+_0xa361('0xd2'),'headers':{'Authorization':_0xa361('0xab')+_0x2bb8cf,'If-None-Match':null,'OData-Version':_0xa361('0xac')},'json':!![]};return rp(_0x45105b)[_0xa361('0x1c')](function(_0xf6fc54){var _0xa64c08={'id':_0x32c928+'_'+_0xf6fc54[_0xa361('0xaf')],'name':_0xf6fc54[_0xa361('0xca')][_0xa361('0xc8')]?_0xf6fc54[_0xa361('0xca')]['UserLocalizedLabel'][_0xa361('0xc7')]:_0xf6fc54[_0xa361('0xaf')],'custom':![],'options':[]};_0x4de036[_0xa361('0xb6')](_0xa64c08);return _0x4de036;});} \ No newline at end of file +var _0x4d6e=['Dynamics365Field','getFields','Incident','description','customerid','caseorigincode','subject','phonenumber','directioncode','accountidname','accountidyominame','actualserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','concat','username','remoteUri','tenantId','clientId','clientSecret','substring','lastIndexOf','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','Wrong\x20credentials','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','DisplayName','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','Dynamics365Account','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','intersection','find','create','body','destroy','getConfigurations','findOne','rawAttributes','order','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Subjects'];(function(_0xa35666,_0x19fb8a){var _0x4b2d2f=function(_0x5d3fca){while(--_0x5d3fca){_0xa35666['push'](_0xa35666['shift']());}};_0x4b2d2f(++_0x19fb8a);}(_0x4d6e,0x77));var _0xe4d6=function(_0x4be774,_0x5b2d48){_0x4be774=_0x4be774-0x0;var _0x31d1c9=_0x4d6e[_0x4be774];return _0x31d1c9;};'use strict';var pdf=require(_0xe4d6('0x0'));var emlformat=require(_0xe4d6('0x1'));var rimraf=require(_0xe4d6('0x2'));var zipdir=require(_0xe4d6('0x3'));var jsonpatch=require(_0xe4d6('0x4'));var rp=require('request-promise');var moment=require(_0xe4d6('0x5'));var BPromise=require(_0xe4d6('0x6'));var Mustache=require(_0xe4d6('0x7'));var util=require(_0xe4d6('0x8'));var path=require(_0xe4d6('0x9'));var sox=require(_0xe4d6('0xa'));var csv=require(_0xe4d6('0xb'));var ejs=require(_0xe4d6('0xc'));var fs=require('fs');var _=require(_0xe4d6('0xd'));var squel=require(_0xe4d6('0xe'));var crypto=require(_0xe4d6('0xf'));var jsforce=require(_0xe4d6('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe4d6('0xb'));var querystring=require(_0xe4d6('0x11'));var Papa=require('papaparse');var Redis=require(_0xe4d6('0x12'));var authService=require(_0xe4d6('0x13'));var qs=require(_0xe4d6('0x14'));var as=require(_0xe4d6('0x15'));var hardwareService=require(_0xe4d6('0x16'));var logger=require(_0xe4d6('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xe4d6('0x18'));var db=require(_0xe4d6('0x19'))['db'];var integrations=require(_0xe4d6('0x1a'));var jayson=require('jayson/promise');var client=jayson[_0xe4d6('0x1b')][_0xe4d6('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x53eac7,_0x286bf4,_0xf0062e){if(_0xf0062e){var _0x5dbcc5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5dbcc5[_0xe4d6('0x1d')](_0x286bf4)){return _0x53eac7;}else{throw new db[(_0xe4d6('0x1e'))][(_0xe4d6('0x1f'))](_0xe4d6('0x20'));}}else{return _0x53eac7;}}function respondWithRpcPromise(_0x53ca26,_0x2e04a9,_0x28e001,_0x3dbe31){return new BPromise(function(_0x1ca3fb,_0x5b6231){var _0x41d1a7=_0x3dbe31||client;return _0x41d1a7['request'](_0x53ca26,_0x28e001)['then'](function(_0x24e9cb){logger[_0xe4d6('0x21')](_0xe4d6('0x22'),_0x2e04a9,_0xe4d6('0x23'));logger[_0xe4d6('0x24')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x2e04a9,_0xe4d6('0x23'),JSON[_0xe4d6('0x25')](_0x24e9cb));if(_0x24e9cb[_0xe4d6('0x26')]){if(_0x24e9cb[_0xe4d6('0x26')][_0xe4d6('0x27')]===0x1f4){logger[_0xe4d6('0x26')](_0xe4d6('0x22'),_0x2e04a9,_0x24e9cb[_0xe4d6('0x26')]['message']);return _0x5b6231(_0x24e9cb[_0xe4d6('0x26')]['message']);}logger[_0xe4d6('0x26')](_0xe4d6('0x22'),_0x2e04a9,_0x24e9cb[_0xe4d6('0x26')][_0xe4d6('0x28')]);return _0x1ca3fb(_0x24e9cb[_0xe4d6('0x26')][_0xe4d6('0x28')]);}else{logger[_0xe4d6('0x21')](_0xe4d6('0x22'),_0x2e04a9,'request\x20sent');_0x1ca3fb(_0x24e9cb[_0xe4d6('0x29')][_0xe4d6('0x28')]);}})['catch'](function(_0xb869f){logger[_0xe4d6('0x26')](_0xe4d6('0x22'),_0x2e04a9,_0xb869f);_0x5b6231(_0xb869f);});});}function respondWithStatusCode(_0x3e8f41,_0x13aeec){_0x13aeec=_0x13aeec||0xcc;return function(_0x2f467f){if(_0x2f467f){return _0x3e8f41[_0xe4d6('0x2a')](_0x13aeec);}return _0x3e8f41[_0xe4d6('0x2b')](_0x13aeec)['end']();};}function respondWithResult(_0x16d492,_0x152d16){_0x152d16=_0x152d16||0xc8;return function(_0x4daadb){if(_0x4daadb){return _0x16d492['status'](_0x152d16)['json'](_0x4daadb);}};}function respondWithFilteredResult(_0x2b732e,_0x4a7e63){return function(_0x3d2efe){if(_0x3d2efe){var _0x4b83fa=_0x3d2efe['count'],_0x4f0485=_0x4a7e63[_0xe4d6('0x2c')],_0x39f7d5=_0x4a7e63[_0xe4d6('0x2c')]+_0x4a7e63['limit'],_0x4e45f0;if(_0x39f7d5>=_0x4b83fa){_0x39f7d5=_0x4b83fa;_0x4e45f0=0xc8;}else{_0x4e45f0=0xce;}_0x2b732e['status'](_0x4e45f0);return _0x2b732e[_0xe4d6('0x2d')](_0xe4d6('0x2e'),_0x4f0485+'-'+_0x39f7d5+'/'+_0x4b83fa)['json'](_0x3d2efe);}return null;};}function patchUpdates(_0xc58fcb){return function(_0x46403e){try{jsonpatch[_0xe4d6('0x2f')](_0x46403e,_0xc58fcb,!![]);}catch(_0x4479b8){return BPromise[_0xe4d6('0x30')](_0x4479b8);}return _0x46403e[_0xe4d6('0x31')]();};}function saveUpdates(_0x48cf65,_0x562070){return function(_0x9b089b){if(_0x9b089b){return _0x9b089b[_0xe4d6('0x32')](_0x48cf65)['then'](function(_0x306b31){return _0x306b31;});}return null;};}function removeEntity(_0x565df5,_0x45c9aa){return function(_0x5a0f9b){if(_0x5a0f9b){return _0x5a0f9b['destroy']()[_0xe4d6('0x33')](function(){_0x565df5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x25013a,_0x36ac8d){return function(_0x475bd6){if(!_0x475bd6){_0x25013a[_0xe4d6('0x2a')](0x194);}return _0x475bd6;};}function handleError(_0x49dde3,_0x170197){_0x170197=_0x170197||0x1f4;return function(_0x1ec931){logger[_0xe4d6('0x26')](_0x1ec931[_0xe4d6('0x34')]);if(_0x1ec931[_0xe4d6('0x35')]){delete _0x1ec931[_0xe4d6('0x35')];}_0x49dde3[_0xe4d6('0x2b')](_0x170197)[_0xe4d6('0x36')](_0x1ec931);};}exports[_0xe4d6('0x37')]=function(_0x270661,_0x4ab62e){var _0x24d2bb={},_0x570d34={},_0x203fe0={'count':0x0,'rows':[]};var _0x36c147=_[_0xe4d6('0x38')](db[_0xe4d6('0x39')]['rawAttributes'],function(_0x483121){return{'name':_0x483121[_0xe4d6('0x3a')],'type':_0x483121[_0xe4d6('0x3b')][_0xe4d6('0x3c')]};});_0x570d34[_0xe4d6('0x3d')]=_[_0xe4d6('0x38')](_0x36c147,_0xe4d6('0x35'));_0x570d34[_0xe4d6('0x3e')]=_['keys'](_0x270661[_0xe4d6('0x3e')]);_0x570d34[_0xe4d6('0x3f')]=_['intersection'](_0x570d34['model'],_0x570d34[_0xe4d6('0x3e')]);_0x24d2bb[_0xe4d6('0x40')]=_['intersection'](_0x570d34[_0xe4d6('0x3d')],qs[_0xe4d6('0x41')](_0x270661[_0xe4d6('0x3e')][_0xe4d6('0x41')]));_0x24d2bb['attributes']=_0x24d2bb[_0xe4d6('0x40')][_0xe4d6('0x42')]?_0x24d2bb[_0xe4d6('0x40')]:_0x570d34[_0xe4d6('0x3d')];if(!_0x270661[_0xe4d6('0x3e')][_0xe4d6('0x43')]('nolimit')){_0x24d2bb['limit']=qs['limit'](_0x270661[_0xe4d6('0x3e')][_0xe4d6('0x44')]);_0x24d2bb[_0xe4d6('0x2c')]=qs[_0xe4d6('0x2c')](_0x270661['query'][_0xe4d6('0x2c')]);}_0x24d2bb['order']=qs['sort'](_0x270661[_0xe4d6('0x3e')][_0xe4d6('0x45')]);_0x24d2bb[_0xe4d6('0x46')]=qs[_0xe4d6('0x3f')](_[_0xe4d6('0x47')](_0x270661[_0xe4d6('0x3e')],_0x570d34['filters']));if(_0x270661[_0xe4d6('0x3e')][_0xe4d6('0x48')]){_0x24d2bb[_0xe4d6('0x46')]=_[_0xe4d6('0x49')](_0x24d2bb[_0xe4d6('0x46')],{'$or':_[_0xe4d6('0x38')](_0x36c147,function(_0x11ef87){if(_0x11ef87[_0xe4d6('0x3b')]!=='VIRTUAL'){var _0x2163a2={};_0x2163a2[_0x11ef87[_0xe4d6('0x35')]]={'$like':'%'+_0x270661[_0xe4d6('0x3e')]['filter']+'%'};return _0x2163a2;}})});}_0x24d2bb=_['merge']({},_0x24d2bb,_0x270661[_0xe4d6('0x4a')]);var _0x329802={'where':_0x24d2bb[_0xe4d6('0x46')]};return db[_0xe4d6('0x39')][_0xe4d6('0x4b')](_0x329802)[_0xe4d6('0x33')](function(_0x22c79d){_0x203fe0[_0xe4d6('0x4b')]=_0x22c79d;if(_0x270661[_0xe4d6('0x3e')][_0xe4d6('0x4c')]){_0x24d2bb[_0xe4d6('0x4d')]=[{'all':!![]}];}return db[_0xe4d6('0x39')][_0xe4d6('0x4e')](_0x24d2bb);})[_0xe4d6('0x33')](function(_0x6bd85){_0x203fe0[_0xe4d6('0x4f')]=_0x6bd85;return _0x203fe0;})['then'](respondWithFilteredResult(_0x4ab62e,_0x24d2bb))[_0xe4d6('0x50')](handleError(_0x4ab62e,null));};exports[_0xe4d6('0x51')]=function(_0x546a80,_0x2bea52){var _0x538e25={'raw':![],'where':{'id':_0x546a80[_0xe4d6('0x52')]['id']}},_0x413603={};_0x413603['model']=_[_0xe4d6('0x53')](db['Dynamics365Account']['rawAttributes']);_0x413603[_0xe4d6('0x3e')]=_[_0xe4d6('0x53')](_0x546a80['query']);_0x413603[_0xe4d6('0x3f')]=_[_0xe4d6('0x54')](_0x413603[_0xe4d6('0x3d')],_0x413603[_0xe4d6('0x3e')]);_0x538e25[_0xe4d6('0x40')]=_['intersection'](_0x413603[_0xe4d6('0x3d')],qs[_0xe4d6('0x41')](_0x546a80['query']['fields']));_0x538e25[_0xe4d6('0x40')]=_0x538e25[_0xe4d6('0x40')][_0xe4d6('0x42')]?_0x538e25['attributes']:_0x413603[_0xe4d6('0x3d')];if(_0x546a80[_0xe4d6('0x3e')][_0xe4d6('0x4c')]){_0x538e25[_0xe4d6('0x4d')]=[{'all':!![]}];}_0x538e25=_[_0xe4d6('0x49')]({},_0x538e25,_0x546a80['options']);return db[_0xe4d6('0x39')][_0xe4d6('0x55')](_0x538e25)[_0xe4d6('0x33')](handleEntityNotFound(_0x2bea52,null))[_0xe4d6('0x33')](respondWithResult(_0x2bea52,null))[_0xe4d6('0x50')](handleError(_0x2bea52,null));};exports['create']=function(_0x279056,_0x30740b){return db[_0xe4d6('0x39')][_0xe4d6('0x56')](_0x279056[_0xe4d6('0x57')],{})[_0xe4d6('0x33')](respondWithResult(_0x30740b,0xc9))['catch'](handleError(_0x30740b,null));};exports[_0xe4d6('0x32')]=function(_0x198660,_0x14cdb8){if(_0x198660[_0xe4d6('0x57')]['id']){delete _0x198660[_0xe4d6('0x57')]['id'];}return db[_0xe4d6('0x39')][_0xe4d6('0x55')]({'where':{'id':_0x198660[_0xe4d6('0x52')]['id']}})[_0xe4d6('0x33')](handleEntityNotFound(_0x14cdb8,null))[_0xe4d6('0x33')](saveUpdates(_0x198660[_0xe4d6('0x57')],null))['then'](respondWithResult(_0x14cdb8,null))[_0xe4d6('0x50')](handleError(_0x14cdb8,null));};exports[_0xe4d6('0x58')]=function(_0x285094,_0xf7fb1e){return db[_0xe4d6('0x39')][_0xe4d6('0x55')]({'where':{'id':_0x285094['params']['id']}})['then'](handleEntityNotFound(_0xf7fb1e,null))[_0xe4d6('0x33')](removeEntity(_0xf7fb1e,null))[_0xe4d6('0x50')](handleError(_0xf7fb1e,null));};exports[_0xe4d6('0x59')]=function(_0xa005ea,_0x4b648d,_0x50689d){var _0xa80da5={};var _0x6bceff={};var _0x2aefac;var _0x2b6451;return db['Dynamics365Account'][_0xe4d6('0x5a')]({'where':{'id':_0xa005ea[_0xe4d6('0x52')]['id']}})['then'](handleEntityNotFound(_0x4b648d,null))[_0xe4d6('0x33')](function(_0x503204){if(_0x503204){_0x2aefac=_0x503204;_0x6bceff[_0xe4d6('0x3d')]=_[_0xe4d6('0x53')](db['Dynamics365Configuration'][_0xe4d6('0x5b')]);_0x6bceff['query']=_[_0xe4d6('0x53')](_0xa005ea[_0xe4d6('0x3e')]);_0x6bceff['filters']=_[_0xe4d6('0x54')](_0x6bceff[_0xe4d6('0x3d')],_0x6bceff[_0xe4d6('0x3e')]);_0xa80da5['attributes']=_['intersection'](_0x6bceff['model'],qs[_0xe4d6('0x41')](_0xa005ea[_0xe4d6('0x3e')][_0xe4d6('0x41')]));_0xa80da5[_0xe4d6('0x40')]=_0xa80da5[_0xe4d6('0x40')][_0xe4d6('0x42')]?_0xa80da5['attributes']:_0x6bceff[_0xe4d6('0x3d')];_0xa80da5[_0xe4d6('0x5c')]=qs[_0xe4d6('0x45')](_0xa005ea[_0xe4d6('0x3e')][_0xe4d6('0x45')]);_0xa80da5[_0xe4d6('0x46')]=qs[_0xe4d6('0x3f')](_[_0xe4d6('0x47')](_0xa005ea[_0xe4d6('0x3e')],_0x6bceff['filters']));if(_0xa005ea['query'][_0xe4d6('0x48')]){_0xa80da5[_0xe4d6('0x46')]=_['merge'](_0xa80da5['where'],{'$or':_[_0xe4d6('0x38')](_0xa80da5[_0xe4d6('0x40')],function(_0x43b803){var _0x20273a={};_0x20273a[_0x43b803]={'$like':'%'+_0xa005ea[_0xe4d6('0x3e')]['filter']+'%'};return _0x20273a;})});}_0xa80da5=_[_0xe4d6('0x49')]({},_0xa80da5,_0xa005ea[_0xe4d6('0x4a')]);return _0x2aefac[_0xe4d6('0x59')](_0xa80da5);}})[_0xe4d6('0x33')](function(_0x1a6f9e){if(_0x1a6f9e){_0x2b6451=_0x1a6f9e[_0xe4d6('0x42')];if(!_0xa005ea['query'][_0xe4d6('0x43')]('nolimit')){_0xa80da5[_0xe4d6('0x44')]=qs[_0xe4d6('0x44')](_0xa005ea[_0xe4d6('0x3e')][_0xe4d6('0x44')]);_0xa80da5['offset']=qs[_0xe4d6('0x2c')](_0xa005ea[_0xe4d6('0x3e')][_0xe4d6('0x2c')]);}return _0x2aefac[_0xe4d6('0x59')](_0xa80da5);}})['then'](function(_0x12d5d1){if(_0x12d5d1){return _0x12d5d1?{'count':_0x2b6451,'rows':_0x12d5d1}:null;}})[_0xe4d6('0x33')](respondWithResult(_0x4b648d,null))[_0xe4d6('0x50')](handleError(_0x4b648d,null));};exports[_0xe4d6('0x5d')]=function(_0xacd55e,_0x410ee6,_0x1169ae){if(_0xacd55e[_0xe4d6('0x57')]['id']){delete _0xacd55e[_0xe4d6('0x57')]['id'];}return db[_0xe4d6('0x39')][_0xe4d6('0x5a')]({'where':{'id':_0xacd55e[_0xe4d6('0x52')]['id']}})[_0xe4d6('0x33')](handleEntityNotFound(_0x410ee6,null))[_0xe4d6('0x33')](function(_0x101a90){if(_0x101a90){_0xacd55e[_0xe4d6('0x57')][_0xe4d6('0x5e')]=_0x101a90['id'];_0xacd55e[_0xe4d6('0x57')]['Subjects']=integrations[_0xe4d6('0x5f')](_0xacd55e[_0xe4d6('0x57')][_0xe4d6('0x60')],_0xacd55e[_0xe4d6('0x57')]['type']);_0xacd55e[_0xe4d6('0x57')][_0xe4d6('0x61')]=integrations[_0xe4d6('0x62')](_0xacd55e['body']['channel'],_0xacd55e[_0xe4d6('0x57')]['type']);return db[_0xe4d6('0x63')][_0xe4d6('0x56')](_0xacd55e[_0xe4d6('0x57')],{'include':[{'model':db['Dynamics365Field'],'as':_0xe4d6('0x64')},{'model':db[_0xe4d6('0x65')],'as':_0xe4d6('0x61')}]});}return null;})[_0xe4d6('0x33')](respondWithResult(_0x410ee6,null))[_0xe4d6('0x50')](handleError(_0x410ee6,null));};exports[_0xe4d6('0x66')]=function(_0x42453f,_0x11cfa0,_0x45e518){var _0x130756=_0x42453f[_0xe4d6('0x3e')]['ticketType'];var _0x18e9e4=_0x130756==='incident'?_0xe4d6('0x67'):'PhoneCall';var _0x18f3e6='';var _0x1f57a7='';var _0x2e0b97='';var _0x437a06='';var _0x253355='';var _0x258f2d='';var _0x1f2b75='';var _0x2fc101='';var _0x3231ce=['title',_0xe4d6('0x68'),_0xe4d6('0x69'),'ownerid',_0xe4d6('0x6a'),_0xe4d6('0x6b'),_0xe4d6('0x6c'),'regardingobjectid',_0xe4d6('0x6d'),'phonecall_activity_parties'];var _0x5e80c4=[_0xe4d6('0x6e'),_0xe4d6('0x6f'),_0xe4d6('0x70'),'billedserviceunits',_0xe4d6('0x71'),'contactidyominame',_0xe4d6('0x72'),_0xe4d6('0x73'),_0xe4d6('0x74'),_0xe4d6('0x75'),_0xe4d6('0x76'),_0xe4d6('0x77'),'createdon','createdonbehalfbyname',_0xe4d6('0x78'),_0xe4d6('0x79'),_0xe4d6('0x7a'),'customeridyominame',_0xe4d6('0x7b'),'entitlementidname',_0xe4d6('0x7c'),_0xe4d6('0x7d'),_0xe4d6('0x7e'),_0xe4d6('0x7f'),_0xe4d6('0x80'),_0xe4d6('0x81'),_0xe4d6('0x82'),'influencescore',_0xe4d6('0x83'),_0xe4d6('0x84'),_0xe4d6('0x85'),_0xe4d6('0x86'),'modifiedbyexternalpartyyominame',_0xe4d6('0x87'),_0xe4d6('0x88'),_0xe4d6('0x89'),'modifiedonbehalfbyname',_0xe4d6('0x8a'),_0xe4d6('0x8b'),_0xe4d6('0x8c'),'numberofchildincidents',_0xe4d6('0x8d'),_0xe4d6('0x8e'),_0xe4d6('0x8f'),_0xe4d6('0x90'),_0xe4d6('0x91'),_0xe4d6('0x92'),_0xe4d6('0x93'),_0xe4d6('0x94'),_0xe4d6('0x95'),_0xe4d6('0x96'),'productserialnumber',_0xe4d6('0x97'),_0xe4d6('0x98'),_0xe4d6('0x99'),_0xe4d6('0x9a'),'responsiblecontactidyominame',_0xe4d6('0x9b'),_0xe4d6('0x9c'),_0xe4d6('0x9d'),_0xe4d6('0x9e'),_0xe4d6('0x9f'),_0xe4d6('0xa0'),_0xe4d6('0xa1'),_0xe4d6('0xa2'),_0xe4d6('0xa3'),_0xe4d6('0xa4'),'traversedpath',_0xe4d6('0xa5'),'versionnumber'];var _0x572d34=_0x3231ce[_0xe4d6('0xa6')](_0x5e80c4);return db[_0xe4d6('0x39')][_0xe4d6('0x5a')]({'where':{'id':_0x42453f['params']['id']},'attributes':['id',_0xe4d6('0xa7'),'password',_0xe4d6('0xa8'),_0xe4d6('0xa9'),_0xe4d6('0xaa'),_0xe4d6('0xab')]})[_0xe4d6('0x33')](handleEntityNotFound(_0x11cfa0,null))[_0xe4d6('0x33')](function(_0x1d2d41){if(_0x1d2d41){_0x2fc101=_0x1d2d41[_0xe4d6('0xa8')];var _0x13d18e=_0x2fc101['slice'](-0x1);if(_0x13d18e==='/'){_0x2fc101=_0x2fc101[_0xe4d6('0xac')](0x0,_0x2fc101[_0xe4d6('0xad')](_0x13d18e));}_0x1f2b75=util['format'](_0xe4d6('0xae'),_0x2fc101);var _0x148536={'method':_0xe4d6('0xaf'),'uri':_0xe4d6('0xb0')+_0x1d2d41[_0xe4d6('0xa9')]+'/oauth2/token','form':{'client_id':_0x1d2d41['clientId'],'resource':_0x2fc101,'username':_0x1d2d41[_0xe4d6('0xa7')],'password':_0x1d2d41[_0xe4d6('0xb1')],'grant_type':'password','client_secret':_0x1d2d41[_0xe4d6('0xab')]},'json':!![]};return rp(_0x148536);}})[_0xe4d6('0x33')](function(_0x1c6034){_0x258f2d=_0x1c6034[_0xe4d6('0xb2')];var _0x13b62e={'method':_0xe4d6('0xb3'),'uri':encodeURI(_0x1f2b75+_0xe4d6('0xb4')+_0x18e9e4+'\x27'),'headers':{'Authorization':_0xe4d6('0xb5')+_0x258f2d,'If-None-Match':null,'OData-Version':_0xe4d6('0xb6')},'json':!![]};return rp(_0x13b62e);})[_0xe4d6('0x33')](function(_0x3b4ede){var _0x5dc53e=_0x3b4ede['value'][0x0];var _0xcf4dd0=_0x5dc53e[_0xe4d6('0xb7')];var _0x53a994={'method':_0xe4d6('0xb3'),'uri':_0x1f2b75+'EntityDefinitions('+_0xcf4dd0+_0xe4d6('0xb8'),'headers':{'Authorization':_0xe4d6('0xb5')+_0x258f2d,'If-None-Match':null,'OData-Version':_0xe4d6('0xb6')},'json':!![]};return rp(_0x53a994);})[_0xe4d6('0x33')](function(_0x4d633c){_0x18f3e6=_0x4d633c;_0x1f57a7=_0x18f3e6['Attributes'];_0x1f57a7=_[_0xe4d6('0xb9')](_0x1f57a7,function(_0x2f85b8){return!_0x572d34[_0xe4d6('0xba')](_0x2f85b8[_0xe4d6('0xbb')]);});var _0x429ddf=[];var _0x3c59f5=[];_0x1f57a7[_0xe4d6('0xbc')](function(_0x456a50){if(_0x456a50[_0xe4d6('0xbd')]){var _0xa02617=_0x456a50[_0xe4d6('0xbd')]['substring'](_0x456a50[_0xe4d6('0xbd')][_0xe4d6('0xad')]('.')+0x1);if(_0xa02617===_0xe4d6('0xbe')){_0x429ddf[_0xe4d6('0xbf')](getSelectList(_0x1f2b75,_0x130756,_0x3c59f5,_0x18f3e6['MetadataId'],_0x456a50[_0xe4d6('0xb7')],_0x258f2d));}}});return Promise[_0xe4d6('0xc0')](_0x429ddf);})['then'](function(_0x5826bb){_0x2e0b97=_0x5826bb[0x0];var _0x4b2b69=[];var _0x4e1250=[];_0x1f57a7['forEach'](function(_0x1e972a){if(!_['isNil'](_0x1e972a['@odata.type'])){var _0x12569e=_0x1e972a[_0xe4d6('0xbd')][_0xe4d6('0xac')](_0x1e972a[_0xe4d6('0xbd')]['lastIndexOf']('.')+0x1);if(_0x12569e===_0xe4d6('0xc1')){_0x4b2b69[_0xe4d6('0xbf')](getBooleanList(_0x1f2b75,_0x130756,_0x4e1250,_0x18f3e6[_0xe4d6('0xb7')],_0x1e972a[_0xe4d6('0xb7')],_0x258f2d));}}});return Promise[_0xe4d6('0xc0')](_0x4b2b69);})[_0xe4d6('0x33')](function(_0x1b18b9){_0x437a06=_0x1b18b9[0x0];var _0x3f7697=[];var _0x263e7f=[];_0x1f57a7['forEach'](function(_0x451ce9){if(_0x451ce9['@odata.type']){var _0x196507=_0x451ce9[_0xe4d6('0xbd')][_0xe4d6('0xac')](_0x451ce9[_0xe4d6('0xbd')][_0xe4d6('0xad')]('.')+0x1);if(_0x196507===_0xe4d6('0xc2')||_0x196507===_0xe4d6('0xc3')||_0x196507===_0xe4d6('0xc4')||_0x196507===_0xe4d6('0xc5')||_0x196507==='MemoAttributeMetadata'||_0x196507===_0xe4d6('0xc6')||_0x196507===_0xe4d6('0xc7')||_0x196507===_0xe4d6('0xc8')||_0x196507===_0xe4d6('0xc9')||_0x196507==='DecimalAttributeMetadata'){_0x3f7697[_0xe4d6('0xbf')](getInputList(_0x1f2b75,_0x130756,_0x196507,_0x263e7f,_0x18f3e6['MetadataId'],_0x451ce9['MetadataId'],_0x258f2d));}}});return Promise[_0xe4d6('0xc0')](_0x3f7697);})['then'](function(_0x843c1e){_0x253355=_0x843c1e[0x0];var _0x4bd9e1=_0x2e0b97[_0xe4d6('0xa6')](_0x437a06)[_0xe4d6('0xa6')](_0x253355);var _0x23f72a={'count':_0x4bd9e1[_0xe4d6('0x42')],'rows':_0x4bd9e1};return _0x23f72a;})['then'](respondWithResult(_0x11cfa0,null))[_0xe4d6('0x50')](function(_0x51c773){var _0x194fba=_0x42453f['query'][_0xe4d6('0x1d')]?0x1f4:_0x51c773['statusCode']||0x1f4;logger[_0xe4d6('0x26')](_0x51c773['stack']);delete _0x51c773[_0xe4d6('0x35')];if(_0x194fba===0x191){_0x194fba=0x190;}_0x11cfa0['status'](_0x194fba)[_0xe4d6('0x36')](_0x42453f[_0xe4d6('0x3e')]['test']?{'message':_0xe4d6('0xca'),'statusCode':_0x51c773[_0xe4d6('0xcb')]}:_0x51c773);});};function getSelectList(_0x1d60b6,_0x483dc7,_0x395bda,_0x38270b,_0x34393c,_0x34eae7){var _0x3f94eb={'method':_0xe4d6('0xb3'),'uri':_0x1d60b6+_0xe4d6('0xcc')+_0x38270b+_0xe4d6('0xcd')+_0x34393c+_0xe4d6('0xce')+_0xe4d6('0xcf'),'headers':{'Authorization':_0xe4d6('0xb5')+_0x34eae7,'If-None-Match':null,'OData-Version':_0xe4d6('0xb6')},'json':!![]};return rp(_0x3f94eb)[_0xe4d6('0x33')](function(_0x491971){var _0x12eed9=[];var _0x19e623=_0x491971[_0xe4d6('0xd0')][_0xe4d6('0xd1')];_0x19e623['forEach'](function(_0x32f20e){_0x12eed9[_0xe4d6('0xbf')]({'name':_0x32f20e[_0xe4d6('0xd2')][_0xe4d6('0xd3')][_0xe4d6('0xd2')],'value':String(_0x32f20e[_0xe4d6('0xd4')])});});var _0x369357={'id':_0x483dc7+'_'+_0x491971[_0xe4d6('0xbb')],'name':_0x491971['DisplayName'][_0xe4d6('0xd3')][_0xe4d6('0xd2')],'custom':![],'options':_0x12eed9};_0x395bda[_0xe4d6('0xbf')](_0x369357);return _0x395bda;});}function getBooleanList(_0xd33a22,_0x5a79df,_0x3cb303,_0x3437a7,_0x860ff1,_0x4650ca){var _0x2b0779={'method':'GET','uri':_0xd33a22+_0xe4d6('0xcc')+_0x3437a7+')/Attributes('+_0x860ff1+_0xe4d6('0xd5'),'headers':{'Authorization':_0xe4d6('0xb5')+_0x4650ca,'If-None-Match':null,'OData-Version':_0xe4d6('0xb6')},'json':!![]};return rp(_0x2b0779)[_0xe4d6('0x33')](function(_0x43770a){var _0xaff71f=[];_0xaff71f[_0xe4d6('0xbf')]({'name':_0x43770a[_0xe4d6('0xd0')][_0xe4d6('0xd6')]['Label'][_0xe4d6('0xd3')][_0xe4d6('0xd2')],'value':_0xe4d6('0xd7')},{'name':_0x43770a[_0xe4d6('0xd0')][_0xe4d6('0xd8')]['Label'][_0xe4d6('0xd3')]['Label'],'value':'false'});var _0x191705={'id':_0x5a79df+'_'+_0x43770a[_0xe4d6('0xbb')],'name':_0x43770a['DisplayName'][_0xe4d6('0xd3')]['Label'],'custom':![],'options':_0xaff71f};_0x3cb303[_0xe4d6('0xbf')](_0x191705);return _0x3cb303;});}function getInputList(_0x588fdb,_0x32b219,_0x39d4ae,_0x1b0805,_0x32ec9f,_0x2fc09c,_0x2942b6){var _0x2bc981={'method':_0xe4d6('0xb3'),'uri':_0x588fdb+_0xe4d6('0xcc')+_0x32ec9f+_0xe4d6('0xcd')+_0x2fc09c+_0xe4d6('0xd9')+_0x39d4ae+_0xe4d6('0xda'),'headers':{'Authorization':'Bearer\x20'+_0x2942b6,'If-None-Match':null,'OData-Version':_0xe4d6('0xb6')},'json':!![]};return rp(_0x2bc981)[_0xe4d6('0x33')](function(_0x27c01c){var _0x2bed2e={'id':_0x32b219+'_'+_0x27c01c[_0xe4d6('0xbb')],'name':_0x27c01c[_0xe4d6('0xdb')][_0xe4d6('0xd3')]?_0x27c01c['DisplayName'][_0xe4d6('0xd3')][_0xe4d6('0xd2')]:_0x27c01c[_0xe4d6('0xbb')],'custom':![],'options':[]};_0x1b0805[_0xe4d6('0xbf')](_0x2bed2e);return _0x1b0805;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 8e54556..592a005 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 _0x8ae1=['../../config/logger','api','moment','bluebird','path','rimraf','./intDynamics365Account.attributes','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x8ae1,0x1c7));var _0x18ae=function(_0x2e9974,_0x5d552c){_0x2e9974=_0x2e9974-0x0;var _0x2e90f0=_0x8ae1[_0x2e9974];return _0x2e90f0;};'use strict';var _=require(_0x18ae('0x0'));var util=require('util');var logger=require(_0x18ae('0x1'))(_0x18ae('0x2'));var moment=require(_0x18ae('0x3'));var BPromise=require(_0x18ae('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x18ae('0x5'));var rimraf=require(_0x18ae('0x6'));var config=require('../../config/environment');var attributes=require(_0x18ae('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x18ae('0x8')]=function(_0x482cba,_0x40494a){return _0x482cba[_0x18ae('0x9')](_0x18ae('0xa'),attributes,{'tableName':_0x18ae('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9611=['bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','api','moment'];(function(_0x577723,_0x57be79){var _0x453c81=function(_0x57e4e3){while(--_0x57e4e3){_0x577723['push'](_0x577723['shift']());}};_0x453c81(++_0x57be79);}(_0x9611,0x182));var _0x1961=function(_0x18c0ac,_0x888032){_0x18c0ac=_0x18c0ac-0x0;var _0x55e5c2=_0x9611[_0x18c0ac];return _0x55e5c2;};'use strict';var _=require('lodash');var util=require(_0x1961('0x0'));var logger=require(_0x1961('0x1'))(_0x1961('0x2'));var moment=require(_0x1961('0x3'));var BPromise=require(_0x1961('0x4'));var rp=require(_0x1961('0x5'));var fs=require('fs');var path=require(_0x1961('0x6'));var rimraf=require(_0x1961('0x7'));var config=require(_0x1961('0x8'));var attributes=require(_0x1961('0x9'));var integrations=require(_0x1961('0xa'));module[_0x1961('0xb')]=function(_0x3814da,_0x4c5a61){return _0x3814da[_0x1961('0xc')](_0x1961('0xd'),attributes,{'tableName':_0x1961('0xe'),'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 ea8abfc..f219fc2 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 _0x8579=['find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','include','map','model','attributes','debug','ShowDynamics365Account'];(function(_0x48e980,_0x35160c){var _0x121995=function(_0x3a791d){while(--_0x3a791d){_0x48e980['push'](_0x48e980['shift']());}};_0x121995(++_0x35160c);}(_0x8579,0x16c));var _0x9857=function(_0x45ed63,_0x1434a1){_0x45ed63=_0x45ed63-0x0;var _0x3076b7=_0x8579[_0x45ed63];return _0x3076b7;};'use strict';var _=require(_0x9857('0x0'));var util=require(_0x9857('0x1'));var moment=require('moment');var BPromise=require(_0x9857('0x2'));var rs=require(_0x9857('0x3'));var fs=require('fs');var Redis=require(_0x9857('0x4'));var db=require(_0x9857('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9857('0x6'));var client=jayson[_0x9857('0x7')][_0x9857('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3538dd,_0x3f0977,_0x3a36cd){return new BPromise(function(_0x5f21a6,_0xaffe57){return client[_0x9857('0x9')](_0x3538dd,_0x3a36cd)[_0x9857('0xa')](function(_0x764f15){logger[_0x9857('0xb')](_0x9857('0xc'),_0x3f0977,'request\x20sent');logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x3f0977,_0x9857('0xd'),JSON[_0x9857('0xe')](_0x764f15));if(_0x764f15[_0x9857('0xf')]){if(_0x764f15[_0x9857('0xf')][_0x9857('0x10')]===0x1f4){logger[_0x9857('0xf')](_0x9857('0xc'),_0x3f0977,_0x764f15[_0x9857('0xf')][_0x9857('0x11')]);return _0xaffe57(_0x764f15[_0x9857('0xf')][_0x9857('0x11')]);}logger[_0x9857('0xf')](_0x9857('0xc'),_0x3f0977,_0x764f15[_0x9857('0xf')][_0x9857('0x11')]);return _0x5f21a6(_0x764f15[_0x9857('0xf')][_0x9857('0x11')]);}else{logger[_0x9857('0xb')](_0x9857('0xc'),_0x3f0977,_0x9857('0xd'));_0x5f21a6(_0x764f15['result'][_0x9857('0x11')]);}})[_0x9857('0x12')](function(_0x308ea8){logger[_0x9857('0xf')](_0x9857('0xc'),_0x3f0977,_0x308ea8);_0xaffe57(_0x308ea8);});});}exports[_0x9857('0x13')]=function(_0x5f46a0){var _0x4ae16d=this;return new Promise(function(_0x492ea2,_0x4d3a21){return db[_0x9857('0x14')][_0x9857('0x15')]({'raw':_0x5f46a0[_0x9857('0x16')]?_0x5f46a0[_0x9857('0x16')][_0x9857('0x17')]===undefined?!![]:![]:!![],'where':_0x5f46a0[_0x9857('0x16')]?_0x5f46a0[_0x9857('0x16')][_0x9857('0x18')]||null:null,'attributes':_0x5f46a0[_0x9857('0x16')]?_0x5f46a0[_0x9857('0x16')]['attributes']||null:null,'limit':_0x5f46a0[_0x9857('0x16')]?_0x5f46a0[_0x9857('0x16')][_0x9857('0x19')]||null:null,'include':_0x5f46a0[_0x9857('0x16')]?_0x5f46a0[_0x9857('0x16')][_0x9857('0x1a')]?_[_0x9857('0x1b')](_0x5f46a0[_0x9857('0x16')][_0x9857('0x1a')],function(_0x48fe32){return{'model':db[_0x48fe32[_0x9857('0x1c')]],'as':_0x48fe32['as'],'attributes':_0x48fe32[_0x9857('0x1d')],'include':_0x48fe32[_0x9857('0x1a')]?_[_0x9857('0x1b')](_0x48fe32[_0x9857('0x1a')],function(_0xea1406){return{'model':db[_0xea1406['model']],'as':_0xea1406['as'],'attributes':_0xea1406[_0x9857('0x1d')],'include':_0xea1406[_0x9857('0x1a')]?_[_0x9857('0x1b')](_0xea1406[_0x9857('0x1a')],function(_0x2a4135){return{'model':db[_0x2a4135['model']],'as':_0x2a4135['as'],'attributes':_0x2a4135[_0x9857('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9857('0xa')](function(_0x233a25){logger[_0x9857('0xb')]('GetDynamics365Account',_0x5f46a0);logger[_0x9857('0x1e')](_0x9857('0x13'),_0x5f46a0,JSON[_0x9857('0xe')](_0x233a25));_0x492ea2(_0x233a25);})['catch'](function(_0x1f7d7e){logger['error'](_0x9857('0x13'),_0x1f7d7e[_0x9857('0x11')],_0x5f46a0);_0x4d3a21(_0x4ae16d['error'](0x1f4,_0x1f7d7e[_0x9857('0x11')]));});});};exports[_0x9857('0x1f')]=function(_0x2cd562){var _0x15c636=this;return new Promise(function(_0x520c29,_0xbe1e2f){return db['Dynamics365Account'][_0x9857('0x20')]({'raw':_0x2cd562[_0x9857('0x16')]?_0x2cd562[_0x9857('0x16')][_0x9857('0x17')]===undefined?!![]:![]:!![],'where':_0x2cd562[_0x9857('0x16')]?_0x2cd562[_0x9857('0x16')][_0x9857('0x18')]||null:null,'attributes':_0x2cd562[_0x9857('0x16')]?_0x2cd562[_0x9857('0x16')]['attributes']||null:null,'include':_0x2cd562[_0x9857('0x16')]?_0x2cd562['options']['include']?_[_0x9857('0x1b')](_0x2cd562[_0x9857('0x16')]['include'],function(_0x35341f){return{'model':db[_0x35341f[_0x9857('0x1c')]],'as':_0x35341f['as'],'attributes':_0x35341f[_0x9857('0x1d')],'include':_0x35341f[_0x9857('0x1a')]?_[_0x9857('0x1b')](_0x35341f[_0x9857('0x1a')],function(_0x3a4013){return{'model':db[_0x3a4013[_0x9857('0x1c')]],'as':_0x3a4013['as'],'attributes':_0x3a4013['attributes'],'include':_0x3a4013['include']?_[_0x9857('0x1b')](_0x3a4013['include'],function(_0x2feef3){return{'model':db[_0x2feef3[_0x9857('0x1c')]],'as':_0x2feef3['as'],'attributes':_0x2feef3[_0x9857('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10e2f5){logger[_0x9857('0xb')](_0x9857('0x1f'),_0x2cd562);logger['debug']('ShowDynamics365Account',_0x2cd562,JSON[_0x9857('0xe')](_0x10e2f5));_0x520c29(_0x10e2f5);})['catch'](function(_0x327471){logger['error'](_0x9857('0x1f'),_0x327471[_0x9857('0x11')],_0x2cd562);_0xbe1e2f(_0x15c636['error'](0x1f4,_0x327471['message']));});});}; \ No newline at end of file +var _0x6d19=['rpc','../../config/environment','jayson/promise','http','request','then','info','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','request\x20sent','result','catch','Dynamics365Account','options','raw','where','attributes','limit','map','model','include','GetDynamics365Account','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x36e187,_0x20b000){var _0x5ce67a=function(_0x599e30){while(--_0x599e30){_0x36e187['push'](_0x36e187['shift']());}};_0x5ce67a(++_0x20b000);}(_0x6d19,0x160));var _0x96d1=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x6d19[_0xc8a931];return _0x28bd27;};'use strict';var _=require(_0x96d1('0x0'));var util=require(_0x96d1('0x1'));var moment=require(_0x96d1('0x2'));var BPromise=require(_0x96d1('0x3'));var rs=require(_0x96d1('0x4'));var fs=require('fs');var Redis=require(_0x96d1('0x5'));var db=require(_0x96d1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x96d1('0x7'))(_0x96d1('0x8'));var config=require(_0x96d1('0x9'));var jayson=require(_0x96d1('0xa'));var client=jayson['client'][_0x96d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x230638,_0x61e0f5,_0x58ade3){return new BPromise(function(_0xba2d03,_0x3f7a36){return client[_0x96d1('0xc')](_0x230638,_0x58ade3)[_0x96d1('0xd')](function(_0x37b251){logger[_0x96d1('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x61e0f5,'request\x20sent');logger[_0x96d1('0xf')](_0x96d1('0x10'),_0x61e0f5,'request\x20sent',JSON[_0x96d1('0x11')](_0x37b251));if(_0x37b251['error']){if(_0x37b251[_0x96d1('0x12')][_0x96d1('0x13')]===0x1f4){logger[_0x96d1('0x12')](_0x96d1('0x14'),_0x61e0f5,_0x37b251[_0x96d1('0x12')][_0x96d1('0x15')]);return _0x3f7a36(_0x37b251['error'][_0x96d1('0x15')]);}logger[_0x96d1('0x12')](_0x96d1('0x14'),_0x61e0f5,_0x37b251[_0x96d1('0x12')][_0x96d1('0x15')]);return _0xba2d03(_0x37b251['error']['message']);}else{logger[_0x96d1('0xe')](_0x96d1('0x14'),_0x61e0f5,_0x96d1('0x16'));_0xba2d03(_0x37b251[_0x96d1('0x17')][_0x96d1('0x15')]);}})[_0x96d1('0x18')](function(_0x45dc6f){logger[_0x96d1('0x12')](_0x96d1('0x14'),_0x61e0f5,_0x45dc6f);_0x3f7a36(_0x45dc6f);});});}exports['GetDynamics365Account']=function(_0x18c73f){var _0x1c3540=this;return new Promise(function(_0x3ed4ff,_0x3524ec){return db[_0x96d1('0x19')]['findAll']({'raw':_0x18c73f[_0x96d1('0x1a')]?_0x18c73f[_0x96d1('0x1a')][_0x96d1('0x1b')]===undefined?!![]:![]:!![],'where':_0x18c73f[_0x96d1('0x1a')]?_0x18c73f['options'][_0x96d1('0x1c')]||null:null,'attributes':_0x18c73f[_0x96d1('0x1a')]?_0x18c73f[_0x96d1('0x1a')][_0x96d1('0x1d')]||null:null,'limit':_0x18c73f['options']?_0x18c73f[_0x96d1('0x1a')][_0x96d1('0x1e')]||null:null,'include':_0x18c73f[_0x96d1('0x1a')]?_0x18c73f[_0x96d1('0x1a')]['include']?_[_0x96d1('0x1f')](_0x18c73f[_0x96d1('0x1a')]['include'],function(_0x14334a){return{'model':db[_0x14334a[_0x96d1('0x20')]],'as':_0x14334a['as'],'attributes':_0x14334a['attributes'],'include':_0x14334a[_0x96d1('0x21')]?_[_0x96d1('0x1f')](_0x14334a[_0x96d1('0x21')],function(_0x5462ec){return{'model':db[_0x5462ec[_0x96d1('0x20')]],'as':_0x5462ec['as'],'attributes':_0x5462ec[_0x96d1('0x1d')],'include':_0x5462ec[_0x96d1('0x21')]?_['map'](_0x5462ec['include'],function(_0xd88eb7){return{'model':db[_0xd88eb7['model']],'as':_0xd88eb7['as'],'attributes':_0xd88eb7[_0x96d1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x96d1('0xd')](function(_0x267efc){logger[_0x96d1('0xe')](_0x96d1('0x22'),_0x18c73f);logger['debug'](_0x96d1('0x22'),_0x18c73f,JSON[_0x96d1('0x11')](_0x267efc));_0x3ed4ff(_0x267efc);})[_0x96d1('0x18')](function(_0x443f9c){logger[_0x96d1('0x12')](_0x96d1('0x22'),_0x443f9c[_0x96d1('0x15')],_0x18c73f);_0x3524ec(_0x1c3540['error'](0x1f4,_0x443f9c['message']));});});};exports[_0x96d1('0x23')]=function(_0x266d2c){var _0x3968f5=this;return new Promise(function(_0x29dc82,_0x43cfc7){return db[_0x96d1('0x19')]['find']({'raw':_0x266d2c[_0x96d1('0x1a')]?_0x266d2c[_0x96d1('0x1a')][_0x96d1('0x1b')]===undefined?!![]:![]:!![],'where':_0x266d2c[_0x96d1('0x1a')]?_0x266d2c[_0x96d1('0x1a')][_0x96d1('0x1c')]||null:null,'attributes':_0x266d2c['options']?_0x266d2c[_0x96d1('0x1a')][_0x96d1('0x1d')]||null:null,'include':_0x266d2c[_0x96d1('0x1a')]?_0x266d2c[_0x96d1('0x1a')][_0x96d1('0x21')]?_[_0x96d1('0x1f')](_0x266d2c['options'][_0x96d1('0x21')],function(_0x59225b){return{'model':db[_0x59225b['model']],'as':_0x59225b['as'],'attributes':_0x59225b['attributes'],'include':_0x59225b[_0x96d1('0x21')]?_[_0x96d1('0x1f')](_0x59225b[_0x96d1('0x21')],function(_0x1e6b73){return{'model':db[_0x1e6b73[_0x96d1('0x20')]],'as':_0x1e6b73['as'],'attributes':_0x1e6b73['attributes'],'include':_0x1e6b73[_0x96d1('0x21')]?_[_0x96d1('0x1f')](_0x1e6b73[_0x96d1('0x21')],function(_0x123cec){return{'model':db[_0x123cec[_0x96d1('0x20')]],'as':_0x123cec['as'],'attributes':_0x123cec[_0x96d1('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b8273){logger[_0x96d1('0xe')](_0x96d1('0x23'),_0x266d2c);logger[_0x96d1('0xf')](_0x96d1('0x23'),_0x266d2c,JSON[_0x96d1('0x11')](_0x2b8273));_0x29dc82(_0x2b8273);})[_0x96d1('0x18')](function(_0x4d70be){logger['error'](_0x96d1('0x23'),_0x4d70be[_0x96d1('0x15')],_0x266d2c);_0x43cfc7(_0x3968f5[_0x96d1('0x12')](0x1f4,_0x4d70be[_0x96d1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 8756530..474ce99 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 _0x73ff=['../../components/interaction/service','get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x54e210,_0x4a7260){var _0x2283bf=function(_0x7c810){while(--_0x7c810){_0x54e210['push'](_0x54e210['shift']());}};_0x2283bf(++_0x4a7260);}(_0x73ff,0xeb));var _0xf73f=function(_0xd4fd5c,_0x194e25){_0xd4fd5c=_0xd4fd5c-0x0;var _0x492d45=_0x73ff[_0xd4fd5c];return _0x492d45;};'use strict';var multer=require(_0xf73f('0x0'));var util=require(_0xf73f('0x1'));var path=require(_0xf73f('0x2'));var timeout=require(_0xf73f('0x3'));var express=require(_0xf73f('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xf73f('0x5'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0xf73f('0x6')]('/',auth[_0xf73f('0x7')](),controller[_0xf73f('0x8')]);router[_0xf73f('0x6')]('/:id',auth[_0xf73f('0x7')](),controller[_0xf73f('0x9')]);router['get'](_0xf73f('0xa'),auth[_0xf73f('0x7')](),controller[_0xf73f('0xb')]);router[_0xf73f('0x6')]('/:id/subjects',auth[_0xf73f('0x7')](),controller[_0xf73f('0xc')]);router[_0xf73f('0x6')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0xf73f('0xd')]('/',auth[_0xf73f('0x7')](),controller[_0xf73f('0xe')]);router[_0xf73f('0xf')](_0xf73f('0x10'),auth['isAuthenticated'](),controller[_0xf73f('0x11')]);router[_0xf73f('0x12')](_0xf73f('0x10'),auth[_0xf73f('0x7')](),controller[_0xf73f('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf8ba=['express','Router','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','delete','destroy','util'];(function(_0x41845d,_0x5b6da5){var _0x262592=function(_0x14341e){while(--_0x14341e){_0x41845d['push'](_0x41845d['shift']());}};_0x262592(++_0x5b6da5);}(_0xf8ba,0xd7));var _0xaf8b=function(_0x50ea5e,_0x3640ce){_0x50ea5e=_0x50ea5e-0x0;var _0x5eb4d9=_0xf8ba[_0x50ea5e];return _0x5eb4d9;};'use strict';var multer=require('multer');var util=require(_0xaf8b('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xaf8b('0x1'));var router=express[_0xaf8b('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xaf8b('0x3'));var config=require(_0xaf8b('0x4'));var controller=require(_0xaf8b('0x5'));router[_0xaf8b('0x6')]('/',auth[_0xaf8b('0x7')](),controller['index']);router[_0xaf8b('0x6')](_0xaf8b('0x8'),auth[_0xaf8b('0x7')](),controller[_0xaf8b('0x9')]);router['get'](_0xaf8b('0xa'),auth[_0xaf8b('0x7')](),controller['getFields']);router[_0xaf8b('0x6')](_0xaf8b('0xb'),auth[_0xaf8b('0x7')](),controller['getSubjects']);router[_0xaf8b('0x6')](_0xaf8b('0xc'),auth[_0xaf8b('0x7')](),controller[_0xaf8b('0xd')]);router['post']('/',auth[_0xaf8b('0x7')](),controller[_0xaf8b('0xe')]);router[_0xaf8b('0xf')](_0xaf8b('0x8'),auth[_0xaf8b('0x7')](),controller['update']);router[_0xaf8b('0x10')](_0xaf8b('0x8'),auth[_0xaf8b('0x7')](),controller[_0xaf8b('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 44836c9..2a3cd58 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 _0xd093=['phonecall','STRING','ENUM','incident'];(function(_0x4c1771,_0x24bba7){var _0x1ba823=function(_0x1bfa72){while(--_0x1bfa72){_0x4c1771['push'](_0x4c1771['shift']());}};_0x1ba823(++_0x24bba7);}(_0xd093,0xd1));var _0x3d09=function(_0x28d830,_0x10c37f){_0x28d830=_0x28d830-0x0;var _0x144b0b=_0xd093[_0x28d830];return _0x144b0b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3d09('0x0')]},'description':{'type':Sequelize[_0x3d09('0x0')]},'ticketType':{'type':Sequelize[_0x3d09('0x1')](_0x3d09('0x2'),_0x3d09('0x3')),'defaultValue':'incident'}}; \ No newline at end of file +var _0x98bf=['ENUM','incident','phonecall','exports','STRING'];(function(_0x2f84c8,_0x5e4372){var _0xf26b94=function(_0x2afe92){while(--_0x2afe92){_0x2f84c8['push'](_0x2f84c8['shift']());}};_0xf26b94(++_0x5e4372);}(_0x98bf,0x184));var _0xf98b=function(_0x56cfbc,_0x322ab5){_0x56cfbc=_0x56cfbc-0x0;var _0x1580e1=_0x98bf[_0x56cfbc];return _0x1580e1;};'use strict';var Sequelize=require('sequelize');module[_0xf98b('0x0')]={'name':{'type':Sequelize[_0xf98b('0x1')]},'description':{'type':Sequelize[_0xf98b('0x1')]},'ticketType':{'type':Sequelize[_0xf98b('0x2')](_0xf98b('0x3'),_0xf98b('0x4')),'defaultValue':_0xf98b('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 0742eb0..51f58f7 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 _0x18b8=['lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Configuration,\x20%s,\x20%s','result','status','count','offset','limit','apply','save','update','end','sendStatus','stack','name','Dynamics365Configuration','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','includeAll','include','rows','params','find','create','body','catch','destroy','getFields','findOne','Dynamics365Field','hasOwnProperty','getSubjects','getDescriptions','options','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs'];(function(_0x39d18b,_0x497c48){var _0x3dbf1e=function(_0x2b7da1){while(--_0x2b7da1){_0x39d18b['push'](_0x39d18b['shift']());}};_0x3dbf1e(++_0x497c48);}(_0x18b8,0x100));var _0x818b=function(_0x159140,_0x25a124){_0x159140=_0x159140-0x0;var _0x49c4c4=_0x18b8[_0x159140];return _0x49c4c4;};'use strict';var pdf=require(_0x818b('0x0'));var emlformat=require(_0x818b('0x1'));var rimraf=require(_0x818b('0x2'));var zipdir=require(_0x818b('0x3'));var jsonpatch=require(_0x818b('0x4'));var rp=require(_0x818b('0x5'));var moment=require(_0x818b('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x818b('0x7'));var util=require(_0x818b('0x8'));var path=require(_0x818b('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x818b('0xa'));var fs=require('fs');var _=require(_0x818b('0xb'));var squel=require(_0x818b('0xc'));var crypto=require(_0x818b('0xd'));var jsforce=require(_0x818b('0xe'));var deskjs=require(_0x818b('0xf'));var toCsv=require(_0x818b('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x818b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x818b('0x12'));var hardwareService=require(_0x818b('0x13'));var logger=require('../../config/logger')(_0x818b('0x14'));var utils=require(_0x818b('0x15'));var config=require('../../config/environment');var db=require(_0x818b('0x16'))['db'];var jayson=require(_0x818b('0x17'));var client=jayson[_0x818b('0x18')][_0x818b('0x19')]({'port':0x232a});function checkPasswordPattern(_0x1ab289,_0x5f2d4e,_0x1cd35b){if(_0x1cd35b){var _0x142494=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x142494[_0x818b('0x1a')](_0x5f2d4e)){return _0x1ab289;}else{throw new db['Sequelize'][(_0x818b('0x1b'))](_0x818b('0x1c'));}}else{return _0x1ab289;}}function respondWithRpcPromise(_0x1dc80b,_0x461641,_0x463e23,_0x57c490){return new BPromise(function(_0x25ebb2,_0x481015){var _0x34024a=_0x57c490||client;return _0x34024a[_0x818b('0x1d')](_0x1dc80b,_0x463e23)[_0x818b('0x1e')](function(_0x227ec3){logger[_0x818b('0x1f')]('Dynamics365Configuration,\x20%s,\x20%s',_0x461641,_0x818b('0x20'));logger[_0x818b('0x21')](_0x818b('0x22'),_0x461641,_0x818b('0x20'),JSON[_0x818b('0x23')](_0x227ec3));if(_0x227ec3[_0x818b('0x24')]){if(_0x227ec3[_0x818b('0x24')][_0x818b('0x25')]===0x1f4){logger[_0x818b('0x24')]('Dynamics365Configuration,\x20%s,\x20%s',_0x461641,_0x227ec3[_0x818b('0x24')][_0x818b('0x26')]);return _0x481015(_0x227ec3['error'][_0x818b('0x26')]);}logger[_0x818b('0x24')](_0x818b('0x27'),_0x461641,_0x227ec3[_0x818b('0x24')][_0x818b('0x26')]);return _0x25ebb2(_0x227ec3[_0x818b('0x24')][_0x818b('0x26')]);}else{logger[_0x818b('0x1f')](_0x818b('0x27'),_0x461641,_0x818b('0x20'));_0x25ebb2(_0x227ec3[_0x818b('0x28')][_0x818b('0x26')]);}})['catch'](function(_0x17ee61){logger['error'](_0x818b('0x27'),_0x461641,_0x17ee61);_0x481015(_0x17ee61);});});}function respondWithStatusCode(_0x543c93,_0x5e8495){_0x5e8495=_0x5e8495||0xcc;return function(_0x3eefa){if(_0x3eefa){return _0x543c93['sendStatus'](_0x5e8495);}return _0x543c93[_0x818b('0x29')](_0x5e8495)['end']();};}function respondWithResult(_0x2e05b2,_0x4a51ae){_0x4a51ae=_0x4a51ae||0xc8;return function(_0x2fa9fa){if(_0x2fa9fa){return _0x2e05b2[_0x818b('0x29')](_0x4a51ae)['json'](_0x2fa9fa);}};}function respondWithFilteredResult(_0x20d6f8,_0x1f2bd1){return function(_0x4a27e0){if(_0x4a27e0){var _0x5f5bc6=_0x4a27e0[_0x818b('0x2a')],_0x5598e5=_0x1f2bd1['offset'],_0x526710=_0x1f2bd1[_0x818b('0x2b')]+_0x1f2bd1[_0x818b('0x2c')],_0x597e2b;if(_0x526710>=_0x5f5bc6){_0x526710=_0x5f5bc6;_0x597e2b=0xc8;}else{_0x597e2b=0xce;}_0x20d6f8[_0x818b('0x29')](_0x597e2b);return _0x20d6f8['set']('Content-Range',_0x5598e5+'-'+_0x526710+'/'+_0x5f5bc6)['json'](_0x4a27e0);}return null;};}function patchUpdates(_0x438fe8){return function(_0x69dab1){try{jsonpatch[_0x818b('0x2d')](_0x69dab1,_0x438fe8,!![]);}catch(_0x257627){return BPromise['reject'](_0x257627);}return _0x69dab1[_0x818b('0x2e')]();};}function saveUpdates(_0x2e6940,_0x3b69ec){return function(_0x533f05){if(_0x533f05){return _0x533f05[_0x818b('0x2f')](_0x2e6940)['then'](function(_0x2bc2e9){return _0x2bc2e9;});}return null;};}function removeEntity(_0x3bed42,_0x3ac08e){return function(_0x1ccbfd){if(_0x1ccbfd){return _0x1ccbfd['destroy']()[_0x818b('0x1e')](function(){_0x3bed42[_0x818b('0x29')](0xcc)[_0x818b('0x30')]();});}};}function handleEntityNotFound(_0x295302,_0x75b64f){return function(_0x6e2e04){if(!_0x6e2e04){_0x295302[_0x818b('0x31')](0x194);}return _0x6e2e04;};}function handleError(_0x7ee96b,_0xadb4d6){_0xadb4d6=_0xadb4d6||0x1f4;return function(_0x5285c0){logger[_0x818b('0x24')](_0x5285c0[_0x818b('0x32')]);if(_0x5285c0['name']){delete _0x5285c0[_0x818b('0x33')];}_0x7ee96b[_0x818b('0x29')](_0xadb4d6)['send'](_0x5285c0);};}exports['index']=function(_0x369159,_0x2405b4){var _0x1a2977={},_0x9a5fcc={},_0x20ded6={'count':0x0,'rows':[]};var _0x447f3c=_['map'](db[_0x818b('0x34')][_0x818b('0x35')],function(_0x268d00){return{'name':_0x268d00['fieldName'],'type':_0x268d00[_0x818b('0x36')][_0x818b('0x37')]};});_0x9a5fcc['model']=_['map'](_0x447f3c,'name');_0x9a5fcc[_0x818b('0x38')]=_[_0x818b('0x39')](_0x369159['query']);_0x9a5fcc[_0x818b('0x3a')]=_[_0x818b('0x3b')](_0x9a5fcc['model'],_0x9a5fcc[_0x818b('0x38')]);_0x1a2977[_0x818b('0x3c')]=_[_0x818b('0x3b')](_0x9a5fcc[_0x818b('0x3d')],qs[_0x818b('0x3e')](_0x369159[_0x818b('0x38')]['fields']));_0x1a2977[_0x818b('0x3c')]=_0x1a2977[_0x818b('0x3c')][_0x818b('0x3f')]?_0x1a2977['attributes']:_0x9a5fcc[_0x818b('0x3d')];if(!_0x369159[_0x818b('0x38')]['hasOwnProperty'](_0x818b('0x40'))){_0x1a2977['limit']=qs[_0x818b('0x2c')](_0x369159[_0x818b('0x38')][_0x818b('0x2c')]);_0x1a2977['offset']=qs[_0x818b('0x2b')](_0x369159[_0x818b('0x38')][_0x818b('0x2b')]);}_0x1a2977[_0x818b('0x41')]=qs['sort'](_0x369159['query'][_0x818b('0x42')]);_0x1a2977[_0x818b('0x43')]=qs['filters'](_[_0x818b('0x44')](_0x369159[_0x818b('0x38')],_0x9a5fcc[_0x818b('0x3a')]));if(_0x369159[_0x818b('0x38')]['filter']){_0x1a2977[_0x818b('0x43')]=_[_0x818b('0x45')](_0x1a2977[_0x818b('0x43')],{'$or':_[_0x818b('0x46')](_0x447f3c,function(_0x22f010){if(_0x22f010['type']!==_0x818b('0x47')){var _0x373fb9={};_0x373fb9[_0x22f010[_0x818b('0x33')]]={'$like':'%'+_0x369159['query'][_0x818b('0x48')]+'%'};return _0x373fb9;}})});}_0x1a2977=_['merge']({},_0x1a2977,_0x369159['options']);var _0x4ae8e5={'where':_0x1a2977[_0x818b('0x43')]};return db['Dynamics365Configuration'][_0x818b('0x2a')](_0x4ae8e5)['then'](function(_0x592f55){_0x20ded6[_0x818b('0x2a')]=_0x592f55;if(_0x369159['query'][_0x818b('0x49')]){_0x1a2977[_0x818b('0x4a')]=[{'all':!![]}];}return db[_0x818b('0x34')]['findAll'](_0x1a2977);})[_0x818b('0x1e')](function(_0x56d162){_0x20ded6[_0x818b('0x4b')]=_0x56d162;return _0x20ded6;})[_0x818b('0x1e')](respondWithFilteredResult(_0x2405b4,_0x1a2977))['catch'](handleError(_0x2405b4,null));};exports['show']=function(_0x29e85f,_0x30140c){var _0x251413={'raw':![],'where':{'id':_0x29e85f[_0x818b('0x4c')]['id']}},_0x530d87={};_0x530d87[_0x818b('0x3d')]=_[_0x818b('0x39')](db[_0x818b('0x34')][_0x818b('0x35')]);_0x530d87[_0x818b('0x38')]=_[_0x818b('0x39')](_0x29e85f[_0x818b('0x38')]);_0x530d87[_0x818b('0x3a')]=_[_0x818b('0x3b')](_0x530d87[_0x818b('0x3d')],_0x530d87['query']);_0x251413[_0x818b('0x3c')]=_[_0x818b('0x3b')](_0x530d87[_0x818b('0x3d')],qs[_0x818b('0x3e')](_0x29e85f['query'][_0x818b('0x3e')]));_0x251413[_0x818b('0x3c')]=_0x251413[_0x818b('0x3c')][_0x818b('0x3f')]?_0x251413[_0x818b('0x3c')]:_0x530d87[_0x818b('0x3d')];if(_0x29e85f[_0x818b('0x38')][_0x818b('0x49')]){_0x251413[_0x818b('0x4a')]=[{'all':!![]}];}_0x251413=_[_0x818b('0x45')]({},_0x251413,_0x29e85f['options']);return db[_0x818b('0x34')][_0x818b('0x4d')](_0x251413)[_0x818b('0x1e')](handleEntityNotFound(_0x30140c,null))['then'](respondWithResult(_0x30140c,null))['catch'](handleError(_0x30140c,null));};exports[_0x818b('0x4e')]=function(_0x3a9671,_0x4f2a2c){return db['Dynamics365Configuration'][_0x818b('0x4e')](_0x3a9671[_0x818b('0x4f')],{})[_0x818b('0x1e')](respondWithResult(_0x4f2a2c,0xc9))['catch'](handleError(_0x4f2a2c,null));};exports[_0x818b('0x2f')]=function(_0x5d8ae6,_0x381a05){if(_0x5d8ae6['body']['id']){delete _0x5d8ae6[_0x818b('0x4f')]['id'];}return db[_0x818b('0x34')]['find']({'where':{'id':_0x5d8ae6[_0x818b('0x4c')]['id']}})[_0x818b('0x1e')](handleEntityNotFound(_0x381a05,null))[_0x818b('0x1e')](saveUpdates(_0x5d8ae6['body'],null))['then'](respondWithResult(_0x381a05,null))[_0x818b('0x50')](handleError(_0x381a05,null));};exports[_0x818b('0x51')]=function(_0x4ff3c5,_0x5c858d){return db[_0x818b('0x34')]['find']({'where':{'id':_0x4ff3c5[_0x818b('0x4c')]['id']}})[_0x818b('0x1e')](handleEntityNotFound(_0x5c858d,null))[_0x818b('0x1e')](removeEntity(_0x5c858d,null))[_0x818b('0x50')](handleError(_0x5c858d,null));};exports[_0x818b('0x52')]=function(_0x315763,_0x96ceb8,_0x13601b){var _0xbcf7f4={};var _0x905212={};var _0x392434;var _0x1fafd0;return db[_0x818b('0x34')][_0x818b('0x53')]({'where':{'id':_0x315763[_0x818b('0x4c')]['id']}})[_0x818b('0x1e')](handleEntityNotFound(_0x96ceb8,null))['then'](function(_0x166608){if(_0x166608){_0x392434=_0x166608;_0x905212['model']=_['keys'](db[_0x818b('0x54')][_0x818b('0x35')]);_0x905212['query']=_[_0x818b('0x39')](_0x315763[_0x818b('0x38')]);_0x905212['filters']=_[_0x818b('0x3b')](_0x905212[_0x818b('0x3d')],_0x905212[_0x818b('0x38')]);_0xbcf7f4['attributes']=_[_0x818b('0x3b')](_0x905212['model'],qs[_0x818b('0x3e')](_0x315763[_0x818b('0x38')][_0x818b('0x3e')]));_0xbcf7f4[_0x818b('0x3c')]=_0xbcf7f4[_0x818b('0x3c')]['length']?_0xbcf7f4[_0x818b('0x3c')]:_0x905212[_0x818b('0x3d')];_0xbcf7f4['order']=qs[_0x818b('0x42')](_0x315763[_0x818b('0x38')][_0x818b('0x42')]);_0xbcf7f4['where']=qs[_0x818b('0x3a')](_[_0x818b('0x44')](_0x315763[_0x818b('0x38')],_0x905212[_0x818b('0x3a')]));if(_0x315763[_0x818b('0x38')][_0x818b('0x48')]){_0xbcf7f4[_0x818b('0x43')]=_[_0x818b('0x45')](_0xbcf7f4[_0x818b('0x43')],{'$or':_[_0x818b('0x46')](_0xbcf7f4[_0x818b('0x3c')],function(_0x2bbe5d){var _0x5c4d72={};_0x5c4d72[_0x2bbe5d]={'$like':'%'+_0x315763[_0x818b('0x38')]['filter']+'%'};return _0x5c4d72;})});}_0xbcf7f4=_[_0x818b('0x45')]({},_0xbcf7f4,_0x315763['options']);return _0x392434[_0x818b('0x52')](_0xbcf7f4);}})['then'](function(_0x14660a){if(_0x14660a){_0x1fafd0=_0x14660a['length'];if(!_0x315763[_0x818b('0x38')][_0x818b('0x55')](_0x818b('0x40'))){_0xbcf7f4[_0x818b('0x2c')]=qs[_0x818b('0x2c')](_0x315763[_0x818b('0x38')]['limit']);_0xbcf7f4[_0x818b('0x2b')]=qs['offset'](_0x315763['query'][_0x818b('0x2b')]);}return _0x392434[_0x818b('0x52')](_0xbcf7f4);}})[_0x818b('0x1e')](function(_0x30be84){if(_0x30be84){return _0x30be84?{'count':_0x1fafd0,'rows':_0x30be84}:null;}})['then'](respondWithResult(_0x96ceb8,null))[_0x818b('0x50')](handleError(_0x96ceb8,null));};exports[_0x818b('0x56')]=function(_0x1783e3,_0x27c767,_0x2dad2b){var _0x37a211={};var _0x30549b={};var _0x5d02c3;var _0x4fc4b3;return db[_0x818b('0x34')][_0x818b('0x53')]({'where':{'id':_0x1783e3[_0x818b('0x4c')]['id']}})[_0x818b('0x1e')](handleEntityNotFound(_0x27c767,null))[_0x818b('0x1e')](function(_0x914e6b){if(_0x914e6b){_0x5d02c3=_0x914e6b;_0x30549b[_0x818b('0x3d')]=_['keys'](db[_0x818b('0x54')][_0x818b('0x35')]);_0x30549b[_0x818b('0x38')]=_[_0x818b('0x39')](_0x1783e3[_0x818b('0x38')]);_0x30549b[_0x818b('0x3a')]=_[_0x818b('0x3b')](_0x30549b[_0x818b('0x3d')],_0x30549b[_0x818b('0x38')]);_0x37a211['attributes']=_[_0x818b('0x3b')](_0x30549b[_0x818b('0x3d')],qs[_0x818b('0x3e')](_0x1783e3[_0x818b('0x38')][_0x818b('0x3e')]));_0x37a211[_0x818b('0x3c')]=_0x37a211[_0x818b('0x3c')]['length']?_0x37a211[_0x818b('0x3c')]:_0x30549b[_0x818b('0x3d')];_0x37a211[_0x818b('0x41')]=qs[_0x818b('0x42')](_0x1783e3['query'][_0x818b('0x42')]);_0x37a211[_0x818b('0x43')]=qs[_0x818b('0x3a')](_[_0x818b('0x44')](_0x1783e3['query'],_0x30549b[_0x818b('0x3a')]));if(_0x1783e3[_0x818b('0x38')][_0x818b('0x48')]){_0x37a211[_0x818b('0x43')]=_[_0x818b('0x45')](_0x37a211[_0x818b('0x43')],{'$or':_[_0x818b('0x46')](_0x37a211['attributes'],function(_0x48a43a){var _0x22c29c={};_0x22c29c[_0x48a43a]={'$like':'%'+_0x1783e3[_0x818b('0x38')][_0x818b('0x48')]+'%'};return _0x22c29c;})});}_0x37a211=_[_0x818b('0x45')]({},_0x37a211,_0x1783e3['options']);return _0x5d02c3[_0x818b('0x56')](_0x37a211);}})[_0x818b('0x1e')](function(_0x211110){if(_0x211110){_0x4fc4b3=_0x211110[_0x818b('0x3f')];if(!_0x1783e3[_0x818b('0x38')][_0x818b('0x55')](_0x818b('0x40'))){_0x37a211[_0x818b('0x2c')]=qs[_0x818b('0x2c')](_0x1783e3[_0x818b('0x38')][_0x818b('0x2c')]);_0x37a211[_0x818b('0x2b')]=qs[_0x818b('0x2b')](_0x1783e3[_0x818b('0x38')][_0x818b('0x2b')]);}return _0x5d02c3['getSubjects'](_0x37a211);}})['then'](function(_0x4dd2c5){if(_0x4dd2c5){return _0x4dd2c5?{'count':_0x4fc4b3,'rows':_0x4dd2c5}:null;}})[_0x818b('0x1e')](respondWithResult(_0x27c767,null))['catch'](handleError(_0x27c767,null));};exports[_0x818b('0x57')]=function(_0x1c3b59,_0x4e1297,_0x4e4f49){var _0x3f114d={};var _0x178be6={};var _0x2d74aa;var _0x4e60b4;return db['Dynamics365Configuration'][_0x818b('0x53')]({'where':{'id':_0x1c3b59[_0x818b('0x4c')]['id']}})[_0x818b('0x1e')](handleEntityNotFound(_0x4e1297,null))['then'](function(_0x30e72a){if(_0x30e72a){_0x2d74aa=_0x30e72a;_0x178be6[_0x818b('0x3d')]=_[_0x818b('0x39')](db['Dynamics365Field'][_0x818b('0x35')]);_0x178be6[_0x818b('0x38')]=_['keys'](_0x1c3b59[_0x818b('0x38')]);_0x178be6[_0x818b('0x3a')]=_[_0x818b('0x3b')](_0x178be6['model'],_0x178be6[_0x818b('0x38')]);_0x3f114d['attributes']=_[_0x818b('0x3b')](_0x178be6[_0x818b('0x3d')],qs[_0x818b('0x3e')](_0x1c3b59[_0x818b('0x38')][_0x818b('0x3e')]));_0x3f114d[_0x818b('0x3c')]=_0x3f114d[_0x818b('0x3c')][_0x818b('0x3f')]?_0x3f114d[_0x818b('0x3c')]:_0x178be6[_0x818b('0x3d')];_0x3f114d[_0x818b('0x41')]=qs[_0x818b('0x42')](_0x1c3b59[_0x818b('0x38')]['sort']);_0x3f114d['where']=qs[_0x818b('0x3a')](_['pick'](_0x1c3b59[_0x818b('0x38')],_0x178be6['filters']));if(_0x1c3b59[_0x818b('0x38')][_0x818b('0x48')]){_0x3f114d[_0x818b('0x43')]=_[_0x818b('0x45')](_0x3f114d[_0x818b('0x43')],{'$or':_[_0x818b('0x46')](_0x3f114d['attributes'],function(_0x17b7c7){var _0x3b1d18={};_0x3b1d18[_0x17b7c7]={'$like':'%'+_0x1c3b59[_0x818b('0x38')][_0x818b('0x48')]+'%'};return _0x3b1d18;})});}_0x3f114d=_['merge']({},_0x3f114d,_0x1c3b59[_0x818b('0x58')]);return _0x2d74aa[_0x818b('0x57')](_0x3f114d);}})[_0x818b('0x1e')](function(_0x104f4c){if(_0x104f4c){_0x4e60b4=_0x104f4c[_0x818b('0x3f')];if(!_0x1c3b59[_0x818b('0x38')][_0x818b('0x55')]('nolimit')){_0x3f114d[_0x818b('0x2c')]=qs['limit'](_0x1c3b59[_0x818b('0x38')][_0x818b('0x2c')]);_0x3f114d[_0x818b('0x2b')]=qs[_0x818b('0x2b')](_0x1c3b59[_0x818b('0x38')][_0x818b('0x2b')]);}return _0x2d74aa['getDescriptions'](_0x3f114d);}})['then'](function(_0x14d60d){if(_0x14d60d){return _0x14d60d?{'count':_0x4e60b4,'rows':_0x14d60d}:null;}})[_0x818b('0x1e')](respondWithResult(_0x4e1297,null))[_0x818b('0x50')](handleError(_0x4e1297,null));}; \ No newline at end of file +var _0xf8b0=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','show','keys','includeAll','create','body','update','find','params','destroy','findOne','Dynamics365Field','options','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','jayson/promise','http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','stack','name','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes'];(function(_0x3b6808,_0x1c6301){var _0x39c682=function(_0x1692c8){while(--_0x1692c8){_0x3b6808['push'](_0x3b6808['shift']());}};_0x39c682(++_0x1c6301);}(_0xf8b0,0xce));var _0x0f8b=function(_0xe67ef,_0x1ac17b){_0xe67ef=_0xe67ef-0x0;var _0x4da51f=_0xf8b0[_0xe67ef];return _0x4da51f;};'use strict';var pdf=require(_0x0f8b('0x0'));var emlformat=require(_0x0f8b('0x1'));var rimraf=require(_0x0f8b('0x2'));var zipdir=require(_0x0f8b('0x3'));var jsonpatch=require(_0x0f8b('0x4'));var rp=require(_0x0f8b('0x5'));var moment=require(_0x0f8b('0x6'));var BPromise=require(_0x0f8b('0x7'));var Mustache=require(_0x0f8b('0x8'));var util=require(_0x0f8b('0x9'));var path=require(_0x0f8b('0xa'));var sox=require(_0x0f8b('0xb'));var csv=require(_0x0f8b('0xc'));var ejs=require(_0x0f8b('0xd'));var fs=require('fs');var _=require(_0x0f8b('0xe'));var squel=require('squel');var crypto=require(_0x0f8b('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x0f8b('0x10'));var toCsv=require(_0x0f8b('0xc'));var querystring=require('querystring');var Papa=require(_0x0f8b('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0f8b('0x12'));var hardwareService=require(_0x0f8b('0x13'));var logger=require('../../config/logger')(_0x0f8b('0x14'));var utils=require(_0x0f8b('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x0f8b('0x16'));var client=jayson['client'][_0x0f8b('0x17')]({'port':0x232a});function checkPasswordPattern(_0x200845,_0x4a09be,_0x31944e){if(_0x31944e){var _0x5c02ca=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5c02ca['test'](_0x4a09be)){return _0x200845;}else{throw new db[(_0x0f8b('0x18'))]['ValidationError'](_0x0f8b('0x19'));}}else{return _0x200845;}}function respondWithRpcPromise(_0x3d9bff,_0x6ad672,_0x563bd0,_0x564f6e){return new BPromise(function(_0x39e4fc,_0x3815fc){var _0x38a9d7=_0x564f6e||client;return _0x38a9d7[_0x0f8b('0x1a')](_0x3d9bff,_0x563bd0)[_0x0f8b('0x1b')](function(_0x135109){logger[_0x0f8b('0x1c')]('Dynamics365Configuration,\x20%s,\x20%s',_0x6ad672,_0x0f8b('0x1d'));logger[_0x0f8b('0x1e')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x6ad672,_0x0f8b('0x1d'),JSON[_0x0f8b('0x1f')](_0x135109));if(_0x135109[_0x0f8b('0x20')]){if(_0x135109[_0x0f8b('0x20')][_0x0f8b('0x21')]===0x1f4){logger[_0x0f8b('0x20')](_0x0f8b('0x22'),_0x6ad672,_0x135109[_0x0f8b('0x20')]['message']);return _0x3815fc(_0x135109[_0x0f8b('0x20')][_0x0f8b('0x23')]);}logger['error'](_0x0f8b('0x22'),_0x6ad672,_0x135109['error'][_0x0f8b('0x23')]);return _0x39e4fc(_0x135109[_0x0f8b('0x20')][_0x0f8b('0x23')]);}else{logger[_0x0f8b('0x1c')]('Dynamics365Configuration,\x20%s,\x20%s',_0x6ad672,_0x0f8b('0x1d'));_0x39e4fc(_0x135109[_0x0f8b('0x24')][_0x0f8b('0x23')]);}})[_0x0f8b('0x25')](function(_0xd312a0){logger[_0x0f8b('0x20')](_0x0f8b('0x22'),_0x6ad672,_0xd312a0);_0x3815fc(_0xd312a0);});});}function respondWithStatusCode(_0x5e43c1,_0x430f53){_0x430f53=_0x430f53||0xcc;return function(_0x596f35){if(_0x596f35){return _0x5e43c1[_0x0f8b('0x26')](_0x430f53);}return _0x5e43c1[_0x0f8b('0x27')](_0x430f53)[_0x0f8b('0x28')]();};}function respondWithResult(_0x285972,_0x511b93){_0x511b93=_0x511b93||0xc8;return function(_0x375301){if(_0x375301){return _0x285972[_0x0f8b('0x27')](_0x511b93)[_0x0f8b('0x29')](_0x375301);}};}function respondWithFilteredResult(_0x1e0816,_0x30db9e){return function(_0x55a22a){if(_0x55a22a){var _0x56ba47=_0x55a22a[_0x0f8b('0x2a')],_0x56a56e=_0x30db9e['offset'],_0x3ce90a=_0x30db9e[_0x0f8b('0x2b')]+_0x30db9e[_0x0f8b('0x2c')],_0x2976c9;if(_0x3ce90a>=_0x56ba47){_0x3ce90a=_0x56ba47;_0x2976c9=0xc8;}else{_0x2976c9=0xce;}_0x1e0816[_0x0f8b('0x27')](_0x2976c9);return _0x1e0816['set'](_0x0f8b('0x2d'),_0x56a56e+'-'+_0x3ce90a+'/'+_0x56ba47)['json'](_0x55a22a);}return null;};}function patchUpdates(_0x114024){return function(_0x14611c){try{jsonpatch[_0x0f8b('0x2e')](_0x14611c,_0x114024,!![]);}catch(_0x3fc954){return BPromise['reject'](_0x3fc954);}return _0x14611c[_0x0f8b('0x2f')]();};}function saveUpdates(_0xc9fe27,_0x2ccf2c){return function(_0x357ba0){if(_0x357ba0){return _0x357ba0['update'](_0xc9fe27)['then'](function(_0xeebe92){return _0xeebe92;});}return null;};}function removeEntity(_0x1d1739,_0x28748a){return function(_0x5b7d3c){if(_0x5b7d3c){return _0x5b7d3c['destroy']()['then'](function(){_0x1d1739[_0x0f8b('0x27')](0xcc)[_0x0f8b('0x28')]();});}};}function handleEntityNotFound(_0x15acc8,_0x39af02){return function(_0x30d890){if(!_0x30d890){_0x15acc8[_0x0f8b('0x26')](0x194);}return _0x30d890;};}function handleError(_0x3c93f8,_0x222697){_0x222697=_0x222697||0x1f4;return function(_0x4fc75b){logger[_0x0f8b('0x20')](_0x4fc75b[_0x0f8b('0x30')]);if(_0x4fc75b[_0x0f8b('0x31')]){delete _0x4fc75b[_0x0f8b('0x31')];}_0x3c93f8['status'](_0x222697)['send'](_0x4fc75b);};}exports['index']=function(_0x4d869a,_0x33fd06){var _0x394d2b={},_0x44ffea={},_0x10358e={'count':0x0,'rows':[]};var _0x178675=_[_0x0f8b('0x32')](db[_0x0f8b('0x33')][_0x0f8b('0x34')],function(_0x147819){return{'name':_0x147819[_0x0f8b('0x35')],'type':_0x147819[_0x0f8b('0x36')][_0x0f8b('0x37')]};});_0x44ffea[_0x0f8b('0x38')]=_[_0x0f8b('0x32')](_0x178675,_0x0f8b('0x31'));_0x44ffea['query']=_['keys'](_0x4d869a[_0x0f8b('0x39')]);_0x44ffea[_0x0f8b('0x3a')]=_[_0x0f8b('0x3b')](_0x44ffea[_0x0f8b('0x38')],_0x44ffea[_0x0f8b('0x39')]);_0x394d2b[_0x0f8b('0x3c')]=_[_0x0f8b('0x3b')](_0x44ffea[_0x0f8b('0x38')],qs[_0x0f8b('0x3d')](_0x4d869a['query']['fields']));_0x394d2b[_0x0f8b('0x3c')]=_0x394d2b[_0x0f8b('0x3c')][_0x0f8b('0x3e')]?_0x394d2b[_0x0f8b('0x3c')]:_0x44ffea[_0x0f8b('0x38')];if(!_0x4d869a[_0x0f8b('0x39')][_0x0f8b('0x3f')](_0x0f8b('0x40'))){_0x394d2b[_0x0f8b('0x2c')]=qs[_0x0f8b('0x2c')](_0x4d869a[_0x0f8b('0x39')][_0x0f8b('0x2c')]);_0x394d2b[_0x0f8b('0x2b')]=qs[_0x0f8b('0x2b')](_0x4d869a[_0x0f8b('0x39')][_0x0f8b('0x2b')]);}_0x394d2b[_0x0f8b('0x41')]=qs[_0x0f8b('0x42')](_0x4d869a[_0x0f8b('0x39')][_0x0f8b('0x42')]);_0x394d2b[_0x0f8b('0x43')]=qs[_0x0f8b('0x3a')](_[_0x0f8b('0x44')](_0x4d869a['query'],_0x44ffea[_0x0f8b('0x3a')]));if(_0x4d869a[_0x0f8b('0x39')][_0x0f8b('0x45')]){_0x394d2b['where']=_['merge'](_0x394d2b['where'],{'$or':_[_0x0f8b('0x32')](_0x178675,function(_0x193830){if(_0x193830['type']!==_0x0f8b('0x46')){var _0x4727f5={};_0x4727f5[_0x193830[_0x0f8b('0x31')]]={'$like':'%'+_0x4d869a[_0x0f8b('0x39')][_0x0f8b('0x45')]+'%'};return _0x4727f5;}})});}_0x394d2b=_[_0x0f8b('0x47')]({},_0x394d2b,_0x4d869a['options']);var _0x361f76={'where':_0x394d2b[_0x0f8b('0x43')]};return db[_0x0f8b('0x33')]['count'](_0x361f76)[_0x0f8b('0x1b')](function(_0x5e7f61){_0x10358e[_0x0f8b('0x2a')]=_0x5e7f61;if(_0x4d869a[_0x0f8b('0x39')]['includeAll']){_0x394d2b[_0x0f8b('0x48')]=[{'all':!![]}];}return db[_0x0f8b('0x33')][_0x0f8b('0x49')](_0x394d2b);})[_0x0f8b('0x1b')](function(_0x3d520a){_0x10358e[_0x0f8b('0x4a')]=_0x3d520a;return _0x10358e;})[_0x0f8b('0x1b')](respondWithFilteredResult(_0x33fd06,_0x394d2b))['catch'](handleError(_0x33fd06,null));};exports[_0x0f8b('0x4b')]=function(_0x4114b4,_0x50d354){var _0xb00643={'raw':![],'where':{'id':_0x4114b4['params']['id']}},_0x303622={};_0x303622['model']=_[_0x0f8b('0x4c')](db['Dynamics365Configuration']['rawAttributes']);_0x303622['query']=_[_0x0f8b('0x4c')](_0x4114b4[_0x0f8b('0x39')]);_0x303622['filters']=_[_0x0f8b('0x3b')](_0x303622['model'],_0x303622[_0x0f8b('0x39')]);_0xb00643[_0x0f8b('0x3c')]=_[_0x0f8b('0x3b')](_0x303622[_0x0f8b('0x38')],qs['fields'](_0x4114b4[_0x0f8b('0x39')][_0x0f8b('0x3d')]));_0xb00643[_0x0f8b('0x3c')]=_0xb00643['attributes'][_0x0f8b('0x3e')]?_0xb00643[_0x0f8b('0x3c')]:_0x303622[_0x0f8b('0x38')];if(_0x4114b4[_0x0f8b('0x39')][_0x0f8b('0x4d')]){_0xb00643[_0x0f8b('0x48')]=[{'all':!![]}];}_0xb00643=_['merge']({},_0xb00643,_0x4114b4['options']);return db[_0x0f8b('0x33')]['find'](_0xb00643)['then'](handleEntityNotFound(_0x50d354,null))[_0x0f8b('0x1b')](respondWithResult(_0x50d354,null))[_0x0f8b('0x25')](handleError(_0x50d354,null));};exports[_0x0f8b('0x4e')]=function(_0x65bc5c,_0x21235e){return db['Dynamics365Configuration']['create'](_0x65bc5c[_0x0f8b('0x4f')],{})[_0x0f8b('0x1b')](respondWithResult(_0x21235e,0xc9))[_0x0f8b('0x25')](handleError(_0x21235e,null));};exports[_0x0f8b('0x50')]=function(_0x37b1a4,_0x2807f8){if(_0x37b1a4[_0x0f8b('0x4f')]['id']){delete _0x37b1a4['body']['id'];}return db['Dynamics365Configuration'][_0x0f8b('0x51')]({'where':{'id':_0x37b1a4[_0x0f8b('0x52')]['id']}})[_0x0f8b('0x1b')](handleEntityNotFound(_0x2807f8,null))[_0x0f8b('0x1b')](saveUpdates(_0x37b1a4['body'],null))['then'](respondWithResult(_0x2807f8,null))[_0x0f8b('0x25')](handleError(_0x2807f8,null));};exports[_0x0f8b('0x53')]=function(_0x2b4133,_0x5adc2f){return db['Dynamics365Configuration'][_0x0f8b('0x51')]({'where':{'id':_0x2b4133[_0x0f8b('0x52')]['id']}})[_0x0f8b('0x1b')](handleEntityNotFound(_0x5adc2f,null))[_0x0f8b('0x1b')](removeEntity(_0x5adc2f,null))[_0x0f8b('0x25')](handleError(_0x5adc2f,null));};exports['getFields']=function(_0x1f197f,_0x314812,_0x1a5b9f){var _0x29b4ae={};var _0x41c93e={};var _0x526849;var _0x5a08c3;return db['Dynamics365Configuration'][_0x0f8b('0x54')]({'where':{'id':_0x1f197f[_0x0f8b('0x52')]['id']}})[_0x0f8b('0x1b')](handleEntityNotFound(_0x314812,null))[_0x0f8b('0x1b')](function(_0x1662cc){if(_0x1662cc){_0x526849=_0x1662cc;_0x41c93e[_0x0f8b('0x38')]=_[_0x0f8b('0x4c')](db[_0x0f8b('0x55')][_0x0f8b('0x34')]);_0x41c93e[_0x0f8b('0x39')]=_[_0x0f8b('0x4c')](_0x1f197f[_0x0f8b('0x39')]);_0x41c93e[_0x0f8b('0x3a')]=_[_0x0f8b('0x3b')](_0x41c93e[_0x0f8b('0x38')],_0x41c93e[_0x0f8b('0x39')]);_0x29b4ae[_0x0f8b('0x3c')]=_[_0x0f8b('0x3b')](_0x41c93e['model'],qs[_0x0f8b('0x3d')](_0x1f197f[_0x0f8b('0x39')][_0x0f8b('0x3d')]));_0x29b4ae['attributes']=_0x29b4ae[_0x0f8b('0x3c')][_0x0f8b('0x3e')]?_0x29b4ae[_0x0f8b('0x3c')]:_0x41c93e[_0x0f8b('0x38')];_0x29b4ae[_0x0f8b('0x41')]=qs[_0x0f8b('0x42')](_0x1f197f[_0x0f8b('0x39')][_0x0f8b('0x42')]);_0x29b4ae[_0x0f8b('0x43')]=qs['filters'](_[_0x0f8b('0x44')](_0x1f197f[_0x0f8b('0x39')],_0x41c93e[_0x0f8b('0x3a')]));if(_0x1f197f[_0x0f8b('0x39')][_0x0f8b('0x45')]){_0x29b4ae[_0x0f8b('0x43')]=_[_0x0f8b('0x47')](_0x29b4ae['where'],{'$or':_[_0x0f8b('0x32')](_0x29b4ae[_0x0f8b('0x3c')],function(_0x57fa08){var _0x1dd9d1={};_0x1dd9d1[_0x57fa08]={'$like':'%'+_0x1f197f[_0x0f8b('0x39')]['filter']+'%'};return _0x1dd9d1;})});}_0x29b4ae=_[_0x0f8b('0x47')]({},_0x29b4ae,_0x1f197f['options']);return _0x526849['getFields'](_0x29b4ae);}})[_0x0f8b('0x1b')](function(_0x1aeda3){if(_0x1aeda3){_0x5a08c3=_0x1aeda3[_0x0f8b('0x3e')];if(!_0x1f197f[_0x0f8b('0x39')][_0x0f8b('0x3f')]('nolimit')){_0x29b4ae[_0x0f8b('0x2c')]=qs['limit'](_0x1f197f['query'][_0x0f8b('0x2c')]);_0x29b4ae[_0x0f8b('0x2b')]=qs['offset'](_0x1f197f['query'][_0x0f8b('0x2b')]);}return _0x526849['getFields'](_0x29b4ae);}})[_0x0f8b('0x1b')](function(_0x17c74d){if(_0x17c74d){return _0x17c74d?{'count':_0x5a08c3,'rows':_0x17c74d}:null;}})[_0x0f8b('0x1b')](respondWithResult(_0x314812,null))[_0x0f8b('0x25')](handleError(_0x314812,null));};exports['getSubjects']=function(_0x5ecd1d,_0x1f8ed8,_0x40da80){var _0x3e950d={};var _0xd94436={};var _0x36f23c;var _0x404aba;return db[_0x0f8b('0x33')][_0x0f8b('0x54')]({'where':{'id':_0x5ecd1d['params']['id']}})[_0x0f8b('0x1b')](handleEntityNotFound(_0x1f8ed8,null))[_0x0f8b('0x1b')](function(_0x278ee1){if(_0x278ee1){_0x36f23c=_0x278ee1;_0xd94436[_0x0f8b('0x38')]=_[_0x0f8b('0x4c')](db['Dynamics365Field'][_0x0f8b('0x34')]);_0xd94436['query']=_[_0x0f8b('0x4c')](_0x5ecd1d[_0x0f8b('0x39')]);_0xd94436[_0x0f8b('0x3a')]=_['intersection'](_0xd94436[_0x0f8b('0x38')],_0xd94436['query']);_0x3e950d[_0x0f8b('0x3c')]=_[_0x0f8b('0x3b')](_0xd94436[_0x0f8b('0x38')],qs['fields'](_0x5ecd1d['query']['fields']));_0x3e950d['attributes']=_0x3e950d[_0x0f8b('0x3c')][_0x0f8b('0x3e')]?_0x3e950d[_0x0f8b('0x3c')]:_0xd94436[_0x0f8b('0x38')];_0x3e950d[_0x0f8b('0x41')]=qs[_0x0f8b('0x42')](_0x5ecd1d[_0x0f8b('0x39')][_0x0f8b('0x42')]);_0x3e950d[_0x0f8b('0x43')]=qs[_0x0f8b('0x3a')](_['pick'](_0x5ecd1d['query'],_0xd94436['filters']));if(_0x5ecd1d[_0x0f8b('0x39')][_0x0f8b('0x45')]){_0x3e950d['where']=_[_0x0f8b('0x47')](_0x3e950d[_0x0f8b('0x43')],{'$or':_[_0x0f8b('0x32')](_0x3e950d[_0x0f8b('0x3c')],function(_0x30eae3){var _0x3df745={};_0x3df745[_0x30eae3]={'$like':'%'+_0x5ecd1d[_0x0f8b('0x39')][_0x0f8b('0x45')]+'%'};return _0x3df745;})});}_0x3e950d=_[_0x0f8b('0x47')]({},_0x3e950d,_0x5ecd1d[_0x0f8b('0x56')]);return _0x36f23c[_0x0f8b('0x57')](_0x3e950d);}})[_0x0f8b('0x1b')](function(_0x7d26da){if(_0x7d26da){_0x404aba=_0x7d26da[_0x0f8b('0x3e')];if(!_0x5ecd1d['query'][_0x0f8b('0x3f')](_0x0f8b('0x40'))){_0x3e950d['limit']=qs['limit'](_0x5ecd1d[_0x0f8b('0x39')][_0x0f8b('0x2c')]);_0x3e950d['offset']=qs[_0x0f8b('0x2b')](_0x5ecd1d['query'][_0x0f8b('0x2b')]);}return _0x36f23c[_0x0f8b('0x57')](_0x3e950d);}})[_0x0f8b('0x1b')](function(_0x253fd0){if(_0x253fd0){return _0x253fd0?{'count':_0x404aba,'rows':_0x253fd0}:null;}})[_0x0f8b('0x1b')](respondWithResult(_0x1f8ed8,null))['catch'](handleError(_0x1f8ed8,null));};exports[_0x0f8b('0x58')]=function(_0x413693,_0x49d5bb,_0xacb5ef){var _0x339aaf={};var _0x3761fd={};var _0x5355f7;var _0x5a0f18;return db[_0x0f8b('0x33')]['findOne']({'where':{'id':_0x413693[_0x0f8b('0x52')]['id']}})[_0x0f8b('0x1b')](handleEntityNotFound(_0x49d5bb,null))[_0x0f8b('0x1b')](function(_0x783397){if(_0x783397){_0x5355f7=_0x783397;_0x3761fd[_0x0f8b('0x38')]=_['keys'](db[_0x0f8b('0x55')]['rawAttributes']);_0x3761fd[_0x0f8b('0x39')]=_[_0x0f8b('0x4c')](_0x413693['query']);_0x3761fd[_0x0f8b('0x3a')]=_['intersection'](_0x3761fd['model'],_0x3761fd[_0x0f8b('0x39')]);_0x339aaf['attributes']=_[_0x0f8b('0x3b')](_0x3761fd['model'],qs[_0x0f8b('0x3d')](_0x413693[_0x0f8b('0x39')][_0x0f8b('0x3d')]));_0x339aaf['attributes']=_0x339aaf[_0x0f8b('0x3c')][_0x0f8b('0x3e')]?_0x339aaf[_0x0f8b('0x3c')]:_0x3761fd[_0x0f8b('0x38')];_0x339aaf[_0x0f8b('0x41')]=qs[_0x0f8b('0x42')](_0x413693[_0x0f8b('0x39')][_0x0f8b('0x42')]);_0x339aaf[_0x0f8b('0x43')]=qs[_0x0f8b('0x3a')](_['pick'](_0x413693[_0x0f8b('0x39')],_0x3761fd[_0x0f8b('0x3a')]));if(_0x413693[_0x0f8b('0x39')][_0x0f8b('0x45')]){_0x339aaf['where']=_[_0x0f8b('0x47')](_0x339aaf['where'],{'$or':_['map'](_0x339aaf[_0x0f8b('0x3c')],function(_0x464afb){var _0x4a1953={};_0x4a1953[_0x464afb]={'$like':'%'+_0x413693['query'][_0x0f8b('0x45')]+'%'};return _0x4a1953;})});}_0x339aaf=_['merge']({},_0x339aaf,_0x413693[_0x0f8b('0x56')]);return _0x5355f7['getDescriptions'](_0x339aaf);}})[_0x0f8b('0x1b')](function(_0x841d07){if(_0x841d07){_0x5a0f18=_0x841d07[_0x0f8b('0x3e')];if(!_0x413693[_0x0f8b('0x39')][_0x0f8b('0x3f')](_0x0f8b('0x40'))){_0x339aaf['limit']=qs[_0x0f8b('0x2c')](_0x413693[_0x0f8b('0x39')][_0x0f8b('0x2c')]);_0x339aaf[_0x0f8b('0x2b')]=qs[_0x0f8b('0x2b')](_0x413693[_0x0f8b('0x39')]['offset']);}return _0x5355f7['getDescriptions'](_0x339aaf);}})[_0x0f8b('0x1b')](function(_0x3b24ae){if(_0x3b24ae){return _0x3b24ae?{'count':_0x5a0f18,'rows':_0x3b24ae}:null;}})[_0x0f8b('0x1b')](respondWithResult(_0x49d5bb,null))[_0x0f8b('0x25')](handleError(_0x49d5bb,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 5be98e2..9c43c5c 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 _0xc510=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird'];(function(_0x36e557,_0x582535){var _0x4072f7=function(_0x552ed5){while(--_0x552ed5){_0x36e557['push'](_0x36e557['shift']());}};_0x4072f7(++_0x582535);}(_0xc510,0x1a8));var _0x0c51=function(_0x3f8187,_0xde28b1){_0x3f8187=_0x3f8187-0x0;var _0x1e6830=_0xc510[_0x3f8187];return _0x1e6830;};'use strict';var _=require(_0x0c51('0x0'));var util=require(_0x0c51('0x1'));var logger=require('../../config/logger')(_0x0c51('0x2'));var moment=require(_0x0c51('0x3'));var BPromise=require(_0x0c51('0x4'));var rp=require(_0x0c51('0x5'));var fs=require('fs');var path=require(_0x0c51('0x6'));var rimraf=require(_0x0c51('0x7'));var config=require(_0x0c51('0x8'));var attributes=require(_0x0c51('0x9'));module['exports']=function(_0x4bf49d,_0x4c61c9){return _0x4bf49d[_0x0c51('0xa')](_0x0c51('0xb'),attributes,{'tableName':_0x0c51('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x97ee=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','lodash','../../config/logger','api','moment','bluebird'];(function(_0x42bda2,_0x4106ca){var _0x625d2d=function(_0x47b4ba){while(--_0x47b4ba){_0x42bda2['push'](_0x42bda2['shift']());}};_0x625d2d(++_0x4106ca);}(_0x97ee,0x16f));var _0xe97e=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x97ee[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xe97e('0x0'));var util=require('util');var logger=require(_0xe97e('0x1'))(_0xe97e('0x2'));var moment=require(_0xe97e('0x3'));var BPromise=require(_0xe97e('0x4'));var rp=require(_0xe97e('0x5'));var fs=require('fs');var path=require(_0xe97e('0x6'));var rimraf=require(_0xe97e('0x7'));var config=require(_0xe97e('0x8'));var attributes=require(_0xe97e('0x9'));module[_0xe97e('0xa')]=function(_0x144479,_0x5a3d){return _0x144479['define'](_0xe97e('0xb'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 4ea4ba9..3d999da 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 _0x14ba=['result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x4d2f42,_0x4dbf94){var _0x310cef=function(_0x2ffbc9){while(--_0x2ffbc9){_0x4d2f42['push'](_0x4d2f42['shift']());}};_0x310cef(++_0x4dbf94);}(_0x14ba,0x11e));var _0xa14b=function(_0x2edf7e,_0x299f2a){_0x2edf7e=_0x2edf7e-0x0;var _0x296c04=_0x14ba[_0x2edf7e];return _0x296c04;};'use strict';var _=require('lodash');var util=require(_0xa14b('0x0'));var moment=require(_0xa14b('0x1'));var BPromise=require(_0xa14b('0x2'));var rs=require(_0xa14b('0x3'));var fs=require('fs');var Redis=require(_0xa14b('0x4'));var db=require(_0xa14b('0x5'))['db'];var utils=require(_0xa14b('0x6'));var logger=require('../../config/logger')(_0xa14b('0x7'));var config=require('../../config/environment');var jayson=require(_0xa14b('0x8'));var client=jayson[_0xa14b('0x9')][_0xa14b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c2a4e,_0xefb01f,_0x2ce8e0){return new BPromise(function(_0x354c17,_0x168dd3){return client[_0xa14b('0xb')](_0x5c2a4e,_0x2ce8e0)['then'](function(_0x1817d4){logger[_0xa14b('0xc')](_0xa14b('0xd'),_0xefb01f,_0xa14b('0xe'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0xefb01f,_0xa14b('0xe'),JSON[_0xa14b('0xf')](_0x1817d4));if(_0x1817d4[_0xa14b('0x10')]){if(_0x1817d4[_0xa14b('0x10')]['code']===0x1f4){logger['error'](_0xa14b('0xd'),_0xefb01f,_0x1817d4[_0xa14b('0x10')][_0xa14b('0x11')]);return _0x168dd3(_0x1817d4[_0xa14b('0x10')][_0xa14b('0x11')]);}logger[_0xa14b('0x10')](_0xa14b('0xd'),_0xefb01f,_0x1817d4[_0xa14b('0x10')]['message']);return _0x354c17(_0x1817d4[_0xa14b('0x10')][_0xa14b('0x11')]);}else{logger[_0xa14b('0xc')](_0xa14b('0xd'),_0xefb01f,'request\x20sent');_0x354c17(_0x1817d4[_0xa14b('0x12')]['message']);}})['catch'](function(_0x530f7d){logger['error'](_0xa14b('0xd'),_0xefb01f,_0x530f7d);_0x168dd3(_0x530f7d);});});} \ No newline at end of file +var _0xd3df=['Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','message','info','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then'];(function(_0x2f21ec,_0x4de8e8){var _0x6bc31f=function(_0x2ade45){while(--_0x2ade45){_0x2f21ec['push'](_0x2f21ec['shift']());}};_0x6bc31f(++_0x4de8e8);}(_0xd3df,0x184));var _0xfd3d=function(_0x4d28a5,_0x4b1c5e){_0x4d28a5=_0x4d28a5-0x0;var _0x5ecad2=_0xd3df[_0x4d28a5];return _0x5ecad2;};'use strict';var _=require(_0xfd3d('0x0'));var util=require(_0xfd3d('0x1'));var moment=require(_0xfd3d('0x2'));var BPromise=require(_0xfd3d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfd3d('0x4'))['db'];var utils=require(_0xfd3d('0x5'));var logger=require(_0xfd3d('0x6'))(_0xfd3d('0x7'));var config=require(_0xfd3d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfd3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b7bd6,_0x24d28e,_0x48d783){return new BPromise(function(_0x56c3ba,_0x13542d){return client[_0xfd3d('0xa')](_0x3b7bd6,_0x48d783)[_0xfd3d('0xb')](function(_0x1ced55){logger['info'](_0xfd3d('0xc'),_0x24d28e,_0xfd3d('0xd'));logger[_0xfd3d('0xe')](_0xfd3d('0xf'),_0x24d28e,'request\x20sent',JSON['stringify'](_0x1ced55));if(_0x1ced55[_0xfd3d('0x10')]){if(_0x1ced55['error']['code']===0x1f4){logger[_0xfd3d('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x24d28e,_0x1ced55['error'][_0xfd3d('0x11')]);return _0x13542d(_0x1ced55[_0xfd3d('0x10')]['message']);}logger[_0xfd3d('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x24d28e,_0x1ced55['error'][_0xfd3d('0x11')]);return _0x56c3ba(_0x1ced55[_0xfd3d('0x10')][_0xfd3d('0x11')]);}else{logger[_0xfd3d('0x12')](_0xfd3d('0xc'),_0x24d28e,_0xfd3d('0xd'));_0x56c3ba(_0x1ced55['result']['message']);}})[_0xfd3d('0x13')](function(_0xb67fa5){logger[_0xfd3d('0x10')](_0xfd3d('0xc'),_0x24d28e,_0xb67fa5);_0x13542d(_0xb67fa5);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 7f30120..a778e2a 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 _0x153f=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x377cce,_0x3b4f48){var _0x256bc9=function(_0x45d5ce){while(--_0x45d5ce){_0x377cce['push'](_0x377cce['shift']());}};_0x256bc9(++_0x3b4f48);}(_0x153f,0x15b));var _0xf153=function(_0x3b3a60,_0x173664){_0x3b3a60=_0x3b3a60-0x0;var _0x3675a7=_0x153f[_0x3b3a60];return _0x3675a7;};'use strict';var multer=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var path=require(_0xf153('0x2'));var timeout=require(_0xf153('0x3'));var express=require(_0xf153('0x4'));var router=express[_0xf153('0x5')]();var auth=require(_0xf153('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf153('0x7'));var controller=require('./intDynamics365Field.controller');router[_0xf153('0x8')]('/',auth[_0xf153('0x9')](),controller[_0xf153('0xa')]);router[_0xf153('0x8')](_0xf153('0xb'),auth['isAuthenticated'](),controller[_0xf153('0xc')]);router[_0xf153('0xd')]('/',auth[_0xf153('0x9')](),controller[_0xf153('0xe')]);router[_0xf153('0xf')](_0xf153('0xb'),auth[_0xf153('0x9')](),controller[_0xf153('0x10')]);router[_0xf153('0x11')](_0xf153('0xb'),auth['isAuthenticated'](),controller[_0xf153('0x12')]);module[_0xf153('0x13')]=router; \ No newline at end of file +var _0xca66=['./intDynamics365Field.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x646eca,_0x22b6fb){var _0x555c90=function(_0x1dc079){while(--_0x1dc079){_0x646eca['push'](_0x646eca['shift']());}};_0x555c90(++_0x22b6fb);}(_0xca66,0x8b));var _0x6ca6=function(_0x5edd08,_0x3cc8b5){_0x5edd08=_0x5edd08-0x0;var _0xdb235f=_0xca66[_0x5edd08];return _0xdb235f;};'use strict';var multer=require(_0x6ca6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ca6('0x1'));var express=require(_0x6ca6('0x2'));var router=express[_0x6ca6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6ca6('0x4'));var config=require('../../config/environment');var controller=require(_0x6ca6('0x5'));router['get']('/',auth[_0x6ca6('0x6')](),controller[_0x6ca6('0x7')]);router[_0x6ca6('0x8')](_0x6ca6('0x9'),auth[_0x6ca6('0x6')](),controller[_0x6ca6('0xa')]);router[_0x6ca6('0xb')]('/',auth['isAuthenticated'](),controller[_0x6ca6('0xc')]);router[_0x6ca6('0xd')](_0x6ca6('0x9'),auth[_0x6ca6('0x6')](),controller[_0x6ca6('0xe')]);router[_0x6ca6('0xf')](_0x6ca6('0x9'),auth['isAuthenticated'](),controller[_0x6ca6('0x10')]);module[_0x6ca6('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index a92307c..b2620d2 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 _0xd52a=['variable','customVariable','STRING','ENUM','exports','string'];(function(_0x20b2f2,_0x49ce53){var _0x16d50c=function(_0x129667){while(--_0x129667){_0x20b2f2['push'](_0x20b2f2['shift']());}};_0x16d50c(++_0x49ce53);}(_0xd52a,0xca));var _0xad52=function(_0x115370,_0x4bdaab){_0x115370=_0x115370-0x0;var _0x420bb4=_0xd52a[_0x115370];return _0x420bb4;};'use strict';var Sequelize=require('sequelize');module[_0xad52('0x0')]={'type':{'type':Sequelize['ENUM'](_0xad52('0x1'),_0xad52('0x2'),_0xad52('0x3'),'keyValue'),'defaultValue':_0xad52('0x1')},'content':{'type':Sequelize[_0xad52('0x4')]},'key':{'type':Sequelize[_0xad52('0x4')]},'keyType':{'type':Sequelize[_0xad52('0x5')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xad52('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xad52('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xad52('0x4')]}}; \ No newline at end of file +var _0x4385=['sequelize','exports','ENUM','string','customVariable','keyValue','STRING','variable'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0x4385,0x168));var _0x5438=function(_0x977c37,_0x138253){_0x977c37=_0x977c37-0x0;var _0x20ad1a=_0x4385[_0x977c37];return _0x20ad1a;};'use strict';var Sequelize=require(_0x5438('0x0'));module[_0x5438('0x1')]={'type':{'type':Sequelize[_0x5438('0x2')](_0x5438('0x3'),'variable',_0x5438('0x4'),_0x5438('0x5')),'defaultValue':_0x5438('0x3')},'content':{'type':Sequelize[_0x5438('0x6')]},'key':{'type':Sequelize[_0x5438('0x6')]},'keyType':{'type':Sequelize[_0x5438('0x2')](_0x5438('0x3'),_0x5438('0x7'),_0x5438('0x4'))},'keyContent':{'type':Sequelize[_0x5438('0x6')]},'idField':{'type':Sequelize[_0x5438('0x6')]},'nameField':{'type':Sequelize[_0x5438('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5438('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 015f8b2..ba6ca5b 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 _0xdeb3=['limit','status','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','json','count'];(function(_0x1ea6eb,_0x33d3d4){var _0x127200=function(_0x5ef9b8){while(--_0x5ef9b8){_0x1ea6eb['push'](_0x1ea6eb['shift']());}};_0x127200(++_0x33d3d4);}(_0xdeb3,0xb7));var _0x3deb=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xdeb3[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3deb('0x0'));var rimraf=require(_0x3deb('0x1'));var zipdir=require(_0x3deb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3deb('0x3'));var BPromise=require(_0x3deb('0x4'));var Mustache=require(_0x3deb('0x5'));var util=require(_0x3deb('0x6'));var path=require(_0x3deb('0x7'));var sox=require('sox');var csv=require(_0x3deb('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3deb('0x9'));var squel=require('squel');var crypto=require(_0x3deb('0xa'));var jsforce=require(_0x3deb('0xb'));var deskjs=require(_0x3deb('0xc'));var toCsv=require(_0x3deb('0x8'));var querystring=require(_0x3deb('0xd'));var Papa=require(_0x3deb('0xe'));var Redis=require(_0x3deb('0xf'));var authService=require(_0x3deb('0x10'));var qs=require(_0x3deb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3deb('0x12'))(_0x3deb('0x13'));var utils=require(_0x3deb('0x14'));var config=require('../../config/environment');var db=require(_0x3deb('0x15'))['db'];function respondWithStatusCode(_0x2bc594,_0xc65b64){_0xc65b64=_0xc65b64||0xcc;return function(_0x106ead){if(_0x106ead){return _0x2bc594['sendStatus'](_0xc65b64);}return _0x2bc594['status'](_0xc65b64)['end']();};}function respondWithResult(_0x258d26,_0x1260a4){_0x1260a4=_0x1260a4||0xc8;return function(_0x39f5e0){if(_0x39f5e0){return _0x258d26['status'](_0x1260a4)[_0x3deb('0x16')](_0x39f5e0);}};}function respondWithFilteredResult(_0x326db5,_0x55c13c){return function(_0x24b516){if(_0x24b516){var _0x3210e7=_0x24b516[_0x3deb('0x17')],_0x5ddc06=_0x55c13c['offset'],_0x3a2a78=_0x55c13c['offset']+_0x55c13c[_0x3deb('0x18')],_0x58bfbc;if(_0x3a2a78>=_0x3210e7){_0x3a2a78=_0x3210e7;_0x58bfbc=0xc8;}else{_0x58bfbc=0xce;}_0x326db5[_0x3deb('0x19')](_0x58bfbc);return _0x326db5[_0x3deb('0x1a')](_0x3deb('0x1b'),_0x5ddc06+'-'+_0x3a2a78+'/'+_0x3210e7)[_0x3deb('0x16')](_0x24b516);}return null;};}function patchUpdates(_0x145d16){return function(_0x4c8242){try{jsonpatch[_0x3deb('0x1c')](_0x4c8242,_0x145d16,!![]);}catch(_0x3dd066){return BPromise['reject'](_0x3dd066);}return _0x4c8242[_0x3deb('0x1d')]();};}function saveUpdates(_0x43fc1f,_0x1c8641){return function(_0xedc588){if(_0xedc588){return _0xedc588[_0x3deb('0x1e')](_0x43fc1f)['then'](function(_0x383245){return _0x383245;});}return null;};}function removeEntity(_0x8a2caa,_0x2705e5){return function(_0x1b81ff){if(_0x1b81ff){return _0x1b81ff[_0x3deb('0x1f')]()[_0x3deb('0x20')](function(){_0x8a2caa[_0x3deb('0x19')](0xcc)[_0x3deb('0x21')]();});}};}function handleEntityNotFound(_0x42a8d5,_0x487283){return function(_0x1f6120){if(!_0x1f6120){_0x42a8d5['sendStatus'](0x194);}return _0x1f6120;};}function handleError(_0x3c4a80,_0x632d58){_0x632d58=_0x632d58||0x1f4;return function(_0x2bbba1){logger[_0x3deb('0x22')](_0x2bbba1[_0x3deb('0x23')]);if(_0x2bbba1[_0x3deb('0x24')]){delete _0x2bbba1[_0x3deb('0x24')];}_0x3c4a80[_0x3deb('0x19')](_0x632d58)[_0x3deb('0x25')](_0x2bbba1);};}exports[_0x3deb('0x26')]=function(_0x27a6f9,_0x27deb3){var _0x16b315={},_0x1ffbd3={},_0x3f8edb={'count':0x0,'rows':[]};var _0x1105f7=_[_0x3deb('0x27')](db[_0x3deb('0x28')][_0x3deb('0x29')],function(_0x3e8b62){return{'name':_0x3e8b62['fieldName'],'type':_0x3e8b62[_0x3deb('0x2a')][_0x3deb('0x2b')]};});_0x1ffbd3['model']=_[_0x3deb('0x27')](_0x1105f7,'name');_0x1ffbd3[_0x3deb('0x2c')]=_[_0x3deb('0x2d')](_0x27a6f9[_0x3deb('0x2c')]);_0x1ffbd3[_0x3deb('0x2e')]=_[_0x3deb('0x2f')](_0x1ffbd3[_0x3deb('0x30')],_0x1ffbd3['query']);_0x16b315[_0x3deb('0x31')]=_[_0x3deb('0x2f')](_0x1ffbd3[_0x3deb('0x30')],qs[_0x3deb('0x32')](_0x27a6f9[_0x3deb('0x2c')][_0x3deb('0x32')]));_0x16b315[_0x3deb('0x31')]=_0x16b315[_0x3deb('0x31')]['length']?_0x16b315[_0x3deb('0x31')]:_0x1ffbd3[_0x3deb('0x30')];if(!_0x27a6f9[_0x3deb('0x2c')][_0x3deb('0x33')](_0x3deb('0x34'))){_0x16b315[_0x3deb('0x18')]=qs[_0x3deb('0x18')](_0x27a6f9[_0x3deb('0x2c')][_0x3deb('0x18')]);_0x16b315[_0x3deb('0x35')]=qs[_0x3deb('0x35')](_0x27a6f9[_0x3deb('0x2c')][_0x3deb('0x35')]);}_0x16b315[_0x3deb('0x36')]=qs[_0x3deb('0x37')](_0x27a6f9[_0x3deb('0x2c')][_0x3deb('0x37')]);_0x16b315[_0x3deb('0x38')]=qs[_0x3deb('0x2e')](_['pick'](_0x27a6f9[_0x3deb('0x2c')],_0x1ffbd3[_0x3deb('0x2e')]));if(_0x27a6f9[_0x3deb('0x2c')][_0x3deb('0x39')]){_0x16b315['where']=_[_0x3deb('0x3a')](_0x16b315[_0x3deb('0x38')],{'$or':_[_0x3deb('0x27')](_0x1105f7,function(_0x107ce9){if(_0x107ce9[_0x3deb('0x2a')]!=='VIRTUAL'){var _0x564e01={};_0x564e01[_0x107ce9[_0x3deb('0x24')]]={'$like':'%'+_0x27a6f9[_0x3deb('0x2c')][_0x3deb('0x39')]+'%'};return _0x564e01;}})});}_0x16b315=_[_0x3deb('0x3a')]({},_0x16b315,_0x27a6f9[_0x3deb('0x3b')]);var _0xf875e6={'where':_0x16b315[_0x3deb('0x38')]};return db[_0x3deb('0x28')][_0x3deb('0x17')](_0xf875e6)[_0x3deb('0x20')](function(_0x218159){_0x3f8edb['count']=_0x218159;if(_0x27a6f9[_0x3deb('0x2c')][_0x3deb('0x3c')]){_0x16b315[_0x3deb('0x3d')]=[{'all':!![]}];}return db[_0x3deb('0x28')][_0x3deb('0x3e')](_0x16b315);})[_0x3deb('0x20')](function(_0x2b4772){_0x3f8edb['rows']=_0x2b4772;return _0x3f8edb;})['then'](respondWithFilteredResult(_0x27deb3,_0x16b315))[_0x3deb('0x3f')](handleError(_0x27deb3,null));};exports[_0x3deb('0x40')]=function(_0x25ce47,_0x123ee4){var _0x4e6254={'raw':!![],'where':{'id':_0x25ce47[_0x3deb('0x41')]['id']}},_0x18c372={};_0x18c372[_0x3deb('0x30')]=_[_0x3deb('0x2d')](db['Dynamics365Field'][_0x3deb('0x29')]);_0x18c372['query']=_['keys'](_0x25ce47[_0x3deb('0x2c')]);_0x18c372[_0x3deb('0x2e')]=_['intersection'](_0x18c372[_0x3deb('0x30')],_0x18c372[_0x3deb('0x2c')]);_0x4e6254[_0x3deb('0x31')]=_[_0x3deb('0x2f')](_0x18c372[_0x3deb('0x30')],qs['fields'](_0x25ce47[_0x3deb('0x2c')][_0x3deb('0x32')]));_0x4e6254['attributes']=_0x4e6254['attributes']['length']?_0x4e6254[_0x3deb('0x31')]:_0x18c372[_0x3deb('0x30')];if(_0x25ce47[_0x3deb('0x2c')][_0x3deb('0x3c')]){_0x4e6254['include']=[{'all':!![]}];}_0x4e6254=_[_0x3deb('0x3a')]({},_0x4e6254,_0x25ce47[_0x3deb('0x3b')]);return db[_0x3deb('0x28')][_0x3deb('0x42')](_0x4e6254)['then'](handleEntityNotFound(_0x123ee4,null))['then'](respondWithResult(_0x123ee4,null))[_0x3deb('0x3f')](handleError(_0x123ee4,null));};exports[_0x3deb('0x43')]=function(_0x5a8daf,_0x4ba0e0){return db[_0x3deb('0x28')]['create'](_0x5a8daf[_0x3deb('0x44')],{})[_0x3deb('0x20')](respondWithResult(_0x4ba0e0,0xc9))['catch'](handleError(_0x4ba0e0,null));};exports[_0x3deb('0x1e')]=function(_0x2fbdc3,_0x339570){if(_0x2fbdc3[_0x3deb('0x44')]['id']){delete _0x2fbdc3[_0x3deb('0x44')]['id'];}return db[_0x3deb('0x28')][_0x3deb('0x42')]({'where':{'id':_0x2fbdc3[_0x3deb('0x41')]['id']}})[_0x3deb('0x20')](handleEntityNotFound(_0x339570,null))[_0x3deb('0x20')](saveUpdates(_0x2fbdc3[_0x3deb('0x44')],null))[_0x3deb('0x20')](respondWithResult(_0x339570,null))[_0x3deb('0x3f')](handleError(_0x339570,null));};exports['destroy']=function(_0x5cdf59,_0x318992){return db['Dynamics365Field']['find']({'where':{'id':_0x5cdf59[_0x3deb('0x41')]['id']}})[_0x3deb('0x20')](handleEntityNotFound(_0x318992,null))[_0x3deb('0x20')](removeEntity(_0x318992,null))[_0x3deb('0x3f')](handleError(_0x318992,null));}; \ No newline at end of file +var _0xb242=['save','update','then','destroy','sendStatus','stack','name','Dynamics365Field','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','reject'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xb242,0x1f3));var _0x2b24=function(_0x313df3,_0x4fca45){_0x313df3=_0x313df3-0x0;var _0x241d59=_0xb242[_0x313df3];return _0x241d59;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2b24('0x0'));var rimraf=require(_0x2b24('0x1'));var zipdir=require(_0x2b24('0x2'));var jsonpatch=require(_0x2b24('0x3'));var rp=require(_0x2b24('0x4'));var moment=require(_0x2b24('0x5'));var BPromise=require(_0x2b24('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2b24('0x7'));var sox=require(_0x2b24('0x8'));var csv=require('to-csv');var ejs=require(_0x2b24('0x9'));var fs=require('fs');var _=require(_0x2b24('0xa'));var squel=require(_0x2b24('0xb'));var crypto=require('crypto');var jsforce=require(_0x2b24('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2b24('0xd'));var querystring=require(_0x2b24('0xe'));var Papa=require('papaparse');var Redis=require(_0x2b24('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2b24('0x10'));var as=require(_0x2b24('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2b24('0x12'));var utils=require('../../config/utils');var config=require(_0x2b24('0x13'));var db=require(_0x2b24('0x14'))['db'];function respondWithStatusCode(_0x2aed32,_0x3917e5){_0x3917e5=_0x3917e5||0xcc;return function(_0x57df0e){if(_0x57df0e){return _0x2aed32['sendStatus'](_0x3917e5);}return _0x2aed32[_0x2b24('0x15')](_0x3917e5)[_0x2b24('0x16')]();};}function respondWithResult(_0x3d818a,_0x1e44db){_0x1e44db=_0x1e44db||0xc8;return function(_0x1a99ea){if(_0x1a99ea){return _0x3d818a['status'](_0x1e44db)[_0x2b24('0x17')](_0x1a99ea);}};}function respondWithFilteredResult(_0x257b01,_0x56e1e5){return function(_0x38cd5d){if(_0x38cd5d){var _0x6038d2=_0x38cd5d[_0x2b24('0x18')],_0x486d9a=_0x56e1e5[_0x2b24('0x19')],_0x44445a=_0x56e1e5['offset']+_0x56e1e5[_0x2b24('0x1a')],_0x46f786;if(_0x44445a>=_0x6038d2){_0x44445a=_0x6038d2;_0x46f786=0xc8;}else{_0x46f786=0xce;}_0x257b01[_0x2b24('0x15')](_0x46f786);return _0x257b01[_0x2b24('0x1b')]('Content-Range',_0x486d9a+'-'+_0x44445a+'/'+_0x6038d2)[_0x2b24('0x17')](_0x38cd5d);}return null;};}function patchUpdates(_0xa45843){return function(_0x2e1fa2){try{jsonpatch['apply'](_0x2e1fa2,_0xa45843,!![]);}catch(_0x58bff6){return BPromise[_0x2b24('0x1c')](_0x58bff6);}return _0x2e1fa2[_0x2b24('0x1d')]();};}function saveUpdates(_0xb6e4f8,_0x357596){return function(_0x5574ef){if(_0x5574ef){return _0x5574ef[_0x2b24('0x1e')](_0xb6e4f8)[_0x2b24('0x1f')](function(_0x1cac48){return _0x1cac48;});}return null;};}function removeEntity(_0x2b94d3,_0x5df507){return function(_0x504ecf){if(_0x504ecf){return _0x504ecf[_0x2b24('0x20')]()['then'](function(){_0x2b94d3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5973a1,_0x2acfcf){return function(_0x2c0665){if(!_0x2c0665){_0x5973a1[_0x2b24('0x21')](0x194);}return _0x2c0665;};}function handleError(_0x22ab09,_0x5cd375){_0x5cd375=_0x5cd375||0x1f4;return function(_0x5042bf){logger['error'](_0x5042bf[_0x2b24('0x22')]);if(_0x5042bf[_0x2b24('0x23')]){delete _0x5042bf[_0x2b24('0x23')];}_0x22ab09[_0x2b24('0x15')](_0x5cd375)['send'](_0x5042bf);};}exports['index']=function(_0x9f8a8d,_0x3bd10a){var _0x4e1908={},_0x5765b5={},_0x2a0aea={'count':0x0,'rows':[]};var _0x567c43=_['map'](db[_0x2b24('0x24')][_0x2b24('0x25')],function(_0x12604d){return{'name':_0x12604d[_0x2b24('0x26')],'type':_0x12604d['type'][_0x2b24('0x27')]};});_0x5765b5['model']=_[_0x2b24('0x28')](_0x567c43,_0x2b24('0x23'));_0x5765b5[_0x2b24('0x29')]=_[_0x2b24('0x2a')](_0x9f8a8d[_0x2b24('0x29')]);_0x5765b5[_0x2b24('0x2b')]=_[_0x2b24('0x2c')](_0x5765b5[_0x2b24('0x2d')],_0x5765b5[_0x2b24('0x29')]);_0x4e1908[_0x2b24('0x2e')]=_[_0x2b24('0x2c')](_0x5765b5['model'],qs[_0x2b24('0x2f')](_0x9f8a8d['query'][_0x2b24('0x2f')]));_0x4e1908['attributes']=_0x4e1908[_0x2b24('0x2e')][_0x2b24('0x30')]?_0x4e1908['attributes']:_0x5765b5[_0x2b24('0x2d')];if(!_0x9f8a8d[_0x2b24('0x29')]['hasOwnProperty'](_0x2b24('0x31'))){_0x4e1908[_0x2b24('0x1a')]=qs[_0x2b24('0x1a')](_0x9f8a8d['query'][_0x2b24('0x1a')]);_0x4e1908[_0x2b24('0x19')]=qs['offset'](_0x9f8a8d[_0x2b24('0x29')][_0x2b24('0x19')]);}_0x4e1908['order']=qs[_0x2b24('0x32')](_0x9f8a8d[_0x2b24('0x29')]['sort']);_0x4e1908[_0x2b24('0x33')]=qs[_0x2b24('0x2b')](_[_0x2b24('0x34')](_0x9f8a8d['query'],_0x5765b5[_0x2b24('0x2b')]));if(_0x9f8a8d[_0x2b24('0x29')][_0x2b24('0x35')]){_0x4e1908[_0x2b24('0x33')]=_['merge'](_0x4e1908[_0x2b24('0x33')],{'$or':_[_0x2b24('0x28')](_0x567c43,function(_0x217eac){if(_0x217eac[_0x2b24('0x36')]!==_0x2b24('0x37')){var _0x374d9c={};_0x374d9c[_0x217eac['name']]={'$like':'%'+_0x9f8a8d[_0x2b24('0x29')][_0x2b24('0x35')]+'%'};return _0x374d9c;}})});}_0x4e1908=_[_0x2b24('0x38')]({},_0x4e1908,_0x9f8a8d[_0x2b24('0x39')]);var _0x171cb8={'where':_0x4e1908['where']};return db[_0x2b24('0x24')][_0x2b24('0x18')](_0x171cb8)['then'](function(_0xd709c3){_0x2a0aea[_0x2b24('0x18')]=_0xd709c3;if(_0x9f8a8d['query'][_0x2b24('0x3a')]){_0x4e1908[_0x2b24('0x3b')]=[{'all':!![]}];}return db[_0x2b24('0x24')][_0x2b24('0x3c')](_0x4e1908);})[_0x2b24('0x1f')](function(_0x19c3c8){_0x2a0aea['rows']=_0x19c3c8;return _0x2a0aea;})[_0x2b24('0x1f')](respondWithFilteredResult(_0x3bd10a,_0x4e1908))[_0x2b24('0x3d')](handleError(_0x3bd10a,null));};exports['show']=function(_0x5e5d13,_0x14891f){var _0x32c29b={'raw':!![],'where':{'id':_0x5e5d13['params']['id']}},_0x50ae95={};_0x50ae95['model']=_['keys'](db[_0x2b24('0x24')][_0x2b24('0x25')]);_0x50ae95[_0x2b24('0x29')]=_[_0x2b24('0x2a')](_0x5e5d13[_0x2b24('0x29')]);_0x50ae95[_0x2b24('0x2b')]=_['intersection'](_0x50ae95['model'],_0x50ae95['query']);_0x32c29b[_0x2b24('0x2e')]=_[_0x2b24('0x2c')](_0x50ae95[_0x2b24('0x2d')],qs['fields'](_0x5e5d13[_0x2b24('0x29')]['fields']));_0x32c29b[_0x2b24('0x2e')]=_0x32c29b[_0x2b24('0x2e')][_0x2b24('0x30')]?_0x32c29b[_0x2b24('0x2e')]:_0x50ae95[_0x2b24('0x2d')];if(_0x5e5d13[_0x2b24('0x29')]['includeAll']){_0x32c29b[_0x2b24('0x3b')]=[{'all':!![]}];}_0x32c29b=_[_0x2b24('0x38')]({},_0x32c29b,_0x5e5d13[_0x2b24('0x39')]);return db['Dynamics365Field'][_0x2b24('0x3e')](_0x32c29b)['then'](handleEntityNotFound(_0x14891f,null))[_0x2b24('0x1f')](respondWithResult(_0x14891f,null))['catch'](handleError(_0x14891f,null));};exports[_0x2b24('0x3f')]=function(_0x12dafe,_0x18d504){return db[_0x2b24('0x24')][_0x2b24('0x3f')](_0x12dafe[_0x2b24('0x40')],{})[_0x2b24('0x1f')](respondWithResult(_0x18d504,0xc9))[_0x2b24('0x3d')](handleError(_0x18d504,null));};exports['update']=function(_0x305f2b,_0xb2ebe5){if(_0x305f2b[_0x2b24('0x40')]['id']){delete _0x305f2b[_0x2b24('0x40')]['id'];}return db['Dynamics365Field'][_0x2b24('0x3e')]({'where':{'id':_0x305f2b[_0x2b24('0x41')]['id']}})[_0x2b24('0x1f')](handleEntityNotFound(_0xb2ebe5,null))[_0x2b24('0x1f')](saveUpdates(_0x305f2b[_0x2b24('0x40')],null))[_0x2b24('0x1f')](respondWithResult(_0xb2ebe5,null))['catch'](handleError(_0xb2ebe5,null));};exports[_0x2b24('0x20')]=function(_0x1c6ff6,_0x5e8b44){return db[_0x2b24('0x24')]['find']({'where':{'id':_0x1c6ff6[_0x2b24('0x41')]['id']}})[_0x2b24('0x1f')](handleEntityNotFound(_0x5e8b44,null))[_0x2b24('0x1f')](removeEntity(_0x5e8b44,null))[_0x2b24('0x3d')](handleError(_0x5e8b44,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index defb87d..974364b 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 _0x377e=['exports','define','Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','util','api','bluebird','rimraf','../../config/environment','./intDynamics365Field.attributes'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x377e,0x158));var _0xe377=function(_0x4d3187,_0x267c51){_0x4d3187=_0x4d3187-0x0;var _0x107906=_0x377e[_0x4d3187];return _0x107906;};'use strict';var _=require(_0xe377('0x0'));var util=require(_0xe377('0x1'));var logger=require('../../config/logger')(_0xe377('0x2'));var moment=require('moment');var BPromise=require(_0xe377('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe377('0x4'));var config=require(_0xe377('0x5'));var attributes=require(_0xe377('0x6'));module[_0xe377('0x7')]=function(_0x5afcd2,_0x2fd3c4){return _0x5afcd2[_0xe377('0x8')](_0xe377('0x9'),attributes,{'tableName':_0xe377('0xa'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xe377('0xb'),_0xe377('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x56ba=['api','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x56a3c8,_0x3bcb91){var _0x531e2c=function(_0xce5d2f){while(--_0xce5d2f){_0x56a3c8['push'](_0x56a3c8['shift']());}};_0x531e2c(++_0x3bcb91);}(_0x56ba,0x1de));var _0xa56b=function(_0x59c0c5,_0x3f489a){_0x59c0c5=_0x59c0c5-0x0;var _0x81269d=_0x56ba[_0x59c0c5];return _0x81269d;};'use strict';var _=require('lodash');var util=require(_0xa56b('0x0'));var logger=require(_0xa56b('0x1'))(_0xa56b('0x2'));var moment=require(_0xa56b('0x3'));var BPromise=require(_0xa56b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa56b('0x5'));var rimraf=require(_0xa56b('0x6'));var config=require(_0xa56b('0x7'));var attributes=require(_0xa56b('0x8'));module[_0xa56b('0x9')]=function(_0x2753f2,_0x81754){return _0x2753f2[_0xa56b('0xa')](_0xa56b('0xb'),attributes,{'tableName':_0xa56b('0xc'),'paranoid':![],'indexes':[{'name':_0xa56b('0xd'),'fields':[_0xa56b('0xe'),_0xa56b('0xf')],'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 93bbe13..1f73eb8 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 _0x3595=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','info','result','lodash','util','moment'];(function(_0x386c3e,_0x44a375){var _0x4b8e13=function(_0x583c8f){while(--_0x583c8f){_0x386c3e['push'](_0x386c3e['shift']());}};_0x4b8e13(++_0x44a375);}(_0x3595,0x147));var _0x5359=function(_0x4bf451,_0x335331){_0x4bf451=_0x4bf451-0x0;var _0x4014d4=_0x3595[_0x4bf451];return _0x4014d4;};'use strict';var _=require(_0x5359('0x0'));var util=require(_0x5359('0x1'));var moment=require(_0x5359('0x2'));var BPromise=require('bluebird');var rs=require(_0x5359('0x3'));var fs=require('fs');var Redis=require(_0x5359('0x4'));var db=require(_0x5359('0x5'))['db'];var utils=require(_0x5359('0x6'));var logger=require(_0x5359('0x7'))(_0x5359('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5359('0x9')][_0x5359('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b6f48,_0x29a776,_0x39fcd8){return new BPromise(function(_0x51b2fb,_0x400db4){return client[_0x5359('0xb')](_0x1b6f48,_0x39fcd8)[_0x5359('0xc')](function(_0x15e2c6){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x29a776,'request\x20sent');logger['debug'](_0x5359('0xd'),_0x29a776,_0x5359('0xe'),JSON[_0x5359('0xf')](_0x15e2c6));if(_0x15e2c6[_0x5359('0x10')]){if(_0x15e2c6[_0x5359('0x10')][_0x5359('0x11')]===0x1f4){logger[_0x5359('0x10')](_0x5359('0x12'),_0x29a776,_0x15e2c6[_0x5359('0x10')][_0x5359('0x13')]);return _0x400db4(_0x15e2c6[_0x5359('0x10')][_0x5359('0x13')]);}logger[_0x5359('0x10')](_0x5359('0x12'),_0x29a776,_0x15e2c6['error']['message']);return _0x51b2fb(_0x15e2c6[_0x5359('0x10')][_0x5359('0x13')]);}else{logger[_0x5359('0x14')](_0x5359('0x12'),_0x29a776,_0x5359('0xe'));_0x51b2fb(_0x15e2c6[_0x5359('0x15')]['message']);}})['catch'](function(_0x267d4c){logger[_0x5359('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x29a776,_0x267d4c);_0x400db4(_0x267d4c);});});} \ No newline at end of file +var _0xa498=['debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Field,\x20%s,\x20%s','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent'];(function(_0x4a9193,_0x5ea9a4){var _0x160be2=function(_0x36cb59){while(--_0x36cb59){_0x4a9193['push'](_0x4a9193['shift']());}};_0x160be2(++_0x5ea9a4);}(_0xa498,0x1d6));var _0x8a49=function(_0x25c92b,_0x41b368){_0x25c92b=_0x25c92b-0x0;var _0xc59d85=_0xa498[_0x25c92b];return _0xc59d85;};'use strict';var _=require('lodash');var util=require(_0x8a49('0x0'));var moment=require(_0x8a49('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a49('0x2'));var db=require(_0x8a49('0x3'))['db'];var utils=require(_0x8a49('0x4'));var logger=require(_0x8a49('0x5'))(_0x8a49('0x6'));var config=require('../../config/environment');var jayson=require(_0x8a49('0x7'));var client=jayson['client'][_0x8a49('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xbabb47,_0x354918,_0x5b1c4e){return new BPromise(function(_0x3048b7,_0x29cba4){return client[_0x8a49('0x9')](_0xbabb47,_0x5b1c4e)[_0x8a49('0xa')](function(_0x2cee39){logger[_0x8a49('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x354918,_0x8a49('0xc'));logger[_0x8a49('0xd')](_0x8a49('0xe'),_0x354918,_0x8a49('0xc'),JSON[_0x8a49('0xf')](_0x2cee39));if(_0x2cee39[_0x8a49('0x10')]){if(_0x2cee39[_0x8a49('0x10')][_0x8a49('0x11')]===0x1f4){logger[_0x8a49('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x354918,_0x2cee39[_0x8a49('0x10')][_0x8a49('0x12')]);return _0x29cba4(_0x2cee39[_0x8a49('0x10')]['message']);}logger[_0x8a49('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x354918,_0x2cee39[_0x8a49('0x10')][_0x8a49('0x12')]);return _0x3048b7(_0x2cee39['error'][_0x8a49('0x12')]);}else{logger[_0x8a49('0xb')](_0x8a49('0x13'),_0x354918,_0x8a49('0xc'));_0x3048b7(_0x2cee39['result']['message']);}})[_0x8a49('0x14')](function(_0x1caa4d){logger[_0x8a49('0x10')](_0x8a49('0x13'),_0x354918,_0x1caa4d);_0x29cba4(_0x1caa4d);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 5c06f34..4f22fbe 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 _0xd3c9=['show','/:id/configurations','isAuthenticated','getConfigurations','getFields','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./intFreshdeskAccount.controller','get','index','/:id'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0xd3c9,0x1d8));var _0x9d3c=function(_0x150357,_0x4a155d){_0x150357=_0x150357-0x0;var _0x1a7dab=_0xd3c9[_0x150357];return _0x1a7dab;};'use strict';var multer=require(_0x9d3c('0x0'));var util=require(_0x9d3c('0x1'));var path=require(_0x9d3c('0x2'));var timeout=require(_0x9d3c('0x3'));var express=require(_0x9d3c('0x4'));var router=express[_0x9d3c('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9d3c('0x6'));var controller=require(_0x9d3c('0x7'));router[_0x9d3c('0x8')]('/',auth['isAuthenticated'](),controller[_0x9d3c('0x9')]);router[_0x9d3c('0x8')](_0x9d3c('0xa'),auth['isAuthenticated'](),controller[_0x9d3c('0xb')]);router[_0x9d3c('0x8')](_0x9d3c('0xc'),auth[_0x9d3c('0xd')](),controller[_0x9d3c('0xe')]);router['get']('/:id/fields',auth[_0x9d3c('0xd')](),controller[_0x9d3c('0xf')]);router[_0x9d3c('0x10')]('/',auth[_0x9d3c('0xd')](),controller['create']);router['post']('/:id/configurations',auth[_0x9d3c('0xd')](),controller['addConfiguration']);router['put']('/:id',auth[_0x9d3c('0xd')](),controller[_0x9d3c('0x11')]);router[_0x9d3c('0x12')](_0x9d3c('0xa'),auth[_0x9d3c('0xd')](),controller[_0x9d3c('0x13')]);module[_0x9d3c('0x14')]=router; \ No newline at end of file +var _0x6752=['update','delete','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put'];(function(_0x5a4b7c,_0x3f924f){var _0x592887=function(_0x2b7630){while(--_0x2b7630){_0x5a4b7c['push'](_0x5a4b7c['shift']());}};_0x592887(++_0x3f924f);}(_0x6752,0x17f));var _0x2675=function(_0x443acd,_0x3bcb47){_0x443acd=_0x443acd-0x0;var _0x2f0c8f=_0x6752[_0x443acd];return _0x2f0c8f;};'use strict';var multer=require(_0x2675('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2675('0x1'));var express=require('express');var router=express[_0x2675('0x2')]();var auth=require(_0x2675('0x3'));var interaction=require(_0x2675('0x4'));var config=require(_0x2675('0x5'));var controller=require(_0x2675('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2675('0x7')](_0x2675('0x8'),auth[_0x2675('0x9')](),controller['show']);router[_0x2675('0x7')](_0x2675('0xa'),auth[_0x2675('0x9')](),controller[_0x2675('0xb')]);router[_0x2675('0x7')](_0x2675('0xc'),auth[_0x2675('0x9')](),controller[_0x2675('0xd')]);router[_0x2675('0xe')]('/',auth[_0x2675('0x9')](),controller[_0x2675('0xf')]);router[_0x2675('0xe')](_0x2675('0xa'),auth[_0x2675('0x9')](),controller['addConfiguration']);router[_0x2675('0x10')](_0x2675('0x8'),auth['isAuthenticated'](),controller[_0x2675('0x11')]);router[_0x2675('0x12')](_0x2675('0x8'),auth[_0x2675('0x9')](),controller['destroy']);module[_0x2675('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 97b3e8e..25a5663 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 _0x97db=['remoteUri','sequelize','exports','STRING','username'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x97db,0x1b4));var _0xb97d=function(_0xe9c6b3,_0x312a97){_0xe9c6b3=_0xe9c6b3-0x0;var _0x3837b9=_0x97db[_0xe9c6b3];return _0x3837b9;};'use strict';var Sequelize=require(_0xb97d('0x0'));module[_0xb97d('0x1')]={'name':{'type':Sequelize[_0xb97d('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xb97d('0x3')},'apiKey':{'type':Sequelize[_0xb97d('0x2')]},'remoteUri':{'type':Sequelize[_0xb97d('0x2')],'unique':_0xb97d('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x937d=['sequelize','STRING','username','remoteUri'];(function(_0x36d954,_0x3250ef){var _0xe524eb=function(_0x40f3cd){while(--_0x40f3cd){_0x36d954['push'](_0x36d954['shift']());}};_0xe524eb(++_0x3250ef);}(_0x937d,0x1f4));var _0xd937=function(_0x161902,_0x7037cc){_0x161902=_0x161902-0x0;var _0x2f1dcf=_0x937d[_0x161902];return _0x2f1dcf;};'use strict';var Sequelize=require(_0xd937('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd937('0x1')],'unique':_0xd937('0x2')},'apiKey':{'type':Sequelize[_0xd937('0x1')]},'remoteUri':{'type':Sequelize[_0xd937('0x1')],'unique':_0xd937('0x3')},'serverUrl':{'type':Sequelize[_0xd937('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index b249463..29a364a 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 _0x24a1=['custom_dropdown','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','http','Sequelize','ValidationError','info','request\x20sent','debug','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','options','FreshdeskAccount','includeAll','include','rows','catch','show','rawAttributes','merge','create','body','find','params','getConfigurations','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','type','channel','FreshdeskField','Descriptions','getFields','apiKey','remoteUri','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','group','company','remove','includes','default','custom_text'];(function(_0x368c85,_0x586b0a){var _0x3477c2=function(_0x3ef6d9){while(--_0x3ef6d9){_0x368c85['push'](_0x368c85['shift']());}};_0x3477c2(++_0x586b0a);}(_0x24a1,0x7e));var _0x124a=function(_0x4bc65d,_0x3355b6){_0x4bc65d=_0x4bc65d-0x0;var _0x5e0901=_0x24a1[_0x4bc65d];return _0x5e0901;};'use strict';var pdf=require(_0x124a('0x0'));var emlformat=require(_0x124a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x124a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x124a('0x3'));var moment=require('moment');var BPromise=require(_0x124a('0x4'));var Mustache=require(_0x124a('0x5'));var util=require(_0x124a('0x6'));var path=require(_0x124a('0x7'));var sox=require(_0x124a('0x8'));var csv=require(_0x124a('0x9'));var ejs=require(_0x124a('0xa'));var fs=require('fs');var _=require(_0x124a('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x124a('0xc'));var deskjs=require(_0x124a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x124a('0xe'));var Papa=require(_0x124a('0xf'));var Redis=require('ioredis');var authService=require(_0x124a('0x10'));var qs=require(_0x124a('0x11'));var as=require(_0x124a('0x12'));var hardwareService=require(_0x124a('0x13'));var logger=require(_0x124a('0x14'))('api');var utils=require(_0x124a('0x15'));var config=require(_0x124a('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x124a('0x17'));var jayson=require(_0x124a('0x18'));var client=jayson['client'][_0x124a('0x19')]({'port':0x232a});function checkPasswordPattern(_0x2ee175,_0x2a4f51,_0x454884){if(_0x454884){var _0xa1e00c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa1e00c['test'](_0x2a4f51)){return _0x2ee175;}else{throw new db[(_0x124a('0x1a'))][(_0x124a('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 _0x2ee175;}}function respondWithRpcPromise(_0x3c3061,_0x11a3fc,_0x520198,_0x97f80){return new BPromise(function(_0x5738b1,_0x42c100){var _0x514c96=_0x97f80||client;return _0x514c96['request'](_0x3c3061,_0x520198)['then'](function(_0x45a8b7){logger[_0x124a('0x1c')]('FreshdeskAccount,\x20%s,\x20%s',_0x11a3fc,_0x124a('0x1d'));logger[_0x124a('0x1e')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x11a3fc,_0x124a('0x1d'),JSON[_0x124a('0x1f')](_0x45a8b7));if(_0x45a8b7[_0x124a('0x20')]){if(_0x45a8b7[_0x124a('0x20')][_0x124a('0x21')]===0x1f4){logger[_0x124a('0x20')](_0x124a('0x22'),_0x11a3fc,_0x45a8b7[_0x124a('0x20')]['message']);return _0x42c100(_0x45a8b7[_0x124a('0x20')][_0x124a('0x23')]);}logger[_0x124a('0x20')]('FreshdeskAccount,\x20%s,\x20%s',_0x11a3fc,_0x45a8b7[_0x124a('0x20')]['message']);return _0x5738b1(_0x45a8b7[_0x124a('0x20')][_0x124a('0x23')]);}else{logger[_0x124a('0x1c')]('FreshdeskAccount,\x20%s,\x20%s',_0x11a3fc,_0x124a('0x1d'));_0x5738b1(_0x45a8b7['result'][_0x124a('0x23')]);}})['catch'](function(_0x389065){logger[_0x124a('0x20')](_0x124a('0x22'),_0x11a3fc,_0x389065);_0x42c100(_0x389065);});});}function respondWithStatusCode(_0x55d31b,_0x4fbc29){_0x4fbc29=_0x4fbc29||0xcc;return function(_0x276e09){if(_0x276e09){return _0x55d31b[_0x124a('0x24')](_0x4fbc29);}return _0x55d31b[_0x124a('0x25')](_0x4fbc29)[_0x124a('0x26')]();};}function respondWithResult(_0x24e51b,_0x4d607a){_0x4d607a=_0x4d607a||0xc8;return function(_0x4a3543){if(_0x4a3543){return _0x24e51b['status'](_0x4d607a)[_0x124a('0x27')](_0x4a3543);}};}function respondWithFilteredResult(_0x4c6727,_0x580c71){return function(_0x4242aa){if(_0x4242aa){var _0xc7c4fd=_0x4242aa[_0x124a('0x28')],_0x25b982=_0x580c71['offset'],_0xa0ef7a=_0x580c71[_0x124a('0x29')]+_0x580c71[_0x124a('0x2a')],_0x568fa6;if(_0xa0ef7a>=_0xc7c4fd){_0xa0ef7a=_0xc7c4fd;_0x568fa6=0xc8;}else{_0x568fa6=0xce;}_0x4c6727['status'](_0x568fa6);return _0x4c6727[_0x124a('0x2b')](_0x124a('0x2c'),_0x25b982+'-'+_0xa0ef7a+'/'+_0xc7c4fd)[_0x124a('0x27')](_0x4242aa);}return null;};}function patchUpdates(_0x42b1a5){return function(_0x148a49){try{jsonpatch[_0x124a('0x2d')](_0x148a49,_0x42b1a5,!![]);}catch(_0x1cd604){return BPromise[_0x124a('0x2e')](_0x1cd604);}return _0x148a49[_0x124a('0x2f')]();};}function saveUpdates(_0x4cfff1,_0x63291d){return function(_0x19a299){if(_0x19a299){return _0x19a299['update'](_0x4cfff1)[_0x124a('0x30')](function(_0x2ba221){return _0x2ba221;});}return null;};}function removeEntity(_0x3108ce,_0x650af5){return function(_0x33882a){if(_0x33882a){return _0x33882a[_0x124a('0x31')]()[_0x124a('0x30')](function(){_0x3108ce[_0x124a('0x25')](0xcc)[_0x124a('0x26')]();});}};}function handleEntityNotFound(_0x4a19db,_0x3598cc){return function(_0x3e4003){if(!_0x3e4003){_0x4a19db[_0x124a('0x24')](0x194);}return _0x3e4003;};}function handleError(_0x2b52e1,_0xb5f4f0){_0xb5f4f0=_0xb5f4f0||0x1f4;return function(_0x32a83b){logger[_0x124a('0x20')](_0x32a83b[_0x124a('0x32')]);if(_0x32a83b[_0x124a('0x33')]){delete _0x32a83b[_0x124a('0x33')];}_0x2b52e1['status'](_0xb5f4f0)[_0x124a('0x34')](_0x32a83b);};}exports[_0x124a('0x35')]=function(_0x456719,_0x2f3681){var _0x389474={},_0x6e8d42={},_0x58233d={'count':0x0,'rows':[]};var _0x3ef1e3=_[_0x124a('0x36')](db['FreshdeskAccount']['rawAttributes'],function(_0x2b4e75){return{'name':_0x2b4e75[_0x124a('0x37')],'type':_0x2b4e75['type']['key']};});_0x6e8d42[_0x124a('0x38')]=_['map'](_0x3ef1e3,'name');_0x6e8d42[_0x124a('0x39')]=_[_0x124a('0x3a')](_0x456719[_0x124a('0x39')]);_0x6e8d42[_0x124a('0x3b')]=_[_0x124a('0x3c')](_0x6e8d42['model'],_0x6e8d42[_0x124a('0x39')]);_0x389474[_0x124a('0x3d')]=_['intersection'](_0x6e8d42[_0x124a('0x38')],qs['fields'](_0x456719['query'][_0x124a('0x3e')]));_0x389474[_0x124a('0x3d')]=_0x389474[_0x124a('0x3d')][_0x124a('0x3f')]?_0x389474[_0x124a('0x3d')]:_0x6e8d42[_0x124a('0x38')];if(!_0x456719['query'][_0x124a('0x40')]('nolimit')){_0x389474['limit']=qs[_0x124a('0x2a')](_0x456719['query'][_0x124a('0x2a')]);_0x389474[_0x124a('0x29')]=qs[_0x124a('0x29')](_0x456719[_0x124a('0x39')][_0x124a('0x29')]);}_0x389474[_0x124a('0x41')]=qs[_0x124a('0x42')](_0x456719[_0x124a('0x39')]['sort']);_0x389474['where']=qs[_0x124a('0x3b')](_['pick'](_0x456719[_0x124a('0x39')],_0x6e8d42[_0x124a('0x3b')]));if(_0x456719[_0x124a('0x39')][_0x124a('0x43')]){_0x389474[_0x124a('0x44')]=_['merge'](_0x389474[_0x124a('0x44')],{'$or':_['map'](_0x3ef1e3,function(_0x35c6ee){if(_0x35c6ee['type']!==_0x124a('0x45')){var _0x1e8d6f={};_0x1e8d6f[_0x35c6ee['name']]={'$like':'%'+_0x456719[_0x124a('0x39')]['filter']+'%'};return _0x1e8d6f;}})});}_0x389474=_['merge']({},_0x389474,_0x456719[_0x124a('0x46')]);var _0x52ede2={'where':_0x389474['where']};return db[_0x124a('0x47')][_0x124a('0x28')](_0x52ede2)[_0x124a('0x30')](function(_0x4299a1){_0x58233d[_0x124a('0x28')]=_0x4299a1;if(_0x456719[_0x124a('0x39')][_0x124a('0x48')]){_0x389474[_0x124a('0x49')]=[{'all':!![]}];}return db[_0x124a('0x47')]['findAll'](_0x389474);})[_0x124a('0x30')](function(_0x594aeb){_0x58233d[_0x124a('0x4a')]=_0x594aeb;return _0x58233d;})[_0x124a('0x30')](respondWithFilteredResult(_0x2f3681,_0x389474))[_0x124a('0x4b')](handleError(_0x2f3681,null));};exports[_0x124a('0x4c')]=function(_0xa17e79,_0x181720){var _0x409d98={'raw':![],'where':{'id':_0xa17e79['params']['id']}},_0x3fff38={};_0x3fff38['model']=_[_0x124a('0x3a')](db[_0x124a('0x47')][_0x124a('0x4d')]);_0x3fff38[_0x124a('0x39')]=_[_0x124a('0x3a')](_0xa17e79[_0x124a('0x39')]);_0x3fff38[_0x124a('0x3b')]=_['intersection'](_0x3fff38['model'],_0x3fff38[_0x124a('0x39')]);_0x409d98[_0x124a('0x3d')]=_[_0x124a('0x3c')](_0x3fff38[_0x124a('0x38')],qs['fields'](_0xa17e79[_0x124a('0x39')]['fields']));_0x409d98[_0x124a('0x3d')]=_0x409d98['attributes'][_0x124a('0x3f')]?_0x409d98['attributes']:_0x3fff38[_0x124a('0x38')];if(_0xa17e79[_0x124a('0x39')][_0x124a('0x48')]){_0x409d98[_0x124a('0x49')]=[{'all':!![]}];}_0x409d98=_[_0x124a('0x4e')]({},_0x409d98,_0xa17e79[_0x124a('0x46')]);return db[_0x124a('0x47')]['find'](_0x409d98)[_0x124a('0x30')](handleEntityNotFound(_0x181720,null))[_0x124a('0x30')](respondWithResult(_0x181720,null))[_0x124a('0x4b')](handleError(_0x181720,null));};exports[_0x124a('0x4f')]=function(_0x516a81,_0x4ee4e6){return db['FreshdeskAccount'][_0x124a('0x4f')](_0x516a81['body'],{})[_0x124a('0x30')](respondWithResult(_0x4ee4e6,0xc9))[_0x124a('0x4b')](handleError(_0x4ee4e6,null));};exports['update']=function(_0x325346,_0x51285d){if(_0x325346[_0x124a('0x50')]['id']){delete _0x325346[_0x124a('0x50')]['id'];}return db['FreshdeskAccount'][_0x124a('0x51')]({'where':{'id':_0x325346[_0x124a('0x52')]['id']}})[_0x124a('0x30')](handleEntityNotFound(_0x51285d,null))[_0x124a('0x30')](saveUpdates(_0x325346[_0x124a('0x50')],null))[_0x124a('0x30')](respondWithResult(_0x51285d,null))[_0x124a('0x4b')](handleError(_0x51285d,null));};exports[_0x124a('0x31')]=function(_0x16e058,_0x13794b){return db['FreshdeskAccount'][_0x124a('0x51')]({'where':{'id':_0x16e058[_0x124a('0x52')]['id']}})[_0x124a('0x30')](handleEntityNotFound(_0x13794b,null))[_0x124a('0x30')](removeEntity(_0x13794b,null))['catch'](handleError(_0x13794b,null));};exports[_0x124a('0x53')]=function(_0x37fb3a,_0x469516,_0x42198e){var _0x127876={};var _0x5374a9={};var _0x228173;var _0x2aea4e;return db[_0x124a('0x47')]['findOne']({'where':{'id':_0x37fb3a['params']['id']}})['then'](handleEntityNotFound(_0x469516,null))[_0x124a('0x30')](function(_0x595994){if(_0x595994){_0x228173=_0x595994;_0x5374a9[_0x124a('0x38')]=_[_0x124a('0x3a')](db['FreshdeskConfiguration']['rawAttributes']);_0x5374a9['query']=_[_0x124a('0x3a')](_0x37fb3a['query']);_0x5374a9[_0x124a('0x3b')]=_[_0x124a('0x3c')](_0x5374a9[_0x124a('0x38')],_0x5374a9[_0x124a('0x39')]);_0x127876[_0x124a('0x3d')]=_[_0x124a('0x3c')](_0x5374a9[_0x124a('0x38')],qs[_0x124a('0x3e')](_0x37fb3a[_0x124a('0x39')]['fields']));_0x127876[_0x124a('0x3d')]=_0x127876[_0x124a('0x3d')][_0x124a('0x3f')]?_0x127876[_0x124a('0x3d')]:_0x5374a9[_0x124a('0x38')];_0x127876['order']=qs[_0x124a('0x42')](_0x37fb3a[_0x124a('0x39')][_0x124a('0x42')]);_0x127876['where']=qs[_0x124a('0x3b')](_['pick'](_0x37fb3a[_0x124a('0x39')],_0x5374a9['filters']));if(_0x37fb3a['query'][_0x124a('0x43')]){_0x127876['where']=_[_0x124a('0x4e')](_0x127876[_0x124a('0x44')],{'$or':_[_0x124a('0x36')](_0x127876[_0x124a('0x3d')],function(_0x58e029){var _0x56177e={};_0x56177e[_0x58e029]={'$like':'%'+_0x37fb3a[_0x124a('0x39')][_0x124a('0x43')]+'%'};return _0x56177e;})});}_0x127876=_[_0x124a('0x4e')]({},_0x127876,_0x37fb3a[_0x124a('0x46')]);return _0x228173[_0x124a('0x53')](_0x127876);}})[_0x124a('0x30')](function(_0x33b9d2){if(_0x33b9d2){_0x2aea4e=_0x33b9d2[_0x124a('0x3f')];if(!_0x37fb3a[_0x124a('0x39')][_0x124a('0x40')](_0x124a('0x54'))){_0x127876['limit']=qs[_0x124a('0x2a')](_0x37fb3a['query'][_0x124a('0x2a')]);_0x127876['offset']=qs[_0x124a('0x29')](_0x37fb3a[_0x124a('0x39')][_0x124a('0x29')]);}return _0x228173[_0x124a('0x53')](_0x127876);}})['then'](function(_0x260a3c){if(_0x260a3c){return _0x260a3c?{'count':_0x2aea4e,'rows':_0x260a3c}:null;}})['then'](respondWithResult(_0x469516,null))[_0x124a('0x4b')](handleError(_0x469516,null));};exports[_0x124a('0x55')]=function(_0x6b5271,_0x4e6a94,_0x530d06){if(_0x6b5271[_0x124a('0x50')]['id']){delete _0x6b5271[_0x124a('0x50')]['id'];}return db[_0x124a('0x47')][_0x124a('0x56')]({'where':{'id':_0x6b5271[_0x124a('0x52')]['id']}})[_0x124a('0x30')](handleEntityNotFound(_0x4e6a94,null))[_0x124a('0x30')](function(_0x316f1e){if(_0x316f1e){_0x6b5271[_0x124a('0x50')][_0x124a('0x57')]=_0x316f1e['id'];_0x6b5271[_0x124a('0x50')][_0x124a('0x58')]=integrations[_0x124a('0x59')](_0x6b5271[_0x124a('0x50')]['channel'],_0x6b5271[_0x124a('0x50')][_0x124a('0x5a')]);_0x6b5271[_0x124a('0x50')]['Descriptions']=integrations['getDescriptions'](_0x6b5271[_0x124a('0x50')][_0x124a('0x5b')],_0x6b5271[_0x124a('0x50')][_0x124a('0x5a')]);return db['FreshdeskConfiguration'][_0x124a('0x4f')](_0x6b5271[_0x124a('0x50')],{'include':[{'model':db[_0x124a('0x5c')],'as':_0x124a('0x58')},{'model':db['FreshdeskField'],'as':_0x124a('0x5d')}]});}return null;})[_0x124a('0x30')](respondWithResult(_0x4e6a94,null))[_0x124a('0x4b')](handleError(_0x4e6a94,null));};exports[_0x124a('0x5e')]=function(_0x11c018,_0x43dc60,_0x30607b){var _0x26b03e='';return db['FreshdeskAccount'][_0x124a('0x56')]({'where':{'id':_0x11c018[_0x124a('0x52')]['id']},'attributes':['id','remoteUri',_0x124a('0x5f')]})[_0x124a('0x30')](handleEntityNotFound(_0x43dc60,null))['then'](function(_0x5884e5){if(_0x5884e5){_0x26b03e=_0x5884e5[_0x124a('0x60')];var _0x21d978=_0x26b03e['slice'](-0x1);if(_0x21d978==='/'){_0x26b03e=_0x26b03e['substring'](0x0,_0x26b03e[_0x124a('0x61')](_0x21d978));}return rp({'method':_0x124a('0x62'),'uri':util[_0x124a('0x63')]('%s/%s',_0x26b03e,_0x124a('0x64')),'headers':{'Authorization':util['format'](_0x124a('0x65'),new Buffer(util['format'](_0x124a('0x66'),_0x5884e5[_0x124a('0x5f')]))[_0x124a('0x67')](_0x124a('0x68')))},'json':!![]});}})[_0x124a('0x30')](function(_0x5ef3e8){if(_0x5ef3e8){var _0x5f04b9=[_0x124a('0x69'),_0x124a('0x6a'),_0x124a('0x6b'),'description','status','priority','group','source','ticket_type',_0x124a('0x6c'),_0x124a('0x6d')];_[_0x124a('0x6e')](_0x5ef3e8,function(_0x48d739){return _0x5f04b9[_0x124a('0x6f')](_0x48d739['name'])||!_0x48d739[_0x124a('0x70')]&&_0x48d739['type']!==_0x124a('0x71')&&_0x48d739['type']!==_0x124a('0x72');});return{'count':_0x5ef3e8['length'],'rows':_[_0x124a('0x36')](_0x5ef3e8,function(_0x4f7988){return{'id':_0x4f7988[_0x124a('0x33')],'name':_0x4f7988['label'],'custom':!_0x4f7988[_0x124a('0x70')],'options':_0x4f7988[_0x124a('0x73')]?_['map'](_0x4f7988[_0x124a('0x73')],function(_0x5ea63c){return{'name':_[_0x124a('0x74')](_0x5ea63c),'value':_0x5ea63c};}):[]};})};}})['then'](respondWithResult(_0x43dc60,null))[_0x124a('0x4b')](function(_0x166d0a){var _0x263ccc=_0x11c018[_0x124a('0x39')]['test']?0x1f4:_0x166d0a['statusCode']||0x1f4;logger[_0x124a('0x20')](_0x124a('0x75'),_0x124a('0x5e'),_0x263ccc,JSON[_0x124a('0x1f')](_0x166d0a));delete _0x166d0a[_0x124a('0x33')];if(_0x263ccc===0x191){_0x263ccc=0x190;}_0x43dc60[_0x124a('0x25')](_0x263ccc)[_0x124a('0x34')](_0x11c018[_0x124a('0x39')]['test']?{'message':_0x124a('0x76'),'statusCode':_0x166d0a[_0x124a('0x77')]}:_0x166d0a);});}; \ No newline at end of file +var _0xa670=['request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','then','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','merge','where','VIRTUAL','options','count','includeAll','include','FreshdeskAccount','rows','show','params','length','find','create','update','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','rawAttributes','filter','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','toString','base64','requester','subject','agent','description','priority','group','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','FreshdeskAccount,\x20%s,\x20%s'];(function(_0x54d6b5,_0x249e99){var _0x54f81b=function(_0x19f4e8){while(--_0x19f4e8){_0x54d6b5['push'](_0x54d6b5['shift']());}};_0x54f81b(++_0x249e99);}(_0xa670,0x154));var _0x0a67=function(_0xac8a8c,_0x3d4031){_0xac8a8c=_0xac8a8c-0x0;var _0x573d83=_0xa670[_0xac8a8c];return _0x573d83;};'use strict';var pdf=require(_0x0a67('0x0'));var emlformat=require(_0x0a67('0x1'));var rimraf=require(_0x0a67('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0a67('0x3'));var rp=require(_0x0a67('0x4'));var moment=require(_0x0a67('0x5'));var BPromise=require(_0x0a67('0x6'));var Mustache=require(_0x0a67('0x7'));var util=require(_0x0a67('0x8'));var path=require(_0x0a67('0x9'));var sox=require('sox');var csv=require(_0x0a67('0xa'));var ejs=require(_0x0a67('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0a67('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0a67('0xd'));var Papa=require(_0x0a67('0xe'));var Redis=require(_0x0a67('0xf'));var authService=require(_0x0a67('0x10'));var qs=require(_0x0a67('0x11'));var as=require(_0x0a67('0x12'));var hardwareService=require(_0x0a67('0x13'));var logger=require(_0x0a67('0x14'))(_0x0a67('0x15'));var utils=require(_0x0a67('0x16'));var config=require(_0x0a67('0x17'));var db=require(_0x0a67('0x18'))['db'];var integrations=require(_0x0a67('0x19'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0a67('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x131ae3,_0x16af98,_0x3af50c){if(_0x3af50c){var _0xe927e3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xe927e3[_0x0a67('0x1b')](_0x16af98)){return _0x131ae3;}else{throw new db['Sequelize'][(_0x0a67('0x1c'))](_0x0a67('0x1d'));}}else{return _0x131ae3;}}function respondWithRpcPromise(_0x140ba3,_0x2792d4,_0x3f8493,_0x5dfc7e){return new BPromise(function(_0xa113f3,_0xfcefd4){var _0x230b37=_0x5dfc7e||client;return _0x230b37['request'](_0x140ba3,_0x3f8493)['then'](function(_0x152bd3){logger[_0x0a67('0x1e')](_0x0a67('0x1f'),_0x2792d4,_0x0a67('0x20'));logger[_0x0a67('0x21')](_0x0a67('0x22'),_0x2792d4,_0x0a67('0x20'),JSON['stringify'](_0x152bd3));if(_0x152bd3[_0x0a67('0x23')]){if(_0x152bd3[_0x0a67('0x23')]['code']===0x1f4){logger[_0x0a67('0x23')](_0x0a67('0x1f'),_0x2792d4,_0x152bd3[_0x0a67('0x23')]['message']);return _0xfcefd4(_0x152bd3[_0x0a67('0x23')][_0x0a67('0x24')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x2792d4,_0x152bd3[_0x0a67('0x23')][_0x0a67('0x24')]);return _0xa113f3(_0x152bd3['error'][_0x0a67('0x24')]);}else{logger[_0x0a67('0x1e')]('FreshdeskAccount,\x20%s,\x20%s',_0x2792d4,_0x0a67('0x20'));_0xa113f3(_0x152bd3[_0x0a67('0x25')][_0x0a67('0x24')]);}})[_0x0a67('0x26')](function(_0x313b8b){logger[_0x0a67('0x23')](_0x0a67('0x1f'),_0x2792d4,_0x313b8b);_0xfcefd4(_0x313b8b);});});}function respondWithStatusCode(_0x2f41ed,_0x2e6989){_0x2e6989=_0x2e6989||0xcc;return function(_0x467de6){if(_0x467de6){return _0x2f41ed[_0x0a67('0x27')](_0x2e6989);}return _0x2f41ed[_0x0a67('0x28')](_0x2e6989)[_0x0a67('0x29')]();};}function respondWithResult(_0x19e80d,_0x31533b){_0x31533b=_0x31533b||0xc8;return function(_0x59388f){if(_0x59388f){return _0x19e80d[_0x0a67('0x28')](_0x31533b)[_0x0a67('0x2a')](_0x59388f);}};}function respondWithFilteredResult(_0x3b4587,_0x5a24e0){return function(_0x31c77e){if(_0x31c77e){var _0xd38170=_0x31c77e['count'],_0x2385c1=_0x5a24e0[_0x0a67('0x2b')],_0x4f3ac6=_0x5a24e0[_0x0a67('0x2b')]+_0x5a24e0[_0x0a67('0x2c')],_0x47d676;if(_0x4f3ac6>=_0xd38170){_0x4f3ac6=_0xd38170;_0x47d676=0xc8;}else{_0x47d676=0xce;}_0x3b4587[_0x0a67('0x28')](_0x47d676);return _0x3b4587[_0x0a67('0x2d')](_0x0a67('0x2e'),_0x2385c1+'-'+_0x4f3ac6+'/'+_0xd38170)['json'](_0x31c77e);}return null;};}function patchUpdates(_0x12bfe5){return function(_0x480a5e){try{jsonpatch[_0x0a67('0x2f')](_0x480a5e,_0x12bfe5,!![]);}catch(_0x4a820f){return BPromise[_0x0a67('0x30')](_0x4a820f);}return _0x480a5e['save']();};}function saveUpdates(_0x1dc2c7,_0x4d7b9d){return function(_0x27d854){if(_0x27d854){return _0x27d854['update'](_0x1dc2c7)[_0x0a67('0x31')](function(_0x5644fc){return _0x5644fc;});}return null;};}function removeEntity(_0x497cdd,_0x5337d7){return function(_0x593b78){if(_0x593b78){return _0x593b78['destroy']()['then'](function(){_0x497cdd[_0x0a67('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40cd5a,_0xcda708){return function(_0x853bed){if(!_0x853bed){_0x40cd5a[_0x0a67('0x27')](0x194);}return _0x853bed;};}function handleError(_0x17a4ad,_0x5a629b){_0x5a629b=_0x5a629b||0x1f4;return function(_0x30dcf3){logger['error'](_0x30dcf3[_0x0a67('0x32')]);if(_0x30dcf3[_0x0a67('0x33')]){delete _0x30dcf3['name'];}_0x17a4ad[_0x0a67('0x28')](_0x5a629b)[_0x0a67('0x34')](_0x30dcf3);};}exports[_0x0a67('0x35')]=function(_0x280718,_0x51ea77){var _0x1a70e2={},_0x59bf87={},_0x3995a0={'count':0x0,'rows':[]};var _0x2d44c8=_[_0x0a67('0x36')](db['FreshdeskAccount']['rawAttributes'],function(_0x5301ac){return{'name':_0x5301ac[_0x0a67('0x37')],'type':_0x5301ac[_0x0a67('0x38')]['key']};});_0x59bf87[_0x0a67('0x39')]=_[_0x0a67('0x36')](_0x2d44c8,_0x0a67('0x33'));_0x59bf87[_0x0a67('0x3a')]=_[_0x0a67('0x3b')](_0x280718[_0x0a67('0x3a')]);_0x59bf87[_0x0a67('0x3c')]=_[_0x0a67('0x3d')](_0x59bf87[_0x0a67('0x39')],_0x59bf87[_0x0a67('0x3a')]);_0x1a70e2[_0x0a67('0x3e')]=_[_0x0a67('0x3d')](_0x59bf87[_0x0a67('0x39')],qs['fields'](_0x280718['query'][_0x0a67('0x3f')]));_0x1a70e2['attributes']=_0x1a70e2[_0x0a67('0x3e')]['length']?_0x1a70e2['attributes']:_0x59bf87[_0x0a67('0x39')];if(!_0x280718['query'][_0x0a67('0x40')]('nolimit')){_0x1a70e2[_0x0a67('0x2c')]=qs[_0x0a67('0x2c')](_0x280718[_0x0a67('0x3a')]['limit']);_0x1a70e2['offset']=qs[_0x0a67('0x2b')](_0x280718[_0x0a67('0x3a')][_0x0a67('0x2b')]);}_0x1a70e2[_0x0a67('0x41')]=qs['sort'](_0x280718[_0x0a67('0x3a')][_0x0a67('0x42')]);_0x1a70e2['where']=qs['filters'](_['pick'](_0x280718[_0x0a67('0x3a')],_0x59bf87[_0x0a67('0x3c')]));if(_0x280718[_0x0a67('0x3a')]['filter']){_0x1a70e2['where']=_[_0x0a67('0x43')](_0x1a70e2[_0x0a67('0x44')],{'$or':_[_0x0a67('0x36')](_0x2d44c8,function(_0x4c9466){if(_0x4c9466[_0x0a67('0x38')]!==_0x0a67('0x45')){var _0x488516={};_0x488516[_0x4c9466[_0x0a67('0x33')]]={'$like':'%'+_0x280718[_0x0a67('0x3a')]['filter']+'%'};return _0x488516;}})});}_0x1a70e2=_['merge']({},_0x1a70e2,_0x280718[_0x0a67('0x46')]);var _0x191e86={'where':_0x1a70e2['where']};return db['FreshdeskAccount'][_0x0a67('0x47')](_0x191e86)['then'](function(_0x373dfb){_0x3995a0[_0x0a67('0x47')]=_0x373dfb;if(_0x280718[_0x0a67('0x3a')][_0x0a67('0x48')]){_0x1a70e2[_0x0a67('0x49')]=[{'all':!![]}];}return db[_0x0a67('0x4a')]['findAll'](_0x1a70e2);})[_0x0a67('0x31')](function(_0x392dfe){_0x3995a0[_0x0a67('0x4b')]=_0x392dfe;return _0x3995a0;})[_0x0a67('0x31')](respondWithFilteredResult(_0x51ea77,_0x1a70e2))[_0x0a67('0x26')](handleError(_0x51ea77,null));};exports[_0x0a67('0x4c')]=function(_0x171d8f,_0x3c975e){var _0x4aa977={'raw':![],'where':{'id':_0x171d8f[_0x0a67('0x4d')]['id']}},_0x5cb2da={};_0x5cb2da['model']=_[_0x0a67('0x3b')](db[_0x0a67('0x4a')]['rawAttributes']);_0x5cb2da[_0x0a67('0x3a')]=_[_0x0a67('0x3b')](_0x171d8f['query']);_0x5cb2da['filters']=_[_0x0a67('0x3d')](_0x5cb2da[_0x0a67('0x39')],_0x5cb2da[_0x0a67('0x3a')]);_0x4aa977[_0x0a67('0x3e')]=_['intersection'](_0x5cb2da[_0x0a67('0x39')],qs[_0x0a67('0x3f')](_0x171d8f['query']['fields']));_0x4aa977[_0x0a67('0x3e')]=_0x4aa977[_0x0a67('0x3e')][_0x0a67('0x4e')]?_0x4aa977[_0x0a67('0x3e')]:_0x5cb2da['model'];if(_0x171d8f[_0x0a67('0x3a')]['includeAll']){_0x4aa977[_0x0a67('0x49')]=[{'all':!![]}];}_0x4aa977=_[_0x0a67('0x43')]({},_0x4aa977,_0x171d8f[_0x0a67('0x46')]);return db['FreshdeskAccount'][_0x0a67('0x4f')](_0x4aa977)[_0x0a67('0x31')](handleEntityNotFound(_0x3c975e,null))[_0x0a67('0x31')](respondWithResult(_0x3c975e,null))[_0x0a67('0x26')](handleError(_0x3c975e,null));};exports[_0x0a67('0x50')]=function(_0x4f0d14,_0x4118ef){return db[_0x0a67('0x4a')][_0x0a67('0x50')](_0x4f0d14['body'],{})['then'](respondWithResult(_0x4118ef,0xc9))[_0x0a67('0x26')](handleError(_0x4118ef,null));};exports[_0x0a67('0x51')]=function(_0x29f0f5,_0x402b4c){if(_0x29f0f5[_0x0a67('0x52')]['id']){delete _0x29f0f5[_0x0a67('0x52')]['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0x29f0f5[_0x0a67('0x4d')]['id']}})[_0x0a67('0x31')](handleEntityNotFound(_0x402b4c,null))[_0x0a67('0x31')](saveUpdates(_0x29f0f5[_0x0a67('0x52')],null))[_0x0a67('0x31')](respondWithResult(_0x402b4c,null))[_0x0a67('0x26')](handleError(_0x402b4c,null));};exports[_0x0a67('0x53')]=function(_0xeb1d88,_0x49a895){return db['FreshdeskAccount'][_0x0a67('0x4f')]({'where':{'id':_0xeb1d88[_0x0a67('0x4d')]['id']}})['then'](handleEntityNotFound(_0x49a895,null))[_0x0a67('0x31')](removeEntity(_0x49a895,null))[_0x0a67('0x26')](handleError(_0x49a895,null));};exports[_0x0a67('0x54')]=function(_0x4f60b5,_0x2a8840,_0x30e640){var _0x5e2d24={};var _0x135550={};var _0x2032df;var _0x1eeed3;return db[_0x0a67('0x4a')][_0x0a67('0x55')]({'where':{'id':_0x4f60b5[_0x0a67('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2a8840,null))[_0x0a67('0x31')](function(_0x5d5774){if(_0x5d5774){_0x2032df=_0x5d5774;_0x135550[_0x0a67('0x39')]=_[_0x0a67('0x3b')](db[_0x0a67('0x56')][_0x0a67('0x57')]);_0x135550['query']=_[_0x0a67('0x3b')](_0x4f60b5[_0x0a67('0x3a')]);_0x135550[_0x0a67('0x3c')]=_[_0x0a67('0x3d')](_0x135550[_0x0a67('0x39')],_0x135550[_0x0a67('0x3a')]);_0x5e2d24[_0x0a67('0x3e')]=_[_0x0a67('0x3d')](_0x135550[_0x0a67('0x39')],qs[_0x0a67('0x3f')](_0x4f60b5['query'][_0x0a67('0x3f')]));_0x5e2d24[_0x0a67('0x3e')]=_0x5e2d24['attributes']['length']?_0x5e2d24[_0x0a67('0x3e')]:_0x135550[_0x0a67('0x39')];_0x5e2d24[_0x0a67('0x41')]=qs[_0x0a67('0x42')](_0x4f60b5[_0x0a67('0x3a')][_0x0a67('0x42')]);_0x5e2d24[_0x0a67('0x44')]=qs[_0x0a67('0x3c')](_['pick'](_0x4f60b5[_0x0a67('0x3a')],_0x135550[_0x0a67('0x3c')]));if(_0x4f60b5[_0x0a67('0x3a')][_0x0a67('0x58')]){_0x5e2d24[_0x0a67('0x44')]=_[_0x0a67('0x43')](_0x5e2d24[_0x0a67('0x44')],{'$or':_[_0x0a67('0x36')](_0x5e2d24['attributes'],function(_0x35ebd2){var _0x151d85={};_0x151d85[_0x35ebd2]={'$like':'%'+_0x4f60b5[_0x0a67('0x3a')][_0x0a67('0x58')]+'%'};return _0x151d85;})});}_0x5e2d24=_[_0x0a67('0x43')]({},_0x5e2d24,_0x4f60b5[_0x0a67('0x46')]);return _0x2032df[_0x0a67('0x54')](_0x5e2d24);}})[_0x0a67('0x31')](function(_0xadaeb0){if(_0xadaeb0){_0x1eeed3=_0xadaeb0['length'];if(!_0x4f60b5[_0x0a67('0x3a')][_0x0a67('0x40')](_0x0a67('0x59'))){_0x5e2d24[_0x0a67('0x2c')]=qs[_0x0a67('0x2c')](_0x4f60b5[_0x0a67('0x3a')][_0x0a67('0x2c')]);_0x5e2d24[_0x0a67('0x2b')]=qs['offset'](_0x4f60b5[_0x0a67('0x3a')][_0x0a67('0x2b')]);}return _0x2032df[_0x0a67('0x54')](_0x5e2d24);}})[_0x0a67('0x31')](function(_0x1ad2ee){if(_0x1ad2ee){return _0x1ad2ee?{'count':_0x1eeed3,'rows':_0x1ad2ee}:null;}})['then'](respondWithResult(_0x2a8840,null))[_0x0a67('0x26')](handleError(_0x2a8840,null));};exports[_0x0a67('0x5a')]=function(_0x3ed287,_0x31b061,_0x3263fb){if(_0x3ed287[_0x0a67('0x52')]['id']){delete _0x3ed287[_0x0a67('0x52')]['id'];}return db['FreshdeskAccount'][_0x0a67('0x55')]({'where':{'id':_0x3ed287[_0x0a67('0x4d')]['id']}})[_0x0a67('0x31')](handleEntityNotFound(_0x31b061,null))[_0x0a67('0x31')](function(_0x5e5ece){if(_0x5e5ece){_0x3ed287[_0x0a67('0x52')]['AccountId']=_0x5e5ece['id'];_0x3ed287['body'][_0x0a67('0x5b')]=integrations[_0x0a67('0x5c')](_0x3ed287['body'][_0x0a67('0x5d')],_0x3ed287[_0x0a67('0x52')][_0x0a67('0x38')]);_0x3ed287[_0x0a67('0x52')][_0x0a67('0x5e')]=integrations[_0x0a67('0x5f')](_0x3ed287[_0x0a67('0x52')]['channel'],_0x3ed287['body'][_0x0a67('0x38')]);return db[_0x0a67('0x56')][_0x0a67('0x50')](_0x3ed287[_0x0a67('0x52')],{'include':[{'model':db['FreshdeskField'],'as':'Subjects'},{'model':db[_0x0a67('0x60')],'as':_0x0a67('0x5e')}]});}return null;})[_0x0a67('0x31')](respondWithResult(_0x31b061,null))[_0x0a67('0x26')](handleError(_0x31b061,null));};exports[_0x0a67('0x61')]=function(_0x3891a5,_0xfdf0e7,_0x57e7a5){var _0x110e8f='';return db[_0x0a67('0x4a')][_0x0a67('0x55')]({'where':{'id':_0x3891a5[_0x0a67('0x4d')]['id']},'attributes':['id','remoteUri','apiKey']})[_0x0a67('0x31')](handleEntityNotFound(_0xfdf0e7,null))[_0x0a67('0x31')](function(_0x4130c4){if(_0x4130c4){_0x110e8f=_0x4130c4['remoteUri'];var _0x4ee120=_0x110e8f['slice'](-0x1);if(_0x4ee120==='/'){_0x110e8f=_0x110e8f['substring'](0x0,_0x110e8f[_0x0a67('0x62')](_0x4ee120));}return rp({'method':_0x0a67('0x63'),'uri':util[_0x0a67('0x64')](_0x0a67('0x65'),_0x110e8f,_0x0a67('0x66')),'headers':{'Authorization':util[_0x0a67('0x64')]('Basic\x20%s',new Buffer(util[_0x0a67('0x64')]('%s:X',_0x4130c4['apiKey']))[_0x0a67('0x67')](_0x0a67('0x68')))},'json':!![]});}})[_0x0a67('0x31')](function(_0x228d31){if(_0x228d31){var _0xecd9c5=[_0x0a67('0x69'),_0x0a67('0x6a'),_0x0a67('0x6b'),_0x0a67('0x6c'),_0x0a67('0x28'),_0x0a67('0x6d'),_0x0a67('0x6e'),'source',_0x0a67('0x6f'),_0x0a67('0x6e'),_0x0a67('0x70')];_[_0x0a67('0x71')](_0x228d31,function(_0x4a1f10){return _0xecd9c5[_0x0a67('0x72')](_0x4a1f10[_0x0a67('0x33')])||!_0x4a1f10[_0x0a67('0x73')]&&_0x4a1f10[_0x0a67('0x38')]!==_0x0a67('0x74')&&_0x4a1f10['type']!==_0x0a67('0x75');});return{'count':_0x228d31[_0x0a67('0x4e')],'rows':_[_0x0a67('0x36')](_0x228d31,function(_0x33c1c6){return{'id':_0x33c1c6[_0x0a67('0x33')],'name':_0x33c1c6[_0x0a67('0x76')],'custom':!_0x33c1c6[_0x0a67('0x73')],'options':_0x33c1c6[_0x0a67('0x77')]?_[_0x0a67('0x36')](_0x33c1c6[_0x0a67('0x77')],function(_0x522cd7){return{'name':_[_0x0a67('0x78')](_0x522cd7),'value':_0x522cd7};}):[]};})};}})[_0x0a67('0x31')](respondWithResult(_0xfdf0e7,null))['catch'](function(_0x3a2e77){var _0x535c46=_0x3891a5['query'][_0x0a67('0x1b')]?0x1f4:_0x3a2e77[_0x0a67('0x79')]||0x1f4;logger[_0x0a67('0x23')](_0x0a67('0x7a'),_0x0a67('0x61'),_0x535c46,JSON[_0x0a67('0x7b')](_0x3a2e77));delete _0x3a2e77[_0x0a67('0x33')];if(_0x535c46===0x191){_0x535c46=0x190;}_0xfdf0e7[_0x0a67('0x28')](_0x535c46)[_0x0a67('0x34')](_0x3891a5[_0x0a67('0x3a')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x3a2e77['statusCode']}:_0x3a2e77);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index c8bf3c7..e587fa5 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 _0xebf3=['int_freshdesk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount'];(function(_0x5557c5,_0x455b4b){var _0x420fd9=function(_0x13a9c5){while(--_0x13a9c5){_0x5557c5['push'](_0x5557c5['shift']());}};_0x420fd9(++_0x455b4b);}(_0xebf3,0xeb));var _0x3ebf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xebf3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3ebf('0x0'));var util=require(_0x3ebf('0x1'));var logger=require(_0x3ebf('0x2'))('api');var moment=require(_0x3ebf('0x3'));var BPromise=require(_0x3ebf('0x4'));var rp=require(_0x3ebf('0x5'));var fs=require('fs');var path=require(_0x3ebf('0x6'));var rimraf=require('rimraf');var config=require(_0x3ebf('0x7'));var attributes=require(_0x3ebf('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x3ebf('0x9')]=function(_0x15dafc,_0xa2de39){return _0x15dafc[_0x3ebf('0xa')](_0x3ebf('0xb'),attributes,{'tableName':_0x3ebf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c21=['request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','lodash','util','../../config/logger','api','moment'];(function(_0x29bccc,_0x21e064){var _0x3cd0d9=function(_0x3934bc){while(--_0x3934bc){_0x29bccc['push'](_0x29bccc['shift']());}};_0x3cd0d9(++_0x21e064);}(_0x5c21,0x119));var _0x15c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c21[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x15c2('0x0'));var util=require(_0x15c2('0x1'));var logger=require(_0x15c2('0x2'))(_0x15c2('0x3'));var moment=require(_0x15c2('0x4'));var BPromise=require('bluebird');var rp=require(_0x15c2('0x5'));var fs=require('fs');var path=require(_0x15c2('0x6'));var rimraf=require(_0x15c2('0x7'));var config=require(_0x15c2('0x8'));var attributes=require(_0x15c2('0x9'));var integrations=require(_0x15c2('0xa'));module[_0x15c2('0xb')]=function(_0x25dd42,_0x1cc161){return _0x25dd42[_0x15c2('0xc')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index a79faf2..97ef4a1 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 _0x1488=['../../config/utils','../../config/logger','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FreshdeskAccount','options','limit','include','map','model','attributes','debug','GetFreshdeskAccount','ShowFreshdeskAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x51991f,_0x3e2f25){var _0x40c6f0=function(_0x2b981e){while(--_0x2b981e){_0x51991f['push'](_0x51991f['shift']());}};_0x40c6f0(++_0x3e2f25);}(_0x1488,0x192));var _0x8148=function(_0x2675da,_0x5a250e){_0x2675da=_0x2675da-0x0;var _0x5e6153=_0x1488[_0x2675da];return _0x5e6153;};'use strict';var _=require(_0x8148('0x0'));var util=require(_0x8148('0x1'));var moment=require(_0x8148('0x2'));var BPromise=require(_0x8148('0x3'));var rs=require(_0x8148('0x4'));var fs=require('fs');var Redis=require(_0x8148('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8148('0x6'));var logger=require(_0x8148('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8148('0x8'));var client=jayson[_0x8148('0x9')][_0x8148('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c8c32,_0xc98397,_0x5a80b2){return new BPromise(function(_0x2c6024,_0x41760c){return client['request'](_0x2c8c32,_0x5a80b2)[_0x8148('0xb')](function(_0x5b6a1e){logger[_0x8148('0xc')](_0x8148('0xd'),_0xc98397,_0x8148('0xe'));logger['debug'](_0x8148('0xf'),_0xc98397,_0x8148('0xe'),JSON[_0x8148('0x10')](_0x5b6a1e));if(_0x5b6a1e[_0x8148('0x11')]){if(_0x5b6a1e['error'][_0x8148('0x12')]===0x1f4){logger[_0x8148('0x11')](_0x8148('0xd'),_0xc98397,_0x5b6a1e['error'][_0x8148('0x13')]);return _0x41760c(_0x5b6a1e[_0x8148('0x11')][_0x8148('0x13')]);}logger['error'](_0x8148('0xd'),_0xc98397,_0x5b6a1e[_0x8148('0x11')][_0x8148('0x13')]);return _0x2c6024(_0x5b6a1e['error']['message']);}else{logger[_0x8148('0xc')](_0x8148('0xd'),_0xc98397,_0x8148('0xe'));_0x2c6024(_0x5b6a1e[_0x8148('0x14')][_0x8148('0x13')]);}})[_0x8148('0x15')](function(_0x4056eb){logger['error'](_0x8148('0xd'),_0xc98397,_0x4056eb);_0x41760c(_0x4056eb);});});}exports['GetFreshdeskAccount']=function(_0x4ce3cd){var _0x2ab669=this;return new Promise(function(_0x5465b1,_0x5141b1){return db[_0x8148('0x16')]['findAll']({'raw':_0x4ce3cd[_0x8148('0x17')]?_0x4ce3cd['options']['raw']===undefined?!![]:![]:!![],'where':_0x4ce3cd[_0x8148('0x17')]?_0x4ce3cd[_0x8148('0x17')]['where']||null:null,'attributes':_0x4ce3cd['options']?_0x4ce3cd[_0x8148('0x17')]['attributes']||null:null,'limit':_0x4ce3cd[_0x8148('0x17')]?_0x4ce3cd[_0x8148('0x17')][_0x8148('0x18')]||null:null,'include':_0x4ce3cd[_0x8148('0x17')]?_0x4ce3cd[_0x8148('0x17')][_0x8148('0x19')]?_[_0x8148('0x1a')](_0x4ce3cd[_0x8148('0x17')][_0x8148('0x19')],function(_0x3af69f){return{'model':db[_0x3af69f[_0x8148('0x1b')]],'as':_0x3af69f['as'],'attributes':_0x3af69f['attributes'],'include':_0x3af69f[_0x8148('0x19')]?_[_0x8148('0x1a')](_0x3af69f[_0x8148('0x19')],function(_0x264d7a){return{'model':db[_0x264d7a[_0x8148('0x1b')]],'as':_0x264d7a['as'],'attributes':_0x264d7a[_0x8148('0x1c')],'include':_0x264d7a[_0x8148('0x19')]?_[_0x8148('0x1a')](_0x264d7a['include'],function(_0x53eaa9){return{'model':db[_0x53eaa9['model']],'as':_0x53eaa9['as'],'attributes':_0x53eaa9[_0x8148('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8148('0xb')](function(_0x2699e5){logger['info']('GetFreshdeskAccount',_0x4ce3cd);logger[_0x8148('0x1d')](_0x8148('0x1e'),_0x4ce3cd,JSON[_0x8148('0x10')](_0x2699e5));_0x5465b1(_0x2699e5);})['catch'](function(_0x2ec7a0){logger[_0x8148('0x11')](_0x8148('0x1e'),_0x2ec7a0['message'],_0x4ce3cd);_0x5141b1(_0x2ab669[_0x8148('0x11')](0x1f4,_0x2ec7a0[_0x8148('0x13')]));});});};exports[_0x8148('0x1f')]=function(_0x7096a0){var _0x46b1fe=this;return new Promise(function(_0x1a90bd,_0x3cbc7d){return db[_0x8148('0x16')][_0x8148('0x20')]({'raw':_0x7096a0[_0x8148('0x17')]?_0x7096a0['options']['raw']===undefined?!![]:![]:!![],'where':_0x7096a0[_0x8148('0x17')]?_0x7096a0[_0x8148('0x17')][_0x8148('0x21')]||null:null,'attributes':_0x7096a0['options']?_0x7096a0['options'][_0x8148('0x1c')]||null:null,'include':_0x7096a0[_0x8148('0x17')]?_0x7096a0['options'][_0x8148('0x19')]?_[_0x8148('0x1a')](_0x7096a0[_0x8148('0x17')]['include'],function(_0x162e59){return{'model':db[_0x162e59[_0x8148('0x1b')]],'as':_0x162e59['as'],'attributes':_0x162e59['attributes'],'include':_0x162e59[_0x8148('0x19')]?_[_0x8148('0x1a')](_0x162e59['include'],function(_0x136d90){return{'model':db[_0x136d90[_0x8148('0x1b')]],'as':_0x136d90['as'],'attributes':_0x136d90[_0x8148('0x1c')],'include':_0x136d90[_0x8148('0x19')]?_[_0x8148('0x1a')](_0x136d90[_0x8148('0x19')],function(_0x4d88cf){return{'model':db[_0x4d88cf['model']],'as':_0x4d88cf['as'],'attributes':_0x4d88cf[_0x8148('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8148('0xb')](function(_0x39c8e3){logger[_0x8148('0xc')](_0x8148('0x1f'),_0x7096a0);logger[_0x8148('0x1d')](_0x8148('0x1f'),_0x7096a0,JSON[_0x8148('0x10')](_0x39c8e3));_0x1a90bd(_0x39c8e3);})['catch'](function(_0x56d6de){logger['error']('ShowFreshdeskAccount',_0x56d6de[_0x8148('0x13')],_0x7096a0);_0x3cbc7d(_0x46b1fe[_0x8148('0x11')](0x1f4,_0x56d6de[_0x8148('0x13')]));});});}; \ No newline at end of file +var _0x31c0=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','limit','include','model','map','catch','ShowFreshdeskAccount','find'];(function(_0x27ff3f,_0x4c47b3){var _0x2527be=function(_0x37981f){while(--_0x37981f){_0x27ff3f['push'](_0x27ff3f['shift']());}};_0x2527be(++_0x4c47b3);}(_0x31c0,0x6f));var _0x031c=function(_0x42b73e,_0x531e20){_0x42b73e=_0x42b73e-0x0;var _0x45c9ff=_0x31c0[_0x42b73e];return _0x45c9ff;};'use strict';var _=require(_0x031c('0x0'));var util=require(_0x031c('0x1'));var moment=require(_0x031c('0x2'));var BPromise=require(_0x031c('0x3'));var rs=require(_0x031c('0x4'));var fs=require('fs');var Redis=require(_0x031c('0x5'));var db=require(_0x031c('0x6'))['db'];var utils=require(_0x031c('0x7'));var logger=require(_0x031c('0x8'))(_0x031c('0x9'));var config=require(_0x031c('0xa'));var jayson=require(_0x031c('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4fb0a6,_0xa76669,_0x3d3f67){return new BPromise(function(_0x35420b,_0x526917){return client[_0x031c('0xc')](_0x4fb0a6,_0x3d3f67)[_0x031c('0xd')](function(_0x3ba8ae){logger['info'](_0x031c('0xe'),_0xa76669,_0x031c('0xf'));logger[_0x031c('0x10')](_0x031c('0x11'),_0xa76669,_0x031c('0xf'),JSON[_0x031c('0x12')](_0x3ba8ae));if(_0x3ba8ae[_0x031c('0x13')]){if(_0x3ba8ae[_0x031c('0x13')][_0x031c('0x14')]===0x1f4){logger[_0x031c('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0xa76669,_0x3ba8ae['error'][_0x031c('0x15')]);return _0x526917(_0x3ba8ae[_0x031c('0x13')][_0x031c('0x15')]);}logger[_0x031c('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0xa76669,_0x3ba8ae[_0x031c('0x13')][_0x031c('0x15')]);return _0x35420b(_0x3ba8ae[_0x031c('0x13')]['message']);}else{logger[_0x031c('0x16')]('FreshdeskAccount,\x20%s,\x20%s',_0xa76669,_0x031c('0xf'));_0x35420b(_0x3ba8ae[_0x031c('0x17')][_0x031c('0x15')]);}})['catch'](function(_0x5b15cb){logger[_0x031c('0x13')](_0x031c('0xe'),_0xa76669,_0x5b15cb);_0x526917(_0x5b15cb);});});}exports[_0x031c('0x18')]=function(_0x474255){var _0x53a1b3=this;return new Promise(function(_0x8c9099,_0x376801){return db[_0x031c('0x19')]['findAll']({'raw':_0x474255[_0x031c('0x1a')]?_0x474255['options'][_0x031c('0x1b')]===undefined?!![]:![]:!![],'where':_0x474255[_0x031c('0x1a')]?_0x474255[_0x031c('0x1a')][_0x031c('0x1c')]||null:null,'attributes':_0x474255[_0x031c('0x1a')]?_0x474255['options'][_0x031c('0x1d')]||null:null,'limit':_0x474255['options']?_0x474255['options'][_0x031c('0x1e')]||null:null,'include':_0x474255[_0x031c('0x1a')]?_0x474255[_0x031c('0x1a')][_0x031c('0x1f')]?_['map'](_0x474255['options'][_0x031c('0x1f')],function(_0x5271b5){return{'model':db[_0x5271b5[_0x031c('0x20')]],'as':_0x5271b5['as'],'attributes':_0x5271b5[_0x031c('0x1d')],'include':_0x5271b5[_0x031c('0x1f')]?_['map'](_0x5271b5[_0x031c('0x1f')],function(_0x5eaa69){return{'model':db[_0x5eaa69[_0x031c('0x20')]],'as':_0x5eaa69['as'],'attributes':_0x5eaa69['attributes'],'include':_0x5eaa69[_0x031c('0x1f')]?_[_0x031c('0x21')](_0x5eaa69[_0x031c('0x1f')],function(_0x21cc72){return{'model':db[_0x21cc72[_0x031c('0x20')]],'as':_0x21cc72['as'],'attributes':_0x21cc72[_0x031c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x031c('0xd')](function(_0x16fc4e){logger['info'](_0x031c('0x18'),_0x474255);logger[_0x031c('0x10')]('GetFreshdeskAccount',_0x474255,JSON['stringify'](_0x16fc4e));_0x8c9099(_0x16fc4e);})[_0x031c('0x22')](function(_0x167311){logger['error'](_0x031c('0x18'),_0x167311['message'],_0x474255);_0x376801(_0x53a1b3['error'](0x1f4,_0x167311[_0x031c('0x15')]));});});};exports[_0x031c('0x23')]=function(_0x209aa5){var _0x3484fd=this;return new Promise(function(_0x35f700,_0x200157){return db[_0x031c('0x19')][_0x031c('0x24')]({'raw':_0x209aa5[_0x031c('0x1a')]?_0x209aa5[_0x031c('0x1a')][_0x031c('0x1b')]===undefined?!![]:![]:!![],'where':_0x209aa5[_0x031c('0x1a')]?_0x209aa5[_0x031c('0x1a')][_0x031c('0x1c')]||null:null,'attributes':_0x209aa5[_0x031c('0x1a')]?_0x209aa5[_0x031c('0x1a')][_0x031c('0x1d')]||null:null,'include':_0x209aa5[_0x031c('0x1a')]?_0x209aa5['options'][_0x031c('0x1f')]?_['map'](_0x209aa5[_0x031c('0x1a')][_0x031c('0x1f')],function(_0x5daf58){return{'model':db[_0x5daf58['model']],'as':_0x5daf58['as'],'attributes':_0x5daf58[_0x031c('0x1d')],'include':_0x5daf58[_0x031c('0x1f')]?_[_0x031c('0x21')](_0x5daf58['include'],function(_0x45f100){return{'model':db[_0x45f100[_0x031c('0x20')]],'as':_0x45f100['as'],'attributes':_0x45f100[_0x031c('0x1d')],'include':_0x45f100[_0x031c('0x1f')]?_[_0x031c('0x21')](_0x45f100[_0x031c('0x1f')],function(_0x22e39a){return{'model':db[_0x22e39a[_0x031c('0x20')]],'as':_0x22e39a['as'],'attributes':_0x22e39a[_0x031c('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b34eb){logger[_0x031c('0x16')](_0x031c('0x23'),_0x209aa5);logger[_0x031c('0x10')](_0x031c('0x23'),_0x209aa5,JSON['stringify'](_0x1b34eb));_0x35f700(_0x1b34eb);})[_0x031c('0x22')](function(_0x123fab){logger[_0x031c('0x13')]('ShowFreshdeskAccount',_0x123fab[_0x031c('0x15')],_0x209aa5);_0x200157(_0x3484fd[_0x031c('0x13')](0x1f4,_0x123fab['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 4374f87..5b1604a 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 _0x45eb=['multer','path','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x45eb,0x8c));var _0xb45e=function(_0x51932d,_0x1ffbf7){_0x51932d=_0x51932d-0x0;var _0x1ca2f4=_0x45eb[_0x51932d];return _0x1ca2f4;};'use strict';var multer=require(_0xb45e('0x0'));var util=require('util');var path=require(_0xb45e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xb45e('0x2'));var config=require(_0xb45e('0x3'));var controller=require(_0xb45e('0x4'));router[_0xb45e('0x5')]('/',auth[_0xb45e('0x6')](),controller[_0xb45e('0x7')]);router[_0xb45e('0x5')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb45e('0x5')]('/:id/fields',auth[_0xb45e('0x6')](),controller['getFields']);router[_0xb45e('0x5')](_0xb45e('0x8'),auth[_0xb45e('0x6')](),controller[_0xb45e('0x9')]);router[_0xb45e('0x5')]('/:id/descriptions',auth[_0xb45e('0x6')](),controller[_0xb45e('0xa')]);router['get'](_0xb45e('0xb'),auth['isAuthenticated'](),controller[_0xb45e('0xc')]);router[_0xb45e('0xd')]('/',auth[_0xb45e('0x6')](),controller[_0xb45e('0xe')]);router[_0xb45e('0xd')](_0xb45e('0xb'),auth['isAuthenticated'](),controller[_0xb45e('0xf')]);router[_0xb45e('0x10')]('/:id',auth[_0xb45e('0x6')](),controller[_0xb45e('0x11')]);router[_0xb45e('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xb45e('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc1c3=['delete','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getTags','create','setTags','put'];(function(_0xe5fc1a,_0x97fb16){var _0x161c2a=function(_0x234c82){while(--_0x234c82){_0xe5fc1a['push'](_0xe5fc1a['shift']());}};_0x161c2a(++_0x97fb16);}(_0xc1c3,0xba));var _0x3c1c=function(_0x310d5a,_0x3a14e0){_0x310d5a=_0x310d5a-0x0;var _0x2ead38=_0xc1c3[_0x310d5a];return _0x2ead38;};'use strict';var multer=require(_0x3c1c('0x0'));var util=require(_0x3c1c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3c1c('0x2'));var router=express[_0x3c1c('0x3')]();var auth=require(_0x3c1c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3c1c('0x5'));var controller=require(_0x3c1c('0x6'));router[_0x3c1c('0x7')]('/',auth[_0x3c1c('0x8')](),controller[_0x3c1c('0x9')]);router[_0x3c1c('0x7')](_0x3c1c('0xa'),auth[_0x3c1c('0x8')](),controller[_0x3c1c('0xb')]);router[_0x3c1c('0x7')](_0x3c1c('0xc'),auth['isAuthenticated'](),controller[_0x3c1c('0xd')]);router[_0x3c1c('0x7')](_0x3c1c('0xe'),auth[_0x3c1c('0x8')](),controller[_0x3c1c('0xf')]);router[_0x3c1c('0x7')](_0x3c1c('0x10'),auth[_0x3c1c('0x8')](),controller['getDescriptions']);router[_0x3c1c('0x7')]('/:id/tags',auth[_0x3c1c('0x8')](),controller[_0x3c1c('0x11')]);router['post']('/',auth[_0x3c1c('0x8')](),controller[_0x3c1c('0x12')]);router['post']('/:id/tags',auth[_0x3c1c('0x8')](),controller[_0x3c1c('0x13')]);router[_0x3c1c('0x14')](_0x3c1c('0xa'),auth[_0x3c1c('0x8')](),controller['update']);router[_0x3c1c('0x15')](_0x3c1c('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x3c1c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 079326e..9902b6e 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 _0x4377=['STRING','exports'];(function(_0x415b27,_0x3f4ef0){var _0x42ff68=function(_0x599f91){while(--_0x599f91){_0x415b27['push'](_0x415b27['shift']());}};_0x42ff68(++_0x3f4ef0);}(_0x4377,0x1db));var _0x7437=function(_0x1f103d,_0x28c8a3){_0x1f103d=_0x1f103d-0x0;var _0x233a9a=_0x4377[_0x1f103d];return _0x233a9a;};'use strict';var Sequelize=require('sequelize');module[_0x7437('0x0')]={'name':{'type':Sequelize[_0x7437('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x860c=['STRING','sequelize','exports'];(function(_0x16e824,_0x23ab90){var _0x1745ea=function(_0x327e55){while(--_0x327e55){_0x16e824['push'](_0x16e824['shift']());}};_0x1745ea(++_0x23ab90);}(_0x860c,0x136));var _0xc860=function(_0x2891af,_0x7bed5){_0x2891af=_0x2891af-0x0;var _0x263f51=_0x860c[_0x2891af];return _0x263f51;};'use strict';var Sequelize=require(_0xc860('0x0'));module[_0xc860('0x1')]={'name':{'type':Sequelize[_0xc860('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index aaebe83..6af1c33 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 _0x90f8=['../../mysqldb','jayson/promise','client','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','FreshdeskConfiguration','findAll','show','params','includeAll','include','find','create','body','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','setTags','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x4878b6,_0x295dad){var _0x3933f9=function(_0x4d4296){while(--_0x4d4296){_0x4878b6['push'](_0x4878b6['shift']());}};_0x3933f9(++_0x295dad);}(_0x90f8,0x151));var _0x890f=function(_0x51923a,_0x4636d0){_0x51923a=_0x51923a-0x0;var _0x55b915=_0x90f8[_0x51923a];return _0x55b915;};'use strict';var pdf=require(_0x890f('0x0'));var emlformat=require(_0x890f('0x1'));var rimraf=require(_0x890f('0x2'));var zipdir=require(_0x890f('0x3'));var jsonpatch=require(_0x890f('0x4'));var rp=require(_0x890f('0x5'));var moment=require(_0x890f('0x6'));var BPromise=require(_0x890f('0x7'));var Mustache=require('mustache');var util=require(_0x890f('0x8'));var path=require(_0x890f('0x9'));var sox=require(_0x890f('0xa'));var csv=require(_0x890f('0xb'));var ejs=require(_0x890f('0xc'));var fs=require('fs');var _=require(_0x890f('0xd'));var squel=require(_0x890f('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x890f('0xb'));var querystring=require(_0x890f('0xf'));var Papa=require('papaparse');var Redis=require(_0x890f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x890f('0x11'));var as=require(_0x890f('0x12'));var hardwareService=require(_0x890f('0x13'));var logger=require('../../config/logger')(_0x890f('0x14'));var utils=require(_0x890f('0x15'));var config=require(_0x890f('0x16'));var db=require(_0x890f('0x17'))['db'];var jayson=require(_0x890f('0x18'));var client=jayson[_0x890f('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x49212f,_0x419c79,_0x39b126){if(_0x39b126){var _0xc24082=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc24082['test'](_0x419c79)){return _0x49212f;}else{throw new db['Sequelize'][(_0x890f('0x1a'))](_0x890f('0x1b'));}}else{return _0x49212f;}}function respondWithRpcPromise(_0x42e4a8,_0x23c146,_0x235bd0,_0x22a08e){return new BPromise(function(_0x592652,_0x5a7ca3){var _0x4403d4=_0x22a08e||client;return _0x4403d4[_0x890f('0x1c')](_0x42e4a8,_0x235bd0)[_0x890f('0x1d')](function(_0x1119b8){logger['info'](_0x890f('0x1e'),_0x23c146,'request\x20sent');logger['debug'](_0x890f('0x1f'),_0x23c146,_0x890f('0x20'),JSON[_0x890f('0x21')](_0x1119b8));if(_0x1119b8[_0x890f('0x22')]){if(_0x1119b8[_0x890f('0x22')][_0x890f('0x23')]===0x1f4){logger['error'](_0x890f('0x1e'),_0x23c146,_0x1119b8[_0x890f('0x22')][_0x890f('0x24')]);return _0x5a7ca3(_0x1119b8['error'][_0x890f('0x24')]);}logger[_0x890f('0x22')](_0x890f('0x1e'),_0x23c146,_0x1119b8[_0x890f('0x22')][_0x890f('0x24')]);return _0x592652(_0x1119b8['error'][_0x890f('0x24')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x23c146,_0x890f('0x20'));_0x592652(_0x1119b8[_0x890f('0x25')]['message']);}})[_0x890f('0x26')](function(_0x4f3bae){logger[_0x890f('0x22')](_0x890f('0x1e'),_0x23c146,_0x4f3bae);_0x5a7ca3(_0x4f3bae);});});}function respondWithStatusCode(_0x550ba9,_0x175be9){_0x175be9=_0x175be9||0xcc;return function(_0xdbb4f0){if(_0xdbb4f0){return _0x550ba9[_0x890f('0x27')](_0x175be9);}return _0x550ba9[_0x890f('0x28')](_0x175be9)[_0x890f('0x29')]();};}function respondWithResult(_0xe94cb3,_0x286a91){_0x286a91=_0x286a91||0xc8;return function(_0x20eb51){if(_0x20eb51){return _0xe94cb3[_0x890f('0x28')](_0x286a91)['json'](_0x20eb51);}};}function respondWithFilteredResult(_0x6dab83,_0x2011ee){return function(_0x3d5236){if(_0x3d5236){var _0x35ec6d=_0x3d5236[_0x890f('0x2a')],_0x156e5a=_0x2011ee['offset'],_0x13756e=_0x2011ee[_0x890f('0x2b')]+_0x2011ee[_0x890f('0x2c')],_0x4add94;if(_0x13756e>=_0x35ec6d){_0x13756e=_0x35ec6d;_0x4add94=0xc8;}else{_0x4add94=0xce;}_0x6dab83[_0x890f('0x28')](_0x4add94);return _0x6dab83['set'](_0x890f('0x2d'),_0x156e5a+'-'+_0x13756e+'/'+_0x35ec6d)['json'](_0x3d5236);}return null;};}function patchUpdates(_0x1a4111){return function(_0x265dd5){try{jsonpatch[_0x890f('0x2e')](_0x265dd5,_0x1a4111,!![]);}catch(_0x3feb3b){return BPromise[_0x890f('0x2f')](_0x3feb3b);}return _0x265dd5['save']();};}function saveUpdates(_0xe72648,_0x2dff41){return function(_0x19a64e){if(_0x19a64e){return _0x19a64e['update'](_0xe72648)['then'](function(_0x4dc7df){return _0x4dc7df;});}return null;};}function removeEntity(_0x13986f,_0x4e5279){return function(_0x2a0673){if(_0x2a0673){return _0x2a0673[_0x890f('0x30')]()[_0x890f('0x1d')](function(){_0x13986f[_0x890f('0x28')](0xcc)[_0x890f('0x29')]();});}};}function handleEntityNotFound(_0x469d31,_0x15d737){return function(_0x4cf066){if(!_0x4cf066){_0x469d31['sendStatus'](0x194);}return _0x4cf066;};}function handleError(_0x51c427,_0x1551fe){_0x1551fe=_0x1551fe||0x1f4;return function(_0x59d691){logger['error'](_0x59d691[_0x890f('0x31')]);if(_0x59d691['name']){delete _0x59d691[_0x890f('0x32')];}_0x51c427[_0x890f('0x28')](_0x1551fe)[_0x890f('0x33')](_0x59d691);};}exports[_0x890f('0x34')]=function(_0x40dee7,_0x8155f6){var _0x2000bc={},_0x5dab8e={},_0x78e3df={'count':0x0,'rows':[]};var _0x165686=_[_0x890f('0x35')](db['FreshdeskConfiguration'][_0x890f('0x36')],function(_0x1c4e2d){return{'name':_0x1c4e2d[_0x890f('0x37')],'type':_0x1c4e2d[_0x890f('0x38')]['key']};});_0x5dab8e[_0x890f('0x39')]=_[_0x890f('0x35')](_0x165686,_0x890f('0x32'));_0x5dab8e[_0x890f('0x3a')]=_[_0x890f('0x3b')](_0x40dee7[_0x890f('0x3a')]);_0x5dab8e['filters']=_[_0x890f('0x3c')](_0x5dab8e[_0x890f('0x39')],_0x5dab8e[_0x890f('0x3a')]);_0x2000bc[_0x890f('0x3d')]=_['intersection'](_0x5dab8e[_0x890f('0x39')],qs[_0x890f('0x3e')](_0x40dee7[_0x890f('0x3a')][_0x890f('0x3e')]));_0x2000bc[_0x890f('0x3d')]=_0x2000bc[_0x890f('0x3d')][_0x890f('0x3f')]?_0x2000bc[_0x890f('0x3d')]:_0x5dab8e[_0x890f('0x39')];if(!_0x40dee7[_0x890f('0x3a')][_0x890f('0x40')](_0x890f('0x41'))){_0x2000bc['limit']=qs['limit'](_0x40dee7[_0x890f('0x3a')][_0x890f('0x2c')]);_0x2000bc[_0x890f('0x2b')]=qs[_0x890f('0x2b')](_0x40dee7[_0x890f('0x3a')][_0x890f('0x2b')]);}_0x2000bc[_0x890f('0x42')]=qs[_0x890f('0x43')](_0x40dee7[_0x890f('0x3a')]['sort']);_0x2000bc[_0x890f('0x44')]=qs[_0x890f('0x45')](_[_0x890f('0x46')](_0x40dee7[_0x890f('0x3a')],_0x5dab8e[_0x890f('0x45')]));if(_0x40dee7[_0x890f('0x3a')]['filter']){_0x2000bc['where']=_[_0x890f('0x47')](_0x2000bc[_0x890f('0x44')],{'$or':_['map'](_0x165686,function(_0x1e1070){if(_0x1e1070[_0x890f('0x38')]!=='VIRTUAL'){var _0x541a8c={};_0x541a8c[_0x1e1070[_0x890f('0x32')]]={'$like':'%'+_0x40dee7[_0x890f('0x3a')][_0x890f('0x48')]+'%'};return _0x541a8c;}})});}_0x2000bc=_['merge']({},_0x2000bc,_0x40dee7[_0x890f('0x49')]);var _0x111f77={'where':_0x2000bc[_0x890f('0x44')]};return db[_0x890f('0x4a')][_0x890f('0x2a')](_0x111f77)[_0x890f('0x1d')](function(_0x3952e6){_0x78e3df['count']=_0x3952e6;if(_0x40dee7['query']['includeAll']){_0x2000bc['include']=[{'all':!![]}];}return db[_0x890f('0x4a')][_0x890f('0x4b')](_0x2000bc);})[_0x890f('0x1d')](function(_0x2f351b){_0x78e3df['rows']=_0x2f351b;return _0x78e3df;})[_0x890f('0x1d')](respondWithFilteredResult(_0x8155f6,_0x2000bc))[_0x890f('0x26')](handleError(_0x8155f6,null));};exports[_0x890f('0x4c')]=function(_0x4adfe1,_0x442e01){var _0x32f9f9={'raw':![],'where':{'id':_0x4adfe1[_0x890f('0x4d')]['id']}},_0x54d0f9={};_0x54d0f9[_0x890f('0x39')]=_[_0x890f('0x3b')](db[_0x890f('0x4a')][_0x890f('0x36')]);_0x54d0f9[_0x890f('0x3a')]=_[_0x890f('0x3b')](_0x4adfe1[_0x890f('0x3a')]);_0x54d0f9[_0x890f('0x45')]=_[_0x890f('0x3c')](_0x54d0f9[_0x890f('0x39')],_0x54d0f9['query']);_0x32f9f9[_0x890f('0x3d')]=_[_0x890f('0x3c')](_0x54d0f9[_0x890f('0x39')],qs[_0x890f('0x3e')](_0x4adfe1[_0x890f('0x3a')][_0x890f('0x3e')]));_0x32f9f9[_0x890f('0x3d')]=_0x32f9f9[_0x890f('0x3d')]['length']?_0x32f9f9['attributes']:_0x54d0f9[_0x890f('0x39')];if(_0x4adfe1[_0x890f('0x3a')][_0x890f('0x4e')]){_0x32f9f9[_0x890f('0x4f')]=[{'all':!![]}];}_0x32f9f9=_['merge']({},_0x32f9f9,_0x4adfe1[_0x890f('0x49')]);return db[_0x890f('0x4a')][_0x890f('0x50')](_0x32f9f9)[_0x890f('0x1d')](handleEntityNotFound(_0x442e01,null))[_0x890f('0x1d')](respondWithResult(_0x442e01,null))[_0x890f('0x26')](handleError(_0x442e01,null));};exports['create']=function(_0x3b9772,_0x378bb2){return db[_0x890f('0x4a')][_0x890f('0x51')](_0x3b9772[_0x890f('0x52')],{})[_0x890f('0x1d')](respondWithResult(_0x378bb2,0xc9))[_0x890f('0x26')](handleError(_0x378bb2,null));};exports['update']=function(_0xdabdd6,_0x32ae6e){if(_0xdabdd6[_0x890f('0x52')]['id']){delete _0xdabdd6[_0x890f('0x52')]['id'];}return db[_0x890f('0x4a')][_0x890f('0x50')]({'where':{'id':_0xdabdd6['params']['id']}})[_0x890f('0x1d')](handleEntityNotFound(_0x32ae6e,null))[_0x890f('0x1d')](saveUpdates(_0xdabdd6['body'],null))[_0x890f('0x1d')](respondWithResult(_0x32ae6e,null))[_0x890f('0x26')](handleError(_0x32ae6e,null));};exports[_0x890f('0x30')]=function(_0x4cdcca,_0x580a50){return db[_0x890f('0x4a')]['find']({'where':{'id':_0x4cdcca['params']['id']}})['then'](handleEntityNotFound(_0x580a50,null))[_0x890f('0x1d')](removeEntity(_0x580a50,null))['catch'](handleError(_0x580a50,null));};exports[_0x890f('0x53')]=function(_0x12b2f7,_0x5cdcad,_0x3dd14c){var _0x391ee4={};var _0x5bb596={};var _0x206e5c;var _0x48b315;return db[_0x890f('0x4a')][_0x890f('0x54')]({'where':{'id':_0x12b2f7[_0x890f('0x4d')]['id']}})[_0x890f('0x1d')](handleEntityNotFound(_0x5cdcad,null))[_0x890f('0x1d')](function(_0x3785b5){if(_0x3785b5){_0x206e5c=_0x3785b5;_0x5bb596[_0x890f('0x39')]=_['keys'](db[_0x890f('0x55')][_0x890f('0x36')]);_0x5bb596[_0x890f('0x3a')]=_['keys'](_0x12b2f7[_0x890f('0x3a')]);_0x5bb596[_0x890f('0x45')]=_[_0x890f('0x3c')](_0x5bb596[_0x890f('0x39')],_0x5bb596[_0x890f('0x3a')]);_0x391ee4[_0x890f('0x3d')]=_[_0x890f('0x3c')](_0x5bb596['model'],qs[_0x890f('0x3e')](_0x12b2f7['query'][_0x890f('0x3e')]));_0x391ee4[_0x890f('0x3d')]=_0x391ee4[_0x890f('0x3d')]['length']?_0x391ee4['attributes']:_0x5bb596['model'];_0x391ee4[_0x890f('0x42')]=qs['sort'](_0x12b2f7[_0x890f('0x3a')][_0x890f('0x43')]);_0x391ee4[_0x890f('0x44')]=qs[_0x890f('0x45')](_['pick'](_0x12b2f7[_0x890f('0x3a')],_0x5bb596[_0x890f('0x45')]));if(_0x12b2f7[_0x890f('0x3a')]['filter']){_0x391ee4[_0x890f('0x44')]=_[_0x890f('0x47')](_0x391ee4[_0x890f('0x44')],{'$or':_[_0x890f('0x35')](_0x391ee4['attributes'],function(_0x5745b2){var _0xa04c4c={};_0xa04c4c[_0x5745b2]={'$like':'%'+_0x12b2f7[_0x890f('0x3a')][_0x890f('0x48')]+'%'};return _0xa04c4c;})});}_0x391ee4=_[_0x890f('0x47')]({},_0x391ee4,_0x12b2f7[_0x890f('0x49')]);return _0x206e5c[_0x890f('0x53')](_0x391ee4);}})[_0x890f('0x1d')](function(_0x26192b){if(_0x26192b){_0x48b315=_0x26192b[_0x890f('0x3f')];if(!_0x12b2f7['query'][_0x890f('0x40')](_0x890f('0x41'))){_0x391ee4[_0x890f('0x2c')]=qs[_0x890f('0x2c')](_0x12b2f7[_0x890f('0x3a')][_0x890f('0x2c')]);_0x391ee4[_0x890f('0x2b')]=qs[_0x890f('0x2b')](_0x12b2f7['query'][_0x890f('0x2b')]);}return _0x206e5c[_0x890f('0x53')](_0x391ee4);}})[_0x890f('0x1d')](function(_0x510c65){if(_0x510c65){return _0x510c65?{'count':_0x48b315,'rows':_0x510c65}:null;}})[_0x890f('0x1d')](respondWithResult(_0x5cdcad,null))['catch'](handleError(_0x5cdcad,null));};exports[_0x890f('0x56')]=function(_0x17cc3f,_0x1a39aa,_0x3899b0){var _0x5b9509={};var _0x476d45={};var _0x44e3e1;var _0x4cf97b;return db[_0x890f('0x4a')][_0x890f('0x54')]({'where':{'id':_0x17cc3f[_0x890f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1a39aa,null))[_0x890f('0x1d')](function(_0x430e61){if(_0x430e61){_0x44e3e1=_0x430e61;_0x476d45[_0x890f('0x39')]=_['keys'](db[_0x890f('0x55')][_0x890f('0x36')]);_0x476d45['query']=_[_0x890f('0x3b')](_0x17cc3f[_0x890f('0x3a')]);_0x476d45[_0x890f('0x45')]=_['intersection'](_0x476d45[_0x890f('0x39')],_0x476d45['query']);_0x5b9509[_0x890f('0x3d')]=_[_0x890f('0x3c')](_0x476d45['model'],qs[_0x890f('0x3e')](_0x17cc3f[_0x890f('0x3a')][_0x890f('0x3e')]));_0x5b9509['attributes']=_0x5b9509[_0x890f('0x3d')][_0x890f('0x3f')]?_0x5b9509[_0x890f('0x3d')]:_0x476d45['model'];_0x5b9509[_0x890f('0x42')]=qs['sort'](_0x17cc3f[_0x890f('0x3a')][_0x890f('0x43')]);_0x5b9509[_0x890f('0x44')]=qs[_0x890f('0x45')](_[_0x890f('0x46')](_0x17cc3f[_0x890f('0x3a')],_0x476d45[_0x890f('0x45')]));if(_0x17cc3f[_0x890f('0x3a')][_0x890f('0x48')]){_0x5b9509[_0x890f('0x44')]=_[_0x890f('0x47')](_0x5b9509[_0x890f('0x44')],{'$or':_[_0x890f('0x35')](_0x5b9509[_0x890f('0x3d')],function(_0x5715a6){var _0x547023={};_0x547023[_0x5715a6]={'$like':'%'+_0x17cc3f[_0x890f('0x3a')][_0x890f('0x48')]+'%'};return _0x547023;})});}_0x5b9509=_[_0x890f('0x47')]({},_0x5b9509,_0x17cc3f[_0x890f('0x49')]);return _0x44e3e1[_0x890f('0x56')](_0x5b9509);}})[_0x890f('0x1d')](function(_0xa9d450){if(_0xa9d450){_0x4cf97b=_0xa9d450[_0x890f('0x3f')];if(!_0x17cc3f[_0x890f('0x3a')]['hasOwnProperty'](_0x890f('0x41'))){_0x5b9509[_0x890f('0x2c')]=qs['limit'](_0x17cc3f[_0x890f('0x3a')][_0x890f('0x2c')]);_0x5b9509['offset']=qs[_0x890f('0x2b')](_0x17cc3f[_0x890f('0x3a')]['offset']);}return _0x44e3e1[_0x890f('0x56')](_0x5b9509);}})[_0x890f('0x1d')](function(_0x245991){if(_0x245991){return _0x245991?{'count':_0x4cf97b,'rows':_0x245991}:null;}})[_0x890f('0x1d')](respondWithResult(_0x1a39aa,null))[_0x890f('0x26')](handleError(_0x1a39aa,null));};exports[_0x890f('0x57')]=function(_0x3242b6,_0x3dac54,_0x37120b){var _0xf3ff82={};var _0x1fef46={};var _0x102ad3;var _0x5be85d;return db[_0x890f('0x4a')][_0x890f('0x54')]({'where':{'id':_0x3242b6[_0x890f('0x4d')]['id']}})[_0x890f('0x1d')](handleEntityNotFound(_0x3dac54,null))[_0x890f('0x1d')](function(_0x1ed5f4){if(_0x1ed5f4){_0x102ad3=_0x1ed5f4;_0x1fef46[_0x890f('0x39')]=_[_0x890f('0x3b')](db[_0x890f('0x55')][_0x890f('0x36')]);_0x1fef46[_0x890f('0x3a')]=_['keys'](_0x3242b6[_0x890f('0x3a')]);_0x1fef46[_0x890f('0x45')]=_[_0x890f('0x3c')](_0x1fef46['model'],_0x1fef46['query']);_0xf3ff82[_0x890f('0x3d')]=_[_0x890f('0x3c')](_0x1fef46[_0x890f('0x39')],qs[_0x890f('0x3e')](_0x3242b6[_0x890f('0x3a')][_0x890f('0x3e')]));_0xf3ff82['attributes']=_0xf3ff82[_0x890f('0x3d')][_0x890f('0x3f')]?_0xf3ff82[_0x890f('0x3d')]:_0x1fef46['model'];_0xf3ff82[_0x890f('0x42')]=qs[_0x890f('0x43')](_0x3242b6[_0x890f('0x3a')][_0x890f('0x43')]);_0xf3ff82['where']=qs[_0x890f('0x45')](_[_0x890f('0x46')](_0x3242b6[_0x890f('0x3a')],_0x1fef46[_0x890f('0x45')]));if(_0x3242b6[_0x890f('0x3a')][_0x890f('0x48')]){_0xf3ff82[_0x890f('0x44')]=_[_0x890f('0x47')](_0xf3ff82[_0x890f('0x44')],{'$or':_['map'](_0xf3ff82[_0x890f('0x3d')],function(_0x17e9ca){var _0x50f1fa={};_0x50f1fa[_0x17e9ca]={'$like':'%'+_0x3242b6[_0x890f('0x3a')][_0x890f('0x48')]+'%'};return _0x50f1fa;})});}_0xf3ff82=_[_0x890f('0x47')]({},_0xf3ff82,_0x3242b6['options']);return _0x102ad3[_0x890f('0x57')](_0xf3ff82);}})[_0x890f('0x1d')](function(_0x265a52){if(_0x265a52){_0x5be85d=_0x265a52['length'];if(!_0x3242b6['query'][_0x890f('0x40')](_0x890f('0x41'))){_0xf3ff82[_0x890f('0x2c')]=qs[_0x890f('0x2c')](_0x3242b6[_0x890f('0x3a')]['limit']);_0xf3ff82['offset']=qs[_0x890f('0x2b')](_0x3242b6[_0x890f('0x3a')][_0x890f('0x2b')]);}return _0x102ad3[_0x890f('0x57')](_0xf3ff82);}})[_0x890f('0x1d')](function(_0x1304f4){if(_0x1304f4){return _0x1304f4?{'count':_0x5be85d,'rows':_0x1304f4}:null;}})[_0x890f('0x1d')](respondWithResult(_0x3dac54,null))[_0x890f('0x26')](handleError(_0x3dac54,null));};exports[_0x890f('0x58')]=function(_0x3b8dfe,_0x5b5117,_0x143ee9){var _0xcdbde1={};var _0x48c787={};var _0x74cb81;var _0x128cd5;return db[_0x890f('0x4a')][_0x890f('0x54')]({'where':{'id':_0x3b8dfe[_0x890f('0x4d')]['id']}})[_0x890f('0x1d')](handleEntityNotFound(_0x5b5117,null))[_0x890f('0x1d')](function(_0x2b3218){if(_0x2b3218){_0x74cb81=_0x2b3218;_0x48c787[_0x890f('0x39')]=_[_0x890f('0x3b')](db['Tag'][_0x890f('0x36')]);_0x48c787[_0x890f('0x3a')]=_[_0x890f('0x3b')](_0x3b8dfe[_0x890f('0x3a')]);_0x48c787[_0x890f('0x45')]=_['intersection'](_0x48c787[_0x890f('0x39')],_0x48c787[_0x890f('0x3a')]);_0xcdbde1[_0x890f('0x3d')]=_[_0x890f('0x3c')](_0x48c787[_0x890f('0x39')],qs[_0x890f('0x3e')](_0x3b8dfe['query'][_0x890f('0x3e')]));_0xcdbde1['attributes']=_0xcdbde1['attributes'][_0x890f('0x3f')]?_0xcdbde1['attributes']:_0x48c787[_0x890f('0x39')];_0xcdbde1[_0x890f('0x42')]=qs[_0x890f('0x43')](_0x3b8dfe[_0x890f('0x3a')]['sort']);_0xcdbde1[_0x890f('0x44')]=qs[_0x890f('0x45')](_[_0x890f('0x46')](_0x3b8dfe[_0x890f('0x3a')],_0x48c787['filters']));if(_0x3b8dfe[_0x890f('0x3a')][_0x890f('0x48')]){_0xcdbde1['where']=_[_0x890f('0x47')](_0xcdbde1[_0x890f('0x44')],{'$or':_[_0x890f('0x35')](_0xcdbde1[_0x890f('0x3d')],function(_0x5223fd){var _0xd0a1d8={};_0xd0a1d8[_0x5223fd]={'$like':'%'+_0x3b8dfe[_0x890f('0x3a')][_0x890f('0x48')]+'%'};return _0xd0a1d8;})});}_0xcdbde1=_[_0x890f('0x47')]({},_0xcdbde1,_0x3b8dfe[_0x890f('0x49')]);return _0x74cb81[_0x890f('0x58')](_0xcdbde1);}})['then'](function(_0x93696){if(_0x93696){_0x128cd5=_0x93696[_0x890f('0x3f')];if(!_0x3b8dfe[_0x890f('0x3a')][_0x890f('0x40')]('nolimit')){_0xcdbde1[_0x890f('0x2c')]=qs['limit'](_0x3b8dfe[_0x890f('0x3a')][_0x890f('0x2c')]);_0xcdbde1[_0x890f('0x2b')]=qs[_0x890f('0x2b')](_0x3b8dfe[_0x890f('0x3a')][_0x890f('0x2b')]);}return _0x74cb81[_0x890f('0x58')](_0xcdbde1);}})[_0x890f('0x1d')](function(_0x2f0cae){if(_0x2f0cae){return _0x2f0cae?{'count':_0x128cd5,'rows':_0x2f0cae}:null;}})[_0x890f('0x1d')](respondWithResult(_0x5b5117,null))['catch'](handleError(_0x5b5117,null));};exports['setTags']=function(_0x559014,_0xa4e9b6,_0x982c2a){if(_0x559014[_0x890f('0x52')]['id']){delete _0x559014['body']['id'];}return db['FreshdeskConfiguration'][_0x890f('0x54')]({'where':{'id':_0x559014[_0x890f('0x4d')]['id']}})['then'](handleEntityNotFound(_0xa4e9b6,null))[_0x890f('0x1d')](function(_0x4ae808){if(_0x4ae808){return _0x4ae808[_0x890f('0x59')](_0x559014['body']['ids']||[]);}return null;})[_0x890f('0x1d')](respondWithResult(_0xa4e9b6,null))[_0x890f('0x26')](handleError(_0xa4e9b6,null));}; \ No newline at end of file +var _0x5843=['merge','filter','options','FreshdeskConfiguration','includeAll','include','show','find','create','body','update','params','destroy','getFields','findOne','FreshdeskField','order','getSubjects','getDescriptions','Tag','getTags','setTags','ids','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','status','end','offset','limit','set','Content-Range','apply','save','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x5f761a,_0x5acd06){var _0x489bea=function(_0x4ef9c3){while(--_0x4ef9c3){_0x5f761a['push'](_0x5f761a['shift']());}};_0x489bea(++_0x5acd06);}(_0x5843,0x74));var _0x3584=function(_0x5f460c,_0x55d7e3){_0x5f460c=_0x5f460c-0x0;var _0x4dbbbd=_0x5843[_0x5f460c];return _0x4dbbbd;};'use strict';var pdf=require(_0x3584('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3584('0x1'));var zipdir=require(_0x3584('0x2'));var jsonpatch=require(_0x3584('0x3'));var rp=require(_0x3584('0x4'));var moment=require(_0x3584('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3584('0x6'));var util=require('util');var path=require(_0x3584('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3584('0x8'));var fs=require('fs');var _=require(_0x3584('0x9'));var squel=require(_0x3584('0xa'));var crypto=require(_0x3584('0xb'));var jsforce=require(_0x3584('0xc'));var deskjs=require(_0x3584('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3584('0xe'));var Papa=require(_0x3584('0xf'));var Redis=require('ioredis');var authService=require(_0x3584('0x10'));var qs=require(_0x3584('0x11'));var as=require(_0x3584('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3584('0x13'))(_0x3584('0x14'));var utils=require('../../config/utils');var config=require(_0x3584('0x15'));var db=require(_0x3584('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x3584('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x3ffa24,_0x220eed,_0x2a04f2){if(_0x2a04f2){var _0x10611f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x10611f[_0x3584('0x18')](_0x220eed)){return _0x3ffa24;}else{throw new db[(_0x3584('0x19'))][(_0x3584('0x1a'))](_0x3584('0x1b'));}}else{return _0x3ffa24;}}function respondWithRpcPromise(_0x1eace9,_0x1d5c55,_0x3f2944,_0x2e62fd){return new BPromise(function(_0x260bb1,_0x1cd803){var _0x16f1a5=_0x2e62fd||client;return _0x16f1a5[_0x3584('0x1c')](_0x1eace9,_0x3f2944)[_0x3584('0x1d')](function(_0xa3368d){logger[_0x3584('0x1e')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1d5c55,_0x3584('0x1f'));logger[_0x3584('0x20')](_0x3584('0x21'),_0x1d5c55,_0x3584('0x1f'),JSON[_0x3584('0x22')](_0xa3368d));if(_0xa3368d['error']){if(_0xa3368d[_0x3584('0x23')]['code']===0x1f4){logger['error'](_0x3584('0x24'),_0x1d5c55,_0xa3368d[_0x3584('0x23')][_0x3584('0x25')]);return _0x1cd803(_0xa3368d[_0x3584('0x23')]['message']);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1d5c55,_0xa3368d[_0x3584('0x23')][_0x3584('0x25')]);return _0x260bb1(_0xa3368d[_0x3584('0x23')]['message']);}else{logger['info'](_0x3584('0x24'),_0x1d5c55,_0x3584('0x1f'));_0x260bb1(_0xa3368d[_0x3584('0x26')]['message']);}})[_0x3584('0x27')](function(_0x230706){logger[_0x3584('0x23')](_0x3584('0x24'),_0x1d5c55,_0x230706);_0x1cd803(_0x230706);});});}function respondWithStatusCode(_0x543bff,_0xc684e){_0xc684e=_0xc684e||0xcc;return function(_0x3e96c5){if(_0x3e96c5){return _0x543bff['sendStatus'](_0xc684e);}return _0x543bff[_0x3584('0x28')](_0xc684e)[_0x3584('0x29')]();};}function respondWithResult(_0xd9fe6f,_0x269ad5){_0x269ad5=_0x269ad5||0xc8;return function(_0x146935){if(_0x146935){return _0xd9fe6f[_0x3584('0x28')](_0x269ad5)['json'](_0x146935);}};}function respondWithFilteredResult(_0x55ae51,_0x441455){return function(_0x424fdd){if(_0x424fdd){var _0x405112=_0x424fdd['count'],_0x1b8420=_0x441455[_0x3584('0x2a')],_0x1e28eb=_0x441455[_0x3584('0x2a')]+_0x441455[_0x3584('0x2b')],_0x246881;if(_0x1e28eb>=_0x405112){_0x1e28eb=_0x405112;_0x246881=0xc8;}else{_0x246881=0xce;}_0x55ae51[_0x3584('0x28')](_0x246881);return _0x55ae51[_0x3584('0x2c')](_0x3584('0x2d'),_0x1b8420+'-'+_0x1e28eb+'/'+_0x405112)['json'](_0x424fdd);}return null;};}function patchUpdates(_0x3da967){return function(_0x47a21c){try{jsonpatch[_0x3584('0x2e')](_0x47a21c,_0x3da967,!![]);}catch(_0x1ac651){return BPromise['reject'](_0x1ac651);}return _0x47a21c[_0x3584('0x2f')]();};}function saveUpdates(_0xf05e77,_0x5d26de){return function(_0x27e671){if(_0x27e671){return _0x27e671['update'](_0xf05e77)[_0x3584('0x1d')](function(_0x22ee83){return _0x22ee83;});}return null;};}function removeEntity(_0xcb3696,_0x4248d8){return function(_0x4d9af3){if(_0x4d9af3){return _0x4d9af3['destroy']()[_0x3584('0x1d')](function(){_0xcb3696[_0x3584('0x28')](0xcc)[_0x3584('0x29')]();});}};}function handleEntityNotFound(_0xd0afc2,_0xa03adc){return function(_0x432a34){if(!_0x432a34){_0xd0afc2[_0x3584('0x30')](0x194);}return _0x432a34;};}function handleError(_0x12bc20,_0x59b6e5){_0x59b6e5=_0x59b6e5||0x1f4;return function(_0x3af3f7){logger[_0x3584('0x23')](_0x3af3f7[_0x3584('0x31')]);if(_0x3af3f7[_0x3584('0x32')]){delete _0x3af3f7[_0x3584('0x32')];}_0x12bc20[_0x3584('0x28')](_0x59b6e5)[_0x3584('0x33')](_0x3af3f7);};}exports[_0x3584('0x34')]=function(_0x3d7ac4,_0x2fc4b1){var _0x24a091={},_0x4059bf={},_0x397958={'count':0x0,'rows':[]};var _0x36317d=_[_0x3584('0x35')](db['FreshdeskConfiguration'][_0x3584('0x36')],function(_0x47f633){return{'name':_0x47f633[_0x3584('0x37')],'type':_0x47f633[_0x3584('0x38')]['key']};});_0x4059bf['model']=_[_0x3584('0x35')](_0x36317d,_0x3584('0x32'));_0x4059bf[_0x3584('0x39')]=_[_0x3584('0x3a')](_0x3d7ac4[_0x3584('0x39')]);_0x4059bf[_0x3584('0x3b')]=_[_0x3584('0x3c')](_0x4059bf[_0x3584('0x3d')],_0x4059bf['query']);_0x24a091['attributes']=_[_0x3584('0x3c')](_0x4059bf[_0x3584('0x3d')],qs[_0x3584('0x3e')](_0x3d7ac4['query'][_0x3584('0x3e')]));_0x24a091[_0x3584('0x3f')]=_0x24a091[_0x3584('0x3f')][_0x3584('0x40')]?_0x24a091[_0x3584('0x3f')]:_0x4059bf['model'];if(!_0x3d7ac4[_0x3584('0x39')][_0x3584('0x41')](_0x3584('0x42'))){_0x24a091['limit']=qs[_0x3584('0x2b')](_0x3d7ac4[_0x3584('0x39')][_0x3584('0x2b')]);_0x24a091[_0x3584('0x2a')]=qs['offset'](_0x3d7ac4['query'][_0x3584('0x2a')]);}_0x24a091['order']=qs[_0x3584('0x43')](_0x3d7ac4[_0x3584('0x39')][_0x3584('0x43')]);_0x24a091[_0x3584('0x44')]=qs[_0x3584('0x3b')](_[_0x3584('0x45')](_0x3d7ac4['query'],_0x4059bf['filters']));if(_0x3d7ac4[_0x3584('0x39')]['filter']){_0x24a091[_0x3584('0x44')]=_[_0x3584('0x46')](_0x24a091['where'],{'$or':_[_0x3584('0x35')](_0x36317d,function(_0x5ad133){if(_0x5ad133[_0x3584('0x38')]!=='VIRTUAL'){var _0x53f85e={};_0x53f85e[_0x5ad133[_0x3584('0x32')]]={'$like':'%'+_0x3d7ac4[_0x3584('0x39')][_0x3584('0x47')]+'%'};return _0x53f85e;}})});}_0x24a091=_['merge']({},_0x24a091,_0x3d7ac4[_0x3584('0x48')]);var _0x31ccf1={'where':_0x24a091[_0x3584('0x44')]};return db[_0x3584('0x49')]['count'](_0x31ccf1)[_0x3584('0x1d')](function(_0x269777){_0x397958['count']=_0x269777;if(_0x3d7ac4[_0x3584('0x39')][_0x3584('0x4a')]){_0x24a091[_0x3584('0x4b')]=[{'all':!![]}];}return db[_0x3584('0x49')]['findAll'](_0x24a091);})[_0x3584('0x1d')](function(_0xf30004){_0x397958['rows']=_0xf30004;return _0x397958;})[_0x3584('0x1d')](respondWithFilteredResult(_0x2fc4b1,_0x24a091))[_0x3584('0x27')](handleError(_0x2fc4b1,null));};exports[_0x3584('0x4c')]=function(_0x416218,_0x92fb76){var _0x4fc823={'raw':![],'where':{'id':_0x416218['params']['id']}},_0x4b5450={};_0x4b5450[_0x3584('0x3d')]=_[_0x3584('0x3a')](db['FreshdeskConfiguration'][_0x3584('0x36')]);_0x4b5450['query']=_[_0x3584('0x3a')](_0x416218[_0x3584('0x39')]);_0x4b5450['filters']=_[_0x3584('0x3c')](_0x4b5450[_0x3584('0x3d')],_0x4b5450[_0x3584('0x39')]);_0x4fc823[_0x3584('0x3f')]=_[_0x3584('0x3c')](_0x4b5450[_0x3584('0x3d')],qs[_0x3584('0x3e')](_0x416218[_0x3584('0x39')][_0x3584('0x3e')]));_0x4fc823[_0x3584('0x3f')]=_0x4fc823['attributes']['length']?_0x4fc823[_0x3584('0x3f')]:_0x4b5450[_0x3584('0x3d')];if(_0x416218[_0x3584('0x39')]['includeAll']){_0x4fc823[_0x3584('0x4b')]=[{'all':!![]}];}_0x4fc823=_[_0x3584('0x46')]({},_0x4fc823,_0x416218[_0x3584('0x48')]);return db[_0x3584('0x49')][_0x3584('0x4d')](_0x4fc823)[_0x3584('0x1d')](handleEntityNotFound(_0x92fb76,null))['then'](respondWithResult(_0x92fb76,null))['catch'](handleError(_0x92fb76,null));};exports[_0x3584('0x4e')]=function(_0x5c2738,_0x46a21c){return db['FreshdeskConfiguration']['create'](_0x5c2738[_0x3584('0x4f')],{})['then'](respondWithResult(_0x46a21c,0xc9))['catch'](handleError(_0x46a21c,null));};exports[_0x3584('0x50')]=function(_0x44a926,_0x140100){if(_0x44a926[_0x3584('0x4f')]['id']){delete _0x44a926[_0x3584('0x4f')]['id'];}return db[_0x3584('0x49')][_0x3584('0x4d')]({'where':{'id':_0x44a926[_0x3584('0x51')]['id']}})[_0x3584('0x1d')](handleEntityNotFound(_0x140100,null))[_0x3584('0x1d')](saveUpdates(_0x44a926[_0x3584('0x4f')],null))[_0x3584('0x1d')](respondWithResult(_0x140100,null))[_0x3584('0x27')](handleError(_0x140100,null));};exports[_0x3584('0x52')]=function(_0x16c4ef,_0x155b93){return db['FreshdeskConfiguration'][_0x3584('0x4d')]({'where':{'id':_0x16c4ef[_0x3584('0x51')]['id']}})[_0x3584('0x1d')](handleEntityNotFound(_0x155b93,null))['then'](removeEntity(_0x155b93,null))['catch'](handleError(_0x155b93,null));};exports[_0x3584('0x53')]=function(_0x3cd354,_0x272a6a,_0x456b4f){var _0x537295={};var _0x225f92={};var _0x42d49a;var _0x30d91c;return db[_0x3584('0x49')][_0x3584('0x54')]({'where':{'id':_0x3cd354[_0x3584('0x51')]['id']}})[_0x3584('0x1d')](handleEntityNotFound(_0x272a6a,null))[_0x3584('0x1d')](function(_0x905a17){if(_0x905a17){_0x42d49a=_0x905a17;_0x225f92[_0x3584('0x3d')]=_[_0x3584('0x3a')](db[_0x3584('0x55')][_0x3584('0x36')]);_0x225f92[_0x3584('0x39')]=_['keys'](_0x3cd354[_0x3584('0x39')]);_0x225f92[_0x3584('0x3b')]=_[_0x3584('0x3c')](_0x225f92[_0x3584('0x3d')],_0x225f92[_0x3584('0x39')]);_0x537295[_0x3584('0x3f')]=_[_0x3584('0x3c')](_0x225f92[_0x3584('0x3d')],qs['fields'](_0x3cd354[_0x3584('0x39')]['fields']));_0x537295[_0x3584('0x3f')]=_0x537295[_0x3584('0x3f')][_0x3584('0x40')]?_0x537295[_0x3584('0x3f')]:_0x225f92[_0x3584('0x3d')];_0x537295[_0x3584('0x56')]=qs[_0x3584('0x43')](_0x3cd354[_0x3584('0x39')][_0x3584('0x43')]);_0x537295[_0x3584('0x44')]=qs['filters'](_['pick'](_0x3cd354['query'],_0x225f92[_0x3584('0x3b')]));if(_0x3cd354['query'][_0x3584('0x47')]){_0x537295[_0x3584('0x44')]=_[_0x3584('0x46')](_0x537295[_0x3584('0x44')],{'$or':_[_0x3584('0x35')](_0x537295[_0x3584('0x3f')],function(_0x29ce85){var _0x5ef293={};_0x5ef293[_0x29ce85]={'$like':'%'+_0x3cd354['query'][_0x3584('0x47')]+'%'};return _0x5ef293;})});}_0x537295=_[_0x3584('0x46')]({},_0x537295,_0x3cd354[_0x3584('0x48')]);return _0x42d49a['getFields'](_0x537295);}})[_0x3584('0x1d')](function(_0x3ccbce){if(_0x3ccbce){_0x30d91c=_0x3ccbce[_0x3584('0x40')];if(!_0x3cd354[_0x3584('0x39')]['hasOwnProperty'](_0x3584('0x42'))){_0x537295[_0x3584('0x2b')]=qs[_0x3584('0x2b')](_0x3cd354[_0x3584('0x39')][_0x3584('0x2b')]);_0x537295[_0x3584('0x2a')]=qs['offset'](_0x3cd354['query'][_0x3584('0x2a')]);}return _0x42d49a[_0x3584('0x53')](_0x537295);}})[_0x3584('0x1d')](function(_0xb781b4){if(_0xb781b4){return _0xb781b4?{'count':_0x30d91c,'rows':_0xb781b4}:null;}})[_0x3584('0x1d')](respondWithResult(_0x272a6a,null))['catch'](handleError(_0x272a6a,null));};exports[_0x3584('0x57')]=function(_0xe3a24f,_0x3ccc6d,_0x35d99e){var _0x59ced1={};var _0x4dc803={};var _0x3e9a66;var _0x1b30c4;return db[_0x3584('0x49')][_0x3584('0x54')]({'where':{'id':_0xe3a24f[_0x3584('0x51')]['id']}})[_0x3584('0x1d')](handleEntityNotFound(_0x3ccc6d,null))[_0x3584('0x1d')](function(_0x3d82c6){if(_0x3d82c6){_0x3e9a66=_0x3d82c6;_0x4dc803[_0x3584('0x3d')]=_[_0x3584('0x3a')](db['FreshdeskField'][_0x3584('0x36')]);_0x4dc803[_0x3584('0x39')]=_[_0x3584('0x3a')](_0xe3a24f[_0x3584('0x39')]);_0x4dc803[_0x3584('0x3b')]=_['intersection'](_0x4dc803['model'],_0x4dc803[_0x3584('0x39')]);_0x59ced1[_0x3584('0x3f')]=_['intersection'](_0x4dc803['model'],qs[_0x3584('0x3e')](_0xe3a24f[_0x3584('0x39')][_0x3584('0x3e')]));_0x59ced1[_0x3584('0x3f')]=_0x59ced1[_0x3584('0x3f')]['length']?_0x59ced1['attributes']:_0x4dc803[_0x3584('0x3d')];_0x59ced1['order']=qs[_0x3584('0x43')](_0xe3a24f['query'][_0x3584('0x43')]);_0x59ced1['where']=qs[_0x3584('0x3b')](_[_0x3584('0x45')](_0xe3a24f[_0x3584('0x39')],_0x4dc803[_0x3584('0x3b')]));if(_0xe3a24f[_0x3584('0x39')]['filter']){_0x59ced1['where']=_[_0x3584('0x46')](_0x59ced1[_0x3584('0x44')],{'$or':_[_0x3584('0x35')](_0x59ced1[_0x3584('0x3f')],function(_0x45adb2){var _0x22d6a0={};_0x22d6a0[_0x45adb2]={'$like':'%'+_0xe3a24f[_0x3584('0x39')][_0x3584('0x47')]+'%'};return _0x22d6a0;})});}_0x59ced1=_[_0x3584('0x46')]({},_0x59ced1,_0xe3a24f[_0x3584('0x48')]);return _0x3e9a66[_0x3584('0x57')](_0x59ced1);}})[_0x3584('0x1d')](function(_0x19f538){if(_0x19f538){_0x1b30c4=_0x19f538[_0x3584('0x40')];if(!_0xe3a24f[_0x3584('0x39')][_0x3584('0x41')](_0x3584('0x42'))){_0x59ced1['limit']=qs[_0x3584('0x2b')](_0xe3a24f[_0x3584('0x39')][_0x3584('0x2b')]);_0x59ced1[_0x3584('0x2a')]=qs[_0x3584('0x2a')](_0xe3a24f['query'][_0x3584('0x2a')]);}return _0x3e9a66[_0x3584('0x57')](_0x59ced1);}})['then'](function(_0x526ab4){if(_0x526ab4){return _0x526ab4?{'count':_0x1b30c4,'rows':_0x526ab4}:null;}})['then'](respondWithResult(_0x3ccc6d,null))[_0x3584('0x27')](handleError(_0x3ccc6d,null));};exports[_0x3584('0x58')]=function(_0x2364f5,_0x13b52d,_0x516077){var _0x2f4bbd={};var _0x5afa61={};var _0x6479a9;var _0x21230c;return db[_0x3584('0x49')][_0x3584('0x54')]({'where':{'id':_0x2364f5['params']['id']}})['then'](handleEntityNotFound(_0x13b52d,null))[_0x3584('0x1d')](function(_0x552794){if(_0x552794){_0x6479a9=_0x552794;_0x5afa61[_0x3584('0x3d')]=_['keys'](db[_0x3584('0x55')][_0x3584('0x36')]);_0x5afa61[_0x3584('0x39')]=_[_0x3584('0x3a')](_0x2364f5[_0x3584('0x39')]);_0x5afa61[_0x3584('0x3b')]=_[_0x3584('0x3c')](_0x5afa61[_0x3584('0x3d')],_0x5afa61[_0x3584('0x39')]);_0x2f4bbd['attributes']=_[_0x3584('0x3c')](_0x5afa61['model'],qs[_0x3584('0x3e')](_0x2364f5[_0x3584('0x39')]['fields']));_0x2f4bbd[_0x3584('0x3f')]=_0x2f4bbd[_0x3584('0x3f')]['length']?_0x2f4bbd[_0x3584('0x3f')]:_0x5afa61[_0x3584('0x3d')];_0x2f4bbd[_0x3584('0x56')]=qs[_0x3584('0x43')](_0x2364f5['query'][_0x3584('0x43')]);_0x2f4bbd[_0x3584('0x44')]=qs[_0x3584('0x3b')](_[_0x3584('0x45')](_0x2364f5[_0x3584('0x39')],_0x5afa61['filters']));if(_0x2364f5[_0x3584('0x39')][_0x3584('0x47')]){_0x2f4bbd[_0x3584('0x44')]=_['merge'](_0x2f4bbd[_0x3584('0x44')],{'$or':_[_0x3584('0x35')](_0x2f4bbd['attributes'],function(_0x2d8368){var _0x1a117f={};_0x1a117f[_0x2d8368]={'$like':'%'+_0x2364f5[_0x3584('0x39')][_0x3584('0x47')]+'%'};return _0x1a117f;})});}_0x2f4bbd=_[_0x3584('0x46')]({},_0x2f4bbd,_0x2364f5[_0x3584('0x48')]);return _0x6479a9[_0x3584('0x58')](_0x2f4bbd);}})['then'](function(_0x4cad9b){if(_0x4cad9b){_0x21230c=_0x4cad9b[_0x3584('0x40')];if(!_0x2364f5[_0x3584('0x39')][_0x3584('0x41')](_0x3584('0x42'))){_0x2f4bbd[_0x3584('0x2b')]=qs[_0x3584('0x2b')](_0x2364f5[_0x3584('0x39')]['limit']);_0x2f4bbd[_0x3584('0x2a')]=qs['offset'](_0x2364f5[_0x3584('0x39')][_0x3584('0x2a')]);}return _0x6479a9[_0x3584('0x58')](_0x2f4bbd);}})[_0x3584('0x1d')](function(_0x1f0c71){if(_0x1f0c71){return _0x1f0c71?{'count':_0x21230c,'rows':_0x1f0c71}:null;}})['then'](respondWithResult(_0x13b52d,null))['catch'](handleError(_0x13b52d,null));};exports['getTags']=function(_0x1a1bc0,_0x447550,_0x3d0d60){var _0x4a6abb={};var _0x1a837b={};var _0x40640f;var _0x30bd35;return db[_0x3584('0x49')]['findOne']({'where':{'id':_0x1a1bc0[_0x3584('0x51')]['id']}})[_0x3584('0x1d')](handleEntityNotFound(_0x447550,null))['then'](function(_0x24b24e){if(_0x24b24e){_0x40640f=_0x24b24e;_0x1a837b[_0x3584('0x3d')]=_['keys'](db[_0x3584('0x59')]['rawAttributes']);_0x1a837b['query']=_[_0x3584('0x3a')](_0x1a1bc0['query']);_0x1a837b[_0x3584('0x3b')]=_[_0x3584('0x3c')](_0x1a837b['model'],_0x1a837b[_0x3584('0x39')]);_0x4a6abb[_0x3584('0x3f')]=_[_0x3584('0x3c')](_0x1a837b[_0x3584('0x3d')],qs['fields'](_0x1a1bc0['query']['fields']));_0x4a6abb[_0x3584('0x3f')]=_0x4a6abb[_0x3584('0x3f')][_0x3584('0x40')]?_0x4a6abb[_0x3584('0x3f')]:_0x1a837b['model'];_0x4a6abb['order']=qs['sort'](_0x1a1bc0[_0x3584('0x39')]['sort']);_0x4a6abb[_0x3584('0x44')]=qs['filters'](_[_0x3584('0x45')](_0x1a1bc0[_0x3584('0x39')],_0x1a837b['filters']));if(_0x1a1bc0[_0x3584('0x39')][_0x3584('0x47')]){_0x4a6abb['where']=_[_0x3584('0x46')](_0x4a6abb[_0x3584('0x44')],{'$or':_[_0x3584('0x35')](_0x4a6abb[_0x3584('0x3f')],function(_0x28edb7){var _0x34daee={};_0x34daee[_0x28edb7]={'$like':'%'+_0x1a1bc0[_0x3584('0x39')][_0x3584('0x47')]+'%'};return _0x34daee;})});}_0x4a6abb=_[_0x3584('0x46')]({},_0x4a6abb,_0x1a1bc0[_0x3584('0x48')]);return _0x40640f[_0x3584('0x5a')](_0x4a6abb);}})[_0x3584('0x1d')](function(_0x46141d){if(_0x46141d){_0x30bd35=_0x46141d[_0x3584('0x40')];if(!_0x1a1bc0[_0x3584('0x39')][_0x3584('0x41')]('nolimit')){_0x4a6abb[_0x3584('0x2b')]=qs['limit'](_0x1a1bc0[_0x3584('0x39')][_0x3584('0x2b')]);_0x4a6abb[_0x3584('0x2a')]=qs[_0x3584('0x2a')](_0x1a1bc0[_0x3584('0x39')]['offset']);}return _0x40640f[_0x3584('0x5a')](_0x4a6abb);}})[_0x3584('0x1d')](function(_0xb5c4fe){if(_0xb5c4fe){return _0xb5c4fe?{'count':_0x30bd35,'rows':_0xb5c4fe}:null;}})[_0x3584('0x1d')](respondWithResult(_0x447550,null))[_0x3584('0x27')](handleError(_0x447550,null));};exports[_0x3584('0x5b')]=function(_0x47d74d,_0x48a7e5,_0x316391){if(_0x47d74d[_0x3584('0x4f')]['id']){delete _0x47d74d[_0x3584('0x4f')]['id'];}return db[_0x3584('0x49')]['findOne']({'where':{'id':_0x47d74d[_0x3584('0x51')]['id']}})[_0x3584('0x1d')](handleEntityNotFound(_0x48a7e5,null))[_0x3584('0x1d')](function(_0x2cadc1){if(_0x2cadc1){return _0x2cadc1['setTags'](_0x47d74d[_0x3584('0x4f')][_0x3584('0x5c')]||[]);}return null;})['then'](respondWithResult(_0x48a7e5,null))['catch'](handleError(_0x48a7e5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 7b42791..b34e41a 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 _0x4fc3=['FreshdeskConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define'];(function(_0x477e24,_0x2b5fd9){var _0x5dc80d=function(_0x41b08f){while(--_0x41b08f){_0x477e24['push'](_0x477e24['shift']());}};_0x5dc80d(++_0x2b5fd9);}(_0x4fc3,0x1ae));var _0x34fc=function(_0xdadb2d,_0x47b3bd){_0xdadb2d=_0xdadb2d-0x0;var _0x4a94cd=_0x4fc3[_0xdadb2d];return _0x4a94cd;};'use strict';var _=require(_0x34fc('0x0'));var util=require(_0x34fc('0x1'));var logger=require(_0x34fc('0x2'))(_0x34fc('0x3'));var moment=require(_0x34fc('0x4'));var BPromise=require(_0x34fc('0x5'));var rp=require(_0x34fc('0x6'));var fs=require('fs');var path=require(_0x34fc('0x7'));var rimraf=require('rimraf');var config=require(_0x34fc('0x8'));var attributes=require(_0x34fc('0x9'));module[_0x34fc('0xa')]=function(_0x31a46c,_0x51da0a){return _0x31a46c[_0x34fc('0xb')](_0x34fc('0xc'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa21=['api','moment','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations','lodash','util','../../config/logger'];(function(_0x5bbb41,_0xf42812){var _0x524e08=function(_0x2639b2){while(--_0x2639b2){_0x5bbb41['push'](_0x5bbb41['shift']());}};_0x524e08(++_0xf42812);}(_0xaa21,0x129));var _0x1aa2=function(_0x598079,_0x1d0b08){_0x598079=_0x598079-0x0;var _0x1e79c8=_0xaa21[_0x598079];return _0x1e79c8;};'use strict';var _=require(_0x1aa2('0x0'));var util=require(_0x1aa2('0x1'));var logger=require(_0x1aa2('0x2'))(_0x1aa2('0x3'));var moment=require(_0x1aa2('0x4'));var BPromise=require('bluebird');var rp=require(_0x1aa2('0x5'));var fs=require('fs');var path=require(_0x1aa2('0x6'));var rimraf=require('rimraf');var config=require(_0x1aa2('0x7'));var attributes=require(_0x1aa2('0x8'));module[_0x1aa2('0x9')]=function(_0x2bb429,_0x50370f){return _0x2bb429[_0x1aa2('0xa')]('FreshdeskConfiguration',attributes,{'tableName':_0x1aa2('0xb'),'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 64844f8..7371d98 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 _0x79f4=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x590ef3,_0x3b2dd2){var _0x4502be=function(_0x2c8011){while(--_0x2c8011){_0x590ef3['push'](_0x590ef3['shift']());}};_0x4502be(++_0x3b2dd2);}(_0x79f4,0x1a5));var _0x479f=function(_0x22bccc,_0x3fe2ef){_0x22bccc=_0x22bccc-0x0;var _0xe93b30=_0x79f4[_0x22bccc];return _0xe93b30;};'use strict';var _=require(_0x479f('0x0'));var util=require(_0x479f('0x1'));var moment=require(_0x479f('0x2'));var BPromise=require(_0x479f('0x3'));var rs=require(_0x479f('0x4'));var fs=require('fs');var Redis=require(_0x479f('0x5'));var db=require(_0x479f('0x6'))['db'];var utils=require(_0x479f('0x7'));var logger=require('../../config/logger')(_0x479f('0x8'));var config=require('../../config/environment');var jayson=require(_0x479f('0x9'));var client=jayson[_0x479f('0xa')][_0x479f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36a07c,_0x5a52ac,_0x34fbed){return new BPromise(function(_0x5b3005,_0x332fbb){return client[_0x479f('0xc')](_0x36a07c,_0x34fbed)[_0x479f('0xd')](function(_0x7ed69b){logger[_0x479f('0xe')](_0x479f('0xf'),_0x5a52ac,_0x479f('0x10'));logger[_0x479f('0x11')](_0x479f('0x12'),_0x5a52ac,_0x479f('0x10'),JSON[_0x479f('0x13')](_0x7ed69b));if(_0x7ed69b[_0x479f('0x14')]){if(_0x7ed69b[_0x479f('0x14')][_0x479f('0x15')]===0x1f4){logger[_0x479f('0x14')](_0x479f('0xf'),_0x5a52ac,_0x7ed69b[_0x479f('0x14')][_0x479f('0x16')]);return _0x332fbb(_0x7ed69b[_0x479f('0x14')]['message']);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x5a52ac,_0x7ed69b[_0x479f('0x14')][_0x479f('0x16')]);return _0x5b3005(_0x7ed69b[_0x479f('0x14')][_0x479f('0x16')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x5a52ac,_0x479f('0x10'));_0x5b3005(_0x7ed69b[_0x479f('0x17')][_0x479f('0x16')]);}})[_0x479f('0x18')](function(_0x1c84d3){logger['error'](_0x479f('0xf'),_0x5a52ac,_0x1c84d3);_0x332fbb(_0x1c84d3);});});} \ No newline at end of file +var _0xe519=['request\x20sent','stringify','error','code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x2a5ae4,_0x1a36c5){var _0x24dbb7=function(_0x291651){while(--_0x291651){_0x2a5ae4['push'](_0x2a5ae4['shift']());}};_0x24dbb7(++_0x1a36c5);}(_0xe519,0xf9));var _0x9e51=function(_0x1f42e9,_0xf89f1){_0x1f42e9=_0x1f42e9-0x0;var _0x117b1a=_0xe519[_0x1f42e9];return _0x117b1a;};'use strict';var _=require(_0x9e51('0x0'));var util=require(_0x9e51('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9e51('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e51('0x3'))['db'];var utils=require(_0x9e51('0x4'));var logger=require(_0x9e51('0x5'))('rpc');var config=require(_0x9e51('0x6'));var jayson=require(_0x9e51('0x7'));var client=jayson[_0x9e51('0x8')][_0x9e51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c795d,_0x282069,_0x25cd60){return new BPromise(function(_0x226921,_0x1f8aab){return client[_0x9e51('0xa')](_0x4c795d,_0x25cd60)['then'](function(_0x23b25e){logger[_0x9e51('0xb')](_0x9e51('0xc'),_0x282069,'request\x20sent');logger[_0x9e51('0xd')](_0x9e51('0xe'),_0x282069,_0x9e51('0xf'),JSON[_0x9e51('0x10')](_0x23b25e));if(_0x23b25e[_0x9e51('0x11')]){if(_0x23b25e[_0x9e51('0x11')][_0x9e51('0x12')]===0x1f4){logger[_0x9e51('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x282069,_0x23b25e[_0x9e51('0x11')][_0x9e51('0x13')]);return _0x1f8aab(_0x23b25e[_0x9e51('0x11')][_0x9e51('0x13')]);}logger[_0x9e51('0x11')](_0x9e51('0xc'),_0x282069,_0x23b25e['error'][_0x9e51('0x13')]);return _0x226921(_0x23b25e['error'][_0x9e51('0x13')]);}else{logger[_0x9e51('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x282069,_0x9e51('0xf'));_0x226921(_0x23b25e[_0x9e51('0x14')][_0x9e51('0x13')]);}})[_0x9e51('0x15')](function(_0x12321e){logger[_0x9e51('0x11')](_0x9e51('0xc'),_0x282069,_0x12321e);_0x1f8aab(_0x12321e);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index b3b7660..672184a 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 _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x3773dd,_0x2d0048){var _0x212e34=function(_0x3bf8a5){while(--_0x3bf8a5){_0x3773dd['push'](_0x3773dd['shift']());}};_0x212e34(++_0x2d0048);}(_0x9c44,0x178));var _0x49c4=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9c44[_0x2d2c16];return _0x53f2fb;};'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('./intFreshdeskField.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['post']('/',auth[_0x49c4('0x9')](),controller[_0x49c4('0xb')]);router[_0x49c4('0xc')](_0x49c4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x49c4('0xd')](_0x49c4('0x8'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file +var _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x2b84d5,_0x428914){var _0x51452a=function(_0x3ddc9c){while(--_0x3ddc9c){_0x2b84d5['push'](_0x2b84d5['shift']());}};_0x51452a(++_0x428914);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'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('./intFreshdeskField.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['post']('/',auth[_0x49c4('0x9')](),controller[_0x49c4('0xb')]);router[_0x49c4('0xc')](_0x49c4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x49c4('0xd')](_0x49c4('0x8'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 72570f6..86fbb75 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 _0x7ee4=['keyValue','STRING','customVariable','BOOLEAN','sequelize','exports','string','variable'];(function(_0x2c0a91,_0x4acff8){var _0x244aba=function(_0x2b29dc){while(--_0x2b29dc){_0x2c0a91['push'](_0x2c0a91['shift']());}};_0x244aba(++_0x4acff8);}(_0x7ee4,0xbc));var _0x47ee=function(_0x485e5d,_0x5b6dfd){_0x485e5d=_0x485e5d-0x0;var _0xe47c92=_0x7ee4[_0x485e5d];return _0xe47c92;};'use strict';var Sequelize=require(_0x47ee('0x0'));module[_0x47ee('0x1')]={'type':{'type':Sequelize['ENUM'](_0x47ee('0x2'),_0x47ee('0x3'),'customVariable',_0x47ee('0x4')),'defaultValue':_0x47ee('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x47ee('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x47ee('0x2'),_0x47ee('0x3'),_0x47ee('0x6'))},'keyContent':{'type':Sequelize[_0x47ee('0x5')]},'idField':{'type':Sequelize[_0x47ee('0x5')]},'nameField':{'type':Sequelize[_0x47ee('0x5')]},'customField':{'type':Sequelize[_0x47ee('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x47ee('0x5')]}}; \ No newline at end of file +var _0x0a16=['ENUM','string','variable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x2a26e1,_0x5cb4d6){var _0x4534c2=function(_0x1edacd){while(--_0x1edacd){_0x2a26e1['push'](_0x2a26e1['shift']());}};_0x4534c2(++_0x5cb4d6);}(_0x0a16,0x10e));var _0x60a1=function(_0x111a45,_0x2b9385){_0x111a45=_0x111a45-0x0;var _0x10e6cd=_0x0a16[_0x111a45];return _0x10e6cd;};'use strict';var Sequelize=require(_0x60a1('0x0'));module[_0x60a1('0x1')]={'type':{'type':Sequelize[_0x60a1('0x2')](_0x60a1('0x3'),_0x60a1('0x4'),'customVariable',_0x60a1('0x5')),'defaultValue':_0x60a1('0x3')},'content':{'type':Sequelize[_0x60a1('0x6')]},'key':{'type':Sequelize[_0x60a1('0x6')]},'keyType':{'type':Sequelize[_0x60a1('0x2')](_0x60a1('0x3'),_0x60a1('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x60a1('0x6')]},'nameField':{'type':Sequelize[_0x60a1('0x6')]},'customField':{'type':Sequelize[_0x60a1('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x60a1('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index ecfe9d8..58d98da 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 _0x107e=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','index','map','FreshdeskField','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','fields','length','find','catch','create','body','update','html-pdf','eml-format','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','jsforce','desk.js'];(function(_0x46297d,_0x19d37a){var _0x19c21e=function(_0xda1922){while(--_0xda1922){_0x46297d['push'](_0x46297d['shift']());}};_0x19c21e(++_0x19d37a);}(_0x107e,0x11c));var _0xe107=function(_0x212c6a,_0x38b301){_0x212c6a=_0x212c6a-0x0;var _0x421a05=_0x107e[_0x212c6a];return _0x421a05;};'use strict';var pdf=require(_0xe107('0x0'));var emlformat=require(_0xe107('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe107('0x2'));var moment=require(_0xe107('0x3'));var BPromise=require(_0xe107('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe107('0x5'));var sox=require(_0xe107('0x6'));var csv=require(_0xe107('0x7'));var ejs=require(_0xe107('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe107('0x9'));var crypto=require('crypto');var jsforce=require(_0xe107('0xa'));var deskjs=require(_0xe107('0xb'));var toCsv=require('to-csv');var querystring=require(_0xe107('0xc'));var Papa=require(_0xe107('0xd'));var Redis=require(_0xe107('0xe'));var authService=require(_0xe107('0xf'));var qs=require(_0xe107('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe107('0x11'));var logger=require(_0xe107('0x12'))('api');var utils=require(_0xe107('0x13'));var config=require(_0xe107('0x14'));var db=require(_0xe107('0x15'))['db'];function respondWithStatusCode(_0x2fbb6a,_0x4254dd){_0x4254dd=_0x4254dd||0xcc;return function(_0x12ddcd){if(_0x12ddcd){return _0x2fbb6a[_0xe107('0x16')](_0x4254dd);}return _0x2fbb6a[_0xe107('0x17')](_0x4254dd)[_0xe107('0x18')]();};}function respondWithResult(_0x30bd93,_0x57ae5d){_0x57ae5d=_0x57ae5d||0xc8;return function(_0x5f3211){if(_0x5f3211){return _0x30bd93[_0xe107('0x17')](_0x57ae5d)['json'](_0x5f3211);}};}function respondWithFilteredResult(_0x50c8d0,_0x13180e){return function(_0x412216){if(_0x412216){var _0x2f5848=_0x412216[_0xe107('0x19')],_0xd6636e=_0x13180e[_0xe107('0x1a')],_0x13ad38=_0x13180e['offset']+_0x13180e['limit'],_0x5ea21f;if(_0x13ad38>=_0x2f5848){_0x13ad38=_0x2f5848;_0x5ea21f=0xc8;}else{_0x5ea21f=0xce;}_0x50c8d0[_0xe107('0x17')](_0x5ea21f);return _0x50c8d0[_0xe107('0x1b')](_0xe107('0x1c'),_0xd6636e+'-'+_0x13ad38+'/'+_0x2f5848)[_0xe107('0x1d')](_0x412216);}return null;};}function patchUpdates(_0x55fcb7){return function(_0x18d61f){try{jsonpatch[_0xe107('0x1e')](_0x18d61f,_0x55fcb7,!![]);}catch(_0x40a0a2){return BPromise[_0xe107('0x1f')](_0x40a0a2);}return _0x18d61f[_0xe107('0x20')]();};}function saveUpdates(_0x3d7103,_0x2c8e5e){return function(_0x12e859){if(_0x12e859){return _0x12e859['update'](_0x3d7103)[_0xe107('0x21')](function(_0x318ec9){return _0x318ec9;});}return null;};}function removeEntity(_0x35f339,_0x22f5b3){return function(_0xf2198e){if(_0xf2198e){return _0xf2198e[_0xe107('0x22')]()[_0xe107('0x21')](function(){_0x35f339[_0xe107('0x17')](0xcc)[_0xe107('0x18')]();});}};}function handleEntityNotFound(_0xb57673,_0x151c34){return function(_0x4d5b44){if(!_0x4d5b44){_0xb57673[_0xe107('0x16')](0x194);}return _0x4d5b44;};}function handleError(_0x38594a,_0x5730aa){_0x5730aa=_0x5730aa||0x1f4;return function(_0x251246){logger[_0xe107('0x23')](_0x251246[_0xe107('0x24')]);if(_0x251246[_0xe107('0x25')]){delete _0x251246[_0xe107('0x25')];}_0x38594a[_0xe107('0x17')](_0x5730aa)['send'](_0x251246);};}exports[_0xe107('0x26')]=function(_0x5b4300,_0x1bdffb){var _0x4085fc={},_0x50ccce={},_0x23d53c={'count':0x0,'rows':[]};var _0x57b17e=_[_0xe107('0x27')](db[_0xe107('0x28')][_0xe107('0x29')],function(_0x19079d){return{'name':_0x19079d[_0xe107('0x2a')],'type':_0x19079d[_0xe107('0x2b')][_0xe107('0x2c')]};});_0x50ccce['model']=_[_0xe107('0x27')](_0x57b17e,_0xe107('0x25'));_0x50ccce['query']=_['keys'](_0x5b4300[_0xe107('0x2d')]);_0x50ccce[_0xe107('0x2e')]=_[_0xe107('0x2f')](_0x50ccce[_0xe107('0x30')],_0x50ccce[_0xe107('0x2d')]);_0x4085fc[_0xe107('0x31')]=_[_0xe107('0x2f')](_0x50ccce[_0xe107('0x30')],qs['fields'](_0x5b4300['query']['fields']));_0x4085fc[_0xe107('0x31')]=_0x4085fc[_0xe107('0x31')]['length']?_0x4085fc['attributes']:_0x50ccce[_0xe107('0x30')];if(!_0x5b4300['query'][_0xe107('0x32')](_0xe107('0x33'))){_0x4085fc[_0xe107('0x34')]=qs['limit'](_0x5b4300[_0xe107('0x2d')]['limit']);_0x4085fc[_0xe107('0x1a')]=qs['offset'](_0x5b4300['query'][_0xe107('0x1a')]);}_0x4085fc['order']=qs[_0xe107('0x35')](_0x5b4300[_0xe107('0x2d')][_0xe107('0x35')]);_0x4085fc[_0xe107('0x36')]=qs[_0xe107('0x2e')](_[_0xe107('0x37')](_0x5b4300[_0xe107('0x2d')],_0x50ccce[_0xe107('0x2e')]));if(_0x5b4300[_0xe107('0x2d')]['filter']){_0x4085fc['where']=_[_0xe107('0x38')](_0x4085fc[_0xe107('0x36')],{'$or':_['map'](_0x57b17e,function(_0x407e12){if(_0x407e12[_0xe107('0x2b')]!==_0xe107('0x39')){var _0x46df53={};_0x46df53[_0x407e12[_0xe107('0x25')]]={'$like':'%'+_0x5b4300['query'][_0xe107('0x3a')]+'%'};return _0x46df53;}})});}_0x4085fc=_['merge']({},_0x4085fc,_0x5b4300[_0xe107('0x3b')]);var _0x2c39f7={'where':_0x4085fc[_0xe107('0x36')]};return db[_0xe107('0x28')][_0xe107('0x19')](_0x2c39f7)['then'](function(_0x58f1d3){_0x23d53c[_0xe107('0x19')]=_0x58f1d3;if(_0x5b4300[_0xe107('0x2d')][_0xe107('0x3c')]){_0x4085fc[_0xe107('0x3d')]=[{'all':!![]}];}return db[_0xe107('0x28')][_0xe107('0x3e')](_0x4085fc);})['then'](function(_0x455a27){_0x23d53c[_0xe107('0x3f')]=_0x455a27;return _0x23d53c;})[_0xe107('0x21')](respondWithFilteredResult(_0x1bdffb,_0x4085fc))['catch'](handleError(_0x1bdffb,null));};exports[_0xe107('0x40')]=function(_0x5a4834,_0xa8541f){var _0x190c47={'raw':!![],'where':{'id':_0x5a4834[_0xe107('0x41')]['id']}},_0x4b80fe={};_0x4b80fe['model']=_[_0xe107('0x42')](db[_0xe107('0x28')][_0xe107('0x29')]);_0x4b80fe[_0xe107('0x2d')]=_[_0xe107('0x42')](_0x5a4834[_0xe107('0x2d')]);_0x4b80fe[_0xe107('0x2e')]=_[_0xe107('0x2f')](_0x4b80fe[_0xe107('0x30')],_0x4b80fe[_0xe107('0x2d')]);_0x190c47[_0xe107('0x31')]=_[_0xe107('0x2f')](_0x4b80fe['model'],qs['fields'](_0x5a4834[_0xe107('0x2d')][_0xe107('0x43')]));_0x190c47[_0xe107('0x31')]=_0x190c47[_0xe107('0x31')][_0xe107('0x44')]?_0x190c47[_0xe107('0x31')]:_0x4b80fe['model'];if(_0x5a4834[_0xe107('0x2d')]['includeAll']){_0x190c47['include']=[{'all':!![]}];}_0x190c47=_[_0xe107('0x38')]({},_0x190c47,_0x5a4834['options']);return db[_0xe107('0x28')][_0xe107('0x45')](_0x190c47)[_0xe107('0x21')](handleEntityNotFound(_0xa8541f,null))[_0xe107('0x21')](respondWithResult(_0xa8541f,null))[_0xe107('0x46')](handleError(_0xa8541f,null));};exports[_0xe107('0x47')]=function(_0x5a225d,_0x5e3c09){return db['FreshdeskField'][_0xe107('0x47')](_0x5a225d[_0xe107('0x48')],{})[_0xe107('0x21')](respondWithResult(_0x5e3c09,0xc9))[_0xe107('0x46')](handleError(_0x5e3c09,null));};exports[_0xe107('0x49')]=function(_0x59be45,_0x37d15b){if(_0x59be45[_0xe107('0x48')]['id']){delete _0x59be45[_0xe107('0x48')]['id'];}return db[_0xe107('0x28')][_0xe107('0x45')]({'where':{'id':_0x59be45[_0xe107('0x41')]['id']}})[_0xe107('0x21')](handleEntityNotFound(_0x37d15b,null))['then'](saveUpdates(_0x59be45['body'],null))['then'](respondWithResult(_0x37d15b,null))[_0xe107('0x46')](handleError(_0x37d15b,null));};exports[_0xe107('0x22')]=function(_0x2d245c,_0x55f8c0){return db[_0xe107('0x28')]['find']({'where':{'id':_0x2d245c[_0xe107('0x41')]['id']}})[_0xe107('0x21')](handleEntityNotFound(_0x55f8c0,null))[_0xe107('0x21')](removeEntity(_0x55f8c0,null))[_0xe107('0x46')](handleError(_0x55f8c0,null));}; \ No newline at end of file +var _0x6f55=['where','pick','filter','merge','VIRTUAL','options','FreshdeskField','includeAll','include','findAll','catch','show','params','keys','rawAttributes','create','body','find','html-pdf','eml-format','rimraf','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort'];(function(_0x25b548,_0x41d522){var _0x6794d2=function(_0x21ed24){while(--_0x21ed24){_0x25b548['push'](_0x25b548['shift']());}};_0x6794d2(++_0x41d522);}(_0x6f55,0x18e));var _0x56f5=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x6f55[_0xe66cf2];return _0x2d84e7;};'use strict';var pdf=require(_0x56f5('0x0'));var emlformat=require(_0x56f5('0x1'));var rimraf=require(_0x56f5('0x2'));var zipdir=require(_0x56f5('0x3'));var jsonpatch=require(_0x56f5('0x4'));var rp=require(_0x56f5('0x5'));var moment=require(_0x56f5('0x6'));var BPromise=require(_0x56f5('0x7'));var Mustache=require(_0x56f5('0x8'));var util=require(_0x56f5('0x9'));var path=require(_0x56f5('0xa'));var sox=require(_0x56f5('0xb'));var csv=require(_0x56f5('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x56f5('0xd'));var squel=require(_0x56f5('0xe'));var crypto=require(_0x56f5('0xf'));var jsforce=require(_0x56f5('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x56f5('0xc'));var querystring=require('querystring');var Papa=require(_0x56f5('0x11'));var Redis=require(_0x56f5('0x12'));var authService=require(_0x56f5('0x13'));var qs=require(_0x56f5('0x14'));var as=require(_0x56f5('0x15'));var hardwareService=require(_0x56f5('0x16'));var logger=require(_0x56f5('0x17'))(_0x56f5('0x18'));var utils=require(_0x56f5('0x19'));var config=require(_0x56f5('0x1a'));var db=require(_0x56f5('0x1b'))['db'];function respondWithStatusCode(_0x433ac4,_0x5005da){_0x5005da=_0x5005da||0xcc;return function(_0x12856c){if(_0x12856c){return _0x433ac4['sendStatus'](_0x5005da);}return _0x433ac4[_0x56f5('0x1c')](_0x5005da)[_0x56f5('0x1d')]();};}function respondWithResult(_0x5a3962,_0x4d7d3c){_0x4d7d3c=_0x4d7d3c||0xc8;return function(_0x36316a){if(_0x36316a){return _0x5a3962['status'](_0x4d7d3c)['json'](_0x36316a);}};}function respondWithFilteredResult(_0x385c82,_0x3fa768){return function(_0x503851){if(_0x503851){var _0x5e3a3f=_0x503851[_0x56f5('0x1e')],_0x2b8394=_0x3fa768['offset'],_0x3e5114=_0x3fa768[_0x56f5('0x1f')]+_0x3fa768['limit'],_0x1ba6f7;if(_0x3e5114>=_0x5e3a3f){_0x3e5114=_0x5e3a3f;_0x1ba6f7=0xc8;}else{_0x1ba6f7=0xce;}_0x385c82[_0x56f5('0x1c')](_0x1ba6f7);return _0x385c82[_0x56f5('0x20')](_0x56f5('0x21'),_0x2b8394+'-'+_0x3e5114+'/'+_0x5e3a3f)[_0x56f5('0x22')](_0x503851);}return null;};}function patchUpdates(_0x3a6291){return function(_0x4d1d13){try{jsonpatch[_0x56f5('0x23')](_0x4d1d13,_0x3a6291,!![]);}catch(_0x3ddb2){return BPromise['reject'](_0x3ddb2);}return _0x4d1d13[_0x56f5('0x24')]();};}function saveUpdates(_0x4b8636,_0x5692d4){return function(_0x1391bb){if(_0x1391bb){return _0x1391bb[_0x56f5('0x25')](_0x4b8636)[_0x56f5('0x26')](function(_0x24ea2c){return _0x24ea2c;});}return null;};}function removeEntity(_0xed66fe,_0x28322f){return function(_0x2abeb1){if(_0x2abeb1){return _0x2abeb1[_0x56f5('0x27')]()[_0x56f5('0x26')](function(){_0xed66fe[_0x56f5('0x1c')](0xcc)[_0x56f5('0x1d')]();});}};}function handleEntityNotFound(_0x512f45,_0x4478a5){return function(_0xbdb1fa){if(!_0xbdb1fa){_0x512f45[_0x56f5('0x28')](0x194);}return _0xbdb1fa;};}function handleError(_0x33081e,_0x313d2e){_0x313d2e=_0x313d2e||0x1f4;return function(_0x51c11f){logger[_0x56f5('0x29')](_0x51c11f[_0x56f5('0x2a')]);if(_0x51c11f[_0x56f5('0x2b')]){delete _0x51c11f[_0x56f5('0x2b')];}_0x33081e[_0x56f5('0x1c')](_0x313d2e)[_0x56f5('0x2c')](_0x51c11f);};}exports[_0x56f5('0x2d')]=function(_0x509d05,_0x45748e){var _0x43674a={},_0x309b68={},_0xf75703={'count':0x0,'rows':[]};var _0x422655=_[_0x56f5('0x2e')](db['FreshdeskField']['rawAttributes'],function(_0x3f9e93){return{'name':_0x3f9e93['fieldName'],'type':_0x3f9e93[_0x56f5('0x2f')]['key']};});_0x309b68[_0x56f5('0x30')]=_[_0x56f5('0x2e')](_0x422655,'name');_0x309b68['query']=_['keys'](_0x509d05[_0x56f5('0x31')]);_0x309b68[_0x56f5('0x32')]=_[_0x56f5('0x33')](_0x309b68[_0x56f5('0x30')],_0x309b68[_0x56f5('0x31')]);_0x43674a[_0x56f5('0x34')]=_[_0x56f5('0x33')](_0x309b68[_0x56f5('0x30')],qs[_0x56f5('0x35')](_0x509d05[_0x56f5('0x31')][_0x56f5('0x35')]));_0x43674a['attributes']=_0x43674a[_0x56f5('0x34')]['length']?_0x43674a[_0x56f5('0x34')]:_0x309b68[_0x56f5('0x30')];if(!_0x509d05[_0x56f5('0x31')][_0x56f5('0x36')](_0x56f5('0x37'))){_0x43674a[_0x56f5('0x38')]=qs['limit'](_0x509d05['query'][_0x56f5('0x38')]);_0x43674a[_0x56f5('0x1f')]=qs[_0x56f5('0x1f')](_0x509d05[_0x56f5('0x31')][_0x56f5('0x1f')]);}_0x43674a['order']=qs[_0x56f5('0x39')](_0x509d05[_0x56f5('0x31')][_0x56f5('0x39')]);_0x43674a[_0x56f5('0x3a')]=qs[_0x56f5('0x32')](_[_0x56f5('0x3b')](_0x509d05[_0x56f5('0x31')],_0x309b68['filters']));if(_0x509d05[_0x56f5('0x31')][_0x56f5('0x3c')]){_0x43674a['where']=_[_0x56f5('0x3d')](_0x43674a[_0x56f5('0x3a')],{'$or':_[_0x56f5('0x2e')](_0x422655,function(_0x2716c2){if(_0x2716c2[_0x56f5('0x2f')]!==_0x56f5('0x3e')){var _0x179936={};_0x179936[_0x2716c2['name']]={'$like':'%'+_0x509d05['query'][_0x56f5('0x3c')]+'%'};return _0x179936;}})});}_0x43674a=_[_0x56f5('0x3d')]({},_0x43674a,_0x509d05[_0x56f5('0x3f')]);var _0x3d9792={'where':_0x43674a[_0x56f5('0x3a')]};return db[_0x56f5('0x40')][_0x56f5('0x1e')](_0x3d9792)[_0x56f5('0x26')](function(_0x5cf125){_0xf75703[_0x56f5('0x1e')]=_0x5cf125;if(_0x509d05[_0x56f5('0x31')][_0x56f5('0x41')]){_0x43674a[_0x56f5('0x42')]=[{'all':!![]}];}return db[_0x56f5('0x40')][_0x56f5('0x43')](_0x43674a);})[_0x56f5('0x26')](function(_0x5c615c){_0xf75703['rows']=_0x5c615c;return _0xf75703;})[_0x56f5('0x26')](respondWithFilteredResult(_0x45748e,_0x43674a))[_0x56f5('0x44')](handleError(_0x45748e,null));};exports[_0x56f5('0x45')]=function(_0x2d1e3f,_0x110e95){var _0x3f86ef={'raw':!![],'where':{'id':_0x2d1e3f[_0x56f5('0x46')]['id']}},_0x6722fb={};_0x6722fb['model']=_[_0x56f5('0x47')](db['FreshdeskField'][_0x56f5('0x48')]);_0x6722fb['query']=_[_0x56f5('0x47')](_0x2d1e3f[_0x56f5('0x31')]);_0x6722fb['filters']=_['intersection'](_0x6722fb['model'],_0x6722fb[_0x56f5('0x31')]);_0x3f86ef['attributes']=_['intersection'](_0x6722fb['model'],qs[_0x56f5('0x35')](_0x2d1e3f[_0x56f5('0x31')]['fields']));_0x3f86ef[_0x56f5('0x34')]=_0x3f86ef['attributes']['length']?_0x3f86ef[_0x56f5('0x34')]:_0x6722fb[_0x56f5('0x30')];if(_0x2d1e3f['query'][_0x56f5('0x41')]){_0x3f86ef[_0x56f5('0x42')]=[{'all':!![]}];}_0x3f86ef=_[_0x56f5('0x3d')]({},_0x3f86ef,_0x2d1e3f[_0x56f5('0x3f')]);return db[_0x56f5('0x40')]['find'](_0x3f86ef)[_0x56f5('0x26')](handleEntityNotFound(_0x110e95,null))['then'](respondWithResult(_0x110e95,null))[_0x56f5('0x44')](handleError(_0x110e95,null));};exports[_0x56f5('0x49')]=function(_0x3c01be,_0x1e9bf4){return db[_0x56f5('0x40')][_0x56f5('0x49')](_0x3c01be[_0x56f5('0x4a')],{})[_0x56f5('0x26')](respondWithResult(_0x1e9bf4,0xc9))[_0x56f5('0x44')](handleError(_0x1e9bf4,null));};exports[_0x56f5('0x25')]=function(_0x30d143,_0x36e84f){if(_0x30d143[_0x56f5('0x4a')]['id']){delete _0x30d143[_0x56f5('0x4a')]['id'];}return db['FreshdeskField'][_0x56f5('0x4b')]({'where':{'id':_0x30d143[_0x56f5('0x46')]['id']}})[_0x56f5('0x26')](handleEntityNotFound(_0x36e84f,null))[_0x56f5('0x26')](saveUpdates(_0x30d143['body'],null))[_0x56f5('0x26')](respondWithResult(_0x36e84f,null))[_0x56f5('0x44')](handleError(_0x36e84f,null));};exports['destroy']=function(_0x16a816,_0x4be2ce){return db[_0x56f5('0x40')]['find']({'where':{'id':_0x16a816['params']['id']}})[_0x56f5('0x26')](handleEntityNotFound(_0x4be2ce,null))['then'](removeEntity(_0x4be2ce,null))[_0x56f5('0x44')](handleError(_0x4be2ce,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 754ddc9..e0ef9ab 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 _0x038f=['idField','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x2a2086,_0x1d25c0){var _0x3f96e8=function(_0x1175c5){while(--_0x1175c5){_0x2a2086['push'](_0x2a2086['shift']());}};_0x3f96e8(++_0x1d25c0);}(_0x038f,0xe2));var _0xf038=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0x038f[_0x368e09];return _0x14b7df;};'use strict';var _=require(_0xf038('0x0'));var util=require(_0xf038('0x1'));var logger=require(_0xf038('0x2'))(_0xf038('0x3'));var moment=require(_0xf038('0x4'));var BPromise=require('bluebird');var rp=require(_0xf038('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf038('0x6'));var config=require(_0xf038('0x7'));var attributes=require(_0xf038('0x8'));module[_0xf038('0x9')]=function(_0x3e29f8,_0x18da9f){return _0x3e29f8[_0xf038('0xa')](_0xf038('0xb'),attributes,{'tableName':_0xf038('0xc'),'paranoid':![],'indexes':[{'name':_0xf038('0xd'),'fields':[_0xf038('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xceda=['FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField'];(function(_0xdf5462,_0x66522a){var _0x12bcb0=function(_0x467132){while(--_0x467132){_0xdf5462['push'](_0xdf5462['shift']());}};_0x12bcb0(++_0x66522a);}(_0xceda,0x79));var _0xaced=function(_0x90fc91,_0x37a194){_0x90fc91=_0x90fc91-0x0;var _0x261289=_0xceda[_0x90fc91];return _0x261289;};'use strict';var _=require(_0xaced('0x0'));var util=require(_0xaced('0x1'));var logger=require(_0xaced('0x2'))(_0xaced('0x3'));var moment=require('moment');var BPromise=require(_0xaced('0x4'));var rp=require(_0xaced('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaced('0x6'));var config=require(_0xaced('0x7'));var attributes=require(_0xaced('0x8'));module['exports']=function(_0x2cb86e,_0x28ceef){return _0x2cb86e[_0xaced('0x9')](_0xaced('0xa'),attributes,{'tableName':_0xaced('0xb'),'paranoid':![],'indexes':[{'name':_0xaced('0xc'),'fields':[_0xaced('0xd'),_0xaced('0xe')],'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 0ff735a..88236c8 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x10ada3,_0x278530){_0x10ada3=_0x10ada3-0x0;var _0x425b64=_0x7a54[_0x10ada3];return _0x425b64;};'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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x34e7f3,_0x5e3a08){_0x34e7f3=_0x34e7f3-0x0;var _0x34605a=_0x7a54[_0x34e7f3];return _0x34605a;};'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 858cc64..3268d43 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 _0x21a0=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x4b29dd,_0x576946){var _0x5b0b77=function(_0x5d3f8b){while(--_0x5d3f8b){_0x4b29dd['push'](_0x4b29dd['shift']());}};_0x5b0b77(++_0x576946);}(_0x21a0,0xc2));var _0x021a=function(_0x307561,_0x104bb2){_0x307561=_0x307561-0x0;var _0x4dc00e=_0x21a0[_0x307561];return _0x4dc00e;};'use strict';var multer=require('multer');var util=require(_0x021a('0x0'));var path=require('path');var timeout=require(_0x021a('0x1'));var express=require(_0x021a('0x2'));var router=express[_0x021a('0x3')]();var auth=require(_0x021a('0x4'));var interaction=require(_0x021a('0x5'));var config=require(_0x021a('0x6'));var controller=require('./intFreshsalesAccount.controller');router[_0x021a('0x7')]('/',auth[_0x021a('0x8')](),controller['index']);router['get'](_0x021a('0x9'),auth['isAuthenticated'](),controller[_0x021a('0xa')]);router[_0x021a('0x7')](_0x021a('0xb'),auth[_0x021a('0x8')](),controller[_0x021a('0xc')]);router['get']('/:id/fields',auth[_0x021a('0x8')](),controller[_0x021a('0xd')]);router[_0x021a('0xe')]('/',auth[_0x021a('0x8')](),controller[_0x021a('0xf')]);router[_0x021a('0xe')](_0x021a('0xb'),auth[_0x021a('0x8')](),controller[_0x021a('0x10')]);router[_0x021a('0x11')]('/:id',auth[_0x021a('0x8')](),controller[_0x021a('0x12')]);router[_0x021a('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x021a('0x14')]);module[_0x021a('0x15')]=router; \ No newline at end of file +var _0x6c72=['put','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration'];(function(_0x34bd7b,_0x509f50){var _0x26b182=function(_0x5282ec){while(--_0x5282ec){_0x34bd7b['push'](_0x34bd7b['shift']());}};_0x26b182(++_0x509f50);}(_0x6c72,0xf3));var _0x26c7=function(_0x513868,_0x2c8610){_0x513868=_0x513868-0x0;var _0x8c6bde=_0x6c72[_0x513868];return _0x8c6bde;};'use strict';var multer=require(_0x26c7('0x0'));var util=require('util');var path=require(_0x26c7('0x1'));var timeout=require(_0x26c7('0x2'));var express=require('express');var router=express[_0x26c7('0x3')]();var auth=require(_0x26c7('0x4'));var interaction=require(_0x26c7('0x5'));var config=require('../../config/environment');var controller=require('./intFreshsalesAccount.controller');router['get']('/',auth[_0x26c7('0x6')](),controller[_0x26c7('0x7')]);router[_0x26c7('0x8')](_0x26c7('0x9'),auth[_0x26c7('0x6')](),controller[_0x26c7('0xa')]);router[_0x26c7('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x26c7('0xb')]);router['get']('/:id/fields',auth[_0x26c7('0x6')](),controller[_0x26c7('0xc')]);router[_0x26c7('0xd')]('/',auth['isAuthenticated'](),controller[_0x26c7('0xe')]);router[_0x26c7('0xd')](_0x26c7('0xf'),auth[_0x26c7('0x6')](),controller[_0x26c7('0x10')]);router[_0x26c7('0x11')](_0x26c7('0x9'),auth[_0x26c7('0x6')](),controller['update']);router[_0x26c7('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x26c7('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 5093d73..9c4c888 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 _0x88c3=['username','remoteUri','sequelize','STRING'];(function(_0x2d8d29,_0x1c0a50){var _0x263cf7=function(_0x18d4c3){while(--_0x18d4c3){_0x2d8d29['push'](_0x2d8d29['shift']());}};_0x263cf7(++_0x1c0a50);}(_0x88c3,0x1ee));var _0x388c=function(_0x34533c,_0x3ee1dd){_0x34533c=_0x34533c-0x0;var _0xa4837c=_0x88c3[_0x34533c];return _0xa4837c;};'use strict';var Sequelize=require(_0x388c('0x0'));module['exports']={'name':{'type':Sequelize[_0x388c('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x388c('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x388c('0x3')},'serverUrl':{'type':Sequelize[_0x388c('0x1')]}}; \ No newline at end of file +var _0x19e1=['STRING','sequelize','exports'];(function(_0x4cf4b0,_0xc317d6){var _0x20b358=function(_0x54b9c5){while(--_0x54b9c5){_0x4cf4b0['push'](_0x4cf4b0['shift']());}};_0x20b358(++_0xc317d6);}(_0x19e1,0x163));var _0x119e=function(_0x2e4cbf,_0x8763d3){_0x2e4cbf=_0x2e4cbf-0x0;var _0x52840f=_0x19e1[_0x2e4cbf];return _0x52840f;};'use strict';var Sequelize=require(_0x119e('0x0'));module[_0x119e('0x1')]={'name':{'type':Sequelize[_0x119e('0x2')]},'description':{'type':Sequelize[_0x119e('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize[_0x119e('0x2')]},'remoteUri':{'type':Sequelize[_0x119e('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x119e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 4fb0222..8f745bd 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 _0xeb8a=['attributes','hasOwnProperty','nolimit','limit','offset','sort','pick','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','rows','show','params','keys','rawAttributes','length','options','find','create','body','update','getConfigurations','findOne','FreshsalesConfiguration','order','addConfiguration','AccountId','channel','Descriptions','FreshsalesField','Subjects','remoteUri','apiKey','username','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','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','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','sendStatus','status','end','json','set','reject','save','then','destroy','stack','name','send','index','FreshsalesAccount','fieldName','type','key','query','filters','intersection','model','fields'];(function(_0x5b67f3,_0x99490f){var _0x153df8=function(_0x23e934){while(--_0x23e934){_0x5b67f3['push'](_0x5b67f3['shift']());}};_0x153df8(++_0x99490f);}(_0xeb8a,0x18d));var _0xaeb8=function(_0x1ea245,_0x210c0b){_0x1ea245=_0x1ea245-0x0;var _0x3aefa1=_0xeb8a[_0x1ea245];return _0x3aefa1;};'use strict';var pdf=require(_0xaeb8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xaeb8('0x1'));var zipdir=require(_0xaeb8('0x2'));var jsonpatch=require(_0xaeb8('0x3'));var rp=require('request-promise');var moment=require(_0xaeb8('0x4'));var BPromise=require(_0xaeb8('0x5'));var Mustache=require('mustache');var util=require(_0xaeb8('0x6'));var path=require(_0xaeb8('0x7'));var sox=require(_0xaeb8('0x8'));var csv=require(_0xaeb8('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xaeb8('0xa'));var squel=require(_0xaeb8('0xb'));var crypto=require(_0xaeb8('0xc'));var jsforce=require(_0xaeb8('0xd'));var deskjs=require(_0xaeb8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xaeb8('0xf'));var Papa=require(_0xaeb8('0x10'));var Redis=require(_0xaeb8('0x11'));var authService=require(_0xaeb8('0x12'));var qs=require(_0xaeb8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaeb8('0x14'));var logger=require(_0xaeb8('0x15'))(_0xaeb8('0x16'));var utils=require(_0xaeb8('0x17'));var config=require(_0xaeb8('0x18'));var db=require(_0xaeb8('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client'][_0xaeb8('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x54458e,_0x421969,_0x52d30c){if(_0x52d30c){var _0x5a9577=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5a9577[_0xaeb8('0x1b')](_0x421969)){return _0x54458e;}else{throw new db[(_0xaeb8('0x1c'))][(_0xaeb8('0x1d'))](_0xaeb8('0x1e'));}}else{return _0x54458e;}}function respondWithRpcPromise(_0x415869,_0x1dae13,_0x7362cd,_0x12b869){return new BPromise(function(_0x230155,_0x1f95e0){var _0x5bf1cd=_0x12b869||client;return _0x5bf1cd[_0xaeb8('0x1f')](_0x415869,_0x7362cd)['then'](function(_0x56c368){logger[_0xaeb8('0x20')](_0xaeb8('0x21'),_0x1dae13,_0xaeb8('0x22'));logger[_0xaeb8('0x23')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x1dae13,'request\x20sent',JSON[_0xaeb8('0x24')](_0x56c368));if(_0x56c368['error']){if(_0x56c368['error'][_0xaeb8('0x25')]===0x1f4){logger[_0xaeb8('0x26')](_0xaeb8('0x21'),_0x1dae13,_0x56c368[_0xaeb8('0x26')][_0xaeb8('0x27')]);return _0x1f95e0(_0x56c368[_0xaeb8('0x26')][_0xaeb8('0x27')]);}logger[_0xaeb8('0x26')](_0xaeb8('0x21'),_0x1dae13,_0x56c368[_0xaeb8('0x26')][_0xaeb8('0x27')]);return _0x230155(_0x56c368[_0xaeb8('0x26')][_0xaeb8('0x27')]);}else{logger[_0xaeb8('0x20')]('FreshsalesAccount,\x20%s,\x20%s',_0x1dae13,_0xaeb8('0x22'));_0x230155(_0x56c368['result']['message']);}})[_0xaeb8('0x28')](function(_0xee1102){logger[_0xaeb8('0x26')](_0xaeb8('0x21'),_0x1dae13,_0xee1102);_0x1f95e0(_0xee1102);});});}function respondWithStatusCode(_0x36f22f,_0x2db46d){_0x2db46d=_0x2db46d||0xcc;return function(_0x353cfe){if(_0x353cfe){return _0x36f22f[_0xaeb8('0x29')](_0x2db46d);}return _0x36f22f[_0xaeb8('0x2a')](_0x2db46d)[_0xaeb8('0x2b')]();};}function respondWithResult(_0x27807d,_0x1ce9a0){_0x1ce9a0=_0x1ce9a0||0xc8;return function(_0x4146df){if(_0x4146df){return _0x27807d[_0xaeb8('0x2a')](_0x1ce9a0)[_0xaeb8('0x2c')](_0x4146df);}};}function respondWithFilteredResult(_0x61e13a,_0x3d5f42){return function(_0x1c217f){if(_0x1c217f){var _0x155879=_0x1c217f['count'],_0x469919=_0x3d5f42['offset'],_0x38ce86=_0x3d5f42['offset']+_0x3d5f42['limit'],_0x4eaafa;if(_0x38ce86>=_0x155879){_0x38ce86=_0x155879;_0x4eaafa=0xc8;}else{_0x4eaafa=0xce;}_0x61e13a['status'](_0x4eaafa);return _0x61e13a[_0xaeb8('0x2d')]('Content-Range',_0x469919+'-'+_0x38ce86+'/'+_0x155879)[_0xaeb8('0x2c')](_0x1c217f);}return null;};}function patchUpdates(_0x428557){return function(_0x24b065){try{jsonpatch['apply'](_0x24b065,_0x428557,!![]);}catch(_0x312898){return BPromise[_0xaeb8('0x2e')](_0x312898);}return _0x24b065[_0xaeb8('0x2f')]();};}function saveUpdates(_0x1b40ab,_0x119187){return function(_0x4f72cd){if(_0x4f72cd){return _0x4f72cd['update'](_0x1b40ab)[_0xaeb8('0x30')](function(_0x595325){return _0x595325;});}return null;};}function removeEntity(_0x29657a,_0x2e7b74){return function(_0x7e4bca){if(_0x7e4bca){return _0x7e4bca[_0xaeb8('0x31')]()['then'](function(){_0x29657a[_0xaeb8('0x2a')](0xcc)[_0xaeb8('0x2b')]();});}};}function handleEntityNotFound(_0x211922,_0x2d90b5){return function(_0x522ba4){if(!_0x522ba4){_0x211922[_0xaeb8('0x29')](0x194);}return _0x522ba4;};}function handleError(_0x373de9,_0x44f3a4){_0x44f3a4=_0x44f3a4||0x1f4;return function(_0x8b924a){logger[_0xaeb8('0x26')](_0x8b924a[_0xaeb8('0x32')]);if(_0x8b924a[_0xaeb8('0x33')]){delete _0x8b924a[_0xaeb8('0x33')];}_0x373de9[_0xaeb8('0x2a')](_0x44f3a4)[_0xaeb8('0x34')](_0x8b924a);};}exports[_0xaeb8('0x35')]=function(_0x595ffd,_0x620f31){var _0x4789cb={},_0x32dd63={},_0x718cb0={'count':0x0,'rows':[]};var _0x465ab0=_['map'](db[_0xaeb8('0x36')]['rawAttributes'],function(_0x568462){return{'name':_0x568462[_0xaeb8('0x37')],'type':_0x568462[_0xaeb8('0x38')][_0xaeb8('0x39')]};});_0x32dd63['model']=_['map'](_0x465ab0,'name');_0x32dd63[_0xaeb8('0x3a')]=_['keys'](_0x595ffd['query']);_0x32dd63[_0xaeb8('0x3b')]=_[_0xaeb8('0x3c')](_0x32dd63[_0xaeb8('0x3d')],_0x32dd63[_0xaeb8('0x3a')]);_0x4789cb['attributes']=_['intersection'](_0x32dd63[_0xaeb8('0x3d')],qs[_0xaeb8('0x3e')](_0x595ffd[_0xaeb8('0x3a')][_0xaeb8('0x3e')]));_0x4789cb[_0xaeb8('0x3f')]=_0x4789cb[_0xaeb8('0x3f')]['length']?_0x4789cb[_0xaeb8('0x3f')]:_0x32dd63[_0xaeb8('0x3d')];if(!_0x595ffd[_0xaeb8('0x3a')][_0xaeb8('0x40')](_0xaeb8('0x41'))){_0x4789cb[_0xaeb8('0x42')]=qs[_0xaeb8('0x42')](_0x595ffd[_0xaeb8('0x3a')][_0xaeb8('0x42')]);_0x4789cb[_0xaeb8('0x43')]=qs[_0xaeb8('0x43')](_0x595ffd['query'][_0xaeb8('0x43')]);}_0x4789cb['order']=qs[_0xaeb8('0x44')](_0x595ffd[_0xaeb8('0x3a')][_0xaeb8('0x44')]);_0x4789cb['where']=qs[_0xaeb8('0x3b')](_[_0xaeb8('0x45')](_0x595ffd[_0xaeb8('0x3a')],_0x32dd63[_0xaeb8('0x3b')]));if(_0x595ffd[_0xaeb8('0x3a')][_0xaeb8('0x46')]){_0x4789cb[_0xaeb8('0x47')]=_[_0xaeb8('0x48')](_0x4789cb[_0xaeb8('0x47')],{'$or':_['map'](_0x465ab0,function(_0x23ac91){if(_0x23ac91[_0xaeb8('0x38')]!==_0xaeb8('0x49')){var _0x53fec0={};_0x53fec0[_0x23ac91['name']]={'$like':'%'+_0x595ffd[_0xaeb8('0x3a')]['filter']+'%'};return _0x53fec0;}})});}_0x4789cb=_[_0xaeb8('0x48')]({},_0x4789cb,_0x595ffd['options']);var _0x3ff866={'where':_0x4789cb[_0xaeb8('0x47')]};return db[_0xaeb8('0x36')][_0xaeb8('0x4a')](_0x3ff866)[_0xaeb8('0x30')](function(_0x4117fc){_0x718cb0[_0xaeb8('0x4a')]=_0x4117fc;if(_0x595ffd[_0xaeb8('0x3a')][_0xaeb8('0x4b')]){_0x4789cb[_0xaeb8('0x4c')]=[{'all':!![]}];}return db[_0xaeb8('0x36')][_0xaeb8('0x4d')](_0x4789cb);})['then'](function(_0x553be1){_0x718cb0[_0xaeb8('0x4e')]=_0x553be1;return _0x718cb0;})['then'](respondWithFilteredResult(_0x620f31,_0x4789cb))[_0xaeb8('0x28')](handleError(_0x620f31,null));};exports[_0xaeb8('0x4f')]=function(_0x49e227,_0x5cb924){var _0x32cfaa={'raw':![],'where':{'id':_0x49e227[_0xaeb8('0x50')]['id']}},_0x477423={};_0x477423[_0xaeb8('0x3d')]=_[_0xaeb8('0x51')](db[_0xaeb8('0x36')][_0xaeb8('0x52')]);_0x477423[_0xaeb8('0x3a')]=_[_0xaeb8('0x51')](_0x49e227['query']);_0x477423['filters']=_[_0xaeb8('0x3c')](_0x477423[_0xaeb8('0x3d')],_0x477423[_0xaeb8('0x3a')]);_0x32cfaa['attributes']=_['intersection'](_0x477423[_0xaeb8('0x3d')],qs[_0xaeb8('0x3e')](_0x49e227[_0xaeb8('0x3a')][_0xaeb8('0x3e')]));_0x32cfaa['attributes']=_0x32cfaa['attributes'][_0xaeb8('0x53')]?_0x32cfaa[_0xaeb8('0x3f')]:_0x477423['model'];if(_0x49e227['query'][_0xaeb8('0x4b')]){_0x32cfaa[_0xaeb8('0x4c')]=[{'all':!![]}];}_0x32cfaa=_[_0xaeb8('0x48')]({},_0x32cfaa,_0x49e227[_0xaeb8('0x54')]);return db[_0xaeb8('0x36')][_0xaeb8('0x55')](_0x32cfaa)['then'](handleEntityNotFound(_0x5cb924,null))[_0xaeb8('0x30')](respondWithResult(_0x5cb924,null))[_0xaeb8('0x28')](handleError(_0x5cb924,null));};exports['create']=function(_0x4fbf6f,_0x2413c5){return db[_0xaeb8('0x36')][_0xaeb8('0x56')](_0x4fbf6f[_0xaeb8('0x57')],{})['then'](respondWithResult(_0x2413c5,0xc9))[_0xaeb8('0x28')](handleError(_0x2413c5,null));};exports[_0xaeb8('0x58')]=function(_0x53ab9,_0x92f8fc){if(_0x53ab9[_0xaeb8('0x57')]['id']){delete _0x53ab9[_0xaeb8('0x57')]['id'];}return db[_0xaeb8('0x36')][_0xaeb8('0x55')]({'where':{'id':_0x53ab9[_0xaeb8('0x50')]['id']}})['then'](handleEntityNotFound(_0x92f8fc,null))['then'](saveUpdates(_0x53ab9[_0xaeb8('0x57')],null))['then'](respondWithResult(_0x92f8fc,null))['catch'](handleError(_0x92f8fc,null));};exports[_0xaeb8('0x31')]=function(_0x198f6a,_0x158b5b){return db['FreshsalesAccount'][_0xaeb8('0x55')]({'where':{'id':_0x198f6a[_0xaeb8('0x50')]['id']}})[_0xaeb8('0x30')](handleEntityNotFound(_0x158b5b,null))[_0xaeb8('0x30')](removeEntity(_0x158b5b,null))[_0xaeb8('0x28')](handleError(_0x158b5b,null));};exports[_0xaeb8('0x59')]=function(_0x4397fa,_0x47c364,_0x373bc2){var _0x45b80e={};var _0x2ad53d={};var _0x5357d1;var _0x23c62f;return db[_0xaeb8('0x36')][_0xaeb8('0x5a')]({'where':{'id':_0x4397fa[_0xaeb8('0x50')]['id']}})[_0xaeb8('0x30')](handleEntityNotFound(_0x47c364,null))[_0xaeb8('0x30')](function(_0xd35716){if(_0xd35716){_0x5357d1=_0xd35716;_0x2ad53d[_0xaeb8('0x3d')]=_['keys'](db[_0xaeb8('0x5b')][_0xaeb8('0x52')]);_0x2ad53d[_0xaeb8('0x3a')]=_[_0xaeb8('0x51')](_0x4397fa[_0xaeb8('0x3a')]);_0x2ad53d[_0xaeb8('0x3b')]=_['intersection'](_0x2ad53d['model'],_0x2ad53d['query']);_0x45b80e[_0xaeb8('0x3f')]=_['intersection'](_0x2ad53d[_0xaeb8('0x3d')],qs[_0xaeb8('0x3e')](_0x4397fa[_0xaeb8('0x3a')][_0xaeb8('0x3e')]));_0x45b80e[_0xaeb8('0x3f')]=_0x45b80e[_0xaeb8('0x3f')][_0xaeb8('0x53')]?_0x45b80e[_0xaeb8('0x3f')]:_0x2ad53d[_0xaeb8('0x3d')];_0x45b80e[_0xaeb8('0x5c')]=qs[_0xaeb8('0x44')](_0x4397fa[_0xaeb8('0x3a')][_0xaeb8('0x44')]);_0x45b80e[_0xaeb8('0x47')]=qs[_0xaeb8('0x3b')](_['pick'](_0x4397fa['query'],_0x2ad53d[_0xaeb8('0x3b')]));if(_0x4397fa[_0xaeb8('0x3a')]['filter']){_0x45b80e[_0xaeb8('0x47')]=_['merge'](_0x45b80e['where'],{'$or':_['map'](_0x45b80e[_0xaeb8('0x3f')],function(_0x2cb472){var _0x1b8450={};_0x1b8450[_0x2cb472]={'$like':'%'+_0x4397fa[_0xaeb8('0x3a')]['filter']+'%'};return _0x1b8450;})});}_0x45b80e=_['merge']({},_0x45b80e,_0x4397fa['options']);return _0x5357d1[_0xaeb8('0x59')](_0x45b80e);}})[_0xaeb8('0x30')](function(_0x37c856){if(_0x37c856){_0x23c62f=_0x37c856[_0xaeb8('0x53')];if(!_0x4397fa[_0xaeb8('0x3a')][_0xaeb8('0x40')]('nolimit')){_0x45b80e[_0xaeb8('0x42')]=qs[_0xaeb8('0x42')](_0x4397fa[_0xaeb8('0x3a')]['limit']);_0x45b80e[_0xaeb8('0x43')]=qs[_0xaeb8('0x43')](_0x4397fa[_0xaeb8('0x3a')][_0xaeb8('0x43')]);}return _0x5357d1[_0xaeb8('0x59')](_0x45b80e);}})[_0xaeb8('0x30')](function(_0x48f2e6){if(_0x48f2e6){return _0x48f2e6?{'count':_0x23c62f,'rows':_0x48f2e6}:null;}})['then'](respondWithResult(_0x47c364,null))[_0xaeb8('0x28')](handleError(_0x47c364,null));};exports[_0xaeb8('0x5d')]=function(_0x1f5d37,_0x8e2424,_0x4d4efb){if(_0x1f5d37[_0xaeb8('0x57')]['id']){delete _0x1f5d37[_0xaeb8('0x57')]['id'];}return db[_0xaeb8('0x36')][_0xaeb8('0x5a')]({'where':{'id':_0x1f5d37[_0xaeb8('0x50')]['id']}})[_0xaeb8('0x30')](handleEntityNotFound(_0x8e2424,null))['then'](function(_0x196101){if(_0x196101){_0x1f5d37['body'][_0xaeb8('0x5e')]=_0x196101['id'];_0x1f5d37[_0xaeb8('0x57')]['Subjects']=integrations['getSubjects'](_0x1f5d37[_0xaeb8('0x57')][_0xaeb8('0x5f')],_0x1f5d37[_0xaeb8('0x57')][_0xaeb8('0x38')]);_0x1f5d37[_0xaeb8('0x57')][_0xaeb8('0x60')]=integrations['getDescriptions'](_0x1f5d37[_0xaeb8('0x57')][_0xaeb8('0x5f')],_0x1f5d37[_0xaeb8('0x57')][_0xaeb8('0x38')]);return db[_0xaeb8('0x5b')][_0xaeb8('0x56')](_0x1f5d37[_0xaeb8('0x57')],{'include':[{'model':db[_0xaeb8('0x61')],'as':_0xaeb8('0x62')},{'model':db[_0xaeb8('0x61')],'as':_0xaeb8('0x60')}]});}return null;})['then'](respondWithResult(_0x8e2424,null))[_0xaeb8('0x28')](handleError(_0x8e2424,null));};exports['getFields']=function(_0x156a38,_0x3ad775,_0x2baead){var _0x321d22='';var _0x5d38e5='';return db['FreshsalesAccount'][_0xaeb8('0x5a')]({'where':{'id':_0x156a38[_0xaeb8('0x50')]['id']},'attributes':['id','username',_0xaeb8('0x63'),_0xaeb8('0x64')]})[_0xaeb8('0x30')](handleEntityNotFound(_0x3ad775,null))[_0xaeb8('0x30')](function(_0x38f48b){if(_0x38f48b){_0x5d38e5=_0x38f48b[_0xaeb8('0x65')];_0x321d22=_0x38f48b[_0xaeb8('0x63')];var _0x1faeb5=_0x38f48b['remoteUri']['slice'](-0x1);if(_0x1faeb5==='/'){_0x321d22=_0x321d22[_0xaeb8('0x66')](0x0,_0x321d22[_0xaeb8('0x67')](_0x1faeb5));}return rp({'method':_0xaeb8('0x68'),'uri':util[_0xaeb8('0x69')](_0xaeb8('0x6a'),_0x321d22,_0xaeb8('0x6b')),'headers':{'Authorization':_0xaeb8('0x6c')+_0x38f48b[_0xaeb8('0x64')]},'json':!![]});}})[_0xaeb8('0x30')](function(_0x2462b2){if(_0x2462b2){var _0x4264d3=_0x2462b2[_0xaeb8('0x6d')];var _0x463ef5=![];var _0x59bf15=null;for(_0x59bf15=0x0;_0x59bf15<_0x4264d3[_0xaeb8('0x53')];_0x59bf15++){if(_0x4264d3[_0x59bf15]['email']===_0x5d38e5){_0x463ef5=!![];}}if(_0x463ef5){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xaeb8('0x6e')});}}})[_0xaeb8('0x30')](respondWithResult(_0x3ad775,null))[_0xaeb8('0x28')](function(_0x1d9995){var _0x45a040=_0x156a38[_0xaeb8('0x3a')]['test']?0x1f4:_0x1d9995[_0xaeb8('0x6f')]||0x1f4;logger[_0xaeb8('0x26')](_0xaeb8('0x70'),_0xaeb8('0x71'),_0x45a040,JSON[_0xaeb8('0x24')](_0x1d9995));delete _0x1d9995[_0xaeb8('0x33')];if(_0x45a040===0x191){_0x45a040=0x190;}_0x3ad775[_0xaeb8('0x2a')](_0x45a040)[_0xaeb8('0x34')](_0x156a38[_0xaeb8('0x3a')][_0xaeb8('0x1b')]?{'message':_0xaeb8('0x72'),'statusCode':_0x1d9995[_0xaeb8('0x6f')]}:_0x1d9995);});}; \ No newline at end of file +var _0xe4c0=['findAll','show','params','includeAll','find','create','body','FreshsalesConfiguration','order','getConfigurations','addConfiguration','findOne','AccountId','getSubjects','channel','FreshsalesField','Subjects','Descriptions','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','getFields,\x20%s,\x20%s,\x20%s','statusCode','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FreshsalesAccount,\x20%s,\x20%s','result','catch','sendStatus','end','status','count','offset','limit','json','apply','reject','update','destroy','stack','name','send','index','map','FreshsalesAccount','rawAttributes','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','include'];(function(_0x18408d,_0x250f37){var _0x5e9153=function(_0x1845cf){while(--_0x1845cf){_0x18408d['push'](_0x18408d['shift']());}};_0x5e9153(++_0x250f37);}(_0xe4c0,0x1ca));var _0x0e4c=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xe4c0[_0x51c819];return _0x15c5d2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0e4c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0e4c('0x1'));var moment=require(_0x0e4c('0x2'));var BPromise=require(_0x0e4c('0x3'));var Mustache=require(_0x0e4c('0x4'));var util=require(_0x0e4c('0x5'));var path=require(_0x0e4c('0x6'));var sox=require('sox');var csv=require(_0x0e4c('0x7'));var ejs=require(_0x0e4c('0x8'));var fs=require('fs');var _=require(_0x0e4c('0x9'));var squel=require('squel');var crypto=require(_0x0e4c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0e4c('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0e4c('0xc'));var Redis=require('ioredis');var authService=require(_0x0e4c('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x0e4c('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e4c('0xf'))('api');var utils=require(_0x0e4c('0x10'));var config=require(_0x0e4c('0x11'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x0e4c('0x12'));var client=jayson[_0x0e4c('0x13')]['http']({'port':0x232a});function checkPasswordPattern(_0x4662f3,_0x554353,_0x570a95){if(_0x570a95){var _0x1e79f1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e79f1[_0x0e4c('0x14')](_0x554353)){return _0x4662f3;}else{throw new db[(_0x0e4c('0x15'))][(_0x0e4c('0x16'))](_0x0e4c('0x17'));}}else{return _0x4662f3;}}function respondWithRpcPromise(_0x2815b2,_0x34f09a,_0x2bba8c,_0x352b58){return new BPromise(function(_0x44e7d4,_0xfa68b9){var _0x5575d7=_0x352b58||client;return _0x5575d7['request'](_0x2815b2,_0x2bba8c)[_0x0e4c('0x18')](function(_0x308dd2){logger[_0x0e4c('0x19')]('FreshsalesAccount,\x20%s,\x20%s',_0x34f09a,'request\x20sent');logger[_0x0e4c('0x1a')](_0x0e4c('0x1b'),_0x34f09a,_0x0e4c('0x1c'),JSON[_0x0e4c('0x1d')](_0x308dd2));if(_0x308dd2[_0x0e4c('0x1e')]){if(_0x308dd2[_0x0e4c('0x1e')][_0x0e4c('0x1f')]===0x1f4){logger[_0x0e4c('0x1e')]('FreshsalesAccount,\x20%s,\x20%s',_0x34f09a,_0x308dd2[_0x0e4c('0x1e')][_0x0e4c('0x20')]);return _0xfa68b9(_0x308dd2[_0x0e4c('0x1e')][_0x0e4c('0x20')]);}logger[_0x0e4c('0x1e')](_0x0e4c('0x21'),_0x34f09a,_0x308dd2['error'][_0x0e4c('0x20')]);return _0x44e7d4(_0x308dd2['error'][_0x0e4c('0x20')]);}else{logger[_0x0e4c('0x19')](_0x0e4c('0x21'),_0x34f09a,'request\x20sent');_0x44e7d4(_0x308dd2[_0x0e4c('0x22')][_0x0e4c('0x20')]);}})[_0x0e4c('0x23')](function(_0x5aa978){logger['error'](_0x0e4c('0x21'),_0x34f09a,_0x5aa978);_0xfa68b9(_0x5aa978);});});}function respondWithStatusCode(_0x19d723,_0x37dd23){_0x37dd23=_0x37dd23||0xcc;return function(_0x3b0028){if(_0x3b0028){return _0x19d723[_0x0e4c('0x24')](_0x37dd23);}return _0x19d723['status'](_0x37dd23)[_0x0e4c('0x25')]();};}function respondWithResult(_0x1d7ae5,_0x153f8f){_0x153f8f=_0x153f8f||0xc8;return function(_0x2903c5){if(_0x2903c5){return _0x1d7ae5[_0x0e4c('0x26')](_0x153f8f)['json'](_0x2903c5);}};}function respondWithFilteredResult(_0x12ec86,_0x9928b2){return function(_0x45b88a){if(_0x45b88a){var _0x584a28=_0x45b88a[_0x0e4c('0x27')],_0x10ca8d=_0x9928b2[_0x0e4c('0x28')],_0x2cb168=_0x9928b2[_0x0e4c('0x28')]+_0x9928b2[_0x0e4c('0x29')],_0xb320f6;if(_0x2cb168>=_0x584a28){_0x2cb168=_0x584a28;_0xb320f6=0xc8;}else{_0xb320f6=0xce;}_0x12ec86['status'](_0xb320f6);return _0x12ec86['set']('Content-Range',_0x10ca8d+'-'+_0x2cb168+'/'+_0x584a28)[_0x0e4c('0x2a')](_0x45b88a);}return null;};}function patchUpdates(_0x1f35a9){return function(_0x1e9d38){try{jsonpatch[_0x0e4c('0x2b')](_0x1e9d38,_0x1f35a9,!![]);}catch(_0x39ae7b){return BPromise[_0x0e4c('0x2c')](_0x39ae7b);}return _0x1e9d38['save']();};}function saveUpdates(_0x3b5819,_0x5aaa95){return function(_0x3fd2b5){if(_0x3fd2b5){return _0x3fd2b5[_0x0e4c('0x2d')](_0x3b5819)[_0x0e4c('0x18')](function(_0x47b8d3){return _0x47b8d3;});}return null;};}function removeEntity(_0xd39e45,_0x1ede48){return function(_0x254c84){if(_0x254c84){return _0x254c84[_0x0e4c('0x2e')]()[_0x0e4c('0x18')](function(){_0xd39e45[_0x0e4c('0x26')](0xcc)[_0x0e4c('0x25')]();});}};}function handleEntityNotFound(_0x4524e9,_0x80c217){return function(_0x37088f){if(!_0x37088f){_0x4524e9[_0x0e4c('0x24')](0x194);}return _0x37088f;};}function handleError(_0xe224b5,_0x3a1ae1){_0x3a1ae1=_0x3a1ae1||0x1f4;return function(_0x3c716b){logger['error'](_0x3c716b[_0x0e4c('0x2f')]);if(_0x3c716b[_0x0e4c('0x30')]){delete _0x3c716b[_0x0e4c('0x30')];}_0xe224b5[_0x0e4c('0x26')](_0x3a1ae1)[_0x0e4c('0x31')](_0x3c716b);};}exports[_0x0e4c('0x32')]=function(_0x2f4f03,_0x485de4){var _0x2bd277={},_0x12cae2={},_0x5cf7d2={'count':0x0,'rows':[]};var _0x1d9a63=_[_0x0e4c('0x33')](db[_0x0e4c('0x34')][_0x0e4c('0x35')],function(_0x5b3161){return{'name':_0x5b3161['fieldName'],'type':_0x5b3161[_0x0e4c('0x36')]['key']};});_0x12cae2[_0x0e4c('0x37')]=_[_0x0e4c('0x33')](_0x1d9a63,_0x0e4c('0x30'));_0x12cae2[_0x0e4c('0x38')]=_[_0x0e4c('0x39')](_0x2f4f03['query']);_0x12cae2['filters']=_['intersection'](_0x12cae2[_0x0e4c('0x37')],_0x12cae2['query']);_0x2bd277[_0x0e4c('0x3a')]=_[_0x0e4c('0x3b')](_0x12cae2['model'],qs['fields'](_0x2f4f03[_0x0e4c('0x38')][_0x0e4c('0x3c')]));_0x2bd277[_0x0e4c('0x3a')]=_0x2bd277[_0x0e4c('0x3a')][_0x0e4c('0x3d')]?_0x2bd277[_0x0e4c('0x3a')]:_0x12cae2['model'];if(!_0x2f4f03[_0x0e4c('0x38')][_0x0e4c('0x3e')](_0x0e4c('0x3f'))){_0x2bd277['limit']=qs['limit'](_0x2f4f03[_0x0e4c('0x38')][_0x0e4c('0x29')]);_0x2bd277[_0x0e4c('0x28')]=qs[_0x0e4c('0x28')](_0x2f4f03[_0x0e4c('0x38')][_0x0e4c('0x28')]);}_0x2bd277['order']=qs[_0x0e4c('0x40')](_0x2f4f03[_0x0e4c('0x38')]['sort']);_0x2bd277[_0x0e4c('0x41')]=qs[_0x0e4c('0x42')](_['pick'](_0x2f4f03[_0x0e4c('0x38')],_0x12cae2[_0x0e4c('0x42')]));if(_0x2f4f03[_0x0e4c('0x38')][_0x0e4c('0x43')]){_0x2bd277[_0x0e4c('0x41')]=_[_0x0e4c('0x44')](_0x2bd277[_0x0e4c('0x41')],{'$or':_['map'](_0x1d9a63,function(_0x1d0886){if(_0x1d0886[_0x0e4c('0x36')]!==_0x0e4c('0x45')){var _0x5b2e77={};_0x5b2e77[_0x1d0886[_0x0e4c('0x30')]]={'$like':'%'+_0x2f4f03[_0x0e4c('0x38')][_0x0e4c('0x43')]+'%'};return _0x5b2e77;}})});}_0x2bd277=_[_0x0e4c('0x44')]({},_0x2bd277,_0x2f4f03[_0x0e4c('0x46')]);var _0x2b0b66={'where':_0x2bd277[_0x0e4c('0x41')]};return db[_0x0e4c('0x34')][_0x0e4c('0x27')](_0x2b0b66)[_0x0e4c('0x18')](function(_0xc864fc){_0x5cf7d2[_0x0e4c('0x27')]=_0xc864fc;if(_0x2f4f03['query']['includeAll']){_0x2bd277[_0x0e4c('0x47')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x0e4c('0x48')](_0x2bd277);})[_0x0e4c('0x18')](function(_0x38d963){_0x5cf7d2['rows']=_0x38d963;return _0x5cf7d2;})[_0x0e4c('0x18')](respondWithFilteredResult(_0x485de4,_0x2bd277))['catch'](handleError(_0x485de4,null));};exports[_0x0e4c('0x49')]=function(_0x2365d9,_0x24d8e5){var _0x2e77e4={'raw':![],'where':{'id':_0x2365d9[_0x0e4c('0x4a')]['id']}},_0x5658d0={};_0x5658d0[_0x0e4c('0x37')]=_[_0x0e4c('0x39')](db['FreshsalesAccount'][_0x0e4c('0x35')]);_0x5658d0[_0x0e4c('0x38')]=_[_0x0e4c('0x39')](_0x2365d9[_0x0e4c('0x38')]);_0x5658d0[_0x0e4c('0x42')]=_[_0x0e4c('0x3b')](_0x5658d0['model'],_0x5658d0[_0x0e4c('0x38')]);_0x2e77e4['attributes']=_[_0x0e4c('0x3b')](_0x5658d0[_0x0e4c('0x37')],qs[_0x0e4c('0x3c')](_0x2365d9[_0x0e4c('0x38')][_0x0e4c('0x3c')]));_0x2e77e4['attributes']=_0x2e77e4[_0x0e4c('0x3a')][_0x0e4c('0x3d')]?_0x2e77e4[_0x0e4c('0x3a')]:_0x5658d0[_0x0e4c('0x37')];if(_0x2365d9[_0x0e4c('0x38')][_0x0e4c('0x4b')]){_0x2e77e4[_0x0e4c('0x47')]=[{'all':!![]}];}_0x2e77e4=_[_0x0e4c('0x44')]({},_0x2e77e4,_0x2365d9[_0x0e4c('0x46')]);return db[_0x0e4c('0x34')][_0x0e4c('0x4c')](_0x2e77e4)['then'](handleEntityNotFound(_0x24d8e5,null))['then'](respondWithResult(_0x24d8e5,null))[_0x0e4c('0x23')](handleError(_0x24d8e5,null));};exports[_0x0e4c('0x4d')]=function(_0x466533,_0x293d45){return db[_0x0e4c('0x34')][_0x0e4c('0x4d')](_0x466533[_0x0e4c('0x4e')],{})[_0x0e4c('0x18')](respondWithResult(_0x293d45,0xc9))[_0x0e4c('0x23')](handleError(_0x293d45,null));};exports[_0x0e4c('0x2d')]=function(_0x3093f3,_0x14df11){if(_0x3093f3['body']['id']){delete _0x3093f3[_0x0e4c('0x4e')]['id'];}return db[_0x0e4c('0x34')][_0x0e4c('0x4c')]({'where':{'id':_0x3093f3[_0x0e4c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x14df11,null))['then'](saveUpdates(_0x3093f3[_0x0e4c('0x4e')],null))['then'](respondWithResult(_0x14df11,null))[_0x0e4c('0x23')](handleError(_0x14df11,null));};exports[_0x0e4c('0x2e')]=function(_0x66157,_0x556338){return db['FreshsalesAccount']['find']({'where':{'id':_0x66157['params']['id']}})[_0x0e4c('0x18')](handleEntityNotFound(_0x556338,null))[_0x0e4c('0x18')](removeEntity(_0x556338,null))[_0x0e4c('0x23')](handleError(_0x556338,null));};exports['getConfigurations']=function(_0x3524ab,_0x37f50c,_0xcb7956){var _0x4ece4e={};var _0x2b6267={};var _0x2ca6ea;var _0x3b2b6a;return db[_0x0e4c('0x34')]['findOne']({'where':{'id':_0x3524ab[_0x0e4c('0x4a')]['id']}})[_0x0e4c('0x18')](handleEntityNotFound(_0x37f50c,null))[_0x0e4c('0x18')](function(_0xb2f03d){if(_0xb2f03d){_0x2ca6ea=_0xb2f03d;_0x2b6267[_0x0e4c('0x37')]=_['keys'](db[_0x0e4c('0x4f')][_0x0e4c('0x35')]);_0x2b6267[_0x0e4c('0x38')]=_['keys'](_0x3524ab[_0x0e4c('0x38')]);_0x2b6267[_0x0e4c('0x42')]=_[_0x0e4c('0x3b')](_0x2b6267[_0x0e4c('0x37')],_0x2b6267[_0x0e4c('0x38')]);_0x4ece4e[_0x0e4c('0x3a')]=_['intersection'](_0x2b6267['model'],qs['fields'](_0x3524ab[_0x0e4c('0x38')]['fields']));_0x4ece4e[_0x0e4c('0x3a')]=_0x4ece4e['attributes'][_0x0e4c('0x3d')]?_0x4ece4e[_0x0e4c('0x3a')]:_0x2b6267['model'];_0x4ece4e[_0x0e4c('0x50')]=qs[_0x0e4c('0x40')](_0x3524ab[_0x0e4c('0x38')]['sort']);_0x4ece4e[_0x0e4c('0x41')]=qs[_0x0e4c('0x42')](_['pick'](_0x3524ab['query'],_0x2b6267[_0x0e4c('0x42')]));if(_0x3524ab[_0x0e4c('0x38')][_0x0e4c('0x43')]){_0x4ece4e[_0x0e4c('0x41')]=_[_0x0e4c('0x44')](_0x4ece4e['where'],{'$or':_[_0x0e4c('0x33')](_0x4ece4e['attributes'],function(_0x3aff9c){var _0x4187c0={};_0x4187c0[_0x3aff9c]={'$like':'%'+_0x3524ab['query'][_0x0e4c('0x43')]+'%'};return _0x4187c0;})});}_0x4ece4e=_[_0x0e4c('0x44')]({},_0x4ece4e,_0x3524ab[_0x0e4c('0x46')]);return _0x2ca6ea[_0x0e4c('0x51')](_0x4ece4e);}})['then'](function(_0xd20b8c){if(_0xd20b8c){_0x3b2b6a=_0xd20b8c[_0x0e4c('0x3d')];if(!_0x3524ab[_0x0e4c('0x38')][_0x0e4c('0x3e')](_0x0e4c('0x3f'))){_0x4ece4e['limit']=qs[_0x0e4c('0x29')](_0x3524ab[_0x0e4c('0x38')]['limit']);_0x4ece4e[_0x0e4c('0x28')]=qs[_0x0e4c('0x28')](_0x3524ab['query'][_0x0e4c('0x28')]);}return _0x2ca6ea[_0x0e4c('0x51')](_0x4ece4e);}})[_0x0e4c('0x18')](function(_0x6d7991){if(_0x6d7991){return _0x6d7991?{'count':_0x3b2b6a,'rows':_0x6d7991}:null;}})['then'](respondWithResult(_0x37f50c,null))[_0x0e4c('0x23')](handleError(_0x37f50c,null));};exports[_0x0e4c('0x52')]=function(_0x5e1398,_0xf3e27f,_0x23e34d){if(_0x5e1398[_0x0e4c('0x4e')]['id']){delete _0x5e1398[_0x0e4c('0x4e')]['id'];}return db[_0x0e4c('0x34')][_0x0e4c('0x53')]({'where':{'id':_0x5e1398['params']['id']}})[_0x0e4c('0x18')](handleEntityNotFound(_0xf3e27f,null))['then'](function(_0x4f1d39){if(_0x4f1d39){_0x5e1398['body'][_0x0e4c('0x54')]=_0x4f1d39['id'];_0x5e1398[_0x0e4c('0x4e')]['Subjects']=integrations[_0x0e4c('0x55')](_0x5e1398['body'][_0x0e4c('0x56')],_0x5e1398['body'][_0x0e4c('0x36')]);_0x5e1398[_0x0e4c('0x4e')]['Descriptions']=integrations['getDescriptions'](_0x5e1398[_0x0e4c('0x4e')]['channel'],_0x5e1398[_0x0e4c('0x4e')][_0x0e4c('0x36')]);return db[_0x0e4c('0x4f')]['create'](_0x5e1398['body'],{'include':[{'model':db[_0x0e4c('0x57')],'as':_0x0e4c('0x58')},{'model':db[_0x0e4c('0x57')],'as':_0x0e4c('0x59')}]});}return null;})[_0x0e4c('0x18')](respondWithResult(_0xf3e27f,null))[_0x0e4c('0x23')](handleError(_0xf3e27f,null));};exports[_0x0e4c('0x5a')]=function(_0x460ac5,_0x346dfe,_0x51c7ab){var _0x29c73d='';var _0x22f19a='';return db[_0x0e4c('0x34')][_0x0e4c('0x53')]({'where':{'id':_0x460ac5['params']['id']},'attributes':['id',_0x0e4c('0x5b'),_0x0e4c('0x5c'),'apiKey']})['then'](handleEntityNotFound(_0x346dfe,null))[_0x0e4c('0x18')](function(_0xc7c865){if(_0xc7c865){_0x22f19a=_0xc7c865[_0x0e4c('0x5b')];_0x29c73d=_0xc7c865[_0x0e4c('0x5c')];var _0x12c005=_0xc7c865[_0x0e4c('0x5c')][_0x0e4c('0x5d')](-0x1);if(_0x12c005==='/'){_0x29c73d=_0x29c73d[_0x0e4c('0x5e')](0x0,_0x29c73d[_0x0e4c('0x5f')](_0x12c005));}return rp({'method':_0x0e4c('0x60'),'uri':util[_0x0e4c('0x61')](_0x0e4c('0x62'),_0x29c73d,_0x0e4c('0x63')),'headers':{'Authorization':_0x0e4c('0x64')+_0xc7c865['apiKey']},'json':!![]});}})[_0x0e4c('0x18')](function(_0x5b626d){if(_0x5b626d){var _0x2964b8=_0x5b626d[_0x0e4c('0x65')];var _0x5210bd=![];var _0x151444=null;for(_0x151444=0x0;_0x151444<_0x2964b8['length'];_0x151444++){if(_0x2964b8[_0x151444][_0x0e4c('0x66')]===_0x22f19a){_0x5210bd=!![];}}if(_0x5210bd){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x0e4c('0x67')});}}})[_0x0e4c('0x18')](respondWithResult(_0x346dfe,null))[_0x0e4c('0x23')](function(_0x39adad){var _0x1e23dd=_0x460ac5[_0x0e4c('0x38')]['test']?0x1f4:_0x39adad['statusCode']||0x1f4;logger['error'](_0x0e4c('0x68'),_0x0e4c('0x5a'),_0x1e23dd,JSON[_0x0e4c('0x1d')](_0x39adad));delete _0x39adad[_0x0e4c('0x30')];if(_0x1e23dd===0x191){_0x1e23dd=0x190;}_0x346dfe[_0x0e4c('0x26')](_0x1e23dd)[_0x0e4c('0x31')](_0x460ac5[_0x0e4c('0x38')][_0x0e4c('0x14')]?{'message':'Wrong\x20credentials','statusCode':_0x39adad[_0x0e4c('0x69')]}:_0x39adad);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 2657ac0..300bf97 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 _0x4148=['bluebird','request-promise','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','moment'];(function(_0x361b47,_0x5bb965){var _0x1f0f9c=function(_0x137c15){while(--_0x137c15){_0x361b47['push'](_0x361b47['shift']());}};_0x1f0f9c(++_0x5bb965);}(_0x4148,0x75));var _0x8414=function(_0x4237d8,_0x13cc54){_0x4237d8=_0x4237d8-0x0;var _0x1e8caf=_0x4148[_0x4237d8];return _0x1e8caf;};'use strict';var _=require(_0x8414('0x0'));var util=require(_0x8414('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8414('0x2'));var BPromise=require(_0x8414('0x3'));var rp=require(_0x8414('0x4'));var fs=require('fs');var path=require(_0x8414('0x5'));var rimraf=require(_0x8414('0x6'));var config=require('../../config/environment');var attributes=require(_0x8414('0x7'));var integrations=require(_0x8414('0x8'));module[_0x8414('0x9')]=function(_0x443c52,_0x1f366b){return _0x443c52[_0x8414('0xa')]('FreshsalesAccount',attributes,{'tableName':_0x8414('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38c9=['FreshsalesAccount','lodash','util','moment','request-promise','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x3f26d1,_0x38a10a){var _0x5d5d3f=function(_0xb780d9){while(--_0xb780d9){_0x3f26d1['push'](_0x3f26d1['shift']());}};_0x5d5d3f(++_0x38a10a);}(_0x38c9,0x64));var _0x938c=function(_0x1057a3,_0x28d9b7){_0x1057a3=_0x1057a3-0x0;var _0x131cdb=_0x38c9[_0x1057a3];return _0x131cdb;};'use strict';var _=require(_0x938c('0x0'));var util=require(_0x938c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x938c('0x2'));var BPromise=require('bluebird');var rp=require(_0x938c('0x3'));var fs=require('fs');var path=require(_0x938c('0x4'));var rimraf=require('rimraf');var config=require(_0x938c('0x5'));var attributes=require(_0x938c('0x6'));var integrations=require(_0x938c('0x7'));module[_0x938c('0x8')]=function(_0x2cd56e,_0x8702b2){return _0x2cd56e[_0x938c('0x9')](_0x938c('0xa'),attributes,{'tableName':'int_freshsales_accounts','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 2885b4b..a4d1728 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 _0x793b=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','attributes','include','map','model','stringify','ShowFreshsalesAccount','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s'];(function(_0x53b7ed,_0x5a276f){var _0x127c26=function(_0x5b502c){while(--_0x5b502c){_0x53b7ed['push'](_0x53b7ed['shift']());}};_0x127c26(++_0x5a276f);}(_0x793b,0x189));var _0xb793=function(_0x13c251,_0x881c0c){_0x13c251=_0x13c251-0x0;var _0x2848f4=_0x793b[_0x13c251];return _0x2848f4;};'use strict';var _=require(_0xb793('0x0'));var util=require(_0xb793('0x1'));var moment=require(_0xb793('0x2'));var BPromise=require(_0xb793('0x3'));var rs=require(_0xb793('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb793('0x5'))['db'];var utils=require(_0xb793('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xb793('0x7'));var jayson=require(_0xb793('0x8'));var client=jayson[_0xb793('0x9')][_0xb793('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39f110,_0x42d0c7,_0x134ac4){return new BPromise(function(_0x23a718,_0x149720){return client[_0xb793('0xb')](_0x39f110,_0x134ac4)[_0xb793('0xc')](function(_0x22c9ea){logger[_0xb793('0xd')](_0xb793('0xe'),_0x42d0c7,'request\x20sent');logger[_0xb793('0xf')](_0xb793('0x10'),_0x42d0c7,'request\x20sent',JSON['stringify'](_0x22c9ea));if(_0x22c9ea[_0xb793('0x11')]){if(_0x22c9ea[_0xb793('0x11')]['code']===0x1f4){logger[_0xb793('0x11')](_0xb793('0xe'),_0x42d0c7,_0x22c9ea['error'][_0xb793('0x12')]);return _0x149720(_0x22c9ea[_0xb793('0x11')][_0xb793('0x12')]);}logger[_0xb793('0x11')](_0xb793('0xe'),_0x42d0c7,_0x22c9ea[_0xb793('0x11')][_0xb793('0x12')]);return _0x23a718(_0x22c9ea['error'][_0xb793('0x12')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x42d0c7,_0xb793('0x13'));_0x23a718(_0x22c9ea[_0xb793('0x14')][_0xb793('0x12')]);}})[_0xb793('0x15')](function(_0x38d9f2){logger[_0xb793('0x11')](_0xb793('0xe'),_0x42d0c7,_0x38d9f2);_0x149720(_0x38d9f2);});});}exports[_0xb793('0x16')]=function(_0x977026){var _0x2914a2=this;return new Promise(function(_0x2c9e87,_0x101162){return db[_0xb793('0x17')][_0xb793('0x18')]({'raw':_0x977026[_0xb793('0x19')]?_0x977026[_0xb793('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x977026[_0xb793('0x19')]?_0x977026[_0xb793('0x19')]['where']||null:null,'attributes':_0x977026[_0xb793('0x19')]?_0x977026[_0xb793('0x19')][_0xb793('0x1a')]||null:null,'limit':_0x977026[_0xb793('0x19')]?_0x977026[_0xb793('0x19')]['limit']||null:null,'include':_0x977026['options']?_0x977026[_0xb793('0x19')][_0xb793('0x1b')]?_[_0xb793('0x1c')](_0x977026[_0xb793('0x19')][_0xb793('0x1b')],function(_0x3753d3){return{'model':db[_0x3753d3[_0xb793('0x1d')]],'as':_0x3753d3['as'],'attributes':_0x3753d3[_0xb793('0x1a')],'include':_0x3753d3['include']?_[_0xb793('0x1c')](_0x3753d3[_0xb793('0x1b')],function(_0x14ecb0){return{'model':db[_0x14ecb0[_0xb793('0x1d')]],'as':_0x14ecb0['as'],'attributes':_0x14ecb0[_0xb793('0x1a')],'include':_0x14ecb0[_0xb793('0x1b')]?_[_0xb793('0x1c')](_0x14ecb0['include'],function(_0x1eef51){return{'model':db[_0x1eef51[_0xb793('0x1d')]],'as':_0x1eef51['as'],'attributes':_0x1eef51[_0xb793('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb793('0xc')](function(_0x35cd9d){logger[_0xb793('0xd')]('GetFreshsalesAccount',_0x977026);logger[_0xb793('0xf')](_0xb793('0x16'),_0x977026,JSON[_0xb793('0x1e')](_0x35cd9d));_0x2c9e87(_0x35cd9d);})['catch'](function(_0x89d007){logger[_0xb793('0x11')](_0xb793('0x16'),_0x89d007[_0xb793('0x12')],_0x977026);_0x101162(_0x2914a2['error'](0x1f4,_0x89d007['message']));});});};exports[_0xb793('0x1f')]=function(_0x4b0297){var _0x4864f0=this;return new Promise(function(_0x8a0bed,_0x2e659d){return db[_0xb793('0x17')][_0xb793('0x20')]({'raw':_0x4b0297['options']?_0x4b0297[_0xb793('0x19')][_0xb793('0x21')]===undefined?!![]:![]:!![],'where':_0x4b0297[_0xb793('0x19')]?_0x4b0297[_0xb793('0x19')]['where']||null:null,'attributes':_0x4b0297[_0xb793('0x19')]?_0x4b0297[_0xb793('0x19')][_0xb793('0x1a')]||null:null,'include':_0x4b0297[_0xb793('0x19')]?_0x4b0297[_0xb793('0x19')][_0xb793('0x1b')]?_[_0xb793('0x1c')](_0x4b0297[_0xb793('0x19')]['include'],function(_0x4f1b49){return{'model':db[_0x4f1b49[_0xb793('0x1d')]],'as':_0x4f1b49['as'],'attributes':_0x4f1b49[_0xb793('0x1a')],'include':_0x4f1b49[_0xb793('0x1b')]?_[_0xb793('0x1c')](_0x4f1b49['include'],function(_0xa679c0){return{'model':db[_0xa679c0[_0xb793('0x1d')]],'as':_0xa679c0['as'],'attributes':_0xa679c0[_0xb793('0x1a')],'include':_0xa679c0[_0xb793('0x1b')]?_[_0xb793('0x1c')](_0xa679c0['include'],function(_0x383db9){return{'model':db[_0x383db9[_0xb793('0x1d')]],'as':_0x383db9['as'],'attributes':_0x383db9[_0xb793('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb793('0xc')](function(_0x46ed5d){logger[_0xb793('0xd')](_0xb793('0x1f'),_0x4b0297);logger['debug'](_0xb793('0x1f'),_0x4b0297,JSON[_0xb793('0x1e')](_0x46ed5d));_0x8a0bed(_0x46ed5d);})['catch'](function(_0x3127f1){logger[_0xb793('0x11')]('ShowFreshsalesAccount',_0x3127f1[_0xb793('0x12')],_0x4b0297);_0x2e659d(_0x4864f0['error'](0x1f4,_0x3127f1[_0xb793('0x12')]));});});}; \ No newline at end of file +var _0x77d4=['util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowFreshsalesAccount','find'];(function(_0xc07c7b,_0x2277b9){var _0x26778f=function(_0x3dd448){while(--_0x3dd448){_0xc07c7b['push'](_0xc07c7b['shift']());}};_0x26778f(++_0x2277b9);}(_0x77d4,0x108));var _0x477d=function(_0x21315c,_0x1abf04){_0x21315c=_0x21315c-0x0;var _0xd53f2a=_0x77d4[_0x21315c];return _0xd53f2a;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var moment=require('moment');var BPromise=require(_0x477d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x477d('0x2'));var db=require(_0x477d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x477d('0x4'));var config=require(_0x477d('0x5'));var jayson=require(_0x477d('0x6'));var client=jayson[_0x477d('0x7')][_0x477d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45ca2d,_0x5153df,_0x4f4fb4){return new BPromise(function(_0x2dd5d2,_0x579859){return client['request'](_0x45ca2d,_0x4f4fb4)[_0x477d('0x9')](function(_0x29f11b){logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));logger['debug'](_0x477d('0xd'),_0x5153df,'request\x20sent',JSON[_0x477d('0xe')](_0x29f11b));if(_0x29f11b[_0x477d('0xf')]){if(_0x29f11b['error'][_0x477d('0x10')]===0x1f4){logger[_0x477d('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x5153df,_0x29f11b['error'][_0x477d('0x11')]);return _0x579859(_0x29f11b[_0x477d('0xf')]['message']);}logger[_0x477d('0xf')](_0x477d('0xb'),_0x5153df,_0x29f11b['error']['message']);return _0x2dd5d2(_0x29f11b[_0x477d('0xf')]['message']);}else{logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));_0x2dd5d2(_0x29f11b['result'][_0x477d('0x11')]);}})[_0x477d('0x12')](function(_0x29c6f8){logger[_0x477d('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x5153df,_0x29c6f8);_0x579859(_0x29c6f8);});});}exports[_0x477d('0x13')]=function(_0x5d5553){var _0x367965=this;return new Promise(function(_0x1399d7,_0x159beb){return db[_0x477d('0x14')][_0x477d('0x15')]({'raw':_0x5d5553[_0x477d('0x16')]?_0x5d5553['options'][_0x477d('0x17')]===undefined?!![]:![]:!![],'where':_0x5d5553['options']?_0x5d5553[_0x477d('0x16')][_0x477d('0x18')]||null:null,'attributes':_0x5d5553[_0x477d('0x16')]?_0x5d5553[_0x477d('0x16')][_0x477d('0x19')]||null:null,'limit':_0x5d5553[_0x477d('0x16')]?_0x5d5553[_0x477d('0x16')][_0x477d('0x1a')]||null:null,'include':_0x5d5553[_0x477d('0x16')]?_0x5d5553[_0x477d('0x16')][_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x5d5553[_0x477d('0x16')][_0x477d('0x1b')],function(_0x4e6a44){return{'model':db[_0x4e6a44[_0x477d('0x1d')]],'as':_0x4e6a44['as'],'attributes':_0x4e6a44['attributes'],'include':_0x4e6a44[_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x4e6a44[_0x477d('0x1b')],function(_0x2287b4){return{'model':db[_0x2287b4['model']],'as':_0x2287b4['as'],'attributes':_0x2287b4[_0x477d('0x19')],'include':_0x2287b4[_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x2287b4['include'],function(_0x585648){return{'model':db[_0x585648[_0x477d('0x1d')]],'as':_0x585648['as'],'attributes':_0x585648[_0x477d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x477d('0x9')](function(_0x5c8ef1){logger[_0x477d('0xa')](_0x477d('0x13'),_0x5d5553);logger[_0x477d('0x1e')](_0x477d('0x13'),_0x5d5553,JSON[_0x477d('0xe')](_0x5c8ef1));_0x1399d7(_0x5c8ef1);})['catch'](function(_0x2fc959){logger[_0x477d('0xf')](_0x477d('0x13'),_0x2fc959[_0x477d('0x11')],_0x5d5553);_0x159beb(_0x367965[_0x477d('0xf')](0x1f4,_0x2fc959[_0x477d('0x11')]));});});};exports[_0x477d('0x1f')]=function(_0x98b5d9){var _0x204541=this;return new Promise(function(_0x8fe6c4,_0x41b790){return db[_0x477d('0x14')][_0x477d('0x20')]({'raw':_0x98b5d9[_0x477d('0x16')]?_0x98b5d9[_0x477d('0x16')][_0x477d('0x17')]===undefined?!![]:![]:!![],'where':_0x98b5d9[_0x477d('0x16')]?_0x98b5d9[_0x477d('0x16')][_0x477d('0x18')]||null:null,'attributes':_0x98b5d9[_0x477d('0x16')]?_0x98b5d9['options'][_0x477d('0x19')]||null:null,'include':_0x98b5d9['options']?_0x98b5d9[_0x477d('0x16')][_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x98b5d9['options'][_0x477d('0x1b')],function(_0x1201a9){return{'model':db[_0x1201a9[_0x477d('0x1d')]],'as':_0x1201a9['as'],'attributes':_0x1201a9[_0x477d('0x19')],'include':_0x1201a9[_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x1201a9[_0x477d('0x1b')],function(_0xf84c4c){return{'model':db[_0xf84c4c[_0x477d('0x1d')]],'as':_0xf84c4c['as'],'attributes':_0xf84c4c[_0x477d('0x19')],'include':_0xf84c4c['include']?_[_0x477d('0x1c')](_0xf84c4c[_0x477d('0x1b')],function(_0xb41cd8){return{'model':db[_0xb41cd8['model']],'as':_0xb41cd8['as'],'attributes':_0xb41cd8[_0x477d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x477d('0x9')](function(_0x1b0410){logger['info']('ShowFreshsalesAccount',_0x98b5d9);logger[_0x477d('0x1e')](_0x477d('0x1f'),_0x98b5d9,JSON[_0x477d('0xe')](_0x1b0410));_0x8fe6c4(_0x1b0410);})[_0x477d('0x12')](function(_0x1c0d86){logger['error'](_0x477d('0x1f'),_0x1c0d86['message'],_0x98b5d9);_0x41b790(_0x204541[_0x477d('0xf')](0x1f4,_0x1c0d86[_0x477d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index c5af40c..a7415d8 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 _0xb0f8=['post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','getFields'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0xb0f8,0xd4));var _0x8b0f=function(_0xe4a7a1,_0x22944d){_0xe4a7a1=_0xe4a7a1-0x0;var _0xe0200f=_0xb0f8[_0xe4a7a1];return _0xe0200f;};'use strict';var multer=require(_0x8b0f('0x0'));var util=require(_0x8b0f('0x1'));var path=require(_0x8b0f('0x2'));var timeout=require(_0x8b0f('0x3'));var express=require(_0x8b0f('0x4'));var router=express[_0x8b0f('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8b0f('0x6'));var controller=require(_0x8b0f('0x7'));router[_0x8b0f('0x8')]('/',auth[_0x8b0f('0x9')](),controller[_0x8b0f('0xa')]);router[_0x8b0f('0x8')](_0x8b0f('0xb'),auth[_0x8b0f('0x9')](),controller[_0x8b0f('0xc')]);router['get'](_0x8b0f('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x8b0f('0x8')](_0x8b0f('0xe'),auth[_0x8b0f('0x9')](),controller[_0x8b0f('0xf')]);router[_0x8b0f('0x8')](_0x8b0f('0x10'),auth[_0x8b0f('0x9')](),controller[_0x8b0f('0x11')]);router[_0x8b0f('0x12')]('/',auth[_0x8b0f('0x9')](),controller[_0x8b0f('0x13')]);router[_0x8b0f('0x14')](_0x8b0f('0xb'),auth['isAuthenticated'](),controller[_0x8b0f('0x15')]);router['delete'](_0x8b0f('0xb'),auth[_0x8b0f('0x9')](),controller[_0x8b0f('0x16')]);module['exports']=router; \ No newline at end of file +var _0x3b69=['/:id','/:id/subjects','getSubjects','/:id/fields','getFields','delete','destroy','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0x3b69,0x16c));var _0x93b6=function(_0x2c072f,_0x8efd98){_0x2c072f=_0x2c072f-0x0;var _0x3c46fd=_0x3b69[_0x2c072f];return _0x3c46fd;};'use strict';var multer=require(_0x93b6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x93b6('0x1'));var express=require('express');var router=express[_0x93b6('0x2')]();var auth=require(_0x93b6('0x3'));var interaction=require(_0x93b6('0x4'));var config=require(_0x93b6('0x5'));var controller=require(_0x93b6('0x6'));router[_0x93b6('0x7')]('/',auth[_0x93b6('0x8')](),controller[_0x93b6('0x9')]);router[_0x93b6('0x7')](_0x93b6('0xa'),auth[_0x93b6('0x8')](),controller['show']);router['get'](_0x93b6('0xb'),auth[_0x93b6('0x8')](),controller[_0x93b6('0xc')]);router[_0x93b6('0x7')]('/:id/descriptions',auth[_0x93b6('0x8')](),controller['getDescriptions']);router[_0x93b6('0x7')](_0x93b6('0xd'),auth['isAuthenticated'](),controller[_0x93b6('0xe')]);router['post']('/',auth[_0x93b6('0x8')](),controller['create']);router['put'](_0x93b6('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x93b6('0xf')](_0x93b6('0xa'),auth[_0x93b6('0x8')](),controller[_0x93b6('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 4cf5f62..be1b669 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 _0x5f15=['STRING','exports'];(function(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_0x5f15,0x1df));var _0x55f1=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5f15[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require('sequelize');module[_0x55f1('0x0')]={'name':{'type':Sequelize[_0x55f1('0x1')]},'description':{'type':Sequelize[_0x55f1('0x1')]}}; \ No newline at end of file +var _0x71d7=['STRING','exports'];(function(_0x3005d5,_0xf588c7){var _0x547c7e=function(_0x4514dc){while(--_0x4514dc){_0x3005d5['push'](_0x3005d5['shift']());}};_0x547c7e(++_0xf588c7);}(_0x71d7,0xcd));var _0x771d=function(_0x3044ef,_0x2257fd){_0x3044ef=_0x3044ef-0x0;var _0x3ded98=_0x71d7[_0x3044ef];return _0x3ded98;};'use strict';var Sequelize=require('sequelize');module[_0x771d('0x0')]={'name':{'type':Sequelize[_0x771d('0x1')]},'description':{'type':Sequelize[_0x771d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index e9f17bd..e240cc9 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 _0xe015=['end','offset','limit','set','json','apply','save','update','destroy','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','type','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','show','params','find','create','body','findOne','nolimit','FreshsalesField','getDescriptions','getFields','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','http','test','ValidationError','then','info','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xe015,0x13b));var _0x5e01=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xe015[_0x465028];return _0xb783d4;};'use strict';var pdf=require(_0x5e01('0x0'));var emlformat=require(_0x5e01('0x1'));var rimraf=require(_0x5e01('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5e01('0x3'));var moment=require('moment');var BPromise=require(_0x5e01('0x4'));var Mustache=require(_0x5e01('0x5'));var util=require(_0x5e01('0x6'));var path=require(_0x5e01('0x7'));var sox=require('sox');var csv=require(_0x5e01('0x8'));var ejs=require(_0x5e01('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5e01('0xa'));var jsforce=require(_0x5e01('0xb'));var deskjs=require(_0x5e01('0xc'));var toCsv=require(_0x5e01('0x8'));var querystring=require(_0x5e01('0xd'));var Papa=require(_0x5e01('0xe'));var Redis=require('ioredis');var authService=require(_0x5e01('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5e01('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e01('0x11'))(_0x5e01('0x12'));var utils=require('../../config/utils');var config=require(_0x5e01('0x13'));var db=require(_0x5e01('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x5e01('0x15')]({'port':0x232a});function checkPasswordPattern(_0x160f79,_0x468901,_0x857e89){if(_0x857e89){var _0x3ecf64=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3ecf64[_0x5e01('0x16')](_0x468901)){return _0x160f79;}else{throw new db['Sequelize'][(_0x5e01('0x17'))]('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 _0x160f79;}}function respondWithRpcPromise(_0x4ab9b2,_0x1df2e0,_0x2dd70c,_0x494b8a){return new BPromise(function(_0x27c6e7,_0x5a532d){var _0x4fb33e=_0x494b8a||client;return _0x4fb33e['request'](_0x4ab9b2,_0x2dd70c)[_0x5e01('0x18')](function(_0x5d85e3){logger[_0x5e01('0x19')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1df2e0,'request\x20sent');logger[_0x5e01('0x1a')](_0x5e01('0x1b'),_0x1df2e0,'request\x20sent',JSON[_0x5e01('0x1c')](_0x5d85e3));if(_0x5d85e3[_0x5e01('0x1d')]){if(_0x5d85e3[_0x5e01('0x1d')][_0x5e01('0x1e')]===0x1f4){logger[_0x5e01('0x1d')](_0x5e01('0x1f'),_0x1df2e0,_0x5d85e3[_0x5e01('0x1d')][_0x5e01('0x20')]);return _0x5a532d(_0x5d85e3['error'][_0x5e01('0x20')]);}logger[_0x5e01('0x1d')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1df2e0,_0x5d85e3[_0x5e01('0x1d')][_0x5e01('0x20')]);return _0x27c6e7(_0x5d85e3[_0x5e01('0x1d')][_0x5e01('0x20')]);}else{logger[_0x5e01('0x19')](_0x5e01('0x1f'),_0x1df2e0,'request\x20sent');_0x27c6e7(_0x5d85e3[_0x5e01('0x21')][_0x5e01('0x20')]);}})[_0x5e01('0x22')](function(_0x52ccd0){logger['error'](_0x5e01('0x1f'),_0x1df2e0,_0x52ccd0);_0x5a532d(_0x52ccd0);});});}function respondWithStatusCode(_0x23264f,_0x31eb7f){_0x31eb7f=_0x31eb7f||0xcc;return function(_0x4f94d0){if(_0x4f94d0){return _0x23264f[_0x5e01('0x23')](_0x31eb7f);}return _0x23264f[_0x5e01('0x24')](_0x31eb7f)[_0x5e01('0x25')]();};}function respondWithResult(_0x28344a,_0x58dc6f){_0x58dc6f=_0x58dc6f||0xc8;return function(_0x4d0ebe){if(_0x4d0ebe){return _0x28344a[_0x5e01('0x24')](_0x58dc6f)['json'](_0x4d0ebe);}};}function respondWithFilteredResult(_0x14b9f5,_0x1332bb){return function(_0x194c11){if(_0x194c11){var _0xc26cf8=_0x194c11['count'],_0x592a61=_0x1332bb[_0x5e01('0x26')],_0x531f0a=_0x1332bb['offset']+_0x1332bb[_0x5e01('0x27')],_0x4a4a9f;if(_0x531f0a>=_0xc26cf8){_0x531f0a=_0xc26cf8;_0x4a4a9f=0xc8;}else{_0x4a4a9f=0xce;}_0x14b9f5[_0x5e01('0x24')](_0x4a4a9f);return _0x14b9f5[_0x5e01('0x28')]('Content-Range',_0x592a61+'-'+_0x531f0a+'/'+_0xc26cf8)[_0x5e01('0x29')](_0x194c11);}return null;};}function patchUpdates(_0x36d7a8){return function(_0x44b818){try{jsonpatch[_0x5e01('0x2a')](_0x44b818,_0x36d7a8,!![]);}catch(_0x4efa6f){return BPromise['reject'](_0x4efa6f);}return _0x44b818[_0x5e01('0x2b')]();};}function saveUpdates(_0x99e40e,_0x308649){return function(_0x207107){if(_0x207107){return _0x207107[_0x5e01('0x2c')](_0x99e40e)[_0x5e01('0x18')](function(_0x2bc93b){return _0x2bc93b;});}return null;};}function removeEntity(_0x16a8de,_0x129269){return function(_0xe5738){if(_0xe5738){return _0xe5738[_0x5e01('0x2d')]()[_0x5e01('0x18')](function(){_0x16a8de['status'](0xcc)[_0x5e01('0x25')]();});}};}function handleEntityNotFound(_0x3b4b72,_0x103b05){return function(_0x514c85){if(!_0x514c85){_0x3b4b72[_0x5e01('0x23')](0x194);}return _0x514c85;};}function handleError(_0x12a1f4,_0x5cca68){_0x5cca68=_0x5cca68||0x1f4;return function(_0x3cc642){logger[_0x5e01('0x1d')](_0x3cc642[_0x5e01('0x2e')]);if(_0x3cc642['name']){delete _0x3cc642[_0x5e01('0x2f')];}_0x12a1f4[_0x5e01('0x24')](_0x5cca68)[_0x5e01('0x30')](_0x3cc642);};}exports[_0x5e01('0x31')]=function(_0x388b8a,_0x3d5c79){var _0x1952fb={},_0x26f5f7={},_0x94d4ee={'count':0x0,'rows':[]};var _0x2b052e=_[_0x5e01('0x32')](db[_0x5e01('0x33')][_0x5e01('0x34')],function(_0x28bd7a){return{'name':_0x28bd7a[_0x5e01('0x35')],'type':_0x28bd7a['type'][_0x5e01('0x36')]};});_0x26f5f7['model']=_['map'](_0x2b052e,_0x5e01('0x2f'));_0x26f5f7[_0x5e01('0x37')]=_[_0x5e01('0x38')](_0x388b8a[_0x5e01('0x37')]);_0x26f5f7[_0x5e01('0x39')]=_['intersection'](_0x26f5f7[_0x5e01('0x3a')],_0x26f5f7[_0x5e01('0x37')]);_0x1952fb['attributes']=_[_0x5e01('0x3b')](_0x26f5f7[_0x5e01('0x3a')],qs[_0x5e01('0x3c')](_0x388b8a['query'][_0x5e01('0x3c')]));_0x1952fb[_0x5e01('0x3d')]=_0x1952fb['attributes'][_0x5e01('0x3e')]?_0x1952fb[_0x5e01('0x3d')]:_0x26f5f7['model'];if(!_0x388b8a['query'][_0x5e01('0x3f')]('nolimit')){_0x1952fb[_0x5e01('0x27')]=qs[_0x5e01('0x27')](_0x388b8a[_0x5e01('0x37')][_0x5e01('0x27')]);_0x1952fb['offset']=qs[_0x5e01('0x26')](_0x388b8a[_0x5e01('0x37')][_0x5e01('0x26')]);}_0x1952fb[_0x5e01('0x40')]=qs[_0x5e01('0x41')](_0x388b8a[_0x5e01('0x37')][_0x5e01('0x41')]);_0x1952fb['where']=qs[_0x5e01('0x39')](_[_0x5e01('0x42')](_0x388b8a[_0x5e01('0x37')],_0x26f5f7[_0x5e01('0x39')]));if(_0x388b8a[_0x5e01('0x37')]['filter']){_0x1952fb[_0x5e01('0x43')]=_[_0x5e01('0x44')](_0x1952fb[_0x5e01('0x43')],{'$or':_[_0x5e01('0x32')](_0x2b052e,function(_0x4748c1){if(_0x4748c1[_0x5e01('0x45')]!==_0x5e01('0x46')){var _0x4ec06d={};_0x4ec06d[_0x4748c1[_0x5e01('0x2f')]]={'$like':'%'+_0x388b8a['query'][_0x5e01('0x47')]+'%'};return _0x4ec06d;}})});}_0x1952fb=_[_0x5e01('0x44')]({},_0x1952fb,_0x388b8a[_0x5e01('0x48')]);var _0x310352={'where':_0x1952fb[_0x5e01('0x43')]};return db[_0x5e01('0x33')]['count'](_0x310352)[_0x5e01('0x18')](function(_0x4a5f37){_0x94d4ee[_0x5e01('0x49')]=_0x4a5f37;if(_0x388b8a[_0x5e01('0x37')][_0x5e01('0x4a')]){_0x1952fb[_0x5e01('0x4b')]=[{'all':!![]}];}return db[_0x5e01('0x33')][_0x5e01('0x4c')](_0x1952fb);})['then'](function(_0x5cf1e4){_0x94d4ee[_0x5e01('0x4d')]=_0x5cf1e4;return _0x94d4ee;})[_0x5e01('0x18')](respondWithFilteredResult(_0x3d5c79,_0x1952fb))[_0x5e01('0x22')](handleError(_0x3d5c79,null));};exports[_0x5e01('0x4e')]=function(_0x3d5bfb,_0x389520){var _0x661d={'raw':![],'where':{'id':_0x3d5bfb[_0x5e01('0x4f')]['id']}},_0x253601={};_0x253601[_0x5e01('0x3a')]=_[_0x5e01('0x38')](db['FreshsalesConfiguration'][_0x5e01('0x34')]);_0x253601[_0x5e01('0x37')]=_[_0x5e01('0x38')](_0x3d5bfb['query']);_0x253601[_0x5e01('0x39')]=_[_0x5e01('0x3b')](_0x253601[_0x5e01('0x3a')],_0x253601[_0x5e01('0x37')]);_0x661d[_0x5e01('0x3d')]=_['intersection'](_0x253601[_0x5e01('0x3a')],qs['fields'](_0x3d5bfb[_0x5e01('0x37')][_0x5e01('0x3c')]));_0x661d[_0x5e01('0x3d')]=_0x661d[_0x5e01('0x3d')][_0x5e01('0x3e')]?_0x661d[_0x5e01('0x3d')]:_0x253601[_0x5e01('0x3a')];if(_0x3d5bfb[_0x5e01('0x37')][_0x5e01('0x4a')]){_0x661d['include']=[{'all':!![]}];}_0x661d=_[_0x5e01('0x44')]({},_0x661d,_0x3d5bfb[_0x5e01('0x48')]);return db[_0x5e01('0x33')][_0x5e01('0x50')](_0x661d)[_0x5e01('0x18')](handleEntityNotFound(_0x389520,null))[_0x5e01('0x18')](respondWithResult(_0x389520,null))['catch'](handleError(_0x389520,null));};exports[_0x5e01('0x51')]=function(_0x506f08,_0x53545b){return db[_0x5e01('0x33')][_0x5e01('0x51')](_0x506f08['body'],{})[_0x5e01('0x18')](respondWithResult(_0x53545b,0xc9))[_0x5e01('0x22')](handleError(_0x53545b,null));};exports['update']=function(_0x16285c,_0x49fb3b){if(_0x16285c[_0x5e01('0x52')]['id']){delete _0x16285c[_0x5e01('0x52')]['id'];}return db[_0x5e01('0x33')][_0x5e01('0x50')]({'where':{'id':_0x16285c['params']['id']}})[_0x5e01('0x18')](handleEntityNotFound(_0x49fb3b,null))['then'](saveUpdates(_0x16285c['body'],null))[_0x5e01('0x18')](respondWithResult(_0x49fb3b,null))['catch'](handleError(_0x49fb3b,null));};exports['destroy']=function(_0x26863b,_0x119962){return db[_0x5e01('0x33')][_0x5e01('0x50')]({'where':{'id':_0x26863b[_0x5e01('0x4f')]['id']}})[_0x5e01('0x18')](handleEntityNotFound(_0x119962,null))[_0x5e01('0x18')](removeEntity(_0x119962,null))[_0x5e01('0x22')](handleError(_0x119962,null));};exports['getSubjects']=function(_0x15c7bb,_0x15227c,_0x58b3a2){var _0x9f5e19={};var _0x2f9869={};var _0x560ecd;var _0x258652;return db[_0x5e01('0x33')][_0x5e01('0x53')]({'where':{'id':_0x15c7bb[_0x5e01('0x4f')]['id']}})[_0x5e01('0x18')](handleEntityNotFound(_0x15227c,null))['then'](function(_0x1caf12){if(_0x1caf12){_0x560ecd=_0x1caf12;_0x2f9869[_0x5e01('0x3a')]=_[_0x5e01('0x38')](db['FreshsalesField'][_0x5e01('0x34')]);_0x2f9869['query']=_[_0x5e01('0x38')](_0x15c7bb[_0x5e01('0x37')]);_0x2f9869[_0x5e01('0x39')]=_[_0x5e01('0x3b')](_0x2f9869['model'],_0x2f9869['query']);_0x9f5e19[_0x5e01('0x3d')]=_[_0x5e01('0x3b')](_0x2f9869['model'],qs[_0x5e01('0x3c')](_0x15c7bb[_0x5e01('0x37')]['fields']));_0x9f5e19[_0x5e01('0x3d')]=_0x9f5e19[_0x5e01('0x3d')][_0x5e01('0x3e')]?_0x9f5e19[_0x5e01('0x3d')]:_0x2f9869[_0x5e01('0x3a')];_0x9f5e19['order']=qs['sort'](_0x15c7bb[_0x5e01('0x37')][_0x5e01('0x41')]);_0x9f5e19[_0x5e01('0x43')]=qs['filters'](_[_0x5e01('0x42')](_0x15c7bb['query'],_0x2f9869[_0x5e01('0x39')]));if(_0x15c7bb[_0x5e01('0x37')][_0x5e01('0x47')]){_0x9f5e19[_0x5e01('0x43')]=_['merge'](_0x9f5e19[_0x5e01('0x43')],{'$or':_[_0x5e01('0x32')](_0x9f5e19[_0x5e01('0x3d')],function(_0x49f357){var _0x545564={};_0x545564[_0x49f357]={'$like':'%'+_0x15c7bb[_0x5e01('0x37')][_0x5e01('0x47')]+'%'};return _0x545564;})});}_0x9f5e19=_['merge']({},_0x9f5e19,_0x15c7bb[_0x5e01('0x48')]);return _0x560ecd['getSubjects'](_0x9f5e19);}})[_0x5e01('0x18')](function(_0x32653d){if(_0x32653d){_0x258652=_0x32653d[_0x5e01('0x3e')];if(!_0x15c7bb['query'][_0x5e01('0x3f')](_0x5e01('0x54'))){_0x9f5e19[_0x5e01('0x27')]=qs['limit'](_0x15c7bb[_0x5e01('0x37')][_0x5e01('0x27')]);_0x9f5e19[_0x5e01('0x26')]=qs['offset'](_0x15c7bb['query'][_0x5e01('0x26')]);}return _0x560ecd['getSubjects'](_0x9f5e19);}})[_0x5e01('0x18')](function(_0x106162){if(_0x106162){return _0x106162?{'count':_0x258652,'rows':_0x106162}:null;}})[_0x5e01('0x18')](respondWithResult(_0x15227c,null))[_0x5e01('0x22')](handleError(_0x15227c,null));};exports['getDescriptions']=function(_0x53a93a,_0x96cd37,_0x588cb6){var _0x4ff9f4={};var _0x5b8320={};var _0xb38f5b;var _0x1832f3;return db[_0x5e01('0x33')][_0x5e01('0x53')]({'where':{'id':_0x53a93a[_0x5e01('0x4f')]['id']}})['then'](handleEntityNotFound(_0x96cd37,null))['then'](function(_0x35f391){if(_0x35f391){_0xb38f5b=_0x35f391;_0x5b8320[_0x5e01('0x3a')]=_['keys'](db[_0x5e01('0x55')][_0x5e01('0x34')]);_0x5b8320[_0x5e01('0x37')]=_[_0x5e01('0x38')](_0x53a93a['query']);_0x5b8320['filters']=_[_0x5e01('0x3b')](_0x5b8320[_0x5e01('0x3a')],_0x5b8320[_0x5e01('0x37')]);_0x4ff9f4[_0x5e01('0x3d')]=_[_0x5e01('0x3b')](_0x5b8320['model'],qs[_0x5e01('0x3c')](_0x53a93a['query'][_0x5e01('0x3c')]));_0x4ff9f4['attributes']=_0x4ff9f4[_0x5e01('0x3d')][_0x5e01('0x3e')]?_0x4ff9f4[_0x5e01('0x3d')]:_0x5b8320[_0x5e01('0x3a')];_0x4ff9f4[_0x5e01('0x40')]=qs['sort'](_0x53a93a[_0x5e01('0x37')][_0x5e01('0x41')]);_0x4ff9f4[_0x5e01('0x43')]=qs[_0x5e01('0x39')](_[_0x5e01('0x42')](_0x53a93a[_0x5e01('0x37')],_0x5b8320[_0x5e01('0x39')]));if(_0x53a93a['query']['filter']){_0x4ff9f4[_0x5e01('0x43')]=_['merge'](_0x4ff9f4[_0x5e01('0x43')],{'$or':_[_0x5e01('0x32')](_0x4ff9f4[_0x5e01('0x3d')],function(_0x242f0c){var _0x55d429={};_0x55d429[_0x242f0c]={'$like':'%'+_0x53a93a[_0x5e01('0x37')][_0x5e01('0x47')]+'%'};return _0x55d429;})});}_0x4ff9f4=_[_0x5e01('0x44')]({},_0x4ff9f4,_0x53a93a[_0x5e01('0x48')]);return _0xb38f5b[_0x5e01('0x56')](_0x4ff9f4);}})[_0x5e01('0x18')](function(_0x13b15d){if(_0x13b15d){_0x1832f3=_0x13b15d[_0x5e01('0x3e')];if(!_0x53a93a[_0x5e01('0x37')]['hasOwnProperty'](_0x5e01('0x54'))){_0x4ff9f4[_0x5e01('0x27')]=qs[_0x5e01('0x27')](_0x53a93a['query'][_0x5e01('0x27')]);_0x4ff9f4[_0x5e01('0x26')]=qs[_0x5e01('0x26')](_0x53a93a[_0x5e01('0x37')][_0x5e01('0x26')]);}return _0xb38f5b['getDescriptions'](_0x4ff9f4);}})['then'](function(_0x8f3cb2){if(_0x8f3cb2){return _0x8f3cb2?{'count':_0x1832f3,'rows':_0x8f3cb2}:null;}})['then'](respondWithResult(_0x96cd37,null))[_0x5e01('0x22')](handleError(_0x96cd37,null));};exports['getFields']=function(_0x4118cf,_0x8083a2,_0x4b9ec8){var _0xc597bc={};var _0x4c57af={};var _0xf4cb47;var _0x11706e;return db[_0x5e01('0x33')][_0x5e01('0x53')]({'where':{'id':_0x4118cf[_0x5e01('0x4f')]['id']}})['then'](handleEntityNotFound(_0x8083a2,null))['then'](function(_0x4c68fd){if(_0x4c68fd){_0xf4cb47=_0x4c68fd;_0x4c57af[_0x5e01('0x3a')]=_[_0x5e01('0x38')](db[_0x5e01('0x55')][_0x5e01('0x34')]);_0x4c57af[_0x5e01('0x37')]=_[_0x5e01('0x38')](_0x4118cf[_0x5e01('0x37')]);_0x4c57af['filters']=_[_0x5e01('0x3b')](_0x4c57af[_0x5e01('0x3a')],_0x4c57af[_0x5e01('0x37')]);_0xc597bc[_0x5e01('0x3d')]=_[_0x5e01('0x3b')](_0x4c57af[_0x5e01('0x3a')],qs[_0x5e01('0x3c')](_0x4118cf[_0x5e01('0x37')][_0x5e01('0x3c')]));_0xc597bc['attributes']=_0xc597bc[_0x5e01('0x3d')][_0x5e01('0x3e')]?_0xc597bc[_0x5e01('0x3d')]:_0x4c57af[_0x5e01('0x3a')];_0xc597bc[_0x5e01('0x40')]=qs[_0x5e01('0x41')](_0x4118cf[_0x5e01('0x37')][_0x5e01('0x41')]);_0xc597bc[_0x5e01('0x43')]=qs[_0x5e01('0x39')](_[_0x5e01('0x42')](_0x4118cf[_0x5e01('0x37')],_0x4c57af[_0x5e01('0x39')]));if(_0x4118cf[_0x5e01('0x37')][_0x5e01('0x47')]){_0xc597bc[_0x5e01('0x43')]=_[_0x5e01('0x44')](_0xc597bc['where'],{'$or':_[_0x5e01('0x32')](_0xc597bc[_0x5e01('0x3d')],function(_0x483a17){var _0x90c000={};_0x90c000[_0x483a17]={'$like':'%'+_0x4118cf['query'][_0x5e01('0x47')]+'%'};return _0x90c000;})});}_0xc597bc=_[_0x5e01('0x44')]({},_0xc597bc,_0x4118cf[_0x5e01('0x48')]);return _0xf4cb47[_0x5e01('0x57')](_0xc597bc);}})['then'](function(_0x5cc3d6){if(_0x5cc3d6){_0x11706e=_0x5cc3d6['length'];if(!_0x4118cf[_0x5e01('0x37')][_0x5e01('0x3f')](_0x5e01('0x54'))){_0xc597bc[_0x5e01('0x27')]=qs[_0x5e01('0x27')](_0x4118cf['query'][_0x5e01('0x27')]);_0xc597bc[_0x5e01('0x26')]=qs['offset'](_0x4118cf[_0x5e01('0x37')][_0x5e01('0x26')]);}return _0xf4cb47['getFields'](_0xc597bc);}})[_0x5e01('0x18')](function(_0x1485c7){if(_0x1485c7){return _0x1485c7?{'count':_0x11706e,'rows':_0x1485c7}:null;}})['then'](respondWithResult(_0x8083a2,null))[_0x5e01('0x22')](handleError(_0x8083a2,null));}; \ No newline at end of file +var _0xd13e=['attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','params','keys','length','find','create','update','body','getSubjects','getDescriptions','findOne','FreshsalesField','getFields','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','ValidationError','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','FreshsalesConfiguration','rawAttributes','type','key','model','map','query','intersection','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd13e,0x193));var _0xed13=function(_0x50e4ac,_0x3f82ae){_0x50e4ac=_0x50e4ac-0x0;var _0x430fcc=_0xd13e[_0x50e4ac];return _0x430fcc;};'use strict';var pdf=require(_0xed13('0x0'));var emlformat=require(_0xed13('0x1'));var rimraf=require(_0xed13('0x2'));var zipdir=require(_0xed13('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed13('0x4'));var moment=require('moment');var BPromise=require(_0xed13('0x5'));var Mustache=require('mustache');var util=require(_0xed13('0x6'));var path=require(_0xed13('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xed13('0x8'));var squel=require(_0xed13('0x9'));var crypto=require(_0xed13('0xa'));var jsforce=require(_0xed13('0xb'));var deskjs=require(_0xed13('0xc'));var toCsv=require(_0xed13('0xd'));var querystring=require(_0xed13('0xe'));var Papa=require(_0xed13('0xf'));var Redis=require(_0xed13('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xed13('0x11'));var as=require(_0xed13('0x12'));var hardwareService=require(_0xed13('0x13'));var logger=require(_0xed13('0x14'))(_0xed13('0x15'));var utils=require('../../config/utils');var config=require(_0xed13('0x16'));var db=require(_0xed13('0x17'))['db'];var jayson=require(_0xed13('0x18'));var client=jayson[_0xed13('0x19')][_0xed13('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3295ba,_0x5b950a,_0xdee482){if(_0xdee482){var _0x4a3ff4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4a3ff4[_0xed13('0x1b')](_0x5b950a)){return _0x3295ba;}else{throw new db['Sequelize'][(_0xed13('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3295ba;}}function respondWithRpcPromise(_0x1de882,_0x4d5435,_0x38901a,_0xf900d2){return new BPromise(function(_0x1d3d67,_0xa260ed){var _0x1d0ebf=_0xf900d2||client;return _0x1d0ebf[_0xed13('0x1d')](_0x1de882,_0x38901a)[_0xed13('0x1e')](function(_0x1148a3){logger[_0xed13('0x1f')](_0xed13('0x20'),_0x4d5435,_0xed13('0x21'));logger[_0xed13('0x22')](_0xed13('0x23'),_0x4d5435,_0xed13('0x21'),JSON[_0xed13('0x24')](_0x1148a3));if(_0x1148a3[_0xed13('0x25')]){if(_0x1148a3['error']['code']===0x1f4){logger[_0xed13('0x25')](_0xed13('0x20'),_0x4d5435,_0x1148a3['error'][_0xed13('0x26')]);return _0xa260ed(_0x1148a3['error']['message']);}logger[_0xed13('0x25')](_0xed13('0x20'),_0x4d5435,_0x1148a3[_0xed13('0x25')][_0xed13('0x26')]);return _0x1d3d67(_0x1148a3[_0xed13('0x25')][_0xed13('0x26')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x4d5435,'request\x20sent');_0x1d3d67(_0x1148a3[_0xed13('0x27')][_0xed13('0x26')]);}})[_0xed13('0x28')](function(_0x3898d9){logger[_0xed13('0x25')](_0xed13('0x20'),_0x4d5435,_0x3898d9);_0xa260ed(_0x3898d9);});});}function respondWithStatusCode(_0x1f0405,_0x276c57){_0x276c57=_0x276c57||0xcc;return function(_0x2410e2){if(_0x2410e2){return _0x1f0405[_0xed13('0x29')](_0x276c57);}return _0x1f0405[_0xed13('0x2a')](_0x276c57)[_0xed13('0x2b')]();};}function respondWithResult(_0x2c6c33,_0x322fc3){_0x322fc3=_0x322fc3||0xc8;return function(_0x4e03d1){if(_0x4e03d1){return _0x2c6c33['status'](_0x322fc3)[_0xed13('0x2c')](_0x4e03d1);}};}function respondWithFilteredResult(_0x2ebdf6,_0x55a1f2){return function(_0x226a9b){if(_0x226a9b){var _0x40444a=_0x226a9b[_0xed13('0x2d')],_0x4ed119=_0x55a1f2['offset'],_0x7ce996=_0x55a1f2[_0xed13('0x2e')]+_0x55a1f2[_0xed13('0x2f')],_0x2066ca;if(_0x7ce996>=_0x40444a){_0x7ce996=_0x40444a;_0x2066ca=0xc8;}else{_0x2066ca=0xce;}_0x2ebdf6['status'](_0x2066ca);return _0x2ebdf6[_0xed13('0x30')](_0xed13('0x31'),_0x4ed119+'-'+_0x7ce996+'/'+_0x40444a)['json'](_0x226a9b);}return null;};}function patchUpdates(_0x11cb93){return function(_0x43c061){try{jsonpatch[_0xed13('0x32')](_0x43c061,_0x11cb93,!![]);}catch(_0x2758f0){return BPromise[_0xed13('0x33')](_0x2758f0);}return _0x43c061[_0xed13('0x34')]();};}function saveUpdates(_0xe332,_0x5b3828){return function(_0x7ee14a){if(_0x7ee14a){return _0x7ee14a['update'](_0xe332)['then'](function(_0x3ac2f7){return _0x3ac2f7;});}return null;};}function removeEntity(_0x378fd3,_0x13e3bb){return function(_0x48c4e9){if(_0x48c4e9){return _0x48c4e9[_0xed13('0x35')]()[_0xed13('0x1e')](function(){_0x378fd3[_0xed13('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f5abf,_0x1c6070){return function(_0x2d1bb7){if(!_0x2d1bb7){_0x2f5abf[_0xed13('0x29')](0x194);}return _0x2d1bb7;};}function handleError(_0x5b8fee,_0x1b7001){_0x1b7001=_0x1b7001||0x1f4;return function(_0x409461){logger[_0xed13('0x25')](_0x409461[_0xed13('0x36')]);if(_0x409461[_0xed13('0x37')]){delete _0x409461[_0xed13('0x37')];}_0x5b8fee[_0xed13('0x2a')](_0x1b7001)[_0xed13('0x38')](_0x409461);};}exports[_0xed13('0x39')]=function(_0x358b32,_0x5a09e4){var _0x2342a5={},_0x31f6e5={},_0x59384b={'count':0x0,'rows':[]};var _0x59218d=_['map'](db[_0xed13('0x3a')][_0xed13('0x3b')],function(_0x53df17){return{'name':_0x53df17['fieldName'],'type':_0x53df17[_0xed13('0x3c')][_0xed13('0x3d')]};});_0x31f6e5[_0xed13('0x3e')]=_[_0xed13('0x3f')](_0x59218d,_0xed13('0x37'));_0x31f6e5['query']=_['keys'](_0x358b32[_0xed13('0x40')]);_0x31f6e5['filters']=_[_0xed13('0x41')](_0x31f6e5['model'],_0x31f6e5[_0xed13('0x40')]);_0x2342a5['attributes']=_['intersection'](_0x31f6e5['model'],qs[_0xed13('0x42')](_0x358b32[_0xed13('0x40')][_0xed13('0x42')]));_0x2342a5[_0xed13('0x43')]=_0x2342a5[_0xed13('0x43')]['length']?_0x2342a5[_0xed13('0x43')]:_0x31f6e5[_0xed13('0x3e')];if(!_0x358b32[_0xed13('0x40')][_0xed13('0x44')](_0xed13('0x45'))){_0x2342a5['limit']=qs[_0xed13('0x2f')](_0x358b32[_0xed13('0x40')][_0xed13('0x2f')]);_0x2342a5[_0xed13('0x2e')]=qs[_0xed13('0x2e')](_0x358b32[_0xed13('0x40')]['offset']);}_0x2342a5[_0xed13('0x46')]=qs[_0xed13('0x47')](_0x358b32[_0xed13('0x40')][_0xed13('0x47')]);_0x2342a5[_0xed13('0x48')]=qs[_0xed13('0x49')](_[_0xed13('0x4a')](_0x358b32[_0xed13('0x40')],_0x31f6e5[_0xed13('0x49')]));if(_0x358b32[_0xed13('0x40')][_0xed13('0x4b')]){_0x2342a5[_0xed13('0x48')]=_[_0xed13('0x4c')](_0x2342a5[_0xed13('0x48')],{'$or':_['map'](_0x59218d,function(_0x1ee94a){if(_0x1ee94a[_0xed13('0x3c')]!=='VIRTUAL'){var _0x18408c={};_0x18408c[_0x1ee94a[_0xed13('0x37')]]={'$like':'%'+_0x358b32[_0xed13('0x40')]['filter']+'%'};return _0x18408c;}})});}_0x2342a5=_[_0xed13('0x4c')]({},_0x2342a5,_0x358b32[_0xed13('0x4d')]);var _0x3ba48c={'where':_0x2342a5['where']};return db['FreshsalesConfiguration'][_0xed13('0x2d')](_0x3ba48c)[_0xed13('0x1e')](function(_0x576ed9){_0x59384b[_0xed13('0x2d')]=_0x576ed9;if(_0x358b32[_0xed13('0x40')][_0xed13('0x4e')]){_0x2342a5[_0xed13('0x4f')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xed13('0x50')](_0x2342a5);})[_0xed13('0x1e')](function(_0x1cec16){_0x59384b[_0xed13('0x51')]=_0x1cec16;return _0x59384b;})['then'](respondWithFilteredResult(_0x5a09e4,_0x2342a5))[_0xed13('0x28')](handleError(_0x5a09e4,null));};exports['show']=function(_0x46dcef,_0x50d12f){var _0x5a0828={'raw':![],'where':{'id':_0x46dcef[_0xed13('0x52')]['id']}},_0x45f643={};_0x45f643['model']=_[_0xed13('0x53')](db[_0xed13('0x3a')][_0xed13('0x3b')]);_0x45f643[_0xed13('0x40')]=_['keys'](_0x46dcef[_0xed13('0x40')]);_0x45f643['filters']=_[_0xed13('0x41')](_0x45f643[_0xed13('0x3e')],_0x45f643[_0xed13('0x40')]);_0x5a0828[_0xed13('0x43')]=_[_0xed13('0x41')](_0x45f643[_0xed13('0x3e')],qs[_0xed13('0x42')](_0x46dcef[_0xed13('0x40')]['fields']));_0x5a0828[_0xed13('0x43')]=_0x5a0828[_0xed13('0x43')][_0xed13('0x54')]?_0x5a0828[_0xed13('0x43')]:_0x45f643['model'];if(_0x46dcef[_0xed13('0x40')]['includeAll']){_0x5a0828[_0xed13('0x4f')]=[{'all':!![]}];}_0x5a0828=_['merge']({},_0x5a0828,_0x46dcef['options']);return db['FreshsalesConfiguration'][_0xed13('0x55')](_0x5a0828)[_0xed13('0x1e')](handleEntityNotFound(_0x50d12f,null))[_0xed13('0x1e')](respondWithResult(_0x50d12f,null))['catch'](handleError(_0x50d12f,null));};exports[_0xed13('0x56')]=function(_0x3b72b4,_0x20dafb){return db[_0xed13('0x3a')][_0xed13('0x56')](_0x3b72b4['body'],{})[_0xed13('0x1e')](respondWithResult(_0x20dafb,0xc9))[_0xed13('0x28')](handleError(_0x20dafb,null));};exports[_0xed13('0x57')]=function(_0x442e84,_0x5eff1b){if(_0x442e84[_0xed13('0x58')]['id']){delete _0x442e84[_0xed13('0x58')]['id'];}return db[_0xed13('0x3a')][_0xed13('0x55')]({'where':{'id':_0x442e84[_0xed13('0x52')]['id']}})[_0xed13('0x1e')](handleEntityNotFound(_0x5eff1b,null))[_0xed13('0x1e')](saveUpdates(_0x442e84['body'],null))[_0xed13('0x1e')](respondWithResult(_0x5eff1b,null))['catch'](handleError(_0x5eff1b,null));};exports[_0xed13('0x35')]=function(_0x5c83f3,_0x1b736f){return db[_0xed13('0x3a')][_0xed13('0x55')]({'where':{'id':_0x5c83f3[_0xed13('0x52')]['id']}})[_0xed13('0x1e')](handleEntityNotFound(_0x1b736f,null))['then'](removeEntity(_0x1b736f,null))['catch'](handleError(_0x1b736f,null));};exports[_0xed13('0x59')]=function(_0x380b62,_0xe2ae5d,_0x1d6de4){var _0x3c9a51={};var _0xb0e307={};var _0xddd16a;var _0x318851;return db[_0xed13('0x3a')]['findOne']({'where':{'id':_0x380b62['params']['id']}})['then'](handleEntityNotFound(_0xe2ae5d,null))[_0xed13('0x1e')](function(_0x292b9b){if(_0x292b9b){_0xddd16a=_0x292b9b;_0xb0e307[_0xed13('0x3e')]=_['keys'](db['FreshsalesField'][_0xed13('0x3b')]);_0xb0e307[_0xed13('0x40')]=_[_0xed13('0x53')](_0x380b62['query']);_0xb0e307['filters']=_['intersection'](_0xb0e307['model'],_0xb0e307[_0xed13('0x40')]);_0x3c9a51[_0xed13('0x43')]=_[_0xed13('0x41')](_0xb0e307['model'],qs[_0xed13('0x42')](_0x380b62[_0xed13('0x40')]['fields']));_0x3c9a51[_0xed13('0x43')]=_0x3c9a51[_0xed13('0x43')][_0xed13('0x54')]?_0x3c9a51[_0xed13('0x43')]:_0xb0e307[_0xed13('0x3e')];_0x3c9a51[_0xed13('0x46')]=qs[_0xed13('0x47')](_0x380b62[_0xed13('0x40')][_0xed13('0x47')]);_0x3c9a51['where']=qs[_0xed13('0x49')](_[_0xed13('0x4a')](_0x380b62[_0xed13('0x40')],_0xb0e307[_0xed13('0x49')]));if(_0x380b62['query']['filter']){_0x3c9a51['where']=_[_0xed13('0x4c')](_0x3c9a51[_0xed13('0x48')],{'$or':_[_0xed13('0x3f')](_0x3c9a51[_0xed13('0x43')],function(_0x1f3007){var _0x5fbb3a={};_0x5fbb3a[_0x1f3007]={'$like':'%'+_0x380b62[_0xed13('0x40')][_0xed13('0x4b')]+'%'};return _0x5fbb3a;})});}_0x3c9a51=_[_0xed13('0x4c')]({},_0x3c9a51,_0x380b62[_0xed13('0x4d')]);return _0xddd16a[_0xed13('0x59')](_0x3c9a51);}})[_0xed13('0x1e')](function(_0x2a17eb){if(_0x2a17eb){_0x318851=_0x2a17eb[_0xed13('0x54')];if(!_0x380b62[_0xed13('0x40')][_0xed13('0x44')]('nolimit')){_0x3c9a51[_0xed13('0x2f')]=qs[_0xed13('0x2f')](_0x380b62[_0xed13('0x40')][_0xed13('0x2f')]);_0x3c9a51[_0xed13('0x2e')]=qs[_0xed13('0x2e')](_0x380b62[_0xed13('0x40')]['offset']);}return _0xddd16a['getSubjects'](_0x3c9a51);}})[_0xed13('0x1e')](function(_0x2b5cf3){if(_0x2b5cf3){return _0x2b5cf3?{'count':_0x318851,'rows':_0x2b5cf3}:null;}})[_0xed13('0x1e')](respondWithResult(_0xe2ae5d,null))[_0xed13('0x28')](handleError(_0xe2ae5d,null));};exports[_0xed13('0x5a')]=function(_0x54f348,_0x487329,_0x34f24b){var _0x2b1285={};var _0x25cbd2={};var _0x3d80ec;var _0x60b490;return db['FreshsalesConfiguration'][_0xed13('0x5b')]({'where':{'id':_0x54f348[_0xed13('0x52')]['id']}})[_0xed13('0x1e')](handleEntityNotFound(_0x487329,null))[_0xed13('0x1e')](function(_0x33f74e){if(_0x33f74e){_0x3d80ec=_0x33f74e;_0x25cbd2[_0xed13('0x3e')]=_[_0xed13('0x53')](db[_0xed13('0x5c')][_0xed13('0x3b')]);_0x25cbd2[_0xed13('0x40')]=_[_0xed13('0x53')](_0x54f348[_0xed13('0x40')]);_0x25cbd2[_0xed13('0x49')]=_[_0xed13('0x41')](_0x25cbd2['model'],_0x25cbd2[_0xed13('0x40')]);_0x2b1285[_0xed13('0x43')]=_[_0xed13('0x41')](_0x25cbd2[_0xed13('0x3e')],qs['fields'](_0x54f348['query'][_0xed13('0x42')]));_0x2b1285['attributes']=_0x2b1285[_0xed13('0x43')][_0xed13('0x54')]?_0x2b1285['attributes']:_0x25cbd2['model'];_0x2b1285[_0xed13('0x46')]=qs[_0xed13('0x47')](_0x54f348[_0xed13('0x40')][_0xed13('0x47')]);_0x2b1285[_0xed13('0x48')]=qs['filters'](_[_0xed13('0x4a')](_0x54f348[_0xed13('0x40')],_0x25cbd2[_0xed13('0x49')]));if(_0x54f348[_0xed13('0x40')][_0xed13('0x4b')]){_0x2b1285['where']=_[_0xed13('0x4c')](_0x2b1285[_0xed13('0x48')],{'$or':_[_0xed13('0x3f')](_0x2b1285['attributes'],function(_0x31b065){var _0xf52bd5={};_0xf52bd5[_0x31b065]={'$like':'%'+_0x54f348['query'][_0xed13('0x4b')]+'%'};return _0xf52bd5;})});}_0x2b1285=_['merge']({},_0x2b1285,_0x54f348['options']);return _0x3d80ec[_0xed13('0x5a')](_0x2b1285);}})[_0xed13('0x1e')](function(_0x48d513){if(_0x48d513){_0x60b490=_0x48d513[_0xed13('0x54')];if(!_0x54f348[_0xed13('0x40')][_0xed13('0x44')](_0xed13('0x45'))){_0x2b1285[_0xed13('0x2f')]=qs['limit'](_0x54f348[_0xed13('0x40')][_0xed13('0x2f')]);_0x2b1285[_0xed13('0x2e')]=qs[_0xed13('0x2e')](_0x54f348['query'][_0xed13('0x2e')]);}return _0x3d80ec[_0xed13('0x5a')](_0x2b1285);}})[_0xed13('0x1e')](function(_0x133310){if(_0x133310){return _0x133310?{'count':_0x60b490,'rows':_0x133310}:null;}})[_0xed13('0x1e')](respondWithResult(_0x487329,null))[_0xed13('0x28')](handleError(_0x487329,null));};exports['getFields']=function(_0x303bd9,_0x44a3f3,_0x4b62d5){var _0x48e0a6={};var _0xcc66ef={};var _0x13b49e;var _0x29ce69;return db[_0xed13('0x3a')][_0xed13('0x5b')]({'where':{'id':_0x303bd9[_0xed13('0x52')]['id']}})[_0xed13('0x1e')](handleEntityNotFound(_0x44a3f3,null))['then'](function(_0x45f398){if(_0x45f398){_0x13b49e=_0x45f398;_0xcc66ef['model']=_['keys'](db[_0xed13('0x5c')][_0xed13('0x3b')]);_0xcc66ef[_0xed13('0x40')]=_[_0xed13('0x53')](_0x303bd9[_0xed13('0x40')]);_0xcc66ef['filters']=_[_0xed13('0x41')](_0xcc66ef['model'],_0xcc66ef['query']);_0x48e0a6[_0xed13('0x43')]=_['intersection'](_0xcc66ef['model'],qs[_0xed13('0x42')](_0x303bd9[_0xed13('0x40')][_0xed13('0x42')]));_0x48e0a6[_0xed13('0x43')]=_0x48e0a6[_0xed13('0x43')][_0xed13('0x54')]?_0x48e0a6[_0xed13('0x43')]:_0xcc66ef[_0xed13('0x3e')];_0x48e0a6[_0xed13('0x46')]=qs[_0xed13('0x47')](_0x303bd9['query']['sort']);_0x48e0a6['where']=qs[_0xed13('0x49')](_['pick'](_0x303bd9['query'],_0xcc66ef[_0xed13('0x49')]));if(_0x303bd9[_0xed13('0x40')][_0xed13('0x4b')]){_0x48e0a6[_0xed13('0x48')]=_['merge'](_0x48e0a6[_0xed13('0x48')],{'$or':_['map'](_0x48e0a6[_0xed13('0x43')],function(_0x535b5d){var _0x1f5466={};_0x1f5466[_0x535b5d]={'$like':'%'+_0x303bd9[_0xed13('0x40')]['filter']+'%'};return _0x1f5466;})});}_0x48e0a6=_['merge']({},_0x48e0a6,_0x303bd9['options']);return _0x13b49e[_0xed13('0x5d')](_0x48e0a6);}})[_0xed13('0x1e')](function(_0x3cb4ec){if(_0x3cb4ec){_0x29ce69=_0x3cb4ec[_0xed13('0x54')];if(!_0x303bd9['query']['hasOwnProperty']('nolimit')){_0x48e0a6['limit']=qs[_0xed13('0x2f')](_0x303bd9[_0xed13('0x40')]['limit']);_0x48e0a6[_0xed13('0x2e')]=qs[_0xed13('0x2e')](_0x303bd9[_0xed13('0x40')]['offset']);}return _0x13b49e['getFields'](_0x48e0a6);}})[_0xed13('0x1e')](function(_0x15b49d){if(_0x15b49d){return _0x15b49d?{'count':_0x29ce69,'rows':_0x15b49d}:null;}})[_0xed13('0x1e')](respondWithResult(_0x44a3f3,null))[_0xed13('0x28')](handleError(_0x44a3f3,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 7149b40..b30c5bf 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabc7=['util','../../config/logger','moment','bluebird','request-promise','path','./intFreshsalesConfiguration.attributes','exports','int_freshsales_configurations','lodash'];(function(_0x4aa648,_0x34b997){var _0x2c1319=function(_0x35ec75){while(--_0x35ec75){_0x4aa648['push'](_0x4aa648['shift']());}};_0x2c1319(++_0x34b997);}(_0xabc7,0xc7));var _0x7abc=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xabc7[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0x7abc('0x0'));var util=require(_0x7abc('0x1'));var logger=require(_0x7abc('0x2'))('api');var moment=require(_0x7abc('0x3'));var BPromise=require(_0x7abc('0x4'));var rp=require(_0x7abc('0x5'));var fs=require('fs');var path=require(_0x7abc('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7abc('0x7'));module[_0x7abc('0x8')]=function(_0x542c09,_0x226476){return _0x542c09['define']('FreshsalesConfiguration',attributes,{'tableName':_0x7abc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x175e=['moment','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api'];(function(_0x16a223,_0x31b6e8){var _0x5ded66=function(_0x25eb5f){while(--_0x25eb5f){_0x16a223['push'](_0x16a223['shift']());}};_0x5ded66(++_0x31b6e8);}(_0x175e,0xe6));var _0xe175=function(_0xded423,_0x4bf7d7){_0xded423=_0xded423-0x0;var _0x2bc980=_0x175e[_0xded423];return _0x2bc980;};'use strict';var _=require(_0xe175('0x0'));var util=require(_0xe175('0x1'));var logger=require(_0xe175('0x2'))(_0xe175('0x3'));var moment=require(_0xe175('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe175('0x5'));var rimraf=require(_0xe175('0x6'));var config=require(_0xe175('0x7'));var attributes=require(_0xe175('0x8'));module[_0xe175('0x9')]=function(_0x278a8d,_0x7eba){return _0x278a8d[_0xe175('0xa')](_0xe175('0xb'),attributes,{'tableName':_0xe175('0xc'),'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 fbc60ad..2a71245 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 _0x4bde=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','info','result'];(function(_0x461886,_0x4fc171){var _0x295e0a=function(_0x451524){while(--_0x451524){_0x461886['push'](_0x461886['shift']());}};_0x295e0a(++_0x4fc171);}(_0x4bde,0x1b1));var _0xe4bd=function(_0x15fbb3,_0x237441){_0x15fbb3=_0x15fbb3-0x0;var _0xfb55f2=_0x4bde[_0x15fbb3];return _0xfb55f2;};'use strict';var _=require(_0xe4bd('0x0'));var util=require(_0xe4bd('0x1'));var moment=require(_0xe4bd('0x2'));var BPromise=require('bluebird');var rs=require(_0xe4bd('0x3'));var fs=require('fs');var Redis=require(_0xe4bd('0x4'));var db=require(_0xe4bd('0x5'))['db'];var utils=require(_0xe4bd('0x6'));var logger=require('../../config/logger')(_0xe4bd('0x7'));var config=require(_0xe4bd('0x8'));var jayson=require(_0xe4bd('0x9'));var client=jayson[_0xe4bd('0xa')][_0xe4bd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4008eb,_0x4c933b,_0x2cf33d){return new BPromise(function(_0xbd04ce,_0x262295){return client[_0xe4bd('0xc')](_0x4008eb,_0x2cf33d)[_0xe4bd('0xd')](function(_0x3ef7e7){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x4c933b,'request\x20sent');logger[_0xe4bd('0xe')](_0xe4bd('0xf'),_0x4c933b,_0xe4bd('0x10'),JSON['stringify'](_0x3ef7e7));if(_0x3ef7e7[_0xe4bd('0x11')]){if(_0x3ef7e7[_0xe4bd('0x11')][_0xe4bd('0x12')]===0x1f4){logger[_0xe4bd('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4c933b,_0x3ef7e7[_0xe4bd('0x11')]['message']);return _0x262295(_0x3ef7e7[_0xe4bd('0x11')]['message']);}logger[_0xe4bd('0x11')](_0xe4bd('0x13'),_0x4c933b,_0x3ef7e7[_0xe4bd('0x11')][_0xe4bd('0x14')]);return _0xbd04ce(_0x3ef7e7[_0xe4bd('0x11')][_0xe4bd('0x14')]);}else{logger[_0xe4bd('0x15')](_0xe4bd('0x13'),_0x4c933b,_0xe4bd('0x10'));_0xbd04ce(_0x3ef7e7[_0xe4bd('0x16')][_0xe4bd('0x14')]);}})[_0xe4bd('0x17')](function(_0x470cd1){logger['error'](_0xe4bd('0x13'),_0x4c933b,_0x470cd1);_0x262295(_0x470cd1);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x4431eb,_0x49d4d0){var _0x7eec85=function(_0x531ac0){while(--_0x531ac0){_0x4431eb['push'](_0x4431eb['shift']());}};_0x7eec85(++_0x49d4d0);}(_0xaa88,0x137));var _0x8aa8=function(_0x2e6c19,_0x131233){_0x2e6c19=_0x2e6c19-0x0;var _0x52885d=_0xaa88[_0x2e6c19];return _0x52885d;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 0047357..05f73ad 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 _0xdceb=['multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post','put','update','destroy','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdceb,0x11d));var _0xbdce=function(_0x58e5d7,_0x286b21){_0x58e5d7=_0x58e5d7-0x0;var _0x225894=_0xdceb[_0x58e5d7];return _0x225894;};'use strict';var multer=require(_0xbdce('0x0'));var util=require(_0xbdce('0x1'));var path=require(_0xbdce('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xbdce('0x3'));var interaction=require(_0xbdce('0x4'));var config=require(_0xbdce('0x5'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0xbdce('0x6')](),controller['index']);router[_0xbdce('0x7')](_0xbdce('0x8'),auth['isAuthenticated'](),controller[_0xbdce('0x9')]);router[_0xbdce('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbdce('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xbdce('0xc')]);router['delete'](_0xbdce('0x8'),auth[_0xbdce('0x6')](),controller[_0xbdce('0xd')]);module[_0xbdce('0xe')]=router; \ No newline at end of file +var _0x9abc=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id','post','create','update','delete','destroy'];(function(_0x45e84a,_0x3bc839){var _0x3bd45f=function(_0x9616a7){while(--_0x9616a7){_0x45e84a['push'](_0x45e84a['shift']());}};_0x3bd45f(++_0x3bc839);}(_0x9abc,0x19e));var _0xc9ab=function(_0x3bb805,_0x14289a){_0x3bb805=_0x3bb805-0x0;var _0x2869ed=_0x9abc[_0x3bb805];return _0x2869ed;};'use strict';var multer=require(_0xc9ab('0x0'));var util=require(_0xc9ab('0x1'));var path=require(_0xc9ab('0x2'));var timeout=require(_0xc9ab('0x3'));var express=require(_0xc9ab('0x4'));var router=express[_0xc9ab('0x5')]();var auth=require(_0xc9ab('0x6'));var interaction=require(_0xc9ab('0x7'));var config=require(_0xc9ab('0x8'));var controller=require(_0xc9ab('0x9'));router[_0xc9ab('0xa')]('/',auth[_0xc9ab('0xb')](),controller['index']);router[_0xc9ab('0xa')](_0xc9ab('0xc'),auth[_0xc9ab('0xb')](),controller['show']);router[_0xc9ab('0xd')]('/',auth[_0xc9ab('0xb')](),controller[_0xc9ab('0xe')]);router['put']('/:id',auth[_0xc9ab('0xb')](),controller[_0xc9ab('0xf')]);router[_0xc9ab('0x10')](_0xc9ab('0xc'),auth[_0xc9ab('0xb')](),controller[_0xc9ab('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 8d0c620..aa01f6e 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 _0x9828=['customVariable','STRING','ENUM','BOOLEAN','exports','string','variable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9828,0x1af));var _0x8982=function(_0x2f161a,_0x33cb2c){_0x2f161a=_0x2f161a-0x0;var _0x498475=_0x9828[_0x2f161a];return _0x498475;};'use strict';var Sequelize=require('sequelize');module[_0x8982('0x0')]={'type':{'type':Sequelize['ENUM'](_0x8982('0x1'),_0x8982('0x2'),_0x8982('0x3'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8982('0x4')]},'keyType':{'type':Sequelize[_0x8982('0x5')](_0x8982('0x1'),_0x8982('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x8982('0x4')]},'idField':{'type':Sequelize[_0x8982('0x4')]},'nameField':{'type':Sequelize[_0x8982('0x4')]},'customField':{'type':Sequelize[_0x8982('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8982('0x4')]}}; \ No newline at end of file +var _0x06c5=['customVariable','keyValue','STRING','sequelize','exports','ENUM','string'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x06c5,0x88));var _0x506c=function(_0xf92d52,_0x59a2f2){_0xf92d52=_0xf92d52-0x0;var _0x56cf67=_0x06c5[_0xf92d52];return _0x56cf67;};'use strict';var Sequelize=require(_0x506c('0x0'));module[_0x506c('0x1')]={'type':{'type':Sequelize[_0x506c('0x2')](_0x506c('0x3'),'variable',_0x506c('0x4'),_0x506c('0x5')),'defaultValue':_0x506c('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x506c('0x2')](_0x506c('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x506c('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x506c('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 792177b..53533e2 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 _0x39cb=['filter','merge','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','FreshsalesField','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x39cb,0x1bd));var _0xb39c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x39cb[_0x19950b];return _0x3c6b41;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb39c('0x0'));var rimraf=require(_0xb39c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb39c('0x2'));var rp=require(_0xb39c('0x3'));var moment=require('moment');var BPromise=require(_0xb39c('0x4'));var Mustache=require(_0xb39c('0x5'));var util=require(_0xb39c('0x6'));var path=require(_0xb39c('0x7'));var sox=require(_0xb39c('0x8'));var csv=require('to-csv');var ejs=require(_0xb39c('0x9'));var fs=require('fs');var _=require(_0xb39c('0xa'));var squel=require(_0xb39c('0xb'));var crypto=require(_0xb39c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb39c('0xd'));var querystring=require(_0xb39c('0xe'));var Papa=require(_0xb39c('0xf'));var Redis=require(_0xb39c('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb39c('0x11'));var logger=require(_0xb39c('0x12'))(_0xb39c('0x13'));var utils=require(_0xb39c('0x14'));var config=require(_0xb39c('0x15'));var db=require(_0xb39c('0x16'))['db'];function respondWithStatusCode(_0x2a5c79,_0x18d12e){_0x18d12e=_0x18d12e||0xcc;return function(_0x51ff24){if(_0x51ff24){return _0x2a5c79[_0xb39c('0x17')](_0x18d12e);}return _0x2a5c79[_0xb39c('0x18')](_0x18d12e)[_0xb39c('0x19')]();};}function respondWithResult(_0x5e4caf,_0xf4662a){_0xf4662a=_0xf4662a||0xc8;return function(_0x40a6d3){if(_0x40a6d3){return _0x5e4caf[_0xb39c('0x18')](_0xf4662a)[_0xb39c('0x1a')](_0x40a6d3);}};}function respondWithFilteredResult(_0x469fa9,_0x27c22a){return function(_0x8e9181){if(_0x8e9181){var _0x5277ce=_0x8e9181[_0xb39c('0x1b')],_0x316c9b=_0x27c22a[_0xb39c('0x1c')],_0x3223f6=_0x27c22a[_0xb39c('0x1c')]+_0x27c22a[_0xb39c('0x1d')],_0x10989d;if(_0x3223f6>=_0x5277ce){_0x3223f6=_0x5277ce;_0x10989d=0xc8;}else{_0x10989d=0xce;}_0x469fa9[_0xb39c('0x18')](_0x10989d);return _0x469fa9[_0xb39c('0x1e')](_0xb39c('0x1f'),_0x316c9b+'-'+_0x3223f6+'/'+_0x5277ce)['json'](_0x8e9181);}return null;};}function patchUpdates(_0x1d2f49){return function(_0x1a8e12){try{jsonpatch[_0xb39c('0x20')](_0x1a8e12,_0x1d2f49,!![]);}catch(_0x447352){return BPromise['reject'](_0x447352);}return _0x1a8e12[_0xb39c('0x21')]();};}function saveUpdates(_0x2da46a,_0x5e4a0b){return function(_0x2d8e93){if(_0x2d8e93){return _0x2d8e93[_0xb39c('0x22')](_0x2da46a)[_0xb39c('0x23')](function(_0x4ebfca){return _0x4ebfca;});}return null;};}function removeEntity(_0x539d27,_0x2789fd){return function(_0x1a5b9d){if(_0x1a5b9d){return _0x1a5b9d[_0xb39c('0x24')]()['then'](function(){_0x539d27[_0xb39c('0x18')](0xcc)[_0xb39c('0x19')]();});}};}function handleEntityNotFound(_0x1bb895,_0x16f3b0){return function(_0x3b03ed){if(!_0x3b03ed){_0x1bb895['sendStatus'](0x194);}return _0x3b03ed;};}function handleError(_0x3036f5,_0xbeab7e){_0xbeab7e=_0xbeab7e||0x1f4;return function(_0x583ee5){logger[_0xb39c('0x25')](_0x583ee5[_0xb39c('0x26')]);if(_0x583ee5[_0xb39c('0x27')]){delete _0x583ee5[_0xb39c('0x27')];}_0x3036f5[_0xb39c('0x18')](_0xbeab7e)['send'](_0x583ee5);};}exports[_0xb39c('0x28')]=function(_0x299c27,_0x132769){var _0x4c06fa={},_0x41fff2={},_0x337532={'count':0x0,'rows':[]};var _0x52eb5e=_[_0xb39c('0x29')](db[_0xb39c('0x2a')][_0xb39c('0x2b')],function(_0x4e9672){return{'name':_0x4e9672[_0xb39c('0x2c')],'type':_0x4e9672[_0xb39c('0x2d')]['key']};});_0x41fff2[_0xb39c('0x2e')]=_['map'](_0x52eb5e,_0xb39c('0x27'));_0x41fff2[_0xb39c('0x2f')]=_[_0xb39c('0x30')](_0x299c27[_0xb39c('0x2f')]);_0x41fff2[_0xb39c('0x31')]=_['intersection'](_0x41fff2[_0xb39c('0x2e')],_0x41fff2['query']);_0x4c06fa[_0xb39c('0x32')]=_['intersection'](_0x41fff2[_0xb39c('0x2e')],qs[_0xb39c('0x33')](_0x299c27[_0xb39c('0x2f')][_0xb39c('0x33')]));_0x4c06fa['attributes']=_0x4c06fa['attributes'][_0xb39c('0x34')]?_0x4c06fa[_0xb39c('0x32')]:_0x41fff2['model'];if(!_0x299c27[_0xb39c('0x2f')][_0xb39c('0x35')](_0xb39c('0x36'))){_0x4c06fa[_0xb39c('0x1d')]=qs[_0xb39c('0x1d')](_0x299c27[_0xb39c('0x2f')][_0xb39c('0x1d')]);_0x4c06fa[_0xb39c('0x1c')]=qs[_0xb39c('0x1c')](_0x299c27[_0xb39c('0x2f')][_0xb39c('0x1c')]);}_0x4c06fa[_0xb39c('0x37')]=qs[_0xb39c('0x38')](_0x299c27[_0xb39c('0x2f')][_0xb39c('0x38')]);_0x4c06fa[_0xb39c('0x39')]=qs[_0xb39c('0x31')](_[_0xb39c('0x3a')](_0x299c27[_0xb39c('0x2f')],_0x41fff2['filters']));if(_0x299c27[_0xb39c('0x2f')][_0xb39c('0x3b')]){_0x4c06fa['where']=_['merge'](_0x4c06fa['where'],{'$or':_[_0xb39c('0x29')](_0x52eb5e,function(_0x33e468){if(_0x33e468[_0xb39c('0x2d')]!=='VIRTUAL'){var _0x3071dd={};_0x3071dd[_0x33e468[_0xb39c('0x27')]]={'$like':'%'+_0x299c27[_0xb39c('0x2f')][_0xb39c('0x3b')]+'%'};return _0x3071dd;}})});}_0x4c06fa=_[_0xb39c('0x3c')]({},_0x4c06fa,_0x299c27['options']);var _0x3cdeeb={'where':_0x4c06fa[_0xb39c('0x39')]};return db['FreshsalesField'][_0xb39c('0x1b')](_0x3cdeeb)['then'](function(_0x1ee418){_0x337532[_0xb39c('0x1b')]=_0x1ee418;if(_0x299c27[_0xb39c('0x2f')]['includeAll']){_0x4c06fa[_0xb39c('0x3d')]=[{'all':!![]}];}return db[_0xb39c('0x2a')][_0xb39c('0x3e')](_0x4c06fa);})[_0xb39c('0x23')](function(_0x10b87b){_0x337532[_0xb39c('0x3f')]=_0x10b87b;return _0x337532;})[_0xb39c('0x23')](respondWithFilteredResult(_0x132769,_0x4c06fa))[_0xb39c('0x40')](handleError(_0x132769,null));};exports[_0xb39c('0x41')]=function(_0x263544,_0x38359d){var _0xd1136f={'raw':!![],'where':{'id':_0x263544[_0xb39c('0x42')]['id']}},_0x53347e={};_0x53347e[_0xb39c('0x2e')]=_[_0xb39c('0x30')](db[_0xb39c('0x2a')][_0xb39c('0x2b')]);_0x53347e[_0xb39c('0x2f')]=_[_0xb39c('0x30')](_0x263544[_0xb39c('0x2f')]);_0x53347e[_0xb39c('0x31')]=_['intersection'](_0x53347e['model'],_0x53347e[_0xb39c('0x2f')]);_0xd1136f[_0xb39c('0x32')]=_['intersection'](_0x53347e['model'],qs[_0xb39c('0x33')](_0x263544['query'][_0xb39c('0x33')]));_0xd1136f[_0xb39c('0x32')]=_0xd1136f[_0xb39c('0x32')][_0xb39c('0x34')]?_0xd1136f[_0xb39c('0x32')]:_0x53347e['model'];if(_0x263544[_0xb39c('0x2f')][_0xb39c('0x43')]){_0xd1136f['include']=[{'all':!![]}];}_0xd1136f=_['merge']({},_0xd1136f,_0x263544[_0xb39c('0x44')]);return db['FreshsalesField']['find'](_0xd1136f)[_0xb39c('0x23')](handleEntityNotFound(_0x38359d,null))[_0xb39c('0x23')](respondWithResult(_0x38359d,null))[_0xb39c('0x40')](handleError(_0x38359d,null));};exports[_0xb39c('0x45')]=function(_0x3dff16,_0x2af6ec){return db[_0xb39c('0x2a')][_0xb39c('0x45')](_0x3dff16[_0xb39c('0x46')],{})[_0xb39c('0x23')](respondWithResult(_0x2af6ec,0xc9))['catch'](handleError(_0x2af6ec,null));};exports[_0xb39c('0x22')]=function(_0x7e9750,_0xe329bf){if(_0x7e9750[_0xb39c('0x46')]['id']){delete _0x7e9750[_0xb39c('0x46')]['id'];}return db[_0xb39c('0x2a')][_0xb39c('0x47')]({'where':{'id':_0x7e9750[_0xb39c('0x42')]['id']}})[_0xb39c('0x23')](handleEntityNotFound(_0xe329bf,null))[_0xb39c('0x23')](saveUpdates(_0x7e9750[_0xb39c('0x46')],null))[_0xb39c('0x23')](respondWithResult(_0xe329bf,null))[_0xb39c('0x40')](handleError(_0xe329bf,null));};exports[_0xb39c('0x24')]=function(_0x17ad13,_0x44b825){return db['FreshsalesField'][_0xb39c('0x47')]({'where':{'id':_0x17ad13[_0xb39c('0x42')]['id']}})[_0xb39c('0x23')](handleEntityNotFound(_0x44b825,null))[_0xb39c('0x23')](removeEntity(_0x44b825,null))[_0xb39c('0x40')](handleError(_0x44b825,null));}; \ No newline at end of file +var _0x073e=['name','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','FreshsalesField','count','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','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','status','json','offset','limit','set','reject','save','update','then','destroy','end','sendStatus'];(function(_0x1a12bb,_0x3da379){var _0x44083e=function(_0x5bb19e){while(--_0x5bb19e){_0x1a12bb['push'](_0x1a12bb['shift']());}};_0x44083e(++_0x3da379);}(_0x073e,0x181));var _0xe073=function(_0x508364,_0xbb53f5){_0x508364=_0x508364-0x0;var _0x3749db=_0x073e[_0x508364];return _0x3749db;};'use strict';var pdf=require(_0xe073('0x0'));var emlformat=require(_0xe073('0x1'));var rimraf=require(_0xe073('0x2'));var zipdir=require(_0xe073('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe073('0x4'));var Mustache=require(_0xe073('0x5'));var util=require(_0xe073('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe073('0x7'));var fs=require('fs');var _=require(_0xe073('0x8'));var squel=require(_0xe073('0x9'));var crypto=require(_0xe073('0xa'));var jsforce=require(_0xe073('0xb'));var deskjs=require(_0xe073('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe073('0xd'));var Papa=require(_0xe073('0xe'));var Redis=require(_0xe073('0xf'));var authService=require(_0xe073('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe073('0x11'));var hardwareService=require(_0xe073('0x12'));var logger=require(_0xe073('0x13'))(_0xe073('0x14'));var utils=require(_0xe073('0x15'));var config=require(_0xe073('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2719a4,_0x56e3f5){_0x56e3f5=_0x56e3f5||0xcc;return function(_0x3dedf7){if(_0x3dedf7){return _0x2719a4['sendStatus'](_0x56e3f5);}return _0x2719a4[_0xe073('0x17')](_0x56e3f5)['end']();};}function respondWithResult(_0x2a2f3e,_0x27d34){_0x27d34=_0x27d34||0xc8;return function(_0x47828d){if(_0x47828d){return _0x2a2f3e[_0xe073('0x17')](_0x27d34)[_0xe073('0x18')](_0x47828d);}};}function respondWithFilteredResult(_0x2ff692,_0x2f4b36){return function(_0xfb28f5){if(_0xfb28f5){var _0x208f2e=_0xfb28f5['count'],_0x26f3d3=_0x2f4b36['offset'],_0x38f9e5=_0x2f4b36[_0xe073('0x19')]+_0x2f4b36[_0xe073('0x1a')],_0x512fe8;if(_0x38f9e5>=_0x208f2e){_0x38f9e5=_0x208f2e;_0x512fe8=0xc8;}else{_0x512fe8=0xce;}_0x2ff692[_0xe073('0x17')](_0x512fe8);return _0x2ff692[_0xe073('0x1b')]('Content-Range',_0x26f3d3+'-'+_0x38f9e5+'/'+_0x208f2e)[_0xe073('0x18')](_0xfb28f5);}return null;};}function patchUpdates(_0x103a51){return function(_0x2a63c6){try{jsonpatch['apply'](_0x2a63c6,_0x103a51,!![]);}catch(_0x21c02e){return BPromise[_0xe073('0x1c')](_0x21c02e);}return _0x2a63c6[_0xe073('0x1d')]();};}function saveUpdates(_0xfeb5bd,_0x43668e){return function(_0x17dd4b){if(_0x17dd4b){return _0x17dd4b[_0xe073('0x1e')](_0xfeb5bd)[_0xe073('0x1f')](function(_0xef9bf5){return _0xef9bf5;});}return null;};}function removeEntity(_0x40b28c,_0x5143fa){return function(_0x4405fd){if(_0x4405fd){return _0x4405fd[_0xe073('0x20')]()[_0xe073('0x1f')](function(){_0x40b28c[_0xe073('0x17')](0xcc)[_0xe073('0x21')]();});}};}function handleEntityNotFound(_0x275aa8,_0x504c26){return function(_0x4c76ef){if(!_0x4c76ef){_0x275aa8[_0xe073('0x22')](0x194);}return _0x4c76ef;};}function handleError(_0x5d72a9,_0x5e3b16){_0x5e3b16=_0x5e3b16||0x1f4;return function(_0x4c3998){logger['error'](_0x4c3998['stack']);if(_0x4c3998['name']){delete _0x4c3998[_0xe073('0x23')];}_0x5d72a9[_0xe073('0x17')](_0x5e3b16)['send'](_0x4c3998);};}exports[_0xe073('0x24')]=function(_0x4548d8,_0x436c34){var _0x5a5b2b={},_0x10f5ba={},_0x58bffd={'count':0x0,'rows':[]};var _0x255d91=_[_0xe073('0x25')](db['FreshsalesField']['rawAttributes'],function(_0x15adbb){return{'name':_0x15adbb[_0xe073('0x26')],'type':_0x15adbb[_0xe073('0x27')][_0xe073('0x28')]};});_0x10f5ba[_0xe073('0x29')]=_[_0xe073('0x25')](_0x255d91,_0xe073('0x23'));_0x10f5ba[_0xe073('0x2a')]=_['keys'](_0x4548d8[_0xe073('0x2a')]);_0x10f5ba[_0xe073('0x2b')]=_['intersection'](_0x10f5ba['model'],_0x10f5ba[_0xe073('0x2a')]);_0x5a5b2b['attributes']=_[_0xe073('0x2c')](_0x10f5ba[_0xe073('0x29')],qs[_0xe073('0x2d')](_0x4548d8['query']['fields']));_0x5a5b2b[_0xe073('0x2e')]=_0x5a5b2b[_0xe073('0x2e')]['length']?_0x5a5b2b[_0xe073('0x2e')]:_0x10f5ba[_0xe073('0x29')];if(!_0x4548d8[_0xe073('0x2a')]['hasOwnProperty'](_0xe073('0x2f'))){_0x5a5b2b['limit']=qs['limit'](_0x4548d8[_0xe073('0x2a')][_0xe073('0x1a')]);_0x5a5b2b[_0xe073('0x19')]=qs['offset'](_0x4548d8[_0xe073('0x2a')][_0xe073('0x19')]);}_0x5a5b2b[_0xe073('0x30')]=qs['sort'](_0x4548d8[_0xe073('0x2a')][_0xe073('0x31')]);_0x5a5b2b[_0xe073('0x32')]=qs[_0xe073('0x2b')](_[_0xe073('0x33')](_0x4548d8[_0xe073('0x2a')],_0x10f5ba['filters']));if(_0x4548d8[_0xe073('0x2a')][_0xe073('0x34')]){_0x5a5b2b[_0xe073('0x32')]=_['merge'](_0x5a5b2b[_0xe073('0x32')],{'$or':_[_0xe073('0x25')](_0x255d91,function(_0x110416){if(_0x110416[_0xe073('0x27')]!==_0xe073('0x35')){var _0x4de55f={};_0x4de55f[_0x110416[_0xe073('0x23')]]={'$like':'%'+_0x4548d8['query'][_0xe073('0x34')]+'%'};return _0x4de55f;}})});}_0x5a5b2b=_[_0xe073('0x36')]({},_0x5a5b2b,_0x4548d8[_0xe073('0x37')]);var _0x5874b7={'where':_0x5a5b2b[_0xe073('0x32')]};return db[_0xe073('0x38')][_0xe073('0x39')](_0x5874b7)[_0xe073('0x1f')](function(_0x23a210){_0x58bffd[_0xe073('0x39')]=_0x23a210;if(_0x4548d8[_0xe073('0x2a')][_0xe073('0x3a')]){_0x5a5b2b[_0xe073('0x3b')]=[{'all':!![]}];}return db['FreshsalesField'][_0xe073('0x3c')](_0x5a5b2b);})['then'](function(_0x174207){_0x58bffd[_0xe073('0x3d')]=_0x174207;return _0x58bffd;})[_0xe073('0x1f')](respondWithFilteredResult(_0x436c34,_0x5a5b2b))[_0xe073('0x3e')](handleError(_0x436c34,null));};exports['show']=function(_0x1797d8,_0x3c33fb){var _0x93852a={'raw':!![],'where':{'id':_0x1797d8[_0xe073('0x3f')]['id']}},_0x3c44f1={};_0x3c44f1['model']=_[_0xe073('0x40')](db['FreshsalesField'][_0xe073('0x41')]);_0x3c44f1[_0xe073('0x2a')]=_[_0xe073('0x40')](_0x1797d8[_0xe073('0x2a')]);_0x3c44f1[_0xe073('0x2b')]=_[_0xe073('0x2c')](_0x3c44f1[_0xe073('0x29')],_0x3c44f1[_0xe073('0x2a')]);_0x93852a[_0xe073('0x2e')]=_[_0xe073('0x2c')](_0x3c44f1[_0xe073('0x29')],qs['fields'](_0x1797d8['query'][_0xe073('0x2d')]));_0x93852a[_0xe073('0x2e')]=_0x93852a[_0xe073('0x2e')][_0xe073('0x42')]?_0x93852a[_0xe073('0x2e')]:_0x3c44f1['model'];if(_0x1797d8[_0xe073('0x2a')][_0xe073('0x3a')]){_0x93852a[_0xe073('0x3b')]=[{'all':!![]}];}_0x93852a=_[_0xe073('0x36')]({},_0x93852a,_0x1797d8[_0xe073('0x37')]);return db['FreshsalesField'][_0xe073('0x43')](_0x93852a)['then'](handleEntityNotFound(_0x3c33fb,null))['then'](respondWithResult(_0x3c33fb,null))[_0xe073('0x3e')](handleError(_0x3c33fb,null));};exports[_0xe073('0x44')]=function(_0x4e6934,_0x5af2b9){return db[_0xe073('0x38')][_0xe073('0x44')](_0x4e6934[_0xe073('0x45')],{})[_0xe073('0x1f')](respondWithResult(_0x5af2b9,0xc9))[_0xe073('0x3e')](handleError(_0x5af2b9,null));};exports[_0xe073('0x1e')]=function(_0x317159,_0x5c7c66){if(_0x317159[_0xe073('0x45')]['id']){delete _0x317159['body']['id'];}return db[_0xe073('0x38')][_0xe073('0x43')]({'where':{'id':_0x317159[_0xe073('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5c7c66,null))['then'](saveUpdates(_0x317159[_0xe073('0x45')],null))[_0xe073('0x1f')](respondWithResult(_0x5c7c66,null))[_0xe073('0x3e')](handleError(_0x5c7c66,null));};exports['destroy']=function(_0x151035,_0x338557){return db[_0xe073('0x38')][_0xe073('0x43')]({'where':{'id':_0x151035[_0xe073('0x3f')]['id']}})[_0xe073('0x1f')](handleEntityNotFound(_0x338557,null))[_0xe073('0x1f')](removeEntity(_0x338557,null))[_0xe073('0x3e')](handleError(_0x338557,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index d2dcec7..111c3ad 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 _0xd23e=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','FreshsalesField','int_freshsales_fields','idField'];(function(_0x3d28c5,_0x2b4644){var _0x3991b8=function(_0x25437d){while(--_0x25437d){_0x3d28c5['push'](_0x3d28c5['shift']());}};_0x3991b8(++_0x2b4644);}(_0xd23e,0xb7));var _0xed23=function(_0x51070b,_0x39c85d){_0x51070b=_0x51070b-0x0;var _0x153240=_0xd23e[_0x51070b];return _0x153240;};'use strict';var _=require(_0xed23('0x0'));var util=require(_0xed23('0x1'));var logger=require(_0xed23('0x2'))(_0xed23('0x3'));var moment=require(_0xed23('0x4'));var BPromise=require(_0xed23('0x5'));var rp=require(_0xed23('0x6'));var fs=require('fs');var path=require(_0xed23('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module[_0xed23('0x8')]=function(_0x491d3f,_0x1fec5a){return _0x491d3f[_0xed23('0x9')](_0xed23('0xa'),attributes,{'tableName':_0xed23('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xed23('0xc'),_0xed23('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x44d2=['FieldId','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','freshsales_unique_index','idField'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x44d2,0x10f));var _0x244d=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x44d2[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require('lodash');var util=require(_0x244d('0x0'));var logger=require(_0x244d('0x1'))(_0x244d('0x2'));var moment=require(_0x244d('0x3'));var BPromise=require('bluebird');var rp=require(_0x244d('0x4'));var fs=require('fs');var path=require(_0x244d('0x5'));var rimraf=require(_0x244d('0x6'));var config=require(_0x244d('0x7'));var attributes=require(_0x244d('0x8'));module[_0x244d('0x9')]=function(_0x375f2e,_0x2e566b){return _0x375f2e[_0x244d('0xa')](_0x244d('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x244d('0xc'),'fields':[_0x244d('0xd'),_0x244d('0xe')],'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 e5116b6..bab34d1 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 _0x8f4d=['lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x55c26b,_0x4c460b){var _0xa30145=function(_0x5777e2){while(--_0x5777e2){_0x55c26b['push'](_0x55c26b['shift']());}};_0xa30145(++_0x4c460b);}(_0x8f4d,0x93));var _0xd8f4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x8f4d[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xd8f4('0x0'));var util=require(_0xd8f4('0x1'));var moment=require('moment');var BPromise=require(_0xd8f4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8f4('0x3'))['db'];var utils=require(_0xd8f4('0x4'));var logger=require('../../config/logger')(_0xd8f4('0x5'));var config=require(_0xd8f4('0x6'));var jayson=require(_0xd8f4('0x7'));var client=jayson[_0xd8f4('0x8')][_0xd8f4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4eb57d,_0x23c21e,_0x4c1575){return new BPromise(function(_0x4c565c,_0x12237c){return client['request'](_0x4eb57d,_0x4c1575)[_0xd8f4('0xa')](function(_0x3c6c74){logger[_0xd8f4('0xb')](_0xd8f4('0xc'),_0x23c21e,_0xd8f4('0xd'));logger[_0xd8f4('0xe')](_0xd8f4('0xf'),_0x23c21e,_0xd8f4('0xd'),JSON[_0xd8f4('0x10')](_0x3c6c74));if(_0x3c6c74[_0xd8f4('0x11')]){if(_0x3c6c74[_0xd8f4('0x11')]['code']===0x1f4){logger['error'](_0xd8f4('0xc'),_0x23c21e,_0x3c6c74['error'][_0xd8f4('0x12')]);return _0x12237c(_0x3c6c74['error']['message']);}logger[_0xd8f4('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x23c21e,_0x3c6c74[_0xd8f4('0x11')][_0xd8f4('0x12')]);return _0x4c565c(_0x3c6c74[_0xd8f4('0x11')][_0xd8f4('0x12')]);}else{logger[_0xd8f4('0xb')](_0xd8f4('0xc'),_0x23c21e,_0xd8f4('0xd'));_0x4c565c(_0x3c6c74[_0xd8f4('0x13')][_0xd8f4('0x12')]);}})[_0xd8f4('0x14')](function(_0x42d9c2){logger[_0xd8f4('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x23c21e,_0x42d9c2);_0x12237c(_0x42d9c2);});});} \ No newline at end of file +var _0xa806=['../../config/environment','client','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0xc968ca,_0x1b522a){var _0x1093f9=function(_0xb00eee){while(--_0xb00eee){_0xc968ca['push'](_0xc968ca['shift']());}};_0x1093f9(++_0x1b522a);}(_0xa806,0xf5));var _0x6a80=function(_0x346df7,_0x3404ad){_0x346df7=_0x346df7-0x0;var _0x504fd8=_0xa806[_0x346df7];return _0x504fd8;};'use strict';var _=require(_0x6a80('0x0'));var util=require(_0x6a80('0x1'));var moment=require(_0x6a80('0x2'));var BPromise=require(_0x6a80('0x3'));var rs=require(_0x6a80('0x4'));var fs=require('fs');var Redis=require(_0x6a80('0x5'));var db=require(_0x6a80('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6a80('0x7'));var config=require(_0x6a80('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6a80('0x9')][_0x6a80('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x526610,_0x5dd1ce,_0x3b4a5d){return new BPromise(function(_0x10f504,_0x335c20){return client[_0x6a80('0xb')](_0x526610,_0x3b4a5d)['then'](function(_0x5651e2){logger[_0x6a80('0xc')](_0x6a80('0xd'),_0x5dd1ce,_0x6a80('0xe'));logger[_0x6a80('0xf')](_0x6a80('0x10'),_0x5dd1ce,_0x6a80('0xe'),JSON[_0x6a80('0x11')](_0x5651e2));if(_0x5651e2['error']){if(_0x5651e2[_0x6a80('0x12')][_0x6a80('0x13')]===0x1f4){logger[_0x6a80('0x12')](_0x6a80('0xd'),_0x5dd1ce,_0x5651e2[_0x6a80('0x12')][_0x6a80('0x14')]);return _0x335c20(_0x5651e2[_0x6a80('0x12')][_0x6a80('0x14')]);}logger[_0x6a80('0x12')](_0x6a80('0xd'),_0x5dd1ce,_0x5651e2[_0x6a80('0x12')][_0x6a80('0x14')]);return _0x10f504(_0x5651e2[_0x6a80('0x12')]['message']);}else{logger['info'](_0x6a80('0xd'),_0x5dd1ce,_0x6a80('0xe'));_0x10f504(_0x5651e2[_0x6a80('0x15')][_0x6a80('0x14')]);}})[_0x6a80('0x16')](function(_0x3ce5d6){logger['error'](_0x6a80('0xd'),_0x5dd1ce,_0x3ce5d6);_0x335c20(_0x3ce5d6);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index ee1dba4..49c385a 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 _0x4680=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','post','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x392341,_0x118b9d){var _0xda5c37=function(_0x3363d1){while(--_0x3363d1){_0x392341['push'](_0x392341['shift']());}};_0xda5c37(++_0x118b9d);}(_0x4680,0x106));var _0x0468=function(_0x399425,_0x354c85){_0x399425=_0x399425-0x0;var _0x5be1a5=_0x4680[_0x399425];return _0x5be1a5;};'use strict';var multer=require(_0x0468('0x0'));var util=require(_0x0468('0x1'));var path=require(_0x0468('0x2'));var timeout=require(_0x0468('0x3'));var express=require('express');var router=express[_0x0468('0x4')]();var auth=require(_0x0468('0x5'));var interaction=require(_0x0468('0x6'));var config=require(_0x0468('0x7'));var controller=require(_0x0468('0x8'));router[_0x0468('0x9')]('/',auth[_0x0468('0xa')](),controller[_0x0468('0xb')]);router[_0x0468('0x9')]('/:id',auth[_0x0468('0xa')](),controller[_0x0468('0xc')]);router[_0x0468('0x9')]('/:id/configurations',auth[_0x0468('0xa')](),controller[_0x0468('0xd')]);router[_0x0468('0x9')](_0x0468('0xe'),auth[_0x0468('0xa')](),controller['getFields']);router[_0x0468('0xf')]('/',auth[_0x0468('0xa')](),controller['create']);router[_0x0468('0xf')]('/:id/configurations',auth[_0x0468('0xa')](),controller['addConfiguration']);router[_0x0468('0x10')](_0x0468('0x11'),auth[_0x0468('0xa')](),controller[_0x0468('0x12')]);router[_0x0468('0x13')](_0x0468('0x11'),auth[_0x0468('0xa')](),controller[_0x0468('0x14')]);module[_0x0468('0x15')]=router; \ No newline at end of file +var _0xf685=['get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','index'];(function(_0x260b9c,_0x48f99e){var _0x5164bc=function(_0x2094de){while(--_0x2094de){_0x260b9c['push'](_0x260b9c['shift']());}};_0x5164bc(++_0x48f99e);}(_0xf685,0x117));var _0x5f68=function(_0x1987c4,_0x3be276){_0x1987c4=_0x1987c4-0x0;var _0x478d53=_0xf685[_0x1987c4];return _0x478d53;};'use strict';var multer=require(_0x5f68('0x0'));var util=require(_0x5f68('0x1'));var path=require(_0x5f68('0x2'));var timeout=require(_0x5f68('0x3'));var express=require(_0x5f68('0x4'));var router=express[_0x5f68('0x5')]();var auth=require(_0x5f68('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5f68('0x7'));var controller=require('./intSalesforceAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5f68('0x8')]);router[_0x5f68('0x9')](_0x5f68('0xa'),auth[_0x5f68('0xb')](),controller[_0x5f68('0xc')]);router[_0x5f68('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x5f68('0xd')]);router[_0x5f68('0x9')](_0x5f68('0xe'),auth[_0x5f68('0xb')](),controller[_0x5f68('0xf')]);router[_0x5f68('0x10')]('/',auth[_0x5f68('0xb')](),controller['create']);router[_0x5f68('0x10')](_0x5f68('0x11'),auth['isAuthenticated'](),controller[_0x5f68('0x12')]);router[_0x5f68('0x13')](_0x5f68('0xa'),auth[_0x5f68('0xb')](),controller[_0x5f68('0x14')]);router[_0x5f68('0x15')](_0x5f68('0xa'),auth[_0x5f68('0xb')](),controller[_0x5f68('0x16')]);module[_0x5f68('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index e37f4a8..1867f04 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 _0x53ec=['ENUM','newTab','integrationTab','sequelize','exports','STRING','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53ec,0x192));var _0xc53e=function(_0x20f52e,_0x596d5e){_0x20f52e=_0x20f52e-0x0;var _0x1489ca=_0x53ec[_0x20f52e];return _0x1489ca;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'name':{'type':Sequelize[_0xc53e('0x2')]},'description':{'type':Sequelize[_0xc53e('0x2')]},'username':{'type':Sequelize[_0xc53e('0x2')],'unique':_0xc53e('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xc53e('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xc53e('0x2')]},'securityToken':{'type':Sequelize[_0xc53e('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc53e('0x4')]('integrationTab',_0xc53e('0x5')),'defaultValue':_0xc53e('0x6')}}; \ No newline at end of file +var _0xc4aa=['STRING','username','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xc4aa[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'name':{'type':Sequelize[_0xac4a('0x2')]},'description':{'type':Sequelize[_0xac4a('0x2')]},'username':{'type':Sequelize[_0xac4a('0x2')],'unique':_0xac4a('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xac4a('0x2')]},'securityToken':{'type':Sequelize[_0xac4a('0x2')]},'serverUrl':{'type':Sequelize[_0xac4a('0x2')]},'type':{'type':Sequelize[_0xac4a('0x4')](_0xac4a('0x5'),_0xac4a('0x6')),'defaultValue':_0xac4a('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 2059bdc..f35aa5f 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 _0xf494=['addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','Task','clientId','username','securityToken','remoteUri','substring','Connection','clientSecret','password','concat','isNil','ticketType','sobject','describe','CallDisposition','CallDurationInSeconds','CallObject','IsArchived','Priority','Status','Type','Case','Origin','Reason','SuppliedName','remove','custom','includes','picklistValues','label','value','boolean','True','true','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','stringify','error','SalesforceAccount,\x20%s,\x20%s','message','result','status','end','count','limit','set','json','apply','reject','save','update','destroy','sendStatus','stack','name','send','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','SalesforceConfiguration','order'];(function(_0x4b19e3,_0x2b63c3){var _0x2ce22a=function(_0x5c1fac){while(--_0x5c1fac){_0x4b19e3['push'](_0x4b19e3['shift']());}};_0x2ce22a(++_0x2b63c3);}(_0xf494,0x1c6));var _0x4f49=function(_0x2c3d3f,_0x3ad633){_0x2c3d3f=_0x2c3d3f-0x0;var _0x376f8f=_0xf494[_0x2c3d3f];return _0x376f8f;};'use strict';var pdf=require(_0x4f49('0x0'));var emlformat=require(_0x4f49('0x1'));var rimraf=require(_0x4f49('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f49('0x3'));var rp=require(_0x4f49('0x4'));var moment=require(_0x4f49('0x5'));var BPromise=require(_0x4f49('0x6'));var Mustache=require(_0x4f49('0x7'));var util=require(_0x4f49('0x8'));var path=require(_0x4f49('0x9'));var sox=require(_0x4f49('0xa'));var csv=require(_0x4f49('0xb'));var ejs=require(_0x4f49('0xc'));var fs=require('fs');var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xb'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x4f49('0x18'));var jayson=require(_0x4f49('0x19'));var client=jayson['client'][_0x4f49('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x111a8b,_0x1b9145,_0x2efe49){if(_0x2efe49){var _0x1a0f1e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a0f1e[_0x4f49('0x1b')](_0x1b9145)){return _0x111a8b;}else{throw new db[(_0x4f49('0x1c'))]['ValidationError'](_0x4f49('0x1d'));}}else{return _0x111a8b;}}function respondWithRpcPromise(_0x1f2d0d,_0x415e83,_0x5878f4,_0x5bdfaf){return new BPromise(function(_0x2f0a0d,_0x2ecaaa){var _0x74886e=_0x5bdfaf||client;return _0x74886e['request'](_0x1f2d0d,_0x5878f4)[_0x4f49('0x1e')](function(_0x399be7){logger[_0x4f49('0x1f')]('SalesforceAccount,\x20%s,\x20%s',_0x415e83,'request\x20sent');logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x415e83,_0x4f49('0x20'),JSON[_0x4f49('0x21')](_0x399be7));if(_0x399be7[_0x4f49('0x22')]){if(_0x399be7[_0x4f49('0x22')]['code']===0x1f4){logger[_0x4f49('0x22')](_0x4f49('0x23'),_0x415e83,_0x399be7[_0x4f49('0x22')][_0x4f49('0x24')]);return _0x2ecaaa(_0x399be7[_0x4f49('0x22')]['message']);}logger[_0x4f49('0x22')](_0x4f49('0x23'),_0x415e83,_0x399be7[_0x4f49('0x22')]['message']);return _0x2f0a0d(_0x399be7[_0x4f49('0x22')][_0x4f49('0x24')]);}else{logger[_0x4f49('0x1f')](_0x4f49('0x23'),_0x415e83,_0x4f49('0x20'));_0x2f0a0d(_0x399be7[_0x4f49('0x25')]['message']);}})['catch'](function(_0x3a947b){logger[_0x4f49('0x22')]('SalesforceAccount,\x20%s,\x20%s',_0x415e83,_0x3a947b);_0x2ecaaa(_0x3a947b);});});}function respondWithStatusCode(_0x408552,_0x2c1519){_0x2c1519=_0x2c1519||0xcc;return function(_0x35f8e0){if(_0x35f8e0){return _0x408552['sendStatus'](_0x2c1519);}return _0x408552[_0x4f49('0x26')](_0x2c1519)[_0x4f49('0x27')]();};}function respondWithResult(_0x298785,_0x148153){_0x148153=_0x148153||0xc8;return function(_0xfefbab){if(_0xfefbab){return _0x298785[_0x4f49('0x26')](_0x148153)['json'](_0xfefbab);}};}function respondWithFilteredResult(_0x50c571,_0x239f44){return function(_0x2c00ee){if(_0x2c00ee){var _0x605c91=_0x2c00ee[_0x4f49('0x28')],_0x560050=_0x239f44['offset'],_0x3cbfbd=_0x239f44['offset']+_0x239f44[_0x4f49('0x29')],_0x206203;if(_0x3cbfbd>=_0x605c91){_0x3cbfbd=_0x605c91;_0x206203=0xc8;}else{_0x206203=0xce;}_0x50c571[_0x4f49('0x26')](_0x206203);return _0x50c571[_0x4f49('0x2a')]('Content-Range',_0x560050+'-'+_0x3cbfbd+'/'+_0x605c91)[_0x4f49('0x2b')](_0x2c00ee);}return null;};}function patchUpdates(_0x35aa33){return function(_0x173657){try{jsonpatch[_0x4f49('0x2c')](_0x173657,_0x35aa33,!![]);}catch(_0x3e103b){return BPromise[_0x4f49('0x2d')](_0x3e103b);}return _0x173657[_0x4f49('0x2e')]();};}function saveUpdates(_0x45ae19,_0x1f38d3){return function(_0x310ee2){if(_0x310ee2){return _0x310ee2[_0x4f49('0x2f')](_0x45ae19)[_0x4f49('0x1e')](function(_0x29ff83){return _0x29ff83;});}return null;};}function removeEntity(_0x6625cd,_0x135d17){return function(_0x97ef98){if(_0x97ef98){return _0x97ef98[_0x4f49('0x30')]()[_0x4f49('0x1e')](function(){_0x6625cd[_0x4f49('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45d0d2,_0x46b7ba){return function(_0x24f568){if(!_0x24f568){_0x45d0d2[_0x4f49('0x31')](0x194);}return _0x24f568;};}function handleError(_0x1c3af8,_0x15e82b){_0x15e82b=_0x15e82b||0x1f4;return function(_0x2cbe4e){logger[_0x4f49('0x22')](_0x2cbe4e[_0x4f49('0x32')]);if(_0x2cbe4e[_0x4f49('0x33')]){delete _0x2cbe4e[_0x4f49('0x33')];}_0x1c3af8[_0x4f49('0x26')](_0x15e82b)[_0x4f49('0x34')](_0x2cbe4e);};}exports['index']=function(_0x371282,_0x27b7a9){var _0x36000a={},_0x26014f={},_0x1c1e9b={'count':0x0,'rows':[]};var _0x3ee818=_[_0x4f49('0x35')](db[_0x4f49('0x36')][_0x4f49('0x37')],function(_0xf8c377){return{'name':_0xf8c377[_0x4f49('0x38')],'type':_0xf8c377[_0x4f49('0x39')][_0x4f49('0x3a')]};});_0x26014f[_0x4f49('0x3b')]=_['map'](_0x3ee818,_0x4f49('0x33'));_0x26014f[_0x4f49('0x3c')]=_['keys'](_0x371282[_0x4f49('0x3c')]);_0x26014f[_0x4f49('0x3d')]=_['intersection'](_0x26014f[_0x4f49('0x3b')],_0x26014f[_0x4f49('0x3c')]);_0x36000a[_0x4f49('0x3e')]=_[_0x4f49('0x3f')](_0x26014f[_0x4f49('0x3b')],qs[_0x4f49('0x40')](_0x371282[_0x4f49('0x3c')]['fields']));_0x36000a['attributes']=_0x36000a['attributes'][_0x4f49('0x41')]?_0x36000a[_0x4f49('0x3e')]:_0x26014f[_0x4f49('0x3b')];if(!_0x371282[_0x4f49('0x3c')][_0x4f49('0x42')](_0x4f49('0x43'))){_0x36000a[_0x4f49('0x29')]=qs[_0x4f49('0x29')](_0x371282[_0x4f49('0x3c')]['limit']);_0x36000a['offset']=qs[_0x4f49('0x44')](_0x371282[_0x4f49('0x3c')][_0x4f49('0x44')]);}_0x36000a['order']=qs[_0x4f49('0x45')](_0x371282['query']['sort']);_0x36000a[_0x4f49('0x46')]=qs[_0x4f49('0x3d')](_[_0x4f49('0x47')](_0x371282['query'],_0x26014f[_0x4f49('0x3d')]));if(_0x371282[_0x4f49('0x3c')]['filter']){_0x36000a[_0x4f49('0x46')]=_['merge'](_0x36000a[_0x4f49('0x46')],{'$or':_[_0x4f49('0x35')](_0x3ee818,function(_0x133f39){if(_0x133f39['type']!==_0x4f49('0x48')){var _0x1e5f0b={};_0x1e5f0b[_0x133f39[_0x4f49('0x33')]]={'$like':'%'+_0x371282[_0x4f49('0x3c')][_0x4f49('0x49')]+'%'};return _0x1e5f0b;}})});}_0x36000a=_[_0x4f49('0x4a')]({},_0x36000a,_0x371282[_0x4f49('0x4b')]);var _0x356785={'where':_0x36000a[_0x4f49('0x46')]};return db[_0x4f49('0x36')]['count'](_0x356785)[_0x4f49('0x1e')](function(_0x44bf1d){_0x1c1e9b['count']=_0x44bf1d;if(_0x371282[_0x4f49('0x3c')]['includeAll']){_0x36000a[_0x4f49('0x4c')]=[{'all':!![]}];}return db[_0x4f49('0x36')][_0x4f49('0x4d')](_0x36000a);})[_0x4f49('0x1e')](function(_0x4a91ec){_0x1c1e9b[_0x4f49('0x4e')]=_0x4a91ec;return _0x1c1e9b;})[_0x4f49('0x1e')](respondWithFilteredResult(_0x27b7a9,_0x36000a))[_0x4f49('0x4f')](handleError(_0x27b7a9,null));};exports[_0x4f49('0x50')]=function(_0x3ec266,_0x72ea05){var _0x37fdb7={'raw':![],'where':{'id':_0x3ec266[_0x4f49('0x51')]['id']}},_0xd282c={};_0xd282c[_0x4f49('0x3b')]=_[_0x4f49('0x52')](db[_0x4f49('0x36')][_0x4f49('0x37')]);_0xd282c[_0x4f49('0x3c')]=_[_0x4f49('0x52')](_0x3ec266[_0x4f49('0x3c')]);_0xd282c['filters']=_['intersection'](_0xd282c[_0x4f49('0x3b')],_0xd282c[_0x4f49('0x3c')]);_0x37fdb7[_0x4f49('0x3e')]=_[_0x4f49('0x3f')](_0xd282c[_0x4f49('0x3b')],qs[_0x4f49('0x40')](_0x3ec266[_0x4f49('0x3c')]['fields']));_0x37fdb7[_0x4f49('0x3e')]=_0x37fdb7['attributes'][_0x4f49('0x41')]?_0x37fdb7[_0x4f49('0x3e')]:_0xd282c[_0x4f49('0x3b')];if(_0x3ec266[_0x4f49('0x3c')]['includeAll']){_0x37fdb7[_0x4f49('0x4c')]=[{'all':!![]}];}_0x37fdb7=_['merge']({},_0x37fdb7,_0x3ec266['options']);return db[_0x4f49('0x36')][_0x4f49('0x53')](_0x37fdb7)[_0x4f49('0x1e')](handleEntityNotFound(_0x72ea05,null))[_0x4f49('0x1e')](respondWithResult(_0x72ea05,null))['catch'](handleError(_0x72ea05,null));};exports['create']=function(_0xd7f47b,_0x291a45){return db['SalesforceAccount'][_0x4f49('0x54')](_0xd7f47b['body'],{})['then'](respondWithResult(_0x291a45,0xc9))[_0x4f49('0x4f')](handleError(_0x291a45,null));};exports['update']=function(_0xfa7dd6,_0x492aaa){if(_0xfa7dd6[_0x4f49('0x55')]['id']){delete _0xfa7dd6[_0x4f49('0x55')]['id'];}return db[_0x4f49('0x36')][_0x4f49('0x53')]({'where':{'id':_0xfa7dd6[_0x4f49('0x51')]['id']}})[_0x4f49('0x1e')](handleEntityNotFound(_0x492aaa,null))[_0x4f49('0x1e')](saveUpdates(_0xfa7dd6[_0x4f49('0x55')],null))['then'](respondWithResult(_0x492aaa,null))[_0x4f49('0x4f')](handleError(_0x492aaa,null));};exports['destroy']=function(_0x213608,_0x1f640d){return db[_0x4f49('0x36')][_0x4f49('0x53')]({'where':{'id':_0x213608[_0x4f49('0x51')]['id']}})[_0x4f49('0x1e')](handleEntityNotFound(_0x1f640d,null))['then'](removeEntity(_0x1f640d,null))[_0x4f49('0x4f')](handleError(_0x1f640d,null));};exports[_0x4f49('0x56')]=function(_0x5e3568,_0x5d2b3c,_0x121c04){var _0x447dde={};var _0x2e0df5={};var _0x2409f1;var _0x19a788;return db['SalesforceAccount'][_0x4f49('0x57')]({'where':{'id':_0x5e3568['params']['id']}})[_0x4f49('0x1e')](handleEntityNotFound(_0x5d2b3c,null))[_0x4f49('0x1e')](function(_0x2a2b0d){if(_0x2a2b0d){_0x2409f1=_0x2a2b0d;_0x2e0df5['model']=_[_0x4f49('0x52')](db[_0x4f49('0x58')][_0x4f49('0x37')]);_0x2e0df5[_0x4f49('0x3c')]=_['keys'](_0x5e3568[_0x4f49('0x3c')]);_0x2e0df5[_0x4f49('0x3d')]=_['intersection'](_0x2e0df5[_0x4f49('0x3b')],_0x2e0df5[_0x4f49('0x3c')]);_0x447dde[_0x4f49('0x3e')]=_[_0x4f49('0x3f')](_0x2e0df5[_0x4f49('0x3b')],qs[_0x4f49('0x40')](_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x40')]));_0x447dde['attributes']=_0x447dde[_0x4f49('0x3e')][_0x4f49('0x41')]?_0x447dde[_0x4f49('0x3e')]:_0x2e0df5[_0x4f49('0x3b')];_0x447dde[_0x4f49('0x59')]=qs[_0x4f49('0x45')](_0x5e3568[_0x4f49('0x3c')]['sort']);_0x447dde[_0x4f49('0x46')]=qs['filters'](_[_0x4f49('0x47')](_0x5e3568[_0x4f49('0x3c')],_0x2e0df5[_0x4f49('0x3d')]));if(_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x49')]){_0x447dde[_0x4f49('0x46')]=_[_0x4f49('0x4a')](_0x447dde[_0x4f49('0x46')],{'$or':_[_0x4f49('0x35')](_0x447dde[_0x4f49('0x3e')],function(_0x545552){var _0x2f9f2e={};_0x2f9f2e[_0x545552]={'$like':'%'+_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x49')]+'%'};return _0x2f9f2e;})});}_0x447dde=_[_0x4f49('0x4a')]({},_0x447dde,_0x5e3568['options']);return _0x2409f1['getConfigurations'](_0x447dde);}})[_0x4f49('0x1e')](function(_0x5e4879){if(_0x5e4879){_0x19a788=_0x5e4879[_0x4f49('0x41')];if(!_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x42')](_0x4f49('0x43'))){_0x447dde[_0x4f49('0x29')]=qs[_0x4f49('0x29')](_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x29')]);_0x447dde[_0x4f49('0x44')]=qs[_0x4f49('0x44')](_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x44')]);}return _0x2409f1[_0x4f49('0x56')](_0x447dde);}})[_0x4f49('0x1e')](function(_0x234984){if(_0x234984){return _0x234984?{'count':_0x19a788,'rows':_0x234984}:null;}})[_0x4f49('0x1e')](respondWithResult(_0x5d2b3c,null))[_0x4f49('0x4f')](handleError(_0x5d2b3c,null));};exports[_0x4f49('0x5a')]=function(_0x1f9161,_0x1434ea,_0x2c3962){if(_0x1f9161[_0x4f49('0x55')]['id']){delete _0x1f9161[_0x4f49('0x55')]['id'];}return db[_0x4f49('0x36')][_0x4f49('0x57')]({'where':{'id':_0x1f9161['params']['id']}})[_0x4f49('0x1e')](handleEntityNotFound(_0x1434ea,null))['then'](function(_0x31df7f){if(_0x31df7f){_0x1f9161[_0x4f49('0x55')][_0x4f49('0x5b')]=_0x31df7f['id'];_0x1f9161[_0x4f49('0x55')][_0x4f49('0x5c')]=integrations[_0x4f49('0x5d')](_0x1f9161[_0x4f49('0x55')][_0x4f49('0x5e')],_0x1f9161[_0x4f49('0x55')]['type']);_0x1f9161['body'][_0x4f49('0x5f')]=integrations['getDescriptions'](_0x1f9161[_0x4f49('0x55')][_0x4f49('0x5e')],_0x1f9161[_0x4f49('0x55')][_0x4f49('0x39')]);return db[_0x4f49('0x58')]['create'](_0x1f9161['body'],{'include':[{'model':db[_0x4f49('0x60')],'as':_0x4f49('0x5c')},{'model':db['SalesforceField'],'as':_0x4f49('0x5f')}]});}return null;})[_0x4f49('0x1e')](respondWithResult(_0x1434ea,null))['catch'](handleError(_0x1434ea,null));};exports[_0x4f49('0x61')]=function(_0x5b88aa,_0x121972,_0x160cf8){var _0x544356;var _0x15ed6c='';var _0x4551d9=_0x4f49('0x62');return db[_0x4f49('0x36')][_0x4f49('0x57')]({'where':{'id':_0x5b88aa[_0x4f49('0x51')]['id']},'attributes':['id','remoteUri',_0x4f49('0x63'),'clientSecret',_0x4f49('0x64'),'password',_0x4f49('0x65')]})['then'](handleEntityNotFound(_0x121972,null))[_0x4f49('0x1e')](function(_0x16fad9){if(_0x16fad9){_0x15ed6c=_0x16fad9[_0x4f49('0x66')];var _0x2dbd0f=_0x15ed6c['slice'](-0x1);if(_0x2dbd0f==='/'){_0x15ed6c=_0x15ed6c[_0x4f49('0x67')](0x0,_0x15ed6c['lastIndexOf'](_0x2dbd0f));}_0x544356=new jsforce[(_0x4f49('0x68'))]({'oauth2':{'loginUrl':_0x15ed6c,'clientId':_0x16fad9['clientId'],'clientSecret':_0x16fad9[_0x4f49('0x69')]}});return _0x544356['login'](_0x16fad9['username'],_0x16fad9[_0x4f49('0x6a')][_0x4f49('0x6b')](_0x16fad9[_0x4f49('0x65')]));}})['then'](function(_0x289810){if(_0x289810){if(!_[_0x4f49('0x6c')](_0x5b88aa['query']['ticketType'])){_0x4551d9=_0x5b88aa['query'][_0x4f49('0x6d')];}return _0x544356[_0x4f49('0x6e')](_0x4551d9)[_0x4f49('0x6f')]();}})[_0x4f49('0x1e')](function(_0x1643fc){var _0x517144=[_0x4f49('0x70'),_0x4f49('0x71'),_0x4f49('0x72'),'CallType',_0x4f49('0x73'),_0x4f49('0x74'),_0x4f49('0x75'),_0x4f49('0x76')];if(!_['isNil'](_0x5b88aa[_0x4f49('0x3c')][_0x4f49('0x6d')])&&_0x5b88aa[_0x4f49('0x3c')][_0x4f49('0x6d')]===_0x4f49('0x77')){_0x517144=['Type',_0x4f49('0x78'),_0x4f49('0x79'),'Status',_0x4f49('0x74'),'IsEscalated',_0x4f49('0x7a'),'SuppliedCompany'];}if(_0x1643fc){_[_0x4f49('0x7b')](_0x1643fc[_0x4f49('0x40')],function(_0x2ef19e){return _0x2ef19e[_0x4f49('0x7c')]===![]&&!_0x517144[_0x4f49('0x7d')](_0x2ef19e['name']);});return{'count':_0x1643fc[_0x4f49('0x40')][_0x4f49('0x41')],'rows':_[_0x4f49('0x35')](_0x1643fc[_0x4f49('0x40')],function(_0x4b7c61){return{'id':_0x4b7c61[_0x4f49('0x33')],'name':_0x4b7c61['label'],'custom':_0x4b7c61[_0x4f49('0x7c')],'options':_0x4b7c61['picklistValues'][_0x4f49('0x41')]>0x0?_[_0x4f49('0x35')](_0x4b7c61[_0x4f49('0x7e')],function(_0x34fca3){return{'name':_0x34fca3[_0x4f49('0x7f')],'value':_0x34fca3[_0x4f49('0x80')]};}):_0x4b7c61[_0x4f49('0x39')]==_0x4f49('0x81')?[{'name':_0x4f49('0x82'),'value':_0x4f49('0x83')},{'name':'False','value':_0x4f49('0x84')}]:[]};})};}})[_0x4f49('0x1e')](respondWithResult(_0x121972,null))[_0x4f49('0x4f')](function(_0x299849){var _0x302861=_0x5b88aa[_0x4f49('0x3c')]['test']?0x1f4:_0x299849[_0x4f49('0x85')]||0x1f4;logger[_0x4f49('0x22')](_0x4f49('0x86'),_0x4f49('0x61'),_0x302861,JSON['stringify'](_0x299849));delete _0x299849[_0x4f49('0x33')];if(_0x302861===0x191){_0x302861=0x190;}_0x121972['status'](_0x302861)[_0x4f49('0x34')](_0x5b88aa[_0x4f49('0x3c')][_0x4f49('0x1b')]?{'message':_0x4f49('0x87'),'statusCode':_0x299849['statusCode']}:_0x299849);});}; \ No newline at end of file +var _0x1967=['json','count','offset','limit','set','Content-Range','apply','reject','save','update','sendStatus','stack','name','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','keys','intersection','model','fields','attributes','length','query','hasOwnProperty','order','sort','filters','pick','VIRTUAL','filter','options','where','includeAll','show','params','include','merge','find','create','body','getConfigurations','findOne','SalesforceConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','slice','substring','lastIndexOf','login','concat','securityToken','ticketType','describe','CallDurationInSeconds','IsArchived','Priority','Status','isNil','Case','Type','Origin','Reason','SuppliedCompany','custom','includes','picklistValues','value','boolean','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../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~!@#$%^&-_=+[{]}.','request','then','info','SalesforceAccount,\x20%s,\x20%s','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','end'];(function(_0x1a6869,_0xd076a3){var _0x2c5023=function(_0x2cc4f6){while(--_0x2cc4f6){_0x1a6869['push'](_0x1a6869['shift']());}};_0x2c5023(++_0xd076a3);}(_0x1967,0x173));var _0x7196=function(_0x1a85a4,_0x510da6){_0x1a85a4=_0x1a85a4-0x0;var _0x5bbbbf=_0x1967[_0x1a85a4];return _0x5bbbbf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7196('0x0'));var rimraf=require(_0x7196('0x1'));var zipdir=require(_0x7196('0x2'));var jsonpatch=require(_0x7196('0x3'));var rp=require(_0x7196('0x4'));var moment=require(_0x7196('0x5'));var BPromise=require(_0x7196('0x6'));var Mustache=require(_0x7196('0x7'));var util=require(_0x7196('0x8'));var path=require(_0x7196('0x9'));var sox=require('sox');var csv=require(_0x7196('0xa'));var ejs=require(_0x7196('0xb'));var fs=require('fs');var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0xa'));var querystring=require(_0x7196('0x10'));var Papa=require(_0x7196('0x11'));var Redis=require(_0x7196('0x12'));var authService=require(_0x7196('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x14'));var logger=require(_0x7196('0x15'))(_0x7196('0x16'));var utils=require(_0x7196('0x17'));var config=require(_0x7196('0x18'));var db=require(_0x7196('0x19'))['db'];var integrations=require(_0x7196('0x1a'));var jayson=require(_0x7196('0x1b'));var client=jayson[_0x7196('0x1c')][_0x7196('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x154101,_0x4e8c4c,_0x26a1ef){if(_0x26a1ef){var _0x3feccd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3feccd[_0x7196('0x1e')](_0x4e8c4c)){return _0x154101;}else{throw new db[(_0x7196('0x1f'))]['ValidationError'](_0x7196('0x20'));}}else{return _0x154101;}}function respondWithRpcPromise(_0x539414,_0xe32933,_0x2590a6,_0xf7e97){return new BPromise(function(_0x3ed1ad,_0x12dce7){var _0x2e3e0e=_0xf7e97||client;return _0x2e3e0e[_0x7196('0x21')](_0x539414,_0x2590a6)[_0x7196('0x22')](function(_0x3e4e69){logger[_0x7196('0x23')](_0x7196('0x24'),_0xe32933,'request\x20sent');logger['debug'](_0x7196('0x25'),_0xe32933,_0x7196('0x26'),JSON[_0x7196('0x27')](_0x3e4e69));if(_0x3e4e69['error']){if(_0x3e4e69[_0x7196('0x28')]['code']===0x1f4){logger['error'](_0x7196('0x24'),_0xe32933,_0x3e4e69[_0x7196('0x28')][_0x7196('0x29')]);return _0x12dce7(_0x3e4e69['error']['message']);}logger[_0x7196('0x28')](_0x7196('0x24'),_0xe32933,_0x3e4e69['error'][_0x7196('0x29')]);return _0x3ed1ad(_0x3e4e69[_0x7196('0x28')][_0x7196('0x29')]);}else{logger[_0x7196('0x23')](_0x7196('0x24'),_0xe32933,'request\x20sent');_0x3ed1ad(_0x3e4e69[_0x7196('0x2a')]['message']);}})[_0x7196('0x2b')](function(_0x1b1f4b){logger[_0x7196('0x28')](_0x7196('0x24'),_0xe32933,_0x1b1f4b);_0x12dce7(_0x1b1f4b);});});}function respondWithStatusCode(_0x70aa65,_0x43f6a2){_0x43f6a2=_0x43f6a2||0xcc;return function(_0x530ab5){if(_0x530ab5){return _0x70aa65['sendStatus'](_0x43f6a2);}return _0x70aa65[_0x7196('0x2c')](_0x43f6a2)[_0x7196('0x2d')]();};}function respondWithResult(_0x184c09,_0x4e878f){_0x4e878f=_0x4e878f||0xc8;return function(_0x5aa538){if(_0x5aa538){return _0x184c09[_0x7196('0x2c')](_0x4e878f)[_0x7196('0x2e')](_0x5aa538);}};}function respondWithFilteredResult(_0x675e64,_0x4c6006){return function(_0x35eef9){if(_0x35eef9){var _0x4ecea1=_0x35eef9[_0x7196('0x2f')],_0x4fd339=_0x4c6006[_0x7196('0x30')],_0x59d79d=_0x4c6006['offset']+_0x4c6006[_0x7196('0x31')],_0x30151f;if(_0x59d79d>=_0x4ecea1){_0x59d79d=_0x4ecea1;_0x30151f=0xc8;}else{_0x30151f=0xce;}_0x675e64[_0x7196('0x2c')](_0x30151f);return _0x675e64[_0x7196('0x32')](_0x7196('0x33'),_0x4fd339+'-'+_0x59d79d+'/'+_0x4ecea1)['json'](_0x35eef9);}return null;};}function patchUpdates(_0x39710d){return function(_0x429160){try{jsonpatch[_0x7196('0x34')](_0x429160,_0x39710d,!![]);}catch(_0x651d7e){return BPromise[_0x7196('0x35')](_0x651d7e);}return _0x429160[_0x7196('0x36')]();};}function saveUpdates(_0x15c5f0,_0x3465aa){return function(_0x354175){if(_0x354175){return _0x354175[_0x7196('0x37')](_0x15c5f0)[_0x7196('0x22')](function(_0x54e46b){return _0x54e46b;});}return null;};}function removeEntity(_0xdf8aa,_0x4fbe57){return function(_0x2452f6){if(_0x2452f6){return _0x2452f6['destroy']()[_0x7196('0x22')](function(){_0xdf8aa[_0x7196('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x628e7d,_0x2bcadd){return function(_0x4531d7){if(!_0x4531d7){_0x628e7d[_0x7196('0x38')](0x194);}return _0x4531d7;};}function handleError(_0x7547cf,_0x4a8580){_0x4a8580=_0x4a8580||0x1f4;return function(_0x10b8c2){logger[_0x7196('0x28')](_0x10b8c2[_0x7196('0x39')]);if(_0x10b8c2[_0x7196('0x3a')]){delete _0x10b8c2[_0x7196('0x3a')];}_0x7547cf[_0x7196('0x2c')](_0x4a8580)['send'](_0x10b8c2);};}exports[_0x7196('0x3b')]=function(_0xe04e44,_0x191df2){var _0x4f6b27={},_0x33831a={},_0x75530e={'count':0x0,'rows':[]};var _0xd72bd9=_[_0x7196('0x3c')](db[_0x7196('0x3d')][_0x7196('0x3e')],function(_0x938e49){return{'name':_0x938e49[_0x7196('0x3f')],'type':_0x938e49[_0x7196('0x40')][_0x7196('0x41')]};});_0x33831a['model']=_[_0x7196('0x3c')](_0xd72bd9,_0x7196('0x3a'));_0x33831a['query']=_[_0x7196('0x42')](_0xe04e44['query']);_0x33831a['filters']=_[_0x7196('0x43')](_0x33831a[_0x7196('0x44')],_0x33831a['query']);_0x4f6b27['attributes']=_[_0x7196('0x43')](_0x33831a[_0x7196('0x44')],qs[_0x7196('0x45')](_0xe04e44['query'][_0x7196('0x45')]));_0x4f6b27[_0x7196('0x46')]=_0x4f6b27[_0x7196('0x46')][_0x7196('0x47')]?_0x4f6b27[_0x7196('0x46')]:_0x33831a[_0x7196('0x44')];if(!_0xe04e44[_0x7196('0x48')][_0x7196('0x49')]('nolimit')){_0x4f6b27[_0x7196('0x31')]=qs[_0x7196('0x31')](_0xe04e44['query'][_0x7196('0x31')]);_0x4f6b27[_0x7196('0x30')]=qs['offset'](_0xe04e44[_0x7196('0x48')][_0x7196('0x30')]);}_0x4f6b27[_0x7196('0x4a')]=qs['sort'](_0xe04e44[_0x7196('0x48')][_0x7196('0x4b')]);_0x4f6b27['where']=qs[_0x7196('0x4c')](_[_0x7196('0x4d')](_0xe04e44['query'],_0x33831a[_0x7196('0x4c')]));if(_0xe04e44['query']['filter']){_0x4f6b27['where']=_['merge'](_0x4f6b27['where'],{'$or':_[_0x7196('0x3c')](_0xd72bd9,function(_0x590857){if(_0x590857[_0x7196('0x40')]!==_0x7196('0x4e')){var _0x780275={};_0x780275[_0x590857[_0x7196('0x3a')]]={'$like':'%'+_0xe04e44['query'][_0x7196('0x4f')]+'%'};return _0x780275;}})});}_0x4f6b27=_['merge']({},_0x4f6b27,_0xe04e44[_0x7196('0x50')]);var _0x1703fc={'where':_0x4f6b27[_0x7196('0x51')]};return db['SalesforceAccount'][_0x7196('0x2f')](_0x1703fc)[_0x7196('0x22')](function(_0x1b5c68){_0x75530e['count']=_0x1b5c68;if(_0xe04e44['query'][_0x7196('0x52')]){_0x4f6b27['include']=[{'all':!![]}];}return db[_0x7196('0x3d')]['findAll'](_0x4f6b27);})['then'](function(_0x14b489){_0x75530e['rows']=_0x14b489;return _0x75530e;})['then'](respondWithFilteredResult(_0x191df2,_0x4f6b27))['catch'](handleError(_0x191df2,null));};exports[_0x7196('0x53')]=function(_0x5052ee,_0x48e3b5){var _0x28591e={'raw':![],'where':{'id':_0x5052ee[_0x7196('0x54')]['id']}},_0x182c8b={};_0x182c8b[_0x7196('0x44')]=_['keys'](db[_0x7196('0x3d')]['rawAttributes']);_0x182c8b[_0x7196('0x48')]=_[_0x7196('0x42')](_0x5052ee['query']);_0x182c8b[_0x7196('0x4c')]=_[_0x7196('0x43')](_0x182c8b[_0x7196('0x44')],_0x182c8b['query']);_0x28591e[_0x7196('0x46')]=_['intersection'](_0x182c8b[_0x7196('0x44')],qs[_0x7196('0x45')](_0x5052ee[_0x7196('0x48')][_0x7196('0x45')]));_0x28591e[_0x7196('0x46')]=_0x28591e[_0x7196('0x46')][_0x7196('0x47')]?_0x28591e[_0x7196('0x46')]:_0x182c8b['model'];if(_0x5052ee['query'][_0x7196('0x52')]){_0x28591e[_0x7196('0x55')]=[{'all':!![]}];}_0x28591e=_[_0x7196('0x56')]({},_0x28591e,_0x5052ee[_0x7196('0x50')]);return db['SalesforceAccount'][_0x7196('0x57')](_0x28591e)[_0x7196('0x22')](handleEntityNotFound(_0x48e3b5,null))[_0x7196('0x22')](respondWithResult(_0x48e3b5,null))[_0x7196('0x2b')](handleError(_0x48e3b5,null));};exports[_0x7196('0x58')]=function(_0x3177c2,_0x7bc89f){return db[_0x7196('0x3d')][_0x7196('0x58')](_0x3177c2[_0x7196('0x59')],{})[_0x7196('0x22')](respondWithResult(_0x7bc89f,0xc9))['catch'](handleError(_0x7bc89f,null));};exports[_0x7196('0x37')]=function(_0x6b65c1,_0x10ee13){if(_0x6b65c1['body']['id']){delete _0x6b65c1[_0x7196('0x59')]['id'];}return db['SalesforceAccount'][_0x7196('0x57')]({'where':{'id':_0x6b65c1[_0x7196('0x54')]['id']}})[_0x7196('0x22')](handleEntityNotFound(_0x10ee13,null))[_0x7196('0x22')](saveUpdates(_0x6b65c1[_0x7196('0x59')],null))['then'](respondWithResult(_0x10ee13,null))[_0x7196('0x2b')](handleError(_0x10ee13,null));};exports['destroy']=function(_0x4be36d,_0x5b9824){return db[_0x7196('0x3d')][_0x7196('0x57')]({'where':{'id':_0x4be36d[_0x7196('0x54')]['id']}})[_0x7196('0x22')](handleEntityNotFound(_0x5b9824,null))[_0x7196('0x22')](removeEntity(_0x5b9824,null))[_0x7196('0x2b')](handleError(_0x5b9824,null));};exports[_0x7196('0x5a')]=function(_0x560ddb,_0x293467,_0x14dc43){var _0x2d14f4={};var _0x2e5c9c={};var _0x196f12;var _0x5ef1eb;return db['SalesforceAccount'][_0x7196('0x5b')]({'where':{'id':_0x560ddb[_0x7196('0x54')]['id']}})[_0x7196('0x22')](handleEntityNotFound(_0x293467,null))[_0x7196('0x22')](function(_0x14cb38){if(_0x14cb38){_0x196f12=_0x14cb38;_0x2e5c9c[_0x7196('0x44')]=_[_0x7196('0x42')](db[_0x7196('0x5c')][_0x7196('0x3e')]);_0x2e5c9c[_0x7196('0x48')]=_[_0x7196('0x42')](_0x560ddb['query']);_0x2e5c9c[_0x7196('0x4c')]=_[_0x7196('0x43')](_0x2e5c9c[_0x7196('0x44')],_0x2e5c9c[_0x7196('0x48')]);_0x2d14f4['attributes']=_[_0x7196('0x43')](_0x2e5c9c[_0x7196('0x44')],qs[_0x7196('0x45')](_0x560ddb[_0x7196('0x48')][_0x7196('0x45')]));_0x2d14f4[_0x7196('0x46')]=_0x2d14f4[_0x7196('0x46')]['length']?_0x2d14f4[_0x7196('0x46')]:_0x2e5c9c[_0x7196('0x44')];_0x2d14f4[_0x7196('0x4a')]=qs[_0x7196('0x4b')](_0x560ddb['query'][_0x7196('0x4b')]);_0x2d14f4[_0x7196('0x51')]=qs[_0x7196('0x4c')](_[_0x7196('0x4d')](_0x560ddb[_0x7196('0x48')],_0x2e5c9c[_0x7196('0x4c')]));if(_0x560ddb[_0x7196('0x48')]['filter']){_0x2d14f4['where']=_['merge'](_0x2d14f4[_0x7196('0x51')],{'$or':_['map'](_0x2d14f4[_0x7196('0x46')],function(_0x432a38){var _0x22511c={};_0x22511c[_0x432a38]={'$like':'%'+_0x560ddb[_0x7196('0x48')][_0x7196('0x4f')]+'%'};return _0x22511c;})});}_0x2d14f4=_[_0x7196('0x56')]({},_0x2d14f4,_0x560ddb[_0x7196('0x50')]);return _0x196f12[_0x7196('0x5a')](_0x2d14f4);}})[_0x7196('0x22')](function(_0x52ab69){if(_0x52ab69){_0x5ef1eb=_0x52ab69['length'];if(!_0x560ddb[_0x7196('0x48')][_0x7196('0x49')](_0x7196('0x5d'))){_0x2d14f4[_0x7196('0x31')]=qs[_0x7196('0x31')](_0x560ddb[_0x7196('0x48')][_0x7196('0x31')]);_0x2d14f4[_0x7196('0x30')]=qs['offset'](_0x560ddb['query'][_0x7196('0x30')]);}return _0x196f12['getConfigurations'](_0x2d14f4);}})[_0x7196('0x22')](function(_0x52f532){if(_0x52f532){return _0x52f532?{'count':_0x5ef1eb,'rows':_0x52f532}:null;}})[_0x7196('0x22')](respondWithResult(_0x293467,null))[_0x7196('0x2b')](handleError(_0x293467,null));};exports[_0x7196('0x5e')]=function(_0x267903,_0x5ab6ae,_0x5a786a){if(_0x267903[_0x7196('0x59')]['id']){delete _0x267903['body']['id'];}return db[_0x7196('0x3d')][_0x7196('0x5b')]({'where':{'id':_0x267903[_0x7196('0x54')]['id']}})[_0x7196('0x22')](handleEntityNotFound(_0x5ab6ae,null))[_0x7196('0x22')](function(_0x1af971){if(_0x1af971){_0x267903['body'][_0x7196('0x5f')]=_0x1af971['id'];_0x267903[_0x7196('0x59')][_0x7196('0x60')]=integrations[_0x7196('0x61')](_0x267903[_0x7196('0x59')][_0x7196('0x62')],_0x267903[_0x7196('0x59')][_0x7196('0x40')]);_0x267903[_0x7196('0x59')][_0x7196('0x63')]=integrations[_0x7196('0x64')](_0x267903[_0x7196('0x59')]['channel'],_0x267903[_0x7196('0x59')][_0x7196('0x40')]);return db['SalesforceConfiguration']['create'](_0x267903[_0x7196('0x59')],{'include':[{'model':db[_0x7196('0x65')],'as':_0x7196('0x60')},{'model':db['SalesforceField'],'as':_0x7196('0x63')}]});}return null;})['then'](respondWithResult(_0x5ab6ae,null))[_0x7196('0x2b')](handleError(_0x5ab6ae,null));};exports[_0x7196('0x66')]=function(_0x4bcf73,_0x1b3d4a,_0x59f5ac){var _0x50d1f1;var _0x379bdb='';var _0x29b7c4=_0x7196('0x67');return db['SalesforceAccount'][_0x7196('0x5b')]({'where':{'id':_0x4bcf73['params']['id']},'attributes':['id',_0x7196('0x68'),_0x7196('0x69'),_0x7196('0x6a'),_0x7196('0x6b'),_0x7196('0x6c'),'securityToken']})[_0x7196('0x22')](handleEntityNotFound(_0x1b3d4a,null))[_0x7196('0x22')](function(_0xc9c0a6){if(_0xc9c0a6){_0x379bdb=_0xc9c0a6[_0x7196('0x68')];var _0xc44ef5=_0x379bdb[_0x7196('0x6d')](-0x1);if(_0xc44ef5==='/'){_0x379bdb=_0x379bdb[_0x7196('0x6e')](0x0,_0x379bdb[_0x7196('0x6f')](_0xc44ef5));}_0x50d1f1=new jsforce['Connection']({'oauth2':{'loginUrl':_0x379bdb,'clientId':_0xc9c0a6[_0x7196('0x69')],'clientSecret':_0xc9c0a6[_0x7196('0x6a')]}});return _0x50d1f1[_0x7196('0x70')](_0xc9c0a6[_0x7196('0x6b')],_0xc9c0a6['password'][_0x7196('0x71')](_0xc9c0a6[_0x7196('0x72')]));}})['then'](function(_0x2e4807){if(_0x2e4807){if(!_['isNil'](_0x4bcf73[_0x7196('0x48')]['ticketType'])){_0x29b7c4=_0x4bcf73[_0x7196('0x48')][_0x7196('0x73')];}return _0x50d1f1['sobject'](_0x29b7c4)[_0x7196('0x74')]();}})[_0x7196('0x22')](function(_0x2c2c53){var _0x4d5ea0=['CallDisposition',_0x7196('0x75'),'CallObject','CallType',_0x7196('0x76'),_0x7196('0x77'),_0x7196('0x78'),'Type'];if(!_[_0x7196('0x79')](_0x4bcf73[_0x7196('0x48')][_0x7196('0x73')])&&_0x4bcf73[_0x7196('0x48')][_0x7196('0x73')]===_0x7196('0x7a')){_0x4d5ea0=[_0x7196('0x7b'),_0x7196('0x7c'),_0x7196('0x7d'),_0x7196('0x78'),_0x7196('0x77'),'IsEscalated','SuppliedName',_0x7196('0x7e')];}if(_0x2c2c53){_['remove'](_0x2c2c53['fields'],function(_0x2bfdc4){return _0x2bfdc4[_0x7196('0x7f')]===![]&&!_0x4d5ea0[_0x7196('0x80')](_0x2bfdc4[_0x7196('0x3a')]);});return{'count':_0x2c2c53['fields']['length'],'rows':_[_0x7196('0x3c')](_0x2c2c53[_0x7196('0x45')],function(_0x1eea71){return{'id':_0x1eea71[_0x7196('0x3a')],'name':_0x1eea71['label'],'custom':_0x1eea71[_0x7196('0x7f')],'options':_0x1eea71['picklistValues']['length']>0x0?_[_0x7196('0x3c')](_0x1eea71[_0x7196('0x81')],function(_0x1e14da){return{'name':_0x1e14da['label'],'value':_0x1e14da[_0x7196('0x82')]};}):_0x1eea71[_0x7196('0x40')]==_0x7196('0x83')?[{'name':_0x7196('0x84'),'value':_0x7196('0x85')},{'name':_0x7196('0x86'),'value':_0x7196('0x87')}]:[]};})};}})[_0x7196('0x22')](respondWithResult(_0x1b3d4a,null))['catch'](function(_0x9bd2ea){var _0x2479b9=_0x4bcf73[_0x7196('0x48')][_0x7196('0x1e')]?0x1f4:_0x9bd2ea[_0x7196('0x88')]||0x1f4;logger['error'](_0x7196('0x89'),_0x7196('0x66'),_0x2479b9,JSON[_0x7196('0x27')](_0x9bd2ea));delete _0x9bd2ea['name'];if(_0x2479b9===0x191){_0x2479b9=0x190;}_0x1b3d4a[_0x7196('0x2c')](_0x2479b9)['send'](_0x4bcf73['query'][_0x7196('0x1e')]?{'message':_0x7196('0x8a'),'statusCode':_0x9bd2ea['statusCode']}:_0x9bd2ea);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 2268647..39edd97 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 _0x320d=['../../config/environment','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x2da0bd,_0xe37a3){var _0x442bbe=function(_0xaf8e16){while(--_0xaf8e16){_0x2da0bd['push'](_0x2da0bd['shift']());}};_0x442bbe(++_0xe37a3);}(_0x320d,0x1b6));var _0xd320=function(_0x29bdb9,_0x47bea1){_0x29bdb9=_0x29bdb9-0x0;var _0x2d63ef=_0x320d[_0x29bdb9];return _0x2d63ef;};'use strict';var _=require(_0xd320('0x0'));var util=require('util');var logger=require(_0xd320('0x1'))(_0xd320('0x2'));var moment=require(_0xd320('0x3'));var BPromise=require('bluebird');var rp=require(_0xd320('0x4'));var fs=require('fs');var path=require(_0xd320('0x5'));var rimraf=require('rimraf');var config=require(_0xd320('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xd320('0x7'));module[_0xd320('0x8')]=function(_0x14467e,_0x2eb41f){return _0x14467e[_0xd320('0x9')](_0xd320('0xa'),attributes,{'tableName':_0xd320('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf8b3=['define','int_salesforce_accounts','lodash','util','moment','request-promise','exports'];(function(_0x15f93e,_0x47dfaa){var _0x189452=function(_0x4c6869){while(--_0x4c6869){_0x15f93e['push'](_0x15f93e['shift']());}};_0x189452(++_0x47dfaa);}(_0xf8b3,0x6b));var _0x3f8b=function(_0x295314,_0x17b250){_0x295314=_0x295314-0x0;var _0x584b0c=_0xf8b3[_0x295314];return _0x584b0c;};'use strict';var _=require(_0x3f8b('0x0'));var util=require(_0x3f8b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3f8b('0x2'));var BPromise=require('bluebird');var rp=require(_0x3f8b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x3f8b('0x4')]=function(_0xa4e8d5,_0x44b98b){return _0xa4e8d5[_0x3f8b('0x5')]('SalesforceAccount',attributes,{'tableName':_0x3f8b('0x6'),'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 894f428..8a0cc59 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 _0x99e9=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SalesforceAccount','findAll','options','where','attributes','limit','include','model','map','GetSalesforceAccount','ShowSalesforceAccount','find','raw'];(function(_0x1296a9,_0x532b4a){var _0x279e58=function(_0x308398){while(--_0x308398){_0x1296a9['push'](_0x1296a9['shift']());}};_0x279e58(++_0x532b4a);}(_0x99e9,0xb4));var _0x999e=function(_0x3c2666,_0x15fd23){_0x3c2666=_0x3c2666-0x0;var _0x10c814=_0x99e9[_0x3c2666];return _0x10c814;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var moment=require(_0x999e('0x1'));var BPromise=require(_0x999e('0x2'));var rs=require(_0x999e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x999e('0x4'))['db'];var utils=require(_0x999e('0x5'));var logger=require(_0x999e('0x6'))('rpc');var config=require(_0x999e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x999e('0x8')][_0x999e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x100330,_0x18f337,_0x5c1c17){return new BPromise(function(_0x46aeae,_0x38a692){return client[_0x999e('0xa')](_0x100330,_0x5c1c17)[_0x999e('0xb')](function(_0x2c38cf){logger[_0x999e('0xc')](_0x999e('0xd'),_0x18f337,_0x999e('0xe'));logger[_0x999e('0xf')](_0x999e('0x10'),_0x18f337,_0x999e('0xe'),JSON[_0x999e('0x11')](_0x2c38cf));if(_0x2c38cf[_0x999e('0x12')]){if(_0x2c38cf[_0x999e('0x12')][_0x999e('0x13')]===0x1f4){logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x38a692(_0x2c38cf['error'][_0x999e('0x14')]);}logger[_0x999e('0x12')](_0x999e('0xd'),_0x18f337,_0x2c38cf['error'][_0x999e('0x14')]);return _0x46aeae(_0x2c38cf['error'][_0x999e('0x14')]);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x18f337,_0x999e('0xe'));_0x46aeae(_0x2c38cf[_0x999e('0x15')][_0x999e('0x14')]);}})[_0x999e('0x16')](function(_0x1e9bff){logger[_0x999e('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x18f337,_0x1e9bff);_0x38a692(_0x1e9bff);});});}exports['GetSalesforceAccount']=function(_0x4fcdfb){var _0x3153ce=this;return new Promise(function(_0x43b09e,_0xc4ef74){return db[_0x999e('0x17')][_0x999e('0x18')]({'raw':_0x4fcdfb[_0x999e('0x19')]?_0x4fcdfb['options']['raw']===undefined?!![]:![]:!![],'where':_0x4fcdfb[_0x999e('0x19')]?_0x4fcdfb[_0x999e('0x19')][_0x999e('0x1a')]||null:null,'attributes':_0x4fcdfb['options']?_0x4fcdfb[_0x999e('0x19')][_0x999e('0x1b')]||null:null,'limit':_0x4fcdfb[_0x999e('0x19')]?_0x4fcdfb[_0x999e('0x19')][_0x999e('0x1c')]||null:null,'include':_0x4fcdfb[_0x999e('0x19')]?_0x4fcdfb[_0x999e('0x19')]['include']?_['map'](_0x4fcdfb[_0x999e('0x19')][_0x999e('0x1d')],function(_0x4c5491){return{'model':db[_0x4c5491[_0x999e('0x1e')]],'as':_0x4c5491['as'],'attributes':_0x4c5491[_0x999e('0x1b')],'include':_0x4c5491[_0x999e('0x1d')]?_[_0x999e('0x1f')](_0x4c5491[_0x999e('0x1d')],function(_0x320634){return{'model':db[_0x320634['model']],'as':_0x320634['as'],'attributes':_0x320634[_0x999e('0x1b')],'include':_0x320634[_0x999e('0x1d')]?_[_0x999e('0x1f')](_0x320634[_0x999e('0x1d')],function(_0x1b7adb){return{'model':db[_0x1b7adb[_0x999e('0x1e')]],'as':_0x1b7adb['as'],'attributes':_0x1b7adb[_0x999e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x28f803){logger['info']('GetSalesforceAccount',_0x4fcdfb);logger[_0x999e('0xf')](_0x999e('0x20'),_0x4fcdfb,JSON[_0x999e('0x11')](_0x28f803));_0x43b09e(_0x28f803);})['catch'](function(_0x1ea0e4){logger[_0x999e('0x12')](_0x999e('0x20'),_0x1ea0e4[_0x999e('0x14')],_0x4fcdfb);_0xc4ef74(_0x3153ce[_0x999e('0x12')](0x1f4,_0x1ea0e4[_0x999e('0x14')]));});});};exports[_0x999e('0x21')]=function(_0x2e9b0e){var _0x27102b=this;return new Promise(function(_0x3ddacb,_0x53ece1){return db[_0x999e('0x17')][_0x999e('0x22')]({'raw':_0x2e9b0e[_0x999e('0x19')]?_0x2e9b0e['options'][_0x999e('0x23')]===undefined?!![]:![]:!![],'where':_0x2e9b0e['options']?_0x2e9b0e['options'][_0x999e('0x1a')]||null:null,'attributes':_0x2e9b0e[_0x999e('0x19')]?_0x2e9b0e['options']['attributes']||null:null,'include':_0x2e9b0e[_0x999e('0x19')]?_0x2e9b0e[_0x999e('0x19')][_0x999e('0x1d')]?_[_0x999e('0x1f')](_0x2e9b0e['options'][_0x999e('0x1d')],function(_0x41d6f1){return{'model':db[_0x41d6f1[_0x999e('0x1e')]],'as':_0x41d6f1['as'],'attributes':_0x41d6f1[_0x999e('0x1b')],'include':_0x41d6f1['include']?_['map'](_0x41d6f1[_0x999e('0x1d')],function(_0x490694){return{'model':db[_0x490694[_0x999e('0x1e')]],'as':_0x490694['as'],'attributes':_0x490694[_0x999e('0x1b')],'include':_0x490694[_0x999e('0x1d')]?_[_0x999e('0x1f')](_0x490694['include'],function(_0xebda67){return{'model':db[_0xebda67[_0x999e('0x1e')]],'as':_0xebda67['as'],'attributes':_0xebda67['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x327866){logger['info'](_0x999e('0x21'),_0x2e9b0e);logger['debug']('ShowSalesforceAccount',_0x2e9b0e,JSON['stringify'](_0x327866));_0x3ddacb(_0x327866);})['catch'](function(_0x17e257){logger['error'](_0x999e('0x21'),_0x17e257['message'],_0x2e9b0e);_0x53ece1(_0x27102b['error'](0x1f4,_0x17e257['message']));});});}; \ No newline at end of file +var _0x702d=['info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','SalesforceAccount','findAll','options','raw','attributes','include','map','model','GetSalesforceAccount','catch','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x166294,_0x175bc9){var _0x304968=function(_0x119ed1){while(--_0x119ed1){_0x166294['push'](_0x166294['shift']());}};_0x304968(++_0x175bc9);}(_0x702d,0x147));var _0xd702=function(_0x1be5f5,_0x520414){_0x1be5f5=_0x1be5f5-0x0;var _0x68d189=_0x702d[_0x1be5f5];return _0x68d189;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var moment=require(_0xd702('0x2'));var BPromise=require(_0xd702('0x3'));var rs=require(_0xd702('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd702('0x5'))['db'];var utils=require(_0xd702('0x6'));var logger=require(_0xd702('0x7'))(_0xd702('0x8'));var config=require('../../config/environment');var jayson=require(_0xd702('0x9'));var client=jayson['client'][_0xd702('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a2c03,_0xf4bf4f,_0x5af246){return new BPromise(function(_0x12bb75,_0x53bd02){return client[_0xd702('0xb')](_0x3a2c03,_0x5af246)[_0xd702('0xc')](function(_0x907a9f){logger[_0xd702('0xd')](_0xd702('0xe'),_0xf4bf4f,_0xd702('0xf'));logger[_0xd702('0x10')](_0xd702('0x11'),_0xf4bf4f,_0xd702('0xf'),JSON[_0xd702('0x12')](_0x907a9f));if(_0x907a9f['error']){if(_0x907a9f['error'][_0xd702('0x13')]===0x1f4){logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x907a9f['error'][_0xd702('0x15')]);return _0x53bd02(_0x907a9f[_0xd702('0x14')][_0xd702('0x15')]);}logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x907a9f[_0xd702('0x14')]['message']);return _0x12bb75(_0x907a9f[_0xd702('0x14')][_0xd702('0x15')]);}else{logger['info'](_0xd702('0xe'),_0xf4bf4f,'request\x20sent');_0x12bb75(_0x907a9f[_0xd702('0x16')][_0xd702('0x15')]);}})['catch'](function(_0x2ba791){logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x2ba791);_0x53bd02(_0x2ba791);});});}exports['GetSalesforceAccount']=function(_0x5b3b1d){var _0x2205de=this;return new Promise(function(_0x5a296e,_0x3fbcec){return db[_0xd702('0x17')][_0xd702('0x18')]({'raw':_0x5b3b1d[_0xd702('0x19')]?_0x5b3b1d[_0xd702('0x19')][_0xd702('0x1a')]===undefined?!![]:![]:!![],'where':_0x5b3b1d[_0xd702('0x19')]?_0x5b3b1d['options']['where']||null:null,'attributes':_0x5b3b1d['options']?_0x5b3b1d[_0xd702('0x19')][_0xd702('0x1b')]||null:null,'limit':_0x5b3b1d['options']?_0x5b3b1d[_0xd702('0x19')]['limit']||null:null,'include':_0x5b3b1d[_0xd702('0x19')]?_0x5b3b1d['options']['include']?_['map'](_0x5b3b1d[_0xd702('0x19')][_0xd702('0x1c')],function(_0x459184){return{'model':db[_0x459184['model']],'as':_0x459184['as'],'attributes':_0x459184[_0xd702('0x1b')],'include':_0x459184[_0xd702('0x1c')]?_[_0xd702('0x1d')](_0x459184[_0xd702('0x1c')],function(_0x1200ed){return{'model':db[_0x1200ed[_0xd702('0x1e')]],'as':_0x1200ed['as'],'attributes':_0x1200ed[_0xd702('0x1b')],'include':_0x1200ed[_0xd702('0x1c')]?_[_0xd702('0x1d')](_0x1200ed['include'],function(_0x116b2f){return{'model':db[_0x116b2f[_0xd702('0x1e')]],'as':_0x116b2f['as'],'attributes':_0x116b2f[_0xd702('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd702('0xc')](function(_0xbe4518){logger[_0xd702('0xd')](_0xd702('0x1f'),_0x5b3b1d);logger[_0xd702('0x10')]('GetSalesforceAccount',_0x5b3b1d,JSON['stringify'](_0xbe4518));_0x5a296e(_0xbe4518);})[_0xd702('0x20')](function(_0x43cd38){logger['error'](_0xd702('0x1f'),_0x43cd38[_0xd702('0x15')],_0x5b3b1d);_0x3fbcec(_0x2205de[_0xd702('0x14')](0x1f4,_0x43cd38[_0xd702('0x15')]));});});};exports['ShowSalesforceAccount']=function(_0x213c31){var _0x313281=this;return new Promise(function(_0x1630ed,_0x43fe18){return db[_0xd702('0x17')]['find']({'raw':_0x213c31[_0xd702('0x19')]?_0x213c31[_0xd702('0x19')][_0xd702('0x1a')]===undefined?!![]:![]:!![],'where':_0x213c31['options']?_0x213c31[_0xd702('0x19')]['where']||null:null,'attributes':_0x213c31['options']?_0x213c31[_0xd702('0x19')][_0xd702('0x1b')]||null:null,'include':_0x213c31[_0xd702('0x19')]?_0x213c31['options'][_0xd702('0x1c')]?_[_0xd702('0x1d')](_0x213c31['options'][_0xd702('0x1c')],function(_0x1f7c7e){return{'model':db[_0x1f7c7e[_0xd702('0x1e')]],'as':_0x1f7c7e['as'],'attributes':_0x1f7c7e[_0xd702('0x1b')],'include':_0x1f7c7e[_0xd702('0x1c')]?_[_0xd702('0x1d')](_0x1f7c7e[_0xd702('0x1c')],function(_0x25d2cd){return{'model':db[_0x25d2cd[_0xd702('0x1e')]],'as':_0x25d2cd['as'],'attributes':_0x25d2cd[_0xd702('0x1b')],'include':_0x25d2cd[_0xd702('0x1c')]?_[_0xd702('0x1d')](_0x25d2cd[_0xd702('0x1c')],function(_0x508652){return{'model':db[_0x508652[_0xd702('0x1e')]],'as':_0x508652['as'],'attributes':_0x508652[_0xd702('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd702('0xc')](function(_0x36a94b){logger[_0xd702('0xd')](_0xd702('0x21'),_0x213c31);logger[_0xd702('0x10')]('ShowSalesforceAccount',_0x213c31,JSON['stringify'](_0x36a94b));_0x1630ed(_0x36a94b);})[_0xd702('0x20')](function(_0x1810ee){logger['error']('ShowSalesforceAccount',_0x1810ee[_0xd702('0x15')],_0x213c31);_0x43fe18(_0x313281[_0xd702('0x14')](0x1f4,_0x1810ee['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 672df4f..e314fed 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 _0xd03c=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated'];(function(_0x1066a3,_0x41ee2c){var _0x46fec6=function(_0x1c8e9c){while(--_0x1c8e9c){_0x1066a3['push'](_0x1066a3['shift']());}};_0x46fec6(++_0x41ee2c);}(_0xd03c,0x84));var _0xcd03=function(_0x24e557,_0x4ed45d){_0x24e557=_0x24e557-0x0;var _0x1d6182=_0xd03c[_0x24e557];return _0x1d6182;};'use strict';var multer=require('multer');var util=require(_0xcd03('0x0'));var path=require(_0xcd03('0x1'));var timeout=require(_0xcd03('0x2'));var express=require(_0xcd03('0x3'));var router=express[_0xcd03('0x4')]();var auth=require(_0xcd03('0x5'));var interaction=require(_0xcd03('0x6'));var config=require(_0xcd03('0x7'));var controller=require(_0xcd03('0x8'));router[_0xcd03('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcd03('0x9')](_0xcd03('0xa'),auth[_0xcd03('0xb')](),controller[_0xcd03('0xc')]);router[_0xcd03('0x9')](_0xcd03('0xd'),auth[_0xcd03('0xb')](),controller[_0xcd03('0xe')]);router[_0xcd03('0x9')](_0xcd03('0xf'),auth[_0xcd03('0xb')](),controller[_0xcd03('0x10')]);router[_0xcd03('0x9')](_0xcd03('0x11'),auth[_0xcd03('0xb')](),controller[_0xcd03('0x12')]);router[_0xcd03('0x13')]('/',auth['isAuthenticated'](),controller[_0xcd03('0x14')]);router[_0xcd03('0x15')](_0xcd03('0xa'),auth['isAuthenticated'](),controller[_0xcd03('0x16')]);router['delete'](_0xcd03('0xa'),auth[_0xcd03('0xb')](),controller[_0xcd03('0x17')]);module['exports']=router; \ No newline at end of file +var _0xc6c6=['post','create','put','/:id','delete','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x323708,_0x4bebf2){var _0x3da3d7=function(_0x5aa71c){while(--_0x5aa71c){_0x323708['push'](_0x323708['shift']());}};_0x3da3d7(++_0x4bebf2);}(_0xc6c6,0x17f));var _0x6c6c=function(_0x5a5395,_0x5361f6){_0x5a5395=_0x5a5395-0x0;var _0x4da43d=_0xc6c6[_0x5a5395];return _0x4da43d;};'use strict';var multer=require('multer');var util=require(_0x6c6c('0x0'));var path=require('path');var timeout=require(_0x6c6c('0x1'));var express=require(_0x6c6c('0x2'));var router=express[_0x6c6c('0x3')]();var auth=require(_0x6c6c('0x4'));var interaction=require(_0x6c6c('0x5'));var config=require(_0x6c6c('0x6'));var controller=require(_0x6c6c('0x7'));router[_0x6c6c('0x8')]('/',auth[_0x6c6c('0x9')](),controller[_0x6c6c('0xa')]);router[_0x6c6c('0x8')]('/:id',auth[_0x6c6c('0x9')](),controller[_0x6c6c('0xb')]);router[_0x6c6c('0x8')](_0x6c6c('0xc'),auth['isAuthenticated'](),controller[_0x6c6c('0xd')]);router[_0x6c6c('0x8')](_0x6c6c('0xe'),auth[_0x6c6c('0x9')](),controller[_0x6c6c('0xf')]);router[_0x6c6c('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x6c6c('0x10')]('/',auth[_0x6c6c('0x9')](),controller[_0x6c6c('0x11')]);router[_0x6c6c('0x12')](_0x6c6c('0x13'),auth[_0x6c6c('0x9')](),controller['update']);router[_0x6c6c('0x14')](_0x6c6c('0x13'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 590637f..d8851b0 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 _0xcc67=['contact_lead','contact','lead','sequelize','exports','ENUM','Task'];(function(_0x5e3147,_0x4bcdad){var _0x2a8609=function(_0x536fd2){while(--_0x536fd2){_0x5e3147['push'](_0x5e3147['shift']());}};_0x2a8609(++_0x4bcdad);}(_0xcc67,0x88));var _0x7cc6=function(_0x210796,_0x19bd4e){_0x210796=_0x210796-0x0;var _0x2bf1da=_0xcc67[_0x210796];return _0x2bf1da;};'use strict';var Sequelize=require(_0x7cc6('0x0'));module[_0x7cc6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x7cc6('0x2')](_0x7cc6('0x3'),'Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x7cc6('0x2')]('contact_lead','contact','lead'),'defaultValue':_0x7cc6('0x4')},'moduleCreate':{'type':Sequelize[_0x7cc6('0x2')]('nothing',_0x7cc6('0x5'),_0x7cc6('0x6')),'defaultValue':'lead'}}; \ No newline at end of file +var _0x42b2=['contact_lead','contact','lead','nothing','sequelize','STRING','ENUM','Case','Task'];(function(_0x312d58,_0x5a4a00){var _0x2e22eb=function(_0xeca3c3){while(--_0xeca3c3){_0x312d58['push'](_0x312d58['shift']());}};_0x2e22eb(++_0x5a4a00);}(_0x42b2,0x1ea));var _0x242b=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x42b2[_0x37c22c];return _0x119d79;};'use strict';var Sequelize=require(_0x242b('0x0'));module['exports']={'name':{'type':Sequelize[_0x242b('0x1')]},'description':{'type':Sequelize[_0x242b('0x1')]},'ticketType':{'type':Sequelize[_0x242b('0x2')]('Task',_0x242b('0x3')),'defaultValue':_0x242b('0x4')},'moduleSearch':{'type':Sequelize[_0x242b('0x2')](_0x242b('0x5'),_0x242b('0x6'),_0x242b('0x7')),'defaultValue':_0x242b('0x5')},'moduleCreate':{'type':Sequelize[_0x242b('0x2')](_0x242b('0x8'),_0x242b('0x6'),_0x242b('0x7')),'defaultValue':_0x242b('0x7')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 813f2ed..7c93c05 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 _0xebc8=['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','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','count','offset','Content-Range','apply','save','update','destroy','stack','name','send','index','map','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','SalesforceConfiguration','findAll','rows','show','find','create','body','params','getFields','findOne','SalesforceField','rawAttributes','getDescriptions','hasOwnProperty','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x11eb2d,_0x33c1a4){var _0x1bbf86=function(_0x359ce5){while(--_0x359ce5){_0x11eb2d['push'](_0x11eb2d['shift']());}};_0x1bbf86(++_0x33c1a4);}(_0xebc8,0x9a));var _0x8ebc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xebc8[_0x397e5f];return _0x5302b8;};'use strict';var pdf=require(_0x8ebc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8ebc('0x1'));var zipdir=require(_0x8ebc('0x2'));var jsonpatch=require(_0x8ebc('0x3'));var rp=require(_0x8ebc('0x4'));var moment=require(_0x8ebc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8ebc('0x6'));var util=require(_0x8ebc('0x7'));var path=require('path');var sox=require(_0x8ebc('0x8'));var csv=require(_0x8ebc('0x9'));var ejs=require(_0x8ebc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8ebc('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8ebc('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ebc('0xd'));var Redis=require(_0x8ebc('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8ebc('0xf'));var as=require(_0x8ebc('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8ebc('0x11'));var config=require(_0x8ebc('0x12'));var db=require(_0x8ebc('0x13'))['db'];var jayson=require(_0x8ebc('0x14'));var client=jayson[_0x8ebc('0x15')][_0x8ebc('0x16')]({'port':0x232a});function checkPasswordPattern(_0x4cc469,_0x58ee35,_0xee5df1){if(_0xee5df1){var _0x36ce7e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x36ce7e['test'](_0x58ee35)){return _0x4cc469;}else{throw new db['Sequelize'][(_0x8ebc('0x17'))](_0x8ebc('0x18'));}}else{return _0x4cc469;}}function respondWithRpcPromise(_0xb9f25b,_0x44be3c,_0x450bbf,_0x4944d9){return new BPromise(function(_0x3cac5c,_0x230fb9){var _0x4fd523=_0x4944d9||client;return _0x4fd523[_0x8ebc('0x19')](_0xb9f25b,_0x450bbf)[_0x8ebc('0x1a')](function(_0x537afc){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x44be3c,'request\x20sent');logger[_0x8ebc('0x1b')](_0x8ebc('0x1c'),_0x44be3c,_0x8ebc('0x1d'),JSON[_0x8ebc('0x1e')](_0x537afc));if(_0x537afc['error']){if(_0x537afc[_0x8ebc('0x1f')][_0x8ebc('0x20')]===0x1f4){logger[_0x8ebc('0x1f')](_0x8ebc('0x21'),_0x44be3c,_0x537afc['error']['message']);return _0x230fb9(_0x537afc[_0x8ebc('0x1f')][_0x8ebc('0x22')]);}logger[_0x8ebc('0x1f')]('SalesforceConfiguration,\x20%s,\x20%s',_0x44be3c,_0x537afc['error']['message']);return _0x3cac5c(_0x537afc[_0x8ebc('0x1f')]['message']);}else{logger['info'](_0x8ebc('0x21'),_0x44be3c,_0x8ebc('0x1d'));_0x3cac5c(_0x537afc['result'][_0x8ebc('0x22')]);}})[_0x8ebc('0x23')](function(_0x256483){logger[_0x8ebc('0x1f')](_0x8ebc('0x21'),_0x44be3c,_0x256483);_0x230fb9(_0x256483);});});}function respondWithStatusCode(_0x3c1e5e,_0x37430b){_0x37430b=_0x37430b||0xcc;return function(_0x4fef1d){if(_0x4fef1d){return _0x3c1e5e[_0x8ebc('0x24')](_0x37430b);}return _0x3c1e5e[_0x8ebc('0x25')](_0x37430b)['end']();};}function respondWithResult(_0x332b5f,_0x2f6826){_0x2f6826=_0x2f6826||0xc8;return function(_0x27cba0){if(_0x27cba0){return _0x332b5f[_0x8ebc('0x25')](_0x2f6826)['json'](_0x27cba0);}};}function respondWithFilteredResult(_0x3663b0,_0x236a97){return function(_0x16bdf9){if(_0x16bdf9){var _0x11ca34=_0x16bdf9[_0x8ebc('0x26')],_0x5c0c1f=_0x236a97[_0x8ebc('0x27')],_0x407035=_0x236a97[_0x8ebc('0x27')]+_0x236a97['limit'],_0x1d1ea5;if(_0x407035>=_0x11ca34){_0x407035=_0x11ca34;_0x1d1ea5=0xc8;}else{_0x1d1ea5=0xce;}_0x3663b0['status'](_0x1d1ea5);return _0x3663b0['set'](_0x8ebc('0x28'),_0x5c0c1f+'-'+_0x407035+'/'+_0x11ca34)['json'](_0x16bdf9);}return null;};}function patchUpdates(_0x575285){return function(_0x1f954c){try{jsonpatch[_0x8ebc('0x29')](_0x1f954c,_0x575285,!![]);}catch(_0x209007){return BPromise['reject'](_0x209007);}return _0x1f954c[_0x8ebc('0x2a')]();};}function saveUpdates(_0x5371a1,_0x5cd5ed){return function(_0x256112){if(_0x256112){return _0x256112[_0x8ebc('0x2b')](_0x5371a1)[_0x8ebc('0x1a')](function(_0x5cdb42){return _0x5cdb42;});}return null;};}function removeEntity(_0x14f910,_0x4f34e4){return function(_0x1b794b){if(_0x1b794b){return _0x1b794b[_0x8ebc('0x2c')]()[_0x8ebc('0x1a')](function(){_0x14f910['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b93cb,_0x110992){return function(_0x561d51){if(!_0x561d51){_0x4b93cb[_0x8ebc('0x24')](0x194);}return _0x561d51;};}function handleError(_0x6b6fe9,_0x57c116){_0x57c116=_0x57c116||0x1f4;return function(_0x45643c){logger['error'](_0x45643c[_0x8ebc('0x2d')]);if(_0x45643c[_0x8ebc('0x2e')]){delete _0x45643c[_0x8ebc('0x2e')];}_0x6b6fe9[_0x8ebc('0x25')](_0x57c116)[_0x8ebc('0x2f')](_0x45643c);};}exports[_0x8ebc('0x30')]=function(_0x4e2c45,_0x5c4b5d){var _0x1f6363={},_0x719bbe={},_0x3169a2={'count':0x0,'rows':[]};var _0xb6446b=_[_0x8ebc('0x31')](db['SalesforceConfiguration']['rawAttributes'],function(_0x4f44a3){return{'name':_0x4f44a3[_0x8ebc('0x32')],'type':_0x4f44a3[_0x8ebc('0x33')][_0x8ebc('0x34')]};});_0x719bbe[_0x8ebc('0x35')]=_[_0x8ebc('0x31')](_0xb6446b,_0x8ebc('0x2e'));_0x719bbe[_0x8ebc('0x36')]=_[_0x8ebc('0x37')](_0x4e2c45[_0x8ebc('0x36')]);_0x719bbe['filters']=_['intersection'](_0x719bbe[_0x8ebc('0x35')],_0x719bbe[_0x8ebc('0x36')]);_0x1f6363[_0x8ebc('0x38')]=_[_0x8ebc('0x39')](_0x719bbe[_0x8ebc('0x35')],qs[_0x8ebc('0x3a')](_0x4e2c45['query'][_0x8ebc('0x3a')]));_0x1f6363['attributes']=_0x1f6363[_0x8ebc('0x38')][_0x8ebc('0x3b')]?_0x1f6363['attributes']:_0x719bbe[_0x8ebc('0x35')];if(!_0x4e2c45[_0x8ebc('0x36')]['hasOwnProperty'](_0x8ebc('0x3c'))){_0x1f6363[_0x8ebc('0x3d')]=qs[_0x8ebc('0x3d')](_0x4e2c45['query'][_0x8ebc('0x3d')]);_0x1f6363[_0x8ebc('0x27')]=qs[_0x8ebc('0x27')](_0x4e2c45[_0x8ebc('0x36')][_0x8ebc('0x27')]);}_0x1f6363[_0x8ebc('0x3e')]=qs[_0x8ebc('0x3f')](_0x4e2c45['query'][_0x8ebc('0x3f')]);_0x1f6363['where']=qs[_0x8ebc('0x40')](_[_0x8ebc('0x41')](_0x4e2c45['query'],_0x719bbe[_0x8ebc('0x40')]));if(_0x4e2c45[_0x8ebc('0x36')][_0x8ebc('0x42')]){_0x1f6363[_0x8ebc('0x43')]=_[_0x8ebc('0x44')](_0x1f6363[_0x8ebc('0x43')],{'$or':_[_0x8ebc('0x31')](_0xb6446b,function(_0x3da920){if(_0x3da920['type']!==_0x8ebc('0x45')){var _0x5ef390={};_0x5ef390[_0x3da920[_0x8ebc('0x2e')]]={'$like':'%'+_0x4e2c45['query'][_0x8ebc('0x42')]+'%'};return _0x5ef390;}})});}_0x1f6363=_['merge']({},_0x1f6363,_0x4e2c45[_0x8ebc('0x46')]);var _0x4dc78f={'where':_0x1f6363[_0x8ebc('0x43')]};return db['SalesforceConfiguration'][_0x8ebc('0x26')](_0x4dc78f)[_0x8ebc('0x1a')](function(_0x20203d){_0x3169a2[_0x8ebc('0x26')]=_0x20203d;if(_0x4e2c45[_0x8ebc('0x36')][_0x8ebc('0x47')]){_0x1f6363[_0x8ebc('0x48')]=[{'all':!![]}];}return db[_0x8ebc('0x49')][_0x8ebc('0x4a')](_0x1f6363);})['then'](function(_0x21d7d8){_0x3169a2[_0x8ebc('0x4b')]=_0x21d7d8;return _0x3169a2;})['then'](respondWithFilteredResult(_0x5c4b5d,_0x1f6363))['catch'](handleError(_0x5c4b5d,null));};exports[_0x8ebc('0x4c')]=function(_0x249114,_0x1c6322){var _0x31ef78={'raw':![],'where':{'id':_0x249114['params']['id']}},_0xb572ae={};_0xb572ae['model']=_['keys'](db[_0x8ebc('0x49')]['rawAttributes']);_0xb572ae[_0x8ebc('0x36')]=_[_0x8ebc('0x37')](_0x249114[_0x8ebc('0x36')]);_0xb572ae['filters']=_['intersection'](_0xb572ae[_0x8ebc('0x35')],_0xb572ae[_0x8ebc('0x36')]);_0x31ef78[_0x8ebc('0x38')]=_[_0x8ebc('0x39')](_0xb572ae[_0x8ebc('0x35')],qs['fields'](_0x249114['query'][_0x8ebc('0x3a')]));_0x31ef78[_0x8ebc('0x38')]=_0x31ef78['attributes'][_0x8ebc('0x3b')]?_0x31ef78[_0x8ebc('0x38')]:_0xb572ae[_0x8ebc('0x35')];if(_0x249114['query'][_0x8ebc('0x47')]){_0x31ef78['include']=[{'all':!![]}];}_0x31ef78=_['merge']({},_0x31ef78,_0x249114[_0x8ebc('0x46')]);return db[_0x8ebc('0x49')][_0x8ebc('0x4d')](_0x31ef78)[_0x8ebc('0x1a')](handleEntityNotFound(_0x1c6322,null))[_0x8ebc('0x1a')](respondWithResult(_0x1c6322,null))[_0x8ebc('0x23')](handleError(_0x1c6322,null));};exports[_0x8ebc('0x4e')]=function(_0x327260,_0x4ded02){return db[_0x8ebc('0x49')][_0x8ebc('0x4e')](_0x327260['body'],{})['then'](respondWithResult(_0x4ded02,0xc9))['catch'](handleError(_0x4ded02,null));};exports['update']=function(_0x2c8c8a,_0x5cf333){if(_0x2c8c8a[_0x8ebc('0x4f')]['id']){delete _0x2c8c8a['body']['id'];}return db[_0x8ebc('0x49')][_0x8ebc('0x4d')]({'where':{'id':_0x2c8c8a[_0x8ebc('0x50')]['id']}})['then'](handleEntityNotFound(_0x5cf333,null))[_0x8ebc('0x1a')](saveUpdates(_0x2c8c8a[_0x8ebc('0x4f')],null))[_0x8ebc('0x1a')](respondWithResult(_0x5cf333,null))[_0x8ebc('0x23')](handleError(_0x5cf333,null));};exports[_0x8ebc('0x2c')]=function(_0x3553bc,_0x2dcff7){return db['SalesforceConfiguration'][_0x8ebc('0x4d')]({'where':{'id':_0x3553bc[_0x8ebc('0x50')]['id']}})[_0x8ebc('0x1a')](handleEntityNotFound(_0x2dcff7,null))['then'](removeEntity(_0x2dcff7,null))[_0x8ebc('0x23')](handleError(_0x2dcff7,null));};exports[_0x8ebc('0x51')]=function(_0x30f376,_0x28f80f,_0x4004c3){var _0x247fc8={};var _0x197dc0={};var _0xa213c7;var _0x4560f8;return db[_0x8ebc('0x49')][_0x8ebc('0x52')]({'where':{'id':_0x30f376['params']['id']}})[_0x8ebc('0x1a')](handleEntityNotFound(_0x28f80f,null))[_0x8ebc('0x1a')](function(_0x2398db){if(_0x2398db){_0xa213c7=_0x2398db;_0x197dc0['model']=_['keys'](db[_0x8ebc('0x53')][_0x8ebc('0x54')]);_0x197dc0[_0x8ebc('0x36')]=_['keys'](_0x30f376[_0x8ebc('0x36')]);_0x197dc0[_0x8ebc('0x40')]=_['intersection'](_0x197dc0[_0x8ebc('0x35')],_0x197dc0['query']);_0x247fc8[_0x8ebc('0x38')]=_[_0x8ebc('0x39')](_0x197dc0['model'],qs[_0x8ebc('0x3a')](_0x30f376['query'][_0x8ebc('0x3a')]));_0x247fc8[_0x8ebc('0x38')]=_0x247fc8[_0x8ebc('0x38')][_0x8ebc('0x3b')]?_0x247fc8[_0x8ebc('0x38')]:_0x197dc0[_0x8ebc('0x35')];_0x247fc8[_0x8ebc('0x3e')]=qs[_0x8ebc('0x3f')](_0x30f376[_0x8ebc('0x36')][_0x8ebc('0x3f')]);_0x247fc8['where']=qs[_0x8ebc('0x40')](_[_0x8ebc('0x41')](_0x30f376[_0x8ebc('0x36')],_0x197dc0[_0x8ebc('0x40')]));if(_0x30f376[_0x8ebc('0x36')][_0x8ebc('0x42')]){_0x247fc8['where']=_['merge'](_0x247fc8[_0x8ebc('0x43')],{'$or':_['map'](_0x247fc8[_0x8ebc('0x38')],function(_0x2dfb67){var _0x2bcdb9={};_0x2bcdb9[_0x2dfb67]={'$like':'%'+_0x30f376[_0x8ebc('0x36')]['filter']+'%'};return _0x2bcdb9;})});}_0x247fc8=_[_0x8ebc('0x44')]({},_0x247fc8,_0x30f376['options']);return _0xa213c7['getFields'](_0x247fc8);}})[_0x8ebc('0x1a')](function(_0x1585c2){if(_0x1585c2){_0x4560f8=_0x1585c2[_0x8ebc('0x3b')];if(!_0x30f376[_0x8ebc('0x36')]['hasOwnProperty'](_0x8ebc('0x3c'))){_0x247fc8[_0x8ebc('0x3d')]=qs[_0x8ebc('0x3d')](_0x30f376[_0x8ebc('0x36')][_0x8ebc('0x3d')]);_0x247fc8[_0x8ebc('0x27')]=qs[_0x8ebc('0x27')](_0x30f376[_0x8ebc('0x36')]['offset']);}return _0xa213c7[_0x8ebc('0x51')](_0x247fc8);}})['then'](function(_0x1591fb){if(_0x1591fb){return _0x1591fb?{'count':_0x4560f8,'rows':_0x1591fb}:null;}})['then'](respondWithResult(_0x28f80f,null))[_0x8ebc('0x23')](handleError(_0x28f80f,null));};exports['getSubjects']=function(_0xd4ae19,_0x493adf,_0x1355b1){var _0x3a1508={};var _0x9386ef={};var _0x48d7d;var _0x18d9c3;return db[_0x8ebc('0x49')][_0x8ebc('0x52')]({'where':{'id':_0xd4ae19[_0x8ebc('0x50')]['id']}})[_0x8ebc('0x1a')](handleEntityNotFound(_0x493adf,null))['then'](function(_0x3ffa7d){if(_0x3ffa7d){_0x48d7d=_0x3ffa7d;_0x9386ef['model']=_[_0x8ebc('0x37')](db[_0x8ebc('0x53')][_0x8ebc('0x54')]);_0x9386ef['query']=_['keys'](_0xd4ae19[_0x8ebc('0x36')]);_0x9386ef[_0x8ebc('0x40')]=_['intersection'](_0x9386ef['model'],_0x9386ef[_0x8ebc('0x36')]);_0x3a1508['attributes']=_[_0x8ebc('0x39')](_0x9386ef[_0x8ebc('0x35')],qs[_0x8ebc('0x3a')](_0xd4ae19[_0x8ebc('0x36')][_0x8ebc('0x3a')]));_0x3a1508[_0x8ebc('0x38')]=_0x3a1508[_0x8ebc('0x38')][_0x8ebc('0x3b')]?_0x3a1508[_0x8ebc('0x38')]:_0x9386ef[_0x8ebc('0x35')];_0x3a1508[_0x8ebc('0x3e')]=qs[_0x8ebc('0x3f')](_0xd4ae19[_0x8ebc('0x36')][_0x8ebc('0x3f')]);_0x3a1508[_0x8ebc('0x43')]=qs[_0x8ebc('0x40')](_[_0x8ebc('0x41')](_0xd4ae19[_0x8ebc('0x36')],_0x9386ef['filters']));if(_0xd4ae19[_0x8ebc('0x36')][_0x8ebc('0x42')]){_0x3a1508['where']=_[_0x8ebc('0x44')](_0x3a1508['where'],{'$or':_['map'](_0x3a1508[_0x8ebc('0x38')],function(_0x5f3290){var _0x1c3f31={};_0x1c3f31[_0x5f3290]={'$like':'%'+_0xd4ae19[_0x8ebc('0x36')][_0x8ebc('0x42')]+'%'};return _0x1c3f31;})});}_0x3a1508=_[_0x8ebc('0x44')]({},_0x3a1508,_0xd4ae19[_0x8ebc('0x46')]);return _0x48d7d['getSubjects'](_0x3a1508);}})[_0x8ebc('0x1a')](function(_0x178f55){if(_0x178f55){_0x18d9c3=_0x178f55[_0x8ebc('0x3b')];if(!_0xd4ae19[_0x8ebc('0x36')]['hasOwnProperty']('nolimit')){_0x3a1508[_0x8ebc('0x3d')]=qs[_0x8ebc('0x3d')](_0xd4ae19[_0x8ebc('0x36')][_0x8ebc('0x3d')]);_0x3a1508[_0x8ebc('0x27')]=qs[_0x8ebc('0x27')](_0xd4ae19[_0x8ebc('0x36')][_0x8ebc('0x27')]);}return _0x48d7d['getSubjects'](_0x3a1508);}})[_0x8ebc('0x1a')](function(_0x49e9b8){if(_0x49e9b8){return _0x49e9b8?{'count':_0x18d9c3,'rows':_0x49e9b8}:null;}})[_0x8ebc('0x1a')](respondWithResult(_0x493adf,null))['catch'](handleError(_0x493adf,null));};exports[_0x8ebc('0x55')]=function(_0x413934,_0x177e8c,_0x3dedea){var _0x463172={};var _0x1d007c={};var _0x44a5d8;var _0x3d2847;return db[_0x8ebc('0x49')]['findOne']({'where':{'id':_0x413934['params']['id']}})[_0x8ebc('0x1a')](handleEntityNotFound(_0x177e8c,null))['then'](function(_0x268261){if(_0x268261){_0x44a5d8=_0x268261;_0x1d007c[_0x8ebc('0x35')]=_[_0x8ebc('0x37')](db['SalesforceField']['rawAttributes']);_0x1d007c[_0x8ebc('0x36')]=_['keys'](_0x413934['query']);_0x1d007c[_0x8ebc('0x40')]=_['intersection'](_0x1d007c[_0x8ebc('0x35')],_0x1d007c['query']);_0x463172['attributes']=_[_0x8ebc('0x39')](_0x1d007c[_0x8ebc('0x35')],qs['fields'](_0x413934[_0x8ebc('0x36')][_0x8ebc('0x3a')]));_0x463172[_0x8ebc('0x38')]=_0x463172[_0x8ebc('0x38')][_0x8ebc('0x3b')]?_0x463172[_0x8ebc('0x38')]:_0x1d007c[_0x8ebc('0x35')];_0x463172[_0x8ebc('0x3e')]=qs[_0x8ebc('0x3f')](_0x413934[_0x8ebc('0x36')][_0x8ebc('0x3f')]);_0x463172[_0x8ebc('0x43')]=qs[_0x8ebc('0x40')](_['pick'](_0x413934[_0x8ebc('0x36')],_0x1d007c[_0x8ebc('0x40')]));if(_0x413934[_0x8ebc('0x36')][_0x8ebc('0x42')]){_0x463172[_0x8ebc('0x43')]=_[_0x8ebc('0x44')](_0x463172[_0x8ebc('0x43')],{'$or':_[_0x8ebc('0x31')](_0x463172[_0x8ebc('0x38')],function(_0x5f1ffc){var _0x381f11={};_0x381f11[_0x5f1ffc]={'$like':'%'+_0x413934[_0x8ebc('0x36')][_0x8ebc('0x42')]+'%'};return _0x381f11;})});}_0x463172=_['merge']({},_0x463172,_0x413934[_0x8ebc('0x46')]);return _0x44a5d8['getDescriptions'](_0x463172);}})['then'](function(_0x11c37b){if(_0x11c37b){_0x3d2847=_0x11c37b[_0x8ebc('0x3b')];if(!_0x413934[_0x8ebc('0x36')][_0x8ebc('0x56')]('nolimit')){_0x463172[_0x8ebc('0x3d')]=qs['limit'](_0x413934[_0x8ebc('0x36')][_0x8ebc('0x3d')]);_0x463172[_0x8ebc('0x27')]=qs['offset'](_0x413934['query'][_0x8ebc('0x27')]);}return _0x44a5d8[_0x8ebc('0x55')](_0x463172);}})['then'](function(_0xe99fd){if(_0xe99fd){return _0xe99fd?{'count':_0x3d2847,'rows':_0xe99fd}:null;}})[_0x8ebc('0x1a')](respondWithResult(_0x177e8c,null))[_0x8ebc('0x23')](handleError(_0x177e8c,null));}; \ No newline at end of file +var _0xf909=['ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','SalesforceConfiguration','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','filters','pick','filter','where','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','rawAttributes','length','find','create','body','params','getFields','findOne','SalesforceField','sort','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf909,0x11e));var _0x9f90=function(_0x2caf38,_0x1e5dd5){_0x2caf38=_0x2caf38-0x0;var _0x164755=_0xf909[_0x2caf38];return _0x164755;};'use strict';var pdf=require(_0x9f90('0x0'));var emlformat=require(_0x9f90('0x1'));var rimraf=require(_0x9f90('0x2'));var zipdir=require(_0x9f90('0x3'));var jsonpatch=require(_0x9f90('0x4'));var rp=require(_0x9f90('0x5'));var moment=require(_0x9f90('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x9f90('0x7'));var util=require(_0x9f90('0x8'));var path=require('path');var sox=require(_0x9f90('0x9'));var csv=require(_0x9f90('0xa'));var ejs=require(_0x9f90('0xb'));var fs=require('fs');var _=require(_0x9f90('0xc'));var squel=require('squel');var crypto=require(_0x9f90('0xd'));var jsforce=require(_0x9f90('0xe'));var deskjs=require(_0x9f90('0xf'));var toCsv=require(_0x9f90('0xa'));var querystring=require('querystring');var Papa=require(_0x9f90('0x10'));var Redis=require('ioredis');var authService=require(_0x9f90('0x11'));var qs=require(_0x9f90('0x12'));var as=require(_0x9f90('0x13'));var hardwareService=require(_0x9f90('0x14'));var logger=require(_0x9f90('0x15'))(_0x9f90('0x16'));var utils=require(_0x9f90('0x17'));var config=require(_0x9f90('0x18'));var db=require(_0x9f90('0x19'))['db'];var jayson=require(_0x9f90('0x1a'));var client=jayson[_0x9f90('0x1b')][_0x9f90('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x5b0e51,_0x3d8fed,_0x35a585){if(_0x35a585){var _0x5d1e0e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5d1e0e[_0x9f90('0x1d')](_0x3d8fed)){return _0x5b0e51;}else{throw new db[(_0x9f90('0x1e'))][(_0x9f90('0x1f'))](_0x9f90('0x20'));}}else{return _0x5b0e51;}}function respondWithRpcPromise(_0x50524b,_0x3f107c,_0x2db556,_0x173f30){return new BPromise(function(_0x675286,_0x498305){var _0x48aee5=_0x173f30||client;return _0x48aee5[_0x9f90('0x21')](_0x50524b,_0x2db556)['then'](function(_0x8ea91d){logger[_0x9f90('0x22')](_0x9f90('0x23'),_0x3f107c,_0x9f90('0x24'));logger[_0x9f90('0x25')](_0x9f90('0x26'),_0x3f107c,_0x9f90('0x24'),JSON['stringify'](_0x8ea91d));if(_0x8ea91d['error']){if(_0x8ea91d[_0x9f90('0x27')][_0x9f90('0x28')]===0x1f4){logger[_0x9f90('0x27')](_0x9f90('0x23'),_0x3f107c,_0x8ea91d['error'][_0x9f90('0x29')]);return _0x498305(_0x8ea91d['error'][_0x9f90('0x29')]);}logger[_0x9f90('0x27')](_0x9f90('0x23'),_0x3f107c,_0x8ea91d[_0x9f90('0x27')][_0x9f90('0x29')]);return _0x675286(_0x8ea91d[_0x9f90('0x27')][_0x9f90('0x29')]);}else{logger[_0x9f90('0x22')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3f107c,_0x9f90('0x24'));_0x675286(_0x8ea91d['result'][_0x9f90('0x29')]);}})[_0x9f90('0x2a')](function(_0x243e21){logger[_0x9f90('0x27')](_0x9f90('0x23'),_0x3f107c,_0x243e21);_0x498305(_0x243e21);});});}function respondWithStatusCode(_0x6bc295,_0x454118){_0x454118=_0x454118||0xcc;return function(_0x1fe560){if(_0x1fe560){return _0x6bc295[_0x9f90('0x2b')](_0x454118);}return _0x6bc295[_0x9f90('0x2c')](_0x454118)[_0x9f90('0x2d')]();};}function respondWithResult(_0x37902d,_0x132123){_0x132123=_0x132123||0xc8;return function(_0x247992){if(_0x247992){return _0x37902d[_0x9f90('0x2c')](_0x132123)[_0x9f90('0x2e')](_0x247992);}};}function respondWithFilteredResult(_0x33e590,_0x3803a9){return function(_0x3a04a7){if(_0x3a04a7){var _0x20928c=_0x3a04a7['count'],_0x3146d3=_0x3803a9[_0x9f90('0x2f')],_0x498442=_0x3803a9[_0x9f90('0x2f')]+_0x3803a9[_0x9f90('0x30')],_0x1961e9;if(_0x498442>=_0x20928c){_0x498442=_0x20928c;_0x1961e9=0xc8;}else{_0x1961e9=0xce;}_0x33e590[_0x9f90('0x2c')](_0x1961e9);return _0x33e590[_0x9f90('0x31')](_0x9f90('0x32'),_0x3146d3+'-'+_0x498442+'/'+_0x20928c)[_0x9f90('0x2e')](_0x3a04a7);}return null;};}function patchUpdates(_0x2dbd8f){return function(_0x29de66){try{jsonpatch[_0x9f90('0x33')](_0x29de66,_0x2dbd8f,!![]);}catch(_0x3bf7e5){return BPromise[_0x9f90('0x34')](_0x3bf7e5);}return _0x29de66[_0x9f90('0x35')]();};}function saveUpdates(_0x4acceb,_0xedaebb){return function(_0x498a81){if(_0x498a81){return _0x498a81[_0x9f90('0x36')](_0x4acceb)[_0x9f90('0x37')](function(_0x186f44){return _0x186f44;});}return null;};}function removeEntity(_0x5ad6f9,_0x32c8d4){return function(_0x2e8531){if(_0x2e8531){return _0x2e8531[_0x9f90('0x38')]()['then'](function(){_0x5ad6f9[_0x9f90('0x2c')](0xcc)[_0x9f90('0x2d')]();});}};}function handleEntityNotFound(_0x156f91,_0x540bed){return function(_0x25f2fa){if(!_0x25f2fa){_0x156f91[_0x9f90('0x2b')](0x194);}return _0x25f2fa;};}function handleError(_0x2f3760,_0x50251a){_0x50251a=_0x50251a||0x1f4;return function(_0x2f16e6){logger[_0x9f90('0x27')](_0x2f16e6[_0x9f90('0x39')]);if(_0x2f16e6[_0x9f90('0x3a')]){delete _0x2f16e6['name'];}_0x2f3760['status'](_0x50251a)[_0x9f90('0x3b')](_0x2f16e6);};}exports[_0x9f90('0x3c')]=function(_0x48892e,_0x4745a1){var _0x26f9a6={},_0x1728dc={},_0x5ee61b={'count':0x0,'rows':[]};var _0x421c1d=_[_0x9f90('0x3d')](db[_0x9f90('0x3e')]['rawAttributes'],function(_0x289886){return{'name':_0x289886['fieldName'],'type':_0x289886['type'][_0x9f90('0x3f')]};});_0x1728dc[_0x9f90('0x40')]=_[_0x9f90('0x3d')](_0x421c1d,_0x9f90('0x3a'));_0x1728dc[_0x9f90('0x41')]=_[_0x9f90('0x42')](_0x48892e[_0x9f90('0x41')]);_0x1728dc['filters']=_[_0x9f90('0x43')](_0x1728dc[_0x9f90('0x40')],_0x1728dc[_0x9f90('0x41')]);_0x26f9a6[_0x9f90('0x44')]=_['intersection'](_0x1728dc[_0x9f90('0x40')],qs[_0x9f90('0x45')](_0x48892e[_0x9f90('0x41')][_0x9f90('0x45')]));_0x26f9a6['attributes']=_0x26f9a6[_0x9f90('0x44')]['length']?_0x26f9a6[_0x9f90('0x44')]:_0x1728dc[_0x9f90('0x40')];if(!_0x48892e[_0x9f90('0x41')][_0x9f90('0x46')]('nolimit')){_0x26f9a6[_0x9f90('0x30')]=qs['limit'](_0x48892e[_0x9f90('0x41')][_0x9f90('0x30')]);_0x26f9a6[_0x9f90('0x2f')]=qs['offset'](_0x48892e[_0x9f90('0x41')][_0x9f90('0x2f')]);}_0x26f9a6[_0x9f90('0x47')]=qs['sort'](_0x48892e['query']['sort']);_0x26f9a6['where']=qs[_0x9f90('0x48')](_[_0x9f90('0x49')](_0x48892e[_0x9f90('0x41')],_0x1728dc[_0x9f90('0x48')]));if(_0x48892e[_0x9f90('0x41')][_0x9f90('0x4a')]){_0x26f9a6[_0x9f90('0x4b')]=_[_0x9f90('0x4c')](_0x26f9a6[_0x9f90('0x4b')],{'$or':_[_0x9f90('0x3d')](_0x421c1d,function(_0x56c673){if(_0x56c673[_0x9f90('0x4d')]!==_0x9f90('0x4e')){var _0xc72f23={};_0xc72f23[_0x56c673[_0x9f90('0x3a')]]={'$like':'%'+_0x48892e['query'][_0x9f90('0x4a')]+'%'};return _0xc72f23;}})});}_0x26f9a6=_[_0x9f90('0x4c')]({},_0x26f9a6,_0x48892e[_0x9f90('0x4f')]);var _0x130b37={'where':_0x26f9a6[_0x9f90('0x4b')]};return db[_0x9f90('0x3e')][_0x9f90('0x50')](_0x130b37)['then'](function(_0x30546e){_0x5ee61b[_0x9f90('0x50')]=_0x30546e;if(_0x48892e['query'][_0x9f90('0x51')]){_0x26f9a6[_0x9f90('0x52')]=[{'all':!![]}];}return db[_0x9f90('0x3e')][_0x9f90('0x53')](_0x26f9a6);})[_0x9f90('0x37')](function(_0x26a5f8){_0x5ee61b[_0x9f90('0x54')]=_0x26a5f8;return _0x5ee61b;})[_0x9f90('0x37')](respondWithFilteredResult(_0x4745a1,_0x26f9a6))['catch'](handleError(_0x4745a1,null));};exports[_0x9f90('0x55')]=function(_0x31c723,_0x3ad8f7){var _0x9ab488={'raw':![],'where':{'id':_0x31c723['params']['id']}},_0xb1974={};_0xb1974[_0x9f90('0x40')]=_[_0x9f90('0x42')](db[_0x9f90('0x3e')][_0x9f90('0x56')]);_0xb1974[_0x9f90('0x41')]=_[_0x9f90('0x42')](_0x31c723[_0x9f90('0x41')]);_0xb1974[_0x9f90('0x48')]=_[_0x9f90('0x43')](_0xb1974[_0x9f90('0x40')],_0xb1974[_0x9f90('0x41')]);_0x9ab488[_0x9f90('0x44')]=_[_0x9f90('0x43')](_0xb1974[_0x9f90('0x40')],qs[_0x9f90('0x45')](_0x31c723[_0x9f90('0x41')][_0x9f90('0x45')]));_0x9ab488[_0x9f90('0x44')]=_0x9ab488[_0x9f90('0x44')][_0x9f90('0x57')]?_0x9ab488[_0x9f90('0x44')]:_0xb1974['model'];if(_0x31c723[_0x9f90('0x41')]['includeAll']){_0x9ab488[_0x9f90('0x52')]=[{'all':!![]}];}_0x9ab488=_[_0x9f90('0x4c')]({},_0x9ab488,_0x31c723[_0x9f90('0x4f')]);return db[_0x9f90('0x3e')][_0x9f90('0x58')](_0x9ab488)['then'](handleEntityNotFound(_0x3ad8f7,null))[_0x9f90('0x37')](respondWithResult(_0x3ad8f7,null))['catch'](handleError(_0x3ad8f7,null));};exports[_0x9f90('0x59')]=function(_0xa6b7d4,_0x4dcba){return db[_0x9f90('0x3e')]['create'](_0xa6b7d4[_0x9f90('0x5a')],{})[_0x9f90('0x37')](respondWithResult(_0x4dcba,0xc9))[_0x9f90('0x2a')](handleError(_0x4dcba,null));};exports[_0x9f90('0x36')]=function(_0x302e8f,_0x57a6d2){if(_0x302e8f['body']['id']){delete _0x302e8f['body']['id'];}return db['SalesforceConfiguration'][_0x9f90('0x58')]({'where':{'id':_0x302e8f[_0x9f90('0x5b')]['id']}})[_0x9f90('0x37')](handleEntityNotFound(_0x57a6d2,null))[_0x9f90('0x37')](saveUpdates(_0x302e8f['body'],null))[_0x9f90('0x37')](respondWithResult(_0x57a6d2,null))[_0x9f90('0x2a')](handleError(_0x57a6d2,null));};exports[_0x9f90('0x38')]=function(_0x2c53f3,_0x141004){return db[_0x9f90('0x3e')]['find']({'where':{'id':_0x2c53f3[_0x9f90('0x5b')]['id']}})['then'](handleEntityNotFound(_0x141004,null))[_0x9f90('0x37')](removeEntity(_0x141004,null))[_0x9f90('0x2a')](handleError(_0x141004,null));};exports[_0x9f90('0x5c')]=function(_0x5125a2,_0x22bcbf,_0x1b55a7){var _0x49276a={};var _0x18f98a={};var _0x1442f9;var _0x5547f8;return db[_0x9f90('0x3e')][_0x9f90('0x5d')]({'where':{'id':_0x5125a2[_0x9f90('0x5b')]['id']}})[_0x9f90('0x37')](handleEntityNotFound(_0x22bcbf,null))[_0x9f90('0x37')](function(_0x5a4d25){if(_0x5a4d25){_0x1442f9=_0x5a4d25;_0x18f98a[_0x9f90('0x40')]=_[_0x9f90('0x42')](db[_0x9f90('0x5e')][_0x9f90('0x56')]);_0x18f98a[_0x9f90('0x41')]=_[_0x9f90('0x42')](_0x5125a2[_0x9f90('0x41')]);_0x18f98a[_0x9f90('0x48')]=_[_0x9f90('0x43')](_0x18f98a[_0x9f90('0x40')],_0x18f98a[_0x9f90('0x41')]);_0x49276a[_0x9f90('0x44')]=_[_0x9f90('0x43')](_0x18f98a[_0x9f90('0x40')],qs[_0x9f90('0x45')](_0x5125a2['query'][_0x9f90('0x45')]));_0x49276a[_0x9f90('0x44')]=_0x49276a[_0x9f90('0x44')][_0x9f90('0x57')]?_0x49276a[_0x9f90('0x44')]:_0x18f98a[_0x9f90('0x40')];_0x49276a[_0x9f90('0x47')]=qs[_0x9f90('0x5f')](_0x5125a2[_0x9f90('0x41')]['sort']);_0x49276a[_0x9f90('0x4b')]=qs[_0x9f90('0x48')](_[_0x9f90('0x49')](_0x5125a2[_0x9f90('0x41')],_0x18f98a[_0x9f90('0x48')]));if(_0x5125a2[_0x9f90('0x41')][_0x9f90('0x4a')]){_0x49276a['where']=_['merge'](_0x49276a[_0x9f90('0x4b')],{'$or':_[_0x9f90('0x3d')](_0x49276a[_0x9f90('0x44')],function(_0x2d154e){var _0x25ef69={};_0x25ef69[_0x2d154e]={'$like':'%'+_0x5125a2[_0x9f90('0x41')][_0x9f90('0x4a')]+'%'};return _0x25ef69;})});}_0x49276a=_[_0x9f90('0x4c')]({},_0x49276a,_0x5125a2[_0x9f90('0x4f')]);return _0x1442f9[_0x9f90('0x5c')](_0x49276a);}})['then'](function(_0x5d878b){if(_0x5d878b){_0x5547f8=_0x5d878b[_0x9f90('0x57')];if(!_0x5125a2[_0x9f90('0x41')][_0x9f90('0x46')](_0x9f90('0x60'))){_0x49276a[_0x9f90('0x30')]=qs[_0x9f90('0x30')](_0x5125a2[_0x9f90('0x41')][_0x9f90('0x30')]);_0x49276a['offset']=qs[_0x9f90('0x2f')](_0x5125a2[_0x9f90('0x41')][_0x9f90('0x2f')]);}return _0x1442f9['getFields'](_0x49276a);}})[_0x9f90('0x37')](function(_0x4e05bc){if(_0x4e05bc){return _0x4e05bc?{'count':_0x5547f8,'rows':_0x4e05bc}:null;}})[_0x9f90('0x37')](respondWithResult(_0x22bcbf,null))[_0x9f90('0x2a')](handleError(_0x22bcbf,null));};exports[_0x9f90('0x61')]=function(_0x133e1f,_0x52c7a8,_0x4435d2){var _0x32baae={};var _0x104dfe={};var _0x30701b;var _0x6671ad;return db[_0x9f90('0x3e')][_0x9f90('0x5d')]({'where':{'id':_0x133e1f[_0x9f90('0x5b')]['id']}})[_0x9f90('0x37')](handleEntityNotFound(_0x52c7a8,null))[_0x9f90('0x37')](function(_0x946f29){if(_0x946f29){_0x30701b=_0x946f29;_0x104dfe[_0x9f90('0x40')]=_['keys'](db[_0x9f90('0x5e')][_0x9f90('0x56')]);_0x104dfe[_0x9f90('0x41')]=_[_0x9f90('0x42')](_0x133e1f[_0x9f90('0x41')]);_0x104dfe[_0x9f90('0x48')]=_[_0x9f90('0x43')](_0x104dfe[_0x9f90('0x40')],_0x104dfe[_0x9f90('0x41')]);_0x32baae[_0x9f90('0x44')]=_[_0x9f90('0x43')](_0x104dfe[_0x9f90('0x40')],qs[_0x9f90('0x45')](_0x133e1f['query'][_0x9f90('0x45')]));_0x32baae[_0x9f90('0x44')]=_0x32baae['attributes'][_0x9f90('0x57')]?_0x32baae[_0x9f90('0x44')]:_0x104dfe[_0x9f90('0x40')];_0x32baae[_0x9f90('0x47')]=qs[_0x9f90('0x5f')](_0x133e1f[_0x9f90('0x41')][_0x9f90('0x5f')]);_0x32baae[_0x9f90('0x4b')]=qs[_0x9f90('0x48')](_[_0x9f90('0x49')](_0x133e1f['query'],_0x104dfe['filters']));if(_0x133e1f[_0x9f90('0x41')][_0x9f90('0x4a')]){_0x32baae[_0x9f90('0x4b')]=_[_0x9f90('0x4c')](_0x32baae['where'],{'$or':_['map'](_0x32baae[_0x9f90('0x44')],function(_0x11a86b){var _0x3e2ac1={};_0x3e2ac1[_0x11a86b]={'$like':'%'+_0x133e1f[_0x9f90('0x41')][_0x9f90('0x4a')]+'%'};return _0x3e2ac1;})});}_0x32baae=_[_0x9f90('0x4c')]({},_0x32baae,_0x133e1f[_0x9f90('0x4f')]);return _0x30701b['getSubjects'](_0x32baae);}})[_0x9f90('0x37')](function(_0xa6ce66){if(_0xa6ce66){_0x6671ad=_0xa6ce66[_0x9f90('0x57')];if(!_0x133e1f[_0x9f90('0x41')][_0x9f90('0x46')](_0x9f90('0x60'))){_0x32baae[_0x9f90('0x30')]=qs[_0x9f90('0x30')](_0x133e1f['query'][_0x9f90('0x30')]);_0x32baae[_0x9f90('0x2f')]=qs[_0x9f90('0x2f')](_0x133e1f[_0x9f90('0x41')][_0x9f90('0x2f')]);}return _0x30701b[_0x9f90('0x61')](_0x32baae);}})['then'](function(_0x384386){if(_0x384386){return _0x384386?{'count':_0x6671ad,'rows':_0x384386}:null;}})[_0x9f90('0x37')](respondWithResult(_0x52c7a8,null))[_0x9f90('0x2a')](handleError(_0x52c7a8,null));};exports['getDescriptions']=function(_0x401bcf,_0x3eff37,_0x130761){var _0xa1e633={};var _0x5ee5e5={};var _0x11de66;var _0x196cc4;return db[_0x9f90('0x3e')][_0x9f90('0x5d')]({'where':{'id':_0x401bcf[_0x9f90('0x5b')]['id']}})[_0x9f90('0x37')](handleEntityNotFound(_0x3eff37,null))[_0x9f90('0x37')](function(_0x449d3b){if(_0x449d3b){_0x11de66=_0x449d3b;_0x5ee5e5['model']=_[_0x9f90('0x42')](db['SalesforceField'][_0x9f90('0x56')]);_0x5ee5e5[_0x9f90('0x41')]=_['keys'](_0x401bcf['query']);_0x5ee5e5[_0x9f90('0x48')]=_['intersection'](_0x5ee5e5['model'],_0x5ee5e5['query']);_0xa1e633[_0x9f90('0x44')]=_[_0x9f90('0x43')](_0x5ee5e5[_0x9f90('0x40')],qs[_0x9f90('0x45')](_0x401bcf['query']['fields']));_0xa1e633['attributes']=_0xa1e633[_0x9f90('0x44')]['length']?_0xa1e633['attributes']:_0x5ee5e5[_0x9f90('0x40')];_0xa1e633[_0x9f90('0x47')]=qs[_0x9f90('0x5f')](_0x401bcf['query']['sort']);_0xa1e633[_0x9f90('0x4b')]=qs['filters'](_[_0x9f90('0x49')](_0x401bcf[_0x9f90('0x41')],_0x5ee5e5[_0x9f90('0x48')]));if(_0x401bcf[_0x9f90('0x41')][_0x9f90('0x4a')]){_0xa1e633[_0x9f90('0x4b')]=_['merge'](_0xa1e633[_0x9f90('0x4b')],{'$or':_[_0x9f90('0x3d')](_0xa1e633[_0x9f90('0x44')],function(_0x7f9377){var _0x237906={};_0x237906[_0x7f9377]={'$like':'%'+_0x401bcf[_0x9f90('0x41')][_0x9f90('0x4a')]+'%'};return _0x237906;})});}_0xa1e633=_['merge']({},_0xa1e633,_0x401bcf[_0x9f90('0x4f')]);return _0x11de66[_0x9f90('0x62')](_0xa1e633);}})[_0x9f90('0x37')](function(_0x227bb9){if(_0x227bb9){_0x196cc4=_0x227bb9[_0x9f90('0x57')];if(!_0x401bcf[_0x9f90('0x41')]['hasOwnProperty'](_0x9f90('0x60'))){_0xa1e633[_0x9f90('0x30')]=qs['limit'](_0x401bcf[_0x9f90('0x41')][_0x9f90('0x30')]);_0xa1e633['offset']=qs[_0x9f90('0x2f')](_0x401bcf[_0x9f90('0x41')][_0x9f90('0x2f')]);}return _0x11de66[_0x9f90('0x62')](_0xa1e633);}})[_0x9f90('0x37')](function(_0x2c3752){if(_0x2c3752){return _0x2c3752?{'count':_0x196cc4,'rows':_0x2c3752}:null;}})['then'](respondWithResult(_0x3eff37,null))[_0x9f90('0x2a')](handleError(_0x3eff37,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 4900733..4486897 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 _0x610a=['SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./intSalesforceConfiguration.attributes','define'];(function(_0x55d5e9,_0x3071b1){var _0x2851a1=function(_0x29ff78){while(--_0x29ff78){_0x55d5e9['push'](_0x55d5e9['shift']());}};_0x2851a1(++_0x3071b1);}(_0x610a,0xce));var _0xa610=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x610a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa610('0x0'));var util=require(_0xa610('0x1'));var logger=require(_0xa610('0x2'))(_0xa610('0x3'));var moment=require(_0xa610('0x4'));var BPromise=require('bluebird');var rp=require(_0xa610('0x5'));var fs=require('fs');var path=require(_0xa610('0x6'));var rimraf=require(_0xa610('0x7'));var config=require('../../config/environment');var attributes=require(_0xa610('0x8'));module['exports']=function(_0x269f4d,_0x419db3){return _0x269f4d[_0xa610('0x9')](_0xa610('0xa'),attributes,{'tableName':_0xa610('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5da=['api','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','lodash','util','../../config/logger'];(function(_0x3141ad,_0x43b38d){var _0x54ec93=function(_0x222a18){while(--_0x222a18){_0x3141ad['push'](_0x3141ad['shift']());}};_0x54ec93(++_0x43b38d);}(_0xd5da,0x194));var _0xad5d=function(_0x3b925f,_0x5a151e){_0x3b925f=_0x3b925f-0x0;var _0x4550b9=_0xd5da[_0x3b925f];return _0x4550b9;};'use strict';var _=require(_0xad5d('0x0'));var util=require(_0xad5d('0x1'));var logger=require(_0xad5d('0x2'))(_0xad5d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xad5d('0x4'));var rimraf=require(_0xad5d('0x5'));var config=require(_0xad5d('0x6'));var attributes=require(_0xad5d('0x7'));module[_0xad5d('0x8')]=function(_0x40a869,_0x1e5700){return _0x40a869[_0xad5d('0x9')](_0xad5d('0xa'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 6ef09c0..3e23114 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 _0xe863=['code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xef1e4c,_0x5cb9ae){var _0x203904=function(_0x10379c){while(--_0x10379c){_0xef1e4c['push'](_0xef1e4c['shift']());}};_0x203904(++_0x5cb9ae);}(_0xe863,0x184));var _0x3e86=function(_0x48ff5f,_0x134535){_0x48ff5f=_0x48ff5f-0x0;var _0x3c0cd7=_0xe863[_0x48ff5f];return _0x3c0cd7;};'use strict';var _=require('lodash');var util=require(_0x3e86('0x0'));var moment=require(_0x3e86('0x1'));var BPromise=require(_0x3e86('0x2'));var rs=require(_0x3e86('0x3'));var fs=require('fs');var Redis=require(_0x3e86('0x4'));var db=require(_0x3e86('0x5'))['db'];var utils=require(_0x3e86('0x6'));var logger=require(_0x3e86('0x7'))('rpc');var config=require(_0x3e86('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3e86('0x9')][_0x3e86('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9c8ff1,_0x4fb857,_0xfa59c7){return new BPromise(function(_0x424c98,_0x4d8b6b){return client[_0x3e86('0xb')](_0x9c8ff1,_0xfa59c7)[_0x3e86('0xc')](function(_0x321afa){logger[_0x3e86('0xd')](_0x3e86('0xe'),_0x4fb857,_0x3e86('0xf'));logger[_0x3e86('0x10')](_0x3e86('0x11'),_0x4fb857,_0x3e86('0xf'),JSON[_0x3e86('0x12')](_0x321afa));if(_0x321afa[_0x3e86('0x13')]){if(_0x321afa['error'][_0x3e86('0x14')]===0x1f4){logger[_0x3e86('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4fb857,_0x321afa[_0x3e86('0x13')][_0x3e86('0x15')]);return _0x4d8b6b(_0x321afa['error']['message']);}logger[_0x3e86('0x13')](_0x3e86('0xe'),_0x4fb857,_0x321afa[_0x3e86('0x13')][_0x3e86('0x15')]);return _0x424c98(_0x321afa[_0x3e86('0x13')][_0x3e86('0x15')]);}else{logger[_0x3e86('0xd')](_0x3e86('0xe'),_0x4fb857,_0x3e86('0xf'));_0x424c98(_0x321afa[_0x3e86('0x16')][_0x3e86('0x15')]);}})[_0x3e86('0x17')](function(_0x3ab8eb){logger[_0x3e86('0x13')](_0x3e86('0xe'),_0x4fb857,_0x3ab8eb);_0x4d8b6b(_0x3ab8eb);});});} \ No newline at end of file +var _0x3bcd=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util'];(function(_0x5a7fc0,_0x2b0f7e){var _0x159b9f=function(_0x41b7a9){while(--_0x41b7a9){_0x5a7fc0['push'](_0x5a7fc0['shift']());}};_0x159b9f(++_0x2b0f7e);}(_0x3bcd,0xbb));var _0xd3bc=function(_0x335f37,_0x37302b){_0x335f37=_0x335f37-0x0;var _0x1768f4=_0x3bcd[_0x335f37];return _0x1768f4;};'use strict';var _=require(_0xd3bc('0x0'));var util=require(_0xd3bc('0x1'));var moment=require(_0xd3bc('0x2'));var BPromise=require('bluebird');var rs=require(_0xd3bc('0x3'));var fs=require('fs');var Redis=require(_0xd3bc('0x4'));var db=require(_0xd3bc('0x5'))['db'];var utils=require(_0xd3bc('0x6'));var logger=require(_0xd3bc('0x7'))(_0xd3bc('0x8'));var config=require(_0xd3bc('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd3bc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c3d17,_0x12a358,_0x9892c5){return new BPromise(function(_0x2c3c4a,_0x3bc568){return client[_0xd3bc('0xb')](_0x2c3d17,_0x9892c5)[_0xd3bc('0xc')](function(_0x4dec9e){logger[_0xd3bc('0xd')](_0xd3bc('0xe'),_0x12a358,_0xd3bc('0xf'));logger[_0xd3bc('0x10')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x12a358,_0xd3bc('0xf'),JSON[_0xd3bc('0x11')](_0x4dec9e));if(_0x4dec9e[_0xd3bc('0x12')]){if(_0x4dec9e[_0xd3bc('0x12')][_0xd3bc('0x13')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x12a358,_0x4dec9e['error']['message']);return _0x3bc568(_0x4dec9e['error']['message']);}logger[_0xd3bc('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x12a358,_0x4dec9e[_0xd3bc('0x12')][_0xd3bc('0x14')]);return _0x2c3c4a(_0x4dec9e[_0xd3bc('0x12')][_0xd3bc('0x14')]);}else{logger['info'](_0xd3bc('0xe'),_0x12a358,_0xd3bc('0xf'));_0x2c3c4a(_0x4dec9e['result'][_0xd3bc('0x14')]);}})['catch'](function(_0x4fc87a){logger[_0xd3bc('0x12')](_0xd3bc('0xe'),_0x12a358,_0x4fc87a);_0x3bc568(_0x4fc87a);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 17ef4ae..ec08844 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 _0x6b8f=['util','connect-timeout','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','/:id','show','create','update','delete'];(function(_0x1ceaba,_0x590da1){var _0x33fa56=function(_0x11fec2){while(--_0x11fec2){_0x1ceaba['push'](_0x1ceaba['shift']());}};_0x33fa56(++_0x590da1);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x2e1fc6,_0x3a3715){_0x2e1fc6=_0x2e1fc6-0x0;var _0x150e65=_0x6b8f[_0x2e1fc6];return _0x150e65;};'use strict';var multer=require('multer');var util=require(_0xf6b8('0x0'));var path=require('path');var timeout=require(_0xf6b8('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xf6b8('0x2'));var interaction=require(_0xf6b8('0x3'));var config=require('../../config/environment');var controller=require(_0xf6b8('0x4'));router[_0xf6b8('0x5')]('/',auth[_0xf6b8('0x6')](),controller['index']);router[_0xf6b8('0x5')](_0xf6b8('0x7'),auth[_0xf6b8('0x6')](),controller[_0xf6b8('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf6b8('0x9')]);router['put'](_0xf6b8('0x7'),auth[_0xf6b8('0x6')](),controller[_0xf6b8('0xa')]);router[_0xf6b8('0xb')](_0xf6b8('0x7'),auth[_0xf6b8('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x31f0=['../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','/:id','show','post','isAuthenticated','create','update','delete','destroy','exports','multer','path','express','Router'];(function(_0x5f1cf8,_0x5e0923){var _0x27d0fa=function(_0x3f1171){while(--_0x3f1171){_0x5f1cf8['push'](_0x5f1cf8['shift']());}};_0x27d0fa(++_0x5e0923);}(_0x31f0,0xb7));var _0x031f=function(_0x4fcc13,_0x5e5c10){_0x4fcc13=_0x4fcc13-0x0;var _0x444574=_0x31f0[_0x4fcc13];return _0x444574;};'use strict';var multer=require(_0x031f('0x0'));var util=require('util');var path=require(_0x031f('0x1'));var timeout=require('connect-timeout');var express=require(_0x031f('0x2'));var router=express[_0x031f('0x3')]();var auth=require(_0x031f('0x4'));var interaction=require(_0x031f('0x5'));var config=require('../../config/environment');var controller=require(_0x031f('0x6'));router[_0x031f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x031f('0x8'),auth['isAuthenticated'](),controller[_0x031f('0x9')]);router[_0x031f('0xa')]('/',auth[_0x031f('0xb')](),controller[_0x031f('0xc')]);router['put'](_0x031f('0x8'),auth[_0x031f('0xb')](),controller[_0x031f('0xd')]);router[_0x031f('0xe')](_0x031f('0x8'),auth[_0x031f('0xb')](),controller[_0x031f('0xf')]);module[_0x031f('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 922c9cc..566c69c 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 _0x12c8=['keyValue','STRING','ENUM','sequelize','exports','string','variable','customVariable'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x12c8,0x1cb));var _0x812c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12c8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x812c('0x0'));module[_0x812c('0x1')]={'type':{'type':Sequelize['ENUM'](_0x812c('0x2'),_0x812c('0x3'),_0x812c('0x4'),_0x812c('0x5')),'defaultValue':_0x812c('0x2')},'content':{'type':Sequelize[_0x812c('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x812c('0x7')](_0x812c('0x2'),'variable',_0x812c('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x812c('0x6')]},'variableName':{'type':Sequelize[_0x812c('0x6')]}}; \ No newline at end of file +var _0x471c=['STRING','variable','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x471c,0xea));var _0xc471=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x471c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc471('0x0'));module[_0xc471('0x1')]={'type':{'type':Sequelize[_0xc471('0x2')](_0xc471('0x3'),'variable',_0xc471('0x4'),_0xc471('0x5')),'defaultValue':_0xc471('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc471('0x6')]},'keyType':{'type':Sequelize[_0xc471('0x2')](_0xc471('0x3'),_0xc471('0x7'),_0xc471('0x4'))},'keyContent':{'type':Sequelize[_0xc471('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xc471('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 55e8a7d..170b54a 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 _0x2ef3=['then','stack','name','send','index','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','sort','pick','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','limit','set','apply','reject','save','update','destroy'];(function(_0xf4356f,_0x478f6d){var _0x3c304c=function(_0x1a08dc){while(--_0x1a08dc){_0xf4356f['push'](_0xf4356f['shift']());}};_0x3c304c(++_0x478f6d);}(_0x2ef3,0xba));var _0x32ef=function(_0x3b756d,_0xee7e60){_0x3b756d=_0x3b756d-0x0;var _0x29a826=_0x2ef3[_0x3b756d];return _0x29a826;};'use strict';var pdf=require(_0x32ef('0x0'));var emlformat=require(_0x32ef('0x1'));var rimraf=require(_0x32ef('0x2'));var zipdir=require(_0x32ef('0x3'));var jsonpatch=require(_0x32ef('0x4'));var rp=require(_0x32ef('0x5'));var moment=require('moment');var BPromise=require(_0x32ef('0x6'));var Mustache=require(_0x32ef('0x7'));var util=require('util');var path=require(_0x32ef('0x8'));var sox=require(_0x32ef('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0xf'));var querystring=require(_0x32ef('0x10'));var Papa=require(_0x32ef('0x11'));var Redis=require(_0x32ef('0x12'));var authService=require(_0x32ef('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x14'));var logger=require(_0x32ef('0x15'))(_0x32ef('0x16'));var utils=require(_0x32ef('0x17'));var config=require('../../config/environment');var db=require(_0x32ef('0x18'))['db'];function respondWithStatusCode(_0x5afcc2,_0x1a5106){_0x1a5106=_0x1a5106||0xcc;return function(_0x49d590){if(_0x49d590){return _0x5afcc2[_0x32ef('0x19')](_0x1a5106);}return _0x5afcc2[_0x32ef('0x1a')](_0x1a5106)['end']();};}function respondWithResult(_0x539d18,_0x19ce1){_0x19ce1=_0x19ce1||0xc8;return function(_0x4d8009){if(_0x4d8009){return _0x539d18[_0x32ef('0x1a')](_0x19ce1)[_0x32ef('0x1b')](_0x4d8009);}};}function respondWithFilteredResult(_0x93d492,_0x54c7f5){return function(_0x57aff1){if(_0x57aff1){var _0x55bf0b=_0x57aff1[_0x32ef('0x1c')],_0x531e30=_0x54c7f5['offset'],_0x13db1a=_0x54c7f5['offset']+_0x54c7f5[_0x32ef('0x1d')],_0x3950e6;if(_0x13db1a>=_0x55bf0b){_0x13db1a=_0x55bf0b;_0x3950e6=0xc8;}else{_0x3950e6=0xce;}_0x93d492[_0x32ef('0x1a')](_0x3950e6);return _0x93d492[_0x32ef('0x1e')]('Content-Range',_0x531e30+'-'+_0x13db1a+'/'+_0x55bf0b)[_0x32ef('0x1b')](_0x57aff1);}return null;};}function patchUpdates(_0x33e230){return function(_0x4f4c98){try{jsonpatch[_0x32ef('0x1f')](_0x4f4c98,_0x33e230,!![]);}catch(_0x314ef1){return BPromise[_0x32ef('0x20')](_0x314ef1);}return _0x4f4c98[_0x32ef('0x21')]();};}function saveUpdates(_0x445cda,_0x3aec05){return function(_0x4de441){if(_0x4de441){return _0x4de441[_0x32ef('0x22')](_0x445cda)['then'](function(_0x309866){return _0x309866;});}return null;};}function removeEntity(_0x3a20ca,_0x49f2d8){return function(_0x1af371){if(_0x1af371){return _0x1af371[_0x32ef('0x23')]()[_0x32ef('0x24')](function(){_0x3a20ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(!_0x225feb){_0x22f2d7['sendStatus'](0x194);}return _0x225feb;};}function handleError(_0x59585f,_0x19ea6){_0x19ea6=_0x19ea6||0x1f4;return function(_0x4d584b){logger['error'](_0x4d584b[_0x32ef('0x25')]);if(_0x4d584b[_0x32ef('0x26')]){delete _0x4d584b[_0x32ef('0x26')];}_0x59585f[_0x32ef('0x1a')](_0x19ea6)[_0x32ef('0x27')](_0x4d584b);};}exports[_0x32ef('0x28')]=function(_0x1874ea,_0x38aed5){var _0x338f19={},_0x2f52d7={},_0x1335e2={'count':0x0,'rows':[]};var _0xba4b3f=_['map'](db[_0x32ef('0x29')][_0x32ef('0x2a')],function(_0x5a04cd){return{'name':_0x5a04cd[_0x32ef('0x2b')],'type':_0x5a04cd[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x2f52d7[_0x32ef('0x2e')]=_['map'](_0xba4b3f,_0x32ef('0x26'));_0x2f52d7[_0x32ef('0x2f')]=_[_0x32ef('0x30')](_0x1874ea[_0x32ef('0x2f')]);_0x2f52d7[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2f52d7[_0x32ef('0x2e')],_0x2f52d7['query']);_0x338f19[_0x32ef('0x33')]=_['intersection'](_0x2f52d7[_0x32ef('0x2e')],qs[_0x32ef('0x34')](_0x1874ea['query'][_0x32ef('0x34')]));_0x338f19[_0x32ef('0x33')]=_0x338f19[_0x32ef('0x33')][_0x32ef('0x35')]?_0x338f19[_0x32ef('0x33')]:_0x2f52d7['model'];if(!_0x1874ea['query'][_0x32ef('0x36')]('nolimit')){_0x338f19[_0x32ef('0x1d')]=qs[_0x32ef('0x1d')](_0x1874ea[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x338f19[_0x32ef('0x37')]=qs[_0x32ef('0x37')](_0x1874ea['query']['offset']);}_0x338f19['order']=qs[_0x32ef('0x38')](_0x1874ea[_0x32ef('0x2f')][_0x32ef('0x38')]);_0x338f19['where']=qs['filters'](_[_0x32ef('0x39')](_0x1874ea[_0x32ef('0x2f')],_0x2f52d7[_0x32ef('0x31')]));if(_0x1874ea['query']['filter']){_0x338f19[_0x32ef('0x3a')]=_[_0x32ef('0x3b')](_0x338f19[_0x32ef('0x3a')],{'$or':_[_0x32ef('0x3c')](_0xba4b3f,function(_0x3a7c49){if(_0x3a7c49[_0x32ef('0x2c')]!==_0x32ef('0x3d')){var _0x21da90={};_0x21da90[_0x3a7c49[_0x32ef('0x26')]]={'$like':'%'+_0x1874ea['query'][_0x32ef('0x3e')]+'%'};return _0x21da90;}})});}_0x338f19=_[_0x32ef('0x3b')]({},_0x338f19,_0x1874ea[_0x32ef('0x3f')]);var _0x4b97dc={'where':_0x338f19[_0x32ef('0x3a')]};return db[_0x32ef('0x29')][_0x32ef('0x1c')](_0x4b97dc)[_0x32ef('0x24')](function(_0x1faf72){_0x1335e2[_0x32ef('0x1c')]=_0x1faf72;if(_0x1874ea[_0x32ef('0x2f')][_0x32ef('0x40')]){_0x338f19[_0x32ef('0x41')]=[{'all':!![]}];}return db[_0x32ef('0x29')][_0x32ef('0x42')](_0x338f19);})[_0x32ef('0x24')](function(_0x48e071){_0x1335e2[_0x32ef('0x43')]=_0x48e071;return _0x1335e2;})[_0x32ef('0x24')](respondWithFilteredResult(_0x38aed5,_0x338f19))[_0x32ef('0x44')](handleError(_0x38aed5,null));};exports[_0x32ef('0x45')]=function(_0x2f92f5,_0x2ca66b){var _0x3c0e44={'raw':!![],'where':{'id':_0x2f92f5['params']['id']}},_0x596d5a={};_0x596d5a[_0x32ef('0x2e')]=_[_0x32ef('0x30')](db[_0x32ef('0x29')][_0x32ef('0x2a')]);_0x596d5a['query']=_[_0x32ef('0x30')](_0x2f92f5[_0x32ef('0x2f')]);_0x596d5a['filters']=_[_0x32ef('0x32')](_0x596d5a['model'],_0x596d5a[_0x32ef('0x2f')]);_0x3c0e44[_0x32ef('0x33')]=_[_0x32ef('0x32')](_0x596d5a[_0x32ef('0x2e')],qs[_0x32ef('0x34')](_0x2f92f5[_0x32ef('0x2f')][_0x32ef('0x34')]));_0x3c0e44[_0x32ef('0x33')]=_0x3c0e44[_0x32ef('0x33')][_0x32ef('0x35')]?_0x3c0e44['attributes']:_0x596d5a[_0x32ef('0x2e')];if(_0x2f92f5['query'][_0x32ef('0x40')]){_0x3c0e44[_0x32ef('0x41')]=[{'all':!![]}];}_0x3c0e44=_[_0x32ef('0x3b')]({},_0x3c0e44,_0x2f92f5['options']);return db[_0x32ef('0x29')][_0x32ef('0x46')](_0x3c0e44)[_0x32ef('0x24')](handleEntityNotFound(_0x2ca66b,null))[_0x32ef('0x24')](respondWithResult(_0x2ca66b,null))[_0x32ef('0x44')](handleError(_0x2ca66b,null));};exports[_0x32ef('0x47')]=function(_0x12c9e6,_0x47dbe1){return db['SalesforceField'][_0x32ef('0x47')](_0x12c9e6[_0x32ef('0x48')],{})[_0x32ef('0x24')](respondWithResult(_0x47dbe1,0xc9))[_0x32ef('0x44')](handleError(_0x47dbe1,null));};exports[_0x32ef('0x22')]=function(_0xd67dc9,_0x44ad11){if(_0xd67dc9[_0x32ef('0x48')]['id']){delete _0xd67dc9[_0x32ef('0x48')]['id'];}return db[_0x32ef('0x29')][_0x32ef('0x46')]({'where':{'id':_0xd67dc9[_0x32ef('0x49')]['id']}})[_0x32ef('0x24')](handleEntityNotFound(_0x44ad11,null))['then'](saveUpdates(_0xd67dc9[_0x32ef('0x48')],null))[_0x32ef('0x24')](respondWithResult(_0x44ad11,null))[_0x32ef('0x44')](handleError(_0x44ad11,null));};exports[_0x32ef('0x23')]=function(_0x1cc9f3,_0x4353f0){return db[_0x32ef('0x29')][_0x32ef('0x46')]({'where':{'id':_0x1cc9f3[_0x32ef('0x49')]['id']}})[_0x32ef('0x24')](handleEntityNotFound(_0x4353f0,null))[_0x32ef('0x24')](removeEntity(_0x4353f0,null))[_0x32ef('0x44')](handleError(_0x4353f0,null));}; \ No newline at end of file +var _0x5f66=['merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','SalesforceField','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x65f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65f6('0x1'));var jsonpatch=require(_0x65f6('0x2'));var rp=require(_0x65f6('0x3'));var moment=require(_0x65f6('0x4'));var BPromise=require(_0x65f6('0x5'));var Mustache=require('mustache');var util=require(_0x65f6('0x6'));var path=require('path');var sox=require(_0x65f6('0x7'));var csv=require(_0x65f6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x8'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x65f6('0x13'))['db'];function respondWithStatusCode(_0x576875,_0x419819){_0x419819=_0x419819||0xcc;return function(_0x4862a5){if(_0x4862a5){return _0x576875[_0x65f6('0x14')](_0x419819);}return _0x576875[_0x65f6('0x15')](_0x419819)[_0x65f6('0x16')]();};}function respondWithResult(_0x217570,_0x369f96){_0x369f96=_0x369f96||0xc8;return function(_0x1d29fd){if(_0x1d29fd){return _0x217570[_0x65f6('0x15')](_0x369f96)[_0x65f6('0x17')](_0x1d29fd);}};}function respondWithFilteredResult(_0x46dbc6,_0x3440af){return function(_0x59154e){if(_0x59154e){var _0x19b9ff=_0x59154e[_0x65f6('0x18')],_0x49a913=_0x3440af[_0x65f6('0x19')],_0x5dd324=_0x3440af[_0x65f6('0x19')]+_0x3440af[_0x65f6('0x1a')],_0x1693e6;if(_0x5dd324>=_0x19b9ff){_0x5dd324=_0x19b9ff;_0x1693e6=0xc8;}else{_0x1693e6=0xce;}_0x46dbc6[_0x65f6('0x15')](_0x1693e6);return _0x46dbc6[_0x65f6('0x1b')](_0x65f6('0x1c'),_0x49a913+'-'+_0x5dd324+'/'+_0x19b9ff)['json'](_0x59154e);}return null;};}function patchUpdates(_0x4d79a1){return function(_0x2d538c){try{jsonpatch['apply'](_0x2d538c,_0x4d79a1,!![]);}catch(_0x4c81f3){return BPromise['reject'](_0x4c81f3);}return _0x2d538c[_0x65f6('0x1d')]();};}function saveUpdates(_0x21ea88,_0x5114a4){return function(_0x39e19f){if(_0x39e19f){return _0x39e19f[_0x65f6('0x1e')](_0x21ea88)[_0x65f6('0x1f')](function(_0x3876ed){return _0x3876ed;});}return null;};}function removeEntity(_0x219ab2,_0xc139c2){return function(_0x581374){if(_0x581374){return _0x581374[_0x65f6('0x20')]()['then'](function(){_0x219ab2['status'](0xcc)[_0x65f6('0x16')]();});}};}function handleEntityNotFound(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(!_0x1eeaaa){_0xd173f4[_0x65f6('0x14')](0x194);}return _0x1eeaaa;};}function handleError(_0x2317ce,_0x2774a1){_0x2774a1=_0x2774a1||0x1f4;return function(_0x4f5a69){logger[_0x65f6('0x21')](_0x4f5a69[_0x65f6('0x22')]);if(_0x4f5a69[_0x65f6('0x23')]){delete _0x4f5a69['name'];}_0x2317ce['status'](_0x2774a1)['send'](_0x4f5a69);};}exports[_0x65f6('0x24')]=function(_0x16cde8,_0x4b2292){var _0x296cd9={},_0x28f710={},_0x52277c={'count':0x0,'rows':[]};var _0x325cb4=_[_0x65f6('0x25')](db[_0x65f6('0x26')]['rawAttributes'],function(_0x4ac04b){return{'name':_0x4ac04b['fieldName'],'type':_0x4ac04b[_0x65f6('0x27')][_0x65f6('0x28')]};});_0x28f710[_0x65f6('0x29')]=_[_0x65f6('0x25')](_0x325cb4,_0x65f6('0x23'));_0x28f710[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](_0x16cde8['query']);_0x28f710['filters']=_[_0x65f6('0x2c')](_0x28f710[_0x65f6('0x29')],_0x28f710['query']);_0x296cd9['attributes']=_[_0x65f6('0x2c')](_0x28f710[_0x65f6('0x29')],qs[_0x65f6('0x2d')](_0x16cde8[_0x65f6('0x2a')][_0x65f6('0x2d')]));_0x296cd9[_0x65f6('0x2e')]=_0x296cd9['attributes'][_0x65f6('0x2f')]?_0x296cd9[_0x65f6('0x2e')]:_0x28f710[_0x65f6('0x29')];if(!_0x16cde8['query'][_0x65f6('0x30')](_0x65f6('0x31'))){_0x296cd9[_0x65f6('0x1a')]=qs[_0x65f6('0x1a')](_0x16cde8[_0x65f6('0x2a')][_0x65f6('0x1a')]);_0x296cd9['offset']=qs[_0x65f6('0x19')](_0x16cde8[_0x65f6('0x2a')]['offset']);}_0x296cd9[_0x65f6('0x32')]=qs['sort'](_0x16cde8[_0x65f6('0x2a')]['sort']);_0x296cd9[_0x65f6('0x33')]=qs[_0x65f6('0x34')](_['pick'](_0x16cde8[_0x65f6('0x2a')],_0x28f710[_0x65f6('0x34')]));if(_0x16cde8[_0x65f6('0x2a')]['filter']){_0x296cd9['where']=_[_0x65f6('0x35')](_0x296cd9['where'],{'$or':_[_0x65f6('0x25')](_0x325cb4,function(_0x4e6653){if(_0x4e6653[_0x65f6('0x27')]!==_0x65f6('0x36')){var _0x5e97f1={};_0x5e97f1[_0x4e6653[_0x65f6('0x23')]]={'$like':'%'+_0x16cde8['query']['filter']+'%'};return _0x5e97f1;}})});}_0x296cd9=_[_0x65f6('0x35')]({},_0x296cd9,_0x16cde8[_0x65f6('0x37')]);var _0x413956={'where':_0x296cd9[_0x65f6('0x33')]};return db[_0x65f6('0x26')][_0x65f6('0x18')](_0x413956)[_0x65f6('0x1f')](function(_0x1153f1){_0x52277c['count']=_0x1153f1;if(_0x16cde8[_0x65f6('0x2a')]['includeAll']){_0x296cd9[_0x65f6('0x38')]=[{'all':!![]}];}return db[_0x65f6('0x26')][_0x65f6('0x39')](_0x296cd9);})[_0x65f6('0x1f')](function(_0x5ef5c2){_0x52277c[_0x65f6('0x3a')]=_0x5ef5c2;return _0x52277c;})[_0x65f6('0x1f')](respondWithFilteredResult(_0x4b2292,_0x296cd9))[_0x65f6('0x3b')](handleError(_0x4b2292,null));};exports[_0x65f6('0x3c')]=function(_0x81fd69,_0x3f6103){var _0xed4c96={'raw':!![],'where':{'id':_0x81fd69[_0x65f6('0x3d')]['id']}},_0x2acca5={};_0x2acca5['model']=_[_0x65f6('0x2b')](db[_0x65f6('0x26')][_0x65f6('0x3e')]);_0x2acca5[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](_0x81fd69[_0x65f6('0x2a')]);_0x2acca5[_0x65f6('0x34')]=_[_0x65f6('0x2c')](_0x2acca5[_0x65f6('0x29')],_0x2acca5[_0x65f6('0x2a')]);_0xed4c96[_0x65f6('0x2e')]=_[_0x65f6('0x2c')](_0x2acca5[_0x65f6('0x29')],qs[_0x65f6('0x2d')](_0x81fd69[_0x65f6('0x2a')][_0x65f6('0x2d')]));_0xed4c96['attributes']=_0xed4c96[_0x65f6('0x2e')][_0x65f6('0x2f')]?_0xed4c96[_0x65f6('0x2e')]:_0x2acca5[_0x65f6('0x29')];if(_0x81fd69['query'][_0x65f6('0x3f')]){_0xed4c96[_0x65f6('0x38')]=[{'all':!![]}];}_0xed4c96=_[_0x65f6('0x35')]({},_0xed4c96,_0x81fd69['options']);return db[_0x65f6('0x26')][_0x65f6('0x40')](_0xed4c96)[_0x65f6('0x1f')](handleEntityNotFound(_0x3f6103,null))[_0x65f6('0x1f')](respondWithResult(_0x3f6103,null))['catch'](handleError(_0x3f6103,null));};exports[_0x65f6('0x41')]=function(_0x512527,_0x3f1baa){return db[_0x65f6('0x26')]['create'](_0x512527[_0x65f6('0x42')],{})['then'](respondWithResult(_0x3f1baa,0xc9))[_0x65f6('0x3b')](handleError(_0x3f1baa,null));};exports[_0x65f6('0x1e')]=function(_0x2d1706,_0xc0db01){if(_0x2d1706[_0x65f6('0x42')]['id']){delete _0x2d1706[_0x65f6('0x42')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x2d1706[_0x65f6('0x3d')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0xc0db01,null))[_0x65f6('0x1f')](saveUpdates(_0x2d1706[_0x65f6('0x42')],null))[_0x65f6('0x1f')](respondWithResult(_0xc0db01,null))[_0x65f6('0x3b')](handleError(_0xc0db01,null));};exports[_0x65f6('0x20')]=function(_0x41690c,_0x414f49){return db['SalesforceField'][_0x65f6('0x40')]({'where':{'id':_0x41690c[_0x65f6('0x3d')]['id']}})[_0x65f6('0x1f')](handleEntityNotFound(_0x414f49,null))['then'](removeEntity(_0x414f49,null))[_0x65f6('0x3b')](handleError(_0x414f49,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 34a6376..2255364 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 _0xefca=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','exports','salesforce_unique_index','FieldId'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xefca,0xe7));var _0xaefc=function(_0x4695ba,_0x5a7f2a){_0x4695ba=_0x4695ba-0x0;var _0x524b7d=_0xefca[_0x4695ba];return _0x524b7d;};'use strict';var _=require('lodash');var util=require(_0xaefc('0x0'));var logger=require(_0xaefc('0x1'))(_0xaefc('0x2'));var moment=require('moment');var BPromise=require(_0xaefc('0x3'));var rp=require(_0xaefc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaefc('0x5'));var config=require(_0xaefc('0x6'));var attributes=require(_0xaefc('0x7'));module[_0xaefc('0x8')]=function(_0xc3f650,_0x533308){return _0xc3f650['define']('SalesforceField',attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xaefc('0x9'),'fields':['idField',_0xaefc('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9dbc=['lodash','util','api','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId'];(function(_0x19b58b,_0x11681f){var _0x5b93d4=function(_0x2d4d5d){while(--_0x2d4d5d){_0x19b58b['push'](_0x19b58b['shift']());}};_0x5b93d4(++_0x11681f);}(_0x9dbc,0x15e));var _0xc9db=function(_0x4dff12,_0x404f00){_0x4dff12=_0x4dff12-0x0;var _0x28461e=_0x9dbc[_0x4dff12];return _0x28461e;};'use strict';var _=require(_0xc9db('0x0'));var util=require(_0xc9db('0x1'));var logger=require('../../config/logger')(_0xc9db('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc9db('0x3'));var fs=require('fs');var path=require(_0xc9db('0x4'));var rimraf=require(_0xc9db('0x5'));var config=require(_0xc9db('0x6'));var attributes=require(_0xc9db('0x7'));module[_0xc9db('0x8')]=function(_0x29087b,_0x5ac03e){return _0x29087b[_0xc9db('0x9')](_0xc9db('0xa'),attributes,{'tableName':_0xc9db('0xb'),'paranoid':![],'indexes':[{'name':_0xc9db('0xc'),'fields':['idField',_0xc9db('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index d646daa..0f65884 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 _0x5b02=['client','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x282f96,_0x2be4be){var _0x12d02b=function(_0x51cc9d){while(--_0x51cc9d){_0x282f96['push'](_0x282f96['shift']());}};_0x12d02b(++_0x2be4be);}(_0x5b02,0xe9));var _0x25b0=function(_0x2f5f6e,_0x400c74){_0x2f5f6e=_0x2f5f6e-0x0;var _0x46d4ca=_0x5b02[_0x2f5f6e];return _0x46d4ca;};'use strict';var _=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var moment=require(_0x25b0('0x2'));var BPromise=require(_0x25b0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x25b0('0x5'))(_0x25b0('0x6'));var config=require(_0x25b0('0x7'));var jayson=require(_0x25b0('0x8'));var client=jayson[_0x25b0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d82c6,_0xd8276d,_0x49ef3a){return new BPromise(function(_0x412954,_0x4d3e71){return client['request'](_0x1d82c6,_0x49ef3a)[_0x25b0('0xa')](function(_0x45429b){logger[_0x25b0('0xb')]('SalesforceField,\x20%s,\x20%s',_0xd8276d,_0x25b0('0xc'));logger[_0x25b0('0xd')](_0x25b0('0xe'),_0xd8276d,_0x25b0('0xc'),JSON[_0x25b0('0xf')](_0x45429b));if(_0x45429b[_0x25b0('0x10')]){if(_0x45429b[_0x25b0('0x10')][_0x25b0('0x11')]===0x1f4){logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);return _0x4d3e71(_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);}logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);return _0x412954(_0x45429b[_0x25b0('0x10')][_0x25b0('0x13')]);}else{logger[_0x25b0('0xb')]('SalesforceField,\x20%s,\x20%s',_0xd8276d,'request\x20sent');_0x412954(_0x45429b[_0x25b0('0x14')]['message']);}})[_0x25b0('0x15')](function(_0x1d009f){logger[_0x25b0('0x10')](_0x25b0('0x12'),_0xd8276d,_0x1d009f);_0x4d3e71(_0x1d009f);});});} \ No newline at end of file +var _0xb4e6=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5ac5e8,_0xc333d2){var _0x5eb1ff=function(_0x2c4802){while(--_0x2c4802){_0x5ac5e8['push'](_0x5ac5e8['shift']());}};_0x5eb1ff(++_0xc333d2);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0xb4e6[_0x622035];return _0x326cf2;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var moment=require(_0x6b4e('0x1'));var BPromise=require(_0x6b4e('0x2'));var rs=require(_0x6b4e('0x3'));var fs=require('fs');var Redis=require(_0x6b4e('0x4'));var db=require(_0x6b4e('0x5'))['db'];var utils=require(_0x6b4e('0x6'));var logger=require(_0x6b4e('0x7'))('rpc');var config=require(_0x6b4e('0x8'));var jayson=require(_0x6b4e('0x9'));var client=jayson[_0x6b4e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd3138f,_0x570346,_0x4f00be){return new BPromise(function(_0x2311d9,_0x48c870){return client['request'](_0xd3138f,_0x4f00be)[_0x6b4e('0xb')](function(_0x2bd576){logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));logger[_0x6b4e('0xf')](_0x6b4e('0x10'),_0x570346,'request\x20sent',JSON[_0x6b4e('0x11')](_0x2bd576));if(_0x2bd576[_0x6b4e('0x12')]){if(_0x2bd576['error'][_0x6b4e('0x13')]===0x1f4){logger[_0x6b4e('0x12')](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);return _0x48c870(_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);}logger['error'](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')]['message']);return _0x2311d9(_0x2bd576[_0x6b4e('0x12')]['message']);}else{logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));_0x2311d9(_0x2bd576[_0x6b4e('0x15')][_0x6b4e('0x14')]);}})[_0x6b4e('0x16')](function(_0x53a934){logger['error'](_0x6b4e('0xd'),_0x570346,_0x53a934);_0x48c870(_0x53a934);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index ec6a12c..4df8377 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 _0xe74d=['express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','update','delete','destroy','exports','multer','util'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xe74d,0x16e));var _0xde74=function(_0x1895b7,_0x21fbc7){_0x1895b7=_0x1895b7-0x0;var _0x1aecdc=_0xe74d[_0x1895b7];return _0x1aecdc;};'use strict';var multer=require(_0xde74('0x0'));var util=require(_0xde74('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xde74('0x2'));var router=express[_0xde74('0x3')]();var auth=require(_0xde74('0x4'));var interaction=require(_0xde74('0x5'));var config=require('../../config/environment');var controller=require(_0xde74('0x6'));router[_0xde74('0x7')]('/',auth[_0xde74('0x8')](),controller[_0xde74('0x9')]);router['get'](_0xde74('0xa'),auth[_0xde74('0x8')](),controller[_0xde74('0xb')]);router[_0xde74('0x7')](_0xde74('0xc'),auth[_0xde74('0x8')](),controller[_0xde74('0xd')]);router[_0xde74('0x7')](_0xde74('0xe'),auth[_0xde74('0x8')](),controller[_0xde74('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xde74('0x10')]);router[_0xde74('0x11')](_0xde74('0xc'),auth['isAuthenticated'](),controller[_0xde74('0x12')]);router['put']('/:id',auth[_0xde74('0x8')](),controller[_0xde74('0x13')]);router[_0xde74('0x14')]('/:id',auth[_0xde74('0x8')](),controller[_0xde74('0x15')]);module[_0xde74('0x16')]=router; \ No newline at end of file +var _0x0d6a=['getConfigurations','/:id/fields','getFields','create','post','addConfiguration','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x5c4436,_0x5ce52f){var _0xa8f10a=function(_0x1f4d04){while(--_0x1f4d04){_0x5c4436['push'](_0x5c4436['shift']());}};_0xa8f10a(++_0x5ce52f);}(_0x0d6a,0xc9));var _0xa0d6=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0x0d6a[_0x3305de];return _0x3b5a84;};'use strict';var multer=require(_0xa0d6('0x0'));var util=require(_0xa0d6('0x1'));var path=require('path');var timeout=require(_0xa0d6('0x2'));var express=require(_0xa0d6('0x3'));var router=express[_0xa0d6('0x4')]();var auth=require(_0xa0d6('0x5'));var interaction=require(_0xa0d6('0x6'));var config=require(_0xa0d6('0x7'));var controller=require(_0xa0d6('0x8'));router[_0xa0d6('0x9')]('/',auth[_0xa0d6('0xa')](),controller[_0xa0d6('0xb')]);router['get'](_0xa0d6('0xc'),auth[_0xa0d6('0xa')](),controller[_0xa0d6('0xd')]);router[_0xa0d6('0x9')](_0xa0d6('0xe'),auth['isAuthenticated'](),controller[_0xa0d6('0xf')]);router['get'](_0xa0d6('0x10'),auth['isAuthenticated'](),controller[_0xa0d6('0x11')]);router['post']('/',auth[_0xa0d6('0xa')](),controller[_0xa0d6('0x12')]);router[_0xa0d6('0x13')](_0xa0d6('0xe'),auth[_0xa0d6('0xa')](),controller[_0xa0d6('0x14')]);router['put'](_0xa0d6('0xc'),auth[_0xa0d6('0xa')](),controller[_0xa0d6('0x15')]);router['delete'](_0xa0d6('0xc'),auth[_0xa0d6('0xa')](),controller[_0xa0d6('0x16')]);module[_0xa0d6('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index d733c27..cf641a4 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 _0x2569=['sequelize','exports','STRING','remoteUri'];(function(_0x4e824c,_0x10de6a){var _0x5d557c=function(_0x1c411c){while(--_0x1c411c){_0x4e824c['push'](_0x4e824c['shift']());}};_0x5d557c(++_0x10de6a);}(_0x2569,0xc4));var _0x9256=function(_0x425541,_0x5dec0e){_0x425541=_0x425541-0x0;var _0x455616=_0x2569[_0x425541];return _0x455616;};'use strict';var Sequelize=require(_0x9256('0x0'));module[_0x9256('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9256('0x2')]},'username':{'type':Sequelize[_0x9256('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x9256('0x2')]},'email':{'type':Sequelize[_0x9256('0x2')]},'remoteUri':{'type':Sequelize[_0x9256('0x2')],'unique':_0x9256('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xac7c=['STRING','username','remoteUri','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xac7c,0xe7));var _0xcac7=function(_0x33975c,_0x50d085){_0x33975c=_0x33975c-0x0;var _0x1c15ab=_0xac7c[_0x33975c];return _0x1c15ab;};'use strict';var Sequelize=require('sequelize');module[_0xcac7('0x0')]={'name':{'type':Sequelize[_0xcac7('0x1')]},'description':{'type':Sequelize[_0xcac7('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xcac7('0x2')},'password':{'type':Sequelize[_0xcac7('0x1')]},'email':{'type':Sequelize[_0xcac7('0x1')]},'remoteUri':{'type':Sequelize[_0xcac7('0x1')],'unique':_0xcac7('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 74960c9..ec4ae7a 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 _0x91ce=['incident_state','severity','category','parent','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','hold_reason','approval_history','number','user_input','sys_created_on','sys_domain','state','sys_created_by','cmdb_ci','delivery_plan','work_notes_list','business_service','priority','sys_domain_path','rfc','expected_start','opened_at','business_duration','group_list','work_end','resolved_at','caller_id','short_description','close_code','correlation_display','assignment_group','additional_assignee_list','description','calendar_duration','closed_by','parent_incident','sys_id','reopened_by','urgency','comments','approval','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','username','password','remoteUri','serverUrl','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','remove','includes','forEach','label','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','push','all','concat','ServiceNow\x20error:\x20','statusCode','true','False','inactive','false','value','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','length','find','create','body','getConfigurations','findOne','pick','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','knowledge','notify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x91ce,0x1bb));var _0xe91c=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0x91ce[_0xb833b1];return _0x1ab87a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe91c('0x0'));var zipdir=require(_0xe91c('0x1'));var jsonpatch=require(_0xe91c('0x2'));var rp=require(_0xe91c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe91c('0x4'));var util=require(_0xe91c('0x5'));var path=require(_0xe91c('0x6'));var sox=require(_0xe91c('0x7'));var csv=require(_0xe91c('0x8'));var ejs=require(_0xe91c('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe91c('0xa'));var crypto=require(_0xe91c('0xb'));var jsforce=require(_0xe91c('0xc'));var deskjs=require(_0xe91c('0xd'));var toCsv=require(_0xe91c('0x8'));var querystring=require(_0xe91c('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe91c('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xe91c('0x10'));var config=require(_0xe91c('0x11'));var db=require(_0xe91c('0x12'))['db'];var integrations=require(_0xe91c('0x13'));var jayson=require(_0xe91c('0x14'));var client=jayson[_0xe91c('0x15')][_0xe91c('0x16')]({'port':0x232a});function checkPasswordPattern(_0x19afe8,_0x570d3c,_0x2090bc){if(_0x2090bc){var _0x92a604=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x92a604[_0xe91c('0x17')](_0x570d3c)){return _0x19afe8;}else{throw new db['Sequelize'][(_0xe91c('0x18'))](_0xe91c('0x19'));}}else{return _0x19afe8;}}function respondWithRpcPromise(_0x52939c,_0x2d58f5,_0x5b347e,_0x4203ce){return new BPromise(function(_0x5c4c75,_0xc1fcde){var _0x5ce9f8=_0x4203ce||client;return _0x5ce9f8[_0xe91c('0x1a')](_0x52939c,_0x5b347e)[_0xe91c('0x1b')](function(_0x4bde8a){logger[_0xe91c('0x1c')]('ServicenowAccount,\x20%s,\x20%s',_0x2d58f5,_0xe91c('0x1d'));logger[_0xe91c('0x1e')](_0xe91c('0x1f'),_0x2d58f5,_0xe91c('0x1d'),JSON['stringify'](_0x4bde8a));if(_0x4bde8a[_0xe91c('0x20')]){if(_0x4bde8a['error'][_0xe91c('0x21')]===0x1f4){logger[_0xe91c('0x20')](_0xe91c('0x22'),_0x2d58f5,_0x4bde8a[_0xe91c('0x20')]['message']);return _0xc1fcde(_0x4bde8a[_0xe91c('0x20')][_0xe91c('0x23')]);}logger[_0xe91c('0x20')](_0xe91c('0x22'),_0x2d58f5,_0x4bde8a[_0xe91c('0x20')][_0xe91c('0x23')]);return _0x5c4c75(_0x4bde8a[_0xe91c('0x20')][_0xe91c('0x23')]);}else{logger['info'](_0xe91c('0x22'),_0x2d58f5,_0xe91c('0x1d'));_0x5c4c75(_0x4bde8a[_0xe91c('0x24')]['message']);}})[_0xe91c('0x25')](function(_0x21337a){logger[_0xe91c('0x20')](_0xe91c('0x22'),_0x2d58f5,_0x21337a);_0xc1fcde(_0x21337a);});});}function respondWithStatusCode(_0x48bdec,_0x532779){_0x532779=_0x532779||0xcc;return function(_0x58eb62){if(_0x58eb62){return _0x48bdec[_0xe91c('0x26')](_0x532779);}return _0x48bdec[_0xe91c('0x27')](_0x532779)[_0xe91c('0x28')]();};}function respondWithResult(_0x87e8ef,_0x11e5cc){_0x11e5cc=_0x11e5cc||0xc8;return function(_0x552e5e){if(_0x552e5e){return _0x87e8ef['status'](_0x11e5cc)[_0xe91c('0x29')](_0x552e5e);}};}function respondWithFilteredResult(_0x495b6c,_0x537f4f){return function(_0x225233){if(_0x225233){var _0x2ec619=_0x225233[_0xe91c('0x2a')],_0x20a807=_0x537f4f['offset'],_0x737dc3=_0x537f4f['offset']+_0x537f4f[_0xe91c('0x2b')],_0x1bf8d7;if(_0x737dc3>=_0x2ec619){_0x737dc3=_0x2ec619;_0x1bf8d7=0xc8;}else{_0x1bf8d7=0xce;}_0x495b6c['status'](_0x1bf8d7);return _0x495b6c[_0xe91c('0x2c')](_0xe91c('0x2d'),_0x20a807+'-'+_0x737dc3+'/'+_0x2ec619)['json'](_0x225233);}return null;};}function patchUpdates(_0x388acb){return function(_0x16b15f){try{jsonpatch[_0xe91c('0x2e')](_0x16b15f,_0x388acb,!![]);}catch(_0x59206b){return BPromise[_0xe91c('0x2f')](_0x59206b);}return _0x16b15f[_0xe91c('0x30')]();};}function saveUpdates(_0x21592e,_0x3f9c55){return function(_0x4b5d87){if(_0x4b5d87){return _0x4b5d87[_0xe91c('0x31')](_0x21592e)[_0xe91c('0x1b')](function(_0x888446){return _0x888446;});}return null;};}function removeEntity(_0x121158,_0x548d5c){return function(_0x298a72){if(_0x298a72){return _0x298a72[_0xe91c('0x32')]()['then'](function(){_0x121158[_0xe91c('0x27')](0xcc)[_0xe91c('0x28')]();});}};}function handleEntityNotFound(_0x364256,_0xfcbe2c){return function(_0x875be2){if(!_0x875be2){_0x364256['sendStatus'](0x194);}return _0x875be2;};}function handleError(_0x1f16b1,_0x6a4e87){_0x6a4e87=_0x6a4e87||0x1f4;return function(_0x14e1b2){logger[_0xe91c('0x20')](_0x14e1b2[_0xe91c('0x33')]);if(_0x14e1b2[_0xe91c('0x34')]){delete _0x14e1b2['name'];}_0x1f16b1[_0xe91c('0x27')](_0x6a4e87)[_0xe91c('0x35')](_0x14e1b2);};}exports['index']=function(_0x20cbd8,_0xc7484d){var _0x35ce61={},_0x15f2bf={},_0x8b0170={'count':0x0,'rows':[]};var _0x4d3b40=_[_0xe91c('0x36')](db[_0xe91c('0x37')][_0xe91c('0x38')],function(_0x4b8be3){return{'name':_0x4b8be3[_0xe91c('0x39')],'type':_0x4b8be3['type'][_0xe91c('0x3a')]};});_0x15f2bf[_0xe91c('0x3b')]=_[_0xe91c('0x36')](_0x4d3b40,'name');_0x15f2bf[_0xe91c('0x3c')]=_['keys'](_0x20cbd8[_0xe91c('0x3c')]);_0x15f2bf[_0xe91c('0x3d')]=_[_0xe91c('0x3e')](_0x15f2bf[_0xe91c('0x3b')],_0x15f2bf[_0xe91c('0x3c')]);_0x35ce61['attributes']=_[_0xe91c('0x3e')](_0x15f2bf[_0xe91c('0x3b')],qs[_0xe91c('0x3f')](_0x20cbd8[_0xe91c('0x3c')][_0xe91c('0x3f')]));_0x35ce61[_0xe91c('0x40')]=_0x35ce61['attributes']['length']?_0x35ce61['attributes']:_0x15f2bf['model'];if(!_0x20cbd8['query'][_0xe91c('0x41')](_0xe91c('0x42'))){_0x35ce61['limit']=qs[_0xe91c('0x2b')](_0x20cbd8[_0xe91c('0x3c')][_0xe91c('0x2b')]);_0x35ce61[_0xe91c('0x43')]=qs[_0xe91c('0x43')](_0x20cbd8[_0xe91c('0x3c')][_0xe91c('0x43')]);}_0x35ce61[_0xe91c('0x44')]=qs[_0xe91c('0x45')](_0x20cbd8['query']['sort']);_0x35ce61[_0xe91c('0x46')]=qs[_0xe91c('0x3d')](_['pick'](_0x20cbd8[_0xe91c('0x3c')],_0x15f2bf[_0xe91c('0x3d')]));if(_0x20cbd8['query']['filter']){_0x35ce61['where']=_[_0xe91c('0x47')](_0x35ce61[_0xe91c('0x46')],{'$or':_[_0xe91c('0x36')](_0x4d3b40,function(_0x2eba23){if(_0x2eba23[_0xe91c('0x48')]!==_0xe91c('0x49')){var _0x243fd2={};_0x243fd2[_0x2eba23[_0xe91c('0x34')]]={'$like':'%'+_0x20cbd8[_0xe91c('0x3c')][_0xe91c('0x4a')]+'%'};return _0x243fd2;}})});}_0x35ce61=_[_0xe91c('0x47')]({},_0x35ce61,_0x20cbd8[_0xe91c('0x4b')]);var _0x9389d8={'where':_0x35ce61[_0xe91c('0x46')]};return db[_0xe91c('0x37')][_0xe91c('0x2a')](_0x9389d8)[_0xe91c('0x1b')](function(_0x2b2c66){_0x8b0170[_0xe91c('0x2a')]=_0x2b2c66;if(_0x20cbd8[_0xe91c('0x3c')][_0xe91c('0x4c')]){_0x35ce61[_0xe91c('0x4d')]=[{'all':!![]}];}return db[_0xe91c('0x37')][_0xe91c('0x4e')](_0x35ce61);})[_0xe91c('0x1b')](function(_0x153748){_0x8b0170['rows']=_0x153748;return _0x8b0170;})[_0xe91c('0x1b')](respondWithFilteredResult(_0xc7484d,_0x35ce61))[_0xe91c('0x25')](handleError(_0xc7484d,null));};exports[_0xe91c('0x4f')]=function(_0x5e4be9,_0x1e8775){var _0x118578={'raw':![],'where':{'id':_0x5e4be9[_0xe91c('0x50')]['id']}},_0x9eecfe={};_0x9eecfe['model']=_['keys'](db['ServicenowAccount'][_0xe91c('0x38')]);_0x9eecfe['query']=_[_0xe91c('0x51')](_0x5e4be9[_0xe91c('0x3c')]);_0x9eecfe[_0xe91c('0x3d')]=_[_0xe91c('0x3e')](_0x9eecfe[_0xe91c('0x3b')],_0x9eecfe[_0xe91c('0x3c')]);_0x118578['attributes']=_[_0xe91c('0x3e')](_0x9eecfe[_0xe91c('0x3b')],qs[_0xe91c('0x3f')](_0x5e4be9[_0xe91c('0x3c')][_0xe91c('0x3f')]));_0x118578[_0xe91c('0x40')]=_0x118578['attributes'][_0xe91c('0x52')]?_0x118578['attributes']:_0x9eecfe['model'];if(_0x5e4be9['query'][_0xe91c('0x4c')]){_0x118578[_0xe91c('0x4d')]=[{'all':!![]}];}_0x118578=_['merge']({},_0x118578,_0x5e4be9['options']);return db['ServicenowAccount'][_0xe91c('0x53')](_0x118578)[_0xe91c('0x1b')](handleEntityNotFound(_0x1e8775,null))[_0xe91c('0x1b')](respondWithResult(_0x1e8775,null))['catch'](handleError(_0x1e8775,null));};exports[_0xe91c('0x54')]=function(_0x10abc8,_0x269a1a){return db[_0xe91c('0x37')][_0xe91c('0x54')](_0x10abc8[_0xe91c('0x55')],{})[_0xe91c('0x1b')](respondWithResult(_0x269a1a,0xc9))['catch'](handleError(_0x269a1a,null));};exports[_0xe91c('0x31')]=function(_0x494839,_0x963ff8){if(_0x494839[_0xe91c('0x55')]['id']){delete _0x494839[_0xe91c('0x55')]['id'];}return db['ServicenowAccount']['find']({'where':{'id':_0x494839[_0xe91c('0x50')]['id']}})[_0xe91c('0x1b')](handleEntityNotFound(_0x963ff8,null))[_0xe91c('0x1b')](saveUpdates(_0x494839[_0xe91c('0x55')],null))['then'](respondWithResult(_0x963ff8,null))[_0xe91c('0x25')](handleError(_0x963ff8,null));};exports[_0xe91c('0x32')]=function(_0x583f1e,_0x3000c3){return db[_0xe91c('0x37')][_0xe91c('0x53')]({'where':{'id':_0x583f1e[_0xe91c('0x50')]['id']}})[_0xe91c('0x1b')](handleEntityNotFound(_0x3000c3,null))[_0xe91c('0x1b')](removeEntity(_0x3000c3,null))[_0xe91c('0x25')](handleError(_0x3000c3,null));};exports[_0xe91c('0x56')]=function(_0x1f3261,_0x4389ed,_0x3ecda6){var _0x3fb3a7={};var _0x73a8e4={};var _0x345813;var _0x270a11;return db[_0xe91c('0x37')][_0xe91c('0x57')]({'where':{'id':_0x1f3261['params']['id']}})[_0xe91c('0x1b')](handleEntityNotFound(_0x4389ed,null))[_0xe91c('0x1b')](function(_0x2e1714){if(_0x2e1714){_0x345813=_0x2e1714;_0x73a8e4['model']=_[_0xe91c('0x51')](db['ServicenowConfiguration'][_0xe91c('0x38')]);_0x73a8e4[_0xe91c('0x3c')]=_[_0xe91c('0x51')](_0x1f3261[_0xe91c('0x3c')]);_0x73a8e4[_0xe91c('0x3d')]=_[_0xe91c('0x3e')](_0x73a8e4[_0xe91c('0x3b')],_0x73a8e4['query']);_0x3fb3a7['attributes']=_[_0xe91c('0x3e')](_0x73a8e4[_0xe91c('0x3b')],qs[_0xe91c('0x3f')](_0x1f3261[_0xe91c('0x3c')][_0xe91c('0x3f')]));_0x3fb3a7['attributes']=_0x3fb3a7[_0xe91c('0x40')]['length']?_0x3fb3a7[_0xe91c('0x40')]:_0x73a8e4[_0xe91c('0x3b')];_0x3fb3a7['order']=qs[_0xe91c('0x45')](_0x1f3261[_0xe91c('0x3c')][_0xe91c('0x45')]);_0x3fb3a7['where']=qs[_0xe91c('0x3d')](_[_0xe91c('0x58')](_0x1f3261[_0xe91c('0x3c')],_0x73a8e4[_0xe91c('0x3d')]));if(_0x1f3261[_0xe91c('0x3c')][_0xe91c('0x4a')]){_0x3fb3a7['where']=_['merge'](_0x3fb3a7[_0xe91c('0x46')],{'$or':_['map'](_0x3fb3a7['attributes'],function(_0x23d4cd){var _0x35a3b5={};_0x35a3b5[_0x23d4cd]={'$like':'%'+_0x1f3261[_0xe91c('0x3c')][_0xe91c('0x4a')]+'%'};return _0x35a3b5;})});}_0x3fb3a7=_['merge']({},_0x3fb3a7,_0x1f3261[_0xe91c('0x4b')]);return _0x345813[_0xe91c('0x56')](_0x3fb3a7);}})[_0xe91c('0x1b')](function(_0x4b2022){if(_0x4b2022){_0x270a11=_0x4b2022['length'];if(!_0x1f3261[_0xe91c('0x3c')][_0xe91c('0x41')](_0xe91c('0x42'))){_0x3fb3a7[_0xe91c('0x2b')]=qs['limit'](_0x1f3261['query'][_0xe91c('0x2b')]);_0x3fb3a7['offset']=qs[_0xe91c('0x43')](_0x1f3261[_0xe91c('0x3c')][_0xe91c('0x43')]);}return _0x345813[_0xe91c('0x56')](_0x3fb3a7);}})['then'](function(_0x8099fe){if(_0x8099fe){return _0x8099fe?{'count':_0x270a11,'rows':_0x8099fe}:null;}})['then'](respondWithResult(_0x4389ed,null))[_0xe91c('0x25')](handleError(_0x4389ed,null));};exports['addConfiguration']=function(_0x22204d,_0x408c12,_0x21cf90){if(_0x22204d[_0xe91c('0x55')]['id']){delete _0x22204d[_0xe91c('0x55')]['id'];}return db[_0xe91c('0x37')][_0xe91c('0x57')]({'where':{'id':_0x22204d[_0xe91c('0x50')]['id']}})[_0xe91c('0x1b')](handleEntityNotFound(_0x408c12,null))[_0xe91c('0x1b')](function(_0x3041b4){if(_0x3041b4){_0x22204d[_0xe91c('0x55')][_0xe91c('0x59')]=_0x3041b4['id'];_0x22204d[_0xe91c('0x55')][_0xe91c('0x5a')]=integrations[_0xe91c('0x5b')](_0x22204d[_0xe91c('0x55')][_0xe91c('0x5c')],_0x22204d[_0xe91c('0x55')][_0xe91c('0x48')]);_0x22204d[_0xe91c('0x55')][_0xe91c('0x5d')]=integrations[_0xe91c('0x5e')](_0x22204d['body'][_0xe91c('0x5c')],_0x22204d[_0xe91c('0x55')][_0xe91c('0x48')]);return db[_0xe91c('0x5f')][_0xe91c('0x54')](_0x22204d[_0xe91c('0x55')],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db[_0xe91c('0x60')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x408c12,null))[_0xe91c('0x25')](handleError(_0x408c12,null));};exports[_0xe91c('0x61')]=function(_0x329ba7,_0x392507,_0x2c8eb0){var _0x5624d5=['made_sla','hold_reason',_0xe91c('0x62'),'subcategory','close_code',_0xe91c('0x63'),_0xe91c('0x64'),_0xe91c('0x65'),_0xe91c('0x66')];var _0x301ca2=[_0xe91c('0x67'),_0xe91c('0x68'),_0xe91c('0x69'),_0xe91c('0x6a'),_0xe91c('0x6b'),_0xe91c('0x6c'),'child_incidents',_0xe91c('0x6d'),_0xe91c('0x6e'),_0xe91c('0x6f'),'resolved_by','sys_updated_by','opened_by',_0xe91c('0x70'),_0xe91c('0x71'),_0xe91c('0x72'),_0xe91c('0x73'),_0xe91c('0x74'),_0xe91c('0x62'),'order','calendar_stc','closed_at',_0xe91c('0x75'),_0xe91c('0x76'),'impact','active',_0xe91c('0x77'),_0xe91c('0x78'),_0xe91c('0x79'),_0xe91c('0x7a'),_0xe91c('0x7b'),'time_worked',_0xe91c('0x7c'),_0xe91c('0x7d'),_0xe91c('0x7e'),_0xe91c('0x7f'),_0xe91c('0x80'),'reopened_time',_0xe91c('0x81'),_0xe91c('0x82'),'approval_set','subcategory','work_notes',_0xe91c('0x83'),_0xe91c('0x84'),_0xe91c('0x85'),'delivery_task','work_start',_0xe91c('0x86'),'business_stc',_0xe91c('0x87'),_0xe91c('0x88'),_0xe91c('0x89'),'notify','sys_class_name','close_notes',_0xe91c('0x8a'),'follow_up',_0xe91c('0x8b'),_0xe91c('0x8c'),'contact_type',_0xe91c('0x8d'),_0xe91c('0x64'),_0xe91c('0x8e'),'problem_id','company','reassignment_count','activity_due','assigned_to','severity',_0xe91c('0x8f'),'sla_due',_0xe91c('0x90'),_0xe91c('0x91'),'due_date',_0xe91c('0x92'),_0xe91c('0x93'),_0xe91c('0x94'),_0xe91c('0x95'),'upon_approval',_0xe91c('0x96'),_0xe91c('0x97'),_0xe91c('0x66')];var _0xf2d561='';var _0x367dc6='';var _0x9ef2d4=[];var _0x40f0f5='';var _0x387d40='';var _0x16bef0=[];var _0x2bef73='';var _0x1c1b36='';var _0x3a9f40={};var _0x7b6575='';return db[_0xe91c('0x37')][_0xe91c('0x57')]({'where':{'id':_0x329ba7[_0xe91c('0x50')]['id']},'attributes':['id',_0xe91c('0x98'),_0xe91c('0x99'),'email',_0xe91c('0x9a'),_0xe91c('0x9b')]})[_0xe91c('0x1b')](handleEntityNotFound(_0x392507,null))[_0xe91c('0x1b')](function(_0x1ee115){if(_0x1ee115){_0x7b6575=_0x1ee115[_0xe91c('0x9a')];var _0x478780=_0x7b6575[_0xe91c('0x9c')](-0x1);if(_0x478780==='/'){_0x7b6575=_0x7b6575[_0xe91c('0x9d')](0x0,_0x7b6575['lastIndexOf'](_0x478780));}_0x1c1b36=util[_0xe91c('0x9e')](_0xe91c('0x9f'),_0x7b6575);_0x2bef73=util['format'](_0xe91c('0xa0'),_0x7b6575);_0x3a9f40={'user':_0x1ee115[_0xe91c('0x98')],'pass':_0x1ee115[_0xe91c('0x99')]};var _0x561901={'method':_0xe91c('0xa1'),'uri':_0x1c1b36+_0xe91c('0xa2'),'auth':_0x3a9f40,'json':!![]};return rp(_0x561901);}})[_0xe91c('0x1b')](function(_0x577621){if(_0x577621['result']['length']>0x0){_0xf2d561=_0x577621[_0xe91c('0x24')];}console[_0xe91c('0xa3')](_0xe91c('0xa4'),_0xf2d561);_0x16bef0=[];_0x367dc6=Object['assign']([],_0xf2d561);_[_0xe91c('0xa5')](_0x367dc6,function(_0x5c7f37){return!_0x5624d5[_0xe91c('0xa6')](_0x5c7f37[_0xe91c('0x34')]);});_0x367dc6[_0xe91c('0xa7')](function(_0x21e14d){var _0x4a3c24=createFieldObject(_0x2bef73,_0x3a9f40,_0x21e14d['internalType'],_0x21e14d[_0xe91c('0x34')],_0x21e14d[_0xe91c('0xa8')],![]);_0x16bef0['push'](_0x4a3c24);});return Promise['all'](_0x16bef0);})[_0xe91c('0x1b')](function(_0x301692){_0x9ef2d4=_0x301692;_0x40f0f5=Object['assign']([],_0xf2d561);console[_0xe91c('0xa3')]('TCL:\x20_object',_0xf2d561);_[_0xe91c('0xa5')](_0x40f0f5,function(_0xf061fd){return _0x301ca2[_0xe91c('0xa6')](_0xf061fd[_0xe91c('0x34')]);});console['log'](_0xe91c('0xa9'),_0x40f0f5);_0x16bef0=[];_0x40f0f5[_0xe91c('0xa7')](function(_0x223d8e){var _0x29e63e=createFieldObject(_0x2bef73,_0x3a9f40,_0x223d8e[_0xe91c('0xaa')],_0x223d8e[_0xe91c('0x34')],_0x223d8e[_0xe91c('0xa8')],!![]);_0x16bef0[_0xe91c('0xab')](_0x29e63e);});return Promise[_0xe91c('0xac')](_0x16bef0);})[_0xe91c('0x1b')](function(_0x27fd9f){_0x387d40=_0x27fd9f;var _0x305216=_0x9ef2d4[_0xe91c('0xad')](_0x387d40);return{'count':_0x305216[_0xe91c('0x52')],'rows':_0x305216};})[_0xe91c('0x1b')](respondWithResult(_0x392507,null))[_0xe91c('0x25')](function(_0x45b87d){console['log'](_0xe91c('0xae')+_0x45b87d);var _0x6fb3a3=_0x329ba7[_0xe91c('0x3c')]['test']?0x1f4:_0x45b87d[_0xe91c('0xaf')]||0x1f4;logger[_0xe91c('0x20')](_0x45b87d[_0xe91c('0x33')]);delete _0x45b87d[_0xe91c('0x34')];if(_0x6fb3a3===0x191){_0x6fb3a3=0x190;}_0x392507[_0xe91c('0x27')](_0x6fb3a3)['send'](_0x329ba7[_0xe91c('0x3c')][_0xe91c('0x17')]?{'message':'Wrong\x20credentials','statusCode':_0x45b87d[_0xe91c('0xaf')]}:_0x45b87d);});};function createFieldObject(_0x224222,_0x584110,_0x4862ee,_0x2c1942,_0x218b5b,_0x4716ff){return new Promise(function(_0x3ebefe,_0x2d7985){var _0x44eae1={'id':_0x2c1942,'name':_0x218b5b,'custom':_0x4716ff};if(_0x4862ee==='boolean'){_0x44eae1['options']=[{'name':'True','value':_0xe91c('0xb0')},{'name':_0xe91c('0xb1'),'value':'false'}];_0x3ebefe(_0x44eae1);}else{var _0x4680a2={'method':'GET','uri':_0x224222+'sys_choice?sysparm_query=name=incident^element='+_0x2c1942,'auth':_0x584110,'json':!![]};return rp(_0x4680a2)[_0xe91c('0x1b')](function(_0x40ab5a){var _0x5830a6=[];if(_0x40ab5a['result']['length']>0x0){_0x40ab5a[_0xe91c('0x24')][_0xe91c('0xa7')](function(_0x140ab0){if(_0x140ab0[_0xe91c('0xb2')]===_0xe91c('0xb3')){var _0x109147={'name':_0x140ab0[_0xe91c('0xa8')],'value':_0x140ab0[_0xe91c('0xb4')]};_0x5830a6['push'](_0x109147);}});}_0x44eae1['options']=_0x5830a6;if(_0x44eae1[_0xe91c('0x4b')][_0xe91c('0x52')]>0x0){_0x3ebefe(_0x44eae1);}else{if(_0x4716ff==![]){_0x3ebefe();}else{_0x3ebefe(_0x44eae1);}}});}});} \ No newline at end of file +var _0x3d50=['type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','show','params','find','create','body','getConfigurations','ServicenowConfiguration','options','addConfiguration','findOne','AccountId','Subjects','Descriptions','getDescriptions','channel','ServicenowField','made_sla','hold_reason','knowledge','close_code','incident_state','severity','category','parent','upon_reject','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','calendar_stc','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','description','calendar_duration','notify','sys_class_name','contact_type','reopened_by','problem_id','company','activity_due','comments','sla_due','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','includes','forEach','label','all','TCL:\x20_object','remove','internalType','concat','ServiceNow\x20error:\x20','statusCode','Wrong\x20credentials','boolean','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','jayson/promise','client','http','test','ValidationError','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','count','offset','limit','Content-Range','json','reject','save','update','then','destroy','sendStatus','stack','name','send','index','ServicenowAccount','rawAttributes','fieldName'];(function(_0x20110e,_0xe9b13e){var _0x4d77b8=function(_0x5aeee0){while(--_0x5aeee0){_0x20110e['push'](_0x20110e['shift']());}};_0x4d77b8(++_0xe9b13e);}(_0x3d50,0x81));var _0x03d5=function(_0x17d77b,_0x5319a5){_0x17d77b=_0x17d77b-0x0;var _0x5764d3=_0x3d50[_0x17d77b];return _0x5764d3;};'use strict';var pdf=require(_0x03d5('0x0'));var emlformat=require(_0x03d5('0x1'));var rimraf=require(_0x03d5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x03d5('0x3'));var rp=require(_0x03d5('0x4'));var moment=require(_0x03d5('0x5'));var BPromise=require(_0x03d5('0x6'));var Mustache=require(_0x03d5('0x7'));var util=require(_0x03d5('0x8'));var path=require(_0x03d5('0x9'));var sox=require('sox');var csv=require(_0x03d5('0xa'));var ejs=require(_0x03d5('0xb'));var fs=require('fs');var _=require(_0x03d5('0xc'));var squel=require(_0x03d5('0xd'));var crypto=require(_0x03d5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x03d5('0xf'));var toCsv=require(_0x03d5('0xa'));var querystring=require(_0x03d5('0x10'));var Papa=require(_0x03d5('0x11'));var Redis=require(_0x03d5('0x12'));var authService=require(_0x03d5('0x13'));var qs=require(_0x03d5('0x14'));var as=require(_0x03d5('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x03d5('0x16'));var utils=require(_0x03d5('0x17'));var config=require('../../config/environment');var db=require(_0x03d5('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x03d5('0x19'));var client=jayson[_0x03d5('0x1a')][_0x03d5('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x44d4ce,_0x4a8c0d,_0x24f6ae){if(_0x24f6ae){var _0x4e4122=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4e4122[_0x03d5('0x1c')](_0x4a8c0d)){return _0x44d4ce;}else{throw new db['Sequelize'][(_0x03d5('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 _0x44d4ce;}}function respondWithRpcPromise(_0x5c548c,_0x120cb4,_0x32bd74,_0x324737){return new BPromise(function(_0x24da23,_0x1d965c){var _0x247996=_0x324737||client;return _0x247996[_0x03d5('0x1e')](_0x5c548c,_0x32bd74)['then'](function(_0x328bf1){logger[_0x03d5('0x1f')](_0x03d5('0x20'),_0x120cb4,_0x03d5('0x21'));logger['debug'](_0x03d5('0x22'),_0x120cb4,_0x03d5('0x21'),JSON[_0x03d5('0x23')](_0x328bf1));if(_0x328bf1[_0x03d5('0x24')]){if(_0x328bf1[_0x03d5('0x24')][_0x03d5('0x25')]===0x1f4){logger[_0x03d5('0x24')](_0x03d5('0x20'),_0x120cb4,_0x328bf1[_0x03d5('0x24')][_0x03d5('0x26')]);return _0x1d965c(_0x328bf1[_0x03d5('0x24')][_0x03d5('0x26')]);}logger[_0x03d5('0x24')](_0x03d5('0x20'),_0x120cb4,_0x328bf1['error'][_0x03d5('0x26')]);return _0x24da23(_0x328bf1[_0x03d5('0x24')][_0x03d5('0x26')]);}else{logger[_0x03d5('0x1f')](_0x03d5('0x20'),_0x120cb4,'request\x20sent');_0x24da23(_0x328bf1[_0x03d5('0x27')][_0x03d5('0x26')]);}})[_0x03d5('0x28')](function(_0x1190ea){logger[_0x03d5('0x24')](_0x03d5('0x20'),_0x120cb4,_0x1190ea);_0x1d965c(_0x1190ea);});});}function respondWithStatusCode(_0x4fd0c4,_0x2bb992){_0x2bb992=_0x2bb992||0xcc;return function(_0x11c1f0){if(_0x11c1f0){return _0x4fd0c4['sendStatus'](_0x2bb992);}return _0x4fd0c4['status'](_0x2bb992)[_0x03d5('0x29')]();};}function respondWithResult(_0x4c2a8a,_0x5a69e6){_0x5a69e6=_0x5a69e6||0xc8;return function(_0x383616){if(_0x383616){return _0x4c2a8a[_0x03d5('0x2a')](_0x5a69e6)['json'](_0x383616);}};}function respondWithFilteredResult(_0x1d829b,_0x45b4d6){return function(_0x5562e5){if(_0x5562e5){var _0x3a765c=_0x5562e5[_0x03d5('0x2b')],_0x21c31e=_0x45b4d6[_0x03d5('0x2c')],_0x599cd3=_0x45b4d6[_0x03d5('0x2c')]+_0x45b4d6[_0x03d5('0x2d')],_0x15cc4a;if(_0x599cd3>=_0x3a765c){_0x599cd3=_0x3a765c;_0x15cc4a=0xc8;}else{_0x15cc4a=0xce;}_0x1d829b[_0x03d5('0x2a')](_0x15cc4a);return _0x1d829b['set'](_0x03d5('0x2e'),_0x21c31e+'-'+_0x599cd3+'/'+_0x3a765c)[_0x03d5('0x2f')](_0x5562e5);}return null;};}function patchUpdates(_0x3b47ae){return function(_0x18f890){try{jsonpatch['apply'](_0x18f890,_0x3b47ae,!![]);}catch(_0x58d156){return BPromise[_0x03d5('0x30')](_0x58d156);}return _0x18f890[_0x03d5('0x31')]();};}function saveUpdates(_0x3d401b,_0x3f81e2){return function(_0x3a7f8c){if(_0x3a7f8c){return _0x3a7f8c[_0x03d5('0x32')](_0x3d401b)[_0x03d5('0x33')](function(_0x491b65){return _0x491b65;});}return null;};}function removeEntity(_0x2ae590,_0x512c08){return function(_0x35af15){if(_0x35af15){return _0x35af15[_0x03d5('0x34')]()[_0x03d5('0x33')](function(){_0x2ae590[_0x03d5('0x2a')](0xcc)[_0x03d5('0x29')]();});}};}function handleEntityNotFound(_0x5a9688,_0xcf4910){return function(_0x2c1ec4){if(!_0x2c1ec4){_0x5a9688[_0x03d5('0x35')](0x194);}return _0x2c1ec4;};}function handleError(_0x4c9c42,_0x14cb82){_0x14cb82=_0x14cb82||0x1f4;return function(_0x5531c2){logger[_0x03d5('0x24')](_0x5531c2[_0x03d5('0x36')]);if(_0x5531c2['name']){delete _0x5531c2[_0x03d5('0x37')];}_0x4c9c42['status'](_0x14cb82)[_0x03d5('0x38')](_0x5531c2);};}exports[_0x03d5('0x39')]=function(_0x1efc1c,_0x9d7e12){var _0x1f3b4c={},_0x29d81a={},_0x5369d1={'count':0x0,'rows':[]};var _0x419e11=_['map'](db[_0x03d5('0x3a')][_0x03d5('0x3b')],function(_0xdc7767){return{'name':_0xdc7767[_0x03d5('0x3c')],'type':_0xdc7767[_0x03d5('0x3d')]['key']};});_0x29d81a[_0x03d5('0x3e')]=_[_0x03d5('0x3f')](_0x419e11,_0x03d5('0x37'));_0x29d81a[_0x03d5('0x40')]=_[_0x03d5('0x41')](_0x1efc1c[_0x03d5('0x40')]);_0x29d81a[_0x03d5('0x42')]=_[_0x03d5('0x43')](_0x29d81a['model'],_0x29d81a[_0x03d5('0x40')]);_0x1f3b4c[_0x03d5('0x44')]=_[_0x03d5('0x43')](_0x29d81a['model'],qs[_0x03d5('0x45')](_0x1efc1c[_0x03d5('0x40')][_0x03d5('0x45')]));_0x1f3b4c[_0x03d5('0x44')]=_0x1f3b4c[_0x03d5('0x44')][_0x03d5('0x46')]?_0x1f3b4c[_0x03d5('0x44')]:_0x29d81a[_0x03d5('0x3e')];if(!_0x1efc1c[_0x03d5('0x40')][_0x03d5('0x47')](_0x03d5('0x48'))){_0x1f3b4c['limit']=qs['limit'](_0x1efc1c['query']['limit']);_0x1f3b4c[_0x03d5('0x2c')]=qs[_0x03d5('0x2c')](_0x1efc1c[_0x03d5('0x40')][_0x03d5('0x2c')]);}_0x1f3b4c[_0x03d5('0x49')]=qs[_0x03d5('0x4a')](_0x1efc1c[_0x03d5('0x40')][_0x03d5('0x4a')]);_0x1f3b4c[_0x03d5('0x4b')]=qs[_0x03d5('0x42')](_[_0x03d5('0x4c')](_0x1efc1c[_0x03d5('0x40')],_0x29d81a[_0x03d5('0x42')]));if(_0x1efc1c[_0x03d5('0x40')][_0x03d5('0x4d')]){_0x1f3b4c[_0x03d5('0x4b')]=_[_0x03d5('0x4e')](_0x1f3b4c[_0x03d5('0x4b')],{'$or':_[_0x03d5('0x3f')](_0x419e11,function(_0x565e14){if(_0x565e14['type']!==_0x03d5('0x4f')){var _0x14b33e={};_0x14b33e[_0x565e14[_0x03d5('0x37')]]={'$like':'%'+_0x1efc1c[_0x03d5('0x40')][_0x03d5('0x4d')]+'%'};return _0x14b33e;}})});}_0x1f3b4c=_[_0x03d5('0x4e')]({},_0x1f3b4c,_0x1efc1c['options']);var _0x378b0b={'where':_0x1f3b4c['where']};return db[_0x03d5('0x3a')][_0x03d5('0x2b')](_0x378b0b)['then'](function(_0x378acf){_0x5369d1['count']=_0x378acf;if(_0x1efc1c[_0x03d5('0x40')]['includeAll']){_0x1f3b4c[_0x03d5('0x50')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x03d5('0x51')](_0x1f3b4c);})[_0x03d5('0x33')](function(_0x715245){_0x5369d1[_0x03d5('0x52')]=_0x715245;return _0x5369d1;})[_0x03d5('0x33')](respondWithFilteredResult(_0x9d7e12,_0x1f3b4c))['catch'](handleError(_0x9d7e12,null));};exports[_0x03d5('0x53')]=function(_0x528d4b,_0x17b654){var _0x4f2515={'raw':![],'where':{'id':_0x528d4b[_0x03d5('0x54')]['id']}},_0x43a795={};_0x43a795[_0x03d5('0x3e')]=_['keys'](db[_0x03d5('0x3a')][_0x03d5('0x3b')]);_0x43a795[_0x03d5('0x40')]=_[_0x03d5('0x41')](_0x528d4b[_0x03d5('0x40')]);_0x43a795[_0x03d5('0x42')]=_[_0x03d5('0x43')](_0x43a795[_0x03d5('0x3e')],_0x43a795[_0x03d5('0x40')]);_0x4f2515[_0x03d5('0x44')]=_[_0x03d5('0x43')](_0x43a795[_0x03d5('0x3e')],qs[_0x03d5('0x45')](_0x528d4b[_0x03d5('0x40')][_0x03d5('0x45')]));_0x4f2515[_0x03d5('0x44')]=_0x4f2515[_0x03d5('0x44')][_0x03d5('0x46')]?_0x4f2515[_0x03d5('0x44')]:_0x43a795[_0x03d5('0x3e')];if(_0x528d4b[_0x03d5('0x40')]['includeAll']){_0x4f2515[_0x03d5('0x50')]=[{'all':!![]}];}_0x4f2515=_[_0x03d5('0x4e')]({},_0x4f2515,_0x528d4b['options']);return db['ServicenowAccount'][_0x03d5('0x55')](_0x4f2515)[_0x03d5('0x33')](handleEntityNotFound(_0x17b654,null))[_0x03d5('0x33')](respondWithResult(_0x17b654,null))[_0x03d5('0x28')](handleError(_0x17b654,null));};exports[_0x03d5('0x56')]=function(_0x2b0c39,_0x5c05ff){return db[_0x03d5('0x3a')]['create'](_0x2b0c39[_0x03d5('0x57')],{})['then'](respondWithResult(_0x5c05ff,0xc9))['catch'](handleError(_0x5c05ff,null));};exports[_0x03d5('0x32')]=function(_0x5d91aa,_0x10484c){if(_0x5d91aa[_0x03d5('0x57')]['id']){delete _0x5d91aa['body']['id'];}return db[_0x03d5('0x3a')]['find']({'where':{'id':_0x5d91aa['params']['id']}})[_0x03d5('0x33')](handleEntityNotFound(_0x10484c,null))[_0x03d5('0x33')](saveUpdates(_0x5d91aa[_0x03d5('0x57')],null))[_0x03d5('0x33')](respondWithResult(_0x10484c,null))[_0x03d5('0x28')](handleError(_0x10484c,null));};exports[_0x03d5('0x34')]=function(_0x518c11,_0x459ffa){return db[_0x03d5('0x3a')]['find']({'where':{'id':_0x518c11[_0x03d5('0x54')]['id']}})[_0x03d5('0x33')](handleEntityNotFound(_0x459ffa,null))[_0x03d5('0x33')](removeEntity(_0x459ffa,null))[_0x03d5('0x28')](handleError(_0x459ffa,null));};exports[_0x03d5('0x58')]=function(_0xa87a9a,_0x1d1a5c,_0x2e1941){var _0x47ead0={};var _0x44ab8d={};var _0x1b29ca;var _0xa3c9b6;return db[_0x03d5('0x3a')]['findOne']({'where':{'id':_0xa87a9a[_0x03d5('0x54')]['id']}})['then'](handleEntityNotFound(_0x1d1a5c,null))[_0x03d5('0x33')](function(_0x2eb30a){if(_0x2eb30a){_0x1b29ca=_0x2eb30a;_0x44ab8d[_0x03d5('0x3e')]=_[_0x03d5('0x41')](db[_0x03d5('0x59')][_0x03d5('0x3b')]);_0x44ab8d[_0x03d5('0x40')]=_[_0x03d5('0x41')](_0xa87a9a[_0x03d5('0x40')]);_0x44ab8d[_0x03d5('0x42')]=_['intersection'](_0x44ab8d[_0x03d5('0x3e')],_0x44ab8d[_0x03d5('0x40')]);_0x47ead0['attributes']=_[_0x03d5('0x43')](_0x44ab8d[_0x03d5('0x3e')],qs[_0x03d5('0x45')](_0xa87a9a[_0x03d5('0x40')][_0x03d5('0x45')]));_0x47ead0[_0x03d5('0x44')]=_0x47ead0['attributes'][_0x03d5('0x46')]?_0x47ead0['attributes']:_0x44ab8d['model'];_0x47ead0[_0x03d5('0x49')]=qs[_0x03d5('0x4a')](_0xa87a9a[_0x03d5('0x40')]['sort']);_0x47ead0[_0x03d5('0x4b')]=qs[_0x03d5('0x42')](_[_0x03d5('0x4c')](_0xa87a9a[_0x03d5('0x40')],_0x44ab8d[_0x03d5('0x42')]));if(_0xa87a9a[_0x03d5('0x40')][_0x03d5('0x4d')]){_0x47ead0[_0x03d5('0x4b')]=_['merge'](_0x47ead0[_0x03d5('0x4b')],{'$or':_[_0x03d5('0x3f')](_0x47ead0[_0x03d5('0x44')],function(_0x7b19e6){var _0xa282={};_0xa282[_0x7b19e6]={'$like':'%'+_0xa87a9a[_0x03d5('0x40')][_0x03d5('0x4d')]+'%'};return _0xa282;})});}_0x47ead0=_[_0x03d5('0x4e')]({},_0x47ead0,_0xa87a9a[_0x03d5('0x5a')]);return _0x1b29ca[_0x03d5('0x58')](_0x47ead0);}})[_0x03d5('0x33')](function(_0x110b29){if(_0x110b29){_0xa3c9b6=_0x110b29[_0x03d5('0x46')];if(!_0xa87a9a[_0x03d5('0x40')][_0x03d5('0x47')](_0x03d5('0x48'))){_0x47ead0[_0x03d5('0x2d')]=qs['limit'](_0xa87a9a[_0x03d5('0x40')][_0x03d5('0x2d')]);_0x47ead0[_0x03d5('0x2c')]=qs['offset'](_0xa87a9a['query']['offset']);}return _0x1b29ca[_0x03d5('0x58')](_0x47ead0);}})[_0x03d5('0x33')](function(_0x23af09){if(_0x23af09){return _0x23af09?{'count':_0xa3c9b6,'rows':_0x23af09}:null;}})[_0x03d5('0x33')](respondWithResult(_0x1d1a5c,null))[_0x03d5('0x28')](handleError(_0x1d1a5c,null));};exports[_0x03d5('0x5b')]=function(_0x373d32,_0xbf4345,_0xe5a782){if(_0x373d32[_0x03d5('0x57')]['id']){delete _0x373d32[_0x03d5('0x57')]['id'];}return db[_0x03d5('0x3a')][_0x03d5('0x5c')]({'where':{'id':_0x373d32[_0x03d5('0x54')]['id']}})['then'](handleEntityNotFound(_0xbf4345,null))['then'](function(_0x3ffe57){if(_0x3ffe57){_0x373d32[_0x03d5('0x57')][_0x03d5('0x5d')]=_0x3ffe57['id'];_0x373d32[_0x03d5('0x57')][_0x03d5('0x5e')]=integrations['getSubjects'](_0x373d32['body']['channel'],_0x373d32[_0x03d5('0x57')][_0x03d5('0x3d')]);_0x373d32[_0x03d5('0x57')][_0x03d5('0x5f')]=integrations[_0x03d5('0x60')](_0x373d32['body'][_0x03d5('0x61')],_0x373d32[_0x03d5('0x57')]['type']);return db['ServicenowConfiguration'][_0x03d5('0x56')](_0x373d32[_0x03d5('0x57')],{'include':[{'model':db[_0x03d5('0x62')],'as':'Subjects'},{'model':db['ServicenowField'],'as':_0x03d5('0x5f')}]});}return null;})[_0x03d5('0x33')](respondWithResult(_0xbf4345,null))[_0x03d5('0x28')](handleError(_0xbf4345,null));};exports['getFields']=function(_0x39585d,_0x5c1223,_0x1023f8){var _0x340832=[_0x03d5('0x63'),_0x03d5('0x64'),_0x03d5('0x65'),'subcategory',_0x03d5('0x66'),'notify',_0x03d5('0x67'),_0x03d5('0x68'),_0x03d5('0x69')];var _0xc16837=[_0x03d5('0x6a'),_0x03d5('0x63'),'caused_by','watch_list',_0x03d5('0x6b'),_0x03d5('0x6c'),_0x03d5('0x6d'),_0x03d5('0x64'),'approval_history',_0x03d5('0x6e'),_0x03d5('0x6f'),_0x03d5('0x70'),_0x03d5('0x71'),_0x03d5('0x72'),_0x03d5('0x73'),_0x03d5('0x74'),_0x03d5('0x75'),'sys_created_by',_0x03d5('0x65'),_0x03d5('0x49'),_0x03d5('0x76'),'closed_at','cmdb_ci',_0x03d5('0x77'),_0x03d5('0x78'),_0x03d5('0x79'),_0x03d5('0x7a'),'business_service',_0x03d5('0x7b'),_0x03d5('0x7c'),_0x03d5('0x7d'),_0x03d5('0x7e'),_0x03d5('0x7f'),_0x03d5('0x80'),_0x03d5('0x81'),_0x03d5('0x82'),_0x03d5('0x83'),_0x03d5('0x84'),_0x03d5('0x85'),_0x03d5('0x86'),_0x03d5('0x87'),_0x03d5('0x88'),'work_notes','short_description',_0x03d5('0x66'),_0x03d5('0x89'),_0x03d5('0x8a'),_0x03d5('0x8b'),'assignment_group',_0x03d5('0x8c'),_0x03d5('0x8d'),_0x03d5('0x8e'),_0x03d5('0x8f'),_0x03d5('0x90'),_0x03d5('0x91'),'close_notes','closed_by','follow_up','parent_incident','sys_id',_0x03d5('0x92'),_0x03d5('0x93'),_0x03d5('0x67'),'urgency',_0x03d5('0x94'),_0x03d5('0x95'),'reassignment_count',_0x03d5('0x96'),'assigned_to','severity',_0x03d5('0x97'),_0x03d5('0x98'),'approval','comments_and_work_notes','due_date',_0x03d5('0x99'),_0x03d5('0x9a'),_0x03d5('0x9b'),_0x03d5('0x9c'),_0x03d5('0x9d'),'correlation_id',_0x03d5('0x9e'),_0x03d5('0x69')];var _0x407cab='';var _0x128d62='';var _0x5879fc=[];var _0x1ade5b='';var _0x3f3fc8='';var _0x2d6644=[];var _0x36c7ad='';var _0x14149b='';var _0x9fa0e8={};var _0x56c27f='';return db[_0x03d5('0x3a')][_0x03d5('0x5c')]({'where':{'id':_0x39585d[_0x03d5('0x54')]['id']},'attributes':['id','username',_0x03d5('0x9f'),_0x03d5('0xa0'),'remoteUri','serverUrl']})[_0x03d5('0x33')](handleEntityNotFound(_0x5c1223,null))[_0x03d5('0x33')](function(_0x4c025c){if(_0x4c025c){_0x56c27f=_0x4c025c[_0x03d5('0xa1')];var _0x241362=_0x56c27f[_0x03d5('0xa2')](-0x1);if(_0x241362==='/'){_0x56c27f=_0x56c27f[_0x03d5('0xa3')](0x0,_0x56c27f[_0x03d5('0xa4')](_0x241362));}_0x14149b=util[_0x03d5('0xa5')](_0x03d5('0xa6'),_0x56c27f);_0x36c7ad=util[_0x03d5('0xa5')](_0x03d5('0xa7'),_0x56c27f);_0x9fa0e8={'user':_0x4c025c['username'],'pass':_0x4c025c[_0x03d5('0x9f')]};var _0x1e7733={'method':_0x03d5('0xa8'),'uri':_0x14149b+_0x03d5('0xa9'),'auth':_0x9fa0e8,'json':!![]};return rp(_0x1e7733);}})[_0x03d5('0x33')](function(_0x5a633d){if(_0x5a633d['result']['length']>0x0){_0x407cab=_0x5a633d['result'];}console[_0x03d5('0xaa')](_0x03d5('0xab'),_0x407cab);_0x2d6644=[];_0x128d62=Object[_0x03d5('0xac')]([],_0x407cab);_['remove'](_0x128d62,function(_0x1c9801){return!_0x340832[_0x03d5('0xad')](_0x1c9801['name']);});_0x128d62[_0x03d5('0xae')](function(_0x22aa40){var _0x74a2b2=createFieldObject(_0x36c7ad,_0x9fa0e8,_0x22aa40['internalType'],_0x22aa40[_0x03d5('0x37')],_0x22aa40[_0x03d5('0xaf')],![]);_0x2d6644['push'](_0x74a2b2);});return Promise[_0x03d5('0xb0')](_0x2d6644);})[_0x03d5('0x33')](function(_0x29eb93){_0x5879fc=_0x29eb93;_0x1ade5b=Object[_0x03d5('0xac')]([],_0x407cab);console[_0x03d5('0xaa')](_0x03d5('0xb1'),_0x407cab);_[_0x03d5('0xb2')](_0x1ade5b,function(_0x1c00fa){return _0xc16837[_0x03d5('0xad')](_0x1c00fa['name']);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x1ade5b);_0x2d6644=[];_0x1ade5b[_0x03d5('0xae')](function(_0x1df9f9){var _0x113171=createFieldObject(_0x36c7ad,_0x9fa0e8,_0x1df9f9[_0x03d5('0xb3')],_0x1df9f9[_0x03d5('0x37')],_0x1df9f9[_0x03d5('0xaf')],!![]);_0x2d6644['push'](_0x113171);});return Promise['all'](_0x2d6644);})[_0x03d5('0x33')](function(_0x400851){_0x3f3fc8=_0x400851;var _0x23c69c=_0x5879fc[_0x03d5('0xb4')](_0x3f3fc8);return{'count':_0x23c69c[_0x03d5('0x46')],'rows':_0x23c69c};})[_0x03d5('0x33')](respondWithResult(_0x5c1223,null))[_0x03d5('0x28')](function(_0x38d201){console['log'](_0x03d5('0xb5')+_0x38d201);var _0x4690ef=_0x39585d[_0x03d5('0x40')][_0x03d5('0x1c')]?0x1f4:_0x38d201[_0x03d5('0xb6')]||0x1f4;logger[_0x03d5('0x24')](_0x38d201['stack']);delete _0x38d201[_0x03d5('0x37')];if(_0x4690ef===0x191){_0x4690ef=0x190;}_0x5c1223['status'](_0x4690ef)[_0x03d5('0x38')](_0x39585d[_0x03d5('0x40')][_0x03d5('0x1c')]?{'message':_0x03d5('0xb7'),'statusCode':_0x38d201[_0x03d5('0xb6')]}:_0x38d201);});};function createFieldObject(_0x3bbf95,_0x1511b7,_0x3a6da9,_0x30f0bd,_0x5c3d63,_0x4a42b5){return new Promise(function(_0x416945,_0x261aec){var _0x1cd0e0={'id':_0x30f0bd,'name':_0x5c3d63,'custom':_0x4a42b5};if(_0x3a6da9===_0x03d5('0xb8')){_0x1cd0e0[_0x03d5('0x5a')]=[{'name':'True','value':_0x03d5('0xb9')},{'name':_0x03d5('0xba'),'value':_0x03d5('0xbb')}];_0x416945(_0x1cd0e0);}else{var _0x1400a3={'method':_0x03d5('0xa8'),'uri':_0x3bbf95+_0x03d5('0xbc')+_0x30f0bd,'auth':_0x1511b7,'json':!![]};return rp(_0x1400a3)['then'](function(_0x1d16be){var _0x41d394=[];if(_0x1d16be[_0x03d5('0x27')][_0x03d5('0x46')]>0x0){_0x1d16be['result'][_0x03d5('0xae')](function(_0x30f952){if(_0x30f952[_0x03d5('0xbd')]===_0x03d5('0xbb')){var _0x5e4fd9={'name':_0x30f952[_0x03d5('0xaf')],'value':_0x30f952['value']};_0x41d394['push'](_0x5e4fd9);}});}_0x1cd0e0[_0x03d5('0x5a')]=_0x41d394;if(_0x1cd0e0[_0x03d5('0x5a')]['length']>0x0){_0x416945(_0x1cd0e0);}else{if(_0x4a42b5==![]){_0x416945();}else{_0x416945(_0x1cd0e0);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 1d1889b..4c2d094 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 _0xac31=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','ServicenowAccount','lodash','util'];(function(_0x295871,_0x2aff73){var _0x3d9258=function(_0x96a703){while(--_0x96a703){_0x295871['push'](_0x295871['shift']());}};_0x3d9258(++_0x2aff73);}(_0xac31,0xca));var _0x1ac3=function(_0x5e5aeb,_0x19a66d){_0x5e5aeb=_0x5e5aeb-0x0;var _0x1ea2a3=_0xac31[_0x5e5aeb];return _0x1ea2a3;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var logger=require(_0x1ac3('0x2'))(_0x1ac3('0x3'));var moment=require(_0x1ac3('0x4'));var BPromise=require(_0x1ac3('0x5'));var rp=require(_0x1ac3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var attributes=require('./intServicenowAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x1ac3('0x9')]=function(_0x20027f,_0x2bf9b1){return _0x20027f[_0x1ac3('0xa')](_0x1ac3('0xb'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf873=['bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment'];(function(_0x325501,_0x5242f6){var _0x2c1626=function(_0x4270b2){while(--_0x4270b2){_0x325501['push'](_0x325501['shift']());}};_0x2c1626(++_0x5242f6);}(_0xf873,0xb2));var _0x3f87=function(_0x134571,_0x2af302){_0x134571=_0x134571-0x0;var _0x391d34=_0xf873[_0x134571];return _0x391d34;};'use strict';var _=require('lodash');var util=require(_0x3f87('0x0'));var logger=require(_0x3f87('0x1'))(_0x3f87('0x2'));var moment=require(_0x3f87('0x3'));var BPromise=require(_0x3f87('0x4'));var rp=require(_0x3f87('0x5'));var fs=require('fs');var path=require(_0x3f87('0x6'));var rimraf=require(_0x3f87('0x7'));var config=require(_0x3f87('0x8'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x3f87('0x9'));module[_0x3f87('0xa')]=function(_0x27c03e,_0x5a5e37){return _0x27c03e[_0x3f87('0xb')](_0x3f87('0xc'),attributes,{'tableName':_0x3f87('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 828d981..9de7d60 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 _0x300c=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','limit','map','include','model','find','ShowServicenowAccount','catch'];(function(_0x598c64,_0x5ad036){var _0x35c2a6=function(_0x59aaab){while(--_0x59aaab){_0x598c64['push'](_0x598c64['shift']());}};_0x35c2a6(++_0x5ad036);}(_0x300c,0xa5));var _0xc300=function(_0x41dffa,_0xf2fdc5){_0x41dffa=_0x41dffa-0x0;var _0x4df98f=_0x300c[_0x41dffa];return _0x4df98f;};'use strict';var _=require(_0xc300('0x0'));var util=require('util');var moment=require(_0xc300('0x1'));var BPromise=require(_0xc300('0x2'));var rs=require(_0xc300('0x3'));var fs=require('fs');var Redis=require(_0xc300('0x4'));var db=require(_0xc300('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc300('0x6'))('rpc');var config=require(_0xc300('0x7'));var jayson=require(_0xc300('0x8'));var client=jayson['client'][_0xc300('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b60e8,_0xe128a,_0x1694ca){return new BPromise(function(_0x1f0299,_0x5d755d){return client['request'](_0x1b60e8,_0x1694ca)[_0xc300('0xa')](function(_0x693be4){logger[_0xc300('0xb')](_0xc300('0xc'),_0xe128a,'request\x20sent');logger[_0xc300('0xd')](_0xc300('0xe'),_0xe128a,_0xc300('0xf'),JSON[_0xc300('0x10')](_0x693be4));if(_0x693be4[_0xc300('0x11')]){if(_0x693be4[_0xc300('0x11')]['code']===0x1f4){logger[_0xc300('0x11')](_0xc300('0xc'),_0xe128a,_0x693be4[_0xc300('0x11')]['message']);return _0x5d755d(_0x693be4[_0xc300('0x11')][_0xc300('0x12')]);}logger[_0xc300('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0xe128a,_0x693be4[_0xc300('0x11')][_0xc300('0x12')]);return _0x1f0299(_0x693be4[_0xc300('0x11')][_0xc300('0x12')]);}else{logger[_0xc300('0xb')](_0xc300('0xc'),_0xe128a,_0xc300('0xf'));_0x1f0299(_0x693be4[_0xc300('0x13')][_0xc300('0x12')]);}})['catch'](function(_0x351ebc){logger[_0xc300('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0xe128a,_0x351ebc);_0x5d755d(_0x351ebc);});});}exports[_0xc300('0x14')]=function(_0x2351f3){var _0x455eeb=this;return new Promise(function(_0x1995cf,_0x392432){return db[_0xc300('0x15')][_0xc300('0x16')]({'raw':_0x2351f3['options']?_0x2351f3[_0xc300('0x17')][_0xc300('0x18')]===undefined?!![]:![]:!![],'where':_0x2351f3[_0xc300('0x17')]?_0x2351f3[_0xc300('0x17')]['where']||null:null,'attributes':_0x2351f3[_0xc300('0x17')]?_0x2351f3[_0xc300('0x17')][_0xc300('0x19')]||null:null,'limit':_0x2351f3['options']?_0x2351f3['options'][_0xc300('0x1a')]||null:null,'include':_0x2351f3[_0xc300('0x17')]?_0x2351f3[_0xc300('0x17')]['include']?_[_0xc300('0x1b')](_0x2351f3[_0xc300('0x17')]['include'],function(_0xf4bb21){return{'model':db[_0xf4bb21['model']],'as':_0xf4bb21['as'],'attributes':_0xf4bb21[_0xc300('0x19')],'include':_0xf4bb21[_0xc300('0x1c')]?_[_0xc300('0x1b')](_0xf4bb21['include'],function(_0x3916a9){return{'model':db[_0x3916a9[_0xc300('0x1d')]],'as':_0x3916a9['as'],'attributes':_0x3916a9[_0xc300('0x19')],'include':_0x3916a9[_0xc300('0x1c')]?_[_0xc300('0x1b')](_0x3916a9['include'],function(_0x3d37eb){return{'model':db[_0x3d37eb[_0xc300('0x1d')]],'as':_0x3d37eb['as'],'attributes':_0x3d37eb[_0xc300('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc300('0xa')](function(_0xfd4149){logger[_0xc300('0xb')]('GetServicenowAccount',_0x2351f3);logger['debug'](_0xc300('0x14'),_0x2351f3,JSON[_0xc300('0x10')](_0xfd4149));_0x1995cf(_0xfd4149);})['catch'](function(_0x24f896){logger[_0xc300('0x11')]('GetServicenowAccount',_0x24f896[_0xc300('0x12')],_0x2351f3);_0x392432(_0x455eeb[_0xc300('0x11')](0x1f4,_0x24f896[_0xc300('0x12')]));});});};exports['ShowServicenowAccount']=function(_0x6a7b63){var _0x378bc4=this;return new Promise(function(_0x35dc9b,_0xf1207){return db[_0xc300('0x15')][_0xc300('0x1e')]({'raw':_0x6a7b63[_0xc300('0x17')]?_0x6a7b63[_0xc300('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x6a7b63[_0xc300('0x17')]?_0x6a7b63['options']['where']||null:null,'attributes':_0x6a7b63[_0xc300('0x17')]?_0x6a7b63[_0xc300('0x17')][_0xc300('0x19')]||null:null,'include':_0x6a7b63[_0xc300('0x17')]?_0x6a7b63[_0xc300('0x17')][_0xc300('0x1c')]?_[_0xc300('0x1b')](_0x6a7b63['options'][_0xc300('0x1c')],function(_0x259c9a){return{'model':db[_0x259c9a[_0xc300('0x1d')]],'as':_0x259c9a['as'],'attributes':_0x259c9a[_0xc300('0x19')],'include':_0x259c9a['include']?_[_0xc300('0x1b')](_0x259c9a[_0xc300('0x1c')],function(_0xb573c4){return{'model':db[_0xb573c4[_0xc300('0x1d')]],'as':_0xb573c4['as'],'attributes':_0xb573c4[_0xc300('0x19')],'include':_0xb573c4[_0xc300('0x1c')]?_[_0xc300('0x1b')](_0xb573c4['include'],function(_0x3f2bf2){return{'model':db[_0x3f2bf2[_0xc300('0x1d')]],'as':_0x3f2bf2['as'],'attributes':_0x3f2bf2[_0xc300('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fe82d){logger['info'](_0xc300('0x1f'),_0x6a7b63);logger[_0xc300('0xd')]('ShowServicenowAccount',_0x6a7b63,JSON['stringify'](_0x4fe82d));_0x35dc9b(_0x4fe82d);})[_0xc300('0x20')](function(_0x54661e){logger[_0xc300('0x11')](_0xc300('0x1f'),_0x54661e['message'],_0x6a7b63);_0xf1207(_0x378bc4[_0xc300('0x11')](0x1f4,_0x54661e[_0xc300('0x12')]));});});}; \ No newline at end of file +var _0x104d=['jayson/promise','client','http','request','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ServicenowAccount,\x20%s,\x20%s','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowServicenowAccount','find','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x104d,0xcb));var _0xd104=function(_0x507403,_0x3f954d){_0x507403=_0x507403-0x0;var _0x1327c=_0x104d[_0x507403];return _0x1327c;};'use strict';var _=require(_0xd104('0x0'));var util=require(_0xd104('0x1'));var moment=require(_0xd104('0x2'));var BPromise=require(_0xd104('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd104('0x4'));var logger=require(_0xd104('0x5'))('rpc');var config=require(_0xd104('0x6'));var jayson=require(_0xd104('0x7'));var client=jayson[_0xd104('0x8')][_0xd104('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x465c60,_0x5071a8,_0x71c70d){return new BPromise(function(_0x275db5,_0x53a39d){return client[_0xd104('0xa')](_0x465c60,_0x71c70d)['then'](function(_0x368907){logger[_0xd104('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x5071a8,'request\x20sent');logger[_0xd104('0xc')](_0xd104('0xd'),_0x5071a8,_0xd104('0xe'),JSON[_0xd104('0xf')](_0x368907));if(_0x368907[_0xd104('0x10')]){if(_0x368907['error']['code']===0x1f4){logger['error'](_0xd104('0x11'),_0x5071a8,_0x368907[_0xd104('0x10')][_0xd104('0x12')]);return _0x53a39d(_0x368907[_0xd104('0x10')][_0xd104('0x12')]);}logger[_0xd104('0x10')](_0xd104('0x11'),_0x5071a8,_0x368907[_0xd104('0x10')][_0xd104('0x12')]);return _0x275db5(_0x368907[_0xd104('0x10')]['message']);}else{logger[_0xd104('0xb')](_0xd104('0x11'),_0x5071a8,_0xd104('0xe'));_0x275db5(_0x368907[_0xd104('0x13')]['message']);}})['catch'](function(_0x2dfa37){logger[_0xd104('0x10')](_0xd104('0x11'),_0x5071a8,_0x2dfa37);_0x53a39d(_0x2dfa37);});});}exports[_0xd104('0x14')]=function(_0x1f6f55){var _0x474a7a=this;return new Promise(function(_0x41d71a,_0x3a3d92){return db[_0xd104('0x15')][_0xd104('0x16')]({'raw':_0x1f6f55[_0xd104('0x17')]?_0x1f6f55[_0xd104('0x17')][_0xd104('0x18')]===undefined?!![]:![]:!![],'where':_0x1f6f55['options']?_0x1f6f55[_0xd104('0x17')][_0xd104('0x19')]||null:null,'attributes':_0x1f6f55['options']?_0x1f6f55[_0xd104('0x17')][_0xd104('0x1a')]||null:null,'limit':_0x1f6f55['options']?_0x1f6f55[_0xd104('0x17')][_0xd104('0x1b')]||null:null,'include':_0x1f6f55['options']?_0x1f6f55[_0xd104('0x17')][_0xd104('0x1c')]?_[_0xd104('0x1d')](_0x1f6f55[_0xd104('0x17')][_0xd104('0x1c')],function(_0x1ca330){return{'model':db[_0x1ca330[_0xd104('0x1e')]],'as':_0x1ca330['as'],'attributes':_0x1ca330['attributes'],'include':_0x1ca330[_0xd104('0x1c')]?_[_0xd104('0x1d')](_0x1ca330['include'],function(_0x284409){return{'model':db[_0x284409['model']],'as':_0x284409['as'],'attributes':_0x284409[_0xd104('0x1a')],'include':_0x284409[_0xd104('0x1c')]?_[_0xd104('0x1d')](_0x284409[_0xd104('0x1c')],function(_0x40ce62){return{'model':db[_0x40ce62[_0xd104('0x1e')]],'as':_0x40ce62['as'],'attributes':_0x40ce62['attributes']};}):[]};}):[]};}):[]:[]})[_0xd104('0x1f')](function(_0x2e7965){logger[_0xd104('0xb')]('GetServicenowAccount',_0x1f6f55);logger[_0xd104('0xc')](_0xd104('0x14'),_0x1f6f55,JSON['stringify'](_0x2e7965));_0x41d71a(_0x2e7965);})['catch'](function(_0x1f863a){logger[_0xd104('0x10')]('GetServicenowAccount',_0x1f863a['message'],_0x1f6f55);_0x3a3d92(_0x474a7a['error'](0x1f4,_0x1f863a[_0xd104('0x12')]));});});};exports[_0xd104('0x20')]=function(_0x6f6fea){var _0x1ce9d6=this;return new Promise(function(_0x12a0c5,_0x1e0f4b){return db[_0xd104('0x15')][_0xd104('0x21')]({'raw':_0x6f6fea[_0xd104('0x17')]?_0x6f6fea[_0xd104('0x17')][_0xd104('0x18')]===undefined?!![]:![]:!![],'where':_0x6f6fea['options']?_0x6f6fea[_0xd104('0x17')][_0xd104('0x19')]||null:null,'attributes':_0x6f6fea[_0xd104('0x17')]?_0x6f6fea['options']['attributes']||null:null,'include':_0x6f6fea['options']?_0x6f6fea[_0xd104('0x17')][_0xd104('0x1c')]?_['map'](_0x6f6fea[_0xd104('0x17')][_0xd104('0x1c')],function(_0x28b336){return{'model':db[_0x28b336[_0xd104('0x1e')]],'as':_0x28b336['as'],'attributes':_0x28b336[_0xd104('0x1a')],'include':_0x28b336[_0xd104('0x1c')]?_[_0xd104('0x1d')](_0x28b336[_0xd104('0x1c')],function(_0x1d0364){return{'model':db[_0x1d0364[_0xd104('0x1e')]],'as':_0x1d0364['as'],'attributes':_0x1d0364[_0xd104('0x1a')],'include':_0x1d0364[_0xd104('0x1c')]?_['map'](_0x1d0364['include'],function(_0x3fd60e){return{'model':db[_0x3fd60e[_0xd104('0x1e')]],'as':_0x3fd60e['as'],'attributes':_0x3fd60e[_0xd104('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b4ff3){logger[_0xd104('0xb')](_0xd104('0x20'),_0x6f6fea);logger[_0xd104('0xc')]('ShowServicenowAccount',_0x6f6fea,JSON[_0xd104('0xf')](_0x5b4ff3));_0x12a0c5(_0x5b4ff3);})[_0xd104('0x22')](function(_0x385c29){logger['error'](_0xd104('0x20'),_0x385c29['message'],_0x6f6fea);_0x1e0f4b(_0x1ce9d6['error'](0x1f4,_0x385c29[_0xd104('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 0fef142..1f58001 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 _0x4ac6=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/subjects','getSubjects','getDescriptions','post','put','destroy','multer','util','path','connect-timeout'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x4ac6,0x10d));var _0x64ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4ac6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x64ac('0x0'));var util=require(_0x64ac('0x1'));var path=require(_0x64ac('0x2'));var timeout=require(_0x64ac('0x3'));var express=require(_0x64ac('0x4'));var router=express[_0x64ac('0x5')]();var auth=require(_0x64ac('0x6'));var interaction=require(_0x64ac('0x7'));var config=require(_0x64ac('0x8'));var controller=require(_0x64ac('0x9'));router[_0x64ac('0xa')]('/',auth['isAuthenticated'](),controller[_0x64ac('0xb')]);router[_0x64ac('0xa')](_0x64ac('0xc'),auth[_0x64ac('0xd')](),controller[_0x64ac('0xe')]);router[_0x64ac('0xa')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x64ac('0xa')](_0x64ac('0xf'),auth[_0x64ac('0xd')](),controller[_0x64ac('0x10')]);router[_0x64ac('0xa')]('/:id/descriptions',auth[_0x64ac('0xd')](),controller[_0x64ac('0x11')]);router[_0x64ac('0x12')]('/',auth[_0x64ac('0xd')](),controller['create']);router[_0x64ac('0x13')]('/:id',auth[_0x64ac('0xd')](),controller['update']);router['delete'](_0x64ac('0xc'),auth[_0x64ac('0xd')](),controller[_0x64ac('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa4ed=['getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x367a13,_0x3c6cd8){var _0x47e09d=function(_0x416905){while(--_0x416905){_0x367a13['push'](_0x367a13['shift']());}};_0x47e09d(++_0x3c6cd8);}(_0xa4ed,0xf0));var _0xda4e=function(_0x3fdf29,_0x53758b){_0x3fdf29=_0x3fdf29-0x0;var _0x11688b=_0xa4ed[_0x3fdf29];return _0x11688b;};'use strict';var multer=require('multer');var util=require(_0xda4e('0x0'));var path=require(_0xda4e('0x1'));var timeout=require(_0xda4e('0x2'));var express=require('express');var router=express[_0xda4e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xda4e('0x4'));var config=require(_0xda4e('0x5'));var controller=require(_0xda4e('0x6'));router[_0xda4e('0x7')]('/',auth[_0xda4e('0x8')](),controller[_0xda4e('0x9')]);router[_0xda4e('0x7')](_0xda4e('0xa'),auth[_0xda4e('0x8')](),controller[_0xda4e('0xb')]);router[_0xda4e('0x7')](_0xda4e('0xc'),auth[_0xda4e('0x8')](),controller[_0xda4e('0xd')]);router[_0xda4e('0x7')](_0xda4e('0xe'),auth[_0xda4e('0x8')](),controller['getSubjects']);router['get'](_0xda4e('0xf'),auth['isAuthenticated'](),controller[_0xda4e('0x10')]);router['post']('/',auth[_0xda4e('0x8')](),controller[_0xda4e('0x11')]);router[_0xda4e('0x12')](_0xda4e('0xa'),auth[_0xda4e('0x8')](),controller[_0xda4e('0x13')]);router[_0xda4e('0x14')](_0xda4e('0xa'),auth[_0xda4e('0x8')](),controller[_0xda4e('0x15')]);module[_0xda4e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 90cc907..5619d09 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 _0xc749=['STRING','sequelize','exports'];(function(_0x119e6a,_0x12172a){var _0x1ec5d7=function(_0x2f6e9a){while(--_0x2f6e9a){_0x119e6a['push'](_0x119e6a['shift']());}};_0x1ec5d7(++_0x12172a);}(_0xc749,0x94));var _0x9c74=function(_0x2e2ae4,_0xa2167f){_0x2e2ae4=_0x2e2ae4-0x0;var _0x1867af=_0xc749[_0x2e2ae4];return _0x1867af;};'use strict';var Sequelize=require(_0x9c74('0x0'));module[_0x9c74('0x1')]={'name':{'type':Sequelize[_0x9c74('0x2')]},'description':{'type':Sequelize[_0x9c74('0x2')]}}; \ No newline at end of file +var _0x9ace=['exports','STRING','sequelize'];(function(_0x11ce3f,_0x3a2562){var _0x50c165=function(_0x584924){while(--_0x584924){_0x11ce3f['push'](_0x11ce3f['shift']());}};_0x50c165(++_0x3a2562);}(_0x9ace,0x125));var _0xe9ac=function(_0x7600ed,_0x268305){_0x7600ed=_0x7600ed-0x0;var _0x348504=_0x9ace[_0x7600ed];return _0x348504;};'use strict';var Sequelize=require(_0xe9ac('0x0'));module[_0xe9ac('0x1')]={'name':{'type':Sequelize[_0xe9ac('0x2')]},'description':{'type':Sequelize[_0xe9ac('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index dbcdb84..8e5dade 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 _0xe397=['filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','count','includeAll','findAll','rows','show','params','rawAttributes','include','merge','find','create','body','getFields','findOne','length','order','getSubjects','ServicenowField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','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','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','end','status','offset','limit','set','json','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map','ServicenowConfiguration','type','key','model','query','keys'];(function(_0x441c0b,_0x22186b){var _0x46457d=function(_0xf6d43b){while(--_0xf6d43b){_0x441c0b['push'](_0x441c0b['shift']());}};_0x46457d(++_0x22186b);}(_0xe397,0x80));var _0x7e39=function(_0x32b122,_0x1ad490){_0x32b122=_0x32b122-0x0;var _0x4ad25a=_0xe397[_0x32b122];return _0x4ad25a;};'use strict';var pdf=require(_0x7e39('0x0'));var emlformat=require(_0x7e39('0x1'));var rimraf=require(_0x7e39('0x2'));var zipdir=require(_0x7e39('0x3'));var jsonpatch=require(_0x7e39('0x4'));var rp=require(_0x7e39('0x5'));var moment=require(_0x7e39('0x6'));var BPromise=require(_0x7e39('0x7'));var Mustache=require(_0x7e39('0x8'));var util=require(_0x7e39('0x9'));var path=require('path');var sox=require(_0x7e39('0xa'));var csv=require(_0x7e39('0xb'));var ejs=require(_0x7e39('0xc'));var fs=require('fs');var _=require(_0x7e39('0xd'));var squel=require('squel');var crypto=require(_0x7e39('0xe'));var jsforce=require(_0x7e39('0xf'));var deskjs=require(_0x7e39('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7e39('0x11'));var Papa=require(_0x7e39('0x12'));var Redis=require('ioredis');var authService=require(_0x7e39('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7e39('0x14'));var hardwareService=require(_0x7e39('0x15'));var logger=require(_0x7e39('0x16'))(_0x7e39('0x17'));var utils=require(_0x7e39('0x18'));var config=require(_0x7e39('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7e39('0x1a'));var client=jayson[_0x7e39('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x433489,_0x2a2f02,_0x36d5f7){if(_0x36d5f7){var _0x32acdb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x32acdb[_0x7e39('0x1c')](_0x2a2f02)){return _0x433489;}else{throw new db[(_0x7e39('0x1d'))]['ValidationError'](_0x7e39('0x1e'));}}else{return _0x433489;}}function respondWithRpcPromise(_0x583d96,_0x2c4223,_0x1b5855,_0x5dc2c9){return new BPromise(function(_0x2e8a77,_0x4e259d){var _0x5046b8=_0x5dc2c9||client;return _0x5046b8[_0x7e39('0x1f')](_0x583d96,_0x1b5855)['then'](function(_0x92c58f){logger[_0x7e39('0x20')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2c4223,_0x7e39('0x21'));logger[_0x7e39('0x22')](_0x7e39('0x23'),_0x2c4223,_0x7e39('0x21'),JSON[_0x7e39('0x24')](_0x92c58f));if(_0x92c58f[_0x7e39('0x25')]){if(_0x92c58f['error'][_0x7e39('0x26')]===0x1f4){logger['error'](_0x7e39('0x27'),_0x2c4223,_0x92c58f[_0x7e39('0x25')][_0x7e39('0x28')]);return _0x4e259d(_0x92c58f[_0x7e39('0x25')][_0x7e39('0x28')]);}logger['error'](_0x7e39('0x27'),_0x2c4223,_0x92c58f[_0x7e39('0x25')][_0x7e39('0x28')]);return _0x2e8a77(_0x92c58f['error']['message']);}else{logger[_0x7e39('0x20')](_0x7e39('0x27'),_0x2c4223,'request\x20sent');_0x2e8a77(_0x92c58f[_0x7e39('0x29')][_0x7e39('0x28')]);}})[_0x7e39('0x2a')](function(_0x18710d){logger[_0x7e39('0x25')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2c4223,_0x18710d);_0x4e259d(_0x18710d);});});}function respondWithStatusCode(_0x1f51db,_0x587c64){_0x587c64=_0x587c64||0xcc;return function(_0x30286c){if(_0x30286c){return _0x1f51db['sendStatus'](_0x587c64);}return _0x1f51db['status'](_0x587c64)[_0x7e39('0x2b')]();};}function respondWithResult(_0x3bc94c,_0x96a192){_0x96a192=_0x96a192||0xc8;return function(_0x528800){if(_0x528800){return _0x3bc94c[_0x7e39('0x2c')](_0x96a192)['json'](_0x528800);}};}function respondWithFilteredResult(_0x23ae11,_0x521282){return function(_0x32202c){if(_0x32202c){var _0x5c3bd7=_0x32202c['count'],_0x1956ec=_0x521282[_0x7e39('0x2d')],_0x3e6e46=_0x521282[_0x7e39('0x2d')]+_0x521282[_0x7e39('0x2e')],_0x484fc3;if(_0x3e6e46>=_0x5c3bd7){_0x3e6e46=_0x5c3bd7;_0x484fc3=0xc8;}else{_0x484fc3=0xce;}_0x23ae11[_0x7e39('0x2c')](_0x484fc3);return _0x23ae11[_0x7e39('0x2f')]('Content-Range',_0x1956ec+'-'+_0x3e6e46+'/'+_0x5c3bd7)[_0x7e39('0x30')](_0x32202c);}return null;};}function patchUpdates(_0x54b3da){return function(_0x3e4bfa){try{jsonpatch[_0x7e39('0x31')](_0x3e4bfa,_0x54b3da,!![]);}catch(_0x27599d){return BPromise[_0x7e39('0x32')](_0x27599d);}return _0x3e4bfa['save']();};}function saveUpdates(_0x7d5c07,_0x5bf503){return function(_0x24be7e){if(_0x24be7e){return _0x24be7e[_0x7e39('0x33')](_0x7d5c07)[_0x7e39('0x34')](function(_0x3d3ff7){return _0x3d3ff7;});}return null;};}function removeEntity(_0x1ec99e,_0x1ae767){return function(_0x202051){if(_0x202051){return _0x202051[_0x7e39('0x35')]()['then'](function(){_0x1ec99e[_0x7e39('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f711d,_0x262468){return function(_0x48d3f8){if(!_0x48d3f8){_0x3f711d[_0x7e39('0x36')](0x194);}return _0x48d3f8;};}function handleError(_0x4cdc8a,_0x4de6ac){_0x4de6ac=_0x4de6ac||0x1f4;return function(_0x110b17){logger['error'](_0x110b17[_0x7e39('0x37')]);if(_0x110b17[_0x7e39('0x38')]){delete _0x110b17['name'];}_0x4cdc8a[_0x7e39('0x2c')](_0x4de6ac)[_0x7e39('0x39')](_0x110b17);};}exports[_0x7e39('0x3a')]=function(_0x309d6c,_0x4bdbc3){var _0xa10d57={},_0x16e7fa={},_0x433193={'count':0x0,'rows':[]};var _0x1556d3=_[_0x7e39('0x3b')](db[_0x7e39('0x3c')]['rawAttributes'],function(_0x8208b6){return{'name':_0x8208b6['fieldName'],'type':_0x8208b6[_0x7e39('0x3d')][_0x7e39('0x3e')]};});_0x16e7fa[_0x7e39('0x3f')]=_[_0x7e39('0x3b')](_0x1556d3,_0x7e39('0x38'));_0x16e7fa[_0x7e39('0x40')]=_[_0x7e39('0x41')](_0x309d6c[_0x7e39('0x40')]);_0x16e7fa[_0x7e39('0x42')]=_[_0x7e39('0x43')](_0x16e7fa[_0x7e39('0x3f')],_0x16e7fa[_0x7e39('0x40')]);_0xa10d57['attributes']=_[_0x7e39('0x43')](_0x16e7fa['model'],qs[_0x7e39('0x44')](_0x309d6c[_0x7e39('0x40')]['fields']));_0xa10d57['attributes']=_0xa10d57[_0x7e39('0x45')]['length']?_0xa10d57['attributes']:_0x16e7fa[_0x7e39('0x3f')];if(!_0x309d6c[_0x7e39('0x40')][_0x7e39('0x46')](_0x7e39('0x47'))){_0xa10d57[_0x7e39('0x2e')]=qs['limit'](_0x309d6c[_0x7e39('0x40')][_0x7e39('0x2e')]);_0xa10d57[_0x7e39('0x2d')]=qs[_0x7e39('0x2d')](_0x309d6c[_0x7e39('0x40')]['offset']);}_0xa10d57['order']=qs[_0x7e39('0x48')](_0x309d6c[_0x7e39('0x40')][_0x7e39('0x48')]);_0xa10d57[_0x7e39('0x49')]=qs[_0x7e39('0x42')](_[_0x7e39('0x4a')](_0x309d6c['query'],_0x16e7fa[_0x7e39('0x42')]));if(_0x309d6c[_0x7e39('0x40')][_0x7e39('0x4b')]){_0xa10d57[_0x7e39('0x49')]=_['merge'](_0xa10d57['where'],{'$or':_['map'](_0x1556d3,function(_0x12708a){if(_0x12708a[_0x7e39('0x3d')]!==_0x7e39('0x4c')){var _0x2b2b49={};_0x2b2b49[_0x12708a['name']]={'$like':'%'+_0x309d6c[_0x7e39('0x40')][_0x7e39('0x4b')]+'%'};return _0x2b2b49;}})});}_0xa10d57=_['merge']({},_0xa10d57,_0x309d6c[_0x7e39('0x4d')]);var _0x51094a={'where':_0xa10d57[_0x7e39('0x49')]};return db[_0x7e39('0x3c')][_0x7e39('0x4e')](_0x51094a)[_0x7e39('0x34')](function(_0x2344b0){_0x433193['count']=_0x2344b0;if(_0x309d6c[_0x7e39('0x40')][_0x7e39('0x4f')]){_0xa10d57['include']=[{'all':!![]}];}return db[_0x7e39('0x3c')][_0x7e39('0x50')](_0xa10d57);})[_0x7e39('0x34')](function(_0x354897){_0x433193[_0x7e39('0x51')]=_0x354897;return _0x433193;})[_0x7e39('0x34')](respondWithFilteredResult(_0x4bdbc3,_0xa10d57))[_0x7e39('0x2a')](handleError(_0x4bdbc3,null));};exports[_0x7e39('0x52')]=function(_0x328527,_0x36067f){var _0x2a469f={'raw':![],'where':{'id':_0x328527[_0x7e39('0x53')]['id']}},_0x83cc41={};_0x83cc41[_0x7e39('0x3f')]=_[_0x7e39('0x41')](db[_0x7e39('0x3c')][_0x7e39('0x54')]);_0x83cc41[_0x7e39('0x40')]=_[_0x7e39('0x41')](_0x328527[_0x7e39('0x40')]);_0x83cc41[_0x7e39('0x42')]=_['intersection'](_0x83cc41['model'],_0x83cc41[_0x7e39('0x40')]);_0x2a469f[_0x7e39('0x45')]=_[_0x7e39('0x43')](_0x83cc41[_0x7e39('0x3f')],qs[_0x7e39('0x44')](_0x328527[_0x7e39('0x40')][_0x7e39('0x44')]));_0x2a469f[_0x7e39('0x45')]=_0x2a469f[_0x7e39('0x45')]['length']?_0x2a469f[_0x7e39('0x45')]:_0x83cc41[_0x7e39('0x3f')];if(_0x328527[_0x7e39('0x40')][_0x7e39('0x4f')]){_0x2a469f[_0x7e39('0x55')]=[{'all':!![]}];}_0x2a469f=_[_0x7e39('0x56')]({},_0x2a469f,_0x328527['options']);return db[_0x7e39('0x3c')][_0x7e39('0x57')](_0x2a469f)[_0x7e39('0x34')](handleEntityNotFound(_0x36067f,null))[_0x7e39('0x34')](respondWithResult(_0x36067f,null))[_0x7e39('0x2a')](handleError(_0x36067f,null));};exports[_0x7e39('0x58')]=function(_0xe942da,_0x199944){return db[_0x7e39('0x3c')][_0x7e39('0x58')](_0xe942da[_0x7e39('0x59')],{})[_0x7e39('0x34')](respondWithResult(_0x199944,0xc9))[_0x7e39('0x2a')](handleError(_0x199944,null));};exports[_0x7e39('0x33')]=function(_0x4095e8,_0x34ca3b){if(_0x4095e8[_0x7e39('0x59')]['id']){delete _0x4095e8[_0x7e39('0x59')]['id'];}return db[_0x7e39('0x3c')][_0x7e39('0x57')]({'where':{'id':_0x4095e8['params']['id']}})['then'](handleEntityNotFound(_0x34ca3b,null))[_0x7e39('0x34')](saveUpdates(_0x4095e8[_0x7e39('0x59')],null))[_0x7e39('0x34')](respondWithResult(_0x34ca3b,null))[_0x7e39('0x2a')](handleError(_0x34ca3b,null));};exports[_0x7e39('0x35')]=function(_0x7265ce,_0xd56ed1){return db['ServicenowConfiguration']['find']({'where':{'id':_0x7265ce[_0x7e39('0x53')]['id']}})[_0x7e39('0x34')](handleEntityNotFound(_0xd56ed1,null))[_0x7e39('0x34')](removeEntity(_0xd56ed1,null))[_0x7e39('0x2a')](handleError(_0xd56ed1,null));};exports[_0x7e39('0x5a')]=function(_0x1297ff,_0x38ba91,_0x546283){var _0x5cae22={};var _0x20a707={};var _0x2677a0;var _0x2ba467;return db[_0x7e39('0x3c')][_0x7e39('0x5b')]({'where':{'id':_0x1297ff[_0x7e39('0x53')]['id']}})[_0x7e39('0x34')](handleEntityNotFound(_0x38ba91,null))[_0x7e39('0x34')](function(_0x32ba57){if(_0x32ba57){_0x2677a0=_0x32ba57;_0x20a707[_0x7e39('0x3f')]=_[_0x7e39('0x41')](db['ServicenowField'][_0x7e39('0x54')]);_0x20a707[_0x7e39('0x40')]=_[_0x7e39('0x41')](_0x1297ff['query']);_0x20a707[_0x7e39('0x42')]=_[_0x7e39('0x43')](_0x20a707[_0x7e39('0x3f')],_0x20a707['query']);_0x5cae22[_0x7e39('0x45')]=_[_0x7e39('0x43')](_0x20a707[_0x7e39('0x3f')],qs[_0x7e39('0x44')](_0x1297ff[_0x7e39('0x40')][_0x7e39('0x44')]));_0x5cae22['attributes']=_0x5cae22['attributes'][_0x7e39('0x5c')]?_0x5cae22[_0x7e39('0x45')]:_0x20a707['model'];_0x5cae22[_0x7e39('0x5d')]=qs['sort'](_0x1297ff[_0x7e39('0x40')]['sort']);_0x5cae22[_0x7e39('0x49')]=qs['filters'](_['pick'](_0x1297ff[_0x7e39('0x40')],_0x20a707['filters']));if(_0x1297ff[_0x7e39('0x40')][_0x7e39('0x4b')]){_0x5cae22[_0x7e39('0x49')]=_[_0x7e39('0x56')](_0x5cae22[_0x7e39('0x49')],{'$or':_[_0x7e39('0x3b')](_0x5cae22['attributes'],function(_0x540ecc){var _0x31d0db={};_0x31d0db[_0x540ecc]={'$like':'%'+_0x1297ff[_0x7e39('0x40')][_0x7e39('0x4b')]+'%'};return _0x31d0db;})});}_0x5cae22=_[_0x7e39('0x56')]({},_0x5cae22,_0x1297ff['options']);return _0x2677a0[_0x7e39('0x5a')](_0x5cae22);}})[_0x7e39('0x34')](function(_0xe41b80){if(_0xe41b80){_0x2ba467=_0xe41b80[_0x7e39('0x5c')];if(!_0x1297ff[_0x7e39('0x40')][_0x7e39('0x46')]('nolimit')){_0x5cae22['limit']=qs[_0x7e39('0x2e')](_0x1297ff[_0x7e39('0x40')][_0x7e39('0x2e')]);_0x5cae22[_0x7e39('0x2d')]=qs[_0x7e39('0x2d')](_0x1297ff[_0x7e39('0x40')][_0x7e39('0x2d')]);}return _0x2677a0['getFields'](_0x5cae22);}})['then'](function(_0x180577){if(_0x180577){return _0x180577?{'count':_0x2ba467,'rows':_0x180577}:null;}})[_0x7e39('0x34')](respondWithResult(_0x38ba91,null))['catch'](handleError(_0x38ba91,null));};exports[_0x7e39('0x5e')]=function(_0x2b380d,_0x2540a3,_0x358bc0){var _0x5f2290={};var _0x51d9f2={};var _0x5d57d4;var _0x460690;return db[_0x7e39('0x3c')][_0x7e39('0x5b')]({'where':{'id':_0x2b380d[_0x7e39('0x53')]['id']}})[_0x7e39('0x34')](handleEntityNotFound(_0x2540a3,null))['then'](function(_0x578f61){if(_0x578f61){_0x5d57d4=_0x578f61;_0x51d9f2[_0x7e39('0x3f')]=_[_0x7e39('0x41')](db[_0x7e39('0x5f')][_0x7e39('0x54')]);_0x51d9f2[_0x7e39('0x40')]=_['keys'](_0x2b380d[_0x7e39('0x40')]);_0x51d9f2[_0x7e39('0x42')]=_[_0x7e39('0x43')](_0x51d9f2['model'],_0x51d9f2[_0x7e39('0x40')]);_0x5f2290[_0x7e39('0x45')]=_[_0x7e39('0x43')](_0x51d9f2['model'],qs[_0x7e39('0x44')](_0x2b380d[_0x7e39('0x40')][_0x7e39('0x44')]));_0x5f2290[_0x7e39('0x45')]=_0x5f2290['attributes']['length']?_0x5f2290['attributes']:_0x51d9f2[_0x7e39('0x3f')];_0x5f2290['order']=qs[_0x7e39('0x48')](_0x2b380d[_0x7e39('0x40')][_0x7e39('0x48')]);_0x5f2290[_0x7e39('0x49')]=qs[_0x7e39('0x42')](_[_0x7e39('0x4a')](_0x2b380d[_0x7e39('0x40')],_0x51d9f2['filters']));if(_0x2b380d['query'][_0x7e39('0x4b')]){_0x5f2290[_0x7e39('0x49')]=_[_0x7e39('0x56')](_0x5f2290[_0x7e39('0x49')],{'$or':_[_0x7e39('0x3b')](_0x5f2290[_0x7e39('0x45')],function(_0xe4e00f){var _0x1d2a71={};_0x1d2a71[_0xe4e00f]={'$like':'%'+_0x2b380d[_0x7e39('0x40')]['filter']+'%'};return _0x1d2a71;})});}_0x5f2290=_['merge']({},_0x5f2290,_0x2b380d[_0x7e39('0x4d')]);return _0x5d57d4[_0x7e39('0x5e')](_0x5f2290);}})[_0x7e39('0x34')](function(_0x170f53){if(_0x170f53){_0x460690=_0x170f53['length'];if(!_0x2b380d['query'][_0x7e39('0x46')](_0x7e39('0x47'))){_0x5f2290[_0x7e39('0x2e')]=qs['limit'](_0x2b380d[_0x7e39('0x40')][_0x7e39('0x2e')]);_0x5f2290[_0x7e39('0x2d')]=qs['offset'](_0x2b380d[_0x7e39('0x40')]['offset']);}return _0x5d57d4[_0x7e39('0x5e')](_0x5f2290);}})[_0x7e39('0x34')](function(_0x4017fc){if(_0x4017fc){return _0x4017fc?{'count':_0x460690,'rows':_0x4017fc}:null;}})[_0x7e39('0x34')](respondWithResult(_0x2540a3,null))['catch'](handleError(_0x2540a3,null));};exports['getDescriptions']=function(_0x21ab02,_0x316a06,_0x4ec64b){var _0x422e43={};var _0x335c05={};var _0x3cb27a;var _0x56c496;return db[_0x7e39('0x3c')][_0x7e39('0x5b')]({'where':{'id':_0x21ab02[_0x7e39('0x53')]['id']}})[_0x7e39('0x34')](handleEntityNotFound(_0x316a06,null))[_0x7e39('0x34')](function(_0x2a9e87){if(_0x2a9e87){_0x3cb27a=_0x2a9e87;_0x335c05[_0x7e39('0x3f')]=_[_0x7e39('0x41')](db[_0x7e39('0x5f')][_0x7e39('0x54')]);_0x335c05['query']=_['keys'](_0x21ab02[_0x7e39('0x40')]);_0x335c05[_0x7e39('0x42')]=_[_0x7e39('0x43')](_0x335c05[_0x7e39('0x3f')],_0x335c05[_0x7e39('0x40')]);_0x422e43[_0x7e39('0x45')]=_[_0x7e39('0x43')](_0x335c05['model'],qs[_0x7e39('0x44')](_0x21ab02['query'][_0x7e39('0x44')]));_0x422e43[_0x7e39('0x45')]=_0x422e43['attributes'][_0x7e39('0x5c')]?_0x422e43[_0x7e39('0x45')]:_0x335c05[_0x7e39('0x3f')];_0x422e43['order']=qs[_0x7e39('0x48')](_0x21ab02[_0x7e39('0x40')][_0x7e39('0x48')]);_0x422e43[_0x7e39('0x49')]=qs['filters'](_[_0x7e39('0x4a')](_0x21ab02[_0x7e39('0x40')],_0x335c05[_0x7e39('0x42')]));if(_0x21ab02['query'][_0x7e39('0x4b')]){_0x422e43[_0x7e39('0x49')]=_[_0x7e39('0x56')](_0x422e43[_0x7e39('0x49')],{'$or':_[_0x7e39('0x3b')](_0x422e43[_0x7e39('0x45')],function(_0x575dde){var _0x5b8b5b={};_0x5b8b5b[_0x575dde]={'$like':'%'+_0x21ab02[_0x7e39('0x40')][_0x7e39('0x4b')]+'%'};return _0x5b8b5b;})});}_0x422e43=_[_0x7e39('0x56')]({},_0x422e43,_0x21ab02[_0x7e39('0x4d')]);return _0x3cb27a[_0x7e39('0x60')](_0x422e43);}})['then'](function(_0x37a185){if(_0x37a185){_0x56c496=_0x37a185['length'];if(!_0x21ab02[_0x7e39('0x40')][_0x7e39('0x46')]('nolimit')){_0x422e43[_0x7e39('0x2e')]=qs[_0x7e39('0x2e')](_0x21ab02['query'][_0x7e39('0x2e')]);_0x422e43[_0x7e39('0x2d')]=qs['offset'](_0x21ab02['query']['offset']);}return _0x3cb27a['getDescriptions'](_0x422e43);}})[_0x7e39('0x34')](function(_0x31ccb9){if(_0x31ccb9){return _0x31ccb9?{'count':_0x56c496,'rows':_0x31ccb9}:null;}})['then'](respondWithResult(_0x316a06,null))[_0x7e39('0x2a')](handleError(_0x316a06,null));}; \ No newline at end of file +var _0xf1a8=['set','Content-Range','apply','reject','update','then','destroy','stack','name','map','ServicenowConfiguration','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','count','include','findAll','show','params','includeAll','find','create','body','getFields','findOne','ServicenowField','order','pick','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','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','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','end','json','offset','limit'];(function(_0x810c8d,_0x59f706){var _0x1f8fd9=function(_0x6b06b5){while(--_0x6b06b5){_0x810c8d['push'](_0x810c8d['shift']());}};_0x1f8fd9(++_0x59f706);}(_0xf1a8,0xdf));var _0x8f1a=function(_0x3afe3c,_0x3429a6){_0x3afe3c=_0x3afe3c-0x0;var _0x70e78f=_0xf1a8[_0x3afe3c];return _0x70e78f;};'use strict';var pdf=require(_0x8f1a('0x0'));var emlformat=require(_0x8f1a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8f1a('0x2'));var jsonpatch=require(_0x8f1a('0x3'));var rp=require('request-promise');var moment=require(_0x8f1a('0x4'));var BPromise=require(_0x8f1a('0x5'));var Mustache=require(_0x8f1a('0x6'));var util=require(_0x8f1a('0x7'));var path=require(_0x8f1a('0x8'));var sox=require(_0x8f1a('0x9'));var csv=require(_0x8f1a('0xa'));var ejs=require(_0x8f1a('0xb'));var fs=require('fs');var _=require(_0x8f1a('0xc'));var squel=require(_0x8f1a('0xd'));var crypto=require(_0x8f1a('0xe'));var jsforce=require(_0x8f1a('0xf'));var deskjs=require(_0x8f1a('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8f1a('0x11'));var as=require(_0x8f1a('0x12'));var hardwareService=require(_0x8f1a('0x13'));var logger=require(_0x8f1a('0x14'))(_0x8f1a('0x15'));var utils=require('../../config/utils');var config=require(_0x8f1a('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x8f1a('0x17'));var client=jayson[_0x8f1a('0x18')][_0x8f1a('0x19')]({'port':0x232a});function checkPasswordPattern(_0x1515df,_0x434313,_0x42aed5){if(_0x42aed5){var _0x5ae142=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5ae142[_0x8f1a('0x1a')](_0x434313)){return _0x1515df;}else{throw new db[(_0x8f1a('0x1b'))]['ValidationError'](_0x8f1a('0x1c'));}}else{return _0x1515df;}}function respondWithRpcPromise(_0x7780b4,_0xb563f,_0x2a967d,_0x36ea43){return new BPromise(function(_0x3aac9d,_0x15a49f){var _0x3647b3=_0x36ea43||client;return _0x3647b3[_0x8f1a('0x1d')](_0x7780b4,_0x2a967d)['then'](function(_0x5f4a76){logger['info'](_0x8f1a('0x1e'),_0xb563f,_0x8f1a('0x1f'));logger['debug'](_0x8f1a('0x20'),_0xb563f,'request\x20sent',JSON[_0x8f1a('0x21')](_0x5f4a76));if(_0x5f4a76[_0x8f1a('0x22')]){if(_0x5f4a76[_0x8f1a('0x22')][_0x8f1a('0x23')]===0x1f4){logger[_0x8f1a('0x22')](_0x8f1a('0x1e'),_0xb563f,_0x5f4a76['error'][_0x8f1a('0x24')]);return _0x15a49f(_0x5f4a76['error'][_0x8f1a('0x24')]);}logger[_0x8f1a('0x22')](_0x8f1a('0x1e'),_0xb563f,_0x5f4a76['error']['message']);return _0x3aac9d(_0x5f4a76[_0x8f1a('0x22')][_0x8f1a('0x24')]);}else{logger[_0x8f1a('0x25')](_0x8f1a('0x1e'),_0xb563f,_0x8f1a('0x1f'));_0x3aac9d(_0x5f4a76['result']['message']);}})[_0x8f1a('0x26')](function(_0x1345a3){logger['error'](_0x8f1a('0x1e'),_0xb563f,_0x1345a3);_0x15a49f(_0x1345a3);});});}function respondWithStatusCode(_0x4f3cad,_0x519a52){_0x519a52=_0x519a52||0xcc;return function(_0xf8b30b){if(_0xf8b30b){return _0x4f3cad['sendStatus'](_0x519a52);}return _0x4f3cad[_0x8f1a('0x27')](_0x519a52)[_0x8f1a('0x28')]();};}function respondWithResult(_0x3dbaf8,_0x490599){_0x490599=_0x490599||0xc8;return function(_0x556cc9){if(_0x556cc9){return _0x3dbaf8[_0x8f1a('0x27')](_0x490599)[_0x8f1a('0x29')](_0x556cc9);}};}function respondWithFilteredResult(_0x2729bf,_0x166262){return function(_0x431b3e){if(_0x431b3e){var _0x45f098=_0x431b3e['count'],_0x12489b=_0x166262[_0x8f1a('0x2a')],_0x3e4fb5=_0x166262[_0x8f1a('0x2a')]+_0x166262[_0x8f1a('0x2b')],_0x4a00c1;if(_0x3e4fb5>=_0x45f098){_0x3e4fb5=_0x45f098;_0x4a00c1=0xc8;}else{_0x4a00c1=0xce;}_0x2729bf[_0x8f1a('0x27')](_0x4a00c1);return _0x2729bf[_0x8f1a('0x2c')](_0x8f1a('0x2d'),_0x12489b+'-'+_0x3e4fb5+'/'+_0x45f098)[_0x8f1a('0x29')](_0x431b3e);}return null;};}function patchUpdates(_0x2ee445){return function(_0x4010c2){try{jsonpatch[_0x8f1a('0x2e')](_0x4010c2,_0x2ee445,!![]);}catch(_0x118b86){return BPromise[_0x8f1a('0x2f')](_0x118b86);}return _0x4010c2['save']();};}function saveUpdates(_0x15d291,_0x48578e){return function(_0x5b7303){if(_0x5b7303){return _0x5b7303[_0x8f1a('0x30')](_0x15d291)[_0x8f1a('0x31')](function(_0x146571){return _0x146571;});}return null;};}function removeEntity(_0x3be451,_0x5ea317){return function(_0x5ca228){if(_0x5ca228){return _0x5ca228[_0x8f1a('0x32')]()[_0x8f1a('0x31')](function(){_0x3be451[_0x8f1a('0x27')](0xcc)[_0x8f1a('0x28')]();});}};}function handleEntityNotFound(_0x2b59bb,_0x69fac0){return function(_0x58d414){if(!_0x58d414){_0x2b59bb['sendStatus'](0x194);}return _0x58d414;};}function handleError(_0x24c216,_0x314a7c){_0x314a7c=_0x314a7c||0x1f4;return function(_0x4e2f6c){logger[_0x8f1a('0x22')](_0x4e2f6c[_0x8f1a('0x33')]);if(_0x4e2f6c[_0x8f1a('0x34')]){delete _0x4e2f6c[_0x8f1a('0x34')];}_0x24c216['status'](_0x314a7c)['send'](_0x4e2f6c);};}exports['index']=function(_0x535969,_0x2da6d1){var _0x8d6aee={},_0x562f94={},_0x3e297e={'count':0x0,'rows':[]};var _0x1fc6ab=_[_0x8f1a('0x35')](db[_0x8f1a('0x36')][_0x8f1a('0x37')],function(_0x44ed01){return{'name':_0x44ed01['fieldName'],'type':_0x44ed01[_0x8f1a('0x38')]['key']};});_0x562f94[_0x8f1a('0x39')]=_[_0x8f1a('0x35')](_0x1fc6ab,_0x8f1a('0x34'));_0x562f94[_0x8f1a('0x3a')]=_[_0x8f1a('0x3b')](_0x535969[_0x8f1a('0x3a')]);_0x562f94['filters']=_[_0x8f1a('0x3c')](_0x562f94[_0x8f1a('0x39')],_0x562f94[_0x8f1a('0x3a')]);_0x8d6aee[_0x8f1a('0x3d')]=_[_0x8f1a('0x3c')](_0x562f94['model'],qs[_0x8f1a('0x3e')](_0x535969[_0x8f1a('0x3a')][_0x8f1a('0x3e')]));_0x8d6aee[_0x8f1a('0x3d')]=_0x8d6aee[_0x8f1a('0x3d')][_0x8f1a('0x3f')]?_0x8d6aee[_0x8f1a('0x3d')]:_0x562f94[_0x8f1a('0x39')];if(!_0x535969[_0x8f1a('0x3a')][_0x8f1a('0x40')](_0x8f1a('0x41'))){_0x8d6aee['limit']=qs[_0x8f1a('0x2b')](_0x535969[_0x8f1a('0x3a')][_0x8f1a('0x2b')]);_0x8d6aee[_0x8f1a('0x2a')]=qs[_0x8f1a('0x2a')](_0x535969[_0x8f1a('0x3a')]['offset']);}_0x8d6aee['order']=qs[_0x8f1a('0x42')](_0x535969[_0x8f1a('0x3a')]['sort']);_0x8d6aee['where']=qs['filters'](_['pick'](_0x535969[_0x8f1a('0x3a')],_0x562f94[_0x8f1a('0x43')]));if(_0x535969[_0x8f1a('0x3a')][_0x8f1a('0x44')]){_0x8d6aee[_0x8f1a('0x45')]=_[_0x8f1a('0x46')](_0x8d6aee[_0x8f1a('0x45')],{'$or':_[_0x8f1a('0x35')](_0x1fc6ab,function(_0x1a56d9){if(_0x1a56d9['type']!==_0x8f1a('0x47')){var _0x5531e0={};_0x5531e0[_0x1a56d9[_0x8f1a('0x34')]]={'$like':'%'+_0x535969[_0x8f1a('0x3a')][_0x8f1a('0x44')]+'%'};return _0x5531e0;}})});}_0x8d6aee=_[_0x8f1a('0x46')]({},_0x8d6aee,_0x535969[_0x8f1a('0x48')]);var _0x331604={'where':_0x8d6aee['where']};return db[_0x8f1a('0x36')]['count'](_0x331604)[_0x8f1a('0x31')](function(_0x4bdfb8){_0x3e297e[_0x8f1a('0x49')]=_0x4bdfb8;if(_0x535969[_0x8f1a('0x3a')]['includeAll']){_0x8d6aee[_0x8f1a('0x4a')]=[{'all':!![]}];}return db[_0x8f1a('0x36')][_0x8f1a('0x4b')](_0x8d6aee);})[_0x8f1a('0x31')](function(_0x4be731){_0x3e297e['rows']=_0x4be731;return _0x3e297e;})[_0x8f1a('0x31')](respondWithFilteredResult(_0x2da6d1,_0x8d6aee))[_0x8f1a('0x26')](handleError(_0x2da6d1,null));};exports[_0x8f1a('0x4c')]=function(_0x12babd,_0x2974b9){var _0x1c7856={'raw':![],'where':{'id':_0x12babd[_0x8f1a('0x4d')]['id']}},_0x5b2aeb={};_0x5b2aeb[_0x8f1a('0x39')]=_['keys'](db[_0x8f1a('0x36')][_0x8f1a('0x37')]);_0x5b2aeb[_0x8f1a('0x3a')]=_[_0x8f1a('0x3b')](_0x12babd['query']);_0x5b2aeb['filters']=_[_0x8f1a('0x3c')](_0x5b2aeb[_0x8f1a('0x39')],_0x5b2aeb[_0x8f1a('0x3a')]);_0x1c7856[_0x8f1a('0x3d')]=_[_0x8f1a('0x3c')](_0x5b2aeb[_0x8f1a('0x39')],qs[_0x8f1a('0x3e')](_0x12babd[_0x8f1a('0x3a')][_0x8f1a('0x3e')]));_0x1c7856['attributes']=_0x1c7856['attributes'][_0x8f1a('0x3f')]?_0x1c7856[_0x8f1a('0x3d')]:_0x5b2aeb[_0x8f1a('0x39')];if(_0x12babd['query'][_0x8f1a('0x4e')]){_0x1c7856[_0x8f1a('0x4a')]=[{'all':!![]}];}_0x1c7856=_[_0x8f1a('0x46')]({},_0x1c7856,_0x12babd[_0x8f1a('0x48')]);return db[_0x8f1a('0x36')][_0x8f1a('0x4f')](_0x1c7856)['then'](handleEntityNotFound(_0x2974b9,null))['then'](respondWithResult(_0x2974b9,null))[_0x8f1a('0x26')](handleError(_0x2974b9,null));};exports[_0x8f1a('0x50')]=function(_0x128064,_0x5691c2){return db['ServicenowConfiguration'][_0x8f1a('0x50')](_0x128064[_0x8f1a('0x51')],{})['then'](respondWithResult(_0x5691c2,0xc9))['catch'](handleError(_0x5691c2,null));};exports['update']=function(_0x22787e,_0x90a63d){if(_0x22787e[_0x8f1a('0x51')]['id']){delete _0x22787e[_0x8f1a('0x51')]['id'];}return db[_0x8f1a('0x36')]['find']({'where':{'id':_0x22787e[_0x8f1a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x90a63d,null))[_0x8f1a('0x31')](saveUpdates(_0x22787e[_0x8f1a('0x51')],null))['then'](respondWithResult(_0x90a63d,null))[_0x8f1a('0x26')](handleError(_0x90a63d,null));};exports['destroy']=function(_0x33dc63,_0x38d1a1){return db[_0x8f1a('0x36')][_0x8f1a('0x4f')]({'where':{'id':_0x33dc63[_0x8f1a('0x4d')]['id']}})[_0x8f1a('0x31')](handleEntityNotFound(_0x38d1a1,null))[_0x8f1a('0x31')](removeEntity(_0x38d1a1,null))[_0x8f1a('0x26')](handleError(_0x38d1a1,null));};exports[_0x8f1a('0x52')]=function(_0x25db9e,_0x4fcc35,_0x42910f){var _0x3c4617={};var _0x366c14={};var _0x708920;var _0x2896ae;return db[_0x8f1a('0x36')][_0x8f1a('0x53')]({'where':{'id':_0x25db9e[_0x8f1a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4fcc35,null))[_0x8f1a('0x31')](function(_0x5699d2){if(_0x5699d2){_0x708920=_0x5699d2;_0x366c14['model']=_['keys'](db[_0x8f1a('0x54')][_0x8f1a('0x37')]);_0x366c14[_0x8f1a('0x3a')]=_['keys'](_0x25db9e['query']);_0x366c14[_0x8f1a('0x43')]=_['intersection'](_0x366c14['model'],_0x366c14[_0x8f1a('0x3a')]);_0x3c4617[_0x8f1a('0x3d')]=_[_0x8f1a('0x3c')](_0x366c14[_0x8f1a('0x39')],qs[_0x8f1a('0x3e')](_0x25db9e['query'][_0x8f1a('0x3e')]));_0x3c4617[_0x8f1a('0x3d')]=_0x3c4617[_0x8f1a('0x3d')][_0x8f1a('0x3f')]?_0x3c4617[_0x8f1a('0x3d')]:_0x366c14[_0x8f1a('0x39')];_0x3c4617[_0x8f1a('0x55')]=qs[_0x8f1a('0x42')](_0x25db9e['query'][_0x8f1a('0x42')]);_0x3c4617['where']=qs[_0x8f1a('0x43')](_[_0x8f1a('0x56')](_0x25db9e[_0x8f1a('0x3a')],_0x366c14[_0x8f1a('0x43')]));if(_0x25db9e[_0x8f1a('0x3a')][_0x8f1a('0x44')]){_0x3c4617[_0x8f1a('0x45')]=_['merge'](_0x3c4617[_0x8f1a('0x45')],{'$or':_[_0x8f1a('0x35')](_0x3c4617[_0x8f1a('0x3d')],function(_0x1fb689){var _0x3c3f56={};_0x3c3f56[_0x1fb689]={'$like':'%'+_0x25db9e['query']['filter']+'%'};return _0x3c3f56;})});}_0x3c4617=_['merge']({},_0x3c4617,_0x25db9e['options']);return _0x708920[_0x8f1a('0x52')](_0x3c4617);}})['then'](function(_0x3fa723){if(_0x3fa723){_0x2896ae=_0x3fa723[_0x8f1a('0x3f')];if(!_0x25db9e[_0x8f1a('0x3a')][_0x8f1a('0x40')]('nolimit')){_0x3c4617[_0x8f1a('0x2b')]=qs[_0x8f1a('0x2b')](_0x25db9e[_0x8f1a('0x3a')][_0x8f1a('0x2b')]);_0x3c4617[_0x8f1a('0x2a')]=qs[_0x8f1a('0x2a')](_0x25db9e['query'][_0x8f1a('0x2a')]);}return _0x708920[_0x8f1a('0x52')](_0x3c4617);}})[_0x8f1a('0x31')](function(_0x55be5a){if(_0x55be5a){return _0x55be5a?{'count':_0x2896ae,'rows':_0x55be5a}:null;}})[_0x8f1a('0x31')](respondWithResult(_0x4fcc35,null))['catch'](handleError(_0x4fcc35,null));};exports[_0x8f1a('0x57')]=function(_0x395af8,_0x292547,_0x199a05){var _0x41d86={};var _0x6cf106={};var _0x165ee3;var _0x20e68e;return db[_0x8f1a('0x36')][_0x8f1a('0x53')]({'where':{'id':_0x395af8['params']['id']}})[_0x8f1a('0x31')](handleEntityNotFound(_0x292547,null))['then'](function(_0x5d818a){if(_0x5d818a){_0x165ee3=_0x5d818a;_0x6cf106[_0x8f1a('0x39')]=_[_0x8f1a('0x3b')](db[_0x8f1a('0x54')][_0x8f1a('0x37')]);_0x6cf106['query']=_[_0x8f1a('0x3b')](_0x395af8[_0x8f1a('0x3a')]);_0x6cf106[_0x8f1a('0x43')]=_['intersection'](_0x6cf106[_0x8f1a('0x39')],_0x6cf106[_0x8f1a('0x3a')]);_0x41d86[_0x8f1a('0x3d')]=_[_0x8f1a('0x3c')](_0x6cf106[_0x8f1a('0x39')],qs['fields'](_0x395af8[_0x8f1a('0x3a')]['fields']));_0x41d86[_0x8f1a('0x3d')]=_0x41d86[_0x8f1a('0x3d')][_0x8f1a('0x3f')]?_0x41d86[_0x8f1a('0x3d')]:_0x6cf106[_0x8f1a('0x39')];_0x41d86['order']=qs[_0x8f1a('0x42')](_0x395af8[_0x8f1a('0x3a')][_0x8f1a('0x42')]);_0x41d86[_0x8f1a('0x45')]=qs[_0x8f1a('0x43')](_[_0x8f1a('0x56')](_0x395af8[_0x8f1a('0x3a')],_0x6cf106['filters']));if(_0x395af8[_0x8f1a('0x3a')][_0x8f1a('0x44')]){_0x41d86[_0x8f1a('0x45')]=_['merge'](_0x41d86[_0x8f1a('0x45')],{'$or':_[_0x8f1a('0x35')](_0x41d86[_0x8f1a('0x3d')],function(_0x293b2b){var _0x4600db={};_0x4600db[_0x293b2b]={'$like':'%'+_0x395af8[_0x8f1a('0x3a')][_0x8f1a('0x44')]+'%'};return _0x4600db;})});}_0x41d86=_[_0x8f1a('0x46')]({},_0x41d86,_0x395af8[_0x8f1a('0x48')]);return _0x165ee3['getSubjects'](_0x41d86);}})['then'](function(_0x31c472){if(_0x31c472){_0x20e68e=_0x31c472[_0x8f1a('0x3f')];if(!_0x395af8[_0x8f1a('0x3a')][_0x8f1a('0x40')](_0x8f1a('0x41'))){_0x41d86[_0x8f1a('0x2b')]=qs[_0x8f1a('0x2b')](_0x395af8[_0x8f1a('0x3a')][_0x8f1a('0x2b')]);_0x41d86[_0x8f1a('0x2a')]=qs[_0x8f1a('0x2a')](_0x395af8['query'][_0x8f1a('0x2a')]);}return _0x165ee3['getSubjects'](_0x41d86);}})['then'](function(_0x3f9d2e){if(_0x3f9d2e){return _0x3f9d2e?{'count':_0x20e68e,'rows':_0x3f9d2e}:null;}})['then'](respondWithResult(_0x292547,null))[_0x8f1a('0x26')](handleError(_0x292547,null));};exports['getDescriptions']=function(_0x2cd68c,_0x353a89,_0x2b291b){var _0xb8b3ab={};var _0x2e9f8a={};var _0x1007c1;var _0x3e4bb5;return db[_0x8f1a('0x36')][_0x8f1a('0x53')]({'where':{'id':_0x2cd68c[_0x8f1a('0x4d')]['id']}})[_0x8f1a('0x31')](handleEntityNotFound(_0x353a89,null))[_0x8f1a('0x31')](function(_0x2282c4){if(_0x2282c4){_0x1007c1=_0x2282c4;_0x2e9f8a[_0x8f1a('0x39')]=_[_0x8f1a('0x3b')](db[_0x8f1a('0x54')][_0x8f1a('0x37')]);_0x2e9f8a[_0x8f1a('0x3a')]=_[_0x8f1a('0x3b')](_0x2cd68c[_0x8f1a('0x3a')]);_0x2e9f8a[_0x8f1a('0x43')]=_['intersection'](_0x2e9f8a[_0x8f1a('0x39')],_0x2e9f8a[_0x8f1a('0x3a')]);_0xb8b3ab[_0x8f1a('0x3d')]=_['intersection'](_0x2e9f8a[_0x8f1a('0x39')],qs[_0x8f1a('0x3e')](_0x2cd68c[_0x8f1a('0x3a')]['fields']));_0xb8b3ab[_0x8f1a('0x3d')]=_0xb8b3ab[_0x8f1a('0x3d')]['length']?_0xb8b3ab[_0x8f1a('0x3d')]:_0x2e9f8a[_0x8f1a('0x39')];_0xb8b3ab[_0x8f1a('0x55')]=qs[_0x8f1a('0x42')](_0x2cd68c[_0x8f1a('0x3a')]['sort']);_0xb8b3ab[_0x8f1a('0x45')]=qs[_0x8f1a('0x43')](_['pick'](_0x2cd68c[_0x8f1a('0x3a')],_0x2e9f8a['filters']));if(_0x2cd68c[_0x8f1a('0x3a')][_0x8f1a('0x44')]){_0xb8b3ab['where']=_[_0x8f1a('0x46')](_0xb8b3ab[_0x8f1a('0x45')],{'$or':_['map'](_0xb8b3ab[_0x8f1a('0x3d')],function(_0x48cabc){var _0x14af3f={};_0x14af3f[_0x48cabc]={'$like':'%'+_0x2cd68c[_0x8f1a('0x3a')][_0x8f1a('0x44')]+'%'};return _0x14af3f;})});}_0xb8b3ab=_['merge']({},_0xb8b3ab,_0x2cd68c[_0x8f1a('0x48')]);return _0x1007c1['getDescriptions'](_0xb8b3ab);}})[_0x8f1a('0x31')](function(_0x1fc849){if(_0x1fc849){_0x3e4bb5=_0x1fc849[_0x8f1a('0x3f')];if(!_0x2cd68c[_0x8f1a('0x3a')]['hasOwnProperty'](_0x8f1a('0x41'))){_0xb8b3ab[_0x8f1a('0x2b')]=qs['limit'](_0x2cd68c[_0x8f1a('0x3a')][_0x8f1a('0x2b')]);_0xb8b3ab[_0x8f1a('0x2a')]=qs['offset'](_0x2cd68c['query'][_0x8f1a('0x2a')]);}return _0x1007c1[_0x8f1a('0x58')](_0xb8b3ab);}})[_0x8f1a('0x31')](function(_0x26f29f){if(_0x26f29f){return _0x26f29f?{'count':_0x3e4bb5,'rows':_0x26f29f}:null;}})[_0x8f1a('0x31')](respondWithResult(_0x353a89,null))['catch'](handleError(_0x353a89,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index ece1c8e..9b9f8cc 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 _0x0f40=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration'];(function(_0x5cccde,_0x4c6505){var _0x40a5b1=function(_0x29bb20){while(--_0x29bb20){_0x5cccde['push'](_0x5cccde['shift']());}};_0x40a5b1(++_0x4c6505);}(_0x0f40,0x160));var _0x00f4=function(_0x50388b,_0x276225){_0x50388b=_0x50388b-0x0;var _0x6037b=_0x0f40[_0x50388b];return _0x6037b;};'use strict';var _=require(_0x00f4('0x0'));var util=require(_0x00f4('0x1'));var logger=require('../../config/logger')(_0x00f4('0x2'));var moment=require('moment');var BPromise=require(_0x00f4('0x3'));var rp=require(_0x00f4('0x4'));var fs=require('fs');var path=require(_0x00f4('0x5'));var rimraf=require(_0x00f4('0x6'));var config=require(_0x00f4('0x7'));var attributes=require(_0x00f4('0x8'));module['exports']=function(_0x477077,_0x286d8a){return _0x477077[_0x00f4('0x9')](_0x00f4('0xa'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3f5=['exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes'];(function(_0x2f3794,_0x3c3bec){var _0x1c9fbe=function(_0x2d2eac){while(--_0x2d2eac){_0x2f3794['push'](_0x2f3794['shift']());}};_0x1c9fbe(++_0x3c3bec);}(_0xf3f5,0x1d2));var _0x5f3f=function(_0x556e34,_0x28388b){_0x556e34=_0x556e34-0x0;var _0x3f5b3f=_0xf3f5[_0x556e34];return _0x3f5b3f;};'use strict';var _=require(_0x5f3f('0x0'));var util=require(_0x5f3f('0x1'));var logger=require(_0x5f3f('0x2'))(_0x5f3f('0x3'));var moment=require(_0x5f3f('0x4'));var BPromise=require(_0x5f3f('0x5'));var rp=require(_0x5f3f('0x6'));var fs=require('fs');var path=require(_0x5f3f('0x7'));var rimraf=require(_0x5f3f('0x8'));var config=require('../../config/environment');var attributes=require(_0x5f3f('0x9'));module[_0x5f3f('0xa')]=function(_0x43cdf2,_0x4d0460){return _0x43cdf2[_0x5f3f('0xb')](_0x5f3f('0xc'),attributes,{'tableName':_0x5f3f('0xd'),'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 0f7588f..a5adb0e 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 _0x5ab7=['code','ServicenowConfiguration,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x21ed77,_0x4c076d){var _0x32ab10=function(_0x36e83b){while(--_0x36e83b){_0x21ed77['push'](_0x21ed77['shift']());}};_0x32ab10(++_0x4c076d);}(_0x5ab7,0xf7));var _0x75ab=function(_0x33108e,_0x42dd22){_0x33108e=_0x33108e-0x0;var _0x5cf4e0=_0x5ab7[_0x33108e];return _0x5cf4e0;};'use strict';var _=require(_0x75ab('0x0'));var util=require(_0x75ab('0x1'));var moment=require(_0x75ab('0x2'));var BPromise=require(_0x75ab('0x3'));var rs=require(_0x75ab('0x4'));var fs=require('fs');var Redis=require(_0x75ab('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x75ab('0x6'));var logger=require(_0x75ab('0x7'))(_0x75ab('0x8'));var config=require(_0x75ab('0x9'));var jayson=require(_0x75ab('0xa'));var client=jayson[_0x75ab('0xb')][_0x75ab('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4724b3,_0x298aa1,_0x3f484e){return new BPromise(function(_0xef62c0,_0x3c6b57){return client['request'](_0x4724b3,_0x3f484e)['then'](function(_0x54d89c){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x298aa1,'request\x20sent');logger['debug'](_0x75ab('0xd'),_0x298aa1,_0x75ab('0xe'),JSON[_0x75ab('0xf')](_0x54d89c));if(_0x54d89c[_0x75ab('0x10')]){if(_0x54d89c[_0x75ab('0x10')][_0x75ab('0x11')]===0x1f4){logger['error'](_0x75ab('0x12'),_0x298aa1,_0x54d89c[_0x75ab('0x10')]['message']);return _0x3c6b57(_0x54d89c[_0x75ab('0x10')][_0x75ab('0x13')]);}logger[_0x75ab('0x10')](_0x75ab('0x12'),_0x298aa1,_0x54d89c[_0x75ab('0x10')][_0x75ab('0x13')]);return _0xef62c0(_0x54d89c[_0x75ab('0x10')]['message']);}else{logger[_0x75ab('0x14')]('ServicenowConfiguration,\x20%s,\x20%s',_0x298aa1,_0x75ab('0xe'));_0xef62c0(_0x54d89c['result']['message']);}})[_0x75ab('0x15')](function(_0x4585eb){logger[_0x75ab('0x10')](_0x75ab('0x12'),_0x298aa1,_0x4585eb);_0x3c6b57(_0x4585eb);});});} \ No newline at end of file +var _0x6109=['debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','then','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x1b3518,_0x1cc495){var _0x557428=function(_0xae4017){while(--_0xae4017){_0x1b3518['push'](_0x1b3518['shift']());}};_0x557428(++_0x1cc495);}(_0x6109,0x136));var _0x9610=function(_0x36d78e,_0x5cd492){_0x36d78e=_0x36d78e-0x0;var _0x5c0a6f=_0x6109[_0x36d78e];return _0x5c0a6f;};'use strict';var _=require(_0x9610('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9610('0x1'));var fs=require('fs');var Redis=require(_0x9610('0x2'));var db=require(_0x9610('0x3'))['db'];var utils=require(_0x9610('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9610('0x5'));var client=jayson[_0x9610('0x6')][_0x9610('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x42f95a,_0x299c3e,_0x457a40){return new BPromise(function(_0x8b4743,_0x2c0cd6){return client['request'](_0x42f95a,_0x457a40)[_0x9610('0x8')](function(_0x38e381){logger['info'](_0x9610('0x9'),_0x299c3e,'request\x20sent');logger[_0x9610('0xa')](_0x9610('0xb'),_0x299c3e,'request\x20sent',JSON[_0x9610('0xc')](_0x38e381));if(_0x38e381[_0x9610('0xd')]){if(_0x38e381[_0x9610('0xd')][_0x9610('0xe')]===0x1f4){logger[_0x9610('0xd')](_0x9610('0x9'),_0x299c3e,_0x38e381[_0x9610('0xd')]['message']);return _0x2c0cd6(_0x38e381[_0x9610('0xd')][_0x9610('0xf')]);}logger[_0x9610('0xd')](_0x9610('0x9'),_0x299c3e,_0x38e381['error'][_0x9610('0xf')]);return _0x8b4743(_0x38e381[_0x9610('0xd')][_0x9610('0xf')]);}else{logger[_0x9610('0x10')](_0x9610('0x9'),_0x299c3e,_0x9610('0x11'));_0x8b4743(_0x38e381[_0x9610('0x12')]['message']);}})[_0x9610('0x13')](function(_0x2a7514){logger['error'](_0x9610('0x9'),_0x299c3e,_0x2a7514);_0x2c0cd6(_0x2a7514);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index dce488a..17e1bdc 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 _0x6970=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','post','create','put','/:id','update','exports','multer','util','path','connect-timeout'];(function(_0x145dfa,_0x3f8231){var _0x557c59=function(_0x2db009){while(--_0x2db009){_0x145dfa['push'](_0x145dfa['shift']());}};_0x557c59(++_0x3f8231);}(_0x6970,0x1ac));var _0x0697=function(_0x3ad9f0,_0xcad34){_0x3ad9f0=_0x3ad9f0-0x0;var _0xa498a5=_0x6970[_0x3ad9f0];return _0xa498a5;};'use strict';var multer=require(_0x0697('0x0'));var util=require(_0x0697('0x1'));var path=require(_0x0697('0x2'));var timeout=require(_0x0697('0x3'));var express=require('express');var router=express[_0x0697('0x4')]();var auth=require(_0x0697('0x5'));var interaction=require(_0x0697('0x6'));var config=require(_0x0697('0x7'));var controller=require(_0x0697('0x8'));router[_0x0697('0x9')]('/',auth[_0x0697('0xa')](),controller[_0x0697('0xb')]);router[_0x0697('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0697('0xc')]('/',auth[_0x0697('0xa')](),controller[_0x0697('0xd')]);router[_0x0697('0xe')](_0x0697('0xf'),auth['isAuthenticated'](),controller[_0x0697('0x10')]);router['delete'](_0x0697('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x0697('0x11')]=router; \ No newline at end of file +var _0x17e5=['../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x44edb0,_0x7a1d21){var _0x38dbd0=function(_0xcc1e93){while(--_0xcc1e93){_0x44edb0['push'](_0x44edb0['shift']());}};_0x38dbd0(++_0x7a1d21);}(_0x17e5,0x13d));var _0x517e=function(_0x1bbf2d,_0x2bfefc){_0x1bbf2d=_0x1bbf2d-0x0;var _0x1e484d=_0x17e5[_0x1bbf2d];return _0x1e484d;};'use strict';var multer=require('multer');var util=require(_0x517e('0x0'));var path=require(_0x517e('0x1'));var timeout=require(_0x517e('0x2'));var express=require(_0x517e('0x3'));var router=express[_0x517e('0x4')]();var auth=require(_0x517e('0x5'));var interaction=require(_0x517e('0x6'));var config=require(_0x517e('0x7'));var controller=require(_0x517e('0x8'));router[_0x517e('0x9')]('/',auth[_0x517e('0xa')](),controller['index']);router[_0x517e('0x9')](_0x517e('0xb'),auth[_0x517e('0xa')](),controller[_0x517e('0xc')]);router[_0x517e('0xd')]('/',auth['isAuthenticated'](),controller[_0x517e('0xe')]);router[_0x517e('0xf')](_0x517e('0xb'),auth[_0x517e('0xa')](),controller[_0x517e('0x10')]);router[_0x517e('0x11')]('/:id',auth[_0x517e('0xa')](),controller['destroy']);module[_0x517e('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index b239a30..dfdf7a6 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 _0x9893=['exports','ENUM','customVariable','keyValue','string','STRING','variable','BOOLEAN','sequelize'];(function(_0x3d2e4f,_0x139a5e){var _0x4ae0ec=function(_0x3eea67){while(--_0x3eea67){_0x3d2e4f['push'](_0x3d2e4f['shift']());}};_0x4ae0ec(++_0x139a5e);}(_0x9893,0xe0));var _0x3989=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9893[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x3989('0x0'));module[_0x3989('0x1')]={'type':{'type':Sequelize[_0x3989('0x2')]('string','variable',_0x3989('0x3'),_0x3989('0x4')),'defaultValue':_0x3989('0x5')},'content':{'type':Sequelize[_0x3989('0x6')]},'key':{'type':Sequelize[_0x3989('0x6')]},'keyType':{'type':Sequelize[_0x3989('0x2')](_0x3989('0x5'),_0x3989('0x7'),_0x3989('0x3'))},'keyContent':{'type':Sequelize[_0x3989('0x6')]},'idField':{'type':Sequelize[_0x3989('0x6')]},'nameField':{'type':Sequelize[_0x3989('0x6')]},'customField':{'type':Sequelize[_0x3989('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3989('0x6')]}}; \ No newline at end of file +var _0x77f2=['STRING','BOOLEAN','exports','string','variable'];(function(_0x1ef9c3,_0x2f430e){var _0x445208=function(_0x13615a){while(--_0x13615a){_0x1ef9c3['push'](_0x1ef9c3['shift']());}};_0x445208(++_0x2f430e);}(_0x77f2,0x188));var _0x277f=function(_0x59ee41,_0xaf7db8){_0x59ee41=_0x59ee41-0x0;var _0x3ecd3e=_0x77f2[_0x59ee41];return _0x3ecd3e;};'use strict';var Sequelize=require('sequelize');module[_0x277f('0x0')]={'type':{'type':Sequelize['ENUM'](_0x277f('0x1'),_0x277f('0x2'),'customVariable','keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0x277f('0x3')]},'key':{'type':Sequelize[_0x277f('0x3')]},'keyType':{'type':Sequelize['ENUM'](_0x277f('0x1'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x277f('0x3')]},'nameField':{'type':Sequelize[_0x277f('0x3')]},'customField':{'type':Sequelize[_0x277f('0x4')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 27f0436..90e8deb 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 _0xc81d=['index','map','ServicenowField','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','params','keys','includeAll','find','catch','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../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','destroy','error','name'];(function(_0x407fb2,_0x4b6813){var _0xfde875=function(_0x131120){while(--_0x131120){_0x407fb2['push'](_0x407fb2['shift']());}};_0xfde875(++_0x4b6813);}(_0xc81d,0xa7));var _0xdc81=function(_0x514a51,_0x34b3fd){_0x514a51=_0x514a51-0x0;var _0x2d9c5a=_0xc81d[_0x514a51];return _0x2d9c5a;};'use strict';var pdf=require(_0xdc81('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdc81('0x1'));var zipdir=require(_0xdc81('0x2'));var jsonpatch=require(_0xdc81('0x3'));var rp=require(_0xdc81('0x4'));var moment=require(_0xdc81('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdc81('0x6'));var path=require(_0xdc81('0x7'));var sox=require('sox');var csv=require(_0xdc81('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdc81('0x9'));var squel=require(_0xdc81('0xa'));var crypto=require(_0xdc81('0xb'));var jsforce=require(_0xdc81('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdc81('0x8'));var querystring=require(_0xdc81('0xd'));var Papa=require(_0xdc81('0xe'));var Redis=require('ioredis');var authService=require(_0xdc81('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xdc81('0x10'));var hardwareService=require(_0xdc81('0x11'));var logger=require(_0xdc81('0x12'))(_0xdc81('0x13'));var utils=require('../../config/utils');var config=require(_0xdc81('0x14'));var db=require(_0xdc81('0x15'))['db'];function respondWithStatusCode(_0x127dc6,_0x20afba){_0x20afba=_0x20afba||0xcc;return function(_0x408ff1){if(_0x408ff1){return _0x127dc6[_0xdc81('0x16')](_0x20afba);}return _0x127dc6[_0xdc81('0x17')](_0x20afba)[_0xdc81('0x18')]();};}function respondWithResult(_0x43bd5d,_0xb53051){_0xb53051=_0xb53051||0xc8;return function(_0x556d1f){if(_0x556d1f){return _0x43bd5d[_0xdc81('0x17')](_0xb53051)['json'](_0x556d1f);}};}function respondWithFilteredResult(_0x13da6f,_0x37d858){return function(_0x5ebe98){if(_0x5ebe98){var _0x55d123=_0x5ebe98[_0xdc81('0x19')],_0x10fcd8=_0x37d858[_0xdc81('0x1a')],_0x4012c2=_0x37d858[_0xdc81('0x1a')]+_0x37d858[_0xdc81('0x1b')],_0xd9f147;if(_0x4012c2>=_0x55d123){_0x4012c2=_0x55d123;_0xd9f147=0xc8;}else{_0xd9f147=0xce;}_0x13da6f[_0xdc81('0x17')](_0xd9f147);return _0x13da6f[_0xdc81('0x1c')](_0xdc81('0x1d'),_0x10fcd8+'-'+_0x4012c2+'/'+_0x55d123)[_0xdc81('0x1e')](_0x5ebe98);}return null;};}function patchUpdates(_0x41596a){return function(_0x377057){try{jsonpatch['apply'](_0x377057,_0x41596a,!![]);}catch(_0x484da6){return BPromise['reject'](_0x484da6);}return _0x377057[_0xdc81('0x1f')]();};}function saveUpdates(_0x3c3876,_0x588c30){return function(_0x283323){if(_0x283323){return _0x283323[_0xdc81('0x20')](_0x3c3876)[_0xdc81('0x21')](function(_0x3b6f27){return _0x3b6f27;});}return null;};}function removeEntity(_0xcc7627,_0x6da2c7){return function(_0x1b7101){if(_0x1b7101){return _0x1b7101[_0xdc81('0x22')]()['then'](function(){_0xcc7627[_0xdc81('0x17')](0xcc)[_0xdc81('0x18')]();});}};}function handleEntityNotFound(_0x205b21,_0x82d718){return function(_0x1d2c33){if(!_0x1d2c33){_0x205b21[_0xdc81('0x16')](0x194);}return _0x1d2c33;};}function handleError(_0x26fefc,_0x1e9d5d){_0x1e9d5d=_0x1e9d5d||0x1f4;return function(_0x27c4b6){logger[_0xdc81('0x23')](_0x27c4b6['stack']);if(_0x27c4b6['name']){delete _0x27c4b6[_0xdc81('0x24')];}_0x26fefc['status'](_0x1e9d5d)['send'](_0x27c4b6);};}exports[_0xdc81('0x25')]=function(_0x90f788,_0x2af39e){var _0x48d93a={},_0x20a198={},_0x448d3e={'count':0x0,'rows':[]};var _0x726a98=_[_0xdc81('0x26')](db[_0xdc81('0x27')]['rawAttributes'],function(_0x4158a1){return{'name':_0x4158a1[_0xdc81('0x28')],'type':_0x4158a1[_0xdc81('0x29')][_0xdc81('0x2a')]};});_0x20a198[_0xdc81('0x2b')]=_[_0xdc81('0x26')](_0x726a98,'name');_0x20a198[_0xdc81('0x2c')]=_['keys'](_0x90f788[_0xdc81('0x2c')]);_0x20a198['filters']=_['intersection'](_0x20a198[_0xdc81('0x2b')],_0x20a198['query']);_0x48d93a[_0xdc81('0x2d')]=_[_0xdc81('0x2e')](_0x20a198['model'],qs[_0xdc81('0x2f')](_0x90f788[_0xdc81('0x2c')]['fields']));_0x48d93a['attributes']=_0x48d93a[_0xdc81('0x2d')][_0xdc81('0x30')]?_0x48d93a[_0xdc81('0x2d')]:_0x20a198['model'];if(!_0x90f788[_0xdc81('0x2c')][_0xdc81('0x31')](_0xdc81('0x32'))){_0x48d93a['limit']=qs['limit'](_0x90f788[_0xdc81('0x2c')][_0xdc81('0x1b')]);_0x48d93a[_0xdc81('0x1a')]=qs[_0xdc81('0x1a')](_0x90f788[_0xdc81('0x2c')]['offset']);}_0x48d93a['order']=qs[_0xdc81('0x33')](_0x90f788[_0xdc81('0x2c')][_0xdc81('0x33')]);_0x48d93a[_0xdc81('0x34')]=qs[_0xdc81('0x35')](_[_0xdc81('0x36')](_0x90f788[_0xdc81('0x2c')],_0x20a198[_0xdc81('0x35')]));if(_0x90f788['query'][_0xdc81('0x37')]){_0x48d93a['where']=_[_0xdc81('0x38')](_0x48d93a[_0xdc81('0x34')],{'$or':_[_0xdc81('0x26')](_0x726a98,function(_0x3f9e6a){if(_0x3f9e6a[_0xdc81('0x29')]!==_0xdc81('0x39')){var _0x435dd8={};_0x435dd8[_0x3f9e6a[_0xdc81('0x24')]]={'$like':'%'+_0x90f788[_0xdc81('0x2c')]['filter']+'%'};return _0x435dd8;}})});}_0x48d93a=_['merge']({},_0x48d93a,_0x90f788[_0xdc81('0x3a')]);var _0xeaa8c4={'where':_0x48d93a[_0xdc81('0x34')]};return db[_0xdc81('0x27')]['count'](_0xeaa8c4)[_0xdc81('0x21')](function(_0x58f6a5){_0x448d3e['count']=_0x58f6a5;if(_0x90f788[_0xdc81('0x2c')]['includeAll']){_0x48d93a['include']=[{'all':!![]}];}return db['ServicenowField'][_0xdc81('0x3b')](_0x48d93a);})['then'](function(_0x2582dc){_0x448d3e[_0xdc81('0x3c')]=_0x2582dc;return _0x448d3e;})[_0xdc81('0x21')](respondWithFilteredResult(_0x2af39e,_0x48d93a))['catch'](handleError(_0x2af39e,null));};exports['show']=function(_0x53ea37,_0x202088){var _0x598c04={'raw':!![],'where':{'id':_0x53ea37[_0xdc81('0x3d')]['id']}},_0x2872cf={};_0x2872cf[_0xdc81('0x2b')]=_[_0xdc81('0x3e')](db[_0xdc81('0x27')]['rawAttributes']);_0x2872cf['query']=_[_0xdc81('0x3e')](_0x53ea37[_0xdc81('0x2c')]);_0x2872cf['filters']=_['intersection'](_0x2872cf[_0xdc81('0x2b')],_0x2872cf[_0xdc81('0x2c')]);_0x598c04[_0xdc81('0x2d')]=_[_0xdc81('0x2e')](_0x2872cf[_0xdc81('0x2b')],qs[_0xdc81('0x2f')](_0x53ea37[_0xdc81('0x2c')][_0xdc81('0x2f')]));_0x598c04[_0xdc81('0x2d')]=_0x598c04[_0xdc81('0x2d')][_0xdc81('0x30')]?_0x598c04[_0xdc81('0x2d')]:_0x2872cf[_0xdc81('0x2b')];if(_0x53ea37[_0xdc81('0x2c')][_0xdc81('0x3f')]){_0x598c04['include']=[{'all':!![]}];}_0x598c04=_[_0xdc81('0x38')]({},_0x598c04,_0x53ea37[_0xdc81('0x3a')]);return db['ServicenowField'][_0xdc81('0x40')](_0x598c04)[_0xdc81('0x21')](handleEntityNotFound(_0x202088,null))[_0xdc81('0x21')](respondWithResult(_0x202088,null))[_0xdc81('0x41')](handleError(_0x202088,null));};exports[_0xdc81('0x42')]=function(_0x112b7b,_0x676a2b){return db[_0xdc81('0x27')][_0xdc81('0x42')](_0x112b7b[_0xdc81('0x43')],{})['then'](respondWithResult(_0x676a2b,0xc9))[_0xdc81('0x41')](handleError(_0x676a2b,null));};exports[_0xdc81('0x20')]=function(_0x2132f5,_0x1a9562){if(_0x2132f5[_0xdc81('0x43')]['id']){delete _0x2132f5['body']['id'];}return db[_0xdc81('0x27')][_0xdc81('0x40')]({'where':{'id':_0x2132f5[_0xdc81('0x3d')]['id']}})[_0xdc81('0x21')](handleEntityNotFound(_0x1a9562,null))['then'](saveUpdates(_0x2132f5[_0xdc81('0x43')],null))[_0xdc81('0x21')](respondWithResult(_0x1a9562,null))['catch'](handleError(_0x1a9562,null));};exports[_0xdc81('0x22')]=function(_0x359c14,_0x5893fd){return db[_0xdc81('0x27')][_0xdc81('0x40')]({'where':{'id':_0x359c14[_0xdc81('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5893fd,null))[_0xdc81('0x21')](removeEntity(_0x5893fd,null))['catch'](handleError(_0x5893fd,null));}; \ No newline at end of file +var _0x897b=['Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','fieldName','type','map','keys','filters','intersection','model','attributes','query','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','ServicenowField','includeAll','include','findAll','catch','show','params','rawAttributes','length','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','end','status','count','offset','limit','set'];(function(_0x37353d,_0x470ca8){var _0x43d9da=function(_0xef44d5){while(--_0xef44d5){_0x37353d['push'](_0x37353d['shift']());}};_0x43d9da(++_0x470ca8);}(_0x897b,0x15d));var _0xb897=function(_0x334b9c,_0x5ab8ba){_0x334b9c=_0x334b9c-0x0;var _0x418229=_0x897b[_0x334b9c];return _0x418229;};'use strict';var pdf=require(_0xb897('0x0'));var emlformat=require(_0xb897('0x1'));var rimraf=require(_0xb897('0x2'));var zipdir=require(_0xb897('0x3'));var jsonpatch=require(_0xb897('0x4'));var rp=require(_0xb897('0x5'));var moment=require(_0xb897('0x6'));var BPromise=require(_0xb897('0x7'));var Mustache=require(_0xb897('0x8'));var util=require(_0xb897('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xb897('0xa'));var ejs=require(_0xb897('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb897('0xc'));var crypto=require('crypto');var jsforce=require(_0xb897('0xd'));var deskjs=require(_0xb897('0xe'));var toCsv=require(_0xb897('0xa'));var querystring=require(_0xb897('0xf'));var Papa=require(_0xb897('0x10'));var Redis=require(_0xb897('0x11'));var authService=require(_0xb897('0x12'));var qs=require(_0xb897('0x13'));var as=require(_0xb897('0x14'));var hardwareService=require(_0xb897('0x15'));var logger=require(_0xb897('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xb897('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb25919,_0x2875b2){_0x2875b2=_0x2875b2||0xcc;return function(_0x3646fa){if(_0x3646fa){return _0xb25919[_0xb897('0x18')](_0x2875b2);}return _0xb25919['status'](_0x2875b2)[_0xb897('0x19')]();};}function respondWithResult(_0xeb122e,_0xe360ba){_0xe360ba=_0xe360ba||0xc8;return function(_0x16a9a8){if(_0x16a9a8){return _0xeb122e[_0xb897('0x1a')](_0xe360ba)['json'](_0x16a9a8);}};}function respondWithFilteredResult(_0x43763d,_0x5af13c){return function(_0x766419){if(_0x766419){var _0x78fabb=_0x766419[_0xb897('0x1b')],_0x4e2227=_0x5af13c[_0xb897('0x1c')],_0x1e5e2b=_0x5af13c[_0xb897('0x1c')]+_0x5af13c[_0xb897('0x1d')],_0x538f3b;if(_0x1e5e2b>=_0x78fabb){_0x1e5e2b=_0x78fabb;_0x538f3b=0xc8;}else{_0x538f3b=0xce;}_0x43763d['status'](_0x538f3b);return _0x43763d[_0xb897('0x1e')](_0xb897('0x1f'),_0x4e2227+'-'+_0x1e5e2b+'/'+_0x78fabb)[_0xb897('0x20')](_0x766419);}return null;};}function patchUpdates(_0x93ddb8){return function(_0x5d6ee7){try{jsonpatch[_0xb897('0x21')](_0x5d6ee7,_0x93ddb8,!![]);}catch(_0x27813a){return BPromise[_0xb897('0x22')](_0x27813a);}return _0x5d6ee7[_0xb897('0x23')]();};}function saveUpdates(_0x8a121f,_0x163cd5){return function(_0xf1a1e1){if(_0xf1a1e1){return _0xf1a1e1[_0xb897('0x24')](_0x8a121f)[_0xb897('0x25')](function(_0x31e2e4){return _0x31e2e4;});}return null;};}function removeEntity(_0x583ab5,_0x94d73d){return function(_0x4eea3d){if(_0x4eea3d){return _0x4eea3d[_0xb897('0x26')]()[_0xb897('0x25')](function(){_0x583ab5[_0xb897('0x1a')](0xcc)[_0xb897('0x19')]();});}};}function handleEntityNotFound(_0x32fe56,_0x287cf){return function(_0x2d7096){if(!_0x2d7096){_0x32fe56[_0xb897('0x18')](0x194);}return _0x2d7096;};}function handleError(_0x4e512c,_0x634ca5){_0x634ca5=_0x634ca5||0x1f4;return function(_0x10acb0){logger[_0xb897('0x27')](_0x10acb0[_0xb897('0x28')]);if(_0x10acb0[_0xb897('0x29')]){delete _0x10acb0[_0xb897('0x29')];}_0x4e512c[_0xb897('0x1a')](_0x634ca5)[_0xb897('0x2a')](_0x10acb0);};}exports[_0xb897('0x2b')]=function(_0x13b7a7,_0x27a1ca){var _0x52bc4c={},_0x6e3bba={},_0x9ea79e={'count':0x0,'rows':[]};var _0x1fce3a=_['map'](db['ServicenowField']['rawAttributes'],function(_0x2f5f6e){return{'name':_0x2f5f6e[_0xb897('0x2c')],'type':_0x2f5f6e[_0xb897('0x2d')]['key']};});_0x6e3bba['model']=_[_0xb897('0x2e')](_0x1fce3a,_0xb897('0x29'));_0x6e3bba['query']=_[_0xb897('0x2f')](_0x13b7a7['query']);_0x6e3bba[_0xb897('0x30')]=_[_0xb897('0x31')](_0x6e3bba[_0xb897('0x32')],_0x6e3bba['query']);_0x52bc4c[_0xb897('0x33')]=_[_0xb897('0x31')](_0x6e3bba[_0xb897('0x32')],qs['fields'](_0x13b7a7[_0xb897('0x34')][_0xb897('0x35')]));_0x52bc4c[_0xb897('0x33')]=_0x52bc4c['attributes']['length']?_0x52bc4c['attributes']:_0x6e3bba[_0xb897('0x32')];if(!_0x13b7a7['query'][_0xb897('0x36')](_0xb897('0x37'))){_0x52bc4c[_0xb897('0x1d')]=qs[_0xb897('0x1d')](_0x13b7a7[_0xb897('0x34')][_0xb897('0x1d')]);_0x52bc4c['offset']=qs[_0xb897('0x1c')](_0x13b7a7[_0xb897('0x34')][_0xb897('0x1c')]);}_0x52bc4c[_0xb897('0x38')]=qs['sort'](_0x13b7a7[_0xb897('0x34')][_0xb897('0x39')]);_0x52bc4c['where']=qs['filters'](_[_0xb897('0x3a')](_0x13b7a7[_0xb897('0x34')],_0x6e3bba['filters']));if(_0x13b7a7[_0xb897('0x34')][_0xb897('0x3b')]){_0x52bc4c[_0xb897('0x3c')]=_[_0xb897('0x3d')](_0x52bc4c['where'],{'$or':_[_0xb897('0x2e')](_0x1fce3a,function(_0x2fa8e8){if(_0x2fa8e8[_0xb897('0x2d')]!==_0xb897('0x3e')){var _0xaf9c75={};_0xaf9c75[_0x2fa8e8[_0xb897('0x29')]]={'$like':'%'+_0x13b7a7[_0xb897('0x34')]['filter']+'%'};return _0xaf9c75;}})});}_0x52bc4c=_[_0xb897('0x3d')]({},_0x52bc4c,_0x13b7a7['options']);var _0xf2944f={'where':_0x52bc4c['where']};return db[_0xb897('0x3f')][_0xb897('0x1b')](_0xf2944f)[_0xb897('0x25')](function(_0x3493f3){_0x9ea79e[_0xb897('0x1b')]=_0x3493f3;if(_0x13b7a7[_0xb897('0x34')][_0xb897('0x40')]){_0x52bc4c[_0xb897('0x41')]=[{'all':!![]}];}return db['ServicenowField'][_0xb897('0x42')](_0x52bc4c);})[_0xb897('0x25')](function(_0x10e8b8){_0x9ea79e['rows']=_0x10e8b8;return _0x9ea79e;})[_0xb897('0x25')](respondWithFilteredResult(_0x27a1ca,_0x52bc4c))[_0xb897('0x43')](handleError(_0x27a1ca,null));};exports[_0xb897('0x44')]=function(_0x335218,_0x10b416){var _0x4194e0={'raw':!![],'where':{'id':_0x335218[_0xb897('0x45')]['id']}},_0x4b24c7={};_0x4b24c7[_0xb897('0x32')]=_['keys'](db[_0xb897('0x3f')][_0xb897('0x46')]);_0x4b24c7[_0xb897('0x34')]=_[_0xb897('0x2f')](_0x335218['query']);_0x4b24c7['filters']=_[_0xb897('0x31')](_0x4b24c7[_0xb897('0x32')],_0x4b24c7[_0xb897('0x34')]);_0x4194e0['attributes']=_[_0xb897('0x31')](_0x4b24c7[_0xb897('0x32')],qs[_0xb897('0x35')](_0x335218[_0xb897('0x34')]['fields']));_0x4194e0[_0xb897('0x33')]=_0x4194e0[_0xb897('0x33')][_0xb897('0x47')]?_0x4194e0[_0xb897('0x33')]:_0x4b24c7[_0xb897('0x32')];if(_0x335218[_0xb897('0x34')][_0xb897('0x40')]){_0x4194e0[_0xb897('0x41')]=[{'all':!![]}];}_0x4194e0=_[_0xb897('0x3d')]({},_0x4194e0,_0x335218[_0xb897('0x48')]);return db[_0xb897('0x3f')][_0xb897('0x49')](_0x4194e0)[_0xb897('0x25')](handleEntityNotFound(_0x10b416,null))[_0xb897('0x25')](respondWithResult(_0x10b416,null))[_0xb897('0x43')](handleError(_0x10b416,null));};exports[_0xb897('0x4a')]=function(_0x21148d,_0x2b39d4){return db[_0xb897('0x3f')][_0xb897('0x4a')](_0x21148d['body'],{})[_0xb897('0x25')](respondWithResult(_0x2b39d4,0xc9))[_0xb897('0x43')](handleError(_0x2b39d4,null));};exports[_0xb897('0x24')]=function(_0x25f872,_0xb28a51){if(_0x25f872[_0xb897('0x4b')]['id']){delete _0x25f872[_0xb897('0x4b')]['id'];}return db[_0xb897('0x3f')]['find']({'where':{'id':_0x25f872[_0xb897('0x45')]['id']}})[_0xb897('0x25')](handleEntityNotFound(_0xb28a51,null))['then'](saveUpdates(_0x25f872[_0xb897('0x4b')],null))[_0xb897('0x25')](respondWithResult(_0xb28a51,null))[_0xb897('0x43')](handleError(_0xb28a51,null));};exports[_0xb897('0x26')]=function(_0x28d3eb,_0x111291){return db[_0xb897('0x3f')][_0xb897('0x49')]({'where':{'id':_0x28d3eb[_0xb897('0x45')]['id']}})['then'](handleEntityNotFound(_0x111291,null))[_0xb897('0x25')](removeEntity(_0x111291,null))[_0xb897('0x43')](handleError(_0x111291,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 9dde720..36d22ef 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 _0x4f47=['exports','define','int_servicenow_fields','servicenow_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./intServicenowField.attributes'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0x4f47,0x1bf));var _0x74f4=function(_0xd3da2a,_0x22241c){_0xd3da2a=_0xd3da2a-0x0;var _0x10ab61=_0x4f47[_0xd3da2a];return _0x10ab61;};'use strict';var _=require(_0x74f4('0x0'));var util=require(_0x74f4('0x1'));var logger=require(_0x74f4('0x2'))(_0x74f4('0x3'));var moment=require(_0x74f4('0x4'));var BPromise=require(_0x74f4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x74f4('0x6'));var config=require('../../config/environment');var attributes=require(_0x74f4('0x7'));module[_0x74f4('0x8')]=function(_0x3fba4a,_0x363e6c){return _0x3fba4a[_0x74f4('0x9')]('ServicenowField',attributes,{'tableName':_0x74f4('0xa'),'paranoid':![],'indexes':[{'name':_0x74f4('0xb'),'fields':[_0x74f4('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe12e=['ServicenowField','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xe12e,0x94));var _0xee12=function(_0x27b7bd,_0x4557be){_0x27b7bd=_0x27b7bd-0x0;var _0x3c3892=_0xe12e[_0x27b7bd];return _0x3c3892;};'use strict';var _=require(_0xee12('0x0'));var util=require(_0xee12('0x1'));var logger=require(_0xee12('0x2'))(_0xee12('0x3'));var moment=require('moment');var BPromise=require(_0xee12('0x4'));var rp=require(_0xee12('0x5'));var fs=require('fs');var path=require(_0xee12('0x6'));var rimraf=require(_0xee12('0x7'));var config=require(_0xee12('0x8'));var attributes=require(_0xee12('0x9'));module[_0xee12('0xa')]=function(_0x175f5b,_0x3bccea){return _0x175f5b[_0xee12('0xb')](_0xee12('0xc'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xee12('0xd'),'fields':[_0xee12('0xe'),_0xee12('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 33b6098..16143a7 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 _0x3fcf=['error','code','message','info','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ServicenowField,\x20%s,\x20%s','ServicenowField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x410969,_0x1e40c7){var _0x52e086=function(_0x233b57){while(--_0x233b57){_0x410969['push'](_0x410969['shift']());}};_0x52e086(++_0x1e40c7);}(_0x3fcf,0x148));var _0xf3fc=function(_0x1151b5,_0x3fba81){_0x1151b5=_0x1151b5-0x0;var _0x2e23d4=_0x3fcf[_0x1151b5];return _0x2e23d4;};'use strict';var _=require(_0xf3fc('0x0'));var util=require(_0xf3fc('0x1'));var moment=require(_0xf3fc('0x2'));var BPromise=require(_0xf3fc('0x3'));var rs=require(_0xf3fc('0x4'));var fs=require('fs');var Redis=require(_0xf3fc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf3fc('0x6'));var logger=require('../../config/logger')(_0xf3fc('0x7'));var config=require(_0xf3fc('0x8'));var jayson=require(_0xf3fc('0x9'));var client=jayson[_0xf3fc('0xa')][_0xf3fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43f8dd,_0x35c15e,_0x5c15c7){return new BPromise(function(_0x2a4f66,_0x1765a6){return client[_0xf3fc('0xc')](_0x43f8dd,_0x5c15c7)[_0xf3fc('0xd')](function(_0x473eb0){logger['info'](_0xf3fc('0xe'),_0x35c15e,'request\x20sent');logger['debug'](_0xf3fc('0xf'),_0x35c15e,'request\x20sent',JSON[_0xf3fc('0x10')](_0x473eb0));if(_0x473eb0[_0xf3fc('0x11')]){if(_0x473eb0[_0xf3fc('0x11')][_0xf3fc('0x12')]===0x1f4){logger[_0xf3fc('0x11')](_0xf3fc('0xe'),_0x35c15e,_0x473eb0[_0xf3fc('0x11')][_0xf3fc('0x13')]);return _0x1765a6(_0x473eb0[_0xf3fc('0x11')][_0xf3fc('0x13')]);}logger[_0xf3fc('0x11')](_0xf3fc('0xe'),_0x35c15e,_0x473eb0['error']['message']);return _0x2a4f66(_0x473eb0[_0xf3fc('0x11')][_0xf3fc('0x13')]);}else{logger[_0xf3fc('0x14')](_0xf3fc('0xe'),_0x35c15e,_0xf3fc('0x15'));_0x2a4f66(_0x473eb0[_0xf3fc('0x16')][_0xf3fc('0x13')]);}})['catch'](function(_0x29f086){logger[_0xf3fc('0x11')]('ServicenowField,\x20%s,\x20%s',_0x35c15e,_0x29f086);_0x1765a6(_0x29f086);});});} \ No newline at end of file +var _0x5cd4=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','randomstring','ioredis'];(function(_0x1709e7,_0x2ced21){var _0x402819=function(_0x3637a0){while(--_0x3637a0){_0x1709e7['push'](_0x1709e7['shift']());}};_0x402819(++_0x2ced21);}(_0x5cd4,0x161));var _0x45cd=function(_0x4d20b0,_0x2affad){_0x4d20b0=_0x4d20b0-0x0;var _0x1c6c8b=_0x5cd4[_0x4d20b0];return _0x1c6c8b;};'use strict';var _=require('lodash');var util=require(_0x45cd('0x0'));var moment=require(_0x45cd('0x1'));var BPromise=require('bluebird');var rs=require(_0x45cd('0x2'));var fs=require('fs');var Redis=require(_0x45cd('0x3'));var db=require(_0x45cd('0x4'))['db'];var utils=require(_0x45cd('0x5'));var logger=require(_0x45cd('0x6'))(_0x45cd('0x7'));var config=require('../../config/environment');var jayson=require(_0x45cd('0x8'));var client=jayson[_0x45cd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31892d,_0x358e48,_0x7ceff0){return new BPromise(function(_0x525472,_0xfbecb){return client[_0x45cd('0xa')](_0x31892d,_0x7ceff0)[_0x45cd('0xb')](function(_0x29aa76){logger[_0x45cd('0xc')](_0x45cd('0xd'),_0x358e48,_0x45cd('0xe'));logger[_0x45cd('0xf')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x358e48,_0x45cd('0xe'),JSON[_0x45cd('0x10')](_0x29aa76));if(_0x29aa76[_0x45cd('0x11')]){if(_0x29aa76[_0x45cd('0x11')][_0x45cd('0x12')]===0x1f4){logger[_0x45cd('0x11')](_0x45cd('0xd'),_0x358e48,_0x29aa76[_0x45cd('0x11')]['message']);return _0xfbecb(_0x29aa76[_0x45cd('0x11')][_0x45cd('0x13')]);}logger[_0x45cd('0x11')]('ServicenowField,\x20%s,\x20%s',_0x358e48,_0x29aa76[_0x45cd('0x11')][_0x45cd('0x13')]);return _0x525472(_0x29aa76['error']['message']);}else{logger[_0x45cd('0xc')](_0x45cd('0xd'),_0x358e48,_0x45cd('0xe'));_0x525472(_0x29aa76['result'][_0x45cd('0x13')]);}})[_0x45cd('0x14')](function(_0x55fc61){logger[_0x45cd('0x11')](_0x45cd('0xd'),_0x358e48,_0x55fc61);_0xfbecb(_0x55fc61);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index aaa4d61..7d1fd13 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 _0xc7c7=['../../config/environment','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x45f183,_0x1dbf1d){var _0x1d39b3=function(_0x3beb67){while(--_0x3beb67){_0x45f183['push'](_0x45f183['shift']());}};_0x1d39b3(++_0x1dbf1d);}(_0xc7c7,0xb0));var _0x7c7c=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0xc7c7[_0x2ca9d4];return _0x258956;};'use strict';var multer=require(_0x7c7c('0x0'));var util=require(_0x7c7c('0x1'));var path=require(_0x7c7c('0x2'));var timeout=require(_0x7c7c('0x3'));var express=require(_0x7c7c('0x4'));var router=express[_0x7c7c('0x5')]();var auth=require(_0x7c7c('0x6'));var interaction=require(_0x7c7c('0x7'));var config=require(_0x7c7c('0x8'));var controller=require('./intSugarcrmAccount.controller');router['get']('/',auth[_0x7c7c('0x9')](),controller[_0x7c7c('0xa')]);router[_0x7c7c('0xb')](_0x7c7c('0xc'),auth[_0x7c7c('0x9')](),controller[_0x7c7c('0xd')]);router['get'](_0x7c7c('0xe'),auth[_0x7c7c('0x9')](),controller[_0x7c7c('0xf')]);router[_0x7c7c('0xb')](_0x7c7c('0x10'),auth[_0x7c7c('0x9')](),controller[_0x7c7c('0x11')]);router[_0x7c7c('0x12')]('/',auth[_0x7c7c('0x9')](),controller['create']);router[_0x7c7c('0x12')](_0x7c7c('0xe'),auth[_0x7c7c('0x9')](),controller['addConfiguration']);router[_0x7c7c('0x13')](_0x7c7c('0xc'),auth[_0x7c7c('0x9')](),controller[_0x7c7c('0x14')]);router[_0x7c7c('0x15')]('/:id',auth[_0x7c7c('0x9')](),controller[_0x7c7c('0x16')]);module['exports']=router; \ No newline at end of file +var _0x59f4=['connect-timeout','Router','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','update','delete','util','path'];(function(_0x2f8e73,_0xd4ca8d){var _0x14c227=function(_0x263b17){while(--_0x263b17){_0x2f8e73['push'](_0x2f8e73['shift']());}};_0x14c227(++_0xd4ca8d);}(_0x59f4,0x83));var _0x459f=function(_0x56608c,_0x29eb74){_0x56608c=_0x56608c-0x0;var _0x3c7fb0=_0x59f4[_0x56608c];return _0x3c7fb0;};'use strict';var multer=require('multer');var util=require(_0x459f('0x0'));var path=require(_0x459f('0x1'));var timeout=require(_0x459f('0x2'));var express=require('express');var router=express[_0x459f('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmAccount.controller');router[_0x459f('0x4')]('/',auth[_0x459f('0x5')](),controller[_0x459f('0x6')]);router[_0x459f('0x4')](_0x459f('0x7'),auth['isAuthenticated'](),controller[_0x459f('0x8')]);router['get']('/:id/configurations',auth[_0x459f('0x5')](),controller[_0x459f('0x9')]);router[_0x459f('0x4')](_0x459f('0xa'),auth[_0x459f('0x5')](),controller[_0x459f('0xb')]);router['post']('/',auth[_0x459f('0x5')](),controller[_0x459f('0xc')]);router[_0x459f('0xd')](_0x459f('0xe'),auth['isAuthenticated'](),controller[_0x459f('0xf')]);router[_0x459f('0x10')]('/:id',auth[_0x459f('0x5')](),controller[_0x459f('0x11')]);router[_0x459f('0x12')](_0x459f('0x7'),auth[_0x459f('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 8cb6837..15c7a6c 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 _0xed21=['username','remoteUri','exports','STRING'];(function(_0x4e4e1c,_0x5c8da5){var _0x10e6e4=function(_0x55d69e){while(--_0x55d69e){_0x4e4e1c['push'](_0x4e4e1c['shift']());}};_0x10e6e4(++_0x5c8da5);}(_0xed21,0x166));var _0x1ed2=function(_0x56b76e,_0x3594fd){_0x56b76e=_0x56b76e-0x0;var _0x3c3b2e=_0xed21[_0x56b76e];return _0x3c3b2e;};'use strict';var Sequelize=require('sequelize');module[_0x1ed2('0x0')]={'name':{'type':Sequelize[_0x1ed2('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x1ed2('0x2')},'password':{'type':Sequelize[_0x1ed2('0x1')]},'remoteUri':{'type':Sequelize[_0x1ed2('0x1')],'unique':_0x1ed2('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb453=['username','remoteUri','sequelize','exports','STRING'];(function(_0x3cbfa2,_0x4b37cd){var _0x28938d=function(_0x45f105){while(--_0x45f105){_0x3cbfa2['push'](_0x3cbfa2['shift']());}};_0x28938d(++_0x4b37cd);}(_0xb453,0x12e));var _0x3b45=function(_0x1c3931,_0x531246){_0x1c3931=_0x1c3931-0x0;var _0x14d750=_0xb453[_0x1c3931];return _0x14d750;};'use strict';var Sequelize=require(_0x3b45('0x0'));module[_0x3b45('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3b45('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x3b45('0x3')},'password':{'type':Sequelize[_0x3b45('0x2')]},'remoteUri':{'type':Sequelize[_0x3b45('0x2')],'unique':_0x3b45('0x4')},'serverUrl':{'type':Sequelize[_0x3b45('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index ce96c88..e18c0de 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 _0x6242=['AccountId','getSubjects','channel','Subjects','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','format','login','JSON','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','/service/v4_1/rest.php','Calls','values','module_fields','remove','includes','label','endsWith','value','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','squel','crypto','desk.js','to-csv','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','update','then','end','name','send','SugarcrmAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','show','params','keys','include','find','create','body','destroy','getConfigurations','findOne','SugarcrmConfiguration'];(function(_0x5c3904,_0x4d9a96){var _0x2cd01c=function(_0x2d359b){while(--_0x2d359b){_0x5c3904['push'](_0x5c3904['shift']());}};_0x2cd01c(++_0x4d9a96);}(_0x6242,0x1a8));var _0x2624=function(_0x56cece,_0x429103){_0x56cece=_0x56cece-0x0;var _0x17ff41=_0x6242[_0x56cece];return _0x17ff41;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2624('0x0'));var rimraf=require(_0x2624('0x1'));var zipdir=require(_0x2624('0x2'));var jsonpatch=require(_0x2624('0x3'));var rp=require('request-promise');var moment=require(_0x2624('0x4'));var BPromise=require(_0x2624('0x5'));var Mustache=require(_0x2624('0x6'));var util=require(_0x2624('0x7'));var path=require(_0x2624('0x8'));var sox=require(_0x2624('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2624('0xa'));var crypto=require(_0x2624('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2624('0xc'));var toCsv=require(_0x2624('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2624('0xe'));var as=require(_0x2624('0xf'));var hardwareService=require(_0x2624('0x10'));var logger=require(_0x2624('0x11'))(_0x2624('0x12'));var utils=require('../../config/utils');var config=require(_0x2624('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2624('0x14'));var jayson=require(_0x2624('0x15'));var client=jayson[_0x2624('0x16')]['http']({'port':0x232a});function checkPasswordPattern(_0xb22d86,_0x347657,_0x49c7fb){if(_0x49c7fb){var _0x4de49a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4de49a[_0x2624('0x17')](_0x347657)){return _0xb22d86;}else{throw new db[(_0x2624('0x18'))]['ValidationError'](_0x2624('0x19'));}}else{return _0xb22d86;}}function respondWithRpcPromise(_0xc1cd6a,_0x31cc1c,_0x2e7d20,_0x470fc2){return new BPromise(function(_0x2ca130,_0x5149cb){var _0x2a882a=_0x470fc2||client;return _0x2a882a[_0x2624('0x1a')](_0xc1cd6a,_0x2e7d20)['then'](function(_0x5cc862){logger[_0x2624('0x1b')](_0x2624('0x1c'),_0x31cc1c,_0x2624('0x1d'));logger['debug'](_0x2624('0x1e'),_0x31cc1c,_0x2624('0x1d'),JSON[_0x2624('0x1f')](_0x5cc862));if(_0x5cc862[_0x2624('0x20')]){if(_0x5cc862[_0x2624('0x20')][_0x2624('0x21')]===0x1f4){logger[_0x2624('0x20')]('SugarcrmAccount,\x20%s,\x20%s',_0x31cc1c,_0x5cc862['error']['message']);return _0x5149cb(_0x5cc862['error'][_0x2624('0x22')]);}logger['error'](_0x2624('0x1c'),_0x31cc1c,_0x5cc862['error'][_0x2624('0x22')]);return _0x2ca130(_0x5cc862['error'][_0x2624('0x22')]);}else{logger[_0x2624('0x1b')]('SugarcrmAccount,\x20%s,\x20%s',_0x31cc1c,_0x2624('0x1d'));_0x2ca130(_0x5cc862[_0x2624('0x23')][_0x2624('0x22')]);}})[_0x2624('0x24')](function(_0xbe570f){logger[_0x2624('0x20')]('SugarcrmAccount,\x20%s,\x20%s',_0x31cc1c,_0xbe570f);_0x5149cb(_0xbe570f);});});}function respondWithStatusCode(_0x42eaaf,_0x26b912){_0x26b912=_0x26b912||0xcc;return function(_0x5d79ce){if(_0x5d79ce){return _0x42eaaf[_0x2624('0x25')](_0x26b912);}return _0x42eaaf[_0x2624('0x26')](_0x26b912)['end']();};}function respondWithResult(_0x2290af,_0x5c5d79){_0x5c5d79=_0x5c5d79||0xc8;return function(_0x24ee2c){if(_0x24ee2c){return _0x2290af[_0x2624('0x26')](_0x5c5d79)[_0x2624('0x27')](_0x24ee2c);}};}function respondWithFilteredResult(_0x570397,_0x11e858){return function(_0x191790){if(_0x191790){var _0x2a48a1=_0x191790[_0x2624('0x28')],_0x1c9c02=_0x11e858[_0x2624('0x29')],_0x21fa0c=_0x11e858[_0x2624('0x29')]+_0x11e858['limit'],_0x468253;if(_0x21fa0c>=_0x2a48a1){_0x21fa0c=_0x2a48a1;_0x468253=0xc8;}else{_0x468253=0xce;}_0x570397[_0x2624('0x26')](_0x468253);return _0x570397[_0x2624('0x2a')](_0x2624('0x2b'),_0x1c9c02+'-'+_0x21fa0c+'/'+_0x2a48a1)[_0x2624('0x27')](_0x191790);}return null;};}function patchUpdates(_0x14ce77){return function(_0x22aa4c){try{jsonpatch[_0x2624('0x2c')](_0x22aa4c,_0x14ce77,!![]);}catch(_0x5b493f){return BPromise[_0x2624('0x2d')](_0x5b493f);}return _0x22aa4c['save']();};}function saveUpdates(_0x1c772,_0x41a61e){return function(_0x102902){if(_0x102902){return _0x102902[_0x2624('0x2e')](_0x1c772)['then'](function(_0x1049e6){return _0x1049e6;});}return null;};}function removeEntity(_0x4e3044,_0x516fa5){return function(_0x999d15){if(_0x999d15){return _0x999d15['destroy']()[_0x2624('0x2f')](function(){_0x4e3044[_0x2624('0x26')](0xcc)[_0x2624('0x30')]();});}};}function handleEntityNotFound(_0x247aeb,_0x31b1b8){return function(_0x44793a){if(!_0x44793a){_0x247aeb[_0x2624('0x25')](0x194);}return _0x44793a;};}function handleError(_0x718b34,_0x3fb2c0){_0x3fb2c0=_0x3fb2c0||0x1f4;return function(_0x5d6a13){logger[_0x2624('0x20')](_0x5d6a13['stack']);if(_0x5d6a13[_0x2624('0x31')]){delete _0x5d6a13[_0x2624('0x31')];}_0x718b34[_0x2624('0x26')](_0x3fb2c0)[_0x2624('0x32')](_0x5d6a13);};}exports['index']=function(_0x34b02a,_0x204662){var _0x3444c7={},_0x16cf90={},_0x429ecf={'count':0x0,'rows':[]};var _0x1ce364=_['map'](db[_0x2624('0x33')][_0x2624('0x34')],function(_0x156edc){return{'name':_0x156edc[_0x2624('0x35')],'type':_0x156edc[_0x2624('0x36')][_0x2624('0x37')]};});_0x16cf90[_0x2624('0x38')]=_[_0x2624('0x39')](_0x1ce364,_0x2624('0x31'));_0x16cf90['query']=_['keys'](_0x34b02a[_0x2624('0x3a')]);_0x16cf90[_0x2624('0x3b')]=_[_0x2624('0x3c')](_0x16cf90[_0x2624('0x38')],_0x16cf90[_0x2624('0x3a')]);_0x3444c7[_0x2624('0x3d')]=_[_0x2624('0x3c')](_0x16cf90[_0x2624('0x38')],qs[_0x2624('0x3e')](_0x34b02a[_0x2624('0x3a')]['fields']));_0x3444c7['attributes']=_0x3444c7['attributes'][_0x2624('0x3f')]?_0x3444c7[_0x2624('0x3d')]:_0x16cf90[_0x2624('0x38')];if(!_0x34b02a['query'][_0x2624('0x40')](_0x2624('0x41'))){_0x3444c7[_0x2624('0x42')]=qs[_0x2624('0x42')](_0x34b02a['query'][_0x2624('0x42')]);_0x3444c7[_0x2624('0x29')]=qs[_0x2624('0x29')](_0x34b02a[_0x2624('0x3a')][_0x2624('0x29')]);}_0x3444c7[_0x2624('0x43')]=qs[_0x2624('0x44')](_0x34b02a[_0x2624('0x3a')][_0x2624('0x44')]);_0x3444c7[_0x2624('0x45')]=qs[_0x2624('0x3b')](_[_0x2624('0x46')](_0x34b02a[_0x2624('0x3a')],_0x16cf90['filters']));if(_0x34b02a[_0x2624('0x3a')]['filter']){_0x3444c7[_0x2624('0x45')]=_[_0x2624('0x47')](_0x3444c7[_0x2624('0x45')],{'$or':_[_0x2624('0x39')](_0x1ce364,function(_0x4f34a8){if(_0x4f34a8['type']!==_0x2624('0x48')){var _0x33f1f0={};_0x33f1f0[_0x4f34a8['name']]={'$like':'%'+_0x34b02a[_0x2624('0x3a')][_0x2624('0x49')]+'%'};return _0x33f1f0;}})});}_0x3444c7=_[_0x2624('0x47')]({},_0x3444c7,_0x34b02a[_0x2624('0x4a')]);var _0x4955be={'where':_0x3444c7[_0x2624('0x45')]};return db['SugarcrmAccount'][_0x2624('0x28')](_0x4955be)[_0x2624('0x2f')](function(_0x20ab43){_0x429ecf[_0x2624('0x28')]=_0x20ab43;if(_0x34b02a[_0x2624('0x3a')][_0x2624('0x4b')]){_0x3444c7['include']=[{'all':!![]}];}return db['SugarcrmAccount']['findAll'](_0x3444c7);})[_0x2624('0x2f')](function(_0x109df5){_0x429ecf[_0x2624('0x4c')]=_0x109df5;return _0x429ecf;})[_0x2624('0x2f')](respondWithFilteredResult(_0x204662,_0x3444c7))[_0x2624('0x24')](handleError(_0x204662,null));};exports[_0x2624('0x4d')]=function(_0x53619b,_0x1db8a4){var _0x82ba60={'raw':![],'where':{'id':_0x53619b[_0x2624('0x4e')]['id']}},_0x51e659={};_0x51e659[_0x2624('0x38')]=_[_0x2624('0x4f')](db[_0x2624('0x33')]['rawAttributes']);_0x51e659[_0x2624('0x3a')]=_[_0x2624('0x4f')](_0x53619b[_0x2624('0x3a')]);_0x51e659['filters']=_[_0x2624('0x3c')](_0x51e659['model'],_0x51e659['query']);_0x82ba60['attributes']=_[_0x2624('0x3c')](_0x51e659[_0x2624('0x38')],qs[_0x2624('0x3e')](_0x53619b[_0x2624('0x3a')][_0x2624('0x3e')]));_0x82ba60['attributes']=_0x82ba60[_0x2624('0x3d')][_0x2624('0x3f')]?_0x82ba60[_0x2624('0x3d')]:_0x51e659['model'];if(_0x53619b[_0x2624('0x3a')][_0x2624('0x4b')]){_0x82ba60[_0x2624('0x50')]=[{'all':!![]}];}_0x82ba60=_[_0x2624('0x47')]({},_0x82ba60,_0x53619b[_0x2624('0x4a')]);return db[_0x2624('0x33')][_0x2624('0x51')](_0x82ba60)[_0x2624('0x2f')](handleEntityNotFound(_0x1db8a4,null))[_0x2624('0x2f')](respondWithResult(_0x1db8a4,null))[_0x2624('0x24')](handleError(_0x1db8a4,null));};exports[_0x2624('0x52')]=function(_0x5c6fc5,_0x480142){return db[_0x2624('0x33')][_0x2624('0x52')](_0x5c6fc5[_0x2624('0x53')],{})[_0x2624('0x2f')](respondWithResult(_0x480142,0xc9))['catch'](handleError(_0x480142,null));};exports[_0x2624('0x2e')]=function(_0x332ba0,_0x45c47f){if(_0x332ba0[_0x2624('0x53')]['id']){delete _0x332ba0[_0x2624('0x53')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x332ba0[_0x2624('0x4e')]['id']}})[_0x2624('0x2f')](handleEntityNotFound(_0x45c47f,null))[_0x2624('0x2f')](saveUpdates(_0x332ba0[_0x2624('0x53')],null))['then'](respondWithResult(_0x45c47f,null))[_0x2624('0x24')](handleError(_0x45c47f,null));};exports[_0x2624('0x54')]=function(_0x4a23a7,_0x5947ff){return db[_0x2624('0x33')]['find']({'where':{'id':_0x4a23a7[_0x2624('0x4e')]['id']}})[_0x2624('0x2f')](handleEntityNotFound(_0x5947ff,null))[_0x2624('0x2f')](removeEntity(_0x5947ff,null))[_0x2624('0x24')](handleError(_0x5947ff,null));};exports[_0x2624('0x55')]=function(_0x4ed387,_0x4bc6cb,_0x2a8953){var _0x39b983={};var _0x4174e6={};var _0x1bd875;var _0x2ab1ba;return db[_0x2624('0x33')][_0x2624('0x56')]({'where':{'id':_0x4ed387['params']['id']}})[_0x2624('0x2f')](handleEntityNotFound(_0x4bc6cb,null))[_0x2624('0x2f')](function(_0x43e3f0){if(_0x43e3f0){_0x1bd875=_0x43e3f0;_0x4174e6[_0x2624('0x38')]=_[_0x2624('0x4f')](db[_0x2624('0x57')][_0x2624('0x34')]);_0x4174e6['query']=_[_0x2624('0x4f')](_0x4ed387[_0x2624('0x3a')]);_0x4174e6[_0x2624('0x3b')]=_['intersection'](_0x4174e6[_0x2624('0x38')],_0x4174e6[_0x2624('0x3a')]);_0x39b983[_0x2624('0x3d')]=_[_0x2624('0x3c')](_0x4174e6[_0x2624('0x38')],qs['fields'](_0x4ed387['query']['fields']));_0x39b983[_0x2624('0x3d')]=_0x39b983[_0x2624('0x3d')]['length']?_0x39b983[_0x2624('0x3d')]:_0x4174e6[_0x2624('0x38')];_0x39b983[_0x2624('0x43')]=qs[_0x2624('0x44')](_0x4ed387[_0x2624('0x3a')][_0x2624('0x44')]);_0x39b983[_0x2624('0x45')]=qs['filters'](_[_0x2624('0x46')](_0x4ed387[_0x2624('0x3a')],_0x4174e6[_0x2624('0x3b')]));if(_0x4ed387[_0x2624('0x3a')][_0x2624('0x49')]){_0x39b983['where']=_['merge'](_0x39b983[_0x2624('0x45')],{'$or':_[_0x2624('0x39')](_0x39b983[_0x2624('0x3d')],function(_0x57da6c){var _0x355420={};_0x355420[_0x57da6c]={'$like':'%'+_0x4ed387[_0x2624('0x3a')][_0x2624('0x49')]+'%'};return _0x355420;})});}_0x39b983=_[_0x2624('0x47')]({},_0x39b983,_0x4ed387[_0x2624('0x4a')]);return _0x1bd875[_0x2624('0x55')](_0x39b983);}})[_0x2624('0x2f')](function(_0x1ed5d1){if(_0x1ed5d1){_0x2ab1ba=_0x1ed5d1[_0x2624('0x3f')];if(!_0x4ed387['query'][_0x2624('0x40')](_0x2624('0x41'))){_0x39b983['limit']=qs[_0x2624('0x42')](_0x4ed387[_0x2624('0x3a')][_0x2624('0x42')]);_0x39b983[_0x2624('0x29')]=qs[_0x2624('0x29')](_0x4ed387[_0x2624('0x3a')][_0x2624('0x29')]);}return _0x1bd875['getConfigurations'](_0x39b983);}})[_0x2624('0x2f')](function(_0xef4334){if(_0xef4334){return _0xef4334?{'count':_0x2ab1ba,'rows':_0xef4334}:null;}})['then'](respondWithResult(_0x4bc6cb,null))[_0x2624('0x24')](handleError(_0x4bc6cb,null));};exports['addConfiguration']=function(_0x3a021d,_0xfaa7c8,_0x565dec){if(_0x3a021d[_0x2624('0x53')]['id']){delete _0x3a021d[_0x2624('0x53')]['id'];}return db[_0x2624('0x33')][_0x2624('0x56')]({'where':{'id':_0x3a021d[_0x2624('0x4e')]['id']}})['then'](handleEntityNotFound(_0xfaa7c8,null))[_0x2624('0x2f')](function(_0xb5d92a){if(_0xb5d92a){_0x3a021d[_0x2624('0x53')][_0x2624('0x58')]=_0xb5d92a['id'];_0x3a021d[_0x2624('0x53')]['Subjects']=integrations[_0x2624('0x59')](_0x3a021d[_0x2624('0x53')][_0x2624('0x5a')],_0x3a021d[_0x2624('0x53')]['type']);_0x3a021d['body']['Descriptions']=integrations['getDescriptions'](_0x3a021d[_0x2624('0x53')][_0x2624('0x5a')],_0x3a021d[_0x2624('0x53')][_0x2624('0x36')]);return db[_0x2624('0x57')][_0x2624('0x52')](_0x3a021d[_0x2624('0x53')],{'include':[{'model':db['SugarcrmField'],'as':_0x2624('0x5b')},{'model':db[_0x2624('0x5c')],'as':_0x2624('0x5d')}]});}return null;})[_0x2624('0x2f')](respondWithResult(_0xfaa7c8,null))[_0x2624('0x24')](handleError(_0xfaa7c8,null));};exports[_0x2624('0x5e')]=function(_0x56a0d4,_0x28c7b6,_0x1a48a2){var _0x5e7548='';var _0x22f479=['id','name',_0x2624('0x5f'),_0x2624('0x60'),_0x2624('0x61'),_0x2624('0x62'),_0x2624('0x63'),_0x2624('0x64'),_0x2624('0x65'),_0x2624('0x66'),_0x2624('0x67'),_0x2624('0x68')];return db[_0x2624('0x33')][_0x2624('0x56')]({'where':{'id':_0x56a0d4[_0x2624('0x4e')]['id']},'attributes':['id',_0x2624('0x69'),_0x2624('0x6a'),_0x2624('0x6b')]})[_0x2624('0x2f')](handleEntityNotFound(_0x28c7b6,null))[_0x2624('0x2f')](function(_0x2fa12d){if(_0x2fa12d){_0x5e7548=_0x2fa12d['remoteUri'];var _0x2b1712=_0x5e7548[_0x2624('0x6c')](-0x1);if(_0x2b1712==='/'){_0x5e7548=_0x5e7548[_0x2624('0x6d')](0x0,_0x5e7548['lastIndexOf'](_0x2b1712));}return rp({'method':'POST','uri':util[_0x2624('0x6e')]('%s%s',_0x5e7548,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x2624('0x6f'),'input_type':_0x2624('0x70'),'response_type':'JSON','rest_data':JSON[_0x2624('0x1f')]({'user_auth':{'user_name':_0x2fa12d[_0x2624('0x69')],'password':_0x2fa12d[_0x2624('0x6a')],'encryption':'PLAIN'},'application':_0x2624('0x71')})}});}})[_0x2624('0x2f')](function(_0x50098a){if(_0x50098a&&_0x50098a[_0x2624('0x31')]!==_0x2624('0x72')&&_0x50098a[_0x2624('0x31')]!==_0x2624('0x73')){return rp({'method':'POST','uri':util[_0x2624('0x6e')](_0x2624('0x74'),_0x5e7548,_0x2624('0x75')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x2624('0x70'),'response_type':_0x2624('0x70'),'rest_data':JSON[_0x2624('0x1f')]({'session':_0x50098a['id'],'module_name':_0x2624('0x76')})}})[_0x2624('0x2f')](function(_0x698e28){if(_0x698e28){var _0x56ff2c=_[_0x2624('0x77')](_0x698e28[_0x2624('0x78')]);_[_0x2624('0x79')](_0x56ff2c,function(_0xbc3f8f){return _0x22f479[_0x2624('0x7a')](_0xbc3f8f[_0x2624('0x31')]);});return{'count':_0x56ff2c[_0x2624('0x3f')],'rows':_[_0x2624('0x39')](_0x56ff2c,function(_0x174cad){return{'id':_0x174cad[_0x2624('0x31')],'name':_0x174cad[_0x2624('0x7b')],'custom':_[_0x2624('0x7c')](_0x174cad[_0x2624('0x31')],'_c')?!![]:![],'options':_0x174cad[_0x2624('0x4a')]?_['map'](_[_0x2624('0x77')](_0x174cad[_0x2624('0x4a')]),function(_0x22e63d){return{'name':_0x22e63d[_0x2624('0x7d')],'value':_0x22e63d[_0x2624('0x31')]};}):[]};})};}})[_0x2624('0x2f')](respondWithResult(_0x28c7b6,null))[_0x2624('0x24')](function(_0x4a45c6){var _0x34df14=_0x56a0d4[_0x2624('0x3a')][_0x2624('0x17')]?0x1f4:_0x4a45c6[_0x2624('0x7e')]||0x1f4;logger[_0x2624('0x20')]('getFields,\x20%s,\x20%s,\x20%s',_0x2624('0x5e'),_0x34df14,JSON['stringify'](_0x4a45c6));delete _0x4a45c6[_0x2624('0x31')];if(_0x34df14===0x191){_0x34df14=0x190;}_0x28c7b6[_0x2624('0x26')](_0x34df14)[_0x2624('0x32')](_0x56a0d4[_0x2624('0x3a')][_0x2624('0x17')]?{'message':_0x2624('0x7f'),'statusCode':_0x4a45c6[_0x2624('0x7e')]}:_0x4a45c6);});}else{var _0x3d8526=0x1f4;_0x28c7b6[_0x2624('0x26')](_0x3d8526)[_0x2624('0x32')]({'message':_0x2624('0x7f'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x07a8=['request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','apply','save','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','include','length','includeAll','find','create','body','update','params','destroy','getConfigurations','findOne','SugarcrmConfiguration','options','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getFields','assigned_user_id','description','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','password','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','get_module_fields','values','module_fields','includes','label','value','test','statusCode','Wrong\x20credentials','send','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x07a8,0x81));var _0x807a=function(_0x22fc0e,_0xd70a5f){_0x22fc0e=_0x22fc0e-0x0;var _0xc91adf=_0x07a8[_0x22fc0e];return _0xc91adf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x807a('0x0'));var rimraf=require(_0x807a('0x1'));var zipdir=require(_0x807a('0x2'));var jsonpatch=require(_0x807a('0x3'));var rp=require(_0x807a('0x4'));var moment=require(_0x807a('0x5'));var BPromise=require(_0x807a('0x6'));var Mustache=require(_0x807a('0x7'));var util=require(_0x807a('0x8'));var path=require(_0x807a('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x807a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x807a('0xb'));var crypto=require(_0x807a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x807a('0xd'));var toCsv=require(_0x807a('0xe'));var querystring=require('querystring');var Papa=require(_0x807a('0xf'));var Redis=require(_0x807a('0x10'));var authService=require(_0x807a('0x11'));var qs=require(_0x807a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x807a('0x13'))(_0x807a('0x14'));var utils=require(_0x807a('0x15'));var config=require(_0x807a('0x16'));var db=require(_0x807a('0x17'))['db'];var integrations=require(_0x807a('0x18'));var jayson=require(_0x807a('0x19'));var client=jayson[_0x807a('0x1a')][_0x807a('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x38d978,_0x2b44d9,_0x5699a4){if(_0x5699a4){var _0x27ab94=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x27ab94['test'](_0x2b44d9)){return _0x38d978;}else{throw new db[(_0x807a('0x1c'))][(_0x807a('0x1d'))](_0x807a('0x1e'));}}else{return _0x38d978;}}function respondWithRpcPromise(_0x50cca6,_0x52c587,_0x58ac5e,_0x10fadb){return new BPromise(function(_0x46d771,_0x22c233){var _0x11566c=_0x10fadb||client;return _0x11566c[_0x807a('0x1f')](_0x50cca6,_0x58ac5e)[_0x807a('0x20')](function(_0x164c2a){logger[_0x807a('0x21')]('SugarcrmAccount,\x20%s,\x20%s',_0x52c587,_0x807a('0x22'));logger[_0x807a('0x23')](_0x807a('0x24'),_0x52c587,_0x807a('0x22'),JSON['stringify'](_0x164c2a));if(_0x164c2a['error']){if(_0x164c2a[_0x807a('0x25')][_0x807a('0x26')]===0x1f4){logger[_0x807a('0x25')](_0x807a('0x27'),_0x52c587,_0x164c2a[_0x807a('0x25')]['message']);return _0x22c233(_0x164c2a[_0x807a('0x25')]['message']);}logger[_0x807a('0x25')](_0x807a('0x27'),_0x52c587,_0x164c2a[_0x807a('0x25')][_0x807a('0x28')]);return _0x46d771(_0x164c2a['error'][_0x807a('0x28')]);}else{logger['info'](_0x807a('0x27'),_0x52c587,_0x807a('0x22'));_0x46d771(_0x164c2a[_0x807a('0x29')][_0x807a('0x28')]);}})[_0x807a('0x2a')](function(_0x20cd8b){logger[_0x807a('0x25')]('SugarcrmAccount,\x20%s,\x20%s',_0x52c587,_0x20cd8b);_0x22c233(_0x20cd8b);});});}function respondWithStatusCode(_0x32ed4f,_0x296b5d){_0x296b5d=_0x296b5d||0xcc;return function(_0x3915fd){if(_0x3915fd){return _0x32ed4f[_0x807a('0x2b')](_0x296b5d);}return _0x32ed4f[_0x807a('0x2c')](_0x296b5d)[_0x807a('0x2d')]();};}function respondWithResult(_0xdbb3e8,_0x21797f){_0x21797f=_0x21797f||0xc8;return function(_0x1aa65e){if(_0x1aa65e){return _0xdbb3e8[_0x807a('0x2c')](_0x21797f)['json'](_0x1aa65e);}};}function respondWithFilteredResult(_0x2ead9b,_0x4095f7){return function(_0x2897e3){if(_0x2897e3){var _0x5577f3=_0x2897e3[_0x807a('0x2e')],_0x4301ed=_0x4095f7[_0x807a('0x2f')],_0x2fe263=_0x4095f7[_0x807a('0x2f')]+_0x4095f7['limit'],_0x39a81b;if(_0x2fe263>=_0x5577f3){_0x2fe263=_0x5577f3;_0x39a81b=0xc8;}else{_0x39a81b=0xce;}_0x2ead9b[_0x807a('0x2c')](_0x39a81b);return _0x2ead9b[_0x807a('0x30')](_0x807a('0x31'),_0x4301ed+'-'+_0x2fe263+'/'+_0x5577f3)[_0x807a('0x32')](_0x2897e3);}return null;};}function patchUpdates(_0x26badd){return function(_0x5259c1){try{jsonpatch[_0x807a('0x33')](_0x5259c1,_0x26badd,!![]);}catch(_0x98508a){return BPromise['reject'](_0x98508a);}return _0x5259c1[_0x807a('0x34')]();};}function saveUpdates(_0x19b9a8,_0xa5f7a3){return function(_0x19db7e){if(_0x19db7e){return _0x19db7e['update'](_0x19b9a8)[_0x807a('0x20')](function(_0x35063c){return _0x35063c;});}return null;};}function removeEntity(_0x51fea0,_0x5c465c){return function(_0x523f41){if(_0x523f41){return _0x523f41['destroy']()[_0x807a('0x20')](function(){_0x51fea0[_0x807a('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c1674,_0x59e4e7){return function(_0xb9c469){if(!_0xb9c469){_0x1c1674[_0x807a('0x2b')](0x194);}return _0xb9c469;};}function handleError(_0x16f938,_0x1d33e3){_0x1d33e3=_0x1d33e3||0x1f4;return function(_0x4cc8e1){logger[_0x807a('0x25')](_0x4cc8e1[_0x807a('0x35')]);if(_0x4cc8e1[_0x807a('0x36')]){delete _0x4cc8e1[_0x807a('0x36')];}_0x16f938[_0x807a('0x2c')](_0x1d33e3)['send'](_0x4cc8e1);};}exports[_0x807a('0x37')]=function(_0x56822d,_0x1bb42d){var _0x17b85d={},_0x1d3889={},_0x5e4b1f={'count':0x0,'rows':[]};var _0x105975=_[_0x807a('0x38')](db[_0x807a('0x39')][_0x807a('0x3a')],function(_0xf9612){return{'name':_0xf9612[_0x807a('0x3b')],'type':_0xf9612[_0x807a('0x3c')][_0x807a('0x3d')]};});_0x1d3889['model']=_['map'](_0x105975,_0x807a('0x36'));_0x1d3889[_0x807a('0x3e')]=_[_0x807a('0x3f')](_0x56822d[_0x807a('0x3e')]);_0x1d3889[_0x807a('0x40')]=_[_0x807a('0x41')](_0x1d3889[_0x807a('0x42')],_0x1d3889[_0x807a('0x3e')]);_0x17b85d[_0x807a('0x43')]=_[_0x807a('0x41')](_0x1d3889[_0x807a('0x42')],qs[_0x807a('0x44')](_0x56822d[_0x807a('0x3e')][_0x807a('0x44')]));_0x17b85d[_0x807a('0x43')]=_0x17b85d[_0x807a('0x43')]['length']?_0x17b85d['attributes']:_0x1d3889[_0x807a('0x42')];if(!_0x56822d[_0x807a('0x3e')][_0x807a('0x45')](_0x807a('0x46'))){_0x17b85d[_0x807a('0x47')]=qs[_0x807a('0x47')](_0x56822d[_0x807a('0x3e')]['limit']);_0x17b85d[_0x807a('0x2f')]=qs[_0x807a('0x2f')](_0x56822d[_0x807a('0x3e')]['offset']);}_0x17b85d[_0x807a('0x48')]=qs[_0x807a('0x49')](_0x56822d[_0x807a('0x3e')]['sort']);_0x17b85d[_0x807a('0x4a')]=qs[_0x807a('0x40')](_[_0x807a('0x4b')](_0x56822d[_0x807a('0x3e')],_0x1d3889['filters']));if(_0x56822d[_0x807a('0x3e')][_0x807a('0x4c')]){_0x17b85d[_0x807a('0x4a')]=_[_0x807a('0x4d')](_0x17b85d[_0x807a('0x4a')],{'$or':_[_0x807a('0x38')](_0x105975,function(_0x223462){if(_0x223462[_0x807a('0x3c')]!==_0x807a('0x4e')){var _0x782e1b={};_0x782e1b[_0x223462['name']]={'$like':'%'+_0x56822d[_0x807a('0x3e')][_0x807a('0x4c')]+'%'};return _0x782e1b;}})});}_0x17b85d=_[_0x807a('0x4d')]({},_0x17b85d,_0x56822d['options']);var _0x3cdb85={'where':_0x17b85d['where']};return db['SugarcrmAccount'][_0x807a('0x2e')](_0x3cdb85)['then'](function(_0x4b22ba){_0x5e4b1f['count']=_0x4b22ba;if(_0x56822d[_0x807a('0x3e')]['includeAll']){_0x17b85d[_0x807a('0x4f')]=[{'all':!![]}];}return db['SugarcrmAccount']['findAll'](_0x17b85d);})[_0x807a('0x20')](function(_0x3de773){_0x5e4b1f['rows']=_0x3de773;return _0x5e4b1f;})[_0x807a('0x20')](respondWithFilteredResult(_0x1bb42d,_0x17b85d))[_0x807a('0x2a')](handleError(_0x1bb42d,null));};exports['show']=function(_0x446e4c,_0x4e697a){var _0x3363ef={'raw':![],'where':{'id':_0x446e4c['params']['id']}},_0x209b1c={};_0x209b1c[_0x807a('0x42')]=_['keys'](db['SugarcrmAccount'][_0x807a('0x3a')]);_0x209b1c[_0x807a('0x3e')]=_[_0x807a('0x3f')](_0x446e4c[_0x807a('0x3e')]);_0x209b1c['filters']=_[_0x807a('0x41')](_0x209b1c['model'],_0x209b1c[_0x807a('0x3e')]);_0x3363ef[_0x807a('0x43')]=_[_0x807a('0x41')](_0x209b1c[_0x807a('0x42')],qs['fields'](_0x446e4c[_0x807a('0x3e')][_0x807a('0x44')]));_0x3363ef[_0x807a('0x43')]=_0x3363ef[_0x807a('0x43')][_0x807a('0x50')]?_0x3363ef[_0x807a('0x43')]:_0x209b1c[_0x807a('0x42')];if(_0x446e4c['query'][_0x807a('0x51')]){_0x3363ef[_0x807a('0x4f')]=[{'all':!![]}];}_0x3363ef=_[_0x807a('0x4d')]({},_0x3363ef,_0x446e4c['options']);return db[_0x807a('0x39')][_0x807a('0x52')](_0x3363ef)[_0x807a('0x20')](handleEntityNotFound(_0x4e697a,null))[_0x807a('0x20')](respondWithResult(_0x4e697a,null))[_0x807a('0x2a')](handleError(_0x4e697a,null));};exports['create']=function(_0x2cf499,_0x1ea171){return db[_0x807a('0x39')][_0x807a('0x53')](_0x2cf499[_0x807a('0x54')],{})[_0x807a('0x20')](respondWithResult(_0x1ea171,0xc9))[_0x807a('0x2a')](handleError(_0x1ea171,null));};exports[_0x807a('0x55')]=function(_0x3358df,_0x2e2d6e){if(_0x3358df[_0x807a('0x54')]['id']){delete _0x3358df[_0x807a('0x54')]['id'];}return db[_0x807a('0x39')]['find']({'where':{'id':_0x3358df[_0x807a('0x56')]['id']}})[_0x807a('0x20')](handleEntityNotFound(_0x2e2d6e,null))[_0x807a('0x20')](saveUpdates(_0x3358df[_0x807a('0x54')],null))[_0x807a('0x20')](respondWithResult(_0x2e2d6e,null))['catch'](handleError(_0x2e2d6e,null));};exports[_0x807a('0x57')]=function(_0x83c120,_0x4f49d4){return db[_0x807a('0x39')]['find']({'where':{'id':_0x83c120['params']['id']}})[_0x807a('0x20')](handleEntityNotFound(_0x4f49d4,null))['then'](removeEntity(_0x4f49d4,null))[_0x807a('0x2a')](handleError(_0x4f49d4,null));};exports[_0x807a('0x58')]=function(_0x3ba4fe,_0x41da88,_0x4fd4a1){var _0x2ea6ed={};var _0x28ff64={};var _0x41044c;var _0x339560;return db[_0x807a('0x39')][_0x807a('0x59')]({'where':{'id':_0x3ba4fe[_0x807a('0x56')]['id']}})[_0x807a('0x20')](handleEntityNotFound(_0x41da88,null))[_0x807a('0x20')](function(_0x43ef58){if(_0x43ef58){_0x41044c=_0x43ef58;_0x28ff64[_0x807a('0x42')]=_['keys'](db[_0x807a('0x5a')][_0x807a('0x3a')]);_0x28ff64['query']=_[_0x807a('0x3f')](_0x3ba4fe['query']);_0x28ff64[_0x807a('0x40')]=_[_0x807a('0x41')](_0x28ff64[_0x807a('0x42')],_0x28ff64[_0x807a('0x3e')]);_0x2ea6ed[_0x807a('0x43')]=_[_0x807a('0x41')](_0x28ff64[_0x807a('0x42')],qs[_0x807a('0x44')](_0x3ba4fe['query']['fields']));_0x2ea6ed[_0x807a('0x43')]=_0x2ea6ed[_0x807a('0x43')][_0x807a('0x50')]?_0x2ea6ed[_0x807a('0x43')]:_0x28ff64['model'];_0x2ea6ed[_0x807a('0x48')]=qs['sort'](_0x3ba4fe['query'][_0x807a('0x49')]);_0x2ea6ed[_0x807a('0x4a')]=qs['filters'](_[_0x807a('0x4b')](_0x3ba4fe[_0x807a('0x3e')],_0x28ff64[_0x807a('0x40')]));if(_0x3ba4fe[_0x807a('0x3e')]['filter']){_0x2ea6ed[_0x807a('0x4a')]=_['merge'](_0x2ea6ed['where'],{'$or':_[_0x807a('0x38')](_0x2ea6ed[_0x807a('0x43')],function(_0x4ded8f){var _0x268fec={};_0x268fec[_0x4ded8f]={'$like':'%'+_0x3ba4fe[_0x807a('0x3e')][_0x807a('0x4c')]+'%'};return _0x268fec;})});}_0x2ea6ed=_[_0x807a('0x4d')]({},_0x2ea6ed,_0x3ba4fe[_0x807a('0x5b')]);return _0x41044c[_0x807a('0x58')](_0x2ea6ed);}})[_0x807a('0x20')](function(_0x12a800){if(_0x12a800){_0x339560=_0x12a800[_0x807a('0x50')];if(!_0x3ba4fe[_0x807a('0x3e')][_0x807a('0x45')](_0x807a('0x46'))){_0x2ea6ed[_0x807a('0x47')]=qs[_0x807a('0x47')](_0x3ba4fe['query']['limit']);_0x2ea6ed['offset']=qs[_0x807a('0x2f')](_0x3ba4fe['query'][_0x807a('0x2f')]);}return _0x41044c[_0x807a('0x58')](_0x2ea6ed);}})[_0x807a('0x20')](function(_0x3fd58a){if(_0x3fd58a){return _0x3fd58a?{'count':_0x339560,'rows':_0x3fd58a}:null;}})[_0x807a('0x20')](respondWithResult(_0x41da88,null))[_0x807a('0x2a')](handleError(_0x41da88,null));};exports[_0x807a('0x5c')]=function(_0x27dc15,_0x4398e5,_0x471a32){if(_0x27dc15['body']['id']){delete _0x27dc15[_0x807a('0x54')]['id'];}return db['SugarcrmAccount'][_0x807a('0x59')]({'where':{'id':_0x27dc15['params']['id']}})[_0x807a('0x20')](handleEntityNotFound(_0x4398e5,null))[_0x807a('0x20')](function(_0x299bb3){if(_0x299bb3){_0x27dc15['body'][_0x807a('0x5d')]=_0x299bb3['id'];_0x27dc15[_0x807a('0x54')][_0x807a('0x5e')]=integrations[_0x807a('0x5f')](_0x27dc15[_0x807a('0x54')][_0x807a('0x60')],_0x27dc15[_0x807a('0x54')]['type']);_0x27dc15['body'][_0x807a('0x61')]=integrations['getDescriptions'](_0x27dc15['body']['channel'],_0x27dc15['body'][_0x807a('0x3c')]);return db[_0x807a('0x5a')]['create'](_0x27dc15[_0x807a('0x54')],{'include':[{'model':db['SugarcrmField'],'as':_0x807a('0x5e')},{'model':db['SugarcrmField'],'as':_0x807a('0x61')}]});}return null;})[_0x807a('0x20')](respondWithResult(_0x4398e5,null))[_0x807a('0x2a')](handleError(_0x4398e5,null));};exports[_0x807a('0x62')]=function(_0xf09a51,_0xa0bc9e,_0x2dbe2b){var _0xae3ad1='';var _0x5e05dc=['id',_0x807a('0x36'),_0x807a('0x63'),'created_by',_0x807a('0x64'),'date_start',_0x807a('0x65'),_0x807a('0x66'),_0x807a('0x67'),_0x807a('0x68'),_0x807a('0x69'),_0x807a('0x6a')];return db['SugarcrmAccount'][_0x807a('0x59')]({'where':{'id':_0xf09a51[_0x807a('0x56')]['id']},'attributes':['id','username','password',_0x807a('0x6b')]})[_0x807a('0x20')](handleEntityNotFound(_0xa0bc9e,null))[_0x807a('0x20')](function(_0x607fcb){if(_0x607fcb){_0xae3ad1=_0x607fcb[_0x807a('0x6b')];var _0x55161b=_0xae3ad1[_0x807a('0x6c')](-0x1);if(_0x55161b==='/'){_0xae3ad1=_0xae3ad1[_0x807a('0x6d')](0x0,_0xae3ad1[_0x807a('0x6e')](_0x55161b));}return rp({'method':_0x807a('0x6f'),'uri':util[_0x807a('0x70')](_0x807a('0x71'),_0xae3ad1,_0x807a('0x72')),'json':!![],'form':{'method':_0x807a('0x73'),'input_type':_0x807a('0x74'),'response_type':'JSON','rest_data':JSON[_0x807a('0x75')]({'user_auth':{'user_name':_0x607fcb[_0x807a('0x76')],'password':_0x607fcb[_0x807a('0x77')],'encryption':_0x807a('0x78')},'application':_0x807a('0x79')})}});}})[_0x807a('0x20')](function(_0x15579a){if(_0x15579a&&_0x15579a[_0x807a('0x36')]!=='Invalid\x20Login'&&_0x15579a['name']!==_0x807a('0x7a')){return rp({'method':'POST','uri':util['format']('%s%s',_0xae3ad1,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x807a('0x7b'),'input_type':_0x807a('0x74'),'response_type':_0x807a('0x74'),'rest_data':JSON[_0x807a('0x75')]({'session':_0x15579a['id'],'module_name':'Calls'})}})[_0x807a('0x20')](function(_0x363f5f){if(_0x363f5f){var _0x2f2b03=_[_0x807a('0x7c')](_0x363f5f[_0x807a('0x7d')]);_['remove'](_0x2f2b03,function(_0x448a9d){return _0x5e05dc[_0x807a('0x7e')](_0x448a9d[_0x807a('0x36')]);});return{'count':_0x2f2b03[_0x807a('0x50')],'rows':_[_0x807a('0x38')](_0x2f2b03,function(_0x1e469f){return{'id':_0x1e469f['name'],'name':_0x1e469f[_0x807a('0x7f')],'custom':_['endsWith'](_0x1e469f[_0x807a('0x36')],'_c')?!![]:![],'options':_0x1e469f['options']?_[_0x807a('0x38')](_['values'](_0x1e469f[_0x807a('0x5b')]),function(_0x12fddf){return{'name':_0x12fddf[_0x807a('0x80')],'value':_0x12fddf['name']};}):[]};})};}})[_0x807a('0x20')](respondWithResult(_0xa0bc9e,null))['catch'](function(_0x350a1c){var _0x478e01=_0xf09a51['query'][_0x807a('0x81')]?0x1f4:_0x350a1c[_0x807a('0x82')]||0x1f4;logger[_0x807a('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x478e01,JSON[_0x807a('0x75')](_0x350a1c));delete _0x350a1c[_0x807a('0x36')];if(_0x478e01===0x191){_0x478e01=0x190;}_0xa0bc9e[_0x807a('0x2c')](_0x478e01)['send'](_0xf09a51[_0x807a('0x3e')][_0x807a('0x81')]?{'message':_0x807a('0x83'),'statusCode':_0x350a1c['statusCode']}:_0x350a1c);});}else{var _0xf13b7d=0x1f4;_0xa0bc9e[_0x807a('0x2c')](_0xf13b7d)[_0x807a('0x84')]({'message':_0x807a('0x83'),'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 8e62b08..5b6bd1e 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 _0xa254=['../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes'];(function(_0x264b9b,_0xa1181e){var _0x4c7a0e=function(_0x4b77a0){while(--_0x4b77a0){_0x264b9b['push'](_0x264b9b['shift']());}};_0x4c7a0e(++_0xa1181e);}(_0xa254,0x1b7));var _0x4a25=function(_0xdb628e,_0x103e9a){_0xdb628e=_0xdb628e-0x0;var _0x493aa5=_0xa254[_0xdb628e];return _0x493aa5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4a25('0x0'))(_0x4a25('0x1'));var moment=require(_0x4a25('0x2'));var BPromise=require(_0x4a25('0x3'));var rp=require(_0x4a25('0x4'));var fs=require('fs');var path=require(_0x4a25('0x5'));var rimraf=require(_0x4a25('0x6'));var config=require(_0x4a25('0x7'));var attributes=require(_0x4a25('0x8'));var integrations=require(_0x4a25('0x9'));module[_0x4a25('0xa')]=function(_0x57dbfd,_0xccc038){return _0x57dbfd[_0x4a25('0xb')](_0x4a25('0xc'),attributes,{'tableName':_0x4a25('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b7d=['SugarcrmAccount','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','define'];(function(_0x457c48,_0x2d7db6){var _0xa7ac7=function(_0x4188eb){while(--_0x4188eb){_0x457c48['push'](_0x457c48['shift']());}};_0xa7ac7(++_0x2d7db6);}(_0x1b7d,0x155));var _0xd1b7=function(_0x339ff5,_0x94b824){_0x339ff5=_0x339ff5-0x0;var _0x4a0b6=_0x1b7d[_0x339ff5];return _0x4a0b6;};'use strict';var _=require(_0xd1b7('0x0'));var util=require('util');var logger=require(_0xd1b7('0x1'))(_0xd1b7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd1b7('0x3'));var fs=require('fs');var path=require(_0xd1b7('0x4'));var rimraf=require(_0xd1b7('0x5'));var config=require(_0xd1b7('0x6'));var attributes=require(_0xd1b7('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xdf1d3e,_0x22cf5e){return _0xdf1d3e[_0xd1b7('0x8')](_0xd1b7('0x9'),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 5d0d099..ba15822 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 _0x97cf=['map','model','GetSugarcrmAccount','ShowSugarcrmAccount','find','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SugarcrmAccount','findAll','options','where','attributes','limit','include'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x97cf,0x1e7));var _0xf97c=function(_0x144616,_0x1188de){_0x144616=_0x144616-0x0;var _0x100e2f=_0x97cf[_0x144616];return _0x100e2f;};'use strict';var _=require(_0xf97c('0x0'));var util=require(_0xf97c('0x1'));var moment=require(_0xf97c('0x2'));var BPromise=require(_0xf97c('0x3'));var rs=require(_0xf97c('0x4'));var fs=require('fs');var Redis=require(_0xf97c('0x5'));var db=require(_0xf97c('0x6'))['db'];var utils=require(_0xf97c('0x7'));var logger=require(_0xf97c('0x8'))(_0xf97c('0x9'));var config=require(_0xf97c('0xa'));var jayson=require(_0xf97c('0xb'));var client=jayson[_0xf97c('0xc')][_0xf97c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2f25b2,_0x46c997,_0x561737){return new BPromise(function(_0x459d33,_0x3c30f1){return client[_0xf97c('0xe')](_0x2f25b2,_0x561737)[_0xf97c('0xf')](function(_0x42198c){logger[_0xf97c('0x10')](_0xf97c('0x11'),_0x46c997,_0xf97c('0x12'));logger['debug'](_0xf97c('0x13'),_0x46c997,_0xf97c('0x12'),JSON[_0xf97c('0x14')](_0x42198c));if(_0x42198c[_0xf97c('0x15')]){if(_0x42198c[_0xf97c('0x15')][_0xf97c('0x16')]===0x1f4){logger[_0xf97c('0x15')](_0xf97c('0x11'),_0x46c997,_0x42198c[_0xf97c('0x15')][_0xf97c('0x17')]);return _0x3c30f1(_0x42198c[_0xf97c('0x15')][_0xf97c('0x17')]);}logger[_0xf97c('0x15')]('SugarcrmAccount,\x20%s,\x20%s',_0x46c997,_0x42198c[_0xf97c('0x15')]['message']);return _0x459d33(_0x42198c[_0xf97c('0x15')]['message']);}else{logger[_0xf97c('0x10')](_0xf97c('0x11'),_0x46c997,_0xf97c('0x12'));_0x459d33(_0x42198c[_0xf97c('0x18')]['message']);}})[_0xf97c('0x19')](function(_0x298451){logger[_0xf97c('0x15')](_0xf97c('0x11'),_0x46c997,_0x298451);_0x3c30f1(_0x298451);});});}exports['GetSugarcrmAccount']=function(_0x484b07){var _0x94d024=this;return new Promise(function(_0x11f1f8,_0x5b370b){return db[_0xf97c('0x1a')][_0xf97c('0x1b')]({'raw':_0x484b07[_0xf97c('0x1c')]?_0x484b07[_0xf97c('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x484b07[_0xf97c('0x1c')]?_0x484b07[_0xf97c('0x1c')][_0xf97c('0x1d')]||null:null,'attributes':_0x484b07[_0xf97c('0x1c')]?_0x484b07[_0xf97c('0x1c')][_0xf97c('0x1e')]||null:null,'limit':_0x484b07[_0xf97c('0x1c')]?_0x484b07[_0xf97c('0x1c')][_0xf97c('0x1f')]||null:null,'include':_0x484b07['options']?_0x484b07[_0xf97c('0x1c')][_0xf97c('0x20')]?_[_0xf97c('0x21')](_0x484b07[_0xf97c('0x1c')][_0xf97c('0x20')],function(_0x5dbe0d){return{'model':db[_0x5dbe0d['model']],'as':_0x5dbe0d['as'],'attributes':_0x5dbe0d[_0xf97c('0x1e')],'include':_0x5dbe0d['include']?_[_0xf97c('0x21')](_0x5dbe0d['include'],function(_0x213253){return{'model':db[_0x213253[_0xf97c('0x22')]],'as':_0x213253['as'],'attributes':_0x213253[_0xf97c('0x1e')],'include':_0x213253[_0xf97c('0x20')]?_[_0xf97c('0x21')](_0x213253[_0xf97c('0x20')],function(_0x3d8b19){return{'model':db[_0x3d8b19['model']],'as':_0x3d8b19['as'],'attributes':_0x3d8b19['attributes']};}):[]};}):[]};}):[]:[]})[_0xf97c('0xf')](function(_0x59cf46){logger['info'](_0xf97c('0x23'),_0x484b07);logger['debug'](_0xf97c('0x23'),_0x484b07,JSON[_0xf97c('0x14')](_0x59cf46));_0x11f1f8(_0x59cf46);})[_0xf97c('0x19')](function(_0x1bb0d9){logger[_0xf97c('0x15')](_0xf97c('0x23'),_0x1bb0d9['message'],_0x484b07);_0x5b370b(_0x94d024['error'](0x1f4,_0x1bb0d9[_0xf97c('0x17')]));});});};exports[_0xf97c('0x24')]=function(_0x534a3c){var _0x3aedc7=this;return new Promise(function(_0x1d4d44,_0x29d16a){return db[_0xf97c('0x1a')][_0xf97c('0x25')]({'raw':_0x534a3c['options']?_0x534a3c[_0xf97c('0x1c')][_0xf97c('0x26')]===undefined?!![]:![]:!![],'where':_0x534a3c[_0xf97c('0x1c')]?_0x534a3c[_0xf97c('0x1c')]['where']||null:null,'attributes':_0x534a3c['options']?_0x534a3c[_0xf97c('0x1c')][_0xf97c('0x1e')]||null:null,'include':_0x534a3c[_0xf97c('0x1c')]?_0x534a3c[_0xf97c('0x1c')][_0xf97c('0x20')]?_[_0xf97c('0x21')](_0x534a3c[_0xf97c('0x1c')][_0xf97c('0x20')],function(_0x555229){return{'model':db[_0x555229[_0xf97c('0x22')]],'as':_0x555229['as'],'attributes':_0x555229[_0xf97c('0x1e')],'include':_0x555229[_0xf97c('0x20')]?_[_0xf97c('0x21')](_0x555229[_0xf97c('0x20')],function(_0x1c4665){return{'model':db[_0x1c4665[_0xf97c('0x22')]],'as':_0x1c4665['as'],'attributes':_0x1c4665[_0xf97c('0x1e')],'include':_0x1c4665[_0xf97c('0x20')]?_[_0xf97c('0x21')](_0x1c4665['include'],function(_0x589a6a){return{'model':db[_0x589a6a[_0xf97c('0x22')]],'as':_0x589a6a['as'],'attributes':_0x589a6a[_0xf97c('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ddec0){logger[_0xf97c('0x10')](_0xf97c('0x24'),_0x534a3c);logger[_0xf97c('0x27')](_0xf97c('0x24'),_0x534a3c,JSON[_0xf97c('0x14')](_0x1ddec0));_0x1d4d44(_0x1ddec0);})['catch'](function(_0x100db3){logger[_0xf97c('0x15')](_0xf97c('0x24'),_0x100db3[_0xf97c('0x17')],_0x534a3c);_0x29d16a(_0x3aedc7[_0xf97c('0x15')](0x1f4,_0x100db3[_0xf97c('0x17')]));});});}; \ No newline at end of file +var _0xb967=['message','request\x20sent','result','GetSugarcrmAccount','SugarcrmAccount','options','where','attributes','limit','include','model','map','catch','ShowSugarcrmAccount','raw','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5a2d95,_0xb362e5){var _0x2c3986=function(_0x5cce7c){while(--_0x5cce7c){_0x5a2d95['push'](_0x5a2d95['shift']());}};_0x2c3986(++_0xb362e5);}(_0xb967,0x1c9));var _0x7b96=function(_0x376ae1,_0x5375ee){_0x376ae1=_0x376ae1-0x0;var _0x1b12b8=_0xb967[_0x376ae1];return _0x1b12b8;};'use strict';var _=require(_0x7b96('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7b96('0x1'));var fs=require('fs');var Redis=require(_0x7b96('0x2'));var db=require(_0x7b96('0x3'))['db'];var utils=require(_0x7b96('0x4'));var logger=require(_0x7b96('0x5'))(_0x7b96('0x6'));var config=require(_0x7b96('0x7'));var jayson=require(_0x7b96('0x8'));var client=jayson[_0x7b96('0x9')][_0x7b96('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x421eaf,_0x2ae178,_0xeb7d48){return new BPromise(function(_0x2d3d4a,_0x341b73){return client['request'](_0x421eaf,_0xeb7d48)[_0x7b96('0xb')](function(_0x1c65a4){logger[_0x7b96('0xc')](_0x7b96('0xd'),_0x2ae178,'request\x20sent');logger[_0x7b96('0xe')](_0x7b96('0xf'),_0x2ae178,'request\x20sent',JSON[_0x7b96('0x10')](_0x1c65a4));if(_0x1c65a4[_0x7b96('0x11')]){if(_0x1c65a4[_0x7b96('0x11')][_0x7b96('0x12')]===0x1f4){logger[_0x7b96('0x11')](_0x7b96('0xd'),_0x2ae178,_0x1c65a4[_0x7b96('0x11')][_0x7b96('0x13')]);return _0x341b73(_0x1c65a4[_0x7b96('0x11')][_0x7b96('0x13')]);}logger['error'](_0x7b96('0xd'),_0x2ae178,_0x1c65a4[_0x7b96('0x11')][_0x7b96('0x13')]);return _0x2d3d4a(_0x1c65a4[_0x7b96('0x11')][_0x7b96('0x13')]);}else{logger[_0x7b96('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x2ae178,_0x7b96('0x14'));_0x2d3d4a(_0x1c65a4[_0x7b96('0x15')][_0x7b96('0x13')]);}})['catch'](function(_0x3424d2){logger['error'](_0x7b96('0xd'),_0x2ae178,_0x3424d2);_0x341b73(_0x3424d2);});});}exports[_0x7b96('0x16')]=function(_0x52b10a){var _0x126264=this;return new Promise(function(_0x27d115,_0x1114e7){return db[_0x7b96('0x17')]['findAll']({'raw':_0x52b10a['options']?_0x52b10a['options']['raw']===undefined?!![]:![]:!![],'where':_0x52b10a[_0x7b96('0x18')]?_0x52b10a[_0x7b96('0x18')][_0x7b96('0x19')]||null:null,'attributes':_0x52b10a[_0x7b96('0x18')]?_0x52b10a[_0x7b96('0x18')][_0x7b96('0x1a')]||null:null,'limit':_0x52b10a['options']?_0x52b10a['options'][_0x7b96('0x1b')]||null:null,'include':_0x52b10a[_0x7b96('0x18')]?_0x52b10a[_0x7b96('0x18')][_0x7b96('0x1c')]?_['map'](_0x52b10a[_0x7b96('0x18')][_0x7b96('0x1c')],function(_0xa418e0){return{'model':db[_0xa418e0[_0x7b96('0x1d')]],'as':_0xa418e0['as'],'attributes':_0xa418e0[_0x7b96('0x1a')],'include':_0xa418e0[_0x7b96('0x1c')]?_[_0x7b96('0x1e')](_0xa418e0[_0x7b96('0x1c')],function(_0x3c146b){return{'model':db[_0x3c146b['model']],'as':_0x3c146b['as'],'attributes':_0x3c146b[_0x7b96('0x1a')],'include':_0x3c146b[_0x7b96('0x1c')]?_[_0x7b96('0x1e')](_0x3c146b[_0x7b96('0x1c')],function(_0x3670da){return{'model':db[_0x3670da['model']],'as':_0x3670da['as'],'attributes':_0x3670da[_0x7b96('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7b96('0xb')](function(_0x3db72f){logger[_0x7b96('0xc')](_0x7b96('0x16'),_0x52b10a);logger['debug']('GetSugarcrmAccount',_0x52b10a,JSON[_0x7b96('0x10')](_0x3db72f));_0x27d115(_0x3db72f);})[_0x7b96('0x1f')](function(_0x2bb688){logger[_0x7b96('0x11')](_0x7b96('0x16'),_0x2bb688[_0x7b96('0x13')],_0x52b10a);_0x1114e7(_0x126264[_0x7b96('0x11')](0x1f4,_0x2bb688[_0x7b96('0x13')]));});});};exports[_0x7b96('0x20')]=function(_0x1eaccc){var _0x20b69b=this;return new Promise(function(_0x2183f2,_0x243f99){return db[_0x7b96('0x17')]['find']({'raw':_0x1eaccc[_0x7b96('0x18')]?_0x1eaccc[_0x7b96('0x18')][_0x7b96('0x21')]===undefined?!![]:![]:!![],'where':_0x1eaccc[_0x7b96('0x18')]?_0x1eaccc['options'][_0x7b96('0x19')]||null:null,'attributes':_0x1eaccc[_0x7b96('0x18')]?_0x1eaccc['options'][_0x7b96('0x1a')]||null:null,'include':_0x1eaccc[_0x7b96('0x18')]?_0x1eaccc[_0x7b96('0x18')][_0x7b96('0x1c')]?_[_0x7b96('0x1e')](_0x1eaccc['options'][_0x7b96('0x1c')],function(_0x3fffb9){return{'model':db[_0x3fffb9[_0x7b96('0x1d')]],'as':_0x3fffb9['as'],'attributes':_0x3fffb9[_0x7b96('0x1a')],'include':_0x3fffb9['include']?_[_0x7b96('0x1e')](_0x3fffb9[_0x7b96('0x1c')],function(_0x461d05){return{'model':db[_0x461d05[_0x7b96('0x1d')]],'as':_0x461d05['as'],'attributes':_0x461d05[_0x7b96('0x1a')],'include':_0x461d05[_0x7b96('0x1c')]?_[_0x7b96('0x1e')](_0x461d05[_0x7b96('0x1c')],function(_0x52dcb4){return{'model':db[_0x52dcb4[_0x7b96('0x1d')]],'as':_0x52dcb4['as'],'attributes':_0x52dcb4[_0x7b96('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7b96('0xb')](function(_0x284aaf){logger[_0x7b96('0xc')](_0x7b96('0x20'),_0x1eaccc);logger[_0x7b96('0xe')](_0x7b96('0x20'),_0x1eaccc,JSON[_0x7b96('0x10')](_0x284aaf));_0x2183f2(_0x284aaf);})['catch'](function(_0x39c380){logger[_0x7b96('0x11')]('ShowSugarcrmAccount',_0x39c380[_0x7b96('0x13')],_0x1eaccc);_0x243f99(_0x20b69b['error'](0x1f4,_0x39c380[_0x7b96('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 0eaafb0..99bfb8e 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 _0x4393=['../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','multer','util','path','express','../../components/auth/service'];(function(_0x49f19e,_0x1c3aa3){var _0x280b5a=function(_0x277203){while(--_0x277203){_0x49f19e['push'](_0x49f19e['shift']());}};_0x280b5a(++_0x1c3aa3);}(_0x4393,0x187));var _0x3439=function(_0x5f34a5,_0x66e517){_0x5f34a5=_0x5f34a5-0x0;var _0x27eb98=_0x4393[_0x5f34a5];return _0x27eb98;};'use strict';var multer=require(_0x3439('0x0'));var util=require(_0x3439('0x1'));var path=require(_0x3439('0x2'));var timeout=require('connect-timeout');var express=require(_0x3439('0x3'));var router=express['Router']();var auth=require(_0x3439('0x4'));var interaction=require(_0x3439('0x5'));var config=require(_0x3439('0x6'));var controller=require(_0x3439('0x7'));router[_0x3439('0x8')]('/',auth[_0x3439('0x9')](),controller[_0x3439('0xa')]);router[_0x3439('0x8')](_0x3439('0xb'),auth['isAuthenticated'](),controller[_0x3439('0xc')]);router[_0x3439('0x8')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x3439('0x8')](_0x3439('0xd'),auth[_0x3439('0x9')](),controller[_0x3439('0xe')]);router[_0x3439('0x8')](_0x3439('0xf'),auth[_0x3439('0x9')](),controller[_0x3439('0x10')]);router[_0x3439('0x11')]('/',auth[_0x3439('0x9')](),controller[_0x3439('0x12')]);router[_0x3439('0x13')](_0x3439('0xb'),auth[_0x3439('0x9')](),controller[_0x3439('0x14')]);router['delete'](_0x3439('0xb'),auth[_0x3439('0x9')](),controller[_0x3439('0x15')]);module['exports']=router; \ No newline at end of file +var _0x1ba2=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put'];(function(_0x383885,_0x4ef401){var _0x1d35f5=function(_0x133672){while(--_0x133672){_0x383885['push'](_0x383885['shift']());}};_0x1d35f5(++_0x4ef401);}(_0x1ba2,0x154));var _0x21ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ba2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x21ba('0x0'));var util=require(_0x21ba('0x1'));var path=require(_0x21ba('0x2'));var timeout=require(_0x21ba('0x3'));var express=require(_0x21ba('0x4'));var router=express[_0x21ba('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x21ba('0x6'));var config=require(_0x21ba('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x21ba('0x8')](_0x21ba('0x9'),auth[_0x21ba('0xa')](),controller[_0x21ba('0xb')]);router[_0x21ba('0x8')](_0x21ba('0xc'),auth['isAuthenticated'](),controller[_0x21ba('0xd')]);router[_0x21ba('0x8')](_0x21ba('0xe'),auth[_0x21ba('0xa')](),controller[_0x21ba('0xf')]);router[_0x21ba('0x8')](_0x21ba('0x10'),auth['isAuthenticated'](),controller[_0x21ba('0x11')]);router[_0x21ba('0x12')]('/',auth[_0x21ba('0xa')](),controller['create']);router[_0x21ba('0x13')]('/:id',auth[_0x21ba('0xa')](),controller[_0x21ba('0x14')]);router[_0x21ba('0x15')](_0x21ba('0x9'),auth[_0x21ba('0xa')](),controller[_0x21ba('0x16')]);module[_0x21ba('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 cfc8eb6..58ded94 100644 --- a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js +++ b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7686=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7686,0x70));var _0x6768=function(_0x4bd374,_0x1b9051){_0x4bd374=_0x4bd374-0x0;var _0x4959a0=_0x7686[_0x4bd374];return _0x4959a0;};'use strict';var Sequelize=require(_0x6768('0x0'));module[_0x6768('0x1')]={'name':{'type':Sequelize[_0x6768('0x2')]},'description':{'type':Sequelize[_0x6768('0x2')]}}; \ No newline at end of file +var _0x90f0=['STRING','exports'];(function(_0x5c21b4,_0x32a80d){var _0x452bea=function(_0x39c97c){while(--_0x39c97c){_0x5c21b4['push'](_0x5c21b4['shift']());}};_0x452bea(++_0x32a80d);}(_0x90f0,0x7d));var _0x090f=function(_0x52dfa9,_0x306d3f){_0x52dfa9=_0x52dfa9-0x0;var _0xdfaa57=_0x90f0[_0x52dfa9];return _0xdfaa57;};'use strict';var Sequelize=require('sequelize');module[_0x090f('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x090f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 9593060..c484b39 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 _0xdeaa=['end','json','offset','limit','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','SugarcrmConfiguration','count','params','length','includeAll','include','find','create','body','findOne','getFields','nolimit','SugarcrmField','getSubjects','getDescriptions','html-pdf','eml-format','fast-json-patch','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/logger','../../config/utils','../../mysqldb','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~!@#$%^&-_=+[{]}.','then','info','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status'];(function(_0x725a4c,_0x102507){var _0x37b2cc=function(_0x505fc9){while(--_0x505fc9){_0x725a4c['push'](_0x725a4c['shift']());}};_0x37b2cc(++_0x102507);}(_0xdeaa,0x145));var _0xadea=function(_0x33a6da,_0x6dfd2d){_0x33a6da=_0x33a6da-0x0;var _0x5a865e=_0xdeaa[_0x33a6da];return _0x5a865e;};'use strict';var pdf=require(_0xadea('0x0'));var emlformat=require(_0xadea('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xadea('0x2'));var rp=require('request-promise');var moment=require(_0xadea('0x3'));var BPromise=require(_0xadea('0x4'));var Mustache=require(_0xadea('0x5'));var util=require(_0xadea('0x6'));var path=require(_0xadea('0x7'));var sox=require(_0xadea('0x8'));var csv=require(_0xadea('0x9'));var ejs=require(_0xadea('0xa'));var fs=require('fs');var _=require(_0xadea('0xb'));var squel=require(_0xadea('0xc'));var crypto=require('crypto');var jsforce=require(_0xadea('0xd'));var deskjs=require(_0xadea('0xe'));var toCsv=require(_0xadea('0x9'));var querystring=require(_0xadea('0xf'));var Papa=require(_0xadea('0x10'));var Redis=require(_0xadea('0x11'));var authService=require(_0xadea('0x12'));var qs=require(_0xadea('0x13'));var as=require(_0xadea('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xadea('0x15'))('api');var utils=require(_0xadea('0x16'));var config=require('../../config/environment');var db=require(_0xadea('0x17'))['db'];var jayson=require(_0xadea('0x18'));var client=jayson['client'][_0xadea('0x19')]({'port':0x232a});function checkPasswordPattern(_0x3ab611,_0x3bb7c2,_0x16080a){if(_0x16080a){var _0x298abd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x298abd[_0xadea('0x1a')](_0x3bb7c2)){return _0x3ab611;}else{throw new db['Sequelize'][(_0xadea('0x1b'))](_0xadea('0x1c'));}}else{return _0x3ab611;}}function respondWithRpcPromise(_0x437d85,_0x194aa8,_0x650a73,_0x5c341a){return new BPromise(function(_0x4c1140,_0x346c06){var _0x3c3aa4=_0x5c341a||client;return _0x3c3aa4['request'](_0x437d85,_0x650a73)[_0xadea('0x1d')](function(_0x4729f4){logger[_0xadea('0x1e')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x194aa8,'request\x20sent');logger[_0xadea('0x1f')](_0xadea('0x20'),_0x194aa8,'request\x20sent',JSON[_0xadea('0x21')](_0x4729f4));if(_0x4729f4['error']){if(_0x4729f4[_0xadea('0x22')][_0xadea('0x23')]===0x1f4){logger[_0xadea('0x22')](_0xadea('0x24'),_0x194aa8,_0x4729f4[_0xadea('0x22')]['message']);return _0x346c06(_0x4729f4[_0xadea('0x22')][_0xadea('0x25')]);}logger[_0xadea('0x22')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x194aa8,_0x4729f4[_0xadea('0x22')][_0xadea('0x25')]);return _0x4c1140(_0x4729f4[_0xadea('0x22')][_0xadea('0x25')]);}else{logger['info'](_0xadea('0x24'),_0x194aa8,_0xadea('0x26'));_0x4c1140(_0x4729f4[_0xadea('0x27')][_0xadea('0x25')]);}})[_0xadea('0x28')](function(_0x18972a){logger[_0xadea('0x22')](_0xadea('0x24'),_0x194aa8,_0x18972a);_0x346c06(_0x18972a);});});}function respondWithStatusCode(_0x382487,_0x30f9d4){_0x30f9d4=_0x30f9d4||0xcc;return function(_0x456b32){if(_0x456b32){return _0x382487[_0xadea('0x29')](_0x30f9d4);}return _0x382487[_0xadea('0x2a')](_0x30f9d4)[_0xadea('0x2b')]();};}function respondWithResult(_0x543922,_0x51a8e9){_0x51a8e9=_0x51a8e9||0xc8;return function(_0x51392e){if(_0x51392e){return _0x543922[_0xadea('0x2a')](_0x51a8e9)[_0xadea('0x2c')](_0x51392e);}};}function respondWithFilteredResult(_0x2a656a,_0x409f17){return function(_0x55d370){if(_0x55d370){var _0x3754ba=_0x55d370['count'],_0x11d916=_0x409f17['offset'],_0x348b9c=_0x409f17[_0xadea('0x2d')]+_0x409f17[_0xadea('0x2e')],_0x56e6bc;if(_0x348b9c>=_0x3754ba){_0x348b9c=_0x3754ba;_0x56e6bc=0xc8;}else{_0x56e6bc=0xce;}_0x2a656a[_0xadea('0x2a')](_0x56e6bc);return _0x2a656a['set'](_0xadea('0x2f'),_0x11d916+'-'+_0x348b9c+'/'+_0x3754ba)[_0xadea('0x2c')](_0x55d370);}return null;};}function patchUpdates(_0xa33c13){return function(_0x454ae2){try{jsonpatch[_0xadea('0x30')](_0x454ae2,_0xa33c13,!![]);}catch(_0x48022a){return BPromise[_0xadea('0x31')](_0x48022a);}return _0x454ae2['save']();};}function saveUpdates(_0x2001ef,_0x106f20){return function(_0x12c23d){if(_0x12c23d){return _0x12c23d[_0xadea('0x32')](_0x2001ef)[_0xadea('0x1d')](function(_0x1e8495){return _0x1e8495;});}return null;};}function removeEntity(_0x417d58,_0x456d41){return function(_0x6315e0){if(_0x6315e0){return _0x6315e0[_0xadea('0x33')]()['then'](function(){_0x417d58['status'](0xcc)[_0xadea('0x2b')]();});}};}function handleEntityNotFound(_0xc1054,_0x50e4e7){return function(_0x13154c){if(!_0x13154c){_0xc1054['sendStatus'](0x194);}return _0x13154c;};}function handleError(_0x45320a,_0x1b76e1){_0x1b76e1=_0x1b76e1||0x1f4;return function(_0x375e02){logger[_0xadea('0x22')](_0x375e02[_0xadea('0x34')]);if(_0x375e02[_0xadea('0x35')]){delete _0x375e02[_0xadea('0x35')];}_0x45320a[_0xadea('0x2a')](_0x1b76e1)[_0xadea('0x36')](_0x375e02);};}exports[_0xadea('0x37')]=function(_0x4aec2d,_0x49c388){var _0x1735e1={},_0x11f47b={},_0x534b02={'count':0x0,'rows':[]};var _0x26d58e=_[_0xadea('0x38')](db['SugarcrmConfiguration'][_0xadea('0x39')],function(_0x3b2a86){return{'name':_0x3b2a86[_0xadea('0x3a')],'type':_0x3b2a86[_0xadea('0x3b')][_0xadea('0x3c')]};});_0x11f47b['model']=_['map'](_0x26d58e,_0xadea('0x35'));_0x11f47b[_0xadea('0x3d')]=_[_0xadea('0x3e')](_0x4aec2d[_0xadea('0x3d')]);_0x11f47b[_0xadea('0x3f')]=_[_0xadea('0x40')](_0x11f47b[_0xadea('0x41')],_0x11f47b[_0xadea('0x3d')]);_0x1735e1[_0xadea('0x42')]=_[_0xadea('0x40')](_0x11f47b[_0xadea('0x41')],qs[_0xadea('0x43')](_0x4aec2d[_0xadea('0x3d')]['fields']));_0x1735e1[_0xadea('0x42')]=_0x1735e1[_0xadea('0x42')]['length']?_0x1735e1[_0xadea('0x42')]:_0x11f47b[_0xadea('0x41')];if(!_0x4aec2d[_0xadea('0x3d')][_0xadea('0x44')]('nolimit')){_0x1735e1[_0xadea('0x2e')]=qs['limit'](_0x4aec2d[_0xadea('0x3d')][_0xadea('0x2e')]);_0x1735e1[_0xadea('0x2d')]=qs['offset'](_0x4aec2d[_0xadea('0x3d')][_0xadea('0x2d')]);}_0x1735e1[_0xadea('0x45')]=qs[_0xadea('0x46')](_0x4aec2d[_0xadea('0x3d')][_0xadea('0x46')]);_0x1735e1['where']=qs[_0xadea('0x3f')](_[_0xadea('0x47')](_0x4aec2d[_0xadea('0x3d')],_0x11f47b[_0xadea('0x3f')]));if(_0x4aec2d[_0xadea('0x3d')][_0xadea('0x48')]){_0x1735e1[_0xadea('0x49')]=_['merge'](_0x1735e1[_0xadea('0x49')],{'$or':_[_0xadea('0x38')](_0x26d58e,function(_0x3e9cc9){if(_0x3e9cc9[_0xadea('0x3b')]!==_0xadea('0x4a')){var _0x5d8bd6={};_0x5d8bd6[_0x3e9cc9[_0xadea('0x35')]]={'$like':'%'+_0x4aec2d['query'][_0xadea('0x48')]+'%'};return _0x5d8bd6;}})});}_0x1735e1=_[_0xadea('0x4b')]({},_0x1735e1,_0x4aec2d[_0xadea('0x4c')]);var _0x587282={'where':_0x1735e1['where']};return db[_0xadea('0x4d')][_0xadea('0x4e')](_0x587282)[_0xadea('0x1d')](function(_0x56c963){_0x534b02['count']=_0x56c963;if(_0x4aec2d['query']['includeAll']){_0x1735e1['include']=[{'all':!![]}];}return db[_0xadea('0x4d')]['findAll'](_0x1735e1);})['then'](function(_0x79a581){_0x534b02['rows']=_0x79a581;return _0x534b02;})['then'](respondWithFilteredResult(_0x49c388,_0x1735e1))[_0xadea('0x28')](handleError(_0x49c388,null));};exports['show']=function(_0x2284d1,_0x4ad571){var _0x494119={'raw':![],'where':{'id':_0x2284d1[_0xadea('0x4f')]['id']}},_0x488e6f={};_0x488e6f['model']=_[_0xadea('0x3e')](db[_0xadea('0x4d')][_0xadea('0x39')]);_0x488e6f[_0xadea('0x3d')]=_['keys'](_0x2284d1[_0xadea('0x3d')]);_0x488e6f[_0xadea('0x3f')]=_[_0xadea('0x40')](_0x488e6f[_0xadea('0x41')],_0x488e6f[_0xadea('0x3d')]);_0x494119[_0xadea('0x42')]=_[_0xadea('0x40')](_0x488e6f[_0xadea('0x41')],qs['fields'](_0x2284d1[_0xadea('0x3d')][_0xadea('0x43')]));_0x494119[_0xadea('0x42')]=_0x494119[_0xadea('0x42')][_0xadea('0x50')]?_0x494119[_0xadea('0x42')]:_0x488e6f[_0xadea('0x41')];if(_0x2284d1[_0xadea('0x3d')][_0xadea('0x51')]){_0x494119[_0xadea('0x52')]=[{'all':!![]}];}_0x494119=_[_0xadea('0x4b')]({},_0x494119,_0x2284d1['options']);return db[_0xadea('0x4d')][_0xadea('0x53')](_0x494119)['then'](handleEntityNotFound(_0x4ad571,null))[_0xadea('0x1d')](respondWithResult(_0x4ad571,null))[_0xadea('0x28')](handleError(_0x4ad571,null));};exports['create']=function(_0xe92b42,_0x4a9628){return db[_0xadea('0x4d')][_0xadea('0x54')](_0xe92b42[_0xadea('0x55')],{})[_0xadea('0x1d')](respondWithResult(_0x4a9628,0xc9))['catch'](handleError(_0x4a9628,null));};exports[_0xadea('0x32')]=function(_0x37e027,_0x8db127){if(_0x37e027[_0xadea('0x55')]['id']){delete _0x37e027[_0xadea('0x55')]['id'];}return db[_0xadea('0x4d')]['find']({'where':{'id':_0x37e027[_0xadea('0x4f')]['id']}})[_0xadea('0x1d')](handleEntityNotFound(_0x8db127,null))[_0xadea('0x1d')](saveUpdates(_0x37e027[_0xadea('0x55')],null))[_0xadea('0x1d')](respondWithResult(_0x8db127,null))[_0xadea('0x28')](handleError(_0x8db127,null));};exports[_0xadea('0x33')]=function(_0x43c083,_0x25030f){return db[_0xadea('0x4d')]['find']({'where':{'id':_0x43c083['params']['id']}})[_0xadea('0x1d')](handleEntityNotFound(_0x25030f,null))[_0xadea('0x1d')](removeEntity(_0x25030f,null))[_0xadea('0x28')](handleError(_0x25030f,null));};exports['getFields']=function(_0x3c8040,_0x53706b,_0x1ee0f5){var _0x27627e={};var _0xa6e9b6={};var _0xd1b761;var _0x165e86;return db[_0xadea('0x4d')][_0xadea('0x56')]({'where':{'id':_0x3c8040[_0xadea('0x4f')]['id']}})[_0xadea('0x1d')](handleEntityNotFound(_0x53706b,null))[_0xadea('0x1d')](function(_0x37a4af){if(_0x37a4af){_0xd1b761=_0x37a4af;_0xa6e9b6['model']=_[_0xadea('0x3e')](db['SugarcrmField']['rawAttributes']);_0xa6e9b6[_0xadea('0x3d')]=_[_0xadea('0x3e')](_0x3c8040['query']);_0xa6e9b6[_0xadea('0x3f')]=_[_0xadea('0x40')](_0xa6e9b6[_0xadea('0x41')],_0xa6e9b6[_0xadea('0x3d')]);_0x27627e[_0xadea('0x42')]=_[_0xadea('0x40')](_0xa6e9b6[_0xadea('0x41')],qs[_0xadea('0x43')](_0x3c8040[_0xadea('0x3d')][_0xadea('0x43')]));_0x27627e[_0xadea('0x42')]=_0x27627e[_0xadea('0x42')][_0xadea('0x50')]?_0x27627e['attributes']:_0xa6e9b6[_0xadea('0x41')];_0x27627e[_0xadea('0x45')]=qs['sort'](_0x3c8040['query'][_0xadea('0x46')]);_0x27627e[_0xadea('0x49')]=qs[_0xadea('0x3f')](_[_0xadea('0x47')](_0x3c8040['query'],_0xa6e9b6[_0xadea('0x3f')]));if(_0x3c8040[_0xadea('0x3d')][_0xadea('0x48')]){_0x27627e['where']=_[_0xadea('0x4b')](_0x27627e[_0xadea('0x49')],{'$or':_['map'](_0x27627e[_0xadea('0x42')],function(_0x19a458){var _0x20746d={};_0x20746d[_0x19a458]={'$like':'%'+_0x3c8040['query'][_0xadea('0x48')]+'%'};return _0x20746d;})});}_0x27627e=_[_0xadea('0x4b')]({},_0x27627e,_0x3c8040[_0xadea('0x4c')]);return _0xd1b761[_0xadea('0x57')](_0x27627e);}})[_0xadea('0x1d')](function(_0x1be0bd){if(_0x1be0bd){_0x165e86=_0x1be0bd[_0xadea('0x50')];if(!_0x3c8040[_0xadea('0x3d')]['hasOwnProperty'](_0xadea('0x58'))){_0x27627e['limit']=qs[_0xadea('0x2e')](_0x3c8040[_0xadea('0x3d')][_0xadea('0x2e')]);_0x27627e[_0xadea('0x2d')]=qs[_0xadea('0x2d')](_0x3c8040[_0xadea('0x3d')][_0xadea('0x2d')]);}return _0xd1b761[_0xadea('0x57')](_0x27627e);}})[_0xadea('0x1d')](function(_0x3f60b5){if(_0x3f60b5){return _0x3f60b5?{'count':_0x165e86,'rows':_0x3f60b5}:null;}})[_0xadea('0x1d')](respondWithResult(_0x53706b,null))[_0xadea('0x28')](handleError(_0x53706b,null));};exports['getSubjects']=function(_0x2dc0ae,_0x1a4c1c,_0x13d8f0){var _0xc52c2e={};var _0x2f957d={};var _0x4bb356;var _0x3c4a2a;return db[_0xadea('0x4d')][_0xadea('0x56')]({'where':{'id':_0x2dc0ae[_0xadea('0x4f')]['id']}})[_0xadea('0x1d')](handleEntityNotFound(_0x1a4c1c,null))['then'](function(_0x3626c9){if(_0x3626c9){_0x4bb356=_0x3626c9;_0x2f957d['model']=_[_0xadea('0x3e')](db[_0xadea('0x59')]['rawAttributes']);_0x2f957d[_0xadea('0x3d')]=_['keys'](_0x2dc0ae[_0xadea('0x3d')]);_0x2f957d[_0xadea('0x3f')]=_[_0xadea('0x40')](_0x2f957d[_0xadea('0x41')],_0x2f957d[_0xadea('0x3d')]);_0xc52c2e[_0xadea('0x42')]=_[_0xadea('0x40')](_0x2f957d[_0xadea('0x41')],qs['fields'](_0x2dc0ae[_0xadea('0x3d')][_0xadea('0x43')]));_0xc52c2e[_0xadea('0x42')]=_0xc52c2e[_0xadea('0x42')][_0xadea('0x50')]?_0xc52c2e['attributes']:_0x2f957d['model'];_0xc52c2e[_0xadea('0x45')]=qs[_0xadea('0x46')](_0x2dc0ae[_0xadea('0x3d')][_0xadea('0x46')]);_0xc52c2e[_0xadea('0x49')]=qs['filters'](_['pick'](_0x2dc0ae[_0xadea('0x3d')],_0x2f957d['filters']));if(_0x2dc0ae['query'][_0xadea('0x48')]){_0xc52c2e['where']=_[_0xadea('0x4b')](_0xc52c2e[_0xadea('0x49')],{'$or':_['map'](_0xc52c2e[_0xadea('0x42')],function(_0xc981e6){var _0x409ca0={};_0x409ca0[_0xc981e6]={'$like':'%'+_0x2dc0ae[_0xadea('0x3d')][_0xadea('0x48')]+'%'};return _0x409ca0;})});}_0xc52c2e=_[_0xadea('0x4b')]({},_0xc52c2e,_0x2dc0ae[_0xadea('0x4c')]);return _0x4bb356['getSubjects'](_0xc52c2e);}})[_0xadea('0x1d')](function(_0x57cc67){if(_0x57cc67){_0x3c4a2a=_0x57cc67['length'];if(!_0x2dc0ae[_0xadea('0x3d')][_0xadea('0x44')]('nolimit')){_0xc52c2e[_0xadea('0x2e')]=qs[_0xadea('0x2e')](_0x2dc0ae[_0xadea('0x3d')]['limit']);_0xc52c2e['offset']=qs[_0xadea('0x2d')](_0x2dc0ae[_0xadea('0x3d')][_0xadea('0x2d')]);}return _0x4bb356[_0xadea('0x5a')](_0xc52c2e);}})[_0xadea('0x1d')](function(_0x5d4f8d){if(_0x5d4f8d){return _0x5d4f8d?{'count':_0x3c4a2a,'rows':_0x5d4f8d}:null;}})['then'](respondWithResult(_0x1a4c1c,null))[_0xadea('0x28')](handleError(_0x1a4c1c,null));};exports[_0xadea('0x5b')]=function(_0x28f0df,_0x20b560,_0x1088ad){var _0x4b3c50={};var _0x44843a={};var _0x32d7d6;var _0x4f969b;return db[_0xadea('0x4d')][_0xadea('0x56')]({'where':{'id':_0x28f0df[_0xadea('0x4f')]['id']}})[_0xadea('0x1d')](handleEntityNotFound(_0x20b560,null))[_0xadea('0x1d')](function(_0x33f8ef){if(_0x33f8ef){_0x32d7d6=_0x33f8ef;_0x44843a['model']=_[_0xadea('0x3e')](db[_0xadea('0x59')]['rawAttributes']);_0x44843a['query']=_['keys'](_0x28f0df[_0xadea('0x3d')]);_0x44843a[_0xadea('0x3f')]=_[_0xadea('0x40')](_0x44843a[_0xadea('0x41')],_0x44843a['query']);_0x4b3c50[_0xadea('0x42')]=_['intersection'](_0x44843a[_0xadea('0x41')],qs['fields'](_0x28f0df['query'][_0xadea('0x43')]));_0x4b3c50[_0xadea('0x42')]=_0x4b3c50['attributes'][_0xadea('0x50')]?_0x4b3c50[_0xadea('0x42')]:_0x44843a[_0xadea('0x41')];_0x4b3c50[_0xadea('0x45')]=qs[_0xadea('0x46')](_0x28f0df[_0xadea('0x3d')]['sort']);_0x4b3c50[_0xadea('0x49')]=qs['filters'](_[_0xadea('0x47')](_0x28f0df[_0xadea('0x3d')],_0x44843a[_0xadea('0x3f')]));if(_0x28f0df[_0xadea('0x3d')][_0xadea('0x48')]){_0x4b3c50[_0xadea('0x49')]=_[_0xadea('0x4b')](_0x4b3c50[_0xadea('0x49')],{'$or':_['map'](_0x4b3c50[_0xadea('0x42')],function(_0x1926b0){var _0x391d6e={};_0x391d6e[_0x1926b0]={'$like':'%'+_0x28f0df['query'][_0xadea('0x48')]+'%'};return _0x391d6e;})});}_0x4b3c50=_['merge']({},_0x4b3c50,_0x28f0df[_0xadea('0x4c')]);return _0x32d7d6['getDescriptions'](_0x4b3c50);}})[_0xadea('0x1d')](function(_0x10e5f9){if(_0x10e5f9){_0x4f969b=_0x10e5f9['length'];if(!_0x28f0df[_0xadea('0x3d')][_0xadea('0x44')](_0xadea('0x58'))){_0x4b3c50[_0xadea('0x2e')]=qs['limit'](_0x28f0df[_0xadea('0x3d')][_0xadea('0x2e')]);_0x4b3c50[_0xadea('0x2d')]=qs[_0xadea('0x2d')](_0x28f0df['query'][_0xadea('0x2d')]);}return _0x32d7d6['getDescriptions'](_0x4b3c50);}})['then'](function(_0x451eec){if(_0x451eec){return _0x451eec?{'count':_0x4f969b,'rows':_0x451eec}:null;}})[_0xadea('0x1d')](respondWithResult(_0x20b560,null))[_0xadea('0x28')](handleError(_0x20b560,null));}; \ No newline at end of file +var _0x3b43=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../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','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','find','body','params','getFields','findOne','SugarcrmField','nolimit','getSubjects','getDescriptions','html-pdf','rimraf','request-promise','moment','mustache'];(function(_0x3676fc,_0x369252){var _0x305fa1=function(_0x21b996){while(--_0x21b996){_0x3676fc['push'](_0x3676fc['shift']());}};_0x305fa1(++_0x369252);}(_0x3b43,0x103));var _0x33b4=function(_0x212159,_0x2d271c){_0x212159=_0x212159-0x0;var _0x26f9b7=_0x3b43[_0x212159];return _0x26f9b7;};'use strict';var pdf=require(_0x33b4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x33b4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x33b4('0x2'));var moment=require(_0x33b4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x33b4('0x4'));var util=require(_0x33b4('0x5'));var path=require(_0x33b4('0x6'));var sox=require(_0x33b4('0x7'));var csv=require(_0x33b4('0x8'));var ejs=require(_0x33b4('0x9'));var fs=require('fs');var _=require(_0x33b4('0xa'));var squel=require(_0x33b4('0xb'));var crypto=require(_0x33b4('0xc'));var jsforce=require(_0x33b4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x33b4('0x8'));var querystring=require(_0x33b4('0xe'));var Papa=require('papaparse');var Redis=require(_0x33b4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x33b4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x33b4('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x33b4('0x12'))['db'];var jayson=require(_0x33b4('0x13'));var client=jayson[_0x33b4('0x14')][_0x33b4('0x15')]({'port':0x232a});function checkPasswordPattern(_0x22ede0,_0x3f6a34,_0x2813dc){if(_0x2813dc){var _0x3aa554=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3aa554[_0x33b4('0x16')](_0x3f6a34)){return _0x22ede0;}else{throw new db[(_0x33b4('0x17'))]['ValidationError'](_0x33b4('0x18'));}}else{return _0x22ede0;}}function respondWithRpcPromise(_0x1ca667,_0x46afd5,_0x525fd1,_0x1a939a){return new BPromise(function(_0x25212f,_0x1421aa){var _0x2f42fa=_0x1a939a||client;return _0x2f42fa[_0x33b4('0x19')](_0x1ca667,_0x525fd1)['then'](function(_0x8dda52){logger[_0x33b4('0x1a')](_0x33b4('0x1b'),_0x46afd5,_0x33b4('0x1c'));logger[_0x33b4('0x1d')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x46afd5,_0x33b4('0x1c'),JSON[_0x33b4('0x1e')](_0x8dda52));if(_0x8dda52[_0x33b4('0x1f')]){if(_0x8dda52['error'][_0x33b4('0x20')]===0x1f4){logger[_0x33b4('0x1f')](_0x33b4('0x1b'),_0x46afd5,_0x8dda52['error'][_0x33b4('0x21')]);return _0x1421aa(_0x8dda52[_0x33b4('0x1f')]['message']);}logger[_0x33b4('0x1f')](_0x33b4('0x1b'),_0x46afd5,_0x8dda52[_0x33b4('0x1f')]['message']);return _0x25212f(_0x8dda52[_0x33b4('0x1f')][_0x33b4('0x21')]);}else{logger['info'](_0x33b4('0x1b'),_0x46afd5,'request\x20sent');_0x25212f(_0x8dda52[_0x33b4('0x22')][_0x33b4('0x21')]);}})[_0x33b4('0x23')](function(_0xbd0ff3){logger['error'](_0x33b4('0x1b'),_0x46afd5,_0xbd0ff3);_0x1421aa(_0xbd0ff3);});});}function respondWithStatusCode(_0x40b8a5,_0x2e2017){_0x2e2017=_0x2e2017||0xcc;return function(_0x21d63a){if(_0x21d63a){return _0x40b8a5[_0x33b4('0x24')](_0x2e2017);}return _0x40b8a5[_0x33b4('0x25')](_0x2e2017)['end']();};}function respondWithResult(_0x3f49ff,_0x286b61){_0x286b61=_0x286b61||0xc8;return function(_0x6aa604){if(_0x6aa604){return _0x3f49ff['status'](_0x286b61)[_0x33b4('0x26')](_0x6aa604);}};}function respondWithFilteredResult(_0x5723b9,_0x677dd2){return function(_0x4e0d95){if(_0x4e0d95){var _0x4ce189=_0x4e0d95[_0x33b4('0x27')],_0x23e4d5=_0x677dd2[_0x33b4('0x28')],_0x2763f5=_0x677dd2[_0x33b4('0x28')]+_0x677dd2[_0x33b4('0x29')],_0x37b719;if(_0x2763f5>=_0x4ce189){_0x2763f5=_0x4ce189;_0x37b719=0xc8;}else{_0x37b719=0xce;}_0x5723b9['status'](_0x37b719);return _0x5723b9['set'](_0x33b4('0x2a'),_0x23e4d5+'-'+_0x2763f5+'/'+_0x4ce189)[_0x33b4('0x26')](_0x4e0d95);}return null;};}function patchUpdates(_0x178edf){return function(_0x2e3a07){try{jsonpatch[_0x33b4('0x2b')](_0x2e3a07,_0x178edf,!![]);}catch(_0x2091e0){return BPromise[_0x33b4('0x2c')](_0x2091e0);}return _0x2e3a07[_0x33b4('0x2d')]();};}function saveUpdates(_0x5e4f8c,_0x43b6f4){return function(_0x303483){if(_0x303483){return _0x303483[_0x33b4('0x2e')](_0x5e4f8c)['then'](function(_0x530715){return _0x530715;});}return null;};}function removeEntity(_0x3d9875,_0x50d5df){return function(_0xd1d7dc){if(_0xd1d7dc){return _0xd1d7dc['destroy']()[_0x33b4('0x2f')](function(){_0x3d9875[_0x33b4('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3300a4,_0x21c8b4){return function(_0x53c5ef){if(!_0x53c5ef){_0x3300a4[_0x33b4('0x24')](0x194);}return _0x53c5ef;};}function handleError(_0xcf3023,_0x543882){_0x543882=_0x543882||0x1f4;return function(_0x21e725){logger['error'](_0x21e725['stack']);if(_0x21e725[_0x33b4('0x30')]){delete _0x21e725[_0x33b4('0x30')];}_0xcf3023['status'](_0x543882)[_0x33b4('0x31')](_0x21e725);};}exports[_0x33b4('0x32')]=function(_0x1949a7,_0x43212c){var _0x521b26={},_0x324e76={},_0x57344d={'count':0x0,'rows':[]};var _0x1c9d79=_[_0x33b4('0x33')](db[_0x33b4('0x34')][_0x33b4('0x35')],function(_0x2362c0){return{'name':_0x2362c0[_0x33b4('0x36')],'type':_0x2362c0['type'][_0x33b4('0x37')]};});_0x324e76[_0x33b4('0x38')]=_['map'](_0x1c9d79,_0x33b4('0x30'));_0x324e76[_0x33b4('0x39')]=_[_0x33b4('0x3a')](_0x1949a7[_0x33b4('0x39')]);_0x324e76[_0x33b4('0x3b')]=_[_0x33b4('0x3c')](_0x324e76[_0x33b4('0x38')],_0x324e76[_0x33b4('0x39')]);_0x521b26[_0x33b4('0x3d')]=_[_0x33b4('0x3c')](_0x324e76[_0x33b4('0x38')],qs[_0x33b4('0x3e')](_0x1949a7['query'][_0x33b4('0x3e')]));_0x521b26[_0x33b4('0x3d')]=_0x521b26[_0x33b4('0x3d')][_0x33b4('0x3f')]?_0x521b26['attributes']:_0x324e76['model'];if(!_0x1949a7[_0x33b4('0x39')][_0x33b4('0x40')]('nolimit')){_0x521b26[_0x33b4('0x29')]=qs[_0x33b4('0x29')](_0x1949a7[_0x33b4('0x39')][_0x33b4('0x29')]);_0x521b26[_0x33b4('0x28')]=qs[_0x33b4('0x28')](_0x1949a7['query']['offset']);}_0x521b26[_0x33b4('0x41')]=qs[_0x33b4('0x42')](_0x1949a7[_0x33b4('0x39')]['sort']);_0x521b26[_0x33b4('0x43')]=qs['filters'](_[_0x33b4('0x44')](_0x1949a7[_0x33b4('0x39')],_0x324e76[_0x33b4('0x3b')]));if(_0x1949a7[_0x33b4('0x39')][_0x33b4('0x45')]){_0x521b26[_0x33b4('0x43')]=_[_0x33b4('0x46')](_0x521b26[_0x33b4('0x43')],{'$or':_[_0x33b4('0x33')](_0x1c9d79,function(_0x447488){if(_0x447488[_0x33b4('0x47')]!==_0x33b4('0x48')){var _0x399f2b={};_0x399f2b[_0x447488[_0x33b4('0x30')]]={'$like':'%'+_0x1949a7[_0x33b4('0x39')][_0x33b4('0x45')]+'%'};return _0x399f2b;}})});}_0x521b26=_['merge']({},_0x521b26,_0x1949a7[_0x33b4('0x49')]);var _0x14a057={'where':_0x521b26[_0x33b4('0x43')]};return db[_0x33b4('0x34')][_0x33b4('0x27')](_0x14a057)[_0x33b4('0x2f')](function(_0x3fc2b0){_0x57344d[_0x33b4('0x27')]=_0x3fc2b0;if(_0x1949a7[_0x33b4('0x39')][_0x33b4('0x4a')]){_0x521b26[_0x33b4('0x4b')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x33b4('0x4c')](_0x521b26);})[_0x33b4('0x2f')](function(_0x1252ad){_0x57344d[_0x33b4('0x4d')]=_0x1252ad;return _0x57344d;})[_0x33b4('0x2f')](respondWithFilteredResult(_0x43212c,_0x521b26))['catch'](handleError(_0x43212c,null));};exports[_0x33b4('0x4e')]=function(_0x52a85f,_0x1854d4){var _0x281b94={'raw':![],'where':{'id':_0x52a85f['params']['id']}},_0x4dfe2d={};_0x4dfe2d[_0x33b4('0x38')]=_[_0x33b4('0x3a')](db['SugarcrmConfiguration']['rawAttributes']);_0x4dfe2d[_0x33b4('0x39')]=_[_0x33b4('0x3a')](_0x52a85f[_0x33b4('0x39')]);_0x4dfe2d[_0x33b4('0x3b')]=_[_0x33b4('0x3c')](_0x4dfe2d[_0x33b4('0x38')],_0x4dfe2d[_0x33b4('0x39')]);_0x281b94['attributes']=_[_0x33b4('0x3c')](_0x4dfe2d['model'],qs['fields'](_0x52a85f[_0x33b4('0x39')][_0x33b4('0x3e')]));_0x281b94[_0x33b4('0x3d')]=_0x281b94[_0x33b4('0x3d')][_0x33b4('0x3f')]?_0x281b94[_0x33b4('0x3d')]:_0x4dfe2d[_0x33b4('0x38')];if(_0x52a85f[_0x33b4('0x39')][_0x33b4('0x4a')]){_0x281b94[_0x33b4('0x4b')]=[{'all':!![]}];}_0x281b94=_[_0x33b4('0x46')]({},_0x281b94,_0x52a85f['options']);return db[_0x33b4('0x34')][_0x33b4('0x4f')](_0x281b94)['then'](handleEntityNotFound(_0x1854d4,null))['then'](respondWithResult(_0x1854d4,null))['catch'](handleError(_0x1854d4,null));};exports['create']=function(_0xc50c54,_0x3c433f){return db[_0x33b4('0x34')]['create'](_0xc50c54['body'],{})[_0x33b4('0x2f')](respondWithResult(_0x3c433f,0xc9))[_0x33b4('0x23')](handleError(_0x3c433f,null));};exports['update']=function(_0x893227,_0x503bb5){if(_0x893227[_0x33b4('0x50')]['id']){delete _0x893227[_0x33b4('0x50')]['id'];}return db[_0x33b4('0x34')][_0x33b4('0x4f')]({'where':{'id':_0x893227[_0x33b4('0x51')]['id']}})[_0x33b4('0x2f')](handleEntityNotFound(_0x503bb5,null))[_0x33b4('0x2f')](saveUpdates(_0x893227[_0x33b4('0x50')],null))[_0x33b4('0x2f')](respondWithResult(_0x503bb5,null))['catch'](handleError(_0x503bb5,null));};exports['destroy']=function(_0x8b3f1,_0x44fdbb){return db[_0x33b4('0x34')][_0x33b4('0x4f')]({'where':{'id':_0x8b3f1[_0x33b4('0x51')]['id']}})['then'](handleEntityNotFound(_0x44fdbb,null))[_0x33b4('0x2f')](removeEntity(_0x44fdbb,null))[_0x33b4('0x23')](handleError(_0x44fdbb,null));};exports[_0x33b4('0x52')]=function(_0x4a6413,_0x1dc621,_0x2ff515){var _0x1c1a8c={};var _0x321d3d={};var _0x24431c;var _0x12d7b7;return db[_0x33b4('0x34')][_0x33b4('0x53')]({'where':{'id':_0x4a6413[_0x33b4('0x51')]['id']}})['then'](handleEntityNotFound(_0x1dc621,null))['then'](function(_0x2627d5){if(_0x2627d5){_0x24431c=_0x2627d5;_0x321d3d[_0x33b4('0x38')]=_['keys'](db[_0x33b4('0x54')][_0x33b4('0x35')]);_0x321d3d[_0x33b4('0x39')]=_[_0x33b4('0x3a')](_0x4a6413[_0x33b4('0x39')]);_0x321d3d[_0x33b4('0x3b')]=_[_0x33b4('0x3c')](_0x321d3d['model'],_0x321d3d[_0x33b4('0x39')]);_0x1c1a8c[_0x33b4('0x3d')]=_[_0x33b4('0x3c')](_0x321d3d['model'],qs[_0x33b4('0x3e')](_0x4a6413['query'][_0x33b4('0x3e')]));_0x1c1a8c[_0x33b4('0x3d')]=_0x1c1a8c[_0x33b4('0x3d')]['length']?_0x1c1a8c[_0x33b4('0x3d')]:_0x321d3d[_0x33b4('0x38')];_0x1c1a8c[_0x33b4('0x41')]=qs[_0x33b4('0x42')](_0x4a6413[_0x33b4('0x39')][_0x33b4('0x42')]);_0x1c1a8c['where']=qs[_0x33b4('0x3b')](_['pick'](_0x4a6413['query'],_0x321d3d[_0x33b4('0x3b')]));if(_0x4a6413[_0x33b4('0x39')][_0x33b4('0x45')]){_0x1c1a8c[_0x33b4('0x43')]=_[_0x33b4('0x46')](_0x1c1a8c[_0x33b4('0x43')],{'$or':_['map'](_0x1c1a8c[_0x33b4('0x3d')],function(_0x955db){var _0x209ca3={};_0x209ca3[_0x955db]={'$like':'%'+_0x4a6413['query'][_0x33b4('0x45')]+'%'};return _0x209ca3;})});}_0x1c1a8c=_[_0x33b4('0x46')]({},_0x1c1a8c,_0x4a6413[_0x33b4('0x49')]);return _0x24431c[_0x33b4('0x52')](_0x1c1a8c);}})[_0x33b4('0x2f')](function(_0x3a5f71){if(_0x3a5f71){_0x12d7b7=_0x3a5f71[_0x33b4('0x3f')];if(!_0x4a6413[_0x33b4('0x39')][_0x33b4('0x40')](_0x33b4('0x55'))){_0x1c1a8c[_0x33b4('0x29')]=qs['limit'](_0x4a6413[_0x33b4('0x39')]['limit']);_0x1c1a8c[_0x33b4('0x28')]=qs[_0x33b4('0x28')](_0x4a6413['query'][_0x33b4('0x28')]);}return _0x24431c[_0x33b4('0x52')](_0x1c1a8c);}})[_0x33b4('0x2f')](function(_0x2407ba){if(_0x2407ba){return _0x2407ba?{'count':_0x12d7b7,'rows':_0x2407ba}:null;}})[_0x33b4('0x2f')](respondWithResult(_0x1dc621,null))[_0x33b4('0x23')](handleError(_0x1dc621,null));};exports[_0x33b4('0x56')]=function(_0x5f0ac5,_0x5bbd9e,_0x2b85ae){var _0x3705e3={};var _0x3c0977={};var _0xf2824d;var _0x55df94;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x5f0ac5[_0x33b4('0x51')]['id']}})[_0x33b4('0x2f')](handleEntityNotFound(_0x5bbd9e,null))[_0x33b4('0x2f')](function(_0x4c06d5){if(_0x4c06d5){_0xf2824d=_0x4c06d5;_0x3c0977[_0x33b4('0x38')]=_['keys'](db['SugarcrmField'][_0x33b4('0x35')]);_0x3c0977[_0x33b4('0x39')]=_['keys'](_0x5f0ac5['query']);_0x3c0977[_0x33b4('0x3b')]=_[_0x33b4('0x3c')](_0x3c0977['model'],_0x3c0977[_0x33b4('0x39')]);_0x3705e3[_0x33b4('0x3d')]=_[_0x33b4('0x3c')](_0x3c0977[_0x33b4('0x38')],qs[_0x33b4('0x3e')](_0x5f0ac5[_0x33b4('0x39')][_0x33b4('0x3e')]));_0x3705e3[_0x33b4('0x3d')]=_0x3705e3[_0x33b4('0x3d')][_0x33b4('0x3f')]?_0x3705e3[_0x33b4('0x3d')]:_0x3c0977[_0x33b4('0x38')];_0x3705e3[_0x33b4('0x41')]=qs[_0x33b4('0x42')](_0x5f0ac5[_0x33b4('0x39')][_0x33b4('0x42')]);_0x3705e3['where']=qs[_0x33b4('0x3b')](_[_0x33b4('0x44')](_0x5f0ac5[_0x33b4('0x39')],_0x3c0977[_0x33b4('0x3b')]));if(_0x5f0ac5[_0x33b4('0x39')]['filter']){_0x3705e3['where']=_[_0x33b4('0x46')](_0x3705e3[_0x33b4('0x43')],{'$or':_[_0x33b4('0x33')](_0x3705e3[_0x33b4('0x3d')],function(_0x3176e7){var _0x214fc3={};_0x214fc3[_0x3176e7]={'$like':'%'+_0x5f0ac5[_0x33b4('0x39')][_0x33b4('0x45')]+'%'};return _0x214fc3;})});}_0x3705e3=_[_0x33b4('0x46')]({},_0x3705e3,_0x5f0ac5[_0x33b4('0x49')]);return _0xf2824d[_0x33b4('0x56')](_0x3705e3);}})[_0x33b4('0x2f')](function(_0x1d6276){if(_0x1d6276){_0x55df94=_0x1d6276[_0x33b4('0x3f')];if(!_0x5f0ac5[_0x33b4('0x39')][_0x33b4('0x40')]('nolimit')){_0x3705e3[_0x33b4('0x29')]=qs[_0x33b4('0x29')](_0x5f0ac5['query']['limit']);_0x3705e3[_0x33b4('0x28')]=qs[_0x33b4('0x28')](_0x5f0ac5[_0x33b4('0x39')][_0x33b4('0x28')]);}return _0xf2824d[_0x33b4('0x56')](_0x3705e3);}})[_0x33b4('0x2f')](function(_0x3275b6){if(_0x3275b6){return _0x3275b6?{'count':_0x55df94,'rows':_0x3275b6}:null;}})[_0x33b4('0x2f')](respondWithResult(_0x5bbd9e,null))[_0x33b4('0x23')](handleError(_0x5bbd9e,null));};exports['getDescriptions']=function(_0x23c732,_0x5c5e2b,_0x1b858a){var _0x34a761={};var _0x4fbf04={};var _0x1eef0b;var _0x58d9ca;return db['SugarcrmConfiguration'][_0x33b4('0x53')]({'where':{'id':_0x23c732[_0x33b4('0x51')]['id']}})[_0x33b4('0x2f')](handleEntityNotFound(_0x5c5e2b,null))[_0x33b4('0x2f')](function(_0x421f0d){if(_0x421f0d){_0x1eef0b=_0x421f0d;_0x4fbf04['model']=_[_0x33b4('0x3a')](db[_0x33b4('0x54')][_0x33b4('0x35')]);_0x4fbf04['query']=_[_0x33b4('0x3a')](_0x23c732[_0x33b4('0x39')]);_0x4fbf04['filters']=_[_0x33b4('0x3c')](_0x4fbf04[_0x33b4('0x38')],_0x4fbf04[_0x33b4('0x39')]);_0x34a761[_0x33b4('0x3d')]=_[_0x33b4('0x3c')](_0x4fbf04['model'],qs['fields'](_0x23c732['query']['fields']));_0x34a761[_0x33b4('0x3d')]=_0x34a761['attributes'][_0x33b4('0x3f')]?_0x34a761[_0x33b4('0x3d')]:_0x4fbf04[_0x33b4('0x38')];_0x34a761[_0x33b4('0x41')]=qs[_0x33b4('0x42')](_0x23c732[_0x33b4('0x39')][_0x33b4('0x42')]);_0x34a761[_0x33b4('0x43')]=qs[_0x33b4('0x3b')](_[_0x33b4('0x44')](_0x23c732[_0x33b4('0x39')],_0x4fbf04[_0x33b4('0x3b')]));if(_0x23c732[_0x33b4('0x39')]['filter']){_0x34a761[_0x33b4('0x43')]=_[_0x33b4('0x46')](_0x34a761['where'],{'$or':_[_0x33b4('0x33')](_0x34a761[_0x33b4('0x3d')],function(_0x36832f){var _0x3ebb38={};_0x3ebb38[_0x36832f]={'$like':'%'+_0x23c732['query'][_0x33b4('0x45')]+'%'};return _0x3ebb38;})});}_0x34a761=_[_0x33b4('0x46')]({},_0x34a761,_0x23c732[_0x33b4('0x49')]);return _0x1eef0b[_0x33b4('0x57')](_0x34a761);}})[_0x33b4('0x2f')](function(_0x5d7e3f){if(_0x5d7e3f){_0x58d9ca=_0x5d7e3f[_0x33b4('0x3f')];if(!_0x23c732[_0x33b4('0x39')][_0x33b4('0x40')](_0x33b4('0x55'))){_0x34a761[_0x33b4('0x29')]=qs['limit'](_0x23c732['query'][_0x33b4('0x29')]);_0x34a761['offset']=qs[_0x33b4('0x28')](_0x23c732[_0x33b4('0x39')][_0x33b4('0x28')]);}return _0x1eef0b[_0x33b4('0x57')](_0x34a761);}})[_0x33b4('0x2f')](function(_0x557426){if(_0x557426){return _0x557426?{'count':_0x58d9ca,'rows':_0x557426}:null;}})['then'](respondWithResult(_0x5c5e2b,null))[_0x33b4('0x23')](handleError(_0x5c5e2b,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 67a6f9d..b65d20d 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 _0x85be=['moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','SugarcrmConfiguration','int_sugarcrm_configurations','../../config/logger','api'];(function(_0x12bcf7,_0xc11103){var _0x2825a=function(_0x4452ba){while(--_0x4452ba){_0x12bcf7['push'](_0x12bcf7['shift']());}};_0x2825a(++_0xc11103);}(_0x85be,0x8a));var _0xe85b=function(_0x451a26,_0x36bc0){_0x451a26=_0x451a26-0x0;var _0x3b8d60=_0x85be[_0x451a26];return _0x3b8d60;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe85b('0x0'))(_0xe85b('0x1'));var moment=require(_0xe85b('0x2'));var BPromise=require('bluebird');var rp=require(_0xe85b('0x3'));var fs=require('fs');var path=require(_0xe85b('0x4'));var rimraf=require(_0xe85b('0x5'));var config=require(_0xe85b('0x6'));var attributes=require(_0xe85b('0x7'));module['exports']=function(_0x5ad774,_0x36eacf){return _0x5ad774['define'](_0xe85b('0x8'),attributes,{'tableName':_0xe85b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc512=['int_sugarcrm_configurations','util','../../config/logger','bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','SugarcrmConfiguration'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xc512,0xfd));var _0x2c51=function(_0x266543,_0x580b73){_0x266543=_0x266543-0x0;var _0x4ae2af=_0xc512[_0x266543];return _0x4ae2af;};'use strict';var _=require('lodash');var util=require(_0x2c51('0x0'));var logger=require(_0x2c51('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2c51('0x2'));var rp=require(_0x2c51('0x3'));var fs=require('fs');var path=require(_0x2c51('0x4'));var rimraf=require(_0x2c51('0x5'));var config=require('../../config/environment');var attributes=require(_0x2c51('0x6'));module['exports']=function(_0x35673a,_0x3350ee){return _0x35673a['define'](_0x2c51('0x7'),attributes,{'tableName':_0x2c51('0x8'),'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 75b6ae5..edd39cc 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 _0x39c9=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','request\x20sent','debug','stringify','error','SugarcrmConfiguration,\x20%s,\x20%s','message','info'];(function(_0x323227,_0x360e53){var _0x57fd80=function(_0x34a998){while(--_0x34a998){_0x323227['push'](_0x323227['shift']());}};_0x57fd80(++_0x360e53);}(_0x39c9,0x95));var _0x939c=function(_0x3db122,_0x5e6bee){_0x3db122=_0x3db122-0x0;var _0x325b67=_0x39c9[_0x3db122];return _0x325b67;};'use strict';var _=require(_0x939c('0x0'));var util=require(_0x939c('0x1'));var moment=require(_0x939c('0x2'));var BPromise=require(_0x939c('0x3'));var rs=require(_0x939c('0x4'));var fs=require('fs');var Redis=require(_0x939c('0x5'));var db=require(_0x939c('0x6'))['db'];var utils=require(_0x939c('0x7'));var logger=require(_0x939c('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x939c('0x9')][_0x939c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39f59e,_0x2df487,_0x5e7cad){return new BPromise(function(_0x46d9f9,_0x14f4af){return client['request'](_0x39f59e,_0x5e7cad)[_0x939c('0xb')](function(_0x6eaec1){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x2df487,_0x939c('0xc'));logger[_0x939c('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x2df487,_0x939c('0xc'),JSON[_0x939c('0xe')](_0x6eaec1));if(_0x6eaec1[_0x939c('0xf')]){if(_0x6eaec1[_0x939c('0xf')]['code']===0x1f4){logger['error'](_0x939c('0x10'),_0x2df487,_0x6eaec1[_0x939c('0xf')][_0x939c('0x11')]);return _0x14f4af(_0x6eaec1[_0x939c('0xf')][_0x939c('0x11')]);}logger[_0x939c('0xf')](_0x939c('0x10'),_0x2df487,_0x6eaec1[_0x939c('0xf')][_0x939c('0x11')]);return _0x46d9f9(_0x6eaec1[_0x939c('0xf')][_0x939c('0x11')]);}else{logger[_0x939c('0x12')](_0x939c('0x10'),_0x2df487,_0x939c('0xc'));_0x46d9f9(_0x6eaec1[_0x939c('0x13')][_0x939c('0x11')]);}})[_0x939c('0x14')](function(_0x8ec0ff){logger[_0x939c('0xf')](_0x939c('0x10'),_0x2df487,_0x8ec0ff);_0x14f4af(_0x8ec0ff);});});} \ No newline at end of file +var _0x25c2=['message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','request','then','info','request\x20sent','debug','error','code','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x25c2,0xec));var _0x225c=function(_0x17406e,_0x1049fd){_0x17406e=_0x17406e-0x0;var _0x2bfc5a=_0x25c2[_0x17406e];return _0x2bfc5a;};'use strict';var _=require(_0x225c('0x0'));var util=require('util');var moment=require(_0x225c('0x1'));var BPromise=require('bluebird');var rs=require(_0x225c('0x2'));var fs=require('fs');var Redis=require(_0x225c('0x3'));var db=require(_0x225c('0x4'))['db'];var utils=require(_0x225c('0x5'));var logger=require('../../config/logger')(_0x225c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x225c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f929e,_0x263260,_0x35054c){return new BPromise(function(_0x36425e,_0x58a3b9){return client[_0x225c('0x8')](_0x2f929e,_0x35054c)[_0x225c('0x9')](function(_0x39344d){logger[_0x225c('0xa')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x263260,_0x225c('0xb'));logger[_0x225c('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x263260,'request\x20sent',JSON['stringify'](_0x39344d));if(_0x39344d['error']){if(_0x39344d[_0x225c('0xd')][_0x225c('0xe')]===0x1f4){logger[_0x225c('0xd')](_0x225c('0xf'),_0x263260,_0x39344d['error'][_0x225c('0x10')]);return _0x58a3b9(_0x39344d['error'][_0x225c('0x10')]);}logger[_0x225c('0xd')](_0x225c('0xf'),_0x263260,_0x39344d[_0x225c('0xd')][_0x225c('0x10')]);return _0x36425e(_0x39344d[_0x225c('0xd')][_0x225c('0x10')]);}else{logger[_0x225c('0xa')](_0x225c('0xf'),_0x263260,_0x225c('0xb'));_0x36425e(_0x39344d[_0x225c('0x11')][_0x225c('0x10')]);}})['catch'](function(_0x2abe6b){logger[_0x225c('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x263260,_0x2abe6b);_0x58a3b9(_0x2abe6b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 6f34efb..b07a054 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 _0xd685=['post','create','put','/:id','update','delete','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','index','get','isAuthenticated','show'];(function(_0x36f47c,_0x38ef4d){var _0x296c55=function(_0x403eec){while(--_0x403eec){_0x36f47c['push'](_0x36f47c['shift']());}};_0x296c55(++_0x38ef4d);}(_0xd685,0x1db));var _0x5d68=function(_0xc03a8e,_0x4c3793){_0xc03a8e=_0xc03a8e-0x0;var _0x5d5e01=_0xd685[_0xc03a8e];return _0x5d5e01;};'use strict';var multer=require(_0x5d68('0x0'));var util=require('util');var path=require(_0x5d68('0x1'));var timeout=require(_0x5d68('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x5d68('0x3'));var interaction=require(_0x5d68('0x4'));var config=require(_0x5d68('0x5'));var controller=require(_0x5d68('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x5d68('0x7')]);router[_0x5d68('0x8')]('/:id',auth[_0x5d68('0x9')](),controller[_0x5d68('0xa')]);router[_0x5d68('0xb')]('/',auth[_0x5d68('0x9')](),controller[_0x5d68('0xc')]);router[_0x5d68('0xd')](_0x5d68('0xe'),auth[_0x5d68('0x9')](),controller[_0x5d68('0xf')]);router[_0x5d68('0x10')](_0x5d68('0xe'),auth[_0x5d68('0x9')](),controller['destroy']);module[_0x5d68('0x11')]=router; \ No newline at end of file +var _0x90a3=['get','isAuthenticated','index','/:id','show','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller'];(function(_0x51cabf,_0x2828db){var _0x517538=function(_0x24a966){while(--_0x24a966){_0x51cabf['push'](_0x51cabf['shift']());}};_0x517538(++_0x2828db);}(_0x90a3,0xc8));var _0x390a=function(_0x218766,_0x151e89){_0x218766=_0x218766-0x0;var _0x4e1a73=_0x90a3[_0x218766];return _0x4e1a73;};'use strict';var multer=require(_0x390a('0x0'));var util=require(_0x390a('0x1'));var path=require(_0x390a('0x2'));var timeout=require('connect-timeout');var express=require(_0x390a('0x3'));var router=express[_0x390a('0x4')]();var auth=require(_0x390a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x390a('0x6'));var controller=require(_0x390a('0x7'));router[_0x390a('0x8')]('/',auth[_0x390a('0x9')](),controller[_0x390a('0xa')]);router[_0x390a('0x8')](_0x390a('0xb'),auth[_0x390a('0x9')](),controller[_0x390a('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x390a('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x390a('0xd')](_0x390a('0xb'),auth[_0x390a('0x9')](),controller[_0x390a('0xe')]);module[_0x390a('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index e0598f8..0c1d3b9 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 _0xc3d8=['customVariable','keyValue','STRING','variable','ENUM','string'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc3d8,0x70));var _0x8c3d=function(_0x149ea5,_0x307cfc){_0x149ea5=_0x149ea5-0x0;var _0x4a4dcd=_0xc3d8[_0x149ea5];return _0x4a4dcd;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x8c3d('0x0')](_0x8c3d('0x1'),'variable',_0x8c3d('0x2'),_0x8c3d('0x3')),'defaultValue':_0x8c3d('0x1')},'content':{'type':Sequelize[_0x8c3d('0x4')]},'key':{'type':Sequelize[_0x8c3d('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x8c3d('0x1'),_0x8c3d('0x5'),_0x8c3d('0x2'))},'keyContent':{'type':Sequelize[_0x8c3d('0x4')]},'idField':{'type':Sequelize[_0x8c3d('0x4')]},'nameField':{'type':Sequelize[_0x8c3d('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8c3d('0x4')]}}; \ No newline at end of file +var _0xde9f=['ENUM','sequelize','exports','string','customVariable','keyValue','STRING'];(function(_0x47d454,_0xf3253a){var _0x1188b9=function(_0x1b6f8d){while(--_0x1b6f8d){_0x47d454['push'](_0x47d454['shift']());}};_0x1188b9(++_0xf3253a);}(_0xde9f,0x16d));var _0xfde9=function(_0x28c939,_0x110e29){_0x28c939=_0x28c939-0x0;var _0x527fe9=_0xde9f[_0x28c939];return _0x527fe9;};'use strict';var Sequelize=require(_0xfde9('0x0'));module[_0xfde9('0x1')]={'type':{'type':Sequelize['ENUM'](_0xfde9('0x2'),'variable',_0xfde9('0x3'),_0xfde9('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfde9('0x5')]},'key':{'type':Sequelize[_0xfde9('0x5')]},'keyType':{'type':Sequelize[_0xfde9('0x6')](_0xfde9('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xfde9('0x5')]},'nameField':{'type':Sequelize[_0xfde9('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfde9('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 39ef694..c985f0e 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 _0x126a=['reject','save','then','destroy','error','stack','name','send','index','map','SugarcrmField','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','params','find','catch','create','body','update','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','Content-Range','apply'];(function(_0x29b3d2,_0x27de6f){var _0x16c0ff=function(_0x278b99){while(--_0x278b99){_0x29b3d2['push'](_0x29b3d2['shift']());}};_0x16c0ff(++_0x27de6f);}(_0x126a,0x1f2));var _0xa126=function(_0x11fa45,_0x1bf9a9){_0x11fa45=_0x11fa45-0x0;var _0x364684=_0x126a[_0x11fa45];return _0x364684;};'use strict';var pdf=require(_0xa126('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa126('0x1'));var zipdir=require(_0xa126('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa126('0x3'));var moment=require('moment');var BPromise=require(_0xa126('0x4'));var Mustache=require(_0xa126('0x5'));var util=require(_0xa126('0x6'));var path=require(_0xa126('0x7'));var sox=require(_0xa126('0x8'));var csv=require(_0xa126('0x9'));var ejs=require(_0xa126('0xa'));var fs=require('fs');var _=require(_0xa126('0xb'));var squel=require(_0xa126('0xc'));var crypto=require(_0xa126('0xd'));var jsforce=require(_0xa126('0xe'));var deskjs=require(_0xa126('0xf'));var toCsv=require(_0xa126('0x9'));var querystring=require(_0xa126('0x10'));var Papa=require(_0xa126('0x11'));var Redis=require(_0xa126('0x12'));var authService=require(_0xa126('0x13'));var qs=require(_0xa126('0x14'));var as=require(_0xa126('0x15'));var hardwareService=require(_0xa126('0x16'));var logger=require('../../config/logger')(_0xa126('0x17'));var utils=require(_0xa126('0x18'));var config=require(_0xa126('0x19'));var db=require(_0xa126('0x1a'))['db'];function respondWithStatusCode(_0x37f822,_0x3dadf6){_0x3dadf6=_0x3dadf6||0xcc;return function(_0x503bcd){if(_0x503bcd){return _0x37f822['sendStatus'](_0x3dadf6);}return _0x37f822[_0xa126('0x1b')](_0x3dadf6)[_0xa126('0x1c')]();};}function respondWithResult(_0x29d1ca,_0x6f3c31){_0x6f3c31=_0x6f3c31||0xc8;return function(_0x4a637b){if(_0x4a637b){return _0x29d1ca[_0xa126('0x1b')](_0x6f3c31)[_0xa126('0x1d')](_0x4a637b);}};}function respondWithFilteredResult(_0x4c7995,_0x478ce7){return function(_0x2fc537){if(_0x2fc537){var _0x559a8f=_0x2fc537['count'],_0xaf46ff=_0x478ce7['offset'],_0x5c14c5=_0x478ce7[_0xa126('0x1e')]+_0x478ce7[_0xa126('0x1f')],_0x7b85e6;if(_0x5c14c5>=_0x559a8f){_0x5c14c5=_0x559a8f;_0x7b85e6=0xc8;}else{_0x7b85e6=0xce;}_0x4c7995[_0xa126('0x1b')](_0x7b85e6);return _0x4c7995['set'](_0xa126('0x20'),_0xaf46ff+'-'+_0x5c14c5+'/'+_0x559a8f)[_0xa126('0x1d')](_0x2fc537);}return null;};}function patchUpdates(_0xcd6422){return function(_0x1958c6){try{jsonpatch[_0xa126('0x21')](_0x1958c6,_0xcd6422,!![]);}catch(_0x2877cc){return BPromise[_0xa126('0x22')](_0x2877cc);}return _0x1958c6[_0xa126('0x23')]();};}function saveUpdates(_0x3698b5,_0x4f31a9){return function(_0xc5ca55){if(_0xc5ca55){return _0xc5ca55['update'](_0x3698b5)[_0xa126('0x24')](function(_0x51be7a){return _0x51be7a;});}return null;};}function removeEntity(_0x24e1e5,_0x2dbe72){return function(_0x399ad9){if(_0x399ad9){return _0x399ad9[_0xa126('0x25')]()['then'](function(){_0x24e1e5[_0xa126('0x1b')](0xcc)[_0xa126('0x1c')]();});}};}function handleEntityNotFound(_0x11b3d3,_0x3ef2f9){return function(_0x41d897){if(!_0x41d897){_0x11b3d3['sendStatus'](0x194);}return _0x41d897;};}function handleError(_0x1aaf5a,_0x2be475){_0x2be475=_0x2be475||0x1f4;return function(_0x5c0a26){logger[_0xa126('0x26')](_0x5c0a26[_0xa126('0x27')]);if(_0x5c0a26[_0xa126('0x28')]){delete _0x5c0a26[_0xa126('0x28')];}_0x1aaf5a[_0xa126('0x1b')](_0x2be475)[_0xa126('0x29')](_0x5c0a26);};}exports[_0xa126('0x2a')]=function(_0x302ba4,_0x4d27af){var _0xa6bef7={},_0x16f8ec={},_0x422296={'count':0x0,'rows':[]};var _0x129757=_[_0xa126('0x2b')](db[_0xa126('0x2c')][_0xa126('0x2d')],function(_0x311c1b){return{'name':_0x311c1b['fieldName'],'type':_0x311c1b['type']['key']};});_0x16f8ec[_0xa126('0x2e')]=_[_0xa126('0x2b')](_0x129757,_0xa126('0x28'));_0x16f8ec[_0xa126('0x2f')]=_[_0xa126('0x30')](_0x302ba4['query']);_0x16f8ec[_0xa126('0x31')]=_[_0xa126('0x32')](_0x16f8ec[_0xa126('0x2e')],_0x16f8ec['query']);_0xa6bef7[_0xa126('0x33')]=_[_0xa126('0x32')](_0x16f8ec[_0xa126('0x2e')],qs[_0xa126('0x34')](_0x302ba4[_0xa126('0x2f')][_0xa126('0x34')]));_0xa6bef7[_0xa126('0x33')]=_0xa6bef7['attributes'][_0xa126('0x35')]?_0xa6bef7['attributes']:_0x16f8ec[_0xa126('0x2e')];if(!_0x302ba4[_0xa126('0x2f')][_0xa126('0x36')](_0xa126('0x37'))){_0xa6bef7['limit']=qs[_0xa126('0x1f')](_0x302ba4[_0xa126('0x2f')]['limit']);_0xa6bef7[_0xa126('0x1e')]=qs[_0xa126('0x1e')](_0x302ba4['query']['offset']);}_0xa6bef7[_0xa126('0x38')]=qs['sort'](_0x302ba4[_0xa126('0x2f')][_0xa126('0x39')]);_0xa6bef7[_0xa126('0x3a')]=qs['filters'](_[_0xa126('0x3b')](_0x302ba4[_0xa126('0x2f')],_0x16f8ec[_0xa126('0x31')]));if(_0x302ba4[_0xa126('0x2f')][_0xa126('0x3c')]){_0xa6bef7['where']=_[_0xa126('0x3d')](_0xa6bef7['where'],{'$or':_[_0xa126('0x2b')](_0x129757,function(_0x1d0b38){if(_0x1d0b38[_0xa126('0x3e')]!==_0xa126('0x3f')){var _0x5c77d1={};_0x5c77d1[_0x1d0b38[_0xa126('0x28')]]={'$like':'%'+_0x302ba4['query'][_0xa126('0x3c')]+'%'};return _0x5c77d1;}})});}_0xa6bef7=_[_0xa126('0x3d')]({},_0xa6bef7,_0x302ba4[_0xa126('0x40')]);var _0x5f31c1={'where':_0xa6bef7[_0xa126('0x3a')]};return db['SugarcrmField'][_0xa126('0x41')](_0x5f31c1)[_0xa126('0x24')](function(_0x37840e){_0x422296[_0xa126('0x41')]=_0x37840e;if(_0x302ba4[_0xa126('0x2f')][_0xa126('0x42')]){_0xa6bef7[_0xa126('0x43')]=[{'all':!![]}];}return db[_0xa126('0x2c')][_0xa126('0x44')](_0xa6bef7);})[_0xa126('0x24')](function(_0x38f05f){_0x422296[_0xa126('0x45')]=_0x38f05f;return _0x422296;})['then'](respondWithFilteredResult(_0x4d27af,_0xa6bef7))['catch'](handleError(_0x4d27af,null));};exports['show']=function(_0x172ccc,_0x2b5875){var _0x3888fa={'raw':!![],'where':{'id':_0x172ccc[_0xa126('0x46')]['id']}},_0x38007b={};_0x38007b[_0xa126('0x2e')]=_[_0xa126('0x30')](db[_0xa126('0x2c')][_0xa126('0x2d')]);_0x38007b[_0xa126('0x2f')]=_['keys'](_0x172ccc[_0xa126('0x2f')]);_0x38007b[_0xa126('0x31')]=_['intersection'](_0x38007b[_0xa126('0x2e')],_0x38007b[_0xa126('0x2f')]);_0x3888fa[_0xa126('0x33')]=_[_0xa126('0x32')](_0x38007b[_0xa126('0x2e')],qs[_0xa126('0x34')](_0x172ccc[_0xa126('0x2f')][_0xa126('0x34')]));_0x3888fa[_0xa126('0x33')]=_0x3888fa['attributes'][_0xa126('0x35')]?_0x3888fa['attributes']:_0x38007b[_0xa126('0x2e')];if(_0x172ccc['query'][_0xa126('0x42')]){_0x3888fa['include']=[{'all':!![]}];}_0x3888fa=_[_0xa126('0x3d')]({},_0x3888fa,_0x172ccc[_0xa126('0x40')]);return db[_0xa126('0x2c')][_0xa126('0x47')](_0x3888fa)[_0xa126('0x24')](handleEntityNotFound(_0x2b5875,null))[_0xa126('0x24')](respondWithResult(_0x2b5875,null))[_0xa126('0x48')](handleError(_0x2b5875,null));};exports[_0xa126('0x49')]=function(_0x2536df,_0x46cd19){return db[_0xa126('0x2c')]['create'](_0x2536df[_0xa126('0x4a')],{})[_0xa126('0x24')](respondWithResult(_0x46cd19,0xc9))[_0xa126('0x48')](handleError(_0x46cd19,null));};exports[_0xa126('0x4b')]=function(_0x4a8551,_0x158eef){if(_0x4a8551['body']['id']){delete _0x4a8551[_0xa126('0x4a')]['id'];}return db[_0xa126('0x2c')][_0xa126('0x47')]({'where':{'id':_0x4a8551[_0xa126('0x46')]['id']}})[_0xa126('0x24')](handleEntityNotFound(_0x158eef,null))['then'](saveUpdates(_0x4a8551[_0xa126('0x4a')],null))[_0xa126('0x24')](respondWithResult(_0x158eef,null))[_0xa126('0x48')](handleError(_0x158eef,null));};exports[_0xa126('0x25')]=function(_0x15d858,_0x146e82){return db['SugarcrmField'][_0xa126('0x47')]({'where':{'id':_0x15d858['params']['id']}})['then'](handleEntityNotFound(_0x146e82,null))[_0xa126('0x24')](removeEntity(_0x146e82,null))['catch'](handleError(_0x146e82,null));}; \ No newline at end of file +var _0xb020=['show','includeAll','find','create','body','params','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','reject','save','update','then','end','stack','name','send','index','map','SugarcrmField','rawAttributes','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','rows','catch'];(function(_0xe2c95e,_0x3e6545){var _0x42ce6f=function(_0x218482){while(--_0x218482){_0xe2c95e['push'](_0xe2c95e['shift']());}};_0x42ce6f(++_0x3e6545);}(_0xb020,0x174));var _0x0b02=function(_0x21c2c8,_0x44257e){_0x21c2c8=_0x21c2c8-0x0;var _0x4dd745=_0xb020[_0x21c2c8];return _0x4dd745;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0b02('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0b02('0x1'));var jsonpatch=require(_0x0b02('0x2'));var rp=require('request-promise');var moment=require(_0x0b02('0x3'));var BPromise=require(_0x0b02('0x4'));var Mustache=require(_0x0b02('0x5'));var util=require(_0x0b02('0x6'));var path=require(_0x0b02('0x7'));var sox=require(_0x0b02('0x8'));var csv=require(_0x0b02('0x9'));var ejs=require(_0x0b02('0xa'));var fs=require('fs');var _=require(_0x0b02('0xb'));var squel=require(_0x0b02('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0b02('0xd'));var toCsv=require(_0x0b02('0x9'));var querystring=require(_0x0b02('0xe'));var Papa=require(_0x0b02('0xf'));var Redis=require(_0x0b02('0x10'));var authService=require(_0x0b02('0x11'));var qs=require(_0x0b02('0x12'));var as=require(_0x0b02('0x13'));var hardwareService=require(_0x0b02('0x14'));var logger=require(_0x0b02('0x15'))(_0x0b02('0x16'));var utils=require(_0x0b02('0x17'));var config=require(_0x0b02('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46002c,_0x159697){_0x159697=_0x159697||0xcc;return function(_0x3a0be9){if(_0x3a0be9){return _0x46002c[_0x0b02('0x19')](_0x159697);}return _0x46002c[_0x0b02('0x1a')](_0x159697)['end']();};}function respondWithResult(_0xade332,_0x1068a5){_0x1068a5=_0x1068a5||0xc8;return function(_0x537448){if(_0x537448){return _0xade332[_0x0b02('0x1a')](_0x1068a5)[_0x0b02('0x1b')](_0x537448);}};}function respondWithFilteredResult(_0x37454b,_0x2a0bbf){return function(_0x3958b1){if(_0x3958b1){var _0x910d4d=_0x3958b1[_0x0b02('0x1c')],_0xa34fb6=_0x2a0bbf[_0x0b02('0x1d')],_0x38bbf5=_0x2a0bbf[_0x0b02('0x1d')]+_0x2a0bbf[_0x0b02('0x1e')],_0x3e5c8a;if(_0x38bbf5>=_0x910d4d){_0x38bbf5=_0x910d4d;_0x3e5c8a=0xc8;}else{_0x3e5c8a=0xce;}_0x37454b['status'](_0x3e5c8a);return _0x37454b[_0x0b02('0x1f')]('Content-Range',_0xa34fb6+'-'+_0x38bbf5+'/'+_0x910d4d)[_0x0b02('0x1b')](_0x3958b1);}return null;};}function patchUpdates(_0x3ef3bf){return function(_0x1b8324){try{jsonpatch['apply'](_0x1b8324,_0x3ef3bf,!![]);}catch(_0x3bf1d0){return BPromise[_0x0b02('0x20')](_0x3bf1d0);}return _0x1b8324[_0x0b02('0x21')]();};}function saveUpdates(_0xb4781f,_0x124933){return function(_0xe0e785){if(_0xe0e785){return _0xe0e785[_0x0b02('0x22')](_0xb4781f)[_0x0b02('0x23')](function(_0x20af2b){return _0x20af2b;});}return null;};}function removeEntity(_0x266e82,_0xc58071){return function(_0x39e445){if(_0x39e445){return _0x39e445['destroy']()['then'](function(){_0x266e82[_0x0b02('0x1a')](0xcc)[_0x0b02('0x24')]();});}};}function handleEntityNotFound(_0x54c3e4,_0x23dcf4){return function(_0x5405f9){if(!_0x5405f9){_0x54c3e4[_0x0b02('0x19')](0x194);}return _0x5405f9;};}function handleError(_0xb5e73b,_0x4f3f32){_0x4f3f32=_0x4f3f32||0x1f4;return function(_0xce7f39){logger['error'](_0xce7f39[_0x0b02('0x25')]);if(_0xce7f39['name']){delete _0xce7f39[_0x0b02('0x26')];}_0xb5e73b['status'](_0x4f3f32)[_0x0b02('0x27')](_0xce7f39);};}exports[_0x0b02('0x28')]=function(_0x80443,_0x1fb7e7){var _0x19ef24={},_0x390370={},_0x12f817={'count':0x0,'rows':[]};var _0x358513=_[_0x0b02('0x29')](db[_0x0b02('0x2a')][_0x0b02('0x2b')],function(_0xfa1e19){return{'name':_0xfa1e19['fieldName'],'type':_0xfa1e19[_0x0b02('0x2c')]['key']};});_0x390370[_0x0b02('0x2d')]=_['map'](_0x358513,_0x0b02('0x26'));_0x390370[_0x0b02('0x2e')]=_[_0x0b02('0x2f')](_0x80443[_0x0b02('0x2e')]);_0x390370['filters']=_['intersection'](_0x390370[_0x0b02('0x2d')],_0x390370[_0x0b02('0x2e')]);_0x19ef24[_0x0b02('0x30')]=_[_0x0b02('0x31')](_0x390370[_0x0b02('0x2d')],qs[_0x0b02('0x32')](_0x80443[_0x0b02('0x2e')][_0x0b02('0x32')]));_0x19ef24[_0x0b02('0x30')]=_0x19ef24['attributes'][_0x0b02('0x33')]?_0x19ef24['attributes']:_0x390370[_0x0b02('0x2d')];if(!_0x80443['query'][_0x0b02('0x34')](_0x0b02('0x35'))){_0x19ef24[_0x0b02('0x1e')]=qs[_0x0b02('0x1e')](_0x80443[_0x0b02('0x2e')][_0x0b02('0x1e')]);_0x19ef24['offset']=qs[_0x0b02('0x1d')](_0x80443[_0x0b02('0x2e')][_0x0b02('0x1d')]);}_0x19ef24[_0x0b02('0x36')]=qs[_0x0b02('0x37')](_0x80443[_0x0b02('0x2e')][_0x0b02('0x37')]);_0x19ef24[_0x0b02('0x38')]=qs[_0x0b02('0x39')](_[_0x0b02('0x3a')](_0x80443[_0x0b02('0x2e')],_0x390370[_0x0b02('0x39')]));if(_0x80443[_0x0b02('0x2e')]['filter']){_0x19ef24[_0x0b02('0x38')]=_[_0x0b02('0x3b')](_0x19ef24[_0x0b02('0x38')],{'$or':_[_0x0b02('0x29')](_0x358513,function(_0x5970b3){if(_0x5970b3[_0x0b02('0x2c')]!==_0x0b02('0x3c')){var _0x3a2558={};_0x3a2558[_0x5970b3['name']]={'$like':'%'+_0x80443['query'][_0x0b02('0x3d')]+'%'};return _0x3a2558;}})});}_0x19ef24=_['merge']({},_0x19ef24,_0x80443[_0x0b02('0x3e')]);var _0x328daf={'where':_0x19ef24[_0x0b02('0x38')]};return db[_0x0b02('0x2a')][_0x0b02('0x1c')](_0x328daf)[_0x0b02('0x23')](function(_0x295e09){_0x12f817[_0x0b02('0x1c')]=_0x295e09;if(_0x80443['query']['includeAll']){_0x19ef24[_0x0b02('0x3f')]=[{'all':!![]}];}return db[_0x0b02('0x2a')]['findAll'](_0x19ef24);})[_0x0b02('0x23')](function(_0x1a3b19){_0x12f817[_0x0b02('0x40')]=_0x1a3b19;return _0x12f817;})[_0x0b02('0x23')](respondWithFilteredResult(_0x1fb7e7,_0x19ef24))[_0x0b02('0x41')](handleError(_0x1fb7e7,null));};exports[_0x0b02('0x42')]=function(_0x4e12fc,_0x191159){var _0x42c867={'raw':!![],'where':{'id':_0x4e12fc['params']['id']}},_0x1031b4={};_0x1031b4[_0x0b02('0x2d')]=_[_0x0b02('0x2f')](db[_0x0b02('0x2a')][_0x0b02('0x2b')]);_0x1031b4[_0x0b02('0x2e')]=_[_0x0b02('0x2f')](_0x4e12fc['query']);_0x1031b4[_0x0b02('0x39')]=_[_0x0b02('0x31')](_0x1031b4[_0x0b02('0x2d')],_0x1031b4['query']);_0x42c867[_0x0b02('0x30')]=_[_0x0b02('0x31')](_0x1031b4[_0x0b02('0x2d')],qs[_0x0b02('0x32')](_0x4e12fc[_0x0b02('0x2e')][_0x0b02('0x32')]));_0x42c867[_0x0b02('0x30')]=_0x42c867[_0x0b02('0x30')]['length']?_0x42c867[_0x0b02('0x30')]:_0x1031b4[_0x0b02('0x2d')];if(_0x4e12fc[_0x0b02('0x2e')][_0x0b02('0x43')]){_0x42c867['include']=[{'all':!![]}];}_0x42c867=_['merge']({},_0x42c867,_0x4e12fc['options']);return db[_0x0b02('0x2a')][_0x0b02('0x44')](_0x42c867)[_0x0b02('0x23')](handleEntityNotFound(_0x191159,null))['then'](respondWithResult(_0x191159,null))[_0x0b02('0x41')](handleError(_0x191159,null));};exports[_0x0b02('0x45')]=function(_0x17ce36,_0xfbbb71){return db[_0x0b02('0x2a')][_0x0b02('0x45')](_0x17ce36['body'],{})['then'](respondWithResult(_0xfbbb71,0xc9))[_0x0b02('0x41')](handleError(_0xfbbb71,null));};exports[_0x0b02('0x22')]=function(_0x3110f1,_0x24d6ab){if(_0x3110f1[_0x0b02('0x46')]['id']){delete _0x3110f1[_0x0b02('0x46')]['id'];}return db[_0x0b02('0x2a')][_0x0b02('0x44')]({'where':{'id':_0x3110f1[_0x0b02('0x47')]['id']}})[_0x0b02('0x23')](handleEntityNotFound(_0x24d6ab,null))['then'](saveUpdates(_0x3110f1[_0x0b02('0x46')],null))[_0x0b02('0x23')](respondWithResult(_0x24d6ab,null))[_0x0b02('0x41')](handleError(_0x24d6ab,null));};exports[_0x0b02('0x48')]=function(_0x50b196,_0xf565d3){return db[_0x0b02('0x2a')][_0x0b02('0x44')]({'where':{'id':_0x50b196[_0x0b02('0x47')]['id']}})[_0x0b02('0x23')](handleEntityNotFound(_0xf565d3,null))['then'](removeEntity(_0xf565d3,null))[_0x0b02('0x41')](handleError(_0xf565d3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 995e658..f6a9176 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 _0x3d2d=['rimraf','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','idField','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1b5a5a,_0x1c3b75){var _0x42b32d=function(_0x3d35ab){while(--_0x3d35ab){_0x1b5a5a['push'](_0x1b5a5a['shift']());}};_0x42b32d(++_0x1c3b75);}(_0x3d2d,0x133));var _0xd3d2=function(_0x13cab0,_0x14d825){_0x13cab0=_0x13cab0-0x0;var _0x38804f=_0x3d2d[_0x13cab0];return _0x38804f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd3d2('0x0'))(_0xd3d2('0x1'));var moment=require(_0xd3d2('0x2'));var BPromise=require(_0xd3d2('0x3'));var rp=require(_0xd3d2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd3d2('0x5'));var config=require(_0xd3d2('0x6'));var attributes=require('./intSugarcrmField.attributes');module[_0xd3d2('0x7')]=function(_0x5ee230,_0x151aa3){return _0x5ee230[_0xd3d2('0x8')](_0xd3d2('0x9'),attributes,{'tableName':_0xd3d2('0xa'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xd3d2('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e3c=['idField','FieldId','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x327303,_0x1bc398){var _0x24ba7a=function(_0x2046b1){while(--_0x2046b1){_0x327303['push'](_0x327303['shift']());}};_0x24ba7a(++_0x1bc398);}(_0x1e3c,0xe3));var _0xc1e3=function(_0x246e95,_0x33aca9){_0x246e95=_0x246e95-0x0;var _0x466bd7=_0x1e3c[_0x246e95];return _0x466bd7;};'use strict';var _=require('lodash');var util=require(_0xc1e3('0x0'));var logger=require(_0xc1e3('0x1'))(_0xc1e3('0x2'));var moment=require(_0xc1e3('0x3'));var BPromise=require(_0xc1e3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc1e3('0x5'));var config=require(_0xc1e3('0x6'));var attributes=require(_0xc1e3('0x7'));module[_0xc1e3('0x8')]=function(_0x244020,_0x26ac3a){return _0x244020[_0xc1e3('0x9')](_0xc1e3('0xa'),attributes,{'tableName':_0xc1e3('0xb'),'paranoid':![],'indexes':[{'name':_0xc1e3('0xc'),'fields':[_0xc1e3('0xd'),_0xc1e3('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index c9457c1..fb0cf8e 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 _0x2032=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x2e889b,_0x2b0e30){var _0x1b4673=function(_0x224637){while(--_0x224637){_0x2e889b['push'](_0x2e889b['shift']());}};_0x1b4673(++_0x2b0e30);}(_0x2032,0xd9));var _0x2203=function(_0x53b20b,_0x51453d){_0x53b20b=_0x53b20b-0x0;var _0x2c6d49=_0x2032[_0x53b20b];return _0x2c6d49;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});} \ No newline at end of file +var _0x2032=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x4a3617,_0x17b3c8){var _0x46579b=function(_0x251de8){while(--_0x251de8){_0x4a3617['push'](_0x4a3617['shift']());}};_0x46579b(++_0x17b3c8);}(_0x2032,0xd9));var _0x2203=function(_0x33adc2,_0x42dc48){_0x33adc2=_0x33adc2-0x0;var _0x14949c=_0x2032[_0x33adc2];return _0x14949c;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index a7a3f7d..e2c19a6 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 _0x6275=['create','addConfiguration','put','update','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6275,0x1e8));var _0x5627=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6275[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x5627('0x0'));var util=require('util');var path=require(_0x5627('0x1'));var timeout=require('connect-timeout');var express=require(_0x5627('0x2'));var router=express[_0x5627('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5627('0x4'));var config=require(_0x5627('0x5'));var controller=require('./intVtigerAccount.controller');router[_0x5627('0x6')]('/',auth[_0x5627('0x7')](),controller[_0x5627('0x8')]);router['get'](_0x5627('0x9'),auth[_0x5627('0x7')](),controller[_0x5627('0xa')]);router[_0x5627('0x6')](_0x5627('0xb'),auth['isAuthenticated'](),controller[_0x5627('0xc')]);router[_0x5627('0x6')](_0x5627('0xd'),auth[_0x5627('0x7')](),controller[_0x5627('0xe')]);router[_0x5627('0xf')]('/',auth[_0x5627('0x7')](),controller[_0x5627('0x10')]);router[_0x5627('0xf')](_0x5627('0xb'),auth[_0x5627('0x7')](),controller[_0x5627('0x11')]);router[_0x5627('0x12')](_0x5627('0x9'),auth[_0x5627('0x7')](),controller[_0x5627('0x13')]);router['delete']('/:id',auth[_0x5627('0x7')](),controller['destroy']);module[_0x5627('0x14')]=router; \ No newline at end of file +var _0x9cee=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','/:id','update','delete','exports','multer'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x9cee,0x1c7));var _0xe9ce=function(_0x338411,_0x17c0a1){_0x338411=_0x338411-0x0;var _0x553fba=_0x9cee[_0x338411];return _0x553fba;};'use strict';var multer=require(_0xe9ce('0x0'));var util=require(_0xe9ce('0x1'));var path=require(_0xe9ce('0x2'));var timeout=require(_0xe9ce('0x3'));var express=require(_0xe9ce('0x4'));var router=express[_0xe9ce('0x5')]();var auth=require(_0xe9ce('0x6'));var interaction=require(_0xe9ce('0x7'));var config=require(_0xe9ce('0x8'));var controller=require(_0xe9ce('0x9'));router[_0xe9ce('0xa')]('/',auth[_0xe9ce('0xb')](),controller[_0xe9ce('0xc')]);router[_0xe9ce('0xa')]('/:id',auth[_0xe9ce('0xb')](),controller[_0xe9ce('0xd')]);router['get'](_0xe9ce('0xe'),auth[_0xe9ce('0xb')](),controller[_0xe9ce('0xf')]);router['get'](_0xe9ce('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0xe9ce('0x11')]('/',auth[_0xe9ce('0xb')](),controller[_0xe9ce('0x12')]);router['post'](_0xe9ce('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xe9ce('0x13')](_0xe9ce('0x14'),auth[_0xe9ce('0xb')](),controller[_0xe9ce('0x15')]);router[_0xe9ce('0x16')](_0xe9ce('0x14'),auth[_0xe9ce('0xb')](),controller['destroy']);module[_0xe9ce('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index bdb284c..1d69241 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 _0x3d25=['exports','STRING','HelpDesk'];(function(_0x4e9f1d,_0x5a4ea0){var _0x586318=function(_0x22aeef){while(--_0x22aeef){_0x4e9f1d['push'](_0x4e9f1d['shift']());}};_0x586318(++_0x5a4ea0);}(_0x3d25,0x174));var _0x53d2=function(_0x46ec32,_0x1e842f){_0x46ec32=_0x46ec32-0x0;var _0x338f60=_0x3d25[_0x46ec32];return _0x338f60;};'use strict';var Sequelize=require('sequelize');module[_0x53d2('0x0')]={'name':{'type':Sequelize[_0x53d2('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x53d2('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x53d2('0x1')],'allowNull':![],'defaultValue':_0x53d2('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING']},'accessKey':{'type':Sequelize[_0x53d2('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xb4f4=['HelpDesk','sequelize','STRING'];(function(_0x247ffa,_0x3282ff){var _0x24a5ab=function(_0x3f80ce){while(--_0x3f80ce){_0x247ffa['push'](_0x247ffa['shift']());}};_0x24a5ab(++_0x3282ff);}(_0xb4f4,0x70));var _0x4b4f=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xb4f4[_0xfa634c];return _0x73e478;};'use strict';var Sequelize=require(_0x4b4f('0x0'));module['exports']={'name':{'type':Sequelize[_0x4b4f('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4b4f('0x1')]},'username':{'type':Sequelize[_0x4b4f('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4b4f('0x1')],'allowNull':![],'defaultValue':_0x4b4f('0x2')},'remoteUri':{'type':Sequelize[_0x4b4f('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4b4f('0x1')]},'accessKey':{'type':Sequelize[_0x4b4f('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index bfa1767..2968e62 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 _0x757b=['crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../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','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','options','VtigerAccount','include','findAll','rows','show','params','create','body','find','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerConfiguration','md5','getFields','description','moduleName','serverUrl','accessKey','username','remoteUri','slice','lastIndexOf','format','%s/webservice.php','success','POST','login','sessionName','autogenerated','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel'];(function(_0x5d3e09,_0x4c0f77){var _0x372626=function(_0x4d6d93){while(--_0x4d6d93){_0x5d3e09['push'](_0x5d3e09['shift']());}};_0x372626(++_0x4c0f77);}(_0x757b,0x7a));var _0xb757=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x757b[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xb757('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb757('0x1'));var zipdir=require(_0xb757('0x2'));var jsonpatch=require(_0xb757('0x3'));var rp=require('request-promise');var moment=require(_0xb757('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb757('0x5'));var util=require('util');var path=require(_0xb757('0x6'));var sox=require(_0xb757('0x7'));var csv=require(_0xb757('0x8'));var ejs=require(_0xb757('0x9'));var fs=require('fs');var _=require(_0xb757('0xa'));var squel=require(_0xb757('0xb'));var crypto=require(_0xb757('0xc'));var jsforce=require(_0xb757('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb757('0x8'));var querystring=require(_0xb757('0xe'));var Papa=require(_0xb757('0xf'));var Redis=require(_0xb757('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb757('0x11'));var as=require(_0xb757('0x12'));var hardwareService=require(_0xb757('0x13'));var logger=require(_0xb757('0x14'))('api');var utils=require(_0xb757('0x15'));var config=require('../../config/environment');var db=require(_0xb757('0x16'))['db'];var integrations=require(_0xb757('0x17'));var jayson=require(_0xb757('0x18'));var client=jayson[_0xb757('0x19')][_0xb757('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x19173d,_0x4227b6,_0x1d1d1b){if(_0x1d1d1b){var _0x31b33d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x31b33d[_0xb757('0x1b')](_0x4227b6)){return _0x19173d;}else{throw new db[(_0xb757('0x1c'))][(_0xb757('0x1d'))](_0xb757('0x1e'));}}else{return _0x19173d;}}function respondWithRpcPromise(_0x53efa1,_0x540169,_0x42a904,_0x5ca871){return new BPromise(function(_0x137ae3,_0x8f3786){var _0xa08286=_0x5ca871||client;return _0xa08286[_0xb757('0x1f')](_0x53efa1,_0x42a904)[_0xb757('0x20')](function(_0x3560d6){logger[_0xb757('0x21')](_0xb757('0x22'),_0x540169,_0xb757('0x23'));logger[_0xb757('0x24')](_0xb757('0x25'),_0x540169,'request\x20sent',JSON[_0xb757('0x26')](_0x3560d6));if(_0x3560d6['error']){if(_0x3560d6[_0xb757('0x27')][_0xb757('0x28')]===0x1f4){logger[_0xb757('0x27')](_0xb757('0x22'),_0x540169,_0x3560d6[_0xb757('0x27')][_0xb757('0x29')]);return _0x8f3786(_0x3560d6[_0xb757('0x27')][_0xb757('0x29')]);}logger[_0xb757('0x27')](_0xb757('0x22'),_0x540169,_0x3560d6[_0xb757('0x27')][_0xb757('0x29')]);return _0x137ae3(_0x3560d6['error'][_0xb757('0x29')]);}else{logger[_0xb757('0x21')](_0xb757('0x22'),_0x540169,_0xb757('0x23'));_0x137ae3(_0x3560d6[_0xb757('0x2a')][_0xb757('0x29')]);}})[_0xb757('0x2b')](function(_0x2b5bd0){logger[_0xb757('0x27')](_0xb757('0x22'),_0x540169,_0x2b5bd0);_0x8f3786(_0x2b5bd0);});});}function respondWithStatusCode(_0x1156e7,_0x5c4a0a){_0x5c4a0a=_0x5c4a0a||0xcc;return function(_0x3f9e6e){if(_0x3f9e6e){return _0x1156e7[_0xb757('0x2c')](_0x5c4a0a);}return _0x1156e7['status'](_0x5c4a0a)[_0xb757('0x2d')]();};}function respondWithResult(_0x4bd208,_0xcade70){_0xcade70=_0xcade70||0xc8;return function(_0x31e60c){if(_0x31e60c){return _0x4bd208[_0xb757('0x2e')](_0xcade70)[_0xb757('0x2f')](_0x31e60c);}};}function respondWithFilteredResult(_0x225b9d,_0x5353f3){return function(_0x345659){if(_0x345659){var _0x4937e6=_0x345659[_0xb757('0x30')],_0x322db0=_0x5353f3[_0xb757('0x31')],_0x14b556=_0x5353f3['offset']+_0x5353f3[_0xb757('0x32')],_0x4f8149;if(_0x14b556>=_0x4937e6){_0x14b556=_0x4937e6;_0x4f8149=0xc8;}else{_0x4f8149=0xce;}_0x225b9d[_0xb757('0x2e')](_0x4f8149);return _0x225b9d[_0xb757('0x33')](_0xb757('0x34'),_0x322db0+'-'+_0x14b556+'/'+_0x4937e6)[_0xb757('0x2f')](_0x345659);}return null;};}function patchUpdates(_0x36ef9e){return function(_0x226d28){try{jsonpatch[_0xb757('0x35')](_0x226d28,_0x36ef9e,!![]);}catch(_0x2d88d6){return BPromise[_0xb757('0x36')](_0x2d88d6);}return _0x226d28['save']();};}function saveUpdates(_0x34c28f,_0x557f0c){return function(_0x2a12b4){if(_0x2a12b4){return _0x2a12b4[_0xb757('0x37')](_0x34c28f)[_0xb757('0x20')](function(_0x28fe0c){return _0x28fe0c;});}return null;};}function removeEntity(_0x5105ed,_0xead47b){return function(_0x5bdc12){if(_0x5bdc12){return _0x5bdc12[_0xb757('0x38')]()['then'](function(){_0x5105ed[_0xb757('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x144fca,_0x57d955){return function(_0x267e25){if(!_0x267e25){_0x144fca['sendStatus'](0x194);}return _0x267e25;};}function handleError(_0x5ebc94,_0x4edb26){_0x4edb26=_0x4edb26||0x1f4;return function(_0x374e6f){logger[_0xb757('0x27')](_0x374e6f[_0xb757('0x39')]);if(_0x374e6f[_0xb757('0x3a')]){delete _0x374e6f[_0xb757('0x3a')];}_0x5ebc94[_0xb757('0x2e')](_0x4edb26)[_0xb757('0x3b')](_0x374e6f);};}exports[_0xb757('0x3c')]=function(_0x350d36,_0x200ab7){var _0x5d00bb={},_0x42744b={},_0x901732={'count':0x0,'rows':[]};var _0x5684c0=_['map'](db['VtigerAccount'][_0xb757('0x3d')],function(_0x2d322e){return{'name':_0x2d322e[_0xb757('0x3e')],'type':_0x2d322e[_0xb757('0x3f')][_0xb757('0x40')]};});_0x42744b[_0xb757('0x41')]=_[_0xb757('0x42')](_0x5684c0,'name');_0x42744b[_0xb757('0x43')]=_[_0xb757('0x44')](_0x350d36['query']);_0x42744b['filters']=_[_0xb757('0x45')](_0x42744b[_0xb757('0x41')],_0x42744b[_0xb757('0x43')]);_0x5d00bb[_0xb757('0x46')]=_['intersection'](_0x42744b[_0xb757('0x41')],qs[_0xb757('0x47')](_0x350d36['query'][_0xb757('0x47')]));_0x5d00bb['attributes']=_0x5d00bb[_0xb757('0x46')][_0xb757('0x48')]?_0x5d00bb['attributes']:_0x42744b[_0xb757('0x41')];if(!_0x350d36[_0xb757('0x43')][_0xb757('0x49')]('nolimit')){_0x5d00bb[_0xb757('0x32')]=qs[_0xb757('0x32')](_0x350d36[_0xb757('0x43')][_0xb757('0x32')]);_0x5d00bb[_0xb757('0x31')]=qs[_0xb757('0x31')](_0x350d36[_0xb757('0x43')][_0xb757('0x31')]);}_0x5d00bb['order']=qs[_0xb757('0x4a')](_0x350d36[_0xb757('0x43')][_0xb757('0x4a')]);_0x5d00bb[_0xb757('0x4b')]=qs[_0xb757('0x4c')](_[_0xb757('0x4d')](_0x350d36[_0xb757('0x43')],_0x42744b['filters']));if(_0x350d36[_0xb757('0x43')]['filter']){_0x5d00bb[_0xb757('0x4b')]=_[_0xb757('0x4e')](_0x5d00bb[_0xb757('0x4b')],{'$or':_['map'](_0x5684c0,function(_0x5e8e6f){if(_0x5e8e6f['type']!==_0xb757('0x4f')){var _0x402088={};_0x402088[_0x5e8e6f['name']]={'$like':'%'+_0x350d36[_0xb757('0x43')][_0xb757('0x50')]+'%'};return _0x402088;}})});}_0x5d00bb=_[_0xb757('0x4e')]({},_0x5d00bb,_0x350d36[_0xb757('0x51')]);var _0x5de653={'where':_0x5d00bb['where']};return db[_0xb757('0x52')]['count'](_0x5de653)[_0xb757('0x20')](function(_0x19c435){_0x901732[_0xb757('0x30')]=_0x19c435;if(_0x350d36['query']['includeAll']){_0x5d00bb[_0xb757('0x53')]=[{'all':!![]}];}return db[_0xb757('0x52')][_0xb757('0x54')](_0x5d00bb);})[_0xb757('0x20')](function(_0x1aa586){_0x901732[_0xb757('0x55')]=_0x1aa586;return _0x901732;})[_0xb757('0x20')](respondWithFilteredResult(_0x200ab7,_0x5d00bb))[_0xb757('0x2b')](handleError(_0x200ab7,null));};exports[_0xb757('0x56')]=function(_0x176f4d,_0x5163b7){var _0x5580ed={'raw':![],'where':{'id':_0x176f4d[_0xb757('0x57')]['id']}},_0x8c79d3={};_0x8c79d3[_0xb757('0x41')]=_[_0xb757('0x44')](db['VtigerAccount'][_0xb757('0x3d')]);_0x8c79d3['query']=_[_0xb757('0x44')](_0x176f4d[_0xb757('0x43')]);_0x8c79d3[_0xb757('0x4c')]=_[_0xb757('0x45')](_0x8c79d3['model'],_0x8c79d3[_0xb757('0x43')]);_0x5580ed['attributes']=_[_0xb757('0x45')](_0x8c79d3[_0xb757('0x41')],qs['fields'](_0x176f4d['query'][_0xb757('0x47')]));_0x5580ed['attributes']=_0x5580ed[_0xb757('0x46')]['length']?_0x5580ed[_0xb757('0x46')]:_0x8c79d3['model'];if(_0x176f4d[_0xb757('0x43')]['includeAll']){_0x5580ed[_0xb757('0x53')]=[{'all':!![]}];}_0x5580ed=_[_0xb757('0x4e')]({},_0x5580ed,_0x176f4d['options']);return db[_0xb757('0x52')]['find'](_0x5580ed)[_0xb757('0x20')](handleEntityNotFound(_0x5163b7,null))[_0xb757('0x20')](respondWithResult(_0x5163b7,null))[_0xb757('0x2b')](handleError(_0x5163b7,null));};exports[_0xb757('0x58')]=function(_0xd3910,_0x46eb6e){return db[_0xb757('0x52')][_0xb757('0x58')](_0xd3910[_0xb757('0x59')],{})[_0xb757('0x20')](respondWithResult(_0x46eb6e,0xc9))[_0xb757('0x2b')](handleError(_0x46eb6e,null));};exports[_0xb757('0x37')]=function(_0x5b28ab,_0xfbb0a7){if(_0x5b28ab[_0xb757('0x59')]['id']){delete _0x5b28ab[_0xb757('0x59')]['id'];}return db[_0xb757('0x52')][_0xb757('0x5a')]({'where':{'id':_0x5b28ab[_0xb757('0x57')]['id']}})['then'](handleEntityNotFound(_0xfbb0a7,null))[_0xb757('0x20')](saveUpdates(_0x5b28ab['body'],null))[_0xb757('0x20')](respondWithResult(_0xfbb0a7,null))[_0xb757('0x2b')](handleError(_0xfbb0a7,null));};exports['destroy']=function(_0x2df111,_0x4a64e8){return db['VtigerAccount'][_0xb757('0x5a')]({'where':{'id':_0x2df111[_0xb757('0x57')]['id']}})['then'](handleEntityNotFound(_0x4a64e8,null))[_0xb757('0x20')](removeEntity(_0x4a64e8,null))['catch'](handleError(_0x4a64e8,null));};exports[_0xb757('0x5b')]=function(_0x299b86,_0x4dc896,_0x2aa37b){var _0x1d6712={};var _0x5af8d2={};var _0xd73c23;var _0x449deb;return db[_0xb757('0x52')][_0xb757('0x5c')]({'where':{'id':_0x299b86[_0xb757('0x57')]['id']}})['then'](handleEntityNotFound(_0x4dc896,null))[_0xb757('0x20')](function(_0x353b62){if(_0x353b62){_0xd73c23=_0x353b62;_0x5af8d2[_0xb757('0x41')]=_[_0xb757('0x44')](db['VtigerConfiguration'][_0xb757('0x3d')]);_0x5af8d2[_0xb757('0x43')]=_[_0xb757('0x44')](_0x299b86[_0xb757('0x43')]);_0x5af8d2[_0xb757('0x4c')]=_[_0xb757('0x45')](_0x5af8d2[_0xb757('0x41')],_0x5af8d2[_0xb757('0x43')]);_0x1d6712[_0xb757('0x46')]=_['intersection'](_0x5af8d2[_0xb757('0x41')],qs[_0xb757('0x47')](_0x299b86[_0xb757('0x43')][_0xb757('0x47')]));_0x1d6712[_0xb757('0x46')]=_0x1d6712[_0xb757('0x46')][_0xb757('0x48')]?_0x1d6712['attributes']:_0x5af8d2[_0xb757('0x41')];_0x1d6712[_0xb757('0x5d')]=qs[_0xb757('0x4a')](_0x299b86[_0xb757('0x43')][_0xb757('0x4a')]);_0x1d6712[_0xb757('0x4b')]=qs['filters'](_[_0xb757('0x4d')](_0x299b86[_0xb757('0x43')],_0x5af8d2[_0xb757('0x4c')]));if(_0x299b86['query'][_0xb757('0x50')]){_0x1d6712[_0xb757('0x4b')]=_[_0xb757('0x4e')](_0x1d6712['where'],{'$or':_[_0xb757('0x42')](_0x1d6712[_0xb757('0x46')],function(_0x2b29bc){var _0x487034={};_0x487034[_0x2b29bc]={'$like':'%'+_0x299b86[_0xb757('0x43')]['filter']+'%'};return _0x487034;})});}_0x1d6712=_[_0xb757('0x4e')]({},_0x1d6712,_0x299b86[_0xb757('0x51')]);return _0xd73c23[_0xb757('0x5b')](_0x1d6712);}})[_0xb757('0x20')](function(_0x207c34){if(_0x207c34){_0x449deb=_0x207c34['length'];if(!_0x299b86[_0xb757('0x43')][_0xb757('0x49')]('nolimit')){_0x1d6712[_0xb757('0x32')]=qs['limit'](_0x299b86[_0xb757('0x43')][_0xb757('0x32')]);_0x1d6712[_0xb757('0x31')]=qs[_0xb757('0x31')](_0x299b86[_0xb757('0x43')][_0xb757('0x31')]);}return _0xd73c23[_0xb757('0x5b')](_0x1d6712);}})[_0xb757('0x20')](function(_0x2dde3b){if(_0x2dde3b){return _0x2dde3b?{'count':_0x449deb,'rows':_0x2dde3b}:null;}})[_0xb757('0x20')](respondWithResult(_0x4dc896,null))['catch'](handleError(_0x4dc896,null));};exports[_0xb757('0x5e')]=function(_0x18c9f0,_0x4cff64,_0x56dab6){if(_0x18c9f0[_0xb757('0x59')]['id']){delete _0x18c9f0[_0xb757('0x59')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x18c9f0[_0xb757('0x57')]['id']}})[_0xb757('0x20')](handleEntityNotFound(_0x4cff64,null))['then'](function(_0x22f04e){if(_0x22f04e){_0x18c9f0[_0xb757('0x59')][_0xb757('0x5f')]=_0x22f04e['id'];_0x18c9f0['body'][_0xb757('0x60')]=integrations['getSubjects'](_0x18c9f0[_0xb757('0x59')][_0xb757('0x61')],_0x18c9f0[_0xb757('0x59')][_0xb757('0x3f')]);_0x18c9f0[_0xb757('0x59')][_0xb757('0x62')]=integrations[_0xb757('0x63')](_0x18c9f0[_0xb757('0x59')][_0xb757('0x61')],_0x18c9f0['body'][_0xb757('0x3f')]);return db[_0xb757('0x64')][_0xb757('0x58')](_0x18c9f0[_0xb757('0x59')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db['VtigerField'],'as':_0xb757('0x62')}]});}return null;})[_0xb757('0x20')](respondWithResult(_0x4cff64,null))[_0xb757('0x2b')](handleError(_0x4cff64,null));};var md5=require(_0xb757('0x65'));exports[_0xb757('0x66')]=function(_0x3df5f1,_0x31f1ea,_0x314bf6){var _0x4bf8b2=null;var _0x34fc2c=null;var _0x3a51bb=null;var _0x459eba=null;var _0x4651da='';return db[_0xb757('0x52')][_0xb757('0x5c')]({'where':{'id':_0x3df5f1['params']['id']},'attributes':['id',_0xb757('0x3a'),'username',_0xb757('0x67'),_0xb757('0x68'),'remoteUri',_0xb757('0x69'),_0xb757('0x6a')]})['then'](handleEntityNotFound(_0x31f1ea,null))[_0xb757('0x20')](function(_0xa64dea){if(_0xa64dea){_0x4bf8b2=_0xa64dea[_0xb757('0x6b')];_0x34fc2c=_0xa64dea[_0xb757('0x6a')];_0x3a51bb=_0xa64dea[_0xb757('0x68')];_0x4651da=_0xa64dea[_0xb757('0x6c')];var _0x8e16fa=_0x4651da[_0xb757('0x6d')](-0x1);if(_0x8e16fa==='/'){_0x4651da=_0x4651da['substring'](0x0,_0x4651da[_0xb757('0x6e')](_0x8e16fa));}_0x459eba=util[_0xb757('0x6f')](_0xb757('0x70'),_0x4651da);var _0x398f34={'method':'GET','uri':_0x459eba,'qs':{'operation':'getchallenge','username':_0xa64dea[_0xb757('0x6b')]},'json':!![]};return rp(_0x398f34);}})[_0xb757('0x20')](function(_0x66ac7c){if(_0x66ac7c[_0xb757('0x71')]){var _0x2079bc={'method':_0xb757('0x72'),'uri':_0x459eba,'form':{'operation':_0xb757('0x73'),'username':_0x4bf8b2,'accessKey':md5(_0x66ac7c[_0xb757('0x2a')]['token']+_0x34fc2c)},'json':!![]};return rp(_0x2079bc);}})['then'](function(_0x4e681c){if(_0x4e681c[_0xb757('0x71')]){var _0x3053c5={'method':'GET','uri':_0x459eba,'qs':{'operation':'describe','username':_0x4bf8b2,'sessionName':_0x4e681c['result'][_0xb757('0x74')],'elementType':_0x3a51bb},'json':!![]};return rp(_0x3053c5);}})[_0xb757('0x20')](function(_0x143151){if(_0x143151[_0xb757('0x71')]){var _0x411dd3=[_0xb757('0x75'),'reference',_0xb757('0x76')];_[_0xb757('0x77')](_0x143151['result'][_0xb757('0x47')],function(_0x13586d){return _0x411dd3[_0xb757('0x78')](_0x13586d['type'][_0xb757('0x3a')]);});_[_0xb757('0x77')](_0x143151[_0xb757('0x2a')][_0xb757('0x47')],function(_0x15e76e){return _0x15e76e[_0xb757('0x79')]===_0xb757('0x7a');});return{'count':_0x143151['result']['fields']['length'],'rows':_[_0xb757('0x42')](_0x143151[_0xb757('0x2a')][_0xb757('0x47')],function(_0x2379f3){return{'id':_0x2379f3[_0xb757('0x3a')],'name':_0x2379f3[_0xb757('0x7b')],'custom':_[_0xb757('0x7c')](_0x2379f3[_0xb757('0x3a')],_0xb757('0x7d'))?!![]:![],'options':_0x2379f3[_0xb757('0x3f')]['name']===_0xb757('0x7e')&&_0x2379f3['type'][_0xb757('0x7f')]['length']>0x0?_[_0xb757('0x42')](_0x2379f3[_0xb757('0x3f')][_0xb757('0x7f')],function(_0x53563e){return{'name':_0x53563e[_0xb757('0x7b')],'value':_0x53563e[_0xb757('0x80')]};}):[]};})};}})[_0xb757('0x20')](respondWithResult(_0x31f1ea,null))[_0xb757('0x2b')](function(_0x2c0bb5){console[_0xb757('0x81')](_0xb757('0x82')+_0x2c0bb5);var _0x3efa3c=_0x3df5f1[_0xb757('0x43')][_0xb757('0x1b')]?0x1f4:_0x2c0bb5[_0xb757('0x83')]||0x1f4;logger[_0xb757('0x27')](_0xb757('0x84'),_0xb757('0x66'),_0x3efa3c,JSON[_0xb757('0x26')](_0x2c0bb5));delete _0x2c0bb5[_0xb757('0x3a')];if(_0x3efa3c===0x191){_0x3efa3c=0x190;}_0x31f1ea[_0xb757('0x2e')](_0x3efa3c)[_0xb757('0x3b')](_0x3df5f1[_0xb757('0x43')][_0xb757('0x1b')]?{'message':_0xb757('0x85'),'statusCode':_0x2c0bb5[_0xb757('0x83')]}:_0x2c0bb5);});}; \ No newline at end of file +var _0xf2f2=['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','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','apply','reject','update','destroy','end','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','VIRTUAL','options','VtigerAccount','includeAll','include','findAll','rows','params','find','create','body','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerField','Descriptions','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','%s/webservice.php','GET','success','POST','login','token','sessionName','autogenerated','reference','owner','remove','editable','false','label','startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','http','test','Sequelize'];(function(_0x47453a,_0x204aa9){var _0x423643=function(_0x1df456){while(--_0x1df456){_0x47453a['push'](_0x47453a['shift']());}};_0x423643(++_0x204aa9);}(_0xf2f2,0x168));var _0x2f2f=function(_0x10acb2,_0x3ca870){_0x10acb2=_0x10acb2-0x0;var _0x186379=_0xf2f2[_0x10acb2];return _0x186379;};'use strict';var pdf=require(_0x2f2f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2f2f('0x1'));var zipdir=require(_0x2f2f('0x2'));var jsonpatch=require(_0x2f2f('0x3'));var rp=require('request-promise');var moment=require(_0x2f2f('0x4'));var BPromise=require(_0x2f2f('0x5'));var Mustache=require('mustache');var util=require(_0x2f2f('0x6'));var path=require(_0x2f2f('0x7'));var sox=require(_0x2f2f('0x8'));var csv=require(_0x2f2f('0x9'));var ejs=require(_0x2f2f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2f2f('0xb'));var crypto=require(_0x2f2f('0xc'));var jsforce=require(_0x2f2f('0xd'));var deskjs=require(_0x2f2f('0xe'));var toCsv=require(_0x2f2f('0x9'));var querystring=require(_0x2f2f('0xf'));var Papa=require('papaparse');var Redis=require(_0x2f2f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2f2f('0x11'));var hardwareService=require(_0x2f2f('0x12'));var logger=require('../../config/logger')(_0x2f2f('0x13'));var utils=require(_0x2f2f('0x14'));var config=require(_0x2f2f('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x2f2f('0x16'));var jayson=require(_0x2f2f('0x17'));var client=jayson['client'][_0x2f2f('0x18')]({'port':0x232a});function checkPasswordPattern(_0x2c74ac,_0x2040e4,_0x3d46f1){if(_0x3d46f1){var _0x39ec85=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x39ec85[_0x2f2f('0x19')](_0x2040e4)){return _0x2c74ac;}else{throw new db[(_0x2f2f('0x1a'))][(_0x2f2f('0x1b'))](_0x2f2f('0x1c'));}}else{return _0x2c74ac;}}function respondWithRpcPromise(_0x142bfa,_0x49d134,_0x4f27aa,_0x12573a){return new BPromise(function(_0x4b2c28,_0x7c8671){var _0xe17d5f=_0x12573a||client;return _0xe17d5f[_0x2f2f('0x1d')](_0x142bfa,_0x4f27aa)[_0x2f2f('0x1e')](function(_0x1fbec0){logger[_0x2f2f('0x1f')]('VtigerAccount,\x20%s,\x20%s',_0x49d134,_0x2f2f('0x20'));logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x49d134,'request\x20sent',JSON[_0x2f2f('0x21')](_0x1fbec0));if(_0x1fbec0[_0x2f2f('0x22')]){if(_0x1fbec0[_0x2f2f('0x22')][_0x2f2f('0x23')]===0x1f4){logger[_0x2f2f('0x22')](_0x2f2f('0x24'),_0x49d134,_0x1fbec0[_0x2f2f('0x22')][_0x2f2f('0x25')]);return _0x7c8671(_0x1fbec0[_0x2f2f('0x22')][_0x2f2f('0x25')]);}logger[_0x2f2f('0x22')](_0x2f2f('0x24'),_0x49d134,_0x1fbec0['error'][_0x2f2f('0x25')]);return _0x4b2c28(_0x1fbec0[_0x2f2f('0x22')][_0x2f2f('0x25')]);}else{logger[_0x2f2f('0x1f')](_0x2f2f('0x24'),_0x49d134,_0x2f2f('0x20'));_0x4b2c28(_0x1fbec0[_0x2f2f('0x26')]['message']);}})[_0x2f2f('0x27')](function(_0x74228d){logger[_0x2f2f('0x22')](_0x2f2f('0x24'),_0x49d134,_0x74228d);_0x7c8671(_0x74228d);});});}function respondWithStatusCode(_0x57eb88,_0x34445c){_0x34445c=_0x34445c||0xcc;return function(_0x253990){if(_0x253990){return _0x57eb88[_0x2f2f('0x28')](_0x34445c);}return _0x57eb88['status'](_0x34445c)['end']();};}function respondWithResult(_0x586361,_0x39a780){_0x39a780=_0x39a780||0xc8;return function(_0x24737b){if(_0x24737b){return _0x586361[_0x2f2f('0x29')](_0x39a780)[_0x2f2f('0x2a')](_0x24737b);}};}function respondWithFilteredResult(_0x3e3ef6,_0x262cee){return function(_0x1491f8){if(_0x1491f8){var _0x682c9f=_0x1491f8[_0x2f2f('0x2b')],_0x27aa24=_0x262cee[_0x2f2f('0x2c')],_0x5ed0ec=_0x262cee[_0x2f2f('0x2c')]+_0x262cee[_0x2f2f('0x2d')],_0x3d565d;if(_0x5ed0ec>=_0x682c9f){_0x5ed0ec=_0x682c9f;_0x3d565d=0xc8;}else{_0x3d565d=0xce;}_0x3e3ef6[_0x2f2f('0x29')](_0x3d565d);return _0x3e3ef6['set']('Content-Range',_0x27aa24+'-'+_0x5ed0ec+'/'+_0x682c9f)[_0x2f2f('0x2a')](_0x1491f8);}return null;};}function patchUpdates(_0x4d2e51){return function(_0x4c8411){try{jsonpatch[_0x2f2f('0x2e')](_0x4c8411,_0x4d2e51,!![]);}catch(_0x2cc467){return BPromise[_0x2f2f('0x2f')](_0x2cc467);}return _0x4c8411['save']();};}function saveUpdates(_0x4e59ed,_0x341e9a){return function(_0x34e8f7){if(_0x34e8f7){return _0x34e8f7[_0x2f2f('0x30')](_0x4e59ed)['then'](function(_0x153d18){return _0x153d18;});}return null;};}function removeEntity(_0x1a5e1c,_0x1e5721){return function(_0x1f5293){if(_0x1f5293){return _0x1f5293[_0x2f2f('0x31')]()[_0x2f2f('0x1e')](function(){_0x1a5e1c[_0x2f2f('0x29')](0xcc)[_0x2f2f('0x32')]();});}};}function handleEntityNotFound(_0x19b647,_0x16f969){return function(_0x13e86f){if(!_0x13e86f){_0x19b647[_0x2f2f('0x28')](0x194);}return _0x13e86f;};}function handleError(_0x5b782f,_0x1e1a62){_0x1e1a62=_0x1e1a62||0x1f4;return function(_0x470e0b){logger[_0x2f2f('0x22')](_0x470e0b[_0x2f2f('0x33')]);if(_0x470e0b[_0x2f2f('0x34')]){delete _0x470e0b[_0x2f2f('0x34')];}_0x5b782f[_0x2f2f('0x29')](_0x1e1a62)['send'](_0x470e0b);};}exports['index']=function(_0x36b607,_0xe1df5f){var _0x3bb64a={},_0xd95e3f={},_0x124f44={'count':0x0,'rows':[]};var _0x189c41=_['map'](db['VtigerAccount'][_0x2f2f('0x35')],function(_0x10a6b8){return{'name':_0x10a6b8[_0x2f2f('0x36')],'type':_0x10a6b8[_0x2f2f('0x37')][_0x2f2f('0x38')]};});_0xd95e3f[_0x2f2f('0x39')]=_['map'](_0x189c41,_0x2f2f('0x34'));_0xd95e3f[_0x2f2f('0x3a')]=_[_0x2f2f('0x3b')](_0x36b607['query']);_0xd95e3f[_0x2f2f('0x3c')]=_['intersection'](_0xd95e3f['model'],_0xd95e3f['query']);_0x3bb64a['attributes']=_[_0x2f2f('0x3d')](_0xd95e3f[_0x2f2f('0x39')],qs['fields'](_0x36b607['query'][_0x2f2f('0x3e')]));_0x3bb64a[_0x2f2f('0x3f')]=_0x3bb64a[_0x2f2f('0x3f')][_0x2f2f('0x40')]?_0x3bb64a['attributes']:_0xd95e3f[_0x2f2f('0x39')];if(!_0x36b607[_0x2f2f('0x3a')][_0x2f2f('0x41')](_0x2f2f('0x42'))){_0x3bb64a[_0x2f2f('0x2d')]=qs['limit'](_0x36b607[_0x2f2f('0x3a')]['limit']);_0x3bb64a[_0x2f2f('0x2c')]=qs[_0x2f2f('0x2c')](_0x36b607[_0x2f2f('0x3a')][_0x2f2f('0x2c')]);}_0x3bb64a['order']=qs[_0x2f2f('0x43')](_0x36b607[_0x2f2f('0x3a')][_0x2f2f('0x43')]);_0x3bb64a['where']=qs[_0x2f2f('0x3c')](_[_0x2f2f('0x44')](_0x36b607[_0x2f2f('0x3a')],_0xd95e3f[_0x2f2f('0x3c')]));if(_0x36b607['query'][_0x2f2f('0x45')]){_0x3bb64a[_0x2f2f('0x46')]=_[_0x2f2f('0x47')](_0x3bb64a['where'],{'$or':_[_0x2f2f('0x48')](_0x189c41,function(_0x10734a){if(_0x10734a[_0x2f2f('0x37')]!==_0x2f2f('0x49')){var _0x2b6127={};_0x2b6127[_0x10734a['name']]={'$like':'%'+_0x36b607[_0x2f2f('0x3a')][_0x2f2f('0x45')]+'%'};return _0x2b6127;}})});}_0x3bb64a=_[_0x2f2f('0x47')]({},_0x3bb64a,_0x36b607[_0x2f2f('0x4a')]);var _0x5471ae={'where':_0x3bb64a['where']};return db[_0x2f2f('0x4b')][_0x2f2f('0x2b')](_0x5471ae)[_0x2f2f('0x1e')](function(_0x5810bb){_0x124f44[_0x2f2f('0x2b')]=_0x5810bb;if(_0x36b607['query'][_0x2f2f('0x4c')]){_0x3bb64a[_0x2f2f('0x4d')]=[{'all':!![]}];}return db[_0x2f2f('0x4b')][_0x2f2f('0x4e')](_0x3bb64a);})['then'](function(_0x1296b0){_0x124f44[_0x2f2f('0x4f')]=_0x1296b0;return _0x124f44;})[_0x2f2f('0x1e')](respondWithFilteredResult(_0xe1df5f,_0x3bb64a))['catch'](handleError(_0xe1df5f,null));};exports['show']=function(_0x142d44,_0x576b58){var _0x5814ee={'raw':![],'where':{'id':_0x142d44[_0x2f2f('0x50')]['id']}},_0x5e268e={};_0x5e268e['model']=_[_0x2f2f('0x3b')](db[_0x2f2f('0x4b')][_0x2f2f('0x35')]);_0x5e268e['query']=_[_0x2f2f('0x3b')](_0x142d44[_0x2f2f('0x3a')]);_0x5e268e[_0x2f2f('0x3c')]=_['intersection'](_0x5e268e[_0x2f2f('0x39')],_0x5e268e['query']);_0x5814ee['attributes']=_[_0x2f2f('0x3d')](_0x5e268e[_0x2f2f('0x39')],qs['fields'](_0x142d44[_0x2f2f('0x3a')][_0x2f2f('0x3e')]));_0x5814ee[_0x2f2f('0x3f')]=_0x5814ee[_0x2f2f('0x3f')]['length']?_0x5814ee[_0x2f2f('0x3f')]:_0x5e268e[_0x2f2f('0x39')];if(_0x142d44[_0x2f2f('0x3a')]['includeAll']){_0x5814ee['include']=[{'all':!![]}];}_0x5814ee=_['merge']({},_0x5814ee,_0x142d44[_0x2f2f('0x4a')]);return db[_0x2f2f('0x4b')][_0x2f2f('0x51')](_0x5814ee)[_0x2f2f('0x1e')](handleEntityNotFound(_0x576b58,null))['then'](respondWithResult(_0x576b58,null))[_0x2f2f('0x27')](handleError(_0x576b58,null));};exports[_0x2f2f('0x52')]=function(_0x528322,_0x17d530){return db['VtigerAccount'][_0x2f2f('0x52')](_0x528322[_0x2f2f('0x53')],{})[_0x2f2f('0x1e')](respondWithResult(_0x17d530,0xc9))[_0x2f2f('0x27')](handleError(_0x17d530,null));};exports[_0x2f2f('0x30')]=function(_0xd05a55,_0x3bba01){if(_0xd05a55['body']['id']){delete _0xd05a55['body']['id'];}return db['VtigerAccount']['find']({'where':{'id':_0xd05a55[_0x2f2f('0x50')]['id']}})[_0x2f2f('0x1e')](handleEntityNotFound(_0x3bba01,null))[_0x2f2f('0x1e')](saveUpdates(_0xd05a55[_0x2f2f('0x53')],null))[_0x2f2f('0x1e')](respondWithResult(_0x3bba01,null))[_0x2f2f('0x27')](handleError(_0x3bba01,null));};exports[_0x2f2f('0x31')]=function(_0x1ff5d7,_0xd7a193){return db[_0x2f2f('0x4b')][_0x2f2f('0x51')]({'where':{'id':_0x1ff5d7[_0x2f2f('0x50')]['id']}})[_0x2f2f('0x1e')](handleEntityNotFound(_0xd7a193,null))[_0x2f2f('0x1e')](removeEntity(_0xd7a193,null))['catch'](handleError(_0xd7a193,null));};exports[_0x2f2f('0x54')]=function(_0x3a6b0c,_0x4b294a,_0x4b1967){var _0xdf79d0={};var _0x2705fc={};var _0x29f8d8;var _0x24cc72;return db['VtigerAccount'][_0x2f2f('0x55')]({'where':{'id':_0x3a6b0c[_0x2f2f('0x50')]['id']}})[_0x2f2f('0x1e')](handleEntityNotFound(_0x4b294a,null))['then'](function(_0x101897){if(_0x101897){_0x29f8d8=_0x101897;_0x2705fc['model']=_[_0x2f2f('0x3b')](db['VtigerConfiguration'][_0x2f2f('0x35')]);_0x2705fc[_0x2f2f('0x3a')]=_[_0x2f2f('0x3b')](_0x3a6b0c[_0x2f2f('0x3a')]);_0x2705fc[_0x2f2f('0x3c')]=_[_0x2f2f('0x3d')](_0x2705fc[_0x2f2f('0x39')],_0x2705fc[_0x2f2f('0x3a')]);_0xdf79d0[_0x2f2f('0x3f')]=_['intersection'](_0x2705fc[_0x2f2f('0x39')],qs[_0x2f2f('0x3e')](_0x3a6b0c[_0x2f2f('0x3a')][_0x2f2f('0x3e')]));_0xdf79d0[_0x2f2f('0x3f')]=_0xdf79d0[_0x2f2f('0x3f')][_0x2f2f('0x40')]?_0xdf79d0['attributes']:_0x2705fc[_0x2f2f('0x39')];_0xdf79d0[_0x2f2f('0x56')]=qs[_0x2f2f('0x43')](_0x3a6b0c['query']['sort']);_0xdf79d0[_0x2f2f('0x46')]=qs['filters'](_[_0x2f2f('0x44')](_0x3a6b0c[_0x2f2f('0x3a')],_0x2705fc[_0x2f2f('0x3c')]));if(_0x3a6b0c['query'][_0x2f2f('0x45')]){_0xdf79d0[_0x2f2f('0x46')]=_[_0x2f2f('0x47')](_0xdf79d0[_0x2f2f('0x46')],{'$or':_[_0x2f2f('0x48')](_0xdf79d0[_0x2f2f('0x3f')],function(_0x45e4e6){var _0x444916={};_0x444916[_0x45e4e6]={'$like':'%'+_0x3a6b0c['query'][_0x2f2f('0x45')]+'%'};return _0x444916;})});}_0xdf79d0=_['merge']({},_0xdf79d0,_0x3a6b0c[_0x2f2f('0x4a')]);return _0x29f8d8['getConfigurations'](_0xdf79d0);}})[_0x2f2f('0x1e')](function(_0x29e6c6){if(_0x29e6c6){_0x24cc72=_0x29e6c6[_0x2f2f('0x40')];if(!_0x3a6b0c[_0x2f2f('0x3a')]['hasOwnProperty'](_0x2f2f('0x42'))){_0xdf79d0[_0x2f2f('0x2d')]=qs['limit'](_0x3a6b0c[_0x2f2f('0x3a')][_0x2f2f('0x2d')]);_0xdf79d0[_0x2f2f('0x2c')]=qs[_0x2f2f('0x2c')](_0x3a6b0c[_0x2f2f('0x3a')][_0x2f2f('0x2c')]);}return _0x29f8d8[_0x2f2f('0x54')](_0xdf79d0);}})[_0x2f2f('0x1e')](function(_0x9c5606){if(_0x9c5606){return _0x9c5606?{'count':_0x24cc72,'rows':_0x9c5606}:null;}})['then'](respondWithResult(_0x4b294a,null))[_0x2f2f('0x27')](handleError(_0x4b294a,null));};exports[_0x2f2f('0x57')]=function(_0x2a2800,_0x4fad9e,_0x516ef5){if(_0x2a2800[_0x2f2f('0x53')]['id']){delete _0x2a2800[_0x2f2f('0x53')]['id'];}return db[_0x2f2f('0x4b')]['findOne']({'where':{'id':_0x2a2800[_0x2f2f('0x50')]['id']}})[_0x2f2f('0x1e')](handleEntityNotFound(_0x4fad9e,null))['then'](function(_0x12a0a4){if(_0x12a0a4){_0x2a2800['body'][_0x2f2f('0x58')]=_0x12a0a4['id'];_0x2a2800[_0x2f2f('0x53')][_0x2f2f('0x59')]=integrations[_0x2f2f('0x5a')](_0x2a2800[_0x2f2f('0x53')][_0x2f2f('0x5b')],_0x2a2800['body'][_0x2f2f('0x37')]);_0x2a2800[_0x2f2f('0x53')]['Descriptions']=integrations[_0x2f2f('0x5c')](_0x2a2800['body'][_0x2f2f('0x5b')],_0x2a2800[_0x2f2f('0x53')][_0x2f2f('0x37')]);return db['VtigerConfiguration'][_0x2f2f('0x52')](_0x2a2800['body'],{'include':[{'model':db[_0x2f2f('0x5d')],'as':_0x2f2f('0x59')},{'model':db[_0x2f2f('0x5d')],'as':_0x2f2f('0x5e')}]});}return null;})[_0x2f2f('0x1e')](respondWithResult(_0x4fad9e,null))[_0x2f2f('0x27')](handleError(_0x4fad9e,null));};var md5=require('md5');exports[_0x2f2f('0x5f')]=function(_0x4cdcaf,_0x2e7339,_0x134159){var _0x5b224c=null;var _0x5e5c49=null;var _0x85d197=null;var _0xed757e=null;var _0x37077b='';return db[_0x2f2f('0x4b')]['findOne']({'where':{'id':_0x4cdcaf['params']['id']},'attributes':['id',_0x2f2f('0x34'),_0x2f2f('0x60'),_0x2f2f('0x61'),_0x2f2f('0x62'),_0x2f2f('0x63'),_0x2f2f('0x64'),_0x2f2f('0x65')]})[_0x2f2f('0x1e')](handleEntityNotFound(_0x2e7339,null))['then'](function(_0x2d56c7){if(_0x2d56c7){_0x5b224c=_0x2d56c7[_0x2f2f('0x60')];_0x5e5c49=_0x2d56c7[_0x2f2f('0x65')];_0x85d197=_0x2d56c7[_0x2f2f('0x62')];_0x37077b=_0x2d56c7[_0x2f2f('0x63')];var _0x19a88b=_0x37077b['slice'](-0x1);if(_0x19a88b==='/'){_0x37077b=_0x37077b[_0x2f2f('0x66')](0x0,_0x37077b[_0x2f2f('0x67')](_0x19a88b));}_0xed757e=util[_0x2f2f('0x68')](_0x2f2f('0x69'),_0x37077b);var _0x32c92d={'method':_0x2f2f('0x6a'),'uri':_0xed757e,'qs':{'operation':'getchallenge','username':_0x2d56c7[_0x2f2f('0x60')]},'json':!![]};return rp(_0x32c92d);}})[_0x2f2f('0x1e')](function(_0x489fa0){if(_0x489fa0[_0x2f2f('0x6b')]){var _0x577599={'method':_0x2f2f('0x6c'),'uri':_0xed757e,'form':{'operation':_0x2f2f('0x6d'),'username':_0x5b224c,'accessKey':md5(_0x489fa0[_0x2f2f('0x26')][_0x2f2f('0x6e')]+_0x5e5c49)},'json':!![]};return rp(_0x577599);}})['then'](function(_0x357831){if(_0x357831[_0x2f2f('0x6b')]){var _0x15ebee={'method':_0x2f2f('0x6a'),'uri':_0xed757e,'qs':{'operation':'describe','username':_0x5b224c,'sessionName':_0x357831[_0x2f2f('0x26')][_0x2f2f('0x6f')],'elementType':_0x85d197},'json':!![]};return rp(_0x15ebee);}})[_0x2f2f('0x1e')](function(_0x305716){if(_0x305716[_0x2f2f('0x6b')]){var _0x1eba73=[_0x2f2f('0x70'),_0x2f2f('0x71'),_0x2f2f('0x72')];_[_0x2f2f('0x73')](_0x305716['result'][_0x2f2f('0x3e')],function(_0x4b5bb8){return _0x1eba73['includes'](_0x4b5bb8[_0x2f2f('0x37')][_0x2f2f('0x34')]);});_[_0x2f2f('0x73')](_0x305716['result'][_0x2f2f('0x3e')],function(_0x1f6abc){return _0x1f6abc[_0x2f2f('0x74')]===_0x2f2f('0x75');});return{'count':_0x305716[_0x2f2f('0x26')]['fields'][_0x2f2f('0x40')],'rows':_[_0x2f2f('0x48')](_0x305716['result'][_0x2f2f('0x3e')],function(_0x50016b){return{'id':_0x50016b[_0x2f2f('0x34')],'name':_0x50016b[_0x2f2f('0x76')],'custom':_[_0x2f2f('0x77')](_0x50016b[_0x2f2f('0x34')],'cf_')?!![]:![],'options':_0x50016b[_0x2f2f('0x37')][_0x2f2f('0x34')]===_0x2f2f('0x78')&&_0x50016b[_0x2f2f('0x37')][_0x2f2f('0x79')][_0x2f2f('0x40')]>0x0?_['map'](_0x50016b['type'][_0x2f2f('0x79')],function(_0x5d7237){return{'name':_0x5d7237[_0x2f2f('0x76')],'value':_0x5d7237[_0x2f2f('0x7a')]};}):[]};})};}})['then'](respondWithResult(_0x2e7339,null))['catch'](function(_0x4413b0){console[_0x2f2f('0x7b')](_0x2f2f('0x7c')+_0x4413b0);var _0x1fc83f=_0x4cdcaf[_0x2f2f('0x3a')][_0x2f2f('0x19')]?0x1f4:_0x4413b0[_0x2f2f('0x7d')]||0x1f4;logger[_0x2f2f('0x22')](_0x2f2f('0x7e'),'getFields',_0x1fc83f,JSON[_0x2f2f('0x21')](_0x4413b0));delete _0x4413b0[_0x2f2f('0x34')];if(_0x1fc83f===0x191){_0x1fc83f=0x190;}_0x2e7339['status'](_0x1fc83f)[_0x2f2f('0x7f')](_0x4cdcaf[_0x2f2f('0x3a')]['test']?{'message':_0x2f2f('0x80'),'statusCode':_0x4413b0[_0x2f2f('0x7d')]}:_0x4413b0);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 16e062f..8f3187a 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 _0xd426=['rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x45505a,_0x5d3ea6){var _0x13e858=function(_0x5e7ec8){while(--_0x5e7ec8){_0x45505a['push'](_0x45505a['shift']());}};_0x13e858(++_0x5d3ea6);}(_0xd426,0x1c8));var _0x6d42=function(_0x4c4917,_0x3a7a7f){_0x4c4917=_0x4c4917-0x0;var _0x143c92=_0xd426[_0x4c4917];return _0x143c92;};'use strict';var _=require(_0x6d42('0x0'));var util=require(_0x6d42('0x1'));var logger=require(_0x6d42('0x2'))(_0x6d42('0x3'));var moment=require(_0x6d42('0x4'));var BPromise=require(_0x6d42('0x5'));var rp=require(_0x6d42('0x6'));var fs=require('fs');var path=require(_0x6d42('0x7'));var rimraf=require(_0x6d42('0x8'));var config=require(_0x6d42('0x9'));var attributes=require(_0x6d42('0xa'));var integrations=require(_0x6d42('0xb'));module[_0x6d42('0xc')]=function(_0x21936c,_0x90c60e){return _0x21936c[_0x6d42('0xd')](_0x6d42('0xe'),attributes,{'tableName':_0x6d42('0xf'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb84=['int_vtiger_accounts','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x3e7844,_0x38e59f){var _0x26fe94=function(_0x44012e){while(--_0x44012e){_0x3e7844['push'](_0x3e7844['shift']());}};_0x26fe94(++_0x38e59f);}(_0xfb84,0xd9));var _0x4fb8=function(_0x3f465d,_0xbd2037){_0x3f465d=_0x3f465d-0x0;var _0x121ad1=_0xfb84[_0x3f465d];return _0x121ad1;};'use strict';var _=require(_0x4fb8('0x0'));var util=require(_0x4fb8('0x1'));var logger=require(_0x4fb8('0x2'))('api');var moment=require(_0x4fb8('0x3'));var BPromise=require(_0x4fb8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4fb8('0x5'));var config=require(_0x4fb8('0x6'));var attributes=require(_0x4fb8('0x7'));var integrations=require(_0x4fb8('0x8'));module[_0x4fb8('0x9')]=function(_0x2b0440,_0x4d561){return _0x2b0440[_0x4fb8('0xa')]('VtigerAccount',attributes,{'tableName':_0x4fb8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 67da482..e451184 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 _0xf0ff=['VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','include','model','map','attributes','ShowVtigerAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf0ff,0x1db));var _0xff0f=function(_0x226c86,_0x3c7440){_0x226c86=_0x226c86-0x0;var _0x476f1a=_0xf0ff[_0x226c86];return _0x476f1a;};'use strict';var _=require(_0xff0f('0x0'));var util=require('util');var moment=require(_0xff0f('0x1'));var BPromise=require(_0xff0f('0x2'));var rs=require(_0xff0f('0x3'));var fs=require('fs');var Redis=require(_0xff0f('0x4'));var db=require(_0xff0f('0x5'))['db'];var utils=require(_0xff0f('0x6'));var logger=require(_0xff0f('0x7'))(_0xff0f('0x8'));var config=require(_0xff0f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xff0f('0xa')][_0xff0f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35dd88,_0x4dde3d,_0x32f36d){return new BPromise(function(_0x5a661c,_0x462156){return client[_0xff0f('0xc')](_0x35dd88,_0x32f36d)[_0xff0f('0xd')](function(_0x3948d8){logger[_0xff0f('0xe')](_0xff0f('0xf'),_0x4dde3d,_0xff0f('0x10'));logger[_0xff0f('0x11')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4dde3d,_0xff0f('0x10'),JSON[_0xff0f('0x12')](_0x3948d8));if(_0x3948d8[_0xff0f('0x13')]){if(_0x3948d8['error'][_0xff0f('0x14')]===0x1f4){logger['error'](_0xff0f('0xf'),_0x4dde3d,_0x3948d8[_0xff0f('0x13')]['message']);return _0x462156(_0x3948d8['error'][_0xff0f('0x15')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x4dde3d,_0x3948d8[_0xff0f('0x13')]['message']);return _0x5a661c(_0x3948d8[_0xff0f('0x13')][_0xff0f('0x15')]);}else{logger[_0xff0f('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x4dde3d,'request\x20sent');_0x5a661c(_0x3948d8[_0xff0f('0x16')]['message']);}})[_0xff0f('0x17')](function(_0x5a6014){logger[_0xff0f('0x13')](_0xff0f('0xf'),_0x4dde3d,_0x5a6014);_0x462156(_0x5a6014);});});}exports[_0xff0f('0x18')]=function(_0x91af9){var _0x1bd6bf=this;return new Promise(function(_0x455269,_0x5a5ee0){return db[_0xff0f('0x19')][_0xff0f('0x1a')]({'raw':_0x91af9[_0xff0f('0x1b')]?_0x91af9['options'][_0xff0f('0x1c')]===undefined?!![]:![]:!![],'where':_0x91af9[_0xff0f('0x1b')]?_0x91af9[_0xff0f('0x1b')][_0xff0f('0x1d')]||null:null,'attributes':_0x91af9[_0xff0f('0x1b')]?_0x91af9[_0xff0f('0x1b')]['attributes']||null:null,'limit':_0x91af9[_0xff0f('0x1b')]?_0x91af9['options']['limit']||null:null,'include':_0x91af9[_0xff0f('0x1b')]?_0x91af9[_0xff0f('0x1b')]['include']?_['map'](_0x91af9[_0xff0f('0x1b')][_0xff0f('0x1e')],function(_0x442c7e){return{'model':db[_0x442c7e[_0xff0f('0x1f')]],'as':_0x442c7e['as'],'attributes':_0x442c7e['attributes'],'include':_0x442c7e[_0xff0f('0x1e')]?_[_0xff0f('0x20')](_0x442c7e[_0xff0f('0x1e')],function(_0x3e1b01){return{'model':db[_0x3e1b01[_0xff0f('0x1f')]],'as':_0x3e1b01['as'],'attributes':_0x3e1b01[_0xff0f('0x21')],'include':_0x3e1b01[_0xff0f('0x1e')]?_['map'](_0x3e1b01[_0xff0f('0x1e')],function(_0xdde92){return{'model':db[_0xdde92[_0xff0f('0x1f')]],'as':_0xdde92['as'],'attributes':_0xdde92['attributes']};}):[]};}):[]};}):[]:[]})[_0xff0f('0xd')](function(_0x52234e){logger[_0xff0f('0xe')](_0xff0f('0x18'),_0x91af9);logger[_0xff0f('0x11')](_0xff0f('0x18'),_0x91af9,JSON[_0xff0f('0x12')](_0x52234e));_0x455269(_0x52234e);})[_0xff0f('0x17')](function(_0x32b6b8){logger[_0xff0f('0x13')]('GetVtigerAccount',_0x32b6b8['message'],_0x91af9);_0x5a5ee0(_0x1bd6bf['error'](0x1f4,_0x32b6b8['message']));});});};exports['ShowVtigerAccount']=function(_0x2d8d51){var _0x4c9f9b=this;return new Promise(function(_0x421dc,_0x2b5dc6){return db[_0xff0f('0x19')]['find']({'raw':_0x2d8d51[_0xff0f('0x1b')]?_0x2d8d51[_0xff0f('0x1b')][_0xff0f('0x1c')]===undefined?!![]:![]:!![],'where':_0x2d8d51[_0xff0f('0x1b')]?_0x2d8d51[_0xff0f('0x1b')][_0xff0f('0x1d')]||null:null,'attributes':_0x2d8d51[_0xff0f('0x1b')]?_0x2d8d51[_0xff0f('0x1b')][_0xff0f('0x21')]||null:null,'include':_0x2d8d51[_0xff0f('0x1b')]?_0x2d8d51[_0xff0f('0x1b')][_0xff0f('0x1e')]?_[_0xff0f('0x20')](_0x2d8d51[_0xff0f('0x1b')][_0xff0f('0x1e')],function(_0x359f47){return{'model':db[_0x359f47[_0xff0f('0x1f')]],'as':_0x359f47['as'],'attributes':_0x359f47[_0xff0f('0x21')],'include':_0x359f47[_0xff0f('0x1e')]?_[_0xff0f('0x20')](_0x359f47[_0xff0f('0x1e')],function(_0x93919a){return{'model':db[_0x93919a['model']],'as':_0x93919a['as'],'attributes':_0x93919a['attributes'],'include':_0x93919a[_0xff0f('0x1e')]?_[_0xff0f('0x20')](_0x93919a[_0xff0f('0x1e')],function(_0x5194b5){return{'model':db[_0x5194b5[_0xff0f('0x1f')]],'as':_0x5194b5['as'],'attributes':_0x5194b5['attributes']};}):[]};}):[]};}):[]:[]})[_0xff0f('0xd')](function(_0x524aaa){logger['info'](_0xff0f('0x22'),_0x2d8d51);logger['debug']('ShowVtigerAccount',_0x2d8d51,JSON[_0xff0f('0x12')](_0x524aaa));_0x421dc(_0x524aaa);})[_0xff0f('0x17')](function(_0x36fd6a){logger['error'](_0xff0f('0x22'),_0x36fd6a[_0xff0f('0x15')],_0x2d8d51);_0x2b5dc6(_0x4c9f9b['error'](0x1f4,_0x36fd6a[_0xff0f('0x15')]));});});}; \ No newline at end of file +var _0x8b2f=['info','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VtigerAccount,\x20%s,\x20%s','result','catch','findAll','options','raw','where','attributes','limit','include','map','debug','GetVtigerAccount','ShowVtigerAccount','model','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2e6d0c,_0x14c856){var _0x180a6b=function(_0x339587){while(--_0x339587){_0x2e6d0c['push'](_0x2e6d0c['shift']());}};_0x180a6b(++_0x14c856);}(_0x8b2f,0x1a2));var _0xf8b2=function(_0x324e6b,_0x265b6a){_0x324e6b=_0x324e6b-0x0;var _0x37ee46=_0x8b2f[_0x324e6b];return _0x37ee46;};'use strict';var _=require(_0xf8b2('0x0'));var util=require('util');var moment=require(_0xf8b2('0x1'));var BPromise=require(_0xf8b2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf8b2('0x3'));var db=require(_0xf8b2('0x4'))['db'];var utils=require(_0xf8b2('0x5'));var logger=require(_0xf8b2('0x6'))(_0xf8b2('0x7'));var config=require(_0xf8b2('0x8'));var jayson=require(_0xf8b2('0x9'));var client=jayson[_0xf8b2('0xa')][_0xf8b2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37d3ee,_0x48e4f7,_0x31630f){return new BPromise(function(_0x14116a,_0x24b43c){return client[_0xf8b2('0xc')](_0x37d3ee,_0x31630f)[_0xf8b2('0xd')](function(_0xb84e6){logger[_0xf8b2('0xe')]('VtigerAccount,\x20%s,\x20%s',_0x48e4f7,'request\x20sent');logger['debug'](_0xf8b2('0xf'),_0x48e4f7,_0xf8b2('0x10'),JSON[_0xf8b2('0x11')](_0xb84e6));if(_0xb84e6[_0xf8b2('0x12')]){if(_0xb84e6[_0xf8b2('0x12')][_0xf8b2('0x13')]===0x1f4){logger[_0xf8b2('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x48e4f7,_0xb84e6[_0xf8b2('0x12')]['message']);return _0x24b43c(_0xb84e6['error']['message']);}logger[_0xf8b2('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x48e4f7,_0xb84e6[_0xf8b2('0x12')][_0xf8b2('0x14')]);return _0x14116a(_0xb84e6[_0xf8b2('0x12')]['message']);}else{logger['info'](_0xf8b2('0x15'),_0x48e4f7,_0xf8b2('0x10'));_0x14116a(_0xb84e6[_0xf8b2('0x16')][_0xf8b2('0x14')]);}})[_0xf8b2('0x17')](function(_0x3dd968){logger[_0xf8b2('0x12')](_0xf8b2('0x15'),_0x48e4f7,_0x3dd968);_0x24b43c(_0x3dd968);});});}exports['GetVtigerAccount']=function(_0x19bdb7){var _0x21994e=this;return new Promise(function(_0x363259,_0x5566fb){return db['VtigerAccount'][_0xf8b2('0x18')]({'raw':_0x19bdb7['options']?_0x19bdb7[_0xf8b2('0x19')][_0xf8b2('0x1a')]===undefined?!![]:![]:!![],'where':_0x19bdb7[_0xf8b2('0x19')]?_0x19bdb7[_0xf8b2('0x19')][_0xf8b2('0x1b')]||null:null,'attributes':_0x19bdb7[_0xf8b2('0x19')]?_0x19bdb7['options'][_0xf8b2('0x1c')]||null:null,'limit':_0x19bdb7[_0xf8b2('0x19')]?_0x19bdb7['options'][_0xf8b2('0x1d')]||null:null,'include':_0x19bdb7[_0xf8b2('0x19')]?_0x19bdb7[_0xf8b2('0x19')][_0xf8b2('0x1e')]?_[_0xf8b2('0x1f')](_0x19bdb7['options'][_0xf8b2('0x1e')],function(_0x328d5d){return{'model':db[_0x328d5d['model']],'as':_0x328d5d['as'],'attributes':_0x328d5d[_0xf8b2('0x1c')],'include':_0x328d5d[_0xf8b2('0x1e')]?_[_0xf8b2('0x1f')](_0x328d5d['include'],function(_0x21d553){return{'model':db[_0x21d553['model']],'as':_0x21d553['as'],'attributes':_0x21d553[_0xf8b2('0x1c')],'include':_0x21d553[_0xf8b2('0x1e')]?_[_0xf8b2('0x1f')](_0x21d553[_0xf8b2('0x1e')],function(_0x6ae94){return{'model':db[_0x6ae94['model']],'as':_0x6ae94['as'],'attributes':_0x6ae94['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b5a72){logger[_0xf8b2('0xe')]('GetVtigerAccount',_0x19bdb7);logger[_0xf8b2('0x20')](_0xf8b2('0x21'),_0x19bdb7,JSON[_0xf8b2('0x11')](_0x2b5a72));_0x363259(_0x2b5a72);})[_0xf8b2('0x17')](function(_0x4a0d17){logger[_0xf8b2('0x12')](_0xf8b2('0x21'),_0x4a0d17[_0xf8b2('0x14')],_0x19bdb7);_0x5566fb(_0x21994e['error'](0x1f4,_0x4a0d17[_0xf8b2('0x14')]));});});};exports[_0xf8b2('0x22')]=function(_0x29a0c0){var _0x29b126=this;return new Promise(function(_0x21a859,_0x2bf16c){return db['VtigerAccount']['find']({'raw':_0x29a0c0[_0xf8b2('0x19')]?_0x29a0c0[_0xf8b2('0x19')][_0xf8b2('0x1a')]===undefined?!![]:![]:!![],'where':_0x29a0c0[_0xf8b2('0x19')]?_0x29a0c0[_0xf8b2('0x19')]['where']||null:null,'attributes':_0x29a0c0[_0xf8b2('0x19')]?_0x29a0c0[_0xf8b2('0x19')]['attributes']||null:null,'include':_0x29a0c0[_0xf8b2('0x19')]?_0x29a0c0[_0xf8b2('0x19')]['include']?_[_0xf8b2('0x1f')](_0x29a0c0['options'][_0xf8b2('0x1e')],function(_0x5b359f){return{'model':db[_0x5b359f[_0xf8b2('0x23')]],'as':_0x5b359f['as'],'attributes':_0x5b359f['attributes'],'include':_0x5b359f[_0xf8b2('0x1e')]?_[_0xf8b2('0x1f')](_0x5b359f['include'],function(_0x1231d3){return{'model':db[_0x1231d3[_0xf8b2('0x23')]],'as':_0x1231d3['as'],'attributes':_0x1231d3['attributes'],'include':_0x1231d3[_0xf8b2('0x1e')]?_[_0xf8b2('0x1f')](_0x1231d3[_0xf8b2('0x1e')],function(_0x1f365c){return{'model':db[_0x1f365c[_0xf8b2('0x23')]],'as':_0x1f365c['as'],'attributes':_0x1f365c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x20d1a3){logger[_0xf8b2('0xe')](_0xf8b2('0x22'),_0x29a0c0);logger[_0xf8b2('0x20')](_0xf8b2('0x22'),_0x29a0c0,JSON[_0xf8b2('0x11')](_0x20d1a3));_0x21a859(_0x20d1a3);})[_0xf8b2('0x17')](function(_0x5e130a){logger[_0xf8b2('0x12')]('ShowVtigerAccount',_0x5e130a[_0xf8b2('0x14')],_0x29a0c0);_0x2bf16c(_0x29b126[_0xf8b2('0x12')](0x1f4,_0x5e130a['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 395b55a..cfedebc 100644 --- a/server/api/intVtigerConfiguration/index.js +++ b/server/api/intVtigerConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x4be40d,_0x218327){var _0x55c59a=function(_0x5e1863){while(--_0x5e1863){_0x4be40d['push'](_0x4be40d['shift']());}};_0x55c59a(++_0x218327);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0xb10b[_0x5e6ea3];return _0x4048b5;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file +var _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getDescriptions','post','create'];(function(_0x22bc93,_0x310d7b){var _0x5bfa52=function(_0x365a1d){while(--_0x365a1d){_0x22bc93['push'](_0x22bc93['shift']());}};_0x5bfa52(++_0x310d7b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x109d36,_0x2eef0c){_0x109d36=_0x109d36-0x0;var _0x5dc4d5=_0x5f2f[_0x109d36];return _0x5dc4d5;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['getFields']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getSubjects']);router[_0xf5f2('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0xf')]('/',auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router[_0xf5f2('0x11')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index c1ad066..a7f73d1 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 _0x61cb=['sequelize','exports','STRING'];(function(_0xc0638b,_0x2fccf4){var _0xd57dfa=function(_0x322fba){while(--_0x322fba){_0xc0638b['push'](_0xc0638b['shift']());}};_0xd57dfa(++_0x2fccf4);}(_0x61cb,0x120));var _0xb61c=function(_0xc1a4cf,_0x17141b){_0xc1a4cf=_0xc1a4cf-0x0;var _0x2930d1=_0x61cb[_0xc1a4cf];return _0x2930d1;};'use strict';var Sequelize=require(_0xb61c('0x0'));module[_0xb61c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb61c('0x2')]}}; \ No newline at end of file +var _0x4cd6=['STRING','sequelize','exports'];(function(_0x4bfedd,_0xddfbf8){var _0x2e925c=function(_0x3937da){while(--_0x3937da){_0x4bfedd['push'](_0x4bfedd['shift']());}};_0x2e925c(++_0xddfbf8);}(_0x4cd6,0x67));var _0x64cd=function(_0x32d4b6,_0x461033){_0x32d4b6=_0x32d4b6-0x0;var _0x39139f=_0x4cd6[_0x32d4b6];return _0x39139f;};'use strict';var Sequelize=require(_0x64cd('0x0'));module[_0x64cd('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x64cd('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 91ad225..d32e404 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 _0x75c5=['find','create','body','findOne','VtigerField','filter','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../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','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','end','name','send','index','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','VtigerConfiguration','findAll','rows','params','keys','rawAttributes'];(function(_0x37c219,_0x16d29c){var _0x52b594=function(_0x5d64eb){while(--_0x5d64eb){_0x37c219['push'](_0x37c219['shift']());}};_0x52b594(++_0x16d29c);}(_0x75c5,0x171));var _0x575c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75c5[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x575c('0x0'));var rimraf=require(_0x575c('0x1'));var zipdir=require(_0x575c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x575c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x575c('0x4'));var util=require(_0x575c('0x5'));var path=require(_0x575c('0x6'));var sox=require(_0x575c('0x7'));var csv=require(_0x575c('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x575c('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x575c('0xa'));var deskjs=require(_0x575c('0xb'));var toCsv=require('to-csv');var querystring=require(_0x575c('0xc'));var Papa=require(_0x575c('0xd'));var Redis=require(_0x575c('0xe'));var authService=require(_0x575c('0xf'));var qs=require(_0x575c('0x10'));var as=require(_0x575c('0x11'));var hardwareService=require(_0x575c('0x12'));var logger=require('../../config/logger')(_0x575c('0x13'));var utils=require(_0x575c('0x14'));var config=require('../../config/environment');var db=require(_0x575c('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x575c('0x16')][_0x575c('0x17')]({'port':0x232a});function checkPasswordPattern(_0x41f0c3,_0x38fd15,_0xb1e666){if(_0xb1e666){var _0x56c9e3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x56c9e3[_0x575c('0x18')](_0x38fd15)){return _0x41f0c3;}else{throw new db[(_0x575c('0x19'))]['ValidationError'](_0x575c('0x1a'));}}else{return _0x41f0c3;}}function respondWithRpcPromise(_0x1e5979,_0x50ee6d,_0x3100da,_0xa797af){return new BPromise(function(_0x5bfcc4,_0x561d1d){var _0x10cbad=_0xa797af||client;return _0x10cbad[_0x575c('0x1b')](_0x1e5979,_0x3100da)['then'](function(_0x41d2d8){logger['info'](_0x575c('0x1c'),_0x50ee6d,_0x575c('0x1d'));logger[_0x575c('0x1e')](_0x575c('0x1f'),_0x50ee6d,_0x575c('0x1d'),JSON['stringify'](_0x41d2d8));if(_0x41d2d8['error']){if(_0x41d2d8['error'][_0x575c('0x20')]===0x1f4){logger[_0x575c('0x21')](_0x575c('0x1c'),_0x50ee6d,_0x41d2d8[_0x575c('0x21')][_0x575c('0x22')]);return _0x561d1d(_0x41d2d8[_0x575c('0x21')][_0x575c('0x22')]);}logger[_0x575c('0x21')](_0x575c('0x1c'),_0x50ee6d,_0x41d2d8['error'][_0x575c('0x22')]);return _0x5bfcc4(_0x41d2d8['error'][_0x575c('0x22')]);}else{logger[_0x575c('0x23')](_0x575c('0x1c'),_0x50ee6d,_0x575c('0x1d'));_0x5bfcc4(_0x41d2d8[_0x575c('0x24')][_0x575c('0x22')]);}})[_0x575c('0x25')](function(_0x5e6d65){logger[_0x575c('0x21')](_0x575c('0x1c'),_0x50ee6d,_0x5e6d65);_0x561d1d(_0x5e6d65);});});}function respondWithStatusCode(_0x3c8ca8,_0x54fed6){_0x54fed6=_0x54fed6||0xcc;return function(_0x3974ef){if(_0x3974ef){return _0x3c8ca8[_0x575c('0x26')](_0x54fed6);}return _0x3c8ca8[_0x575c('0x27')](_0x54fed6)['end']();};}function respondWithResult(_0x436fad,_0x315faf){_0x315faf=_0x315faf||0xc8;return function(_0x5bdf14){if(_0x5bdf14){return _0x436fad[_0x575c('0x27')](_0x315faf)[_0x575c('0x28')](_0x5bdf14);}};}function respondWithFilteredResult(_0x2fc076,_0x2bda76){return function(_0x17ef0b){if(_0x17ef0b){var _0x10d826=_0x17ef0b[_0x575c('0x29')],_0x3ca7fa=_0x2bda76[_0x575c('0x2a')],_0x1f259a=_0x2bda76['offset']+_0x2bda76[_0x575c('0x2b')],_0x12d587;if(_0x1f259a>=_0x10d826){_0x1f259a=_0x10d826;_0x12d587=0xc8;}else{_0x12d587=0xce;}_0x2fc076['status'](_0x12d587);return _0x2fc076['set'](_0x575c('0x2c'),_0x3ca7fa+'-'+_0x1f259a+'/'+_0x10d826)[_0x575c('0x28')](_0x17ef0b);}return null;};}function patchUpdates(_0xb23023){return function(_0x566c50){try{jsonpatch[_0x575c('0x2d')](_0x566c50,_0xb23023,!![]);}catch(_0x255821){return BPromise[_0x575c('0x2e')](_0x255821);}return _0x566c50['save']();};}function saveUpdates(_0x9998c5,_0x3e4894){return function(_0x501c8d){if(_0x501c8d){return _0x501c8d[_0x575c('0x2f')](_0x9998c5)[_0x575c('0x30')](function(_0x340d7c){return _0x340d7c;});}return null;};}function removeEntity(_0x373dce,_0x314557){return function(_0x5e01d0){if(_0x5e01d0){return _0x5e01d0[_0x575c('0x31')]()[_0x575c('0x30')](function(){_0x373dce[_0x575c('0x27')](0xcc)[_0x575c('0x32')]();});}};}function handleEntityNotFound(_0x47448d,_0x971a40){return function(_0x3abbee){if(!_0x3abbee){_0x47448d['sendStatus'](0x194);}return _0x3abbee;};}function handleError(_0x3a15b0,_0x4e7ca0){_0x4e7ca0=_0x4e7ca0||0x1f4;return function(_0x21f949){logger[_0x575c('0x21')](_0x21f949['stack']);if(_0x21f949[_0x575c('0x33')]){delete _0x21f949[_0x575c('0x33')];}_0x3a15b0[_0x575c('0x27')](_0x4e7ca0)[_0x575c('0x34')](_0x21f949);};}exports[_0x575c('0x35')]=function(_0x151d90,_0xc7358b){var _0x10fbed={},_0x429c03={},_0x3a8059={'count':0x0,'rows':[]};var _0x31e2e7=_['map'](db['VtigerConfiguration']['rawAttributes'],function(_0x1dc637){return{'name':_0x1dc637[_0x575c('0x36')],'type':_0x1dc637[_0x575c('0x37')][_0x575c('0x38')]};});_0x429c03[_0x575c('0x39')]=_[_0x575c('0x3a')](_0x31e2e7,'name');_0x429c03[_0x575c('0x3b')]=_['keys'](_0x151d90['query']);_0x429c03[_0x575c('0x3c')]=_[_0x575c('0x3d')](_0x429c03['model'],_0x429c03[_0x575c('0x3b')]);_0x10fbed['attributes']=_['intersection'](_0x429c03[_0x575c('0x39')],qs[_0x575c('0x3e')](_0x151d90[_0x575c('0x3b')][_0x575c('0x3e')]));_0x10fbed[_0x575c('0x3f')]=_0x10fbed[_0x575c('0x3f')][_0x575c('0x40')]?_0x10fbed['attributes']:_0x429c03[_0x575c('0x39')];if(!_0x151d90[_0x575c('0x3b')][_0x575c('0x41')](_0x575c('0x42'))){_0x10fbed[_0x575c('0x2b')]=qs[_0x575c('0x2b')](_0x151d90[_0x575c('0x3b')][_0x575c('0x2b')]);_0x10fbed[_0x575c('0x2a')]=qs[_0x575c('0x2a')](_0x151d90['query'][_0x575c('0x2a')]);}_0x10fbed[_0x575c('0x43')]=qs[_0x575c('0x44')](_0x151d90[_0x575c('0x3b')][_0x575c('0x44')]);_0x10fbed[_0x575c('0x45')]=qs[_0x575c('0x3c')](_[_0x575c('0x46')](_0x151d90['query'],_0x429c03[_0x575c('0x3c')]));if(_0x151d90[_0x575c('0x3b')]['filter']){_0x10fbed[_0x575c('0x45')]=_[_0x575c('0x47')](_0x10fbed[_0x575c('0x45')],{'$or':_['map'](_0x31e2e7,function(_0x3c5036){if(_0x3c5036['type']!=='VIRTUAL'){var _0xac1738={};_0xac1738[_0x3c5036[_0x575c('0x33')]]={'$like':'%'+_0x151d90[_0x575c('0x3b')]['filter']+'%'};return _0xac1738;}})});}_0x10fbed=_[_0x575c('0x47')]({},_0x10fbed,_0x151d90[_0x575c('0x48')]);var _0x59f42e={'where':_0x10fbed['where']};return db['VtigerConfiguration'][_0x575c('0x29')](_0x59f42e)[_0x575c('0x30')](function(_0x5a1efc){_0x3a8059[_0x575c('0x29')]=_0x5a1efc;if(_0x151d90[_0x575c('0x3b')][_0x575c('0x49')]){_0x10fbed[_0x575c('0x4a')]=[{'all':!![]}];}return db[_0x575c('0x4b')][_0x575c('0x4c')](_0x10fbed);})[_0x575c('0x30')](function(_0x114bc3){_0x3a8059[_0x575c('0x4d')]=_0x114bc3;return _0x3a8059;})['then'](respondWithFilteredResult(_0xc7358b,_0x10fbed))[_0x575c('0x25')](handleError(_0xc7358b,null));};exports['show']=function(_0x3add40,_0x2e475a){var _0x4c0b84={'raw':![],'where':{'id':_0x3add40[_0x575c('0x4e')]['id']}},_0x326281={};_0x326281[_0x575c('0x39')]=_[_0x575c('0x4f')](db['VtigerConfiguration'][_0x575c('0x50')]);_0x326281['query']=_['keys'](_0x3add40[_0x575c('0x3b')]);_0x326281['filters']=_[_0x575c('0x3d')](_0x326281['model'],_0x326281[_0x575c('0x3b')]);_0x4c0b84['attributes']=_[_0x575c('0x3d')](_0x326281[_0x575c('0x39')],qs['fields'](_0x3add40[_0x575c('0x3b')]['fields']));_0x4c0b84['attributes']=_0x4c0b84[_0x575c('0x3f')][_0x575c('0x40')]?_0x4c0b84[_0x575c('0x3f')]:_0x326281[_0x575c('0x39')];if(_0x3add40[_0x575c('0x3b')][_0x575c('0x49')]){_0x4c0b84[_0x575c('0x4a')]=[{'all':!![]}];}_0x4c0b84=_[_0x575c('0x47')]({},_0x4c0b84,_0x3add40[_0x575c('0x48')]);return db[_0x575c('0x4b')][_0x575c('0x51')](_0x4c0b84)[_0x575c('0x30')](handleEntityNotFound(_0x2e475a,null))[_0x575c('0x30')](respondWithResult(_0x2e475a,null))[_0x575c('0x25')](handleError(_0x2e475a,null));};exports[_0x575c('0x52')]=function(_0x101d3e,_0x543d79){return db[_0x575c('0x4b')][_0x575c('0x52')](_0x101d3e['body'],{})[_0x575c('0x30')](respondWithResult(_0x543d79,0xc9))['catch'](handleError(_0x543d79,null));};exports['update']=function(_0x5554af,_0x551da4){if(_0x5554af['body']['id']){delete _0x5554af[_0x575c('0x53')]['id'];}return db[_0x575c('0x4b')][_0x575c('0x51')]({'where':{'id':_0x5554af['params']['id']}})[_0x575c('0x30')](handleEntityNotFound(_0x551da4,null))[_0x575c('0x30')](saveUpdates(_0x5554af[_0x575c('0x53')],null))[_0x575c('0x30')](respondWithResult(_0x551da4,null))[_0x575c('0x25')](handleError(_0x551da4,null));};exports['destroy']=function(_0x2a938f,_0x5eeaf3){return db[_0x575c('0x4b')]['find']({'where':{'id':_0x2a938f[_0x575c('0x4e')]['id']}})[_0x575c('0x30')](handleEntityNotFound(_0x5eeaf3,null))[_0x575c('0x30')](removeEntity(_0x5eeaf3,null))['catch'](handleError(_0x5eeaf3,null));};exports['getFields']=function(_0x1b5e18,_0x4ae0c5,_0x2176fe){var _0x11e0b1={};var _0x2612a0={};var _0xf2fe8;var _0x3a3339;return db[_0x575c('0x4b')][_0x575c('0x54')]({'where':{'id':_0x1b5e18['params']['id']}})['then'](handleEntityNotFound(_0x4ae0c5,null))[_0x575c('0x30')](function(_0x349db2){if(_0x349db2){_0xf2fe8=_0x349db2;_0x2612a0[_0x575c('0x39')]=_[_0x575c('0x4f')](db[_0x575c('0x55')]['rawAttributes']);_0x2612a0[_0x575c('0x3b')]=_[_0x575c('0x4f')](_0x1b5e18['query']);_0x2612a0['filters']=_[_0x575c('0x3d')](_0x2612a0[_0x575c('0x39')],_0x2612a0[_0x575c('0x3b')]);_0x11e0b1[_0x575c('0x3f')]=_[_0x575c('0x3d')](_0x2612a0[_0x575c('0x39')],qs['fields'](_0x1b5e18[_0x575c('0x3b')][_0x575c('0x3e')]));_0x11e0b1[_0x575c('0x3f')]=_0x11e0b1[_0x575c('0x3f')][_0x575c('0x40')]?_0x11e0b1[_0x575c('0x3f')]:_0x2612a0[_0x575c('0x39')];_0x11e0b1[_0x575c('0x43')]=qs[_0x575c('0x44')](_0x1b5e18['query'][_0x575c('0x44')]);_0x11e0b1[_0x575c('0x45')]=qs['filters'](_[_0x575c('0x46')](_0x1b5e18['query'],_0x2612a0[_0x575c('0x3c')]));if(_0x1b5e18[_0x575c('0x3b')][_0x575c('0x56')]){_0x11e0b1[_0x575c('0x45')]=_['merge'](_0x11e0b1['where'],{'$or':_[_0x575c('0x3a')](_0x11e0b1[_0x575c('0x3f')],function(_0x575e8e){var _0x103061={};_0x103061[_0x575e8e]={'$like':'%'+_0x1b5e18['query'][_0x575c('0x56')]+'%'};return _0x103061;})});}_0x11e0b1=_[_0x575c('0x47')]({},_0x11e0b1,_0x1b5e18[_0x575c('0x48')]);return _0xf2fe8[_0x575c('0x57')](_0x11e0b1);}})[_0x575c('0x30')](function(_0x123e4c){if(_0x123e4c){_0x3a3339=_0x123e4c[_0x575c('0x40')];if(!_0x1b5e18['query']['hasOwnProperty'](_0x575c('0x42'))){_0x11e0b1[_0x575c('0x2b')]=qs[_0x575c('0x2b')](_0x1b5e18[_0x575c('0x3b')]['limit']);_0x11e0b1[_0x575c('0x2a')]=qs[_0x575c('0x2a')](_0x1b5e18[_0x575c('0x3b')][_0x575c('0x2a')]);}return _0xf2fe8[_0x575c('0x57')](_0x11e0b1);}})[_0x575c('0x30')](function(_0x4da549){if(_0x4da549){return _0x4da549?{'count':_0x3a3339,'rows':_0x4da549}:null;}})[_0x575c('0x30')](respondWithResult(_0x4ae0c5,null))[_0x575c('0x25')](handleError(_0x4ae0c5,null));};exports[_0x575c('0x58')]=function(_0xf8e59d,_0x50477d,_0x1d746c){var _0x26ab7e={};var _0x48e3dd={};var _0x1d7a58;var _0x8149c7;return db[_0x575c('0x4b')][_0x575c('0x54')]({'where':{'id':_0xf8e59d['params']['id']}})[_0x575c('0x30')](handleEntityNotFound(_0x50477d,null))[_0x575c('0x30')](function(_0x136ecf){if(_0x136ecf){_0x1d7a58=_0x136ecf;_0x48e3dd[_0x575c('0x39')]=_[_0x575c('0x4f')](db['VtigerField']['rawAttributes']);_0x48e3dd[_0x575c('0x3b')]=_[_0x575c('0x4f')](_0xf8e59d[_0x575c('0x3b')]);_0x48e3dd['filters']=_[_0x575c('0x3d')](_0x48e3dd[_0x575c('0x39')],_0x48e3dd[_0x575c('0x3b')]);_0x26ab7e[_0x575c('0x3f')]=_[_0x575c('0x3d')](_0x48e3dd[_0x575c('0x39')],qs[_0x575c('0x3e')](_0xf8e59d[_0x575c('0x3b')][_0x575c('0x3e')]));_0x26ab7e[_0x575c('0x3f')]=_0x26ab7e[_0x575c('0x3f')][_0x575c('0x40')]?_0x26ab7e[_0x575c('0x3f')]:_0x48e3dd[_0x575c('0x39')];_0x26ab7e['order']=qs[_0x575c('0x44')](_0xf8e59d['query'][_0x575c('0x44')]);_0x26ab7e[_0x575c('0x45')]=qs[_0x575c('0x3c')](_[_0x575c('0x46')](_0xf8e59d[_0x575c('0x3b')],_0x48e3dd['filters']));if(_0xf8e59d[_0x575c('0x3b')]['filter']){_0x26ab7e[_0x575c('0x45')]=_['merge'](_0x26ab7e[_0x575c('0x45')],{'$or':_[_0x575c('0x3a')](_0x26ab7e[_0x575c('0x3f')],function(_0xe0bec7){var _0x4171e6={};_0x4171e6[_0xe0bec7]={'$like':'%'+_0xf8e59d['query'][_0x575c('0x56')]+'%'};return _0x4171e6;})});}_0x26ab7e=_[_0x575c('0x47')]({},_0x26ab7e,_0xf8e59d[_0x575c('0x48')]);return _0x1d7a58[_0x575c('0x58')](_0x26ab7e);}})[_0x575c('0x30')](function(_0x8029fe){if(_0x8029fe){_0x8149c7=_0x8029fe['length'];if(!_0xf8e59d[_0x575c('0x3b')][_0x575c('0x41')](_0x575c('0x42'))){_0x26ab7e[_0x575c('0x2b')]=qs[_0x575c('0x2b')](_0xf8e59d[_0x575c('0x3b')][_0x575c('0x2b')]);_0x26ab7e[_0x575c('0x2a')]=qs[_0x575c('0x2a')](_0xf8e59d[_0x575c('0x3b')]['offset']);}return _0x1d7a58['getSubjects'](_0x26ab7e);}})[_0x575c('0x30')](function(_0x581af3){if(_0x581af3){return _0x581af3?{'count':_0x8149c7,'rows':_0x581af3}:null;}})[_0x575c('0x30')](respondWithResult(_0x50477d,null))[_0x575c('0x25')](handleError(_0x50477d,null));};exports[_0x575c('0x59')]=function(_0x283146,_0x137176,_0x56e0c0){var _0x266745={};var _0x2ed1c0={};var _0x3a5f04;var _0x1808d0;return db[_0x575c('0x4b')][_0x575c('0x54')]({'where':{'id':_0x283146['params']['id']}})[_0x575c('0x30')](handleEntityNotFound(_0x137176,null))[_0x575c('0x30')](function(_0x42d42f){if(_0x42d42f){_0x3a5f04=_0x42d42f;_0x2ed1c0[_0x575c('0x39')]=_[_0x575c('0x4f')](db[_0x575c('0x55')][_0x575c('0x50')]);_0x2ed1c0[_0x575c('0x3b')]=_[_0x575c('0x4f')](_0x283146[_0x575c('0x3b')]);_0x2ed1c0[_0x575c('0x3c')]=_[_0x575c('0x3d')](_0x2ed1c0[_0x575c('0x39')],_0x2ed1c0[_0x575c('0x3b')]);_0x266745[_0x575c('0x3f')]=_[_0x575c('0x3d')](_0x2ed1c0[_0x575c('0x39')],qs[_0x575c('0x3e')](_0x283146['query'][_0x575c('0x3e')]));_0x266745[_0x575c('0x3f')]=_0x266745[_0x575c('0x3f')]['length']?_0x266745[_0x575c('0x3f')]:_0x2ed1c0[_0x575c('0x39')];_0x266745[_0x575c('0x43')]=qs[_0x575c('0x44')](_0x283146['query'][_0x575c('0x44')]);_0x266745[_0x575c('0x45')]=qs[_0x575c('0x3c')](_[_0x575c('0x46')](_0x283146[_0x575c('0x3b')],_0x2ed1c0[_0x575c('0x3c')]));if(_0x283146[_0x575c('0x3b')][_0x575c('0x56')]){_0x266745[_0x575c('0x45')]=_[_0x575c('0x47')](_0x266745['where'],{'$or':_[_0x575c('0x3a')](_0x266745[_0x575c('0x3f')],function(_0x3f13b7){var _0x4a3f35={};_0x4a3f35[_0x3f13b7]={'$like':'%'+_0x283146[_0x575c('0x3b')][_0x575c('0x56')]+'%'};return _0x4a3f35;})});}_0x266745=_[_0x575c('0x47')]({},_0x266745,_0x283146[_0x575c('0x48')]);return _0x3a5f04['getDescriptions'](_0x266745);}})['then'](function(_0x46aa5d){if(_0x46aa5d){_0x1808d0=_0x46aa5d[_0x575c('0x40')];if(!_0x283146[_0x575c('0x3b')][_0x575c('0x41')](_0x575c('0x42'))){_0x266745[_0x575c('0x2b')]=qs['limit'](_0x283146['query'][_0x575c('0x2b')]);_0x266745['offset']=qs[_0x575c('0x2a')](_0x283146[_0x575c('0x3b')][_0x575c('0x2a')]);}return _0x3a5f04[_0x575c('0x59')](_0x266745);}})[_0x575c('0x30')](function(_0x28fc94){if(_0x28fc94){return _0x28fc94?{'count':_0x1808d0,'rows':_0x28fc94}:null;}})[_0x575c('0x30')](respondWithResult(_0x137176,null))['catch'](handleError(_0x137176,null));}; \ No newline at end of file +var _0x0183=['type','VIRTUAL','merge','options','includeAll','include','rows','find','create','body','params','getFields','findOne','VtigerField','order','sort','pick','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','test','ValidationError','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','set','apply','reject','save','update','destroy','stack','name','send','index','map','VtigerConfiguration','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','where','filter'];(function(_0x52cc40,_0x257b91){var _0x146b44=function(_0x2a9dd4){while(--_0x2a9dd4){_0x52cc40['push'](_0x52cc40['shift']());}};_0x146b44(++_0x257b91);}(_0x0183,0xc7));var _0x3018=function(_0x606051,_0x3f3122){_0x606051=_0x606051-0x0;var _0x12a782=_0x0183[_0x606051];return _0x12a782;};'use strict';var pdf=require(_0x3018('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3018('0x1'));var zipdir=require(_0x3018('0x2'));var jsonpatch=require(_0x3018('0x3'));var rp=require(_0x3018('0x4'));var moment=require(_0x3018('0x5'));var BPromise=require(_0x3018('0x6'));var Mustache=require(_0x3018('0x7'));var util=require(_0x3018('0x8'));var path=require('path');var sox=require(_0x3018('0x9'));var csv=require(_0x3018('0xa'));var ejs=require(_0x3018('0xb'));var fs=require('fs');var _=require(_0x3018('0xc'));var squel=require(_0x3018('0xd'));var crypto=require(_0x3018('0xe'));var jsforce=require(_0x3018('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3018('0x10'));var Papa=require(_0x3018('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3018('0x12'));var as=require(_0x3018('0x13'));var hardwareService=require(_0x3018('0x14'));var logger=require('../../config/logger')(_0x3018('0x15'));var utils=require(_0x3018('0x16'));var config=require(_0x3018('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0xac92b9,_0x1b0dfe,_0x134a58){if(_0x134a58){var _0x6ec1cb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x6ec1cb[_0x3018('0x18')](_0x1b0dfe)){return _0xac92b9;}else{throw new db['Sequelize'][(_0x3018('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 _0xac92b9;}}function respondWithRpcPromise(_0x5a3ee9,_0x1e0754,_0x33a898,_0x135bf0){return new BPromise(function(_0x129650,_0x1741b6){var _0x51cc3c=_0x135bf0||client;return _0x51cc3c[_0x3018('0x1a')](_0x5a3ee9,_0x33a898)[_0x3018('0x1b')](function(_0x35d445){logger[_0x3018('0x1c')](_0x3018('0x1d'),_0x1e0754,_0x3018('0x1e'));logger[_0x3018('0x1f')](_0x3018('0x20'),_0x1e0754,'request\x20sent',JSON[_0x3018('0x21')](_0x35d445));if(_0x35d445[_0x3018('0x22')]){if(_0x35d445[_0x3018('0x22')][_0x3018('0x23')]===0x1f4){logger[_0x3018('0x22')](_0x3018('0x1d'),_0x1e0754,_0x35d445[_0x3018('0x22')][_0x3018('0x24')]);return _0x1741b6(_0x35d445[_0x3018('0x22')][_0x3018('0x24')]);}logger['error'](_0x3018('0x1d'),_0x1e0754,_0x35d445[_0x3018('0x22')][_0x3018('0x24')]);return _0x129650(_0x35d445[_0x3018('0x22')][_0x3018('0x24')]);}else{logger[_0x3018('0x1c')]('VtigerConfiguration,\x20%s,\x20%s',_0x1e0754,_0x3018('0x1e'));_0x129650(_0x35d445[_0x3018('0x25')][_0x3018('0x24')]);}})[_0x3018('0x26')](function(_0x5b41a4){logger[_0x3018('0x22')]('VtigerConfiguration,\x20%s,\x20%s',_0x1e0754,_0x5b41a4);_0x1741b6(_0x5b41a4);});});}function respondWithStatusCode(_0x3ffdb4,_0x17eb8a){_0x17eb8a=_0x17eb8a||0xcc;return function(_0x5de2d5){if(_0x5de2d5){return _0x3ffdb4[_0x3018('0x27')](_0x17eb8a);}return _0x3ffdb4[_0x3018('0x28')](_0x17eb8a)[_0x3018('0x29')]();};}function respondWithResult(_0x38a0f0,_0x389afc){_0x389afc=_0x389afc||0xc8;return function(_0x37e5ca){if(_0x37e5ca){return _0x38a0f0['status'](_0x389afc)['json'](_0x37e5ca);}};}function respondWithFilteredResult(_0x5f20b9,_0x1af2db){return function(_0x5f3d2f){if(_0x5f3d2f){var _0x1e1af3=_0x5f3d2f[_0x3018('0x2a')],_0x2cbca4=_0x1af2db[_0x3018('0x2b')],_0x40aa48=_0x1af2db[_0x3018('0x2b')]+_0x1af2db['limit'],_0x2ae8ab;if(_0x40aa48>=_0x1e1af3){_0x40aa48=_0x1e1af3;_0x2ae8ab=0xc8;}else{_0x2ae8ab=0xce;}_0x5f20b9[_0x3018('0x28')](_0x2ae8ab);return _0x5f20b9[_0x3018('0x2c')]('Content-Range',_0x2cbca4+'-'+_0x40aa48+'/'+_0x1e1af3)['json'](_0x5f3d2f);}return null;};}function patchUpdates(_0x5cb4bc){return function(_0x2157cd){try{jsonpatch[_0x3018('0x2d')](_0x2157cd,_0x5cb4bc,!![]);}catch(_0x398184){return BPromise[_0x3018('0x2e')](_0x398184);}return _0x2157cd[_0x3018('0x2f')]();};}function saveUpdates(_0x14bad0,_0x182e14){return function(_0x5c2e09){if(_0x5c2e09){return _0x5c2e09[_0x3018('0x30')](_0x14bad0)['then'](function(_0x11c936){return _0x11c936;});}return null;};}function removeEntity(_0x9ca3c4,_0x4cece3){return function(_0x289b97){if(_0x289b97){return _0x289b97[_0x3018('0x31')]()[_0x3018('0x1b')](function(){_0x9ca3c4[_0x3018('0x28')](0xcc)[_0x3018('0x29')]();});}};}function handleEntityNotFound(_0x2f184b,_0x5a1915){return function(_0x20414a){if(!_0x20414a){_0x2f184b[_0x3018('0x27')](0x194);}return _0x20414a;};}function handleError(_0x358bac,_0x28d995){_0x28d995=_0x28d995||0x1f4;return function(_0xe5083a){logger[_0x3018('0x22')](_0xe5083a[_0x3018('0x32')]);if(_0xe5083a[_0x3018('0x33')]){delete _0xe5083a['name'];}_0x358bac[_0x3018('0x28')](_0x28d995)[_0x3018('0x34')](_0xe5083a);};}exports[_0x3018('0x35')]=function(_0xcc8777,_0x5107db){var _0x1f504b={},_0xec5795={},_0xd9ecd0={'count':0x0,'rows':[]};var _0x809dba=_[_0x3018('0x36')](db[_0x3018('0x37')][_0x3018('0x38')],function(_0x2f2174){return{'name':_0x2f2174['fieldName'],'type':_0x2f2174['type'][_0x3018('0x39')]};});_0xec5795['model']=_['map'](_0x809dba,_0x3018('0x33'));_0xec5795[_0x3018('0x3a')]=_[_0x3018('0x3b')](_0xcc8777[_0x3018('0x3a')]);_0xec5795[_0x3018('0x3c')]=_[_0x3018('0x3d')](_0xec5795[_0x3018('0x3e')],_0xec5795[_0x3018('0x3a')]);_0x1f504b['attributes']=_[_0x3018('0x3d')](_0xec5795[_0x3018('0x3e')],qs['fields'](_0xcc8777['query'][_0x3018('0x3f')]));_0x1f504b['attributes']=_0x1f504b[_0x3018('0x40')][_0x3018('0x41')]?_0x1f504b[_0x3018('0x40')]:_0xec5795[_0x3018('0x3e')];if(!_0xcc8777['query'][_0x3018('0x42')](_0x3018('0x43'))){_0x1f504b[_0x3018('0x44')]=qs[_0x3018('0x44')](_0xcc8777[_0x3018('0x3a')][_0x3018('0x44')]);_0x1f504b[_0x3018('0x2b')]=qs[_0x3018('0x2b')](_0xcc8777['query']['offset']);}_0x1f504b['order']=qs['sort'](_0xcc8777[_0x3018('0x3a')]['sort']);_0x1f504b[_0x3018('0x45')]=qs[_0x3018('0x3c')](_['pick'](_0xcc8777['query'],_0xec5795[_0x3018('0x3c')]));if(_0xcc8777[_0x3018('0x3a')][_0x3018('0x46')]){_0x1f504b[_0x3018('0x45')]=_['merge'](_0x1f504b[_0x3018('0x45')],{'$or':_['map'](_0x809dba,function(_0x34e409){if(_0x34e409[_0x3018('0x47')]!==_0x3018('0x48')){var _0x40cc87={};_0x40cc87[_0x34e409[_0x3018('0x33')]]={'$like':'%'+_0xcc8777[_0x3018('0x3a')]['filter']+'%'};return _0x40cc87;}})});}_0x1f504b=_[_0x3018('0x49')]({},_0x1f504b,_0xcc8777[_0x3018('0x4a')]);var _0x173a50={'where':_0x1f504b[_0x3018('0x45')]};return db[_0x3018('0x37')][_0x3018('0x2a')](_0x173a50)['then'](function(_0x4cf03c){_0xd9ecd0[_0x3018('0x2a')]=_0x4cf03c;if(_0xcc8777[_0x3018('0x3a')][_0x3018('0x4b')]){_0x1f504b[_0x3018('0x4c')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x1f504b);})[_0x3018('0x1b')](function(_0x3adbd5){_0xd9ecd0[_0x3018('0x4d')]=_0x3adbd5;return _0xd9ecd0;})[_0x3018('0x1b')](respondWithFilteredResult(_0x5107db,_0x1f504b))[_0x3018('0x26')](handleError(_0x5107db,null));};exports['show']=function(_0x50ecf5,_0x436540){var _0x2171ff={'raw':![],'where':{'id':_0x50ecf5['params']['id']}},_0x12f4a4={};_0x12f4a4[_0x3018('0x3e')]=_[_0x3018('0x3b')](db[_0x3018('0x37')][_0x3018('0x38')]);_0x12f4a4[_0x3018('0x3a')]=_[_0x3018('0x3b')](_0x50ecf5[_0x3018('0x3a')]);_0x12f4a4[_0x3018('0x3c')]=_[_0x3018('0x3d')](_0x12f4a4[_0x3018('0x3e')],_0x12f4a4[_0x3018('0x3a')]);_0x2171ff['attributes']=_[_0x3018('0x3d')](_0x12f4a4[_0x3018('0x3e')],qs[_0x3018('0x3f')](_0x50ecf5[_0x3018('0x3a')][_0x3018('0x3f')]));_0x2171ff['attributes']=_0x2171ff[_0x3018('0x40')][_0x3018('0x41')]?_0x2171ff[_0x3018('0x40')]:_0x12f4a4['model'];if(_0x50ecf5[_0x3018('0x3a')][_0x3018('0x4b')]){_0x2171ff[_0x3018('0x4c')]=[{'all':!![]}];}_0x2171ff=_[_0x3018('0x49')]({},_0x2171ff,_0x50ecf5[_0x3018('0x4a')]);return db[_0x3018('0x37')][_0x3018('0x4e')](_0x2171ff)[_0x3018('0x1b')](handleEntityNotFound(_0x436540,null))[_0x3018('0x1b')](respondWithResult(_0x436540,null))['catch'](handleError(_0x436540,null));};exports['create']=function(_0x1379d9,_0x33a27f){return db['VtigerConfiguration'][_0x3018('0x4f')](_0x1379d9[_0x3018('0x50')],{})[_0x3018('0x1b')](respondWithResult(_0x33a27f,0xc9))['catch'](handleError(_0x33a27f,null));};exports[_0x3018('0x30')]=function(_0x25eba9,_0xbffdee){if(_0x25eba9[_0x3018('0x50')]['id']){delete _0x25eba9['body']['id'];}return db[_0x3018('0x37')]['find']({'where':{'id':_0x25eba9[_0x3018('0x51')]['id']}})[_0x3018('0x1b')](handleEntityNotFound(_0xbffdee,null))[_0x3018('0x1b')](saveUpdates(_0x25eba9[_0x3018('0x50')],null))[_0x3018('0x1b')](respondWithResult(_0xbffdee,null))[_0x3018('0x26')](handleError(_0xbffdee,null));};exports[_0x3018('0x31')]=function(_0x5b8956,_0x366761){return db[_0x3018('0x37')]['find']({'where':{'id':_0x5b8956['params']['id']}})['then'](handleEntityNotFound(_0x366761,null))[_0x3018('0x1b')](removeEntity(_0x366761,null))[_0x3018('0x26')](handleError(_0x366761,null));};exports[_0x3018('0x52')]=function(_0x3c172e,_0xb601d0,_0x240266){var _0x4b17ac={};var _0x35c681={};var _0x2a458c;var _0x117eee;return db[_0x3018('0x37')][_0x3018('0x53')]({'where':{'id':_0x3c172e['params']['id']}})[_0x3018('0x1b')](handleEntityNotFound(_0xb601d0,null))[_0x3018('0x1b')](function(_0x1187f0){if(_0x1187f0){_0x2a458c=_0x1187f0;_0x35c681[_0x3018('0x3e')]=_['keys'](db[_0x3018('0x54')]['rawAttributes']);_0x35c681[_0x3018('0x3a')]=_[_0x3018('0x3b')](_0x3c172e['query']);_0x35c681['filters']=_['intersection'](_0x35c681[_0x3018('0x3e')],_0x35c681['query']);_0x4b17ac[_0x3018('0x40')]=_['intersection'](_0x35c681[_0x3018('0x3e')],qs['fields'](_0x3c172e[_0x3018('0x3a')][_0x3018('0x3f')]));_0x4b17ac[_0x3018('0x40')]=_0x4b17ac[_0x3018('0x40')]['length']?_0x4b17ac[_0x3018('0x40')]:_0x35c681[_0x3018('0x3e')];_0x4b17ac[_0x3018('0x55')]=qs[_0x3018('0x56')](_0x3c172e['query'][_0x3018('0x56')]);_0x4b17ac[_0x3018('0x45')]=qs[_0x3018('0x3c')](_[_0x3018('0x57')](_0x3c172e[_0x3018('0x3a')],_0x35c681[_0x3018('0x3c')]));if(_0x3c172e[_0x3018('0x3a')]['filter']){_0x4b17ac[_0x3018('0x45')]=_[_0x3018('0x49')](_0x4b17ac[_0x3018('0x45')],{'$or':_[_0x3018('0x36')](_0x4b17ac['attributes'],function(_0x28a774){var _0x2150fb={};_0x2150fb[_0x28a774]={'$like':'%'+_0x3c172e[_0x3018('0x3a')][_0x3018('0x46')]+'%'};return _0x2150fb;})});}_0x4b17ac=_[_0x3018('0x49')]({},_0x4b17ac,_0x3c172e[_0x3018('0x4a')]);return _0x2a458c[_0x3018('0x52')](_0x4b17ac);}})[_0x3018('0x1b')](function(_0x5c4bba){if(_0x5c4bba){_0x117eee=_0x5c4bba[_0x3018('0x41')];if(!_0x3c172e[_0x3018('0x3a')][_0x3018('0x42')](_0x3018('0x43'))){_0x4b17ac[_0x3018('0x44')]=qs[_0x3018('0x44')](_0x3c172e[_0x3018('0x3a')][_0x3018('0x44')]);_0x4b17ac[_0x3018('0x2b')]=qs[_0x3018('0x2b')](_0x3c172e[_0x3018('0x3a')]['offset']);}return _0x2a458c[_0x3018('0x52')](_0x4b17ac);}})[_0x3018('0x1b')](function(_0x4ae698){if(_0x4ae698){return _0x4ae698?{'count':_0x117eee,'rows':_0x4ae698}:null;}})[_0x3018('0x1b')](respondWithResult(_0xb601d0,null))['catch'](handleError(_0xb601d0,null));};exports[_0x3018('0x58')]=function(_0x2f4bf4,_0x193541,_0x16e5e3){var _0x1203e6={};var _0xc2b621={};var _0x170f7e;var _0x4be87a;return db[_0x3018('0x37')][_0x3018('0x53')]({'where':{'id':_0x2f4bf4[_0x3018('0x51')]['id']}})[_0x3018('0x1b')](handleEntityNotFound(_0x193541,null))[_0x3018('0x1b')](function(_0x931f67){if(_0x931f67){_0x170f7e=_0x931f67;_0xc2b621[_0x3018('0x3e')]=_[_0x3018('0x3b')](db[_0x3018('0x54')]['rawAttributes']);_0xc2b621[_0x3018('0x3a')]=_['keys'](_0x2f4bf4[_0x3018('0x3a')]);_0xc2b621[_0x3018('0x3c')]=_['intersection'](_0xc2b621[_0x3018('0x3e')],_0xc2b621['query']);_0x1203e6[_0x3018('0x40')]=_[_0x3018('0x3d')](_0xc2b621[_0x3018('0x3e')],qs['fields'](_0x2f4bf4[_0x3018('0x3a')]['fields']));_0x1203e6['attributes']=_0x1203e6[_0x3018('0x40')]['length']?_0x1203e6[_0x3018('0x40')]:_0xc2b621['model'];_0x1203e6[_0x3018('0x55')]=qs[_0x3018('0x56')](_0x2f4bf4['query']['sort']);_0x1203e6[_0x3018('0x45')]=qs[_0x3018('0x3c')](_['pick'](_0x2f4bf4[_0x3018('0x3a')],_0xc2b621[_0x3018('0x3c')]));if(_0x2f4bf4['query'][_0x3018('0x46')]){_0x1203e6[_0x3018('0x45')]=_[_0x3018('0x49')](_0x1203e6['where'],{'$or':_[_0x3018('0x36')](_0x1203e6[_0x3018('0x40')],function(_0x25b0a2){var _0x3b4578={};_0x3b4578[_0x25b0a2]={'$like':'%'+_0x2f4bf4[_0x3018('0x3a')][_0x3018('0x46')]+'%'};return _0x3b4578;})});}_0x1203e6=_[_0x3018('0x49')]({},_0x1203e6,_0x2f4bf4['options']);return _0x170f7e[_0x3018('0x58')](_0x1203e6);}})['then'](function(_0x3d52e6){if(_0x3d52e6){_0x4be87a=_0x3d52e6[_0x3018('0x41')];if(!_0x2f4bf4[_0x3018('0x3a')][_0x3018('0x42')](_0x3018('0x43'))){_0x1203e6['limit']=qs[_0x3018('0x44')](_0x2f4bf4[_0x3018('0x3a')][_0x3018('0x44')]);_0x1203e6[_0x3018('0x2b')]=qs[_0x3018('0x2b')](_0x2f4bf4[_0x3018('0x3a')][_0x3018('0x2b')]);}return _0x170f7e['getSubjects'](_0x1203e6);}})[_0x3018('0x1b')](function(_0x5a69eb){if(_0x5a69eb){return _0x5a69eb?{'count':_0x4be87a,'rows':_0x5a69eb}:null;}})[_0x3018('0x1b')](respondWithResult(_0x193541,null))[_0x3018('0x26')](handleError(_0x193541,null));};exports['getDescriptions']=function(_0x196ae6,_0x321175,_0x1682cb){var _0x4792a7={};var _0x2e989f={};var _0x2d17a1;var _0x106991;return db[_0x3018('0x37')]['findOne']({'where':{'id':_0x196ae6['params']['id']}})['then'](handleEntityNotFound(_0x321175,null))[_0x3018('0x1b')](function(_0x38b15f){if(_0x38b15f){_0x2d17a1=_0x38b15f;_0x2e989f[_0x3018('0x3e')]=_[_0x3018('0x3b')](db[_0x3018('0x54')][_0x3018('0x38')]);_0x2e989f[_0x3018('0x3a')]=_[_0x3018('0x3b')](_0x196ae6['query']);_0x2e989f[_0x3018('0x3c')]=_[_0x3018('0x3d')](_0x2e989f[_0x3018('0x3e')],_0x2e989f[_0x3018('0x3a')]);_0x4792a7[_0x3018('0x40')]=_[_0x3018('0x3d')](_0x2e989f[_0x3018('0x3e')],qs[_0x3018('0x3f')](_0x196ae6[_0x3018('0x3a')][_0x3018('0x3f')]));_0x4792a7['attributes']=_0x4792a7[_0x3018('0x40')][_0x3018('0x41')]?_0x4792a7[_0x3018('0x40')]:_0x2e989f[_0x3018('0x3e')];_0x4792a7[_0x3018('0x55')]=qs[_0x3018('0x56')](_0x196ae6['query']['sort']);_0x4792a7[_0x3018('0x45')]=qs[_0x3018('0x3c')](_['pick'](_0x196ae6[_0x3018('0x3a')],_0x2e989f['filters']));if(_0x196ae6[_0x3018('0x3a')]['filter']){_0x4792a7['where']=_['merge'](_0x4792a7[_0x3018('0x45')],{'$or':_['map'](_0x4792a7['attributes'],function(_0x2bbfba){var _0x33a3c1={};_0x33a3c1[_0x2bbfba]={'$like':'%'+_0x196ae6[_0x3018('0x3a')]['filter']+'%'};return _0x33a3c1;})});}_0x4792a7=_[_0x3018('0x49')]({},_0x4792a7,_0x196ae6[_0x3018('0x4a')]);return _0x2d17a1['getDescriptions'](_0x4792a7);}})['then'](function(_0x4c7975){if(_0x4c7975){_0x106991=_0x4c7975[_0x3018('0x41')];if(!_0x196ae6[_0x3018('0x3a')][_0x3018('0x42')](_0x3018('0x43'))){_0x4792a7[_0x3018('0x44')]=qs[_0x3018('0x44')](_0x196ae6[_0x3018('0x3a')]['limit']);_0x4792a7['offset']=qs[_0x3018('0x2b')](_0x196ae6[_0x3018('0x3a')]['offset']);}return _0x2d17a1[_0x3018('0x59')](_0x4792a7);}})['then'](function(_0x436638){if(_0x436638){return _0x436638?{'count':_0x106991,'rows':_0x436638}:null;}})[_0x3018('0x1b')](respondWithResult(_0x321175,null))[_0x3018('0x26')](handleError(_0x321175,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 5ab7190..32c9bf3 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 _0x216c=['VtigerConfiguration','int_vtiger_configurations','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x5049aa,_0x40d25a){var _0x33ce68=function(_0x355701){while(--_0x355701){_0x5049aa['push'](_0x5049aa['shift']());}};_0x33ce68(++_0x40d25a);}(_0x216c,0x9c));var _0xc216=function(_0x54991e,_0x4036c7){_0x54991e=_0x54991e-0x0;var _0x2e3651=_0x216c[_0x54991e];return _0x2e3651;};'use strict';var _=require(_0xc216('0x0'));var util=require(_0xc216('0x1'));var logger=require('../../config/logger')(_0xc216('0x2'));var moment=require(_0xc216('0x3'));var BPromise=require(_0xc216('0x4'));var rp=require(_0xc216('0x5'));var fs=require('fs');var path=require(_0xc216('0x6'));var rimraf=require('rimraf');var config=require(_0xc216('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module[_0xc216('0x8')]=function(_0x474c20,_0x30dd64){return _0x474c20['define'](_0xc216('0x9'),attributes,{'tableName':_0xc216('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbf53=['VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports'];(function(_0x3dcc1e,_0x8ade32){var _0x9def22=function(_0x38c314){while(--_0x38c314){_0x3dcc1e['push'](_0x3dcc1e['shift']());}};_0x9def22(++_0x8ade32);}(_0xbf53,0x12e));var _0x3bf5=function(_0x4fcfda,_0x45099a){_0x4fcfda=_0x4fcfda-0x0;var _0x12c8a5=_0xbf53[_0x4fcfda];return _0x12c8a5;};'use strict';var _=require('lodash');var util=require(_0x3bf5('0x0'));var logger=require(_0x3bf5('0x1'))(_0x3bf5('0x2'));var moment=require(_0x3bf5('0x3'));var BPromise=require(_0x3bf5('0x4'));var rp=require(_0x3bf5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3bf5('0x6'));var config=require(_0x3bf5('0x7'));var attributes=require(_0x3bf5('0x8'));module[_0x3bf5('0x9')]=function(_0xb99c55,_0x4291cf){return _0xb99c55['define'](_0x3bf5('0xa'),attributes,{'tableName':_0x3bf5('0xb'),'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 1c7c52b..37de857 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 _0x141a=['../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x130689,_0x4bee2b){var _0x4f02de=function(_0x289f26){while(--_0x289f26){_0x130689['push'](_0x130689['shift']());}};_0x4f02de(++_0x4bee2b);}(_0x141a,0x16f));var _0xa141=function(_0x4a56da,_0x261b11){_0x4a56da=_0x4a56da-0x0;var _0x1e2c30=_0x141a[_0x4a56da];return _0x1e2c30;};'use strict';var _=require(_0xa141('0x0'));var util=require(_0xa141('0x1'));var moment=require(_0xa141('0x2'));var BPromise=require(_0xa141('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa141('0x4'));var db=require(_0xa141('0x5'))['db'];var utils=require(_0xa141('0x6'));var logger=require(_0xa141('0x7'))(_0xa141('0x8'));var config=require(_0xa141('0x9'));var jayson=require(_0xa141('0xa'));var client=jayson['client'][_0xa141('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52886c,_0x1ba11f,_0x1bd747){return new BPromise(function(_0x37a1ef,_0x4886bd){return client['request'](_0x52886c,_0x1bd747)['then'](function(_0xe83ea){logger[_0xa141('0xc')](_0xa141('0xd'),_0x1ba11f,_0xa141('0xe'));logger[_0xa141('0xf')](_0xa141('0x10'),_0x1ba11f,'request\x20sent',JSON[_0xa141('0x11')](_0xe83ea));if(_0xe83ea[_0xa141('0x12')]){if(_0xe83ea[_0xa141('0x12')][_0xa141('0x13')]===0x1f4){logger['error'](_0xa141('0xd'),_0x1ba11f,_0xe83ea[_0xa141('0x12')][_0xa141('0x14')]);return _0x4886bd(_0xe83ea[_0xa141('0x12')][_0xa141('0x14')]);}logger[_0xa141('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x1ba11f,_0xe83ea[_0xa141('0x12')][_0xa141('0x14')]);return _0x37a1ef(_0xe83ea[_0xa141('0x12')][_0xa141('0x14')]);}else{logger[_0xa141('0xc')](_0xa141('0xd'),_0x1ba11f,_0xa141('0xe'));_0x37a1ef(_0xe83ea[_0xa141('0x15')]['message']);}})['catch'](function(_0x3b20b4){logger[_0xa141('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x1ba11f,_0x3b20b4);_0x4886bd(_0x3b20b4);});});} \ No newline at end of file +var _0x86ee=['../../config/environment','jayson/promise','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','../../config/utils','../../config/logger','rpc'];(function(_0x4f23e1,_0xb7ee3f){var _0x5394f4=function(_0x40ee05){while(--_0x40ee05){_0x4f23e1['push'](_0x4f23e1['shift']());}};_0x5394f4(++_0xb7ee3f);}(_0x86ee,0x174));var _0xe86e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x86ee[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xe86e('0x0'));var moment=require(_0xe86e('0x1'));var BPromise=require(_0xe86e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe86e('0x3'));var logger=require(_0xe86e('0x4'))(_0xe86e('0x5'));var config=require(_0xe86e('0x6'));var jayson=require(_0xe86e('0x7'));var client=jayson[_0xe86e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x110ed6,_0x24cc42,_0x3863ff){return new BPromise(function(_0x5150ff,_0x31029d){return client[_0xe86e('0x9')](_0x110ed6,_0x3863ff)[_0xe86e('0xa')](function(_0x1561e6){logger[_0xe86e('0xb')](_0xe86e('0xc'),_0x24cc42,_0xe86e('0xd'));logger[_0xe86e('0xe')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x24cc42,'request\x20sent',JSON[_0xe86e('0xf')](_0x1561e6));if(_0x1561e6['error']){if(_0x1561e6[_0xe86e('0x10')][_0xe86e('0x11')]===0x1f4){logger['error'](_0xe86e('0xc'),_0x24cc42,_0x1561e6[_0xe86e('0x10')][_0xe86e('0x12')]);return _0x31029d(_0x1561e6['error'][_0xe86e('0x12')]);}logger[_0xe86e('0x10')](_0xe86e('0xc'),_0x24cc42,_0x1561e6[_0xe86e('0x10')][_0xe86e('0x12')]);return _0x5150ff(_0x1561e6[_0xe86e('0x10')][_0xe86e('0x12')]);}else{logger[_0xe86e('0xb')](_0xe86e('0xc'),_0x24cc42,_0xe86e('0xd'));_0x5150ff(_0x1561e6[_0xe86e('0x13')][_0xe86e('0x12')]);}})[_0xe86e('0x14')](function(_0x1ac037){logger['error'](_0xe86e('0xc'),_0x24cc42,_0x1ac037);_0x31029d(_0x1ac037);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 057a7f2..56dc636 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 _0x8118=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','create','put','update'];(function(_0x4d2b3d,_0x2ad821){var _0x315645=function(_0x4bf9cd){while(--_0x4bf9cd){_0x4d2b3d['push'](_0x4d2b3d['shift']());}};_0x315645(++_0x2ad821);}(_0x8118,0x1ba));var _0x8811=function(_0x4e6090,_0x50fa28){_0x4e6090=_0x4e6090-0x0;var _0x108ca1=_0x8118[_0x4e6090];return _0x108ca1;};'use strict';var multer=require(_0x8811('0x0'));var util=require(_0x8811('0x1'));var path=require(_0x8811('0x2'));var timeout=require(_0x8811('0x3'));var express=require(_0x8811('0x4'));var router=express[_0x8811('0x5')]();var auth=require(_0x8811('0x6'));var interaction=require(_0x8811('0x7'));var config=require(_0x8811('0x8'));var controller=require(_0x8811('0x9'));router[_0x8811('0xa')]('/',auth[_0x8811('0xb')](),controller[_0x8811('0xc')]);router['get'](_0x8811('0xd'),auth['isAuthenticated'](),controller[_0x8811('0xe')]);router['post']('/',auth[_0x8811('0xb')](),controller[_0x8811('0xf')]);router[_0x8811('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x8811('0x11')]);router['delete']('/:id',auth[_0x8811('0xb')](),controller[_0x8811('0x12')]);module[_0x8811('0x13')]=router; \ No newline at end of file +var _0x7d75=['get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intVtigerField.controller'];(function(_0x402c8f,_0x30cc1d){var _0x11e809=function(_0x4ccfa3){while(--_0x4ccfa3){_0x402c8f['push'](_0x402c8f['shift']());}};_0x11e809(++_0x30cc1d);}(_0x7d75,0x118));var _0x57d7=function(_0x19154d,_0x595c51){_0x19154d=_0x19154d-0x0;var _0x5e3474=_0x7d75[_0x19154d];return _0x5e3474;};'use strict';var multer=require(_0x57d7('0x0'));var util=require(_0x57d7('0x1'));var path=require(_0x57d7('0x2'));var timeout=require(_0x57d7('0x3'));var express=require(_0x57d7('0x4'));var router=express['Router']();var auth=require(_0x57d7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x57d7('0x6'));var controller=require(_0x57d7('0x7'));router[_0x57d7('0x8')]('/',auth[_0x57d7('0x9')](),controller[_0x57d7('0xa')]);router[_0x57d7('0x8')](_0x57d7('0xb'),auth[_0x57d7('0x9')](),controller[_0x57d7('0xc')]);router['post']('/',auth[_0x57d7('0x9')](),controller[_0x57d7('0xd')]);router[_0x57d7('0xe')]('/:id',auth[_0x57d7('0x9')](),controller['update']);router[_0x57d7('0xf')](_0x57d7('0xb'),auth[_0x57d7('0x9')](),controller[_0x57d7('0x10')]);module[_0x57d7('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index f7d61fd..f9dc60e 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 _0x80ce=['variable','keyValue','STRING','customVariable','string'];(function(_0x2fdee1,_0x466858){var _0x2c5533=function(_0x1f34de){while(--_0x1f34de){_0x2fdee1['push'](_0x2fdee1['shift']());}};_0x2c5533(++_0x466858);}(_0x80ce,0xae));var _0xe80c=function(_0x4d70cc,_0x4860ca){_0x4d70cc=_0x4d70cc-0x0;var _0x485bb4=_0x80ce[_0x4d70cc];return _0x485bb4;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0xe80c('0x0'),_0xe80c('0x1'),'customVariable',_0xe80c('0x2')),'defaultValue':_0xe80c('0x0')},'content':{'type':Sequelize[_0xe80c('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xe80c('0x1'),_0xe80c('0x4'))},'keyContent':{'type':Sequelize[_0xe80c('0x3')]},'idField':{'type':Sequelize[_0xe80c('0x3')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe80c('0x3')]}}; \ No newline at end of file +var _0x323b=['variable','keyValue','STRING','customVariable','BOOLEAN','sequelize','ENUM','string'];(function(_0x173452,_0x3aa870){var _0xee3fd0=function(_0x10eb01){while(--_0x10eb01){_0x173452['push'](_0x173452['shift']());}};_0xee3fd0(++_0x3aa870);}(_0x323b,0x1ad));var _0xb323=function(_0x37bde4,_0x1634a8){_0x37bde4=_0x37bde4-0x0;var _0x5e32d7=_0x323b[_0x37bde4];return _0x5e32d7;};'use strict';var Sequelize=require(_0xb323('0x0'));module['exports']={'type':{'type':Sequelize[_0xb323('0x1')](_0xb323('0x2'),_0xb323('0x3'),'customVariable',_0xb323('0x4')),'defaultValue':_0xb323('0x2')},'content':{'type':Sequelize[_0xb323('0x5')]},'key':{'type':Sequelize[_0xb323('0x5')]},'keyType':{'type':Sequelize[_0xb323('0x1')](_0xb323('0x2'),_0xb323('0x3'),_0xb323('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb323('0x5')]},'customField':{'type':Sequelize[_0xb323('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb323('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 2c20d3a..9e74c41 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 _0x09b3=['desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','destroy','then','stack','name','send','index','VtigerField','rawAttributes','fieldName','type','map','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','include','findAll','catch','show','includeAll','create','body','find','params','html-pdf','eml-format','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce'];(function(_0x37e845,_0x219f9f){var _0x59e55b=function(_0x5dc6c8){while(--_0x5dc6c8){_0x37e845['push'](_0x37e845['shift']());}};_0x59e55b(++_0x219f9f);}(_0x09b3,0x10b));var _0x309b=function(_0x2f1a2a,_0x22cd7e){_0x2f1a2a=_0x2f1a2a-0x0;var _0x577c6c=_0x09b3[_0x2f1a2a];return _0x577c6c;};'use strict';var pdf=require(_0x309b('0x0'));var emlformat=require(_0x309b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x309b('0x2'));var moment=require(_0x309b('0x3'));var BPromise=require(_0x309b('0x4'));var Mustache=require(_0x309b('0x5'));var util=require('util');var path=require(_0x309b('0x6'));var sox=require(_0x309b('0x7'));var csv=require(_0x309b('0x8'));var ejs=require(_0x309b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x309b('0xa'));var crypto=require(_0x309b('0xb'));var jsforce=require(_0x309b('0xc'));var deskjs=require(_0x309b('0xd'));var toCsv=require(_0x309b('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x309b('0xe'));var authService=require(_0x309b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x309b('0x10'));var hardwareService=require(_0x309b('0x11'));var logger=require(_0x309b('0x12'))(_0x309b('0x13'));var utils=require(_0x309b('0x14'));var config=require(_0x309b('0x15'));var db=require(_0x309b('0x16'))['db'];function respondWithStatusCode(_0x944700,_0x4bcf04){_0x4bcf04=_0x4bcf04||0xcc;return function(_0xe3f765){if(_0xe3f765){return _0x944700[_0x309b('0x17')](_0x4bcf04);}return _0x944700[_0x309b('0x18')](_0x4bcf04)[_0x309b('0x19')]();};}function respondWithResult(_0x4678b0,_0x59021a){_0x59021a=_0x59021a||0xc8;return function(_0x5e11bf){if(_0x5e11bf){return _0x4678b0['status'](_0x59021a)['json'](_0x5e11bf);}};}function respondWithFilteredResult(_0x2311a1,_0x4dff60){return function(_0x55321a){if(_0x55321a){var _0x4b2822=_0x55321a[_0x309b('0x1a')],_0x4cf249=_0x4dff60[_0x309b('0x1b')],_0x37762f=_0x4dff60['offset']+_0x4dff60[_0x309b('0x1c')],_0xd4a840;if(_0x37762f>=_0x4b2822){_0x37762f=_0x4b2822;_0xd4a840=0xc8;}else{_0xd4a840=0xce;}_0x2311a1['status'](_0xd4a840);return _0x2311a1[_0x309b('0x1d')](_0x309b('0x1e'),_0x4cf249+'-'+_0x37762f+'/'+_0x4b2822)[_0x309b('0x1f')](_0x55321a);}return null;};}function patchUpdates(_0x108c6b){return function(_0x3f1daf){try{jsonpatch[_0x309b('0x20')](_0x3f1daf,_0x108c6b,!![]);}catch(_0x41d74e){return BPromise['reject'](_0x41d74e);}return _0x3f1daf[_0x309b('0x21')]();};}function saveUpdates(_0x5af70c,_0x33f5cf){return function(_0x4ac76a){if(_0x4ac76a){return _0x4ac76a['update'](_0x5af70c)['then'](function(_0xbffaf6){return _0xbffaf6;});}return null;};}function removeEntity(_0x38ae98,_0xc3100d){return function(_0x429f04){if(_0x429f04){return _0x429f04[_0x309b('0x22')]()[_0x309b('0x23')](function(){_0x38ae98[_0x309b('0x18')](0xcc)[_0x309b('0x19')]();});}};}function handleEntityNotFound(_0x14761c,_0x4750c0){return function(_0x5394eb){if(!_0x5394eb){_0x14761c[_0x309b('0x17')](0x194);}return _0x5394eb;};}function handleError(_0x4720d0,_0x23d6f8){_0x23d6f8=_0x23d6f8||0x1f4;return function(_0x44b2dd){logger['error'](_0x44b2dd[_0x309b('0x24')]);if(_0x44b2dd[_0x309b('0x25')]){delete _0x44b2dd[_0x309b('0x25')];}_0x4720d0[_0x309b('0x18')](_0x23d6f8)[_0x309b('0x26')](_0x44b2dd);};}exports[_0x309b('0x27')]=function(_0x2a899f,_0x4a8c82){var _0x4a271f={},_0x267774={},_0x195409={'count':0x0,'rows':[]};var _0xfc0db7=_['map'](db[_0x309b('0x28')][_0x309b('0x29')],function(_0x5f009c){return{'name':_0x5f009c[_0x309b('0x2a')],'type':_0x5f009c[_0x309b('0x2b')]['key']};});_0x267774['model']=_[_0x309b('0x2c')](_0xfc0db7,_0x309b('0x25'));_0x267774['query']=_[_0x309b('0x2d')](_0x2a899f['query']);_0x267774['filters']=_[_0x309b('0x2e')](_0x267774[_0x309b('0x2f')],_0x267774[_0x309b('0x30')]);_0x4a271f[_0x309b('0x31')]=_[_0x309b('0x2e')](_0x267774['model'],qs[_0x309b('0x32')](_0x2a899f[_0x309b('0x30')][_0x309b('0x32')]));_0x4a271f[_0x309b('0x31')]=_0x4a271f[_0x309b('0x31')][_0x309b('0x33')]?_0x4a271f[_0x309b('0x31')]:_0x267774[_0x309b('0x2f')];if(!_0x2a899f[_0x309b('0x30')][_0x309b('0x34')](_0x309b('0x35'))){_0x4a271f[_0x309b('0x1c')]=qs[_0x309b('0x1c')](_0x2a899f[_0x309b('0x30')][_0x309b('0x1c')]);_0x4a271f['offset']=qs[_0x309b('0x1b')](_0x2a899f['query']['offset']);}_0x4a271f[_0x309b('0x36')]=qs[_0x309b('0x37')](_0x2a899f[_0x309b('0x30')][_0x309b('0x37')]);_0x4a271f[_0x309b('0x38')]=qs[_0x309b('0x39')](_['pick'](_0x2a899f[_0x309b('0x30')],_0x267774[_0x309b('0x39')]));if(_0x2a899f['query'][_0x309b('0x3a')]){_0x4a271f[_0x309b('0x38')]=_[_0x309b('0x3b')](_0x4a271f[_0x309b('0x38')],{'$or':_[_0x309b('0x2c')](_0xfc0db7,function(_0x566f6a){if(_0x566f6a[_0x309b('0x2b')]!=='VIRTUAL'){var _0x672554={};_0x672554[_0x566f6a[_0x309b('0x25')]]={'$like':'%'+_0x2a899f['query'][_0x309b('0x3a')]+'%'};return _0x672554;}})});}_0x4a271f=_[_0x309b('0x3b')]({},_0x4a271f,_0x2a899f[_0x309b('0x3c')]);var _0x1ba133={'where':_0x4a271f[_0x309b('0x38')]};return db['VtigerField'][_0x309b('0x1a')](_0x1ba133)[_0x309b('0x23')](function(_0x4bad31){_0x195409[_0x309b('0x1a')]=_0x4bad31;if(_0x2a899f[_0x309b('0x30')]['includeAll']){_0x4a271f[_0x309b('0x3d')]=[{'all':!![]}];}return db[_0x309b('0x28')][_0x309b('0x3e')](_0x4a271f);})[_0x309b('0x23')](function(_0x5be8f1){_0x195409['rows']=_0x5be8f1;return _0x195409;})[_0x309b('0x23')](respondWithFilteredResult(_0x4a8c82,_0x4a271f))[_0x309b('0x3f')](handleError(_0x4a8c82,null));};exports[_0x309b('0x40')]=function(_0x2e29fc,_0x1a348e){var _0x5ef6d2={'raw':!![],'where':{'id':_0x2e29fc['params']['id']}},_0x2888ba={};_0x2888ba['model']=_[_0x309b('0x2d')](db[_0x309b('0x28')][_0x309b('0x29')]);_0x2888ba[_0x309b('0x30')]=_[_0x309b('0x2d')](_0x2e29fc['query']);_0x2888ba[_0x309b('0x39')]=_['intersection'](_0x2888ba[_0x309b('0x2f')],_0x2888ba[_0x309b('0x30')]);_0x5ef6d2[_0x309b('0x31')]=_['intersection'](_0x2888ba[_0x309b('0x2f')],qs[_0x309b('0x32')](_0x2e29fc[_0x309b('0x30')][_0x309b('0x32')]));_0x5ef6d2[_0x309b('0x31')]=_0x5ef6d2[_0x309b('0x31')][_0x309b('0x33')]?_0x5ef6d2[_0x309b('0x31')]:_0x2888ba[_0x309b('0x2f')];if(_0x2e29fc[_0x309b('0x30')][_0x309b('0x41')]){_0x5ef6d2[_0x309b('0x3d')]=[{'all':!![]}];}_0x5ef6d2=_[_0x309b('0x3b')]({},_0x5ef6d2,_0x2e29fc[_0x309b('0x3c')]);return db[_0x309b('0x28')]['find'](_0x5ef6d2)[_0x309b('0x23')](handleEntityNotFound(_0x1a348e,null))[_0x309b('0x23')](respondWithResult(_0x1a348e,null))[_0x309b('0x3f')](handleError(_0x1a348e,null));};exports['create']=function(_0x31f86a,_0x2519bc){return db['VtigerField'][_0x309b('0x42')](_0x31f86a[_0x309b('0x43')],{})['then'](respondWithResult(_0x2519bc,0xc9))[_0x309b('0x3f')](handleError(_0x2519bc,null));};exports['update']=function(_0xd06304,_0x12c235){if(_0xd06304[_0x309b('0x43')]['id']){delete _0xd06304[_0x309b('0x43')]['id'];}return db[_0x309b('0x28')][_0x309b('0x44')]({'where':{'id':_0xd06304[_0x309b('0x45')]['id']}})[_0x309b('0x23')](handleEntityNotFound(_0x12c235,null))['then'](saveUpdates(_0xd06304[_0x309b('0x43')],null))[_0x309b('0x23')](respondWithResult(_0x12c235,null))[_0x309b('0x3f')](handleError(_0x12c235,null));};exports[_0x309b('0x22')]=function(_0x57e3d6,_0x1b534f){return db[_0x309b('0x28')][_0x309b('0x44')]({'where':{'id':_0x57e3d6['params']['id']}})[_0x309b('0x23')](handleEntityNotFound(_0x1b534f,null))[_0x309b('0x23')](removeEntity(_0x1b534f,null))[_0x309b('0x3f')](handleError(_0x1b534f,null));}; \ No newline at end of file +var _0xc91a=['length','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0xc91a,0x1c9));var _0xac91=function(_0x1cee93,_0x54251e){_0x1cee93=_0x1cee93-0x0;var _0x40f9a5=_0xc91a[_0x1cee93];return _0x40f9a5;};'use strict';var pdf=require(_0xac91('0x0'));var emlformat=require(_0xac91('0x1'));var rimraf=require(_0xac91('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xac91('0x3'));var moment=require(_0xac91('0x4'));var BPromise=require(_0xac91('0x5'));var Mustache=require(_0xac91('0x6'));var util=require(_0xac91('0x7'));var path=require(_0xac91('0x8'));var sox=require(_0xac91('0x9'));var csv=require(_0xac91('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xac91('0xb'));var crypto=require(_0xac91('0xc'));var jsforce=require(_0xac91('0xd'));var deskjs=require(_0xac91('0xe'));var toCsv=require(_0xac91('0xa'));var querystring=require('querystring');var Papa=require(_0xac91('0xf'));var Redis=require(_0xac91('0x10'));var authService=require(_0xac91('0x11'));var qs=require(_0xac91('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xac91('0x13'));var utils=require(_0xac91('0x14'));var config=require(_0xac91('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x437ab7,_0x225a6b){_0x225a6b=_0x225a6b||0xcc;return function(_0x962a30){if(_0x962a30){return _0x437ab7['sendStatus'](_0x225a6b);}return _0x437ab7[_0xac91('0x16')](_0x225a6b)[_0xac91('0x17')]();};}function respondWithResult(_0x407d4d,_0x3a08f7){_0x3a08f7=_0x3a08f7||0xc8;return function(_0xf7cb2a){if(_0xf7cb2a){return _0x407d4d[_0xac91('0x16')](_0x3a08f7)[_0xac91('0x18')](_0xf7cb2a);}};}function respondWithFilteredResult(_0x2494aa,_0x240f69){return function(_0x3d41e4){if(_0x3d41e4){var _0x4a721=_0x3d41e4[_0xac91('0x19')],_0x49d442=_0x240f69[_0xac91('0x1a')],_0x46e868=_0x240f69[_0xac91('0x1a')]+_0x240f69[_0xac91('0x1b')],_0x2d98f2;if(_0x46e868>=_0x4a721){_0x46e868=_0x4a721;_0x2d98f2=0xc8;}else{_0x2d98f2=0xce;}_0x2494aa[_0xac91('0x16')](_0x2d98f2);return _0x2494aa[_0xac91('0x1c')](_0xac91('0x1d'),_0x49d442+'-'+_0x46e868+'/'+_0x4a721)[_0xac91('0x18')](_0x3d41e4);}return null;};}function patchUpdates(_0x4df316){return function(_0x96fc2f){try{jsonpatch[_0xac91('0x1e')](_0x96fc2f,_0x4df316,!![]);}catch(_0x337b96){return BPromise[_0xac91('0x1f')](_0x337b96);}return _0x96fc2f[_0xac91('0x20')]();};}function saveUpdates(_0x317832,_0x36caef){return function(_0x4fbf21){if(_0x4fbf21){return _0x4fbf21[_0xac91('0x21')](_0x317832)[_0xac91('0x22')](function(_0x16c79c){return _0x16c79c;});}return null;};}function removeEntity(_0x2b9b67,_0x486305){return function(_0x57116e){if(_0x57116e){return _0x57116e[_0xac91('0x23')]()[_0xac91('0x22')](function(){_0x2b9b67[_0xac91('0x16')](0xcc)[_0xac91('0x17')]();});}};}function handleEntityNotFound(_0x5b061b,_0x289c80){return function(_0x4211cb){if(!_0x4211cb){_0x5b061b[_0xac91('0x24')](0x194);}return _0x4211cb;};}function handleError(_0x3ad5da,_0x1c6b03){_0x1c6b03=_0x1c6b03||0x1f4;return function(_0x4eddb0){logger[_0xac91('0x25')](_0x4eddb0['stack']);if(_0x4eddb0[_0xac91('0x26')]){delete _0x4eddb0[_0xac91('0x26')];}_0x3ad5da[_0xac91('0x16')](_0x1c6b03)[_0xac91('0x27')](_0x4eddb0);};}exports[_0xac91('0x28')]=function(_0x4dda17,_0xa78258){var _0x24bc1b={},_0x576eaa={},_0x3042f6={'count':0x0,'rows':[]};var _0x49a070=_[_0xac91('0x29')](db[_0xac91('0x2a')][_0xac91('0x2b')],function(_0x424e1b){return{'name':_0x424e1b[_0xac91('0x2c')],'type':_0x424e1b[_0xac91('0x2d')][_0xac91('0x2e')]};});_0x576eaa[_0xac91('0x2f')]=_['map'](_0x49a070,_0xac91('0x26'));_0x576eaa['query']=_[_0xac91('0x30')](_0x4dda17[_0xac91('0x31')]);_0x576eaa[_0xac91('0x32')]=_[_0xac91('0x33')](_0x576eaa[_0xac91('0x2f')],_0x576eaa[_0xac91('0x31')]);_0x24bc1b[_0xac91('0x34')]=_[_0xac91('0x33')](_0x576eaa[_0xac91('0x2f')],qs[_0xac91('0x35')](_0x4dda17[_0xac91('0x31')][_0xac91('0x35')]));_0x24bc1b[_0xac91('0x34')]=_0x24bc1b[_0xac91('0x34')][_0xac91('0x36')]?_0x24bc1b['attributes']:_0x576eaa[_0xac91('0x2f')];if(!_0x4dda17[_0xac91('0x31')][_0xac91('0x37')](_0xac91('0x38'))){_0x24bc1b[_0xac91('0x1b')]=qs['limit'](_0x4dda17['query'][_0xac91('0x1b')]);_0x24bc1b['offset']=qs['offset'](_0x4dda17['query'][_0xac91('0x1a')]);}_0x24bc1b['order']=qs[_0xac91('0x39')](_0x4dda17['query'][_0xac91('0x39')]);_0x24bc1b[_0xac91('0x3a')]=qs[_0xac91('0x32')](_['pick'](_0x4dda17[_0xac91('0x31')],_0x576eaa[_0xac91('0x32')]));if(_0x4dda17[_0xac91('0x31')]['filter']){_0x24bc1b[_0xac91('0x3a')]=_['merge'](_0x24bc1b[_0xac91('0x3a')],{'$or':_[_0xac91('0x29')](_0x49a070,function(_0x2b82b0){if(_0x2b82b0[_0xac91('0x2d')]!==_0xac91('0x3b')){var _0x2ed739={};_0x2ed739[_0x2b82b0[_0xac91('0x26')]]={'$like':'%'+_0x4dda17[_0xac91('0x31')][_0xac91('0x3c')]+'%'};return _0x2ed739;}})});}_0x24bc1b=_[_0xac91('0x3d')]({},_0x24bc1b,_0x4dda17['options']);var _0xd34a8a={'where':_0x24bc1b['where']};return db['VtigerField']['count'](_0xd34a8a)[_0xac91('0x22')](function(_0x4954e2){_0x3042f6['count']=_0x4954e2;if(_0x4dda17[_0xac91('0x31')][_0xac91('0x3e')]){_0x24bc1b[_0xac91('0x3f')]=[{'all':!![]}];}return db['VtigerField'][_0xac91('0x40')](_0x24bc1b);})[_0xac91('0x22')](function(_0x458938){_0x3042f6[_0xac91('0x41')]=_0x458938;return _0x3042f6;})['then'](respondWithFilteredResult(_0xa78258,_0x24bc1b))[_0xac91('0x42')](handleError(_0xa78258,null));};exports[_0xac91('0x43')]=function(_0x393fd1,_0x29d0ef){var _0x10fc87={'raw':!![],'where':{'id':_0x393fd1[_0xac91('0x44')]['id']}},_0xea31c7={};_0xea31c7[_0xac91('0x2f')]=_['keys'](db[_0xac91('0x2a')][_0xac91('0x2b')]);_0xea31c7[_0xac91('0x31')]=_[_0xac91('0x30')](_0x393fd1[_0xac91('0x31')]);_0xea31c7[_0xac91('0x32')]=_[_0xac91('0x33')](_0xea31c7['model'],_0xea31c7[_0xac91('0x31')]);_0x10fc87[_0xac91('0x34')]=_[_0xac91('0x33')](_0xea31c7[_0xac91('0x2f')],qs[_0xac91('0x35')](_0x393fd1[_0xac91('0x31')][_0xac91('0x35')]));_0x10fc87[_0xac91('0x34')]=_0x10fc87[_0xac91('0x34')][_0xac91('0x36')]?_0x10fc87['attributes']:_0xea31c7['model'];if(_0x393fd1['query'][_0xac91('0x3e')]){_0x10fc87['include']=[{'all':!![]}];}_0x10fc87=_['merge']({},_0x10fc87,_0x393fd1[_0xac91('0x45')]);return db[_0xac91('0x2a')][_0xac91('0x46')](_0x10fc87)[_0xac91('0x22')](handleEntityNotFound(_0x29d0ef,null))['then'](respondWithResult(_0x29d0ef,null))[_0xac91('0x42')](handleError(_0x29d0ef,null));};exports[_0xac91('0x47')]=function(_0xb26642,_0x139e24){return db[_0xac91('0x2a')]['create'](_0xb26642[_0xac91('0x48')],{})[_0xac91('0x22')](respondWithResult(_0x139e24,0xc9))[_0xac91('0x42')](handleError(_0x139e24,null));};exports[_0xac91('0x21')]=function(_0x59bd2d,_0x369347){if(_0x59bd2d[_0xac91('0x48')]['id']){delete _0x59bd2d[_0xac91('0x48')]['id'];}return db[_0xac91('0x2a')][_0xac91('0x46')]({'where':{'id':_0x59bd2d[_0xac91('0x44')]['id']}})[_0xac91('0x22')](handleEntityNotFound(_0x369347,null))['then'](saveUpdates(_0x59bd2d[_0xac91('0x48')],null))[_0xac91('0x22')](respondWithResult(_0x369347,null))[_0xac91('0x42')](handleError(_0x369347,null));};exports[_0xac91('0x23')]=function(_0x433572,_0x369d20){return db['VtigerField'][_0xac91('0x46')]({'where':{'id':_0x433572[_0xac91('0x44')]['id']}})[_0xac91('0x22')](handleEntityNotFound(_0x369d20,null))[_0xac91('0x22')](removeEntity(_0x369d20,null))[_0xac91('0x42')](handleError(_0x369d20,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 5f71155..4b19c23 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x909215,_0xad0aa7){var _0x23e850=function(_0x386fa4){while(--_0x386fa4){_0x909215['push'](_0x909215['shift']());}};_0x23e850(++_0xad0aa7);}(_0x7a54,0x106));var _0x47a5=function(_0x32412c,_0x2c91ea){_0x32412c=_0x32412c-0x0;var _0x4ed529=_0x7a54[_0x32412c];return _0x4ed529;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index c724d8a..d28586d 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 _0x2c91=['code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','rpc','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2c91,0xe0));var _0x12c9=function(_0xa48a70,_0x3b9ab6){_0xa48a70=_0xa48a70-0x0;var _0x1dd205=_0x2c91[_0xa48a70];return _0x1dd205;};'use strict';var _=require('lodash');var util=require(_0x12c9('0x0'));var moment=require('moment');var BPromise=require(_0x12c9('0x1'));var rs=require(_0x12c9('0x2'));var fs=require('fs');var Redis=require(_0x12c9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x12c9('0x4'));var logger=require('../../config/logger')(_0x12c9('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x12c9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x15aa3a,_0x394013,_0x588655){return new BPromise(function(_0x33b83e,_0x49e4eb){return client[_0x12c9('0x7')](_0x15aa3a,_0x588655)[_0x12c9('0x8')](function(_0x58dbb1){logger[_0x12c9('0x9')](_0x12c9('0xa'),_0x394013,_0x12c9('0xb'));logger[_0x12c9('0xc')](_0x12c9('0xd'),_0x394013,_0x12c9('0xb'),JSON[_0x12c9('0xe')](_0x58dbb1));if(_0x58dbb1[_0x12c9('0xf')]){if(_0x58dbb1[_0x12c9('0xf')][_0x12c9('0x10')]===0x1f4){logger[_0x12c9('0xf')](_0x12c9('0xa'),_0x394013,_0x58dbb1[_0x12c9('0xf')][_0x12c9('0x11')]);return _0x49e4eb(_0x58dbb1['error'][_0x12c9('0x11')]);}logger[_0x12c9('0xf')](_0x12c9('0xa'),_0x394013,_0x58dbb1['error'][_0x12c9('0x11')]);return _0x33b83e(_0x58dbb1[_0x12c9('0xf')][_0x12c9('0x11')]);}else{logger['info'](_0x12c9('0xa'),_0x394013,_0x12c9('0xb'));_0x33b83e(_0x58dbb1[_0x12c9('0x12')]['message']);}})[_0x12c9('0x13')](function(_0x269cb3){logger[_0x12c9('0xf')](_0x12c9('0xa'),_0x394013,_0x269cb3);_0x49e4eb(_0x269cb3);});});} \ No newline at end of file +var _0xea28=['rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1772a9,_0x378d32){var _0x49915d=function(_0x5b2bce){while(--_0x5b2bce){_0x1772a9['push'](_0x1772a9['shift']());}};_0x49915d(++_0x378d32);}(_0xea28,0x13a));var _0x8ea2=function(_0x254690,_0x3bcdce){_0x254690=_0x254690-0x0;var _0x4a2e63=_0xea28[_0x254690];return _0x4a2e63;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var moment=require(_0x8ea2('0x2'));var BPromise=require(_0x8ea2('0x3'));var rs=require(_0x8ea2('0x4'));var fs=require('fs');var Redis=require(_0x8ea2('0x5'));var db=require(_0x8ea2('0x6'))['db'];var utils=require(_0x8ea2('0x7'));var logger=require('../../config/logger')(_0x8ea2('0x8'));var config=require(_0x8ea2('0x9'));var jayson=require(_0x8ea2('0xa'));var client=jayson['client'][_0x8ea2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x435d78,_0xb7f278,_0x39b1fa){return new BPromise(function(_0x28b5b8,_0x929304){return client[_0x8ea2('0xc')](_0x435d78,_0x39b1fa)[_0x8ea2('0xd')](function(_0x3de4a1){logger[_0x8ea2('0xe')](_0x8ea2('0xf'),_0xb7f278,_0x8ea2('0x10'));logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0xb7f278,_0x8ea2('0x10'),JSON[_0x8ea2('0x11')](_0x3de4a1));if(_0x3de4a1[_0x8ea2('0x12')]){if(_0x3de4a1['error'][_0x8ea2('0x13')]===0x1f4){logger[_0x8ea2('0x12')](_0x8ea2('0xf'),_0xb7f278,_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);return _0x929304(_0x3de4a1['error'][_0x8ea2('0x14')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0xb7f278,_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);return _0x28b5b8(_0x3de4a1[_0x8ea2('0x12')][_0x8ea2('0x14')]);}else{logger[_0x8ea2('0xe')](_0x8ea2('0xf'),_0xb7f278,_0x8ea2('0x10'));_0x28b5b8(_0x3de4a1[_0x8ea2('0x15')][_0x8ea2('0x14')]);}})[_0x8ea2('0x16')](function(_0x2dfa7c){logger[_0x8ea2('0x12')](_0x8ea2('0xf'),_0xb7f278,_0x2dfa7c);_0x929304(_0x2dfa7c);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index bc67528..6cb9162 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 _0x07b7=['../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x47b924,_0x5a61ca){var _0x3b267e=function(_0x559d00){while(--_0x559d00){_0x47b924['push'](_0x47b924['shift']());}};_0x3b267e(++_0x5a61ca);}(_0x07b7,0x189));var _0x707b=function(_0x5484f4,_0x4f2c3a){_0x5484f4=_0x5484f4-0x0;var _0x7f7dc9=_0x07b7[_0x5484f4];return _0x7f7dc9;};'use strict';var multer=require(_0x707b('0x0'));var util=require(_0x707b('0x1'));var path=require(_0x707b('0x2'));var timeout=require(_0x707b('0x3'));var express=require(_0x707b('0x4'));var router=express[_0x707b('0x5')]();var auth=require(_0x707b('0x6'));var interaction=require(_0x707b('0x7'));var config=require(_0x707b('0x8'));var controller=require('./intZendeskAccount.controller');router[_0x707b('0x9')]('/',auth['isAuthenticated'](),controller[_0x707b('0xa')]);router[_0x707b('0x9')](_0x707b('0xb'),auth[_0x707b('0xc')](),controller[_0x707b('0xd')]);router[_0x707b('0x9')](_0x707b('0xe'),auth['isAuthenticated'](),controller[_0x707b('0xf')]);router[_0x707b('0x9')](_0x707b('0x10'),auth[_0x707b('0xc')](),controller[_0x707b('0x11')]);router[_0x707b('0x12')]('/',auth[_0x707b('0xc')](),controller[_0x707b('0x13')]);router[_0x707b('0x12')](_0x707b('0xe'),auth['isAuthenticated'](),controller[_0x707b('0x14')]);router[_0x707b('0x15')](_0x707b('0xb'),auth['isAuthenticated'](),controller[_0x707b('0x16')]);router[_0x707b('0x17')](_0x707b('0xb'),auth[_0x707b('0xc')](),controller['destroy']);module[_0x707b('0x18')]=router; \ No newline at end of file +var _0x2afc=['getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0xc2f1f5,_0x18ff00){var _0x38c81b=function(_0x2b0222){while(--_0x2b0222){_0xc2f1f5['push'](_0xc2f1f5['shift']());}};_0x38c81b(++_0x18ff00);}(_0x2afc,0x1a2));var _0xc2af=function(_0x4fdc46,_0x2a3759){_0x4fdc46=_0x4fdc46-0x0;var _0x2c178a=_0x2afc[_0x4fdc46];return _0x2c178a;};'use strict';var multer=require(_0xc2af('0x0'));var util=require(_0xc2af('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc2af('0x2'));var router=express[_0xc2af('0x3')]();var auth=require(_0xc2af('0x4'));var interaction=require(_0xc2af('0x5'));var config=require(_0xc2af('0x6'));var controller=require(_0xc2af('0x7'));router[_0xc2af('0x8')]('/',auth[_0xc2af('0x9')](),controller[_0xc2af('0xa')]);router[_0xc2af('0x8')](_0xc2af('0xb'),auth[_0xc2af('0x9')](),controller[_0xc2af('0xc')]);router[_0xc2af('0x8')](_0xc2af('0xd'),auth[_0xc2af('0x9')](),controller[_0xc2af('0xe')]);router[_0xc2af('0x8')](_0xc2af('0xf'),auth[_0xc2af('0x9')](),controller[_0xc2af('0x10')]);router[_0xc2af('0x11')]('/',auth['isAuthenticated'](),controller[_0xc2af('0x12')]);router[_0xc2af('0x11')]('/:id/configurations',auth[_0xc2af('0x9')](),controller[_0xc2af('0x13')]);router[_0xc2af('0x14')](_0xc2af('0xb'),auth['isAuthenticated'](),controller[_0xc2af('0x15')]);router['delete'](_0xc2af('0xb'),auth['isAuthenticated'](),controller[_0xc2af('0x16')]);module[_0xc2af('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index bf12d0b..3e72509 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 _0x9365=['password','token','integrationTab','newTab','sequelize','exports','STRING','remoteUri','ENUM'];(function(_0x3fba73,_0x4cf9ae){var _0x240689=function(_0x3da767){while(--_0x3da767){_0x3fba73['push'](_0x3fba73['shift']());}};_0x240689(++_0x4cf9ae);}(_0x9365,0x12d));var _0x5936=function(_0x2338ef,_0x263a87){_0x2338ef=_0x2338ef-0x0;var _0x1b576e=_0x9365[_0x2338ef];return _0x1b576e;};'use strict';var Sequelize=require(_0x5936('0x0'));module[_0x5936('0x1')]={'name':{'type':Sequelize[_0x5936('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5936('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5936('0x2')],'unique':_0x5936('0x3')},'authType':{'type':Sequelize[_0x5936('0x4')](_0x5936('0x5'),_0x5936('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x5936('0x7'),_0x5936('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xddd8=['password','token','ENUM','integrationTab','newTab','sequelize','exports','STRING','username','remoteUri'];(function(_0xbdd3b3,_0x11d541){var _0x3e683f=function(_0x37b88a){while(--_0x37b88a){_0xbdd3b3['push'](_0xbdd3b3['shift']());}};_0x3e683f(++_0x11d541);}(_0xddd8,0x1d1));var _0x8ddd=function(_0x54ccb3,_0xa4a3d4){_0x54ccb3=_0x54ccb3-0x0;var _0x1bfdff=_0xddd8[_0x54ccb3];return _0x1bfdff;};'use strict';var Sequelize=require(_0x8ddd('0x0'));module[_0x8ddd('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8ddd('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x8ddd('0x3')},'password':{'type':Sequelize[_0x8ddd('0x2')]},'token':{'type':Sequelize[_0x8ddd('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x8ddd('0x4')},'authType':{'type':Sequelize['ENUM'](_0x8ddd('0x5'),_0x8ddd('0x6')),'defaultValue':_0x8ddd('0x5')},'serverUrl':{'type':Sequelize[_0x8ddd('0x2')]},'type':{'type':Sequelize[_0x8ddd('0x7')](_0x8ddd('0x8'),_0x8ddd('0x9')),'defaultValue':_0x8ddd('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index b44f87c..1d2a4bc 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 _0xd19f=['username','token','%s/token:%s','base64','ValidationError','Unknown\x20authentication\x20type','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','statusCode','Wrong\x20credentials','eml-format','zip-dir','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','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','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','ZendeskAccount','includeAll','include','rows','show','params','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','getSubjects','channel','getDescriptions','Subjects','ZendeskField','Descriptions','getFields','password','authType','remoteUri','lastIndexOf','GET','format','ticket_fields','headers','Basic\x20%s'];(function(_0x2cb7ef,_0x4dd339){var _0x5ce2e6=function(_0x3ff1b2){while(--_0x3ff1b2){_0x2cb7ef['push'](_0x2cb7ef['shift']());}};_0x5ce2e6(++_0x4dd339);}(_0xd19f,0x104));var _0xfd19=function(_0x5c38cd,_0x5a6b4e){_0x5c38cd=_0x5c38cd-0x0;var _0xc985ef=_0xd19f[_0x5c38cd];return _0xc985ef;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfd19('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfd19('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfd19('0x2'));var Mustache=require(_0xfd19('0x3'));var util=require(_0xfd19('0x4'));var path=require('path');var sox=require(_0xfd19('0x5'));var csv=require('to-csv');var ejs=require(_0xfd19('0x6'));var fs=require('fs');var _=require(_0xfd19('0x7'));var squel=require(_0xfd19('0x8'));var crypto=require('crypto');var jsforce=require(_0xfd19('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xfd19('0xa'));var querystring=require(_0xfd19('0xb'));var Papa=require(_0xfd19('0xc'));var Redis=require(_0xfd19('0xd'));var authService=require(_0xfd19('0xe'));var qs=require(_0xfd19('0xf'));var as=require(_0xfd19('0x10'));var hardwareService=require(_0xfd19('0x11'));var logger=require('../../config/logger')(_0xfd19('0x12'));var utils=require(_0xfd19('0x13'));var config=require('../../config/environment');var db=require(_0xfd19('0x14'))['db'];var integrations=require(_0xfd19('0x15'));var jayson=require(_0xfd19('0x16'));var client=jayson['client'][_0xfd19('0x17')]({'port':0x232a});function checkPasswordPattern(_0x5d93d5,_0x38b56a,_0xf3c431){if(_0xf3c431){var _0x295818=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x295818[_0xfd19('0x18')](_0x38b56a)){return _0x5d93d5;}else{throw new db[(_0xfd19('0x19'))]['ValidationError'](_0xfd19('0x1a'));}}else{return _0x5d93d5;}}function respondWithRpcPromise(_0x19a369,_0x5f066d,_0x588d3f,_0x45d07e){return new BPromise(function(_0x52216d,_0x42842a){var _0x165994=_0x45d07e||client;return _0x165994[_0xfd19('0x1b')](_0x19a369,_0x588d3f)[_0xfd19('0x1c')](function(_0x26a6bd){logger[_0xfd19('0x1d')]('ZendeskAccount,\x20%s,\x20%s',_0x5f066d,_0xfd19('0x1e'));logger[_0xfd19('0x1f')](_0xfd19('0x20'),_0x5f066d,'request\x20sent',JSON[_0xfd19('0x21')](_0x26a6bd));if(_0x26a6bd['error']){if(_0x26a6bd[_0xfd19('0x22')][_0xfd19('0x23')]===0x1f4){logger[_0xfd19('0x22')](_0xfd19('0x24'),_0x5f066d,_0x26a6bd[_0xfd19('0x22')][_0xfd19('0x25')]);return _0x42842a(_0x26a6bd['error'][_0xfd19('0x25')]);}logger[_0xfd19('0x22')](_0xfd19('0x24'),_0x5f066d,_0x26a6bd[_0xfd19('0x22')][_0xfd19('0x25')]);return _0x52216d(_0x26a6bd[_0xfd19('0x22')]['message']);}else{logger['info'](_0xfd19('0x24'),_0x5f066d,_0xfd19('0x1e'));_0x52216d(_0x26a6bd[_0xfd19('0x26')]['message']);}})[_0xfd19('0x27')](function(_0x573342){logger[_0xfd19('0x22')](_0xfd19('0x24'),_0x5f066d,_0x573342);_0x42842a(_0x573342);});});}function respondWithStatusCode(_0x953919,_0x4b7b54){_0x4b7b54=_0x4b7b54||0xcc;return function(_0x493dc9){if(_0x493dc9){return _0x953919['sendStatus'](_0x4b7b54);}return _0x953919[_0xfd19('0x28')](_0x4b7b54)[_0xfd19('0x29')]();};}function respondWithResult(_0x4b9414,_0x586059){_0x586059=_0x586059||0xc8;return function(_0x2e6816){if(_0x2e6816){return _0x4b9414[_0xfd19('0x28')](_0x586059)[_0xfd19('0x2a')](_0x2e6816);}};}function respondWithFilteredResult(_0x5b40fa,_0xb8bb57){return function(_0x30dfb9){if(_0x30dfb9){var _0x3c3620=_0x30dfb9[_0xfd19('0x2b')],_0x516677=_0xb8bb57[_0xfd19('0x2c')],_0xd1a46=_0xb8bb57[_0xfd19('0x2c')]+_0xb8bb57[_0xfd19('0x2d')],_0x22af93;if(_0xd1a46>=_0x3c3620){_0xd1a46=_0x3c3620;_0x22af93=0xc8;}else{_0x22af93=0xce;}_0x5b40fa[_0xfd19('0x28')](_0x22af93);return _0x5b40fa[_0xfd19('0x2e')](_0xfd19('0x2f'),_0x516677+'-'+_0xd1a46+'/'+_0x3c3620)[_0xfd19('0x2a')](_0x30dfb9);}return null;};}function patchUpdates(_0x120ecd){return function(_0x1a8a1b){try{jsonpatch[_0xfd19('0x30')](_0x1a8a1b,_0x120ecd,!![]);}catch(_0x278290){return BPromise[_0xfd19('0x31')](_0x278290);}return _0x1a8a1b[_0xfd19('0x32')]();};}function saveUpdates(_0x132a7e,_0x490a1e){return function(_0x5dfbc2){if(_0x5dfbc2){return _0x5dfbc2[_0xfd19('0x33')](_0x132a7e)[_0xfd19('0x1c')](function(_0x23e01a){return _0x23e01a;});}return null;};}function removeEntity(_0x2dc8fa,_0x28ef4d){return function(_0x73c30b){if(_0x73c30b){return _0x73c30b[_0xfd19('0x34')]()[_0xfd19('0x1c')](function(){_0x2dc8fa['status'](0xcc)[_0xfd19('0x29')]();});}};}function handleEntityNotFound(_0x22645e,_0x54058d){return function(_0x139004){if(!_0x139004){_0x22645e[_0xfd19('0x35')](0x194);}return _0x139004;};}function handleError(_0x2000fa,_0x57e154){_0x57e154=_0x57e154||0x1f4;return function(_0xacb1cf){logger[_0xfd19('0x22')](_0xacb1cf['stack']);if(_0xacb1cf[_0xfd19('0x36')]){delete _0xacb1cf['name'];}_0x2000fa[_0xfd19('0x28')](_0x57e154)[_0xfd19('0x37')](_0xacb1cf);};}exports['index']=function(_0x47d3b8,_0x8b1a39){var _0x44d5d9={},_0x53b033={},_0xa0673a={'count':0x0,'rows':[]};var _0x975ac3=_[_0xfd19('0x38')](db['ZendeskAccount'][_0xfd19('0x39')],function(_0x18acee){return{'name':_0x18acee[_0xfd19('0x3a')],'type':_0x18acee[_0xfd19('0x3b')]['key']};});_0x53b033[_0xfd19('0x3c')]=_[_0xfd19('0x38')](_0x975ac3,_0xfd19('0x36'));_0x53b033[_0xfd19('0x3d')]=_[_0xfd19('0x3e')](_0x47d3b8[_0xfd19('0x3d')]);_0x53b033[_0xfd19('0x3f')]=_['intersection'](_0x53b033[_0xfd19('0x3c')],_0x53b033['query']);_0x44d5d9[_0xfd19('0x40')]=_[_0xfd19('0x41')](_0x53b033[_0xfd19('0x3c')],qs[_0xfd19('0x42')](_0x47d3b8['query'][_0xfd19('0x42')]));_0x44d5d9[_0xfd19('0x40')]=_0x44d5d9[_0xfd19('0x40')][_0xfd19('0x43')]?_0x44d5d9['attributes']:_0x53b033[_0xfd19('0x3c')];if(!_0x47d3b8[_0xfd19('0x3d')][_0xfd19('0x44')](_0xfd19('0x45'))){_0x44d5d9['limit']=qs[_0xfd19('0x2d')](_0x47d3b8[_0xfd19('0x3d')]['limit']);_0x44d5d9[_0xfd19('0x2c')]=qs[_0xfd19('0x2c')](_0x47d3b8[_0xfd19('0x3d')][_0xfd19('0x2c')]);}_0x44d5d9[_0xfd19('0x46')]=qs['sort'](_0x47d3b8[_0xfd19('0x3d')][_0xfd19('0x47')]);_0x44d5d9[_0xfd19('0x48')]=qs[_0xfd19('0x3f')](_[_0xfd19('0x49')](_0x47d3b8['query'],_0x53b033[_0xfd19('0x3f')]));if(_0x47d3b8['query'][_0xfd19('0x4a')]){_0x44d5d9[_0xfd19('0x48')]=_['merge'](_0x44d5d9[_0xfd19('0x48')],{'$or':_[_0xfd19('0x38')](_0x975ac3,function(_0x165d58){if(_0x165d58[_0xfd19('0x3b')]!==_0xfd19('0x4b')){var _0x35f4bd={};_0x35f4bd[_0x165d58[_0xfd19('0x36')]]={'$like':'%'+_0x47d3b8[_0xfd19('0x3d')][_0xfd19('0x4a')]+'%'};return _0x35f4bd;}})});}_0x44d5d9=_[_0xfd19('0x4c')]({},_0x44d5d9,_0x47d3b8['options']);var _0xa92c8a={'where':_0x44d5d9[_0xfd19('0x48')]};return db[_0xfd19('0x4d')][_0xfd19('0x2b')](_0xa92c8a)[_0xfd19('0x1c')](function(_0x4b9f1c){_0xa0673a['count']=_0x4b9f1c;if(_0x47d3b8[_0xfd19('0x3d')][_0xfd19('0x4e')]){_0x44d5d9[_0xfd19('0x4f')]=[{'all':!![]}];}return db[_0xfd19('0x4d')]['findAll'](_0x44d5d9);})['then'](function(_0x29464a){_0xa0673a[_0xfd19('0x50')]=_0x29464a;return _0xa0673a;})[_0xfd19('0x1c')](respondWithFilteredResult(_0x8b1a39,_0x44d5d9))['catch'](handleError(_0x8b1a39,null));};exports[_0xfd19('0x51')]=function(_0x43d1ac,_0x58bd48){var _0x2d481b={'raw':![],'where':{'id':_0x43d1ac[_0xfd19('0x52')]['id']}},_0xd3cb20={};_0xd3cb20[_0xfd19('0x3c')]=_[_0xfd19('0x3e')](db[_0xfd19('0x4d')][_0xfd19('0x39')]);_0xd3cb20[_0xfd19('0x3d')]=_['keys'](_0x43d1ac[_0xfd19('0x3d')]);_0xd3cb20[_0xfd19('0x3f')]=_['intersection'](_0xd3cb20[_0xfd19('0x3c')],_0xd3cb20[_0xfd19('0x3d')]);_0x2d481b['attributes']=_['intersection'](_0xd3cb20[_0xfd19('0x3c')],qs[_0xfd19('0x42')](_0x43d1ac[_0xfd19('0x3d')][_0xfd19('0x42')]));_0x2d481b[_0xfd19('0x40')]=_0x2d481b[_0xfd19('0x40')][_0xfd19('0x43')]?_0x2d481b['attributes']:_0xd3cb20['model'];if(_0x43d1ac['query'][_0xfd19('0x4e')]){_0x2d481b[_0xfd19('0x4f')]=[{'all':!![]}];}_0x2d481b=_[_0xfd19('0x4c')]({},_0x2d481b,_0x43d1ac['options']);return db[_0xfd19('0x4d')][_0xfd19('0x53')](_0x2d481b)[_0xfd19('0x1c')](handleEntityNotFound(_0x58bd48,null))[_0xfd19('0x1c')](respondWithResult(_0x58bd48,null))[_0xfd19('0x27')](handleError(_0x58bd48,null));};exports[_0xfd19('0x54')]=function(_0x28718b,_0x39581c){return db[_0xfd19('0x4d')][_0xfd19('0x54')](_0x28718b[_0xfd19('0x55')],{})[_0xfd19('0x1c')](respondWithResult(_0x39581c,0xc9))[_0xfd19('0x27')](handleError(_0x39581c,null));};exports[_0xfd19('0x33')]=function(_0x44c02b,_0x11fd0a){if(_0x44c02b[_0xfd19('0x55')]['id']){delete _0x44c02b[_0xfd19('0x55')]['id'];}return db['ZendeskAccount']['find']({'where':{'id':_0x44c02b[_0xfd19('0x52')]['id']}})[_0xfd19('0x1c')](handleEntityNotFound(_0x11fd0a,null))[_0xfd19('0x1c')](saveUpdates(_0x44c02b[_0xfd19('0x55')],null))[_0xfd19('0x1c')](respondWithResult(_0x11fd0a,null))[_0xfd19('0x27')](handleError(_0x11fd0a,null));};exports[_0xfd19('0x34')]=function(_0x55a30a,_0x4d29cf){return db[_0xfd19('0x4d')][_0xfd19('0x53')]({'where':{'id':_0x55a30a[_0xfd19('0x52')]['id']}})[_0xfd19('0x1c')](handleEntityNotFound(_0x4d29cf,null))[_0xfd19('0x1c')](removeEntity(_0x4d29cf,null))[_0xfd19('0x27')](handleError(_0x4d29cf,null));};exports[_0xfd19('0x56')]=function(_0x3f6c3a,_0x1a266b,_0x1d0d41){var _0x178450={};var _0x3bb359={};var _0x2a635a;var _0x496626;return db[_0xfd19('0x4d')][_0xfd19('0x57')]({'where':{'id':_0x3f6c3a[_0xfd19('0x52')]['id']}})[_0xfd19('0x1c')](handleEntityNotFound(_0x1a266b,null))[_0xfd19('0x1c')](function(_0x4a4516){if(_0x4a4516){_0x2a635a=_0x4a4516;_0x3bb359[_0xfd19('0x3c')]=_[_0xfd19('0x3e')](db['ZendeskConfiguration']['rawAttributes']);_0x3bb359[_0xfd19('0x3d')]=_[_0xfd19('0x3e')](_0x3f6c3a[_0xfd19('0x3d')]);_0x3bb359[_0xfd19('0x3f')]=_['intersection'](_0x3bb359[_0xfd19('0x3c')],_0x3bb359[_0xfd19('0x3d')]);_0x178450[_0xfd19('0x40')]=_['intersection'](_0x3bb359[_0xfd19('0x3c')],qs[_0xfd19('0x42')](_0x3f6c3a[_0xfd19('0x3d')]['fields']));_0x178450[_0xfd19('0x40')]=_0x178450[_0xfd19('0x40')][_0xfd19('0x43')]?_0x178450[_0xfd19('0x40')]:_0x3bb359[_0xfd19('0x3c')];_0x178450[_0xfd19('0x46')]=qs[_0xfd19('0x47')](_0x3f6c3a['query'][_0xfd19('0x47')]);_0x178450[_0xfd19('0x48')]=qs[_0xfd19('0x3f')](_[_0xfd19('0x49')](_0x3f6c3a['query'],_0x3bb359[_0xfd19('0x3f')]));if(_0x3f6c3a[_0xfd19('0x3d')][_0xfd19('0x4a')]){_0x178450[_0xfd19('0x48')]=_[_0xfd19('0x4c')](_0x178450['where'],{'$or':_[_0xfd19('0x38')](_0x178450[_0xfd19('0x40')],function(_0x2cecad){var _0x3ce13f={};_0x3ce13f[_0x2cecad]={'$like':'%'+_0x3f6c3a['query']['filter']+'%'};return _0x3ce13f;})});}_0x178450=_[_0xfd19('0x4c')]({},_0x178450,_0x3f6c3a['options']);return _0x2a635a[_0xfd19('0x56')](_0x178450);}})[_0xfd19('0x1c')](function(_0xc99191){if(_0xc99191){_0x496626=_0xc99191['length'];if(!_0x3f6c3a[_0xfd19('0x3d')]['hasOwnProperty'](_0xfd19('0x45'))){_0x178450[_0xfd19('0x2d')]=qs[_0xfd19('0x2d')](_0x3f6c3a[_0xfd19('0x3d')]['limit']);_0x178450[_0xfd19('0x2c')]=qs[_0xfd19('0x2c')](_0x3f6c3a['query'][_0xfd19('0x2c')]);}return _0x2a635a['getConfigurations'](_0x178450);}})['then'](function(_0x3c621f){if(_0x3c621f){return _0x3c621f?{'count':_0x496626,'rows':_0x3c621f}:null;}})[_0xfd19('0x1c')](respondWithResult(_0x1a266b,null))['catch'](handleError(_0x1a266b,null));};exports[_0xfd19('0x58')]=function(_0x1389a9,_0x24ff69,_0x35bb6c){if(_0x1389a9[_0xfd19('0x55')]['id']){delete _0x1389a9['body']['id'];}return db[_0xfd19('0x4d')]['findOne']({'where':{'id':_0x1389a9[_0xfd19('0x52')]['id']}})['then'](handleEntityNotFound(_0x24ff69,null))[_0xfd19('0x1c')](function(_0x359bed){if(_0x359bed){_0x1389a9[_0xfd19('0x55')][_0xfd19('0x59')]=_0x359bed['id'];_0x1389a9[_0xfd19('0x55')]['Subjects']=integrations[_0xfd19('0x5a')](_0x1389a9['body'][_0xfd19('0x5b')],_0x1389a9['body'][_0xfd19('0x3b')]);_0x1389a9[_0xfd19('0x55')]['Descriptions']=integrations[_0xfd19('0x5c')](_0x1389a9[_0xfd19('0x55')][_0xfd19('0x5b')],_0x1389a9[_0xfd19('0x55')][_0xfd19('0x3b')]);return db['ZendeskConfiguration'][_0xfd19('0x54')](_0x1389a9['body'],{'include':[{'model':db['ZendeskField'],'as':_0xfd19('0x5d')},{'model':db[_0xfd19('0x5e')],'as':_0xfd19('0x5f')}]});}return null;})[_0xfd19('0x1c')](respondWithResult(_0x24ff69,null))[_0xfd19('0x27')](handleError(_0x24ff69,null));};exports[_0xfd19('0x60')]=function(_0x20d747,_0x5a4402,_0x5a9ab9){var _0x4cc2d0='';return db[_0xfd19('0x4d')]['findOne']({'where':{'id':_0x20d747[_0xfd19('0x52')]['id']},'attributes':['id','username',_0xfd19('0x61'),'token',_0xfd19('0x62'),_0xfd19('0x63')]})[_0xfd19('0x1c')](handleEntityNotFound(_0x5a4402,null))[_0xfd19('0x1c')](function(_0x5e665b){if(_0x5e665b){_0x4cc2d0=_0x5e665b['remoteUri'];var _0x1661b3=_0x4cc2d0['slice'](-0x1);if(_0x1661b3==='/'){_0x4cc2d0=_0x4cc2d0['substring'](0x0,_0x4cc2d0[_0xfd19('0x64')](_0x1661b3));}var _0x3709b9={'method':_0xfd19('0x65'),'uri':util[_0xfd19('0x66')]('%s/%s',_0x4cc2d0,_0xfd19('0x67')),'json':!![]};switch(_0x5e665b['authType']){case _0xfd19('0x61'):_0x3709b9[_0xfd19('0x68')]={'Authorization':util[_0xfd19('0x66')](_0xfd19('0x69'),new Buffer(util[_0xfd19('0x66')]('%s:%s',_0x5e665b[_0xfd19('0x6a')],_0x5e665b['password']))['toString']('base64'))};break;case _0xfd19('0x6b'):_0x3709b9['headers']={'Authorization':util[_0xfd19('0x66')](_0xfd19('0x69'),new Buffer(util[_0xfd19('0x66')](_0xfd19('0x6c'),_0x5e665b['username'],_0x5e665b[_0xfd19('0x6b')]))['toString'](_0xfd19('0x6d')))};break;default:throw new db[(_0xfd19('0x19'))][(_0xfd19('0x6e'))](_0xfd19('0x6f'));}return rp(_0x3709b9);}})[_0xfd19('0x1c')](function(_0x10e6d0){if(_0x10e6d0){var _0x1f4fb1=['subject','description',_0xfd19('0x70'),_0xfd19('0x71')];_[_0xfd19('0x72')](_0x10e6d0[_0xfd19('0x67')],function(_0x18a1ae){return _0x1f4fb1[_0xfd19('0x73')](_0x18a1ae['type']);});return{'count':_0x10e6d0[_0xfd19('0x67')]['length'],'rows':_['map'](_0x10e6d0[_0xfd19('0x67')],function(_0x513244){return{'id':_0x513244['id'],'name':_0x513244[_0xfd19('0x74')]>0x7?_0x513244[_0xfd19('0x75')]:_0x513244[_0xfd19('0x3b')],'custom':_0x513244['position']>0x7?!![]:![],'options':_0x513244[_0xfd19('0x76')]?_0x513244[_0xfd19('0x76')]:_0x513244['custom_field_options']?_0x513244[_0xfd19('0x77')]:[]};})};}})['then'](respondWithResult(_0x5a4402,null))[_0xfd19('0x27')](function(_0x38ce87){var _0x23a14f=_0x20d747[_0xfd19('0x3d')][_0xfd19('0x18')]?0x1f4:_0x38ce87[_0xfd19('0x78')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x23a14f,JSON[_0xfd19('0x21')](_0x38ce87));delete _0x38ce87[_0xfd19('0x36')];if(_0x23a14f===0x191){_0x23a14f=0x190;}_0x5a4402[_0xfd19('0x28')](_0x23a14f)[_0xfd19('0x37')](_0x20d747[_0xfd19('0x3d')][_0xfd19('0x18')]?{'message':_0xfd19('0x79'),'statusCode':_0x38ce87[_0xfd19('0x78')]}:_0x38ce87);});}; \ No newline at end of file +var _0x5057=['%s:%s','toString','base64','Basic\x20%s','%s/token:%s','Sequelize','Unknown\x20authentication\x20type','subject','assignee','remove','includes','position','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','test','ValidationError','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','params','includeAll','find','create','body','catch','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','format','%s/%s','ticket_fields','headers'];(function(_0x435117,_0x2b9bad){var _0x585a63=function(_0x32c270){while(--_0x32c270){_0x435117['push'](_0x435117['shift']());}};_0x585a63(++_0x2b9bad);}(_0x5057,0x197));var _0x7505=function(_0x110194,_0x47d937){_0x110194=_0x110194-0x0;var _0x22d6ec=_0x5057[_0x110194];return _0x22d6ec;};'use strict';var pdf=require(_0x7505('0x0'));var emlformat=require(_0x7505('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7505('0x2'));var rp=require(_0x7505('0x3'));var moment=require(_0x7505('0x4'));var BPromise=require(_0x7505('0x5'));var Mustache=require(_0x7505('0x6'));var util=require(_0x7505('0x7'));var path=require('path');var sox=require(_0x7505('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7505('0x9'));var crypto=require(_0x7505('0xa'));var jsforce=require(_0x7505('0xb'));var deskjs=require(_0x7505('0xc'));var toCsv=require(_0x7505('0xd'));var querystring=require(_0x7505('0xe'));var Papa=require('papaparse');var Redis=require(_0x7505('0xf'));var authService=require(_0x7505('0x10'));var qs=require(_0x7505('0x11'));var as=require(_0x7505('0x12'));var hardwareService=require(_0x7505('0x13'));var logger=require(_0x7505('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7505('0x15'));var db=require(_0x7505('0x16'))['db'];var integrations=require(_0x7505('0x17'));var jayson=require('jayson/promise');var client=jayson[_0x7505('0x18')][_0x7505('0x19')]({'port':0x232a});function checkPasswordPattern(_0x7bc067,_0x429497,_0x5cbe7c){if(_0x5cbe7c){var _0x41b8ae=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x41b8ae[_0x7505('0x1a')](_0x429497)){return _0x7bc067;}else{throw new db['Sequelize'][(_0x7505('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 _0x7bc067;}}function respondWithRpcPromise(_0x220470,_0x4f8ad8,_0x46f293,_0x5d70f8){return new BPromise(function(_0x590dd3,_0x4b8cc6){var _0x2ce884=_0x5d70f8||client;return _0x2ce884[_0x7505('0x1c')](_0x220470,_0x46f293)['then'](function(_0x339aab){logger[_0x7505('0x1d')](_0x7505('0x1e'),_0x4f8ad8,_0x7505('0x1f'));logger[_0x7505('0x20')](_0x7505('0x21'),_0x4f8ad8,_0x7505('0x1f'),JSON[_0x7505('0x22')](_0x339aab));if(_0x339aab[_0x7505('0x23')]){if(_0x339aab[_0x7505('0x23')]['code']===0x1f4){logger['error'](_0x7505('0x1e'),_0x4f8ad8,_0x339aab[_0x7505('0x23')][_0x7505('0x24')]);return _0x4b8cc6(_0x339aab[_0x7505('0x23')]['message']);}logger[_0x7505('0x23')](_0x7505('0x1e'),_0x4f8ad8,_0x339aab[_0x7505('0x23')][_0x7505('0x24')]);return _0x590dd3(_0x339aab['error'][_0x7505('0x24')]);}else{logger[_0x7505('0x1d')](_0x7505('0x1e'),_0x4f8ad8,_0x7505('0x1f'));_0x590dd3(_0x339aab[_0x7505('0x25')]['message']);}})['catch'](function(_0x382825){logger[_0x7505('0x23')](_0x7505('0x1e'),_0x4f8ad8,_0x382825);_0x4b8cc6(_0x382825);});});}function respondWithStatusCode(_0x25537f,_0x2cbc21){_0x2cbc21=_0x2cbc21||0xcc;return function(_0x2cd5c8){if(_0x2cd5c8){return _0x25537f['sendStatus'](_0x2cbc21);}return _0x25537f[_0x7505('0x26')](_0x2cbc21)[_0x7505('0x27')]();};}function respondWithResult(_0x47b707,_0x25b48e){_0x25b48e=_0x25b48e||0xc8;return function(_0x28259d){if(_0x28259d){return _0x47b707[_0x7505('0x26')](_0x25b48e)[_0x7505('0x28')](_0x28259d);}};}function respondWithFilteredResult(_0x41da12,_0x123c9b){return function(_0x57ac92){if(_0x57ac92){var _0x576239=_0x57ac92[_0x7505('0x29')],_0xb26cc2=_0x123c9b['offset'],_0x4d87e5=_0x123c9b[_0x7505('0x2a')]+_0x123c9b[_0x7505('0x2b')],_0x482c53;if(_0x4d87e5>=_0x576239){_0x4d87e5=_0x576239;_0x482c53=0xc8;}else{_0x482c53=0xce;}_0x41da12[_0x7505('0x26')](_0x482c53);return _0x41da12[_0x7505('0x2c')](_0x7505('0x2d'),_0xb26cc2+'-'+_0x4d87e5+'/'+_0x576239)[_0x7505('0x28')](_0x57ac92);}return null;};}function patchUpdates(_0x17b69b){return function(_0x52d183){try{jsonpatch[_0x7505('0x2e')](_0x52d183,_0x17b69b,!![]);}catch(_0x338459){return BPromise[_0x7505('0x2f')](_0x338459);}return _0x52d183[_0x7505('0x30')]();};}function saveUpdates(_0x39f9b4,_0x5d2870){return function(_0x3f3577){if(_0x3f3577){return _0x3f3577[_0x7505('0x31')](_0x39f9b4)[_0x7505('0x32')](function(_0x2c3e06){return _0x2c3e06;});}return null;};}function removeEntity(_0x5a698e,_0x11d99d){return function(_0x5e5f06){if(_0x5e5f06){return _0x5e5f06[_0x7505('0x33')]()[_0x7505('0x32')](function(){_0x5a698e[_0x7505('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33fbce,_0xd8a580){return function(_0x47c3a7){if(!_0x47c3a7){_0x33fbce[_0x7505('0x34')](0x194);}return _0x47c3a7;};}function handleError(_0x5cc3af,_0x31ce20){_0x31ce20=_0x31ce20||0x1f4;return function(_0x15bc39){logger['error'](_0x15bc39[_0x7505('0x35')]);if(_0x15bc39['name']){delete _0x15bc39[_0x7505('0x36')];}_0x5cc3af[_0x7505('0x26')](_0x31ce20)[_0x7505('0x37')](_0x15bc39);};}exports[_0x7505('0x38')]=function(_0x33e04d,_0x4e3504){var _0x3f8476={},_0x37b939={},_0xdcaeaf={'count':0x0,'rows':[]};var _0x3fefad=_[_0x7505('0x39')](db[_0x7505('0x3a')][_0x7505('0x3b')],function(_0x58ca85){return{'name':_0x58ca85[_0x7505('0x3c')],'type':_0x58ca85[_0x7505('0x3d')][_0x7505('0x3e')]};});_0x37b939[_0x7505('0x3f')]=_['map'](_0x3fefad,'name');_0x37b939['query']=_[_0x7505('0x40')](_0x33e04d['query']);_0x37b939[_0x7505('0x41')]=_[_0x7505('0x42')](_0x37b939[_0x7505('0x3f')],_0x37b939[_0x7505('0x43')]);_0x3f8476[_0x7505('0x44')]=_[_0x7505('0x42')](_0x37b939[_0x7505('0x3f')],qs[_0x7505('0x45')](_0x33e04d['query'][_0x7505('0x45')]));_0x3f8476[_0x7505('0x44')]=_0x3f8476[_0x7505('0x44')][_0x7505('0x46')]?_0x3f8476['attributes']:_0x37b939[_0x7505('0x3f')];if(!_0x33e04d[_0x7505('0x43')][_0x7505('0x47')](_0x7505('0x48'))){_0x3f8476['limit']=qs[_0x7505('0x2b')](_0x33e04d['query'][_0x7505('0x2b')]);_0x3f8476[_0x7505('0x2a')]=qs[_0x7505('0x2a')](_0x33e04d[_0x7505('0x43')][_0x7505('0x2a')]);}_0x3f8476[_0x7505('0x49')]=qs[_0x7505('0x4a')](_0x33e04d[_0x7505('0x43')][_0x7505('0x4a')]);_0x3f8476[_0x7505('0x4b')]=qs['filters'](_['pick'](_0x33e04d[_0x7505('0x43')],_0x37b939[_0x7505('0x41')]));if(_0x33e04d[_0x7505('0x43')][_0x7505('0x4c')]){_0x3f8476[_0x7505('0x4b')]=_['merge'](_0x3f8476[_0x7505('0x4b')],{'$or':_[_0x7505('0x39')](_0x3fefad,function(_0x55f2b8){if(_0x55f2b8[_0x7505('0x3d')]!==_0x7505('0x4d')){var _0x27e556={};_0x27e556[_0x55f2b8['name']]={'$like':'%'+_0x33e04d[_0x7505('0x43')][_0x7505('0x4c')]+'%'};return _0x27e556;}})});}_0x3f8476=_[_0x7505('0x4e')]({},_0x3f8476,_0x33e04d[_0x7505('0x4f')]);var _0x2bfd36={'where':_0x3f8476[_0x7505('0x4b')]};return db[_0x7505('0x3a')][_0x7505('0x29')](_0x2bfd36)[_0x7505('0x32')](function(_0x2db8fa){_0xdcaeaf[_0x7505('0x29')]=_0x2db8fa;if(_0x33e04d[_0x7505('0x43')]['includeAll']){_0x3f8476[_0x7505('0x50')]=[{'all':!![]}];}return db[_0x7505('0x3a')][_0x7505('0x51')](_0x3f8476);})[_0x7505('0x32')](function(_0x2318c6){_0xdcaeaf[_0x7505('0x52')]=_0x2318c6;return _0xdcaeaf;})['then'](respondWithFilteredResult(_0x4e3504,_0x3f8476))['catch'](handleError(_0x4e3504,null));};exports['show']=function(_0x3182e4,_0x171225){var _0x25654c={'raw':![],'where':{'id':_0x3182e4[_0x7505('0x53')]['id']}},_0x449a8f={};_0x449a8f['model']=_[_0x7505('0x40')](db[_0x7505('0x3a')][_0x7505('0x3b')]);_0x449a8f[_0x7505('0x43')]=_[_0x7505('0x40')](_0x3182e4[_0x7505('0x43')]);_0x449a8f[_0x7505('0x41')]=_[_0x7505('0x42')](_0x449a8f[_0x7505('0x3f')],_0x449a8f['query']);_0x25654c[_0x7505('0x44')]=_[_0x7505('0x42')](_0x449a8f[_0x7505('0x3f')],qs[_0x7505('0x45')](_0x3182e4[_0x7505('0x43')][_0x7505('0x45')]));_0x25654c[_0x7505('0x44')]=_0x25654c['attributes'][_0x7505('0x46')]?_0x25654c[_0x7505('0x44')]:_0x449a8f['model'];if(_0x3182e4[_0x7505('0x43')][_0x7505('0x54')]){_0x25654c[_0x7505('0x50')]=[{'all':!![]}];}_0x25654c=_[_0x7505('0x4e')]({},_0x25654c,_0x3182e4['options']);return db[_0x7505('0x3a')][_0x7505('0x55')](_0x25654c)[_0x7505('0x32')](handleEntityNotFound(_0x171225,null))['then'](respondWithResult(_0x171225,null))['catch'](handleError(_0x171225,null));};exports[_0x7505('0x56')]=function(_0x55e273,_0x5335e2){return db['ZendeskAccount'][_0x7505('0x56')](_0x55e273[_0x7505('0x57')],{})[_0x7505('0x32')](respondWithResult(_0x5335e2,0xc9))[_0x7505('0x58')](handleError(_0x5335e2,null));};exports[_0x7505('0x31')]=function(_0x55163f,_0x5c3848){if(_0x55163f[_0x7505('0x57')]['id']){delete _0x55163f[_0x7505('0x57')]['id'];}return db['ZendeskAccount']['find']({'where':{'id':_0x55163f[_0x7505('0x53')]['id']}})[_0x7505('0x32')](handleEntityNotFound(_0x5c3848,null))[_0x7505('0x32')](saveUpdates(_0x55163f[_0x7505('0x57')],null))[_0x7505('0x32')](respondWithResult(_0x5c3848,null))['catch'](handleError(_0x5c3848,null));};exports[_0x7505('0x33')]=function(_0x1cb3af,_0x26bfc6){return db[_0x7505('0x3a')]['find']({'where':{'id':_0x1cb3af[_0x7505('0x53')]['id']}})['then'](handleEntityNotFound(_0x26bfc6,null))[_0x7505('0x32')](removeEntity(_0x26bfc6,null))[_0x7505('0x58')](handleError(_0x26bfc6,null));};exports[_0x7505('0x59')]=function(_0x404b9b,_0x4111dc,_0x158e20){var _0x2045dc={};var _0x252e18={};var _0xff4b42;var _0x1cea4c;return db[_0x7505('0x3a')][_0x7505('0x5a')]({'where':{'id':_0x404b9b[_0x7505('0x53')]['id']}})[_0x7505('0x32')](handleEntityNotFound(_0x4111dc,null))[_0x7505('0x32')](function(_0x3ae68b){if(_0x3ae68b){_0xff4b42=_0x3ae68b;_0x252e18[_0x7505('0x3f')]=_[_0x7505('0x40')](db[_0x7505('0x5b')][_0x7505('0x3b')]);_0x252e18['query']=_[_0x7505('0x40')](_0x404b9b['query']);_0x252e18['filters']=_['intersection'](_0x252e18[_0x7505('0x3f')],_0x252e18[_0x7505('0x43')]);_0x2045dc[_0x7505('0x44')]=_[_0x7505('0x42')](_0x252e18[_0x7505('0x3f')],qs[_0x7505('0x45')](_0x404b9b['query'][_0x7505('0x45')]));_0x2045dc[_0x7505('0x44')]=_0x2045dc[_0x7505('0x44')][_0x7505('0x46')]?_0x2045dc[_0x7505('0x44')]:_0x252e18['model'];_0x2045dc['order']=qs[_0x7505('0x4a')](_0x404b9b[_0x7505('0x43')][_0x7505('0x4a')]);_0x2045dc[_0x7505('0x4b')]=qs[_0x7505('0x41')](_[_0x7505('0x5c')](_0x404b9b[_0x7505('0x43')],_0x252e18[_0x7505('0x41')]));if(_0x404b9b[_0x7505('0x43')][_0x7505('0x4c')]){_0x2045dc[_0x7505('0x4b')]=_[_0x7505('0x4e')](_0x2045dc[_0x7505('0x4b')],{'$or':_['map'](_0x2045dc[_0x7505('0x44')],function(_0x5701c8){var _0x3e62d0={};_0x3e62d0[_0x5701c8]={'$like':'%'+_0x404b9b['query'][_0x7505('0x4c')]+'%'};return _0x3e62d0;})});}_0x2045dc=_['merge']({},_0x2045dc,_0x404b9b['options']);return _0xff4b42['getConfigurations'](_0x2045dc);}})[_0x7505('0x32')](function(_0x7c0212){if(_0x7c0212){_0x1cea4c=_0x7c0212[_0x7505('0x46')];if(!_0x404b9b['query'][_0x7505('0x47')](_0x7505('0x48'))){_0x2045dc[_0x7505('0x2b')]=qs['limit'](_0x404b9b[_0x7505('0x43')][_0x7505('0x2b')]);_0x2045dc[_0x7505('0x2a')]=qs[_0x7505('0x2a')](_0x404b9b[_0x7505('0x43')][_0x7505('0x2a')]);}return _0xff4b42[_0x7505('0x59')](_0x2045dc);}})['then'](function(_0x368f15){if(_0x368f15){return _0x368f15?{'count':_0x1cea4c,'rows':_0x368f15}:null;}})[_0x7505('0x32')](respondWithResult(_0x4111dc,null))[_0x7505('0x58')](handleError(_0x4111dc,null));};exports[_0x7505('0x5d')]=function(_0x39bf36,_0x5acbbf,_0x5228a2){if(_0x39bf36[_0x7505('0x57')]['id']){delete _0x39bf36[_0x7505('0x57')]['id'];}return db[_0x7505('0x3a')]['findOne']({'where':{'id':_0x39bf36[_0x7505('0x53')]['id']}})[_0x7505('0x32')](handleEntityNotFound(_0x5acbbf,null))[_0x7505('0x32')](function(_0x2ae542){if(_0x2ae542){_0x39bf36[_0x7505('0x57')][_0x7505('0x5e')]=_0x2ae542['id'];_0x39bf36[_0x7505('0x57')][_0x7505('0x5f')]=integrations['getSubjects'](_0x39bf36[_0x7505('0x57')][_0x7505('0x60')],_0x39bf36[_0x7505('0x57')][_0x7505('0x3d')]);_0x39bf36[_0x7505('0x57')]['Descriptions']=integrations[_0x7505('0x61')](_0x39bf36[_0x7505('0x57')]['channel'],_0x39bf36['body'][_0x7505('0x3d')]);return db[_0x7505('0x5b')]['create'](_0x39bf36[_0x7505('0x57')],{'include':[{'model':db[_0x7505('0x62')],'as':_0x7505('0x5f')},{'model':db[_0x7505('0x62')],'as':_0x7505('0x63')}]});}return null;})[_0x7505('0x32')](respondWithResult(_0x5acbbf,null))[_0x7505('0x58')](handleError(_0x5acbbf,null));};exports[_0x7505('0x64')]=function(_0x40a3ac,_0x1bb989,_0xfb7b99){var _0x2d5938='';return db[_0x7505('0x3a')][_0x7505('0x5a')]({'where':{'id':_0x40a3ac[_0x7505('0x53')]['id']},'attributes':['id',_0x7505('0x65'),_0x7505('0x66'),_0x7505('0x67'),_0x7505('0x68'),_0x7505('0x69')]})[_0x7505('0x32')](handleEntityNotFound(_0x1bb989,null))[_0x7505('0x32')](function(_0x110fd9){if(_0x110fd9){_0x2d5938=_0x110fd9[_0x7505('0x69')];var _0x2f90ad=_0x2d5938[_0x7505('0x6a')](-0x1);if(_0x2f90ad==='/'){_0x2d5938=_0x2d5938[_0x7505('0x6b')](0x0,_0x2d5938[_0x7505('0x6c')](_0x2f90ad));}var _0x11eb3c={'method':'GET','uri':util[_0x7505('0x6d')](_0x7505('0x6e'),_0x2d5938,_0x7505('0x6f')),'json':!![]};switch(_0x110fd9[_0x7505('0x68')]){case _0x7505('0x66'):_0x11eb3c[_0x7505('0x70')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x7505('0x6d')](_0x7505('0x71'),_0x110fd9['username'],_0x110fd9['password']))[_0x7505('0x72')](_0x7505('0x73')))};break;case _0x7505('0x67'):_0x11eb3c[_0x7505('0x70')]={'Authorization':util[_0x7505('0x6d')](_0x7505('0x74'),new Buffer(util[_0x7505('0x6d')](_0x7505('0x75'),_0x110fd9[_0x7505('0x65')],_0x110fd9['token']))['toString'](_0x7505('0x73')))};break;default:throw new db[(_0x7505('0x76'))][(_0x7505('0x1b'))](_0x7505('0x77'));}return rp(_0x11eb3c);}})[_0x7505('0x32')](function(_0x4d2c2c){if(_0x4d2c2c){var _0x387112=[_0x7505('0x78'),'description','group',_0x7505('0x79')];_[_0x7505('0x7a')](_0x4d2c2c['ticket_fields'],function(_0x1a8a56){return _0x387112[_0x7505('0x7b')](_0x1a8a56[_0x7505('0x3d')]);});return{'count':_0x4d2c2c[_0x7505('0x6f')][_0x7505('0x46')],'rows':_[_0x7505('0x39')](_0x4d2c2c[_0x7505('0x6f')],function(_0x1f3d4f){return{'id':_0x1f3d4f['id'],'name':_0x1f3d4f[_0x7505('0x7c')]>0x7?_0x1f3d4f['title']:_0x1f3d4f[_0x7505('0x3d')],'custom':_0x1f3d4f[_0x7505('0x7c')]>0x7?!![]:![],'options':_0x1f3d4f[_0x7505('0x7d')]?_0x1f3d4f['system_field_options']:_0x1f3d4f[_0x7505('0x7e')]?_0x1f3d4f[_0x7505('0x7e')]:[]};})};}})[_0x7505('0x32')](respondWithResult(_0x1bb989,null))[_0x7505('0x58')](function(_0x35d772){var _0x4379d6=_0x40a3ac[_0x7505('0x43')]['test']?0x1f4:_0x35d772[_0x7505('0x7f')]||0x1f4;logger[_0x7505('0x23')](_0x7505('0x80'),'getFields',_0x4379d6,JSON['stringify'](_0x35d772));delete _0x35d772['name'];if(_0x4379d6===0x191){_0x4379d6=0x190;}_0x1bb989['status'](_0x4379d6)[_0x7505('0x37')](_0x40a3ac['query'][_0x7505('0x1a')]?{'message':_0x7505('0x81'),'statusCode':_0x35d772[_0x7505('0x7f')]}:_0x35d772);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 41aa285..49af13c 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 _0x056a=['request-promise','rimraf','../../components/integrations/configuration','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x056a,0x158));var _0xa056=function(_0x1067d5,_0x2f7e78){_0x1067d5=_0x1067d5-0x0;var _0x116548=_0x056a[_0x1067d5];return _0x116548;};'use strict';var _=require(_0xa056('0x0'));var util=require(_0xa056('0x1'));var logger=require(_0xa056('0x2'))(_0xa056('0x3'));var moment=require(_0xa056('0x4'));var BPromise=require(_0xa056('0x5'));var rp=require(_0xa056('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa056('0x7'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xa056('0x8'));module['exports']=function(_0x19e9ad,_0x1b2f8f){return _0x19e9ad['define']('ZendeskAccount',attributes,{'tableName':_0xa056('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b0b=['bluebird','request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','moment'];(function(_0x366e60,_0x50cda5){var _0x39eb8c=function(_0x5bff94){while(--_0x5bff94){_0x366e60['push'](_0x366e60['shift']());}};_0x39eb8c(++_0x50cda5);}(_0x4b0b,0x195));var _0xb4b0=function(_0x225295,_0x3a321c){_0x225295=_0x225295-0x0;var _0x441445=_0x4b0b[_0x225295];return _0x441445;};'use strict';var _=require('lodash');var util=require(_0xb4b0('0x0'));var logger=require(_0xb4b0('0x1'))('api');var moment=require(_0xb4b0('0x2'));var BPromise=require(_0xb4b0('0x3'));var rp=require(_0xb4b0('0x4'));var fs=require('fs');var path=require(_0xb4b0('0x5'));var rimraf=require('rimraf');var config=require(_0xb4b0('0x6'));var attributes=require(_0xb4b0('0x7'));var integrations=require(_0xb4b0('0x8'));module['exports']=function(_0x83d089,_0x545e4a){return _0x83d089[_0xb4b0('0x9')](_0xb4b0('0xa'),attributes,{'tableName':_0xb4b0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 5fbf4ec..34ec314 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','include','map','model','then','ShowZendeskAccount','find','where','moment','bluebird','randomstring','ioredis'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2c2980,_0x34282a){_0x2c2980=_0x2c2980-0x0;var _0x2a20a9=_0xcb91[_0x2c2980];return _0x2a20a9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')]({'raw':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x18')]===undefined?!![]:![]:!![],'where':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['where']||null:null,'attributes':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options'][_0x1cb9('0x19')]||null:null,'limit':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['limit']||null:null,'include':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x59ebea){return{'model':db[_0x59ebea['model']],'as':_0x59ebea['as'],'attributes':_0x59ebea[_0x1cb9('0x19')],'include':_0x59ebea['include']?_[_0x1cb9('0x1b')](_0x59ebea[_0x1cb9('0x1a')],function(_0x69b4c8){return{'model':db[_0x69b4c8[_0x1cb9('0x1c')]],'as':_0x69b4c8['as'],'attributes':_0x69b4c8[_0x1cb9('0x19')],'include':_0x69b4c8['include']?_[_0x1cb9('0x1b')](_0x69b4c8[_0x1cb9('0x1a')],function(_0x4c8d76){return{'model':db[_0x4c8d76[_0x1cb9('0x1c')]],'as':_0x4c8d76['as'],'attributes':_0x4c8d76[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x1804fd){logger[_0x1cb9('0xa')](_0x1cb9('0x14'),_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON[_0x1cb9('0xf')](_0x1804fd));_0x479d43(_0x1804fd);})[_0x1cb9('0x13')](function(_0x48888d){logger[_0x1cb9('0x10')]('GetZendeskAccount',_0x48888d[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340['error'](0x1f4,_0x48888d[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x1e')]=function(_0x3cd7f5){var _0x2038aa=this;return new Promise(function(_0x561d89,_0x1c701f){return db['ZendeskAccount'][_0x1cb9('0x1f')]({'raw':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5['options'][_0x1cb9('0x20')]||null:null,'attributes':_0x3cd7f5['options']?_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x19')]||null:null,'include':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['include']?_[_0x1cb9('0x1b')](_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x91a1db){return{'model':db[_0x91a1db[_0x1cb9('0x1c')]],'as':_0x91a1db['as'],'attributes':_0x91a1db[_0x1cb9('0x19')],'include':_0x91a1db[_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x91a1db[_0x1cb9('0x1a')],function(_0x1de287){return{'model':db[_0x1de287[_0x1cb9('0x1c')]],'as':_0x1de287['as'],'attributes':_0x1de287[_0x1cb9('0x19')],'include':_0x1de287[_0x1cb9('0x1a')]?_['map'](_0x1de287['include'],function(_0x299ff8){return{'model':db[_0x299ff8[_0x1cb9('0x1c')]],'as':_0x299ff8['as'],'attributes':_0x299ff8[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x385daa){logger[_0x1cb9('0xa')](_0x1cb9('0x1e'),_0x3cd7f5);logger[_0x1cb9('0xd')]('ShowZendeskAccount',_0x3cd7f5,JSON[_0x1cb9('0xf')](_0x385daa));_0x561d89(_0x385daa);})[_0x1cb9('0x13')](function(_0xefe136){logger['error'](_0x1cb9('0x1e'),_0xefe136['message'],_0x3cd7f5);_0x1c701f(_0x2038aa[_0x1cb9('0x10')](0x1f4,_0xefe136['message']));});});}; \ No newline at end of file +var _0xcb91=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','include','map','model','then','ShowZendeskAccount','find','where','moment','bluebird','randomstring','ioredis'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0xcb91[_0x2d61b2];return _0x12df89;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')]({'raw':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x18')]===undefined?!![]:![]:!![],'where':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['where']||null:null,'attributes':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options'][_0x1cb9('0x19')]||null:null,'limit':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['limit']||null:null,'include':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x59ebea){return{'model':db[_0x59ebea['model']],'as':_0x59ebea['as'],'attributes':_0x59ebea[_0x1cb9('0x19')],'include':_0x59ebea['include']?_[_0x1cb9('0x1b')](_0x59ebea[_0x1cb9('0x1a')],function(_0x69b4c8){return{'model':db[_0x69b4c8[_0x1cb9('0x1c')]],'as':_0x69b4c8['as'],'attributes':_0x69b4c8[_0x1cb9('0x19')],'include':_0x69b4c8['include']?_[_0x1cb9('0x1b')](_0x69b4c8[_0x1cb9('0x1a')],function(_0x4c8d76){return{'model':db[_0x4c8d76[_0x1cb9('0x1c')]],'as':_0x4c8d76['as'],'attributes':_0x4c8d76[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x1804fd){logger[_0x1cb9('0xa')](_0x1cb9('0x14'),_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON[_0x1cb9('0xf')](_0x1804fd));_0x479d43(_0x1804fd);})[_0x1cb9('0x13')](function(_0x48888d){logger[_0x1cb9('0x10')]('GetZendeskAccount',_0x48888d[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340['error'](0x1f4,_0x48888d[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x1e')]=function(_0x3cd7f5){var _0x2038aa=this;return new Promise(function(_0x561d89,_0x1c701f){return db['ZendeskAccount'][_0x1cb9('0x1f')]({'raw':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5['options'][_0x1cb9('0x20')]||null:null,'attributes':_0x3cd7f5['options']?_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x19')]||null:null,'include':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['include']?_[_0x1cb9('0x1b')](_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x91a1db){return{'model':db[_0x91a1db[_0x1cb9('0x1c')]],'as':_0x91a1db['as'],'attributes':_0x91a1db[_0x1cb9('0x19')],'include':_0x91a1db[_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x91a1db[_0x1cb9('0x1a')],function(_0x1de287){return{'model':db[_0x1de287[_0x1cb9('0x1c')]],'as':_0x1de287['as'],'attributes':_0x1de287[_0x1cb9('0x19')],'include':_0x1de287[_0x1cb9('0x1a')]?_['map'](_0x1de287['include'],function(_0x299ff8){return{'model':db[_0x299ff8[_0x1cb9('0x1c')]],'as':_0x299ff8['as'],'attributes':_0x299ff8[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x385daa){logger[_0x1cb9('0xa')](_0x1cb9('0x1e'),_0x3cd7f5);logger[_0x1cb9('0xd')]('ShowZendeskAccount',_0x3cd7f5,JSON[_0x1cb9('0xf')](_0x385daa));_0x561d89(_0x385daa);})[_0x1cb9('0x13')](function(_0xefe136){logger['error'](_0x1cb9('0x1e'),_0xefe136['message'],_0x3cd7f5);_0x1c701f(_0x2038aa[_0x1cb9('0x10')](0x1f4,_0xefe136['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 876c321..cb7da08 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 _0x54f5=['/:id/tags','post','setTags','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions'];(function(_0x2023e1,_0xeca985){var _0x1fe133=function(_0x526d5f){while(--_0x526d5f){_0x2023e1['push'](_0x2023e1['shift']());}};_0x1fe133(++_0xeca985);}(_0x54f5,0x67));var _0x554f=function(_0x43941d,_0x45fd0d){_0x43941d=_0x43941d-0x0;var _0x27b82a=_0x54f5[_0x43941d];return _0x27b82a;};'use strict';var multer=require(_0x554f('0x0'));var util=require(_0x554f('0x1'));var path=require(_0x554f('0x2'));var timeout=require('connect-timeout');var express=require(_0x554f('0x3'));var router=express[_0x554f('0x4')]();var auth=require(_0x554f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x554f('0x6'));var controller=require(_0x554f('0x7'));router[_0x554f('0x8')]('/',auth[_0x554f('0x9')](),controller[_0x554f('0xa')]);router[_0x554f('0x8')](_0x554f('0xb'),auth[_0x554f('0x9')](),controller[_0x554f('0xc')]);router[_0x554f('0x8')](_0x554f('0xd'),auth[_0x554f('0x9')](),controller[_0x554f('0xe')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x554f('0x8')](_0x554f('0xf'),auth['isAuthenticated'](),controller[_0x554f('0x10')]);router[_0x554f('0x8')](_0x554f('0x11'),auth['isAuthenticated'](),controller['getTags']);router[_0x554f('0x12')]('/',auth[_0x554f('0x9')](),controller['create']);router[_0x554f('0x12')](_0x554f('0x11'),auth[_0x554f('0x9')](),controller[_0x554f('0x13')]);router[_0x554f('0x14')](_0x554f('0xb'),auth[_0x554f('0x9')](),controller[_0x554f('0x15')]);router[_0x554f('0x16')]('/:id',auth[_0x554f('0x9')](),controller['destroy']);module[_0x554f('0x17')]=router; \ No newline at end of file +var _0x0dd9=['put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','getTags','post','create','/:id/tags','setTags'];(function(_0x25d4e5,_0x30b67f){var _0x44d116=function(_0x3011c2){while(--_0x3011c2){_0x25d4e5['push'](_0x25d4e5['shift']());}};_0x44d116(++_0x30b67f);}(_0x0dd9,0x1a8));var _0x90dd=function(_0x5a4c04,_0x28f553){_0x5a4c04=_0x5a4c04-0x0;var _0x168fd1=_0x0dd9[_0x5a4c04];return _0x168fd1;};'use strict';var multer=require('multer');var util=require(_0x90dd('0x0'));var path=require(_0x90dd('0x1'));var timeout=require(_0x90dd('0x2'));var express=require(_0x90dd('0x3'));var router=express[_0x90dd('0x4')]();var auth=require(_0x90dd('0x5'));var interaction=require(_0x90dd('0x6'));var config=require(_0x90dd('0x7'));var controller=require(_0x90dd('0x8'));router[_0x90dd('0x9')]('/',auth[_0x90dd('0xa')](),controller[_0x90dd('0xb')]);router[_0x90dd('0x9')](_0x90dd('0xc'),auth['isAuthenticated'](),controller[_0x90dd('0xd')]);router[_0x90dd('0x9')](_0x90dd('0xe'),auth[_0x90dd('0xa')](),controller[_0x90dd('0xf')]);router['get'](_0x90dd('0x10'),auth[_0x90dd('0xa')](),controller[_0x90dd('0x11')]);router[_0x90dd('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x90dd('0x12')]);router[_0x90dd('0x9')]('/:id/tags',auth[_0x90dd('0xa')](),controller[_0x90dd('0x13')]);router[_0x90dd('0x14')]('/',auth['isAuthenticated'](),controller[_0x90dd('0x15')]);router[_0x90dd('0x14')](_0x90dd('0x16'),auth['isAuthenticated'](),controller[_0x90dd('0x17')]);router[_0x90dd('0x18')](_0x90dd('0xc'),auth[_0x90dd('0xa')](),controller['update']);router[_0x90dd('0x19')]('/:id',auth[_0x90dd('0xa')](),controller[_0x90dd('0x1a')]);module[_0x90dd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 90eb460..2e984f4 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 _0x6892=['sequelize'];(function(_0x2cdfba,_0x1bdfd8){var _0x58ca28=function(_0x40886d){while(--_0x40886d){_0x2cdfba['push'](_0x2cdfba['shift']());}};_0x58ca28(++_0x1bdfd8);}(_0x6892,0xa5));var _0x2689=function(_0x156840,_0x2ace35){_0x156840=_0x156840-0x0;var _0x19e7a3=_0x6892[_0x156840];return _0x19e7a3;};'use strict';var Sequelize=require(_0x2689('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbf4c=['STRING','sequelize','exports'];(function(_0x17e7dd,_0x444fcd){var _0x988be0=function(_0x4c23cf){while(--_0x4c23cf){_0x17e7dd['push'](_0x17e7dd['shift']());}};_0x988be0(++_0x444fcd);}(_0xbf4c,0x1c0));var _0xcbf4=function(_0x7ceafe,_0x5e71fb){_0x7ceafe=_0x7ceafe-0x0;var _0x321c81=_0xbf4c[_0x7ceafe];return _0x321c81;};'use strict';var Sequelize=require(_0xcbf4('0x0'));module[_0xcbf4('0x1')]={'name':{'type':Sequelize[_0xcbf4('0x2')]},'description':{'type':Sequelize[_0xcbf4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 4cf2302..2226719 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 _0x5fc3=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','http','test','Sequelize','request','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','ZendeskConfiguration','includeAll','findAll','params','include','find','create','body','getFields','findOne','rawAttributes','pick','getSubjects','ZendeskField','getDescriptions','Tag','setTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x8b7113,_0x3db824){var _0x2bd89c=function(_0x2f5d91){while(--_0x2f5d91){_0x8b7113['push'](_0x8b7113['shift']());}};_0x2bd89c(++_0x3db824);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4704dc,_0x575a5f){_0x4704dc=_0x4704dc-0x0;var _0x254d81=_0x5fc3[_0x4704dc];return _0x254d81;};'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 jayson=require('jayson/promise');var client=jayson['client'][_0x35fc('0x18')]({'port':0x232a});function checkPasswordPattern(_0x5d462a,_0x397738,_0x22055e){if(_0x22055e){var _0x2a6ad2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a6ad2[_0x35fc('0x19')](_0x397738)){return _0x5d462a;}else{throw new db[(_0x35fc('0x1a'))]['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 _0x5d462a;}}function respondWithRpcPromise(_0x5eac0f,_0x558364,_0x398b67,_0x229d56){return new BPromise(function(_0x53b898,_0x154958){var _0x227a49=_0x229d56||client;return _0x227a49[_0x35fc('0x1b')](_0x5eac0f,_0x398b67)['then'](function(_0x26ba54){logger[_0x35fc('0x1c')]('ZendeskConfiguration,\x20%s,\x20%s',_0x558364,_0x35fc('0x1d'));logger[_0x35fc('0x1e')](_0x35fc('0x1f'),_0x558364,'request\x20sent',JSON[_0x35fc('0x20')](_0x26ba54));if(_0x26ba54[_0x35fc('0x21')]){if(_0x26ba54[_0x35fc('0x21')]['code']===0x1f4){logger[_0x35fc('0x21')](_0x35fc('0x22'),_0x558364,_0x26ba54[_0x35fc('0x21')][_0x35fc('0x23')]);return _0x154958(_0x26ba54[_0x35fc('0x21')][_0x35fc('0x23')]);}logger[_0x35fc('0x21')](_0x35fc('0x22'),_0x558364,_0x26ba54[_0x35fc('0x21')][_0x35fc('0x23')]);return _0x53b898(_0x26ba54['error'][_0x35fc('0x23')]);}else{logger[_0x35fc('0x1c')](_0x35fc('0x22'),_0x558364,_0x35fc('0x1d'));_0x53b898(_0x26ba54[_0x35fc('0x24')]['message']);}})[_0x35fc('0x25')](function(_0x4c587a){logger['error'](_0x35fc('0x22'),_0x558364,_0x4c587a);_0x154958(_0x4c587a);});});}function respondWithStatusCode(_0x5a93df,_0x3d4a98){_0x3d4a98=_0x3d4a98||0xcc;return function(_0x51cfec){if(_0x51cfec){return _0x5a93df[_0x35fc('0x26')](_0x3d4a98);}return _0x5a93df['status'](_0x3d4a98)[_0x35fc('0x27')]();};}function respondWithResult(_0xdfab9f,_0x5cb986){_0x5cb986=_0x5cb986||0xc8;return function(_0x519264){if(_0x519264){return _0xdfab9f[_0x35fc('0x28')](_0x5cb986)['json'](_0x519264);}};}function respondWithFilteredResult(_0x274208,_0x1a5d92){return function(_0x57001c){if(_0x57001c){var _0x26b7cb=_0x57001c[_0x35fc('0x29')],_0x645eac=_0x1a5d92[_0x35fc('0x2a')],_0x383837=_0x1a5d92[_0x35fc('0x2a')]+_0x1a5d92[_0x35fc('0x2b')],_0x9f3c8a;if(_0x383837>=_0x26b7cb){_0x383837=_0x26b7cb;_0x9f3c8a=0xc8;}else{_0x9f3c8a=0xce;}_0x274208['status'](_0x9f3c8a);return _0x274208[_0x35fc('0x2c')](_0x35fc('0x2d'),_0x645eac+'-'+_0x383837+'/'+_0x26b7cb)[_0x35fc('0x2e')](_0x57001c);}return null;};}function patchUpdates(_0x52acc5){return function(_0xe79f52){try{jsonpatch[_0x35fc('0x2f')](_0xe79f52,_0x52acc5,!![]);}catch(_0x3822a8){return BPromise[_0x35fc('0x30')](_0x3822a8);}return _0xe79f52[_0x35fc('0x31')]();};}function saveUpdates(_0x103181,_0x222ddb){return function(_0x37b435){if(_0x37b435){return _0x37b435[_0x35fc('0x32')](_0x103181)[_0x35fc('0x33')](function(_0x57072d){return _0x57072d;});}return null;};}function removeEntity(_0x5e0313,_0x114bc1){return function(_0x4af5fe){if(_0x4af5fe){return _0x4af5fe[_0x35fc('0x34')]()[_0x35fc('0x33')](function(){_0x5e0313[_0x35fc('0x28')](0xcc)[_0x35fc('0x27')]();});}};}function handleEntityNotFound(_0x271ba9,_0x12e78f){return function(_0x4e43b4){if(!_0x4e43b4){_0x271ba9[_0x35fc('0x26')](0x194);}return _0x4e43b4;};}function handleError(_0x330a14,_0x46b9ef){_0x46b9ef=_0x46b9ef||0x1f4;return function(_0x4441d8){logger[_0x35fc('0x21')](_0x4441d8[_0x35fc('0x35')]);if(_0x4441d8['name']){delete _0x4441d8[_0x35fc('0x36')];}_0x330a14[_0x35fc('0x28')](_0x46b9ef)[_0x35fc('0x37')](_0x4441d8);};}exports['index']=function(_0x2c657d,_0x48d223){var _0x2ecb2e={},_0x33a377={},_0x266a11={'count':0x0,'rows':[]};var _0x2e00e3=_['map'](db['ZendeskConfiguration']['rawAttributes'],function(_0x20f5fe){return{'name':_0x20f5fe['fieldName'],'type':_0x20f5fe[_0x35fc('0x38')]['key']};});_0x33a377[_0x35fc('0x39')]=_[_0x35fc('0x3a')](_0x2e00e3,_0x35fc('0x36'));_0x33a377[_0x35fc('0x3b')]=_[_0x35fc('0x3c')](_0x2c657d[_0x35fc('0x3b')]);_0x33a377[_0x35fc('0x3d')]=_['intersection'](_0x33a377[_0x35fc('0x39')],_0x33a377[_0x35fc('0x3b')]);_0x2ecb2e['attributes']=_[_0x35fc('0x3e')](_0x33a377[_0x35fc('0x39')],qs[_0x35fc('0x3f')](_0x2c657d[_0x35fc('0x3b')][_0x35fc('0x3f')]));_0x2ecb2e[_0x35fc('0x40')]=_0x2ecb2e['attributes'][_0x35fc('0x41')]?_0x2ecb2e[_0x35fc('0x40')]:_0x33a377[_0x35fc('0x39')];if(!_0x2c657d['query'][_0x35fc('0x42')](_0x35fc('0x43'))){_0x2ecb2e['limit']=qs[_0x35fc('0x2b')](_0x2c657d[_0x35fc('0x3b')][_0x35fc('0x2b')]);_0x2ecb2e[_0x35fc('0x2a')]=qs[_0x35fc('0x2a')](_0x2c657d[_0x35fc('0x3b')][_0x35fc('0x2a')]);}_0x2ecb2e[_0x35fc('0x44')]=qs['sort'](_0x2c657d['query'][_0x35fc('0x45')]);_0x2ecb2e[_0x35fc('0x46')]=qs['filters'](_['pick'](_0x2c657d['query'],_0x33a377[_0x35fc('0x3d')]));if(_0x2c657d[_0x35fc('0x3b')]['filter']){_0x2ecb2e[_0x35fc('0x46')]=_[_0x35fc('0x47')](_0x2ecb2e[_0x35fc('0x46')],{'$or':_[_0x35fc('0x3a')](_0x2e00e3,function(_0x5c52be){if(_0x5c52be['type']!=='VIRTUAL'){var _0x539157={};_0x539157[_0x5c52be['name']]={'$like':'%'+_0x2c657d[_0x35fc('0x3b')][_0x35fc('0x48')]+'%'};return _0x539157;}})});}_0x2ecb2e=_['merge']({},_0x2ecb2e,_0x2c657d[_0x35fc('0x49')]);var _0x56cf1f={'where':_0x2ecb2e[_0x35fc('0x46')]};return db[_0x35fc('0x4a')][_0x35fc('0x29')](_0x56cf1f)[_0x35fc('0x33')](function(_0x16f7c8){_0x266a11['count']=_0x16f7c8;if(_0x2c657d[_0x35fc('0x3b')][_0x35fc('0x4b')]){_0x2ecb2e['include']=[{'all':!![]}];}return db[_0x35fc('0x4a')][_0x35fc('0x4c')](_0x2ecb2e);})[_0x35fc('0x33')](function(_0x211746){_0x266a11['rows']=_0x211746;return _0x266a11;})[_0x35fc('0x33')](respondWithFilteredResult(_0x48d223,_0x2ecb2e))['catch'](handleError(_0x48d223,null));};exports['show']=function(_0x1b6160,_0x9db7e8){var _0x18dc78={'raw':![],'where':{'id':_0x1b6160[_0x35fc('0x4d')]['id']}},_0xca8aef={};_0xca8aef[_0x35fc('0x39')]=_[_0x35fc('0x3c')](db[_0x35fc('0x4a')]['rawAttributes']);_0xca8aef[_0x35fc('0x3b')]=_[_0x35fc('0x3c')](_0x1b6160[_0x35fc('0x3b')]);_0xca8aef[_0x35fc('0x3d')]=_[_0x35fc('0x3e')](_0xca8aef[_0x35fc('0x39')],_0xca8aef[_0x35fc('0x3b')]);_0x18dc78[_0x35fc('0x40')]=_[_0x35fc('0x3e')](_0xca8aef[_0x35fc('0x39')],qs[_0x35fc('0x3f')](_0x1b6160[_0x35fc('0x3b')][_0x35fc('0x3f')]));_0x18dc78[_0x35fc('0x40')]=_0x18dc78['attributes']['length']?_0x18dc78[_0x35fc('0x40')]:_0xca8aef[_0x35fc('0x39')];if(_0x1b6160[_0x35fc('0x3b')][_0x35fc('0x4b')]){_0x18dc78[_0x35fc('0x4e')]=[{'all':!![]}];}_0x18dc78=_[_0x35fc('0x47')]({},_0x18dc78,_0x1b6160['options']);return db['ZendeskConfiguration'][_0x35fc('0x4f')](_0x18dc78)[_0x35fc('0x33')](handleEntityNotFound(_0x9db7e8,null))[_0x35fc('0x33')](respondWithResult(_0x9db7e8,null))[_0x35fc('0x25')](handleError(_0x9db7e8,null));};exports['create']=function(_0x467980,_0x13281f){return db['ZendeskConfiguration'][_0x35fc('0x50')](_0x467980[_0x35fc('0x51')],{})['then'](respondWithResult(_0x13281f,0xc9))[_0x35fc('0x25')](handleError(_0x13281f,null));};exports[_0x35fc('0x32')]=function(_0x26118e,_0x18f18b){if(_0x26118e['body']['id']){delete _0x26118e['body']['id'];}return db['ZendeskConfiguration'][_0x35fc('0x4f')]({'where':{'id':_0x26118e[_0x35fc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x18f18b,null))[_0x35fc('0x33')](saveUpdates(_0x26118e[_0x35fc('0x51')],null))[_0x35fc('0x33')](respondWithResult(_0x18f18b,null))[_0x35fc('0x25')](handleError(_0x18f18b,null));};exports[_0x35fc('0x34')]=function(_0x538be0,_0x2d9d45){return db[_0x35fc('0x4a')][_0x35fc('0x4f')]({'where':{'id':_0x538be0['params']['id']}})[_0x35fc('0x33')](handleEntityNotFound(_0x2d9d45,null))[_0x35fc('0x33')](removeEntity(_0x2d9d45,null))['catch'](handleError(_0x2d9d45,null));};exports[_0x35fc('0x52')]=function(_0x164c7b,_0x1c46b1,_0x1c4c33){var _0x314666={};var _0x41453b={};var _0x8501d1;var _0x998fd9;return db['ZendeskConfiguration'][_0x35fc('0x53')]({'where':{'id':_0x164c7b[_0x35fc('0x4d')]['id']}})[_0x35fc('0x33')](handleEntityNotFound(_0x1c46b1,null))['then'](function(_0x243871){if(_0x243871){_0x8501d1=_0x243871;_0x41453b['model']=_['keys'](db['ZendeskField'][_0x35fc('0x54')]);_0x41453b[_0x35fc('0x3b')]=_[_0x35fc('0x3c')](_0x164c7b[_0x35fc('0x3b')]);_0x41453b[_0x35fc('0x3d')]=_['intersection'](_0x41453b['model'],_0x41453b['query']);_0x314666['attributes']=_['intersection'](_0x41453b[_0x35fc('0x39')],qs[_0x35fc('0x3f')](_0x164c7b[_0x35fc('0x3b')][_0x35fc('0x3f')]));_0x314666['attributes']=_0x314666[_0x35fc('0x40')][_0x35fc('0x41')]?_0x314666[_0x35fc('0x40')]:_0x41453b[_0x35fc('0x39')];_0x314666[_0x35fc('0x44')]=qs[_0x35fc('0x45')](_0x164c7b[_0x35fc('0x3b')][_0x35fc('0x45')]);_0x314666[_0x35fc('0x46')]=qs['filters'](_[_0x35fc('0x55')](_0x164c7b['query'],_0x41453b[_0x35fc('0x3d')]));if(_0x164c7b[_0x35fc('0x3b')][_0x35fc('0x48')]){_0x314666[_0x35fc('0x46')]=_['merge'](_0x314666[_0x35fc('0x46')],{'$or':_['map'](_0x314666['attributes'],function(_0x5f1d4a){var _0x10dd1a={};_0x10dd1a[_0x5f1d4a]={'$like':'%'+_0x164c7b['query'][_0x35fc('0x48')]+'%'};return _0x10dd1a;})});}_0x314666=_['merge']({},_0x314666,_0x164c7b[_0x35fc('0x49')]);return _0x8501d1['getFields'](_0x314666);}})[_0x35fc('0x33')](function(_0x455b84){if(_0x455b84){_0x998fd9=_0x455b84[_0x35fc('0x41')];if(!_0x164c7b[_0x35fc('0x3b')]['hasOwnProperty'](_0x35fc('0x43'))){_0x314666[_0x35fc('0x2b')]=qs[_0x35fc('0x2b')](_0x164c7b['query'][_0x35fc('0x2b')]);_0x314666[_0x35fc('0x2a')]=qs[_0x35fc('0x2a')](_0x164c7b[_0x35fc('0x3b')][_0x35fc('0x2a')]);}return _0x8501d1[_0x35fc('0x52')](_0x314666);}})[_0x35fc('0x33')](function(_0x4464d5){if(_0x4464d5){return _0x4464d5?{'count':_0x998fd9,'rows':_0x4464d5}:null;}})['then'](respondWithResult(_0x1c46b1,null))[_0x35fc('0x25')](handleError(_0x1c46b1,null));};exports[_0x35fc('0x56')]=function(_0x2600d2,_0x4a926d,_0x1c88d8){var _0x1b76f0={};var _0x586729={};var _0x4d09d4;var _0x3969d3;return db['ZendeskConfiguration'][_0x35fc('0x53')]({'where':{'id':_0x2600d2[_0x35fc('0x4d')]['id']}})[_0x35fc('0x33')](handleEntityNotFound(_0x4a926d,null))[_0x35fc('0x33')](function(_0x1932c9){if(_0x1932c9){_0x4d09d4=_0x1932c9;_0x586729[_0x35fc('0x39')]=_[_0x35fc('0x3c')](db[_0x35fc('0x57')][_0x35fc('0x54')]);_0x586729[_0x35fc('0x3b')]=_[_0x35fc('0x3c')](_0x2600d2[_0x35fc('0x3b')]);_0x586729[_0x35fc('0x3d')]=_[_0x35fc('0x3e')](_0x586729[_0x35fc('0x39')],_0x586729[_0x35fc('0x3b')]);_0x1b76f0[_0x35fc('0x40')]=_[_0x35fc('0x3e')](_0x586729[_0x35fc('0x39')],qs[_0x35fc('0x3f')](_0x2600d2['query'][_0x35fc('0x3f')]));_0x1b76f0['attributes']=_0x1b76f0[_0x35fc('0x40')][_0x35fc('0x41')]?_0x1b76f0[_0x35fc('0x40')]:_0x586729[_0x35fc('0x39')];_0x1b76f0[_0x35fc('0x44')]=qs[_0x35fc('0x45')](_0x2600d2[_0x35fc('0x3b')][_0x35fc('0x45')]);_0x1b76f0[_0x35fc('0x46')]=qs[_0x35fc('0x3d')](_[_0x35fc('0x55')](_0x2600d2['query'],_0x586729[_0x35fc('0x3d')]));if(_0x2600d2[_0x35fc('0x3b')][_0x35fc('0x48')]){_0x1b76f0[_0x35fc('0x46')]=_[_0x35fc('0x47')](_0x1b76f0[_0x35fc('0x46')],{'$or':_['map'](_0x1b76f0[_0x35fc('0x40')],function(_0x3353e0){var _0x277514={};_0x277514[_0x3353e0]={'$like':'%'+_0x2600d2[_0x35fc('0x3b')][_0x35fc('0x48')]+'%'};return _0x277514;})});}_0x1b76f0=_[_0x35fc('0x47')]({},_0x1b76f0,_0x2600d2[_0x35fc('0x49')]);return _0x4d09d4[_0x35fc('0x56')](_0x1b76f0);}})[_0x35fc('0x33')](function(_0x5f23d8){if(_0x5f23d8){_0x3969d3=_0x5f23d8[_0x35fc('0x41')];if(!_0x2600d2['query'][_0x35fc('0x42')](_0x35fc('0x43'))){_0x1b76f0['limit']=qs[_0x35fc('0x2b')](_0x2600d2[_0x35fc('0x3b')][_0x35fc('0x2b')]);_0x1b76f0[_0x35fc('0x2a')]=qs[_0x35fc('0x2a')](_0x2600d2[_0x35fc('0x3b')][_0x35fc('0x2a')]);}return _0x4d09d4[_0x35fc('0x56')](_0x1b76f0);}})[_0x35fc('0x33')](function(_0x5806bf){if(_0x5806bf){return _0x5806bf?{'count':_0x3969d3,'rows':_0x5806bf}:null;}})['then'](respondWithResult(_0x4a926d,null))['catch'](handleError(_0x4a926d,null));};exports['getDescriptions']=function(_0x160a6f,_0x23cf84,_0x8fc410){var _0x1f5cbc={};var _0x35ef53={};var _0x4f535a;var _0x226fdf;return db[_0x35fc('0x4a')][_0x35fc('0x53')]({'where':{'id':_0x160a6f[_0x35fc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x23cf84,null))[_0x35fc('0x33')](function(_0x3ddd21){if(_0x3ddd21){_0x4f535a=_0x3ddd21;_0x35ef53[_0x35fc('0x39')]=_['keys'](db[_0x35fc('0x57')][_0x35fc('0x54')]);_0x35ef53[_0x35fc('0x3b')]=_[_0x35fc('0x3c')](_0x160a6f[_0x35fc('0x3b')]);_0x35ef53[_0x35fc('0x3d')]=_[_0x35fc('0x3e')](_0x35ef53[_0x35fc('0x39')],_0x35ef53['query']);_0x1f5cbc[_0x35fc('0x40')]=_[_0x35fc('0x3e')](_0x35ef53[_0x35fc('0x39')],qs[_0x35fc('0x3f')](_0x160a6f[_0x35fc('0x3b')][_0x35fc('0x3f')]));_0x1f5cbc['attributes']=_0x1f5cbc[_0x35fc('0x40')]['length']?_0x1f5cbc['attributes']:_0x35ef53[_0x35fc('0x39')];_0x1f5cbc['order']=qs[_0x35fc('0x45')](_0x160a6f[_0x35fc('0x3b')][_0x35fc('0x45')]);_0x1f5cbc['where']=qs[_0x35fc('0x3d')](_[_0x35fc('0x55')](_0x160a6f[_0x35fc('0x3b')],_0x35ef53[_0x35fc('0x3d')]));if(_0x160a6f[_0x35fc('0x3b')]['filter']){_0x1f5cbc['where']=_['merge'](_0x1f5cbc[_0x35fc('0x46')],{'$or':_['map'](_0x1f5cbc[_0x35fc('0x40')],function(_0x1824c2){var _0x391321={};_0x391321[_0x1824c2]={'$like':'%'+_0x160a6f[_0x35fc('0x3b')]['filter']+'%'};return _0x391321;})});}_0x1f5cbc=_[_0x35fc('0x47')]({},_0x1f5cbc,_0x160a6f[_0x35fc('0x49')]);return _0x4f535a[_0x35fc('0x58')](_0x1f5cbc);}})['then'](function(_0x128286){if(_0x128286){_0x226fdf=_0x128286[_0x35fc('0x41')];if(!_0x160a6f[_0x35fc('0x3b')]['hasOwnProperty']('nolimit')){_0x1f5cbc['limit']=qs[_0x35fc('0x2b')](_0x160a6f[_0x35fc('0x3b')][_0x35fc('0x2b')]);_0x1f5cbc[_0x35fc('0x2a')]=qs['offset'](_0x160a6f[_0x35fc('0x3b')][_0x35fc('0x2a')]);}return _0x4f535a['getDescriptions'](_0x1f5cbc);}})['then'](function(_0x143c94){if(_0x143c94){return _0x143c94?{'count':_0x226fdf,'rows':_0x143c94}:null;}})[_0x35fc('0x33')](respondWithResult(_0x23cf84,null))[_0x35fc('0x25')](handleError(_0x23cf84,null));};exports['getTags']=function(_0x4dd05f,_0x134e60,_0x432ba4){var _0x4d5204={};var _0x3439de={};var _0x163edb;var _0x1d96c9;return db['ZendeskConfiguration'][_0x35fc('0x53')]({'where':{'id':_0x4dd05f[_0x35fc('0x4d')]['id']}})[_0x35fc('0x33')](handleEntityNotFound(_0x134e60,null))[_0x35fc('0x33')](function(_0x4fd676){if(_0x4fd676){_0x163edb=_0x4fd676;_0x3439de[_0x35fc('0x39')]=_[_0x35fc('0x3c')](db[_0x35fc('0x59')]['rawAttributes']);_0x3439de[_0x35fc('0x3b')]=_[_0x35fc('0x3c')](_0x4dd05f[_0x35fc('0x3b')]);_0x3439de['filters']=_[_0x35fc('0x3e')](_0x3439de[_0x35fc('0x39')],_0x3439de['query']);_0x4d5204[_0x35fc('0x40')]=_[_0x35fc('0x3e')](_0x3439de[_0x35fc('0x39')],qs[_0x35fc('0x3f')](_0x4dd05f[_0x35fc('0x3b')][_0x35fc('0x3f')]));_0x4d5204[_0x35fc('0x40')]=_0x4d5204[_0x35fc('0x40')][_0x35fc('0x41')]?_0x4d5204['attributes']:_0x3439de[_0x35fc('0x39')];_0x4d5204[_0x35fc('0x44')]=qs[_0x35fc('0x45')](_0x4dd05f[_0x35fc('0x3b')]['sort']);_0x4d5204[_0x35fc('0x46')]=qs[_0x35fc('0x3d')](_[_0x35fc('0x55')](_0x4dd05f[_0x35fc('0x3b')],_0x3439de[_0x35fc('0x3d')]));if(_0x4dd05f[_0x35fc('0x3b')][_0x35fc('0x48')]){_0x4d5204[_0x35fc('0x46')]=_['merge'](_0x4d5204['where'],{'$or':_[_0x35fc('0x3a')](_0x4d5204[_0x35fc('0x40')],function(_0x961ee9){var _0x4ebf4a={};_0x4ebf4a[_0x961ee9]={'$like':'%'+_0x4dd05f[_0x35fc('0x3b')][_0x35fc('0x48')]+'%'};return _0x4ebf4a;})});}_0x4d5204=_[_0x35fc('0x47')]({},_0x4d5204,_0x4dd05f[_0x35fc('0x49')]);return _0x163edb['getTags'](_0x4d5204);}})['then'](function(_0x379650){if(_0x379650){_0x1d96c9=_0x379650['length'];if(!_0x4dd05f[_0x35fc('0x3b')][_0x35fc('0x42')]('nolimit')){_0x4d5204['limit']=qs[_0x35fc('0x2b')](_0x4dd05f[_0x35fc('0x3b')][_0x35fc('0x2b')]);_0x4d5204['offset']=qs[_0x35fc('0x2a')](_0x4dd05f[_0x35fc('0x3b')][_0x35fc('0x2a')]);}return _0x163edb['getTags'](_0x4d5204);}})[_0x35fc('0x33')](function(_0x32cbd){if(_0x32cbd){return _0x32cbd?{'count':_0x1d96c9,'rows':_0x32cbd}:null;}})[_0x35fc('0x33')](respondWithResult(_0x134e60,null))[_0x35fc('0x25')](handleError(_0x134e60,null));};exports['setTags']=function(_0x451cb8,_0x347e06,_0x6f8054){if(_0x451cb8[_0x35fc('0x51')]['id']){delete _0x451cb8[_0x35fc('0x51')]['id'];}return db[_0x35fc('0x4a')]['findOne']({'where':{'id':_0x451cb8[_0x35fc('0x4d')]['id']}})[_0x35fc('0x33')](handleEntityNotFound(_0x347e06,null))['then'](function(_0x4c3253){if(_0x4c3253){return _0x4c3253[_0x35fc('0x5a')](_0x451cb8['body'][_0x35fc('0x5b')]||[]);}return null;})[_0x35fc('0x33')](respondWithResult(_0x347e06,null))[_0x35fc('0x25')](handleError(_0x347e06,null));}; \ No newline at end of file +var _0xc4aa=['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','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','update','destroy','stack','send','index','map','ZendeskConfiguration','fieldName','type','model','keys','query','attributes','intersection','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','name','options','count','includeAll','rows','show','rawAttributes','include','create','body','find','params','getFields','ZendeskField','getSubjects','hasOwnProperty','nolimit','getDescriptions','findOne','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','test','Sequelize'];(function(_0x35d4e9,_0x298c61){var _0x5c2770=function(_0x2f326a){while(--_0x2f326a){_0x35d4e9['push'](_0x35d4e9['shift']());}};_0x5c2770(++_0x298c61);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xc4aa[_0x273c39];return _0x46d6b5;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];var jayson=require(_0xac4a('0x16'));var client=jayson[_0xac4a('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x21a79,_0x68424a,_0x247b78){if(_0x247b78){var _0x6e00d4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x6e00d4[_0xac4a('0x18')](_0x68424a)){return _0x21a79;}else{throw new db[(_0xac4a('0x19'))][(_0xac4a('0x1a'))](_0xac4a('0x1b'));}}else{return _0x21a79;}}function respondWithRpcPromise(_0x190418,_0x42c7fc,_0x11e101,_0x26dbb8){return new BPromise(function(_0x4a2119,_0x402fff){var _0x34d797=_0x26dbb8||client;return _0x34d797[_0xac4a('0x1c')](_0x190418,_0x11e101)[_0xac4a('0x1d')](function(_0x3e88e3){logger[_0xac4a('0x1e')](_0xac4a('0x1f'),_0x42c7fc,_0xac4a('0x20'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x42c7fc,_0xac4a('0x20'),JSON[_0xac4a('0x21')](_0x3e88e3));if(_0x3e88e3[_0xac4a('0x22')]){if(_0x3e88e3['error'][_0xac4a('0x23')]===0x1f4){logger[_0xac4a('0x22')](_0xac4a('0x1f'),_0x42c7fc,_0x3e88e3[_0xac4a('0x22')][_0xac4a('0x24')]);return _0x402fff(_0x3e88e3[_0xac4a('0x22')][_0xac4a('0x24')]);}logger[_0xac4a('0x22')]('ZendeskConfiguration,\x20%s,\x20%s',_0x42c7fc,_0x3e88e3[_0xac4a('0x22')][_0xac4a('0x24')]);return _0x4a2119(_0x3e88e3['error'][_0xac4a('0x24')]);}else{logger[_0xac4a('0x1e')](_0xac4a('0x1f'),_0x42c7fc,_0xac4a('0x20'));_0x4a2119(_0x3e88e3['result'][_0xac4a('0x24')]);}})[_0xac4a('0x25')](function(_0x15435c){logger[_0xac4a('0x22')](_0xac4a('0x1f'),_0x42c7fc,_0x15435c);_0x402fff(_0x15435c);});});}function respondWithStatusCode(_0x2b0dc2,_0x222507){_0x222507=_0x222507||0xcc;return function(_0x36054a){if(_0x36054a){return _0x2b0dc2[_0xac4a('0x26')](_0x222507);}return _0x2b0dc2[_0xac4a('0x27')](_0x222507)[_0xac4a('0x28')]();};}function respondWithResult(_0x215a31,_0x14832b){_0x14832b=_0x14832b||0xc8;return function(_0x472c57){if(_0x472c57){return _0x215a31[_0xac4a('0x27')](_0x14832b)[_0xac4a('0x29')](_0x472c57);}};}function respondWithFilteredResult(_0x4e17ce,_0x23b061){return function(_0x267a22){if(_0x267a22){var _0x42a33c=_0x267a22['count'],_0x2772fe=_0x23b061[_0xac4a('0x2a')],_0x116700=_0x23b061[_0xac4a('0x2a')]+_0x23b061[_0xac4a('0x2b')],_0x4a5a9e;if(_0x116700>=_0x42a33c){_0x116700=_0x42a33c;_0x4a5a9e=0xc8;}else{_0x4a5a9e=0xce;}_0x4e17ce['status'](_0x4a5a9e);return _0x4e17ce['set'](_0xac4a('0x2c'),_0x2772fe+'-'+_0x116700+'/'+_0x42a33c)[_0xac4a('0x29')](_0x267a22);}return null;};}function patchUpdates(_0x228629){return function(_0x432066){try{jsonpatch[_0xac4a('0x2d')](_0x432066,_0x228629,!![]);}catch(_0x53d3a5){return BPromise[_0xac4a('0x2e')](_0x53d3a5);}return _0x432066['save']();};}function saveUpdates(_0x30364b,_0x57adcf){return function(_0x17e6de){if(_0x17e6de){return _0x17e6de[_0xac4a('0x2f')](_0x30364b)[_0xac4a('0x1d')](function(_0x228aa7){return _0x228aa7;});}return null;};}function removeEntity(_0x34577f,_0x61e552){return function(_0xbd4591){if(_0xbd4591){return _0xbd4591[_0xac4a('0x30')]()[_0xac4a('0x1d')](function(){_0x34577f[_0xac4a('0x27')](0xcc)[_0xac4a('0x28')]();});}};}function handleEntityNotFound(_0x1634df,_0x1a9be2){return function(_0x1a9d4e){if(!_0x1a9d4e){_0x1634df['sendStatus'](0x194);}return _0x1a9d4e;};}function handleError(_0x30442d,_0x1c41fb){_0x1c41fb=_0x1c41fb||0x1f4;return function(_0x5a4e2b){logger[_0xac4a('0x22')](_0x5a4e2b[_0xac4a('0x31')]);if(_0x5a4e2b['name']){delete _0x5a4e2b['name'];}_0x30442d[_0xac4a('0x27')](_0x1c41fb)[_0xac4a('0x32')](_0x5a4e2b);};}exports[_0xac4a('0x33')]=function(_0x3de9e2,_0x4f5986){var _0x453d02={},_0x2e56c6={},_0x4e7630={'count':0x0,'rows':[]};var _0x37f2ee=_[_0xac4a('0x34')](db[_0xac4a('0x35')]['rawAttributes'],function(_0x121328){return{'name':_0x121328[_0xac4a('0x36')],'type':_0x121328[_0xac4a('0x37')]['key']};});_0x2e56c6[_0xac4a('0x38')]=_[_0xac4a('0x34')](_0x37f2ee,'name');_0x2e56c6['query']=_[_0xac4a('0x39')](_0x3de9e2['query']);_0x2e56c6['filters']=_['intersection'](_0x2e56c6['model'],_0x2e56c6[_0xac4a('0x3a')]);_0x453d02[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x2e56c6[_0xac4a('0x38')],qs[_0xac4a('0x3d')](_0x3de9e2[_0xac4a('0x3a')][_0xac4a('0x3d')]));_0x453d02[_0xac4a('0x3b')]=_0x453d02[_0xac4a('0x3b')][_0xac4a('0x3e')]?_0x453d02[_0xac4a('0x3b')]:_0x2e56c6[_0xac4a('0x38')];if(!_0x3de9e2['query']['hasOwnProperty']('nolimit')){_0x453d02[_0xac4a('0x2b')]=qs[_0xac4a('0x2b')](_0x3de9e2[_0xac4a('0x3a')][_0xac4a('0x2b')]);_0x453d02[_0xac4a('0x2a')]=qs[_0xac4a('0x2a')](_0x3de9e2[_0xac4a('0x3a')][_0xac4a('0x2a')]);}_0x453d02[_0xac4a('0x3f')]=qs[_0xac4a('0x40')](_0x3de9e2['query'][_0xac4a('0x40')]);_0x453d02[_0xac4a('0x41')]=qs[_0xac4a('0x42')](_[_0xac4a('0x43')](_0x3de9e2[_0xac4a('0x3a')],_0x2e56c6['filters']));if(_0x3de9e2[_0xac4a('0x3a')][_0xac4a('0x44')]){_0x453d02['where']=_[_0xac4a('0x45')](_0x453d02['where'],{'$or':_[_0xac4a('0x34')](_0x37f2ee,function(_0x65494e){if(_0x65494e[_0xac4a('0x37')]!==_0xac4a('0x46')){var _0x520e4a={};_0x520e4a[_0x65494e[_0xac4a('0x47')]]={'$like':'%'+_0x3de9e2[_0xac4a('0x3a')][_0xac4a('0x44')]+'%'};return _0x520e4a;}})});}_0x453d02=_[_0xac4a('0x45')]({},_0x453d02,_0x3de9e2[_0xac4a('0x48')]);var _0x4fa9eb={'where':_0x453d02[_0xac4a('0x41')]};return db['ZendeskConfiguration'][_0xac4a('0x49')](_0x4fa9eb)[_0xac4a('0x1d')](function(_0xeca4e9){_0x4e7630['count']=_0xeca4e9;if(_0x3de9e2[_0xac4a('0x3a')][_0xac4a('0x4a')]){_0x453d02['include']=[{'all':!![]}];}return db[_0xac4a('0x35')]['findAll'](_0x453d02);})[_0xac4a('0x1d')](function(_0xe620f6){_0x4e7630[_0xac4a('0x4b')]=_0xe620f6;return _0x4e7630;})['then'](respondWithFilteredResult(_0x4f5986,_0x453d02))['catch'](handleError(_0x4f5986,null));};exports[_0xac4a('0x4c')]=function(_0x4aaeff,_0x18ae96){var _0x566258={'raw':![],'where':{'id':_0x4aaeff['params']['id']}},_0x3d2aaf={};_0x3d2aaf[_0xac4a('0x38')]=_[_0xac4a('0x39')](db[_0xac4a('0x35')][_0xac4a('0x4d')]);_0x3d2aaf['query']=_[_0xac4a('0x39')](_0x4aaeff[_0xac4a('0x3a')]);_0x3d2aaf[_0xac4a('0x42')]=_[_0xac4a('0x3c')](_0x3d2aaf[_0xac4a('0x38')],_0x3d2aaf[_0xac4a('0x3a')]);_0x566258[_0xac4a('0x3b')]=_['intersection'](_0x3d2aaf[_0xac4a('0x38')],qs[_0xac4a('0x3d')](_0x4aaeff['query'][_0xac4a('0x3d')]));_0x566258[_0xac4a('0x3b')]=_0x566258[_0xac4a('0x3b')][_0xac4a('0x3e')]?_0x566258['attributes']:_0x3d2aaf[_0xac4a('0x38')];if(_0x4aaeff[_0xac4a('0x3a')][_0xac4a('0x4a')]){_0x566258[_0xac4a('0x4e')]=[{'all':!![]}];}_0x566258=_[_0xac4a('0x45')]({},_0x566258,_0x4aaeff['options']);return db[_0xac4a('0x35')]['find'](_0x566258)[_0xac4a('0x1d')](handleEntityNotFound(_0x18ae96,null))[_0xac4a('0x1d')](respondWithResult(_0x18ae96,null))['catch'](handleError(_0x18ae96,null));};exports['create']=function(_0x437466,_0x70fdc3){return db['ZendeskConfiguration'][_0xac4a('0x4f')](_0x437466[_0xac4a('0x50')],{})[_0xac4a('0x1d')](respondWithResult(_0x70fdc3,0xc9))[_0xac4a('0x25')](handleError(_0x70fdc3,null));};exports['update']=function(_0x3057d6,_0x108f7c){if(_0x3057d6[_0xac4a('0x50')]['id']){delete _0x3057d6[_0xac4a('0x50')]['id'];}return db[_0xac4a('0x35')][_0xac4a('0x51')]({'where':{'id':_0x3057d6[_0xac4a('0x52')]['id']}})['then'](handleEntityNotFound(_0x108f7c,null))[_0xac4a('0x1d')](saveUpdates(_0x3057d6[_0xac4a('0x50')],null))[_0xac4a('0x1d')](respondWithResult(_0x108f7c,null))[_0xac4a('0x25')](handleError(_0x108f7c,null));};exports[_0xac4a('0x30')]=function(_0x2ac1e9,_0x213df2){return db[_0xac4a('0x35')][_0xac4a('0x51')]({'where':{'id':_0x2ac1e9[_0xac4a('0x52')]['id']}})[_0xac4a('0x1d')](handleEntityNotFound(_0x213df2,null))[_0xac4a('0x1d')](removeEntity(_0x213df2,null))[_0xac4a('0x25')](handleError(_0x213df2,null));};exports[_0xac4a('0x53')]=function(_0x5222f3,_0x11c753,_0x492aae){var _0x13a577={};var _0x479ebc={};var _0x2d598e;var _0x4b7f79;return db[_0xac4a('0x35')]['findOne']({'where':{'id':_0x5222f3[_0xac4a('0x52')]['id']}})['then'](handleEntityNotFound(_0x11c753,null))['then'](function(_0x52c957){if(_0x52c957){_0x2d598e=_0x52c957;_0x479ebc[_0xac4a('0x38')]=_[_0xac4a('0x39')](db[_0xac4a('0x54')][_0xac4a('0x4d')]);_0x479ebc[_0xac4a('0x3a')]=_['keys'](_0x5222f3[_0xac4a('0x3a')]);_0x479ebc['filters']=_[_0xac4a('0x3c')](_0x479ebc['model'],_0x479ebc[_0xac4a('0x3a')]);_0x13a577[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x479ebc[_0xac4a('0x38')],qs[_0xac4a('0x3d')](_0x5222f3[_0xac4a('0x3a')][_0xac4a('0x3d')]));_0x13a577[_0xac4a('0x3b')]=_0x13a577[_0xac4a('0x3b')][_0xac4a('0x3e')]?_0x13a577[_0xac4a('0x3b')]:_0x479ebc[_0xac4a('0x38')];_0x13a577[_0xac4a('0x3f')]=qs[_0xac4a('0x40')](_0x5222f3[_0xac4a('0x3a')][_0xac4a('0x40')]);_0x13a577[_0xac4a('0x41')]=qs['filters'](_[_0xac4a('0x43')](_0x5222f3[_0xac4a('0x3a')],_0x479ebc['filters']));if(_0x5222f3[_0xac4a('0x3a')][_0xac4a('0x44')]){_0x13a577[_0xac4a('0x41')]=_[_0xac4a('0x45')](_0x13a577[_0xac4a('0x41')],{'$or':_['map'](_0x13a577['attributes'],function(_0x45f3c3){var _0x11bb54={};_0x11bb54[_0x45f3c3]={'$like':'%'+_0x5222f3[_0xac4a('0x3a')][_0xac4a('0x44')]+'%'};return _0x11bb54;})});}_0x13a577=_[_0xac4a('0x45')]({},_0x13a577,_0x5222f3[_0xac4a('0x48')]);return _0x2d598e[_0xac4a('0x53')](_0x13a577);}})[_0xac4a('0x1d')](function(_0x44c60b){if(_0x44c60b){_0x4b7f79=_0x44c60b[_0xac4a('0x3e')];if(!_0x5222f3[_0xac4a('0x3a')]['hasOwnProperty']('nolimit')){_0x13a577[_0xac4a('0x2b')]=qs[_0xac4a('0x2b')](_0x5222f3[_0xac4a('0x3a')][_0xac4a('0x2b')]);_0x13a577[_0xac4a('0x2a')]=qs[_0xac4a('0x2a')](_0x5222f3[_0xac4a('0x3a')][_0xac4a('0x2a')]);}return _0x2d598e[_0xac4a('0x53')](_0x13a577);}})[_0xac4a('0x1d')](function(_0xb09b89){if(_0xb09b89){return _0xb09b89?{'count':_0x4b7f79,'rows':_0xb09b89}:null;}})[_0xac4a('0x1d')](respondWithResult(_0x11c753,null))['catch'](handleError(_0x11c753,null));};exports[_0xac4a('0x55')]=function(_0xc74ce8,_0x26bd31,_0x231932){var _0x513976={};var _0xc61e94={};var _0x5a30af;var _0xab4305;return db[_0xac4a('0x35')]['findOne']({'where':{'id':_0xc74ce8['params']['id']}})[_0xac4a('0x1d')](handleEntityNotFound(_0x26bd31,null))[_0xac4a('0x1d')](function(_0x13097f){if(_0x13097f){_0x5a30af=_0x13097f;_0xc61e94['model']=_[_0xac4a('0x39')](db['ZendeskField'][_0xac4a('0x4d')]);_0xc61e94['query']=_['keys'](_0xc74ce8[_0xac4a('0x3a')]);_0xc61e94['filters']=_[_0xac4a('0x3c')](_0xc61e94['model'],_0xc61e94[_0xac4a('0x3a')]);_0x513976[_0xac4a('0x3b')]=_['intersection'](_0xc61e94[_0xac4a('0x38')],qs['fields'](_0xc74ce8[_0xac4a('0x3a')][_0xac4a('0x3d')]));_0x513976['attributes']=_0x513976[_0xac4a('0x3b')]['length']?_0x513976['attributes']:_0xc61e94[_0xac4a('0x38')];_0x513976['order']=qs[_0xac4a('0x40')](_0xc74ce8['query']['sort']);_0x513976[_0xac4a('0x41')]=qs[_0xac4a('0x42')](_[_0xac4a('0x43')](_0xc74ce8['query'],_0xc61e94['filters']));if(_0xc74ce8[_0xac4a('0x3a')][_0xac4a('0x44')]){_0x513976['where']=_['merge'](_0x513976[_0xac4a('0x41')],{'$or':_[_0xac4a('0x34')](_0x513976[_0xac4a('0x3b')],function(_0x36df3d){var _0x1810f7={};_0x1810f7[_0x36df3d]={'$like':'%'+_0xc74ce8[_0xac4a('0x3a')][_0xac4a('0x44')]+'%'};return _0x1810f7;})});}_0x513976=_[_0xac4a('0x45')]({},_0x513976,_0xc74ce8[_0xac4a('0x48')]);return _0x5a30af['getSubjects'](_0x513976);}})[_0xac4a('0x1d')](function(_0x440dc4){if(_0x440dc4){_0xab4305=_0x440dc4[_0xac4a('0x3e')];if(!_0xc74ce8['query'][_0xac4a('0x56')](_0xac4a('0x57'))){_0x513976[_0xac4a('0x2b')]=qs[_0xac4a('0x2b')](_0xc74ce8[_0xac4a('0x3a')]['limit']);_0x513976[_0xac4a('0x2a')]=qs[_0xac4a('0x2a')](_0xc74ce8[_0xac4a('0x3a')][_0xac4a('0x2a')]);}return _0x5a30af[_0xac4a('0x55')](_0x513976);}})[_0xac4a('0x1d')](function(_0xd7bdd6){if(_0xd7bdd6){return _0xd7bdd6?{'count':_0xab4305,'rows':_0xd7bdd6}:null;}})['then'](respondWithResult(_0x26bd31,null))[_0xac4a('0x25')](handleError(_0x26bd31,null));};exports[_0xac4a('0x58')]=function(_0x19bd6f,_0x35a97c,_0x1bb24d){var _0x171c47={};var _0x547eec={};var _0x318bee;var _0x29c772;return db[_0xac4a('0x35')][_0xac4a('0x59')]({'where':{'id':_0x19bd6f['params']['id']}})[_0xac4a('0x1d')](handleEntityNotFound(_0x35a97c,null))['then'](function(_0x4447b5){if(_0x4447b5){_0x318bee=_0x4447b5;_0x547eec[_0xac4a('0x38')]=_['keys'](db['ZendeskField'][_0xac4a('0x4d')]);_0x547eec[_0xac4a('0x3a')]=_[_0xac4a('0x39')](_0x19bd6f['query']);_0x547eec[_0xac4a('0x42')]=_['intersection'](_0x547eec[_0xac4a('0x38')],_0x547eec[_0xac4a('0x3a')]);_0x171c47[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x547eec[_0xac4a('0x38')],qs['fields'](_0x19bd6f['query'][_0xac4a('0x3d')]));_0x171c47[_0xac4a('0x3b')]=_0x171c47[_0xac4a('0x3b')][_0xac4a('0x3e')]?_0x171c47[_0xac4a('0x3b')]:_0x547eec[_0xac4a('0x38')];_0x171c47[_0xac4a('0x3f')]=qs[_0xac4a('0x40')](_0x19bd6f['query']['sort']);_0x171c47[_0xac4a('0x41')]=qs[_0xac4a('0x42')](_[_0xac4a('0x43')](_0x19bd6f[_0xac4a('0x3a')],_0x547eec[_0xac4a('0x42')]));if(_0x19bd6f[_0xac4a('0x3a')][_0xac4a('0x44')]){_0x171c47[_0xac4a('0x41')]=_['merge'](_0x171c47['where'],{'$or':_[_0xac4a('0x34')](_0x171c47[_0xac4a('0x3b')],function(_0x22804e){var _0x371e06={};_0x371e06[_0x22804e]={'$like':'%'+_0x19bd6f[_0xac4a('0x3a')][_0xac4a('0x44')]+'%'};return _0x371e06;})});}_0x171c47=_[_0xac4a('0x45')]({},_0x171c47,_0x19bd6f['options']);return _0x318bee[_0xac4a('0x58')](_0x171c47);}})[_0xac4a('0x1d')](function(_0x3439f3){if(_0x3439f3){_0x29c772=_0x3439f3['length'];if(!_0x19bd6f[_0xac4a('0x3a')][_0xac4a('0x56')](_0xac4a('0x57'))){_0x171c47[_0xac4a('0x2b')]=qs[_0xac4a('0x2b')](_0x19bd6f[_0xac4a('0x3a')][_0xac4a('0x2b')]);_0x171c47[_0xac4a('0x2a')]=qs[_0xac4a('0x2a')](_0x19bd6f['query'][_0xac4a('0x2a')]);}return _0x318bee['getDescriptions'](_0x171c47);}})[_0xac4a('0x1d')](function(_0x1199f6){if(_0x1199f6){return _0x1199f6?{'count':_0x29c772,'rows':_0x1199f6}:null;}})[_0xac4a('0x1d')](respondWithResult(_0x35a97c,null))[_0xac4a('0x25')](handleError(_0x35a97c,null));};exports[_0xac4a('0x5a')]=function(_0x337da7,_0x19766a,_0x5266d3){var _0x2b883a={};var _0x42b3f7={};var _0x279f9b;var _0x3315e7;return db[_0xac4a('0x35')]['findOne']({'where':{'id':_0x337da7[_0xac4a('0x52')]['id']}})[_0xac4a('0x1d')](handleEntityNotFound(_0x19766a,null))['then'](function(_0x55af32){if(_0x55af32){_0x279f9b=_0x55af32;_0x42b3f7[_0xac4a('0x38')]=_[_0xac4a('0x39')](db['Tag'][_0xac4a('0x4d')]);_0x42b3f7[_0xac4a('0x3a')]=_[_0xac4a('0x39')](_0x337da7[_0xac4a('0x3a')]);_0x42b3f7[_0xac4a('0x42')]=_[_0xac4a('0x3c')](_0x42b3f7['model'],_0x42b3f7[_0xac4a('0x3a')]);_0x2b883a[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x42b3f7['model'],qs[_0xac4a('0x3d')](_0x337da7[_0xac4a('0x3a')][_0xac4a('0x3d')]));_0x2b883a[_0xac4a('0x3b')]=_0x2b883a[_0xac4a('0x3b')][_0xac4a('0x3e')]?_0x2b883a['attributes']:_0x42b3f7[_0xac4a('0x38')];_0x2b883a[_0xac4a('0x3f')]=qs['sort'](_0x337da7[_0xac4a('0x3a')]['sort']);_0x2b883a[_0xac4a('0x41')]=qs[_0xac4a('0x42')](_['pick'](_0x337da7[_0xac4a('0x3a')],_0x42b3f7['filters']));if(_0x337da7[_0xac4a('0x3a')]['filter']){_0x2b883a[_0xac4a('0x41')]=_[_0xac4a('0x45')](_0x2b883a[_0xac4a('0x41')],{'$or':_[_0xac4a('0x34')](_0x2b883a[_0xac4a('0x3b')],function(_0x36d8ff){var _0x7e403a={};_0x7e403a[_0x36d8ff]={'$like':'%'+_0x337da7[_0xac4a('0x3a')][_0xac4a('0x44')]+'%'};return _0x7e403a;})});}_0x2b883a=_[_0xac4a('0x45')]({},_0x2b883a,_0x337da7[_0xac4a('0x48')]);return _0x279f9b[_0xac4a('0x5a')](_0x2b883a);}})[_0xac4a('0x1d')](function(_0x4217df){if(_0x4217df){_0x3315e7=_0x4217df['length'];if(!_0x337da7[_0xac4a('0x3a')][_0xac4a('0x56')]('nolimit')){_0x2b883a[_0xac4a('0x2b')]=qs[_0xac4a('0x2b')](_0x337da7[_0xac4a('0x3a')][_0xac4a('0x2b')]);_0x2b883a[_0xac4a('0x2a')]=qs['offset'](_0x337da7[_0xac4a('0x3a')]['offset']);}return _0x279f9b[_0xac4a('0x5a')](_0x2b883a);}})[_0xac4a('0x1d')](function(_0x240ff1){if(_0x240ff1){return _0x240ff1?{'count':_0x3315e7,'rows':_0x240ff1}:null;}})[_0xac4a('0x1d')](respondWithResult(_0x19766a,null))['catch'](handleError(_0x19766a,null));};exports[_0xac4a('0x5b')]=function(_0x55866d,_0x277fd1,_0x40d363){if(_0x55866d[_0xac4a('0x50')]['id']){delete _0x55866d['body']['id'];}return db[_0xac4a('0x35')][_0xac4a('0x59')]({'where':{'id':_0x55866d[_0xac4a('0x52')]['id']}})['then'](handleEntityNotFound(_0x277fd1,null))[_0xac4a('0x1d')](function(_0x25639a){if(_0x25639a){return _0x25639a[_0xac4a('0x5b')](_0x55866d[_0xac4a('0x50')][_0xac4a('0x5c')]||[]);}return null;})[_0xac4a('0x1d')](respondWithResult(_0x277fd1,null))[_0xac4a('0x25')](handleError(_0x277fd1,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index caa7dfb..40c53b0 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 _0x7f41=['bluebird','request-promise','path','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','../../config/logger','api','moment'];(function(_0x3b2c8e,_0x53910b){var _0x3ebe3d=function(_0x57220b){while(--_0x57220b){_0x3b2c8e['push'](_0x3b2c8e['shift']());}};_0x3ebe3d(++_0x53910b);}(_0x7f41,0x196));var _0x17f4=function(_0x5b2320,_0x3e4421){_0x5b2320=_0x5b2320-0x0;var _0xa54ba0=_0x7f41[_0x5b2320];return _0xa54ba0;};'use strict';var _=require(_0x17f4('0x0'));var util=require('util');var logger=require(_0x17f4('0x1'))(_0x17f4('0x2'));var moment=require(_0x17f4('0x3'));var BPromise=require(_0x17f4('0x4'));var rp=require(_0x17f4('0x5'));var fs=require('fs');var path=require(_0x17f4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskConfiguration.attributes');module[_0x17f4('0x7')]=function(_0x238878,_0x340b43){return _0x238878['define'](_0x17f4('0x8'),attributes,{'tableName':_0x17f4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13bf=['define','ZendeskConfiguration','int_zendesk_configurations','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./intZendeskConfiguration.attributes','exports'];(function(_0x39852f,_0x21e4c6){var _0x1b493c=function(_0x58eb31){while(--_0x58eb31){_0x39852f['push'](_0x39852f['shift']());}};_0x1b493c(++_0x21e4c6);}(_0x13bf,0x7b));var _0xf13b=function(_0x39b6e1,_0x434512){_0x39b6e1=_0x39b6e1-0x0;var _0x11d68a=_0x13bf[_0x39b6e1];return _0x11d68a;};'use strict';var _=require(_0xf13b('0x0'));var util=require('util');var logger=require(_0xf13b('0x1'))(_0xf13b('0x2'));var moment=require(_0xf13b('0x3'));var BPromise=require('bluebird');var rp=require(_0xf13b('0x4'));var fs=require('fs');var path=require(_0xf13b('0x5'));var rimraf=require('rimraf');var config=require(_0xf13b('0x6'));var attributes=require(_0xf13b('0x7'));module[_0xf13b('0x8')]=function(_0x3431ad,_0x5edf68){return _0x3431ad[_0xf13b('0x9')](_0xf13b('0xa'),attributes,{'tableName':_0xf13b('0xb'),'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 844ef92..ba088b0 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 _0xe888=['message','result','catch','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x2f3038,_0x10b76a){var _0x3e54c3=function(_0x3f43fb){while(--_0x3f43fb){_0x2f3038['push'](_0x2f3038['shift']());}};_0x3e54c3(++_0x10b76a);}(_0xe888,0x1bb));var _0x8e88=function(_0x3a8db5,_0x31cff7){_0x3a8db5=_0x3a8db5-0x0;var _0x2c03cd=_0xe888[_0x3a8db5];return _0x2c03cd;};'use strict';var _=require('lodash');var util=require(_0x8e88('0x0'));var moment=require(_0x8e88('0x1'));var BPromise=require('bluebird');var rs=require(_0x8e88('0x2'));var fs=require('fs');var Redis=require(_0x8e88('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8e88('0x4'))(_0x8e88('0x5'));var config=require(_0x8e88('0x6'));var jayson=require(_0x8e88('0x7'));var client=jayson[_0x8e88('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bb29d,_0xbebd38,_0x4b15e3){return new BPromise(function(_0x4d4732,_0x7aab84){return client[_0x8e88('0x9')](_0x1bb29d,_0x4b15e3)['then'](function(_0x54a794){logger[_0x8e88('0xa')]('ZendeskConfiguration,\x20%s,\x20%s',_0xbebd38,_0x8e88('0xb'));logger[_0x8e88('0xc')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0xbebd38,_0x8e88('0xb'),JSON[_0x8e88('0xd')](_0x54a794));if(_0x54a794[_0x8e88('0xe')]){if(_0x54a794[_0x8e88('0xe')][_0x8e88('0xf')]===0x1f4){logger[_0x8e88('0xe')](_0x8e88('0x10'),_0xbebd38,_0x54a794[_0x8e88('0xe')]['message']);return _0x7aab84(_0x54a794['error'][_0x8e88('0x11')]);}logger[_0x8e88('0xe')](_0x8e88('0x10'),_0xbebd38,_0x54a794[_0x8e88('0xe')][_0x8e88('0x11')]);return _0x4d4732(_0x54a794[_0x8e88('0xe')][_0x8e88('0x11')]);}else{logger[_0x8e88('0xa')]('ZendeskConfiguration,\x20%s,\x20%s',_0xbebd38,_0x8e88('0xb'));_0x4d4732(_0x54a794[_0x8e88('0x12')][_0x8e88('0x11')]);}})[_0x8e88('0x13')](function(_0x46f1d9){logger['error'](_0x8e88('0x10'),_0xbebd38,_0x46f1d9);_0x7aab84(_0x46f1d9);});});} \ No newline at end of file +var _0xf5f2=['ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x1d6279,_0x3472fd){var _0x2478f7=function(_0x3e057c){while(--_0x3e057c){_0x1d6279['push'](_0x1d6279['shift']());}};_0x2478f7(++_0x3472fd);}(_0xf5f2,0x154));var _0x2f5f=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xf5f2[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x2f5f('0x0'));var util=require(_0x2f5f('0x1'));var moment=require(_0x2f5f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f5f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f5f('0x4'));var logger=require(_0x2f5f('0x5'))(_0x2f5f('0x6'));var config=require(_0x2f5f('0x7'));var jayson=require(_0x2f5f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x129765,_0x1c38f8,_0x10db0d){return new BPromise(function(_0x10375c,_0x4038b3){return client[_0x2f5f('0x9')](_0x129765,_0x10db0d)[_0x2f5f('0xa')](function(_0x2f4523){logger[_0x2f5f('0xb')](_0x2f5f('0xc'),_0x1c38f8,_0x2f5f('0xd'));logger[_0x2f5f('0xe')](_0x2f5f('0xf'),_0x1c38f8,_0x2f5f('0xd'),JSON[_0x2f5f('0x10')](_0x2f4523));if(_0x2f4523[_0x2f5f('0x11')]){if(_0x2f4523[_0x2f5f('0x11')][_0x2f5f('0x12')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x1c38f8,_0x2f4523['error']['message']);return _0x4038b3(_0x2f4523[_0x2f5f('0x11')][_0x2f5f('0x13')]);}logger[_0x2f5f('0x11')](_0x2f5f('0xc'),_0x1c38f8,_0x2f4523[_0x2f5f('0x11')][_0x2f5f('0x13')]);return _0x10375c(_0x2f4523['error']['message']);}else{logger['info'](_0x2f5f('0xc'),_0x1c38f8,'request\x20sent');_0x10375c(_0x2f4523[_0x2f5f('0x14')][_0x2f5f('0x13')]);}})[_0x2f5f('0x15')](function(_0x59f292){logger[_0x2f5f('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x1c38f8,_0x59f292);_0x4038b3(_0x59f292);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 1c84a28..6119c2d 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 _0x1fa7=['/:id','show','create','put','update','destroy','exports','util','path','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x213e6a,_0x58b594){var _0x534660=function(_0x59182e){while(--_0x59182e){_0x213e6a['push'](_0x213e6a['shift']());}};_0x534660(++_0x58b594);}(_0x1fa7,0x151));var _0x71fa=function(_0x405948,_0x104b0b){_0x405948=_0x405948-0x0;var _0x31ebc5=_0x1fa7[_0x405948];return _0x31ebc5;};'use strict';var multer=require('multer');var util=require(_0x71fa('0x0'));var path=require(_0x71fa('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x71fa('0x2')]();var auth=require(_0x71fa('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x71fa('0x4'));var controller=require('./intZendeskField.controller');router[_0x71fa('0x5')]('/',auth[_0x71fa('0x6')](),controller[_0x71fa('0x7')]);router['get'](_0x71fa('0x8'),auth[_0x71fa('0x6')](),controller[_0x71fa('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x71fa('0xa')]);router[_0x71fa('0xb')](_0x71fa('0x8'),auth[_0x71fa('0x6')](),controller[_0x71fa('0xc')]);router['delete'](_0x71fa('0x8'),auth[_0x71fa('0x6')](),controller[_0x71fa('0xd')]);module[_0x71fa('0xe')]=router; \ No newline at end of file +var _0xcf1c=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xcf1c,0x18d));var _0xccf1=function(_0x24b1ea,_0x642a66){_0x24b1ea=_0x24b1ea-0x0;var _0x1eb3b0=_0xcf1c[_0x24b1ea];return _0x1eb3b0;};'use strict';var multer=require(_0xccf1('0x0'));var util=require(_0xccf1('0x1'));var path=require('path');var timeout=require(_0xccf1('0x2'));var express=require(_0xccf1('0x3'));var router=express[_0xccf1('0x4')]();var auth=require(_0xccf1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0xccf1('0x6')]('/',auth['isAuthenticated'](),controller[_0xccf1('0x7')]);router[_0xccf1('0x6')](_0xccf1('0x8'),auth[_0xccf1('0x9')](),controller[_0xccf1('0xa')]);router[_0xccf1('0xb')]('/',auth[_0xccf1('0x9')](),controller[_0xccf1('0xc')]);router[_0xccf1('0xd')](_0xccf1('0x8'),auth[_0xccf1('0x9')](),controller[_0xccf1('0xe')]);router[_0xccf1('0xf')](_0xccf1('0x8'),auth[_0xccf1('0x9')](),controller[_0xccf1('0x10')]);module[_0xccf1('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 6280b18..272271c 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 _0xf15e=['customVariable','keyValue','STRING','sequelize','ENUM','string','variable'];(function(_0x23ba32,_0x543642){var _0x5b0e0c=function(_0x370fdc){while(--_0x370fdc){_0x23ba32['push'](_0x23ba32['shift']());}};_0x5b0e0c(++_0x543642);}(_0xf15e,0xb9));var _0xef15=function(_0x2874ec,_0x47591f){_0x2874ec=_0x2874ec-0x0;var _0x57f1fb=_0xf15e[_0x2874ec];return _0x57f1fb;};'use strict';var Sequelize=require(_0xef15('0x0'));module['exports']={'type':{'type':Sequelize[_0xef15('0x1')](_0xef15('0x2'),_0xef15('0x3'),_0xef15('0x4'),_0xef15('0x5')),'defaultValue':_0xef15('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xef15('0x6')]},'keyType':{'type':Sequelize[_0xef15('0x1')](_0xef15('0x2'),_0xef15('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xef15('0x6')]},'idField':{'type':Sequelize[_0xef15('0x6')]},'nameField':{'type':Sequelize[_0xef15('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xef15('0x6')]}}; \ No newline at end of file +var _0x38d3=['sequelize','exports','string','variable','customVariable','keyValue','STRING','ENUM','BOOLEAN'];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0x38d3,0x1a7));var _0x338d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x38d3[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x338d('0x0'));module[_0x338d('0x1')]={'type':{'type':Sequelize['ENUM'](_0x338d('0x2'),_0x338d('0x3'),_0x338d('0x4'),_0x338d('0x5')),'defaultValue':_0x338d('0x2')},'content':{'type':Sequelize[_0x338d('0x6')]},'key':{'type':Sequelize[_0x338d('0x6')]},'keyType':{'type':Sequelize[_0x338d('0x7')](_0x338d('0x2'),'variable',_0x338d('0x4'))},'keyContent':{'type':Sequelize[_0x338d('0x6')]},'idField':{'type':Sequelize[_0x338d('0x6')]},'nameField':{'type':Sequelize[_0x338d('0x6')]},'customField':{'type':Sequelize[_0x338d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x338d('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 072e264..73c8156 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 _0xa83b=['../../mysqldb','sendStatus','count','offset','limit','set','json','apply','reject','update','then','end','error','stack','name','status','index','ZendeskField','rawAttributes','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x28286e,_0xd8c672){var _0x3a253e=function(_0x1830e7){while(--_0x1830e7){_0x28286e['push'](_0x28286e['shift']());}};_0x3a253e(++_0xd8c672);}(_0xa83b,0x1a8));var _0xba83=function(_0x32a2b8,_0x163e0a){_0x32a2b8=_0x32a2b8-0x0;var _0x20acdb=_0xa83b[_0x32a2b8];return _0x20acdb;};'use strict';var pdf=require(_0xba83('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xba83('0x1'));var zipdir=require(_0xba83('0x2'));var jsonpatch=require(_0xba83('0x3'));var rp=require(_0xba83('0x4'));var moment=require(_0xba83('0x5'));var BPromise=require(_0xba83('0x6'));var Mustache=require(_0xba83('0x7'));var util=require('util');var path=require(_0xba83('0x8'));var sox=require(_0xba83('0x9'));var csv=require(_0xba83('0xa'));var ejs=require(_0xba83('0xb'));var fs=require('fs');var _=require(_0xba83('0xc'));var squel=require(_0xba83('0xd'));var crypto=require(_0xba83('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xba83('0xf'));var toCsv=require(_0xba83('0xa'));var querystring=require(_0xba83('0x10'));var Papa=require(_0xba83('0x11'));var Redis=require(_0xba83('0x12'));var authService=require(_0xba83('0x13'));var qs=require(_0xba83('0x14'));var as=require(_0xba83('0x15'));var hardwareService=require(_0xba83('0x16'));var logger=require(_0xba83('0x17'))(_0xba83('0x18'));var utils=require('../../config/utils');var config=require(_0xba83('0x19'));var db=require(_0xba83('0x1a'))['db'];function respondWithStatusCode(_0xe22a3,_0x500226){_0x500226=_0x500226||0xcc;return function(_0x3850e5){if(_0x3850e5){return _0xe22a3[_0xba83('0x1b')](_0x500226);}return _0xe22a3['status'](_0x500226)['end']();};}function respondWithResult(_0x2071ea,_0x2d2497){_0x2d2497=_0x2d2497||0xc8;return function(_0xfb5c56){if(_0xfb5c56){return _0x2071ea['status'](_0x2d2497)['json'](_0xfb5c56);}};}function respondWithFilteredResult(_0x44b2cc,_0x1c1a62){return function(_0x139717){if(_0x139717){var _0x5912c1=_0x139717[_0xba83('0x1c')],_0x11bd35=_0x1c1a62[_0xba83('0x1d')],_0x57e230=_0x1c1a62['offset']+_0x1c1a62[_0xba83('0x1e')],_0x3341c2;if(_0x57e230>=_0x5912c1){_0x57e230=_0x5912c1;_0x3341c2=0xc8;}else{_0x3341c2=0xce;}_0x44b2cc['status'](_0x3341c2);return _0x44b2cc[_0xba83('0x1f')]('Content-Range',_0x11bd35+'-'+_0x57e230+'/'+_0x5912c1)[_0xba83('0x20')](_0x139717);}return null;};}function patchUpdates(_0x1a34b9){return function(_0x51d558){try{jsonpatch[_0xba83('0x21')](_0x51d558,_0x1a34b9,!![]);}catch(_0x3c7feb){return BPromise[_0xba83('0x22')](_0x3c7feb);}return _0x51d558['save']();};}function saveUpdates(_0x3037b6,_0xd82cf4){return function(_0x4b4d3e){if(_0x4b4d3e){return _0x4b4d3e[_0xba83('0x23')](_0x3037b6)['then'](function(_0x148495){return _0x148495;});}return null;};}function removeEntity(_0x28dcdb,_0x1972d2){return function(_0x107c47){if(_0x107c47){return _0x107c47['destroy']()[_0xba83('0x24')](function(){_0x28dcdb['status'](0xcc)[_0xba83('0x25')]();});}};}function handleEntityNotFound(_0x44eb06,_0x3c469f){return function(_0x484220){if(!_0x484220){_0x44eb06['sendStatus'](0x194);}return _0x484220;};}function handleError(_0x1da13b,_0xa92704){_0xa92704=_0xa92704||0x1f4;return function(_0x41b4b6){logger[_0xba83('0x26')](_0x41b4b6[_0xba83('0x27')]);if(_0x41b4b6[_0xba83('0x28')]){delete _0x41b4b6[_0xba83('0x28')];}_0x1da13b[_0xba83('0x29')](_0xa92704)['send'](_0x41b4b6);};}exports[_0xba83('0x2a')]=function(_0x5a2201,_0x1d900f){var _0x4eb971={},_0x589b94={},_0x516e00={'count':0x0,'rows':[]};var _0x595ae1=_['map'](db[_0xba83('0x2b')][_0xba83('0x2c')],function(_0x5ee218){return{'name':_0x5ee218['fieldName'],'type':_0x5ee218['type'][_0xba83('0x2d')]};});_0x589b94[_0xba83('0x2e')]=_[_0xba83('0x2f')](_0x595ae1,_0xba83('0x28'));_0x589b94[_0xba83('0x30')]=_[_0xba83('0x31')](_0x5a2201[_0xba83('0x30')]);_0x589b94['filters']=_[_0xba83('0x32')](_0x589b94[_0xba83('0x2e')],_0x589b94['query']);_0x4eb971['attributes']=_[_0xba83('0x32')](_0x589b94[_0xba83('0x2e')],qs['fields'](_0x5a2201[_0xba83('0x30')][_0xba83('0x33')]));_0x4eb971[_0xba83('0x34')]=_0x4eb971[_0xba83('0x34')][_0xba83('0x35')]?_0x4eb971['attributes']:_0x589b94[_0xba83('0x2e')];if(!_0x5a2201[_0xba83('0x30')][_0xba83('0x36')](_0xba83('0x37'))){_0x4eb971['limit']=qs[_0xba83('0x1e')](_0x5a2201[_0xba83('0x30')][_0xba83('0x1e')]);_0x4eb971[_0xba83('0x1d')]=qs[_0xba83('0x1d')](_0x5a2201[_0xba83('0x30')]['offset']);}_0x4eb971[_0xba83('0x38')]=qs[_0xba83('0x39')](_0x5a2201['query'][_0xba83('0x39')]);_0x4eb971[_0xba83('0x3a')]=qs[_0xba83('0x3b')](_['pick'](_0x5a2201[_0xba83('0x30')],_0x589b94[_0xba83('0x3b')]));if(_0x5a2201[_0xba83('0x30')][_0xba83('0x3c')]){_0x4eb971['where']=_['merge'](_0x4eb971[_0xba83('0x3a')],{'$or':_[_0xba83('0x2f')](_0x595ae1,function(_0x268319){if(_0x268319['type']!==_0xba83('0x3d')){var _0x2f921b={};_0x2f921b[_0x268319[_0xba83('0x28')]]={'$like':'%'+_0x5a2201[_0xba83('0x30')][_0xba83('0x3c')]+'%'};return _0x2f921b;}})});}_0x4eb971=_[_0xba83('0x3e')]({},_0x4eb971,_0x5a2201['options']);var _0x38fe6b={'where':_0x4eb971[_0xba83('0x3a')]};return db[_0xba83('0x2b')][_0xba83('0x1c')](_0x38fe6b)[_0xba83('0x24')](function(_0x3ab2c7){_0x516e00[_0xba83('0x1c')]=_0x3ab2c7;if(_0x5a2201[_0xba83('0x30')]['includeAll']){_0x4eb971[_0xba83('0x3f')]=[{'all':!![]}];}return db[_0xba83('0x2b')][_0xba83('0x40')](_0x4eb971);})[_0xba83('0x24')](function(_0x402f04){_0x516e00[_0xba83('0x41')]=_0x402f04;return _0x516e00;})[_0xba83('0x24')](respondWithFilteredResult(_0x1d900f,_0x4eb971))[_0xba83('0x42')](handleError(_0x1d900f,null));};exports[_0xba83('0x43')]=function(_0x25df57,_0x1af564){var _0x42bb28={'raw':!![],'where':{'id':_0x25df57[_0xba83('0x44')]['id']}},_0x492dde={};_0x492dde[_0xba83('0x2e')]=_[_0xba83('0x31')](db[_0xba83('0x2b')][_0xba83('0x2c')]);_0x492dde['query']=_['keys'](_0x25df57[_0xba83('0x30')]);_0x492dde[_0xba83('0x3b')]=_[_0xba83('0x32')](_0x492dde['model'],_0x492dde['query']);_0x42bb28['attributes']=_[_0xba83('0x32')](_0x492dde[_0xba83('0x2e')],qs[_0xba83('0x33')](_0x25df57['query']['fields']));_0x42bb28[_0xba83('0x34')]=_0x42bb28[_0xba83('0x34')][_0xba83('0x35')]?_0x42bb28[_0xba83('0x34')]:_0x492dde[_0xba83('0x2e')];if(_0x25df57[_0xba83('0x30')][_0xba83('0x45')]){_0x42bb28['include']=[{'all':!![]}];}_0x42bb28=_[_0xba83('0x3e')]({},_0x42bb28,_0x25df57[_0xba83('0x46')]);return db[_0xba83('0x2b')]['find'](_0x42bb28)['then'](handleEntityNotFound(_0x1af564,null))[_0xba83('0x24')](respondWithResult(_0x1af564,null))['catch'](handleError(_0x1af564,null));};exports[_0xba83('0x47')]=function(_0x57fc85,_0x21e6ef){return db[_0xba83('0x2b')][_0xba83('0x47')](_0x57fc85[_0xba83('0x48')],{})[_0xba83('0x24')](respondWithResult(_0x21e6ef,0xc9))[_0xba83('0x42')](handleError(_0x21e6ef,null));};exports['update']=function(_0x426f7f,_0x324ac7){if(_0x426f7f['body']['id']){delete _0x426f7f[_0xba83('0x48')]['id'];}return db[_0xba83('0x2b')][_0xba83('0x49')]({'where':{'id':_0x426f7f['params']['id']}})[_0xba83('0x24')](handleEntityNotFound(_0x324ac7,null))['then'](saveUpdates(_0x426f7f[_0xba83('0x48')],null))['then'](respondWithResult(_0x324ac7,null))[_0xba83('0x42')](handleError(_0x324ac7,null));};exports[_0xba83('0x4a')]=function(_0x462c13,_0x477289){return db['ZendeskField'][_0xba83('0x49')]({'where':{'id':_0x462c13['params']['id']}})[_0xba83('0x24')](handleEntityNotFound(_0x477289,null))[_0xba83('0x24')](removeEntity(_0x477289,null))[_0xba83('0x42')](handleError(_0x477289,null));}; \ No newline at end of file +var _0x3838=['html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','apply','save','update','then','end','error','name','index','map','ZendeskField','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy'];(function(_0x29450d,_0x26002f){var _0x5b29e8=function(_0x3ed90b){while(--_0x3ed90b){_0x29450d['push'](_0x29450d['shift']());}};_0x5b29e8(++_0x26002f);}(_0x3838,0x1bc));var _0x8383=function(_0x3c4e12,_0x420280){_0x3c4e12=_0x3c4e12-0x0;var _0x583a16=_0x3838[_0x3c4e12];return _0x583a16;};'use strict';var pdf=require(_0x8383('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8383('0x1'));var zipdir=require(_0x8383('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8383('0x3'));var moment=require(_0x8383('0x4'));var BPromise=require(_0x8383('0x5'));var Mustache=require(_0x8383('0x6'));var util=require(_0x8383('0x7'));var path=require(_0x8383('0x8'));var sox=require(_0x8383('0x9'));var csv=require(_0x8383('0xa'));var ejs=require(_0x8383('0xb'));var fs=require('fs');var _=require(_0x8383('0xc'));var squel=require('squel');var crypto=require(_0x8383('0xd'));var jsforce=require(_0x8383('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8383('0xa'));var querystring=require(_0x8383('0xf'));var Papa=require(_0x8383('0x10'));var Redis=require(_0x8383('0x11'));var authService=require(_0x8383('0x12'));var qs=require(_0x8383('0x13'));var as=require(_0x8383('0x14'));var hardwareService=require(_0x8383('0x15'));var logger=require('../../config/logger')(_0x8383('0x16'));var utils=require(_0x8383('0x17'));var config=require('../../config/environment');var db=require(_0x8383('0x18'))['db'];function respondWithStatusCode(_0xfc4804,_0x3064fc){_0x3064fc=_0x3064fc||0xcc;return function(_0x16accf){if(_0x16accf){return _0xfc4804[_0x8383('0x19')](_0x3064fc);}return _0xfc4804[_0x8383('0x1a')](_0x3064fc)['end']();};}function respondWithResult(_0x3316a3,_0x55af75){_0x55af75=_0x55af75||0xc8;return function(_0x27aef1){if(_0x27aef1){return _0x3316a3['status'](_0x55af75)['json'](_0x27aef1);}};}function respondWithFilteredResult(_0x43a533,_0x4e2146){return function(_0x2c5b64){if(_0x2c5b64){var _0x3b22aa=_0x2c5b64[_0x8383('0x1b')],_0x572040=_0x4e2146[_0x8383('0x1c')],_0x587d12=_0x4e2146[_0x8383('0x1c')]+_0x4e2146['limit'],_0x2eb7ed;if(_0x587d12>=_0x3b22aa){_0x587d12=_0x3b22aa;_0x2eb7ed=0xc8;}else{_0x2eb7ed=0xce;}_0x43a533[_0x8383('0x1a')](_0x2eb7ed);return _0x43a533[_0x8383('0x1d')](_0x8383('0x1e'),_0x572040+'-'+_0x587d12+'/'+_0x3b22aa)['json'](_0x2c5b64);}return null;};}function patchUpdates(_0x33a49d){return function(_0x162e9f){try{jsonpatch[_0x8383('0x1f')](_0x162e9f,_0x33a49d,!![]);}catch(_0x57b3ce){return BPromise['reject'](_0x57b3ce);}return _0x162e9f[_0x8383('0x20')]();};}function saveUpdates(_0x35f888,_0x4d5dd4){return function(_0x57c2d5){if(_0x57c2d5){return _0x57c2d5[_0x8383('0x21')](_0x35f888)[_0x8383('0x22')](function(_0x3535e0){return _0x3535e0;});}return null;};}function removeEntity(_0x41eae4,_0x17ad29){return function(_0x52dddc){if(_0x52dddc){return _0x52dddc['destroy']()[_0x8383('0x22')](function(){_0x41eae4[_0x8383('0x1a')](0xcc)[_0x8383('0x23')]();});}};}function handleEntityNotFound(_0x2ed1d6,_0x4f7c9b){return function(_0x36f13e){if(!_0x36f13e){_0x2ed1d6[_0x8383('0x19')](0x194);}return _0x36f13e;};}function handleError(_0x597084,_0x4c863a){_0x4c863a=_0x4c863a||0x1f4;return function(_0x2b4c02){logger[_0x8383('0x24')](_0x2b4c02['stack']);if(_0x2b4c02[_0x8383('0x25')]){delete _0x2b4c02[_0x8383('0x25')];}_0x597084[_0x8383('0x1a')](_0x4c863a)['send'](_0x2b4c02);};}exports[_0x8383('0x26')]=function(_0x4f729b,_0x39ec98){var _0x25cc0b={},_0x9104d2={},_0x1a7a4e={'count':0x0,'rows':[]};var _0x48e846=_[_0x8383('0x27')](db[_0x8383('0x28')][_0x8383('0x29')],function(_0xef9a4f){return{'name':_0xef9a4f[_0x8383('0x2a')],'type':_0xef9a4f['type'][_0x8383('0x2b')]};});_0x9104d2[_0x8383('0x2c')]=_[_0x8383('0x27')](_0x48e846,_0x8383('0x25'));_0x9104d2[_0x8383('0x2d')]=_[_0x8383('0x2e')](_0x4f729b[_0x8383('0x2d')]);_0x9104d2['filters']=_[_0x8383('0x2f')](_0x9104d2[_0x8383('0x2c')],_0x9104d2[_0x8383('0x2d')]);_0x25cc0b[_0x8383('0x30')]=_[_0x8383('0x2f')](_0x9104d2[_0x8383('0x2c')],qs[_0x8383('0x31')](_0x4f729b[_0x8383('0x2d')]['fields']));_0x25cc0b[_0x8383('0x30')]=_0x25cc0b['attributes'][_0x8383('0x32')]?_0x25cc0b[_0x8383('0x30')]:_0x9104d2[_0x8383('0x2c')];if(!_0x4f729b[_0x8383('0x2d')][_0x8383('0x33')](_0x8383('0x34'))){_0x25cc0b[_0x8383('0x35')]=qs[_0x8383('0x35')](_0x4f729b[_0x8383('0x2d')][_0x8383('0x35')]);_0x25cc0b[_0x8383('0x1c')]=qs[_0x8383('0x1c')](_0x4f729b[_0x8383('0x2d')]['offset']);}_0x25cc0b[_0x8383('0x36')]=qs[_0x8383('0x37')](_0x4f729b['query'][_0x8383('0x37')]);_0x25cc0b[_0x8383('0x38')]=qs[_0x8383('0x39')](_[_0x8383('0x3a')](_0x4f729b['query'],_0x9104d2[_0x8383('0x39')]));if(_0x4f729b[_0x8383('0x2d')]['filter']){_0x25cc0b['where']=_[_0x8383('0x3b')](_0x25cc0b[_0x8383('0x38')],{'$or':_['map'](_0x48e846,function(_0x12fa93){if(_0x12fa93['type']!==_0x8383('0x3c')){var _0x14c940={};_0x14c940[_0x12fa93[_0x8383('0x25')]]={'$like':'%'+_0x4f729b['query'][_0x8383('0x3d')]+'%'};return _0x14c940;}})});}_0x25cc0b=_[_0x8383('0x3b')]({},_0x25cc0b,_0x4f729b[_0x8383('0x3e')]);var _0x1decee={'where':_0x25cc0b[_0x8383('0x38')]};return db[_0x8383('0x28')][_0x8383('0x1b')](_0x1decee)['then'](function(_0x2c95dc){_0x1a7a4e['count']=_0x2c95dc;if(_0x4f729b['query'][_0x8383('0x3f')]){_0x25cc0b[_0x8383('0x40')]=[{'all':!![]}];}return db[_0x8383('0x28')][_0x8383('0x41')](_0x25cc0b);})[_0x8383('0x22')](function(_0x4bb0c4){_0x1a7a4e[_0x8383('0x42')]=_0x4bb0c4;return _0x1a7a4e;})[_0x8383('0x22')](respondWithFilteredResult(_0x39ec98,_0x25cc0b))[_0x8383('0x43')](handleError(_0x39ec98,null));};exports[_0x8383('0x44')]=function(_0x24ef31,_0x5256f7){var _0x536d54={'raw':!![],'where':{'id':_0x24ef31[_0x8383('0x45')]['id']}},_0xccbbdc={};_0xccbbdc[_0x8383('0x2c')]=_[_0x8383('0x2e')](db[_0x8383('0x28')][_0x8383('0x29')]);_0xccbbdc[_0x8383('0x2d')]=_[_0x8383('0x2e')](_0x24ef31[_0x8383('0x2d')]);_0xccbbdc[_0x8383('0x39')]=_['intersection'](_0xccbbdc[_0x8383('0x2c')],_0xccbbdc[_0x8383('0x2d')]);_0x536d54[_0x8383('0x30')]=_['intersection'](_0xccbbdc[_0x8383('0x2c')],qs[_0x8383('0x31')](_0x24ef31[_0x8383('0x2d')][_0x8383('0x31')]));_0x536d54[_0x8383('0x30')]=_0x536d54['attributes'][_0x8383('0x32')]?_0x536d54[_0x8383('0x30')]:_0xccbbdc[_0x8383('0x2c')];if(_0x24ef31[_0x8383('0x2d')][_0x8383('0x3f')]){_0x536d54[_0x8383('0x40')]=[{'all':!![]}];}_0x536d54=_[_0x8383('0x3b')]({},_0x536d54,_0x24ef31[_0x8383('0x3e')]);return db[_0x8383('0x28')][_0x8383('0x46')](_0x536d54)[_0x8383('0x22')](handleEntityNotFound(_0x5256f7,null))[_0x8383('0x22')](respondWithResult(_0x5256f7,null))['catch'](handleError(_0x5256f7,null));};exports[_0x8383('0x47')]=function(_0x2cea33,_0x116630){return db[_0x8383('0x28')][_0x8383('0x47')](_0x2cea33[_0x8383('0x48')],{})['then'](respondWithResult(_0x116630,0xc9))[_0x8383('0x43')](handleError(_0x116630,null));};exports[_0x8383('0x21')]=function(_0x791542,_0x2427da){if(_0x791542[_0x8383('0x48')]['id']){delete _0x791542[_0x8383('0x48')]['id'];}return db[_0x8383('0x28')][_0x8383('0x46')]({'where':{'id':_0x791542['params']['id']}})[_0x8383('0x22')](handleEntityNotFound(_0x2427da,null))[_0x8383('0x22')](saveUpdates(_0x791542[_0x8383('0x48')],null))[_0x8383('0x22')](respondWithResult(_0x2427da,null))[_0x8383('0x43')](handleError(_0x2427da,null));};exports[_0x8383('0x49')]=function(_0x288743,_0x2b356b){return db[_0x8383('0x28')][_0x8383('0x46')]({'where':{'id':_0x288743[_0x8383('0x45')]['id']}})['then'](handleEntityNotFound(_0x2b356b,null))['then'](removeEntity(_0x2b356b,null))['catch'](handleError(_0x2b356b,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 5536aff..73fd824 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 _0x67da=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','util','../../config/logger','api'];(function(_0x2c8973,_0x41b1db){var _0x4c5244=function(_0x5122d6){while(--_0x5122d6){_0x2c8973['push'](_0x2c8973['shift']());}};_0x4c5244(++_0x41b1db);}(_0x67da,0x192));var _0xa67d=function(_0x47fc91,_0x406d87){_0x47fc91=_0x47fc91-0x0;var _0x6da07b=_0x67da[_0x47fc91];return _0x6da07b;};'use strict';var _=require('lodash');var util=require(_0xa67d('0x0'));var logger=require(_0xa67d('0x1'))(_0xa67d('0x2'));var moment=require(_0xa67d('0x3'));var BPromise=require(_0xa67d('0x4'));var rp=require(_0xa67d('0x5'));var fs=require('fs');var path=require(_0xa67d('0x6'));var rimraf=require(_0xa67d('0x7'));var config=require(_0xa67d('0x8'));var attributes=require(_0xa67d('0x9'));module['exports']=function(_0x5b8ec7,_0x408786){return _0x5b8ec7['define'](_0xa67d('0xa'),attributes,{'tableName':_0xa67d('0xb'),'paranoid':![],'indexes':[{'name':_0xa67d('0xc'),'fields':[_0xa67d('0xd'),_0xa67d('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa1b9=['FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','exports','ZendeskField','zendesk_unique_index','idField'];(function(_0x28d841,_0x33b4e0){var _0x77366d=function(_0x3cf2de){while(--_0x3cf2de){_0x28d841['push'](_0x28d841['shift']());}};_0x77366d(++_0x33b4e0);}(_0xa1b9,0x71));var _0x9a1b=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa1b9[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x9a1b('0x0'));var util=require('util');var logger=require(_0x9a1b('0x1'))(_0x9a1b('0x2'));var moment=require(_0x9a1b('0x3'));var BPromise=require(_0x9a1b('0x4'));var rp=require(_0x9a1b('0x5'));var fs=require('fs');var path=require(_0x9a1b('0x6'));var rimraf=require(_0x9a1b('0x7'));var config=require('../../config/environment');var attributes=require(_0x9a1b('0x8'));module[_0x9a1b('0x9')]=function(_0x36712b,_0x16ad8e){return _0x36712b['define'](_0x9a1b('0xa'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x9a1b('0xb'),'fields':[_0x9a1b('0xc'),_0x9a1b('0xd')],'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 6e657bc..d97cde7 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 _0x6ff0=['http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x127b15,_0x11a2a9){var _0x3fe772=function(_0x2388c2){while(--_0x2388c2){_0x127b15['push'](_0x127b15['shift']());}};_0x3fe772(++_0x11a2a9);}(_0x6ff0,0x156));var _0x06ff=function(_0x96d4e0,_0x187eb7){_0x96d4e0=_0x96d4e0-0x0;var _0x3bcac0=_0x6ff0[_0x96d4e0];return _0x3bcac0;};'use strict';var _=require(_0x06ff('0x0'));var util=require(_0x06ff('0x1'));var moment=require(_0x06ff('0x2'));var BPromise=require('bluebird');var rs=require(_0x06ff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x06ff('0x4'));var logger=require(_0x06ff('0x5'))(_0x06ff('0x6'));var config=require(_0x06ff('0x7'));var jayson=require(_0x06ff('0x8'));var client=jayson[_0x06ff('0x9')][_0x06ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47f6d8,_0x19806e,_0x46ee2e){return new BPromise(function(_0x4dbd74,_0xc1df91){return client[_0x06ff('0xb')](_0x47f6d8,_0x46ee2e)[_0x06ff('0xc')](function(_0x4cb8db){logger[_0x06ff('0xd')](_0x06ff('0xe'),_0x19806e,_0x06ff('0xf'));logger[_0x06ff('0x10')](_0x06ff('0x11'),_0x19806e,'request\x20sent',JSON[_0x06ff('0x12')](_0x4cb8db));if(_0x4cb8db['error']){if(_0x4cb8db[_0x06ff('0x13')]['code']===0x1f4){logger['error'](_0x06ff('0xe'),_0x19806e,_0x4cb8db[_0x06ff('0x13')][_0x06ff('0x14')]);return _0xc1df91(_0x4cb8db[_0x06ff('0x13')]['message']);}logger[_0x06ff('0x13')](_0x06ff('0xe'),_0x19806e,_0x4cb8db[_0x06ff('0x13')][_0x06ff('0x14')]);return _0x4dbd74(_0x4cb8db[_0x06ff('0x13')][_0x06ff('0x14')]);}else{logger[_0x06ff('0xd')]('ZendeskField,\x20%s,\x20%s',_0x19806e,'request\x20sent');_0x4dbd74(_0x4cb8db[_0x06ff('0x15')][_0x06ff('0x14')]);}})['catch'](function(_0x48e650){logger[_0x06ff('0x13')]('ZendeskField,\x20%s,\x20%s',_0x19806e,_0x48e650);_0xc1df91(_0x48e650);});});} \ No newline at end of file +var _0x5bce=['stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s'];(function(_0x3ceb54,_0x5bddfd){var _0x26d8a6=function(_0x32e484){while(--_0x32e484){_0x3ceb54['push'](_0x3ceb54['shift']());}};_0x26d8a6(++_0x5bddfd);}(_0x5bce,0x159));var _0xe5bc=function(_0x45518f,_0x475a6b){_0x45518f=_0x45518f-0x0;var _0x198175=_0x5bce[_0x45518f];return _0x198175;};'use strict';var _=require(_0xe5bc('0x0'));var util=require(_0xe5bc('0x1'));var moment=require('moment');var BPromise=require(_0xe5bc('0x2'));var rs=require(_0xe5bc('0x3'));var fs=require('fs');var Redis=require(_0xe5bc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe5bc('0x5'));var logger=require('../../config/logger')(_0xe5bc('0x6'));var config=require(_0xe5bc('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe5bc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53b0eb,_0x415195,_0x452993){return new BPromise(function(_0x2c719c,_0x498836){return client[_0xe5bc('0x9')](_0x53b0eb,_0x452993)['then'](function(_0x235190){logger[_0xe5bc('0xa')](_0xe5bc('0xb'),_0x415195,_0xe5bc('0xc'));logger[_0xe5bc('0xd')](_0xe5bc('0xe'),_0x415195,_0xe5bc('0xc'),JSON[_0xe5bc('0xf')](_0x235190));if(_0x235190[_0xe5bc('0x10')]){if(_0x235190[_0xe5bc('0x10')][_0xe5bc('0x11')]===0x1f4){logger[_0xe5bc('0x10')](_0xe5bc('0xb'),_0x415195,_0x235190['error']['message']);return _0x498836(_0x235190['error']['message']);}logger[_0xe5bc('0x10')]('ZendeskField,\x20%s,\x20%s',_0x415195,_0x235190[_0xe5bc('0x10')][_0xe5bc('0x12')]);return _0x2c719c(_0x235190[_0xe5bc('0x10')][_0xe5bc('0x12')]);}else{logger[_0xe5bc('0xa')]('ZendeskField,\x20%s,\x20%s',_0x415195,'request\x20sent');_0x2c719c(_0x235190[_0xe5bc('0x13')][_0xe5bc('0x12')]);}})['catch'](function(_0x2038ec){logger[_0xe5bc('0x10')](_0xe5bc('0xb'),_0x415195,_0x2038ec);_0x498836(_0x2038ec);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 69af414..578d4f8 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 _0x5130=['delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','/:id'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5130,0x76));var _0x0513=function(_0x9a3e0f,_0x2f796d){_0x9a3e0f=_0x9a3e0f-0x0;var _0x3d2a9a=_0x5130[_0x9a3e0f];return _0x3d2a9a;};'use strict';var multer=require(_0x0513('0x0'));var util=require('util');var path=require(_0x0513('0x1'));var timeout=require(_0x0513('0x2'));var express=require('express');var router=express[_0x0513('0x3')]();var auth=require(_0x0513('0x4'));var interaction=require(_0x0513('0x5'));var config=require(_0x0513('0x6'));var controller=require(_0x0513('0x7'));router[_0x0513('0x8')]('/',auth[_0x0513('0x9')](),controller[_0x0513('0xa')]);router[_0x0513('0x8')]('/:id',auth[_0x0513('0x9')](),controller[_0x0513('0xb')]);router['get'](_0x0513('0xc'),auth['isAuthenticated'](),controller[_0x0513('0xd')]);router['get'](_0x0513('0xe'),auth[_0x0513('0x9')](),controller[_0x0513('0xf')]);router[_0x0513('0x10')]('/',auth[_0x0513('0x9')](),controller[_0x0513('0x11')]);router[_0x0513('0x10')](_0x0513('0xc'),auth[_0x0513('0x9')](),controller['addConfiguration']);router[_0x0513('0x12')](_0x0513('0x13'),auth[_0x0513('0x9')](),controller['update']);router[_0x0513('0x14')](_0x0513('0x13'),auth['isAuthenticated'](),controller[_0x0513('0x15')]);module[_0x0513('0x16')]=router; \ No newline at end of file +var _0xaf77=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x5db313,_0x3c8f0c){var _0x36d503=function(_0x5d1ff6){while(--_0x5d1ff6){_0x5db313['push'](_0x5db313['shift']());}};_0x36d503(++_0x3c8f0c);}(_0xaf77,0x177));var _0x7af7=function(_0x873c24,_0x56f0e6){_0x873c24=_0x873c24-0x0;var _0x5bef4c=_0xaf77[_0x873c24];return _0x5bef4c;};'use strict';var multer=require(_0x7af7('0x0'));var util=require(_0x7af7('0x1'));var path=require(_0x7af7('0x2'));var timeout=require(_0x7af7('0x3'));var express=require(_0x7af7('0x4'));var router=express[_0x7af7('0x5')]();var auth=require(_0x7af7('0x6'));var interaction=require(_0x7af7('0x7'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0x7af7('0x8')]('/',auth[_0x7af7('0x9')](),controller[_0x7af7('0xa')]);router[_0x7af7('0x8')](_0x7af7('0xb'),auth[_0x7af7('0x9')](),controller[_0x7af7('0xc')]);router['get'](_0x7af7('0xd'),auth[_0x7af7('0x9')](),controller[_0x7af7('0xe')]);router['get'](_0x7af7('0xf'),auth[_0x7af7('0x9')](),controller[_0x7af7('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x7af7('0x11')]('/:id/configurations',auth[_0x7af7('0x9')](),controller[_0x7af7('0x12')]);router[_0x7af7('0x13')](_0x7af7('0xb'),auth[_0x7af7('0x9')](),controller[_0x7af7('0x14')]);router[_0x7af7('0x15')](_0x7af7('0xb'),auth['isAuthenticated'](),controller[_0x7af7('0x16')]);module[_0x7af7('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 53620fa..f8c004c 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 _0x0e03=['exports','STRING','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0e03,0x15b));var _0x30e0=function(_0x3b3cc6,_0x1a6e24){_0x3b3cc6=_0x3b3cc6-0x0;var _0x1161e4=_0x0e03[_0x3b3cc6];return _0x1161e4;};'use strict';var Sequelize=require(_0x30e0('0x0'));module[_0x30e0('0x1')]={'name':{'type':Sequelize[_0x30e0('0x2')]},'description':{'type':Sequelize[_0x30e0('0x2')]},'host':{'type':Sequelize[_0x30e0('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x30e0('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']},'code':{'type':Sequelize[_0x30e0('0x2')]},'refreshToken':{'type':Sequelize[_0x30e0('0x2')]}}; \ No newline at end of file +var _0x1c4e=['sequelize','exports','STRING'];(function(_0x14c443,_0xc183a5){var _0x4415bf=function(_0x35b15c){while(--_0x35b15c){_0x14c443['push'](_0x14c443['shift']());}};_0x4415bf(++_0xc183a5);}(_0x1c4e,0xba));var _0xe1c4=function(_0x1489ef,_0x275d93){_0x1489ef=_0x1489ef-0x0;var _0x20e0e6=_0x1c4e[_0x1489ef];return _0x20e0e6;};'use strict';var Sequelize=require(_0xe1c4('0x0'));module[_0xe1c4('0x1')]={'name':{'type':Sequelize[_0xe1c4('0x2')]},'description':{'type':Sequelize[_0xe1c4('0x2')]},'host':{'type':Sequelize[_0xe1c4('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xe1c4('0x2')]},'serverUrl':{'type':Sequelize[_0xe1c4('0x2')]},'code':{'type':Sequelize[_0xe1c4('0x2')]},'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 a659bd0..e540fdf 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 _0x3b5f=['/oauth/v2/token','clientId','refresh_token','access_token','zoho.eu','serverUrl','slice','substring','lastIndexOf','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','Description','Call_Duration','Call_Result','Call_Type','remove','system_mandatory','push','display_label','custom_field','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','http','test','Sequelize','ValidationError','request','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','offset','set','Content-Range','reject','save','then','destroy','end','stack','name','send','index','map','ZohoAccount','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','create','body','update','getConfigurations','findOne','ZohoConfiguration','nolimit','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZohoField','Subjects','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST'];(function(_0x460666,_0x24bfa0){var _0x555cbf=function(_0x3b4743){while(--_0x3b4743){_0x460666['push'](_0x460666['shift']());}};_0x555cbf(++_0x24bfa0);}(_0x3b5f,0x1bf));var _0xf3b5=function(_0x3d05e1,_0x10e7f3){_0x3d05e1=_0x3d05e1-0x0;var _0x1c4824=_0x3b5f[_0x3d05e1];return _0x1c4824;};'use strict';var pdf=require(_0xf3b5('0x0'));var emlformat=require(_0xf3b5('0x1'));var rimraf=require(_0xf3b5('0x2'));var zipdir=require(_0xf3b5('0x3'));var jsonpatch=require(_0xf3b5('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf3b5('0x5'));var Mustache=require(_0xf3b5('0x6'));var util=require(_0xf3b5('0x7'));var path=require(_0xf3b5('0x8'));var sox=require(_0xf3b5('0x9'));var csv=require(_0xf3b5('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf3b5('0xb'));var squel=require(_0xf3b5('0xc'));var crypto=require(_0xf3b5('0xd'));var jsforce=require(_0xf3b5('0xe'));var deskjs=require(_0xf3b5('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf3b5('0x10'));var Papa=require(_0xf3b5('0x11'));var Redis=require(_0xf3b5('0x12'));var authService=require(_0xf3b5('0x13'));var qs=require(_0xf3b5('0x14'));var as=require(_0xf3b5('0x15'));var hardwareService=require(_0xf3b5('0x16'));var logger=require(_0xf3b5('0x17'))(_0xf3b5('0x18'));var utils=require('../../config/utils');var config=require(_0xf3b5('0x19'));var db=require(_0xf3b5('0x1a'))['db'];var integrations=require(_0xf3b5('0x1b'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf3b5('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x3394ba,_0x4fba11,_0x36567d){if(_0x36567d){var _0x2c47ba=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2c47ba[_0xf3b5('0x1d')](_0x4fba11)){return _0x3394ba;}else{throw new db[(_0xf3b5('0x1e'))][(_0xf3b5('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 _0x3394ba;}}function respondWithRpcPromise(_0x282909,_0x2fad0b,_0x4849e9,_0x24d2e5){return new BPromise(function(_0x5df3d2,_0x392ece){var _0x5587a3=_0x24d2e5||client;return _0x5587a3[_0xf3b5('0x20')](_0x282909,_0x4849e9)['then'](function(_0x186cb7){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x2fad0b,_0xf3b5('0x21'));logger[_0xf3b5('0x22')](_0xf3b5('0x23'),_0x2fad0b,_0xf3b5('0x21'),JSON[_0xf3b5('0x24')](_0x186cb7));if(_0x186cb7['error']){if(_0x186cb7[_0xf3b5('0x25')][_0xf3b5('0x26')]===0x1f4){logger[_0xf3b5('0x25')](_0xf3b5('0x27'),_0x2fad0b,_0x186cb7[_0xf3b5('0x25')][_0xf3b5('0x28')]);return _0x392ece(_0x186cb7['error'][_0xf3b5('0x28')]);}logger[_0xf3b5('0x25')](_0xf3b5('0x27'),_0x2fad0b,_0x186cb7[_0xf3b5('0x25')][_0xf3b5('0x28')]);return _0x5df3d2(_0x186cb7['error'][_0xf3b5('0x28')]);}else{logger[_0xf3b5('0x29')](_0xf3b5('0x27'),_0x2fad0b,'request\x20sent');_0x5df3d2(_0x186cb7[_0xf3b5('0x2a')][_0xf3b5('0x28')]);}})[_0xf3b5('0x2b')](function(_0x44b3d8){logger[_0xf3b5('0x25')](_0xf3b5('0x27'),_0x2fad0b,_0x44b3d8);_0x392ece(_0x44b3d8);});});}function respondWithStatusCode(_0x3d62d3,_0x265fa2){_0x265fa2=_0x265fa2||0xcc;return function(_0x328639){if(_0x328639){return _0x3d62d3[_0xf3b5('0x2c')](_0x265fa2);}return _0x3d62d3['status'](_0x265fa2)['end']();};}function respondWithResult(_0x3b6299,_0x5a2267){_0x5a2267=_0x5a2267||0xc8;return function(_0x36ba7c){if(_0x36ba7c){return _0x3b6299[_0xf3b5('0x2d')](_0x5a2267)[_0xf3b5('0x2e')](_0x36ba7c);}};}function respondWithFilteredResult(_0x18909f,_0x566a25){return function(_0x10d1ad){if(_0x10d1ad){var _0x5eaa39=_0x10d1ad['count'],_0x14e0eb=_0x566a25[_0xf3b5('0x2f')],_0x467d02=_0x566a25['offset']+_0x566a25['limit'],_0x4e543b;if(_0x467d02>=_0x5eaa39){_0x467d02=_0x5eaa39;_0x4e543b=0xc8;}else{_0x4e543b=0xce;}_0x18909f['status'](_0x4e543b);return _0x18909f[_0xf3b5('0x30')](_0xf3b5('0x31'),_0x14e0eb+'-'+_0x467d02+'/'+_0x5eaa39)[_0xf3b5('0x2e')](_0x10d1ad);}return null;};}function patchUpdates(_0x37b3bd){return function(_0x88dc97){try{jsonpatch['apply'](_0x88dc97,_0x37b3bd,!![]);}catch(_0xd2e60b){return BPromise[_0xf3b5('0x32')](_0xd2e60b);}return _0x88dc97[_0xf3b5('0x33')]();};}function saveUpdates(_0x1171f6,_0x16943e){return function(_0x345267){if(_0x345267){return _0x345267['update'](_0x1171f6)[_0xf3b5('0x34')](function(_0x520fff){return _0x520fff;});}return null;};}function removeEntity(_0x23eff1,_0x31c8ee){return function(_0x1fe46b){if(_0x1fe46b){return _0x1fe46b[_0xf3b5('0x35')]()[_0xf3b5('0x34')](function(){_0x23eff1['status'](0xcc)[_0xf3b5('0x36')]();});}};}function handleEntityNotFound(_0x1e76e9,_0x4611cc){return function(_0x344799){if(!_0x344799){_0x1e76e9[_0xf3b5('0x2c')](0x194);}return _0x344799;};}function handleError(_0x169014,_0x4b5269){_0x4b5269=_0x4b5269||0x1f4;return function(_0x3271a4){logger[_0xf3b5('0x25')](_0x3271a4[_0xf3b5('0x37')]);if(_0x3271a4[_0xf3b5('0x38')]){delete _0x3271a4['name'];}_0x169014[_0xf3b5('0x2d')](_0x4b5269)[_0xf3b5('0x39')](_0x3271a4);};}exports[_0xf3b5('0x3a')]=function(_0x3bf979,_0x103912){var _0x2bac05={},_0x47eb09={},_0x81ec96={'count':0x0,'rows':[]};var _0x1e4db6=_[_0xf3b5('0x3b')](db[_0xf3b5('0x3c')][_0xf3b5('0x3d')],function(_0xf86abd){return{'name':_0xf86abd['fieldName'],'type':_0xf86abd[_0xf3b5('0x3e')][_0xf3b5('0x3f')]};});_0x47eb09[_0xf3b5('0x40')]=_['map'](_0x1e4db6,'name');_0x47eb09[_0xf3b5('0x41')]=_[_0xf3b5('0x42')](_0x3bf979['query']);_0x47eb09['filters']=_[_0xf3b5('0x43')](_0x47eb09[_0xf3b5('0x40')],_0x47eb09[_0xf3b5('0x41')]);_0x2bac05[_0xf3b5('0x44')]=_['intersection'](_0x47eb09[_0xf3b5('0x40')],qs[_0xf3b5('0x45')](_0x3bf979['query'][_0xf3b5('0x45')]));_0x2bac05[_0xf3b5('0x44')]=_0x2bac05[_0xf3b5('0x44')][_0xf3b5('0x46')]?_0x2bac05[_0xf3b5('0x44')]:_0x47eb09[_0xf3b5('0x40')];if(!_0x3bf979[_0xf3b5('0x41')][_0xf3b5('0x47')]('nolimit')){_0x2bac05[_0xf3b5('0x48')]=qs[_0xf3b5('0x48')](_0x3bf979[_0xf3b5('0x41')][_0xf3b5('0x48')]);_0x2bac05[_0xf3b5('0x2f')]=qs[_0xf3b5('0x2f')](_0x3bf979[_0xf3b5('0x41')]['offset']);}_0x2bac05[_0xf3b5('0x49')]=qs[_0xf3b5('0x4a')](_0x3bf979[_0xf3b5('0x41')]['sort']);_0x2bac05[_0xf3b5('0x4b')]=qs[_0xf3b5('0x4c')](_[_0xf3b5('0x4d')](_0x3bf979[_0xf3b5('0x41')],_0x47eb09[_0xf3b5('0x4c')]));if(_0x3bf979[_0xf3b5('0x41')][_0xf3b5('0x4e')]){_0x2bac05[_0xf3b5('0x4b')]=_[_0xf3b5('0x4f')](_0x2bac05[_0xf3b5('0x4b')],{'$or':_[_0xf3b5('0x3b')](_0x1e4db6,function(_0x4f78d3){if(_0x4f78d3[_0xf3b5('0x3e')]!==_0xf3b5('0x50')){var _0x18ddbe={};_0x18ddbe[_0x4f78d3[_0xf3b5('0x38')]]={'$like':'%'+_0x3bf979[_0xf3b5('0x41')][_0xf3b5('0x4e')]+'%'};return _0x18ddbe;}})});}_0x2bac05=_[_0xf3b5('0x4f')]({},_0x2bac05,_0x3bf979[_0xf3b5('0x51')]);var _0x31b809={'where':_0x2bac05[_0xf3b5('0x4b')]};return db[_0xf3b5('0x3c')][_0xf3b5('0x52')](_0x31b809)['then'](function(_0x184d9c){_0x81ec96[_0xf3b5('0x52')]=_0x184d9c;if(_0x3bf979['query'][_0xf3b5('0x53')]){_0x2bac05[_0xf3b5('0x54')]=[{'all':!![]}];}return db['ZohoAccount'][_0xf3b5('0x55')](_0x2bac05);})[_0xf3b5('0x34')](function(_0x1d4e22){_0x81ec96[_0xf3b5('0x56')]=_0x1d4e22;return _0x81ec96;})['then'](respondWithFilteredResult(_0x103912,_0x2bac05))['catch'](handleError(_0x103912,null));};exports[_0xf3b5('0x57')]=function(_0x1159a4,_0x596fff){var _0x316696={'raw':![],'where':{'id':_0x1159a4[_0xf3b5('0x58')]['id']}},_0x28663e={};_0x28663e[_0xf3b5('0x40')]=_[_0xf3b5('0x42')](db[_0xf3b5('0x3c')][_0xf3b5('0x3d')]);_0x28663e['query']=_[_0xf3b5('0x42')](_0x1159a4['query']);_0x28663e[_0xf3b5('0x4c')]=_['intersection'](_0x28663e[_0xf3b5('0x40')],_0x28663e[_0xf3b5('0x41')]);_0x316696[_0xf3b5('0x44')]=_['intersection'](_0x28663e[_0xf3b5('0x40')],qs[_0xf3b5('0x45')](_0x1159a4[_0xf3b5('0x41')][_0xf3b5('0x45')]));_0x316696['attributes']=_0x316696[_0xf3b5('0x44')][_0xf3b5('0x46')]?_0x316696[_0xf3b5('0x44')]:_0x28663e[_0xf3b5('0x40')];if(_0x1159a4[_0xf3b5('0x41')][_0xf3b5('0x53')]){_0x316696[_0xf3b5('0x54')]=[{'all':!![]}];}_0x316696=_[_0xf3b5('0x4f')]({},_0x316696,_0x1159a4['options']);return db[_0xf3b5('0x3c')][_0xf3b5('0x59')](_0x316696)[_0xf3b5('0x34')](handleEntityNotFound(_0x596fff,null))[_0xf3b5('0x34')](respondWithResult(_0x596fff,null))[_0xf3b5('0x2b')](handleError(_0x596fff,null));};exports[_0xf3b5('0x5a')]=function(_0x59c8e3,_0x44b9cd){return db[_0xf3b5('0x3c')][_0xf3b5('0x5a')](_0x59c8e3[_0xf3b5('0x5b')],{})['then'](respondWithResult(_0x44b9cd,0xc9))[_0xf3b5('0x2b')](handleError(_0x44b9cd,null));};exports[_0xf3b5('0x5c')]=function(_0x18a3be,_0x383327){if(_0x18a3be[_0xf3b5('0x5b')]['id']){delete _0x18a3be[_0xf3b5('0x5b')]['id'];}return db[_0xf3b5('0x3c')][_0xf3b5('0x59')]({'where':{'id':_0x18a3be[_0xf3b5('0x58')]['id']}})[_0xf3b5('0x34')](handleEntityNotFound(_0x383327,null))[_0xf3b5('0x34')](saveUpdates(_0x18a3be[_0xf3b5('0x5b')],null))['then'](respondWithResult(_0x383327,null))[_0xf3b5('0x2b')](handleError(_0x383327,null));};exports[_0xf3b5('0x35')]=function(_0x3ec11c,_0x502772){return db[_0xf3b5('0x3c')][_0xf3b5('0x59')]({'where':{'id':_0x3ec11c[_0xf3b5('0x58')]['id']}})[_0xf3b5('0x34')](handleEntityNotFound(_0x502772,null))['then'](removeEntity(_0x502772,null))[_0xf3b5('0x2b')](handleError(_0x502772,null));};exports[_0xf3b5('0x5d')]=function(_0x22ed22,_0x3ebe86,_0x49f13f){var _0x5a402e={};var _0x3c2b6b={};var _0x50e9f3;var _0x396c0d;return db[_0xf3b5('0x3c')][_0xf3b5('0x5e')]({'where':{'id':_0x22ed22[_0xf3b5('0x58')]['id']}})[_0xf3b5('0x34')](handleEntityNotFound(_0x3ebe86,null))['then'](function(_0x536f23){if(_0x536f23){_0x50e9f3=_0x536f23;_0x3c2b6b[_0xf3b5('0x40')]=_[_0xf3b5('0x42')](db[_0xf3b5('0x5f')][_0xf3b5('0x3d')]);_0x3c2b6b[_0xf3b5('0x41')]=_[_0xf3b5('0x42')](_0x22ed22[_0xf3b5('0x41')]);_0x3c2b6b[_0xf3b5('0x4c')]=_[_0xf3b5('0x43')](_0x3c2b6b[_0xf3b5('0x40')],_0x3c2b6b[_0xf3b5('0x41')]);_0x5a402e[_0xf3b5('0x44')]=_[_0xf3b5('0x43')](_0x3c2b6b['model'],qs['fields'](_0x22ed22[_0xf3b5('0x41')][_0xf3b5('0x45')]));_0x5a402e['attributes']=_0x5a402e[_0xf3b5('0x44')][_0xf3b5('0x46')]?_0x5a402e[_0xf3b5('0x44')]:_0x3c2b6b[_0xf3b5('0x40')];_0x5a402e['order']=qs[_0xf3b5('0x4a')](_0x22ed22[_0xf3b5('0x41')][_0xf3b5('0x4a')]);_0x5a402e[_0xf3b5('0x4b')]=qs[_0xf3b5('0x4c')](_[_0xf3b5('0x4d')](_0x22ed22[_0xf3b5('0x41')],_0x3c2b6b[_0xf3b5('0x4c')]));if(_0x22ed22['query']['filter']){_0x5a402e[_0xf3b5('0x4b')]=_['merge'](_0x5a402e['where'],{'$or':_[_0xf3b5('0x3b')](_0x5a402e['attributes'],function(_0x25cb47){var _0x5a9eac={};_0x5a9eac[_0x25cb47]={'$like':'%'+_0x22ed22['query'][_0xf3b5('0x4e')]+'%'};return _0x5a9eac;})});}_0x5a402e=_[_0xf3b5('0x4f')]({},_0x5a402e,_0x22ed22[_0xf3b5('0x51')]);return _0x50e9f3[_0xf3b5('0x5d')](_0x5a402e);}})[_0xf3b5('0x34')](function(_0x41d864){if(_0x41d864){_0x396c0d=_0x41d864['length'];if(!_0x22ed22[_0xf3b5('0x41')][_0xf3b5('0x47')](_0xf3b5('0x60'))){_0x5a402e[_0xf3b5('0x48')]=qs[_0xf3b5('0x48')](_0x22ed22[_0xf3b5('0x41')]['limit']);_0x5a402e[_0xf3b5('0x2f')]=qs[_0xf3b5('0x2f')](_0x22ed22[_0xf3b5('0x41')][_0xf3b5('0x2f')]);}return _0x50e9f3[_0xf3b5('0x5d')](_0x5a402e);}})[_0xf3b5('0x34')](function(_0x3ed665){if(_0x3ed665){return _0x3ed665?{'count':_0x396c0d,'rows':_0x3ed665}:null;}})[_0xf3b5('0x34')](respondWithResult(_0x3ebe86,null))[_0xf3b5('0x2b')](handleError(_0x3ebe86,null));};exports['addConfiguration']=function(_0xc2ece4,_0x15f15a,_0x161be7){if(_0xc2ece4[_0xf3b5('0x5b')]['id']){delete _0xc2ece4['body']['id'];}return db[_0xf3b5('0x3c')][_0xf3b5('0x5e')]({'where':{'id':_0xc2ece4[_0xf3b5('0x58')]['id']}})['then'](handleEntityNotFound(_0x15f15a,null))[_0xf3b5('0x34')](function(_0x1ed232){if(_0x1ed232){_0xc2ece4[_0xf3b5('0x5b')][_0xf3b5('0x61')]=_0x1ed232['id'];_0xc2ece4[_0xf3b5('0x5b')]['Subjects']=integrations[_0xf3b5('0x62')](_0xc2ece4[_0xf3b5('0x5b')][_0xf3b5('0x63')],_0xc2ece4['body'][_0xf3b5('0x3e')]);_0xc2ece4['body'][_0xf3b5('0x64')]=integrations[_0xf3b5('0x65')](_0xc2ece4[_0xf3b5('0x5b')]['channel'],_0xc2ece4[_0xf3b5('0x5b')][_0xf3b5('0x3e')]);return db['ZohoConfiguration'][_0xf3b5('0x5a')](_0xc2ece4[_0xf3b5('0x5b')],{'include':[{'model':db[_0xf3b5('0x66')],'as':_0xf3b5('0x67')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0xf3b5('0x34')](respondWithResult(_0x15f15a,null))['catch'](handleError(_0x15f15a,null));};function getAccessToken(_0xdf2586){return new Promise(function(_0x9e8ea4,_0xe3a2b2){var _0x4bc7cb;switch(_0xdf2586['zone']){case'US':_0x4bc7cb=_0xf3b5('0x68');break;case'AU':_0x4bc7cb=_0xf3b5('0x69');break;case'EU':_0x4bc7cb='https://accounts.zoho.eu';break;case'IN':_0x4bc7cb='https://accounts.zoho.in';break;case'CN':_0x4bc7cb=_0xf3b5('0x6a');break;default:_0x4bc7cb=_0xf3b5('0x6b');break;}var _0x1fa919={'method':_0xf3b5('0x6c'),'uri':_0x4bc7cb+_0xf3b5('0x6d'),'qs':{'refresh_token':_0xdf2586['refreshToken'],'client_id':_0xdf2586[_0xf3b5('0x6e')],'client_secret':_0xdf2586['clientSecret'],'grant_type':_0xf3b5('0x6f')},'json':!![]};return rp(_0x1fa919)['then'](function(_0x291b36){if(_0x291b36[_0xf3b5('0x70')]){_0x9e8ea4(_0x291b36[_0xf3b5('0x70')]);}else{_0xe3a2b2('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xf3b5('0x2b')](function(_0x4d373c){_0xe3a2b2(_0x4d373c);});});}exports['getFields']=function(_0x11e6f5,_0x4905dc,_0x3f6165){var _0x32d5d0,_0x323553,_0xe5da5e,_0x19ac4d,_0x48da48;return db['ZohoAccount']['findOne']({'where':{'id':_0x11e6f5['params']['id']},'attributes':['id','host','zone','clientId','clientSecret','serverUrl',_0xf3b5('0x26'),'refreshToken']})[_0xf3b5('0x34')](handleEntityNotFound(_0x4905dc,null))['then'](function(_0x68f5eb){_0x48da48=_0x68f5eb;_0x32d5d0=_0x48da48['host'];_0x323553=_0x32d5d0===_0xf3b5('0x71')?'eu':'com';_0xe5da5e=_0x48da48[_0xf3b5('0x72')];var _0x5d99e1=_0xe5da5e[_0xf3b5('0x73')](-0x1);if(_0x5d99e1==='/'||_0x5d99e1==='\x5c'||_0x5d99e1===':'){_0xe5da5e=_0xe5da5e[_0xf3b5('0x74')](0x0,_0xe5da5e[_0xf3b5('0x75')](_0x5d99e1));}if(!_0x48da48['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x48da48);})[_0xf3b5('0x34')](function(_0x54adac){if(_0x54adac){return rp({'method':_0xf3b5('0x76'),'uri':util[_0xf3b5('0x77')](_0xf3b5('0x78'),_0x323553),'qs':{'module':_0xf3b5('0x79')},'headers':{'Authorization':_0xf3b5('0x7a')+_0x54adac},'json':!![]});}})[_0xf3b5('0x34')](function(_0x59477a){if(_0x59477a){if(_0x59477a[_0xf3b5('0x7b')]&&_0x59477a[_0xf3b5('0x7b')][_0xf3b5('0x25')]){throw new Error(_0x59477a['response'][_0xf3b5('0x25')][_0xf3b5('0x28')]);}var _0x4c55ec=[];var _0x17ee0e=[];var _0x7d8480=[_0xf3b5('0x7c'),_0xf3b5('0x7d'),_0xf3b5('0x7e'),'WhoId',_0xf3b5('0x7f'),_0xf3b5('0x80'),'Call_Start_Time',_0xf3b5('0x81')];_0x17ee0e=_[_0xf3b5('0x82')](_0x59477a[_0xf3b5('0x45')],function(_0x4fcacf){return _0x7d8480['includes'](_0x4fcacf['api_name']);});for(var _0x522a4a=0x0;_0x522a4a<_0x17ee0e[_0xf3b5('0x46')];_0x522a4a++){if(_0x17ee0e[_0x522a4a][_0xf3b5('0x83')]===![]){_0x4c55ec[_0xf3b5('0x84')]({'id':_0x17ee0e[_0x522a4a]['id'],'name':_0x17ee0e[_0x522a4a][_0xf3b5('0x85')],'custom':_0x17ee0e[_0x522a4a][_0xf3b5('0x86')],'options':_0x17ee0e[_0x522a4a]['data_type']==='picklist'&&_0x17ee0e[_0x522a4a]['pick_list_values'][_0xf3b5('0x46')]>-0x1?_[_0xf3b5('0x3b')](_0x17ee0e[_0x522a4a][_0xf3b5('0x87')],function(_0xa26a8){return{'name':_0xa26a8,'value':_0xa26a8};}):[]});}}return{'count':_0x4c55ec[_0xf3b5('0x46')],'rows':_0x4c55ec};}else{return{'count':0x0,'rows':[]};}})[_0xf3b5('0x34')](respondWithResult(_0x4905dc,null))[_0xf3b5('0x2b')](function(_0x5de49a){var _0x3724d1=_0x11e6f5[_0xf3b5('0x41')][_0xf3b5('0x1d')]?0x1f4:_0x5de49a[_0xf3b5('0x88')]||0x1f4;logger['error'](_0xf3b5('0x89'),'getFields',_0x3724d1,JSON[_0xf3b5('0x24')](_0x5de49a));delete _0x5de49a[_0xf3b5('0x38')];if(_0x3724d1===0x191){_0x3724d1=0x190;}_0x4905dc[_0xf3b5('0x2d')](_0x3724d1)[_0xf3b5('0x39')](_0x11e6f5[_0xf3b5('0x41')][_0xf3b5('0x1d')]?{'message':_0xf3b5('0x8a'),'statusCode':_0x5de49a[_0xf3b5('0x88')]}:_0x5de49a);});}; \ No newline at end of file +var _0x5eb6=['includes','api_name','system_mandatory','push','display_label','custom_field','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','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','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','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','save','update','destroy','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','findAll','rows','params','includeAll','include','find','create','body','getConfigurations','findOne','ZohoConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','host','serverUrl','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x5eb6,0x9a));var _0x65eb=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5eb6[_0x19950b];return _0x3c6b41;};'use strict';var pdf=require(_0x65eb('0x0'));var emlformat=require(_0x65eb('0x1'));var rimraf=require(_0x65eb('0x2'));var zipdir=require(_0x65eb('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x65eb('0x4'));var moment=require('moment');var BPromise=require(_0x65eb('0x5'));var Mustache=require('mustache');var util=require(_0x65eb('0x6'));var path=require(_0x65eb('0x7'));var sox=require(_0x65eb('0x8'));var csv=require(_0x65eb('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x65eb('0xa'));var squel=require(_0x65eb('0xb'));var crypto=require(_0x65eb('0xc'));var jsforce=require(_0x65eb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x65eb('0xe'));var Redis=require(_0x65eb('0xf'));var authService=require(_0x65eb('0x10'));var qs=require(_0x65eb('0x11'));var as=require(_0x65eb('0x12'));var hardwareService=require(_0x65eb('0x13'));var logger=require(_0x65eb('0x14'))(_0x65eb('0x15'));var utils=require(_0x65eb('0x16'));var config=require(_0x65eb('0x17'));var db=require(_0x65eb('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x65eb('0x19'));var client=jayson[_0x65eb('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x4aaf49,_0x3e1262,_0x54dffe){if(_0x54dffe){var _0x5f1469=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5f1469[_0x65eb('0x1b')](_0x3e1262)){return _0x4aaf49;}else{throw new db[(_0x65eb('0x1c'))]['ValidationError'](_0x65eb('0x1d'));}}else{return _0x4aaf49;}}function respondWithRpcPromise(_0x2a48f3,_0x2bd83d,_0x5f467d,_0x2bd1b6){return new BPromise(function(_0x549f1f,_0x255f9b){var _0x5cc6d6=_0x2bd1b6||client;return _0x5cc6d6[_0x65eb('0x1e')](_0x2a48f3,_0x5f467d)[_0x65eb('0x1f')](function(_0x59ced){logger[_0x65eb('0x20')](_0x65eb('0x21'),_0x2bd83d,'request\x20sent');logger[_0x65eb('0x22')](_0x65eb('0x23'),_0x2bd83d,'request\x20sent',JSON[_0x65eb('0x24')](_0x59ced));if(_0x59ced[_0x65eb('0x25')]){if(_0x59ced[_0x65eb('0x25')][_0x65eb('0x26')]===0x1f4){logger[_0x65eb('0x25')](_0x65eb('0x21'),_0x2bd83d,_0x59ced[_0x65eb('0x25')][_0x65eb('0x27')]);return _0x255f9b(_0x59ced[_0x65eb('0x25')]['message']);}logger['error'](_0x65eb('0x21'),_0x2bd83d,_0x59ced['error'][_0x65eb('0x27')]);return _0x549f1f(_0x59ced[_0x65eb('0x25')][_0x65eb('0x27')]);}else{logger[_0x65eb('0x20')]('ZohoAccount,\x20%s,\x20%s',_0x2bd83d,_0x65eb('0x28'));_0x549f1f(_0x59ced[_0x65eb('0x29')][_0x65eb('0x27')]);}})[_0x65eb('0x2a')](function(_0x384216){logger[_0x65eb('0x25')](_0x65eb('0x21'),_0x2bd83d,_0x384216);_0x255f9b(_0x384216);});});}function respondWithStatusCode(_0x3e8bb2,_0x4d2917){_0x4d2917=_0x4d2917||0xcc;return function(_0x2b56a1){if(_0x2b56a1){return _0x3e8bb2[_0x65eb('0x2b')](_0x4d2917);}return _0x3e8bb2[_0x65eb('0x2c')](_0x4d2917)[_0x65eb('0x2d')]();};}function respondWithResult(_0x4281cf,_0x25f36d){_0x25f36d=_0x25f36d||0xc8;return function(_0x50faff){if(_0x50faff){return _0x4281cf['status'](_0x25f36d)[_0x65eb('0x2e')](_0x50faff);}};}function respondWithFilteredResult(_0x536a61,_0x158ea){return function(_0x106b2d){if(_0x106b2d){var _0x5bba28=_0x106b2d[_0x65eb('0x2f')],_0x440e88=_0x158ea[_0x65eb('0x30')],_0x314328=_0x158ea[_0x65eb('0x30')]+_0x158ea[_0x65eb('0x31')],_0x7bd506;if(_0x314328>=_0x5bba28){_0x314328=_0x5bba28;_0x7bd506=0xc8;}else{_0x7bd506=0xce;}_0x536a61['status'](_0x7bd506);return _0x536a61['set'](_0x65eb('0x32'),_0x440e88+'-'+_0x314328+'/'+_0x5bba28)[_0x65eb('0x2e')](_0x106b2d);}return null;};}function patchUpdates(_0x194f1f){return function(_0xc07120){try{jsonpatch['apply'](_0xc07120,_0x194f1f,!![]);}catch(_0x213b26){return BPromise['reject'](_0x213b26);}return _0xc07120[_0x65eb('0x33')]();};}function saveUpdates(_0x19fed8,_0x556efe){return function(_0x92b7c2){if(_0x92b7c2){return _0x92b7c2[_0x65eb('0x34')](_0x19fed8)['then'](function(_0x18174c){return _0x18174c;});}return null;};}function removeEntity(_0x356dd8,_0x188648){return function(_0x49d2f8){if(_0x49d2f8){return _0x49d2f8[_0x65eb('0x35')]()[_0x65eb('0x1f')](function(){_0x356dd8[_0x65eb('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5beacb,_0x203e29){return function(_0x3e0c79){if(!_0x3e0c79){_0x5beacb[_0x65eb('0x2b')](0x194);}return _0x3e0c79;};}function handleError(_0xc4fec5,_0x12fc9f){_0x12fc9f=_0x12fc9f||0x1f4;return function(_0x5d7b7a){logger['error'](_0x5d7b7a[_0x65eb('0x36')]);if(_0x5d7b7a[_0x65eb('0x37')]){delete _0x5d7b7a['name'];}_0xc4fec5['status'](_0x12fc9f)['send'](_0x5d7b7a);};}exports[_0x65eb('0x38')]=function(_0x3e23fd,_0xd94845){var _0x2cb3b1={},_0xe7eff7={},_0x32c3ff={'count':0x0,'rows':[]};var _0x3c3082=_[_0x65eb('0x39')](db[_0x65eb('0x3a')][_0x65eb('0x3b')],function(_0x2f4d6e){return{'name':_0x2f4d6e[_0x65eb('0x3c')],'type':_0x2f4d6e[_0x65eb('0x3d')][_0x65eb('0x3e')]};});_0xe7eff7['model']=_[_0x65eb('0x39')](_0x3c3082,'name');_0xe7eff7[_0x65eb('0x3f')]=_[_0x65eb('0x40')](_0x3e23fd[_0x65eb('0x3f')]);_0xe7eff7[_0x65eb('0x41')]=_[_0x65eb('0x42')](_0xe7eff7[_0x65eb('0x43')],_0xe7eff7[_0x65eb('0x3f')]);_0x2cb3b1[_0x65eb('0x44')]=_[_0x65eb('0x42')](_0xe7eff7['model'],qs[_0x65eb('0x45')](_0x3e23fd[_0x65eb('0x3f')][_0x65eb('0x45')]));_0x2cb3b1['attributes']=_0x2cb3b1[_0x65eb('0x44')][_0x65eb('0x46')]?_0x2cb3b1[_0x65eb('0x44')]:_0xe7eff7[_0x65eb('0x43')];if(!_0x3e23fd[_0x65eb('0x3f')][_0x65eb('0x47')](_0x65eb('0x48'))){_0x2cb3b1[_0x65eb('0x31')]=qs[_0x65eb('0x31')](_0x3e23fd[_0x65eb('0x3f')][_0x65eb('0x31')]);_0x2cb3b1['offset']=qs[_0x65eb('0x30')](_0x3e23fd[_0x65eb('0x3f')][_0x65eb('0x30')]);}_0x2cb3b1[_0x65eb('0x49')]=qs[_0x65eb('0x4a')](_0x3e23fd[_0x65eb('0x3f')][_0x65eb('0x4a')]);_0x2cb3b1[_0x65eb('0x4b')]=qs['filters'](_['pick'](_0x3e23fd[_0x65eb('0x3f')],_0xe7eff7[_0x65eb('0x41')]));if(_0x3e23fd['query'][_0x65eb('0x4c')]){_0x2cb3b1[_0x65eb('0x4b')]=_['merge'](_0x2cb3b1[_0x65eb('0x4b')],{'$or':_[_0x65eb('0x39')](_0x3c3082,function(_0x3918c0){if(_0x3918c0['type']!==_0x65eb('0x4d')){var _0x18d47e={};_0x18d47e[_0x3918c0[_0x65eb('0x37')]]={'$like':'%'+_0x3e23fd[_0x65eb('0x3f')][_0x65eb('0x4c')]+'%'};return _0x18d47e;}})});}_0x2cb3b1=_[_0x65eb('0x4e')]({},_0x2cb3b1,_0x3e23fd[_0x65eb('0x4f')]);var _0x1b2df8={'where':_0x2cb3b1[_0x65eb('0x4b')]};return db[_0x65eb('0x3a')]['count'](_0x1b2df8)['then'](function(_0x2b761b){_0x32c3ff['count']=_0x2b761b;if(_0x3e23fd[_0x65eb('0x3f')]['includeAll']){_0x2cb3b1['include']=[{'all':!![]}];}return db[_0x65eb('0x3a')][_0x65eb('0x50')](_0x2cb3b1);})[_0x65eb('0x1f')](function(_0x10d37b){_0x32c3ff[_0x65eb('0x51')]=_0x10d37b;return _0x32c3ff;})[_0x65eb('0x1f')](respondWithFilteredResult(_0xd94845,_0x2cb3b1))[_0x65eb('0x2a')](handleError(_0xd94845,null));};exports['show']=function(_0x1734ec,_0xfd17b3){var _0x435a66={'raw':![],'where':{'id':_0x1734ec[_0x65eb('0x52')]['id']}},_0x48378c={};_0x48378c['model']=_[_0x65eb('0x40')](db[_0x65eb('0x3a')][_0x65eb('0x3b')]);_0x48378c['query']=_[_0x65eb('0x40')](_0x1734ec[_0x65eb('0x3f')]);_0x48378c[_0x65eb('0x41')]=_[_0x65eb('0x42')](_0x48378c['model'],_0x48378c[_0x65eb('0x3f')]);_0x435a66[_0x65eb('0x44')]=_[_0x65eb('0x42')](_0x48378c[_0x65eb('0x43')],qs[_0x65eb('0x45')](_0x1734ec[_0x65eb('0x3f')][_0x65eb('0x45')]));_0x435a66[_0x65eb('0x44')]=_0x435a66[_0x65eb('0x44')][_0x65eb('0x46')]?_0x435a66[_0x65eb('0x44')]:_0x48378c['model'];if(_0x1734ec[_0x65eb('0x3f')][_0x65eb('0x53')]){_0x435a66[_0x65eb('0x54')]=[{'all':!![]}];}_0x435a66=_[_0x65eb('0x4e')]({},_0x435a66,_0x1734ec[_0x65eb('0x4f')]);return db[_0x65eb('0x3a')][_0x65eb('0x55')](_0x435a66)[_0x65eb('0x1f')](handleEntityNotFound(_0xfd17b3,null))[_0x65eb('0x1f')](respondWithResult(_0xfd17b3,null))['catch'](handleError(_0xfd17b3,null));};exports[_0x65eb('0x56')]=function(_0x2e72e1,_0x7a0626){return db[_0x65eb('0x3a')][_0x65eb('0x56')](_0x2e72e1[_0x65eb('0x57')],{})['then'](respondWithResult(_0x7a0626,0xc9))['catch'](handleError(_0x7a0626,null));};exports[_0x65eb('0x34')]=function(_0x1c67d7,_0x592e7e){if(_0x1c67d7[_0x65eb('0x57')]['id']){delete _0x1c67d7[_0x65eb('0x57')]['id'];}return db[_0x65eb('0x3a')][_0x65eb('0x55')]({'where':{'id':_0x1c67d7[_0x65eb('0x52')]['id']}})[_0x65eb('0x1f')](handleEntityNotFound(_0x592e7e,null))['then'](saveUpdates(_0x1c67d7[_0x65eb('0x57')],null))['then'](respondWithResult(_0x592e7e,null))[_0x65eb('0x2a')](handleError(_0x592e7e,null));};exports[_0x65eb('0x35')]=function(_0x46b57a,_0x45701e){return db[_0x65eb('0x3a')][_0x65eb('0x55')]({'where':{'id':_0x46b57a[_0x65eb('0x52')]['id']}})[_0x65eb('0x1f')](handleEntityNotFound(_0x45701e,null))[_0x65eb('0x1f')](removeEntity(_0x45701e,null))[_0x65eb('0x2a')](handleError(_0x45701e,null));};exports[_0x65eb('0x58')]=function(_0x2e4281,_0x3d1481,_0x27f1f4){var _0x16c770={};var _0x170e09={};var _0x23011b;var _0x3d7b73;return db[_0x65eb('0x3a')][_0x65eb('0x59')]({'where':{'id':_0x2e4281['params']['id']}})[_0x65eb('0x1f')](handleEntityNotFound(_0x3d1481,null))[_0x65eb('0x1f')](function(_0x1e6682){if(_0x1e6682){_0x23011b=_0x1e6682;_0x170e09[_0x65eb('0x43')]=_[_0x65eb('0x40')](db[_0x65eb('0x5a')]['rawAttributes']);_0x170e09[_0x65eb('0x3f')]=_[_0x65eb('0x40')](_0x2e4281[_0x65eb('0x3f')]);_0x170e09['filters']=_[_0x65eb('0x42')](_0x170e09[_0x65eb('0x43')],_0x170e09[_0x65eb('0x3f')]);_0x16c770[_0x65eb('0x44')]=_[_0x65eb('0x42')](_0x170e09[_0x65eb('0x43')],qs[_0x65eb('0x45')](_0x2e4281[_0x65eb('0x3f')][_0x65eb('0x45')]));_0x16c770[_0x65eb('0x44')]=_0x16c770[_0x65eb('0x44')][_0x65eb('0x46')]?_0x16c770[_0x65eb('0x44')]:_0x170e09['model'];_0x16c770[_0x65eb('0x49')]=qs[_0x65eb('0x4a')](_0x2e4281[_0x65eb('0x3f')][_0x65eb('0x4a')]);_0x16c770['where']=qs['filters'](_[_0x65eb('0x5b')](_0x2e4281[_0x65eb('0x3f')],_0x170e09[_0x65eb('0x41')]));if(_0x2e4281[_0x65eb('0x3f')]['filter']){_0x16c770[_0x65eb('0x4b')]=_[_0x65eb('0x4e')](_0x16c770[_0x65eb('0x4b')],{'$or':_[_0x65eb('0x39')](_0x16c770[_0x65eb('0x44')],function(_0x18fe8c){var _0x282163={};_0x282163[_0x18fe8c]={'$like':'%'+_0x2e4281[_0x65eb('0x3f')][_0x65eb('0x4c')]+'%'};return _0x282163;})});}_0x16c770=_[_0x65eb('0x4e')]({},_0x16c770,_0x2e4281['options']);return _0x23011b[_0x65eb('0x58')](_0x16c770);}})['then'](function(_0x27e7c4){if(_0x27e7c4){_0x3d7b73=_0x27e7c4[_0x65eb('0x46')];if(!_0x2e4281[_0x65eb('0x3f')][_0x65eb('0x47')](_0x65eb('0x48'))){_0x16c770[_0x65eb('0x31')]=qs[_0x65eb('0x31')](_0x2e4281[_0x65eb('0x3f')][_0x65eb('0x31')]);_0x16c770[_0x65eb('0x30')]=qs[_0x65eb('0x30')](_0x2e4281['query'][_0x65eb('0x30')]);}return _0x23011b[_0x65eb('0x58')](_0x16c770);}})[_0x65eb('0x1f')](function(_0x24d4f6){if(_0x24d4f6){return _0x24d4f6?{'count':_0x3d7b73,'rows':_0x24d4f6}:null;}})[_0x65eb('0x1f')](respondWithResult(_0x3d1481,null))['catch'](handleError(_0x3d1481,null));};exports[_0x65eb('0x5c')]=function(_0x471ee5,_0x4e083c,_0x1ca5dc){if(_0x471ee5[_0x65eb('0x57')]['id']){delete _0x471ee5[_0x65eb('0x57')]['id'];}return db[_0x65eb('0x3a')][_0x65eb('0x59')]({'where':{'id':_0x471ee5[_0x65eb('0x52')]['id']}})['then'](handleEntityNotFound(_0x4e083c,null))['then'](function(_0x3dee8e){if(_0x3dee8e){_0x471ee5['body'][_0x65eb('0x5d')]=_0x3dee8e['id'];_0x471ee5[_0x65eb('0x57')][_0x65eb('0x5e')]=integrations[_0x65eb('0x5f')](_0x471ee5[_0x65eb('0x57')]['channel'],_0x471ee5[_0x65eb('0x57')][_0x65eb('0x3d')]);_0x471ee5[_0x65eb('0x57')][_0x65eb('0x60')]=integrations[_0x65eb('0x61')](_0x471ee5[_0x65eb('0x57')]['channel'],_0x471ee5[_0x65eb('0x57')][_0x65eb('0x3d')]);return db[_0x65eb('0x5a')]['create'](_0x471ee5['body'],{'include':[{'model':db[_0x65eb('0x62')],'as':'Subjects'},{'model':db[_0x65eb('0x62')],'as':_0x65eb('0x60')}]});}return null;})['then'](respondWithResult(_0x4e083c,null))[_0x65eb('0x2a')](handleError(_0x4e083c,null));};function getAccessToken(_0x26b454){return new Promise(function(_0x3c7b41,_0x42e162){var _0x5f39b6;switch(_0x26b454[_0x65eb('0x63')]){case'US':_0x5f39b6=_0x65eb('0x64');break;case'AU':_0x5f39b6=_0x65eb('0x65');break;case'EU':_0x5f39b6=_0x65eb('0x66');break;case'IN':_0x5f39b6=_0x65eb('0x67');break;case'CN':_0x5f39b6=_0x65eb('0x68');break;default:_0x5f39b6=_0x65eb('0x66');break;}var _0x4726b6={'method':_0x65eb('0x69'),'uri':_0x5f39b6+_0x65eb('0x6a'),'qs':{'refresh_token':_0x26b454[_0x65eb('0x6b')],'client_id':_0x26b454[_0x65eb('0x6c')],'client_secret':_0x26b454[_0x65eb('0x6d')],'grant_type':_0x65eb('0x6e')},'json':!![]};return rp(_0x4726b6)['then'](function(_0x18d384){if(_0x18d384['access_token']){_0x3c7b41(_0x18d384[_0x65eb('0x6f')]);}else{_0x42e162('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0xbe4176){_0x42e162(_0xbe4176);});});}exports[_0x65eb('0x70')]=function(_0x32c527,_0x45b0ab,_0x14e2bb){var _0x54a3ec,_0x4bb28a,_0x1dfa0f,_0x44ddf7,_0x3bf4e7;return db[_0x65eb('0x3a')][_0x65eb('0x59')]({'where':{'id':_0x32c527[_0x65eb('0x52')]['id']},'attributes':['id',_0x65eb('0x71'),_0x65eb('0x63'),_0x65eb('0x6c'),_0x65eb('0x6d'),_0x65eb('0x72'),'code','refreshToken']})[_0x65eb('0x1f')](handleEntityNotFound(_0x45b0ab,null))[_0x65eb('0x1f')](function(_0x2aff3b){_0x3bf4e7=_0x2aff3b;_0x54a3ec=_0x3bf4e7['host'];_0x4bb28a=_0x54a3ec===_0x65eb('0x73')?'eu':_0x65eb('0x74');_0x1dfa0f=_0x3bf4e7[_0x65eb('0x72')];var _0x5df08d=_0x1dfa0f[_0x65eb('0x75')](-0x1);if(_0x5df08d==='/'||_0x5df08d==='\x5c'||_0x5df08d===':'){_0x1dfa0f=_0x1dfa0f[_0x65eb('0x76')](0x0,_0x1dfa0f[_0x65eb('0x77')](_0x5df08d));}if(!_0x3bf4e7[_0x65eb('0x6b')]){throw new Error(_0x65eb('0x78'));}return getAccessToken(_0x3bf4e7);})[_0x65eb('0x1f')](function(_0x5394d5){if(_0x5394d5){return rp({'method':_0x65eb('0x79'),'uri':util[_0x65eb('0x7a')](_0x65eb('0x7b'),_0x4bb28a),'qs':{'module':_0x65eb('0x7c')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5394d5},'json':!![]});}})[_0x65eb('0x1f')](function(_0x56a656){if(_0x56a656){if(_0x56a656[_0x65eb('0x7d')]&&_0x56a656['response'][_0x65eb('0x25')]){throw new Error(_0x56a656['response'][_0x65eb('0x25')][_0x65eb('0x27')]);}var _0x370e37=[];var _0x4acba0=[];var _0x283e57=[_0x65eb('0x7e'),_0x65eb('0x7f'),_0x65eb('0x80'),_0x65eb('0x81'),'Call_Duration',_0x65eb('0x82'),_0x65eb('0x83'),_0x65eb('0x84')];_0x4acba0=_[_0x65eb('0x85')](_0x56a656['fields'],function(_0x2a4e83){return _0x283e57[_0x65eb('0x86')](_0x2a4e83[_0x65eb('0x87')]);});for(var _0xac449e=0x0;_0xac449e<_0x4acba0[_0x65eb('0x46')];_0xac449e++){if(_0x4acba0[_0xac449e][_0x65eb('0x88')]===![]){_0x370e37[_0x65eb('0x89')]({'id':_0x4acba0[_0xac449e]['id'],'name':_0x4acba0[_0xac449e][_0x65eb('0x8a')],'custom':_0x4acba0[_0xac449e][_0x65eb('0x8b')],'options':_0x4acba0[_0xac449e]['data_type']==='picklist'&&_0x4acba0[_0xac449e][_0x65eb('0x8c')][_0x65eb('0x46')]>-0x1?_[_0x65eb('0x39')](_0x4acba0[_0xac449e][_0x65eb('0x8c')],function(_0xc46b5a){return{'name':_0xc46b5a,'value':_0xc46b5a};}):[]});}}return{'count':_0x370e37[_0x65eb('0x46')],'rows':_0x370e37};}else{return{'count':0x0,'rows':[]};}})[_0x65eb('0x1f')](respondWithResult(_0x45b0ab,null))['catch'](function(_0x1da5ff){var _0x3002b3=_0x32c527['query'][_0x65eb('0x1b')]?0x1f4:_0x1da5ff[_0x65eb('0x8d')]||0x1f4;logger[_0x65eb('0x25')](_0x65eb('0x8e'),_0x65eb('0x70'),_0x3002b3,JSON['stringify'](_0x1da5ff));delete _0x1da5ff[_0x65eb('0x37')];if(_0x3002b3===0x191){_0x3002b3=0x190;}_0x45b0ab[_0x65eb('0x2c')](_0x3002b3)['send'](_0x32c527['query'][_0x65eb('0x1b')]?{'message':_0x65eb('0x8f'),'statusCode':_0x1da5ff['statusCode']}:_0x1da5ff);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index e8e5437..35d13f6 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 _0xdac0=['slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','application/x-www-form-urlencoded','then','parse','refreshToken','info','format','name','inspect','catch','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','https://accounts.zoho.com.au','code','refresh_token','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','host'];(function(_0x18bc72,_0x1b2062){var _0x3db2c0=function(_0x2c6256){while(--_0x2c6256){_0x18bc72['push'](_0x18bc72['shift']());}};_0x3db2c0(++_0x1b2062);}(_0xdac0,0x11f));var _0x0dac=function(_0x5bffb8,_0x514c04){_0x5bffb8=_0x5bffb8-0x0;var _0x297522=_0xdac0[_0x5bffb8];return _0x297522;};'use strict';var _=require(_0x0dac('0x0'));var util=require(_0x0dac('0x1'));var logger=require(_0x0dac('0x2'))('api');var moment=require(_0x0dac('0x3'));var BPromise=require(_0x0dac('0x4'));var rp=require(_0x0dac('0x5'));var fs=require('fs');var path=require(_0x0dac('0x6'));var rimraf=require(_0x0dac('0x7'));var config=require(_0x0dac('0x8'));var attributes=require(_0x0dac('0x9'));var integrations=require(_0x0dac('0xa'));module[_0x0dac('0xb')]=function(_0x5a5115,_0xb8fc05){return _0x5a5115[_0x0dac('0xc')](_0x0dac('0xd'),attributes,{'tableName':_0x0dac('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x520f5c,_0x476288,_0x3f62f9){if(_0x520f5c[_0x0dac('0xf')](_0x0dac('0x10'))||_0x520f5c['changed'](_0x0dac('0x11'))||_0x520f5c['changed'](_0x0dac('0x12'))||_0x520f5c[_0x0dac('0xf')](_0x0dac('0x13'))||_0x520f5c[_0x0dac('0xf')]('code')||_0x520f5c[_0x0dac('0xf')](_0x0dac('0x14'))){var _0x57574d,_0x206173;_0x57574d=_0x520f5c[_0x0dac('0x11')];var _0x575b94=_0x57574d[_0x0dac('0x15')](-0x1);if(_0x575b94==='/'||_0x575b94==='\x5c'||_0x575b94===':'){_0x57574d=_0x57574d[_0x0dac('0x16')](0x0,_0x57574d[_0x0dac('0x17')](_0x575b94));}switch(_0x520f5c[_0x0dac('0x10')]){case'US':_0x206173=_0x0dac('0x18');break;case'AU':_0x206173='https://accounts.zoho.com.au';break;case'IN':_0x206173=_0x0dac('0x19');break;case'CN':_0x206173=_0x0dac('0x1a');break;default:_0x206173=_0x0dac('0x1b');break;}var _0x452c9b={'method':_0x0dac('0x1c'),'uri':_0x206173+'/oauth/v2/token','form':{'grant_type':_0x0dac('0x1d'),'client_id':_0x520f5c[_0x0dac('0x12')],'client_secret':_0x520f5c[_0x0dac('0x13')],'redirect_uri':_0x520f5c[_0x0dac('0x11')],'code':_0x520f5c['code']},'headers':{'Content-Type':_0x0dac('0x1e')}};return rp(_0x452c9b)[_0x0dac('0x1f')](function(_0x1b6cbf){var _0x592e4c=JSON[_0x0dac('0x20')](_0x1b6cbf);if(_0x592e4c['refresh_token']){_0x520f5c[_0x0dac('0x21')]=_0x592e4c['refresh_token'];logger[_0x0dac('0x22')](util[_0x0dac('0x23')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x520f5c[_0x0dac('0x24')],_0x520f5c['id']));}else{logger['error'](util[_0x0dac('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x520f5c[_0x0dac('0x24')],_0x520f5c['id']),util[_0x0dac('0x25')](_0x592e4c,{'showHidden':![],'depth':null}));}return _0x3f62f9(null,_0x476288);})[_0x0dac('0x26')](function(_0x597ef4){logger[_0x0dac('0x27')](util['format'](_0x0dac('0x28'),_0x520f5c['name'],_0x520f5c['id']),util[_0x0dac('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x3f62f9(_0x597ef4);});}else{return _0x3f62f9(null,_0x476288);}},'beforeUpdate':function(_0x11785,_0x383961,_0x231146){if(_0x11785[_0x0dac('0xf')](_0x0dac('0x10'))||_0x11785[_0x0dac('0xf')](_0x0dac('0x11'))||_0x11785[_0x0dac('0xf')](_0x0dac('0x12'))||_0x11785[_0x0dac('0xf')](_0x0dac('0x13'))||_0x11785[_0x0dac('0xf')]('code')||_0x11785[_0x0dac('0xf')](_0x0dac('0x14'))){var _0xcb862f,_0x38be33;_0xcb862f=_0x11785[_0x0dac('0x11')];var _0x4a78c5=_0xcb862f[_0x0dac('0x15')](-0x1);if(_0x4a78c5==='/'||_0x4a78c5==='\x5c'||_0x4a78c5===':'){_0xcb862f=_0xcb862f[_0x0dac('0x16')](0x0,_0xcb862f[_0x0dac('0x17')](_0x4a78c5));}switch(_0x11785[_0x0dac('0x10')]){case'US':_0x38be33='https://accounts.zoho.com';break;case'AU':_0x38be33=_0x0dac('0x29');break;case'IN':_0x38be33=_0x0dac('0x19');break;case'CN':_0x38be33=_0x0dac('0x1a');break;default:_0x38be33=_0x0dac('0x1b');break;}var _0x3e77e4={'method':'POST','uri':_0x38be33+'/oauth/v2/token','form':{'grant_type':_0x0dac('0x1d'),'client_id':_0x11785[_0x0dac('0x12')],'client_secret':_0x11785[_0x0dac('0x13')],'redirect_uri':_0x11785[_0x0dac('0x11')],'code':_0x11785[_0x0dac('0x2a')]},'headers':{'Content-Type':_0x0dac('0x1e')}};return rp(_0x3e77e4)[_0x0dac('0x1f')](function(_0x5004b5){var _0x2fb565=JSON[_0x0dac('0x20')](_0x5004b5);if(_0x2fb565[_0x0dac('0x2b')]){_0x11785[_0x0dac('0x21')]=_0x2fb565[_0x0dac('0x2b')];logger[_0x0dac('0x22')](util[_0x0dac('0x23')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x11785[_0x0dac('0x24')],_0x11785['id']));}else{logger[_0x0dac('0x27')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x11785['name'],_0x11785['id']),util[_0x0dac('0x25')](_0x2fb565,{'showHidden':![],'depth':null}));}return _0x231146(null,_0x383961);})[_0x0dac('0x26')](function(_0x341e1f){logger['error'](util[_0x0dac('0x23')](_0x0dac('0x28'),_0x11785[_0x0dac('0x24')],_0x11785['id']),util[_0x0dac('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x231146(_0x341e1f);});}else{return _0x231146(null,_0x383961);}}}});}; \ No newline at end of file +var _0x8869=['request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','clientSecret','code','host','serverUrl','slice','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','substring','lastIndexOf','https://accounts.zoho.com','util','../../config/logger','api','moment'];(function(_0x29cb90,_0xe956d8){var _0x41a5f3=function(_0x51716e){while(--_0x51716e){_0x29cb90['push'](_0x29cb90['shift']());}};_0x41a5f3(++_0xe956d8);}(_0x8869,0x130));var _0x9886=function(_0xd0ee00,_0xfa645e){_0xd0ee00=_0xd0ee00-0x0;var _0x248e28=_0x8869[_0xd0ee00];return _0x248e28;};'use strict';var _=require('lodash');var util=require(_0x9886('0x0'));var logger=require(_0x9886('0x1'))(_0x9886('0x2'));var moment=require(_0x9886('0x3'));var BPromise=require('bluebird');var rp=require(_0x9886('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9886('0x5'));var config=require(_0x9886('0x6'));var attributes=require(_0x9886('0x7'));var integrations=require(_0x9886('0x8'));module[_0x9886('0x9')]=function(_0x462f07,_0xf2d69){return _0x462f07[_0x9886('0xa')](_0x9886('0xb'),attributes,{'tableName':_0x9886('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x843a6b,_0xfcf53d,_0x36afd6){if(_0x843a6b[_0x9886('0xd')](_0x9886('0xe'))||_0x843a6b[_0x9886('0xd')]('serverUrl')||_0x843a6b[_0x9886('0xd')](_0x9886('0xf'))||_0x843a6b[_0x9886('0xd')](_0x9886('0x10'))||_0x843a6b[_0x9886('0xd')](_0x9886('0x11'))||_0x843a6b[_0x9886('0xd')](_0x9886('0x12'))){var _0x18a729,_0x467380;_0x18a729=_0x843a6b[_0x9886('0x13')];var _0xd4867d=_0x18a729[_0x9886('0x14')](-0x1);if(_0xd4867d==='/'||_0xd4867d==='\x5c'||_0xd4867d===':'){_0x18a729=_0x18a729['substring'](0x0,_0x18a729['lastIndexOf'](_0xd4867d));}switch(_0x843a6b['zone']){case'US':_0x467380='https://accounts.zoho.com';break;case'AU':_0x467380=_0x9886('0x15');break;case'IN':_0x467380=_0x9886('0x16');break;case'CN':_0x467380=_0x9886('0x17');break;default:_0x467380=_0x9886('0x18');break;}var _0x5f148b={'method':_0x9886('0x19'),'uri':_0x467380+_0x9886('0x1a'),'form':{'grant_type':_0x9886('0x1b'),'client_id':_0x843a6b[_0x9886('0xf')],'client_secret':_0x843a6b[_0x9886('0x10')],'redirect_uri':_0x843a6b[_0x9886('0x13')],'code':_0x843a6b[_0x9886('0x11')]},'headers':{'Content-Type':_0x9886('0x1c')}};return rp(_0x5f148b)[_0x9886('0x1d')](function(_0x2b2032){var _0x5530ef=JSON[_0x9886('0x1e')](_0x2b2032);if(_0x5530ef[_0x9886('0x1f')]){_0x843a6b[_0x9886('0x20')]=_0x5530ef[_0x9886('0x1f')];logger[_0x9886('0x21')](util[_0x9886('0x22')](_0x9886('0x23'),_0x843a6b[_0x9886('0x24')],_0x843a6b['id']));}else{logger[_0x9886('0x25')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x843a6b[_0x9886('0x24')],_0x843a6b['id']),util['inspect'](_0x5530ef,{'showHidden':![],'depth':null}));}return _0x36afd6(null,_0xfcf53d);})[_0x9886('0x26')](function(_0x5a0e27){logger[_0x9886('0x25')](util[_0x9886('0x22')](_0x9886('0x27'),_0x843a6b['name'],_0x843a6b['id']),util[_0x9886('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x36afd6(_0x5a0e27);});}else{return _0x36afd6(null,_0xfcf53d);}},'beforeUpdate':function(_0x424f53,_0x10d113,_0x4f0158){if(_0x424f53['changed']('zone')||_0x424f53[_0x9886('0xd')](_0x9886('0x13'))||_0x424f53[_0x9886('0xd')](_0x9886('0xf'))||_0x424f53[_0x9886('0xd')](_0x9886('0x10'))||_0x424f53[_0x9886('0xd')]('code')||_0x424f53['changed'](_0x9886('0x12'))){var _0x2d9375,_0x436b48;_0x2d9375=_0x424f53['serverUrl'];var _0x24e6f3=_0x2d9375[_0x9886('0x14')](-0x1);if(_0x24e6f3==='/'||_0x24e6f3==='\x5c'||_0x24e6f3===':'){_0x2d9375=_0x2d9375[_0x9886('0x29')](0x0,_0x2d9375[_0x9886('0x2a')](_0x24e6f3));}switch(_0x424f53[_0x9886('0xe')]){case'US':_0x436b48=_0x9886('0x2b');break;case'AU':_0x436b48=_0x9886('0x15');break;case'IN':_0x436b48=_0x9886('0x16');break;case'CN':_0x436b48=_0x9886('0x17');break;default:_0x436b48='https://accounts.zoho.eu';break;}var _0x486c17={'method':'POST','uri':_0x436b48+_0x9886('0x1a'),'form':{'grant_type':_0x9886('0x1b'),'client_id':_0x424f53[_0x9886('0xf')],'client_secret':_0x424f53['clientSecret'],'redirect_uri':_0x424f53[_0x9886('0x13')],'code':_0x424f53['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x486c17)[_0x9886('0x1d')](function(_0x3745f6){var _0xc78b2=JSON[_0x9886('0x1e')](_0x3745f6);if(_0xc78b2[_0x9886('0x1f')]){_0x424f53[_0x9886('0x20')]=_0xc78b2[_0x9886('0x1f')];logger['info'](util['format'](_0x9886('0x23'),_0x424f53[_0x9886('0x24')],_0x424f53['id']));}else{logger[_0x9886('0x25')](util[_0x9886('0x22')](_0x9886('0x27'),_0x424f53[_0x9886('0x24')],_0x424f53['id']),util[_0x9886('0x28')](_0xc78b2,{'showHidden':![],'depth':null}));}return _0x4f0158(null,_0x10d113);})[_0x9886('0x26')](function(_0x2fd096){logger[_0x9886('0x25')](util[_0x9886('0x22')](_0x9886('0x27'),_0x424f53['name'],_0x424f53['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x4f0158(_0x2fd096);});}else{return _0x4f0158(null,_0x10d113);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 6804734..dda7fb3 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 _0x42e2=['request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','model','map','debug','catch','ShowZohoAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','ZohoAccount,\x20%s,\x20%s'];(function(_0xc4af59,_0x51915e){var _0x504942=function(_0x31ff29){while(--_0x31ff29){_0xc4af59['push'](_0xc4af59['shift']());}};_0x504942(++_0x51915e);}(_0x42e2,0xee));var _0x242e=function(_0x511c08,_0x299bc4){_0x511c08=_0x511c08-0x0;var _0x1528ff=_0x42e2[_0x511c08];return _0x1528ff;};'use strict';var _=require(_0x242e('0x0'));var util=require(_0x242e('0x1'));var moment=require(_0x242e('0x2'));var BPromise=require(_0x242e('0x3'));var rs=require(_0x242e('0x4'));var fs=require('fs');var Redis=require(_0x242e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x242e('0x6'));var logger=require(_0x242e('0x7'))(_0x242e('0x8'));var config=require(_0x242e('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f43ab,_0x1135ed,_0x161f32){return new BPromise(function(_0xa4c586,_0x915ae2){return client[_0x242e('0xa')](_0x1f43ab,_0x161f32)[_0x242e('0xb')](function(_0x53f5be){logger[_0x242e('0xc')](_0x242e('0xd'),_0x1135ed,_0x242e('0xe'));logger['debug'](_0x242e('0xf'),_0x1135ed,'request\x20sent',JSON[_0x242e('0x10')](_0x53f5be));if(_0x53f5be['error']){if(_0x53f5be['error'][_0x242e('0x11')]===0x1f4){logger['error'](_0x242e('0xd'),_0x1135ed,_0x53f5be[_0x242e('0x12')][_0x242e('0x13')]);return _0x915ae2(_0x53f5be['error'][_0x242e('0x13')]);}logger[_0x242e('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x1135ed,_0x53f5be[_0x242e('0x12')][_0x242e('0x13')]);return _0xa4c586(_0x53f5be['error'][_0x242e('0x13')]);}else{logger['info'](_0x242e('0xd'),_0x1135ed,_0x242e('0xe'));_0xa4c586(_0x53f5be[_0x242e('0x14')][_0x242e('0x13')]);}})['catch'](function(_0x3a8e08){logger['error'](_0x242e('0xd'),_0x1135ed,_0x3a8e08);_0x915ae2(_0x3a8e08);});});}exports[_0x242e('0x15')]=function(_0x3b6aa7){var _0x58cc83=this;return new Promise(function(_0x21bae4,_0x366ab8){return db[_0x242e('0x16')][_0x242e('0x17')]({'raw':_0x3b6aa7[_0x242e('0x18')]?_0x3b6aa7[_0x242e('0x18')][_0x242e('0x19')]===undefined?!![]:![]:!![],'where':_0x3b6aa7[_0x242e('0x18')]?_0x3b6aa7[_0x242e('0x18')][_0x242e('0x1a')]||null:null,'attributes':_0x3b6aa7[_0x242e('0x18')]?_0x3b6aa7[_0x242e('0x18')][_0x242e('0x1b')]||null:null,'limit':_0x3b6aa7['options']?_0x3b6aa7[_0x242e('0x18')][_0x242e('0x1c')]||null:null,'include':_0x3b6aa7[_0x242e('0x18')]?_0x3b6aa7['options'][_0x242e('0x1d')]?_['map'](_0x3b6aa7[_0x242e('0x18')]['include'],function(_0x3578fa){return{'model':db[_0x3578fa['model']],'as':_0x3578fa['as'],'attributes':_0x3578fa[_0x242e('0x1b')],'include':_0x3578fa[_0x242e('0x1d')]?_['map'](_0x3578fa[_0x242e('0x1d')],function(_0x5e60d5){return{'model':db[_0x5e60d5[_0x242e('0x1e')]],'as':_0x5e60d5['as'],'attributes':_0x5e60d5['attributes'],'include':_0x5e60d5['include']?_[_0x242e('0x1f')](_0x5e60d5[_0x242e('0x1d')],function(_0x5c4cc4){return{'model':db[_0x5c4cc4[_0x242e('0x1e')]],'as':_0x5c4cc4['as'],'attributes':_0x5c4cc4[_0x242e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x242e('0xb')](function(_0x1b1417){logger[_0x242e('0xc')](_0x242e('0x15'),_0x3b6aa7);logger[_0x242e('0x20')]('GetZohoAccount',_0x3b6aa7,JSON[_0x242e('0x10')](_0x1b1417));_0x21bae4(_0x1b1417);})[_0x242e('0x21')](function(_0x271f7a){logger['error'](_0x242e('0x15'),_0x271f7a[_0x242e('0x13')],_0x3b6aa7);_0x366ab8(_0x58cc83[_0x242e('0x12')](0x1f4,_0x271f7a[_0x242e('0x13')]));});});};exports[_0x242e('0x22')]=function(_0x42388c){var _0x2ba1cd=this;return new Promise(function(_0x423f98,_0x1dba68){return db['ZohoAccount'][_0x242e('0x23')]({'raw':_0x42388c[_0x242e('0x18')]?_0x42388c[_0x242e('0x18')][_0x242e('0x19')]===undefined?!![]:![]:!![],'where':_0x42388c['options']?_0x42388c[_0x242e('0x18')]['where']||null:null,'attributes':_0x42388c['options']?_0x42388c[_0x242e('0x18')][_0x242e('0x1b')]||null:null,'include':_0x42388c['options']?_0x42388c[_0x242e('0x18')][_0x242e('0x1d')]?_[_0x242e('0x1f')](_0x42388c[_0x242e('0x18')][_0x242e('0x1d')],function(_0x2b0806){return{'model':db[_0x2b0806[_0x242e('0x1e')]],'as':_0x2b0806['as'],'attributes':_0x2b0806[_0x242e('0x1b')],'include':_0x2b0806['include']?_[_0x242e('0x1f')](_0x2b0806[_0x242e('0x1d')],function(_0x26c6e2){return{'model':db[_0x26c6e2[_0x242e('0x1e')]],'as':_0x26c6e2['as'],'attributes':_0x26c6e2[_0x242e('0x1b')],'include':_0x26c6e2['include']?_[_0x242e('0x1f')](_0x26c6e2[_0x242e('0x1d')],function(_0x399c6f){return{'model':db[_0x399c6f[_0x242e('0x1e')]],'as':_0x399c6f['as'],'attributes':_0x399c6f[_0x242e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x242e('0xb')](function(_0x1036cd){logger[_0x242e('0xc')]('ShowZohoAccount',_0x42388c);logger['debug']('ShowZohoAccount',_0x42388c,JSON['stringify'](_0x1036cd));_0x423f98(_0x1036cd);})['catch'](function(_0x70207){logger[_0x242e('0x12')](_0x242e('0x22'),_0x70207[_0x242e('0x13')],_0x42388c);_0x1dba68(_0x2ba1cd[_0x242e('0x12')](0x1f4,_0x70207[_0x242e('0x13')]));});});}; \ No newline at end of file +var _0xb616=['ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ZohoAccount','findAll','raw','options','where','limit','map','include','model','attributes','then','GetZohoAccount','stringify','ShowZohoAccount','find','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info'];(function(_0x538a41,_0x23cbfb){var _0x4e9724=function(_0x26db2d){while(--_0x26db2d){_0x538a41['push'](_0x538a41['shift']());}};_0x4e9724(++_0x23cbfb);}(_0xb616,0x84));var _0x6b61=function(_0x1f8693,_0x4e7625){_0x1f8693=_0x1f8693-0x0;var _0x1e9981=_0xb616[_0x1f8693];return _0x1e9981;};'use strict';var _=require(_0x6b61('0x0'));var util=require(_0x6b61('0x1'));var moment=require(_0x6b61('0x2'));var BPromise=require('bluebird');var rs=require(_0x6b61('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b61('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b61('0x5'))(_0x6b61('0x6'));var config=require(_0x6b61('0x7'));var jayson=require(_0x6b61('0x8'));var client=jayson[_0x6b61('0x9')][_0x6b61('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc63567,_0x3f74c2,_0x420b40){return new BPromise(function(_0x218ff0,_0x49806d){return client['request'](_0xc63567,_0x420b40)['then'](function(_0x1add82){logger[_0x6b61('0xb')](_0x6b61('0xc'),_0x3f74c2,_0x6b61('0xd'));logger[_0x6b61('0xe')](_0x6b61('0xf'),_0x3f74c2,_0x6b61('0xd'),JSON['stringify'](_0x1add82));if(_0x1add82[_0x6b61('0x10')]){if(_0x1add82[_0x6b61('0x10')][_0x6b61('0x11')]===0x1f4){logger['error'](_0x6b61('0xc'),_0x3f74c2,_0x1add82['error'][_0x6b61('0x12')]);return _0x49806d(_0x1add82[_0x6b61('0x10')][_0x6b61('0x12')]);}logger[_0x6b61('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x3f74c2,_0x1add82['error'][_0x6b61('0x12')]);return _0x218ff0(_0x1add82['error'][_0x6b61('0x12')]);}else{logger['info'](_0x6b61('0xc'),_0x3f74c2,_0x6b61('0xd'));_0x218ff0(_0x1add82[_0x6b61('0x13')][_0x6b61('0x12')]);}})[_0x6b61('0x14')](function(_0x436799){logger[_0x6b61('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x3f74c2,_0x436799);_0x49806d(_0x436799);});});}exports['GetZohoAccount']=function(_0x4fc2b2){var _0x415c87=this;return new Promise(function(_0x5024b0,_0x646715){return db[_0x6b61('0x15')][_0x6b61('0x16')]({'raw':_0x4fc2b2['options']?_0x4fc2b2['options'][_0x6b61('0x17')]===undefined?!![]:![]:!![],'where':_0x4fc2b2[_0x6b61('0x18')]?_0x4fc2b2['options'][_0x6b61('0x19')]||null:null,'attributes':_0x4fc2b2[_0x6b61('0x18')]?_0x4fc2b2[_0x6b61('0x18')]['attributes']||null:null,'limit':_0x4fc2b2[_0x6b61('0x18')]?_0x4fc2b2[_0x6b61('0x18')][_0x6b61('0x1a')]||null:null,'include':_0x4fc2b2['options']?_0x4fc2b2[_0x6b61('0x18')]['include']?_[_0x6b61('0x1b')](_0x4fc2b2[_0x6b61('0x18')][_0x6b61('0x1c')],function(_0x478975){return{'model':db[_0x478975[_0x6b61('0x1d')]],'as':_0x478975['as'],'attributes':_0x478975[_0x6b61('0x1e')],'include':_0x478975[_0x6b61('0x1c')]?_[_0x6b61('0x1b')](_0x478975[_0x6b61('0x1c')],function(_0x5f3d06){return{'model':db[_0x5f3d06[_0x6b61('0x1d')]],'as':_0x5f3d06['as'],'attributes':_0x5f3d06[_0x6b61('0x1e')],'include':_0x5f3d06[_0x6b61('0x1c')]?_[_0x6b61('0x1b')](_0x5f3d06[_0x6b61('0x1c')],function(_0x4273a3){return{'model':db[_0x4273a3[_0x6b61('0x1d')]],'as':_0x4273a3['as'],'attributes':_0x4273a3[_0x6b61('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6b61('0x1f')](function(_0x38bcea){logger[_0x6b61('0xb')](_0x6b61('0x20'),_0x4fc2b2);logger['debug'](_0x6b61('0x20'),_0x4fc2b2,JSON[_0x6b61('0x21')](_0x38bcea));_0x5024b0(_0x38bcea);})[_0x6b61('0x14')](function(_0x5ab1ea){logger[_0x6b61('0x10')](_0x6b61('0x20'),_0x5ab1ea[_0x6b61('0x12')],_0x4fc2b2);_0x646715(_0x415c87[_0x6b61('0x10')](0x1f4,_0x5ab1ea[_0x6b61('0x12')]));});});};exports[_0x6b61('0x22')]=function(_0x2f1b0f){var _0x24ed3a=this;return new Promise(function(_0x472f68,_0x21d397){return db[_0x6b61('0x15')][_0x6b61('0x23')]({'raw':_0x2f1b0f[_0x6b61('0x18')]?_0x2f1b0f[_0x6b61('0x18')][_0x6b61('0x17')]===undefined?!![]:![]:!![],'where':_0x2f1b0f[_0x6b61('0x18')]?_0x2f1b0f[_0x6b61('0x18')]['where']||null:null,'attributes':_0x2f1b0f[_0x6b61('0x18')]?_0x2f1b0f['options'][_0x6b61('0x1e')]||null:null,'include':_0x2f1b0f[_0x6b61('0x18')]?_0x2f1b0f[_0x6b61('0x18')][_0x6b61('0x1c')]?_['map'](_0x2f1b0f[_0x6b61('0x18')][_0x6b61('0x1c')],function(_0x3a8c78){return{'model':db[_0x3a8c78['model']],'as':_0x3a8c78['as'],'attributes':_0x3a8c78[_0x6b61('0x1e')],'include':_0x3a8c78[_0x6b61('0x1c')]?_[_0x6b61('0x1b')](_0x3a8c78[_0x6b61('0x1c')],function(_0xc1ad84){return{'model':db[_0xc1ad84['model']],'as':_0xc1ad84['as'],'attributes':_0xc1ad84[_0x6b61('0x1e')],'include':_0xc1ad84['include']?_[_0x6b61('0x1b')](_0xc1ad84['include'],function(_0x5ef943){return{'model':db[_0x5ef943[_0x6b61('0x1d')]],'as':_0x5ef943['as'],'attributes':_0x5ef943['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bf5f0){logger[_0x6b61('0xb')](_0x6b61('0x22'),_0x2f1b0f);logger[_0x6b61('0xe')](_0x6b61('0x22'),_0x2f1b0f,JSON['stringify'](_0x2bf5f0));_0x472f68(_0x2bf5f0);})[_0x6b61('0x14')](function(_0x3cc135){logger[_0x6b61('0x10')]('ShowZohoAccount',_0x3cc135[_0x6b61('0x12')],_0x2f1b0f);_0x21d397(_0x24ed3a[_0x6b61('0x10')](0x1f4,_0x3cc135[_0x6b61('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index c111f34..356652d 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 _0x5f6a=['getSubjects','getDescriptions','put','update','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects'];(function(_0x1de052,_0x3d64b3){var _0x3c1e09=function(_0x5422db){while(--_0x5422db){_0x1de052['push'](_0x1de052['shift']());}};_0x3c1e09(++_0x3d64b3);}(_0x5f6a,0xc4));var _0xa5f6=function(_0x4fd698,_0x4287fc){_0x4fd698=_0x4fd698-0x0;var _0x188513=_0x5f6a[_0x4fd698];return _0x188513;};'use strict';var multer=require(_0xa5f6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa5f6('0x1'));var express=require(_0xa5f6('0x2'));var router=express[_0xa5f6('0x3')]();var auth=require(_0xa5f6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa5f6('0x5'));var controller=require(_0xa5f6('0x6'));router[_0xa5f6('0x7')]('/',auth[_0xa5f6('0x8')](),controller[_0xa5f6('0x9')]);router[_0xa5f6('0x7')](_0xa5f6('0xa'),auth[_0xa5f6('0x8')](),controller[_0xa5f6('0xb')]);router[_0xa5f6('0x7')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xa5f6('0x7')](_0xa5f6('0xc'),auth[_0xa5f6('0x8')](),controller[_0xa5f6('0xd')]);router[_0xa5f6('0x7')]('/:id/descriptions',auth[_0xa5f6('0x8')](),controller[_0xa5f6('0xe')]);router['post']('/',auth[_0xa5f6('0x8')](),controller['create']);router[_0xa5f6('0xf')]('/:id',auth[_0xa5f6('0x8')](),controller[_0xa5f6('0x10')]);router['delete'](_0xa5f6('0xa'),auth[_0xa5f6('0x8')](),controller[_0xa5f6('0x11')]);module[_0xa5f6('0x12')]=router; \ No newline at end of file +var _0x93e7=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x36a9fb,_0x31f294){var _0x563139=function(_0x608fc5){while(--_0x608fc5){_0x36a9fb['push'](_0x36a9fb['shift']());}};_0x563139(++_0x31f294);}(_0x93e7,0x9e));var _0x793e=function(_0x5c1345,_0x40116e){_0x5c1345=_0x5c1345-0x0;var _0x1c070d=_0x93e7[_0x5c1345];return _0x1c070d;};'use strict';var multer=require(_0x793e('0x0'));var util=require('util');var path=require(_0x793e('0x1'));var timeout=require(_0x793e('0x2'));var express=require('express');var router=express[_0x793e('0x3')]();var auth=require(_0x793e('0x4'));var interaction=require(_0x793e('0x5'));var config=require(_0x793e('0x6'));var controller=require('./intZohoConfiguration.controller');router[_0x793e('0x7')]('/',auth['isAuthenticated'](),controller[_0x793e('0x8')]);router['get'](_0x793e('0x9'),auth['isAuthenticated'](),controller[_0x793e('0xa')]);router[_0x793e('0x7')](_0x793e('0xb'),auth[_0x793e('0xc')](),controller[_0x793e('0xd')]);router[_0x793e('0x7')](_0x793e('0xe'),auth[_0x793e('0xc')](),controller[_0x793e('0xf')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x793e('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x793e('0x11')]);router[_0x793e('0x12')]('/:id',auth[_0x793e('0xc')](),controller[_0x793e('0x13')]);router[_0x793e('0x14')](_0x793e('0x9'),auth[_0x793e('0xc')](),controller[_0x793e('0x15')]);module[_0x793e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 81b4b8a..090e51a 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 _0x7ecb=['contact_lead','sequelize','STRING','ENUM','lead'];(function(_0x1de9d4,_0x3940c4){var _0xe52a0b=function(_0x249f5e){while(--_0x249f5e){_0x1de9d4['push'](_0x1de9d4['shift']());}};_0xe52a0b(++_0x3940c4);}(_0x7ecb,0xce));var _0xb7ec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7ecb[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb7ec('0x0'));module['exports']={'name':{'type':Sequelize[_0xb7ec('0x1')]},'moduleCreate':{'type':Sequelize[_0xb7ec('0x2')](_0xb7ec('0x3'),'contact','nothing'),'defaultValue':_0xb7ec('0x3')},'moduleSearch':{'type':Sequelize[_0xb7ec('0x2')](_0xb7ec('0x4'),'contact','lead'),'defaultValue':_0xb7ec('0x4')},'description':{'type':Sequelize[_0xb7ec('0x1')]}}; \ No newline at end of file +var _0xe870=['contact','nothing','contact_lead','STRING','sequelize','exports','ENUM','lead'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xe870,0x174));var _0x0e87=function(_0x529a07,_0x27fd4d){_0x529a07=_0x529a07-0x0;var _0x2fb215=_0xe870[_0x529a07];return _0x2fb215;};'use strict';var Sequelize=require(_0x0e87('0x0'));module[_0x0e87('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x0e87('0x2')](_0x0e87('0x3'),_0x0e87('0x4'),_0x0e87('0x5')),'defaultValue':_0x0e87('0x3')},'moduleSearch':{'type':Sequelize[_0x0e87('0x2')](_0x0e87('0x6'),_0x0e87('0x4'),'lead'),'defaultValue':_0x0e87('0x6')},'description':{'type':Sequelize[_0x0e87('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index dd60b17..d1d24a7 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 _0x3e74=['keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','options','ZohoConfiguration','include','findAll','rawAttributes','length','create','body','find','destroy','getFields','findOne','params','ZohoField','getSubjects','getDescriptions','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','jayson/promise','client','http','test','Sequelize','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','send','map','fieldName','type','key','model','name','query'];(function(_0x105878,_0x7eb9c6){var _0x202398=function(_0x1d3e55){while(--_0x1d3e55){_0x105878['push'](_0x105878['shift']());}};_0x202398(++_0x7eb9c6);}(_0x3e74,0x175));var _0x43e7=function(_0x30bacd,_0x260f0d){_0x30bacd=_0x30bacd-0x0;var _0x4b2e00=_0x3e74[_0x30bacd];return _0x4b2e00;};'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'];var jayson=require(_0x43e7('0x14'));var client=jayson[_0x43e7('0x15')][_0x43e7('0x16')]({'port':0x232a});function checkPasswordPattern(_0x3bb83f,_0x4e008c,_0x583d85){if(_0x583d85){var _0x2fcb36=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2fcb36[_0x43e7('0x17')](_0x4e008c)){return _0x3bb83f;}else{throw new db[(_0x43e7('0x18'))]['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 _0x3bb83f;}}function respondWithRpcPromise(_0x16849c,_0x14c146,_0x203378,_0x328445){return new BPromise(function(_0x4de324,_0x5c4eaa){var _0xdf16c=_0x328445||client;return _0xdf16c[_0x43e7('0x19')](_0x16849c,_0x203378)[_0x43e7('0x1a')](function(_0x5d346f){logger['info'](_0x43e7('0x1b'),_0x14c146,_0x43e7('0x1c'));logger[_0x43e7('0x1d')](_0x43e7('0x1e'),_0x14c146,_0x43e7('0x1c'),JSON[_0x43e7('0x1f')](_0x5d346f));if(_0x5d346f[_0x43e7('0x20')]){if(_0x5d346f[_0x43e7('0x20')][_0x43e7('0x21')]===0x1f4){logger[_0x43e7('0x20')](_0x43e7('0x1b'),_0x14c146,_0x5d346f[_0x43e7('0x20')]['message']);return _0x5c4eaa(_0x5d346f[_0x43e7('0x20')][_0x43e7('0x22')]);}logger['error'](_0x43e7('0x1b'),_0x14c146,_0x5d346f[_0x43e7('0x20')][_0x43e7('0x22')]);return _0x4de324(_0x5d346f[_0x43e7('0x20')][_0x43e7('0x22')]);}else{logger[_0x43e7('0x23')]('ZohoConfiguration,\x20%s,\x20%s',_0x14c146,_0x43e7('0x1c'));_0x4de324(_0x5d346f['result']['message']);}})[_0x43e7('0x24')](function(_0x43f4ff){logger['error'](_0x43e7('0x1b'),_0x14c146,_0x43f4ff);_0x5c4eaa(_0x43f4ff);});});}function respondWithStatusCode(_0x4ca5cf,_0x326dab){_0x326dab=_0x326dab||0xcc;return function(_0x5c5e67){if(_0x5c5e67){return _0x4ca5cf[_0x43e7('0x25')](_0x326dab);}return _0x4ca5cf[_0x43e7('0x26')](_0x326dab)[_0x43e7('0x27')]();};}function respondWithResult(_0x405f85,_0x51f4d7){_0x51f4d7=_0x51f4d7||0xc8;return function(_0x52b7b3){if(_0x52b7b3){return _0x405f85[_0x43e7('0x26')](_0x51f4d7)['json'](_0x52b7b3);}};}function respondWithFilteredResult(_0x2dd5f,_0x40dc8f){return function(_0x3565cf){if(_0x3565cf){var _0xb1fc63=_0x3565cf[_0x43e7('0x28')],_0x5087d7=_0x40dc8f[_0x43e7('0x29')],_0x33a1a5=_0x40dc8f[_0x43e7('0x29')]+_0x40dc8f[_0x43e7('0x2a')],_0x4690a6;if(_0x33a1a5>=_0xb1fc63){_0x33a1a5=_0xb1fc63;_0x4690a6=0xc8;}else{_0x4690a6=0xce;}_0x2dd5f[_0x43e7('0x26')](_0x4690a6);return _0x2dd5f[_0x43e7('0x2b')](_0x43e7('0x2c'),_0x5087d7+'-'+_0x33a1a5+'/'+_0xb1fc63)[_0x43e7('0x2d')](_0x3565cf);}return null;};}function patchUpdates(_0x17df44){return function(_0x19725a){try{jsonpatch[_0x43e7('0x2e')](_0x19725a,_0x17df44,!![]);}catch(_0x208706){return BPromise['reject'](_0x208706);}return _0x19725a[_0x43e7('0x2f')]();};}function saveUpdates(_0x44f6b0,_0x3b8f78){return function(_0x183c81){if(_0x183c81){return _0x183c81[_0x43e7('0x30')](_0x44f6b0)['then'](function(_0x1eba65){return _0x1eba65;});}return null;};}function removeEntity(_0x49b83d,_0x30d47e){return function(_0x3f280d){if(_0x3f280d){return _0x3f280d['destroy']()['then'](function(){_0x49b83d['status'](0xcc)[_0x43e7('0x27')]();});}};}function handleEntityNotFound(_0xbe6e28,_0x117c07){return function(_0x234fe6){if(!_0x234fe6){_0xbe6e28[_0x43e7('0x25')](0x194);}return _0x234fe6;};}function handleError(_0xde7ed,_0x485c6c){_0x485c6c=_0x485c6c||0x1f4;return function(_0x47baee){logger['error'](_0x47baee['stack']);if(_0x47baee['name']){delete _0x47baee['name'];}_0xde7ed['status'](_0x485c6c)[_0x43e7('0x31')](_0x47baee);};}exports['index']=function(_0x2b4bfd,_0x8e9f40){var _0x31bc78={},_0x50a2d0={},_0x40f72f={'count':0x0,'rows':[]};var _0x449803=_[_0x43e7('0x32')](db['ZohoConfiguration']['rawAttributes'],function(_0x5d84f4){return{'name':_0x5d84f4[_0x43e7('0x33')],'type':_0x5d84f4[_0x43e7('0x34')][_0x43e7('0x35')]};});_0x50a2d0[_0x43e7('0x36')]=_[_0x43e7('0x32')](_0x449803,_0x43e7('0x37'));_0x50a2d0[_0x43e7('0x38')]=_[_0x43e7('0x39')](_0x2b4bfd['query']);_0x50a2d0[_0x43e7('0x3a')]=_[_0x43e7('0x3b')](_0x50a2d0['model'],_0x50a2d0[_0x43e7('0x38')]);_0x31bc78['attributes']=_[_0x43e7('0x3b')](_0x50a2d0[_0x43e7('0x36')],qs[_0x43e7('0x3c')](_0x2b4bfd[_0x43e7('0x38')][_0x43e7('0x3c')]));_0x31bc78[_0x43e7('0x3d')]=_0x31bc78['attributes']['length']?_0x31bc78[_0x43e7('0x3d')]:_0x50a2d0[_0x43e7('0x36')];if(!_0x2b4bfd[_0x43e7('0x38')][_0x43e7('0x3e')](_0x43e7('0x3f'))){_0x31bc78['limit']=qs[_0x43e7('0x2a')](_0x2b4bfd[_0x43e7('0x38')]['limit']);_0x31bc78[_0x43e7('0x29')]=qs['offset'](_0x2b4bfd[_0x43e7('0x38')]['offset']);}_0x31bc78[_0x43e7('0x40')]=qs[_0x43e7('0x41')](_0x2b4bfd[_0x43e7('0x38')][_0x43e7('0x41')]);_0x31bc78['where']=qs['filters'](_[_0x43e7('0x42')](_0x2b4bfd[_0x43e7('0x38')],_0x50a2d0[_0x43e7('0x3a')]));if(_0x2b4bfd[_0x43e7('0x38')]['filter']){_0x31bc78['where']=_['merge'](_0x31bc78[_0x43e7('0x43')],{'$or':_['map'](_0x449803,function(_0x2ab022){if(_0x2ab022['type']!=='VIRTUAL'){var _0x46b2e6={};_0x46b2e6[_0x2ab022['name']]={'$like':'%'+_0x2b4bfd[_0x43e7('0x38')][_0x43e7('0x44')]+'%'};return _0x46b2e6;}})});}_0x31bc78=_[_0x43e7('0x45')]({},_0x31bc78,_0x2b4bfd[_0x43e7('0x46')]);var _0x4fc5e8={'where':_0x31bc78[_0x43e7('0x43')]};return db[_0x43e7('0x47')][_0x43e7('0x28')](_0x4fc5e8)[_0x43e7('0x1a')](function(_0x296dc8){_0x40f72f[_0x43e7('0x28')]=_0x296dc8;if(_0x2b4bfd['query']['includeAll']){_0x31bc78[_0x43e7('0x48')]=[{'all':!![]}];}return db[_0x43e7('0x47')][_0x43e7('0x49')](_0x31bc78);})['then'](function(_0x5c1c18){_0x40f72f['rows']=_0x5c1c18;return _0x40f72f;})[_0x43e7('0x1a')](respondWithFilteredResult(_0x8e9f40,_0x31bc78))[_0x43e7('0x24')](handleError(_0x8e9f40,null));};exports['show']=function(_0x351ca2,_0x47686e){var _0x3c96fe={'raw':![],'where':{'id':_0x351ca2['params']['id']}},_0x560329={};_0x560329['model']=_['keys'](db[_0x43e7('0x47')][_0x43e7('0x4a')]);_0x560329['query']=_[_0x43e7('0x39')](_0x351ca2[_0x43e7('0x38')]);_0x560329[_0x43e7('0x3a')]=_[_0x43e7('0x3b')](_0x560329['model'],_0x560329[_0x43e7('0x38')]);_0x3c96fe['attributes']=_['intersection'](_0x560329[_0x43e7('0x36')],qs[_0x43e7('0x3c')](_0x351ca2[_0x43e7('0x38')][_0x43e7('0x3c')]));_0x3c96fe[_0x43e7('0x3d')]=_0x3c96fe[_0x43e7('0x3d')][_0x43e7('0x4b')]?_0x3c96fe[_0x43e7('0x3d')]:_0x560329[_0x43e7('0x36')];if(_0x351ca2[_0x43e7('0x38')]['includeAll']){_0x3c96fe[_0x43e7('0x48')]=[{'all':!![]}];}_0x3c96fe=_[_0x43e7('0x45')]({},_0x3c96fe,_0x351ca2['options']);return db[_0x43e7('0x47')]['find'](_0x3c96fe)[_0x43e7('0x1a')](handleEntityNotFound(_0x47686e,null))[_0x43e7('0x1a')](respondWithResult(_0x47686e,null))[_0x43e7('0x24')](handleError(_0x47686e,null));};exports[_0x43e7('0x4c')]=function(_0xfe13fa,_0x5e5556){return db['ZohoConfiguration'][_0x43e7('0x4c')](_0xfe13fa[_0x43e7('0x4d')],{})[_0x43e7('0x1a')](respondWithResult(_0x5e5556,0xc9))[_0x43e7('0x24')](handleError(_0x5e5556,null));};exports[_0x43e7('0x30')]=function(_0x25bb44,_0xa47464){if(_0x25bb44[_0x43e7('0x4d')]['id']){delete _0x25bb44[_0x43e7('0x4d')]['id'];}return db[_0x43e7('0x47')][_0x43e7('0x4e')]({'where':{'id':_0x25bb44['params']['id']}})[_0x43e7('0x1a')](handleEntityNotFound(_0xa47464,null))[_0x43e7('0x1a')](saveUpdates(_0x25bb44['body'],null))[_0x43e7('0x1a')](respondWithResult(_0xa47464,null))[_0x43e7('0x24')](handleError(_0xa47464,null));};exports[_0x43e7('0x4f')]=function(_0x558d54,_0x5d63c6){return db[_0x43e7('0x47')][_0x43e7('0x4e')]({'where':{'id':_0x558d54['params']['id']}})[_0x43e7('0x1a')](handleEntityNotFound(_0x5d63c6,null))['then'](removeEntity(_0x5d63c6,null))['catch'](handleError(_0x5d63c6,null));};exports[_0x43e7('0x50')]=function(_0x4b6b7f,_0x1f7c02,_0x40155c){var _0x68697={};var _0x4dfdb0={};var _0xc3976;var _0xdb9fbe;return db['ZohoConfiguration'][_0x43e7('0x51')]({'where':{'id':_0x4b6b7f[_0x43e7('0x52')]['id']}})[_0x43e7('0x1a')](handleEntityNotFound(_0x1f7c02,null))['then'](function(_0x5a4c95){if(_0x5a4c95){_0xc3976=_0x5a4c95;_0x4dfdb0['model']=_[_0x43e7('0x39')](db[_0x43e7('0x53')][_0x43e7('0x4a')]);_0x4dfdb0[_0x43e7('0x38')]=_['keys'](_0x4b6b7f['query']);_0x4dfdb0[_0x43e7('0x3a')]=_[_0x43e7('0x3b')](_0x4dfdb0[_0x43e7('0x36')],_0x4dfdb0[_0x43e7('0x38')]);_0x68697['attributes']=_[_0x43e7('0x3b')](_0x4dfdb0[_0x43e7('0x36')],qs[_0x43e7('0x3c')](_0x4b6b7f[_0x43e7('0x38')][_0x43e7('0x3c')]));_0x68697[_0x43e7('0x3d')]=_0x68697[_0x43e7('0x3d')][_0x43e7('0x4b')]?_0x68697[_0x43e7('0x3d')]:_0x4dfdb0[_0x43e7('0x36')];_0x68697[_0x43e7('0x40')]=qs['sort'](_0x4b6b7f['query'][_0x43e7('0x41')]);_0x68697['where']=qs['filters'](_['pick'](_0x4b6b7f[_0x43e7('0x38')],_0x4dfdb0[_0x43e7('0x3a')]));if(_0x4b6b7f['query'][_0x43e7('0x44')]){_0x68697[_0x43e7('0x43')]=_[_0x43e7('0x45')](_0x68697['where'],{'$or':_[_0x43e7('0x32')](_0x68697[_0x43e7('0x3d')],function(_0x289f86){var _0xc9723={};_0xc9723[_0x289f86]={'$like':'%'+_0x4b6b7f[_0x43e7('0x38')][_0x43e7('0x44')]+'%'};return _0xc9723;})});}_0x68697=_[_0x43e7('0x45')]({},_0x68697,_0x4b6b7f['options']);return _0xc3976[_0x43e7('0x50')](_0x68697);}})[_0x43e7('0x1a')](function(_0x415f26){if(_0x415f26){_0xdb9fbe=_0x415f26['length'];if(!_0x4b6b7f['query'][_0x43e7('0x3e')]('nolimit')){_0x68697['limit']=qs[_0x43e7('0x2a')](_0x4b6b7f[_0x43e7('0x38')]['limit']);_0x68697[_0x43e7('0x29')]=qs[_0x43e7('0x29')](_0x4b6b7f[_0x43e7('0x38')][_0x43e7('0x29')]);}return _0xc3976[_0x43e7('0x50')](_0x68697);}})[_0x43e7('0x1a')](function(_0x398a78){if(_0x398a78){return _0x398a78?{'count':_0xdb9fbe,'rows':_0x398a78}:null;}})['then'](respondWithResult(_0x1f7c02,null))[_0x43e7('0x24')](handleError(_0x1f7c02,null));};exports[_0x43e7('0x54')]=function(_0x4e5956,_0x418213,_0x5c2c5f){var _0x26ee52={};var _0x248936={};var _0x37301b;var _0x1ca24b;return db['ZohoConfiguration'][_0x43e7('0x51')]({'where':{'id':_0x4e5956[_0x43e7('0x52')]['id']}})[_0x43e7('0x1a')](handleEntityNotFound(_0x418213,null))['then'](function(_0x17889c){if(_0x17889c){_0x37301b=_0x17889c;_0x248936[_0x43e7('0x36')]=_[_0x43e7('0x39')](db[_0x43e7('0x53')][_0x43e7('0x4a')]);_0x248936['query']=_[_0x43e7('0x39')](_0x4e5956[_0x43e7('0x38')]);_0x248936[_0x43e7('0x3a')]=_[_0x43e7('0x3b')](_0x248936[_0x43e7('0x36')],_0x248936[_0x43e7('0x38')]);_0x26ee52[_0x43e7('0x3d')]=_['intersection'](_0x248936['model'],qs[_0x43e7('0x3c')](_0x4e5956['query']['fields']));_0x26ee52['attributes']=_0x26ee52[_0x43e7('0x3d')][_0x43e7('0x4b')]?_0x26ee52[_0x43e7('0x3d')]:_0x248936[_0x43e7('0x36')];_0x26ee52[_0x43e7('0x40')]=qs[_0x43e7('0x41')](_0x4e5956['query'][_0x43e7('0x41')]);_0x26ee52[_0x43e7('0x43')]=qs[_0x43e7('0x3a')](_['pick'](_0x4e5956[_0x43e7('0x38')],_0x248936[_0x43e7('0x3a')]));if(_0x4e5956[_0x43e7('0x38')][_0x43e7('0x44')]){_0x26ee52[_0x43e7('0x43')]=_[_0x43e7('0x45')](_0x26ee52[_0x43e7('0x43')],{'$or':_[_0x43e7('0x32')](_0x26ee52['attributes'],function(_0x52c757){var _0x55990c={};_0x55990c[_0x52c757]={'$like':'%'+_0x4e5956[_0x43e7('0x38')][_0x43e7('0x44')]+'%'};return _0x55990c;})});}_0x26ee52=_['merge']({},_0x26ee52,_0x4e5956[_0x43e7('0x46')]);return _0x37301b[_0x43e7('0x54')](_0x26ee52);}})[_0x43e7('0x1a')](function(_0x8e60f1){if(_0x8e60f1){_0x1ca24b=_0x8e60f1['length'];if(!_0x4e5956['query']['hasOwnProperty'](_0x43e7('0x3f'))){_0x26ee52[_0x43e7('0x2a')]=qs['limit'](_0x4e5956['query'][_0x43e7('0x2a')]);_0x26ee52[_0x43e7('0x29')]=qs[_0x43e7('0x29')](_0x4e5956['query'][_0x43e7('0x29')]);}return _0x37301b[_0x43e7('0x54')](_0x26ee52);}})[_0x43e7('0x1a')](function(_0xb04082){if(_0xb04082){return _0xb04082?{'count':_0x1ca24b,'rows':_0xb04082}:null;}})['then'](respondWithResult(_0x418213,null))[_0x43e7('0x24')](handleError(_0x418213,null));};exports['getDescriptions']=function(_0xa66309,_0x3ab790,_0x24a168){var _0x90667c={};var _0xa7cb2c={};var _0x45adef;var _0x126133;return db['ZohoConfiguration'][_0x43e7('0x51')]({'where':{'id':_0xa66309[_0x43e7('0x52')]['id']}})[_0x43e7('0x1a')](handleEntityNotFound(_0x3ab790,null))[_0x43e7('0x1a')](function(_0x550960){if(_0x550960){_0x45adef=_0x550960;_0xa7cb2c['model']=_['keys'](db[_0x43e7('0x53')]['rawAttributes']);_0xa7cb2c[_0x43e7('0x38')]=_[_0x43e7('0x39')](_0xa66309[_0x43e7('0x38')]);_0xa7cb2c[_0x43e7('0x3a')]=_[_0x43e7('0x3b')](_0xa7cb2c[_0x43e7('0x36')],_0xa7cb2c[_0x43e7('0x38')]);_0x90667c[_0x43e7('0x3d')]=_[_0x43e7('0x3b')](_0xa7cb2c[_0x43e7('0x36')],qs[_0x43e7('0x3c')](_0xa66309['query'][_0x43e7('0x3c')]));_0x90667c[_0x43e7('0x3d')]=_0x90667c[_0x43e7('0x3d')][_0x43e7('0x4b')]?_0x90667c[_0x43e7('0x3d')]:_0xa7cb2c['model'];_0x90667c['order']=qs[_0x43e7('0x41')](_0xa66309[_0x43e7('0x38')]['sort']);_0x90667c[_0x43e7('0x43')]=qs[_0x43e7('0x3a')](_['pick'](_0xa66309['query'],_0xa7cb2c[_0x43e7('0x3a')]));if(_0xa66309[_0x43e7('0x38')][_0x43e7('0x44')]){_0x90667c[_0x43e7('0x43')]=_[_0x43e7('0x45')](_0x90667c['where'],{'$or':_['map'](_0x90667c[_0x43e7('0x3d')],function(_0x18c438){var _0x3ce34b={};_0x3ce34b[_0x18c438]={'$like':'%'+_0xa66309[_0x43e7('0x38')]['filter']+'%'};return _0x3ce34b;})});}_0x90667c=_[_0x43e7('0x45')]({},_0x90667c,_0xa66309[_0x43e7('0x46')]);return _0x45adef[_0x43e7('0x55')](_0x90667c);}})[_0x43e7('0x1a')](function(_0x5bc060){if(_0x5bc060){_0x126133=_0x5bc060[_0x43e7('0x4b')];if(!_0xa66309[_0x43e7('0x38')][_0x43e7('0x3e')](_0x43e7('0x3f'))){_0x90667c[_0x43e7('0x2a')]=qs['limit'](_0xa66309[_0x43e7('0x38')][_0x43e7('0x2a')]);_0x90667c['offset']=qs[_0x43e7('0x29')](_0xa66309[_0x43e7('0x38')][_0x43e7('0x29')]);}return _0x45adef[_0x43e7('0x55')](_0x90667c);}})['then'](function(_0x3da183){if(_0x3da183){return _0x3da183?{'count':_0x126133,'rows':_0x3da183}:null;}})['then'](respondWithResult(_0x3ab790,null))[_0x43e7('0x24')](handleError(_0x3ab790,null));}; \ No newline at end of file +var _0xe14b=['info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','name','map','ZohoConfiguration','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','body','getFields','findOne','ZohoField','order','getSubjects','getDescriptions','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','jayson/promise','client','http','test','Sequelize','ValidationError','request','then'];(function(_0x592acf,_0x102934){var _0x37405c=function(_0x33ba90){while(--_0x33ba90){_0x592acf['push'](_0x592acf['shift']());}};_0x37405c(++_0x102934);}(_0xe14b,0x93));var _0xbe14=function(_0x1e0f75,_0x497973){_0x1e0f75=_0x1e0f75-0x0;var _0x422d75=_0xe14b[_0x1e0f75];return _0x422d75;};'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'];var jayson=require(_0xbe14('0x15'));var client=jayson[_0xbe14('0x16')][_0xbe14('0x17')]({'port':0x232a});function checkPasswordPattern(_0x23a730,_0x2850cb,_0x16893f){if(_0x16893f){var _0xa2cf72=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa2cf72[_0xbe14('0x18')](_0x2850cb)){return _0x23a730;}else{throw new db[(_0xbe14('0x19'))][(_0xbe14('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 _0x23a730;}}function respondWithRpcPromise(_0x55b3a7,_0x3f58f5,_0x3dc4a9,_0xf4ac9){return new BPromise(function(_0x37ce4e,_0x4e8f34){var _0x21c789=_0xf4ac9||client;return _0x21c789[_0xbe14('0x1b')](_0x55b3a7,_0x3dc4a9)[_0xbe14('0x1c')](function(_0x123ede){logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x3f58f5,_0xbe14('0x1f'));logger['debug'](_0xbe14('0x20'),_0x3f58f5,_0xbe14('0x1f'),JSON[_0xbe14('0x21')](_0x123ede));if(_0x123ede[_0xbe14('0x22')]){if(_0x123ede[_0xbe14('0x22')][_0xbe14('0x23')]===0x1f4){logger['error'](_0xbe14('0x1e'),_0x3f58f5,_0x123ede[_0xbe14('0x22')][_0xbe14('0x24')]);return _0x4e8f34(_0x123ede[_0xbe14('0x22')][_0xbe14('0x24')]);}logger['error'](_0xbe14('0x1e'),_0x3f58f5,_0x123ede['error'][_0xbe14('0x24')]);return _0x37ce4e(_0x123ede['error'][_0xbe14('0x24')]);}else{logger['info'](_0xbe14('0x1e'),_0x3f58f5,_0xbe14('0x1f'));_0x37ce4e(_0x123ede['result'][_0xbe14('0x24')]);}})['catch'](function(_0x4587a8){logger['error'](_0xbe14('0x1e'),_0x3f58f5,_0x4587a8);_0x4e8f34(_0x4587a8);});});}function respondWithStatusCode(_0x5fa043,_0x1ee9c1){_0x1ee9c1=_0x1ee9c1||0xcc;return function(_0x39cc81){if(_0x39cc81){return _0x5fa043[_0xbe14('0x25')](_0x1ee9c1);}return _0x5fa043[_0xbe14('0x26')](_0x1ee9c1)['end']();};}function respondWithResult(_0x1822e0,_0x1ba46a){_0x1ba46a=_0x1ba46a||0xc8;return function(_0x391556){if(_0x391556){return _0x1822e0[_0xbe14('0x26')](_0x1ba46a)['json'](_0x391556);}};}function respondWithFilteredResult(_0x16f884,_0x29fc64){return function(_0x59bf34){if(_0x59bf34){var _0x3c3613=_0x59bf34[_0xbe14('0x27')],_0x3b3e84=_0x29fc64[_0xbe14('0x28')],_0x1c7cc7=_0x29fc64[_0xbe14('0x28')]+_0x29fc64[_0xbe14('0x29')],_0x19252f;if(_0x1c7cc7>=_0x3c3613){_0x1c7cc7=_0x3c3613;_0x19252f=0xc8;}else{_0x19252f=0xce;}_0x16f884[_0xbe14('0x26')](_0x19252f);return _0x16f884[_0xbe14('0x2a')](_0xbe14('0x2b'),_0x3b3e84+'-'+_0x1c7cc7+'/'+_0x3c3613)[_0xbe14('0x2c')](_0x59bf34);}return null;};}function patchUpdates(_0x39dc0a){return function(_0x10ae36){try{jsonpatch[_0xbe14('0x2d')](_0x10ae36,_0x39dc0a,!![]);}catch(_0xe6feb2){return BPromise[_0xbe14('0x2e')](_0xe6feb2);}return _0x10ae36[_0xbe14('0x2f')]();};}function saveUpdates(_0x29e76a,_0x14e7c4){return function(_0x581e86){if(_0x581e86){return _0x581e86[_0xbe14('0x30')](_0x29e76a)['then'](function(_0x58f8de){return _0x58f8de;});}return null;};}function removeEntity(_0x46c2d1,_0x4c1e7e){return function(_0x243524){if(_0x243524){return _0x243524[_0xbe14('0x31')]()['then'](function(){_0x46c2d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x412ad5,_0xa3d24){return function(_0x5f27b6){if(!_0x5f27b6){_0x412ad5[_0xbe14('0x25')](0x194);}return _0x5f27b6;};}function handleError(_0x1faf3e,_0x452635){_0x452635=_0x452635||0x1f4;return function(_0x1aa849){logger[_0xbe14('0x22')](_0x1aa849['stack']);if(_0x1aa849['name']){delete _0x1aa849[_0xbe14('0x32')];}_0x1faf3e['status'](_0x452635)['send'](_0x1aa849);};}exports['index']=function(_0x163ef7,_0x393f6b){var _0x2bb45={},_0x3dbacb={},_0x172e79={'count':0x0,'rows':[]};var _0x29356f=_[_0xbe14('0x33')](db[_0xbe14('0x34')][_0xbe14('0x35')],function(_0x2dfd5a){return{'name':_0x2dfd5a[_0xbe14('0x36')],'type':_0x2dfd5a[_0xbe14('0x37')]['key']};});_0x3dbacb['model']=_[_0xbe14('0x33')](_0x29356f,_0xbe14('0x32'));_0x3dbacb[_0xbe14('0x38')]=_['keys'](_0x163ef7[_0xbe14('0x38')]);_0x3dbacb[_0xbe14('0x39')]=_[_0xbe14('0x3a')](_0x3dbacb[_0xbe14('0x3b')],_0x3dbacb[_0xbe14('0x38')]);_0x2bb45[_0xbe14('0x3c')]=_[_0xbe14('0x3a')](_0x3dbacb[_0xbe14('0x3b')],qs[_0xbe14('0x3d')](_0x163ef7['query'][_0xbe14('0x3d')]));_0x2bb45[_0xbe14('0x3c')]=_0x2bb45[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x2bb45[_0xbe14('0x3c')]:_0x3dbacb[_0xbe14('0x3b')];if(!_0x163ef7['query'][_0xbe14('0x3f')](_0xbe14('0x40'))){_0x2bb45[_0xbe14('0x29')]=qs[_0xbe14('0x29')](_0x163ef7['query']['limit']);_0x2bb45[_0xbe14('0x28')]=qs[_0xbe14('0x28')](_0x163ef7[_0xbe14('0x38')]['offset']);}_0x2bb45['order']=qs[_0xbe14('0x41')](_0x163ef7['query']['sort']);_0x2bb45[_0xbe14('0x42')]=qs[_0xbe14('0x39')](_[_0xbe14('0x43')](_0x163ef7['query'],_0x3dbacb['filters']));if(_0x163ef7['query'][_0xbe14('0x44')]){_0x2bb45[_0xbe14('0x42')]=_[_0xbe14('0x45')](_0x2bb45['where'],{'$or':_[_0xbe14('0x33')](_0x29356f,function(_0xcb0680){if(_0xcb0680[_0xbe14('0x37')]!==_0xbe14('0x46')){var _0x58351f={};_0x58351f[_0xcb0680['name']]={'$like':'%'+_0x163ef7[_0xbe14('0x38')][_0xbe14('0x44')]+'%'};return _0x58351f;}})});}_0x2bb45=_[_0xbe14('0x45')]({},_0x2bb45,_0x163ef7[_0xbe14('0x47')]);var _0x2550dc={'where':_0x2bb45['where']};return db['ZohoConfiguration'][_0xbe14('0x27')](_0x2550dc)[_0xbe14('0x1c')](function(_0x238c60){_0x172e79[_0xbe14('0x27')]=_0x238c60;if(_0x163ef7['query'][_0xbe14('0x48')]){_0x2bb45[_0xbe14('0x49')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xbe14('0x4a')](_0x2bb45);})[_0xbe14('0x1c')](function(_0x2d6ee8){_0x172e79[_0xbe14('0x4b')]=_0x2d6ee8;return _0x172e79;})['then'](respondWithFilteredResult(_0x393f6b,_0x2bb45))['catch'](handleError(_0x393f6b,null));};exports[_0xbe14('0x4c')]=function(_0x29564b,_0x4a1a37){var _0x5acf90={'raw':![],'where':{'id':_0x29564b[_0xbe14('0x4d')]['id']}},_0xca8cdb={};_0xca8cdb[_0xbe14('0x3b')]=_[_0xbe14('0x4e')](db[_0xbe14('0x34')][_0xbe14('0x35')]);_0xca8cdb[_0xbe14('0x38')]=_['keys'](_0x29564b[_0xbe14('0x38')]);_0xca8cdb[_0xbe14('0x39')]=_[_0xbe14('0x3a')](_0xca8cdb[_0xbe14('0x3b')],_0xca8cdb[_0xbe14('0x38')]);_0x5acf90['attributes']=_[_0xbe14('0x3a')](_0xca8cdb[_0xbe14('0x3b')],qs[_0xbe14('0x3d')](_0x29564b[_0xbe14('0x38')][_0xbe14('0x3d')]));_0x5acf90[_0xbe14('0x3c')]=_0x5acf90['attributes']['length']?_0x5acf90[_0xbe14('0x3c')]:_0xca8cdb[_0xbe14('0x3b')];if(_0x29564b[_0xbe14('0x38')]['includeAll']){_0x5acf90['include']=[{'all':!![]}];}_0x5acf90=_[_0xbe14('0x45')]({},_0x5acf90,_0x29564b[_0xbe14('0x47')]);return db['ZohoConfiguration'][_0xbe14('0x4f')](_0x5acf90)[_0xbe14('0x1c')](handleEntityNotFound(_0x4a1a37,null))['then'](respondWithResult(_0x4a1a37,null))[_0xbe14('0x50')](handleError(_0x4a1a37,null));};exports['create']=function(_0x41ba58,_0x410c59){return db[_0xbe14('0x34')]['create'](_0x41ba58[_0xbe14('0x51')],{})[_0xbe14('0x1c')](respondWithResult(_0x410c59,0xc9))['catch'](handleError(_0x410c59,null));};exports[_0xbe14('0x30')]=function(_0x42ca15,_0x2210cc){if(_0x42ca15[_0xbe14('0x51')]['id']){delete _0x42ca15[_0xbe14('0x51')]['id'];}return db['ZohoConfiguration'][_0xbe14('0x4f')]({'where':{'id':_0x42ca15[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x2210cc,null))[_0xbe14('0x1c')](saveUpdates(_0x42ca15[_0xbe14('0x51')],null))[_0xbe14('0x1c')](respondWithResult(_0x2210cc,null))[_0xbe14('0x50')](handleError(_0x2210cc,null));};exports['destroy']=function(_0x72c875,_0x1b47a4){return db[_0xbe14('0x34')][_0xbe14('0x4f')]({'where':{'id':_0x72c875[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x1b47a4,null))[_0xbe14('0x1c')](removeEntity(_0x1b47a4,null))[_0xbe14('0x50')](handleError(_0x1b47a4,null));};exports[_0xbe14('0x52')]=function(_0xc61103,_0x358950,_0x4bccfc){var _0x56bcd3={};var _0x58dd79={};var _0x10c0bc;var _0x1bfcbf;return db[_0xbe14('0x34')][_0xbe14('0x53')]({'where':{'id':_0xc61103[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x358950,null))[_0xbe14('0x1c')](function(_0x22bf69){if(_0x22bf69){_0x10c0bc=_0x22bf69;_0x58dd79[_0xbe14('0x3b')]=_[_0xbe14('0x4e')](db[_0xbe14('0x54')][_0xbe14('0x35')]);_0x58dd79[_0xbe14('0x38')]=_[_0xbe14('0x4e')](_0xc61103[_0xbe14('0x38')]);_0x58dd79[_0xbe14('0x39')]=_[_0xbe14('0x3a')](_0x58dd79[_0xbe14('0x3b')],_0x58dd79[_0xbe14('0x38')]);_0x56bcd3[_0xbe14('0x3c')]=_['intersection'](_0x58dd79[_0xbe14('0x3b')],qs[_0xbe14('0x3d')](_0xc61103[_0xbe14('0x38')][_0xbe14('0x3d')]));_0x56bcd3[_0xbe14('0x3c')]=_0x56bcd3[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x56bcd3[_0xbe14('0x3c')]:_0x58dd79[_0xbe14('0x3b')];_0x56bcd3[_0xbe14('0x55')]=qs['sort'](_0xc61103[_0xbe14('0x38')][_0xbe14('0x41')]);_0x56bcd3[_0xbe14('0x42')]=qs[_0xbe14('0x39')](_[_0xbe14('0x43')](_0xc61103['query'],_0x58dd79[_0xbe14('0x39')]));if(_0xc61103[_0xbe14('0x38')][_0xbe14('0x44')]){_0x56bcd3[_0xbe14('0x42')]=_[_0xbe14('0x45')](_0x56bcd3['where'],{'$or':_[_0xbe14('0x33')](_0x56bcd3[_0xbe14('0x3c')],function(_0x7ea146){var _0x29bb26={};_0x29bb26[_0x7ea146]={'$like':'%'+_0xc61103[_0xbe14('0x38')][_0xbe14('0x44')]+'%'};return _0x29bb26;})});}_0x56bcd3=_[_0xbe14('0x45')]({},_0x56bcd3,_0xc61103[_0xbe14('0x47')]);return _0x10c0bc['getFields'](_0x56bcd3);}})[_0xbe14('0x1c')](function(_0x33c309){if(_0x33c309){_0x1bfcbf=_0x33c309[_0xbe14('0x3e')];if(!_0xc61103[_0xbe14('0x38')][_0xbe14('0x3f')](_0xbe14('0x40'))){_0x56bcd3[_0xbe14('0x29')]=qs['limit'](_0xc61103['query'][_0xbe14('0x29')]);_0x56bcd3[_0xbe14('0x28')]=qs[_0xbe14('0x28')](_0xc61103[_0xbe14('0x38')][_0xbe14('0x28')]);}return _0x10c0bc[_0xbe14('0x52')](_0x56bcd3);}})[_0xbe14('0x1c')](function(_0x43511e){if(_0x43511e){return _0x43511e?{'count':_0x1bfcbf,'rows':_0x43511e}:null;}})['then'](respondWithResult(_0x358950,null))['catch'](handleError(_0x358950,null));};exports[_0xbe14('0x56')]=function(_0x1c18b6,_0x29aa52,_0x57729f){var _0x76e91e={};var _0x16bca1={};var _0x105be0;var _0x1797dd;return db[_0xbe14('0x34')][_0xbe14('0x53')]({'where':{'id':_0x1c18b6[_0xbe14('0x4d')]['id']}})['then'](handleEntityNotFound(_0x29aa52,null))[_0xbe14('0x1c')](function(_0x3b6ef5){if(_0x3b6ef5){_0x105be0=_0x3b6ef5;_0x16bca1[_0xbe14('0x3b')]=_[_0xbe14('0x4e')](db[_0xbe14('0x54')][_0xbe14('0x35')]);_0x16bca1[_0xbe14('0x38')]=_['keys'](_0x1c18b6[_0xbe14('0x38')]);_0x16bca1[_0xbe14('0x39')]=_[_0xbe14('0x3a')](_0x16bca1[_0xbe14('0x3b')],_0x16bca1[_0xbe14('0x38')]);_0x76e91e[_0xbe14('0x3c')]=_[_0xbe14('0x3a')](_0x16bca1[_0xbe14('0x3b')],qs['fields'](_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x3d')]));_0x76e91e[_0xbe14('0x3c')]=_0x76e91e[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x76e91e[_0xbe14('0x3c')]:_0x16bca1['model'];_0x76e91e[_0xbe14('0x55')]=qs[_0xbe14('0x41')](_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x41')]);_0x76e91e['where']=qs[_0xbe14('0x39')](_[_0xbe14('0x43')](_0x1c18b6[_0xbe14('0x38')],_0x16bca1[_0xbe14('0x39')]));if(_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x44')]){_0x76e91e[_0xbe14('0x42')]=_['merge'](_0x76e91e[_0xbe14('0x42')],{'$or':_['map'](_0x76e91e[_0xbe14('0x3c')],function(_0x5d85d3){var _0x389822={};_0x389822[_0x5d85d3]={'$like':'%'+_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x44')]+'%'};return _0x389822;})});}_0x76e91e=_['merge']({},_0x76e91e,_0x1c18b6[_0xbe14('0x47')]);return _0x105be0[_0xbe14('0x56')](_0x76e91e);}})[_0xbe14('0x1c')](function(_0x546f22){if(_0x546f22){_0x1797dd=_0x546f22[_0xbe14('0x3e')];if(!_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x3f')](_0xbe14('0x40'))){_0x76e91e['limit']=qs[_0xbe14('0x29')](_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x29')]);_0x76e91e[_0xbe14('0x28')]=qs[_0xbe14('0x28')](_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x28')]);}return _0x105be0['getSubjects'](_0x76e91e);}})[_0xbe14('0x1c')](function(_0x123f4f){if(_0x123f4f){return _0x123f4f?{'count':_0x1797dd,'rows':_0x123f4f}:null;}})[_0xbe14('0x1c')](respondWithResult(_0x29aa52,null))['catch'](handleError(_0x29aa52,null));};exports[_0xbe14('0x57')]=function(_0x420467,_0x1ea305,_0x5bc52b){var _0xa53262={};var _0x1205d1={};var _0x47d7bb;var _0x2be969;return db['ZohoConfiguration'][_0xbe14('0x53')]({'where':{'id':_0x420467[_0xbe14('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1ea305,null))['then'](function(_0x54045e){if(_0x54045e){_0x47d7bb=_0x54045e;_0x1205d1[_0xbe14('0x3b')]=_[_0xbe14('0x4e')](db['ZohoField'][_0xbe14('0x35')]);_0x1205d1[_0xbe14('0x38')]=_[_0xbe14('0x4e')](_0x420467[_0xbe14('0x38')]);_0x1205d1['filters']=_['intersection'](_0x1205d1[_0xbe14('0x3b')],_0x1205d1[_0xbe14('0x38')]);_0xa53262[_0xbe14('0x3c')]=_[_0xbe14('0x3a')](_0x1205d1[_0xbe14('0x3b')],qs[_0xbe14('0x3d')](_0x420467[_0xbe14('0x38')]['fields']));_0xa53262[_0xbe14('0x3c')]=_0xa53262['attributes'][_0xbe14('0x3e')]?_0xa53262[_0xbe14('0x3c')]:_0x1205d1[_0xbe14('0x3b')];_0xa53262[_0xbe14('0x55')]=qs['sort'](_0x420467[_0xbe14('0x38')][_0xbe14('0x41')]);_0xa53262[_0xbe14('0x42')]=qs['filters'](_[_0xbe14('0x43')](_0x420467[_0xbe14('0x38')],_0x1205d1[_0xbe14('0x39')]));if(_0x420467[_0xbe14('0x38')][_0xbe14('0x44')]){_0xa53262[_0xbe14('0x42')]=_[_0xbe14('0x45')](_0xa53262[_0xbe14('0x42')],{'$or':_[_0xbe14('0x33')](_0xa53262[_0xbe14('0x3c')],function(_0x2bf94c){var _0x49497e={};_0x49497e[_0x2bf94c]={'$like':'%'+_0x420467[_0xbe14('0x38')][_0xbe14('0x44')]+'%'};return _0x49497e;})});}_0xa53262=_[_0xbe14('0x45')]({},_0xa53262,_0x420467[_0xbe14('0x47')]);return _0x47d7bb[_0xbe14('0x57')](_0xa53262);}})[_0xbe14('0x1c')](function(_0x1679bd){if(_0x1679bd){_0x2be969=_0x1679bd[_0xbe14('0x3e')];if(!_0x420467['query'][_0xbe14('0x3f')]('nolimit')){_0xa53262[_0xbe14('0x29')]=qs[_0xbe14('0x29')](_0x420467[_0xbe14('0x38')][_0xbe14('0x29')]);_0xa53262[_0xbe14('0x28')]=qs['offset'](_0x420467['query'][_0xbe14('0x28')]);}return _0x47d7bb[_0xbe14('0x57')](_0xa53262);}})[_0xbe14('0x1c')](function(_0x42b849){if(_0x42b849){return _0x42b849?{'count':_0x2be969,'rows':_0x42b849}:null;}})['then'](respondWithResult(_0x1ea305,null))[_0xbe14('0x50')](handleError(_0x1ea305,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 1f577fd..35f61b8 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 _0xa963=['bluebird','request-promise','path','rimraf','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x555ded,_0x249373){var _0x3f0d2d=function(_0x1e45db){while(--_0x1e45db){_0x555ded['push'](_0x555ded['shift']());}};_0x3f0d2d(++_0x249373);}(_0xa963,0xdb));var _0x3a96=function(_0x59d1da,_0x87ef28){_0x59d1da=_0x59d1da-0x0;var _0x156437=_0xa963[_0x59d1da];return _0x156437;};'use strict';var _=require(_0x3a96('0x0'));var util=require(_0x3a96('0x1'));var logger=require(_0x3a96('0x2'))(_0x3a96('0x3'));var moment=require(_0x3a96('0x4'));var BPromise=require(_0x3a96('0x5'));var rp=require(_0x3a96('0x6'));var fs=require('fs');var path=require(_0x3a96('0x7'));var rimraf=require(_0x3a96('0x8'));var config=require('../../config/environment');var attributes=require(_0x3a96('0x9'));module[_0x3a96('0xa')]=function(_0x18e62a,_0x4a4bf7){return _0x18e62a[_0x3a96('0xb')](_0x3a96('0xc'),attributes,{'tableName':_0x3a96('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c49=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x46aa6f,_0xf7b072){var _0x44759c=function(_0x97a501){while(--_0x97a501){_0x46aa6f['push'](_0x46aa6f['shift']());}};_0x44759c(++_0xf7b072);}(_0x3c49,0x138));var _0x93c4=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x3c49[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x93c4('0x0'));var util=require(_0x93c4('0x1'));var logger=require(_0x93c4('0x2'))(_0x93c4('0x3'));var moment=require(_0x93c4('0x4'));var BPromise=require(_0x93c4('0x5'));var rp=require(_0x93c4('0x6'));var fs=require('fs');var path=require(_0x93c4('0x7'));var rimraf=require(_0x93c4('0x8'));var config=require(_0x93c4('0x9'));var attributes=require(_0x93c4('0xa'));module[_0x93c4('0xb')]=function(_0x342a21,_0x3f3be7){return _0x342a21[_0x93c4('0xc')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 4408d2b..bbe6f8c 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 _0x5df5=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','lodash','moment'];(function(_0x3f6bab,_0x47fdb0){var _0x26d34b=function(_0x1a8bfc){while(--_0x1a8bfc){_0x3f6bab['push'](_0x3f6bab['shift']());}};_0x26d34b(++_0x47fdb0);}(_0x5df5,0x1de));var _0x55df=function(_0x3a2fc3,_0x237fc8){_0x3a2fc3=_0x3a2fc3-0x0;var _0x3942cf=_0x5df5[_0x3a2fc3];return _0x3942cf;};'use strict';var _=require(_0x55df('0x0'));var util=require('util');var moment=require(_0x55df('0x1'));var BPromise=require('bluebird');var rs=require(_0x55df('0x2'));var fs=require('fs');var Redis=require(_0x55df('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x55df('0x4'))(_0x55df('0x5'));var config=require(_0x55df('0x6'));var jayson=require(_0x55df('0x7'));var client=jayson[_0x55df('0x8')][_0x55df('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3954e8,_0x5c853c,_0x737856){return new BPromise(function(_0x3226b6,_0xf41e9c){return client['request'](_0x3954e8,_0x737856)[_0x55df('0xa')](function(_0x4622c5){logger[_0x55df('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x5c853c,'request\x20sent');logger[_0x55df('0xc')](_0x55df('0xd'),_0x5c853c,_0x55df('0xe'),JSON['stringify'](_0x4622c5));if(_0x4622c5[_0x55df('0xf')]){if(_0x4622c5[_0x55df('0xf')][_0x55df('0x10')]===0x1f4){logger[_0x55df('0xf')](_0x55df('0x11'),_0x5c853c,_0x4622c5[_0x55df('0xf')]['message']);return _0xf41e9c(_0x4622c5[_0x55df('0xf')][_0x55df('0x12')]);}logger[_0x55df('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x5c853c,_0x4622c5['error'][_0x55df('0x12')]);return _0x3226b6(_0x4622c5['error'][_0x55df('0x12')]);}else{logger[_0x55df('0xb')](_0x55df('0x11'),_0x5c853c,_0x55df('0xe'));_0x3226b6(_0x4622c5[_0x55df('0x13')][_0x55df('0x12')]);}})['catch'](function(_0x19b966){logger[_0x55df('0xf')](_0x55df('0x11'),_0x5c853c,_0x19b966);_0xf41e9c(_0x19b966);});});} \ No newline at end of file +var _0x99d7=['../../config/logger','../../config/environment','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x547e20,_0x284545){var _0x359171=function(_0x590250){while(--_0x590250){_0x547e20['push'](_0x547e20['shift']());}};_0x359171(++_0x284545);}(_0x99d7,0xbf));var _0x799d=function(_0x241a97,_0x506009){_0x241a97=_0x241a97-0x0;var _0x18bb1a=_0x99d7[_0x241a97];return _0x18bb1a;};'use strict';var _=require(_0x799d('0x0'));var util=require(_0x799d('0x1'));var moment=require(_0x799d('0x2'));var BPromise=require('bluebird');var rs=require(_0x799d('0x3'));var fs=require('fs');var Redis=require(_0x799d('0x4'));var db=require(_0x799d('0x5'))['db'];var utils=require(_0x799d('0x6'));var logger=require(_0x799d('0x7'))('rpc');var config=require(_0x799d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x799d('0x9')][_0x799d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x319e7b,_0x1f38c8,_0x29abde){return new BPromise(function(_0x487c1a,_0x1478b9){return client[_0x799d('0xb')](_0x319e7b,_0x29abde)[_0x799d('0xc')](function(_0x58ff0f){logger[_0x799d('0xd')](_0x799d('0xe'),_0x1f38c8,_0x799d('0xf'));logger['debug'](_0x799d('0x10'),_0x1f38c8,_0x799d('0xf'),JSON['stringify'](_0x58ff0f));if(_0x58ff0f['error']){if(_0x58ff0f[_0x799d('0x11')][_0x799d('0x12')]===0x1f4){logger['error'](_0x799d('0xe'),_0x1f38c8,_0x58ff0f[_0x799d('0x11')]['message']);return _0x1478b9(_0x58ff0f[_0x799d('0x11')][_0x799d('0x13')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x1f38c8,_0x58ff0f[_0x799d('0x11')]['message']);return _0x487c1a(_0x58ff0f[_0x799d('0x11')]['message']);}else{logger[_0x799d('0xd')](_0x799d('0xe'),_0x1f38c8,'request\x20sent');_0x487c1a(_0x58ff0f[_0x799d('0x14')]['message']);}})[_0x799d('0x15')](function(_0xb9d6e4){logger[_0x799d('0x11')](_0x799d('0xe'),_0x1f38c8,_0xb9d6e4);_0x1478b9(_0xb9d6e4);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 882bea4..37e7e98 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 _0xadb5=['destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete'];(function(_0xfbd336,_0x52c148){var _0xa1ba10=function(_0x53ac7a){while(--_0x53ac7a){_0xfbd336['push'](_0xfbd336['shift']());}};_0xa1ba10(++_0x52c148);}(_0xadb5,0xad));var _0x5adb=function(_0x366749,_0x4fb4bd){_0x366749=_0x366749-0x0;var _0x5e51e6=_0xadb5[_0x366749];return _0x5e51e6;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var controller=require(_0x5adb('0x6'));router['get']('/',auth[_0x5adb('0x7')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0xa'),auth[_0x5adb('0x7')](),controller[_0x5adb('0xb')]);router[_0x5adb('0xc')]('/',auth[_0x5adb('0x7')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xa'),auth[_0x5adb('0x7')](),controller[_0x5adb('0xf')]);router[_0x5adb('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x5adb('0x11')]);module[_0x5adb('0x12')]=router; \ No newline at end of file +var _0x6d11=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','put','update','destroy','exports','multer','util','path','express'];(function(_0xb89dfb,_0xbcf3a7){var _0x515dba=function(_0x59aecc){while(--_0x59aecc){_0xb89dfb['push'](_0xb89dfb['shift']());}};_0x515dba(++_0xbcf3a7);}(_0x6d11,0xbf));var _0x16d1=function(_0xe5a050,_0x3ae6b6){_0xe5a050=_0xe5a050-0x0;var _0x5a9c62=_0x6d11[_0xe5a050];return _0x5a9c62;};'use strict';var multer=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var path=require(_0x16d1('0x2'));var timeout=require('connect-timeout');var express=require(_0x16d1('0x3'));var router=express['Router']();var auth=require(_0x16d1('0x4'));var interaction=require(_0x16d1('0x5'));var config=require('../../config/environment');var controller=require('./intZohoField.controller');router[_0x16d1('0x6')]('/',auth[_0x16d1('0x7')](),controller[_0x16d1('0x8')]);router[_0x16d1('0x6')](_0x16d1('0x9'),auth[_0x16d1('0x7')](),controller[_0x16d1('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x16d1('0xb')](_0x16d1('0x9'),auth[_0x16d1('0x7')](),controller[_0x16d1('0xc')]);router['delete'](_0x16d1('0x9'),auth[_0x16d1('0x7')](),controller[_0x16d1('0xd')]);module[_0x16d1('0xe')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index d75cc2d..5ecde86 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 _0x2fa9=['variable','customVariable','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x3a10e3,_0x3cdb35){var _0xf067c8=function(_0x184beb){while(--_0x184beb){_0x3a10e3['push'](_0x3a10e3['shift']());}};_0xf067c8(++_0x3cdb35);}(_0x2fa9,0x144));var _0x92fa=function(_0x56a1f6,_0x1f94de){_0x56a1f6=_0x56a1f6-0x0;var _0x177124=_0x2fa9[_0x56a1f6];return _0x177124;};'use strict';var Sequelize=require(_0x92fa('0x0'));module[_0x92fa('0x1')]={'type':{'type':Sequelize[_0x92fa('0x2')](_0x92fa('0x3'),_0x92fa('0x4'),_0x92fa('0x5'),'keyValue'),'defaultValue':_0x92fa('0x3')},'content':{'type':Sequelize[_0x92fa('0x6')]},'key':{'type':Sequelize[_0x92fa('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x92fa('0x3'),_0x92fa('0x4'),_0x92fa('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x92fa('0x6')]},'nameField':{'type':Sequelize[_0x92fa('0x6')]},'customField':{'type':Sequelize[_0x92fa('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x92fa('0x6')]}}; \ No newline at end of file +var _0x7531=['keyValue','string','STRING','variable','customVariable','BOOLEAN','sequelize','exports','ENUM'];(function(_0xf280a2,_0x43f9c2){var _0x4449f8=function(_0x291a5f){while(--_0x291a5f){_0xf280a2['push'](_0xf280a2['shift']());}};_0x4449f8(++_0x43f9c2);}(_0x7531,0x69));var _0x1753=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x7531[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x1753('0x0'));module[_0x1753('0x1')]={'type':{'type':Sequelize[_0x1753('0x2')]('string','variable','customVariable',_0x1753('0x3')),'defaultValue':_0x1753('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1753('0x5')]},'keyType':{'type':Sequelize[_0x1753('0x2')]('string',_0x1753('0x6'),_0x1753('0x7'))},'keyContent':{'type':Sequelize[_0x1753('0x5')]},'idField':{'type':Sequelize[_0x1753('0x5')]},'nameField':{'type':Sequelize[_0x1753('0x5')]},'customField':{'type':Sequelize[_0x1753('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1753('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index adf0c5f..a185d62 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 _0x7622=['then','destroy','sendStatus','error','stack','name','send','index','map','ZohoField','type','key','filters','intersection','query','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','apply','save','update'];(function(_0x28849c,_0xf17ed2){var _0x5444ed=function(_0x278dbc){while(--_0x278dbc){_0x28849c['push'](_0x28849c['shift']());}};_0x5444ed(++_0xf17ed2);}(_0x7622,0x6b));var _0x2762=function(_0x3cabb0,_0x109927){_0x3cabb0=_0x3cabb0-0x0;var _0x2427ce=_0x7622[_0x3cabb0];return _0x2427ce;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2762('0x0'));var zipdir=require(_0x2762('0x1'));var jsonpatch=require(_0x2762('0x2'));var rp=require('request-promise');var moment=require(_0x2762('0x3'));var BPromise=require(_0x2762('0x4'));var Mustache=require(_0x2762('0x5'));var util=require(_0x2762('0x6'));var path=require(_0x2762('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2762('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2762('0x9'));var toCsv=require(_0x2762('0xa'));var querystring=require(_0x2762('0xb'));var Papa=require(_0x2762('0xc'));var Redis=require(_0x2762('0xd'));var authService=require(_0x2762('0xe'));var qs=require(_0x2762('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2762('0x10'))('api');var utils=require(_0x2762('0x11'));var config=require(_0x2762('0x12'));var db=require(_0x2762('0x13'))['db'];function respondWithStatusCode(_0x32db8c,_0x43a436){_0x43a436=_0x43a436||0xcc;return function(_0x27ffd7){if(_0x27ffd7){return _0x32db8c['sendStatus'](_0x43a436);}return _0x32db8c[_0x2762('0x14')](_0x43a436)[_0x2762('0x15')]();};}function respondWithResult(_0xccf511,_0x457dc7){_0x457dc7=_0x457dc7||0xc8;return function(_0x15186c){if(_0x15186c){return _0xccf511[_0x2762('0x14')](_0x457dc7)[_0x2762('0x16')](_0x15186c);}};}function respondWithFilteredResult(_0x142e3f,_0x54f4c8){return function(_0x3d6090){if(_0x3d6090){var _0x269fe8=_0x3d6090['count'],_0x5a0d04=_0x54f4c8[_0x2762('0x17')],_0x3ed4a8=_0x54f4c8[_0x2762('0x17')]+_0x54f4c8[_0x2762('0x18')],_0x2e7cc3;if(_0x3ed4a8>=_0x269fe8){_0x3ed4a8=_0x269fe8;_0x2e7cc3=0xc8;}else{_0x2e7cc3=0xce;}_0x142e3f[_0x2762('0x14')](_0x2e7cc3);return _0x142e3f[_0x2762('0x19')]('Content-Range',_0x5a0d04+'-'+_0x3ed4a8+'/'+_0x269fe8)['json'](_0x3d6090);}return null;};}function patchUpdates(_0x27938f){return function(_0x23c2fc){try{jsonpatch[_0x2762('0x1a')](_0x23c2fc,_0x27938f,!![]);}catch(_0x225cb4){return BPromise['reject'](_0x225cb4);}return _0x23c2fc[_0x2762('0x1b')]();};}function saveUpdates(_0x155b5e,_0x1212ae){return function(_0x5184b2){if(_0x5184b2){return _0x5184b2[_0x2762('0x1c')](_0x155b5e)[_0x2762('0x1d')](function(_0x27ad38){return _0x27ad38;});}return null;};}function removeEntity(_0x42d7f7,_0xaa3c8c){return function(_0x41bcf9){if(_0x41bcf9){return _0x41bcf9[_0x2762('0x1e')]()[_0x2762('0x1d')](function(){_0x42d7f7['status'](0xcc)[_0x2762('0x15')]();});}};}function handleEntityNotFound(_0x59040c,_0x5b126c){return function(_0x9fbfb3){if(!_0x9fbfb3){_0x59040c[_0x2762('0x1f')](0x194);}return _0x9fbfb3;};}function handleError(_0x4cf355,_0x3bad5b){_0x3bad5b=_0x3bad5b||0x1f4;return function(_0x180ac9){logger[_0x2762('0x20')](_0x180ac9[_0x2762('0x21')]);if(_0x180ac9[_0x2762('0x22')]){delete _0x180ac9[_0x2762('0x22')];}_0x4cf355['status'](_0x3bad5b)[_0x2762('0x23')](_0x180ac9);};}exports[_0x2762('0x24')]=function(_0x44218c,_0x5f596b){var _0x4903ef={},_0x407bfd={},_0x1855fe={'count':0x0,'rows':[]};var _0x2052f5=_[_0x2762('0x25')](db[_0x2762('0x26')]['rawAttributes'],function(_0x436b1f){return{'name':_0x436b1f['fieldName'],'type':_0x436b1f[_0x2762('0x27')][_0x2762('0x28')]};});_0x407bfd['model']=_['map'](_0x2052f5,_0x2762('0x22'));_0x407bfd['query']=_['keys'](_0x44218c['query']);_0x407bfd[_0x2762('0x29')]=_[_0x2762('0x2a')](_0x407bfd['model'],_0x407bfd[_0x2762('0x2b')]);_0x4903ef['attributes']=_[_0x2762('0x2a')](_0x407bfd[_0x2762('0x2c')],qs[_0x2762('0x2d')](_0x44218c[_0x2762('0x2b')][_0x2762('0x2d')]));_0x4903ef[_0x2762('0x2e')]=_0x4903ef[_0x2762('0x2e')][_0x2762('0x2f')]?_0x4903ef[_0x2762('0x2e')]:_0x407bfd['model'];if(!_0x44218c[_0x2762('0x2b')][_0x2762('0x30')]('nolimit')){_0x4903ef[_0x2762('0x18')]=qs[_0x2762('0x18')](_0x44218c[_0x2762('0x2b')][_0x2762('0x18')]);_0x4903ef[_0x2762('0x17')]=qs[_0x2762('0x17')](_0x44218c[_0x2762('0x2b')]['offset']);}_0x4903ef[_0x2762('0x31')]=qs[_0x2762('0x32')](_0x44218c[_0x2762('0x2b')][_0x2762('0x32')]);_0x4903ef[_0x2762('0x33')]=qs['filters'](_[_0x2762('0x34')](_0x44218c['query'],_0x407bfd[_0x2762('0x29')]));if(_0x44218c[_0x2762('0x2b')]['filter']){_0x4903ef['where']=_[_0x2762('0x35')](_0x4903ef[_0x2762('0x33')],{'$or':_[_0x2762('0x25')](_0x2052f5,function(_0x5269a1){if(_0x5269a1['type']!=='VIRTUAL'){var _0x2998df={};_0x2998df[_0x5269a1[_0x2762('0x22')]]={'$like':'%'+_0x44218c[_0x2762('0x2b')][_0x2762('0x36')]+'%'};return _0x2998df;}})});}_0x4903ef=_[_0x2762('0x35')]({},_0x4903ef,_0x44218c[_0x2762('0x37')]);var _0x2332c6={'where':_0x4903ef['where']};return db[_0x2762('0x26')][_0x2762('0x38')](_0x2332c6)[_0x2762('0x1d')](function(_0x55821f){_0x1855fe[_0x2762('0x38')]=_0x55821f;if(_0x44218c[_0x2762('0x2b')][_0x2762('0x39')]){_0x4903ef[_0x2762('0x3a')]=[{'all':!![]}];}return db[_0x2762('0x26')][_0x2762('0x3b')](_0x4903ef);})[_0x2762('0x1d')](function(_0x5c0e57){_0x1855fe[_0x2762('0x3c')]=_0x5c0e57;return _0x1855fe;})[_0x2762('0x1d')](respondWithFilteredResult(_0x5f596b,_0x4903ef))[_0x2762('0x3d')](handleError(_0x5f596b,null));};exports[_0x2762('0x3e')]=function(_0x2382c2,_0x54f111){var _0x290cf6={'raw':!![],'where':{'id':_0x2382c2[_0x2762('0x3f')]['id']}},_0x4d1445={};_0x4d1445[_0x2762('0x2c')]=_[_0x2762('0x40')](db['ZohoField']['rawAttributes']);_0x4d1445[_0x2762('0x2b')]=_[_0x2762('0x40')](_0x2382c2[_0x2762('0x2b')]);_0x4d1445['filters']=_['intersection'](_0x4d1445[_0x2762('0x2c')],_0x4d1445['query']);_0x290cf6[_0x2762('0x2e')]=_[_0x2762('0x2a')](_0x4d1445[_0x2762('0x2c')],qs[_0x2762('0x2d')](_0x2382c2[_0x2762('0x2b')][_0x2762('0x2d')]));_0x290cf6['attributes']=_0x290cf6['attributes'][_0x2762('0x2f')]?_0x290cf6[_0x2762('0x2e')]:_0x4d1445[_0x2762('0x2c')];if(_0x2382c2[_0x2762('0x2b')][_0x2762('0x39')]){_0x290cf6[_0x2762('0x3a')]=[{'all':!![]}];}_0x290cf6=_['merge']({},_0x290cf6,_0x2382c2[_0x2762('0x37')]);return db[_0x2762('0x26')][_0x2762('0x41')](_0x290cf6)[_0x2762('0x1d')](handleEntityNotFound(_0x54f111,null))['then'](respondWithResult(_0x54f111,null))[_0x2762('0x3d')](handleError(_0x54f111,null));};exports[_0x2762('0x42')]=function(_0x4cc759,_0xe4562e){return db['ZohoField']['create'](_0x4cc759[_0x2762('0x43')],{})[_0x2762('0x1d')](respondWithResult(_0xe4562e,0xc9))['catch'](handleError(_0xe4562e,null));};exports[_0x2762('0x1c')]=function(_0x154dcd,_0x3fb407){if(_0x154dcd[_0x2762('0x43')]['id']){delete _0x154dcd[_0x2762('0x43')]['id'];}return db[_0x2762('0x26')][_0x2762('0x41')]({'where':{'id':_0x154dcd[_0x2762('0x3f')]['id']}})[_0x2762('0x1d')](handleEntityNotFound(_0x3fb407,null))[_0x2762('0x1d')](saveUpdates(_0x154dcd[_0x2762('0x43')],null))[_0x2762('0x1d')](respondWithResult(_0x3fb407,null))[_0x2762('0x3d')](handleError(_0x3fb407,null));};exports['destroy']=function(_0x16d640,_0x46447a){return db[_0x2762('0x26')][_0x2762('0x41')]({'where':{'id':_0x16d640[_0x2762('0x3f')]['id']}})[_0x2762('0x1d')](handleEntityNotFound(_0x46447a,null))[_0x2762('0x1d')](removeEntity(_0x46447a,null))[_0x2762('0x3d')](handleError(_0x46447a,null));}; \ No newline at end of file +var _0x6f4c=['create','body','catch','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','ZohoField','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','sort','pick','merge','where','type','VIRTUAL','filter','includeAll','include','findAll','rows','show','keys','options'];(function(_0x1c08a2,_0x2f98a3){var _0x2c2e52=function(_0x36d648){while(--_0x36d648){_0x1c08a2['push'](_0x1c08a2['shift']());}};_0x2c2e52(++_0x2f98a3);}(_0x6f4c,0x11d));var _0xc6f4=function(_0x276de3,_0x47f9d3){_0x276de3=_0x276de3-0x0;var _0xcd6f2e=_0x6f4c[_0x276de3];return _0xcd6f2e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc6f4('0x0'));var rimraf=require(_0xc6f4('0x1'));var zipdir=require(_0xc6f4('0x2'));var jsonpatch=require(_0xc6f4('0x3'));var rp=require(_0xc6f4('0x4'));var moment=require('moment');var BPromise=require(_0xc6f4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc6f4('0x6'));var sox=require(_0xc6f4('0x7'));var csv=require(_0xc6f4('0x8'));var ejs=require(_0xc6f4('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc6f4('0xa'));var crypto=require('crypto');var jsforce=require(_0xc6f4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc6f4('0xc'));var authService=require(_0xc6f4('0xd'));var qs=require(_0xc6f4('0xe'));var as=require(_0xc6f4('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc6f4('0x10'))(_0xc6f4('0x11'));var utils=require(_0xc6f4('0x12'));var config=require('../../config/environment');var db=require(_0xc6f4('0x13'))['db'];function respondWithStatusCode(_0xa3371e,_0x5c0acb){_0x5c0acb=_0x5c0acb||0xcc;return function(_0x48eadb){if(_0x48eadb){return _0xa3371e[_0xc6f4('0x14')](_0x5c0acb);}return _0xa3371e[_0xc6f4('0x15')](_0x5c0acb)[_0xc6f4('0x16')]();};}function respondWithResult(_0x5ceb4d,_0x56f3e2){_0x56f3e2=_0x56f3e2||0xc8;return function(_0x4f10c8){if(_0x4f10c8){return _0x5ceb4d[_0xc6f4('0x15')](_0x56f3e2)[_0xc6f4('0x17')](_0x4f10c8);}};}function respondWithFilteredResult(_0x36d696,_0x172822){return function(_0x3904d2){if(_0x3904d2){var _0x20f4db=_0x3904d2[_0xc6f4('0x18')],_0x3a0be3=_0x172822['offset'],_0x57ab1c=_0x172822['offset']+_0x172822[_0xc6f4('0x19')],_0x6124ed;if(_0x57ab1c>=_0x20f4db){_0x57ab1c=_0x20f4db;_0x6124ed=0xc8;}else{_0x6124ed=0xce;}_0x36d696[_0xc6f4('0x15')](_0x6124ed);return _0x36d696[_0xc6f4('0x1a')](_0xc6f4('0x1b'),_0x3a0be3+'-'+_0x57ab1c+'/'+_0x20f4db)[_0xc6f4('0x17')](_0x3904d2);}return null;};}function patchUpdates(_0x1b63c9){return function(_0x21c260){try{jsonpatch[_0xc6f4('0x1c')](_0x21c260,_0x1b63c9,!![]);}catch(_0x232692){return BPromise['reject'](_0x232692);}return _0x21c260[_0xc6f4('0x1d')]();};}function saveUpdates(_0x26d10d,_0x81d54b){return function(_0x52b5fa){if(_0x52b5fa){return _0x52b5fa[_0xc6f4('0x1e')](_0x26d10d)[_0xc6f4('0x1f')](function(_0x48a72c){return _0x48a72c;});}return null;};}function removeEntity(_0x3ee243,_0x411532){return function(_0x107054){if(_0x107054){return _0x107054[_0xc6f4('0x20')]()['then'](function(){_0x3ee243[_0xc6f4('0x15')](0xcc)[_0xc6f4('0x16')]();});}};}function handleEntityNotFound(_0x16bd51,_0x396655){return function(_0x2e3952){if(!_0x2e3952){_0x16bd51[_0xc6f4('0x14')](0x194);}return _0x2e3952;};}function handleError(_0x514536,_0x364002){_0x364002=_0x364002||0x1f4;return function(_0x43476e){logger[_0xc6f4('0x21')](_0x43476e[_0xc6f4('0x22')]);if(_0x43476e['name']){delete _0x43476e[_0xc6f4('0x23')];}_0x514536[_0xc6f4('0x15')](_0x364002)[_0xc6f4('0x24')](_0x43476e);};}exports['index']=function(_0x1eb8a4,_0x38e594){var _0x239c8d={},_0x531658={},_0x578c16={'count':0x0,'rows':[]};var _0x5ae5ff=_[_0xc6f4('0x25')](db[_0xc6f4('0x26')][_0xc6f4('0x27')],function(_0x4ef530){return{'name':_0x4ef530[_0xc6f4('0x28')],'type':_0x4ef530['type'][_0xc6f4('0x29')]};});_0x531658[_0xc6f4('0x2a')]=_['map'](_0x5ae5ff,_0xc6f4('0x23'));_0x531658[_0xc6f4('0x2b')]=_['keys'](_0x1eb8a4['query']);_0x531658[_0xc6f4('0x2c')]=_[_0xc6f4('0x2d')](_0x531658[_0xc6f4('0x2a')],_0x531658[_0xc6f4('0x2b')]);_0x239c8d[_0xc6f4('0x2e')]=_[_0xc6f4('0x2d')](_0x531658[_0xc6f4('0x2a')],qs[_0xc6f4('0x2f')](_0x1eb8a4[_0xc6f4('0x2b')][_0xc6f4('0x2f')]));_0x239c8d[_0xc6f4('0x2e')]=_0x239c8d[_0xc6f4('0x2e')][_0xc6f4('0x30')]?_0x239c8d[_0xc6f4('0x2e')]:_0x531658[_0xc6f4('0x2a')];if(!_0x1eb8a4[_0xc6f4('0x2b')][_0xc6f4('0x31')]('nolimit')){_0x239c8d[_0xc6f4('0x19')]=qs[_0xc6f4('0x19')](_0x1eb8a4['query'][_0xc6f4('0x19')]);_0x239c8d[_0xc6f4('0x32')]=qs[_0xc6f4('0x32')](_0x1eb8a4['query'][_0xc6f4('0x32')]);}_0x239c8d['order']=qs[_0xc6f4('0x33')](_0x1eb8a4[_0xc6f4('0x2b')][_0xc6f4('0x33')]);_0x239c8d['where']=qs[_0xc6f4('0x2c')](_[_0xc6f4('0x34')](_0x1eb8a4[_0xc6f4('0x2b')],_0x531658['filters']));if(_0x1eb8a4[_0xc6f4('0x2b')]['filter']){_0x239c8d['where']=_[_0xc6f4('0x35')](_0x239c8d[_0xc6f4('0x36')],{'$or':_[_0xc6f4('0x25')](_0x5ae5ff,function(_0x4c1022){if(_0x4c1022[_0xc6f4('0x37')]!==_0xc6f4('0x38')){var _0x52de69={};_0x52de69[_0x4c1022['name']]={'$like':'%'+_0x1eb8a4['query'][_0xc6f4('0x39')]+'%'};return _0x52de69;}})});}_0x239c8d=_[_0xc6f4('0x35')]({},_0x239c8d,_0x1eb8a4['options']);var _0xb0fcf6={'where':_0x239c8d[_0xc6f4('0x36')]};return db[_0xc6f4('0x26')][_0xc6f4('0x18')](_0xb0fcf6)[_0xc6f4('0x1f')](function(_0x440478){_0x578c16['count']=_0x440478;if(_0x1eb8a4[_0xc6f4('0x2b')][_0xc6f4('0x3a')]){_0x239c8d[_0xc6f4('0x3b')]=[{'all':!![]}];}return db[_0xc6f4('0x26')][_0xc6f4('0x3c')](_0x239c8d);})[_0xc6f4('0x1f')](function(_0x503fc0){_0x578c16[_0xc6f4('0x3d')]=_0x503fc0;return _0x578c16;})[_0xc6f4('0x1f')](respondWithFilteredResult(_0x38e594,_0x239c8d))['catch'](handleError(_0x38e594,null));};exports[_0xc6f4('0x3e')]=function(_0x2a65f8,_0x5ebc3e){var _0x484fa2={'raw':!![],'where':{'id':_0x2a65f8['params']['id']}},_0x24e241={};_0x24e241[_0xc6f4('0x2a')]=_[_0xc6f4('0x3f')](db[_0xc6f4('0x26')][_0xc6f4('0x27')]);_0x24e241['query']=_['keys'](_0x2a65f8[_0xc6f4('0x2b')]);_0x24e241[_0xc6f4('0x2c')]=_[_0xc6f4('0x2d')](_0x24e241[_0xc6f4('0x2a')],_0x24e241[_0xc6f4('0x2b')]);_0x484fa2[_0xc6f4('0x2e')]=_['intersection'](_0x24e241[_0xc6f4('0x2a')],qs[_0xc6f4('0x2f')](_0x2a65f8['query'][_0xc6f4('0x2f')]));_0x484fa2['attributes']=_0x484fa2[_0xc6f4('0x2e')][_0xc6f4('0x30')]?_0x484fa2['attributes']:_0x24e241[_0xc6f4('0x2a')];if(_0x2a65f8['query']['includeAll']){_0x484fa2[_0xc6f4('0x3b')]=[{'all':!![]}];}_0x484fa2=_[_0xc6f4('0x35')]({},_0x484fa2,_0x2a65f8[_0xc6f4('0x40')]);return db['ZohoField']['find'](_0x484fa2)['then'](handleEntityNotFound(_0x5ebc3e,null))['then'](respondWithResult(_0x5ebc3e,null))['catch'](handleError(_0x5ebc3e,null));};exports[_0xc6f4('0x41')]=function(_0x2955e6,_0x51dee1){return db[_0xc6f4('0x26')][_0xc6f4('0x41')](_0x2955e6[_0xc6f4('0x42')],{})['then'](respondWithResult(_0x51dee1,0xc9))['catch'](handleError(_0x51dee1,null));};exports[_0xc6f4('0x1e')]=function(_0x54ef3e,_0x5d2eb7){if(_0x54ef3e[_0xc6f4('0x42')]['id']){delete _0x54ef3e[_0xc6f4('0x42')]['id'];}return db[_0xc6f4('0x26')]['find']({'where':{'id':_0x54ef3e['params']['id']}})[_0xc6f4('0x1f')](handleEntityNotFound(_0x5d2eb7,null))['then'](saveUpdates(_0x54ef3e[_0xc6f4('0x42')],null))[_0xc6f4('0x1f')](respondWithResult(_0x5d2eb7,null))[_0xc6f4('0x43')](handleError(_0x5d2eb7,null));};exports[_0xc6f4('0x20')]=function(_0x3dca45,_0x15e310){return db[_0xc6f4('0x26')][_0xc6f4('0x44')]({'where':{'id':_0x3dca45[_0xc6f4('0x45')]['id']}})['then'](handleEntityNotFound(_0x15e310,null))[_0xc6f4('0x1f')](removeEntity(_0x15e310,null))[_0xc6f4('0x43')](handleError(_0x15e310,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index b37b76f..0cc5613 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 _0x67ac=['idField','FieldId','lodash','api','moment','bluebird','request-promise','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x67ac,0x1f0));var _0xc67a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x67ac[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc67a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc67a('0x1'));var moment=require(_0xc67a('0x2'));var BPromise=require(_0xc67a('0x3'));var rp=require(_0xc67a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc67a('0x5'));var attributes=require(_0xc67a('0x6'));module[_0xc67a('0x7')]=function(_0x5ca2a5,_0x31a461){return _0x5ca2a5[_0xc67a('0x8')](_0xc67a('0x9'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xc67a('0xa'),'fields':[_0xc67a('0xb'),_0xc67a('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ebe=['rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','idField','FieldId','lodash','util','api','moment','bluebird','path'];(function(_0x4fb9fe,_0xaf3562){var _0x36032d=function(_0x176cc1){while(--_0x176cc1){_0x4fb9fe['push'](_0x4fb9fe['shift']());}};_0x36032d(++_0xaf3562);}(_0x7ebe,0x14a));var _0xe7eb=function(_0x4f7c26,_0x555a7b){_0x4f7c26=_0x4f7c26-0x0;var _0x223aab=_0x7ebe[_0x4f7c26];return _0x223aab;};'use strict';var _=require(_0xe7eb('0x0'));var util=require(_0xe7eb('0x1'));var logger=require('../../config/logger')(_0xe7eb('0x2'));var moment=require(_0xe7eb('0x3'));var BPromise=require(_0xe7eb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe7eb('0x5'));var rimraf=require(_0xe7eb('0x6'));var config=require(_0xe7eb('0x7'));var attributes=require(_0xe7eb('0x8'));module['exports']=function(_0x2c577a,_0x39df10){return _0x2c577a[_0xe7eb('0x9')](_0xe7eb('0xa'),attributes,{'tableName':_0xe7eb('0xb'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0xe7eb('0xc'),_0xe7eb('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 02ed528..c2cdcf4 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 _0xae24=['request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','ZohoField,\x20%s,\x20%s','message','catch','lodash','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','info'];(function(_0x2bee03,_0x5d721a){var _0x5730d0=function(_0x4624ff){while(--_0x4624ff){_0x2bee03['push'](_0x2bee03['shift']());}};_0x5730d0(++_0x5d721a);}(_0xae24,0x182));var _0x4ae2=function(_0x33184a,_0x1acfc3){_0x33184a=_0x33184a-0x0;var _0x3d5e47=_0xae24[_0x33184a];return _0x3d5e47;};'use strict';var _=require(_0x4ae2('0x0'));var util=require('util');var moment=require(_0x4ae2('0x1'));var BPromise=require('bluebird');var rs=require(_0x4ae2('0x2'));var fs=require('fs');var Redis=require(_0x4ae2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ae2('0x4'))('rpc');var config=require(_0x4ae2('0x5'));var jayson=require(_0x4ae2('0x6'));var client=jayson[_0x4ae2('0x7')][_0x4ae2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x428054,_0x307247,_0x4f2e84){return new BPromise(function(_0x5f589a,_0x41cdf1){return client['request'](_0x428054,_0x4f2e84)['then'](function(_0xb5587a){logger[_0x4ae2('0x9')]('ZohoField,\x20%s,\x20%s',_0x307247,_0x4ae2('0xa'));logger[_0x4ae2('0xb')](_0x4ae2('0xc'),_0x307247,_0x4ae2('0xa'),JSON['stringify'](_0xb5587a));if(_0xb5587a[_0x4ae2('0xd')]){if(_0xb5587a[_0x4ae2('0xd')][_0x4ae2('0xe')]===0x1f4){logger['error'](_0x4ae2('0xf'),_0x307247,_0xb5587a[_0x4ae2('0xd')][_0x4ae2('0x10')]);return _0x41cdf1(_0xb5587a[_0x4ae2('0xd')][_0x4ae2('0x10')]);}logger[_0x4ae2('0xd')](_0x4ae2('0xf'),_0x307247,_0xb5587a[_0x4ae2('0xd')][_0x4ae2('0x10')]);return _0x5f589a(_0xb5587a['error']['message']);}else{logger['info'](_0x4ae2('0xf'),_0x307247,_0x4ae2('0xa'));_0x5f589a(_0xb5587a['result'][_0x4ae2('0x10')]);}})[_0x4ae2('0x11')](function(_0x1fde63){logger[_0x4ae2('0xd')](_0x4ae2('0xf'),_0x307247,_0x1fde63);_0x41cdf1(_0x1fde63);});});} \ No newline at end of file +var _0x7bae=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7bae,0x13b));var _0xe7ba=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x7bae[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7ba('0x0'));var BPromise=require(_0xe7ba('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7ba('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7ba('0x3'));var logger=require(_0xe7ba('0x4'))(_0xe7ba('0x5'));var config=require(_0xe7ba('0x6'));var jayson=require(_0xe7ba('0x7'));var client=jayson[_0xe7ba('0x8')][_0xe7ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5e59,_0x10b307,_0x34fb18){return new BPromise(function(_0x160565,_0x27b1d5){return client[_0xe7ba('0xa')](_0x3c5e59,_0x34fb18)[_0xe7ba('0xb')](function(_0x588f08){logger[_0xe7ba('0xc')](_0xe7ba('0xd'),_0x10b307,_0xe7ba('0xe'));logger[_0xe7ba('0xf')](_0xe7ba('0x10'),_0x10b307,_0xe7ba('0xe'),JSON[_0xe7ba('0x11')](_0x588f08));if(_0x588f08[_0xe7ba('0x12')]){if(_0x588f08[_0xe7ba('0x12')]['code']===0x1f4){logger[_0xe7ba('0x12')]('ZohoField,\x20%s,\x20%s',_0x10b307,_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);return _0x27b1d5(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}logger[_0xe7ba('0x12')](_0xe7ba('0xd'),_0x10b307,_0x588f08['error']['message']);return _0x160565(_0x588f08[_0xe7ba('0x12')][_0xe7ba('0x13')]);}else{logger[_0xe7ba('0xc')]('ZohoField,\x20%s,\x20%s',_0x10b307,_0xe7ba('0xe'));_0x160565(_0x588f08['result']['message']);}})['catch'](function(_0x393f75){logger['error'](_0xe7ba('0xd'),_0x10b307,_0x393f75);_0x27b1d5(_0x393f75);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 5544115..c0e8c9a 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 _0xee5e=['express','../../components/auth/service','../../config/environment','multer','util','path','connect-timeout'];(function(_0x3f1cdc,_0x44e761){var _0x2d4c1c=function(_0x1887fa){while(--_0x1887fa){_0x3f1cdc['push'](_0x3f1cdc['shift']());}};_0x2d4c1c(++_0x44e761);}(_0xee5e,0x1c3));var _0xeee5=function(_0x14f235,_0x5ed97f){_0x14f235=_0x14f235-0x0;var _0xb6b9e1=_0xee5e[_0x14f235];return _0xb6b9e1;};'use strict';var multer=require(_0xeee5('0x0'));var util=require(_0xeee5('0x1'));var path=require(_0xeee5('0x2'));var timeout=require(_0xeee5('0x3'));var express=require(_0xeee5('0x4'));var router=express['Router']();var auth=require(_0xeee5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xeee5('0x6'));module['exports']=router; \ No newline at end of file +var _0xad1a=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express'];(function(_0x3f52ee,_0x468aab){var _0x4f7924=function(_0x405846){while(--_0x405846){_0x3f52ee['push'](_0x3f52ee['shift']());}};_0x4f7924(++_0x468aab);}(_0xad1a,0xff));var _0xaad1=function(_0x126f45,_0x744602){_0x126f45=_0x126f45-0x0;var _0x57407d=_0xad1a[_0x126f45];return _0x57407d;};'use strict';var multer=require(_0xaad1('0x0'));var util=require(_0xaad1('0x1'));var path=require(_0xaad1('0x2'));var timeout=require(_0xaad1('0x3'));var express=require(_0xaad1('0x4'));var router=express[_0xaad1('0x5')]();var auth=require(_0xaad1('0x6'));var interaction=require(_0xaad1('0x7'));var config=require(_0xaad1('0x8'));module[_0xaad1('0x9')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 4ed06d1..abdc167 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 _0xd638=['unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize','STRING'];(function(_0x45ceb0,_0x58cb7b){var _0x3d1b1d=function(_0x449462){while(--_0x449462){_0x45ceb0['push'](_0x45ceb0['shift']());}};_0x3d1b1d(++_0x58cb7b);}(_0xd638,0x7c));var _0x8d63=function(_0x1da778,_0x39d34c){_0x1da778=_0x1da778-0x0;var _0x87ed15=_0xd638[_0x1da778];return _0x87ed15;};'use strict';var Sequelize=require(_0x8d63('0x0'));module['exports']={'name':{'type':Sequelize[_0x8d63('0x1')],'allowNull':![],'unique':_0x8d63('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8d63('0x2')},'main':{'type':Sequelize[_0x8d63('0x1')],'defaultValue':_0x8d63('0x3')},'filename':{'type':Sequelize[_0x8d63('0x1')]},'path':{'type':Sequelize[_0x8d63('0x1')]},'type':{'type':Sequelize[_0x8d63('0x1')]},'size':{'type':Sequelize[_0x8d63('0x4')]},'active':{'type':Sequelize[_0x8d63('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x8d63('0x1')]},'logo':{'type':Sequelize[_0x8d63('0x1')]},'state':{'type':Sequelize[_0x8d63('0x1')],'unique':_0x8d63('0x6')},'description':{'type':Sequelize[_0x8d63('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8d63('0x1')]},'link':{'type':Sequelize[_0x8d63('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x12bb=['state','sequelize','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x3e1c88,_0x53d0f0){var _0x17ac80=function(_0x234374){while(--_0x234374){_0x3e1c88['push'](_0x3e1c88['shift']());}};_0x17ac80(++_0x53d0f0);}(_0x12bb,0x67));var _0xb12b=function(_0x14ee9f,_0x57a942){_0x14ee9f=_0x14ee9f-0x0;var _0x5db2ee=_0x12bb[_0x14ee9f];return _0x5db2ee;};'use strict';var Sequelize=require(_0xb12b('0x0'));module['exports']={'name':{'type':Sequelize[_0xb12b('0x1')],'allowNull':![],'unique':_0xb12b('0x2')},'version':{'type':Sequelize[_0xb12b('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xb12b('0x1')],'defaultValue':_0xb12b('0x3')},'filename':{'type':Sequelize[_0xb12b('0x1')]},'path':{'type':Sequelize[_0xb12b('0x1')]},'type':{'type':Sequelize[_0xb12b('0x1')]},'size':{'type':Sequelize[_0xb12b('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xb12b('0x1')]},'logo':{'type':Sequelize[_0xb12b('0x1')]},'state':{'type':Sequelize[_0xb12b('0x1')],'unique':_0xb12b('0x5')},'description':{'type':Sequelize[_0xb12b('0x1')]},'title':{'type':Sequelize[_0xb12b('0x1')]},'remoteUri':{'type':Sequelize[_0xb12b('0x1')]},'link':{'type':Sequelize[_0xb12b('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 003499b..537c54b 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 _0xf250=['body','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','index','Integration','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','findAll','rows','catch','show','params','includeAll','include','find','create'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf250,0x1c9));var _0x0f25=function(_0x4d584f,_0x385fcd){_0x4d584f=_0x4d584f-0x0;var _0x383793=_0xf250[_0x4d584f];return _0x383793;};'use strict';var pdf=require(_0x0f25('0x0'));var emlformat=require(_0x0f25('0x1'));var rimraf=require(_0x0f25('0x2'));var zipdir=require(_0x0f25('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f25('0x4'));var moment=require('moment');var BPromise=require(_0x0f25('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0f25('0x6'));var sox=require(_0x0f25('0x7'));var csv=require(_0x0f25('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0f25('0x9'));var squel=require(_0x0f25('0xa'));var crypto=require(_0x0f25('0xb'));var jsforce=require(_0x0f25('0xc'));var deskjs=require(_0x0f25('0xd'));var toCsv=require(_0x0f25('0x8'));var querystring=require(_0x0f25('0xe'));var Papa=require('papaparse');var Redis=require(_0x0f25('0xf'));var authService=require(_0x0f25('0x10'));var qs=require(_0x0f25('0x11'));var as=require(_0x0f25('0x12'));var hardwareService=require(_0x0f25('0x13'));var logger=require(_0x0f25('0x14'))(_0x0f25('0x15'));var utils=require(_0x0f25('0x16'));var config=require(_0x0f25('0x17'));var db=require(_0x0f25('0x18'))['db'];function respondWithStatusCode(_0x34ff61,_0x24b3ba){_0x24b3ba=_0x24b3ba||0xcc;return function(_0x15e4fa){if(_0x15e4fa){return _0x34ff61[_0x0f25('0x19')](_0x24b3ba);}return _0x34ff61[_0x0f25('0x1a')](_0x24b3ba)[_0x0f25('0x1b')]();};}function respondWithResult(_0x31a84a,_0x25c2b9){_0x25c2b9=_0x25c2b9||0xc8;return function(_0x478200){if(_0x478200){return _0x31a84a[_0x0f25('0x1a')](_0x25c2b9)[_0x0f25('0x1c')](_0x478200);}};}function respondWithFilteredResult(_0x2a3974,_0x494c62){return function(_0x45a258){if(_0x45a258){var _0x241e20=_0x45a258['count'],_0x5f05c0=_0x494c62[_0x0f25('0x1d')],_0x3c65ea=_0x494c62['offset']+_0x494c62[_0x0f25('0x1e')],_0x33a0eb;if(_0x3c65ea>=_0x241e20){_0x3c65ea=_0x241e20;_0x33a0eb=0xc8;}else{_0x33a0eb=0xce;}_0x2a3974[_0x0f25('0x1a')](_0x33a0eb);return _0x2a3974[_0x0f25('0x1f')]('Content-Range',_0x5f05c0+'-'+_0x3c65ea+'/'+_0x241e20)['json'](_0x45a258);}return null;};}function patchUpdates(_0x2b3329){return function(_0x418415){try{jsonpatch[_0x0f25('0x20')](_0x418415,_0x2b3329,!![]);}catch(_0x585ccc){return BPromise[_0x0f25('0x21')](_0x585ccc);}return _0x418415[_0x0f25('0x22')]();};}function saveUpdates(_0x2c1c42,_0x335572){return function(_0x4d99fa){if(_0x4d99fa){return _0x4d99fa[_0x0f25('0x23')](_0x2c1c42)[_0x0f25('0x24')](function(_0x5b314b){return _0x5b314b;});}return null;};}function removeEntity(_0x1467c3,_0x55ea30){return function(_0x533cef){if(_0x533cef){return _0x533cef[_0x0f25('0x25')]()[_0x0f25('0x24')](function(){_0x1467c3[_0x0f25('0x1a')](0xcc)[_0x0f25('0x1b')]();});}};}function handleEntityNotFound(_0x50de0b,_0x20e749){return function(_0x5c36ab){if(!_0x5c36ab){_0x50de0b[_0x0f25('0x19')](0x194);}return _0x5c36ab;};}function handleError(_0x16571d,_0x2f6034){_0x2f6034=_0x2f6034||0x1f4;return function(_0x270d41){logger[_0x0f25('0x26')](_0x270d41['stack']);if(_0x270d41[_0x0f25('0x27')]){delete _0x270d41['name'];}_0x16571d['status'](_0x2f6034)[_0x0f25('0x28')](_0x270d41);};}exports[_0x0f25('0x29')]=function(_0x4adff0,_0x46da49){var _0x54f574={},_0x55183e={},_0x175686={'count':0x0,'rows':[]};var _0xfdaa4e=_['map'](db[_0x0f25('0x2a')][_0x0f25('0x2b')],function(_0x3b3f9d){return{'name':_0x3b3f9d[_0x0f25('0x2c')],'type':_0x3b3f9d[_0x0f25('0x2d')]['key']};});_0x55183e[_0x0f25('0x2e')]=_[_0x0f25('0x2f')](_0xfdaa4e,'name');_0x55183e[_0x0f25('0x30')]=_[_0x0f25('0x31')](_0x4adff0[_0x0f25('0x30')]);_0x55183e[_0x0f25('0x32')]=_[_0x0f25('0x33')](_0x55183e[_0x0f25('0x2e')],_0x55183e[_0x0f25('0x30')]);_0x54f574[_0x0f25('0x34')]=_[_0x0f25('0x33')](_0x55183e[_0x0f25('0x2e')],qs[_0x0f25('0x35')](_0x4adff0[_0x0f25('0x30')][_0x0f25('0x35')]));_0x54f574[_0x0f25('0x34')]=_0x54f574[_0x0f25('0x34')][_0x0f25('0x36')]?_0x54f574['attributes']:_0x55183e[_0x0f25('0x2e')];if(!_0x4adff0[_0x0f25('0x30')][_0x0f25('0x37')](_0x0f25('0x38'))){_0x54f574[_0x0f25('0x1e')]=qs['limit'](_0x4adff0[_0x0f25('0x30')][_0x0f25('0x1e')]);_0x54f574['offset']=qs['offset'](_0x4adff0[_0x0f25('0x30')][_0x0f25('0x1d')]);}_0x54f574[_0x0f25('0x39')]=qs[_0x0f25('0x3a')](_0x4adff0[_0x0f25('0x30')]['sort']);_0x54f574[_0x0f25('0x3b')]=qs[_0x0f25('0x32')](_[_0x0f25('0x3c')](_0x4adff0['query'],_0x55183e[_0x0f25('0x32')]));if(_0x4adff0[_0x0f25('0x30')][_0x0f25('0x3d')]){_0x54f574[_0x0f25('0x3b')]=_[_0x0f25('0x3e')](_0x54f574[_0x0f25('0x3b')],{'$or':_[_0x0f25('0x2f')](_0xfdaa4e,function(_0x42171a){if(_0x42171a[_0x0f25('0x2d')]!==_0x0f25('0x3f')){var _0x2e8674={};_0x2e8674[_0x42171a[_0x0f25('0x27')]]={'$like':'%'+_0x4adff0['query'][_0x0f25('0x3d')]+'%'};return _0x2e8674;}})});}_0x54f574=_['merge']({},_0x54f574,_0x4adff0[_0x0f25('0x40')]);var _0x4f1cab={'where':_0x54f574[_0x0f25('0x3b')]};return db[_0x0f25('0x2a')][_0x0f25('0x41')](_0x4f1cab)[_0x0f25('0x24')](function(_0x54d8a7){_0x175686[_0x0f25('0x41')]=_0x54d8a7;if(_0x4adff0[_0x0f25('0x30')]['includeAll']){_0x54f574['include']=[{'all':!![]}];}return db[_0x0f25('0x2a')][_0x0f25('0x42')](_0x54f574);})[_0x0f25('0x24')](function(_0x556738){_0x175686[_0x0f25('0x43')]=_0x556738;return _0x175686;})[_0x0f25('0x24')](respondWithFilteredResult(_0x46da49,_0x54f574))[_0x0f25('0x44')](handleError(_0x46da49,null));};exports[_0x0f25('0x45')]=function(_0x28af4d,_0x2c271f){var _0x54f4c1={'raw':![],'where':{'id':_0x28af4d[_0x0f25('0x46')]['id']}},_0x285ca1={};_0x285ca1[_0x0f25('0x2e')]=_[_0x0f25('0x31')](db[_0x0f25('0x2a')][_0x0f25('0x2b')]);_0x285ca1[_0x0f25('0x30')]=_[_0x0f25('0x31')](_0x28af4d[_0x0f25('0x30')]);_0x285ca1[_0x0f25('0x32')]=_[_0x0f25('0x33')](_0x285ca1['model'],_0x285ca1[_0x0f25('0x30')]);_0x54f4c1[_0x0f25('0x34')]=_[_0x0f25('0x33')](_0x285ca1[_0x0f25('0x2e')],qs[_0x0f25('0x35')](_0x28af4d[_0x0f25('0x30')]['fields']));_0x54f4c1[_0x0f25('0x34')]=_0x54f4c1[_0x0f25('0x34')][_0x0f25('0x36')]?_0x54f4c1['attributes']:_0x285ca1['model'];if(_0x28af4d['query'][_0x0f25('0x47')]){_0x54f4c1[_0x0f25('0x48')]=[{'all':!![]}];}_0x54f4c1=_['merge']({},_0x54f4c1,_0x28af4d[_0x0f25('0x40')]);return db['Integration'][_0x0f25('0x49')](_0x54f4c1)['then'](handleEntityNotFound(_0x2c271f,null))[_0x0f25('0x24')](respondWithResult(_0x2c271f,null))[_0x0f25('0x44')](handleError(_0x2c271f,null));};exports[_0x0f25('0x4a')]=function(_0x22e6b1,_0x33d66e){return db['Integration'][_0x0f25('0x4a')](_0x22e6b1[_0x0f25('0x4b')],{})[_0x0f25('0x24')](respondWithResult(_0x33d66e,0xc9))['catch'](handleError(_0x33d66e,null));};exports[_0x0f25('0x23')]=function(_0x3aa75a,_0xe1f9bb){if(_0x3aa75a[_0x0f25('0x4b')]['id']){delete _0x3aa75a[_0x0f25('0x4b')]['id'];}return db[_0x0f25('0x2a')][_0x0f25('0x49')]({'where':{'id':_0x3aa75a[_0x0f25('0x46')]['id']}})[_0x0f25('0x24')](handleEntityNotFound(_0xe1f9bb,null))['then'](saveUpdates(_0x3aa75a[_0x0f25('0x4b')],null))['then'](respondWithResult(_0xe1f9bb,null))['catch'](handleError(_0xe1f9bb,null));};exports['destroy']=function(_0x532163,_0xf9fbcd){return db[_0x0f25('0x2a')][_0x0f25('0x49')]({'where':{'id':_0x532163[_0x0f25('0x46')]['id']}})[_0x0f25('0x24')](handleEntityNotFound(_0xf9fbcd,null))[_0x0f25('0x24')](removeEntity(_0xf9fbcd,null))['catch'](handleError(_0xf9fbcd,null));}; \ No newline at end of file +var _0xc0b9=['show','params','includeAll','find','create','body','update','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','save','then','error','stack','name','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','catch'];(function(_0x1a68dd,_0x3afd57){var _0x3e65a2=function(_0x4a6643){while(--_0x4a6643){_0x1a68dd['push'](_0x1a68dd['shift']());}};_0x3e65a2(++_0x3afd57);}(_0xc0b9,0x1e4));var _0x9c0b=function(_0x2b4554,_0x1aee0e){_0x2b4554=_0x2b4554-0x0;var _0x2d015a=_0xc0b9[_0x2b4554];return _0x2d015a;};'use strict';var pdf=require(_0x9c0b('0x0'));var emlformat=require(_0x9c0b('0x1'));var rimraf=require(_0x9c0b('0x2'));var zipdir=require(_0x9c0b('0x3'));var jsonpatch=require(_0x9c0b('0x4'));var rp=require(_0x9c0b('0x5'));var moment=require('moment');var BPromise=require(_0x9c0b('0x6'));var Mustache=require('mustache');var util=require(_0x9c0b('0x7'));var path=require(_0x9c0b('0x8'));var sox=require('sox');var csv=require(_0x9c0b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9c0b('0xa'));var squel=require(_0x9c0b('0xb'));var crypto=require(_0x9c0b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9c0b('0xd'));var toCsv=require(_0x9c0b('0x9'));var querystring=require(_0x9c0b('0xe'));var Papa=require(_0x9c0b('0xf'));var Redis=require(_0x9c0b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9c0b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c0b('0x12'))(_0x9c0b('0x13'));var utils=require(_0x9c0b('0x14'));var config=require(_0x9c0b('0x15'));var db=require(_0x9c0b('0x16'))['db'];function respondWithStatusCode(_0x1dfaf4,_0x567e9f){_0x567e9f=_0x567e9f||0xcc;return function(_0x47851a){if(_0x47851a){return _0x1dfaf4[_0x9c0b('0x17')](_0x567e9f);}return _0x1dfaf4[_0x9c0b('0x18')](_0x567e9f)[_0x9c0b('0x19')]();};}function respondWithResult(_0xbe1344,_0x57daeb){_0x57daeb=_0x57daeb||0xc8;return function(_0x25d628){if(_0x25d628){return _0xbe1344[_0x9c0b('0x18')](_0x57daeb)['json'](_0x25d628);}};}function respondWithFilteredResult(_0x28ef4f,_0x1358ab){return function(_0x4b3c41){if(_0x4b3c41){var _0x1139f2=_0x4b3c41[_0x9c0b('0x1a')],_0x1f9bc4=_0x1358ab['offset'],_0x48aa8a=_0x1358ab[_0x9c0b('0x1b')]+_0x1358ab[_0x9c0b('0x1c')],_0x4f2ec6;if(_0x48aa8a>=_0x1139f2){_0x48aa8a=_0x1139f2;_0x4f2ec6=0xc8;}else{_0x4f2ec6=0xce;}_0x28ef4f[_0x9c0b('0x18')](_0x4f2ec6);return _0x28ef4f['set'](_0x9c0b('0x1d'),_0x1f9bc4+'-'+_0x48aa8a+'/'+_0x1139f2)[_0x9c0b('0x1e')](_0x4b3c41);}return null;};}function patchUpdates(_0x45411a){return function(_0x15af1e){try{jsonpatch['apply'](_0x15af1e,_0x45411a,!![]);}catch(_0x4400ad){return BPromise['reject'](_0x4400ad);}return _0x15af1e[_0x9c0b('0x1f')]();};}function saveUpdates(_0x3bf879,_0x22e934){return function(_0x1238fa){if(_0x1238fa){return _0x1238fa['update'](_0x3bf879)[_0x9c0b('0x20')](function(_0x5afb9f){return _0x5afb9f;});}return null;};}function removeEntity(_0x26d54c,_0x3098ae){return function(_0x46ed2d){if(_0x46ed2d){return _0x46ed2d['destroy']()[_0x9c0b('0x20')](function(){_0x26d54c[_0x9c0b('0x18')](0xcc)[_0x9c0b('0x19')]();});}};}function handleEntityNotFound(_0x5d143d,_0x89f491){return function(_0x2badc0){if(!_0x2badc0){_0x5d143d[_0x9c0b('0x17')](0x194);}return _0x2badc0;};}function handleError(_0x1396e8,_0x14b68a){_0x14b68a=_0x14b68a||0x1f4;return function(_0x3b3b8f){logger[_0x9c0b('0x21')](_0x3b3b8f[_0x9c0b('0x22')]);if(_0x3b3b8f[_0x9c0b('0x23')]){delete _0x3b3b8f[_0x9c0b('0x23')];}_0x1396e8['status'](_0x14b68a)['send'](_0x3b3b8f);};}exports['index']=function(_0x35fbcd,_0x8cfd7a){var _0x3bd53d={},_0x115877={},_0x3ca1d6={'count':0x0,'rows':[]};var _0x1401ce=_[_0x9c0b('0x24')](db[_0x9c0b('0x25')][_0x9c0b('0x26')],function(_0x4fa6a3){return{'name':_0x4fa6a3[_0x9c0b('0x27')],'type':_0x4fa6a3[_0x9c0b('0x28')][_0x9c0b('0x29')]};});_0x115877[_0x9c0b('0x2a')]=_[_0x9c0b('0x24')](_0x1401ce,_0x9c0b('0x23'));_0x115877[_0x9c0b('0x2b')]=_[_0x9c0b('0x2c')](_0x35fbcd[_0x9c0b('0x2b')]);_0x115877[_0x9c0b('0x2d')]=_['intersection'](_0x115877[_0x9c0b('0x2a')],_0x115877[_0x9c0b('0x2b')]);_0x3bd53d[_0x9c0b('0x2e')]=_[_0x9c0b('0x2f')](_0x115877[_0x9c0b('0x2a')],qs['fields'](_0x35fbcd[_0x9c0b('0x2b')][_0x9c0b('0x30')]));_0x3bd53d['attributes']=_0x3bd53d[_0x9c0b('0x2e')][_0x9c0b('0x31')]?_0x3bd53d[_0x9c0b('0x2e')]:_0x115877[_0x9c0b('0x2a')];if(!_0x35fbcd[_0x9c0b('0x2b')][_0x9c0b('0x32')](_0x9c0b('0x33'))){_0x3bd53d['limit']=qs[_0x9c0b('0x1c')](_0x35fbcd['query'][_0x9c0b('0x1c')]);_0x3bd53d['offset']=qs[_0x9c0b('0x1b')](_0x35fbcd[_0x9c0b('0x2b')][_0x9c0b('0x1b')]);}_0x3bd53d['order']=qs[_0x9c0b('0x34')](_0x35fbcd['query']['sort']);_0x3bd53d[_0x9c0b('0x35')]=qs[_0x9c0b('0x2d')](_['pick'](_0x35fbcd[_0x9c0b('0x2b')],_0x115877['filters']));if(_0x35fbcd[_0x9c0b('0x2b')][_0x9c0b('0x36')]){_0x3bd53d[_0x9c0b('0x35')]=_[_0x9c0b('0x37')](_0x3bd53d[_0x9c0b('0x35')],{'$or':_[_0x9c0b('0x24')](_0x1401ce,function(_0x389557){if(_0x389557[_0x9c0b('0x28')]!==_0x9c0b('0x38')){var _0x120a26={};_0x120a26[_0x389557[_0x9c0b('0x23')]]={'$like':'%'+_0x35fbcd[_0x9c0b('0x2b')][_0x9c0b('0x36')]+'%'};return _0x120a26;}})});}_0x3bd53d=_[_0x9c0b('0x37')]({},_0x3bd53d,_0x35fbcd[_0x9c0b('0x39')]);var _0xad9a9e={'where':_0x3bd53d[_0x9c0b('0x35')]};return db[_0x9c0b('0x25')][_0x9c0b('0x1a')](_0xad9a9e)[_0x9c0b('0x20')](function(_0x3256ae){_0x3ca1d6[_0x9c0b('0x1a')]=_0x3256ae;if(_0x35fbcd[_0x9c0b('0x2b')]['includeAll']){_0x3bd53d[_0x9c0b('0x3a')]=[{'all':!![]}];}return db[_0x9c0b('0x25')]['findAll'](_0x3bd53d);})[_0x9c0b('0x20')](function(_0xf7ba2f){_0x3ca1d6['rows']=_0xf7ba2f;return _0x3ca1d6;})[_0x9c0b('0x20')](respondWithFilteredResult(_0x8cfd7a,_0x3bd53d))[_0x9c0b('0x3b')](handleError(_0x8cfd7a,null));};exports[_0x9c0b('0x3c')]=function(_0x3b282d,_0x2a2410){var _0x40e73f={'raw':![],'where':{'id':_0x3b282d[_0x9c0b('0x3d')]['id']}},_0x3b6ab4={};_0x3b6ab4[_0x9c0b('0x2a')]=_['keys'](db[_0x9c0b('0x25')]['rawAttributes']);_0x3b6ab4[_0x9c0b('0x2b')]=_[_0x9c0b('0x2c')](_0x3b282d[_0x9c0b('0x2b')]);_0x3b6ab4[_0x9c0b('0x2d')]=_[_0x9c0b('0x2f')](_0x3b6ab4[_0x9c0b('0x2a')],_0x3b6ab4[_0x9c0b('0x2b')]);_0x40e73f['attributes']=_[_0x9c0b('0x2f')](_0x3b6ab4[_0x9c0b('0x2a')],qs[_0x9c0b('0x30')](_0x3b282d[_0x9c0b('0x2b')][_0x9c0b('0x30')]));_0x40e73f[_0x9c0b('0x2e')]=_0x40e73f[_0x9c0b('0x2e')][_0x9c0b('0x31')]?_0x40e73f[_0x9c0b('0x2e')]:_0x3b6ab4[_0x9c0b('0x2a')];if(_0x3b282d['query'][_0x9c0b('0x3e')]){_0x40e73f['include']=[{'all':!![]}];}_0x40e73f=_[_0x9c0b('0x37')]({},_0x40e73f,_0x3b282d[_0x9c0b('0x39')]);return db['Integration'][_0x9c0b('0x3f')](_0x40e73f)[_0x9c0b('0x20')](handleEntityNotFound(_0x2a2410,null))[_0x9c0b('0x20')](respondWithResult(_0x2a2410,null))['catch'](handleError(_0x2a2410,null));};exports[_0x9c0b('0x40')]=function(_0x31d601,_0x41bfc3){return db[_0x9c0b('0x25')][_0x9c0b('0x40')](_0x31d601[_0x9c0b('0x41')],{})['then'](respondWithResult(_0x41bfc3,0xc9))[_0x9c0b('0x3b')](handleError(_0x41bfc3,null));};exports[_0x9c0b('0x42')]=function(_0x494a5e,_0x5bb715){if(_0x494a5e[_0x9c0b('0x41')]['id']){delete _0x494a5e[_0x9c0b('0x41')]['id'];}return db[_0x9c0b('0x25')][_0x9c0b('0x3f')]({'where':{'id':_0x494a5e[_0x9c0b('0x3d')]['id']}})[_0x9c0b('0x20')](handleEntityNotFound(_0x5bb715,null))[_0x9c0b('0x20')](saveUpdates(_0x494a5e['body'],null))[_0x9c0b('0x20')](respondWithResult(_0x5bb715,null))[_0x9c0b('0x3b')](handleError(_0x5bb715,null));};exports[_0x9c0b('0x43')]=function(_0x4b06cb,_0x3c9e66){return db[_0x9c0b('0x25')][_0x9c0b('0x3f')]({'where':{'id':_0x4b06cb[_0x9c0b('0x3d')]['id']}})[_0x9c0b('0x20')](handleEntityNotFound(_0x3c9e66,null))[_0x9c0b('0x20')](removeEntity(_0x3c9e66,null))[_0x9c0b('0x3b')](handleError(_0x3c9e66,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 19eac08..b7364dd 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 _0x65c1=['../../config/logger','api','moment','request-promise','path','../../config/environment','./integration.attributes','exports','define','Integration','lodash'];(function(_0x572165,_0x6a45cc){var _0x8c8709=function(_0x43faab){while(--_0x43faab){_0x572165['push'](_0x572165['shift']());}};_0x8c8709(++_0x6a45cc);}(_0x65c1,0x1cd));var _0x165c=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x65c1[_0x1a9204];return _0x17ca68;};'use strict';var _=require(_0x165c('0x0'));var util=require('util');var logger=require(_0x165c('0x1'))(_0x165c('0x2'));var moment=require(_0x165c('0x3'));var BPromise=require('bluebird');var rp=require(_0x165c('0x4'));var fs=require('fs');var path=require(_0x165c('0x5'));var rimraf=require('rimraf');var config=require(_0x165c('0x6'));var attributes=require(_0x165c('0x7'));module[_0x165c('0x8')]=function(_0xc21d29,_0x230005){return _0xc21d29[_0x165c('0x9')](_0x165c('0xa'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda8a=['Integration','integrations','../../config/logger','api','bluebird','path','../../config/environment','exports','define'];(function(_0x34b5ca,_0x594010){var _0x2d72c0=function(_0x4ae1d3){while(--_0x4ae1d3){_0x34b5ca['push'](_0x34b5ca['shift']());}};_0x2d72c0(++_0x594010);}(_0xda8a,0xd1));var _0xada8=function(_0x148a0b,_0x4a9838){_0x148a0b=_0x148a0b-0x0;var _0x5c0653=_0xda8a[_0x148a0b];return _0x5c0653;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xada8('0x0'))(_0xada8('0x1'));var moment=require('moment');var BPromise=require(_0xada8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xada8('0x3'));var rimraf=require('rimraf');var config=require(_0xada8('0x4'));var attributes=require('./integration.attributes');module[_0xada8('0x5')]=function(_0x22a1b7,_0x26200b){return _0x22a1b7[_0xada8('0x6')](_0xada8('0x7'),attributes,{'tableName':_0xada8('0x8'),'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 4f64e7c..e1669d7 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 _0xafca=['http','request','then','info','Integration,\x20%s,\x20%s','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0xfe5a2a,_0x290a8d){var _0x23e5c4=function(_0x1f65ea){while(--_0x1f65ea){_0xfe5a2a['push'](_0xfe5a2a['shift']());}};_0x23e5c4(++_0x290a8d);}(_0xafca,0x1ef));var _0xaafc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xafca[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xaafc('0x0'));var util=require('util');var moment=require(_0xaafc('0x1'));var BPromise=require(_0xaafc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaafc('0x3'))['db'];var utils=require(_0xaafc('0x4'));var logger=require(_0xaafc('0x5'))(_0xaafc('0x6'));var config=require(_0xaafc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xaafc('0x8')][_0xaafc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x978cf0,_0x29d3ec,_0x83ea82){return new BPromise(function(_0x2cf865,_0xd953fb){return client[_0xaafc('0xa')](_0x978cf0,_0x83ea82)[_0xaafc('0xb')](function(_0x318181){logger[_0xaafc('0xc')](_0xaafc('0xd'),_0x29d3ec,'request\x20sent');logger['debug'](_0xaafc('0xe'),_0x29d3ec,'request\x20sent',JSON[_0xaafc('0xf')](_0x318181));if(_0x318181['error']){if(_0x318181[_0xaafc('0x10')]['code']===0x1f4){logger[_0xaafc('0x10')](_0xaafc('0xd'),_0x29d3ec,_0x318181[_0xaafc('0x10')][_0xaafc('0x11')]);return _0xd953fb(_0x318181[_0xaafc('0x10')][_0xaafc('0x11')]);}logger[_0xaafc('0x10')](_0xaafc('0xd'),_0x29d3ec,_0x318181[_0xaafc('0x10')][_0xaafc('0x11')]);return _0x2cf865(_0x318181[_0xaafc('0x10')]['message']);}else{logger[_0xaafc('0xc')](_0xaafc('0xd'),_0x29d3ec,_0xaafc('0x12'));_0x2cf865(_0x318181[_0xaafc('0x13')][_0xaafc('0x11')]);}})[_0xaafc('0x14')](function(_0x1f46e8){logger[_0xaafc('0x10')](_0xaafc('0xd'),_0x29d3ec,_0x1f46e8);_0xd953fb(_0x1f46e8);});});} \ No newline at end of file +var _0x351d=['then','info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request'];(function(_0x32fc20,_0x253681){var _0x48f580=function(_0x1c3383){while(--_0x1c3383){_0x32fc20['push'](_0x32fc20['shift']());}};_0x48f580(++_0x253681);}(_0x351d,0x137));var _0xd351=function(_0x296047,_0x411073){_0x296047=_0x296047-0x0;var _0x2dfdd9=_0x351d[_0x296047];return _0x2dfdd9;};'use strict';var _=require(_0xd351('0x0'));var util=require(_0xd351('0x1'));var moment=require(_0xd351('0x2'));var BPromise=require(_0xd351('0x3'));var rs=require(_0xd351('0x4'));var fs=require('fs');var Redis=require(_0xd351('0x5'));var db=require(_0xd351('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd351('0x7'))('rpc');var config=require(_0xd351('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd351('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x325cd1,_0x2e9acc,_0x458d7b){return new BPromise(function(_0x74ff9,_0xf2b6a2){return client[_0xd351('0xa')](_0x325cd1,_0x458d7b)[_0xd351('0xb')](function(_0x15f758){logger[_0xd351('0xc')](_0xd351('0xd'),_0x2e9acc,'request\x20sent');logger[_0xd351('0xe')](_0xd351('0xf'),_0x2e9acc,_0xd351('0x10'),JSON[_0xd351('0x11')](_0x15f758));if(_0x15f758[_0xd351('0x12')]){if(_0x15f758[_0xd351('0x12')][_0xd351('0x13')]===0x1f4){logger[_0xd351('0x12')](_0xd351('0xd'),_0x2e9acc,_0x15f758[_0xd351('0x12')][_0xd351('0x14')]);return _0xf2b6a2(_0x15f758[_0xd351('0x12')][_0xd351('0x14')]);}logger['error'](_0xd351('0xd'),_0x2e9acc,_0x15f758[_0xd351('0x12')][_0xd351('0x14')]);return _0x74ff9(_0x15f758[_0xd351('0x12')]['message']);}else{logger[_0xd351('0xc')](_0xd351('0xd'),_0x2e9acc,'request\x20sent');_0x74ff9(_0x15f758[_0xd351('0x15')]['message']);}})[_0xd351('0x16')](function(_0x5891d8){logger[_0xd351('0x12')](_0xd351('0xd'),_0x2e9acc,_0x5891d8);_0xf2b6a2(_0x5891d8);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 8eddf53..2573c50 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 _0x2ec5=['Router','../../components/auth/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','describe','get','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x2ec5,0x9c));var _0x52ec=function(_0x4a8568,_0x3440b7){_0x4a8568=_0x4a8568-0x0;var _0x4803c7=_0x2ec5[_0x4a8568];return _0x4803c7;};'use strict';var multer=require(_0x52ec('0x0'));var util=require(_0x52ec('0x1'));var path=require(_0x52ec('0x2'));var timeout=require(_0x52ec('0x3'));var express=require('express');var router=express[_0x52ec('0x4')]();var auth=require(_0x52ec('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x52ec('0x6'));var controller=require(_0x52ec('0x7'));router['get']('/',auth[_0x52ec('0x8')](),controller[_0x52ec('0x9')]);router['get']('/describe',auth[_0x52ec('0x8')](),controller[_0x52ec('0xa')]);router[_0x52ec('0xb')](_0x52ec('0xc'),auth[_0x52ec('0x8')](),controller[_0x52ec('0xd')]);router['post']('/',auth[_0x52ec('0x8')](),controller[_0x52ec('0xe')]);router[_0x52ec('0xf')]('/:id',auth[_0x52ec('0x8')](),controller[_0x52ec('0x10')]);router[_0x52ec('0x11')]('/:id',auth[_0x52ec('0x8')](),controller[_0x52ec('0x12')]);module[_0x52ec('0x13')]=router; \ No newline at end of file +var _0xd60e=['show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','get','/describe','describe','/:id'];(function(_0x182321,_0x28c912){var _0xa18eda=function(_0x586b47){while(--_0x586b47){_0x182321['push'](_0x182321['shift']());}};_0xa18eda(++_0x28c912);}(_0xd60e,0x1d6));var _0xed60=function(_0x5e5266,_0x495355){_0x5e5266=_0x5e5266-0x0;var _0x34d6fe=_0xd60e[_0x5e5266];return _0x34d6fe;};'use strict';var multer=require(_0xed60('0x0'));var util=require(_0xed60('0x1'));var path=require(_0xed60('0x2'));var timeout=require('connect-timeout');var express=require(_0xed60('0x3'));var router=express[_0xed60('0x4')]();var auth=require(_0xed60('0x5'));var interaction=require(_0xed60('0x6'));var config=require(_0xed60('0x7'));var controller=require(_0xed60('0x8'));router['get']('/',auth[_0xed60('0x9')](),controller['index']);router[_0xed60('0xa')](_0xed60('0xb'),auth[_0xed60('0x9')](),controller[_0xed60('0xc')]);router[_0xed60('0xa')](_0xed60('0xd'),auth[_0xed60('0x9')](),controller[_0xed60('0xe')]);router[_0xed60('0xf')]('/',auth[_0xed60('0x9')](),controller[_0xed60('0x10')]);router[_0xed60('0x11')]('/:id',auth[_0xed60('0x9')](),controller[_0xed60('0x12')]);router[_0xed60('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xed60('0x14')]);module[_0xed60('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 28a2f5d..559b3f4 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 _0xe710=['TEXT','ENUM','SENT','SENDING','FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x5fb795,_0x237e54){var _0x3f45d4=function(_0x26c7a5){while(--_0x26c7a5){_0x5fb795['push'](_0x5fb795['shift']());}};_0x3f45d4(++_0x237e54);}(_0xe710,0x1bd));var _0x0e71=function(_0x290052,_0x7024d3){_0x290052=_0x290052-0x0;var _0xe903cf=_0xe710[_0x290052];return _0xe903cf;};'use strict';var Sequelize=require(_0x0e71('0x0'));module['exports']={'integration':{'type':Sequelize[_0x0e71('0x1')]},'eventChannel':{'type':Sequelize[_0x0e71('0x1')]},'exitStatus':{'type':Sequelize[_0x0e71('0x1')]},'ticketId':{'type':Sequelize[_0x0e71('0x1')]},'integrationId':{'type':Sequelize[_0x0e71('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x0e71('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0e71('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x0e71('0x1')]},'membername':{'type':Sequelize[_0x0e71('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x0e71('0x3')]},'holdtime':{'type':Sequelize[_0x0e71('0x2')]},'agentcomplete':{'type':Sequelize[_0x0e71('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x0e71('0x3')]},'talktime':{'type':Sequelize[_0x0e71('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x0e71('0x2')]},'reason':{'type':Sequelize[_0x0e71('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x0e71('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x0e71('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x0e71('0x3')]},'lastevent':{'type':Sequelize[_0x0e71('0x1')]},'channel':{'type':Sequelize[_0x0e71('0x1')]},'channelstate':{'type':Sequelize[_0x0e71('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x0e71('0x1')]},'language':{'type':Sequelize[_0x0e71('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x0e71('0x1')]},'exten':{'type':Sequelize[_0x0e71('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x0e71('0x1')]},'destcalleridnum':{'type':Sequelize[_0x0e71('0x1')]},'destcalleridname':{'type':Sequelize[_0x0e71('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x0e71('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x0e71('0x1')]},'destlanguage':{'type':Sequelize[_0x0e71('0x1')]},'destaccountcode':{'type':Sequelize[_0x0e71('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x0e71('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x0e71('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x0e71('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x0e71('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x0e71('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x0e71('0x5')]},'status':{'type':Sequelize[_0x0e71('0x6')](_0x0e71('0x7'),_0x0e71('0x8'),'RECEIVED',_0x0e71('0x9'))},'url':{'type':Sequelize[_0x0e71('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x0e71('0x1')]},'projectId':{'type':Sequelize[_0x0e71('0x2')]}}; \ No newline at end of file +var _0x8104=['BOOLEAN','TEXT','ENUM','SENT','SENDING','sequelize','STRING','INTEGER','DATE'];(function(_0x44f974,_0x4db616){var _0x805dbd=function(_0x1a56b7){while(--_0x1a56b7){_0x44f974['push'](_0x44f974['shift']());}};_0x805dbd(++_0x4db616);}(_0x8104,0x1b5));var _0x4810=function(_0x1bf111,_0x17a42a){_0x1bf111=_0x1bf111-0x0;var _0x12d9fe=_0x8104[_0x1bf111];return _0x12d9fe;};'use strict';var Sequelize=require(_0x4810('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x4810('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x4810('0x1')]},'integrationId':{'type':Sequelize[_0x4810('0x2')]},'contacts':{'type':Sequelize[_0x4810('0x1')]},'uniqueid':{'type':Sequelize[_0x4810('0x1')]},'calleridnum':{'type':Sequelize[_0x4810('0x1')]},'calleridname':{'type':Sequelize[_0x4810('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4810('0x1')]},'agentcalledAt':{'type':Sequelize[_0x4810('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4810('0x3')]},'holdtime':{'type':Sequelize[_0x4810('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x4810('0x2')]},'agentacw':{'type':Sequelize[_0x4810('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x4810('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x4810('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x4810('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4810('0x3')]},'lastevent':{'type':Sequelize[_0x4810('0x1')]},'channel':{'type':Sequelize[_0x4810('0x1')]},'channelstate':{'type':Sequelize[_0x4810('0x2')]},'channelstatedesc':{'type':Sequelize[_0x4810('0x1')]},'connectedlinenum':{'type':Sequelize[_0x4810('0x1')]},'connectedlinename':{'type':Sequelize[_0x4810('0x1')]},'language':{'type':Sequelize[_0x4810('0x1')]},'accountcode':{'type':Sequelize[_0x4810('0x1')]},'context':{'type':Sequelize[_0x4810('0x1')]},'exten':{'type':Sequelize[_0x4810('0x1')]},'priority':{'type':Sequelize[_0x4810('0x1')]},'destchannel':{'type':Sequelize[_0x4810('0x1')]},'destchannelstate':{'type':Sequelize[_0x4810('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x4810('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x4810('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x4810('0x1')]},'destlanguage':{'type':Sequelize[_0x4810('0x1')]},'destaccountcode':{'type':Sequelize[_0x4810('0x1')]},'destcontext':{'type':Sequelize[_0x4810('0x1')]},'destexten':{'type':Sequelize[_0x4810('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x4810('0x1')]},'messageId':{'type':Sequelize[_0x4810('0x1')]},'inReplyTo':{'type':Sequelize[_0x4810('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x4810('0x1')]},'attachment':{'type':Sequelize[_0x4810('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x4810('0x5')]},'status':{'type':Sequelize[_0x4810('0x6')](_0x4810('0x7'),_0x4810('0x8'),'RECEIVED','FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x4810('0x1')]},'appdata':{'type':Sequelize[_0x4810('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index c5116b7..681e8ad 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 _0x8227=['index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','length','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name'];(function(_0x2669c1,_0x55f578){var _0x485505=function(_0x5ba9ee){while(--_0x5ba9ee){_0x2669c1['push'](_0x2669c1['shift']());}};_0x485505(++_0x55f578);}(_0x8227,0x146));var _0x7822=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8227[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7822('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7822('0x1'));var jsonpatch=require(_0x7822('0x2'));var rp=require(_0x7822('0x3'));var moment=require(_0x7822('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7822('0x5'));var util=require(_0x7822('0x6'));var path=require(_0x7822('0x7'));var sox=require(_0x7822('0x8'));var csv=require(_0x7822('0x9'));var ejs=require(_0x7822('0xa'));var fs=require('fs');var _=require(_0x7822('0xb'));var squel=require(_0x7822('0xc'));var crypto=require('crypto');var jsforce=require(_0x7822('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7822('0x9'));var querystring=require(_0x7822('0xe'));var Papa=require(_0x7822('0xf'));var Redis=require(_0x7822('0x10'));var authService=require(_0x7822('0x11'));var qs=require(_0x7822('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7822('0x13'))('api');var utils=require(_0x7822('0x14'));var config=require(_0x7822('0x15'));var db=require(_0x7822('0x16'))['db'];function respondWithStatusCode(_0xba69e4,_0x2c21d0){_0x2c21d0=_0x2c21d0||0xcc;return function(_0x3f6355){if(_0x3f6355){return _0xba69e4['sendStatus'](_0x2c21d0);}return _0xba69e4['status'](_0x2c21d0)[_0x7822('0x17')]();};}function respondWithResult(_0x10703c,_0x5bd7e0){_0x5bd7e0=_0x5bd7e0||0xc8;return function(_0x30d3d5){if(_0x30d3d5){return _0x10703c[_0x7822('0x18')](_0x5bd7e0)[_0x7822('0x19')](_0x30d3d5);}};}function respondWithFilteredResult(_0x438b8d,_0x411d99){return function(_0x5c13de){if(_0x5c13de){var _0x4a8b06=_0x5c13de[_0x7822('0x1a')],_0x154c49=_0x411d99[_0x7822('0x1b')],_0x228381=_0x411d99[_0x7822('0x1b')]+_0x411d99[_0x7822('0x1c')],_0x65b961;if(_0x228381>=_0x4a8b06){_0x228381=_0x4a8b06;_0x65b961=0xc8;}else{_0x65b961=0xce;}_0x438b8d[_0x7822('0x18')](_0x65b961);return _0x438b8d[_0x7822('0x1d')](_0x7822('0x1e'),_0x154c49+'-'+_0x228381+'/'+_0x4a8b06)[_0x7822('0x19')](_0x5c13de);}return null;};}function patchUpdates(_0x13183d){return function(_0x4533d9){try{jsonpatch[_0x7822('0x1f')](_0x4533d9,_0x13183d,!![]);}catch(_0x44e30a){return BPromise[_0x7822('0x20')](_0x44e30a);}return _0x4533d9['save']();};}function saveUpdates(_0x34fb40,_0x2a25e2){return function(_0x1780c6){if(_0x1780c6){return _0x1780c6[_0x7822('0x21')](_0x34fb40)[_0x7822('0x22')](function(_0x59c6e3){return _0x59c6e3;});}return null;};}function removeEntity(_0x20104e,_0x497e04){return function(_0x509ee8){if(_0x509ee8){return _0x509ee8[_0x7822('0x23')]()[_0x7822('0x22')](function(){_0x20104e[_0x7822('0x18')](0xcc)[_0x7822('0x17')]();});}};}function handleEntityNotFound(_0x5599f8,_0x53269e){return function(_0xf0f816){if(!_0xf0f816){_0x5599f8[_0x7822('0x24')](0x194);}return _0xf0f816;};}function handleError(_0x12e581,_0x53f827){_0x53f827=_0x53f827||0x1f4;return function(_0xb87022){logger[_0x7822('0x25')](_0xb87022['stack']);if(_0xb87022[_0x7822('0x26')]){delete _0xb87022[_0x7822('0x26')];}_0x12e581[_0x7822('0x18')](_0x53f827)['send'](_0xb87022);};}exports[_0x7822('0x27')]=function(_0xef55f2,_0x30d46d){var _0x470dcd={},_0x26ef14={},_0x324258={'count':0x0,'rows':[]};var _0x54aa99=_[_0x7822('0x28')](db[_0x7822('0x29')][_0x7822('0x2a')],function(_0x8ce726){return{'name':_0x8ce726[_0x7822('0x2b')],'type':_0x8ce726[_0x7822('0x2c')][_0x7822('0x2d')]};});_0x26ef14[_0x7822('0x2e')]=_[_0x7822('0x28')](_0x54aa99,'name');_0x26ef14['query']=_['keys'](_0xef55f2[_0x7822('0x2f')]);_0x26ef14[_0x7822('0x30')]=_['intersection'](_0x26ef14[_0x7822('0x2e')],_0x26ef14[_0x7822('0x2f')]);_0x470dcd['attributes']=_[_0x7822('0x31')](_0x26ef14[_0x7822('0x2e')],qs[_0x7822('0x32')](_0xef55f2['query']['fields']));_0x470dcd[_0x7822('0x33')]=_0x470dcd['attributes']['length']?_0x470dcd[_0x7822('0x33')]:_0x26ef14['model'];if(!_0xef55f2[_0x7822('0x2f')][_0x7822('0x34')](_0x7822('0x35'))){_0x470dcd['limit']=qs[_0x7822('0x1c')](_0xef55f2[_0x7822('0x2f')][_0x7822('0x1c')]);_0x470dcd[_0x7822('0x1b')]=qs[_0x7822('0x1b')](_0xef55f2[_0x7822('0x2f')][_0x7822('0x1b')]);}_0x470dcd['order']=qs[_0x7822('0x36')](_0xef55f2[_0x7822('0x2f')][_0x7822('0x36')]);_0x470dcd[_0x7822('0x37')]=qs[_0x7822('0x30')](_['pick'](_0xef55f2['query'],_0x26ef14[_0x7822('0x30')]));if(_0xef55f2['query'][_0x7822('0x38')]){_0x470dcd[_0x7822('0x37')]=_[_0x7822('0x39')](_0x470dcd[_0x7822('0x37')],{'$or':_['map'](_0x54aa99,function(_0x569434){if(_0x569434[_0x7822('0x2c')]!==_0x7822('0x3a')){var _0x5a6cf0={};_0x5a6cf0[_0x569434[_0x7822('0x26')]]={'$like':'%'+_0xef55f2[_0x7822('0x2f')]['filter']+'%'};return _0x5a6cf0;}})});}_0x470dcd=_['merge']({},_0x470dcd,_0xef55f2[_0x7822('0x3b')]);var _0x41d628={'where':_0x470dcd[_0x7822('0x37')]};return db['IntegrationReport'][_0x7822('0x1a')](_0x41d628)[_0x7822('0x22')](function(_0x5e8b56){_0x324258[_0x7822('0x1a')]=_0x5e8b56;if(_0xef55f2[_0x7822('0x2f')][_0x7822('0x3c')]){_0x470dcd['include']=[{'all':!![]}];}return db[_0x7822('0x29')][_0x7822('0x3d')](_0x470dcd);})[_0x7822('0x22')](function(_0x23c4e8){_0x324258[_0x7822('0x3e')]=_0x23c4e8;return _0x324258;})['then'](respondWithFilteredResult(_0x30d46d,_0x470dcd))[_0x7822('0x3f')](handleError(_0x30d46d,null));};exports[_0x7822('0x40')]=function(_0x3ccaba,_0x3e2d2d){var _0x5c7b50={'raw':![],'where':{'id':_0x3ccaba[_0x7822('0x41')]['id']}},_0xbaf1b6={};_0xbaf1b6['model']=_[_0x7822('0x42')](db[_0x7822('0x29')][_0x7822('0x2a')]);_0xbaf1b6[_0x7822('0x2f')]=_[_0x7822('0x42')](_0x3ccaba[_0x7822('0x2f')]);_0xbaf1b6['filters']=_[_0x7822('0x31')](_0xbaf1b6[_0x7822('0x2e')],_0xbaf1b6['query']);_0x5c7b50[_0x7822('0x33')]=_['intersection'](_0xbaf1b6[_0x7822('0x2e')],qs[_0x7822('0x32')](_0x3ccaba[_0x7822('0x2f')][_0x7822('0x32')]));_0x5c7b50[_0x7822('0x33')]=_0x5c7b50[_0x7822('0x33')][_0x7822('0x43')]?_0x5c7b50[_0x7822('0x33')]:_0xbaf1b6[_0x7822('0x2e')];if(_0x3ccaba['query']['includeAll']){_0x5c7b50[_0x7822('0x44')]=[{'all':!![]}];}_0x5c7b50=_['merge']({},_0x5c7b50,_0x3ccaba['options']);return db[_0x7822('0x29')][_0x7822('0x45')](_0x5c7b50)[_0x7822('0x22')](handleEntityNotFound(_0x3e2d2d,null))[_0x7822('0x22')](respondWithResult(_0x3e2d2d,null))[_0x7822('0x3f')](handleError(_0x3e2d2d,null));};exports[_0x7822('0x46')]=function(_0x4423dc,_0x34357e){return db[_0x7822('0x29')]['create'](_0x4423dc[_0x7822('0x47')],{})[_0x7822('0x22')](respondWithResult(_0x34357e,0xc9))[_0x7822('0x3f')](handleError(_0x34357e,null));};exports[_0x7822('0x21')]=function(_0x1389ab,_0x3c1707){if(_0x1389ab['body']['id']){delete _0x1389ab[_0x7822('0x47')]['id'];}return db[_0x7822('0x29')][_0x7822('0x45')]({'where':{'id':_0x1389ab[_0x7822('0x41')]['id']}})[_0x7822('0x22')](handleEntityNotFound(_0x3c1707,null))[_0x7822('0x22')](saveUpdates(_0x1389ab[_0x7822('0x47')],null))[_0x7822('0x22')](respondWithResult(_0x3c1707,null))['catch'](handleError(_0x3c1707,null));};exports['destroy']=function(_0x28736e,_0x5010f1){return db[_0x7822('0x29')][_0x7822('0x45')]({'where':{'id':_0x28736e[_0x7822('0x41')]['id']}})[_0x7822('0x22')](handleEntityNotFound(_0x5010f1,null))['then'](removeEntity(_0x5010f1,null))[_0x7822('0x3f')](handleError(_0x5010f1,null));};exports[_0x7822('0x48')]=function(_0x127e08,_0x49f2de){return db[_0x7822('0x29')][_0x7822('0x48')]()[_0x7822('0x22')](respondWithResult(_0x49f2de,null))[_0x7822('0x3f')](handleError(_0x49f2de,null));}; \ No newline at end of file +var _0xe5af=['sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','describe','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','IntegrationReport','fieldName','type','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x5ef6f4,_0x390836){var _0x490220=function(_0x42071c){while(--_0x42071c){_0x5ef6f4['push'](_0x5ef6f4['shift']());}};_0x490220(++_0x390836);}(_0xe5af,0x9c));var _0xfe5a=function(_0x408828,_0x3f348c){_0x408828=_0x408828-0x0;var _0x4cbdec=_0xe5af[_0x408828];return _0x4cbdec;};'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')]));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['IntegrationReport'][_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['IntegrationReport']['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['IntegrationReport'][_0xfe5a('0x42')]({'where':{'id':_0x394073['params']['id']}})['then'](handleEntityNotFound(_0x3f8447,null))[_0xfe5a('0x1f')](removeEntity(_0x3f8447,null))['catch'](handleError(_0x3f8447,null));};exports[_0xfe5a('0x44')]=function(_0x4536ba,_0xe50aa9){return db[_0xfe5a('0x26')]['describe']()[_0xfe5a('0x1f')](respondWithResult(_0xe50aa9,null))['catch'](handleError(_0xe50aa9,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 543c2d6..7d89131 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 _0xbc37=['rimraf','./integrationReport.attributes','exports','report_integration','util','moment','bluebird','path'];(function(_0x4173f3,_0x41904c){var _0x2431a0=function(_0x4aab70){while(--_0x4aab70){_0x4173f3['push'](_0x4173f3['shift']());}};_0x2431a0(++_0x41904c);}(_0xbc37,0xcc));var _0x7bc3=function(_0x485172,_0x4e4cce){_0x485172=_0x485172-0x0;var _0x5dbdbd=_0xbc37[_0x485172];return _0x5dbdbd;};'use strict';var _=require('lodash');var util=require(_0x7bc3('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7bc3('0x1'));var BPromise=require(_0x7bc3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7bc3('0x3'));var rimraf=require(_0x7bc3('0x4'));var config=require('../../config/environment');var attributes=require(_0x7bc3('0x5'));module[_0x7bc3('0x6')]=function(_0x3af64c,_0x433e40){return _0x3af64c['define']('IntegrationReport',attributes,{'tableName':_0x7bc3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf8d=['bluebird','request-promise','path','rimraf','../../config/environment','exports','IntegrationReport','lodash','util','../../config/logger','api'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xaf8d,0x6a));var _0xdaf8=function(_0x5e1c1a,_0x53139a){_0x5e1c1a=_0x5e1c1a-0x0;var _0x218514=_0xaf8d[_0x5e1c1a];return _0x218514;};'use strict';var _=require(_0xdaf8('0x0'));var util=require(_0xdaf8('0x1'));var logger=require(_0xdaf8('0x2'))(_0xdaf8('0x3'));var moment=require('moment');var BPromise=require(_0xdaf8('0x4'));var rp=require(_0xdaf8('0x5'));var fs=require('fs');var path=require(_0xdaf8('0x6'));var rimraf=require(_0xdaf8('0x7'));var config=require(_0xdaf8('0x8'));var attributes=require('./integrationReport.attributes');module[_0xdaf8('0x9')]=function(_0xcad28b,_0x56d96c){return _0xcad28b['define'](_0xdaf8('0xa'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 2548b59..52de68b 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(_0x4ed4d2,_0x47acf7){var _0x15ae2e=function(_0x3199f0){while(--_0x3199f0){_0x4ed4d2['push'](_0x4ed4d2['shift']());}};_0x15ae2e(++_0x47acf7);}(_0x4fc2,0x111));var _0x24fc=function(_0x1736e8,_0x28cb17){_0x1736e8=_0x1736e8-0x0;var _0x23024e=_0x4fc2[_0x1736e8];return _0x23024e;};'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 _0xbaf0=['client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index eff1cfe..2f982c7 100644 --- a/server/api/interval/index.js +++ b/server/api/interval/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['isAuthenticated','index','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./interval.controller','get'];(function(_0x5633c1,_0x1bb1d3){var _0x423fdf=function(_0x1979a9){while(--_0x1979a9){_0x5633c1['push'](_0x5633c1['shift']());}};_0x423fdf(++_0x1bb1d3);}(_0x3e74,0x175));var _0x43e7=function(_0x308d4f,_0xba537b){_0x308d4f=_0x308d4f-0x0;var _0x441602=_0x3e74[_0x308d4f];return _0x441602;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['getIntervals']);router[_0x43e7('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x43e7('0xb')](_0x43e7('0xa'),auth['isAuthenticated'](),controller[_0x43e7('0xc')]);router['post'](_0x43e7('0xd'),auth[_0x43e7('0x7')](),controller['addIntervals']);router[_0x43e7('0xe')](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x11')]);module[_0x43e7('0x12')]=router; \ No newline at end of file +var _0x9957=['../../config/environment','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','create','/:id/sub_intervals/create_many','addIntervals','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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('./interval.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0xe')](_0x7995('0xc'),auth[_0x7995('0x9')](),controller['addInterval']);router[_0x7995('0xe')](_0x7995('0x10'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index eb3d72d..4992fab 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 _0x0cb0=['sequelize','exports','STRING'];(function(_0x3cd6cb,_0xc32453){var _0x5a868a=function(_0x4c7ef6){while(--_0x4c7ef6){_0x3cd6cb['push'](_0x3cd6cb['shift']());}};_0x5a868a(++_0xc32453);}(_0x0cb0,0x168));var _0x00cb=function(_0x2d116b,_0x269bc9){_0x2d116b=_0x2d116b-0x0;var _0x2b13ef=_0x0cb0[_0x2d116b];return _0x2b13ef;};'use strict';var Sequelize=require(_0x00cb('0x0'));module[_0x00cb('0x1')]={'name':{'type':Sequelize[_0x00cb('0x2')]},'description':{'type':Sequelize[_0x00cb('0x2')]},'interval':{'type':Sequelize[_0x00cb('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x9457=['exports'];(function(_0x4b94f9,_0x426b8a){var _0x54f656=function(_0x40fe44){while(--_0x40fe44){_0x4b94f9['push'](_0x4b94f9['shift']());}};_0x54f656(++_0x426b8a);}(_0x9457,0x161));var _0x7945=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9457[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x7945('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 23a3559..6f93b42 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 _0xedd9=['sequelize','IntervalId','bulkCreate','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','../../components/extensions/rewrite','sendStatus','status','json','offset','limit','set','save','update','then','get','Intervals','destroy','end','name','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','user','role','userProfileId','UserProfileResource','error','getIntervals','addIntervals'];(function(_0x62c9,_0x14531b){var _0x52a8a4=function(_0x412964){while(--_0x412964){_0x62c9['push'](_0x62c9['shift']());}};_0x52a8a4(++_0x14531b);}(_0xedd9,0xfc));var _0x9edd=function(_0x49cf88,_0x5aa395){_0x49cf88=_0x49cf88-0x0;var _0x4bd501=_0xedd9[_0x49cf88];return _0x4bd501;};'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'];var extensions=require(_0x9edd('0x17'));function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=_0x75a4ab['count'],_0x5f5bf4=_0x1042aa[_0x9edd('0x1b')],_0x448996=_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1c')],_0x449cee;if(_0x448996>=_0x4ea60f){_0x448996=_0x4ea60f;_0x449cee=0xc8;}else{_0x449cee=0xce;}_0x338f3c['status'](_0x449cee);return _0x338f3c[_0x9edd('0x1d')]('Content-Range',_0x5f5bf4+'-'+_0x448996+'/'+_0x4ea60f)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x1083e4){return function(_0x4bdb88){try{jsonpatch['apply'](_0x4bdb88,_0x1083e4,!![]);}catch(_0x45c3ab){return BPromise['reject'](_0x45c3ab);}return _0x4bdb88[_0x9edd('0x1e')]();};}function saveUpdates(_0x54a03f,_0x535f37){return function(_0x356751){if(_0x356751){return _0x356751[_0x9edd('0x1f')](_0x54a03f)['then'](function(_0x5823bc){return _0x5823bc;});}return null;};}function removeEntity(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['destroy']()[_0x9edd('0x20')](function(){var _0x1dca43=_0x477878[_0x9edd('0x21')]({'plain':!![]});var _0x2ca65f=_0x9edd('0x22');return db['UserProfileResource'][_0x9edd('0x23')]({'where':{'type':_0x2ca65f,'resourceId':_0x1dca43['id']}})[_0x9edd('0x20')](function(){return _0x477878;});})[_0x9edd('0x20')](function(){_0x341d67[_0x9edd('0x19')](0xcc)[_0x9edd('0x24')]();});}};}function handleEntityNotFound(_0x4d507f,_0x4b3d1b){return function(_0x3276ee){if(!_0x3276ee){_0x4d507f[_0x9edd('0x18')](0x194);}return _0x3276ee;};}function handleError(_0x8d67aa,_0x25e135){_0x25e135=_0x25e135||0x1f4;return function(_0x3c2227){logger['error'](_0x3c2227['stack']);if(_0x3c2227[_0x9edd('0x25')]){delete _0x3c2227[_0x9edd('0x25')];}_0x8d67aa[_0x9edd('0x19')](_0x25e135)['send'](_0x3c2227);};}exports[_0x9edd('0x26')]=function(_0x28cfae,_0x2ae8dd){var _0x41af53={},_0x5eccfb={},_0x2155a1={'count':0x0,'rows':[]};var _0x3fb556=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x42e664){return{'name':_0x42e664[_0x9edd('0x2a')],'type':_0x42e664[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x5eccfb[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x3fb556,_0x9edd('0x25'));_0x5eccfb[_0x9edd('0x2e')]=_[_0x9edd('0x2f')](_0x28cfae[_0x9edd('0x2e')]);_0x5eccfb['filters']=_[_0x9edd('0x30')](_0x5eccfb[_0x9edd('0x2d')],_0x5eccfb[_0x9edd('0x2e')]);_0x41af53['attributes']=_[_0x9edd('0x30')](_0x5eccfb[_0x9edd('0x2d')],qs[_0x9edd('0x31')](_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x31')]));_0x41af53[_0x9edd('0x32')]=_0x41af53[_0x9edd('0x32')][_0x9edd('0x33')]?_0x41af53[_0x9edd('0x32')]:_0x5eccfb[_0x9edd('0x2d')];if(!_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x34')](_0x9edd('0x35'))){_0x41af53[_0x9edd('0x1c')]=qs['limit'](_0x28cfae[_0x9edd('0x2e')]['limit']);_0x41af53[_0x9edd('0x1b')]=qs[_0x9edd('0x1b')](_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x1b')]);}_0x41af53[_0x9edd('0x36')]=qs['sort'](_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x37')]);_0x41af53[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_[_0x9edd('0x3a')](_0x28cfae[_0x9edd('0x2e')],_0x5eccfb[_0x9edd('0x39')]));if(_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x3b')]){_0x41af53[_0x9edd('0x38')]=_['merge'](_0x41af53[_0x9edd('0x38')],{'$or':_['map'](_0x3fb556,function(_0x3ef1d5){if(_0x3ef1d5['type']!==_0x9edd('0x3c')){var _0x2858b5={};_0x2858b5[_0x3ef1d5[_0x9edd('0x25')]]={'$like':'%'+_0x28cfae['query'][_0x9edd('0x3b')]+'%'};return _0x2858b5;}})});}_0x41af53=_[_0x9edd('0x3d')]({},_0x41af53,_0x28cfae[_0x9edd('0x3e')]);var _0x48958a={'where':_0x41af53[_0x9edd('0x38')]};return db['Interval'][_0x9edd('0x3f')](_0x48958a)[_0x9edd('0x20')](function(_0x50be2c){_0x2155a1[_0x9edd('0x3f')]=_0x50be2c;if(_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x40')]){_0x41af53[_0x9edd('0x41')]=[{'all':!![]}];}return db['Interval'][_0x9edd('0x42')](_0x41af53);})['then'](function(_0x2bdb3f){_0x2155a1[_0x9edd('0x43')]=_0x2bdb3f;return _0x2155a1;})['then'](respondWithFilteredResult(_0x2ae8dd,_0x41af53))[_0x9edd('0x44')](handleError(_0x2ae8dd,null));};exports['show']=function(_0x548299,_0x369b69){var _0x9cab86={'raw':!![],'where':{'id':_0x548299[_0x9edd('0x45')]['id']}},_0x1f276b={};_0x1f276b[_0x9edd('0x2d')]=_[_0x9edd('0x2f')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x1f276b[_0x9edd('0x2e')]=_[_0x9edd('0x2f')](_0x548299[_0x9edd('0x2e')]);_0x1f276b[_0x9edd('0x39')]=_[_0x9edd('0x30')](_0x1f276b[_0x9edd('0x2d')],_0x1f276b[_0x9edd('0x2e')]);_0x9cab86['attributes']=_[_0x9edd('0x30')](_0x1f276b[_0x9edd('0x2d')],qs[_0x9edd('0x31')](_0x548299[_0x9edd('0x2e')][_0x9edd('0x31')]));_0x9cab86[_0x9edd('0x32')]=_0x9cab86[_0x9edd('0x32')]['length']?_0x9cab86['attributes']:_0x1f276b['model'];if(_0x548299[_0x9edd('0x2e')]['includeAll']){_0x9cab86[_0x9edd('0x41')]=[{'all':!![]}];}_0x9cab86=_[_0x9edd('0x3d')]({},_0x9cab86,_0x548299[_0x9edd('0x3e')]);return db[_0x9edd('0x28')][_0x9edd('0x46')](_0x9cab86)['then'](handleEntityNotFound(_0x369b69,null))[_0x9edd('0x20')](respondWithResult(_0x369b69,null))[_0x9edd('0x44')](handleError(_0x369b69,null));};exports[_0x9edd('0x47')]=function(_0x4a89ae,_0x3626bc){return db[_0x9edd('0x28')][_0x9edd('0x47')](_0x4a89ae[_0x9edd('0x48')],{})[_0x9edd('0x20')](function(_0x35bdec){var _0x4d4f33=_0x4a89ae[_0x9edd('0x49')][_0x9edd('0x21')]({'plain':!![]});if(!_0x4d4f33)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d4f33[_0x9edd('0x4a')]===_0x9edd('0x49')){var _0x4bb324=_0x35bdec[_0x9edd('0x21')]({'plain':!![]});var _0x8134cd=_0x9edd('0x22');return db['UserProfileSection'][_0x9edd('0x46')]({'where':{'name':_0x8134cd,'userProfileId':_0x4d4f33[_0x9edd('0x4b')]},'raw':!![]})[_0x9edd('0x20')](function(_0x28c7bd){if(_0x28c7bd&&_0x28c7bd['autoAssociation']===0x0){return db[_0x9edd('0x4c')][_0x9edd('0x47')]({'name':_0x4bb324[_0x9edd('0x25')],'resourceId':_0x4bb324['id'],'type':_0x28c7bd['name'],'sectionId':_0x28c7bd['id']},{})[_0x9edd('0x20')](function(){return _0x35bdec;});}else{return _0x35bdec;}})[_0x9edd('0x44')](function(_0x57db43){logger[_0x9edd('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57db43);throw _0x57db43;});}return _0x35bdec;})[_0x9edd('0x20')](respondWithResult(_0x3626bc,0xc9))[_0x9edd('0x44')](handleError(_0x3626bc,null));};exports[_0x9edd('0x1f')]=function(_0x3fcdf5,_0x1e3c19){if(_0x3fcdf5[_0x9edd('0x48')]['id']){delete _0x3fcdf5[_0x9edd('0x48')]['id'];}return db[_0x9edd('0x28')][_0x9edd('0x46')]({'where':{'id':_0x3fcdf5[_0x9edd('0x45')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x1e3c19,null))['then'](saveUpdates(_0x3fcdf5[_0x9edd('0x48')],null))[_0x9edd('0x20')](respondWithResult(_0x1e3c19,null))[_0x9edd('0x44')](handleError(_0x1e3c19,null));};exports['destroy']=function(_0xe96d6a,_0x54a704){return db['Interval']['find']({'where':{'id':_0xe96d6a[_0x9edd('0x45')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x54a704,null))[_0x9edd('0x20')](removeEntity(_0x54a704,null))[_0x9edd('0x44')](handleError(_0x54a704,null));};exports['addInterval']=function(_0x56b38b,_0x4e3c3e,_0x71820f){if(_0x56b38b[_0x9edd('0x48')]['id']){delete _0x56b38b[_0x9edd('0x48')]['id'];}return db[_0x9edd('0x28')][_0x9edd('0x46')]({'where':{'id':_0x56b38b[_0x9edd('0x45')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x4e3c3e,null))[_0x9edd('0x20')](function(_0x4eb780){if(_0x4eb780){_0x56b38b[_0x9edd('0x48')]['IntervalId']=_0x4eb780['id'];return db[_0x9edd('0x28')][_0x9edd('0x47')](_0x56b38b['body']);}})[_0x9edd('0x20')](respondWithResult(_0x4e3c3e,null))[_0x9edd('0x44')](handleError(_0x4e3c3e,null));};exports[_0x9edd('0x4e')]=function(_0x5ec9af,_0xc648c4,_0x2e1ce3){var _0x430eb4={};var _0x15ebfa={};var _0x1720b1;var _0x2c3173;return db['Interval']['findOne']({'where':{'id':_0x5ec9af[_0x9edd('0x45')]['id']}})['then'](handleEntityNotFound(_0xc648c4,null))[_0x9edd('0x20')](function(_0x3e9a3e){if(_0x3e9a3e){_0x1720b1=_0x3e9a3e;_0x15ebfa[_0x9edd('0x2d')]=_[_0x9edd('0x2f')](db['Interval'][_0x9edd('0x29')]);_0x15ebfa['query']=_[_0x9edd('0x2f')](_0x5ec9af[_0x9edd('0x2e')]);_0x15ebfa[_0x9edd('0x39')]=_['intersection'](_0x15ebfa[_0x9edd('0x2d')],_0x15ebfa['query']);_0x430eb4[_0x9edd('0x32')]=_[_0x9edd('0x30')](_0x15ebfa['model'],qs[_0x9edd('0x31')](_0x5ec9af['query'][_0x9edd('0x31')]));_0x430eb4[_0x9edd('0x32')]=_0x430eb4[_0x9edd('0x32')]['length']?_0x430eb4[_0x9edd('0x32')]:_0x15ebfa[_0x9edd('0x2d')];_0x430eb4[_0x9edd('0x36')]=qs[_0x9edd('0x37')](_0x5ec9af[_0x9edd('0x2e')]['sort']);_0x430eb4['where']=qs[_0x9edd('0x39')](_[_0x9edd('0x3a')](_0x5ec9af['query'],_0x15ebfa['filters']));if(_0x5ec9af['query'][_0x9edd('0x3b')]){_0x430eb4['where']=_['merge'](_0x430eb4[_0x9edd('0x38')],{'$or':_[_0x9edd('0x27')](_0x430eb4['attributes'],function(_0xb9ebeb){var _0x11e082={};_0x11e082[_0xb9ebeb]={'$like':'%'+_0x5ec9af[_0x9edd('0x2e')]['filter']+'%'};return _0x11e082;})});}_0x430eb4=_[_0x9edd('0x3d')]({},_0x430eb4,_0x5ec9af['options']);return _0x1720b1[_0x9edd('0x4e')](_0x430eb4);}})[_0x9edd('0x20')](function(_0x4c8d06){if(_0x4c8d06){_0x2c3173=_0x4c8d06[_0x9edd('0x33')];if(!_0x5ec9af[_0x9edd('0x2e')]['hasOwnProperty'](_0x9edd('0x35'))){_0x430eb4[_0x9edd('0x1c')]=qs[_0x9edd('0x1c')](_0x5ec9af[_0x9edd('0x2e')]['limit']);_0x430eb4[_0x9edd('0x1b')]=qs['offset'](_0x5ec9af[_0x9edd('0x2e')][_0x9edd('0x1b')]);}return _0x1720b1[_0x9edd('0x4e')](_0x430eb4);}})['then'](function(_0x106a67){if(_0x106a67){return _0x106a67?{'count':_0x2c3173,'rows':_0x106a67}:null;}})[_0x9edd('0x20')](respondWithResult(_0xc648c4,null))[_0x9edd('0x44')](handleError(_0xc648c4,null));};exports[_0x9edd('0x4f')]=function(_0x25626a,_0x14e2e5,_0x3fa4a9){return db['Interval']['findOne']({'where':{'id':_0x25626a[_0x9edd('0x45')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x14e2e5,null))[_0x9edd('0x20')](function(_0x171403){if(_0x171403){return db[_0x9edd('0x50')]['transaction'](function(_0x2e40c8){return db[_0x9edd('0x28')][_0x9edd('0x23')]({'where':{'IntervalId':_0x25626a['params']['id']},'transaction':_0x2e40c8})[_0x9edd('0x20')](function(_0x29d70d){var _0x4b1c12=_[_0x9edd('0x27')](_0x25626a[_0x9edd('0x48')],function(_0x58c839){delete _0x58c839['id'];_0x58c839[_0x9edd('0x51')]=_0x25626a[_0x9edd('0x45')]['id'];return _0x58c839;});return db['Interval'][_0x9edd('0x52')](_0x4b1c12,{'transaction':_0x2e40c8});});})['then'](function(){return db['Interval'][_0x9edd('0x42')]({'where':{'IntervalId':_0x25626a[_0x9edd('0x45')]['id']}});});}})[_0x9edd('0x20')](respondWithResult(_0x14e2e5,null))['catch'](handleError(_0x14e2e5,null));}; \ No newline at end of file +var _0xedd9=['sequelize','IntervalId','bulkCreate','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','../../components/extensions/rewrite','sendStatus','status','json','offset','limit','set','save','update','then','get','Intervals','destroy','end','name','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','user','role','userProfileId','UserProfileResource','error','getIntervals','addIntervals'];(function(_0x582c89,_0x785190){var _0x1ab7ec=function(_0x490854){while(--_0x490854){_0x582c89['push'](_0x582c89['shift']());}};_0x1ab7ec(++_0x785190);}(_0xedd9,0xfc));var _0x9edd=function(_0x13efbc,_0x1663bd){_0x13efbc=_0x13efbc-0x0;var _0x3eee59=_0xedd9[_0x13efbc];return _0x3eee59;};'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'];var extensions=require(_0x9edd('0x17'));function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=_0x75a4ab['count'],_0x5f5bf4=_0x1042aa[_0x9edd('0x1b')],_0x448996=_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1c')],_0x449cee;if(_0x448996>=_0x4ea60f){_0x448996=_0x4ea60f;_0x449cee=0xc8;}else{_0x449cee=0xce;}_0x338f3c['status'](_0x449cee);return _0x338f3c[_0x9edd('0x1d')]('Content-Range',_0x5f5bf4+'-'+_0x448996+'/'+_0x4ea60f)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x1083e4){return function(_0x4bdb88){try{jsonpatch['apply'](_0x4bdb88,_0x1083e4,!![]);}catch(_0x45c3ab){return BPromise['reject'](_0x45c3ab);}return _0x4bdb88[_0x9edd('0x1e')]();};}function saveUpdates(_0x54a03f,_0x535f37){return function(_0x356751){if(_0x356751){return _0x356751[_0x9edd('0x1f')](_0x54a03f)['then'](function(_0x5823bc){return _0x5823bc;});}return null;};}function removeEntity(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['destroy']()[_0x9edd('0x20')](function(){var _0x1dca43=_0x477878[_0x9edd('0x21')]({'plain':!![]});var _0x2ca65f=_0x9edd('0x22');return db['UserProfileResource'][_0x9edd('0x23')]({'where':{'type':_0x2ca65f,'resourceId':_0x1dca43['id']}})[_0x9edd('0x20')](function(){return _0x477878;});})[_0x9edd('0x20')](function(){_0x341d67[_0x9edd('0x19')](0xcc)[_0x9edd('0x24')]();});}};}function handleEntityNotFound(_0x4d507f,_0x4b3d1b){return function(_0x3276ee){if(!_0x3276ee){_0x4d507f[_0x9edd('0x18')](0x194);}return _0x3276ee;};}function handleError(_0x8d67aa,_0x25e135){_0x25e135=_0x25e135||0x1f4;return function(_0x3c2227){logger['error'](_0x3c2227['stack']);if(_0x3c2227[_0x9edd('0x25')]){delete _0x3c2227[_0x9edd('0x25')];}_0x8d67aa[_0x9edd('0x19')](_0x25e135)['send'](_0x3c2227);};}exports[_0x9edd('0x26')]=function(_0x28cfae,_0x2ae8dd){var _0x41af53={},_0x5eccfb={},_0x2155a1={'count':0x0,'rows':[]};var _0x3fb556=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x42e664){return{'name':_0x42e664[_0x9edd('0x2a')],'type':_0x42e664[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x5eccfb[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x3fb556,_0x9edd('0x25'));_0x5eccfb[_0x9edd('0x2e')]=_[_0x9edd('0x2f')](_0x28cfae[_0x9edd('0x2e')]);_0x5eccfb['filters']=_[_0x9edd('0x30')](_0x5eccfb[_0x9edd('0x2d')],_0x5eccfb[_0x9edd('0x2e')]);_0x41af53['attributes']=_[_0x9edd('0x30')](_0x5eccfb[_0x9edd('0x2d')],qs[_0x9edd('0x31')](_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x31')]));_0x41af53[_0x9edd('0x32')]=_0x41af53[_0x9edd('0x32')][_0x9edd('0x33')]?_0x41af53[_0x9edd('0x32')]:_0x5eccfb[_0x9edd('0x2d')];if(!_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x34')](_0x9edd('0x35'))){_0x41af53[_0x9edd('0x1c')]=qs['limit'](_0x28cfae[_0x9edd('0x2e')]['limit']);_0x41af53[_0x9edd('0x1b')]=qs[_0x9edd('0x1b')](_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x1b')]);}_0x41af53[_0x9edd('0x36')]=qs['sort'](_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x37')]);_0x41af53[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_[_0x9edd('0x3a')](_0x28cfae[_0x9edd('0x2e')],_0x5eccfb[_0x9edd('0x39')]));if(_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x3b')]){_0x41af53[_0x9edd('0x38')]=_['merge'](_0x41af53[_0x9edd('0x38')],{'$or':_['map'](_0x3fb556,function(_0x3ef1d5){if(_0x3ef1d5['type']!==_0x9edd('0x3c')){var _0x2858b5={};_0x2858b5[_0x3ef1d5[_0x9edd('0x25')]]={'$like':'%'+_0x28cfae['query'][_0x9edd('0x3b')]+'%'};return _0x2858b5;}})});}_0x41af53=_[_0x9edd('0x3d')]({},_0x41af53,_0x28cfae[_0x9edd('0x3e')]);var _0x48958a={'where':_0x41af53[_0x9edd('0x38')]};return db['Interval'][_0x9edd('0x3f')](_0x48958a)[_0x9edd('0x20')](function(_0x50be2c){_0x2155a1[_0x9edd('0x3f')]=_0x50be2c;if(_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x40')]){_0x41af53[_0x9edd('0x41')]=[{'all':!![]}];}return db['Interval'][_0x9edd('0x42')](_0x41af53);})['then'](function(_0x2bdb3f){_0x2155a1[_0x9edd('0x43')]=_0x2bdb3f;return _0x2155a1;})['then'](respondWithFilteredResult(_0x2ae8dd,_0x41af53))[_0x9edd('0x44')](handleError(_0x2ae8dd,null));};exports['show']=function(_0x548299,_0x369b69){var _0x9cab86={'raw':!![],'where':{'id':_0x548299[_0x9edd('0x45')]['id']}},_0x1f276b={};_0x1f276b[_0x9edd('0x2d')]=_[_0x9edd('0x2f')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x1f276b[_0x9edd('0x2e')]=_[_0x9edd('0x2f')](_0x548299[_0x9edd('0x2e')]);_0x1f276b[_0x9edd('0x39')]=_[_0x9edd('0x30')](_0x1f276b[_0x9edd('0x2d')],_0x1f276b[_0x9edd('0x2e')]);_0x9cab86['attributes']=_[_0x9edd('0x30')](_0x1f276b[_0x9edd('0x2d')],qs[_0x9edd('0x31')](_0x548299[_0x9edd('0x2e')][_0x9edd('0x31')]));_0x9cab86[_0x9edd('0x32')]=_0x9cab86[_0x9edd('0x32')]['length']?_0x9cab86['attributes']:_0x1f276b['model'];if(_0x548299[_0x9edd('0x2e')]['includeAll']){_0x9cab86[_0x9edd('0x41')]=[{'all':!![]}];}_0x9cab86=_[_0x9edd('0x3d')]({},_0x9cab86,_0x548299[_0x9edd('0x3e')]);return db[_0x9edd('0x28')][_0x9edd('0x46')](_0x9cab86)['then'](handleEntityNotFound(_0x369b69,null))[_0x9edd('0x20')](respondWithResult(_0x369b69,null))[_0x9edd('0x44')](handleError(_0x369b69,null));};exports[_0x9edd('0x47')]=function(_0x4a89ae,_0x3626bc){return db[_0x9edd('0x28')][_0x9edd('0x47')](_0x4a89ae[_0x9edd('0x48')],{})[_0x9edd('0x20')](function(_0x35bdec){var _0x4d4f33=_0x4a89ae[_0x9edd('0x49')][_0x9edd('0x21')]({'plain':!![]});if(!_0x4d4f33)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d4f33[_0x9edd('0x4a')]===_0x9edd('0x49')){var _0x4bb324=_0x35bdec[_0x9edd('0x21')]({'plain':!![]});var _0x8134cd=_0x9edd('0x22');return db['UserProfileSection'][_0x9edd('0x46')]({'where':{'name':_0x8134cd,'userProfileId':_0x4d4f33[_0x9edd('0x4b')]},'raw':!![]})[_0x9edd('0x20')](function(_0x28c7bd){if(_0x28c7bd&&_0x28c7bd['autoAssociation']===0x0){return db[_0x9edd('0x4c')][_0x9edd('0x47')]({'name':_0x4bb324[_0x9edd('0x25')],'resourceId':_0x4bb324['id'],'type':_0x28c7bd['name'],'sectionId':_0x28c7bd['id']},{})[_0x9edd('0x20')](function(){return _0x35bdec;});}else{return _0x35bdec;}})[_0x9edd('0x44')](function(_0x57db43){logger[_0x9edd('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57db43);throw _0x57db43;});}return _0x35bdec;})[_0x9edd('0x20')](respondWithResult(_0x3626bc,0xc9))[_0x9edd('0x44')](handleError(_0x3626bc,null));};exports[_0x9edd('0x1f')]=function(_0x3fcdf5,_0x1e3c19){if(_0x3fcdf5[_0x9edd('0x48')]['id']){delete _0x3fcdf5[_0x9edd('0x48')]['id'];}return db[_0x9edd('0x28')][_0x9edd('0x46')]({'where':{'id':_0x3fcdf5[_0x9edd('0x45')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x1e3c19,null))['then'](saveUpdates(_0x3fcdf5[_0x9edd('0x48')],null))[_0x9edd('0x20')](respondWithResult(_0x1e3c19,null))[_0x9edd('0x44')](handleError(_0x1e3c19,null));};exports['destroy']=function(_0xe96d6a,_0x54a704){return db['Interval']['find']({'where':{'id':_0xe96d6a[_0x9edd('0x45')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x54a704,null))[_0x9edd('0x20')](removeEntity(_0x54a704,null))[_0x9edd('0x44')](handleError(_0x54a704,null));};exports['addInterval']=function(_0x56b38b,_0x4e3c3e,_0x71820f){if(_0x56b38b[_0x9edd('0x48')]['id']){delete _0x56b38b[_0x9edd('0x48')]['id'];}return db[_0x9edd('0x28')][_0x9edd('0x46')]({'where':{'id':_0x56b38b[_0x9edd('0x45')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x4e3c3e,null))[_0x9edd('0x20')](function(_0x4eb780){if(_0x4eb780){_0x56b38b[_0x9edd('0x48')]['IntervalId']=_0x4eb780['id'];return db[_0x9edd('0x28')][_0x9edd('0x47')](_0x56b38b['body']);}})[_0x9edd('0x20')](respondWithResult(_0x4e3c3e,null))[_0x9edd('0x44')](handleError(_0x4e3c3e,null));};exports[_0x9edd('0x4e')]=function(_0x5ec9af,_0xc648c4,_0x2e1ce3){var _0x430eb4={};var _0x15ebfa={};var _0x1720b1;var _0x2c3173;return db['Interval']['findOne']({'where':{'id':_0x5ec9af[_0x9edd('0x45')]['id']}})['then'](handleEntityNotFound(_0xc648c4,null))[_0x9edd('0x20')](function(_0x3e9a3e){if(_0x3e9a3e){_0x1720b1=_0x3e9a3e;_0x15ebfa[_0x9edd('0x2d')]=_[_0x9edd('0x2f')](db['Interval'][_0x9edd('0x29')]);_0x15ebfa['query']=_[_0x9edd('0x2f')](_0x5ec9af[_0x9edd('0x2e')]);_0x15ebfa[_0x9edd('0x39')]=_['intersection'](_0x15ebfa[_0x9edd('0x2d')],_0x15ebfa['query']);_0x430eb4[_0x9edd('0x32')]=_[_0x9edd('0x30')](_0x15ebfa['model'],qs[_0x9edd('0x31')](_0x5ec9af['query'][_0x9edd('0x31')]));_0x430eb4[_0x9edd('0x32')]=_0x430eb4[_0x9edd('0x32')]['length']?_0x430eb4[_0x9edd('0x32')]:_0x15ebfa[_0x9edd('0x2d')];_0x430eb4[_0x9edd('0x36')]=qs[_0x9edd('0x37')](_0x5ec9af[_0x9edd('0x2e')]['sort']);_0x430eb4['where']=qs[_0x9edd('0x39')](_[_0x9edd('0x3a')](_0x5ec9af['query'],_0x15ebfa['filters']));if(_0x5ec9af['query'][_0x9edd('0x3b')]){_0x430eb4['where']=_['merge'](_0x430eb4[_0x9edd('0x38')],{'$or':_[_0x9edd('0x27')](_0x430eb4['attributes'],function(_0xb9ebeb){var _0x11e082={};_0x11e082[_0xb9ebeb]={'$like':'%'+_0x5ec9af[_0x9edd('0x2e')]['filter']+'%'};return _0x11e082;})});}_0x430eb4=_[_0x9edd('0x3d')]({},_0x430eb4,_0x5ec9af['options']);return _0x1720b1[_0x9edd('0x4e')](_0x430eb4);}})[_0x9edd('0x20')](function(_0x4c8d06){if(_0x4c8d06){_0x2c3173=_0x4c8d06[_0x9edd('0x33')];if(!_0x5ec9af[_0x9edd('0x2e')]['hasOwnProperty'](_0x9edd('0x35'))){_0x430eb4[_0x9edd('0x1c')]=qs[_0x9edd('0x1c')](_0x5ec9af[_0x9edd('0x2e')]['limit']);_0x430eb4[_0x9edd('0x1b')]=qs['offset'](_0x5ec9af[_0x9edd('0x2e')][_0x9edd('0x1b')]);}return _0x1720b1[_0x9edd('0x4e')](_0x430eb4);}})['then'](function(_0x106a67){if(_0x106a67){return _0x106a67?{'count':_0x2c3173,'rows':_0x106a67}:null;}})[_0x9edd('0x20')](respondWithResult(_0xc648c4,null))[_0x9edd('0x44')](handleError(_0xc648c4,null));};exports[_0x9edd('0x4f')]=function(_0x25626a,_0x14e2e5,_0x3fa4a9){return db['Interval']['findOne']({'where':{'id':_0x25626a[_0x9edd('0x45')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x14e2e5,null))[_0x9edd('0x20')](function(_0x171403){if(_0x171403){return db[_0x9edd('0x50')]['transaction'](function(_0x2e40c8){return db[_0x9edd('0x28')][_0x9edd('0x23')]({'where':{'IntervalId':_0x25626a['params']['id']},'transaction':_0x2e40c8})[_0x9edd('0x20')](function(_0x29d70d){var _0x4b1c12=_[_0x9edd('0x27')](_0x25626a[_0x9edd('0x48')],function(_0x58c839){delete _0x58c839['id'];_0x58c839[_0x9edd('0x51')]=_0x25626a[_0x9edd('0x45')]['id'];return _0x58c839;});return db['Interval'][_0x9edd('0x52')](_0x4b1c12,{'transaction':_0x2e40c8});});})['then'](function(){return db['Interval'][_0x9edd('0x42')]({'where':{'IntervalId':_0x25626a[_0x9edd('0x45')]['id']}});});}})[_0x9edd('0x20')](respondWithResult(_0x14e2e5,null))['catch'](handleError(_0x14e2e5,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index d7d564c..c866de7 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 _0xf290=['../../config/environment','../../components/extensions/rewrite','define','Interval','tools_intervals','rewrite','util','api','bluebird','request-promise','path','rimraf'];(function(_0x3815c4,_0x294ec1){var _0x4c9db2=function(_0x1ff073){while(--_0x1ff073){_0x3815c4['push'](_0x3815c4['shift']());}};_0x4c9db2(++_0x294ec1);}(_0xf290,0xde));var _0x0f29=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0xf290[_0x533e4e];return _0x1f14bb;};'use strict';var _=require('lodash');var util=require(_0x0f29('0x0'));var logger=require('../../config/logger')(_0x0f29('0x1'));var moment=require('moment');var BPromise=require(_0x0f29('0x2'));var rp=require(_0x0f29('0x3'));var fs=require('fs');var path=require(_0x0f29('0x4'));var rimraf=require(_0x0f29('0x5'));var config=require(_0x0f29('0x6'));var attributes=require('./interval.attributes');var extensions=require(_0x0f29('0x7'));module['exports']=function(_0x2d5350,_0x1c45ec){return _0x2d5350[_0x0f29('0x8')](_0x0f29('0x9'),attributes,{'tableName':_0x0f29('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x45350b,_0x2be26e){extensions[_0x0f29('0xb')](_0x2d5350,_0x45350b);},'afterBulkCreate':function(_0x376de4,_0x139c65,_0xd4d3af){_0xd4d3af();extensions[_0x0f29('0xb')](_0x2d5350,_0x376de4[0x0]);},'afterUpdate':function(_0x1499b7,_0xbcdea8){extensions[_0x0f29('0xb')](_0x2d5350,_0x1499b7);},'afterDestroy':function(_0x55da44,_0x38eb8f){extensions['rewrite'](_0x2d5350,_0x55da44);}}});}; \ No newline at end of file +var _0x682e=['rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x682e,0x119));var _0xe682=function(_0x6d3149,_0x2ab43d){_0x6d3149=_0x6d3149-0x0;var _0x3b0b6d=_0x682e[_0x6d3149];return _0x3b0b6d;};'use strict';var _=require(_0xe682('0x0'));var util=require('util');var logger=require(_0xe682('0x1'))(_0xe682('0x2'));var moment=require(_0xe682('0x3'));var BPromise=require(_0xe682('0x4'));var rp=require(_0xe682('0x5'));var fs=require('fs');var path=require(_0xe682('0x6'));var rimraf=require(_0xe682('0x7'));var config=require(_0xe682('0x8'));var attributes=require(_0xe682('0x9'));var extensions=require(_0xe682('0xa'));module[_0xe682('0xb')]=function(_0x4898a1,_0x82fa21){return _0x4898a1[_0xe682('0xc')](_0xe682('0xd'),attributes,{'tableName':_0xe682('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d9cd5,_0x2de5d5){extensions[_0xe682('0xf')](_0x4898a1,_0x5d9cd5);},'afterBulkCreate':function(_0xc6d5fe,_0x1a85c6,_0x10a39e){_0x10a39e();extensions[_0xe682('0xf')](_0x4898a1,_0xc6d5fe[0x0]);},'afterUpdate':function(_0x5da44a,_0x147c38){extensions[_0xe682('0xf')](_0x4898a1,_0x5da44a);},'afterDestroy':function(_0x4bb520,_0x160d76){extensions[_0xe682('0xf')](_0x4898a1,_0x4bb520);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 55aac3d..780d447 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 _0x98dc=['findAll','options','raw','where','limit','include','map','model','attributes','then','GetInterval','ShowInterval','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','Interval,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','Interval'];(function(_0x59a81d,_0x26f075){var _0x3de6a5=function(_0x4ff8cc){while(--_0x4ff8cc){_0x59a81d['push'](_0x59a81d['shift']());}};_0x3de6a5(++_0x26f075);}(_0x98dc,0xd8));var _0xc98d=function(_0xe9def9,_0x48a5fd){_0xe9def9=_0xe9def9-0x0;var _0x3be2bc=_0x98dc[_0xe9def9];return _0x3be2bc;};'use strict';var _=require(_0xc98d('0x0'));var util=require(_0xc98d('0x1'));var moment=require(_0xc98d('0x2'));var BPromise=require('bluebird');var rs=require(_0xc98d('0x3'));var fs=require('fs');var Redis=require(_0xc98d('0x4'));var db=require(_0xc98d('0x5'))['db'];var utils=require(_0xc98d('0x6'));var logger=require(_0xc98d('0x7'))(_0xc98d('0x8'));var config=require(_0xc98d('0x9'));var jayson=require(_0xc98d('0xa'));var client=jayson[_0xc98d('0xb')][_0xc98d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1bdbc6,_0x3dfca2,_0x4f5c18){return new BPromise(function(_0x2a8476,_0x42fc67){return client['request'](_0x1bdbc6,_0x4f5c18)['then'](function(_0x3b437b){logger['info'](_0xc98d('0xd'),_0x3dfca2,_0xc98d('0xe'));logger[_0xc98d('0xf')]('Interval,\x20%s,\x20%s,\x20%s',_0x3dfca2,_0xc98d('0xe'),JSON[_0xc98d('0x10')](_0x3b437b));if(_0x3b437b[_0xc98d('0x11')]){if(_0x3b437b[_0xc98d('0x11')]['code']===0x1f4){logger[_0xc98d('0x11')](_0xc98d('0xd'),_0x3dfca2,_0x3b437b[_0xc98d('0x11')][_0xc98d('0x12')]);return _0x42fc67(_0x3b437b[_0xc98d('0x11')][_0xc98d('0x12')]);}logger[_0xc98d('0x11')]('Interval,\x20%s,\x20%s',_0x3dfca2,_0x3b437b['error'][_0xc98d('0x12')]);return _0x2a8476(_0x3b437b[_0xc98d('0x11')][_0xc98d('0x12')]);}else{logger[_0xc98d('0x13')](_0xc98d('0xd'),_0x3dfca2,_0xc98d('0xe'));_0x2a8476(_0x3b437b['result']['message']);}})[_0xc98d('0x14')](function(_0x4e9044){logger[_0xc98d('0x11')](_0xc98d('0xd'),_0x3dfca2,_0x4e9044);_0x42fc67(_0x4e9044);});});}exports['GetInterval']=function(_0x3545c3){var _0x3c428a=this;return new Promise(function(_0x4ee75a,_0x4b8304){return db[_0xc98d('0x15')][_0xc98d('0x16')]({'raw':_0x3545c3['options']?_0x3545c3[_0xc98d('0x17')][_0xc98d('0x18')]===undefined?!![]:![]:!![],'where':_0x3545c3['options']?_0x3545c3['options'][_0xc98d('0x19')]||null:null,'attributes':_0x3545c3[_0xc98d('0x17')]?_0x3545c3[_0xc98d('0x17')]['attributes']||null:null,'limit':_0x3545c3[_0xc98d('0x17')]?_0x3545c3[_0xc98d('0x17')][_0xc98d('0x1a')]||null:null,'include':_0x3545c3[_0xc98d('0x17')]?_0x3545c3[_0xc98d('0x17')][_0xc98d('0x1b')]?_[_0xc98d('0x1c')](_0x3545c3[_0xc98d('0x17')][_0xc98d('0x1b')],function(_0xf6c8bc){return{'model':db[_0xf6c8bc[_0xc98d('0x1d')]],'as':_0xf6c8bc['as'],'attributes':_0xf6c8bc[_0xc98d('0x1e')],'include':_0xf6c8bc[_0xc98d('0x1b')]?_['map'](_0xf6c8bc[_0xc98d('0x1b')],function(_0x3cb14e){return{'model':db[_0x3cb14e[_0xc98d('0x1d')]],'as':_0x3cb14e['as'],'attributes':_0x3cb14e[_0xc98d('0x1e')],'include':_0x3cb14e[_0xc98d('0x1b')]?_['map'](_0x3cb14e[_0xc98d('0x1b')],function(_0x1d3d00){return{'model':db[_0x1d3d00[_0xc98d('0x1d')]],'as':_0x1d3d00['as'],'attributes':_0x1d3d00[_0xc98d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xc98d('0x1f')](function(_0x3356fc){logger[_0xc98d('0x13')]('GetInterval',_0x3545c3);logger[_0xc98d('0xf')](_0xc98d('0x20'),_0x3545c3,JSON[_0xc98d('0x10')](_0x3356fc));_0x4ee75a(_0x3356fc);})[_0xc98d('0x14')](function(_0x9c8399){logger[_0xc98d('0x11')](_0xc98d('0x20'),_0x9c8399['message'],_0x3545c3);_0x4b8304(_0x3c428a[_0xc98d('0x11')](0x1f4,_0x9c8399[_0xc98d('0x12')]));});});};exports[_0xc98d('0x21')]=function(_0x230ccb){var _0x39c72d=this;return new Promise(function(_0x288b64,_0x3d628d){return db['Interval']['find']({'raw':_0x230ccb[_0xc98d('0x17')]?_0x230ccb[_0xc98d('0x17')][_0xc98d('0x18')]===undefined?!![]:![]:!![],'where':_0x230ccb['options']?_0x230ccb[_0xc98d('0x17')][_0xc98d('0x19')]||null:null,'attributes':_0x230ccb['options']?_0x230ccb[_0xc98d('0x17')][_0xc98d('0x1e')]||null:null,'include':_0x230ccb[_0xc98d('0x17')]?_0x230ccb[_0xc98d('0x17')][_0xc98d('0x1b')]?_[_0xc98d('0x1c')](_0x230ccb[_0xc98d('0x17')][_0xc98d('0x1b')],function(_0x3c7bd7){return{'model':db[_0x3c7bd7[_0xc98d('0x1d')]],'as':_0x3c7bd7['as'],'attributes':_0x3c7bd7['attributes'],'include':_0x3c7bd7[_0xc98d('0x1b')]?_[_0xc98d('0x1c')](_0x3c7bd7[_0xc98d('0x1b')],function(_0x5e612b){return{'model':db[_0x5e612b[_0xc98d('0x1d')]],'as':_0x5e612b['as'],'attributes':_0x5e612b['attributes'],'include':_0x5e612b['include']?_[_0xc98d('0x1c')](_0x5e612b[_0xc98d('0x1b')],function(_0x233ec7){return{'model':db[_0x233ec7[_0xc98d('0x1d')]],'as':_0x233ec7['as'],'attributes':_0x233ec7[_0xc98d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x258327){logger['info']('ShowInterval',_0x230ccb);logger[_0xc98d('0xf')](_0xc98d('0x21'),_0x230ccb,JSON[_0xc98d('0x10')](_0x258327));_0x288b64(_0x258327);})[_0xc98d('0x14')](function(_0x419c53){logger[_0xc98d('0x11')]('ShowInterval',_0x419c53['message'],_0x230ccb);_0x3d628d(_0x39c72d['error'](0x1f4,_0x419c53['message']));});});}; \ No newline at end of file +var _0x5b7c=['catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','Interval,\x20%s,\x20%s','request\x20sent','Interval,\x20%s,\x20%s,\x20%s','error','message','result','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowInterval','find','then'];(function(_0x43e7d6,_0x3ed017){var _0x2073d3=function(_0x5f401d){while(--_0x5f401d){_0x43e7d6['push'](_0x43e7d6['shift']());}};_0x2073d3(++_0x3ed017);}(_0x5b7c,0x1dd));var _0xc5b7=function(_0x26494d,_0x67e3bd){_0x26494d=_0x26494d-0x0;var _0xfd690f=_0x5b7c[_0x26494d];return _0xfd690f;};'use strict';var _=require(_0xc5b7('0x0'));var util=require(_0xc5b7('0x1'));var moment=require(_0xc5b7('0x2'));var BPromise=require('bluebird');var rs=require(_0xc5b7('0x3'));var fs=require('fs');var Redis=require(_0xc5b7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc5b7('0x5'));var logger=require('../../config/logger')(_0xc5b7('0x6'));var config=require(_0xc5b7('0x7'));var jayson=require(_0xc5b7('0x8'));var client=jayson[_0xc5b7('0x9')][_0xc5b7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43d047,_0x4eb48e,_0x3f6505){return new BPromise(function(_0x15def3,_0x520f7a){return client['request'](_0x43d047,_0x3f6505)['then'](function(_0x1badcd){logger[_0xc5b7('0xb')](_0xc5b7('0xc'),_0x4eb48e,_0xc5b7('0xd'));logger['debug'](_0xc5b7('0xe'),_0x4eb48e,'request\x20sent',JSON['stringify'](_0x1badcd));if(_0x1badcd[_0xc5b7('0xf')]){if(_0x1badcd[_0xc5b7('0xf')]['code']===0x1f4){logger[_0xc5b7('0xf')](_0xc5b7('0xc'),_0x4eb48e,_0x1badcd[_0xc5b7('0xf')][_0xc5b7('0x10')]);return _0x520f7a(_0x1badcd[_0xc5b7('0xf')][_0xc5b7('0x10')]);}logger['error'](_0xc5b7('0xc'),_0x4eb48e,_0x1badcd[_0xc5b7('0xf')][_0xc5b7('0x10')]);return _0x15def3(_0x1badcd[_0xc5b7('0xf')][_0xc5b7('0x10')]);}else{logger['info']('Interval,\x20%s,\x20%s',_0x4eb48e,_0xc5b7('0xd'));_0x15def3(_0x1badcd[_0xc5b7('0x11')][_0xc5b7('0x10')]);}})['catch'](function(_0x5f1413){logger[_0xc5b7('0xf')]('Interval,\x20%s,\x20%s',_0x4eb48e,_0x5f1413);_0x520f7a(_0x5f1413);});});}exports[_0xc5b7('0x12')]=function(_0x174706){var _0x2d6b5e=this;return new Promise(function(_0x2ccbeb,_0x1dd457){return db[_0xc5b7('0x13')][_0xc5b7('0x14')]({'raw':_0x174706['options']?_0x174706[_0xc5b7('0x15')][_0xc5b7('0x16')]===undefined?!![]:![]:!![],'where':_0x174706[_0xc5b7('0x15')]?_0x174706['options'][_0xc5b7('0x17')]||null:null,'attributes':_0x174706[_0xc5b7('0x15')]?_0x174706[_0xc5b7('0x15')][_0xc5b7('0x18')]||null:null,'limit':_0x174706[_0xc5b7('0x15')]?_0x174706['options'][_0xc5b7('0x19')]||null:null,'include':_0x174706[_0xc5b7('0x15')]?_0x174706[_0xc5b7('0x15')][_0xc5b7('0x1a')]?_[_0xc5b7('0x1b')](_0x174706['options']['include'],function(_0x4ece04){return{'model':db[_0x4ece04[_0xc5b7('0x1c')]],'as':_0x4ece04['as'],'attributes':_0x4ece04['attributes'],'include':_0x4ece04['include']?_[_0xc5b7('0x1b')](_0x4ece04['include'],function(_0x5ca83b){return{'model':db[_0x5ca83b[_0xc5b7('0x1c')]],'as':_0x5ca83b['as'],'attributes':_0x5ca83b[_0xc5b7('0x18')],'include':_0x5ca83b[_0xc5b7('0x1a')]?_['map'](_0x5ca83b[_0xc5b7('0x1a')],function(_0x16aec1){return{'model':db[_0x16aec1[_0xc5b7('0x1c')]],'as':_0x16aec1['as'],'attributes':_0x16aec1[_0xc5b7('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23d19b){logger[_0xc5b7('0xb')](_0xc5b7('0x12'),_0x174706);logger[_0xc5b7('0x1d')](_0xc5b7('0x12'),_0x174706,JSON['stringify'](_0x23d19b));_0x2ccbeb(_0x23d19b);})['catch'](function(_0x441ad6){logger[_0xc5b7('0xf')](_0xc5b7('0x12'),_0x441ad6[_0xc5b7('0x10')],_0x174706);_0x1dd457(_0x2d6b5e['error'](0x1f4,_0x441ad6[_0xc5b7('0x10')]));});});};exports[_0xc5b7('0x1e')]=function(_0x44cf3a){var _0x53e78b=this;return new Promise(function(_0x22742f,_0x4ac00b){return db[_0xc5b7('0x13')][_0xc5b7('0x1f')]({'raw':_0x44cf3a[_0xc5b7('0x15')]?_0x44cf3a[_0xc5b7('0x15')][_0xc5b7('0x16')]===undefined?!![]:![]:!![],'where':_0x44cf3a[_0xc5b7('0x15')]?_0x44cf3a['options']['where']||null:null,'attributes':_0x44cf3a[_0xc5b7('0x15')]?_0x44cf3a['options'][_0xc5b7('0x18')]||null:null,'include':_0x44cf3a[_0xc5b7('0x15')]?_0x44cf3a[_0xc5b7('0x15')][_0xc5b7('0x1a')]?_['map'](_0x44cf3a[_0xc5b7('0x15')][_0xc5b7('0x1a')],function(_0xe255df){return{'model':db[_0xe255df['model']],'as':_0xe255df['as'],'attributes':_0xe255df['attributes'],'include':_0xe255df[_0xc5b7('0x1a')]?_[_0xc5b7('0x1b')](_0xe255df[_0xc5b7('0x1a')],function(_0x5c898e){return{'model':db[_0x5c898e[_0xc5b7('0x1c')]],'as':_0x5c898e['as'],'attributes':_0x5c898e[_0xc5b7('0x18')],'include':_0x5c898e[_0xc5b7('0x1a')]?_['map'](_0x5c898e[_0xc5b7('0x1a')],function(_0x59cbbb){return{'model':db[_0x59cbbb[_0xc5b7('0x1c')]],'as':_0x59cbbb['as'],'attributes':_0x59cbbb[_0xc5b7('0x18')]};}):[]};}):[]};}):[]:[]})[_0xc5b7('0x20')](function(_0x18f0e9){logger[_0xc5b7('0xb')](_0xc5b7('0x1e'),_0x44cf3a);logger[_0xc5b7('0x1d')](_0xc5b7('0x1e'),_0x44cf3a,JSON['stringify'](_0x18f0e9));_0x22742f(_0x18f0e9);})[_0xc5b7('0x21')](function(_0x524e16){logger[_0xc5b7('0xf')](_0xc5b7('0x1e'),_0x524e16[_0xc5b7('0x10')],_0x44cf3a);_0x4ac00b(_0x53e78b[_0xc5b7('0xf')](0x1f4,_0x524e16[_0xc5b7('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 38d1221..922fa83 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 _0x192f=['send','exports','express','Router','../../components/auth/service','./jira.controller','post','isAuthenticated'];(function(_0x559948,_0x5d7a75){var _0x4fc8d5=function(_0x4f77aa){while(--_0x4f77aa){_0x559948['push'](_0x559948['shift']());}};_0x4fc8d5(++_0x5d7a75);}(_0x192f,0x19a));var _0xf192=function(_0x259b00,_0x25cf2a){_0x259b00=_0x259b00-0x0;var _0x31c5f0=_0x192f[_0x259b00];return _0x31c5f0;};'use strict';var express=require(_0xf192('0x0'));var router=express[_0xf192('0x1')]();var auth=require(_0xf192('0x2'));var controller=require(_0xf192('0x3'));router[_0xf192('0x4')]('/',auth[_0xf192('0x5')](),controller[_0xf192('0x6')]);module[_0xf192('0x7')]=router; \ No newline at end of file +var _0x5ddf=['Router','../../components/auth/service','post','send','exports','express'];(function(_0x1d2177,_0x1547fb){var _0x98107c=function(_0x3b89b2){while(--_0x3b89b2){_0x1d2177['push'](_0x1d2177['shift']());}};_0x98107c(++_0x1547fb);}(_0x5ddf,0xb9));var _0xf5dd=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5ddf[_0xfae23b];return _0x200640;};'use strict';var express=require(_0xf5dd('0x0'));var router=express[_0xf5dd('0x1')]();var auth=require(_0xf5dd('0x2'));var controller=require('./jira.controller');router[_0xf5dd('0x3')]('/',auth['isAuthenticated'](),controller[_0xf5dd('0x4')]);module[_0xf5dd('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index e43c760..beb87b3 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 _0xcabe=['api.jira','openIssue','body','headers','connection','remoteAddress','socket','bluebird','../../config/logger','api','support','key','MOTGUI','summary','Report','description','stringify','issuetype','Bug','customfield_11500','email','fields','oldToken','newToken','name','customfield_11504','reason','/rest/api/2/issue','POST','Basic\x20','toString','base64','request','setEncoding','data','end','status','statusCode','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request'];(function(_0x3c9b3a,_0x522744){var _0x3d5aed=function(_0x5d3752){while(--_0x5d3752){_0x3c9b3a['push'](_0x3c9b3a['shift']());}};_0x3d5aed(++_0x522744);}(_0xcabe,0x14f));var _0xecab=function(_0x55acc0,_0x514eb2){_0x55acc0=_0x55acc0-0x0;var _0x156c75=_0xcabe[_0x55acc0];return _0x156c75;};'use strict';var BPromise=require(_0xecab('0x0'));var https=require('https');var logger=require(_0xecab('0x1'))(_0xecab('0x2'));var USERNAME=_0xecab('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0xebc5f1,_0x39acee){var _0x191703={'fields':{'project':{'key':_0xebc5f1[_0xecab('0x4')]||_0xecab('0x5')},'summary':(_0xebc5f1[_0xecab('0x6')]||_0xecab('0x7'))+'\x20from\x20'+_0xebc5f1['ip'],'description':_0xebc5f1[_0xecab('0x8')]||JSON[_0xecab('0x9')](_0xebc5f1),'issuetype':{'name':_0xebc5f1[_0xecab('0xa')]||_0xecab('0xb')}}};_0x191703['fields'][_0xecab('0xc')]=_0xebc5f1[_0xecab('0xd')];_0x191703[_0xecab('0xe')]['customfield_11501']=_0xebc5f1[_0xecab('0xf')];_0x191703[_0xecab('0xe')]['customfield_11502']=_0xebc5f1[_0xecab('0x10')];_0x191703[_0xecab('0xe')]['customfield_11503']=_0xebc5f1[_0xecab('0x11')];_0x191703[_0xecab('0xe')][_0xecab('0x12')]=_0xebc5f1[_0xecab('0x13')];_0x191703[_0xecab('0xe')]['customfield_10102']=_0xebc5f1['ip'];var _0x4dacd1={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xecab('0x14'),'method':_0xecab('0x15'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xecab('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0xecab('0x17')](_0xecab('0x18'))}};var _0x4ca229=JSON[_0xecab('0x9')](_0x191703);var _0x4ca79a=https[_0xecab('0x19')](_0x4dacd1,function(_0x218fd4){_0x218fd4[_0xecab('0x1a')]('utf8');var _0x284364='';_0x218fd4['on'](_0xecab('0x1b'),function(_0x1b3690){_0x284364+=_0x1b3690;});_0x218fd4['on'](_0xecab('0x1c'),function(){if(_0x39acee){return _0x39acee[_0xecab('0x1d')](_0x218fd4[_0xecab('0x1e')])['json'](JSON['parse'](_0x284364));}});});_0x4ca79a['on'](_0xecab('0x1f'),function(_0xb4b3f0){if(_0x39acee){return _0x39acee[_0xecab('0x1d')](0x1f4)[_0xecab('0x20')]({'errors':[{'message':_0xecab('0x21'),'type':_0xecab('0x22')}]});}});_0x4ca79a['write'](_0x4ca229);_0x4ca79a[_0xecab('0x1c')]();}exports[_0xecab('0x23')]=openIssue;exports['send']=function(_0x56d1e3,_0x25434){_0x56d1e3[_0xecab('0x24')]['ip']=_0x56d1e3[_0xecab('0x25')]['x-forwarded-for']||_0x56d1e3[_0xecab('0x26')][_0xecab('0x27')]||_0x56d1e3[_0xecab('0x28')][_0xecab('0x27')]||_0x56d1e3['connection']['socket']['remoteAddress'];return openIssue(_0x56d1e3[_0xecab('0x24')],_0x25434);}; \ No newline at end of file +var _0x6ac3=['connection','socket','remoteAddress','bluebird','https','api','support','3eAmWpBVP0','key','MOTGUI','\x20from\x20','description','stringify','issuetype','Bug','fields','oldToken','customfield_11502','customfield_11503','name','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','utf8','data','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','send','body','headers','x-forwarded-for'];(function(_0x116482,_0x35ddae){var _0x56db37=function(_0xc3685c){while(--_0xc3685c){_0x116482['push'](_0x116482['shift']());}};_0x56db37(++_0x35ddae);}(_0x6ac3,0x105));var _0x36ac=function(_0x114413,_0x45c38b){_0x114413=_0x114413-0x0;var _0x84c997=_0x6ac3[_0x114413];return _0x84c997;};'use strict';var BPromise=require(_0x36ac('0x0'));var https=require(_0x36ac('0x1'));var logger=require('../../config/logger')(_0x36ac('0x2'));var USERNAME=_0x36ac('0x3');var PASSWORD=_0x36ac('0x4');function openIssue(_0x128bab,_0x1a0cf7){var _0x374b02={'fields':{'project':{'key':_0x128bab[_0x36ac('0x5')]||_0x36ac('0x6')},'summary':(_0x128bab['summary']||'Report')+_0x36ac('0x7')+_0x128bab['ip'],'description':_0x128bab[_0x36ac('0x8')]||JSON[_0x36ac('0x9')](_0x128bab),'issuetype':{'name':_0x128bab[_0x36ac('0xa')]||_0x36ac('0xb')}}};_0x374b02[_0x36ac('0xc')]['customfield_11500']=_0x128bab['email'];_0x374b02['fields']['customfield_11501']=_0x128bab[_0x36ac('0xd')];_0x374b02[_0x36ac('0xc')][_0x36ac('0xe')]=_0x128bab['newToken'];_0x374b02['fields'][_0x36ac('0xf')]=_0x128bab[_0x36ac('0x10')];_0x374b02[_0x36ac('0xc')][_0x36ac('0x11')]=_0x128bab['reason'];_0x374b02['fields'][_0x36ac('0x12')]=_0x128bab['ip'];var _0x3c172b={'host':_0x36ac('0x13'),'port':0x1bb,'path':_0x36ac('0x14'),'method':_0x36ac('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x36ac('0x16'),'Authorization':_0x36ac('0x17')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x56c616=JSON['stringify'](_0x374b02);var _0x29f6bf=https['request'](_0x3c172b,function(_0x312417){_0x312417['setEncoding'](_0x36ac('0x18'));var _0x3f32de='';_0x312417['on'](_0x36ac('0x19'),function(_0x3a20aa){_0x3f32de+=_0x3a20aa;});_0x312417['on']('end',function(){if(_0x1a0cf7){return _0x1a0cf7[_0x36ac('0x1a')](_0x312417[_0x36ac('0x1b')])[_0x36ac('0x1c')](JSON[_0x36ac('0x1d')](_0x3f32de));}});});_0x29f6bf['on'](_0x36ac('0x1e'),function(_0x310b40){if(_0x1a0cf7){return _0x1a0cf7[_0x36ac('0x1a')](0x1f4)['json']({'errors':[{'message':_0x36ac('0x1f'),'type':_0x36ac('0x20')}]});}});_0x29f6bf[_0x36ac('0x21')](_0x56c616);_0x29f6bf[_0x36ac('0x22')]();}exports[_0x36ac('0x23')]=openIssue;exports[_0x36ac('0x24')]=function(_0x3a4529,_0x3b1391){_0x3a4529[_0x36ac('0x25')]['ip']=_0x3a4529[_0x36ac('0x26')][_0x36ac('0x27')]||_0x3a4529[_0x36ac('0x28')]['remoteAddress']||_0x3a4529[_0x36ac('0x29')][_0x36ac('0x2a')]||_0x3a4529['connection'][_0x36ac('0x29')][_0x36ac('0x2a')];return openIssue(_0x3a4529[_0x36ac('0x25')],_0x3b1391);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 1939cd0..9c85a93 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 _0xd187=['isAuthenticated','index','describe','/:id','show','post','create','put','update','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd187,0x1cc));var _0x7d18=function(_0x1c1da1,_0x4755d8){_0x1c1da1=_0x1c1da1-0x0;var _0x3c1816=_0xd187[_0x1c1da1];return _0x3c1816;};'use strict';var multer=require(_0x7d18('0x0'));var util=require(_0x7d18('0x1'));var path=require(_0x7d18('0x2'));var timeout=require(_0x7d18('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x7d18('0x4'));var interaction=require(_0x7d18('0x5'));var config=require('../../config/environment');var controller=require(_0x7d18('0x6'));router[_0x7d18('0x7')]('/',auth[_0x7d18('0x8')](),controller[_0x7d18('0x9')]);router[_0x7d18('0x7')]('/describe',auth[_0x7d18('0x8')](),controller[_0x7d18('0xa')]);router['get'](_0x7d18('0xb'),auth[_0x7d18('0x8')](),controller[_0x7d18('0xc')]);router[_0x7d18('0xd')]('/',auth[_0x7d18('0x8')](),controller[_0x7d18('0xe')]);router[_0x7d18('0xf')]('/:id',auth[_0x7d18('0x8')](),controller[_0x7d18('0x10')]);router['delete'](_0x7d18('0xb'),auth['isAuthenticated'](),controller[_0x7d18('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1322=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1322,0xad));var _0x2132=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x1322[_0x38537f];return _0x141e23;};'use strict';var multer=require(_0x2132('0x0'));var util=require(_0x2132('0x1'));var path=require(_0x2132('0x2'));var timeout=require(_0x2132('0x3'));var express=require(_0x2132('0x4'));var router=express[_0x2132('0x5')]();var auth=require(_0x2132('0x6'));var interaction=require(_0x2132('0x7'));var config=require('../../config/environment');var controller=require(_0x2132('0x8'));router[_0x2132('0x9')]('/',auth['isAuthenticated'](),controller[_0x2132('0xa')]);router[_0x2132('0x9')](_0x2132('0xb'),auth[_0x2132('0xc')](),controller[_0x2132('0xd')]);router[_0x2132('0x9')](_0x2132('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x2132('0xf')]('/',auth[_0x2132('0xc')](),controller[_0x2132('0x10')]);router[_0x2132('0x11')]('/:id',auth[_0x2132('0xc')](),controller['update']);router[_0x2132('0x12')](_0x2132('0xe'),auth[_0x2132('0xc')](),controller[_0x2132('0x13')]);module[_0x2132('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 efa600f..ffc6e8b 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 _0xc270=['long','sequelize','exports','STRING'];(function(_0x120bc2,_0x57a253){var _0x454a41=function(_0x21adfe){while(--_0x21adfe){_0x120bc2['push'](_0x120bc2['shift']());}};_0x454a41(++_0x57a253);}(_0xc270,0xf1));var _0x0c27=function(_0x43d313,_0x22cbab){_0x43d313=_0x43d313-0x0;var _0x3d8371=_0xc270[_0x43d313];return _0x3d8371;};'use strict';var Sequelize=require(_0x0c27('0x0'));module[_0x0c27('0x1')]={'question':{'type':Sequelize[_0x0c27('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x0c27('0x3'))},'membername':{'type':Sequelize[_0x0c27('0x2')]},'projectname':{'type':Sequelize[_0x0c27('0x2')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0c27('0x2')]},'calleridnum':{'type':Sequelize[_0x0c27('0x2')]},'questionId':{'type':Sequelize[_0x0c27('0x2')]}}; \ No newline at end of file +var _0x1b8d=['exports','TEXT','long','STRING','sequelize'];(function(_0x16cb55,_0x4ce3c1){var _0x3c5570=function(_0x44bfd3){while(--_0x44bfd3){_0x16cb55['push'](_0x16cb55['shift']());}};_0x3c5570(++_0x4ce3c1);}(_0x1b8d,0x1cb));var _0xd1b8=function(_0x2ecb67,_0x8ec62d){_0x2ecb67=_0x2ecb67-0x0;var _0x168079=_0x1b8d[_0x2ecb67];return _0x168079;};'use strict';var Sequelize=require(_0xd1b8('0x0'));module[_0xd1b8('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0xd1b8('0x2')](_0xd1b8('0x3'))},'membername':{'type':Sequelize[_0xd1b8('0x4')]},'projectname':{'type':Sequelize[_0xd1b8('0x4')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd1b8('0x4')]},'calleridname':{'type':Sequelize[_0xd1b8('0x4')]},'calleridnum':{'type':Sequelize[_0xd1b8('0x4')]},'questionId':{'type':Sequelize[_0xd1b8('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 5776389..a9d63e2 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 _0xb1fa=['keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','describe','rimraf','fast-json-patch','path','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','then','destroy','error','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','map'];(function(_0x45146d,_0x8389aa){var _0x278f35=function(_0x1e7d7b){while(--_0x1e7d7b){_0x45146d['push'](_0x45146d['shift']());}};_0x278f35(++_0x8389aa);}(_0xb1fa,0x9e));var _0xab1f=function(_0x19061b,_0x396a41){_0x19061b=_0x19061b-0x0;var _0x58194e=_0xb1fa[_0x19061b];return _0x58194e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xab1f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab1f('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xab1f('0x2'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xab1f('0x3'));var squel=require('squel');var crypto=require(_0xab1f('0x4'));var jsforce=require(_0xab1f('0x5'));var deskjs=require('desk.js');var toCsv=require(_0xab1f('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xab1f('0x7'));var authService=require(_0xab1f('0x8'));var qs=require(_0xab1f('0x9'));var as=require(_0xab1f('0xa'));var hardwareService=require(_0xab1f('0xb'));var logger=require('../../config/logger')(_0xab1f('0xc'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xab1f('0xd'))['db'];function respondWithStatusCode(_0x67827d,_0x5168bb){_0x5168bb=_0x5168bb||0xcc;return function(_0x4cb402){if(_0x4cb402){return _0x67827d[_0xab1f('0xe')](_0x5168bb);}return _0x67827d['status'](_0x5168bb)[_0xab1f('0xf')]();};}function respondWithResult(_0x53bb5b,_0x68b4e4){_0x68b4e4=_0x68b4e4||0xc8;return function(_0x58a0fb){if(_0x58a0fb){return _0x53bb5b[_0xab1f('0x10')](_0x68b4e4)[_0xab1f('0x11')](_0x58a0fb);}};}function respondWithFilteredResult(_0x27327c,_0x1c0260){return function(_0x5124d6){if(_0x5124d6){var _0x33fc3a=_0x5124d6[_0xab1f('0x12')],_0x4c68b0=_0x1c0260['offset'],_0xefcf11=_0x1c0260[_0xab1f('0x13')]+_0x1c0260[_0xab1f('0x14')],_0x2ea87f;if(_0xefcf11>=_0x33fc3a){_0xefcf11=_0x33fc3a;_0x2ea87f=0xc8;}else{_0x2ea87f=0xce;}_0x27327c['status'](_0x2ea87f);return _0x27327c[_0xab1f('0x15')](_0xab1f('0x16'),_0x4c68b0+'-'+_0xefcf11+'/'+_0x33fc3a)[_0xab1f('0x11')](_0x5124d6);}return null;};}function patchUpdates(_0x231ce7){return function(_0x122f6f){try{jsonpatch['apply'](_0x122f6f,_0x231ce7,!![]);}catch(_0x77a502){return BPromise[_0xab1f('0x17')](_0x77a502);}return _0x122f6f['save']();};}function saveUpdates(_0x128422,_0x30f973){return function(_0x4fe6d7){if(_0x4fe6d7){return _0x4fe6d7['update'](_0x128422)[_0xab1f('0x18')](function(_0x3ce90b){return _0x3ce90b;});}return null;};}function removeEntity(_0x635566,_0x425b61){return function(_0x1bd51b){if(_0x1bd51b){return _0x1bd51b[_0xab1f('0x19')]()[_0xab1f('0x18')](function(){_0x635566['status'](0xcc)[_0xab1f('0xf')]();});}};}function handleEntityNotFound(_0x85f20a,_0x3662b8){return function(_0x33b647){if(!_0x33b647){_0x85f20a['sendStatus'](0x194);}return _0x33b647;};}function handleError(_0x70b291,_0x219f01){_0x219f01=_0x219f01||0x1f4;return function(_0x4061fb){logger[_0xab1f('0x1a')](_0x4061fb['stack']);if(_0x4061fb[_0xab1f('0x1b')]){delete _0x4061fb[_0xab1f('0x1b')];}_0x70b291[_0xab1f('0x10')](_0x219f01)[_0xab1f('0x1c')](_0x4061fb);};}exports[_0xab1f('0x1d')]=function(_0x47284c,_0x357c51){var _0x4ffb2e={},_0x2216ca={},_0x552d03={'count':0x0,'rows':[]};var _0x38ee2b=_['map'](db[_0xab1f('0x1e')][_0xab1f('0x1f')],function(_0x2e9ac4){return{'name':_0x2e9ac4[_0xab1f('0x20')],'type':_0x2e9ac4[_0xab1f('0x21')][_0xab1f('0x22')]};});_0x2216ca[_0xab1f('0x23')]=_[_0xab1f('0x24')](_0x38ee2b,_0xab1f('0x1b'));_0x2216ca['query']=_[_0xab1f('0x25')](_0x47284c['query']);_0x2216ca[_0xab1f('0x26')]=_[_0xab1f('0x27')](_0x2216ca[_0xab1f('0x23')],_0x2216ca[_0xab1f('0x28')]);_0x4ffb2e[_0xab1f('0x29')]=_['intersection'](_0x2216ca[_0xab1f('0x23')],qs[_0xab1f('0x2a')](_0x47284c[_0xab1f('0x28')]['fields']));_0x4ffb2e[_0xab1f('0x29')]=_0x4ffb2e['attributes'][_0xab1f('0x2b')]?_0x4ffb2e['attributes']:_0x2216ca[_0xab1f('0x23')];if(!_0x47284c['query'][_0xab1f('0x2c')](_0xab1f('0x2d'))){_0x4ffb2e[_0xab1f('0x14')]=qs[_0xab1f('0x14')](_0x47284c['query']['limit']);_0x4ffb2e[_0xab1f('0x13')]=qs['offset'](_0x47284c[_0xab1f('0x28')][_0xab1f('0x13')]);}_0x4ffb2e[_0xab1f('0x2e')]=qs[_0xab1f('0x2f')](_0x47284c[_0xab1f('0x28')][_0xab1f('0x2f')]);_0x4ffb2e['where']=qs[_0xab1f('0x26')](_[_0xab1f('0x30')](_0x47284c['query'],_0x2216ca['filters']));if(_0x47284c[_0xab1f('0x28')][_0xab1f('0x31')]){_0x4ffb2e[_0xab1f('0x32')]=_[_0xab1f('0x33')](_0x4ffb2e[_0xab1f('0x32')],{'$or':_[_0xab1f('0x24')](_0x38ee2b,function(_0x51ef9c){if(_0x51ef9c[_0xab1f('0x21')]!==_0xab1f('0x34')){var _0x36d792={};_0x36d792[_0x51ef9c[_0xab1f('0x1b')]]={'$like':'%'+_0x47284c[_0xab1f('0x28')][_0xab1f('0x31')]+'%'};return _0x36d792;}})});}_0x4ffb2e=_[_0xab1f('0x33')]({},_0x4ffb2e,_0x47284c['options']);var _0x276609={'where':_0x4ffb2e[_0xab1f('0x32')]};return db[_0xab1f('0x1e')][_0xab1f('0x12')](_0x276609)[_0xab1f('0x18')](function(_0x4462ef){_0x552d03[_0xab1f('0x12')]=_0x4462ef;if(_0x47284c[_0xab1f('0x28')][_0xab1f('0x35')]){_0x4ffb2e['include']=[{'all':!![]}];}return db[_0xab1f('0x1e')][_0xab1f('0x36')](_0x4ffb2e);})[_0xab1f('0x18')](function(_0x1387c6){_0x552d03[_0xab1f('0x37')]=_0x1387c6;return _0x552d03;})[_0xab1f('0x18')](respondWithFilteredResult(_0x357c51,_0x4ffb2e))[_0xab1f('0x38')](handleError(_0x357c51,null));};exports[_0xab1f('0x39')]=function(_0x2f7053,_0x129795){var _0xe349a6={'raw':!![],'where':{'id':_0x2f7053[_0xab1f('0x3a')]['id']}},_0x246627={};_0x246627[_0xab1f('0x23')]=_[_0xab1f('0x25')](db['JscriptyAnswerReport'][_0xab1f('0x1f')]);_0x246627['query']=_[_0xab1f('0x25')](_0x2f7053['query']);_0x246627[_0xab1f('0x26')]=_[_0xab1f('0x27')](_0x246627[_0xab1f('0x23')],_0x246627[_0xab1f('0x28')]);_0xe349a6['attributes']=_[_0xab1f('0x27')](_0x246627[_0xab1f('0x23')],qs[_0xab1f('0x2a')](_0x2f7053['query'][_0xab1f('0x2a')]));_0xe349a6['attributes']=_0xe349a6['attributes'][_0xab1f('0x2b')]?_0xe349a6['attributes']:_0x246627[_0xab1f('0x23')];if(_0x2f7053['query']['includeAll']){_0xe349a6[_0xab1f('0x3b')]=[{'all':!![]}];}_0xe349a6=_[_0xab1f('0x33')]({},_0xe349a6,_0x2f7053[_0xab1f('0x3c')]);return db['JscriptyAnswerReport'][_0xab1f('0x3d')](_0xe349a6)['then'](handleEntityNotFound(_0x129795,null))[_0xab1f('0x18')](respondWithResult(_0x129795,null))[_0xab1f('0x38')](handleError(_0x129795,null));};exports[_0xab1f('0x3e')]=function(_0x5f0e97,_0x21d1f9){return db[_0xab1f('0x1e')]['create'](_0x5f0e97[_0xab1f('0x3f')],{})[_0xab1f('0x18')](respondWithResult(_0x21d1f9,0xc9))[_0xab1f('0x38')](handleError(_0x21d1f9,null));};exports['update']=function(_0x28b1b8,_0x5c45c2){if(_0x28b1b8[_0xab1f('0x3f')]['id']){delete _0x28b1b8[_0xab1f('0x3f')]['id'];}return db[_0xab1f('0x1e')]['find']({'where':{'id':_0x28b1b8[_0xab1f('0x3a')]['id']}})[_0xab1f('0x18')](handleEntityNotFound(_0x5c45c2,null))[_0xab1f('0x18')](saveUpdates(_0x28b1b8[_0xab1f('0x3f')],null))['then'](respondWithResult(_0x5c45c2,null))[_0xab1f('0x38')](handleError(_0x5c45c2,null));};exports['destroy']=function(_0x3491d3,_0x1d3d41){return db[_0xab1f('0x1e')]['find']({'where':{'id':_0x3491d3['params']['id']}})[_0xab1f('0x18')](handleEntityNotFound(_0x1d3d41,null))['then'](removeEntity(_0x1d3d41,null))['catch'](handleError(_0x1d3d41,null));};exports['describe']=function(_0xe2eced,_0xa0cd7f){return db[_0xab1f('0x1e')][_0xab1f('0x40')]()['then'](respondWithResult(_0xa0cd7f,null))[_0xab1f('0x38')](handleError(_0xa0cd7f,null));}; \ No newline at end of file +var _0x0f97=['mustache','util','path','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','count','offset','limit','set','Content-Range','apply','update','destroy','then','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','model','query','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','options','include','findAll','show','keys','length','includeAll','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x73e3f1,_0x34ae7b){var _0x2d1dee=function(_0xafa03d){while(--_0xafa03d){_0x73e3f1['push'](_0x73e3f1['shift']());}};_0x2d1dee(++_0x34ae7b);}(_0x0f97,0x196));var _0x70f9=function(_0x5ee907,_0x27e587){_0x5ee907=_0x5ee907-0x0;var _0x2cba70=_0x0f97[_0x5ee907];return _0x2cba70;};'use strict';var pdf=require(_0x70f9('0x0'));var emlformat=require(_0x70f9('0x1'));var rimraf=require(_0x70f9('0x2'));var zipdir=require(_0x70f9('0x3'));var jsonpatch=require(_0x70f9('0x4'));var rp=require(_0x70f9('0x5'));var moment=require(_0x70f9('0x6'));var BPromise=require(_0x70f9('0x7'));var Mustache=require(_0x70f9('0x8'));var util=require(_0x70f9('0x9'));var path=require(_0x70f9('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x70f9('0xb'));var fs=require('fs');var _=require(_0x70f9('0xc'));var squel=require(_0x70f9('0xd'));var crypto=require(_0x70f9('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x70f9('0xf'));var querystring=require(_0x70f9('0x10'));var Papa=require(_0x70f9('0x11'));var Redis=require(_0x70f9('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x70f9('0x13'))(_0x70f9('0x14'));var utils=require(_0x70f9('0x15'));var config=require(_0x70f9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32568f,_0x2ae8f0){_0x2ae8f0=_0x2ae8f0||0xcc;return function(_0x27d5cd){if(_0x27d5cd){return _0x32568f[_0x70f9('0x17')](_0x2ae8f0);}return _0x32568f[_0x70f9('0x18')](_0x2ae8f0)['end']();};}function respondWithResult(_0x6d9d9f,_0x5186dd){_0x5186dd=_0x5186dd||0xc8;return function(_0x57f942){if(_0x57f942){return _0x6d9d9f['status'](_0x5186dd)['json'](_0x57f942);}};}function respondWithFilteredResult(_0x30b651,_0x4d1deb){return function(_0x2a86bb){if(_0x2a86bb){var _0x36044f=_0x2a86bb[_0x70f9('0x19')],_0x138a8e=_0x4d1deb[_0x70f9('0x1a')],_0x3ce5ed=_0x4d1deb[_0x70f9('0x1a')]+_0x4d1deb[_0x70f9('0x1b')],_0x25b88f;if(_0x3ce5ed>=_0x36044f){_0x3ce5ed=_0x36044f;_0x25b88f=0xc8;}else{_0x25b88f=0xce;}_0x30b651['status'](_0x25b88f);return _0x30b651[_0x70f9('0x1c')](_0x70f9('0x1d'),_0x138a8e+'-'+_0x3ce5ed+'/'+_0x36044f)['json'](_0x2a86bb);}return null;};}function patchUpdates(_0x35ba0b){return function(_0x3634d3){try{jsonpatch[_0x70f9('0x1e')](_0x3634d3,_0x35ba0b,!![]);}catch(_0x22f7f7){return BPromise['reject'](_0x22f7f7);}return _0x3634d3['save']();};}function saveUpdates(_0x14de5c,_0x24a7f1){return function(_0x34e740){if(_0x34e740){return _0x34e740[_0x70f9('0x1f')](_0x14de5c)['then'](function(_0x15d7a8){return _0x15d7a8;});}return null;};}function removeEntity(_0x5156d5,_0x454339){return function(_0x309afd){if(_0x309afd){return _0x309afd[_0x70f9('0x20')]()[_0x70f9('0x21')](function(){_0x5156d5[_0x70f9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x440f34,_0x38479d){return function(_0x388f13){if(!_0x388f13){_0x440f34['sendStatus'](0x194);}return _0x388f13;};}function handleError(_0x47057b,_0x474474){_0x474474=_0x474474||0x1f4;return function(_0xcc9c19){logger[_0x70f9('0x22')](_0xcc9c19[_0x70f9('0x23')]);if(_0xcc9c19['name']){delete _0xcc9c19[_0x70f9('0x24')];}_0x47057b[_0x70f9('0x18')](_0x474474)[_0x70f9('0x25')](_0xcc9c19);};}exports[_0x70f9('0x26')]=function(_0x345c11,_0xfe324e){var _0x54ddcd={},_0x470d0c={},_0x37d551={'count':0x0,'rows':[]};var _0x1a0da5=_[_0x70f9('0x27')](db[_0x70f9('0x28')][_0x70f9('0x29')],function(_0x3e29b9){return{'name':_0x3e29b9[_0x70f9('0x2a')],'type':_0x3e29b9['type']['key']};});_0x470d0c[_0x70f9('0x2b')]=_[_0x70f9('0x27')](_0x1a0da5,_0x70f9('0x24'));_0x470d0c['query']=_['keys'](_0x345c11[_0x70f9('0x2c')]);_0x470d0c[_0x70f9('0x2d')]=_['intersection'](_0x470d0c['model'],_0x470d0c[_0x70f9('0x2c')]);_0x54ddcd[_0x70f9('0x2e')]=_['intersection'](_0x470d0c[_0x70f9('0x2b')],qs[_0x70f9('0x2f')](_0x345c11['query'][_0x70f9('0x2f')]));_0x54ddcd[_0x70f9('0x2e')]=_0x54ddcd[_0x70f9('0x2e')]['length']?_0x54ddcd[_0x70f9('0x2e')]:_0x470d0c[_0x70f9('0x2b')];if(!_0x345c11['query'][_0x70f9('0x30')](_0x70f9('0x31'))){_0x54ddcd['limit']=qs[_0x70f9('0x1b')](_0x345c11[_0x70f9('0x2c')][_0x70f9('0x1b')]);_0x54ddcd[_0x70f9('0x1a')]=qs[_0x70f9('0x1a')](_0x345c11[_0x70f9('0x2c')][_0x70f9('0x1a')]);}_0x54ddcd['order']=qs[_0x70f9('0x32')](_0x345c11[_0x70f9('0x2c')][_0x70f9('0x32')]);_0x54ddcd[_0x70f9('0x33')]=qs[_0x70f9('0x2d')](_[_0x70f9('0x34')](_0x345c11['query'],_0x470d0c[_0x70f9('0x2d')]));if(_0x345c11[_0x70f9('0x2c')]['filter']){_0x54ddcd[_0x70f9('0x33')]=_['merge'](_0x54ddcd[_0x70f9('0x33')],{'$or':_['map'](_0x1a0da5,function(_0x53b955){if(_0x53b955[_0x70f9('0x35')]!==_0x70f9('0x36')){var _0x3385f9={};_0x3385f9[_0x53b955[_0x70f9('0x24')]]={'$like':'%'+_0x345c11[_0x70f9('0x2c')][_0x70f9('0x37')]+'%'};return _0x3385f9;}})});}_0x54ddcd=_[_0x70f9('0x38')]({},_0x54ddcd,_0x345c11[_0x70f9('0x39')]);var _0x16c40c={'where':_0x54ddcd['where']};return db[_0x70f9('0x28')][_0x70f9('0x19')](_0x16c40c)[_0x70f9('0x21')](function(_0x27b717){_0x37d551[_0x70f9('0x19')]=_0x27b717;if(_0x345c11[_0x70f9('0x2c')]['includeAll']){_0x54ddcd[_0x70f9('0x3a')]=[{'all':!![]}];}return db[_0x70f9('0x28')][_0x70f9('0x3b')](_0x54ddcd);})[_0x70f9('0x21')](function(_0x255a8f){_0x37d551['rows']=_0x255a8f;return _0x37d551;})[_0x70f9('0x21')](respondWithFilteredResult(_0xfe324e,_0x54ddcd))['catch'](handleError(_0xfe324e,null));};exports[_0x70f9('0x3c')]=function(_0x4cb3b8,_0x40cdd2){var _0x54452c={'raw':!![],'where':{'id':_0x4cb3b8['params']['id']}},_0x8c3827={};_0x8c3827['model']=_[_0x70f9('0x3d')](db['JscriptyAnswerReport'][_0x70f9('0x29')]);_0x8c3827['query']=_[_0x70f9('0x3d')](_0x4cb3b8[_0x70f9('0x2c')]);_0x8c3827[_0x70f9('0x2d')]=_['intersection'](_0x8c3827['model'],_0x8c3827[_0x70f9('0x2c')]);_0x54452c[_0x70f9('0x2e')]=_['intersection'](_0x8c3827[_0x70f9('0x2b')],qs[_0x70f9('0x2f')](_0x4cb3b8[_0x70f9('0x2c')][_0x70f9('0x2f')]));_0x54452c[_0x70f9('0x2e')]=_0x54452c[_0x70f9('0x2e')][_0x70f9('0x3e')]?_0x54452c['attributes']:_0x8c3827[_0x70f9('0x2b')];if(_0x4cb3b8[_0x70f9('0x2c')][_0x70f9('0x3f')]){_0x54452c[_0x70f9('0x3a')]=[{'all':!![]}];}_0x54452c=_['merge']({},_0x54452c,_0x4cb3b8[_0x70f9('0x39')]);return db[_0x70f9('0x28')][_0x70f9('0x40')](_0x54452c)[_0x70f9('0x21')](handleEntityNotFound(_0x40cdd2,null))[_0x70f9('0x21')](respondWithResult(_0x40cdd2,null))[_0x70f9('0x41')](handleError(_0x40cdd2,null));};exports['create']=function(_0x34e4da,_0x15a22e){return db[_0x70f9('0x28')][_0x70f9('0x42')](_0x34e4da['body'],{})[_0x70f9('0x21')](respondWithResult(_0x15a22e,0xc9))['catch'](handleError(_0x15a22e,null));};exports[_0x70f9('0x1f')]=function(_0x4a10de,_0x322f0b){if(_0x4a10de[_0x70f9('0x43')]['id']){delete _0x4a10de[_0x70f9('0x43')]['id'];}return db[_0x70f9('0x28')][_0x70f9('0x40')]({'where':{'id':_0x4a10de['params']['id']}})[_0x70f9('0x21')](handleEntityNotFound(_0x322f0b,null))['then'](saveUpdates(_0x4a10de[_0x70f9('0x43')],null))[_0x70f9('0x21')](respondWithResult(_0x322f0b,null))[_0x70f9('0x41')](handleError(_0x322f0b,null));};exports[_0x70f9('0x20')]=function(_0x15b024,_0x59c385){return db[_0x70f9('0x28')]['find']({'where':{'id':_0x15b024['params']['id']}})[_0x70f9('0x21')](handleEntityNotFound(_0x59c385,null))[_0x70f9('0x21')](removeEntity(_0x59c385,null))['catch'](handleError(_0x59c385,null));};exports[_0x70f9('0x44')]=function(_0x175083,_0x3e9fa5){return db[_0x70f9('0x28')][_0x70f9('0x44')]()[_0x70f9('0x21')](respondWithResult(_0x3e9fa5,null))[_0x70f9('0x41')](handleError(_0x3e9fa5,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 3df5738..aa63339 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 _0x4bfb=['lodash','util','../../config/logger','api','bluebird','request-promise','path','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers'];(function(_0x2d1ccb,_0x426e38){var _0x53b731=function(_0x304de5){while(--_0x304de5){_0x2d1ccb['push'](_0x2d1ccb['shift']());}};_0x53b731(++_0x426e38);}(_0x4bfb,0x150));var _0xb4bf=function(_0x3abe58,_0x184dd9){_0x3abe58=_0x3abe58-0x0;var _0x457389=_0x4bfb[_0x3abe58];return _0x457389;};'use strict';var _=require(_0xb4bf('0x0'));var util=require(_0xb4bf('0x1'));var logger=require(_0xb4bf('0x2'))(_0xb4bf('0x3'));var moment=require('moment');var BPromise=require(_0xb4bf('0x4'));var rp=require(_0xb4bf('0x5'));var fs=require('fs');var path=require(_0xb4bf('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb4bf('0x7'));module[_0xb4bf('0x8')]=function(_0x9f9815,_0x12ad6f){return _0x9f9815[_0xb4bf('0x9')](_0xb4bf('0xa'),attributes,{'tableName':_0xb4bf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6a8=['../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4861d3,_0x23bbd1){var _0x2e3c41=function(_0xe07f3f){while(--_0xe07f3f){_0x4861d3['push'](_0x4861d3['shift']());}};_0x2e3c41(++_0x23bbd1);}(_0xc6a8,0x157));var _0x8c6a=function(_0x19523f,_0x561781){_0x19523f=_0x19523f-0x0;var _0x45993c=_0xc6a8[_0x19523f];return _0x45993c;};'use strict';var _=require(_0x8c6a('0x0'));var util=require(_0x8c6a('0x1'));var logger=require(_0x8c6a('0x2'))('api');var moment=require(_0x8c6a('0x3'));var BPromise=require(_0x8c6a('0x4'));var rp=require(_0x8c6a('0x5'));var fs=require('fs');var path=require(_0x8c6a('0x6'));var rimraf=require(_0x8c6a('0x7'));var config=require(_0x8c6a('0x8'));var attributes=require(_0x8c6a('0x9'));module[_0x8c6a('0xa')]=function(_0x5713ab,_0x15c5a5){return _0x5713ab['define'](_0x8c6a('0xb'),attributes,{'tableName':_0x8c6a('0xc'),'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 4f386cc..35f462b 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 _0xe34e=['catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x29defb,_0x45a8c5){var _0x4f3da8=function(_0x172327){while(--_0x172327){_0x29defb['push'](_0x29defb['shift']());}};_0x4f3da8(++_0x45a8c5);}(_0xe34e,0x190));var _0xee34=function(_0x30b938,_0x45f41a){_0x30b938=_0x30b938-0x0;var _0x430188=_0xe34e[_0x30b938];return _0x430188;};'use strict';var _=require(_0xee34('0x0'));var util=require('util');var moment=require(_0xee34('0x1'));var BPromise=require(_0xee34('0x2'));var rs=require(_0xee34('0x3'));var fs=require('fs');var Redis=require(_0xee34('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xee34('0x5'))('rpc');var config=require(_0xee34('0x6'));var jayson=require(_0xee34('0x7'));var client=jayson['client'][_0xee34('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x6fe18a,_0x44329a,_0x3bd7c){return new BPromise(function(_0x2f0413,_0x46f14b){return client[_0xee34('0x9')](_0x6fe18a,_0x3bd7c)[_0xee34('0xa')](function(_0x1d96fc){logger[_0xee34('0xb')](_0xee34('0xc'),_0x44329a,'request\x20sent');logger[_0xee34('0xd')](_0xee34('0xe'),_0x44329a,_0xee34('0xf'),JSON[_0xee34('0x10')](_0x1d96fc));if(_0x1d96fc[_0xee34('0x11')]){if(_0x1d96fc[_0xee34('0x11')]['code']===0x1f4){logger[_0xee34('0x11')](_0xee34('0xc'),_0x44329a,_0x1d96fc['error'][_0xee34('0x12')]);return _0x46f14b(_0x1d96fc['error'][_0xee34('0x12')]);}logger[_0xee34('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x44329a,_0x1d96fc[_0xee34('0x11')][_0xee34('0x12')]);return _0x2f0413(_0x1d96fc['error'][_0xee34('0x12')]);}else{logger[_0xee34('0xb')](_0xee34('0xc'),_0x44329a,_0xee34('0xf'));_0x2f0413(_0x1d96fc[_0xee34('0x13')][_0xee34('0x12')]);}})[_0xee34('0x14')](function(_0x11bfed){logger['error'](_0xee34('0xc'),_0x44329a,_0x11bfed);_0x46f14b(_0x11bfed);});});} \ No newline at end of file +var _0x0ae2=['http','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','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ae2,0xe9));var _0x20ae=function(_0x57da0a,_0x284aed){_0x57da0a=_0x57da0a-0x0;var _0x3145d5=_0x0ae2[_0x57da0a];return _0x3145d5;};'use strict';var _=require(_0x20ae('0x0'));var util=require(_0x20ae('0x1'));var moment=require('moment');var BPromise=require(_0x20ae('0x2'));var rs=require(_0x20ae('0x3'));var fs=require('fs');var Redis=require(_0x20ae('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x20ae('0x5'))(_0x20ae('0x6'));var config=require('../../config/environment');var jayson=require(_0x20ae('0x7'));var client=jayson[_0x20ae('0x8')][_0x20ae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x318551,_0x25ec01,_0x178a57){return new BPromise(function(_0x32173c,_0x128853){return client[_0x20ae('0xa')](_0x318551,_0x178a57)[_0x20ae('0xb')](function(_0x55306b){logger[_0x20ae('0xc')](_0x20ae('0xd'),_0x25ec01,_0x20ae('0xe'));logger[_0x20ae('0xf')](_0x20ae('0x10'),_0x25ec01,_0x20ae('0xe'),JSON[_0x20ae('0x11')](_0x55306b));if(_0x55306b[_0x20ae('0x12')]){if(_0x55306b[_0x20ae('0x12')][_0x20ae('0x13')]===0x1f4){logger[_0x20ae('0x12')](_0x20ae('0xd'),_0x25ec01,_0x55306b[_0x20ae('0x12')][_0x20ae('0x14')]);return _0x128853(_0x55306b[_0x20ae('0x12')]['message']);}logger[_0x20ae('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x25ec01,_0x55306b[_0x20ae('0x12')][_0x20ae('0x14')]);return _0x32173c(_0x55306b[_0x20ae('0x12')][_0x20ae('0x14')]);}else{logger[_0x20ae('0xc')](_0x20ae('0xd'),_0x25ec01,_0x20ae('0xe'));_0x32173c(_0x55306b[_0x20ae('0x15')]['message']);}})['catch'](function(_0x6fc9b7){logger['error'](_0x20ae('0xd'),_0x25ec01,_0x6fc9b7);_0x128853(_0x6fc9b7);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 9707dea..418bbff 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 _0xeaab=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','update','destroy'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xeaab,0xeb));var _0xbeaa=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xeaab[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xbeaa('0x0'));var util=require(_0xbeaa('0x1'));var path=require(_0xbeaa('0x2'));var timeout=require(_0xbeaa('0x3'));var express=require('express');var router=express[_0xbeaa('0x4')]();var auth=require(_0xbeaa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbeaa('0x6'));var controller=require(_0xbeaa('0x7'));router[_0xbeaa('0x8')]('/',auth[_0xbeaa('0x9')](),controller[_0xbeaa('0xa')]);router[_0xbeaa('0x8')](_0xbeaa('0xb'),auth[_0xbeaa('0x9')](),controller[_0xbeaa('0xc')]);router[_0xbeaa('0x8')](_0xbeaa('0xd'),auth[_0xbeaa('0x9')](),controller[_0xbeaa('0xe')]);router[_0xbeaa('0x8')]('/:id/answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0xbeaa('0x8')](_0xbeaa('0xf'),auth['isAuthenticated'](),timeout(_0xbeaa('0x10')),controller[_0xbeaa('0x11')]);router[_0xbeaa('0x12')]('/',auth[_0xbeaa('0x9')](),controller[_0xbeaa('0x13')]);router['post'](_0xbeaa('0x14'),auth[_0xbeaa('0x9')](),controller[_0xbeaa('0x15')]);router[_0xbeaa('0x16')](_0xbeaa('0xb'),auth[_0xbeaa('0x9')](),controller[_0xbeaa('0x17')]);router['delete'](_0xbeaa('0xb'),auth['isAuthenticated'](),controller[_0xbeaa('0x18')]);module[_0xbeaa('0x19')]=router; \ No newline at end of file +var _0xda58=['./jscriptyProject.controller','get','isAuthenticated','show','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','update','/:id','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xda58,0x1c5));var _0x8da5=function(_0x241a6b,_0x13df29){_0x241a6b=_0x241a6b-0x0;var _0x363354=_0xda58[_0x241a6b];return _0x363354;};'use strict';var multer=require(_0x8da5('0x0'));var util=require(_0x8da5('0x1'));var path=require('path');var timeout=require(_0x8da5('0x2'));var express=require(_0x8da5('0x3'));var router=express['Router']();var auth=require(_0x8da5('0x4'));var interaction=require(_0x8da5('0x5'));var config=require(_0x8da5('0x6'));var controller=require(_0x8da5('0x7'));router[_0x8da5('0x8')]('/',auth[_0x8da5('0x9')](),controller['index']);router[_0x8da5('0x8')]('/:id',auth[_0x8da5('0x9')](),controller[_0x8da5('0xa')]);router[_0x8da5('0x8')]('/:id/sessions',auth[_0x8da5('0x9')](),controller['getSessions']);router['get'](_0x8da5('0xb'),auth['isAuthenticated'](),controller[_0x8da5('0xc')]);router['get'](_0x8da5('0xd'),auth[_0x8da5('0x9')](),timeout(_0x8da5('0xe')),controller[_0x8da5('0xf')]);router[_0x8da5('0x10')]('/',auth[_0x8da5('0x9')](),controller[_0x8da5('0x11')]);router[_0x8da5('0x10')](_0x8da5('0x12'),auth[_0x8da5('0x9')](),controller['clone']);router['put']('/:id',auth[_0x8da5('0x9')](),controller[_0x8da5('0x13')]);router['delete'](_0x8da5('0x14'),auth['isAuthenticated'](),controller[_0x8da5('0x15')]);module[_0x8da5('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 6bc3e6b..3dc8765 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 _0x51eb=['isObjectLike','setDataValue','formData','stringify','format','getDataValue','name','description','BOOLEAN','sequelize','lodash','util','exports','STRING','TEXT','long'];(function(_0x545252,_0x27a35b){var _0x46f59c=function(_0x18be8d){while(--_0x18be8d){_0x545252['push'](_0x545252['shift']());}};_0x46f59c(++_0x27a35b);}(_0x51eb,0xd9));var _0xb51e=function(_0x3a29d7,_0x2d1f36){_0x3a29d7=_0x3a29d7-0x0;var _0x3fe1d7=_0x51eb[_0x3a29d7];return _0x3fe1d7;};'use strict';var Sequelize=require(_0xb51e('0x0'));var _=require(_0xb51e('0x1'));var util=require(_0xb51e('0x2'));module[_0xb51e('0x3')]={'name':{'type':Sequelize[_0xb51e('0x4')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xb51e('0x5')](_0xb51e('0x6')),'set':function(_0x243574){if(_[_0xb51e('0x7')](_0x243574)){this[_0xb51e('0x8')](_0xb51e('0x9'),JSON[_0xb51e('0xa')](_0x243574));}else if(_['isString'](_0x243574)){this[_0xb51e('0x8')]('formData',_0x243574);}else{this[_0xb51e('0x8')](_0xb51e('0x9'),util[_0xb51e('0xb')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xb51e('0xc')](_0xb51e('0xd'))||'',this['getDataValue'](_0xb51e('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xb51e('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1dbd=['setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','STRING','name','long','isObjectLike'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1dbd,0xaf));var _0xd1db=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dbd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd1db('0x0'));var _=require(_0xd1db('0x1'));var util=require(_0xd1db('0x2'));module['exports']={'name':{'type':Sequelize[_0xd1db('0x3')],'unique':_0xd1db('0x4')},'description':{'type':Sequelize[_0xd1db('0x3')]},'formData':{'type':Sequelize['TEXT'](_0xd1db('0x5')),'set':function(_0x416d62){if(_[_0xd1db('0x6')](_0x416d62)){this[_0xd1db('0x7')](_0xd1db('0x8'),JSON['stringify'](_0x416d62));}else if(_['isString'](_0x416d62)){this[_0xd1db('0x7')](_0xd1db('0x8'),_0x416d62);}else{this['setDataValue'](_0xd1db('0x8'),util[_0xd1db('0x9')](_0xd1db('0xa'),this[_0xd1db('0xb')](_0xd1db('0x4'))||'',this['getDataValue'](_0xd1db('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xd1db('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xd1db('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 705197a..0475b80 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 _0x0f84=['count','offset','limit','set','apply','save','update','then','Projects','name','send','index','map','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','JscriptyProject','includeAll','include','rows','catch','show','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','error','getSessions','findOne','JscriptySessionReport','ProjectId','findAll','getAnswers','JscriptyAnswerReport','order','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','SessionId','answer','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Content-type','text/csv','download','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x20b858,_0x79b422){var _0x8ad9ff=function(_0x65b32f){while(--_0x65b32f){_0x20b858['push'](_0x20b858['shift']());}};_0x8ad9ff(++_0x79b422);}(_0x0f84,0x1b8));var _0x40f8=function(_0x4a257f,_0x36cccb){_0x4a257f=_0x4a257f-0x0;var _0x364b91=_0x0f84[_0x4a257f];return _0x364b91;};'use strict';var pdf=require(_0x40f8('0x0'));var emlformat=require(_0x40f8('0x1'));var rimraf=require(_0x40f8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x40f8('0x3'));var rp=require(_0x40f8('0x4'));var moment=require(_0x40f8('0x5'));var BPromise=require(_0x40f8('0x6'));var Mustache=require(_0x40f8('0x7'));var util=require('util');var path=require(_0x40f8('0x8'));var sox=require(_0x40f8('0x9'));var csv=require('to-csv');var ejs=require(_0x40f8('0xa'));var fs=require('fs');var _=require(_0x40f8('0xb'));var squel=require(_0x40f8('0xc'));var crypto=require(_0x40f8('0xd'));var jsforce=require(_0x40f8('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x40f8('0xf'));var Redis=require(_0x40f8('0x10'));var authService=require(_0x40f8('0x11'));var qs=require(_0x40f8('0x12'));var as=require(_0x40f8('0x13'));var hardwareService=require(_0x40f8('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x40f8('0x15'));var config=require(_0x40f8('0x16'));var db=require(_0x40f8('0x17'))['db'];function respondWithStatusCode(_0x1ee823,_0xc270f9){_0xc270f9=_0xc270f9||0xcc;return function(_0x47937f){if(_0x47937f){return _0x1ee823[_0x40f8('0x18')](_0xc270f9);}return _0x1ee823[_0x40f8('0x19')](_0xc270f9)[_0x40f8('0x1a')]();};}function respondWithResult(_0x3b1e3d,_0x409b36){_0x409b36=_0x409b36||0xc8;return function(_0x116ee0){if(_0x116ee0){return _0x3b1e3d[_0x40f8('0x19')](_0x409b36)[_0x40f8('0x1b')](_0x116ee0);}};}function respondWithFilteredResult(_0x1aa3d7,_0x1c06c0){return function(_0x3f9ce1){if(_0x3f9ce1){var _0x16cc69=_0x3f9ce1[_0x40f8('0x1c')],_0x39f7ec=_0x1c06c0[_0x40f8('0x1d')],_0x368bcd=_0x1c06c0['offset']+_0x1c06c0[_0x40f8('0x1e')],_0x117797;if(_0x368bcd>=_0x16cc69){_0x368bcd=_0x16cc69;_0x117797=0xc8;}else{_0x117797=0xce;}_0x1aa3d7[_0x40f8('0x19')](_0x117797);return _0x1aa3d7[_0x40f8('0x1f')]('Content-Range',_0x39f7ec+'-'+_0x368bcd+'/'+_0x16cc69)[_0x40f8('0x1b')](_0x3f9ce1);}return null;};}function patchUpdates(_0x177673){return function(_0x392f60){try{jsonpatch[_0x40f8('0x20')](_0x392f60,_0x177673,!![]);}catch(_0x9c95f6){return BPromise['reject'](_0x9c95f6);}return _0x392f60[_0x40f8('0x21')]();};}function saveUpdates(_0x1ceee3,_0x2d96bf){return function(_0xcf2790){if(_0xcf2790){return _0xcf2790[_0x40f8('0x22')](_0x1ceee3)[_0x40f8('0x23')](function(_0x21e7bc){return _0x21e7bc;});}return null;};}function removeEntity(_0x395540,_0x13b4bf){return function(_0x22ddff){if(_0x22ddff){return _0x22ddff['destroy']()[_0x40f8('0x23')](function(){var _0x58c304=_0x22ddff['get']({'plain':!![]});var _0x2e6ccc=_0x40f8('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x2e6ccc,'resourceId':_0x58c304['id']}})[_0x40f8('0x23')](function(){return _0x22ddff;});})[_0x40f8('0x23')](function(){_0x395540[_0x40f8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19a245,_0x3ed72f){return function(_0xcd620e){if(!_0xcd620e){_0x19a245[_0x40f8('0x18')](0x194);}return _0xcd620e;};}function handleError(_0x26680a,_0xa9a619){_0xa9a619=_0xa9a619||0x1f4;return function(_0x3349aa){logger['error'](_0x3349aa['stack']);if(_0x3349aa[_0x40f8('0x25')]){delete _0x3349aa[_0x40f8('0x25')];}_0x26680a[_0x40f8('0x19')](_0xa9a619)[_0x40f8('0x26')](_0x3349aa);};}exports[_0x40f8('0x27')]=function(_0xb3d2ef,_0x26a8e1){var _0x260164={},_0x2125dc={},_0x5e7c50={'count':0x0,'rows':[]};var _0x3f524b=_[_0x40f8('0x28')](db['JscriptyProject']['rawAttributes'],function(_0x1f7623){return{'name':_0x1f7623['fieldName'],'type':_0x1f7623[_0x40f8('0x29')][_0x40f8('0x2a')]};});_0x2125dc[_0x40f8('0x2b')]=_['map'](_0x3f524b,'name');_0x2125dc[_0x40f8('0x2c')]=_[_0x40f8('0x2d')](_0xb3d2ef[_0x40f8('0x2c')]);_0x2125dc[_0x40f8('0x2e')]=_['intersection'](_0x2125dc[_0x40f8('0x2b')],_0x2125dc[_0x40f8('0x2c')]);_0x260164[_0x40f8('0x2f')]=_[_0x40f8('0x30')](_0x2125dc[_0x40f8('0x2b')],qs[_0x40f8('0x31')](_0xb3d2ef[_0x40f8('0x2c')]['fields']));_0x260164[_0x40f8('0x2f')]=_0x260164[_0x40f8('0x2f')][_0x40f8('0x32')]?_0x260164[_0x40f8('0x2f')]:_0x2125dc['model'];if(!_0xb3d2ef[_0x40f8('0x2c')][_0x40f8('0x33')](_0x40f8('0x34'))){_0x260164[_0x40f8('0x1e')]=qs[_0x40f8('0x1e')](_0xb3d2ef['query']['limit']);_0x260164['offset']=qs[_0x40f8('0x1d')](_0xb3d2ef[_0x40f8('0x2c')][_0x40f8('0x1d')]);}_0x260164['order']=qs[_0x40f8('0x35')](_0xb3d2ef[_0x40f8('0x2c')][_0x40f8('0x35')]);_0x260164[_0x40f8('0x36')]=qs['filters'](_[_0x40f8('0x37')](_0xb3d2ef[_0x40f8('0x2c')],_0x2125dc['filters']));if(_0xb3d2ef[_0x40f8('0x2c')][_0x40f8('0x38')]){_0x260164[_0x40f8('0x36')]=_[_0x40f8('0x39')](_0x260164[_0x40f8('0x36')],{'$or':_[_0x40f8('0x28')](_0x3f524b,function(_0x5b241a){if(_0x5b241a['type']!==_0x40f8('0x3a')){var _0x350f43={};_0x350f43[_0x5b241a[_0x40f8('0x25')]]={'$like':'%'+_0xb3d2ef[_0x40f8('0x2c')]['filter']+'%'};return _0x350f43;}})});}_0x260164=_[_0x40f8('0x39')]({},_0x260164,_0xb3d2ef[_0x40f8('0x3b')]);var _0x4da2e7={'where':_0x260164[_0x40f8('0x36')]};return db[_0x40f8('0x3c')][_0x40f8('0x1c')](_0x4da2e7)[_0x40f8('0x23')](function(_0x22189d){_0x5e7c50[_0x40f8('0x1c')]=_0x22189d;if(_0xb3d2ef[_0x40f8('0x2c')][_0x40f8('0x3d')]){_0x260164[_0x40f8('0x3e')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x260164);})[_0x40f8('0x23')](function(_0xc651c){_0x5e7c50[_0x40f8('0x3f')]=_0xc651c;return _0x5e7c50;})['then'](respondWithFilteredResult(_0x26a8e1,_0x260164))[_0x40f8('0x40')](handleError(_0x26a8e1,null));};exports[_0x40f8('0x41')]=function(_0x35d876,_0x48ceb9){var _0x4ea721={'raw':![],'where':{'id':_0x35d876['params']['id']}},_0x68d43a={};_0x68d43a[_0x40f8('0x2b')]=_[_0x40f8('0x2d')](db['JscriptyProject'][_0x40f8('0x42')]);_0x68d43a[_0x40f8('0x2c')]=_[_0x40f8('0x2d')](_0x35d876[_0x40f8('0x2c')]);_0x68d43a[_0x40f8('0x2e')]=_[_0x40f8('0x30')](_0x68d43a[_0x40f8('0x2b')],_0x68d43a[_0x40f8('0x2c')]);_0x4ea721[_0x40f8('0x2f')]=_[_0x40f8('0x30')](_0x68d43a[_0x40f8('0x2b')],qs['fields'](_0x35d876['query'][_0x40f8('0x31')]));_0x4ea721[_0x40f8('0x2f')]=_0x4ea721[_0x40f8('0x2f')]['length']?_0x4ea721[_0x40f8('0x2f')]:_0x68d43a[_0x40f8('0x2b')];if(_0x35d876[_0x40f8('0x2c')][_0x40f8('0x3d')]){_0x4ea721[_0x40f8('0x3e')]=[{'all':!![]}];}_0x4ea721=_[_0x40f8('0x39')]({},_0x4ea721,_0x35d876['options']);return db['JscriptyProject']['find'](_0x4ea721)[_0x40f8('0x23')](handleEntityNotFound(_0x48ceb9,null))['then'](respondWithResult(_0x48ceb9,null))[_0x40f8('0x40')](handleError(_0x48ceb9,null));};exports[_0x40f8('0x43')]=function(_0x2b921a,_0x199943){return db[_0x40f8('0x3c')]['create'](_0x2b921a[_0x40f8('0x44')],{})[_0x40f8('0x23')](function(_0x4f6b50){var _0x15449f=_0x2b921a[_0x40f8('0x45')]['get']({'plain':!![]});if(!_0x15449f)throw new Error(_0x40f8('0x46'));if(_0x15449f[_0x40f8('0x47')]==='user'){var _0x1788c4=_0x4f6b50[_0x40f8('0x48')]({'plain':!![]});var _0x4ac5eb=_0x40f8('0x24');return db[_0x40f8('0x49')][_0x40f8('0x4a')]({'where':{'name':_0x4ac5eb,'userProfileId':_0x15449f[_0x40f8('0x4b')]},'raw':!![]})['then'](function(_0x55a38e){if(_0x55a38e&&_0x55a38e[_0x40f8('0x4c')]===0x0){return db[_0x40f8('0x4d')][_0x40f8('0x43')]({'name':_0x1788c4['name'],'resourceId':_0x1788c4['id'],'type':_0x55a38e['name'],'sectionId':_0x55a38e['id']},{})['then'](function(){return _0x4f6b50;});}else{return _0x4f6b50;}})[_0x40f8('0x40')](function(_0x397a32){logger['error'](_0x40f8('0x4e'),_0x397a32);throw _0x397a32;});}return _0x4f6b50;})['then'](respondWithResult(_0x199943,0xc9))[_0x40f8('0x40')](handleError(_0x199943,null));};exports[_0x40f8('0x4f')]=function(_0x4d3735,_0x4c20e1){var _0x2329b3={'where':{'id':_0x4d3735[_0x40f8('0x50')]['id']}},_0x5bd095={};_0x5bd095['model']=_['keys'](db[_0x40f8('0x3c')][_0x40f8('0x42')]);_0x2329b3[_0x40f8('0x2f')]=_[_0x40f8('0x30')](_0x5bd095[_0x40f8('0x2b')],qs[_0x40f8('0x31')](_0x4d3735[_0x40f8('0x2c')][_0x40f8('0x31')]));_0x2329b3[_0x40f8('0x2f')]=_0x2329b3[_0x40f8('0x2f')][_0x40f8('0x32')]?_0x2329b3[_0x40f8('0x2f')]:_0x5bd095['model'];if(_0x4d3735[_0x40f8('0x2c')][_0x40f8('0x3d')]){_0x2329b3[_0x40f8('0x3e')]=[{'all':!![]}];}_0x2329b3=_[_0x40f8('0x39')]({},_0x2329b3,_0x4d3735[_0x40f8('0x3b')]);return db[_0x40f8('0x3c')][_0x40f8('0x4a')](_0x2329b3)['then'](handleEntityNotFound(_0x4c20e1,null))[_0x40f8('0x23')](function(_0x3de714){if(_0x3de714){var _0xa580a2=_0x3de714[_0x40f8('0x48')]({'plain':!![]});_0xa580a2=qs[_0x40f8('0x51')](_0xa580a2,['id',_0x40f8('0x52'),_0x40f8('0x53')]);_0x4d3735[_0x40f8('0x44')]=_[_0x40f8('0x51')](_0x4d3735['body'],['id','createdAt',_0x40f8('0x53')]);return db['JscriptyProject'][_0x40f8('0x43')](_[_0x40f8('0x39')](_0xa580a2,_0x4d3735[_0x40f8('0x44')]),{'include':_0x4d3735[_0x40f8('0x2c')][_0x40f8('0x3d')]?[{'all':!![]}]:undefined})['then'](function(_0x30ef2e){var _0x135bc8=_0x4d3735['user']['get']({'plain':!![]});if(!_0x135bc8)throw new Error(_0x40f8('0x46'));if(_0x135bc8[_0x40f8('0x47')]===_0x40f8('0x45')){var _0x2a61df=_0x30ef2e[_0x40f8('0x48')]({'plain':!![]});var _0x3dcb27=_0x40f8('0x24');return db[_0x40f8('0x49')][_0x40f8('0x4a')]({'where':{'name':_0x3dcb27,'userProfileId':_0x135bc8[_0x40f8('0x4b')]},'raw':!![]})[_0x40f8('0x23')](function(_0x279406){if(_0x279406&&_0x279406[_0x40f8('0x4c')]===0x0){return db[_0x40f8('0x4d')]['create']({'name':_0x2a61df['name'],'resourceId':_0x2a61df['id'],'type':_0x279406['name'],'sectionId':_0x279406['id']},{})[_0x40f8('0x23')](function(){return _0x30ef2e;});}else{return _0x30ef2e;}})[_0x40f8('0x40')](function(_0x3d1878){logger[_0x40f8('0x54')](_0x40f8('0x4e'),_0x3d1878);throw _0x3d1878;});}return _0x30ef2e;});}})[_0x40f8('0x23')](respondWithResult(_0x4c20e1,0xc9))[_0x40f8('0x40')](handleError(_0x4c20e1,null));};exports[_0x40f8('0x22')]=function(_0x51d98b,_0x6306fb){if(_0x51d98b[_0x40f8('0x44')]['id']){delete _0x51d98b[_0x40f8('0x44')]['id'];}return db[_0x40f8('0x3c')]['find']({'where':{'id':_0x51d98b[_0x40f8('0x50')]['id']}})[_0x40f8('0x23')](handleEntityNotFound(_0x6306fb,null))[_0x40f8('0x23')](saveUpdates(_0x51d98b[_0x40f8('0x44')],null))[_0x40f8('0x23')](respondWithResult(_0x6306fb,null))[_0x40f8('0x40')](handleError(_0x6306fb,null));};exports['destroy']=function(_0x526b4a,_0x1a913e){return db[_0x40f8('0x3c')][_0x40f8('0x4a')]({'where':{'id':_0x526b4a[_0x40f8('0x50')]['id']}})[_0x40f8('0x23')](handleEntityNotFound(_0x1a913e,null))[_0x40f8('0x23')](removeEntity(_0x1a913e,null))[_0x40f8('0x40')](handleError(_0x1a913e,null));};exports[_0x40f8('0x55')]=function(_0x1b5934,_0x260028,_0x10ead8){var _0x24533d={'raw':!![],'where':{}};var _0x1b2fd1={};var _0x37b5bc={'count':0x0,'rows':[]};return db[_0x40f8('0x3c')][_0x40f8('0x56')]({'where':{'id':_0x1b5934[_0x40f8('0x50')]['id']}})[_0x40f8('0x23')](handleEntityNotFound(_0x260028,null))['then'](function(_0x5e5519){if(_0x5e5519){_0x1b2fd1[_0x40f8('0x2b')]=_[_0x40f8('0x2d')](db[_0x40f8('0x57')][_0x40f8('0x42')]);_0x1b2fd1[_0x40f8('0x2c')]=_[_0x40f8('0x2d')](_0x1b5934[_0x40f8('0x2c')]);_0x1b2fd1[_0x40f8('0x2e')]=_[_0x40f8('0x30')](_0x1b2fd1['model'],_0x1b2fd1[_0x40f8('0x2c')]);_0x24533d[_0x40f8('0x2f')]=_[_0x40f8('0x30')](_0x1b2fd1[_0x40f8('0x2b')],qs[_0x40f8('0x31')](_0x1b5934[_0x40f8('0x2c')][_0x40f8('0x31')]));_0x24533d[_0x40f8('0x2f')]=_0x24533d[_0x40f8('0x2f')]['length']?_0x24533d[_0x40f8('0x2f')]:_0x1b2fd1['model'];if(!_0x1b5934[_0x40f8('0x2c')]['hasOwnProperty'](_0x40f8('0x34'))){_0x24533d[_0x40f8('0x1e')]=qs[_0x40f8('0x1e')](_0x1b5934[_0x40f8('0x2c')][_0x40f8('0x1e')]);_0x24533d['offset']=qs[_0x40f8('0x1d')](_0x1b5934[_0x40f8('0x2c')][_0x40f8('0x1d')]);}_0x24533d['order']=qs['sort'](_0x1b5934[_0x40f8('0x2c')]['sort']);_0x24533d[_0x40f8('0x36')]=qs[_0x40f8('0x2e')](_['pick'](_0x1b5934['query'],_0x1b2fd1['filters']));_0x24533d[_0x40f8('0x36')][_0x40f8('0x58')]=_0x5e5519['id'];if(_0x1b5934[_0x40f8('0x2c')][_0x40f8('0x38')]){_0x24533d[_0x40f8('0x36')]=_[_0x40f8('0x39')](_0x24533d[_0x40f8('0x36')],{'$or':_['map'](_0x24533d[_0x40f8('0x2f')],function(_0x3278c0){var _0xdb25f3={};_0xdb25f3[_0x3278c0]={'$like':'%'+_0x1b5934[_0x40f8('0x2c')][_0x40f8('0x38')]+'%'};return _0xdb25f3;})});}_0x24533d=_[_0x40f8('0x39')]({},_0x24533d,_0x1b5934[_0x40f8('0x3b')]);return db[_0x40f8('0x57')][_0x40f8('0x1c')]({'where':_0x24533d[_0x40f8('0x36')]})['then'](function(_0x411c39){_0x37b5bc['count']=_0x411c39;if(_0x1b5934[_0x40f8('0x2c')]['includeAll']){_0x24533d['include']=[{'all':!![]}];}return db[_0x40f8('0x57')][_0x40f8('0x59')](_0x24533d);})[_0x40f8('0x23')](function(_0x57aaab){_0x37b5bc['rows']=_0x57aaab;return _0x37b5bc;});}})[_0x40f8('0x23')](respondWithFilteredResult(_0x260028,_0x24533d))[_0x40f8('0x40')](handleError(_0x260028,null));};exports[_0x40f8('0x5a')]=function(_0x50ff47,_0x436cfd,_0x327f83){var _0x4ba515={'raw':!![],'where':{}};var _0x673e97={};var _0x3075af={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x40f8('0x56')]({'where':{'id':_0x50ff47['params']['id']}})[_0x40f8('0x23')](handleEntityNotFound(_0x436cfd,null))[_0x40f8('0x23')](function(_0x5712d1){if(_0x5712d1){_0x673e97[_0x40f8('0x2b')]=_[_0x40f8('0x2d')](db[_0x40f8('0x5b')][_0x40f8('0x42')]);_0x673e97[_0x40f8('0x2c')]=_[_0x40f8('0x2d')](_0x50ff47['query']);_0x673e97[_0x40f8('0x2e')]=_['intersection'](_0x673e97[_0x40f8('0x2b')],_0x673e97[_0x40f8('0x2c')]);_0x4ba515[_0x40f8('0x2f')]=_[_0x40f8('0x30')](_0x673e97['model'],qs[_0x40f8('0x31')](_0x50ff47[_0x40f8('0x2c')]['fields']));_0x4ba515[_0x40f8('0x2f')]=_0x4ba515['attributes'][_0x40f8('0x32')]?_0x4ba515[_0x40f8('0x2f')]:_0x673e97[_0x40f8('0x2b')];if(!_0x50ff47[_0x40f8('0x2c')]['hasOwnProperty'](_0x40f8('0x34'))){_0x4ba515['limit']=qs['limit'](_0x50ff47[_0x40f8('0x2c')][_0x40f8('0x1e')]);_0x4ba515[_0x40f8('0x1d')]=qs[_0x40f8('0x1d')](_0x50ff47['query'][_0x40f8('0x1d')]);}_0x4ba515[_0x40f8('0x5c')]=qs[_0x40f8('0x35')](_0x50ff47[_0x40f8('0x2c')][_0x40f8('0x35')]);_0x4ba515[_0x40f8('0x36')]=qs[_0x40f8('0x2e')](_[_0x40f8('0x37')](_0x50ff47['query'],_0x673e97['filters']));_0x4ba515[_0x40f8('0x36')][_0x40f8('0x58')]=_0x5712d1['id'];if(_0x50ff47[_0x40f8('0x2c')][_0x40f8('0x38')]){_0x4ba515[_0x40f8('0x36')]=_[_0x40f8('0x39')](_0x4ba515[_0x40f8('0x36')],{'$or':_[_0x40f8('0x28')](_0x4ba515[_0x40f8('0x2f')],function(_0x3fc968){var _0xade91e={};_0xade91e[_0x3fc968]={'$like':'%'+_0x50ff47[_0x40f8('0x2c')][_0x40f8('0x38')]+'%'};return _0xade91e;})});}_0x4ba515=_[_0x40f8('0x39')]({},_0x4ba515,_0x50ff47[_0x40f8('0x3b')]);return db[_0x40f8('0x5b')][_0x40f8('0x1c')]({'where':_0x4ba515['where']})[_0x40f8('0x23')](function(_0x216eb9){_0x3075af[_0x40f8('0x1c')]=_0x216eb9;if(_0x50ff47[_0x40f8('0x2c')][_0x40f8('0x3d')]){_0x4ba515[_0x40f8('0x3e')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x40f8('0x59')](_0x4ba515);})[_0x40f8('0x23')](function(_0x26256b){_0x3075af[_0x40f8('0x3f')]=_0x26256b;return _0x3075af;});}})[_0x40f8('0x23')](respondWithFilteredResult(_0x436cfd,_0x4ba515))['catch'](handleError(_0x436cfd,null));};function char(_0x4e5592){return _0x40f8('0x5d')===typeof _0x4e5592?String[_0x40f8('0x5e')][_0x40f8('0x20')](null,arguments):_0x4e5592;}function needsEncapsulation(_0x16aa4c){return!!_0x16aa4c&&(_0x16aa4c[_0x40f8('0x5f')]()[_0x40f8('0x60')](char(0xd))>=0x0||_0x16aa4c[_0x40f8('0x5f')]()[_0x40f8('0x60')](char(0xa))>=0x0||_0x16aa4c[_0x40f8('0x5f')]()[_0x40f8('0x60')](char(0x2c))>=0x0||_0x16aa4c[_0x40f8('0x5f')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x13ab38){var _0x391f83=char(0x22),_0x404d83='\x5c'+char(0x22),_0x262830=_0x13ab38[_0x40f8('0x5f')]()[_0x40f8('0x61')](new RegExp(_0x391f83,'g'),_0x404d83);return _0x391f83+_0x262830+_0x391f83;}exports[_0x40f8('0x62')]=function(_0x2670a3,_0x527fac,_0x44094f){var _0x231039,_0x51f7e4;var _0x5585f3={'where':{'ProjectId':_0x2670a3[_0x40f8('0x50')]['id']}};if(_0x2670a3['query'][_0x40f8('0x63')]){_0x5585f3['where'][_0x40f8('0x64')]=JSON[_0x40f8('0x65')](_0x2670a3[_0x40f8('0x2c')]['startTime']);}return db['JscriptySessionReport']['findAll'](_0x5585f3)[_0x40f8('0x23')](handleEntityNotFound(_0x527fac,null))['then'](function(_0x15f660){if(_0x15f660){_0x231039=_0x15f660;return db[_0x40f8('0x66')][_0x40f8('0x59')]({'where':{'SessionId':{'$in':_[_0x40f8('0x28')](_0x231039,'id')},'ProjectId':_0x2670a3[_0x40f8('0x50')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x527fac,null))['then'](function(_0x2d87c2){if(_0x2d87c2){_0x51f7e4=_0x2d87c2;var _0x149d24={};for(var _0x4b3cc6=0x0,_0x4c5109=_0x51f7e4[_0x40f8('0x32')];_0x4b3cc6<_0x4c5109;_0x4b3cc6++){if(!_0x149d24[_0x40f8('0x33')](_0x51f7e4[_0x4b3cc6][_0x40f8('0x67')])){_0x149d24[_0x51f7e4[_0x4b3cc6][_0x40f8('0x67')]]=needsEncapsulation(_0x51f7e4[_0x4b3cc6][_0x40f8('0x68')])?encapsulate(_0x51f7e4[_0x4b3cc6][_0x40f8('0x68')]):_0x51f7e4[_0x4b3cc6][_0x40f8('0x68')];}}var _0x3d3503=[],_0x32572a={};for(var _0x552f8d=0x0,_0x45be94=_0x231039[_0x40f8('0x32')];_0x552f8d<_0x45be94;_0x552f8d++){_0x32572a={'ProjectId':_0x2670a3['params']['id'],'SessionId':_0x231039[_0x552f8d]['id'],'StartTime':moment(_0x231039[_0x552f8d][_0x40f8('0x64')])[_0x40f8('0x69')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x38b642=0x0,_0x1f13e2=_0x51f7e4[_0x40f8('0x32')];_0x38b642<_0x1f13e2;_0x38b642++){if(_0x51f7e4[_0x38b642][_0x40f8('0x6a')]==_0x231039[_0x552f8d]['id']&&_0x149d24[_0x40f8('0x33')](_0x51f7e4[_0x38b642][_0x40f8('0x67')])){_0x32572a[_0x149d24[_0x51f7e4[_0x38b642][_0x40f8('0x67')]]]=_0x51f7e4[_0x38b642][_0x40f8('0x6b')];}}for(var _0x5a5aac in _0x149d24){if(!_0x32572a['hasOwnProperty'](_0x149d24[_0x5a5aac])){_0x32572a[_0x149d24[_0x5a5aac]]=null;}}_0x3d3503[_0x40f8('0x6c')](_0x32572a);}return _0x3d3503;}})[_0x40f8('0x23')](function(_0x22ab04){if(!_['isEmpty'](_0x22ab04)){var _0x39fd86=toCsv(_0x22ab04);var _0xd78818=Date[_0x40f8('0x6d')]();fs[_0x40f8('0x6e')](util[_0x40f8('0x69')](_0x40f8('0x6f'),_0x2670a3['params']['id'],_0xd78818),_0x39fd86);_0x527fac[_0x40f8('0x70')](_0x40f8('0x71'),'attachment;\x20filename='+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x2670a3['params']['id'],_0xd78818));_0x527fac[_0x40f8('0x70')](_0x40f8('0x72'),_0x40f8('0x73'));return _0x527fac[_0x40f8('0x74')](util[_0x40f8('0x69')](_0x40f8('0x6f'),_0x2670a3[_0x40f8('0x50')]['id'],_0xd78818));}else{return _0x527fac[_0x40f8('0x18')](0xcc);}})[_0x40f8('0x40')](handleError(_0x527fac,null));}; \ No newline at end of file +var _0x427a=['findOne','JscriptySessionReport','filters','findAll','JscriptyAnswerReport','ProjectId','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','destroy','then','Projects','UserProfileResource','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','rows','show','params','keys','include','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit','createdAt','updatedAt','body','getSessions'];(function(_0xf90b77,_0x5b5c86){var _0x287702=function(_0x30cab6){while(--_0x30cab6){_0xf90b77['push'](_0xf90b77['shift']());}};_0x287702(++_0x5b5c86);}(_0x427a,0x18a));var _0xa427=function(_0x317226,_0x44415d){_0x317226=_0x317226-0x0;var _0x4dd967=_0x427a[_0x317226];return _0x4dd967;};'use strict';var pdf=require(_0xa427('0x0'));var emlformat=require(_0xa427('0x1'));var rimraf=require(_0xa427('0x2'));var zipdir=require(_0xa427('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa427('0x4'));var moment=require(_0xa427('0x5'));var BPromise=require(_0xa427('0x6'));var Mustache=require(_0xa427('0x7'));var util=require(_0xa427('0x8'));var path=require(_0xa427('0x9'));var sox=require(_0xa427('0xa'));var csv=require('to-csv');var ejs=require(_0xa427('0xb'));var fs=require('fs');var _=require(_0xa427('0xc'));var squel=require(_0xa427('0xd'));var crypto=require(_0xa427('0xe'));var jsforce=require(_0xa427('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa427('0x10'));var querystring=require(_0xa427('0x11'));var Papa=require(_0xa427('0x12'));var Redis=require(_0xa427('0x13'));var authService=require(_0xa427('0x14'));var qs=require(_0xa427('0x15'));var as=require(_0xa427('0x16'));var hardwareService=require(_0xa427('0x17'));var logger=require('../../config/logger')(_0xa427('0x18'));var utils=require(_0xa427('0x19'));var config=require('../../config/environment');var db=require(_0xa427('0x1a'))['db'];function respondWithStatusCode(_0x2bb0e2,_0x3a2230){_0x3a2230=_0x3a2230||0xcc;return function(_0x46c495){if(_0x46c495){return _0x2bb0e2[_0xa427('0x1b')](_0x3a2230);}return _0x2bb0e2[_0xa427('0x1c')](_0x3a2230)[_0xa427('0x1d')]();};}function respondWithResult(_0x3468c5,_0x2e5c52){_0x2e5c52=_0x2e5c52||0xc8;return function(_0xbcad04){if(_0xbcad04){return _0x3468c5[_0xa427('0x1c')](_0x2e5c52)[_0xa427('0x1e')](_0xbcad04);}};}function respondWithFilteredResult(_0x2d2a20,_0x3c24e5){return function(_0x324f6f){if(_0x324f6f){var _0x115caa=_0x324f6f[_0xa427('0x1f')],_0x40d8cc=_0x3c24e5[_0xa427('0x20')],_0x24bd95=_0x3c24e5['offset']+_0x3c24e5[_0xa427('0x21')],_0x529757;if(_0x24bd95>=_0x115caa){_0x24bd95=_0x115caa;_0x529757=0xc8;}else{_0x529757=0xce;}_0x2d2a20[_0xa427('0x1c')](_0x529757);return _0x2d2a20['set'](_0xa427('0x22'),_0x40d8cc+'-'+_0x24bd95+'/'+_0x115caa)[_0xa427('0x1e')](_0x324f6f);}return null;};}function patchUpdates(_0x683b09){return function(_0x5d4fd8){try{jsonpatch[_0xa427('0x23')](_0x5d4fd8,_0x683b09,!![]);}catch(_0x9c38f0){return BPromise[_0xa427('0x24')](_0x9c38f0);}return _0x5d4fd8['save']();};}function saveUpdates(_0x520701,_0x29efc4){return function(_0x17bb90){if(_0x17bb90){return _0x17bb90[_0xa427('0x25')](_0x520701)['then'](function(_0x50c0a7){return _0x50c0a7;});}return null;};}function removeEntity(_0x218a5c,_0x15c0f6){return function(_0x11cd29){if(_0x11cd29){return _0x11cd29[_0xa427('0x26')]()[_0xa427('0x27')](function(){var _0x15981d=_0x11cd29['get']({'plain':!![]});var _0x27e191=_0xa427('0x28');return db[_0xa427('0x29')][_0xa427('0x26')]({'where':{'type':_0x27e191,'resourceId':_0x15981d['id']}})['then'](function(){return _0x11cd29;});})[_0xa427('0x27')](function(){_0x218a5c[_0xa427('0x1c')](0xcc)[_0xa427('0x1d')]();});}};}function handleEntityNotFound(_0x4bb661,_0x5edfbc){return function(_0x176f5a){if(!_0x176f5a){_0x4bb661[_0xa427('0x1b')](0x194);}return _0x176f5a;};}function handleError(_0x12486c,_0x536ed0){_0x536ed0=_0x536ed0||0x1f4;return function(_0x17271e){logger[_0xa427('0x2a')](_0x17271e[_0xa427('0x2b')]);if(_0x17271e[_0xa427('0x2c')]){delete _0x17271e[_0xa427('0x2c')];}_0x12486c[_0xa427('0x1c')](_0x536ed0)[_0xa427('0x2d')](_0x17271e);};}exports[_0xa427('0x2e')]=function(_0x100c26,_0x51e448){var _0x4e20c4={},_0x4522c7={},_0x124fc1={'count':0x0,'rows':[]};var _0x14ce61=_[_0xa427('0x2f')](db[_0xa427('0x30')][_0xa427('0x31')],function(_0x244aa5){return{'name':_0x244aa5[_0xa427('0x32')],'type':_0x244aa5[_0xa427('0x33')][_0xa427('0x34')]};});_0x4522c7[_0xa427('0x35')]=_[_0xa427('0x2f')](_0x14ce61,'name');_0x4522c7[_0xa427('0x36')]=_['keys'](_0x100c26[_0xa427('0x36')]);_0x4522c7['filters']=_['intersection'](_0x4522c7[_0xa427('0x35')],_0x4522c7[_0xa427('0x36')]);_0x4e20c4[_0xa427('0x37')]=_[_0xa427('0x38')](_0x4522c7[_0xa427('0x35')],qs[_0xa427('0x39')](_0x100c26['query'][_0xa427('0x39')]));_0x4e20c4[_0xa427('0x37')]=_0x4e20c4[_0xa427('0x37')][_0xa427('0x3a')]?_0x4e20c4['attributes']:_0x4522c7[_0xa427('0x35')];if(!_0x100c26[_0xa427('0x36')][_0xa427('0x3b')]('nolimit')){_0x4e20c4[_0xa427('0x21')]=qs[_0xa427('0x21')](_0x100c26[_0xa427('0x36')]['limit']);_0x4e20c4[_0xa427('0x20')]=qs[_0xa427('0x20')](_0x100c26['query'][_0xa427('0x20')]);}_0x4e20c4[_0xa427('0x3c')]=qs[_0xa427('0x3d')](_0x100c26[_0xa427('0x36')][_0xa427('0x3d')]);_0x4e20c4['where']=qs['filters'](_[_0xa427('0x3e')](_0x100c26['query'],_0x4522c7['filters']));if(_0x100c26[_0xa427('0x36')][_0xa427('0x3f')]){_0x4e20c4[_0xa427('0x40')]=_[_0xa427('0x41')](_0x4e20c4['where'],{'$or':_['map'](_0x14ce61,function(_0x2816c9){if(_0x2816c9[_0xa427('0x33')]!=='VIRTUAL'){var _0x19e315={};_0x19e315[_0x2816c9[_0xa427('0x2c')]]={'$like':'%'+_0x100c26[_0xa427('0x36')][_0xa427('0x3f')]+'%'};return _0x19e315;}})});}_0x4e20c4=_[_0xa427('0x41')]({},_0x4e20c4,_0x100c26[_0xa427('0x42')]);var _0x3b5332={'where':_0x4e20c4[_0xa427('0x40')]};return db[_0xa427('0x30')][_0xa427('0x1f')](_0x3b5332)[_0xa427('0x27')](function(_0x41c7a7){_0x124fc1[_0xa427('0x1f')]=_0x41c7a7;if(_0x100c26[_0xa427('0x36')]['includeAll']){_0x4e20c4['include']=[{'all':!![]}];}return db[_0xa427('0x30')]['findAll'](_0x4e20c4);})[_0xa427('0x27')](function(_0x38c293){_0x124fc1[_0xa427('0x43')]=_0x38c293;return _0x124fc1;})[_0xa427('0x27')](respondWithFilteredResult(_0x51e448,_0x4e20c4))['catch'](handleError(_0x51e448,null));};exports[_0xa427('0x44')]=function(_0x4b2ee2,_0x2ff5c7){var _0x1bb2cf={'raw':![],'where':{'id':_0x4b2ee2[_0xa427('0x45')]['id']}},_0xa9ba37={};_0xa9ba37[_0xa427('0x35')]=_[_0xa427('0x46')](db[_0xa427('0x30')]['rawAttributes']);_0xa9ba37[_0xa427('0x36')]=_['keys'](_0x4b2ee2[_0xa427('0x36')]);_0xa9ba37['filters']=_[_0xa427('0x38')](_0xa9ba37[_0xa427('0x35')],_0xa9ba37[_0xa427('0x36')]);_0x1bb2cf[_0xa427('0x37')]=_[_0xa427('0x38')](_0xa9ba37[_0xa427('0x35')],qs['fields'](_0x4b2ee2[_0xa427('0x36')][_0xa427('0x39')]));_0x1bb2cf[_0xa427('0x37')]=_0x1bb2cf[_0xa427('0x37')]['length']?_0x1bb2cf[_0xa427('0x37')]:_0xa9ba37['model'];if(_0x4b2ee2[_0xa427('0x36')]['includeAll']){_0x1bb2cf[_0xa427('0x47')]=[{'all':!![]}];}_0x1bb2cf=_[_0xa427('0x41')]({},_0x1bb2cf,_0x4b2ee2[_0xa427('0x42')]);return db[_0xa427('0x30')][_0xa427('0x48')](_0x1bb2cf)[_0xa427('0x27')](handleEntityNotFound(_0x2ff5c7,null))[_0xa427('0x27')](respondWithResult(_0x2ff5c7,null))[_0xa427('0x49')](handleError(_0x2ff5c7,null));};exports[_0xa427('0x4a')]=function(_0x12ed3b,_0x7780e1){return db[_0xa427('0x30')][_0xa427('0x4a')](_0x12ed3b['body'],{})[_0xa427('0x27')](function(_0x3b900e){var _0x2fc471=_0x12ed3b[_0xa427('0x4b')][_0xa427('0x4c')]({'plain':!![]});if(!_0x2fc471)throw new Error(_0xa427('0x4d'));if(_0x2fc471[_0xa427('0x4e')]===_0xa427('0x4b')){var _0x335b56=_0x3b900e['get']({'plain':!![]});var _0x1dfd16=_0xa427('0x28');return db[_0xa427('0x4f')][_0xa427('0x48')]({'where':{'name':_0x1dfd16,'userProfileId':_0x2fc471[_0xa427('0x50')]},'raw':!![]})[_0xa427('0x27')](function(_0x291844){if(_0x291844&&_0x291844[_0xa427('0x51')]===0x0){return db[_0xa427('0x29')][_0xa427('0x4a')]({'name':_0x335b56[_0xa427('0x2c')],'resourceId':_0x335b56['id'],'type':_0x291844['name'],'sectionId':_0x291844['id']},{})[_0xa427('0x27')](function(){return _0x3b900e;});}else{return _0x3b900e;}})[_0xa427('0x49')](function(_0x513462){logger[_0xa427('0x2a')](_0xa427('0x52'),_0x513462);throw _0x513462;});}return _0x3b900e;})['then'](respondWithResult(_0x7780e1,0xc9))[_0xa427('0x49')](handleError(_0x7780e1,null));};exports[_0xa427('0x53')]=function(_0x2b38b2,_0x253da0){var _0xee55ae={'where':{'id':_0x2b38b2[_0xa427('0x45')]['id']}},_0x288683={};_0x288683[_0xa427('0x35')]=_[_0xa427('0x46')](db[_0xa427('0x30')][_0xa427('0x31')]);_0xee55ae[_0xa427('0x37')]=_[_0xa427('0x38')](_0x288683['model'],qs[_0xa427('0x39')](_0x2b38b2[_0xa427('0x36')][_0xa427('0x39')]));_0xee55ae[_0xa427('0x37')]=_0xee55ae[_0xa427('0x37')][_0xa427('0x3a')]?_0xee55ae[_0xa427('0x37')]:_0x288683[_0xa427('0x35')];if(_0x2b38b2['query'][_0xa427('0x54')]){_0xee55ae[_0xa427('0x47')]=[{'all':!![]}];}_0xee55ae=_[_0xa427('0x41')]({},_0xee55ae,_0x2b38b2['options']);return db['JscriptyProject'][_0xa427('0x48')](_0xee55ae)[_0xa427('0x27')](handleEntityNotFound(_0x253da0,null))['then'](function(_0x1f8f41){if(_0x1f8f41){var _0xc72563=_0x1f8f41[_0xa427('0x4c')]({'plain':!![]});_0xc72563=qs[_0xa427('0x55')](_0xc72563,['id',_0xa427('0x56'),'updatedAt']);_0x2b38b2['body']=_[_0xa427('0x55')](_0x2b38b2['body'],['id',_0xa427('0x56'),_0xa427('0x57')]);return db['JscriptyProject'][_0xa427('0x4a')](_[_0xa427('0x41')](_0xc72563,_0x2b38b2[_0xa427('0x58')]),{'include':_0x2b38b2[_0xa427('0x36')][_0xa427('0x54')]?[{'all':!![]}]:undefined})[_0xa427('0x27')](function(_0x13695e){var _0x13e64a=_0x2b38b2[_0xa427('0x4b')][_0xa427('0x4c')]({'plain':!![]});if(!_0x13e64a)throw new Error(_0xa427('0x4d'));if(_0x13e64a[_0xa427('0x4e')]===_0xa427('0x4b')){var _0x24aa15=_0x13695e['get']({'plain':!![]});var _0x3a6ade=_0xa427('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x3a6ade,'userProfileId':_0x13e64a[_0xa427('0x50')]},'raw':!![]})['then'](function(_0x38eeb2){if(_0x38eeb2&&_0x38eeb2[_0xa427('0x51')]===0x0){return db[_0xa427('0x29')][_0xa427('0x4a')]({'name':_0x24aa15[_0xa427('0x2c')],'resourceId':_0x24aa15['id'],'type':_0x38eeb2[_0xa427('0x2c')],'sectionId':_0x38eeb2['id']},{})[_0xa427('0x27')](function(){return _0x13695e;});}else{return _0x13695e;}})[_0xa427('0x49')](function(_0x367de5){logger[_0xa427('0x2a')](_0xa427('0x52'),_0x367de5);throw _0x367de5;});}return _0x13695e;});}})['then'](respondWithResult(_0x253da0,0xc9))[_0xa427('0x49')](handleError(_0x253da0,null));};exports['update']=function(_0x120964,_0x211441){if(_0x120964[_0xa427('0x58')]['id']){delete _0x120964[_0xa427('0x58')]['id'];}return db[_0xa427('0x30')][_0xa427('0x48')]({'where':{'id':_0x120964[_0xa427('0x45')]['id']}})[_0xa427('0x27')](handleEntityNotFound(_0x211441,null))['then'](saveUpdates(_0x120964[_0xa427('0x58')],null))['then'](respondWithResult(_0x211441,null))[_0xa427('0x49')](handleError(_0x211441,null));};exports[_0xa427('0x26')]=function(_0x5c0a8c,_0xfde98c){return db['JscriptyProject'][_0xa427('0x48')]({'where':{'id':_0x5c0a8c['params']['id']}})['then'](handleEntityNotFound(_0xfde98c,null))[_0xa427('0x27')](removeEntity(_0xfde98c,null))[_0xa427('0x49')](handleError(_0xfde98c,null));};exports[_0xa427('0x59')]=function(_0x2e77dd,_0x300e67,_0x4629a3){var _0x43bbf4={'raw':!![],'where':{}};var _0x4dfb49={};var _0xecc693={'count':0x0,'rows':[]};return db[_0xa427('0x30')][_0xa427('0x5a')]({'where':{'id':_0x2e77dd['params']['id']}})[_0xa427('0x27')](handleEntityNotFound(_0x300e67,null))[_0xa427('0x27')](function(_0x30f801){if(_0x30f801){_0x4dfb49[_0xa427('0x35')]=_['keys'](db[_0xa427('0x5b')][_0xa427('0x31')]);_0x4dfb49[_0xa427('0x36')]=_[_0xa427('0x46')](_0x2e77dd[_0xa427('0x36')]);_0x4dfb49['filters']=_[_0xa427('0x38')](_0x4dfb49[_0xa427('0x35')],_0x4dfb49[_0xa427('0x36')]);_0x43bbf4[_0xa427('0x37')]=_[_0xa427('0x38')](_0x4dfb49[_0xa427('0x35')],qs[_0xa427('0x39')](_0x2e77dd['query'][_0xa427('0x39')]));_0x43bbf4[_0xa427('0x37')]=_0x43bbf4['attributes'][_0xa427('0x3a')]?_0x43bbf4[_0xa427('0x37')]:_0x4dfb49['model'];if(!_0x2e77dd[_0xa427('0x36')][_0xa427('0x3b')]('nolimit')){_0x43bbf4['limit']=qs['limit'](_0x2e77dd[_0xa427('0x36')][_0xa427('0x21')]);_0x43bbf4['offset']=qs[_0xa427('0x20')](_0x2e77dd['query'][_0xa427('0x20')]);}_0x43bbf4[_0xa427('0x3c')]=qs[_0xa427('0x3d')](_0x2e77dd[_0xa427('0x36')]['sort']);_0x43bbf4[_0xa427('0x40')]=qs[_0xa427('0x5c')](_[_0xa427('0x3e')](_0x2e77dd[_0xa427('0x36')],_0x4dfb49['filters']));_0x43bbf4[_0xa427('0x40')]['ProjectId']=_0x30f801['id'];if(_0x2e77dd[_0xa427('0x36')]['filter']){_0x43bbf4['where']=_[_0xa427('0x41')](_0x43bbf4[_0xa427('0x40')],{'$or':_[_0xa427('0x2f')](_0x43bbf4['attributes'],function(_0x265e99){var _0x16fcf9={};_0x16fcf9[_0x265e99]={'$like':'%'+_0x2e77dd[_0xa427('0x36')][_0xa427('0x3f')]+'%'};return _0x16fcf9;})});}_0x43bbf4=_[_0xa427('0x41')]({},_0x43bbf4,_0x2e77dd['options']);return db[_0xa427('0x5b')]['count']({'where':_0x43bbf4[_0xa427('0x40')]})[_0xa427('0x27')](function(_0x58e144){_0xecc693[_0xa427('0x1f')]=_0x58e144;if(_0x2e77dd[_0xa427('0x36')][_0xa427('0x54')]){_0x43bbf4[_0xa427('0x47')]=[{'all':!![]}];}return db[_0xa427('0x5b')][_0xa427('0x5d')](_0x43bbf4);})[_0xa427('0x27')](function(_0x30fd28){_0xecc693[_0xa427('0x43')]=_0x30fd28;return _0xecc693;});}})[_0xa427('0x27')](respondWithFilteredResult(_0x300e67,_0x43bbf4))['catch'](handleError(_0x300e67,null));};exports['getAnswers']=function(_0x4f4cb2,_0x224180,_0x4b26ac){var _0x403cba={'raw':!![],'where':{}};var _0x25dd46={};var _0x9ed59={'count':0x0,'rows':[]};return db[_0xa427('0x30')]['findOne']({'where':{'id':_0x4f4cb2['params']['id']}})[_0xa427('0x27')](handleEntityNotFound(_0x224180,null))['then'](function(_0x5308e1){if(_0x5308e1){_0x25dd46[_0xa427('0x35')]=_[_0xa427('0x46')](db[_0xa427('0x5e')]['rawAttributes']);_0x25dd46[_0xa427('0x36')]=_[_0xa427('0x46')](_0x4f4cb2[_0xa427('0x36')]);_0x25dd46['filters']=_[_0xa427('0x38')](_0x25dd46[_0xa427('0x35')],_0x25dd46[_0xa427('0x36')]);_0x403cba[_0xa427('0x37')]=_['intersection'](_0x25dd46[_0xa427('0x35')],qs['fields'](_0x4f4cb2[_0xa427('0x36')][_0xa427('0x39')]));_0x403cba[_0xa427('0x37')]=_0x403cba[_0xa427('0x37')][_0xa427('0x3a')]?_0x403cba['attributes']:_0x25dd46[_0xa427('0x35')];if(!_0x4f4cb2[_0xa427('0x36')][_0xa427('0x3b')]('nolimit')){_0x403cba['limit']=qs['limit'](_0x4f4cb2['query']['limit']);_0x403cba[_0xa427('0x20')]=qs[_0xa427('0x20')](_0x4f4cb2['query'][_0xa427('0x20')]);}_0x403cba[_0xa427('0x3c')]=qs[_0xa427('0x3d')](_0x4f4cb2[_0xa427('0x36')][_0xa427('0x3d')]);_0x403cba[_0xa427('0x40')]=qs[_0xa427('0x5c')](_[_0xa427('0x3e')](_0x4f4cb2[_0xa427('0x36')],_0x25dd46[_0xa427('0x5c')]));_0x403cba['where'][_0xa427('0x5f')]=_0x5308e1['id'];if(_0x4f4cb2['query'][_0xa427('0x3f')]){_0x403cba[_0xa427('0x40')]=_[_0xa427('0x41')](_0x403cba[_0xa427('0x40')],{'$or':_[_0xa427('0x2f')](_0x403cba['attributes'],function(_0x4d7348){var _0x5cb3df={};_0x5cb3df[_0x4d7348]={'$like':'%'+_0x4f4cb2[_0xa427('0x36')]['filter']+'%'};return _0x5cb3df;})});}_0x403cba=_['merge']({},_0x403cba,_0x4f4cb2[_0xa427('0x42')]);return db[_0xa427('0x5e')][_0xa427('0x1f')]({'where':_0x403cba[_0xa427('0x40')]})['then'](function(_0xbd8991){_0x9ed59[_0xa427('0x1f')]=_0xbd8991;if(_0x4f4cb2[_0xa427('0x36')][_0xa427('0x54')]){_0x403cba[_0xa427('0x47')]=[{'all':!![]}];}return db[_0xa427('0x5e')]['findAll'](_0x403cba);})[_0xa427('0x27')](function(_0x23a408){_0x9ed59['rows']=_0x23a408;return _0x9ed59;});}})['then'](respondWithFilteredResult(_0x224180,_0x403cba))[_0xa427('0x49')](handleError(_0x224180,null));};function char(_0x2335d2){return _0xa427('0x60')===typeof _0x2335d2?String[_0xa427('0x61')]['apply'](null,arguments):_0x2335d2;}function needsEncapsulation(_0x15d80e){return!!_0x15d80e&&(_0x15d80e[_0xa427('0x62')]()['indexOf'](char(0xd))>=0x0||_0x15d80e[_0xa427('0x62')]()['indexOf'](char(0xa))>=0x0||_0x15d80e[_0xa427('0x62')]()[_0xa427('0x63')](char(0x2c))>=0x0||_0x15d80e[_0xa427('0x62')]()[_0xa427('0x63')](char(0x22))>=0x0);}function encapsulate(_0x2455c2){var _0x41fdb5=char(0x22),_0x1cb9a2='\x5c'+char(0x22),_0x120cb9=_0x2455c2[_0xa427('0x62')]()[_0xa427('0x64')](new RegExp(_0x41fdb5,'g'),_0x1cb9a2);return _0x41fdb5+_0x120cb9+_0x41fdb5;}exports[_0xa427('0x65')]=function(_0x1821e7,_0x39039a,_0x58c663){var _0x5f3459,_0x5d1eee;var _0x3d286a={'where':{'ProjectId':_0x1821e7[_0xa427('0x45')]['id']}};if(_0x1821e7[_0xa427('0x36')][_0xa427('0x66')]){_0x3d286a[_0xa427('0x40')][_0xa427('0x67')]=JSON[_0xa427('0x68')](_0x1821e7[_0xa427('0x36')][_0xa427('0x66')]);}return db[_0xa427('0x5b')][_0xa427('0x5d')](_0x3d286a)['then'](handleEntityNotFound(_0x39039a,null))[_0xa427('0x27')](function(_0x211c2a){if(_0x211c2a){_0x5f3459=_0x211c2a;return db[_0xa427('0x69')][_0xa427('0x5d')]({'where':{'SessionId':{'$in':_['map'](_0x5f3459,'id')},'ProjectId':_0x1821e7['params']['id']},'order':_0xa427('0x6a')});}})['then'](handleEntityNotFound(_0x39039a,null))[_0xa427('0x27')](function(_0x24e9e1){if(_0x24e9e1){_0x5d1eee=_0x24e9e1;var _0x3b44f5={};for(var _0x52a379=0x0,_0x25cf72=_0x5d1eee['length'];_0x52a379<_0x25cf72;_0x52a379++){if(!_0x3b44f5['hasOwnProperty'](_0x5d1eee[_0x52a379][_0xa427('0x6b')])){_0x3b44f5[_0x5d1eee[_0x52a379][_0xa427('0x6b')]]=needsEncapsulation(_0x5d1eee[_0x52a379][_0xa427('0x6c')])?encapsulate(_0x5d1eee[_0x52a379][_0xa427('0x6c')]):_0x5d1eee[_0x52a379][_0xa427('0x6c')];}}var _0x16f55a=[],_0x15ae9e={};for(var _0x3cc4a1=0x0,_0x27a33a=_0x5f3459['length'];_0x3cc4a1<_0x27a33a;_0x3cc4a1++){_0x15ae9e={'ProjectId':_0x1821e7[_0xa427('0x45')]['id'],'SessionId':_0x5f3459[_0x3cc4a1]['id'],'StartTime':moment(_0x5f3459[_0x3cc4a1][_0xa427('0x67')])[_0xa427('0x6d')](_0xa427('0x6e'))};for(var _0x432e1f=0x0,_0x252fb8=_0x5d1eee[_0xa427('0x3a')];_0x432e1f<_0x252fb8;_0x432e1f++){if(_0x5d1eee[_0x432e1f]['SessionId']==_0x5f3459[_0x3cc4a1]['id']&&_0x3b44f5[_0xa427('0x3b')](_0x5d1eee[_0x432e1f][_0xa427('0x6b')])){_0x15ae9e[_0x3b44f5[_0x5d1eee[_0x432e1f][_0xa427('0x6b')]]]=_0x5d1eee[_0x432e1f][_0xa427('0x6f')];}}for(var _0x197692 in _0x3b44f5){if(!_0x15ae9e['hasOwnProperty'](_0x3b44f5[_0x197692])){_0x15ae9e[_0x3b44f5[_0x197692]]=null;}}_0x16f55a[_0xa427('0x70')](_0x15ae9e);}return _0x16f55a;}})['then'](function(_0x1dfdee){if(!_['isEmpty'](_0x1dfdee)){var _0x1753ad=toCsv(_0x1dfdee);var _0x44bcb0=Date[_0xa427('0x71')]();fs[_0xa427('0x72')](util['format'](_0xa427('0x73'),_0x1821e7[_0xa427('0x45')]['id'],_0x44bcb0),_0x1753ad);_0x39039a[_0xa427('0x74')](_0xa427('0x75'),'attachment;\x20filename='+util[_0xa427('0x6d')](_0xa427('0x76'),_0x1821e7[_0xa427('0x45')]['id'],_0x44bcb0));_0x39039a[_0xa427('0x74')]('Content-type',_0xa427('0x77'));return _0x39039a[_0xa427('0x78')](util['format'](_0xa427('0x73'),_0x1821e7[_0xa427('0x45')]['id'],_0x44bcb0));}else{return _0x39039a[_0xa427('0x1b')](0xcc);}})['catch'](handleError(_0x39039a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 08a5d8f..2607106 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 _0x9c17=['JscriptyProject','jscripty_projects','lodash','util','moment','bluebird','request-promise','rimraf','./jscriptyProject.attributes','exports','define'];(function(_0x38831b,_0x4611ea){var _0x5a508a=function(_0x2df441){while(--_0x2df441){_0x38831b['push'](_0x38831b['shift']());}};_0x5a508a(++_0x4611ea);}(_0x9c17,0x7b));var _0x79c1=function(_0xe51920,_0x4a1092){_0xe51920=_0xe51920-0x0;var _0x4e4c70=_0x9c17[_0xe51920];return _0x4e4c70;};'use strict';var _=require(_0x79c1('0x0'));var util=require(_0x79c1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x79c1('0x2'));var BPromise=require(_0x79c1('0x3'));var rp=require(_0x79c1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x79c1('0x5'));var config=require('../../config/environment');var attributes=require(_0x79c1('0x6'));module[_0x79c1('0x7')]=function(_0x328245,_0x1b2615){return _0x328245[_0x79c1('0x8')](_0x79c1('0x9'),attributes,{'tableName':_0x79c1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53fd=['../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x46451c,_0x88ddd){var _0x12dce4=function(_0x2e4087){while(--_0x2e4087){_0x46451c['push'](_0x46451c['shift']());}};_0x12dce4(++_0x88ddd);}(_0x53fd,0x185));var _0xd53f=function(_0x161c2d,_0x2eae85){_0x161c2d=_0x161c2d-0x0;var _0xf09e=_0x53fd[_0x161c2d];return _0xf09e;};'use strict';var _=require('lodash');var util=require(_0xd53f('0x0'));var logger=require(_0xd53f('0x1'))(_0xd53f('0x2'));var moment=require(_0xd53f('0x3'));var BPromise=require(_0xd53f('0x4'));var rp=require(_0xd53f('0x5'));var fs=require('fs');var path=require(_0xd53f('0x6'));var rimraf=require('rimraf');var config=require(_0xd53f('0x7'));var attributes=require(_0xd53f('0x8'));module['exports']=function(_0x407ea0,_0x5c468a){return _0x407ea0[_0xd53f('0x9')](_0xd53f('0xa'),attributes,{'tableName':_0xd53f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 0f3e198..b88d7f1 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 _0x9c65=['catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','result'];(function(_0x2dd67d,_0x390381){var _0x57fd0e=function(_0x5694c1){while(--_0x5694c1){_0x2dd67d['push'](_0x2dd67d['shift']());}};_0x57fd0e(++_0x390381);}(_0x9c65,0xf3));var _0x59c6=function(_0x295cf4,_0xd5d755){_0x295cf4=_0x295cf4-0x0;var _0x354f65=_0x9c65[_0x295cf4];return _0x354f65;};'use strict';var _=require(_0x59c6('0x0'));var util=require(_0x59c6('0x1'));var moment=require('moment');var BPromise=require(_0x59c6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x59c6('0x3'));var db=require(_0x59c6('0x4'))['db'];var utils=require(_0x59c6('0x5'));var logger=require('../../config/logger')(_0x59c6('0x6'));var config=require(_0x59c6('0x7'));var jayson=require(_0x59c6('0x8'));var client=jayson[_0x59c6('0x9')][_0x59c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x545170,_0xdfa99c,_0x4957c0){return new BPromise(function(_0x3d4b15,_0x2be2ee){return client[_0x59c6('0xb')](_0x545170,_0x4957c0)['then'](function(_0x3f979d){logger[_0x59c6('0xc')](_0x59c6('0xd'),_0xdfa99c,_0x59c6('0xe'));logger[_0x59c6('0xf')](_0x59c6('0x10'),_0xdfa99c,'request\x20sent',JSON[_0x59c6('0x11')](_0x3f979d));if(_0x3f979d[_0x59c6('0x12')]){if(_0x3f979d[_0x59c6('0x12')][_0x59c6('0x13')]===0x1f4){logger[_0x59c6('0x12')](_0x59c6('0xd'),_0xdfa99c,_0x3f979d[_0x59c6('0x12')]['message']);return _0x2be2ee(_0x3f979d[_0x59c6('0x12')]['message']);}logger[_0x59c6('0x12')](_0x59c6('0xd'),_0xdfa99c,_0x3f979d['error']['message']);return _0x3d4b15(_0x3f979d[_0x59c6('0x12')]['message']);}else{logger['info'](_0x59c6('0xd'),_0xdfa99c,'request\x20sent');_0x3d4b15(_0x3f979d[_0x59c6('0x14')]['message']);}})[_0x59c6('0x15')](function(_0x3faa51){logger[_0x59c6('0x12')](_0x59c6('0xd'),_0xdfa99c,_0x3faa51);_0x2be2ee(_0x3faa51);});});} \ No newline at end of file +var _0x9917=['client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x2a1af7,_0x482911){var _0x246fe2=function(_0x1bf65c){while(--_0x1bf65c){_0x2a1af7['push'](_0x2a1af7['shift']());}};_0x246fe2(++_0x482911);}(_0x9917,0x1d3));var _0x7991=function(_0x4f6108,_0x3947aa){_0x4f6108=_0x4f6108-0x0;var _0x56bb9a=_0x9917[_0x4f6108];return _0x56bb9a;};'use strict';var _=require('lodash');var util=require(_0x7991('0x0'));var moment=require('moment');var BPromise=require(_0x7991('0x1'));var rs=require(_0x7991('0x2'));var fs=require('fs');var Redis=require(_0x7991('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7991('0x4'));var logger=require(_0x7991('0x5'))(_0x7991('0x6'));var config=require('../../config/environment');var jayson=require(_0x7991('0x7'));var client=jayson[_0x7991('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x456227,_0x16a301,_0x5efddc){return new BPromise(function(_0x5930d2,_0x2178a1){return client[_0x7991('0x9')](_0x456227,_0x5efddc)[_0x7991('0xa')](function(_0x58ffe8){logger[_0x7991('0xb')](_0x7991('0xc'),_0x16a301,_0x7991('0xd'));logger[_0x7991('0xe')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x16a301,_0x7991('0xd'),JSON[_0x7991('0xf')](_0x58ffe8));if(_0x58ffe8[_0x7991('0x10')]){if(_0x58ffe8[_0x7991('0x10')]['code']===0x1f4){logger[_0x7991('0x10')](_0x7991('0xc'),_0x16a301,_0x58ffe8[_0x7991('0x10')][_0x7991('0x11')]);return _0x2178a1(_0x58ffe8[_0x7991('0x10')]['message']);}logger[_0x7991('0x10')](_0x7991('0xc'),_0x16a301,_0x58ffe8[_0x7991('0x10')][_0x7991('0x11')]);return _0x5930d2(_0x58ffe8[_0x7991('0x10')][_0x7991('0x11')]);}else{logger['info'](_0x7991('0xc'),_0x16a301,_0x7991('0xd'));_0x5930d2(_0x58ffe8['result'][_0x7991('0x11')]);}})[_0x7991('0x12')](function(_0x1bc8e7){logger[_0x7991('0x10')](_0x7991('0xc'),_0x16a301,_0x1bc8e7);_0x2178a1(_0x1bc8e7);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 24572b6..1da66e0 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 _0x5298=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','describe','/:id','show','post','create'];(function(_0x4b7f10,_0x23de60){var _0x507b56=function(_0x22ff47){while(--_0x22ff47){_0x4b7f10['push'](_0x4b7f10['shift']());}};_0x507b56(++_0x23de60);}(_0x5298,0x1b3));var _0x8529=function(_0x36cc31,_0x40204c){_0x36cc31=_0x36cc31-0x0;var _0x2cec01=_0x5298[_0x36cc31];return _0x2cec01;};'use strict';var multer=require(_0x8529('0x0'));var util=require('util');var path=require(_0x8529('0x1'));var timeout=require('connect-timeout');var express=require(_0x8529('0x2'));var router=express[_0x8529('0x3')]();var auth=require(_0x8529('0x4'));var interaction=require(_0x8529('0x5'));var config=require(_0x8529('0x6'));var controller=require(_0x8529('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8529('0x8')]('/describe',auth[_0x8529('0x9')](),controller[_0x8529('0xa')]);router['get'](_0x8529('0xb'),auth[_0x8529('0x9')](),controller[_0x8529('0xc')]);router[_0x8529('0xd')]('/',auth['isAuthenticated'](),controller[_0x8529('0xe')]);router['put'](_0x8529('0xb'),auth[_0x8529('0x9')](),controller['update']);router['delete']('/:id',auth[_0x8529('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x50c6=['path','express','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer'];(function(_0x172da0,_0x121abf){var _0x35dddf=function(_0x2bbff3){while(--_0x2bbff3){_0x172da0['push'](_0x172da0['shift']());}};_0x35dddf(++_0x121abf);}(_0x50c6,0x197));var _0x650c=function(_0x1f15b7,_0x5778ab){_0x1f15b7=_0x1f15b7-0x0;var _0x1958ba=_0x50c6[_0x1f15b7];return _0x1958ba;};'use strict';var multer=require(_0x650c('0x0'));var util=require('util');var path=require(_0x650c('0x1'));var timeout=require('connect-timeout');var express=require(_0x650c('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x650c('0x3'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router[_0x650c('0x4')]('/',auth[_0x650c('0x5')](),controller[_0x650c('0x6')]);router[_0x650c('0x4')](_0x650c('0x7'),auth['isAuthenticated'](),controller[_0x650c('0x8')]);router[_0x650c('0x4')](_0x650c('0x9'),auth[_0x650c('0x5')](),controller[_0x650c('0xa')]);router[_0x650c('0xb')]('/',auth[_0x650c('0x5')](),controller[_0x650c('0xc')]);router[_0x650c('0xd')](_0x650c('0x9'),auth[_0x650c('0x5')](),controller[_0x650c('0xe')]);router[_0x650c('0xf')]('/:id',auth[_0x650c('0x5')](),controller[_0x650c('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 4312c50..0285edd 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 _0xdc6b=['sequelize','STRING'];(function(_0x48223a,_0x4766a6){var _0x71fc84=function(_0x3547e3){while(--_0x3547e3){_0x48223a['push'](_0x48223a['shift']());}};_0x71fc84(++_0x4766a6);}(_0xdc6b,0xdc));var _0xbdc6=function(_0x11e05d,_0x3a4491){_0x11e05d=_0x11e05d-0x0;var _0x335588=_0xdc6b[_0x11e05d];return _0x335588;};'use strict';var Sequelize=require(_0xbdc6('0x0'));module['exports']={'question':{'type':Sequelize[_0xbdc6('0x1')]},'answer':{'type':Sequelize['TEXT']('long')},'membername':{'type':Sequelize[_0xbdc6('0x1')]},'projectname':{'type':Sequelize[_0xbdc6('0x1')]},'queue':{'type':Sequelize[_0xbdc6('0x1')]},'uniqueid':{'type':Sequelize[_0xbdc6('0x1')]},'calleridname':{'type':Sequelize[_0xbdc6('0x1')]},'calleridnum':{'type':Sequelize[_0xbdc6('0x1')]},'questionId':{'type':Sequelize[_0xbdc6('0x1')]}}; \ No newline at end of file +var _0x584a=['sequelize','exports','STRING','TEXT','long'];(function(_0x18a236,_0x3d75c3){var _0x4a89d0=function(_0x469edb){while(--_0x469edb){_0x18a236['push'](_0x18a236['shift']());}};_0x4a89d0(++_0x3d75c3);}(_0x584a,0x1e5));var _0xa584=function(_0x3afbdf,_0x9e463b){_0x3afbdf=_0x3afbdf-0x0;var _0x5b6861=_0x584a[_0x3afbdf];return _0x5b6861;};'use strict';var Sequelize=require(_0xa584('0x0'));module[_0xa584('0x1')]={'question':{'type':Sequelize[_0xa584('0x2')]},'answer':{'type':Sequelize[_0xa584('0x3')](_0xa584('0x4'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xa584('0x2')]},'calleridname':{'type':Sequelize[_0xa584('0x2')]},'calleridnum':{'type':Sequelize[_0xa584('0x2')]},'questionId':{'type':Sequelize[_0xa584('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 33a56fa..f700832 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 _0x2509=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','rows','catch','show','params','length','includeAll','include','find','create','body','describe','html-pdf','eml-format'];(function(_0x3e942a,_0xdbdf47){var _0x2f4639=function(_0x436529){while(--_0x436529){_0x3e942a['push'](_0x3e942a['shift']());}};_0x2f4639(++_0xdbdf47);}(_0x2509,0xe5));var _0x9250=function(_0x47794f,_0x12c9b3){_0x47794f=_0x47794f-0x0;var _0x2ca51d=_0x2509[_0x47794f];return _0x2ca51d;};'use strict';var pdf=require(_0x9250('0x0'));var emlformat=require(_0x9250('0x1'));var rimraf=require(_0x9250('0x2'));var zipdir=require(_0x9250('0x3'));var jsonpatch=require(_0x9250('0x4'));var rp=require(_0x9250('0x5'));var moment=require(_0x9250('0x6'));var BPromise=require(_0x9250('0x7'));var Mustache=require(_0x9250('0x8'));var util=require(_0x9250('0x9'));var path=require(_0x9250('0xa'));var sox=require(_0x9250('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9250('0xc'));var squel=require('squel');var crypto=require(_0x9250('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9250('0xe'));var toCsv=require(_0x9250('0xf'));var querystring=require('querystring');var Papa=require(_0x9250('0x10'));var Redis=require(_0x9250('0x11'));var authService=require(_0x9250('0x12'));var qs=require(_0x9250('0x13'));var as=require(_0x9250('0x14'));var hardwareService=require(_0x9250('0x15'));var logger=require('../../config/logger')(_0x9250('0x16'));var utils=require(_0x9250('0x17'));var config=require('../../config/environment');var db=require(_0x9250('0x18'))['db'];function respondWithStatusCode(_0x1646bb,_0x3c3f65){_0x3c3f65=_0x3c3f65||0xcc;return function(_0x50706e){if(_0x50706e){return _0x1646bb[_0x9250('0x19')](_0x3c3f65);}return _0x1646bb[_0x9250('0x1a')](_0x3c3f65)[_0x9250('0x1b')]();};}function respondWithResult(_0x42fbbd,_0x535d8f){_0x535d8f=_0x535d8f||0xc8;return function(_0x1a4217){if(_0x1a4217){return _0x42fbbd[_0x9250('0x1a')](_0x535d8f)[_0x9250('0x1c')](_0x1a4217);}};}function respondWithFilteredResult(_0xffc17b,_0x57e879){return function(_0x374ba3){if(_0x374ba3){var _0x1306ae=_0x374ba3[_0x9250('0x1d')],_0x22cb9a=_0x57e879[_0x9250('0x1e')],_0x4c32f7=_0x57e879['offset']+_0x57e879[_0x9250('0x1f')],_0x1f2eac;if(_0x4c32f7>=_0x1306ae){_0x4c32f7=_0x1306ae;_0x1f2eac=0xc8;}else{_0x1f2eac=0xce;}_0xffc17b[_0x9250('0x1a')](_0x1f2eac);return _0xffc17b[_0x9250('0x20')](_0x9250('0x21'),_0x22cb9a+'-'+_0x4c32f7+'/'+_0x1306ae)[_0x9250('0x1c')](_0x374ba3);}return null;};}function patchUpdates(_0x257a4d){return function(_0x234e5b){try{jsonpatch[_0x9250('0x22')](_0x234e5b,_0x257a4d,!![]);}catch(_0x21671a){return BPromise[_0x9250('0x23')](_0x21671a);}return _0x234e5b[_0x9250('0x24')]();};}function saveUpdates(_0x496e07,_0x2ef494){return function(_0x1e977f){if(_0x1e977f){return _0x1e977f[_0x9250('0x25')](_0x496e07)[_0x9250('0x26')](function(_0x23f9ae){return _0x23f9ae;});}return null;};}function removeEntity(_0xc738bf,_0x33476f){return function(_0x34a094){if(_0x34a094){return _0x34a094[_0x9250('0x27')]()['then'](function(){_0xc738bf['status'](0xcc)[_0x9250('0x1b')]();});}};}function handleEntityNotFound(_0x32095d,_0x5394a2){return function(_0x582dc9){if(!_0x582dc9){_0x32095d[_0x9250('0x19')](0x194);}return _0x582dc9;};}function handleError(_0x1205d6,_0x26e61b){_0x26e61b=_0x26e61b||0x1f4;return function(_0x58e318){logger['error'](_0x58e318[_0x9250('0x28')]);if(_0x58e318[_0x9250('0x29')]){delete _0x58e318[_0x9250('0x29')];}_0x1205d6[_0x9250('0x1a')](_0x26e61b)[_0x9250('0x2a')](_0x58e318);};}exports[_0x9250('0x2b')]=function(_0x1b147c,_0x41fa57){var _0x11e894={},_0x159481={},_0x5bcbd7={'count':0x0,'rows':[]};var _0x237e6e=_[_0x9250('0x2c')](db[_0x9250('0x2d')][_0x9250('0x2e')],function(_0x8d292a){return{'name':_0x8d292a[_0x9250('0x2f')],'type':_0x8d292a[_0x9250('0x30')]['key']};});_0x159481[_0x9250('0x31')]=_[_0x9250('0x2c')](_0x237e6e,_0x9250('0x29'));_0x159481[_0x9250('0x32')]=_[_0x9250('0x33')](_0x1b147c[_0x9250('0x32')]);_0x159481[_0x9250('0x34')]=_[_0x9250('0x35')](_0x159481['model'],_0x159481[_0x9250('0x32')]);_0x11e894[_0x9250('0x36')]=_['intersection'](_0x159481['model'],qs[_0x9250('0x37')](_0x1b147c[_0x9250('0x32')][_0x9250('0x37')]));_0x11e894[_0x9250('0x36')]=_0x11e894[_0x9250('0x36')]['length']?_0x11e894[_0x9250('0x36')]:_0x159481[_0x9250('0x31')];if(!_0x1b147c[_0x9250('0x32')][_0x9250('0x38')](_0x9250('0x39'))){_0x11e894[_0x9250('0x1f')]=qs[_0x9250('0x1f')](_0x1b147c[_0x9250('0x32')][_0x9250('0x1f')]);_0x11e894['offset']=qs['offset'](_0x1b147c['query'][_0x9250('0x1e')]);}_0x11e894[_0x9250('0x3a')]=qs[_0x9250('0x3b')](_0x1b147c[_0x9250('0x32')][_0x9250('0x3b')]);_0x11e894[_0x9250('0x3c')]=qs[_0x9250('0x34')](_[_0x9250('0x3d')](_0x1b147c[_0x9250('0x32')],_0x159481[_0x9250('0x34')]));if(_0x1b147c[_0x9250('0x32')][_0x9250('0x3e')]){_0x11e894[_0x9250('0x3c')]=_['merge'](_0x11e894[_0x9250('0x3c')],{'$or':_[_0x9250('0x2c')](_0x237e6e,function(_0x5706aa){if(_0x5706aa[_0x9250('0x30')]!==_0x9250('0x3f')){var _0x38a9aa={};_0x38a9aa[_0x5706aa[_0x9250('0x29')]]={'$like':'%'+_0x1b147c[_0x9250('0x32')][_0x9250('0x3e')]+'%'};return _0x38a9aa;}})});}_0x11e894=_[_0x9250('0x40')]({},_0x11e894,_0x1b147c[_0x9250('0x41')]);var _0x314d7f={'where':_0x11e894[_0x9250('0x3c')]};return db['JscriptyQuestionReport'][_0x9250('0x1d')](_0x314d7f)[_0x9250('0x26')](function(_0x2a45a7){_0x5bcbd7['count']=_0x2a45a7;if(_0x1b147c[_0x9250('0x32')]['includeAll']){_0x11e894['include']=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x11e894);})['then'](function(_0x126c91){_0x5bcbd7[_0x9250('0x42')]=_0x126c91;return _0x5bcbd7;})[_0x9250('0x26')](respondWithFilteredResult(_0x41fa57,_0x11e894))[_0x9250('0x43')](handleError(_0x41fa57,null));};exports[_0x9250('0x44')]=function(_0x3e5c91,_0x17019b){var _0x4bc27c={'raw':!![],'where':{'id':_0x3e5c91[_0x9250('0x45')]['id']}},_0x5e2ee5={};_0x5e2ee5[_0x9250('0x31')]=_['keys'](db[_0x9250('0x2d')][_0x9250('0x2e')]);_0x5e2ee5[_0x9250('0x32')]=_[_0x9250('0x33')](_0x3e5c91[_0x9250('0x32')]);_0x5e2ee5[_0x9250('0x34')]=_['intersection'](_0x5e2ee5['model'],_0x5e2ee5[_0x9250('0x32')]);_0x4bc27c[_0x9250('0x36')]=_[_0x9250('0x35')](_0x5e2ee5[_0x9250('0x31')],qs[_0x9250('0x37')](_0x3e5c91[_0x9250('0x32')]['fields']));_0x4bc27c[_0x9250('0x36')]=_0x4bc27c[_0x9250('0x36')][_0x9250('0x46')]?_0x4bc27c['attributes']:_0x5e2ee5['model'];if(_0x3e5c91['query'][_0x9250('0x47')]){_0x4bc27c[_0x9250('0x48')]=[{'all':!![]}];}_0x4bc27c=_['merge']({},_0x4bc27c,_0x3e5c91['options']);return db[_0x9250('0x2d')][_0x9250('0x49')](_0x4bc27c)['then'](handleEntityNotFound(_0x17019b,null))[_0x9250('0x26')](respondWithResult(_0x17019b,null))[_0x9250('0x43')](handleError(_0x17019b,null));};exports[_0x9250('0x4a')]=function(_0x171758,_0x6e3afa){return db['JscriptyQuestionReport'][_0x9250('0x4a')](_0x171758[_0x9250('0x4b')],{})[_0x9250('0x26')](respondWithResult(_0x6e3afa,0xc9))['catch'](handleError(_0x6e3afa,null));};exports[_0x9250('0x25')]=function(_0x37ac25,_0x54144a){if(_0x37ac25[_0x9250('0x4b')]['id']){delete _0x37ac25[_0x9250('0x4b')]['id'];}return db[_0x9250('0x2d')][_0x9250('0x49')]({'where':{'id':_0x37ac25['params']['id']}})[_0x9250('0x26')](handleEntityNotFound(_0x54144a,null))[_0x9250('0x26')](saveUpdates(_0x37ac25[_0x9250('0x4b')],null))[_0x9250('0x26')](respondWithResult(_0x54144a,null))[_0x9250('0x43')](handleError(_0x54144a,null));};exports[_0x9250('0x27')]=function(_0x3d3ddd,_0x5efac7){return db[_0x9250('0x2d')]['find']({'where':{'id':_0x3d3ddd[_0x9250('0x45')]['id']}})['then'](handleEntityNotFound(_0x5efac7,null))[_0x9250('0x26')](removeEntity(_0x5efac7,null))[_0x9250('0x43')](handleError(_0x5efac7,null));};exports['describe']=function(_0x43745b,_0x523a0e){return db[_0x9250('0x2d')][_0x9250('0x4c')]()[_0x9250('0x26')](respondWithResult(_0x523a0e,null))['catch'](handleError(_0x523a0e,null));}; \ No newline at end of file +var _0x9749=['length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','model','rawAttributes','includeAll','create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','map','JscriptyQuestionReport','fieldName','type','key','query','keys','intersection','fields','attributes'];(function(_0x205171,_0x42fcd7){var _0x4f1a74=function(_0x57f73d){while(--_0x57f73d){_0x205171['push'](_0x205171['shift']());}};_0x4f1a74(++_0x42fcd7);}(_0x9749,0x1d9));var _0x9974=function(_0xa841cb,_0x5bd823){_0xa841cb=_0xa841cb-0x0;var _0x3bdf39=_0x9749[_0xa841cb];return _0x3bdf39;};'use strict';var pdf=require(_0x9974('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9974('0x1'));var zipdir=require(_0x9974('0x2'));var jsonpatch=require(_0x9974('0x3'));var rp=require(_0x9974('0x4'));var moment=require(_0x9974('0x5'));var BPromise=require(_0x9974('0x6'));var Mustache=require('mustache');var util=require(_0x9974('0x7'));var path=require(_0x9974('0x8'));var sox=require(_0x9974('0x9'));var csv=require('to-csv');var ejs=require(_0x9974('0xa'));var fs=require('fs');var _=require(_0x9974('0xb'));var squel=require(_0x9974('0xc'));var crypto=require(_0x9974('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9974('0xe'));var querystring=require(_0x9974('0xf'));var Papa=require('papaparse');var Redis=require(_0x9974('0x10'));var authService=require(_0x9974('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9974('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9974('0x13'))(_0x9974('0x14'));var utils=require(_0x9974('0x15'));var config=require(_0x9974('0x16'));var db=require(_0x9974('0x17'))['db'];function respondWithStatusCode(_0x3824b0,_0x4e4d4d){_0x4e4d4d=_0x4e4d4d||0xcc;return function(_0x206af0){if(_0x206af0){return _0x3824b0['sendStatus'](_0x4e4d4d);}return _0x3824b0[_0x9974('0x18')](_0x4e4d4d)[_0x9974('0x19')]();};}function respondWithResult(_0x4e39f7,_0x9e1818){_0x9e1818=_0x9e1818||0xc8;return function(_0x5809f3){if(_0x5809f3){return _0x4e39f7['status'](_0x9e1818)[_0x9974('0x1a')](_0x5809f3);}};}function respondWithFilteredResult(_0x534ea6,_0x5eb4ae){return function(_0x2b619c){if(_0x2b619c){var _0x4792dc=_0x2b619c[_0x9974('0x1b')],_0x15ac08=_0x5eb4ae['offset'],_0x571ef4=_0x5eb4ae[_0x9974('0x1c')]+_0x5eb4ae[_0x9974('0x1d')],_0x3b2f67;if(_0x571ef4>=_0x4792dc){_0x571ef4=_0x4792dc;_0x3b2f67=0xc8;}else{_0x3b2f67=0xce;}_0x534ea6[_0x9974('0x18')](_0x3b2f67);return _0x534ea6[_0x9974('0x1e')](_0x9974('0x1f'),_0x15ac08+'-'+_0x571ef4+'/'+_0x4792dc)['json'](_0x2b619c);}return null;};}function patchUpdates(_0x4d8bbb){return function(_0xb5c3b9){try{jsonpatch[_0x9974('0x20')](_0xb5c3b9,_0x4d8bbb,!![]);}catch(_0x20d2e3){return BPromise[_0x9974('0x21')](_0x20d2e3);}return _0xb5c3b9[_0x9974('0x22')]();};}function saveUpdates(_0x4f4f2b,_0x3704ae){return function(_0x4dfa99){if(_0x4dfa99){return _0x4dfa99[_0x9974('0x23')](_0x4f4f2b)[_0x9974('0x24')](function(_0x3581ec){return _0x3581ec;});}return null;};}function removeEntity(_0x534442,_0x42d973){return function(_0x31884b){if(_0x31884b){return _0x31884b[_0x9974('0x25')]()[_0x9974('0x24')](function(){_0x534442[_0x9974('0x18')](0xcc)[_0x9974('0x19')]();});}};}function handleEntityNotFound(_0x565f64,_0x81a8da){return function(_0x17ffc4){if(!_0x17ffc4){_0x565f64[_0x9974('0x26')](0x194);}return _0x17ffc4;};}function handleError(_0x2a30c4,_0x2e8c21){_0x2e8c21=_0x2e8c21||0x1f4;return function(_0x1651f4){logger[_0x9974('0x27')](_0x1651f4[_0x9974('0x28')]);if(_0x1651f4[_0x9974('0x29')]){delete _0x1651f4['name'];}_0x2a30c4[_0x9974('0x18')](_0x2e8c21)['send'](_0x1651f4);};}exports['index']=function(_0x59d7f3,_0x55b7be){var _0x4e5817={},_0x18c2c8={},_0x2b2b16={'count':0x0,'rows':[]};var _0x4f0c6a=_[_0x9974('0x2a')](db[_0x9974('0x2b')]['rawAttributes'],function(_0x146f53){return{'name':_0x146f53[_0x9974('0x2c')],'type':_0x146f53[_0x9974('0x2d')][_0x9974('0x2e')]};});_0x18c2c8['model']=_['map'](_0x4f0c6a,_0x9974('0x29'));_0x18c2c8[_0x9974('0x2f')]=_[_0x9974('0x30')](_0x59d7f3['query']);_0x18c2c8['filters']=_[_0x9974('0x31')](_0x18c2c8['model'],_0x18c2c8['query']);_0x4e5817['attributes']=_['intersection'](_0x18c2c8['model'],qs[_0x9974('0x32')](_0x59d7f3['query']['fields']));_0x4e5817[_0x9974('0x33')]=_0x4e5817['attributes'][_0x9974('0x34')]?_0x4e5817[_0x9974('0x33')]:_0x18c2c8['model'];if(!_0x59d7f3[_0x9974('0x2f')][_0x9974('0x35')]('nolimit')){_0x4e5817[_0x9974('0x1d')]=qs['limit'](_0x59d7f3[_0x9974('0x2f')]['limit']);_0x4e5817['offset']=qs['offset'](_0x59d7f3[_0x9974('0x2f')][_0x9974('0x1c')]);}_0x4e5817[_0x9974('0x36')]=qs[_0x9974('0x37')](_0x59d7f3[_0x9974('0x2f')]['sort']);_0x4e5817[_0x9974('0x38')]=qs['filters'](_[_0x9974('0x39')](_0x59d7f3['query'],_0x18c2c8[_0x9974('0x3a')]));if(_0x59d7f3[_0x9974('0x2f')][_0x9974('0x3b')]){_0x4e5817['where']=_[_0x9974('0x3c')](_0x4e5817[_0x9974('0x38')],{'$or':_['map'](_0x4f0c6a,function(_0x16b9c6){if(_0x16b9c6[_0x9974('0x2d')]!==_0x9974('0x3d')){var _0x2cdd97={};_0x2cdd97[_0x16b9c6[_0x9974('0x29')]]={'$like':'%'+_0x59d7f3[_0x9974('0x2f')][_0x9974('0x3b')]+'%'};return _0x2cdd97;}})});}_0x4e5817=_[_0x9974('0x3c')]({},_0x4e5817,_0x59d7f3[_0x9974('0x3e')]);var _0x5e9c23={'where':_0x4e5817[_0x9974('0x38')]};return db[_0x9974('0x2b')][_0x9974('0x1b')](_0x5e9c23)[_0x9974('0x24')](function(_0x213d12){_0x2b2b16[_0x9974('0x1b')]=_0x213d12;if(_0x59d7f3['query']['includeAll']){_0x4e5817[_0x9974('0x3f')]=[{'all':!![]}];}return db[_0x9974('0x2b')][_0x9974('0x40')](_0x4e5817);})[_0x9974('0x24')](function(_0x43984a){_0x2b2b16['rows']=_0x43984a;return _0x2b2b16;})['then'](respondWithFilteredResult(_0x55b7be,_0x4e5817))[_0x9974('0x41')](handleError(_0x55b7be,null));};exports[_0x9974('0x42')]=function(_0x461559,_0x45012c){var _0x4672cb={'raw':!![],'where':{'id':_0x461559[_0x9974('0x43')]['id']}},_0x582653={};_0x582653[_0x9974('0x44')]=_[_0x9974('0x30')](db[_0x9974('0x2b')][_0x9974('0x45')]);_0x582653['query']=_['keys'](_0x461559[_0x9974('0x2f')]);_0x582653[_0x9974('0x3a')]=_[_0x9974('0x31')](_0x582653['model'],_0x582653[_0x9974('0x2f')]);_0x4672cb[_0x9974('0x33')]=_['intersection'](_0x582653[_0x9974('0x44')],qs[_0x9974('0x32')](_0x461559[_0x9974('0x2f')][_0x9974('0x32')]));_0x4672cb[_0x9974('0x33')]=_0x4672cb['attributes'][_0x9974('0x34')]?_0x4672cb['attributes']:_0x582653['model'];if(_0x461559[_0x9974('0x2f')][_0x9974('0x46')]){_0x4672cb[_0x9974('0x3f')]=[{'all':!![]}];}_0x4672cb=_[_0x9974('0x3c')]({},_0x4672cb,_0x461559['options']);return db[_0x9974('0x2b')]['find'](_0x4672cb)['then'](handleEntityNotFound(_0x45012c,null))[_0x9974('0x24')](respondWithResult(_0x45012c,null))[_0x9974('0x41')](handleError(_0x45012c,null));};exports[_0x9974('0x47')]=function(_0x479285,_0x1aba3a){return db[_0x9974('0x2b')][_0x9974('0x47')](_0x479285[_0x9974('0x48')],{})[_0x9974('0x24')](respondWithResult(_0x1aba3a,0xc9))[_0x9974('0x41')](handleError(_0x1aba3a,null));};exports[_0x9974('0x23')]=function(_0x3d08af,_0x34c3a3){if(_0x3d08af['body']['id']){delete _0x3d08af[_0x9974('0x48')]['id'];}return db[_0x9974('0x2b')][_0x9974('0x49')]({'where':{'id':_0x3d08af[_0x9974('0x43')]['id']}})[_0x9974('0x24')](handleEntityNotFound(_0x34c3a3,null))[_0x9974('0x24')](saveUpdates(_0x3d08af[_0x9974('0x48')],null))['then'](respondWithResult(_0x34c3a3,null))[_0x9974('0x41')](handleError(_0x34c3a3,null));};exports[_0x9974('0x25')]=function(_0x5f55d1,_0x194725){return db[_0x9974('0x2b')][_0x9974('0x49')]({'where':{'id':_0x5f55d1['params']['id']}})[_0x9974('0x24')](handleEntityNotFound(_0x194725,null))[_0x9974('0x24')](removeEntity(_0x194725,null))[_0x9974('0x41')](handleError(_0x194725,null));};exports['describe']=function(_0x2c5bc5,_0x3396b7){return db[_0x9974('0x2b')][_0x9974('0x4a')]()['then'](respondWithResult(_0x3396b7,null))['catch'](handleError(_0x3396b7,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 43d1226..f30e3b3 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 _0xf244=['bluebird','request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','moment'];(function(_0x5b227f,_0x45db7e){var _0x38a460=function(_0x1e87e7){while(--_0x1e87e7){_0x5b227f['push'](_0x5b227f['shift']());}};_0x38a460(++_0x45db7e);}(_0xf244,0x98));var _0x4f24=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xf244[_0x2112d4];return _0x434972;};'use strict';var _=require(_0x4f24('0x0'));var util=require(_0x4f24('0x1'));var logger=require(_0x4f24('0x2'))('api');var moment=require(_0x4f24('0x3'));var BPromise=require(_0x4f24('0x4'));var rp=require(_0x4f24('0x5'));var fs=require('fs');var path=require(_0x4f24('0x6'));var rimraf=require('rimraf');var config=require(_0x4f24('0x7'));var attributes=require(_0x4f24('0x8'));module[_0x4f24('0x9')]=function(_0x4cd442,_0x222000){return _0x4cd442['define'](_0x4f24('0xa'),attributes,{'tableName':_0x4f24('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02e9=['report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport'];(function(_0x19f5fc,_0x4c658a){var _0x315fa3=function(_0x2198b5){while(--_0x2198b5){_0x19f5fc['push'](_0x19f5fc['shift']());}};_0x315fa3(++_0x4c658a);}(_0x02e9,0x11e));var _0x902e=function(_0x4f166f,_0x51f93e){_0x4f166f=_0x4f166f-0x0;var _0x37aed8=_0x02e9[_0x4f166f];return _0x37aed8;};'use strict';var _=require(_0x902e('0x0'));var util=require(_0x902e('0x1'));var logger=require(_0x902e('0x2'))(_0x902e('0x3'));var moment=require(_0x902e('0x4'));var BPromise=require(_0x902e('0x5'));var rp=require(_0x902e('0x6'));var fs=require('fs');var path=require(_0x902e('0x7'));var rimraf=require(_0x902e('0x8'));var config=require(_0x902e('0x9'));var attributes=require(_0x902e('0xa'));module[_0x902e('0xb')]=function(_0x45b256,_0x3ae414){return _0x45b256[_0x902e('0xc')](_0x902e('0xd'),attributes,{'tableName':_0x902e('0xe'),'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 915d484..e32300d 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 _0x0a9b=['request','then','info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x41c381,_0x1176bd){var _0x427981=function(_0x508843){while(--_0x508843){_0x41c381['push'](_0x41c381['shift']());}};_0x427981(++_0x1176bd);}(_0x0a9b,0x1b0));var _0xb0a9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0a9b[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xb0a9('0x0'));var moment=require(_0xb0a9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb0a9('0x2'));var db=require(_0xb0a9('0x3'))['db'];var utils=require(_0xb0a9('0x4'));var logger=require(_0xb0a9('0x5'))(_0xb0a9('0x6'));var config=require(_0xb0a9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb0a9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ac96d,_0x36032f,_0x2be3ac){return new BPromise(function(_0x4b8ad3,_0x2e5468){return client[_0xb0a9('0x9')](_0x2ac96d,_0x2be3ac)[_0xb0a9('0xa')](function(_0x34f2ff){logger[_0xb0a9('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x36032f,_0xb0a9('0xc'));logger[_0xb0a9('0xd')](_0xb0a9('0xe'),_0x36032f,_0xb0a9('0xc'),JSON[_0xb0a9('0xf')](_0x34f2ff));if(_0x34f2ff['error']){if(_0x34f2ff[_0xb0a9('0x10')][_0xb0a9('0x11')]===0x1f4){logger[_0xb0a9('0x10')](_0xb0a9('0x12'),_0x36032f,_0x34f2ff[_0xb0a9('0x10')][_0xb0a9('0x13')]);return _0x2e5468(_0x34f2ff[_0xb0a9('0x10')][_0xb0a9('0x13')]);}logger[_0xb0a9('0x10')](_0xb0a9('0x12'),_0x36032f,_0x34f2ff[_0xb0a9('0x10')][_0xb0a9('0x13')]);return _0x4b8ad3(_0x34f2ff[_0xb0a9('0x10')][_0xb0a9('0x13')]);}else{logger[_0xb0a9('0xb')](_0xb0a9('0x12'),_0x36032f,_0xb0a9('0xc'));_0x4b8ad3(_0x34f2ff['result'][_0xb0a9('0x13')]);}})[_0xb0a9('0x14')](function(_0x394eb7){logger[_0xb0a9('0x10')](_0xb0a9('0x12'),_0x36032f,_0x394eb7);_0x2e5468(_0x394eb7);});});} \ No newline at end of file +var _0x1769=['jayson/promise','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x314b87,_0x13705c){var _0x4c3dd3=function(_0x42d0e2){while(--_0x42d0e2){_0x314b87['push'](_0x314b87['shift']());}};_0x4c3dd3(++_0x13705c);}(_0x1769,0xcc));var _0x9176=function(_0x527238,_0x21f261){_0x527238=_0x527238-0x0;var _0x4d45dc=_0x1769[_0x527238];return _0x4d45dc;};'use strict';var _=require(_0x9176('0x0'));var util=require('util');var moment=require(_0x9176('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(_0x9176('0x2'));var logger=require(_0x9176('0x3'))(_0x9176('0x4'));var config=require(_0x9176('0x5'));var jayson=require(_0x9176('0x6'));var client=jayson[_0x9176('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x380ea7,_0xd8b72a,_0x2d5dd4){return new BPromise(function(_0x5e76de,_0x1e6a7c){return client[_0x9176('0x8')](_0x380ea7,_0x2d5dd4)[_0x9176('0x9')](function(_0x56e558){logger[_0x9176('0xa')](_0x9176('0xb'),_0xd8b72a,_0x9176('0xc'));logger[_0x9176('0xd')](_0x9176('0xe'),_0xd8b72a,_0x9176('0xc'),JSON[_0x9176('0xf')](_0x56e558));if(_0x56e558['error']){if(_0x56e558['error'][_0x9176('0x10')]===0x1f4){logger[_0x9176('0x11')](_0x9176('0xb'),_0xd8b72a,_0x56e558[_0x9176('0x11')]['message']);return _0x1e6a7c(_0x56e558[_0x9176('0x11')]['message']);}logger[_0x9176('0x11')](_0x9176('0xb'),_0xd8b72a,_0x56e558[_0x9176('0x11')][_0x9176('0x12')]);return _0x5e76de(_0x56e558[_0x9176('0x11')]['message']);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0xd8b72a,_0x9176('0xc'));_0x5e76de(_0x56e558[_0x9176('0x13')]['message']);}})[_0x9176('0x14')](function(_0x3fef50){logger['error'](_0x9176('0xb'),_0xd8b72a,_0x3fef50);_0x1e6a7c(_0x3fef50);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 4520d9d..ca075b6 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 _0xf873=['../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xf873,0xb2));var _0x3f87=function(_0x3f84f8,_0x5b6101){_0x3f84f8=_0x3f84f8-0x0;var _0x3d5e4b=_0xf873[_0x3f84f8];return _0x3d5e4b;};'use strict';var multer=require('multer');var util=require(_0x3f87('0x0'));var path=require(_0x3f87('0x1'));var timeout=require(_0x3f87('0x2'));var express=require(_0x3f87('0x3'));var router=express[_0x3f87('0x4')]();var auth=require(_0x3f87('0x5'));var interaction=require(_0x3f87('0x6'));var config=require(_0x3f87('0x7'));var controller=require(_0x3f87('0x8'));router['get']('/',auth[_0x3f87('0x9')](),controller[_0x3f87('0xa')]);router[_0x3f87('0xb')]('/describe',auth[_0x3f87('0x9')](),controller[_0x3f87('0xc')]);router[_0x3f87('0xb')](_0x3f87('0xd'),auth[_0x3f87('0x9')](),controller[_0x3f87('0xe')]);router['get'](_0x3f87('0xf'),auth[_0x3f87('0x9')](),controller[_0x3f87('0x10')]);router[_0x3f87('0x11')]('/',auth[_0x3f87('0x9')](),controller[_0x3f87('0x12')]);router[_0x3f87('0x13')](_0x3f87('0xd'),auth[_0x3f87('0x9')](),controller[_0x3f87('0x14')]);router[_0x3f87('0x15')](_0x3f87('0xd'),auth[_0x3f87('0x9')](),controller[_0x3f87('0x16')]);module['exports']=router; \ No newline at end of file +var _0x0ba7=['/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ba7,0x16d));var _0x70ba=function(_0x4f5cd3,_0xd9ca28){_0x4f5cd3=_0x4f5cd3-0x0;var _0x14d881=_0x0ba7[_0x4f5cd3];return _0x14d881;};'use strict';var multer=require(_0x70ba('0x0'));var util=require('util');var path=require(_0x70ba('0x1'));var timeout=require(_0x70ba('0x2'));var express=require(_0x70ba('0x3'));var router=express[_0x70ba('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x70ba('0x5'));var config=require(_0x70ba('0x6'));var controller=require(_0x70ba('0x7'));router[_0x70ba('0x8')]('/',auth[_0x70ba('0x9')](),controller[_0x70ba('0xa')]);router[_0x70ba('0x8')](_0x70ba('0xb'),auth[_0x70ba('0x9')](),controller[_0x70ba('0xc')]);router[_0x70ba('0x8')](_0x70ba('0xd'),auth[_0x70ba('0x9')](),controller[_0x70ba('0xe')]);router[_0x70ba('0x8')]('/:id/questions',auth[_0x70ba('0x9')](),controller['getQuestions']);router[_0x70ba('0xf')]('/',auth[_0x70ba('0x9')](),controller[_0x70ba('0x10')]);router[_0x70ba('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x70ba('0x12')]);router['delete'](_0x70ba('0xd'),auth['isAuthenticated'](),controller[_0x70ba('0x13')]);module[_0x70ba('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 590c604..f484e4b 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 _0x5309=['setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','exports','DATE'];(function(_0x640108,_0x239ea9){var _0x23f7a4=function(_0x32bd06){while(--_0x32bd06){_0x640108['push'](_0x640108['shift']());}};_0x23f7a4(++_0x239ea9);}(_0x5309,0x1be));var _0x9530=function(_0x26bcec,_0xe13f50){_0x26bcec=_0x26bcec-0x0;var _0x1049dc=_0x5309[_0x26bcec];return _0x1049dc;};'use strict';var moment=require(_0x9530('0x0'));var Sequelize=require(_0x9530('0x1'));module[_0x9530('0x2')]={'starttime':{'type':Sequelize[_0x9530('0x3')],'set':function(_0x2bdb1e){this[_0x9530('0x4')](_0x9530('0x5'),_0x2bdb1e);this[_0x9530('0x4')](_0x9530('0x6'),moment()[_0x9530('0x7')](_0x9530('0x8')));}},'endtime':{'type':Sequelize[_0x9530('0x3')]},'membername':{'type':Sequelize[_0x9530('0x9')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x9530('0x9')]},'uniqueid':{'type':Sequelize[_0x9530('0x9')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x9530('0x9')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x69c0=['starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','DATE','setDataValue'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x69c0,0x180));var _0x069c=function(_0x40911a,_0x55ec99){_0x40911a=_0x40911a-0x0;var _0x27e8e3=_0x69c0[_0x40911a];return _0x27e8e3;};'use strict';var moment=require('moment');var Sequelize=require(_0x069c('0x0'));module['exports']={'starttime':{'type':Sequelize[_0x069c('0x1')],'set':function(_0x1cce12){this[_0x069c('0x2')](_0x069c('0x3'),_0x1cce12);this['setDataValue'](_0x069c('0x4'),moment()[_0x069c('0x5')](_0x069c('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x069c('0x7')]},'projectname':{'type':Sequelize[_0x069c('0x7')]},'queue':{'type':Sequelize[_0x069c('0x7')]},'uniqueid':{'type':Sequelize[_0x069c('0x7')]},'calleridname':{'type':Sequelize[_0x069c('0x7')]},'calleridnum':{'type':Sequelize[_0x069c('0x7')]},'completed':{'type':Sequelize[_0x069c('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 2f56139..8a5251f 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 _0x394e=['query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','JscriptySessionReport','include','findAll','show','keys','options','catch','create','body','update','find','params','describe','findOne','SessionId','includeAll','JscriptyQuestionReport','rows','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','map','rawAttributes','type','key','model'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x394e,0x111));var _0xe394=function(_0x36a87c,_0x17d58c){_0x36a87c=_0x36a87c-0x0;var _0x6cd4e3=_0x394e[_0x36a87c];return _0x6cd4e3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe394('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe394('0x1'));var jsonpatch=require(_0xe394('0x2'));var rp=require(_0xe394('0x3'));var moment=require(_0xe394('0x4'));var BPromise=require(_0xe394('0x5'));var Mustache=require('mustache');var util=require(_0xe394('0x6'));var path=require(_0xe394('0x7'));var sox=require('sox');var csv=require(_0xe394('0x8'));var ejs=require(_0xe394('0x9'));var fs=require('fs');var _=require(_0xe394('0xa'));var squel=require('squel');var crypto=require(_0xe394('0xb'));var jsforce=require(_0xe394('0xc'));var deskjs=require(_0xe394('0xd'));var toCsv=require(_0xe394('0x8'));var querystring=require(_0xe394('0xe'));var Papa=require(_0xe394('0xf'));var Redis=require(_0xe394('0x10'));var authService=require(_0xe394('0x11'));var qs=require(_0xe394('0x12'));var as=require(_0xe394('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe394('0x14'));var utils=require(_0xe394('0x15'));var config=require(_0xe394('0x16'));var db=require(_0xe394('0x17'))['db'];function respondWithStatusCode(_0x5ec1f4,_0x3493f6){_0x3493f6=_0x3493f6||0xcc;return function(_0x4bfe60){if(_0x4bfe60){return _0x5ec1f4[_0xe394('0x18')](_0x3493f6);}return _0x5ec1f4['status'](_0x3493f6)[_0xe394('0x19')]();};}function respondWithResult(_0x382691,_0x4a2649){_0x4a2649=_0x4a2649||0xc8;return function(_0x5b83a9){if(_0x5b83a9){return _0x382691['status'](_0x4a2649)[_0xe394('0x1a')](_0x5b83a9);}};}function respondWithFilteredResult(_0x39c22e,_0x143233){return function(_0x278522){if(_0x278522){var _0x19b836=_0x278522[_0xe394('0x1b')],_0x40fb22=_0x143233[_0xe394('0x1c')],_0x46d78a=_0x143233[_0xe394('0x1c')]+_0x143233[_0xe394('0x1d')],_0x24e485;if(_0x46d78a>=_0x19b836){_0x46d78a=_0x19b836;_0x24e485=0xc8;}else{_0x24e485=0xce;}_0x39c22e[_0xe394('0x1e')](_0x24e485);return _0x39c22e[_0xe394('0x1f')](_0xe394('0x20'),_0x40fb22+'-'+_0x46d78a+'/'+_0x19b836)[_0xe394('0x1a')](_0x278522);}return null;};}function patchUpdates(_0x364f3f){return function(_0x2fc55b){try{jsonpatch[_0xe394('0x21')](_0x2fc55b,_0x364f3f,!![]);}catch(_0x5d9563){return BPromise[_0xe394('0x22')](_0x5d9563);}return _0x2fc55b[_0xe394('0x23')]();};}function saveUpdates(_0x37e064,_0x2ea88f){return function(_0x33ee79){if(_0x33ee79){return _0x33ee79['update'](_0x37e064)['then'](function(_0x5bbbe7){return _0x5bbbe7;});}return null;};}function removeEntity(_0x143978,_0x5819a3){return function(_0x1ba0a8){if(_0x1ba0a8){return _0x1ba0a8[_0xe394('0x24')]()[_0xe394('0x25')](function(){_0x143978[_0xe394('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x565b6a,_0x1a00f3){return function(_0x3d40c2){if(!_0x3d40c2){_0x565b6a['sendStatus'](0x194);}return _0x3d40c2;};}function handleError(_0x1ece78,_0x265c25){_0x265c25=_0x265c25||0x1f4;return function(_0x4c05a9){logger['error'](_0x4c05a9[_0xe394('0x26')]);if(_0x4c05a9[_0xe394('0x27')]){delete _0x4c05a9['name'];}_0x1ece78[_0xe394('0x1e')](_0x265c25)[_0xe394('0x28')](_0x4c05a9);};}exports[_0xe394('0x29')]=function(_0x4b5a9a,_0x1660da){var _0x4ab5ce={},_0x14af9c={},_0xfc4e05={'count':0x0,'rows':[]};var _0x5a924a=_[_0xe394('0x2a')](db['JscriptySessionReport'][_0xe394('0x2b')],function(_0x153358){return{'name':_0x153358['fieldName'],'type':_0x153358[_0xe394('0x2c')][_0xe394('0x2d')]};});_0x14af9c[_0xe394('0x2e')]=_['map'](_0x5a924a,'name');_0x14af9c['query']=_['keys'](_0x4b5a9a[_0xe394('0x2f')]);_0x14af9c[_0xe394('0x30')]=_[_0xe394('0x31')](_0x14af9c[_0xe394('0x2e')],_0x14af9c[_0xe394('0x2f')]);_0x4ab5ce['attributes']=_[_0xe394('0x31')](_0x14af9c[_0xe394('0x2e')],qs[_0xe394('0x32')](_0x4b5a9a[_0xe394('0x2f')]['fields']));_0x4ab5ce[_0xe394('0x33')]=_0x4ab5ce['attributes'][_0xe394('0x34')]?_0x4ab5ce['attributes']:_0x14af9c[_0xe394('0x2e')];if(!_0x4b5a9a[_0xe394('0x2f')][_0xe394('0x35')](_0xe394('0x36'))){_0x4ab5ce[_0xe394('0x1d')]=qs['limit'](_0x4b5a9a[_0xe394('0x2f')][_0xe394('0x1d')]);_0x4ab5ce[_0xe394('0x1c')]=qs[_0xe394('0x1c')](_0x4b5a9a[_0xe394('0x2f')]['offset']);}_0x4ab5ce[_0xe394('0x37')]=qs[_0xe394('0x38')](_0x4b5a9a['query'][_0xe394('0x38')]);_0x4ab5ce[_0xe394('0x39')]=qs['filters'](_[_0xe394('0x3a')](_0x4b5a9a[_0xe394('0x2f')],_0x14af9c[_0xe394('0x30')]));if(_0x4b5a9a[_0xe394('0x2f')][_0xe394('0x3b')]){_0x4ab5ce['where']=_[_0xe394('0x3c')](_0x4ab5ce[_0xe394('0x39')],{'$or':_['map'](_0x5a924a,function(_0xa2955e){if(_0xa2955e[_0xe394('0x2c')]!==_0xe394('0x3d')){var _0x8883c={};_0x8883c[_0xa2955e['name']]={'$like':'%'+_0x4b5a9a[_0xe394('0x2f')][_0xe394('0x3b')]+'%'};return _0x8883c;}})});}_0x4ab5ce=_[_0xe394('0x3c')]({},_0x4ab5ce,_0x4b5a9a['options']);var _0x5ac958={'where':_0x4ab5ce[_0xe394('0x39')]};return db[_0xe394('0x3e')][_0xe394('0x1b')](_0x5ac958)[_0xe394('0x25')](function(_0x4f37cc){_0xfc4e05[_0xe394('0x1b')]=_0x4f37cc;if(_0x4b5a9a[_0xe394('0x2f')]['includeAll']){_0x4ab5ce[_0xe394('0x3f')]=[{'all':!![]}];}return db[_0xe394('0x3e')][_0xe394('0x40')](_0x4ab5ce);})[_0xe394('0x25')](function(_0x3e3121){_0xfc4e05['rows']=_0x3e3121;return _0xfc4e05;})[_0xe394('0x25')](respondWithFilteredResult(_0x1660da,_0x4ab5ce))['catch'](handleError(_0x1660da,null));};exports[_0xe394('0x41')]=function(_0x58c8bd,_0x2390db){var _0xfc046e={'raw':!![],'where':{'id':_0x58c8bd['params']['id']}},_0x24d28f={};_0x24d28f[_0xe394('0x2e')]=_[_0xe394('0x42')](db[_0xe394('0x3e')][_0xe394('0x2b')]);_0x24d28f[_0xe394('0x2f')]=_[_0xe394('0x42')](_0x58c8bd[_0xe394('0x2f')]);_0x24d28f[_0xe394('0x30')]=_['intersection'](_0x24d28f[_0xe394('0x2e')],_0x24d28f[_0xe394('0x2f')]);_0xfc046e['attributes']=_['intersection'](_0x24d28f['model'],qs[_0xe394('0x32')](_0x58c8bd[_0xe394('0x2f')][_0xe394('0x32')]));_0xfc046e[_0xe394('0x33')]=_0xfc046e[_0xe394('0x33')]['length']?_0xfc046e['attributes']:_0x24d28f[_0xe394('0x2e')];if(_0x58c8bd[_0xe394('0x2f')]['includeAll']){_0xfc046e[_0xe394('0x3f')]=[{'all':!![]}];}_0xfc046e=_[_0xe394('0x3c')]({},_0xfc046e,_0x58c8bd[_0xe394('0x43')]);return db[_0xe394('0x3e')]['find'](_0xfc046e)[_0xe394('0x25')](handleEntityNotFound(_0x2390db,null))[_0xe394('0x25')](respondWithResult(_0x2390db,null))[_0xe394('0x44')](handleError(_0x2390db,null));};exports['create']=function(_0x31f8d4,_0x1aaa23){return db[_0xe394('0x3e')][_0xe394('0x45')](_0x31f8d4[_0xe394('0x46')],{})[_0xe394('0x25')](respondWithResult(_0x1aaa23,0xc9))[_0xe394('0x44')](handleError(_0x1aaa23,null));};exports[_0xe394('0x47')]=function(_0x219034,_0x2f171f){if(_0x219034[_0xe394('0x46')]['id']){delete _0x219034[_0xe394('0x46')]['id'];}return db[_0xe394('0x3e')][_0xe394('0x48')]({'where':{'id':_0x219034[_0xe394('0x49')]['id']}})[_0xe394('0x25')](handleEntityNotFound(_0x2f171f,null))[_0xe394('0x25')](saveUpdates(_0x219034['body'],null))['then'](respondWithResult(_0x2f171f,null))[_0xe394('0x44')](handleError(_0x2f171f,null));};exports['destroy']=function(_0x29a7c3,_0xa85e9a){return db[_0xe394('0x3e')][_0xe394('0x48')]({'where':{'id':_0x29a7c3[_0xe394('0x49')]['id']}})[_0xe394('0x25')](handleEntityNotFound(_0xa85e9a,null))[_0xe394('0x25')](removeEntity(_0xa85e9a,null))[_0xe394('0x44')](handleError(_0xa85e9a,null));};exports[_0xe394('0x4a')]=function(_0x496c5a,_0x4eb894){return db[_0xe394('0x3e')][_0xe394('0x4a')]()[_0xe394('0x25')](respondWithResult(_0x4eb894,null))[_0xe394('0x44')](handleError(_0x4eb894,null));};exports['getQuestions']=function(_0x22ca7a,_0x5265d0,_0x2985f3){var _0x390d10={'raw':!![],'where':{}};var _0x4ae23e={};var _0x4c4a12={'count':0x0,'rows':[]};return db[_0xe394('0x3e')][_0xe394('0x4b')]({'where':{'id':_0x22ca7a[_0xe394('0x49')]['id']}})[_0xe394('0x25')](handleEntityNotFound(_0x5265d0,null))[_0xe394('0x25')](function(_0x330273){if(_0x330273){_0x4ae23e['model']=_[_0xe394('0x42')](db['JscriptyQuestionReport']['rawAttributes']);_0x4ae23e[_0xe394('0x2f')]=_[_0xe394('0x42')](_0x22ca7a[_0xe394('0x2f')]);_0x4ae23e[_0xe394('0x30')]=_[_0xe394('0x31')](_0x4ae23e[_0xe394('0x2e')],_0x4ae23e[_0xe394('0x2f')]);_0x390d10[_0xe394('0x33')]=_[_0xe394('0x31')](_0x4ae23e[_0xe394('0x2e')],qs[_0xe394('0x32')](_0x22ca7a[_0xe394('0x2f')]['fields']));_0x390d10[_0xe394('0x33')]=_0x390d10[_0xe394('0x33')][_0xe394('0x34')]?_0x390d10[_0xe394('0x33')]:_0x4ae23e[_0xe394('0x2e')];if(!_0x22ca7a[_0xe394('0x2f')][_0xe394('0x35')]('nolimit')){_0x390d10[_0xe394('0x1d')]=qs[_0xe394('0x1d')](_0x22ca7a[_0xe394('0x2f')]['limit']);_0x390d10[_0xe394('0x1c')]=qs[_0xe394('0x1c')](_0x22ca7a[_0xe394('0x2f')][_0xe394('0x1c')]);}_0x390d10[_0xe394('0x37')]=qs[_0xe394('0x38')](_0x22ca7a[_0xe394('0x2f')][_0xe394('0x38')]);_0x390d10[_0xe394('0x39')]=qs[_0xe394('0x30')](_[_0xe394('0x3a')](_0x22ca7a[_0xe394('0x2f')],_0x4ae23e['filters']));_0x390d10[_0xe394('0x39')][_0xe394('0x4c')]=_0x330273['id'];if(_0x22ca7a[_0xe394('0x2f')]['filter']){_0x390d10[_0xe394('0x39')]=_[_0xe394('0x3c')](_0x390d10['where'],{'$or':_[_0xe394('0x2a')](_0x390d10[_0xe394('0x33')],function(_0x267699){var _0x2b187e={};_0x2b187e[_0x267699]={'$like':'%'+_0x22ca7a[_0xe394('0x2f')]['filter']+'%'};return _0x2b187e;})});}_0x390d10=_[_0xe394('0x3c')]({},_0x390d10,_0x22ca7a[_0xe394('0x43')]);return db['JscriptyQuestionReport'][_0xe394('0x1b')]({'where':_0x390d10['where']})[_0xe394('0x25')](function(_0x26b991){_0x4c4a12[_0xe394('0x1b')]=_0x26b991;if(_0x22ca7a[_0xe394('0x2f')][_0xe394('0x4d')]){_0x390d10['include']=[{'all':!![]}];}return db[_0xe394('0x4e')][_0xe394('0x40')](_0x390d10);})[_0xe394('0x25')](function(_0xc1baec){_0x4c4a12[_0xe394('0x4f')]=_0xc1baec;return _0x4c4a12;});}})[_0xe394('0x25')](respondWithFilteredResult(_0x5265d0,_0x390d10))['catch'](handleError(_0x5265d0,null));}; \ No newline at end of file +var _0x5518=['../../config/utils','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','includeAll','create','body','update','find','params','destroy','describe','getQuestions','findOne','SessionId','JscriptyQuestionReport','html-pdf','rimraf','zip-dir','request-promise','moment','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'];(function(_0x4ed788,_0x27f718){var _0x1fc7dc=function(_0x1989ca){while(--_0x1989ca){_0x4ed788['push'](_0x4ed788['shift']());}};_0x1fc7dc(++_0x27f718);}(_0x5518,0x131));var _0x8551=function(_0x482ddd,_0x3e1bd2){_0x482ddd=_0x482ddd-0x0;var _0x5c4a0f=_0x5518[_0x482ddd];return _0x5c4a0f;};'use strict';var pdf=require(_0x8551('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8551('0x1'));var zipdir=require(_0x8551('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8551('0x3'));var moment=require(_0x8551('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8551('0x5'));var util=require(_0x8551('0x6'));var path=require(_0x8551('0x7'));var sox=require(_0x8551('0x8'));var csv=require(_0x8551('0x9'));var ejs=require(_0x8551('0xa'));var fs=require('fs');var _=require(_0x8551('0xb'));var squel=require(_0x8551('0xc'));var crypto=require(_0x8551('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8551('0xe'));var toCsv=require(_0x8551('0x9'));var querystring=require(_0x8551('0xf'));var Papa=require(_0x8551('0x10'));var Redis=require(_0x8551('0x11'));var authService=require(_0x8551('0x12'));var qs=require(_0x8551('0x13'));var as=require(_0x8551('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8551('0x15'))(_0x8551('0x16'));var utils=require(_0x8551('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f377b,_0x72a97e){_0x72a97e=_0x72a97e||0xcc;return function(_0x4b3652){if(_0x4b3652){return _0x5f377b['sendStatus'](_0x72a97e);}return _0x5f377b[_0x8551('0x18')](_0x72a97e)[_0x8551('0x19')]();};}function respondWithResult(_0x3c16c1,_0x7b955d){_0x7b955d=_0x7b955d||0xc8;return function(_0x294d6c){if(_0x294d6c){return _0x3c16c1[_0x8551('0x18')](_0x7b955d)[_0x8551('0x1a')](_0x294d6c);}};}function respondWithFilteredResult(_0x360c3c,_0x5e64ea){return function(_0xd90d6a){if(_0xd90d6a){var _0x2068c3=_0xd90d6a[_0x8551('0x1b')],_0x2fb40b=_0x5e64ea['offset'],_0x22f909=_0x5e64ea[_0x8551('0x1c')]+_0x5e64ea[_0x8551('0x1d')],_0x541171;if(_0x22f909>=_0x2068c3){_0x22f909=_0x2068c3;_0x541171=0xc8;}else{_0x541171=0xce;}_0x360c3c[_0x8551('0x18')](_0x541171);return _0x360c3c[_0x8551('0x1e')](_0x8551('0x1f'),_0x2fb40b+'-'+_0x22f909+'/'+_0x2068c3)[_0x8551('0x1a')](_0xd90d6a);}return null;};}function patchUpdates(_0x54910a){return function(_0xa9fc1b){try{jsonpatch[_0x8551('0x20')](_0xa9fc1b,_0x54910a,!![]);}catch(_0x334858){return BPromise[_0x8551('0x21')](_0x334858);}return _0xa9fc1b[_0x8551('0x22')]();};}function saveUpdates(_0x4082dd,_0x24e742){return function(_0x3af2b1){if(_0x3af2b1){return _0x3af2b1['update'](_0x4082dd)[_0x8551('0x23')](function(_0x5a5c7b){return _0x5a5c7b;});}return null;};}function removeEntity(_0x411bb1,_0x2a2c61){return function(_0x3dd070){if(_0x3dd070){return _0x3dd070['destroy']()[_0x8551('0x23')](function(){_0x411bb1[_0x8551('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14b176,_0x528229){return function(_0x1c8b5e){if(!_0x1c8b5e){_0x14b176[_0x8551('0x24')](0x194);}return _0x1c8b5e;};}function handleError(_0x4ccb20,_0x425d75){_0x425d75=_0x425d75||0x1f4;return function(_0x12864f){logger[_0x8551('0x25')](_0x12864f[_0x8551('0x26')]);if(_0x12864f[_0x8551('0x27')]){delete _0x12864f[_0x8551('0x27')];}_0x4ccb20[_0x8551('0x18')](_0x425d75)[_0x8551('0x28')](_0x12864f);};}exports[_0x8551('0x29')]=function(_0xe29588,_0x4781f0){var _0x2bc2cb={},_0x5652ef={},_0x1d9295={'count':0x0,'rows':[]};var _0x5eab36=_[_0x8551('0x2a')](db[_0x8551('0x2b')][_0x8551('0x2c')],function(_0x2a0969){return{'name':_0x2a0969[_0x8551('0x2d')],'type':_0x2a0969[_0x8551('0x2e')][_0x8551('0x2f')]};});_0x5652ef[_0x8551('0x30')]=_[_0x8551('0x2a')](_0x5eab36,_0x8551('0x27'));_0x5652ef['query']=_[_0x8551('0x31')](_0xe29588[_0x8551('0x32')]);_0x5652ef[_0x8551('0x33')]=_[_0x8551('0x34')](_0x5652ef[_0x8551('0x30')],_0x5652ef[_0x8551('0x32')]);_0x2bc2cb[_0x8551('0x35')]=_['intersection'](_0x5652ef['model'],qs[_0x8551('0x36')](_0xe29588['query'][_0x8551('0x36')]));_0x2bc2cb['attributes']=_0x2bc2cb['attributes'][_0x8551('0x37')]?_0x2bc2cb[_0x8551('0x35')]:_0x5652ef[_0x8551('0x30')];if(!_0xe29588[_0x8551('0x32')][_0x8551('0x38')](_0x8551('0x39'))){_0x2bc2cb[_0x8551('0x1d')]=qs[_0x8551('0x1d')](_0xe29588[_0x8551('0x32')]['limit']);_0x2bc2cb[_0x8551('0x1c')]=qs['offset'](_0xe29588[_0x8551('0x32')]['offset']);}_0x2bc2cb[_0x8551('0x3a')]=qs[_0x8551('0x3b')](_0xe29588[_0x8551('0x32')]['sort']);_0x2bc2cb[_0x8551('0x3c')]=qs[_0x8551('0x33')](_[_0x8551('0x3d')](_0xe29588[_0x8551('0x32')],_0x5652ef[_0x8551('0x33')]));if(_0xe29588[_0x8551('0x32')][_0x8551('0x3e')]){_0x2bc2cb[_0x8551('0x3c')]=_[_0x8551('0x3f')](_0x2bc2cb[_0x8551('0x3c')],{'$or':_['map'](_0x5eab36,function(_0x39a8d5){if(_0x39a8d5[_0x8551('0x2e')]!=='VIRTUAL'){var _0x5b3418={};_0x5b3418[_0x39a8d5[_0x8551('0x27')]]={'$like':'%'+_0xe29588[_0x8551('0x32')][_0x8551('0x3e')]+'%'};return _0x5b3418;}})});}_0x2bc2cb=_[_0x8551('0x3f')]({},_0x2bc2cb,_0xe29588[_0x8551('0x40')]);var _0x5d58e3={'where':_0x2bc2cb[_0x8551('0x3c')]};return db[_0x8551('0x2b')][_0x8551('0x1b')](_0x5d58e3)[_0x8551('0x23')](function(_0x518e1d){_0x1d9295['count']=_0x518e1d;if(_0xe29588['query']['includeAll']){_0x2bc2cb[_0x8551('0x41')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x8551('0x42')](_0x2bc2cb);})[_0x8551('0x23')](function(_0x1eb071){_0x1d9295[_0x8551('0x43')]=_0x1eb071;return _0x1d9295;})[_0x8551('0x23')](respondWithFilteredResult(_0x4781f0,_0x2bc2cb))[_0x8551('0x44')](handleError(_0x4781f0,null));};exports[_0x8551('0x45')]=function(_0x10968d,_0x4b8155){var _0x2f73ff={'raw':!![],'where':{'id':_0x10968d['params']['id']}},_0x1ae324={};_0x1ae324[_0x8551('0x30')]=_['keys'](db[_0x8551('0x2b')][_0x8551('0x2c')]);_0x1ae324['query']=_[_0x8551('0x31')](_0x10968d['query']);_0x1ae324[_0x8551('0x33')]=_['intersection'](_0x1ae324[_0x8551('0x30')],_0x1ae324[_0x8551('0x32')]);_0x2f73ff['attributes']=_[_0x8551('0x34')](_0x1ae324['model'],qs[_0x8551('0x36')](_0x10968d['query'][_0x8551('0x36')]));_0x2f73ff[_0x8551('0x35')]=_0x2f73ff[_0x8551('0x35')][_0x8551('0x37')]?_0x2f73ff[_0x8551('0x35')]:_0x1ae324['model'];if(_0x10968d[_0x8551('0x32')][_0x8551('0x46')]){_0x2f73ff[_0x8551('0x41')]=[{'all':!![]}];}_0x2f73ff=_[_0x8551('0x3f')]({},_0x2f73ff,_0x10968d[_0x8551('0x40')]);return db[_0x8551('0x2b')]['find'](_0x2f73ff)[_0x8551('0x23')](handleEntityNotFound(_0x4b8155,null))['then'](respondWithResult(_0x4b8155,null))[_0x8551('0x44')](handleError(_0x4b8155,null));};exports[_0x8551('0x47')]=function(_0x4f9a4b,_0x55ca2b){return db[_0x8551('0x2b')][_0x8551('0x47')](_0x4f9a4b[_0x8551('0x48')],{})[_0x8551('0x23')](respondWithResult(_0x55ca2b,0xc9))[_0x8551('0x44')](handleError(_0x55ca2b,null));};exports[_0x8551('0x49')]=function(_0x2abf83,_0x51cb2c){if(_0x2abf83[_0x8551('0x48')]['id']){delete _0x2abf83[_0x8551('0x48')]['id'];}return db[_0x8551('0x2b')][_0x8551('0x4a')]({'where':{'id':_0x2abf83[_0x8551('0x4b')]['id']}})['then'](handleEntityNotFound(_0x51cb2c,null))[_0x8551('0x23')](saveUpdates(_0x2abf83[_0x8551('0x48')],null))[_0x8551('0x23')](respondWithResult(_0x51cb2c,null))['catch'](handleError(_0x51cb2c,null));};exports[_0x8551('0x4c')]=function(_0xa60335,_0x523dce){return db[_0x8551('0x2b')]['find']({'where':{'id':_0xa60335[_0x8551('0x4b')]['id']}})[_0x8551('0x23')](handleEntityNotFound(_0x523dce,null))[_0x8551('0x23')](removeEntity(_0x523dce,null))[_0x8551('0x44')](handleError(_0x523dce,null));};exports[_0x8551('0x4d')]=function(_0x20d25b,_0x33af34){return db[_0x8551('0x2b')][_0x8551('0x4d')]()['then'](respondWithResult(_0x33af34,null))['catch'](handleError(_0x33af34,null));};exports[_0x8551('0x4e')]=function(_0x4de63e,_0x405a92,_0x246538){var _0x55e82e={'raw':!![],'where':{}};var _0x415476={};var _0x401b58={'count':0x0,'rows':[]};return db[_0x8551('0x2b')][_0x8551('0x4f')]({'where':{'id':_0x4de63e[_0x8551('0x4b')]['id']}})[_0x8551('0x23')](handleEntityNotFound(_0x405a92,null))['then'](function(_0x2974af){if(_0x2974af){_0x415476[_0x8551('0x30')]=_['keys'](db['JscriptyQuestionReport'][_0x8551('0x2c')]);_0x415476['query']=_['keys'](_0x4de63e[_0x8551('0x32')]);_0x415476['filters']=_[_0x8551('0x34')](_0x415476['model'],_0x415476[_0x8551('0x32')]);_0x55e82e[_0x8551('0x35')]=_[_0x8551('0x34')](_0x415476[_0x8551('0x30')],qs[_0x8551('0x36')](_0x4de63e[_0x8551('0x32')]['fields']));_0x55e82e[_0x8551('0x35')]=_0x55e82e[_0x8551('0x35')][_0x8551('0x37')]?_0x55e82e[_0x8551('0x35')]:_0x415476[_0x8551('0x30')];if(!_0x4de63e[_0x8551('0x32')]['hasOwnProperty']('nolimit')){_0x55e82e[_0x8551('0x1d')]=qs[_0x8551('0x1d')](_0x4de63e[_0x8551('0x32')][_0x8551('0x1d')]);_0x55e82e['offset']=qs[_0x8551('0x1c')](_0x4de63e['query'][_0x8551('0x1c')]);}_0x55e82e['order']=qs['sort'](_0x4de63e[_0x8551('0x32')][_0x8551('0x3b')]);_0x55e82e[_0x8551('0x3c')]=qs[_0x8551('0x33')](_[_0x8551('0x3d')](_0x4de63e[_0x8551('0x32')],_0x415476['filters']));_0x55e82e[_0x8551('0x3c')][_0x8551('0x50')]=_0x2974af['id'];if(_0x4de63e[_0x8551('0x32')][_0x8551('0x3e')]){_0x55e82e[_0x8551('0x3c')]=_['merge'](_0x55e82e[_0x8551('0x3c')],{'$or':_[_0x8551('0x2a')](_0x55e82e[_0x8551('0x35')],function(_0xe60832){var _0x223a8c={};_0x223a8c[_0xe60832]={'$like':'%'+_0x4de63e[_0x8551('0x32')][_0x8551('0x3e')]+'%'};return _0x223a8c;})});}_0x55e82e=_['merge']({},_0x55e82e,_0x4de63e[_0x8551('0x40')]);return db['JscriptyQuestionReport'][_0x8551('0x1b')]({'where':_0x55e82e['where']})[_0x8551('0x23')](function(_0x2011f7){_0x401b58['count']=_0x2011f7;if(_0x4de63e[_0x8551('0x32')][_0x8551('0x46')]){_0x55e82e[_0x8551('0x41')]=[{'all':!![]}];}return db[_0x8551('0x51')][_0x8551('0x42')](_0x55e82e);})[_0x8551('0x23')](function(_0x5190e4){_0x401b58[_0x8551('0x43')]=_0x5190e4;return _0x401b58;});}})[_0x8551('0x23')](respondWithFilteredResult(_0x405a92,_0x55e82e))[_0x8551('0x44')](handleError(_0x405a92,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index fd628ec..740adb6 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 _0x7ebe=['./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0x7ebe,0xe2));var _0xe7eb=function(_0x406943,_0x24e0b7){_0x406943=_0x406943-0x0;var _0x1ac440=_0x7ebe[_0x406943];return _0x1ac440;};'use strict';var _=require(_0xe7eb('0x0'));var util=require(_0xe7eb('0x1'));var logger=require(_0xe7eb('0x2'))('api');var moment=require(_0xe7eb('0x3'));var BPromise=require(_0xe7eb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe7eb('0x5'));var rimraf=require(_0xe7eb('0x6'));var config=require(_0xe7eb('0x7'));var attributes=require(_0xe7eb('0x8'));module[_0xe7eb('0x9')]=function(_0x225be6,_0x3bfc34){return _0x225be6[_0xe7eb('0xa')](_0xe7eb('0xb'),attributes,{'tableName':_0xe7eb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb16=['path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','lodash','api','bluebird','request-promise'];(function(_0x4c78ee,_0x1202fa){var _0x1124b8=function(_0xd7804){while(--_0xd7804){_0x4c78ee['push'](_0x4c78ee['shift']());}};_0x1124b8(++_0x1202fa);}(_0xbb16,0xba));var _0x6bb1=function(_0x5ce142,_0x359db6){_0x5ce142=_0x5ce142-0x0;var _0x4e63a5=_0xbb16[_0x5ce142];return _0x4e63a5;};'use strict';var _=require(_0x6bb1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6bb1('0x1'));var moment=require('moment');var BPromise=require(_0x6bb1('0x2'));var rp=require(_0x6bb1('0x3'));var fs=require('fs');var path=require(_0x6bb1('0x4'));var rimraf=require(_0x6bb1('0x5'));var config=require(_0x6bb1('0x6'));var attributes=require(_0x6bb1('0x7'));module[_0x6bb1('0x8')]=function(_0x37fd56,_0x5e0a0b){return _0x37fd56[_0x6bb1('0x9')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','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 15d764a..2e15a16 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 _0x1de5=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x28fc5b,_0x50a44c){var _0x1894c6=function(_0x273ab3){while(--_0x273ab3){_0x28fc5b['push'](_0x28fc5b['shift']());}};_0x1894c6(++_0x50a44c);}(_0x1de5,0x118));var _0x51de=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x1de5[_0x5a95fa];return _0x1a61b8;};'use strict';var _=require(_0x51de('0x0'));var util=require(_0x51de('0x1'));var moment=require(_0x51de('0x2'));var BPromise=require(_0x51de('0x3'));var rs=require(_0x51de('0x4'));var fs=require('fs');var Redis=require(_0x51de('0x5'));var db=require(_0x51de('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x51de('0x7'))(_0x51de('0x8'));var config=require(_0x51de('0x9'));var jayson=require(_0x51de('0xa'));var client=jayson[_0x51de('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ac86d,_0x1b65a7,_0x212ff2){return new BPromise(function(_0x5cab41,_0x81745e){return client[_0x51de('0xc')](_0x2ac86d,_0x212ff2)[_0x51de('0xd')](function(_0x3b8923){logger[_0x51de('0xe')](_0x51de('0xf'),_0x1b65a7,_0x51de('0x10'));logger[_0x51de('0x11')](_0x51de('0x12'),_0x1b65a7,_0x51de('0x10'),JSON[_0x51de('0x13')](_0x3b8923));if(_0x3b8923[_0x51de('0x14')]){if(_0x3b8923[_0x51de('0x14')][_0x51de('0x15')]===0x1f4){logger[_0x51de('0x14')](_0x51de('0xf'),_0x1b65a7,_0x3b8923[_0x51de('0x14')][_0x51de('0x16')]);return _0x81745e(_0x3b8923['error'][_0x51de('0x16')]);}logger[_0x51de('0x14')](_0x51de('0xf'),_0x1b65a7,_0x3b8923['error']['message']);return _0x5cab41(_0x3b8923[_0x51de('0x14')][_0x51de('0x16')]);}else{logger[_0x51de('0xe')](_0x51de('0xf'),_0x1b65a7,_0x51de('0x10'));_0x5cab41(_0x3b8923[_0x51de('0x17')]['message']);}})[_0x51de('0x18')](function(_0x5b6fb5){logger[_0x51de('0x14')](_0x51de('0xf'),_0x1b65a7,_0x5b6fb5);_0x81745e(_0x5b6fb5);});});} \ No newline at end of file +var _0xc1c3=['client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x4830dc,_0x1e4c3c){var _0x2b53f9=function(_0x37f1fc){while(--_0x37f1fc){_0x4830dc['push'](_0x4830dc['shift']());}};_0x2b53f9(++_0x1e4c3c);}(_0xc1c3,0xc7));var _0x3c1c=function(_0x287a40,_0x3b343a){_0x287a40=_0x287a40-0x0;var _0x18896a=_0xc1c3[_0x287a40];return _0x18896a;};'use strict';var _=require('lodash');var util=require(_0x3c1c('0x0'));var moment=require(_0x3c1c('0x1'));var BPromise=require(_0x3c1c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c1c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3c1c('0x4'));var logger=require(_0x3c1c('0x5'))(_0x3c1c('0x6'));var config=require('../../config/environment');var jayson=require(_0x3c1c('0x7'));var client=jayson[_0x3c1c('0x8')][_0x3c1c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x146bd0,_0xe69923,_0x49898c){return new BPromise(function(_0x17dbe1,_0x4f411c){return client[_0x3c1c('0xa')](_0x146bd0,_0x49898c)[_0x3c1c('0xb')](function(_0x355e2c){logger[_0x3c1c('0xc')](_0x3c1c('0xd'),_0xe69923,_0x3c1c('0xe'));logger[_0x3c1c('0xf')](_0x3c1c('0x10'),_0xe69923,_0x3c1c('0xe'),JSON[_0x3c1c('0x11')](_0x355e2c));if(_0x355e2c[_0x3c1c('0x12')]){if(_0x355e2c['error'][_0x3c1c('0x13')]===0x1f4){logger['error'](_0x3c1c('0xd'),_0xe69923,_0x355e2c[_0x3c1c('0x12')][_0x3c1c('0x14')]);return _0x4f411c(_0x355e2c[_0x3c1c('0x12')][_0x3c1c('0x14')]);}logger[_0x3c1c('0x12')](_0x3c1c('0xd'),_0xe69923,_0x355e2c[_0x3c1c('0x12')][_0x3c1c('0x14')]);return _0x17dbe1(_0x355e2c[_0x3c1c('0x12')]['message']);}else{logger['info'](_0x3c1c('0xd'),_0xe69923,_0x3c1c('0xe'));_0x17dbe1(_0x355e2c[_0x3c1c('0x15')][_0x3c1c('0x14')]);}})[_0x3c1c('0x16')](function(_0x2102d9){logger[_0x3c1c('0x12')](_0x3c1c('0xd'),_0xe69923,_0x2102d9);_0x4f411c(_0x2102d9);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 05a65c3..cb1a08e 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 _0x447b=['update','util','path','express','Router','../../components/interaction/service','./license.controller','get','index','put','/:id','isAuthenticated'];(function(_0x4c9f70,_0x53990b){var _0x3b1dd9=function(_0x1548fa){while(--_0x1548fa){_0x4c9f70['push'](_0x4c9f70['shift']());}};_0x3b1dd9(++_0x53990b);}(_0x447b,0x1ed));var _0xb447=function(_0x54203e,_0x1db8db){_0x54203e=_0x54203e-0x0;var _0xe307cf=_0x447b[_0x54203e];return _0xe307cf;};'use strict';var multer=require('multer');var util=require(_0xb447('0x0'));var path=require(_0xb447('0x1'));var timeout=require('connect-timeout');var express=require(_0xb447('0x2'));var router=express[_0xb447('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb447('0x4'));var config=require('../../config/environment');var controller=require(_0xb447('0x5'));router[_0xb447('0x6')]('/',controller[_0xb447('0x7')]);router[_0xb447('0x8')](_0xb447('0x9'),auth[_0xb447('0xa')](),controller[_0xb447('0xb')]);module['exports']=router; \ No newline at end of file +var _0xd065=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','put','/:id','isAuthenticated','update','exports','multer'];(function(_0x4f7576,_0x138a8f){var _0x45d522=function(_0x1662ee){while(--_0x1662ee){_0x4f7576['push'](_0x4f7576['shift']());}};_0x45d522(++_0x138a8f);}(_0xd065,0x144));var _0x5d06=function(_0x498362,_0x4246fb){_0x498362=_0x498362-0x0;var _0x501559=_0xd065[_0x498362];return _0x501559;};'use strict';var multer=require(_0x5d06('0x0'));var util=require('util');var path=require(_0x5d06('0x1'));var timeout=require('connect-timeout');var express=require(_0x5d06('0x2'));var router=express[_0x5d06('0x3')]();var auth=require(_0x5d06('0x4'));var interaction=require(_0x5d06('0x5'));var config=require(_0x5d06('0x6'));var controller=require('./license.controller');router[_0x5d06('0x7')]('/',controller['index']);router[_0x5d06('0x8')](_0x5d06('0x9'),auth[_0x5d06('0xa')](),controller[_0x5d06('0xb')]);module[_0x5d06('0xc')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 51e4c96..a276b78 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 _0xda19=['exports','TEXT','STRING'];(function(_0x2c12ce,_0x36de19){var _0x5ca224=function(_0x3efdef){while(--_0x3efdef){_0x2c12ce['push'](_0x2c12ce['shift']());}};_0x5ca224(++_0x36de19);}(_0xda19,0xd5));var _0x9da1=function(_0x2fdf3d,_0x202758){_0x2fdf3d=_0x2fdf3d-0x0;var _0x3ef512=_0xda19[_0x2fdf3d];return _0x3ef512;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'license':{'type':Sequelize[_0x9da1('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x9da1('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','INTEGER'];(function(_0x520cb1,_0x7d0742){var _0x7a3bae=function(_0x116353){while(--_0x116353){_0x520cb1['push'](_0x520cb1['shift']());}};_0x7a3bae(++_0x7d0742);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3da612,_0x332456){_0x3da612=_0x3da612-0x0;var _0x1a9d1d=_0x5fc3[_0x3da612];return _0x1a9d1d;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x35fc('0x2')]},'data2':{'type':Sequelize[_0x35fc('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x35fc('0x3')],'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 c2fcb75..b74a835 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 _0xa2a4=['then','destroy','stack','name','send','index','model','keys','rawAttributes','query','filters','attributes','intersection','fields','length','merge','catch','body','find','params','get','checkLicense','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','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','set','Content-Range','apply','reject','save','update'];(function(_0xfe8ded,_0x420173){var _0x60cef4=function(_0x55b0fb){while(--_0x55b0fb){_0xfe8ded['push'](_0xfe8ded['shift']());}};_0x60cef4(++_0x420173);}(_0xa2a4,0x1ac));var _0x4a2a=function(_0x2eaff7,_0x5c3296){_0x2eaff7=_0x2eaff7-0x0;var _0x32dbf8=_0xa2a4[_0x2eaff7];return _0x32dbf8;};'use strict';var pdf=require(_0x4a2a('0x0'));var emlformat=require(_0x4a2a('0x1'));var rimraf=require(_0x4a2a('0x2'));var zipdir=require(_0x4a2a('0x3'));var jsonpatch=require(_0x4a2a('0x4'));var rp=require(_0x4a2a('0x5'));var moment=require(_0x4a2a('0x6'));var BPromise=require(_0x4a2a('0x7'));var Mustache=require('mustache');var util=require(_0x4a2a('0x8'));var path=require('path');var sox=require(_0x4a2a('0x9'));var csv=require(_0x4a2a('0xa'));var ejs=require(_0x4a2a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4a2a('0xc'));var crypto=require(_0x4a2a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4a2a('0xe'));var toCsv=require(_0x4a2a('0xa'));var querystring=require('querystring');var Papa=require(_0x4a2a('0xf'));var Redis=require(_0x4a2a('0x10'));var authService=require(_0x4a2a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4a2a('0x12'));var hardwareService=require(_0x4a2a('0x13'));var logger=require(_0x4a2a('0x14'))('api');var utils=require(_0x4a2a('0x15'));var config=require(_0x4a2a('0x16'));var db=require(_0x4a2a('0x17'))['db'];function respondWithStatusCode(_0x275965,_0x108358){_0x108358=_0x108358||0xcc;return function(_0xc7cfd){if(_0xc7cfd){return _0x275965[_0x4a2a('0x18')](_0x108358);}return _0x275965[_0x4a2a('0x19')](_0x108358)['end']();};}function respondWithResult(_0x4efdf,_0x236c79){_0x236c79=_0x236c79||0xc8;return function(_0x341cf1){if(_0x341cf1){return _0x4efdf[_0x4a2a('0x19')](_0x236c79)[_0x4a2a('0x1a')](_0x341cf1);}};}function respondWithFilteredResult(_0x46f3e8,_0xfe05f){return function(_0x5244cc){if(_0x5244cc){var _0x1264b6=_0x5244cc[_0x4a2a('0x1b')],_0x482e11=_0xfe05f[_0x4a2a('0x1c')],_0x35079d=_0xfe05f[_0x4a2a('0x1c')]+_0xfe05f[_0x4a2a('0x1d')],_0x16c0c8;if(_0x35079d>=_0x1264b6){_0x35079d=_0x1264b6;_0x16c0c8=0xc8;}else{_0x16c0c8=0xce;}_0x46f3e8[_0x4a2a('0x19')](_0x16c0c8);return _0x46f3e8[_0x4a2a('0x1e')](_0x4a2a('0x1f'),_0x482e11+'-'+_0x35079d+'/'+_0x1264b6)[_0x4a2a('0x1a')](_0x5244cc);}return null;};}function patchUpdates(_0x44033f){return function(_0x48a84e){try{jsonpatch[_0x4a2a('0x20')](_0x48a84e,_0x44033f,!![]);}catch(_0x169042){return BPromise[_0x4a2a('0x21')](_0x169042);}return _0x48a84e[_0x4a2a('0x22')]();};}function saveUpdates(_0x33299d,_0x118590){return function(_0x56c0e2){if(_0x56c0e2){return _0x56c0e2[_0x4a2a('0x23')](_0x33299d)[_0x4a2a('0x24')](function(_0x2e83c0){return _0x2e83c0;});}return null;};}function removeEntity(_0x1e6d18,_0x3ee8d6){return function(_0x2ce13e){if(_0x2ce13e){return _0x2ce13e[_0x4a2a('0x25')]()[_0x4a2a('0x24')](function(){_0x1e6d18['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19e601,_0x4058e3){return function(_0x290090){if(!_0x290090){_0x19e601[_0x4a2a('0x18')](0x194);}return _0x290090;};}function handleError(_0x448982,_0x5ad3e8){_0x5ad3e8=_0x5ad3e8||0x1f4;return function(_0xb9a7a7){logger['error'](_0xb9a7a7[_0x4a2a('0x26')]);if(_0xb9a7a7[_0x4a2a('0x27')]){delete _0xb9a7a7[_0x4a2a('0x27')];}_0x448982[_0x4a2a('0x19')](_0x5ad3e8)[_0x4a2a('0x28')](_0xb9a7a7);};}var utilLicense=require('../../config/license/util');exports[_0x4a2a('0x29')]=function(_0x584528,_0x4a3d79){var _0x2eb009={'raw':!![],'where':{'id':0x1}},_0x29b14d={};_0x29b14d[_0x4a2a('0x2a')]=_[_0x4a2a('0x2b')](db['License'][_0x4a2a('0x2c')]);_0x29b14d['query']=_[_0x4a2a('0x2b')](_0x584528[_0x4a2a('0x2d')]);_0x29b14d[_0x4a2a('0x2e')]=_['intersection'](_0x29b14d['model'],_0x29b14d[_0x4a2a('0x2d')]);_0x2eb009[_0x4a2a('0x2f')]=_[_0x4a2a('0x30')](_0x29b14d[_0x4a2a('0x2a')],qs[_0x4a2a('0x31')](_0x584528[_0x4a2a('0x2d')]['fields']));_0x2eb009['attributes']=_0x2eb009[_0x4a2a('0x2f')][_0x4a2a('0x32')]?_0x2eb009[_0x4a2a('0x2f')]:_0x29b14d[_0x4a2a('0x2a')];_0x2eb009=_[_0x4a2a('0x33')]({},_0x2eb009,_0x584528['options']);return utilLicense['getLicense'](_0x2eb009)[_0x4a2a('0x24')](respondWithResult(_0x4a3d79,null))[_0x4a2a('0x34')](handleError(_0x4a3d79,null));};exports[_0x4a2a('0x23')]=function(_0x2878a9,_0x375a95){if(_0x2878a9[_0x4a2a('0x35')]['id']){delete _0x2878a9[_0x4a2a('0x35')]['id'];}return db['License'][_0x4a2a('0x36')]({'where':{'id':_0x2878a9[_0x4a2a('0x37')]['id']}})[_0x4a2a('0x24')](handleEntityNotFound(_0x375a95,null))['then'](function(_0x1958c9){var _0x26e73b=_0x1958c9[_0x4a2a('0x38')]({'plain':!![]});return utilLicense[_0x4a2a('0x39')](_0x26e73b,_0x2878a9['body']['key']);})['then'](function(_0x264c42){if(!_0x264c42['demo']){return saveUpdates(_0x2878a9[_0x4a2a('0x35')],null);}return _0x264c42;})['then'](respondWithResult(_0x375a95,null))[_0x4a2a('0x34')](handleError(_0x375a95,null));}; \ No newline at end of file +var _0x742c=['../../config/logger','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','set','Content-Range','apply','reject','save','then','destroy','error','name','send','../../config/license/util','index','model','License','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','options','getLicense','body','find','params','checkLicense','demo','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4643ca,_0x3923af){var _0x103e95=function(_0x133871){while(--_0x133871){_0x4643ca['push'](_0x4643ca['shift']());}};_0x103e95(++_0x3923af);}(_0x742c,0x98));var _0xc742=function(_0x580b15,_0x28afa4){_0x580b15=_0x580b15-0x0;var _0x1adb1b=_0x742c[_0x580b15];return _0x1adb1b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc742('0x0'));var rimraf=require(_0xc742('0x1'));var zipdir=require(_0xc742('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc742('0x3'));var moment=require(_0xc742('0x4'));var BPromise=require(_0xc742('0x5'));var Mustache=require(_0xc742('0x6'));var util=require(_0xc742('0x7'));var path=require(_0xc742('0x8'));var sox=require(_0xc742('0x9'));var csv=require(_0xc742('0xa'));var ejs=require(_0xc742('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc742('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc742('0xd'));var toCsv=require(_0xc742('0xa'));var querystring=require(_0xc742('0xe'));var Papa=require(_0xc742('0xf'));var Redis=require('ioredis');var authService=require(_0xc742('0x10'));var qs=require(_0xc742('0x11'));var as=require(_0xc742('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc742('0x13'))('api');var utils=require(_0xc742('0x14'));var config=require('../../config/environment');var db=require(_0xc742('0x15'))['db'];function respondWithStatusCode(_0x6b487,_0x20a48c){_0x20a48c=_0x20a48c||0xcc;return function(_0x26308f){if(_0x26308f){return _0x6b487[_0xc742('0x16')](_0x20a48c);}return _0x6b487['status'](_0x20a48c)[_0xc742('0x17')]();};}function respondWithResult(_0x4b71e4,_0x4da84b){_0x4da84b=_0x4da84b||0xc8;return function(_0x549168){if(_0x549168){return _0x4b71e4[_0xc742('0x18')](_0x4da84b)[_0xc742('0x19')](_0x549168);}};}function respondWithFilteredResult(_0x1bc349,_0x3672d1){return function(_0x4048a4){if(_0x4048a4){var _0x2b2c8b=_0x4048a4['count'],_0x382211=_0x3672d1['offset'],_0x12e119=_0x3672d1[_0xc742('0x1a')]+_0x3672d1['limit'],_0x306d04;if(_0x12e119>=_0x2b2c8b){_0x12e119=_0x2b2c8b;_0x306d04=0xc8;}else{_0x306d04=0xce;}_0x1bc349[_0xc742('0x18')](_0x306d04);return _0x1bc349[_0xc742('0x1b')](_0xc742('0x1c'),_0x382211+'-'+_0x12e119+'/'+_0x2b2c8b)[_0xc742('0x19')](_0x4048a4);}return null;};}function patchUpdates(_0x45f9e3){return function(_0xb22063){try{jsonpatch[_0xc742('0x1d')](_0xb22063,_0x45f9e3,!![]);}catch(_0x1dc8cb){return BPromise[_0xc742('0x1e')](_0x1dc8cb);}return _0xb22063[_0xc742('0x1f')]();};}function saveUpdates(_0x192bdf,_0x4448d2){return function(_0x616813){if(_0x616813){return _0x616813['update'](_0x192bdf)[_0xc742('0x20')](function(_0x57311d){return _0x57311d;});}return null;};}function removeEntity(_0x2d1f55,_0x4da55a){return function(_0x294735){if(_0x294735){return _0x294735[_0xc742('0x21')]()['then'](function(){_0x2d1f55['status'](0xcc)[_0xc742('0x17')]();});}};}function handleEntityNotFound(_0x3cc6f0,_0x125bdf){return function(_0x338bf5){if(!_0x338bf5){_0x3cc6f0[_0xc742('0x16')](0x194);}return _0x338bf5;};}function handleError(_0x5bd08c,_0x1a0df1){_0x1a0df1=_0x1a0df1||0x1f4;return function(_0x384e98){logger[_0xc742('0x22')](_0x384e98['stack']);if(_0x384e98[_0xc742('0x23')]){delete _0x384e98[_0xc742('0x23')];}_0x5bd08c[_0xc742('0x18')](_0x1a0df1)[_0xc742('0x24')](_0x384e98);};}var utilLicense=require(_0xc742('0x25'));exports[_0xc742('0x26')]=function(_0x4621f0,_0x2b403f){var _0x3068c3={'raw':!![],'where':{'id':0x1}},_0x346789={};_0x346789[_0xc742('0x27')]=_['keys'](db[_0xc742('0x28')][_0xc742('0x29')]);_0x346789[_0xc742('0x2a')]=_[_0xc742('0x2b')](_0x4621f0['query']);_0x346789[_0xc742('0x2c')]=_[_0xc742('0x2d')](_0x346789['model'],_0x346789['query']);_0x3068c3[_0xc742('0x2e')]=_['intersection'](_0x346789[_0xc742('0x27')],qs[_0xc742('0x2f')](_0x4621f0[_0xc742('0x2a')]['fields']));_0x3068c3['attributes']=_0x3068c3[_0xc742('0x2e')][_0xc742('0x30')]?_0x3068c3[_0xc742('0x2e')]:_0x346789[_0xc742('0x27')];_0x3068c3=_[_0xc742('0x31')]({},_0x3068c3,_0x4621f0[_0xc742('0x32')]);return utilLicense[_0xc742('0x33')](_0x3068c3)[_0xc742('0x20')](respondWithResult(_0x2b403f,null))['catch'](handleError(_0x2b403f,null));};exports['update']=function(_0x437b2f,_0xfe4d30){if(_0x437b2f[_0xc742('0x34')]['id']){delete _0x437b2f['body']['id'];}return db['License'][_0xc742('0x35')]({'where':{'id':_0x437b2f[_0xc742('0x36')]['id']}})['then'](handleEntityNotFound(_0xfe4d30,null))[_0xc742('0x20')](function(_0x337f98){var _0x1e8edd=_0x337f98['get']({'plain':!![]});return utilLicense[_0xc742('0x37')](_0x1e8edd,_0x437b2f[_0xc742('0x34')]['key']);})[_0xc742('0x20')](function(_0x29ba55){if(!_0x29ba55[_0xc742('0x38')]){return saveUpdates(_0x437b2f[_0xc742('0x34')],null);}return _0x29ba55;})[_0xc742('0x20')](respondWithResult(_0xfe4d30,null))['catch'](handleError(_0xfe4d30,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 495289c..87a9eec 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 _0xba85=['define','License','license','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./license.attributes','exports'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0xba85,0x78));var _0x5ba8=function(_0x387098,_0x2224d0){_0x387098=_0x387098-0x0;var _0x2740dc=_0xba85[_0x387098];return _0x2740dc;};'use strict';var _=require(_0x5ba8('0x0'));var util=require(_0x5ba8('0x1'));var logger=require(_0x5ba8('0x2'))(_0x5ba8('0x3'));var moment=require('moment');var BPromise=require(_0x5ba8('0x4'));var rp=require(_0x5ba8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5ba8('0x6'));var config=require(_0x5ba8('0x7'));var attributes=require(_0x5ba8('0x8'));module[_0x5ba8('0x9')]=function(_0x4ace2d,_0x2fa1dd){return _0x4ace2d[_0x5ba8('0xa')](_0x5ba8('0xb'),attributes,{'tableName':_0x5ba8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54a9=['rimraf','../../config/environment','./license.attributes','define','License','license','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x191b31,_0x45512c){var _0x154afd=function(_0x7361e7){while(--_0x7361e7){_0x191b31['push'](_0x191b31['shift']());}};_0x154afd(++_0x45512c);}(_0x54a9,0x186));var _0x954a=function(_0x11f9cb,_0x52b830){_0x11f9cb=_0x11f9cb-0x0;var _0xeacabc=_0x54a9[_0x11f9cb];return _0xeacabc;};'use strict';var _=require(_0x954a('0x0'));var util=require('util');var logger=require(_0x954a('0x1'))('api');var moment=require(_0x954a('0x2'));var BPromise=require(_0x954a('0x3'));var rp=require(_0x954a('0x4'));var fs=require('fs');var path=require(_0x954a('0x5'));var rimraf=require(_0x954a('0x6'));var config=require(_0x954a('0x7'));var attributes=require(_0x954a('0x8'));module['exports']=function(_0x2066b6,_0x5634fc){return _0x2066b6[_0x954a('0x9')](_0x954a('0xa'),attributes,{'tableName':_0x954a('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 338cbc0..4a80a18 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 _0xbfcc=['License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','request','info'];(function(_0x23ce9d,_0x53bf13){var _0x503cef=function(_0x15294d){while(--_0x15294d){_0x23ce9d['push'](_0x23ce9d['shift']());}};_0x503cef(++_0x53bf13);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x339129,_0x86dcc6){_0x339129=_0x339129-0x0;var _0x1570df=_0xbfcc[_0x339129];return _0x1570df;};'use strict';var _=require(_0xcbfc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcbfc('0x1'));var rs=require(_0xcbfc('0x2'));var fs=require('fs');var Redis=require(_0xcbfc('0x3'));var db=require(_0xcbfc('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xcbfc('0x5'));var client=jayson[_0xcbfc('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b3917,_0x5a2be0,_0x2ea130){return new BPromise(function(_0x1f8b71,_0x1b1377){return client[_0xcbfc('0x7')](_0x1b3917,_0x2ea130)['then'](function(_0x2e7097){logger[_0xcbfc('0x8')](_0xcbfc('0x9'),_0x5a2be0,_0xcbfc('0xa'));logger[_0xcbfc('0xb')](_0xcbfc('0xc'),_0x5a2be0,'request\x20sent',JSON[_0xcbfc('0xd')](_0x2e7097));if(_0x2e7097[_0xcbfc('0xe')]){if(_0x2e7097[_0xcbfc('0xe')][_0xcbfc('0xf')]===0x1f4){logger[_0xcbfc('0xe')]('License,\x20%s,\x20%s',_0x5a2be0,_0x2e7097[_0xcbfc('0xe')][_0xcbfc('0x10')]);return _0x1b1377(_0x2e7097[_0xcbfc('0xe')]['message']);}logger[_0xcbfc('0xe')](_0xcbfc('0x9'),_0x5a2be0,_0x2e7097[_0xcbfc('0xe')][_0xcbfc('0x10')]);return _0x1f8b71(_0x2e7097[_0xcbfc('0xe')]['message']);}else{logger[_0xcbfc('0x8')](_0xcbfc('0x9'),_0x5a2be0,_0xcbfc('0xa'));_0x1f8b71(_0x2e7097[_0xcbfc('0x11')]['message']);}})['catch'](function(_0x418f18){logger[_0xcbfc('0xe')](_0xcbfc('0x9'),_0x5a2be0,_0x418f18);_0x1b1377(_0x418f18);});});} \ No newline at end of file +var _0xc4dd=['stringify','error','message','request\x20sent','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s'];(function(_0x3ecd18,_0xd4be11){var _0x13f1ff=function(_0x3304b2){while(--_0x3304b2){_0x3ecd18['push'](_0x3ecd18['shift']());}};_0x13f1ff(++_0xd4be11);}(_0xc4dd,0xad));var _0xdc4d=function(_0x58d148,_0x2e0c1c){_0x58d148=_0x58d148-0x0;var _0x4885e1=_0xc4dd[_0x58d148];return _0x4885e1;};'use strict';var _=require(_0xdc4d('0x0'));var util=require(_0xdc4d('0x1'));var moment=require(_0xdc4d('0x2'));var BPromise=require('bluebird');var rs=require(_0xdc4d('0x3'));var fs=require('fs');var Redis=require(_0xdc4d('0x4'));var db=require(_0xdc4d('0x5'))['db'];var utils=require(_0xdc4d('0x6'));var logger=require(_0xdc4d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdc4d('0x8'));var client=jayson[_0xdc4d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c4ce7,_0x2a2a14,_0x566564){return new BPromise(function(_0x1c2e51,_0x1db67d){return client[_0xdc4d('0xa')](_0x3c4ce7,_0x566564)[_0xdc4d('0xb')](function(_0x1f3a6d){logger[_0xdc4d('0xc')](_0xdc4d('0xd'),_0x2a2a14,'request\x20sent');logger[_0xdc4d('0xe')](_0xdc4d('0xf'),_0x2a2a14,'request\x20sent',JSON[_0xdc4d('0x10')](_0x1f3a6d));if(_0x1f3a6d['error']){if(_0x1f3a6d[_0xdc4d('0x11')]['code']===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x2a2a14,_0x1f3a6d[_0xdc4d('0x11')][_0xdc4d('0x12')]);return _0x1db67d(_0x1f3a6d[_0xdc4d('0x11')]['message']);}logger[_0xdc4d('0x11')](_0xdc4d('0xd'),_0x2a2a14,_0x1f3a6d[_0xdc4d('0x11')]['message']);return _0x1c2e51(_0x1f3a6d[_0xdc4d('0x11')]['message']);}else{logger['info'](_0xdc4d('0xd'),_0x2a2a14,_0xdc4d('0x13'));_0x1c2e51(_0x1f3a6d[_0xdc4d('0x14')][_0xdc4d('0x12')]);}})['catch'](function(_0x7b1093){logger[_0xdc4d('0x11')](_0xdc4d('0xd'),_0x2a2a14,_0x7b1093);_0x1db67d(_0x7b1093);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 25e97c7..0aefd7e 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 _0xdea1=['post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','/:id/send','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','express','../../config/environment','get','isAuthenticated','describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/verify','verifySmtp','/:id/users','getAgents'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0xdea1,0x80));var _0x1dea=function(_0x2854bf,_0x39b7ca){_0x2854bf=_0x2854bf-0x0;var _0x73f50d=_0xdea1[_0x2854bf];return _0x73f50d;};'use strict';var multer=require(_0x1dea('0x0'));var util=require(_0x1dea('0x1'));var path=require(_0x1dea('0x2'));var timeout=require('connect-timeout');var express=require(_0x1dea('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1dea('0x4'));var controller=require('./mailAccount.controller');router[_0x1dea('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1dea('0x5')]('/describe',auth[_0x1dea('0x6')](),controller[_0x1dea('0x7')]);router[_0x1dea('0x5')](_0x1dea('0x8'),auth[_0x1dea('0x6')](),controller['show']);router[_0x1dea('0x5')](_0x1dea('0x9'),auth[_0x1dea('0x6')](),controller['getDispositions']);router['get'](_0x1dea('0xa'),auth[_0x1dea('0x6')](),controller[_0x1dea('0xb')]);router[_0x1dea('0x5')](_0x1dea('0xc'),auth[_0x1dea('0x6')](),controller[_0x1dea('0xd')]);router[_0x1dea('0x5')](_0x1dea('0xe'),auth[_0x1dea('0x6')](),controller[_0x1dea('0xf')]);router[_0x1dea('0x5')](_0x1dea('0x10'),auth[_0x1dea('0x6')](),controller[_0x1dea('0x11')]);router[_0x1dea('0x5')](_0x1dea('0x12'),auth[_0x1dea('0x6')](),controller[_0x1dea('0x13')]);router['get']('/:id/messages',auth[_0x1dea('0x6')](),controller['getMessages']);router[_0x1dea('0x5')](_0x1dea('0x14'),auth[_0x1dea('0x6')](),controller[_0x1dea('0x15')]);router['get'](_0x1dea('0x16'),auth[_0x1dea('0x6')](),controller[_0x1dea('0x17')]);router[_0x1dea('0x18')](_0x1dea('0x9'),auth[_0x1dea('0x6')](),controller[_0x1dea('0x19')]);router[_0x1dea('0x18')](_0x1dea('0xa'),auth[_0x1dea('0x6')](),controller[_0x1dea('0x1a')]);router[_0x1dea('0x18')]('/',auth['isAuthenticated'](),controller[_0x1dea('0x1b')]);router[_0x1dea('0x18')](_0x1dea('0xc'),auth[_0x1dea('0x6')](),controller[_0x1dea('0x1c')]);router[_0x1dea('0x18')](_0x1dea('0xe'),auth['isAuthenticated'](),controller[_0x1dea('0x1d')]);router[_0x1dea('0x18')](_0x1dea('0x10'),auth['isAuthenticated'](),controller[_0x1dea('0x1e')]);router['post'](_0x1dea('0x12'),auth[_0x1dea('0x6')](),controller['addApplications']);router['post'](_0x1dea('0x1f'),auth[_0x1dea('0x6')](),controller['send']);router[_0x1dea('0x18')](_0x1dea('0x16'),auth[_0x1dea('0x6')](),controller['addAgents']);router['put']('/:id',auth[_0x1dea('0x6')](),controller['update']);router['delete']('/:id/dispositions',auth[_0x1dea('0x6')](),controller['removeDispositions']);router['delete'](_0x1dea('0xa'),auth['isAuthenticated'](),controller[_0x1dea('0x20')]);router['delete'](_0x1dea('0xc'),auth[_0x1dea('0x6')](),controller[_0x1dea('0x21')]);router['delete'](_0x1dea('0xe'),auth[_0x1dea('0x6')](),controller[_0x1dea('0x22')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1dea('0x23')]);router['delete']('/:id/users',auth[_0x1dea('0x6')](),controller[_0x1dea('0x24')]);module[_0x1dea('0x25')]=router; \ No newline at end of file +var _0x7125=['getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addSmtp','addInteraction','/:id/applications','addApplications','send','put','update','delete','removeDispositions','removeImap','destroy','removeAgents','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','index','/describe','isAuthenticated','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7125,0xbe));var _0x5712=function(_0xa88d2c,_0x38bca){_0xa88d2c=_0xa88d2c-0x0;var _0x2e9f15=_0x7125[_0xa88d2c];return _0x2e9f15;};'use strict';var multer=require(_0x5712('0x0'));var util=require(_0x5712('0x1'));var path=require('path');var timeout=require(_0x5712('0x2'));var express=require(_0x5712('0x3'));var router=express['Router']();var auth=require(_0x5712('0x4'));var interaction=require(_0x5712('0x5'));var config=require('../../config/environment');var controller=require(_0x5712('0x6'));router[_0x5712('0x7')]('/',auth['isAuthenticated'](),controller[_0x5712('0x8')]);router[_0x5712('0x7')](_0x5712('0x9'),auth[_0x5712('0xa')](),controller['describe']);router[_0x5712('0x7')](_0x5712('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x5712('0x7')](_0x5712('0xc'),auth[_0x5712('0xa')](),controller[_0x5712('0xd')]);router[_0x5712('0x7')]('/:id/canned_answers',auth[_0x5712('0xa')](),controller[_0x5712('0xe')]);router[_0x5712('0x7')](_0x5712('0xf'),auth['isAuthenticated'](),controller['getImap']);router[_0x5712('0x7')](_0x5712('0x10'),auth['isAuthenticated'](),controller[_0x5712('0x11')]);router['get'](_0x5712('0x12'),auth['isAuthenticated'](),controller[_0x5712('0x13')]);router[_0x5712('0x7')]('/:id/applications',auth[_0x5712('0xa')](),controller[_0x5712('0x14')]);router[_0x5712('0x7')](_0x5712('0x15'),auth[_0x5712('0xa')](),controller['getMessages']);router[_0x5712('0x7')](_0x5712('0x16'),auth['isAuthenticated'](),controller[_0x5712('0x17')]);router['get'](_0x5712('0x18'),auth[_0x5712('0xa')](),controller[_0x5712('0x19')]);router[_0x5712('0x1a')](_0x5712('0xc'),auth[_0x5712('0xa')](),controller[_0x5712('0x1b')]);router['post'](_0x5712('0x1c'),auth[_0x5712('0xa')](),controller[_0x5712('0x1d')]);router[_0x5712('0x1a')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5712('0x1a')]('/:id/in_servers',auth['isAuthenticated'](),controller['addImap']);router[_0x5712('0x1a')](_0x5712('0x10'),auth[_0x5712('0xa')](),controller[_0x5712('0x1e')]);router[_0x5712('0x1a')](_0x5712('0x12'),auth[_0x5712('0xa')](),controller[_0x5712('0x1f')]);router[_0x5712('0x1a')](_0x5712('0x20'),auth[_0x5712('0xa')](),controller[_0x5712('0x21')]);router[_0x5712('0x1a')]('/:id/send',auth['isAuthenticated'](),controller[_0x5712('0x22')]);router['post'](_0x5712('0x18'),auth[_0x5712('0xa')](),controller['addAgents']);router[_0x5712('0x23')]('/:id',auth[_0x5712('0xa')](),controller[_0x5712('0x24')]);router[_0x5712('0x25')](_0x5712('0xc'),auth[_0x5712('0xa')](),controller[_0x5712('0x26')]);router[_0x5712('0x25')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0x5712('0xf'),auth[_0x5712('0xa')](),controller[_0x5712('0x27')]);router[_0x5712('0x25')](_0x5712('0x10'),auth[_0x5712('0xa')](),controller['removeSmtp']);router[_0x5712('0x25')](_0x5712('0xb'),auth['isAuthenticated'](),controller[_0x5712('0x28')]);router[_0x5712('0x25')](_0x5712('0x18'),auth['isAuthenticated'](),controller[_0x5712('0x29')]);module[_0x5712('0x2a')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index bb73223..afec030 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 _0x96eb=['STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','exports'];(function(_0x1259ad,_0x3e44c6){var _0x9d61fb=function(_0x1e65c7){while(--_0x1e65c7){_0x1259ad['push'](_0x1259ad['shift']());}};_0x9d61fb(++_0x3e44c6);}(_0x96eb,0x187));var _0xb96e=function(_0x4cd65a,_0x1bfc38){_0x4cd65a=_0x4cd65a-0x0;var _0x5429a3=_0x96eb[_0x4cd65a];return _0x5429a3;};'use strict';var Sequelize=require('sequelize');module[_0xb96e('0x0')]={'description':{'type':Sequelize[_0xb96e('0x1')]},'name':{'type':Sequelize[_0xb96e('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xb96e('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xb96e('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xb96e('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xb96e('0x3')]},'markAsUnread':{'type':Sequelize[_0xb96e('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb96e('0x4')},'fontSize':{'type':Sequelize[_0xb96e('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xb96e('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xb96e('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb96e('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb96e('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb96e('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb96e('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb96e('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xb96e('0x2')],'defaultValue':![],'comment':_0xb96e('0x6'),'set':function(_0x136e3e){if(!_0x136e3e)this[_0xb96e('0x7')]('mandatoryDispositionPauseId',null);this[_0xb96e('0x7')]('mandatoryDisposition',_0x136e3e);}}}; \ No newline at end of file +var _0x7a32=['UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','INTEGER'];(function(_0x22fc9e,_0x296376){var _0x5efcf9=function(_0x3433b3){while(--_0x3433b3){_0x22fc9e['push'](_0x22fc9e['shift']());}};_0x5efcf9(++_0x296376);}(_0x7a32,0x165));var _0x27a3=function(_0x45dc3e,_0x4e8bc5){_0x45dc3e=_0x45dc3e-0x0;var _0xdc2c4a=_0x7a32[_0x45dc3e];return _0xdc2c4a;};'use strict';var Sequelize=require(_0x27a3('0x0'));module[_0x27a3('0x1')]={'description':{'type':Sequelize[_0x27a3('0x2')]},'name':{'type':Sequelize[_0x27a3('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x27a3('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x27a3('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x27a3('0x4')]},'markAsUnread':{'type':Sequelize[_0x27a3('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x27a3('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x27a3('0x5')](0x2)[_0x27a3('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x27a3('0x4')],'defaultValue':function(){return _0x27a3('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x27a3('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x27a3('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x27a3('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x27a3('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x27a3('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x27a3('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x27a3('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x27a3('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x27a3('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4f4eda){if(!_0x4f4eda)this['setDataValue'](_0x27a3('0x9'),null);this['setDataValue'](_0x27a3('0xa'),_0x4f4eda);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 67ad05d..b79883b 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 _0xb5e7=['Disposition','getDispositions','findOne','order','rows','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','create','email','ListId','isNil','active','description','cservice','user','password','pass','cpassword','authentication','host','port','service','cuser','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Owner','fullname','Tag','Tags','color','tag','addApplications','transaction','MailApplication','findAndCountAll','priority','getApplications','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','from','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','format','Interaction','Messages','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','removeAgents','isArray','emit','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./mailAccount.socket','register','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','sendStatus','status','count','offset','limit','Content-Range','json','apply','save','update','destroy','get','MailAccounts','UserProfileResource','end','stack','name','send','MailServerIn','Imap','MailServerOut','Smtp','mandatoryDispositionPause','map','MailAccount','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','params','rawAttributes','filters','options','body','find','describe','addDisposition','MailAccountId'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb5e7,0x114));var _0x7b5e=function(_0x3efda4,_0x536b19){_0x3efda4=_0x3efda4-0x0;var _0x310da4=_0xb5e7[_0x3efda4];return _0x310da4;};'use strict';var pdf=require(_0x7b5e('0x0'));var emlformat=require(_0x7b5e('0x1'));var rimraf=require(_0x7b5e('0x2'));var zipdir=require(_0x7b5e('0x3'));var jsonpatch=require(_0x7b5e('0x4'));var rp=require(_0x7b5e('0x5'));var moment=require(_0x7b5e('0x6'));var BPromise=require(_0x7b5e('0x7'));var Mustache=require(_0x7b5e('0x8'));var util=require('util');var path=require(_0x7b5e('0x9'));var sox=require(_0x7b5e('0xa'));var csv=require(_0x7b5e('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7b5e('0xc'));var squel=require(_0x7b5e('0xd'));var crypto=require('crypto');var jsforce=require(_0x7b5e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7b5e('0xb'));var querystring=require(_0x7b5e('0xf'));var Papa=require(_0x7b5e('0x10'));var Redis=require(_0x7b5e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7b5e('0x12'));var hardwareService=require(_0x7b5e('0x13'));var logger=require(_0x7b5e('0x14'))(_0x7b5e('0x15'));var utils=require('../../config/utils');var config=require(_0x7b5e('0x16'));var db=require('../../mysqldb')['db'];config[_0x7b5e('0x17')]=_[_0x7b5e('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7b5e('0x19'))(new Redis(config[_0x7b5e('0x17')]));require(_0x7b5e('0x1a'))[_0x7b5e('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7b5e('0x1c')]['http']({'port':0x232b});function checkPasswordPattern(_0x40e0e8,_0x29d189,_0x493ac4){if(_0x493ac4){var _0x123049=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x123049[_0x7b5e('0x1d')](_0x29d189)){return _0x40e0e8;}else{throw new db[(_0x7b5e('0x1e'))][(_0x7b5e('0x1f'))](_0x7b5e('0x20'));}}else{return _0x40e0e8;}}function respondWithRpcPromise(_0x2a207a,_0x1f5112,_0x5d5dfb,_0x1e3521){return new BPromise(function(_0x18999c,_0xb080c){var _0x4726fb=_0x1e3521||client;return _0x4726fb[_0x7b5e('0x21')](_0x2a207a,_0x5d5dfb)[_0x7b5e('0x22')](function(_0x26ed99){logger['info'](_0x7b5e('0x23'),_0x1f5112,_0x7b5e('0x24'));logger[_0x7b5e('0x25')](_0x7b5e('0x26'),_0x1f5112,_0x7b5e('0x24'),JSON['stringify'](_0x26ed99));if(_0x26ed99[_0x7b5e('0x27')]){if(_0x26ed99[_0x7b5e('0x27')][_0x7b5e('0x28')]===0x1f4){logger[_0x7b5e('0x27')]('MailAccount,\x20%s,\x20%s',_0x1f5112,_0x26ed99[_0x7b5e('0x27')]['message']);return _0xb080c(_0x26ed99[_0x7b5e('0x27')][_0x7b5e('0x29')]);}logger[_0x7b5e('0x27')](_0x7b5e('0x23'),_0x1f5112,_0x26ed99[_0x7b5e('0x27')]['message']);return _0x18999c(_0x26ed99[_0x7b5e('0x27')]['message']);}else{logger[_0x7b5e('0x2a')](_0x7b5e('0x23'),_0x1f5112,_0x7b5e('0x24'));_0x18999c(_0x26ed99['result'][_0x7b5e('0x29')]);}})[_0x7b5e('0x2b')](function(_0x553bd9){logger[_0x7b5e('0x27')](_0x7b5e('0x23'),_0x1f5112,_0x553bd9);_0xb080c(_0x553bd9);});});}function respondWithStatusCode(_0x59389c,_0x2e37bb){_0x2e37bb=_0x2e37bb||0xcc;return function(_0x4e0951){if(_0x4e0951){return _0x59389c[_0x7b5e('0x2c')](_0x2e37bb);}return _0x59389c[_0x7b5e('0x2d')](_0x2e37bb)['end']();};}function respondWithResult(_0x2947a1,_0x2e6fa9){_0x2e6fa9=_0x2e6fa9||0xc8;return function(_0x55339b){if(_0x55339b){return _0x2947a1['status'](_0x2e6fa9)['json'](_0x55339b);}};}function respondWithFilteredResult(_0x57b296,_0x211691){return function(_0x5765ab){if(_0x5765ab){var _0x572611=_0x5765ab[_0x7b5e('0x2e')],_0x40c03d=_0x211691[_0x7b5e('0x2f')],_0x224157=_0x211691[_0x7b5e('0x2f')]+_0x211691[_0x7b5e('0x30')],_0x4164e8;if(_0x224157>=_0x572611){_0x224157=_0x572611;_0x4164e8=0xc8;}else{_0x4164e8=0xce;}_0x57b296['status'](_0x4164e8);return _0x57b296['set'](_0x7b5e('0x31'),_0x40c03d+'-'+_0x224157+'/'+_0x572611)[_0x7b5e('0x32')](_0x5765ab);}return null;};}function patchUpdates(_0x34f223){return function(_0x86ec16){try{jsonpatch[_0x7b5e('0x33')](_0x86ec16,_0x34f223,!![]);}catch(_0x55f75f){return BPromise['reject'](_0x55f75f);}return _0x86ec16[_0x7b5e('0x34')]();};}function saveUpdates(_0x2bcb20,_0x3b4997){return function(_0x4abd52){if(_0x4abd52){return _0x4abd52[_0x7b5e('0x35')](_0x2bcb20)[_0x7b5e('0x22')](function(_0x4bacf6){return _0x4bacf6;});}return null;};}function removeEntity(_0x56b397,_0x1e91bd){return function(_0x360a79){if(_0x360a79){return _0x360a79[_0x7b5e('0x36')]()[_0x7b5e('0x22')](function(){var _0x3a9a20=_0x360a79[_0x7b5e('0x37')]({'plain':!![]});var _0x1e48d1=_0x7b5e('0x38');return db[_0x7b5e('0x39')][_0x7b5e('0x36')]({'where':{'type':_0x1e48d1,'resourceId':_0x3a9a20['id']}})[_0x7b5e('0x22')](function(){return _0x360a79;});})[_0x7b5e('0x22')](function(){_0x56b397['status'](0xcc)[_0x7b5e('0x3a')]();});}};}function handleEntityNotFound(_0x1bc903,_0x56ac73){return function(_0x33bfc9){if(!_0x33bfc9){_0x1bc903[_0x7b5e('0x2c')](0x194);}return _0x33bfc9;};}function handleError(_0x3fcd2a,_0x337cfb){_0x337cfb=_0x337cfb||0x1f4;return function(_0x3e25ef){logger[_0x7b5e('0x27')](_0x3e25ef[_0x7b5e('0x3b')]);if(_0x3e25ef[_0x7b5e('0x3c')]){delete _0x3e25ef[_0x7b5e('0x3c')];}_0x3fcd2a['status'](_0x337cfb)[_0x7b5e('0x3d')](_0x3e25ef);};}exports['index']=function(_0x4f9787,_0x2287c7){var _0x2e7b17={'include':[{'model':db[_0x7b5e('0x3e')],'as':_0x7b5e('0x3f')},{'model':db[_0x7b5e('0x40')],'as':_0x7b5e('0x41')},{'model':db['Pause'],'as':_0x7b5e('0x42')}]},_0x12e83d={},_0xf5f428={'count':0x0,'rows':[]};var _0x54e858=_[_0x7b5e('0x43')](db[_0x7b5e('0x44')]['rawAttributes'],function(_0x2add32){return{'name':_0x2add32[_0x7b5e('0x45')],'type':_0x2add32[_0x7b5e('0x46')]['key']};});_0x12e83d[_0x7b5e('0x47')]=_[_0x7b5e('0x43')](_0x54e858,_0x7b5e('0x3c'));_0x12e83d['query']=_[_0x7b5e('0x48')](_0x4f9787[_0x7b5e('0x49')]);_0x12e83d['filters']=_['intersection'](_0x12e83d[_0x7b5e('0x47')],_0x12e83d[_0x7b5e('0x49')]);_0x2e7b17['attributes']=_[_0x7b5e('0x4a')](_0x12e83d['model'],qs[_0x7b5e('0x4b')](_0x4f9787['query'][_0x7b5e('0x4b')]));_0x2e7b17[_0x7b5e('0x4c')]=_0x2e7b17['attributes'][_0x7b5e('0x4d')]?_0x2e7b17[_0x7b5e('0x4c')]:_0x12e83d[_0x7b5e('0x47')];if(!_0x4f9787[_0x7b5e('0x49')][_0x7b5e('0x4e')](_0x7b5e('0x4f'))){_0x2e7b17[_0x7b5e('0x30')]=qs[_0x7b5e('0x30')](_0x4f9787[_0x7b5e('0x49')][_0x7b5e('0x30')]);_0x2e7b17['offset']=qs[_0x7b5e('0x2f')](_0x4f9787[_0x7b5e('0x49')][_0x7b5e('0x2f')]);}_0x2e7b17['order']=qs['sort'](_0x4f9787[_0x7b5e('0x49')][_0x7b5e('0x50')]);_0x2e7b17[_0x7b5e('0x51')]=qs['filters'](_[_0x7b5e('0x52')](_0x4f9787[_0x7b5e('0x49')],_0x12e83d['filters']));if(_0x4f9787[_0x7b5e('0x49')][_0x7b5e('0x53')]){_0x2e7b17[_0x7b5e('0x51')]=_['merge'](_0x2e7b17[_0x7b5e('0x51')],{'$or':_[_0x7b5e('0x43')](_0x54e858,function(_0xfcba0b){if(_0xfcba0b[_0x7b5e('0x46')]!==_0x7b5e('0x54')){var _0x23a8fd={};_0x23a8fd[_0xfcba0b[_0x7b5e('0x3c')]]={'$like':'%'+_0x4f9787['query'][_0x7b5e('0x53')]+'%'};return _0x23a8fd;}})});}_0x2e7b17=_[_0x7b5e('0x55')]({},_0x2e7b17,_0x4f9787['options']);var _0x52900b={'where':_0x2e7b17[_0x7b5e('0x51')]};return db[_0x7b5e('0x44')][_0x7b5e('0x2e')](_0x52900b)[_0x7b5e('0x22')](function(_0x505f41){_0xf5f428[_0x7b5e('0x2e')]=_0x505f41;if(_0x4f9787[_0x7b5e('0x49')][_0x7b5e('0x56')]){_0x2e7b17[_0x7b5e('0x57')]=[{'all':!![]}];}return db['MailAccount'][_0x7b5e('0x58')](_0x2e7b17);})[_0x7b5e('0x22')](function(_0x5f049e){_0xf5f428['rows']=_0x5f049e;return _0xf5f428;})[_0x7b5e('0x22')](respondWithFilteredResult(_0x2287c7,_0x2e7b17))[_0x7b5e('0x2b')](handleError(_0x2287c7,null));};exports['show']=function(_0x11aa8a,_0x1ab3dc){var _0x58ddd2={'raw':![],'where':{'id':_0x11aa8a[_0x7b5e('0x59')]['id']},'include':[{'model':db[_0x7b5e('0x3e')],'as':_0x7b5e('0x3f')},{'model':db['MailServerOut'],'as':_0x7b5e('0x41')},{'model':db['Pause'],'as':_0x7b5e('0x42')}]},_0x5ee7cd={};_0x5ee7cd[_0x7b5e('0x47')]=_[_0x7b5e('0x48')](db[_0x7b5e('0x44')][_0x7b5e('0x5a')]);_0x5ee7cd[_0x7b5e('0x49')]=_[_0x7b5e('0x48')](_0x11aa8a['query']);_0x5ee7cd[_0x7b5e('0x5b')]=_[_0x7b5e('0x4a')](_0x5ee7cd['model'],_0x5ee7cd[_0x7b5e('0x49')]);_0x58ddd2[_0x7b5e('0x4c')]=_['intersection'](_0x5ee7cd[_0x7b5e('0x47')],qs[_0x7b5e('0x4b')](_0x11aa8a[_0x7b5e('0x49')]['fields']));_0x58ddd2['attributes']=_0x58ddd2[_0x7b5e('0x4c')][_0x7b5e('0x4d')]?_0x58ddd2['attributes']:_0x5ee7cd[_0x7b5e('0x47')];if(_0x11aa8a['query']['includeAll']){_0x58ddd2[_0x7b5e('0x57')]=[{'all':!![]}];}_0x58ddd2=_[_0x7b5e('0x55')]({},_0x58ddd2,_0x11aa8a[_0x7b5e('0x5c')]);return db[_0x7b5e('0x44')]['find'](_0x58ddd2)['then'](handleEntityNotFound(_0x1ab3dc,null))[_0x7b5e('0x22')](respondWithResult(_0x1ab3dc,null))[_0x7b5e('0x2b')](handleError(_0x1ab3dc,null));};exports['update']=function(_0x2f8ee6,_0x5782f0){if(_0x2f8ee6['body']['id']){delete _0x2f8ee6[_0x7b5e('0x5d')]['id'];}return db[_0x7b5e('0x44')][_0x7b5e('0x5e')]({'where':{'id':_0x2f8ee6[_0x7b5e('0x59')]['id']},'include':[{'model':db[_0x7b5e('0x3e')],'as':_0x7b5e('0x3f')},{'model':db[_0x7b5e('0x40')],'as':'Smtp'},{'model':db['Pause'],'as':_0x7b5e('0x42')}]})[_0x7b5e('0x22')](handleEntityNotFound(_0x5782f0,null))[_0x7b5e('0x22')](saveUpdates(_0x2f8ee6[_0x7b5e('0x5d')],null))[_0x7b5e('0x22')](function(_0xad515){if(_0xad515&&_0x2f8ee6[_0x7b5e('0x5d')][_0x7b5e('0x3f')]){return db['MailServerIn']['update'](_0x2f8ee6[_0x7b5e('0x5d')][_0x7b5e('0x3f')],{'where':{'MailAccountId':_0xad515['id']}})[_0x7b5e('0x22')](function(){return _0xad515;});}return _0xad515;})[_0x7b5e('0x22')](function(_0x594eb0){if(_0x594eb0&&_0x2f8ee6[_0x7b5e('0x5d')][_0x7b5e('0x41')]){return db[_0x7b5e('0x40')][_0x7b5e('0x35')](_0x2f8ee6[_0x7b5e('0x5d')][_0x7b5e('0x41')],{'where':{'MailAccountId':_0x594eb0['id']}})['then'](function(){return _0x594eb0;});}return _0x594eb0;})[_0x7b5e('0x22')](respondWithResult(_0x5782f0,null))[_0x7b5e('0x2b')](handleError(_0x5782f0,null));};exports['describe']=function(_0x35c9f3,_0x504633){return db[_0x7b5e('0x44')][_0x7b5e('0x5f')]()[_0x7b5e('0x22')](respondWithResult(_0x504633,null))[_0x7b5e('0x2b')](handleError(_0x504633,null));};exports[_0x7b5e('0x60')]=function(_0x33aba1,_0x366c9c,_0x725c1d){if(_0x33aba1[_0x7b5e('0x5d')]['id']){delete _0x33aba1['body']['id'];}return db[_0x7b5e('0x44')][_0x7b5e('0x5e')]({'where':{'id':_0x33aba1[_0x7b5e('0x59')]['id']}})['then'](handleEntityNotFound(_0x366c9c,null))[_0x7b5e('0x22')](function(_0x1f692e){if(_0x1f692e){_0x33aba1[_0x7b5e('0x5d')][_0x7b5e('0x61')]=_0x1f692e['id'];return db[_0x7b5e('0x62')]['create'](_0x33aba1[_0x7b5e('0x5d')]);}})[_0x7b5e('0x22')](respondWithResult(_0x366c9c,null))[_0x7b5e('0x2b')](handleError(_0x366c9c,null));};exports[_0x7b5e('0x63')]=function(_0x37ec8,_0x2d22fb,_0xb70520){var _0x308efd={'raw':![],'where':{}};var _0x72a5f9={};var _0x248765={'count':0x0,'rows':[]};return db[_0x7b5e('0x44')][_0x7b5e('0x64')]({'where':{'id':_0x37ec8['params']['id']}})[_0x7b5e('0x22')](handleEntityNotFound(_0x2d22fb,null))[_0x7b5e('0x22')](function(_0x3df7f4){if(_0x3df7f4){_0x72a5f9['model']=_['keys'](db[_0x7b5e('0x62')][_0x7b5e('0x5a')]);_0x72a5f9[_0x7b5e('0x49')]=_[_0x7b5e('0x48')](_0x37ec8[_0x7b5e('0x49')]);_0x72a5f9['filters']=_[_0x7b5e('0x4a')](_0x72a5f9[_0x7b5e('0x47')],_0x72a5f9[_0x7b5e('0x49')]);_0x308efd['attributes']=_[_0x7b5e('0x4a')](_0x72a5f9[_0x7b5e('0x47')],qs[_0x7b5e('0x4b')](_0x37ec8[_0x7b5e('0x49')]['fields']));_0x308efd['attributes']=_0x308efd[_0x7b5e('0x4c')][_0x7b5e('0x4d')]?_0x308efd[_0x7b5e('0x4c')]:_0x72a5f9[_0x7b5e('0x47')];if(!_0x37ec8[_0x7b5e('0x49')][_0x7b5e('0x4e')](_0x7b5e('0x4f'))){_0x308efd[_0x7b5e('0x30')]=qs[_0x7b5e('0x30')](_0x37ec8[_0x7b5e('0x49')][_0x7b5e('0x30')]);_0x308efd[_0x7b5e('0x2f')]=qs[_0x7b5e('0x2f')](_0x37ec8[_0x7b5e('0x49')][_0x7b5e('0x2f')]);}_0x308efd[_0x7b5e('0x65')]=qs[_0x7b5e('0x50')](_0x37ec8[_0x7b5e('0x49')]['sort']);_0x308efd['where']=qs[_0x7b5e('0x5b')](_[_0x7b5e('0x52')](_0x37ec8[_0x7b5e('0x49')],_0x72a5f9[_0x7b5e('0x5b')]));_0x308efd[_0x7b5e('0x51')][_0x7b5e('0x61')]=_0x3df7f4['id'];if(_0x37ec8[_0x7b5e('0x49')][_0x7b5e('0x53')]){_0x308efd[_0x7b5e('0x51')]=_[_0x7b5e('0x55')](_0x308efd[_0x7b5e('0x51')],{'$or':_['map'](_0x308efd[_0x7b5e('0x4c')],function(_0x266883){var _0x152a24={};_0x152a24[_0x266883]={'$like':'%'+_0x37ec8[_0x7b5e('0x49')][_0x7b5e('0x53')]+'%'};return _0x152a24;})});}_0x308efd=_[_0x7b5e('0x55')]({},_0x308efd,_0x37ec8[_0x7b5e('0x5c')]);return db[_0x7b5e('0x62')][_0x7b5e('0x2e')]({'where':_0x308efd[_0x7b5e('0x51')]})[_0x7b5e('0x22')](function(_0xd05978){_0x248765[_0x7b5e('0x2e')]=_0xd05978;if(_0x37ec8[_0x7b5e('0x49')][_0x7b5e('0x56')]){_0x308efd[_0x7b5e('0x57')]=[{'all':!![]}];}return db[_0x7b5e('0x62')]['findAll'](_0x308efd);})[_0x7b5e('0x22')](function(_0x3d2cf0){_0x248765[_0x7b5e('0x66')]=_0x3d2cf0;return _0x248765;});}})[_0x7b5e('0x22')](respondWithFilteredResult(_0x2d22fb,_0x308efd))[_0x7b5e('0x2b')](handleError(_0x2d22fb,null));};exports['removeDispositions']=function(_0x58425e,_0x17a83e,_0x3550ef){return db[_0x7b5e('0x44')][_0x7b5e('0x5e')]({'where':{'id':_0x58425e[_0x7b5e('0x59')]['id']}})[_0x7b5e('0x22')](handleEntityNotFound(_0x17a83e,null))['then'](function(_0x2a1113){if(_0x2a1113){return _0x2a1113['removeDispositions'](_0x58425e[_0x7b5e('0x49')][_0x7b5e('0x67')]);}})[_0x7b5e('0x22')](respondWithStatusCode(_0x17a83e,null))['catch'](handleError(_0x17a83e,null));};exports[_0x7b5e('0x68')]=function(_0x5317e6,_0xbb5479,_0x2e059d){if(_0x5317e6[_0x7b5e('0x5d')]['id']){delete _0x5317e6[_0x7b5e('0x5d')]['id'];}return db[_0x7b5e('0x44')][_0x7b5e('0x5e')]({'where':{'id':_0x5317e6[_0x7b5e('0x59')]['id']}})[_0x7b5e('0x22')](handleEntityNotFound(_0xbb5479,null))[_0x7b5e('0x22')](function(_0x259f4a){if(_0x259f4a){_0x5317e6[_0x7b5e('0x5d')][_0x7b5e('0x61')]=_0x259f4a['id'];return db['CannedAnswer']['create'](_0x5317e6[_0x7b5e('0x5d')]);}})[_0x7b5e('0x22')](respondWithResult(_0xbb5479,null))[_0x7b5e('0x2b')](handleError(_0xbb5479,null));};exports[_0x7b5e('0x69')]=function(_0xe4966,_0x32ee55,_0xabef32){var _0x1a45f9={'raw':![],'where':{}};var _0x3cb57c={};var _0x27fa79={'count':0x0,'rows':[]};return db[_0x7b5e('0x44')][_0x7b5e('0x64')]({'where':{'id':_0xe4966['params']['id']}})[_0x7b5e('0x22')](handleEntityNotFound(_0x32ee55,null))[_0x7b5e('0x22')](function(_0x953310){if(_0x953310){_0x3cb57c[_0x7b5e('0x47')]=_[_0x7b5e('0x48')](db[_0x7b5e('0x6a')][_0x7b5e('0x5a')]);_0x3cb57c[_0x7b5e('0x49')]=_['keys'](_0xe4966['query']);_0x3cb57c['filters']=_[_0x7b5e('0x4a')](_0x3cb57c[_0x7b5e('0x47')],_0x3cb57c['query']);_0x1a45f9[_0x7b5e('0x4c')]=_['intersection'](_0x3cb57c['model'],qs[_0x7b5e('0x4b')](_0xe4966[_0x7b5e('0x49')]['fields']));_0x1a45f9[_0x7b5e('0x4c')]=_0x1a45f9[_0x7b5e('0x4c')][_0x7b5e('0x4d')]?_0x1a45f9[_0x7b5e('0x4c')]:_0x3cb57c['model'];if(!_0xe4966[_0x7b5e('0x49')][_0x7b5e('0x4e')](_0x7b5e('0x4f'))){_0x1a45f9[_0x7b5e('0x30')]=qs['limit'](_0xe4966[_0x7b5e('0x49')][_0x7b5e('0x30')]);_0x1a45f9[_0x7b5e('0x2f')]=qs[_0x7b5e('0x2f')](_0xe4966['query'][_0x7b5e('0x2f')]);}_0x1a45f9[_0x7b5e('0x65')]=qs[_0x7b5e('0x50')](_0xe4966[_0x7b5e('0x49')][_0x7b5e('0x50')]);_0x1a45f9[_0x7b5e('0x51')]=qs[_0x7b5e('0x5b')](_[_0x7b5e('0x52')](_0xe4966[_0x7b5e('0x49')],_0x3cb57c[_0x7b5e('0x5b')]));_0x1a45f9[_0x7b5e('0x51')][_0x7b5e('0x61')]=_0x953310['id'];if(_0xe4966[_0x7b5e('0x49')]['filter']){_0x1a45f9[_0x7b5e('0x51')]=_[_0x7b5e('0x55')](_0x1a45f9[_0x7b5e('0x51')],{'$or':_['map'](_0x1a45f9[_0x7b5e('0x4c')],function(_0x59dc00){var _0x4afa0b={};_0x4afa0b[_0x59dc00]={'$like':'%'+_0xe4966[_0x7b5e('0x49')]['filter']+'%'};return _0x4afa0b;})});}_0x1a45f9=_['merge']({},_0x1a45f9,_0xe4966[_0x7b5e('0x5c')]);return db[_0x7b5e('0x6a')]['count']({'where':_0x1a45f9['where']})[_0x7b5e('0x22')](function(_0x34ac05){_0x27fa79['count']=_0x34ac05;if(_0xe4966[_0x7b5e('0x49')]['includeAll']){_0x1a45f9[_0x7b5e('0x57')]=[{'all':!![]}];}return db[_0x7b5e('0x6a')][_0x7b5e('0x58')](_0x1a45f9);})[_0x7b5e('0x22')](function(_0x5a7803){_0x27fa79[_0x7b5e('0x66')]=_0x5a7803;return _0x27fa79;});}})[_0x7b5e('0x22')](respondWithFilteredResult(_0x32ee55,_0x1a45f9))[_0x7b5e('0x2b')](handleError(_0x32ee55,null));};exports['removeAnswers']=function(_0x47242e,_0x23d4aa,_0x2e8c05){return db[_0x7b5e('0x44')][_0x7b5e('0x5e')]({'where':{'id':_0x47242e[_0x7b5e('0x59')]['id']}})[_0x7b5e('0x22')](handleEntityNotFound(_0x23d4aa,null))['then'](function(_0x12738d){if(_0x12738d){return _0x12738d[_0x7b5e('0x6b')](_0x47242e[_0x7b5e('0x49')][_0x7b5e('0x67')]);}})[_0x7b5e('0x22')](respondWithStatusCode(_0x23d4aa,null))[_0x7b5e('0x2b')](handleError(_0x23d4aa,null));};exports[_0x7b5e('0x6c')]=function(_0x4ce78b,_0xcba241){var _0x294987={'name':_0x4ce78b[_0x7b5e('0x5d')][_0x7b5e('0x3c')],'key':_0x4ce78b[_0x7b5e('0x5d')]['key'],'email':_0x4ce78b[_0x7b5e('0x5d')][_0x7b5e('0x6d')],'ListId':_0x4ce78b['body'][_0x7b5e('0x6e')],'active':!_[_0x7b5e('0x6f')](_0x4ce78b['body'][_0x7b5e('0x70')])?_0x4ce78b['body']['active']:!![],'description':_0x4ce78b[_0x7b5e('0x5d')][_0x7b5e('0x71')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x4ce78b['body'][_0x7b5e('0x72')])){if(_0x4ce78b['body']['cauthentication']){_0x294987[_0x7b5e('0x3f')]['user']=_0x294987[_0x7b5e('0x41')][_0x7b5e('0x73')]=_0x4ce78b[_0x7b5e('0x5d')]['cuser'];_0x294987[_0x7b5e('0x3f')][_0x7b5e('0x74')]=_0x294987['Smtp'][_0x7b5e('0x75')]=_0x4ce78b['body'][_0x7b5e('0x76')];}else{_0x294987[_0x7b5e('0x3f')][_0x7b5e('0x77')]=_0x294987[_0x7b5e('0x41')][_0x7b5e('0x77')]=![];}_0x294987['Imap'][_0x7b5e('0x78')]=_0x4ce78b['body'][_0x7b5e('0x3f')][_0x7b5e('0x78')];_0x294987[_0x7b5e('0x3f')][_0x7b5e('0x79')]=_0x4ce78b['body']['Imap']['port'];_0x294987['Smtp'][_0x7b5e('0x78')]=_0x4ce78b[_0x7b5e('0x5d')][_0x7b5e('0x41')][_0x7b5e('0x78')];_0x294987[_0x7b5e('0x41')][_0x7b5e('0x79')]=_0x4ce78b['body'][_0x7b5e('0x41')]['port'];}else{_0x294987[_0x7b5e('0x3f')]['service']=_0x294987[_0x7b5e('0x41')][_0x7b5e('0x7a')]=_0x4ce78b[_0x7b5e('0x5d')][_0x7b5e('0x72')];_0x294987[_0x7b5e('0x3f')][_0x7b5e('0x73')]=_0x294987[_0x7b5e('0x41')]['user']=_0x4ce78b[_0x7b5e('0x5d')][_0x7b5e('0x7b')];_0x294987['Imap'][_0x7b5e('0x74')]=_0x294987[_0x7b5e('0x41')][_0x7b5e('0x75')]=_0x4ce78b[_0x7b5e('0x5d')]['cpassword'];}return db[_0x7b5e('0x44')][_0x7b5e('0x6c')](_0x294987,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x7b5e('0x3e')],'as':_0x7b5e('0x3f')}]})[_0x7b5e('0x22')](function(_0x402a9e){var _0x5289bd=_0x4ce78b[_0x7b5e('0x73')]['get']({'plain':!![]});if(!_0x5289bd)throw new Error(_0x7b5e('0x7c'));if(_0x5289bd['role']===_0x7b5e('0x73')){var _0x2e1b97=_0x402a9e[_0x7b5e('0x37')]({'plain':!![]});return db[_0x7b5e('0x7d')]['find']({'where':{'name':_0x7b5e('0x38'),'userProfileId':_0x5289bd[_0x7b5e('0x7e')]},'raw':!![]})[_0x7b5e('0x22')](function(_0x3ca0c1){if(_0x3ca0c1&&_0x3ca0c1['autoAssociation']===0x0){return db['UserProfileResource'][_0x7b5e('0x6c')]({'name':_0x2e1b97[_0x7b5e('0x3c')],'resourceId':_0x2e1b97['id'],'type':_0x3ca0c1[_0x7b5e('0x3c')],'sectionId':_0x3ca0c1['id']},{})['then'](function(){return _0x402a9e;});}else{return _0x402a9e;}})['catch'](function(_0xd8ac63){logger[_0x7b5e('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd8ac63);throw _0xd8ac63;});}return _0x402a9e;})[_0x7b5e('0x22')](respondWithResult(_0xcba241,0xc9))[_0x7b5e('0x2b')](handleError(_0xcba241,null));};exports[_0x7b5e('0x7f')]=function(_0x583781,_0x48e017,_0x4865fa){return db[_0x7b5e('0x44')][_0x7b5e('0x64')]({'where':{'id':_0x583781[_0x7b5e('0x59')]['id']}})['then'](handleEntityNotFound(_0x48e017,null))[_0x7b5e('0x22')](function(_0x163250){if(_0x163250){return _0x163250[_0x7b5e('0x7f')]();}return null;})[_0x7b5e('0x22')](respondWithResult(_0x48e017,null))['catch'](handleError(_0x48e017,null));};exports[_0x7b5e('0x80')]=function(_0x25c338,_0x497dc3,_0xb9e7b9){if(_0x25c338[_0x7b5e('0x5d')]['id']){delete _0x25c338[_0x7b5e('0x5d')]['id'];}return db[_0x7b5e('0x44')][_0x7b5e('0x5e')]({'where':{'id':_0x25c338[_0x7b5e('0x59')]['id']}})['then'](handleEntityNotFound(_0x497dc3,null))[_0x7b5e('0x22')](function(_0x333434){if(_0x333434){_0x25c338[_0x7b5e('0x5d')][_0x7b5e('0x61')]=_0x333434['id'];return db['MailServerIn'][_0x7b5e('0x6c')](_0x25c338[_0x7b5e('0x5d')]);}})['then'](respondWithResult(_0x497dc3,null))[_0x7b5e('0x2b')](handleError(_0x497dc3,null));};exports[_0x7b5e('0x81')]=function(_0x4390ea,_0x3151a1,_0x4417c0){return db['MailAccount'][_0x7b5e('0x64')]({'where':{'id':_0x4390ea['params']['id']}})[_0x7b5e('0x22')](handleEntityNotFound(_0x3151a1,null))[_0x7b5e('0x22')](function(_0x20a944){if(_0x20a944){return _0x20a944[_0x7b5e('0x82')](null);}return null;})[_0x7b5e('0x22')](respondWithStatusCode(_0x3151a1,null))['catch'](handleError(_0x3151a1,null));};exports[_0x7b5e('0x83')]=function(_0x81e845,_0x418f29,_0x16cbe5){return db[_0x7b5e('0x44')][_0x7b5e('0x64')]({'where':{'id':_0x81e845[_0x7b5e('0x59')]['id']}})[_0x7b5e('0x22')](handleEntityNotFound(_0x418f29,null))['then'](function(_0x438075){if(_0x438075){return _0x438075[_0x7b5e('0x83')]();}return null;})[_0x7b5e('0x22')](respondWithResult(_0x418f29,null))[_0x7b5e('0x2b')](handleError(_0x418f29,null));};exports[_0x7b5e('0x84')]=function(_0x30bd79,_0x4f3080,_0x52d083){if(_0x30bd79[_0x7b5e('0x5d')]['id']){delete _0x30bd79[_0x7b5e('0x5d')]['id'];}return db['MailAccount'][_0x7b5e('0x5e')]({'where':{'id':_0x30bd79[_0x7b5e('0x59')]['id']}})[_0x7b5e('0x22')](handleEntityNotFound(_0x4f3080,null))[_0x7b5e('0x22')](function(_0x23dd16){if(_0x23dd16){_0x30bd79[_0x7b5e('0x5d')]['MailAccountId']=_0x23dd16['id'];return db['MailServerOut'][_0x7b5e('0x6c')](_0x30bd79[_0x7b5e('0x5d')]);}})[_0x7b5e('0x22')](respondWithResult(_0x4f3080,null))[_0x7b5e('0x2b')](handleError(_0x4f3080,null));};exports['removeSmtp']=function(_0x3a9f73,_0x52be44,_0x139f25){return db[_0x7b5e('0x44')][_0x7b5e('0x64')]({'where':{'id':_0x3a9f73[_0x7b5e('0x59')]['id']}})['then'](handleEntityNotFound(_0x52be44,null))[_0x7b5e('0x22')](function(_0x352550){if(_0x352550){return _0x352550[_0x7b5e('0x85')](null);}return null;})[_0x7b5e('0x22')](respondWithStatusCode(_0x52be44,null))[_0x7b5e('0x2b')](handleError(_0x52be44,null));};exports[_0x7b5e('0x86')]=function(_0xbeab02,_0xe4b868,_0x4667b3){return db[_0x7b5e('0x87')][_0x7b5e('0x5e')]({'where':{'id':_0xbeab02['params']['id']}})[_0x7b5e('0x22')](handleEntityNotFound(_0xe4b868,null))[_0x7b5e('0x22')](function(_0x5e0456){if(_0x5e0456){return _0x5e0456[_0x7b5e('0x86')](_0xbeab02['body'][_0x7b5e('0x67')],_[_0x7b5e('0x88')](_0xbeab02['body'],['ids','id'])||{});}})[_0x7b5e('0x22')](respondWithResult(_0xe4b868,null))[_0x7b5e('0x2b')](handleError(_0xe4b868,null));};exports[_0x7b5e('0x89')]=function(_0x1b1016,_0xa5390b,_0x13f795){var _0x59b3e0={'raw':![],'where':{}};var _0x382522={};var _0x1f0729={'count':0x0,'rows':[]};return db['MailAccount'][_0x7b5e('0x64')]({'where':{'id':_0x1b1016['params']['id']}})[_0x7b5e('0x22')](handleEntityNotFound(_0xa5390b,null))['then'](function(_0xe95326){if(_0xe95326){_0x382522[_0x7b5e('0x47')]=_[_0x7b5e('0x48')](db[_0x7b5e('0x87')][_0x7b5e('0x5a')]);_0x382522[_0x7b5e('0x49')]=_[_0x7b5e('0x48')](_0x1b1016[_0x7b5e('0x49')]);_0x382522['filters']=_[_0x7b5e('0x4a')](_0x382522[_0x7b5e('0x47')],_0x382522[_0x7b5e('0x49')]);_0x59b3e0[_0x7b5e('0x4c')]=_[_0x7b5e('0x4a')](_0x382522[_0x7b5e('0x47')],qs[_0x7b5e('0x4b')](_0x1b1016['query']['fields']));_0x59b3e0[_0x7b5e('0x4c')]=_0x59b3e0[_0x7b5e('0x4c')][_0x7b5e('0x4d')]?_0x59b3e0[_0x7b5e('0x4c')]:_0x382522['model'];if(!_0x1b1016[_0x7b5e('0x49')][_0x7b5e('0x4e')](_0x7b5e('0x4f'))){_0x59b3e0[_0x7b5e('0x30')]=qs[_0x7b5e('0x30')](_0x1b1016[_0x7b5e('0x49')][_0x7b5e('0x30')]);_0x59b3e0[_0x7b5e('0x2f')]=qs[_0x7b5e('0x2f')](_0x1b1016[_0x7b5e('0x49')][_0x7b5e('0x2f')]);}_0x59b3e0[_0x7b5e('0x65')]=qs[_0x7b5e('0x50')](_0x1b1016[_0x7b5e('0x49')][_0x7b5e('0x50')]);_0x59b3e0['where']=qs[_0x7b5e('0x5b')](_[_0x7b5e('0x52')](_0x1b1016[_0x7b5e('0x49')],_0x382522[_0x7b5e('0x5b')]));_0x59b3e0[_0x7b5e('0x51')][_0x7b5e('0x61')]=_0xe95326['id'];if(_0x1b1016['query']['filter']){_0x59b3e0[_0x7b5e('0x51')]=_[_0x7b5e('0x55')](_0x59b3e0[_0x7b5e('0x51')],{'$or':_[_0x7b5e('0x43')](_0x59b3e0[_0x7b5e('0x4c')],function(_0x2be6c4){var _0x5f021c={};_0x5f021c[_0x2be6c4]={'$like':'%'+_0x1b1016[_0x7b5e('0x49')]['filter']+'%'};return _0x5f021c;})});}_0x59b3e0=_[_0x7b5e('0x55')]({},_0x59b3e0,_0x1b1016[_0x7b5e('0x5c')]);return db[_0x7b5e('0x87')][_0x7b5e('0x2e')]({'where':_0x59b3e0[_0x7b5e('0x51')]})['then'](function(_0x3478d4){_0x1f0729[_0x7b5e('0x2e')]=_0x3478d4;if(_0x1b1016[_0x7b5e('0x49')][_0x7b5e('0x56')]){_0x59b3e0[_0x7b5e('0x57')]=[{'model':db[_0x7b5e('0x8a')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x7b5e('0x8b'),'attributes':['name',_0x7b5e('0x8c'),'internal'],'required':![]},{'model':db[_0x7b5e('0x8d')],'as':_0x7b5e('0x8e'),'attributes':['id',_0x7b5e('0x3c'),_0x7b5e('0x8f')],'where':_0x1b1016[_0x7b5e('0x49')]['tag']?{'id':_0x1b1016[_0x7b5e('0x49')][_0x7b5e('0x90')]}:undefined,'required':_0x1b1016[_0x7b5e('0x49')][_0x7b5e('0x90')]?!![]:![]}];}return db['MailInteraction'][_0x7b5e('0x58')](_0x59b3e0);})['then'](function(_0x155ba0){_0x1f0729['rows']=_0x155ba0;return _0x1f0729;});}})[_0x7b5e('0x22')](respondWithFilteredResult(_0xa5390b,_0x59b3e0))[_0x7b5e('0x2b')](handleError(_0xa5390b,null));};exports[_0x7b5e('0x91')]=function(_0x7359d2,_0x28711f,_0x3a2eeb){return db['MailAccount'][_0x7b5e('0x64')]({'where':{'id':_0x7359d2[_0x7b5e('0x59')]['id']}})[_0x7b5e('0x22')](handleEntityNotFound(_0x28711f,null))[_0x7b5e('0x22')](function(_0x291877){if(_0x291877){return db['sequelize'][_0x7b5e('0x92')](function(_0xc314c3){return db[_0x7b5e('0x93')]['destroy']({'where':{'MailAccountId':_0x7359d2[_0x7b5e('0x59')]['id']},'transaction':_0xc314c3})[_0x7b5e('0x22')](function(_0x19e57e){var _0x469554=_[_0x7b5e('0x43')](_0x7359d2[_0x7b5e('0x5d')],function(_0x2d0a27){_0x2d0a27[_0x7b5e('0x61')]=_0x7359d2[_0x7b5e('0x59')]['id'];return _0x2d0a27;});return db['MailApplication']['bulkCreate'](_0x469554,{'transaction':_0xc314c3});});})[_0x7b5e('0x22')](function(){return db[_0x7b5e('0x93')][_0x7b5e('0x94')]({'where':{'MailAccountId':_0x7359d2[_0x7b5e('0x59')]['id']},'order':_0x7b5e('0x95')});});}})[_0x7b5e('0x22')](respondWithResult(_0x28711f,null))[_0x7b5e('0x2b')](handleError(_0x28711f,null));};exports[_0x7b5e('0x96')]=function(_0x1f4a60,_0x20365d,_0x7f3c9a){var _0x3ed8ed={};var _0x28f605={};var _0x10be30;var _0x14e343;return db[_0x7b5e('0x44')][_0x7b5e('0x64')]({'where':{'id':_0x1f4a60[_0x7b5e('0x59')]['id']}})['then'](handleEntityNotFound(_0x20365d,null))[_0x7b5e('0x22')](function(_0x4ce048){if(_0x4ce048){_0x10be30=_0x4ce048;_0x28f605[_0x7b5e('0x47')]=_[_0x7b5e('0x48')](db[_0x7b5e('0x93')][_0x7b5e('0x5a')]);_0x28f605['query']=_[_0x7b5e('0x48')](_0x1f4a60[_0x7b5e('0x49')]);_0x28f605[_0x7b5e('0x5b')]=_[_0x7b5e('0x4a')](_0x28f605[_0x7b5e('0x47')],_0x28f605[_0x7b5e('0x49')]);_0x3ed8ed[_0x7b5e('0x4c')]=_[_0x7b5e('0x4a')](_0x28f605[_0x7b5e('0x47')],qs['fields'](_0x1f4a60[_0x7b5e('0x49')][_0x7b5e('0x4b')]));_0x3ed8ed[_0x7b5e('0x4c')]=_0x3ed8ed[_0x7b5e('0x4c')][_0x7b5e('0x4d')]?_0x3ed8ed[_0x7b5e('0x4c')]:_0x28f605['model'];_0x3ed8ed[_0x7b5e('0x65')]=qs[_0x7b5e('0x50')](_0x1f4a60[_0x7b5e('0x49')]['sort']);_0x3ed8ed[_0x7b5e('0x51')]=qs[_0x7b5e('0x5b')](_[_0x7b5e('0x52')](_0x1f4a60['query'],_0x28f605[_0x7b5e('0x5b')]));if(_0x1f4a60['query'][_0x7b5e('0x53')]){_0x3ed8ed['where']=_[_0x7b5e('0x55')](_0x3ed8ed['where'],{'$or':_[_0x7b5e('0x43')](_0x3ed8ed[_0x7b5e('0x4c')],function(_0x2ca26a){var _0x29e8cf={};_0x29e8cf[_0x2ca26a]={'$like':'%'+_0x1f4a60[_0x7b5e('0x49')][_0x7b5e('0x53')]+'%'};return _0x29e8cf;})});}_0x3ed8ed=_[_0x7b5e('0x55')]({},_0x3ed8ed,_0x1f4a60[_0x7b5e('0x5c')]);return _0x10be30['getApplications'](_0x3ed8ed);}})['then'](function(_0x2f8fb1){if(_0x2f8fb1){_0x14e343=_0x2f8fb1[_0x7b5e('0x4d')];if(!_0x1f4a60[_0x7b5e('0x49')]['hasOwnProperty'](_0x7b5e('0x4f'))){_0x3ed8ed[_0x7b5e('0x30')]=qs['limit'](_0x1f4a60[_0x7b5e('0x49')][_0x7b5e('0x30')]);_0x3ed8ed[_0x7b5e('0x2f')]=qs[_0x7b5e('0x2f')](_0x1f4a60['query'][_0x7b5e('0x2f')]);}return _0x10be30['getApplications'](_0x3ed8ed);}})['then'](function(_0x20790d){if(_0x20790d){return _0x20790d?{'count':_0x14e343,'rows':_0x20790d}:null;}})[_0x7b5e('0x22')](respondWithResult(_0x20365d,null))[_0x7b5e('0x2b')](handleError(_0x20365d,null));};exports['getMessages']=function(_0x47be00,_0x990781,_0x57e6e0){var _0x2b8b81={'raw':!![],'where':{}};var _0x4057a0={};var _0x558bb5={'count':0x0,'rows':[]};return db[_0x7b5e('0x44')]['findOne']({'where':{'id':_0x47be00[_0x7b5e('0x59')]['id']}})['then'](handleEntityNotFound(_0x990781,null))[_0x7b5e('0x22')](function(_0x289b34){if(_0x289b34){_0x4057a0[_0x7b5e('0x47')]=_['keys'](db[_0x7b5e('0x97')][_0x7b5e('0x5a')]);_0x4057a0[_0x7b5e('0x49')]=_[_0x7b5e('0x48')](_0x47be00[_0x7b5e('0x49')]);_0x4057a0[_0x7b5e('0x5b')]=_[_0x7b5e('0x4a')](_0x4057a0['model'],_0x4057a0[_0x7b5e('0x49')]);_0x2b8b81[_0x7b5e('0x4c')]=_[_0x7b5e('0x4a')](_0x4057a0['model'],qs[_0x7b5e('0x4b')](_0x47be00[_0x7b5e('0x49')][_0x7b5e('0x4b')]));_0x2b8b81[_0x7b5e('0x4c')]=_0x2b8b81[_0x7b5e('0x4c')]['length']?_0x2b8b81[_0x7b5e('0x4c')]:_0x4057a0[_0x7b5e('0x47')];if(!_0x47be00['query'][_0x7b5e('0x4e')](_0x7b5e('0x4f'))){_0x2b8b81[_0x7b5e('0x30')]=qs['limit'](_0x47be00[_0x7b5e('0x49')]['limit']);_0x2b8b81[_0x7b5e('0x2f')]=qs[_0x7b5e('0x2f')](_0x47be00[_0x7b5e('0x49')][_0x7b5e('0x2f')]);}_0x2b8b81[_0x7b5e('0x65')]=qs[_0x7b5e('0x50')](_0x47be00[_0x7b5e('0x49')][_0x7b5e('0x50')]);_0x2b8b81['where']=qs[_0x7b5e('0x5b')](_[_0x7b5e('0x52')](_0x47be00['query'],_0x4057a0[_0x7b5e('0x5b')]));_0x2b8b81[_0x7b5e('0x51')][_0x7b5e('0x61')]=_0x289b34['id'];if(_0x47be00[_0x7b5e('0x49')][_0x7b5e('0x53')]){_0x2b8b81[_0x7b5e('0x51')]=_[_0x7b5e('0x55')](_0x2b8b81[_0x7b5e('0x51')],{'$or':_['map'](_0x2b8b81[_0x7b5e('0x4c')],function(_0x4b7960){var _0x7ba023={};_0x7ba023[_0x4b7960]={'$like':'%'+_0x47be00['query'][_0x7b5e('0x53')]+'%'};return _0x7ba023;})});}if(_0x47be00[_0x7b5e('0x49')][_0x7b5e('0x98')]){var _0x14d5ba=_0x47be00[_0x7b5e('0x49')][_0x7b5e('0x98')][_0x7b5e('0x99')](',');var _0xce5a7f={};_0xce5a7f[_0x14d5ba[0x0]]={'$gte':moment(_0x14d5ba[0x1])['format'](_0x7b5e('0x9a'))};_0x2b8b81[_0x7b5e('0x51')]=_[_0x7b5e('0x55')](_0x2b8b81['where'],_0xce5a7f);}_0x2b8b81=_['merge']({},_0x2b8b81,_0x47be00[_0x7b5e('0x5c')]);return db[_0x7b5e('0x97')][_0x7b5e('0x2e')]({'where':_0x2b8b81['where']})[_0x7b5e('0x22')](function(_0x420851){_0x558bb5[_0x7b5e('0x2e')]=_0x420851;if(_0x47be00['query']['includeAll']){_0x2b8b81[_0x7b5e('0x57')]=[{'all':!![]}];}return db['MailMessage'][_0x7b5e('0x58')](_0x2b8b81);})[_0x7b5e('0x22')](function(_0x14c72c){_0x558bb5[_0x7b5e('0x66')]=_0x14c72c;return _0x558bb5;});}})['then'](respondWithFilteredResult(_0x990781,_0x2b8b81))['catch'](handleError(_0x990781,null));};exports[_0x7b5e('0x3d')]=function(_0x422bbc,_0x42b788,_0x4dd8b){var _0x283161,_0x2b9c10={},_0x5866e0;if(_0x422bbc[_0x7b5e('0x5d')]['to']){_0x5866e0=_0x422bbc[_0x7b5e('0x5d')]['to'][_0x7b5e('0x99')](',')[0x0];}return db[_0x7b5e('0x44')][_0x7b5e('0x5e')]({'where':{'id':_0x422bbc[_0x7b5e('0x59')]['id']},'include':[{'model':db[_0x7b5e('0x9b')],'as':_0x7b5e('0x9c'),'include':[{'model':db['CmContact'],'as':_0x7b5e('0x9d'),'where':{'email':_0x5866e0},'limit':0x1,'order':[[_0x7b5e('0x9e'),_0x7b5e('0x9f')]]}]},{'model':db[_0x7b5e('0x40')],'as':_0x7b5e('0x41'),'raw':!![]}]})[_0x7b5e('0x22')](handleEntityNotFound(_0x42b788,null))[_0x7b5e('0x22')](function(_0x222a73){if(_0x222a73){_0x283161=_0x222a73;if(_0x222a73['Smtp']){if(_[_0x7b5e('0x6f')](_0x422bbc[_0x7b5e('0x5d')]['from'])){_0x422bbc[_0x7b5e('0x5d')][_0x7b5e('0xa0')]=util['format']('%s\x20<%s>',_0x222a73[_0x7b5e('0x3c')],_0x222a73[_0x7b5e('0x6d')]||_0x222a73[_0x7b5e('0x41')][_0x7b5e('0x73')]);}if(_0x422bbc[_0x7b5e('0x5d')][_0x7b5e('0xa1')]&&_0x422bbc[_0x7b5e('0x5d')][_0x7b5e('0xa1')][_0x7b5e('0x4d')]){for(var _0x3eb028=0x0;_0x3eb028<_0x422bbc[_0x7b5e('0x5d')][_0x7b5e('0xa1')]['length'];_0x3eb028+=0x1){_0x422bbc[_0x7b5e('0x5d')][_0x7b5e('0xa1')][_0x3eb028]={'filename':_0x422bbc[_0x7b5e('0x5d')]['attachments'][_0x3eb028][_0x7b5e('0x3c')],'path':path[_0x7b5e('0xa2')](config[_0x7b5e('0xa3')],_0x7b5e('0xa4'),_0x422bbc[_0x7b5e('0x5d')][_0x7b5e('0xa1')][_0x3eb028][_0x7b5e('0xa5')])};}}var _0x147f6e={'tls':{'rejectUnauthorized':![]}};if(_[_0x7b5e('0x6f')](_0x222a73[_0x7b5e('0x41')][_0x7b5e('0x7a')])){if(_0x222a73[_0x7b5e('0x41')][_0x7b5e('0x77')]){_0x147f6e[_0x7b5e('0xa6')]={'user':_0x222a73['Smtp']['user'],'pass':_0x222a73['Smtp'][_0x7b5e('0x75')]};}_0x147f6e[_0x7b5e('0x78')]=_0x222a73[_0x7b5e('0x41')][_0x7b5e('0x78')];_0x147f6e['port']=_0x222a73[_0x7b5e('0x41')][_0x7b5e('0x79')];_0x147f6e['secure']=_0x222a73[_0x7b5e('0x41')][_0x7b5e('0xa7')];}else{_0x147f6e[_0x7b5e('0x7a')]=_0x222a73['Smtp'][_0x7b5e('0x7a')];_0x147f6e['auth']={'user':_0x222a73[_0x7b5e('0x41')]['user'],'pass':_0x222a73[_0x7b5e('0x41')][_0x7b5e('0x75')]};}return respondWithRpcPromise(_0x7b5e('0xa8'),_0x7b5e('0xa9'),{'account':_0x147f6e,'message':_0x422bbc[_0x7b5e('0x5d')]});}else{throw new Error(_0x7b5e('0xaa'));}}})['then'](function(_0x3b3f9d){if(_0x3b3f9d){_0x2b9c10=_0x3b3f9d;if(_0x283161[_0x7b5e('0x9c')]){if(_0x283161[_0x7b5e('0x9c')][_0x7b5e('0x9d')]['length']){return _0x283161[_0x7b5e('0x9c')][_0x7b5e('0x9d')][0x0];}else{return db[_0x7b5e('0x8a')][_0x7b5e('0x6c')](_[_0x7b5e('0x18')](_0x422bbc['body'],{'firstName':_0x422bbc[_0x7b5e('0x5d')]['to'],'email':_0x422bbc[_0x7b5e('0x5d')]['to'],'phone':_0x422bbc[_0x7b5e('0x5d')]['to'],'ListId':_0x283161[_0x7b5e('0x6e')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0x7b5e('0x22')](function(_0x2df47f){if(_0x2df47f){var _0x3f8470={'UserId':_0x422bbc['user']['id'],'ContactId':_0x2df47f['id'],'MailAccountId':_0x283161['id'],'inReplyTo':_0x2b9c10[_0x7b5e('0xab')],'to':_0x422bbc[_0x7b5e('0x5d')]['from'],'cc':_0x422bbc[_0x7b5e('0x5d')]['cc'],'subject':_0x422bbc[_0x7b5e('0x5d')][_0x7b5e('0xac')],'attach':_0x422bbc['body'][_0x7b5e('0xad')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x7b5e('0xae')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','lastMsgBody':_0x422bbc[_0x7b5e('0x5d')]['body'],'Messages':[_['merge'](_0x422bbc[_0x7b5e('0x5d')],{'messageId':_0x2b9c10[_0x7b5e('0xab')],'sentAt':moment()['format'](_0x7b5e('0x9a')),'read':!![],'MailAccountId':_0x283161['id'],'UserId':_0x422bbc['user']['id'],'ContactId':_0x2df47f['id']})]};if(_0x422bbc[_0x7b5e('0x5d')][_0x7b5e('0xaf')]){_0x3f8470=_[_0x7b5e('0x55')](_0x3f8470,_0x422bbc[_0x7b5e('0x5d')][_0x7b5e('0xaf')]);}return db['MailInteraction']['create'](_0x3f8470,{'include':[{'model':db['MailMessage'],'as':_0x7b5e('0xb0')}]});}})[_0x7b5e('0x22')](respondWithResult(_0x42b788,null))[_0x7b5e('0x2b')](handleError(_0x42b788,null));};exports[_0x7b5e('0xb1')]=function(_0x520ec1,_0x2eb83d,_0x43ed6e){return db[_0x7b5e('0x44')][_0x7b5e('0x5e')]({'where':{'id':_0x520ec1[_0x7b5e('0x59')]['id']},'include':[{'model':db[_0x7b5e('0x40')],'as':_0x7b5e('0x41'),'raw':!![]}]})[_0x7b5e('0x22')](handleEntityNotFound(_0x2eb83d,null))[_0x7b5e('0x22')](function(_0x319298){if(_0x319298&&_0x319298['Smtp']){var _0x16db9={'id':_0x319298['id'],'tls':{'rejectUnauthorized':![]}};if(_0x319298[_0x7b5e('0x41')]['service']){_0x16db9['service']=_0x319298[_0x7b5e('0x41')][_0x7b5e('0x7a')];}else{_0x16db9[_0x7b5e('0x78')]=_0x319298[_0x7b5e('0x41')]['host'];_0x16db9[_0x7b5e('0x79')]=_0x319298[_0x7b5e('0x41')][_0x7b5e('0x79')];_0x16db9['secure']=_0x319298['Smtp'][_0x7b5e('0xa7')];}if(_0x319298[_0x7b5e('0x41')]['authentication']){_0x16db9[_0x7b5e('0xa6')]={'user':_0x319298[_0x7b5e('0x41')][_0x7b5e('0x73')],'pass':_0x319298[_0x7b5e('0x41')]['pass']};}return respondWithRpcPromise(_0x7b5e('0xb2'),'verifySmtp',{'account':_0x16db9});}})['then'](respondWithResult(_0x2eb83d,null))[_0x7b5e('0x2b')](handleError(_0x2eb83d,null));};exports[_0x7b5e('0x36')]=function(_0x1f807f,_0x5e5f03){return db[_0x7b5e('0x44')]['find']({'where':{'id':_0x1f807f[_0x7b5e('0x59')]['id']}})[_0x7b5e('0x22')](handleEntityNotFound(_0x5e5f03,null))[_0x7b5e('0x22')](function(_0x16396f){if(_0x16396f&&_0x16396f['service']){throw new db['Sequelize'][(_0x7b5e('0x1f'))](_0x7b5e('0xb3'));}return _0x16396f;})[_0x7b5e('0x22')](removeEntity(_0x5e5f03,null))['catch'](handleError(_0x5e5f03,null));};exports[_0x7b5e('0xb4')]=function(_0x39c5d0,_0x4d7bd1,_0x2affaf){return db['MailAccount'][_0x7b5e('0x5e')]({'where':{'id':_0x39c5d0[_0x7b5e('0x59')]['id']}})[_0x7b5e('0x22')](handleEntityNotFound(_0x4d7bd1,null))['then'](function(_0x5350ef){if(_0x5350ef){return _0x5350ef[_0x7b5e('0xb4')](_0x39c5d0['body'][_0x7b5e('0x67')],_[_0x7b5e('0x88')](_0x39c5d0[_0x7b5e('0x5d')],[_0x7b5e('0x67'),'id'])||{})[_0x7b5e('0xb5')](function(_0x452818){for(var _0x5ae609=0x0;_0x5ae609<_0x39c5d0[_0x7b5e('0x5d')][_0x7b5e('0x67')][_0x7b5e('0x4d')];_0x5ae609+=0x1){socket['emit']('userMailAccount:save',{'UserId':_0x39c5d0[_0x7b5e('0x5d')][_0x7b5e('0x67')][_0x5ae609],'MailAccountId':_0x39c5d0[_0x7b5e('0x59')]['id']});}return _0x452818;});}})[_0x7b5e('0x22')](respondWithResult(_0x4d7bd1,null))['catch'](handleError(_0x4d7bd1,null));};exports[_0x7b5e('0xb6')]=function(_0xa5e9ab,_0xacc11c,_0x3474dc){return db[_0x7b5e('0x44')]['find']({'where':{'id':_0xa5e9ab[_0x7b5e('0x59')]['id']}})[_0x7b5e('0x22')](handleEntityNotFound(_0xacc11c,null))[_0x7b5e('0x22')](function(_0x361259){if(_0x361259){return _0x361259[_0x7b5e('0xb6')](_0xa5e9ab[_0x7b5e('0x49')][_0x7b5e('0x67')])[_0x7b5e('0x22')](function(){if(_[_0x7b5e('0xb7')](_0xa5e9ab[_0x7b5e('0x49')][_0x7b5e('0x67')])){for(var _0x261139=0x0;_0x261139<_0xa5e9ab[_0x7b5e('0x49')][_0x7b5e('0x67')][_0x7b5e('0x4d')];_0x261139+=0x1){socket[_0x7b5e('0xb8')](_0x7b5e('0xb9'),{'UserId':Number(_0xa5e9ab[_0x7b5e('0x49')]['ids'][_0x261139]),'MailAccountId':Number(_0xa5e9ab[_0x7b5e('0x59')]['id'])});}}else{socket[_0x7b5e('0xb8')](_0x7b5e('0xb9'),{'UserId':Number(_0xa5e9ab['query'][_0x7b5e('0x67')]),'MailAccountId':Number(_0xa5e9ab[_0x7b5e('0x59')]['id'])});}});}})[_0x7b5e('0x22')](respondWithStatusCode(_0xacc11c,null))[_0x7b5e('0x2b')](handleError(_0xacc11c,null));};exports[_0x7b5e('0xba')]=function(_0x5c0ad9,_0x991f5e,_0x3c650a){var _0x7f1d67={};var _0x11924b={};var _0x46e4da;var _0x5e7267;return db[_0x7b5e('0x44')][_0x7b5e('0x64')]({'where':{'id':_0x5c0ad9['params']['id']}})[_0x7b5e('0x22')](handleEntityNotFound(_0x991f5e,null))[_0x7b5e('0x22')](function(_0x21db99){if(_0x21db99){_0x46e4da=_0x21db99;_0x11924b['model']=_['keys'](db['User'][_0x7b5e('0x5a')]);_0x11924b[_0x7b5e('0x49')]=_['keys'](_0x5c0ad9[_0x7b5e('0x49')]);_0x11924b[_0x7b5e('0x5b')]=_[_0x7b5e('0x4a')](_0x11924b[_0x7b5e('0x47')],_0x11924b[_0x7b5e('0x49')]);_0x7f1d67[_0x7b5e('0x4c')]=_['intersection'](_0x11924b['model'],qs[_0x7b5e('0x4b')](_0x5c0ad9[_0x7b5e('0x49')][_0x7b5e('0x4b')]));_0x7f1d67['attributes']=_0x7f1d67[_0x7b5e('0x4c')][_0x7b5e('0x4d')]?_0x7f1d67[_0x7b5e('0x4c')]:_0x11924b[_0x7b5e('0x47')];_0x7f1d67[_0x7b5e('0x65')]=qs[_0x7b5e('0x50')](_0x5c0ad9['query'][_0x7b5e('0x50')]);_0x7f1d67[_0x7b5e('0x51')]=qs[_0x7b5e('0x5b')](_[_0x7b5e('0x52')](_0x5c0ad9[_0x7b5e('0x49')],_0x11924b['filters']));if(_0x5c0ad9['query']['filter']){_0x7f1d67[_0x7b5e('0x51')]=_['merge'](_0x7f1d67[_0x7b5e('0x51')],{'$or':_[_0x7b5e('0x43')](_0x7f1d67[_0x7b5e('0x4c')],function(_0x3f12a3){var _0x429b95={};_0x429b95[_0x3f12a3]={'$like':'%'+_0x5c0ad9[_0x7b5e('0x49')][_0x7b5e('0x53')]+'%'};return _0x429b95;})});}_0x7f1d67=_[_0x7b5e('0x55')]({},_0x7f1d67,_0x5c0ad9['options']);return _0x46e4da['getAgents'](_0x7f1d67);}})['then'](function(_0x59919d){if(_0x59919d){_0x5e7267=_0x59919d['length'];if(!_0x5c0ad9[_0x7b5e('0x49')][_0x7b5e('0x4e')]('nolimit')){_0x7f1d67[_0x7b5e('0x30')]=qs[_0x7b5e('0x30')](_0x5c0ad9[_0x7b5e('0x49')][_0x7b5e('0x30')]);_0x7f1d67[_0x7b5e('0x2f')]=qs['offset'](_0x5c0ad9[_0x7b5e('0x49')]['offset']);}return _0x46e4da[_0x7b5e('0xba')](_0x7f1d67);}})[_0x7b5e('0x22')](function(_0x42fd32){if(_0x42fd32){return _0x42fd32?{'count':_0x5e7267,'rows':_0x42fd32}:null;}})[_0x7b5e('0x22')](respondWithResult(_0x991f5e,null))[_0x7b5e('0x2b')](handleError(_0x991f5e,null));}; \ No newline at end of file +var _0x5bf6=['index','MailServerIn','Imap','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','include','findAll','rows','show','params','Smtp','includeAll','options','update','body','find','describe','create','getDispositions','findOne','MailAccountId','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','cservice','cauthentication','user','password','pass','cpassword','authentication','host','port','service','cuser','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','User','Owner','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','List','updatedAt','DESC','from','format','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','secure','auth','SendMail','sendMail','Contacts','List\x20not\x20found','subject','attach','out','messageId','Interaction','verifySmtp','addAgents','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','localhost','socket.io-emitter','./mailAccount.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~!@#$%^&-_=+[{]}.','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','destroy','get','UserProfileResource','stack','name','send'];(function(_0xd204b0,_0x4c7d1d){var _0xfc8310=function(_0x4f4b5a){while(--_0x4f4b5a){_0xd204b0['push'](_0xd204b0['shift']());}};_0xfc8310(++_0x4c7d1d);}(_0x5bf6,0x143));var _0x65bf=function(_0x2ffc46,_0x35ce3c){_0x2ffc46=_0x2ffc46-0x0;var _0x1eda8f=_0x5bf6[_0x2ffc46];return _0x1eda8f;};'use strict';var pdf=require(_0x65bf('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x65bf('0x1'));var jsonpatch=require(_0x65bf('0x2'));var rp=require(_0x65bf('0x3'));var moment=require(_0x65bf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x65bf('0x5'));var util=require(_0x65bf('0x6'));var path=require(_0x65bf('0x7'));var sox=require(_0x65bf('0x8'));var csv=require(_0x65bf('0x9'));var ejs=require(_0x65bf('0xa'));var fs=require('fs');var _=require(_0x65bf('0xb'));var squel=require(_0x65bf('0xc'));var crypto=require(_0x65bf('0xd'));var jsforce=require(_0x65bf('0xe'));var deskjs=require(_0x65bf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x65bf('0x10'));var Papa=require(_0x65bf('0x11'));var Redis=require(_0x65bf('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x65bf('0x13'));var as=require(_0x65bf('0x14'));var hardwareService=require(_0x65bf('0x15'));var logger=require(_0x65bf('0x16'))(_0x65bf('0x17'));var utils=require(_0x65bf('0x18'));var config=require('../../config/environment');var db=require(_0x65bf('0x19'))['db'];config['redis']=_[_0x65bf('0x1a')](config['redis'],{'host':_0x65bf('0x1b'),'port':0x18eb});var socket=require(_0x65bf('0x1c'))(new Redis(config['redis']));require(_0x65bf('0x1d'))['register'](socket);var jayson=require(_0x65bf('0x1e'));var client=jayson[_0x65bf('0x1f')][_0x65bf('0x20')]({'port':0x232b});function checkPasswordPattern(_0x150c86,_0x1e5c5b,_0x228f9c){if(_0x228f9c){var _0x377610=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x377610[_0x65bf('0x21')](_0x1e5c5b)){return _0x150c86;}else{throw new db[(_0x65bf('0x22'))][(_0x65bf('0x23'))](_0x65bf('0x24'));}}else{return _0x150c86;}}function respondWithRpcPromise(_0x13f299,_0x560d31,_0x4219cb,_0x13981f){return new BPromise(function(_0x1375ba,_0x20d9fe){var _0x2b2d5e=_0x13981f||client;return _0x2b2d5e[_0x65bf('0x25')](_0x13f299,_0x4219cb)[_0x65bf('0x26')](function(_0x494b7c){logger[_0x65bf('0x27')](_0x65bf('0x28'),_0x560d31,_0x65bf('0x29'));logger[_0x65bf('0x2a')](_0x65bf('0x2b'),_0x560d31,_0x65bf('0x29'),JSON[_0x65bf('0x2c')](_0x494b7c));if(_0x494b7c[_0x65bf('0x2d')]){if(_0x494b7c[_0x65bf('0x2d')]['code']===0x1f4){logger[_0x65bf('0x2d')](_0x65bf('0x28'),_0x560d31,_0x494b7c['error'][_0x65bf('0x2e')]);return _0x20d9fe(_0x494b7c[_0x65bf('0x2d')][_0x65bf('0x2e')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x560d31,_0x494b7c[_0x65bf('0x2d')][_0x65bf('0x2e')]);return _0x1375ba(_0x494b7c[_0x65bf('0x2d')]['message']);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x560d31,_0x65bf('0x29'));_0x1375ba(_0x494b7c[_0x65bf('0x2f')][_0x65bf('0x2e')]);}})[_0x65bf('0x30')](function(_0x415f3f){logger[_0x65bf('0x2d')]('MailAccount,\x20%s,\x20%s',_0x560d31,_0x415f3f);_0x20d9fe(_0x415f3f);});});}function respondWithStatusCode(_0x2c81a9,_0x1a6719){_0x1a6719=_0x1a6719||0xcc;return function(_0x37e685){if(_0x37e685){return _0x2c81a9[_0x65bf('0x31')](_0x1a6719);}return _0x2c81a9[_0x65bf('0x32')](_0x1a6719)[_0x65bf('0x33')]();};}function respondWithResult(_0x15e84d,_0x58bb1c){_0x58bb1c=_0x58bb1c||0xc8;return function(_0x123d03){if(_0x123d03){return _0x15e84d['status'](_0x58bb1c)[_0x65bf('0x34')](_0x123d03);}};}function respondWithFilteredResult(_0x564334,_0x386d63){return function(_0x372e3b){if(_0x372e3b){var _0x13ec70=_0x372e3b[_0x65bf('0x35')],_0x164119=_0x386d63['offset'],_0xa6eb24=_0x386d63[_0x65bf('0x36')]+_0x386d63[_0x65bf('0x37')],_0x162d97;if(_0xa6eb24>=_0x13ec70){_0xa6eb24=_0x13ec70;_0x162d97=0xc8;}else{_0x162d97=0xce;}_0x564334[_0x65bf('0x32')](_0x162d97);return _0x564334[_0x65bf('0x38')](_0x65bf('0x39'),_0x164119+'-'+_0xa6eb24+'/'+_0x13ec70)[_0x65bf('0x34')](_0x372e3b);}return null;};}function patchUpdates(_0x8ae04a){return function(_0x50465a){try{jsonpatch['apply'](_0x50465a,_0x8ae04a,!![]);}catch(_0x167368){return BPromise['reject'](_0x167368);}return _0x50465a[_0x65bf('0x3a')]();};}function saveUpdates(_0x1bd0d2,_0x575931){return function(_0x10698d){if(_0x10698d){return _0x10698d['update'](_0x1bd0d2)[_0x65bf('0x26')](function(_0x20984e){return _0x20984e;});}return null;};}function removeEntity(_0x4bd41a,_0x391669){return function(_0x90f35c){if(_0x90f35c){return _0x90f35c[_0x65bf('0x3b')]()[_0x65bf('0x26')](function(){var _0x591432=_0x90f35c[_0x65bf('0x3c')]({'plain':!![]});var _0x5f130e='MailAccounts';return db[_0x65bf('0x3d')][_0x65bf('0x3b')]({'where':{'type':_0x5f130e,'resourceId':_0x591432['id']}})[_0x65bf('0x26')](function(){return _0x90f35c;});})[_0x65bf('0x26')](function(){_0x4bd41a['status'](0xcc)[_0x65bf('0x33')]();});}};}function handleEntityNotFound(_0x41b604,_0x4bd7ca){return function(_0x5379eb){if(!_0x5379eb){_0x41b604[_0x65bf('0x31')](0x194);}return _0x5379eb;};}function handleError(_0x578caa,_0x42c6ad){_0x42c6ad=_0x42c6ad||0x1f4;return function(_0xb31a56){logger[_0x65bf('0x2d')](_0xb31a56[_0x65bf('0x3e')]);if(_0xb31a56[_0x65bf('0x3f')]){delete _0xb31a56[_0x65bf('0x3f')];}_0x578caa[_0x65bf('0x32')](_0x42c6ad)[_0x65bf('0x40')](_0xb31a56);};}exports[_0x65bf('0x41')]=function(_0x3e17dd,_0x196221){var _0x15b974={'include':[{'model':db[_0x65bf('0x42')],'as':_0x65bf('0x43')},{'model':db[_0x65bf('0x44')],'as':'Smtp'},{'model':db[_0x65bf('0x45')],'as':_0x65bf('0x46')}]},_0x24c2da={},_0x4f9733={'count':0x0,'rows':[]};var _0x12693c=_['map'](db[_0x65bf('0x47')][_0x65bf('0x48')],function(_0x2eebfa){return{'name':_0x2eebfa[_0x65bf('0x49')],'type':_0x2eebfa[_0x65bf('0x4a')][_0x65bf('0x4b')]};});_0x24c2da['model']=_['map'](_0x12693c,'name');_0x24c2da[_0x65bf('0x4c')]=_[_0x65bf('0x4d')](_0x3e17dd[_0x65bf('0x4c')]);_0x24c2da[_0x65bf('0x4e')]=_[_0x65bf('0x4f')](_0x24c2da['model'],_0x24c2da[_0x65bf('0x4c')]);_0x15b974['attributes']=_[_0x65bf('0x4f')](_0x24c2da[_0x65bf('0x50')],qs[_0x65bf('0x51')](_0x3e17dd['query'][_0x65bf('0x51')]));_0x15b974[_0x65bf('0x52')]=_0x15b974['attributes'][_0x65bf('0x53')]?_0x15b974['attributes']:_0x24c2da['model'];if(!_0x3e17dd[_0x65bf('0x4c')][_0x65bf('0x54')](_0x65bf('0x55'))){_0x15b974['limit']=qs[_0x65bf('0x37')](_0x3e17dd[_0x65bf('0x4c')][_0x65bf('0x37')]);_0x15b974['offset']=qs['offset'](_0x3e17dd['query'][_0x65bf('0x36')]);}_0x15b974[_0x65bf('0x56')]=qs[_0x65bf('0x57')](_0x3e17dd[_0x65bf('0x4c')][_0x65bf('0x57')]);_0x15b974['where']=qs[_0x65bf('0x4e')](_[_0x65bf('0x58')](_0x3e17dd[_0x65bf('0x4c')],_0x24c2da[_0x65bf('0x4e')]));if(_0x3e17dd['query'][_0x65bf('0x59')]){_0x15b974[_0x65bf('0x5a')]=_[_0x65bf('0x5b')](_0x15b974[_0x65bf('0x5a')],{'$or':_[_0x65bf('0x5c')](_0x12693c,function(_0x1b2ec6){if(_0x1b2ec6[_0x65bf('0x4a')]!==_0x65bf('0x5d')){var _0x1931da={};_0x1931da[_0x1b2ec6[_0x65bf('0x3f')]]={'$like':'%'+_0x3e17dd['query'][_0x65bf('0x59')]+'%'};return _0x1931da;}})});}_0x15b974=_[_0x65bf('0x5b')]({},_0x15b974,_0x3e17dd['options']);var _0x33c4df={'where':_0x15b974[_0x65bf('0x5a')]};return db[_0x65bf('0x47')][_0x65bf('0x35')](_0x33c4df)[_0x65bf('0x26')](function(_0xf66479){_0x4f9733[_0x65bf('0x35')]=_0xf66479;if(_0x3e17dd[_0x65bf('0x4c')]['includeAll']){_0x15b974[_0x65bf('0x5e')]=[{'all':!![]}];}return db[_0x65bf('0x47')][_0x65bf('0x5f')](_0x15b974);})[_0x65bf('0x26')](function(_0x3ba355){_0x4f9733[_0x65bf('0x60')]=_0x3ba355;return _0x4f9733;})[_0x65bf('0x26')](respondWithFilteredResult(_0x196221,_0x15b974))[_0x65bf('0x30')](handleError(_0x196221,null));};exports[_0x65bf('0x61')]=function(_0x14b37d,_0x1d8b3a){var _0x4672f8={'raw':![],'where':{'id':_0x14b37d[_0x65bf('0x62')]['id']},'include':[{'model':db[_0x65bf('0x42')],'as':'Imap'},{'model':db[_0x65bf('0x44')],'as':_0x65bf('0x63')},{'model':db['Pause'],'as':_0x65bf('0x46')}]},_0x115d38={};_0x115d38[_0x65bf('0x50')]=_[_0x65bf('0x4d')](db['MailAccount'][_0x65bf('0x48')]);_0x115d38[_0x65bf('0x4c')]=_[_0x65bf('0x4d')](_0x14b37d[_0x65bf('0x4c')]);_0x115d38[_0x65bf('0x4e')]=_[_0x65bf('0x4f')](_0x115d38[_0x65bf('0x50')],_0x115d38[_0x65bf('0x4c')]);_0x4672f8[_0x65bf('0x52')]=_[_0x65bf('0x4f')](_0x115d38[_0x65bf('0x50')],qs[_0x65bf('0x51')](_0x14b37d[_0x65bf('0x4c')][_0x65bf('0x51')]));_0x4672f8['attributes']=_0x4672f8['attributes']['length']?_0x4672f8[_0x65bf('0x52')]:_0x115d38[_0x65bf('0x50')];if(_0x14b37d[_0x65bf('0x4c')][_0x65bf('0x64')]){_0x4672f8[_0x65bf('0x5e')]=[{'all':!![]}];}_0x4672f8=_[_0x65bf('0x5b')]({},_0x4672f8,_0x14b37d[_0x65bf('0x65')]);return db['MailAccount']['find'](_0x4672f8)['then'](handleEntityNotFound(_0x1d8b3a,null))['then'](respondWithResult(_0x1d8b3a,null))[_0x65bf('0x30')](handleError(_0x1d8b3a,null));};exports[_0x65bf('0x66')]=function(_0x2c79e6,_0xf94c66){if(_0x2c79e6[_0x65bf('0x67')]['id']){delete _0x2c79e6['body']['id'];}return db[_0x65bf('0x47')][_0x65bf('0x68')]({'where':{'id':_0x2c79e6[_0x65bf('0x62')]['id']},'include':[{'model':db[_0x65bf('0x42')],'as':_0x65bf('0x43')},{'model':db[_0x65bf('0x44')],'as':'Smtp'},{'model':db[_0x65bf('0x45')],'as':_0x65bf('0x46')}]})[_0x65bf('0x26')](handleEntityNotFound(_0xf94c66,null))['then'](saveUpdates(_0x2c79e6['body'],null))[_0x65bf('0x26')](function(_0x14e360){if(_0x14e360&&_0x2c79e6[_0x65bf('0x67')]['Imap']){return db[_0x65bf('0x42')]['update'](_0x2c79e6[_0x65bf('0x67')]['Imap'],{'where':{'MailAccountId':_0x14e360['id']}})[_0x65bf('0x26')](function(){return _0x14e360;});}return _0x14e360;})[_0x65bf('0x26')](function(_0x4ddf49){if(_0x4ddf49&&_0x2c79e6[_0x65bf('0x67')][_0x65bf('0x63')]){return db['MailServerOut'][_0x65bf('0x66')](_0x2c79e6[_0x65bf('0x67')][_0x65bf('0x63')],{'where':{'MailAccountId':_0x4ddf49['id']}})[_0x65bf('0x26')](function(){return _0x4ddf49;});}return _0x4ddf49;})[_0x65bf('0x26')](respondWithResult(_0xf94c66,null))[_0x65bf('0x30')](handleError(_0xf94c66,null));};exports[_0x65bf('0x69')]=function(_0x5517e9,_0x22cf0a){return db[_0x65bf('0x47')]['describe']()[_0x65bf('0x26')](respondWithResult(_0x22cf0a,null))[_0x65bf('0x30')](handleError(_0x22cf0a,null));};exports['addDisposition']=function(_0x1bd36a,_0x5daef7,_0x53a081){if(_0x1bd36a['body']['id']){delete _0x1bd36a[_0x65bf('0x67')]['id'];}return db[_0x65bf('0x47')][_0x65bf('0x68')]({'where':{'id':_0x1bd36a[_0x65bf('0x62')]['id']}})[_0x65bf('0x26')](handleEntityNotFound(_0x5daef7,null))['then'](function(_0x3d8cee){if(_0x3d8cee){_0x1bd36a[_0x65bf('0x67')]['MailAccountId']=_0x3d8cee['id'];return db['Disposition'][_0x65bf('0x6a')](_0x1bd36a['body']);}})[_0x65bf('0x26')](respondWithResult(_0x5daef7,null))['catch'](handleError(_0x5daef7,null));};exports[_0x65bf('0x6b')]=function(_0x25b1e5,_0x147df3,_0x222638){var _0x2bf968={'raw':![],'where':{}};var _0x17e2cd={};var _0x32ce5c={'count':0x0,'rows':[]};return db[_0x65bf('0x47')][_0x65bf('0x6c')]({'where':{'id':_0x25b1e5[_0x65bf('0x62')]['id']}})['then'](handleEntityNotFound(_0x147df3,null))['then'](function(_0x4620d7){if(_0x4620d7){_0x17e2cd['model']=_['keys'](db['Disposition'][_0x65bf('0x48')]);_0x17e2cd[_0x65bf('0x4c')]=_['keys'](_0x25b1e5['query']);_0x17e2cd[_0x65bf('0x4e')]=_[_0x65bf('0x4f')](_0x17e2cd[_0x65bf('0x50')],_0x17e2cd[_0x65bf('0x4c')]);_0x2bf968[_0x65bf('0x52')]=_['intersection'](_0x17e2cd[_0x65bf('0x50')],qs[_0x65bf('0x51')](_0x25b1e5['query'][_0x65bf('0x51')]));_0x2bf968[_0x65bf('0x52')]=_0x2bf968[_0x65bf('0x52')][_0x65bf('0x53')]?_0x2bf968[_0x65bf('0x52')]:_0x17e2cd['model'];if(!_0x25b1e5[_0x65bf('0x4c')][_0x65bf('0x54')](_0x65bf('0x55'))){_0x2bf968[_0x65bf('0x37')]=qs['limit'](_0x25b1e5['query'][_0x65bf('0x37')]);_0x2bf968[_0x65bf('0x36')]=qs[_0x65bf('0x36')](_0x25b1e5['query']['offset']);}_0x2bf968[_0x65bf('0x56')]=qs[_0x65bf('0x57')](_0x25b1e5[_0x65bf('0x4c')][_0x65bf('0x57')]);_0x2bf968[_0x65bf('0x5a')]=qs[_0x65bf('0x4e')](_[_0x65bf('0x58')](_0x25b1e5[_0x65bf('0x4c')],_0x17e2cd[_0x65bf('0x4e')]));_0x2bf968['where'][_0x65bf('0x6d')]=_0x4620d7['id'];if(_0x25b1e5[_0x65bf('0x4c')][_0x65bf('0x59')]){_0x2bf968['where']=_[_0x65bf('0x5b')](_0x2bf968[_0x65bf('0x5a')],{'$or':_[_0x65bf('0x5c')](_0x2bf968[_0x65bf('0x52')],function(_0x231c79){var _0x156e25={};_0x156e25[_0x231c79]={'$like':'%'+_0x25b1e5[_0x65bf('0x4c')]['filter']+'%'};return _0x156e25;})});}_0x2bf968=_[_0x65bf('0x5b')]({},_0x2bf968,_0x25b1e5[_0x65bf('0x65')]);return db[_0x65bf('0x6e')][_0x65bf('0x35')]({'where':_0x2bf968[_0x65bf('0x5a')]})[_0x65bf('0x26')](function(_0x13d325){_0x32ce5c[_0x65bf('0x35')]=_0x13d325;if(_0x25b1e5[_0x65bf('0x4c')][_0x65bf('0x64')]){_0x2bf968[_0x65bf('0x5e')]=[{'all':!![]}];}return db[_0x65bf('0x6e')][_0x65bf('0x5f')](_0x2bf968);})[_0x65bf('0x26')](function(_0x4a826a){_0x32ce5c[_0x65bf('0x60')]=_0x4a826a;return _0x32ce5c;});}})[_0x65bf('0x26')](respondWithFilteredResult(_0x147df3,_0x2bf968))['catch'](handleError(_0x147df3,null));};exports[_0x65bf('0x6f')]=function(_0x2d300a,_0x30083f,_0x190cd3){return db[_0x65bf('0x47')][_0x65bf('0x68')]({'where':{'id':_0x2d300a[_0x65bf('0x62')]['id']}})[_0x65bf('0x26')](handleEntityNotFound(_0x30083f,null))[_0x65bf('0x26')](function(_0x2b5bef){if(_0x2b5bef){return _0x2b5bef[_0x65bf('0x6f')](_0x2d300a[_0x65bf('0x4c')][_0x65bf('0x70')]);}})['then'](respondWithStatusCode(_0x30083f,null))[_0x65bf('0x30')](handleError(_0x30083f,null));};exports['addAnswer']=function(_0x56bb68,_0x1eaea0,_0x5ea35d){if(_0x56bb68[_0x65bf('0x67')]['id']){delete _0x56bb68[_0x65bf('0x67')]['id'];}return db[_0x65bf('0x47')]['find']({'where':{'id':_0x56bb68['params']['id']}})[_0x65bf('0x26')](handleEntityNotFound(_0x1eaea0,null))['then'](function(_0x23a950){if(_0x23a950){_0x56bb68[_0x65bf('0x67')][_0x65bf('0x6d')]=_0x23a950['id'];return db[_0x65bf('0x71')]['create'](_0x56bb68[_0x65bf('0x67')]);}})[_0x65bf('0x26')](respondWithResult(_0x1eaea0,null))['catch'](handleError(_0x1eaea0,null));};exports[_0x65bf('0x72')]=function(_0x21e85e,_0x546ed4,_0xf45b00){var _0xdc59dc={'raw':![],'where':{}};var _0x27c5bc={};var _0x45fc7f={'count':0x0,'rows':[]};return db[_0x65bf('0x47')][_0x65bf('0x6c')]({'where':{'id':_0x21e85e['params']['id']}})[_0x65bf('0x26')](handleEntityNotFound(_0x546ed4,null))[_0x65bf('0x26')](function(_0x2067fa){if(_0x2067fa){_0x27c5bc['model']=_['keys'](db['CannedAnswer'][_0x65bf('0x48')]);_0x27c5bc[_0x65bf('0x4c')]=_[_0x65bf('0x4d')](_0x21e85e[_0x65bf('0x4c')]);_0x27c5bc['filters']=_['intersection'](_0x27c5bc[_0x65bf('0x50')],_0x27c5bc[_0x65bf('0x4c')]);_0xdc59dc[_0x65bf('0x52')]=_[_0x65bf('0x4f')](_0x27c5bc['model'],qs[_0x65bf('0x51')](_0x21e85e['query'][_0x65bf('0x51')]));_0xdc59dc[_0x65bf('0x52')]=_0xdc59dc['attributes']['length']?_0xdc59dc[_0x65bf('0x52')]:_0x27c5bc[_0x65bf('0x50')];if(!_0x21e85e[_0x65bf('0x4c')][_0x65bf('0x54')]('nolimit')){_0xdc59dc['limit']=qs['limit'](_0x21e85e[_0x65bf('0x4c')][_0x65bf('0x37')]);_0xdc59dc['offset']=qs[_0x65bf('0x36')](_0x21e85e[_0x65bf('0x4c')][_0x65bf('0x36')]);}_0xdc59dc[_0x65bf('0x56')]=qs[_0x65bf('0x57')](_0x21e85e[_0x65bf('0x4c')][_0x65bf('0x57')]);_0xdc59dc[_0x65bf('0x5a')]=qs[_0x65bf('0x4e')](_[_0x65bf('0x58')](_0x21e85e[_0x65bf('0x4c')],_0x27c5bc[_0x65bf('0x4e')]));_0xdc59dc[_0x65bf('0x5a')]['MailAccountId']=_0x2067fa['id'];if(_0x21e85e['query'][_0x65bf('0x59')]){_0xdc59dc['where']=_['merge'](_0xdc59dc[_0x65bf('0x5a')],{'$or':_['map'](_0xdc59dc[_0x65bf('0x52')],function(_0x3f6a0c){var _0x46b8aa={};_0x46b8aa[_0x3f6a0c]={'$like':'%'+_0x21e85e[_0x65bf('0x4c')][_0x65bf('0x59')]+'%'};return _0x46b8aa;})});}_0xdc59dc=_['merge']({},_0xdc59dc,_0x21e85e[_0x65bf('0x65')]);return db['CannedAnswer'][_0x65bf('0x35')]({'where':_0xdc59dc[_0x65bf('0x5a')]})['then'](function(_0x3e1ca6){_0x45fc7f['count']=_0x3e1ca6;if(_0x21e85e[_0x65bf('0x4c')][_0x65bf('0x64')]){_0xdc59dc[_0x65bf('0x5e')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0xdc59dc);})['then'](function(_0x375ada){_0x45fc7f[_0x65bf('0x60')]=_0x375ada;return _0x45fc7f;});}})[_0x65bf('0x26')](respondWithFilteredResult(_0x546ed4,_0xdc59dc))[_0x65bf('0x30')](handleError(_0x546ed4,null));};exports['removeAnswers']=function(_0xebe117,_0x526db3,_0x73fd4){return db[_0x65bf('0x47')][_0x65bf('0x68')]({'where':{'id':_0xebe117[_0x65bf('0x62')]['id']}})[_0x65bf('0x26')](handleEntityNotFound(_0x526db3,null))[_0x65bf('0x26')](function(_0x5df928){if(_0x5df928){return _0x5df928[_0x65bf('0x73')](_0xebe117[_0x65bf('0x4c')][_0x65bf('0x70')]);}})['then'](respondWithStatusCode(_0x526db3,null))['catch'](handleError(_0x526db3,null));};exports[_0x65bf('0x6a')]=function(_0x2e87fd,_0x40118e){var _0x40dc8f={'name':_0x2e87fd[_0x65bf('0x67')]['name'],'key':_0x2e87fd[_0x65bf('0x67')]['key'],'email':_0x2e87fd[_0x65bf('0x67')][_0x65bf('0x74')],'ListId':_0x2e87fd[_0x65bf('0x67')][_0x65bf('0x75')],'active':!_[_0x65bf('0x76')](_0x2e87fd[_0x65bf('0x67')][_0x65bf('0x77')])?_0x2e87fd[_0x65bf('0x67')][_0x65bf('0x77')]:!![],'description':_0x2e87fd[_0x65bf('0x67')][_0x65bf('0x78')]||null,'Imap':{},'Smtp':{}};if(_[_0x65bf('0x76')](_0x2e87fd[_0x65bf('0x67')][_0x65bf('0x79')])){if(_0x2e87fd[_0x65bf('0x67')][_0x65bf('0x7a')]){_0x40dc8f[_0x65bf('0x43')][_0x65bf('0x7b')]=_0x40dc8f[_0x65bf('0x63')][_0x65bf('0x7b')]=_0x2e87fd[_0x65bf('0x67')]['cuser'];_0x40dc8f['Imap'][_0x65bf('0x7c')]=_0x40dc8f[_0x65bf('0x63')][_0x65bf('0x7d')]=_0x2e87fd[_0x65bf('0x67')][_0x65bf('0x7e')];}else{_0x40dc8f[_0x65bf('0x43')][_0x65bf('0x7f')]=_0x40dc8f['Smtp']['authentication']=![];}_0x40dc8f[_0x65bf('0x43')][_0x65bf('0x80')]=_0x2e87fd[_0x65bf('0x67')][_0x65bf('0x43')][_0x65bf('0x80')];_0x40dc8f[_0x65bf('0x43')][_0x65bf('0x81')]=_0x2e87fd[_0x65bf('0x67')][_0x65bf('0x43')]['port'];_0x40dc8f[_0x65bf('0x63')]['host']=_0x2e87fd[_0x65bf('0x67')][_0x65bf('0x63')]['host'];_0x40dc8f['Smtp'][_0x65bf('0x81')]=_0x2e87fd[_0x65bf('0x67')][_0x65bf('0x63')][_0x65bf('0x81')];}else{_0x40dc8f[_0x65bf('0x43')][_0x65bf('0x82')]=_0x40dc8f[_0x65bf('0x63')][_0x65bf('0x82')]=_0x2e87fd[_0x65bf('0x67')]['cservice'];_0x40dc8f[_0x65bf('0x43')][_0x65bf('0x7b')]=_0x40dc8f[_0x65bf('0x63')]['user']=_0x2e87fd[_0x65bf('0x67')][_0x65bf('0x83')];_0x40dc8f['Imap'][_0x65bf('0x7c')]=_0x40dc8f[_0x65bf('0x63')]['pass']=_0x2e87fd[_0x65bf('0x67')][_0x65bf('0x7e')];}return db['MailAccount'][_0x65bf('0x6a')](_0x40dc8f,{'include':[{'model':db['MailServerOut'],'as':_0x65bf('0x63')},{'model':db['MailServerIn'],'as':_0x65bf('0x43')}]})[_0x65bf('0x26')](function(_0x57b8eb){var _0xac0c19=_0x2e87fd[_0x65bf('0x7b')][_0x65bf('0x3c')]({'plain':!![]});if(!_0xac0c19)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xac0c19[_0x65bf('0x84')]===_0x65bf('0x7b')){var _0x33a548=_0x57b8eb[_0x65bf('0x3c')]({'plain':!![]});return db[_0x65bf('0x85')][_0x65bf('0x68')]({'where':{'name':'MailAccounts','userProfileId':_0xac0c19[_0x65bf('0x86')]},'raw':!![]})[_0x65bf('0x26')](function(_0x517c57){if(_0x517c57&&_0x517c57[_0x65bf('0x87')]===0x0){return db[_0x65bf('0x3d')][_0x65bf('0x6a')]({'name':_0x33a548[_0x65bf('0x3f')],'resourceId':_0x33a548['id'],'type':_0x517c57[_0x65bf('0x3f')],'sectionId':_0x517c57['id']},{})[_0x65bf('0x26')](function(){return _0x57b8eb;});}else{return _0x57b8eb;}})['catch'](function(_0x2f26d4){logger[_0x65bf('0x2d')](_0x65bf('0x88'),_0x2f26d4);throw _0x2f26d4;});}return _0x57b8eb;})['then'](respondWithResult(_0x40118e,0xc9))['catch'](handleError(_0x40118e,null));};exports['getImap']=function(_0x19384f,_0x13002b,_0x375323){return db[_0x65bf('0x47')][_0x65bf('0x6c')]({'where':{'id':_0x19384f[_0x65bf('0x62')]['id']}})[_0x65bf('0x26')](handleEntityNotFound(_0x13002b,null))[_0x65bf('0x26')](function(_0x577ef4){if(_0x577ef4){return _0x577ef4[_0x65bf('0x89')]();}return null;})[_0x65bf('0x26')](respondWithResult(_0x13002b,null))[_0x65bf('0x30')](handleError(_0x13002b,null));};exports[_0x65bf('0x8a')]=function(_0x10ce34,_0x19202b,_0x1cd802){if(_0x10ce34[_0x65bf('0x67')]['id']){delete _0x10ce34[_0x65bf('0x67')]['id'];}return db[_0x65bf('0x47')]['find']({'where':{'id':_0x10ce34[_0x65bf('0x62')]['id']}})[_0x65bf('0x26')](handleEntityNotFound(_0x19202b,null))[_0x65bf('0x26')](function(_0x456a0a){if(_0x456a0a){_0x10ce34[_0x65bf('0x67')][_0x65bf('0x6d')]=_0x456a0a['id'];return db[_0x65bf('0x42')][_0x65bf('0x6a')](_0x10ce34['body']);}})[_0x65bf('0x26')](respondWithResult(_0x19202b,null))[_0x65bf('0x30')](handleError(_0x19202b,null));};exports[_0x65bf('0x8b')]=function(_0x3b4bba,_0x4b91ec,_0x3e1741){return db['MailAccount']['findOne']({'where':{'id':_0x3b4bba[_0x65bf('0x62')]['id']}})[_0x65bf('0x26')](handleEntityNotFound(_0x4b91ec,null))[_0x65bf('0x26')](function(_0x3f369e){if(_0x3f369e){return _0x3f369e['setImap'](null);}return null;})[_0x65bf('0x26')](respondWithStatusCode(_0x4b91ec,null))[_0x65bf('0x30')](handleError(_0x4b91ec,null));};exports['getSmtp']=function(_0x18236c,_0x24dc54,_0x3db650){return db[_0x65bf('0x47')][_0x65bf('0x6c')]({'where':{'id':_0x18236c[_0x65bf('0x62')]['id']}})[_0x65bf('0x26')](handleEntityNotFound(_0x24dc54,null))[_0x65bf('0x26')](function(_0x5e8e89){if(_0x5e8e89){return _0x5e8e89['getSmtp']();}return null;})[_0x65bf('0x26')](respondWithResult(_0x24dc54,null))[_0x65bf('0x30')](handleError(_0x24dc54,null));};exports['addSmtp']=function(_0x8f7187,_0x19ed51,_0x508d3c){if(_0x8f7187[_0x65bf('0x67')]['id']){delete _0x8f7187[_0x65bf('0x67')]['id'];}return db[_0x65bf('0x47')][_0x65bf('0x68')]({'where':{'id':_0x8f7187[_0x65bf('0x62')]['id']}})['then'](handleEntityNotFound(_0x19ed51,null))['then'](function(_0x7cca93){if(_0x7cca93){_0x8f7187[_0x65bf('0x67')][_0x65bf('0x6d')]=_0x7cca93['id'];return db[_0x65bf('0x44')]['create'](_0x8f7187['body']);}})[_0x65bf('0x26')](respondWithResult(_0x19ed51,null))['catch'](handleError(_0x19ed51,null));};exports[_0x65bf('0x8c')]=function(_0x36d220,_0x29c555,_0x1fa6ed){return db[_0x65bf('0x47')][_0x65bf('0x6c')]({'where':{'id':_0x36d220[_0x65bf('0x62')]['id']}})[_0x65bf('0x26')](handleEntityNotFound(_0x29c555,null))[_0x65bf('0x26')](function(_0x9c5e88){if(_0x9c5e88){return _0x9c5e88[_0x65bf('0x8d')](null);}return null;})['then'](respondWithStatusCode(_0x29c555,null))[_0x65bf('0x30')](handleError(_0x29c555,null));};exports[_0x65bf('0x8e')]=function(_0x115965,_0x527f3e,_0x54ee41){return db[_0x65bf('0x8f')][_0x65bf('0x68')]({'where':{'id':_0x115965[_0x65bf('0x62')]['id']}})[_0x65bf('0x26')](handleEntityNotFound(_0x527f3e,null))[_0x65bf('0x26')](function(_0x2977b9){if(_0x2977b9){return _0x2977b9[_0x65bf('0x8e')](_0x115965[_0x65bf('0x67')][_0x65bf('0x70')],_[_0x65bf('0x90')](_0x115965[_0x65bf('0x67')],[_0x65bf('0x70'),'id'])||{});}})[_0x65bf('0x26')](respondWithResult(_0x527f3e,null))[_0x65bf('0x30')](handleError(_0x527f3e,null));};exports['getInteractions']=function(_0xa8fdec,_0x56e8a9,_0x4c1a6e){var _0x4ae831={'raw':![],'where':{}};var _0x3289ce={};var _0x2a8663={'count':0x0,'rows':[]};return db[_0x65bf('0x47')][_0x65bf('0x6c')]({'where':{'id':_0xa8fdec[_0x65bf('0x62')]['id']}})[_0x65bf('0x26')](handleEntityNotFound(_0x56e8a9,null))['then'](function(_0x80c850){if(_0x80c850){_0x3289ce[_0x65bf('0x50')]=_['keys'](db[_0x65bf('0x8f')][_0x65bf('0x48')]);_0x3289ce[_0x65bf('0x4c')]=_[_0x65bf('0x4d')](_0xa8fdec[_0x65bf('0x4c')]);_0x3289ce[_0x65bf('0x4e')]=_['intersection'](_0x3289ce['model'],_0x3289ce['query']);_0x4ae831[_0x65bf('0x52')]=_['intersection'](_0x3289ce['model'],qs[_0x65bf('0x51')](_0xa8fdec[_0x65bf('0x4c')][_0x65bf('0x51')]));_0x4ae831['attributes']=_0x4ae831[_0x65bf('0x52')]['length']?_0x4ae831['attributes']:_0x3289ce[_0x65bf('0x50')];if(!_0xa8fdec[_0x65bf('0x4c')][_0x65bf('0x54')](_0x65bf('0x55'))){_0x4ae831['limit']=qs[_0x65bf('0x37')](_0xa8fdec[_0x65bf('0x4c')][_0x65bf('0x37')]);_0x4ae831['offset']=qs[_0x65bf('0x36')](_0xa8fdec['query'][_0x65bf('0x36')]);}_0x4ae831[_0x65bf('0x56')]=qs['sort'](_0xa8fdec['query'][_0x65bf('0x57')]);_0x4ae831[_0x65bf('0x5a')]=qs[_0x65bf('0x4e')](_[_0x65bf('0x58')](_0xa8fdec[_0x65bf('0x4c')],_0x3289ce[_0x65bf('0x4e')]));_0x4ae831[_0x65bf('0x5a')][_0x65bf('0x6d')]=_0x80c850['id'];if(_0xa8fdec['query'][_0x65bf('0x59')]){_0x4ae831[_0x65bf('0x5a')]=_[_0x65bf('0x5b')](_0x4ae831[_0x65bf('0x5a')],{'$or':_['map'](_0x4ae831[_0x65bf('0x52')],function(_0x227f82){var _0x733748={};_0x733748[_0x227f82]={'$like':'%'+_0xa8fdec[_0x65bf('0x4c')][_0x65bf('0x59')]+'%'};return _0x733748;})});}_0x4ae831=_['merge']({},_0x4ae831,_0xa8fdec[_0x65bf('0x65')]);return db[_0x65bf('0x8f')][_0x65bf('0x35')]({'where':_0x4ae831['where']})[_0x65bf('0x26')](function(_0x268090){_0x2a8663[_0x65bf('0x35')]=_0x268090;if(_0xa8fdec['query'][_0x65bf('0x64')]){_0x4ae831['include']=[{'model':db[_0x65bf('0x91')],'as':_0x65bf('0x92'),'required':![]},{'model':db[_0x65bf('0x93')],'as':_0x65bf('0x94'),'attributes':[_0x65bf('0x3f'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x65bf('0x3f'),_0x65bf('0x95')],'where':_0xa8fdec[_0x65bf('0x4c')]['tag']?{'id':_0xa8fdec[_0x65bf('0x4c')][_0x65bf('0x96')]}:undefined,'required':_0xa8fdec[_0x65bf('0x4c')][_0x65bf('0x96')]?!![]:![]}];}return db[_0x65bf('0x8f')]['findAll'](_0x4ae831);})[_0x65bf('0x26')](function(_0x247b7a){_0x2a8663[_0x65bf('0x60')]=_0x247b7a;return _0x2a8663;});}})[_0x65bf('0x26')](respondWithFilteredResult(_0x56e8a9,_0x4ae831))[_0x65bf('0x30')](handleError(_0x56e8a9,null));};exports[_0x65bf('0x97')]=function(_0x3035c6,_0x5e09af,_0x5c9a7d){return db[_0x65bf('0x47')][_0x65bf('0x6c')]({'where':{'id':_0x3035c6['params']['id']}})['then'](handleEntityNotFound(_0x5e09af,null))[_0x65bf('0x26')](function(_0x2e9035){if(_0x2e9035){return db[_0x65bf('0x98')][_0x65bf('0x99')](function(_0x9f475f){return db[_0x65bf('0x9a')][_0x65bf('0x3b')]({'where':{'MailAccountId':_0x3035c6[_0x65bf('0x62')]['id']},'transaction':_0x9f475f})[_0x65bf('0x26')](function(_0x2d9732){var _0x3dca4e=_['map'](_0x3035c6['body'],function(_0x16c055){_0x16c055[_0x65bf('0x6d')]=_0x3035c6[_0x65bf('0x62')]['id'];return _0x16c055;});return db[_0x65bf('0x9a')][_0x65bf('0x9b')](_0x3dca4e,{'transaction':_0x9f475f});});})[_0x65bf('0x26')](function(){return db[_0x65bf('0x9a')][_0x65bf('0x9c')]({'where':{'MailAccountId':_0x3035c6[_0x65bf('0x62')]['id']},'order':_0x65bf('0x9d')});});}})[_0x65bf('0x26')](respondWithResult(_0x5e09af,null))[_0x65bf('0x30')](handleError(_0x5e09af,null));};exports[_0x65bf('0x9e')]=function(_0x35474b,_0x21623f,_0xbbac28){var _0x55374f={};var _0x5ac830={};var _0x36ef7a;var _0x22e876;return db[_0x65bf('0x47')][_0x65bf('0x6c')]({'where':{'id':_0x35474b[_0x65bf('0x62')]['id']}})[_0x65bf('0x26')](handleEntityNotFound(_0x21623f,null))[_0x65bf('0x26')](function(_0x316268){if(_0x316268){_0x36ef7a=_0x316268;_0x5ac830[_0x65bf('0x50')]=_['keys'](db[_0x65bf('0x9a')][_0x65bf('0x48')]);_0x5ac830['query']=_[_0x65bf('0x4d')](_0x35474b[_0x65bf('0x4c')]);_0x5ac830[_0x65bf('0x4e')]=_[_0x65bf('0x4f')](_0x5ac830[_0x65bf('0x50')],_0x5ac830[_0x65bf('0x4c')]);_0x55374f['attributes']=_[_0x65bf('0x4f')](_0x5ac830[_0x65bf('0x50')],qs['fields'](_0x35474b[_0x65bf('0x4c')][_0x65bf('0x51')]));_0x55374f['attributes']=_0x55374f[_0x65bf('0x52')][_0x65bf('0x53')]?_0x55374f[_0x65bf('0x52')]:_0x5ac830[_0x65bf('0x50')];_0x55374f[_0x65bf('0x56')]=qs['sort'](_0x35474b['query'][_0x65bf('0x57')]);_0x55374f['where']=qs[_0x65bf('0x4e')](_[_0x65bf('0x58')](_0x35474b['query'],_0x5ac830['filters']));if(_0x35474b[_0x65bf('0x4c')][_0x65bf('0x59')]){_0x55374f[_0x65bf('0x5a')]=_[_0x65bf('0x5b')](_0x55374f[_0x65bf('0x5a')],{'$or':_['map'](_0x55374f[_0x65bf('0x52')],function(_0x3ffd58){var _0x362c7d={};_0x362c7d[_0x3ffd58]={'$like':'%'+_0x35474b['query']['filter']+'%'};return _0x362c7d;})});}_0x55374f=_[_0x65bf('0x5b')]({},_0x55374f,_0x35474b[_0x65bf('0x65')]);return _0x36ef7a[_0x65bf('0x9e')](_0x55374f);}})[_0x65bf('0x26')](function(_0x1eff66){if(_0x1eff66){_0x22e876=_0x1eff66[_0x65bf('0x53')];if(!_0x35474b[_0x65bf('0x4c')][_0x65bf('0x54')]('nolimit')){_0x55374f[_0x65bf('0x37')]=qs[_0x65bf('0x37')](_0x35474b['query'][_0x65bf('0x37')]);_0x55374f[_0x65bf('0x36')]=qs['offset'](_0x35474b[_0x65bf('0x4c')][_0x65bf('0x36')]);}return _0x36ef7a[_0x65bf('0x9e')](_0x55374f);}})['then'](function(_0xe73203){if(_0xe73203){return _0xe73203?{'count':_0x22e876,'rows':_0xe73203}:null;}})[_0x65bf('0x26')](respondWithResult(_0x21623f,null))['catch'](handleError(_0x21623f,null));};exports[_0x65bf('0x9f')]=function(_0x408bfe,_0xe59abd,_0x420cc4){var _0x576805={'raw':!![],'where':{}};var _0x3a767={};var _0x1f7c33={'count':0x0,'rows':[]};return db[_0x65bf('0x47')][_0x65bf('0x6c')]({'where':{'id':_0x408bfe[_0x65bf('0x62')]['id']}})[_0x65bf('0x26')](handleEntityNotFound(_0xe59abd,null))[_0x65bf('0x26')](function(_0xfc45ff){if(_0xfc45ff){_0x3a767[_0x65bf('0x50')]=_[_0x65bf('0x4d')](db[_0x65bf('0xa0')][_0x65bf('0x48')]);_0x3a767['query']=_['keys'](_0x408bfe['query']);_0x3a767[_0x65bf('0x4e')]=_[_0x65bf('0x4f')](_0x3a767[_0x65bf('0x50')],_0x3a767['query']);_0x576805['attributes']=_[_0x65bf('0x4f')](_0x3a767[_0x65bf('0x50')],qs[_0x65bf('0x51')](_0x408bfe[_0x65bf('0x4c')][_0x65bf('0x51')]));_0x576805[_0x65bf('0x52')]=_0x576805[_0x65bf('0x52')]['length']?_0x576805['attributes']:_0x3a767[_0x65bf('0x50')];if(!_0x408bfe[_0x65bf('0x4c')][_0x65bf('0x54')]('nolimit')){_0x576805[_0x65bf('0x37')]=qs[_0x65bf('0x37')](_0x408bfe[_0x65bf('0x4c')][_0x65bf('0x37')]);_0x576805[_0x65bf('0x36')]=qs[_0x65bf('0x36')](_0x408bfe[_0x65bf('0x4c')][_0x65bf('0x36')]);}_0x576805[_0x65bf('0x56')]=qs[_0x65bf('0x57')](_0x408bfe[_0x65bf('0x4c')][_0x65bf('0x57')]);_0x576805[_0x65bf('0x5a')]=qs['filters'](_[_0x65bf('0x58')](_0x408bfe[_0x65bf('0x4c')],_0x3a767['filters']));_0x576805[_0x65bf('0x5a')][_0x65bf('0x6d')]=_0xfc45ff['id'];if(_0x408bfe[_0x65bf('0x4c')][_0x65bf('0x59')]){_0x576805[_0x65bf('0x5a')]=_[_0x65bf('0x5b')](_0x576805[_0x65bf('0x5a')],{'$or':_[_0x65bf('0x5c')](_0x576805[_0x65bf('0x52')],function(_0x4f030d){var _0x347f34={};_0x347f34[_0x4f030d]={'$like':'%'+_0x408bfe['query'][_0x65bf('0x59')]+'%'};return _0x347f34;})});}if(_0x408bfe[_0x65bf('0x4c')][_0x65bf('0xa1')]){var _0x20ae2a=_0x408bfe[_0x65bf('0x4c')][_0x65bf('0xa1')][_0x65bf('0xa2')](',');var _0x46d7c4={};_0x46d7c4[_0x20ae2a[0x0]]={'$gte':moment(_0x20ae2a[0x1])['format'](_0x65bf('0xa3'))};_0x576805[_0x65bf('0x5a')]=_[_0x65bf('0x5b')](_0x576805[_0x65bf('0x5a')],_0x46d7c4);}_0x576805=_[_0x65bf('0x5b')]({},_0x576805,_0x408bfe[_0x65bf('0x65')]);return db[_0x65bf('0xa0')]['count']({'where':_0x576805[_0x65bf('0x5a')]})['then'](function(_0x38b818){_0x1f7c33[_0x65bf('0x35')]=_0x38b818;if(_0x408bfe[_0x65bf('0x4c')][_0x65bf('0x64')]){_0x576805[_0x65bf('0x5e')]=[{'all':!![]}];}return db[_0x65bf('0xa0')][_0x65bf('0x5f')](_0x576805);})[_0x65bf('0x26')](function(_0x37ab44){_0x1f7c33[_0x65bf('0x60')]=_0x37ab44;return _0x1f7c33;});}})['then'](respondWithFilteredResult(_0xe59abd,_0x576805))[_0x65bf('0x30')](handleError(_0xe59abd,null));};exports[_0x65bf('0x40')]=function(_0x4365e4,_0x4a7de0,_0x1559e5){var _0x5dcbc3,_0x37819a={},_0x5c117d;if(_0x4365e4['body']['to']){_0x5c117d=_0x4365e4[_0x65bf('0x67')]['to'][_0x65bf('0xa2')](',')[0x0];}return db[_0x65bf('0x47')][_0x65bf('0x68')]({'where':{'id':_0x4365e4['params']['id']},'include':[{'model':db['CmList'],'as':_0x65bf('0xa4'),'include':[{'model':db[_0x65bf('0x91')],'as':'Contacts','where':{'email':_0x5c117d},'limit':0x1,'order':[[_0x65bf('0xa5'),_0x65bf('0xa6')]]}]},{'model':db['MailServerOut'],'as':_0x65bf('0x63'),'raw':!![]}]})[_0x65bf('0x26')](handleEntityNotFound(_0x4a7de0,null))[_0x65bf('0x26')](function(_0x1d2618){if(_0x1d2618){_0x5dcbc3=_0x1d2618;if(_0x1d2618[_0x65bf('0x63')]){if(_[_0x65bf('0x76')](_0x4365e4['body'][_0x65bf('0xa7')])){_0x4365e4['body'][_0x65bf('0xa7')]=util[_0x65bf('0xa8')](_0x65bf('0xa9'),_0x1d2618[_0x65bf('0x3f')],_0x1d2618[_0x65bf('0x74')]||_0x1d2618['Smtp']['user']);}if(_0x4365e4[_0x65bf('0x67')][_0x65bf('0xaa')]&&_0x4365e4[_0x65bf('0x67')][_0x65bf('0xaa')]['length']){for(var _0x3026a8=0x0;_0x3026a8<_0x4365e4[_0x65bf('0x67')][_0x65bf('0xaa')][_0x65bf('0x53')];_0x3026a8+=0x1){_0x4365e4[_0x65bf('0x67')][_0x65bf('0xaa')][_0x3026a8]={'filename':_0x4365e4[_0x65bf('0x67')]['attachments'][_0x3026a8][_0x65bf('0x3f')],'path':path[_0x65bf('0xab')](config[_0x65bf('0xac')],_0x65bf('0xad'),_0x4365e4[_0x65bf('0x67')][_0x65bf('0xaa')][_0x3026a8][_0x65bf('0xae')])};}}var _0x33dde0={'tls':{'rejectUnauthorized':![]}};if(_[_0x65bf('0x76')](_0x1d2618[_0x65bf('0x63')][_0x65bf('0x82')])){if(_0x1d2618[_0x65bf('0x63')][_0x65bf('0x7f')]){_0x33dde0['auth']={'user':_0x1d2618[_0x65bf('0x63')]['user'],'pass':_0x1d2618['Smtp'][_0x65bf('0x7d')]};}_0x33dde0[_0x65bf('0x80')]=_0x1d2618['Smtp']['host'];_0x33dde0[_0x65bf('0x81')]=_0x1d2618['Smtp'][_0x65bf('0x81')];_0x33dde0['secure']=_0x1d2618[_0x65bf('0x63')][_0x65bf('0xaf')];}else{_0x33dde0[_0x65bf('0x82')]=_0x1d2618[_0x65bf('0x63')][_0x65bf('0x82')];_0x33dde0[_0x65bf('0xb0')]={'user':_0x1d2618[_0x65bf('0x63')]['user'],'pass':_0x1d2618[_0x65bf('0x63')]['pass']};}return respondWithRpcPromise(_0x65bf('0xb1'),_0x65bf('0xb2'),{'account':_0x33dde0,'message':_0x4365e4[_0x65bf('0x67')]});}else{throw new Error('List\x20not\x20found');}}})[_0x65bf('0x26')](function(_0x2656aa){if(_0x2656aa){_0x37819a=_0x2656aa;if(_0x5dcbc3[_0x65bf('0xa4')]){if(_0x5dcbc3[_0x65bf('0xa4')][_0x65bf('0xb3')][_0x65bf('0x53')]){return _0x5dcbc3[_0x65bf('0xa4')]['Contacts'][0x0];}else{return db[_0x65bf('0x91')]['create'](_[_0x65bf('0x1a')](_0x4365e4[_0x65bf('0x67')],{'firstName':_0x4365e4[_0x65bf('0x67')]['to'],'email':_0x4365e4[_0x65bf('0x67')]['to'],'phone':_0x4365e4[_0x65bf('0x67')]['to'],'ListId':_0x5dcbc3[_0x65bf('0x75')]}));}}else{throw new Error(_0x65bf('0xb4'));}}})[_0x65bf('0x26')](function(_0x10f35b){if(_0x10f35b){var _0xd8d792={'UserId':_0x4365e4[_0x65bf('0x7b')]['id'],'ContactId':_0x10f35b['id'],'MailAccountId':_0x5dcbc3['id'],'inReplyTo':_0x37819a['messageId'],'to':_0x4365e4[_0x65bf('0x67')]['from'],'cc':_0x4365e4['body']['cc'],'subject':_0x4365e4['body'][_0x65bf('0xb5')],'attach':_0x4365e4[_0x65bf('0x67')][_0x65bf('0xb6')],'firstMsgDirection':_0x65bf('0xb7'),'lastMsgAt':moment()[_0x65bf('0xa8')](_0x65bf('0xa3')),'lastMsgDirection':_0x65bf('0xb7'),'lastMsgBody':_0x4365e4[_0x65bf('0x67')]['body'],'Messages':[_['merge'](_0x4365e4[_0x65bf('0x67')],{'messageId':_0x37819a[_0x65bf('0xb8')],'sentAt':moment()['format'](_0x65bf('0xa3')),'read':!![],'MailAccountId':_0x5dcbc3['id'],'UserId':_0x4365e4[_0x65bf('0x7b')]['id'],'ContactId':_0x10f35b['id']})]};if(_0x4365e4[_0x65bf('0x67')][_0x65bf('0xb9')]){_0xd8d792=_[_0x65bf('0x5b')](_0xd8d792,_0x4365e4[_0x65bf('0x67')][_0x65bf('0xb9')]);}return db['MailInteraction']['create'](_0xd8d792,{'include':[{'model':db[_0x65bf('0xa0')],'as':'Messages'}]});}})[_0x65bf('0x26')](respondWithResult(_0x4a7de0,null))[_0x65bf('0x30')](handleError(_0x4a7de0,null));};exports[_0x65bf('0xba')]=function(_0x28a047,_0x312001,_0x139c88){return db[_0x65bf('0x47')][_0x65bf('0x68')]({'where':{'id':_0x28a047[_0x65bf('0x62')]['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x65bf('0x26')](handleEntityNotFound(_0x312001,null))['then'](function(_0x188e47){if(_0x188e47&&_0x188e47[_0x65bf('0x63')]){var _0x25ad4c={'id':_0x188e47['id'],'tls':{'rejectUnauthorized':![]}};if(_0x188e47[_0x65bf('0x63')]['service']){_0x25ad4c['service']=_0x188e47[_0x65bf('0x63')][_0x65bf('0x82')];}else{_0x25ad4c['host']=_0x188e47[_0x65bf('0x63')][_0x65bf('0x80')];_0x25ad4c['port']=_0x188e47['Smtp']['port'];_0x25ad4c['secure']=_0x188e47['Smtp'][_0x65bf('0xaf')];}if(_0x188e47[_0x65bf('0x63')][_0x65bf('0x7f')]){_0x25ad4c['auth']={'user':_0x188e47[_0x65bf('0x63')][_0x65bf('0x7b')],'pass':_0x188e47['Smtp'][_0x65bf('0x7d')]};}return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x25ad4c});}})['then'](respondWithResult(_0x312001,null))[_0x65bf('0x30')](handleError(_0x312001,null));};exports[_0x65bf('0x3b')]=function(_0x552217,_0x1a97af){return db[_0x65bf('0x47')][_0x65bf('0x68')]({'where':{'id':_0x552217[_0x65bf('0x62')]['id']}})[_0x65bf('0x26')](handleEntityNotFound(_0x1a97af,null))[_0x65bf('0x26')](function(_0x19f306){if(_0x19f306&&_0x19f306[_0x65bf('0x82')]){throw new db[(_0x65bf('0x22'))][(_0x65bf('0x23'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x19f306;})['then'](removeEntity(_0x1a97af,null))[_0x65bf('0x30')](handleError(_0x1a97af,null));};exports[_0x65bf('0xbb')]=function(_0x3d5336,_0x4b9e80,_0x22470d){return db[_0x65bf('0x47')]['find']({'where':{'id':_0x3d5336[_0x65bf('0x62')]['id']}})[_0x65bf('0x26')](handleEntityNotFound(_0x4b9e80,null))[_0x65bf('0x26')](function(_0x9f8f6e){if(_0x9f8f6e){return _0x9f8f6e['addAgents'](_0x3d5336['body']['ids'],_[_0x65bf('0x90')](_0x3d5336[_0x65bf('0x67')],[_0x65bf('0x70'),'id'])||{})['spread'](function(_0x3ff0ad){for(var _0xc5920b=0x0;_0xc5920b<_0x3d5336[_0x65bf('0x67')]['ids']['length'];_0xc5920b+=0x1){socket['emit'](_0x65bf('0xbc'),{'UserId':_0x3d5336['body'][_0x65bf('0x70')][_0xc5920b],'MailAccountId':_0x3d5336[_0x65bf('0x62')]['id']});}return _0x3ff0ad;});}})['then'](respondWithResult(_0x4b9e80,null))[_0x65bf('0x30')](handleError(_0x4b9e80,null));};exports[_0x65bf('0xbd')]=function(_0x45759d,_0x31302d,_0x2bf4f0){return db[_0x65bf('0x47')][_0x65bf('0x68')]({'where':{'id':_0x45759d[_0x65bf('0x62')]['id']}})['then'](handleEntityNotFound(_0x31302d,null))[_0x65bf('0x26')](function(_0xb0d6e9){if(_0xb0d6e9){return _0xb0d6e9[_0x65bf('0xbd')](_0x45759d['query']['ids'])[_0x65bf('0x26')](function(){if(_[_0x65bf('0xbe')](_0x45759d[_0x65bf('0x4c')][_0x65bf('0x70')])){for(var _0x44ca65=0x0;_0x44ca65<_0x45759d[_0x65bf('0x4c')][_0x65bf('0x70')][_0x65bf('0x53')];_0x44ca65+=0x1){socket[_0x65bf('0xbf')](_0x65bf('0xc0'),{'UserId':Number(_0x45759d['query']['ids'][_0x44ca65]),'MailAccountId':Number(_0x45759d['params']['id'])});}}else{socket[_0x65bf('0xbf')](_0x65bf('0xc0'),{'UserId':Number(_0x45759d[_0x65bf('0x4c')]['ids']),'MailAccountId':Number(_0x45759d['params']['id'])});}});}})[_0x65bf('0x26')](respondWithStatusCode(_0x31302d,null))[_0x65bf('0x30')](handleError(_0x31302d,null));};exports[_0x65bf('0xc1')]=function(_0x5d7178,_0x7cb3f2,_0x3620ce){var _0x2eb31c={};var _0x1389dd={};var _0x9a25c;var _0x4fa829;return db[_0x65bf('0x47')][_0x65bf('0x6c')]({'where':{'id':_0x5d7178[_0x65bf('0x62')]['id']}})[_0x65bf('0x26')](handleEntityNotFound(_0x7cb3f2,null))[_0x65bf('0x26')](function(_0x2674cc){if(_0x2674cc){_0x9a25c=_0x2674cc;_0x1389dd[_0x65bf('0x50')]=_[_0x65bf('0x4d')](db[_0x65bf('0x93')][_0x65bf('0x48')]);_0x1389dd[_0x65bf('0x4c')]=_[_0x65bf('0x4d')](_0x5d7178[_0x65bf('0x4c')]);_0x1389dd[_0x65bf('0x4e')]=_[_0x65bf('0x4f')](_0x1389dd[_0x65bf('0x50')],_0x1389dd[_0x65bf('0x4c')]);_0x2eb31c[_0x65bf('0x52')]=_[_0x65bf('0x4f')](_0x1389dd[_0x65bf('0x50')],qs[_0x65bf('0x51')](_0x5d7178['query'][_0x65bf('0x51')]));_0x2eb31c[_0x65bf('0x52')]=_0x2eb31c[_0x65bf('0x52')][_0x65bf('0x53')]?_0x2eb31c[_0x65bf('0x52')]:_0x1389dd['model'];_0x2eb31c['order']=qs[_0x65bf('0x57')](_0x5d7178[_0x65bf('0x4c')][_0x65bf('0x57')]);_0x2eb31c[_0x65bf('0x5a')]=qs[_0x65bf('0x4e')](_[_0x65bf('0x58')](_0x5d7178[_0x65bf('0x4c')],_0x1389dd[_0x65bf('0x4e')]));if(_0x5d7178[_0x65bf('0x4c')][_0x65bf('0x59')]){_0x2eb31c['where']=_['merge'](_0x2eb31c[_0x65bf('0x5a')],{'$or':_[_0x65bf('0x5c')](_0x2eb31c[_0x65bf('0x52')],function(_0x1c78e3){var _0x5e36e2={};_0x5e36e2[_0x1c78e3]={'$like':'%'+_0x5d7178[_0x65bf('0x4c')][_0x65bf('0x59')]+'%'};return _0x5e36e2;})});}_0x2eb31c=_['merge']({},_0x2eb31c,_0x5d7178[_0x65bf('0x65')]);return _0x9a25c[_0x65bf('0xc1')](_0x2eb31c);}})[_0x65bf('0x26')](function(_0x8d53cd){if(_0x8d53cd){_0x4fa829=_0x8d53cd[_0x65bf('0x53')];if(!_0x5d7178['query']['hasOwnProperty'](_0x65bf('0x55'))){_0x2eb31c[_0x65bf('0x37')]=qs[_0x65bf('0x37')](_0x5d7178[_0x65bf('0x4c')][_0x65bf('0x37')]);_0x2eb31c[_0x65bf('0x36')]=qs[_0x65bf('0x36')](_0x5d7178['query'][_0x65bf('0x36')]);}return _0x9a25c[_0x65bf('0xc1')](_0x2eb31c);}})['then'](function(_0x29bdd3){if(_0x29bdd3){return _0x29bdd3?{'count':_0x4fa829,'rows':_0x29bdd3}:null;}})[_0x65bf('0x26')](respondWithResult(_0x7cb3f2,null))['catch'](handleError(_0x7cb3f2,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 7311c02..0a6e9d4 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 _0x09c9=['hasOwnProperty','exports','MailAccount','update','remove','emit'];(function(_0x305c31,_0x466b17){var _0x17f39f=function(_0x53ae03){while(--_0x53ae03){_0x305c31['push'](_0x305c31['shift']());}};_0x17f39f(++_0x466b17);}(_0x09c9,0x122));var _0x909c=function(_0x321cff,_0x271a66){_0x321cff=_0x321cff-0x0;var _0x331c4=_0x09c9[_0x321cff];return _0x331c4;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db'][_0x909c('0x0')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x909c('0x1'),'afterDestroy':_0x909c('0x2')};function emitEvent(_0x3c9286){return function(_0x1fbb3b,_0x434040,_0x42d104){MailAccountEvents[_0x909c('0x3')](_0x3c9286+':'+_0x1fbb3b['id'],_0x1fbb3b);MailAccountEvents[_0x909c('0x3')](_0x3c9286,_0x1fbb3b);_0x42d104(null);};}for(var e in events){if(events[_0x909c('0x4')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x909c('0x5')]=MailAccountEvents; \ No newline at end of file +var _0x1980=['setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb','MailAccount'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0x1980,0x1ec));var _0x0198=function(_0x5e8858,_0x405d91){_0x5e8858=_0x5e8858-0x0;var _0x5e27ca=_0x1980[_0x5e8858];return _0x5e27ca;};'use strict';var EventEmitter=require(_0x0198('0x0'));var MailAccount=require(_0x0198('0x1'))['db'][_0x0198('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x0198('0x3')](0x0);var events={'afterCreate':_0x0198('0x4'),'afterUpdate':_0x0198('0x5'),'afterDestroy':_0x0198('0x6')};function emitEvent(_0x50ff4c){return function(_0x45c78c,_0x30f746,_0x1184b5){MailAccountEvents[_0x0198('0x7')](_0x50ff4c+':'+_0x45c78c['id'],_0x45c78c);MailAccountEvents[_0x0198('0x7')](_0x50ff4c,_0x45c78c);_0x1184b5(null);};}for(var e in events){if(events[_0x0198('0x8')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 9ca941b..9115657 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 _0x9401=['rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash','util','moment','path'];(function(_0x288be4,_0x23654e){var _0x1b2680=function(_0x26913e){while(--_0x26913e){_0x288be4['push'](_0x288be4['shift']());}};_0x1b2680(++_0x23654e);}(_0x9401,0xee));var _0x1940=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9401[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x1940('0x0'));var util=require(_0x1940('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1940('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1940('0x3'));var rimraf=require(_0x1940('0x4'));var config=require(_0x1940('0x5'));var attributes=require(_0x1940('0x6'));module[_0x1940('0x7')]=function(_0x35b726,_0x1b25e1){return _0x35b726[_0x1940('0x8')](_0x1940('0x9'),attributes,{'tableName':_0x1940('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca21=['exports','define','mail_accounts','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xca21,0xcf));var _0x1ca2=function(_0x5c99ee,_0x43a314){_0x5c99ee=_0x5c99ee-0x0;var _0xcea7c6=_0xca21[_0x5c99ee];return _0xcea7c6;};'use strict';var _=require(_0x1ca2('0x0'));var util=require(_0x1ca2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1ca2('0x2'));var BPromise=require(_0x1ca2('0x3'));var rp=require(_0x1ca2('0x4'));var fs=require('fs');var path=require(_0x1ca2('0x5'));var rimraf=require(_0x1ca2('0x6'));var config=require(_0x1ca2('0x7'));var attributes=require(_0x1ca2('0x8'));module[_0x1ca2('0x9')]=function(_0x51556b,_0x4f5d05){return _0x51556b[_0x1ca2('0xa')]('MailAccount',attributes,{'tableName':_0x1ca2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 94ff07a..50f9bef 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 _0xdeb7=['spread','subject','interaction','get','attachments','originTo','originCc','bcc','Attachments','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailAccount','findAll','options','raw','where','attributes','include','map','model','ShowMailAccount','MailAccount','NotifyMailAccount','body','rawAttributes','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','CmContact','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','Smtp','applications','list','List','orderBy','priority','asc','autoclose','length','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found'];(function(_0x5ea24f,_0x3bd868){var _0x112afb=function(_0x530fda){while(--_0x530fda){_0x5ea24f['push'](_0x5ea24f['shift']());}};_0x112afb(++_0x3bd868);}(_0xdeb7,0x77));var _0x7deb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdeb7[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x7deb('0x0'));var util=require(_0x7deb('0x1'));var moment=require(_0x7deb('0x2'));var BPromise=require('bluebird');var rs=require(_0x7deb('0x3'));var fs=require('fs');var Redis=require(_0x7deb('0x4'));var db=require(_0x7deb('0x5'))['db'];var utils=require(_0x7deb('0x6'));var logger=require(_0x7deb('0x7'))('rpc');var config=require(_0x7deb('0x8'));var jayson=require(_0x7deb('0x9'));var client=jayson[_0x7deb('0xa')][_0x7deb('0xb')]({'port':0x232c});config[_0x7deb('0xc')]=_[_0x7deb('0xd')](config['redis'],{'host':_0x7deb('0xe'),'port':0x18eb});var socket=require(_0x7deb('0xf'))(new Redis(config[_0x7deb('0xc')]));require(_0x7deb('0x10'))['register'](socket);function respondWithRpcPromise(_0x1c771d,_0x5e37c9,_0x49b193){return new BPromise(function(_0x453eaf,_0x51019e){return client[_0x7deb('0x11')](_0x1c771d,_0x49b193)[_0x7deb('0x12')](function(_0x2b749e){logger['info'](_0x7deb('0x13'),_0x5e37c9,_0x7deb('0x14'));logger[_0x7deb('0x15')](_0x7deb('0x16'),_0x5e37c9,'request\x20sent',JSON[_0x7deb('0x17')](_0x2b749e));if(_0x2b749e[_0x7deb('0x18')]){if(_0x2b749e[_0x7deb('0x18')][_0x7deb('0x19')]===0x1f4){logger[_0x7deb('0x18')](_0x7deb('0x13'),_0x5e37c9,_0x2b749e[_0x7deb('0x18')][_0x7deb('0x1a')]);return _0x51019e(_0x2b749e[_0x7deb('0x18')][_0x7deb('0x1a')]);}logger[_0x7deb('0x18')](_0x7deb('0x13'),_0x5e37c9,_0x2b749e[_0x7deb('0x18')][_0x7deb('0x1a')]);return _0x453eaf(_0x2b749e[_0x7deb('0x18')]['message']);}else{logger[_0x7deb('0x1b')]('MailAccount,\x20%s,\x20%s',_0x5e37c9,_0x7deb('0x14'));_0x453eaf(_0x2b749e[_0x7deb('0x1c')]['message']);}})[_0x7deb('0x1d')](function(_0x42605d){logger[_0x7deb('0x18')](_0x7deb('0x13'),_0x5e37c9,_0x42605d);_0x51019e(_0x42605d);});});}exports[_0x7deb('0x1e')]=function(_0x11fbd0){var _0xfdeba4=this;return new Promise(function(_0x2ab72e,_0x27a448){return db['MailAccount'][_0x7deb('0x1f')]({'raw':_0x11fbd0[_0x7deb('0x20')]?_0x11fbd0[_0x7deb('0x20')][_0x7deb('0x21')]===undefined?!![]:![]:!![],'where':_0x11fbd0[_0x7deb('0x20')]?_0x11fbd0[_0x7deb('0x20')][_0x7deb('0x22')]||null:null,'attributes':_0x11fbd0[_0x7deb('0x20')]?_0x11fbd0['options'][_0x7deb('0x23')]||null:null,'limit':_0x11fbd0[_0x7deb('0x20')]?_0x11fbd0[_0x7deb('0x20')]['limit']||null:null,'include':_0x11fbd0[_0x7deb('0x20')]?_0x11fbd0[_0x7deb('0x20')][_0x7deb('0x24')]?_[_0x7deb('0x25')](_0x11fbd0['options'][_0x7deb('0x24')],function(_0x28023c){return{'model':db[_0x28023c[_0x7deb('0x26')]],'as':_0x28023c['as'],'attributes':_0x28023c[_0x7deb('0x23')],'include':_0x28023c[_0x7deb('0x24')]?_[_0x7deb('0x25')](_0x28023c[_0x7deb('0x24')],function(_0x659b9){return{'model':db[_0x659b9[_0x7deb('0x26')]],'as':_0x659b9['as'],'attributes':_0x659b9[_0x7deb('0x23')],'include':_0x659b9[_0x7deb('0x24')]?_[_0x7deb('0x25')](_0x659b9[_0x7deb('0x24')],function(_0x14ec6f){return{'model':db[_0x14ec6f['model']],'as':_0x14ec6f['as'],'attributes':_0x14ec6f[_0x7deb('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ce28d){logger['info'](_0x7deb('0x1e'),_0x11fbd0);logger[_0x7deb('0x15')]('GetMailAccount',_0x11fbd0,JSON['stringify'](_0x1ce28d));_0x2ab72e(_0x1ce28d);})[_0x7deb('0x1d')](function(_0x298831){logger['error']('GetMailAccount',_0x298831[_0x7deb('0x1a')],_0x11fbd0);_0x27a448(_0xfdeba4[_0x7deb('0x18')](0x1f4,_0x298831[_0x7deb('0x1a')]));});});};exports[_0x7deb('0x27')]=function(_0x3a334b){var _0x6d5e8f=this;return new Promise(function(_0x12e0ac,_0x21c945){return db[_0x7deb('0x28')]['find']({'raw':_0x3a334b[_0x7deb('0x20')]?_0x3a334b['options'][_0x7deb('0x21')]===undefined?!![]:![]:!![],'where':_0x3a334b[_0x7deb('0x20')]?_0x3a334b[_0x7deb('0x20')][_0x7deb('0x22')]||null:null,'attributes':_0x3a334b[_0x7deb('0x20')]?_0x3a334b[_0x7deb('0x20')][_0x7deb('0x23')]||null:null,'include':_0x3a334b[_0x7deb('0x20')]?_0x3a334b[_0x7deb('0x20')][_0x7deb('0x24')]?_['map'](_0x3a334b[_0x7deb('0x20')][_0x7deb('0x24')],function(_0x4c2120){return{'model':db[_0x4c2120['model']],'as':_0x4c2120['as'],'attributes':_0x4c2120['attributes'],'include':_0x4c2120[_0x7deb('0x24')]?_['map'](_0x4c2120[_0x7deb('0x24')],function(_0x36d875){return{'model':db[_0x36d875[_0x7deb('0x26')]],'as':_0x36d875['as'],'attributes':_0x36d875[_0x7deb('0x23')],'include':_0x36d875['include']?_['map'](_0x36d875['include'],function(_0x326163){return{'model':db[_0x326163[_0x7deb('0x26')]],'as':_0x326163['as'],'attributes':_0x326163[_0x7deb('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7deb('0x12')](function(_0x27f541){logger[_0x7deb('0x1b')]('ShowMailAccount',_0x3a334b);logger['debug'](_0x7deb('0x27'),_0x3a334b,JSON[_0x7deb('0x17')](_0x27f541));_0x12e0ac(_0x27f541);})['catch'](function(_0x35d033){logger['error'](_0x7deb('0x27'),_0x35d033[_0x7deb('0x1a')],_0x3a334b);_0x21c945(_0x6d5e8f[_0x7deb('0x18')](0x1f4,_0x35d033[_0x7deb('0x1a')]));});});};exports[_0x7deb('0x29')]=function(_0x15452d){var _0x5ecca3=this;return new Promise(function(_0x2f7018,_0xccae33){var _0x1b7bbe={'body':_0x15452d[_0x7deb('0x2a')],'channel':'mail'};var _0x37b574=_['difference'](_['keys'](db['CmContact'][_0x7deb('0x2b')]),[_0x7deb('0x2c'),'updatedAt',_0x7deb('0x2d'),_0x7deb('0x2e')]);var _0x5c9e57=![];if(_0x15452d[_0x7deb('0x2a')]['id']){delete _0x15452d['body']['id'];}if(_['isNil'](_0x15452d[_0x7deb('0x2a')][_0x7deb('0x2f')])){return _0xccae33(_0x5ecca3[_0x7deb('0x18')](0x1f4,_0x7deb('0x30')));}if(_[_0x7deb('0x31')](_0x15452d[_0x7deb('0x2a')]['body'])||_0x15452d[_0x7deb('0x2a')][_0x7deb('0x2a')]===''){return _0xccae33(_0x5ecca3[_0x7deb('0x18')](0x1f4,_0x7deb('0x32')));}if(_[_0x7deb('0x31')](_0x15452d[_0x7deb('0x2a')][_0x7deb('0x33')])){return _0xccae33(_0x5ecca3['error'](0x1f4,_0x7deb('0x34')+_0x37b574));}if(!_[_0x7deb('0x35')](_0x37b574,_0x15452d[_0x7deb('0x2a')][_0x7deb('0x33')])){return _0xccae33(_0x5ecca3[_0x7deb('0x18')](0x1f4,_0x7deb('0x36')+_0x37b574));}var _0x4e8169={};_0x4e8169[_0x15452d['body'][_0x7deb('0x33')]]=_0x15452d[_0x7deb('0x2a')][_0x7deb('0x2f')];return db[_0x7deb('0x28')][_0x7deb('0x37')]({'where':{'id':_0x15452d[_0x7deb('0x38')]['id']},'include':[{'model':db[_0x7deb('0x39')],'as':'List','include':[{'model':db[_0x7deb('0x3a')],'as':_0x7deb('0x3b'),'where':_0x4e8169,'limit':0x1,'order':[[_0x7deb('0x3c'),_0x7deb('0x3d')]]}]},{'model':db[_0x7deb('0x3e')],'as':_0x7deb('0x3f')},{'model':db[_0x7deb('0x40')],'as':_0x7deb('0x41')}]})['then'](function(_0x3f4abc){if(_0x3f4abc&&_0x3f4abc['List']){var _0x16b998=_0x3f4abc['get']({'plain':!![]});_0x1b7bbe['account']=_['omit'](_0x16b998,[_0x7deb('0x3f'),'List']);_0x1b7bbe[_0x7deb('0x42')]=_0x16b998['Applications'];_0x1b7bbe[_0x7deb('0x43')]=_0x16b998[_0x7deb('0x44')];_0x1b7bbe[_0x7deb('0x42')]=_[_0x7deb('0x45')](_0x1b7bbe[_0x7deb('0x42')],[_0x7deb('0x46')],[_0x7deb('0x47')]);if(_0x1b7bbe['account']&&_0x1b7bbe[_0x7deb('0x38')][_0x7deb('0x48')]){_0x1b7bbe['applications']['push']({'id':0x0,'priority':_0x1b7bbe['applications'][_0x7deb('0x49')]+0x1,'app':_0x7deb('0x4a'),'appdata':'autoclose','interval':_0x7deb('0x4b')});}if(_0x1b7bbe[_0x7deb('0x38')][_0x7deb('0x3f')]){delete _0x1b7bbe[_0x7deb('0x38')][_0x7deb('0x3f')];}if(_0x1b7bbe[_0x7deb('0x38')]['List']){delete _0x1b7bbe[_0x7deb('0x38')]['List'];}if(_0x16b998[_0x7deb('0x44')][_0x7deb('0x3b')][_0x7deb('0x49')]){return _0x16b998[_0x7deb('0x44')][_0x7deb('0x3b')][0x0];}var _0x1a71f2=_[_0x7deb('0xd')](_0x15452d[_0x7deb('0x2a')],{'firstName':_0x15452d[_0x7deb('0x2a')][_0x7deb('0x2f')],'ListId':_0x16b998[_0x7deb('0x2e')]});_0x1a71f2[_0x15452d['body']['mapKey']]=_0x15452d[_0x7deb('0x2a')][_0x7deb('0x2f')];return db[_0x7deb('0x3a')][_0x7deb('0x4c')](_0x1a71f2);}else{throw new Error(_0x7deb('0x4d'));}})['then'](function(_0x107bb5){_0x1b7bbe[_0x7deb('0x4e')]=_0x107bb5;if(_0x107bb5){if(!_0x15452d[_0x7deb('0x2a')][_0x7deb('0x1a')]['messageId']){_0x15452d[_0x7deb('0x2a')][_0x7deb('0x1a')][_0x7deb('0x4f')]=rs[_0x7deb('0x50')]()+'\x20'+_0x15452d[_0x7deb('0x2a')][_0x7deb('0x1a')][_0x7deb('0x2f')];}var _0x4aa1c7={'ContactId':_0x107bb5['id'],'MailAccountId':_0x15452d[_0x7deb('0x38')]['id'],'inReplyTo':_0x15452d[_0x7deb('0x2a')][_0x7deb('0x1a')]['messageId'],'to':_0x15452d[_0x7deb('0x2a')][_0x7deb('0x1a')]['from'],'cc':_0x15452d[_0x7deb('0x2a')]['message']['cc'],'subject':_0x15452d[_0x7deb('0x2a')]['message']['subject'],'attach':_0x15452d[_0x7deb('0x2a')][_0x7deb('0x1a')][_0x7deb('0x51')],'lastMsgAt':moment()[_0x7deb('0x52')](_0x7deb('0x53')),'lastMsgDirection':'in','lastMsgBody':_0x15452d['body'][_0x7deb('0x2a')]};return db[_0x7deb('0x54')][_0x7deb('0x37')]({'where':{'closed':![],'MailAccountId':_0x15452d[_0x7deb('0x38')]['id']},'include':[{'model':db[_0x7deb('0x55')],'as':_0x7deb('0x56'),'attributes':[_0x7deb('0x4f')],'where':{'messageId':_0x15452d[_0x7deb('0x2a')][_0x7deb('0x1a')][_0x7deb('0x57')]}}]})['then'](function(_0x2d593e){if(_0x2d593e){return[_0x2d593e,![]];}return db[_0x7deb('0x54')][_0x7deb('0x4c')](_0x4aa1c7)[_0x7deb('0x12')](function(_0x5aa27a){return[_0x5aa27a,!![]];});});}else{throw new Error(_0x7deb('0x58'));}})[_0x7deb('0x59')](function(_0x96ea16,_0x3aed0f){if(_0x96ea16){_0x5c9e57=_0x3aed0f;if(!_0x3aed0f){return _0x96ea16['update']({'inReplyTo':_0x15452d[_0x7deb('0x2a')][_0x7deb('0x1a')][_0x7deb('0x4f')],'to':_0x15452d[_0x7deb('0x2a')][_0x7deb('0x1a')][_0x7deb('0x2f')],'cc':_0x15452d['body']['message']['cc'],'subject':_0x15452d[_0x7deb('0x2a')]['message'][_0x7deb('0x5a')],'attach':_0x96ea16[_0x7deb('0x51')]?_0x96ea16[_0x7deb('0x51')]:_0x15452d[_0x7deb('0x2a')][_0x7deb('0x1a')]['attach'],'substatus':null,'substatusAt':moment()[_0x7deb('0x52')](_0x7deb('0x53')),'lastMsgAt':moment()[_0x7deb('0x52')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x15452d[_0x7deb('0x2a')][_0x7deb('0x2a')]});}else{return _0x96ea16;}}})['then'](function(_0x20bb1c){_0x1b7bbe[_0x7deb('0x5b')]=_0x20bb1c[_0x7deb('0x5c')]({'plain':!![]});_0x1b7bbe[_0x7deb('0x5b')]['created']=_0x5c9e57;return db[_0x7deb('0x55')][_0x7deb('0x4c')]({'body':_0x15452d['body'][_0x7deb('0x2a')],'MailAccountId':_0x15452d[_0x7deb('0x38')]['id'],'MailInteractionId':_0x20bb1c['id'],'direction':'in','ContactId':_0x1b7bbe[_0x7deb('0x4e')]['id'],'messageId':_0x15452d['body'][_0x7deb('0x1a')][_0x7deb('0x4f')],'from':_0x15452d['body'][_0x7deb('0x1a')]['from'],'to':_0x15452d['body'][_0x7deb('0x1a')]['to'],'cc':_0x15452d[_0x7deb('0x2a')]['message']['cc'],'subject':_0x15452d[_0x7deb('0x2a')]['message']['subject'],'attach':_0x15452d[_0x7deb('0x2a')][_0x7deb('0x1a')][_0x7deb('0x51')],'Attachments':_0x15452d[_0x7deb('0x2a')][_0x7deb('0x1a')][_0x7deb('0x5d')],'originTo':_0x15452d[_0x7deb('0x2a')]['message'][_0x7deb('0x5e')],'originCc':_0x15452d['body'][_0x7deb('0x1a')][_0x7deb('0x5f')],'bcc':_0x15452d['body'][_0x7deb('0x1a')][_0x7deb('0x60')]},{'include':[{'model':db['Attachment'],'as':_0x7deb('0x61')}]});})[_0x7deb('0x12')](function(_0x471152){_0x1b7bbe[_0x7deb('0x1a')]=_0x471152;if(_0x1b7bbe[_0x7deb('0x5b')]['UserId']){return db[_0x7deb('0x62')]['find']({'attributes':['id',_0x7deb('0x63')],'where':{'id':_0x1b7bbe['interaction']['UserId']}})['then'](function(_0x577e89){if(_0x577e89){_0x1b7bbe[_0x7deb('0x42')]['unshift']({'id':0x0,'priority':0x0,'app':_0x7deb('0x64'),'appdata':_0x577e89[_0x7deb('0x63')]+','+(_0x1b7bbe[_0x7deb('0x38')][_0x7deb('0x65')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x7deb('0x66'),_0x7deb('0x67'),_0x1b7bbe);});}return respondWithRpcPromise(_0x7deb('0x66'),'startRouting',_0x1b7bbe);})[_0x7deb('0x12')](function(_0x1e9a59){_0x2f7018(_0x1e9a59);})[_0x7deb('0x1d')](function(_0x54f1b5){_0xccae33(_0x5ecca3[_0x7deb('0x18')](0x1f4,_0x54f1b5[_0x7deb('0x1a')]));});});}; \ No newline at end of file +var _0x5127=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','model','map','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','List','DESC','MailApplication','get','omit','Applications','list','applications','orderBy','priority','asc','account','autoclose','length','close','Contacts','defaults','create','List\x20not\x20found','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','find','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','update','interaction','contact','attachments','originTo','originCc','bcc','Attachment','Attachments','UserId','name','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5127,0x18f));var _0x7512=function(_0x29ecbc,_0x2929d9){_0x29ecbc=_0x29ecbc-0x0;var _0x5709b0=_0x5127[_0x29ecbc];return _0x5709b0;};'use strict';var _=require(_0x7512('0x0'));var util=require(_0x7512('0x1'));var moment=require(_0x7512('0x2'));var BPromise=require(_0x7512('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7512('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7512('0x5'))(_0x7512('0x6'));var config=require(_0x7512('0x7'));var jayson=require(_0x7512('0x8'));var client=jayson[_0x7512('0x9')][_0x7512('0xa')]({'port':0x232c});config['redis']=_['defaults'](config[_0x7512('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7512('0xc'))(new Redis(config['redis']));require(_0x7512('0xd'))[_0x7512('0xe')](socket);function respondWithRpcPromise(_0x3804df,_0x3db733,_0x255ab9){return new BPromise(function(_0x7c0280,_0x1446b3){return client[_0x7512('0xf')](_0x3804df,_0x255ab9)[_0x7512('0x10')](function(_0x885024){logger[_0x7512('0x11')](_0x7512('0x12'),_0x3db733,_0x7512('0x13'));logger[_0x7512('0x14')](_0x7512('0x15'),_0x3db733,_0x7512('0x13'),JSON[_0x7512('0x16')](_0x885024));if(_0x885024['error']){if(_0x885024[_0x7512('0x17')]['code']===0x1f4){logger[_0x7512('0x17')](_0x7512('0x12'),_0x3db733,_0x885024[_0x7512('0x17')][_0x7512('0x18')]);return _0x1446b3(_0x885024[_0x7512('0x17')]['message']);}logger['error'](_0x7512('0x12'),_0x3db733,_0x885024[_0x7512('0x17')][_0x7512('0x18')]);return _0x7c0280(_0x885024[_0x7512('0x17')]['message']);}else{logger[_0x7512('0x11')]('MailAccount,\x20%s,\x20%s',_0x3db733,_0x7512('0x13'));_0x7c0280(_0x885024[_0x7512('0x19')][_0x7512('0x18')]);}})[_0x7512('0x1a')](function(_0x2d98fa){logger[_0x7512('0x17')](_0x7512('0x12'),_0x3db733,_0x2d98fa);_0x1446b3(_0x2d98fa);});});}exports[_0x7512('0x1b')]=function(_0x2f04fb){var _0x3900f3=this;return new Promise(function(_0x581d56,_0x3c8b39){return db[_0x7512('0x1c')]['findAll']({'raw':_0x2f04fb[_0x7512('0x1d')]?_0x2f04fb[_0x7512('0x1d')][_0x7512('0x1e')]===undefined?!![]:![]:!![],'where':_0x2f04fb[_0x7512('0x1d')]?_0x2f04fb[_0x7512('0x1d')][_0x7512('0x1f')]||null:null,'attributes':_0x2f04fb['options']?_0x2f04fb[_0x7512('0x1d')][_0x7512('0x20')]||null:null,'limit':_0x2f04fb[_0x7512('0x1d')]?_0x2f04fb[_0x7512('0x1d')][_0x7512('0x21')]||null:null,'include':_0x2f04fb['options']?_0x2f04fb[_0x7512('0x1d')][_0x7512('0x22')]?_['map'](_0x2f04fb[_0x7512('0x1d')]['include'],function(_0x5df068){return{'model':db[_0x5df068[_0x7512('0x23')]],'as':_0x5df068['as'],'attributes':_0x5df068[_0x7512('0x20')],'include':_0x5df068[_0x7512('0x22')]?_['map'](_0x5df068['include'],function(_0x5c8fdf){return{'model':db[_0x5c8fdf[_0x7512('0x23')]],'as':_0x5c8fdf['as'],'attributes':_0x5c8fdf['attributes'],'include':_0x5c8fdf['include']?_[_0x7512('0x24')](_0x5c8fdf['include'],function(_0x1c0442){return{'model':db[_0x1c0442[_0x7512('0x23')]],'as':_0x1c0442['as'],'attributes':_0x1c0442[_0x7512('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4cc591){logger[_0x7512('0x11')](_0x7512('0x1b'),_0x2f04fb);logger[_0x7512('0x14')](_0x7512('0x1b'),_0x2f04fb,JSON['stringify'](_0x4cc591));_0x581d56(_0x4cc591);})[_0x7512('0x1a')](function(_0x4e6690){logger['error'](_0x7512('0x1b'),_0x4e6690[_0x7512('0x18')],_0x2f04fb);_0x3c8b39(_0x3900f3['error'](0x1f4,_0x4e6690['message']));});});};exports[_0x7512('0x25')]=function(_0x5d6005){var _0x3964cb=this;return new Promise(function(_0x45313a,_0x3afca9){return db[_0x7512('0x1c')]['find']({'raw':_0x5d6005[_0x7512('0x1d')]?_0x5d6005['options'][_0x7512('0x1e')]===undefined?!![]:![]:!![],'where':_0x5d6005[_0x7512('0x1d')]?_0x5d6005['options']['where']||null:null,'attributes':_0x5d6005[_0x7512('0x1d')]?_0x5d6005[_0x7512('0x1d')]['attributes']||null:null,'include':_0x5d6005[_0x7512('0x1d')]?_0x5d6005[_0x7512('0x1d')][_0x7512('0x22')]?_[_0x7512('0x24')](_0x5d6005[_0x7512('0x1d')][_0x7512('0x22')],function(_0x5b566d){return{'model':db[_0x5b566d[_0x7512('0x23')]],'as':_0x5b566d['as'],'attributes':_0x5b566d[_0x7512('0x20')],'include':_0x5b566d[_0x7512('0x22')]?_['map'](_0x5b566d[_0x7512('0x22')],function(_0xe24aa6){return{'model':db[_0xe24aa6['model']],'as':_0xe24aa6['as'],'attributes':_0xe24aa6[_0x7512('0x20')],'include':_0xe24aa6[_0x7512('0x22')]?_['map'](_0xe24aa6[_0x7512('0x22')],function(_0x5cc6a1){return{'model':db[_0x5cc6a1[_0x7512('0x23')]],'as':_0x5cc6a1['as'],'attributes':_0x5cc6a1[_0x7512('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ec0c3){logger['info'](_0x7512('0x25'),_0x5d6005);logger['debug'](_0x7512('0x25'),_0x5d6005,JSON[_0x7512('0x16')](_0x3ec0c3));_0x45313a(_0x3ec0c3);})[_0x7512('0x1a')](function(_0x538c6e){logger[_0x7512('0x17')](_0x7512('0x25'),_0x538c6e[_0x7512('0x18')],_0x5d6005);_0x3afca9(_0x3964cb[_0x7512('0x17')](0x1f4,_0x538c6e['message']));});});};exports[_0x7512('0x26')]=function(_0x3e9635){var _0x524dc3=this;return new Promise(function(_0x5c140c,_0xd53c66){var _0x351946={'body':_0x3e9635[_0x7512('0x27')],'channel':_0x7512('0x28')};var _0x4653ea=_[_0x7512('0x29')](_[_0x7512('0x2a')](db[_0x7512('0x2b')]['rawAttributes']),[_0x7512('0x2c'),_0x7512('0x2d'),_0x7512('0x2e'),_0x7512('0x2f')]);var _0x120cac=![];if(_0x3e9635[_0x7512('0x27')]['id']){delete _0x3e9635['body']['id'];}if(_[_0x7512('0x30')](_0x3e9635['body'][_0x7512('0x31')])){return _0xd53c66(_0x524dc3['error'](0x1f4,_0x7512('0x32')));}if(_['isNil'](_0x3e9635[_0x7512('0x27')][_0x7512('0x27')])||_0x3e9635[_0x7512('0x27')][_0x7512('0x27')]===''){return _0xd53c66(_0x524dc3['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x7512('0x30')](_0x3e9635[_0x7512('0x27')][_0x7512('0x33')])){return _0xd53c66(_0x524dc3[_0x7512('0x17')](0x1f4,_0x7512('0x34')+_0x4653ea));}if(!_[_0x7512('0x35')](_0x4653ea,_0x3e9635[_0x7512('0x27')]['mapKey'])){return _0xd53c66(_0x524dc3['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4653ea));}var _0x27eb88={};_0x27eb88[_0x3e9635['body'][_0x7512('0x33')]]=_0x3e9635[_0x7512('0x27')]['from'];return db[_0x7512('0x1c')]['find']({'where':{'id':_0x3e9635['account']['id']},'include':[{'model':db['CmList'],'as':_0x7512('0x36'),'include':[{'model':db[_0x7512('0x2b')],'as':'Contacts','where':_0x27eb88,'limit':0x1,'order':[[_0x7512('0x2d'),_0x7512('0x37')]]}]},{'model':db[_0x7512('0x38')],'as':'Applications'},{'model':db['MailServerOut'],'as':'Smtp'}]})[_0x7512('0x10')](function(_0x3b5217){if(_0x3b5217&&_0x3b5217['List']){var _0x5afa78=_0x3b5217[_0x7512('0x39')]({'plain':!![]});_0x351946['account']=_[_0x7512('0x3a')](_0x5afa78,[_0x7512('0x3b'),'List']);_0x351946['applications']=_0x5afa78[_0x7512('0x3b')];_0x351946[_0x7512('0x3c')]=_0x5afa78[_0x7512('0x36')];_0x351946[_0x7512('0x3d')]=_[_0x7512('0x3e')](_0x351946[_0x7512('0x3d')],[_0x7512('0x3f')],[_0x7512('0x40')]);if(_0x351946[_0x7512('0x41')]&&_0x351946[_0x7512('0x41')][_0x7512('0x42')]){_0x351946[_0x7512('0x3d')]['push']({'id':0x0,'priority':_0x351946[_0x7512('0x3d')][_0x7512('0x43')]+0x1,'app':_0x7512('0x44'),'appdata':_0x7512('0x42'),'interval':'*,*,*,*'});}if(_0x351946[_0x7512('0x41')][_0x7512('0x3b')]){delete _0x351946['account'][_0x7512('0x3b')];}if(_0x351946[_0x7512('0x41')][_0x7512('0x36')]){delete _0x351946[_0x7512('0x41')][_0x7512('0x36')];}if(_0x5afa78['List'][_0x7512('0x45')][_0x7512('0x43')]){return _0x5afa78[_0x7512('0x36')][_0x7512('0x45')][0x0];}var _0xef3299=_[_0x7512('0x46')](_0x3e9635[_0x7512('0x27')],{'firstName':_0x3e9635[_0x7512('0x27')][_0x7512('0x31')],'ListId':_0x5afa78[_0x7512('0x2f')]});_0xef3299[_0x3e9635[_0x7512('0x27')][_0x7512('0x33')]]=_0x3e9635['body']['from'];return db[_0x7512('0x2b')][_0x7512('0x47')](_0xef3299);}else{throw new Error(_0x7512('0x48'));}})[_0x7512('0x10')](function(_0x37fe87){_0x351946['contact']=_0x37fe87;if(_0x37fe87){if(!_0x3e9635[_0x7512('0x27')]['message']['messageId']){_0x3e9635['body'][_0x7512('0x18')][_0x7512('0x49')]=rs[_0x7512('0x4a')]()+'\x20'+_0x3e9635[_0x7512('0x27')][_0x7512('0x18')]['from'];}var _0x51ce39={'ContactId':_0x37fe87['id'],'MailAccountId':_0x3e9635[_0x7512('0x41')]['id'],'inReplyTo':_0x3e9635['body'][_0x7512('0x18')][_0x7512('0x49')],'to':_0x3e9635['body'][_0x7512('0x18')][_0x7512('0x31')],'cc':_0x3e9635[_0x7512('0x27')][_0x7512('0x18')]['cc'],'subject':_0x3e9635[_0x7512('0x27')][_0x7512('0x18')][_0x7512('0x4b')],'attach':_0x3e9635[_0x7512('0x27')][_0x7512('0x18')][_0x7512('0x4c')],'lastMsgAt':moment()[_0x7512('0x4d')](_0x7512('0x4e')),'lastMsgDirection':'in','lastMsgBody':_0x3e9635['body'][_0x7512('0x27')]};return db[_0x7512('0x4f')][_0x7512('0x50')]({'where':{'closed':![],'MailAccountId':_0x3e9635[_0x7512('0x41')]['id']},'include':[{'model':db[_0x7512('0x51')],'as':_0x7512('0x52'),'attributes':[_0x7512('0x49')],'where':{'messageId':_0x3e9635['body'][_0x7512('0x18')][_0x7512('0x53')]}}]})[_0x7512('0x10')](function(_0x37c8e1){if(_0x37c8e1){return[_0x37c8e1,![]];}return db[_0x7512('0x4f')]['create'](_0x51ce39)[_0x7512('0x10')](function(_0x18bf65){return[_0x18bf65,!![]];});});}else{throw new Error(_0x7512('0x54'));}})['spread'](function(_0x9abbd7,_0x2e2399){if(_0x9abbd7){_0x120cac=_0x2e2399;if(!_0x2e2399){return _0x9abbd7[_0x7512('0x55')]({'inReplyTo':_0x3e9635[_0x7512('0x27')][_0x7512('0x18')][_0x7512('0x49')],'to':_0x3e9635['body'][_0x7512('0x18')][_0x7512('0x31')],'cc':_0x3e9635['body']['message']['cc'],'subject':_0x3e9635['body'][_0x7512('0x18')][_0x7512('0x4b')],'attach':_0x9abbd7['attach']?_0x9abbd7[_0x7512('0x4c')]:_0x3e9635[_0x7512('0x27')][_0x7512('0x18')][_0x7512('0x4c')],'substatus':null,'substatusAt':moment()[_0x7512('0x4d')](_0x7512('0x4e')),'lastMsgAt':moment()['format'](_0x7512('0x4e')),'lastMsgDirection':'in','lastMsgBody':_0x3e9635['body'][_0x7512('0x27')]});}else{return _0x9abbd7;}}})['then'](function(_0x11e659){_0x351946[_0x7512('0x56')]=_0x11e659[_0x7512('0x39')]({'plain':!![]});_0x351946[_0x7512('0x56')]['created']=_0x120cac;return db[_0x7512('0x51')][_0x7512('0x47')]({'body':_0x3e9635[_0x7512('0x27')][_0x7512('0x27')],'MailAccountId':_0x3e9635[_0x7512('0x41')]['id'],'MailInteractionId':_0x11e659['id'],'direction':'in','ContactId':_0x351946[_0x7512('0x57')]['id'],'messageId':_0x3e9635[_0x7512('0x27')][_0x7512('0x18')][_0x7512('0x49')],'from':_0x3e9635[_0x7512('0x27')][_0x7512('0x18')]['from'],'to':_0x3e9635['body'][_0x7512('0x18')]['to'],'cc':_0x3e9635['body'][_0x7512('0x18')]['cc'],'subject':_0x3e9635['body'][_0x7512('0x18')]['subject'],'attach':_0x3e9635['body'][_0x7512('0x18')]['attach'],'Attachments':_0x3e9635[_0x7512('0x27')][_0x7512('0x18')][_0x7512('0x58')],'originTo':_0x3e9635[_0x7512('0x27')][_0x7512('0x18')][_0x7512('0x59')],'originCc':_0x3e9635[_0x7512('0x27')][_0x7512('0x18')][_0x7512('0x5a')],'bcc':_0x3e9635[_0x7512('0x27')]['message'][_0x7512('0x5b')]},{'include':[{'model':db[_0x7512('0x5c')],'as':_0x7512('0x5d')}]});})[_0x7512('0x10')](function(_0x22d725){_0x351946['message']=_0x22d725;if(_0x351946[_0x7512('0x56')][_0x7512('0x5e')]){return db['User'][_0x7512('0x50')]({'attributes':['id',_0x7512('0x5f')],'where':{'id':_0x351946[_0x7512('0x56')][_0x7512('0x5e')]}})[_0x7512('0x10')](function(_0x10f651){if(_0x10f651){_0x351946[_0x7512('0x3d')][_0x7512('0x60')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x10f651[_0x7512('0x5f')]+','+(_0x351946[_0x7512('0x41')][_0x7512('0x61')]||0xa),'interval':_0x7512('0x62')});}return respondWithRpcPromise(_0x7512('0x63'),_0x7512('0x64'),_0x351946);});}return respondWithRpcPromise('Start',_0x7512('0x64'),_0x351946);})[_0x7512('0x10')](function(_0x1e3c84){_0x5c140c(_0x1e3c84);})[_0x7512('0x1a')](function(_0x34b5c1){_0xd53c66(_0x524dc3[_0x7512('0x17')](0x1f4,_0x34b5c1[_0x7512('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 5408c66..cec0d20 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 _0x29af=['./mailAccount.events','save','remove','emit','removeListener','length','mailAccount:'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x29af,0x134));var _0xf29a=function(_0x14d469,_0xbe25e4){_0x14d469=_0x14d469-0x0;var _0x13fbd7=_0x29af[_0x14d469];return _0x13fbd7;};'use strict';var MailAccountEvents=require(_0xf29a('0x0'));var events=[_0xf29a('0x1'),_0xf29a('0x2'),'update'];function createListener(_0x133327,_0x13cfd8){return function(_0x58929e){_0x13cfd8[_0xf29a('0x3')](_0x133327,_0x58929e);};}function removeListener(_0x505d15,_0x37e156){return function(){MailAccountEvents[_0xf29a('0x4')](_0x505d15,_0x37e156);};}exports['register']=function(_0x553398){for(var _0x2e25dc=0x0,_0x2c111b=events[_0xf29a('0x5')];_0x2e25dc<_0x2c111b;_0x2e25dc++){var _0x33a308=events[_0x2e25dc];var _0x347d76=createListener(_0xf29a('0x6')+_0x33a308,_0x553398);MailAccountEvents['on'](_0x33a308,_0x347d76);}}; \ No newline at end of file +var _0x3248=['remove','update','removeListener','length','mailAccount:','./mailAccount.events','save'];(function(_0x8f7825,_0xaa0ca0){var _0x29a7c9=function(_0x43f1eb){while(--_0x43f1eb){_0x8f7825['push'](_0x8f7825['shift']());}};_0x29a7c9(++_0xaa0ca0);}(_0x3248,0x1b0));var _0x8324=function(_0x341535,_0x3d2e98){_0x341535=_0x341535-0x0;var _0x390503=_0x3248[_0x341535];return _0x390503;};'use strict';var MailAccountEvents=require(_0x8324('0x0'));var events=[_0x8324('0x1'),_0x8324('0x2'),_0x8324('0x3')];function createListener(_0x9b580,_0x23b671){return function(_0x3ab598){_0x23b671['emit'](_0x9b580,_0x3ab598);};}function removeListener(_0x4c565b,_0x2e46f3){return function(){MailAccountEvents[_0x8324('0x4')](_0x4c565b,_0x2e46f3);};}exports['register']=function(_0x18edd2){for(var _0x283f5f=0x0,_0x446423=events[_0x8324('0x5')];_0x283f5f<_0x446423;_0x283f5f++){var _0x215c15=events[_0x283f5f];var _0x5d5f01=createListener(_0x8324('0x6')+_0x215c15,_0x18edd2);MailAccountEvents['on'](_0x215c15,_0x5d5f01);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index aa842eb..18a805b 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 _0x9ffd=['show','put','/:id','update','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','isAuthenticated'];(function(_0x45ecc8,_0x36f750){var _0x18fbdc=function(_0x2de459){while(--_0x2de459){_0x45ecc8['push'](_0x45ecc8['shift']());}};_0x18fbdc(++_0x36f750);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x5ed64a,_0x2d85bc){_0x5ed64a=_0x5ed64a-0x0;var _0x304f14=_0x9ffd[_0x5ed64a];return _0x304f14;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var auth=require(_0xd9ff('0x5'));var interaction=require(_0xd9ff('0x6'));var config=require('../../config/environment');var controller=require(_0xd9ff('0x7'));router[_0xd9ff('0x8')]('/:id',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xe')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xeb74=['update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','put'];(function(_0x419571,_0x5ad855){var _0x28be78=function(_0x4e2f0c){while(--_0x4e2f0c){_0x419571['push'](_0x419571['shift']());}};_0x28be78(++_0x5ad855);}(_0xeb74,0xe3));var _0x4eb7=function(_0x1a6cbe,_0x48afd6){_0x1a6cbe=_0x1a6cbe-0x0;var _0x38aec0=_0xeb74[_0x1a6cbe];return _0x38aec0;};'use strict';var multer=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var path=require(_0x4eb7('0x2'));var timeout=require(_0x4eb7('0x3'));var express=require(_0x4eb7('0x4'));var router=express[_0x4eb7('0x5')]();var auth=require(_0x4eb7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4eb7('0x7'));var controller=require(_0x4eb7('0x8'));router[_0x4eb7('0x9')](_0x4eb7('0xa'),auth[_0x4eb7('0xb')](),controller['show']);router[_0x4eb7('0xc')]('/:id',auth[_0x4eb7('0xb')](),controller[_0x4eb7('0xd')]);router['delete']('/:id',auth[_0x4eb7('0xb')](),controller[_0x4eb7('0xe')]);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 a66f2f0..227d19d 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 _0x2ae2=['INTEGER','STRING','noop','*,*,*,*','sequelize','exports'];(function(_0x5f1f49,_0x3c95b9){var _0x5c5528=function(_0x2c699e){while(--_0x2c699e){_0x5f1f49['push'](_0x5f1f49['shift']());}};_0x5c5528(++_0x3c95b9);}(_0x2ae2,0x106));var _0x22ae=function(_0x25eb68,_0x2b9197){_0x25eb68=_0x25eb68-0x0;var _0x359151=_0x2ae2[_0x25eb68];return _0x359151;};'use strict';var Sequelize=require(_0x22ae('0x0'));module[_0x22ae('0x1')]={'priority':{'type':Sequelize[_0x22ae('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x22ae('0x3')],'allowNull':![],'defaultValue':_0x22ae('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x22ae('0x3')]},'interval':{'type':Sequelize[_0x22ae('0x3')],'defaultValue':_0x22ae('0x5')}}; \ No newline at end of file +var _0xa241=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa241,0xa5));var _0x1a24=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa241[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x1a24('0x0'));module[_0x1a24('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x1a24('0x2')],'allowNull':![],'defaultValue':_0x1a24('0x3')},'appdata':{'type':Sequelize[_0x1a24('0x4')]()},'description':{'type':Sequelize[_0x1a24('0x2')]},'interval':{'type':Sequelize[_0x1a24('0x2')],'defaultValue':_0x1a24('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 97a5fb4..25d02e8 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 _0x0298=['json','count','offset','limit','set','Content-Range','save','then','destroy','error','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','catch','update','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','status','end'];(function(_0x5432e3,_0x209a84){var _0x365781=function(_0x19b0f5){while(--_0x19b0f5){_0x5432e3['push'](_0x5432e3['shift']());}};_0x365781(++_0x209a84);}(_0x0298,0x95));var _0x8029=function(_0x4642ab,_0x289453){_0x4642ab=_0x4642ab-0x0;var _0x28c63b=_0x0298[_0x4642ab];return _0x28c63b;};'use strict';var pdf=require(_0x8029('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8029('0x1'));var zipdir=require(_0x8029('0x2'));var jsonpatch=require(_0x8029('0x3'));var rp=require(_0x8029('0x4'));var moment=require(_0x8029('0x5'));var BPromise=require(_0x8029('0x6'));var Mustache=require(_0x8029('0x7'));var util=require(_0x8029('0x8'));var path=require(_0x8029('0x9'));var sox=require('sox');var csv=require(_0x8029('0xa'));var ejs=require(_0x8029('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8029('0xc'));var crypto=require(_0x8029('0xd'));var jsforce=require(_0x8029('0xe'));var deskjs=require(_0x8029('0xf'));var toCsv=require(_0x8029('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8029('0x10'));var authService=require(_0x8029('0x11'));var qs=require(_0x8029('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8029('0x13'))(_0x8029('0x14'));var utils=require('../../config/utils');var config=require(_0x8029('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38260e,_0x2be145){_0x2be145=_0x2be145||0xcc;return function(_0x24adac){if(_0x24adac){return _0x38260e[_0x8029('0x16')](_0x2be145);}return _0x38260e[_0x8029('0x17')](_0x2be145)[_0x8029('0x18')]();};}function respondWithResult(_0x594c05,_0x16f994){_0x16f994=_0x16f994||0xc8;return function(_0x3cf1f0){if(_0x3cf1f0){return _0x594c05[_0x8029('0x17')](_0x16f994)[_0x8029('0x19')](_0x3cf1f0);}};}function respondWithFilteredResult(_0x57e243,_0x4b4904){return function(_0x4a7abc){if(_0x4a7abc){var _0x3fdf4b=_0x4a7abc[_0x8029('0x1a')],_0xcea0a8=_0x4b4904[_0x8029('0x1b')],_0x6615a5=_0x4b4904['offset']+_0x4b4904[_0x8029('0x1c')],_0x1cef49;if(_0x6615a5>=_0x3fdf4b){_0x6615a5=_0x3fdf4b;_0x1cef49=0xc8;}else{_0x1cef49=0xce;}_0x57e243[_0x8029('0x17')](_0x1cef49);return _0x57e243[_0x8029('0x1d')](_0x8029('0x1e'),_0xcea0a8+'-'+_0x6615a5+'/'+_0x3fdf4b)['json'](_0x4a7abc);}return null;};}function patchUpdates(_0x3e3ab2){return function(_0x2d2516){try{jsonpatch['apply'](_0x2d2516,_0x3e3ab2,!![]);}catch(_0x326e58){return BPromise['reject'](_0x326e58);}return _0x2d2516[_0x8029('0x1f')]();};}function saveUpdates(_0x16d185,_0xd9b93f){return function(_0x40d3b5){if(_0x40d3b5){return _0x40d3b5['update'](_0x16d185)[_0x8029('0x20')](function(_0x2cb9c6){return _0x2cb9c6;});}return null;};}function removeEntity(_0x495909,_0x555879){return function(_0xef370a){if(_0xef370a){return _0xef370a[_0x8029('0x21')]()[_0x8029('0x20')](function(){_0x495909[_0x8029('0x17')](0xcc)[_0x8029('0x18')]();});}};}function handleEntityNotFound(_0x181f66,_0x385e5a){return function(_0x432c4b){if(!_0x432c4b){_0x181f66[_0x8029('0x16')](0x194);}return _0x432c4b;};}function handleError(_0x2e083d,_0x4689bc){_0x4689bc=_0x4689bc||0x1f4;return function(_0x4032a9){logger[_0x8029('0x22')](_0x4032a9[_0x8029('0x23')]);if(_0x4032a9[_0x8029('0x24')]){delete _0x4032a9[_0x8029('0x24')];}_0x2e083d[_0x8029('0x17')](_0x4689bc)[_0x8029('0x25')](_0x4032a9);};}exports[_0x8029('0x26')]=function(_0x194fbd,_0x53de5b){var _0x3525ed={'raw':!![],'where':{'id':_0x194fbd[_0x8029('0x27')]['id']}},_0x479a21={};_0x479a21[_0x8029('0x28')]=_[_0x8029('0x29')](db[_0x8029('0x2a')][_0x8029('0x2b')]);_0x479a21['query']=_[_0x8029('0x29')](_0x194fbd[_0x8029('0x2c')]);_0x479a21[_0x8029('0x2d')]=_[_0x8029('0x2e')](_0x479a21[_0x8029('0x28')],_0x479a21['query']);_0x3525ed[_0x8029('0x2f')]=_[_0x8029('0x2e')](_0x479a21['model'],qs[_0x8029('0x30')](_0x194fbd['query'][_0x8029('0x30')]));_0x3525ed[_0x8029('0x2f')]=_0x3525ed[_0x8029('0x2f')][_0x8029('0x31')]?_0x3525ed[_0x8029('0x2f')]:_0x479a21[_0x8029('0x28')];if(_0x194fbd['query'][_0x8029('0x32')]){_0x3525ed[_0x8029('0x33')]=[{'all':!![]}];}_0x3525ed=_[_0x8029('0x34')]({},_0x3525ed,_0x194fbd[_0x8029('0x35')]);return db['MailApplication']['find'](_0x3525ed)['then'](handleEntityNotFound(_0x53de5b,null))['then'](respondWithResult(_0x53de5b,null))[_0x8029('0x36')](handleError(_0x53de5b,null));};exports[_0x8029('0x37')]=function(_0x3be1f4,_0x1b2097){if(_0x3be1f4[_0x8029('0x38')]['id']){delete _0x3be1f4[_0x8029('0x38')]['id'];}return db['MailApplication'][_0x8029('0x39')]({'where':{'id':_0x3be1f4[_0x8029('0x27')]['id']}})[_0x8029('0x20')](handleEntityNotFound(_0x1b2097,null))['then'](saveUpdates(_0x3be1f4['body'],null))[_0x8029('0x20')](respondWithResult(_0x1b2097,null))[_0x8029('0x36')](handleError(_0x1b2097,null));};exports['destroy']=function(_0x3d58d2,_0x2bc543){return db[_0x8029('0x2a')][_0x8029('0x39')]({'where':{'id':_0x3d58d2[_0x8029('0x27')]['id']}})[_0x8029('0x20')](handleEntityNotFound(_0x2bc543,null))[_0x8029('0x20')](removeEntity(_0x2bc543,null))[_0x8029('0x36')](handleError(_0x2bc543,null));}; \ No newline at end of file +var _0xaaa7=['includeAll','include','merge','options','find','update','body','catch','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','fields','attributes','length'];(function(_0x2207dd,_0x3806c6){var _0x5ebbb2=function(_0x29f3bf){while(--_0x29f3bf){_0x2207dd['push'](_0x2207dd['shift']());}};_0x5ebbb2(++_0x3806c6);}(_0xaaa7,0x15e));var _0x7aaa=function(_0x5e204d,_0x19466d){_0x5e204d=_0x5e204d-0x0;var _0x3e4a3f=_0xaaa7[_0x5e204d];return _0x3e4a3f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7aaa('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7aaa('0x1'));var rp=require(_0x7aaa('0x2'));var moment=require(_0x7aaa('0x3'));var BPromise=require(_0x7aaa('0x4'));var Mustache=require(_0x7aaa('0x5'));var util=require(_0x7aaa('0x6'));var path=require(_0x7aaa('0x7'));var sox=require(_0x7aaa('0x8'));var csv=require('to-csv');var ejs=require(_0x7aaa('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7aaa('0xa'));var crypto=require(_0x7aaa('0xb'));var jsforce=require(_0x7aaa('0xc'));var deskjs=require(_0x7aaa('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7aaa('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7aaa('0xf'));var qs=require(_0x7aaa('0x10'));var as=require(_0x7aaa('0x11'));var hardwareService=require(_0x7aaa('0x12'));var logger=require(_0x7aaa('0x13'))(_0x7aaa('0x14'));var utils=require(_0x7aaa('0x15'));var config=require(_0x7aaa('0x16'));var db=require(_0x7aaa('0x17'))['db'];function respondWithStatusCode(_0xdb272,_0x2300d8){_0x2300d8=_0x2300d8||0xcc;return function(_0x2a8294){if(_0x2a8294){return _0xdb272['sendStatus'](_0x2300d8);}return _0xdb272[_0x7aaa('0x18')](_0x2300d8)[_0x7aaa('0x19')]();};}function respondWithResult(_0x247c9b,_0x3448a3){_0x3448a3=_0x3448a3||0xc8;return function(_0x4d746b){if(_0x4d746b){return _0x247c9b[_0x7aaa('0x18')](_0x3448a3)['json'](_0x4d746b);}};}function respondWithFilteredResult(_0xdb644f,_0x3b3263){return function(_0x52be0d){if(_0x52be0d){var _0x4f0194=_0x52be0d[_0x7aaa('0x1a')],_0x7a4bf7=_0x3b3263[_0x7aaa('0x1b')],_0x1dd347=_0x3b3263['offset']+_0x3b3263[_0x7aaa('0x1c')],_0x2f87c6;if(_0x1dd347>=_0x4f0194){_0x1dd347=_0x4f0194;_0x2f87c6=0xc8;}else{_0x2f87c6=0xce;}_0xdb644f['status'](_0x2f87c6);return _0xdb644f['set'](_0x7aaa('0x1d'),_0x7a4bf7+'-'+_0x1dd347+'/'+_0x4f0194)['json'](_0x52be0d);}return null;};}function patchUpdates(_0x17743d){return function(_0x4932c2){try{jsonpatch[_0x7aaa('0x1e')](_0x4932c2,_0x17743d,!![]);}catch(_0x29c759){return BPromise[_0x7aaa('0x1f')](_0x29c759);}return _0x4932c2[_0x7aaa('0x20')]();};}function saveUpdates(_0x15e07f,_0x55e650){return function(_0x51cc3d){if(_0x51cc3d){return _0x51cc3d['update'](_0x15e07f)[_0x7aaa('0x21')](function(_0x35bf08){return _0x35bf08;});}return null;};}function removeEntity(_0x4edec1,_0x3b83ae){return function(_0x19c0e7){if(_0x19c0e7){return _0x19c0e7[_0x7aaa('0x22')]()[_0x7aaa('0x21')](function(){_0x4edec1[_0x7aaa('0x18')](0xcc)[_0x7aaa('0x19')]();});}};}function handleEntityNotFound(_0x39cc21,_0xa8532a){return function(_0x3a75fb){if(!_0x3a75fb){_0x39cc21[_0x7aaa('0x23')](0x194);}return _0x3a75fb;};}function handleError(_0x20a13f,_0xd6dfa){_0xd6dfa=_0xd6dfa||0x1f4;return function(_0x4f32b7){logger['error'](_0x4f32b7[_0x7aaa('0x24')]);if(_0x4f32b7[_0x7aaa('0x25')]){delete _0x4f32b7[_0x7aaa('0x25')];}_0x20a13f[_0x7aaa('0x18')](_0xd6dfa)[_0x7aaa('0x26')](_0x4f32b7);};}exports[_0x7aaa('0x27')]=function(_0x1cf91a,_0x398a26){var _0x37eb29={'raw':!![],'where':{'id':_0x1cf91a[_0x7aaa('0x28')]['id']}},_0x248ab8={};_0x248ab8[_0x7aaa('0x29')]=_[_0x7aaa('0x2a')](db[_0x7aaa('0x2b')][_0x7aaa('0x2c')]);_0x248ab8['query']=_[_0x7aaa('0x2a')](_0x1cf91a[_0x7aaa('0x2d')]);_0x248ab8['filters']=_['intersection'](_0x248ab8[_0x7aaa('0x29')],_0x248ab8[_0x7aaa('0x2d')]);_0x37eb29['attributes']=_['intersection'](_0x248ab8[_0x7aaa('0x29')],qs[_0x7aaa('0x2e')](_0x1cf91a[_0x7aaa('0x2d')][_0x7aaa('0x2e')]));_0x37eb29[_0x7aaa('0x2f')]=_0x37eb29['attributes'][_0x7aaa('0x30')]?_0x37eb29[_0x7aaa('0x2f')]:_0x248ab8[_0x7aaa('0x29')];if(_0x1cf91a[_0x7aaa('0x2d')][_0x7aaa('0x31')]){_0x37eb29[_0x7aaa('0x32')]=[{'all':!![]}];}_0x37eb29=_[_0x7aaa('0x33')]({},_0x37eb29,_0x1cf91a[_0x7aaa('0x34')]);return db[_0x7aaa('0x2b')][_0x7aaa('0x35')](_0x37eb29)['then'](handleEntityNotFound(_0x398a26,null))['then'](respondWithResult(_0x398a26,null))['catch'](handleError(_0x398a26,null));};exports[_0x7aaa('0x36')]=function(_0x58a5a2,_0x258e3c){if(_0x58a5a2['body']['id']){delete _0x58a5a2[_0x7aaa('0x37')]['id'];}return db[_0x7aaa('0x2b')][_0x7aaa('0x35')]({'where':{'id':_0x58a5a2[_0x7aaa('0x28')]['id']}})[_0x7aaa('0x21')](handleEntityNotFound(_0x258e3c,null))['then'](saveUpdates(_0x58a5a2[_0x7aaa('0x37')],null))[_0x7aaa('0x21')](respondWithResult(_0x258e3c,null))['catch'](handleError(_0x258e3c,null));};exports[_0x7aaa('0x22')]=function(_0x3a12c1,_0x3e4111){return db['MailApplication']['find']({'where':{'id':_0x3a12c1[_0x7aaa('0x28')]['id']}})[_0x7aaa('0x21')](handleEntityNotFound(_0x3e4111,null))[_0x7aaa('0x21')](removeEntity(_0x3e4111,null))[_0x7aaa('0x38')](handleError(_0x3e4111,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 5ed0494..c90a038 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 _0xe1c4=['lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe1c4,0x1ec));var _0x4e1c=function(_0x4c7d49,_0x284cdf){_0x4c7d49=_0x4c7d49-0x0;var _0x212fb0=_0xe1c4[_0x4c7d49];return _0x212fb0;};'use strict';var _=require(_0x4e1c('0x0'));var util=require(_0x4e1c('0x1'));var logger=require(_0x4e1c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4e1c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e1c('0x4'));var rimraf=require(_0x4e1c('0x5'));var config=require(_0x4e1c('0x6'));var attributes=require('./mailApplication.attributes');module['exports']=function(_0x7af82a,_0x119617){return _0x7af82a[_0x4e1c('0x7')](_0x4e1c('0x8'),attributes,{'tableName':_0x4e1c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4e1c('0xa'),'collate':_0x4e1c('0xb')});}; \ No newline at end of file +var _0x4815=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x2989f5,_0x1a3dcb){var _0x3b42c9=function(_0x38d4c0){while(--_0x38d4c0){_0x2989f5['push'](_0x2989f5['shift']());}};_0x3b42c9(++_0x1a3dcb);}(_0x4815,0xff));var _0x5481=function(_0x4d4d8d,_0x31e6ae){_0x4d4d8d=_0x4d4d8d-0x0;var _0x5e7b40=_0x4815[_0x4d4d8d];return _0x5e7b40;};'use strict';var _=require(_0x5481('0x0'));var util=require(_0x5481('0x1'));var logger=require(_0x5481('0x2'))(_0x5481('0x3'));var moment=require(_0x5481('0x4'));var BPromise=require(_0x5481('0x5'));var rp=require(_0x5481('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5481('0x7'));var attributes=require(_0x5481('0x8'));module[_0x5481('0x9')]=function(_0x3de2c3,_0xa91d26){return _0x3de2c3[_0x5481('0xa')](_0x5481('0xb'),attributes,{'tableName':_0x5481('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5481('0xd'),'collate':_0x5481('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index b854a48..5eee622 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 _0x4885=['../../config/environment','jayson/promise','client','request','info','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','MailApplication,\x20%s,\x20%s','message','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','attributes','limit','debug','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x89a001,_0x3a9a8c){var _0x5f3ec2=function(_0x3e849b){while(--_0x3e849b){_0x89a001['push'](_0x89a001['shift']());}};_0x5f3ec2(++_0x3a9a8c);}(_0x4885,0x8b));var _0x5488=function(_0x1f9876,_0x486c48){_0x1f9876=_0x1f9876-0x0;var _0x5bab4d=_0x4885[_0x1f9876];return _0x5bab4d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5488('0x0'));var BPromise=require(_0x5488('0x1'));var rs=require(_0x5488('0x2'));var fs=require('fs');var Redis=require(_0x5488('0x3'));var db=require(_0x5488('0x4'))['db'];var utils=require(_0x5488('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5488('0x6'));var jayson=require(_0x5488('0x7'));var client=jayson[_0x5488('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33a74b,_0x58308d,_0x53de90){return new BPromise(function(_0x107b3d,_0x2f0edb){return client[_0x5488('0x9')](_0x33a74b,_0x53de90)['then'](function(_0x411f84){logger[_0x5488('0xa')]('MailApplication,\x20%s,\x20%s',_0x58308d,_0x5488('0xb'));logger['debug'](_0x5488('0xc'),_0x58308d,'request\x20sent',JSON[_0x5488('0xd')](_0x411f84));if(_0x411f84[_0x5488('0xe')]){if(_0x411f84['error'][_0x5488('0xf')]===0x1f4){logger[_0x5488('0xe')](_0x5488('0x10'),_0x58308d,_0x411f84[_0x5488('0xe')][_0x5488('0x11')]);return _0x2f0edb(_0x411f84[_0x5488('0xe')][_0x5488('0x11')]);}logger['error'](_0x5488('0x10'),_0x58308d,_0x411f84[_0x5488('0xe')][_0x5488('0x11')]);return _0x107b3d(_0x411f84[_0x5488('0xe')]['message']);}else{logger[_0x5488('0xa')](_0x5488('0x10'),_0x58308d,'request\x20sent');_0x107b3d(_0x411f84['result'][_0x5488('0x11')]);}})[_0x5488('0x12')](function(_0x31771e){logger[_0x5488('0xe')](_0x5488('0x10'),_0x58308d,_0x31771e);_0x2f0edb(_0x31771e);});});}exports[_0x5488('0x13')]=function(_0x292356){var _0x1c5553=this;return new Promise(function(_0x5ac1cd,_0x11dfae){return db[_0x5488('0x14')][_0x5488('0x15')](_0x292356[_0x5488('0x16')],{'raw':_0x292356[_0x5488('0x17')]?_0x292356[_0x5488('0x17')][_0x5488('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x292356[_0x5488('0x17')]?_0x292356[_0x5488('0x17')][_0x5488('0x19')]||null:null,'attributes':_0x292356[_0x5488('0x17')]?_0x292356[_0x5488('0x17')][_0x5488('0x1a')]||null:null,'limit':_0x292356[_0x5488('0x17')]?_0x292356['options'][_0x5488('0x1b')]||null:null})['then'](function(_0x6fe407){logger[_0x5488('0xa')]('UpdateMailApplication',_0x292356);logger[_0x5488('0x1c')](_0x5488('0x13'),_0x292356,JSON['stringify'](_0x6fe407));_0x5ac1cd(_0x6fe407);})[_0x5488('0x12')](function(_0x51288a){logger[_0x5488('0xe')](_0x5488('0x13'),_0x51288a[_0x5488('0x11')],_0x292356);_0x11dfae(_0x1c5553[_0x5488('0xe')](0x1f4,_0x51288a[_0x5488('0x11')]));});});}; \ No newline at end of file +var _0x5bb6=['http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','MailApplication','update','body','options','raw','UpdateMailApplication','debug','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x18abec,_0x4e833f){var _0x3faf0b=function(_0x22bd49){while(--_0x22bd49){_0x18abec['push'](_0x18abec['shift']());}};_0x3faf0b(++_0x4e833f);}(_0x5bb6,0x1a8));var _0x65bb=function(_0x6f1a59,_0x2bc9cf){_0x6f1a59=_0x6f1a59-0x0;var _0x58da9f=_0x5bb6[_0x6f1a59];return _0x58da9f;};'use strict';var _=require(_0x65bb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x65bb('0x1'));var rs=require(_0x65bb('0x2'));var fs=require('fs');var Redis=require(_0x65bb('0x3'));var db=require(_0x65bb('0x4'))['db'];var utils=require(_0x65bb('0x5'));var logger=require(_0x65bb('0x6'))(_0x65bb('0x7'));var config=require(_0x65bb('0x8'));var jayson=require(_0x65bb('0x9'));var client=jayson[_0x65bb('0xa')][_0x65bb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x258418,_0x41831f,_0x38ec7b){return new BPromise(function(_0x13cf8a,_0x3cc1b9){return client[_0x65bb('0xc')](_0x258418,_0x38ec7b)[_0x65bb('0xd')](function(_0x1382df){logger['info'](_0x65bb('0xe'),_0x41831f,_0x65bb('0xf'));logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x41831f,'request\x20sent',JSON[_0x65bb('0x10')](_0x1382df));if(_0x1382df[_0x65bb('0x11')]){if(_0x1382df[_0x65bb('0x11')][_0x65bb('0x12')]===0x1f4){logger[_0x65bb('0x11')](_0x65bb('0xe'),_0x41831f,_0x1382df[_0x65bb('0x11')]['message']);return _0x3cc1b9(_0x1382df['error'][_0x65bb('0x13')]);}logger[_0x65bb('0x11')](_0x65bb('0xe'),_0x41831f,_0x1382df['error']['message']);return _0x13cf8a(_0x1382df['error'][_0x65bb('0x13')]);}else{logger[_0x65bb('0x14')]('MailApplication,\x20%s,\x20%s',_0x41831f,_0x65bb('0xf'));_0x13cf8a(_0x1382df['result'][_0x65bb('0x13')]);}})[_0x65bb('0x15')](function(_0x3346cd){logger[_0x65bb('0x11')](_0x65bb('0xe'),_0x41831f,_0x3346cd);_0x3cc1b9(_0x3346cd);});});}exports['UpdateMailApplication']=function(_0x51fb74){var _0x5276f0=this;return new Promise(function(_0x5aca01,_0x8c7710){return db[_0x65bb('0x16')][_0x65bb('0x17')](_0x51fb74[_0x65bb('0x18')],{'raw':_0x51fb74['options']?_0x51fb74[_0x65bb('0x19')][_0x65bb('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51fb74[_0x65bb('0x19')]?_0x51fb74[_0x65bb('0x19')]['where']||null:null,'attributes':_0x51fb74['options']?_0x51fb74[_0x65bb('0x19')]['attributes']||null:null,'limit':_0x51fb74[_0x65bb('0x19')]?_0x51fb74[_0x65bb('0x19')]['limit']||null:null})[_0x65bb('0xd')](function(_0x50de8){logger['info'](_0x65bb('0x1b'),_0x51fb74);logger[_0x65bb('0x1c')](_0x65bb('0x1b'),_0x51fb74,JSON[_0x65bb('0x10')](_0x50de8));_0x5aca01(_0x50de8);})['catch'](function(_0x569288){logger['error']('UpdateMailApplication',_0x569288[_0x65bb('0x13')],_0x51fb74);_0x8c7710(_0x5276f0[_0x65bb('0x11')](0x1f4,_0x569288['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 9d36d5b..b145ce8 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 _0x8a87=['mailinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a87,0xa5));var _0x78a8=function(_0x5d225a,_0x2debe9){_0x5d225a=_0x5d225a-0x0;var _0x1e7761=_0x8a87[_0x5d225a];return _0x1e7761;};'use strict';var multer=require(_0x78a8('0x0'));var util=require('util');var path=require(_0x78a8('0x1'));var timeout=require(_0x78a8('0x2'));var express=require('express');var router=express[_0x78a8('0x3')]();var auth=require(_0x78a8('0x4'));var interaction=require(_0x78a8('0x5'));var config=require(_0x78a8('0x6'));var controller=require(_0x78a8('0x7'));router[_0x78a8('0x8')]('/',auth[_0x78a8('0x9')](),controller[_0x78a8('0xa')]);router[_0x78a8('0x8')](_0x78a8('0xb'),auth[_0x78a8('0x9')](),controller[_0x78a8('0xc')]);router['get'](_0x78a8('0xd'),auth[_0x78a8('0x9')](),controller[_0x78a8('0xe')]);router[_0x78a8('0x8')](_0x78a8('0xf'),auth[_0x78a8('0x9')](),controller['getMessages']);router['get'](_0x78a8('0x10'),auth[_0x78a8('0x9')](),controller['download']);router[_0x78a8('0x11')]('/',auth[_0x78a8('0x9')](),controller[_0x78a8('0x12')]);router[_0x78a8('0x11')]('/:id/messages',auth[_0x78a8('0x9')](),controller[_0x78a8('0x13')]);router[_0x78a8('0x11')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x78a8('0x14')](_0x78a8('0x15'),_0x78a8('0x16')),controller[_0x78a8('0x17')]);router[_0x78a8('0x18')](_0x78a8('0xd'),auth[_0x78a8('0x9')](),interaction[_0x78a8('0x14')]('mail',_0x78a8('0x19')),controller['update']);router[_0x78a8('0x1a')](_0x78a8('0xd'),auth[_0x78a8('0x9')](),interaction['tracked'](_0x78a8('0x15'),_0x78a8('0x1b')),controller[_0x78a8('0x1c')]);router[_0x78a8('0x1a')](_0x78a8('0x1d'),auth[_0x78a8('0x9')](),controller[_0x78a8('0x1e')]);module[_0x78a8('0x1f')]=router; \ No newline at end of file +var _0x74d8=['show','/:id/messages','getMessages','download','create','addMessage','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','delete','mailinteraction:destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','/describe','isAuthenticated','describe','/:id'];(function(_0x4faac6,_0x571919){var _0xdc1f3d=function(_0x1bcd6f){while(--_0x1bcd6f){_0x4faac6['push'](_0x4faac6['shift']());}};_0xdc1f3d(++_0x571919);}(_0x74d8,0xac));var _0x874d=function(_0x4d55e8,_0x55f6a5){_0x4d55e8=_0x4d55e8-0x0;var _0x2a85e9=_0x74d8[_0x4d55e8];return _0x2a85e9;};'use strict';var multer=require(_0x874d('0x0'));var util=require('util');var path=require(_0x874d('0x1'));var timeout=require(_0x874d('0x2'));var express=require(_0x874d('0x3'));var router=express[_0x874d('0x4')]();var auth=require(_0x874d('0x5'));var interaction=require(_0x874d('0x6'));var config=require(_0x874d('0x7'));var controller=require(_0x874d('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x874d('0x9')](_0x874d('0xa'),auth[_0x874d('0xb')](),controller[_0x874d('0xc')]);router[_0x874d('0x9')](_0x874d('0xd'),auth[_0x874d('0xb')](),controller[_0x874d('0xe')]);router[_0x874d('0x9')](_0x874d('0xf'),auth[_0x874d('0xb')](),controller[_0x874d('0x10')]);router[_0x874d('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x874d('0x11')]);router['post']('/',auth[_0x874d('0xb')](),controller[_0x874d('0x12')]);router['post']('/:id/messages',auth[_0x874d('0xb')](),controller[_0x874d('0x13')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction[_0x874d('0x14')](_0x874d('0x15'),_0x874d('0x16')),controller[_0x874d('0x17')]);router[_0x874d('0x18')]('/:id',auth[_0x874d('0xb')](),interaction['tracked'](_0x874d('0x15'),_0x874d('0x19')),controller['update']);router[_0x874d('0x1a')](_0x874d('0xd'),auth[_0x874d('0xb')](),interaction[_0x874d('0x14')]('mail',_0x874d('0x1b')),controller['destroy']);router[_0x874d('0x1a')](_0x874d('0x1c'),auth[_0x874d('0xb')](),controller[_0x874d('0x1d')]);module[_0x874d('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 4ce3b60..dca9c97 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 _0x435e=['STRING','TEXT','ENUM','out','long','sequelize','BOOLEAN','DATE'];(function(_0x55b1e6,_0x362af3){var _0x52d6af=function(_0x391e34){while(--_0x391e34){_0x55b1e6['push'](_0x55b1e6['shift']());}};_0x52d6af(++_0x362af3);}(_0x435e,0xdd));var _0xe435=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x435e[_0x119d5a];return _0x15bff4;};'use strict';var Sequelize=require(_0xe435('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0xe435('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe435('0x2')]},'disposition':{'type':Sequelize[_0xe435('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xe435('0x3')](0x1fe)},'to':{'type':Sequelize[_0xe435('0x3')]},'cc':{'type':Sequelize[_0xe435('0x4')]('long')},'subject':{'type':Sequelize[_0xe435('0x4')]()},'attach':{'type':Sequelize[_0xe435('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xe435('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xe435('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xe435('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xe435('0x5')]('in',_0xe435('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xe435('0x4')](_0xe435('0x7'))},'lastMsgText':{'type':Sequelize[_0xe435('0x4')]('long')}}; \ No newline at end of file +var _0x37e3=['BOOLEAN','out','ENUM','long','sequelize','exports','DATE','STRING','TEXT'];(function(_0x182df4,_0x549eb9){var _0x368c88=function(_0xe8ac27){while(--_0xe8ac27){_0x182df4['push'](_0x182df4['shift']());}};_0x368c88(++_0x549eb9);}(_0x37e3,0x1bd));var _0x337e=function(_0x2fe78e,_0x54229e){_0x2fe78e=_0x2fe78e-0x0;var _0x4f1c08=_0x37e3[_0x2fe78e];return _0x4f1c08;};'use strict';var Sequelize=require(_0x337e('0x0'));var iconv=require('iconv');module[_0x337e('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x337e('0x2')]},'disposition':{'type':Sequelize[_0x337e('0x3')]},'note':{'type':Sequelize[_0x337e('0x3')]},'inReplyTo':{'type':Sequelize[_0x337e('0x3')](0x1fe)},'to':{'type':Sequelize[_0x337e('0x3')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x337e('0x4')]()},'attach':{'type':Sequelize[_0x337e('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x337e('0x2')]},'substatus':{'type':Sequelize[_0x337e('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x337e('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x337e('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x337e('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x337e('0x7')]('in',_0x337e('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0x337e('0x8'))},'lastMsgText':{'type':Sequelize[_0x337e('0x4')](_0x337e('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index d304785..1cc4678 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 _0x3d36=['redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','then','destroy','error','name','send','Users','map','TagIds','split','forEach','Tags','findOne','lastMsgBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','plainBody','buildExpression','keys','some','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','toString','count','sequelize','keyBy','merge','a.key','Account.key','i.updatedAt','i.attach','i.subject','i.substatus','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','enableEmailPreview','push','all','rows','params','fields','includeAll','include','options','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','format','addTags','setTags','spread','emit','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','each','headers','Bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','log','err','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x5a94ac,_0x57438d){var _0x1d6ff4=function(_0x3c0112){while(--_0x3c0112){_0x5a94ac['push'](_0x5a94ac['shift']());}};_0x1d6ff4(++_0x57438d);}(_0x3d36,0xd1));var _0x63d3=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x3d36[_0x29d94e];return _0x106237;};'use strict';var pdf=require(_0x63d3('0x0'));var emlformat=require(_0x63d3('0x1'));var rimraf=require(_0x63d3('0x2'));var zipdir=require(_0x63d3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x63d3('0x4'));var moment=require('moment');var BPromise=require(_0x63d3('0x5'));var Mustache=require(_0x63d3('0x6'));var util=require(_0x63d3('0x7'));var path=require('path');var sox=require(_0x63d3('0x8'));var csv=require(_0x63d3('0x9'));var ejs=require(_0x63d3('0xa'));var fs=require('fs');var _=require(_0x63d3('0xb'));var squel=require(_0x63d3('0xc'));var crypto=require(_0x63d3('0xd'));var jsforce=require(_0x63d3('0xe'));var deskjs=require(_0x63d3('0xf'));var toCsv=require(_0x63d3('0x9'));var querystring=require(_0x63d3('0x10'));var Papa=require(_0x63d3('0x11'));var htmlToText=require('html-to-text');var Redis=require(_0x63d3('0x12'));var authService=require(_0x63d3('0x13'));var qs=require(_0x63d3('0x14'));var as=require(_0x63d3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x63d3('0x16'))(_0x63d3('0x17'));var utils=require(_0x63d3('0x18'));var config=require(_0x63d3('0x19'));var db=require(_0x63d3('0x1a'))['db'];config[_0x63d3('0x1b')]=_[_0x63d3('0x1c')](config[_0x63d3('0x1b')],{'host':_0x63d3('0x1d'),'port':0x18eb});var socket=require(_0x63d3('0x1e'))(new Redis(config[_0x63d3('0x1b')]));require(_0x63d3('0x1f'))[_0x63d3('0x20')](socket);function respondWithStatusCode(_0x467c73,_0x53206d){_0x53206d=_0x53206d||0xcc;return function(_0x1099f5){if(_0x1099f5){return _0x467c73[_0x63d3('0x21')](_0x53206d);}return _0x467c73[_0x63d3('0x22')](_0x53206d)[_0x63d3('0x23')]();};}function respondWithResult(_0x4a42db,_0x58b11e){_0x58b11e=_0x58b11e||0xc8;return function(_0x1bb2a3){if(_0x1bb2a3){return _0x4a42db['status'](_0x58b11e)[_0x63d3('0x24')](_0x1bb2a3);}};}function respondWithFilteredResult(_0x14ecce,_0x12a121){return function(_0x3de355){if(_0x3de355){var _0x53aae6=_0x3de355['count'],_0x2d2cd3=_0x12a121[_0x63d3('0x25')],_0xf129fa=_0x12a121[_0x63d3('0x25')]+_0x12a121[_0x63d3('0x26')],_0x3d0e76;if(_0xf129fa>=_0x53aae6){_0xf129fa=_0x53aae6;_0x3d0e76=0xc8;}else{_0x3d0e76=0xce;}_0x14ecce[_0x63d3('0x22')](_0x3d0e76);return _0x14ecce['set'](_0x63d3('0x27'),_0x2d2cd3+'-'+_0xf129fa+'/'+_0x53aae6)['json'](_0x3de355);}return null;};}function patchUpdates(_0x4b817d){return function(_0x4b8314){try{jsonpatch[_0x63d3('0x28')](_0x4b8314,_0x4b817d,!![]);}catch(_0x4aceda){return BPromise[_0x63d3('0x29')](_0x4aceda);}return _0x4b8314[_0x63d3('0x2a')]();};}function saveUpdates(_0x4e5e0e,_0x4fdf38){return function(_0xe7b94b){if(_0xe7b94b){return _0xe7b94b['update'](_0x4e5e0e)[_0x63d3('0x2b')](function(_0xad9c70){return _0xad9c70;});}return null;};}function removeEntity(_0x49fefa,_0x184ebb){return function(_0x43e542){if(_0x43e542){return _0x43e542[_0x63d3('0x2c')]()['then'](function(){_0x49fefa[_0x63d3('0x22')](0xcc)[_0x63d3('0x23')]();});}};}function handleEntityNotFound(_0x116fe7,_0x35b4d2){return function(_0x3b95d1){if(!_0x3b95d1){_0x116fe7[_0x63d3('0x21')](0x194);}return _0x3b95d1;};}function handleError(_0x40877b,_0x16b73b){_0x16b73b=_0x16b73b||0x1f4;return function(_0x79a825){logger[_0x63d3('0x2d')](_0x79a825['stack']);if(_0x79a825[_0x63d3('0x2e')]){delete _0x79a825[_0x63d3('0x2e')];}_0x40877b[_0x63d3('0x22')](_0x16b73b)[_0x63d3('0x2f')](_0x79a825);};}function getInteractionUsers(_0x475318,_0x1f3dc5){return new BPromise(function(_0x281f26,_0x503254){try{if(_0x1f3dc5[_0x475318['id']]){_0x475318[_0x63d3('0x30')]=_[_0x63d3('0x31')](_0x1f3dc5[_0x475318['id']],function(_0x46aec2){return{'id':_0x46aec2['id'],'fullname':_0x46aec2['fullname']};});}}catch(_0x33abf7){_0x503254(_0x33abf7);}_0x281f26(_0x475318);});}function getInteractionTags(_0x371fe5,_0x28a9ad){return new BPromise(function(_0xdb88a9,_0x46793f){try{if(_0x371fe5[_0x63d3('0x32')]){_0x371fe5['Tags']=[];_0x371fe5['TagIds'][_0x63d3('0x33')](',')[_0x63d3('0x34')](function(_0x5ea76b){_0x371fe5[_0x63d3('0x35')]['push'](_0x28a9ad[_0x5ea76b]);});}delete _0x371fe5[_0x63d3('0x32')];}catch(_0x2259a9){_0x46793f(_0x2259a9);}_0xdb88a9(_0x371fe5);});}function getLastMessageText(_0x2a9fc){return new BPromise(function(_0x13788d,_0x2ad8e5){return db['MailInteraction'][_0x63d3('0x36')]({'where':{'id':_0x2a9fc['id']},'attributes':[_0x63d3('0x37'),_0x63d3('0x38')],'raw':!![]})['then'](function(_0xbd1c1a){if(!_0xbd1c1a[_0x63d3('0x38')]){_0x2a9fc[_0x63d3('0x38')]=_[_0x63d3('0x39')](htmlToText['fromString'](_0xbd1c1a['lastMsgBody'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2a9fc[_0x63d3('0x38')]=_0xbd1c1a[_0x63d3('0x38')];}_0x13788d(_0x2a9fc);})[_0x63d3('0x3a')](function(_0x3cc0c2){_0x2ad8e5(_0x3cc0c2);});});}function updateMailInteraction(_0x1151b5,_0x27751b,_0xaa3602,_0x47de5e){return new BPromise(function(_0xe5db88,_0x23c816){return getInteractionUsers(_0x1151b5,_0xaa3602)[_0x63d3('0x2b')](function(_0x31e4be){return getInteractionTags(_0x31e4be,_0x27751b);})[_0x63d3('0x2b')](function(_0x263a8c){if(_0x47de5e){_0xe5db88(getLastMessageText(_0x263a8c));}else{_0xe5db88(_0x263a8c);}})['catch'](function(_0x2bc70e){_0x23c816(_0x2bc70e);});});}exports[_0x63d3('0x3b')]=function(_0x34c3c3,_0x273af8){var _0x3c3cbd={},_0x4a40c1={},_0x4395c4={'count':0x0,'rows':[]};var _0x525b99=_[_0x63d3('0x31')](db[_0x63d3('0x3c')][_0x63d3('0x3d')],function(_0x40dcdb){return{'name':_0x40dcdb[_0x63d3('0x3e')],'type':_0x40dcdb[_0x63d3('0x3f')][_0x63d3('0x40')]};});_0x4a40c1[_0x63d3('0x41')]=_['map'](_0x525b99,_0x63d3('0x2e'));_0x4a40c1[_0x63d3('0x42')]=_['keys'](_0x34c3c3[_0x63d3('0x42')]);_0x4a40c1[_0x63d3('0x43')]=_[_0x63d3('0x44')](_0x4a40c1['model'],_0x4a40c1['query']);_0x3c3cbd[_0x63d3('0x45')]=_[_0x63d3('0x44')](_0x4a40c1['model'],qs['fields'](_0x34c3c3[_0x63d3('0x42')]['fields']));_0x3c3cbd['attributes']=_0x3c3cbd[_0x63d3('0x45')][_0x63d3('0x46')]?_0x3c3cbd[_0x63d3('0x45')]:_0x4a40c1[_0x63d3('0x41')];if(!_0x34c3c3[_0x63d3('0x42')][_0x63d3('0x47')](_0x63d3('0x48'))){_0x3c3cbd[_0x63d3('0x26')]=qs['limit'](_0x34c3c3['query'][_0x63d3('0x26')]);_0x3c3cbd[_0x63d3('0x25')]=qs[_0x63d3('0x25')](_0x34c3c3[_0x63d3('0x42')][_0x63d3('0x25')]);}_0x3c3cbd[_0x63d3('0x49')]=qs[_0x63d3('0x4a')](_0x34c3c3[_0x63d3('0x42')][_0x63d3('0x4a')]);_0x3c3cbd[_0x63d3('0x4b')]=qs[_0x63d3('0x43')](_[_0x63d3('0x4c')](_0x34c3c3[_0x63d3('0x42')],_0x4a40c1['filters']));var _0x181ffe=[];var _0x5a612d=squel[_0x63d3('0x4d')]()['field']('id')[_0x63d3('0x4e')](_0x63d3('0x2e'))[_0x63d3('0x4e')](_0x63d3('0x4f'))[_0x63d3('0x50')](_0x63d3('0x51'));var _0x41e986=squel['select']()['field']('u.id')[_0x63d3('0x4e')]('u.fullname')[_0x63d3('0x4e')](_0x63d3('0x52'))[_0x63d3('0x50')](_0x63d3('0x53'),'ui')[_0x63d3('0x54')](_0x63d3('0x55'),'u',_0x63d3('0x56'));var _0x4febbc=squel[_0x63d3('0x4d')]()[_0x63d3('0x50')]('mail_interactions','i')[_0x63d3('0x54')]('cm_contacts','c',_0x63d3('0x57'))[_0x63d3('0x54')]('users','o',_0x63d3('0x58'))[_0x63d3('0x54')]('mail_accounts','a','a.id\x20=\x20i.MailAccountId')[_0x63d3('0x54')](_0x63d3('0x59'),'me',_0x63d3('0x5a'))[_0x63d3('0x54')](_0x63d3('0x5b'),'it',_0x63d3('0x5c'))['left_join'](_0x63d3('0x51'),'t','t.id\x20=\x20it.TagId');var _0xb91aa6=squel[_0x63d3('0x5d')]();var _0x173ee5=[];var _0x1a5315=squel[_0x63d3('0x5d')]();var _0x5cb29f;if(_0x34c3c3[_0x63d3('0x42')][_0x63d3('0x5e')]){_0x5cb29f=as[_0x63d3('0x5f')](_0x34c3c3[_0x63d3('0x42')][_0x63d3('0x5e')]);var _0x1bc7ea=_0x5cb29f['sqlOperator'];for(var _0x11d312=0x0;_0x11d312<_0x5cb29f[_0x63d3('0x60')][_0x63d3('0x46')];_0x11d312++){var _0x4cbf59=_0x5cb29f[_0x63d3('0x60')][_0x11d312];var _0x3ae17d='i';var _0x23ff01=_['find'](_0x525b99,['name',_0x4cbf59[_0x63d3('0x4e')]]);if(!_0x23ff01){switch(_0x4cbf59['field']){case _0x63d3('0x61'):if(_0x4cbf59[_0x63d3('0x62')]==0x1){_0x4febbc[_0x63d3('0x63')]('`'+_0x4cbf59[_0x63d3('0x4e')]+_0x63d3('0x64'));}else{_0x4febbc['having']('`'+_0x4cbf59[_0x63d3('0x4e')]+_0x63d3('0x65'));}break;case _0x63d3('0x66'):if(_0x4cbf59[_0x63d3('0x67')]==='$substring'){if(_0x4cbf59[_0x63d3('0x62')]['split']('\x20')[_0x63d3('0x46')]>0x1){_0xb91aa6[_0x1bc7ea](_0x63d3('0x68'),qs[_0x63d3('0x69')](_0x4cbf59[_0x63d3('0x62')]),null);}else{var _0x4b8994='%'+_0x4cbf59[_0x63d3('0x62')]+'%';_0xb91aa6[_0x1bc7ea](_0x63d3('0x6a'),_0x4b8994,_0x4b8994,_0x4b8994);}}else{_0x23ff01=_[_0x63d3('0x6b')](_0x525b99,[_0x63d3('0x2e'),'ContactId']);_0x4cbf59['field']=_0x63d3('0x6c');_0x341707=as['buildExpression'](_0x3ae17d,_0x23ff01['type'],_0x4cbf59);_0xb91aa6[_0x1bc7ea](_0x341707['text'],_0x341707[_0x63d3('0x62')][_0x63d3('0x6d')],_0x341707[_0x63d3('0x62')][_0x63d3('0x23')]);}break;case'Tag':var _0xc20b93=_0x4cbf59[_0x63d3('0x62')]['split'](',')['map'](function(_0x317768){return Number(_0x317768);});_0xc20b93['forEach'](function(_0x5d2dac){_0x1a5315['or'](_0x63d3('0x6e'),'%,'+_0x5d2dac+',%');});_0x173ee5=_[_0x63d3('0x6f')](_0x173ee5,_0xc20b93);break;case _0x63d3('0x70'):if(_0x4cbf59[_0x63d3('0x67')]===_0x63d3('0x71')){_0xb91aa6[_0x1bc7ea](_0x63d3('0x72'),'%'+_0x4cbf59[_0x63d3('0x62')]+'%',null);}else{_0x23ff01=_[_0x63d3('0x6b')](_0x525b99,[_0x63d3('0x2e'),'UserId']);_0x4cbf59[_0x63d3('0x4e')]=_0x63d3('0x73');_0x341707=as['buildExpression'](_0x3ae17d,_0x23ff01['type'],_0x4cbf59);_0xb91aa6[_0x1bc7ea](_0x341707[_0x63d3('0x74')],_0x341707[_0x63d3('0x62')]['start'],_0x341707['value'][_0x63d3('0x23')]);}break;case _0x63d3('0x75'):_0x341707=as[_0x63d3('0x76')]('me',null,_0x4cbf59);_0xb91aa6[_0x1bc7ea](_0x341707[_0x63d3('0x74')],_0x341707['value'][_0x63d3('0x6d')],_0x341707[_0x63d3('0x62')][_0x63d3('0x23')]);break;}}else{var _0x341707=as[_0x63d3('0x76')](_0x3ae17d,_0x23ff01[_0x63d3('0x3f')],_0x4cbf59);_0xb91aa6[_0x1bc7ea](_0x341707['text'],_0x341707[_0x63d3('0x62')]['start'],_0x341707[_0x63d3('0x62')][_0x63d3('0x23')]);}}}else{var _0x8d7ae4=_(_0x34c3c3[_0x63d3('0x42')])[_0x63d3('0x77')]()[_0x63d3('0x31')](function(_0x1c8ff7){return _[_0x63d3('0x78')](_0x525b99,[_0x63d3('0x2e'),_0x1c8ff7])?_0x1c8ff7:undefined;})['compact']()[_0x63d3('0x62')]();if(!_[_0x63d3('0x79')](_0x8d7ae4)){_0x8d7ae4['forEach'](function(_0x2b5205){if(_0x2b5205===_0x63d3('0x7a')){_0x4febbc[_0x63d3('0x4b')](_0x63d3('0x7b'),[][_0x63d3('0x7c')](_0x34c3c3[_0x63d3('0x42')][_0x2b5205]));}else if(_0x2b5205===_0x63d3('0x7d')){var _0x284f52=JSON[_0x63d3('0x7e')](_0x34c3c3[_0x63d3('0x42')][_0x2b5205])[_0x63d3('0x7f')];var _0x3ef3db=JSON[_0x63d3('0x7e')](_0x34c3c3[_0x63d3('0x42')][_0x2b5205])['$lte'];_0x4febbc[_0x63d3('0x4b')](_0x63d3('0x80'),_0x284f52,_0x3ef3db);}else{if(_0x34c3c3[_0x63d3('0x42')][_0x2b5205]===_0x63d3('0x81')){_0x4febbc[_0x63d3('0x4b')]('i.'+_0x2b5205+'\x20IS\x20NULL');}else{_0x4febbc[_0x63d3('0x4b')]('i.'+_0x2b5205+_0x63d3('0x82'),_0x34c3c3[_0x63d3('0x42')][_0x2b5205]);}}});}if(_0x34c3c3[_0x63d3('0x42')][_0x63d3('0x83')]){if(_0x34c3c3[_0x63d3('0x42')][_0x63d3('0x83')]==0x1){_0x4febbc[_0x63d3('0x63')](_0x63d3('0x84'));}else{_0x4febbc[_0x63d3('0x63')](_0x63d3('0x85'));}}if(_0x34c3c3[_0x63d3('0x42')]['tag']){_0x173ee5=_[_0x63d3('0x86')](_0x34c3c3[_0x63d3('0x42')]['tag'])?_0x34c3c3[_0x63d3('0x42')][_0x63d3('0x87')]:new Array(_0x34c3c3[_0x63d3('0x42')][_0x63d3('0x87')]);_0x173ee5[_0x63d3('0x34')](function(_0x30db08){_0x1a5315['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x30db08+',%');});}if(_0x34c3c3[_0x63d3('0x42')]['filter']){var _0x2abfbf=_0x34c3c3['query'][_0x63d3('0x88')][_0x63d3('0x89')]('\x5c','\x5c\x5c')[_0x63d3('0x89')]('\x27\x27',_0x63d3('0x8a'));if(qs[_0x63d3('0x8b')](_0x2abfbf)){_0xb91aa6['or']('i.id\x20LIKE\x20?',_0x2abfbf+'%');}else if(qs[_0x63d3('0x8c')](_0x2abfbf)){_0xb91aa6['or'](_0x63d3('0x8d'),_0x2abfbf+'%');}else{_0xb91aa6['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x63d3('0x69')](_0x2abfbf))['or'](_0x63d3('0x8e'),qs[_0x63d3('0x69')](_0x2abfbf));}}}_0x4febbc[_0x63d3('0x4b')](_0xb91aa6);_0x4febbc[_0x63d3('0x8f')](_0x63d3('0x90'));var _0x2d8a4b={'type':db['Sequelize'][_0x63d3('0x91')][_0x63d3('0x92')],'raw':!![]};var _0x161644=_0x4febbc[_0x63d3('0x93')]();_0x161644[_0x63d3('0x4e')](_0x63d3('0x90'));_0x161644['field'](_0x63d3('0x94'),'unreadMessages');if(_0x3c3cbd['order']){_0x3c3cbd[_0x63d3('0x49')]['forEach'](function(_0x513194){_0x4febbc[_0x63d3('0x49')]('i.'+_0x513194[0x0],_0x513194[0x1]==='DESC'?![]:!![]);});}if(!_[_0x63d3('0x79')](_0x173ee5)){_0x4febbc[_0x63d3('0x63')](_0x1a5315);_0x161644['where'](_0x63d3('0x95'),_0x173ee5);}BPromise[_0x63d3('0x96')]()[_0x63d3('0x2b')](function(){if(!_0x5cb29f){if(_0x34c3c3[_0x63d3('0x42')][_0x63d3('0x7a')]||_0x34c3c3[_0x63d3('0x42')][_0x63d3('0x97')])return;_0x161644[_0x63d3('0x4b')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x4febbc[_0x63d3('0x4b')](_0x63d3('0x98'));return;}return _0x34c3c3[_0x63d3('0x99')][_0x63d3('0x9a')]({'attributes':['id'],'raw':!![]})[_0x63d3('0x2b')](function(_0x5c7ef7){if(_[_0x63d3('0x79')](_0x5c7ef7)){_0x161644[_0x63d3('0x4b')](_0x63d3('0x9b'));_0x4febbc[_0x63d3('0x4b')](_0x63d3('0x9b'));}else{_0x161644[_0x63d3('0x4b')](_0x63d3('0x7b'),_[_0x63d3('0x31')](_0x5c7ef7,'id'));_0x4febbc['where'](_0x63d3('0x7b'),_[_0x63d3('0x31')](_0x5c7ef7,'id'));}});})['then'](function(){db['sequelize'][_0x63d3('0x42')](_0x161644[_0x63d3('0x9c')](),_0x2d8a4b)[_0x63d3('0x2b')](function(_0x12779a){_0x4395c4[_0x63d3('0x9d')]=_0x12779a[_0x63d3('0x46')];if(_0x4395c4[_0x63d3('0x9d')]===0x0)return[];return db[_0x63d3('0x9e')]['query'](_0x5a612d[_0x63d3('0x9c')](),_0x2d8a4b)[_0x63d3('0x2b')](function(_0x2ff2a4){_0x181ffe=_[_0x63d3('0x9f')](_0x2ff2a4,'id');_0x2d8a4b=_[_0x63d3('0xa0')](_0x2d8a4b,{'model':db[_0x63d3('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x34c3c3[_0x63d3('0x42')]['fields']){_0x3c3cbd[_0x63d3('0x45')]['forEach'](function(_0x2edb8e){_0x4febbc[_0x63d3('0x4e')]('i.'+_0x2edb8e);});}else{_0x4febbc['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x4febbc['field'](_0x63d3('0xa1'),_0x63d3('0xa2'));_0x4febbc[_0x63d3('0x4e')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x4febbc[_0x63d3('0x4e')](_0x63d3('0x90'));_0x4febbc[_0x63d3('0x4e')]('i.createdAt');_0x4febbc[_0x63d3('0x4e')](_0x63d3('0xa3'));_0x4febbc[_0x63d3('0x4e')]('i.closed');_0x4febbc[_0x63d3('0x4e')]('i.closedAt');_0x4febbc[_0x63d3('0x4e')](_0x63d3('0xa4'));_0x4febbc['field']('i.lastMsgAt');_0x4febbc[_0x63d3('0x4e')]('i.lastMsgDirection');_0x4febbc[_0x63d3('0x4e')](_0x63d3('0xa5'));_0x4febbc['field']('i.disposition');_0x4febbc['field'](_0x63d3('0xa6'));_0x4febbc['field']('i.to');_0x4febbc[_0x63d3('0x4e')](_0x63d3('0xa7'));_0x4febbc[_0x63d3('0x4e')](_0x63d3('0xa8'));_0x4febbc[_0x63d3('0x4e')](_0x63d3('0xa9'));_0x4febbc[_0x63d3('0x4e')](_0x63d3('0xaa'),_0x63d3('0xab'));_0x4febbc[_0x63d3('0x4e')](_0x63d3('0xac'),_0x63d3('0xad'));_0x4febbc[_0x63d3('0x4e')](_0x63d3('0xae'),_0x63d3('0xaf'));_0x4febbc[_0x63d3('0x4e')]('c.phone',_0x63d3('0xb0'));_0x4febbc['field'](_0x63d3('0xb1'),'Contact.mobile');_0x4febbc[_0x63d3('0x4e')](_0x63d3('0xb2'),_0x63d3('0xb3'));_0x4febbc[_0x63d3('0x4e')](_0x63d3('0xb4'),_0x63d3('0xb5'));_0x4febbc[_0x63d3('0x4e')](_0x63d3('0xb6'),'Owner.internal');_0x4febbc[_0x63d3('0x4e')](_0x63d3('0xb7'),'TagIds');}_0x4febbc['limit'](_0x3c3cbd[_0x63d3('0x26')]);_0x4febbc[_0x63d3('0x25')](_0x3c3cbd[_0x63d3('0x25')]);return db['sequelize'][_0x63d3('0x42')](_0x4febbc[_0x63d3('0x9c')](),_0x2d8a4b);})[_0x63d3('0x2b')](function(_0x5d234a){_0x41e986[_0x63d3('0x4b')](_0x63d3('0xb8'),_[_0x63d3('0x31')](_0x5d234a,'id'));return db['sequelize']['query'](_0x41e986[_0x63d3('0x9c')](),_0x2d8a4b)[_0x63d3('0x2b')](function(_0x2ad545){var _0x149348=_[_0x63d3('0xb9')](_0x2ad545,_0x63d3('0xba'));var _0x22044d=[];return db['Setting']['findOne']({'attributes':[_0x63d3('0xbb')],'raw':!![]})[_0x63d3('0x2b')](function(_0x1d7a68){var _0x390363=_0x1d7a68[_0x63d3('0xbb')];_0x5d234a[_0x63d3('0x34')](function(_0x9bd65f){_0x22044d[_0x63d3('0xbc')](updateMailInteraction(_0x9bd65f,_0x181ffe,_0x149348,_0x390363));});return BPromise[_0x63d3('0xbd')](_0x22044d);});});});})[_0x63d3('0x2b')](function(_0x18f93c){_0x4395c4[_0x63d3('0xbe')]=_0x18f93c;return _0x4395c4;})[_0x63d3('0x2b')](respondWithFilteredResult(_0x273af8,_0x3c3cbd));})[_0x63d3('0x3a')](handleError(_0x273af8,null));};exports['show']=function(_0x428e70,_0x24f4ef){var _0x3bc3c3={'raw':![],'where':{'id':_0x428e70[_0x63d3('0xbf')]['id']}},_0x417007={};_0x417007[_0x63d3('0x41')]=_[_0x63d3('0x77')](db[_0x63d3('0x3c')][_0x63d3('0x3d')]);_0x417007[_0x63d3('0x42')]=_[_0x63d3('0x77')](_0x428e70[_0x63d3('0x42')]);_0x417007[_0x63d3('0x43')]=_[_0x63d3('0x44')](_0x417007[_0x63d3('0x41')],_0x417007['query']);_0x3bc3c3['attributes']=_[_0x63d3('0x44')](_0x417007[_0x63d3('0x41')],qs[_0x63d3('0xc0')](_0x428e70['query'][_0x63d3('0xc0')]));_0x3bc3c3[_0x63d3('0x45')]=_0x3bc3c3['attributes']['length']?_0x3bc3c3[_0x63d3('0x45')]:_0x417007[_0x63d3('0x41')];if(_0x428e70['query'][_0x63d3('0xc1')]){_0x3bc3c3[_0x63d3('0xc2')]=[{'all':!![]}];}_0x3bc3c3=_[_0x63d3('0xa0')]({},_0x3bc3c3,_0x428e70[_0x63d3('0xc3')]);return db['MailInteraction']['find'](_0x3bc3c3)[_0x63d3('0x2b')](handleEntityNotFound(_0x24f4ef,null))[_0x63d3('0x2b')](respondWithResult(_0x24f4ef,null))[_0x63d3('0x3a')](handleError(_0x24f4ef,null));};exports[_0x63d3('0xc4')]=function(_0x238ddb,_0x189fcd){return db['MailInteraction'][_0x63d3('0xc4')](_0x238ddb['body'],{})[_0x63d3('0x2b')](respondWithResult(_0x189fcd,0xc9))[_0x63d3('0x3a')](handleError(_0x189fcd,null));};exports['update']=function(_0x152c9d,_0xd3a649){if(_0x152c9d[_0x63d3('0xc5')]['id']){delete _0x152c9d['body']['id'];}return db[_0x63d3('0x3c')][_0x63d3('0x6b')]({'where':{'id':_0x152c9d[_0x63d3('0xbf')]['id']}})[_0x63d3('0x2b')](handleEntityNotFound(_0xd3a649,null))[_0x63d3('0x2b')](saveUpdates(_0x152c9d[_0x63d3('0xc5')],null))[_0x63d3('0x2b')](respondWithResult(_0xd3a649,null))['catch'](handleError(_0xd3a649,null));};exports[_0x63d3('0x2c')]=function(_0x475fbb,_0x42515d){return db[_0x63d3('0x3c')]['find']({'where':{'id':_0x475fbb[_0x63d3('0xbf')]['id']}})[_0x63d3('0x2b')](handleEntityNotFound(_0x42515d,null))[_0x63d3('0x2b')](removeEntity(_0x42515d,null))[_0x63d3('0x3a')](handleError(_0x42515d,null));};exports[_0x63d3('0xc6')]=function(_0x92cd38,_0x5c6be5){return db[_0x63d3('0x3c')]['describe']()['then'](respondWithResult(_0x5c6be5,null))['catch'](handleError(_0x5c6be5,null));};exports[_0x63d3('0xc7')]=function(_0x20f582,_0x342c6b,_0x4c31ef){return db[_0x63d3('0xc8')]['find']({'where':{'id':_0x20f582[_0x63d3('0xbf')]['id']}})[_0x63d3('0x2b')](handleEntityNotFound(_0x342c6b,null))[_0x63d3('0x2b')](function(_0xc992e2){if(_0xc992e2){return _0xc992e2[_0x63d3('0xc7')](_0x20f582[_0x63d3('0xc5')][_0x63d3('0xc9')],_[_0x63d3('0xca')](_0x20f582['body'],['ids','id'])||{});}})[_0x63d3('0x2b')](respondWithResult(_0x342c6b,null))[_0x63d3('0x3a')](handleError(_0x342c6b,null));};exports[_0x63d3('0xcb')]=function(_0x3de4a7,_0x5b079e,_0x305d9c){var _0x59f91b={'raw':![],'where':{}};var _0x128a74={};var _0x5ef331={'count':0x0,'rows':[]};return db[_0x63d3('0x3c')][_0x63d3('0x36')]({'where':{'id':_0x3de4a7[_0x63d3('0xbf')]['id']}})[_0x63d3('0x2b')](handleEntityNotFound(_0x5b079e,null))['then'](function(_0x820b1b){if(_0x820b1b){_0x128a74[_0x63d3('0x41')]=_[_0x63d3('0x77')](db['MailMessage']['rawAttributes']);_0x128a74[_0x63d3('0x42')]=_[_0x63d3('0x77')](_0x3de4a7[_0x63d3('0x42')]);_0x128a74[_0x63d3('0x43')]=_[_0x63d3('0x44')](_0x128a74[_0x63d3('0x41')],_0x128a74[_0x63d3('0x42')]);_0x59f91b[_0x63d3('0x45')]=_['intersection'](_0x128a74[_0x63d3('0x41')],qs['fields'](_0x3de4a7[_0x63d3('0x42')][_0x63d3('0xc0')]));_0x59f91b[_0x63d3('0x45')]=_0x59f91b[_0x63d3('0x45')]['length']?_0x59f91b[_0x63d3('0x45')]:_0x128a74[_0x63d3('0x41')];if(!_0x3de4a7[_0x63d3('0x42')][_0x63d3('0x47')]('nolimit')){_0x59f91b[_0x63d3('0x26')]=qs[_0x63d3('0x26')](_0x3de4a7['query'][_0x63d3('0x26')]);_0x59f91b[_0x63d3('0x25')]=qs['offset'](_0x3de4a7[_0x63d3('0x42')][_0x63d3('0x25')]);}_0x59f91b[_0x63d3('0x49')]=qs[_0x63d3('0x4a')](_0x3de4a7[_0x63d3('0x42')][_0x63d3('0x4a')]);_0x59f91b['where']=qs[_0x63d3('0x43')](_['pick'](_0x3de4a7[_0x63d3('0x42')],_0x128a74['filters']));_0x59f91b[_0x63d3('0x4b')][_0x63d3('0xba')]=_0x820b1b['id'];if(_0x3de4a7[_0x63d3('0x42')][_0x63d3('0x88')]){_0x59f91b[_0x63d3('0x4b')]=_[_0x63d3('0xa0')](_0x59f91b[_0x63d3('0x4b')],{'$or':_[_0x63d3('0x31')](_0x59f91b[_0x63d3('0x45')],function(_0x3deb88){var _0x3ce012={};_0x3ce012[_0x3deb88]={'$like':'%'+_0x3de4a7[_0x63d3('0x42')][_0x63d3('0x88')]+'%'};return _0x3ce012;})});}if(_0x3de4a7[_0x63d3('0x42')][_0x63d3('0x7f')]){var _0x197adf=_0x3de4a7['query'][_0x63d3('0x7f')]['split'](',');var _0x461d51={};_0x461d51[_0x197adf[0x0]]={'$gte':moment(_0x197adf[0x1])[_0x63d3('0xcc')]('YYYY-MM-DD\x20HH:mm:ss')};_0x59f91b['where']=_[_0x63d3('0xa0')](_0x59f91b[_0x63d3('0x4b')],_0x461d51);}_0x59f91b=_[_0x63d3('0xa0')]({},_0x59f91b,_0x3de4a7[_0x63d3('0xc3')]);return db[_0x63d3('0xc8')][_0x63d3('0x9d')]({'where':_0x59f91b[_0x63d3('0x4b')]})[_0x63d3('0x2b')](function(_0x291d08){_0x5ef331['count']=_0x291d08;if(_0x3de4a7[_0x63d3('0x42')][_0x63d3('0xc1')]){_0x59f91b['include']=[{'all':!![]}];}return db[_0x63d3('0xc8')]['findAll'](_0x59f91b);})[_0x63d3('0x2b')](function(_0x2d660d){_0x5ef331[_0x63d3('0xbe')]=_0x2d660d;return _0x5ef331;});}})['then'](respondWithFilteredResult(_0x5b079e,_0x59f91b))[_0x63d3('0x3a')](handleError(_0x5b079e,null));};exports[_0x63d3('0xcd')]=function(_0x2a8c89,_0x138dcf,_0x29ec26){return db[_0x63d3('0x3c')][_0x63d3('0x6b')]({'where':{'id':_0x2a8c89[_0x63d3('0xbf')]['id']}})[_0x63d3('0x2b')](handleEntityNotFound(_0x138dcf,null))[_0x63d3('0x2b')](function(_0x55fb4c){if(_0x55fb4c){return _0x55fb4c[_0x63d3('0xce')](_0x2a8c89[_0x63d3('0xc5')][_0x63d3('0xc9')],_[_0x63d3('0xca')](_0x2a8c89[_0x63d3('0xc5')],[_0x63d3('0xc9'),'id'])||{})[_0x63d3('0xcf')](function(){return db['Tag']['findAll']({'attributes':['id',_0x63d3('0x2e'),'color'],'where':{'id':_0x2a8c89[_0x63d3('0xc5')][_0x63d3('0xc9')]}});})[_0x63d3('0x2b')](function(_0x434185){socket[_0x63d3('0xd0')]('mailInteractionTags:save',{'id':Number(_0x2a8c89[_0x63d3('0xbf')]['id']),'tags':_0x434185||[]});return{'id':Number(_0x2a8c89[_0x63d3('0xbf')]['id']),'tags':_0x434185||[]};});}})['then'](respondWithResult(_0x138dcf,null))[_0x63d3('0x3a')](handleError(_0x138dcf,null));};exports[_0x63d3('0xd1')]=function(_0x1a7ef8,_0x4b8f4e,_0x5d1ea6){return db[_0x63d3('0x3c')]['find']({'where':{'id':_0x1a7ef8['params']['id']}})[_0x63d3('0x2b')](handleEntityNotFound(_0x4b8f4e,null))['then'](function(_0x41defc){if(_0x41defc){return _0x41defc[_0x63d3('0xd1')](_0x1a7ef8[_0x63d3('0x42')][_0x63d3('0xc9')]);}})[_0x63d3('0x2b')](respondWithStatusCode(_0x4b8f4e,null))[_0x63d3('0x3a')](handleError(_0x4b8f4e,null));};exports[_0x63d3('0xd2')]=function(_0x208ef3,_0x1588c0){var _0x1c1fac=moment()[_0x63d3('0xd3')]()[_0x63d3('0x9c')]();var _0x7dc1cc=path[_0x63d3('0xd4')](config[_0x63d3('0xd5')],_0x63d3('0xd6'),_0x63d3('0xd7'),'tmp');var _0x36fe3d=path[_0x63d3('0xd4')](config['root'],_0x63d3('0xd6'),_0x63d3('0xd7'),_0x63d3('0xd8'));var _0x17b3c7=path[_0x63d3('0xd4')](_0x7dc1cc,_0x1c1fac);var _0x30c155=util['format'](_0x63d3('0xd9'),_0x208ef3['params']['id'],_0x1c1fac);var _0x396cc0=path[_0x63d3('0xd4')](_0x7dc1cc,_0x30c155);var _0x38352e=[];if(_0x208ef3['query']['attachments']){_0x38352e[_0x63d3('0xbc')]({'model':db[_0x63d3('0xda')],'as':_0x63d3('0xdb'),'raw':!![]});}var _0x1ea00b=[{'model':db[_0x63d3('0xc8')],'as':_0x63d3('0xdc'),'attributes':['id','body',_0x63d3('0x50'),'to','cc',_0x63d3('0xdd'),_0x63d3('0xde'),_0x63d3('0x7d')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x38352e}];return db[_0x63d3('0x3c')]['find']({'where':{'id':_0x208ef3['params']['id']},'include':_0x1ea00b})[_0x63d3('0x2b')](handleEntityNotFound(_0x1588c0,null))[_0x63d3('0x2b')](function(_0x6991ed){if(_0x6991ed&&_0x6991ed[_0x63d3('0xdc')]){var _0x3e1afb=_0x6991ed[_0x63d3('0xdf')]({'plain':!![]});fs[_0x63d3('0xe0')](_0x17b3c7);return BPromise[_0x63d3('0xe1')](_0x3e1afb['Messages'],function(_0x1f1d5f,_0x13aafd){var _0x597813={'from':_0x1f1d5f[_0x63d3('0x50')],'to':_0x1f1d5f['to'],'subject':_0x1f1d5f[_0x63d3('0xde')],'html':_0x1f1d5f[_0x63d3('0xc5')],'headers':{'Date':moment(_0x1f1d5f[_0x63d3('0x7d')])[_0x63d3('0xcc')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1f1d5f['cc']){_0x597813['headers']['Cc']=_0x1f1d5f['cc'];}if(_0x1f1d5f[_0x63d3('0xdd')]){_0x597813[_0x63d3('0xe2')][_0x63d3('0xe3')]=_0x1f1d5f[_0x63d3('0xdd')];}return new BPromise(function(_0x3e671c,_0x41742b){if(_0x1f1d5f[_0x63d3('0xdb')]){for(var _0x27543c=0x0;_0x27543c<_0x1f1d5f[_0x63d3('0xdb')][_0x63d3('0x46')];_0x27543c++){var _0x1f2d2c=_0x1f1d5f['Attachments'][_0x27543c];var _0x1d8f89=path[_0x63d3('0xd4')](_0x36fe3d,_0x1f2d2c[_0x63d3('0xe4')]);if(fs[_0x63d3('0xe5')](_0x1d8f89)){_0x597813[_0x63d3('0xd8')][_0x63d3('0xbc')]({'name':_0x1f2d2c[_0x63d3('0x2e')],'contentType':_0x1f2d2c['type'],'data':fs[_0x63d3('0xe6')](_0x1d8f89)});}}}emlformat[_0x63d3('0xe7')](_0x597813,function(_0x572e3d,_0x324bb1){if(_0x572e3d)return _0x41742b(_0x572e3d);fs[_0x63d3('0xe8')](path[_0x63d3('0xd4')](_0x17b3c7,util[_0x63d3('0xcc')](_0x63d3('0xe9'),_0x13aafd)),_0x324bb1);return _0x3e671c(_0x324bb1);});});})[_0x63d3('0x2b')](function(){return new BPromise(function(_0x349496,_0x5a4bc1){zipdir(_0x17b3c7,{'saveTo':_0x396cc0},function(_0x8f9a0a,_0xf91757){if(_0x8f9a0a)return _0x5a4bc1(_0x8f9a0a);return _0x349496(_0xf91757);});})['then'](function(){return new BPromise(function(_0x3ab6d6,_0x5c8a16){rimraf(_0x17b3c7,function(_0x1e4cb2){if(_0x1e4cb2)_0x5c8a16(_0x1e4cb2);return _0x3ab6d6();});});})['then'](function(){return _0x1588c0['download'](_0x396cc0,_0x30c155,function(_0x1bb272){if(_0x1bb272){console[_0x63d3('0xea')](_0x63d3('0xeb'),_0x1bb272);}else{fs['unlinkSync'](_0x396cc0);}});});});}else{return _0x1588c0[_0x63d3('0x21')](0xc8);}})[_0x63d3('0x3a')](handleError(_0x1588c0,null));}; \ No newline at end of file +var _0x30c5=['c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','text','keys','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.to','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.phone','c.mobile','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','Setting','enableEmailPreview','all','show','includeAll','include','create','body','params','describe','addMessage','ids','omit','getMessages','MailMessage','rawAttributes','MailInteractionId','format','findAll','rows','addTags','setTags','spread','emit','removeTags','join','root','server','files','tmp','attachments','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','each','headers','Bcc','basename','build','message%d.eml','log','err','unlinkSync','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./mailInteraction.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','MailInteraction','findOne','lastMsgBody','lastMsgText','trimStart','fromString','catch','index','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','u.id','u.fullname','from','user_has_mail_interactions','left_join','mail_interactions','cm_contacts','users','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue'];(function(_0x5e8c7c,_0x3429c6){var _0x48f7bd=function(_0x2b8a0f){while(--_0x2b8a0f){_0x5e8c7c['push'](_0x5e8c7c['shift']());}};_0x48f7bd(++_0x3429c6);}(_0x30c5,0x15a));var _0x530c=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x30c5[_0x1ac595];return _0x455fff;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x530c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x530c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x530c('0x2'));var Mustache=require(_0x530c('0x3'));var util=require(_0x530c('0x4'));var path=require(_0x530c('0x5'));var sox=require(_0x530c('0x6'));var csv=require(_0x530c('0x7'));var ejs=require(_0x530c('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x530c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x530c('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var htmlToText=require('html-to-text');var Redis=require(_0x530c('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x530c('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x530c('0xd'));var logger=require(_0x530c('0xe'))(_0x530c('0xf'));var utils=require('../../config/utils');var config=require(_0x530c('0x10'));var db=require('../../mysqldb')['db'];config[_0x530c('0x11')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x530c('0x12'))(new Redis(config[_0x530c('0x11')]));require(_0x530c('0x13'))[_0x530c('0x14')](socket);function respondWithStatusCode(_0x3059d6,_0x21f676){_0x21f676=_0x21f676||0xcc;return function(_0x2b31c3){if(_0x2b31c3){return _0x3059d6[_0x530c('0x15')](_0x21f676);}return _0x3059d6['status'](_0x21f676)[_0x530c('0x16')]();};}function respondWithResult(_0x1b0395,_0xa3a001){_0xa3a001=_0xa3a001||0xc8;return function(_0x590800){if(_0x590800){return _0x1b0395[_0x530c('0x17')](_0xa3a001)[_0x530c('0x18')](_0x590800);}};}function respondWithFilteredResult(_0x548a4f,_0xc67b10){return function(_0x3c0bcb){if(_0x3c0bcb){var _0x2e735d=_0x3c0bcb[_0x530c('0x19')],_0x5e2d97=_0xc67b10[_0x530c('0x1a')],_0x52d293=_0xc67b10[_0x530c('0x1a')]+_0xc67b10[_0x530c('0x1b')],_0x582876;if(_0x52d293>=_0x2e735d){_0x52d293=_0x2e735d;_0x582876=0xc8;}else{_0x582876=0xce;}_0x548a4f[_0x530c('0x17')](_0x582876);return _0x548a4f[_0x530c('0x1c')](_0x530c('0x1d'),_0x5e2d97+'-'+_0x52d293+'/'+_0x2e735d)[_0x530c('0x18')](_0x3c0bcb);}return null;};}function patchUpdates(_0x5be4b9){return function(_0x461a6c){try{jsonpatch[_0x530c('0x1e')](_0x461a6c,_0x5be4b9,!![]);}catch(_0x2f9295){return BPromise[_0x530c('0x1f')](_0x2f9295);}return _0x461a6c['save']();};}function saveUpdates(_0x1057e8,_0x26f387){return function(_0x48f7d5){if(_0x48f7d5){return _0x48f7d5[_0x530c('0x20')](_0x1057e8)[_0x530c('0x21')](function(_0xde99ac){return _0xde99ac;});}return null;};}function removeEntity(_0x28ee41,_0x21b573){return function(_0x463890){if(_0x463890){return _0x463890[_0x530c('0x22')]()['then'](function(){_0x28ee41[_0x530c('0x17')](0xcc)[_0x530c('0x16')]();});}};}function handleEntityNotFound(_0x4074ea,_0x534cae){return function(_0x1979d5){if(!_0x1979d5){_0x4074ea[_0x530c('0x15')](0x194);}return _0x1979d5;};}function handleError(_0x151d96,_0x45759a){_0x45759a=_0x45759a||0x1f4;return function(_0x3b1101){logger[_0x530c('0x23')](_0x3b1101[_0x530c('0x24')]);if(_0x3b1101[_0x530c('0x25')]){delete _0x3b1101[_0x530c('0x25')];}_0x151d96[_0x530c('0x17')](_0x45759a)[_0x530c('0x26')](_0x3b1101);};}function getInteractionUsers(_0x202ae0,_0x315dfa){return new BPromise(function(_0x582edd,_0x583c0e){try{if(_0x315dfa[_0x202ae0['id']]){_0x202ae0['Users']=_['map'](_0x315dfa[_0x202ae0['id']],function(_0x3aba10){return{'id':_0x3aba10['id'],'fullname':_0x3aba10[_0x530c('0x27')]};});}}catch(_0x518419){_0x583c0e(_0x518419);}_0x582edd(_0x202ae0);});}function getInteractionTags(_0x54f626,_0x8830f4){return new BPromise(function(_0x48618d,_0x1b95f1){try{if(_0x54f626[_0x530c('0x28')]){_0x54f626[_0x530c('0x29')]=[];_0x54f626[_0x530c('0x28')][_0x530c('0x2a')](',')[_0x530c('0x2b')](function(_0x157a38){_0x54f626['Tags'][_0x530c('0x2c')](_0x8830f4[_0x157a38]);});}delete _0x54f626[_0x530c('0x28')];}catch(_0x3523bd){_0x1b95f1(_0x3523bd);}_0x48618d(_0x54f626);});}function getLastMessageText(_0x27c8a2){return new BPromise(function(_0x1ccecc,_0xab247e){return db[_0x530c('0x2d')][_0x530c('0x2e')]({'where':{'id':_0x27c8a2['id']},'attributes':[_0x530c('0x2f'),'lastMsgText'],'raw':!![]})[_0x530c('0x21')](function(_0x2b7750){if(!_0x2b7750[_0x530c('0x30')]){_0x27c8a2['lastMsgText']=_[_0x530c('0x31')](htmlToText[_0x530c('0x32')](_0x2b7750[_0x530c('0x2f')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x27c8a2[_0x530c('0x30')]=_0x2b7750[_0x530c('0x30')];}_0x1ccecc(_0x27c8a2);})[_0x530c('0x33')](function(_0x2437a5){_0xab247e(_0x2437a5);});});}function updateMailInteraction(_0x3782aa,_0x54f03f,_0x5587b3,_0x3ae32c){return new BPromise(function(_0x23c2b7,_0x211d77){return getInteractionUsers(_0x3782aa,_0x5587b3)[_0x530c('0x21')](function(_0x26abd6){return getInteractionTags(_0x26abd6,_0x54f03f);})[_0x530c('0x21')](function(_0x508377){if(_0x3ae32c){_0x23c2b7(getLastMessageText(_0x508377));}else{_0x23c2b7(_0x508377);}})[_0x530c('0x33')](function(_0x5d4232){_0x211d77(_0x5d4232);});});}exports[_0x530c('0x34')]=function(_0x3f7b33,_0x45cc6e){var _0x5200a9={},_0x126c8d={},_0x3a3d72={'count':0x0,'rows':[]};var _0x4b5024=_['map'](db[_0x530c('0x2d')]['rawAttributes'],function(_0x4ccd4f){return{'name':_0x4ccd4f['fieldName'],'type':_0x4ccd4f[_0x530c('0x35')][_0x530c('0x36')]};});_0x126c8d[_0x530c('0x37')]=_[_0x530c('0x38')](_0x4b5024,_0x530c('0x25'));_0x126c8d['query']=_['keys'](_0x3f7b33[_0x530c('0x39')]);_0x126c8d[_0x530c('0x3a')]=_['intersection'](_0x126c8d[_0x530c('0x37')],_0x126c8d['query']);_0x5200a9[_0x530c('0x3b')]=_[_0x530c('0x3c')](_0x126c8d['model'],qs[_0x530c('0x3d')](_0x3f7b33[_0x530c('0x39')]['fields']));_0x5200a9['attributes']=_0x5200a9['attributes'][_0x530c('0x3e')]?_0x5200a9[_0x530c('0x3b')]:_0x126c8d['model'];if(!_0x3f7b33[_0x530c('0x39')][_0x530c('0x3f')](_0x530c('0x40'))){_0x5200a9['limit']=qs['limit'](_0x3f7b33[_0x530c('0x39')][_0x530c('0x1b')]);_0x5200a9[_0x530c('0x1a')]=qs['offset'](_0x3f7b33[_0x530c('0x39')][_0x530c('0x1a')]);}_0x5200a9[_0x530c('0x41')]=qs[_0x530c('0x42')](_0x3f7b33['query'][_0x530c('0x42')]);_0x5200a9[_0x530c('0x43')]=qs['filters'](_[_0x530c('0x44')](_0x3f7b33[_0x530c('0x39')],_0x126c8d['filters']));var _0x4b0b4c=[];var _0x4c357d=squel[_0x530c('0x45')]()['field']('id')[_0x530c('0x46')](_0x530c('0x25'))[_0x530c('0x46')](_0x530c('0x47'))['from']('tools_tags');var _0x4c1887=squel[_0x530c('0x45')]()[_0x530c('0x46')](_0x530c('0x48'))[_0x530c('0x46')](_0x530c('0x49'))[_0x530c('0x46')]('ui.MailInteractionId')[_0x530c('0x4a')](_0x530c('0x4b'),'ui')[_0x530c('0x4c')]('users','u','u.id\x20=\x20ui.UserId');var _0x36b07e=squel[_0x530c('0x45')]()[_0x530c('0x4a')](_0x530c('0x4d'),'i')[_0x530c('0x4c')](_0x530c('0x4e'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x530c('0x4f'),'o','o.id\x20=\x20i.UserId')[_0x530c('0x4c')]('mail_accounts','a','a.id\x20=\x20i.MailAccountId')[_0x530c('0x4c')](_0x530c('0x50'),'me',_0x530c('0x51'))[_0x530c('0x4c')]('mail_interaction_has_tags','it',_0x530c('0x52'))[_0x530c('0x4c')]('tools_tags','t',_0x530c('0x53'));var _0x547869=squel['expr']();var _0x580f37=[];var _0x5b9882=squel[_0x530c('0x54')]();var _0x507a2b;if(_0x3f7b33[_0x530c('0x39')][_0x530c('0x55')]){_0x507a2b=as[_0x530c('0x56')](_0x3f7b33[_0x530c('0x39')][_0x530c('0x55')]);var _0x54c600=_0x507a2b[_0x530c('0x57')];for(var _0x264607=0x0;_0x264607<_0x507a2b[_0x530c('0x58')][_0x530c('0x3e')];_0x264607++){var _0x1e6fc6=_0x507a2b['conditions'][_0x264607];var _0x491ca6='i';var _0x226fdd=_['find'](_0x4b5024,[_0x530c('0x25'),_0x1e6fc6[_0x530c('0x46')]]);if(!_0x226fdd){switch(_0x1e6fc6[_0x530c('0x46')]){case _0x530c('0x59'):if(_0x1e6fc6[_0x530c('0x5a')]==0x1){_0x36b07e[_0x530c('0x5b')]('`'+_0x1e6fc6[_0x530c('0x46')]+'`\x20=\x200');}else{_0x36b07e['having']('`'+_0x1e6fc6[_0x530c('0x46')]+_0x530c('0x5c'));}break;case _0x530c('0x5d'):if(_0x1e6fc6[_0x530c('0x5e')]===_0x530c('0x5f')){if(_0x1e6fc6['value'][_0x530c('0x2a')]('\x20')[_0x530c('0x3e')]>0x1){_0x547869[_0x54c600](_0x530c('0x60'),qs[_0x530c('0x61')](_0x1e6fc6[_0x530c('0x5a')]),null);}else{var _0x4af1df='%'+_0x1e6fc6[_0x530c('0x5a')]+'%';_0x547869[_0x54c600](_0x530c('0x62'),_0x4af1df,_0x4af1df,_0x4af1df);}}else{_0x226fdd=_[_0x530c('0x63')](_0x4b5024,[_0x530c('0x25'),_0x530c('0x64')]);_0x1e6fc6[_0x530c('0x46')]=_0x530c('0x64');_0x4861f2=as[_0x530c('0x65')](_0x491ca6,_0x226fdd[_0x530c('0x35')],_0x1e6fc6);_0x547869[_0x54c600](_0x4861f2['text'],_0x4861f2[_0x530c('0x5a')][_0x530c('0x66')],_0x4861f2[_0x530c('0x5a')][_0x530c('0x16')]);}break;case'Tag':var _0x3a4456=_0x1e6fc6[_0x530c('0x5a')][_0x530c('0x2a')](',')[_0x530c('0x38')](function(_0x174ea3){return Number(_0x174ea3);});_0x3a4456[_0x530c('0x2b')](function(_0x1105ee){_0x5b9882['or'](_0x530c('0x67'),'%,'+_0x1105ee+',%');});_0x580f37=_['union'](_0x580f37,_0x3a4456);break;case _0x530c('0x68'):if(_0x1e6fc6[_0x530c('0x5e')]==='$substring'){_0x547869[_0x54c600](_0x530c('0x69'),'%'+_0x1e6fc6[_0x530c('0x5a')]+'%',null);}else{_0x226fdd=_[_0x530c('0x63')](_0x4b5024,[_0x530c('0x25'),_0x530c('0x6a')]);_0x1e6fc6[_0x530c('0x46')]=_0x530c('0x6a');_0x4861f2=as[_0x530c('0x65')](_0x491ca6,_0x226fdd[_0x530c('0x35')],_0x1e6fc6);_0x547869[_0x54c600](_0x4861f2['text'],_0x4861f2[_0x530c('0x5a')][_0x530c('0x66')],_0x4861f2[_0x530c('0x5a')][_0x530c('0x16')]);}break;case _0x530c('0x6b'):_0x4861f2=as[_0x530c('0x65')]('me',null,_0x1e6fc6);_0x547869[_0x54c600](_0x4861f2['text'],_0x4861f2[_0x530c('0x5a')][_0x530c('0x66')],_0x4861f2[_0x530c('0x5a')][_0x530c('0x16')]);break;}}else{var _0x4861f2=as[_0x530c('0x65')](_0x491ca6,_0x226fdd['type'],_0x1e6fc6);_0x547869[_0x54c600](_0x4861f2[_0x530c('0x6c')],_0x4861f2[_0x530c('0x5a')]['start'],_0x4861f2[_0x530c('0x5a')][_0x530c('0x16')]);}}}else{var _0x1792a3=_(_0x3f7b33[_0x530c('0x39')])[_0x530c('0x6d')]()[_0x530c('0x38')](function(_0x486e69){return _[_0x530c('0x6e')](_0x4b5024,[_0x530c('0x25'),_0x486e69])?_0x486e69:undefined;})[_0x530c('0x6f')]()['value']();if(!_[_0x530c('0x70')](_0x1792a3)){_0x1792a3[_0x530c('0x2b')](function(_0xf85682){if(_0xf85682===_0x530c('0x71')){_0x36b07e[_0x530c('0x43')](_0x530c('0x72'),[][_0x530c('0x73')](_0x3f7b33[_0x530c('0x39')][_0xf85682]));}else if(_0xf85682===_0x530c('0x74')){var _0x11e773=JSON['parse'](_0x3f7b33[_0x530c('0x39')][_0xf85682])[_0x530c('0x75')];var _0xa27a54=JSON[_0x530c('0x76')](_0x3f7b33[_0x530c('0x39')][_0xf85682])[_0x530c('0x77')];_0x36b07e['where'](_0x530c('0x78'),_0x11e773,_0xa27a54);}else{if(_0x3f7b33[_0x530c('0x39')][_0xf85682]===_0x530c('0x79')){_0x36b07e[_0x530c('0x43')]('i.'+_0xf85682+'\x20IS\x20NULL');}else{_0x36b07e[_0x530c('0x43')]('i.'+_0xf85682+_0x530c('0x7a'),_0x3f7b33[_0x530c('0x39')][_0xf85682]);}}});}if(_0x3f7b33['query'][_0x530c('0x7b')]){if(_0x3f7b33[_0x530c('0x39')][_0x530c('0x7b')]==0x1){_0x36b07e[_0x530c('0x5b')](_0x530c('0x7c'));}else{_0x36b07e[_0x530c('0x5b')]('`unreadMessages`\x20>\x200');}}if(_0x3f7b33[_0x530c('0x39')]['tag']){_0x580f37=_[_0x530c('0x7d')](_0x3f7b33[_0x530c('0x39')][_0x530c('0x7e')])?_0x3f7b33[_0x530c('0x39')][_0x530c('0x7e')]:new Array(_0x3f7b33[_0x530c('0x39')]['tag']);_0x580f37[_0x530c('0x2b')](function(_0x45a73f){_0x5b9882['or'](_0x530c('0x67'),'%,'+_0x45a73f+',%');});}if(_0x3f7b33['query'][_0x530c('0x7f')]){var _0x5c92e1=_0x3f7b33[_0x530c('0x39')][_0x530c('0x7f')][_0x530c('0x80')]('\x5c','\x5c\x5c')[_0x530c('0x80')]('\x27\x27',_0x530c('0x81'));if(qs[_0x530c('0x82')](_0x5c92e1)){_0x547869['or'](_0x530c('0x83'),_0x5c92e1+'%');}else if(qs[_0x530c('0x84')](_0x5c92e1)){_0x547869['or'](_0x530c('0x85'),_0x5c92e1+'%');}else{_0x547869['or'](_0x530c('0x86'),qs[_0x530c('0x61')](_0x5c92e1))['or'](_0x530c('0x87'),qs[_0x530c('0x61')](_0x5c92e1));}}}_0x36b07e[_0x530c('0x43')](_0x547869);_0x36b07e[_0x530c('0x88')](_0x530c('0x89'));var _0x3add53={'type':db[_0x530c('0x8a')]['QueryTypes'][_0x530c('0x8b')],'raw':!![]};var _0x2e9138=_0x36b07e[_0x530c('0x8c')]();_0x2e9138[_0x530c('0x46')](_0x530c('0x89'));_0x2e9138['field'](_0x530c('0x8d'),_0x530c('0x59'));if(_0x5200a9[_0x530c('0x41')]){_0x5200a9[_0x530c('0x41')][_0x530c('0x2b')](function(_0x29174c){_0x36b07e[_0x530c('0x41')]('i.'+_0x29174c[0x0],_0x29174c[0x1]===_0x530c('0x8e')?![]:!![]);});}if(!_[_0x530c('0x70')](_0x580f37)){_0x36b07e[_0x530c('0x5b')](_0x5b9882);_0x2e9138['where'](_0x530c('0x8f'),_0x580f37);}BPromise[_0x530c('0x90')]()['then'](function(){if(!_0x507a2b){if(_0x3f7b33[_0x530c('0x39')][_0x530c('0x71')]||_0x3f7b33[_0x530c('0x39')][_0x530c('0x91')])return;_0x2e9138[_0x530c('0x43')](_0x530c('0x92'));_0x36b07e[_0x530c('0x43')](_0x530c('0x92'));return;}return _0x3f7b33[_0x530c('0x93')][_0x530c('0x94')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4630b2){if(_['isEmpty'](_0x4630b2)){_0x2e9138[_0x530c('0x43')]('i.MailAccountId\x20IS\x20NULL');_0x36b07e[_0x530c('0x43')](_0x530c('0x95'));}else{_0x2e9138['where'](_0x530c('0x72'),_[_0x530c('0x38')](_0x4630b2,'id'));_0x36b07e['where']('i.MailAccountId\x20IN\x20?',_[_0x530c('0x38')](_0x4630b2,'id'));}});})[_0x530c('0x21')](function(){db[_0x530c('0x96')][_0x530c('0x39')](_0x2e9138[_0x530c('0x97')](),_0x3add53)[_0x530c('0x21')](function(_0xf61e6e){_0x3a3d72['count']=_0xf61e6e[_0x530c('0x3e')];if(_0x3a3d72[_0x530c('0x19')]===0x0)return[];return db['sequelize'][_0x530c('0x39')](_0x4c357d[_0x530c('0x97')](),_0x3add53)[_0x530c('0x21')](function(_0xa5cf57){_0x4b0b4c=_[_0x530c('0x98')](_0xa5cf57,'id');_0x3add53=_[_0x530c('0x99')](_0x3add53,{'model':db[_0x530c('0x2d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3f7b33[_0x530c('0x39')][_0x530c('0x3d')]){_0x5200a9[_0x530c('0x3b')][_0x530c('0x2b')](function(_0x18a91b){_0x36b07e[_0x530c('0x46')]('i.'+_0x18a91b);});}else{_0x36b07e[_0x530c('0x46')](_0x530c('0x8d'),_0x530c('0x59'));_0x36b07e[_0x530c('0x46')]('a.key',_0x530c('0x9a'));_0x36b07e['field'](_0x530c('0x9b'),_0x530c('0x9c'));_0x36b07e[_0x530c('0x46')](_0x530c('0x89'));_0x36b07e[_0x530c('0x46')](_0x530c('0x9d'));_0x36b07e['field']('i.updatedAt');_0x36b07e[_0x530c('0x46')](_0x530c('0x9e'));_0x36b07e[_0x530c('0x46')](_0x530c('0x9f'));_0x36b07e['field']('i.attach');_0x36b07e[_0x530c('0x46')](_0x530c('0xa0'));_0x36b07e[_0x530c('0x46')](_0x530c('0xa1'));_0x36b07e[_0x530c('0x46')](_0x530c('0xa2'));_0x36b07e[_0x530c('0x46')](_0x530c('0xa3'));_0x36b07e[_0x530c('0x46')]('i.substatus');_0x36b07e[_0x530c('0x46')](_0x530c('0xa4'));_0x36b07e[_0x530c('0x46')]('i.ContactId');_0x36b07e[_0x530c('0x46')]('i.MailAccountId');_0x36b07e[_0x530c('0x46')]('i.UserId');_0x36b07e[_0x530c('0x46')](_0x530c('0xa5'),_0x530c('0xa6'));_0x36b07e[_0x530c('0x46')](_0x530c('0xa7'),_0x530c('0xa8'));_0x36b07e[_0x530c('0x46')]('c.email','Contact.email');_0x36b07e[_0x530c('0x46')]('c.phone',_0x530c('0xa9'));_0x36b07e['field'](_0x530c('0xaa'),'Contact.mobile');_0x36b07e[_0x530c('0x46')]('c.fax','Contact.fax');_0x36b07e[_0x530c('0x46')](_0x530c('0xab'),_0x530c('0xac'));_0x36b07e['field']('o.internal','Owner.internal');_0x36b07e['field'](_0x530c('0xad'),_0x530c('0x28'));}_0x36b07e[_0x530c('0x1b')](_0x5200a9[_0x530c('0x1b')]);_0x36b07e[_0x530c('0x1a')](_0x5200a9['offset']);return db[_0x530c('0x96')][_0x530c('0x39')](_0x36b07e[_0x530c('0x97')](),_0x3add53);})[_0x530c('0x21')](function(_0x38826e){_0x4c1887[_0x530c('0x43')](_0x530c('0xae'),_[_0x530c('0x38')](_0x38826e,'id'));return db['sequelize']['query'](_0x4c1887[_0x530c('0x97')](),_0x3add53)[_0x530c('0x21')](function(_0x296f86){var _0x46ad0b=_['groupBy'](_0x296f86,'MailInteractionId');var _0x5f191c=[];return db[_0x530c('0xaf')][_0x530c('0x2e')]({'attributes':[_0x530c('0xb0')],'raw':!![]})[_0x530c('0x21')](function(_0x53e3ee){var _0x3b9899=_0x53e3ee['enableEmailPreview'];_0x38826e[_0x530c('0x2b')](function(_0x575f8a){_0x5f191c[_0x530c('0x2c')](updateMailInteraction(_0x575f8a,_0x4b0b4c,_0x46ad0b,_0x3b9899));});return BPromise[_0x530c('0xb1')](_0x5f191c);});});});})[_0x530c('0x21')](function(_0x5a0ae4){_0x3a3d72['rows']=_0x5a0ae4;return _0x3a3d72;})[_0x530c('0x21')](respondWithFilteredResult(_0x45cc6e,_0x5200a9));})[_0x530c('0x33')](handleError(_0x45cc6e,null));};exports[_0x530c('0xb2')]=function(_0x5eee37,_0x350a2a){var _0x28c4e2={'raw':![],'where':{'id':_0x5eee37['params']['id']}},_0x503c49={};_0x503c49['model']=_[_0x530c('0x6d')](db[_0x530c('0x2d')]['rawAttributes']);_0x503c49[_0x530c('0x39')]=_['keys'](_0x5eee37[_0x530c('0x39')]);_0x503c49['filters']=_[_0x530c('0x3c')](_0x503c49[_0x530c('0x37')],_0x503c49[_0x530c('0x39')]);_0x28c4e2[_0x530c('0x3b')]=_['intersection'](_0x503c49[_0x530c('0x37')],qs[_0x530c('0x3d')](_0x5eee37['query'][_0x530c('0x3d')]));_0x28c4e2[_0x530c('0x3b')]=_0x28c4e2[_0x530c('0x3b')][_0x530c('0x3e')]?_0x28c4e2[_0x530c('0x3b')]:_0x503c49[_0x530c('0x37')];if(_0x5eee37[_0x530c('0x39')][_0x530c('0xb3')]){_0x28c4e2[_0x530c('0xb4')]=[{'all':!![]}];}_0x28c4e2=_[_0x530c('0x99')]({},_0x28c4e2,_0x5eee37['options']);return db[_0x530c('0x2d')][_0x530c('0x63')](_0x28c4e2)[_0x530c('0x21')](handleEntityNotFound(_0x350a2a,null))[_0x530c('0x21')](respondWithResult(_0x350a2a,null))['catch'](handleError(_0x350a2a,null));};exports['create']=function(_0x417f52,_0x5309d6){return db[_0x530c('0x2d')][_0x530c('0xb5')](_0x417f52[_0x530c('0xb6')],{})[_0x530c('0x21')](respondWithResult(_0x5309d6,0xc9))['catch'](handleError(_0x5309d6,null));};exports[_0x530c('0x20')]=function(_0x189137,_0x17e70a){if(_0x189137[_0x530c('0xb6')]['id']){delete _0x189137[_0x530c('0xb6')]['id'];}return db[_0x530c('0x2d')][_0x530c('0x63')]({'where':{'id':_0x189137['params']['id']}})[_0x530c('0x21')](handleEntityNotFound(_0x17e70a,null))['then'](saveUpdates(_0x189137[_0x530c('0xb6')],null))[_0x530c('0x21')](respondWithResult(_0x17e70a,null))[_0x530c('0x33')](handleError(_0x17e70a,null));};exports[_0x530c('0x22')]=function(_0x3387ef,_0x3cf7f0){return db[_0x530c('0x2d')][_0x530c('0x63')]({'where':{'id':_0x3387ef[_0x530c('0xb7')]['id']}})['then'](handleEntityNotFound(_0x3cf7f0,null))['then'](removeEntity(_0x3cf7f0,null))[_0x530c('0x33')](handleError(_0x3cf7f0,null));};exports[_0x530c('0xb8')]=function(_0x413a3a,_0x13d010){return db[_0x530c('0x2d')]['describe']()[_0x530c('0x21')](respondWithResult(_0x13d010,null))['catch'](handleError(_0x13d010,null));};exports[_0x530c('0xb9')]=function(_0x248dfc,_0x2ad119,_0x18991e){return db['MailMessage'][_0x530c('0x63')]({'where':{'id':_0x248dfc[_0x530c('0xb7')]['id']}})[_0x530c('0x21')](handleEntityNotFound(_0x2ad119,null))[_0x530c('0x21')](function(_0x5bc91b){if(_0x5bc91b){return _0x5bc91b['addMessage'](_0x248dfc[_0x530c('0xb6')][_0x530c('0xba')],_[_0x530c('0xbb')](_0x248dfc[_0x530c('0xb6')],[_0x530c('0xba'),'id'])||{});}})['then'](respondWithResult(_0x2ad119,null))[_0x530c('0x33')](handleError(_0x2ad119,null));};exports[_0x530c('0xbc')]=function(_0x1fe005,_0x5571bc,_0x9a4053){var _0x148849={'raw':![],'where':{}};var _0x5d3ca1={};var _0x5a0ddd={'count':0x0,'rows':[]};return db[_0x530c('0x2d')][_0x530c('0x2e')]({'where':{'id':_0x1fe005[_0x530c('0xb7')]['id']}})[_0x530c('0x21')](handleEntityNotFound(_0x5571bc,null))[_0x530c('0x21')](function(_0x304ff9){if(_0x304ff9){_0x5d3ca1[_0x530c('0x37')]=_[_0x530c('0x6d')](db[_0x530c('0xbd')][_0x530c('0xbe')]);_0x5d3ca1[_0x530c('0x39')]=_[_0x530c('0x6d')](_0x1fe005[_0x530c('0x39')]);_0x5d3ca1[_0x530c('0x3a')]=_[_0x530c('0x3c')](_0x5d3ca1[_0x530c('0x37')],_0x5d3ca1['query']);_0x148849[_0x530c('0x3b')]=_[_0x530c('0x3c')](_0x5d3ca1[_0x530c('0x37')],qs[_0x530c('0x3d')](_0x1fe005[_0x530c('0x39')][_0x530c('0x3d')]));_0x148849['attributes']=_0x148849[_0x530c('0x3b')][_0x530c('0x3e')]?_0x148849['attributes']:_0x5d3ca1[_0x530c('0x37')];if(!_0x1fe005[_0x530c('0x39')]['hasOwnProperty']('nolimit')){_0x148849[_0x530c('0x1b')]=qs[_0x530c('0x1b')](_0x1fe005[_0x530c('0x39')][_0x530c('0x1b')]);_0x148849[_0x530c('0x1a')]=qs[_0x530c('0x1a')](_0x1fe005['query']['offset']);}_0x148849[_0x530c('0x41')]=qs[_0x530c('0x42')](_0x1fe005[_0x530c('0x39')]['sort']);_0x148849['where']=qs[_0x530c('0x3a')](_[_0x530c('0x44')](_0x1fe005['query'],_0x5d3ca1['filters']));_0x148849[_0x530c('0x43')][_0x530c('0xbf')]=_0x304ff9['id'];if(_0x1fe005[_0x530c('0x39')]['filter']){_0x148849['where']=_[_0x530c('0x99')](_0x148849[_0x530c('0x43')],{'$or':_[_0x530c('0x38')](_0x148849[_0x530c('0x3b')],function(_0x226676){var _0xd70755={};_0xd70755[_0x226676]={'$like':'%'+_0x1fe005[_0x530c('0x39')][_0x530c('0x7f')]+'%'};return _0xd70755;})});}if(_0x1fe005['query'][_0x530c('0x75')]){var _0x47d6b1=_0x1fe005[_0x530c('0x39')]['$gte'][_0x530c('0x2a')](',');var _0x17eee7={};_0x17eee7[_0x47d6b1[0x0]]={'$gte':moment(_0x47d6b1[0x1])[_0x530c('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')};_0x148849[_0x530c('0x43')]=_[_0x530c('0x99')](_0x148849[_0x530c('0x43')],_0x17eee7);}_0x148849=_[_0x530c('0x99')]({},_0x148849,_0x1fe005['options']);return db[_0x530c('0xbd')][_0x530c('0x19')]({'where':_0x148849[_0x530c('0x43')]})[_0x530c('0x21')](function(_0x4e5d4e){_0x5a0ddd[_0x530c('0x19')]=_0x4e5d4e;if(_0x1fe005[_0x530c('0x39')]['includeAll']){_0x148849[_0x530c('0xb4')]=[{'all':!![]}];}return db['MailMessage'][_0x530c('0xc1')](_0x148849);})[_0x530c('0x21')](function(_0x32577){_0x5a0ddd[_0x530c('0xc2')]=_0x32577;return _0x5a0ddd;});}})['then'](respondWithFilteredResult(_0x5571bc,_0x148849))[_0x530c('0x33')](handleError(_0x5571bc,null));};exports[_0x530c('0xc3')]=function(_0x278467,_0x58849a,_0x33bc1d){return db[_0x530c('0x2d')][_0x530c('0x63')]({'where':{'id':_0x278467[_0x530c('0xb7')]['id']}})[_0x530c('0x21')](handleEntityNotFound(_0x58849a,null))[_0x530c('0x21')](function(_0x4c9365){if(_0x4c9365){return _0x4c9365[_0x530c('0xc4')](_0x278467[_0x530c('0xb6')][_0x530c('0xba')],_['omit'](_0x278467[_0x530c('0xb6')],[_0x530c('0xba'),'id'])||{})[_0x530c('0xc5')](function(){return db['Tag'][_0x530c('0xc1')]({'attributes':['id',_0x530c('0x25'),_0x530c('0x47')],'where':{'id':_0x278467[_0x530c('0xb6')][_0x530c('0xba')]}});})[_0x530c('0x21')](function(_0x292287){socket[_0x530c('0xc6')]('mailInteractionTags:save',{'id':Number(_0x278467[_0x530c('0xb7')]['id']),'tags':_0x292287||[]});return{'id':Number(_0x278467[_0x530c('0xb7')]['id']),'tags':_0x292287||[]};});}})['then'](respondWithResult(_0x58849a,null))[_0x530c('0x33')](handleError(_0x58849a,null));};exports[_0x530c('0xc7')]=function(_0x3ea854,_0x1d557f,_0x488b9d){return db['MailInteraction'][_0x530c('0x63')]({'where':{'id':_0x3ea854[_0x530c('0xb7')]['id']}})[_0x530c('0x21')](handleEntityNotFound(_0x1d557f,null))[_0x530c('0x21')](function(_0x21302a){if(_0x21302a){return _0x21302a[_0x530c('0xc7')](_0x3ea854[_0x530c('0x39')][_0x530c('0xba')]);}})['then'](respondWithStatusCode(_0x1d557f,null))[_0x530c('0x33')](handleError(_0x1d557f,null));};exports['download']=function(_0x45a316,_0x470483){var _0x2c78dd=moment()['unix']()[_0x530c('0x97')]();var _0xffafc0=path[_0x530c('0xc8')](config[_0x530c('0xc9')],_0x530c('0xca'),_0x530c('0xcb'),_0x530c('0xcc'));var _0x2c7619=path['join'](config[_0x530c('0xc9')],'server',_0x530c('0xcb'),'attachments');var _0x1cb04d=path['join'](_0xffafc0,_0x2c78dd);var _0x1c3347=util['format']('transcript-%d-%s.zip',_0x45a316[_0x530c('0xb7')]['id'],_0x2c78dd);var _0x38effa=path['join'](_0xffafc0,_0x1c3347);var _0x3d928b=[];if(_0x45a316['query'][_0x530c('0xcd')]){_0x3d928b['push']({'model':db[_0x530c('0xce')],'as':_0x530c('0xcf'),'raw':!![]});}var _0x8ca991=[{'model':db[_0x530c('0xbd')],'as':_0x530c('0xd0'),'attributes':['id',_0x530c('0xb6'),'from','to','cc',_0x530c('0xd1'),_0x530c('0xd2'),_0x530c('0x74')],'where':{'secret':![]},'order':qs[_0x530c('0x42')]('id'),'include':_0x3d928b}];return db[_0x530c('0x2d')][_0x530c('0x63')]({'where':{'id':_0x45a316[_0x530c('0xb7')]['id']},'include':_0x8ca991})[_0x530c('0x21')](handleEntityNotFound(_0x470483,null))[_0x530c('0x21')](function(_0x4d78f){if(_0x4d78f&&_0x4d78f['Messages']){var _0x38f1d2=_0x4d78f[_0x530c('0xd3')]({'plain':!![]});fs[_0x530c('0xd4')](_0x1cb04d);return BPromise[_0x530c('0xd5')](_0x38f1d2['Messages'],function(_0x399e2e,_0x490255){var _0x5c69f1={'from':_0x399e2e[_0x530c('0x4a')],'to':_0x399e2e['to'],'subject':_0x399e2e[_0x530c('0xd2')],'html':_0x399e2e['body'],'headers':{'Date':moment(_0x399e2e['createdAt'])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x399e2e['cc']){_0x5c69f1[_0x530c('0xd6')]['Cc']=_0x399e2e['cc'];}if(_0x399e2e[_0x530c('0xd1')]){_0x5c69f1['headers'][_0x530c('0xd7')]=_0x399e2e[_0x530c('0xd1')];}return new BPromise(function(_0xc8d9ba,_0x4a6c18){if(_0x399e2e[_0x530c('0xcf')]){for(var _0x4bd5ee=0x0;_0x4bd5ee<_0x399e2e[_0x530c('0xcf')][_0x530c('0x3e')];_0x4bd5ee++){var _0x5b9631=_0x399e2e[_0x530c('0xcf')][_0x4bd5ee];var _0x31d152=path[_0x530c('0xc8')](_0x2c7619,_0x5b9631[_0x530c('0xd8')]);if(fs['existsSync'](_0x31d152)){_0x5c69f1['attachments'][_0x530c('0x2c')]({'name':_0x5b9631['name'],'contentType':_0x5b9631[_0x530c('0x35')],'data':fs['readFileSync'](_0x31d152)});}}}emlformat[_0x530c('0xd9')](_0x5c69f1,function(_0x58515f,_0x339f66){if(_0x58515f)return _0x4a6c18(_0x58515f);fs['writeFileSync'](path[_0x530c('0xc8')](_0x1cb04d,util[_0x530c('0xc0')](_0x530c('0xda'),_0x490255)),_0x339f66);return _0xc8d9ba(_0x339f66);});});})[_0x530c('0x21')](function(){return new BPromise(function(_0x136fb7,_0x41662b){zipdir(_0x1cb04d,{'saveTo':_0x38effa},function(_0x57a6c9,_0x4e3900){if(_0x57a6c9)return _0x41662b(_0x57a6c9);return _0x136fb7(_0x4e3900);});})[_0x530c('0x21')](function(){return new BPromise(function(_0x4d5827,_0x39a5eb){rimraf(_0x1cb04d,function(_0x297305){if(_0x297305)_0x39a5eb(_0x297305);return _0x4d5827();});});})[_0x530c('0x21')](function(){return _0x470483['download'](_0x38effa,_0x1c3347,function(_0x478958){if(_0x478958){console[_0x530c('0xdb')](_0x530c('0xdc'),_0x478958);}else{fs[_0x530c('0xdd')](_0x38effa);}});});});}else{return _0x470483[_0x530c('0x15')](0xc8);}})[_0x530c('0x33')](handleError(_0x470483,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 5d9a0c1..db2cded 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 _0x689f=['../../mysqldb','MailInteraction','MailMessage','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x689f,0x18e));var _0xf689=function(_0x3c9bc6,_0x36f624){_0x3c9bc6=_0x3c9bc6-0x0;var _0x8e1377=_0x689f[_0x3c9bc6];return _0x8e1377;};'use strict';var EventEmitter=require(_0xf689('0x0'));var MailInteraction=require(_0xf689('0x1'))['db'][_0xf689('0x2')];var MailMessage=require(_0xf689('0x1'))['db'][_0xf689('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf689('0x4'),'afterUpdate':_0xf689('0x5'),'afterDestroy':_0xf689('0x6')};function emitEvent(_0x1989ee){return function(_0x3e4c9b,_0x8850e8,_0x59912a){_0x3e4c9b[_0xf689('0x7')]({'attributes':['id'],'raw':!![]})[_0xf689('0x8')](function(_0x8e3e06){_0x3e4c9b[_0xf689('0x9')](_0xf689('0xa'),_0x8e3e06[_0xf689('0xb')](function(_0xdb14b0){return{'id':_0xdb14b0['id']};}));return MailMessage[_0xf689('0xc')]({'where':{'MailInteractionId':_0x3e4c9b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf689('0x8')](function(_0x164143){_0x3e4c9b[_0xf689('0x9')](_0xf689('0xd'),_0x164143['length']);MailInteractionEvents['emit'](_0x1989ee+':'+_0x3e4c9b['id'],_0x3e4c9b);MailInteractionEvents[_0xf689('0xe')](_0x1989ee,_0x3e4c9b);_0x59912a(null);})[_0xf689('0xf')](_0x59912a(null));};}for(var e in events){if(events[_0xf689('0x10')](e)){var event=events[e];MailInteraction[_0xf689('0x11')](e,emitEvent(event));}}module[_0xf689('0x12')]=MailInteractionEvents; \ No newline at end of file +var _0x5f79=['length','emit','catch','hook','exports','../../mysqldb','MailInteraction','setMaxListeners','update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages'];(function(_0x317f30,_0x38db95){var _0x2b2751=function(_0x2909f2){while(--_0x2909f2){_0x317f30['push'](_0x317f30['shift']());}};_0x2b2751(++_0x38db95);}(_0x5f79,0x126));var _0x95f7=function(_0x2c18a8,_0x24eaa5){_0x2c18a8=_0x2c18a8-0x0;var _0x1e009a=_0x5f79[_0x2c18a8];return _0x1e009a;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x95f7('0x0'))['db'][_0x95f7('0x1')];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x95f7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x95f7('0x3'),'afterDestroy':_0x95f7('0x4')};function emitEvent(_0x4e2b38){return function(_0x4d1578,_0x4b9023,_0x1936c3){_0x4d1578[_0x95f7('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x255f83){_0x4d1578[_0x95f7('0x6')](_0x95f7('0x7'),_0x255f83[_0x95f7('0x8')](function(_0x349d3b){return{'id':_0x349d3b['id']};}));return MailMessage[_0x95f7('0x9')]({'where':{'MailInteractionId':_0x4d1578['id'],'direction':'in','read':![]},'raw':!![]});})[_0x95f7('0xa')](function(_0x3f8b51){_0x4d1578['setDataValue'](_0x95f7('0xb'),_0x3f8b51[_0x95f7('0xc')]);MailInteractionEvents[_0x95f7('0xd')](_0x4e2b38+':'+_0x4d1578['id'],_0x4d1578);MailInteractionEvents['emit'](_0x4e2b38,_0x4d1578);_0x1936c3(null);})[_0x95f7('0xe')](_0x1936c3(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x95f7('0xf')](e,emitEvent(event));}}module[_0x95f7('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index d890ec1..847e5c3 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 _0xc40b=['exports','define','MailInteraction','fti_mail_interactions','subject','FULLTEXT','substatus','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','substatusAt','models','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc40b,0x95));var _0xbc40=function(_0x2ae6ee,_0x16805a){_0x2ae6ee=_0x2ae6ee-0x0;var _0x17653b=_0xc40b[_0x2ae6ee];return _0x17653b;};'use strict';var _=require(_0xbc40('0x0'));var util=require('util');var logger=require(_0xbc40('0x1'))(_0xbc40('0x2'));var moment=require('moment');var BPromise=require(_0xbc40('0x3'));var rp=require(_0xbc40('0x4'));var fs=require('fs');var path=require(_0xbc40('0x5'));var rimraf=require(_0xbc40('0x6'));var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0xbc40('0x7')]=function(_0x300dbb,_0x1a8dab){return _0x300dbb[_0xbc40('0x8')](_0xbc40('0x9'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xbc40('0xa'),'fields':[_0xbc40('0xb'),'to'],'type':_0xbc40('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x12788a,_0x199c44,_0x148b19){if(_0x12788a[_0xbc40('0xd')]){_0x12788a['substatusAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x12788a[_0xbc40('0xe')]){_0x12788a[_0xbc40('0xf')]=moment()[_0xbc40('0x10')](_0xbc40('0x11'));}_0x148b19(null,_0x199c44);},'beforeUpdate':function(_0x5cccc2,_0x45775f,_0xf27e1c){if(_0x5cccc2[_0xbc40('0x12')]('substatus')){_0x5cccc2[_0xbc40('0x13')]=_0x5cccc2[_0xbc40('0xd')]?moment()[_0xbc40('0x10')](_0xbc40('0x11')):null;}if(_0x5cccc2[_0xbc40('0x12')](_0xbc40('0xe'))){_0x5cccc2[_0xbc40('0xf')]=moment()[_0xbc40('0x10')](_0xbc40('0x11'));_0x5cccc2[_0xbc40('0xd')]=null;_0x5cccc2[_0xbc40('0x13')]=null;}_0xf27e1c(null,_0x5cccc2);},'afterUpdate':function(_0x1ade75,_0x136648,_0x711470){var _0x395996=_0x300dbb[_0xbc40('0x14')];var _0x5df5d0=_0x1ade75['get']({'plain':!![]});if(_0x5df5d0['closed']){return _0x395996['MailMessage'][_0xbc40('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x5df5d0['id']}})[_0xbc40('0x16')](function(){_0x711470();})[_0xbc40('0x17')](function(_0xa84222){_0x711470(_0xa84222);});}else{_0x711470();}}},'charset':_0xbc40('0x18'),'collate':_0xbc40('0x19')});}; \ No newline at end of file +var _0xc718=['api','bluebird','request-promise','../../config/environment','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','MailMessage','update','then','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x269394,_0x49ae8d){var _0x40e14f=function(_0x4a24c8){while(--_0x4a24c8){_0x269394['push'](_0x269394['shift']());}};_0x40e14f(++_0x49ae8d);}(_0xc718,0xb6));var _0x8c71=function(_0x59e564,_0x5936f5){_0x59e564=_0x59e564-0x0;var _0x461a11=_0xc718[_0x59e564];return _0x461a11;};'use strict';var _=require(_0x8c71('0x0'));var util=require('util');var logger=require(_0x8c71('0x1'))(_0x8c71('0x2'));var moment=require('moment');var BPromise=require(_0x8c71('0x3'));var rp=require(_0x8c71('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8c71('0x5'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x49ce50,_0xa3ec25){return _0x49ce50['define'](_0x8c71('0x6'),attributes,{'tableName':_0x8c71('0x7'),'paranoid':![],'indexes':[{'name':_0x8c71('0x8'),'fields':[_0x8c71('0x9'),'to'],'type':_0x8c71('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5272f4,_0xaeb417,_0xa09e14){if(_0x5272f4[_0x8c71('0xb')]){_0x5272f4[_0x8c71('0xc')]=moment()[_0x8c71('0xd')](_0x8c71('0xe'));}if(_0x5272f4[_0x8c71('0xf')]){_0x5272f4[_0x8c71('0x10')]=moment()[_0x8c71('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0xa09e14(null,_0xaeb417);},'beforeUpdate':function(_0x386eea,_0x797409,_0x9766f){if(_0x386eea[_0x8c71('0x11')](_0x8c71('0xb'))){_0x386eea[_0x8c71('0xc')]=_0x386eea[_0x8c71('0xb')]?moment()[_0x8c71('0xd')](_0x8c71('0xe')):null;}if(_0x386eea[_0x8c71('0x11')](_0x8c71('0xf'))){_0x386eea[_0x8c71('0x10')]=moment()[_0x8c71('0xd')](_0x8c71('0xe'));_0x386eea[_0x8c71('0xb')]=null;_0x386eea[_0x8c71('0xc')]=null;}_0x9766f(null,_0x386eea);},'afterUpdate':function(_0x461978,_0x10ff21,_0x599894){var _0x2588b3=_0x49ce50[_0x8c71('0x12')];var _0x4ffa9a=_0x461978['get']({'plain':!![]});if(_0x4ffa9a[_0x8c71('0xf')]){return _0x2588b3[_0x8c71('0x13')][_0x8c71('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x4ffa9a['id']}})[_0x8c71('0x15')](function(){_0x599894();})['catch'](function(_0x2b22c8){_0x599894(_0x2b22c8);});}else{_0x599894();}}},'charset':'utf8mb4','collate':_0x8c71('0x16')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 01475e8..ac1860a 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 _0x95af=['then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateMailInteraction','update','body','options','raw','attributes','limit','stringify','catch','AddTagsToMailInteraction','MailInteraction','where','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','./mailInteraction.socket','request'];(function(_0x3fad16,_0x1e6174){var _0x2d6320=function(_0x40ea9f){while(--_0x40ea9f){_0x3fad16['push'](_0x3fad16['shift']());}};_0x2d6320(++_0x1e6174);}(_0x95af,0x173));var _0xf95a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x95af[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xf95a('0x0'));var util=require(_0xf95a('0x1'));var moment=require('moment');var BPromise=require(_0xf95a('0x2'));var rs=require(_0xf95a('0x3'));var fs=require('fs');var Redis=require(_0xf95a('0x4'));var db=require(_0xf95a('0x5'))['db'];var utils=require(_0xf95a('0x6'));var logger=require(_0xf95a('0x7'))(_0xf95a('0x8'));var config=require('../../config/environment');var jayson=require(_0xf95a('0x9'));var client=jayson['client'][_0xf95a('0xa')]({'port':0x232a});config['redis']=_[_0xf95a('0xb')](config[_0xf95a('0xc')],{'host':_0xf95a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf95a('0xc')]));require(_0xf95a('0xe'))['register'](socket);function respondWithRpcPromise(_0x1e5aa3,_0x49656e,_0x28fc23){return new BPromise(function(_0x1058b6,_0x2a24bd){return client[_0xf95a('0xf')](_0x1e5aa3,_0x28fc23)[_0xf95a('0x10')](function(_0xf221e4){logger[_0xf95a('0x11')](_0xf95a('0x12'),_0x49656e,_0xf95a('0x13'));logger[_0xf95a('0x14')](_0xf95a('0x15'),_0x49656e,_0xf95a('0x13'),JSON['stringify'](_0xf221e4));if(_0xf221e4[_0xf95a('0x16')]){if(_0xf221e4[_0xf95a('0x16')][_0xf95a('0x17')]===0x1f4){logger['error'](_0xf95a('0x12'),_0x49656e,_0xf221e4['error'][_0xf95a('0x18')]);return _0x2a24bd(_0xf221e4['error'][_0xf95a('0x18')]);}logger[_0xf95a('0x16')](_0xf95a('0x12'),_0x49656e,_0xf221e4['error'][_0xf95a('0x18')]);return _0x1058b6(_0xf221e4[_0xf95a('0x16')][_0xf95a('0x18')]);}else{logger[_0xf95a('0x11')](_0xf95a('0x12'),_0x49656e,_0xf95a('0x13'));_0x1058b6(_0xf221e4[_0xf95a('0x19')][_0xf95a('0x18')]);}})['catch'](function(_0x185f7f){logger[_0xf95a('0x16')](_0xf95a('0x12'),_0x49656e,_0x185f7f);_0x2a24bd(_0x185f7f);});});}exports[_0xf95a('0x1a')]=function(_0x10da56){var _0x10386a=this;return new Promise(function(_0x2d2528,_0x53ffb1){return db['MailInteraction'][_0xf95a('0x1b')](_0x10da56[_0xf95a('0x1c')],{'raw':_0x10da56[_0xf95a('0x1d')]?_0x10da56[_0xf95a('0x1d')][_0xf95a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10da56[_0xf95a('0x1d')]?_0x10da56[_0xf95a('0x1d')]['where']||null:null,'attributes':_0x10da56[_0xf95a('0x1d')]?_0x10da56[_0xf95a('0x1d')][_0xf95a('0x1f')]||null:null,'limit':_0x10da56['options']?_0x10da56[_0xf95a('0x1d')][_0xf95a('0x20')]||null:null})[_0xf95a('0x10')](function(_0x2a3de2){logger[_0xf95a('0x11')](_0xf95a('0x1a'),_0x10da56);logger[_0xf95a('0x14')](_0xf95a('0x1a'),_0x10da56,JSON[_0xf95a('0x21')](_0x2a3de2));_0x2d2528(_0x2a3de2);})[_0xf95a('0x22')](function(_0x3a3761){logger['error'](_0xf95a('0x1a'),_0x3a3761['message'],_0x10da56);_0x53ffb1(_0x10386a[_0xf95a('0x16')](0x1f4,_0x3a3761['message']));});});};exports[_0xf95a('0x23')]=function(_0x2cdef2){return new Promise(function(_0x2b0c26,_0x495f46){return db[_0xf95a('0x24')]['find']({'where':_0x2cdef2[_0xf95a('0x1d')]?_0x2cdef2[_0xf95a('0x1d')][_0xf95a('0x25')]||null:null})[_0xf95a('0x10')](function(_0x368a13){if(_0x368a13){return _0x368a13[_0xf95a('0x26')](_0x2cdef2[_0xf95a('0x1c')][_0xf95a('0x27')],_[_0xf95a('0x28')](_0x2cdef2['body'],[_0xf95a('0x27'),'id'])||{});}})[_0xf95a('0x29')](function(_0x106f30){logger[_0xf95a('0x11')](_0xf95a('0x2a'),_0x2cdef2);logger['debug'](_0xf95a('0x2a'),_0x2cdef2,JSON[_0xf95a('0x21')](_0x106f30));_0x2b0c26(_0x106f30);})[_0xf95a('0x22')](function(_0x893a61){logger['error'](_0xf95a('0x2a'),_0x893a61[_0xf95a('0x18')],_0x2cdef2);_0x495f46(_this[_0xf95a('0x16')](0x1f4,_0x893a61[_0xf95a('0x18')]));});});}; \ No newline at end of file +var _0x1752=['body','omit','info','AddTags','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailInteraction.socket','register','request','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','MailInteraction,\x20%s,\x20%s','message','catch','UpdateMailInteraction','options','raw','where','limit','then','debug','AddTagsToMailInteraction','MailInteraction','find'];(function(_0x2ddfe6,_0x3f7c80){var _0x10c0b7=function(_0x264aee){while(--_0x264aee){_0x2ddfe6['push'](_0x2ddfe6['shift']());}};_0x10c0b7(++_0x3f7c80);}(_0x1752,0xa5));var _0x2175=function(_0x3853f,_0x5ab624){_0x3853f=_0x3853f-0x0;var _0x2a0394=_0x1752[_0x3853f];return _0x2a0394;};'use strict';var _=require('lodash');var util=require(_0x2175('0x0'));var moment=require(_0x2175('0x1'));var BPromise=require(_0x2175('0x2'));var rs=require(_0x2175('0x3'));var fs=require('fs');var Redis=require(_0x2175('0x4'));var db=require(_0x2175('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2175('0x6'))(_0x2175('0x7'));var config=require(_0x2175('0x8'));var jayson=require(_0x2175('0x9'));var client=jayson[_0x2175('0xa')][_0x2175('0xb')]({'port':0x232a});config[_0x2175('0xc')]=_[_0x2175('0xd')](config[_0x2175('0xc')],{'host':_0x2175('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2175('0xc')]));require(_0x2175('0xf'))[_0x2175('0x10')](socket);function respondWithRpcPromise(_0x455803,_0x77e3fa,_0x4be8c8){return new BPromise(function(_0x5ad5ad,_0x5717b0){return client[_0x2175('0x11')](_0x455803,_0x4be8c8)['then'](function(_0x5e275f){logger['info']('MailInteraction,\x20%s,\x20%s',_0x77e3fa,_0x2175('0x12'));logger['debug'](_0x2175('0x13'),_0x77e3fa,_0x2175('0x12'),JSON['stringify'](_0x5e275f));if(_0x5e275f[_0x2175('0x14')]){if(_0x5e275f[_0x2175('0x14')][_0x2175('0x15')]===0x1f4){logger[_0x2175('0x14')](_0x2175('0x16'),_0x77e3fa,_0x5e275f[_0x2175('0x14')][_0x2175('0x17')]);return _0x5717b0(_0x5e275f[_0x2175('0x14')]['message']);}logger['error'](_0x2175('0x16'),_0x77e3fa,_0x5e275f[_0x2175('0x14')][_0x2175('0x17')]);return _0x5ad5ad(_0x5e275f['error']['message']);}else{logger['info'](_0x2175('0x16'),_0x77e3fa,_0x2175('0x12'));_0x5ad5ad(_0x5e275f['result']['message']);}})[_0x2175('0x18')](function(_0x3d6467){logger[_0x2175('0x14')]('MailInteraction,\x20%s,\x20%s',_0x77e3fa,_0x3d6467);_0x5717b0(_0x3d6467);});});}exports[_0x2175('0x19')]=function(_0x5e60ee){var _0x38d6b5=this;return new Promise(function(_0x49ee8e,_0x37818a){return db['MailInteraction']['update'](_0x5e60ee['body'],{'raw':_0x5e60ee[_0x2175('0x1a')]?_0x5e60ee['options'][_0x2175('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e60ee[_0x2175('0x1a')]?_0x5e60ee[_0x2175('0x1a')][_0x2175('0x1c')]||null:null,'attributes':_0x5e60ee[_0x2175('0x1a')]?_0x5e60ee[_0x2175('0x1a')]['attributes']||null:null,'limit':_0x5e60ee[_0x2175('0x1a')]?_0x5e60ee[_0x2175('0x1a')][_0x2175('0x1d')]||null:null})[_0x2175('0x1e')](function(_0x495887){logger['info'](_0x2175('0x19'),_0x5e60ee);logger[_0x2175('0x1f')](_0x2175('0x19'),_0x5e60ee,JSON['stringify'](_0x495887));_0x49ee8e(_0x495887);})[_0x2175('0x18')](function(_0x4d2120){logger['error'](_0x2175('0x19'),_0x4d2120[_0x2175('0x17')],_0x5e60ee);_0x37818a(_0x38d6b5[_0x2175('0x14')](0x1f4,_0x4d2120[_0x2175('0x17')]));});});};exports[_0x2175('0x20')]=function(_0x31cc46){return new Promise(function(_0x40ded,_0x40d8c8){return db[_0x2175('0x21')][_0x2175('0x22')]({'where':_0x31cc46[_0x2175('0x1a')]?_0x31cc46['options'][_0x2175('0x1c')]||null:null})[_0x2175('0x1e')](function(_0x4a41f1){if(_0x4a41f1){return _0x4a41f1['addTags'](_0x31cc46[_0x2175('0x23')]['ids'],_[_0x2175('0x24')](_0x31cc46['body'],['ids','id'])||{});}})['spread'](function(_0x2255e1){logger[_0x2175('0x25')](_0x2175('0x26'),_0x31cc46);logger[_0x2175('0x1f')]('AddTags',_0x31cc46,JSON[_0x2175('0x27')](_0x2255e1));_0x40ded(_0x2255e1);})[_0x2175('0x18')](function(_0x563e97){logger[_0x2175('0x14')](_0x2175('0x26'),_0x563e97['message'],_0x31cc46);_0x40d8c8(_this['error'](0x1f4,_0x563e97['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index d06c29c..c02c399 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 _0xfa85=['save','remove','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events'];(function(_0x14525d,_0x747b83){var _0x26b05c=function(_0xf98e52){while(--_0xf98e52){_0x14525d['push'](_0x14525d['shift']());}};_0x26b05c(++_0x747b83);}(_0xfa85,0x6f));var _0x5fa8=function(_0x5ab0d9,_0xbd1726){_0x5ab0d9=_0x5ab0d9-0x0;var _0x54472a=_0xfa85[_0x5ab0d9];return _0x54472a;};'use strict';var MailInteractionEvents=require(_0x5fa8('0x0'));var events=[_0x5fa8('0x1'),_0x5fa8('0x2'),'update'];function createListener(_0x189e62,_0x419101){return function(_0x3ed420){_0x419101[_0x5fa8('0x3')](_0x189e62,_0x3ed420);};}function removeListener(_0x549b02,_0x2610a3){return function(){MailInteractionEvents[_0x5fa8('0x4')](_0x549b02,_0x2610a3);};}exports[_0x5fa8('0x5')]=function(_0x2edaab){for(var _0x38807a=0x0,_0x5c73d5=events[_0x5fa8('0x6')];_0x38807a<_0x5c73d5;_0x38807a++){var _0x3feaf5=events[_0x38807a];var _0x1a5b37=createListener(_0x5fa8('0x7')+_0x3feaf5,_0x2edaab);MailInteractionEvents['on'](_0x3feaf5,_0x1a5b37);}}; \ No newline at end of file +var _0x8a4c=['save','remove','update','emit','register','length','mailInteraction:','./mailInteraction.events'];(function(_0xdcbbb,_0x39b964){var _0x19bb4e=function(_0x4952b7){while(--_0x4952b7){_0xdcbbb['push'](_0xdcbbb['shift']());}};_0x19bb4e(++_0x39b964);}(_0x8a4c,0x127));var _0xc8a4=function(_0x91384,_0x545eef){_0x91384=_0x91384-0x0;var _0x44daa0=_0x8a4c[_0x91384];return _0x44daa0;};'use strict';var MailInteractionEvents=require(_0xc8a4('0x0'));var events=[_0xc8a4('0x1'),_0xc8a4('0x2'),_0xc8a4('0x3')];function createListener(_0x23785c,_0x3ddf74){return function(_0x34a0f3){_0x3ddf74[_0xc8a4('0x4')](_0x23785c,_0x34a0f3);};}function removeListener(_0x181f83,_0x4d953b){return function(){MailInteractionEvents['removeListener'](_0x181f83,_0x4d953b);};}exports[_0xc8a4('0x5')]=function(_0x1f1590){for(var _0x4d04c8=0x0,_0x40dda3=events[_0xc8a4('0x6')];_0x4d04c8<_0x40dda3;_0x4d04c8++){var _0x213d06=events[_0x4d04c8];var _0xed028f=createListener(_0xc8a4('0x7')+_0x213d06,_0x1f1590);MailInteractionEvents['on'](_0x213d06,_0xed028f);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index d9766d6..fe7f3b5 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 _0xbec5=['/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','mail','mailmessage:create','create','put','/:id/accept','accept'];(function(_0x5acd8e,_0x57f12f){var _0x27bb97=function(_0x3780d6){while(--_0x3780d6){_0x5acd8e['push'](_0x5acd8e['shift']());}};_0x27bb97(++_0x57f12f);}(_0xbec5,0xe5));var _0x5bec=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0xbec5[_0x492535];return _0x256620;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var auth=require(_0x5bec('0x5'));var interaction=require(_0x5bec('0x6'));var config=require('../../config/environment');var controller=require(_0x5bec('0x7'));router[_0x5bec('0x8')]('/',auth[_0x5bec('0x9')](),controller['index']);router[_0x5bec('0x8')](_0x5bec('0xa'),auth[_0x5bec('0x9')](),controller[_0x5bec('0xb')]);router[_0x5bec('0x8')](_0x5bec('0xc'),auth[_0x5bec('0x9')](),controller[_0x5bec('0xd')]);router['get'](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0xf')]);router[_0x5bec('0x10')]('/',auth[_0x5bec('0x9')](),interaction['tracked'](_0x5bec('0x11'),_0x5bec('0x12')),controller[_0x5bec('0x13')]);router['put'](_0x5bec('0xc'),auth[_0x5bec('0x9')](),controller['update']);router[_0x5bec('0x14')](_0x5bec('0x15'),auth[_0x5bec('0x9')](),controller[_0x5bec('0x16')]);router[_0x5bec('0x14')](_0x5bec('0x17'),auth[_0x5bec('0x9')](),controller[_0x5bec('0x18')]);router[_0x5bec('0x19')](_0x5bec('0xc'),auth[_0x5bec('0x9')](),controller[_0x5bec('0x1a')]);module[_0x5bec('0x1b')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','index','describe','/:id','download','post','tracked','mailmessage:create','create','update','put','accept','/:id/reject','delete','destroy','multer'];(function(_0x26b82d,_0x40b9f0){var _0x59374d=function(_0x54740f){while(--_0x54740f){_0x26b82d['push'](_0x26b82d['shift']());}};_0x59374d(++_0x40b9f0);}(_0x3e74,0x175));var _0x43e7=function(_0x344ebb,_0x2be273){_0x344ebb=_0x344ebb-0x0;var _0x25dc13=_0x3e74[_0x344ebb];return _0x25dc13;};'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/download',auth['isAuthenticated'](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth['isAuthenticated'](),interaction[_0x43e7('0xd')]('mail',_0x43e7('0xe')),controller[_0x43e7('0xf')]);router['put'](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router[_0x43e7('0x11')]('/:id/accept',auth['isAuthenticated'](),controller[_0x43e7('0x12')]);router[_0x43e7('0x11')](_0x43e7('0x13'),auth['isAuthenticated'](),controller['reject']);router[_0x43e7('0x14')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 0247ac1..14c256c 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 _0x806d=['medium','BOOLEAN','out','STRING','TEXT','long','DATE','INTEGER','sequelize','lodash','exports'];(function(_0x224dda,_0x16d0f9){var _0x2987ac=function(_0x3b1033){while(--_0x3b1033){_0x224dda['push'](_0x224dda['shift']());}};_0x2987ac(++_0x16d0f9);}(_0x806d,0x131));var _0xd806=function(_0x332cc5,_0x32e2ee){_0x332cc5=_0x332cc5-0x0;var _0x25eadb=_0x806d[_0x332cc5];return _0x25eadb;};'use strict';var Sequelize=require(_0xd806('0x0'));var _=require(_0xd806('0x1'));module[_0xd806('0x2')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xd806('0x3'))},'read':{'type':Sequelize[_0xd806('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd806('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xd806('0x6')](0x1fe)},'from':{'type':Sequelize[_0xd806('0x6')]},'to':{'type':Sequelize[_0xd806('0x7')](_0xd806('0x8'))},'cc':{'type':Sequelize[_0xd806('0x7')](_0xd806('0x8'))},'bcc':{'type':Sequelize[_0xd806('0x7')]('long')},'subject':{'type':Sequelize[_0xd806('0x7')]},'sentAt':{'type':Sequelize[_0xd806('0x9')]},'attach':{'type':Sequelize[_0xd806('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xd806('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xd806('0x7')]('long')},'originCc':{'type':Sequelize[_0xd806('0x7')](_0xd806('0x8'))}}; \ No newline at end of file +var _0xd48e=['long','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','lodash','exports','TEXT'];(function(_0x9c90ec,_0x554e63){var _0x5606e3=function(_0x4150b9){while(--_0x4150b9){_0x9c90ec['push'](_0x9c90ec['shift']());}};_0x5606e3(++_0x554e63);}(_0xd48e,0x93));var _0xed48=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xd48e[_0xc0a3d3];return _0x3386e8;};'use strict';var Sequelize=require('sequelize');var _=require(_0xed48('0x0'));module[_0xed48('0x1')]={'body':{'type':Sequelize[_0xed48('0x2')](_0xed48('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xed48('0x2')]('medium')},'read':{'type':Sequelize[_0xed48('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xed48('0x5')]('in',_0xed48('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xed48('0x7')](0x1fe)},'from':{'type':Sequelize[_0xed48('0x7')]},'to':{'type':Sequelize[_0xed48('0x2')]('long')},'cc':{'type':Sequelize[_0xed48('0x2')](_0xed48('0x3'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xed48('0x8')]},'attach':{'type':Sequelize[_0xed48('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xed48('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT'](_0xed48('0x3'))},'originCc':{'type':Sequelize[_0xed48('0x2')](_0xed48('0x3'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index f7f59c0..bb0ee24 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 _0x6b7e=['ListId','List\x20not\x20found','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','mail-interactions','accept','mail','format','UserId','Contact','MailInteraction','read1stAt','get','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','MailInteractionId','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','download','unix','toString','server','files','tmp','message-%s.eml','bcc','Attachments','from','subject','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','push','readFileSync','err','unlinkSync','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','client','http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','save','destroy','end','stack','name','send','index','map','MailMessage','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','options','find','update','body','params','describe','direction','out','secret','split','MailAccount','findOne','MailAccountId','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','basename'];(function(_0x1f6d96,_0x328869){var _0x4cd64b=function(_0x2777cd){while(--_0x2777cd){_0x1f6d96['push'](_0x1f6d96['shift']());}};_0x4cd64b(++_0x328869);}(_0x6b7e,0xdd));var _0xe6b7=function(_0x537c23,_0x52aad3){_0x537c23=_0x537c23-0x0;var _0x158bee=_0x6b7e[_0x537c23];return _0x158bee;};'use strict';var pdf=require(_0xe6b7('0x0'));var emlformat=require(_0xe6b7('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe6b7('0x2'));var rp=require('request-promise');var moment=require(_0xe6b7('0x3'));var BPromise=require(_0xe6b7('0x4'));var Mustache=require(_0xe6b7('0x5'));var util=require('util');var path=require(_0xe6b7('0x6'));var sox=require(_0xe6b7('0x7'));var csv=require(_0xe6b7('0x8'));var ejs=require(_0xe6b7('0x9'));var fs=require('fs');var _=require(_0xe6b7('0xa'));var squel=require('squel');var crypto=require(_0xe6b7('0xb'));var jsforce=require(_0xe6b7('0xc'));var deskjs=require(_0xe6b7('0xd'));var toCsv=require(_0xe6b7('0x8'));var querystring=require(_0xe6b7('0xe'));var Papa=require(_0xe6b7('0xf'));var Redis=require(_0xe6b7('0x10'));var authService=require(_0xe6b7('0x11'));var qs=require(_0xe6b7('0x12'));var as=require(_0xe6b7('0x13'));var hardwareService=require(_0xe6b7('0x14'));var logger=require('../../config/logger')(_0xe6b7('0x15'));var utils=require('../../config/utils');var config=require(_0xe6b7('0x16'));var db=require(_0xe6b7('0x17'))['db'];config[_0xe6b7('0x18')]=_[_0xe6b7('0x19')](config['redis'],{'host':_0xe6b7('0x1a'),'port':0x18eb});var socket=require(_0xe6b7('0x1b'))(new Redis(config[_0xe6b7('0x18')]));require(_0xe6b7('0x1c'))[_0xe6b7('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe6b7('0x1e')]['http']({'port':0x232c});var client9003=jayson[_0xe6b7('0x1e')][_0xe6b7('0x1f')]({'port':0x232b});var client9002=jayson[_0xe6b7('0x1e')][_0xe6b7('0x1f')]({'port':0x232a});function checkPasswordPattern(_0xea313c,_0x2dac68,_0x4b93b8){if(_0x4b93b8){var _0x25657a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x25657a['test'](_0x2dac68)){return _0xea313c;}else{throw new db[(_0xe6b7('0x20'))]['ValidationError'](_0xe6b7('0x21'));}}else{return _0xea313c;}}function respondWithRpcPromise(_0x2f9c23,_0x155d15,_0x157463,_0x5b4eb1){return new BPromise(function(_0x4a976e,_0x336b35){var _0x2afcd8=_0x5b4eb1||client;return _0x2afcd8[_0xe6b7('0x22')](_0x2f9c23,_0x157463)[_0xe6b7('0x23')](function(_0x30f036){logger[_0xe6b7('0x24')](_0xe6b7('0x25'),_0x155d15,_0xe6b7('0x26'));logger[_0xe6b7('0x27')](_0xe6b7('0x28'),_0x155d15,_0xe6b7('0x26'),JSON[_0xe6b7('0x29')](_0x30f036));if(_0x30f036[_0xe6b7('0x2a')]){if(_0x30f036['error'][_0xe6b7('0x2b')]===0x1f4){logger['error'](_0xe6b7('0x25'),_0x155d15,_0x30f036[_0xe6b7('0x2a')][_0xe6b7('0x2c')]);return _0x336b35(_0x30f036['error'][_0xe6b7('0x2c')]);}logger[_0xe6b7('0x2a')](_0xe6b7('0x25'),_0x155d15,_0x30f036[_0xe6b7('0x2a')][_0xe6b7('0x2c')]);return _0x4a976e(_0x30f036['error']['message']);}else{logger[_0xe6b7('0x24')]('MailMessage,\x20%s,\x20%s',_0x155d15,_0xe6b7('0x26'));_0x4a976e(_0x30f036['result'][_0xe6b7('0x2c')]);}})[_0xe6b7('0x2d')](function(_0x19f2e9){logger[_0xe6b7('0x2a')]('MailMessage,\x20%s,\x20%s',_0x155d15,_0x19f2e9);_0x336b35(_0x19f2e9);});});}function respondWithStatusCode(_0x37e706,_0x131dfb){_0x131dfb=_0x131dfb||0xcc;return function(_0x2d32ba){if(_0x2d32ba){return _0x37e706[_0xe6b7('0x2e')](_0x131dfb);}return _0x37e706[_0xe6b7('0x2f')](_0x131dfb)['end']();};}function respondWithResult(_0x3ebb7b,_0x37294e){_0x37294e=_0x37294e||0xc8;return function(_0x375b2f){if(_0x375b2f){return _0x3ebb7b['status'](_0x37294e)[_0xe6b7('0x30')](_0x375b2f);}};}function respondWithFilteredResult(_0x27ae5f,_0x1f93a4){return function(_0x191594){if(_0x191594){var _0x261286=_0x191594[_0xe6b7('0x31')],_0xce2d31=_0x1f93a4[_0xe6b7('0x32')],_0x451f80=_0x1f93a4[_0xe6b7('0x32')]+_0x1f93a4[_0xe6b7('0x33')],_0xa2ce41;if(_0x451f80>=_0x261286){_0x451f80=_0x261286;_0xa2ce41=0xc8;}else{_0xa2ce41=0xce;}_0x27ae5f['status'](_0xa2ce41);return _0x27ae5f[_0xe6b7('0x34')](_0xe6b7('0x35'),_0xce2d31+'-'+_0x451f80+'/'+_0x261286)[_0xe6b7('0x30')](_0x191594);}return null;};}function patchUpdates(_0x134a16){return function(_0x80d798){try{jsonpatch['apply'](_0x80d798,_0x134a16,!![]);}catch(_0x229896){return BPromise['reject'](_0x229896);}return _0x80d798[_0xe6b7('0x36')]();};}function saveUpdates(_0x799f0e,_0x42d0ce){return function(_0x871327){if(_0x871327){return _0x871327['update'](_0x799f0e)[_0xe6b7('0x23')](function(_0x2284a2){return _0x2284a2;});}return null;};}function removeEntity(_0x47685c,_0x154752){return function(_0x2ec92c){if(_0x2ec92c){return _0x2ec92c[_0xe6b7('0x37')]()[_0xe6b7('0x23')](function(){_0x47685c[_0xe6b7('0x2f')](0xcc)[_0xe6b7('0x38')]();});}};}function handleEntityNotFound(_0x1d0f9a,_0x13dbd9){return function(_0x1c6850){if(!_0x1c6850){_0x1d0f9a['sendStatus'](0x194);}return _0x1c6850;};}function handleError(_0x44698a,_0x54aac0){_0x54aac0=_0x54aac0||0x1f4;return function(_0x334d64){logger['error'](_0x334d64[_0xe6b7('0x39')]);if(_0x334d64['name']){delete _0x334d64[_0xe6b7('0x3a')];}_0x44698a[_0xe6b7('0x2f')](_0x54aac0)[_0xe6b7('0x3b')](_0x334d64);};}exports[_0xe6b7('0x3c')]=function(_0x47202a,_0x30571d){var _0x314180={},_0x20095e={},_0x2a93f1={'count':0x0,'rows':[]};var _0x28aa91=_[_0xe6b7('0x3d')](db[_0xe6b7('0x3e')][_0xe6b7('0x3f')],function(_0x2d2567){return{'name':_0x2d2567['fieldName'],'type':_0x2d2567[_0xe6b7('0x40')][_0xe6b7('0x41')]};});_0x20095e[_0xe6b7('0x42')]=_[_0xe6b7('0x3d')](_0x28aa91,_0xe6b7('0x3a'));_0x20095e[_0xe6b7('0x43')]=_[_0xe6b7('0x44')](_0x47202a[_0xe6b7('0x43')]);_0x20095e[_0xe6b7('0x45')]=_[_0xe6b7('0x46')](_0x20095e[_0xe6b7('0x42')],_0x20095e[_0xe6b7('0x43')]);_0x314180['attributes']=_[_0xe6b7('0x46')](_0x20095e[_0xe6b7('0x42')],qs[_0xe6b7('0x47')](_0x47202a[_0xe6b7('0x43')]['fields']));_0x314180[_0xe6b7('0x48')]=_0x314180[_0xe6b7('0x48')][_0xe6b7('0x49')]?_0x314180['attributes']:_0x20095e[_0xe6b7('0x42')];if(!_0x47202a[_0xe6b7('0x43')]['hasOwnProperty']('nolimit')){_0x314180[_0xe6b7('0x33')]=qs['limit'](_0x47202a[_0xe6b7('0x43')][_0xe6b7('0x33')]);_0x314180[_0xe6b7('0x32')]=qs[_0xe6b7('0x32')](_0x47202a[_0xe6b7('0x43')][_0xe6b7('0x32')]);}_0x314180['order']=qs[_0xe6b7('0x4a')](_0x47202a[_0xe6b7('0x43')][_0xe6b7('0x4a')]);_0x314180[_0xe6b7('0x4b')]=qs[_0xe6b7('0x45')](_[_0xe6b7('0x4c')](_0x47202a[_0xe6b7('0x43')],_0x20095e[_0xe6b7('0x45')]));if(_0x47202a['query'][_0xe6b7('0x4d')]){_0x314180[_0xe6b7('0x4b')]=_[_0xe6b7('0x4e')](_0x314180[_0xe6b7('0x4b')],{'$or':_[_0xe6b7('0x3d')](_0x28aa91,function(_0x54fa78){if(_0x54fa78[_0xe6b7('0x40')]!==_0xe6b7('0x4f')){var _0x39da27={};_0x39da27[_0x54fa78[_0xe6b7('0x3a')]]={'$like':'%'+_0x47202a[_0xe6b7('0x43')][_0xe6b7('0x4d')]+'%'};return _0x39da27;}})});}_0x314180=_[_0xe6b7('0x4e')]({},_0x314180,_0x47202a['options']);var _0x57c928={'where':_0x314180[_0xe6b7('0x4b')]};return db[_0xe6b7('0x3e')][_0xe6b7('0x31')](_0x57c928)[_0xe6b7('0x23')](function(_0x334467){_0x2a93f1['count']=_0x334467;if(_0x47202a[_0xe6b7('0x43')][_0xe6b7('0x50')]){_0x314180[_0xe6b7('0x51')]=[{'all':!![]}];}return db[_0xe6b7('0x3e')][_0xe6b7('0x52')](_0x314180);})['then'](function(_0xce4a86){_0x2a93f1[_0xe6b7('0x53')]=_0xce4a86;return _0x2a93f1;})[_0xe6b7('0x23')](respondWithFilteredResult(_0x30571d,_0x314180))[_0xe6b7('0x2d')](handleError(_0x30571d,null));};exports[_0xe6b7('0x54')]=function(_0x2758ec,_0x34a13a){var _0x906e55={'raw':!![],'where':{'id':_0x2758ec['params']['id']}},_0xf070aa={};_0xf070aa['model']=_[_0xe6b7('0x44')](db[_0xe6b7('0x3e')][_0xe6b7('0x3f')]);_0xf070aa[_0xe6b7('0x43')]=_[_0xe6b7('0x44')](_0x2758ec[_0xe6b7('0x43')]);_0xf070aa[_0xe6b7('0x45')]=_[_0xe6b7('0x46')](_0xf070aa[_0xe6b7('0x42')],_0xf070aa['query']);_0x906e55[_0xe6b7('0x48')]=_[_0xe6b7('0x46')](_0xf070aa[_0xe6b7('0x42')],qs[_0xe6b7('0x47')](_0x2758ec[_0xe6b7('0x43')][_0xe6b7('0x47')]));_0x906e55['attributes']=_0x906e55[_0xe6b7('0x48')][_0xe6b7('0x49')]?_0x906e55[_0xe6b7('0x48')]:_0xf070aa[_0xe6b7('0x42')];if(_0x2758ec['query']['includeAll']){_0x906e55[_0xe6b7('0x51')]=[{'all':!![]}];}_0x906e55=_[_0xe6b7('0x4e')]({},_0x906e55,_0x2758ec[_0xe6b7('0x55')]);return db['MailMessage'][_0xe6b7('0x56')](_0x906e55)[_0xe6b7('0x23')](handleEntityNotFound(_0x34a13a,null))[_0xe6b7('0x23')](respondWithResult(_0x34a13a,null))[_0xe6b7('0x2d')](handleError(_0x34a13a,null));};exports[_0xe6b7('0x57')]=function(_0x465b45,_0x14fe34){if(_0x465b45['body']['id']){delete _0x465b45[_0xe6b7('0x58')]['id'];}return db[_0xe6b7('0x3e')]['find']({'where':{'id':_0x465b45[_0xe6b7('0x59')]['id']}})['then'](handleEntityNotFound(_0x14fe34,null))['then'](saveUpdates(_0x465b45[_0xe6b7('0x58')],null))[_0xe6b7('0x23')](respondWithResult(_0x14fe34,null))[_0xe6b7('0x2d')](handleError(_0x14fe34,null));};exports['destroy']=function(_0x5b69cf,_0x25ad46){return db[_0xe6b7('0x3e')][_0xe6b7('0x56')]({'where':{'id':_0x5b69cf[_0xe6b7('0x59')]['id']}})[_0xe6b7('0x23')](handleEntityNotFound(_0x25ad46,null))[_0xe6b7('0x23')](removeEntity(_0x25ad46,null))[_0xe6b7('0x2d')](handleError(_0x25ad46,null));};exports[_0xe6b7('0x5a')]=function(_0x5a6707,_0x4c4cd8){return db[_0xe6b7('0x3e')][_0xe6b7('0x5a')]()[_0xe6b7('0x23')](respondWithResult(_0x4c4cd8,null))[_0xe6b7('0x2d')](handleError(_0x4c4cd8,null));};exports['create']=function(_0x551772,_0xaf6e28){return db[_0xe6b7('0x3e')]['create'](_0x551772[_0xe6b7('0x58')])[_0xe6b7('0x23')](function(_0x4c71a2){if(_0x4c71a2){if(_0x4c71a2[_0xe6b7('0x5b')]===_0xe6b7('0x5c')&&!_0x4c71a2[_0xe6b7('0x5d')]){var _0x797dda,_0x1732b4,_0x3ffbae;if(_0x551772[_0xe6b7('0x58')]['to']){_0x1732b4=_0x551772[_0xe6b7('0x58')]['to'][_0xe6b7('0x5e')](',')[0x0];}return db[_0xe6b7('0x5f')][_0xe6b7('0x60')]({'where':{'id':_0x4c71a2[_0xe6b7('0x61')]},'include':[{'model':db['CmList'],'as':_0xe6b7('0x62'),'include':[{'model':db[_0xe6b7('0x63')],'as':_0xe6b7('0x64'),'where':{'email':_0x1732b4},'limit':0x1,'order':[[_0xe6b7('0x65'),_0xe6b7('0x66')]]}]},{'model':db[_0xe6b7('0x67')],'as':_0xe6b7('0x68'),'raw':!![]}]})[_0xe6b7('0x23')](function(_0x75bf62){_0x797dda=_0x75bf62;if(_0x797dda&&_0x797dda[_0xe6b7('0x68')]){var _0x230c50={'tls':{'rejectUnauthorized':![]}};if(_[_0xe6b7('0x69')](_0x797dda[_0xe6b7('0x68')][_0xe6b7('0x6a')])){_0x230c50[_0xe6b7('0x6b')]=_0x797dda[_0xe6b7('0x68')][_0xe6b7('0x6b')];_0x230c50[_0xe6b7('0x6c')]=_0x797dda[_0xe6b7('0x68')][_0xe6b7('0x6c')];_0x230c50['secure']=_0x797dda['Smtp'][_0xe6b7('0x6d')];if(_0x797dda['Smtp'][_0xe6b7('0x6e')]){_0x230c50[_0xe6b7('0x6f')]={'user':_0x797dda[_0xe6b7('0x68')][_0xe6b7('0x70')],'pass':_0x797dda[_0xe6b7('0x68')][_0xe6b7('0x71')]};}}else{_0x230c50[_0xe6b7('0x6a')]=_0x797dda[_0xe6b7('0x68')][_0xe6b7('0x6a')];_0x230c50[_0xe6b7('0x6f')]={'user':_0x797dda[_0xe6b7('0x68')][_0xe6b7('0x70')],'pass':_0x797dda['Smtp']['pass']};_0x230c50[_0xe6b7('0x6d')]=_0x797dda[_0xe6b7('0x68')][_0xe6b7('0x6d')];}if(_0x551772[_0xe6b7('0x58')][_0xe6b7('0x72')]&&_0x551772[_0xe6b7('0x58')][_0xe6b7('0x72')][_0xe6b7('0x49')]){for(var _0x2378f6=0x0;_0x2378f6<_0x551772[_0xe6b7('0x58')][_0xe6b7('0x72')]['length'];_0x2378f6+=0x1){_0x551772[_0xe6b7('0x58')][_0xe6b7('0x72')][_0x2378f6]={'filename':_0x551772['body'][_0xe6b7('0x72')][_0x2378f6][_0xe6b7('0x3a')],'path':path[_0xe6b7('0x73')](config[_0xe6b7('0x74')],_0xe6b7('0x75'),_0x551772[_0xe6b7('0x58')][_0xe6b7('0x72')][_0x2378f6][_0xe6b7('0x76')])};}}_0x3ffbae={'account':_0x230c50,'message':_0x551772['body']};return;}})['then'](function(){if(_0x797dda['List']){if(_0x797dda[_0xe6b7('0x62')][_0xe6b7('0x64')]['length']){return _0x797dda[_0xe6b7('0x62')]['Contacts'][0x0];}else{return db[_0xe6b7('0x63')]['create'](_['defaults'](_0x551772['body'],{'firstName':_0x551772[_0xe6b7('0x58')]['to'],'email':_0x551772[_0xe6b7('0x58')]['to'],'phone':_0x551772[_0xe6b7('0x58')]['to'],'ListId':_0x797dda[_0xe6b7('0x77')]}));}}else{throw new Error(_0xe6b7('0x78'));}})['then'](function(){if(_0x3ffbae){return respondWithRpcPromise('SendMail',_0xe6b7('0x79'),_0x3ffbae,client9003)[_0xe6b7('0x23')](function(_0x433c86){return _0x4c71a2[_0xe6b7('0x57')]({'read':!![],'messageId':_0x433c86[_0xe6b7('0x7a')],'sentAt':moment()['format'](_0xe6b7('0x7b'))});})[_0xe6b7('0x2d')](function(_0x28e8a6){logger['error']('%s',JSON[_0xe6b7('0x29')](_0x28e8a6));return _0x4c71a2;});}return _0x4c71a2;});}return _0x4c71a2;}})[_0xe6b7('0x23')](respondWithResult(_0xaf6e28,0xc9))[_0xe6b7('0x2d')](handleError(_0xaf6e28,null));};var interaction_log=require(_0xe6b7('0x7c'))(_0xe6b7('0x7d'));exports[_0xe6b7('0x7e')]=function(_0x3adb7e,_0x15bc2f,_0x436689){var _0x305e83={'channel':_0xe6b7('0x7f')};if(_0x3adb7e[_0xe6b7('0x58')]['id']){delete _0x3adb7e['body']['id'];}_0x3adb7e[_0xe6b7('0x58')]['read']=!![];_0x3adb7e[_0xe6b7('0x58')]['readAt']=moment()[_0xe6b7('0x80')](_0xe6b7('0x7b'));_0x3adb7e[_0xe6b7('0x58')][_0xe6b7('0x81')]=_0x3adb7e[_0xe6b7('0x58')][_0xe6b7('0x81')]||_0x3adb7e[_0xe6b7('0x70')]['id'];return db[_0xe6b7('0x3e')][_0xe6b7('0x56')]({'where':{'id':_0x3adb7e[_0xe6b7('0x59')]['id'],'UserId':null},'include':[{'model':db[_0xe6b7('0x63')],'as':_0xe6b7('0x82')}]})[_0xe6b7('0x23')](handleEntityNotFound(_0x15bc2f,null))['then'](saveUpdates(_0x3adb7e[_0xe6b7('0x58')],null))['then'](function(_0x167014){if(_0x167014){_0x305e83[_0xe6b7('0x2c')]=_0x167014['get']({'plain':!![]});return db[_0xe6b7('0x83')][_0xe6b7('0x56')]({'where':{'id':_0x167014['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x15bc2f,null))[_0xe6b7('0x23')](function(_0x29dad7){if(_0x29dad7){return _0x29dad7[_0xe6b7('0x57')]({'UserId':_0x3adb7e[_0xe6b7('0x58')]['UserId'],'read1stAt':_[_0xe6b7('0x69')](_0x29dad7[_0xe6b7('0x84')])?moment()[_0xe6b7('0x80')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xe6b7('0x23')](function(_0x4bd9f1){if(_0x4bd9f1){_0x305e83['interaction']=_0x4bd9f1[_0xe6b7('0x85')]({'plain':!![]});interaction_log[_0xe6b7('0x24')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3adb7e[_0xe6b7('0x70')]['id'],_0x3adb7e['user'][_0xe6b7('0x3a')],_0x3adb7e['user'][_0xe6b7('0x86')],_0x305e83['interaction']['id'],_0x3adb7e[_0xe6b7('0x58')]?JSON[_0xe6b7('0x29')](_0x3adb7e['body']):_0xe6b7('0x87'));return respondWithRpcPromise(_0xe6b7('0x88'),_0xe6b7('0x89'),_0x305e83);}return null;})['then'](function(_0x14c6ad){if(_0x14c6ad){if(_0x3adb7e[_0xe6b7('0x58')][_0xe6b7('0x8a')]){_0x305e83['message'][_0xe6b7('0x8b')]=util['format'](_0xe6b7('0x8c'),_0x3adb7e[_0xe6b7('0x70')]['name']);_0x305e83['message'][_0xe6b7('0x8d')]=_0x305e83[_0xe6b7('0x8d')];_0x305e83['message'][_0xe6b7('0x8e')]=_0xe6b7('0x7e');return respondWithRpcPromise(_0xe6b7('0x8f'),_0xe6b7('0x8f'),{'event':_0xe6b7('0x90'),'message':_0x305e83[_0xe6b7('0x2c')]},client9002)[_0xe6b7('0x23')](function(){return _0x305e83;});}return _0x305e83;}return null;})[_0xe6b7('0x23')](respondWithResult(_0x15bc2f,null))[_0xe6b7('0x2d')](handleError(_0x15bc2f,null));};var interaction_log=require('../../config/logger')(_0xe6b7('0x7d'));exports[_0xe6b7('0x91')]=function(_0x4ce4a1,_0x152ba9,_0x218564){var _0x15df88={'agent':{},'channel':'mail'};if(_0x4ce4a1[_0xe6b7('0x58')]['id']){delete _0x4ce4a1['body']['id'];}_0x4ce4a1['body'][_0xe6b7('0x81')]=_0x4ce4a1['body'][_0xe6b7('0x81')]||_0x4ce4a1[_0xe6b7('0x70')]['id'];_0x15df88['agent']['id']=_0x4ce4a1[_0xe6b7('0x58')][_0xe6b7('0x81')];return db['MailMessage']['find']({'where':{'id':_0x4ce4a1[_0xe6b7('0x59')]['id'],'UserId':null}})[_0xe6b7('0x23')](handleEntityNotFound(_0x152ba9,null))[_0xe6b7('0x23')](function(_0x52e7b7){if(_0x52e7b7){_0x15df88[_0xe6b7('0x2c')]=_0x52e7b7['get']({'plain':!![]});return db[_0xe6b7('0x83')][_0xe6b7('0x56')]({'where':{'id':_0x52e7b7[_0xe6b7('0x92')]}});}return null;})['then'](handleEntityNotFound(_0x152ba9,null))[_0xe6b7('0x23')](function(_0x18e12e){if(_0x18e12e){_0x15df88[_0xe6b7('0x93')]=_0x18e12e[_0xe6b7('0x85')]({'plain':!![]});interaction_log[_0xe6b7('0x24')](_0xe6b7('0x94'),_0x4ce4a1['user']['id'],_0x4ce4a1[_0xe6b7('0x70')][_0xe6b7('0x3a')],_0x4ce4a1[_0xe6b7('0x70')][_0xe6b7('0x86')],_0x15df88[_0xe6b7('0x93')]['id'],_0x4ce4a1[_0xe6b7('0x58')]?JSON[_0xe6b7('0x29')](_0x4ce4a1[_0xe6b7('0x58')]):'null');return respondWithRpcPromise(_0xe6b7('0x95'),_0xe6b7('0x96'),_0x15df88);}return null;})['then'](function(_0x1464e6){if(_0x1464e6){_0x1464e6[_0xe6b7('0x2c')][_0xe6b7('0x8b')]=util[_0xe6b7('0x80')](_0xe6b7('0x8c'),_0x4ce4a1[_0xe6b7('0x70')][_0xe6b7('0x3a')]);_0x1464e6[_0xe6b7('0x2c')][_0xe6b7('0x8d')]=_0x15df88['channel'];_0x1464e6[_0xe6b7('0x2c')][_0xe6b7('0x8e')]=_0xe6b7('0x91');respondWithRpcPromise('EventManager',_0xe6b7('0x8f'),{'event':'rejectmessage','message':_0x1464e6['message']},client9002);return _0x15df88;}return null;})[_0xe6b7('0x23')](respondWithResult(_0x152ba9,null))[_0xe6b7('0x2d')](handleError(_0x152ba9,null));};exports[_0xe6b7('0x97')]=function(_0x54441c,_0x282ab6){var _0x30f614=moment()[_0xe6b7('0x98')]()[_0xe6b7('0x99')]();var _0x5e7cb6=path[_0xe6b7('0x73')](config[_0xe6b7('0x74')],_0xe6b7('0x9a'),_0xe6b7('0x9b'),_0xe6b7('0x9c'));var _0x127424=path[_0xe6b7('0x73')](config[_0xe6b7('0x74')],_0xe6b7('0x9a'),_0xe6b7('0x9b'),'attachments');var _0x492ff4=util['format'](_0xe6b7('0x9d'),_0x30f614);return db['MailMessage'][_0xe6b7('0x56')]({'where':{'id':_0x54441c['params']['id']},'attributes':['id',_0xe6b7('0x58'),'from','to','cc',_0xe6b7('0x9e'),'subject','createdAt'],'include':_0x54441c[_0xe6b7('0x43')]['attachments']?[{'model':db['Attachment'],'as':_0xe6b7('0x9f')}]:undefined})[_0xe6b7('0x23')](handleEntityNotFound(_0x282ab6,null))[_0xe6b7('0x23')](function(_0x19e897){if(_0x19e897){var _0x107a38=_0x19e897;var _0x306564={'from':_0x107a38[_0xe6b7('0xa0')],'to':_0x107a38['to'],'subject':_0x107a38[_0xe6b7('0xa1')],'html':_0x107a38[_0xe6b7('0x58')],'headers':{'Date':moment(_0x107a38[_0xe6b7('0xa2')])[_0xe6b7('0x80')](_0xe6b7('0xa3'))},'attachments':[]};if(_0x19e897['cc']){_0x306564['headers']['Cc']=_0x19e897['cc'];}if(_0x19e897[_0xe6b7('0x9e')]){_0x306564[_0xe6b7('0xa4')]['Bcc']=_0x19e897[_0xe6b7('0x9e')];}return new BPromise(function(_0x153585,_0x5bdacd){if(_0x19e897[_0xe6b7('0x9f')]){for(var _0x52bba0=0x0;_0x52bba0<_0x19e897['Attachments'][_0xe6b7('0x49')];_0x52bba0++){var _0x153630=_0x19e897['Attachments'][_0x52bba0];var _0xd9bb9=path['join'](_0x127424,_0x153630['basename']);if(fs[_0xe6b7('0xa5')](_0xd9bb9)){_0x306564[_0xe6b7('0x72')][_0xe6b7('0xa6')]({'name':_0x153630[_0xe6b7('0x3a')],'contentType':_0x153630[_0xe6b7('0x40')],'data':fs[_0xe6b7('0xa7')](_0xd9bb9)});}}}emlformat['build'](_0x306564,function(_0x1082d2,_0x4375d2){if(_0x1082d2)return _0x5bdacd(_0x1082d2);fs['writeFileSync'](path['join'](_0x5e7cb6,_0x492ff4),_0x4375d2);return _0x153585(_0x4375d2);});});}})[_0xe6b7('0x23')](function(_0x50309f){if(_0x50309f){return _0x282ab6['download'](path['join'](_0x5e7cb6,_0x492ff4),_0x492ff4,function(_0x3bcee7){if(_0x3bcee7){console['log'](_0xe6b7('0xa8'),_0x3bcee7);}else{fs[_0xe6b7('0xa9')](path[_0xe6b7('0x73')](_0x5e7cb6,_0x492ff4));}});}})['catch'](handleError(_0x282ab6,null));}; \ No newline at end of file +var _0xeee5=['length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','count','includeAll','include','findAll','show','params','options','update','body','find','describe','create','direction','out','secret','split','MailAccount','MailAccountId','CmList','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','port','secure','authentication','auth','user','pass','service','attachments','join','root','server/files/attachments','basename','CmContact','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','mail-interactions','accept','mail','read','readAt','UserId','Contact','get','MailInteraction','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','agent','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','toString','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','type','readFileSync','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.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','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','destroy','end','stack','name','index','map','MailMessage','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xeee5,0x10d));var _0x5eee=function(_0x3c0ccd,_0x1e1335){_0x3c0ccd=_0x3c0ccd-0x0;var _0x23231c=_0xeee5[_0x3c0ccd];return _0x23231c;};'use strict';var pdf=require(_0x5eee('0x0'));var emlformat=require(_0x5eee('0x1'));var rimraf=require(_0x5eee('0x2'));var zipdir=require(_0x5eee('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5eee('0x4'));var moment=require('moment');var BPromise=require(_0x5eee('0x5'));var Mustache=require(_0x5eee('0x6'));var util=require(_0x5eee('0x7'));var path=require(_0x5eee('0x8'));var sox=require(_0x5eee('0x9'));var csv=require(_0x5eee('0xa'));var ejs=require(_0x5eee('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5eee('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5eee('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5eee('0xd'));var qs=require(_0x5eee('0xe'));var as=require(_0x5eee('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x5eee('0x10'));var config=require(_0x5eee('0x11'));var db=require(_0x5eee('0x12'))['db'];config[_0x5eee('0x13')]=_[_0x5eee('0x14')](config[_0x5eee('0x13')],{'host':_0x5eee('0x15'),'port':0x18eb});var socket=require(_0x5eee('0x16'))(new Redis(config['redis']));require(_0x5eee('0x17'))[_0x5eee('0x18')](socket);var jayson=require(_0x5eee('0x19'));var client=jayson[_0x5eee('0x1a')]['http']({'port':0x232c});var client9003=jayson['client'][_0x5eee('0x1b')]({'port':0x232b});var client9002=jayson[_0x5eee('0x1a')][_0x5eee('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x16a159,_0x5a70e0,_0x1e0661){if(_0x1e0661){var _0x21cb40=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x21cb40['test'](_0x5a70e0)){return _0x16a159;}else{throw new db[(_0x5eee('0x1c'))][(_0x5eee('0x1d'))](_0x5eee('0x1e'));}}else{return _0x16a159;}}function respondWithRpcPromise(_0x51618b,_0x340a1a,_0x2bdfb0,_0x3d9b7c){return new BPromise(function(_0xfaced3,_0x31b50b){var _0x3297fe=_0x3d9b7c||client;return _0x3297fe[_0x5eee('0x1f')](_0x51618b,_0x2bdfb0)[_0x5eee('0x20')](function(_0x157d56){logger[_0x5eee('0x21')](_0x5eee('0x22'),_0x340a1a,_0x5eee('0x23'));logger[_0x5eee('0x24')](_0x5eee('0x25'),_0x340a1a,_0x5eee('0x23'),JSON[_0x5eee('0x26')](_0x157d56));if(_0x157d56[_0x5eee('0x27')]){if(_0x157d56[_0x5eee('0x27')][_0x5eee('0x28')]===0x1f4){logger[_0x5eee('0x27')](_0x5eee('0x22'),_0x340a1a,_0x157d56[_0x5eee('0x27')]['message']);return _0x31b50b(_0x157d56['error'][_0x5eee('0x29')]);}logger[_0x5eee('0x27')](_0x5eee('0x22'),_0x340a1a,_0x157d56[_0x5eee('0x27')]['message']);return _0xfaced3(_0x157d56[_0x5eee('0x27')][_0x5eee('0x29')]);}else{logger[_0x5eee('0x21')]('MailMessage,\x20%s,\x20%s',_0x340a1a,'request\x20sent');_0xfaced3(_0x157d56[_0x5eee('0x2a')]['message']);}})[_0x5eee('0x2b')](function(_0x279b07){logger[_0x5eee('0x27')](_0x5eee('0x22'),_0x340a1a,_0x279b07);_0x31b50b(_0x279b07);});});}function respondWithStatusCode(_0x184787,_0x594f6c){_0x594f6c=_0x594f6c||0xcc;return function(_0x20516a){if(_0x20516a){return _0x184787[_0x5eee('0x2c')](_0x594f6c);}return _0x184787[_0x5eee('0x2d')](_0x594f6c)['end']();};}function respondWithResult(_0x30c824,_0x4b4236){_0x4b4236=_0x4b4236||0xc8;return function(_0x345d1){if(_0x345d1){return _0x30c824[_0x5eee('0x2d')](_0x4b4236)[_0x5eee('0x2e')](_0x345d1);}};}function respondWithFilteredResult(_0x4e0029,_0x57fc1a){return function(_0x569fd3){if(_0x569fd3){var _0x2b4eba=_0x569fd3['count'],_0x1da337=_0x57fc1a['offset'],_0x572b1b=_0x57fc1a[_0x5eee('0x2f')]+_0x57fc1a[_0x5eee('0x30')],_0x171ac1;if(_0x572b1b>=_0x2b4eba){_0x572b1b=_0x2b4eba;_0x171ac1=0xc8;}else{_0x171ac1=0xce;}_0x4e0029['status'](_0x171ac1);return _0x4e0029[_0x5eee('0x31')](_0x5eee('0x32'),_0x1da337+'-'+_0x572b1b+'/'+_0x2b4eba)['json'](_0x569fd3);}return null;};}function patchUpdates(_0x39514d){return function(_0x3cb9b9){try{jsonpatch[_0x5eee('0x33')](_0x3cb9b9,_0x39514d,!![]);}catch(_0x27378c){return BPromise[_0x5eee('0x34')](_0x27378c);}return _0x3cb9b9[_0x5eee('0x35')]();};}function saveUpdates(_0x27eead,_0x272b42){return function(_0x3df592){if(_0x3df592){return _0x3df592['update'](_0x27eead)[_0x5eee('0x20')](function(_0x46f434){return _0x46f434;});}return null;};}function removeEntity(_0xe3075,_0x4391c6){return function(_0x21c4ff){if(_0x21c4ff){return _0x21c4ff[_0x5eee('0x36')]()[_0x5eee('0x20')](function(){_0xe3075['status'](0xcc)[_0x5eee('0x37')]();});}};}function handleEntityNotFound(_0x531c4f,_0x3bc8a6){return function(_0xb69cd2){if(!_0xb69cd2){_0x531c4f[_0x5eee('0x2c')](0x194);}return _0xb69cd2;};}function handleError(_0x2cdac1,_0xb2c765){_0xb2c765=_0xb2c765||0x1f4;return function(_0x280422){logger['error'](_0x280422[_0x5eee('0x38')]);if(_0x280422[_0x5eee('0x39')]){delete _0x280422[_0x5eee('0x39')];}_0x2cdac1[_0x5eee('0x2d')](_0xb2c765)['send'](_0x280422);};}exports[_0x5eee('0x3a')]=function(_0x109f3f,_0x4e372e){var _0xeb8a23={},_0x173a08={},_0x2f9b3e={'count':0x0,'rows':[]};var _0x22bee0=_[_0x5eee('0x3b')](db[_0x5eee('0x3c')][_0x5eee('0x3d')],function(_0x2451f7){return{'name':_0x2451f7[_0x5eee('0x3e')],'type':_0x2451f7['type'][_0x5eee('0x3f')]};});_0x173a08['model']=_['map'](_0x22bee0,_0x5eee('0x39'));_0x173a08[_0x5eee('0x40')]=_[_0x5eee('0x41')](_0x109f3f[_0x5eee('0x40')]);_0x173a08[_0x5eee('0x42')]=_[_0x5eee('0x43')](_0x173a08[_0x5eee('0x44')],_0x173a08['query']);_0xeb8a23[_0x5eee('0x45')]=_[_0x5eee('0x43')](_0x173a08[_0x5eee('0x44')],qs[_0x5eee('0x46')](_0x109f3f[_0x5eee('0x40')]['fields']));_0xeb8a23['attributes']=_0xeb8a23[_0x5eee('0x45')][_0x5eee('0x47')]?_0xeb8a23[_0x5eee('0x45')]:_0x173a08[_0x5eee('0x44')];if(!_0x109f3f[_0x5eee('0x40')][_0x5eee('0x48')](_0x5eee('0x49'))){_0xeb8a23[_0x5eee('0x30')]=qs[_0x5eee('0x30')](_0x109f3f['query'][_0x5eee('0x30')]);_0xeb8a23[_0x5eee('0x2f')]=qs[_0x5eee('0x2f')](_0x109f3f['query'][_0x5eee('0x2f')]);}_0xeb8a23[_0x5eee('0x4a')]=qs[_0x5eee('0x4b')](_0x109f3f[_0x5eee('0x40')][_0x5eee('0x4b')]);_0xeb8a23[_0x5eee('0x4c')]=qs['filters'](_['pick'](_0x109f3f[_0x5eee('0x40')],_0x173a08[_0x5eee('0x42')]));if(_0x109f3f[_0x5eee('0x40')]['filter']){_0xeb8a23[_0x5eee('0x4c')]=_['merge'](_0xeb8a23[_0x5eee('0x4c')],{'$or':_[_0x5eee('0x3b')](_0x22bee0,function(_0x4a8d65){if(_0x4a8d65['type']!==_0x5eee('0x4d')){var _0x387c36={};_0x387c36[_0x4a8d65[_0x5eee('0x39')]]={'$like':'%'+_0x109f3f[_0x5eee('0x40')]['filter']+'%'};return _0x387c36;}})});}_0xeb8a23=_['merge']({},_0xeb8a23,_0x109f3f['options']);var _0x1d6542={'where':_0xeb8a23[_0x5eee('0x4c')]};return db['MailMessage'][_0x5eee('0x4e')](_0x1d6542)[_0x5eee('0x20')](function(_0xce49e4){_0x2f9b3e[_0x5eee('0x4e')]=_0xce49e4;if(_0x109f3f[_0x5eee('0x40')][_0x5eee('0x4f')]){_0xeb8a23[_0x5eee('0x50')]=[{'all':!![]}];}return db[_0x5eee('0x3c')][_0x5eee('0x51')](_0xeb8a23);})[_0x5eee('0x20')](function(_0x5f6d88){_0x2f9b3e['rows']=_0x5f6d88;return _0x2f9b3e;})[_0x5eee('0x20')](respondWithFilteredResult(_0x4e372e,_0xeb8a23))[_0x5eee('0x2b')](handleError(_0x4e372e,null));};exports[_0x5eee('0x52')]=function(_0x52ff5b,_0x5029cc){var _0x20fa97={'raw':!![],'where':{'id':_0x52ff5b[_0x5eee('0x53')]['id']}},_0x3d6f62={};_0x3d6f62[_0x5eee('0x44')]=_['keys'](db['MailMessage']['rawAttributes']);_0x3d6f62[_0x5eee('0x40')]=_[_0x5eee('0x41')](_0x52ff5b[_0x5eee('0x40')]);_0x3d6f62[_0x5eee('0x42')]=_[_0x5eee('0x43')](_0x3d6f62[_0x5eee('0x44')],_0x3d6f62[_0x5eee('0x40')]);_0x20fa97[_0x5eee('0x45')]=_['intersection'](_0x3d6f62[_0x5eee('0x44')],qs[_0x5eee('0x46')](_0x52ff5b[_0x5eee('0x40')][_0x5eee('0x46')]));_0x20fa97['attributes']=_0x20fa97['attributes'][_0x5eee('0x47')]?_0x20fa97['attributes']:_0x3d6f62[_0x5eee('0x44')];if(_0x52ff5b[_0x5eee('0x40')][_0x5eee('0x4f')]){_0x20fa97[_0x5eee('0x50')]=[{'all':!![]}];}_0x20fa97=_['merge']({},_0x20fa97,_0x52ff5b[_0x5eee('0x54')]);return db[_0x5eee('0x3c')]['find'](_0x20fa97)['then'](handleEntityNotFound(_0x5029cc,null))[_0x5eee('0x20')](respondWithResult(_0x5029cc,null))[_0x5eee('0x2b')](handleError(_0x5029cc,null));};exports[_0x5eee('0x55')]=function(_0x3bb84a,_0x2d2bdf){if(_0x3bb84a[_0x5eee('0x56')]['id']){delete _0x3bb84a[_0x5eee('0x56')]['id'];}return db[_0x5eee('0x3c')][_0x5eee('0x57')]({'where':{'id':_0x3bb84a[_0x5eee('0x53')]['id']}})[_0x5eee('0x20')](handleEntityNotFound(_0x2d2bdf,null))[_0x5eee('0x20')](saveUpdates(_0x3bb84a['body'],null))[_0x5eee('0x20')](respondWithResult(_0x2d2bdf,null))[_0x5eee('0x2b')](handleError(_0x2d2bdf,null));};exports['destroy']=function(_0x2f64c9,_0x490be4){return db[_0x5eee('0x3c')][_0x5eee('0x57')]({'where':{'id':_0x2f64c9[_0x5eee('0x53')]['id']}})[_0x5eee('0x20')](handleEntityNotFound(_0x490be4,null))[_0x5eee('0x20')](removeEntity(_0x490be4,null))[_0x5eee('0x2b')](handleError(_0x490be4,null));};exports[_0x5eee('0x58')]=function(_0x11af82,_0x55003d){return db['MailMessage'][_0x5eee('0x58')]()[_0x5eee('0x20')](respondWithResult(_0x55003d,null))[_0x5eee('0x2b')](handleError(_0x55003d,null));};exports[_0x5eee('0x59')]=function(_0xcb824,_0x40c647){return db['MailMessage'][_0x5eee('0x59')](_0xcb824['body'])[_0x5eee('0x20')](function(_0x39fef9){if(_0x39fef9){if(_0x39fef9[_0x5eee('0x5a')]===_0x5eee('0x5b')&&!_0x39fef9[_0x5eee('0x5c')]){var _0x313ccd,_0x2a96cc,_0x547759;if(_0xcb824[_0x5eee('0x56')]['to']){_0x2a96cc=_0xcb824[_0x5eee('0x56')]['to'][_0x5eee('0x5d')](',')[0x0];}return db[_0x5eee('0x5e')]['findOne']({'where':{'id':_0x39fef9[_0x5eee('0x5f')]},'include':[{'model':db[_0x5eee('0x60')],'as':_0x5eee('0x61'),'include':[{'model':db['CmContact'],'as':_0x5eee('0x62'),'where':{'email':_0x2a96cc},'limit':0x1,'order':[[_0x5eee('0x63'),_0x5eee('0x64')]]}]},{'model':db[_0x5eee('0x65')],'as':_0x5eee('0x66'),'raw':!![]}]})[_0x5eee('0x20')](function(_0x1a24d8){_0x313ccd=_0x1a24d8;if(_0x313ccd&&_0x313ccd[_0x5eee('0x66')]){var _0x1071cf={'tls':{'rejectUnauthorized':![]}};if(_[_0x5eee('0x67')](_0x313ccd['Smtp']['service'])){_0x1071cf['host']=_0x313ccd[_0x5eee('0x66')]['host'];_0x1071cf[_0x5eee('0x68')]=_0x313ccd['Smtp'][_0x5eee('0x68')];_0x1071cf[_0x5eee('0x69')]=_0x313ccd[_0x5eee('0x66')]['secure'];if(_0x313ccd[_0x5eee('0x66')][_0x5eee('0x6a')]){_0x1071cf[_0x5eee('0x6b')]={'user':_0x313ccd['Smtp'][_0x5eee('0x6c')],'pass':_0x313ccd[_0x5eee('0x66')][_0x5eee('0x6d')]};}}else{_0x1071cf['service']=_0x313ccd[_0x5eee('0x66')][_0x5eee('0x6e')];_0x1071cf[_0x5eee('0x6b')]={'user':_0x313ccd['Smtp']['user'],'pass':_0x313ccd[_0x5eee('0x66')][_0x5eee('0x6d')]};_0x1071cf['secure']=_0x313ccd['Smtp']['secure'];}if(_0xcb824[_0x5eee('0x56')][_0x5eee('0x6f')]&&_0xcb824['body']['attachments']['length']){for(var _0x567c9a=0x0;_0x567c9a<_0xcb824[_0x5eee('0x56')][_0x5eee('0x6f')][_0x5eee('0x47')];_0x567c9a+=0x1){_0xcb824[_0x5eee('0x56')][_0x5eee('0x6f')][_0x567c9a]={'filename':_0xcb824[_0x5eee('0x56')][_0x5eee('0x6f')][_0x567c9a]['name'],'path':path[_0x5eee('0x70')](config[_0x5eee('0x71')],_0x5eee('0x72'),_0xcb824[_0x5eee('0x56')][_0x5eee('0x6f')][_0x567c9a][_0x5eee('0x73')])};}}_0x547759={'account':_0x1071cf,'message':_0xcb824[_0x5eee('0x56')]};return;}})[_0x5eee('0x20')](function(){if(_0x313ccd['List']){if(_0x313ccd[_0x5eee('0x61')]['Contacts']['length']){return _0x313ccd[_0x5eee('0x61')]['Contacts'][0x0];}else{return db[_0x5eee('0x74')][_0x5eee('0x59')](_[_0x5eee('0x14')](_0xcb824[_0x5eee('0x56')],{'firstName':_0xcb824[_0x5eee('0x56')]['to'],'email':_0xcb824['body']['to'],'phone':_0xcb824[_0x5eee('0x56')]['to'],'ListId':_0x313ccd['ListId']}));}}else{throw new Error('List\x20not\x20found');}})[_0x5eee('0x20')](function(){if(_0x547759){return respondWithRpcPromise('SendMail',_0x5eee('0x75'),_0x547759,client9003)[_0x5eee('0x20')](function(_0x5a9031){return _0x39fef9[_0x5eee('0x55')]({'read':!![],'messageId':_0x5a9031[_0x5eee('0x76')],'sentAt':moment()[_0x5eee('0x77')](_0x5eee('0x78'))});})[_0x5eee('0x2b')](function(_0x207db9){logger[_0x5eee('0x27')]('%s',JSON[_0x5eee('0x26')](_0x207db9));return _0x39fef9;});}return _0x39fef9;});}return _0x39fef9;}})[_0x5eee('0x20')](respondWithResult(_0x40c647,0xc9))[_0x5eee('0x2b')](handleError(_0x40c647,null));};var interaction_log=require(_0x5eee('0x79'))(_0x5eee('0x7a'));exports[_0x5eee('0x7b')]=function(_0x46cce0,_0x38d76a,_0x5411c2){var _0x1e000b={'channel':_0x5eee('0x7c')};if(_0x46cce0['body']['id']){delete _0x46cce0['body']['id'];}_0x46cce0['body'][_0x5eee('0x7d')]=!![];_0x46cce0['body'][_0x5eee('0x7e')]=moment()[_0x5eee('0x77')]('YYYY-MM-DD\x20HH:mm:ss');_0x46cce0['body'][_0x5eee('0x7f')]=_0x46cce0['body'][_0x5eee('0x7f')]||_0x46cce0[_0x5eee('0x6c')]['id'];return db[_0x5eee('0x3c')][_0x5eee('0x57')]({'where':{'id':_0x46cce0['params']['id'],'UserId':null},'include':[{'model':db[_0x5eee('0x74')],'as':_0x5eee('0x80')}]})[_0x5eee('0x20')](handleEntityNotFound(_0x38d76a,null))[_0x5eee('0x20')](saveUpdates(_0x46cce0[_0x5eee('0x56')],null))[_0x5eee('0x20')](function(_0x2341db){if(_0x2341db){_0x1e000b[_0x5eee('0x29')]=_0x2341db[_0x5eee('0x81')]({'plain':!![]});return db[_0x5eee('0x82')][_0x5eee('0x57')]({'where':{'id':_0x2341db['MailInteractionId']}});}return null;})[_0x5eee('0x20')](handleEntityNotFound(_0x38d76a,null))[_0x5eee('0x20')](function(_0x51d5ac){if(_0x51d5ac){return _0x51d5ac[_0x5eee('0x55')]({'UserId':_0x46cce0[_0x5eee('0x56')][_0x5eee('0x7f')],'read1stAt':_[_0x5eee('0x67')](_0x51d5ac[_0x5eee('0x83')])?moment()[_0x5eee('0x77')](_0x5eee('0x78')):undefined});}return null;})['then'](function(_0x1fa339){if(_0x1fa339){_0x1e000b['interaction']=_0x1fa339[_0x5eee('0x81')]({'plain':!![]});interaction_log[_0x5eee('0x21')](_0x5eee('0x84'),_0x46cce0[_0x5eee('0x6c')]['id'],_0x46cce0['user'][_0x5eee('0x39')],_0x46cce0['user'][_0x5eee('0x85')],_0x1e000b[_0x5eee('0x86')]['id'],_0x46cce0[_0x5eee('0x56')]?JSON[_0x5eee('0x26')](_0x46cce0[_0x5eee('0x56')]):_0x5eee('0x87'));return respondWithRpcPromise(_0x5eee('0x88'),'acceptMessage',_0x1e000b);}return null;})[_0x5eee('0x20')](function(_0x197e31){if(_0x197e31){if(_0x46cce0['body'][_0x5eee('0x89')]){_0x1e000b[_0x5eee('0x29')]['interface']=util['format'](_0x5eee('0x8a'),_0x46cce0[_0x5eee('0x6c')][_0x5eee('0x39')]);_0x1e000b[_0x5eee('0x29')][_0x5eee('0x8b')]=_0x1e000b[_0x5eee('0x8b')];_0x1e000b['message'][_0x5eee('0x8c')]=_0x5eee('0x7b');return respondWithRpcPromise(_0x5eee('0x8d'),_0x5eee('0x8d'),{'event':_0x5eee('0x8e'),'message':_0x1e000b['message']},client9002)[_0x5eee('0x20')](function(){return _0x1e000b;});}return _0x1e000b;}return null;})[_0x5eee('0x20')](respondWithResult(_0x38d76a,null))[_0x5eee('0x2b')](handleError(_0x38d76a,null));};var interaction_log=require('../../config/logger')('mail-interactions');exports[_0x5eee('0x34')]=function(_0x1be78b,_0x45fe69,_0x578d95){var _0x306290={'agent':{},'channel':_0x5eee('0x7c')};if(_0x1be78b[_0x5eee('0x56')]['id']){delete _0x1be78b[_0x5eee('0x56')]['id'];}_0x1be78b[_0x5eee('0x56')]['UserId']=_0x1be78b[_0x5eee('0x56')][_0x5eee('0x7f')]||_0x1be78b[_0x5eee('0x6c')]['id'];_0x306290[_0x5eee('0x8f')]['id']=_0x1be78b['body'][_0x5eee('0x7f')];return db[_0x5eee('0x3c')][_0x5eee('0x57')]({'where':{'id':_0x1be78b[_0x5eee('0x53')]['id'],'UserId':null}})[_0x5eee('0x20')](handleEntityNotFound(_0x45fe69,null))[_0x5eee('0x20')](function(_0x24b090){if(_0x24b090){_0x306290[_0x5eee('0x29')]=_0x24b090['get']({'plain':!![]});return db[_0x5eee('0x82')][_0x5eee('0x57')]({'where':{'id':_0x24b090[_0x5eee('0x90')]}});}return null;})['then'](handleEntityNotFound(_0x45fe69,null))[_0x5eee('0x20')](function(_0x48934a){if(_0x48934a){_0x306290[_0x5eee('0x86')]=_0x48934a['get']({'plain':!![]});interaction_log[_0x5eee('0x21')](_0x5eee('0x91'),_0x1be78b[_0x5eee('0x6c')]['id'],_0x1be78b[_0x5eee('0x6c')][_0x5eee('0x39')],_0x1be78b['user'][_0x5eee('0x85')],_0x306290[_0x5eee('0x86')]['id'],_0x1be78b['body']?JSON['stringify'](_0x1be78b[_0x5eee('0x56')]):_0x5eee('0x87'));return respondWithRpcPromise(_0x5eee('0x92'),_0x5eee('0x93'),_0x306290);}return null;})[_0x5eee('0x20')](function(_0x1c1260){if(_0x1c1260){_0x1c1260[_0x5eee('0x29')][_0x5eee('0x94')]=util[_0x5eee('0x77')](_0x5eee('0x8a'),_0x1be78b[_0x5eee('0x6c')]['name']);_0x1c1260['message'][_0x5eee('0x8b')]=_0x306290[_0x5eee('0x8b')];_0x1c1260[_0x5eee('0x29')][_0x5eee('0x8c')]=_0x5eee('0x34');respondWithRpcPromise(_0x5eee('0x8d'),_0x5eee('0x8d'),{'event':'rejectmessage','message':_0x1c1260[_0x5eee('0x29')]},client9002);return _0x306290;}return null;})[_0x5eee('0x20')](respondWithResult(_0x45fe69,null))[_0x5eee('0x2b')](handleError(_0x45fe69,null));};exports['download']=function(_0x5b5b12,_0x48feeb){var _0x2063d2=moment()['unix']()[_0x5eee('0x95')]();var _0xca6341=path[_0x5eee('0x70')](config[_0x5eee('0x71')],_0x5eee('0x96'),_0x5eee('0x97'),_0x5eee('0x98'));var _0x34248a=path[_0x5eee('0x70')](config[_0x5eee('0x71')],'server',_0x5eee('0x97'),_0x5eee('0x6f'));var _0x5a08ab=util[_0x5eee('0x77')](_0x5eee('0x99'),_0x2063d2);return db[_0x5eee('0x3c')][_0x5eee('0x57')]({'where':{'id':_0x5b5b12['params']['id']},'attributes':['id',_0x5eee('0x56'),_0x5eee('0x9a'),'to','cc',_0x5eee('0x9b'),_0x5eee('0x9c'),_0x5eee('0x9d')],'include':_0x5b5b12['query'][_0x5eee('0x6f')]?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})[_0x5eee('0x20')](handleEntityNotFound(_0x48feeb,null))[_0x5eee('0x20')](function(_0x47d866){if(_0x47d866){var _0x59ca23=_0x47d866;var _0x3ea4fb={'from':_0x59ca23[_0x5eee('0x9a')],'to':_0x59ca23['to'],'subject':_0x59ca23[_0x5eee('0x9c')],'html':_0x59ca23[_0x5eee('0x56')],'headers':{'Date':moment(_0x59ca23[_0x5eee('0x9d')])[_0x5eee('0x77')](_0x5eee('0x9e'))},'attachments':[]};if(_0x47d866['cc']){_0x3ea4fb[_0x5eee('0x9f')]['Cc']=_0x47d866['cc'];}if(_0x47d866['bcc']){_0x3ea4fb['headers'][_0x5eee('0xa0')]=_0x47d866[_0x5eee('0x9b')];}return new BPromise(function(_0x3a6d57,_0x12add4){if(_0x47d866['Attachments']){for(var _0x500c43=0x0;_0x500c43<_0x47d866[_0x5eee('0xa1')][_0x5eee('0x47')];_0x500c43++){var _0x54f94c=_0x47d866[_0x5eee('0xa1')][_0x500c43];var _0x30e2ee=path[_0x5eee('0x70')](_0x34248a,_0x54f94c['basename']);if(fs[_0x5eee('0xa2')](_0x30e2ee)){_0x3ea4fb[_0x5eee('0x6f')]['push']({'name':_0x54f94c['name'],'contentType':_0x54f94c[_0x5eee('0xa3')],'data':fs[_0x5eee('0xa4')](_0x30e2ee)});}}}emlformat['build'](_0x3ea4fb,function(_0x1cfdbd,_0x51fb1e){if(_0x1cfdbd)return _0x12add4(_0x1cfdbd);fs[_0x5eee('0xa5')](path[_0x5eee('0x70')](_0xca6341,_0x5a08ab),_0x51fb1e);return _0x3a6d57(_0x51fb1e);});});}})[_0x5eee('0x20')](function(_0x183113){if(_0x183113){return _0x48feeb[_0x5eee('0xa6')](path[_0x5eee('0x70')](_0xca6341,_0x5a08ab),_0x5a08ab,function(_0x44690c){if(_0x44690c){console[_0x5eee('0xa7')](_0x5eee('0xa8'),_0x44690c);}else{fs[_0x5eee('0xa9')](path[_0x5eee('0x70')](_0xca6341,_0x5a08ab));}});}})[_0x5eee('0x2b')](handleError(_0x48feeb,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 3dfede9..edbae2e 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 _0x8083=['exports','events','../../mysqldb','MailMessage','setMaxListeners','update','remove','emit'];(function(_0x4b33c7,_0x4c7837){var _0x4adaff=function(_0x7eb867){while(--_0x7eb867){_0x4b33c7['push'](_0x4b33c7['shift']());}};_0x4adaff(++_0x4c7837);}(_0x8083,0xf1));var _0x3808=function(_0x352b44,_0x4a91a1){_0x352b44=_0x352b44-0x0;var _0x3e8baa=_0x8083[_0x352b44];return _0x3e8baa;};'use strict';var EventEmitter=require(_0x3808('0x0'));var MailMessage=require(_0x3808('0x1'))['db'][_0x3808('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x3808('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3808('0x4'),'afterDestroy':_0x3808('0x5')};function emitEvent(_0x28a2f8){return function(_0x3993ca,_0x486036,_0x43da09){MailMessageEvents[_0x3808('0x6')](_0x28a2f8+':'+_0x3993ca['id'],_0x3993ca);MailMessageEvents[_0x3808('0x6')](_0x28a2f8,_0x3993ca);_0x43da09(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x3808('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x43f2=['hook','exports','events','../../mysqldb','MailMessage','save','update','remove','hasOwnProperty'];(function(_0x2819cd,_0x1f7703){var _0x47874c=function(_0x523698){while(--_0x523698){_0x2819cd['push'](_0x2819cd['shift']());}};_0x47874c(++_0x1f7703);}(_0x43f2,0x1df));var _0x243f=function(_0x339199,_0x58da9d){_0x339199=_0x339199-0x0;var _0xf75c5d=_0x43f2[_0x339199];return _0xf75c5d;};'use strict';var EventEmitter=require(_0x243f('0x0'));var MailMessage=require(_0x243f('0x1'))['db'][_0x243f('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x243f('0x3'),'afterUpdate':_0x243f('0x4'),'afterDestroy':_0x243f('0x5')};function emitEvent(_0x84f00d){return function(_0x1a4ef4,_0x5c5ddf,_0x3db487){MailMessageEvents['emit'](_0x84f00d+':'+_0x1a4ef4['id'],_0x1a4ef4);MailMessageEvents['emit'](_0x84f00d,_0x1a4ef4);_0x3db487(null);};}for(var e in events){if(events[_0x243f('0x6')](e)){var event=events[e];MailMessage[_0x243f('0x7')](e,emitEvent(event));}}module[_0x243f('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index fda4f8b..e28e821 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 _0x1f43=['rimraf','../../config/environment','exports','define','MailMessage','mail_messages','messageId','subject','FULLTEXT','body','fromString','models','direction','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','update','createdAt','toLowerCase','catch','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text'];(function(_0x15026d,_0x510fd7){var _0x822dae=function(_0x1fd685){while(--_0x1fd685){_0x15026d['push'](_0x15026d['shift']());}};_0x822dae(++_0x510fd7);}(_0x1f43,0xdf));var _0x31f4=function(_0x51b3cf,_0x1e1716){_0x51b3cf=_0x51b3cf-0x0;var _0x5cfaa8=_0x1f43[_0x51b3cf];return _0x5cfaa8;};'use strict';var _=require(_0x31f4('0x0'));var util=require(_0x31f4('0x1'));var logger=require(_0x31f4('0x2'))(_0x31f4('0x3'));var moment=require(_0x31f4('0x4'));var BPromise=require(_0x31f4('0x5'));var rp=require(_0x31f4('0x6'));var htmlToText=require(_0x31f4('0x7'));var fs=require('fs');var path=require('path');var rimraf=require(_0x31f4('0x8'));var config=require(_0x31f4('0x9'));var attributes=require('./mailMessage.attributes');module[_0x31f4('0xa')]=function(_0x277b4c,_0xeae7a2){return _0x277b4c[_0x31f4('0xb')](_0x31f4('0xc'),attributes,{'tableName':_0x31f4('0xd'),'paranoid':![],'indexes':[{'name':_0x31f4('0xe'),'fields':[_0x31f4('0xe')]},{'name':'fti_mail_messages','fields':['plainBody',_0x31f4('0xf')],'type':_0x31f4('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x47ac6a,_0x4993bc,_0x545bf1){if(_0x47ac6a[_0x31f4('0x11')]){_0x47ac6a['plainBody']=htmlToText[_0x31f4('0x12')](_0x47ac6a[_0x31f4('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x545bf1(null,_0x4993bc);},'afterCreate':function(_0x2c977d,_0x2a1236,_0x1d0d41){var _0x4a4cb8=_0x277b4c[_0x31f4('0x13')];var _0x24d1c4=_0x2c977d['get']({'plain':!![]});if(_0x24d1c4[_0x31f4('0x14')]['toLowerCase']()==='in'||_0x24d1c4[_0x31f4('0x14')]['toLowerCase']()===_0x31f4('0x15')&&!_0x24d1c4[_0x31f4('0x16')]&&!_[_0x31f4('0x17')](_0x24d1c4[_0x31f4('0x18')])){_0x4a4cb8[_0x31f4('0x19')][_0x31f4('0x1a')]({'where':{'id':_0x24d1c4[_0x31f4('0x1b')]}})['then'](function(_0x4fefa3){if(_0x4fefa3){_0x4fefa3[_0x31f4('0x1c')]({'lastMsgAt':_0x24d1c4[_0x31f4('0x1d')],'lastMsgDirection':_0x24d1c4[_0x31f4('0x14')][_0x31f4('0x1e')](),'lastMsgBody':_0x24d1c4[_0x31f4('0x11')]});}})[_0x31f4('0x1f')](function(_0x1bedbb){console['error'](_0x1bedbb);});}_0x1d0d41();}},'charset':_0x31f4('0x20'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe1bc=['fti_mail_messages','subject','FULLTEXT','body','plainBody','fromString','models','get','toLowerCase','out','secret','isNil','UserId','MailInteraction','then','update','direction','catch','error','utf8mb4_unicode_ci','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId'];(function(_0x174f46,_0x1cb865){var _0x5a88fe=function(_0x5dfa77){while(--_0x5dfa77){_0x174f46['push'](_0x174f46['shift']());}};_0x5a88fe(++_0x1cb865);}(_0xe1bc,0x71));var _0xce1b=function(_0x45d14e,_0x40e726){_0x45d14e=_0x45d14e-0x0;var _0x288a1e=_0xe1bc[_0x45d14e];return _0x288a1e;};'use strict';var _=require('lodash');var util=require(_0xce1b('0x0'));var logger=require(_0xce1b('0x1'))('api');var moment=require(_0xce1b('0x2'));var BPromise=require('bluebird');var rp=require(_0xce1b('0x3'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require(_0xce1b('0x4'));var config=require(_0xce1b('0x5'));var attributes=require(_0xce1b('0x6'));module[_0xce1b('0x7')]=function(_0x3fee68,_0x5b6deb){return _0x3fee68['define'](_0xce1b('0x8'),attributes,{'tableName':_0xce1b('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xce1b('0xa')]},{'name':_0xce1b('0xb'),'fields':['plainBody',_0xce1b('0xc')],'type':_0xce1b('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x346c65,_0x385afc,_0x29ee89){if(_0x346c65[_0xce1b('0xe')]){_0x346c65[_0xce1b('0xf')]=htmlToText[_0xce1b('0x10')](_0x346c65['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x29ee89(null,_0x385afc);},'afterCreate':function(_0xdfd6e4,_0x425694,_0x5a49b0){var _0x5b4c8d=_0x3fee68[_0xce1b('0x11')];var _0x483daa=_0xdfd6e4[_0xce1b('0x12')]({'plain':!![]});if(_0x483daa['direction'][_0xce1b('0x13')]()==='in'||_0x483daa['direction'][_0xce1b('0x13')]()===_0xce1b('0x14')&&!_0x483daa[_0xce1b('0x15')]&&!_[_0xce1b('0x16')](_0x483daa[_0xce1b('0x17')])){_0x5b4c8d[_0xce1b('0x18')]['findOne']({'where':{'id':_0x483daa['MailInteractionId']}})[_0xce1b('0x19')](function(_0x3d5951){if(_0x3d5951){_0x3d5951[_0xce1b('0x1a')]({'lastMsgAt':_0x483daa['createdAt'],'lastMsgDirection':_0x483daa[_0xce1b('0x1b')][_0xce1b('0x13')](),'lastMsgBody':_0x483daa[_0xce1b('0xe')]});}})[_0xce1b('0x1c')](function(_0x52e71a){console[_0xce1b('0x1d')](_0x52e71a);});}_0x5a49b0();}},'charset':'utf8mb4','collate':_0xce1b('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index f5a530d..f722e12 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 _0xdc03=['CreateMailMessage','MailMessage','create','body','options','raw','then','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','./mailMessage.socket','register','info','MailMessage,\x20%s,\x20%s','MailMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0xaab22e,_0x3bab3c){var _0x1cd2fa=function(_0x5620f2){while(--_0x5620f2){_0xaab22e['push'](_0xaab22e['shift']());}};_0x1cd2fa(++_0x3bab3c);}(_0xdc03,0x65));var _0x3dc0=function(_0x1210f8,_0x2e7ab6){_0x1210f8=_0x1210f8-0x0;var _0x44847c=_0xdc03[_0x1210f8];return _0x44847c;};'use strict';var _=require(_0x3dc0('0x0'));var util=require('util');var moment=require(_0x3dc0('0x1'));var BPromise=require(_0x3dc0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3dc0('0x3'));var db=require(_0x3dc0('0x4'))['db'];var utils=require(_0x3dc0('0x5'));var logger=require(_0x3dc0('0x6'))(_0x3dc0('0x7'));var config=require(_0x3dc0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3dc0('0x9')][_0x3dc0('0xa')]({'port':0x232a});config[_0x3dc0('0xb')]=_['defaults'](config[_0x3dc0('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3dc0('0xc'))[_0x3dc0('0xd')](socket);function respondWithRpcPromise(_0xb5ff98,_0xa2608d,_0x2967f6){return new BPromise(function(_0x1fb434,_0x3e0b99){return client['request'](_0xb5ff98,_0x2967f6)['then'](function(_0x14b474){logger[_0x3dc0('0xe')](_0x3dc0('0xf'),_0xa2608d,'request\x20sent');logger['debug'](_0x3dc0('0x10'),_0xa2608d,'request\x20sent',JSON[_0x3dc0('0x11')](_0x14b474));if(_0x14b474['error']){if(_0x14b474['error'][_0x3dc0('0x12')]===0x1f4){logger[_0x3dc0('0x13')](_0x3dc0('0xf'),_0xa2608d,_0x14b474[_0x3dc0('0x13')][_0x3dc0('0x14')]);return _0x3e0b99(_0x14b474[_0x3dc0('0x13')][_0x3dc0('0x14')]);}logger[_0x3dc0('0x13')]('MailMessage,\x20%s,\x20%s',_0xa2608d,_0x14b474[_0x3dc0('0x13')][_0x3dc0('0x14')]);return _0x1fb434(_0x14b474['error'][_0x3dc0('0x14')]);}else{logger[_0x3dc0('0xe')](_0x3dc0('0xf'),_0xa2608d,'request\x20sent');_0x1fb434(_0x14b474[_0x3dc0('0x15')][_0x3dc0('0x14')]);}})[_0x3dc0('0x16')](function(_0x5a67af){logger[_0x3dc0('0x13')](_0x3dc0('0xf'),_0xa2608d,_0x5a67af);_0x3e0b99(_0x5a67af);});});}exports[_0x3dc0('0x17')]=function(_0xac9dc8){var _0x24bf8c=this;return new Promise(function(_0x3efe80,_0x379fff){return db[_0x3dc0('0x18')][_0x3dc0('0x19')](_0xac9dc8[_0x3dc0('0x1a')],{'raw':_0xac9dc8['options']?_0xac9dc8[_0x3dc0('0x1b')][_0x3dc0('0x1c')]===undefined?!![]:![]:!![]})[_0x3dc0('0x1d')](function(_0x5ee6b3){logger['info'](_0x3dc0('0x17'),_0xac9dc8);logger[_0x3dc0('0x1e')](_0x3dc0('0x17'),_0xac9dc8,JSON[_0x3dc0('0x11')](_0x5ee6b3));_0x3efe80(_0x5ee6b3);})['catch'](function(_0x252cda){logger['error']('CreateMailMessage',_0x252cda[_0x3dc0('0x14')],_0xac9dc8);_0x379fff(_0x24bf8c[_0x3dc0('0x13')](0x1f4,_0x252cda[_0x3dc0('0x14')]));});});}; \ No newline at end of file +var _0x7dee=['then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateMailMessage','MailMessage','body','options','info','stringify','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request'];(function(_0x414743,_0x2e6d87){var _0x39d57d=function(_0xb932fa){while(--_0xb932fa){_0x414743['push'](_0x414743['shift']());}};_0x39d57d(++_0x2e6d87);}(_0x7dee,0xb0));var _0xe7de=function(_0x9051f9,_0x2d4ef7){_0x9051f9=_0x9051f9-0x0;var _0x111e71=_0x7dee[_0x9051f9];return _0x111e71;};'use strict';var _=require(_0xe7de('0x0'));var util=require('util');var moment=require(_0xe7de('0x1'));var BPromise=require('bluebird');var rs=require(_0xe7de('0x2'));var fs=require('fs');var Redis=require(_0xe7de('0x3'));var db=require(_0xe7de('0x4'))['db'];var utils=require(_0xe7de('0x5'));var logger=require('../../config/logger')(_0xe7de('0x6'));var config=require('../../config/environment');var jayson=require(_0xe7de('0x7'));var client=jayson[_0xe7de('0x8')][_0xe7de('0x9')]({'port':0x232a});config[_0xe7de('0xa')]=_[_0xe7de('0xb')](config[_0xe7de('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe7de('0xc'))(new Redis(config[_0xe7de('0xa')]));require(_0xe7de('0xd'))[_0xe7de('0xe')](socket);function respondWithRpcPromise(_0x54b443,_0x130ac8,_0x42ddbc){return new BPromise(function(_0x2a2042,_0x35718e){return client[_0xe7de('0xf')](_0x54b443,_0x42ddbc)[_0xe7de('0x10')](function(_0x358e90){logger['info'](_0xe7de('0x11'),_0x130ac8,_0xe7de('0x12'));logger[_0xe7de('0x13')](_0xe7de('0x14'),_0x130ac8,_0xe7de('0x12'),JSON['stringify'](_0x358e90));if(_0x358e90[_0xe7de('0x15')]){if(_0x358e90[_0xe7de('0x15')][_0xe7de('0x16')]===0x1f4){logger[_0xe7de('0x15')](_0xe7de('0x11'),_0x130ac8,_0x358e90[_0xe7de('0x15')]['message']);return _0x35718e(_0x358e90['error'][_0xe7de('0x17')]);}logger[_0xe7de('0x15')](_0xe7de('0x11'),_0x130ac8,_0x358e90[_0xe7de('0x15')][_0xe7de('0x17')]);return _0x2a2042(_0x358e90['error'][_0xe7de('0x17')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x130ac8,'request\x20sent');_0x2a2042(_0x358e90[_0xe7de('0x18')][_0xe7de('0x17')]);}})['catch'](function(_0x2659e5){logger[_0xe7de('0x15')](_0xe7de('0x11'),_0x130ac8,_0x2659e5);_0x35718e(_0x2659e5);});});}exports[_0xe7de('0x19')]=function(_0x952594){var _0x93c23c=this;return new Promise(function(_0x2595b5,_0xfead44){return db[_0xe7de('0x1a')]['create'](_0x952594[_0xe7de('0x1b')],{'raw':_0x952594[_0xe7de('0x1c')]?_0x952594[_0xe7de('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xe7de('0x10')](function(_0x597346){logger[_0xe7de('0x1d')](_0xe7de('0x19'),_0x952594);logger[_0xe7de('0x13')]('CreateMailMessage',_0x952594,JSON[_0xe7de('0x1e')](_0x597346));_0x2595b5(_0x597346);})[_0xe7de('0x1f')](function(_0x3e845c){logger[_0xe7de('0x15')](_0xe7de('0x19'),_0x3e845c[_0xe7de('0x17')],_0x952594);_0xfead44(_0x93c23c[_0xe7de('0x15')](0x1f4,_0x3e845c[_0xe7de('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 7d6a3c9..e447bdd 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 _0xa4b7=['update','removeListener','register','length','mailMessage:','./mailMessage.events'];(function(_0xcc4d3a,_0x104f66){var _0x20bae1=function(_0x2403f8){while(--_0x2403f8){_0xcc4d3a['push'](_0xcc4d3a['shift']());}};_0x20bae1(++_0x104f66);}(_0xa4b7,0xbf));var _0x7a4b=function(_0x2ad63e,_0x3046e6){_0x2ad63e=_0x2ad63e-0x0;var _0x2aa905=_0xa4b7[_0x2ad63e];return _0x2aa905;};'use strict';var MailMessageEvents=require(_0x7a4b('0x0'));var events=['save','remove',_0x7a4b('0x1')];function createListener(_0x398fd7,_0x411981){return function(_0x315d52){_0x411981['emit'](_0x398fd7,_0x315d52);};}function removeListener(_0x1b8c07,_0x5a222e){return function(){MailMessageEvents[_0x7a4b('0x2')](_0x1b8c07,_0x5a222e);};}exports[_0x7a4b('0x3')]=function(_0x2ab276){for(var _0x1622c3=0x0,_0x1b9e8e=events[_0x7a4b('0x4')];_0x1622c3<_0x1b9e8e;_0x1622c3++){var _0x230643=events[_0x1622c3];var _0x516fa4=createListener(_0x7a4b('0x5')+_0x230643,_0x2ab276);MailMessageEvents['on'](_0x230643,_0x516fa4);}}; \ No newline at end of file +var _0xa8fb=['update','emit','removeListener','register','length','mailMessage:','./mailMessage.events'];(function(_0x2552e2,_0x4fb60a){var _0x27922b=function(_0x3ff1cb){while(--_0x3ff1cb){_0x2552e2['push'](_0x2552e2['shift']());}};_0x27922b(++_0x4fb60a);}(_0xa8fb,0x172));var _0xba8f=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0xa8fb[_0x38537f];return _0x141e23;};'use strict';var MailMessageEvents=require(_0xba8f('0x0'));var events=['save','remove',_0xba8f('0x1')];function createListener(_0x271b77,_0x1b6b88){return function(_0xdfc5b9){_0x1b6b88[_0xba8f('0x2')](_0x271b77,_0xdfc5b9);};}function removeListener(_0x21be59,_0x19567f){return function(){MailMessageEvents[_0xba8f('0x3')](_0x21be59,_0x19567f);};}exports[_0xba8f('0x4')]=function(_0x2c61c3){for(var _0x23082b=0x0,_0x247a71=events[_0xba8f('0x5')];_0x23082b<_0x247a71;_0x23082b++){var _0x57bd7f=events[_0x23082b];var _0x43bac5=createListener(_0xba8f('0x6')+_0x57bd7f,_0x2c61c3);MailMessageEvents['on'](_0x57bd7f,_0x43bac5);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 13fa894..d43b813 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 _0x6c2a=['./mailQueue.controller','get','isAuthenticated','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xd736f1,_0x219400){var _0x14c1e2=function(_0x1e997b){while(--_0x1e997b){_0xd736f1['push'](_0xd736f1['shift']());}};_0x14c1e2(++_0x219400);}(_0x6c2a,0x12e));var _0xa6c2=function(_0x37efa5,_0x430478){_0x37efa5=_0x37efa5-0x0;var _0x8267c6=_0x6c2a[_0x37efa5];return _0x8267c6;};'use strict';var multer=require(_0xa6c2('0x0'));var util=require(_0xa6c2('0x1'));var path=require(_0xa6c2('0x2'));var timeout=require(_0xa6c2('0x3'));var express=require('express');var router=express[_0xa6c2('0x4')]();var auth=require(_0xa6c2('0x5'));var interaction=require(_0xa6c2('0x6'));var config=require(_0xa6c2('0x7'));var controller=require(_0xa6c2('0x8'));router[_0xa6c2('0x9')]('/',auth[_0xa6c2('0xa')](),controller['index']);router[_0xa6c2('0x9')](_0xa6c2('0xb'),auth[_0xa6c2('0xa')](),controller['describe']);router[_0xa6c2('0x9')](_0xa6c2('0xc'),auth[_0xa6c2('0xa')](),controller[_0xa6c2('0xd')]);router[_0xa6c2('0x9')](_0xa6c2('0xe'),auth[_0xa6c2('0xa')](),controller[_0xa6c2('0xf')]);router[_0xa6c2('0x9')](_0xa6c2('0x10'),auth['isAuthenticated'](),controller[_0xa6c2('0x11')]);router[_0xa6c2('0x9')](_0xa6c2('0x12'),auth[_0xa6c2('0xa')](),controller[_0xa6c2('0x13')]);router[_0xa6c2('0x14')]('/',auth['isAuthenticated'](),controller[_0xa6c2('0x15')]);router[_0xa6c2('0x14')](_0xa6c2('0x10'),auth[_0xa6c2('0xa')](),controller[_0xa6c2('0x16')]);router[_0xa6c2('0x14')](_0xa6c2('0x12'),auth[_0xa6c2('0xa')](),controller[_0xa6c2('0x17')]);router[_0xa6c2('0x18')](_0xa6c2('0xc'),auth['isAuthenticated'](),controller[_0xa6c2('0x19')]);router[_0xa6c2('0x1a')](_0xa6c2('0xc'),auth['isAuthenticated'](),controller[_0xa6c2('0x1b')]);router[_0xa6c2('0x1a')](_0xa6c2('0x10'),auth[_0xa6c2('0xa')](),controller[_0xa6c2('0x1c')]);router[_0xa6c2('0x1a')](_0xa6c2('0x12'),auth[_0xa6c2('0xa')](),controller[_0xa6c2('0x1d')]);module[_0xa6c2('0x1e')]=router; \ No newline at end of file +var _0x6a0b=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','addAgents','update','/:id/users','removeAgents','exports','multer','path'];(function(_0x1fd4d7,_0x2feafd){var _0x7efe8a=function(_0xc54f55){while(--_0xc54f55){_0x1fd4d7['push'](_0x1fd4d7['shift']());}};_0x7efe8a(++_0x2feafd);}(_0x6a0b,0xc6));var _0xb6a0=function(_0x33873b,_0x5a410d){_0x33873b=_0x33873b-0x0;var _0x41b254=_0x6a0b[_0x33873b];return _0x41b254;};'use strict';var multer=require(_0xb6a0('0x0'));var util=require('util');var path=require(_0xb6a0('0x1'));var timeout=require('connect-timeout');var express=require(_0xb6a0('0x2'));var router=express['Router']();var auth=require(_0xb6a0('0x3'));var interaction=require(_0xb6a0('0x4'));var config=require(_0xb6a0('0x5'));var controller=require(_0xb6a0('0x6'));router[_0xb6a0('0x7')]('/',auth[_0xb6a0('0x8')](),controller[_0xb6a0('0x9')]);router[_0xb6a0('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xb6a0('0xa')]);router[_0xb6a0('0x7')](_0xb6a0('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0xb6a0('0xc'),auth['isAuthenticated'](),controller[_0xb6a0('0xd')]);router[_0xb6a0('0x7')](_0xb6a0('0xe'),auth['isAuthenticated'](),controller[_0xb6a0('0xf')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xb6a0('0x10')]);router[_0xb6a0('0x11')]('/',auth[_0xb6a0('0x8')](),controller[_0xb6a0('0x12')]);router['post']('/:id/teams',auth[_0xb6a0('0x8')](),controller[_0xb6a0('0x13')]);router[_0xb6a0('0x11')]('/:id/users',auth[_0xb6a0('0x8')](),controller[_0xb6a0('0x14')]);router['put'](_0xb6a0('0xb'),auth[_0xb6a0('0x8')](),controller[_0xb6a0('0x15')]);router['delete'](_0xb6a0('0xb'),auth[_0xb6a0('0x8')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xb6a0('0x8')](),controller['removeTeams']);router['delete'](_0xb6a0('0x16'),auth[_0xb6a0('0x8')](),controller[_0xb6a0('0x17')]);module[_0xb6a0('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 44a5d00..4f1aeb5 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 _0x9d01=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x3d7046,_0x4ebd3b){var _0x47e2a9=function(_0x2fe2dc){while(--_0x2fe2dc){_0x3d7046['push'](_0x3d7046['shift']());}};_0x47e2a9(++_0x4ebd3b);}(_0x9d01,0x1ec));var _0x19d0=function(_0x2c6e87,_0x120aa2){_0x2c6e87=_0x2c6e87-0x0;var _0x12c488=_0x9d01[_0x2c6e87];return _0x12c488;};'use strict';var Sequelize=require(_0x19d0('0x0'));module[_0x19d0('0x1')]={'name':{'type':Sequelize[_0x19d0('0x2')],'unique':_0x19d0('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x19d0('0x2')]},'timeout':{'type':Sequelize[_0x19d0('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x19d0('0x5')](_0x19d0('0x6'),'beepall',_0x19d0('0x7'))}}; \ No newline at end of file +var _0x8303=['beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x4dc596,_0x273f6e){var _0x155cc5=function(_0x147433){while(--_0x147433){_0x4dc596['push'](_0x4dc596['shift']());}};_0x155cc5(++_0x273f6e);}(_0x8303,0xaa));var _0x3830=function(_0x7c5d6a,_0x3c9f62){_0x7c5d6a=_0x7c5d6a-0x0;var _0x3e6de7=_0x8303[_0x7c5d6a];return _0x3e6de7;};'use strict';var Sequelize=require(_0x3830('0x0'));module['exports']={'name':{'type':Sequelize[_0x3830('0x1')],'unique':_0x3830('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3830('0x1')]},'timeout':{'type':Sequelize[_0x3830('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3830('0x4')](_0x3830('0x5'),_0x3830('0x6'),_0x3830('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 6a60ae3..c48c327 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 _0xf663=['SIP','createdAt','updatedAt','getTeams','findOne','addTeams','ids','Agents','voicePause','flatMap','each','forEach','emit','userMailQueue:save','removeTeams','Team','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','TeamId','all','union','compact','value','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userMailQueue:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','register','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','MailQueues','UserProfileResource','error','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','format','%s/%s'];(function(_0x479583,_0x586dbb){var _0xa61e14=function(_0x5d897a){while(--_0x5d897a){_0x479583['push'](_0x479583['shift']());}};_0xa61e14(++_0x586dbb);}(_0xf663,0x143));var _0x3f66=function(_0x5225c2,_0x3999c2){_0x5225c2=_0x5225c2-0x0;var _0x5a98f2=_0xf663[_0x5225c2];return _0x5a98f2;};'use strict';var pdf=require(_0x3f66('0x0'));var emlformat=require(_0x3f66('0x1'));var rimraf=require(_0x3f66('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f66('0x3'));var rp=require(_0x3f66('0x4'));var moment=require(_0x3f66('0x5'));var BPromise=require(_0x3f66('0x6'));var Mustache=require(_0x3f66('0x7'));var util=require(_0x3f66('0x8'));var path=require(_0x3f66('0x9'));var sox=require('sox');var csv=require(_0x3f66('0xa'));var ejs=require(_0x3f66('0xb'));var fs=require('fs');var _=require(_0x3f66('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3f66('0xd'));var deskjs=require(_0x3f66('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3f66('0xf'));var Papa=require('papaparse');var Redis=require(_0x3f66('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3f66('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x3f66('0x12'));var db=require(_0x3f66('0x13'))['db'];config[_0x3f66('0x14')]=_[_0x3f66('0x15')](config[_0x3f66('0x14')],{'host':_0x3f66('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3f66('0x14')]));require(_0x3f66('0x17'))[_0x3f66('0x18')](socket);function respondWithStatusCode(_0x3bb26d,_0x2c8c46){_0x2c8c46=_0x2c8c46||0xcc;return function(_0x2f0a69){if(_0x2f0a69){return _0x3bb26d['sendStatus'](_0x2c8c46);}return _0x3bb26d['status'](_0x2c8c46)[_0x3f66('0x19')]();};}function respondWithResult(_0x2a0559,_0x2ee34d){_0x2ee34d=_0x2ee34d||0xc8;return function(_0xf3204){if(_0xf3204){return _0x2a0559[_0x3f66('0x1a')](_0x2ee34d)[_0x3f66('0x1b')](_0xf3204);}};}function respondWithFilteredResult(_0x5eb3bd,_0x7e440f){return function(_0x2fc11e){if(_0x2fc11e){var _0x5d4ba5=_0x2fc11e[_0x3f66('0x1c')],_0x56fc23=_0x7e440f[_0x3f66('0x1d')],_0x2ac95c=_0x7e440f[_0x3f66('0x1d')]+_0x7e440f[_0x3f66('0x1e')],_0x2a3800;if(_0x2ac95c>=_0x5d4ba5){_0x2ac95c=_0x5d4ba5;_0x2a3800=0xc8;}else{_0x2a3800=0xce;}_0x5eb3bd['status'](_0x2a3800);return _0x5eb3bd[_0x3f66('0x1f')](_0x3f66('0x20'),_0x56fc23+'-'+_0x2ac95c+'/'+_0x5d4ba5)['json'](_0x2fc11e);}return null;};}function patchUpdates(_0x12f4e3){return function(_0x589fb3){try{jsonpatch[_0x3f66('0x21')](_0x589fb3,_0x12f4e3,!![]);}catch(_0x38dd74){return BPromise[_0x3f66('0x22')](_0x38dd74);}return _0x589fb3[_0x3f66('0x23')]();};}function saveUpdates(_0x25f9ca,_0x4f0967){return function(_0x2aab8a){if(_0x2aab8a){return _0x2aab8a['update'](_0x25f9ca)[_0x3f66('0x24')](function(_0x255e6c){return _0x255e6c;});}return null;};}function removeEntity(_0x4b0fd0,_0x583dfe){return function(_0x55a13a){if(_0x55a13a){return _0x55a13a[_0x3f66('0x25')]()['then'](function(){var _0xb097c7=_0x55a13a[_0x3f66('0x26')]({'plain':!![]});var _0x2e32cd=_0x3f66('0x27');return db[_0x3f66('0x28')][_0x3f66('0x25')]({'where':{'type':_0x2e32cd,'resourceId':_0xb097c7['id']}})[_0x3f66('0x24')](function(){return _0x55a13a;});})[_0x3f66('0x24')](function(){_0x4b0fd0['status'](0xcc)[_0x3f66('0x19')]();});}};}function handleEntityNotFound(_0x10ca55,_0x7bb81c){return function(_0x2d5e07){if(!_0x2d5e07){_0x10ca55['sendStatus'](0x194);}return _0x2d5e07;};}function handleError(_0x224188,_0x3df49a){_0x3df49a=_0x3df49a||0x1f4;return function(_0x48acfb){logger[_0x3f66('0x29')](_0x48acfb['stack']);if(_0x48acfb[_0x3f66('0x2a')]){delete _0x48acfb[_0x3f66('0x2a')];}_0x224188['status'](_0x3df49a)[_0x3f66('0x2b')](_0x48acfb);};}exports[_0x3f66('0x2c')]=function(_0x304a65,_0x4b6985){var _0x468a7b={},_0x310c87={},_0x944fd3={'count':0x0,'rows':[]};var _0x402741=_[_0x3f66('0x2d')](db[_0x3f66('0x2e')][_0x3f66('0x2f')],function(_0x5a1388){return{'name':_0x5a1388[_0x3f66('0x30')],'type':_0x5a1388[_0x3f66('0x31')][_0x3f66('0x32')]};});_0x310c87[_0x3f66('0x33')]=_[_0x3f66('0x2d')](_0x402741,_0x3f66('0x2a'));_0x310c87['query']=_[_0x3f66('0x34')](_0x304a65[_0x3f66('0x35')]);_0x310c87[_0x3f66('0x36')]=_['intersection'](_0x310c87[_0x3f66('0x33')],_0x310c87[_0x3f66('0x35')]);_0x468a7b[_0x3f66('0x37')]=_[_0x3f66('0x38')](_0x310c87['model'],qs['fields'](_0x304a65[_0x3f66('0x35')][_0x3f66('0x39')]));_0x468a7b[_0x3f66('0x37')]=_0x468a7b[_0x3f66('0x37')][_0x3f66('0x3a')]?_0x468a7b[_0x3f66('0x37')]:_0x310c87[_0x3f66('0x33')];if(!_0x304a65[_0x3f66('0x35')][_0x3f66('0x3b')](_0x3f66('0x3c'))){_0x468a7b['limit']=qs['limit'](_0x304a65[_0x3f66('0x35')][_0x3f66('0x1e')]);_0x468a7b[_0x3f66('0x1d')]=qs['offset'](_0x304a65[_0x3f66('0x35')][_0x3f66('0x1d')]);}_0x468a7b[_0x3f66('0x3d')]=qs[_0x3f66('0x3e')](_0x304a65[_0x3f66('0x35')][_0x3f66('0x3e')]);_0x468a7b[_0x3f66('0x3f')]=qs[_0x3f66('0x36')](_[_0x3f66('0x40')](_0x304a65['query'],_0x310c87[_0x3f66('0x36')]));if(_0x304a65[_0x3f66('0x35')]['filter']){_0x468a7b[_0x3f66('0x3f')]=_['merge'](_0x468a7b['where'],{'$or':_[_0x3f66('0x2d')](_0x402741,function(_0x5d3198){if(_0x5d3198['type']!==_0x3f66('0x41')){var _0x135f13={};_0x135f13[_0x5d3198[_0x3f66('0x2a')]]={'$like':'%'+_0x304a65[_0x3f66('0x35')][_0x3f66('0x42')]+'%'};return _0x135f13;}})});}_0x468a7b=_[_0x3f66('0x43')]({},_0x468a7b,_0x304a65[_0x3f66('0x44')]);var _0x1d7136={'where':_0x468a7b[_0x3f66('0x3f')]};return db[_0x3f66('0x2e')]['count'](_0x1d7136)[_0x3f66('0x24')](function(_0xf33c6e){_0x944fd3[_0x3f66('0x1c')]=_0xf33c6e;if(_0x304a65[_0x3f66('0x35')][_0x3f66('0x45')]){_0x468a7b[_0x3f66('0x46')]=[{'all':!![]}];}return db['MailQueue'][_0x3f66('0x47')](_0x468a7b);})[_0x3f66('0x24')](function(_0x11e0d9){_0x944fd3[_0x3f66('0x48')]=_0x11e0d9;return _0x944fd3;})['then'](respondWithFilteredResult(_0x4b6985,_0x468a7b))[_0x3f66('0x49')](handleError(_0x4b6985,null));};exports[_0x3f66('0x4a')]=function(_0x561319,_0x43407b){var _0x308852={'raw':!![],'where':{'id':_0x561319[_0x3f66('0x4b')]['id']}},_0x21c160={};_0x21c160[_0x3f66('0x33')]=_[_0x3f66('0x34')](db[_0x3f66('0x2e')][_0x3f66('0x2f')]);_0x21c160['query']=_[_0x3f66('0x34')](_0x561319['query']);_0x21c160['filters']=_[_0x3f66('0x38')](_0x21c160[_0x3f66('0x33')],_0x21c160[_0x3f66('0x35')]);_0x308852[_0x3f66('0x37')]=_['intersection'](_0x21c160['model'],qs[_0x3f66('0x39')](_0x561319[_0x3f66('0x35')][_0x3f66('0x39')]));_0x308852[_0x3f66('0x37')]=_0x308852[_0x3f66('0x37')][_0x3f66('0x3a')]?_0x308852[_0x3f66('0x37')]:_0x21c160[_0x3f66('0x33')];if(_0x561319[_0x3f66('0x35')][_0x3f66('0x45')]){_0x308852[_0x3f66('0x46')]=[{'all':!![]}];}_0x308852=_[_0x3f66('0x43')]({},_0x308852,_0x561319[_0x3f66('0x44')]);return db[_0x3f66('0x2e')][_0x3f66('0x4c')](_0x308852)[_0x3f66('0x24')](handleEntityNotFound(_0x43407b,null))['then'](respondWithResult(_0x43407b,null))['catch'](handleError(_0x43407b,null));};exports[_0x3f66('0x4d')]=function(_0x2ecea1,_0x579c6d){return db[_0x3f66('0x2e')][_0x3f66('0x4d')](_0x2ecea1[_0x3f66('0x4e')],{})[_0x3f66('0x24')](function(_0x21cf0f){var _0x8a03ea=_0x2ecea1[_0x3f66('0x4f')][_0x3f66('0x26')]({'plain':!![]});if(!_0x8a03ea)throw new Error(_0x3f66('0x50'));if(_0x8a03ea['role']===_0x3f66('0x4f')){var _0x4a3f35=_0x21cf0f[_0x3f66('0x26')]({'plain':!![]});var _0x5ec6b2=_0x3f66('0x27');return db[_0x3f66('0x51')][_0x3f66('0x4c')]({'where':{'name':_0x5ec6b2,'userProfileId':_0x8a03ea[_0x3f66('0x52')]},'raw':!![]})[_0x3f66('0x24')](function(_0x249668){if(_0x249668&&_0x249668[_0x3f66('0x53')]===0x0){return db['UserProfileResource'][_0x3f66('0x4d')]({'name':_0x4a3f35['name'],'resourceId':_0x4a3f35['id'],'type':_0x249668[_0x3f66('0x2a')],'sectionId':_0x249668['id']},{})[_0x3f66('0x24')](function(){return _0x21cf0f;});}else{return _0x21cf0f;}})[_0x3f66('0x49')](function(_0x125132){logger['error'](_0x3f66('0x54'),_0x125132);throw _0x125132;});}return _0x21cf0f;})[_0x3f66('0x24')](respondWithResult(_0x579c6d,0xc9))[_0x3f66('0x49')](handleError(_0x579c6d,null));};exports[_0x3f66('0x55')]=function(_0xd50ed0,_0x553328){if(_0xd50ed0['body']['id']){delete _0xd50ed0[_0x3f66('0x4e')]['id'];}return db[_0x3f66('0x2e')][_0x3f66('0x4c')]({'where':{'id':_0xd50ed0['params']['id']}})[_0x3f66('0x24')](handleEntityNotFound(_0x553328,null))[_0x3f66('0x24')](saveUpdates(_0xd50ed0[_0x3f66('0x4e')],null))['then'](respondWithResult(_0x553328,null))['catch'](handleError(_0x553328,null));};exports['destroy']=function(_0x38c601,_0x59906){return db[_0x3f66('0x2e')][_0x3f66('0x4c')]({'where':{'id':_0x38c601['params']['id']}})['then'](handleEntityNotFound(_0x59906,null))[_0x3f66('0x24')](removeEntity(_0x59906,null))[_0x3f66('0x49')](handleError(_0x59906,null));};exports[_0x3f66('0x56')]=function(_0x3bac90,_0x58adce){return db[_0x3f66('0x2e')]['describe']()[_0x3f66('0x24')](respondWithResult(_0x58adce,null))[_0x3f66('0x49')](handleError(_0x58adce,null));};exports[_0x3f66('0x57')]=function(_0x2db0bd,_0x8819af,_0x5bd959){var _0x2c3123={'raw':!![],'where':{}},_0x2375ee={},_0xaf124e;return db['MailQueue']['findOne']({'where':{'id':_0x2db0bd[_0x3f66('0x4b')]['id']}})['then'](handleEntityNotFound(_0x8819af,null))['then'](function(_0x1a79af){if(_0x1a79af){_0xaf124e=_0x1a79af[_0x3f66('0x26')]({'plain':!![]});_0x2375ee['model']=_[_0x3f66('0x34')](db[_0x3f66('0x58')]['rawAttributes']);_0x2375ee['query']=_[_0x3f66('0x34')](_0x2db0bd['query']);_0x2375ee['filters']=_[_0x3f66('0x38')](_0x2375ee[_0x3f66('0x33')],_0x2375ee[_0x3f66('0x35')]);_0x2c3123[_0x3f66('0x37')]=_['intersection'](_0x2375ee[_0x3f66('0x33')],qs[_0x3f66('0x39')](_0x2db0bd[_0x3f66('0x35')][_0x3f66('0x39')]));_0x2c3123[_0x3f66('0x37')]=_0x2c3123[_0x3f66('0x37')][_0x3f66('0x3a')]?_0x2c3123['attributes']:_0x2375ee['model'];if(!_0x2db0bd[_0x3f66('0x35')][_0x3f66('0x3b')](_0x3f66('0x3c'))){_0x2c3123[_0x3f66('0x1e')]=qs['limit'](_0x2db0bd[_0x3f66('0x35')][_0x3f66('0x1e')]);_0x2c3123['offset']=qs[_0x3f66('0x1d')](_0x2db0bd[_0x3f66('0x35')]['offset']);}_0x2c3123[_0x3f66('0x3d')]=qs['sort'](_0x2db0bd[_0x3f66('0x35')][_0x3f66('0x3e')]);_0x2c3123[_0x3f66('0x3f')]=qs[_0x3f66('0x36')](_[_0x3f66('0x40')](_0x2db0bd[_0x3f66('0x35')],_0x2375ee[_0x3f66('0x36')]));_0x2c3123['where'][_0x3f66('0x59')]=_0x1a79af['id'];if(_0x2db0bd[_0x3f66('0x35')][_0x3f66('0x42')]){_0x2c3123[_0x3f66('0x3f')]=_[_0x3f66('0x43')](_0x2c3123['where'],{'$or':_[_0x3f66('0x2d')](_0x2c3123[_0x3f66('0x37')],function(_0x3cef0c){var _0x31960b={};_0x31960b[_0x3cef0c]={'$like':'%'+_0x2db0bd[_0x3f66('0x35')][_0x3f66('0x42')]+'%'};return _0x31960b;})});}_0x2c3123=_[_0x3f66('0x43')]({},_0x2c3123,_0x2db0bd[_0x3f66('0x44')]);return db[_0x3f66('0x58')]['findAll'](_0x2c3123);}})[_0x3f66('0x24')](function(_0x1263b4){if(_0x1263b4){return db[_0x3f66('0x5a')][_0x3f66('0x5b')]({'where':{'id':_['map'](_0x1263b4,_0x3f66('0x5c')),'role':_0x3f66('0x5d')},'attributes':['id',_0x3f66('0x2a'),_0x3f66('0x5e'),'updatedAt','createdAt']});}})['then'](function(_0x1d5349){if(_0x1d5349){return{'count':_0x1d5349[_0x3f66('0x1c')],'rows':_[_0x3f66('0x2d')](_0x1d5349[_0x3f66('0x48')],function(_0x87a340){return{'membername':_0x87a340['name'],'UserId':_0x87a340['id'],'queue_name':_0xaf124e[_0x3f66('0x2a')],'MailQueueId':_0xaf124e['id'],'interface':util[_0x3f66('0x5f')](_0x3f66('0x60'),_0x3f66('0x61'),_0x87a340[_0x3f66('0x2a')]),'penalty':0x0,'paused':_0x87a340[_0x3f66('0x5e')],'createdAt':_0x87a340[_0x3f66('0x62')],'updatedAt':_0x87a340[_0x3f66('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3f66('0x24')](respondWithFilteredResult(_0x8819af,_0x2c3123))[_0x3f66('0x49')](handleError(_0x8819af,null));};exports[_0x3f66('0x64')]=function(_0x46e20,_0x4b9816,_0x302a05){var _0x56cadc={};var _0x17a015={};var _0x4e370a;var _0x25a09a;return db['MailQueue'][_0x3f66('0x65')]({'where':{'id':_0x46e20[_0x3f66('0x4b')]['id']}})[_0x3f66('0x24')](handleEntityNotFound(_0x4b9816,null))['then'](function(_0x2a812a){if(_0x2a812a){_0x4e370a=_0x2a812a;_0x17a015['model']=_[_0x3f66('0x34')](db['Team'][_0x3f66('0x2f')]);_0x17a015[_0x3f66('0x35')]=_[_0x3f66('0x34')](_0x46e20[_0x3f66('0x35')]);_0x17a015[_0x3f66('0x36')]=_[_0x3f66('0x38')](_0x17a015[_0x3f66('0x33')],_0x17a015['query']);_0x56cadc['attributes']=_['intersection'](_0x17a015[_0x3f66('0x33')],qs['fields'](_0x46e20[_0x3f66('0x35')]['fields']));_0x56cadc[_0x3f66('0x37')]=_0x56cadc[_0x3f66('0x37')][_0x3f66('0x3a')]?_0x56cadc[_0x3f66('0x37')]:_0x17a015[_0x3f66('0x33')];_0x56cadc[_0x3f66('0x3d')]=qs[_0x3f66('0x3e')](_0x46e20[_0x3f66('0x35')][_0x3f66('0x3e')]);_0x56cadc['where']=qs['filters'](_[_0x3f66('0x40')](_0x46e20['query'],_0x17a015[_0x3f66('0x36')]));if(_0x46e20['query'][_0x3f66('0x42')]){_0x56cadc[_0x3f66('0x3f')]=_['merge'](_0x56cadc['where'],{'$or':_[_0x3f66('0x2d')](_0x56cadc[_0x3f66('0x37')],function(_0x33746a){var _0x12ffa1={};_0x12ffa1[_0x33746a]={'$like':'%'+_0x46e20[_0x3f66('0x35')][_0x3f66('0x42')]+'%'};return _0x12ffa1;})});}_0x56cadc=_[_0x3f66('0x43')]({},_0x56cadc,_0x46e20['options']);return _0x4e370a[_0x3f66('0x64')](_0x56cadc);}})['then'](function(_0xb1699){if(_0xb1699){_0x25a09a=_0xb1699[_0x3f66('0x3a')];if(!_0x46e20[_0x3f66('0x35')][_0x3f66('0x3b')](_0x3f66('0x3c'))){_0x56cadc[_0x3f66('0x1e')]=qs[_0x3f66('0x1e')](_0x46e20[_0x3f66('0x35')][_0x3f66('0x1e')]);_0x56cadc[_0x3f66('0x1d')]=qs['offset'](_0x46e20['query']['offset']);}return _0x4e370a[_0x3f66('0x64')](_0x56cadc);}})[_0x3f66('0x24')](function(_0x31091d){if(_0x31091d){return _0x31091d?{'count':_0x25a09a,'rows':_0x31091d}:null;}})['then'](respondWithResult(_0x4b9816,null))[_0x3f66('0x49')](handleError(_0x4b9816,null));};exports[_0x3f66('0x66')]=function(_0x3c96c8,_0x57575d,_0x4cd09a){var _0x1bafe7=_0x3c96c8[_0x3f66('0x4e')][_0x3f66('0x67')];return db['Team']['findAll']({'where':{'id':_0x1bafe7},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3f66('0x68'),'attributes':['id',_0x3f66('0x2a'),'online',_0x3f66('0x69'),'interface'],'raw':!![]}]})['then'](function(_0x58365e){if(_0x58365e){var _0x5b806e=_[_0x3f66('0x6a')](_0x58365e,function(_0x6e31d5){var _0x3c7e2a=_0x6e31d5[_0x3f66('0x26')]({'plain':!![]});return _0x3c7e2a[_0x3f66('0x68')];});return db[_0x3f66('0x2e')][_0x3f66('0x4c')]({'where':{'id':_0x3c96c8[_0x3f66('0x4b')]['id']}})[_0x3f66('0x24')](function(_0x2a1cdc){return db['sequelize']['transaction'](function(_0x462168){return _0x2a1cdc['addTeams'](_0x1bafe7,{'transaction':_0x462168})[_0x3f66('0x24')](function(){return BPromise[_0x3f66('0x6b')](_0x5b806e,function(_0x1c77b6){return db[_0x3f66('0x58')]['findOrCreate']({'where':{'UserId':_0x1c77b6['id'],'MailQueueId':_0x3c96c8[_0x3f66('0x4b')]['id']},'transaction':_0x462168});});})[_0x3f66('0x24')](function(){_0x5b806e[_0x3f66('0x6c')](function(_0x3e2d58){socket[_0x3f66('0x6d')](_0x3f66('0x6e'),{'UserId':_0x3e2d58['id'],'MailQueueId':_0x2a1cdc['id']});});});});});}})[_0x3f66('0x24')](respondWithStatusCode(_0x57575d,null))[_0x3f66('0x49')](handleError(_0x57575d,null));};exports[_0x3f66('0x6f')]=function(_0x1c0e72,_0x2d04c0,_0x3725c7){return db[_0x3f66('0x70')]['findAll']({'where':{'id':_0x1c0e72[_0x3f66('0x35')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3f66('0x68'),'attributes':['id'],'raw':!![]}]})[_0x3f66('0x24')](handleEntityNotFound(_0x2d04c0,null))[_0x3f66('0x24')](function(_0x47ce91){var _0x36a9d3=_[_0x3f66('0x2d')](_0x47ce91,'id');var _0x433637=[];var _0xdfdb07=[];var _0x45e0bf=squel['select']();_0x45e0bf[_0x3f66('0x71')](_0x3f66('0x72'))['from'](_0x3f66('0x73'),'tq')[_0x3f66('0x74')](_0x3f66('0x75'),'ut',_0x3f66('0x76'))[_0x3f66('0x3f')](_0x3f66('0x77'),_0x1c0e72[_0x3f66('0x4b')]['id']);for(var _0x1fd6f9=0x0;_0x1fd6f9<_0x47ce91[_0x3f66('0x3a')];_0x1fd6f9+=0x1){let _0x1227d0=_0x47ce91[_0x1fd6f9];for(var _0x147fd5=0x0;_0x147fd5<_0x1227d0[_0x3f66('0x68')][_0x3f66('0x3a')];_0x147fd5+=0x1){let _0x1a3154=_0x1227d0[_0x3f66('0x68')][_0x147fd5];var _0x27160d=_0x45e0bf[_0x3f66('0x78')]();_0x27160d[_0x3f66('0x3f')](_0x3f66('0x79'),_0x1a3154['id']);_0xdfdb07['push'](db[_0x3f66('0x7a')]['query'](_0x27160d[_0x3f66('0x7b')](),{'type':db[_0x3f66('0x7a')][_0x3f66('0x7c')][_0x3f66('0x7d')]})['then'](function(_0x1778e6){if(_0x1778e6[_0x3f66('0x3a')]===0x1){return _0x1a3154['id'];}else{var _0x53a9f0=_['every'](_[_0x3f66('0x2d')](_0x1778e6,_0x3f66('0x7e')),function(_0x4116f6){return _['includes'](_0x36a9d3,_0x4116f6);});if(_0x53a9f0){return _0x1a3154['id'];}}}));}}return BPromise[_0x3f66('0x7f')](_0xdfdb07)['then'](function(_0x5a9d01){_0x433637=_(_0x433637)[_0x3f66('0x80')](_0x5a9d01)[_0x3f66('0x81')]()[_0x3f66('0x82')]();return db[_0x3f66('0x2e')][_0x3f66('0x4c')]({'where':{'id':_0x1c0e72[_0x3f66('0x4b')]['id']}})[_0x3f66('0x24')](function(_0xcf82ed){return db['sequelize'][_0x3f66('0x83')](function(_0x12782d){return _0xcf82ed['removeTeams'](_0x1c0e72[_0x3f66('0x35')]['ids'],{'transaction':_0x12782d})[_0x3f66('0x24')](function(){if(!_[_0x3f66('0x84')](_0x433637)){return _0xcf82ed[_0x3f66('0x85')](_0x433637,{'transaction':_0x12782d});}})['then'](function(){_0x433637[_0x3f66('0x6c')](function(_0x531ad5){socket[_0x3f66('0x6d')]('userMailQueue:remove',{'UserId':_0x531ad5,'MailQueueId':_0xcf82ed['id']});});});});});});})[_0x3f66('0x24')](respondWithStatusCode(_0x2d04c0,null))[_0x3f66('0x49')](handleError(_0x2d04c0,null));};exports['addAgents']=function(_0x119099,_0x119aa5,_0xf3c712){return db[_0x3f66('0x2e')][_0x3f66('0x4c')]({'where':{'id':_0x119099['params']['id']}})[_0x3f66('0x24')](handleEntityNotFound(_0x119aa5,null))[_0x3f66('0x24')](function(_0x322539){if(_0x322539){return _0x322539[_0x3f66('0x86')](_0x119099[_0x3f66('0x4e')]['ids'],_[_0x3f66('0x87')](_0x119099[_0x3f66('0x4e')],[_0x3f66('0x67'),'id'])||{})[_0x3f66('0x88')](function(_0x587d4c){for(var _0x2911d5=0x0;_0x2911d5<_0x119099[_0x3f66('0x4e')]['ids'][_0x3f66('0x3a')];_0x2911d5+=0x1){socket[_0x3f66('0x6d')](_0x3f66('0x6e'),{'UserId':_0x119099[_0x3f66('0x4e')]['ids'][_0x2911d5],'MailQueueId':_0x119099[_0x3f66('0x4b')]['id']});}return _0x587d4c;});}})['then'](respondWithResult(_0x119aa5,null))[_0x3f66('0x49')](handleError(_0x119aa5,null));};exports[_0x3f66('0x85')]=function(_0xf26935,_0x44b623,_0x2669e9){return db['MailQueue'][_0x3f66('0x4c')]({'where':{'id':_0xf26935['params']['id']}})[_0x3f66('0x24')](handleEntityNotFound(_0x44b623,null))[_0x3f66('0x24')](function(_0x549a9f){if(_0x549a9f){return _0x549a9f[_0x3f66('0x85')](_0xf26935[_0x3f66('0x35')][_0x3f66('0x67')])[_0x3f66('0x24')](function(){if(_[_0x3f66('0x89')](_0xf26935['query']['ids'])){for(var _0x2cb732=0x0;_0x2cb732<_0xf26935[_0x3f66('0x35')]['ids'][_0x3f66('0x3a')];_0x2cb732+=0x1){socket[_0x3f66('0x6d')]('userMailQueue:remove',{'UserId':Number(_0xf26935[_0x3f66('0x35')]['ids'][_0x2cb732]),'MailQueueId':Number(_0xf26935[_0x3f66('0x4b')]['id'])});}}else{socket[_0x3f66('0x6d')](_0x3f66('0x8a'),{'UserId':Number(_0xf26935[_0x3f66('0x35')][_0x3f66('0x67')]),'MailQueueId':Number(_0xf26935[_0x3f66('0x4b')]['id'])});}});}})[_0x3f66('0x24')](respondWithStatusCode(_0x44b623,null))[_0x3f66('0x49')](handleError(_0x44b623,null));};exports[_0x3f66('0x8b')]=function(_0x1c78f8,_0x3d636c,_0x2eefe6){var _0x194a33={};var _0x2233ce={};var _0x3c377f;var _0x5a2309;return db[_0x3f66('0x2e')][_0x3f66('0x65')]({'where':{'id':_0x1c78f8[_0x3f66('0x4b')]['id']}})[_0x3f66('0x24')](handleEntityNotFound(_0x3d636c,null))[_0x3f66('0x24')](function(_0x116b1f){if(_0x116b1f){_0x3c377f=_0x116b1f;_0x2233ce['model']=_[_0x3f66('0x34')](db[_0x3f66('0x5a')][_0x3f66('0x2f')]);_0x2233ce['query']=_['keys'](_0x1c78f8[_0x3f66('0x35')]);_0x2233ce[_0x3f66('0x36')]=_[_0x3f66('0x38')](_0x2233ce[_0x3f66('0x33')],_0x2233ce['query']);_0x194a33[_0x3f66('0x37')]=_[_0x3f66('0x38')](_0x2233ce['model'],qs[_0x3f66('0x39')](_0x1c78f8['query'][_0x3f66('0x39')]));_0x194a33[_0x3f66('0x37')]=_0x194a33[_0x3f66('0x37')]['length']?_0x194a33['attributes']:_0x2233ce[_0x3f66('0x33')];_0x194a33[_0x3f66('0x3d')]=qs[_0x3f66('0x3e')](_0x1c78f8[_0x3f66('0x35')][_0x3f66('0x3e')]);_0x194a33[_0x3f66('0x3f')]=qs[_0x3f66('0x36')](_[_0x3f66('0x40')](_0x1c78f8[_0x3f66('0x35')],_0x2233ce[_0x3f66('0x36')]));if(_0x1c78f8[_0x3f66('0x35')][_0x3f66('0x42')]){_0x194a33[_0x3f66('0x3f')]=_[_0x3f66('0x43')](_0x194a33['where'],{'$or':_[_0x3f66('0x2d')](_0x194a33[_0x3f66('0x37')],function(_0x570202){var _0x34747f={};_0x34747f[_0x570202]={'$like':'%'+_0x1c78f8['query'][_0x3f66('0x42')]+'%'};return _0x34747f;})});}_0x194a33=_['merge']({},_0x194a33,_0x1c78f8[_0x3f66('0x44')]);return _0x3c377f[_0x3f66('0x8b')](_0x194a33);}})[_0x3f66('0x24')](function(_0x590fe9){if(_0x590fe9){_0x5a2309=_0x590fe9[_0x3f66('0x3a')];if(!_0x1c78f8[_0x3f66('0x35')][_0x3f66('0x3b')](_0x3f66('0x3c'))){_0x194a33[_0x3f66('0x1e')]=qs['limit'](_0x1c78f8[_0x3f66('0x35')][_0x3f66('0x1e')]);_0x194a33[_0x3f66('0x1d')]=qs[_0x3f66('0x1d')](_0x1c78f8[_0x3f66('0x35')][_0x3f66('0x1d')]);}return _0x3c377f['getAgents'](_0x194a33);}})['then'](function(_0x57f60b){if(_0x57f60b){return _0x57f60b?{'count':_0x5a2309,'rows':_0x57f60b}:null;}})[_0x3f66('0x24')](respondWithResult(_0x3d636c,null))['catch'](handleError(_0x3d636c,null));}; \ No newline at end of file +var _0xada4=['MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','userMailQueue:save','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','destroy','get','MailQueues','UserProfileResource','then','stack','name','send','map','MailQueue','fieldName','type','keys','filters','intersection','model','query','fields','attributes','length','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','catch','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','hasOwnProperty','nolimit','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','SIP','findOne','Team','getTeams','User','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','ids','Agents','select','field','join','user_has_teams'];(function(_0x7f537a,_0x20b5cc){var _0x3b4d37=function(_0x58022c){while(--_0x58022c){_0x7f537a['push'](_0x7f537a['shift']());}};_0x3b4d37(++_0x20b5cc);}(_0xada4,0x97));var _0x4ada=function(_0xa52502,_0x46e116){_0xa52502=_0xa52502-0x0;var _0x26d411=_0xada4[_0xa52502];return _0x26d411;};'use strict';var pdf=require(_0x4ada('0x0'));var emlformat=require(_0x4ada('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4ada('0x2'));var jsonpatch=require(_0x4ada('0x3'));var rp=require(_0x4ada('0x4'));var moment=require(_0x4ada('0x5'));var BPromise=require(_0x4ada('0x6'));var Mustache=require(_0x4ada('0x7'));var util=require('util');var path=require(_0x4ada('0x8'));var sox=require('sox');var csv=require(_0x4ada('0x9'));var ejs=require(_0x4ada('0xa'));var fs=require('fs');var _=require(_0x4ada('0xb'));var squel=require(_0x4ada('0xc'));var crypto=require(_0x4ada('0xd'));var jsforce=require(_0x4ada('0xe'));var deskjs=require(_0x4ada('0xf'));var toCsv=require(_0x4ada('0x9'));var querystring=require(_0x4ada('0x10'));var Papa=require(_0x4ada('0x11'));var Redis=require(_0x4ada('0x12'));var authService=require(_0x4ada('0x13'));var qs=require(_0x4ada('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4ada('0x15'));var logger=require('../../config/logger')(_0x4ada('0x16'));var utils=require(_0x4ada('0x17'));var config=require(_0x4ada('0x18'));var db=require(_0x4ada('0x19'))['db'];config[_0x4ada('0x1a')]=_[_0x4ada('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4ada('0x1c'))(new Redis(config[_0x4ada('0x1a')]));require('./mailQueue.socket')[_0x4ada('0x1d')](socket);function respondWithStatusCode(_0x4ebb8f,_0x414bd9){_0x414bd9=_0x414bd9||0xcc;return function(_0x5cb136){if(_0x5cb136){return _0x4ebb8f[_0x4ada('0x1e')](_0x414bd9);}return _0x4ebb8f[_0x4ada('0x1f')](_0x414bd9)[_0x4ada('0x20')]();};}function respondWithResult(_0x48be09,_0x16f51f){_0x16f51f=_0x16f51f||0xc8;return function(_0x4fa1b1){if(_0x4fa1b1){return _0x48be09['status'](_0x16f51f)[_0x4ada('0x21')](_0x4fa1b1);}};}function respondWithFilteredResult(_0x59e08e,_0x439e83){return function(_0x1f2efa){if(_0x1f2efa){var _0xdd21c8=_0x1f2efa['count'],_0x21923b=_0x439e83[_0x4ada('0x22')],_0x25fc10=_0x439e83[_0x4ada('0x22')]+_0x439e83[_0x4ada('0x23')],_0x4fc17f;if(_0x25fc10>=_0xdd21c8){_0x25fc10=_0xdd21c8;_0x4fc17f=0xc8;}else{_0x4fc17f=0xce;}_0x59e08e[_0x4ada('0x1f')](_0x4fc17f);return _0x59e08e[_0x4ada('0x24')]('Content-Range',_0x21923b+'-'+_0x25fc10+'/'+_0xdd21c8)[_0x4ada('0x21')](_0x1f2efa);}return null;};}function patchUpdates(_0x461d01){return function(_0x430c4b){try{jsonpatch[_0x4ada('0x25')](_0x430c4b,_0x461d01,!![]);}catch(_0x1898e8){return BPromise[_0x4ada('0x26')](_0x1898e8);}return _0x430c4b[_0x4ada('0x27')]();};}function saveUpdates(_0x1d8972,_0x91945e){return function(_0x2f485b){if(_0x2f485b){return _0x2f485b[_0x4ada('0x28')](_0x1d8972)['then'](function(_0x33cd4f){return _0x33cd4f;});}return null;};}function removeEntity(_0x187db5,_0x135da7){return function(_0x16601a){if(_0x16601a){return _0x16601a[_0x4ada('0x29')]()['then'](function(){var _0x4edea2=_0x16601a[_0x4ada('0x2a')]({'plain':!![]});var _0x4041a2=_0x4ada('0x2b');return db[_0x4ada('0x2c')][_0x4ada('0x29')]({'where':{'type':_0x4041a2,'resourceId':_0x4edea2['id']}})[_0x4ada('0x2d')](function(){return _0x16601a;});})[_0x4ada('0x2d')](function(){_0x187db5[_0x4ada('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e2fa1,_0x31d7e1){return function(_0x39628e){if(!_0x39628e){_0x5e2fa1['sendStatus'](0x194);}return _0x39628e;};}function handleError(_0x3464a6,_0x3cc32d){_0x3cc32d=_0x3cc32d||0x1f4;return function(_0x183d02){logger['error'](_0x183d02[_0x4ada('0x2e')]);if(_0x183d02[_0x4ada('0x2f')]){delete _0x183d02[_0x4ada('0x2f')];}_0x3464a6['status'](_0x3cc32d)[_0x4ada('0x30')](_0x183d02);};}exports['index']=function(_0x28b522,_0x4c67fd){var _0xbb4e8f={},_0x21e4e8={},_0x37803d={'count':0x0,'rows':[]};var _0x3ddc76=_[_0x4ada('0x31')](db[_0x4ada('0x32')]['rawAttributes'],function(_0x2c1b24){return{'name':_0x2c1b24[_0x4ada('0x33')],'type':_0x2c1b24[_0x4ada('0x34')]['key']};});_0x21e4e8['model']=_[_0x4ada('0x31')](_0x3ddc76,_0x4ada('0x2f'));_0x21e4e8['query']=_[_0x4ada('0x35')](_0x28b522['query']);_0x21e4e8[_0x4ada('0x36')]=_[_0x4ada('0x37')](_0x21e4e8[_0x4ada('0x38')],_0x21e4e8[_0x4ada('0x39')]);_0xbb4e8f['attributes']=_[_0x4ada('0x37')](_0x21e4e8[_0x4ada('0x38')],qs[_0x4ada('0x3a')](_0x28b522[_0x4ada('0x39')][_0x4ada('0x3a')]));_0xbb4e8f[_0x4ada('0x3b')]=_0xbb4e8f[_0x4ada('0x3b')][_0x4ada('0x3c')]?_0xbb4e8f['attributes']:_0x21e4e8['model'];if(!_0x28b522[_0x4ada('0x39')]['hasOwnProperty']('nolimit')){_0xbb4e8f['limit']=qs['limit'](_0x28b522['query'][_0x4ada('0x23')]);_0xbb4e8f[_0x4ada('0x22')]=qs[_0x4ada('0x22')](_0x28b522[_0x4ada('0x39')][_0x4ada('0x22')]);}_0xbb4e8f[_0x4ada('0x3d')]=qs[_0x4ada('0x3e')](_0x28b522['query']['sort']);_0xbb4e8f[_0x4ada('0x3f')]=qs[_0x4ada('0x36')](_[_0x4ada('0x40')](_0x28b522['query'],_0x21e4e8['filters']));if(_0x28b522[_0x4ada('0x39')][_0x4ada('0x41')]){_0xbb4e8f[_0x4ada('0x3f')]=_[_0x4ada('0x42')](_0xbb4e8f[_0x4ada('0x3f')],{'$or':_[_0x4ada('0x31')](_0x3ddc76,function(_0x3b9057){if(_0x3b9057[_0x4ada('0x34')]!=='VIRTUAL'){var _0x31947b={};_0x31947b[_0x3b9057[_0x4ada('0x2f')]]={'$like':'%'+_0x28b522[_0x4ada('0x39')]['filter']+'%'};return _0x31947b;}})});}_0xbb4e8f=_[_0x4ada('0x42')]({},_0xbb4e8f,_0x28b522['options']);var _0x38fa45={'where':_0xbb4e8f[_0x4ada('0x3f')]};return db[_0x4ada('0x32')][_0x4ada('0x43')](_0x38fa45)[_0x4ada('0x2d')](function(_0x1640cf){_0x37803d[_0x4ada('0x43')]=_0x1640cf;if(_0x28b522[_0x4ada('0x39')][_0x4ada('0x44')]){_0xbb4e8f[_0x4ada('0x45')]=[{'all':!![]}];}return db['MailQueue'][_0x4ada('0x46')](_0xbb4e8f);})['then'](function(_0x2f0b5f){_0x37803d[_0x4ada('0x47')]=_0x2f0b5f;return _0x37803d;})[_0x4ada('0x2d')](respondWithFilteredResult(_0x4c67fd,_0xbb4e8f))['catch'](handleError(_0x4c67fd,null));};exports[_0x4ada('0x48')]=function(_0x25a7cf,_0x20ccfc){var _0x429ca8={'raw':!![],'where':{'id':_0x25a7cf[_0x4ada('0x49')]['id']}},_0x4253a8={};_0x4253a8[_0x4ada('0x38')]=_[_0x4ada('0x35')](db['MailQueue'][_0x4ada('0x4a')]);_0x4253a8[_0x4ada('0x39')]=_[_0x4ada('0x35')](_0x25a7cf[_0x4ada('0x39')]);_0x4253a8['filters']=_[_0x4ada('0x37')](_0x4253a8[_0x4ada('0x38')],_0x4253a8[_0x4ada('0x39')]);_0x429ca8[_0x4ada('0x3b')]=_[_0x4ada('0x37')](_0x4253a8['model'],qs[_0x4ada('0x3a')](_0x25a7cf[_0x4ada('0x39')][_0x4ada('0x3a')]));_0x429ca8[_0x4ada('0x3b')]=_0x429ca8[_0x4ada('0x3b')][_0x4ada('0x3c')]?_0x429ca8[_0x4ada('0x3b')]:_0x4253a8[_0x4ada('0x38')];if(_0x25a7cf[_0x4ada('0x39')][_0x4ada('0x44')]){_0x429ca8['include']=[{'all':!![]}];}_0x429ca8=_[_0x4ada('0x42')]({},_0x429ca8,_0x25a7cf[_0x4ada('0x4b')]);return db[_0x4ada('0x32')][_0x4ada('0x4c')](_0x429ca8)[_0x4ada('0x2d')](handleEntityNotFound(_0x20ccfc,null))['then'](respondWithResult(_0x20ccfc,null))[_0x4ada('0x4d')](handleError(_0x20ccfc,null));};exports['create']=function(_0x4a2397,_0x4b38e4){return db[_0x4ada('0x32')]['create'](_0x4a2397[_0x4ada('0x4e')],{})[_0x4ada('0x2d')](function(_0x3d67db){var _0xd5eb1d=_0x4a2397[_0x4ada('0x4f')]['get']({'plain':!![]});if(!_0xd5eb1d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd5eb1d[_0x4ada('0x50')]==='user'){var _0x10f92b=_0x3d67db[_0x4ada('0x2a')]({'plain':!![]});var _0x76f646='MailQueues';return db[_0x4ada('0x51')][_0x4ada('0x4c')]({'where':{'name':_0x76f646,'userProfileId':_0xd5eb1d[_0x4ada('0x52')]},'raw':!![]})[_0x4ada('0x2d')](function(_0x14b92f){if(_0x14b92f&&_0x14b92f[_0x4ada('0x53')]===0x0){return db[_0x4ada('0x2c')]['create']({'name':_0x10f92b[_0x4ada('0x2f')],'resourceId':_0x10f92b['id'],'type':_0x14b92f['name'],'sectionId':_0x14b92f['id']},{})[_0x4ada('0x2d')](function(){return _0x3d67db;});}else{return _0x3d67db;}})[_0x4ada('0x4d')](function(_0x40eb72){logger[_0x4ada('0x54')](_0x4ada('0x55'),_0x40eb72);throw _0x40eb72;});}return _0x3d67db;})['then'](respondWithResult(_0x4b38e4,0xc9))['catch'](handleError(_0x4b38e4,null));};exports[_0x4ada('0x28')]=function(_0x345d39,_0x19503e){if(_0x345d39[_0x4ada('0x4e')]['id']){delete _0x345d39['body']['id'];}return db[_0x4ada('0x32')][_0x4ada('0x4c')]({'where':{'id':_0x345d39[_0x4ada('0x49')]['id']}})[_0x4ada('0x2d')](handleEntityNotFound(_0x19503e,null))[_0x4ada('0x2d')](saveUpdates(_0x345d39[_0x4ada('0x4e')],null))['then'](respondWithResult(_0x19503e,null))[_0x4ada('0x4d')](handleError(_0x19503e,null));};exports[_0x4ada('0x29')]=function(_0x2222f6,_0x1f3b89){return db[_0x4ada('0x32')][_0x4ada('0x4c')]({'where':{'id':_0x2222f6[_0x4ada('0x49')]['id']}})[_0x4ada('0x2d')](handleEntityNotFound(_0x1f3b89,null))[_0x4ada('0x2d')](removeEntity(_0x1f3b89,null))['catch'](handleError(_0x1f3b89,null));};exports[_0x4ada('0x56')]=function(_0x422531,_0x4802ad){return db[_0x4ada('0x32')][_0x4ada('0x56')]()[_0x4ada('0x2d')](respondWithResult(_0x4802ad,null))[_0x4ada('0x4d')](handleError(_0x4802ad,null));};exports[_0x4ada('0x57')]=function(_0x3e440e,_0x307248,_0x16e3d1){var _0x3050c6={'raw':!![],'where':{}},_0x1ea41c={},_0x488fa0;return db[_0x4ada('0x32')]['findOne']({'where':{'id':_0x3e440e[_0x4ada('0x49')]['id']}})[_0x4ada('0x2d')](handleEntityNotFound(_0x307248,null))[_0x4ada('0x2d')](function(_0xb8d5f9){if(_0xb8d5f9){_0x488fa0=_0xb8d5f9[_0x4ada('0x2a')]({'plain':!![]});_0x1ea41c[_0x4ada('0x38')]=_[_0x4ada('0x35')](db[_0x4ada('0x58')][_0x4ada('0x4a')]);_0x1ea41c[_0x4ada('0x39')]=_[_0x4ada('0x35')](_0x3e440e[_0x4ada('0x39')]);_0x1ea41c[_0x4ada('0x36')]=_['intersection'](_0x1ea41c[_0x4ada('0x38')],_0x1ea41c['query']);_0x3050c6['attributes']=_['intersection'](_0x1ea41c[_0x4ada('0x38')],qs['fields'](_0x3e440e[_0x4ada('0x39')][_0x4ada('0x3a')]));_0x3050c6[_0x4ada('0x3b')]=_0x3050c6[_0x4ada('0x3b')][_0x4ada('0x3c')]?_0x3050c6['attributes']:_0x1ea41c[_0x4ada('0x38')];if(!_0x3e440e[_0x4ada('0x39')][_0x4ada('0x59')](_0x4ada('0x5a'))){_0x3050c6[_0x4ada('0x23')]=qs[_0x4ada('0x23')](_0x3e440e[_0x4ada('0x39')][_0x4ada('0x23')]);_0x3050c6[_0x4ada('0x22')]=qs['offset'](_0x3e440e['query']['offset']);}_0x3050c6[_0x4ada('0x3d')]=qs[_0x4ada('0x3e')](_0x3e440e[_0x4ada('0x39')][_0x4ada('0x3e')]);_0x3050c6[_0x4ada('0x3f')]=qs['filters'](_['pick'](_0x3e440e['query'],_0x1ea41c[_0x4ada('0x36')]));_0x3050c6[_0x4ada('0x3f')]['MailQueueId']=_0xb8d5f9['id'];if(_0x3e440e['query'][_0x4ada('0x41')]){_0x3050c6[_0x4ada('0x3f')]=_[_0x4ada('0x42')](_0x3050c6[_0x4ada('0x3f')],{'$or':_[_0x4ada('0x31')](_0x3050c6[_0x4ada('0x3b')],function(_0x331dd6){var _0x10c255={};_0x10c255[_0x331dd6]={'$like':'%'+_0x3e440e[_0x4ada('0x39')][_0x4ada('0x41')]+'%'};return _0x10c255;})});}_0x3050c6=_[_0x4ada('0x42')]({},_0x3050c6,_0x3e440e[_0x4ada('0x4b')]);return db[_0x4ada('0x58')][_0x4ada('0x46')](_0x3050c6);}})['then'](function(_0x37033d){if(_0x37033d){return db['User'][_0x4ada('0x5b')]({'where':{'id':_[_0x4ada('0x31')](_0x37033d,_0x4ada('0x5c')),'role':_0x4ada('0x5d')},'attributes':['id',_0x4ada('0x2f'),_0x4ada('0x5e'),_0x4ada('0x5f'),_0x4ada('0x60')]});}})['then'](function(_0x111843){if(_0x111843){return{'count':_0x111843['count'],'rows':_[_0x4ada('0x31')](_0x111843[_0x4ada('0x47')],function(_0x125743){return{'membername':_0x125743[_0x4ada('0x2f')],'UserId':_0x125743['id'],'queue_name':_0x488fa0[_0x4ada('0x2f')],'MailQueueId':_0x488fa0['id'],'interface':util['format']('%s/%s',_0x4ada('0x61'),_0x125743[_0x4ada('0x2f')]),'penalty':0x0,'paused':_0x125743[_0x4ada('0x5e')],'createdAt':_0x125743[_0x4ada('0x60')],'updatedAt':_0x125743[_0x4ada('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4ada('0x2d')](respondWithFilteredResult(_0x307248,_0x3050c6))[_0x4ada('0x4d')](handleError(_0x307248,null));};exports['getTeams']=function(_0x44c67f,_0x9a13e5,_0x1c18eb){var _0x308ac8={};var _0x4e397c={};var _0x45ed40;var _0xe552a1;return db['MailQueue'][_0x4ada('0x62')]({'where':{'id':_0x44c67f[_0x4ada('0x49')]['id']}})[_0x4ada('0x2d')](handleEntityNotFound(_0x9a13e5,null))[_0x4ada('0x2d')](function(_0x44a889){if(_0x44a889){_0x45ed40=_0x44a889;_0x4e397c[_0x4ada('0x38')]=_['keys'](db[_0x4ada('0x63')][_0x4ada('0x4a')]);_0x4e397c['query']=_[_0x4ada('0x35')](_0x44c67f[_0x4ada('0x39')]);_0x4e397c[_0x4ada('0x36')]=_[_0x4ada('0x37')](_0x4e397c['model'],_0x4e397c['query']);_0x308ac8['attributes']=_[_0x4ada('0x37')](_0x4e397c[_0x4ada('0x38')],qs['fields'](_0x44c67f[_0x4ada('0x39')]['fields']));_0x308ac8[_0x4ada('0x3b')]=_0x308ac8['attributes'][_0x4ada('0x3c')]?_0x308ac8[_0x4ada('0x3b')]:_0x4e397c[_0x4ada('0x38')];_0x308ac8['order']=qs[_0x4ada('0x3e')](_0x44c67f[_0x4ada('0x39')]['sort']);_0x308ac8[_0x4ada('0x3f')]=qs[_0x4ada('0x36')](_[_0x4ada('0x40')](_0x44c67f[_0x4ada('0x39')],_0x4e397c[_0x4ada('0x36')]));if(_0x44c67f[_0x4ada('0x39')][_0x4ada('0x41')]){_0x308ac8['where']=_['merge'](_0x308ac8['where'],{'$or':_[_0x4ada('0x31')](_0x308ac8['attributes'],function(_0x2dda84){var _0x14741d={};_0x14741d[_0x2dda84]={'$like':'%'+_0x44c67f['query'][_0x4ada('0x41')]+'%'};return _0x14741d;})});}_0x308ac8=_['merge']({},_0x308ac8,_0x44c67f[_0x4ada('0x4b')]);return _0x45ed40[_0x4ada('0x64')](_0x308ac8);}})[_0x4ada('0x2d')](function(_0x1e7a37){if(_0x1e7a37){_0xe552a1=_0x1e7a37[_0x4ada('0x3c')];if(!_0x44c67f[_0x4ada('0x39')][_0x4ada('0x59')](_0x4ada('0x5a'))){_0x308ac8[_0x4ada('0x23')]=qs[_0x4ada('0x23')](_0x44c67f[_0x4ada('0x39')][_0x4ada('0x23')]);_0x308ac8[_0x4ada('0x22')]=qs[_0x4ada('0x22')](_0x44c67f[_0x4ada('0x39')][_0x4ada('0x22')]);}return _0x45ed40[_0x4ada('0x64')](_0x308ac8);}})['then'](function(_0x482500){if(_0x482500){return _0x482500?{'count':_0xe552a1,'rows':_0x482500}:null;}})[_0x4ada('0x2d')](respondWithResult(_0x9a13e5,null))[_0x4ada('0x4d')](handleError(_0x9a13e5,null));};exports['addTeams']=function(_0x4857d2,_0x1c4a0c,_0x2e3457){var _0xabfb33=_0x4857d2[_0x4ada('0x4e')]['ids'];return db[_0x4ada('0x63')][_0x4ada('0x46')]({'where':{'id':_0xabfb33},'attributes':['id'],'include':[{'model':db[_0x4ada('0x65')],'as':'Agents','attributes':['id','name','online',_0x4ada('0x66'),_0x4ada('0x67')],'raw':!![]}]})[_0x4ada('0x2d')](function(_0x148ce7){if(_0x148ce7){var _0x4f3fd1=_['flatMap'](_0x148ce7,function(_0x41453f){var _0x2f70ae=_0x41453f[_0x4ada('0x2a')]({'plain':!![]});return _0x2f70ae['Agents'];});return db[_0x4ada('0x32')]['find']({'where':{'id':_0x4857d2[_0x4ada('0x49')]['id']}})[_0x4ada('0x2d')](function(_0xe59c8d){return db[_0x4ada('0x68')][_0x4ada('0x69')](function(_0x4c49ad){return _0xe59c8d['addTeams'](_0xabfb33,{'transaction':_0x4c49ad})[_0x4ada('0x2d')](function(){return BPromise[_0x4ada('0x6a')](_0x4f3fd1,function(_0x389196){return db[_0x4ada('0x58')][_0x4ada('0x6b')]({'where':{'UserId':_0x389196['id'],'MailQueueId':_0x4857d2['params']['id']},'transaction':_0x4c49ad});});})[_0x4ada('0x2d')](function(){_0x4f3fd1[_0x4ada('0x6c')](function(_0xb9758f){socket[_0x4ada('0x6d')]('userMailQueue:save',{'UserId':_0xb9758f['id'],'MailQueueId':_0xe59c8d['id']});});});});});}})[_0x4ada('0x2d')](respondWithStatusCode(_0x1c4a0c,null))[_0x4ada('0x4d')](handleError(_0x1c4a0c,null));};exports[_0x4ada('0x6e')]=function(_0xc3d0bb,_0x2a55c0,_0x4fe711){return db[_0x4ada('0x63')][_0x4ada('0x46')]({'where':{'id':_0xc3d0bb[_0x4ada('0x39')][_0x4ada('0x6f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4ada('0x70'),'attributes':['id'],'raw':!![]}]})[_0x4ada('0x2d')](handleEntityNotFound(_0x2a55c0,null))[_0x4ada('0x2d')](function(_0x39931d){var _0x5c280f=_['map'](_0x39931d,'id');var _0x167b82=[];var _0x11faef=[];var _0x3e928f=squel[_0x4ada('0x71')]();_0x3e928f[_0x4ada('0x72')]('tq.TeamId')['from']('team_has_mail_queues','tq')[_0x4ada('0x73')](_0x4ada('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x4ada('0x3f')](_0x4ada('0x75'),_0xc3d0bb[_0x4ada('0x49')]['id']);for(var _0x4f17c8=0x0;_0x4f17c8<_0x39931d[_0x4ada('0x3c')];_0x4f17c8+=0x1){let _0xbab071=_0x39931d[_0x4f17c8];for(var _0x267f71=0x0;_0x267f71<_0xbab071[_0x4ada('0x70')]['length'];_0x267f71+=0x1){let _0x227dc3=_0xbab071[_0x4ada('0x70')][_0x267f71];var _0x32a959=_0x3e928f[_0x4ada('0x76')]();_0x32a959['where']('ut.UserId\x20=\x20?',_0x227dc3['id']);_0x11faef[_0x4ada('0x77')](db[_0x4ada('0x68')][_0x4ada('0x39')](_0x32a959[_0x4ada('0x78')](),{'type':db[_0x4ada('0x68')][_0x4ada('0x79')][_0x4ada('0x7a')]})['then'](function(_0x53eab5){if(_0x53eab5[_0x4ada('0x3c')]===0x1){return _0x227dc3['id'];}else{var _0x293774=_[_0x4ada('0x7b')](_[_0x4ada('0x31')](_0x53eab5,_0x4ada('0x7c')),function(_0x1a0aa0){return _['includes'](_0x5c280f,_0x1a0aa0);});if(_0x293774){return _0x227dc3['id'];}}}));}}return BPromise[_0x4ada('0x7d')](_0x11faef)[_0x4ada('0x2d')](function(_0x2b4b69){_0x167b82=_(_0x167b82)['union'](_0x2b4b69)[_0x4ada('0x7e')]()[_0x4ada('0x7f')]();return db[_0x4ada('0x32')]['find']({'where':{'id':_0xc3d0bb[_0x4ada('0x49')]['id']}})[_0x4ada('0x2d')](function(_0x4bd438){return db['sequelize']['transaction'](function(_0x18609b){return _0x4bd438[_0x4ada('0x6e')](_0xc3d0bb[_0x4ada('0x39')][_0x4ada('0x6f')],{'transaction':_0x18609b})['then'](function(){if(!_[_0x4ada('0x80')](_0x167b82)){return _0x4bd438[_0x4ada('0x81')](_0x167b82,{'transaction':_0x18609b});}})[_0x4ada('0x2d')](function(){_0x167b82['forEach'](function(_0x47599f){socket['emit'](_0x4ada('0x82'),{'UserId':_0x47599f,'MailQueueId':_0x4bd438['id']});});});});});});})[_0x4ada('0x2d')](respondWithStatusCode(_0x2a55c0,null))[_0x4ada('0x4d')](handleError(_0x2a55c0,null));};exports[_0x4ada('0x83')]=function(_0x27053e,_0x2389af,_0x1a2ce1){return db['MailQueue'][_0x4ada('0x4c')]({'where':{'id':_0x27053e[_0x4ada('0x49')]['id']}})[_0x4ada('0x2d')](handleEntityNotFound(_0x2389af,null))[_0x4ada('0x2d')](function(_0xde7adf){if(_0xde7adf){return _0xde7adf[_0x4ada('0x83')](_0x27053e[_0x4ada('0x4e')][_0x4ada('0x6f')],_['omit'](_0x27053e[_0x4ada('0x4e')],[_0x4ada('0x6f'),'id'])||{})['spread'](function(_0x126eef){for(var _0x405df9=0x0;_0x405df9<_0x27053e[_0x4ada('0x4e')]['ids'][_0x4ada('0x3c')];_0x405df9+=0x1){socket['emit'](_0x4ada('0x84'),{'UserId':_0x27053e[_0x4ada('0x4e')][_0x4ada('0x6f')][_0x405df9],'MailQueueId':_0x27053e['params']['id']});}return _0x126eef;});}})[_0x4ada('0x2d')](respondWithResult(_0x2389af,null))[_0x4ada('0x4d')](handleError(_0x2389af,null));};exports[_0x4ada('0x81')]=function(_0x30f4c3,_0x153339,_0x132c35){return db[_0x4ada('0x32')][_0x4ada('0x4c')]({'where':{'id':_0x30f4c3[_0x4ada('0x49')]['id']}})[_0x4ada('0x2d')](handleEntityNotFound(_0x153339,null))[_0x4ada('0x2d')](function(_0x3cc594){if(_0x3cc594){return _0x3cc594[_0x4ada('0x81')](_0x30f4c3[_0x4ada('0x39')]['ids'])[_0x4ada('0x2d')](function(){if(_['isArray'](_0x30f4c3[_0x4ada('0x39')][_0x4ada('0x6f')])){for(var _0x635d90=0x0;_0x635d90<_0x30f4c3[_0x4ada('0x39')][_0x4ada('0x6f')]['length'];_0x635d90+=0x1){socket['emit'](_0x4ada('0x82'),{'UserId':Number(_0x30f4c3[_0x4ada('0x39')][_0x4ada('0x6f')][_0x635d90]),'MailQueueId':Number(_0x30f4c3[_0x4ada('0x49')]['id'])});}}else{socket[_0x4ada('0x6d')]('userMailQueue:remove',{'UserId':Number(_0x30f4c3['query']['ids']),'MailQueueId':Number(_0x30f4c3[_0x4ada('0x49')]['id'])});}});}})[_0x4ada('0x2d')](respondWithStatusCode(_0x153339,null))['catch'](handleError(_0x153339,null));};exports[_0x4ada('0x85')]=function(_0x277dcc,_0x9dee59,_0x718dc9){var _0x141df0={};var _0x3359fe={};var _0x6a9acc;var _0x17d803;return db[_0x4ada('0x32')][_0x4ada('0x62')]({'where':{'id':_0x277dcc[_0x4ada('0x49')]['id']}})[_0x4ada('0x2d')](handleEntityNotFound(_0x9dee59,null))[_0x4ada('0x2d')](function(_0x409771){if(_0x409771){_0x6a9acc=_0x409771;_0x3359fe['model']=_[_0x4ada('0x35')](db['User'][_0x4ada('0x4a')]);_0x3359fe[_0x4ada('0x39')]=_['keys'](_0x277dcc[_0x4ada('0x39')]);_0x3359fe[_0x4ada('0x36')]=_[_0x4ada('0x37')](_0x3359fe[_0x4ada('0x38')],_0x3359fe[_0x4ada('0x39')]);_0x141df0[_0x4ada('0x3b')]=_[_0x4ada('0x37')](_0x3359fe['model'],qs[_0x4ada('0x3a')](_0x277dcc[_0x4ada('0x39')][_0x4ada('0x3a')]));_0x141df0['attributes']=_0x141df0[_0x4ada('0x3b')]['length']?_0x141df0[_0x4ada('0x3b')]:_0x3359fe['model'];_0x141df0[_0x4ada('0x3d')]=qs[_0x4ada('0x3e')](_0x277dcc[_0x4ada('0x39')][_0x4ada('0x3e')]);_0x141df0[_0x4ada('0x3f')]=qs[_0x4ada('0x36')](_[_0x4ada('0x40')](_0x277dcc[_0x4ada('0x39')],_0x3359fe[_0x4ada('0x36')]));if(_0x277dcc[_0x4ada('0x39')][_0x4ada('0x41')]){_0x141df0[_0x4ada('0x3f')]=_[_0x4ada('0x42')](_0x141df0[_0x4ada('0x3f')],{'$or':_[_0x4ada('0x31')](_0x141df0[_0x4ada('0x3b')],function(_0x2f528){var _0x5bfd18={};_0x5bfd18[_0x2f528]={'$like':'%'+_0x277dcc['query'][_0x4ada('0x41')]+'%'};return _0x5bfd18;})});}_0x141df0=_[_0x4ada('0x42')]({},_0x141df0,_0x277dcc[_0x4ada('0x4b')]);return _0x6a9acc[_0x4ada('0x85')](_0x141df0);}})[_0x4ada('0x2d')](function(_0x17c02d){if(_0x17c02d){_0x17d803=_0x17c02d[_0x4ada('0x3c')];if(!_0x277dcc[_0x4ada('0x39')][_0x4ada('0x59')](_0x4ada('0x5a'))){_0x141df0[_0x4ada('0x23')]=qs[_0x4ada('0x23')](_0x277dcc[_0x4ada('0x39')][_0x4ada('0x23')]);_0x141df0[_0x4ada('0x22')]=qs['offset'](_0x277dcc['query'][_0x4ada('0x22')]);}return _0x6a9acc[_0x4ada('0x85')](_0x141df0);}})[_0x4ada('0x2d')](function(_0x3dd2b1){if(_0x3dd2b1){return _0x3dd2b1?{'count':_0x17d803,'rows':_0x3dd2b1}:null;}})['then'](respondWithResult(_0x9dee59,null))[_0x4ada('0x4d')](handleError(_0x9dee59,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 604eb9d..f58e238 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 _0x8f34=['emit','exports','events','../../mysqldb','save','update','remove'];(function(_0x4abab9,_0xde21a4){var _0x374eba=function(_0x3659f7){while(--_0x3659f7){_0x4abab9['push'](_0x4abab9['shift']());}};_0x374eba(++_0xde21a4);}(_0x8f34,0x121));var _0x48f3=function(_0x85f634,_0x5ea1ef){_0x85f634=_0x85f634-0x0;var _0x370075=_0x8f34[_0x85f634];return _0x370075;};'use strict';var EventEmitter=require(_0x48f3('0x0'));var MailQueue=require(_0x48f3('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x48f3('0x2'),'afterUpdate':_0x48f3('0x3'),'afterDestroy':_0x48f3('0x4')};function emitEvent(_0x19a361){return function(_0x971499,_0x2d08b9,_0x1b1488){MailQueueEvents['emit'](_0x19a361+':'+_0x971499['id'],_0x971499);MailQueueEvents[_0x48f3('0x5')](_0x19a361,_0x971499);_0x1b1488(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x48f3('0x6')]=MailQueueEvents; \ No newline at end of file +var _0x18e5=['exports','../../mysqldb','MailQueue','update','emit','hasOwnProperty','hook'];(function(_0x2f8e55,_0x4ff987){var _0x34746e=function(_0x29cc2d){while(--_0x29cc2d){_0x2f8e55['push'](_0x2f8e55['shift']());}};_0x34746e(++_0x4ff987);}(_0x18e5,0xb7));var _0x518e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x18e5[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x518e('0x0'))['db'][_0x518e('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x518e('0x2'),'afterDestroy':'remove'};function emitEvent(_0x3b76d1){return function(_0x28bb57,_0x19d921,_0x2c8060){MailQueueEvents[_0x518e('0x3')](_0x3b76d1+':'+_0x28bb57['id'],_0x28bb57);MailQueueEvents[_0x518e('0x3')](_0x3b76d1,_0x28bb57);_0x2c8060(null);};}for(var e in events){if(events[_0x518e('0x4')](e)){var event=events[e];MailQueue[_0x518e('0x5')](e,emitEvent(event));}}module[_0x518e('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index c265782..c24f7e4 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 _0xd493=['define','MailQueue','mail_queues','util','../../config/logger','bluebird','path','../../config/environment','./mailQueue.attributes'];(function(_0x36b0d8,_0x43670e){var _0x3c3f18=function(_0x920845){while(--_0x920845){_0x36b0d8['push'](_0x36b0d8['shift']());}};_0x3c3f18(++_0x43670e);}(_0xd493,0x1d7));var _0x3d49=function(_0x9e882d,_0x5654fb){_0x9e882d=_0x9e882d-0x0;var _0x290140=_0xd493[_0x9e882d];return _0x290140;};'use strict';var _=require('lodash');var util=require(_0x3d49('0x0'));var logger=require(_0x3d49('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3d49('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d49('0x3'));var rimraf=require('rimraf');var config=require(_0x3d49('0x4'));var attributes=require(_0x3d49('0x5'));module['exports']=function(_0x5b3a2e,_0x3970f1){return _0x5b3a2e[_0x3d49('0x6')](_0x3d49('0x7'),attributes,{'tableName':_0x3d49('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67b3=['MailQueue','mail_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0xe1e1aa,_0x39d7e){var _0x1e0943=function(_0x3f31df){while(--_0x3f31df){_0xe1e1aa['push'](_0xe1e1aa['shift']());}};_0x1e0943(++_0x39d7e);}(_0x67b3,0x1a2));var _0x367b=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x67b3[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0x367b('0x0'));var util=require('util');var logger=require(_0x367b('0x1'))(_0x367b('0x2'));var moment=require(_0x367b('0x3'));var BPromise=require(_0x367b('0x4'));var rp=require(_0x367b('0x5'));var fs=require('fs');var path=require(_0x367b('0x6'));var rimraf=require(_0x367b('0x7'));var config=require(_0x367b('0x8'));var attributes=require('./mailQueue.attributes');module[_0x367b('0x9')]=function(_0x63e764,_0x1b2dcc){return _0x63e764[_0x367b('0xa')](_0x367b('0xb'),attributes,{'tableName':_0x367b('0xc'),'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 f68d1c9..b751ff6 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 _0x7dcc=['error','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowMailQueue','find','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1261c2,_0x3ef819){var _0x3aabd2=function(_0x425d76){while(--_0x425d76){_0x1261c2['push'](_0x1261c2['shift']());}};_0x3aabd2(++_0x3ef819);}(_0x7dcc,0xfc));var _0xc7dc=function(_0x28836b,_0x389433){_0x28836b=_0x28836b-0x0;var _0x51f3f8=_0x7dcc[_0x28836b];return _0x51f3f8;};'use strict';var _=require('lodash');var util=require(_0xc7dc('0x0'));var moment=require('moment');var BPromise=require(_0xc7dc('0x1'));var rs=require(_0xc7dc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc7dc('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc7dc('0x4'))('rpc');var config=require(_0xc7dc('0x5'));var jayson=require(_0xc7dc('0x6'));var client=jayson[_0xc7dc('0x7')][_0xc7dc('0x8')]({'port':0x232a});config[_0xc7dc('0x9')]=_[_0xc7dc('0xa')](config[_0xc7dc('0x9')],{'host':_0xc7dc('0xb'),'port':0x18eb});var socket=require(_0xc7dc('0xc'))(new Redis(config[_0xc7dc('0x9')]));require(_0xc7dc('0xd'))[_0xc7dc('0xe')](socket);function respondWithRpcPromise(_0x23169e,_0x1beaef,_0x1c9ff5){return new BPromise(function(_0x16de8a,_0x5409c4){return client[_0xc7dc('0xf')](_0x23169e,_0x1c9ff5)[_0xc7dc('0x10')](function(_0x175e49){logger[_0xc7dc('0x11')](_0xc7dc('0x12'),_0x1beaef,_0xc7dc('0x13'));logger[_0xc7dc('0x14')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x1beaef,_0xc7dc('0x13'),JSON['stringify'](_0x175e49));if(_0x175e49['error']){if(_0x175e49[_0xc7dc('0x15')]['code']===0x1f4){logger[_0xc7dc('0x15')]('MailQueue,\x20%s,\x20%s',_0x1beaef,_0x175e49['error'][_0xc7dc('0x16')]);return _0x5409c4(_0x175e49[_0xc7dc('0x15')][_0xc7dc('0x16')]);}logger[_0xc7dc('0x15')](_0xc7dc('0x12'),_0x1beaef,_0x175e49[_0xc7dc('0x15')]['message']);return _0x16de8a(_0x175e49['error'][_0xc7dc('0x16')]);}else{logger[_0xc7dc('0x11')](_0xc7dc('0x12'),_0x1beaef,'request\x20sent');_0x16de8a(_0x175e49[_0xc7dc('0x17')][_0xc7dc('0x16')]);}})[_0xc7dc('0x18')](function(_0x482a24){logger[_0xc7dc('0x15')]('MailQueue,\x20%s,\x20%s',_0x1beaef,_0x482a24);_0x5409c4(_0x482a24);});});}exports[_0xc7dc('0x19')]=function(_0x560bf8){var _0xeaa156=this;return new Promise(function(_0xc11f24,_0x559451){return db[_0xc7dc('0x1a')][_0xc7dc('0x1b')]({'raw':_0x560bf8[_0xc7dc('0x1c')]?_0x560bf8[_0xc7dc('0x1c')][_0xc7dc('0x1d')]===undefined?!![]:![]:!![],'where':_0x560bf8[_0xc7dc('0x1c')]?_0x560bf8[_0xc7dc('0x1c')][_0xc7dc('0x1e')]||null:null,'attributes':_0x560bf8[_0xc7dc('0x1c')]?_0x560bf8['options'][_0xc7dc('0x1f')]||null:null,'limit':_0x560bf8[_0xc7dc('0x1c')]?_0x560bf8[_0xc7dc('0x1c')][_0xc7dc('0x20')]||null:null,'include':_0x560bf8[_0xc7dc('0x1c')]?_0x560bf8[_0xc7dc('0x1c')][_0xc7dc('0x21')]?_[_0xc7dc('0x22')](_0x560bf8[_0xc7dc('0x1c')][_0xc7dc('0x21')],function(_0xf76682){return{'model':db[_0xf76682['model']],'as':_0xf76682['as'],'attributes':_0xf76682[_0xc7dc('0x1f')],'include':_0xf76682[_0xc7dc('0x21')]?_[_0xc7dc('0x22')](_0xf76682[_0xc7dc('0x21')],function(_0x2449fa){return{'model':db[_0x2449fa[_0xc7dc('0x23')]],'as':_0x2449fa['as'],'attributes':_0x2449fa[_0xc7dc('0x1f')],'include':_0x2449fa[_0xc7dc('0x21')]?_[_0xc7dc('0x22')](_0x2449fa[_0xc7dc('0x21')],function(_0x29267e){return{'model':db[_0x29267e[_0xc7dc('0x23')]],'as':_0x29267e['as'],'attributes':_0x29267e[_0xc7dc('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1cb5d2){logger[_0xc7dc('0x11')](_0xc7dc('0x19'),_0x560bf8);logger[_0xc7dc('0x14')](_0xc7dc('0x19'),_0x560bf8,JSON[_0xc7dc('0x24')](_0x1cb5d2));_0xc11f24(_0x1cb5d2);})[_0xc7dc('0x18')](function(_0x298e7c){logger[_0xc7dc('0x15')]('GetMailQueue',_0x298e7c['message'],_0x560bf8);_0x559451(_0xeaa156[_0xc7dc('0x15')](0x1f4,_0x298e7c[_0xc7dc('0x16')]));});});};exports[_0xc7dc('0x25')]=function(_0x56db00){var _0x22cb9e=this;return new Promise(function(_0x1d32a5,_0xec62ba){return db['MailQueue'][_0xc7dc('0x26')]({'raw':_0x56db00[_0xc7dc('0x1c')]?_0x56db00[_0xc7dc('0x1c')][_0xc7dc('0x1d')]===undefined?!![]:![]:!![],'where':_0x56db00[_0xc7dc('0x1c')]?_0x56db00[_0xc7dc('0x1c')]['where']||null:null,'attributes':_0x56db00[_0xc7dc('0x1c')]?_0x56db00[_0xc7dc('0x1c')][_0xc7dc('0x1f')]||null:null,'include':_0x56db00[_0xc7dc('0x1c')]?_0x56db00[_0xc7dc('0x1c')]['include']?_[_0xc7dc('0x22')](_0x56db00['options'][_0xc7dc('0x21')],function(_0x543a1d){return{'model':db[_0x543a1d[_0xc7dc('0x23')]],'as':_0x543a1d['as'],'attributes':_0x543a1d[_0xc7dc('0x1f')],'include':_0x543a1d[_0xc7dc('0x21')]?_[_0xc7dc('0x22')](_0x543a1d[_0xc7dc('0x21')],function(_0xda00a){return{'model':db[_0xda00a[_0xc7dc('0x23')]],'as':_0xda00a['as'],'attributes':_0xda00a[_0xc7dc('0x1f')],'include':_0xda00a[_0xc7dc('0x21')]?_['map'](_0xda00a[_0xc7dc('0x21')],function(_0x4014ed){return{'model':db[_0x4014ed[_0xc7dc('0x23')]],'as':_0x4014ed['as'],'attributes':_0x4014ed['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x55999b){logger[_0xc7dc('0x11')](_0xc7dc('0x25'),_0x56db00);logger[_0xc7dc('0x14')](_0xc7dc('0x25'),_0x56db00,JSON[_0xc7dc('0x24')](_0x55999b));_0x1d32a5(_0x55999b);})[_0xc7dc('0x18')](function(_0x45bd43){logger[_0xc7dc('0x15')](_0xc7dc('0x25'),_0x45bd43[_0xc7dc('0x16')],_0x56db00);_0xec62ba(_0x22cb9e[_0xc7dc('0x15')](0x1f4,_0x45bd43[_0xc7dc('0x16')]));});});}; \ No newline at end of file +var _0xb69d=['defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','GetMailQueue','findAll','options','raw','where','attributes','limit','include','model','map','catch','MailQueue','find','ShowMailQueue','debug','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x131e09,_0x38b3ca){var _0x3ab749=function(_0x2633d2){while(--_0x2633d2){_0x131e09['push'](_0x131e09['shift']());}};_0x3ab749(++_0x38b3ca);}(_0xb69d,0x1cc));var _0xdb69=function(_0x438881,_0x50aac3){_0x438881=_0x438881-0x0;var _0x34d8b0=_0xb69d[_0x438881];return _0x34d8b0;};'use strict';var _=require('lodash');var util=require(_0xdb69('0x0'));var moment=require('moment');var BPromise=require(_0xdb69('0x1'));var rs=require(_0xdb69('0x2'));var fs=require('fs');var Redis=require(_0xdb69('0x3'));var db=require(_0xdb69('0x4'))['db'];var utils=require(_0xdb69('0x5'));var logger=require(_0xdb69('0x6'))(_0xdb69('0x7'));var config=require(_0xdb69('0x8'));var jayson=require(_0xdb69('0x9'));var client=jayson[_0xdb69('0xa')][_0xdb69('0xb')]({'port':0x232a});config[_0xdb69('0xc')]=_[_0xdb69('0xd')](config[_0xdb69('0xc')],{'host':_0xdb69('0xe'),'port':0x18eb});var socket=require(_0xdb69('0xf'))(new Redis(config['redis']));require(_0xdb69('0x10'))[_0xdb69('0x11')](socket);function respondWithRpcPromise(_0x1e71ad,_0x3abb57,_0x35882e){return new BPromise(function(_0x36367a,_0x3c62c9){return client[_0xdb69('0x12')](_0x1e71ad,_0x35882e)[_0xdb69('0x13')](function(_0x36dd75){logger[_0xdb69('0x14')]('MailQueue,\x20%s,\x20%s',_0x3abb57,_0xdb69('0x15'));logger['debug'](_0xdb69('0x16'),_0x3abb57,'request\x20sent',JSON[_0xdb69('0x17')](_0x36dd75));if(_0x36dd75['error']){if(_0x36dd75[_0xdb69('0x18')][_0xdb69('0x19')]===0x1f4){logger[_0xdb69('0x18')](_0xdb69('0x1a'),_0x3abb57,_0x36dd75[_0xdb69('0x18')]['message']);return _0x3c62c9(_0x36dd75['error']['message']);}logger['error'](_0xdb69('0x1a'),_0x3abb57,_0x36dd75['error'][_0xdb69('0x1b')]);return _0x36367a(_0x36dd75[_0xdb69('0x18')][_0xdb69('0x1b')]);}else{logger[_0xdb69('0x14')](_0xdb69('0x1a'),_0x3abb57,_0xdb69('0x15'));_0x36367a(_0x36dd75['result'][_0xdb69('0x1b')]);}})['catch'](function(_0x14a3a2){logger[_0xdb69('0x18')](_0xdb69('0x1a'),_0x3abb57,_0x14a3a2);_0x3c62c9(_0x14a3a2);});});}exports[_0xdb69('0x1c')]=function(_0x53ab85){var _0x9b69f8=this;return new Promise(function(_0x567702,_0x226376){return db['MailQueue'][_0xdb69('0x1d')]({'raw':_0x53ab85['options']?_0x53ab85[_0xdb69('0x1e')][_0xdb69('0x1f')]===undefined?!![]:![]:!![],'where':_0x53ab85[_0xdb69('0x1e')]?_0x53ab85['options'][_0xdb69('0x20')]||null:null,'attributes':_0x53ab85['options']?_0x53ab85[_0xdb69('0x1e')][_0xdb69('0x21')]||null:null,'limit':_0x53ab85[_0xdb69('0x1e')]?_0x53ab85['options'][_0xdb69('0x22')]||null:null,'include':_0x53ab85['options']?_0x53ab85[_0xdb69('0x1e')][_0xdb69('0x23')]?_['map'](_0x53ab85[_0xdb69('0x1e')][_0xdb69('0x23')],function(_0x684e99){return{'model':db[_0x684e99[_0xdb69('0x24')]],'as':_0x684e99['as'],'attributes':_0x684e99[_0xdb69('0x21')],'include':_0x684e99[_0xdb69('0x23')]?_[_0xdb69('0x25')](_0x684e99['include'],function(_0x524337){return{'model':db[_0x524337[_0xdb69('0x24')]],'as':_0x524337['as'],'attributes':_0x524337['attributes'],'include':_0x524337[_0xdb69('0x23')]?_[_0xdb69('0x25')](_0x524337[_0xdb69('0x23')],function(_0x59e166){return{'model':db[_0x59e166['model']],'as':_0x59e166['as'],'attributes':_0x59e166[_0xdb69('0x21')]};}):[]};}):[]};}):[]:[]})[_0xdb69('0x13')](function(_0x1a6875){logger[_0xdb69('0x14')]('GetMailQueue',_0x53ab85);logger['debug'](_0xdb69('0x1c'),_0x53ab85,JSON[_0xdb69('0x17')](_0x1a6875));_0x567702(_0x1a6875);})[_0xdb69('0x26')](function(_0x4b8f90){logger[_0xdb69('0x18')](_0xdb69('0x1c'),_0x4b8f90[_0xdb69('0x1b')],_0x53ab85);_0x226376(_0x9b69f8[_0xdb69('0x18')](0x1f4,_0x4b8f90[_0xdb69('0x1b')]));});});};exports['ShowMailQueue']=function(_0x54068e){var _0x2e1d71=this;return new Promise(function(_0x4cd2c0,_0x3f5796){return db[_0xdb69('0x27')][_0xdb69('0x28')]({'raw':_0x54068e[_0xdb69('0x1e')]?_0x54068e[_0xdb69('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x54068e['options']?_0x54068e['options'][_0xdb69('0x20')]||null:null,'attributes':_0x54068e[_0xdb69('0x1e')]?_0x54068e[_0xdb69('0x1e')][_0xdb69('0x21')]||null:null,'include':_0x54068e[_0xdb69('0x1e')]?_0x54068e[_0xdb69('0x1e')][_0xdb69('0x23')]?_[_0xdb69('0x25')](_0x54068e[_0xdb69('0x1e')][_0xdb69('0x23')],function(_0x488624){return{'model':db[_0x488624[_0xdb69('0x24')]],'as':_0x488624['as'],'attributes':_0x488624[_0xdb69('0x21')],'include':_0x488624['include']?_[_0xdb69('0x25')](_0x488624[_0xdb69('0x23')],function(_0x3b720d){return{'model':db[_0x3b720d[_0xdb69('0x24')]],'as':_0x3b720d['as'],'attributes':_0x3b720d['attributes'],'include':_0x3b720d[_0xdb69('0x23')]?_[_0xdb69('0x25')](_0x3b720d[_0xdb69('0x23')],function(_0x55dd47){return{'model':db[_0x55dd47[_0xdb69('0x24')]],'as':_0x55dd47['as'],'attributes':_0x55dd47[_0xdb69('0x21')]};}):[]};}):[]};}):[]:[]})[_0xdb69('0x13')](function(_0x3b14f2){logger[_0xdb69('0x14')](_0xdb69('0x29'),_0x54068e);logger[_0xdb69('0x2a')]('ShowMailQueue',_0x54068e,JSON[_0xdb69('0x17')](_0x3b14f2));_0x4cd2c0(_0x3b14f2);})['catch'](function(_0x11853b){logger[_0xdb69('0x18')](_0xdb69('0x29'),_0x11853b[_0xdb69('0x1b')],_0x54068e);_0x3f5796(_0x2e1d71['error'](0x1f4,_0x11853b[_0xdb69('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 69275c6..ec48bf9 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 _0xead9=['save','remove','update','emit','removeListener','register','mailQueue:','./mailQueue.events'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xead9,0x107));var _0x9ead=function(_0x56e4c8,_0x49a1a4){_0x56e4c8=_0x56e4c8-0x0;var _0x409cfa=_0xead9[_0x56e4c8];return _0x409cfa;};'use strict';var MailQueueEvents=require(_0x9ead('0x0'));var events=[_0x9ead('0x1'),_0x9ead('0x2'),_0x9ead('0x3')];function createListener(_0x3828b8,_0x45ee02){return function(_0x5342df){_0x45ee02[_0x9ead('0x4')](_0x3828b8,_0x5342df);};}function removeListener(_0x50c7e1,_0x36a80e){return function(){MailQueueEvents[_0x9ead('0x5')](_0x50c7e1,_0x36a80e);};}exports[_0x9ead('0x6')]=function(_0x35c956){for(var _0x4b6b2a=0x0,_0x3fbbad=events['length'];_0x4b6b2a<_0x3fbbad;_0x4b6b2a++){var _0x35e591=events[_0x4b6b2a];var _0x24e587=createListener(_0x9ead('0x7')+_0x35e591,_0x35c956);MailQueueEvents['on'](_0x35e591,_0x24e587);}}; \ No newline at end of file +var _0xe1ba=['remove','update','emit','removeListener','register','length','./mailQueue.events','save'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0xe1ba,0x1a6));var _0xae1b=function(_0x3f99a8,_0x160bf7){_0x3f99a8=_0x3f99a8-0x0;var _0x25c907=_0xe1ba[_0x3f99a8];return _0x25c907;};'use strict';var MailQueueEvents=require(_0xae1b('0x0'));var events=[_0xae1b('0x1'),_0xae1b('0x2'),_0xae1b('0x3')];function createListener(_0x41ae75,_0x2c3271){return function(_0x27abf5){_0x2c3271[_0xae1b('0x4')](_0x41ae75,_0x27abf5);};}function removeListener(_0x24d79a,_0x4b81a9){return function(){MailQueueEvents[_0xae1b('0x5')](_0x24d79a,_0x4b81a9);};}exports[_0xae1b('0x6')]=function(_0x4a78a8){for(var _0x4d71f2=0x0,_0xc8a1e0=events[_0xae1b('0x7')];_0x4d71f2<_0xc8a1e0;_0x4d71f2++){var _0x2e6c16=events[_0x4d71f2];var _0x1cd0c2=createListener('mailQueue:'+_0x2e6c16,_0x4a78a8);MailQueueEvents['on'](_0x2e6c16,_0x1cd0c2);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 27eac50..667a2c4 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 _0xe338=['index','/describe','describe','get','/:id','show','post','create','update','delete','destroy','exports','util','path','../../components/interaction/service','./mailQueueReport.controller','isAuthenticated'];(function(_0x4bb76c,_0x165970){var _0xbd60b0=function(_0x1a2c47){while(--_0x1a2c47){_0x4bb76c['push'](_0x4bb76c['shift']());}};_0xbd60b0(++_0x165970);}(_0xe338,0x193));var _0x8e33=function(_0x47285f,_0x577c2c){_0x47285f=_0x47285f-0x0;var _0x7ec23f=_0xe338[_0x47285f];return _0x7ec23f;};'use strict';var multer=require('multer');var util=require(_0x8e33('0x0'));var path=require(_0x8e33('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8e33('0x2'));var config=require('../../config/environment');var controller=require(_0x8e33('0x3'));router['get']('/',auth[_0x8e33('0x4')](),controller[_0x8e33('0x5')]);router['get'](_0x8e33('0x6'),auth[_0x8e33('0x4')](),controller[_0x8e33('0x7')]);router[_0x8e33('0x8')](_0x8e33('0x9'),auth[_0x8e33('0x4')](),controller[_0x8e33('0xa')]);router[_0x8e33('0xb')]('/',auth[_0x8e33('0x4')](),controller[_0x8e33('0xc')]);router['put'](_0x8e33('0x9'),auth[_0x8e33('0x4')](),controller[_0x8e33('0xd')]);router[_0x8e33('0xe')](_0x8e33('0x9'),auth[_0x8e33('0x4')](),controller[_0x8e33('0xf')]);module[_0x8e33('0x10')]=router; \ No newline at end of file +var _0xbc9e=['../../components/interaction/service','./mailQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated','post','create','put','update','delete','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbc9e,0x6d));var _0xebc9=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xbc9e[_0x8c43de];return _0xa6591b;};'use strict';var multer=require('multer');var util=require(_0xebc9('0x0'));var path=require(_0xebc9('0x1'));var timeout=require(_0xebc9('0x2'));var express=require(_0xebc9('0x3'));var router=express['Router']();var auth=require(_0xebc9('0x4'));var interaction=require(_0xebc9('0x5'));var config=require('../../config/environment');var controller=require(_0xebc9('0x6'));router[_0xebc9('0x7')]('/',auth['isAuthenticated'](),controller[_0xebc9('0x8')]);router[_0xebc9('0x7')](_0xebc9('0x9'),auth['isAuthenticated'](),controller[_0xebc9('0xa')]);router[_0xebc9('0x7')](_0xebc9('0xb'),auth[_0xebc9('0xc')](),controller['show']);router[_0xebc9('0xd')]('/',auth['isAuthenticated'](),controller[_0xebc9('0xe')]);router[_0xebc9('0xf')]('/:id',auth[_0xebc9('0xc')](),controller[_0xebc9('0x10')]);router[_0xebc9('0x11')](_0xebc9('0xb'),auth[_0xebc9('0xc')](),controller['destroy']);module[_0xebc9('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 29919fe..a9e8629 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 _0xee73=['moment','exports','STRING','DATE'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0xee73,0x184));var _0x3ee7=function(_0x3e4a61,_0x59a7c0){_0x3e4a61=_0x3e4a61-0x0;var _0x2361b5=_0xee73[_0x3e4a61];return _0x2361b5;};'use strict';var moment=require(_0x3ee7('0x0'));var Sequelize=require('sequelize');module[_0x3ee7('0x1')]={'uniqueid':{'type':Sequelize[_0x3ee7('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3ee7('0x2')]},'joinAt':{'type':Sequelize[_0x3ee7('0x3')]},'leaveAt':{'type':Sequelize[_0x3ee7('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x3ee7('0x2')]}}; \ No newline at end of file +var _0xaa40=['exports','STRING','DATE','moment','sequelize'];(function(_0x122751,_0x48aa61){var _0xc1ac24=function(_0x307a3f){while(--_0x307a3f){_0x122751['push'](_0x122751['shift']());}};_0xc1ac24(++_0x48aa61);}(_0xaa40,0x152));var _0x0aa4=function(_0x158f52,_0x55b3af){_0x158f52=_0x158f52-0x0;var _0x3759a3=_0xaa40[_0x158f52];return _0x3759a3;};'use strict';var moment=require(_0x0aa4('0x0'));var Sequelize=require(_0x0aa4('0x1'));module[_0x0aa4('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x0aa4('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x0aa4('0x4')]},'acceptAt':{'type':Sequelize[_0x0aa4('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x0aa4('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 45c9ebc..637eb9e 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 _0x4101=['pick','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','order','sort','where'];(function(_0x4edd73,_0x31c9f4){var _0x60a855=function(_0x183bce){while(--_0x183bce){_0x4edd73['push'](_0x4edd73['shift']());}};_0x60a855(++_0x31c9f4);}(_0x4101,0x1c5));var _0x1410=function(_0x389618,_0x28254a){_0x389618=_0x389618-0x0;var _0x45076c=_0x4101[_0x389618];return _0x45076c;};'use strict';var pdf=require(_0x1410('0x0'));var emlformat=require(_0x1410('0x1'));var rimraf=require(_0x1410('0x2'));var zipdir=require(_0x1410('0x3'));var jsonpatch=require(_0x1410('0x4'));var rp=require(_0x1410('0x5'));var moment=require(_0x1410('0x6'));var BPromise=require(_0x1410('0x7'));var Mustache=require(_0x1410('0x8'));var util=require('util');var path=require('path');var sox=require(_0x1410('0x9'));var csv=require(_0x1410('0xa'));var ejs=require(_0x1410('0xb'));var fs=require('fs');var _=require(_0x1410('0xc'));var squel=require(_0x1410('0xd'));var crypto=require('crypto');var jsforce=require(_0x1410('0xe'));var deskjs=require(_0x1410('0xf'));var toCsv=require(_0x1410('0xa'));var querystring=require(_0x1410('0x10'));var Papa=require(_0x1410('0x11'));var Redis=require(_0x1410('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1410('0x13'));var as=require(_0x1410('0x14'));var hardwareService=require(_0x1410('0x15'));var logger=require(_0x1410('0x16'))(_0x1410('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x1410('0x18'))['db'];function respondWithStatusCode(_0x194ebc,_0x5e0c5b){_0x5e0c5b=_0x5e0c5b||0xcc;return function(_0x3348d6){if(_0x3348d6){return _0x194ebc['sendStatus'](_0x5e0c5b);}return _0x194ebc[_0x1410('0x19')](_0x5e0c5b)[_0x1410('0x1a')]();};}function respondWithResult(_0x2ffd90,_0x2ebc7b){_0x2ebc7b=_0x2ebc7b||0xc8;return function(_0x36e3aa){if(_0x36e3aa){return _0x2ffd90[_0x1410('0x19')](_0x2ebc7b)[_0x1410('0x1b')](_0x36e3aa);}};}function respondWithFilteredResult(_0x2e912c,_0x229414){return function(_0x34f52f){if(_0x34f52f){var _0x296784=_0x34f52f[_0x1410('0x1c')],_0x5614e4=_0x229414[_0x1410('0x1d')],_0xf96a50=_0x229414[_0x1410('0x1d')]+_0x229414[_0x1410('0x1e')],_0x58a71f;if(_0xf96a50>=_0x296784){_0xf96a50=_0x296784;_0x58a71f=0xc8;}else{_0x58a71f=0xce;}_0x2e912c['status'](_0x58a71f);return _0x2e912c[_0x1410('0x1f')](_0x1410('0x20'),_0x5614e4+'-'+_0xf96a50+'/'+_0x296784)[_0x1410('0x1b')](_0x34f52f);}return null;};}function patchUpdates(_0x550701){return function(_0x1ed5b3){try{jsonpatch['apply'](_0x1ed5b3,_0x550701,!![]);}catch(_0x146fe7){return BPromise['reject'](_0x146fe7);}return _0x1ed5b3[_0x1410('0x21')]();};}function saveUpdates(_0x324d9d,_0x5e6409){return function(_0x46bcc5){if(_0x46bcc5){return _0x46bcc5[_0x1410('0x22')](_0x324d9d)[_0x1410('0x23')](function(_0x1989f8){return _0x1989f8;});}return null;};}function removeEntity(_0x233342,_0x3b6ce1){return function(_0x24708d){if(_0x24708d){return _0x24708d[_0x1410('0x24')]()[_0x1410('0x23')](function(){_0x233342[_0x1410('0x19')](0xcc)[_0x1410('0x1a')]();});}};}function handleEntityNotFound(_0x3e61c6,_0x1245d8){return function(_0x1a3f0d){if(!_0x1a3f0d){_0x3e61c6[_0x1410('0x25')](0x194);}return _0x1a3f0d;};}function handleError(_0x4c8e5d,_0x234229){_0x234229=_0x234229||0x1f4;return function(_0x54312b){logger[_0x1410('0x26')](_0x54312b[_0x1410('0x27')]);if(_0x54312b['name']){delete _0x54312b[_0x1410('0x28')];}_0x4c8e5d['status'](_0x234229)[_0x1410('0x29')](_0x54312b);};}exports[_0x1410('0x2a')]=function(_0x51c3d9,_0x361c71){var _0x53a60a={},_0x4aa00f={},_0x54ea26={'count':0x0,'rows':[]};var _0x30769f=_['map'](db[_0x1410('0x2b')][_0x1410('0x2c')],function(_0x718fa){return{'name':_0x718fa[_0x1410('0x2d')],'type':_0x718fa['type'][_0x1410('0x2e')]};});_0x4aa00f[_0x1410('0x2f')]=_[_0x1410('0x30')](_0x30769f,'name');_0x4aa00f[_0x1410('0x31')]=_[_0x1410('0x32')](_0x51c3d9['query']);_0x4aa00f[_0x1410('0x33')]=_[_0x1410('0x34')](_0x4aa00f[_0x1410('0x2f')],_0x4aa00f[_0x1410('0x31')]);_0x53a60a['attributes']=_[_0x1410('0x34')](_0x4aa00f[_0x1410('0x2f')],qs['fields'](_0x51c3d9[_0x1410('0x31')][_0x1410('0x35')]));_0x53a60a[_0x1410('0x36')]=_0x53a60a[_0x1410('0x36')]['length']?_0x53a60a['attributes']:_0x4aa00f['model'];if(!_0x51c3d9[_0x1410('0x31')]['hasOwnProperty']('nolimit')){_0x53a60a['limit']=qs['limit'](_0x51c3d9[_0x1410('0x31')][_0x1410('0x1e')]);_0x53a60a[_0x1410('0x1d')]=qs[_0x1410('0x1d')](_0x51c3d9[_0x1410('0x31')][_0x1410('0x1d')]);}_0x53a60a[_0x1410('0x37')]=qs[_0x1410('0x38')](_0x51c3d9['query'][_0x1410('0x38')]);_0x53a60a[_0x1410('0x39')]=qs[_0x1410('0x33')](_[_0x1410('0x3a')](_0x51c3d9[_0x1410('0x31')],_0x4aa00f['filters']));if(_0x51c3d9[_0x1410('0x31')]['filter']){_0x53a60a[_0x1410('0x39')]=_['merge'](_0x53a60a[_0x1410('0x39')],{'$or':_[_0x1410('0x30')](_0x30769f,function(_0x1f6939){if(_0x1f6939['type']!==_0x1410('0x3b')){var _0x3f4787={};_0x3f4787[_0x1f6939['name']]={'$like':'%'+_0x51c3d9[_0x1410('0x31')]['filter']+'%'};return _0x3f4787;}})});}_0x53a60a=_[_0x1410('0x3c')]({},_0x53a60a,_0x51c3d9['options']);var _0x46f0ed={'where':_0x53a60a[_0x1410('0x39')]};return db[_0x1410('0x2b')][_0x1410('0x1c')](_0x46f0ed)[_0x1410('0x23')](function(_0x4c228b){_0x54ea26[_0x1410('0x1c')]=_0x4c228b;if(_0x51c3d9[_0x1410('0x31')][_0x1410('0x3d')]){_0x53a60a[_0x1410('0x3e')]=[{'all':!![]}];}return db[_0x1410('0x2b')][_0x1410('0x3f')](_0x53a60a);})[_0x1410('0x23')](function(_0x12b37e){_0x54ea26[_0x1410('0x40')]=_0x12b37e;return _0x54ea26;})[_0x1410('0x23')](respondWithFilteredResult(_0x361c71,_0x53a60a))[_0x1410('0x41')](handleError(_0x361c71,null));};exports['show']=function(_0xe43cf2,_0x1438c6){var _0x201143={'raw':!![],'where':{'id':_0xe43cf2[_0x1410('0x42')]['id']}},_0x1f32a6={};_0x1f32a6[_0x1410('0x2f')]=_['keys'](db[_0x1410('0x2b')][_0x1410('0x2c')]);_0x1f32a6[_0x1410('0x31')]=_['keys'](_0xe43cf2[_0x1410('0x31')]);_0x1f32a6[_0x1410('0x33')]=_[_0x1410('0x34')](_0x1f32a6['model'],_0x1f32a6['query']);_0x201143['attributes']=_['intersection'](_0x1f32a6['model'],qs['fields'](_0xe43cf2['query']['fields']));_0x201143['attributes']=_0x201143[_0x1410('0x36')][_0x1410('0x43')]?_0x201143[_0x1410('0x36')]:_0x1f32a6[_0x1410('0x2f')];if(_0xe43cf2[_0x1410('0x31')][_0x1410('0x3d')]){_0x201143['include']=[{'all':!![]}];}_0x201143=_[_0x1410('0x3c')]({},_0x201143,_0xe43cf2[_0x1410('0x44')]);return db[_0x1410('0x2b')][_0x1410('0x45')](_0x201143)[_0x1410('0x23')](handleEntityNotFound(_0x1438c6,null))[_0x1410('0x23')](respondWithResult(_0x1438c6,null))['catch'](handleError(_0x1438c6,null));};exports[_0x1410('0x46')]=function(_0x470b10,_0x3dd454){return db[_0x1410('0x2b')][_0x1410('0x46')](_0x470b10[_0x1410('0x47')],{})[_0x1410('0x23')](respondWithResult(_0x3dd454,0xc9))[_0x1410('0x41')](handleError(_0x3dd454,null));};exports['update']=function(_0x144302,_0x4654cc){if(_0x144302[_0x1410('0x47')]['id']){delete _0x144302['body']['id'];}return db[_0x1410('0x2b')][_0x1410('0x45')]({'where':{'id':_0x144302[_0x1410('0x42')]['id']}})[_0x1410('0x23')](handleEntityNotFound(_0x4654cc,null))[_0x1410('0x23')](saveUpdates(_0x144302[_0x1410('0x47')],null))[_0x1410('0x23')](respondWithResult(_0x4654cc,null))['catch'](handleError(_0x4654cc,null));};exports[_0x1410('0x24')]=function(_0x22b955,_0x1005e1){return db['MailQueueReport'][_0x1410('0x45')]({'where':{'id':_0x22b955['params']['id']}})[_0x1410('0x23')](handleEntityNotFound(_0x1005e1,null))['then'](removeEntity(_0x1005e1,null))['catch'](handleError(_0x1005e1,null));};exports[_0x1410('0x48')]=function(_0x2003c4,_0x4e2b35){return db[_0x1410('0x2b')][_0x1410('0x48')]()['then'](respondWithResult(_0x4e2b35,null))[_0x1410('0x41')](handleError(_0x4e2b35,null));}; \ No newline at end of file +var _0x48f6=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','end','status','json','count','offset','limit','Content-Range','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','MailQueueReport','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x48f6,0x122));var _0x648f=function(_0x4b5e0a,_0x1fc41c){_0x4b5e0a=_0x4b5e0a-0x0;var _0x48c81f=_0x48f6[_0x4b5e0a];return _0x48c81f;};'use strict';var pdf=require(_0x648f('0x0'));var emlformat=require(_0x648f('0x1'));var rimraf=require(_0x648f('0x2'));var zipdir=require(_0x648f('0x3'));var jsonpatch=require(_0x648f('0x4'));var rp=require('request-promise');var moment=require(_0x648f('0x5'));var BPromise=require(_0x648f('0x6'));var Mustache=require(_0x648f('0x7'));var util=require(_0x648f('0x8'));var path=require(_0x648f('0x9'));var sox=require(_0x648f('0xa'));var csv=require(_0x648f('0xb'));var ejs=require(_0x648f('0xc'));var fs=require('fs');var _=require(_0x648f('0xd'));var squel=require(_0x648f('0xe'));var crypto=require(_0x648f('0xf'));var jsforce=require(_0x648f('0x10'));var deskjs=require(_0x648f('0x11'));var toCsv=require('to-csv');var querystring=require(_0x648f('0x12'));var Papa=require(_0x648f('0x13'));var Redis=require(_0x648f('0x14'));var authService=require(_0x648f('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x648f('0x16'));var hardwareService=require(_0x648f('0x17'));var logger=require(_0x648f('0x18'))(_0x648f('0x19'));var utils=require(_0x648f('0x1a'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b25e9,_0x537cc7){_0x537cc7=_0x537cc7||0xcc;return function(_0x28d6cd){if(_0x28d6cd){return _0x3b25e9['sendStatus'](_0x537cc7);}return _0x3b25e9['status'](_0x537cc7)[_0x648f('0x1b')]();};}function respondWithResult(_0x4b475d,_0x3cc49d){_0x3cc49d=_0x3cc49d||0xc8;return function(_0x4df645){if(_0x4df645){return _0x4b475d[_0x648f('0x1c')](_0x3cc49d)[_0x648f('0x1d')](_0x4df645);}};}function respondWithFilteredResult(_0x253e88,_0x3a5ae8){return function(_0xd528ce){if(_0xd528ce){var _0x302335=_0xd528ce[_0x648f('0x1e')],_0x4b68c1=_0x3a5ae8[_0x648f('0x1f')],_0x5182db=_0x3a5ae8['offset']+_0x3a5ae8[_0x648f('0x20')],_0x6e59c4;if(_0x5182db>=_0x302335){_0x5182db=_0x302335;_0x6e59c4=0xc8;}else{_0x6e59c4=0xce;}_0x253e88[_0x648f('0x1c')](_0x6e59c4);return _0x253e88['set'](_0x648f('0x21'),_0x4b68c1+'-'+_0x5182db+'/'+_0x302335)['json'](_0xd528ce);}return null;};}function patchUpdates(_0x107400){return function(_0x13f12d){try{jsonpatch['apply'](_0x13f12d,_0x107400,!![]);}catch(_0x4018a7){return BPromise['reject'](_0x4018a7);}return _0x13f12d[_0x648f('0x22')]();};}function saveUpdates(_0x407c82,_0x150e10){return function(_0x987af7){if(_0x987af7){return _0x987af7[_0x648f('0x23')](_0x407c82)['then'](function(_0x24203d){return _0x24203d;});}return null;};}function removeEntity(_0x14ebee,_0x227387){return function(_0x5df475){if(_0x5df475){return _0x5df475[_0x648f('0x24')]()[_0x648f('0x25')](function(){_0x14ebee[_0x648f('0x1c')](0xcc)[_0x648f('0x1b')]();});}};}function handleEntityNotFound(_0x5cf031,_0x2508c8){return function(_0x29a1ea){if(!_0x29a1ea){_0x5cf031[_0x648f('0x26')](0x194);}return _0x29a1ea;};}function handleError(_0x27f53b,_0x48618f){_0x48618f=_0x48618f||0x1f4;return function(_0x3d3289){logger[_0x648f('0x27')](_0x3d3289[_0x648f('0x28')]);if(_0x3d3289[_0x648f('0x29')]){delete _0x3d3289[_0x648f('0x29')];}_0x27f53b['status'](_0x48618f)[_0x648f('0x2a')](_0x3d3289);};}exports[_0x648f('0x2b')]=function(_0x3959f9,_0x2c8145){var _0x2f1fcf={},_0xbae94c={},_0x54b108={'count':0x0,'rows':[]};var _0x5a989a=_[_0x648f('0x2c')](db[_0x648f('0x2d')]['rawAttributes'],function(_0x12b47e){return{'name':_0x12b47e[_0x648f('0x2e')],'type':_0x12b47e[_0x648f('0x2f')][_0x648f('0x30')]};});_0xbae94c['model']=_[_0x648f('0x2c')](_0x5a989a,_0x648f('0x29'));_0xbae94c['query']=_[_0x648f('0x31')](_0x3959f9[_0x648f('0x32')]);_0xbae94c[_0x648f('0x33')]=_[_0x648f('0x34')](_0xbae94c['model'],_0xbae94c[_0x648f('0x32')]);_0x2f1fcf[_0x648f('0x35')]=_['intersection'](_0xbae94c[_0x648f('0x36')],qs['fields'](_0x3959f9['query'][_0x648f('0x37')]));_0x2f1fcf[_0x648f('0x35')]=_0x2f1fcf[_0x648f('0x35')]['length']?_0x2f1fcf[_0x648f('0x35')]:_0xbae94c[_0x648f('0x36')];if(!_0x3959f9[_0x648f('0x32')][_0x648f('0x38')](_0x648f('0x39'))){_0x2f1fcf['limit']=qs['limit'](_0x3959f9[_0x648f('0x32')][_0x648f('0x20')]);_0x2f1fcf['offset']=qs['offset'](_0x3959f9[_0x648f('0x32')][_0x648f('0x1f')]);}_0x2f1fcf[_0x648f('0x3a')]=qs[_0x648f('0x3b')](_0x3959f9[_0x648f('0x32')][_0x648f('0x3b')]);_0x2f1fcf[_0x648f('0x3c')]=qs['filters'](_[_0x648f('0x3d')](_0x3959f9[_0x648f('0x32')],_0xbae94c[_0x648f('0x33')]));if(_0x3959f9[_0x648f('0x32')]['filter']){_0x2f1fcf[_0x648f('0x3c')]=_[_0x648f('0x3e')](_0x2f1fcf[_0x648f('0x3c')],{'$or':_[_0x648f('0x2c')](_0x5a989a,function(_0xb1315e){if(_0xb1315e[_0x648f('0x2f')]!==_0x648f('0x3f')){var _0x1cdfe6={};_0x1cdfe6[_0xb1315e[_0x648f('0x29')]]={'$like':'%'+_0x3959f9['query'][_0x648f('0x40')]+'%'};return _0x1cdfe6;}})});}_0x2f1fcf=_['merge']({},_0x2f1fcf,_0x3959f9[_0x648f('0x41')]);var _0xed72d2={'where':_0x2f1fcf['where']};return db['MailQueueReport'][_0x648f('0x1e')](_0xed72d2)[_0x648f('0x25')](function(_0x430028){_0x54b108[_0x648f('0x1e')]=_0x430028;if(_0x3959f9[_0x648f('0x32')][_0x648f('0x42')]){_0x2f1fcf[_0x648f('0x43')]=[{'all':!![]}];}return db[_0x648f('0x2d')]['findAll'](_0x2f1fcf);})[_0x648f('0x25')](function(_0x6658c){_0x54b108[_0x648f('0x44')]=_0x6658c;return _0x54b108;})[_0x648f('0x25')](respondWithFilteredResult(_0x2c8145,_0x2f1fcf))[_0x648f('0x45')](handleError(_0x2c8145,null));};exports[_0x648f('0x46')]=function(_0x488a9f,_0x4afe7c){var _0x57197f={'raw':!![],'where':{'id':_0x488a9f[_0x648f('0x47')]['id']}},_0x2bf97d={};_0x2bf97d['model']=_[_0x648f('0x31')](db['MailQueueReport'][_0x648f('0x48')]);_0x2bf97d[_0x648f('0x32')]=_[_0x648f('0x31')](_0x488a9f['query']);_0x2bf97d[_0x648f('0x33')]=_[_0x648f('0x34')](_0x2bf97d[_0x648f('0x36')],_0x2bf97d['query']);_0x57197f[_0x648f('0x35')]=_[_0x648f('0x34')](_0x2bf97d[_0x648f('0x36')],qs[_0x648f('0x37')](_0x488a9f[_0x648f('0x32')]['fields']));_0x57197f['attributes']=_0x57197f[_0x648f('0x35')][_0x648f('0x49')]?_0x57197f['attributes']:_0x2bf97d[_0x648f('0x36')];if(_0x488a9f[_0x648f('0x32')][_0x648f('0x42')]){_0x57197f[_0x648f('0x43')]=[{'all':!![]}];}_0x57197f=_[_0x648f('0x3e')]({},_0x57197f,_0x488a9f[_0x648f('0x41')]);return db[_0x648f('0x2d')][_0x648f('0x4a')](_0x57197f)[_0x648f('0x25')](handleEntityNotFound(_0x4afe7c,null))[_0x648f('0x25')](respondWithResult(_0x4afe7c,null))[_0x648f('0x45')](handleError(_0x4afe7c,null));};exports[_0x648f('0x4b')]=function(_0x3789b7,_0x318b1d){return db['MailQueueReport'][_0x648f('0x4b')](_0x3789b7[_0x648f('0x4c')],{})[_0x648f('0x25')](respondWithResult(_0x318b1d,0xc9))[_0x648f('0x45')](handleError(_0x318b1d,null));};exports['update']=function(_0x1cc3cd,_0x5de2a2){if(_0x1cc3cd[_0x648f('0x4c')]['id']){delete _0x1cc3cd[_0x648f('0x4c')]['id'];}return db[_0x648f('0x2d')][_0x648f('0x4a')]({'where':{'id':_0x1cc3cd[_0x648f('0x47')]['id']}})[_0x648f('0x25')](handleEntityNotFound(_0x5de2a2,null))[_0x648f('0x25')](saveUpdates(_0x1cc3cd[_0x648f('0x4c')],null))[_0x648f('0x25')](respondWithResult(_0x5de2a2,null))[_0x648f('0x45')](handleError(_0x5de2a2,null));};exports[_0x648f('0x24')]=function(_0x5d3346,_0x1a9c07){return db[_0x648f('0x2d')][_0x648f('0x4a')]({'where':{'id':_0x5d3346['params']['id']}})['then'](handleEntityNotFound(_0x1a9c07,null))[_0x648f('0x25')](removeEntity(_0x1a9c07,null))[_0x648f('0x45')](handleError(_0x1a9c07,null));};exports['describe']=function(_0x48546f,_0x3967d0){return db[_0x648f('0x2d')][_0x648f('0x4d')]()[_0x648f('0x25')](respondWithResult(_0x3967d0,null))['catch'](handleError(_0x3967d0,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 6a03084..1a7b4f8 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 _0x0896=['api','bluebird','rimraf','../../config/environment','./mailQueueReport.attributes','MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x0896,0x12a));var _0x6089=function(_0x195fda,_0x19a825){_0x195fda=_0x195fda-0x0;var _0x56b67d=_0x0896[_0x195fda];return _0x56b67d;};'use strict';var _=require(_0x6089('0x0'));var util=require('util');var logger=require(_0x6089('0x1'))(_0x6089('0x2'));var moment=require('moment');var BPromise=require(_0x6089('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6089('0x4'));var config=require(_0x6089('0x5'));var attributes=require(_0x6089('0x6'));module['exports']=function(_0x11cdbb,_0x4f0dbd){return _0x11cdbb['define'](_0x6089('0x7'),attributes,{'tableName':_0x6089('0x8'),'paranoid':![],'indexes':[{'name':_0x6089('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2433=['bluebird','path','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x3e5b8b,_0x2e00b9){var _0x5bebca=function(_0x32014a){while(--_0x32014a){_0x3e5b8b['push'](_0x3e5b8b['shift']());}};_0x5bebca(++_0x2e00b9);}(_0x2433,0xe5));var _0x3243=function(_0x2979c1,_0xc27ca){_0x2979c1=_0x2979c1-0x0;var _0x3d19d5=_0x2433[_0x2979c1];return _0x3d19d5;};'use strict';var _=require(_0x3243('0x0'));var util=require(_0x3243('0x1'));var logger=require(_0x3243('0x2'))(_0x3243('0x3'));var moment=require(_0x3243('0x4'));var BPromise=require(_0x3243('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3243('0x6'));var rimraf=require('rimraf');var config=require(_0x3243('0x7'));var attributes=require(_0x3243('0x8'));module[_0x3243('0x9')]=function(_0x5df08e,_0x126626){return _0x5df08e[_0x3243('0xa')](_0x3243('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x3243('0xc'),'fields':[_0x3243('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 9c0ad78..007720a 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 _0xeda8=['body','options','raw','then','UpdateMailQueueReport','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateMailQueueReport','MailQueueReport','create'];(function(_0x434782,_0x3b66fc){var _0x44856f=function(_0x5c6e27){while(--_0x5c6e27){_0x434782['push'](_0x434782['shift']());}};_0x44856f(++_0x3b66fc);}(_0xeda8,0x104));var _0x8eda=function(_0x28ecf4,_0x4d62fd){_0x28ecf4=_0x28ecf4-0x0;var _0x54b937=_0xeda8[_0x28ecf4];return _0x54b937;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var moment=require('moment');var BPromise=require(_0x8eda('0x2'));var rs=require(_0x8eda('0x3'));var fs=require('fs');var Redis=require(_0x8eda('0x4'));var db=require(_0x8eda('0x5'))['db'];var utils=require(_0x8eda('0x6'));var logger=require(_0x8eda('0x7'))(_0x8eda('0x8'));var config=require(_0x8eda('0x9'));var jayson=require(_0x8eda('0xa'));var client=jayson[_0x8eda('0xb')][_0x8eda('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x32abe8,_0x4e2ebb,_0x28b721){return new BPromise(function(_0x1b6a1d,_0x5aa93d){return client[_0x8eda('0xd')](_0x32abe8,_0x28b721)['then'](function(_0x4f7893){logger['info']('MailQueueReport,\x20%s,\x20%s',_0x4e2ebb,_0x8eda('0xe'));logger[_0x8eda('0xf')](_0x8eda('0x10'),_0x4e2ebb,'request\x20sent',JSON[_0x8eda('0x11')](_0x4f7893));if(_0x4f7893['error']){if(_0x4f7893[_0x8eda('0x12')][_0x8eda('0x13')]===0x1f4){logger[_0x8eda('0x12')](_0x8eda('0x14'),_0x4e2ebb,_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);return _0x5aa93d(_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);}logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4e2ebb,_0x4f7893[_0x8eda('0x12')][_0x8eda('0x15')]);return _0x1b6a1d(_0x4f7893['error'][_0x8eda('0x15')]);}else{logger[_0x8eda('0x16')](_0x8eda('0x14'),_0x4e2ebb,'request\x20sent');_0x1b6a1d(_0x4f7893[_0x8eda('0x17')]['message']);}})[_0x8eda('0x18')](function(_0x553382){logger[_0x8eda('0x12')]('MailQueueReport,\x20%s,\x20%s',_0x4e2ebb,_0x553382);_0x5aa93d(_0x553382);});});}exports[_0x8eda('0x19')]=function(_0x2a4d2b){var _0x496c77=this;return new Promise(function(_0x5e44b7,_0x6a6282){return db[_0x8eda('0x1a')][_0x8eda('0x1b')](_0x2a4d2b[_0x8eda('0x1c')],{'raw':_0x2a4d2b[_0x8eda('0x1d')]?_0x2a4d2b[_0x8eda('0x1d')][_0x8eda('0x1e')]===undefined?!![]:![]:!![]})[_0x8eda('0x1f')](function(_0x850cce){logger[_0x8eda('0x16')](_0x8eda('0x19'),_0x2a4d2b);logger['debug'](_0x8eda('0x19'),_0x2a4d2b,JSON['stringify'](_0x850cce));_0x5e44b7(_0x850cce);})[_0x8eda('0x18')](function(_0x5183bc){logger[_0x8eda('0x12')](_0x8eda('0x19'),_0x5183bc['message'],_0x2a4d2b);_0x6a6282(_0x496c77['error'](0x1f4,_0x5183bc['message']));});});};exports[_0x8eda('0x20')]=function(_0x17cae8){var _0x5be84f=this;return new Promise(function(_0x978502,_0x37a8ab){return db['MailQueueReport'][_0x8eda('0x21')](_0x17cae8[_0x8eda('0x1c')],{'raw':_0x17cae8[_0x8eda('0x1d')]?_0x17cae8[_0x8eda('0x1d')][_0x8eda('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17cae8['options']?_0x17cae8[_0x8eda('0x1d')]['where']||null:null,'attributes':_0x17cae8[_0x8eda('0x1d')]?_0x17cae8[_0x8eda('0x1d')][_0x8eda('0x22')]||null:null,'limit':_0x17cae8['options']?_0x17cae8[_0x8eda('0x1d')][_0x8eda('0x23')]||null:null})[_0x8eda('0x1f')](function(_0x4cdd2e){logger[_0x8eda('0x16')](_0x8eda('0x20'),_0x17cae8);logger['debug'](_0x8eda('0x20'),_0x17cae8,JSON[_0x8eda('0x11')](_0x4cdd2e));_0x978502(_0x4cdd2e);})[_0x8eda('0x18')](function(_0x3cf3f7){logger['error']('UpdateMailQueueReport',_0x3cf3f7['message'],_0x17cae8);_0x37a8ab(_0x5be84f[_0x8eda('0x12')](0x1f4,_0x3cf3f7[_0x8eda('0x15')]));});});}; \ No newline at end of file +var _0xafc4=['info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateMailQueueReport','MailQueueReport','body','options','raw','debug','UpdateMailQueueReport','update','attributes','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then'];(function(_0x1455f3,_0x2eba86){var _0x2a2534=function(_0x1aa017){while(--_0x1aa017){_0x1455f3['push'](_0x1455f3['shift']());}};_0x2a2534(++_0x2eba86);}(_0xafc4,0x69));var _0x4afc=function(_0x5ad235,_0x44d078){_0x5ad235=_0x5ad235-0x0;var _0x180dd=_0xafc4[_0x5ad235];return _0x180dd;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var moment=require(_0x4afc('0x1'));var BPromise=require('bluebird');var rs=require(_0x4afc('0x2'));var fs=require('fs');var Redis=require(_0x4afc('0x3'));var db=require(_0x4afc('0x4'))['db'];var utils=require(_0x4afc('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4afc('0x6'));var client=jayson[_0x4afc('0x7')][_0x4afc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bb281,_0xc828d9,_0xaf053d){return new BPromise(function(_0x5e1e29,_0x31e165){return client[_0x4afc('0x9')](_0x1bb281,_0xaf053d)[_0x4afc('0xa')](function(_0x1e6bf5){logger[_0x4afc('0xb')](_0x4afc('0xc'),_0xc828d9,'request\x20sent');logger['debug'](_0x4afc('0xd'),_0xc828d9,'request\x20sent',JSON[_0x4afc('0xe')](_0x1e6bf5));if(_0x1e6bf5[_0x4afc('0xf')]){if(_0x1e6bf5['error'][_0x4afc('0x10')]===0x1f4){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x31e165(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}logger[_0x4afc('0xf')]('MailQueueReport,\x20%s,\x20%s',_0xc828d9,_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);return _0x5e1e29(_0x1e6bf5[_0x4afc('0xf')][_0x4afc('0x11')]);}else{logger['info']('MailQueueReport,\x20%s,\x20%s',_0xc828d9,_0x4afc('0x12'));_0x5e1e29(_0x1e6bf5['result'][_0x4afc('0x11')]);}})[_0x4afc('0x13')](function(_0x2b928b){logger[_0x4afc('0xf')](_0x4afc('0xc'),_0xc828d9,_0x2b928b);_0x31e165(_0x2b928b);});});}exports[_0x4afc('0x14')]=function(_0x22f809){var _0x3ad418=this;return new Promise(function(_0x16365f,_0x135349){return db[_0x4afc('0x15')]['create'](_0x22f809[_0x4afc('0x16')],{'raw':_0x22f809[_0x4afc('0x17')]?_0x22f809[_0x4afc('0x17')][_0x4afc('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x3bddc0){logger[_0x4afc('0xb')](_0x4afc('0x14'),_0x22f809);logger[_0x4afc('0x19')](_0x4afc('0x14'),_0x22f809,JSON[_0x4afc('0xe')](_0x3bddc0));_0x16365f(_0x3bddc0);})[_0x4afc('0x13')](function(_0x573a75){logger[_0x4afc('0xf')](_0x4afc('0x14'),_0x573a75['message'],_0x22f809);_0x135349(_0x3ad418[_0x4afc('0xf')](0x1f4,_0x573a75['message']));});});};exports[_0x4afc('0x1a')]=function(_0x2a0314){var _0x1e454e=this;return new Promise(function(_0x2876f2,_0x86dbd4){return db[_0x4afc('0x15')][_0x4afc('0x1b')](_0x2a0314[_0x4afc('0x16')],{'raw':_0x2a0314[_0x4afc('0x17')]?_0x2a0314[_0x4afc('0x17')][_0x4afc('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a0314[_0x4afc('0x17')]?_0x2a0314[_0x4afc('0x17')]['where']||null:null,'attributes':_0x2a0314[_0x4afc('0x17')]?_0x2a0314[_0x4afc('0x17')][_0x4afc('0x1c')]||null:null,'limit':_0x2a0314['options']?_0x2a0314['options']['limit']||null:null})[_0x4afc('0xa')](function(_0x5db47e){logger['info'](_0x4afc('0x1a'),_0x2a0314);logger[_0x4afc('0x19')]('UpdateMailQueueReport',_0x2a0314,JSON['stringify'](_0x5db47e));_0x2876f2(_0x5db47e);})['catch'](function(_0x3bae1a){logger[_0x4afc('0xf')](_0x4afc('0x1a'),_0x3bae1a[_0x4afc('0x11')],_0x2a0314);_0x86dbd4(_0x1e454e[_0x4afc('0xf')](0x1f4,_0x3bae1a[_0x4afc('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index a1f573f..d697629 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 _0xd9d6=['Router','../../config/environment','exports','multer','util','connect-timeout','express'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd9d6,0xb2));var _0x6d9d=function(_0x2747b2,_0x10dce8){_0x2747b2=_0x2747b2-0x0;var _0x540db0=_0xd9d6[_0x2747b2];return _0x540db0;};'use strict';var multer=require(_0x6d9d('0x0'));var util=require(_0x6d9d('0x1'));var path=require('path');var timeout=require(_0x6d9d('0x2'));var express=require(_0x6d9d('0x3'));var router=express[_0x6d9d('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6d9d('0x5'));module[_0x6d9d('0x6')]=router; \ No newline at end of file +var _0x35ff=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x35ff,0x85));var _0xf35f=function(_0x1179d2,_0x489bcf){_0x1179d2=_0x1179d2-0x0;var _0x45a38b=_0x35ff[_0x1179d2];return _0x45a38b;};'use strict';var multer=require(_0xf35f('0x0'));var util=require(_0xf35f('0x1'));var path=require(_0xf35f('0x2'));var timeout=require(_0xf35f('0x3'));var express=require(_0xf35f('0x4'));var router=express[_0xf35f('0x5')]();var auth=require(_0xf35f('0x6'));var interaction=require(_0xf35f('0x7'));var config=require(_0xf35f('0x8'));module[_0xf35f('0x9')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index dccc5a2..0c0fbb6 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 _0x4d8b=['BOOLEAN','username','INTEGER','INBOX','STRING'];(function(_0x36473e,_0x3bc969){var _0x3245a7=function(_0x207f02){while(--_0x207f02){_0x36473e['push'](_0x36473e['shift']());}};_0x3245a7(++_0x3bc969);}(_0x4d8b,0x86));var _0xb4d8=function(_0x1d426f,_0x37e919){_0x1d426f=_0x1d426f-0x0;var _0x17f71a=_0x4d8b[_0x1d426f];return _0x17f71a;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xb4d8('0x0')]},'host':{'type':Sequelize[_0xb4d8('0x0')]},'authentication':{'type':Sequelize[_0xb4d8('0x1')],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':_0xb4d8('0x2')},'password':{'type':Sequelize[_0xb4d8('0x0')]},'port':{'type':Sequelize[_0xb4d8('0x3')]},'tls':{'type':Sequelize[_0xb4d8('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xb4d8('0x0')],'defaultValue':_0xb4d8('0x4')},'connTimeout':{'type':Sequelize[_0xb4d8('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xb4d8('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xb4d8('0x0')]}}; \ No newline at end of file +var _0xae42=['exports','STRING','BOOLEAN','username','INBOX','sequelize'];(function(_0x7a2a14,_0x188f7a){var _0x22ecff=function(_0x5c4578){while(--_0x5c4578){_0x7a2a14['push'](_0x7a2a14['shift']());}};_0x22ecff(++_0x188f7a);}(_0xae42,0x1a3));var _0x2ae4=function(_0x3eee18,_0x11bde5){_0x3eee18=_0x3eee18-0x0;var _0x473a83=_0xae42[_0x3eee18];return _0x473a83;};'use strict';var Sequelize=require(_0x2ae4('0x0'));module[_0x2ae4('0x1')]={'description':{'type':Sequelize[_0x2ae4('0x2')]},'host':{'type':Sequelize[_0x2ae4('0x2')]},'authentication':{'type':Sequelize[_0x2ae4('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':_0x2ae4('0x4')},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x2ae4('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x2ae4('0x2')],'defaultValue':_0x2ae4('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x2ae4('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 50c43e8..d1f7db4 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 _0xf45e=['exports','define','MailServerIn','mail_servers_in','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xf45e,0x115));var _0xef45=function(_0x4f194b,_0xba02d4){_0x4f194b=_0x4f194b-0x0;var _0x24f58f=_0xf45e[_0x4f194b];return _0x24f58f;};'use strict';var _=require(_0xef45('0x0'));var util=require('util');var logger=require(_0xef45('0x1'))('api');var moment=require(_0xef45('0x2'));var BPromise=require(_0xef45('0x3'));var rp=require(_0xef45('0x4'));var fs=require('fs');var path=require(_0xef45('0x5'));var rimraf=require(_0xef45('0x6'));var config=require(_0xef45('0x7'));var attributes=require(_0xef45('0x8'));module[_0xef45('0x9')]=function(_0x338960,_0x315b84){return _0x338960[_0xef45('0xa')](_0xef45('0xb'),attributes,{'tableName':_0xef45('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7a0=['path','rimraf','../../config/environment','exports','define','MailServerIn','mail_servers_in','lodash','util','api','bluebird','request-promise'];(function(_0x582d0b,_0x28f609){var _0x2e93e1=function(_0xb6a81c){while(--_0xb6a81c){_0x582d0b['push'](_0x582d0b['shift']());}};_0x2e93e1(++_0x28f609);}(_0xd7a0,0x163));var _0x0d7a=function(_0x4575de,_0x154d9b){_0x4575de=_0x4575de-0x0;var _0x572223=_0xd7a0[_0x4575de];return _0x572223;};'use strict';var _=require(_0x0d7a('0x0'));var util=require(_0x0d7a('0x1'));var logger=require('../../config/logger')(_0x0d7a('0x2'));var moment=require('moment');var BPromise=require(_0x0d7a('0x3'));var rp=require(_0x0d7a('0x4'));var fs=require('fs');var path=require(_0x0d7a('0x5'));var rimraf=require(_0x0d7a('0x6'));var config=require(_0x0d7a('0x7'));var attributes=require('./mailServerIn.attributes');module[_0x0d7a('0x8')]=function(_0x37c000,_0x321114){return _0x37c000[_0x0d7a('0x9')](_0x0d7a('0xa'),attributes,{'tableName':_0x0d7a('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 b0dc717..d626259 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 _0xc66b=['include','map','model','attributes','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','limit'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xc66b,0x104));var _0xbc66=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc66b[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require(_0xbc66('0x0'));var moment=require(_0xbc66('0x1'));var BPromise=require(_0xbc66('0x2'));var rs=require(_0xbc66('0x3'));var fs=require('fs');var Redis=require(_0xbc66('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc66('0x5'));var logger=require(_0xbc66('0x6'))('rpc');var config=require(_0xbc66('0x7'));var jayson=require(_0xbc66('0x8'));var client=jayson[_0xbc66('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43d471,_0x3676c8,_0x154cf6){return new BPromise(function(_0x4b6571,_0x30fe34){return client['request'](_0x43d471,_0x154cf6)[_0xbc66('0xa')](function(_0x2930d2){logger[_0xbc66('0xb')]('MailServerIn,\x20%s,\x20%s',_0x3676c8,_0xbc66('0xc'));logger[_0xbc66('0xd')](_0xbc66('0xe'),_0x3676c8,'request\x20sent',JSON[_0xbc66('0xf')](_0x2930d2));if(_0x2930d2[_0xbc66('0x10')]){if(_0x2930d2[_0xbc66('0x10')]['code']===0x1f4){logger[_0xbc66('0x10')](_0xbc66('0x11'),_0x3676c8,_0x2930d2['error'][_0xbc66('0x12')]);return _0x30fe34(_0x2930d2[_0xbc66('0x10')][_0xbc66('0x12')]);}logger[_0xbc66('0x10')](_0xbc66('0x11'),_0x3676c8,_0x2930d2[_0xbc66('0x10')][_0xbc66('0x12')]);return _0x4b6571(_0x2930d2['error'][_0xbc66('0x12')]);}else{logger['info'](_0xbc66('0x11'),_0x3676c8,_0xbc66('0xc'));_0x4b6571(_0x2930d2[_0xbc66('0x13')][_0xbc66('0x12')]);}})[_0xbc66('0x14')](function(_0x1727a9){logger['error'](_0xbc66('0x11'),_0x3676c8,_0x1727a9);_0x30fe34(_0x1727a9);});});}exports[_0xbc66('0x15')]=function(_0x353f1d){var _0x1a6c03=this;return new Promise(function(_0x288f1c,_0x5c5048){return db[_0xbc66('0x16')][_0xbc66('0x17')]({'raw':_0x353f1d['options']?_0x353f1d[_0xbc66('0x18')][_0xbc66('0x19')]===undefined?!![]:![]:!![],'where':_0x353f1d['options']?_0x353f1d['options'][_0xbc66('0x1a')]||null:null,'attributes':_0x353f1d[_0xbc66('0x18')]?_0x353f1d['options']['attributes']||null:null,'limit':_0x353f1d[_0xbc66('0x18')]?_0x353f1d[_0xbc66('0x18')][_0xbc66('0x1b')]||null:null,'include':_0x353f1d['options']?_0x353f1d['options'][_0xbc66('0x1c')]?_[_0xbc66('0x1d')](_0x353f1d[_0xbc66('0x18')][_0xbc66('0x1c')],function(_0x36cf27){return{'model':db[_0x36cf27[_0xbc66('0x1e')]],'as':_0x36cf27['as'],'attributes':_0x36cf27[_0xbc66('0x1f')],'include':_0x36cf27[_0xbc66('0x1c')]?_[_0xbc66('0x1d')](_0x36cf27['include'],function(_0x4561d0){return{'model':db[_0x4561d0[_0xbc66('0x1e')]],'as':_0x4561d0['as'],'attributes':_0x4561d0[_0xbc66('0x1f')],'include':_0x4561d0[_0xbc66('0x1c')]?_[_0xbc66('0x1d')](_0x4561d0[_0xbc66('0x1c')],function(_0x33dbbc){return{'model':db[_0x33dbbc[_0xbc66('0x1e')]],'as':_0x33dbbc['as'],'attributes':_0x33dbbc[_0xbc66('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbc66('0xa')](function(_0x3109bd){logger[_0xbc66('0xb')](_0xbc66('0x15'),_0x353f1d);logger['debug'](_0xbc66('0x15'),_0x353f1d,JSON[_0xbc66('0xf')](_0x3109bd));_0x288f1c(_0x3109bd);})[_0xbc66('0x14')](function(_0x4d6abd){logger[_0xbc66('0x10')](_0xbc66('0x15'),_0x4d6abd[_0xbc66('0x12')],_0x353f1d);_0x5c5048(_0x1a6c03['error'](0x1f4,_0x4d6abd[_0xbc66('0x12')]));});});}; \ No newline at end of file +var _0x267e=['model','then','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','map','include'];(function(_0xd71a41,_0x59c071){var _0x2347e8=function(_0x341351){while(--_0x341351){_0xd71a41['push'](_0xd71a41['shift']());}};_0x2347e8(++_0x59c071);}(_0x267e,0xa2));var _0xe267=function(_0x36deb9,_0x18bc47){_0x36deb9=_0x36deb9-0x0;var _0x4a2f53=_0x267e[_0x36deb9];return _0x4a2f53;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe267('0x0'));var BPromise=require(_0xe267('0x1'));var rs=require(_0xe267('0x2'));var fs=require('fs');var Redis=require(_0xe267('0x3'));var db=require(_0xe267('0x4'))['db'];var utils=require(_0xe267('0x5'));var logger=require(_0xe267('0x6'))(_0xe267('0x7'));var config=require(_0xe267('0x8'));var jayson=require(_0xe267('0x9'));var client=jayson[_0xe267('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42b764,_0x1b2f17,_0x398ff1){return new BPromise(function(_0x53a7ce,_0x33930b){return client['request'](_0x42b764,_0x398ff1)['then'](function(_0xc2ae4c){logger[_0xe267('0xb')](_0xe267('0xc'),_0x1b2f17,_0xe267('0xd'));logger[_0xe267('0xe')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x1b2f17,_0xe267('0xd'),JSON[_0xe267('0xf')](_0xc2ae4c));if(_0xc2ae4c['error']){if(_0xc2ae4c[_0xe267('0x10')][_0xe267('0x11')]===0x1f4){logger['error'](_0xe267('0xc'),_0x1b2f17,_0xc2ae4c['error'][_0xe267('0x12')]);return _0x33930b(_0xc2ae4c[_0xe267('0x10')]['message']);}logger[_0xe267('0x10')]('MailServerIn,\x20%s,\x20%s',_0x1b2f17,_0xc2ae4c[_0xe267('0x10')]['message']);return _0x53a7ce(_0xc2ae4c['error'][_0xe267('0x12')]);}else{logger[_0xe267('0xb')](_0xe267('0xc'),_0x1b2f17,'request\x20sent');_0x53a7ce(_0xc2ae4c['result']['message']);}})[_0xe267('0x13')](function(_0x3dcac6){logger[_0xe267('0x10')](_0xe267('0xc'),_0x1b2f17,_0x3dcac6);_0x33930b(_0x3dcac6);});});}exports[_0xe267('0x14')]=function(_0x56d493){var _0x4097f3=this;return new Promise(function(_0x10efa4,_0x521d18){return db[_0xe267('0x15')][_0xe267('0x16')]({'raw':_0x56d493[_0xe267('0x17')]?_0x56d493[_0xe267('0x17')][_0xe267('0x18')]===undefined?!![]:![]:!![],'where':_0x56d493['options']?_0x56d493[_0xe267('0x17')][_0xe267('0x19')]||null:null,'attributes':_0x56d493['options']?_0x56d493[_0xe267('0x17')][_0xe267('0x1a')]||null:null,'limit':_0x56d493[_0xe267('0x17')]?_0x56d493[_0xe267('0x17')][_0xe267('0x1b')]||null:null,'include':_0x56d493['options']?_0x56d493['options']['include']?_[_0xe267('0x1c')](_0x56d493['options'][_0xe267('0x1d')],function(_0x3b6047){return{'model':db[_0x3b6047[_0xe267('0x1e')]],'as':_0x3b6047['as'],'attributes':_0x3b6047['attributes'],'include':_0x3b6047[_0xe267('0x1d')]?_[_0xe267('0x1c')](_0x3b6047['include'],function(_0x46f7b6){return{'model':db[_0x46f7b6['model']],'as':_0x46f7b6['as'],'attributes':_0x46f7b6[_0xe267('0x1a')],'include':_0x46f7b6[_0xe267('0x1d')]?_[_0xe267('0x1c')](_0x46f7b6['include'],function(_0xbb1fcb){return{'model':db[_0xbb1fcb[_0xe267('0x1e')]],'as':_0xbb1fcb['as'],'attributes':_0xbb1fcb['attributes']};}):[]};}):[]};}):[]:[]})[_0xe267('0x1f')](function(_0x43a296){logger[_0xe267('0xb')](_0xe267('0x14'),_0x56d493);logger[_0xe267('0xe')](_0xe267('0x14'),_0x56d493,JSON[_0xe267('0xf')](_0x43a296));_0x10efa4(_0x43a296);})[_0xe267('0x13')](function(_0x48fa82){logger[_0xe267('0x10')](_0xe267('0x14'),_0x48fa82[_0xe267('0x12')],_0x56d493);_0x521d18(_0x4097f3[_0xe267('0x10')](0x1f4,_0x48fa82['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 48372eb..82150aa 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 _0x5b64=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','/:id','create','update','delete','destroy'];(function(_0x467cfe,_0x41abba){var _0x3442f4=function(_0x2ee935){while(--_0x2ee935){_0x467cfe['push'](_0x467cfe['shift']());}};_0x3442f4(++_0x41abba);}(_0x5b64,0xd8));var _0x45b6=function(_0x4e449d,_0x117f16){_0x4e449d=_0x4e449d-0x0;var _0x4e5833=_0x5b64[_0x4e449d];return _0x4e5833;};'use strict';var multer=require(_0x45b6('0x0'));var util=require(_0x45b6('0x1'));var path=require(_0x45b6('0x2'));var timeout=require(_0x45b6('0x3'));var express=require(_0x45b6('0x4'));var router=express[_0x45b6('0x5')]();var auth=require(_0x45b6('0x6'));var interaction=require(_0x45b6('0x7'));var config=require(_0x45b6('0x8'));var controller=require(_0x45b6('0x9'));router[_0x45b6('0xa')]('/',auth[_0x45b6('0xb')](),controller[_0x45b6('0xc')]);router[_0x45b6('0xa')](_0x45b6('0xd'),auth[_0x45b6('0xb')](),controller['show']);router['post']('/',auth[_0x45b6('0xb')](),controller[_0x45b6('0xe')]);router['put'](_0x45b6('0xd'),auth[_0x45b6('0xb')](),controller[_0x45b6('0xf')]);router[_0x45b6('0x10')](_0x45b6('0xd'),auth[_0x45b6('0xb')](),controller[_0x45b6('0x11')]);module['exports']=router; \ No newline at end of file +var _0xbc7e=['express','Router','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','util','path','connect-timeout'];(function(_0x5f56f1,_0x1910ec){var _0xb614b2=function(_0x48cc44){while(--_0x48cc44){_0x5f56f1['push'](_0x5f56f1['shift']());}};_0xb614b2(++_0x1910ec);}(_0xbc7e,0xd5));var _0xebc7=function(_0x4b13ae,_0x29e5db){_0x4b13ae=_0x4b13ae-0x0;var _0x620ad5=_0xbc7e[_0x4b13ae];return _0x620ad5;};'use strict';var multer=require('multer');var util=require(_0xebc7('0x0'));var path=require(_0xebc7('0x1'));var timeout=require(_0xebc7('0x2'));var express=require(_0xebc7('0x3'));var router=express[_0xebc7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xebc7('0x5'));var config=require(_0xebc7('0x6'));var controller=require(_0xebc7('0x7'));router[_0xebc7('0x8')]('/',auth[_0xebc7('0x9')](),controller[_0xebc7('0xa')]);router['get'](_0xebc7('0xb'),auth[_0xebc7('0x9')](),controller[_0xebc7('0xc')]);router[_0xebc7('0xd')]('/',auth[_0xebc7('0x9')](),controller[_0xebc7('0xe')]);router['put'](_0xebc7('0xb'),auth[_0xebc7('0x9')](),controller[_0xebc7('0xf')]);router[_0xebc7('0x10')](_0xebc7('0xb'),auth[_0xebc7('0x9')](),controller['destroy']);module[_0xebc7('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index effbaf5..caaaa70 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 _0x5d59=['exports','STRING','INTEGER'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x5d59,0x15f));var _0x95d5=function(_0x161341,_0x1c054d){_0x161341=_0x161341-0x0;var _0x5e06c3=_0x5d59[_0x161341];return _0x5e06c3;};'use strict';var Sequelize=require('sequelize');module[_0x95d5('0x0')]={'description':{'type':Sequelize[_0x95d5('0x1')]},'host':{'type':Sequelize[_0x95d5('0x1')]},'user':{'type':Sequelize[_0x95d5('0x1')]},'pass':{'type':Sequelize[_0x95d5('0x1')]},'port':{'type':Sequelize[_0x95d5('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x95d5('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x82c4=['STRING','INTEGER','sequelize','exports'];(function(_0xff9427,_0x3093d7){var _0x3d734d=function(_0x5a86f3){while(--_0x5a86f3){_0xff9427['push'](_0xff9427['shift']());}};_0x3d734d(++_0x3093d7);}(_0x82c4,0x1ca));var _0x482c=function(_0x481844,_0x259b1f){_0x481844=_0x481844-0x0;var _0x2afc17=_0x82c4[_0x481844];return _0x2afc17;};'use strict';var Sequelize=require(_0x482c('0x0'));module[_0x482c('0x1')]={'description':{'type':Sequelize[_0x482c('0x2')]},'host':{'type':Sequelize[_0x482c('0x2')]},'user':{'type':Sequelize[_0x482c('0x2')]},'pass':{'type':Sequelize[_0x482c('0x2')]},'port':{'type':Sequelize[_0x482c('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x482c('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 58110ee..22fac5f 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 _0x23a5=['end','json','count','offset','Content-Range','apply','reject','then','error','stack','name','index','map','MailServerOut','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','update','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x23a5,0x108));var _0x523a=function(_0x30b6d3,_0xd02c1e){_0x30b6d3=_0x30b6d3-0x0;var _0x5c487b=_0x23a5[_0x30b6d3];return _0x5c487b;};'use strict';var pdf=require(_0x523a('0x0'));var emlformat=require(_0x523a('0x1'));var rimraf=require(_0x523a('0x2'));var zipdir=require(_0x523a('0x3'));var jsonpatch=require(_0x523a('0x4'));var rp=require('request-promise');var moment=require(_0x523a('0x5'));var BPromise=require(_0x523a('0x6'));var Mustache=require('mustache');var util=require(_0x523a('0x7'));var path=require(_0x523a('0x8'));var sox=require('sox');var csv=require(_0x523a('0x9'));var ejs=require(_0x523a('0xa'));var fs=require('fs');var _=require(_0x523a('0xb'));var squel=require(_0x523a('0xc'));var crypto=require('crypto');var jsforce=require(_0x523a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x523a('0x9'));var querystring=require(_0x523a('0xe'));var Papa=require(_0x523a('0xf'));var Redis=require(_0x523a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x523a('0x11'));var logger=require(_0x523a('0x12'))(_0x523a('0x13'));var utils=require('../../config/utils');var config=require(_0x523a('0x14'));var db=require(_0x523a('0x15'))['db'];function respondWithStatusCode(_0x175ad8,_0x7c6007){_0x7c6007=_0x7c6007||0xcc;return function(_0x1102b4){if(_0x1102b4){return _0x175ad8[_0x523a('0x16')](_0x7c6007);}return _0x175ad8[_0x523a('0x17')](_0x7c6007)[_0x523a('0x18')]();};}function respondWithResult(_0xdf0665,_0x102d92){_0x102d92=_0x102d92||0xc8;return function(_0x48c5cf){if(_0x48c5cf){return _0xdf0665[_0x523a('0x17')](_0x102d92)[_0x523a('0x19')](_0x48c5cf);}};}function respondWithFilteredResult(_0x5c224d,_0x33b1e6){return function(_0x55e418){if(_0x55e418){var _0x272af9=_0x55e418[_0x523a('0x1a')],_0x211742=_0x33b1e6[_0x523a('0x1b')],_0x38d035=_0x33b1e6['offset']+_0x33b1e6['limit'],_0xfffd7d;if(_0x38d035>=_0x272af9){_0x38d035=_0x272af9;_0xfffd7d=0xc8;}else{_0xfffd7d=0xce;}_0x5c224d['status'](_0xfffd7d);return _0x5c224d['set'](_0x523a('0x1c'),_0x211742+'-'+_0x38d035+'/'+_0x272af9)[_0x523a('0x19')](_0x55e418);}return null;};}function patchUpdates(_0x1e51c6){return function(_0x11d507){try{jsonpatch[_0x523a('0x1d')](_0x11d507,_0x1e51c6,!![]);}catch(_0x5df2a0){return BPromise[_0x523a('0x1e')](_0x5df2a0);}return _0x11d507['save']();};}function saveUpdates(_0x2aac66,_0x824b96){return function(_0xe4e0c9){if(_0xe4e0c9){return _0xe4e0c9['update'](_0x2aac66)['then'](function(_0x4632b3){return _0x4632b3;});}return null;};}function removeEntity(_0x37adeb,_0x4fc0f7){return function(_0x33f12d){if(_0x33f12d){return _0x33f12d['destroy']()[_0x523a('0x1f')](function(){_0x37adeb[_0x523a('0x17')](0xcc)[_0x523a('0x18')]();});}};}function handleEntityNotFound(_0x8521ac,_0x707c71){return function(_0x2c9362){if(!_0x2c9362){_0x8521ac[_0x523a('0x16')](0x194);}return _0x2c9362;};}function handleError(_0x248c43,_0x10d3ee){_0x10d3ee=_0x10d3ee||0x1f4;return function(_0x1cc23c){logger[_0x523a('0x20')](_0x1cc23c[_0x523a('0x21')]);if(_0x1cc23c[_0x523a('0x22')]){delete _0x1cc23c[_0x523a('0x22')];}_0x248c43[_0x523a('0x17')](_0x10d3ee)['send'](_0x1cc23c);};}exports[_0x523a('0x23')]=function(_0x19c65f,_0x3015f1){var _0x6060d6={},_0x37019b={},_0x10bfae={'count':0x0,'rows':[]};var _0x4cc4f2=_[_0x523a('0x24')](db[_0x523a('0x25')][_0x523a('0x26')],function(_0x11ca0e){return{'name':_0x11ca0e[_0x523a('0x27')],'type':_0x11ca0e['type'][_0x523a('0x28')]};});_0x37019b[_0x523a('0x29')]=_['map'](_0x4cc4f2,_0x523a('0x22'));_0x37019b[_0x523a('0x2a')]=_[_0x523a('0x2b')](_0x19c65f[_0x523a('0x2a')]);_0x37019b['filters']=_[_0x523a('0x2c')](_0x37019b[_0x523a('0x29')],_0x37019b[_0x523a('0x2a')]);_0x6060d6[_0x523a('0x2d')]=_['intersection'](_0x37019b['model'],qs[_0x523a('0x2e')](_0x19c65f[_0x523a('0x2a')][_0x523a('0x2e')]));_0x6060d6[_0x523a('0x2d')]=_0x6060d6[_0x523a('0x2d')][_0x523a('0x2f')]?_0x6060d6[_0x523a('0x2d')]:_0x37019b[_0x523a('0x29')];if(!_0x19c65f[_0x523a('0x2a')][_0x523a('0x30')](_0x523a('0x31'))){_0x6060d6[_0x523a('0x32')]=qs['limit'](_0x19c65f['query']['limit']);_0x6060d6['offset']=qs[_0x523a('0x1b')](_0x19c65f['query'][_0x523a('0x1b')]);}_0x6060d6[_0x523a('0x33')]=qs[_0x523a('0x34')](_0x19c65f[_0x523a('0x2a')][_0x523a('0x34')]);_0x6060d6[_0x523a('0x35')]=qs['filters'](_[_0x523a('0x36')](_0x19c65f[_0x523a('0x2a')],_0x37019b[_0x523a('0x37')]));if(_0x19c65f[_0x523a('0x2a')][_0x523a('0x38')]){_0x6060d6[_0x523a('0x35')]=_[_0x523a('0x39')](_0x6060d6[_0x523a('0x35')],{'$or':_[_0x523a('0x24')](_0x4cc4f2,function(_0x1aa838){if(_0x1aa838[_0x523a('0x3a')]!==_0x523a('0x3b')){var _0x425fa0={};_0x425fa0[_0x1aa838[_0x523a('0x22')]]={'$like':'%'+_0x19c65f['query'][_0x523a('0x38')]+'%'};return _0x425fa0;}})});}_0x6060d6=_[_0x523a('0x39')]({},_0x6060d6,_0x19c65f['options']);var _0x10eb6b={'where':_0x6060d6[_0x523a('0x35')]};return db[_0x523a('0x25')][_0x523a('0x1a')](_0x10eb6b)[_0x523a('0x1f')](function(_0x1984ad){_0x10bfae['count']=_0x1984ad;if(_0x19c65f[_0x523a('0x2a')][_0x523a('0x3c')]){_0x6060d6[_0x523a('0x3d')]=[{'all':!![]}];}return db[_0x523a('0x25')][_0x523a('0x3e')](_0x6060d6);})[_0x523a('0x1f')](function(_0x1e164d){_0x10bfae[_0x523a('0x3f')]=_0x1e164d;return _0x10bfae;})['then'](respondWithFilteredResult(_0x3015f1,_0x6060d6))[_0x523a('0x40')](handleError(_0x3015f1,null));};exports['show']=function(_0xc036c0,_0x26365b){var _0xd90cd8={'raw':!![],'where':{'id':_0xc036c0[_0x523a('0x41')]['id']}},_0x55c2d8={};_0x55c2d8['model']=_[_0x523a('0x2b')](db[_0x523a('0x25')][_0x523a('0x26')]);_0x55c2d8['query']=_['keys'](_0xc036c0[_0x523a('0x2a')]);_0x55c2d8['filters']=_[_0x523a('0x2c')](_0x55c2d8[_0x523a('0x29')],_0x55c2d8['query']);_0xd90cd8[_0x523a('0x2d')]=_[_0x523a('0x2c')](_0x55c2d8[_0x523a('0x29')],qs[_0x523a('0x2e')](_0xc036c0['query'][_0x523a('0x2e')]));_0xd90cd8[_0x523a('0x2d')]=_0xd90cd8['attributes']['length']?_0xd90cd8[_0x523a('0x2d')]:_0x55c2d8[_0x523a('0x29')];if(_0xc036c0[_0x523a('0x2a')][_0x523a('0x3c')]){_0xd90cd8[_0x523a('0x3d')]=[{'all':!![]}];}_0xd90cd8=_[_0x523a('0x39')]({},_0xd90cd8,_0xc036c0[_0x523a('0x42')]);return db[_0x523a('0x25')][_0x523a('0x43')](_0xd90cd8)[_0x523a('0x1f')](handleEntityNotFound(_0x26365b,null))[_0x523a('0x1f')](respondWithResult(_0x26365b,null))[_0x523a('0x40')](handleError(_0x26365b,null));};exports[_0x523a('0x44')]=function(_0xe6e333,_0x2d8466){return db['MailServerOut'][_0x523a('0x44')](_0xe6e333[_0x523a('0x45')],{})[_0x523a('0x1f')](respondWithResult(_0x2d8466,0xc9))[_0x523a('0x40')](handleError(_0x2d8466,null));};exports[_0x523a('0x46')]=function(_0x45174d,_0x2c062a){if(_0x45174d[_0x523a('0x45')]['id']){delete _0x45174d[_0x523a('0x45')]['id'];}return db[_0x523a('0x25')][_0x523a('0x43')]({'where':{'id':_0x45174d[_0x523a('0x41')]['id']}})[_0x523a('0x1f')](handleEntityNotFound(_0x2c062a,null))['then'](saveUpdates(_0x45174d[_0x523a('0x45')],null))['then'](respondWithResult(_0x2c062a,null))[_0x523a('0x40')](handleError(_0x2c062a,null));};exports[_0x523a('0x47')]=function(_0x3cd5a8,_0x13591e){return db['MailServerOut'][_0x523a('0x43')]({'where':{'id':_0x3cd5a8[_0x523a('0x41')]['id']}})[_0x523a('0x1f')](handleEntityNotFound(_0x13591e,null))[_0x523a('0x1f')](removeEntity(_0x13591e,null))[_0x523a('0x40')](handleError(_0x13591e,null));}; \ No newline at end of file +var _0xedf9=['count','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','MailServerOut','findAll','catch','show','keys','include','find','create','body','params','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/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json'];(function(_0x494107,_0x1daebd){var _0x416b3b=function(_0x2a66b7){while(--_0x2a66b7){_0x494107['push'](_0x494107['shift']());}};_0x416b3b(++_0x1daebd);}(_0xedf9,0x15d));var _0x9edf=function(_0x4666c5,_0x295a44){_0x4666c5=_0x4666c5-0x0;var _0x5c4eb6=_0xedf9[_0x4666c5];return _0x5c4eb6;};'use strict';var pdf=require(_0x9edf('0x0'));var emlformat=require(_0x9edf('0x1'));var rimraf=require(_0x9edf('0x2'));var zipdir=require(_0x9edf('0x3'));var jsonpatch=require(_0x9edf('0x4'));var rp=require(_0x9edf('0x5'));var moment=require(_0x9edf('0x6'));var BPromise=require(_0x9edf('0x7'));var Mustache=require(_0x9edf('0x8'));var util=require(_0x9edf('0x9'));var path=require(_0x9edf('0xa'));var sox=require('sox');var csv=require(_0x9edf('0xb'));var ejs=require(_0x9edf('0xc'));var fs=require('fs');var _=require(_0x9edf('0xd'));var squel=require('squel');var crypto=require(_0x9edf('0xe'));var jsforce=require(_0x9edf('0xf'));var deskjs=require(_0x9edf('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9edf('0x11'));var Papa=require(_0x9edf('0x12'));var Redis=require(_0x9edf('0x13'));var authService=require(_0x9edf('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x9edf('0x15'));var hardwareService=require(_0x9edf('0x16'));var logger=require(_0x9edf('0x17'))(_0x9edf('0x18'));var utils=require(_0x9edf('0x19'));var config=require(_0x9edf('0x1a'));var db=require(_0x9edf('0x1b'))['db'];function respondWithStatusCode(_0xee79f5,_0x3f36a3){_0x3f36a3=_0x3f36a3||0xcc;return function(_0x7c209f){if(_0x7c209f){return _0xee79f5[_0x9edf('0x1c')](_0x3f36a3);}return _0xee79f5[_0x9edf('0x1d')](_0x3f36a3)['end']();};}function respondWithResult(_0x509a61,_0x1666f3){_0x1666f3=_0x1666f3||0xc8;return function(_0x28a9ff){if(_0x28a9ff){return _0x509a61[_0x9edf('0x1d')](_0x1666f3)[_0x9edf('0x1e')](_0x28a9ff);}};}function respondWithFilteredResult(_0x512609,_0x2ee8ee){return function(_0x16a09a){if(_0x16a09a){var _0x4c3a17=_0x16a09a[_0x9edf('0x1f')],_0x45e808=_0x2ee8ee[_0x9edf('0x20')],_0x1a4d68=_0x2ee8ee['offset']+_0x2ee8ee[_0x9edf('0x21')],_0x241ec5;if(_0x1a4d68>=_0x4c3a17){_0x1a4d68=_0x4c3a17;_0x241ec5=0xc8;}else{_0x241ec5=0xce;}_0x512609[_0x9edf('0x1d')](_0x241ec5);return _0x512609['set']('Content-Range',_0x45e808+'-'+_0x1a4d68+'/'+_0x4c3a17)[_0x9edf('0x1e')](_0x16a09a);}return null;};}function patchUpdates(_0x9429a0){return function(_0x112dd3){try{jsonpatch[_0x9edf('0x22')](_0x112dd3,_0x9429a0,!![]);}catch(_0x355955){return BPromise[_0x9edf('0x23')](_0x355955);}return _0x112dd3[_0x9edf('0x24')]();};}function saveUpdates(_0x57eff1,_0x54ad52){return function(_0x454eee){if(_0x454eee){return _0x454eee[_0x9edf('0x25')](_0x57eff1)[_0x9edf('0x26')](function(_0x5bd4f8){return _0x5bd4f8;});}return null;};}function removeEntity(_0x380202,_0x4c871a){return function(_0x45e38e){if(_0x45e38e){return _0x45e38e[_0x9edf('0x27')]()[_0x9edf('0x26')](function(){_0x380202['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f1c55,_0x4c9195){return function(_0x1e2e69){if(!_0x1e2e69){_0x2f1c55[_0x9edf('0x1c')](0x194);}return _0x1e2e69;};}function handleError(_0x25fb62,_0x1a1f8b){_0x1a1f8b=_0x1a1f8b||0x1f4;return function(_0x25461e){logger[_0x9edf('0x28')](_0x25461e[_0x9edf('0x29')]);if(_0x25461e[_0x9edf('0x2a')]){delete _0x25461e['name'];}_0x25fb62[_0x9edf('0x1d')](_0x1a1f8b)[_0x9edf('0x2b')](_0x25461e);};}exports[_0x9edf('0x2c')]=function(_0x27337a,_0x2b95b9){var _0x4da485={},_0x22fe09={},_0x1183c4={'count':0x0,'rows':[]};var _0x513935=_['map'](db['MailServerOut'][_0x9edf('0x2d')],function(_0x287e1c){return{'name':_0x287e1c['fieldName'],'type':_0x287e1c[_0x9edf('0x2e')][_0x9edf('0x2f')]};});_0x22fe09[_0x9edf('0x30')]=_[_0x9edf('0x31')](_0x513935,'name');_0x22fe09[_0x9edf('0x32')]=_['keys'](_0x27337a[_0x9edf('0x32')]);_0x22fe09['filters']=_[_0x9edf('0x33')](_0x22fe09[_0x9edf('0x30')],_0x22fe09['query']);_0x4da485['attributes']=_[_0x9edf('0x33')](_0x22fe09['model'],qs[_0x9edf('0x34')](_0x27337a[_0x9edf('0x32')][_0x9edf('0x34')]));_0x4da485[_0x9edf('0x35')]=_0x4da485['attributes'][_0x9edf('0x36')]?_0x4da485[_0x9edf('0x35')]:_0x22fe09[_0x9edf('0x30')];if(!_0x27337a[_0x9edf('0x32')][_0x9edf('0x37')](_0x9edf('0x38'))){_0x4da485[_0x9edf('0x21')]=qs['limit'](_0x27337a[_0x9edf('0x32')][_0x9edf('0x21')]);_0x4da485[_0x9edf('0x20')]=qs[_0x9edf('0x20')](_0x27337a['query'][_0x9edf('0x20')]);}_0x4da485[_0x9edf('0x39')]=qs[_0x9edf('0x3a')](_0x27337a[_0x9edf('0x32')]['sort']);_0x4da485[_0x9edf('0x3b')]=qs[_0x9edf('0x3c')](_[_0x9edf('0x3d')](_0x27337a[_0x9edf('0x32')],_0x22fe09['filters']));if(_0x27337a[_0x9edf('0x32')][_0x9edf('0x3e')]){_0x4da485[_0x9edf('0x3b')]=_[_0x9edf('0x3f')](_0x4da485['where'],{'$or':_[_0x9edf('0x31')](_0x513935,function(_0x3a7bda){if(_0x3a7bda['type']!=='VIRTUAL'){var _0x2386dc={};_0x2386dc[_0x3a7bda[_0x9edf('0x2a')]]={'$like':'%'+_0x27337a[_0x9edf('0x32')]['filter']+'%'};return _0x2386dc;}})});}_0x4da485=_[_0x9edf('0x3f')]({},_0x4da485,_0x27337a[_0x9edf('0x40')]);var _0x333d0b={'where':_0x4da485[_0x9edf('0x3b')]};return db['MailServerOut'][_0x9edf('0x1f')](_0x333d0b)[_0x9edf('0x26')](function(_0x4b5e29){_0x1183c4[_0x9edf('0x1f')]=_0x4b5e29;if(_0x27337a[_0x9edf('0x32')][_0x9edf('0x41')]){_0x4da485['include']=[{'all':!![]}];}return db[_0x9edf('0x42')][_0x9edf('0x43')](_0x4da485);})[_0x9edf('0x26')](function(_0x283b73){_0x1183c4['rows']=_0x283b73;return _0x1183c4;})[_0x9edf('0x26')](respondWithFilteredResult(_0x2b95b9,_0x4da485))[_0x9edf('0x44')](handleError(_0x2b95b9,null));};exports[_0x9edf('0x45')]=function(_0x41211a,_0x441e08){var _0x4a285a={'raw':!![],'where':{'id':_0x41211a['params']['id']}},_0x23e184={};_0x23e184[_0x9edf('0x30')]=_[_0x9edf('0x46')](db[_0x9edf('0x42')][_0x9edf('0x2d')]);_0x23e184[_0x9edf('0x32')]=_['keys'](_0x41211a[_0x9edf('0x32')]);_0x23e184[_0x9edf('0x3c')]=_['intersection'](_0x23e184['model'],_0x23e184[_0x9edf('0x32')]);_0x4a285a[_0x9edf('0x35')]=_['intersection'](_0x23e184[_0x9edf('0x30')],qs[_0x9edf('0x34')](_0x41211a[_0x9edf('0x32')]['fields']));_0x4a285a[_0x9edf('0x35')]=_0x4a285a[_0x9edf('0x35')][_0x9edf('0x36')]?_0x4a285a[_0x9edf('0x35')]:_0x23e184[_0x9edf('0x30')];if(_0x41211a[_0x9edf('0x32')][_0x9edf('0x41')]){_0x4a285a[_0x9edf('0x47')]=[{'all':!![]}];}_0x4a285a=_[_0x9edf('0x3f')]({},_0x4a285a,_0x41211a[_0x9edf('0x40')]);return db[_0x9edf('0x42')][_0x9edf('0x48')](_0x4a285a)[_0x9edf('0x26')](handleEntityNotFound(_0x441e08,null))['then'](respondWithResult(_0x441e08,null))['catch'](handleError(_0x441e08,null));};exports[_0x9edf('0x49')]=function(_0x54895c,_0x3f80a3){return db[_0x9edf('0x42')][_0x9edf('0x49')](_0x54895c[_0x9edf('0x4a')],{})[_0x9edf('0x26')](respondWithResult(_0x3f80a3,0xc9))[_0x9edf('0x44')](handleError(_0x3f80a3,null));};exports[_0x9edf('0x25')]=function(_0x7fe5f3,_0x375cc0){if(_0x7fe5f3[_0x9edf('0x4a')]['id']){delete _0x7fe5f3[_0x9edf('0x4a')]['id'];}return db[_0x9edf('0x42')][_0x9edf('0x48')]({'where':{'id':_0x7fe5f3[_0x9edf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x375cc0,null))['then'](saveUpdates(_0x7fe5f3[_0x9edf('0x4a')],null))[_0x9edf('0x26')](respondWithResult(_0x375cc0,null))[_0x9edf('0x44')](handleError(_0x375cc0,null));};exports[_0x9edf('0x27')]=function(_0x4fb1f1,_0x123c5f){return db[_0x9edf('0x42')]['find']({'where':{'id':_0x4fb1f1[_0x9edf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x123c5f,null))[_0x9edf('0x26')](removeEntity(_0x123c5f,null))[_0x9edf('0x44')](handleError(_0x123c5f,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index e79ef9d..23a0199 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 _0x2675=['lodash','moment','bluebird','path','rimraf','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x26333b,_0x56470d){var _0x404306=function(_0x5b379e){while(--_0x5b379e){_0x26333b['push'](_0x26333b['shift']());}};_0x404306(++_0x56470d);}(_0x2675,0x75));var _0x5267=function(_0x23c7c7,_0x57d597){_0x23c7c7=_0x23c7c7-0x0;var _0x508f88=_0x2675[_0x23c7c7];return _0x508f88;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5267('0x1'));var BPromise=require(_0x5267('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5267('0x3'));var rimraf=require(_0x5267('0x4'));var config=require('../../config/environment');var attributes=require(_0x5267('0x5'));module[_0x5267('0x6')]=function(_0x4bd042,_0x10f92c){return _0x4bd042[_0x5267('0x7')](_0x5267('0x8'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda19=['exports','define','MailServerOut','mail_servers_out','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./mailServerOut.attributes'];(function(_0x1b202f,_0x54ec53){var _0x1cd268=function(_0x58bd49){while(--_0x58bd49){_0x1b202f['push'](_0x1b202f['shift']());}};_0x1cd268(++_0x54ec53);}(_0xda19,0xd5));var _0x9da1=function(_0x21d8de,_0x326e16){_0x21d8de=_0x21d8de-0x0;var _0x19f8e5=_0xda19[_0x21d8de];return _0x19f8e5;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var logger=require(_0x9da1('0x1'))('api');var moment=require(_0x9da1('0x2'));var BPromise=require('bluebird');var rp=require(_0x9da1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var attributes=require(_0x9da1('0x6'));module[_0x9da1('0x7')]=function(_0x156faf,_0x2dcbc6){return _0x156faf[_0x9da1('0x8')](_0x9da1('0x9'),attributes,{'tableName':_0x9da1('0xa'),'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 472e30e..8ec051c 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 _0x30f6=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x15920e,_0x5840b6){var _0x26d656=function(_0x17565c){while(--_0x17565c){_0x15920e['push'](_0x15920e['shift']());}};_0x26d656(++_0x5840b6);}(_0x30f6,0xf7));var _0x630f=function(_0xe836f8,_0x4206b6){_0xe836f8=_0xe836f8-0x0;var _0xf8fc22=_0x30f6[_0xe836f8];return _0xf8fc22;};'use strict';var _=require(_0x630f('0x0'));var util=require('util');var moment=require(_0x630f('0x1'));var BPromise=require(_0x630f('0x2'));var rs=require(_0x630f('0x3'));var fs=require('fs');var Redis=require(_0x630f('0x4'));var db=require(_0x630f('0x5'))['db'];var utils=require(_0x630f('0x6'));var logger=require('../../config/logger')(_0x630f('0x7'));var config=require(_0x630f('0x8'));var jayson=require(_0x630f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1e2658,_0x4bdd00,_0x417136){return new BPromise(function(_0x58b854,_0x37a6d6){return client[_0x630f('0xa')](_0x1e2658,_0x417136)[_0x630f('0xb')](function(_0x331da4){logger[_0x630f('0xc')](_0x630f('0xd'),_0x4bdd00,_0x630f('0xe'));logger[_0x630f('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x4bdd00,_0x630f('0xe'),JSON[_0x630f('0x10')](_0x331da4));if(_0x331da4[_0x630f('0x11')]){if(_0x331da4[_0x630f('0x11')]['code']===0x1f4){logger['error'](_0x630f('0xd'),_0x4bdd00,_0x331da4[_0x630f('0x11')][_0x630f('0x12')]);return _0x37a6d6(_0x331da4['error'][_0x630f('0x12')]);}logger[_0x630f('0x11')](_0x630f('0xd'),_0x4bdd00,_0x331da4[_0x630f('0x11')]['message']);return _0x58b854(_0x331da4['error'][_0x630f('0x12')]);}else{logger['info'](_0x630f('0xd'),_0x4bdd00,_0x630f('0xe'));_0x58b854(_0x331da4[_0x630f('0x13')]['message']);}})[_0x630f('0x14')](function(_0x55ddfa){logger[_0x630f('0x11')]('MailServerOut,\x20%s,\x20%s',_0x4bdd00,_0x55ddfa);_0x37a6d6(_0x55ddfa);});});} \ No newline at end of file +var _0x8d34=['message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1915b8,_0x220304){var _0x4516f0=function(_0x47c61a){while(--_0x47c61a){_0x1915b8['push'](_0x1915b8['shift']());}};_0x4516f0(++_0x220304);}(_0x8d34,0x116));var _0x48d3=function(_0xc487b9,_0x13b645){_0xc487b9=_0xc487b9-0x0;var _0x239f28=_0x8d34[_0xc487b9];return _0x239f28;};'use strict';var _=require(_0x48d3('0x0'));var util=require('util');var moment=require(_0x48d3('0x1'));var BPromise=require(_0x48d3('0x2'));var rs=require(_0x48d3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x48d3('0x4'))['db'];var utils=require(_0x48d3('0x5'));var logger=require('../../config/logger')(_0x48d3('0x6'));var config=require(_0x48d3('0x7'));var jayson=require(_0x48d3('0x8'));var client=jayson[_0x48d3('0x9')][_0x48d3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x153aee,_0x205048,_0xf6c3e6){return new BPromise(function(_0x1bd701,_0xb7aa95){return client[_0x48d3('0xb')](_0x153aee,_0xf6c3e6)[_0x48d3('0xc')](function(_0x1fdf08){logger[_0x48d3('0xd')](_0x48d3('0xe'),_0x205048,_0x48d3('0xf'));logger[_0x48d3('0x10')](_0x48d3('0x11'),_0x205048,_0x48d3('0xf'),JSON[_0x48d3('0x12')](_0x1fdf08));if(_0x1fdf08[_0x48d3('0x13')]){if(_0x1fdf08[_0x48d3('0x13')][_0x48d3('0x14')]===0x1f4){logger['error'](_0x48d3('0xe'),_0x205048,_0x1fdf08[_0x48d3('0x13')][_0x48d3('0x15')]);return _0xb7aa95(_0x1fdf08['error'][_0x48d3('0x15')]);}logger[_0x48d3('0x13')](_0x48d3('0xe'),_0x205048,_0x1fdf08['error'][_0x48d3('0x15')]);return _0x1bd701(_0x1fdf08[_0x48d3('0x13')][_0x48d3('0x15')]);}else{logger[_0x48d3('0xd')]('MailServerOut,\x20%s,\x20%s',_0x205048,_0x48d3('0xf'));_0x1bd701(_0x1fdf08[_0x48d3('0x16')][_0x48d3('0x15')]);}})['catch'](function(_0x3ed4b0){logger[_0x48d3('0x13')]('MailServerOut,\x20%s,\x20%s',_0x205048,_0x3ed4b0);_0xb7aa95(_0x3ed4b0);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 53147b4..117784b 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 _0xe3f1=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','destroy','multer','util','connect-timeout','express'];(function(_0x41ec78,_0x5ae60){var _0x42b8d2=function(_0xd58d17){while(--_0xd58d17){_0x41ec78['push'](_0x41ec78['shift']());}};_0x42b8d2(++_0x5ae60);}(_0xe3f1,0x106));var _0x1e3f=function(_0x2327d2,_0x184a0e){_0x2327d2=_0x2327d2-0x0;var _0x506120=_0xe3f1[_0x2327d2];return _0x506120;};'use strict';var multer=require(_0x1e3f('0x0'));var util=require(_0x1e3f('0x1'));var path=require('path');var timeout=require(_0x1e3f('0x2'));var express=require(_0x1e3f('0x3'));var router=express[_0x1e3f('0x4')]();var auth=require(_0x1e3f('0x5'));var interaction=require(_0x1e3f('0x6'));var config=require(_0x1e3f('0x7'));var controller=require(_0x1e3f('0x8'));router[_0x1e3f('0x9')]('/',auth[_0x1e3f('0xa')](),controller[_0x1e3f('0xb')]);router[_0x1e3f('0x9')](_0x1e3f('0xc'),auth[_0x1e3f('0xa')](),controller[_0x1e3f('0xd')]);router[_0x1e3f('0x9')](_0x1e3f('0xe'),auth['isAuthenticated'](),controller[_0x1e3f('0xf')]);router[_0x1e3f('0x10')]('/',auth[_0x1e3f('0xa')](),controller[_0x1e3f('0x11')]);router['put'](_0x1e3f('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x1e3f('0xe'),auth[_0x1e3f('0xa')](),controller[_0x1e3f('0x12')]);module['exports']=router; \ No newline at end of file +var _0x516e=['/:id','post','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3b29ce,_0x13de5f){var _0x57b233=function(_0x5e4248){while(--_0x5e4248){_0x3b29ce['push'](_0x3b29ce['shift']());}};_0x57b233(++_0x13de5f);}(_0x516e,0x66));var _0xe516=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x516e[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0xe516('0x0'));var util=require(_0xe516('0x1'));var path=require(_0xe516('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe516('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xe516('0x4'));var config=require(_0xe516('0x5'));var controller=require(_0xe516('0x6'));router[_0xe516('0x7')]('/',auth[_0xe516('0x8')](),controller[_0xe516('0x9')]);router[_0xe516('0x7')](_0xe516('0xa'),auth['isAuthenticated'](),controller[_0xe516('0xb')]);router['get'](_0xe516('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xe516('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe516('0xe')]('/:id',auth[_0xe516('0x8')](),controller[_0xe516('0xf')]);router[_0xe516('0x10')](_0xe516('0xc'),auth[_0xe516('0x8')](),controller[_0xe516('0x11')]);module[_0xe516('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index b2d3f91..d5af57a 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 _0xe056=['name','STRING'];(function(_0x4fa166,_0x58b7fb){var _0x5dd974=function(_0x342886){while(--_0x342886){_0x4fa166['push'](_0x4fa166['shift']());}};_0x5dd974(++_0x58b7fb);}(_0xe056,0xdb));var _0x6e05=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0xe056[_0x2706da];return _0x3ba87e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6e05('0x0')],'unique':_0x6e05('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6e05('0x0')]}}; \ No newline at end of file +var _0x751c=['sequelize','exports','STRING'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x751c,0x69));var _0xc751=function(_0x276254,_0x4dc72e){_0x276254=_0x276254-0x0;var _0x88693e=_0x751c[_0x276254];return _0x88693e;};'use strict';var Sequelize=require(_0xc751('0x0'));module[_0xc751('0x1')]={'name':{'type':Sequelize[_0xc751('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc751('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 8ea9883..2609c47 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 _0x814b=['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','MailSubstatus','options','find','create','body','params','describe','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','destroy','then','error','stack','name','send'];(function(_0x3cdcfc,_0x5c259b){var _0x4b7c43=function(_0xbf5619){while(--_0xbf5619){_0x3cdcfc['push'](_0x3cdcfc['shift']());}};_0x4b7c43(++_0x5c259b);}(_0x814b,0x1a2));var _0xb814=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0x814b[_0x119280];return _0x481797;};'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['MailSubstatus'][_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')]));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['MailSubstatus'][_0xb814('0x1e')](_0x4d308a)[_0xb814('0x27')](function(_0x38cdc2){_0x5a6291[_0xb814('0x1e')]=_0x38cdc2;if(_0x32ed56['query']['includeAll']){_0x3f0150[_0xb814('0x41')]=[{'all':!![]}];}return db['MailSubstatus'][_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));};exports[_0xb814('0x4c')]=function(_0x388324,_0xf27a6e){return db['MailSubstatus'][_0xb814('0x4c')]()['then'](respondWithResult(_0xf27a6e,null))[_0xb814('0x44')](handleError(_0xf27a6e,null));}; \ No newline at end of file +var _0x4c60=['papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','save','update','then','destroy','error','name','send','index','map','MailSubstatus','fieldName','type','key','model','filters','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','findAll','rows','catch','params','keys','rawAttributes','options','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x4c60,0xc1));var _0x04c6=function(_0x194f8d,_0x1cc100){_0x194f8d=_0x194f8d-0x0;var _0x317b6c=_0x4c60[_0x194f8d];return _0x317b6c;};'use strict';var pdf=require(_0x04c6('0x0'));var emlformat=require(_0x04c6('0x1'));var rimraf=require(_0x04c6('0x2'));var zipdir=require(_0x04c6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x04c6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x04c6('0x5'));var sox=require(_0x04c6('0x6'));var csv=require(_0x04c6('0x7'));var ejs=require(_0x04c6('0x8'));var fs=require('fs');var _=require(_0x04c6('0x9'));var squel=require(_0x04c6('0xa'));var crypto=require(_0x04c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04c6('0xc'));var toCsv=require(_0x04c6('0x7'));var querystring=require(_0x04c6('0xd'));var Papa=require(_0x04c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04c6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04c6('0x10'))(_0x04c6('0x11'));var utils=require('../../config/utils');var config=require(_0x04c6('0x12'));var db=require(_0x04c6('0x13'))['db'];function respondWithStatusCode(_0x119187,_0x4e5e6){_0x4e5e6=_0x4e5e6||0xcc;return function(_0x52cdcf){if(_0x52cdcf){return _0x119187[_0x04c6('0x14')](_0x4e5e6);}return _0x119187[_0x04c6('0x15')](_0x4e5e6)[_0x04c6('0x16')]();};}function respondWithResult(_0x56422a,_0x12d1c5){_0x12d1c5=_0x12d1c5||0xc8;return function(_0x15cbe0){if(_0x15cbe0){return _0x56422a[_0x04c6('0x15')](_0x12d1c5)[_0x04c6('0x17')](_0x15cbe0);}};}function respondWithFilteredResult(_0x4760f8,_0x19a26f){return function(_0x1cd963){if(_0x1cd963){var _0x3d46a9=_0x1cd963[_0x04c6('0x18')],_0x5a5a66=_0x19a26f[_0x04c6('0x19')],_0x31edf9=_0x19a26f[_0x04c6('0x19')]+_0x19a26f[_0x04c6('0x1a')],_0xa2bc92;if(_0x31edf9>=_0x3d46a9){_0x31edf9=_0x3d46a9;_0xa2bc92=0xc8;}else{_0xa2bc92=0xce;}_0x4760f8[_0x04c6('0x15')](_0xa2bc92);return _0x4760f8[_0x04c6('0x1b')]('Content-Range',_0x5a5a66+'-'+_0x31edf9+'/'+_0x3d46a9)[_0x04c6('0x17')](_0x1cd963);}return null;};}function patchUpdates(_0x13e472){return function(_0xa70fd2){try{jsonpatch['apply'](_0xa70fd2,_0x13e472,!![]);}catch(_0x4cef4e){return BPromise['reject'](_0x4cef4e);}return _0xa70fd2[_0x04c6('0x1c')]();};}function saveUpdates(_0xb997e0,_0x50dd61){return function(_0x5a5e9e){if(_0x5a5e9e){return _0x5a5e9e[_0x04c6('0x1d')](_0xb997e0)[_0x04c6('0x1e')](function(_0x3cd448){return _0x3cd448;});}return null;};}function removeEntity(_0x5daa22,_0x33a0f7){return function(_0x13f2dc){if(_0x13f2dc){return _0x13f2dc[_0x04c6('0x1f')]()['then'](function(){_0x5daa22[_0x04c6('0x15')](0xcc)[_0x04c6('0x16')]();});}};}function handleEntityNotFound(_0x562491,_0x54a8b0){return function(_0x4c8d72){if(!_0x4c8d72){_0x562491[_0x04c6('0x14')](0x194);}return _0x4c8d72;};}function handleError(_0x3a2014,_0xd5828d){_0xd5828d=_0xd5828d||0x1f4;return function(_0x115e35){logger[_0x04c6('0x20')](_0x115e35['stack']);if(_0x115e35['name']){delete _0x115e35[_0x04c6('0x21')];}_0x3a2014[_0x04c6('0x15')](_0xd5828d)[_0x04c6('0x22')](_0x115e35);};}exports[_0x04c6('0x23')]=function(_0x4f256f,_0x1f5aaf){var _0x47c69a={},_0x1d0d3f={},_0x165cb5={'count':0x0,'rows':[]};var _0x4e00fe=_[_0x04c6('0x24')](db[_0x04c6('0x25')]['rawAttributes'],function(_0x5c9003){return{'name':_0x5c9003[_0x04c6('0x26')],'type':_0x5c9003[_0x04c6('0x27')][_0x04c6('0x28')]};});_0x1d0d3f[_0x04c6('0x29')]=_[_0x04c6('0x24')](_0x4e00fe,_0x04c6('0x21'));_0x1d0d3f['query']=_['keys'](_0x4f256f['query']);_0x1d0d3f[_0x04c6('0x2a')]=_['intersection'](_0x1d0d3f[_0x04c6('0x29')],_0x1d0d3f[_0x04c6('0x2b')]);_0x47c69a['attributes']=_[_0x04c6('0x2c')](_0x1d0d3f[_0x04c6('0x29')],qs[_0x04c6('0x2d')](_0x4f256f[_0x04c6('0x2b')]['fields']));_0x47c69a[_0x04c6('0x2e')]=_0x47c69a[_0x04c6('0x2e')][_0x04c6('0x2f')]?_0x47c69a[_0x04c6('0x2e')]:_0x1d0d3f[_0x04c6('0x29')];if(!_0x4f256f[_0x04c6('0x2b')][_0x04c6('0x30')](_0x04c6('0x31'))){_0x47c69a[_0x04c6('0x1a')]=qs[_0x04c6('0x1a')](_0x4f256f[_0x04c6('0x2b')][_0x04c6('0x1a')]);_0x47c69a[_0x04c6('0x19')]=qs[_0x04c6('0x19')](_0x4f256f[_0x04c6('0x2b')]['offset']);}_0x47c69a[_0x04c6('0x32')]=qs[_0x04c6('0x33')](_0x4f256f[_0x04c6('0x2b')][_0x04c6('0x33')]);_0x47c69a['where']=qs[_0x04c6('0x2a')](_[_0x04c6('0x34')](_0x4f256f['query'],_0x1d0d3f['filters']));if(_0x4f256f['query'][_0x04c6('0x35')]){_0x47c69a[_0x04c6('0x36')]=_['merge'](_0x47c69a[_0x04c6('0x36')],{'$or':_['map'](_0x4e00fe,function(_0x15c270){if(_0x15c270[_0x04c6('0x27')]!==_0x04c6('0x37')){var _0x2b28cd={};_0x2b28cd[_0x15c270['name']]={'$like':'%'+_0x4f256f['query'][_0x04c6('0x35')]+'%'};return _0x2b28cd;}})});}_0x47c69a=_[_0x04c6('0x38')]({},_0x47c69a,_0x4f256f['options']);var _0x3f4fad={'where':_0x47c69a['where']};return db['MailSubstatus'][_0x04c6('0x18')](_0x3f4fad)['then'](function(_0x181d3f){_0x165cb5[_0x04c6('0x18')]=_0x181d3f;if(_0x4f256f['query'][_0x04c6('0x39')]){_0x47c69a['include']=[{'all':!![]}];}return db[_0x04c6('0x25')][_0x04c6('0x3a')](_0x47c69a);})[_0x04c6('0x1e')](function(_0x120238){_0x165cb5[_0x04c6('0x3b')]=_0x120238;return _0x165cb5;})['then'](respondWithFilteredResult(_0x1f5aaf,_0x47c69a))[_0x04c6('0x3c')](handleError(_0x1f5aaf,null));};exports['show']=function(_0x74f1d1,_0x533608){var _0x1f7ead={'raw':!![],'where':{'id':_0x74f1d1[_0x04c6('0x3d')]['id']}},_0xc31731={};_0xc31731[_0x04c6('0x29')]=_[_0x04c6('0x3e')](db[_0x04c6('0x25')][_0x04c6('0x3f')]);_0xc31731['query']=_[_0x04c6('0x3e')](_0x74f1d1['query']);_0xc31731[_0x04c6('0x2a')]=_['intersection'](_0xc31731['model'],_0xc31731[_0x04c6('0x2b')]);_0x1f7ead['attributes']=_[_0x04c6('0x2c')](_0xc31731[_0x04c6('0x29')],qs[_0x04c6('0x2d')](_0x74f1d1['query'][_0x04c6('0x2d')]));_0x1f7ead[_0x04c6('0x2e')]=_0x1f7ead[_0x04c6('0x2e')][_0x04c6('0x2f')]?_0x1f7ead[_0x04c6('0x2e')]:_0xc31731[_0x04c6('0x29')];if(_0x74f1d1[_0x04c6('0x2b')]['includeAll']){_0x1f7ead['include']=[{'all':!![]}];}_0x1f7ead=_[_0x04c6('0x38')]({},_0x1f7ead,_0x74f1d1[_0x04c6('0x40')]);return db[_0x04c6('0x25')]['find'](_0x1f7ead)[_0x04c6('0x1e')](handleEntityNotFound(_0x533608,null))[_0x04c6('0x1e')](respondWithResult(_0x533608,null))[_0x04c6('0x3c')](handleError(_0x533608,null));};exports['create']=function(_0x4c9942,_0x56c7e6){return db[_0x04c6('0x25')][_0x04c6('0x41')](_0x4c9942['body'],{})[_0x04c6('0x1e')](respondWithResult(_0x56c7e6,0xc9))[_0x04c6('0x3c')](handleError(_0x56c7e6,null));};exports[_0x04c6('0x1d')]=function(_0x4ef366,_0x392983){if(_0x4ef366[_0x04c6('0x42')]['id']){delete _0x4ef366['body']['id'];}return db[_0x04c6('0x25')][_0x04c6('0x43')]({'where':{'id':_0x4ef366[_0x04c6('0x3d')]['id']}})[_0x04c6('0x1e')](handleEntityNotFound(_0x392983,null))['then'](saveUpdates(_0x4ef366[_0x04c6('0x42')],null))[_0x04c6('0x1e')](respondWithResult(_0x392983,null))[_0x04c6('0x3c')](handleError(_0x392983,null));};exports[_0x04c6('0x1f')]=function(_0x5155aa,_0x192437){return db[_0x04c6('0x25')][_0x04c6('0x43')]({'where':{'id':_0x5155aa[_0x04c6('0x3d')]['id']}})['then'](handleEntityNotFound(_0x192437,null))[_0x04c6('0x1e')](removeEntity(_0x192437,null))[_0x04c6('0x3c')](handleError(_0x192437,null));};exports[_0x04c6('0x44')]=function(_0x489361,_0x3119f0){return db[_0x04c6('0x25')][_0x04c6('0x44')]()[_0x04c6('0x1e')](respondWithResult(_0x3119f0,null))[_0x04c6('0x3c')](handleError(_0x3119f0,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index b4c7fe4..0139c28 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 _0x0b0e=['path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x400888,_0x47a302){var _0x417fe6=function(_0x22d0e0){while(--_0x22d0e0){_0x400888['push'](_0x400888['shift']());}};_0x417fe6(++_0x47a302);}(_0x0b0e,0x187));var _0xe0b0=function(_0x56825b,_0x172b8d){_0x56825b=_0x56825b-0x0;var _0x69ce77=_0x0b0e[_0x56825b];return _0x69ce77;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var logger=require(_0xe0b0('0x1'))('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var fs=require('fs');var path=require(_0xe0b0('0x5'));var rimraf=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var attributes=require(_0xe0b0('0x8'));module[_0xe0b0('0x9')]=function(_0x30e20d,_0x28e40f){return _0x30e20d[_0xe0b0('0xa')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef0f=['moment','request-promise','path','rimraf','./mailSubstatus.attributes','exports','define','MailSubstatus','lodash','../../config/logger','api'];(function(_0x348021,_0x24fc80){var _0x426682=function(_0x573730){while(--_0x573730){_0x348021['push'](_0x348021['shift']());}};_0x426682(++_0x24fc80);}(_0xef0f,0x168));var _0xfef0=function(_0x6fc29b,_0x3e1bcb){_0x6fc29b=_0x6fc29b-0x0;var _0xe7d8c1=_0xef0f[_0x6fc29b];return _0xe7d8c1;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var logger=require(_0xfef0('0x1'))(_0xfef0('0x2'));var moment=require(_0xfef0('0x3'));var BPromise=require('bluebird');var rp=require(_0xfef0('0x4'));var fs=require('fs');var path=require(_0xfef0('0x5'));var rimraf=require(_0xfef0('0x6'));var config=require('../../config/environment');var attributes=require(_0xfef0('0x7'));module[_0xfef0('0x8')]=function(_0x2697df,_0x315a8c){return _0x2697df[_0xfef0('0x9')](_0xfef0('0xa'),attributes,{'tableName':'mail_substatuses','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 69095d4..07f6e08 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 _0x702d=['stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x59d471,_0x2b1e92){var _0x5e23b1=function(_0x55c456){while(--_0x55c456){_0x59d471['push'](_0x59d471['shift']());}};_0x5e23b1(++_0x2b1e92);}(_0x702d,0x147));var _0xd702=function(_0x4772bf,_0x6aa348){_0x4772bf=_0x4772bf-0x0;var _0x43c067=_0x702d[_0x4772bf];return _0x43c067;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var moment=require(_0xd702('0x2'));var BPromise=require(_0xd702('0x3'));var rs=require(_0xd702('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd702('0x5'))['db'];var utils=require(_0xd702('0x6'));var logger=require(_0xd702('0x7'))(_0xd702('0x8'));var config=require('../../config/environment');var jayson=require(_0xd702('0x9'));var client=jayson['client'][_0xd702('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a2c03,_0xf4bf4f,_0x5af246){return new BPromise(function(_0x12bb75,_0x53bd02){return client[_0xd702('0xb')](_0x3a2c03,_0x5af246)[_0xd702('0xc')](function(_0x907a9f){logger[_0xd702('0xd')](_0xd702('0xe'),_0xf4bf4f,_0xd702('0xf'));logger[_0xd702('0x10')](_0xd702('0x11'),_0xf4bf4f,_0xd702('0xf'),JSON[_0xd702('0x12')](_0x907a9f));if(_0x907a9f['error']){if(_0x907a9f['error'][_0xd702('0x13')]===0x1f4){logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x907a9f['error'][_0xd702('0x15')]);return _0x53bd02(_0x907a9f[_0xd702('0x14')][_0xd702('0x15')]);}logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x907a9f[_0xd702('0x14')]['message']);return _0x12bb75(_0x907a9f[_0xd702('0x14')][_0xd702('0x15')]);}else{logger['info'](_0xd702('0xe'),_0xf4bf4f,'request\x20sent');_0x12bb75(_0x907a9f[_0xd702('0x16')][_0xd702('0x15')]);}})['catch'](function(_0x2ba791){logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x2ba791);_0x53bd02(_0x2ba791);});});} \ No newline at end of file +var _0xee5b=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','ioredis'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xee5b,0x1f4));var _0xbee5=function(_0x1eecec,_0x43da0f){_0x1eecec=_0x1eecec-0x0;var _0x41b74c=_0xee5b[_0x1eecec];return _0x41b74c;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var moment=require(_0xbee5('0x1'));var BPromise=require(_0xbee5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbee5('0x3'));var db=require(_0xbee5('0x4'))['db'];var utils=require(_0xbee5('0x5'));var logger=require(_0xbee5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbee5('0x7'));var client=jayson[_0xbee5('0x8')][_0xbee5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x804ab8,_0x4f5065,_0x5505e3){return new BPromise(function(_0x53d5b9,_0x5baf5c){return client['request'](_0x804ab8,_0x5505e3)[_0xbee5('0xa')](function(_0x7dda04){logger[_0xbee5('0xb')](_0xbee5('0xc'),_0x4f5065,'request\x20sent');logger[_0xbee5('0xd')](_0xbee5('0xe'),_0x4f5065,_0xbee5('0xf'),JSON[_0xbee5('0x10')](_0x7dda04));if(_0x7dda04[_0xbee5('0x11')]){if(_0x7dda04[_0xbee5('0x11')][_0xbee5('0x12')]===0x1f4){logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error'][_0xbee5('0x13')]);return _0x5baf5c(_0x7dda04['error'][_0xbee5('0x13')]);}logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error']['message']);return _0x53d5b9(_0x7dda04[_0xbee5('0x11')]['message']);}else{logger[_0xbee5('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x4f5065,_0xbee5('0xf'));_0x53d5b9(_0x7dda04[_0xbee5('0x14')][_0xbee5('0x13')]);}})['catch'](function(_0x27e034){logger[_0xbee5('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x4f5065,_0x27e034);_0x5baf5c(_0x27e034);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index f9574fc..f82c7f6 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 _0xbdec=['describe','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x6ff984,_0x52fbd1){var _0x1b8400=function(_0x15ce8c){while(--_0x15ce8c){_0x6ff984['push'](_0x6ff984['shift']());}};_0x1b8400(++_0x52fbd1);}(_0xbdec,0x198));var _0xcbde=function(_0x2934e9,_0x562fe1){_0x2934e9=_0x2934e9-0x0;var _0x813f77=_0xbdec[_0x2934e9];return _0x813f77;};'use strict';var multer=require('multer');var util=require(_0xcbde('0x0'));var path=require(_0xcbde('0x1'));var timeout=require(_0xcbde('0x2'));var express=require(_0xcbde('0x3'));var router=express[_0xcbde('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xcbde('0x5'));var config=require(_0xcbde('0x6'));var controller=require(_0xcbde('0x7'));router[_0xcbde('0x8')]('/',auth[_0xcbde('0x9')](),controller[_0xcbde('0xa')]);router[_0xcbde('0x8')](_0xcbde('0xb'),auth[_0xcbde('0x9')](),controller[_0xcbde('0xc')]);router[_0xcbde('0x8')](_0xcbde('0xd'),auth[_0xcbde('0x9')](),controller[_0xcbde('0xe')]);router[_0xcbde('0xf')]('/',auth['isAuthenticated'](),controller[_0xcbde('0x10')]);router[_0xcbde('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xcbde('0x12')]);router[_0xcbde('0x13')](_0xcbde('0xd'),auth[_0xcbde('0x9')](),controller['destroy']);module[_0xcbde('0x14')]=router; \ No newline at end of file +var _0x7bcb=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','post','create','/:id','update','delete','exports','util','path','connect-timeout'];(function(_0x2fb866,_0x59bc0c){var _0x5d310f=function(_0x13bf75){while(--_0x13bf75){_0x2fb866['push'](_0x2fb866['shift']());}};_0x5d310f(++_0x59bc0c);}(_0x7bcb,0x166));var _0xb7bc=function(_0x1bd3b2,_0x14d3b7){_0x1bd3b2=_0x1bd3b2-0x0;var _0x2b95bc=_0x7bcb[_0x1bd3b2];return _0x2b95bc;};'use strict';var multer=require('multer');var util=require(_0xb7bc('0x0'));var path=require(_0xb7bc('0x1'));var timeout=require(_0xb7bc('0x2'));var express=require(_0xb7bc('0x3'));var router=express[_0xb7bc('0x4')]();var auth=require(_0xb7bc('0x5'));var interaction=require(_0xb7bc('0x6'));var config=require(_0xb7bc('0x7'));var controller=require('./mailTransferReport.controller');router[_0xb7bc('0x8')]('/',auth[_0xb7bc('0x9')](),controller[_0xb7bc('0xa')]);router['get']('/describe',auth[_0xb7bc('0x9')](),controller[_0xb7bc('0xb')]);router[_0xb7bc('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xb7bc('0xc')]);router[_0xb7bc('0xd')]('/',auth[_0xb7bc('0x9')](),controller[_0xb7bc('0xe')]);router['put'](_0xb7bc('0xf'),auth[_0xb7bc('0x9')](),controller[_0xb7bc('0x10')]);router[_0xb7bc('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xb7bc('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 a483e1f..38a8168 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 _0x88bd=['agent','queue','DATE','NOW','moment','sequelize','STRING'];(function(_0x401684,_0x2ecbdc){var _0x535d35=function(_0x492ae3){while(--_0x492ae3){_0x401684['push'](_0x401684['shift']());}};_0x535d35(++_0x2ecbdc);}(_0x88bd,0xf2));var _0xd88b=function(_0x2dfaad,_0x4ce5b7){_0x2dfaad=_0x2dfaad-0x0;var _0x1a311d=_0x88bd[_0x2dfaad];return _0x1a311d;};'use strict';var moment=require(_0xd88b('0x0'));var Sequelize=require(_0xd88b('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xd88b('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0xd88b('0x3'),_0xd88b('0x4')),'allowNull':![],'defaultValue':_0xd88b('0x4')},'transferredAt':{'type':Sequelize[_0xd88b('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xd88b('0x6')]}}; \ No newline at end of file +var _0x2020=['sequelize','STRING','ENUM','account','agent','queue','DATE','moment'];(function(_0x350d9a,_0x48946a){var _0xe37b93=function(_0x47e954){while(--_0x47e954){_0x350d9a['push'](_0x350d9a['shift']());}};_0xe37b93(++_0x48946a);}(_0x2020,0xb7));var _0x0202=function(_0x567484,_0x5e3d79){_0x567484=_0x567484-0x0;var _0x212acb=_0x2020[_0x567484];return _0x212acb;};'use strict';var moment=require(_0x0202('0x0'));var Sequelize=require(_0x0202('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x0202('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0202('0x3')](_0x0202('0x4'),_0x0202('0x5'),_0x0202('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x0202('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index c81694a..496e1ff 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 _0x7a54=['Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','map','MailTransferReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','update','describe','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','status','end','json','offset','set'];(function(_0x214362,_0x131d71){var _0x46d9ff=function(_0x5dc14f){while(--_0x5dc14f){_0x214362['push'](_0x214362['shift']());}};_0x46d9ff(++_0x131d71);}(_0x7a54,0x106));var _0x47a5=function(_0x3e4ab6,_0x2bdfcb){_0x3e4ab6=_0x3e4ab6-0x0;var _0x1e0565=_0x7a54[_0x3e4ab6];return _0x1e0565;};'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'];function respondWithStatusCode(_0xd612dd,_0xd308b8){_0xd308b8=_0xd308b8||0xcc;return function(_0x1eae59){if(_0x1eae59){return _0xd612dd['sendStatus'](_0xd308b8);}return _0xd612dd[_0x47a5('0x15')](_0xd308b8)[_0x47a5('0x16')]();};}function respondWithResult(_0x1cf309,_0x711793){_0x711793=_0x711793||0xc8;return function(_0x139f25){if(_0x139f25){return _0x1cf309[_0x47a5('0x15')](_0x711793)[_0x47a5('0x17')](_0x139f25);}};}function respondWithFilteredResult(_0x190faa,_0x4e99a8){return function(_0x362359){if(_0x362359){var _0x11faf5=_0x362359['count'],_0x3b001e=_0x4e99a8['offset'],_0x2a2cbb=_0x4e99a8[_0x47a5('0x18')]+_0x4e99a8['limit'],_0x1ef44c;if(_0x2a2cbb>=_0x11faf5){_0x2a2cbb=_0x11faf5;_0x1ef44c=0xc8;}else{_0x1ef44c=0xce;}_0x190faa['status'](_0x1ef44c);return _0x190faa[_0x47a5('0x19')](_0x47a5('0x1a'),_0x3b001e+'-'+_0x2a2cbb+'/'+_0x11faf5)[_0x47a5('0x17')](_0x362359);}return null;};}function patchUpdates(_0x1ef371){return function(_0x477b1d){try{jsonpatch[_0x47a5('0x1b')](_0x477b1d,_0x1ef371,!![]);}catch(_0x2763d6){return BPromise[_0x47a5('0x1c')](_0x2763d6);}return _0x477b1d[_0x47a5('0x1d')]();};}function saveUpdates(_0x4a9fcb,_0x1570bc){return function(_0xf160ba){if(_0xf160ba){return _0xf160ba['update'](_0x4a9fcb)[_0x47a5('0x1e')](function(_0x1f03f7){return _0x1f03f7;});}return null;};}function removeEntity(_0x36874d,_0x4c5910){return function(_0xb8ae6c){if(_0xb8ae6c){return _0xb8ae6c[_0x47a5('0x1f')]()[_0x47a5('0x1e')](function(){_0x36874d[_0x47a5('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe2dea9,_0x385687){return function(_0x513981){if(!_0x513981){_0xe2dea9[_0x47a5('0x20')](0x194);}return _0x513981;};}function handleError(_0xc4cd63,_0x4437f1){_0x4437f1=_0x4437f1||0x1f4;return function(_0x129ce5){logger[_0x47a5('0x21')](_0x129ce5['stack']);if(_0x129ce5['name']){delete _0x129ce5[_0x47a5('0x22')];}_0xc4cd63['status'](_0x4437f1)[_0x47a5('0x23')](_0x129ce5);};}exports['index']=function(_0x23cb77,_0x378208){var _0x36ad34={},_0x1dac65={},_0x21f296={'count':0x0,'rows':[]};var _0x3ba0b7=_[_0x47a5('0x24')](db[_0x47a5('0x25')][_0x47a5('0x26')],function(_0x361bfa){return{'name':_0x361bfa[_0x47a5('0x27')],'type':_0x361bfa[_0x47a5('0x28')][_0x47a5('0x29')]};});_0x1dac65['model']=_[_0x47a5('0x24')](_0x3ba0b7,'name');_0x1dac65[_0x47a5('0x2a')]=_[_0x47a5('0x2b')](_0x23cb77[_0x47a5('0x2a')]);_0x1dac65['filters']=_[_0x47a5('0x2c')](_0x1dac65[_0x47a5('0x2d')],_0x1dac65[_0x47a5('0x2a')]);_0x36ad34[_0x47a5('0x2e')]=_['intersection'](_0x1dac65['model'],qs[_0x47a5('0x2f')](_0x23cb77[_0x47a5('0x2a')]['fields']));_0x36ad34['attributes']=_0x36ad34[_0x47a5('0x2e')][_0x47a5('0x30')]?_0x36ad34['attributes']:_0x1dac65[_0x47a5('0x2d')];if(!_0x23cb77['query'][_0x47a5('0x31')](_0x47a5('0x32'))){_0x36ad34['limit']=qs['limit'](_0x23cb77[_0x47a5('0x2a')]['limit']);_0x36ad34[_0x47a5('0x18')]=qs[_0x47a5('0x18')](_0x23cb77[_0x47a5('0x2a')]['offset']);}_0x36ad34[_0x47a5('0x33')]=qs['sort'](_0x23cb77['query'][_0x47a5('0x34')]);_0x36ad34['where']=qs[_0x47a5('0x35')](_['pick'](_0x23cb77[_0x47a5('0x2a')],_0x1dac65[_0x47a5('0x35')]));if(_0x23cb77[_0x47a5('0x2a')][_0x47a5('0x36')]){_0x36ad34[_0x47a5('0x37')]=_[_0x47a5('0x38')](_0x36ad34[_0x47a5('0x37')],{'$or':_[_0x47a5('0x24')](_0x3ba0b7,function(_0x1a0d23){if(_0x1a0d23['type']!==_0x47a5('0x39')){var _0x10f136={};_0x10f136[_0x1a0d23['name']]={'$like':'%'+_0x23cb77[_0x47a5('0x2a')][_0x47a5('0x36')]+'%'};return _0x10f136;}})});}_0x36ad34=_[_0x47a5('0x38')]({},_0x36ad34,_0x23cb77['options']);var _0x101f70={'where':_0x36ad34[_0x47a5('0x37')]};return db['MailTransferReport'][_0x47a5('0x3a')](_0x101f70)[_0x47a5('0x1e')](function(_0x54ae35){_0x21f296['count']=_0x54ae35;if(_0x23cb77['query'][_0x47a5('0x3b')]){_0x36ad34['include']=[{'all':!![]}];}return db[_0x47a5('0x25')][_0x47a5('0x3c')](_0x36ad34);})[_0x47a5('0x1e')](function(_0x111f0d){_0x21f296[_0x47a5('0x3d')]=_0x111f0d;return _0x21f296;})[_0x47a5('0x1e')](respondWithFilteredResult(_0x378208,_0x36ad34))[_0x47a5('0x3e')](handleError(_0x378208,null));};exports[_0x47a5('0x3f')]=function(_0x3fa2a8,_0x36a24e){var _0x280500={'raw':!![],'where':{'id':_0x3fa2a8[_0x47a5('0x40')]['id']}},_0x1658e8={};_0x1658e8['model']=_[_0x47a5('0x2b')](db[_0x47a5('0x25')][_0x47a5('0x26')]);_0x1658e8[_0x47a5('0x2a')]=_['keys'](_0x3fa2a8[_0x47a5('0x2a')]);_0x1658e8['filters']=_['intersection'](_0x1658e8['model'],_0x1658e8['query']);_0x280500[_0x47a5('0x2e')]=_['intersection'](_0x1658e8[_0x47a5('0x2d')],qs[_0x47a5('0x2f')](_0x3fa2a8[_0x47a5('0x2a')]['fields']));_0x280500[_0x47a5('0x2e')]=_0x280500[_0x47a5('0x2e')]['length']?_0x280500['attributes']:_0x1658e8[_0x47a5('0x2d')];if(_0x3fa2a8['query'][_0x47a5('0x3b')]){_0x280500[_0x47a5('0x41')]=[{'all':!![]}];}_0x280500=_[_0x47a5('0x38')]({},_0x280500,_0x3fa2a8[_0x47a5('0x42')]);return db[_0x47a5('0x25')][_0x47a5('0x43')](_0x280500)[_0x47a5('0x1e')](handleEntityNotFound(_0x36a24e,null))[_0x47a5('0x1e')](respondWithResult(_0x36a24e,null))[_0x47a5('0x3e')](handleError(_0x36a24e,null));};exports[_0x47a5('0x44')]=function(_0x24ecb1,_0x3c3ebf){return db[_0x47a5('0x25')][_0x47a5('0x44')](_0x24ecb1[_0x47a5('0x45')],{})[_0x47a5('0x1e')](respondWithResult(_0x3c3ebf,0xc9))['catch'](handleError(_0x3c3ebf,null));};exports[_0x47a5('0x46')]=function(_0x23bb04,_0x49eab1){if(_0x23bb04['body']['id']){delete _0x23bb04[_0x47a5('0x45')]['id'];}return db['MailTransferReport'][_0x47a5('0x43')]({'where':{'id':_0x23bb04[_0x47a5('0x40')]['id']}})['then'](handleEntityNotFound(_0x49eab1,null))['then'](saveUpdates(_0x23bb04[_0x47a5('0x45')],null))['then'](respondWithResult(_0x49eab1,null))[_0x47a5('0x3e')](handleError(_0x49eab1,null));};exports[_0x47a5('0x1f')]=function(_0x3548bc,_0x3e12a7){return db[_0x47a5('0x25')][_0x47a5('0x43')]({'where':{'id':_0x3548bc[_0x47a5('0x40')]['id']}})['then'](handleEntityNotFound(_0x3e12a7,null))['then'](removeEntity(_0x3e12a7,null))[_0x47a5('0x3e')](handleError(_0x3e12a7,null));};exports[_0x47a5('0x47')]=function(_0x1163e3,_0x9ea93e){return db[_0x47a5('0x25')][_0x47a5('0x47')]()[_0x47a5('0x1e')](respondWithResult(_0x9ea93e,null))['catch'](handleError(_0x9ea93e,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','pick','filter','where','merge','VIRTUAL','options','MailTransferReport','count','includeAll','include','findAll','rows','show','find','catch','create','body','update','params','describe','html-pdf'];(function(_0x2390e7,_0x3c861d){var _0x4bca65=function(_0x4be0f0){while(--_0x4be0f0){_0x2390e7['push'](_0x2390e7['shift']());}};_0x4bca65(++_0x3c861d);}(_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'];function respondWithStatusCode(_0x2cb37a,_0x19a27e){_0x19a27e=_0x19a27e||0xcc;return function(_0x385f00){if(_0x385f00){return _0x2cb37a[_0x7995('0x1a')](_0x19a27e);}return _0x2cb37a[_0x7995('0x1b')](_0x19a27e)[_0x7995('0x1c')]();};}function respondWithResult(_0x4cc004,_0x58f5ad){_0x58f5ad=_0x58f5ad||0xc8;return function(_0x2b4e94){if(_0x2b4e94){return _0x4cc004[_0x7995('0x1b')](_0x58f5ad)[_0x7995('0x1d')](_0x2b4e94);}};}function respondWithFilteredResult(_0x321ae8,_0x3f1d3e){return function(_0x1a5310){if(_0x1a5310){var _0x2202ce=_0x1a5310['count'],_0x41cbf0=_0x3f1d3e[_0x7995('0x1e')],_0x5377e5=_0x3f1d3e[_0x7995('0x1e')]+_0x3f1d3e[_0x7995('0x1f')],_0x2eeacc;if(_0x5377e5>=_0x2202ce){_0x5377e5=_0x2202ce;_0x2eeacc=0xc8;}else{_0x2eeacc=0xce;}_0x321ae8[_0x7995('0x1b')](_0x2eeacc);return _0x321ae8[_0x7995('0x20')](_0x7995('0x21'),_0x41cbf0+'-'+_0x5377e5+'/'+_0x2202ce)['json'](_0x1a5310);}return null;};}function patchUpdates(_0x54c9ae){return function(_0x2536c8){try{jsonpatch['apply'](_0x2536c8,_0x54c9ae,!![]);}catch(_0x555f74){return BPromise[_0x7995('0x22')](_0x555f74);}return _0x2536c8[_0x7995('0x23')]();};}function saveUpdates(_0x4cbe10,_0x3a9b54){return function(_0x51f276){if(_0x51f276){return _0x51f276['update'](_0x4cbe10)[_0x7995('0x24')](function(_0x327b1f){return _0x327b1f;});}return null;};}function removeEntity(_0x350fd9,_0x1a8568){return function(_0x460924){if(_0x460924){return _0x460924[_0x7995('0x25')]()['then'](function(){_0x350fd9[_0x7995('0x1b')](0xcc)[_0x7995('0x1c')]();});}};}function handleEntityNotFound(_0x204507,_0x285437){return function(_0x563799){if(!_0x563799){_0x204507[_0x7995('0x1a')](0x194);}return _0x563799;};}function handleError(_0x475351,_0x472195){_0x472195=_0x472195||0x1f4;return function(_0x59405a){logger[_0x7995('0x26')](_0x59405a[_0x7995('0x27')]);if(_0x59405a[_0x7995('0x28')]){delete _0x59405a[_0x7995('0x28')];}_0x475351[_0x7995('0x1b')](_0x472195)[_0x7995('0x29')](_0x59405a);};}exports['index']=function(_0x47625f,_0x5911c3){var _0x229742={},_0x49bc7e={},_0xf16cc2={'count':0x0,'rows':[]};var _0x132a42=_[_0x7995('0x2a')](db['MailTransferReport'][_0x7995('0x2b')],function(_0x514445){return{'name':_0x514445[_0x7995('0x2c')],'type':_0x514445[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x49bc7e['model']=_['map'](_0x132a42,'name');_0x49bc7e[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x47625f[_0x7995('0x2f')]);_0x49bc7e[_0x7995('0x31')]=_[_0x7995('0x32')](_0x49bc7e[_0x7995('0x33')],_0x49bc7e['query']);_0x229742['attributes']=_[_0x7995('0x32')](_0x49bc7e['model'],qs[_0x7995('0x34')](_0x47625f[_0x7995('0x2f')][_0x7995('0x34')]));_0x229742[_0x7995('0x35')]=_0x229742[_0x7995('0x35')]['length']?_0x229742[_0x7995('0x35')]:_0x49bc7e[_0x7995('0x33')];if(!_0x47625f['query']['hasOwnProperty']('nolimit')){_0x229742[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x47625f['query'][_0x7995('0x1f')]);_0x229742['offset']=qs[_0x7995('0x1e')](_0x47625f[_0x7995('0x2f')][_0x7995('0x1e')]);}_0x229742['order']=qs['sort'](_0x47625f[_0x7995('0x2f')]['sort']);_0x229742['where']=qs[_0x7995('0x31')](_[_0x7995('0x36')](_0x47625f['query'],_0x49bc7e[_0x7995('0x31')]));if(_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]){_0x229742[_0x7995('0x38')]=_[_0x7995('0x39')](_0x229742['where'],{'$or':_[_0x7995('0x2a')](_0x132a42,function(_0x242713){if(_0x242713[_0x7995('0x2d')]!==_0x7995('0x3a')){var _0x4b1541={};_0x4b1541[_0x242713[_0x7995('0x28')]]={'$like':'%'+_0x47625f[_0x7995('0x2f')][_0x7995('0x37')]+'%'};return _0x4b1541;}})});}_0x229742=_[_0x7995('0x39')]({},_0x229742,_0x47625f[_0x7995('0x3b')]);var _0x1035dc={'where':_0x229742['where']};return db[_0x7995('0x3c')][_0x7995('0x3d')](_0x1035dc)[_0x7995('0x24')](function(_0x2ea47f){_0xf16cc2[_0x7995('0x3d')]=_0x2ea47f;if(_0x47625f[_0x7995('0x2f')][_0x7995('0x3e')]){_0x229742[_0x7995('0x3f')]=[{'all':!![]}];}return db[_0x7995('0x3c')][_0x7995('0x40')](_0x229742);})[_0x7995('0x24')](function(_0x270d52){_0xf16cc2[_0x7995('0x41')]=_0x270d52;return _0xf16cc2;})['then'](respondWithFilteredResult(_0x5911c3,_0x229742))['catch'](handleError(_0x5911c3,null));};exports[_0x7995('0x42')]=function(_0x7325e8,_0x58523e){var _0x4b0855={'raw':!![],'where':{'id':_0x7325e8['params']['id']}},_0x3f8522={};_0x3f8522['model']=_[_0x7995('0x30')](db[_0x7995('0x3c')][_0x7995('0x2b')]);_0x3f8522['query']=_[_0x7995('0x30')](_0x7325e8['query']);_0x3f8522[_0x7995('0x31')]=_['intersection'](_0x3f8522['model'],_0x3f8522[_0x7995('0x2f')]);_0x4b0855[_0x7995('0x35')]=_[_0x7995('0x32')](_0x3f8522[_0x7995('0x33')],qs['fields'](_0x7325e8[_0x7995('0x2f')][_0x7995('0x34')]));_0x4b0855[_0x7995('0x35')]=_0x4b0855[_0x7995('0x35')]['length']?_0x4b0855['attributes']:_0x3f8522[_0x7995('0x33')];if(_0x7325e8['query'][_0x7995('0x3e')]){_0x4b0855['include']=[{'all':!![]}];}_0x4b0855=_[_0x7995('0x39')]({},_0x4b0855,_0x7325e8['options']);return db[_0x7995('0x3c')][_0x7995('0x43')](_0x4b0855)['then'](handleEntityNotFound(_0x58523e,null))[_0x7995('0x24')](respondWithResult(_0x58523e,null))[_0x7995('0x44')](handleError(_0x58523e,null));};exports[_0x7995('0x45')]=function(_0xb70a51,_0x4c6837){return db[_0x7995('0x3c')][_0x7995('0x45')](_0xb70a51[_0x7995('0x46')],{})['then'](respondWithResult(_0x4c6837,0xc9))[_0x7995('0x44')](handleError(_0x4c6837,null));};exports[_0x7995('0x47')]=function(_0x511567,_0x3d8ae3){if(_0x511567[_0x7995('0x46')]['id']){delete _0x511567['body']['id'];}return db[_0x7995('0x3c')][_0x7995('0x43')]({'where':{'id':_0x511567['params']['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x3d8ae3,null))['then'](saveUpdates(_0x511567[_0x7995('0x46')],null))[_0x7995('0x24')](respondWithResult(_0x3d8ae3,null))[_0x7995('0x44')](handleError(_0x3d8ae3,null));};exports[_0x7995('0x25')]=function(_0xddf537,_0x14b537){return db[_0x7995('0x3c')]['find']({'where':{'id':_0xddf537[_0x7995('0x48')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x24')](removeEntity(_0x14b537,null))['catch'](handleError(_0x14b537,null));};exports[_0x7995('0x49')]=function(_0x1fe77e,_0x12d4b8){return db['MailTransferReport']['describe']()['then'](respondWithResult(_0x12d4b8,null))[_0x7995('0x44')](handleError(_0x12d4b8,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 8a02ba5..b84aca8 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 _0xef0f=['rimraf','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','uniqueid','util','../../config/logger','api','moment','bluebird','path'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xef0f,0x1c2));var _0xfef0=function(_0x5d1b27,_0x330a7b){_0x5d1b27=_0x5d1b27-0x0;var _0x3cfec3=_0xef0f[_0x5d1b27];return _0x3cfec3;};'use strict';var _=require('lodash');var util=require(_0xfef0('0x0'));var logger=require(_0xfef0('0x1'))(_0xfef0('0x2'));var moment=require(_0xfef0('0x3'));var BPromise=require(_0xfef0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfef0('0x5'));var rimraf=require(_0xfef0('0x6'));var config=require(_0xfef0('0x7'));var attributes=require(_0xfef0('0x8'));module[_0xfef0('0x9')]=function(_0x95151e,_0x5307cc){return _0x95151e['define'](_0xfef0('0xa'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xfef0('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd1c2=['api','moment','bluebird','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd1c2,0x80));var _0x2d1c=function(_0x252c16,_0x3904b3){_0x252c16=_0x252c16-0x0;var _0x1482d5=_0xd1c2[_0x252c16];return _0x1482d5;};'use strict';var _=require(_0x2d1c('0x0'));var util=require(_0x2d1c('0x1'));var logger=require('../../config/logger')(_0x2d1c('0x2'));var moment=require(_0x2d1c('0x3'));var BPromise=require(_0x2d1c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2d1c('0x5'));var rimraf=require(_0x2d1c('0x6'));var config=require(_0x2d1c('0x7'));var attributes=require(_0x2d1c('0x8'));module[_0x2d1c('0x9')]=function(_0x38af8e,_0x4eb3f0){return _0x38af8e['define'](_0x2d1c('0xa'),attributes,{'tableName':_0x2d1c('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2d1c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 28eeb80..f0d4722 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 _0x2b40=['../../config/environment','jayson/promise','client','http','info','MailTransferReport,\x20%s,\x20%s','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','util','moment','randomstring','../../mysqldb','../../config/logger'];(function(_0x5c56fa,_0x320e5a){var _0x64b637=function(_0x34fdb9){while(--_0x34fdb9){_0x5c56fa['push'](_0x5c56fa['shift']());}};_0x64b637(++_0x320e5a);}(_0x2b40,0x64));var _0x02b4=function(_0x5d9171,_0x5ccd64){_0x5d9171=_0x5d9171-0x0;var _0x49aa7b=_0x2b40[_0x5d9171];return _0x49aa7b;};'use strict';var _=require('lodash');var util=require(_0x02b4('0x0'));var moment=require(_0x02b4('0x1'));var BPromise=require('bluebird');var rs=require(_0x02b4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02b4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x02b4('0x4'))('rpc');var config=require(_0x02b4('0x5'));var jayson=require(_0x02b4('0x6'));var client=jayson[_0x02b4('0x7')][_0x02b4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39acbe,_0x389833,_0x54a066){return new BPromise(function(_0x689a71,_0x19fa03){return client['request'](_0x39acbe,_0x54a066)['then'](function(_0x552e09){logger[_0x02b4('0x9')](_0x02b4('0xa'),_0x389833,'request\x20sent');logger['debug'](_0x02b4('0xb'),_0x389833,_0x02b4('0xc'),JSON['stringify'](_0x552e09));if(_0x552e09[_0x02b4('0xd')]){if(_0x552e09['error']['code']===0x1f4){logger[_0x02b4('0xd')](_0x02b4('0xa'),_0x389833,_0x552e09['error'][_0x02b4('0xe')]);return _0x19fa03(_0x552e09[_0x02b4('0xd')][_0x02b4('0xe')]);}logger['error'](_0x02b4('0xa'),_0x389833,_0x552e09[_0x02b4('0xd')][_0x02b4('0xe')]);return _0x689a71(_0x552e09[_0x02b4('0xd')][_0x02b4('0xe')]);}else{logger[_0x02b4('0x9')](_0x02b4('0xa'),_0x389833,_0x02b4('0xc'));_0x689a71(_0x552e09['result']['message']);}})['catch'](function(_0x46c415){logger[_0x02b4('0xd')](_0x02b4('0xa'),_0x389833,_0x46c415);_0x19fa03(_0x46c415);});});} \ No newline at end of file +var _0x9e56=['code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','info','MailTransferReport,\x20%s,\x20%s','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2c7b86,_0x59ef3c){var _0x256735=function(_0x352e33){while(--_0x352e33){_0x2c7b86['push'](_0x2c7b86['shift']());}};_0x256735(++_0x59ef3c);}(_0x9e56,0xae));var _0x69e5=function(_0x3caeb5,_0x219363){_0x3caeb5=_0x3caeb5-0x0;var _0x5eca7e=_0x9e56[_0x3caeb5];return _0x5eca7e;};'use strict';var _=require(_0x69e5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x69e5('0x1'));var rs=require(_0x69e5('0x2'));var fs=require('fs');var Redis=require(_0x69e5('0x3'));var db=require(_0x69e5('0x4'))['db'];var utils=require(_0x69e5('0x5'));var logger=require(_0x69e5('0x6'))(_0x69e5('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x69e5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c6162,_0x426da6,_0x4577d1){return new BPromise(function(_0x21fc9d,_0x1cb15a){return client['request'](_0x4c6162,_0x4577d1)[_0x69e5('0x9')](function(_0x2d90ab){logger[_0x69e5('0xa')](_0x69e5('0xb'),_0x426da6,'request\x20sent');logger['debug'](_0x69e5('0xc'),_0x426da6,_0x69e5('0xd'),JSON[_0x69e5('0xe')](_0x2d90ab));if(_0x2d90ab[_0x69e5('0xf')]){if(_0x2d90ab['error'][_0x69e5('0x10')]===0x1f4){logger[_0x69e5('0xf')](_0x69e5('0xb'),_0x426da6,_0x2d90ab[_0x69e5('0xf')][_0x69e5('0x11')]);return _0x1cb15a(_0x2d90ab['error']['message']);}logger[_0x69e5('0xf')](_0x69e5('0xb'),_0x426da6,_0x2d90ab['error'][_0x69e5('0x11')]);return _0x21fc9d(_0x2d90ab[_0x69e5('0xf')]['message']);}else{logger[_0x69e5('0xa')](_0x69e5('0xb'),_0x426da6,_0x69e5('0xd'));_0x21fc9d(_0x2d90ab[_0x69e5('0x12')][_0x69e5('0x11')]);}})['catch'](function(_0x500548){logger[_0x69e5('0xf')](_0x69e5('0xb'),_0x426da6,_0x500548);_0x1cb15a(_0x500548);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index e288595..ce39f3f 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 _0x1caa=['get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x1caa,0xe9));var _0xa1ca=function(_0x4814c9,_0x271edb){_0x4814c9=_0x4814c9-0x0;var _0xcb681e=_0x1caa[_0x4814c9];return _0xcb681e;};'use strict';var multer=require(_0xa1ca('0x0'));var util=require(_0xa1ca('0x1'));var path=require(_0xa1ca('0x2'));var timeout=require(_0xa1ca('0x3'));var express=require(_0xa1ca('0x4'));var router=express['Router']();var auth=require(_0xa1ca('0x5'));var interaction=require(_0xa1ca('0x6'));var config=require(_0xa1ca('0x7'));var controller=require(_0xa1ca('0x8'));router[_0xa1ca('0x9')]('/',auth['isAuthenticated'](),controller[_0xa1ca('0xa')]);router[_0xa1ca('0x9')](_0xa1ca('0xb'),auth[_0xa1ca('0xc')](),controller[_0xa1ca('0xd')]);router[_0xa1ca('0x9')](_0xa1ca('0xe'),auth[_0xa1ca('0xc')](),controller[_0xa1ca('0xf')]);router['post']('/',auth[_0xa1ca('0xc')](),controller[_0xa1ca('0x10')]);router[_0xa1ca('0x11')](_0xa1ca('0xe'),auth[_0xa1ca('0xc')](),controller[_0xa1ca('0x12')]);router[_0xa1ca('0x13')](_0xa1ca('0xe'),auth[_0xa1ca('0xc')](),controller[_0xa1ca('0x14')]);module[_0xa1ca('0x15')]=router; \ No newline at end of file +var _0x13a5=['create','put','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x1dfdd,_0x5c2bd1){var _0x22b4cd=function(_0x278e10){while(--_0x278e10){_0x1dfdd['push'](_0x1dfdd['shift']());}};_0x22b4cd(++_0x5c2bd1);}(_0x13a5,0x79));var _0x513a=function(_0x1b65c6,_0x142002){_0x1b65c6=_0x1b65c6-0x0;var _0x493cea=_0x13a5[_0x1b65c6];return _0x493cea;};'use strict';var multer=require(_0x513a('0x0'));var util=require(_0x513a('0x1'));var path=require(_0x513a('0x2'));var timeout=require(_0x513a('0x3'));var express=require(_0x513a('0x4'));var router=express['Router']();var auth=require(_0x513a('0x5'));var interaction=require(_0x513a('0x6'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0x513a('0x7')]('/',auth['isAuthenticated'](),controller[_0x513a('0x8')]);router['get'](_0x513a('0x9'),auth[_0x513a('0xa')](),controller[_0x513a('0xb')]);router[_0x513a('0x7')](_0x513a('0xc'),auth['isAuthenticated'](),controller[_0x513a('0xd')]);router[_0x513a('0xe')]('/',auth['isAuthenticated'](),controller[_0x513a('0xf')]);router[_0x513a('0x10')]('/:id',auth[_0x513a('0xa')](),controller['update']);router['delete']('/:id',auth[_0x513a('0xa')](),controller['destroy']);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 4f9118e..8022c1c 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 _0xa3b9=['moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','setDataValue','duration','talk:[start]','talk:[destination]','sequelize'];(function(_0x4bda03,_0x111a9e){var _0x54ad93=function(_0x4dafd7){while(--_0x4dafd7){_0x4bda03['push'](_0x4bda03['shift']());}};_0x54ad93(++_0x111a9e);}(_0xa3b9,0x1b2));var _0x9a3b=function(_0x3fff7b,_0x1f73eb){_0x3fff7b=_0x3fff7b-0x0;var _0x4aac97=_0xa3b9[_0x3fff7b];return _0x4aac97;};'use strict';var Sequelize=require(_0x9a3b('0x0'));var moment=require(_0x9a3b('0x1'));module[_0x9a3b('0x2')]={'channel':{'type':Sequelize[_0x9a3b('0x3')]},'membername':{'type':Sequelize[_0x9a3b('0x3')]},'interface':{'type':Sequelize[_0x9a3b('0x3')]},'type':{'type':Sequelize[_0x9a3b('0x3')],'defaultValue':_0x9a3b('0x4'),'comment':_0x9a3b('0x5')},'duration':{'type':Sequelize[_0x9a3b('0x6')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9a3b('0x7')],'set':function(_0xb64eec){var _0x4b0450=moment(_0xb64eec);var _0x3e1e7c=moment(this[_0x9a3b('0x8')](_0x9a3b('0x9')));var _0xd2311f=_0x4b0450[_0x9a3b('0xa')](_0x3e1e7c,'seconds');this['setDataValue']('exitAt',_0xb64eec);this[_0x9a3b('0xb')](_0x9a3b('0xc'),_0xd2311f||null);}},'data1':{'type':Sequelize[_0x9a3b('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x9a3b('0x3')],'comment':_0x9a3b('0xd')},'data3':{'type':Sequelize[_0x9a3b('0x3')],'comment':_0x9a3b('0xe')},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x9a3b('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x9a3b('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd46b=['DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[dial\x20string]','sequelize','moment','exports','STRING'];(function(_0x4884a7,_0x18e38a){var _0x56b60e=function(_0x2ba8a3){while(--_0x2ba8a3){_0x4884a7['push'](_0x4884a7['shift']());}};_0x56b60e(++_0x18e38a);}(_0xd46b,0x12c));var _0xbd46=function(_0x2d3000,_0x424572){_0x2d3000=_0x2d3000-0x0;var _0xab6ac8=_0xd46b[_0x2d3000];return _0xab6ac8;};'use strict';var Sequelize=require(_0xbd46('0x0'));var moment=require(_0xbd46('0x1'));module[_0xbd46('0x2')]={'channel':{'type':Sequelize[_0xbd46('0x3')]},'membername':{'type':Sequelize[_0xbd46('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbd46('0x3')],'defaultValue':_0xbd46('0x4'),'comment':_0xbd46('0x5')},'duration':{'type':Sequelize[_0xbd46('0x6')]},'enterAt':{'type':Sequelize[_0xbd46('0x7')]},'exitAt':{'type':Sequelize[_0xbd46('0x7')],'set':function(_0x38edb4){var _0x22d761=moment(_0x38edb4);var _0x17a198=moment(this[_0xbd46('0x8')](_0xbd46('0x9')));var _0x1a6e35=_0x22d761[_0xbd46('0xa')](_0x17a198,_0xbd46('0xb'));this[_0xbd46('0xc')](_0xbd46('0xd'),_0x38edb4);this['setDataValue'](_0xbd46('0xe'),_0x1a6e35||null);}},'data1':{'type':Sequelize[_0xbd46('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xbd46('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xbd46('0x3')],'comment':_0xbd46('0xf')},'data5':{'type':Sequelize[_0xbd46('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xbd46('0x3')]},'internal':{'type':Sequelize[_0xbd46('0x6')]},'uniqueid':{'type':Sequelize[_0xbd46('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index d91fd74..db04d5a 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 _0x3458=['key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','update','describe','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','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','then','destroy','end','error','stack','name','send','index','map','MemberReport','rawAttributes','type'];(function(_0x21adbd,_0x16d384){var _0x4ffb9e=function(_0x15fbf6){while(--_0x15fbf6){_0x21adbd['push'](_0x21adbd['shift']());}};_0x4ffb9e(++_0x16d384);}(_0x3458,0xbc));var _0x8345=function(_0x379825,_0x57af4a){_0x379825=_0x379825-0x0;var _0xfcc221=_0x3458[_0x379825];return _0xfcc221;};'use strict';var pdf=require(_0x8345('0x0'));var emlformat=require(_0x8345('0x1'));var rimraf=require(_0x8345('0x2'));var zipdir=require(_0x8345('0x3'));var jsonpatch=require(_0x8345('0x4'));var rp=require('request-promise');var moment=require(_0x8345('0x5'));var BPromise=require(_0x8345('0x6'));var Mustache=require(_0x8345('0x7'));var util=require(_0x8345('0x8'));var path=require(_0x8345('0x9'));var sox=require('sox');var csv=require(_0x8345('0xa'));var ejs=require(_0x8345('0xb'));var fs=require('fs');var _=require(_0x8345('0xc'));var squel=require(_0x8345('0xd'));var crypto=require(_0x8345('0xe'));var jsforce=require(_0x8345('0xf'));var deskjs=require(_0x8345('0x10'));var toCsv=require(_0x8345('0xa'));var querystring=require(_0x8345('0x11'));var Papa=require(_0x8345('0x12'));var Redis=require('ioredis');var authService=require(_0x8345('0x13'));var qs=require(_0x8345('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8345('0x15'));var logger=require(_0x8345('0x16'))(_0x8345('0x17'));var utils=require(_0x8345('0x18'));var config=require(_0x8345('0x19'));var db=require(_0x8345('0x1a'))['db'];function respondWithStatusCode(_0x5e6919,_0x53c43d){_0x53c43d=_0x53c43d||0xcc;return function(_0x19efb5){if(_0x19efb5){return _0x5e6919[_0x8345('0x1b')](_0x53c43d);}return _0x5e6919[_0x8345('0x1c')](_0x53c43d)['end']();};}function respondWithResult(_0x5465fe,_0x1cf165){_0x1cf165=_0x1cf165||0xc8;return function(_0x20b84){if(_0x20b84){return _0x5465fe[_0x8345('0x1c')](_0x1cf165)['json'](_0x20b84);}};}function respondWithFilteredResult(_0x39beb6,_0x55615c){return function(_0x233820){if(_0x233820){var _0x307251=_0x233820[_0x8345('0x1d')],_0x2ecc1d=_0x55615c[_0x8345('0x1e')],_0x3d6c77=_0x55615c[_0x8345('0x1e')]+_0x55615c[_0x8345('0x1f')],_0x3aa53c;if(_0x3d6c77>=_0x307251){_0x3d6c77=_0x307251;_0x3aa53c=0xc8;}else{_0x3aa53c=0xce;}_0x39beb6[_0x8345('0x1c')](_0x3aa53c);return _0x39beb6[_0x8345('0x20')](_0x8345('0x21'),_0x2ecc1d+'-'+_0x3d6c77+'/'+_0x307251)[_0x8345('0x22')](_0x233820);}return null;};}function patchUpdates(_0x50acf2){return function(_0x399cb3){try{jsonpatch[_0x8345('0x23')](_0x399cb3,_0x50acf2,!![]);}catch(_0x2c1e96){return BPromise['reject'](_0x2c1e96);}return _0x399cb3[_0x8345('0x24')]();};}function saveUpdates(_0x12a845,_0x894623){return function(_0xcb32cf){if(_0xcb32cf){return _0xcb32cf['update'](_0x12a845)[_0x8345('0x25')](function(_0x3883eb){return _0x3883eb;});}return null;};}function removeEntity(_0x539149,_0x26ed7e){return function(_0x292e7a){if(_0x292e7a){return _0x292e7a[_0x8345('0x26')]()[_0x8345('0x25')](function(){_0x539149[_0x8345('0x1c')](0xcc)[_0x8345('0x27')]();});}};}function handleEntityNotFound(_0xaf3d1c,_0x5360ac){return function(_0x13984d){if(!_0x13984d){_0xaf3d1c[_0x8345('0x1b')](0x194);}return _0x13984d;};}function handleError(_0x444fb1,_0x409aa0){_0x409aa0=_0x409aa0||0x1f4;return function(_0x372f4a){logger[_0x8345('0x28')](_0x372f4a[_0x8345('0x29')]);if(_0x372f4a[_0x8345('0x2a')]){delete _0x372f4a[_0x8345('0x2a')];}_0x444fb1[_0x8345('0x1c')](_0x409aa0)[_0x8345('0x2b')](_0x372f4a);};}exports[_0x8345('0x2c')]=function(_0x4e67d5,_0x22bfa5){var _0x2ef610={},_0x151451={},_0x3ac2bf={'count':0x0,'rows':[]};var _0x588f8f=_[_0x8345('0x2d')](db[_0x8345('0x2e')][_0x8345('0x2f')],function(_0x26e69c){return{'name':_0x26e69c['fieldName'],'type':_0x26e69c[_0x8345('0x30')][_0x8345('0x31')]};});_0x151451[_0x8345('0x32')]=_[_0x8345('0x2d')](_0x588f8f,_0x8345('0x2a'));_0x151451[_0x8345('0x33')]=_[_0x8345('0x34')](_0x4e67d5[_0x8345('0x33')]);_0x151451[_0x8345('0x35')]=_['intersection'](_0x151451[_0x8345('0x32')],_0x151451[_0x8345('0x33')]);_0x2ef610[_0x8345('0x36')]=_[_0x8345('0x37')](_0x151451['model'],qs['fields'](_0x4e67d5[_0x8345('0x33')][_0x8345('0x38')]));_0x2ef610[_0x8345('0x36')]=_0x2ef610[_0x8345('0x36')][_0x8345('0x39')]?_0x2ef610['attributes']:_0x151451[_0x8345('0x32')];if(!_0x4e67d5[_0x8345('0x33')][_0x8345('0x3a')]('nolimit')){_0x2ef610[_0x8345('0x1f')]=qs[_0x8345('0x1f')](_0x4e67d5[_0x8345('0x33')][_0x8345('0x1f')]);_0x2ef610['offset']=qs['offset'](_0x4e67d5[_0x8345('0x33')][_0x8345('0x1e')]);}_0x2ef610[_0x8345('0x3b')]=qs[_0x8345('0x3c')](_0x4e67d5[_0x8345('0x33')][_0x8345('0x3c')]);_0x2ef610['where']=qs[_0x8345('0x35')](_[_0x8345('0x3d')](_0x4e67d5[_0x8345('0x33')],_0x151451[_0x8345('0x35')]));if(_0x4e67d5['query'][_0x8345('0x3e')]){_0x2ef610[_0x8345('0x3f')]=_[_0x8345('0x40')](_0x2ef610[_0x8345('0x3f')],{'$or':_[_0x8345('0x2d')](_0x588f8f,function(_0x5b93a0){if(_0x5b93a0[_0x8345('0x30')]!==_0x8345('0x41')){var _0x14bf7e={};_0x14bf7e[_0x5b93a0['name']]={'$like':'%'+_0x4e67d5[_0x8345('0x33')]['filter']+'%'};return _0x14bf7e;}})});}_0x2ef610=_[_0x8345('0x40')]({},_0x2ef610,_0x4e67d5['options']);var _0x149bd9={'where':_0x2ef610['where']};return db[_0x8345('0x2e')]['count'](_0x149bd9)[_0x8345('0x25')](function(_0x28fb92){_0x3ac2bf['count']=_0x28fb92;if(_0x4e67d5[_0x8345('0x33')][_0x8345('0x42')]){_0x2ef610[_0x8345('0x43')]=[{'all':!![]}];}return db[_0x8345('0x2e')][_0x8345('0x44')](_0x2ef610);})[_0x8345('0x25')](function(_0xa0548){_0x3ac2bf[_0x8345('0x45')]=_0xa0548;return _0x3ac2bf;})[_0x8345('0x25')](respondWithFilteredResult(_0x22bfa5,_0x2ef610))['catch'](handleError(_0x22bfa5,null));};exports[_0x8345('0x46')]=function(_0x4cbd57,_0x15b5c4){var _0x1d34c6={'raw':!![],'where':{'id':_0x4cbd57[_0x8345('0x47')]['id']}},_0x30e909={};_0x30e909['model']=_[_0x8345('0x34')](db[_0x8345('0x2e')][_0x8345('0x2f')]);_0x30e909[_0x8345('0x33')]=_[_0x8345('0x34')](_0x4cbd57[_0x8345('0x33')]);_0x30e909[_0x8345('0x35')]=_[_0x8345('0x37')](_0x30e909['model'],_0x30e909[_0x8345('0x33')]);_0x1d34c6[_0x8345('0x36')]=_[_0x8345('0x37')](_0x30e909[_0x8345('0x32')],qs[_0x8345('0x38')](_0x4cbd57[_0x8345('0x33')][_0x8345('0x38')]));_0x1d34c6['attributes']=_0x1d34c6[_0x8345('0x36')]['length']?_0x1d34c6[_0x8345('0x36')]:_0x30e909[_0x8345('0x32')];if(_0x4cbd57['query'][_0x8345('0x42')]){_0x1d34c6[_0x8345('0x43')]=[{'all':!![]}];}_0x1d34c6=_[_0x8345('0x40')]({},_0x1d34c6,_0x4cbd57[_0x8345('0x48')]);return db[_0x8345('0x2e')][_0x8345('0x49')](_0x1d34c6)[_0x8345('0x25')](handleEntityNotFound(_0x15b5c4,null))[_0x8345('0x25')](respondWithResult(_0x15b5c4,null))[_0x8345('0x4a')](handleError(_0x15b5c4,null));};exports['create']=function(_0x3c7805,_0x57e1dc){return db['MemberReport'][_0x8345('0x4b')](_0x3c7805[_0x8345('0x4c')],{})['then'](respondWithResult(_0x57e1dc,0xc9))['catch'](handleError(_0x57e1dc,null));};exports[_0x8345('0x4d')]=function(_0x2113fa,_0x4111c0){if(_0x2113fa[_0x8345('0x4c')]['id']){delete _0x2113fa['body']['id'];}return db[_0x8345('0x2e')][_0x8345('0x49')]({'where':{'id':_0x2113fa['params']['id']}})['then'](handleEntityNotFound(_0x4111c0,null))[_0x8345('0x25')](saveUpdates(_0x2113fa[_0x8345('0x4c')],null))[_0x8345('0x25')](respondWithResult(_0x4111c0,null))['catch'](handleError(_0x4111c0,null));};exports[_0x8345('0x26')]=function(_0x10a6f8,_0x14f03b){return db[_0x8345('0x2e')][_0x8345('0x49')]({'where':{'id':_0x10a6f8[_0x8345('0x47')]['id']}})[_0x8345('0x25')](handleEntityNotFound(_0x14f03b,null))[_0x8345('0x25')](removeEntity(_0x14f03b,null))[_0x8345('0x4a')](handleError(_0x14f03b,null));};exports['describe']=function(_0x51ad73,_0x3670c4){return db[_0x8345('0x2e')][_0x8345('0x4e')]()[_0x8345('0x25')](respondWithResult(_0x3670c4,null))[_0x8345('0x4a')](handleError(_0x3670c4,null));}; \ No newline at end of file +var _0x0f96=['options','findAll','rows','catch','show','rawAttributes','include','find','create','body','params','html-pdf','eml-format','fast-json-patch','request-promise','moment','util','path','to-csv','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','send','map','MemberReport','fieldName','key','model','name','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL'];(function(_0x299446,_0x202cf7){var _0x5bd7d8=function(_0x77cbcc){while(--_0x77cbcc){_0x299446['push'](_0x299446['shift']());}};_0x5bd7d8(++_0x202cf7);}(_0x0f96,0xda));var _0x60f9=function(_0x474849,_0x5e4ea6){_0x474849=_0x474849-0x0;var _0x5a5401=_0x0f96[_0x474849];return _0x5a5401;};'use strict';var pdf=require(_0x60f9('0x0'));var emlformat=require(_0x60f9('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x60f9('0x2'));var rp=require(_0x60f9('0x3'));var moment=require(_0x60f9('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x60f9('0x5'));var path=require(_0x60f9('0x6'));var sox=require('sox');var csv=require(_0x60f9('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x60f9('0x8'));var squel=require(_0x60f9('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x60f9('0x7'));var querystring=require(_0x60f9('0xa'));var Papa=require(_0x60f9('0xb'));var Redis=require(_0x60f9('0xc'));var authService=require(_0x60f9('0xd'));var qs=require(_0x60f9('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x60f9('0xf'))('api');var utils=require(_0x60f9('0x10'));var config=require(_0x60f9('0x11'));var db=require(_0x60f9('0x12'))['db'];function respondWithStatusCode(_0xc2159e,_0x50d8e7){_0x50d8e7=_0x50d8e7||0xcc;return function(_0x39f641){if(_0x39f641){return _0xc2159e[_0x60f9('0x13')](_0x50d8e7);}return _0xc2159e[_0x60f9('0x14')](_0x50d8e7)['end']();};}function respondWithResult(_0x14c058,_0x306420){_0x306420=_0x306420||0xc8;return function(_0x4f86f2){if(_0x4f86f2){return _0x14c058[_0x60f9('0x14')](_0x306420)['json'](_0x4f86f2);}};}function respondWithFilteredResult(_0x524fd5,_0x300985){return function(_0x22cd1c){if(_0x22cd1c){var _0x8bf553=_0x22cd1c[_0x60f9('0x15')],_0x10656b=_0x300985[_0x60f9('0x16')],_0x400395=_0x300985['offset']+_0x300985[_0x60f9('0x17')],_0x2ef925;if(_0x400395>=_0x8bf553){_0x400395=_0x8bf553;_0x2ef925=0xc8;}else{_0x2ef925=0xce;}_0x524fd5[_0x60f9('0x14')](_0x2ef925);return _0x524fd5[_0x60f9('0x18')](_0x60f9('0x19'),_0x10656b+'-'+_0x400395+'/'+_0x8bf553)[_0x60f9('0x1a')](_0x22cd1c);}return null;};}function patchUpdates(_0x735cf0){return function(_0x405967){try{jsonpatch[_0x60f9('0x1b')](_0x405967,_0x735cf0,!![]);}catch(_0x3edba5){return BPromise[_0x60f9('0x1c')](_0x3edba5);}return _0x405967[_0x60f9('0x1d')]();};}function saveUpdates(_0x20822c,_0x3ca065){return function(_0xae1d42){if(_0xae1d42){return _0xae1d42[_0x60f9('0x1e')](_0x20822c)['then'](function(_0x25a8d9){return _0x25a8d9;});}return null;};}function removeEntity(_0x3ecc34,_0x18ff98){return function(_0x50445d){if(_0x50445d){return _0x50445d[_0x60f9('0x1f')]()[_0x60f9('0x20')](function(){_0x3ecc34[_0x60f9('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18cf65,_0x4cfdd9){return function(_0x4fce3b){if(!_0x4fce3b){_0x18cf65[_0x60f9('0x13')](0x194);}return _0x4fce3b;};}function handleError(_0x37573a,_0x506a98){_0x506a98=_0x506a98||0x1f4;return function(_0x33287c){logger[_0x60f9('0x21')](_0x33287c[_0x60f9('0x22')]);if(_0x33287c['name']){delete _0x33287c['name'];}_0x37573a[_0x60f9('0x14')](_0x506a98)[_0x60f9('0x23')](_0x33287c);};}exports['index']=function(_0x448645,_0x33c632){var _0x1ac4c1={},_0x2256b9={},_0x30b4f6={'count':0x0,'rows':[]};var _0x478c50=_[_0x60f9('0x24')](db[_0x60f9('0x25')]['rawAttributes'],function(_0x1b7b8b){return{'name':_0x1b7b8b[_0x60f9('0x26')],'type':_0x1b7b8b['type'][_0x60f9('0x27')]};});_0x2256b9[_0x60f9('0x28')]=_[_0x60f9('0x24')](_0x478c50,_0x60f9('0x29'));_0x2256b9['query']=_[_0x60f9('0x2a')](_0x448645[_0x60f9('0x2b')]);_0x2256b9['filters']=_['intersection'](_0x2256b9[_0x60f9('0x28')],_0x2256b9[_0x60f9('0x2b')]);_0x1ac4c1[_0x60f9('0x2c')]=_[_0x60f9('0x2d')](_0x2256b9['model'],qs[_0x60f9('0x2e')](_0x448645[_0x60f9('0x2b')][_0x60f9('0x2e')]));_0x1ac4c1[_0x60f9('0x2c')]=_0x1ac4c1[_0x60f9('0x2c')][_0x60f9('0x2f')]?_0x1ac4c1[_0x60f9('0x2c')]:_0x2256b9[_0x60f9('0x28')];if(!_0x448645[_0x60f9('0x2b')][_0x60f9('0x30')](_0x60f9('0x31'))){_0x1ac4c1[_0x60f9('0x17')]=qs['limit'](_0x448645[_0x60f9('0x2b')][_0x60f9('0x17')]);_0x1ac4c1[_0x60f9('0x16')]=qs['offset'](_0x448645[_0x60f9('0x2b')][_0x60f9('0x16')]);}_0x1ac4c1[_0x60f9('0x32')]=qs[_0x60f9('0x33')](_0x448645[_0x60f9('0x2b')][_0x60f9('0x33')]);_0x1ac4c1[_0x60f9('0x34')]=qs[_0x60f9('0x35')](_['pick'](_0x448645['query'],_0x2256b9['filters']));if(_0x448645[_0x60f9('0x2b')][_0x60f9('0x36')]){_0x1ac4c1['where']=_[_0x60f9('0x37')](_0x1ac4c1[_0x60f9('0x34')],{'$or':_[_0x60f9('0x24')](_0x478c50,function(_0x332f86){if(_0x332f86[_0x60f9('0x38')]!==_0x60f9('0x39')){var _0x387e56={};_0x387e56[_0x332f86['name']]={'$like':'%'+_0x448645[_0x60f9('0x2b')]['filter']+'%'};return _0x387e56;}})});}_0x1ac4c1=_['merge']({},_0x1ac4c1,_0x448645[_0x60f9('0x3a')]);var _0x2d118e={'where':_0x1ac4c1[_0x60f9('0x34')]};return db[_0x60f9('0x25')][_0x60f9('0x15')](_0x2d118e)[_0x60f9('0x20')](function(_0x1f62f2){_0x30b4f6[_0x60f9('0x15')]=_0x1f62f2;if(_0x448645[_0x60f9('0x2b')]['includeAll']){_0x1ac4c1['include']=[{'all':!![]}];}return db['MemberReport'][_0x60f9('0x3b')](_0x1ac4c1);})['then'](function(_0x2843cd){_0x30b4f6[_0x60f9('0x3c')]=_0x2843cd;return _0x30b4f6;})[_0x60f9('0x20')](respondWithFilteredResult(_0x33c632,_0x1ac4c1))[_0x60f9('0x3d')](handleError(_0x33c632,null));};exports[_0x60f9('0x3e')]=function(_0x44450f,_0x1e2f6f){var _0x4d8184={'raw':!![],'where':{'id':_0x44450f['params']['id']}},_0x30691a={};_0x30691a[_0x60f9('0x28')]=_[_0x60f9('0x2a')](db[_0x60f9('0x25')][_0x60f9('0x3f')]);_0x30691a[_0x60f9('0x2b')]=_[_0x60f9('0x2a')](_0x44450f[_0x60f9('0x2b')]);_0x30691a[_0x60f9('0x35')]=_[_0x60f9('0x2d')](_0x30691a[_0x60f9('0x28')],_0x30691a[_0x60f9('0x2b')]);_0x4d8184[_0x60f9('0x2c')]=_['intersection'](_0x30691a[_0x60f9('0x28')],qs[_0x60f9('0x2e')](_0x44450f[_0x60f9('0x2b')][_0x60f9('0x2e')]));_0x4d8184[_0x60f9('0x2c')]=_0x4d8184[_0x60f9('0x2c')]['length']?_0x4d8184[_0x60f9('0x2c')]:_0x30691a[_0x60f9('0x28')];if(_0x44450f[_0x60f9('0x2b')]['includeAll']){_0x4d8184[_0x60f9('0x40')]=[{'all':!![]}];}_0x4d8184=_['merge']({},_0x4d8184,_0x44450f[_0x60f9('0x3a')]);return db[_0x60f9('0x25')][_0x60f9('0x41')](_0x4d8184)['then'](handleEntityNotFound(_0x1e2f6f,null))[_0x60f9('0x20')](respondWithResult(_0x1e2f6f,null))[_0x60f9('0x3d')](handleError(_0x1e2f6f,null));};exports[_0x60f9('0x42')]=function(_0x3c18e6,_0x3ae134){return db[_0x60f9('0x25')][_0x60f9('0x42')](_0x3c18e6[_0x60f9('0x43')],{})[_0x60f9('0x20')](respondWithResult(_0x3ae134,0xc9))['catch'](handleError(_0x3ae134,null));};exports[_0x60f9('0x1e')]=function(_0x3e640a,_0x540dfc){if(_0x3e640a['body']['id']){delete _0x3e640a[_0x60f9('0x43')]['id'];}return db[_0x60f9('0x25')][_0x60f9('0x41')]({'where':{'id':_0x3e640a[_0x60f9('0x44')]['id']}})[_0x60f9('0x20')](handleEntityNotFound(_0x540dfc,null))[_0x60f9('0x20')](saveUpdates(_0x3e640a[_0x60f9('0x43')],null))[_0x60f9('0x20')](respondWithResult(_0x540dfc,null))['catch'](handleError(_0x540dfc,null));};exports[_0x60f9('0x1f')]=function(_0x3804f2,_0x1d8cd4){return db['MemberReport']['find']({'where':{'id':_0x3804f2[_0x60f9('0x44')]['id']}})[_0x60f9('0x20')](handleEntityNotFound(_0x1d8cd4,null))[_0x60f9('0x20')](removeEntity(_0x1d8cd4,null))[_0x60f9('0x3d')](handleError(_0x1d8cd4,null));};exports['describe']=function(_0x4016fa,_0x424dc8){return db[_0x60f9('0x25')]['describe']()[_0x60f9('0x20')](respondWithResult(_0x424dc8,null))[_0x60f9('0x3d')](handleError(_0x424dc8,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 74b8b5c..ef1feec 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 _0xd38f=['moment','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','MemberReport','report_member','membername_interface','../../config/logger','api'];(function(_0xfe2485,_0x39e98a){var _0x554f4b=function(_0x22815b){while(--_0x22815b){_0xfe2485['push'](_0xfe2485['shift']());}};_0x554f4b(++_0x39e98a);}(_0xd38f,0x1c1));var _0xfd38=function(_0x2ed5a8,_0x203f1b){_0x2ed5a8=_0x2ed5a8-0x0;var _0x31d68b=_0xd38f[_0x2ed5a8];return _0x31d68b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfd38('0x0'))(_0xfd38('0x1'));var moment=require(_0xfd38('0x2'));var BPromise=require('bluebird');var rp=require(_0xfd38('0x3'));var fs=require('fs');var path=require(_0xfd38('0x4'));var rimraf=require(_0xfd38('0x5'));var config=require(_0xfd38('0x6'));var attributes=require(_0xfd38('0x7'));module['exports']=function(_0x491bb6,_0x478767){return _0x491bb6['define'](_0xfd38('0x8'),attributes,{'tableName':_0xfd38('0x9'),'paranoid':![],'indexes':[{'name':_0xfd38('0xa'),'fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x63a5=['../../config/environment','./memberReport.attributes','exports','define','MemberReport','membername','interface','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1d3023,_0x30f969){var _0x378c07=function(_0x562938){while(--_0x562938){_0x1d3023['push'](_0x1d3023['shift']());}};_0x378c07(++_0x30f969);}(_0x63a5,0xe7));var _0x563a=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x63a5[_0x5627e1];return _0x2f013f;};'use strict';var _=require(_0x563a('0x0'));var util=require('util');var logger=require(_0x563a('0x1'))(_0x563a('0x2'));var moment=require(_0x563a('0x3'));var BPromise=require(_0x563a('0x4'));var rp=require(_0x563a('0x5'));var fs=require('fs');var path=require(_0x563a('0x6'));var rimraf=require('rimraf');var config=require(_0x563a('0x7'));var attributes=require(_0x563a('0x8'));module[_0x563a('0x9')]=function(_0x4789d8,_0x370358){return _0x4789d8[_0x563a('0xa')](_0x563a('0xb'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x563a('0xc'),_0x563a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index f88c60f..f788809 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 _0x54ca=['model','stringify','CreateMemberReport','create','body','raw','UpdateMemberReport','update','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','GetMemberReport','MemberReport','options','attributes','limit','include','map'];(function(_0x578d24,_0x2321df){var _0x11a241=function(_0x4e8891){while(--_0x4e8891){_0x578d24['push'](_0x578d24['shift']());}};_0x11a241(++_0x2321df);}(_0x54ca,0xe7));var _0xa54c=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x54ca[_0x26462c];return _0x509a42;};'use strict';var _=require(_0xa54c('0x0'));var util=require(_0xa54c('0x1'));var moment=require(_0xa54c('0x2'));var BPromise=require(_0xa54c('0x3'));var rs=require(_0xa54c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa54c('0x5'))['db'];var utils=require(_0xa54c('0x6'));var logger=require(_0xa54c('0x7'))('rpc');var config=require(_0xa54c('0x8'));var jayson=require(_0xa54c('0x9'));var client=jayson[_0xa54c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43c2ed,_0x17e722,_0x433df2){return new BPromise(function(_0x43f224,_0x140203){return client[_0xa54c('0xb')](_0x43c2ed,_0x433df2)[_0xa54c('0xc')](function(_0x3bfa11){logger[_0xa54c('0xd')](_0xa54c('0xe'),_0x17e722,_0xa54c('0xf'));logger[_0xa54c('0x10')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x17e722,_0xa54c('0xf'),JSON['stringify'](_0x3bfa11));if(_0x3bfa11['error']){if(_0x3bfa11[_0xa54c('0x11')][_0xa54c('0x12')]===0x1f4){logger[_0xa54c('0x11')](_0xa54c('0xe'),_0x17e722,_0x3bfa11['error']['message']);return _0x140203(_0x3bfa11[_0xa54c('0x11')][_0xa54c('0x13')]);}logger[_0xa54c('0x11')](_0xa54c('0xe'),_0x17e722,_0x3bfa11[_0xa54c('0x11')][_0xa54c('0x13')]);return _0x43f224(_0x3bfa11[_0xa54c('0x11')][_0xa54c('0x13')]);}else{logger[_0xa54c('0xd')](_0xa54c('0xe'),_0x17e722,_0xa54c('0xf'));_0x43f224(_0x3bfa11[_0xa54c('0x14')]['message']);}})['catch'](function(_0x101a90){logger[_0xa54c('0x11')](_0xa54c('0xe'),_0x17e722,_0x101a90);_0x140203(_0x101a90);});});}exports[_0xa54c('0x15')]=function(_0x3e0553){var _0x32ac97=this;return new Promise(function(_0x5c9d80,_0x1a93af){return db[_0xa54c('0x16')]['findAll']({'raw':_0x3e0553[_0xa54c('0x17')]?_0x3e0553[_0xa54c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3e0553[_0xa54c('0x17')]?_0x3e0553[_0xa54c('0x17')]['where']||null:null,'attributes':_0x3e0553[_0xa54c('0x17')]?_0x3e0553['options'][_0xa54c('0x18')]||null:null,'limit':_0x3e0553[_0xa54c('0x17')]?_0x3e0553[_0xa54c('0x17')][_0xa54c('0x19')]||null:null,'include':_0x3e0553['options']?_0x3e0553[_0xa54c('0x17')][_0xa54c('0x1a')]?_[_0xa54c('0x1b')](_0x3e0553['options'][_0xa54c('0x1a')],function(_0x1454cc){return{'model':db[_0x1454cc['model']],'as':_0x1454cc['as'],'attributes':_0x1454cc[_0xa54c('0x18')],'include':_0x1454cc[_0xa54c('0x1a')]?_[_0xa54c('0x1b')](_0x1454cc[_0xa54c('0x1a')],function(_0x20321e){return{'model':db[_0x20321e[_0xa54c('0x1c')]],'as':_0x20321e['as'],'attributes':_0x20321e['attributes'],'include':_0x20321e[_0xa54c('0x1a')]?_[_0xa54c('0x1b')](_0x20321e[_0xa54c('0x1a')],function(_0x5b643b){return{'model':db[_0x5b643b[_0xa54c('0x1c')]],'as':_0x5b643b['as'],'attributes':_0x5b643b[_0xa54c('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa54c('0xc')](function(_0x5b7ce5){logger[_0xa54c('0xd')](_0xa54c('0x15'),_0x3e0553);logger[_0xa54c('0x10')]('GetMemberReport',_0x3e0553,JSON[_0xa54c('0x1d')](_0x5b7ce5));_0x5c9d80(_0x5b7ce5);})['catch'](function(_0x1a0a5c){logger[_0xa54c('0x11')](_0xa54c('0x15'),_0x1a0a5c['message'],_0x3e0553);_0x1a93af(_0x32ac97[_0xa54c('0x11')](0x1f4,_0x1a0a5c['message']));});});};exports[_0xa54c('0x1e')]=function(_0x2fe3da){var _0x5f1961=this;return new Promise(function(_0x55efa6,_0x43081e){return db['MemberReport'][_0xa54c('0x1f')](_0x2fe3da[_0xa54c('0x20')],{'raw':_0x2fe3da[_0xa54c('0x17')]?_0x2fe3da[_0xa54c('0x17')][_0xa54c('0x21')]===undefined?!![]:![]:!![]})[_0xa54c('0xc')](function(_0x2f61fc){logger[_0xa54c('0xd')](_0xa54c('0x1e'),_0x2fe3da);logger['debug'](_0xa54c('0x1e'),_0x2fe3da,JSON[_0xa54c('0x1d')](_0x2f61fc));_0x55efa6(_0x2f61fc);})['catch'](function(_0x4dd240){logger[_0xa54c('0x11')](_0xa54c('0x1e'),_0x4dd240[_0xa54c('0x13')],_0x2fe3da);_0x43081e(_0x5f1961[_0xa54c('0x11')](0x1f4,_0x4dd240[_0xa54c('0x13')]));});});};exports[_0xa54c('0x22')]=function(_0x417d83){var _0x3dbb24=this;return new Promise(function(_0x3c1c76,_0x419a0f){return db['MemberReport'][_0xa54c('0x23')](_0x417d83['body'],{'raw':_0x417d83[_0xa54c('0x17')]?_0x417d83[_0xa54c('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x417d83[_0xa54c('0x17')]?_0x417d83['options'][_0xa54c('0x24')]||null:null,'attributes':_0x417d83[_0xa54c('0x17')]?_0x417d83[_0xa54c('0x17')][_0xa54c('0x18')]||null:null,'limit':_0x417d83['options']?_0x417d83[_0xa54c('0x17')][_0xa54c('0x19')]||null:null})[_0xa54c('0xc')](function(_0x39ae67){logger[_0xa54c('0xd')](_0xa54c('0x22'),_0x417d83);logger[_0xa54c('0x10')](_0xa54c('0x22'),_0x417d83,JSON[_0xa54c('0x1d')](_0x39ae67));_0x3c1c76(_0x39ae67);})['catch'](function(_0x113158){logger[_0xa54c('0x11')]('UpdateMemberReport',_0x113158[_0xa54c('0x13')],_0x417d83);_0x419a0f(_0x3dbb24[_0xa54c('0x11')](0x1f4,_0x113158['message']));});});}; \ No newline at end of file +var _0xefc7=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetMemberReport','findAll','options','raw','where','attributes','include','map','model','CreateMemberReport','MemberReport','body','UpdateMemberReport','limit'];(function(_0x5b89c7,_0x22994c){var _0x332b50=function(_0x2afacc){while(--_0x2afacc){_0x5b89c7['push'](_0x5b89c7['shift']());}};_0x332b50(++_0x22994c);}(_0xefc7,0x111));var _0x7efc=function(_0x4c4ecb,_0x17523b){_0x4c4ecb=_0x4c4ecb-0x0;var _0x1e1b70=_0xefc7[_0x4c4ecb];return _0x1e1b70;};'use strict';var _=require(_0x7efc('0x0'));var util=require('util');var moment=require(_0x7efc('0x1'));var BPromise=require(_0x7efc('0x2'));var rs=require(_0x7efc('0x3'));var fs=require('fs');var Redis=require(_0x7efc('0x4'));var db=require(_0x7efc('0x5'))['db'];var utils=require(_0x7efc('0x6'));var logger=require(_0x7efc('0x7'))(_0x7efc('0x8'));var config=require(_0x7efc('0x9'));var jayson=require(_0x7efc('0xa'));var client=jayson[_0x7efc('0xb')][_0x7efc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39f033,_0x1ed304,_0x5a356f){return new BPromise(function(_0x3efad9,_0x469f22){return client['request'](_0x39f033,_0x5a356f)[_0x7efc('0xd')](function(_0x540c96){logger['info'](_0x7efc('0xe'),_0x1ed304,'request\x20sent');logger[_0x7efc('0xf')](_0x7efc('0x10'),_0x1ed304,_0x7efc('0x11'),JSON[_0x7efc('0x12')](_0x540c96));if(_0x540c96[_0x7efc('0x13')]){if(_0x540c96[_0x7efc('0x13')][_0x7efc('0x14')]===0x1f4){logger[_0x7efc('0x13')]('MemberReport,\x20%s,\x20%s',_0x1ed304,_0x540c96['error'][_0x7efc('0x15')]);return _0x469f22(_0x540c96[_0x7efc('0x13')][_0x7efc('0x15')]);}logger[_0x7efc('0x13')]('MemberReport,\x20%s,\x20%s',_0x1ed304,_0x540c96[_0x7efc('0x13')][_0x7efc('0x15')]);return _0x3efad9(_0x540c96['error'][_0x7efc('0x15')]);}else{logger[_0x7efc('0x16')](_0x7efc('0xe'),_0x1ed304,'request\x20sent');_0x3efad9(_0x540c96[_0x7efc('0x17')][_0x7efc('0x15')]);}})[_0x7efc('0x18')](function(_0x494daf){logger['error'](_0x7efc('0xe'),_0x1ed304,_0x494daf);_0x469f22(_0x494daf);});});}exports[_0x7efc('0x19')]=function(_0x1fc904){var _0x4bbe86=this;return new Promise(function(_0x57a494,_0x3f51aa){return db['MemberReport'][_0x7efc('0x1a')]({'raw':_0x1fc904[_0x7efc('0x1b')]?_0x1fc904[_0x7efc('0x1b')][_0x7efc('0x1c')]===undefined?!![]:![]:!![],'where':_0x1fc904[_0x7efc('0x1b')]?_0x1fc904['options'][_0x7efc('0x1d')]||null:null,'attributes':_0x1fc904[_0x7efc('0x1b')]?_0x1fc904[_0x7efc('0x1b')][_0x7efc('0x1e')]||null:null,'limit':_0x1fc904[_0x7efc('0x1b')]?_0x1fc904[_0x7efc('0x1b')]['limit']||null:null,'include':_0x1fc904[_0x7efc('0x1b')]?_0x1fc904[_0x7efc('0x1b')][_0x7efc('0x1f')]?_[_0x7efc('0x20')](_0x1fc904[_0x7efc('0x1b')][_0x7efc('0x1f')],function(_0x219b33){return{'model':db[_0x219b33[_0x7efc('0x21')]],'as':_0x219b33['as'],'attributes':_0x219b33[_0x7efc('0x1e')],'include':_0x219b33[_0x7efc('0x1f')]?_[_0x7efc('0x20')](_0x219b33[_0x7efc('0x1f')],function(_0x23794c){return{'model':db[_0x23794c[_0x7efc('0x21')]],'as':_0x23794c['as'],'attributes':_0x23794c[_0x7efc('0x1e')],'include':_0x23794c[_0x7efc('0x1f')]?_[_0x7efc('0x20')](_0x23794c[_0x7efc('0x1f')],function(_0x401975){return{'model':db[_0x401975['model']],'as':_0x401975['as'],'attributes':_0x401975[_0x7efc('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26bbb7){logger[_0x7efc('0x16')]('GetMemberReport',_0x1fc904);logger[_0x7efc('0xf')]('GetMemberReport',_0x1fc904,JSON[_0x7efc('0x12')](_0x26bbb7));_0x57a494(_0x26bbb7);})[_0x7efc('0x18')](function(_0x4efd77){logger[_0x7efc('0x13')](_0x7efc('0x19'),_0x4efd77[_0x7efc('0x15')],_0x1fc904);_0x3f51aa(_0x4bbe86['error'](0x1f4,_0x4efd77['message']));});});};exports[_0x7efc('0x22')]=function(_0x10ee3a){var _0x501ca0=this;return new Promise(function(_0x2187fc,_0x40fa8b){return db[_0x7efc('0x23')]['create'](_0x10ee3a[_0x7efc('0x24')],{'raw':_0x10ee3a[_0x7efc('0x1b')]?_0x10ee3a[_0x7efc('0x1b')][_0x7efc('0x1c')]===undefined?!![]:![]:!![]})[_0x7efc('0xd')](function(_0x1c079c){logger['info'](_0x7efc('0x22'),_0x10ee3a);logger[_0x7efc('0xf')]('CreateMemberReport',_0x10ee3a,JSON['stringify'](_0x1c079c));_0x2187fc(_0x1c079c);})['catch'](function(_0x5ed6d1){logger[_0x7efc('0x13')]('CreateMemberReport',_0x5ed6d1['message'],_0x10ee3a);_0x40fa8b(_0x501ca0['error'](0x1f4,_0x5ed6d1[_0x7efc('0x15')]));});});};exports[_0x7efc('0x25')]=function(_0x5380ff){var _0xc5a7f0=this;return new Promise(function(_0x23f7ed,_0x3b709c){return db[_0x7efc('0x23')]['update'](_0x5380ff['body'],{'raw':_0x5380ff[_0x7efc('0x1b')]?_0x5380ff['options'][_0x7efc('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5380ff[_0x7efc('0x1b')]?_0x5380ff['options'][_0x7efc('0x1d')]||null:null,'attributes':_0x5380ff[_0x7efc('0x1b')]?_0x5380ff[_0x7efc('0x1b')][_0x7efc('0x1e')]||null:null,'limit':_0x5380ff[_0x7efc('0x1b')]?_0x5380ff[_0x7efc('0x1b')][_0x7efc('0x26')]||null:null})[_0x7efc('0xd')](function(_0xd1cc7a){logger[_0x7efc('0x16')]('UpdateMemberReport',_0x5380ff);logger[_0x7efc('0xf')]('UpdateMemberReport',_0x5380ff,JSON['stringify'](_0xd1cc7a));_0x23f7ed(_0xd1cc7a);})[_0x7efc('0x18')](function(_0x8c7c37){logger[_0x7efc('0x13')](_0x7efc('0x25'),_0x8c7c37['message'],_0x5380ff);_0x3b709c(_0xc5a7f0[_0x7efc('0x13')](0x1f4,_0x8c7c37[_0x7efc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index ef4e51f..5a0b2ec 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 _0xb10b=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','multer','path'];(function(_0x5b5e9b,_0x28dd83){var _0x4d6705=function(_0x3851b4){while(--_0x3851b4){_0x5b5e9b['push'](_0x5b5e9b['shift']());}};_0x4d6705(++_0x28dd83);}(_0xb10b,0x12a));var _0xbb10=function(_0x310832,_0xe72c7e){_0x310832=_0x310832-0x0;var _0x103f74=_0xb10b[_0x310832];return _0x103f74;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',controller[_0xbb10('0x9')]);module['exports']=router; \ No newline at end of file +var _0x7334=['path','Router','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util'];(function(_0x4cc100,_0x56fddc){var _0x40fb43=function(_0x58973d){while(--_0x58973d){_0x4cc100['push'](_0x4cc100['shift']());}};_0x40fb43(++_0x56fddc);}(_0x7334,0x184));var _0x4733=function(_0x3f8ef5,_0x2677cf){_0x3f8ef5=_0x3f8ef5-0x0;var _0x36276e=_0x7334[_0x3f8ef5];return _0x36276e;};'use strict';var multer=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var path=require(_0x4733('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4733('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4733('0x4'));var config=require(_0x4733('0x5'));var controller=require(_0x4733('0x6'));router[_0x4733('0x7')]('/',controller[_0x4733('0x8')]);module[_0x4733('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 524a82b..7a51919 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 _0x08a1=['sequelize','exports','STRING','version'];(function(_0x41b41d,_0x717fc0){var _0x1b9543=function(_0x72c1a2){while(--_0x72c1a2){_0x41b41d['push'](_0x41b41d['shift']());}};_0x1b9543(++_0x717fc0);}(_0x08a1,0x12c));var _0x108a=function(_0x14f973,_0x584751){_0x14f973=_0x14f973-0x0;var _0x10757e=_0x08a1[_0x14f973];return _0x10757e;};'use strict';var Sequelize=require(_0x108a('0x0'));module[_0x108a('0x1')]={'version':{'type':Sequelize[_0x108a('0x2')],'unique':_0x108a('0x3')}}; \ No newline at end of file +var _0x58aa=['STRING','version','sequelize','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x58aa,0xf2));var _0xa58a=function(_0x19765b,_0x5035c0){_0x19765b=_0x19765b-0x0;var _0x1a85db=_0x58aa[_0x19765b];return _0x1a85db;};'use strict';var Sequelize=require(_0xa58a('0x0'));module[_0xa58a('0x1')]={'version':{'type':Sequelize[_0xa58a('0x2')],'unique':_0xa58a('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 9323359..8e1579d 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 _0x5f2f=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','fieldName','type','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','Migration','then','include','rows','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x2a70a2,_0x5aa49a){var _0x512092=function(_0x3512a0){while(--_0x3512a0){_0x2a70a2['push'](_0x2a70a2['shift']());}};_0x512092(++_0x5aa49a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5ec01d,_0x2bc9b6){_0x5ec01d=_0x5ec01d-0x0;var _0x186225=_0x5f2f[_0x5ec01d];return _0x186225;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var db=require(_0xf5f2('0x16'))['db'];function respondWithStatusCode(_0x14b51f,_0x331482){_0x331482=_0x331482||0xcc;return function(_0x3f2997){if(_0x3f2997){return _0x14b51f[_0xf5f2('0x17')](_0x331482);}return _0x14b51f[_0xf5f2('0x18')](_0x331482)['end']();};}function respondWithResult(_0x5850f4,_0xea612c){_0xea612c=_0xea612c||0xc8;return function(_0x269909){if(_0x269909){return _0x5850f4[_0xf5f2('0x18')](_0xea612c)[_0xf5f2('0x19')](_0x269909);}};}function respondWithFilteredResult(_0x4d97fc,_0xafe430){return function(_0x286197){if(_0x286197){var _0x17d656=_0x286197[_0xf5f2('0x1a')],_0x1b6dd2=_0xafe430[_0xf5f2('0x1b')],_0x23e23a=_0xafe430[_0xf5f2('0x1b')]+_0xafe430[_0xf5f2('0x1c')],_0x3a9dbb;if(_0x23e23a>=_0x17d656){_0x23e23a=_0x17d656;_0x3a9dbb=0xc8;}else{_0x3a9dbb=0xce;}_0x4d97fc[_0xf5f2('0x18')](_0x3a9dbb);return _0x4d97fc[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x1b6dd2+'-'+_0x23e23a+'/'+_0x17d656)[_0xf5f2('0x19')](_0x286197);}return null;};}function patchUpdates(_0x3cf5ea){return function(_0x626999){try{jsonpatch[_0xf5f2('0x1f')](_0x626999,_0x3cf5ea,!![]);}catch(_0x56acc5){return BPromise[_0xf5f2('0x20')](_0x56acc5);}return _0x626999[_0xf5f2('0x21')]();};}function saveUpdates(_0x49dac2,_0x47acfc){return function(_0x2d2805){if(_0x2d2805){return _0x2d2805[_0xf5f2('0x22')](_0x49dac2)['then'](function(_0x45b74f){return _0x45b74f;});}return null;};}function removeEntity(_0x170042,_0x39e44a){return function(_0x39c024){if(_0x39c024){return _0x39c024[_0xf5f2('0x23')]()['then'](function(){_0x170042[_0xf5f2('0x18')](0xcc)[_0xf5f2('0x24')]();});}};}function handleEntityNotFound(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(!_0x287ad5){_0x4e8bda['sendStatus'](0x194);}return _0x287ad5;};}function handleError(_0x529f07,_0x5f1124){_0x5f1124=_0x5f1124||0x1f4;return function(_0x3f79d5){logger[_0xf5f2('0x25')](_0x3f79d5[_0xf5f2('0x26')]);if(_0x3f79d5[_0xf5f2('0x27')]){delete _0x3f79d5[_0xf5f2('0x27')];}_0x529f07[_0xf5f2('0x18')](_0x5f1124)[_0xf5f2('0x28')](_0x3f79d5);};}exports[_0xf5f2('0x29')]=function(_0x4ab014,_0xaa2602){var _0x102449={},_0x375ca8={},_0x31bfcb={'count':0x0,'rows':[]};var _0x198c73=_[_0xf5f2('0x2a')](db['Migration']['rawAttributes'],function(_0x22c826){return{'name':_0x22c826[_0xf5f2('0x2b')],'type':_0x22c826[_0xf5f2('0x2c')]['key']};});_0x375ca8['model']=_[_0xf5f2('0x2a')](_0x198c73,_0xf5f2('0x27'));_0x375ca8[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x4ab014[_0xf5f2('0x2d')]);_0x375ca8['filters']=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],_0x375ca8['query']);_0x102449[_0xf5f2('0x30')]=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x102449[_0xf5f2('0x30')]=_0x102449[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x102449[_0xf5f2('0x30')]:_0x375ca8['model'];if(!_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x33')](_0xf5f2('0x34'))){_0x102449[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x1c')]);_0x102449['offset']=qs[_0xf5f2('0x1b')](_0x4ab014[_0xf5f2('0x2d')]['offset']);}_0x102449[_0xf5f2('0x35')]=qs['sort'](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x36')]);_0x102449[_0xf5f2('0x37')]=qs[_0xf5f2('0x38')](_['pick'](_0x4ab014['query'],_0x375ca8[_0xf5f2('0x38')]));if(_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]){_0x102449['where']=_[_0xf5f2('0x3a')](_0x102449['where'],{'$or':_[_0xf5f2('0x2a')](_0x198c73,function(_0x566c47){if(_0x566c47[_0xf5f2('0x2c')]!==_0xf5f2('0x3b')){var _0x5337a6={};_0x5337a6[_0x566c47[_0xf5f2('0x27')]]={'$like':'%'+_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]+'%'};return _0x5337a6;}})});}_0x102449=_[_0xf5f2('0x3a')]({},_0x102449,_0x4ab014['options']);var _0x5d2d82={'where':_0x102449[_0xf5f2('0x37')]};return db[_0xf5f2('0x3c')][_0xf5f2('0x1a')](_0x5d2d82)[_0xf5f2('0x3d')](function(_0x2c7f65){_0x31bfcb[_0xf5f2('0x1a')]=_0x2c7f65;if(_0x4ab014[_0xf5f2('0x2d')]['includeAll']){_0x102449[_0xf5f2('0x3e')]=[{'all':!![]}];}return db[_0xf5f2('0x3c')]['findAll'](_0x102449);})[_0xf5f2('0x3d')](function(_0x3f3895){_0x31bfcb[_0xf5f2('0x3f')]=_0x3f3895;return _0x31bfcb;})[_0xf5f2('0x3d')](respondWithFilteredResult(_0xaa2602,_0x102449))[_0xf5f2('0x40')](handleError(_0xaa2602,null));}; \ No newline at end of file +var _0x5f2f=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','fieldName','type','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','Migration','then','include','rows','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x37e9b4,_0x1608f7){var _0x4bc7ff=function(_0x38cd44){while(--_0x38cd44){_0x37e9b4['push'](_0x37e9b4['shift']());}};_0x4bc7ff(++_0x1608f7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x57daa8,_0x10a51c){_0x57daa8=_0x57daa8-0x0;var _0x510f0f=_0x5f2f[_0x57daa8];return _0x510f0f;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var db=require(_0xf5f2('0x16'))['db'];function respondWithStatusCode(_0x14b51f,_0x331482){_0x331482=_0x331482||0xcc;return function(_0x3f2997){if(_0x3f2997){return _0x14b51f[_0xf5f2('0x17')](_0x331482);}return _0x14b51f[_0xf5f2('0x18')](_0x331482)['end']();};}function respondWithResult(_0x5850f4,_0xea612c){_0xea612c=_0xea612c||0xc8;return function(_0x269909){if(_0x269909){return _0x5850f4[_0xf5f2('0x18')](_0xea612c)[_0xf5f2('0x19')](_0x269909);}};}function respondWithFilteredResult(_0x4d97fc,_0xafe430){return function(_0x286197){if(_0x286197){var _0x17d656=_0x286197[_0xf5f2('0x1a')],_0x1b6dd2=_0xafe430[_0xf5f2('0x1b')],_0x23e23a=_0xafe430[_0xf5f2('0x1b')]+_0xafe430[_0xf5f2('0x1c')],_0x3a9dbb;if(_0x23e23a>=_0x17d656){_0x23e23a=_0x17d656;_0x3a9dbb=0xc8;}else{_0x3a9dbb=0xce;}_0x4d97fc[_0xf5f2('0x18')](_0x3a9dbb);return _0x4d97fc[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x1b6dd2+'-'+_0x23e23a+'/'+_0x17d656)[_0xf5f2('0x19')](_0x286197);}return null;};}function patchUpdates(_0x3cf5ea){return function(_0x626999){try{jsonpatch[_0xf5f2('0x1f')](_0x626999,_0x3cf5ea,!![]);}catch(_0x56acc5){return BPromise[_0xf5f2('0x20')](_0x56acc5);}return _0x626999[_0xf5f2('0x21')]();};}function saveUpdates(_0x49dac2,_0x47acfc){return function(_0x2d2805){if(_0x2d2805){return _0x2d2805[_0xf5f2('0x22')](_0x49dac2)['then'](function(_0x45b74f){return _0x45b74f;});}return null;};}function removeEntity(_0x170042,_0x39e44a){return function(_0x39c024){if(_0x39c024){return _0x39c024[_0xf5f2('0x23')]()['then'](function(){_0x170042[_0xf5f2('0x18')](0xcc)[_0xf5f2('0x24')]();});}};}function handleEntityNotFound(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(!_0x287ad5){_0x4e8bda['sendStatus'](0x194);}return _0x287ad5;};}function handleError(_0x529f07,_0x5f1124){_0x5f1124=_0x5f1124||0x1f4;return function(_0x3f79d5){logger[_0xf5f2('0x25')](_0x3f79d5[_0xf5f2('0x26')]);if(_0x3f79d5[_0xf5f2('0x27')]){delete _0x3f79d5[_0xf5f2('0x27')];}_0x529f07[_0xf5f2('0x18')](_0x5f1124)[_0xf5f2('0x28')](_0x3f79d5);};}exports[_0xf5f2('0x29')]=function(_0x4ab014,_0xaa2602){var _0x102449={},_0x375ca8={},_0x31bfcb={'count':0x0,'rows':[]};var _0x198c73=_[_0xf5f2('0x2a')](db['Migration']['rawAttributes'],function(_0x22c826){return{'name':_0x22c826[_0xf5f2('0x2b')],'type':_0x22c826[_0xf5f2('0x2c')]['key']};});_0x375ca8['model']=_[_0xf5f2('0x2a')](_0x198c73,_0xf5f2('0x27'));_0x375ca8[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x4ab014[_0xf5f2('0x2d')]);_0x375ca8['filters']=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],_0x375ca8['query']);_0x102449[_0xf5f2('0x30')]=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x102449[_0xf5f2('0x30')]=_0x102449[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x102449[_0xf5f2('0x30')]:_0x375ca8['model'];if(!_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x33')](_0xf5f2('0x34'))){_0x102449[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x1c')]);_0x102449['offset']=qs[_0xf5f2('0x1b')](_0x4ab014[_0xf5f2('0x2d')]['offset']);}_0x102449[_0xf5f2('0x35')]=qs['sort'](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x36')]);_0x102449[_0xf5f2('0x37')]=qs[_0xf5f2('0x38')](_['pick'](_0x4ab014['query'],_0x375ca8[_0xf5f2('0x38')]));if(_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]){_0x102449['where']=_[_0xf5f2('0x3a')](_0x102449['where'],{'$or':_[_0xf5f2('0x2a')](_0x198c73,function(_0x566c47){if(_0x566c47[_0xf5f2('0x2c')]!==_0xf5f2('0x3b')){var _0x5337a6={};_0x5337a6[_0x566c47[_0xf5f2('0x27')]]={'$like':'%'+_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]+'%'};return _0x5337a6;}})});}_0x102449=_[_0xf5f2('0x3a')]({},_0x102449,_0x4ab014['options']);var _0x5d2d82={'where':_0x102449[_0xf5f2('0x37')]};return db[_0xf5f2('0x3c')][_0xf5f2('0x1a')](_0x5d2d82)[_0xf5f2('0x3d')](function(_0x2c7f65){_0x31bfcb[_0xf5f2('0x1a')]=_0x2c7f65;if(_0x4ab014[_0xf5f2('0x2d')]['includeAll']){_0x102449[_0xf5f2('0x3e')]=[{'all':!![]}];}return db[_0xf5f2('0x3c')]['findAll'](_0x102449);})[_0xf5f2('0x3d')](function(_0x3f3895){_0x31bfcb[_0xf5f2('0x3f')]=_0x3f3895;return _0x31bfcb;})[_0xf5f2('0x3d')](respondWithFilteredResult(_0xaa2602,_0x102449))[_0xf5f2('0x40')](handleError(_0xaa2602,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 8e74e3d..98e0ff3 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 _0xf1e4=['Migration','migrations','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./migration.attributes','exports','define'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0xf1e4,0xb8));var _0x4f1e=function(_0x46a463,_0x2d1711){_0x46a463=_0x46a463-0x0;var _0x3d614a=_0xf1e4[_0x46a463];return _0x3d614a;};'use strict';var _=require(_0x4f1e('0x0'));var util=require(_0x4f1e('0x1'));var logger=require('../../config/logger')(_0x4f1e('0x2'));var moment=require(_0x4f1e('0x3'));var BPromise=require(_0x4f1e('0x4'));var rp=require(_0x4f1e('0x5'));var fs=require('fs');var path=require(_0x4f1e('0x6'));var rimraf=require('rimraf');var config=require(_0x4f1e('0x7'));var attributes=require(_0x4f1e('0x8'));module[_0x4f1e('0x9')]=function(_0x4d44ea,_0x51250b){return _0x4d44ea[_0x4f1e('0xa')](_0x4f1e('0xb'),attributes,{'tableName':_0x4f1e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3731=['../../config/environment','./migration.attributes','exports','define','migrations','lodash','util','api','moment','request-promise','path'];(function(_0x32b487,_0x316e17){var _0x68b22a=function(_0x4e2351){while(--_0x4e2351){_0x32b487['push'](_0x32b487['shift']());}};_0x68b22a(++_0x316e17);}(_0x3731,0x9f));var _0x1373=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3731[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x1373('0x0'));var util=require(_0x1373('0x1'));var logger=require('../../config/logger')(_0x1373('0x2'));var moment=require(_0x1373('0x3'));var BPromise=require('bluebird');var rp=require(_0x1373('0x4'));var fs=require('fs');var path=require(_0x1373('0x5'));var rimraf=require('rimraf');var config=require(_0x1373('0x6'));var attributes=require(_0x1373('0x7'));module[_0x1373('0x8')]=function(_0xd17613,_0x48b658){return _0xd17613[_0x1373('0x9')]('Migration',attributes,{'tableName':_0x1373('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 f781897..5c6ce9c 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 _0x5fcf=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x44d435,_0x5666ac){var _0x1e9450=function(_0x34106c){while(--_0x34106c){_0x44d435['push'](_0x44d435['shift']());}};_0x1e9450(++_0x5666ac);}(_0x5fcf,0xf3));var _0xf5fc=function(_0x54ed1a,_0x398b01){_0x54ed1a=_0x54ed1a-0x0;var _0x22933c=_0x5fcf[_0x54ed1a];return _0x22933c;};'use strict';var _=require(_0xf5fc('0x0'));var util=require(_0xf5fc('0x1'));var moment=require(_0xf5fc('0x2'));var BPromise=require(_0xf5fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf5fc('0x4'));var db=require(_0xf5fc('0x5'))['db'];var utils=require(_0xf5fc('0x6'));var logger=require(_0xf5fc('0x7'))('rpc');var config=require(_0xf5fc('0x8'));var jayson=require(_0xf5fc('0x9'));var client=jayson[_0xf5fc('0xa')][_0xf5fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a876b,_0x5453dc,_0x4a6449){return new BPromise(function(_0x110fa3,_0x187877){return client[_0xf5fc('0xc')](_0x3a876b,_0x4a6449)[_0xf5fc('0xd')](function(_0x13621e){logger['info'](_0xf5fc('0xe'),_0x5453dc,_0xf5fc('0xf'));logger[_0xf5fc('0x10')](_0xf5fc('0x11'),_0x5453dc,_0xf5fc('0xf'),JSON[_0xf5fc('0x12')](_0x13621e));if(_0x13621e[_0xf5fc('0x13')]){if(_0x13621e['error'][_0xf5fc('0x14')]===0x1f4){logger[_0xf5fc('0x13')]('Migration,\x20%s,\x20%s',_0x5453dc,_0x13621e['error']['message']);return _0x187877(_0x13621e[_0xf5fc('0x13')][_0xf5fc('0x15')]);}logger['error'](_0xf5fc('0xe'),_0x5453dc,_0x13621e[_0xf5fc('0x13')][_0xf5fc('0x15')]);return _0x110fa3(_0x13621e[_0xf5fc('0x13')][_0xf5fc('0x15')]);}else{logger[_0xf5fc('0x16')](_0xf5fc('0xe'),_0x5453dc,_0xf5fc('0xf'));_0x110fa3(_0x13621e[_0xf5fc('0x17')][_0xf5fc('0x15')]);}})[_0xf5fc('0x18')](function(_0x242e6e){logger[_0xf5fc('0x13')](_0xf5fc('0xe'),_0x5453dc,_0x242e6e);_0x187877(_0x242e6e);});});} \ No newline at end of file +var _0xa962=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','stringify','error','message','Migration,\x20%s,\x20%s','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1b3956,_0x3ea00e){var _0xc47bdc=function(_0x317688){while(--_0x317688){_0x1b3956['push'](_0x1b3956['shift']());}};_0xc47bdc(++_0x3ea00e);}(_0xa962,0xea));var _0x2a96=function(_0x5a1cca,_0x2a8755){_0x5a1cca=_0x5a1cca-0x0;var _0x4fa83a=_0xa962[_0x5a1cca];return _0x4fa83a;};'use strict';var _=require(_0x2a96('0x0'));var util=require(_0x2a96('0x1'));var moment=require('moment');var BPromise=require(_0x2a96('0x2'));var rs=require(_0x2a96('0x3'));var fs=require('fs');var Redis=require(_0x2a96('0x4'));var db=require(_0x2a96('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2a96('0x6'))(_0x2a96('0x7'));var config=require(_0x2a96('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2a96('0x9')][_0x2a96('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2dcf0c,_0x60e02,_0x2d3300){return new BPromise(function(_0x5499d6,_0x438363){return client[_0x2a96('0xb')](_0x2dcf0c,_0x2d3300)[_0x2a96('0xc')](function(_0x4d8e6a){logger[_0x2a96('0xd')]('Migration,\x20%s,\x20%s',_0x60e02,_0x2a96('0xe'));logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0x60e02,_0x2a96('0xe'),JSON[_0x2a96('0xf')](_0x4d8e6a));if(_0x4d8e6a['error']){if(_0x4d8e6a[_0x2a96('0x10')]['code']===0x1f4){logger[_0x2a96('0x10')]('Migration,\x20%s,\x20%s',_0x60e02,_0x4d8e6a[_0x2a96('0x10')][_0x2a96('0x11')]);return _0x438363(_0x4d8e6a[_0x2a96('0x10')]['message']);}logger['error'](_0x2a96('0x12'),_0x60e02,_0x4d8e6a['error'][_0x2a96('0x11')]);return _0x5499d6(_0x4d8e6a[_0x2a96('0x10')]['message']);}else{logger['info'](_0x2a96('0x12'),_0x60e02,'request\x20sent');_0x5499d6(_0x4d8e6a[_0x2a96('0x13')][_0x2a96('0x11')]);}})['catch'](function(_0x3238ad){logger[_0x2a96('0x10')](_0x2a96('0x12'),_0x60e02,_0x3238ad);_0x438363(_0x3238ad);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 10ea054..fcc6112 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 _0x8daf=['destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','show','post','isAuthenticated','put','update','delete','/:id'];(function(_0x3ff623,_0xf3acd1){var _0xb5f8d4=function(_0x209c68){while(--_0x209c68){_0x3ff623['push'](_0x3ff623['shift']());}};_0xb5f8d4(++_0xf3acd1);}(_0x8daf,0xf9));var _0xf8da=function(_0x300860,_0x509371){_0x300860=_0x300860-0x0;var _0x2094ad=_0x8daf[_0x300860];return _0x2094ad;};'use strict';var multer=require(_0xf8da('0x0'));var util=require(_0xf8da('0x1'));var path=require('path');var timeout=require(_0xf8da('0x2'));var express=require(_0xf8da('0x3'));var router=express['Router']();var auth=require(_0xf8da('0x4'));var interaction=require(_0xf8da('0x5'));var config=require(_0xf8da('0x6'));var controller=require(_0xf8da('0x7'));router[_0xf8da('0x8')]('/',auth['isAuthenticated'](),controller[_0xf8da('0x9')]);router[_0xf8da('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf8da('0xa')]);router[_0xf8da('0xb')]('/',auth[_0xf8da('0xc')](),controller['create']);router[_0xf8da('0xd')]('/:id',auth[_0xf8da('0xc')](),controller[_0xf8da('0xe')]);router[_0xf8da('0xf')](_0xf8da('0x10'),auth['isAuthenticated'](),controller[_0xf8da('0x11')]);module[_0xf8da('0x12')]=router; \ No newline at end of file +var _0x2371=['express','Router','../../components/auth/service','../../components/interaction/service','./network.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','multer','util','path','connect-timeout'];(function(_0x28b366,_0x57407f){var _0x311a0d=function(_0x14f095){while(--_0x14f095){_0x28b366['push'](_0x28b366['shift']());}};_0x311a0d(++_0x57407f);}(_0x2371,0x140));var _0x1237=function(_0x2d126e,_0x1e8257){_0x2d126e=_0x2d126e-0x0;var _0xcb04d3=_0x2371[_0x2d126e];return _0xcb04d3;};'use strict';var multer=require(_0x1237('0x0'));var util=require(_0x1237('0x1'));var path=require(_0x1237('0x2'));var timeout=require(_0x1237('0x3'));var express=require(_0x1237('0x4'));var router=express[_0x1237('0x5')]();var auth=require(_0x1237('0x6'));var interaction=require(_0x1237('0x7'));var config=require('../../config/environment');var controller=require(_0x1237('0x8'));router[_0x1237('0x9')]('/',auth['isAuthenticated'](),controller[_0x1237('0xa')]);router['get'](_0x1237('0xb'),auth[_0x1237('0xc')](),controller[_0x1237('0xd')]);router[_0x1237('0xe')]('/',auth['isAuthenticated'](),controller[_0x1237('0xf')]);router[_0x1237('0x10')](_0x1237('0xb'),auth['isAuthenticated'](),controller[_0x1237('0x11')]);router['delete'](_0x1237('0xb'),auth[_0x1237('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index f035386..b7d6ae7 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(_0x4a5bf5,_0xe5ebe0){var _0x3d08dc=function(_0x196e41){while(--_0x196e41){_0x4a5bf5['push'](_0x4a5bf5['shift']());}};_0x3d08dc(++_0xe5ebe0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x46ac00,_0x2e0f7b){var _0x25a670=function(_0x13e5aa){while(--_0x13e5aa){_0x46ac00['push'](_0x46ac00['shift']());}};_0x25a670(++_0x2e0f7b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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 8c1ddb9..f329a0b 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 _0xd90a=['type','VIRTUAL','merge','options','includeAll','findAll','keys','include','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','update','params','find','chan_sip.so','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','message','Network,\x20%s,\x20%s','result','catch','sendStatus','status','json','offset','Content-Range','reject','destroy','stack','name','send','Network','rawAttributes','fieldName','key','map','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','filter','where'];(function(_0x5a26c5,_0x3ee715){var _0x1d6565=function(_0x5daa72){while(--_0x5daa72){_0x5a26c5['push'](_0x5a26c5['shift']());}};_0x1d6565(++_0x3ee715);}(_0xd90a,0x1cb));var _0xad90=function(_0x5cba78,_0x3e1e1c){_0x5cba78=_0x5cba78-0x0;var _0x3af348=_0xd90a[_0x5cba78];return _0x3af348;};'use strict';var pdf=require(_0xad90('0x0'));var emlformat=require(_0xad90('0x1'));var rimraf=require(_0xad90('0x2'));var zipdir=require(_0xad90('0x3'));var jsonpatch=require(_0xad90('0x4'));var rp=require(_0xad90('0x5'));var moment=require(_0xad90('0x6'));var BPromise=require(_0xad90('0x7'));var Mustache=require('mustache');var util=require(_0xad90('0x8'));var path=require(_0xad90('0x9'));var sox=require(_0xad90('0xa'));var csv=require(_0xad90('0xb'));var ejs=require(_0xad90('0xc'));var fs=require('fs');var _=require(_0xad90('0xd'));var squel=require(_0xad90('0xe'));var crypto=require(_0xad90('0xf'));var jsforce=require(_0xad90('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xad90('0x11'));var Papa=require(_0xad90('0x12'));var Redis=require(_0xad90('0x13'));var authService=require(_0xad90('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xad90('0x15'));var hardwareService=require(_0xad90('0x16'));var logger=require(_0xad90('0x17'))(_0xad90('0x18'));var utils=require('../../config/utils');var config=require(_0xad90('0x19'));var db=require(_0xad90('0x1a'))['db'];var jayson=require(_0xad90('0x1b'));var client=jayson[_0xad90('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x15a3bc,_0x58fd1b,_0x35f86b){if(_0x35f86b){var _0x27e2d0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x27e2d0[_0xad90('0x1d')](_0x58fd1b)){return _0x15a3bc;}else{throw new db[(_0xad90('0x1e'))][(_0xad90('0x1f'))](_0xad90('0x20'));}}else{return _0x15a3bc;}}function respondWithRpcPromise(_0x33e905,_0x52a466,_0x5eb612,_0x2dd3a5){return new BPromise(function(_0xde717f,_0x4d7cce){var _0x41bd9d=_0x2dd3a5||client;return _0x41bd9d[_0xad90('0x21')](_0x33e905,_0x5eb612)[_0xad90('0x22')](function(_0x104206){logger['info']('Network,\x20%s,\x20%s',_0x52a466,_0xad90('0x23'));logger['debug'](_0xad90('0x24'),_0x52a466,_0xad90('0x23'),JSON['stringify'](_0x104206));if(_0x104206[_0xad90('0x25')]){if(_0x104206[_0xad90('0x25')]['code']===0x1f4){logger[_0xad90('0x25')]('Network,\x20%s,\x20%s',_0x52a466,_0x104206['error'][_0xad90('0x26')]);return _0x4d7cce(_0x104206['error'][_0xad90('0x26')]);}logger['error'](_0xad90('0x27'),_0x52a466,_0x104206[_0xad90('0x25')]['message']);return _0xde717f(_0x104206[_0xad90('0x25')][_0xad90('0x26')]);}else{logger['info'](_0xad90('0x27'),_0x52a466,_0xad90('0x23'));_0xde717f(_0x104206[_0xad90('0x28')]['message']);}})[_0xad90('0x29')](function(_0x292195){logger[_0xad90('0x25')](_0xad90('0x27'),_0x52a466,_0x292195);_0x4d7cce(_0x292195);});});}function respondWithStatusCode(_0x4ad6a0,_0x20c2c9){_0x20c2c9=_0x20c2c9||0xcc;return function(_0x595682){if(_0x595682){return _0x4ad6a0[_0xad90('0x2a')](_0x20c2c9);}return _0x4ad6a0[_0xad90('0x2b')](_0x20c2c9)['end']();};}function respondWithResult(_0x51d43c,_0x5def55){_0x5def55=_0x5def55||0xc8;return function(_0x465943){if(_0x465943){return _0x51d43c[_0xad90('0x2b')](_0x5def55)[_0xad90('0x2c')](_0x465943);}};}function respondWithFilteredResult(_0x41313d,_0x417698){return function(_0x12fa80){if(_0x12fa80){var _0x4bc246=_0x12fa80['count'],_0x259670=_0x417698[_0xad90('0x2d')],_0x313454=_0x417698[_0xad90('0x2d')]+_0x417698['limit'],_0x26e10c;if(_0x313454>=_0x4bc246){_0x313454=_0x4bc246;_0x26e10c=0xc8;}else{_0x26e10c=0xce;}_0x41313d[_0xad90('0x2b')](_0x26e10c);return _0x41313d['set'](_0xad90('0x2e'),_0x259670+'-'+_0x313454+'/'+_0x4bc246)[_0xad90('0x2c')](_0x12fa80);}return null;};}function patchUpdates(_0x5b98ae){return function(_0x5aede3){try{jsonpatch['apply'](_0x5aede3,_0x5b98ae,!![]);}catch(_0x6988a0){return BPromise[_0xad90('0x2f')](_0x6988a0);}return _0x5aede3['save']();};}function saveUpdates(_0x55aa5f,_0x1b34a2){return function(_0x581d3f){if(_0x581d3f){return _0x581d3f['update'](_0x55aa5f)[_0xad90('0x22')](function(_0x41112e){return _0x41112e;});}return null;};}function removeEntity(_0x49a8d2,_0x2b24ae){return function(_0x1f5b69){if(_0x1f5b69){return _0x1f5b69[_0xad90('0x30')]()[_0xad90('0x22')](function(){_0x49a8d2[_0xad90('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ec0df,_0x1c96fa){return function(_0x2771bf){if(!_0x2771bf){_0x3ec0df[_0xad90('0x2a')](0x194);}return _0x2771bf;};}function handleError(_0x5242f0,_0x225001){_0x225001=_0x225001||0x1f4;return function(_0x382cdc){logger[_0xad90('0x25')](_0x382cdc[_0xad90('0x31')]);if(_0x382cdc['name']){delete _0x382cdc[_0xad90('0x32')];}_0x5242f0['status'](_0x225001)[_0xad90('0x33')](_0x382cdc);};}exports['index']=function(_0x44d0f1,_0x2fea10){var _0x22301e={},_0x328a5b={},_0x5ad718={'count':0x0,'rows':[]};var _0x37ac63=_['map'](db[_0xad90('0x34')][_0xad90('0x35')],function(_0x5f2892){return{'name':_0x5f2892[_0xad90('0x36')],'type':_0x5f2892['type'][_0xad90('0x37')]};});_0x328a5b['model']=_[_0xad90('0x38')](_0x37ac63,_0xad90('0x32'));_0x328a5b[_0xad90('0x39')]=_['keys'](_0x44d0f1['query']);_0x328a5b['filters']=_[_0xad90('0x3a')](_0x328a5b[_0xad90('0x3b')],_0x328a5b['query']);_0x22301e[_0xad90('0x3c')]=_[_0xad90('0x3a')](_0x328a5b[_0xad90('0x3b')],qs['fields'](_0x44d0f1[_0xad90('0x39')][_0xad90('0x3d')]));_0x22301e[_0xad90('0x3c')]=_0x22301e[_0xad90('0x3c')][_0xad90('0x3e')]?_0x22301e[_0xad90('0x3c')]:_0x328a5b['model'];if(!_0x44d0f1[_0xad90('0x39')][_0xad90('0x3f')](_0xad90('0x40'))){_0x22301e[_0xad90('0x41')]=qs[_0xad90('0x41')](_0x44d0f1[_0xad90('0x39')]['limit']);_0x22301e[_0xad90('0x2d')]=qs[_0xad90('0x2d')](_0x44d0f1[_0xad90('0x39')][_0xad90('0x2d')]);}_0x22301e[_0xad90('0x42')]=qs['sort'](_0x44d0f1['query'][_0xad90('0x43')]);_0x22301e['where']=qs['filters'](_['pick'](_0x44d0f1[_0xad90('0x39')],_0x328a5b[_0xad90('0x44')]));if(_0x44d0f1[_0xad90('0x39')][_0xad90('0x45')]){_0x22301e[_0xad90('0x46')]=_['merge'](_0x22301e[_0xad90('0x46')],{'$or':_[_0xad90('0x38')](_0x37ac63,function(_0x540109){if(_0x540109[_0xad90('0x47')]!==_0xad90('0x48')){var _0x4d7181={};_0x4d7181[_0x540109[_0xad90('0x32')]]={'$like':'%'+_0x44d0f1[_0xad90('0x39')][_0xad90('0x45')]+'%'};return _0x4d7181;}})});}_0x22301e=_[_0xad90('0x49')]({},_0x22301e,_0x44d0f1[_0xad90('0x4a')]);var _0x80614e={'where':_0x22301e[_0xad90('0x46')]};return db[_0xad90('0x34')]['count'](_0x80614e)[_0xad90('0x22')](function(_0x2be683){_0x5ad718['count']=_0x2be683;if(_0x44d0f1['query'][_0xad90('0x4b')]){_0x22301e['include']=[{'all':!![]}];}return db[_0xad90('0x34')][_0xad90('0x4c')](_0x22301e);})[_0xad90('0x22')](function(_0x5868ae){_0x5ad718['rows']=_0x5868ae;return _0x5ad718;})[_0xad90('0x22')](respondWithFilteredResult(_0x2fea10,_0x22301e))[_0xad90('0x29')](handleError(_0x2fea10,null));};exports['show']=function(_0x5352de,_0x42a074){var _0xaae53a={'raw':!![],'where':{'id':_0x5352de['params']['id']}},_0x3942ba={};_0x3942ba[_0xad90('0x3b')]=_[_0xad90('0x4d')](db['Network'][_0xad90('0x35')]);_0x3942ba[_0xad90('0x39')]=_[_0xad90('0x4d')](_0x5352de[_0xad90('0x39')]);_0x3942ba[_0xad90('0x44')]=_['intersection'](_0x3942ba[_0xad90('0x3b')],_0x3942ba[_0xad90('0x39')]);_0xaae53a['attributes']=_[_0xad90('0x3a')](_0x3942ba['model'],qs[_0xad90('0x3d')](_0x5352de['query']['fields']));_0xaae53a['attributes']=_0xaae53a[_0xad90('0x3c')]['length']?_0xaae53a[_0xad90('0x3c')]:_0x3942ba['model'];if(_0x5352de[_0xad90('0x39')]['includeAll']){_0xaae53a[_0xad90('0x4e')]=[{'all':!![]}];}_0xaae53a=_[_0xad90('0x49')]({},_0xaae53a,_0x5352de[_0xad90('0x4a')]);return db[_0xad90('0x34')]['find'](_0xaae53a)[_0xad90('0x22')](handleEntityNotFound(_0x42a074,null))[_0xad90('0x22')](respondWithResult(_0x42a074,null))[_0xad90('0x29')](handleError(_0x42a074,null));};exports[_0xad90('0x4f')]=function(_0xa1250a,_0x429835,_0x401c91){var _0x1a6dc7;return db[_0xad90('0x50')][_0xad90('0x51')](function(_0x3f0081){return db[_0xad90('0x34')][_0xad90('0x4f')](_0xa1250a[_0xad90('0x52')],{'raw':!![]})['then'](function(_0x338ad3){_0x1a6dc7=_0x338ad3;return db[_0xad90('0x34')][_0xad90('0x4c')]({'where':{'type':_0xa1250a[_0xad90('0x52')]['type']},'raw':!![]});})[_0xad90('0x22')](function(_0x3c3575){if(_0x1a6dc7[_0xad90('0x47')][_0xad90('0x53')]()==_0xad90('0x54')){var _0x2a4c91=fs[_0xad90('0x55')](path[_0xad90('0x56')](config[_0xad90('0x57')],_0xad90('0x58')),'utf8');var _0x19a965=ejs[_0xad90('0x59')](_0x2a4c91,{'networks':_0x3c3575||[]});fs[_0xad90('0x5a')](_0xad90('0x5b'),_0x19a965);return respondWithRpcPromise('Reload',_0xad90('0x4f'),{'module':_0xad90('0x5c')});}else if(_0x1a6dc7[_0xad90('0x47')][_0xad90('0x53')]()==_0xad90('0x5d')){var _0x1015f5=fs[_0xad90('0x55')](path[_0xad90('0x56')](config['root'],_0xad90('0x5e')),_0xad90('0x5f'));var _0x58a5c1=ejs[_0xad90('0x59')](_0x1015f5,{'networks':_0x3c3575||[]});fs[_0xad90('0x5a')](_0xad90('0x60'),_0x58a5c1);return respondWithRpcPromise(_0xad90('0x61'),'create',{'module':_0xad90('0x5c')});}else{var _0x42fc0d=fs[_0xad90('0x55')](path[_0xad90('0x56')](config[_0xad90('0x57')],_0xad90('0x62')),_0xad90('0x5f'));var _0xf9bdd=ejs[_0xad90('0x59')](_0x42fc0d,{'networks':_0x3c3575||[]});fs[_0xad90('0x5a')](util[_0xad90('0x63')](_0xad90('0x64'),_0xa1250a[_0xad90('0x52')][_0xad90('0x47')][_0xad90('0x65')]()),_0xf9bdd);return respondWithRpcPromise(_0xad90('0x61'),_0xad90('0x4f'),{'module':'chan_sip.so'});}return null;})[_0xad90('0x22')](function(){return _0x1a6dc7;});})[_0xad90('0x22')](respondWithResult(_0x429835,0xc9))[_0xad90('0x29')](handleError(_0x429835,null));};exports[_0xad90('0x66')]=function(_0xb256b5,_0x142ed2,_0x200fa8){var _0x553e26;return db[_0xad90('0x50')][_0xad90('0x51')](function(_0x4cea77){return db[_0xad90('0x34')]['find']({'where':{'id':_0xb256b5[_0xad90('0x67')]['id']}})[_0xad90('0x22')](handleEntityNotFound(_0x142ed2,null))[_0xad90('0x22')](saveUpdates(_0xb256b5[_0xad90('0x52')],null))[_0xad90('0x22')](function(_0x5018a5){if(_0x5018a5){_0x553e26=_0x5018a5;return db['Network'][_0xad90('0x4c')]({'where':{'type':_0x553e26['type']},'raw':!![]});}return null;})[_0xad90('0x22')](function(_0x11960f){if(_0x553e26['type']['toUpperCase']()==_0xad90('0x54')){var _0x5ca6d2=fs[_0xad90('0x55')](path[_0xad90('0x56')](config[_0xad90('0x57')],_0xad90('0x58')),_0xad90('0x5f'));var _0x4ded18=ejs[_0xad90('0x59')](_0x5ca6d2,{'networks':_0x11960f||[]});fs[_0xad90('0x5a')](_0xad90('0x5b'),_0x4ded18);return respondWithRpcPromise(_0xad90('0x61'),_0xad90('0x66'),{'module':_0xad90('0x5c')});}else if(_0x553e26['type'][_0xad90('0x53')]()==_0xad90('0x5d')){var _0x2f20ef=fs['readFileSync'](path[_0xad90('0x56')](config[_0xad90('0x57')],_0xad90('0x5e')),_0xad90('0x5f'));var _0x584790=ejs[_0xad90('0x59')](_0x2f20ef,{'networks':_0x11960f||[]});fs['writeFileSync'](_0xad90('0x60'),_0x584790);return respondWithRpcPromise(_0xad90('0x61'),_0xad90('0x66'),{'module':'res_stun_monitor.so'});}else{var _0x2e8227=fs[_0xad90('0x55')](path[_0xad90('0x56')](config['root'],_0xad90('0x62')),_0xad90('0x5f'));var _0x240255=ejs[_0xad90('0x59')](_0x2e8227,{'networks':_0x11960f||[]});fs[_0xad90('0x5a')](util[_0xad90('0x63')](_0xad90('0x64'),_0xb256b5['body'][_0xad90('0x47')][_0xad90('0x65')]()),_0x240255);return respondWithRpcPromise('Reload',_0xad90('0x66'),{'module':'chan_sip.so'});}return null;})[_0xad90('0x22')](function(_0x1504f4){if(_0x1504f4){return _0x553e26;}return null;});})[_0xad90('0x22')](respondWithResult(_0x142ed2,null))['catch'](handleError(_0x142ed2,null));};exports[_0xad90('0x30')]=function(_0x4331b9,_0x1dd05f,_0x56bd8d){var _0x5268e8;return db[_0xad90('0x34')][_0xad90('0x68')]({'where':{'id':_0x4331b9[_0xad90('0x67')]['id']}})[_0xad90('0x22')](function(_0x314e29){_0x5268e8=_0x314e29;return _0x314e29;})[_0xad90('0x22')](handleEntityNotFound(_0x1dd05f,null))[_0xad90('0x22')](removeEntity(_0x1dd05f,null))[_0xad90('0x22')](function(){if(_0x5268e8){return db[_0xad90('0x34')]['findAll']({'where':{'type':_0x5268e8[_0xad90('0x47')]},'raw':!![]});}})[_0xad90('0x22')](function(_0x4331be){if(_0x5268e8[_0xad90('0x47')][_0xad90('0x53')]()=='STUN'){var _0x3c8330=fs[_0xad90('0x55')](path[_0xad90('0x56')](config[_0xad90('0x57')],'server/files/templates/stun_multiple.ejs'),_0xad90('0x5f'));var _0x1d21c0=ejs[_0xad90('0x59')](_0x3c8330,{'networks':_0x4331be||[]});fs[_0xad90('0x5a')](_0xad90('0x5b'),_0x1d21c0);return respondWithRpcPromise(_0xad90('0x61'),_0xad90('0x30'),{'module':_0xad90('0x5c')});}else if(_0x5268e8[_0xad90('0x47')][_0xad90('0x53')]()=='TURN'){var _0x46e10f=fs[_0xad90('0x55')](path[_0xad90('0x56')](config[_0xad90('0x57')],_0xad90('0x5e')),_0xad90('0x5f'));var _0x53cdbc=ejs[_0xad90('0x59')](_0x46e10f,{'networks':_0x4331be||[]});fs[_0xad90('0x5a')](_0xad90('0x60'),_0x53cdbc);return respondWithRpcPromise(_0xad90('0x61'),_0xad90('0x30'),{'module':_0xad90('0x5c')});}else{var _0x54ccca=fs[_0xad90('0x55')](path[_0xad90('0x56')](config['root'],_0xad90('0x62')),'utf8');var _0x17b915=ejs[_0xad90('0x59')](_0x54ccca,{'networks':_0x4331be||[]});fs['writeFileSync'](util[_0xad90('0x63')](_0xad90('0x64'),_0x4331b9[_0xad90('0x52')][_0xad90('0x47')][_0xad90('0x65')]()),_0x17b915);return respondWithRpcPromise(_0xad90('0x61'),'destroy',{'module':_0xad90('0x69')});}return null;})[_0xad90('0x29')](handleError(_0x1dd05f,null));}; \ No newline at end of file +var _0xa3ad=['The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','sendStatus','status','end','offset','set','Content-Range','json','reject','save','update','destroy','stack','name','send','index','Network','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','show','params','length','options','find','create','sequelize','body','STUN','join','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','readFileSync','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','transaction','server/files/templates/stun_multiple.ejs','TURN','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','jayson/promise','client','http','Sequelize','ValidationError'];(function(_0x47d0a2,_0x31c041){var _0x255e54=function(_0x18886f){while(--_0x18886f){_0x47d0a2['push'](_0x47d0a2['shift']());}};_0x255e54(++_0x31c041);}(_0xa3ad,0x130));var _0xda3a=function(_0x3de1c8,_0xf3b9a8){_0x3de1c8=_0x3de1c8-0x0;var _0xf5d04b=_0xa3ad[_0x3de1c8];return _0xf5d04b;};'use strict';var pdf=require(_0xda3a('0x0'));var emlformat=require(_0xda3a('0x1'));var rimraf=require(_0xda3a('0x2'));var zipdir=require(_0xda3a('0x3'));var jsonpatch=require(_0xda3a('0x4'));var rp=require(_0xda3a('0x5'));var moment=require(_0xda3a('0x6'));var BPromise=require(_0xda3a('0x7'));var Mustache=require(_0xda3a('0x8'));var util=require(_0xda3a('0x9'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xda3a('0xa'));var fs=require('fs');var _=require(_0xda3a('0xb'));var squel=require(_0xda3a('0xc'));var crypto=require(_0xda3a('0xd'));var jsforce=require(_0xda3a('0xe'));var deskjs=require(_0xda3a('0xf'));var toCsv=require(_0xda3a('0x10'));var querystring=require(_0xda3a('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xda3a('0x12'));var qs=require(_0xda3a('0x13'));var as=require(_0xda3a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xda3a('0x15'));var utils=require(_0xda3a('0x16'));var config=require(_0xda3a('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xda3a('0x18'));var client=jayson[_0xda3a('0x19')][_0xda3a('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x182f85,_0x32b2ff,_0x463522){if(_0x463522){var _0x19c2c8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x19c2c8['test'](_0x32b2ff)){return _0x182f85;}else{throw new db[(_0xda3a('0x1b'))][(_0xda3a('0x1c'))](_0xda3a('0x1d'));}}else{return _0x182f85;}}function respondWithRpcPromise(_0x4c82c1,_0x1de2b0,_0x4b9ebd,_0x969b68){return new BPromise(function(_0x5928df,_0xbe3a11){var _0x1b9401=_0x969b68||client;return _0x1b9401[_0xda3a('0x1e')](_0x4c82c1,_0x4b9ebd)[_0xda3a('0x1f')](function(_0x3f380c){logger[_0xda3a('0x20')](_0xda3a('0x21'),_0x1de2b0,_0xda3a('0x22'));logger[_0xda3a('0x23')](_0xda3a('0x24'),_0x1de2b0,_0xda3a('0x22'),JSON['stringify'](_0x3f380c));if(_0x3f380c['error']){if(_0x3f380c['error'][_0xda3a('0x25')]===0x1f4){logger[_0xda3a('0x26')](_0xda3a('0x21'),_0x1de2b0,_0x3f380c[_0xda3a('0x26')][_0xda3a('0x27')]);return _0xbe3a11(_0x3f380c['error'][_0xda3a('0x27')]);}logger[_0xda3a('0x26')]('Network,\x20%s,\x20%s',_0x1de2b0,_0x3f380c[_0xda3a('0x26')]['message']);return _0x5928df(_0x3f380c[_0xda3a('0x26')][_0xda3a('0x27')]);}else{logger[_0xda3a('0x20')](_0xda3a('0x21'),_0x1de2b0,_0xda3a('0x22'));_0x5928df(_0x3f380c[_0xda3a('0x28')]['message']);}})[_0xda3a('0x29')](function(_0x17db3d){logger[_0xda3a('0x26')](_0xda3a('0x21'),_0x1de2b0,_0x17db3d);_0xbe3a11(_0x17db3d);});});}function respondWithStatusCode(_0x28a8f6,_0x4ef86f){_0x4ef86f=_0x4ef86f||0xcc;return function(_0x27b09c){if(_0x27b09c){return _0x28a8f6[_0xda3a('0x2a')](_0x4ef86f);}return _0x28a8f6[_0xda3a('0x2b')](_0x4ef86f)[_0xda3a('0x2c')]();};}function respondWithResult(_0x80dd7d,_0x23c1a1){_0x23c1a1=_0x23c1a1||0xc8;return function(_0x13df7f){if(_0x13df7f){return _0x80dd7d[_0xda3a('0x2b')](_0x23c1a1)['json'](_0x13df7f);}};}function respondWithFilteredResult(_0xd1e58f,_0xa3543a){return function(_0x3abeb5){if(_0x3abeb5){var _0x2a664e=_0x3abeb5['count'],_0x93a8cd=_0xa3543a[_0xda3a('0x2d')],_0x89b7cb=_0xa3543a[_0xda3a('0x2d')]+_0xa3543a['limit'],_0x25468c;if(_0x89b7cb>=_0x2a664e){_0x89b7cb=_0x2a664e;_0x25468c=0xc8;}else{_0x25468c=0xce;}_0xd1e58f[_0xda3a('0x2b')](_0x25468c);return _0xd1e58f[_0xda3a('0x2e')](_0xda3a('0x2f'),_0x93a8cd+'-'+_0x89b7cb+'/'+_0x2a664e)[_0xda3a('0x30')](_0x3abeb5);}return null;};}function patchUpdates(_0x2c1ec5){return function(_0x2cc954){try{jsonpatch['apply'](_0x2cc954,_0x2c1ec5,!![]);}catch(_0x12f280){return BPromise[_0xda3a('0x31')](_0x12f280);}return _0x2cc954[_0xda3a('0x32')]();};}function saveUpdates(_0x54be91,_0x2b56d9){return function(_0x1d8ef5){if(_0x1d8ef5){return _0x1d8ef5[_0xda3a('0x33')](_0x54be91)[_0xda3a('0x1f')](function(_0x2b09da){return _0x2b09da;});}return null;};}function removeEntity(_0x17eb95,_0x2b5847){return function(_0x5bd034){if(_0x5bd034){return _0x5bd034[_0xda3a('0x34')]()[_0xda3a('0x1f')](function(){_0x17eb95['status'](0xcc)[_0xda3a('0x2c')]();});}};}function handleEntityNotFound(_0x142e08,_0x13eda){return function(_0x15d74e){if(!_0x15d74e){_0x142e08[_0xda3a('0x2a')](0x194);}return _0x15d74e;};}function handleError(_0x3624ee,_0x26d2ab){_0x26d2ab=_0x26d2ab||0x1f4;return function(_0x52754f){logger['error'](_0x52754f[_0xda3a('0x35')]);if(_0x52754f[_0xda3a('0x36')]){delete _0x52754f['name'];}_0x3624ee[_0xda3a('0x2b')](_0x26d2ab)[_0xda3a('0x37')](_0x52754f);};}exports[_0xda3a('0x38')]=function(_0x1f7140,_0x3c8343){var _0x6a546a={},_0x15944b={},_0x46930e={'count':0x0,'rows':[]};var _0x42447e=_['map'](db[_0xda3a('0x39')][_0xda3a('0x3a')],function(_0x5ef981){return{'name':_0x5ef981['fieldName'],'type':_0x5ef981[_0xda3a('0x3b')][_0xda3a('0x3c')]};});_0x15944b[_0xda3a('0x3d')]=_[_0xda3a('0x3e')](_0x42447e,_0xda3a('0x36'));_0x15944b[_0xda3a('0x3f')]=_[_0xda3a('0x40')](_0x1f7140[_0xda3a('0x3f')]);_0x15944b[_0xda3a('0x41')]=_[_0xda3a('0x42')](_0x15944b[_0xda3a('0x3d')],_0x15944b[_0xda3a('0x3f')]);_0x6a546a['attributes']=_['intersection'](_0x15944b[_0xda3a('0x3d')],qs[_0xda3a('0x43')](_0x1f7140[_0xda3a('0x3f')][_0xda3a('0x43')]));_0x6a546a['attributes']=_0x6a546a[_0xda3a('0x44')]['length']?_0x6a546a[_0xda3a('0x44')]:_0x15944b[_0xda3a('0x3d')];if(!_0x1f7140[_0xda3a('0x3f')][_0xda3a('0x45')](_0xda3a('0x46'))){_0x6a546a[_0xda3a('0x47')]=qs['limit'](_0x1f7140['query'][_0xda3a('0x47')]);_0x6a546a[_0xda3a('0x2d')]=qs['offset'](_0x1f7140[_0xda3a('0x3f')][_0xda3a('0x2d')]);}_0x6a546a['order']=qs[_0xda3a('0x48')](_0x1f7140['query'][_0xda3a('0x48')]);_0x6a546a[_0xda3a('0x49')]=qs['filters'](_[_0xda3a('0x4a')](_0x1f7140[_0xda3a('0x3f')],_0x15944b[_0xda3a('0x41')]));if(_0x1f7140[_0xda3a('0x3f')][_0xda3a('0x4b')]){_0x6a546a[_0xda3a('0x49')]=_[_0xda3a('0x4c')](_0x6a546a['where'],{'$or':_['map'](_0x42447e,function(_0x535f12){if(_0x535f12['type']!==_0xda3a('0x4d')){var _0x8e17ff={};_0x8e17ff[_0x535f12[_0xda3a('0x36')]]={'$like':'%'+_0x1f7140[_0xda3a('0x3f')][_0xda3a('0x4b')]+'%'};return _0x8e17ff;}})});}_0x6a546a=_['merge']({},_0x6a546a,_0x1f7140['options']);var _0x580b69={'where':_0x6a546a[_0xda3a('0x49')]};return db[_0xda3a('0x39')][_0xda3a('0x4e')](_0x580b69)[_0xda3a('0x1f')](function(_0x484e8d){_0x46930e[_0xda3a('0x4e')]=_0x484e8d;if(_0x1f7140[_0xda3a('0x3f')][_0xda3a('0x4f')]){_0x6a546a['include']=[{'all':!![]}];}return db[_0xda3a('0x39')][_0xda3a('0x50')](_0x6a546a);})[_0xda3a('0x1f')](function(_0x2f5403){_0x46930e[_0xda3a('0x51')]=_0x2f5403;return _0x46930e;})[_0xda3a('0x1f')](respondWithFilteredResult(_0x3c8343,_0x6a546a))[_0xda3a('0x29')](handleError(_0x3c8343,null));};exports[_0xda3a('0x52')]=function(_0x2d2921,_0x3c3c93){var _0x521b24={'raw':!![],'where':{'id':_0x2d2921[_0xda3a('0x53')]['id']}},_0x1fdb2f={};_0x1fdb2f[_0xda3a('0x3d')]=_[_0xda3a('0x40')](db[_0xda3a('0x39')][_0xda3a('0x3a')]);_0x1fdb2f['query']=_[_0xda3a('0x40')](_0x2d2921[_0xda3a('0x3f')]);_0x1fdb2f[_0xda3a('0x41')]=_['intersection'](_0x1fdb2f[_0xda3a('0x3d')],_0x1fdb2f[_0xda3a('0x3f')]);_0x521b24[_0xda3a('0x44')]=_[_0xda3a('0x42')](_0x1fdb2f[_0xda3a('0x3d')],qs[_0xda3a('0x43')](_0x2d2921[_0xda3a('0x3f')]['fields']));_0x521b24[_0xda3a('0x44')]=_0x521b24[_0xda3a('0x44')][_0xda3a('0x54')]?_0x521b24[_0xda3a('0x44')]:_0x1fdb2f[_0xda3a('0x3d')];if(_0x2d2921[_0xda3a('0x3f')][_0xda3a('0x4f')]){_0x521b24['include']=[{'all':!![]}];}_0x521b24=_[_0xda3a('0x4c')]({},_0x521b24,_0x2d2921[_0xda3a('0x55')]);return db[_0xda3a('0x39')][_0xda3a('0x56')](_0x521b24)['then'](handleEntityNotFound(_0x3c3c93,null))['then'](respondWithResult(_0x3c3c93,null))[_0xda3a('0x29')](handleError(_0x3c3c93,null));};exports[_0xda3a('0x57')]=function(_0x3702f3,_0x4c61a1,_0x326eac){var _0x42cb6b;return db[_0xda3a('0x58')]['transaction'](function(_0x4d9b82){return db[_0xda3a('0x39')][_0xda3a('0x57')](_0x3702f3[_0xda3a('0x59')],{'raw':!![]})[_0xda3a('0x1f')](function(_0x4ff0f2){_0x42cb6b=_0x4ff0f2;return db[_0xda3a('0x39')][_0xda3a('0x50')]({'where':{'type':_0x3702f3['body']['type']},'raw':!![]});})['then'](function(_0x1d1dbf){if(_0x42cb6b[_0xda3a('0x3b')]['toUpperCase']()==_0xda3a('0x5a')){var _0x4f6d1f=fs['readFileSync'](path[_0xda3a('0x5b')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xda3a('0x5c'));var _0x47edc2=ejs[_0xda3a('0x5d')](_0x4f6d1f,{'networks':_0x1d1dbf||[]});fs[_0xda3a('0x5e')](_0xda3a('0x5f'),_0x47edc2);return respondWithRpcPromise(_0xda3a('0x60'),'create',{'module':_0xda3a('0x61')});}else if(_0x42cb6b[_0xda3a('0x3b')][_0xda3a('0x62')]()=='TURN'){var _0x4cdba1=fs['readFileSync'](path['join'](config[_0xda3a('0x63')],_0xda3a('0x64')),'utf8');var _0x49ffbc=ejs['render'](_0x4cdba1,{'networks':_0x1d1dbf||[]});fs[_0xda3a('0x5e')](_0xda3a('0x65'),_0x49ffbc);return respondWithRpcPromise(_0xda3a('0x60'),_0xda3a('0x57'),{'module':_0xda3a('0x61')});}else{var _0x44b0d0=fs[_0xda3a('0x66')](path['join'](config[_0xda3a('0x63')],_0xda3a('0x67')),_0xda3a('0x5c'));var _0x46377d=ejs[_0xda3a('0x5d')](_0x44b0d0,{'networks':_0x1d1dbf||[]});fs[_0xda3a('0x5e')](util[_0xda3a('0x68')](_0xda3a('0x69'),_0x3702f3[_0xda3a('0x59')][_0xda3a('0x3b')][_0xda3a('0x6a')]()),_0x46377d);return respondWithRpcPromise(_0xda3a('0x60'),'create',{'module':_0xda3a('0x6b')});}return null;})[_0xda3a('0x1f')](function(){return _0x42cb6b;});})['then'](respondWithResult(_0x4c61a1,0xc9))[_0xda3a('0x29')](handleError(_0x4c61a1,null));};exports[_0xda3a('0x33')]=function(_0x22c8fc,_0x3a2432,_0x335b92){var _0x2dd1b0;return db['sequelize'][_0xda3a('0x6c')](function(_0x236019){return db[_0xda3a('0x39')][_0xda3a('0x56')]({'where':{'id':_0x22c8fc[_0xda3a('0x53')]['id']}})[_0xda3a('0x1f')](handleEntityNotFound(_0x3a2432,null))[_0xda3a('0x1f')](saveUpdates(_0x22c8fc[_0xda3a('0x59')],null))[_0xda3a('0x1f')](function(_0x13557c){if(_0x13557c){_0x2dd1b0=_0x13557c;return db[_0xda3a('0x39')][_0xda3a('0x50')]({'where':{'type':_0x2dd1b0[_0xda3a('0x3b')]},'raw':!![]});}return null;})[_0xda3a('0x1f')](function(_0x5a0ed2){if(_0x2dd1b0['type'][_0xda3a('0x62')]()==_0xda3a('0x5a')){var _0x50324d=fs['readFileSync'](path[_0xda3a('0x5b')](config[_0xda3a('0x63')],_0xda3a('0x6d')),'utf8');var _0x50358d=ejs[_0xda3a('0x5d')](_0x50324d,{'networks':_0x5a0ed2||[]});fs[_0xda3a('0x5e')](_0xda3a('0x5f'),_0x50358d);return respondWithRpcPromise(_0xda3a('0x60'),_0xda3a('0x33'),{'module':_0xda3a('0x61')});}else if(_0x2dd1b0[_0xda3a('0x3b')][_0xda3a('0x62')]()==_0xda3a('0x6e')){var _0x411540=fs['readFileSync'](path['join'](config[_0xda3a('0x63')],'server/files/templates/turn_multiple.ejs'),_0xda3a('0x5c'));var _0x32d298=ejs['render'](_0x411540,{'networks':_0x5a0ed2||[]});fs[_0xda3a('0x5e')](_0xda3a('0x65'),_0x32d298);return respondWithRpcPromise(_0xda3a('0x60'),_0xda3a('0x33'),{'module':_0xda3a('0x61')});}else{var _0x191ace=fs[_0xda3a('0x66')](path[_0xda3a('0x5b')](config[_0xda3a('0x63')],'server/files/templates/network.ejs'),_0xda3a('0x5c'));var _0x330c99=ejs['render'](_0x191ace,{'networks':_0x5a0ed2||[]});fs[_0xda3a('0x5e')](util[_0xda3a('0x68')]('/etc/asterisk/sip_xcally_%s.conf',_0x22c8fc[_0xda3a('0x59')][_0xda3a('0x3b')]['toLowerCase']()),_0x330c99);return respondWithRpcPromise('Reload','update',{'module':_0xda3a('0x6b')});}return null;})['then'](function(_0x2277a6){if(_0x2277a6){return _0x2dd1b0;}return null;});})[_0xda3a('0x1f')](respondWithResult(_0x3a2432,null))[_0xda3a('0x29')](handleError(_0x3a2432,null));};exports[_0xda3a('0x34')]=function(_0x11d21a,_0x244edd,_0x425341){var _0x143748;return db['Network'][_0xda3a('0x56')]({'where':{'id':_0x11d21a[_0xda3a('0x53')]['id']}})[_0xda3a('0x1f')](function(_0x5cdb5a){_0x143748=_0x5cdb5a;return _0x5cdb5a;})[_0xda3a('0x1f')](handleEntityNotFound(_0x244edd,null))[_0xda3a('0x1f')](removeEntity(_0x244edd,null))['then'](function(){if(_0x143748){return db['Network'][_0xda3a('0x50')]({'where':{'type':_0x143748[_0xda3a('0x3b')]},'raw':!![]});}})[_0xda3a('0x1f')](function(_0x374c30){if(_0x143748[_0xda3a('0x3b')][_0xda3a('0x62')]()=='STUN'){var _0x9d25cd=fs[_0xda3a('0x66')](path[_0xda3a('0x5b')](config[_0xda3a('0x63')],_0xda3a('0x6d')),_0xda3a('0x5c'));var _0xbde764=ejs[_0xda3a('0x5d')](_0x9d25cd,{'networks':_0x374c30||[]});fs[_0xda3a('0x5e')](_0xda3a('0x5f'),_0xbde764);return respondWithRpcPromise('Reload',_0xda3a('0x34'),{'module':_0xda3a('0x61')});}else if(_0x143748['type'][_0xda3a('0x62')]()==_0xda3a('0x6e')){var _0x4d7409=fs[_0xda3a('0x66')](path[_0xda3a('0x5b')](config[_0xda3a('0x63')],_0xda3a('0x64')),_0xda3a('0x5c'));var _0x11319d=ejs[_0xda3a('0x5d')](_0x4d7409,{'networks':_0x374c30||[]});fs[_0xda3a('0x5e')]('/etc/asterisk/turn_xcally.conf',_0x11319d);return respondWithRpcPromise(_0xda3a('0x60'),_0xda3a('0x34'),{'module':'res_stun_monitor.so'});}else{var _0x3a8520=fs['readFileSync'](path['join'](config[_0xda3a('0x63')],_0xda3a('0x67')),_0xda3a('0x5c'));var _0x530943=ejs[_0xda3a('0x5d')](_0x3a8520,{'networks':_0x374c30||[]});fs[_0xda3a('0x5e')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x11d21a['body'][_0xda3a('0x3b')][_0xda3a('0x6a')]()),_0x530943);return respondWithRpcPromise(_0xda3a('0x60'),'destroy',{'module':'chan_sip.so'});}return null;})[_0xda3a('0x29')](handleError(_0x244edd,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index b1cac34..32d0d61 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 _0xcd3a=['../../config/environment','./network.attributes','exports','define','Network','lodash','util','../../config/logger','api','bluebird','rimraf'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xcd3a,0x73));var _0xacd3=function(_0x372c53,_0x70271){_0x372c53=_0x372c53-0x0;var _0x3bd8b4=_0xcd3a[_0x372c53];return _0x3bd8b4;};'use strict';var _=require(_0xacd3('0x0'));var util=require(_0xacd3('0x1'));var logger=require(_0xacd3('0x2'))(_0xacd3('0x3'));var moment=require('moment');var BPromise=require(_0xacd3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xacd3('0x5'));var config=require(_0xacd3('0x6'));var attributes=require(_0xacd3('0x7'));module[_0xacd3('0x8')]=function(_0x5f3fb8,_0x68eb01){return _0x5f3fb8[_0xacd3('0x9')](_0xacd3('0xa'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ba1=['request-promise','path','rimraf','../../config/environment','exports','define','Network','network','lodash','util','api','moment','bluebird'];(function(_0x1f8f72,_0x1c5882){var _0x1ea333=function(_0x585727){while(--_0x585727){_0x1f8f72['push'](_0x1f8f72['shift']());}};_0x1ea333(++_0x1c5882);}(_0x4ba1,0x140));var _0x14ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4ba1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x14ba('0x0'));var util=require(_0x14ba('0x1'));var logger=require('../../config/logger')(_0x14ba('0x2'));var moment=require(_0x14ba('0x3'));var BPromise=require(_0x14ba('0x4'));var rp=require(_0x14ba('0x5'));var fs=require('fs');var path=require(_0x14ba('0x6'));var rimraf=require(_0x14ba('0x7'));var config=require(_0x14ba('0x8'));var attributes=require('./network.attributes');module[_0x14ba('0x9')]=function(_0x4d9aaa,_0x46c3c2){return _0x4d9aaa[_0x14ba('0xa')](_0x14ba('0xb'),attributes,{'tableName':_0x14ba('0xc'),'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 73a4e2c..cb972e9 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 _0xc398=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','result','catch','lodash','moment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc398,0x102));var _0x8c39=function(_0x4de877,_0x340170){_0x4de877=_0x4de877-0x0;var _0xb2cfeb=_0xc398[_0x4de877];return _0xb2cfeb;};'use strict';var _=require(_0x8c39('0x0'));var util=require('util');var moment=require(_0x8c39('0x1'));var BPromise=require(_0x8c39('0x2'));var rs=require(_0x8c39('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c39('0x4'))['db'];var utils=require(_0x8c39('0x5'));var logger=require(_0x8c39('0x6'))(_0x8c39('0x7'));var config=require(_0x8c39('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x44480b,_0x4ce94b,_0x3cc090){return new BPromise(function(_0x5aae60,_0x434c8){return client[_0x8c39('0x9')](_0x44480b,_0x3cc090)[_0x8c39('0xa')](function(_0x440c96){logger['info']('Network,\x20%s,\x20%s',_0x4ce94b,'request\x20sent');logger[_0x8c39('0xb')](_0x8c39('0xc'),_0x4ce94b,'request\x20sent',JSON[_0x8c39('0xd')](_0x440c96));if(_0x440c96[_0x8c39('0xe')]){if(_0x440c96[_0x8c39('0xe')][_0x8c39('0xf')]===0x1f4){logger['error'](_0x8c39('0x10'),_0x4ce94b,_0x440c96[_0x8c39('0xe')][_0x8c39('0x11')]);return _0x434c8(_0x440c96[_0x8c39('0xe')][_0x8c39('0x11')]);}logger['error']('Network,\x20%s,\x20%s',_0x4ce94b,_0x440c96['error']['message']);return _0x5aae60(_0x440c96['error'][_0x8c39('0x11')]);}else{logger['info'](_0x8c39('0x10'),_0x4ce94b,'request\x20sent');_0x5aae60(_0x440c96[_0x8c39('0x12')]['message']);}})[_0x8c39('0x13')](function(_0x23e70b){logger[_0x8c39('0xe')](_0x8c39('0x10'),_0x4ce94b,_0x23e70b);_0x434c8(_0x23e70b);});});} \ No newline at end of file +var _0x3b2d=['util','moment','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x37d5b4,_0x34b696){var _0x2cbb20=function(_0x166b30){while(--_0x166b30){_0x37d5b4['push'](_0x37d5b4['shift']());}};_0x2cbb20(++_0x34b696);}(_0x3b2d,0x1b0));var _0xd3b2=function(_0x2509b8,_0xc3f866){_0x2509b8=_0x2509b8-0x0;var _0x1a2783=_0x3b2d[_0x2509b8];return _0x1a2783;};'use strict';var _=require('lodash');var util=require(_0xd3b2('0x0'));var moment=require(_0xd3b2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd3b2('0x2'));var db=require(_0xd3b2('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd3b2('0x4'))(_0xd3b2('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd3b2('0x6')][_0xd3b2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xbe3653,_0x49ba25,_0x12ffca){return new BPromise(function(_0x279685,_0x3a8d1b){return client[_0xd3b2('0x8')](_0xbe3653,_0x12ffca)['then'](function(_0x3e9c2a){logger[_0xd3b2('0x9')](_0xd3b2('0xa'),_0x49ba25,_0xd3b2('0xb'));logger[_0xd3b2('0xc')]('Network,\x20%s,\x20%s,\x20%s',_0x49ba25,_0xd3b2('0xb'),JSON[_0xd3b2('0xd')](_0x3e9c2a));if(_0x3e9c2a[_0xd3b2('0xe')]){if(_0x3e9c2a['error']['code']===0x1f4){logger[_0xd3b2('0xe')](_0xd3b2('0xa'),_0x49ba25,_0x3e9c2a[_0xd3b2('0xe')]['message']);return _0x3a8d1b(_0x3e9c2a[_0xd3b2('0xe')][_0xd3b2('0xf')]);}logger['error']('Network,\x20%s,\x20%s',_0x49ba25,_0x3e9c2a[_0xd3b2('0xe')]['message']);return _0x279685(_0x3e9c2a[_0xd3b2('0xe')][_0xd3b2('0xf')]);}else{logger[_0xd3b2('0x9')](_0xd3b2('0xa'),_0x49ba25,_0xd3b2('0xb'));_0x279685(_0x3e9c2a[_0xd3b2('0x10')][_0xd3b2('0xf')]);}})[_0xd3b2('0x11')](function(_0x59e4ea){logger['error'](_0xd3b2('0xa'),_0x49ba25,_0x59e4ea);_0x3a8d1b(_0x59e4ea);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 896375d..e40f073 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 _0x8f9e=['multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','sendNotification','exports'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x8f9e,0x118));var _0xe8f9=function(_0x29dedd,_0x3c7419){_0x29dedd=_0x29dedd-0x0;var _0x4e6d4f=_0x8f9e[_0x29dedd];return _0x4e6d4f;};'use strict';var multer=require(_0xe8f9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe8f9('0x1'));var express=require(_0xe8f9('0x2'));var router=express[_0xe8f9('0x3')]();var auth=require(_0xe8f9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe8f9('0x5'));var controller=require('./notification.controller');router['post']('/',auth['isAuthenticated'](),controller[_0xe8f9('0x6')]);module[_0xe8f9('0x7')]=router; \ No newline at end of file +var _0x12e1=['../../components/interaction/service','../../config/environment','./notification.controller','post','isAuthenticated','exports','multer','util','connect-timeout'];(function(_0x43e713,_0x522ed2){var _0x1a13dc=function(_0x100430){while(--_0x100430){_0x43e713['push'](_0x43e713['shift']());}};_0x1a13dc(++_0x522ed2);}(_0x12e1,0x10b));var _0x112e=function(_0x4c59e1,_0x48260d){_0x4c59e1=_0x4c59e1-0x0;var _0x13f677=_0x12e1[_0x4c59e1];return _0x13f677;};'use strict';var multer=require(_0x112e('0x0'));var util=require(_0x112e('0x1'));var path=require('path');var timeout=require(_0x112e('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x112e('0x3'));var config=require(_0x112e('0x4'));var controller=require(_0x112e('0x5'));router[_0x112e('0x6')]('/',auth[_0x112e('0x7')](),controller['sendNotification']);module[_0x112e('0x8')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index ed32348..842f70c 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 _0x690d=['STRING','TEXT','sequelize','exports'];(function(_0x5219ba,_0x5ee9a1){var _0x3ead29=function(_0x252f9a){while(--_0x252f9a){_0x5219ba['push'](_0x5219ba['shift']());}};_0x3ead29(++_0x5ee9a1);}(_0x690d,0x66));var _0xd690=function(_0x24e11a,_0x516f69){_0x24e11a=_0x24e11a-0x0;var _0x4901a6=_0x690d[_0x24e11a];return _0x4901a6;};'use strict';var Sequelize=require(_0xd690('0x0'));module[_0xd690('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xd690('0x2')]},'recipientsId':{'type':Sequelize[_0xd690('0x3')]},'recipientsDescription':{'type':Sequelize[_0xd690('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x8b7f=['BOOLEAN','sequelize','TEXT','STRING'];(function(_0x1be10e,_0x468f9d){var _0x1b360b=function(_0x255871){while(--_0x255871){_0x1be10e['push'](_0x1be10e['shift']());}};_0x1b360b(++_0x468f9d);}(_0x8b7f,0x12d));var _0xf8b7=function(_0x256baa,_0x10a3ea){_0x256baa=_0x256baa-0x0;var _0x15e012=_0x8b7f[_0x256baa];return _0x15e012;};'use strict';var Sequelize=require(_0xf8b7('0x0'));module['exports']={'body':{'type':Sequelize[_0xf8b7('0x1')]},'senderName':{'type':Sequelize[_0xf8b7('0x2')]},'recipientsId':{'type':Sequelize[_0xf8b7('0x1')]},'recipientsDescription':{'type':Sequelize[_0xf8b7('0x2')]},'beep':{'type':Sequelize[_0xf8b7('0x3')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 5b3d416..ab972be 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 _0x7730=['startCase','User','union','ids','queue','replace','Queue','all','flatten','findOne','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','save','update','then','destroy','name','send','sendNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','error','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','whatsappqueue','team','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','user','sortBy','join','sequelize','Notification','create','forEach','recipient','emit','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','catch'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x7730,0xd1));var _0x0773=function(_0x19f9e6,_0x4f59a6){_0x19f9e6=_0x19f9e6-0x0;var _0x45c862=_0x7730[_0x19f9e6];return _0x45c862;};'use strict';var pdf=require(_0x0773('0x0'));var emlformat=require(_0x0773('0x1'));var rimraf=require(_0x0773('0x2'));var zipdir=require(_0x0773('0x3'));var jsonpatch=require(_0x0773('0x4'));var rp=require(_0x0773('0x5'));var moment=require(_0x0773('0x6'));var BPromise=require(_0x0773('0x7'));var Mustache=require(_0x0773('0x8'));var util=require(_0x0773('0x9'));var path=require(_0x0773('0xa'));var sox=require(_0x0773('0xb'));var csv=require(_0x0773('0xc'));var ejs=require(_0x0773('0xd'));var fs=require('fs');var _=require(_0x0773('0xe'));var squel=require('squel');var crypto=require(_0x0773('0xf'));var jsforce=require(_0x0773('0x10'));var deskjs=require(_0x0773('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0773('0x12'));var hardwareService=require(_0x0773('0x13'));var logger=require(_0x0773('0x14'))(_0x0773('0x15'));var utils=require(_0x0773('0x16'));var config=require(_0x0773('0x17'));var db=require('../../mysqldb')['db'];config[_0x0773('0x18')]=_[_0x0773('0x19')](config['redis'],{'host':_0x0773('0x1a'),'port':0x18eb});var socket=require(_0x0773('0x1b'))(new Redis(config[_0x0773('0x18')]));require(_0x0773('0x1c'))[_0x0773('0x1d')](socket);function respondWithStatusCode(_0x1e0306,_0xbcbe6a){_0xbcbe6a=_0xbcbe6a||0xcc;return function(_0x2961b4){if(_0x2961b4){return _0x1e0306[_0x0773('0x1e')](_0xbcbe6a);}return _0x1e0306['status'](_0xbcbe6a)[_0x0773('0x1f')]();};}function respondWithResult(_0x2545af,_0x2755f5){_0x2755f5=_0x2755f5||0xc8;return function(_0x3bf3d6){if(_0x3bf3d6){return _0x2545af[_0x0773('0x20')](_0x2755f5)['json'](_0x3bf3d6);}};}function respondWithFilteredResult(_0x21c7f9,_0x2ff05f){return function(_0x5d1d5b){if(_0x5d1d5b){var _0x4b1980=_0x5d1d5b[_0x0773('0x21')],_0x33587a=_0x2ff05f[_0x0773('0x22')],_0x46b2fa=_0x2ff05f[_0x0773('0x22')]+_0x2ff05f[_0x0773('0x23')],_0xcfa95f;if(_0x46b2fa>=_0x4b1980){_0x46b2fa=_0x4b1980;_0xcfa95f=0xc8;}else{_0xcfa95f=0xce;}_0x21c7f9[_0x0773('0x20')](_0xcfa95f);return _0x21c7f9[_0x0773('0x24')]('Content-Range',_0x33587a+'-'+_0x46b2fa+'/'+_0x4b1980)[_0x0773('0x25')](_0x5d1d5b);}return null;};}function patchUpdates(_0x17fe5f){return function(_0xbc6e24){try{jsonpatch[_0x0773('0x26')](_0xbc6e24,_0x17fe5f,!![]);}catch(_0x2f664e){return BPromise['reject'](_0x2f664e);}return _0xbc6e24[_0x0773('0x27')]();};}function saveUpdates(_0x6f4fb5,_0x4c9be9){return function(_0x2809bb){if(_0x2809bb){return _0x2809bb[_0x0773('0x28')](_0x6f4fb5)[_0x0773('0x29')](function(_0x3fc98f){return _0x3fc98f;});}return null;};}function removeEntity(_0x3d11cb,_0x49f9b4){return function(_0x2ded15){if(_0x2ded15){return _0x2ded15[_0x0773('0x2a')]()[_0x0773('0x29')](function(){_0x3d11cb[_0x0773('0x20')](0xcc)[_0x0773('0x1f')]();});}};}function handleEntityNotFound(_0x2d0ef0,_0x490ae5){return function(_0x1e531a){if(!_0x1e531a){_0x2d0ef0['sendStatus'](0x194);}return _0x1e531a;};}function handleError(_0x2a6a88,_0x179976){_0x179976=_0x179976||0x1f4;return function(_0x27b28c){logger['error'](_0x27b28c['stack']);if(_0x27b28c[_0x0773('0x2b')]){delete _0x27b28c[_0x0773('0x2b')];}_0x2a6a88[_0x0773('0x20')](_0x179976)[_0x0773('0x2c')](_0x27b28c);};}exports[_0x0773('0x2d')]=function(_0x4e3129,_0x4dcd8c,_0x41339d){if(!_0x4e3129[_0x0773('0x2e')][_0x0773('0x2f')](_0x0773('0x30'))&&!_0x4e3129[_0x0773('0x2e')][_0x0773('0x2f')](_0x0773('0x31'))){throw new db[(_0x0773('0x32'))][(_0x0773('0x33'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x4e3129[_0x0773('0x2e')]['hasOwnProperty'](_0x0773('0x31'))&&!_0x4e3129[_0x0773('0x2e')]['hasOwnProperty']('view')){throw new db[(_0x0773('0x32'))][(_0x0773('0x33'))](_0x0773('0x34'));}if(!_0x4e3129[_0x0773('0x2e')][_0x0773('0x2f')]('recipients')){throw new db[(_0x0773('0x32'))]['ValidationError'](_0x0773('0x35'));}else{try{var _0x51c2a0=JSON[_0x0773('0x36')](_0x4e3129[_0x0773('0x2e')]['recipients']);}catch(_0x392002){logger[_0x0773('0x37')](_0x392002);throw new db[(_0x0773('0x32'))][(_0x0773('0x33'))]('Invalid\x20\x27recipients\x27\x20object');}var _0xe47fb3=[_0x0773('0x38'),_0x0773('0x39'),_0x0773('0x3a'),_0x0773('0x3b'),_0x0773('0x3c'),'voicequeue',_0x0773('0x3d'),_0x0773('0x3e'),'user'];if(_[_0x0773('0x3f')](_0x51c2a0,function(_0x595dae){return!_[_0x0773('0x40')](_0xe47fb3,_0x595dae[_0x0773('0x41')][_0x0773('0x42')]());})){throw new db['Sequelize'][(_0x0773('0x33'))](_0x0773('0x43'));}}}var _0x310781={};_0x310781['senderName']=_0x4e3129[_0x0773('0x2e')][_0x0773('0x2f')](_0x0773('0x44'))?_0x4e3129[_0x0773('0x2e')][_0x0773('0x44')]:_0x4e3129['user']['fullname'];_0x310781[_0x0773('0x45')]=_[_0x0773('0x46')](_0x4e3129[_0x0773('0x2e')][_0x0773('0x45')])?null:_0x4e3129[_0x0773('0x2e')]['recipientsDescription'];_0x310781[_0x0773('0x47')]=_0x4e3129[_0x0773('0x2e')][_0x0773('0x47')]||![];_0x310781[_0x0773('0x48')]=_0x4e3129[_0x0773('0x49')]['id'];return getContent(_0x4e3129[_0x0773('0x2e')])['then'](function(_0x3e89c8){_0x310781[_0x0773('0x2e')]=_0x3e89c8;return getRecipients(_0x51c2a0);})[_0x0773('0x29')](function(_0x258c4f){_0x310781['recipientsId']=_[_0x0773('0x4a')](_0x258c4f)[_0x0773('0x4b')](',');return db[_0x0773('0x4c')]['transaction'](function(_0x46b294){return db[_0x0773('0x4d')][_0x0773('0x4e')](_0x310781,{'raw':!![],'transaction':_0x46b294})[_0x0773('0x29')](function(_0x4cc287){var _0xb87537={'sender':_0x310781[_0x0773('0x44')],'description':_0x310781[_0x0773('0x45')],'content':_0x310781['body'],'beep':_0x310781[_0x0773('0x47')]};_0x258c4f[_0x0773('0x4f')](function(_0x3a7f11){_0xb87537[_0x0773('0x50')]=_0x3a7f11;socket[_0x0773('0x51')]('notification:send',_0xb87537);});return _0x4cc287;});});})[_0x0773('0x29')](respondWithResult(_0x4dcd8c,0xc9))['catch'](handleError(_0x4dcd8c,null));};function getContent(_0x2774d0){return new BPromise(function(_0x4d7c42,_0x3f1021){if(_0x2774d0['text']){_0x4d7c42(_0x2774d0['text']);return;}return db[_0x0773('0x52')]['findOne']({'attributes':[_0x0773('0x53')],'where':{'id':_0x2774d0[_0x0773('0x31')]},'raw':!![]})[_0x0773('0x29')](function(_0x4fde59){if(!_0x4fde59)throw new db['Sequelize'][(_0x0773('0x33'))](_0x0773('0x54'));var _0x3ccdd5=Mustache[_0x0773('0x55')](_0x4fde59[_0x0773('0x53')],_0x2774d0[_0x0773('0x56')]);_0x4d7c42(_0x3ccdd5);})[_0x0773('0x57')](function(_0x2ccfc9){_0x3f1021(_0x2ccfc9);});});}function getRecipients(_0x376835){return new BPromise(function(_0x43d853,_0x2b801a){var _0x2b3e7e=[];var _0x3ed3e0=[];_0x376835[_0x0773('0x4f')](function(_0x1a275){var _0x43fbce=_[_0x0773('0x58')](_0x1a275['model'][_0x0773('0x42')]());if(_0x43fbce===_0x0773('0x59')){_0x2b3e7e=_[_0x0773('0x5a')](_0x2b3e7e,_0x1a275[_0x0773('0x5b')]);}else{if(_[_0x0773('0x40')](_0x43fbce,_0x0773('0x5c')))_0x43fbce=_0x43fbce[_0x0773('0x5d')](_0x0773('0x5c'),_0x0773('0x5e'));_0x1a275[_0x0773('0x5b')][_0x0773('0x4f')](function(_0x37d14d){_0x3ed3e0['push'](getAgents(_0x43fbce,_0x37d14d));});}});return BPromise[_0x0773('0x5f')](_0x3ed3e0)[_0x0773('0x29')](function(_0x2cb2c5){_0x2b3e7e=_[_0x0773('0x5a')](_0x2b3e7e,_[_0x0773('0x60')](_0x2cb2c5));_0x43d853(_0x2b3e7e);})['catch'](function(_0x5aa59c){_0x2b801a(_0x5aa59c);});});}function getAgents(_0x7fcd10,_0x1b2003){return new BPromise(function(_0x148f53,_0xb29ef9){return db[_0x7fcd10][_0x0773('0x61')]({'where':{'id':_0x1b2003}})[_0x0773('0x29')](function(_0x3bcfb6){return _0x3bcfb6[_0x0773('0x62')]({'attributes':['id'],'raw':!![]})['then'](function(_0x159ad1){var _0x39585f=_['map'](_0x159ad1,'id');_0x148f53(_0x39585f);});})[_0x0773('0x57')](function(_0x2892df){_0xb29ef9(_0x2892df);});});} \ No newline at end of file +var _0x59d1=['text','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','chatqueue','openchannelqueue','smsqueue','whatsappqueue','some','model','toLowerCase','senderName','user','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','Notification','forEach','recipient','emit','notification:send','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','ids','includes','queue','replace','push','all','catch','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','sendStatus','status','end','json','count','limit','set','apply','reject','save','update','then','destroy','stack','name','send','sendNotification','body','hasOwnProperty'];(function(_0x1a5858,_0x41d401){var _0x22cbc3=function(_0x2552ef){while(--_0x2552ef){_0x1a5858['push'](_0x1a5858['shift']());}};_0x22cbc3(++_0x41d401);}(_0x59d1,0x92));var _0x159d=function(_0x2bd6b9,_0xba2ab){_0x2bd6b9=_0x2bd6b9-0x0;var _0x5859a9=_0x59d1[_0x2bd6b9];return _0x5859a9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x159d('0x0'));var rimraf=require(_0x159d('0x1'));var zipdir=require(_0x159d('0x2'));var jsonpatch=require(_0x159d('0x3'));var rp=require(_0x159d('0x4'));var moment=require('moment');var BPromise=require(_0x159d('0x5'));var Mustache=require(_0x159d('0x6'));var util=require(_0x159d('0x7'));var path=require(_0x159d('0x8'));var sox=require(_0x159d('0x9'));var csv=require('to-csv');var ejs=require(_0x159d('0xa'));var fs=require('fs');var _=require(_0x159d('0xb'));var squel=require(_0x159d('0xc'));var crypto=require(_0x159d('0xd'));var jsforce=require(_0x159d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x159d('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x159d('0x10'));var qs=require(_0x159d('0x11'));var as=require(_0x159d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x159d('0x13'))(_0x159d('0x14'));var utils=require(_0x159d('0x15'));var config=require('../../config/environment');var db=require(_0x159d('0x16'))['db'];config[_0x159d('0x17')]=_[_0x159d('0x18')](config[_0x159d('0x17')],{'host':_0x159d('0x19'),'port':0x18eb});var socket=require(_0x159d('0x1a'))(new Redis(config['redis']));require(_0x159d('0x1b'))[_0x159d('0x1c')](socket);function respondWithStatusCode(_0x28f43f,_0x541fe1){_0x541fe1=_0x541fe1||0xcc;return function(_0x1d6337){if(_0x1d6337){return _0x28f43f[_0x159d('0x1d')](_0x541fe1);}return _0x28f43f[_0x159d('0x1e')](_0x541fe1)[_0x159d('0x1f')]();};}function respondWithResult(_0x24c90c,_0x2f8171){_0x2f8171=_0x2f8171||0xc8;return function(_0x2cfdd8){if(_0x2cfdd8){return _0x24c90c[_0x159d('0x1e')](_0x2f8171)[_0x159d('0x20')](_0x2cfdd8);}};}function respondWithFilteredResult(_0x4d0ba0,_0x4d459a){return function(_0x35db77){if(_0x35db77){var _0x16baeb=_0x35db77[_0x159d('0x21')],_0x28f5ec=_0x4d459a['offset'],_0x577136=_0x4d459a['offset']+_0x4d459a[_0x159d('0x22')],_0x4bc849;if(_0x577136>=_0x16baeb){_0x577136=_0x16baeb;_0x4bc849=0xc8;}else{_0x4bc849=0xce;}_0x4d0ba0[_0x159d('0x1e')](_0x4bc849);return _0x4d0ba0[_0x159d('0x23')]('Content-Range',_0x28f5ec+'-'+_0x577136+'/'+_0x16baeb)['json'](_0x35db77);}return null;};}function patchUpdates(_0x2ab0c7){return function(_0x3f0e33){try{jsonpatch[_0x159d('0x24')](_0x3f0e33,_0x2ab0c7,!![]);}catch(_0x53b63c){return BPromise[_0x159d('0x25')](_0x53b63c);}return _0x3f0e33[_0x159d('0x26')]();};}function saveUpdates(_0x39b2e9,_0x16105c){return function(_0x21d20c){if(_0x21d20c){return _0x21d20c[_0x159d('0x27')](_0x39b2e9)[_0x159d('0x28')](function(_0x1c7278){return _0x1c7278;});}return null;};}function removeEntity(_0x40a00c,_0x2560a2){return function(_0x5f44ed){if(_0x5f44ed){return _0x5f44ed[_0x159d('0x29')]()[_0x159d('0x28')](function(){_0x40a00c['status'](0xcc)[_0x159d('0x1f')]();});}};}function handleEntityNotFound(_0x178c85,_0x9eab58){return function(_0x3ba488){if(!_0x3ba488){_0x178c85[_0x159d('0x1d')](0x194);}return _0x3ba488;};}function handleError(_0x163001,_0x2f06df){_0x2f06df=_0x2f06df||0x1f4;return function(_0x3d68dc){logger['error'](_0x3d68dc[_0x159d('0x2a')]);if(_0x3d68dc[_0x159d('0x2b')]){delete _0x3d68dc[_0x159d('0x2b')];}_0x163001['status'](_0x2f06df)[_0x159d('0x2c')](_0x3d68dc);};}exports[_0x159d('0x2d')]=function(_0x215520,_0x482e6d,_0x191bf9){if(!_0x215520[_0x159d('0x2e')][_0x159d('0x2f')](_0x159d('0x30'))&&!_0x215520['body'][_0x159d('0x2f')](_0x159d('0x31'))){throw new db[(_0x159d('0x32'))][(_0x159d('0x33'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x215520[_0x159d('0x2e')]['hasOwnProperty']('TemplateId')&&!_0x215520['body'][_0x159d('0x2f')](_0x159d('0x34'))){throw new db['Sequelize'][(_0x159d('0x33'))](_0x159d('0x35'));}if(!_0x215520[_0x159d('0x2e')][_0x159d('0x2f')](_0x159d('0x36'))){throw new db['Sequelize'][(_0x159d('0x33'))](_0x159d('0x37'));}else{try{var _0x7cca0c=JSON[_0x159d('0x38')](_0x215520[_0x159d('0x2e')][_0x159d('0x36')]);}catch(_0x1fb104){logger[_0x159d('0x39')](_0x1fb104);throw new db['Sequelize']['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x48a3c0=[_0x159d('0x3a'),'faxqueue','mailqueue',_0x159d('0x3b'),_0x159d('0x3c'),'voicequeue',_0x159d('0x3d'),'team','user'];if(_[_0x159d('0x3e')](_0x7cca0c,function(_0x502fc8){return!_['includes'](_0x48a3c0,_0x502fc8[_0x159d('0x3f')][_0x159d('0x40')]());})){throw new db[(_0x159d('0x32'))]['ValidationError']('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0xb62ad1={};_0xb62ad1[_0x159d('0x41')]=_0x215520[_0x159d('0x2e')][_0x159d('0x2f')](_0x159d('0x41'))?_0x215520[_0x159d('0x2e')][_0x159d('0x41')]:_0x215520[_0x159d('0x42')][_0x159d('0x43')];_0xb62ad1['recipientsDescription']=_[_0x159d('0x44')](_0x215520[_0x159d('0x2e')]['recipientsDescription'])?null:_0x215520[_0x159d('0x2e')][_0x159d('0x45')];_0xb62ad1[_0x159d('0x46')]=_0x215520['body']['beep']||![];_0xb62ad1[_0x159d('0x47')]=_0x215520[_0x159d('0x42')]['id'];return getContent(_0x215520[_0x159d('0x2e')])['then'](function(_0x43a5d5){_0xb62ad1[_0x159d('0x2e')]=_0x43a5d5;return getRecipients(_0x7cca0c);})[_0x159d('0x28')](function(_0x4d1429){_0xb62ad1[_0x159d('0x48')]=_[_0x159d('0x49')](_0x4d1429)[_0x159d('0x4a')](',');return db['sequelize']['transaction'](function(_0xd78903){return db[_0x159d('0x4b')]['create'](_0xb62ad1,{'raw':!![],'transaction':_0xd78903})[_0x159d('0x28')](function(_0x58d102){var _0x443d96={'sender':_0xb62ad1[_0x159d('0x41')],'description':_0xb62ad1[_0x159d('0x45')],'content':_0xb62ad1[_0x159d('0x2e')],'beep':_0xb62ad1['beep']};_0x4d1429[_0x159d('0x4c')](function(_0x58291f){_0x443d96[_0x159d('0x4d')]=_0x58291f;socket[_0x159d('0x4e')](_0x159d('0x4f'),_0x443d96);});return _0x58d102;});});})[_0x159d('0x28')](respondWithResult(_0x482e6d,0xc9))['catch'](handleError(_0x482e6d,null));};function getContent(_0x9fb822){return new BPromise(function(_0x35d497,_0x58eb3e){if(_0x9fb822['text']){_0x35d497(_0x9fb822[_0x159d('0x30')]);return;}return db[_0x159d('0x50')][_0x159d('0x51')]({'attributes':[_0x159d('0x52')],'where':{'id':_0x9fb822[_0x159d('0x31')]},'raw':!![]})['then'](function(_0x4fc33e){if(!_0x4fc33e)throw new db[(_0x159d('0x32'))]['ValidationError'](_0x159d('0x53'));var _0x365a7=Mustache[_0x159d('0x54')](_0x4fc33e[_0x159d('0x52')],_0x9fb822['view']);_0x35d497(_0x365a7);})['catch'](function(_0x41aaef){_0x58eb3e(_0x41aaef);});});}function getRecipients(_0x29a0d9){return new BPromise(function(_0x148087,_0x2823c2){var _0x36307d=[];var _0x280663=[];_0x29a0d9['forEach'](function(_0x5db2bb){var _0x4d4f75=_[_0x159d('0x55')](_0x5db2bb[_0x159d('0x3f')][_0x159d('0x40')]());if(_0x4d4f75===_0x159d('0x56')){_0x36307d=_[_0x159d('0x57')](_0x36307d,_0x5db2bb[_0x159d('0x58')]);}else{if(_[_0x159d('0x59')](_0x4d4f75,_0x159d('0x5a')))_0x4d4f75=_0x4d4f75[_0x159d('0x5b')](_0x159d('0x5a'),'Queue');_0x5db2bb['ids'][_0x159d('0x4c')](function(_0x3c3645){_0x280663[_0x159d('0x5c')](getAgents(_0x4d4f75,_0x3c3645));});}});return BPromise[_0x159d('0x5d')](_0x280663)[_0x159d('0x28')](function(_0xfeb778){_0x36307d=_['union'](_0x36307d,_['flatten'](_0xfeb778));_0x148087(_0x36307d);})[_0x159d('0x5e')](function(_0x26ff17){_0x2823c2(_0x26ff17);});});}function getAgents(_0x81f272,_0x250040){return new BPromise(function(_0x28aba1,_0x5cbd53){return db[_0x81f272]['findOne']({'where':{'id':_0x250040}})[_0x159d('0x28')](function(_0x5525eb){return _0x5525eb[_0x159d('0x5f')]({'attributes':['id'],'raw':!![]})[_0x159d('0x28')](function(_0x5d0c1f){var _0x545e68=_[_0x159d('0x60')](_0x5d0c1f,'id');_0x28aba1(_0x545e68);});})['catch'](function(_0x1887ec){_0x5cbd53(_0x1887ec);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index ed9f449..81331a0 100644 --- a/server/api/notification/notification.events.js +++ b/server/api/notification/notification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['../../mysqldb','Notification','remove','emit','hasOwnProperty','hook'];(function(_0x1b6ec0,_0x403acb){var _0x3f19fa=function(_0x504de1){while(--_0x504de1){_0x1b6ec0['push'](_0x1b6ec0['shift']());}};_0x3f19fa(++_0x403acb);}(_0x757a,0xde));var _0xa757=function(_0x573f23,_0x1cfe18){_0x573f23=_0x573f23-0x0;var _0x3c6198=_0x757a[_0x573f23];return _0x3c6198;};'use strict';var EventEmitter=require('events');var Notification=require(_0xa757('0x0'))['db'][_0xa757('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa757('0x2')};function emitEvent(_0x1721c6){return function(_0x1c2932,_0x453d07,_0x32630d){NotificationEvents[_0xa757('0x3')](_0x1721c6+':'+_0x1c2932['id'],_0x1c2932);NotificationEvents['emit'](_0x1721c6,_0x1c2932);_0x32630d(null);};}for(var e in events){if(events[_0xa757('0x4')](e)){var event=events[e];Notification[_0xa757('0x5')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file +var _0xdb28=['Notification','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x55a93f,_0x298710){var _0x3c2e8e=function(_0x19d860){while(--_0x19d860){_0x55a93f['push'](_0x55a93f['shift']());}};_0x3c2e8e(++_0x298710);}(_0xdb28,0x106));var _0x8db2=function(_0x1127db,_0x75f0c6){_0x1127db=_0x1127db-0x0;var _0x1c4740=_0xdb28[_0x1127db];return _0x1c4740;};'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 640b0b3..6ab9591 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 _0x7b9d=['Notification','notifications','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./notification.attributes','exports','define'];(function(_0x19362a,_0x54d06f){var _0x3543c5=function(_0x424e13){while(--_0x424e13){_0x19362a['push'](_0x19362a['shift']());}};_0x3543c5(++_0x54d06f);}(_0x7b9d,0x195));var _0xd7b9=function(_0x3d9e94,_0x48136c){_0x3d9e94=_0x3d9e94-0x0;var _0x45f76e=_0x7b9d[_0x3d9e94];return _0x45f76e;};'use strict';var _=require(_0xd7b9('0x0'));var util=require('util');var logger=require(_0xd7b9('0x1'))(_0xd7b9('0x2'));var moment=require(_0xd7b9('0x3'));var BPromise=require(_0xd7b9('0x4'));var rp=require(_0xd7b9('0x5'));var fs=require('fs');var path=require(_0xd7b9('0x6'));var rimraf=require(_0xd7b9('0x7'));var config=require('../../config/environment');var attributes=require(_0xd7b9('0x8'));module[_0xd7b9('0x9')]=function(_0x59be78,_0x20db4f){return _0x59be78[_0xd7b9('0xa')](_0xd7b9('0xb'),attributes,{'tableName':_0xd7b9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8085=['notifications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','request-promise','rimraf','./notification.attributes','exports','Notification'];(function(_0x2c909c,_0x2bf49e){var _0x1606f2=function(_0x45e5b0){while(--_0x45e5b0){_0x2c909c['push'](_0x2c909c['shift']());}};_0x1606f2(++_0x2bf49e);}(_0x8085,0x12c));var _0x5808=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x8085[_0x58dc25];return _0x21b0a7;};'use strict';var _=require('lodash');var util=require(_0x5808('0x0'));var logger=require(_0x5808('0x1'))('api');var moment=require(_0x5808('0x2'));var BPromise=require('bluebird');var rp=require(_0x5808('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5808('0x4'));var config=require('../../config/environment');var attributes=require(_0x5808('0x5'));module[_0x5808('0x6')]=function(_0x4bf095,_0x24b372){return _0x4bf095['define'](_0x5808('0x7'),attributes,{'tableName':_0x5808('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5808('0x9'),'collate':_0x5808('0xa')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index afa24e2..652a547 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 _0x8c63=['request\x20sent','debug','error','code','Notification,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','request','info'];(function(_0x2bda68,_0x3d314c){var _0x9fd143=function(_0x23f9c1){while(--_0x23f9c1){_0x2bda68['push'](_0x2bda68['shift']());}};_0x9fd143(++_0x3d314c);}(_0x8c63,0xa2));var _0x38c6=function(_0x3f7c83,_0x2cb981){_0x3f7c83=_0x3f7c83-0x0;var _0x272963=_0x8c63[_0x3f7c83];return _0x272963;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x38c6('0x0'));var BPromise=require(_0x38c6('0x1'));var rs=require(_0x38c6('0x2'));var fs=require('fs');var Redis=require(_0x38c6('0x3'));var db=require(_0x38c6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x38c6('0x5'))(_0x38c6('0x6'));var config=require(_0x38c6('0x7'));var jayson=require(_0x38c6('0x8'));var client=jayson[_0x38c6('0x9')]['http']({'port':0x232a});config[_0x38c6('0xa')]=_[_0x38c6('0xb')](config[_0x38c6('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x38c6('0xa')]));require('./notification.socket')['register'](socket);function respondWithRpcPromise(_0x1a93f5,_0x33a0e6,_0xb7b6d0){return new BPromise(function(_0x58cf07,_0x3862fc){return client[_0x38c6('0xc')](_0x1a93f5,_0xb7b6d0)['then'](function(_0x2bd5f1){logger[_0x38c6('0xd')]('Notification,\x20%s,\x20%s',_0x33a0e6,_0x38c6('0xe'));logger[_0x38c6('0xf')]('Notification,\x20%s,\x20%s,\x20%s',_0x33a0e6,'request\x20sent',JSON['stringify'](_0x2bd5f1));if(_0x2bd5f1['error']){if(_0x2bd5f1[_0x38c6('0x10')][_0x38c6('0x11')]===0x1f4){logger['error'](_0x38c6('0x12'),_0x33a0e6,_0x2bd5f1[_0x38c6('0x10')]['message']);return _0x3862fc(_0x2bd5f1['error'][_0x38c6('0x13')]);}logger[_0x38c6('0x10')]('Notification,\x20%s,\x20%s',_0x33a0e6,_0x2bd5f1[_0x38c6('0x10')]['message']);return _0x58cf07(_0x2bd5f1[_0x38c6('0x10')][_0x38c6('0x13')]);}else{logger[_0x38c6('0xd')](_0x38c6('0x12'),_0x33a0e6,'request\x20sent');_0x58cf07(_0x2bd5f1[_0x38c6('0x14')][_0x38c6('0x13')]);}})[_0x38c6('0x15')](function(_0x2d50f6){logger['error']('Notification,\x20%s,\x20%s',_0x33a0e6,_0x2d50f6);_0x3862fc(_0x2d50f6);});});} \ No newline at end of file +var _0x23d7=['redis','localhost','socket.io-emitter','./notification.socket','register','request','then','info','Notification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x31a437,_0xf91821){var _0x50eedf=function(_0x5e9a4c){while(--_0x5e9a4c){_0x31a437['push'](_0x31a437['shift']());}};_0x50eedf(++_0xf91821);}(_0x23d7,0x11f));var _0x723d=function(_0x3d2652,_0x2a6baa){_0x3d2652=_0x3d2652-0x0;var _0x11cb43=_0x23d7[_0x3d2652];return _0x11cb43;};'use strict';var _=require(_0x723d('0x0'));var util=require(_0x723d('0x1'));var moment=require('moment');var BPromise=require(_0x723d('0x2'));var rs=require(_0x723d('0x3'));var fs=require('fs');var Redis=require(_0x723d('0x4'));var db=require(_0x723d('0x5'))['db'];var utils=require(_0x723d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x723d('0x7'));var jayson=require(_0x723d('0x8'));var client=jayson[_0x723d('0x9')]['http']({'port':0x232a});config[_0x723d('0xa')]=_['defaults'](config[_0x723d('0xa')],{'host':_0x723d('0xb'),'port':0x18eb});var socket=require(_0x723d('0xc'))(new Redis(config['redis']));require(_0x723d('0xd'))[_0x723d('0xe')](socket);function respondWithRpcPromise(_0x25dfab,_0x539ab6,_0x30de09){return new BPromise(function(_0x287bcd,_0x5b14d5){return client[_0x723d('0xf')](_0x25dfab,_0x30de09)[_0x723d('0x10')](function(_0x3bb4df){logger[_0x723d('0x11')](_0x723d('0x12'),_0x539ab6,_0x723d('0x13'));logger[_0x723d('0x14')]('Notification,\x20%s,\x20%s,\x20%s',_0x539ab6,'request\x20sent',JSON[_0x723d('0x15')](_0x3bb4df));if(_0x3bb4df[_0x723d('0x16')]){if(_0x3bb4df['error'][_0x723d('0x17')]===0x1f4){logger[_0x723d('0x16')](_0x723d('0x12'),_0x539ab6,_0x3bb4df[_0x723d('0x16')][_0x723d('0x18')]);return _0x5b14d5(_0x3bb4df[_0x723d('0x16')][_0x723d('0x18')]);}logger[_0x723d('0x16')](_0x723d('0x12'),_0x539ab6,_0x3bb4df[_0x723d('0x16')][_0x723d('0x18')]);return _0x287bcd(_0x3bb4df[_0x723d('0x16')][_0x723d('0x18')]);}else{logger['info'](_0x723d('0x12'),_0x539ab6,_0x723d('0x13'));_0x287bcd(_0x3bb4df[_0x723d('0x19')][_0x723d('0x18')]);}})[_0x723d('0x1a')](function(_0x1c3abd){logger[_0x723d('0x16')](_0x723d('0x12'),_0x539ab6,_0x1c3abd);_0x5b14d5(_0x1c3abd);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 607a0d3..7f04455 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 _0xdbb9=['notification:','./notification.events','save','remove','update','register'];(function(_0x3a9252,_0x1e97ea){var _0x342dbc=function(_0x39c1d5){while(--_0x39c1d5){_0x3a9252['push'](_0x3a9252['shift']());}};_0x342dbc(++_0x1e97ea);}(_0xdbb9,0x175));var _0x9dbb=function(_0xa515c,_0x57ca32){_0xa515c=_0xa515c-0x0;var _0x4b737e=_0xdbb9[_0xa515c];return _0x4b737e;};'use strict';var NotificationEvents=require(_0x9dbb('0x0'));var events=[_0x9dbb('0x1'),_0x9dbb('0x2'),_0x9dbb('0x3')];function createListener(_0x4fd375,_0xde425b){return function(_0x1f6871){_0xde425b['emit'](_0x4fd375,_0x1f6871);};}function removeListener(_0x233a8f,_0x2164d9){return function(){NotificationEvents['removeListener'](_0x233a8f,_0x2164d9);};}exports[_0x9dbb('0x4')]=function(_0x3e9109){for(var _0x36a905=0x0,_0x1baf47=events['length'];_0x36a905<_0x1baf47;_0x36a905++){var _0xd146fd=events[_0x36a905];var _0x519408=createListener(_0x9dbb('0x5')+_0xd146fd,_0x3e9109);NotificationEvents['on'](_0xd146fd,_0x519408);}}; \ No newline at end of file +var _0x8a0d=['remove','update','emit','removeListener','register','length','notification:','save'];(function(_0x49168a,_0x3a4f34){var _0x2be687=function(_0x4b34a0){while(--_0x4b34a0){_0x49168a['push'](_0x49168a['shift']());}};_0x2be687(++_0x3a4f34);}(_0x8a0d,0x117));var _0xd8a0=function(_0x506f97,_0x741bf1){_0x506f97=_0x506f97-0x0;var _0xbc7438=_0x8a0d[_0x506f97];return _0xbc7438;};'use strict';var NotificationEvents=require('./notification.events');var events=[_0xd8a0('0x0'),_0xd8a0('0x1'),_0xd8a0('0x2')];function createListener(_0x5bd670,_0x218976){return function(_0x7213be){_0x218976[_0xd8a0('0x3')](_0x5bd670,_0x7213be);};}function removeListener(_0x464401,_0x3cf9b7){return function(){NotificationEvents[_0xd8a0('0x4')](_0x464401,_0x3cf9b7);};}exports[_0xd8a0('0x5')]=function(_0x52cdc0){for(var _0x70baa6=0x0,_0x46af27=events[_0xd8a0('0x6')];_0x70baa6<_0x46af27;_0x70baa6++){var _0x4744fd=events[_0x70baa6];var _0x49ae09=createListener(_0xd8a0('0x7')+_0x4744fd,_0x52cdc0);NotificationEvents['on'](_0x4744fd,_0x49ae09);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 88cdb28..7b89416 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 _0xb722=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','post','/:id/notify','notify','addApplications','/:id/send','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer'];(function(_0x235c8c,_0x14ca9b){var _0x258f7e=function(_0x3c6926){while(--_0x3c6926){_0x235c8c['push'](_0x235c8c['shift']());}};_0x258f7e(++_0x14ca9b);}(_0xb722,0x6e));var _0x2b72=function(_0x405156,_0x10c7c1){_0x405156=_0x405156-0x0;var _0x104f1c=_0xb722[_0x405156];return _0x104f1c;};'use strict';var multer=require(_0x2b72('0x0'));var util=require(_0x2b72('0x1'));var path=require('path');var timeout=require(_0x2b72('0x2'));var express=require(_0x2b72('0x3'));var router=express[_0x2b72('0x4')]();var auth=require(_0x2b72('0x5'));var interaction=require(_0x2b72('0x6'));var config=require(_0x2b72('0x7'));var controller=require('./openchannelAccount.controller');router['get']('/',auth[_0x2b72('0x8')](),controller[_0x2b72('0x9')]);router[_0x2b72('0xa')](_0x2b72('0xb'),auth[_0x2b72('0x8')](),controller[_0x2b72('0xc')]);router[_0x2b72('0xa')](_0x2b72('0xd'),auth[_0x2b72('0x8')](),controller[_0x2b72('0xe')]);router[_0x2b72('0xa')](_0x2b72('0xf'),auth[_0x2b72('0x8')](),controller[_0x2b72('0x10')]);router[_0x2b72('0xa')](_0x2b72('0x11'),auth[_0x2b72('0x8')](),controller[_0x2b72('0x12')]);router[_0x2b72('0xa')](_0x2b72('0x13'),auth['isAuthenticated'](),controller[_0x2b72('0x14')]);router[_0x2b72('0xa')](_0x2b72('0x15'),auth['isAuthenticated'](),controller[_0x2b72('0x16')]);router['get'](_0x2b72('0x17'),auth['isAuthenticated'](),controller['getAgents']);router[_0x2b72('0x18')]('/',auth[_0x2b72('0x8')](),controller['create']);router[_0x2b72('0x18')](_0x2b72('0xf'),auth[_0x2b72('0x8')](),controller['addDisposition']);router['post'](_0x2b72('0x11'),auth[_0x2b72('0x8')](),controller['addAnswer']);router[_0x2b72('0x18')](_0x2b72('0x19'),controller[_0x2b72('0x1a')]);router[_0x2b72('0x18')](_0x2b72('0x13'),auth[_0x2b72('0x8')](),controller[_0x2b72('0x1b')]);router[_0x2b72('0x18')](_0x2b72('0x17'),auth[_0x2b72('0x8')](),controller['addAgents']);router[_0x2b72('0x18')](_0x2b72('0x1c'),auth['isAuthenticated'](),controller[_0x2b72('0x1d')]);router[_0x2b72('0x1e')]('/:id',auth[_0x2b72('0x8')](),controller['update']);router[_0x2b72('0x1f')](_0x2b72('0xd'),auth['isAuthenticated'](),controller[_0x2b72('0x20')]);router[_0x2b72('0x1f')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x2b72('0x21')]);router[_0x2b72('0x1f')](_0x2b72('0x11'),auth[_0x2b72('0x8')](),controller[_0x2b72('0x22')]);router[_0x2b72('0x1f')](_0x2b72('0x17'),auth[_0x2b72('0x8')](),controller[_0x2b72('0x23')]);module[_0x2b72('0x24')]=router; \ No newline at end of file +var _0xefa8=['../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/notify','notify','addApplications','addAgents','send','put','/:id','update','delete','/:id/dispositions','removeDispositions','removeAnswers','removeAgents','exports','util','connect-timeout'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xefa8,0x1a2));var _0x8efa=function(_0x1d190e,_0x5cf2bd){_0x1d190e=_0x1d190e-0x0;var _0x16e2c3=_0xefa8[_0x1d190e];return _0x16e2c3;};'use strict';var multer=require('multer');var util=require(_0x8efa('0x0'));var path=require('path');var timeout=require(_0x8efa('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8efa('0x2'));var config=require('../../config/environment');var controller=require(_0x8efa('0x3'));router[_0x8efa('0x4')]('/',auth[_0x8efa('0x5')](),controller[_0x8efa('0x6')]);router['get'](_0x8efa('0x7'),auth[_0x8efa('0x5')](),controller[_0x8efa('0x8')]);router[_0x8efa('0x4')]('/:id',auth[_0x8efa('0x5')](),controller[_0x8efa('0x9')]);router[_0x8efa('0x4')]('/:id/dispositions',auth[_0x8efa('0x5')](),controller[_0x8efa('0xa')]);router['get'](_0x8efa('0xb'),auth[_0x8efa('0x5')](),controller[_0x8efa('0xc')]);router['get'](_0x8efa('0xd'),auth[_0x8efa('0x5')](),controller[_0x8efa('0xe')]);router[_0x8efa('0x4')](_0x8efa('0xf'),auth['isAuthenticated'](),controller[_0x8efa('0x10')]);router[_0x8efa('0x4')](_0x8efa('0x11'),auth[_0x8efa('0x5')](),controller[_0x8efa('0x12')]);router[_0x8efa('0x13')]('/',auth[_0x8efa('0x5')](),controller[_0x8efa('0x14')]);router[_0x8efa('0x13')]('/:id/dispositions',auth[_0x8efa('0x5')](),controller['addDisposition']);router['post'](_0x8efa('0xb'),auth[_0x8efa('0x5')](),controller['addAnswer']);router['post'](_0x8efa('0x15'),controller[_0x8efa('0x16')]);router[_0x8efa('0x13')](_0x8efa('0xd'),auth[_0x8efa('0x5')](),controller[_0x8efa('0x17')]);router[_0x8efa('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0x8efa('0x18')]);router['post']('/:id/send',auth[_0x8efa('0x5')](),controller[_0x8efa('0x19')]);router[_0x8efa('0x1a')](_0x8efa('0x1b'),auth[_0x8efa('0x5')](),controller[_0x8efa('0x1c')]);router['delete'](_0x8efa('0x1b'),auth['isAuthenticated'](),controller['destroy']);router[_0x8efa('0x1d')](_0x8efa('0x1e'),auth[_0x8efa('0x5')](),controller[_0x8efa('0x1f')]);router[_0x8efa('0x1d')](_0x8efa('0xb'),auth[_0x8efa('0x5')](),controller[_0x8efa('0x20')]);router[_0x8efa('0x1d')]('/:id/users',auth['isAuthenticated'](),controller[_0x8efa('0x21')]);module[_0x8efa('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index e29f907..bba8c0c 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 _0x97af=['generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING'];(function(_0x5b21dc,_0x1a2c8e){var _0x26607b=function(_0x27e7e8){while(--_0x27e7e8){_0x5b21dc['push'](_0x5b21dc['shift']());}};_0x26607b(++_0x1a2c8e);}(_0x97af,0x134));var _0xf97a=function(_0x4dc307,_0x59e8bc){_0x4dc307=_0x4dc307-0x0;var _0x1f7a19=_0x97af[_0x4dc307];return _0x1f7a19;};'use strict';var Sequelize=require(_0xf97a('0x0'));var rs=require(_0xf97a('0x1'));module[_0xf97a('0x2')]={'name':{'type':Sequelize[_0xf97a('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xf97a('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xf97a('0x4')]();}},'replyUri':{'type':Sequelize[_0xf97a('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf97a('0x5')],'defaultValue':function(){return _0xf97a('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf97a('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf97a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xf97a('0x3')]},'queueTransfer':{'type':Sequelize[_0xf97a('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf97a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf97a('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xf97a('0x7')],'defaultValue':![],'comment':_0xf97a('0x9'),'set':function(_0x370ddd){if(!_0x370ddd)this['setDataValue'](_0xf97a('0xa'),null);this[_0xf97a('0xb')](_0xf97a('0xc'),_0x370ddd);}}}; \ No newline at end of file +var _0x2d59=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x351f90,_0xac6d4f){var _0x171efe=function(_0x3aca7d){while(--_0x3aca7d){_0x351f90['push'](_0x351f90['shift']());}};_0x171efe(++_0xac6d4f);}(_0x2d59,0x185));var _0x92d5=function(_0x219ce5,_0x34208a){_0x219ce5=_0x219ce5-0x0;var _0x702cf3=_0x2d59[_0x219ce5];return _0x702cf3;};'use strict';var Sequelize=require(_0x92d5('0x0'));var rs=require(_0x92d5('0x1'));module['exports']={'name':{'type':Sequelize[_0x92d5('0x2')],'unique':_0x92d5('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x92d5('0x2')]},'token':{'type':Sequelize[_0x92d5('0x2')],'defaultValue':function(){return rs[_0x92d5('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x92d5('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x92d5('0x5');}},'notificationSound':{'type':Sequelize[_0x92d5('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x92d5('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x92d5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x92d5('0x2')]},'queueTransfer':{'type':Sequelize[_0x92d5('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x92d5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x92d5('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x92d5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x92d5('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x92d5('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x92d5('0x6')],'defaultValue':![],'comment':_0x92d5('0x9'),'set':function(_0x2a0172){if(!_0x2a0172)this[_0x92d5('0xa')]('mandatoryDispositionPauseId',null);this[_0x92d5('0xa')](_0x92d5('0xb'),_0x2a0172);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 4ec806e..947df2c 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 _0xf6d4=['order','OpenchannelAccountId','filter','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','openchannel','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','List','CmContact','Contacts','DESC','OpenchannelApplication','account','Applications','list','applications','orderBy','priority','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','EventManager','notify','addApplications','sequelize','transaction','bulkCreate','getApplications','getInteractions','User','Owner','fullname','internal','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','send','CmList','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelAccount.socket','register','jayson/promise','http','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','set','Content-Range','apply','save','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','index','Pause','OpenchannelAccount','fieldName','type','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','filters','pick','where','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','mandatoryDispositionPause','rawAttributes','length','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','OpnechannelAccountId','getDispositions','findOne','Disposition'];(function(_0x3466bd,_0x413210){var _0x5c3854=function(_0x6001f4){while(--_0x6001f4){_0x3466bd['push'](_0x3466bd['shift']());}};_0x5c3854(++_0x413210);}(_0xf6d4,0x115));var _0x4f6d=function(_0x1687b9,_0x45a6b8){_0x1687b9=_0x1687b9-0x0;var _0x4834da=_0xf6d4[_0x1687b9];return _0x4834da;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4f6d('0x0'));var zipdir=require(_0x4f6d('0x1'));var jsonpatch=require(_0x4f6d('0x2'));var rp=require('request-promise');var moment=require(_0x4f6d('0x3'));var BPromise=require(_0x4f6d('0x4'));var Mustache=require(_0x4f6d('0x5'));var util=require(_0x4f6d('0x6'));var path=require(_0x4f6d('0x7'));var sox=require(_0x4f6d('0x8'));var csv=require(_0x4f6d('0x9'));var ejs=require(_0x4f6d('0xa'));var fs=require('fs');var _=require(_0x4f6d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4f6d('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4f6d('0xd'));var Papa=require('papaparse');var Redis=require(_0x4f6d('0xe'));var authService=require(_0x4f6d('0xf'));var qs=require(_0x4f6d('0x10'));var as=require(_0x4f6d('0x11'));var hardwareService=require(_0x4f6d('0x12'));var logger=require(_0x4f6d('0x13'))('api');var utils=require(_0x4f6d('0x14'));var config=require(_0x4f6d('0x15'));var db=require(_0x4f6d('0x16'))['db'];config[_0x4f6d('0x17')]=_[_0x4f6d('0x18')](config[_0x4f6d('0x17')],{'host':_0x4f6d('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f6d('0x17')]));require(_0x4f6d('0x1a'))[_0x4f6d('0x1b')](socket);var jayson=require(_0x4f6d('0x1c'));var client=jayson['client'][_0x4f6d('0x1d')]({'port':0x232c});var client9002=jayson[_0x4f6d('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0xe8bc3e,_0x200e9d,_0x1bc93a){if(_0x1bc93a){var _0x1f0894=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1f0894[_0x4f6d('0x1f')](_0x200e9d)){return _0xe8bc3e;}else{throw new db[(_0x4f6d('0x20'))]['ValidationError'](_0x4f6d('0x21'));}}else{return _0xe8bc3e;}}function respondWithRpcPromise(_0x3df7e8,_0x5490b6,_0x514010,_0x3b0631){return new BPromise(function(_0x57c922,_0x5bf090){var _0x13c534=_0x3b0631||client;return _0x13c534[_0x4f6d('0x22')](_0x3df7e8,_0x514010)[_0x4f6d('0x23')](function(_0x52dbcb){logger[_0x4f6d('0x24')](_0x4f6d('0x25'),_0x5490b6,_0x4f6d('0x26'));logger[_0x4f6d('0x27')](_0x4f6d('0x28'),_0x5490b6,_0x4f6d('0x26'),JSON['stringify'](_0x52dbcb));if(_0x52dbcb[_0x4f6d('0x29')]){if(_0x52dbcb['error'][_0x4f6d('0x2a')]===0x1f4){logger[_0x4f6d('0x29')](_0x4f6d('0x25'),_0x5490b6,_0x52dbcb[_0x4f6d('0x29')][_0x4f6d('0x2b')]);return _0x5bf090(_0x52dbcb[_0x4f6d('0x29')][_0x4f6d('0x2b')]);}logger[_0x4f6d('0x29')](_0x4f6d('0x25'),_0x5490b6,_0x52dbcb[_0x4f6d('0x29')]['message']);return _0x57c922(_0x52dbcb[_0x4f6d('0x29')]['message']);}else{logger[_0x4f6d('0x24')](_0x4f6d('0x25'),_0x5490b6,_0x4f6d('0x26'));_0x57c922(_0x52dbcb[_0x4f6d('0x2c')][_0x4f6d('0x2b')]);}})[_0x4f6d('0x2d')](function(_0x4ed933){logger[_0x4f6d('0x29')](_0x4f6d('0x25'),_0x5490b6,_0x4ed933);_0x5bf090(_0x4ed933);});});}function respondWithStatusCode(_0x33b8c4,_0x325beb){_0x325beb=_0x325beb||0xcc;return function(_0x47c754){if(_0x47c754){return _0x33b8c4[_0x4f6d('0x2e')](_0x325beb);}return _0x33b8c4[_0x4f6d('0x2f')](_0x325beb)[_0x4f6d('0x30')]();};}function respondWithResult(_0x19e34d,_0x220b00){_0x220b00=_0x220b00||0xc8;return function(_0x2f94c5){if(_0x2f94c5){return _0x19e34d['status'](_0x220b00)[_0x4f6d('0x31')](_0x2f94c5);}};}function respondWithFilteredResult(_0x1fd8aa,_0x34a675){return function(_0x1ce3cc){if(_0x1ce3cc){var _0x6bad3f=_0x1ce3cc['count'],_0x4ef6fd=_0x34a675[_0x4f6d('0x32')],_0x3f55f5=_0x34a675[_0x4f6d('0x32')]+_0x34a675['limit'],_0x2a12c1;if(_0x3f55f5>=_0x6bad3f){_0x3f55f5=_0x6bad3f;_0x2a12c1=0xc8;}else{_0x2a12c1=0xce;}_0x1fd8aa[_0x4f6d('0x2f')](_0x2a12c1);return _0x1fd8aa[_0x4f6d('0x33')](_0x4f6d('0x34'),_0x4ef6fd+'-'+_0x3f55f5+'/'+_0x6bad3f)[_0x4f6d('0x31')](_0x1ce3cc);}return null;};}function patchUpdates(_0x3e79a1){return function(_0x619af8){try{jsonpatch[_0x4f6d('0x35')](_0x619af8,_0x3e79a1,!![]);}catch(_0x1924f9){return BPromise['reject'](_0x1924f9);}return _0x619af8[_0x4f6d('0x36')]();};}function saveUpdates(_0x2146d0,_0x809a34){return function(_0x2ef368){if(_0x2ef368){return _0x2ef368['update'](_0x2146d0)[_0x4f6d('0x23')](function(_0x440501){return _0x440501;});}return null;};}function removeEntity(_0x2b6602,_0x57cfdd){return function(_0x540eb8){if(_0x540eb8){return _0x540eb8[_0x4f6d('0x37')]()['then'](function(){var _0xe58edd=_0x540eb8[_0x4f6d('0x38')]({'plain':!![]});var _0x1ce04d=_0x4f6d('0x39');return db[_0x4f6d('0x3a')][_0x4f6d('0x37')]({'where':{'type':_0x1ce04d,'resourceId':_0xe58edd['id']}})[_0x4f6d('0x23')](function(){return _0x540eb8;});})[_0x4f6d('0x23')](function(){_0x2b6602[_0x4f6d('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c7eec,_0x2dffe1){return function(_0x28c0c7){if(!_0x28c0c7){_0x5c7eec['sendStatus'](0x194);}return _0x28c0c7;};}function handleError(_0x5e2770,_0x32693b){_0x32693b=_0x32693b||0x1f4;return function(_0x2e4c93){logger[_0x4f6d('0x29')](_0x2e4c93[_0x4f6d('0x3b')]);if(_0x2e4c93['name']){delete _0x2e4c93[_0x4f6d('0x3c')];}_0x5e2770['status'](_0x32693b)['send'](_0x2e4c93);};}exports[_0x4f6d('0x3d')]=function(_0x311244,_0x27937d){var _0x1e27fc={'include':[{'model':db[_0x4f6d('0x3e')],'as':'mandatoryDispositionPause'}]},_0x3f6ce4={},_0x403db0={'count':0x0,'rows':[]};var _0x2e3fe7=_['map'](db[_0x4f6d('0x3f')]['rawAttributes'],function(_0xf4abc5){return{'name':_0xf4abc5[_0x4f6d('0x40')],'type':_0xf4abc5[_0x4f6d('0x41')]['key']};});_0x3f6ce4[_0x4f6d('0x42')]=_[_0x4f6d('0x43')](_0x2e3fe7,_0x4f6d('0x3c'));_0x3f6ce4[_0x4f6d('0x44')]=_[_0x4f6d('0x45')](_0x311244[_0x4f6d('0x44')]);_0x3f6ce4['filters']=_[_0x4f6d('0x46')](_0x3f6ce4[_0x4f6d('0x42')],_0x3f6ce4[_0x4f6d('0x44')]);_0x1e27fc['attributes']=_[_0x4f6d('0x46')](_0x3f6ce4['model'],qs[_0x4f6d('0x47')](_0x311244['query'][_0x4f6d('0x47')]));_0x1e27fc[_0x4f6d('0x48')]=_0x1e27fc[_0x4f6d('0x48')]['length']?_0x1e27fc[_0x4f6d('0x48')]:_0x3f6ce4[_0x4f6d('0x42')];if(!_0x311244[_0x4f6d('0x44')][_0x4f6d('0x49')](_0x4f6d('0x4a'))){_0x1e27fc['limit']=qs[_0x4f6d('0x4b')](_0x311244['query'][_0x4f6d('0x4b')]);_0x1e27fc[_0x4f6d('0x32')]=qs[_0x4f6d('0x32')](_0x311244[_0x4f6d('0x44')]['offset']);}_0x1e27fc['order']=qs['sort'](_0x311244[_0x4f6d('0x44')][_0x4f6d('0x4c')]);_0x1e27fc['where']=qs[_0x4f6d('0x4d')](_[_0x4f6d('0x4e')](_0x311244[_0x4f6d('0x44')],_0x3f6ce4[_0x4f6d('0x4d')]));if(_0x311244[_0x4f6d('0x44')]['filter']){_0x1e27fc[_0x4f6d('0x4f')]=_[_0x4f6d('0x50')](_0x1e27fc[_0x4f6d('0x4f')],{'$or':_[_0x4f6d('0x43')](_0x2e3fe7,function(_0x1d4945){if(_0x1d4945[_0x4f6d('0x41')]!==_0x4f6d('0x51')){var _0x2fdd3a={};_0x2fdd3a[_0x1d4945[_0x4f6d('0x3c')]]={'$like':'%'+_0x311244[_0x4f6d('0x44')]['filter']+'%'};return _0x2fdd3a;}})});}_0x1e27fc=_[_0x4f6d('0x50')]({},_0x1e27fc,_0x311244[_0x4f6d('0x52')]);var _0x6b2fdf={'where':_0x1e27fc[_0x4f6d('0x4f')]};return db[_0x4f6d('0x3f')][_0x4f6d('0x53')](_0x6b2fdf)[_0x4f6d('0x23')](function(_0x445ff7){_0x403db0['count']=_0x445ff7;if(_0x311244[_0x4f6d('0x44')][_0x4f6d('0x54')]){_0x1e27fc['include']=[{'all':!![]}];}return db[_0x4f6d('0x3f')][_0x4f6d('0x55')](_0x1e27fc);})[_0x4f6d('0x23')](function(_0x576b14){_0x403db0[_0x4f6d('0x56')]=_0x576b14;return _0x403db0;})[_0x4f6d('0x23')](respondWithFilteredResult(_0x27937d,_0x1e27fc))['catch'](handleError(_0x27937d,null));};exports[_0x4f6d('0x57')]=function(_0x16097e,_0xea926a){var _0x42fb8f={'raw':![],'where':{'id':_0x16097e['params']['id']},'include':[{'model':db['Pause'],'as':_0x4f6d('0x58')}]},_0x24c7fe={};_0x24c7fe['model']=_['keys'](db[_0x4f6d('0x3f')][_0x4f6d('0x59')]);_0x24c7fe[_0x4f6d('0x44')]=_[_0x4f6d('0x45')](_0x16097e[_0x4f6d('0x44')]);_0x24c7fe[_0x4f6d('0x4d')]=_[_0x4f6d('0x46')](_0x24c7fe['model'],_0x24c7fe['query']);_0x42fb8f[_0x4f6d('0x48')]=_[_0x4f6d('0x46')](_0x24c7fe[_0x4f6d('0x42')],qs[_0x4f6d('0x47')](_0x16097e['query']['fields']));_0x42fb8f['attributes']=_0x42fb8f[_0x4f6d('0x48')][_0x4f6d('0x5a')]?_0x42fb8f['attributes']:_0x24c7fe['model'];if(_0x16097e['query'][_0x4f6d('0x54')]){_0x42fb8f[_0x4f6d('0x5b')]=[{'all':!![]}];}_0x42fb8f=_['merge']({},_0x42fb8f,_0x16097e[_0x4f6d('0x52')]);return db[_0x4f6d('0x3f')]['find'](_0x42fb8f)['then'](handleEntityNotFound(_0xea926a,null))[_0x4f6d('0x23')](respondWithResult(_0xea926a,null))[_0x4f6d('0x2d')](handleError(_0xea926a,null));};exports[_0x4f6d('0x5c')]=function(_0x5b92b1,_0xf89b34){return db['OpenchannelAccount'][_0x4f6d('0x5c')](_0x5b92b1[_0x4f6d('0x5d')],{})[_0x4f6d('0x23')](function(_0x24bd85){var _0x385915=_0x5b92b1[_0x4f6d('0x5e')]['get']({'plain':!![]});if(!_0x385915)throw new Error(_0x4f6d('0x5f'));if(_0x385915['role']==='user'){var _0x246677=_0x24bd85['get']({'plain':!![]});var _0x44a78b=_0x4f6d('0x39');return db[_0x4f6d('0x60')][_0x4f6d('0x61')]({'where':{'name':_0x44a78b,'userProfileId':_0x385915[_0x4f6d('0x62')]},'raw':!![]})['then'](function(_0x3cc43){if(_0x3cc43&&_0x3cc43[_0x4f6d('0x63')]===0x0){return db[_0x4f6d('0x3a')][_0x4f6d('0x5c')]({'name':_0x246677[_0x4f6d('0x3c')],'resourceId':_0x246677['id'],'type':_0x3cc43['name'],'sectionId':_0x3cc43['id']},{})[_0x4f6d('0x23')](function(){return _0x24bd85;});}else{return _0x24bd85;}})[_0x4f6d('0x2d')](function(_0x436e2f){logger[_0x4f6d('0x29')](_0x4f6d('0x64'),_0x436e2f);throw _0x436e2f;});}return _0x24bd85;})[_0x4f6d('0x23')](respondWithResult(_0xf89b34,0xc9))[_0x4f6d('0x2d')](handleError(_0xf89b34,null));};exports[_0x4f6d('0x65')]=function(_0x3ad9fc,_0x592172){if(_0x3ad9fc['body']['id']){delete _0x3ad9fc['body']['id'];}return db[_0x4f6d('0x3f')][_0x4f6d('0x61')]({'where':{'id':_0x3ad9fc[_0x4f6d('0x66')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x4f6d('0x23')](handleEntityNotFound(_0x592172,null))[_0x4f6d('0x23')](saveUpdates(_0x3ad9fc[_0x4f6d('0x5d')],null))[_0x4f6d('0x23')](respondWithResult(_0x592172,null))[_0x4f6d('0x2d')](handleError(_0x592172,null));};exports['destroy']=function(_0x8ee238,_0x54e089){return db['OpenchannelAccount'][_0x4f6d('0x61')]({'where':{'id':_0x8ee238[_0x4f6d('0x66')]['id']}})[_0x4f6d('0x23')](handleEntityNotFound(_0x54e089,null))['then'](removeEntity(_0x54e089,null))[_0x4f6d('0x2d')](handleError(_0x54e089,null));};exports[_0x4f6d('0x67')]=function(_0x5402a1,_0x46ec01){return db[_0x4f6d('0x3f')][_0x4f6d('0x67')]()[_0x4f6d('0x23')](respondWithResult(_0x46ec01,null))['catch'](handleError(_0x46ec01,null));};exports[_0x4f6d('0x68')]=function(_0x95cf81,_0x21a339,_0x53a03f){if(_0x95cf81['body']['id']){delete _0x95cf81[_0x4f6d('0x5d')]['id'];}return db['OpenchannelAccount'][_0x4f6d('0x61')]({'where':{'id':_0x95cf81[_0x4f6d('0x66')]['id']}})[_0x4f6d('0x23')](handleEntityNotFound(_0x21a339,null))[_0x4f6d('0x23')](function(_0x4fb63e){if(_0x4fb63e){_0x95cf81[_0x4f6d('0x5d')][_0x4f6d('0x69')]=_0x4fb63e['id'];return db['Disposition'][_0x4f6d('0x5c')](_0x95cf81[_0x4f6d('0x5d')]);}})['then'](respondWithResult(_0x21a339,null))[_0x4f6d('0x2d')](handleError(_0x21a339,null));};exports[_0x4f6d('0x6a')]=function(_0x45e2d2,_0xaf24e6,_0x317d5d){var _0x59bd08={'raw':![],'where':{}};var _0x5b9c63={};var _0x5cc344={'count':0x0,'rows':[]};return db[_0x4f6d('0x3f')][_0x4f6d('0x6b')]({'where':{'id':_0x45e2d2[_0x4f6d('0x66')]['id']}})[_0x4f6d('0x23')](handleEntityNotFound(_0xaf24e6,null))[_0x4f6d('0x23')](function(_0x5d4aa4){if(_0x5d4aa4){_0x5b9c63[_0x4f6d('0x42')]=_['keys'](db[_0x4f6d('0x6c')][_0x4f6d('0x59')]);_0x5b9c63[_0x4f6d('0x44')]=_['keys'](_0x45e2d2[_0x4f6d('0x44')]);_0x5b9c63[_0x4f6d('0x4d')]=_[_0x4f6d('0x46')](_0x5b9c63['model'],_0x5b9c63['query']);_0x59bd08[_0x4f6d('0x48')]=_[_0x4f6d('0x46')](_0x5b9c63[_0x4f6d('0x42')],qs[_0x4f6d('0x47')](_0x45e2d2['query'][_0x4f6d('0x47')]));_0x59bd08[_0x4f6d('0x48')]=_0x59bd08[_0x4f6d('0x48')][_0x4f6d('0x5a')]?_0x59bd08['attributes']:_0x5b9c63[_0x4f6d('0x42')];if(!_0x45e2d2[_0x4f6d('0x44')]['hasOwnProperty'](_0x4f6d('0x4a'))){_0x59bd08[_0x4f6d('0x4b')]=qs[_0x4f6d('0x4b')](_0x45e2d2[_0x4f6d('0x44')][_0x4f6d('0x4b')]);_0x59bd08['offset']=qs[_0x4f6d('0x32')](_0x45e2d2[_0x4f6d('0x44')][_0x4f6d('0x32')]);}_0x59bd08[_0x4f6d('0x6d')]=qs[_0x4f6d('0x4c')](_0x45e2d2[_0x4f6d('0x44')][_0x4f6d('0x4c')]);_0x59bd08[_0x4f6d('0x4f')]=qs[_0x4f6d('0x4d')](_[_0x4f6d('0x4e')](_0x45e2d2['query'],_0x5b9c63[_0x4f6d('0x4d')]));_0x59bd08[_0x4f6d('0x4f')][_0x4f6d('0x6e')]=_0x5d4aa4['id'];if(_0x45e2d2['query'][_0x4f6d('0x6f')]){_0x59bd08['where']=_['merge'](_0x59bd08[_0x4f6d('0x4f')],{'$or':_[_0x4f6d('0x43')](_0x59bd08[_0x4f6d('0x48')],function(_0x2715ed){var _0x521703={};_0x521703[_0x2715ed]={'$like':'%'+_0x45e2d2[_0x4f6d('0x44')][_0x4f6d('0x6f')]+'%'};return _0x521703;})});}_0x59bd08=_[_0x4f6d('0x50')]({},_0x59bd08,_0x45e2d2[_0x4f6d('0x52')]);return db[_0x4f6d('0x6c')][_0x4f6d('0x53')]({'where':_0x59bd08[_0x4f6d('0x4f')]})['then'](function(_0x2ff2a9){_0x5cc344['count']=_0x2ff2a9;if(_0x45e2d2[_0x4f6d('0x44')]['includeAll']){_0x59bd08[_0x4f6d('0x5b')]=[{'all':!![]}];}return db[_0x4f6d('0x6c')]['findAll'](_0x59bd08);})[_0x4f6d('0x23')](function(_0x2674e6){_0x5cc344[_0x4f6d('0x56')]=_0x2674e6;return _0x5cc344;});}})[_0x4f6d('0x23')](respondWithFilteredResult(_0xaf24e6,_0x59bd08))[_0x4f6d('0x2d')](handleError(_0xaf24e6,null));};exports[_0x4f6d('0x70')]=function(_0x14cbd0,_0x367b43,_0x59a980){return db[_0x4f6d('0x3f')][_0x4f6d('0x61')]({'where':{'id':_0x14cbd0[_0x4f6d('0x66')]['id']}})['then'](handleEntityNotFound(_0x367b43,null))['then'](function(_0x492583){if(_0x492583){return _0x492583[_0x4f6d('0x70')](_0x14cbd0[_0x4f6d('0x44')]['ids']);}})[_0x4f6d('0x23')](respondWithStatusCode(_0x367b43,null))['catch'](handleError(_0x367b43,null));};exports[_0x4f6d('0x71')]=function(_0x5efff5,_0x66f219,_0xd05385){if(_0x5efff5[_0x4f6d('0x5d')]['id']){delete _0x5efff5['body']['id'];}return db[_0x4f6d('0x3f')]['find']({'where':{'id':_0x5efff5[_0x4f6d('0x66')]['id']}})[_0x4f6d('0x23')](handleEntityNotFound(_0x66f219,null))[_0x4f6d('0x23')](function(_0x1a162c){if(_0x1a162c){_0x5efff5['body'][_0x4f6d('0x6e')]=_0x1a162c['id'];return db[_0x4f6d('0x72')][_0x4f6d('0x5c')](_0x5efff5[_0x4f6d('0x5d')]);}})['then'](respondWithResult(_0x66f219,null))['catch'](handleError(_0x66f219,null));};exports[_0x4f6d('0x73')]=function(_0x526125,_0x455e1f,_0x54b376){var _0xb9b29e={'raw':![],'where':{}};var _0x2396a6={};var _0x20318c={'count':0x0,'rows':[]};return db[_0x4f6d('0x3f')]['findOne']({'where':{'id':_0x526125[_0x4f6d('0x66')]['id']}})[_0x4f6d('0x23')](handleEntityNotFound(_0x455e1f,null))[_0x4f6d('0x23')](function(_0x4faf09){if(_0x4faf09){_0x2396a6['model']=_['keys'](db[_0x4f6d('0x72')]['rawAttributes']);_0x2396a6[_0x4f6d('0x44')]=_['keys'](_0x526125[_0x4f6d('0x44')]);_0x2396a6[_0x4f6d('0x4d')]=_[_0x4f6d('0x46')](_0x2396a6[_0x4f6d('0x42')],_0x2396a6[_0x4f6d('0x44')]);_0xb9b29e[_0x4f6d('0x48')]=_[_0x4f6d('0x46')](_0x2396a6[_0x4f6d('0x42')],qs['fields'](_0x526125[_0x4f6d('0x44')][_0x4f6d('0x47')]));_0xb9b29e[_0x4f6d('0x48')]=_0xb9b29e[_0x4f6d('0x48')][_0x4f6d('0x5a')]?_0xb9b29e[_0x4f6d('0x48')]:_0x2396a6[_0x4f6d('0x42')];if(!_0x526125[_0x4f6d('0x44')]['hasOwnProperty'](_0x4f6d('0x4a'))){_0xb9b29e[_0x4f6d('0x4b')]=qs[_0x4f6d('0x4b')](_0x526125[_0x4f6d('0x44')][_0x4f6d('0x4b')]);_0xb9b29e[_0x4f6d('0x32')]=qs[_0x4f6d('0x32')](_0x526125['query'][_0x4f6d('0x32')]);}_0xb9b29e[_0x4f6d('0x6d')]=qs['sort'](_0x526125[_0x4f6d('0x44')][_0x4f6d('0x4c')]);_0xb9b29e[_0x4f6d('0x4f')]=qs[_0x4f6d('0x4d')](_['pick'](_0x526125[_0x4f6d('0x44')],_0x2396a6[_0x4f6d('0x4d')]));_0xb9b29e[_0x4f6d('0x4f')]['OpenchannelAccountId']=_0x4faf09['id'];if(_0x526125[_0x4f6d('0x44')][_0x4f6d('0x6f')]){_0xb9b29e[_0x4f6d('0x4f')]=_[_0x4f6d('0x50')](_0xb9b29e[_0x4f6d('0x4f')],{'$or':_[_0x4f6d('0x43')](_0xb9b29e[_0x4f6d('0x48')],function(_0x3ec85c){var _0x197e56={};_0x197e56[_0x3ec85c]={'$like':'%'+_0x526125[_0x4f6d('0x44')]['filter']+'%'};return _0x197e56;})});}_0xb9b29e=_[_0x4f6d('0x50')]({},_0xb9b29e,_0x526125['options']);return db['CannedAnswer'][_0x4f6d('0x53')]({'where':_0xb9b29e[_0x4f6d('0x4f')]})[_0x4f6d('0x23')](function(_0x4c3933){_0x20318c[_0x4f6d('0x53')]=_0x4c3933;if(_0x526125[_0x4f6d('0x44')][_0x4f6d('0x54')]){_0xb9b29e['include']=[{'all':!![]}];}return db[_0x4f6d('0x72')][_0x4f6d('0x55')](_0xb9b29e);})['then'](function(_0x299b86){_0x20318c['rows']=_0x299b86;return _0x20318c;});}})[_0x4f6d('0x23')](respondWithFilteredResult(_0x455e1f,_0xb9b29e))[_0x4f6d('0x2d')](handleError(_0x455e1f,null));};exports['removeAnswers']=function(_0x50efb7,_0x37dd14,_0x2dc56b){return db[_0x4f6d('0x3f')][_0x4f6d('0x61')]({'where':{'id':_0x50efb7[_0x4f6d('0x66')]['id']}})[_0x4f6d('0x23')](handleEntityNotFound(_0x37dd14,null))['then'](function(_0x5082a0){if(_0x5082a0){return _0x5082a0[_0x4f6d('0x74')](_0x50efb7[_0x4f6d('0x44')][_0x4f6d('0x75')]);}})[_0x4f6d('0x23')](respondWithStatusCode(_0x37dd14,null))['catch'](handleError(_0x37dd14,null));};exports['notify']=function(_0x2458ed,_0xe85cad,_0x3aa51b){var _0x24bbd4={'body':_0x2458ed[_0x4f6d('0x5d')],'channel':_0x4f6d('0x76')};var _0x57ac9b=[];var _0x319252=[];var _0x11e110={};var _0x2ac1f9=![];return db['CmContact'][_0x4f6d('0x67')]()[_0x4f6d('0x23')](function(_0x3ad07c){if(!_0x3ad07c){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x57ac9b=_[_0x4f6d('0x77')](_['keys'](_0x3ad07c),[_0x4f6d('0x78'),_0x4f6d('0x79')]);_0x319252=_[_0x4f6d('0x77')](_[_0x4f6d('0x45')](_0x3ad07c),[_0x4f6d('0x78'),_0x4f6d('0x79'),_0x4f6d('0x7a'),_0x4f6d('0x7b')]);if(_0x2458ed[_0x4f6d('0x5d')]['id']){delete _0x2458ed[_0x4f6d('0x5d')]['id'];}if(_[_0x4f6d('0x7c')](_0x2458ed[_0x4f6d('0x5d')][_0x4f6d('0x7d')])){throw new db['Sequelize'][(_0x4f6d('0x7e'))](_0x4f6d('0x7f'));}if(_[_0x4f6d('0x7c')](_0x2458ed[_0x4f6d('0x5d')][_0x4f6d('0x5d')])||_0x2458ed['body'][_0x4f6d('0x5d')]===''){throw new db[(_0x4f6d('0x20'))][(_0x4f6d('0x7e'))](_0x4f6d('0x80'));}if(_[_0x4f6d('0x7c')](_0x2458ed[_0x4f6d('0x5d')]['mapKey'])){throw new db['Sequelize'][(_0x4f6d('0x7e'))](_0x4f6d('0x81')+_0x319252);}if(!_['includes'](_0x319252,_0x2458ed[_0x4f6d('0x5d')]['mapKey'])){throw new db[(_0x4f6d('0x20'))]['ValidationError'](_0x4f6d('0x82')+_0x319252);}_0x11e110[_0x2458ed[_0x4f6d('0x5d')][_0x4f6d('0x83')]]=_0x2458ed[_0x4f6d('0x5d')][_0x4f6d('0x7d')];})[_0x4f6d('0x23')](function(){return db[_0x4f6d('0x3f')][_0x4f6d('0x61')]({'where':{'id':_0x2458ed[_0x4f6d('0x66')]['id']},'include':[{'model':db['CmList'],'as':_0x4f6d('0x84'),'include':[{'model':db[_0x4f6d('0x85')],'as':_0x4f6d('0x86'),'where':_0x11e110,'limit':0x1,'order':[[_0x4f6d('0x79'),_0x4f6d('0x87')]]}]},{'model':db[_0x4f6d('0x88')],'as':'Applications'}]});})[_0x4f6d('0x23')](handleEntityNotFound(_0xe85cad,null))[_0x4f6d('0x23')](function(_0x1305f6){if(_0x1305f6&&_0x1305f6[_0x4f6d('0x84')]){_0x24bbd4[_0x4f6d('0x89')]=_0x1305f6;_0x24bbd4['applications']=_0x1305f6[_0x4f6d('0x8a')];_0x24bbd4[_0x4f6d('0x8b')]=_0x1305f6[_0x4f6d('0x84')];_0x24bbd4[_0x4f6d('0x8c')]=_[_0x4f6d('0x8d')](_0x24bbd4['applications'],[_0x4f6d('0x8e')],[_0x4f6d('0x8f')]);if(_0x24bbd4['account'][_0x4f6d('0x8a')]){delete _0x24bbd4[_0x4f6d('0x89')][_0x4f6d('0x8a')];}if(_0x24bbd4[_0x4f6d('0x89')][_0x4f6d('0x84')]&&_0x24bbd4[_0x4f6d('0x89')]['List'][_0x4f6d('0x86')][_0x4f6d('0x5a')]){return _0x24bbd4[_0x4f6d('0x89')]['List'][_0x4f6d('0x86')][0x0];}var _0x22ab95=_[_0x4f6d('0x18')](_0x2458ed[_0x4f6d('0x5d')],{'firstName':_0x2458ed[_0x4f6d('0x5d')][_0x4f6d('0x7d')],'ListId':_0x1305f6[_0x4f6d('0x7b')]});_0x22ab95[_0x2458ed[_0x4f6d('0x5d')][_0x4f6d('0x83')]]=_0x2458ed['body']['from'];return db[_0x4f6d('0x85')][_0x4f6d('0x5c')](_0x22ab95,{'fields':_0x57ac9b,'raw':!![]});}})[_0x4f6d('0x23')](handleEntityNotFound(_0xe85cad,null))['then'](function(_0x3fd8d9){_0x24bbd4[_0x4f6d('0x90')]=_0x3fd8d9;if(_0x3fd8d9){var _0x1d4c11={'ContactId':_0x3fd8d9['id'],'OpenchannelAccountId':_0x2458ed[_0x4f6d('0x66')]['id'],'from':(_0x3fd8d9[_0x4f6d('0x91')]||'')+'\x20'+(_0x3fd8d9[_0x4f6d('0x92')]||'')};var _0x428354={'OpenchannelAccountId':_0x2458ed[_0x4f6d('0x66')]['id'],'closed':![]};if(_0x2458ed['body'][_0x4f6d('0x93')]){_0x428354[_0x4f6d('0x93')]=_0x2458ed[_0x4f6d('0x5d')][_0x4f6d('0x93')];return db[_0x4f6d('0x94')]['find']({'where':_0x428354})[_0x4f6d('0x23')](function(_0x56fa16){if(_0x56fa16){return[_0x56fa16,![]];}_0x1d4c11['threadId']=_0x2458ed[_0x4f6d('0x5d')][_0x4f6d('0x93')];_0x1d4c11[_0x4f6d('0x95')]=_0x2458ed[_0x4f6d('0x5d')]['externalUrl'];return db[_0x4f6d('0x94')][_0x4f6d('0x5c')](_0x1d4c11)[_0x4f6d('0x23')](function(_0x55bcd2){return[_0x55bcd2,!![]];});});}else{_0x428354[_0x4f6d('0x93')]=null;}_0x428354[_0x4f6d('0x96')]=_0x3fd8d9['id'];return db[_0x4f6d('0x94')][_0x4f6d('0x61')]({'where':_0x428354})['then'](function(_0x5b0e97){if(_0x5b0e97){return[_0x5b0e97,![]];}return db[_0x4f6d('0x94')][_0x4f6d('0x5c')](_0x1d4c11)['then'](function(_0xff477c){return[_0xff477c,!![]];});});}})[_0x4f6d('0x97')](function(_0x345f44,_0x22278e){if(_0x345f44){_0x2ac1f9=_0x22278e;if(!_0x22278e){var _0x3b47fa={'from':(_0x24bbd4[_0x4f6d('0x90')]['firstName']||'')+'\x20'+(_0x24bbd4[_0x4f6d('0x90')][_0x4f6d('0x92')]||'')};if(_0x2458ed[_0x4f6d('0x5d')][_0x4f6d('0x93')]&&_0x2458ed[_0x4f6d('0x5d')][_0x4f6d('0x98')]&&_0x2458ed[_0x4f6d('0x5d')][_0x4f6d('0x93')]!=_0x2458ed[_0x4f6d('0x5d')][_0x4f6d('0x98')]){_0x3b47fa[_0x4f6d('0x93')]=_0x2458ed[_0x4f6d('0x5d')][_0x4f6d('0x98')];}return _0x345f44['update'](_0x3b47fa);}else{return _0x345f44;}}})[_0x4f6d('0x23')](function(_0x1a370b){_0x24bbd4[_0x4f6d('0x99')]=_0x1a370b['get']({'plain':!![]});_0x24bbd4[_0x4f6d('0x99')][_0x4f6d('0x9a')]=_0x2ac1f9;if(_0x24bbd4[_0x4f6d('0x99')][_0x4f6d('0x9a')]){if(_0x24bbd4[_0x4f6d('0x89')]['autoclose']){_0x24bbd4[_0x4f6d('0x8c')][_0x4f6d('0x9b')]({'id':0x0,'priority':_0x24bbd4['applications'][_0x4f6d('0x5a')]+0x1,'app':_0x4f6d('0x9c'),'appdata':_0x4f6d('0x9d'),'interval':_0x4f6d('0x9e')});}}return db[_0x4f6d('0x9f')]['create']({'body':_0x2458ed['body'][_0x4f6d('0x5d')],'OpenchannelAccountId':_0x2458ed['params']['id'],'OpenchannelInteractionId':_0x1a370b['id'],'direction':'in','ContactId':_0x24bbd4[_0x4f6d('0x90')]['id'],'AttachmentId':_0x2458ed['body'][_0x4f6d('0xa0')]});})['then'](function(_0x103e12){_0x24bbd4['message']=_0x103e12;if(_0x24bbd4[_0x4f6d('0x99')][_0x4f6d('0xa1')]){return db['User']['find']({'attributes':['id',_0x4f6d('0x3c')],'where':{'id':_0x24bbd4['interaction'][_0x4f6d('0xa1')]}})[_0x4f6d('0x23')](function(_0x38f655){if(_0x38f655){_0x24bbd4[_0x4f6d('0x8c')][_0x4f6d('0xa2')]({'id':0x0,'priority':0x0,'app':_0x4f6d('0xa3'),'appdata':_0x38f655[_0x4f6d('0x3c')]+','+(_0x24bbd4['account'][_0x4f6d('0xa4')]||0xa),'interval':_0x4f6d('0x9e')});_0x24bbd4['forcedOwnership']=![];}return respondWithRpcPromise('Start',_0x4f6d('0xa5'),_0x24bbd4);});}return respondWithRpcPromise('Start',_0x4f6d('0xa5'),_0x24bbd4);})[_0x4f6d('0x23')](function(_0x47e272){respondWithRpcPromise('EventManager',_0x4f6d('0xa6'),{'event':_0x4f6d('0xa7'),'message':_0x47e272},client9002);return _0x47e272;})[_0x4f6d('0x23')](respondWithResult(_0xe85cad,null))[_0x4f6d('0x2d')](handleError(_0xe85cad,null));};exports[_0x4f6d('0xa8')]=function(_0x14980d,_0x1309d5,_0x30f063){return db[_0x4f6d('0x3f')][_0x4f6d('0x6b')]({'where':{'id':_0x14980d['params']['id']}})[_0x4f6d('0x23')](handleEntityNotFound(_0x1309d5,null))[_0x4f6d('0x23')](function(_0x238253){if(_0x238253){return db[_0x4f6d('0xa9')][_0x4f6d('0xaa')](function(_0x4752c4){return db[_0x4f6d('0x88')][_0x4f6d('0x37')]({'where':{'OpenchannelAccountId':_0x14980d[_0x4f6d('0x66')]['id']},'transaction':_0x4752c4})['then'](function(_0x263316){var _0x375985=_[_0x4f6d('0x43')](_0x14980d['body'],function(_0x27ea8f){_0x27ea8f[_0x4f6d('0x6e')]=_0x14980d[_0x4f6d('0x66')]['id'];return _0x27ea8f;});return db[_0x4f6d('0x88')][_0x4f6d('0xab')](_0x375985,{'transaction':_0x4752c4});});})[_0x4f6d('0x23')](function(){return db[_0x4f6d('0x88')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x14980d[_0x4f6d('0x66')]['id']},'order':_0x4f6d('0x8e')});});}})['then'](respondWithResult(_0x1309d5,null))[_0x4f6d('0x2d')](handleError(_0x1309d5,null));};exports['getApplications']=function(_0x4be187,_0x915abb,_0x1b4db3){var _0x4d126d={};var _0xc8f203={};var _0x2113e3;var _0xfd5364;return db[_0x4f6d('0x3f')][_0x4f6d('0x6b')]({'where':{'id':_0x4be187['params']['id']}})[_0x4f6d('0x23')](handleEntityNotFound(_0x915abb,null))['then'](function(_0x39bf02){if(_0x39bf02){_0x2113e3=_0x39bf02;_0xc8f203[_0x4f6d('0x42')]=_[_0x4f6d('0x45')](db['OpenchannelApplication'][_0x4f6d('0x59')]);_0xc8f203[_0x4f6d('0x44')]=_[_0x4f6d('0x45')](_0x4be187[_0x4f6d('0x44')]);_0xc8f203[_0x4f6d('0x4d')]=_[_0x4f6d('0x46')](_0xc8f203[_0x4f6d('0x42')],_0xc8f203['query']);_0x4d126d[_0x4f6d('0x48')]=_['intersection'](_0xc8f203[_0x4f6d('0x42')],qs['fields'](_0x4be187[_0x4f6d('0x44')]['fields']));_0x4d126d[_0x4f6d('0x48')]=_0x4d126d[_0x4f6d('0x48')][_0x4f6d('0x5a')]?_0x4d126d[_0x4f6d('0x48')]:_0xc8f203[_0x4f6d('0x42')];_0x4d126d[_0x4f6d('0x6d')]=qs[_0x4f6d('0x4c')](_0x4be187[_0x4f6d('0x44')][_0x4f6d('0x4c')]);_0x4d126d[_0x4f6d('0x4f')]=qs['filters'](_[_0x4f6d('0x4e')](_0x4be187['query'],_0xc8f203['filters']));if(_0x4be187[_0x4f6d('0x44')][_0x4f6d('0x6f')]){_0x4d126d[_0x4f6d('0x4f')]=_[_0x4f6d('0x50')](_0x4d126d['where'],{'$or':_[_0x4f6d('0x43')](_0x4d126d[_0x4f6d('0x48')],function(_0x4b29d5){var _0x16ce9d={};_0x16ce9d[_0x4b29d5]={'$like':'%'+_0x4be187[_0x4f6d('0x44')][_0x4f6d('0x6f')]+'%'};return _0x16ce9d;})});}_0x4d126d=_[_0x4f6d('0x50')]({},_0x4d126d,_0x4be187[_0x4f6d('0x52')]);return _0x2113e3['getApplications'](_0x4d126d);}})[_0x4f6d('0x23')](function(_0x298ab1){if(_0x298ab1){_0xfd5364=_0x298ab1[_0x4f6d('0x5a')];if(!_0x4be187[_0x4f6d('0x44')][_0x4f6d('0x49')]('nolimit')){_0x4d126d[_0x4f6d('0x4b')]=qs[_0x4f6d('0x4b')](_0x4be187[_0x4f6d('0x44')][_0x4f6d('0x4b')]);_0x4d126d[_0x4f6d('0x32')]=qs[_0x4f6d('0x32')](_0x4be187[_0x4f6d('0x44')]['offset']);}return _0x2113e3[_0x4f6d('0xac')](_0x4d126d);}})[_0x4f6d('0x23')](function(_0x6a9122){if(_0x6a9122){return _0x6a9122?{'count':_0xfd5364,'rows':_0x6a9122}:null;}})[_0x4f6d('0x23')](respondWithResult(_0x915abb,null))[_0x4f6d('0x2d')](handleError(_0x915abb,null));};exports[_0x4f6d('0xad')]=function(_0x38a441,_0x28d6e0,_0x1eadad){var _0x6fdbb={'raw':![],'where':{}};var _0x3596ef={};var _0x5e6d49={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x4f6d('0x6b')]({'where':{'id':_0x38a441[_0x4f6d('0x66')]['id']}})[_0x4f6d('0x23')](handleEntityNotFound(_0x28d6e0,null))[_0x4f6d('0x23')](function(_0x34b6a5){if(_0x34b6a5){_0x3596ef['model']=_[_0x4f6d('0x45')](db['OpenchannelInteraction'][_0x4f6d('0x59')]);_0x3596ef[_0x4f6d('0x44')]=_[_0x4f6d('0x45')](_0x38a441['query']);_0x3596ef[_0x4f6d('0x4d')]=_[_0x4f6d('0x46')](_0x3596ef[_0x4f6d('0x42')],_0x3596ef[_0x4f6d('0x44')]);_0x6fdbb['attributes']=_['intersection'](_0x3596ef[_0x4f6d('0x42')],qs[_0x4f6d('0x47')](_0x38a441[_0x4f6d('0x44')]['fields']));_0x6fdbb['attributes']=_0x6fdbb[_0x4f6d('0x48')][_0x4f6d('0x5a')]?_0x6fdbb['attributes']:_0x3596ef['model'];if(!_0x38a441[_0x4f6d('0x44')][_0x4f6d('0x49')](_0x4f6d('0x4a'))){_0x6fdbb[_0x4f6d('0x4b')]=qs[_0x4f6d('0x4b')](_0x38a441[_0x4f6d('0x44')][_0x4f6d('0x4b')]);_0x6fdbb[_0x4f6d('0x32')]=qs[_0x4f6d('0x32')](_0x38a441[_0x4f6d('0x44')][_0x4f6d('0x32')]);}_0x6fdbb['order']=qs[_0x4f6d('0x4c')](_0x38a441[_0x4f6d('0x44')]['sort']);_0x6fdbb[_0x4f6d('0x4f')]=qs[_0x4f6d('0x4d')](_[_0x4f6d('0x4e')](_0x38a441[_0x4f6d('0x44')],_0x3596ef[_0x4f6d('0x4d')]));_0x6fdbb[_0x4f6d('0x4f')]['OpenchannelAccountId']=_0x34b6a5['id'];if(_0x38a441[_0x4f6d('0x44')][_0x4f6d('0x6f')]){_0x6fdbb[_0x4f6d('0x4f')]=_[_0x4f6d('0x50')](_0x6fdbb['where'],{'$or':_['map'](_0x6fdbb[_0x4f6d('0x48')],function(_0x2e4efd){var _0x52a12e={};_0x52a12e[_0x2e4efd]={'$like':'%'+_0x38a441[_0x4f6d('0x44')][_0x4f6d('0x6f')]+'%'};return _0x52a12e;})});}_0x6fdbb=_[_0x4f6d('0x50')]({},_0x6fdbb,_0x38a441[_0x4f6d('0x52')]);return db['OpenchannelInteraction'][_0x4f6d('0x53')]({'where':_0x6fdbb[_0x4f6d('0x4f')]})[_0x4f6d('0x23')](function(_0x504296){_0x5e6d49[_0x4f6d('0x53')]=_0x504296;if(_0x38a441['query'][_0x4f6d('0x54')]){_0x6fdbb['include']=[{'model':db[_0x4f6d('0x85')],'as':'Contact','required':![]},{'model':db[_0x4f6d('0xae')],'as':_0x4f6d('0xaf'),'attributes':[_0x4f6d('0x3c'),_0x4f6d('0xb0'),_0x4f6d('0xb1')],'required':![]},{'model':db['Tag'],'as':_0x4f6d('0xb2'),'attributes':['id',_0x4f6d('0x3c'),_0x4f6d('0xb3')],'where':_0x38a441[_0x4f6d('0x44')]['tag']?{'id':_0x38a441[_0x4f6d('0x44')][_0x4f6d('0xb4')]}:undefined,'required':_0x38a441['query'][_0x4f6d('0xb4')]?!![]:![]}];}return db[_0x4f6d('0x94')][_0x4f6d('0x55')](_0x6fdbb);})[_0x4f6d('0x23')](function(_0x14a7b4){_0x5e6d49[_0x4f6d('0x56')]=_0x14a7b4;return _0x5e6d49;});}})[_0x4f6d('0x23')](respondWithFilteredResult(_0x28d6e0,_0x6fdbb))[_0x4f6d('0x2d')](handleError(_0x28d6e0,null));};exports['addAgents']=function(_0x531832,_0x191b27,_0x17eaed){return db['OpenchannelAccount'][_0x4f6d('0x61')]({'where':{'id':_0x531832['params']['id']}})[_0x4f6d('0x23')](handleEntityNotFound(_0x191b27,null))[_0x4f6d('0x23')](function(_0x3f02e3){if(_0x3f02e3){return _0x3f02e3[_0x4f6d('0xb5')](_0x531832[_0x4f6d('0x5d')][_0x4f6d('0x75')],_[_0x4f6d('0xb6')](_0x531832[_0x4f6d('0x5d')],[_0x4f6d('0x75'),'id'])||{})[_0x4f6d('0x97')](function(_0x4ca9e7){for(var _0x30e464=0x0;_0x30e464<_0x531832['body'][_0x4f6d('0x75')]['length'];_0x30e464+=0x1){socket[_0x4f6d('0xb7')](_0x4f6d('0xb8'),{'UserId':_0x531832[_0x4f6d('0x5d')][_0x4f6d('0x75')][_0x30e464],'OpenchannelAccountId':_0x531832[_0x4f6d('0x66')]['id']});}return _0x4ca9e7;});}})[_0x4f6d('0x23')](respondWithResult(_0x191b27,null))[_0x4f6d('0x2d')](handleError(_0x191b27,null));};exports[_0x4f6d('0xb9')]=function(_0x4d4c0d,_0x2e2faa,_0x3435ce){return db[_0x4f6d('0x3f')]['find']({'where':{'id':_0x4d4c0d[_0x4f6d('0x66')]['id']}})[_0x4f6d('0x23')](handleEntityNotFound(_0x2e2faa,null))[_0x4f6d('0x23')](function(_0xa79cbc){if(_0xa79cbc){return _0xa79cbc[_0x4f6d('0xb9')](_0x4d4c0d[_0x4f6d('0x44')][_0x4f6d('0x75')])[_0x4f6d('0x23')](function(){if(_['isArray'](_0x4d4c0d['query']['ids'])){for(var _0x34a165=0x0;_0x34a165<_0x4d4c0d[_0x4f6d('0x44')]['ids'][_0x4f6d('0x5a')];_0x34a165+=0x1){socket[_0x4f6d('0xb7')](_0x4f6d('0xba'),{'UserId':Number(_0x4d4c0d[_0x4f6d('0x44')]['ids'][_0x34a165]),'OpenchannelAccountId':Number(_0x4d4c0d[_0x4f6d('0x66')]['id'])});}}else{socket['emit'](_0x4f6d('0xba'),{'UserId':Number(_0x4d4c0d['query'][_0x4f6d('0x75')]),'OpenchannelAccountId':Number(_0x4d4c0d[_0x4f6d('0x66')]['id'])});}});}})[_0x4f6d('0x23')](respondWithStatusCode(_0x2e2faa,null))[_0x4f6d('0x2d')](handleError(_0x2e2faa,null));};exports[_0x4f6d('0xbb')]=function(_0x33e882,_0x3edd78,_0x48232d){var _0x5f1d87={};var _0x5cd064={};var _0x46fe95;var _0x18e307;return db[_0x4f6d('0x3f')]['findOne']({'where':{'id':_0x33e882[_0x4f6d('0x66')]['id']}})[_0x4f6d('0x23')](handleEntityNotFound(_0x3edd78,null))[_0x4f6d('0x23')](function(_0x4208e4){if(_0x4208e4){_0x46fe95=_0x4208e4;_0x5cd064['model']=_[_0x4f6d('0x45')](db[_0x4f6d('0xae')][_0x4f6d('0x59')]);_0x5cd064[_0x4f6d('0x44')]=_[_0x4f6d('0x45')](_0x33e882[_0x4f6d('0x44')]);_0x5cd064[_0x4f6d('0x4d')]=_[_0x4f6d('0x46')](_0x5cd064['model'],_0x5cd064[_0x4f6d('0x44')]);_0x5f1d87[_0x4f6d('0x48')]=_[_0x4f6d('0x46')](_0x5cd064[_0x4f6d('0x42')],qs[_0x4f6d('0x47')](_0x33e882['query'][_0x4f6d('0x47')]));_0x5f1d87[_0x4f6d('0x48')]=_0x5f1d87[_0x4f6d('0x48')]['length']?_0x5f1d87[_0x4f6d('0x48')]:_0x5cd064[_0x4f6d('0x42')];_0x5f1d87[_0x4f6d('0x6d')]=qs[_0x4f6d('0x4c')](_0x33e882['query']['sort']);_0x5f1d87[_0x4f6d('0x4f')]=qs[_0x4f6d('0x4d')](_['pick'](_0x33e882[_0x4f6d('0x44')],_0x5cd064['filters']));if(_0x33e882[_0x4f6d('0x44')][_0x4f6d('0x6f')]){_0x5f1d87[_0x4f6d('0x4f')]=_['merge'](_0x5f1d87[_0x4f6d('0x4f')],{'$or':_[_0x4f6d('0x43')](_0x5f1d87['attributes'],function(_0x1354a7){var _0xfc6789={};_0xfc6789[_0x1354a7]={'$like':'%'+_0x33e882[_0x4f6d('0x44')][_0x4f6d('0x6f')]+'%'};return _0xfc6789;})});}_0x5f1d87=_[_0x4f6d('0x50')]({},_0x5f1d87,_0x33e882[_0x4f6d('0x52')]);return _0x46fe95[_0x4f6d('0xbb')](_0x5f1d87);}})[_0x4f6d('0x23')](function(_0x48e855){if(_0x48e855){_0x18e307=_0x48e855[_0x4f6d('0x5a')];if(!_0x33e882[_0x4f6d('0x44')]['hasOwnProperty'](_0x4f6d('0x4a'))){_0x5f1d87[_0x4f6d('0x4b')]=qs[_0x4f6d('0x4b')](_0x33e882[_0x4f6d('0x44')]['limit']);_0x5f1d87[_0x4f6d('0x32')]=qs[_0x4f6d('0x32')](_0x33e882[_0x4f6d('0x44')][_0x4f6d('0x32')]);}return _0x46fe95['getAgents'](_0x5f1d87);}})[_0x4f6d('0x23')](function(_0x47a58c){if(_0x47a58c){return _0x47a58c?{'count':_0x18e307,'rows':_0x47a58c}:null;}})[_0x4f6d('0x23')](respondWithResult(_0x3edd78,null))['catch'](handleError(_0x3edd78,null));};exports[_0x4f6d('0xbc')]=function(_0x373262,_0x9d892b,_0x42fe9c){var _0x46374f,_0x149bc7,_0x538e39;if(_['isNil'](_0x373262[_0x4f6d('0x5d')][_0x4f6d('0x5d')])||_0x373262['body']['body']===''){throw new db['Sequelize'][(_0x4f6d('0x7e'))](_0x4f6d('0x80'));}if(_[_0x4f6d('0x7c')](_0x373262['body']['to'])){}_0x46374f=_0x373262['body']['to'];return db['OpenchannelAccount'][_0x4f6d('0x6b')]({'where':{'id':_0x373262[_0x4f6d('0x66')]['id']}})[_0x4f6d('0x23')](handleEntityNotFound(_0x9d892b,null))[_0x4f6d('0x23')](function(_0xce8674){if(_0xce8674){return db[_0x4f6d('0x3f')]['find']({'where':{'id':_0xce8674['id']},'include':[{'model':db[_0x4f6d('0xbd')],'as':_0x4f6d('0x84'),'include':[{'model':db[_0x4f6d('0x85')],'as':_0x4f6d('0x86'),'where':{[_0xce8674['mapKey']]:_0x46374f},'limit':0x1,'order':[[_0x4f6d('0x79'),_0x4f6d('0x87')]]}]}]})[_0x4f6d('0x23')](handleEntityNotFound(_0x9d892b,null))[_0x4f6d('0x23')](function(_0x42d884){if(_0x42d884&&_0x42d884['List']){_0x149bc7=_0x42d884[_0x4f6d('0x38')]({'plain':!![]});if(_0x149bc7[_0x4f6d('0x84')]&&_0x149bc7[_0x4f6d('0x84')]['Contacts'][_0x4f6d('0x5a')]){return _0x149bc7['List'][_0x4f6d('0x86')][0x0];}return db[_0x4f6d('0x85')]['create'](_[_0x4f6d('0x18')](_0x373262[_0x4f6d('0x5d')],{'firstName':_0x46374f,[_0x42d884[_0x4f6d('0x83')]]:_0x46374f,'phone':_0x46374f,'ListId':_0x149bc7['ListId']}));}})['then'](handleEntityNotFound(_0x9d892b,null))[_0x4f6d('0x23')](function(_0x39c6dd){if(_0x39c6dd){_0x538e39=_0x39c6dd;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x538e39['id'],'closed':![],'OpenchannelAccountId':_0x149bc7['id']}})[_0x4f6d('0x23')](function(_0x3c6793){if(_0x3c6793){return[_0x3c6793,![]];}return db[_0x4f6d('0x94')][_0x4f6d('0x5c')]({'UserId':_0x373262[_0x4f6d('0x5e')]['id'],'ContactId':_0x538e39['id'],'OpenchannelAccountId':_0x149bc7['id'],'lastMsgDirection':_0x4f6d('0xbe'),'Messages':[_[_0x4f6d('0x50')](_0x373262[_0x4f6d('0x5d')],{'read':![],'body':_0x373262[_0x4f6d('0x5d')]['body'],'OpenchannelAccountId':_0x149bc7['id'],'UserId':_0x373262[_0x4f6d('0x5e')]['id'],'ContactId':_0x538e39['id']})]},{'include':[{'model':db[_0x4f6d('0x9f')],'as':_0x4f6d('0xbf')}]})[_0x4f6d('0x23')](function(_0x226b9d){return[_0x226b9d,!![]];});});}})[_0x4f6d('0x97')](function(_0x1cf068,_0x319633){if(_0x319633){return _0x1cf068;}return db[_0x4f6d('0x9f')][_0x4f6d('0x5c')](_['merge'](_0x373262['body'],{'read':![],'body':_0x373262[_0x4f6d('0x5d')][_0x4f6d('0x5d')],'OpenchannelAccountId':_0x149bc7['id'],'OpenchannelInteractionId':_0x1cf068['id'],'UserId':_0x373262[_0x4f6d('0x5e')]['id'],'ContactId':_0x538e39['id']}))[_0x4f6d('0x23')](function(_0x35fde9){_0x1cf068[_0x4f6d('0xc0')][_0x4f6d('0xbf')]=[];_0x1cf068[_0x4f6d('0xc0')][_0x4f6d('0xbf')][_0x4f6d('0x9b')](_0x35fde9['dataValues']);return _0x1cf068;});});}})[_0x4f6d('0x23')](respondWithResult(_0x9d892b,null))[_0x4f6d('0x2d')](handleError(_0x9d892b,null));}; \ No newline at end of file +var _0xf98c=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','type','VIRTUAL','options','count','includeAll','findAll','catch','show','params','rawAttributes','include','merge','create','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','findOne','nolimit','pick','rows','removeDispositions','addAnswer','OpenchannelAccountId','CannedAnswer','order','removeAnswers','openchannel','no\x20available\x20attributes','createdAt','difference','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','List','Contacts','Applications','account','applications','list','orderBy','priority','asc','CmContact','contact','firstName','threadId','externalUrl','OpenchannelInteraction','ContactId','messageId','created','interaction','push','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','notify','sequelize','OpenchannelApplication','findAndCountAll','getInteractions','Contact','Owner','fullname','internal','color','tag','addAgents','omit','ids','spread','removeAgents','isArray','userOpenchannelAccount:remove','emit','getAgents','CmList','DESC','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x3ce937,_0x568d7d){var _0x41d2fa=function(_0x19a409){while(--_0x19a409){_0x3ce937['push'](_0x3ce937['shift']());}};_0x41d2fa(++_0x568d7d);}(_0xf98c,0x16a));var _0xcf98=function(_0x42b3fa,_0x420f0f){_0x42b3fa=_0x42b3fa-0x0;var _0x51a98c=_0xf98c[_0x42b3fa];return _0x51a98c;};'use strict';var pdf=require(_0xcf98('0x0'));var emlformat=require(_0xcf98('0x1'));var rimraf=require(_0xcf98('0x2'));var zipdir=require(_0xcf98('0x3'));var jsonpatch=require(_0xcf98('0x4'));var rp=require(_0xcf98('0x5'));var moment=require(_0xcf98('0x6'));var BPromise=require(_0xcf98('0x7'));var Mustache=require('mustache');var util=require(_0xcf98('0x8'));var path=require(_0xcf98('0x9'));var sox=require(_0xcf98('0xa'));var csv=require(_0xcf98('0xb'));var ejs=require(_0xcf98('0xc'));var fs=require('fs');var _=require(_0xcf98('0xd'));var squel=require(_0xcf98('0xe'));var crypto=require(_0xcf98('0xf'));var jsforce=require(_0xcf98('0x10'));var deskjs=require(_0xcf98('0x11'));var toCsv=require(_0xcf98('0xb'));var querystring=require(_0xcf98('0x12'));var Papa=require(_0xcf98('0x13'));var Redis=require('ioredis');var authService=require(_0xcf98('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcf98('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcf98('0x16'))(_0xcf98('0x17'));var utils=require(_0xcf98('0x18'));var config=require('../../config/environment');var db=require(_0xcf98('0x19'))['db'];config[_0xcf98('0x1a')]=_[_0xcf98('0x1b')](config[_0xcf98('0x1a')],{'host':_0xcf98('0x1c'),'port':0x18eb});var socket=require(_0xcf98('0x1d'))(new Redis(config['redis']));require(_0xcf98('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xcf98('0x1f')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x16e357,_0x4d580d,_0x442f7b){if(_0x442f7b){var _0xcd0b55=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xcd0b55[_0xcf98('0x20')](_0x4d580d)){return _0x16e357;}else{throw new db[(_0xcf98('0x21'))][(_0xcf98('0x22'))](_0xcf98('0x23'));}}else{return _0x16e357;}}function respondWithRpcPromise(_0x1c0f2c,_0x29925f,_0x2f5034,_0xd90f0a){return new BPromise(function(_0x3a805b,_0x15fb8f){var _0xc1dd65=_0xd90f0a||client;return _0xc1dd65['request'](_0x1c0f2c,_0x2f5034)[_0xcf98('0x24')](function(_0x184bab){logger[_0xcf98('0x25')](_0xcf98('0x26'),_0x29925f,_0xcf98('0x27'));logger[_0xcf98('0x28')](_0xcf98('0x29'),_0x29925f,_0xcf98('0x27'),JSON['stringify'](_0x184bab));if(_0x184bab[_0xcf98('0x2a')]){if(_0x184bab[_0xcf98('0x2a')][_0xcf98('0x2b')]===0x1f4){logger[_0xcf98('0x2a')]('OpenchannelAccount,\x20%s,\x20%s',_0x29925f,_0x184bab[_0xcf98('0x2a')][_0xcf98('0x2c')]);return _0x15fb8f(_0x184bab[_0xcf98('0x2a')]['message']);}logger[_0xcf98('0x2a')]('OpenchannelAccount,\x20%s,\x20%s',_0x29925f,_0x184bab[_0xcf98('0x2a')]['message']);return _0x3a805b(_0x184bab[_0xcf98('0x2a')][_0xcf98('0x2c')]);}else{logger[_0xcf98('0x25')](_0xcf98('0x26'),_0x29925f,_0xcf98('0x27'));_0x3a805b(_0x184bab[_0xcf98('0x2d')]['message']);}})['catch'](function(_0xebab68){logger[_0xcf98('0x2a')]('OpenchannelAccount,\x20%s,\x20%s',_0x29925f,_0xebab68);_0x15fb8f(_0xebab68);});});}function respondWithStatusCode(_0x39e467,_0x1f9323){_0x1f9323=_0x1f9323||0xcc;return function(_0x2f6b5e){if(_0x2f6b5e){return _0x39e467[_0xcf98('0x2e')](_0x1f9323);}return _0x39e467[_0xcf98('0x2f')](_0x1f9323)[_0xcf98('0x30')]();};}function respondWithResult(_0x2e7fc6,_0x443ebe){_0x443ebe=_0x443ebe||0xc8;return function(_0xaf42a3){if(_0xaf42a3){return _0x2e7fc6['status'](_0x443ebe)[_0xcf98('0x31')](_0xaf42a3);}};}function respondWithFilteredResult(_0x5acf65,_0x4bbaf3){return function(_0x3f150b){if(_0x3f150b){var _0x375bcc=_0x3f150b['count'],_0x1a90db=_0x4bbaf3[_0xcf98('0x32')],_0x5d5c9a=_0x4bbaf3['offset']+_0x4bbaf3[_0xcf98('0x33')],_0x59442e;if(_0x5d5c9a>=_0x375bcc){_0x5d5c9a=_0x375bcc;_0x59442e=0xc8;}else{_0x59442e=0xce;}_0x5acf65[_0xcf98('0x2f')](_0x59442e);return _0x5acf65[_0xcf98('0x34')](_0xcf98('0x35'),_0x1a90db+'-'+_0x5d5c9a+'/'+_0x375bcc)[_0xcf98('0x31')](_0x3f150b);}return null;};}function patchUpdates(_0x2227ad){return function(_0x9d08a8){try{jsonpatch[_0xcf98('0x36')](_0x9d08a8,_0x2227ad,!![]);}catch(_0x232b97){return BPromise[_0xcf98('0x37')](_0x232b97);}return _0x9d08a8[_0xcf98('0x38')]();};}function saveUpdates(_0x11b92a,_0x215d49){return function(_0x11bd96){if(_0x11bd96){return _0x11bd96[_0xcf98('0x39')](_0x11b92a)[_0xcf98('0x24')](function(_0x1ec8b7){return _0x1ec8b7;});}return null;};}function removeEntity(_0x1fd1d5,_0x3f9ae4){return function(_0x124782){if(_0x124782){return _0x124782[_0xcf98('0x3a')]()[_0xcf98('0x24')](function(){var _0xc4e632=_0x124782[_0xcf98('0x3b')]({'plain':!![]});var _0x580a5f=_0xcf98('0x3c');return db['UserProfileResource'][_0xcf98('0x3a')]({'where':{'type':_0x580a5f,'resourceId':_0xc4e632['id']}})[_0xcf98('0x24')](function(){return _0x124782;});})['then'](function(){_0x1fd1d5[_0xcf98('0x2f')](0xcc)[_0xcf98('0x30')]();});}};}function handleEntityNotFound(_0x1bae88,_0x134f43){return function(_0x26a8b1){if(!_0x26a8b1){_0x1bae88['sendStatus'](0x194);}return _0x26a8b1;};}function handleError(_0x45d2dd,_0x5051f4){_0x5051f4=_0x5051f4||0x1f4;return function(_0x243f1d){logger['error'](_0x243f1d['stack']);if(_0x243f1d[_0xcf98('0x3d')]){delete _0x243f1d[_0xcf98('0x3d')];}_0x45d2dd['status'](_0x5051f4)[_0xcf98('0x3e')](_0x243f1d);};}exports[_0xcf98('0x3f')]=function(_0x12ca54,_0x5e7a08){var _0x4b3580={'include':[{'model':db[_0xcf98('0x40')],'as':_0xcf98('0x41')}]},_0x25314a={},_0xde848f={'count':0x0,'rows':[]};var _0x21dd4f=_[_0xcf98('0x42')](db[_0xcf98('0x43')]['rawAttributes'],function(_0x15ad0a){return{'name':_0x15ad0a[_0xcf98('0x44')],'type':_0x15ad0a['type'][_0xcf98('0x45')]};});_0x25314a[_0xcf98('0x46')]=_[_0xcf98('0x42')](_0x21dd4f,_0xcf98('0x3d'));_0x25314a[_0xcf98('0x47')]=_[_0xcf98('0x48')](_0x12ca54[_0xcf98('0x47')]);_0x25314a[_0xcf98('0x49')]=_[_0xcf98('0x4a')](_0x25314a[_0xcf98('0x46')],_0x25314a[_0xcf98('0x47')]);_0x4b3580['attributes']=_['intersection'](_0x25314a[_0xcf98('0x46')],qs[_0xcf98('0x4b')](_0x12ca54[_0xcf98('0x47')][_0xcf98('0x4b')]));_0x4b3580['attributes']=_0x4b3580[_0xcf98('0x4c')][_0xcf98('0x4d')]?_0x4b3580[_0xcf98('0x4c')]:_0x25314a[_0xcf98('0x46')];if(!_0x12ca54[_0xcf98('0x47')][_0xcf98('0x4e')]('nolimit')){_0x4b3580['limit']=qs[_0xcf98('0x33')](_0x12ca54[_0xcf98('0x47')]['limit']);_0x4b3580[_0xcf98('0x32')]=qs['offset'](_0x12ca54[_0xcf98('0x47')]['offset']);}_0x4b3580['order']=qs['sort'](_0x12ca54[_0xcf98('0x47')][_0xcf98('0x4f')]);_0x4b3580[_0xcf98('0x50')]=qs[_0xcf98('0x49')](_['pick'](_0x12ca54[_0xcf98('0x47')],_0x25314a[_0xcf98('0x49')]));if(_0x12ca54[_0xcf98('0x47')][_0xcf98('0x51')]){_0x4b3580[_0xcf98('0x50')]=_['merge'](_0x4b3580['where'],{'$or':_[_0xcf98('0x42')](_0x21dd4f,function(_0x126629){if(_0x126629[_0xcf98('0x52')]!==_0xcf98('0x53')){var _0x331d8d={};_0x331d8d[_0x126629['name']]={'$like':'%'+_0x12ca54[_0xcf98('0x47')][_0xcf98('0x51')]+'%'};return _0x331d8d;}})});}_0x4b3580=_['merge']({},_0x4b3580,_0x12ca54[_0xcf98('0x54')]);var _0xabcfed={'where':_0x4b3580[_0xcf98('0x50')]};return db['OpenchannelAccount'][_0xcf98('0x55')](_0xabcfed)[_0xcf98('0x24')](function(_0x4c5c0f){_0xde848f[_0xcf98('0x55')]=_0x4c5c0f;if(_0x12ca54[_0xcf98('0x47')][_0xcf98('0x56')]){_0x4b3580['include']=[{'all':!![]}];}return db[_0xcf98('0x43')][_0xcf98('0x57')](_0x4b3580);})[_0xcf98('0x24')](function(_0x180271){_0xde848f['rows']=_0x180271;return _0xde848f;})[_0xcf98('0x24')](respondWithFilteredResult(_0x5e7a08,_0x4b3580))[_0xcf98('0x58')](handleError(_0x5e7a08,null));};exports[_0xcf98('0x59')]=function(_0xbfeced,_0x5c7a43){var _0x4b41dd={'raw':![],'where':{'id':_0xbfeced[_0xcf98('0x5a')]['id']},'include':[{'model':db[_0xcf98('0x40')],'as':_0xcf98('0x41')}]},_0xe2db13={};_0xe2db13[_0xcf98('0x46')]=_[_0xcf98('0x48')](db[_0xcf98('0x43')][_0xcf98('0x5b')]);_0xe2db13[_0xcf98('0x47')]=_['keys'](_0xbfeced[_0xcf98('0x47')]);_0xe2db13['filters']=_['intersection'](_0xe2db13[_0xcf98('0x46')],_0xe2db13[_0xcf98('0x47')]);_0x4b41dd[_0xcf98('0x4c')]=_[_0xcf98('0x4a')](_0xe2db13['model'],qs[_0xcf98('0x4b')](_0xbfeced[_0xcf98('0x47')][_0xcf98('0x4b')]));_0x4b41dd['attributes']=_0x4b41dd[_0xcf98('0x4c')][_0xcf98('0x4d')]?_0x4b41dd['attributes']:_0xe2db13[_0xcf98('0x46')];if(_0xbfeced[_0xcf98('0x47')]['includeAll']){_0x4b41dd[_0xcf98('0x5c')]=[{'all':!![]}];}_0x4b41dd=_[_0xcf98('0x5d')]({},_0x4b41dd,_0xbfeced[_0xcf98('0x54')]);return db[_0xcf98('0x43')]['find'](_0x4b41dd)['then'](handleEntityNotFound(_0x5c7a43,null))[_0xcf98('0x24')](respondWithResult(_0x5c7a43,null))[_0xcf98('0x58')](handleError(_0x5c7a43,null));};exports[_0xcf98('0x5e')]=function(_0x2ee4c7,_0x3aaf39){return db[_0xcf98('0x43')]['create'](_0x2ee4c7['body'],{})[_0xcf98('0x24')](function(_0x5406c4){var _0x48d6ca=_0x2ee4c7[_0xcf98('0x5f')][_0xcf98('0x3b')]({'plain':!![]});if(!_0x48d6ca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x48d6ca['role']===_0xcf98('0x5f')){var _0x5c346d=_0x5406c4[_0xcf98('0x3b')]({'plain':!![]});var _0x273a41=_0xcf98('0x3c');return db[_0xcf98('0x60')][_0xcf98('0x61')]({'where':{'name':_0x273a41,'userProfileId':_0x48d6ca[_0xcf98('0x62')]},'raw':!![]})[_0xcf98('0x24')](function(_0x4d4b5d){if(_0x4d4b5d&&_0x4d4b5d[_0xcf98('0x63')]===0x0){return db[_0xcf98('0x64')]['create']({'name':_0x5c346d[_0xcf98('0x3d')],'resourceId':_0x5c346d['id'],'type':_0x4d4b5d[_0xcf98('0x3d')],'sectionId':_0x4d4b5d['id']},{})[_0xcf98('0x24')](function(){return _0x5406c4;});}else{return _0x5406c4;}})[_0xcf98('0x58')](function(_0x293744){logger[_0xcf98('0x2a')](_0xcf98('0x65'),_0x293744);throw _0x293744;});}return _0x5406c4;})['then'](respondWithResult(_0x3aaf39,0xc9))[_0xcf98('0x58')](handleError(_0x3aaf39,null));};exports['update']=function(_0x1f3473,_0x4fcc24){if(_0x1f3473[_0xcf98('0x66')]['id']){delete _0x1f3473['body']['id'];}return db[_0xcf98('0x43')]['find']({'where':{'id':_0x1f3473[_0xcf98('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0xcf98('0x41')}]})[_0xcf98('0x24')](handleEntityNotFound(_0x4fcc24,null))[_0xcf98('0x24')](saveUpdates(_0x1f3473[_0xcf98('0x66')],null))['then'](respondWithResult(_0x4fcc24,null))['catch'](handleError(_0x4fcc24,null));};exports[_0xcf98('0x3a')]=function(_0x8e9159,_0x2e0cfa){return db[_0xcf98('0x43')][_0xcf98('0x61')]({'where':{'id':_0x8e9159[_0xcf98('0x5a')]['id']}})[_0xcf98('0x24')](handleEntityNotFound(_0x2e0cfa,null))[_0xcf98('0x24')](removeEntity(_0x2e0cfa,null))[_0xcf98('0x58')](handleError(_0x2e0cfa,null));};exports[_0xcf98('0x67')]=function(_0x1700b9,_0x3dd537){return db[_0xcf98('0x43')][_0xcf98('0x67')]()['then'](respondWithResult(_0x3dd537,null))[_0xcf98('0x58')](handleError(_0x3dd537,null));};exports[_0xcf98('0x68')]=function(_0x569595,_0x581e8f,_0x29ff9d){if(_0x569595[_0xcf98('0x66')]['id']){delete _0x569595['body']['id'];}return db[_0xcf98('0x43')][_0xcf98('0x61')]({'where':{'id':_0x569595[_0xcf98('0x5a')]['id']}})[_0xcf98('0x24')](handleEntityNotFound(_0x581e8f,null))[_0xcf98('0x24')](function(_0xeae1b8){if(_0xeae1b8){_0x569595['body'][_0xcf98('0x69')]=_0xeae1b8['id'];return db[_0xcf98('0x6a')][_0xcf98('0x5e')](_0x569595['body']);}})[_0xcf98('0x24')](respondWithResult(_0x581e8f,null))[_0xcf98('0x58')](handleError(_0x581e8f,null));};exports[_0xcf98('0x6b')]=function(_0x40814f,_0x25058f,_0x370371){var _0x5ecadf={'raw':![],'where':{}};var _0x14c575={};var _0x3e5b59={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xcf98('0x6c')]({'where':{'id':_0x40814f[_0xcf98('0x5a')]['id']}})['then'](handleEntityNotFound(_0x25058f,null))[_0xcf98('0x24')](function(_0x566559){if(_0x566559){_0x14c575[_0xcf98('0x46')]=_[_0xcf98('0x48')](db['Disposition'][_0xcf98('0x5b')]);_0x14c575['query']=_[_0xcf98('0x48')](_0x40814f[_0xcf98('0x47')]);_0x14c575[_0xcf98('0x49')]=_['intersection'](_0x14c575[_0xcf98('0x46')],_0x14c575[_0xcf98('0x47')]);_0x5ecadf[_0xcf98('0x4c')]=_[_0xcf98('0x4a')](_0x14c575[_0xcf98('0x46')],qs[_0xcf98('0x4b')](_0x40814f['query']['fields']));_0x5ecadf[_0xcf98('0x4c')]=_0x5ecadf[_0xcf98('0x4c')]['length']?_0x5ecadf['attributes']:_0x14c575[_0xcf98('0x46')];if(!_0x40814f[_0xcf98('0x47')]['hasOwnProperty'](_0xcf98('0x6d'))){_0x5ecadf['limit']=qs[_0xcf98('0x33')](_0x40814f[_0xcf98('0x47')][_0xcf98('0x33')]);_0x5ecadf['offset']=qs[_0xcf98('0x32')](_0x40814f[_0xcf98('0x47')][_0xcf98('0x32')]);}_0x5ecadf['order']=qs[_0xcf98('0x4f')](_0x40814f['query'][_0xcf98('0x4f')]);_0x5ecadf[_0xcf98('0x50')]=qs[_0xcf98('0x49')](_[_0xcf98('0x6e')](_0x40814f['query'],_0x14c575[_0xcf98('0x49')]));_0x5ecadf[_0xcf98('0x50')]['OpenchannelAccountId']=_0x566559['id'];if(_0x40814f[_0xcf98('0x47')][_0xcf98('0x51')]){_0x5ecadf[_0xcf98('0x50')]=_[_0xcf98('0x5d')](_0x5ecadf[_0xcf98('0x50')],{'$or':_['map'](_0x5ecadf['attributes'],function(_0x3857e7){var _0x435f87={};_0x435f87[_0x3857e7]={'$like':'%'+_0x40814f[_0xcf98('0x47')][_0xcf98('0x51')]+'%'};return _0x435f87;})});}_0x5ecadf=_[_0xcf98('0x5d')]({},_0x5ecadf,_0x40814f[_0xcf98('0x54')]);return db['Disposition'][_0xcf98('0x55')]({'where':_0x5ecadf[_0xcf98('0x50')]})['then'](function(_0x3659a1){_0x3e5b59['count']=_0x3659a1;if(_0x40814f[_0xcf98('0x47')][_0xcf98('0x56')]){_0x5ecadf[_0xcf98('0x5c')]=[{'all':!![]}];}return db[_0xcf98('0x6a')]['findAll'](_0x5ecadf);})[_0xcf98('0x24')](function(_0x28069e){_0x3e5b59[_0xcf98('0x6f')]=_0x28069e;return _0x3e5b59;});}})[_0xcf98('0x24')](respondWithFilteredResult(_0x25058f,_0x5ecadf))[_0xcf98('0x58')](handleError(_0x25058f,null));};exports['removeDispositions']=function(_0x5233a7,_0x532672,_0x4dce56){return db[_0xcf98('0x43')][_0xcf98('0x61')]({'where':{'id':_0x5233a7['params']['id']}})[_0xcf98('0x24')](handleEntityNotFound(_0x532672,null))[_0xcf98('0x24')](function(_0x465c76){if(_0x465c76){return _0x465c76[_0xcf98('0x70')](_0x5233a7[_0xcf98('0x47')]['ids']);}})[_0xcf98('0x24')](respondWithStatusCode(_0x532672,null))[_0xcf98('0x58')](handleError(_0x532672,null));};exports[_0xcf98('0x71')]=function(_0x1d587a,_0x5ee4c7,_0x3e05f6){if(_0x1d587a[_0xcf98('0x66')]['id']){delete _0x1d587a['body']['id'];}return db[_0xcf98('0x43')][_0xcf98('0x61')]({'where':{'id':_0x1d587a[_0xcf98('0x5a')]['id']}})[_0xcf98('0x24')](handleEntityNotFound(_0x5ee4c7,null))[_0xcf98('0x24')](function(_0x12dc3a){if(_0x12dc3a){_0x1d587a['body'][_0xcf98('0x72')]=_0x12dc3a['id'];return db['CannedAnswer'][_0xcf98('0x5e')](_0x1d587a[_0xcf98('0x66')]);}})[_0xcf98('0x24')](respondWithResult(_0x5ee4c7,null))[_0xcf98('0x58')](handleError(_0x5ee4c7,null));};exports['getAnswers']=function(_0x360537,_0xa1ee3a,_0x22272f){var _0x4e9316={'raw':![],'where':{}};var _0xb4db1c={};var _0x3a802f={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xcf98('0x6c')]({'where':{'id':_0x360537[_0xcf98('0x5a')]['id']}})[_0xcf98('0x24')](handleEntityNotFound(_0xa1ee3a,null))['then'](function(_0x3efd75){if(_0x3efd75){_0xb4db1c[_0xcf98('0x46')]=_['keys'](db[_0xcf98('0x73')]['rawAttributes']);_0xb4db1c[_0xcf98('0x47')]=_[_0xcf98('0x48')](_0x360537[_0xcf98('0x47')]);_0xb4db1c[_0xcf98('0x49')]=_[_0xcf98('0x4a')](_0xb4db1c[_0xcf98('0x46')],_0xb4db1c[_0xcf98('0x47')]);_0x4e9316[_0xcf98('0x4c')]=_[_0xcf98('0x4a')](_0xb4db1c[_0xcf98('0x46')],qs[_0xcf98('0x4b')](_0x360537[_0xcf98('0x47')][_0xcf98('0x4b')]));_0x4e9316[_0xcf98('0x4c')]=_0x4e9316['attributes'][_0xcf98('0x4d')]?_0x4e9316[_0xcf98('0x4c')]:_0xb4db1c['model'];if(!_0x360537[_0xcf98('0x47')]['hasOwnProperty'](_0xcf98('0x6d'))){_0x4e9316[_0xcf98('0x33')]=qs['limit'](_0x360537[_0xcf98('0x47')][_0xcf98('0x33')]);_0x4e9316[_0xcf98('0x32')]=qs[_0xcf98('0x32')](_0x360537[_0xcf98('0x47')]['offset']);}_0x4e9316[_0xcf98('0x74')]=qs['sort'](_0x360537['query']['sort']);_0x4e9316[_0xcf98('0x50')]=qs[_0xcf98('0x49')](_[_0xcf98('0x6e')](_0x360537[_0xcf98('0x47')],_0xb4db1c[_0xcf98('0x49')]));_0x4e9316[_0xcf98('0x50')][_0xcf98('0x72')]=_0x3efd75['id'];if(_0x360537[_0xcf98('0x47')][_0xcf98('0x51')]){_0x4e9316['where']=_[_0xcf98('0x5d')](_0x4e9316['where'],{'$or':_['map'](_0x4e9316['attributes'],function(_0x33d259){var _0x4d5c24={};_0x4d5c24[_0x33d259]={'$like':'%'+_0x360537[_0xcf98('0x47')]['filter']+'%'};return _0x4d5c24;})});}_0x4e9316=_[_0xcf98('0x5d')]({},_0x4e9316,_0x360537[_0xcf98('0x54')]);return db[_0xcf98('0x73')]['count']({'where':_0x4e9316[_0xcf98('0x50')]})[_0xcf98('0x24')](function(_0x1ac1f3){_0x3a802f[_0xcf98('0x55')]=_0x1ac1f3;if(_0x360537[_0xcf98('0x47')][_0xcf98('0x56')]){_0x4e9316['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xcf98('0x57')](_0x4e9316);})[_0xcf98('0x24')](function(_0xba29c8){_0x3a802f['rows']=_0xba29c8;return _0x3a802f;});}})[_0xcf98('0x24')](respondWithFilteredResult(_0xa1ee3a,_0x4e9316))['catch'](handleError(_0xa1ee3a,null));};exports[_0xcf98('0x75')]=function(_0x48d982,_0x42c1b9,_0x488185){return db[_0xcf98('0x43')]['find']({'where':{'id':_0x48d982['params']['id']}})[_0xcf98('0x24')](handleEntityNotFound(_0x42c1b9,null))['then'](function(_0x3b154a){if(_0x3b154a){return _0x3b154a[_0xcf98('0x75')](_0x48d982[_0xcf98('0x47')]['ids']);}})[_0xcf98('0x24')](respondWithStatusCode(_0x42c1b9,null))['catch'](handleError(_0x42c1b9,null));};exports['notify']=function(_0x299279,_0x521de9,_0x3288b1){var _0x55eec7={'body':_0x299279[_0xcf98('0x66')],'channel':_0xcf98('0x76')};var _0x1414e5=[];var _0x38b64d=[];var _0x135637={};var _0x29708f=![];return db['CmContact']['describe']()[_0xcf98('0x24')](function(_0x9a43b9){if(!_0x9a43b9){throw new db[(_0xcf98('0x21'))][(_0xcf98('0x22'))](_0xcf98('0x77'));}_0x1414e5=_['difference'](_[_0xcf98('0x48')](_0x9a43b9),[_0xcf98('0x78'),'updatedAt']);_0x38b64d=_[_0xcf98('0x79')](_[_0xcf98('0x48')](_0x9a43b9),[_0xcf98('0x78'),_0xcf98('0x7a'),'CompanyId',_0xcf98('0x7b')]);if(_0x299279[_0xcf98('0x66')]['id']){delete _0x299279['body']['id'];}if(_[_0xcf98('0x7c')](_0x299279[_0xcf98('0x66')][_0xcf98('0x7d')])){throw new db[(_0xcf98('0x21'))][(_0xcf98('0x22'))](_0xcf98('0x7e'));}if(_[_0xcf98('0x7c')](_0x299279[_0xcf98('0x66')]['body'])||_0x299279['body'][_0xcf98('0x66')]===''){throw new db['Sequelize'][(_0xcf98('0x22'))](_0xcf98('0x7f'));}if(_[_0xcf98('0x7c')](_0x299279[_0xcf98('0x66')][_0xcf98('0x80')])){throw new db[(_0xcf98('0x21'))][(_0xcf98('0x22'))](_0xcf98('0x81')+_0x38b64d);}if(!_[_0xcf98('0x82')](_0x38b64d,_0x299279['body'][_0xcf98('0x80')])){throw new db[(_0xcf98('0x21'))][(_0xcf98('0x22'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x38b64d);}_0x135637[_0x299279[_0xcf98('0x66')][_0xcf98('0x80')]]=_0x299279[_0xcf98('0x66')][_0xcf98('0x7d')];})['then'](function(){return db[_0xcf98('0x43')]['find']({'where':{'id':_0x299279[_0xcf98('0x5a')]['id']},'include':[{'model':db['CmList'],'as':_0xcf98('0x83'),'include':[{'model':db['CmContact'],'as':_0xcf98('0x84'),'where':_0x135637,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0xcf98('0x85')}]});})[_0xcf98('0x24')](handleEntityNotFound(_0x521de9,null))[_0xcf98('0x24')](function(_0x23d273){if(_0x23d273&&_0x23d273[_0xcf98('0x83')]){_0x55eec7[_0xcf98('0x86')]=_0x23d273;_0x55eec7[_0xcf98('0x87')]=_0x23d273['Applications'];_0x55eec7[_0xcf98('0x88')]=_0x23d273[_0xcf98('0x83')];_0x55eec7[_0xcf98('0x87')]=_[_0xcf98('0x89')](_0x55eec7[_0xcf98('0x87')],[_0xcf98('0x8a')],[_0xcf98('0x8b')]);if(_0x55eec7[_0xcf98('0x86')][_0xcf98('0x85')]){delete _0x55eec7[_0xcf98('0x86')]['Applications'];}if(_0x55eec7[_0xcf98('0x86')][_0xcf98('0x83')]&&_0x55eec7['account'][_0xcf98('0x83')][_0xcf98('0x84')][_0xcf98('0x4d')]){return _0x55eec7[_0xcf98('0x86')][_0xcf98('0x83')][_0xcf98('0x84')][0x0];}var _0x1d9e08=_[_0xcf98('0x1b')](_0x299279[_0xcf98('0x66')],{'firstName':_0x299279['body']['from'],'ListId':_0x23d273['ListId']});_0x1d9e08[_0x299279[_0xcf98('0x66')][_0xcf98('0x80')]]=_0x299279['body'][_0xcf98('0x7d')];return db[_0xcf98('0x8c')][_0xcf98('0x5e')](_0x1d9e08,{'fields':_0x1414e5,'raw':!![]});}})[_0xcf98('0x24')](handleEntityNotFound(_0x521de9,null))['then'](function(_0x51aaa3){_0x55eec7[_0xcf98('0x8d')]=_0x51aaa3;if(_0x51aaa3){var _0x1f2d64={'ContactId':_0x51aaa3['id'],'OpenchannelAccountId':_0x299279[_0xcf98('0x5a')]['id'],'from':(_0x51aaa3[_0xcf98('0x8e')]||'')+'\x20'+(_0x51aaa3['lastName']||'')};var _0xaa9be6={'OpenchannelAccountId':_0x299279['params']['id'],'closed':![]};if(_0x299279[_0xcf98('0x66')][_0xcf98('0x8f')]){_0xaa9be6[_0xcf98('0x8f')]=_0x299279['body'][_0xcf98('0x8f')];return db['OpenchannelInteraction'][_0xcf98('0x61')]({'where':_0xaa9be6})[_0xcf98('0x24')](function(_0x1cb14b){if(_0x1cb14b){return[_0x1cb14b,![]];}_0x1f2d64[_0xcf98('0x8f')]=_0x299279[_0xcf98('0x66')][_0xcf98('0x8f')];_0x1f2d64[_0xcf98('0x90')]=_0x299279[_0xcf98('0x66')][_0xcf98('0x90')];return db[_0xcf98('0x91')][_0xcf98('0x5e')](_0x1f2d64)[_0xcf98('0x24')](function(_0x34f547){return[_0x34f547,!![]];});});}else{_0xaa9be6[_0xcf98('0x8f')]=null;}_0xaa9be6[_0xcf98('0x92')]=_0x51aaa3['id'];return db['OpenchannelInteraction'][_0xcf98('0x61')]({'where':_0xaa9be6})[_0xcf98('0x24')](function(_0xb5dbfe){if(_0xb5dbfe){return[_0xb5dbfe,![]];}return db[_0xcf98('0x91')][_0xcf98('0x5e')](_0x1f2d64)[_0xcf98('0x24')](function(_0x17c07f){return[_0x17c07f,!![]];});});}})['spread'](function(_0x584800,_0x4c2fb0){if(_0x584800){_0x29708f=_0x4c2fb0;if(!_0x4c2fb0){var _0x219a64={'from':(_0x55eec7[_0xcf98('0x8d')][_0xcf98('0x8e')]||'')+'\x20'+(_0x55eec7[_0xcf98('0x8d')]['lastName']||'')};if(_0x299279[_0xcf98('0x66')]['threadId']&&_0x299279[_0xcf98('0x66')]['messageId']&&_0x299279[_0xcf98('0x66')]['threadId']!=_0x299279[_0xcf98('0x66')][_0xcf98('0x93')]){_0x219a64[_0xcf98('0x8f')]=_0x299279[_0xcf98('0x66')][_0xcf98('0x93')];}return _0x584800[_0xcf98('0x39')](_0x219a64);}else{return _0x584800;}}})[_0xcf98('0x24')](function(_0x74fe26){_0x55eec7['interaction']=_0x74fe26[_0xcf98('0x3b')]({'plain':!![]});_0x55eec7['interaction'][_0xcf98('0x94')]=_0x29708f;if(_0x55eec7[_0xcf98('0x95')][_0xcf98('0x94')]){if(_0x55eec7[_0xcf98('0x86')]['autoclose']){_0x55eec7[_0xcf98('0x87')][_0xcf98('0x96')]({'id':0x0,'priority':_0x55eec7['applications'][_0xcf98('0x4d')]+0x1,'app':'close','appdata':_0xcf98('0x97'),'interval':'*,*,*,*'});}}return db[_0xcf98('0x98')]['create']({'body':_0x299279[_0xcf98('0x66')][_0xcf98('0x66')],'OpenchannelAccountId':_0x299279[_0xcf98('0x5a')]['id'],'OpenchannelInteractionId':_0x74fe26['id'],'direction':'in','ContactId':_0x55eec7['contact']['id'],'AttachmentId':_0x299279[_0xcf98('0x66')][_0xcf98('0x99')]});})[_0xcf98('0x24')](function(_0x4b7a0e){_0x55eec7['message']=_0x4b7a0e;if(_0x55eec7[_0xcf98('0x95')][_0xcf98('0x9a')]){return db[_0xcf98('0x9b')][_0xcf98('0x61')]({'attributes':['id','name'],'where':{'id':_0x55eec7['interaction'][_0xcf98('0x9a')]}})[_0xcf98('0x24')](function(_0x29d54c){if(_0x29d54c){_0x55eec7[_0xcf98('0x87')]['unshift']({'id':0x0,'priority':0x0,'app':_0xcf98('0x9c'),'appdata':_0x29d54c[_0xcf98('0x3d')]+','+(_0x55eec7['account'][_0xcf98('0x9d')]||0xa),'interval':'*,*,*,*'});_0x55eec7['forcedOwnership']=![];}return respondWithRpcPromise(_0xcf98('0x9e'),'startRouting',_0x55eec7);});}return respondWithRpcPromise(_0xcf98('0x9e'),_0xcf98('0x9f'),_0x55eec7);})[_0xcf98('0x24')](function(_0x5b40f5){respondWithRpcPromise(_0xcf98('0xa0'),_0xcf98('0xa0'),{'event':_0xcf98('0xa1'),'message':_0x5b40f5},client9002);return _0x5b40f5;})[_0xcf98('0x24')](respondWithResult(_0x521de9,null))[_0xcf98('0x58')](handleError(_0x521de9,null));};exports['addApplications']=function(_0x4c785a,_0x2d6aa8,_0x15d1a0){return db[_0xcf98('0x43')][_0xcf98('0x6c')]({'where':{'id':_0x4c785a[_0xcf98('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2d6aa8,null))[_0xcf98('0x24')](function(_0x24661f){if(_0x24661f){return db[_0xcf98('0xa2')]['transaction'](function(_0x42abc3){return db[_0xcf98('0xa3')][_0xcf98('0x3a')]({'where':{'OpenchannelAccountId':_0x4c785a[_0xcf98('0x5a')]['id']},'transaction':_0x42abc3})['then'](function(_0x4cc92f){var _0x4fad0e=_[_0xcf98('0x42')](_0x4c785a['body'],function(_0x38099e){_0x38099e[_0xcf98('0x72')]=_0x4c785a[_0xcf98('0x5a')]['id'];return _0x38099e;});return db[_0xcf98('0xa3')]['bulkCreate'](_0x4fad0e,{'transaction':_0x42abc3});});})[_0xcf98('0x24')](function(){return db[_0xcf98('0xa3')][_0xcf98('0xa4')]({'where':{'OpenchannelAccountId':_0x4c785a[_0xcf98('0x5a')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x2d6aa8,null))['catch'](handleError(_0x2d6aa8,null));};exports['getApplications']=function(_0x5593d8,_0x20f993,_0x5001b7){var _0x27f4d8={};var _0x3c8a83={};var _0x238b69;var _0x3da3f6;return db[_0xcf98('0x43')][_0xcf98('0x6c')]({'where':{'id':_0x5593d8[_0xcf98('0x5a')]['id']}})[_0xcf98('0x24')](handleEntityNotFound(_0x20f993,null))[_0xcf98('0x24')](function(_0x40df33){if(_0x40df33){_0x238b69=_0x40df33;_0x3c8a83['model']=_[_0xcf98('0x48')](db[_0xcf98('0xa3')][_0xcf98('0x5b')]);_0x3c8a83[_0xcf98('0x47')]=_[_0xcf98('0x48')](_0x5593d8[_0xcf98('0x47')]);_0x3c8a83[_0xcf98('0x49')]=_['intersection'](_0x3c8a83[_0xcf98('0x46')],_0x3c8a83[_0xcf98('0x47')]);_0x27f4d8['attributes']=_[_0xcf98('0x4a')](_0x3c8a83[_0xcf98('0x46')],qs['fields'](_0x5593d8['query'][_0xcf98('0x4b')]));_0x27f4d8['attributes']=_0x27f4d8[_0xcf98('0x4c')][_0xcf98('0x4d')]?_0x27f4d8[_0xcf98('0x4c')]:_0x3c8a83[_0xcf98('0x46')];_0x27f4d8[_0xcf98('0x74')]=qs[_0xcf98('0x4f')](_0x5593d8['query'][_0xcf98('0x4f')]);_0x27f4d8['where']=qs['filters'](_[_0xcf98('0x6e')](_0x5593d8[_0xcf98('0x47')],_0x3c8a83[_0xcf98('0x49')]));if(_0x5593d8[_0xcf98('0x47')]['filter']){_0x27f4d8[_0xcf98('0x50')]=_[_0xcf98('0x5d')](_0x27f4d8['where'],{'$or':_['map'](_0x27f4d8['attributes'],function(_0x3a4a9d){var _0x257fb6={};_0x257fb6[_0x3a4a9d]={'$like':'%'+_0x5593d8['query'][_0xcf98('0x51')]+'%'};return _0x257fb6;})});}_0x27f4d8=_[_0xcf98('0x5d')]({},_0x27f4d8,_0x5593d8[_0xcf98('0x54')]);return _0x238b69['getApplications'](_0x27f4d8);}})['then'](function(_0x2d22e3){if(_0x2d22e3){_0x3da3f6=_0x2d22e3[_0xcf98('0x4d')];if(!_0x5593d8[_0xcf98('0x47')][_0xcf98('0x4e')](_0xcf98('0x6d'))){_0x27f4d8[_0xcf98('0x33')]=qs['limit'](_0x5593d8[_0xcf98('0x47')][_0xcf98('0x33')]);_0x27f4d8['offset']=qs[_0xcf98('0x32')](_0x5593d8['query'][_0xcf98('0x32')]);}return _0x238b69['getApplications'](_0x27f4d8);}})[_0xcf98('0x24')](function(_0x1637ae){if(_0x1637ae){return _0x1637ae?{'count':_0x3da3f6,'rows':_0x1637ae}:null;}})[_0xcf98('0x24')](respondWithResult(_0x20f993,null))[_0xcf98('0x58')](handleError(_0x20f993,null));};exports[_0xcf98('0xa5')]=function(_0x473474,_0x12185c,_0x4bb6c9){var _0x2500c0={'raw':![],'where':{}};var _0x34081d={};var _0x28aab3={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xcf98('0x6c')]({'where':{'id':_0x473474[_0xcf98('0x5a')]['id']}})[_0xcf98('0x24')](handleEntityNotFound(_0x12185c,null))[_0xcf98('0x24')](function(_0x472f03){if(_0x472f03){_0x34081d[_0xcf98('0x46')]=_['keys'](db[_0xcf98('0x91')][_0xcf98('0x5b')]);_0x34081d[_0xcf98('0x47')]=_['keys'](_0x473474[_0xcf98('0x47')]);_0x34081d[_0xcf98('0x49')]=_[_0xcf98('0x4a')](_0x34081d[_0xcf98('0x46')],_0x34081d[_0xcf98('0x47')]);_0x2500c0['attributes']=_['intersection'](_0x34081d['model'],qs[_0xcf98('0x4b')](_0x473474[_0xcf98('0x47')]['fields']));_0x2500c0[_0xcf98('0x4c')]=_0x2500c0['attributes'][_0xcf98('0x4d')]?_0x2500c0[_0xcf98('0x4c')]:_0x34081d[_0xcf98('0x46')];if(!_0x473474[_0xcf98('0x47')][_0xcf98('0x4e')](_0xcf98('0x6d'))){_0x2500c0[_0xcf98('0x33')]=qs[_0xcf98('0x33')](_0x473474[_0xcf98('0x47')][_0xcf98('0x33')]);_0x2500c0[_0xcf98('0x32')]=qs[_0xcf98('0x32')](_0x473474[_0xcf98('0x47')][_0xcf98('0x32')]);}_0x2500c0['order']=qs['sort'](_0x473474[_0xcf98('0x47')][_0xcf98('0x4f')]);_0x2500c0['where']=qs[_0xcf98('0x49')](_[_0xcf98('0x6e')](_0x473474[_0xcf98('0x47')],_0x34081d[_0xcf98('0x49')]));_0x2500c0[_0xcf98('0x50')][_0xcf98('0x72')]=_0x472f03['id'];if(_0x473474['query']['filter']){_0x2500c0['where']=_[_0xcf98('0x5d')](_0x2500c0[_0xcf98('0x50')],{'$or':_[_0xcf98('0x42')](_0x2500c0[_0xcf98('0x4c')],function(_0x161caa){var _0x199a9c={};_0x199a9c[_0x161caa]={'$like':'%'+_0x473474[_0xcf98('0x47')]['filter']+'%'};return _0x199a9c;})});}_0x2500c0=_[_0xcf98('0x5d')]({},_0x2500c0,_0x473474[_0xcf98('0x54')]);return db['OpenchannelInteraction'][_0xcf98('0x55')]({'where':_0x2500c0[_0xcf98('0x50')]})['then'](function(_0x5b5611){_0x28aab3[_0xcf98('0x55')]=_0x5b5611;if(_0x473474[_0xcf98('0x47')][_0xcf98('0x56')]){_0x2500c0[_0xcf98('0x5c')]=[{'model':db[_0xcf98('0x8c')],'as':_0xcf98('0xa6'),'required':![]},{'model':db['User'],'as':_0xcf98('0xa7'),'attributes':[_0xcf98('0x3d'),_0xcf98('0xa8'),_0xcf98('0xa9')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xcf98('0x3d'),_0xcf98('0xaa')],'where':_0x473474[_0xcf98('0x47')][_0xcf98('0xab')]?{'id':_0x473474[_0xcf98('0x47')][_0xcf98('0xab')]}:undefined,'required':_0x473474['query']['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0xcf98('0x57')](_0x2500c0);})['then'](function(_0x193cd1){_0x28aab3['rows']=_0x193cd1;return _0x28aab3;});}})[_0xcf98('0x24')](respondWithFilteredResult(_0x12185c,_0x2500c0))['catch'](handleError(_0x12185c,null));};exports[_0xcf98('0xac')]=function(_0x17dcbe,_0x53ebfd,_0x2c6970){return db[_0xcf98('0x43')]['find']({'where':{'id':_0x17dcbe[_0xcf98('0x5a')]['id']}})[_0xcf98('0x24')](handleEntityNotFound(_0x53ebfd,null))[_0xcf98('0x24')](function(_0x2dd050){if(_0x2dd050){return _0x2dd050['addAgents'](_0x17dcbe[_0xcf98('0x66')]['ids'],_[_0xcf98('0xad')](_0x17dcbe[_0xcf98('0x66')],[_0xcf98('0xae'),'id'])||{})[_0xcf98('0xaf')](function(_0x340e7c){for(var _0x1c0a22=0x0;_0x1c0a22<_0x17dcbe['body'][_0xcf98('0xae')]['length'];_0x1c0a22+=0x1){socket['emit']('userOpenchannelAccount:save',{'UserId':_0x17dcbe['body'][_0xcf98('0xae')][_0x1c0a22],'OpenchannelAccountId':_0x17dcbe['params']['id']});}return _0x340e7c;});}})[_0xcf98('0x24')](respondWithResult(_0x53ebfd,null))[_0xcf98('0x58')](handleError(_0x53ebfd,null));};exports[_0xcf98('0xb0')]=function(_0x47bb4e,_0x5827cc,_0x948499){return db['OpenchannelAccount'][_0xcf98('0x61')]({'where':{'id':_0x47bb4e[_0xcf98('0x5a')]['id']}})[_0xcf98('0x24')](handleEntityNotFound(_0x5827cc,null))['then'](function(_0x39677e){if(_0x39677e){return _0x39677e[_0xcf98('0xb0')](_0x47bb4e['query'][_0xcf98('0xae')])[_0xcf98('0x24')](function(){if(_[_0xcf98('0xb1')](_0x47bb4e[_0xcf98('0x47')][_0xcf98('0xae')])){for(var _0x5a06cf=0x0;_0x5a06cf<_0x47bb4e['query'][_0xcf98('0xae')][_0xcf98('0x4d')];_0x5a06cf+=0x1){socket['emit'](_0xcf98('0xb2'),{'UserId':Number(_0x47bb4e[_0xcf98('0x47')][_0xcf98('0xae')][_0x5a06cf]),'OpenchannelAccountId':Number(_0x47bb4e[_0xcf98('0x5a')]['id'])});}}else{socket[_0xcf98('0xb3')](_0xcf98('0xb2'),{'UserId':Number(_0x47bb4e[_0xcf98('0x47')][_0xcf98('0xae')]),'OpenchannelAccountId':Number(_0x47bb4e['params']['id'])});}});}})[_0xcf98('0x24')](respondWithStatusCode(_0x5827cc,null))[_0xcf98('0x58')](handleError(_0x5827cc,null));};exports[_0xcf98('0xb4')]=function(_0x56ef5b,_0x1d1ab4,_0x147c65){var _0x474ff6={};var _0x3a043b={};var _0x47feed;var _0x12cad0;return db[_0xcf98('0x43')][_0xcf98('0x6c')]({'where':{'id':_0x56ef5b[_0xcf98('0x5a')]['id']}})[_0xcf98('0x24')](handleEntityNotFound(_0x1d1ab4,null))[_0xcf98('0x24')](function(_0x1a4f8a){if(_0x1a4f8a){_0x47feed=_0x1a4f8a;_0x3a043b[_0xcf98('0x46')]=_[_0xcf98('0x48')](db[_0xcf98('0x9b')]['rawAttributes']);_0x3a043b[_0xcf98('0x47')]=_[_0xcf98('0x48')](_0x56ef5b[_0xcf98('0x47')]);_0x3a043b[_0xcf98('0x49')]=_[_0xcf98('0x4a')](_0x3a043b['model'],_0x3a043b[_0xcf98('0x47')]);_0x474ff6[_0xcf98('0x4c')]=_[_0xcf98('0x4a')](_0x3a043b[_0xcf98('0x46')],qs[_0xcf98('0x4b')](_0x56ef5b[_0xcf98('0x47')]['fields']));_0x474ff6['attributes']=_0x474ff6[_0xcf98('0x4c')][_0xcf98('0x4d')]?_0x474ff6[_0xcf98('0x4c')]:_0x3a043b[_0xcf98('0x46')];_0x474ff6[_0xcf98('0x74')]=qs[_0xcf98('0x4f')](_0x56ef5b[_0xcf98('0x47')][_0xcf98('0x4f')]);_0x474ff6[_0xcf98('0x50')]=qs[_0xcf98('0x49')](_[_0xcf98('0x6e')](_0x56ef5b['query'],_0x3a043b['filters']));if(_0x56ef5b[_0xcf98('0x47')][_0xcf98('0x51')]){_0x474ff6['where']=_[_0xcf98('0x5d')](_0x474ff6[_0xcf98('0x50')],{'$or':_['map'](_0x474ff6[_0xcf98('0x4c')],function(_0x2983fa){var _0x3c772b={};_0x3c772b[_0x2983fa]={'$like':'%'+_0x56ef5b[_0xcf98('0x47')][_0xcf98('0x51')]+'%'};return _0x3c772b;})});}_0x474ff6=_[_0xcf98('0x5d')]({},_0x474ff6,_0x56ef5b[_0xcf98('0x54')]);return _0x47feed[_0xcf98('0xb4')](_0x474ff6);}})['then'](function(_0x40a791){if(_0x40a791){_0x12cad0=_0x40a791[_0xcf98('0x4d')];if(!_0x56ef5b[_0xcf98('0x47')][_0xcf98('0x4e')](_0xcf98('0x6d'))){_0x474ff6['limit']=qs[_0xcf98('0x33')](_0x56ef5b['query'][_0xcf98('0x33')]);_0x474ff6[_0xcf98('0x32')]=qs[_0xcf98('0x32')](_0x56ef5b[_0xcf98('0x47')][_0xcf98('0x32')]);}return _0x47feed[_0xcf98('0xb4')](_0x474ff6);}})[_0xcf98('0x24')](function(_0x47d5b3){if(_0x47d5b3){return _0x47d5b3?{'count':_0x12cad0,'rows':_0x47d5b3}:null;}})[_0xcf98('0x24')](respondWithResult(_0x1d1ab4,null))[_0xcf98('0x58')](handleError(_0x1d1ab4,null));};exports[_0xcf98('0x3e')]=function(_0x2b3657,_0x934d29,_0x324095){var _0x637908,_0xc5aa02,_0x530a3c;if(_[_0xcf98('0x7c')](_0x2b3657[_0xcf98('0x66')]['body'])||_0x2b3657['body'][_0xcf98('0x66')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2b3657[_0xcf98('0x66')]['to'])){}_0x637908=_0x2b3657[_0xcf98('0x66')]['to'];return db['OpenchannelAccount'][_0xcf98('0x6c')]({'where':{'id':_0x2b3657[_0xcf98('0x5a')]['id']}})[_0xcf98('0x24')](handleEntityNotFound(_0x934d29,null))[_0xcf98('0x24')](function(_0x1720fd){if(_0x1720fd){return db[_0xcf98('0x43')][_0xcf98('0x61')]({'where':{'id':_0x1720fd['id']},'include':[{'model':db[_0xcf98('0xb5')],'as':_0xcf98('0x83'),'include':[{'model':db['CmContact'],'as':_0xcf98('0x84'),'where':{[_0x1720fd[_0xcf98('0x80')]]:_0x637908},'limit':0x1,'order':[['updatedAt',_0xcf98('0xb6')]]}]}]})[_0xcf98('0x24')](handleEntityNotFound(_0x934d29,null))[_0xcf98('0x24')](function(_0x4162de){if(_0x4162de&&_0x4162de[_0xcf98('0x83')]){_0xc5aa02=_0x4162de[_0xcf98('0x3b')]({'plain':!![]});if(_0xc5aa02[_0xcf98('0x83')]&&_0xc5aa02['List']['Contacts'][_0xcf98('0x4d')]){return _0xc5aa02['List'][_0xcf98('0x84')][0x0];}return db[_0xcf98('0x8c')][_0xcf98('0x5e')](_['defaults'](_0x2b3657[_0xcf98('0x66')],{'firstName':_0x637908,[_0x4162de[_0xcf98('0x80')]]:_0x637908,'phone':_0x637908,'ListId':_0xc5aa02[_0xcf98('0x7b')]}));}})['then'](handleEntityNotFound(_0x934d29,null))[_0xcf98('0x24')](function(_0x63de3c){if(_0x63de3c){_0x530a3c=_0x63de3c;return db['OpenchannelInteraction'][_0xcf98('0x61')]({'where':{'ContactId':_0x530a3c['id'],'closed':![],'OpenchannelAccountId':_0xc5aa02['id']}})[_0xcf98('0x24')](function(_0x2439b0){if(_0x2439b0){return[_0x2439b0,![]];}return db[_0xcf98('0x91')][_0xcf98('0x5e')]({'UserId':_0x2b3657['user']['id'],'ContactId':_0x530a3c['id'],'OpenchannelAccountId':_0xc5aa02['id'],'lastMsgDirection':'out','Messages':[_[_0xcf98('0x5d')](_0x2b3657[_0xcf98('0x66')],{'read':![],'body':_0x2b3657['body'][_0xcf98('0x66')],'OpenchannelAccountId':_0xc5aa02['id'],'UserId':_0x2b3657['user']['id'],'ContactId':_0x530a3c['id']})]},{'include':[{'model':db[_0xcf98('0x98')],'as':_0xcf98('0xb7')}]})[_0xcf98('0x24')](function(_0x31f35c){return[_0x31f35c,!![]];});});}})['spread'](function(_0x1c1b02,_0x2c2484){if(_0x2c2484){return _0x1c1b02;}return db[_0xcf98('0x98')][_0xcf98('0x5e')](_[_0xcf98('0x5d')](_0x2b3657[_0xcf98('0x66')],{'read':![],'body':_0x2b3657[_0xcf98('0x66')]['body'],'OpenchannelAccountId':_0xc5aa02['id'],'OpenchannelInteractionId':_0x1c1b02['id'],'UserId':_0x2b3657[_0xcf98('0x5f')]['id'],'ContactId':_0x530a3c['id']}))[_0xcf98('0x24')](function(_0x364e7c){_0x1c1b02[_0xcf98('0xb8')][_0xcf98('0xb7')]=[];_0x1c1b02[_0xcf98('0xb8')][_0xcf98('0xb7')]['push'](_0x364e7c['dataValues']);return _0x1c1b02;});});}})['then'](respondWithResult(_0x934d29,null))[_0xcf98('0x58')](handleError(_0x934d29,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 7a62791..d686831 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 _0x86d6=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount'];(function(_0x450d62,_0x43bda4){var _0x39d501=function(_0x30ef91){while(--_0x30ef91){_0x450d62['push'](_0x450d62['shift']());}};_0x39d501(++_0x43bda4);}(_0x86d6,0x84));var _0x686d=function(_0x178ceb,_0x1f8b0c){_0x178ceb=_0x178ceb-0x0;var _0x5a852a=_0x86d6[_0x178ceb];return _0x5a852a;};'use strict';var EventEmitter=require(_0x686d('0x0'));var OpenchannelAccount=require(_0x686d('0x1'))['db'][_0x686d('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x686d('0x3')](0x0);var events={'afterCreate':_0x686d('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x27e765){return function(_0x14cbe2,_0x2f64e1,_0x1201e1){OpenchannelAccountEvents['emit'](_0x27e765+':'+_0x14cbe2['id'],_0x14cbe2);OpenchannelAccountEvents[_0x686d('0x5')](_0x27e765,_0x14cbe2);_0x1201e1(null);};}for(var e in events){if(events[_0x686d('0x6')](e)){var event=events[e];OpenchannelAccount[_0x686d('0x7')](e,emitEvent(event));}}module[_0x686d('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x18c1=['OpenchannelAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x317244,_0xa536ba){var _0x18ae01=function(_0x246bbe){while(--_0x246bbe){_0x317244['push'](_0x317244['shift']());}};_0x18ae01(++_0xa536ba);}(_0x18c1,0x1d4));var _0x118c=function(_0x65225,_0x57d66e){_0x65225=_0x65225-0x0;var _0xf73473=_0x18c1[_0x65225];return _0xf73473;};'use strict';var EventEmitter=require(_0x118c('0x0'));var OpenchannelAccount=require(_0x118c('0x1'))['db'][_0x118c('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x118c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x118c('0x4'),'afterDestroy':_0x118c('0x5')};function emitEvent(_0xac0af3){return function(_0x5be748,_0x25115e,_0x5f07fe){OpenchannelAccountEvents[_0x118c('0x6')](_0xac0af3+':'+_0x5be748['id'],_0x5be748);OpenchannelAccountEvents[_0x118c('0x6')](_0xac0af3,_0x5be748);_0x5f07fe(null);};}for(var e in events){if(events[_0x118c('0x7')](e)){var event=events[e];OpenchannelAccount[_0x118c('0x8')](e,emitEvent(event));}}module[_0x118c('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 c1c68ef..a6f2c5c 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 _0x140f=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','openchannel_accounts'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x140f,0x145));var _0xf140=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x140f[_0x5416db];return _0x243e35;};'use strict';var _=require(_0xf140('0x0'));var util=require(_0xf140('0x1'));var logger=require('../../config/logger')(_0xf140('0x2'));var moment=require(_0xf140('0x3'));var BPromise=require('bluebird');var rp=require(_0xf140('0x4'));var fs=require('fs');var path=require(_0xf140('0x5'));var rimraf=require(_0xf140('0x6'));var config=require(_0xf140('0x7'));var attributes=require(_0xf140('0x8'));module[_0xf140('0x9')]=function(_0x5fe101,_0x3c14c4){return _0x5fe101[_0xf140('0xa')](_0xf140('0xb'),attributes,{'tableName':_0xf140('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e5d=['./openchannelAccount.attributes','exports','define','openchannel_accounts','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x244e44,_0x27d240){var _0x285bf7=function(_0x4dab12){while(--_0x4dab12){_0x244e44['push'](_0x244e44['shift']());}};_0x285bf7(++_0x27d240);}(_0x0e5d,0xeb));var _0xd0e5=function(_0x2d1f6f,_0x239dec){_0x2d1f6f=_0x2d1f6f-0x0;var _0x2b8c80=_0x0e5d[_0x2d1f6f];return _0x2b8c80;};'use strict';var _=require(_0xd0e5('0x0'));var util=require(_0xd0e5('0x1'));var logger=require(_0xd0e5('0x2'))('api');var moment=require(_0xd0e5('0x3'));var BPromise=require(_0xd0e5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd0e5('0x5'));var rimraf=require('rimraf');var config=require(_0xd0e5('0x6'));var attributes=require(_0xd0e5('0x7'));module[_0xd0e5('0x8')]=function(_0x4abfe3,_0x4802bc){return _0x4abfe3[_0xd0e5('0x9')]('OpenchannelAccount',attributes,{'tableName':_0xd0e5('0xa'),'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 e9951da..cebb329 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 _0xaafc=['register','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x90ff40,_0x285b53){var _0x2cc677=function(_0x5c1031){while(--_0x5c1031){_0x90ff40['push'](_0x90ff40['shift']());}};_0x2cc677(++_0x285b53);}(_0xaafc,0x186));var _0xcaaf=function(_0x116d6a,_0x164ce1){_0x116d6a=_0x116d6a-0x0;var _0x4b2ce9=_0xaafc[_0x116d6a];return _0x4b2ce9;};'use strict';var _=require(_0xcaaf('0x0'));var util=require(_0xcaaf('0x1'));var moment=require(_0xcaaf('0x2'));var BPromise=require(_0xcaaf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcaaf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcaaf('0x5'));var logger=require(_0xcaaf('0x6'))(_0xcaaf('0x7'));var config=require(_0xcaaf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcaaf('0x9')][_0xcaaf('0xa')]({'port':0x232a});config['redis']=_[_0xcaaf('0xb')](config[_0xcaaf('0xc')],{'host':_0xcaaf('0xd'),'port':0x18eb});var socket=require(_0xcaaf('0xe'))(new Redis(config[_0xcaaf('0xc')]));require('./openchannelAccount.socket')[_0xcaaf('0xf')](socket);function respondWithRpcPromise(_0x3a872e,_0x4f1c2c,_0x36e0db){return new BPromise(function(_0x2afe0f,_0x1b1178){return client[_0xcaaf('0x10')](_0x3a872e,_0x36e0db)['then'](function(_0x292c61){logger['info'](_0xcaaf('0x11'),_0x4f1c2c,_0xcaaf('0x12'));logger[_0xcaaf('0x13')](_0xcaaf('0x14'),_0x4f1c2c,_0xcaaf('0x12'),JSON['stringify'](_0x292c61));if(_0x292c61['error']){if(_0x292c61[_0xcaaf('0x15')][_0xcaaf('0x16')]===0x1f4){logger['error'](_0xcaaf('0x11'),_0x4f1c2c,_0x292c61[_0xcaaf('0x15')][_0xcaaf('0x17')]);return _0x1b1178(_0x292c61[_0xcaaf('0x15')][_0xcaaf('0x17')]);}logger[_0xcaaf('0x15')](_0xcaaf('0x11'),_0x4f1c2c,_0x292c61[_0xcaaf('0x15')][_0xcaaf('0x17')]);return _0x2afe0f(_0x292c61[_0xcaaf('0x15')]['message']);}else{logger[_0xcaaf('0x18')](_0xcaaf('0x11'),_0x4f1c2c,_0xcaaf('0x12'));_0x2afe0f(_0x292c61[_0xcaaf('0x19')]['message']);}})[_0xcaaf('0x1a')](function(_0x35b6db){logger[_0xcaaf('0x15')](_0xcaaf('0x11'),_0x4f1c2c,_0x35b6db);_0x1b1178(_0x35b6db);});});} \ No newline at end of file +var _0xef0b=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','./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','catch','util'];(function(_0x5cded1,_0x13b052){var _0x4443b5=function(_0x381128){while(--_0x381128){_0x5cded1['push'](_0x5cded1['shift']());}};_0x4443b5(++_0x13b052);}(_0xef0b,0x185));var _0xbef0=function(_0x36dae7,_0x5ad760){_0x36dae7=_0x36dae7-0x0;var _0x1607b0=_0xef0b[_0x36dae7];return _0x1607b0;};'use strict';var _=require('lodash');var util=require(_0xbef0('0x0'));var moment=require(_0xbef0('0x1'));var BPromise=require(_0xbef0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbef0('0x3'));var db=require(_0xbef0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbef0('0x5'))(_0xbef0('0x6'));var config=require(_0xbef0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbef0('0x8')][_0xbef0('0x9')]({'port':0x232a});config['redis']=_[_0xbef0('0xa')](config[_0xbef0('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbef0('0xb')]));require(_0xbef0('0xc'))[_0xbef0('0xd')](socket);function respondWithRpcPromise(_0x1a8613,_0x20e89a,_0x23af4f){return new BPromise(function(_0x5eac6b,_0x1eee8f){return client[_0xbef0('0xe')](_0x1a8613,_0x23af4f)[_0xbef0('0xf')](function(_0x55b92c){logger[_0xbef0('0x10')](_0xbef0('0x11'),_0x20e89a,_0xbef0('0x12'));logger[_0xbef0('0x13')](_0xbef0('0x14'),_0x20e89a,'request\x20sent',JSON[_0xbef0('0x15')](_0x55b92c));if(_0x55b92c[_0xbef0('0x16')]){if(_0x55b92c[_0xbef0('0x16')][_0xbef0('0x17')]===0x1f4){logger['error'](_0xbef0('0x11'),_0x20e89a,_0x55b92c[_0xbef0('0x16')][_0xbef0('0x18')]);return _0x1eee8f(_0x55b92c[_0xbef0('0x16')]['message']);}logger[_0xbef0('0x16')](_0xbef0('0x11'),_0x20e89a,_0x55b92c[_0xbef0('0x16')][_0xbef0('0x18')]);return _0x5eac6b(_0x55b92c[_0xbef0('0x16')][_0xbef0('0x18')]);}else{logger['info'](_0xbef0('0x11'),_0x20e89a,'request\x20sent');_0x5eac6b(_0x55b92c['result'][_0xbef0('0x18')]);}})[_0xbef0('0x19')](function(_0x57ecae){logger[_0xbef0('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x20e89a,_0x57ecae);_0x1eee8f(_0x57ecae);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 875e04b..124f33b 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 _0x3a6e=['save','remove','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3a6e,0x71));var _0xe3a6=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x3a6e[_0x46e363];return _0x3fb059;};'use strict';var OpenchannelAccountEvents=require(_0xe3a6('0x0'));var events=[_0xe3a6('0x1'),_0xe3a6('0x2'),'update'];function createListener(_0x1e33f5,_0x34bb76){return function(_0x51b228){_0x34bb76['emit'](_0x1e33f5,_0x51b228);};}function removeListener(_0x3bc90a,_0x4cf4e5){return function(){OpenchannelAccountEvents['removeListener'](_0x3bc90a,_0x4cf4e5);};}exports[_0xe3a6('0x3')]=function(_0x3d8656){for(var _0x2c44d6=0x0,_0xbdb341=events[_0xe3a6('0x4')];_0x2c44d6<_0xbdb341;_0x2c44d6++){var _0xbdb2da=events[_0x2c44d6];var _0x3d9922=createListener(_0xe3a6('0x5')+_0xbdb2da,_0x3d8656);OpenchannelAccountEvents['on'](_0xbdb2da,_0x3d9922);}}; \ No newline at end of file +var _0x5085=['register','length','openchannelAccount:','./openchannelAccount.events','update','emit'];(function(_0x2c9cf9,_0x2bed45){var _0x560d6d=function(_0x419979){while(--_0x419979){_0x2c9cf9['push'](_0x2c9cf9['shift']());}};_0x560d6d(++_0x2bed45);}(_0x5085,0x11d));var _0x5508=function(_0x4a76b8,_0x24bf01){_0x4a76b8=_0x4a76b8-0x0;var _0x3caf4c=_0x5085[_0x4a76b8];return _0x3caf4c;};'use strict';var OpenchannelAccountEvents=require(_0x5508('0x0'));var events=['save','remove',_0x5508('0x1')];function createListener(_0x1d3187,_0xf86ffa){return function(_0x2c302e){_0xf86ffa[_0x5508('0x2')](_0x1d3187,_0x2c302e);};}function removeListener(_0x2290b7,_0x45573b){return function(){OpenchannelAccountEvents['removeListener'](_0x2290b7,_0x45573b);};}exports[_0x5508('0x3')]=function(_0x5d3120){for(var _0x163753=0x0,_0x35737b=events[_0x5508('0x4')];_0x163753<_0x35737b;_0x163753++){var _0x1fa255=events[_0x163753];var _0x43116c=createListener(_0x5508('0x5')+_0x1fa255,_0x5d3120);OpenchannelAccountEvents['on'](_0x1fa255,_0x43116c);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 90d0993..8954527 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 _0x80e7=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete'];(function(_0x3d1566,_0x20b471){var _0x462871=function(_0x2c5f0b){while(--_0x2c5f0b){_0x3d1566['push'](_0x3d1566['shift']());}};_0x462871(++_0x20b471);}(_0x80e7,0x17e));var _0x780e=function(_0x404dab,_0x485987){_0x404dab=_0x404dab-0x0;var _0x2ae84d=_0x80e7[_0x404dab];return _0x2ae84d;};'use strict';var multer=require(_0x780e('0x0'));var util=require(_0x780e('0x1'));var path=require('path');var timeout=require(_0x780e('0x2'));var express=require(_0x780e('0x3'));var router=express[_0x780e('0x4')]();var auth=require(_0x780e('0x5'));var interaction=require(_0x780e('0x6'));var config=require(_0x780e('0x7'));var controller=require(_0x780e('0x8'));router[_0x780e('0x9')]('/',auth[_0x780e('0xa')](),controller['index']);router[_0x780e('0x9')](_0x780e('0xb'),auth[_0x780e('0xa')](),controller[_0x780e('0xc')]);router[_0x780e('0xd')]('/',auth[_0x780e('0xa')](),controller[_0x780e('0xe')]);router[_0x780e('0xf')](_0x780e('0xb'),auth[_0x780e('0xa')](),controller[_0x780e('0x10')]);router[_0x780e('0x11')](_0x780e('0xb'),auth[_0x780e('0xa')](),controller[_0x780e('0x12')]);module[_0x780e('0x13')]=router; \ No newline at end of file +var _0x868c=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./openchannelApplication.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x868c,0x16e));var _0xc868=function(_0xd93b26,_0x12bbf2){_0xd93b26=_0xd93b26-0x0;var _0x25f668=_0x868c[_0xd93b26];return _0x25f668;};'use strict';var multer=require(_0xc868('0x0'));var util=require(_0xc868('0x1'));var path=require(_0xc868('0x2'));var timeout=require(_0xc868('0x3'));var express=require(_0xc868('0x4'));var router=express[_0xc868('0x5')]();var auth=require(_0xc868('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc868('0x7'));router[_0xc868('0x8')]('/',auth['isAuthenticated'](),controller[_0xc868('0x9')]);router['get'](_0xc868('0xa'),auth[_0xc868('0xb')](),controller[_0xc868('0xc')]);router[_0xc868('0xd')]('/',auth[_0xc868('0xb')](),controller[_0xc868('0xe')]);router[_0xc868('0xf')](_0xc868('0xa'),auth[_0xc868('0xb')](),controller[_0xc868('0x10')]);router[_0xc868('0x11')](_0xc868('0xa'),auth[_0xc868('0xb')](),controller[_0xc868('0x12')]);module[_0xc868('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 9939b6c..86b78d7 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 _0x8c34=['STRING','INTEGER','noop','TEXT'];(function(_0x135fb4,_0x50e172){var _0x1b7f11=function(_0x3d10e0){while(--_0x3d10e0){_0x135fb4['push'](_0x135fb4['shift']());}};_0x1b7f11(++_0x50e172);}(_0x8c34,0x1e1));var _0x48c3=function(_0x522953,_0x255c93){_0x522953=_0x522953-0x0;var _0x592b34=_0x8c34[_0x522953];return _0x592b34;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x48c3('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x48c3('0x1')},'appdata':{'type':Sequelize[_0x48c3('0x2')]()},'description':{'type':Sequelize[_0x48c3('0x3')]},'interval':{'type':Sequelize[_0x48c3('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xf5b9=['noop','TEXT','STRING','sequelize','exports','INTEGER'];(function(_0x389fb1,_0x431673){var _0x3d3520=function(_0x2dcab7){while(--_0x2dcab7){_0x389fb1['push'](_0x389fb1['shift']());}};_0x3d3520(++_0x431673);}(_0xf5b9,0x11d));var _0x9f5b=function(_0x3cc6d0,_0x55168e){_0x3cc6d0=_0x3cc6d0-0x0;var _0x2276a0=_0xf5b9[_0x3cc6d0];return _0x2276a0;};'use strict';var Sequelize=require(_0x9f5b('0x0'));module[_0x9f5b('0x1')]={'priority':{'type':Sequelize[_0x9f5b('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9f5b('0x3')},'appdata':{'type':Sequelize[_0x9f5b('0x4')]()},'description':{'type':Sequelize[_0x9f5b('0x5')]},'interval':{'type':Sequelize[_0x9f5b('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 99304a7..6cef87e 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 _0x2c21=['reject','update','then','destroy','error','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','create','body','find','params','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set'];(function(_0x4fa701,_0xe6c06f){var _0x407cc0=function(_0x28b3a8){while(--_0x28b3a8){_0x4fa701['push'](_0x4fa701['shift']());}};_0x407cc0(++_0xe6c06f);}(_0x2c21,0x13b));var _0x12c2=function(_0x1e24b1,_0x14ab30){_0x1e24b1=_0x1e24b1-0x0;var _0x212baf=_0x2c21[_0x1e24b1];return _0x212baf;};'use strict';var pdf=require(_0x12c2('0x0'));var emlformat=require(_0x12c2('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x12c2('0x2'));var rp=require(_0x12c2('0x3'));var moment=require(_0x12c2('0x4'));var BPromise=require(_0x12c2('0x5'));var Mustache=require(_0x12c2('0x6'));var util=require('util');var path=require(_0x12c2('0x7'));var sox=require(_0x12c2('0x8'));var csv=require(_0x12c2('0x9'));var ejs=require(_0x12c2('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x12c2('0xb'));var crypto=require(_0x12c2('0xc'));var jsforce=require(_0x12c2('0xd'));var deskjs=require(_0x12c2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x12c2('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x12c2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x12c2('0x11'));var hardwareService=require(_0x12c2('0x12'));var logger=require(_0x12c2('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x12c2('0x14'));var db=require(_0x12c2('0x15'))['db'];function respondWithStatusCode(_0x5a9766,_0x35b2ac){_0x35b2ac=_0x35b2ac||0xcc;return function(_0x26dd60){if(_0x26dd60){return _0x5a9766[_0x12c2('0x16')](_0x35b2ac);}return _0x5a9766['status'](_0x35b2ac)[_0x12c2('0x17')]();};}function respondWithResult(_0x4b9470,_0x8e7469){_0x8e7469=_0x8e7469||0xc8;return function(_0x53ac38){if(_0x53ac38){return _0x4b9470[_0x12c2('0x18')](_0x8e7469)[_0x12c2('0x19')](_0x53ac38);}};}function respondWithFilteredResult(_0x4e02ca,_0x25e135){return function(_0x4d8dbf){if(_0x4d8dbf){var _0x3eccf7=_0x4d8dbf[_0x12c2('0x1a')],_0x2ab73c=_0x25e135[_0x12c2('0x1b')],_0x536902=_0x25e135[_0x12c2('0x1b')]+_0x25e135[_0x12c2('0x1c')],_0xe1505c;if(_0x536902>=_0x3eccf7){_0x536902=_0x3eccf7;_0xe1505c=0xc8;}else{_0xe1505c=0xce;}_0x4e02ca[_0x12c2('0x18')](_0xe1505c);return _0x4e02ca[_0x12c2('0x1d')]('Content-Range',_0x2ab73c+'-'+_0x536902+'/'+_0x3eccf7)[_0x12c2('0x19')](_0x4d8dbf);}return null;};}function patchUpdates(_0xdc6579){return function(_0x243d33){try{jsonpatch['apply'](_0x243d33,_0xdc6579,!![]);}catch(_0x376535){return BPromise[_0x12c2('0x1e')](_0x376535);}return _0x243d33['save']();};}function saveUpdates(_0x372d7a,_0x4610c8){return function(_0x100cc3){if(_0x100cc3){return _0x100cc3[_0x12c2('0x1f')](_0x372d7a)[_0x12c2('0x20')](function(_0x41fed6){return _0x41fed6;});}return null;};}function removeEntity(_0x3fcb40,_0xbba2be){return function(_0x5eb412){if(_0x5eb412){return _0x5eb412[_0x12c2('0x21')]()[_0x12c2('0x20')](function(){_0x3fcb40[_0x12c2('0x18')](0xcc)[_0x12c2('0x17')]();});}};}function handleEntityNotFound(_0x490967,_0x4d3c77){return function(_0x124713){if(!_0x124713){_0x490967[_0x12c2('0x16')](0x194);}return _0x124713;};}function handleError(_0x164159,_0x54ffce){_0x54ffce=_0x54ffce||0x1f4;return function(_0x227111){logger[_0x12c2('0x22')](_0x227111['stack']);if(_0x227111['name']){delete _0x227111[_0x12c2('0x23')];}_0x164159['status'](_0x54ffce)[_0x12c2('0x24')](_0x227111);};}exports[_0x12c2('0x25')]=function(_0x3f5e54,_0x2b6bb3){var _0x47c6c0={},_0x53ea8e={},_0x1ae2ad={'count':0x0,'rows':[]};var _0x19c3c5=_[_0x12c2('0x26')](db[_0x12c2('0x27')][_0x12c2('0x28')],function(_0x2969ca){return{'name':_0x2969ca[_0x12c2('0x29')],'type':_0x2969ca[_0x12c2('0x2a')][_0x12c2('0x2b')]};});_0x53ea8e[_0x12c2('0x2c')]=_[_0x12c2('0x26')](_0x19c3c5,_0x12c2('0x23'));_0x53ea8e[_0x12c2('0x2d')]=_[_0x12c2('0x2e')](_0x3f5e54[_0x12c2('0x2d')]);_0x53ea8e[_0x12c2('0x2f')]=_['intersection'](_0x53ea8e[_0x12c2('0x2c')],_0x53ea8e[_0x12c2('0x2d')]);_0x47c6c0[_0x12c2('0x30')]=_[_0x12c2('0x31')](_0x53ea8e['model'],qs['fields'](_0x3f5e54[_0x12c2('0x2d')][_0x12c2('0x32')]));_0x47c6c0[_0x12c2('0x30')]=_0x47c6c0['attributes'][_0x12c2('0x33')]?_0x47c6c0[_0x12c2('0x30')]:_0x53ea8e[_0x12c2('0x2c')];if(!_0x3f5e54[_0x12c2('0x2d')][_0x12c2('0x34')](_0x12c2('0x35'))){_0x47c6c0['limit']=qs[_0x12c2('0x1c')](_0x3f5e54['query'][_0x12c2('0x1c')]);_0x47c6c0['offset']=qs[_0x12c2('0x1b')](_0x3f5e54[_0x12c2('0x2d')]['offset']);}_0x47c6c0[_0x12c2('0x36')]=qs[_0x12c2('0x37')](_0x3f5e54[_0x12c2('0x2d')][_0x12c2('0x37')]);_0x47c6c0['where']=qs[_0x12c2('0x2f')](_['pick'](_0x3f5e54[_0x12c2('0x2d')],_0x53ea8e[_0x12c2('0x2f')]));if(_0x3f5e54[_0x12c2('0x2d')][_0x12c2('0x38')]){_0x47c6c0['where']=_[_0x12c2('0x39')](_0x47c6c0[_0x12c2('0x3a')],{'$or':_[_0x12c2('0x26')](_0x19c3c5,function(_0x303a8e){if(_0x303a8e[_0x12c2('0x2a')]!==_0x12c2('0x3b')){var _0x271487={};_0x271487[_0x303a8e[_0x12c2('0x23')]]={'$like':'%'+_0x3f5e54['query'][_0x12c2('0x38')]+'%'};return _0x271487;}})});}_0x47c6c0=_['merge']({},_0x47c6c0,_0x3f5e54[_0x12c2('0x3c')]);var _0x41023d={'where':_0x47c6c0['where']};return db[_0x12c2('0x27')][_0x12c2('0x1a')](_0x41023d)['then'](function(_0x2f591d){_0x1ae2ad[_0x12c2('0x1a')]=_0x2f591d;if(_0x3f5e54[_0x12c2('0x2d')]['includeAll']){_0x47c6c0[_0x12c2('0x3d')]=[{'all':!![]}];}return db[_0x12c2('0x27')][_0x12c2('0x3e')](_0x47c6c0);})[_0x12c2('0x20')](function(_0x5dbd4d){_0x1ae2ad[_0x12c2('0x3f')]=_0x5dbd4d;return _0x1ae2ad;})['then'](respondWithFilteredResult(_0x2b6bb3,_0x47c6c0))[_0x12c2('0x40')](handleError(_0x2b6bb3,null));};exports['show']=function(_0x1d26d4,_0x3659dd){var _0x175d31={'raw':!![],'where':{'id':_0x1d26d4['params']['id']}},_0x4ed495={};_0x4ed495[_0x12c2('0x2c')]=_[_0x12c2('0x2e')](db[_0x12c2('0x27')][_0x12c2('0x28')]);_0x4ed495[_0x12c2('0x2d')]=_['keys'](_0x1d26d4[_0x12c2('0x2d')]);_0x4ed495[_0x12c2('0x2f')]=_[_0x12c2('0x31')](_0x4ed495[_0x12c2('0x2c')],_0x4ed495[_0x12c2('0x2d')]);_0x175d31['attributes']=_[_0x12c2('0x31')](_0x4ed495[_0x12c2('0x2c')],qs['fields'](_0x1d26d4[_0x12c2('0x2d')]['fields']));_0x175d31[_0x12c2('0x30')]=_0x175d31['attributes'][_0x12c2('0x33')]?_0x175d31[_0x12c2('0x30')]:_0x4ed495[_0x12c2('0x2c')];if(_0x1d26d4['query']['includeAll']){_0x175d31['include']=[{'all':!![]}];}_0x175d31=_[_0x12c2('0x39')]({},_0x175d31,_0x1d26d4[_0x12c2('0x3c')]);return db[_0x12c2('0x27')]['find'](_0x175d31)[_0x12c2('0x20')](handleEntityNotFound(_0x3659dd,null))[_0x12c2('0x20')](respondWithResult(_0x3659dd,null))[_0x12c2('0x40')](handleError(_0x3659dd,null));};exports[_0x12c2('0x41')]=function(_0x4218ce,_0x564ef9){return db[_0x12c2('0x27')][_0x12c2('0x41')](_0x4218ce[_0x12c2('0x42')],{})[_0x12c2('0x20')](respondWithResult(_0x564ef9,0xc9))[_0x12c2('0x40')](handleError(_0x564ef9,null));};exports[_0x12c2('0x1f')]=function(_0x3a0552,_0x372875){if(_0x3a0552[_0x12c2('0x42')]['id']){delete _0x3a0552[_0x12c2('0x42')]['id'];}return db[_0x12c2('0x27')][_0x12c2('0x43')]({'where':{'id':_0x3a0552[_0x12c2('0x44')]['id']}})[_0x12c2('0x20')](handleEntityNotFound(_0x372875,null))[_0x12c2('0x20')](saveUpdates(_0x3a0552[_0x12c2('0x42')],null))[_0x12c2('0x20')](respondWithResult(_0x372875,null))['catch'](handleError(_0x372875,null));};exports['destroy']=function(_0x291dc0,_0x26c412){return db[_0x12c2('0x27')]['find']({'where':{'id':_0x291dc0[_0x12c2('0x44')]['id']}})[_0x12c2('0x20')](handleEntityNotFound(_0x26c412,null))[_0x12c2('0x20')](removeEntity(_0x26c412,null))[_0x12c2('0x40')](handleError(_0x26c412,null));}; \ No newline at end of file +var _0x1045=['send','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','options','find','create','update','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1045,0x6e));var _0x5104=function(_0x1dc130,_0x1f8090){_0x1dc130=_0x1dc130-0x0;var _0x48e316=_0x1045[_0x1dc130];return _0x48e316;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5104('0x0'));var zipdir=require(_0x5104('0x1'));var jsonpatch=require(_0x5104('0x2'));var rp=require(_0x5104('0x3'));var moment=require(_0x5104('0x4'));var BPromise=require(_0x5104('0x5'));var Mustache=require(_0x5104('0x6'));var util=require('util');var path=require(_0x5104('0x7'));var sox=require(_0x5104('0x8'));var csv=require(_0x5104('0x9'));var ejs=require(_0x5104('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5104('0xb'));var crypto=require(_0x5104('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5104('0xd'));var toCsv=require(_0x5104('0x9'));var querystring=require(_0x5104('0xe'));var Papa=require('papaparse');var Redis=require(_0x5104('0xf'));var authService=require(_0x5104('0x10'));var qs=require(_0x5104('0x11'));var as=require(_0x5104('0x12'));var hardwareService=require(_0x5104('0x13'));var logger=require('../../config/logger')(_0x5104('0x14'));var utils=require(_0x5104('0x15'));var config=require(_0x5104('0x16'));var db=require(_0x5104('0x17'))['db'];function respondWithStatusCode(_0x3e4a85,_0x4c9706){_0x4c9706=_0x4c9706||0xcc;return function(_0x2fe48e){if(_0x2fe48e){return _0x3e4a85[_0x5104('0x18')](_0x4c9706);}return _0x3e4a85[_0x5104('0x19')](_0x4c9706)[_0x5104('0x1a')]();};}function respondWithResult(_0x4493da,_0x4a4425){_0x4a4425=_0x4a4425||0xc8;return function(_0xbfd199){if(_0xbfd199){return _0x4493da[_0x5104('0x19')](_0x4a4425)[_0x5104('0x1b')](_0xbfd199);}};}function respondWithFilteredResult(_0x4fab7e,_0x4ac31b){return function(_0x21d319){if(_0x21d319){var _0x738847=_0x21d319['count'],_0x2c58d8=_0x4ac31b[_0x5104('0x1c')],_0x58cf56=_0x4ac31b[_0x5104('0x1c')]+_0x4ac31b[_0x5104('0x1d')],_0x584b12;if(_0x58cf56>=_0x738847){_0x58cf56=_0x738847;_0x584b12=0xc8;}else{_0x584b12=0xce;}_0x4fab7e[_0x5104('0x19')](_0x584b12);return _0x4fab7e[_0x5104('0x1e')](_0x5104('0x1f'),_0x2c58d8+'-'+_0x58cf56+'/'+_0x738847)[_0x5104('0x1b')](_0x21d319);}return null;};}function patchUpdates(_0x3c8099){return function(_0x15dd07){try{jsonpatch[_0x5104('0x20')](_0x15dd07,_0x3c8099,!![]);}catch(_0x50122e){return BPromise[_0x5104('0x21')](_0x50122e);}return _0x15dd07[_0x5104('0x22')]();};}function saveUpdates(_0x33bc97,_0x3d2a34){return function(_0x255036){if(_0x255036){return _0x255036['update'](_0x33bc97)[_0x5104('0x23')](function(_0x1d9843){return _0x1d9843;});}return null;};}function removeEntity(_0x4464b2,_0x25f750){return function(_0x24065d){if(_0x24065d){return _0x24065d[_0x5104('0x24')]()[_0x5104('0x23')](function(){_0x4464b2[_0x5104('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f19f4,_0x4ba983){return function(_0x890535){if(!_0x890535){_0x2f19f4[_0x5104('0x18')](0x194);}return _0x890535;};}function handleError(_0xab0985,_0x415a9e){_0x415a9e=_0x415a9e||0x1f4;return function(_0x1d8aac){logger[_0x5104('0x25')](_0x1d8aac[_0x5104('0x26')]);if(_0x1d8aac[_0x5104('0x27')]){delete _0x1d8aac['name'];}_0xab0985[_0x5104('0x19')](_0x415a9e)[_0x5104('0x28')](_0x1d8aac);};}exports['index']=function(_0x59beb7,_0x2453cd){var _0xa1f8a7={},_0x23d435={},_0x5935f2={'count':0x0,'rows':[]};var _0x4d6cd9=_[_0x5104('0x29')](db[_0x5104('0x2a')][_0x5104('0x2b')],function(_0x397895){return{'name':_0x397895[_0x5104('0x2c')],'type':_0x397895[_0x5104('0x2d')][_0x5104('0x2e')]};});_0x23d435[_0x5104('0x2f')]=_['map'](_0x4d6cd9,'name');_0x23d435[_0x5104('0x30')]=_[_0x5104('0x31')](_0x59beb7[_0x5104('0x30')]);_0x23d435[_0x5104('0x32')]=_['intersection'](_0x23d435[_0x5104('0x2f')],_0x23d435[_0x5104('0x30')]);_0xa1f8a7[_0x5104('0x33')]=_[_0x5104('0x34')](_0x23d435[_0x5104('0x2f')],qs['fields'](_0x59beb7['query'][_0x5104('0x35')]));_0xa1f8a7['attributes']=_0xa1f8a7[_0x5104('0x33')][_0x5104('0x36')]?_0xa1f8a7['attributes']:_0x23d435['model'];if(!_0x59beb7[_0x5104('0x30')][_0x5104('0x37')](_0x5104('0x38'))){_0xa1f8a7['limit']=qs[_0x5104('0x1d')](_0x59beb7[_0x5104('0x30')][_0x5104('0x1d')]);_0xa1f8a7[_0x5104('0x1c')]=qs['offset'](_0x59beb7['query']['offset']);}_0xa1f8a7[_0x5104('0x39')]=qs[_0x5104('0x3a')](_0x59beb7['query']['sort']);_0xa1f8a7[_0x5104('0x3b')]=qs[_0x5104('0x32')](_['pick'](_0x59beb7['query'],_0x23d435[_0x5104('0x32')]));if(_0x59beb7[_0x5104('0x30')][_0x5104('0x3c')]){_0xa1f8a7[_0x5104('0x3b')]=_[_0x5104('0x3d')](_0xa1f8a7[_0x5104('0x3b')],{'$or':_[_0x5104('0x29')](_0x4d6cd9,function(_0x5345bd){if(_0x5345bd['type']!==_0x5104('0x3e')){var _0x4429a7={};_0x4429a7[_0x5345bd[_0x5104('0x27')]]={'$like':'%'+_0x59beb7[_0x5104('0x30')][_0x5104('0x3c')]+'%'};return _0x4429a7;}})});}_0xa1f8a7=_[_0x5104('0x3d')]({},_0xa1f8a7,_0x59beb7['options']);var _0x1339ba={'where':_0xa1f8a7[_0x5104('0x3b')]};return db[_0x5104('0x2a')][_0x5104('0x3f')](_0x1339ba)[_0x5104('0x23')](function(_0x44cff8){_0x5935f2[_0x5104('0x3f')]=_0x44cff8;if(_0x59beb7[_0x5104('0x30')][_0x5104('0x40')]){_0xa1f8a7[_0x5104('0x41')]=[{'all':!![]}];}return db[_0x5104('0x2a')][_0x5104('0x42')](_0xa1f8a7);})[_0x5104('0x23')](function(_0x12bdae){_0x5935f2[_0x5104('0x43')]=_0x12bdae;return _0x5935f2;})['then'](respondWithFilteredResult(_0x2453cd,_0xa1f8a7))[_0x5104('0x44')](handleError(_0x2453cd,null));};exports['show']=function(_0x5be389,_0x4f8d45){var _0x2c94dd={'raw':!![],'where':{'id':_0x5be389[_0x5104('0x45')]['id']}},_0xe7a9f7={};_0xe7a9f7[_0x5104('0x2f')]=_[_0x5104('0x31')](db['OpenchannelApplication'][_0x5104('0x2b')]);_0xe7a9f7['query']=_[_0x5104('0x31')](_0x5be389[_0x5104('0x30')]);_0xe7a9f7[_0x5104('0x32')]=_[_0x5104('0x34')](_0xe7a9f7['model'],_0xe7a9f7['query']);_0x2c94dd[_0x5104('0x33')]=_[_0x5104('0x34')](_0xe7a9f7[_0x5104('0x2f')],qs[_0x5104('0x35')](_0x5be389[_0x5104('0x30')]['fields']));_0x2c94dd[_0x5104('0x33')]=_0x2c94dd[_0x5104('0x33')][_0x5104('0x36')]?_0x2c94dd[_0x5104('0x33')]:_0xe7a9f7[_0x5104('0x2f')];if(_0x5be389[_0x5104('0x30')][_0x5104('0x40')]){_0x2c94dd[_0x5104('0x41')]=[{'all':!![]}];}_0x2c94dd=_[_0x5104('0x3d')]({},_0x2c94dd,_0x5be389[_0x5104('0x46')]);return db['OpenchannelApplication'][_0x5104('0x47')](_0x2c94dd)[_0x5104('0x23')](handleEntityNotFound(_0x4f8d45,null))[_0x5104('0x23')](respondWithResult(_0x4f8d45,null))[_0x5104('0x44')](handleError(_0x4f8d45,null));};exports['create']=function(_0x4d647f,_0x28ae91){return db[_0x5104('0x2a')][_0x5104('0x48')](_0x4d647f['body'],{})[_0x5104('0x23')](respondWithResult(_0x28ae91,0xc9))[_0x5104('0x44')](handleError(_0x28ae91,null));};exports[_0x5104('0x49')]=function(_0x23a7e3,_0x30d833){if(_0x23a7e3[_0x5104('0x4a')]['id']){delete _0x23a7e3[_0x5104('0x4a')]['id'];}return db[_0x5104('0x2a')]['find']({'where':{'id':_0x23a7e3[_0x5104('0x45')]['id']}})['then'](handleEntityNotFound(_0x30d833,null))[_0x5104('0x23')](saveUpdates(_0x23a7e3[_0x5104('0x4a')],null))['then'](respondWithResult(_0x30d833,null))['catch'](handleError(_0x30d833,null));};exports[_0x5104('0x24')]=function(_0x352add,_0x84988c){return db[_0x5104('0x2a')][_0x5104('0x47')]({'where':{'id':_0x352add[_0x5104('0x45')]['id']}})[_0x5104('0x23')](handleEntityNotFound(_0x84988c,null))[_0x5104('0x23')](removeEntity(_0x84988c,null))[_0x5104('0x44')](handleError(_0x84988c,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index d64aa0e..3901833 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 _0x2e42=['OpenchannelApplication','openchannel_applications','utf8mb4','util','../../config/logger','moment','path','rimraf','define'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x2e42,0x12c));var _0x22e4=function(_0x409fb8,_0x5ab3d3){_0x409fb8=_0x409fb8-0x0;var _0x278270=_0x2e42[_0x409fb8];return _0x278270;};'use strict';var _=require('lodash');var util=require(_0x22e4('0x0'));var logger=require(_0x22e4('0x1'))('api');var moment=require(_0x22e4('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x22e4('0x3'));var rimraf=require(_0x22e4('0x4'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0x487844,_0x4b203d){return _0x487844[_0x22e4('0x5')](_0x22e4('0x6'),attributes,{'tableName':_0x22e4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x22e4('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbaa3=['api','bluebird','request-promise','path','rimraf','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbaa3,0x97));var _0x3baa=function(_0x3bb45b,_0x2dcc0b){_0x3bb45b=_0x3bb45b-0x0;var _0x513162=_0xbaa3[_0x3bb45b];return _0x513162;};'use strict';var _=require(_0x3baa('0x0'));var util=require(_0x3baa('0x1'));var logger=require(_0x3baa('0x2'))(_0x3baa('0x3'));var moment=require('moment');var BPromise=require(_0x3baa('0x4'));var rp=require(_0x3baa('0x5'));var fs=require('fs');var path=require(_0x3baa('0x6'));var rimraf=require(_0x3baa('0x7'));var config=require('../../config/environment');var attributes=require(_0x3baa('0x8'));module[_0x3baa('0x9')]=function(_0x14d412,_0x23fe30){return _0x14d412[_0x3baa('0xa')](_0x3baa('0xb'),attributes,{'tableName':_0x3baa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3baa('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 6fb5634..1d926f8 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 _0xd8b0=['OpenchannelApplication','body','options','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication'];(function(_0xb99421,_0xaab133){var _0x4b3ec7=function(_0x591d1a){while(--_0x591d1a){_0xb99421['push'](_0xb99421['shift']());}};_0x4b3ec7(++_0xaab133);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var 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);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['update'](_0x5fecbd[_0x0d8b('0x18')],{'raw':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1b')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['attributes']||null:null,'limit':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['limit']||null:null})['then'](function(_0x238728){logger[_0x0d8b('0xb')](_0x0d8b('0x16'),_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON[_0x0d8b('0x10')](_0x238728));_0x18dd2d(_0x238728);})[_0x0d8b('0x15')](function(_0x4562cb){logger[_0x0d8b('0x11')]('UpdateOpenchannelApplication',_0x4562cb[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x4562cb['message']));});});}; \ No newline at end of file +var _0x5f2f=['error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','stringify'];(function(_0x2f39cf,_0x3c59ec){var _0xd0ece8=function(_0x4ffc0f){while(--_0x4ffc0f){_0x2f39cf['push'](_0x2f39cf['shift']());}};_0xd0ece8(++_0x3c59ec);}(_0x5f2f,0x73));var _0xf5f2=function(_0x371548,_0x12f39f){_0x371548=_0x371548-0x0;var _0x418d35=_0x5f2f[_0x371548];return _0x418d35;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index c613e7f..bacd480 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 _0xb009=['show','getMessages','/:id/download','download','post','create','/:id/messages','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','openchannelinteraction:destroy','delete','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x37e3e1,_0x46b0fe){var _0x1fe6cc=function(_0xef06f0){while(--_0xef06f0){_0x37e3e1['push'](_0x37e3e1['shift']());}};_0x1fe6cc(++_0x46b0fe);}(_0xb009,0x14f));var _0x9b00=function(_0x3655bd,_0x5da5f1){_0x3655bd=_0x3655bd-0x0;var _0x3a69e4=_0xb009[_0x3655bd];return _0x3a69e4;};'use strict';var multer=require('multer');var util=require(_0x9b00('0x0'));var path=require(_0x9b00('0x1'));var timeout=require(_0x9b00('0x2'));var express=require(_0x9b00('0x3'));var router=express[_0x9b00('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9b00('0x5'));var config=require(_0x9b00('0x6'));var controller=require(_0x9b00('0x7'));router[_0x9b00('0x8')]('/',auth[_0x9b00('0x9')](),controller['index']);router[_0x9b00('0x8')](_0x9b00('0xa'),auth[_0x9b00('0x9')](),controller[_0x9b00('0xb')]);router[_0x9b00('0x8')](_0x9b00('0xc'),auth['isAuthenticated'](),controller[_0x9b00('0xd')]);router['get']('/:id/messages',auth[_0x9b00('0x9')](),controller[_0x9b00('0xe')]);router[_0x9b00('0x8')](_0x9b00('0xf'),auth[_0x9b00('0x9')](),controller[_0x9b00('0x10')]);router[_0x9b00('0x11')]('/',auth[_0x9b00('0x9')](),controller[_0x9b00('0x12')]);router[_0x9b00('0x11')](_0x9b00('0x13'),auth['isAuthenticated'](),controller['addMessage']);router[_0x9b00('0x11')](_0x9b00('0x14'),auth[_0x9b00('0x9')](),interaction[_0x9b00('0x15')](_0x9b00('0x16'),_0x9b00('0x17')),controller[_0x9b00('0x18')]);router[_0x9b00('0x19')](_0x9b00('0xc'),auth[_0x9b00('0x9')](),interaction[_0x9b00('0x15')](_0x9b00('0x16'),_0x9b00('0x1a')),controller['update']);router['delete'](_0x9b00('0xc'),auth[_0x9b00('0x9')](),interaction[_0x9b00('0x15')](_0x9b00('0x16'),_0x9b00('0x1b')),controller['destroy']);router[_0x9b00('0x1c')](_0x9b00('0x14'),auth[_0x9b00('0x9')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xc434=['download','post','create','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','openchannelinteraction:destroy','delete','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download'];(function(_0x51803a,_0x2e1a84){var _0x42e77e=function(_0x17c2ac){while(--_0x17c2ac){_0x51803a['push'](_0x51803a['shift']());}};_0x42e77e(++_0x2e1a84);}(_0xc434,0xa3));var _0x4c43=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xc434[_0x2c7618];return _0x5ce3f0;};'use strict';var multer=require(_0x4c43('0x0'));var util=require(_0x4c43('0x1'));var path=require(_0x4c43('0x2'));var timeout=require(_0x4c43('0x3'));var express=require('express');var router=express[_0x4c43('0x4')]();var auth=require(_0x4c43('0x5'));var interaction=require(_0x4c43('0x6'));var config=require('../../config/environment');var controller=require(_0x4c43('0x7'));router[_0x4c43('0x8')]('/',auth[_0x4c43('0x9')](),controller[_0x4c43('0xa')]);router[_0x4c43('0x8')](_0x4c43('0xb'),auth['isAuthenticated'](),controller[_0x4c43('0xc')]);router[_0x4c43('0x8')](_0x4c43('0xd'),auth[_0x4c43('0x9')](),controller[_0x4c43('0xe')]);router[_0x4c43('0x8')](_0x4c43('0xf'),auth[_0x4c43('0x9')](),controller['getMessages']);router[_0x4c43('0x8')](_0x4c43('0x10'),auth[_0x4c43('0x9')](),controller[_0x4c43('0x11')]);router[_0x4c43('0x12')]('/',auth[_0x4c43('0x9')](),controller[_0x4c43('0x13')]);router[_0x4c43('0x12')](_0x4c43('0xf'),auth[_0x4c43('0x9')](),controller['addMessage']);router['post'](_0x4c43('0x14'),auth[_0x4c43('0x9')](),interaction[_0x4c43('0x15')](_0x4c43('0x16'),_0x4c43('0x17')),controller[_0x4c43('0x18')]);router['put'](_0x4c43('0xd'),auth[_0x4c43('0x9')](),interaction[_0x4c43('0x15')]('openchannel',_0x4c43('0x19')),controller['update']);router['delete'](_0x4c43('0xd'),auth[_0x4c43('0x9')](),interaction[_0x4c43('0x15')](_0x4c43('0x16'),_0x4c43('0x1a')),controller['destroy']);router[_0x4c43('0x1b')]('/:id/tags',auth[_0x4c43('0x9')](),controller[_0x4c43('0x1c')]);module[_0x4c43('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index b0fd98a..d18982a 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 _0x35a3=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x35a3,0x1e4));var _0x335a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x35a3[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x335a('0x0'));module[_0x335a('0x1')]={'closed':{'type':Sequelize[_0x335a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x335a('0x3')]},'disposition':{'type':Sequelize[_0x335a('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x335a('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x335a('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x335a('0x5')]('in',_0x335a('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x335a('0x4')]}}; \ No newline at end of file +var _0x09a4=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x9ce749,_0x38b8cf){var _0x3d2c62=function(_0x58d630){while(--_0x58d630){_0x9ce749['push'](_0x9ce749['shift']());}};_0x3d2c62(++_0x38b8cf);}(_0x09a4,0x118));var _0x409a=function(_0x1dc815,_0x469579){_0x1dc815=_0x1dc815-0x0;var _0x4f29e4=_0x09a4[_0x1dc815];return _0x4f29e4;};'use strict';var Sequelize=require(_0x409a('0x0'));module[_0x409a('0x1')]={'closed':{'type':Sequelize[_0x409a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x409a('0x3')]},'disposition':{'type':Sequelize[_0x409a('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x409a('0x3')]},'threadId':{'type':Sequelize[_0x409a('0x4')]},'externalUrl':{'type':Sequelize[_0x409a('0x4')]},'lastMsgAt':{'type':Sequelize[_0x409a('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x409a('0x5')]('in',_0x409a('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index f1205e0..9c92d83 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 _0x3a51=['socket.io-emitter','register','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','Users','map','fullname','TagIds','Tags','forEach','catch','index','OpenchannelInteraction','rawAttributes','key','model','name','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','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?','ContactId','buildExpression','type','text','start','end','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','concat','createdAt','parse','$lte','\x20=\x20?','read','`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?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','count','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','OpenchannelInteractionId','push','all','show','params','fields','include','options','create','body','describe','addMessage','OpenchannelMessage','omit','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','addTags','setTags','ids','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','lastName','Attachment','direction','secret','OpenchannelAccount','Account','Owner','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','Openchannel','YYYY-MM-DD','N.A.','closed','threadId','Private','Messages','basename','createReadStream','pipe','createWriteStream','out','firstName','views','downloadInteraction.html','toFile','transcript-','err','unlinkSync','sendStatus','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','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','defaults','redis','localhost'];(function(_0x1d6eb3,_0x5b5aaf){var _0x1225f3=function(_0x4c654c){while(--_0x4c654c){_0x1d6eb3['push'](_0x1d6eb3['shift']());}};_0x1225f3(++_0x5b5aaf);}(_0x3a51,0xd5));var _0x13a5=function(_0x5eabe8,_0x84d3c5){_0x5eabe8=_0x5eabe8-0x0;var _0x141775=_0x3a51[_0x5eabe8];return _0x141775;};'use strict';var pdf=require(_0x13a5('0x0'));var emlformat=require(_0x13a5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x13a5('0x2'));var rp=require(_0x13a5('0x3'));var moment=require(_0x13a5('0x4'));var BPromise=require(_0x13a5('0x5'));var Mustache=require(_0x13a5('0x6'));var util=require('util');var path=require(_0x13a5('0x7'));var sox=require(_0x13a5('0x8'));var csv=require(_0x13a5('0x9'));var ejs=require(_0x13a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x13a5('0xb'));var crypto=require(_0x13a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x13a5('0xd'));var toCsv=require(_0x13a5('0x9'));var querystring=require('querystring');var Papa=require(_0x13a5('0xe'));var Redis=require(_0x13a5('0xf'));var authService=require(_0x13a5('0x10'));var qs=require(_0x13a5('0x11'));var as=require(_0x13a5('0x12'));var hardwareService=require(_0x13a5('0x13'));var logger=require(_0x13a5('0x14'))(_0x13a5('0x15'));var utils=require(_0x13a5('0x16'));var config=require(_0x13a5('0x17'));var db=require(_0x13a5('0x18'))['db'];config['redis']=_[_0x13a5('0x19')](config[_0x13a5('0x1a')],{'host':_0x13a5('0x1b'),'port':0x18eb});var socket=require(_0x13a5('0x1c'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0x13a5('0x1d')](socket);function respondWithStatusCode(_0x2b5340,_0x547c41){_0x547c41=_0x547c41||0xcc;return function(_0x46425f){if(_0x46425f){return _0x2b5340['sendStatus'](_0x547c41);}return _0x2b5340[_0x13a5('0x1e')](_0x547c41)['end']();};}function respondWithResult(_0x4888f2,_0x1e0e14){_0x1e0e14=_0x1e0e14||0xc8;return function(_0x5f374e){if(_0x5f374e){return _0x4888f2[_0x13a5('0x1e')](_0x1e0e14)[_0x13a5('0x1f')](_0x5f374e);}};}function respondWithFilteredResult(_0x359eb4,_0x19244b){return function(_0x1b3ef6){if(_0x1b3ef6){var _0x67c0b1=_0x1b3ef6['count'],_0x5aeed3=_0x19244b[_0x13a5('0x20')],_0x319b5d=_0x19244b[_0x13a5('0x20')]+_0x19244b[_0x13a5('0x21')],_0x46cb87;if(_0x319b5d>=_0x67c0b1){_0x319b5d=_0x67c0b1;_0x46cb87=0xc8;}else{_0x46cb87=0xce;}_0x359eb4['status'](_0x46cb87);return _0x359eb4['set'](_0x13a5('0x22'),_0x5aeed3+'-'+_0x319b5d+'/'+_0x67c0b1)[_0x13a5('0x1f')](_0x1b3ef6);}return null;};}function patchUpdates(_0x11e265){return function(_0x4da63b){try{jsonpatch[_0x13a5('0x23')](_0x4da63b,_0x11e265,!![]);}catch(_0x59ec4b){return BPromise[_0x13a5('0x24')](_0x59ec4b);}return _0x4da63b[_0x13a5('0x25')]();};}function saveUpdates(_0x3aa7ae,_0x4e3f67){return function(_0x246c08){if(_0x246c08){return _0x246c08[_0x13a5('0x26')](_0x3aa7ae)[_0x13a5('0x27')](function(_0xab816b){return _0xab816b;});}return null;};}function removeEntity(_0x20b7e5,_0xeb46a3){return function(_0x3dd77a){if(_0x3dd77a){return _0x3dd77a[_0x13a5('0x28')]()['then'](function(){_0x20b7e5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e8c67,_0x38fa5f){return function(_0x10f1ca){if(!_0x10f1ca){_0x1e8c67['sendStatus'](0x194);}return _0x10f1ca;};}function handleError(_0x257686,_0x4625f3){_0x4625f3=_0x4625f3||0x1f4;return function(_0x42ec77){logger['error'](_0x42ec77['stack']);if(_0x42ec77['name']){delete _0x42ec77['name'];}_0x257686[_0x13a5('0x1e')](_0x4625f3)['send'](_0x42ec77);};}function getInteractionUsers(_0x8b8000,_0x533389){return new BPromise(function(_0x480e20,_0x19322a){try{if(_0x533389[_0x8b8000['id']]){_0x8b8000[_0x13a5('0x29')]=_[_0x13a5('0x2a')](_0x533389[_0x8b8000['id']],function(_0x418c22){return{'id':_0x418c22['id'],'fullname':_0x418c22[_0x13a5('0x2b')]};});}}catch(_0x31bdf8){_0x19322a(_0x31bdf8);}_0x480e20(_0x8b8000);});}function getInteractionTags(_0x356f0b,_0x7b434f){return new BPromise(function(_0x3867d3,_0xdce1e7){try{if(_0x356f0b[_0x13a5('0x2c')]){_0x356f0b[_0x13a5('0x2d')]=[];_0x356f0b['TagIds']['split'](',')[_0x13a5('0x2e')](function(_0x55ff00){_0x356f0b[_0x13a5('0x2d')]['push'](_0x7b434f[_0x55ff00]);});}delete _0x356f0b[_0x13a5('0x2c')];}catch(_0x3ec274){_0xdce1e7(_0x3ec274);}_0x3867d3(_0x356f0b);});}function updateOpenchannelInteraction(_0x561feb,_0x28735d,_0x27b465){return new BPromise(function(_0x53bd75,_0x4c5a27){return getInteractionUsers(_0x561feb,_0x27b465)['then'](function(_0x2066e3){return getInteractionTags(_0x2066e3,_0x28735d);})[_0x13a5('0x27')](function(_0x9834a5){_0x53bd75(_0x9834a5);})[_0x13a5('0x2f')](function(_0x50b5c6){_0x4c5a27(_0x50b5c6);});});}exports[_0x13a5('0x30')]=function(_0x2a7982,_0x32883a){var _0x10d830={},_0x360d1b={},_0x209d5d={'count':0x0,'rows':[]};var _0xea0aff=_['map'](db[_0x13a5('0x31')][_0x13a5('0x32')],function(_0x3668d7){return{'name':_0x3668d7['fieldName'],'type':_0x3668d7['type'][_0x13a5('0x33')]};});_0x360d1b[_0x13a5('0x34')]=_[_0x13a5('0x2a')](_0xea0aff,_0x13a5('0x35'));_0x360d1b[_0x13a5('0x36')]=_[_0x13a5('0x37')](_0x2a7982[_0x13a5('0x36')]);_0x360d1b[_0x13a5('0x38')]=_[_0x13a5('0x39')](_0x360d1b[_0x13a5('0x34')],_0x360d1b[_0x13a5('0x36')]);_0x10d830['attributes']=_['intersection'](_0x360d1b[_0x13a5('0x34')],qs['fields'](_0x2a7982[_0x13a5('0x36')]['fields']));_0x10d830[_0x13a5('0x3a')]=_0x10d830[_0x13a5('0x3a')][_0x13a5('0x3b')]?_0x10d830[_0x13a5('0x3a')]:_0x360d1b[_0x13a5('0x34')];if(!_0x2a7982[_0x13a5('0x36')][_0x13a5('0x3c')](_0x13a5('0x3d'))){_0x10d830['limit']=qs[_0x13a5('0x21')](_0x2a7982[_0x13a5('0x36')][_0x13a5('0x21')]);_0x10d830[_0x13a5('0x20')]=qs[_0x13a5('0x20')](_0x2a7982[_0x13a5('0x36')][_0x13a5('0x20')]);}_0x10d830[_0x13a5('0x3e')]=qs[_0x13a5('0x3f')](_0x2a7982[_0x13a5('0x36')][_0x13a5('0x3f')]);_0x10d830[_0x13a5('0x40')]=qs[_0x13a5('0x38')](_[_0x13a5('0x41')](_0x2a7982['query'],_0x360d1b[_0x13a5('0x38')]));var _0x2467b9=[];var _0x29985a=squel[_0x13a5('0x42')]()[_0x13a5('0x43')]('id')[_0x13a5('0x43')](_0x13a5('0x35'))[_0x13a5('0x43')]('color')[_0x13a5('0x44')](_0x13a5('0x45'));var _0x33621=squel[_0x13a5('0x42')]()[_0x13a5('0x43')](_0x13a5('0x46'))[_0x13a5('0x43')](_0x13a5('0x47'))[_0x13a5('0x43')](_0x13a5('0x48'))[_0x13a5('0x44')](_0x13a5('0x49'),'ui')[_0x13a5('0x4a')](_0x13a5('0x4b'),'u','u.id\x20=\x20ui.UserId');var _0x26956f=squel[_0x13a5('0x42')]()[_0x13a5('0x44')](_0x13a5('0x4c'),'i')[_0x13a5('0x4a')](_0x13a5('0x4d'),'c',_0x13a5('0x4e'))[_0x13a5('0x4a')](_0x13a5('0x4b'),'o',_0x13a5('0x4f'))[_0x13a5('0x4a')](_0x13a5('0x50'),'a',_0x13a5('0x51'))[_0x13a5('0x4a')](_0x13a5('0x52'),'me',_0x13a5('0x53'))[_0x13a5('0x4a')](_0x13a5('0x54'),'it',_0x13a5('0x55'))[_0x13a5('0x4a')](_0x13a5('0x45'),'t',_0x13a5('0x56'));var _0x105e68=squel[_0x13a5('0x57')]();var _0x255b33=[];var _0x23b2f3=squel['expr']();var _0x53c929;if(_0x2a7982[_0x13a5('0x36')][_0x13a5('0x58')]){_0x53c929=as[_0x13a5('0x59')](_0x2a7982[_0x13a5('0x36')][_0x13a5('0x58')]);var _0x2e9460=_0x53c929[_0x13a5('0x5a')];for(var _0xcd5175=0x0;_0xcd5175<_0x53c929[_0x13a5('0x5b')][_0x13a5('0x3b')];_0xcd5175++){var _0x2f13b9=_0x53c929[_0x13a5('0x5b')][_0xcd5175];var _0x13370c='i';var _0x401eb0=_[_0x13a5('0x5c')](_0xea0aff,['name',_0x2f13b9[_0x13a5('0x43')]]);if(!_0x401eb0){switch(_0x2f13b9[_0x13a5('0x43')]){case _0x13a5('0x5d'):if(_0x2f13b9[_0x13a5('0x5e')]==0x1){_0x26956f['having']('`'+_0x2f13b9[_0x13a5('0x43')]+_0x13a5('0x5f'));}else{_0x26956f[_0x13a5('0x60')]('`'+_0x2f13b9[_0x13a5('0x43')]+_0x13a5('0x61'));}break;case _0x13a5('0x62'):if(_0x2f13b9[_0x13a5('0x63')]===_0x13a5('0x64')){if(_0x2f13b9['value'][_0x13a5('0x65')]('\x20')[_0x13a5('0x3b')]>0x1){_0x105e68[_0x2e9460](_0x13a5('0x66'),qs[_0x13a5('0x67')](_0x2f13b9[_0x13a5('0x5e')]),null);}else{var _0x452737='%'+_0x2f13b9[_0x13a5('0x5e')]+'%';_0x105e68[_0x2e9460](_0x13a5('0x68'),_0x452737,_0x452737,_0x452737);}}else{_0x401eb0=_['find'](_0xea0aff,[_0x13a5('0x35'),_0x13a5('0x69')]);_0x2f13b9[_0x13a5('0x43')]=_0x13a5('0x69');_0x5df465=as[_0x13a5('0x6a')](_0x13370c,_0x401eb0[_0x13a5('0x6b')],_0x2f13b9);_0x105e68[_0x2e9460](_0x5df465[_0x13a5('0x6c')],_0x5df465[_0x13a5('0x5e')][_0x13a5('0x6d')],_0x5df465[_0x13a5('0x5e')][_0x13a5('0x6e')]);}break;case _0x13a5('0x6f'):var _0x2e78aa=_0x2f13b9['value'][_0x13a5('0x65')](',')[_0x13a5('0x2a')](function(_0x2f17db){return Number(_0x2f17db);});_0x2e78aa[_0x13a5('0x2e')](function(_0x1cfcaf){_0x23b2f3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1cfcaf+',%');});_0x255b33=_[_0x13a5('0x70')](_0x255b33,_0x2e78aa);break;case _0x13a5('0x71'):if(_0x2f13b9['operator']===_0x13a5('0x64')){_0x105e68[_0x2e9460](_0x13a5('0x72'),'%'+_0x2f13b9[_0x13a5('0x5e')]+'%',null);}else{_0x401eb0=_[_0x13a5('0x5c')](_0xea0aff,['name',_0x13a5('0x73')]);_0x2f13b9[_0x13a5('0x43')]='UserId';_0x5df465=as[_0x13a5('0x6a')](_0x13370c,_0x401eb0[_0x13a5('0x6b')],_0x2f13b9);_0x105e68[_0x2e9460](_0x5df465[_0x13a5('0x6c')],_0x5df465[_0x13a5('0x5e')][_0x13a5('0x6d')],_0x5df465[_0x13a5('0x5e')][_0x13a5('0x6e')]);}break;case'body':_0x5df465=as[_0x13a5('0x6a')]('me',null,_0x2f13b9);_0x105e68[_0x2e9460](_0x5df465[_0x13a5('0x6c')],_0x5df465['value']['start'],_0x5df465[_0x13a5('0x5e')]['end']);break;}}else{var _0x5df465=as[_0x13a5('0x6a')](_0x13370c,_0x401eb0[_0x13a5('0x6b')],_0x2f13b9);_0x105e68[_0x2e9460](_0x5df465['text'],_0x5df465[_0x13a5('0x5e')]['start'],_0x5df465['value'][_0x13a5('0x6e')]);}}}else{var _0x3857b4=_(_0x2a7982[_0x13a5('0x36')])['keys']()[_0x13a5('0x2a')](function(_0x3c1662){return _[_0x13a5('0x74')](_0xea0aff,[_0x13a5('0x35'),_0x3c1662])?_0x3c1662:undefined;})[_0x13a5('0x75')]()['value']();if(!_[_0x13a5('0x76')](_0x3857b4)){_0x3857b4[_0x13a5('0x2e')](function(_0x2f7a2c){if(_0x2f7a2c==='OpenchannelAccountId'){_0x26956f[_0x13a5('0x40')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x13a5('0x77')](_0x2a7982[_0x13a5('0x36')][_0x2f7a2c]));}else if(_0x2f7a2c===_0x13a5('0x78')){var _0x431800=JSON[_0x13a5('0x79')](_0x2a7982[_0x13a5('0x36')][_0x2f7a2c])['$gte'];var _0x6971b9=JSON[_0x13a5('0x79')](_0x2a7982['query'][_0x2f7a2c])[_0x13a5('0x7a')];_0x26956f['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x431800,_0x6971b9);}else{if(_0x2a7982[_0x13a5('0x36')][_0x2f7a2c]==='null'){_0x26956f[_0x13a5('0x40')]('i.'+_0x2f7a2c+'\x20IS\x20NULL');}else{_0x26956f[_0x13a5('0x40')]('i.'+_0x2f7a2c+_0x13a5('0x7b'),_0x2a7982[_0x13a5('0x36')][_0x2f7a2c]);}}});}if(_0x2a7982[_0x13a5('0x36')][_0x13a5('0x7c')]){if(_0x2a7982[_0x13a5('0x36')]['read']==0x1){_0x26956f[_0x13a5('0x60')](_0x13a5('0x7d'));}else{_0x26956f[_0x13a5('0x60')](_0x13a5('0x7e'));}}if(_0x2a7982[_0x13a5('0x36')][_0x13a5('0x7f')]){_0x255b33=_[_0x13a5('0x80')](_0x2a7982[_0x13a5('0x36')][_0x13a5('0x7f')])?_0x2a7982[_0x13a5('0x36')][_0x13a5('0x7f')]:new Array(_0x2a7982[_0x13a5('0x36')][_0x13a5('0x7f')]);_0x255b33[_0x13a5('0x2e')](function(_0x3f20e3){_0x23b2f3['or'](_0x13a5('0x81'),'%,'+_0x3f20e3+',%');});}if(_0x2a7982[_0x13a5('0x36')][_0x13a5('0x82')]){var _0x34ce9f=_0x2a7982[_0x13a5('0x36')][_0x13a5('0x82')]['replace']('\x5c','\x5c\x5c')[_0x13a5('0x83')]('\x27\x27',_0x13a5('0x84'));if(qs[_0x13a5('0x85')](_0x34ce9f)){_0x105e68['or'](_0x13a5('0x86'),_0x34ce9f+'%');}else{_0x105e68['or'](_0x13a5('0x87'),qs[_0x13a5('0x67')](_0x34ce9f))['or']('i.from\x20LIKE\x20?',_0x34ce9f+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x34ce9f+'%');}}}_0x26956f['where'](_0x105e68);_0x26956f[_0x13a5('0x88')](_0x13a5('0x89'));var _0x3ae660={'type':db[_0x13a5('0x8a')][_0x13a5('0x8b')][_0x13a5('0x8c')],'raw':!![]};var _0x44fa5c=_0x26956f[_0x13a5('0x8d')]();_0x44fa5c[_0x13a5('0x43')](_0x13a5('0x89'));_0x44fa5c[_0x13a5('0x43')](_0x13a5('0x8e'),_0x13a5('0x5d'));if(_0x10d830['order']){_0x10d830[_0x13a5('0x3e')][_0x13a5('0x2e')](function(_0x1e3fdb){_0x26956f[_0x13a5('0x3e')]('i.'+_0x1e3fdb[0x0],_0x1e3fdb[0x1]===_0x13a5('0x8f')?![]:!![]);});}if(!_[_0x13a5('0x76')](_0x255b33)){_0x26956f[_0x13a5('0x60')](_0x23b2f3);_0x44fa5c[_0x13a5('0x40')](_0x13a5('0x90'),_0x255b33);}BPromise['resolve']()[_0x13a5('0x27')](function(){if(!_0x53c929){if(_0x2a7982[_0x13a5('0x36')]['OpenchannelAccountId']||_0x2a7982[_0x13a5('0x36')][_0x13a5('0x91')])return;_0x44fa5c[_0x13a5('0x40')](_0x13a5('0x92'));_0x26956f['where'](_0x13a5('0x92'));return;}return _0x2a7982[_0x13a5('0x93')][_0x13a5('0x94')]({'attributes':['id'],'raw':!![]})[_0x13a5('0x27')](function(_0x35ca53){if(_['isEmpty'](_0x35ca53)){_0x44fa5c[_0x13a5('0x40')](_0x13a5('0x95'));_0x26956f[_0x13a5('0x40')](_0x13a5('0x95'));}else{_0x44fa5c[_0x13a5('0x40')](_0x13a5('0x96'),_['map'](_0x35ca53,'id'));_0x26956f[_0x13a5('0x40')](_0x13a5('0x96'),_[_0x13a5('0x2a')](_0x35ca53,'id'));}});})[_0x13a5('0x27')](function(){db[_0x13a5('0x97')][_0x13a5('0x36')](_0x44fa5c['toString'](),_0x3ae660)[_0x13a5('0x27')](function(_0x15469f){_0x209d5d['count']=_0x15469f['length'];if(_0x209d5d[_0x13a5('0x98')]===0x0)return[];return db['sequelize'][_0x13a5('0x36')](_0x29985a['toString'](),_0x3ae660)[_0x13a5('0x27')](function(_0x1d9e51){_0x2467b9=_[_0x13a5('0x99')](_0x1d9e51,'id');_0x3ae660=_[_0x13a5('0x9a')](_0x3ae660,{'model':db[_0x13a5('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2a7982['query']['fields']){_0x10d830[_0x13a5('0x3a')][_0x13a5('0x2e')](function(_0x2e750b){_0x26956f[_0x13a5('0x43')]('i.'+_0x2e750b);});}else{_0x26956f[_0x13a5('0x43')](_0x13a5('0x8e'),'unreadMessages');_0x26956f['field'](_0x13a5('0x9b'),_0x13a5('0x9c'));_0x26956f[_0x13a5('0x43')]('a.mandatoryDisposition',_0x13a5('0x9d'));_0x26956f[_0x13a5('0x43')]('i.*');_0x26956f[_0x13a5('0x43')](_0x13a5('0x9e'),'Contact.firstName');_0x26956f[_0x13a5('0x43')](_0x13a5('0x9f'),_0x13a5('0xa0'));_0x26956f[_0x13a5('0x43')](_0x13a5('0xa1'),_0x13a5('0xa2'));_0x26956f[_0x13a5('0x43')]('c.phone',_0x13a5('0xa3'));_0x26956f[_0x13a5('0x43')](_0x13a5('0xa4'),_0x13a5('0xa5'));_0x26956f[_0x13a5('0x43')](_0x13a5('0xa6'),_0x13a5('0xa7'));_0x26956f[_0x13a5('0x43')]('o.fullname',_0x13a5('0xa8'));_0x26956f['field'](_0x13a5('0xa9'),'Owner.internal');_0x26956f[_0x13a5('0x43')](_0x13a5('0xaa'),_0x13a5('0x2c'));}_0x26956f['limit'](_0x10d830[_0x13a5('0x21')]);_0x26956f[_0x13a5('0x20')](_0x10d830[_0x13a5('0x20')]);return db[_0x13a5('0x97')][_0x13a5('0x36')](_0x26956f[_0x13a5('0xab')](),_0x3ae660);})[_0x13a5('0x27')](function(_0x178b8c){_0x33621[_0x13a5('0x40')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x13a5('0x2a')](_0x178b8c,'id'));return db['sequelize'][_0x13a5('0x36')](_0x33621[_0x13a5('0xab')](),_0x3ae660)[_0x13a5('0x27')](function(_0x57c0d5){var _0x1ce926=_['groupBy'](_0x57c0d5,_0x13a5('0xac'));var _0x8203a9=[];_0x178b8c[_0x13a5('0x2e')](function(_0x196ad1){_0x8203a9[_0x13a5('0xad')](updateOpenchannelInteraction(_0x196ad1,_0x2467b9,_0x1ce926));});return BPromise[_0x13a5('0xae')](_0x8203a9);});});})['then'](function(_0x3dd792){_0x209d5d['rows']=_0x3dd792;return _0x209d5d;})[_0x13a5('0x27')](respondWithFilteredResult(_0x32883a,_0x10d830));})['catch'](handleError(_0x32883a,null));};exports[_0x13a5('0xaf')]=function(_0x5887bc,_0x5aea8c){var _0x47f6cd={'raw':![],'where':{'id':_0x5887bc[_0x13a5('0xb0')]['id']}},_0x40efcf={};_0x40efcf[_0x13a5('0x34')]=_[_0x13a5('0x37')](db[_0x13a5('0x31')][_0x13a5('0x32')]);_0x40efcf[_0x13a5('0x36')]=_[_0x13a5('0x37')](_0x5887bc['query']);_0x40efcf[_0x13a5('0x38')]=_[_0x13a5('0x39')](_0x40efcf[_0x13a5('0x34')],_0x40efcf['query']);_0x47f6cd[_0x13a5('0x3a')]=_[_0x13a5('0x39')](_0x40efcf['model'],qs['fields'](_0x5887bc[_0x13a5('0x36')][_0x13a5('0xb1')]));_0x47f6cd['attributes']=_0x47f6cd[_0x13a5('0x3a')][_0x13a5('0x3b')]?_0x47f6cd[_0x13a5('0x3a')]:_0x40efcf[_0x13a5('0x34')];if(_0x5887bc[_0x13a5('0x36')]['includeAll']){_0x47f6cd[_0x13a5('0xb2')]=[{'all':!![]}];}_0x47f6cd=_['merge']({},_0x47f6cd,_0x5887bc[_0x13a5('0xb3')]);return db[_0x13a5('0x31')][_0x13a5('0x5c')](_0x47f6cd)[_0x13a5('0x27')](handleEntityNotFound(_0x5aea8c,null))[_0x13a5('0x27')](respondWithResult(_0x5aea8c,null))[_0x13a5('0x2f')](handleError(_0x5aea8c,null));};exports[_0x13a5('0xb4')]=function(_0x2ec8fa,_0x2ab6bb){return db[_0x13a5('0x31')][_0x13a5('0xb4')](_0x2ec8fa['body'],{})[_0x13a5('0x27')](respondWithResult(_0x2ab6bb,0xc9))[_0x13a5('0x2f')](handleError(_0x2ab6bb,null));};exports[_0x13a5('0x26')]=function(_0x162253,_0x30c75b){if(_0x162253[_0x13a5('0xb5')]['id']){delete _0x162253['body']['id'];}return db[_0x13a5('0x31')][_0x13a5('0x5c')]({'where':{'id':_0x162253[_0x13a5('0xb0')]['id']}})['then'](handleEntityNotFound(_0x30c75b,null))[_0x13a5('0x27')](saveUpdates(_0x162253[_0x13a5('0xb5')],null))[_0x13a5('0x27')](respondWithResult(_0x30c75b,null))[_0x13a5('0x2f')](handleError(_0x30c75b,null));};exports[_0x13a5('0x28')]=function(_0x567bc6,_0x17dbb3){return db[_0x13a5('0x31')]['find']({'where':{'id':_0x567bc6[_0x13a5('0xb0')]['id']}})[_0x13a5('0x27')](handleEntityNotFound(_0x17dbb3,null))[_0x13a5('0x27')](removeEntity(_0x17dbb3,null))['catch'](handleError(_0x17dbb3,null));};exports[_0x13a5('0xb6')]=function(_0x4bf21c,_0x48b227){return db[_0x13a5('0x31')][_0x13a5('0xb6')]()['then'](respondWithResult(_0x48b227,null))['catch'](handleError(_0x48b227,null));};exports[_0x13a5('0xb7')]=function(_0x738d24,_0x11718f,_0x34e76d){return db[_0x13a5('0xb8')][_0x13a5('0x5c')]({'where':{'id':_0x738d24[_0x13a5('0xb0')]['id']}})[_0x13a5('0x27')](handleEntityNotFound(_0x11718f,null))['then'](function(_0x471753){if(_0x471753){return _0x471753[_0x13a5('0xb7')](_0x738d24[_0x13a5('0xb5')]['ids'],_[_0x13a5('0xb9')](_0x738d24['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x11718f,null))[_0x13a5('0x2f')](handleError(_0x11718f,null));};exports['getMessages']=function(_0x5672b8,_0x2a768c,_0x6cb145){var _0x2e620b={'raw':![],'where':{}};var _0x566ff4={};var _0x3b8338={'count':0x0,'rows':[]};return db['OpenchannelInteraction']['findOne']({'where':{'id':_0x5672b8[_0x13a5('0xb0')]['id']}})[_0x13a5('0x27')](handleEntityNotFound(_0x2a768c,null))['then'](function(_0x35edf3){if(_0x35edf3){_0x566ff4[_0x13a5('0x34')]=_['keys'](db[_0x13a5('0xb8')][_0x13a5('0x32')]);_0x566ff4['query']=_[_0x13a5('0x37')](_0x5672b8[_0x13a5('0x36')]);_0x566ff4[_0x13a5('0x38')]=_[_0x13a5('0x39')](_0x566ff4[_0x13a5('0x34')],_0x566ff4[_0x13a5('0x36')]);_0x2e620b[_0x13a5('0x3a')]=_['intersection'](_0x566ff4[_0x13a5('0x34')],qs[_0x13a5('0xb1')](_0x5672b8['query'][_0x13a5('0xb1')]));_0x2e620b[_0x13a5('0x3a')]=_0x2e620b[_0x13a5('0x3a')]['length']?_0x2e620b[_0x13a5('0x3a')]:_0x566ff4[_0x13a5('0x34')];if(!_0x5672b8['query'][_0x13a5('0x3c')]('nolimit')){_0x2e620b['limit']=qs[_0x13a5('0x21')](_0x5672b8[_0x13a5('0x36')][_0x13a5('0x21')]);_0x2e620b[_0x13a5('0x20')]=qs[_0x13a5('0x20')](_0x5672b8[_0x13a5('0x36')][_0x13a5('0x20')]);}_0x2e620b[_0x13a5('0x3e')]=qs[_0x13a5('0x3f')](_0x5672b8[_0x13a5('0x36')]['sort']);_0x2e620b[_0x13a5('0x40')]=qs[_0x13a5('0x38')](_[_0x13a5('0x41')](_0x5672b8[_0x13a5('0x36')],_0x566ff4[_0x13a5('0x38')]));_0x2e620b[_0x13a5('0x40')][_0x13a5('0xac')]=_0x35edf3['id'];if(_0x5672b8[_0x13a5('0x36')][_0x13a5('0x82')]){_0x2e620b['where']=_['merge'](_0x2e620b[_0x13a5('0x40')],{'$or':_['map'](_0x2e620b[_0x13a5('0x3a')],function(_0x3e7e66){var _0x10cb15={};_0x10cb15[_0x3e7e66]={'$like':'%'+_0x5672b8[_0x13a5('0x36')][_0x13a5('0x82')]+'%'};return _0x10cb15;})});}if(_0x5672b8[_0x13a5('0x36')][_0x13a5('0xba')]){var _0x47fdb9=_0x5672b8['query']['$gte']['split'](',');var _0x8a4ba8={};_0x8a4ba8[_0x47fdb9[0x0]]={'$gte':moment(_0x47fdb9[0x1])[_0x13a5('0xbb')](_0x13a5('0xbc'))};_0x2e620b['where']=_[_0x13a5('0x9a')](_0x2e620b[_0x13a5('0x40')],_0x8a4ba8);}_0x2e620b=_['merge']({},_0x2e620b,_0x5672b8[_0x13a5('0xb3')]);return db['OpenchannelMessage']['count']({'where':_0x2e620b['where']})[_0x13a5('0x27')](function(_0x52b059){_0x3b8338[_0x13a5('0x98')]=_0x52b059;if(_0x5672b8['query'][_0x13a5('0xbd')]){_0x2e620b[_0x13a5('0xb2')]=[{'all':!![]}];}return db[_0x13a5('0xb8')][_0x13a5('0xbe')](_0x2e620b);})[_0x13a5('0x27')](function(_0x1d411c){_0x3b8338[_0x13a5('0xbf')]=_0x1d411c;return _0x3b8338;});}})[_0x13a5('0x27')](respondWithFilteredResult(_0x2a768c,_0x2e620b))[_0x13a5('0x2f')](handleError(_0x2a768c,null));};exports[_0x13a5('0xc0')]=function(_0x3fdb1e,_0x7434e,_0x3cfdeb){return db[_0x13a5('0x31')][_0x13a5('0x5c')]({'where':{'id':_0x3fdb1e[_0x13a5('0xb0')]['id']}})[_0x13a5('0x27')](handleEntityNotFound(_0x7434e,null))[_0x13a5('0x27')](function(_0x5ab345){if(_0x5ab345){return _0x5ab345[_0x13a5('0xc1')](_0x3fdb1e[_0x13a5('0xb5')][_0x13a5('0xc2')],_[_0x13a5('0xb9')](_0x3fdb1e[_0x13a5('0xb5')],['ids','id'])||{})[_0x13a5('0xc3')](function(){return db[_0x13a5('0x6f')]['findAll']({'attributes':['id','name',_0x13a5('0xc4')],'where':{'id':_0x3fdb1e[_0x13a5('0xb5')][_0x13a5('0xc2')]}});})['then'](function(_0x234f8b){socket[_0x13a5('0xc5')](_0x13a5('0xc6'),{'id':Number(_0x3fdb1e[_0x13a5('0xb0')]['id']),'tags':_0x234f8b||[]});return{'id':Number(_0x3fdb1e[_0x13a5('0xb0')]['id']),'tags':_0x234f8b||[]};});}})[_0x13a5('0x27')](respondWithResult(_0x7434e,null))[_0x13a5('0x2f')](handleError(_0x7434e,null));};exports[_0x13a5('0xc7')]=function(_0x2f8163,_0xcc4f63,_0x547514){return db[_0x13a5('0x31')]['find']({'where':{'id':_0x2f8163['params']['id']}})['then'](handleEntityNotFound(_0xcc4f63,null))[_0x13a5('0x27')](function(_0x43ab2e){if(_0x43ab2e){return _0x43ab2e['removeTags'](_0x2f8163['query'][_0x13a5('0xc2')]);}})[_0x13a5('0x27')](respondWithStatusCode(_0xcc4f63,null))[_0x13a5('0x2f')](handleError(_0xcc4f63,null));};exports[_0x13a5('0xc8')]=function(_0x185d1c,_0x3cd94d){var _0x2331ac=moment()[_0x13a5('0xc9')]()['toString']();var _0x1912fb=path[_0x13a5('0xca')](config[_0x13a5('0xcb')],_0x13a5('0xcc'),_0x13a5('0xcd'),_0x13a5('0xce'));var _0x407159=path['join'](config['root'],_0x13a5('0xcc'),'files',_0x13a5('0xcf'));var _0x5d912d=path[_0x13a5('0xca')](_0x1912fb,_0x2331ac);var _0x562b8c=util[_0x13a5('0xbb')](_0x13a5('0xd0'),_0x185d1c[_0x13a5('0xb0')]['id'],_0x2331ac);var _0x58b336=path[_0x13a5('0xca')](_0x1912fb,_0x562b8c);var _0x4a489e=[];_0x4a489e[_0x13a5('0xad')]({'model':db[_0x13a5('0x71')],'as':_0x13a5('0x71'),'attributes':['id',_0x13a5('0x2b')],'raw':!![]});_0x4a489e[_0x13a5('0xad')]({'model':db['CmContact'],'as':_0x13a5('0x62'),'attributes':['id','firstName',_0x13a5('0xd1')],'raw':!![]});if(_0x185d1c['query']['attachments']){_0x4a489e['push']({'model':db[_0x13a5('0xd2')],'as':_0x13a5('0xd2'),'raw':!![]});}var _0x35c172=[{'model':db[_0x13a5('0xb8')],'as':'Messages','attributes':['id','body',_0x13a5('0x78'),_0x13a5('0xd3'),_0x13a5('0xd4'),_0x13a5('0x7c')],'include':_0x4a489e}];_0x35c172[_0x13a5('0xad')]({'model':db[_0x13a5('0xd5')],'as':_0x13a5('0xd6'),'attributes':['id','name']});_0x35c172[_0x13a5('0xad')]({'model':db[_0x13a5('0x71')],'as':_0x13a5('0xd7'),'attributes':['id',_0x13a5('0x2b')]});return db[_0x13a5('0x31')][_0x13a5('0x5c')]({'where':{'id':_0x185d1c[_0x13a5('0xb0')]['id']},'include':_0x35c172})[_0x13a5('0x27')](handleEntityNotFound(_0x3cd94d,null))[_0x13a5('0x27')](function(_0x128adc){if(_0x128adc){var _0x1f58a1=_0x128adc['get']({'plain':!![]});fs[_0x13a5('0xd8')](_0x5d912d);var _0x4ee7ac={'format':'A4','border':'10px','header':{'height':_0x13a5('0xd9'),'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':_0x13a5('0xda'),'contents':{'default':util[_0x13a5('0xbb')](_0x13a5('0xdb'),util[_0x13a5('0xbb')](_0x13a5('0xdc'),_0x13a5('0xdd'),_0x1f58a1['id']),moment()[_0x13a5('0xbb')](_0x13a5('0xde'))['toString']())}}};var _0x43511f={'channel':_0x13a5('0xdd'),'account':_0x1f58a1[_0x13a5('0xd6')]['name'],'agent':_0x1f58a1['Owner']?_0x1f58a1[_0x13a5('0xd7')][_0x13a5('0x2b')]:_0x13a5('0xdf'),'createdAt':moment(_0x1f58a1[_0x13a5('0x78')])['format'](_0x13a5('0xbc'))[_0x13a5('0xab')](),'closedAt':_0x1f58a1[_0x13a5('0xe0')]?moment(_0x1f58a1['closedAt'])['format'](_0x13a5('0xbc'))['toString']():'','disposition':_0x1f58a1['disposition'],'visibility':_0x1f58a1[_0x13a5('0xe1')]?'Public':_0x13a5('0xe2'),'messages':_(_0x1f58a1[_0x13a5('0xe3')])[_0x13a5('0x82')]({'secret':![]})[_0x13a5('0x2a')](function(_0x23d63b){if(_0x23d63b[_0x13a5('0xd2')]){var _0x1e5429=path['join'](_0x407159,_0x23d63b['Attachment'][_0x13a5('0xe4')]);if(fs['existsSync'](_0x1e5429)){fs[_0x13a5('0xe5')](_0x1e5429)[_0x13a5('0xe6')](fs[_0x13a5('0xe7')](path[_0x13a5('0xca')](_0x5d912d,_0x23d63b[_0x13a5('0xd2')][_0x13a5('0xe4')])));}}return{'date':moment(_0x23d63b[_0x13a5('0x78')])[_0x13a5('0xbb')](_0x13a5('0xbc'))[_0x13a5('0xab')](),'sender':_0x23d63b[_0x13a5('0xd3')]===_0x13a5('0xe8')?_0x23d63b['User']?_0x23d63b[_0x13a5('0x71')]['fullname']:'System':_0x23d63b[_0x13a5('0x62')][_0x13a5('0xe9')]+(_0x23d63b['Contact']['lastName']?'\x20'+_0x23d63b['Contact'][_0x13a5('0xd1')]:''),'body':_0x23d63b[_0x13a5('0xd2')]?_0x23d63b['Attachment']['basename']:_0x23d63b[_0x13a5('0xb5')],'direction':_0x23d63b[_0x13a5('0xd3')]===_0x13a5('0xe8')?'A':'C','secret':_0x23d63b[_0x13a5('0xd4')],'read':_0x23d63b[_0x13a5('0x7c')],'attachment':_0x23d63b[_0x13a5('0xd2')]};})[_0x13a5('0x5e')]()};return ejs['renderFile'](path['join'](config[_0x13a5('0xcb')],_0x13a5('0xcc'),_0x13a5('0xea'),_0x13a5('0xeb')),{'interaction':_0x43511f})['then'](function(_0x2a7913){return new BPromise(function(_0xfb5e5a,_0x73534c){pdf[_0x13a5('0xb4')](_0x2a7913,_0x4ee7ac)[_0x13a5('0xec')](path['join'](_0x5d912d,_0x13a5('0xed')+_0x1f58a1['id']+'-'+_0x2331ac+'.pdf'),function(_0x159c99,_0x3d67e1){if(_0x159c99)return _0x73534c(_0x159c99);_0xfb5e5a(_0x3d67e1);});});})['then'](function(){return new BPromise(function(_0x3322f7,_0xf22507){zipdir(_0x5d912d,{'saveTo':_0x58b336},function(_0x215d2e,_0x5c5abc){if(_0x215d2e)return _0xf22507(_0x215d2e);return _0x3322f7(_0x5c5abc);});})['then'](function(){return new BPromise(function(_0x4e0e64,_0x269ab6){rimraf(_0x5d912d,function(_0xafb29){if(_0xafb29)_0x269ab6(_0xafb29);return _0x4e0e64();});});})[_0x13a5('0x27')](function(){return _0x3cd94d[_0x13a5('0xc8')](_0x58b336,_0x562b8c,function(_0x2094cc){if(_0x2094cc){console['log'](_0x13a5('0xee'),_0x2094cc);}else{fs[_0x13a5('0xef')](_0x58b336);}});});});}else{return _0x3cd94d[_0x13a5('0xf0')](0xc8);}})['catch'](handleError(_0x3cd94d,null));}; \ No newline at end of file +var _0xb770=['out','System','firstName','renderFile','views','downloadInteraction.html','transcript-','.pdf','log','unlinkSync','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','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','redis','defaults','localhost','./openchannelInteraction.socket','register','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','OpenchannelInteraction','rawAttributes','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','end','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','buildExpression','body','type','some','compact','isEmpty','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','sequelize','count','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.lastName','Contact.lastName','c.email','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','params','intersection','create','destroy','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','$gte','format','includeAll','findAll','rows','addTags','setTags','spread','Tag','emit','openchannelInteractionTags:save','download','unix','join','root','server','files','tmp','attachments','CmContact','lastName','Attachment','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','%s\x20#%d','Openchannel','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','Public','Private','Messages','existsSync','pipe','createWriteStream','basename'];(function(_0x4cef68,_0x56e87f){var _0x28f79d=function(_0x4a7f07){while(--_0x4a7f07){_0x4cef68['push'](_0x4cef68['shift']());}};_0x28f79d(++_0x56e87f);}(_0xb770,0x1e2));var _0x0b77=function(_0x86adab,_0x54554e){_0x86adab=_0x86adab-0x0;var _0x28fb45=_0xb770[_0x86adab];return _0x28fb45;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0b77('0x0'));var rimraf=require(_0x0b77('0x1'));var zipdir=require(_0x0b77('0x2'));var jsonpatch=require(_0x0b77('0x3'));var rp=require(_0x0b77('0x4'));var moment=require(_0x0b77('0x5'));var BPromise=require(_0x0b77('0x6'));var Mustache=require(_0x0b77('0x7'));var util=require(_0x0b77('0x8'));var path=require(_0x0b77('0x9'));var sox=require(_0x0b77('0xa'));var csv=require(_0x0b77('0xb'));var ejs=require(_0x0b77('0xc'));var fs=require('fs');var _=require(_0x0b77('0xd'));var squel=require(_0x0b77('0xe'));var crypto=require('crypto');var jsforce=require(_0x0b77('0xf'));var deskjs=require(_0x0b77('0x10'));var toCsv=require(_0x0b77('0xb'));var querystring=require(_0x0b77('0x11'));var Papa=require(_0x0b77('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0b77('0x13'));var as=require(_0x0b77('0x14'));var hardwareService=require(_0x0b77('0x15'));var logger=require(_0x0b77('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x0b77('0x17'));var db=require('../../mysqldb')['db'];config[_0x0b77('0x18')]=_[_0x0b77('0x19')](config[_0x0b77('0x18')],{'host':_0x0b77('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0b77('0x18')]));require(_0x0b77('0x1b'))[_0x0b77('0x1c')](socket);function respondWithStatusCode(_0x228e03,_0x57012e){_0x57012e=_0x57012e||0xcc;return function(_0x55c6a5){if(_0x55c6a5){return _0x228e03['sendStatus'](_0x57012e);}return _0x228e03[_0x0b77('0x1d')](_0x57012e)['end']();};}function respondWithResult(_0x19242b,_0x319b04){_0x319b04=_0x319b04||0xc8;return function(_0x29699b){if(_0x29699b){return _0x19242b['status'](_0x319b04)[_0x0b77('0x1e')](_0x29699b);}};}function respondWithFilteredResult(_0x2e7b6a,_0x3807cc){return function(_0x2a920b){if(_0x2a920b){var _0xec6733=_0x2a920b['count'],_0x54f177=_0x3807cc['offset'],_0x17e1e0=_0x3807cc[_0x0b77('0x1f')]+_0x3807cc[_0x0b77('0x20')],_0x1fbda8;if(_0x17e1e0>=_0xec6733){_0x17e1e0=_0xec6733;_0x1fbda8=0xc8;}else{_0x1fbda8=0xce;}_0x2e7b6a[_0x0b77('0x1d')](_0x1fbda8);return _0x2e7b6a[_0x0b77('0x21')](_0x0b77('0x22'),_0x54f177+'-'+_0x17e1e0+'/'+_0xec6733)['json'](_0x2a920b);}return null;};}function patchUpdates(_0x9384fb){return function(_0x5030bd){try{jsonpatch[_0x0b77('0x23')](_0x5030bd,_0x9384fb,!![]);}catch(_0x5abdc7){return BPromise[_0x0b77('0x24')](_0x5abdc7);}return _0x5030bd[_0x0b77('0x25')]();};}function saveUpdates(_0x3430ee,_0xccf557){return function(_0x3f02f7){if(_0x3f02f7){return _0x3f02f7[_0x0b77('0x26')](_0x3430ee)[_0x0b77('0x27')](function(_0x177f94){return _0x177f94;});}return null;};}function removeEntity(_0x4664bb,_0x218b68){return function(_0x19620f){if(_0x19620f){return _0x19620f['destroy']()[_0x0b77('0x27')](function(){_0x4664bb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d1450,_0x2f9084){return function(_0xeca5d7){if(!_0xeca5d7){_0x5d1450[_0x0b77('0x28')](0x194);}return _0xeca5d7;};}function handleError(_0x1c326d,_0x7f5234){_0x7f5234=_0x7f5234||0x1f4;return function(_0x2ec8d7){logger['error'](_0x2ec8d7[_0x0b77('0x29')]);if(_0x2ec8d7[_0x0b77('0x2a')]){delete _0x2ec8d7[_0x0b77('0x2a')];}_0x1c326d['status'](_0x7f5234)[_0x0b77('0x2b')](_0x2ec8d7);};}function getInteractionUsers(_0x31ae45,_0x578aaa){return new BPromise(function(_0x4d08a1,_0x58215d){try{if(_0x578aaa[_0x31ae45['id']]){_0x31ae45[_0x0b77('0x2c')]=_[_0x0b77('0x2d')](_0x578aaa[_0x31ae45['id']],function(_0x5e855d){return{'id':_0x5e855d['id'],'fullname':_0x5e855d[_0x0b77('0x2e')]};});}}catch(_0x1e7192){_0x58215d(_0x1e7192);}_0x4d08a1(_0x31ae45);});}function getInteractionTags(_0x10eddd,_0x29a49c){return new BPromise(function(_0x1bcb5a,_0x5ac7c7){try{if(_0x10eddd[_0x0b77('0x2f')]){_0x10eddd[_0x0b77('0x30')]=[];_0x10eddd['TagIds'][_0x0b77('0x31')](',')['forEach'](function(_0x39f7d7){_0x10eddd[_0x0b77('0x30')][_0x0b77('0x32')](_0x29a49c[_0x39f7d7]);});}delete _0x10eddd['TagIds'];}catch(_0x3676b0){_0x5ac7c7(_0x3676b0);}_0x1bcb5a(_0x10eddd);});}function updateOpenchannelInteraction(_0x168f0d,_0x3280bd,_0x422014){return new BPromise(function(_0x1a9f63,_0x387d6e){return getInteractionUsers(_0x168f0d,_0x422014)[_0x0b77('0x27')](function(_0x3b3da2){return getInteractionTags(_0x3b3da2,_0x3280bd);})['then'](function(_0x20e651){_0x1a9f63(_0x20e651);})[_0x0b77('0x33')](function(_0x3fcb3d){_0x387d6e(_0x3fcb3d);});});}exports['index']=function(_0x2933b4,_0x308917){var _0x54988f={},_0xc07407={},_0x18f2a3={'count':0x0,'rows':[]};var _0xc20de6=_[_0x0b77('0x2d')](db[_0x0b77('0x34')][_0x0b77('0x35')],function(_0x3374cf){return{'name':_0x3374cf['fieldName'],'type':_0x3374cf['type'][_0x0b77('0x36')]};});_0xc07407[_0x0b77('0x37')]=_[_0x0b77('0x2d')](_0xc20de6,_0x0b77('0x2a'));_0xc07407[_0x0b77('0x38')]=_[_0x0b77('0x39')](_0x2933b4['query']);_0xc07407['filters']=_['intersection'](_0xc07407['model'],_0xc07407['query']);_0x54988f[_0x0b77('0x3a')]=_['intersection'](_0xc07407['model'],qs[_0x0b77('0x3b')](_0x2933b4[_0x0b77('0x38')]['fields']));_0x54988f[_0x0b77('0x3a')]=_0x54988f['attributes'][_0x0b77('0x3c')]?_0x54988f[_0x0b77('0x3a')]:_0xc07407[_0x0b77('0x37')];if(!_0x2933b4[_0x0b77('0x38')][_0x0b77('0x3d')](_0x0b77('0x3e'))){_0x54988f['limit']=qs[_0x0b77('0x20')](_0x2933b4['query'][_0x0b77('0x20')]);_0x54988f[_0x0b77('0x1f')]=qs['offset'](_0x2933b4[_0x0b77('0x38')]['offset']);}_0x54988f[_0x0b77('0x3f')]=qs[_0x0b77('0x40')](_0x2933b4['query']['sort']);_0x54988f[_0x0b77('0x41')]=qs['filters'](_[_0x0b77('0x42')](_0x2933b4[_0x0b77('0x38')],_0xc07407[_0x0b77('0x43')]));var _0x4b78e4=[];var _0x44948d=squel[_0x0b77('0x44')]()[_0x0b77('0x45')]('id')[_0x0b77('0x45')](_0x0b77('0x2a'))[_0x0b77('0x45')](_0x0b77('0x46'))[_0x0b77('0x47')](_0x0b77('0x48'));var _0x2e4664=squel[_0x0b77('0x44')]()['field'](_0x0b77('0x49'))[_0x0b77('0x45')](_0x0b77('0x4a'))[_0x0b77('0x45')](_0x0b77('0x4b'))['from'](_0x0b77('0x4c'),'ui')[_0x0b77('0x4d')](_0x0b77('0x4e'),'u',_0x0b77('0x4f'));var _0x4f4dce=squel[_0x0b77('0x44')]()[_0x0b77('0x47')](_0x0b77('0x50'),'i')[_0x0b77('0x4d')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x0b77('0x4d')](_0x0b77('0x4e'),'o',_0x0b77('0x51'))[_0x0b77('0x4d')](_0x0b77('0x52'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0x0b77('0x4d')](_0x0b77('0x53'),'me',_0x0b77('0x54'))[_0x0b77('0x4d')](_0x0b77('0x55'),'it','it.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0x0b77('0x48'),'t',_0x0b77('0x56'));var _0x3df436=squel['expr']();var _0x45e3f5=[];var _0x599e9d=squel[_0x0b77('0x57')]();var _0x5bfe8c;if(_0x2933b4[_0x0b77('0x38')][_0x0b77('0x58')]){_0x5bfe8c=as['parseSearch'](_0x2933b4[_0x0b77('0x38')][_0x0b77('0x58')]);var _0x1f1b85=_0x5bfe8c[_0x0b77('0x59')];for(var _0x2b57fa=0x0;_0x2b57fa<_0x5bfe8c[_0x0b77('0x5a')][_0x0b77('0x3c')];_0x2b57fa++){var _0x239680=_0x5bfe8c[_0x0b77('0x5a')][_0x2b57fa];var _0x4cc927='i';var _0xd848a8=_[_0x0b77('0x5b')](_0xc20de6,[_0x0b77('0x2a'),_0x239680[_0x0b77('0x45')]]);if(!_0xd848a8){switch(_0x239680['field']){case _0x0b77('0x5c'):if(_0x239680[_0x0b77('0x5d')]==0x1){_0x4f4dce[_0x0b77('0x5e')]('`'+_0x239680[_0x0b77('0x45')]+_0x0b77('0x5f'));}else{_0x4f4dce[_0x0b77('0x5e')]('`'+_0x239680[_0x0b77('0x45')]+'`\x20>\x200');}break;case _0x0b77('0x60'):if(_0x239680[_0x0b77('0x61')]===_0x0b77('0x62')){if(_0x239680['value'][_0x0b77('0x31')]('\x20')['length']>0x1){_0x3df436[_0x1f1b85](_0x0b77('0x63'),qs['getFullTextValue'](_0x239680['value']),null);}else{var _0x55b946='%'+_0x239680[_0x0b77('0x5d')]+'%';_0x3df436[_0x1f1b85](_0x0b77('0x64'),_0x55b946,_0x55b946,_0x55b946);}}else{_0xd848a8=_[_0x0b77('0x5b')](_0xc20de6,['name',_0x0b77('0x65')]);_0x239680[_0x0b77('0x45')]=_0x0b77('0x65');_0xae02e=as['buildExpression'](_0x4cc927,_0xd848a8['type'],_0x239680);_0x3df436[_0x1f1b85](_0xae02e[_0x0b77('0x66')],_0xae02e[_0x0b77('0x5d')][_0x0b77('0x67')],_0xae02e[_0x0b77('0x5d')][_0x0b77('0x68')]);}break;case'Tag':var _0x30ecb2=_0x239680['value'][_0x0b77('0x31')](',')[_0x0b77('0x2d')](function(_0x2f5061){return Number(_0x2f5061);});_0x30ecb2[_0x0b77('0x69')](function(_0x4e3057){_0x599e9d['or'](_0x0b77('0x6a'),'%,'+_0x4e3057+',%');});_0x45e3f5=_[_0x0b77('0x6b')](_0x45e3f5,_0x30ecb2);break;case _0x0b77('0x6c'):if(_0x239680[_0x0b77('0x61')]===_0x0b77('0x62')){_0x3df436[_0x1f1b85]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x239680['value']+'%',null);}else{_0xd848a8=_['find'](_0xc20de6,[_0x0b77('0x2a'),'UserId']);_0x239680[_0x0b77('0x45')]=_0x0b77('0x6d');_0xae02e=as[_0x0b77('0x6e')](_0x4cc927,_0xd848a8['type'],_0x239680);_0x3df436[_0x1f1b85](_0xae02e['text'],_0xae02e['value'][_0x0b77('0x67')],_0xae02e['value'][_0x0b77('0x68')]);}break;case _0x0b77('0x6f'):_0xae02e=as[_0x0b77('0x6e')]('me',null,_0x239680);_0x3df436[_0x1f1b85](_0xae02e['text'],_0xae02e[_0x0b77('0x5d')]['start'],_0xae02e['value']['end']);break;}}else{var _0xae02e=as[_0x0b77('0x6e')](_0x4cc927,_0xd848a8[_0x0b77('0x70')],_0x239680);_0x3df436[_0x1f1b85](_0xae02e[_0x0b77('0x66')],_0xae02e['value']['start'],_0xae02e[_0x0b77('0x5d')]['end']);}}}else{var _0x521bb4=_(_0x2933b4['query'])[_0x0b77('0x39')]()[_0x0b77('0x2d')](function(_0x35ea79){return _[_0x0b77('0x71')](_0xc20de6,[_0x0b77('0x2a'),_0x35ea79])?_0x35ea79:undefined;})[_0x0b77('0x72')]()[_0x0b77('0x5d')]();if(!_[_0x0b77('0x73')](_0x521bb4)){_0x521bb4[_0x0b77('0x69')](function(_0x449bef){if(_0x449bef==='OpenchannelAccountId'){_0x4f4dce[_0x0b77('0x41')](_0x0b77('0x74'),[]['concat'](_0x2933b4[_0x0b77('0x38')][_0x449bef]));}else if(_0x449bef===_0x0b77('0x75')){var _0xde5eb2=JSON[_0x0b77('0x76')](_0x2933b4[_0x0b77('0x38')][_0x449bef])['$gte'];var _0x188704=JSON[_0x0b77('0x76')](_0x2933b4[_0x0b77('0x38')][_0x449bef])[_0x0b77('0x77')];_0x4f4dce[_0x0b77('0x41')](_0x0b77('0x78'),_0xde5eb2,_0x188704);}else{if(_0x2933b4[_0x0b77('0x38')][_0x449bef]===_0x0b77('0x79')){_0x4f4dce[_0x0b77('0x41')]('i.'+_0x449bef+_0x0b77('0x7a'));}else{_0x4f4dce[_0x0b77('0x41')]('i.'+_0x449bef+_0x0b77('0x7b'),_0x2933b4[_0x0b77('0x38')][_0x449bef]);}}});}if(_0x2933b4['query'][_0x0b77('0x7c')]){if(_0x2933b4[_0x0b77('0x38')][_0x0b77('0x7c')]==0x1){_0x4f4dce[_0x0b77('0x5e')](_0x0b77('0x7d'));}else{_0x4f4dce['having'](_0x0b77('0x7e'));}}if(_0x2933b4[_0x0b77('0x38')][_0x0b77('0x7f')]){_0x45e3f5=_['isArray'](_0x2933b4['query'][_0x0b77('0x7f')])?_0x2933b4['query']['tag']:new Array(_0x2933b4['query'][_0x0b77('0x7f')]);_0x45e3f5[_0x0b77('0x69')](function(_0x22938e){_0x599e9d['or'](_0x0b77('0x6a'),'%,'+_0x22938e+',%');});}if(_0x2933b4[_0x0b77('0x38')][_0x0b77('0x80')]){var _0x173c20=_0x2933b4[_0x0b77('0x38')]['filter'][_0x0b77('0x81')]('\x5c','\x5c\x5c')[_0x0b77('0x81')]('\x27\x27',_0x0b77('0x82'));if(qs[_0x0b77('0x83')](_0x173c20)){_0x3df436['or']('i.id\x20LIKE\x20?',_0x173c20+'%');}else{_0x3df436['or'](_0x0b77('0x84'),qs['getFullTextValue'](_0x173c20))['or']('i.from\x20LIKE\x20?',_0x173c20+'%')['or'](_0x0b77('0x85'),_0x173c20+'%');}}}_0x4f4dce[_0x0b77('0x41')](_0x3df436);_0x4f4dce[_0x0b77('0x86')]('i.id');var _0x504b36={'type':db[_0x0b77('0x87')][_0x0b77('0x88')][_0x0b77('0x89')],'raw':!![]};var _0x16ef3c=_0x4f4dce[_0x0b77('0x8a')]();_0x16ef3c[_0x0b77('0x45')]('i.id');_0x16ef3c['field'](_0x0b77('0x8b'),_0x0b77('0x5c'));if(_0x54988f[_0x0b77('0x3f')]){_0x54988f[_0x0b77('0x3f')][_0x0b77('0x69')](function(_0x322c42){_0x4f4dce[_0x0b77('0x3f')]('i.'+_0x322c42[0x0],_0x322c42[0x1]===_0x0b77('0x8c')?![]:!![]);});}if(!_[_0x0b77('0x73')](_0x45e3f5)){_0x4f4dce[_0x0b77('0x5e')](_0x599e9d);_0x16ef3c[_0x0b77('0x41')](_0x0b77('0x8d'),_0x45e3f5);}BPromise[_0x0b77('0x8e')]()[_0x0b77('0x27')](function(){if(!_0x5bfe8c){if(_0x2933b4[_0x0b77('0x38')]['OpenchannelAccountId']||_0x2933b4['query']['journey'])return;_0x16ef3c[_0x0b77('0x41')](_0x0b77('0x8f'));_0x4f4dce[_0x0b77('0x41')](_0x0b77('0x8f'));return;}return _0x2933b4[_0x0b77('0x90')][_0x0b77('0x91')]({'attributes':['id'],'raw':!![]})['then'](function(_0x54520f){if(_[_0x0b77('0x73')](_0x54520f)){_0x16ef3c[_0x0b77('0x41')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x4f4dce[_0x0b77('0x41')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x16ef3c[_0x0b77('0x41')](_0x0b77('0x74'),_['map'](_0x54520f,'id'));_0x4f4dce[_0x0b77('0x41')](_0x0b77('0x74'),_[_0x0b77('0x2d')](_0x54520f,'id'));}});})['then'](function(){db[_0x0b77('0x92')]['query'](_0x16ef3c['toString'](),_0x504b36)[_0x0b77('0x27')](function(_0xb51617){_0x18f2a3[_0x0b77('0x93')]=_0xb51617[_0x0b77('0x3c')];if(_0x18f2a3[_0x0b77('0x93')]===0x0)return[];return db[_0x0b77('0x92')][_0x0b77('0x38')](_0x44948d[_0x0b77('0x94')](),_0x504b36)['then'](function(_0x3281e6){_0x4b78e4=_[_0x0b77('0x95')](_0x3281e6,'id');_0x504b36=_[_0x0b77('0x96')](_0x504b36,{'model':db[_0x0b77('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2933b4['query'][_0x0b77('0x3b')]){_0x54988f[_0x0b77('0x3a')]['forEach'](function(_0x5dde25){_0x4f4dce['field']('i.'+_0x5dde25);});}else{_0x4f4dce['field'](_0x0b77('0x8b'),'unreadMessages');_0x4f4dce[_0x0b77('0x45')](_0x0b77('0x97'),'Account.key');_0x4f4dce['field'](_0x0b77('0x98'),_0x0b77('0x99'));_0x4f4dce['field']('i.*');_0x4f4dce[_0x0b77('0x45')]('c.firstName','Contact.firstName');_0x4f4dce[_0x0b77('0x45')](_0x0b77('0x9a'),_0x0b77('0x9b'));_0x4f4dce[_0x0b77('0x45')](_0x0b77('0x9c'),'Contact.email');_0x4f4dce[_0x0b77('0x45')]('c.phone','Contact.phone');_0x4f4dce[_0x0b77('0x45')](_0x0b77('0x9d'),_0x0b77('0x9e'));_0x4f4dce[_0x0b77('0x45')]('c.fax',_0x0b77('0x9f'));_0x4f4dce[_0x0b77('0x45')]('o.fullname',_0x0b77('0xa0'));_0x4f4dce[_0x0b77('0x45')](_0x0b77('0xa1'),_0x0b77('0xa2'));_0x4f4dce['field'](_0x0b77('0xa3'),'TagIds');}_0x4f4dce[_0x0b77('0x20')](_0x54988f[_0x0b77('0x20')]);_0x4f4dce['offset'](_0x54988f[_0x0b77('0x1f')]);return db['sequelize'][_0x0b77('0x38')](_0x4f4dce[_0x0b77('0x94')](),_0x504b36);})[_0x0b77('0x27')](function(_0x44ae55){_0x2e4664[_0x0b77('0x41')](_0x0b77('0xa4'),_[_0x0b77('0x2d')](_0x44ae55,'id'));return db['sequelize'][_0x0b77('0x38')](_0x2e4664[_0x0b77('0x94')](),_0x504b36)[_0x0b77('0x27')](function(_0x1ea98a){var _0x2d79ad=_[_0x0b77('0xa5')](_0x1ea98a,_0x0b77('0xa6'));var _0x13eb19=[];_0x44ae55['forEach'](function(_0x2afed7){_0x13eb19[_0x0b77('0x32')](updateOpenchannelInteraction(_0x2afed7,_0x4b78e4,_0x2d79ad));});return BPromise[_0x0b77('0xa7')](_0x13eb19);});});})[_0x0b77('0x27')](function(_0x21350a){_0x18f2a3['rows']=_0x21350a;return _0x18f2a3;})[_0x0b77('0x27')](respondWithFilteredResult(_0x308917,_0x54988f));})[_0x0b77('0x33')](handleError(_0x308917,null));};exports['show']=function(_0x2e6b29,_0x25519f){var _0x182e6c={'raw':![],'where':{'id':_0x2e6b29[_0x0b77('0xa8')]['id']}},_0x64e439={};_0x64e439[_0x0b77('0x37')]=_['keys'](db['OpenchannelInteraction'][_0x0b77('0x35')]);_0x64e439[_0x0b77('0x38')]=_[_0x0b77('0x39')](_0x2e6b29[_0x0b77('0x38')]);_0x64e439['filters']=_[_0x0b77('0xa9')](_0x64e439[_0x0b77('0x37')],_0x64e439[_0x0b77('0x38')]);_0x182e6c['attributes']=_[_0x0b77('0xa9')](_0x64e439[_0x0b77('0x37')],qs[_0x0b77('0x3b')](_0x2e6b29['query'][_0x0b77('0x3b')]));_0x182e6c['attributes']=_0x182e6c[_0x0b77('0x3a')][_0x0b77('0x3c')]?_0x182e6c['attributes']:_0x64e439[_0x0b77('0x37')];if(_0x2e6b29[_0x0b77('0x38')]['includeAll']){_0x182e6c['include']=[{'all':!![]}];}_0x182e6c=_[_0x0b77('0x96')]({},_0x182e6c,_0x2e6b29['options']);return db[_0x0b77('0x34')][_0x0b77('0x5b')](_0x182e6c)[_0x0b77('0x27')](handleEntityNotFound(_0x25519f,null))[_0x0b77('0x27')](respondWithResult(_0x25519f,null))[_0x0b77('0x33')](handleError(_0x25519f,null));};exports[_0x0b77('0xaa')]=function(_0x51febe,_0x5b4732){return db['OpenchannelInteraction']['create'](_0x51febe[_0x0b77('0x6f')],{})['then'](respondWithResult(_0x5b4732,0xc9))[_0x0b77('0x33')](handleError(_0x5b4732,null));};exports[_0x0b77('0x26')]=function(_0x594e7a,_0xdb6974){if(_0x594e7a[_0x0b77('0x6f')]['id']){delete _0x594e7a[_0x0b77('0x6f')]['id'];}return db[_0x0b77('0x34')][_0x0b77('0x5b')]({'where':{'id':_0x594e7a['params']['id']}})[_0x0b77('0x27')](handleEntityNotFound(_0xdb6974,null))[_0x0b77('0x27')](saveUpdates(_0x594e7a[_0x0b77('0x6f')],null))[_0x0b77('0x27')](respondWithResult(_0xdb6974,null))['catch'](handleError(_0xdb6974,null));};exports[_0x0b77('0xab')]=function(_0xc87fd9,_0x468c33){return db[_0x0b77('0x34')]['find']({'where':{'id':_0xc87fd9[_0x0b77('0xa8')]['id']}})[_0x0b77('0x27')](handleEntityNotFound(_0x468c33,null))[_0x0b77('0x27')](removeEntity(_0x468c33,null))[_0x0b77('0x33')](handleError(_0x468c33,null));};exports[_0x0b77('0xac')]=function(_0x5054df,_0x511291){return db['OpenchannelInteraction'][_0x0b77('0xac')]()[_0x0b77('0x27')](respondWithResult(_0x511291,null))['catch'](handleError(_0x511291,null));};exports[_0x0b77('0xad')]=function(_0x2b82ea,_0x868ee4,_0x3cd5b6){return db[_0x0b77('0xae')]['find']({'where':{'id':_0x2b82ea['params']['id']}})[_0x0b77('0x27')](handleEntityNotFound(_0x868ee4,null))['then'](function(_0x4cdf7d){if(_0x4cdf7d){return _0x4cdf7d[_0x0b77('0xad')](_0x2b82ea[_0x0b77('0x6f')][_0x0b77('0xaf')],_[_0x0b77('0xb0')](_0x2b82ea['body'],[_0x0b77('0xaf'),'id'])||{});}})['then'](respondWithResult(_0x868ee4,null))[_0x0b77('0x33')](handleError(_0x868ee4,null));};exports[_0x0b77('0xb1')]=function(_0x40443c,_0x4ce138,_0x3a2a08){var _0x24c15c={'raw':![],'where':{}};var _0x3ac499={};var _0x56f2d6={'count':0x0,'rows':[]};return db[_0x0b77('0x34')]['findOne']({'where':{'id':_0x40443c[_0x0b77('0xa8')]['id']}})[_0x0b77('0x27')](handleEntityNotFound(_0x4ce138,null))[_0x0b77('0x27')](function(_0x57b821){if(_0x57b821){_0x3ac499[_0x0b77('0x37')]=_[_0x0b77('0x39')](db['OpenchannelMessage'][_0x0b77('0x35')]);_0x3ac499[_0x0b77('0x38')]=_['keys'](_0x40443c['query']);_0x3ac499[_0x0b77('0x43')]=_[_0x0b77('0xa9')](_0x3ac499[_0x0b77('0x37')],_0x3ac499['query']);_0x24c15c[_0x0b77('0x3a')]=_[_0x0b77('0xa9')](_0x3ac499[_0x0b77('0x37')],qs[_0x0b77('0x3b')](_0x40443c[_0x0b77('0x38')][_0x0b77('0x3b')]));_0x24c15c[_0x0b77('0x3a')]=_0x24c15c[_0x0b77('0x3a')][_0x0b77('0x3c')]?_0x24c15c[_0x0b77('0x3a')]:_0x3ac499[_0x0b77('0x37')];if(!_0x40443c['query'][_0x0b77('0x3d')]('nolimit')){_0x24c15c[_0x0b77('0x20')]=qs['limit'](_0x40443c[_0x0b77('0x38')][_0x0b77('0x20')]);_0x24c15c[_0x0b77('0x1f')]=qs[_0x0b77('0x1f')](_0x40443c['query']['offset']);}_0x24c15c[_0x0b77('0x3f')]=qs['sort'](_0x40443c[_0x0b77('0x38')]['sort']);_0x24c15c[_0x0b77('0x41')]=qs[_0x0b77('0x43')](_[_0x0b77('0x42')](_0x40443c[_0x0b77('0x38')],_0x3ac499[_0x0b77('0x43')]));_0x24c15c[_0x0b77('0x41')][_0x0b77('0xa6')]=_0x57b821['id'];if(_0x40443c[_0x0b77('0x38')][_0x0b77('0x80')]){_0x24c15c[_0x0b77('0x41')]=_[_0x0b77('0x96')](_0x24c15c[_0x0b77('0x41')],{'$or':_['map'](_0x24c15c[_0x0b77('0x3a')],function(_0x146a37){var _0x97cd47={};_0x97cd47[_0x146a37]={'$like':'%'+_0x40443c[_0x0b77('0x38')]['filter']+'%'};return _0x97cd47;})});}if(_0x40443c[_0x0b77('0x38')][_0x0b77('0xb2')]){var _0x1d9810=_0x40443c[_0x0b77('0x38')][_0x0b77('0xb2')]['split'](',');var _0x4ec9bb={};_0x4ec9bb[_0x1d9810[0x0]]={'$gte':moment(_0x1d9810[0x1])[_0x0b77('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x24c15c[_0x0b77('0x41')]=_[_0x0b77('0x96')](_0x24c15c[_0x0b77('0x41')],_0x4ec9bb);}_0x24c15c=_[_0x0b77('0x96')]({},_0x24c15c,_0x40443c['options']);return db[_0x0b77('0xae')]['count']({'where':_0x24c15c[_0x0b77('0x41')]})[_0x0b77('0x27')](function(_0x45cee){_0x56f2d6['count']=_0x45cee;if(_0x40443c['query'][_0x0b77('0xb4')]){_0x24c15c['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x0b77('0xb5')](_0x24c15c);})[_0x0b77('0x27')](function(_0x5eceed){_0x56f2d6[_0x0b77('0xb6')]=_0x5eceed;return _0x56f2d6;});}})[_0x0b77('0x27')](respondWithFilteredResult(_0x4ce138,_0x24c15c))['catch'](handleError(_0x4ce138,null));};exports[_0x0b77('0xb7')]=function(_0x2e8797,_0x1f139c,_0x30bb98){return db['OpenchannelInteraction'][_0x0b77('0x5b')]({'where':{'id':_0x2e8797[_0x0b77('0xa8')]['id']}})[_0x0b77('0x27')](handleEntityNotFound(_0x1f139c,null))[_0x0b77('0x27')](function(_0x3e2667){if(_0x3e2667){return _0x3e2667[_0x0b77('0xb8')](_0x2e8797[_0x0b77('0x6f')][_0x0b77('0xaf')],_[_0x0b77('0xb0')](_0x2e8797[_0x0b77('0x6f')],[_0x0b77('0xaf'),'id'])||{})[_0x0b77('0xb9')](function(){return db[_0x0b77('0xba')]['findAll']({'attributes':['id',_0x0b77('0x2a'),_0x0b77('0x46')],'where':{'id':_0x2e8797[_0x0b77('0x6f')]['ids']}});})[_0x0b77('0x27')](function(_0x3eadda){socket[_0x0b77('0xbb')](_0x0b77('0xbc'),{'id':Number(_0x2e8797[_0x0b77('0xa8')]['id']),'tags':_0x3eadda||[]});return{'id':Number(_0x2e8797[_0x0b77('0xa8')]['id']),'tags':_0x3eadda||[]};});}})[_0x0b77('0x27')](respondWithResult(_0x1f139c,null))[_0x0b77('0x33')](handleError(_0x1f139c,null));};exports['removeTags']=function(_0x47d6e4,_0x867d46,_0x5cfa08){return db[_0x0b77('0x34')][_0x0b77('0x5b')]({'where':{'id':_0x47d6e4[_0x0b77('0xa8')]['id']}})[_0x0b77('0x27')](handleEntityNotFound(_0x867d46,null))['then'](function(_0x3081cf){if(_0x3081cf){return _0x3081cf['removeTags'](_0x47d6e4[_0x0b77('0x38')]['ids']);}})[_0x0b77('0x27')](respondWithStatusCode(_0x867d46,null))[_0x0b77('0x33')](handleError(_0x867d46,null));};exports[_0x0b77('0xbd')]=function(_0x5ea3d0,_0x16cd70){var _0x1424b7=moment()[_0x0b77('0xbe')]()[_0x0b77('0x94')]();var _0x352016=path[_0x0b77('0xbf')](config[_0x0b77('0xc0')],_0x0b77('0xc1'),_0x0b77('0xc2'),_0x0b77('0xc3'));var _0x39684e=path[_0x0b77('0xbf')](config[_0x0b77('0xc0')],_0x0b77('0xc1'),'files',_0x0b77('0xc4'));var _0x3eb4e9=path[_0x0b77('0xbf')](_0x352016,_0x1424b7);var _0xbbae1=util[_0x0b77('0xb3')]('transcript-%d-%s.zip',_0x5ea3d0['params']['id'],_0x1424b7);var _0x1048a8=path[_0x0b77('0xbf')](_0x352016,_0xbbae1);var _0x2561f3=[];_0x2561f3[_0x0b77('0x32')]({'model':db['User'],'as':_0x0b77('0x6c'),'attributes':['id',_0x0b77('0x2e')],'raw':!![]});_0x2561f3[_0x0b77('0x32')]({'model':db[_0x0b77('0xc5')],'as':_0x0b77('0x60'),'attributes':['id','firstName',_0x0b77('0xc6')],'raw':!![]});if(_0x5ea3d0['query'][_0x0b77('0xc4')]){_0x2561f3['push']({'model':db[_0x0b77('0xc7')],'as':_0x0b77('0xc7'),'raw':!![]});}var _0x57aa7b=[{'model':db[_0x0b77('0xae')],'as':'Messages','attributes':['id',_0x0b77('0x6f'),_0x0b77('0x75'),_0x0b77('0xc8'),_0x0b77('0xc9'),_0x0b77('0x7c')],'include':_0x2561f3}];_0x57aa7b[_0x0b77('0x32')]({'model':db[_0x0b77('0xca')],'as':_0x0b77('0xcb'),'attributes':['id',_0x0b77('0x2a')]});_0x57aa7b['push']({'model':db[_0x0b77('0x6c')],'as':_0x0b77('0xcc'),'attributes':['id',_0x0b77('0x2e')]});return db[_0x0b77('0x34')][_0x0b77('0x5b')]({'where':{'id':_0x5ea3d0[_0x0b77('0xa8')]['id']},'include':_0x57aa7b})[_0x0b77('0x27')](handleEntityNotFound(_0x16cd70,null))[_0x0b77('0x27')](function(_0x13a827){if(_0x13a827){var _0x1ff942=_0x13a827[_0x0b77('0xcd')]({'plain':!![]});fs[_0x0b77('0xce')](_0x3eb4e9);var _0x461a67={'format':'A4','border':_0x0b77('0xcf'),'header':{'height':_0x0b77('0xd0'),'contents':{'first':_0x0b77('0xd1')}},'footer':{'height':_0x0b77('0xd2'),'contents':{'default':util[_0x0b77('0xb3')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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[_0x0b77('0xb3')](_0x0b77('0xd3'),_0x0b77('0xd4'),_0x1ff942['id']),moment()[_0x0b77('0xb3')](_0x0b77('0xd5'))[_0x0b77('0x94')]())}}};var _0x47c843={'channel':_0x0b77('0xd4'),'account':_0x1ff942['Account'][_0x0b77('0x2a')],'agent':_0x1ff942[_0x0b77('0xcc')]?_0x1ff942[_0x0b77('0xcc')]['fullname']:_0x0b77('0xd6'),'createdAt':moment(_0x1ff942['createdAt'])[_0x0b77('0xb3')](_0x0b77('0xd7'))[_0x0b77('0x94')](),'closedAt':_0x1ff942[_0x0b77('0xd8')]?moment(_0x1ff942[_0x0b77('0xd9')])[_0x0b77('0xb3')](_0x0b77('0xd7'))[_0x0b77('0x94')]():'','disposition':_0x1ff942[_0x0b77('0xda')],'visibility':_0x1ff942['threadId']?_0x0b77('0xdb'):_0x0b77('0xdc'),'messages':_(_0x1ff942[_0x0b77('0xdd')])[_0x0b77('0x80')]({'secret':![]})['map'](function(_0x5ed388){if(_0x5ed388[_0x0b77('0xc7')]){var _0x4e87a7=path[_0x0b77('0xbf')](_0x39684e,_0x5ed388['Attachment']['basename']);if(fs[_0x0b77('0xde')](_0x4e87a7)){fs['createReadStream'](_0x4e87a7)[_0x0b77('0xdf')](fs[_0x0b77('0xe0')](path['join'](_0x3eb4e9,_0x5ed388['Attachment'][_0x0b77('0xe1')])));}}return{'date':moment(_0x5ed388[_0x0b77('0x75')])['format'](_0x0b77('0xd7'))[_0x0b77('0x94')](),'sender':_0x5ed388[_0x0b77('0xc8')]===_0x0b77('0xe2')?_0x5ed388[_0x0b77('0x6c')]?_0x5ed388['User'][_0x0b77('0x2e')]:_0x0b77('0xe3'):_0x5ed388[_0x0b77('0x60')][_0x0b77('0xe4')]+(_0x5ed388[_0x0b77('0x60')][_0x0b77('0xc6')]?'\x20'+_0x5ed388[_0x0b77('0x60')][_0x0b77('0xc6')]:''),'body':_0x5ed388['Attachment']?_0x5ed388['Attachment'][_0x0b77('0xe1')]:_0x5ed388[_0x0b77('0x6f')],'direction':_0x5ed388['direction']===_0x0b77('0xe2')?'A':'C','secret':_0x5ed388[_0x0b77('0xc9')],'read':_0x5ed388['read'],'attachment':_0x5ed388[_0x0b77('0xc7')]};})[_0x0b77('0x5d')]()};return ejs[_0x0b77('0xe5')](path['join'](config[_0x0b77('0xc0')],_0x0b77('0xc1'),_0x0b77('0xe6'),_0x0b77('0xe7')),{'interaction':_0x47c843})[_0x0b77('0x27')](function(_0x3853b5){return new BPromise(function(_0x269c42,_0x47e2af){pdf[_0x0b77('0xaa')](_0x3853b5,_0x461a67)['toFile'](path[_0x0b77('0xbf')](_0x3eb4e9,_0x0b77('0xe8')+_0x1ff942['id']+'-'+_0x1424b7+_0x0b77('0xe9')),function(_0x207404,_0x2846e7){if(_0x207404)return _0x47e2af(_0x207404);_0x269c42(_0x2846e7);});});})[_0x0b77('0x27')](function(){return new BPromise(function(_0xa115f4,_0x535089){zipdir(_0x3eb4e9,{'saveTo':_0x1048a8},function(_0x1ccd7c,_0x2da1d3){if(_0x1ccd7c)return _0x535089(_0x1ccd7c);return _0xa115f4(_0x2da1d3);});})['then'](function(){return new BPromise(function(_0x3a47ca,_0x867279){rimraf(_0x3eb4e9,function(_0x5734c4){if(_0x5734c4)_0x867279(_0x5734c4);return _0x3a47ca();});});})[_0x0b77('0x27')](function(){return _0x16cd70[_0x0b77('0xbd')](_0x1048a8,_0xbbae1,function(_0x4dbf0b){if(_0x4dbf0b){console[_0x0b77('0xea')]('err',_0x4dbf0b);}else{fs[_0x0b77('0xeb')](_0x1048a8);}});});});}else{return _0x16cd70['sendStatus'](0xc8);}})[_0x0b77('0x33')](handleError(_0x16cd70,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index f205e02..ad99980 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 _0xcc37=['save','update','remove','getUsers','then','setDataValue','map','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xcc37,0x175));var _0x7cc3=function(_0x1567dc,_0x3728b2){_0x1567dc=_0x1567dc-0x0;var _0x547ca5=_0xcc37[_0x1567dc];return _0x547ca5;};'use strict';var EventEmitter=require(_0x7cc3('0x0'));var OpenchannelInteraction=require(_0x7cc3('0x1'))['db'][_0x7cc3('0x2')];var OpenchannelMessage=require(_0x7cc3('0x1'))['db'][_0x7cc3('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7cc3('0x4')](0x0);var events={'afterCreate':_0x7cc3('0x5'),'afterUpdate':_0x7cc3('0x6'),'afterDestroy':_0x7cc3('0x7')};function emitEvent(_0x44ca84){return function(_0x2647f7,_0x1ed642,_0x20b9f2){_0x2647f7[_0x7cc3('0x8')]({'attributes':['id'],'raw':!![]})[_0x7cc3('0x9')](function(_0xfff4b6){_0x2647f7[_0x7cc3('0xa')]('Users',_0xfff4b6[_0x7cc3('0xb')](function(_0x21a408){return{'id':_0x21a408['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x2647f7['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7cc3('0x9')](function(_0x5d916d){_0x2647f7[_0x7cc3('0xa')](_0x7cc3('0xc'),_0x5d916d[_0x7cc3('0xd')]);OpenchannelInteractionEvents['emit'](_0x44ca84+':'+_0x2647f7['id'],_0x2647f7);OpenchannelInteractionEvents[_0x7cc3('0xe')](_0x44ca84,_0x2647f7);_0x20b9f2(null);})[_0x7cc3('0xf')](_0x20b9f2(null));};}for(var e in events){if(events[_0x7cc3('0x10')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x7cc3('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x296e=['remove','getUsers','then','Users','map','findAll','setDataValue','emit','catch','hook','exports','events','OpenchannelInteraction','save','update'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x296e,0x1cd));var _0xe296=function(_0x36b1bc,_0x15a6a3){_0x36b1bc=_0x36b1bc-0x0;var _0x26a12f=_0x296e[_0x36b1bc];return _0x26a12f;};'use strict';var EventEmitter=require(_0xe296('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xe296('0x1')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe296('0x2'),'afterUpdate':_0xe296('0x3'),'afterDestroy':_0xe296('0x4')};function emitEvent(_0x53513e){return function(_0x5afc4e,_0x2d101c,_0x25d765){_0x5afc4e[_0xe296('0x5')]({'attributes':['id'],'raw':!![]})[_0xe296('0x6')](function(_0x26f563){_0x5afc4e['setDataValue'](_0xe296('0x7'),_0x26f563[_0xe296('0x8')](function(_0x4617a8){return{'id':_0x4617a8['id']};}));return OpenchannelMessage[_0xe296('0x9')]({'where':{'OpenchannelInteractionId':_0x5afc4e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x455054){_0x5afc4e[_0xe296('0xa')]('unreadMessages',_0x455054['length']);OpenchannelInteractionEvents[_0xe296('0xb')](_0x53513e+':'+_0x5afc4e['id'],_0x5afc4e);OpenchannelInteractionEvents['emit'](_0x53513e,_0x5afc4e);_0x25d765(null);})[_0xe296('0xc')](_0x25d765(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xe296('0xd')](e,emitEvent(event));}}module[_0xe296('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 0bc67ed..28571c4 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 _0x7217=['api','moment','bluebird','request-promise','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt','format','lodash','../../config/logger'];(function(_0x489d75,_0xc04d09){var _0x5e2ae9=function(_0x5ed7a3){while(--_0x5ed7a3){_0x489d75['push'](_0x489d75['shift']());}};_0x5e2ae9(++_0xc04d09);}(_0x7217,0x19e));var _0x7721=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x7217[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x225610,_0x2f99ed,_0x3e6368){if(_0x225610[_0x7721('0xc')](_0x7721('0xd'))){_0x225610[_0x7721('0xe')]=moment()[_0x7721('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3e6368(null,_0x225610);}}});}; \ No newline at end of file +var _0xf9d5=['OpenchannelInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','define'];(function(_0x32c08e,_0x3a1547){var _0x17e650=function(_0x219d6e){while(--_0x219d6e){_0x32c08e['push'](_0x32c08e['shift']());}};_0x17e650(++_0x3a1547);}(_0xf9d5,0x122));var _0x5f9d=function(_0x4bfabc,_0x237267){_0x4bfabc=_0x4bfabc-0x0;var _0x509d81=_0xf9d5[_0x4bfabc];return _0x509d81;};'use strict';var _=require('lodash');var util=require(_0x5f9d('0x0'));var logger=require(_0x5f9d('0x1'))('api');var moment=require(_0x5f9d('0x2'));var BPromise=require(_0x5f9d('0x3'));var rp=require(_0x5f9d('0x4'));var fs=require('fs');var path=require(_0x5f9d('0x5'));var rimraf=require(_0x5f9d('0x6'));var config=require(_0x5f9d('0x7'));var attributes=require(_0x5f9d('0x8'));module['exports']=function(_0x1fc74c,_0x59027b){return _0x1fc74c[_0x5f9d('0x9')](_0x5f9d('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3420b2,_0x23e865,_0x46e265){if(_0x3420b2[_0x5f9d('0xb')](_0x5f9d('0xc'))){_0x3420b2[_0x5f9d('0xd')]=moment()['format'](_0x5f9d('0xe'));}_0x46e265(null,_0x3420b2);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index b75712b..6b0bcaf 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 _0x4a24=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','limit','then','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','debug','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x20f355,_0x2d4d13){var _0x1e8879=function(_0x3c263d){while(--_0x3c263d){_0x20f355['push'](_0x20f355['shift']());}};_0x1e8879(++_0x2d4d13);}(_0x4a24,0xa9));var _0x44a2=function(_0x5de214,_0x107e9d){_0x5de214=_0x5de214-0x0;var _0x4df627=_0x4a24[_0x5de214];return _0x4df627;};'use strict';var _=require(_0x44a2('0x0'));var util=require(_0x44a2('0x1'));var moment=require(_0x44a2('0x2'));var BPromise=require(_0x44a2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x44a2('0x4'));var db=require(_0x44a2('0x5'))['db'];var utils=require(_0x44a2('0x6'));var logger=require(_0x44a2('0x7'))(_0x44a2('0x8'));var config=require(_0x44a2('0x9'));var jayson=require(_0x44a2('0xa'));var client=jayson[_0x44a2('0xb')][_0x44a2('0xc')]({'port':0x232a});config[_0x44a2('0xd')]=_['defaults'](config[_0x44a2('0xd')],{'host':_0x44a2('0xe'),'port':0x18eb});var socket=require(_0x44a2('0xf'))(new Redis(config[_0x44a2('0xd')]));require('./openchannelInteraction.socket')[_0x44a2('0x10')](socket);function respondWithRpcPromise(_0x193359,_0xba2f5d,_0x5e08fd){return new BPromise(function(_0x30ea96,_0x225aa4){return client[_0x44a2('0x11')](_0x193359,_0x5e08fd)['then'](function(_0xa01d14){logger['info'](_0x44a2('0x12'),_0xba2f5d,_0x44a2('0x13'));logger['debug'](_0x44a2('0x14'),_0xba2f5d,_0x44a2('0x13'),JSON['stringify'](_0xa01d14));if(_0xa01d14[_0x44a2('0x15')]){if(_0xa01d14[_0x44a2('0x15')][_0x44a2('0x16')]===0x1f4){logger['error'](_0x44a2('0x12'),_0xba2f5d,_0xa01d14[_0x44a2('0x15')][_0x44a2('0x17')]);return _0x225aa4(_0xa01d14[_0x44a2('0x15')][_0x44a2('0x17')]);}logger[_0x44a2('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0xba2f5d,_0xa01d14['error'][_0x44a2('0x17')]);return _0x30ea96(_0xa01d14['error'][_0x44a2('0x17')]);}else{logger[_0x44a2('0x18')](_0x44a2('0x12'),_0xba2f5d,_0x44a2('0x13'));_0x30ea96(_0xa01d14[_0x44a2('0x19')][_0x44a2('0x17')]);}})[_0x44a2('0x1a')](function(_0x269ebd){logger[_0x44a2('0x15')](_0x44a2('0x12'),_0xba2f5d,_0x269ebd);_0x225aa4(_0x269ebd);});});}exports[_0x44a2('0x1b')]=function(_0x18ea78){var _0x3f169e=this;return new Promise(function(_0x37e678,_0x51e834){return db[_0x44a2('0x1c')][_0x44a2('0x1d')](_0x18ea78[_0x44a2('0x1e')],{'raw':_0x18ea78[_0x44a2('0x1f')]?_0x18ea78[_0x44a2('0x1f')][_0x44a2('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18ea78[_0x44a2('0x1f')]?_0x18ea78[_0x44a2('0x1f')][_0x44a2('0x21')]||null:null,'attributes':_0x18ea78[_0x44a2('0x1f')]?_0x18ea78[_0x44a2('0x1f')]['attributes']||null:null,'limit':_0x18ea78['options']?_0x18ea78[_0x44a2('0x1f')][_0x44a2('0x22')]||null:null})[_0x44a2('0x23')](function(_0x4b51b3){logger[_0x44a2('0x18')](_0x44a2('0x1b'),_0x18ea78);logger['debug']('UpdateOpenchannelInteraction',_0x18ea78,JSON['stringify'](_0x4b51b3));_0x37e678(_0x4b51b3);})[_0x44a2('0x1a')](function(_0x392057){logger[_0x44a2('0x15')](_0x44a2('0x1b'),_0x392057[_0x44a2('0x17')],_0x18ea78);_0x51e834(_0x3f169e[_0x44a2('0x15')](0x1f4,_0x392057['message']));});});};exports[_0x44a2('0x24')]=function(_0x44baec){return new Promise(function(_0x2aca62,_0x22c14a){return db['OpenchannelInteraction'][_0x44a2('0x25')]({'where':_0x44baec[_0x44a2('0x1f')]?_0x44baec[_0x44a2('0x1f')][_0x44a2('0x21')]||null:null})[_0x44a2('0x23')](function(_0xceacbc){if(_0xceacbc){return _0xceacbc[_0x44a2('0x26')](_0x44baec['body'][_0x44a2('0x27')],_[_0x44a2('0x28')](_0x44baec['body'],['ids','id'])||{});}})[_0x44a2('0x29')](function(_0x343c46){logger[_0x44a2('0x18')]('AddTags',_0x44baec);logger[_0x44a2('0x2a')]('AddTags',_0x44baec,JSON['stringify'](_0x343c46));_0x2aca62(_0x343c46);})[_0x44a2('0x1a')](function(_0x1f2ff9){logger[_0x44a2('0x15')](_0x44a2('0x2b'),_0x1f2ff9[_0x44a2('0x17')],_0x44baec);_0x22c14a(_this[_0x44a2('0x15')](0x1f4,_0x1f2ff9['message']));});});}; \ No newline at end of file +var _0xcfb7=['defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','body','omit','ids','spread','AddTags','stringify','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcfb7,0x11a));var _0x7cfb=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0xcfb7[_0x4099ee];return _0x1b7bfc;};'use strict';var _=require(_0x7cfb('0x0'));var util=require(_0x7cfb('0x1'));var moment=require(_0x7cfb('0x2'));var BPromise=require(_0x7cfb('0x3'));var rs=require(_0x7cfb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7cfb('0x5'))(_0x7cfb('0x6'));var config=require(_0x7cfb('0x7'));var jayson=require(_0x7cfb('0x8'));var client=jayson[_0x7cfb('0x9')][_0x7cfb('0xa')]({'port':0x232a});config[_0x7cfb('0xb')]=_[_0x7cfb('0xc')](config[_0x7cfb('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x7cfb('0xd'))(new Redis(config[_0x7cfb('0xb')]));require(_0x7cfb('0xe'))[_0x7cfb('0xf')](socket);function respondWithRpcPromise(_0x528333,_0x58fc30,_0x83d50a){return new BPromise(function(_0x223946,_0x28d885){return client[_0x7cfb('0x10')](_0x528333,_0x83d50a)[_0x7cfb('0x11')](function(_0x402702){logger[_0x7cfb('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x58fc30,_0x7cfb('0x13'));logger[_0x7cfb('0x14')](_0x7cfb('0x15'),_0x58fc30,'request\x20sent',JSON['stringify'](_0x402702));if(_0x402702[_0x7cfb('0x16')]){if(_0x402702['error'][_0x7cfb('0x17')]===0x1f4){logger[_0x7cfb('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x58fc30,_0x402702['error'][_0x7cfb('0x18')]);return _0x28d885(_0x402702['error'][_0x7cfb('0x18')]);}logger['error'](_0x7cfb('0x19'),_0x58fc30,_0x402702['error'][_0x7cfb('0x18')]);return _0x223946(_0x402702['error'][_0x7cfb('0x18')]);}else{logger['info'](_0x7cfb('0x19'),_0x58fc30,_0x7cfb('0x13'));_0x223946(_0x402702['result'][_0x7cfb('0x18')]);}})[_0x7cfb('0x1a')](function(_0x40f660){logger[_0x7cfb('0x16')](_0x7cfb('0x19'),_0x58fc30,_0x40f660);_0x28d885(_0x40f660);});});}exports[_0x7cfb('0x1b')]=function(_0x36020e){var _0x5dff05=this;return new Promise(function(_0x804a87,_0x2647ab){return db[_0x7cfb('0x1c')][_0x7cfb('0x1d')](_0x36020e['body'],{'raw':_0x36020e[_0x7cfb('0x1e')]?_0x36020e[_0x7cfb('0x1e')][_0x7cfb('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36020e[_0x7cfb('0x1e')]?_0x36020e[_0x7cfb('0x1e')][_0x7cfb('0x20')]||null:null,'attributes':_0x36020e[_0x7cfb('0x1e')]?_0x36020e[_0x7cfb('0x1e')][_0x7cfb('0x21')]||null:null,'limit':_0x36020e[_0x7cfb('0x1e')]?_0x36020e[_0x7cfb('0x1e')][_0x7cfb('0x22')]||null:null})[_0x7cfb('0x11')](function(_0x10e1dd){logger[_0x7cfb('0x12')](_0x7cfb('0x1b'),_0x36020e);logger[_0x7cfb('0x14')]('UpdateOpenchannelInteraction',_0x36020e,JSON['stringify'](_0x10e1dd));_0x804a87(_0x10e1dd);})['catch'](function(_0x4b976e){logger[_0x7cfb('0x16')](_0x7cfb('0x1b'),_0x4b976e[_0x7cfb('0x18')],_0x36020e);_0x2647ab(_0x5dff05[_0x7cfb('0x16')](0x1f4,_0x4b976e[_0x7cfb('0x18')]));});});};exports[_0x7cfb('0x23')]=function(_0x1470dc){return new Promise(function(_0x3ee597,_0x312776){return db[_0x7cfb('0x1c')]['find']({'where':_0x1470dc[_0x7cfb('0x1e')]?_0x1470dc[_0x7cfb('0x1e')]['where']||null:null})[_0x7cfb('0x11')](function(_0x2d8d61){if(_0x2d8d61){return _0x2d8d61['addTags'](_0x1470dc[_0x7cfb('0x24')]['ids'],_[_0x7cfb('0x25')](_0x1470dc[_0x7cfb('0x24')],[_0x7cfb('0x26'),'id'])||{});}})[_0x7cfb('0x27')](function(_0x37bb73){logger[_0x7cfb('0x12')](_0x7cfb('0x28'),_0x1470dc);logger[_0x7cfb('0x14')](_0x7cfb('0x28'),_0x1470dc,JSON[_0x7cfb('0x29')](_0x37bb73));_0x3ee597(_0x37bb73);})[_0x7cfb('0x1a')](function(_0x37d283){logger['error'](_0x7cfb('0x28'),_0x37d283['message'],_0x1470dc);_0x312776(_this[_0x7cfb('0x16')](0x1f4,_0x37d283[_0x7cfb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 16a4273..e264768 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 _0x0487=['removeListener','register','save','remove','update'];(function(_0x3322fa,_0x588b7c){var _0x16296f=function(_0x3ee0a9){while(--_0x3ee0a9){_0x3322fa['push'](_0x3322fa['shift']());}};_0x16296f(++_0x588b7c);}(_0x0487,0x138));var _0x7048=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x0487[_0x4baae2];return _0x1a2285;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x7048('0x0'),_0x7048('0x1'),_0x7048('0x2')];function createListener(_0x343037,_0x5ba267){return function(_0x5ea9ce){_0x5ba267['emit'](_0x343037,_0x5ea9ce);};}function removeListener(_0x1a3f21,_0x151f45){return function(){OpenchannelInteractionEvents[_0x7048('0x3')](_0x1a3f21,_0x151f45);};}exports[_0x7048('0x4')]=function(_0xc7a0bf){for(var _0x48adec=0x0,_0x3703d5=events['length'];_0x48adec<_0x3703d5;_0x48adec++){var _0x563b5c=events[_0x48adec];var _0x526885=createListener('openchannelInteraction:'+_0x563b5c,_0xc7a0bf);OpenchannelInteractionEvents['on'](_0x563b5c,_0x526885);}}; \ No newline at end of file +var _0xc992=['remove','update','removeListener','openchannelInteraction:','save'];(function(_0x16d858,_0x3c6abf){var _0x24c667=function(_0x3d6092){while(--_0x3d6092){_0x16d858['push'](_0x16d858['shift']());}};_0x24c667(++_0x3c6abf);}(_0xc992,0xa9));var _0x2c99=function(_0x5348bd,_0x1c75c2){_0x5348bd=_0x5348bd-0x0;var _0x4f2a40=_0xc992[_0x5348bd];return _0x4f2a40;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x2c99('0x0'),_0x2c99('0x1'),_0x2c99('0x2')];function createListener(_0x1c7eea,_0x401809){return function(_0x335b69){_0x401809['emit'](_0x1c7eea,_0x335b69);};}function removeListener(_0x4773d6,_0x28718e){return function(){OpenchannelInteractionEvents[_0x2c99('0x3')](_0x4773d6,_0x28718e);};}exports['register']=function(_0x44c74d){for(var _0x26496e=0x0,_0x214677=events['length'];_0x26496e<_0x214677;_0x26496e++){var _0xefb8a6=events[_0x26496e];var _0x550b6f=createListener(_0x2c99('0x4')+_0xefb8a6,_0x44c74d);OpenchannelInteractionEvents['on'](_0xefb8a6,_0x550b6f);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index cfc71d0..966ed43 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 _0x61b6=['show','post','tracked','openchannel','openchannelmessage:create','create','put','update','/:id/accept','/:id/reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x5db79e,_0x39b3c2){var _0x148b6e=function(_0x46050a){while(--_0x46050a){_0x5db79e['push'](_0x5db79e['shift']());}};_0x148b6e(++_0x39b3c2);}(_0x61b6,0x11b));var _0x661b=function(_0x5c25f0,_0x11589c){_0x5c25f0=_0x5c25f0-0x0;var _0x242e65=_0x61b6[_0x5c25f0];return _0x242e65;};'use strict';var multer=require(_0x661b('0x0'));var util=require('util');var path=require(_0x661b('0x1'));var timeout=require(_0x661b('0x2'));var express=require(_0x661b('0x3'));var router=express[_0x661b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x661b('0x5'));var config=require(_0x661b('0x6'));var controller=require(_0x661b('0x7'));router[_0x661b('0x8')]('/',auth[_0x661b('0x9')](),controller[_0x661b('0xa')]);router[_0x661b('0x8')](_0x661b('0xb'),auth[_0x661b('0x9')](),controller[_0x661b('0xc')]);router[_0x661b('0x8')](_0x661b('0xd'),auth['isAuthenticated'](),controller[_0x661b('0xe')]);router[_0x661b('0xf')]('/',auth['isAuthenticated'](),interaction[_0x661b('0x10')](_0x661b('0x11'),_0x661b('0x12')),controller[_0x661b('0x13')]);router[_0x661b('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x661b('0x15')]);router[_0x661b('0x14')](_0x661b('0x16'),auth['isAuthenticated'](),controller['accept']);router[_0x661b('0x14')](_0x661b('0x17'),auth[_0x661b('0x9')](),controller['reject']);router[_0x661b('0x18')](_0x661b('0xd'),auth[_0x661b('0x9')](),controller[_0x661b('0x19')]);module[_0x661b('0x1a')]=router; \ No newline at end of file +var _0xea3d=['exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','put','/:id/accept','accept','/:id/reject','destroy'];(function(_0x1c14e7,_0x5a1bff){var _0x5bacdf=function(_0x2ff175){while(--_0x2ff175){_0x1c14e7['push'](_0x1c14e7['shift']());}};_0x5bacdf(++_0x5a1bff);}(_0xea3d,0x1ef));var _0xdea3=function(_0x7d4f10,_0x28328e){_0x7d4f10=_0x7d4f10-0x0;var _0x5524c=_0xea3d[_0x7d4f10];return _0x5524c;};'use strict';var multer=require('multer');var util=require(_0xdea3('0x0'));var path=require(_0xdea3('0x1'));var timeout=require(_0xdea3('0x2'));var express=require(_0xdea3('0x3'));var router=express['Router']();var auth=require(_0xdea3('0x4'));var interaction=require(_0xdea3('0x5'));var config=require(_0xdea3('0x6'));var controller=require(_0xdea3('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xdea3('0x8')]);router[_0xdea3('0x9')](_0xdea3('0xa'),auth[_0xdea3('0xb')](),controller[_0xdea3('0xc')]);router[_0xdea3('0x9')](_0xdea3('0xd'),auth[_0xdea3('0xb')](),controller[_0xdea3('0xe')]);router[_0xdea3('0xf')]('/',auth[_0xdea3('0xb')](),interaction[_0xdea3('0x10')](_0xdea3('0x11'),_0xdea3('0x12')),controller[_0xdea3('0x13')]);router[_0xdea3('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xdea3('0x14')](_0xdea3('0x15'),auth[_0xdea3('0xb')](),controller[_0xdea3('0x16')]);router['put'](_0xdea3('0x17'),auth[_0xdea3('0xb')](),controller['reject']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xdea3('0x18')]);module[_0xdea3('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index ed5c961..5f16471 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 _0x3d38=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0xea35d1,_0x302471){var _0x1d7a7c=function(_0x1bc101){while(--_0x1bc101){_0xea35d1['push'](_0xea35d1['shift']());}};_0x1d7a7c(++_0x302471);}(_0x3d38,0xd8));var _0x83d3=function(_0x4d0be7,_0xe3a0d0){_0x4d0be7=_0x4d0be7-0x0;var _0x2a4910=_0x3d38[_0x4d0be7];return _0x2a4910;};'use strict';var Sequelize=require(_0x83d3('0x0'));module[_0x83d3('0x1')]={'body':{'type':Sequelize[_0x83d3('0x2')](_0x83d3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x83d3('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x83d3('0x5')]('in',_0x83d3('0x6')),'defaultValue':_0x83d3('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x83d3('0x7')]}}; \ No newline at end of file +var _0x9d76=['ENUM','out','TEXT','medium','BOOLEAN'];(function(_0x3d74d5,_0xcea1ed){var _0x408ad9=function(_0xdbc83b){while(--_0xdbc83b){_0x3d74d5['push'](_0x3d74d5['shift']());}};_0x408ad9(++_0xcea1ed);}(_0x9d76,0x115));var _0x69d7=function(_0x532d2a,_0x417eca){_0x532d2a=_0x532d2a-0x0;var _0x533c9b=_0x9d76[_0x532d2a];return _0x533c9b;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x69d7('0x0')](_0x69d7('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x69d7('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x69d7('0x3')]('in',_0x69d7('0x4')),'defaultValue':_0x69d7('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 6137da6..8f323ea 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 _0x4ed8=['end','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','describe','../../config/logger','openchannel-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','openchannel','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','sendStatus','status','json','count','offset','limit','set','apply','update','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ed8,0x1ab));var _0x84ed=function(_0x3d6e09,_0x1fa4d1){_0x3d6e09=_0x3d6e09-0x0;var _0x315f3c=_0x4ed8[_0x3d6e09];return _0x315f3c;};'use strict';var pdf=require(_0x84ed('0x0'));var emlformat=require(_0x84ed('0x1'));var rimraf=require(_0x84ed('0x2'));var zipdir=require(_0x84ed('0x3'));var jsonpatch=require(_0x84ed('0x4'));var rp=require(_0x84ed('0x5'));var moment=require('moment');var BPromise=require(_0x84ed('0x6'));var Mustache=require('mustache');var util=require(_0x84ed('0x7'));var path=require('path');var sox=require(_0x84ed('0x8'));var csv=require('to-csv');var ejs=require(_0x84ed('0x9'));var fs=require('fs');var _=require(_0x84ed('0xa'));var squel=require(_0x84ed('0xb'));var crypto=require(_0x84ed('0xc'));var jsforce=require(_0x84ed('0xd'));var deskjs=require(_0x84ed('0xe'));var toCsv=require(_0x84ed('0xf'));var querystring=require(_0x84ed('0x10'));var Papa=require('papaparse');var Redis=require(_0x84ed('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x84ed('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x84ed('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x84ed('0x14'));var config=require(_0x84ed('0x15'));var db=require(_0x84ed('0x16'))['db'];config['redis']=_['defaults'](config[_0x84ed('0x17')],{'host':_0x84ed('0x18'),'port':0x18eb});var socket=require(_0x84ed('0x19'))(new Redis(config[_0x84ed('0x17')]));require('./openchannelMessage.socket')[_0x84ed('0x1a')](socket);var jayson=require(_0x84ed('0x1b'));var client=jayson[_0x84ed('0x1c')][_0x84ed('0x1d')]({'port':0x232c});var client9002=jayson[_0x84ed('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0xdb2a43,_0x2d4fd6,_0x30caf5){if(_0x30caf5){var _0x39e610=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x39e610[_0x84ed('0x1e')](_0x2d4fd6)){return _0xdb2a43;}else{throw new db[(_0x84ed('0x1f'))][(_0x84ed('0x20'))](_0x84ed('0x21'));}}else{return _0xdb2a43;}}function respondWithRpcPromise(_0x143ca1,_0x923622,_0x4c466b,_0x15a32c){return new BPromise(function(_0x55dc7f,_0x47a12e){var _0x4b509d=_0x15a32c||client;return _0x4b509d['request'](_0x143ca1,_0x4c466b)[_0x84ed('0x22')](function(_0x11a04e){logger[_0x84ed('0x23')](_0x84ed('0x24'),_0x923622,_0x84ed('0x25'));logger[_0x84ed('0x26')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x923622,_0x84ed('0x25'),JSON[_0x84ed('0x27')](_0x11a04e));if(_0x11a04e[_0x84ed('0x28')]){if(_0x11a04e[_0x84ed('0x28')]['code']===0x1f4){logger[_0x84ed('0x28')](_0x84ed('0x24'),_0x923622,_0x11a04e['error']['message']);return _0x47a12e(_0x11a04e[_0x84ed('0x28')][_0x84ed('0x29')]);}logger[_0x84ed('0x28')](_0x84ed('0x24'),_0x923622,_0x11a04e['error'][_0x84ed('0x29')]);return _0x55dc7f(_0x11a04e[_0x84ed('0x28')][_0x84ed('0x29')]);}else{logger['info'](_0x84ed('0x24'),_0x923622,_0x84ed('0x25'));_0x55dc7f(_0x11a04e[_0x84ed('0x2a')][_0x84ed('0x29')]);}})['catch'](function(_0x31b7a6){logger[_0x84ed('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x923622,_0x31b7a6);_0x47a12e(_0x31b7a6);});});}function respondWithStatusCode(_0x4f3cbb,_0x2c3eca){_0x2c3eca=_0x2c3eca||0xcc;return function(_0x542a14){if(_0x542a14){return _0x4f3cbb[_0x84ed('0x2b')](_0x2c3eca);}return _0x4f3cbb[_0x84ed('0x2c')](_0x2c3eca)['end']();};}function respondWithResult(_0x53c611,_0x5d344f){_0x5d344f=_0x5d344f||0xc8;return function(_0xf33d85){if(_0xf33d85){return _0x53c611[_0x84ed('0x2c')](_0x5d344f)[_0x84ed('0x2d')](_0xf33d85);}};}function respondWithFilteredResult(_0x5e277f,_0x311a77){return function(_0x251b7a){if(_0x251b7a){var _0x330a05=_0x251b7a[_0x84ed('0x2e')],_0x4c9450=_0x311a77[_0x84ed('0x2f')],_0xebcdd7=_0x311a77[_0x84ed('0x2f')]+_0x311a77[_0x84ed('0x30')],_0x2dc015;if(_0xebcdd7>=_0x330a05){_0xebcdd7=_0x330a05;_0x2dc015=0xc8;}else{_0x2dc015=0xce;}_0x5e277f[_0x84ed('0x2c')](_0x2dc015);return _0x5e277f[_0x84ed('0x31')]('Content-Range',_0x4c9450+'-'+_0xebcdd7+'/'+_0x330a05)[_0x84ed('0x2d')](_0x251b7a);}return null;};}function patchUpdates(_0x4d62f6){return function(_0x8dbfe6){try{jsonpatch[_0x84ed('0x32')](_0x8dbfe6,_0x4d62f6,!![]);}catch(_0x105ab0){return BPromise['reject'](_0x105ab0);}return _0x8dbfe6['save']();};}function saveUpdates(_0x531cb0,_0x1e243e){return function(_0x1e326c){if(_0x1e326c){return _0x1e326c[_0x84ed('0x33')](_0x531cb0)[_0x84ed('0x22')](function(_0x300170){return _0x300170;});}return null;};}function removeEntity(_0x36941f,_0x4e0f6f){return function(_0x481fad){if(_0x481fad){return _0x481fad[_0x84ed('0x34')]()[_0x84ed('0x22')](function(){_0x36941f['status'](0xcc)[_0x84ed('0x35')]();});}};}function handleEntityNotFound(_0x2a4f7b,_0x263353){return function(_0x1833d7){if(!_0x1833d7){_0x2a4f7b[_0x84ed('0x2b')](0x194);}return _0x1833d7;};}function handleError(_0xd5aa1f,_0x30c5ad){_0x30c5ad=_0x30c5ad||0x1f4;return function(_0x40026e){logger[_0x84ed('0x28')](_0x40026e[_0x84ed('0x36')]);if(_0x40026e['name']){delete _0x40026e[_0x84ed('0x37')];}_0xd5aa1f[_0x84ed('0x2c')](_0x30c5ad)[_0x84ed('0x38')](_0x40026e);};}exports[_0x84ed('0x39')]=function(_0x1ddf46,_0x5936f4){var _0x14a5ba={},_0x273218={},_0xe3b03a={'count':0x0,'rows':[]};var _0xc969f1=_[_0x84ed('0x3a')](db[_0x84ed('0x3b')][_0x84ed('0x3c')],function(_0x1ef0a9){return{'name':_0x1ef0a9[_0x84ed('0x3d')],'type':_0x1ef0a9['type'][_0x84ed('0x3e')]};});_0x273218['model']=_['map'](_0xc969f1,_0x84ed('0x37'));_0x273218['query']=_[_0x84ed('0x3f')](_0x1ddf46[_0x84ed('0x40')]);_0x273218[_0x84ed('0x41')]=_[_0x84ed('0x42')](_0x273218[_0x84ed('0x43')],_0x273218[_0x84ed('0x40')]);_0x14a5ba[_0x84ed('0x44')]=_[_0x84ed('0x42')](_0x273218[_0x84ed('0x43')],qs[_0x84ed('0x45')](_0x1ddf46[_0x84ed('0x40')][_0x84ed('0x45')]));_0x14a5ba['attributes']=_0x14a5ba[_0x84ed('0x44')][_0x84ed('0x46')]?_0x14a5ba[_0x84ed('0x44')]:_0x273218[_0x84ed('0x43')];if(!_0x1ddf46[_0x84ed('0x40')]['hasOwnProperty'](_0x84ed('0x47'))){_0x14a5ba['limit']=qs[_0x84ed('0x30')](_0x1ddf46[_0x84ed('0x40')][_0x84ed('0x30')]);_0x14a5ba[_0x84ed('0x2f')]=qs[_0x84ed('0x2f')](_0x1ddf46[_0x84ed('0x40')][_0x84ed('0x2f')]);}_0x14a5ba[_0x84ed('0x48')]=qs[_0x84ed('0x49')](_0x1ddf46[_0x84ed('0x40')][_0x84ed('0x49')]);_0x14a5ba[_0x84ed('0x4a')]=qs[_0x84ed('0x41')](_['pick'](_0x1ddf46[_0x84ed('0x40')],_0x273218[_0x84ed('0x41')]));if(_0x1ddf46[_0x84ed('0x40')][_0x84ed('0x4b')]){_0x14a5ba[_0x84ed('0x4a')]=_[_0x84ed('0x4c')](_0x14a5ba[_0x84ed('0x4a')],{'$or':_['map'](_0xc969f1,function(_0x12241d){if(_0x12241d['type']!==_0x84ed('0x4d')){var _0x584eb1={};_0x584eb1[_0x12241d[_0x84ed('0x37')]]={'$like':'%'+_0x1ddf46[_0x84ed('0x40')][_0x84ed('0x4b')]+'%'};return _0x584eb1;}})});}_0x14a5ba=_['merge']({},_0x14a5ba,_0x1ddf46[_0x84ed('0x4e')]);var _0xcb8f71={'where':_0x14a5ba['where']};return db[_0x84ed('0x3b')]['count'](_0xcb8f71)[_0x84ed('0x22')](function(_0x4a16d6){_0xe3b03a[_0x84ed('0x2e')]=_0x4a16d6;if(_0x1ddf46[_0x84ed('0x40')][_0x84ed('0x4f')]){_0x14a5ba['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x84ed('0x50')](_0x14a5ba);})['then'](function(_0x4c4698){_0xe3b03a[_0x84ed('0x51')]=_0x4c4698;return _0xe3b03a;})[_0x84ed('0x22')](respondWithFilteredResult(_0x5936f4,_0x14a5ba))[_0x84ed('0x52')](handleError(_0x5936f4,null));};exports['show']=function(_0x1c9fbb,_0x41caa2){var _0x1b93b9={'raw':!![],'where':{'id':_0x1c9fbb[_0x84ed('0x53')]['id']}},_0x3018b7={};_0x3018b7['model']=_[_0x84ed('0x3f')](db[_0x84ed('0x3b')][_0x84ed('0x3c')]);_0x3018b7[_0x84ed('0x40')]=_[_0x84ed('0x3f')](_0x1c9fbb[_0x84ed('0x40')]);_0x3018b7[_0x84ed('0x41')]=_[_0x84ed('0x42')](_0x3018b7['model'],_0x3018b7['query']);_0x1b93b9[_0x84ed('0x44')]=_[_0x84ed('0x42')](_0x3018b7[_0x84ed('0x43')],qs[_0x84ed('0x45')](_0x1c9fbb[_0x84ed('0x40')][_0x84ed('0x45')]));_0x1b93b9[_0x84ed('0x44')]=_0x1b93b9['attributes']['length']?_0x1b93b9[_0x84ed('0x44')]:_0x3018b7[_0x84ed('0x43')];if(_0x1c9fbb[_0x84ed('0x40')][_0x84ed('0x4f')]){_0x1b93b9[_0x84ed('0x54')]=[{'all':!![]}];}_0x1b93b9=_[_0x84ed('0x4c')]({},_0x1b93b9,_0x1c9fbb[_0x84ed('0x4e')]);return db[_0x84ed('0x3b')][_0x84ed('0x55')](_0x1b93b9)[_0x84ed('0x22')](handleEntityNotFound(_0x41caa2,null))[_0x84ed('0x22')](respondWithResult(_0x41caa2,null))[_0x84ed('0x52')](handleError(_0x41caa2,null));};exports[_0x84ed('0x56')]=function(_0x30303c,_0x3544cf){return db['OpenchannelMessage']['create'](_0x30303c[_0x84ed('0x57')],{})[_0x84ed('0x22')](respondWithResult(_0x3544cf,0xc9))[_0x84ed('0x52')](handleError(_0x3544cf,null));};exports[_0x84ed('0x33')]=function(_0x58f22f,_0x2fb38c){if(_0x58f22f[_0x84ed('0x57')]['id']){delete _0x58f22f[_0x84ed('0x57')]['id'];}return db['OpenchannelMessage'][_0x84ed('0x55')]({'where':{'id':_0x58f22f['params']['id']}})['then'](handleEntityNotFound(_0x2fb38c,null))['then'](saveUpdates(_0x58f22f[_0x84ed('0x57')],null))[_0x84ed('0x22')](respondWithResult(_0x2fb38c,null))[_0x84ed('0x52')](handleError(_0x2fb38c,null));};exports[_0x84ed('0x34')]=function(_0x5eff78,_0x8a7f08){return db[_0x84ed('0x3b')][_0x84ed('0x55')]({'where':{'id':_0x5eff78[_0x84ed('0x53')]['id']}})['then'](handleEntityNotFound(_0x8a7f08,null))['then'](removeEntity(_0x8a7f08,null))[_0x84ed('0x52')](handleError(_0x8a7f08,null));};exports[_0x84ed('0x58')]=function(_0x2bddaa,_0x1aa231){return db[_0x84ed('0x3b')]['describe']()[_0x84ed('0x22')](respondWithResult(_0x1aa231,null))[_0x84ed('0x52')](handleError(_0x1aa231,null));};var interaction_log=require(_0x84ed('0x59'))(_0x84ed('0x5a'));exports[_0x84ed('0x5b')]=function(_0x4108d9,_0x24b61,_0x55b9d9){var _0x1d200b={'channel':'openchannel'};if(_0x4108d9[_0x84ed('0x57')]['id']){delete _0x4108d9[_0x84ed('0x57')]['id'];}_0x4108d9['body'][_0x84ed('0x5c')]=!![];_0x4108d9[_0x84ed('0x57')][_0x84ed('0x5d')]=moment()[_0x84ed('0x5e')](_0x84ed('0x5f'));_0x4108d9['body'][_0x84ed('0x60')]=_0x4108d9[_0x84ed('0x57')]['UserId']||_0x4108d9['user']['id'];return db[_0x84ed('0x3b')][_0x84ed('0x55')]({'where':{'id':_0x4108d9[_0x84ed('0x53')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x84ed('0x22')](handleEntityNotFound(_0x24b61,null))[_0x84ed('0x22')](saveUpdates(_0x4108d9['body'],null))[_0x84ed('0x22')](function(_0x1285db){if(_0x1285db){_0x1d200b[_0x84ed('0x29')]=_0x1285db[_0x84ed('0x61')]({'plain':!![]});return db[_0x84ed('0x62')][_0x84ed('0x55')]({'where':{'id':_0x1285db[_0x84ed('0x63')]}});}return null;})[_0x84ed('0x22')](handleEntityNotFound(_0x24b61,null))[_0x84ed('0x22')](function(_0x2dd68a){if(_0x2dd68a){return _0x2dd68a[_0x84ed('0x33')]({'UserId':_0x4108d9[_0x84ed('0x57')][_0x84ed('0x60')],'read1stAt':_[_0x84ed('0x64')](_0x2dd68a[_0x84ed('0x65')])?moment()[_0x84ed('0x5e')](_0x84ed('0x5f')):undefined});}return null;})[_0x84ed('0x22')](function(_0x15c078){if(_0x15c078){_0x1d200b[_0x84ed('0x66')]=_0x15c078['get']({'plain':!![]});interaction_log[_0x84ed('0x23')](_0x84ed('0x67'),_0x4108d9[_0x84ed('0x68')]['id'],_0x4108d9[_0x84ed('0x68')][_0x84ed('0x37')],_0x4108d9['user'][_0x84ed('0x69')],_0x1d200b[_0x84ed('0x66')]['id'],_0x4108d9[_0x84ed('0x57')]?JSON[_0x84ed('0x27')](_0x4108d9[_0x84ed('0x57')]):'null');return respondWithRpcPromise(_0x84ed('0x6a'),_0x84ed('0x6b'),_0x1d200b);}return null;})['then'](function(_0x15175f){if(_0x15175f){if(_0x4108d9[_0x84ed('0x57')]['manual']){_0x1d200b['message'][_0x84ed('0x6c')]=util[_0x84ed('0x5e')](_0x84ed('0x6d'),_0x4108d9['user']['name']);_0x1d200b[_0x84ed('0x29')][_0x84ed('0x6e')]=_0x1d200b[_0x84ed('0x6e')];_0x1d200b['message'][_0x84ed('0x6f')]=_0x84ed('0x5b');return respondWithRpcPromise(_0x84ed('0x70'),_0x84ed('0x70'),{'event':_0x84ed('0x71'),'message':_0x1d200b[_0x84ed('0x29')]},client9002)[_0x84ed('0x22')](function(){return _0x1d200b;});}return _0x1d200b;}return null;})[_0x84ed('0x22')](respondWithResult(_0x24b61,null))[_0x84ed('0x52')](handleError(_0x24b61,null));};var interaction_log=require(_0x84ed('0x59'))(_0x84ed('0x5a'));exports[_0x84ed('0x72')]=function(_0x59681b,_0x1c4f24,_0x51fc22){var _0x107db5={'agent':{},'channel':_0x84ed('0x73')};if(_0x59681b[_0x84ed('0x57')]['id']){delete _0x59681b[_0x84ed('0x57')]['id'];}_0x59681b[_0x84ed('0x57')][_0x84ed('0x60')]=_0x59681b[_0x84ed('0x57')][_0x84ed('0x60')]||_0x59681b[_0x84ed('0x68')]['id'];_0x107db5[_0x84ed('0x74')]['id']=_0x59681b['body'][_0x84ed('0x60')];return db[_0x84ed('0x3b')]['find']({'where':{'id':_0x59681b['params']['id'],'UserId':null}})[_0x84ed('0x22')](handleEntityNotFound(_0x1c4f24,null))['then'](function(_0x44e627){if(_0x44e627){_0x107db5['message']=_0x44e627[_0x84ed('0x61')]({'plain':!![]});return db[_0x84ed('0x62')][_0x84ed('0x55')]({'where':{'id':_0x44e627[_0x84ed('0x63')]}});}return null;})[_0x84ed('0x22')](handleEntityNotFound(_0x1c4f24,null))[_0x84ed('0x22')](function(_0x5c8db0){if(_0x5c8db0){_0x107db5[_0x84ed('0x66')]=_0x5c8db0['get']({'plain':!![]});interaction_log[_0x84ed('0x23')](_0x84ed('0x75'),_0x59681b[_0x84ed('0x68')]['id'],_0x59681b[_0x84ed('0x68')][_0x84ed('0x37')],_0x59681b[_0x84ed('0x68')][_0x84ed('0x69')],_0x107db5['interaction']['id'],_0x59681b[_0x84ed('0x57')]?JSON[_0x84ed('0x27')](_0x59681b[_0x84ed('0x57')]):_0x84ed('0x76'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x107db5);}return null;})[_0x84ed('0x22')](function(_0x4afcf8){if(_0x4afcf8){_0x4afcf8[_0x84ed('0x29')][_0x84ed('0x6c')]=util[_0x84ed('0x5e')](_0x84ed('0x6d'),_0x59681b['user'][_0x84ed('0x37')]);_0x4afcf8[_0x84ed('0x29')][_0x84ed('0x6e')]=_0x107db5[_0x84ed('0x6e')];_0x4afcf8[_0x84ed('0x29')][_0x84ed('0x6f')]=_0x84ed('0x72');respondWithRpcPromise(_0x84ed('0x70'),_0x84ed('0x70'),{'event':_0x84ed('0x77'),'message':_0x4afcf8[_0x84ed('0x29')]},client9002);return _0x107db5;}return null;})[_0x84ed('0x22')](respondWithResult(_0x1c4f24,null))['catch'](handleError(_0x1c4f24,null));}; \ No newline at end of file +var _0x3a3b=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','jayson/promise','client','http','test','ValidationError','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','filter','options','includeAll','include','findAll','show','params','intersection','create','body','find','describe','accept','openchannel','read','readAt','format','UserId','user','CmContact','Contact','get','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','EventManager','acceptmessage','openchannel-interactions','agent','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x8560d3,_0x26a504){var _0x33b1b5=function(_0x3a2cad){while(--_0x3a2cad){_0x8560d3['push'](_0x8560d3['shift']());}};_0x33b1b5(++_0x26a504);}(_0x3a3b,0x1e7));var _0xb3a3=function(_0x15c6cd,_0x31b63f){_0x15c6cd=_0x15c6cd-0x0;var _0xc94a41=_0x3a3b[_0x15c6cd];return _0xc94a41;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb3a3('0x0'));var rimraf=require(_0xb3a3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb3a3('0x2'));var rp=require(_0xb3a3('0x3'));var moment=require(_0xb3a3('0x4'));var BPromise=require(_0xb3a3('0x5'));var Mustache=require('mustache');var util=require(_0xb3a3('0x6'));var path=require(_0xb3a3('0x7'));var sox=require(_0xb3a3('0x8'));var csv=require(_0xb3a3('0x9'));var ejs=require(_0xb3a3('0xa'));var fs=require('fs');var _=require(_0xb3a3('0xb'));var squel=require(_0xb3a3('0xc'));var crypto=require(_0xb3a3('0xd'));var jsforce=require(_0xb3a3('0xe'));var deskjs=require(_0xb3a3('0xf'));var toCsv=require(_0xb3a3('0x9'));var querystring=require(_0xb3a3('0x10'));var Papa=require(_0xb3a3('0x11'));var Redis=require(_0xb3a3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb3a3('0x13'));var as=require(_0xb3a3('0x14'));var hardwareService=require(_0xb3a3('0x15'));var logger=require(_0xb3a3('0x16'))(_0xb3a3('0x17'));var utils=require(_0xb3a3('0x18'));var config=require(_0xb3a3('0x19'));var db=require(_0xb3a3('0x1a'))['db'];config[_0xb3a3('0x1b')]=_['defaults'](config[_0xb3a3('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xb3a3('0x1c'))(new Redis(config[_0xb3a3('0x1b')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0xb3a3('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xb3a3('0x1e')][_0xb3a3('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x11d697,_0x3a2187,_0x1bfb36){if(_0x1bfb36){var _0x2509fa=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2509fa[_0xb3a3('0x20')](_0x3a2187)){return _0x11d697;}else{throw new db['Sequelize'][(_0xb3a3('0x21'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x11d697;}}function respondWithRpcPromise(_0x342196,_0x57a123,_0x2c24fb,_0x3380c0){return new BPromise(function(_0x9060d4,_0x270b15){var _0xc13abc=_0x3380c0||client;return _0xc13abc['request'](_0x342196,_0x2c24fb)['then'](function(_0x128a68){logger['info'](_0xb3a3('0x22'),_0x57a123,_0xb3a3('0x23'));logger[_0xb3a3('0x24')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x57a123,_0xb3a3('0x23'),JSON[_0xb3a3('0x25')](_0x128a68));if(_0x128a68[_0xb3a3('0x26')]){if(_0x128a68[_0xb3a3('0x26')][_0xb3a3('0x27')]===0x1f4){logger[_0xb3a3('0x26')](_0xb3a3('0x22'),_0x57a123,_0x128a68[_0xb3a3('0x26')][_0xb3a3('0x28')]);return _0x270b15(_0x128a68['error']['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x57a123,_0x128a68[_0xb3a3('0x26')][_0xb3a3('0x28')]);return _0x9060d4(_0x128a68[_0xb3a3('0x26')]['message']);}else{logger[_0xb3a3('0x29')](_0xb3a3('0x22'),_0x57a123,_0xb3a3('0x23'));_0x9060d4(_0x128a68[_0xb3a3('0x2a')][_0xb3a3('0x28')]);}})[_0xb3a3('0x2b')](function(_0x225236){logger[_0xb3a3('0x26')](_0xb3a3('0x22'),_0x57a123,_0x225236);_0x270b15(_0x225236);});});}function respondWithStatusCode(_0x33b4da,_0x2e2d7e){_0x2e2d7e=_0x2e2d7e||0xcc;return function(_0x584c1c){if(_0x584c1c){return _0x33b4da['sendStatus'](_0x2e2d7e);}return _0x33b4da[_0xb3a3('0x2c')](_0x2e2d7e)[_0xb3a3('0x2d')]();};}function respondWithResult(_0x31170d,_0x4f7bbf){_0x4f7bbf=_0x4f7bbf||0xc8;return function(_0xa63333){if(_0xa63333){return _0x31170d[_0xb3a3('0x2c')](_0x4f7bbf)[_0xb3a3('0x2e')](_0xa63333);}};}function respondWithFilteredResult(_0x25b28b,_0x1e2a8f){return function(_0x201cbe){if(_0x201cbe){var _0xc451f7=_0x201cbe[_0xb3a3('0x2f')],_0x441de0=_0x1e2a8f[_0xb3a3('0x30')],_0x88a962=_0x1e2a8f[_0xb3a3('0x30')]+_0x1e2a8f[_0xb3a3('0x31')],_0xe998a9;if(_0x88a962>=_0xc451f7){_0x88a962=_0xc451f7;_0xe998a9=0xc8;}else{_0xe998a9=0xce;}_0x25b28b[_0xb3a3('0x2c')](_0xe998a9);return _0x25b28b['set'](_0xb3a3('0x32'),_0x441de0+'-'+_0x88a962+'/'+_0xc451f7)[_0xb3a3('0x2e')](_0x201cbe);}return null;};}function patchUpdates(_0x393efd){return function(_0x4d311c){try{jsonpatch[_0xb3a3('0x33')](_0x4d311c,_0x393efd,!![]);}catch(_0x24f93c){return BPromise[_0xb3a3('0x34')](_0x24f93c);}return _0x4d311c['save']();};}function saveUpdates(_0x106ab7,_0x4dacbb){return function(_0x42558b){if(_0x42558b){return _0x42558b[_0xb3a3('0x35')](_0x106ab7)[_0xb3a3('0x36')](function(_0x544142){return _0x544142;});}return null;};}function removeEntity(_0x47cf12,_0x51370e){return function(_0x496364){if(_0x496364){return _0x496364[_0xb3a3('0x37')]()['then'](function(){_0x47cf12['status'](0xcc)[_0xb3a3('0x2d')]();});}};}function handleEntityNotFound(_0x5a59cf,_0x3ee616){return function(_0x398d28){if(!_0x398d28){_0x5a59cf[_0xb3a3('0x38')](0x194);}return _0x398d28;};}function handleError(_0x12964d,_0xf71e9b){_0xf71e9b=_0xf71e9b||0x1f4;return function(_0x1cc5e0){logger[_0xb3a3('0x26')](_0x1cc5e0[_0xb3a3('0x39')]);if(_0x1cc5e0[_0xb3a3('0x3a')]){delete _0x1cc5e0['name'];}_0x12964d['status'](_0xf71e9b)[_0xb3a3('0x3b')](_0x1cc5e0);};}exports[_0xb3a3('0x3c')]=function(_0x51ec96,_0x9a7517){var _0x17a471={},_0x4c14b6={},_0x95f3c5={'count':0x0,'rows':[]};var _0x5a82f5=_[_0xb3a3('0x3d')](db[_0xb3a3('0x3e')][_0xb3a3('0x3f')],function(_0x303236){return{'name':_0x303236[_0xb3a3('0x40')],'type':_0x303236[_0xb3a3('0x41')][_0xb3a3('0x42')]};});_0x4c14b6[_0xb3a3('0x43')]=_[_0xb3a3('0x3d')](_0x5a82f5,_0xb3a3('0x3a'));_0x4c14b6['query']=_[_0xb3a3('0x44')](_0x51ec96[_0xb3a3('0x45')]);_0x4c14b6[_0xb3a3('0x46')]=_['intersection'](_0x4c14b6[_0xb3a3('0x43')],_0x4c14b6[_0xb3a3('0x45')]);_0x17a471[_0xb3a3('0x47')]=_['intersection'](_0x4c14b6['model'],qs[_0xb3a3('0x48')](_0x51ec96[_0xb3a3('0x45')][_0xb3a3('0x48')]));_0x17a471[_0xb3a3('0x47')]=_0x17a471['attributes'][_0xb3a3('0x49')]?_0x17a471[_0xb3a3('0x47')]:_0x4c14b6[_0xb3a3('0x43')];if(!_0x51ec96['query'][_0xb3a3('0x4a')](_0xb3a3('0x4b'))){_0x17a471[_0xb3a3('0x31')]=qs[_0xb3a3('0x31')](_0x51ec96[_0xb3a3('0x45')][_0xb3a3('0x31')]);_0x17a471[_0xb3a3('0x30')]=qs[_0xb3a3('0x30')](_0x51ec96[_0xb3a3('0x45')][_0xb3a3('0x30')]);}_0x17a471['order']=qs[_0xb3a3('0x4c')](_0x51ec96['query'][_0xb3a3('0x4c')]);_0x17a471['where']=qs[_0xb3a3('0x46')](_[_0xb3a3('0x4d')](_0x51ec96['query'],_0x4c14b6[_0xb3a3('0x46')]));if(_0x51ec96[_0xb3a3('0x45')]['filter']){_0x17a471[_0xb3a3('0x4e')]=_[_0xb3a3('0x4f')](_0x17a471[_0xb3a3('0x4e')],{'$or':_['map'](_0x5a82f5,function(_0x4d248d){if(_0x4d248d[_0xb3a3('0x41')]!=='VIRTUAL'){var _0x6c4a1a={};_0x6c4a1a[_0x4d248d['name']]={'$like':'%'+_0x51ec96[_0xb3a3('0x45')][_0xb3a3('0x50')]+'%'};return _0x6c4a1a;}})});}_0x17a471=_[_0xb3a3('0x4f')]({},_0x17a471,_0x51ec96[_0xb3a3('0x51')]);var _0x56aad4={'where':_0x17a471['where']};return db[_0xb3a3('0x3e')]['count'](_0x56aad4)['then'](function(_0xdd63bb){_0x95f3c5[_0xb3a3('0x2f')]=_0xdd63bb;if(_0x51ec96[_0xb3a3('0x45')][_0xb3a3('0x52')]){_0x17a471[_0xb3a3('0x53')]=[{'all':!![]}];}return db[_0xb3a3('0x3e')][_0xb3a3('0x54')](_0x17a471);})[_0xb3a3('0x36')](function(_0x41c824){_0x95f3c5['rows']=_0x41c824;return _0x95f3c5;})['then'](respondWithFilteredResult(_0x9a7517,_0x17a471))[_0xb3a3('0x2b')](handleError(_0x9a7517,null));};exports[_0xb3a3('0x55')]=function(_0x22d835,_0x3d83fb){var _0x3decd8={'raw':!![],'where':{'id':_0x22d835[_0xb3a3('0x56')]['id']}},_0x14f5c2={};_0x14f5c2[_0xb3a3('0x43')]=_[_0xb3a3('0x44')](db[_0xb3a3('0x3e')]['rawAttributes']);_0x14f5c2['query']=_[_0xb3a3('0x44')](_0x22d835[_0xb3a3('0x45')]);_0x14f5c2[_0xb3a3('0x46')]=_[_0xb3a3('0x57')](_0x14f5c2['model'],_0x14f5c2[_0xb3a3('0x45')]);_0x3decd8[_0xb3a3('0x47')]=_[_0xb3a3('0x57')](_0x14f5c2['model'],qs[_0xb3a3('0x48')](_0x22d835[_0xb3a3('0x45')][_0xb3a3('0x48')]));_0x3decd8[_0xb3a3('0x47')]=_0x3decd8[_0xb3a3('0x47')]['length']?_0x3decd8[_0xb3a3('0x47')]:_0x14f5c2['model'];if(_0x22d835['query'][_0xb3a3('0x52')]){_0x3decd8[_0xb3a3('0x53')]=[{'all':!![]}];}_0x3decd8=_[_0xb3a3('0x4f')]({},_0x3decd8,_0x22d835['options']);return db['OpenchannelMessage']['find'](_0x3decd8)[_0xb3a3('0x36')](handleEntityNotFound(_0x3d83fb,null))['then'](respondWithResult(_0x3d83fb,null))[_0xb3a3('0x2b')](handleError(_0x3d83fb,null));};exports[_0xb3a3('0x58')]=function(_0x589088,_0x1cb0f8){return db[_0xb3a3('0x3e')]['create'](_0x589088[_0xb3a3('0x59')],{})['then'](respondWithResult(_0x1cb0f8,0xc9))[_0xb3a3('0x2b')](handleError(_0x1cb0f8,null));};exports[_0xb3a3('0x35')]=function(_0x10008e,_0x55e3df){if(_0x10008e[_0xb3a3('0x59')]['id']){delete _0x10008e['body']['id'];}return db[_0xb3a3('0x3e')][_0xb3a3('0x5a')]({'where':{'id':_0x10008e[_0xb3a3('0x56')]['id']}})[_0xb3a3('0x36')](handleEntityNotFound(_0x55e3df,null))['then'](saveUpdates(_0x10008e['body'],null))[_0xb3a3('0x36')](respondWithResult(_0x55e3df,null))[_0xb3a3('0x2b')](handleError(_0x55e3df,null));};exports['destroy']=function(_0x1490a8,_0x56595f){return db[_0xb3a3('0x3e')][_0xb3a3('0x5a')]({'where':{'id':_0x1490a8[_0xb3a3('0x56')]['id']}})[_0xb3a3('0x36')](handleEntityNotFound(_0x56595f,null))[_0xb3a3('0x36')](removeEntity(_0x56595f,null))['catch'](handleError(_0x56595f,null));};exports['describe']=function(_0x211cde,_0xc7d00b){return db['OpenchannelMessage'][_0xb3a3('0x5b')]()[_0xb3a3('0x36')](respondWithResult(_0xc7d00b,null))[_0xb3a3('0x2b')](handleError(_0xc7d00b,null));};var interaction_log=require(_0xb3a3('0x16'))('openchannel-interactions');exports[_0xb3a3('0x5c')]=function(_0x145b50,_0x14a093,_0x4409c1){var _0x1e08e4={'channel':_0xb3a3('0x5d')};if(_0x145b50[_0xb3a3('0x59')]['id']){delete _0x145b50[_0xb3a3('0x59')]['id'];}_0x145b50[_0xb3a3('0x59')][_0xb3a3('0x5e')]=!![];_0x145b50[_0xb3a3('0x59')][_0xb3a3('0x5f')]=moment()[_0xb3a3('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x145b50[_0xb3a3('0x59')][_0xb3a3('0x61')]=_0x145b50[_0xb3a3('0x59')][_0xb3a3('0x61')]||_0x145b50[_0xb3a3('0x62')]['id'];return db['OpenchannelMessage']['find']({'where':{'id':_0x145b50[_0xb3a3('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xb3a3('0x63')],'as':_0xb3a3('0x64')}]})['then'](handleEntityNotFound(_0x14a093,null))['then'](saveUpdates(_0x145b50['body'],null))[_0xb3a3('0x36')](function(_0x313e0e){if(_0x313e0e){_0x1e08e4[_0xb3a3('0x28')]=_0x313e0e[_0xb3a3('0x65')]({'plain':!![]});return db['OpenchannelInteraction'][_0xb3a3('0x5a')]({'where':{'id':_0x313e0e[_0xb3a3('0x66')]}});}return null;})[_0xb3a3('0x36')](handleEntityNotFound(_0x14a093,null))[_0xb3a3('0x36')](function(_0x47e75b){if(_0x47e75b){return _0x47e75b[_0xb3a3('0x35')]({'UserId':_0x145b50[_0xb3a3('0x59')][_0xb3a3('0x61')],'read1stAt':_[_0xb3a3('0x67')](_0x47e75b[_0xb3a3('0x68')])?moment()[_0xb3a3('0x60')](_0xb3a3('0x69')):undefined});}return null;})[_0xb3a3('0x36')](function(_0x142b49){if(_0x142b49){_0x1e08e4[_0xb3a3('0x6a')]=_0x142b49[_0xb3a3('0x65')]({'plain':!![]});interaction_log[_0xb3a3('0x29')](_0xb3a3('0x6b'),_0x145b50[_0xb3a3('0x62')]['id'],_0x145b50[_0xb3a3('0x62')]['name'],_0x145b50['user'][_0xb3a3('0x6c')],_0x1e08e4[_0xb3a3('0x6a')]['id'],_0x145b50[_0xb3a3('0x59')]?JSON[_0xb3a3('0x25')](_0x145b50[_0xb3a3('0x59')]):_0xb3a3('0x6d'));return respondWithRpcPromise(_0xb3a3('0x6e'),_0xb3a3('0x6f'),_0x1e08e4);}return null;})[_0xb3a3('0x36')](function(_0x1877a4){if(_0x1877a4){if(_0x145b50['body']['manual']){_0x1e08e4[_0xb3a3('0x28')][_0xb3a3('0x70')]=util[_0xb3a3('0x60')](_0xb3a3('0x71'),_0x145b50[_0xb3a3('0x62')][_0xb3a3('0x3a')]);_0x1e08e4[_0xb3a3('0x28')][_0xb3a3('0x72')]=_0x1e08e4[_0xb3a3('0x72')];_0x1e08e4[_0xb3a3('0x28')]['event']=_0xb3a3('0x5c');return respondWithRpcPromise(_0xb3a3('0x73'),_0xb3a3('0x73'),{'event':_0xb3a3('0x74'),'message':_0x1e08e4['message']},client9002)['then'](function(){return _0x1e08e4;});}return _0x1e08e4;}return null;})[_0xb3a3('0x36')](respondWithResult(_0x14a093,null))[_0xb3a3('0x2b')](handleError(_0x14a093,null));};var interaction_log=require(_0xb3a3('0x16'))(_0xb3a3('0x75'));exports[_0xb3a3('0x34')]=function(_0x2d0249,_0xb3663b,_0x36472d){var _0x5e7149={'agent':{},'channel':_0xb3a3('0x5d')};if(_0x2d0249[_0xb3a3('0x59')]['id']){delete _0x2d0249[_0xb3a3('0x59')]['id'];}_0x2d0249[_0xb3a3('0x59')][_0xb3a3('0x61')]=_0x2d0249[_0xb3a3('0x59')][_0xb3a3('0x61')]||_0x2d0249[_0xb3a3('0x62')]['id'];_0x5e7149[_0xb3a3('0x76')]['id']=_0x2d0249['body']['UserId'];return db[_0xb3a3('0x3e')][_0xb3a3('0x5a')]({'where':{'id':_0x2d0249[_0xb3a3('0x56')]['id'],'UserId':null}})[_0xb3a3('0x36')](handleEntityNotFound(_0xb3663b,null))[_0xb3a3('0x36')](function(_0x34b7e5){if(_0x34b7e5){_0x5e7149[_0xb3a3('0x28')]=_0x34b7e5[_0xb3a3('0x65')]({'plain':!![]});return db[_0xb3a3('0x77')][_0xb3a3('0x5a')]({'where':{'id':_0x34b7e5[_0xb3a3('0x66')]}});}return null;})[_0xb3a3('0x36')](handleEntityNotFound(_0xb3663b,null))['then'](function(_0x4b8dce){if(_0x4b8dce){_0x5e7149[_0xb3a3('0x6a')]=_0x4b8dce[_0xb3a3('0x65')]({'plain':!![]});interaction_log['info'](_0xb3a3('0x78'),_0x2d0249['user']['id'],_0x2d0249[_0xb3a3('0x62')]['name'],_0x2d0249[_0xb3a3('0x62')][_0xb3a3('0x6c')],_0x5e7149[_0xb3a3('0x6a')]['id'],_0x2d0249[_0xb3a3('0x59')]?JSON[_0xb3a3('0x25')](_0x2d0249[_0xb3a3('0x59')]):_0xb3a3('0x6d'));return respondWithRpcPromise(_0xb3a3('0x79'),_0xb3a3('0x7a'),_0x5e7149);}return null;})['then'](function(_0x5430a6){if(_0x5430a6){_0x5430a6[_0xb3a3('0x28')][_0xb3a3('0x70')]=util[_0xb3a3('0x60')]('SIP/%s',_0x2d0249[_0xb3a3('0x62')][_0xb3a3('0x3a')]);_0x5430a6[_0xb3a3('0x28')][_0xb3a3('0x72')]=_0x5e7149[_0xb3a3('0x72')];_0x5430a6[_0xb3a3('0x28')][_0xb3a3('0x7b')]=_0xb3a3('0x34');respondWithRpcPromise('EventManager',_0xb3a3('0x73'),{'event':_0xb3a3('0x7c'),'message':_0x5430a6[_0xb3a3('0x28')]},client9002);return _0x5e7149;}return null;})[_0xb3a3('0x36')](respondWithResult(_0xb3663b,null))[_0xb3a3('0x2b')](handleError(_0xb3663b,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 443bad6..d66fa2c 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 _0xf0eb=['events','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x577932,_0x59ca3e){var _0x6a0ea8=function(_0x1c2ca1){while(--_0x1c2ca1){_0x577932['push'](_0x577932['shift']());}};_0x6a0ea8(++_0x59ca3e);}(_0xf0eb,0x1a4));var _0xbf0e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xf0eb[_0x1cfa0d];return _0xe33279;};'use strict';var EventEmitter=require(_0xbf0e('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xbf0e('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xbf0e('0x2')](0x0);var events={'afterCreate':_0xbf0e('0x3'),'afterUpdate':_0xbf0e('0x4'),'afterDestroy':_0xbf0e('0x5')};function emitEvent(_0x2e98b0){return function(_0x4eec87,_0x318bac,_0x1a40c5){OpenchannelMessageEvents[_0xbf0e('0x6')](_0x2e98b0+':'+_0x4eec87['id'],_0x4eec87);OpenchannelMessageEvents[_0xbf0e('0x6')](_0x2e98b0,_0x4eec87);_0x1a40c5(null);};}for(var e in events){if(events[_0xbf0e('0x7')](e)){var event=events[e];OpenchannelMessage[_0xbf0e('0x8')](e,emitEvent(event));}}module[_0xbf0e('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x68c5=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save'];(function(_0x14ad77,_0xb5c484){var _0x47d4a6=function(_0xd2b7c4){while(--_0xd2b7c4){_0x14ad77['push'](_0x14ad77['shift']());}};_0x47d4a6(++_0xb5c484);}(_0x68c5,0x12f));var _0x568c=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x68c5[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require(_0x568c('0x0'));var OpenchannelMessage=require(_0x568c('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x568c('0x2'),'afterUpdate':_0x568c('0x3'),'afterDestroy':_0x568c('0x4')};function emitEvent(_0x19ea1f){return function(_0x1e0e5d,_0x244ba9,_0x5f0bec){OpenchannelMessageEvents[_0x568c('0x5')](_0x19ea1f+':'+_0x1e0e5d['id'],_0x1e0e5d);OpenchannelMessageEvents[_0x568c('0x5')](_0x19ea1f,_0x1e0e5d);_0x5f0bec(null);};}for(var e in events){if(events[_0x568c('0x6')](e)){var event=events[e];OpenchannelMessage[_0x568c('0x7')](e,emitEvent(event));}}module[_0x568c('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 492028a..5f19a4b 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 _0x7735=['Interaction','omit','Contact','POST','method','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','afterCreate','inspect','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','models','get','direction','toLowerCase','out','isNil','findOne','update','catch','error','secret','then','OpenchannelAccount','OpenchannelAccountId','OpenchannelInteraction','Interactions','OpenchannelInteractionId','CmContact','replyUri','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','length'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x7735,0x101));var _0x5773=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x7735[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x5773('0x0'));var util=require(_0x5773('0x1'));var logger=require(_0x5773('0x2'))(_0x5773('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5773('0x4'));var fs=require('fs');var path=require(_0x5773('0x5'));var rimraf=require(_0x5773('0x6'));var config=require(_0x5773('0x7'));var attributes=require(_0x5773('0x8'));module[_0x5773('0x9')]=function(_0x47c5b9,_0x24e3c4){return _0x47c5b9[_0x5773('0xa')](_0x5773('0xb'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x5773('0xc'),'fields':[_0x5773('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xe5ad5a,_0x14b3f0,_0x1cf59b){var _0x5ce91b=_0x47c5b9[_0x5773('0xe')];var _0x534ab1=_0xe5ad5a[_0x5773('0xf')]({'plain':!![]});if(_0x534ab1[_0x5773('0x10')][_0x5773('0x11')]()==='in'||_0x534ab1[_0x5773('0x10')][_0x5773('0x11')]()===_0x5773('0x12')&&!_0x534ab1['secret']&&!_[_0x5773('0x13')](_0x534ab1['UserId'])){_0x5ce91b['OpenchannelInteraction'][_0x5773('0x14')]({'where':{'id':_0x534ab1['OpenchannelInteractionId']}})['then'](function(_0x42979d){if(_0x42979d){_0x42979d[_0x5773('0x15')]({'lastMsgAt':_0x534ab1['createdAt'],'lastMsgDirection':_0x534ab1[_0x5773('0x10')][_0x5773('0x11')]()});}})[_0x5773('0x16')](function(_0xfd14e3){console[_0x5773('0x17')](_0xfd14e3);});}if(_0x534ab1[_0x5773('0x10')]===_0x5773('0x12')&&!_0x534ab1[_0x5773('0x18')]){var _0x2bebfd;_0x5ce91b['CmContact']['describe']()[_0x5773('0x19')](function(_0x239435){return _0x5ce91b[_0x5773('0x1a')]['find']({'where':{'id':_0x534ab1[_0x5773('0x1b')]},'include':[{'model':_0x5ce91b[_0x5773('0x1c')],'as':_0x5773('0x1d'),'where':{'id':_0x534ab1[_0x5773('0x1e')]},'limit':0x1,'include':[{'model':_0x5ce91b[_0x5773('0x1f')],'as':'Contact','attributes':_['keys'](_0x239435)}]}]});})[_0x5773('0x19')](function(_0x56e05c){_0x2bebfd=_0x56e05c[_0x5773('0xf')]({'plain':!![]});if(_0x2bebfd&&_0x2bebfd[_0x5773('0x20')]){logger['info'](_0x5773('0x21'),'afterCreate',util[_0x5773('0x22')](_0x5773('0x23'),_0x534ab1['id'],_0x2bebfd[_0x5773('0x20')]));if(_0x2bebfd[_0x5773('0x1d')]&&_0x2bebfd[_0x5773('0x1d')][_0x5773('0x24')]){_0x534ab1[_0x5773('0x25')]=_[_0x5773('0x26')](_0x2bebfd[_0x5773('0x1d')][0x0],'Contact');_0x534ab1[_0x5773('0x27')]=_0x2bebfd['Interactions'][0x0][_0x5773('0x27')];}var _0x14b3f0={'method':_0x5773('0x28'),'uri':encodeURI(_0x2bebfd[_0x5773('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x14b3f0[_0x5773('0x29')]){case'GET':_0x14b3f0['qs']=_0x534ab1;break;case _0x5773('0x28'):_0x14b3f0[_0x5773('0xd')]=_0x534ab1;break;}return rp(_0x14b3f0)[_0x5773('0x19')](function(_0x522149){logger[_0x5773('0x2a')](_0x5773('0x21'),'afterCreate',util[_0x5773('0x22')](_0x5773('0x2b'),_0x534ab1['id'],_0x2bebfd[_0x5773('0x20')]));if(_0x522149[_0x5773('0xd')][_0x5773('0x2c')]&&_0x522149[_0x5773('0xd')][_0x5773('0x2c')]!=_0x534ab1[_0x5773('0x25')][_0x5773('0x2c')]){return _0x5ce91b[_0x5773('0x1c')][_0x5773('0x15')]({'threadId':_0x522149['body'][_0x5773('0x2c')]},{'logging':!![],'where':{'id':_0x534ab1[_0x5773('0x25')]['id']}});}else{return;}})['then'](function(){return _0xe5ad5a[_0x5773('0x15')]({'read':!![]});})['catch'](function(_0x5707d3){logger[_0x5773('0x17')](_0x5773('0x21'),_0x5773('0x2d'),util[_0x5773('0x2e')](_0x5707d3,{'showHidden':![],'depth':null}));_0x1cf59b();});}else{_0x1cf59b();}})[_0x5773('0x2f')](function(){_0x1cf59b();});}else{_0x1cf59b();}}},'charset':'utf8mb4','collate':_0x5773('0x30')});}; \ No newline at end of file +var _0x4c24=['GET','info','Message\x20%d\x20forwarded\x20to\x20%s','body','threadId','inspect','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','get','toLowerCase','direction','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt','catch','describe','then','OpenchannelAccount','find','OpenchannelAccountId','Interactions','CmContact','Contact','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','Interaction','omit','POST'];(function(_0x3faf4e,_0x31d6f4){var _0x556e67=function(_0x58c169){while(--_0x58c169){_0x3faf4e['push'](_0x3faf4e['shift']());}};_0x556e67(++_0x31d6f4);}(_0x4c24,0x1c1));var _0x44c2=function(_0x5c8c6c,_0x3e6d9e){_0x5c8c6c=_0x5c8c6c-0x0;var _0x26505b=_0x4c24[_0x5c8c6c];return _0x26505b;};'use strict';var _=require('lodash');var util=require(_0x44c2('0x0'));var logger=require(_0x44c2('0x1'))(_0x44c2('0x2'));var moment=require(_0x44c2('0x3'));var BPromise=require(_0x44c2('0x4'));var rp=require(_0x44c2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x44c2('0x6'));var config=require('../../config/environment');var attributes=require(_0x44c2('0x7'));module[_0x44c2('0x8')]=function(_0x6568dc,_0x125d05){return _0x6568dc[_0x44c2('0x9')](_0x44c2('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x44c2('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x324548,_0x35a820,_0x1c861f){var _0xd9e330=_0x6568dc['models'];var _0x5e6cd8=_0x324548[_0x44c2('0xc')]({'plain':!![]});if(_0x5e6cd8['direction'][_0x44c2('0xd')]()==='in'||_0x5e6cd8[_0x44c2('0xe')]['toLowerCase']()===_0x44c2('0xf')&&!_0x5e6cd8[_0x44c2('0x10')]&&!_[_0x44c2('0x11')](_0x5e6cd8[_0x44c2('0x12')])){_0xd9e330[_0x44c2('0x13')][_0x44c2('0x14')]({'where':{'id':_0x5e6cd8[_0x44c2('0x15')]}})['then'](function(_0x5104ab){if(_0x5104ab){_0x5104ab[_0x44c2('0x16')]({'lastMsgAt':_0x5e6cd8[_0x44c2('0x17')],'lastMsgDirection':_0x5e6cd8[_0x44c2('0xe')][_0x44c2('0xd')]()});}})[_0x44c2('0x18')](function(_0x4a543e){console['error'](_0x4a543e);});}if(_0x5e6cd8[_0x44c2('0xe')]===_0x44c2('0xf')&&!_0x5e6cd8[_0x44c2('0x10')]){var _0x292787;_0xd9e330['CmContact'][_0x44c2('0x19')]()[_0x44c2('0x1a')](function(_0x30cc12){return _0xd9e330[_0x44c2('0x1b')][_0x44c2('0x1c')]({'where':{'id':_0x5e6cd8[_0x44c2('0x1d')]},'include':[{'model':_0xd9e330[_0x44c2('0x13')],'as':_0x44c2('0x1e'),'where':{'id':_0x5e6cd8[_0x44c2('0x15')]},'limit':0x1,'include':[{'model':_0xd9e330[_0x44c2('0x1f')],'as':_0x44c2('0x20'),'attributes':_['keys'](_0x30cc12)}]}]});})['then'](function(_0x947575){_0x292787=_0x947575[_0x44c2('0xc')]({'plain':!![]});if(_0x292787&&_0x292787[_0x44c2('0x21')]){logger['info'](_0x44c2('0x22'),_0x44c2('0x23'),util[_0x44c2('0x24')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x5e6cd8['id'],_0x292787['replyUri']));if(_0x292787[_0x44c2('0x1e')]&&_0x292787[_0x44c2('0x1e')][_0x44c2('0x25')]){_0x5e6cd8[_0x44c2('0x26')]=_[_0x44c2('0x27')](_0x292787[_0x44c2('0x1e')][0x0],_0x44c2('0x20'));_0x5e6cd8[_0x44c2('0x20')]=_0x292787[_0x44c2('0x1e')][0x0][_0x44c2('0x20')];}var _0x35a820={'method':_0x44c2('0x28'),'uri':encodeURI(_0x292787[_0x44c2('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x35a820['method']){case _0x44c2('0x29'):_0x35a820['qs']=_0x5e6cd8;break;case'POST':_0x35a820['body']=_0x5e6cd8;break;}return rp(_0x35a820)[_0x44c2('0x1a')](function(_0x3d59a9){logger[_0x44c2('0x2a')]('OpenchannelMessage,\x20%s,\x20%s',_0x44c2('0x23'),util[_0x44c2('0x24')](_0x44c2('0x2b'),_0x5e6cd8['id'],_0x292787[_0x44c2('0x21')]));if(_0x3d59a9[_0x44c2('0x2c')][_0x44c2('0x2d')]&&_0x3d59a9[_0x44c2('0x2c')][_0x44c2('0x2d')]!=_0x5e6cd8[_0x44c2('0x26')]['threadId']){return _0xd9e330[_0x44c2('0x13')]['update']({'threadId':_0x3d59a9[_0x44c2('0x2c')][_0x44c2('0x2d')]},{'logging':!![],'where':{'id':_0x5e6cd8['Interaction']['id']}});}else{return;}})[_0x44c2('0x1a')](function(){return _0x324548[_0x44c2('0x16')]({'read':!![]});})[_0x44c2('0x18')](function(_0x36e083){logger['error'](_0x44c2('0x22'),_0x44c2('0x23'),util[_0x44c2('0x2e')](_0x36e083,{'showHidden':![],'depth':null}));_0x1c861f();});}else{_0x1c861f();}})[_0x44c2('0x2f')](function(){_0x1c861f();});}else{_0x1c861f();}}},'charset':'utf8mb4','collate':_0x44c2('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index f281af4..101c037 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 _0x8f1a=['defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http'];(function(_0x229f5e,_0x433f0f){var _0x2d62ff=function(_0xe4d381){while(--_0xe4d381){_0x229f5e['push'](_0x229f5e['shift']());}};_0x2d62ff(++_0x433f0f);}(_0x8f1a,0xcd));var _0xa8f1=function(_0x54ce07,_0x45ce1f){_0x54ce07=_0x54ce07-0x0;var _0x2e0a81=_0x8f1a[_0x54ce07];return _0x2e0a81;};'use strict';var _=require(_0xa8f1('0x0'));var util=require(_0xa8f1('0x1'));var moment=require(_0xa8f1('0x2'));var BPromise=require(_0xa8f1('0x3'));var rs=require(_0xa8f1('0x4'));var fs=require('fs');var Redis=require(_0xa8f1('0x5'));var db=require(_0xa8f1('0x6'))['db'];var utils=require(_0xa8f1('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xa8f1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa8f1('0x9')][_0xa8f1('0xa')]({'port':0x232a});config['redis']=_[_0xa8f1('0xb')](config[_0xa8f1('0xc')],{'host':_0xa8f1('0xd'),'port':0x18eb});var socket=require(_0xa8f1('0xe'))(new Redis(config[_0xa8f1('0xc')]));require(_0xa8f1('0xf'))[_0xa8f1('0x10')](socket);function respondWithRpcPromise(_0x394911,_0x587220,_0x20cc24){return new BPromise(function(_0x4403a8,_0x52c874){return client[_0xa8f1('0x11')](_0x394911,_0x20cc24)['then'](function(_0x261a32){logger[_0xa8f1('0x12')](_0xa8f1('0x13'),_0x587220,'request\x20sent');logger[_0xa8f1('0x14')](_0xa8f1('0x15'),_0x587220,_0xa8f1('0x16'),JSON[_0xa8f1('0x17')](_0x261a32));if(_0x261a32[_0xa8f1('0x18')]){if(_0x261a32['error'][_0xa8f1('0x19')]===0x1f4){logger['error'](_0xa8f1('0x13'),_0x587220,_0x261a32[_0xa8f1('0x18')]['message']);return _0x52c874(_0x261a32['error'][_0xa8f1('0x1a')]);}logger[_0xa8f1('0x18')](_0xa8f1('0x13'),_0x587220,_0x261a32[_0xa8f1('0x18')][_0xa8f1('0x1a')]);return _0x4403a8(_0x261a32[_0xa8f1('0x18')][_0xa8f1('0x1a')]);}else{logger[_0xa8f1('0x12')](_0xa8f1('0x13'),_0x587220,_0xa8f1('0x16'));_0x4403a8(_0x261a32[_0xa8f1('0x1b')][_0xa8f1('0x1a')]);}})[_0xa8f1('0x1c')](function(_0x437035){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x587220,_0x437035);_0x52c874(_0x437035);});});}exports[_0xa8f1('0x1d')]=function(_0x378dd9){var _0xac0d42=this;return new Promise(function(_0x4f1dd5,_0x3abcab){return db[_0xa8f1('0x1e')][_0xa8f1('0x1f')](_0x378dd9[_0xa8f1('0x20')],{'raw':_0x378dd9[_0xa8f1('0x21')]?_0x378dd9['options'][_0xa8f1('0x22')]===undefined?!![]:![]:!![]})[_0xa8f1('0x23')](function(_0x4d905c){logger[_0xa8f1('0x12')](_0xa8f1('0x1d'),_0x378dd9);logger[_0xa8f1('0x14')](_0xa8f1('0x1d'),_0x378dd9,JSON[_0xa8f1('0x17')](_0x4d905c));_0x4f1dd5(_0x4d905c);})[_0xa8f1('0x1c')](function(_0xa0ac0f){logger[_0xa8f1('0x18')](_0xa8f1('0x1d'),_0xa0ac0f['message'],_0x378dd9);_0x3abcab(_0xac0d42[_0xa8f1('0x18')](0x1f4,_0xa0ac0f[_0xa8f1('0x1a')]));});});}; \ No newline at end of file +var _0x5532=['CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5532,0x19a));var _0x2553=function(_0x234aaf,_0xa36f2b){_0x234aaf=_0x234aaf-0x0;var _0x3db2d0=_0x5532[_0x234aaf];return _0x3db2d0;};'use strict';var _=require(_0x2553('0x0'));var util=require(_0x2553('0x1'));var moment=require(_0x2553('0x2'));var BPromise=require('bluebird');var rs=require(_0x2553('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2553('0x4'))['db'];var utils=require(_0x2553('0x5'));var logger=require(_0x2553('0x6'))('rpc');var config=require(_0x2553('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2553('0x8')]({'port':0x232a});config[_0x2553('0x9')]=_['defaults'](config[_0x2553('0x9')],{'host':_0x2553('0xa'),'port':0x18eb});var socket=require(_0x2553('0xb'))(new Redis(config[_0x2553('0x9')]));require(_0x2553('0xc'))[_0x2553('0xd')](socket);function respondWithRpcPromise(_0x1d5b78,_0x16c62b,_0x1d3874){return new BPromise(function(_0xf589a5,_0x4f492b){return client[_0x2553('0xe')](_0x1d5b78,_0x1d3874)[_0x2553('0xf')](function(_0x3f32d1){logger['info'](_0x2553('0x10'),_0x16c62b,_0x2553('0x11'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x16c62b,_0x2553('0x11'),JSON['stringify'](_0x3f32d1));if(_0x3f32d1[_0x2553('0x12')]){if(_0x3f32d1[_0x2553('0x12')][_0x2553('0x13')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x16c62b,_0x3f32d1[_0x2553('0x12')][_0x2553('0x14')]);return _0x4f492b(_0x3f32d1[_0x2553('0x12')][_0x2553('0x14')]);}logger[_0x2553('0x12')](_0x2553('0x10'),_0x16c62b,_0x3f32d1['error'][_0x2553('0x14')]);return _0xf589a5(_0x3f32d1[_0x2553('0x12')]['message']);}else{logger[_0x2553('0x15')](_0x2553('0x10'),_0x16c62b,'request\x20sent');_0xf589a5(_0x3f32d1[_0x2553('0x16')][_0x2553('0x14')]);}})[_0x2553('0x17')](function(_0x3f8794){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x16c62b,_0x3f8794);_0x4f492b(_0x3f8794);});});}exports[_0x2553('0x18')]=function(_0x3eba0d){var _0x15ced9=this;return new Promise(function(_0x5642ea,_0x55ceba){return db[_0x2553('0x19')][_0x2553('0x1a')](_0x3eba0d[_0x2553('0x1b')],{'raw':_0x3eba0d['options']?_0x3eba0d[_0x2553('0x1c')][_0x2553('0x1d')]===undefined?!![]:![]:!![]})[_0x2553('0xf')](function(_0x5682dd){logger[_0x2553('0x15')](_0x2553('0x18'),_0x3eba0d);logger[_0x2553('0x1e')](_0x2553('0x18'),_0x3eba0d,JSON['stringify'](_0x5682dd));_0x5642ea(_0x5682dd);})[_0x2553('0x17')](function(_0x25babb){logger['error'](_0x2553('0x18'),_0x25babb[_0x2553('0x14')],_0x3eba0d);_0x55ceba(_0x15ced9['error'](0x1f4,_0x25babb[_0x2553('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 75dc751..7681ee5 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 _0xf4eb=['removeListener','register','./openchannelMessage.events'];(function(_0x2fe689,_0x5794e5){var _0x35ea44=function(_0x51b9d6){while(--_0x51b9d6){_0x2fe689['push'](_0x2fe689['shift']());}};_0x35ea44(++_0x5794e5);}(_0xf4eb,0xec));var _0xbf4e=function(_0x57bffe,_0x52da09){_0x57bffe=_0x57bffe-0x0;var _0x560f49=_0xf4eb[_0x57bffe];return _0x560f49;};'use strict';var OpenchannelMessageEvents=require(_0xbf4e('0x0'));var events=['save','remove','update'];function createListener(_0x5ed5b9,_0xbbbf01){return function(_0x49d80e){_0xbbbf01['emit'](_0x5ed5b9,_0x49d80e);};}function removeListener(_0x2e3070,_0x1c7606){return function(){OpenchannelMessageEvents[_0xbf4e('0x1')](_0x2e3070,_0x1c7606);};}exports[_0xbf4e('0x2')]=function(_0xa4dcf5){for(var _0x2fcfed=0x0,_0x15b99f=events['length'];_0x2fcfed<_0x15b99f;_0x2fcfed++){var _0x449d55=events[_0x2fcfed];var _0x5013c2=createListener('openchannelMessage:'+_0x449d55,_0xa4dcf5);OpenchannelMessageEvents['on'](_0x449d55,_0x5013c2);}}; \ No newline at end of file +var _0xb43b=['./openchannelMessage.events','save','update','emit','removeListener','length','openchannelMessage:'];(function(_0x3f2302,_0x3c3363){var _0x55fed4=function(_0x14d32e){while(--_0x14d32e){_0x3f2302['push'](_0x3f2302['shift']());}};_0x55fed4(++_0x3c3363);}(_0xb43b,0x1b2));var _0xbb43=function(_0x35ca9a,_0x1283ba){_0x35ca9a=_0x35ca9a-0x0;var _0x251c71=_0xb43b[_0x35ca9a];return _0x251c71;};'use strict';var OpenchannelMessageEvents=require(_0xbb43('0x0'));var events=[_0xbb43('0x1'),'remove',_0xbb43('0x2')];function createListener(_0x1995f8,_0x22bc86){return function(_0x4cf605){_0x22bc86[_0xbb43('0x3')](_0x1995f8,_0x4cf605);};}function removeListener(_0x41aff6,_0x351254){return function(){OpenchannelMessageEvents[_0xbb43('0x4')](_0x41aff6,_0x351254);};}exports['register']=function(_0x491fb9){for(var _0x378df5=0x0,_0x553520=events[_0xbb43('0x5')];_0x378df5<_0x553520;_0x378df5++){var _0x1ccd49=events[_0x378df5];var _0x2a2f11=createListener(_0xbb43('0x6')+_0x1ccd49,_0x491fb9);OpenchannelMessageEvents['on'](_0x1ccd49,_0x2a2f11);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 96a1360..bbbeba3 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 _0x22da=['express','Router','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/teams','/:id/users','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','path','connect-timeout'];(function(_0x9622fc,_0x436ce3){var _0x8a8cfa=function(_0xc8e5da){while(--_0xc8e5da){_0x9622fc['push'](_0x9622fc['shift']());}};_0x8a8cfa(++_0x436ce3);}(_0x22da,0x80));var _0xa22d=function(_0x4fecda,_0x548d21){_0x4fecda=_0x4fecda-0x0;var _0xc4d612=_0x22da[_0x4fecda];return _0xc4d612;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa22d('0x0'));var timeout=require(_0xa22d('0x1'));var express=require(_0xa22d('0x2'));var router=express[_0xa22d('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa22d('0x4'));var config=require(_0xa22d('0x5'));var controller=require(_0xa22d('0x6'));router[_0xa22d('0x7')]('/',auth['isAuthenticated'](),controller[_0xa22d('0x8')]);router[_0xa22d('0x7')]('/describe',auth[_0xa22d('0x9')](),controller[_0xa22d('0xa')]);router[_0xa22d('0x7')](_0xa22d('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xa22d('0x7')](_0xa22d('0xc'),auth['isAuthenticated'](),controller[_0xa22d('0xd')]);router[_0xa22d('0x7')](_0xa22d('0xe'),auth[_0xa22d('0x9')](),controller['getTeams']);router['get'](_0xa22d('0xf'),auth[_0xa22d('0x9')](),controller['getAgents']);router[_0xa22d('0x10')]('/',auth['isAuthenticated'](),controller[_0xa22d('0x11')]);router[_0xa22d('0x10')](_0xa22d('0xe'),auth['isAuthenticated'](),controller[_0xa22d('0x12')]);router[_0xa22d('0x10')](_0xa22d('0xf'),auth[_0xa22d('0x9')](),controller[_0xa22d('0x13')]);router['put'](_0xa22d('0xb'),auth[_0xa22d('0x9')](),controller[_0xa22d('0x14')]);router[_0xa22d('0x15')](_0xa22d('0xb'),auth[_0xa22d('0x9')](),controller[_0xa22d('0x16')]);router[_0xa22d('0x15')](_0xa22d('0xe'),auth[_0xa22d('0x9')](),controller[_0xa22d('0x17')]);router[_0xa22d('0x15')](_0xa22d('0xf'),auth[_0xa22d('0x9')](),controller[_0xa22d('0x18')]);module[_0xa22d('0x19')]=router; \ No newline at end of file +var _0xf52f=['../../components/auth/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','create','post','/:id/users','put','update','delete','removeTeams','exports','multer','util','path','express','Router'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xf52f,0x113));var _0xff52=function(_0x2a3982,_0x4b55ab){_0x2a3982=_0x2a3982-0x0;var _0x1a72c2=_0xf52f[_0x2a3982];return _0x1a72c2;};'use strict';var multer=require(_0xff52('0x0'));var util=require(_0xff52('0x1'));var path=require(_0xff52('0x2'));var timeout=require('connect-timeout');var express=require(_0xff52('0x3'));var router=express[_0xff52('0x4')]();var auth=require(_0xff52('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xff52('0x6'));var controller=require(_0xff52('0x7'));router['get']('/',auth[_0xff52('0x8')](),controller[_0xff52('0x9')]);router[_0xff52('0xa')](_0xff52('0xb'),auth[_0xff52('0x8')](),controller[_0xff52('0xc')]);router[_0xff52('0xa')](_0xff52('0xd'),auth[_0xff52('0x8')](),controller[_0xff52('0xe')]);router[_0xff52('0xa')](_0xff52('0xf'),auth[_0xff52('0x8')](),controller[_0xff52('0x10')]);router[_0xff52('0xa')](_0xff52('0x11'),auth[_0xff52('0x8')](),controller[_0xff52('0x12')]);router[_0xff52('0xa')]('/:id/users',auth['isAuthenticated'](),controller[_0xff52('0x13')]);router['post']('/',auth[_0xff52('0x8')](),controller[_0xff52('0x14')]);router[_0xff52('0x15')](_0xff52('0x11'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0xff52('0x16'),auth['isAuthenticated'](),controller['addAgents']);router[_0xff52('0x17')](_0xff52('0xd'),auth[_0xff52('0x8')](),controller[_0xff52('0x18')]);router[_0xff52('0x19')]('/:id',auth[_0xff52('0x8')](),controller['destroy']);router[_0xff52('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xff52('0x1a')]);router[_0xff52('0x19')](_0xff52('0x16'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xff52('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 4c80e84..b39f141 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 _0x7711=['rrmemory','beepall','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x3ba723,_0xfb883){var _0x7cd4b7=function(_0xd2d713){while(--_0xd2d713){_0x3ba723['push'](_0x3ba723['shift']());}};_0x7cd4b7(++_0xfb883);}(_0x7711,0xf7));var _0x1771=function(_0x4bbe60,_0x1be638){_0x4bbe60=_0x4bbe60-0x0;var _0x1be7c0=_0x7711[_0x4bbe60];return _0x1be7c0;};'use strict';var Sequelize=require(_0x1771('0x0'));module[_0x1771('0x1')]={'name':{'type':Sequelize[_0x1771('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1771('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1771('0x4')](_0x1771('0x5'),_0x1771('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x696e=['INTEGER','ENUM','roundrobin','sequelize','STRING','name'];(function(_0x4106a1,_0x52fee1){var _0x8a23f0=function(_0x20dbaa){while(--_0x20dbaa){_0x4106a1['push'](_0x4106a1['shift']());}};_0x8a23f0(++_0x52fee1);}(_0x696e,0x1d1));var _0xe696=function(_0x159307,_0x1911c6){_0x159307=_0x159307-0x0;var _0x56221c=_0x696e[_0x159307];return _0x56221c;};'use strict';var Sequelize=require(_0xe696('0x0'));module['exports']={'name':{'type':Sequelize[_0xe696('0x1')],'unique':_0xe696('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xe696('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe696('0x4')]('rrmemory','beepall',_0xe696('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 2c2c3ba..677c3b0 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 _0x6819=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','end','status','count','offset','set','Content-Range','json','apply','reject','update','destroy','then','get','OpenchannelQueues','UserProfileResource','error','name','index','map','OpenchannelQueue','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','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','params','describe','getMembers','User','agent','openchannelPause','createdAt','rows','format','%s/%s','SIP','updatedAt','getTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','UserOpenchannelQueue','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','from','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','TeamId','all','union','compact','value','isEmpty','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','findOne'];(function(_0x55374d,_0x1bc553){var _0x3979b3=function(_0x4f43ba){while(--_0x4f43ba){_0x55374d['push'](_0x55374d['shift']());}};_0x3979b3(++_0x1bc553);}(_0x6819,0x8a));var _0x9681=function(_0x16fdfb,_0x5e5918){_0x16fdfb=_0x16fdfb-0x0;var _0x496ec0=_0x6819[_0x16fdfb];return _0x496ec0;};'use strict';var pdf=require(_0x9681('0x0'));var emlformat=require(_0x9681('0x1'));var rimraf=require(_0x9681('0x2'));var zipdir=require(_0x9681('0x3'));var jsonpatch=require(_0x9681('0x4'));var rp=require(_0x9681('0x5'));var moment=require(_0x9681('0x6'));var BPromise=require(_0x9681('0x7'));var Mustache=require(_0x9681('0x8'));var util=require(_0x9681('0x9'));var path=require(_0x9681('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9681('0xb'));var squel=require(_0x9681('0xc'));var crypto=require(_0x9681('0xd'));var jsforce=require(_0x9681('0xe'));var deskjs=require(_0x9681('0xf'));var toCsv=require(_0x9681('0x10'));var querystring=require(_0x9681('0x11'));var Papa=require(_0x9681('0x12'));var Redis=require(_0x9681('0x13'));var authService=require(_0x9681('0x14'));var qs=require(_0x9681('0x15'));var as=require(_0x9681('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9681('0x17'))(_0x9681('0x18'));var utils=require(_0x9681('0x19'));var config=require('../../config/environment');var db=require(_0x9681('0x1a'))['db'];config[_0x9681('0x1b')]=_[_0x9681('0x1c')](config[_0x9681('0x1b')],{'host':_0x9681('0x1d'),'port':0x18eb});var socket=require(_0x9681('0x1e'))(new Redis(config[_0x9681('0x1b')]));require('./openchannelQueue.socket')[_0x9681('0x1f')](socket);function respondWithStatusCode(_0xc617e6,_0x29388d){_0x29388d=_0x29388d||0xcc;return function(_0x227aa2){if(_0x227aa2){return _0xc617e6['sendStatus'](_0x29388d);}return _0xc617e6['status'](_0x29388d)[_0x9681('0x20')]();};}function respondWithResult(_0x5589e3,_0x4e6f3e){_0x4e6f3e=_0x4e6f3e||0xc8;return function(_0x4a30fc){if(_0x4a30fc){return _0x5589e3[_0x9681('0x21')](_0x4e6f3e)['json'](_0x4a30fc);}};}function respondWithFilteredResult(_0x126e9c,_0x424ebd){return function(_0x4602c2){if(_0x4602c2){var _0x33dade=_0x4602c2[_0x9681('0x22')],_0x1abe85=_0x424ebd[_0x9681('0x23')],_0x4436f6=_0x424ebd[_0x9681('0x23')]+_0x424ebd['limit'],_0x36aa9e;if(_0x4436f6>=_0x33dade){_0x4436f6=_0x33dade;_0x36aa9e=0xc8;}else{_0x36aa9e=0xce;}_0x126e9c[_0x9681('0x21')](_0x36aa9e);return _0x126e9c[_0x9681('0x24')](_0x9681('0x25'),_0x1abe85+'-'+_0x4436f6+'/'+_0x33dade)[_0x9681('0x26')](_0x4602c2);}return null;};}function patchUpdates(_0x51b180){return function(_0xbcacdf){try{jsonpatch[_0x9681('0x27')](_0xbcacdf,_0x51b180,!![]);}catch(_0x43da73){return BPromise[_0x9681('0x28')](_0x43da73);}return _0xbcacdf['save']();};}function saveUpdates(_0x535ecd,_0x48f99e){return function(_0x4bd3f8){if(_0x4bd3f8){return _0x4bd3f8[_0x9681('0x29')](_0x535ecd)['then'](function(_0x29cf63){return _0x29cf63;});}return null;};}function removeEntity(_0x140d69,_0x4c0fba){return function(_0x735673){if(_0x735673){return _0x735673[_0x9681('0x2a')]()[_0x9681('0x2b')](function(){var _0x5dab52=_0x735673[_0x9681('0x2c')]({'plain':!![]});var _0x1133c9=_0x9681('0x2d');return db[_0x9681('0x2e')][_0x9681('0x2a')]({'where':{'type':_0x1133c9,'resourceId':_0x5dab52['id']}})[_0x9681('0x2b')](function(){return _0x735673;});})[_0x9681('0x2b')](function(){_0x140d69[_0x9681('0x21')](0xcc)[_0x9681('0x20')]();});}};}function handleEntityNotFound(_0x445aa2,_0x2f1520){return function(_0x22d12b){if(!_0x22d12b){_0x445aa2['sendStatus'](0x194);}return _0x22d12b;};}function handleError(_0xaf6399,_0x2e6a66){_0x2e6a66=_0x2e6a66||0x1f4;return function(_0x1fdc3c){logger[_0x9681('0x2f')](_0x1fdc3c['stack']);if(_0x1fdc3c[_0x9681('0x30')]){delete _0x1fdc3c[_0x9681('0x30')];}_0xaf6399[_0x9681('0x21')](_0x2e6a66)['send'](_0x1fdc3c);};}exports[_0x9681('0x31')]=function(_0x48b6c2,_0xfc502b){var _0x1c73c0={},_0x4bb542={},_0x5a3872={'count':0x0,'rows':[]};var _0x3ced5a=_[_0x9681('0x32')](db[_0x9681('0x33')]['rawAttributes'],function(_0x2a9013){return{'name':_0x2a9013['fieldName'],'type':_0x2a9013['type']['key']};});_0x4bb542[_0x9681('0x34')]=_[_0x9681('0x32')](_0x3ced5a,_0x9681('0x30'));_0x4bb542[_0x9681('0x35')]=_[_0x9681('0x36')](_0x48b6c2[_0x9681('0x35')]);_0x4bb542['filters']=_[_0x9681('0x37')](_0x4bb542[_0x9681('0x34')],_0x4bb542['query']);_0x1c73c0['attributes']=_['intersection'](_0x4bb542[_0x9681('0x34')],qs[_0x9681('0x38')](_0x48b6c2[_0x9681('0x35')][_0x9681('0x38')]));_0x1c73c0[_0x9681('0x39')]=_0x1c73c0[_0x9681('0x39')][_0x9681('0x3a')]?_0x1c73c0[_0x9681('0x39')]:_0x4bb542[_0x9681('0x34')];if(!_0x48b6c2[_0x9681('0x35')][_0x9681('0x3b')](_0x9681('0x3c'))){_0x1c73c0[_0x9681('0x3d')]=qs[_0x9681('0x3d')](_0x48b6c2[_0x9681('0x35')]['limit']);_0x1c73c0[_0x9681('0x23')]=qs['offset'](_0x48b6c2[_0x9681('0x35')][_0x9681('0x23')]);}_0x1c73c0[_0x9681('0x3e')]=qs['sort'](_0x48b6c2[_0x9681('0x35')][_0x9681('0x3f')]);_0x1c73c0[_0x9681('0x40')]=qs[_0x9681('0x41')](_[_0x9681('0x42')](_0x48b6c2[_0x9681('0x35')],_0x4bb542[_0x9681('0x41')]));if(_0x48b6c2[_0x9681('0x35')][_0x9681('0x43')]){_0x1c73c0[_0x9681('0x40')]=_[_0x9681('0x44')](_0x1c73c0[_0x9681('0x40')],{'$or':_[_0x9681('0x32')](_0x3ced5a,function(_0x16bdbf){if(_0x16bdbf[_0x9681('0x45')]!==_0x9681('0x46')){var _0x1ddc30={};_0x1ddc30[_0x16bdbf['name']]={'$like':'%'+_0x48b6c2['query'][_0x9681('0x43')]+'%'};return _0x1ddc30;}})});}_0x1c73c0=_[_0x9681('0x44')]({},_0x1c73c0,_0x48b6c2[_0x9681('0x47')]);var _0x4991ae={'where':_0x1c73c0[_0x9681('0x40')]};return db[_0x9681('0x33')][_0x9681('0x22')](_0x4991ae)[_0x9681('0x2b')](function(_0x2d6d7e){_0x5a3872['count']=_0x2d6d7e;if(_0x48b6c2[_0x9681('0x35')]['includeAll']){_0x1c73c0[_0x9681('0x48')]=[{'all':!![]}];}return db[_0x9681('0x33')][_0x9681('0x49')](_0x1c73c0);})['then'](function(_0x138364){_0x5a3872['rows']=_0x138364;return _0x5a3872;})['then'](respondWithFilteredResult(_0xfc502b,_0x1c73c0))[_0x9681('0x4a')](handleError(_0xfc502b,null));};exports['show']=function(_0x43b24e,_0x4c0d18){var _0xefcf8e={'raw':!![],'where':{'id':_0x43b24e['params']['id']}},_0x4d1390={};_0x4d1390[_0x9681('0x34')]=_[_0x9681('0x36')](db[_0x9681('0x33')][_0x9681('0x4b')]);_0x4d1390[_0x9681('0x35')]=_[_0x9681('0x36')](_0x43b24e[_0x9681('0x35')]);_0x4d1390[_0x9681('0x41')]=_[_0x9681('0x37')](_0x4d1390[_0x9681('0x34')],_0x4d1390[_0x9681('0x35')]);_0xefcf8e['attributes']=_['intersection'](_0x4d1390[_0x9681('0x34')],qs[_0x9681('0x38')](_0x43b24e[_0x9681('0x35')]['fields']));_0xefcf8e[_0x9681('0x39')]=_0xefcf8e[_0x9681('0x39')]['length']?_0xefcf8e['attributes']:_0x4d1390['model'];if(_0x43b24e['query']['includeAll']){_0xefcf8e['include']=[{'all':!![]}];}_0xefcf8e=_[_0x9681('0x44')]({},_0xefcf8e,_0x43b24e[_0x9681('0x47')]);return db[_0x9681('0x33')][_0x9681('0x4c')](_0xefcf8e)[_0x9681('0x2b')](handleEntityNotFound(_0x4c0d18,null))[_0x9681('0x2b')](respondWithResult(_0x4c0d18,null))['catch'](handleError(_0x4c0d18,null));};exports[_0x9681('0x4d')]=function(_0x4b8343,_0x3563cd){return db[_0x9681('0x33')][_0x9681('0x4d')](_0x4b8343[_0x9681('0x4e')],{})[_0x9681('0x2b')](function(_0x196dcc){var _0x304b56=_0x4b8343[_0x9681('0x4f')][_0x9681('0x2c')]({'plain':!![]});if(!_0x304b56)throw new Error(_0x9681('0x50'));if(_0x304b56[_0x9681('0x51')]==='user'){var _0x677b6b=_0x196dcc['get']({'plain':!![]});var _0x2ecbf6=_0x9681('0x2d');return db[_0x9681('0x52')][_0x9681('0x4c')]({'where':{'name':_0x2ecbf6,'userProfileId':_0x304b56[_0x9681('0x53')]},'raw':!![]})['then'](function(_0x5ad82c){if(_0x5ad82c&&_0x5ad82c['autoAssociation']===0x0){return db[_0x9681('0x2e')][_0x9681('0x4d')]({'name':_0x677b6b['name'],'resourceId':_0x677b6b['id'],'type':_0x5ad82c[_0x9681('0x30')],'sectionId':_0x5ad82c['id']},{})['then'](function(){return _0x196dcc;});}else{return _0x196dcc;}})[_0x9681('0x4a')](function(_0x2c86e4){logger[_0x9681('0x2f')](_0x9681('0x54'),_0x2c86e4);throw _0x2c86e4;});}return _0x196dcc;})[_0x9681('0x2b')](respondWithResult(_0x3563cd,0xc9))[_0x9681('0x4a')](handleError(_0x3563cd,null));};exports[_0x9681('0x29')]=function(_0x20be51,_0x105067){if(_0x20be51[_0x9681('0x4e')]['id']){delete _0x20be51[_0x9681('0x4e')]['id'];}return db[_0x9681('0x33')][_0x9681('0x4c')]({'where':{'id':_0x20be51[_0x9681('0x55')]['id']}})[_0x9681('0x2b')](handleEntityNotFound(_0x105067,null))['then'](saveUpdates(_0x20be51[_0x9681('0x4e')],null))[_0x9681('0x2b')](respondWithResult(_0x105067,null))[_0x9681('0x4a')](handleError(_0x105067,null));};exports[_0x9681('0x2a')]=function(_0xc7031e,_0x446970){return db[_0x9681('0x33')][_0x9681('0x4c')]({'where':{'id':_0xc7031e[_0x9681('0x55')]['id']}})['then'](handleEntityNotFound(_0x446970,null))[_0x9681('0x2b')](removeEntity(_0x446970,null))['catch'](handleError(_0x446970,null));};exports[_0x9681('0x56')]=function(_0x123390,_0x5e64f9){return db[_0x9681('0x33')][_0x9681('0x56')]()[_0x9681('0x2b')](respondWithResult(_0x5e64f9,null))['catch'](handleError(_0x5e64f9,null));};exports[_0x9681('0x57')]=function(_0xed9596,_0x3c112b,_0x10fd60){var _0x41b50d={'raw':!![],'where':{}},_0xf96a85={},_0x4af9e1;return db[_0x9681('0x33')]['findOne']({'where':{'id':_0xed9596['params']['id']}})[_0x9681('0x2b')](handleEntityNotFound(_0x3c112b,null))[_0x9681('0x2b')](function(_0xc94246){if(_0xc94246){_0x4af9e1=_0xc94246['get']({'plain':!![]});_0xf96a85[_0x9681('0x34')]=_[_0x9681('0x36')](db['UserOpenchannelQueue']['rawAttributes']);_0xf96a85[_0x9681('0x35')]=_[_0x9681('0x36')](_0xed9596[_0x9681('0x35')]);_0xf96a85[_0x9681('0x41')]=_[_0x9681('0x37')](_0xf96a85[_0x9681('0x34')],_0xf96a85[_0x9681('0x35')]);_0x41b50d['attributes']=_['intersection'](_0xf96a85[_0x9681('0x34')],qs[_0x9681('0x38')](_0xed9596[_0x9681('0x35')]['fields']));_0x41b50d[_0x9681('0x39')]=_0x41b50d['attributes']['length']?_0x41b50d[_0x9681('0x39')]:_0xf96a85['model'];if(!_0xed9596[_0x9681('0x35')][_0x9681('0x3b')]('nolimit')){_0x41b50d[_0x9681('0x3d')]=qs[_0x9681('0x3d')](_0xed9596[_0x9681('0x35')][_0x9681('0x3d')]);_0x41b50d[_0x9681('0x23')]=qs[_0x9681('0x23')](_0xed9596['query'][_0x9681('0x23')]);}_0x41b50d[_0x9681('0x3e')]=qs['sort'](_0xed9596['query'][_0x9681('0x3f')]);_0x41b50d['where']=qs[_0x9681('0x41')](_[_0x9681('0x42')](_0xed9596[_0x9681('0x35')],_0xf96a85[_0x9681('0x41')]));_0x41b50d[_0x9681('0x40')]['OpenchannelQueueId']=_0xc94246['id'];if(_0xed9596[_0x9681('0x35')]['filter']){_0x41b50d[_0x9681('0x40')]=_[_0x9681('0x44')](_0x41b50d[_0x9681('0x40')],{'$or':_[_0x9681('0x32')](_0x41b50d[_0x9681('0x39')],function(_0x3a82c3){var _0x17e061={};_0x17e061[_0x3a82c3]={'$like':'%'+_0xed9596['query']['filter']+'%'};return _0x17e061;})});}_0x41b50d=_[_0x9681('0x44')]({},_0x41b50d,_0xed9596[_0x9681('0x47')]);return db['UserOpenchannelQueue']['findAll'](_0x41b50d);}})[_0x9681('0x2b')](function(_0x47ff4d){if(_0x47ff4d){return db[_0x9681('0x58')]['findAndCountAll']({'where':{'id':_['map'](_0x47ff4d,'UserId'),'role':_0x9681('0x59')},'attributes':['id',_0x9681('0x30'),_0x9681('0x5a'),'updatedAt',_0x9681('0x5b')]});}})['then'](function(_0x55a7a8){if(_0x55a7a8){return{'count':_0x55a7a8[_0x9681('0x22')],'rows':_['map'](_0x55a7a8[_0x9681('0x5c')],function(_0x470763){return{'membername':_0x470763[_0x9681('0x30')],'UserId':_0x470763['id'],'queue_name':_0x4af9e1['name'],'OpenchannelQueueId':_0x4af9e1['id'],'interface':util[_0x9681('0x5d')](_0x9681('0x5e'),_0x9681('0x5f'),_0x470763['name']),'penalty':0x0,'paused':_0x470763[_0x9681('0x5a')],'createdAt':_0x470763[_0x9681('0x5b')],'updatedAt':_0x470763[_0x9681('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9681('0x2b')](respondWithFilteredResult(_0x3c112b,_0x41b50d))[_0x9681('0x4a')](handleError(_0x3c112b,null));};exports[_0x9681('0x61')]=function(_0x5d85d9,_0xe9f051,_0x547cef){var _0x5e1046={};var _0x21f1fa={};var _0x54de6c;var _0x23ae00;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x5d85d9['params']['id']}})['then'](handleEntityNotFound(_0xe9f051,null))[_0x9681('0x2b')](function(_0x109a0e){if(_0x109a0e){_0x54de6c=_0x109a0e;_0x21f1fa[_0x9681('0x34')]=_['keys'](db['Team'][_0x9681('0x4b')]);_0x21f1fa[_0x9681('0x35')]=_['keys'](_0x5d85d9[_0x9681('0x35')]);_0x21f1fa[_0x9681('0x41')]=_[_0x9681('0x37')](_0x21f1fa[_0x9681('0x34')],_0x21f1fa[_0x9681('0x35')]);_0x5e1046[_0x9681('0x39')]=_[_0x9681('0x37')](_0x21f1fa['model'],qs[_0x9681('0x38')](_0x5d85d9[_0x9681('0x35')][_0x9681('0x38')]));_0x5e1046[_0x9681('0x39')]=_0x5e1046[_0x9681('0x39')]['length']?_0x5e1046[_0x9681('0x39')]:_0x21f1fa[_0x9681('0x34')];_0x5e1046[_0x9681('0x3e')]=qs[_0x9681('0x3f')](_0x5d85d9[_0x9681('0x35')]['sort']);_0x5e1046[_0x9681('0x40')]=qs['filters'](_[_0x9681('0x42')](_0x5d85d9['query'],_0x21f1fa[_0x9681('0x41')]));if(_0x5d85d9['query'][_0x9681('0x43')]){_0x5e1046['where']=_['merge'](_0x5e1046[_0x9681('0x40')],{'$or':_[_0x9681('0x32')](_0x5e1046[_0x9681('0x39')],function(_0x59deb2){var _0x590a6b={};_0x590a6b[_0x59deb2]={'$like':'%'+_0x5d85d9[_0x9681('0x35')]['filter']+'%'};return _0x590a6b;})});}_0x5e1046=_[_0x9681('0x44')]({},_0x5e1046,_0x5d85d9[_0x9681('0x47')]);return _0x54de6c[_0x9681('0x61')](_0x5e1046);}})[_0x9681('0x2b')](function(_0x263bd8){if(_0x263bd8){_0x23ae00=_0x263bd8['length'];if(!_0x5d85d9[_0x9681('0x35')]['hasOwnProperty'](_0x9681('0x3c'))){_0x5e1046[_0x9681('0x3d')]=qs[_0x9681('0x3d')](_0x5d85d9['query'][_0x9681('0x3d')]);_0x5e1046[_0x9681('0x23')]=qs[_0x9681('0x23')](_0x5d85d9[_0x9681('0x35')][_0x9681('0x23')]);}return _0x54de6c[_0x9681('0x61')](_0x5e1046);}})['then'](function(_0x4eb393){if(_0x4eb393){return _0x4eb393?{'count':_0x23ae00,'rows':_0x4eb393}:null;}})[_0x9681('0x2b')](respondWithResult(_0xe9f051,null))[_0x9681('0x4a')](handleError(_0xe9f051,null));};exports['addTeams']=function(_0x3bade8,_0x3af7ed,_0x39778e){var _0x27b28b=_0x3bade8['body'][_0x9681('0x62')];return db['Team'][_0x9681('0x49')]({'where':{'id':_0x27b28b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9681('0x63'),'attributes':['id',_0x9681('0x30'),'online',_0x9681('0x64'),_0x9681('0x65')],'raw':!![]}]})['then'](function(_0x44fd99){if(_0x44fd99){var _0x547e5f=_[_0x9681('0x66')](_0x44fd99,function(_0x15fffd){var _0x45c37a=_0x15fffd[_0x9681('0x2c')]({'plain':!![]});return _0x45c37a[_0x9681('0x63')];});return db[_0x9681('0x33')]['find']({'where':{'id':_0x3bade8[_0x9681('0x55')]['id']}})['then'](function(_0x2bd3d2){return db[_0x9681('0x67')][_0x9681('0x68')](function(_0x1449fb){return _0x2bd3d2[_0x9681('0x69')](_0x27b28b,{'transaction':_0x1449fb})['then'](function(){return BPromise[_0x9681('0x6a')](_0x547e5f,function(_0x3c5287){return db[_0x9681('0x6b')][_0x9681('0x6c')]({'where':{'UserId':_0x3c5287['id'],'OpenchannelQueueId':_0x3bade8[_0x9681('0x55')]['id']},'transaction':_0x1449fb});});})[_0x9681('0x2b')](function(){_0x547e5f[_0x9681('0x6d')](function(_0x53327b){socket[_0x9681('0x6e')](_0x9681('0x6f'),{'UserId':_0x53327b['id'],'OpenchannelQueueId':_0x2bd3d2['id']});});});});});}})[_0x9681('0x2b')](respondWithStatusCode(_0x3af7ed,null))[_0x9681('0x4a')](handleError(_0x3af7ed,null));};exports[_0x9681('0x70')]=function(_0x45a160,_0x5a2d27,_0x24ff5b){return db['Team'][_0x9681('0x49')]({'where':{'id':_0x45a160[_0x9681('0x35')][_0x9681('0x62')]},'attributes':['id'],'include':[{'model':db[_0x9681('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9681('0x2b')](handleEntityNotFound(_0x5a2d27,null))[_0x9681('0x2b')](function(_0x300688){var _0x971414=_['map'](_0x300688,'id');var _0x4d368a=[];var _0x477e14=[];var _0x541eb9=squel[_0x9681('0x71')]();_0x541eb9[_0x9681('0x72')]('tq.TeamId')[_0x9681('0x73')]('team_has_openchannel_queues','tq')[_0x9681('0x74')](_0x9681('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9681('0x40')](_0x9681('0x76'),_0x45a160[_0x9681('0x55')]['id']);for(var _0x47e4a1=0x0;_0x47e4a1<_0x300688['length'];_0x47e4a1+=0x1){let _0x1601f6=_0x300688[_0x47e4a1];for(var _0x9b496b=0x0;_0x9b496b<_0x1601f6[_0x9681('0x63')]['length'];_0x9b496b+=0x1){let _0x40ae0b=_0x1601f6[_0x9681('0x63')][_0x9b496b];var _0x10e7ab=_0x541eb9[_0x9681('0x77')]();_0x10e7ab[_0x9681('0x40')]('ut.UserId\x20=\x20?',_0x40ae0b['id']);_0x477e14[_0x9681('0x78')](db[_0x9681('0x67')][_0x9681('0x35')](_0x10e7ab[_0x9681('0x79')](),{'type':db[_0x9681('0x67')][_0x9681('0x7a')]['SELECT']})[_0x9681('0x2b')](function(_0x292d0c){if(_0x292d0c['length']===0x1){return _0x40ae0b['id'];}else{var _0x5a05e4=_[_0x9681('0x7b')](_['map'](_0x292d0c,_0x9681('0x7c')),function(_0xc7cacf){return _['includes'](_0x971414,_0xc7cacf);});if(_0x5a05e4){return _0x40ae0b['id'];}}}));}}return BPromise[_0x9681('0x7d')](_0x477e14)[_0x9681('0x2b')](function(_0x1257e8){_0x4d368a=_(_0x4d368a)[_0x9681('0x7e')](_0x1257e8)[_0x9681('0x7f')]()[_0x9681('0x80')]();return db['OpenchannelQueue'][_0x9681('0x4c')]({'where':{'id':_0x45a160[_0x9681('0x55')]['id']}})[_0x9681('0x2b')](function(_0x532968){return db[_0x9681('0x67')]['transaction'](function(_0x178e1f){return _0x532968['removeTeams'](_0x45a160[_0x9681('0x35')][_0x9681('0x62')],{'transaction':_0x178e1f})[_0x9681('0x2b')](function(){if(!_[_0x9681('0x81')](_0x4d368a)){return _0x532968['removeAgents'](_0x4d368a,{'transaction':_0x178e1f});}})[_0x9681('0x2b')](function(){_0x4d368a[_0x9681('0x6d')](function(_0x5217f7){socket[_0x9681('0x6e')](_0x9681('0x82'),{'UserId':_0x5217f7,'OpenchannelQueueId':_0x532968['id']});});});});});});})[_0x9681('0x2b')](respondWithStatusCode(_0x5a2d27,null))[_0x9681('0x4a')](handleError(_0x5a2d27,null));};exports[_0x9681('0x83')]=function(_0x2d6681,_0x5b387d,_0x450698){return db['OpenchannelQueue'][_0x9681('0x4c')]({'where':{'id':_0x2d6681['params']['id']}})[_0x9681('0x2b')](handleEntityNotFound(_0x5b387d,null))['then'](function(_0x11ddff){if(_0x11ddff){return _0x11ddff[_0x9681('0x83')](_0x2d6681[_0x9681('0x4e')][_0x9681('0x62')],_[_0x9681('0x84')](_0x2d6681[_0x9681('0x4e')],['ids','id'])||{})[_0x9681('0x85')](function(_0x5110b9){for(var _0x2ddde7=0x0;_0x2ddde7<_0x2d6681['body'][_0x9681('0x62')][_0x9681('0x3a')];_0x2ddde7+=0x1){socket[_0x9681('0x6e')](_0x9681('0x6f'),{'UserId':_0x2d6681[_0x9681('0x4e')][_0x9681('0x62')][_0x2ddde7],'OpenchannelQueueId':_0x2d6681[_0x9681('0x55')]['id']});}return _0x5110b9;});}})['then'](respondWithResult(_0x5b387d,null))[_0x9681('0x4a')](handleError(_0x5b387d,null));};exports[_0x9681('0x86')]=function(_0x5b4b29,_0x4dfb49,_0x3de110){return db[_0x9681('0x33')][_0x9681('0x4c')]({'where':{'id':_0x5b4b29[_0x9681('0x55')]['id']}})['then'](handleEntityNotFound(_0x4dfb49,null))[_0x9681('0x2b')](function(_0x1559bf){if(_0x1559bf){return _0x1559bf[_0x9681('0x86')](_0x5b4b29['query']['ids'])[_0x9681('0x2b')](function(){if(_[_0x9681('0x87')](_0x5b4b29[_0x9681('0x35')][_0x9681('0x62')])){for(var _0x302273=0x0;_0x302273<_0x5b4b29[_0x9681('0x35')][_0x9681('0x62')][_0x9681('0x3a')];_0x302273+=0x1){socket[_0x9681('0x6e')](_0x9681('0x82'),{'UserId':Number(_0x5b4b29[_0x9681('0x35')]['ids'][_0x302273]),'OpenchannelQueueId':Number(_0x5b4b29[_0x9681('0x55')]['id'])});}}else{socket[_0x9681('0x6e')](_0x9681('0x82'),{'UserId':Number(_0x5b4b29['query'][_0x9681('0x62')]),'OpenchannelQueueId':Number(_0x5b4b29[_0x9681('0x55')]['id'])});}});}})[_0x9681('0x2b')](respondWithStatusCode(_0x4dfb49,null))[_0x9681('0x4a')](handleError(_0x4dfb49,null));};exports[_0x9681('0x88')]=function(_0x1aba3d,_0x54048e,_0x1261a3){var _0x4e7ad8={};var _0x27b394={};var _0x408c90;var _0x530c7a;return db[_0x9681('0x33')][_0x9681('0x89')]({'where':{'id':_0x1aba3d[_0x9681('0x55')]['id']}})[_0x9681('0x2b')](handleEntityNotFound(_0x54048e,null))['then'](function(_0x3855e0){if(_0x3855e0){_0x408c90=_0x3855e0;_0x27b394['model']=_[_0x9681('0x36')](db[_0x9681('0x58')][_0x9681('0x4b')]);_0x27b394[_0x9681('0x35')]=_['keys'](_0x1aba3d['query']);_0x27b394[_0x9681('0x41')]=_[_0x9681('0x37')](_0x27b394['model'],_0x27b394['query']);_0x4e7ad8[_0x9681('0x39')]=_[_0x9681('0x37')](_0x27b394[_0x9681('0x34')],qs['fields'](_0x1aba3d[_0x9681('0x35')][_0x9681('0x38')]));_0x4e7ad8[_0x9681('0x39')]=_0x4e7ad8[_0x9681('0x39')][_0x9681('0x3a')]?_0x4e7ad8[_0x9681('0x39')]:_0x27b394[_0x9681('0x34')];_0x4e7ad8['order']=qs[_0x9681('0x3f')](_0x1aba3d[_0x9681('0x35')][_0x9681('0x3f')]);_0x4e7ad8[_0x9681('0x40')]=qs[_0x9681('0x41')](_[_0x9681('0x42')](_0x1aba3d[_0x9681('0x35')],_0x27b394[_0x9681('0x41')]));if(_0x1aba3d[_0x9681('0x35')][_0x9681('0x43')]){_0x4e7ad8['where']=_[_0x9681('0x44')](_0x4e7ad8[_0x9681('0x40')],{'$or':_[_0x9681('0x32')](_0x4e7ad8['attributes'],function(_0x2b3007){var _0x3914b1={};_0x3914b1[_0x2b3007]={'$like':'%'+_0x1aba3d[_0x9681('0x35')][_0x9681('0x43')]+'%'};return _0x3914b1;})});}_0x4e7ad8=_['merge']({},_0x4e7ad8,_0x1aba3d['options']);return _0x408c90['getAgents'](_0x4e7ad8);}})['then'](function(_0x2ef0d7){if(_0x2ef0d7){_0x530c7a=_0x2ef0d7['length'];if(!_0x1aba3d[_0x9681('0x35')][_0x9681('0x3b')]('nolimit')){_0x4e7ad8['limit']=qs[_0x9681('0x3d')](_0x1aba3d['query']['limit']);_0x4e7ad8[_0x9681('0x23')]=qs[_0x9681('0x23')](_0x1aba3d[_0x9681('0x35')][_0x9681('0x23')]);}return _0x408c90[_0x9681('0x88')](_0x4e7ad8);}})['then'](function(_0x2b67ce){if(_0x2b67ce){return _0x2b67ce?{'count':_0x530c7a,'rows':_0x2b67ce}:null;}})['then'](respondWithResult(_0x54048e,null))[_0x9681('0x4a')](handleError(_0x54048e,null));}; \ No newline at end of file +var _0x20ff=['key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','OpenchannelQueue','count','includeAll','include','findAll','rows','show','params','options','catch','create','user','role','OpenchannelQueues','find','userProfileId','UserProfileResource','update','body','describe','getMembers','UserOpenchannelQueue','User','findAndCountAll','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','findOne','addTeams','ids','Team','Agents','online','voicePause','interface','sequelize','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','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?','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userOpenchannelQueue:remove','spread','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','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','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','status','offset','limit','Content-Range','json','apply','reject','save','then','destroy','get','end','sendStatus','error','stack','name','map','rawAttributes','fieldName','type'];(function(_0xe6b674,_0x267db9){var _0x2a6236=function(_0x4b6f69){while(--_0x4b6f69){_0xe6b674['push'](_0xe6b674['shift']());}};_0x2a6236(++_0x267db9);}(_0x20ff,0x16e));var _0xf20f=function(_0x3a6a1d,_0x535363){_0x3a6a1d=_0x3a6a1d-0x0;var _0xf4cb8b=_0x20ff[_0x3a6a1d];return _0xf4cb8b;};'use strict';var pdf=require(_0xf20f('0x0'));var emlformat=require(_0xf20f('0x1'));var rimraf=require(_0xf20f('0x2'));var zipdir=require(_0xf20f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf20f('0x4'));var BPromise=require(_0xf20f('0x5'));var Mustache=require(_0xf20f('0x6'));var util=require(_0xf20f('0x7'));var path=require(_0xf20f('0x8'));var sox=require('sox');var csv=require(_0xf20f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf20f('0xa'));var squel=require(_0xf20f('0xb'));var crypto=require(_0xf20f('0xc'));var jsforce=require(_0xf20f('0xd'));var deskjs=require(_0xf20f('0xe'));var toCsv=require(_0xf20f('0x9'));var querystring=require('querystring');var Papa=require(_0xf20f('0xf'));var Redis=require(_0xf20f('0x10'));var authService=require(_0xf20f('0x11'));var qs=require(_0xf20f('0x12'));var as=require(_0xf20f('0x13'));var hardwareService=require(_0xf20f('0x14'));var logger=require(_0xf20f('0x15'))(_0xf20f('0x16'));var utils=require(_0xf20f('0x17'));var config=require(_0xf20f('0x18'));var db=require(_0xf20f('0x19'))['db'];config[_0xf20f('0x1a')]=_[_0xf20f('0x1b')](config[_0xf20f('0x1a')],{'host':_0xf20f('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf20f('0x1d'))[_0xf20f('0x1e')](socket);function respondWithStatusCode(_0x52f460,_0xe0f944){_0xe0f944=_0xe0f944||0xcc;return function(_0x1b2a94){if(_0x1b2a94){return _0x52f460['sendStatus'](_0xe0f944);}return _0x52f460[_0xf20f('0x1f')](_0xe0f944)['end']();};}function respondWithResult(_0x13b19c,_0x182017){_0x182017=_0x182017||0xc8;return function(_0x578d9e){if(_0x578d9e){return _0x13b19c[_0xf20f('0x1f')](_0x182017)['json'](_0x578d9e);}};}function respondWithFilteredResult(_0x3acfd1,_0x588e89){return function(_0x11ee0e){if(_0x11ee0e){var _0x5f3eb7=_0x11ee0e['count'],_0x4060c0=_0x588e89[_0xf20f('0x20')],_0x15924a=_0x588e89[_0xf20f('0x20')]+_0x588e89[_0xf20f('0x21')],_0xecf7e2;if(_0x15924a>=_0x5f3eb7){_0x15924a=_0x5f3eb7;_0xecf7e2=0xc8;}else{_0xecf7e2=0xce;}_0x3acfd1[_0xf20f('0x1f')](_0xecf7e2);return _0x3acfd1['set'](_0xf20f('0x22'),_0x4060c0+'-'+_0x15924a+'/'+_0x5f3eb7)[_0xf20f('0x23')](_0x11ee0e);}return null;};}function patchUpdates(_0x346825){return function(_0x5699e7){try{jsonpatch[_0xf20f('0x24')](_0x5699e7,_0x346825,!![]);}catch(_0x1d67de){return BPromise[_0xf20f('0x25')](_0x1d67de);}return _0x5699e7[_0xf20f('0x26')]();};}function saveUpdates(_0x5455a9,_0x14bb51){return function(_0x4f3df3){if(_0x4f3df3){return _0x4f3df3['update'](_0x5455a9)[_0xf20f('0x27')](function(_0x1f8929){return _0x1f8929;});}return null;};}function removeEntity(_0x1c5a08,_0x2649ca){return function(_0x10017b){if(_0x10017b){return _0x10017b[_0xf20f('0x28')]()[_0xf20f('0x27')](function(){var _0x5ae00a=_0x10017b[_0xf20f('0x29')]({'plain':!![]});var _0xefe2f3='OpenchannelQueues';return db['UserProfileResource'][_0xf20f('0x28')]({'where':{'type':_0xefe2f3,'resourceId':_0x5ae00a['id']}})[_0xf20f('0x27')](function(){return _0x10017b;});})[_0xf20f('0x27')](function(){_0x1c5a08[_0xf20f('0x1f')](0xcc)[_0xf20f('0x2a')]();});}};}function handleEntityNotFound(_0x35c5c2,_0x48d3c4){return function(_0x1320c5){if(!_0x1320c5){_0x35c5c2[_0xf20f('0x2b')](0x194);}return _0x1320c5;};}function handleError(_0x4dcf57,_0xd85e82){_0xd85e82=_0xd85e82||0x1f4;return function(_0x50748b){logger[_0xf20f('0x2c')](_0x50748b[_0xf20f('0x2d')]);if(_0x50748b[_0xf20f('0x2e')]){delete _0x50748b[_0xf20f('0x2e')];}_0x4dcf57[_0xf20f('0x1f')](_0xd85e82)['send'](_0x50748b);};}exports['index']=function(_0x4d41cf,_0x4b296b){var _0x532583={},_0x97f26c={},_0x1c36c8={'count':0x0,'rows':[]};var _0x2b4aa7=_[_0xf20f('0x2f')](db['OpenchannelQueue'][_0xf20f('0x30')],function(_0x2b11cb){return{'name':_0x2b11cb[_0xf20f('0x31')],'type':_0x2b11cb[_0xf20f('0x32')][_0xf20f('0x33')]};});_0x97f26c['model']=_[_0xf20f('0x2f')](_0x2b4aa7,_0xf20f('0x2e'));_0x97f26c[_0xf20f('0x34')]=_[_0xf20f('0x35')](_0x4d41cf['query']);_0x97f26c[_0xf20f('0x36')]=_[_0xf20f('0x37')](_0x97f26c[_0xf20f('0x38')],_0x97f26c[_0xf20f('0x34')]);_0x532583[_0xf20f('0x39')]=_[_0xf20f('0x37')](_0x97f26c[_0xf20f('0x38')],qs['fields'](_0x4d41cf[_0xf20f('0x34')][_0xf20f('0x3a')]));_0x532583[_0xf20f('0x39')]=_0x532583[_0xf20f('0x39')][_0xf20f('0x3b')]?_0x532583[_0xf20f('0x39')]:_0x97f26c[_0xf20f('0x38')];if(!_0x4d41cf[_0xf20f('0x34')][_0xf20f('0x3c')](_0xf20f('0x3d'))){_0x532583[_0xf20f('0x21')]=qs[_0xf20f('0x21')](_0x4d41cf['query'][_0xf20f('0x21')]);_0x532583[_0xf20f('0x20')]=qs[_0xf20f('0x20')](_0x4d41cf[_0xf20f('0x34')][_0xf20f('0x20')]);}_0x532583[_0xf20f('0x3e')]=qs[_0xf20f('0x3f')](_0x4d41cf['query'][_0xf20f('0x3f')]);_0x532583[_0xf20f('0x40')]=qs[_0xf20f('0x36')](_[_0xf20f('0x41')](_0x4d41cf[_0xf20f('0x34')],_0x97f26c[_0xf20f('0x36')]));if(_0x4d41cf[_0xf20f('0x34')][_0xf20f('0x42')]){_0x532583[_0xf20f('0x40')]=_[_0xf20f('0x43')](_0x532583[_0xf20f('0x40')],{'$or':_['map'](_0x2b4aa7,function(_0x5dba64){if(_0x5dba64[_0xf20f('0x32')]!==_0xf20f('0x44')){var _0x598366={};_0x598366[_0x5dba64[_0xf20f('0x2e')]]={'$like':'%'+_0x4d41cf[_0xf20f('0x34')]['filter']+'%'};return _0x598366;}})});}_0x532583=_['merge']({},_0x532583,_0x4d41cf['options']);var _0x29d19c={'where':_0x532583[_0xf20f('0x40')]};return db[_0xf20f('0x45')][_0xf20f('0x46')](_0x29d19c)[_0xf20f('0x27')](function(_0x25ac19){_0x1c36c8[_0xf20f('0x46')]=_0x25ac19;if(_0x4d41cf['query'][_0xf20f('0x47')]){_0x532583[_0xf20f('0x48')]=[{'all':!![]}];}return db[_0xf20f('0x45')][_0xf20f('0x49')](_0x532583);})[_0xf20f('0x27')](function(_0x2a30ec){_0x1c36c8[_0xf20f('0x4a')]=_0x2a30ec;return _0x1c36c8;})[_0xf20f('0x27')](respondWithFilteredResult(_0x4b296b,_0x532583))['catch'](handleError(_0x4b296b,null));};exports[_0xf20f('0x4b')]=function(_0x119aaf,_0x23201f){var _0x3560c9={'raw':!![],'where':{'id':_0x119aaf[_0xf20f('0x4c')]['id']}},_0x8d982b={};_0x8d982b[_0xf20f('0x38')]=_[_0xf20f('0x35')](db[_0xf20f('0x45')][_0xf20f('0x30')]);_0x8d982b[_0xf20f('0x34')]=_['keys'](_0x119aaf[_0xf20f('0x34')]);_0x8d982b['filters']=_[_0xf20f('0x37')](_0x8d982b[_0xf20f('0x38')],_0x8d982b['query']);_0x3560c9['attributes']=_[_0xf20f('0x37')](_0x8d982b[_0xf20f('0x38')],qs[_0xf20f('0x3a')](_0x119aaf['query']['fields']));_0x3560c9[_0xf20f('0x39')]=_0x3560c9[_0xf20f('0x39')]['length']?_0x3560c9['attributes']:_0x8d982b[_0xf20f('0x38')];if(_0x119aaf[_0xf20f('0x34')][_0xf20f('0x47')]){_0x3560c9[_0xf20f('0x48')]=[{'all':!![]}];}_0x3560c9=_[_0xf20f('0x43')]({},_0x3560c9,_0x119aaf[_0xf20f('0x4d')]);return db['OpenchannelQueue']['find'](_0x3560c9)['then'](handleEntityNotFound(_0x23201f,null))[_0xf20f('0x27')](respondWithResult(_0x23201f,null))[_0xf20f('0x4e')](handleError(_0x23201f,null));};exports[_0xf20f('0x4f')]=function(_0x11b75f,_0x4dfe76){return db[_0xf20f('0x45')]['create'](_0x11b75f['body'],{})['then'](function(_0x2a18f4){var _0x161db2=_0x11b75f[_0xf20f('0x50')]['get']({'plain':!![]});if(!_0x161db2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x161db2[_0xf20f('0x51')]===_0xf20f('0x50')){var _0x6f41cf=_0x2a18f4['get']({'plain':!![]});var _0x16fa9c=_0xf20f('0x52');return db['UserProfileSection'][_0xf20f('0x53')]({'where':{'name':_0x16fa9c,'userProfileId':_0x161db2[_0xf20f('0x54')]},'raw':!![]})[_0xf20f('0x27')](function(_0x1e9553){if(_0x1e9553&&_0x1e9553['autoAssociation']===0x0){return db[_0xf20f('0x55')][_0xf20f('0x4f')]({'name':_0x6f41cf[_0xf20f('0x2e')],'resourceId':_0x6f41cf['id'],'type':_0x1e9553[_0xf20f('0x2e')],'sectionId':_0x1e9553['id']},{})[_0xf20f('0x27')](function(){return _0x2a18f4;});}else{return _0x2a18f4;}})[_0xf20f('0x4e')](function(_0x467a5d){logger[_0xf20f('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x467a5d);throw _0x467a5d;});}return _0x2a18f4;})['then'](respondWithResult(_0x4dfe76,0xc9))[_0xf20f('0x4e')](handleError(_0x4dfe76,null));};exports[_0xf20f('0x56')]=function(_0x1d02be,_0x58810c){if(_0x1d02be[_0xf20f('0x57')]['id']){delete _0x1d02be[_0xf20f('0x57')]['id'];}return db['OpenchannelQueue'][_0xf20f('0x53')]({'where':{'id':_0x1d02be[_0xf20f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x58810c,null))[_0xf20f('0x27')](saveUpdates(_0x1d02be[_0xf20f('0x57')],null))[_0xf20f('0x27')](respondWithResult(_0x58810c,null))[_0xf20f('0x4e')](handleError(_0x58810c,null));};exports[_0xf20f('0x28')]=function(_0x3db298,_0x46e5ed){return db['OpenchannelQueue'][_0xf20f('0x53')]({'where':{'id':_0x3db298[_0xf20f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x46e5ed,null))[_0xf20f('0x27')](removeEntity(_0x46e5ed,null))['catch'](handleError(_0x46e5ed,null));};exports['describe']=function(_0x5d3406,_0x4e571b){return db[_0xf20f('0x45')][_0xf20f('0x58')]()[_0xf20f('0x27')](respondWithResult(_0x4e571b,null))['catch'](handleError(_0x4e571b,null));};exports[_0xf20f('0x59')]=function(_0x523b2a,_0x2d592d,_0x302fd2){var _0x163607={'raw':!![],'where':{}},_0x3becc0={},_0x2c861f;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x523b2a['params']['id']}})[_0xf20f('0x27')](handleEntityNotFound(_0x2d592d,null))[_0xf20f('0x27')](function(_0x3603e1){if(_0x3603e1){_0x2c861f=_0x3603e1['get']({'plain':!![]});_0x3becc0[_0xf20f('0x38')]=_[_0xf20f('0x35')](db[_0xf20f('0x5a')][_0xf20f('0x30')]);_0x3becc0[_0xf20f('0x34')]=_[_0xf20f('0x35')](_0x523b2a['query']);_0x3becc0[_0xf20f('0x36')]=_[_0xf20f('0x37')](_0x3becc0[_0xf20f('0x38')],_0x3becc0[_0xf20f('0x34')]);_0x163607[_0xf20f('0x39')]=_['intersection'](_0x3becc0['model'],qs[_0xf20f('0x3a')](_0x523b2a[_0xf20f('0x34')][_0xf20f('0x3a')]));_0x163607[_0xf20f('0x39')]=_0x163607['attributes'][_0xf20f('0x3b')]?_0x163607[_0xf20f('0x39')]:_0x3becc0[_0xf20f('0x38')];if(!_0x523b2a[_0xf20f('0x34')][_0xf20f('0x3c')](_0xf20f('0x3d'))){_0x163607['limit']=qs['limit'](_0x523b2a[_0xf20f('0x34')]['limit']);_0x163607['offset']=qs[_0xf20f('0x20')](_0x523b2a[_0xf20f('0x34')][_0xf20f('0x20')]);}_0x163607[_0xf20f('0x3e')]=qs['sort'](_0x523b2a[_0xf20f('0x34')]['sort']);_0x163607['where']=qs[_0xf20f('0x36')](_['pick'](_0x523b2a['query'],_0x3becc0['filters']));_0x163607['where']['OpenchannelQueueId']=_0x3603e1['id'];if(_0x523b2a['query'][_0xf20f('0x42')]){_0x163607[_0xf20f('0x40')]=_[_0xf20f('0x43')](_0x163607['where'],{'$or':_[_0xf20f('0x2f')](_0x163607[_0xf20f('0x39')],function(_0x22309a){var _0x39ca41={};_0x39ca41[_0x22309a]={'$like':'%'+_0x523b2a[_0xf20f('0x34')][_0xf20f('0x42')]+'%'};return _0x39ca41;})});}_0x163607=_[_0xf20f('0x43')]({},_0x163607,_0x523b2a[_0xf20f('0x4d')]);return db['UserOpenchannelQueue']['findAll'](_0x163607);}})['then'](function(_0x1a2cde){if(_0x1a2cde){return db[_0xf20f('0x5b')][_0xf20f('0x5c')]({'where':{'id':_[_0xf20f('0x2f')](_0x1a2cde,'UserId'),'role':'agent'},'attributes':['id',_0xf20f('0x2e'),_0xf20f('0x5d'),_0xf20f('0x5e'),_0xf20f('0x5f')]});}})['then'](function(_0x30537c){if(_0x30537c){return{'count':_0x30537c[_0xf20f('0x46')],'rows':_['map'](_0x30537c['rows'],function(_0x5b0969){return{'membername':_0x5b0969[_0xf20f('0x2e')],'UserId':_0x5b0969['id'],'queue_name':_0x2c861f['name'],'OpenchannelQueueId':_0x2c861f['id'],'interface':util[_0xf20f('0x60')](_0xf20f('0x61'),'SIP',_0x5b0969[_0xf20f('0x2e')]),'penalty':0x0,'paused':_0x5b0969[_0xf20f('0x5d')],'createdAt':_0x5b0969['createdAt'],'updatedAt':_0x5b0969[_0xf20f('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2d592d,_0x163607))[_0xf20f('0x4e')](handleError(_0x2d592d,null));};exports[_0xf20f('0x62')]=function(_0x547161,_0x11558e,_0x27dd5b){var _0x54598f={};var _0x5c9261={};var _0xf250e8;var _0x35fd4f;return db[_0xf20f('0x45')][_0xf20f('0x63')]({'where':{'id':_0x547161[_0xf20f('0x4c')]['id']}})[_0xf20f('0x27')](handleEntityNotFound(_0x11558e,null))[_0xf20f('0x27')](function(_0x9f1b62){if(_0x9f1b62){_0xf250e8=_0x9f1b62;_0x5c9261['model']=_['keys'](db['Team'][_0xf20f('0x30')]);_0x5c9261['query']=_[_0xf20f('0x35')](_0x547161[_0xf20f('0x34')]);_0x5c9261[_0xf20f('0x36')]=_[_0xf20f('0x37')](_0x5c9261[_0xf20f('0x38')],_0x5c9261[_0xf20f('0x34')]);_0x54598f[_0xf20f('0x39')]=_[_0xf20f('0x37')](_0x5c9261['model'],qs[_0xf20f('0x3a')](_0x547161['query'][_0xf20f('0x3a')]));_0x54598f['attributes']=_0x54598f[_0xf20f('0x39')][_0xf20f('0x3b')]?_0x54598f[_0xf20f('0x39')]:_0x5c9261[_0xf20f('0x38')];_0x54598f[_0xf20f('0x3e')]=qs[_0xf20f('0x3f')](_0x547161['query'][_0xf20f('0x3f')]);_0x54598f[_0xf20f('0x40')]=qs[_0xf20f('0x36')](_[_0xf20f('0x41')](_0x547161['query'],_0x5c9261['filters']));if(_0x547161[_0xf20f('0x34')][_0xf20f('0x42')]){_0x54598f[_0xf20f('0x40')]=_[_0xf20f('0x43')](_0x54598f['where'],{'$or':_[_0xf20f('0x2f')](_0x54598f[_0xf20f('0x39')],function(_0x28e31c){var _0x3f9e33={};_0x3f9e33[_0x28e31c]={'$like':'%'+_0x547161[_0xf20f('0x34')]['filter']+'%'};return _0x3f9e33;})});}_0x54598f=_[_0xf20f('0x43')]({},_0x54598f,_0x547161['options']);return _0xf250e8[_0xf20f('0x62')](_0x54598f);}})[_0xf20f('0x27')](function(_0xc2a011){if(_0xc2a011){_0x35fd4f=_0xc2a011['length'];if(!_0x547161[_0xf20f('0x34')][_0xf20f('0x3c')](_0xf20f('0x3d'))){_0x54598f[_0xf20f('0x21')]=qs[_0xf20f('0x21')](_0x547161[_0xf20f('0x34')][_0xf20f('0x21')]);_0x54598f['offset']=qs[_0xf20f('0x20')](_0x547161[_0xf20f('0x34')][_0xf20f('0x20')]);}return _0xf250e8[_0xf20f('0x62')](_0x54598f);}})[_0xf20f('0x27')](function(_0x5b5d0d){if(_0x5b5d0d){return _0x5b5d0d?{'count':_0x35fd4f,'rows':_0x5b5d0d}:null;}})['then'](respondWithResult(_0x11558e,null))[_0xf20f('0x4e')](handleError(_0x11558e,null));};exports[_0xf20f('0x64')]=function(_0x564d3d,_0x366e97,_0x2c4f49){var _0x2188b2=_0x564d3d[_0xf20f('0x57')][_0xf20f('0x65')];return db[_0xf20f('0x66')][_0xf20f('0x49')]({'where':{'id':_0x2188b2},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf20f('0x67'),'attributes':['id','name',_0xf20f('0x68'),_0xf20f('0x69'),_0xf20f('0x6a')],'raw':!![]}]})[_0xf20f('0x27')](function(_0x31d420){if(_0x31d420){var _0x57a067=_['flatMap'](_0x31d420,function(_0x3e6c00){var _0x4f2ce0=_0x3e6c00[_0xf20f('0x29')]({'plain':!![]});return _0x4f2ce0[_0xf20f('0x67')];});return db['OpenchannelQueue'][_0xf20f('0x53')]({'where':{'id':_0x564d3d[_0xf20f('0x4c')]['id']}})[_0xf20f('0x27')](function(_0x460c97){return db[_0xf20f('0x6b')]['transaction'](function(_0x357609){return _0x460c97[_0xf20f('0x64')](_0x2188b2,{'transaction':_0x357609})[_0xf20f('0x27')](function(){return BPromise[_0xf20f('0x6c')](_0x57a067,function(_0x4c4195){return db[_0xf20f('0x5a')][_0xf20f('0x6d')]({'where':{'UserId':_0x4c4195['id'],'OpenchannelQueueId':_0x564d3d[_0xf20f('0x4c')]['id']},'transaction':_0x357609});});})[_0xf20f('0x27')](function(){_0x57a067[_0xf20f('0x6e')](function(_0x242c45){socket[_0xf20f('0x6f')](_0xf20f('0x70'),{'UserId':_0x242c45['id'],'OpenchannelQueueId':_0x460c97['id']});});});});});}})['then'](respondWithStatusCode(_0x366e97,null))['catch'](handleError(_0x366e97,null));};exports[_0xf20f('0x71')]=function(_0x4e0a1c,_0x106a88,_0x4222ce){return db[_0xf20f('0x66')][_0xf20f('0x49')]({'where':{'id':_0x4e0a1c['query'][_0xf20f('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf20f('0x67'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x106a88,null))[_0xf20f('0x27')](function(_0x1b4a61){var _0x22a62d=_[_0xf20f('0x2f')](_0x1b4a61,'id');var _0x16363d=[];var _0x325fce=[];var _0x132d69=squel[_0xf20f('0x72')]();_0x132d69[_0xf20f('0x73')](_0xf20f('0x74'))[_0xf20f('0x75')](_0xf20f('0x76'),'tq')[_0xf20f('0x77')](_0xf20f('0x78'),'ut',_0xf20f('0x79'))[_0xf20f('0x40')](_0xf20f('0x7a'),_0x4e0a1c[_0xf20f('0x4c')]['id']);for(var _0x533fd2=0x0;_0x533fd2<_0x1b4a61[_0xf20f('0x3b')];_0x533fd2+=0x1){let _0x297fe8=_0x1b4a61[_0x533fd2];for(var _0x2cd55b=0x0;_0x2cd55b<_0x297fe8[_0xf20f('0x67')][_0xf20f('0x3b')];_0x2cd55b+=0x1){let _0x1ea062=_0x297fe8[_0xf20f('0x67')][_0x2cd55b];var _0xfcf76f=_0x132d69[_0xf20f('0x7b')]();_0xfcf76f[_0xf20f('0x40')](_0xf20f('0x7c'),_0x1ea062['id']);_0x325fce['push'](db[_0xf20f('0x6b')][_0xf20f('0x34')](_0xfcf76f['toString'](),{'type':db[_0xf20f('0x6b')]['QueryTypes'][_0xf20f('0x7d')]})['then'](function(_0xef319d){if(_0xef319d['length']===0x1){return _0x1ea062['id'];}else{var _0x6022f=_[_0xf20f('0x7e')](_[_0xf20f('0x2f')](_0xef319d,_0xf20f('0x7f')),function(_0x3c108d){return _[_0xf20f('0x80')](_0x22a62d,_0x3c108d);});if(_0x6022f){return _0x1ea062['id'];}}}));}}return BPromise[_0xf20f('0x81')](_0x325fce)[_0xf20f('0x27')](function(_0x88a7fa){_0x16363d=_(_0x16363d)[_0xf20f('0x82')](_0x88a7fa)[_0xf20f('0x83')]()[_0xf20f('0x84')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x4e0a1c['params']['id']}})[_0xf20f('0x27')](function(_0x1fd8db){return db[_0xf20f('0x6b')]['transaction'](function(_0x1d8393){return _0x1fd8db['removeTeams'](_0x4e0a1c['query'][_0xf20f('0x65')],{'transaction':_0x1d8393})[_0xf20f('0x27')](function(){if(!_[_0xf20f('0x85')](_0x16363d)){return _0x1fd8db['removeAgents'](_0x16363d,{'transaction':_0x1d8393});}})[_0xf20f('0x27')](function(){_0x16363d[_0xf20f('0x6e')](function(_0x30cead){socket[_0xf20f('0x6f')](_0xf20f('0x86'),{'UserId':_0x30cead,'OpenchannelQueueId':_0x1fd8db['id']});});});});});});})[_0xf20f('0x27')](respondWithStatusCode(_0x106a88,null))['catch'](handleError(_0x106a88,null));};exports['addAgents']=function(_0x3ef5f0,_0x5b76fa,_0x22f6ea){return db[_0xf20f('0x45')][_0xf20f('0x53')]({'where':{'id':_0x3ef5f0[_0xf20f('0x4c')]['id']}})[_0xf20f('0x27')](handleEntityNotFound(_0x5b76fa,null))[_0xf20f('0x27')](function(_0xd7ac6a){if(_0xd7ac6a){return _0xd7ac6a['addAgents'](_0x3ef5f0[_0xf20f('0x57')][_0xf20f('0x65')],_['omit'](_0x3ef5f0[_0xf20f('0x57')],[_0xf20f('0x65'),'id'])||{})[_0xf20f('0x87')](function(_0x549cf2){for(var _0x40783f=0x0;_0x40783f<_0x3ef5f0[_0xf20f('0x57')][_0xf20f('0x65')][_0xf20f('0x3b')];_0x40783f+=0x1){socket[_0xf20f('0x6f')](_0xf20f('0x70'),{'UserId':_0x3ef5f0[_0xf20f('0x57')][_0xf20f('0x65')][_0x40783f],'OpenchannelQueueId':_0x3ef5f0['params']['id']});}return _0x549cf2;});}})['then'](respondWithResult(_0x5b76fa,null))['catch'](handleError(_0x5b76fa,null));};exports[_0xf20f('0x88')]=function(_0x22efcf,_0x33db84,_0x5df5d9){return db['OpenchannelQueue']['find']({'where':{'id':_0x22efcf[_0xf20f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x33db84,null))[_0xf20f('0x27')](function(_0x5b23eb){if(_0x5b23eb){return _0x5b23eb[_0xf20f('0x88')](_0x22efcf['query'][_0xf20f('0x65')])['then'](function(){if(_[_0xf20f('0x89')](_0x22efcf['query'][_0xf20f('0x65')])){for(var _0x196fad=0x0;_0x196fad<_0x22efcf[_0xf20f('0x34')][_0xf20f('0x65')][_0xf20f('0x3b')];_0x196fad+=0x1){socket['emit'](_0xf20f('0x86'),{'UserId':Number(_0x22efcf[_0xf20f('0x34')][_0xf20f('0x65')][_0x196fad]),'OpenchannelQueueId':Number(_0x22efcf[_0xf20f('0x4c')]['id'])});}}else{socket[_0xf20f('0x6f')]('userOpenchannelQueue:remove',{'UserId':Number(_0x22efcf['query']['ids']),'OpenchannelQueueId':Number(_0x22efcf[_0xf20f('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x33db84,null))[_0xf20f('0x4e')](handleError(_0x33db84,null));};exports[_0xf20f('0x8a')]=function(_0x181a16,_0x148901,_0x437536){var _0x15f49a={};var _0x3d18f1={};var _0x212e71;var _0x13dfcb;return db[_0xf20f('0x45')][_0xf20f('0x63')]({'where':{'id':_0x181a16[_0xf20f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x148901,null))[_0xf20f('0x27')](function(_0x235883){if(_0x235883){_0x212e71=_0x235883;_0x3d18f1['model']=_['keys'](db['User'][_0xf20f('0x30')]);_0x3d18f1[_0xf20f('0x34')]=_['keys'](_0x181a16['query']);_0x3d18f1[_0xf20f('0x36')]=_[_0xf20f('0x37')](_0x3d18f1[_0xf20f('0x38')],_0x3d18f1['query']);_0x15f49a['attributes']=_['intersection'](_0x3d18f1[_0xf20f('0x38')],qs[_0xf20f('0x3a')](_0x181a16['query'][_0xf20f('0x3a')]));_0x15f49a[_0xf20f('0x39')]=_0x15f49a[_0xf20f('0x39')][_0xf20f('0x3b')]?_0x15f49a[_0xf20f('0x39')]:_0x3d18f1[_0xf20f('0x38')];_0x15f49a['order']=qs[_0xf20f('0x3f')](_0x181a16[_0xf20f('0x34')][_0xf20f('0x3f')]);_0x15f49a[_0xf20f('0x40')]=qs[_0xf20f('0x36')](_['pick'](_0x181a16[_0xf20f('0x34')],_0x3d18f1[_0xf20f('0x36')]));if(_0x181a16[_0xf20f('0x34')][_0xf20f('0x42')]){_0x15f49a[_0xf20f('0x40')]=_['merge'](_0x15f49a[_0xf20f('0x40')],{'$or':_[_0xf20f('0x2f')](_0x15f49a[_0xf20f('0x39')],function(_0x444b8c){var _0x3429c7={};_0x3429c7[_0x444b8c]={'$like':'%'+_0x181a16[_0xf20f('0x34')][_0xf20f('0x42')]+'%'};return _0x3429c7;})});}_0x15f49a=_[_0xf20f('0x43')]({},_0x15f49a,_0x181a16['options']);return _0x212e71[_0xf20f('0x8a')](_0x15f49a);}})[_0xf20f('0x27')](function(_0xe8d3f5){if(_0xe8d3f5){_0x13dfcb=_0xe8d3f5[_0xf20f('0x3b')];if(!_0x181a16[_0xf20f('0x34')][_0xf20f('0x3c')](_0xf20f('0x3d'))){_0x15f49a[_0xf20f('0x21')]=qs[_0xf20f('0x21')](_0x181a16[_0xf20f('0x34')]['limit']);_0x15f49a['offset']=qs[_0xf20f('0x20')](_0x181a16['query']['offset']);}return _0x212e71[_0xf20f('0x8a')](_0x15f49a);}})[_0xf20f('0x27')](function(_0x4f0e73){if(_0x4f0e73){return _0x4f0e73?{'count':_0x13dfcb,'rows':_0x4f0e73}:null;}})['then'](respondWithResult(_0x148901,null))[_0xf20f('0x4e')](handleError(_0x148901,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index a019462..8630649 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 _0xbc74=['hook','exports','../../mysqldb','save','emit','hasOwnProperty'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbc74,0x11c));var _0x4bc7=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xbc74[_0x4a747d];return _0x3a5b5c;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x4bc7('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4bc7('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x12a215){return function(_0x8e9f74,_0x30b913,_0xcb057c){OpenchannelQueueEvents['emit'](_0x12a215+':'+_0x8e9f74['id'],_0x8e9f74);OpenchannelQueueEvents[_0x4bc7('0x2')](_0x12a215,_0x8e9f74);_0xcb057c(null);};}for(var e in events){if(events[_0x4bc7('0x3')](e)){var event=events[e];OpenchannelQueue[_0x4bc7('0x4')](e,emitEvent(event));}}module[_0x4bc7('0x5')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x6201=['remove','emit','hook','exports','../../mysqldb','OpenchannelQueue','update'];(function(_0x53ee22,_0x4465c5){var _0x792275=function(_0xe0fbe4){while(--_0xe0fbe4){_0x53ee22['push'](_0x53ee22['shift']());}};_0x792275(++_0x4465c5);}(_0x6201,0x1b6));var _0x1620=function(_0x2599a8,_0x20d758){_0x2599a8=_0x2599a8-0x0;var _0x56b6ad=_0x6201[_0x2599a8];return _0x56b6ad;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x1620('0x0'))['db'][_0x1620('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1620('0x2'),'afterDestroy':_0x1620('0x3')};function emitEvent(_0xb4d6a9){return function(_0x4c39ce,_0x231a6d,_0x439d79){OpenchannelQueueEvents['emit'](_0xb4d6a9+':'+_0x4c39ce['id'],_0x4c39ce);OpenchannelQueueEvents[_0x1620('0x4')](_0xb4d6a9,_0x4c39ce);_0x439d79(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x1620('0x5')](e,emitEvent(event));}}module[_0x1620('0x6')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 78f0aaf..986e272 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 _0x8ce3=['moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue','openchannel_queues','util','../../config/logger','api'];(function(_0x15d763,_0x5d5012){var _0x2d12cc=function(_0x3ceb49){while(--_0x3ceb49){_0x15d763['push'](_0x15d763['shift']());}};_0x2d12cc(++_0x5d5012);}(_0x8ce3,0x1b9));var _0x38ce=function(_0x23fd1b,_0x469cab){_0x23fd1b=_0x23fd1b-0x0;var _0x304e83=_0x8ce3[_0x23fd1b];return _0x304e83;};'use strict';var _=require('lodash');var util=require(_0x38ce('0x0'));var logger=require(_0x38ce('0x1'))(_0x38ce('0x2'));var moment=require(_0x38ce('0x3'));var BPromise=require(_0x38ce('0x4'));var rp=require(_0x38ce('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x38ce('0x6'));var config=require(_0x38ce('0x7'));var attributes=require(_0x38ce('0x8'));module['exports']=function(_0x4dcca6,_0x4f84e2){return _0x4dcca6[_0x38ce('0x9')](_0x38ce('0xa'),attributes,{'tableName':_0x38ce('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c1b=['request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x2c1b,0xb0));var _0xb2c1=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x2c1b[_0x556bb1];return _0x45455f;};'use strict';var _=require(_0xb2c1('0x0'));var util=require(_0xb2c1('0x1'));var logger=require(_0xb2c1('0x2'))(_0xb2c1('0x3'));var moment=require(_0xb2c1('0x4'));var BPromise=require(_0xb2c1('0x5'));var rp=require(_0xb2c1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2c1('0x7'));var config=require(_0xb2c1('0x8'));var attributes=require(_0xb2c1('0x9'));module[_0xb2c1('0xa')]=function(_0x42b565,_0x18bc5d){return _0x42b565[_0xb2c1('0xb')](_0xb2c1('0xc'),attributes,{'tableName':_0xb2c1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 1549eea..6b6f5d8 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 _0x788b=['request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','limit','map','include','attributes','model','ShowOpenchannelQueue','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','then','info','OpenchannelQueue,\x20%s,\x20%s'];(function(_0x385d85,_0x8b463f){var _0x48818f=function(_0x281f11){while(--_0x281f11){_0x385d85['push'](_0x385d85['shift']());}};_0x48818f(++_0x8b463f);}(_0x788b,0x1b4));var _0xb788=function(_0x5ae6d4,_0x49a04d){_0x5ae6d4=_0x5ae6d4-0x0;var _0x3bd1b6=_0x788b[_0x5ae6d4];return _0x3bd1b6;};'use strict';var _=require(_0xb788('0x0'));var util=require(_0xb788('0x1'));var moment=require(_0xb788('0x2'));var BPromise=require(_0xb788('0x3'));var rs=require(_0xb788('0x4'));var fs=require('fs');var Redis=require(_0xb788('0x5'));var db=require(_0xb788('0x6'))['db'];var utils=require(_0xb788('0x7'));var logger=require(_0xb788('0x8'))(_0xb788('0x9'));var config=require(_0xb788('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xb788('0xb')][_0xb788('0xc')]({'port':0x232a});config[_0xb788('0xd')]=_[_0xb788('0xe')](config[_0xb788('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xb788('0xf'))(new Redis(config['redis']));require(_0xb788('0x10'))['register'](socket);function respondWithRpcPromise(_0x4838a8,_0x269f24,_0xdcb135){return new BPromise(function(_0x137e66,_0x5e3f08){return client['request'](_0x4838a8,_0xdcb135)[_0xb788('0x11')](function(_0x242c36){logger[_0xb788('0x12')](_0xb788('0x13'),_0x269f24,_0xb788('0x14'));logger[_0xb788('0x15')](_0xb788('0x16'),_0x269f24,_0xb788('0x14'),JSON[_0xb788('0x17')](_0x242c36));if(_0x242c36[_0xb788('0x18')]){if(_0x242c36[_0xb788('0x18')]['code']===0x1f4){logger['error'](_0xb788('0x13'),_0x269f24,_0x242c36[_0xb788('0x18')][_0xb788('0x19')]);return _0x5e3f08(_0x242c36[_0xb788('0x18')]['message']);}logger[_0xb788('0x18')](_0xb788('0x13'),_0x269f24,_0x242c36[_0xb788('0x18')]['message']);return _0x137e66(_0x242c36[_0xb788('0x18')][_0xb788('0x19')]);}else{logger[_0xb788('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x269f24,'request\x20sent');_0x137e66(_0x242c36[_0xb788('0x1a')][_0xb788('0x19')]);}})[_0xb788('0x1b')](function(_0x5466e4){logger[_0xb788('0x18')](_0xb788('0x13'),_0x269f24,_0x5466e4);_0x5e3f08(_0x5466e4);});});}exports[_0xb788('0x1c')]=function(_0xdbe52d){var _0x11c8f5=this;return new Promise(function(_0x4d676f,_0x43eb57){return db[_0xb788('0x1d')]['findAll']({'raw':_0xdbe52d['options']?_0xdbe52d[_0xb788('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xdbe52d[_0xb788('0x1e')]?_0xdbe52d[_0xb788('0x1e')]['where']||null:null,'attributes':_0xdbe52d[_0xb788('0x1e')]?_0xdbe52d[_0xb788('0x1e')]['attributes']||null:null,'limit':_0xdbe52d[_0xb788('0x1e')]?_0xdbe52d[_0xb788('0x1e')][_0xb788('0x1f')]||null:null,'include':_0xdbe52d[_0xb788('0x1e')]?_0xdbe52d['options']['include']?_[_0xb788('0x20')](_0xdbe52d[_0xb788('0x1e')][_0xb788('0x21')],function(_0x1fe907){return{'model':db[_0x1fe907['model']],'as':_0x1fe907['as'],'attributes':_0x1fe907[_0xb788('0x22')],'include':_0x1fe907[_0xb788('0x21')]?_[_0xb788('0x20')](_0x1fe907['include'],function(_0x4cf75a){return{'model':db[_0x4cf75a['model']],'as':_0x4cf75a['as'],'attributes':_0x4cf75a[_0xb788('0x22')],'include':_0x4cf75a['include']?_[_0xb788('0x20')](_0x4cf75a[_0xb788('0x21')],function(_0x1dfe1c){return{'model':db[_0x1dfe1c[_0xb788('0x23')]],'as':_0x1dfe1c['as'],'attributes':_0x1dfe1c[_0xb788('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb788('0x11')](function(_0x10a13a){logger[_0xb788('0x12')](_0xb788('0x1c'),_0xdbe52d);logger[_0xb788('0x15')]('GetOpenchannelQueue',_0xdbe52d,JSON['stringify'](_0x10a13a));_0x4d676f(_0x10a13a);})[_0xb788('0x1b')](function(_0x1bb50e){logger[_0xb788('0x18')](_0xb788('0x1c'),_0x1bb50e['message'],_0xdbe52d);_0x43eb57(_0x11c8f5[_0xb788('0x18')](0x1f4,_0x1bb50e[_0xb788('0x19')]));});});};exports[_0xb788('0x24')]=function(_0xb7c4a1){var _0x47811d=this;return new Promise(function(_0x135305,_0x4b4e40){return db[_0xb788('0x1d')]['find']({'raw':_0xb7c4a1[_0xb788('0x1e')]?_0xb7c4a1[_0xb788('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xb7c4a1[_0xb788('0x1e')]?_0xb7c4a1[_0xb788('0x1e')][_0xb788('0x25')]||null:null,'attributes':_0xb7c4a1[_0xb788('0x1e')]?_0xb7c4a1[_0xb788('0x1e')][_0xb788('0x22')]||null:null,'include':_0xb7c4a1[_0xb788('0x1e')]?_0xb7c4a1['options']['include']?_[_0xb788('0x20')](_0xb7c4a1[_0xb788('0x1e')][_0xb788('0x21')],function(_0x2ec346){return{'model':db[_0x2ec346[_0xb788('0x23')]],'as':_0x2ec346['as'],'attributes':_0x2ec346[_0xb788('0x22')],'include':_0x2ec346[_0xb788('0x21')]?_[_0xb788('0x20')](_0x2ec346[_0xb788('0x21')],function(_0x4ee29a){return{'model':db[_0x4ee29a[_0xb788('0x23')]],'as':_0x4ee29a['as'],'attributes':_0x4ee29a[_0xb788('0x22')],'include':_0x4ee29a[_0xb788('0x21')]?_[_0xb788('0x20')](_0x4ee29a[_0xb788('0x21')],function(_0x2161a1){return{'model':db[_0x2161a1['model']],'as':_0x2161a1['as'],'attributes':_0x2161a1['attributes']};}):[]};}):[]};}):[]:[]})[_0xb788('0x11')](function(_0x59dba1){logger[_0xb788('0x12')](_0xb788('0x24'),_0xb7c4a1);logger['debug']('ShowOpenchannelQueue',_0xb7c4a1,JSON[_0xb788('0x17')](_0x59dba1));_0x135305(_0x59dba1);})[_0xb788('0x1b')](function(_0x125819){logger[_0xb788('0x18')](_0xb788('0x24'),_0x125819[_0xb788('0x19')],_0xb7c4a1);_0x4b4e40(_0x47811d[_0xb788('0x18')](0x1f4,_0x125819[_0xb788('0x19')]));});});}; \ No newline at end of file +var _0x9138=['error','message','info','result','catch','findAll','options','raw','where','include','map','model','attributes','then','GetOpenchannelQueue','ShowOpenchannelQueue','OpenchannelQueue','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3c7574,_0x1029a4){var _0x2fc809=function(_0x393196){while(--_0x393196){_0x3c7574['push'](_0x3c7574['shift']());}};_0x2fc809(++_0x1029a4);}(_0x9138,0x1ca));var _0x8913=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0x9138[_0x3b150c];return _0x5cd414;};'use strict';var _=require(_0x8913('0x0'));var util=require(_0x8913('0x1'));var moment=require(_0x8913('0x2'));var BPromise=require('bluebird');var rs=require(_0x8913('0x3'));var fs=require('fs');var Redis=require(_0x8913('0x4'));var db=require(_0x8913('0x5'))['db'];var utils=require(_0x8913('0x6'));var logger=require(_0x8913('0x7'))('rpc');var config=require(_0x8913('0x8'));var jayson=require(_0x8913('0x9'));var client=jayson[_0x8913('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x8913('0xb')],{'host':_0x8913('0xc'),'port':0x18eb});var socket=require(_0x8913('0xd'))(new Redis(config[_0x8913('0xb')]));require(_0x8913('0xe'))[_0x8913('0xf')](socket);function respondWithRpcPromise(_0x42ad1b,_0x1c0149,_0x1799d5){return new BPromise(function(_0x245e69,_0x5e5291){return client[_0x8913('0x10')](_0x42ad1b,_0x1799d5)['then'](function(_0x3a3b2c){logger['info'](_0x8913('0x11'),_0x1c0149,_0x8913('0x12'));logger[_0x8913('0x13')](_0x8913('0x14'),_0x1c0149,_0x8913('0x12'),JSON[_0x8913('0x15')](_0x3a3b2c));if(_0x3a3b2c[_0x8913('0x16')]){if(_0x3a3b2c['error']['code']===0x1f4){logger[_0x8913('0x16')](_0x8913('0x11'),_0x1c0149,_0x3a3b2c[_0x8913('0x16')][_0x8913('0x17')]);return _0x5e5291(_0x3a3b2c[_0x8913('0x16')][_0x8913('0x17')]);}logger[_0x8913('0x16')](_0x8913('0x11'),_0x1c0149,_0x3a3b2c[_0x8913('0x16')][_0x8913('0x17')]);return _0x245e69(_0x3a3b2c['error'][_0x8913('0x17')]);}else{logger[_0x8913('0x18')](_0x8913('0x11'),_0x1c0149,_0x8913('0x12'));_0x245e69(_0x3a3b2c[_0x8913('0x19')]['message']);}})[_0x8913('0x1a')](function(_0x1c36a0){logger[_0x8913('0x16')](_0x8913('0x11'),_0x1c0149,_0x1c36a0);_0x5e5291(_0x1c36a0);});});}exports['GetOpenchannelQueue']=function(_0x9647e2){var _0x4362f3=this;return new Promise(function(_0x1ce8c2,_0xbb4cb4){return db['OpenchannelQueue'][_0x8913('0x1b')]({'raw':_0x9647e2[_0x8913('0x1c')]?_0x9647e2[_0x8913('0x1c')][_0x8913('0x1d')]===undefined?!![]:![]:!![],'where':_0x9647e2['options']?_0x9647e2[_0x8913('0x1c')][_0x8913('0x1e')]||null:null,'attributes':_0x9647e2['options']?_0x9647e2['options']['attributes']||null:null,'limit':_0x9647e2[_0x8913('0x1c')]?_0x9647e2[_0x8913('0x1c')]['limit']||null:null,'include':_0x9647e2[_0x8913('0x1c')]?_0x9647e2[_0x8913('0x1c')][_0x8913('0x1f')]?_[_0x8913('0x20')](_0x9647e2[_0x8913('0x1c')][_0x8913('0x1f')],function(_0x56a3fd){return{'model':db[_0x56a3fd[_0x8913('0x21')]],'as':_0x56a3fd['as'],'attributes':_0x56a3fd[_0x8913('0x22')],'include':_0x56a3fd['include']?_[_0x8913('0x20')](_0x56a3fd[_0x8913('0x1f')],function(_0x54b2aa){return{'model':db[_0x54b2aa[_0x8913('0x21')]],'as':_0x54b2aa['as'],'attributes':_0x54b2aa['attributes'],'include':_0x54b2aa[_0x8913('0x1f')]?_[_0x8913('0x20')](_0x54b2aa['include'],function(_0x152dbd){return{'model':db[_0x152dbd['model']],'as':_0x152dbd['as'],'attributes':_0x152dbd[_0x8913('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8913('0x23')](function(_0x2f62c8){logger['info'](_0x8913('0x24'),_0x9647e2);logger['debug'](_0x8913('0x24'),_0x9647e2,JSON['stringify'](_0x2f62c8));_0x1ce8c2(_0x2f62c8);})['catch'](function(_0x3f9a15){logger['error'](_0x8913('0x24'),_0x3f9a15[_0x8913('0x17')],_0x9647e2);_0xbb4cb4(_0x4362f3[_0x8913('0x16')](0x1f4,_0x3f9a15[_0x8913('0x17')]));});});};exports[_0x8913('0x25')]=function(_0x1cedfa){var _0x2a8db7=this;return new Promise(function(_0x1fc95e,_0x28344f){return db[_0x8913('0x26')][_0x8913('0x27')]({'raw':_0x1cedfa[_0x8913('0x1c')]?_0x1cedfa[_0x8913('0x1c')][_0x8913('0x1d')]===undefined?!![]:![]:!![],'where':_0x1cedfa[_0x8913('0x1c')]?_0x1cedfa[_0x8913('0x1c')]['where']||null:null,'attributes':_0x1cedfa[_0x8913('0x1c')]?_0x1cedfa[_0x8913('0x1c')][_0x8913('0x22')]||null:null,'include':_0x1cedfa[_0x8913('0x1c')]?_0x1cedfa['options'][_0x8913('0x1f')]?_['map'](_0x1cedfa[_0x8913('0x1c')][_0x8913('0x1f')],function(_0x351078){return{'model':db[_0x351078[_0x8913('0x21')]],'as':_0x351078['as'],'attributes':_0x351078[_0x8913('0x22')],'include':_0x351078[_0x8913('0x1f')]?_[_0x8913('0x20')](_0x351078[_0x8913('0x1f')],function(_0x5ddb9b){return{'model':db[_0x5ddb9b['model']],'as':_0x5ddb9b['as'],'attributes':_0x5ddb9b[_0x8913('0x22')],'include':_0x5ddb9b[_0x8913('0x1f')]?_['map'](_0x5ddb9b[_0x8913('0x1f')],function(_0x2e8dc8){return{'model':db[_0x2e8dc8[_0x8913('0x21')]],'as':_0x2e8dc8['as'],'attributes':_0x2e8dc8[_0x8913('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8913('0x23')](function(_0x2b81f7){logger['info'](_0x8913('0x25'),_0x1cedfa);logger['debug']('ShowOpenchannelQueue',_0x1cedfa,JSON['stringify'](_0x2b81f7));_0x1fc95e(_0x2b81f7);})[_0x8913('0x1a')](function(_0x48a49b){logger[_0x8913('0x16')](_0x8913('0x25'),_0x48a49b[_0x8913('0x17')],_0x1cedfa);_0x28344f(_0x2a8db7[_0x8913('0x16')](0x1f4,_0x48a49b[_0x8913('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 5ee1ff8..a7d6aed 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 _0xbfe8=['emit','length','openchannelQueue:','save','remove','update'];(function(_0x51a22f,_0x400c9f){var _0x5d2aef=function(_0x387aed){while(--_0x387aed){_0x51a22f['push'](_0x51a22f['shift']());}};_0x5d2aef(++_0x400c9f);}(_0xbfe8,0x1a7));var _0x8bfe=function(_0x2fcb74,_0x1f8940){_0x2fcb74=_0x2fcb74-0x0;var _0x247289=_0xbfe8[_0x2fcb74];return _0x247289;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x8bfe('0x0'),_0x8bfe('0x1'),_0x8bfe('0x2')];function createListener(_0x9c0d1f,_0x4265fe){return function(_0x30a8a8){_0x4265fe[_0x8bfe('0x3')](_0x9c0d1f,_0x30a8a8);};}function removeListener(_0x5d7c2f,_0xf0cd10){return function(){OpenchannelQueueEvents['removeListener'](_0x5d7c2f,_0xf0cd10);};}exports['register']=function(_0x4a9d84){for(var _0x5cd2ca=0x0,_0x2e4d3c=events[_0x8bfe('0x4')];_0x5cd2ca<_0x2e4d3c;_0x5cd2ca++){var _0x495e60=events[_0x5cd2ca];var _0xfa6cf5=createListener(_0x8bfe('0x5')+_0x495e60,_0x4a9d84);OpenchannelQueueEvents['on'](_0x495e60,_0xfa6cf5);}}; \ No newline at end of file +var _0x20b8=['emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save','update'];(function(_0x3fb9dd,_0x174fff){var _0x20136a=function(_0x480081){while(--_0x480081){_0x3fb9dd['push'](_0x3fb9dd['shift']());}};_0x20136a(++_0x174fff);}(_0x20b8,0x75));var _0x820b=function(_0x30a884,_0x63f475){_0x30a884=_0x30a884-0x0;var _0x12937f=_0x20b8[_0x30a884];return _0x12937f;};'use strict';var OpenchannelQueueEvents=require(_0x820b('0x0'));var events=[_0x820b('0x1'),'remove',_0x820b('0x2')];function createListener(_0x512ddc,_0x549d16){return function(_0x32be5a){_0x549d16[_0x820b('0x3')](_0x512ddc,_0x32be5a);};}function removeListener(_0x2b2593,_0x257684){return function(){OpenchannelQueueEvents[_0x820b('0x4')](_0x2b2593,_0x257684);};}exports[_0x820b('0x5')]=function(_0x462783){for(var _0x546438=0x0,_0x3c931f=events[_0x820b('0x6')];_0x546438<_0x3c931f;_0x546438++){var _0x5b5de1=events[_0x546438];var _0x22a2c9=createListener(_0x820b('0x7')+_0x5b5de1,_0x462783);OpenchannelQueueEvents['on'](_0x5b5de1,_0x22a2c9);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index fcb5d56..6589845 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 _0x5928=['isAuthenticated','describe','show','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./openchannelQueueReport.controller','get'];(function(_0x5be348,_0xca88ca){var _0x1ed73b=function(_0x40b0c5){while(--_0x40b0c5){_0x5be348['push'](_0x5be348['shift']());}};_0x1ed73b(++_0xca88ca);}(_0x5928,0x1c2));var _0x8592=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5928[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8592('0x0'));var util=require(_0x8592('0x1'));var path=require(_0x8592('0x2'));var timeout=require(_0x8592('0x3'));var express=require(_0x8592('0x4'));var router=express[_0x8592('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x8592('0x6'));var config=require('../../config/environment');var controller=require(_0x8592('0x7'));router[_0x8592('0x8')]('/',auth[_0x8592('0x9')](),controller['index']);router['get']('/describe',auth[_0x8592('0x9')](),controller[_0x8592('0xa')]);router[_0x8592('0x8')]('/:id',auth[_0x8592('0x9')](),controller[_0x8592('0xb')]);router['post']('/',auth[_0x8592('0x9')](),controller[_0x8592('0xc')]);router[_0x8592('0xd')](_0x8592('0xe'),auth[_0x8592('0x9')](),controller['update']);router['delete'](_0x8592('0xe'),auth[_0x8592('0x9')](),controller[_0x8592('0xf')]);module[_0x8592('0x10')]=router; \ No newline at end of file +var _0x9056=['update','delete','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','put'];(function(_0x5a2331,_0x1ab371){var _0x540629=function(_0x1de044){while(--_0x1de044){_0x5a2331['push'](_0x5a2331['shift']());}};_0x540629(++_0x1ab371);}(_0x9056,0x1ac));var _0x6905=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9056[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6905('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6905('0x1'));var router=express[_0x6905('0x2')]();var auth=require(_0x6905('0x3'));var interaction=require(_0x6905('0x4'));var config=require(_0x6905('0x5'));var controller=require('./openchannelQueueReport.controller');router[_0x6905('0x6')]('/',auth[_0x6905('0x7')](),controller[_0x6905('0x8')]);router[_0x6905('0x6')]('/describe',auth[_0x6905('0x7')](),controller[_0x6905('0x9')]);router[_0x6905('0x6')](_0x6905('0xa'),auth['isAuthenticated'](),controller[_0x6905('0xb')]);router[_0x6905('0xc')]('/',auth[_0x6905('0x7')](),controller['create']);router[_0x6905('0xd')](_0x6905('0xa'),auth[_0x6905('0x7')](),controller[_0x6905('0xe')]);router[_0x6905('0xf')](_0x6905('0xa'),auth[_0x6905('0x7')](),controller['destroy']);module[_0x6905('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 8cd8be3..80c085b 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 _0x24f9=['DATE','moment','sequelize','exports','STRING'];(function(_0x1a3832,_0x33c9d9){var _0x1fdbcd=function(_0x3822e5){while(--_0x3822e5){_0x1a3832['push'](_0x1a3832['shift']());}};_0x1fdbcd(++_0x33c9d9);}(_0x24f9,0x8d));var _0x924f=function(_0xc975dc,_0x2c4e94){_0xc975dc=_0xc975dc-0x0;var _0x40fc5e=_0x24f9[_0xc975dc];return _0x40fc5e;};'use strict';var moment=require(_0x924f('0x0'));var Sequelize=require(_0x924f('0x1'));module[_0x924f('0x2')]={'uniqueid':{'type':Sequelize[_0x924f('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x924f('0x3')]},'joinAt':{'type':Sequelize[_0x924f('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x924f('0x4')]},'exitAt':{'type':Sequelize[_0x924f('0x4')]},'reason':{'type':Sequelize[_0x924f('0x3')]}}; \ No newline at end of file +var _0xffa3=['STRING','DATE','moment','sequelize'];(function(_0xce2eff,_0x19adbb){var _0x2e101e=function(_0xef32cc){while(--_0xef32cc){_0xce2eff['push'](_0xce2eff['shift']());}};_0x2e101e(++_0x19adbb);}(_0xffa3,0x1e2));var _0x3ffa=function(_0x1ad6c9,_0x5b31e1){_0x1ad6c9=_0x1ad6c9-0x0;var _0x181127=_0xffa3[_0x1ad6c9];return _0x181127;};'use strict';var moment=require(_0x3ffa('0x0'));var Sequelize=require(_0x3ffa('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x3ffa('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3ffa('0x2')]},'joinAt':{'type':Sequelize[_0x3ffa('0x3')]},'leaveAt':{'type':Sequelize[_0x3ffa('0x3')]},'acceptAt':{'type':Sequelize[_0x3ffa('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x3ffa('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index fc7f5fc..ee36614 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 _0x7916=['findAll','rows','catch','show','params','keys','length','find','create','body','update','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','jsforce','querystring','papaparse','../../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','apply','reject','save','then','destroy','name','send','rawAttributes','fieldName','type','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','OpenchannelQueueReport','includeAll','include'];(function(_0x382305,_0x3407c2){var _0x4b31eb=function(_0x58eefb){while(--_0x58eefb){_0x382305['push'](_0x382305['shift']());}};_0x4b31eb(++_0x3407c2);}(_0x7916,0x128));var _0x6791=function(_0x177e14,_0x401d6b){_0x177e14=_0x177e14-0x0;var _0x4dcdfe=_0x7916[_0x177e14];return _0x4dcdfe;};'use strict';var pdf=require(_0x6791('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6791('0x1'));var zipdir=require(_0x6791('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6791('0x3'));var moment=require(_0x6791('0x4'));var BPromise=require(_0x6791('0x5'));var Mustache=require(_0x6791('0x6'));var util=require('util');var path=require(_0x6791('0x7'));var sox=require('sox');var csv=require(_0x6791('0x8'));var ejs=require(_0x6791('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6791('0xa'));var crypto=require('crypto');var jsforce=require(_0x6791('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6791('0xc'));var Papa=require(_0x6791('0xd'));var Redis=require('ioredis');var authService=require(_0x6791('0xe'));var qs=require(_0x6791('0xf'));var as=require(_0x6791('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6791('0x11'))(_0x6791('0x12'));var utils=require(_0x6791('0x13'));var config=require(_0x6791('0x14'));var db=require(_0x6791('0x15'))['db'];function respondWithStatusCode(_0x1eddd3,_0x61ac73){_0x61ac73=_0x61ac73||0xcc;return function(_0x16c62b){if(_0x16c62b){return _0x1eddd3[_0x6791('0x16')](_0x61ac73);}return _0x1eddd3[_0x6791('0x17')](_0x61ac73)[_0x6791('0x18')]();};}function respondWithResult(_0x5c51f8,_0x4b1719){_0x4b1719=_0x4b1719||0xc8;return function(_0x34b28d){if(_0x34b28d){return _0x5c51f8['status'](_0x4b1719)[_0x6791('0x19')](_0x34b28d);}};}function respondWithFilteredResult(_0x4c32a1,_0x3be9f0){return function(_0x163898){if(_0x163898){var _0x517910=_0x163898[_0x6791('0x1a')],_0x3e4792=_0x3be9f0['offset'],_0x4b80ed=_0x3be9f0[_0x6791('0x1b')]+_0x3be9f0[_0x6791('0x1c')],_0x3856ac;if(_0x4b80ed>=_0x517910){_0x4b80ed=_0x517910;_0x3856ac=0xc8;}else{_0x3856ac=0xce;}_0x4c32a1['status'](_0x3856ac);return _0x4c32a1[_0x6791('0x1d')]('Content-Range',_0x3e4792+'-'+_0x4b80ed+'/'+_0x517910)[_0x6791('0x19')](_0x163898);}return null;};}function patchUpdates(_0x126451){return function(_0x669270){try{jsonpatch[_0x6791('0x1e')](_0x669270,_0x126451,!![]);}catch(_0x25adbc){return BPromise[_0x6791('0x1f')](_0x25adbc);}return _0x669270[_0x6791('0x20')]();};}function saveUpdates(_0x581d51,_0x4a2922){return function(_0x306acb){if(_0x306acb){return _0x306acb['update'](_0x581d51)[_0x6791('0x21')](function(_0x3b57f0){return _0x3b57f0;});}return null;};}function removeEntity(_0x595cf2,_0x17f200){return function(_0x309610){if(_0x309610){return _0x309610[_0x6791('0x22')]()[_0x6791('0x21')](function(){_0x595cf2['status'](0xcc)[_0x6791('0x18')]();});}};}function handleEntityNotFound(_0x1b516d,_0x4a8717){return function(_0x53bb44){if(!_0x53bb44){_0x1b516d['sendStatus'](0x194);}return _0x53bb44;};}function handleError(_0x372dae,_0x502043){_0x502043=_0x502043||0x1f4;return function(_0x1d27c0){logger['error'](_0x1d27c0['stack']);if(_0x1d27c0['name']){delete _0x1d27c0[_0x6791('0x23')];}_0x372dae[_0x6791('0x17')](_0x502043)[_0x6791('0x24')](_0x1d27c0);};}exports['index']=function(_0x3def2e,_0x30cc17){var _0x493a59={},_0x342107={},_0x5cbb79={'count':0x0,'rows':[]};var _0x424b0e=_['map'](db['OpenchannelQueueReport'][_0x6791('0x25')],function(_0x551718){return{'name':_0x551718[_0x6791('0x26')],'type':_0x551718[_0x6791('0x27')]['key']};});_0x342107[_0x6791('0x28')]=_[_0x6791('0x29')](_0x424b0e,_0x6791('0x23'));_0x342107[_0x6791('0x2a')]=_['keys'](_0x3def2e['query']);_0x342107[_0x6791('0x2b')]=_['intersection'](_0x342107[_0x6791('0x28')],_0x342107[_0x6791('0x2a')]);_0x493a59[_0x6791('0x2c')]=_[_0x6791('0x2d')](_0x342107[_0x6791('0x28')],qs[_0x6791('0x2e')](_0x3def2e[_0x6791('0x2a')][_0x6791('0x2e')]));_0x493a59[_0x6791('0x2c')]=_0x493a59[_0x6791('0x2c')]['length']?_0x493a59[_0x6791('0x2c')]:_0x342107[_0x6791('0x28')];if(!_0x3def2e[_0x6791('0x2a')][_0x6791('0x2f')](_0x6791('0x30'))){_0x493a59[_0x6791('0x1c')]=qs['limit'](_0x3def2e['query']['limit']);_0x493a59[_0x6791('0x1b')]=qs[_0x6791('0x1b')](_0x3def2e[_0x6791('0x2a')]['offset']);}_0x493a59['order']=qs[_0x6791('0x31')](_0x3def2e[_0x6791('0x2a')][_0x6791('0x31')]);_0x493a59[_0x6791('0x32')]=qs['filters'](_[_0x6791('0x33')](_0x3def2e[_0x6791('0x2a')],_0x342107[_0x6791('0x2b')]));if(_0x3def2e['query'][_0x6791('0x34')]){_0x493a59['where']=_['merge'](_0x493a59[_0x6791('0x32')],{'$or':_[_0x6791('0x29')](_0x424b0e,function(_0x530b13){if(_0x530b13[_0x6791('0x27')]!==_0x6791('0x35')){var _0x407882={};_0x407882[_0x530b13[_0x6791('0x23')]]={'$like':'%'+_0x3def2e[_0x6791('0x2a')]['filter']+'%'};return _0x407882;}})});}_0x493a59=_[_0x6791('0x36')]({},_0x493a59,_0x3def2e[_0x6791('0x37')]);var _0x2d0dd8={'where':_0x493a59['where']};return db[_0x6791('0x38')][_0x6791('0x1a')](_0x2d0dd8)[_0x6791('0x21')](function(_0x577006){_0x5cbb79[_0x6791('0x1a')]=_0x577006;if(_0x3def2e[_0x6791('0x2a')][_0x6791('0x39')]){_0x493a59[_0x6791('0x3a')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x6791('0x3b')](_0x493a59);})[_0x6791('0x21')](function(_0x3e95b6){_0x5cbb79[_0x6791('0x3c')]=_0x3e95b6;return _0x5cbb79;})[_0x6791('0x21')](respondWithFilteredResult(_0x30cc17,_0x493a59))[_0x6791('0x3d')](handleError(_0x30cc17,null));};exports[_0x6791('0x3e')]=function(_0xae0e07,_0x46c244){var _0x4e4004={'raw':!![],'where':{'id':_0xae0e07[_0x6791('0x3f')]['id']}},_0x52c03a={};_0x52c03a[_0x6791('0x28')]=_['keys'](db[_0x6791('0x38')][_0x6791('0x25')]);_0x52c03a[_0x6791('0x2a')]=_[_0x6791('0x40')](_0xae0e07[_0x6791('0x2a')]);_0x52c03a[_0x6791('0x2b')]=_[_0x6791('0x2d')](_0x52c03a['model'],_0x52c03a[_0x6791('0x2a')]);_0x4e4004['attributes']=_[_0x6791('0x2d')](_0x52c03a[_0x6791('0x28')],qs[_0x6791('0x2e')](_0xae0e07[_0x6791('0x2a')]['fields']));_0x4e4004[_0x6791('0x2c')]=_0x4e4004[_0x6791('0x2c')][_0x6791('0x41')]?_0x4e4004[_0x6791('0x2c')]:_0x52c03a[_0x6791('0x28')];if(_0xae0e07[_0x6791('0x2a')][_0x6791('0x39')]){_0x4e4004[_0x6791('0x3a')]=[{'all':!![]}];}_0x4e4004=_['merge']({},_0x4e4004,_0xae0e07[_0x6791('0x37')]);return db[_0x6791('0x38')][_0x6791('0x42')](_0x4e4004)[_0x6791('0x21')](handleEntityNotFound(_0x46c244,null))['then'](respondWithResult(_0x46c244,null))[_0x6791('0x3d')](handleError(_0x46c244,null));};exports[_0x6791('0x43')]=function(_0x540ebe,_0x1ac964){return db['OpenchannelQueueReport'][_0x6791('0x43')](_0x540ebe[_0x6791('0x44')],{})[_0x6791('0x21')](respondWithResult(_0x1ac964,0xc9))[_0x6791('0x3d')](handleError(_0x1ac964,null));};exports[_0x6791('0x45')]=function(_0xb2a2,_0x4163f5){if(_0xb2a2[_0x6791('0x44')]['id']){delete _0xb2a2[_0x6791('0x44')]['id'];}return db['OpenchannelQueueReport'][_0x6791('0x42')]({'where':{'id':_0xb2a2['params']['id']}})[_0x6791('0x21')](handleEntityNotFound(_0x4163f5,null))[_0x6791('0x21')](saveUpdates(_0xb2a2[_0x6791('0x44')],null))[_0x6791('0x21')](respondWithResult(_0x4163f5,null))[_0x6791('0x3d')](handleError(_0x4163f5,null));};exports['destroy']=function(_0x2bc08d,_0x35e087){return db[_0x6791('0x38')][_0x6791('0x42')]({'where':{'id':_0x2bc08d[_0x6791('0x3f')]['id']}})['then'](handleEntityNotFound(_0x35e087,null))[_0x6791('0x21')](removeEntity(_0x35e087,null))[_0x6791('0x3d')](handleError(_0x35e087,null));};exports['describe']=function(_0x3df699,_0x56f6c6){return db[_0x6791('0x38')][_0x6791('0x46')]()[_0x6791('0x21')](respondWithResult(_0x56f6c6,null))[_0x6791('0x3d')](handleError(_0x56f6c6,null));}; \ No newline at end of file +var _0x65c9=['show','params','options','find','body','describe','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','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','apply','reject','save','update','then','destroy','stack','send','index','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','map','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','catch'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x65c9,0x182));var _0x965c=function(_0x8b9de8,_0x499007){_0x8b9de8=_0x8b9de8-0x0;var _0x11a3e0=_0x65c9[_0x8b9de8];return _0x11a3e0;};'use strict';var pdf=require(_0x965c('0x0'));var emlformat=require(_0x965c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x965c('0x2'));var jsonpatch=require(_0x965c('0x3'));var rp=require(_0x965c('0x4'));var moment=require(_0x965c('0x5'));var BPromise=require(_0x965c('0x6'));var Mustache=require(_0x965c('0x7'));var util=require(_0x965c('0x8'));var path=require(_0x965c('0x9'));var sox=require(_0x965c('0xa'));var csv=require(_0x965c('0xb'));var ejs=require(_0x965c('0xc'));var fs=require('fs');var _=require(_0x965c('0xd'));var squel=require('squel');var crypto=require(_0x965c('0xe'));var jsforce=require(_0x965c('0xf'));var deskjs=require(_0x965c('0x10'));var toCsv=require(_0x965c('0xb'));var querystring=require(_0x965c('0x11'));var Papa=require(_0x965c('0x12'));var Redis=require(_0x965c('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x965c('0x14'));var as=require(_0x965c('0x15'));var hardwareService=require(_0x965c('0x16'));var logger=require(_0x965c('0x17'))(_0x965c('0x18'));var utils=require(_0x965c('0x19'));var config=require(_0x965c('0x1a'));var db=require(_0x965c('0x1b'))['db'];function respondWithStatusCode(_0x3b5e1d,_0x3ff4ea){_0x3ff4ea=_0x3ff4ea||0xcc;return function(_0x154827){if(_0x154827){return _0x3b5e1d[_0x965c('0x1c')](_0x3ff4ea);}return _0x3b5e1d[_0x965c('0x1d')](_0x3ff4ea)[_0x965c('0x1e')]();};}function respondWithResult(_0x5039e5,_0x1e343c){_0x1e343c=_0x1e343c||0xc8;return function(_0x26618f){if(_0x26618f){return _0x5039e5[_0x965c('0x1d')](_0x1e343c)['json'](_0x26618f);}};}function respondWithFilteredResult(_0x438616,_0x2a9580){return function(_0x20dee0){if(_0x20dee0){var _0x4f61de=_0x20dee0['count'],_0x1c820a=_0x2a9580[_0x965c('0x1f')],_0x495acf=_0x2a9580[_0x965c('0x1f')]+_0x2a9580[_0x965c('0x20')],_0x52e339;if(_0x495acf>=_0x4f61de){_0x495acf=_0x4f61de;_0x52e339=0xc8;}else{_0x52e339=0xce;}_0x438616[_0x965c('0x1d')](_0x52e339);return _0x438616['set']('Content-Range',_0x1c820a+'-'+_0x495acf+'/'+_0x4f61de)['json'](_0x20dee0);}return null;};}function patchUpdates(_0x39c663){return function(_0x26c613){try{jsonpatch[_0x965c('0x21')](_0x26c613,_0x39c663,!![]);}catch(_0x1bb9da){return BPromise[_0x965c('0x22')](_0x1bb9da);}return _0x26c613[_0x965c('0x23')]();};}function saveUpdates(_0x2e41e5,_0x3f5ec9){return function(_0x11f510){if(_0x11f510){return _0x11f510[_0x965c('0x24')](_0x2e41e5)[_0x965c('0x25')](function(_0x4be8a8){return _0x4be8a8;});}return null;};}function removeEntity(_0x6d0a3,_0x230d38){return function(_0x4e345c){if(_0x4e345c){return _0x4e345c[_0x965c('0x26')]()[_0x965c('0x25')](function(){_0x6d0a3['status'](0xcc)[_0x965c('0x1e')]();});}};}function handleEntityNotFound(_0x2ac16c,_0x3dcfa2){return function(_0x4d41e5){if(!_0x4d41e5){_0x2ac16c[_0x965c('0x1c')](0x194);}return _0x4d41e5;};}function handleError(_0x7b8907,_0x351971){_0x351971=_0x351971||0x1f4;return function(_0x146df2){logger['error'](_0x146df2[_0x965c('0x27')]);if(_0x146df2['name']){delete _0x146df2['name'];}_0x7b8907['status'](_0x351971)[_0x965c('0x28')](_0x146df2);};}exports[_0x965c('0x29')]=function(_0x3cf10f,_0x551ed5){var _0x4f9406={},_0x5574e2={},_0x59ceee={'count':0x0,'rows':[]};var _0x26b49d=_['map'](db[_0x965c('0x2a')][_0x965c('0x2b')],function(_0x9227f8){return{'name':_0x9227f8[_0x965c('0x2c')],'type':_0x9227f8[_0x965c('0x2d')][_0x965c('0x2e')]};});_0x5574e2[_0x965c('0x2f')]=_[_0x965c('0x30')](_0x26b49d,_0x965c('0x31'));_0x5574e2['query']=_[_0x965c('0x32')](_0x3cf10f[_0x965c('0x33')]);_0x5574e2[_0x965c('0x34')]=_[_0x965c('0x35')](_0x5574e2[_0x965c('0x2f')],_0x5574e2[_0x965c('0x33')]);_0x4f9406[_0x965c('0x36')]=_[_0x965c('0x35')](_0x5574e2['model'],qs[_0x965c('0x37')](_0x3cf10f['query']['fields']));_0x4f9406[_0x965c('0x36')]=_0x4f9406[_0x965c('0x36')][_0x965c('0x38')]?_0x4f9406['attributes']:_0x5574e2[_0x965c('0x2f')];if(!_0x3cf10f[_0x965c('0x33')][_0x965c('0x39')]('nolimit')){_0x4f9406[_0x965c('0x20')]=qs[_0x965c('0x20')](_0x3cf10f[_0x965c('0x33')]['limit']);_0x4f9406[_0x965c('0x1f')]=qs[_0x965c('0x1f')](_0x3cf10f[_0x965c('0x33')][_0x965c('0x1f')]);}_0x4f9406[_0x965c('0x3a')]=qs[_0x965c('0x3b')](_0x3cf10f['query'][_0x965c('0x3b')]);_0x4f9406[_0x965c('0x3c')]=qs[_0x965c('0x34')](_[_0x965c('0x3d')](_0x3cf10f[_0x965c('0x33')],_0x5574e2[_0x965c('0x34')]));if(_0x3cf10f[_0x965c('0x33')][_0x965c('0x3e')]){_0x4f9406['where']=_[_0x965c('0x3f')](_0x4f9406[_0x965c('0x3c')],{'$or':_[_0x965c('0x30')](_0x26b49d,function(_0x31b818){if(_0x31b818['type']!==_0x965c('0x40')){var _0x452183={};_0x452183[_0x31b818[_0x965c('0x31')]]={'$like':'%'+_0x3cf10f[_0x965c('0x33')]['filter']+'%'};return _0x452183;}})});}_0x4f9406=_[_0x965c('0x3f')]({},_0x4f9406,_0x3cf10f['options']);var _0x31d5b0={'where':_0x4f9406[_0x965c('0x3c')]};return db[_0x965c('0x2a')][_0x965c('0x41')](_0x31d5b0)[_0x965c('0x25')](function(_0x544f59){_0x59ceee[_0x965c('0x41')]=_0x544f59;if(_0x3cf10f[_0x965c('0x33')][_0x965c('0x42')]){_0x4f9406[_0x965c('0x43')]=[{'all':!![]}];}return db[_0x965c('0x2a')][_0x965c('0x44')](_0x4f9406);})[_0x965c('0x25')](function(_0x29e2e0){_0x59ceee['rows']=_0x29e2e0;return _0x59ceee;})[_0x965c('0x25')](respondWithFilteredResult(_0x551ed5,_0x4f9406))[_0x965c('0x45')](handleError(_0x551ed5,null));};exports[_0x965c('0x46')]=function(_0x334a86,_0x1317c0){var _0x3e6a26={'raw':!![],'where':{'id':_0x334a86[_0x965c('0x47')]['id']}},_0x3162f3={};_0x3162f3[_0x965c('0x2f')]=_[_0x965c('0x32')](db['OpenchannelQueueReport'][_0x965c('0x2b')]);_0x3162f3['query']=_[_0x965c('0x32')](_0x334a86['query']);_0x3162f3[_0x965c('0x34')]=_[_0x965c('0x35')](_0x3162f3[_0x965c('0x2f')],_0x3162f3[_0x965c('0x33')]);_0x3e6a26[_0x965c('0x36')]=_[_0x965c('0x35')](_0x3162f3['model'],qs['fields'](_0x334a86[_0x965c('0x33')][_0x965c('0x37')]));_0x3e6a26['attributes']=_0x3e6a26[_0x965c('0x36')][_0x965c('0x38')]?_0x3e6a26[_0x965c('0x36')]:_0x3162f3['model'];if(_0x334a86[_0x965c('0x33')][_0x965c('0x42')]){_0x3e6a26[_0x965c('0x43')]=[{'all':!![]}];}_0x3e6a26=_[_0x965c('0x3f')]({},_0x3e6a26,_0x334a86[_0x965c('0x48')]);return db[_0x965c('0x2a')][_0x965c('0x49')](_0x3e6a26)[_0x965c('0x25')](handleEntityNotFound(_0x1317c0,null))['then'](respondWithResult(_0x1317c0,null))['catch'](handleError(_0x1317c0,null));};exports['create']=function(_0x1b785c,_0x273230){return db[_0x965c('0x2a')]['create'](_0x1b785c['body'],{})['then'](respondWithResult(_0x273230,0xc9))['catch'](handleError(_0x273230,null));};exports[_0x965c('0x24')]=function(_0x5eb4e6,_0x13c10f){if(_0x5eb4e6[_0x965c('0x4a')]['id']){delete _0x5eb4e6[_0x965c('0x4a')]['id'];}return db[_0x965c('0x2a')][_0x965c('0x49')]({'where':{'id':_0x5eb4e6[_0x965c('0x47')]['id']}})['then'](handleEntityNotFound(_0x13c10f,null))[_0x965c('0x25')](saveUpdates(_0x5eb4e6[_0x965c('0x4a')],null))[_0x965c('0x25')](respondWithResult(_0x13c10f,null))['catch'](handleError(_0x13c10f,null));};exports[_0x965c('0x26')]=function(_0xf13546,_0x161ed1){return db['OpenchannelQueueReport']['find']({'where':{'id':_0xf13546[_0x965c('0x47')]['id']}})[_0x965c('0x25')](handleEntityNotFound(_0x161ed1,null))[_0x965c('0x25')](removeEntity(_0x161ed1,null))[_0x965c('0x45')](handleError(_0x161ed1,null));};exports[_0x965c('0x4b')]=function(_0x214085,_0x3b009a){return db[_0x965c('0x2a')][_0x965c('0x4b')]()[_0x965c('0x25')](respondWithResult(_0x3b009a,null))[_0x965c('0x45')](handleError(_0x3b009a,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 3253f53..d2add86 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 _0xaa19=['uniqueid','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport'];(function(_0x4e707e,_0x208eb5){var _0x3d346e=function(_0xd1f767){while(--_0xd1f767){_0x4e707e['push'](_0x4e707e['shift']());}};_0x3d346e(++_0x208eb5);}(_0xaa19,0x79));var _0x9aa1=function(_0x4135dd,_0x3e6ae9){_0x4135dd=_0x4135dd-0x0;var _0x306460=_0xaa19[_0x4135dd];return _0x306460;};'use strict';var _=require(_0x9aa1('0x0'));var util=require(_0x9aa1('0x1'));var logger=require(_0x9aa1('0x2'))(_0x9aa1('0x3'));var moment=require('moment');var BPromise=require(_0x9aa1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9aa1('0x5'));var rimraf=require('rimraf');var config=require(_0x9aa1('0x6'));var attributes=require(_0x9aa1('0x7'));module[_0x9aa1('0x8')]=function(_0x52124b,_0x1e59f8){return _0x52124b[_0x9aa1('0x9')](_0x9aa1('0xa'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0x9aa1('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x67d1=['request-promise','path','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x671a39,_0x743a86){var _0x23735e=function(_0x348e3){while(--_0x348e3){_0x671a39['push'](_0x671a39['shift']());}};_0x23735e(++_0x743a86);}(_0x67d1,0xdf));var _0x167d=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x67d1[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0x167d('0x0'));var util=require(_0x167d('0x1'));var logger=require(_0x167d('0x2'))(_0x167d('0x3'));var moment=require('moment');var BPromise=require(_0x167d('0x4'));var rp=require(_0x167d('0x5'));var fs=require('fs');var path=require(_0x167d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelQueueReport.attributes');module[_0x167d('0x7')]=function(_0x2c0047,_0x3c707b){return _0x2c0047[_0x167d('0x8')](_0x167d('0x9'),attributes,{'tableName':_0x167d('0xa'),'paranoid':![],'indexes':[{'name':_0x167d('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 8e92006..65e3cfd 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 _0x6b1b=['body','options','UpdateOpenchannelQueueReport','where','attributes','limit','debug','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','stringify','error','OpenchannelQueueReport,\x20%s,\x20%s','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x6b1b[_0xbb091];return _0x467a04;};'use strict';var _=require('lodash');var util=require(_0xb6b1('0x0'));var moment=require(_0xb6b1('0x1'));var BPromise=require(_0xb6b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6b1('0x3'));var db=require(_0xb6b1('0x4'))['db'];var utils=require(_0xb6b1('0x5'));var logger=require(_0xb6b1('0x6'))(_0xb6b1('0x7'));var config=require(_0xb6b1('0x8'));var jayson=require(_0xb6b1('0x9'));var client=jayson[_0xb6b1('0xa')][_0xb6b1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13334e,_0x1a4cd0,_0x5b440a){return new BPromise(function(_0x2734cc,_0x52aa76){return client['request'](_0x13334e,_0x5b440a)[_0xb6b1('0xc')](function(_0x58027c){logger[_0xb6b1('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1a4cd0,'request\x20sent');logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x1a4cd0,_0xb6b1('0xe'),JSON[_0xb6b1('0xf')](_0x58027c));if(_0x58027c['error']){if(_0x58027c[_0xb6b1('0x10')]['code']===0x1f4){logger['error'](_0xb6b1('0x11'),_0x1a4cd0,_0x58027c[_0xb6b1('0x10')][_0xb6b1('0x12')]);return _0x52aa76(_0x58027c[_0xb6b1('0x10')][_0xb6b1('0x12')]);}logger[_0xb6b1('0x10')](_0xb6b1('0x11'),_0x1a4cd0,_0x58027c[_0xb6b1('0x10')][_0xb6b1('0x12')]);return _0x2734cc(_0x58027c[_0xb6b1('0x10')][_0xb6b1('0x12')]);}else{logger[_0xb6b1('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1a4cd0,'request\x20sent');_0x2734cc(_0x58027c['result']['message']);}})[_0xb6b1('0x13')](function(_0x12c595){logger[_0xb6b1('0x10')](_0xb6b1('0x11'),_0x1a4cd0,_0x12c595);_0x52aa76(_0x12c595);});});}exports[_0xb6b1('0x14')]=function(_0x51fb33){var _0x47a204=this;return new Promise(function(_0x581e28,_0x1bdf63){return db[_0xb6b1('0x15')][_0xb6b1('0x16')](_0x51fb33[_0xb6b1('0x17')],{'raw':_0x51fb33[_0xb6b1('0x18')]?_0x51fb33[_0xb6b1('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x43312e){logger[_0xb6b1('0xd')]('CreateOpenchannelQueueReport',_0x51fb33);logger['debug'](_0xb6b1('0x14'),_0x51fb33,JSON['stringify'](_0x43312e));_0x581e28(_0x43312e);})['catch'](function(_0x232157){logger[_0xb6b1('0x10')](_0xb6b1('0x14'),_0x232157[_0xb6b1('0x12')],_0x51fb33);_0x1bdf63(_0x47a204[_0xb6b1('0x10')](0x1f4,_0x232157[_0xb6b1('0x12')]));});});};exports[_0xb6b1('0x19')]=function(_0x3b1ff7){var _0x472585=this;return new Promise(function(_0x20066f,_0x5069cd){return db[_0xb6b1('0x15')]['update'](_0x3b1ff7[_0xb6b1('0x17')],{'raw':_0x3b1ff7['options']?_0x3b1ff7[_0xb6b1('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b1ff7[_0xb6b1('0x18')]?_0x3b1ff7[_0xb6b1('0x18')][_0xb6b1('0x1a')]||null:null,'attributes':_0x3b1ff7[_0xb6b1('0x18')]?_0x3b1ff7[_0xb6b1('0x18')][_0xb6b1('0x1b')]||null:null,'limit':_0x3b1ff7[_0xb6b1('0x18')]?_0x3b1ff7[_0xb6b1('0x18')][_0xb6b1('0x1c')]||null:null})['then'](function(_0xf40426){logger['info'](_0xb6b1('0x19'),_0x3b1ff7);logger[_0xb6b1('0x1d')](_0xb6b1('0x19'),_0x3b1ff7,JSON[_0xb6b1('0xf')](_0xf40426));_0x20066f(_0xf40426);})[_0xb6b1('0x13')](function(_0x12f369){logger[_0xb6b1('0x10')]('UpdateOpenchannelQueueReport',_0x12f369[_0xb6b1('0x12')],_0x3b1ff7);_0x5069cd(_0x472585[_0xb6b1('0x10')](0x1f4,_0x12f369[_0xb6b1('0x12')]));});});}; \ No newline at end of file +var _0x11f3=['OpenchannelQueueReport','create','body','options','raw','update','where','attributes','UpdateOpenchannelQueueReport','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport'];(function(_0x5dcff6,_0x4a8796){var _0x2699cd=function(_0x36a328){while(--_0x36a328){_0x5dcff6['push'](_0x5dcff6['shift']());}};_0x2699cd(++_0x4a8796);}(_0x11f3,0x149));var _0x311f=function(_0x3a485b,_0x1a1b38){_0x3a485b=_0x3a485b-0x0;var _0x379adc=_0x11f3[_0x3a485b];return _0x379adc;};'use strict';var _=require(_0x311f('0x0'));var util=require(_0x311f('0x1'));var moment=require(_0x311f('0x2'));var BPromise=require('bluebird');var rs=require(_0x311f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x311f('0x4'))['db'];var utils=require(_0x311f('0x5'));var logger=require(_0x311f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x311f('0x7'));var client=jayson['client'][_0x311f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xcbec7b,_0x11c88d,_0x3381a7){return new BPromise(function(_0x565d4d,_0x24a3fc){return client[_0x311f('0x9')](_0xcbec7b,_0x3381a7)[_0x311f('0xa')](function(_0x21b762){logger[_0x311f('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x11c88d,_0x311f('0xc'));logger[_0x311f('0xd')](_0x311f('0xe'),_0x11c88d,_0x311f('0xc'),JSON[_0x311f('0xf')](_0x21b762));if(_0x21b762[_0x311f('0x10')]){if(_0x21b762[_0x311f('0x10')][_0x311f('0x11')]===0x1f4){logger[_0x311f('0x10')](_0x311f('0x12'),_0x11c88d,_0x21b762[_0x311f('0x10')][_0x311f('0x13')]);return _0x24a3fc(_0x21b762[_0x311f('0x10')][_0x311f('0x13')]);}logger[_0x311f('0x10')](_0x311f('0x12'),_0x11c88d,_0x21b762[_0x311f('0x10')][_0x311f('0x13')]);return _0x565d4d(_0x21b762[_0x311f('0x10')]['message']);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x11c88d,_0x311f('0xc'));_0x565d4d(_0x21b762[_0x311f('0x14')][_0x311f('0x13')]);}})[_0x311f('0x15')](function(_0xb8227e){logger[_0x311f('0x10')](_0x311f('0x12'),_0x11c88d,_0xb8227e);_0x24a3fc(_0xb8227e);});});}exports[_0x311f('0x16')]=function(_0x3ee04d){var _0x5c7ac0=this;return new Promise(function(_0x7e7d28,_0x43f3a0){return db[_0x311f('0x17')][_0x311f('0x18')](_0x3ee04d[_0x311f('0x19')],{'raw':_0x3ee04d[_0x311f('0x1a')]?_0x3ee04d[_0x311f('0x1a')][_0x311f('0x1b')]===undefined?!![]:![]:!![]})[_0x311f('0xa')](function(_0x67ea17){logger['info'](_0x311f('0x16'),_0x3ee04d);logger['debug'](_0x311f('0x16'),_0x3ee04d,JSON['stringify'](_0x67ea17));_0x7e7d28(_0x67ea17);})[_0x311f('0x15')](function(_0x32d9bf){logger[_0x311f('0x10')](_0x311f('0x16'),_0x32d9bf[_0x311f('0x13')],_0x3ee04d);_0x43f3a0(_0x5c7ac0[_0x311f('0x10')](0x1f4,_0x32d9bf['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x5dd17d){var _0x271f1a=this;return new Promise(function(_0x4429d3,_0x5ece19){return db[_0x311f('0x17')][_0x311f('0x1c')](_0x5dd17d[_0x311f('0x19')],{'raw':_0x5dd17d['options']?_0x5dd17d[_0x311f('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5dd17d[_0x311f('0x1a')]?_0x5dd17d[_0x311f('0x1a')][_0x311f('0x1d')]||null:null,'attributes':_0x5dd17d['options']?_0x5dd17d[_0x311f('0x1a')][_0x311f('0x1e')]||null:null,'limit':_0x5dd17d[_0x311f('0x1a')]?_0x5dd17d['options']['limit']||null:null})[_0x311f('0xa')](function(_0x49cfc3){logger[_0x311f('0xb')](_0x311f('0x1f'),_0x5dd17d);logger[_0x311f('0xd')](_0x311f('0x1f'),_0x5dd17d,JSON['stringify'](_0x49cfc3));_0x4429d3(_0x49cfc3);})[_0x311f('0x15')](function(_0x4abddb){logger[_0x311f('0x10')](_0x311f('0x1f'),_0x4abddb[_0x311f('0x13')],_0x5dd17d);_0x5ece19(_0x271f1a['error'](0x1f4,_0x4abddb[_0x311f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 89a45eb..958ae42 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(_0x52e0ee,_0x52f7c1){var _0x32534c=function(_0x535d65){while(--_0x535d65){_0x52e0ee['push'](_0x52e0ee['shift']());}};_0x32534c(++_0x52f7c1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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(_0x33a694,_0x9b6640){var _0x41ff01=function(_0x4c38b7){while(--_0x4c38b7){_0x33a694['push'](_0x33a694['shift']());}};_0x41ff01(++_0x9b6640);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 accae44..ec303fb 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 _0x6dce=['ENUM','account','agent','queue','DATE','NOW','moment','exports','STRING'];(function(_0x336cda,_0x3a7718){var _0x190b40=function(_0x2a0b94){while(--_0x2a0b94){_0x336cda['push'](_0x336cda['shift']());}};_0x190b40(++_0x3a7718);}(_0x6dce,0x10b));var _0xe6dc=function(_0x2d34cc,_0x4a6cf1){_0x2d34cc=_0x2d34cc-0x0;var _0x1439ac=_0x6dce[_0x2d34cc];return _0x1439ac;};'use strict';var moment=require(_0xe6dc('0x0'));var Sequelize=require('sequelize');module[_0xe6dc('0x1')]={'uniqueid':{'type':Sequelize[_0xe6dc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe6dc('0x3')](_0xe6dc('0x4'),_0xe6dc('0x5'),_0xe6dc('0x6')),'allowNull':![],'defaultValue':_0xe6dc('0x6')},'transferredAt':{'type':Sequelize[_0xe6dc('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xe6dc('0x8')]}}; \ No newline at end of file +var _0x1bac=['exports','STRING','ENUM','account','queue','NOW','moment','sequelize'];(function(_0x350258,_0x4e0a50){var _0x3714b3=function(_0x8918f7){while(--_0x8918f7){_0x350258['push'](_0x350258['shift']());}};_0x3714b3(++_0x4e0a50);}(_0x1bac,0x12e));var _0xc1ba=function(_0x246527,_0x329631){_0x246527=_0x246527-0x0;var _0x55393d=_0x1bac[_0x246527];return _0x55393d;};'use strict';var moment=require(_0xc1ba('0x0'));var Sequelize=require(_0xc1ba('0x1'));module[_0xc1ba('0x2')]={'uniqueid':{'type':Sequelize[_0xc1ba('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc1ba('0x4')](_0xc1ba('0x5'),'agent',_0xc1ba('0x6')),'allowNull':![],'defaultValue':_0xc1ba('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xc1ba('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 6c401ad..f8f64c5 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 _0xec1d=['rows','show','params','find','create','body','catch','describe','html-pdf','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','end','json','offset','limit','status','set','Content-Range','save','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelTransferReport','count','includeAll','include','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xec1d,0x1ac));var _0xdec1=function(_0x2f67cc,_0x5e41eb){_0x2f67cc=_0x2f67cc-0x0;var _0x3adf53=_0xec1d[_0x2f67cc];return _0x3adf53;};'use strict';var pdf=require(_0xdec1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xdec1('0x1'));var zipdir=require(_0xdec1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdec1('0x3'));var BPromise=require(_0xdec1('0x4'));var Mustache=require('mustache');var util=require(_0xdec1('0x5'));var path=require('path');var sox=require(_0xdec1('0x6'));var csv=require(_0xdec1('0x7'));var ejs=require(_0xdec1('0x8'));var fs=require('fs');var _=require(_0xdec1('0x9'));var squel=require(_0xdec1('0xa'));var crypto=require(_0xdec1('0xb'));var jsforce=require(_0xdec1('0xc'));var deskjs=require(_0xdec1('0xd'));var toCsv=require(_0xdec1('0x7'));var querystring=require(_0xdec1('0xe'));var Papa=require(_0xdec1('0xf'));var Redis=require('ioredis');var authService=require(_0xdec1('0x10'));var qs=require(_0xdec1('0x11'));var as=require(_0xdec1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdec1('0x13'))(_0xdec1('0x14'));var utils=require('../../config/utils');var config=require(_0xdec1('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fef2b,_0x443769){_0x443769=_0x443769||0xcc;return function(_0x1cc628){if(_0x1cc628){return _0x1fef2b[_0xdec1('0x16')](_0x443769);}return _0x1fef2b['status'](_0x443769)[_0xdec1('0x17')]();};}function respondWithResult(_0x17a06b,_0x7e84b8){_0x7e84b8=_0x7e84b8||0xc8;return function(_0x55f73d){if(_0x55f73d){return _0x17a06b['status'](_0x7e84b8)[_0xdec1('0x18')](_0x55f73d);}};}function respondWithFilteredResult(_0xae232c,_0x34e26a){return function(_0x2be2f8){if(_0x2be2f8){var _0x3ccbce=_0x2be2f8['count'],_0x5ce7a9=_0x34e26a[_0xdec1('0x19')],_0x19b97c=_0x34e26a[_0xdec1('0x19')]+_0x34e26a[_0xdec1('0x1a')],_0x5801b9;if(_0x19b97c>=_0x3ccbce){_0x19b97c=_0x3ccbce;_0x5801b9=0xc8;}else{_0x5801b9=0xce;}_0xae232c[_0xdec1('0x1b')](_0x5801b9);return _0xae232c[_0xdec1('0x1c')](_0xdec1('0x1d'),_0x5ce7a9+'-'+_0x19b97c+'/'+_0x3ccbce)[_0xdec1('0x18')](_0x2be2f8);}return null;};}function patchUpdates(_0x1d3876){return function(_0x396579){try{jsonpatch['apply'](_0x396579,_0x1d3876,!![]);}catch(_0x3a6ee0){return BPromise['reject'](_0x3a6ee0);}return _0x396579[_0xdec1('0x1e')]();};}function saveUpdates(_0x37c7d5,_0x346154){return function(_0x35008f){if(_0x35008f){return _0x35008f['update'](_0x37c7d5)[_0xdec1('0x1f')](function(_0x2245bb){return _0x2245bb;});}return null;};}function removeEntity(_0x459e02,_0x148533){return function(_0x3c7e8d){if(_0x3c7e8d){return _0x3c7e8d[_0xdec1('0x20')]()['then'](function(){_0x459e02[_0xdec1('0x1b')](0xcc)[_0xdec1('0x17')]();});}};}function handleEntityNotFound(_0x3e2b50,_0x276480){return function(_0x5384f7){if(!_0x5384f7){_0x3e2b50[_0xdec1('0x16')](0x194);}return _0x5384f7;};}function handleError(_0x47038a,_0x59c2d7){_0x59c2d7=_0x59c2d7||0x1f4;return function(_0x19343f){logger[_0xdec1('0x21')](_0x19343f['stack']);if(_0x19343f['name']){delete _0x19343f[_0xdec1('0x22')];}_0x47038a[_0xdec1('0x1b')](_0x59c2d7)[_0xdec1('0x23')](_0x19343f);};}exports['index']=function(_0x1548d5,_0x4e1c65){var _0x34cf90={},_0x27f0e1={},_0x861068={'count':0x0,'rows':[]};var _0x1639e8=_[_0xdec1('0x24')](db['OpenchannelTransferReport'][_0xdec1('0x25')],function(_0x12c269){return{'name':_0x12c269[_0xdec1('0x26')],'type':_0x12c269[_0xdec1('0x27')][_0xdec1('0x28')]};});_0x27f0e1[_0xdec1('0x29')]=_['map'](_0x1639e8,_0xdec1('0x22'));_0x27f0e1[_0xdec1('0x2a')]=_[_0xdec1('0x2b')](_0x1548d5['query']);_0x27f0e1[_0xdec1('0x2c')]=_[_0xdec1('0x2d')](_0x27f0e1[_0xdec1('0x29')],_0x27f0e1[_0xdec1('0x2a')]);_0x34cf90['attributes']=_['intersection'](_0x27f0e1[_0xdec1('0x29')],qs[_0xdec1('0x2e')](_0x1548d5[_0xdec1('0x2a')][_0xdec1('0x2e')]));_0x34cf90[_0xdec1('0x2f')]=_0x34cf90[_0xdec1('0x2f')][_0xdec1('0x30')]?_0x34cf90[_0xdec1('0x2f')]:_0x27f0e1[_0xdec1('0x29')];if(!_0x1548d5['query']['hasOwnProperty']('nolimit')){_0x34cf90[_0xdec1('0x1a')]=qs[_0xdec1('0x1a')](_0x1548d5[_0xdec1('0x2a')][_0xdec1('0x1a')]);_0x34cf90[_0xdec1('0x19')]=qs[_0xdec1('0x19')](_0x1548d5[_0xdec1('0x2a')][_0xdec1('0x19')]);}_0x34cf90[_0xdec1('0x31')]=qs[_0xdec1('0x32')](_0x1548d5['query'][_0xdec1('0x32')]);_0x34cf90[_0xdec1('0x33')]=qs['filters'](_[_0xdec1('0x34')](_0x1548d5['query'],_0x27f0e1[_0xdec1('0x2c')]));if(_0x1548d5[_0xdec1('0x2a')][_0xdec1('0x35')]){_0x34cf90[_0xdec1('0x33')]=_[_0xdec1('0x36')](_0x34cf90['where'],{'$or':_[_0xdec1('0x24')](_0x1639e8,function(_0x216986){if(_0x216986['type']!==_0xdec1('0x37')){var _0x2a2042={};_0x2a2042[_0x216986[_0xdec1('0x22')]]={'$like':'%'+_0x1548d5[_0xdec1('0x2a')][_0xdec1('0x35')]+'%'};return _0x2a2042;}})});}_0x34cf90=_[_0xdec1('0x36')]({},_0x34cf90,_0x1548d5[_0xdec1('0x38')]);var _0xd478aa={'where':_0x34cf90[_0xdec1('0x33')]};return db[_0xdec1('0x39')][_0xdec1('0x3a')](_0xd478aa)[_0xdec1('0x1f')](function(_0x1c8647){_0x861068[_0xdec1('0x3a')]=_0x1c8647;if(_0x1548d5[_0xdec1('0x2a')][_0xdec1('0x3b')]){_0x34cf90[_0xdec1('0x3c')]=[{'all':!![]}];}return db[_0xdec1('0x39')][_0xdec1('0x3d')](_0x34cf90);})[_0xdec1('0x1f')](function(_0x253388){_0x861068[_0xdec1('0x3e')]=_0x253388;return _0x861068;})['then'](respondWithFilteredResult(_0x4e1c65,_0x34cf90))['catch'](handleError(_0x4e1c65,null));};exports[_0xdec1('0x3f')]=function(_0x11f10a,_0x5f2c24){var _0xfa4607={'raw':!![],'where':{'id':_0x11f10a[_0xdec1('0x40')]['id']}},_0x22a0c0={};_0x22a0c0[_0xdec1('0x29')]=_[_0xdec1('0x2b')](db[_0xdec1('0x39')][_0xdec1('0x25')]);_0x22a0c0[_0xdec1('0x2a')]=_[_0xdec1('0x2b')](_0x11f10a[_0xdec1('0x2a')]);_0x22a0c0[_0xdec1('0x2c')]=_['intersection'](_0x22a0c0[_0xdec1('0x29')],_0x22a0c0[_0xdec1('0x2a')]);_0xfa4607[_0xdec1('0x2f')]=_[_0xdec1('0x2d')](_0x22a0c0[_0xdec1('0x29')],qs[_0xdec1('0x2e')](_0x11f10a[_0xdec1('0x2a')][_0xdec1('0x2e')]));_0xfa4607[_0xdec1('0x2f')]=_0xfa4607[_0xdec1('0x2f')][_0xdec1('0x30')]?_0xfa4607[_0xdec1('0x2f')]:_0x22a0c0[_0xdec1('0x29')];if(_0x11f10a[_0xdec1('0x2a')]['includeAll']){_0xfa4607[_0xdec1('0x3c')]=[{'all':!![]}];}_0xfa4607=_['merge']({},_0xfa4607,_0x11f10a[_0xdec1('0x38')]);return db['OpenchannelTransferReport'][_0xdec1('0x41')](_0xfa4607)[_0xdec1('0x1f')](handleEntityNotFound(_0x5f2c24,null))[_0xdec1('0x1f')](respondWithResult(_0x5f2c24,null))['catch'](handleError(_0x5f2c24,null));};exports[_0xdec1('0x42')]=function(_0x3440aa,_0x454684){return db['OpenchannelTransferReport'][_0xdec1('0x42')](_0x3440aa[_0xdec1('0x43')],{})[_0xdec1('0x1f')](respondWithResult(_0x454684,0xc9))[_0xdec1('0x44')](handleError(_0x454684,null));};exports['update']=function(_0x2977c8,_0x1f4416){if(_0x2977c8['body']['id']){delete _0x2977c8[_0xdec1('0x43')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x2977c8[_0xdec1('0x40')]['id']}})['then'](handleEntityNotFound(_0x1f4416,null))[_0xdec1('0x1f')](saveUpdates(_0x2977c8[_0xdec1('0x43')],null))[_0xdec1('0x1f')](respondWithResult(_0x1f4416,null))[_0xdec1('0x44')](handleError(_0x1f4416,null));};exports[_0xdec1('0x20')]=function(_0x52bb4a,_0x19eeb9){return db['OpenchannelTransferReport'][_0xdec1('0x41')]({'where':{'id':_0x52bb4a[_0xdec1('0x40')]['id']}})[_0xdec1('0x1f')](handleEntityNotFound(_0x19eeb9,null))[_0xdec1('0x1f')](removeEntity(_0x19eeb9,null))[_0xdec1('0x44')](handleError(_0x19eeb9,null));};exports['describe']=function(_0x59fc65,_0x1b241c){return db[_0xdec1('0x39')][_0xdec1('0x45')]()['then'](respondWithResult(_0x1b241c,null))[_0xdec1('0x44')](handleError(_0x1b241c,null));}; \ No newline at end of file +var _0xd712=['destroy','end','sendStatus','error','stack','name','send','map','OpenchannelTransferReport','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','includeAll','include','catch','show','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','save','update','then'];(function(_0x58328a,_0xd717b0){var _0x49bc21=function(_0x440421){while(--_0x440421){_0x58328a['push'](_0x58328a['shift']());}};_0x49bc21(++_0xd717b0);}(_0xd712,0xfb));var _0x2d71=function(_0x233092,_0x3149ab){_0x233092=_0x233092-0x0;var _0xc5d9ad=_0xd712[_0x233092];return _0xc5d9ad;};'use strict';var pdf=require(_0x2d71('0x0'));var emlformat=require(_0x2d71('0x1'));var rimraf=require(_0x2d71('0x2'));var zipdir=require(_0x2d71('0x3'));var jsonpatch=require(_0x2d71('0x4'));var rp=require(_0x2d71('0x5'));var moment=require(_0x2d71('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x2d71('0x7'));var util=require('util');var path=require(_0x2d71('0x8'));var sox=require(_0x2d71('0x9'));var csv=require(_0x2d71('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2d71('0xb'));var squel=require(_0x2d71('0xc'));var crypto=require(_0x2d71('0xd'));var jsforce=require(_0x2d71('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2d71('0xa'));var querystring=require(_0x2d71('0xf'));var Papa=require(_0x2d71('0x10'));var Redis=require('ioredis');var authService=require(_0x2d71('0x11'));var qs=require(_0x2d71('0x12'));var as=require(_0x2d71('0x13'));var hardwareService=require(_0x2d71('0x14'));var logger=require(_0x2d71('0x15'))(_0x2d71('0x16'));var utils=require(_0x2d71('0x17'));var config=require(_0x2d71('0x18'));var db=require(_0x2d71('0x19'))['db'];function respondWithStatusCode(_0x12b505,_0x36e59c){_0x36e59c=_0x36e59c||0xcc;return function(_0x2b0622){if(_0x2b0622){return _0x12b505['sendStatus'](_0x36e59c);}return _0x12b505[_0x2d71('0x1a')](_0x36e59c)['end']();};}function respondWithResult(_0x10ebde,_0x46adba){_0x46adba=_0x46adba||0xc8;return function(_0x19ebe5){if(_0x19ebe5){return _0x10ebde[_0x2d71('0x1a')](_0x46adba)[_0x2d71('0x1b')](_0x19ebe5);}};}function respondWithFilteredResult(_0x2022e3,_0xe68eb3){return function(_0xe9359d){if(_0xe9359d){var _0x118ffe=_0xe9359d[_0x2d71('0x1c')],_0x4a0ad1=_0xe68eb3['offset'],_0x313191=_0xe68eb3[_0x2d71('0x1d')]+_0xe68eb3[_0x2d71('0x1e')],_0x243073;if(_0x313191>=_0x118ffe){_0x313191=_0x118ffe;_0x243073=0xc8;}else{_0x243073=0xce;}_0x2022e3[_0x2d71('0x1a')](_0x243073);return _0x2022e3[_0x2d71('0x1f')](_0x2d71('0x20'),_0x4a0ad1+'-'+_0x313191+'/'+_0x118ffe)[_0x2d71('0x1b')](_0xe9359d);}return null;};}function patchUpdates(_0x364e7a){return function(_0x210f28){try{jsonpatch[_0x2d71('0x21')](_0x210f28,_0x364e7a,!![]);}catch(_0x82a54f){return BPromise['reject'](_0x82a54f);}return _0x210f28[_0x2d71('0x22')]();};}function saveUpdates(_0x303310,_0x307b65){return function(_0x39b4bc){if(_0x39b4bc){return _0x39b4bc[_0x2d71('0x23')](_0x303310)[_0x2d71('0x24')](function(_0x41ea4a){return _0x41ea4a;});}return null;};}function removeEntity(_0x5a8688,_0x46cd32){return function(_0x2cccf8){if(_0x2cccf8){return _0x2cccf8[_0x2d71('0x25')]()[_0x2d71('0x24')](function(){_0x5a8688[_0x2d71('0x1a')](0xcc)[_0x2d71('0x26')]();});}};}function handleEntityNotFound(_0x367b14,_0x18ef31){return function(_0x5a9d1e){if(!_0x5a9d1e){_0x367b14[_0x2d71('0x27')](0x194);}return _0x5a9d1e;};}function handleError(_0x449190,_0x5a35f8){_0x5a35f8=_0x5a35f8||0x1f4;return function(_0x2a234e){logger[_0x2d71('0x28')](_0x2a234e[_0x2d71('0x29')]);if(_0x2a234e['name']){delete _0x2a234e[_0x2d71('0x2a')];}_0x449190['status'](_0x5a35f8)[_0x2d71('0x2b')](_0x2a234e);};}exports['index']=function(_0x2756ff,_0xf09f34){var _0x78fe85={},_0x1eed62={},_0x18049d={'count':0x0,'rows':[]};var _0x3b47c9=_[_0x2d71('0x2c')](db[_0x2d71('0x2d')][_0x2d71('0x2e')],function(_0x4df86d){return{'name':_0x4df86d['fieldName'],'type':_0x4df86d[_0x2d71('0x2f')][_0x2d71('0x30')]};});_0x1eed62[_0x2d71('0x31')]=_[_0x2d71('0x2c')](_0x3b47c9,_0x2d71('0x2a'));_0x1eed62['query']=_[_0x2d71('0x32')](_0x2756ff['query']);_0x1eed62[_0x2d71('0x33')]=_[_0x2d71('0x34')](_0x1eed62[_0x2d71('0x31')],_0x1eed62[_0x2d71('0x35')]);_0x78fe85[_0x2d71('0x36')]=_[_0x2d71('0x34')](_0x1eed62['model'],qs[_0x2d71('0x37')](_0x2756ff[_0x2d71('0x35')][_0x2d71('0x37')]));_0x78fe85['attributes']=_0x78fe85[_0x2d71('0x36')][_0x2d71('0x38')]?_0x78fe85[_0x2d71('0x36')]:_0x1eed62[_0x2d71('0x31')];if(!_0x2756ff[_0x2d71('0x35')][_0x2d71('0x39')](_0x2d71('0x3a'))){_0x78fe85[_0x2d71('0x1e')]=qs['limit'](_0x2756ff['query'][_0x2d71('0x1e')]);_0x78fe85[_0x2d71('0x1d')]=qs[_0x2d71('0x1d')](_0x2756ff[_0x2d71('0x35')]['offset']);}_0x78fe85['order']=qs[_0x2d71('0x3b')](_0x2756ff['query'][_0x2d71('0x3b')]);_0x78fe85[_0x2d71('0x3c')]=qs[_0x2d71('0x33')](_['pick'](_0x2756ff['query'],_0x1eed62[_0x2d71('0x33')]));if(_0x2756ff[_0x2d71('0x35')][_0x2d71('0x3d')]){_0x78fe85['where']=_[_0x2d71('0x3e')](_0x78fe85[_0x2d71('0x3c')],{'$or':_[_0x2d71('0x2c')](_0x3b47c9,function(_0x7e4c7d){if(_0x7e4c7d[_0x2d71('0x2f')]!=='VIRTUAL'){var _0x5dd033={};_0x5dd033[_0x7e4c7d['name']]={'$like':'%'+_0x2756ff['query'][_0x2d71('0x3d')]+'%'};return _0x5dd033;}})});}_0x78fe85=_[_0x2d71('0x3e')]({},_0x78fe85,_0x2756ff['options']);var _0x3aaff3={'where':_0x78fe85[_0x2d71('0x3c')]};return db[_0x2d71('0x2d')]['count'](_0x3aaff3)['then'](function(_0x48fc0d){_0x18049d[_0x2d71('0x1c')]=_0x48fc0d;if(_0x2756ff['query'][_0x2d71('0x3f')]){_0x78fe85[_0x2d71('0x40')]=[{'all':!![]}];}return db['OpenchannelTransferReport']['findAll'](_0x78fe85);})[_0x2d71('0x24')](function(_0x4f10f8){_0x18049d['rows']=_0x4f10f8;return _0x18049d;})[_0x2d71('0x24')](respondWithFilteredResult(_0xf09f34,_0x78fe85))[_0x2d71('0x41')](handleError(_0xf09f34,null));};exports[_0x2d71('0x42')]=function(_0x52aed4,_0xafeb67){var _0x2bef8c={'raw':!![],'where':{'id':_0x52aed4['params']['id']}},_0x204a17={};_0x204a17['model']=_[_0x2d71('0x32')](db['OpenchannelTransferReport'][_0x2d71('0x2e')]);_0x204a17[_0x2d71('0x35')]=_[_0x2d71('0x32')](_0x52aed4[_0x2d71('0x35')]);_0x204a17[_0x2d71('0x33')]=_[_0x2d71('0x34')](_0x204a17[_0x2d71('0x31')],_0x204a17[_0x2d71('0x35')]);_0x2bef8c[_0x2d71('0x36')]=_[_0x2d71('0x34')](_0x204a17[_0x2d71('0x31')],qs['fields'](_0x52aed4[_0x2d71('0x35')][_0x2d71('0x37')]));_0x2bef8c[_0x2d71('0x36')]=_0x2bef8c[_0x2d71('0x36')][_0x2d71('0x38')]?_0x2bef8c[_0x2d71('0x36')]:_0x204a17[_0x2d71('0x31')];if(_0x52aed4[_0x2d71('0x35')][_0x2d71('0x3f')]){_0x2bef8c[_0x2d71('0x40')]=[{'all':!![]}];}_0x2bef8c=_[_0x2d71('0x3e')]({},_0x2bef8c,_0x52aed4['options']);return db[_0x2d71('0x2d')][_0x2d71('0x43')](_0x2bef8c)[_0x2d71('0x24')](handleEntityNotFound(_0xafeb67,null))['then'](respondWithResult(_0xafeb67,null))[_0x2d71('0x41')](handleError(_0xafeb67,null));};exports[_0x2d71('0x44')]=function(_0x43d395,_0x131c27){return db['OpenchannelTransferReport']['create'](_0x43d395[_0x2d71('0x45')],{})[_0x2d71('0x24')](respondWithResult(_0x131c27,0xc9))['catch'](handleError(_0x131c27,null));};exports[_0x2d71('0x23')]=function(_0x3ada67,_0x57c545){if(_0x3ada67[_0x2d71('0x45')]['id']){delete _0x3ada67[_0x2d71('0x45')]['id'];}return db[_0x2d71('0x2d')][_0x2d71('0x43')]({'where':{'id':_0x3ada67[_0x2d71('0x46')]['id']}})[_0x2d71('0x24')](handleEntityNotFound(_0x57c545,null))[_0x2d71('0x24')](saveUpdates(_0x3ada67[_0x2d71('0x45')],null))[_0x2d71('0x24')](respondWithResult(_0x57c545,null))[_0x2d71('0x41')](handleError(_0x57c545,null));};exports[_0x2d71('0x25')]=function(_0x3133aa,_0x81b6f2){return db[_0x2d71('0x2d')][_0x2d71('0x43')]({'where':{'id':_0x3133aa[_0x2d71('0x46')]['id']}})[_0x2d71('0x24')](handleEntityNotFound(_0x81b6f2,null))[_0x2d71('0x24')](removeEntity(_0x81b6f2,null))[_0x2d71('0x41')](handleError(_0x81b6f2,null));};exports['describe']=function(_0x370bd4,_0x58a232){return db[_0x2d71('0x2d')][_0x2d71('0x47')]()[_0x2d71('0x24')](respondWithResult(_0x58a232,null))['catch'](handleError(_0x58a232,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 229438f..4f48e55 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 _0xe084=['request-promise','path','rimraf','exports','define','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x508619,_0x23a4a9){var _0xe7bd99=function(_0x4af77b){while(--_0x4af77b){_0x508619['push'](_0x508619['shift']());}};_0xe7bd99(++_0x23a4a9);}(_0xe084,0x67));var _0x4e08=function(_0x25b549,_0x4426d6){_0x25b549=_0x25b549-0x0;var _0xc8e732=_0xe084[_0x25b549];return _0xc8e732;};'use strict';var _=require(_0x4e08('0x0'));var util=require(_0x4e08('0x1'));var logger=require(_0x4e08('0x2'))('api');var moment=require(_0x4e08('0x3'));var BPromise=require(_0x4e08('0x4'));var rp=require(_0x4e08('0x5'));var fs=require('fs');var path=require(_0x4e08('0x6'));var rimraf=require(_0x4e08('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module[_0x4e08('0x8')]=function(_0x3b9f07,_0x23c89b){return _0x3b9f07[_0x4e08('0x9')]('OpenchannelTransferReport',attributes,{'tableName':_0x4e08('0xa'),'paranoid':![],'indexes':[{'name':_0x4e08('0xb'),'fields':[_0x4e08('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3b16=['../../config/logger','api','moment','bluebird','request-promise','path','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util'];(function(_0x2811bd,_0xb9a3e9){var _0x308145=function(_0x309935){while(--_0x309935){_0x2811bd['push'](_0x2811bd['shift']());}};_0x308145(++_0xb9a3e9);}(_0x3b16,0x150));var _0x63b1=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x3b16[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x63b1('0x0'));var util=require(_0x63b1('0x1'));var logger=require(_0x63b1('0x2'))(_0x63b1('0x3'));var moment=require(_0x63b1('0x4'));var BPromise=require(_0x63b1('0x5'));var rp=require(_0x63b1('0x6'));var fs=require('fs');var path=require(_0x63b1('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module[_0x63b1('0x8')]=function(_0x48bda1,_0x194171){return _0x48bda1[_0x63b1('0x9')](_0x63b1('0xa'),attributes,{'tableName':_0x63b1('0xb'),'paranoid':![],'indexes':[{'name':_0x63b1('0xc'),'fields':[_0x63b1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index d57a36a..679ebfe 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 _0x5735=['jayson/promise','http','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','bluebird','randomstring','../../config/logger','rpc','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5735,0x16a));var _0x5573=function(_0x1d656c,_0x14fba4){_0x1d656c=_0x1d656c-0x0;var _0x4eeb25=_0x5735[_0x1d656c];return _0x4eeb25;};'use strict';var _=require(_0x5573('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5573('0x1'));var rs=require(_0x5573('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5573('0x3'))(_0x5573('0x4'));var config=require(_0x5573('0x5'));var jayson=require(_0x5573('0x6'));var client=jayson['client'][_0x5573('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x9f36d2,_0x2e7e92,_0x46bc52){return new BPromise(function(_0x407489,_0x3dc2dd){return client['request'](_0x9f36d2,_0x46bc52)['then'](function(_0x26f696){logger[_0x5573('0x8')](_0x5573('0x9'),_0x2e7e92,_0x5573('0xa'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x2e7e92,_0x5573('0xa'),JSON['stringify'](_0x26f696));if(_0x26f696[_0x5573('0xb')]){if(_0x26f696[_0x5573('0xb')][_0x5573('0xc')]===0x1f4){logger[_0x5573('0xb')](_0x5573('0x9'),_0x2e7e92,_0x26f696[_0x5573('0xb')][_0x5573('0xd')]);return _0x3dc2dd(_0x26f696[_0x5573('0xb')][_0x5573('0xd')]);}logger[_0x5573('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2e7e92,_0x26f696[_0x5573('0xb')][_0x5573('0xd')]);return _0x407489(_0x26f696['error'][_0x5573('0xd')]);}else{logger[_0x5573('0x8')](_0x5573('0x9'),_0x2e7e92,'request\x20sent');_0x407489(_0x26f696[_0x5573('0xe')]['message']);}})[_0x5573('0xf')](function(_0x136e23){logger[_0x5573('0xb')](_0x5573('0x9'),_0x2e7e92,_0x136e23);_0x3dc2dd(_0x136e23);});});} \ No newline at end of file +var _0x5e51=['rpc','../../config/environment','jayson/promise','client','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger'];(function(_0x23c02b,_0x411b4d){var _0x25efc5=function(_0x50e9e4){while(--_0x50e9e4){_0x23c02b['push'](_0x23c02b['shift']());}};_0x25efc5(++_0x411b4d);}(_0x5e51,0x86));var _0x15e5=function(_0x4c7c4a,_0x520920){_0x4c7c4a=_0x4c7c4a-0x0;var _0x4d78ae=_0x5e51[_0x4c7c4a];return _0x4d78ae;};'use strict';var _=require(_0x15e5('0x0'));var util=require(_0x15e5('0x1'));var moment=require(_0x15e5('0x2'));var BPromise=require('bluebird');var rs=require(_0x15e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x15e5('0x4'));var logger=require(_0x15e5('0x5'))(_0x15e5('0x6'));var config=require(_0x15e5('0x7'));var jayson=require(_0x15e5('0x8'));var client=jayson[_0x15e5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53e365,_0x3c59,_0x478124){return new BPromise(function(_0xb74b45,_0x5e35fc){return client['request'](_0x53e365,_0x478124)['then'](function(_0x29ae5b){logger[_0x15e5('0xa')](_0x15e5('0xb'),_0x3c59,_0x15e5('0xc'));logger[_0x15e5('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x3c59,'request\x20sent',JSON[_0x15e5('0xe')](_0x29ae5b));if(_0x29ae5b['error']){if(_0x29ae5b[_0x15e5('0xf')][_0x15e5('0x10')]===0x1f4){logger['error'](_0x15e5('0xb'),_0x3c59,_0x29ae5b[_0x15e5('0xf')][_0x15e5('0x11')]);return _0x5e35fc(_0x29ae5b['error'][_0x15e5('0x11')]);}logger['error'](_0x15e5('0xb'),_0x3c59,_0x29ae5b[_0x15e5('0xf')][_0x15e5('0x11')]);return _0xb74b45(_0x29ae5b[_0x15e5('0xf')]['message']);}else{logger[_0x15e5('0xa')](_0x15e5('0xb'),_0x3c59,_0x15e5('0xc'));_0xb74b45(_0x29ae5b[_0x15e5('0x12')][_0x15e5('0x11')]);}})[_0x15e5('0x13')](function(_0x11045f){logger['error'](_0x15e5('0xb'),_0x3c59,_0x11045f);_0x5e35fc(_0x11045f);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 206df28..06d832a 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 _0x1a55=['index','show','post','put','update','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./pause.controller','get','isAuthenticated'];(function(_0x3a2b32,_0x5531ee){var _0x5349e5=function(_0x462a80){while(--_0x462a80){_0x3a2b32['push'](_0x3a2b32['shift']());}};_0x5349e5(++_0x5531ee);}(_0x1a55,0x1b7));var _0x51a5=function(_0x3c2f91,_0x10d4ca){_0x3c2f91=_0x3c2f91-0x0;var _0x43a63b=_0x1a55[_0x3c2f91];return _0x43a63b;};'use strict';var multer=require('multer');var util=require(_0x51a5('0x0'));var path=require('path');var timeout=require(_0x51a5('0x1'));var express=require(_0x51a5('0x2'));var router=express[_0x51a5('0x3')]();var auth=require(_0x51a5('0x4'));var interaction=require(_0x51a5('0x5'));var config=require('../../config/environment');var controller=require(_0x51a5('0x6'));router[_0x51a5('0x7')]('/',auth[_0x51a5('0x8')](),controller[_0x51a5('0x9')]);router['get']('/:id',auth[_0x51a5('0x8')](),controller[_0x51a5('0xa')]);router[_0x51a5('0xb')]('/',auth[_0x51a5('0x8')](),controller['create']);router[_0x51a5('0xc')]('/:id',auth[_0x51a5('0x8')](),controller[_0x51a5('0xd')]);router['delete']('/:id',auth[_0x51a5('0x8')](),controller[_0x51a5('0xe')]);module[_0x51a5('0xf')]=router; \ No newline at end of file +var _0xccf2=['../../components/auth/service','../../components/interaction/service','./pause.controller','isAuthenticated','index','/:id','show','post','create','delete','exports','multer','util','path','express'];(function(_0xecc551,_0x471cac){var _0x344658=function(_0x5ef130){while(--_0x5ef130){_0xecc551['push'](_0xecc551['shift']());}};_0x344658(++_0x471cac);}(_0xccf2,0x74));var _0x2ccf=function(_0x616b3e,_0x21b5ef){_0x616b3e=_0x616b3e-0x0;var _0x2d39a9=_0xccf2[_0x616b3e];return _0x2d39a9;};'use strict';var multer=require(_0x2ccf('0x0'));var util=require(_0x2ccf('0x1'));var path=require(_0x2ccf('0x2'));var timeout=require('connect-timeout');var express=require(_0x2ccf('0x3'));var router=express['Router']();var auth=require(_0x2ccf('0x4'));var interaction=require(_0x2ccf('0x5'));var config=require('../../config/environment');var controller=require(_0x2ccf('0x6'));router['get']('/',auth[_0x2ccf('0x7')](),controller[_0x2ccf('0x8')]);router['get'](_0x2ccf('0x9'),auth[_0x2ccf('0x7')](),controller[_0x2ccf('0xa')]);router[_0x2ccf('0xb')]('/',auth[_0x2ccf('0x7')](),controller[_0x2ccf('0xc')]);router['put'](_0x2ccf('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x2ccf('0xd')]('/:id',auth[_0x2ccf('0x7')](),controller['destroy']);module[_0x2ccf('0xe')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 7d3e59f..f265bcf 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 _0xc792=['name','STRING','sequelize'];(function(_0x48a930,_0x56646a){var _0x373dc6=function(_0x1d833c){while(--_0x1d833c){_0x48a930['push'](_0x48a930['shift']());}};_0x373dc6(++_0x56646a);}(_0xc792,0x18e));var _0x2c79=function(_0x4abbc1,_0x2450fb){_0x4abbc1=_0x4abbc1-0x0;var _0x3e3a65=_0xc792[_0x4abbc1];return _0x3e3a65;};'use strict';var Sequelize=require(_0x2c79('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x2c79('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x2c79('0x2')]}}; \ No newline at end of file +var _0xedcb=['sequelize','STRING'];(function(_0x569407,_0x115d0f){var _0x51d1e3=function(_0x191efb){while(--_0x191efb){_0x569407['push'](_0x569407['shift']());}};_0x51d1e3(++_0x115d0f);}(_0xedcb,0x19a));var _0xbedc=function(_0x1cac3d,_0x5b3e51){_0x1cac3d=_0x1cac3d-0x0;var _0x28da42=_0xedcb[_0x1cac3d];return _0x28da42;};'use strict';var Sequelize=require(_0xbedc('0x0'));module['exports']={'name':{'type':Sequelize[_0xbedc('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xbedc('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 00e313b..a340ee7 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 _0xe29b=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','Pauses','UserProfileResource','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','options','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','error'];(function(_0x147af5,_0x520b7c){var _0x32ebb9=function(_0x28cf49){while(--_0x28cf49){_0x147af5['push'](_0x147af5['shift']());}};_0x32ebb9(++_0x520b7c);}(_0xe29b,0xb0));var _0xbe29=function(_0x41a2d7,_0x381166){_0x41a2d7=_0x41a2d7-0x0;var _0x4ff51d=_0xe29b[_0x41a2d7];return _0x4ff51d;};'use strict';var pdf=require(_0xbe29('0x0'));var emlformat=require(_0xbe29('0x1'));var rimraf=require(_0xbe29('0x2'));var zipdir=require(_0xbe29('0x3'));var jsonpatch=require(_0xbe29('0x4'));var rp=require(_0xbe29('0x5'));var moment=require(_0xbe29('0x6'));var BPromise=require(_0xbe29('0x7'));var Mustache=require(_0xbe29('0x8'));var util=require(_0xbe29('0x9'));var path=require(_0xbe29('0xa'));var sox=require(_0xbe29('0xb'));var csv=require(_0xbe29('0xc'));var ejs=require(_0xbe29('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbe29('0xe'));var crypto=require(_0xbe29('0xf'));var jsforce=require(_0xbe29('0x10'));var deskjs=require(_0xbe29('0x11'));var toCsv=require('to-csv');var querystring=require(_0xbe29('0x12'));var Papa=require(_0xbe29('0x13'));var Redis=require(_0xbe29('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xbe29('0x15'));var as=require(_0xbe29('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbe29('0x17'))(_0xbe29('0x18'));var utils=require('../../config/utils');var config=require(_0xbe29('0x19'));var db=require(_0xbe29('0x1a'))['db'];function respondWithStatusCode(_0x547f42,_0x1d2d98){_0x1d2d98=_0x1d2d98||0xcc;return function(_0xfbf8bf){if(_0xfbf8bf){return _0x547f42[_0xbe29('0x1b')](_0x1d2d98);}return _0x547f42[_0xbe29('0x1c')](_0x1d2d98)['end']();};}function respondWithResult(_0x2e53d1,_0x273488){_0x273488=_0x273488||0xc8;return function(_0x444c97){if(_0x444c97){return _0x2e53d1[_0xbe29('0x1c')](_0x273488)['json'](_0x444c97);}};}function respondWithFilteredResult(_0x495cf4,_0x533453){return function(_0x3fbe90){if(_0x3fbe90){var _0x3f2b58=_0x3fbe90[_0xbe29('0x1d')],_0x28ff5c=_0x533453['offset'],_0x4746cf=_0x533453[_0xbe29('0x1e')]+_0x533453[_0xbe29('0x1f')],_0xd107ae;if(_0x4746cf>=_0x3f2b58){_0x4746cf=_0x3f2b58;_0xd107ae=0xc8;}else{_0xd107ae=0xce;}_0x495cf4[_0xbe29('0x1c')](_0xd107ae);return _0x495cf4[_0xbe29('0x20')](_0xbe29('0x21'),_0x28ff5c+'-'+_0x4746cf+'/'+_0x3f2b58)[_0xbe29('0x22')](_0x3fbe90);}return null;};}function patchUpdates(_0x4cea81){return function(_0x326a25){try{jsonpatch[_0xbe29('0x23')](_0x326a25,_0x4cea81,!![]);}catch(_0x6cab69){return BPromise[_0xbe29('0x24')](_0x6cab69);}return _0x326a25['save']();};}function saveUpdates(_0x236e12,_0x75bdce){return function(_0x63f605){if(_0x63f605){return _0x63f605[_0xbe29('0x25')](_0x236e12)[_0xbe29('0x26')](function(_0x5d0d0c){return _0x5d0d0c;});}return null;};}function removeEntity(_0x27e1f7,_0xe3ba1b){return function(_0x51840e){if(_0x51840e){return _0x51840e[_0xbe29('0x27')]()[_0xbe29('0x26')](function(){var _0x58f5ff=_0x51840e[_0xbe29('0x28')]({'plain':!![]});var _0x3f7e13=_0xbe29('0x29');return db[_0xbe29('0x2a')][_0xbe29('0x27')]({'where':{'type':_0x3f7e13,'resourceId':_0x58f5ff['id']}})['then'](function(){return _0x51840e;});})[_0xbe29('0x26')](function(){_0x27e1f7[_0xbe29('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x927d74,_0x5c37ff){return function(_0xffcb9d){if(!_0xffcb9d){_0x927d74[_0xbe29('0x1b')](0x194);}return _0xffcb9d;};}function handleError(_0x5a8952,_0x1d8a2c){_0x1d8a2c=_0x1d8a2c||0x1f4;return function(_0x1a3d93){logger['error'](_0x1a3d93[_0xbe29('0x2b')]);if(_0x1a3d93[_0xbe29('0x2c')]){delete _0x1a3d93[_0xbe29('0x2c')];}_0x5a8952['status'](_0x1d8a2c)[_0xbe29('0x2d')](_0x1a3d93);};}exports[_0xbe29('0x2e')]=function(_0x607a60,_0x54f462){var _0x1bec11={},_0x3934fd={},_0x3052c7={'count':0x0,'rows':[]};var _0x2f3046=_[_0xbe29('0x2f')](db[_0xbe29('0x30')][_0xbe29('0x31')],function(_0x3f98dc){return{'name':_0x3f98dc[_0xbe29('0x32')],'type':_0x3f98dc[_0xbe29('0x33')][_0xbe29('0x34')]};});_0x3934fd[_0xbe29('0x35')]=_['map'](_0x2f3046,_0xbe29('0x2c'));_0x3934fd[_0xbe29('0x36')]=_[_0xbe29('0x37')](_0x607a60[_0xbe29('0x36')]);_0x3934fd[_0xbe29('0x38')]=_[_0xbe29('0x39')](_0x3934fd['model'],_0x3934fd[_0xbe29('0x36')]);_0x1bec11[_0xbe29('0x3a')]=_['intersection'](_0x3934fd['model'],qs[_0xbe29('0x3b')](_0x607a60['query']['fields']));_0x1bec11[_0xbe29('0x3a')]=_0x1bec11['attributes'][_0xbe29('0x3c')]?_0x1bec11[_0xbe29('0x3a')]:_0x3934fd[_0xbe29('0x35')];if(!_0x607a60[_0xbe29('0x36')][_0xbe29('0x3d')](_0xbe29('0x3e'))){_0x1bec11['limit']=qs[_0xbe29('0x1f')](_0x607a60[_0xbe29('0x36')][_0xbe29('0x1f')]);_0x1bec11[_0xbe29('0x1e')]=qs[_0xbe29('0x1e')](_0x607a60['query'][_0xbe29('0x1e')]);}_0x1bec11['order']=qs[_0xbe29('0x3f')](_0x607a60[_0xbe29('0x36')][_0xbe29('0x3f')]);_0x1bec11[_0xbe29('0x40')]=qs[_0xbe29('0x38')](_['pick'](_0x607a60[_0xbe29('0x36')],_0x3934fd[_0xbe29('0x38')]));if(_0x607a60[_0xbe29('0x36')][_0xbe29('0x41')]){_0x1bec11[_0xbe29('0x40')]=_[_0xbe29('0x42')](_0x1bec11[_0xbe29('0x40')],{'$or':_[_0xbe29('0x2f')](_0x2f3046,function(_0x120d0e){if(_0x120d0e[_0xbe29('0x33')]!==_0xbe29('0x43')){var _0x271a44={};_0x271a44[_0x120d0e[_0xbe29('0x2c')]]={'$like':'%'+_0x607a60[_0xbe29('0x36')][_0xbe29('0x41')]+'%'};return _0x271a44;}})});}_0x1bec11=_[_0xbe29('0x42')]({},_0x1bec11,_0x607a60['options']);var _0x48c078={'where':_0x1bec11[_0xbe29('0x40')]};return db[_0xbe29('0x30')][_0xbe29('0x1d')](_0x48c078)['then'](function(_0x1fd836){_0x3052c7['count']=_0x1fd836;if(_0x607a60[_0xbe29('0x36')][_0xbe29('0x44')]){_0x1bec11[_0xbe29('0x45')]=[{'all':!![]}];}return db['Pause'][_0xbe29('0x46')](_0x1bec11);})[_0xbe29('0x26')](function(_0x294f38){_0x3052c7[_0xbe29('0x47')]=_0x294f38;return _0x3052c7;})['then'](respondWithFilteredResult(_0x54f462,_0x1bec11))['catch'](handleError(_0x54f462,null));};exports[_0xbe29('0x48')]=function(_0x40c852,_0x3e6444){var _0x401d4b={'raw':!![],'where':{'id':_0x40c852['params']['id']}},_0x782a07={};_0x782a07[_0xbe29('0x35')]=_[_0xbe29('0x37')](db['Pause'][_0xbe29('0x31')]);_0x782a07[_0xbe29('0x36')]=_['keys'](_0x40c852[_0xbe29('0x36')]);_0x782a07[_0xbe29('0x38')]=_[_0xbe29('0x39')](_0x782a07[_0xbe29('0x35')],_0x782a07[_0xbe29('0x36')]);_0x401d4b[_0xbe29('0x3a')]=_['intersection'](_0x782a07[_0xbe29('0x35')],qs[_0xbe29('0x3b')](_0x40c852[_0xbe29('0x36')][_0xbe29('0x3b')]));_0x401d4b[_0xbe29('0x3a')]=_0x401d4b['attributes']['length']?_0x401d4b['attributes']:_0x782a07['model'];if(_0x40c852['query']['includeAll']){_0x401d4b[_0xbe29('0x45')]=[{'all':!![]}];}_0x401d4b=_[_0xbe29('0x42')]({},_0x401d4b,_0x40c852[_0xbe29('0x49')]);return db[_0xbe29('0x30')]['find'](_0x401d4b)[_0xbe29('0x26')](handleEntityNotFound(_0x3e6444,null))[_0xbe29('0x26')](respondWithResult(_0x3e6444,null))[_0xbe29('0x4a')](handleError(_0x3e6444,null));};exports[_0xbe29('0x4b')]=function(_0x527f1b,_0x130cb8){return db[_0xbe29('0x30')][_0xbe29('0x4b')](_0x527f1b[_0xbe29('0x4c')],{})[_0xbe29('0x26')](function(_0x6ca7a8){var _0x1a91d1=_0x527f1b['user'][_0xbe29('0x28')]({'plain':!![]});if(!_0x1a91d1)throw new Error(_0xbe29('0x4d'));if(_0x1a91d1[_0xbe29('0x4e')]===_0xbe29('0x4f')){var _0x123c8d=_0x6ca7a8[_0xbe29('0x28')]({'plain':!![]});var _0x46fa0e=_0xbe29('0x29');return db[_0xbe29('0x50')][_0xbe29('0x51')]({'where':{'name':_0x46fa0e,'userProfileId':_0x1a91d1[_0xbe29('0x52')]},'raw':!![]})[_0xbe29('0x26')](function(_0x467f99){if(_0x467f99&&_0x467f99[_0xbe29('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x123c8d[_0xbe29('0x2c')],'resourceId':_0x123c8d['id'],'type':_0x467f99[_0xbe29('0x2c')],'sectionId':_0x467f99['id']},{})[_0xbe29('0x26')](function(){return _0x6ca7a8;});}else{return _0x6ca7a8;}})[_0xbe29('0x4a')](function(_0x38f7c0){logger[_0xbe29('0x54')](_0xbe29('0x55'),_0x38f7c0);throw _0x38f7c0;});}return _0x6ca7a8;})[_0xbe29('0x26')](respondWithResult(_0x130cb8,0xc9))['catch'](handleError(_0x130cb8,null));};exports['update']=function(_0x2f7071,_0x593f95){if(_0x2f7071['body']['id']){delete _0x2f7071['body']['id'];}return db['Pause'][_0xbe29('0x51')]({'where':{'id':_0x2f7071[_0xbe29('0x56')]['id']}})[_0xbe29('0x26')](handleEntityNotFound(_0x593f95,null))[_0xbe29('0x26')](saveUpdates(_0x2f7071[_0xbe29('0x4c')],null))[_0xbe29('0x26')](respondWithResult(_0x593f95,null))[_0xbe29('0x4a')](handleError(_0x593f95,null));};exports['destroy']=function(_0x551292,_0x42a0f2){return db[_0xbe29('0x30')][_0xbe29('0x51')]({'where':{'id':_0x551292[_0xbe29('0x56')]['id']}})['then'](handleEntityNotFound(_0x42a0f2,null))['then'](removeEntity(_0x42a0f2,null))[_0xbe29('0x4a')](handleError(_0x42a0f2,null));}; \ No newline at end of file +var _0xe74e=['to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','set','Content-Range','apply','save','update','then','Pauses','UserProfileResource','sendStatus','error','stack','name','send','index','map','Pause','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','options','count','findAll','catch','show','params','includeAll','include','find','body','get','user','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x4629ed,_0x59ef85){var _0x52ca04=function(_0x59dc63){while(--_0x59dc63){_0x4629ed['push'](_0x4629ed['shift']());}};_0x52ca04(++_0x59ef85);}(_0xe74e,0xe2));var _0xee74=function(_0x518be2,_0x112c41){_0x518be2=_0x518be2-0x0;var _0x3af8fa=_0xe74e[_0x518be2];return _0x3af8fa;};'use strict';var pdf=require(_0xee74('0x0'));var emlformat=require(_0xee74('0x1'));var rimraf=require(_0xee74('0x2'));var zipdir=require(_0xee74('0x3'));var jsonpatch=require(_0xee74('0x4'));var rp=require(_0xee74('0x5'));var moment=require(_0xee74('0x6'));var BPromise=require(_0xee74('0x7'));var Mustache=require(_0xee74('0x8'));var util=require('util');var path=require(_0xee74('0x9'));var sox=require(_0xee74('0xa'));var csv=require(_0xee74('0xb'));var ejs=require(_0xee74('0xc'));var fs=require('fs');var _=require(_0xee74('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xee74('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xee74('0xf'));var Papa=require(_0xee74('0x10'));var Redis=require(_0xee74('0x11'));var authService=require(_0xee74('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xee74('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee74('0x14'))(_0xee74('0x15'));var utils=require(_0xee74('0x16'));var config=require(_0xee74('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3168f3,_0x1c7c45){_0x1c7c45=_0x1c7c45||0xcc;return function(_0x2aae8c){if(_0x2aae8c){return _0x3168f3['sendStatus'](_0x1c7c45);}return _0x3168f3[_0xee74('0x18')](_0x1c7c45)[_0xee74('0x19')]();};}function respondWithResult(_0x19a73b,_0x283518){_0x283518=_0x283518||0xc8;return function(_0x136f80){if(_0x136f80){return _0x19a73b[_0xee74('0x18')](_0x283518)[_0xee74('0x1a')](_0x136f80);}};}function respondWithFilteredResult(_0x325e07,_0xc3db7c){return function(_0xb42736){if(_0xb42736){var _0x1d6fb0=_0xb42736['count'],_0x70896a=_0xc3db7c['offset'],_0x225b74=_0xc3db7c[_0xee74('0x1b')]+_0xc3db7c['limit'],_0xeb8c26;if(_0x225b74>=_0x1d6fb0){_0x225b74=_0x1d6fb0;_0xeb8c26=0xc8;}else{_0xeb8c26=0xce;}_0x325e07[_0xee74('0x18')](_0xeb8c26);return _0x325e07[_0xee74('0x1c')](_0xee74('0x1d'),_0x70896a+'-'+_0x225b74+'/'+_0x1d6fb0)[_0xee74('0x1a')](_0xb42736);}return null;};}function patchUpdates(_0x2469f3){return function(_0x12a1b2){try{jsonpatch[_0xee74('0x1e')](_0x12a1b2,_0x2469f3,!![]);}catch(_0x2b9677){return BPromise['reject'](_0x2b9677);}return _0x12a1b2[_0xee74('0x1f')]();};}function saveUpdates(_0x4e7df6,_0x54609f){return function(_0x20c526){if(_0x20c526){return _0x20c526[_0xee74('0x20')](_0x4e7df6)[_0xee74('0x21')](function(_0x41f268){return _0x41f268;});}return null;};}function removeEntity(_0x79d23a,_0x3293cb){return function(_0x46e975){if(_0x46e975){return _0x46e975['destroy']()[_0xee74('0x21')](function(){var _0x506db9=_0x46e975['get']({'plain':!![]});var _0x299a46=_0xee74('0x22');return db[_0xee74('0x23')]['destroy']({'where':{'type':_0x299a46,'resourceId':_0x506db9['id']}})['then'](function(){return _0x46e975;});})['then'](function(){_0x79d23a[_0xee74('0x18')](0xcc)[_0xee74('0x19')]();});}};}function handleEntityNotFound(_0x141824,_0x29965d){return function(_0x48a59b){if(!_0x48a59b){_0x141824[_0xee74('0x24')](0x194);}return _0x48a59b;};}function handleError(_0xa2f193,_0x4ee0bd){_0x4ee0bd=_0x4ee0bd||0x1f4;return function(_0x2dbcbd){logger[_0xee74('0x25')](_0x2dbcbd[_0xee74('0x26')]);if(_0x2dbcbd[_0xee74('0x27')]){delete _0x2dbcbd['name'];}_0xa2f193[_0xee74('0x18')](_0x4ee0bd)[_0xee74('0x28')](_0x2dbcbd);};}exports[_0xee74('0x29')]=function(_0x1796cc,_0x46cbb6){var _0x4109ee={},_0x9ad485={},_0x147090={'count':0x0,'rows':[]};var _0x32d97e=_[_0xee74('0x2a')](db[_0xee74('0x2b')][_0xee74('0x2c')],function(_0x3d85eb){return{'name':_0x3d85eb['fieldName'],'type':_0x3d85eb['type']['key']};});_0x9ad485[_0xee74('0x2d')]=_[_0xee74('0x2a')](_0x32d97e,_0xee74('0x27'));_0x9ad485[_0xee74('0x2e')]=_[_0xee74('0x2f')](_0x1796cc['query']);_0x9ad485[_0xee74('0x30')]=_[_0xee74('0x31')](_0x9ad485[_0xee74('0x2d')],_0x9ad485[_0xee74('0x2e')]);_0x4109ee[_0xee74('0x32')]=_[_0xee74('0x31')](_0x9ad485[_0xee74('0x2d')],qs[_0xee74('0x33')](_0x1796cc['query'][_0xee74('0x33')]));_0x4109ee['attributes']=_0x4109ee[_0xee74('0x32')][_0xee74('0x34')]?_0x4109ee['attributes']:_0x9ad485['model'];if(!_0x1796cc[_0xee74('0x2e')][_0xee74('0x35')](_0xee74('0x36'))){_0x4109ee[_0xee74('0x37')]=qs['limit'](_0x1796cc['query'][_0xee74('0x37')]);_0x4109ee[_0xee74('0x1b')]=qs[_0xee74('0x1b')](_0x1796cc[_0xee74('0x2e')][_0xee74('0x1b')]);}_0x4109ee[_0xee74('0x38')]=qs['sort'](_0x1796cc[_0xee74('0x2e')][_0xee74('0x39')]);_0x4109ee[_0xee74('0x3a')]=qs[_0xee74('0x30')](_['pick'](_0x1796cc[_0xee74('0x2e')],_0x9ad485['filters']));if(_0x1796cc[_0xee74('0x2e')][_0xee74('0x3b')]){_0x4109ee[_0xee74('0x3a')]=_[_0xee74('0x3c')](_0x4109ee[_0xee74('0x3a')],{'$or':_[_0xee74('0x2a')](_0x32d97e,function(_0x3372ec){if(_0x3372ec[_0xee74('0x3d')]!=='VIRTUAL'){var _0x29a2cb={};_0x29a2cb[_0x3372ec[_0xee74('0x27')]]={'$like':'%'+_0x1796cc['query'][_0xee74('0x3b')]+'%'};return _0x29a2cb;}})});}_0x4109ee=_[_0xee74('0x3c')]({},_0x4109ee,_0x1796cc[_0xee74('0x3e')]);var _0x4e23a6={'where':_0x4109ee[_0xee74('0x3a')]};return db[_0xee74('0x2b')][_0xee74('0x3f')](_0x4e23a6)[_0xee74('0x21')](function(_0x1b07f5){_0x147090[_0xee74('0x3f')]=_0x1b07f5;if(_0x1796cc[_0xee74('0x2e')]['includeAll']){_0x4109ee['include']=[{'all':!![]}];}return db[_0xee74('0x2b')][_0xee74('0x40')](_0x4109ee);})[_0xee74('0x21')](function(_0x2151e5){_0x147090['rows']=_0x2151e5;return _0x147090;})[_0xee74('0x21')](respondWithFilteredResult(_0x46cbb6,_0x4109ee))[_0xee74('0x41')](handleError(_0x46cbb6,null));};exports[_0xee74('0x42')]=function(_0x503787,_0x748119){var _0x8086ab={'raw':!![],'where':{'id':_0x503787[_0xee74('0x43')]['id']}},_0x1c074={};_0x1c074[_0xee74('0x2d')]=_[_0xee74('0x2f')](db['Pause'][_0xee74('0x2c')]);_0x1c074[_0xee74('0x2e')]=_[_0xee74('0x2f')](_0x503787[_0xee74('0x2e')]);_0x1c074[_0xee74('0x30')]=_['intersection'](_0x1c074[_0xee74('0x2d')],_0x1c074['query']);_0x8086ab['attributes']=_[_0xee74('0x31')](_0x1c074['model'],qs[_0xee74('0x33')](_0x503787[_0xee74('0x2e')][_0xee74('0x33')]));_0x8086ab[_0xee74('0x32')]=_0x8086ab['attributes'][_0xee74('0x34')]?_0x8086ab[_0xee74('0x32')]:_0x1c074[_0xee74('0x2d')];if(_0x503787['query'][_0xee74('0x44')]){_0x8086ab[_0xee74('0x45')]=[{'all':!![]}];}_0x8086ab=_['merge']({},_0x8086ab,_0x503787[_0xee74('0x3e')]);return db[_0xee74('0x2b')][_0xee74('0x46')](_0x8086ab)[_0xee74('0x21')](handleEntityNotFound(_0x748119,null))[_0xee74('0x21')](respondWithResult(_0x748119,null))[_0xee74('0x41')](handleError(_0x748119,null));};exports['create']=function(_0x26b7ee,_0x523b46){return db[_0xee74('0x2b')]['create'](_0x26b7ee[_0xee74('0x47')],{})[_0xee74('0x21')](function(_0x37d8a0){var _0x425a16=_0x26b7ee['user'][_0xee74('0x48')]({'plain':!![]});if(!_0x425a16)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x425a16['role']===_0xee74('0x49')){var _0xf1b1a6=_0x37d8a0[_0xee74('0x48')]({'plain':!![]});var _0x2ae878='Pauses';return db['UserProfileSection']['find']({'where':{'name':_0x2ae878,'userProfileId':_0x425a16[_0xee74('0x4a')]},'raw':!![]})['then'](function(_0x3c2e5e){if(_0x3c2e5e&&_0x3c2e5e[_0xee74('0x4b')]===0x0){return db[_0xee74('0x23')][_0xee74('0x4c')]({'name':_0xf1b1a6['name'],'resourceId':_0xf1b1a6['id'],'type':_0x3c2e5e[_0xee74('0x27')],'sectionId':_0x3c2e5e['id']},{})[_0xee74('0x21')](function(){return _0x37d8a0;});}else{return _0x37d8a0;}})[_0xee74('0x41')](function(_0x5eb0fc){logger[_0xee74('0x25')](_0xee74('0x4d'),_0x5eb0fc);throw _0x5eb0fc;});}return _0x37d8a0;})[_0xee74('0x21')](respondWithResult(_0x523b46,0xc9))[_0xee74('0x41')](handleError(_0x523b46,null));};exports[_0xee74('0x20')]=function(_0x34f310,_0x5ae7e0){if(_0x34f310[_0xee74('0x47')]['id']){delete _0x34f310[_0xee74('0x47')]['id'];}return db[_0xee74('0x2b')]['find']({'where':{'id':_0x34f310['params']['id']}})['then'](handleEntityNotFound(_0x5ae7e0,null))[_0xee74('0x21')](saveUpdates(_0x34f310[_0xee74('0x47')],null))[_0xee74('0x21')](respondWithResult(_0x5ae7e0,null))['catch'](handleError(_0x5ae7e0,null));};exports[_0xee74('0x4e')]=function(_0x1dd4cc,_0x45fb21){return db[_0xee74('0x2b')][_0xee74('0x46')]({'where':{'id':_0x1dd4cc[_0xee74('0x43')]['id']}})['then'](handleEntityNotFound(_0x45fb21,null))[_0xee74('0x21')](removeEntity(_0x45fb21,null))[_0xee74('0x41')](handleError(_0x45fb21,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 51f6d9a..3fbbbb4 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 _0xf4ce=['Pause','tools_pauses','lodash','api','moment','bluebird','request-promise','define'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xf4ce,0xf2));var _0xef4c=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xf4ce[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xef4c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xef4c('0x1'));var moment=require(_0xef4c('0x2'));var BPromise=require(_0xef4c('0x3'));var rp=require(_0xef4c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./pause.attributes');module['exports']=function(_0x2488f4,_0x3e7b2a){return _0x2488f4[_0xef4c('0x5')](_0xef4c('0x6'),attributes,{'tableName':_0xef4c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffc0=['request-promise','path','rimraf','../../config/environment','exports','tools_pauses','util','api','moment','bluebird'];(function(_0x1ce3fa,_0x2a15c2){var _0x27a3b5=function(_0xa3f501){while(--_0xa3f501){_0x1ce3fa['push'](_0x1ce3fa['shift']());}};_0x27a3b5(++_0x2a15c2);}(_0xffc0,0x1a0));var _0x0ffc=function(_0x49c640,_0x4d25df){_0x49c640=_0x49c640-0x0;var _0xf5acd=_0xffc0[_0x49c640];return _0xf5acd;};'use strict';var _=require('lodash');var util=require(_0x0ffc('0x0'));var logger=require('../../config/logger')(_0x0ffc('0x1'));var moment=require(_0x0ffc('0x2'));var BPromise=require(_0x0ffc('0x3'));var rp=require(_0x0ffc('0x4'));var fs=require('fs');var path=require(_0x0ffc('0x5'));var rimraf=require(_0x0ffc('0x6'));var config=require(_0x0ffc('0x7'));var attributes=require('./pause.attributes');module[_0x0ffc('0x8')]=function(_0x23d3e0,_0x426ce2){return _0x23d3e0['define']('Pause',attributes,{'tableName':_0x0ffc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 31978ba..c2a2a70 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 _0xe07c=['client','http','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowPause','Pause','find','options','where','attributes','include','map','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x7f27a0,_0x15d0e0){var _0x6f8f3b=function(_0x545489){while(--_0x545489){_0x7f27a0['push'](_0x7f27a0['shift']());}};_0x6f8f3b(++_0x15d0e0);}(_0xe07c,0x1f3));var _0xce07=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xe07c[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xce07('0x0'));var util=require(_0xce07('0x1'));var moment=require(_0xce07('0x2'));var BPromise=require(_0xce07('0x3'));var rs=require(_0xce07('0x4'));var fs=require('fs');var Redis=require(_0xce07('0x5'));var db=require(_0xce07('0x6'))['db'];var utils=require(_0xce07('0x7'));var logger=require('../../config/logger')(_0xce07('0x8'));var config=require(_0xce07('0x9'));var jayson=require(_0xce07('0xa'));var client=jayson[_0xce07('0xb')][_0xce07('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xbe28a9,_0x2bb379,_0x2ecdaf){return new BPromise(function(_0x13e4b1,_0x79525f){return client[_0xce07('0xd')](_0xbe28a9,_0x2ecdaf)[_0xce07('0xe')](function(_0xd58657){logger[_0xce07('0xf')](_0xce07('0x10'),_0x2bb379,_0xce07('0x11'));logger['debug'](_0xce07('0x12'),_0x2bb379,_0xce07('0x11'),JSON[_0xce07('0x13')](_0xd58657));if(_0xd58657['error']){if(_0xd58657[_0xce07('0x14')][_0xce07('0x15')]===0x1f4){logger[_0xce07('0x14')](_0xce07('0x10'),_0x2bb379,_0xd58657[_0xce07('0x14')]['message']);return _0x79525f(_0xd58657[_0xce07('0x14')][_0xce07('0x16')]);}logger[_0xce07('0x14')](_0xce07('0x10'),_0x2bb379,_0xd58657['error']['message']);return _0x13e4b1(_0xd58657[_0xce07('0x14')][_0xce07('0x16')]);}else{logger['info'](_0xce07('0x10'),_0x2bb379,_0xce07('0x11'));_0x13e4b1(_0xd58657['result']['message']);}})[_0xce07('0x17')](function(_0x17c888){logger[_0xce07('0x14')]('Pause,\x20%s,\x20%s',_0x2bb379,_0x17c888);_0x79525f(_0x17c888);});});}exports[_0xce07('0x18')]=function(_0x2f1756){var _0x5465dc=this;return new Promise(function(_0x4a22c1,_0x1e3f71){return db[_0xce07('0x19')][_0xce07('0x1a')]({'raw':_0x2f1756[_0xce07('0x1b')]?_0x2f1756['options']['raw']===undefined?!![]:![]:!![],'where':_0x2f1756[_0xce07('0x1b')]?_0x2f1756[_0xce07('0x1b')][_0xce07('0x1c')]||null:null,'attributes':_0x2f1756['options']?_0x2f1756[_0xce07('0x1b')][_0xce07('0x1d')]||null:null,'include':_0x2f1756[_0xce07('0x1b')]?_0x2f1756[_0xce07('0x1b')][_0xce07('0x1e')]?_[_0xce07('0x1f')](_0x2f1756[_0xce07('0x1b')]['include'],function(_0x4200ca){return{'model':db[_0x4200ca[_0xce07('0x20')]],'as':_0x4200ca['as'],'attributes':_0x4200ca[_0xce07('0x1d')],'include':_0x4200ca[_0xce07('0x1e')]?_[_0xce07('0x1f')](_0x4200ca[_0xce07('0x1e')],function(_0x33593c){return{'model':db[_0x33593c[_0xce07('0x20')]],'as':_0x33593c['as'],'attributes':_0x33593c[_0xce07('0x1d')],'include':_0x33593c['include']?_['map'](_0x33593c[_0xce07('0x1e')],function(_0x49d8a9){return{'model':db[_0x49d8a9[_0xce07('0x20')]],'as':_0x49d8a9['as'],'attributes':_0x49d8a9[_0xce07('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16d7c5){logger['info'](_0xce07('0x18'),_0x2f1756);logger[_0xce07('0x21')](_0xce07('0x18'),_0x2f1756,JSON[_0xce07('0x13')](_0x16d7c5));_0x4a22c1(_0x16d7c5);})[_0xce07('0x17')](function(_0x2f83b1){logger[_0xce07('0x14')]('ShowPause',_0x2f83b1[_0xce07('0x16')],_0x2f1756);_0x1e3f71(_0x5465dc['error'](0x1f4,_0x2f83b1['message']));});});}; \ No newline at end of file +var _0xacaf=['where','options','include','map','model','attributes','stringify','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','ShowPause','Pause','find','raw'];(function(_0x3f0fe3,_0xf9ebc7){var _0x23d912=function(_0x1bea35){while(--_0x1bea35){_0x3f0fe3['push'](_0x3f0fe3['shift']());}};_0x23d912(++_0xf9ebc7);}(_0xacaf,0x152));var _0xfaca=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xacaf[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0xfaca('0x0'));var util=require('util');var moment=require(_0xfaca('0x1'));var BPromise=require(_0xfaca('0x2'));var rs=require(_0xfaca('0x3'));var fs=require('fs');var Redis=require(_0xfaca('0x4'));var db=require(_0xfaca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfaca('0x6'))(_0xfaca('0x7'));var config=require(_0xfaca('0x8'));var jayson=require(_0xfaca('0x9'));var client=jayson[_0xfaca('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x556051,_0x198252,_0x3e73fa){return new BPromise(function(_0x4b2754,_0x16546c){return client[_0xfaca('0xb')](_0x556051,_0x3e73fa)[_0xfaca('0xc')](function(_0x20484b){logger[_0xfaca('0xd')](_0xfaca('0xe'),_0x198252,_0xfaca('0xf'));logger[_0xfaca('0x10')]('Pause,\x20%s,\x20%s,\x20%s',_0x198252,_0xfaca('0xf'),JSON['stringify'](_0x20484b));if(_0x20484b[_0xfaca('0x11')]){if(_0x20484b['error'][_0xfaca('0x12')]===0x1f4){logger['error'](_0xfaca('0xe'),_0x198252,_0x20484b[_0xfaca('0x11')]['message']);return _0x16546c(_0x20484b['error'][_0xfaca('0x13')]);}logger['error'](_0xfaca('0xe'),_0x198252,_0x20484b[_0xfaca('0x11')][_0xfaca('0x13')]);return _0x4b2754(_0x20484b[_0xfaca('0x11')][_0xfaca('0x13')]);}else{logger[_0xfaca('0xd')](_0xfaca('0xe'),_0x198252,_0xfaca('0xf'));_0x4b2754(_0x20484b[_0xfaca('0x14')][_0xfaca('0x13')]);}})['catch'](function(_0x3c8944){logger[_0xfaca('0x11')](_0xfaca('0xe'),_0x198252,_0x3c8944);_0x16546c(_0x3c8944);});});}exports[_0xfaca('0x15')]=function(_0x4ba798){var _0x575f9f=this;return new Promise(function(_0x20a7b0,_0x3e6891){return db[_0xfaca('0x16')][_0xfaca('0x17')]({'raw':_0x4ba798['options']?_0x4ba798['options'][_0xfaca('0x18')]===undefined?!![]:![]:!![],'where':_0x4ba798['options']?_0x4ba798['options'][_0xfaca('0x19')]||null:null,'attributes':_0x4ba798[_0xfaca('0x1a')]?_0x4ba798[_0xfaca('0x1a')]['attributes']||null:null,'include':_0x4ba798[_0xfaca('0x1a')]?_0x4ba798[_0xfaca('0x1a')][_0xfaca('0x1b')]?_[_0xfaca('0x1c')](_0x4ba798['options'][_0xfaca('0x1b')],function(_0x394f92){return{'model':db[_0x394f92[_0xfaca('0x1d')]],'as':_0x394f92['as'],'attributes':_0x394f92[_0xfaca('0x1e')],'include':_0x394f92['include']?_['map'](_0x394f92[_0xfaca('0x1b')],function(_0x867799){return{'model':db[_0x867799[_0xfaca('0x1d')]],'as':_0x867799['as'],'attributes':_0x867799['attributes'],'include':_0x867799['include']?_[_0xfaca('0x1c')](_0x867799[_0xfaca('0x1b')],function(_0x4c3872){return{'model':db[_0x4c3872['model']],'as':_0x4c3872['as'],'attributes':_0x4c3872[_0xfaca('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfaca('0xc')](function(_0x4ad79a){logger['info'](_0xfaca('0x15'),_0x4ba798);logger['debug'](_0xfaca('0x15'),_0x4ba798,JSON[_0xfaca('0x1f')](_0x4ad79a));_0x20a7b0(_0x4ad79a);})[_0xfaca('0x20')](function(_0x56d4ca){logger[_0xfaca('0x11')](_0xfaca('0x15'),_0x56d4ca[_0xfaca('0x13')],_0x4ba798);_0x3e6891(_0x575f9f[_0xfaca('0x11')](0x1f4,_0x56d4ca[_0xfaca('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 9980b1e..5e2b41c 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 _0x1e6d=['update','delete','multer','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','/webhook','webhookGet','/:id','/:id/download','diskStorage','join','server/files/plugins','originalname','replace','format','basename','extname','single','file','upload','webhookPost','put'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x1e6d,0x1b2));var _0xd1e6=function(_0x3c2a87,_0x301e33){_0x3c2a87=_0x3c2a87-0x0;var _0x3a4efd=_0x1e6d[_0x3c2a87];return _0x3a4efd;};'use strict';var multer=require(_0xd1e6('0x0'));var util=require('util');var path=require(_0xd1e6('0x1'));var timeout=require(_0xd1e6('0x2'));var express=require(_0xd1e6('0x3'));var router=express[_0xd1e6('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd1e6('0x5'));var controller=require('./plugin.controller');router[_0xd1e6('0x6')]('/',auth[_0xd1e6('0x7')](),controller['index']);router[_0xd1e6('0x6')](_0xd1e6('0x8'),controller[_0xd1e6('0x9')]);router[_0xd1e6('0x6')](_0xd1e6('0xa'),auth[_0xd1e6('0x7')](),controller['show']);router[_0xd1e6('0x6')](_0xd1e6('0xb'),auth[_0xd1e6('0x7')](),controller['download']);var upload=multer({'storage':multer[_0xd1e6('0xc')]({'destination':function(_0x416826,_0x4855ac,_0x25ff29){_0x25ff29(null,path[_0xd1e6('0xd')](config['root'],_0xd1e6('0xe')));},'filename':function(_0x183045,_0x4293d5,_0x1279be){_0x4293d5['originalname']=_0x4293d5[_0xd1e6('0xf')][_0xd1e6('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1279be(null,util[_0xd1e6('0x11')]('%s-%s%s',path[_0xd1e6('0x12')](_0x4293d5[_0xd1e6('0xf')],path[_0xd1e6('0x13')](_0x4293d5[_0xd1e6('0xf')])),Date['now'](),path[_0xd1e6('0x13')](_0x4293d5[_0xd1e6('0xf')])));}})});router['post']('/',upload[_0xd1e6('0x14')](_0xd1e6('0x15')),controller[_0xd1e6('0x16')]);router['post'](_0xd1e6('0x8'),controller[_0xd1e6('0x17')]);router[_0xd1e6('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xd1e6('0x19')]);router[_0xd1e6('0x1a')]('/:id',auth[_0xd1e6('0x7')](),controller[_0xd1e6('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x50a8=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','root','server/files/plugins','originalname','%s-%s%s','basename','extname','now','single','upload','webhookPost','put','delete','exports'];(function(_0x4b287b,_0x3d4caa){var _0x3b9ab9=function(_0x8099ba){while(--_0x8099ba){_0x4b287b['push'](_0x4b287b['shift']());}};_0x3b9ab9(++_0x3d4caa);}(_0x50a8,0x117));var _0x850a=function(_0x370732,_0x304cac){_0x370732=_0x370732-0x0;var _0x3226d8=_0x50a8[_0x370732];return _0x3226d8;};'use strict';var multer=require(_0x850a('0x0'));var util=require(_0x850a('0x1'));var path=require(_0x850a('0x2'));var timeout=require(_0x850a('0x3'));var express=require('express');var router=express[_0x850a('0x4')]();var auth=require(_0x850a('0x5'));var interaction=require(_0x850a('0x6'));var config=require(_0x850a('0x7'));var controller=require(_0x850a('0x8'));router[_0x850a('0x9')]('/',auth[_0x850a('0xa')](),controller[_0x850a('0xb')]);router[_0x850a('0x9')](_0x850a('0xc'),controller[_0x850a('0xd')]);router['get'](_0x850a('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x850a('0x9')](_0x850a('0xf'),auth['isAuthenticated'](),controller[_0x850a('0x10')]);var upload=multer({'storage':multer[_0x850a('0x11')]({'destination':function(_0x2aef14,_0x29475a,_0x1685cf){_0x1685cf(null,path['join'](config[_0x850a('0x12')],_0x850a('0x13')));},'filename':function(_0x41a043,_0x1f3530,_0x15a68a){_0x1f3530[_0x850a('0x14')]=_0x1f3530['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x15a68a(null,util['format'](_0x850a('0x15'),path[_0x850a('0x16')](_0x1f3530[_0x850a('0x14')],path[_0x850a('0x17')](_0x1f3530[_0x850a('0x14')])),Date[_0x850a('0x18')](),path[_0x850a('0x17')](_0x1f3530['originalname'])));}})});router['post']('/',upload[_0x850a('0x19')]('file'),controller[_0x850a('0x1a')]);router['post'](_0x850a('0xc'),controller[_0x850a('0x1b')]);router[_0x850a('0x1c')]('/:id',auth[_0x850a('0xa')](),controller['update']);router[_0x850a('0x1d')]('/:id',auth['isAuthenticated'](),controller['delete']);module[_0x850a('0x1e')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index ebfc86d..0e25b26 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 _0x8b62=['adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','html','script','TEXT','STRING','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8b62,0x12b));var _0x28b6=function(_0x368587,_0x1b6554){_0x368587=_0x368587-0x0;var _0x42d33c=_0x8b62[_0x368587];return _0x42d33c;};'use strict';var Sequelize=require(_0x28b6('0x0'));module[_0x28b6('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x28b6('0x2')](_0x28b6('0x3'),_0x28b6('0x4'))},'description':{'type':Sequelize[_0x28b6('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x28b6('0x6')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x28b6('0x7')],'defaultValue':0x0,'comment':_0x28b6('0x8')},'sidebar':{'type':Sequelize[_0x28b6('0x2')](_0x28b6('0x9'),_0x28b6('0xa'),_0x28b6('0xb'),_0x28b6('0xc')),'defaultValue':_0x28b6('0xb'),'comment':_0x28b6('0xd')},'icon':{'type':Sequelize[_0x28b6('0x6')]},'adminUrl':{'type':Sequelize[_0x28b6('0x6')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x28b6('0x6')]},'scriptPath':{'type':Sequelize[_0x28b6('0x6')]}}; \ No newline at end of file +var _0x81c3=['TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html','script'];(function(_0x158b5e,_0x35ca3a){var _0x31ccf6=function(_0x3c763d){while(--_0x3c763d){_0x158b5e['push'](_0x158b5e['shift']());}};_0x31ccf6(++_0x35ca3a);}(_0x81c3,0x181));var _0x381c=function(_0x12c30e,_0x508a01){_0x12c30e=_0x12c30e-0x0;var _0x1b7326=_0x81c3[_0x12c30e];return _0x1b7326;};'use strict';var Sequelize=require(_0x381c('0x0'));module[_0x381c('0x1')]={'name':{'type':Sequelize[_0x381c('0x2')]},'type':{'type':Sequelize['ENUM'](_0x381c('0x3'),_0x381c('0x4'))},'description':{'type':Sequelize[_0x381c('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x381c('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x381c('0x6')],'defaultValue':0x0,'comment':_0x381c('0x7')},'sidebar':{'type':Sequelize[_0x381c('0x8')](_0x381c('0x9'),_0x381c('0xa'),'always','never'),'defaultValue':_0x381c('0xb'),'comment':_0x381c('0xc')},'icon':{'type':Sequelize[_0x381c('0x2')]},'adminUrl':{'type':Sequelize[_0x381c('0x2')]},'agentUrl':{'type':Sequelize[_0x381c('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x381c('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 30da6e6..ff17abb 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 _0xa3e5=['Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','Warning:\x20admin\x20view\x20not\x20specified','test','plugins','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','resolve','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','statusCode','webhookPost','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','rimraf','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','destroy','UserProfileResource','end','stack','send','index','map','Plugin','rawAttributes','fieldName','key','name','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','then','rows','show','params','length','find','download','join','format','%s.zip','basename','createWriteStream','zip','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','error','pipe','glob','root','dirname','node_modules/**/*','attachments/**/*','close','info','Temporary\x20file\x20removed','catch','file','filename','extname','server/files/plugins','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','readdirSync','some','manifest.json','parse','undefined','Invalid\x20manifest:\x20name\x20missing','type','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'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa3e5,0x178));var _0x5a3e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa3e5[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0x5a3e('0x0'));var emlformat=require(_0x5a3e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5a3e('0x2'));var jsonpatch=require(_0x5a3e('0x3'));var rp=require(_0x5a3e('0x4'));var moment=require(_0x5a3e('0x5'));var BPromise=require(_0x5a3e('0x6'));var Mustache=require(_0x5a3e('0x7'));var util=require(_0x5a3e('0x8'));var path=require(_0x5a3e('0x9'));var sox=require(_0x5a3e('0xa'));var csv=require('to-csv');var ejs=require(_0x5a3e('0xb'));var fs=require('fs');var _=require(_0x5a3e('0xc'));var squel=require(_0x5a3e('0xd'));var crypto=require(_0x5a3e('0xe'));var jsforce=require(_0x5a3e('0xf'));var deskjs=require(_0x5a3e('0x10'));var toCsv=require(_0x5a3e('0x11'));var querystring=require(_0x5a3e('0x12'));var Papa=require(_0x5a3e('0x13'));var extract=require('extract-zip');var rimraf=require(_0x5a3e('0x14'));var archiver=require('archiver');var Redis=require(_0x5a3e('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x5a3e('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a3e('0x17'));var logger=require('../../config/logger')(_0x5a3e('0x18'));var utils=require(_0x5a3e('0x19'));var config=require(_0x5a3e('0x1a'));var db=require(_0x5a3e('0x1b'))['db'];config['redis']=_[_0x5a3e('0x1c')](config[_0x5a3e('0x1d')],{'host':_0x5a3e('0x1e'),'port':0x18eb});var socket=require(_0x5a3e('0x1f'))(new Redis(config['redis']));require(_0x5a3e('0x20'))[_0x5a3e('0x21')](socket);function respondWithStatusCode(_0x9b5f1,_0x2cd09b){_0x2cd09b=_0x2cd09b||0xcc;return function(_0x24d140){if(_0x24d140){return _0x9b5f1[_0x5a3e('0x22')](_0x2cd09b);}return _0x9b5f1['status'](_0x2cd09b)['end']();};}function respondWithResult(_0x135d58,_0x2401c6){_0x2401c6=_0x2401c6||0xc8;return function(_0x524fbb){if(_0x524fbb){return _0x135d58[_0x5a3e('0x23')](_0x2401c6)[_0x5a3e('0x24')](_0x524fbb);}};}function respondWithFilteredResult(_0x5e694d,_0x4af722){return function(_0x2fb35a){if(_0x2fb35a){var _0x57e30f=_0x2fb35a[_0x5a3e('0x25')],_0x108bf5=_0x4af722['offset'],_0x1dc7ef=_0x4af722[_0x5a3e('0x26')]+_0x4af722[_0x5a3e('0x27')],_0x569c3e;if(_0x1dc7ef>=_0x57e30f){_0x1dc7ef=_0x57e30f;_0x569c3e=0xc8;}else{_0x569c3e=0xce;}_0x5e694d[_0x5a3e('0x23')](_0x569c3e);return _0x5e694d[_0x5a3e('0x28')]('Content-Range',_0x108bf5+'-'+_0x1dc7ef+'/'+_0x57e30f)['json'](_0x2fb35a);}return null;};}function patchUpdates(_0x50e36a){return function(_0x3df8bc){try{jsonpatch[_0x5a3e('0x29')](_0x3df8bc,_0x50e36a,!![]);}catch(_0x340d70){return BPromise[_0x5a3e('0x2a')](_0x340d70);}return _0x3df8bc[_0x5a3e('0x2b')]();};}function saveUpdates(_0x292b71,_0x1d6349){return function(_0x5d3bed){if(_0x5d3bed){return _0x5d3bed[_0x5a3e('0x2c')](_0x292b71)['then'](function(_0x250208){return _0x250208;});}return null;};}function removeEntity(_0x327704,_0x33d607){return function(_0x48e593){if(_0x48e593){return _0x48e593[_0x5a3e('0x2d')]()['then'](function(){var _0x55fd41=_0x48e593['get']({'plain':!![]});var _0x302da0='Plugins';return db[_0x5a3e('0x2e')]['destroy']({'where':{'type':_0x302da0,'resourceId':_0x55fd41['id']}})['then'](function(){return _0x48e593;});})['then'](function(){_0x327704['status'](0xcc)[_0x5a3e('0x2f')]();});}};}function handleEntityNotFound(_0x40dcf0,_0x55c891){return function(_0x1d584e){if(!_0x1d584e){_0x40dcf0['sendStatus'](0x194);}return _0x1d584e;};}function handleError(_0x3b3720,_0x1e75b0){_0x1e75b0=_0x1e75b0||0x1f4;return function(_0x429226){logger['error'](_0x429226[_0x5a3e('0x30')]);if(_0x429226['name']){delete _0x429226['name'];}_0x3b3720[_0x5a3e('0x23')](_0x1e75b0)[_0x5a3e('0x31')](_0x429226);};}exports[_0x5a3e('0x32')]=function(_0x1ac8d4,_0xf42802){var _0x180f3b={},_0x1b8d51={},_0x5c0206={'count':0x0,'rows':[]};var _0x12b1c6=_[_0x5a3e('0x33')](db[_0x5a3e('0x34')][_0x5a3e('0x35')],function(_0x3fe20a){return{'name':_0x3fe20a[_0x5a3e('0x36')],'type':_0x3fe20a['type'][_0x5a3e('0x37')]};});_0x1b8d51['model']=_[_0x5a3e('0x33')](_0x12b1c6,_0x5a3e('0x38'));_0x1b8d51[_0x5a3e('0x39')]=_[_0x5a3e('0x3a')](_0x1ac8d4[_0x5a3e('0x39')]);_0x1b8d51[_0x5a3e('0x3b')]=_[_0x5a3e('0x3c')](_0x1b8d51[_0x5a3e('0x3d')],_0x1b8d51[_0x5a3e('0x39')]);_0x180f3b[_0x5a3e('0x3e')]=_[_0x5a3e('0x3c')](_0x1b8d51[_0x5a3e('0x3d')],qs[_0x5a3e('0x3f')](_0x1ac8d4[_0x5a3e('0x39')]['fields']));_0x180f3b[_0x5a3e('0x3e')]=_0x180f3b[_0x5a3e('0x3e')]['length']?_0x180f3b[_0x5a3e('0x3e')]:_0x1b8d51[_0x5a3e('0x3d')];if(!_0x1ac8d4['query'][_0x5a3e('0x40')](_0x5a3e('0x41'))){_0x180f3b[_0x5a3e('0x27')]=qs['limit'](_0x1ac8d4[_0x5a3e('0x39')][_0x5a3e('0x27')]);_0x180f3b['offset']=qs[_0x5a3e('0x26')](_0x1ac8d4[_0x5a3e('0x39')]['offset']);}_0x180f3b[_0x5a3e('0x42')]=qs[_0x5a3e('0x43')](_0x1ac8d4[_0x5a3e('0x39')]['sort']);_0x180f3b[_0x5a3e('0x44')]=qs['filters'](_['pick'](_0x1ac8d4[_0x5a3e('0x39')],_0x1b8d51['filters']));if(_0x1ac8d4[_0x5a3e('0x39')]['filter']){_0x180f3b['where']=_[_0x5a3e('0x45')](_0x180f3b[_0x5a3e('0x44')],{'$or':_['map'](_0x12b1c6,function(_0xa63289){if(_0xa63289['type']!==_0x5a3e('0x46')){var _0x3541f5={};_0x3541f5[_0xa63289[_0x5a3e('0x38')]]={'$like':'%'+_0x1ac8d4[_0x5a3e('0x39')][_0x5a3e('0x47')]+'%'};return _0x3541f5;}})});}_0x180f3b=_[_0x5a3e('0x45')]({},_0x180f3b,_0x1ac8d4[_0x5a3e('0x48')]);var _0x3696db={'where':_0x180f3b[_0x5a3e('0x44')]};return db[_0x5a3e('0x34')][_0x5a3e('0x25')](_0x3696db)['then'](function(_0x1ef9ad){_0x5c0206[_0x5a3e('0x25')]=_0x1ef9ad;if(_0x1ac8d4[_0x5a3e('0x39')][_0x5a3e('0x49')]){_0x180f3b['include']=[{'all':!![]}];}return db['Plugin'][_0x5a3e('0x4a')](_0x180f3b);})[_0x5a3e('0x4b')](function(_0x4dbbe4){_0x5c0206[_0x5a3e('0x4c')]=_0x4dbbe4;return _0x5c0206;})['then'](respondWithFilteredResult(_0xf42802,_0x180f3b))['catch'](handleError(_0xf42802,null));};exports[_0x5a3e('0x4d')]=function(_0x2d7210,_0x527ca4){var _0x204eff={'raw':!![],'where':{'id':_0x2d7210[_0x5a3e('0x4e')]['id']}},_0x17c746={};_0x17c746[_0x5a3e('0x3d')]=_[_0x5a3e('0x3a')](db[_0x5a3e('0x34')][_0x5a3e('0x35')]);_0x17c746[_0x5a3e('0x39')]=_[_0x5a3e('0x3a')](_0x2d7210[_0x5a3e('0x39')]);_0x17c746['filters']=_[_0x5a3e('0x3c')](_0x17c746[_0x5a3e('0x3d')],_0x17c746[_0x5a3e('0x39')]);_0x204eff['attributes']=_['intersection'](_0x17c746[_0x5a3e('0x3d')],qs[_0x5a3e('0x3f')](_0x2d7210[_0x5a3e('0x39')][_0x5a3e('0x3f')]));_0x204eff[_0x5a3e('0x3e')]=_0x204eff['attributes'][_0x5a3e('0x4f')]?_0x204eff[_0x5a3e('0x3e')]:_0x17c746[_0x5a3e('0x3d')];if(_0x2d7210[_0x5a3e('0x39')]['includeAll']){_0x204eff['include']=[{'all':!![]}];}_0x204eff=_[_0x5a3e('0x45')]({},_0x204eff,_0x2d7210['options']);return db[_0x5a3e('0x34')][_0x5a3e('0x50')](_0x204eff)[_0x5a3e('0x4b')](handleEntityNotFound(_0x527ca4,null))[_0x5a3e('0x4b')](respondWithResult(_0x527ca4,null))['catch'](handleError(_0x527ca4,null));};exports[_0x5a3e('0x51')]=function(_0x42d7bf,_0x70b5ec,_0x1667a8){return db[_0x5a3e('0x34')]['find']({'where':{'id':_0x42d7bf['params']['id']},'attributes':[_0x5a3e('0x38'),_0x5a3e('0x9')],'raw':!![]})[_0x5a3e('0x4b')](handleEntityNotFound(_0x70b5ec,null))[_0x5a3e('0x4b')](function(_0x30b218){if(_0x30b218){var _0x108fab=path[_0x5a3e('0x52')](config['root'],'server/files/plugins',util[_0x5a3e('0x53')](_0x5a3e('0x54'),path[_0x5a3e('0x55')](_0x30b218[_0x5a3e('0x9')])));var _0x1e5bc1=fs[_0x5a3e('0x56')](_0x108fab);var _0xa0c981=archiver(_0x5a3e('0x57'),{'zlib':{'level':0x9}});_0xa0c981['on'](_0x5a3e('0x58'),function(_0x532e60){if(_0x532e60['code']===_0x5a3e('0x59')){logger['error'](_0x532e60);}else{throw new db[(_0x5a3e('0x5a'))][(_0x5a3e('0x5b'))](_0x5a3e('0x5c'));}});_0xa0c981['on'](_0x5a3e('0x5d'),function(_0x3b7880){throw new db[(_0x5a3e('0x5a'))][(_0x5a3e('0x5b'))](_0x5a3e('0x5c'));});_0xa0c981[_0x5a3e('0x5e')](_0x1e5bc1);_0xa0c981[_0x5a3e('0x5f')]('**/*',{'cwd':path['join'](config[_0x5a3e('0x60')],'server/files/plugins',path[_0x5a3e('0x61')](_0x30b218[_0x5a3e('0x9')])),'ignore':[path[_0x5a3e('0x52')](path[_0x5a3e('0x55')](_0x30b218[_0x5a3e('0x9')]),_0x5a3e('0x62')),path['join'](path[_0x5a3e('0x55')](_0x30b218[_0x5a3e('0x9')]),_0x5a3e('0x63'))],'nodir':!![]})['finalize']();_0x1e5bc1['on'](_0x5a3e('0x64'),function(){if(!fs['existsSync'](_0x108fab)){throw new db[(_0x5a3e('0x5a'))][(_0x5a3e('0x5b'))]('Plugin\x20not\x20found');}return _0x70b5ec[_0x5a3e('0x51')](_0x108fab,util[_0x5a3e('0x53')](_0x5a3e('0x54'),path[_0x5a3e('0x55')](_0x30b218[_0x5a3e('0x9')])),function(_0xce0190){if(_0xce0190){throw new db[(_0x5a3e('0x5a'))][(_0x5a3e('0x5b'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x108fab);logger[_0x5a3e('0x65')]('Download\x20completed');logger[_0x5a3e('0x65')](_0x5a3e('0x66'));});});}return null;})[_0x5a3e('0x67')](handleError(_0x70b5ec,null));};exports['upload']=function(_0x2c0c8a,_0x1e6b13,_0x4a3e2e){var _0x231d61=path[_0x5a3e('0x55')](_0x2c0c8a[_0x5a3e('0x68')][_0x5a3e('0x69')],path[_0x5a3e('0x6a')](_0x2c0c8a[_0x5a3e('0x68')]['filename']));var _0x3f5abc=path[_0x5a3e('0x52')](config[_0x5a3e('0x60')],'server/files/plugins',_0x2c0c8a['file']['filename']);var _0x514212=path[_0x5a3e('0x52')](config[_0x5a3e('0x60')],_0x5a3e('0x6b'),_0x231d61);logger[_0x5a3e('0x65')](_0x5a3e('0x6c'),_0x3f5abc);logger[_0x5a3e('0x65')](_0x5a3e('0x6d'),_0x514212);try{fs[_0x5a3e('0x6e')](_0x3f5abc,parseInt(_0x5a3e('0x6f'),0x8));extract(_0x3f5abc,{'dir':_0x514212},function(_0x5acc5e){if(_0x5acc5e){logger['error'](_0x5acc5e);handleError(_0x5acc5e,!![]);};var _0x445e5f=fs['readdirSync'](_0x514212);if(_0x445e5f[_0x5a3e('0x4f')]>0x1){removeReferences(_0x3f5abc,_0x514212);logger[_0x5a3e('0x5d')](_0x5a3e('0x70'));return _0x4a3e2e(new Error('Invalid\x20plugin\x20structure'));}var _0x171354=fs[_0x5a3e('0x71')](path[_0x5a3e('0x52')](_0x514212,_0x445e5f[0x0]));if(_0x171354[_0x5a3e('0x72')]()){removeReferences(_0x3f5abc,_0x514212);logger['error']('Invalid\x20plugin\x20structure');return _0x4a3e2e(new Error('Invalid\x20plugin\x20structure'));}if(_0x171354[_0x5a3e('0x73')]()){var _0x1e0b04=fs[_0x5a3e('0x74')](path[_0x5a3e('0x52')](_0x514212,_0x445e5f[0x0]));if(_0x1e0b04['length']===0x0){removeReferences(_0x3f5abc,_0x514212);logger[_0x5a3e('0x5d')]('Invalid\x20plugin\x20structure');return _0x4a3e2e(new Error(_0x5a3e('0x70')));}var _0x5a73ce=_0x1e0b04[_0x5a3e('0x75')](function(_0x41a377){return _0x41a377==='manifest.json';});if(!_0x5a73ce){return _0x4a3e2e(new Error('Plugin\x20manifest\x20missing'));}var _0x54d614=fs['readFileSync'](path[_0x5a3e('0x52')](_0x514212,_0x445e5f[0x0],_0x5a3e('0x76')));var _0x5da10d=JSON[_0x5a3e('0x77')](_0x54d614);if(_0x5a3e('0x78')==typeof _0x5da10d[_0x5a3e('0x38')]){return _0x4a3e2e(new Error(_0x5a3e('0x79')));}if(_0x5a3e('0x78')==typeof _0x5da10d[_0x5a3e('0x7a')]){return _0x4a3e2e(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x5a3e('0x78')==typeof _0x5da10d['version']){return _0x4a3e2e(new Error(_0x5a3e('0x7b')));}if(_0x5a3e('0x78')==typeof _0x5da10d[_0x5a3e('0x7c')]){return _0x4a3e2e(new Error(_0x5a3e('0x7d')));}if(_0x5da10d[_0x5a3e('0x7a')]===_0x5a3e('0x7e')){if('undefined'==typeof _0x5da10d[_0x5a3e('0x7c')][_0x5a3e('0x7f')]){return _0x4a3e2e(new Error(_0x5a3e('0x80')));}if(_0x5a3e('0x78')==typeof _0x5da10d[_0x5a3e('0x7c')][_0x5a3e('0x7f')][_0x5a3e('0x81')]&&_0x5a3e('0x78')==typeof _0x5da10d[_0x5a3e('0x7c')]['views'][_0x5a3e('0x82')]){return _0x4a3e2e(new Error(_0x5a3e('0x83')));}}else if(_0x5da10d['type']===_0x5a3e('0x84')){if(_0x5a3e('0x78')==typeof _0x5da10d[_0x5a3e('0x7c')][_0x5a3e('0x85')]){return _0x4a3e2e(new Error(_0x5a3e('0x86')));}if(_0x5a3e('0x78')==typeof _0x5da10d[_0x5a3e('0x7c')][_0x5a3e('0x87')]){return _0x4a3e2e(new Error(_0x5a3e('0x88')));}}else{return _0x4a3e2e(new Error(_0x5a3e('0x89')));}var _0x16dbdd=_0x5da10d[_0x5a3e('0x38')];var _0x3ace67=_0x5da10d[_0x5a3e('0x8a')];var _0x2d2c41=_0x5da10d[_0x5a3e('0x7a')];var _0x122bfb=_0x5da10d[_0x5a3e('0x8b')]?_0x5da10d[_0x5a3e('0x8b')]:_0x5a3e('0x8c');var _0x3130c0=_0x5da10d[_0x5a3e('0x8d')]?_0x5da10d[_0x5a3e('0x8d')]:_0x5a3e('0x8e');var _0x1dfc5e='';var _0x36e31d='';var _0x14ae57='';var _0x59adef='';var _0x430bfa=_0x5da10d['version'];if(_0x2d2c41==='html'){if(_0x5a3e('0x78')!=typeof _0x5da10d[_0x5a3e('0x7c')]['views'][_0x5a3e('0x81')]){var _0x20115d=_0x5da10d[_0x5a3e('0x7c')][_0x5a3e('0x7f')][_0x5a3e('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x20115d)){_0x1dfc5e=path['join']('plugins',_0x231d61,_0x445e5f[0x0],_0x20115d);}else{_0x1dfc5e=_0x20115d;}}else{logger[_0x5a3e('0x65')](_0x5a3e('0x8f'));}if(_0x5a3e('0x78')!=typeof _0x5da10d['parameters'][_0x5a3e('0x7f')][_0x5a3e('0x82')]){var _0x471315=_0x5da10d[_0x5a3e('0x7c')][_0x5a3e('0x7f')][_0x5a3e('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x5a3e('0x90')](_0x471315)){_0x36e31d=path['join'](_0x5a3e('0x91'),_0x231d61,_0x445e5f[0x0],_0x471315);}else{_0x36e31d=_0x471315;}}else{logger[_0x5a3e('0x65')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x2d2c41===_0x5a3e('0x84')){_0x14ae57=_0x5da10d[_0x5a3e('0x7c')]['scriptName'];_0x59adef=_0x5da10d['parameters'][_0x5a3e('0x87')];if(_0x5a3e('0x78')!=typeof _0x5da10d['parameters'][_0x5a3e('0x7f')]){if(_0x5a3e('0x78')!=typeof _0x5da10d[_0x5a3e('0x7c')]['views']['admin']){var _0x20115d=_0x5da10d[_0x5a3e('0x7c')][_0x5a3e('0x7f')][_0x5a3e('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x5a3e('0x90')](_0x20115d)){_0x1dfc5e=path[_0x5a3e('0x52')]('plugins',_0x231d61,_0x445e5f[0x0],_0x20115d);}else{_0x1dfc5e=_0x20115d;}}if(_0x5a3e('0x78')!=typeof _0x5da10d[_0x5a3e('0x7c')]['views']['agent']){var _0x471315=_0x5da10d['parameters'][_0x5a3e('0x7f')][_0x5a3e('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x5a3e('0x90')](_0x471315)){_0x36e31d=path[_0x5a3e('0x52')](_0x5a3e('0x91'),_0x231d61,_0x445e5f[0x0],_0x471315);}else{_0x36e31d=_0x471315;}}}}var _0x42f408={'name':_0x16dbdd,'description':_0x3ace67,'path':path['join'](_0x231d61,_0x445e5f[0x0]),'type':_0x2d2c41,'sidebar':_0x122bfb,'icon':_0x3130c0,'adminUrl':_0x1dfc5e,'agentUrl':_0x36e31d,'scriptName':_0x14ae57,'scriptPath':_0x59adef,'version':_0x430bfa};removeReferences(_0x3f5abc,null);return db['Plugin'][_0x5a3e('0x92')](_0x42f408)[_0x5a3e('0x4b')](function(_0x182f79){var _0x2b6935={'role':_0x2c0c8a['body'][_0x5a3e('0x93')],'userProfileId':_0x2c0c8a[_0x5a3e('0x94')][_0x5a3e('0x95')]};if(!_0x2b6935)throw new Error(_0x5a3e('0x96'));if(_0x2b6935[_0x5a3e('0x93')]===_0x5a3e('0x97')){var _0x2f7cfe=_0x182f79[_0x5a3e('0x98')]({'plain':!![]});return db['UserProfileSection'][_0x5a3e('0x50')]({'where':{'name':_0x5a3e('0x99'),'userProfileId':_0x2b6935[_0x5a3e('0x95')]},'raw':!![]})['then'](function(_0x4b7d00){if(_0x4b7d00&&_0x4b7d00[_0x5a3e('0x9a')]===0x0){return db[_0x5a3e('0x2e')][_0x5a3e('0x92')]({'name':_0x2f7cfe['name'],'resourceId':_0x2f7cfe['id'],'type':_0x4b7d00['name'],'sectionId':_0x4b7d00['id']},{})['then'](function(){return _0x182f79;});}else{return _0x182f79;}})['catch'](function(_0x39b962){logger[_0x5a3e('0x5d')](_0x5a3e('0x9b'),_0x39b962);throw _0x39b962;});}return _0x182f79;})[_0x5a3e('0x4b')](respondWithResult(_0x1e6b13,null))[_0x5a3e('0x67')](handleError(_0x1e6b13,null));}});}catch(_0x5d0cf6){_0x1e6b13[_0x5a3e('0x23')](0x1f4)[_0x5a3e('0x31')](_0x5d0cf6);}};function removeReferences(_0x309c5c,_0x12be3e){try{if(_0x309c5c){fs['unlinkSync'](_0x309c5c);logger[_0x5a3e('0x65')](_0x5a3e('0x9c'));}if(_0x12be3e){rimraf(_0x12be3e,function(){});logger[_0x5a3e('0x65')](_0x5a3e('0x9d'));}}catch(_0x180797){logger[_0x5a3e('0x5d')](_0x180797);}}exports['update']=function(_0x48a239,_0x19b2cc,_0x449e1d){return db[_0x5a3e('0x34')][_0x5a3e('0x50')]({'where':{'id':_0x48a239[_0x5a3e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x19b2cc,null))[_0x5a3e('0x4b')](saveUpdates(_0x48a239['body'],null))[_0x5a3e('0x4b')](respondWithResult(_0x19b2cc,null))[_0x5a3e('0x67')](handleError(_0x19b2cc,null));};exports['delete']=function(_0x5ac527,_0x58525a,_0x4a19c1){return db['Plugin'][_0x5a3e('0x50')]({'where':{'id':_0x5ac527[_0x5a3e('0x4e')]['id']}})[_0x5a3e('0x4b')](function(_0x56e865){if(_0x56e865){return _0x56e865['destroy']();}})[_0x5a3e('0x4b')](function(_0x5b1835){rimraf(path['join'](config['root'],_0x5a3e('0x6b'),path['dirname'](_0x5b1835[_0x5a3e('0x9')])),function(){});return _0x5b1835;})['then'](handleEntityNotFound(_0x58525a,null))[_0x5a3e('0x4b')](respondWithStatusCode(_0x58525a,null))[_0x5a3e('0x67')](handleError(_0x58525a,null));};exports['webhookGet']=function(_0x42e715,_0x2e0f50,_0xae5e6a){return BPromise[_0x5a3e('0x9e')]()['then'](function(){if(!_0x42e715[_0x5a3e('0x39')][_0x5a3e('0x9')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x42e715[_0x5a3e('0x39')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x4a0e27=_0x42e715[_0x5a3e('0x39')]['hostname']?_0x42e715[_0x5a3e('0x39')][_0x5a3e('0x9f')]+':'+_0x42e715['query'][_0x5a3e('0xa0')]:_0x5a3e('0xa1')+_0x42e715['query'][_0x5a3e('0xa0')];var _0x1d84b9=_0x42e715[_0x5a3e('0x39')][_0x5a3e('0x24')]?_0x42e715[_0x5a3e('0x39')]['json']:!![];var _0x519c9f=_0x42e715[_0x5a3e('0x39')][_0x5a3e('0xa2')]?_0x42e715[_0x5a3e('0x39')][_0x5a3e('0xa2')]:null;var _0x2471a4={'method':_0x42e715[_0x5a3e('0xa3')],'uri':util[_0x5a3e('0x53')](_0x5a3e('0xa4'),_0x4a0e27,_0x42e715[_0x5a3e('0x39')][_0x5a3e('0x9')]),'json':_0x1d84b9,'resolveWithFullResponse':!![],'encoding':_0x519c9f,'qs':_0x42e715[_0x5a3e('0x39')]};if(_0x42e715[_0x5a3e('0xa5')]){_0x2471a4[_0x5a3e('0xa5')]=_0x42e715[_0x5a3e('0xa5')];if(_0x2471a4[_0x5a3e('0xa5')][_0x5a3e('0xa6')]){delete _0x2471a4[_0x5a3e('0xa5')][_0x5a3e('0xa6')];}}if(_0x2471a4[_0x5a3e('0xa5')][_0x5a3e('0xa7')]){delete _0x2471a4['headers'][_0x5a3e('0xa7')];}return rp(_0x2471a4);})[_0x5a3e('0x4b')](function(_0x4b70cc){if(_0x4b70cc){_0x2e0f50[_0x5a3e('0x28')](_0x4b70cc[_0x5a3e('0xa5')]);logger['info'](_0x4b70cc[_0x5a3e('0x94')]);if(_['endsWith'](_0x42e715[_0x5a3e('0x39')][_0x5a3e('0x9')],'download')&&_0x4b70cc[_0x5a3e('0xa8')]==0x1f4){return _0x2e0f50[_0x5a3e('0x22')](_0x4b70cc['statusCode']);}else{return _0x2e0f50['status'](_0x4b70cc['statusCode'])['send'](_0x4b70cc[_0x5a3e('0x94')]);}}else{return _0x2e0f50[_0x5a3e('0x22')](0xc8);}})[_0x5a3e('0x67')](handleError(_0x2e0f50,null));};exports[_0x5a3e('0xa9')]=function(_0x9eca59,_0xc32fd,_0x50b0ea){return BPromise[_0x5a3e('0x9e')]()['then'](function(){if(!_0x9eca59['query'][_0x5a3e('0x9')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x9eca59[_0x5a3e('0x39')][_0x5a3e('0xa0')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x355f33=_0x9eca59[_0x5a3e('0x39')]['hostname']?_0x9eca59['query'][_0x5a3e('0x9f')]+':'+_0x9eca59[_0x5a3e('0x39')]['port']:_0x5a3e('0xa1')+_0x9eca59[_0x5a3e('0x39')][_0x5a3e('0xa0')];var _0x3a8902=_0x9eca59[_0x5a3e('0x39')][_0x5a3e('0x24')]?_0x9eca59[_0x5a3e('0x39')]['json']:!![];var _0x24c684=_0x9eca59[_0x5a3e('0x39')][_0x5a3e('0xa2')]?_0x9eca59[_0x5a3e('0x39')][_0x5a3e('0xa2')]:null;var _0x4732ac={'method':_0x9eca59[_0x5a3e('0xa3')],'uri':util[_0x5a3e('0x53')](_0x5a3e('0xa4'),_0x355f33,_0x9eca59[_0x5a3e('0x39')][_0x5a3e('0x9')]),'json':_0x3a8902,'resolveWithFullResponse':!![],'encoding':_0x24c684,'body':_0x9eca59['body']};if(_0x9eca59['headers']){_0x4732ac[_0x5a3e('0xa5')]=_0x9eca59[_0x5a3e('0xa5')];if(_0x4732ac[_0x5a3e('0xa5')][_0x5a3e('0xa6')]){delete _0x4732ac[_0x5a3e('0xa5')][_0x5a3e('0xa6')];}}if(_0x4732ac[_0x5a3e('0xa5')]['content-type']){delete _0x4732ac['headers'][_0x5a3e('0xa7')];}return rp(_0x4732ac);})[_0x5a3e('0x4b')](function(_0x12b5fe){if(_0x12b5fe){_0xc32fd[_0x5a3e('0x28')](_0x12b5fe[_0x5a3e('0xa5')]);logger[_0x5a3e('0x65')](_0x12b5fe[_0x5a3e('0x94')]);return _0xc32fd[_0x5a3e('0x23')](_0x12b5fe[_0x5a3e('0xa8')])[_0x5a3e('0x31')](_0x12b5fe[_0x5a3e('0x94')]);}else{return _0xc32fd[_0x5a3e('0x22')](0xc8);}})[_0x5a3e('0x67')](handleError(_0xc32fd,null));}; \ No newline at end of file +var _0x98d7=['where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','length','find','params','root','format','%s.zip','basename','path','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','join','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','server/files/plugins','Plugin\x20upload\x20filepath:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','manifest.json','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','script','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./plugin.socket','register','sendStatus','status','count','offset','set','Content-Range','json','apply','save','update','then','get','Plugins','UserProfileResource','destroy','end','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort'];(function(_0x1419f6,_0x4180de){var _0x5b07c7=function(_0x5dd304){while(--_0x5dd304){_0x1419f6['push'](_0x1419f6['shift']());}};_0x5b07c7(++_0x4180de);}(_0x98d7,0x69));var _0x798d=function(_0x481004,_0x2f2881){_0x481004=_0x481004-0x0;var _0x44b175=_0x98d7[_0x481004];return _0x44b175;};'use strict';var pdf=require(_0x798d('0x0'));var emlformat=require(_0x798d('0x1'));var rimraf=require(_0x798d('0x2'));var zipdir=require(_0x798d('0x3'));var jsonpatch=require(_0x798d('0x4'));var rp=require(_0x798d('0x5'));var moment=require(_0x798d('0x6'));var BPromise=require(_0x798d('0x7'));var Mustache=require(_0x798d('0x8'));var util=require(_0x798d('0x9'));var path=require('path');var sox=require(_0x798d('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x798d('0xb'));var squel=require(_0x798d('0xc'));var crypto=require(_0x798d('0xd'));var jsforce=require(_0x798d('0xe'));var deskjs=require(_0x798d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x798d('0x10'));var Papa=require(_0x798d('0x11'));var extract=require(_0x798d('0x12'));var rimraf=require(_0x798d('0x2'));var archiver=require(_0x798d('0x13'));var Redis=require(_0x798d('0x14'));var authService=require(_0x798d('0x15'));var qs=require(_0x798d('0x16'));var as=require(_0x798d('0x17'));var hardwareService=require(_0x798d('0x18'));var logger=require('../../config/logger')(_0x798d('0x19'));var utils=require(_0x798d('0x1a'));var config=require(_0x798d('0x1b'));var db=require(_0x798d('0x1c'))['db'];config[_0x798d('0x1d')]=_['defaults'](config['redis'],{'host':_0x798d('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x798d('0x1d')]));require(_0x798d('0x1f'))[_0x798d('0x20')](socket);function respondWithStatusCode(_0x2b4e96,_0x4ad970){_0x4ad970=_0x4ad970||0xcc;return function(_0x45197a){if(_0x45197a){return _0x2b4e96[_0x798d('0x21')](_0x4ad970);}return _0x2b4e96['status'](_0x4ad970)['end']();};}function respondWithResult(_0x25cec6,_0x52933a){_0x52933a=_0x52933a||0xc8;return function(_0x31c6b5){if(_0x31c6b5){return _0x25cec6[_0x798d('0x22')](_0x52933a)['json'](_0x31c6b5);}};}function respondWithFilteredResult(_0x15b13d,_0x4f4584){return function(_0xed49d2){if(_0xed49d2){var _0x551349=_0xed49d2[_0x798d('0x23')],_0x392d3f=_0x4f4584[_0x798d('0x24')],_0x3e24d6=_0x4f4584[_0x798d('0x24')]+_0x4f4584['limit'],_0x18e3fd;if(_0x3e24d6>=_0x551349){_0x3e24d6=_0x551349;_0x18e3fd=0xc8;}else{_0x18e3fd=0xce;}_0x15b13d['status'](_0x18e3fd);return _0x15b13d[_0x798d('0x25')](_0x798d('0x26'),_0x392d3f+'-'+_0x3e24d6+'/'+_0x551349)[_0x798d('0x27')](_0xed49d2);}return null;};}function patchUpdates(_0x51681b){return function(_0x2f4175){try{jsonpatch[_0x798d('0x28')](_0x2f4175,_0x51681b,!![]);}catch(_0x373563){return BPromise['reject'](_0x373563);}return _0x2f4175[_0x798d('0x29')]();};}function saveUpdates(_0x5999ad,_0x326b55){return function(_0x2797fb){if(_0x2797fb){return _0x2797fb[_0x798d('0x2a')](_0x5999ad)[_0x798d('0x2b')](function(_0x17c74b){return _0x17c74b;});}return null;};}function removeEntity(_0x3e2a65,_0x167675){return function(_0x5a2adb){if(_0x5a2adb){return _0x5a2adb['destroy']()['then'](function(){var _0x436c84=_0x5a2adb[_0x798d('0x2c')]({'plain':!![]});var _0xd15cce=_0x798d('0x2d');return db[_0x798d('0x2e')][_0x798d('0x2f')]({'where':{'type':_0xd15cce,'resourceId':_0x436c84['id']}})[_0x798d('0x2b')](function(){return _0x5a2adb;});})['then'](function(){_0x3e2a65['status'](0xcc)[_0x798d('0x30')]();});}};}function handleEntityNotFound(_0x1bc9c1,_0x2b3c04){return function(_0x2d0c12){if(!_0x2d0c12){_0x1bc9c1['sendStatus'](0x194);}return _0x2d0c12;};}function handleError(_0x5b5df4,_0x79cba8){_0x79cba8=_0x79cba8||0x1f4;return function(_0x3d1c97){logger[_0x798d('0x31')](_0x3d1c97[_0x798d('0x32')]);if(_0x3d1c97[_0x798d('0x33')]){delete _0x3d1c97[_0x798d('0x33')];}_0x5b5df4[_0x798d('0x22')](_0x79cba8)[_0x798d('0x34')](_0x3d1c97);};}exports[_0x798d('0x35')]=function(_0x598887,_0x252f0b){var _0xa5d60a={},_0x120cb2={},_0x43d6b9={'count':0x0,'rows':[]};var _0x203f28=_[_0x798d('0x36')](db[_0x798d('0x37')][_0x798d('0x38')],function(_0x2688ea){return{'name':_0x2688ea[_0x798d('0x39')],'type':_0x2688ea['type']['key']};});_0x120cb2[_0x798d('0x3a')]=_[_0x798d('0x36')](_0x203f28,_0x798d('0x33'));_0x120cb2[_0x798d('0x3b')]=_[_0x798d('0x3c')](_0x598887[_0x798d('0x3b')]);_0x120cb2[_0x798d('0x3d')]=_[_0x798d('0x3e')](_0x120cb2[_0x798d('0x3a')],_0x120cb2['query']);_0xa5d60a[_0x798d('0x3f')]=_[_0x798d('0x3e')](_0x120cb2['model'],qs['fields'](_0x598887['query'][_0x798d('0x40')]));_0xa5d60a[_0x798d('0x3f')]=_0xa5d60a[_0x798d('0x3f')]['length']?_0xa5d60a['attributes']:_0x120cb2['model'];if(!_0x598887['query'][_0x798d('0x41')](_0x798d('0x42'))){_0xa5d60a['limit']=qs[_0x798d('0x43')](_0x598887[_0x798d('0x3b')]['limit']);_0xa5d60a[_0x798d('0x24')]=qs['offset'](_0x598887[_0x798d('0x3b')]['offset']);}_0xa5d60a['order']=qs[_0x798d('0x44')](_0x598887[_0x798d('0x3b')][_0x798d('0x44')]);_0xa5d60a[_0x798d('0x45')]=qs[_0x798d('0x3d')](_['pick'](_0x598887['query'],_0x120cb2['filters']));if(_0x598887[_0x798d('0x3b')][_0x798d('0x46')]){_0xa5d60a['where']=_[_0x798d('0x47')](_0xa5d60a[_0x798d('0x45')],{'$or':_[_0x798d('0x36')](_0x203f28,function(_0x3be654){if(_0x3be654[_0x798d('0x48')]!==_0x798d('0x49')){var _0xacbc26={};_0xacbc26[_0x3be654[_0x798d('0x33')]]={'$like':'%'+_0x598887[_0x798d('0x3b')][_0x798d('0x46')]+'%'};return _0xacbc26;}})});}_0xa5d60a=_[_0x798d('0x47')]({},_0xa5d60a,_0x598887[_0x798d('0x4a')]);var _0x2c9947={'where':_0xa5d60a[_0x798d('0x45')]};return db[_0x798d('0x37')][_0x798d('0x23')](_0x2c9947)[_0x798d('0x2b')](function(_0x1c2cc3){_0x43d6b9[_0x798d('0x23')]=_0x1c2cc3;if(_0x598887['query'][_0x798d('0x4b')]){_0xa5d60a[_0x798d('0x4c')]=[{'all':!![]}];}return db[_0x798d('0x37')][_0x798d('0x4d')](_0xa5d60a);})['then'](function(_0x1f1ef7){_0x43d6b9['rows']=_0x1f1ef7;return _0x43d6b9;})[_0x798d('0x2b')](respondWithFilteredResult(_0x252f0b,_0xa5d60a))[_0x798d('0x4e')](handleError(_0x252f0b,null));};exports[_0x798d('0x4f')]=function(_0x4786d,_0x789830){var _0x2aa810={'raw':!![],'where':{'id':_0x4786d['params']['id']}},_0x2cc508={};_0x2cc508[_0x798d('0x3a')]=_[_0x798d('0x3c')](db['Plugin'][_0x798d('0x38')]);_0x2cc508[_0x798d('0x3b')]=_[_0x798d('0x3c')](_0x4786d[_0x798d('0x3b')]);_0x2cc508[_0x798d('0x3d')]=_[_0x798d('0x3e')](_0x2cc508[_0x798d('0x3a')],_0x2cc508[_0x798d('0x3b')]);_0x2aa810[_0x798d('0x3f')]=_[_0x798d('0x3e')](_0x2cc508['model'],qs['fields'](_0x4786d['query'][_0x798d('0x40')]));_0x2aa810[_0x798d('0x3f')]=_0x2aa810[_0x798d('0x3f')][_0x798d('0x50')]?_0x2aa810['attributes']:_0x2cc508[_0x798d('0x3a')];if(_0x4786d['query'][_0x798d('0x4b')]){_0x2aa810['include']=[{'all':!![]}];}_0x2aa810=_[_0x798d('0x47')]({},_0x2aa810,_0x4786d[_0x798d('0x4a')]);return db[_0x798d('0x37')][_0x798d('0x51')](_0x2aa810)[_0x798d('0x2b')](handleEntityNotFound(_0x789830,null))[_0x798d('0x2b')](respondWithResult(_0x789830,null))[_0x798d('0x4e')](handleError(_0x789830,null));};exports['download']=function(_0xe6ae30,_0x326911,_0x5d92bc){return db[_0x798d('0x37')][_0x798d('0x51')]({'where':{'id':_0xe6ae30[_0x798d('0x52')]['id']},'attributes':[_0x798d('0x33'),'path'],'raw':!![]})[_0x798d('0x2b')](handleEntityNotFound(_0x326911,null))[_0x798d('0x2b')](function(_0x2ba23a){if(_0x2ba23a){var _0x28dda3=path['join'](config[_0x798d('0x53')],'server/files/plugins',util[_0x798d('0x54')](_0x798d('0x55'),path[_0x798d('0x56')](_0x2ba23a[_0x798d('0x57')])));var _0x47e277=fs[_0x798d('0x58')](_0x28dda3);var _0x2b58f7=archiver('zip',{'zlib':{'level':0x9}});_0x2b58f7['on'](_0x798d('0x59'),function(_0x1d1ef7){if(_0x1d1ef7[_0x798d('0x5a')]===_0x798d('0x5b')){logger[_0x798d('0x31')](_0x1d1ef7);}else{throw new db[(_0x798d('0x5c'))][(_0x798d('0x5d'))](_0x798d('0x5e'));}});_0x2b58f7['on'](_0x798d('0x31'),function(_0x37fb66){throw new db[(_0x798d('0x5c'))][(_0x798d('0x5d'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x2b58f7[_0x798d('0x5f')](_0x47e277);_0x2b58f7['glob']('**/*',{'cwd':path[_0x798d('0x60')](config[_0x798d('0x53')],'server/files/plugins',path[_0x798d('0x61')](_0x2ba23a[_0x798d('0x57')])),'ignore':[path[_0x798d('0x60')](path[_0x798d('0x56')](_0x2ba23a[_0x798d('0x57')]),_0x798d('0x62')),path[_0x798d('0x60')](path[_0x798d('0x56')](_0x2ba23a['path']),_0x798d('0x63'))],'nodir':!![]})[_0x798d('0x64')]();_0x47e277['on'](_0x798d('0x65'),function(){if(!fs[_0x798d('0x66')](_0x28dda3)){throw new db[(_0x798d('0x5c'))][(_0x798d('0x5d'))]('Plugin\x20not\x20found');}return _0x326911[_0x798d('0x67')](_0x28dda3,util[_0x798d('0x54')](_0x798d('0x55'),path[_0x798d('0x56')](_0x2ba23a['path'])),function(_0x193b09){if(_0x193b09){throw new db[(_0x798d('0x5c'))]['Error'](_0x798d('0x68'));}fs[_0x798d('0x69')](_0x28dda3);logger[_0x798d('0x6a')](_0x798d('0x6b'));logger[_0x798d('0x6a')](_0x798d('0x6c'));});});}return null;})['catch'](handleError(_0x326911,null));};exports['upload']=function(_0x18db97,_0x1fea61,_0x471258){var _0x153eba=path['basename'](_0x18db97[_0x798d('0x6d')][_0x798d('0x6e')],path[_0x798d('0x6f')](_0x18db97[_0x798d('0x6d')][_0x798d('0x6e')]));var _0x16ea1a=path[_0x798d('0x60')](config[_0x798d('0x53')],'server/files/plugins',_0x18db97[_0x798d('0x6d')][_0x798d('0x6e')]);var _0x2ece5e=path[_0x798d('0x60')](config[_0x798d('0x53')],_0x798d('0x70'),_0x153eba);logger[_0x798d('0x6a')](_0x798d('0x71'),_0x16ea1a);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x2ece5e);try{fs[_0x798d('0x72')](_0x16ea1a,parseInt('0777',0x8));extract(_0x16ea1a,{'dir':_0x2ece5e},function(_0x1dac42){if(_0x1dac42){logger[_0x798d('0x31')](_0x1dac42);handleError(_0x1dac42,!![]);};var _0x31308b=fs[_0x798d('0x73')](_0x2ece5e);if(_0x31308b[_0x798d('0x50')]>0x1){removeReferences(_0x16ea1a,_0x2ece5e);logger[_0x798d('0x31')](_0x798d('0x74'));return _0x471258(new Error(_0x798d('0x74')));}var _0x222480=fs[_0x798d('0x75')](path[_0x798d('0x60')](_0x2ece5e,_0x31308b[0x0]));if(_0x222480['isFile']()){removeReferences(_0x16ea1a,_0x2ece5e);logger[_0x798d('0x31')](_0x798d('0x74'));return _0x471258(new Error(_0x798d('0x74')));}if(_0x222480[_0x798d('0x76')]()){var _0x3e578c=fs['readdirSync'](path[_0x798d('0x60')](_0x2ece5e,_0x31308b[0x0]));if(_0x3e578c[_0x798d('0x50')]===0x0){removeReferences(_0x16ea1a,_0x2ece5e);logger[_0x798d('0x31')](_0x798d('0x74'));return _0x471258(new Error(_0x798d('0x74')));}var _0x430ae8=_0x3e578c['some'](function(_0x5f3d45){return _0x5f3d45===_0x798d('0x77');});if(!_0x430ae8){return _0x471258(new Error('Plugin\x20manifest\x20missing'));}var _0x1e086b=fs[_0x798d('0x78')](path[_0x798d('0x60')](_0x2ece5e,_0x31308b[0x0],_0x798d('0x77')));var _0xbb6900=JSON[_0x798d('0x79')](_0x1e086b);if(_0x798d('0x7a')==typeof _0xbb6900[_0x798d('0x33')]){return _0x471258(new Error(_0x798d('0x7b')));}if(_0x798d('0x7a')==typeof _0xbb6900[_0x798d('0x48')]){return _0x471258(new Error(_0x798d('0x7c')));}if(_0x798d('0x7a')==typeof _0xbb6900[_0x798d('0x7d')]){return _0x471258(new Error(_0x798d('0x7e')));}if(_0x798d('0x7a')==typeof _0xbb6900['parameters']){return _0x471258(new Error(_0x798d('0x7f')));}if(_0xbb6900['type']===_0x798d('0x80')){if(_0x798d('0x7a')==typeof _0xbb6900[_0x798d('0x81')][_0x798d('0x82')]){return _0x471258(new Error(_0x798d('0x83')));}if(_0x798d('0x7a')==typeof _0xbb6900['parameters'][_0x798d('0x82')][_0x798d('0x84')]&&'undefined'==typeof _0xbb6900[_0x798d('0x81')][_0x798d('0x82')][_0x798d('0x85')]){return _0x471258(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0xbb6900[_0x798d('0x48')]==='script'){if(_0x798d('0x7a')==typeof _0xbb6900[_0x798d('0x81')][_0x798d('0x86')]){return _0x471258(new Error(_0x798d('0x87')));}if(_0x798d('0x7a')==typeof _0xbb6900['parameters'][_0x798d('0x88')]){return _0x471258(new Error(_0x798d('0x89')));}}else{return _0x471258(new Error(_0x798d('0x8a')));}var _0x2fcdc5=_0xbb6900[_0x798d('0x33')];var _0x250727=_0xbb6900[_0x798d('0x8b')];var _0x340d17=_0xbb6900[_0x798d('0x48')];var _0x8a7f74=_0xbb6900['sidebar']?_0xbb6900['sidebar']:_0x798d('0x8c');var _0x1e4405=_0xbb6900[_0x798d('0x8d')]?_0xbb6900[_0x798d('0x8d')]:_0x798d('0x8e');var _0x5043c4='';var _0x37ba14='';var _0x3bba2e='';var _0xb65fc8='';var _0x12dce8=_0xbb6900[_0x798d('0x7d')];if(_0x340d17===_0x798d('0x80')){if(_0x798d('0x7a')!=typeof _0xbb6900[_0x798d('0x81')][_0x798d('0x82')]['admin']){var _0x5f06fe=_0xbb6900[_0x798d('0x81')]['views'][_0x798d('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x798d('0x8f')](_0x5f06fe)){_0x5043c4=path['join'](_0x798d('0x90'),_0x153eba,_0x31308b[0x0],_0x5f06fe);}else{_0x5043c4=_0x5f06fe;}}else{logger[_0x798d('0x6a')](_0x798d('0x91'));}if(_0x798d('0x7a')!=typeof _0xbb6900[_0x798d('0x81')][_0x798d('0x82')][_0x798d('0x85')]){var _0x178456=_0xbb6900[_0x798d('0x81')][_0x798d('0x82')][_0x798d('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x798d('0x8f')](_0x178456)){_0x37ba14=path[_0x798d('0x60')](_0x798d('0x90'),_0x153eba,_0x31308b[0x0],_0x178456);}else{_0x37ba14=_0x178456;}}else{logger[_0x798d('0x6a')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x340d17===_0x798d('0x92')){_0x3bba2e=_0xbb6900[_0x798d('0x81')]['scriptName'];_0xb65fc8=_0xbb6900[_0x798d('0x81')][_0x798d('0x88')];if(_0x798d('0x7a')!=typeof _0xbb6900[_0x798d('0x81')][_0x798d('0x82')]){if(_0x798d('0x7a')!=typeof _0xbb6900[_0x798d('0x81')]['views'][_0x798d('0x84')]){var _0x5f06fe=_0xbb6900[_0x798d('0x81')][_0x798d('0x82')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x5f06fe)){_0x5043c4=path[_0x798d('0x60')]('plugins',_0x153eba,_0x31308b[0x0],_0x5f06fe);}else{_0x5043c4=_0x5f06fe;}}if(_0x798d('0x7a')!=typeof _0xbb6900[_0x798d('0x81')][_0x798d('0x82')][_0x798d('0x85')]){var _0x178456=_0xbb6900[_0x798d('0x81')][_0x798d('0x82')][_0x798d('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x798d('0x8f')](_0x178456)){_0x37ba14=path['join']('plugins',_0x153eba,_0x31308b[0x0],_0x178456);}else{_0x37ba14=_0x178456;}}}}var _0x3eee31={'name':_0x2fcdc5,'description':_0x250727,'path':path['join'](_0x153eba,_0x31308b[0x0]),'type':_0x340d17,'sidebar':_0x8a7f74,'icon':_0x1e4405,'adminUrl':_0x5043c4,'agentUrl':_0x37ba14,'scriptName':_0x3bba2e,'scriptPath':_0xb65fc8,'version':_0x12dce8};removeReferences(_0x16ea1a,null);return db['Plugin'][_0x798d('0x93')](_0x3eee31)['then'](function(_0x5dbfda){var _0x4a3c62={'role':_0x18db97['body'][_0x798d('0x94')],'userProfileId':_0x18db97[_0x798d('0x95')][_0x798d('0x96')]};if(!_0x4a3c62)throw new Error(_0x798d('0x97'));if(_0x4a3c62[_0x798d('0x94')]===_0x798d('0x98')){var _0x30483e=_0x5dbfda[_0x798d('0x2c')]({'plain':!![]});return db[_0x798d('0x99')]['find']({'where':{'name':'Plugins','userProfileId':_0x4a3c62[_0x798d('0x96')]},'raw':!![]})[_0x798d('0x2b')](function(_0x1a030d){if(_0x1a030d&&_0x1a030d[_0x798d('0x9a')]===0x0){return db[_0x798d('0x2e')][_0x798d('0x93')]({'name':_0x30483e[_0x798d('0x33')],'resourceId':_0x30483e['id'],'type':_0x1a030d[_0x798d('0x33')],'sectionId':_0x1a030d['id']},{})[_0x798d('0x2b')](function(){return _0x5dbfda;});}else{return _0x5dbfda;}})[_0x798d('0x4e')](function(_0x222ff0){logger[_0x798d('0x31')](_0x798d('0x9b'),_0x222ff0);throw _0x222ff0;});}return _0x5dbfda;})[_0x798d('0x2b')](respondWithResult(_0x1fea61,null))[_0x798d('0x4e')](handleError(_0x1fea61,null));}});}catch(_0x2d3fbd){_0x1fea61[_0x798d('0x22')](0x1f4)[_0x798d('0x34')](_0x2d3fbd);}};function removeReferences(_0x554dfa,_0x30ec42){try{if(_0x554dfa){fs[_0x798d('0x69')](_0x554dfa);logger[_0x798d('0x6a')](_0x798d('0x9c'));}if(_0x30ec42){rimraf(_0x30ec42,function(){});logger[_0x798d('0x6a')](_0x798d('0x9d'));}}catch(_0x1b30e5){logger[_0x798d('0x31')](_0x1b30e5);}}exports['update']=function(_0x1db774,_0x4ee6cc,_0x27f949){return db[_0x798d('0x37')]['find']({'where':{'id':_0x1db774[_0x798d('0x52')]['id']}})[_0x798d('0x2b')](handleEntityNotFound(_0x4ee6cc,null))[_0x798d('0x2b')](saveUpdates(_0x1db774['body'],null))[_0x798d('0x2b')](respondWithResult(_0x4ee6cc,null))[_0x798d('0x4e')](handleError(_0x4ee6cc,null));};exports[_0x798d('0x9e')]=function(_0x210e3a,_0x5d8407,_0xcb4862){return db['Plugin']['find']({'where':{'id':_0x210e3a['params']['id']}})['then'](function(_0x44d10d){if(_0x44d10d){return _0x44d10d[_0x798d('0x2f')]();}})[_0x798d('0x2b')](function(_0x3fa32d){rimraf(path[_0x798d('0x60')](config[_0x798d('0x53')],_0x798d('0x70'),path['dirname'](_0x3fa32d['path'])),function(){});return _0x3fa32d;})[_0x798d('0x2b')](handleEntityNotFound(_0x5d8407,null))['then'](respondWithStatusCode(_0x5d8407,null))[_0x798d('0x4e')](handleError(_0x5d8407,null));};exports[_0x798d('0x9f')]=function(_0x5c2b65,_0x5d1c57,_0x4c688a){return BPromise[_0x798d('0xa0')]()['then'](function(){if(!_0x5c2b65[_0x798d('0x3b')][_0x798d('0x57')]){throw new Error(_0x798d('0xa1'));}if(!_0x5c2b65[_0x798d('0x3b')][_0x798d('0xa2')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x1b9aae=_0x5c2b65[_0x798d('0x3b')][_0x798d('0xa3')]?_0x5c2b65[_0x798d('0x3b')]['hostname']+':'+_0x5c2b65['query'][_0x798d('0xa2')]:'http://localhost:'+_0x5c2b65[_0x798d('0x3b')]['port'];var _0x54878a=_0x5c2b65['query']['json']?_0x5c2b65[_0x798d('0x3b')][_0x798d('0x27')]:!![];var _0x4111e1=_0x5c2b65[_0x798d('0x3b')][_0x798d('0xa4')]?_0x5c2b65[_0x798d('0x3b')][_0x798d('0xa4')]:null;var _0x4bcbe8={'method':_0x5c2b65['method'],'uri':util[_0x798d('0x54')](_0x798d('0xa5'),_0x1b9aae,_0x5c2b65[_0x798d('0x3b')][_0x798d('0x57')]),'json':_0x54878a,'resolveWithFullResponse':!![],'encoding':_0x4111e1,'qs':_0x5c2b65[_0x798d('0x3b')]};if(_0x5c2b65[_0x798d('0xa6')]){_0x4bcbe8[_0x798d('0xa6')]=_0x5c2b65[_0x798d('0xa6')];if(_0x4bcbe8['headers']['content-length']){delete _0x4bcbe8['headers'][_0x798d('0xa7')];}}if(_0x4bcbe8['headers']['content-type']){delete _0x4bcbe8['headers'][_0x798d('0xa8')];}return rp(_0x4bcbe8);})['then'](function(_0x41be26){if(_0x41be26){_0x5d1c57[_0x798d('0x25')](_0x41be26[_0x798d('0xa6')]);logger[_0x798d('0x6a')](_0x41be26[_0x798d('0x95')]);if(_[_0x798d('0xa9')](_0x5c2b65[_0x798d('0x3b')][_0x798d('0x57')],_0x798d('0x67'))&&_0x41be26[_0x798d('0xaa')]==0x1f4){return _0x5d1c57[_0x798d('0x21')](_0x41be26[_0x798d('0xaa')]);}else{return _0x5d1c57[_0x798d('0x22')](_0x41be26[_0x798d('0xaa')])['send'](_0x41be26['body']);}}else{return _0x5d1c57[_0x798d('0x21')](0xc8);}})[_0x798d('0x4e')](handleError(_0x5d1c57,null));};exports[_0x798d('0xab')]=function(_0x2a5e16,_0x2c3086,_0x25be7b){return BPromise[_0x798d('0xa0')]()['then'](function(){if(!_0x2a5e16[_0x798d('0x3b')]['path']){throw new Error(_0x798d('0xa1'));}if(!_0x2a5e16[_0x798d('0x3b')][_0x798d('0xa2')]){throw new Error(_0x798d('0xac'));}var _0x52edb1=_0x2a5e16[_0x798d('0x3b')][_0x798d('0xa3')]?_0x2a5e16[_0x798d('0x3b')][_0x798d('0xa3')]+':'+_0x2a5e16[_0x798d('0x3b')][_0x798d('0xa2')]:_0x798d('0xad')+_0x2a5e16['query'][_0x798d('0xa2')];var _0x33acb3=_0x2a5e16[_0x798d('0x3b')]['json']?_0x2a5e16[_0x798d('0x3b')][_0x798d('0x27')]:!![];var _0x51b892=_0x2a5e16[_0x798d('0x3b')]['encoding']?_0x2a5e16['query']['encoding']:null;var _0x124be7={'method':_0x2a5e16['method'],'uri':util[_0x798d('0x54')](_0x798d('0xa5'),_0x52edb1,_0x2a5e16[_0x798d('0x3b')][_0x798d('0x57')]),'json':_0x33acb3,'resolveWithFullResponse':!![],'encoding':_0x51b892,'body':_0x2a5e16['body']};if(_0x2a5e16[_0x798d('0xa6')]){_0x124be7['headers']=_0x2a5e16[_0x798d('0xa6')];if(_0x124be7[_0x798d('0xa6')]['content-length']){delete _0x124be7[_0x798d('0xa6')][_0x798d('0xa7')];}}if(_0x124be7[_0x798d('0xa6')][_0x798d('0xa8')]){delete _0x124be7[_0x798d('0xa6')]['content-type'];}return rp(_0x124be7);})['then'](function(_0x5e5b9a){if(_0x5e5b9a){_0x2c3086[_0x798d('0x25')](_0x5e5b9a[_0x798d('0xa6')]);logger['info'](_0x5e5b9a[_0x798d('0x95')]);return _0x2c3086[_0x798d('0x22')](_0x5e5b9a[_0x798d('0xaa')])[_0x798d('0x34')](_0x5e5b9a[_0x798d('0x95')]);}else{return _0x2c3086[_0x798d('0x21')](0xc8);}})['catch'](handleError(_0x2c3086,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index db860e3..c6855a3 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 _0xa456=['Plugin','setMaxListeners','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x58f1f8,_0x2c9d79){var _0x5a6d87=function(_0x2291b0){while(--_0x2291b0){_0x58f1f8['push'](_0x58f1f8['shift']());}};_0x5a6d87(++_0x2c9d79);}(_0xa456,0x142));var _0x6a45=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0xa456[_0x46d0c9];return _0x174506;};'use strict';var EventEmitter=require(_0x6a45('0x0'));var Plugin=require(_0x6a45('0x1'))['db'][_0x6a45('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x6a45('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6a45('0x4'),'afterDestroy':_0x6a45('0x5')};function emitEvent(_0x3f7448){return function(_0x500c72,_0x1f0701,_0x40acad){PluginEvents[_0x6a45('0x6')](_0x3f7448+':'+_0x500c72['id'],_0x500c72);PluginEvents[_0x6a45('0x6')](_0x3f7448,_0x500c72);_0x40acad(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x6a45('0x7')](e,emitEvent(event));}}module[_0x6a45('0x8')]=PluginEvents; \ No newline at end of file +var _0xd4a2=['setMaxListeners','update','emit','hasOwnProperty','exports','events'];(function(_0x2dcd68,_0x2d8d8e){var _0x5f5d10=function(_0x5550e6){while(--_0x5550e6){_0x2dcd68['push'](_0x2dcd68['shift']());}};_0x5f5d10(++_0x2d8d8e);}(_0xd4a2,0x173));var _0x2d4a=function(_0x406a45,_0x1f2d3f){_0x406a45=_0x406a45-0x0;var _0x224491=_0xd4a2[_0x406a45];return _0x224491;};'use strict';var EventEmitter=require(_0x2d4a('0x0'));var Plugin=require('../../mysqldb')['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x2d4a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2d4a('0x2'),'afterDestroy':'remove'};function emitEvent(_0x24810d){return function(_0x5d435a,_0x32af9e,_0x40d744){PluginEvents[_0x2d4a('0x3')](_0x24810d+':'+_0x5d435a['id'],_0x5d435a);PluginEvents[_0x2d4a('0x3')](_0x24810d,_0x5d435a);_0x40d744(null);};}for(var e in events){if(events[_0x2d4a('0x4')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x2d4a('0x5')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 85f2c4e..d3ee5e4 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 _0xfd28=['rimraf','./plugin.attributes','exports','define','util','../../config/logger','moment','request-promise','path'];(function(_0x1dd461,_0x5cae03){var _0x1314c0=function(_0x19b4d8){while(--_0x19b4d8){_0x1dd461['push'](_0x1dd461['shift']());}};_0x1314c0(++_0x5cae03);}(_0xfd28,0x148));var _0x8fd2=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0xfd28[_0x648163];return _0x199d4d;};'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')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3cd=['path','rimraf','../../config/environment','exports','define','Plugin','plugins','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x107090,_0x2cd535){var _0xfc0078=function(_0x3ec9af){while(--_0x3ec9af){_0x107090['push'](_0x107090['shift']());}};_0xfc0078(++_0x2cd535);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2d2258,_0x2ce510){_0x2d2258=_0x2d2258-0x0;var _0x18e155=_0xf3cd[_0x2d2258];return _0x18e155;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./plugin.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'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 f47912c..3d815b2 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 _0x397f=['stringify','error','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','debug','request\x20sent'];(function(_0xf85796,_0x486a5b){var _0x5b700e=function(_0xdf5c8c){while(--_0xdf5c8c){_0xf85796['push'](_0xf85796['shift']());}};_0x5b700e(++_0x486a5b);}(_0x397f,0x113));var _0xf397=function(_0x30a9a2,_0x1e4a87){_0x30a9a2=_0x30a9a2-0x0;var _0x36c8bc=_0x397f[_0x30a9a2];return _0x36c8bc;};'use strict';var _=require(_0xf397('0x0'));var util=require('util');var moment=require(_0xf397('0x1'));var BPromise=require(_0xf397('0x2'));var rs=require(_0xf397('0x3'));var fs=require('fs');var Redis=require(_0xf397('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf397('0x5'));var logger=require('../../config/logger')(_0xf397('0x6'));var config=require(_0xf397('0x7'));var jayson=require(_0xf397('0x8'));var client=jayson[_0xf397('0x9')][_0xf397('0xa')]({'port':0x232a});config[_0xf397('0xb')]=_[_0xf397('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf397('0xd'))(new Redis(config[_0xf397('0xb')]));require(_0xf397('0xe'))[_0xf397('0xf')](socket);function respondWithRpcPromise(_0x38cc65,_0x163fe9,_0x555256){return new BPromise(function(_0xba19aa,_0x292e22){return client[_0xf397('0x10')](_0x38cc65,_0x555256)[_0xf397('0x11')](function(_0x22ed97){logger[_0xf397('0x12')](_0xf397('0x13'),_0x163fe9,'request\x20sent');logger[_0xf397('0x14')]('Plugin,\x20%s,\x20%s,\x20%s',_0x163fe9,_0xf397('0x15'),JSON[_0xf397('0x16')](_0x22ed97));if(_0x22ed97['error']){if(_0x22ed97['error']['code']===0x1f4){logger[_0xf397('0x17')](_0xf397('0x13'),_0x163fe9,_0x22ed97['error'][_0xf397('0x18')]);return _0x292e22(_0x22ed97[_0xf397('0x17')]['message']);}logger[_0xf397('0x17')](_0xf397('0x13'),_0x163fe9,_0x22ed97[_0xf397('0x17')]['message']);return _0xba19aa(_0x22ed97[_0xf397('0x17')][_0xf397('0x18')]);}else{logger[_0xf397('0x12')](_0xf397('0x13'),_0x163fe9,_0xf397('0x15'));_0xba19aa(_0x22ed97[_0xf397('0x19')][_0xf397('0x18')]);}})[_0xf397('0x1a')](function(_0xf81395){logger['error'](_0xf397('0x13'),_0x163fe9,_0xf81395);_0x292e22(_0xf81395);});});}exports[_0xf397('0x1b')]=function(_0x33ebad){var _0x37f2dd=this;return new Promise(function(_0x5cfcfd,_0x4acb4c){return db[_0xf397('0x1c')][_0xf397('0x1d')](_0x33ebad[_0xf397('0x1e')],{'raw':_0x33ebad[_0xf397('0x1f')]?_0x33ebad[_0xf397('0x1f')][_0xf397('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x15f1bc){logger[_0xf397('0x12')]('CreatePlugin',_0x33ebad);logger[_0xf397('0x14')](_0xf397('0x1b'),_0x33ebad,JSON[_0xf397('0x16')](_0x15f1bc));_0x5cfcfd(_0x15f1bc);})[_0xf397('0x1a')](function(_0x497a23){logger[_0xf397('0x17')](_0xf397('0x1b'),_0x497a23['message'],_0x33ebad);_0x4acb4c(_0x37f2dd['error'](0x1f4,_0x497a23[_0xf397('0x18')]));});});}; \ No newline at end of file +var _0xeac0=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','register','request','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','catch','Plugin','body','options','raw','then','CreatePlugin','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x36a7bd,_0x1149c8){var _0x4cb722=function(_0x343dd5){while(--_0x343dd5){_0x36a7bd['push'](_0x36a7bd['shift']());}};_0x4cb722(++_0x1149c8);}(_0xeac0,0x1d5));var _0x0eac=function(_0x4354b5,_0x136344){_0x4354b5=_0x4354b5-0x0;var _0x447e53=_0xeac0[_0x4354b5];return _0x447e53;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0eac('0x0'));var BPromise=require(_0x0eac('0x1'));var rs=require(_0x0eac('0x2'));var fs=require('fs');var Redis=require(_0x0eac('0x3'));var db=require(_0x0eac('0x4'))['db'];var utils=require(_0x0eac('0x5'));var logger=require(_0x0eac('0x6'))(_0x0eac('0x7'));var config=require(_0x0eac('0x8'));var jayson=require(_0x0eac('0x9'));var client=jayson[_0x0eac('0xa')][_0x0eac('0xb')]({'port':0x232a});config[_0x0eac('0xc')]=_[_0x0eac('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0eac('0xe'))(new Redis(config[_0x0eac('0xc')]));require(_0x0eac('0xf'))[_0x0eac('0x10')](socket);function respondWithRpcPromise(_0x85a5af,_0x28a0a5,_0x3aec64){return new BPromise(function(_0x19f97f,_0x1b093e){return client[_0x0eac('0x11')](_0x85a5af,_0x3aec64)['then'](function(_0x48be5f){logger[_0x0eac('0x12')]('Plugin,\x20%s,\x20%s',_0x28a0a5,_0x0eac('0x13'));logger[_0x0eac('0x14')](_0x0eac('0x15'),_0x28a0a5,_0x0eac('0x13'),JSON[_0x0eac('0x16')](_0x48be5f));if(_0x48be5f[_0x0eac('0x17')]){if(_0x48be5f[_0x0eac('0x17')][_0x0eac('0x18')]===0x1f4){logger[_0x0eac('0x17')](_0x0eac('0x19'),_0x28a0a5,_0x48be5f[_0x0eac('0x17')][_0x0eac('0x1a')]);return _0x1b093e(_0x48be5f['error'][_0x0eac('0x1a')]);}logger[_0x0eac('0x17')](_0x0eac('0x19'),_0x28a0a5,_0x48be5f[_0x0eac('0x17')][_0x0eac('0x1a')]);return _0x19f97f(_0x48be5f['error'][_0x0eac('0x1a')]);}else{logger[_0x0eac('0x12')]('Plugin,\x20%s,\x20%s',_0x28a0a5,'request\x20sent');_0x19f97f(_0x48be5f['result'][_0x0eac('0x1a')]);}})[_0x0eac('0x1b')](function(_0x2077b9){logger[_0x0eac('0x17')](_0x0eac('0x19'),_0x28a0a5,_0x2077b9);_0x1b093e(_0x2077b9);});});}exports['CreatePlugin']=function(_0x5dec6f){var _0x4881f9=this;return new Promise(function(_0x3afe38,_0x5df67f){return db[_0x0eac('0x1c')]['create'](_0x5dec6f[_0x0eac('0x1d')],{'raw':_0x5dec6f[_0x0eac('0x1e')]?_0x5dec6f[_0x0eac('0x1e')][_0x0eac('0x1f')]===undefined?!![]:![]:!![]})[_0x0eac('0x20')](function(_0x2af9ca){logger[_0x0eac('0x12')](_0x0eac('0x21'),_0x5dec6f);logger[_0x0eac('0x14')](_0x0eac('0x21'),_0x5dec6f,JSON['stringify'](_0x2af9ca));_0x3afe38(_0x2af9ca);})[_0x0eac('0x1b')](function(_0x7cee0f){logger[_0x0eac('0x17')](_0x0eac('0x21'),_0x7cee0f[_0x0eac('0x1a')],_0x5dec6f);_0x5df67f(_0x4881f9['error'](0x1f4,_0x7cee0f['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 81cf31b..99d0e0f 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 _0xfa93=['register','plugin:','./plugin.events','remove','update'];(function(_0x51b398,_0x59a387){var _0x4f02c9=function(_0x571343){while(--_0x571343){_0x51b398['push'](_0x51b398['shift']());}};_0x4f02c9(++_0x59a387);}(_0xfa93,0x11f));var _0x3fa9=function(_0x1f517a,_0x924729){_0x1f517a=_0x1f517a-0x0;var _0x28c3fc=_0xfa93[_0x1f517a];return _0x28c3fc;};'use strict';var PluginEvents=require(_0x3fa9('0x0'));var events=['save',_0x3fa9('0x1'),_0x3fa9('0x2')];function createListener(_0x408965,_0x4b33d0){return function(_0x5bd1f9){_0x4b33d0['emit'](_0x408965,_0x5bd1f9);};}function removeListener(_0x31c34d,_0x53a91d){return function(){PluginEvents['removeListener'](_0x31c34d,_0x53a91d);};}exports[_0x3fa9('0x3')]=function(_0x442708){for(var _0x4631a2=0x0,_0x814ea=events['length'];_0x4631a2<_0x814ea;_0x4631a2++){var _0x543ddd=events[_0x4631a2];var _0x42c87c=createListener(_0x3fa9('0x4')+_0x543ddd,_0x442708);PluginEvents['on'](_0x543ddd,_0x42c87c);}}; \ No newline at end of file +var _0xf496=['save','remove','update','emit','removeListener','register','length','./plugin.events'];(function(_0x2319c7,_0x171cb9){var _0x136a90=function(_0x13a28b){while(--_0x13a28b){_0x2319c7['push'](_0x2319c7['shift']());}};_0x136a90(++_0x171cb9);}(_0xf496,0x1c7));var _0x6f49=function(_0x261da1,_0x15ee04){_0x261da1=_0x261da1-0x0;var _0x23bfb4=_0xf496[_0x261da1];return _0x23bfb4;};'use strict';var PluginEvents=require(_0x6f49('0x0'));var events=[_0x6f49('0x1'),_0x6f49('0x2'),_0x6f49('0x3')];function createListener(_0x1e9547,_0x4bc28b){return function(_0x303bad){_0x4bc28b[_0x6f49('0x4')](_0x1e9547,_0x303bad);};}function removeListener(_0x4fbce5,_0x16a835){return function(){PluginEvents[_0x6f49('0x5')](_0x4fbce5,_0x16a835);};}exports[_0x6f49('0x6')]=function(_0x3ad4f6){for(var _0x521f19=0x0,_0x1185c8=events[_0x6f49('0x7')];_0x521f19<_0x1185c8;_0x521f19++){var _0x426d37=events[_0x521f19];var _0x4792ec=createListener('plugin:'+_0x426d37,_0x3ad4f6);PluginEvents['on'](_0x426d37,_0x4792ec);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index a2af982..750254f 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 _0x68e2=['create','/:id','update','delete','destroy','exports','Router','get','isAuthenticated','index'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x68e2,0x92));var _0x268e=function(_0x19d093,_0x5a9c7d){_0x19d093=_0x19d093-0x0;var _0x497f44=_0x68e2[_0x19d093];return _0x497f44;};'use strict';var express=require('express');var router=express[_0x268e('0x0')]();var auth=require('../../components/auth/service');var controller=require('./pm2.controller');router[_0x268e('0x1')]('/',auth[_0x268e('0x2')](),controller[_0x268e('0x3')]);router[_0x268e('0x1')]('/:id',auth[_0x268e('0x2')](),controller['show']);router['post']('/',auth[_0x268e('0x2')](),controller[_0x268e('0x4')]);router['put'](_0x268e('0x5'),auth['isAuthenticated'](),controller[_0x268e('0x6')]);router[_0x268e('0x7')]('/:id',auth[_0x268e('0x2')](),controller[_0x268e('0x8')]);module[_0x268e('0x9')]=router; \ No newline at end of file +var _0x3ce2=['get','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','express','Router','../../components/auth/service','./pm2.controller'];(function(_0xdc56d3,_0x1de52d){var _0x597b04=function(_0x1d1ef5){while(--_0x1d1ef5){_0xdc56d3['push'](_0xdc56d3['shift']());}};_0x597b04(++_0x1de52d);}(_0x3ce2,0xbf));var _0x23ce=function(_0x74892f,_0x1e981b){_0x74892f=_0x74892f-0x0;var _0x10ee61=_0x3ce2[_0x74892f];return _0x10ee61;};'use strict';var express=require(_0x23ce('0x0'));var router=express[_0x23ce('0x1')]();var auth=require(_0x23ce('0x2'));var controller=require(_0x23ce('0x3'));router[_0x23ce('0x4')]('/',auth[_0x23ce('0x5')](),controller[_0x23ce('0x6')]);router[_0x23ce('0x4')]('/:id',auth['isAuthenticated'](),controller[_0x23ce('0x7')]);router[_0x23ce('0x8')]('/',auth[_0x23ce('0x5')](),controller[_0x23ce('0x9')]);router[_0x23ce('0xa')](_0x23ce('0xb'),auth[_0x23ce('0x5')](),controller[_0x23ce('0xc')]);router[_0x23ce('0xd')](_0x23ce('0xb'),auth[_0x23ce('0x5')](),controller['destroy']);module[_0x23ce('0xe')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 07f5e0e..7083207 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 _0xa312=['params','create','body','script','join','cwd','chdir','dirname','start','dump','update','restart','stop','Unknown\x20status','destroy','delete','lodash','../../config/pm2','api','path','child_process','exec','bluebird','sendStatus','status','error','stack','name','send','npm\x20install','info','index','list','then','reject','catch','show'];(function(_0x38fb8b,_0x70dd0a){var _0x1ec681=function(_0x58f130){while(--_0x58f130){_0x38fb8b['push'](_0x38fb8b['shift']());}};_0x1ec681(++_0x70dd0a);}(_0xa312,0x1cc));var _0x2a31=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0xa312[_0x2c1dcd];return _0x158ce5;};'use strict';var _=require(_0x2a31('0x0'));var pm2=require(_0x2a31('0x1'));var logger=require('../../config/logger')(_0x2a31('0x2'));var path=require(_0x2a31('0x3'));var exec=require(_0x2a31('0x4'))[_0x2a31('0x5')];var BPromise=require(_0x2a31('0x6'));function handleEntityNotFound(_0x5e9161,_0x4e8958){return function(_0x5e0421){if(!_0x5e0421){_0x5e9161[_0x2a31('0x7')](0x194);;}return _0x5e0421;};}function respondWithResult(_0x3788ea,_0x2e58b4){_0x2e58b4=_0x2e58b4||0xc8;return function(_0x280555){if(_0x280555){return _0x3788ea[_0x2a31('0x8')](_0x2e58b4)['json'](_0x280555);}return null;};}function handleError(_0x663c99,_0xa0921d){_0xa0921d=_0xa0921d||0x1f4;return function(_0x2f3f9f){logger[_0x2a31('0x9')](_0x2f3f9f[_0x2a31('0xa')]);if(_0x2f3f9f[_0x2a31('0xb')]){delete _0x2f3f9f[_0x2a31('0xb')];}_0x663c99[_0x2a31('0x8')](_0xa0921d)[_0x2a31('0xc')](_0x2f3f9f);};}function execChildProcess(){return new BPromise(function(_0x2f2fa1,_0x294ce0){exec(_0x2a31('0xd'),function(_0x289c89,_0x2d9fe9,_0x1b1a22){logger[_0x2a31('0xe')](_0x2d9fe9);logger[_0x2a31('0xe')](_0x1b1a22);if(_0x289c89){logger[_0x2a31('0x9')](_0x289c89);return _0x294ce0(_0x289c89);}return _0x2f2fa1(_0x2d9fe9);});});}exports[_0x2a31('0xf')]=function(_0xf246c5,_0x2812a2){return pm2[_0x2a31('0x10')]()[_0x2a31('0x11')](function(_0x1a3b5e){if(_0x1a3b5e){var _0x2413db=_[_0x2a31('0x12')](_0x1a3b5e,function(_0x5c4f1a){return _0x5c4f1a['name']==='express'||_0x5c4f1a[_0x2a31('0xb')]==='motion2';});return{'rows':_0x2413db,'count':_0x2413db['length']};}return null;})['then'](respondWithResult(_0x2812a2,null))[_0x2a31('0x13')](handleError(_0x2812a2,null));};exports[_0x2a31('0x14')]=function(_0x68d19c,_0x398047){return pm2['describe'](_0x68d19c[_0x2a31('0x15')]['id'])[_0x2a31('0x11')](respondWithResult(_0x398047,null))[_0x2a31('0x11')](handleEntityNotFound(_0x398047,null))[_0x2a31('0x13')](handleError(_0x398047,null));};exports[_0x2a31('0x16')]=function(_0x203fc9,_0x2f3636){if(_0x203fc9['body'][_0x2a31('0xb')]&&_0x203fc9[_0x2a31('0x17')][_0x2a31('0x18')]){var _0xdce206=path[_0x2a31('0x19')](__dirname,'../../files/plugins',_0x203fc9[_0x2a31('0x17')][_0x2a31('0x18')]);var _0x2e8afc=process[_0x2a31('0x1a')]();process[_0x2a31('0x1b')](path[_0x2a31('0x1c')](_0xdce206));return execChildProcess()[_0x2a31('0x11')](function(_0x19666c){process['chdir'](_0x2e8afc);return pm2[_0x2a31('0x1d')]({'name':_0x203fc9[_0x2a31('0x17')][_0x2a31('0xb')],'script':_0xdce206});})[_0x2a31('0x11')](function(_0x151354){pm2[_0x2a31('0x1e')]();return _0x151354[0x0];})[_0x2a31('0x11')](respondWithResult(_0x2f3636,0xc9))[_0x2a31('0x13')](handleError(_0x2f3636,null));}else{return _0x2f3636[_0x2a31('0x8')](0x1f4)[_0x2a31('0xc')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x2a31('0x1f')]=function(_0x340c27,_0x5c52b5){if(_0x340c27['body']['id']){delete _0x340c27['body']['id'];}var _0x57078f={'online':_0x2a31('0x20'),'stopped':_0x2a31('0x21')};if(_0x57078f['hasOwnProperty'](_0x340c27['body'][_0x2a31('0x8')])){return pm2[_0x57078f[_0x340c27[_0x2a31('0x17')][_0x2a31('0x8')]]](_0x340c27[_0x2a31('0x15')]['id'])[_0x2a31('0x11')](respondWithResult(_0x5c52b5,0xc8))[_0x2a31('0x13')](handleError(_0x5c52b5,null));}else{return _0x5c52b5[_0x2a31('0x8')](0x1f4)[_0x2a31('0xc')]({'message':_0x2a31('0x22')});}};exports[_0x2a31('0x23')]=function(_0x180313,_0x510762){if(_0x180313[_0x2a31('0x17')]['id']){delete _0x180313[_0x2a31('0x17')]['id'];}if(_0x180313[_0x2a31('0x15')]['id']){return pm2[_0x2a31('0x24')](_0x180313['params']['id'])['then'](function(_0x35c160){pm2[_0x2a31('0x1e')]();return _0x35c160[0x0];})[_0x2a31('0x11')](respondWithResult(_0x510762,null))[_0x2a31('0x13')](handleError(_0x510762,null));}else{return _0x510762[_0x2a31('0x8')](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x88b4=['npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','json','error','stack','name','status'];(function(_0x586363,_0x37701a){var _0xbec4c9=function(_0x2dfeb9){while(--_0x2dfeb9){_0x586363['push'](_0x586363['shift']());}};_0xbec4c9(++_0x37701a);}(_0x88b4,0x7c));var _0x488b=function(_0x212a37,_0xf35b2e){_0x212a37=_0x212a37-0x0;var _0x5d0bf9=_0x88b4[_0x212a37];return _0x5d0bf9;};'use strict';var _=require(_0x488b('0x0'));var pm2=require(_0x488b('0x1'));var logger=require(_0x488b('0x2'))(_0x488b('0x3'));var path=require(_0x488b('0x4'));var exec=require(_0x488b('0x5'))[_0x488b('0x6')];var BPromise=require(_0x488b('0x7'));function handleEntityNotFound(_0x2e53b0,_0x5c9f55){return function(_0xa1a702){if(!_0xa1a702){_0x2e53b0[_0x488b('0x8')](0x194);;}return _0xa1a702;};}function respondWithResult(_0x2d5025,_0x2ba66b){_0x2ba66b=_0x2ba66b||0xc8;return function(_0x965277){if(_0x965277){return _0x2d5025['status'](_0x2ba66b)[_0x488b('0x9')](_0x965277);}return null;};}function handleError(_0xc046f3,_0x2fdc5a){_0x2fdc5a=_0x2fdc5a||0x1f4;return function(_0x2de949){logger[_0x488b('0xa')](_0x2de949[_0x488b('0xb')]);if(_0x2de949[_0x488b('0xc')]){delete _0x2de949[_0x488b('0xc')];}_0xc046f3[_0x488b('0xd')](_0x2fdc5a)['send'](_0x2de949);};}function execChildProcess(){return new BPromise(function(_0xfbffe1,_0x5b3008){exec(_0x488b('0xe'),function(_0x4959d9,_0x86d000,_0x444911){logger['info'](_0x86d000);logger[_0x488b('0xf')](_0x444911);if(_0x4959d9){logger[_0x488b('0xa')](_0x4959d9);return _0x5b3008(_0x4959d9);}return _0xfbffe1(_0x86d000);});});}exports[_0x488b('0x10')]=function(_0x55611b,_0x2df377){return pm2[_0x488b('0x11')]()[_0x488b('0x12')](function(_0x541c75){if(_0x541c75){var _0x1767e4=_[_0x488b('0x13')](_0x541c75,function(_0x2913fc){return _0x2913fc[_0x488b('0xc')]===_0x488b('0x14')||_0x2913fc[_0x488b('0xc')]===_0x488b('0x15');});return{'rows':_0x1767e4,'count':_0x1767e4[_0x488b('0x16')]};}return null;})['then'](respondWithResult(_0x2df377,null))[_0x488b('0x17')](handleError(_0x2df377,null));};exports[_0x488b('0x18')]=function(_0x2a3794,_0x48ba0b){return pm2[_0x488b('0x19')](_0x2a3794[_0x488b('0x1a')]['id'])[_0x488b('0x12')](respondWithResult(_0x48ba0b,null))['then'](handleEntityNotFound(_0x48ba0b,null))[_0x488b('0x17')](handleError(_0x48ba0b,null));};exports[_0x488b('0x1b')]=function(_0x22363b,_0x3ab565){if(_0x22363b[_0x488b('0x1c')][_0x488b('0xc')]&&_0x22363b['body'][_0x488b('0x1d')]){var _0x3e6415=path[_0x488b('0x1e')](__dirname,_0x488b('0x1f'),_0x22363b[_0x488b('0x1c')][_0x488b('0x1d')]);var _0x247414=process[_0x488b('0x20')]();process[_0x488b('0x21')](path[_0x488b('0x22')](_0x3e6415));return execChildProcess()[_0x488b('0x12')](function(_0x29a483){process['chdir'](_0x247414);return pm2[_0x488b('0x23')]({'name':_0x22363b['body'][_0x488b('0xc')],'script':_0x3e6415});})['then'](function(_0x216af0){pm2[_0x488b('0x24')]();return _0x216af0[0x0];})['then'](respondWithResult(_0x3ab565,0xc9))[_0x488b('0x17')](handleError(_0x3ab565,null));}else{return _0x3ab565['status'](0x1f4)[_0x488b('0x25')]({'message':_0x488b('0x26')});}};exports[_0x488b('0x27')]=function(_0x28fc66,_0x3a4a0a){if(_0x28fc66[_0x488b('0x1c')]['id']){delete _0x28fc66[_0x488b('0x1c')]['id'];}var _0x463e5a={'online':_0x488b('0x28'),'stopped':_0x488b('0x29')};if(_0x463e5a[_0x488b('0x2a')](_0x28fc66[_0x488b('0x1c')]['status'])){return pm2[_0x463e5a[_0x28fc66[_0x488b('0x1c')]['status']]](_0x28fc66[_0x488b('0x1a')]['id'])['then'](respondWithResult(_0x3a4a0a,0xc8))[_0x488b('0x17')](handleError(_0x3a4a0a,null));}else{return _0x3a4a0a[_0x488b('0xd')](0x1f4)[_0x488b('0x25')]({'message':'Unknown\x20status'});}};exports[_0x488b('0x2b')]=function(_0x5c071b,_0xe1599){if(_0x5c071b[_0x488b('0x1c')]['id']){delete _0x5c071b[_0x488b('0x1c')]['id'];}if(_0x5c071b[_0x488b('0x1a')]['id']){return pm2[_0x488b('0x2c')](_0x5c071b[_0x488b('0x1a')]['id'])[_0x488b('0x12')](function(_0x5d5575){pm2[_0x488b('0x24')]();return _0x5d5575[0x0];})[_0x488b('0x12')](respondWithResult(_0xe1599,null))[_0x488b('0x17')](handleError(_0xe1599,null));}else{return _0xe1599[_0x488b('0xd')](0x1f4)[_0x488b('0x25')]({'message':_0x488b('0x2d')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 78ae047..ec0495b 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 _0x691a=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x511fad,_0x26cf29){var _0x4b61bd=function(_0x543692){while(--_0x543692){_0x511fad['push'](_0x511fad['shift']());}};_0x4b61bd(++_0x26cf29);}(_0x691a,0x1df));var _0xa691=function(_0x730dd1,_0x3ae068){_0x730dd1=_0x730dd1-0x0;var _0x250f65=_0x691a[_0x730dd1];return _0x250f65;};'use strict';var multer=require(_0xa691('0x0'));var util=require(_0xa691('0x1'));var path=require(_0xa691('0x2'));var timeout=require(_0xa691('0x3'));var express=require(_0xa691('0x4'));var router=express[_0xa691('0x5')]();var auth=require(_0xa691('0x6'));var interaction=require(_0xa691('0x7'));var config=require(_0xa691('0x8'));module[_0xa691('0x9')]=router; \ No newline at end of file +var _0x392f=['exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment'];(function(_0x29a1d5,_0x4d742d){var _0x315a27=function(_0x576b50){while(--_0x576b50){_0x29a1d5['push'](_0x29a1d5['shift']());}};_0x315a27(++_0x4d742d);}(_0x392f,0x1f2));var _0xf392=function(_0x13a9ce,_0x13f027){_0x13a9ce=_0x13a9ce-0x0;var _0x2f0c6d=_0x392f[_0x13a9ce];return _0x2f0c6d;};'use strict';var multer=require(_0xf392('0x0'));var util=require(_0xf392('0x1'));var path=require(_0xf392('0x2'));var timeout=require(_0xf392('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xf392('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf392('0x5'));module[_0xf392('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 1f80236..ea8d0a7 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 _0x8d1f=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x3b796f,_0xaa0502){var _0x6427e5=function(_0x4aac7e){while(--_0x4aac7e){_0x3b796f['push'](_0x3b796f['shift']());}};_0x6427e5(++_0xaa0502);}(_0x8d1f,0x91));var _0xf8d1=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8d1f[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xf8d1('0x0'));module[_0xf8d1('0x1')]={'state':{'type':Sequelize[_0xf8d1('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf8d1('0x3')]},'scheduledat':{'type':Sequelize[_0xf8d1('0x4')]},'uniqueid':{'type':Sequelize[_0xf8d1('0x3')]},'starttime':{'type':Sequelize[_0xf8d1('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xf8d1('0x3')]},'membername':{'type':Sequelize[_0xf8d1('0x3')]}}; \ No newline at end of file +var _0xb5a7=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x3e8901,_0x11341f){var _0xab4ba7=function(_0x19249f){while(--_0x19249f){_0x3e8901['push'](_0x3e8901['shift']());}};_0xab4ba7(++_0x11341f);}(_0xb5a7,0x15c));var _0x7b5a=function(_0x48850a,_0x5ebef3){_0x48850a=_0x48850a-0x0;var _0x382739=_0xb5a7[_0x48850a];return _0x382739;};'use strict';var Sequelize=require(_0x7b5a('0x0'));module[_0x7b5a('0x1')]={'state':{'type':Sequelize[_0x7b5a('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x7b5a('0x3')]},'scheduledat':{'type':Sequelize[_0x7b5a('0x4')]},'uniqueid':{'type':Sequelize[_0x7b5a('0x3')]},'starttime':{'type':Sequelize[_0x7b5a('0x4')]},'responsetime':{'type':Sequelize[_0x7b5a('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x7b5a('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x7b5a('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 225ce6e..a41c6b8 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 _0xf7bc=['bluebird','path','rimraf','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api'];(function(_0x315b6c,_0x2ac37f){var _0x94dc8=function(_0x24bb2e){while(--_0x24bb2e){_0x315b6c['push'](_0x315b6c['shift']());}};_0x94dc8(++_0x2ac37f);}(_0xf7bc,0x14c));var _0xcf7b=function(_0x484179,_0x1173b3){_0x484179=_0x484179-0x0;var _0x19a047=_0xf7bc[_0x484179];return _0x19a047;};'use strict';var _=require(_0xcf7b('0x0'));var util=require(_0xcf7b('0x1'));var logger=require(_0xcf7b('0x2'))(_0xcf7b('0x3'));var moment=require('moment');var BPromise=require(_0xcf7b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf7b('0x5'));var rimraf=require(_0xcf7b('0x6'));var config=require(_0xcf7b('0x7'));var attributes=require(_0xcf7b('0x8'));module['exports']=function(_0x5c160e,_0x16938d){return _0x5c160e[_0xcf7b('0x9')](_0xcf7b('0xa'),attributes,{'tableName':_0xcf7b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9262=['../../config/environment','./reportAgentPreview.attributes','exports','define','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x119499,_0x2c6648){var _0x43a7bd=function(_0x16efcf){while(--_0x16efcf){_0x119499['push'](_0x119499['shift']());}};_0x43a7bd(++_0x2c6648);}(_0x9262,0x139));var _0x2926=function(_0x12b0e7,_0xb22eb8){_0x12b0e7=_0x12b0e7-0x0;var _0x5591c9=_0x9262[_0x12b0e7];return _0x5591c9;};'use strict';var _=require(_0x2926('0x0'));var util=require(_0x2926('0x1'));var logger=require(_0x2926('0x2'))(_0x2926('0x3'));var moment=require(_0x2926('0x4'));var BPromise=require(_0x2926('0x5'));var rp=require(_0x2926('0x6'));var fs=require('fs');var path=require(_0x2926('0x7'));var rimraf=require(_0x2926('0x8'));var config=require(_0x2926('0x9'));var attributes=require(_0x2926('0xa'));module[_0x2926('0xb')]=function(_0x5e3841,_0x52f2f8){return _0x5e3841[_0x2926('0xc')]('ReportAgentPreview',attributes,{'tableName':_0x2926('0xd'),'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 f01bbeb..24a208a 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 _0xe84b=['result','catch','CreateReportAgentPreview','create','options','raw','then','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x469303,_0x31edd7){var _0x4f5ae0=function(_0x5d63be){while(--_0x5d63be){_0x469303['push'](_0x469303['shift']());}};_0x4f5ae0(++_0x31edd7);}(_0xe84b,0x1ab));var _0xbe84=function(_0x225be8,_0x38850b){_0x225be8=_0x225be8-0x0;var _0x4a33d2=_0xe84b[_0x225be8];return _0x4a33d2;};'use strict';var _=require(_0xbe84('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbe84('0x1'));var rs=require(_0xbe84('0x2'));var fs=require('fs');var Redis=require(_0xbe84('0x3'));var db=require(_0xbe84('0x4'))['db'];var utils=require(_0xbe84('0x5'));var logger=require(_0xbe84('0x6'))('rpc');var config=require(_0xbe84('0x7'));var jayson=require(_0xbe84('0x8'));var client=jayson[_0xbe84('0x9')][_0xbe84('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f6a27,_0x2d747b,_0x2775e3){return new BPromise(function(_0x1f9736,_0x54df33){return client[_0xbe84('0xb')](_0x2f6a27,_0x2775e3)['then'](function(_0x3ae5c9){logger['info'](_0xbe84('0xc'),_0x2d747b,_0xbe84('0xd'));logger[_0xbe84('0xe')](_0xbe84('0xf'),_0x2d747b,'request\x20sent',JSON[_0xbe84('0x10')](_0x3ae5c9));if(_0x3ae5c9['error']){if(_0x3ae5c9[_0xbe84('0x11')][_0xbe84('0x12')]===0x1f4){logger[_0xbe84('0x11')](_0xbe84('0xc'),_0x2d747b,_0x3ae5c9[_0xbe84('0x11')][_0xbe84('0x13')]);return _0x54df33(_0x3ae5c9['error']['message']);}logger[_0xbe84('0x11')](_0xbe84('0xc'),_0x2d747b,_0x3ae5c9['error']['message']);return _0x1f9736(_0x3ae5c9[_0xbe84('0x11')][_0xbe84('0x13')]);}else{logger[_0xbe84('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x2d747b,_0xbe84('0xd'));_0x1f9736(_0x3ae5c9[_0xbe84('0x15')][_0xbe84('0x13')]);}})[_0xbe84('0x16')](function(_0x3b03d4){logger['error'](_0xbe84('0xc'),_0x2d747b,_0x3b03d4);_0x54df33(_0x3b03d4);});});}exports[_0xbe84('0x17')]=function(_0xf93572){var _0x553460=this;return new Promise(function(_0x114142,_0x59634b){return db['ReportAgentPreview'][_0xbe84('0x18')](_0xf93572['body'],{'raw':_0xf93572[_0xbe84('0x19')]?_0xf93572['options'][_0xbe84('0x1a')]===undefined?!![]:![]:!![]})[_0xbe84('0x1b')](function(_0x1425cb){logger[_0xbe84('0x14')](_0xbe84('0x17'),_0xf93572);logger[_0xbe84('0xe')](_0xbe84('0x17'),_0xf93572,JSON[_0xbe84('0x10')](_0x1425cb));_0x114142(_0x1425cb);})['catch'](function(_0x1662da){logger[_0xbe84('0x11')](_0xbe84('0x17'),_0x1662da[_0xbe84('0x13')],_0xf93572);_0x59634b(_0x553460['error'](0x1f4,_0x1662da['message']));});});}; \ No newline at end of file +var _0xe3c9=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','stringify','error','code','message','ReportAgentPreview,\x20%s,\x20%s','result','ReportAgentPreview','options','raw','CreateReportAgentPreview','debug','util','bluebird','randomstring'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xe3c9,0x1ad));var _0x9e3c=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xe3c9[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var util=require(_0x9e3c('0x0'));var moment=require('moment');var BPromise=require(_0x9e3c('0x1'));var rs=require(_0x9e3c('0x2'));var fs=require('fs');var Redis=require(_0x9e3c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9e3c('0x4'));var logger=require(_0x9e3c('0x5'))(_0x9e3c('0x6'));var config=require(_0x9e3c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9e3c('0x8')][_0x9e3c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5347cb,_0x1437a0,_0x335e99){return new BPromise(function(_0x59a631,_0x3cc670){return client[_0x9e3c('0xa')](_0x5347cb,_0x335e99)['then'](function(_0x1bd026){logger[_0x9e3c('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x1437a0,_0x9e3c('0xc'));logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x1437a0,_0x9e3c('0xc'),JSON[_0x9e3c('0xd')](_0x1bd026));if(_0x1bd026['error']){if(_0x1bd026[_0x9e3c('0xe')][_0x9e3c('0xf')]===0x1f4){logger[_0x9e3c('0xe')]('ReportAgentPreview,\x20%s,\x20%s',_0x1437a0,_0x1bd026[_0x9e3c('0xe')][_0x9e3c('0x10')]);return _0x3cc670(_0x1bd026[_0x9e3c('0xe')][_0x9e3c('0x10')]);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x1437a0,_0x1bd026[_0x9e3c('0xe')][_0x9e3c('0x10')]);return _0x59a631(_0x1bd026[_0x9e3c('0xe')][_0x9e3c('0x10')]);}else{logger[_0x9e3c('0xb')](_0x9e3c('0x11'),_0x1437a0,'request\x20sent');_0x59a631(_0x1bd026[_0x9e3c('0x12')][_0x9e3c('0x10')]);}})['catch'](function(_0x55bcad){logger['error'](_0x9e3c('0x11'),_0x1437a0,_0x55bcad);_0x3cc670(_0x55bcad);});});}exports['CreateReportAgentPreview']=function(_0x2943fe){var _0x47da45=this;return new Promise(function(_0x3ac32b,_0x488a47){return db[_0x9e3c('0x13')]['create'](_0x2943fe['body'],{'raw':_0x2943fe[_0x9e3c('0x14')]?_0x2943fe[_0x9e3c('0x14')][_0x9e3c('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x433711){logger[_0x9e3c('0xb')](_0x9e3c('0x16'),_0x2943fe);logger[_0x9e3c('0x17')](_0x9e3c('0x16'),_0x2943fe,JSON[_0x9e3c('0xd')](_0x433711));_0x3ac32b(_0x433711);})['catch'](function(_0x2ad1b){logger[_0x9e3c('0xe')]('CreateReportAgentPreview',_0x2ad1b[_0x9e3c('0x10')],_0x2943fe);_0x488a47(_0x47da45[_0x9e3c('0xe')](0x1f4,_0x2ad1b[_0x9e3c('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index ca2915c..9a06abb 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 _0xaa92=['agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','/campaigns','campaigns','/fax/accounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','showSmsQueues','/agents/:id/notify','exports','multer','path','express','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/voice/queues/preview/:id','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','/outbound/channels','outboundChannels','/agents'];(function(_0xdd9150,_0x54bd43){var _0x1dfced=function(_0x147d6b){while(--_0x147d6b){_0xdd9150['push'](_0xdd9150['shift']());}};_0x1dfced(++_0x54bd43);}(_0xaa92,0x166));var _0x2aa9=function(_0x1cfe2e,_0x1ebbcd){_0x1cfe2e=_0x1cfe2e-0x0;var _0x39233f=_0xaa92[_0x1cfe2e];return _0x39233f;};'use strict';var multer=require(_0x2aa9('0x0'));var util=require('util');var path=require(_0x2aa9('0x1'));var express=require(_0x2aa9('0x2'));var router=express['Router']();var auth=require(_0x2aa9('0x3'));var controller=require(_0x2aa9('0x4'));router[_0x2aa9('0x5')](_0x2aa9('0x6'),auth[_0x2aa9('0x7')](),controller[_0x2aa9('0x8')]);router[_0x2aa9('0x5')](_0x2aa9('0x9'),auth['isAuthenticated'](),controller[_0x2aa9('0xa')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x2aa9('0x7')](),controller[_0x2aa9('0xb')]);router[_0x2aa9('0x5')]('/voice/queues',auth['isAuthenticated'](),controller[_0x2aa9('0xc')]);router[_0x2aa9('0x5')](_0x2aa9('0xd'),auth['isAuthenticated'](),controller['chatQueues']);router[_0x2aa9('0x5')](_0x2aa9('0xe'),auth[_0x2aa9('0x7')](),controller[_0x2aa9('0xf')]);router[_0x2aa9('0x5')]('/mail/accounts',auth[_0x2aa9('0x7')](),controller[_0x2aa9('0x10')]);router[_0x2aa9('0x5')](_0x2aa9('0x11'),auth[_0x2aa9('0x7')](),controller[_0x2aa9('0x12')]);router[_0x2aa9('0x5')]('/sms/queues',auth[_0x2aa9('0x7')](),controller['smsQueues']);router[_0x2aa9('0x5')]('/fax/queues',auth[_0x2aa9('0x7')](),controller['faxQueues']);router[_0x2aa9('0x5')](_0x2aa9('0x13'),auth[_0x2aa9('0x7')](),controller['voiceQueuesPreview']);router['get']('/voice/queues/channels',auth['isAuthenticated'](),controller[_0x2aa9('0x14')]);router['get']('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x2aa9('0x15')]);router[_0x2aa9('0x5')](_0x2aa9('0x16'),auth['isAuthenticated'](),controller[_0x2aa9('0x17')]);router[_0x2aa9('0x5')](_0x2aa9('0x18'),auth[_0x2aa9('0x7')](),controller[_0x2aa9('0x19')]);router[_0x2aa9('0x5')](_0x2aa9('0x1a'),auth['isAuthenticated'](),controller[_0x2aa9('0x1b')]);router['get'](_0x2aa9('0x1c'),auth[_0x2aa9('0x7')](),controller['outbound']);router[_0x2aa9('0x5')](_0x2aa9('0x1d'),auth[_0x2aa9('0x7')](),controller[_0x2aa9('0x1e')]);router['get'](_0x2aa9('0x1f'),auth[_0x2aa9('0x7')](),controller[_0x2aa9('0x20')]);router[_0x2aa9('0x21')](_0x2aa9('0x22'),auth[_0x2aa9('0x7')](),controller[_0x2aa9('0x23')]);router[_0x2aa9('0x5')](_0x2aa9('0x24'),auth['isAuthenticated'](),controller[_0x2aa9('0x25')]);router[_0x2aa9('0x5')]('/trunks',auth[_0x2aa9('0x7')](),controller[_0x2aa9('0x26')]);router['get'](_0x2aa9('0x27'),auth[_0x2aa9('0x7')](),controller[_0x2aa9('0x28')]);router[_0x2aa9('0x5')](_0x2aa9('0x29'),auth[_0x2aa9('0x7')](),controller['faxAccounts']);router[_0x2aa9('0x5')]('/chat/queues/waitinginteractions',auth[_0x2aa9('0x7')](),controller[_0x2aa9('0x2a')]);router[_0x2aa9('0x5')](_0x2aa9('0x2b'),auth[_0x2aa9('0x7')](),controller[_0x2aa9('0x2c')]);router[_0x2aa9('0x5')]('/openchannel/queues/waitinginteractions',auth[_0x2aa9('0x7')](),controller[_0x2aa9('0x2d')]);router['get'](_0x2aa9('0x2e'),auth[_0x2aa9('0x7')](),controller[_0x2aa9('0x2f')]);router[_0x2aa9('0x5')](_0x2aa9('0x30'),auth[_0x2aa9('0x7')](),controller['faxQueuesWaitingInteractions']);router[_0x2aa9('0x31')](_0x2aa9('0x32'),auth[_0x2aa9('0x7')](),controller[_0x2aa9('0x33')](_0x2aa9('0x34')));router['get']('/mail/queues/:id',auth['isAuthenticated'](),controller['showMailQueues']);router[_0x2aa9('0x31')]('/chat/queues/:id/notify',auth[_0x2aa9('0x7')](),controller[_0x2aa9('0x33')]('chat'));router[_0x2aa9('0x5')](_0x2aa9('0x35'),auth[_0x2aa9('0x7')](),controller[_0x2aa9('0x36')]);router[_0x2aa9('0x31')](_0x2aa9('0x37'),auth['isAuthenticated'](),controller[_0x2aa9('0x33')]('fax'));router['get'](_0x2aa9('0x38'),auth[_0x2aa9('0x7')](),controller[_0x2aa9('0x39')]);router[_0x2aa9('0x31')](_0x2aa9('0x3a'),auth[_0x2aa9('0x7')](),controller['queueNotify'](_0x2aa9('0x3b')));router[_0x2aa9('0x5')](_0x2aa9('0x3c'),auth[_0x2aa9('0x7')](),controller['showOpenchannelQueues']);router[_0x2aa9('0x31')](_0x2aa9('0x3d'),auth['isAuthenticated'](),controller[_0x2aa9('0x33')]('sms'));router[_0x2aa9('0x5')]('/sms/queues/:id',auth[_0x2aa9('0x7')](),controller[_0x2aa9('0x3e')]);router['post'](_0x2aa9('0x3f'),auth[_0x2aa9('0x7')](),controller['agentNotify']);module[_0x2aa9('0x40')]=router; \ No newline at end of file +var _0x7fda=['mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/sms/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','express','Router','../../components/auth/service','./rpc.controller','/voice/channels','voiceChannels','get','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','/telephones','telephones','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0x7fda,0xf4));var _0xa7fd=function(_0x165797,_0x5f4375){_0x165797=_0x165797-0x0;var _0x5ccad0=_0x7fda[_0x165797];return _0x5ccad0;};'use strict';var multer=require(_0xa7fd('0x0'));var util=require(_0xa7fd('0x1'));var path=require('path');var express=require(_0xa7fd('0x2'));var router=express[_0xa7fd('0x3')]();var auth=require(_0xa7fd('0x4'));var controller=require(_0xa7fd('0x5'));router['get'](_0xa7fd('0x6'),auth['isAuthenticated'](),controller[_0xa7fd('0x7')]);router[_0xa7fd('0x8')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xa7fd('0x9')](),controller[_0xa7fd('0xa')]);router[_0xa7fd('0x8')](_0xa7fd('0xb'),auth[_0xa7fd('0x9')](),controller[_0xa7fd('0xc')]);router[_0xa7fd('0x8')](_0xa7fd('0xd'),auth['isAuthenticated'](),controller[_0xa7fd('0xe')]);router[_0xa7fd('0x8')](_0xa7fd('0xf'),auth['isAuthenticated'](),controller[_0xa7fd('0x10')]);router[_0xa7fd('0x8')](_0xa7fd('0x11'),auth[_0xa7fd('0x9')](),controller[_0xa7fd('0x12')]);router['get'](_0xa7fd('0x13'),auth[_0xa7fd('0x9')](),controller[_0xa7fd('0x14')]);router[_0xa7fd('0x8')](_0xa7fd('0x15'),auth[_0xa7fd('0x9')](),controller['openchannelQueues']);router['get'](_0xa7fd('0x16'),auth[_0xa7fd('0x9')](),controller['smsQueues']);router[_0xa7fd('0x8')](_0xa7fd('0x17'),auth[_0xa7fd('0x9')](),controller['faxQueues']);router[_0xa7fd('0x8')](_0xa7fd('0x18'),auth['isAuthenticated'](),controller[_0xa7fd('0x19')]);router[_0xa7fd('0x8')](_0xa7fd('0x1a'),auth[_0xa7fd('0x9')](),controller[_0xa7fd('0x1b')]);router[_0xa7fd('0x8')]('/voice/queues/channels/:uniqueid',auth[_0xa7fd('0x9')](),controller[_0xa7fd('0x1c')]);router['get'](_0xa7fd('0x1d'),auth[_0xa7fd('0x9')](),controller[_0xa7fd('0x1e')]);router['get'](_0xa7fd('0x1f'),auth['isAuthenticated'](),controller[_0xa7fd('0x20')]);router[_0xa7fd('0x8')](_0xa7fd('0x21'),auth[_0xa7fd('0x9')](),controller[_0xa7fd('0x22')]);router[_0xa7fd('0x8')](_0xa7fd('0x23'),auth['isAuthenticated'](),controller['outbound']);router[_0xa7fd('0x8')](_0xa7fd('0x24'),auth[_0xa7fd('0x9')](),controller[_0xa7fd('0x25')]);router[_0xa7fd('0x8')](_0xa7fd('0x26'),auth[_0xa7fd('0x9')](),controller['agents']);router['put'](_0xa7fd('0x27'),auth['isAuthenticated'](),controller['agentCapacity']);router[_0xa7fd('0x8')](_0xa7fd('0x28'),auth['isAuthenticated'](),controller[_0xa7fd('0x29')]);router['get']('/trunks',auth[_0xa7fd('0x9')](),controller[_0xa7fd('0x2a')]);router[_0xa7fd('0x8')](_0xa7fd('0x2b'),auth[_0xa7fd('0x9')](),controller[_0xa7fd('0x2c')]);router[_0xa7fd('0x8')](_0xa7fd('0x2d'),auth[_0xa7fd('0x9')](),controller['faxAccounts']);router[_0xa7fd('0x8')](_0xa7fd('0x2e'),auth[_0xa7fd('0x9')](),controller['chatQueuesWaitingInteractions']);router[_0xa7fd('0x8')](_0xa7fd('0x2f'),auth['isAuthenticated'](),controller[_0xa7fd('0x30')]);router['get'](_0xa7fd('0x31'),auth['isAuthenticated'](),controller[_0xa7fd('0x32')]);router[_0xa7fd('0x8')](_0xa7fd('0x33'),auth[_0xa7fd('0x9')](),controller[_0xa7fd('0x34')]);router['get'](_0xa7fd('0x35'),auth[_0xa7fd('0x9')](),controller[_0xa7fd('0x36')]);router[_0xa7fd('0x37')](_0xa7fd('0x38'),auth[_0xa7fd('0x9')](),controller[_0xa7fd('0x39')]('mail'));router[_0xa7fd('0x8')](_0xa7fd('0x3a'),auth[_0xa7fd('0x9')](),controller[_0xa7fd('0x3b')]);router[_0xa7fd('0x37')](_0xa7fd('0x3c'),auth[_0xa7fd('0x9')](),controller[_0xa7fd('0x39')](_0xa7fd('0x3d')));router[_0xa7fd('0x8')]('/chat/queues/:id',auth[_0xa7fd('0x9')](),controller[_0xa7fd('0x3e')]);router[_0xa7fd('0x37')]('/fax/queues/:id/notify',auth[_0xa7fd('0x9')](),controller[_0xa7fd('0x39')](_0xa7fd('0x3f')));router['get'](_0xa7fd('0x40'),auth[_0xa7fd('0x9')](),controller[_0xa7fd('0x41')]);router[_0xa7fd('0x37')]('/openchannel/queues/:id/notify',auth[_0xa7fd('0x9')](),controller['queueNotify']('openchannel'));router[_0xa7fd('0x8')](_0xa7fd('0x42'),auth[_0xa7fd('0x9')](),controller[_0xa7fd('0x43')]);router[_0xa7fd('0x37')](_0xa7fd('0x44'),auth[_0xa7fd('0x9')](),controller[_0xa7fd('0x39')]('sms'));router[_0xa7fd('0x8')](_0xa7fd('0x45'),auth['isAuthenticated'](),controller['showSmsQueues']);router[_0xa7fd('0x37')](_0xa7fd('0x46'),auth[_0xa7fd('0x9')](),controller[_0xa7fd('0x47')]);module[_0xa7fd('0x48')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 0238ec3..f23ec50 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 _0x267d=['faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','update','queue','From','QueueId','create','Start','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','User','Agent\x20not\x20found','messageId','MessageId','TransferReport','agentTransferTimeout','bluebird','moment','util','../../mysqldb','api','client','http','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','VoiceChannels','query','voiceChannelMixMonitor','merge','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannelHangup','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','body','interaction','user','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','length','MemberReport','findOrCreate','INTERACTION','SIP/%s','internal','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions'];(function(_0x9910f3,_0x188ee2){var _0x1566a7=function(_0x56d625){while(--_0x56d625){_0x9910f3['push'](_0x9910f3['shift']());}};_0x1566a7(++_0x188ee2);}(_0x267d,0x1e5));var _0xd267=function(_0x41dd76,_0x45bdab){_0x41dd76=_0x41dd76-0x0;var _0x598e32=_0x267d[_0x41dd76];return _0x598e32;};'use strict';var BPromise=require(_0xd267('0x0'));var moment=require(_0xd267('0x1'));var _=require('lodash');var util=require(_0xd267('0x2'));var db=require(_0xd267('0x3'))['db'];var logger=require('../../config/logger')(_0xd267('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0xd267('0x5')]['http']({'port':0x232a});var mailClient=jayson['client'][_0xd267('0x6')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x5244d1,_0x32a5ab,_0x4c53db){return new BPromise(function(_0x230c90,_0x41f332){var _0x56e76a=_0x4c53db?_0x4c53db:amiClient;return _0x56e76a['request'](_0x5244d1,_0x32a5ab)[_0xd267('0x7')](function(_0x35c0e3){if(_0x35c0e3['error']){if(_0x35c0e3[_0xd267('0x8')][_0xd267('0x9')]===0x1f4){return _0x41f332(_0x35c0e3['error']['message']);}return _0x230c90(_0x35c0e3[_0xd267('0x8')][_0xd267('0xa')]);}else{_0x230c90(_0x35c0e3[_0xd267('0xb')]);}})[_0xd267('0xc')](function(_0xfe13fb){_0x41f332(_0xfe13fb);});});}function respondWithResult(_0x3f274c,_0x5ce3ac){_0x5ce3ac=_0x5ce3ac||0xc8;return function(_0x4d3359){if(_0x4d3359){return _0x3f274c[_0xd267('0xd')](_0x5ce3ac)[_0xd267('0xe')](_0x4d3359);}return _0x3f274c[_0xd267('0xf')](0x194);};}function handleError(_0x9a5d66,_0xb75c4d){_0xb75c4d=_0xb75c4d||0x1f4;return function(_0x5352c){logger[_0xd267('0x8')](_0x5352c[_0xd267('0x10')]);if(_0x5352c[_0xd267('0x11')]){delete _0x5352c[_0xd267('0x11')];}_0x9a5d66[_0xd267('0xd')](_0xb75c4d)[_0xd267('0x12')](_0x5352c);};}function findById(_0x52acf7){return function(_0x1d1dce){if(!_[_0xd267('0x13')](_0x52acf7)&&!_['isNil'](_0x1d1dce)&&!_[_0xd267('0x13')](_0x1d1dce[_0xd267('0x14')])){return _[_0xd267('0x15')](_0x1d1dce[_0xd267('0x14')],function(_0x34eba6){return _0x34eba6['id']==_0x52acf7;});}return null;};}exports['voiceChannels']=function(_0x4c098b,_0x25ca0a){return respondWithRpcPromise(_0xd267('0x16'),_0x4c098b[_0xd267('0x17')])[_0xd267('0x7')](respondWithResult(_0x25ca0a,null))['catch'](handleError(_0x25ca0a,null));};exports[_0xd267('0x18')]=function(_0x25db57,_0x1bd3f6){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xd267('0x19')](_0x25db57[_0xd267('0x17')],_0x25db57['params']))[_0xd267('0x7')](respondWithResult(_0x1bd3f6,null))['catch'](handleError(_0x1bd3f6,null));};exports['voiceChannelStopMixMonitor']=function(_0x38e40c,_0x15db5e){return respondWithRpcPromise(_0xd267('0x1a'),_[_0xd267('0x19')](_0x38e40c[_0xd267('0x17')],_0x38e40c[_0xd267('0x1b')]))['then'](respondWithResult(_0x15db5e,null))['catch'](handleError(_0x15db5e,null));};exports[_0xd267('0x1c')]=function(_0x71fdd4,_0x2b526e){return respondWithRpcPromise(_0xd267('0x1d'),_0x71fdd4[_0xd267('0x17')])[_0xd267('0x7')](respondWithResult(_0x2b526e,null))[_0xd267('0xc')](handleError(_0x2b526e,null));};exports[_0xd267('0x1e')]=function(_0x46d200,_0x1e26ca){return respondWithRpcPromise(_0xd267('0x1d'),_0x46d200['query'])[_0xd267('0x7')](findById(_0x46d200[_0xd267('0x1b')]['id']))[_0xd267('0x7')](respondWithResult(_0x1e26ca,null))[_0xd267('0xc')](handleError(_0x1e26ca,null));};exports[_0xd267('0x1f')]=function(_0x251299,_0xffdaa0){return respondWithRpcPromise(_0xd267('0x20'),_[_0xd267('0x19')](_0x251299['query'],_0x251299['params']))[_0xd267('0x7')](respondWithResult(_0xffdaa0,null))[_0xd267('0xc')](handleError(_0xffdaa0,null));};exports[_0xd267('0x21')]=function(_0xe4817a,_0x3b5169){return respondWithRpcPromise(_0xd267('0x22'),_0xe4817a[_0xd267('0x17')])[_0xd267('0x7')](respondWithResult(_0x3b5169,null))[_0xd267('0xc')](handleError(_0x3b5169,null));};exports[_0xd267('0x23')]=function(_0x6e3991,_0x5707d0){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x6e3991['query'],_0x6e3991[_0xd267('0x1b')]))[_0xd267('0x7')](respondWithResult(_0x5707d0,null))[_0xd267('0xc')](handleError(_0x5707d0,null));};exports['voiceQueuesChannelHangup']=function(_0x173e39,_0x4a6897){return respondWithRpcPromise(_0xd267('0x24'),_[_0xd267('0x19')](_0x173e39[_0xd267('0x17')],_0x173e39[_0xd267('0x1b')]))[_0xd267('0x7')](respondWithResult(_0x4a6897,null))['catch'](handleError(_0x4a6897,null));};exports['voiceQueuesChannelRedirect']=function(_0x2af2fc,_0x19faeb){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_['merge'](_0x2af2fc[_0xd267('0x17')],_0x2af2fc['params']))[_0xd267('0x7')](respondWithResult(_0x19faeb,null))[_0xd267('0xc')](handleError(_0x19faeb,null));};exports[_0xd267('0x25')]=function(_0x320256,_0x113d06){return respondWithRpcPromise(_0xd267('0x26'),_0x320256[_0xd267('0x17')])[_0xd267('0x7')](respondWithResult(_0x113d06,null))['catch'](handleError(_0x113d06,null));};exports[_0xd267('0x27')]=function(_0x2ee040,_0x317031){return respondWithRpcPromise(_0xd267('0x28'),_0x2ee040[_0xd267('0x17')])[_0xd267('0x7')](respondWithResult(_0x317031,null))[_0xd267('0xc')](handleError(_0x317031,null));};exports[_0xd267('0x29')]=function(_0x2ff23c,_0x5e751f){var _0x28b8ab;return respondWithRpcPromise(_0xd267('0x2a'),_0x2ff23c[_0xd267('0x17')])[_0xd267('0x7')](function(_0x248885){_0x28b8ab=_0x248885;return respondWithRpcPromise(_0xd267('0x2a'),_0x2ff23c[_0xd267('0x17')],routingClient);})[_0xd267('0x7')](function(_0x5c9f86){return _[_0xd267('0x19')]({},_0x5c9f86,_0x28b8ab);})['then'](respondWithResult(_0x5e751f,null))[_0xd267('0xc')](handleError(_0x5e751f,null));};exports['agentCapacity']=function(_0x4707ed,_0x20531d){if(_0x4707ed[_0xd267('0x2b')]&&_0x4707ed['body'][_0xd267('0x2c')]&&_0x4707ed[_0xd267('0x2d')]&&_0x4707ed['user'][_0xd267('0x11')]){for(var _0x53fb03 in _0x4707ed[_0xd267('0x2b')][_0xd267('0x2c')]){if(_0x4707ed[_0xd267('0x2b')][_0xd267('0x2c')][_0xd267('0x2e')](_0x53fb03)){db['MemberReport']['findAll']({'where':{'channel':_0x53fb03,'membername':_0x4707ed[_0xd267('0x2d')][_0xd267('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x4707ed[_0xd267('0x2b')]['interaction'][_0x53fb03]&&_0x4707ed[_0xd267('0x2b')][_0xd267('0x2c')][_0x53fb03]['length']?{'$notIn':_0x4707ed[_0xd267('0x2b')][_0xd267('0x2c')][_0x53fb03]}:{'$ne':null}}})[_0xd267('0x7')](function(_0x4ac197){var _0x5b0c39=moment()[_0xd267('0x2f')](_0xd267('0x30'));for(var _0x4a5805=0x0,_0x221c51=_0x4ac197['length'];_0x4a5805<_0x221c51;_0x4a5805+=0x1){_0x4ac197[_0x4a5805][_0xd267('0x31')]({'exitAt':_0x5b0c39});}});for(var _0x3a4aee=0x0;_0x3a4aee<_0x4707ed['body'][_0xd267('0x2c')][_0x53fb03][_0xd267('0x32')];_0x3a4aee+=0x1){db[_0xd267('0x33')][_0xd267('0x34')]({'where':{'channel':_0x53fb03,'membername':_0x4707ed[_0xd267('0x2d')]['name'],'type':_0xd267('0x35'),'uniqueid':_0x4707ed[_0xd267('0x2b')][_0xd267('0x2c')][_0x53fb03][_0x3a4aee],'exitAt':null},'defaults':{'channel':_0x53fb03,'membername':_0x4707ed[_0xd267('0x2d')][_0xd267('0x11')],'interface':_[_0xd267('0x13')](_0x4707ed[_0xd267('0x2d')]['interface'])?util['format'](_0xd267('0x36'),_0x4707ed[_0xd267('0x2d')][_0xd267('0x11')]):_0x4707ed[_0xd267('0x2d')]['interface'],'type':_0xd267('0x35'),'enterAt':moment()[_0xd267('0x2f')](_0xd267('0x30')),'role':'agent','internal':_0x4707ed[_0xd267('0x2d')][_0xd267('0x37')],'uniqueid':_0x4707ed[_0xd267('0x2b')][_0xd267('0x2c')][_0x53fb03][_0x3a4aee]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x4707ed[_0xd267('0x1b')]['id'],'capacity':_0x4707ed['body'][_0xd267('0x38')]},routingClient)[_0xd267('0x7')](respondWithResult(_0x20531d,null))['catch'](handleError(_0x20531d,null));};exports[_0xd267('0x39')]=function(_0x2a8987,_0x4980d5){return respondWithRpcPromise(_0xd267('0x3a'),_0x2a8987[_0xd267('0x17')])[_0xd267('0x7')](respondWithResult(_0x4980d5,null))[_0xd267('0xc')](handleError(_0x4980d5,null));};exports[_0xd267('0x3b')]=function(_0x4fa514,_0xce829){return respondWithRpcPromise(_0xd267('0x3c'),_0x4fa514[_0xd267('0x17')])[_0xd267('0x7')](respondWithResult(_0xce829,null))['catch'](handleError(_0xce829,null));};exports[_0xd267('0x3d')]=function(_0x114294,_0x163cdf){return respondWithRpcPromise(_0xd267('0x3e'),_0x114294[_0xd267('0x17')])[_0xd267('0x7')](respondWithResult(_0x163cdf,null))[_0xd267('0xc')](handleError(_0x163cdf,null));};exports[_0xd267('0x3f')]=function(_0x43f46b,_0x5e9bff){return respondWithRpcPromise(_0xd267('0x40'),_0x43f46b[_0xd267('0x17')],routingClient)[_0xd267('0x7')](respondWithResult(_0x5e9bff,null))[_0xd267('0xc')](handleError(_0x5e9bff,null));};exports['showChatQueues']=function(_0x4db689,_0x29547e){return respondWithRpcPromise(_0xd267('0x40'),_0x4db689['query'],routingClient)[_0xd267('0x7')](findById(_0x4db689['params']['id']))['then'](respondWithResult(_0x29547e,null))['catch'](handleError(_0x29547e,null));};exports[_0xd267('0x41')]=function(_0x47c681,_0x2388c5){return respondWithRpcPromise(_0xd267('0x42'),_0x47c681['query'],routingClient)['then'](respondWithResult(_0x2388c5,null))[_0xd267('0xc')](handleError(_0x2388c5,null));};exports[_0xd267('0x43')]=function(_0x1b578b,_0x1079f1){return respondWithRpcPromise(_0xd267('0x42'),_0x1b578b[_0xd267('0x17')],routingClient)[_0xd267('0x7')](findById(_0x1b578b['params']['id']))['then'](respondWithResult(_0x1079f1,null))[_0xd267('0xc')](handleError(_0x1079f1,null));};exports[_0xd267('0x44')]=function(_0x180c0c,_0x419150){return respondWithRpcPromise(_0xd267('0x45'),_0x180c0c[_0xd267('0x17')],mailClient)[_0xd267('0x7')](respondWithResult(_0x419150,null))['catch'](handleError(_0x419150,null));};exports[_0xd267('0x46')]=function(_0x3c55a5,_0x3ccf9e){return respondWithRpcPromise('OpenchannelQueues',_0x3c55a5[_0xd267('0x17')],routingClient)[_0xd267('0x7')](respondWithResult(_0x3ccf9e,null))[_0xd267('0xc')](handleError(_0x3ccf9e,null));};exports[_0xd267('0x47')]=function(_0x136623,_0x59b609){return respondWithRpcPromise('OpenchannelQueues',_0x136623['query'],routingClient)[_0xd267('0x7')](findById(_0x136623[_0xd267('0x1b')]['id']))[_0xd267('0x7')](respondWithResult(_0x59b609,null))[_0xd267('0xc')](handleError(_0x59b609,null));};exports['smsQueues']=function(_0x578d58,_0x497c02){return respondWithRpcPromise(_0xd267('0x48'),_0x578d58['query'],routingClient)[_0xd267('0x7')](respondWithResult(_0x497c02,null))[_0xd267('0xc')](handleError(_0x497c02,null));};exports[_0xd267('0x49')]=function(_0x50deba,_0x108a9e){return respondWithRpcPromise(_0xd267('0x48'),_0x50deba[_0xd267('0x17')],routingClient)['then'](findById(_0x50deba[_0xd267('0x1b')]['id']))[_0xd267('0x7')](respondWithResult(_0x108a9e,null))[_0xd267('0xc')](handleError(_0x108a9e,null));};exports[_0xd267('0x4a')]=function(_0xa9a239,_0x132a8f){return respondWithRpcPromise(_0xd267('0x4b'),_0xa9a239[_0xd267('0x17')],routingClient)['then'](respondWithResult(_0x132a8f,null))[_0xd267('0xc')](handleError(_0x132a8f,null));};exports['showFaxQueues']=function(_0x2079ed,_0x15c45c){return respondWithRpcPromise(_0xd267('0x4b'),_0x2079ed['query'],routingClient)['then'](findById(_0x2079ed[_0xd267('0x1b')]['id']))[_0xd267('0x7')](respondWithResult(_0x15c45c,null))[_0xd267('0xc')](handleError(_0x15c45c,null));};exports[_0xd267('0x4c')]=function(_0x1f8b83,_0x108648){return respondWithRpcPromise(_0xd267('0x4d'),_0x1f8b83[_0xd267('0x17')])[_0xd267('0x7')](respondWithResult(_0x108648,null))[_0xd267('0xc')](handleError(_0x108648,null));};exports['chatQueuesWaitingInteractions']=function(_0x315ba6,_0xbfba29){return respondWithRpcPromise(_0xd267('0x4e'),_0x315ba6['query'],routingClient)[_0xd267('0x7')](respondWithResult(_0xbfba29,null))[_0xd267('0xc')](handleError(_0xbfba29,null));};exports[_0xd267('0x4f')]=function(_0x3283c0,_0x1987d2){return respondWithRpcPromise(_0xd267('0x50'),_0x3283c0[_0xd267('0x17')],routingClient)[_0xd267('0x7')](respondWithResult(_0x1987d2,null))[_0xd267('0xc')](handleError(_0x1987d2,null));};exports[_0xd267('0x51')]=function(_0x3c15d2,_0x565348){return respondWithRpcPromise(_0xd267('0x52'),_0x3c15d2['query'],routingClient)[_0xd267('0x7')](respondWithResult(_0x565348,null))['catch'](handleError(_0x565348,null));};exports[_0xd267('0x53')]=function(_0x2d3e3b,_0x56b4de){return respondWithRpcPromise(_0xd267('0x54'),_0x2d3e3b['query'],routingClient)['then'](respondWithResult(_0x56b4de,null))[_0xd267('0xc')](handleError(_0x56b4de,null));};exports[_0xd267('0x55')]=function(_0x1050f8,_0xf6068e){return respondWithRpcPromise(_0xd267('0x56'),_0x1050f8[_0xd267('0x17')],routingClient)[_0xd267('0x7')](respondWithResult(_0xf6068e,null))[_0xd267('0xc')](handleError(_0xf6068e,null));};exports[_0xd267('0x57')]=function(_0x1a5f9f){return function(_0x16704b,_0x4b8c01){var _0x158192,_0xb8b8dd;var _0x585e39=_['capitalize'](_0x1a5f9f);var _0x82c597=_0x1a5f9f===_0xd267('0x58')?_0xd267('0x59'):_0xd267('0x5a');return db[_0x585e39+_0xd267('0x5b')][_0xd267('0x5c')]({'raw':!![],'where':{'id':_0x16704b['params']['id']}})[_0xd267('0x7')](function(_0x56dc4b){if(_[_0xd267('0x13')](_0x56dc4b)){throw new Error(_0x585e39+_0xd267('0x5d'));}_0x158192=_0x56dc4b;return db[_0x585e39+_0xd267('0x5e')][_0xd267('0x5c')]({'where':{'id':_0x16704b['body']['messageId']},'include':[{'model':db[_0x585e39+_0xd267('0x5f')],'as':_0xd267('0x5f')},{'model':db[_0x585e39+_0x82c597],'as':_0xd267('0x5a')}]});})[_0xd267('0x7')](function(_0x1eab61){if(_[_0xd267('0x13')](_0x1eab61)){throw new Error(_0x585e39+_0xd267('0x60'));}_0xb8b8dd=_0x1eab61;return _0x1eab61[_0xd267('0x61')]({'read':0x0,'readAt':null,'UserId':null});})[_0xd267('0x7')](function(){var _0x2a826b={'uniqueid':_0x1a5f9f+'.'+_0xb8b8dd['id']+'.'+_0xb8b8dd[_0xd267('0x5f')]['id'],'FromUserId':_0x16704b[_0xd267('0x2d')]['id'],'type':_0xd267('0x62')};_0x2a826b[_0x585e39+'MessageId']=_0xb8b8dd['id'];_0x2a826b[_0x585e39+'InteractionId']=_0xb8b8dd[_0xd267('0x5f')]['id'];_0x2a826b[_0xd267('0x63')+_0x585e39+_0x82c597+'Id']=_0xb8b8dd[_0xd267('0x5a')]['id'];_0x2a826b['To'+_0x585e39+_0xd267('0x64')]=_0x158192['id'];return db[_0x585e39+'TransferReport'][_0xd267('0x65')](_0x2a826b);})[_0xd267('0x7')](function(){return respondWithRpcPromise(_0xd267('0x66'),{'channel':_0x1a5f9f,'interaction':_0xb8b8dd[_0xd267('0x5f')],'message':_0xb8b8dd,'account':_0xb8b8dd[_0xd267('0x5a')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd267('0x62'),'appdata':_0x158192[_0xd267('0x11')]+','+(_0xb8b8dd['Account']['queueTransferTimeout']||0x12c),'interval':_0xd267('0x67')}]},routingClient);})[_0xd267('0x7')](respondWithResult(_0x4b8c01,null))['catch'](handleError(_0x4b8c01,null));};};exports[_0xd267('0x68')]=function(_0x29c354,_0x41f4b7){var _0x3148e5,_0x861588;if(_[_0xd267('0x13')](_0x29c354[_0xd267('0x2b')][_0xd267('0x69')])){throw new Error(_0xd267('0x6a'));}var _0x215df9=_0x29c354['body']['channel'];var _0x5be40b=_[_0xd267('0x6b')](_0x215df9);var _0x1f2a08=_0x215df9===_0xd267('0x58')?_0xd267('0x59'):_0xd267('0x5a');return db[_0xd267('0x6c')][_0xd267('0x5c')]({'raw':!![],'where':{'id':_0x29c354[_0xd267('0x1b')]['id'],'role':'agent'}})[_0xd267('0x7')](function(_0x92ea28){if(_['isNil'](_0x92ea28)){throw new Error(_0xd267('0x6d'));}_0x3148e5=_0x92ea28;return db[_0x5be40b+_0xd267('0x5e')][_0xd267('0x5c')]({'where':{'id':_0x29c354[_0xd267('0x2b')][_0xd267('0x6e')]},'include':[{'model':db[_0x5be40b+_0xd267('0x5f')],'as':'Interaction'},{'model':db[_0x5be40b+_0x1f2a08],'as':_0xd267('0x5a')}]});})['then'](function(_0x1cc2b8){if(_[_0xd267('0x13')](_0x1cc2b8)){throw new Error(_0x5be40b+_0xd267('0x60'));}_0x861588=_0x1cc2b8;return _0x1cc2b8['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xd267('0x7')](function(){var _0x58fd0e={'uniqueid':_0x215df9+'.'+_0x861588['id']+'.'+_0x861588[_0xd267('0x5f')]['id'],'FromUserId':_0x29c354['user']['id'],'type':_0xd267('0x62'),'ToUserId':_0x3148e5['id']};_0x58fd0e[_0x5be40b+_0xd267('0x6f')]=_0x861588['id'];_0x58fd0e[_0x5be40b+'InteractionId']=_0x861588[_0xd267('0x5f')]['id'];_0x58fd0e[_0xd267('0x63')+_0x5be40b+_0x1f2a08+'Id']=_0x861588['Account']['id'];return db[_0x5be40b+_0xd267('0x70')][_0xd267('0x65')](_0x58fd0e);})[_0xd267('0x7')](function(){return respondWithRpcPromise(_0xd267('0x66'),{'channel':_0x215df9,'interaction':_0x861588[_0xd267('0x5f')],'message':_0x861588,'account':_0x861588[_0xd267('0x5a')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3148e5[_0xd267('0x11')]+','+(_0x861588[_0xd267('0x5a')][_0xd267('0x71')]||0x12c),'interval':_0xd267('0x67')}]},routingClient);})[_0xd267('0x7')](respondWithResult(_0x41f4b7,null))[_0xd267('0xc')](handleError(_0x41f4b7,null));}; \ No newline at end of file +var _0x7984=['interface','format','YYYY-MM-DD\x20HH:mm:ss','agent','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','showChatQueues','mailQueues','showMailQueues','mailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','SmsQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Account','Queue','isNil','Message','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','QueueId','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','Agent\x20not\x20found','MessageId','TransferReport','Start','bluebird','moment','lodash','util','../../mysqldb','api','jayson/promise','client','http','request','error','code','result','status','json','sendStatus','stack','name','send','find','rows','query','then','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','OutboundChannels','agents','Agents','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','updateAttributes','findOrCreate'];(function(_0x19a484,_0x22ec98){var _0x1a11de=function(_0x43de16){while(--_0x43de16){_0x19a484['push'](_0x19a484['shift']());}};_0x1a11de(++_0x22ec98);}(_0x7984,0x188));var _0x4798=function(_0x47569c,_0x1a156c){_0x47569c=_0x47569c-0x0;var _0x593f8c=_0x7984[_0x47569c];return _0x593f8c;};'use strict';var BPromise=require(_0x4798('0x0'));var moment=require(_0x4798('0x1'));var _=require(_0x4798('0x2'));var util=require(_0x4798('0x3'));var db=require(_0x4798('0x4'))['db'];var logger=require('../../config/logger')(_0x4798('0x5'));var jayson=require(_0x4798('0x6'));var amiClient=jayson[_0x4798('0x7')][_0x4798('0x8')]({'port':0x232a});var mailClient=jayson[_0x4798('0x7')][_0x4798('0x8')]({'port':0x232b});var routingClient=jayson[_0x4798('0x7')][_0x4798('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x5b9431,_0xaa567f,_0x17c7f8){return new BPromise(function(_0x116108,_0x25b99f){var _0x3bf43b=_0x17c7f8?_0x17c7f8:amiClient;return _0x3bf43b[_0x4798('0x9')](_0x5b9431,_0xaa567f)['then'](function(_0xd2cdce){if(_0xd2cdce[_0x4798('0xa')]){if(_0xd2cdce[_0x4798('0xa')][_0x4798('0xb')]===0x1f4){return _0x25b99f(_0xd2cdce['error']['message']);}return _0x116108(_0xd2cdce[_0x4798('0xa')]['message']);}else{_0x116108(_0xd2cdce[_0x4798('0xc')]);}})['catch'](function(_0x2148b1){_0x25b99f(_0x2148b1);});});}function respondWithResult(_0x3921d3,_0x51a81f){_0x51a81f=_0x51a81f||0xc8;return function(_0x5ef3cd){if(_0x5ef3cd){return _0x3921d3[_0x4798('0xd')](_0x51a81f)[_0x4798('0xe')](_0x5ef3cd);}return _0x3921d3[_0x4798('0xf')](0x194);};}function handleError(_0x487554,_0x334db8){_0x334db8=_0x334db8||0x1f4;return function(_0x551aaf){logger['error'](_0x551aaf[_0x4798('0x10')]);if(_0x551aaf[_0x4798('0x11')]){delete _0x551aaf[_0x4798('0x11')];}_0x487554[_0x4798('0xd')](_0x334db8)[_0x4798('0x12')](_0x551aaf);};}function findById(_0x5568b1){return function(_0x3a3c5c){if(!_['isNil'](_0x5568b1)&&!_['isNil'](_0x3a3c5c)&&!_['isNil'](_0x3a3c5c['rows'])){return _[_0x4798('0x13')](_0x3a3c5c[_0x4798('0x14')],function(_0x4cad0b){return _0x4cad0b['id']==_0x5568b1;});}return null;};}exports['voiceChannels']=function(_0x491460,_0xfe7587){return respondWithRpcPromise('VoiceChannels',_0x491460[_0x4798('0x15')])[_0x4798('0x16')](respondWithResult(_0xfe7587,null))[_0x4798('0x17')](handleError(_0xfe7587,null));};exports[_0x4798('0x18')]=function(_0x3dce9e,_0x280e67){return respondWithRpcPromise(_0x4798('0x19'),_[_0x4798('0x1a')](_0x3dce9e[_0x4798('0x15')],_0x3dce9e[_0x4798('0x1b')]))[_0x4798('0x16')](respondWithResult(_0x280e67,null))[_0x4798('0x17')](handleError(_0x280e67,null));};exports[_0x4798('0x1c')]=function(_0xee9c0e,_0x539ef2){return respondWithRpcPromise(_0x4798('0x1d'),_['merge'](_0xee9c0e[_0x4798('0x15')],_0xee9c0e[_0x4798('0x1b')]))[_0x4798('0x16')](respondWithResult(_0x539ef2,null))['catch'](handleError(_0x539ef2,null));};exports[_0x4798('0x1e')]=function(_0x5414aa,_0x33822a){return respondWithRpcPromise(_0x4798('0x1f'),_0x5414aa[_0x4798('0x15')])['then'](respondWithResult(_0x33822a,null))[_0x4798('0x17')](handleError(_0x33822a,null));};exports[_0x4798('0x20')]=function(_0x2192a8,_0x2262c1){return respondWithRpcPromise(_0x4798('0x1f'),_0x2192a8[_0x4798('0x15')])[_0x4798('0x16')](findById(_0x2192a8[_0x4798('0x1b')]['id']))['then'](respondWithResult(_0x2262c1,null))[_0x4798('0x17')](handleError(_0x2262c1,null));};exports['voiceQueuesPreview']=function(_0x3afa02,_0x39165e){return respondWithRpcPromise(_0x4798('0x21'),_[_0x4798('0x1a')](_0x3afa02[_0x4798('0x15')],_0x3afa02[_0x4798('0x1b')]))[_0x4798('0x16')](respondWithResult(_0x39165e,null))[_0x4798('0x17')](handleError(_0x39165e,null));};exports[_0x4798('0x22')]=function(_0x138ae3,_0x168454){return respondWithRpcPromise('VoiceQueuesChannels',_0x138ae3['query'])[_0x4798('0x16')](respondWithResult(_0x168454,null))[_0x4798('0x17')](handleError(_0x168454,null));};exports[_0x4798('0x23')]=function(_0x2c8525,_0xe91c13){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x2c8525[_0x4798('0x15')],_0x2c8525[_0x4798('0x1b')]))[_0x4798('0x16')](respondWithResult(_0xe91c13,null))['catch'](handleError(_0xe91c13,null));};exports[_0x4798('0x24')]=function(_0x5d93a1,_0x465c8c){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0x5d93a1[_0x4798('0x15')],_0x5d93a1[_0x4798('0x1b')]))[_0x4798('0x16')](respondWithResult(_0x465c8c,null))[_0x4798('0x17')](handleError(_0x465c8c,null));};exports[_0x4798('0x25')]=function(_0x189d89,_0x4964aa){return respondWithRpcPromise(_0x4798('0x26'),_['merge'](_0x189d89[_0x4798('0x15')],_0x189d89[_0x4798('0x1b')]))['then'](respondWithResult(_0x4964aa,null))['catch'](handleError(_0x4964aa,null));};exports[_0x4798('0x27')]=function(_0x41ba8a,_0x2c6ed3){return respondWithRpcPromise('Outbound',_0x41ba8a[_0x4798('0x15')])[_0x4798('0x16')](respondWithResult(_0x2c6ed3,null))[_0x4798('0x17')](handleError(_0x2c6ed3,null));};exports['outboundChannels']=function(_0x48a01c,_0x4486b2){return respondWithRpcPromise(_0x4798('0x28'),_0x48a01c[_0x4798('0x15')])['then'](respondWithResult(_0x4486b2,null))['catch'](handleError(_0x4486b2,null));};exports[_0x4798('0x29')]=function(_0x1af459,_0x50e105){var _0x490172;return respondWithRpcPromise(_0x4798('0x2a'),_0x1af459[_0x4798('0x15')])[_0x4798('0x16')](function(_0x17ad8e){_0x490172=_0x17ad8e;return respondWithRpcPromise(_0x4798('0x2a'),_0x1af459[_0x4798('0x15')],routingClient);})[_0x4798('0x16')](function(_0x413805){return _['merge']({},_0x413805,_0x490172);})[_0x4798('0x16')](respondWithResult(_0x50e105,null))['catch'](handleError(_0x50e105,null));};exports['agentCapacity']=function(_0x32372f,_0x40316b){if(_0x32372f[_0x4798('0x2b')]&&_0x32372f[_0x4798('0x2b')][_0x4798('0x2c')]&&_0x32372f['user']&&_0x32372f[_0x4798('0x2d')][_0x4798('0x11')]){for(var _0x43fe1a in _0x32372f[_0x4798('0x2b')][_0x4798('0x2c')]){if(_0x32372f[_0x4798('0x2b')][_0x4798('0x2c')][_0x4798('0x2e')](_0x43fe1a)){db[_0x4798('0x2f')][_0x4798('0x30')]({'where':{'channel':_0x43fe1a,'membername':_0x32372f[_0x4798('0x2d')][_0x4798('0x11')],'type':_0x4798('0x31'),'exitAt':null,'uniqueid':_0x32372f['body'][_0x4798('0x2c')][_0x43fe1a]&&_0x32372f[_0x4798('0x2b')]['interaction'][_0x43fe1a]['length']?{'$notIn':_0x32372f['body']['interaction'][_0x43fe1a]}:{'$ne':null}}})[_0x4798('0x16')](function(_0x9913c){var _0x5b3953=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x45f4ce=0x0,_0x3973e7=_0x9913c['length'];_0x45f4ce<_0x3973e7;_0x45f4ce+=0x1){_0x9913c[_0x45f4ce][_0x4798('0x32')]({'exitAt':_0x5b3953});}});for(var _0x27ad15=0x0;_0x27ad15<_0x32372f['body'][_0x4798('0x2c')][_0x43fe1a]['length'];_0x27ad15+=0x1){db[_0x4798('0x2f')][_0x4798('0x33')]({'where':{'channel':_0x43fe1a,'membername':_0x32372f['user'][_0x4798('0x11')],'type':_0x4798('0x31'),'uniqueid':_0x32372f[_0x4798('0x2b')][_0x4798('0x2c')][_0x43fe1a][_0x27ad15],'exitAt':null},'defaults':{'channel':_0x43fe1a,'membername':_0x32372f[_0x4798('0x2d')]['name'],'interface':_['isNil'](_0x32372f[_0x4798('0x2d')][_0x4798('0x34')])?util[_0x4798('0x35')]('SIP/%s',_0x32372f[_0x4798('0x2d')][_0x4798('0x11')]):_0x32372f[_0x4798('0x2d')]['interface'],'type':_0x4798('0x31'),'enterAt':moment()[_0x4798('0x35')](_0x4798('0x36')),'role':_0x4798('0x37'),'internal':_0x32372f[_0x4798('0x2d')]['internal'],'uniqueid':_0x32372f[_0x4798('0x2b')]['interaction'][_0x43fe1a][_0x27ad15]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x32372f['params']['id'],'capacity':_0x32372f['body'][_0x4798('0x38')]},routingClient)[_0x4798('0x16')](respondWithResult(_0x40316b,null))[_0x4798('0x17')](handleError(_0x40316b,null));};exports[_0x4798('0x39')]=function(_0xf3d7bd,_0x4d9cb5){return respondWithRpcPromise(_0x4798('0x3a'),_0xf3d7bd[_0x4798('0x15')])[_0x4798('0x16')](respondWithResult(_0x4d9cb5,null))[_0x4798('0x17')](handleError(_0x4d9cb5,null));};exports[_0x4798('0x3b')]=function(_0x5eec40,_0x135609){return respondWithRpcPromise(_0x4798('0x3c'),_0x5eec40[_0x4798('0x15')])['then'](respondWithResult(_0x135609,null))[_0x4798('0x17')](handleError(_0x135609,null));};exports[_0x4798('0x3d')]=function(_0x3bb2b9,_0x17220b){return respondWithRpcPromise(_0x4798('0x3e'),_0x3bb2b9[_0x4798('0x15')])[_0x4798('0x16')](respondWithResult(_0x17220b,null))['catch'](handleError(_0x17220b,null));};exports[_0x4798('0x3f')]=function(_0x54c373,_0x53e97e){return respondWithRpcPromise('ChatQueues',_0x54c373[_0x4798('0x15')],routingClient)['then'](respondWithResult(_0x53e97e,null))[_0x4798('0x17')](handleError(_0x53e97e,null));};exports[_0x4798('0x40')]=function(_0x3b5ebe,_0x4ffdd1){return respondWithRpcPromise('ChatQueues',_0x3b5ebe[_0x4798('0x15')],routingClient)['then'](findById(_0x3b5ebe['params']['id']))[_0x4798('0x16')](respondWithResult(_0x4ffdd1,null))['catch'](handleError(_0x4ffdd1,null));};exports[_0x4798('0x41')]=function(_0xc5f789,_0x2e3a92){return respondWithRpcPromise('MailQueues',_0xc5f789['query'],routingClient)['then'](respondWithResult(_0x2e3a92,null))[_0x4798('0x17')](handleError(_0x2e3a92,null));};exports[_0x4798('0x42')]=function(_0x4b9b18,_0x3b60b8){return respondWithRpcPromise('MailQueues',_0x4b9b18[_0x4798('0x15')],routingClient)[_0x4798('0x16')](findById(_0x4b9b18[_0x4798('0x1b')]['id']))[_0x4798('0x16')](respondWithResult(_0x3b60b8,null))[_0x4798('0x17')](handleError(_0x3b60b8,null));};exports[_0x4798('0x43')]=function(_0x556cac,_0x80729a){return respondWithRpcPromise('MailAccounts',_0x556cac[_0x4798('0x15')],mailClient)['then'](respondWithResult(_0x80729a,null))[_0x4798('0x17')](handleError(_0x80729a,null));};exports[_0x4798('0x44')]=function(_0x4f6d4a,_0x17656c){return respondWithRpcPromise('OpenchannelQueues',_0x4f6d4a['query'],routingClient)[_0x4798('0x16')](respondWithResult(_0x17656c,null))[_0x4798('0x17')](handleError(_0x17656c,null));};exports[_0x4798('0x45')]=function(_0x3e099d,_0x2d118a){return respondWithRpcPromise(_0x4798('0x46'),_0x3e099d['query'],routingClient)[_0x4798('0x16')](findById(_0x3e099d[_0x4798('0x1b')]['id']))[_0x4798('0x16')](respondWithResult(_0x2d118a,null))['catch'](handleError(_0x2d118a,null));};exports['smsQueues']=function(_0x28131b,_0x23d76a){return respondWithRpcPromise(_0x4798('0x47'),_0x28131b[_0x4798('0x15')],routingClient)[_0x4798('0x16')](respondWithResult(_0x23d76a,null))[_0x4798('0x17')](handleError(_0x23d76a,null));};exports[_0x4798('0x48')]=function(_0x4a3ff4,_0x5d2099){return respondWithRpcPromise('SmsQueues',_0x4a3ff4['query'],routingClient)[_0x4798('0x16')](findById(_0x4a3ff4[_0x4798('0x1b')]['id']))[_0x4798('0x16')](respondWithResult(_0x5d2099,null))[_0x4798('0x17')](handleError(_0x5d2099,null));};exports['faxQueues']=function(_0xf30875,_0x40a7f0){return respondWithRpcPromise(_0x4798('0x49'),_0xf30875['query'],routingClient)['then'](respondWithResult(_0x40a7f0,null))[_0x4798('0x17')](handleError(_0x40a7f0,null));};exports[_0x4798('0x4a')]=function(_0x590c94,_0x2ce021){return respondWithRpcPromise(_0x4798('0x49'),_0x590c94[_0x4798('0x15')],routingClient)[_0x4798('0x16')](findById(_0x590c94[_0x4798('0x1b')]['id']))[_0x4798('0x16')](respondWithResult(_0x2ce021,null))['catch'](handleError(_0x2ce021,null));};exports[_0x4798('0x4b')]=function(_0x56b9fa,_0x537eb3){return respondWithRpcPromise(_0x4798('0x4c'),_0x56b9fa[_0x4798('0x15')])[_0x4798('0x16')](respondWithResult(_0x537eb3,null))[_0x4798('0x17')](handleError(_0x537eb3,null));};exports[_0x4798('0x4d')]=function(_0x3edb03,_0x1879dd){return respondWithRpcPromise(_0x4798('0x4e'),_0x3edb03[_0x4798('0x15')],routingClient)[_0x4798('0x16')](respondWithResult(_0x1879dd,null))[_0x4798('0x17')](handleError(_0x1879dd,null));};exports[_0x4798('0x4f')]=function(_0x44ae84,_0x1496d3){return respondWithRpcPromise(_0x4798('0x50'),_0x44ae84[_0x4798('0x15')],routingClient)[_0x4798('0x16')](respondWithResult(_0x1496d3,null))[_0x4798('0x17')](handleError(_0x1496d3,null));};exports[_0x4798('0x51')]=function(_0x5a30f6,_0x4956ac){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x5a30f6[_0x4798('0x15')],routingClient)[_0x4798('0x16')](respondWithResult(_0x4956ac,null))[_0x4798('0x17')](handleError(_0x4956ac,null));};exports['smsQueuesWaitingInteractions']=function(_0x2ac47d,_0x3e897b){return respondWithRpcPromise(_0x4798('0x52'),_0x2ac47d[_0x4798('0x15')],routingClient)['then'](respondWithResult(_0x3e897b,null))[_0x4798('0x17')](handleError(_0x3e897b,null));};exports['faxQueuesWaitingInteractions']=function(_0x5f09c6,_0x1b70a8){return respondWithRpcPromise(_0x4798('0x53'),_0x5f09c6['query'],routingClient)[_0x4798('0x16')](respondWithResult(_0x1b70a8,null))[_0x4798('0x17')](handleError(_0x1b70a8,null));};exports[_0x4798('0x54')]=function(_0x2a692f){return function(_0x34d342,_0x154a82){var _0x370132,_0x414ed2;var _0x278cec=_[_0x4798('0x55')](_0x2a692f);var _0x516077=_0x2a692f==='chat'?'Website':_0x4798('0x56');return db[_0x278cec+_0x4798('0x57')]['findOne']({'raw':!![],'where':{'id':_0x34d342[_0x4798('0x1b')]['id']}})['then'](function(_0x4f3681){if(_[_0x4798('0x58')](_0x4f3681)){throw new Error(_0x278cec+'\x20Queue\x20not\x20found');}_0x370132=_0x4f3681;return db[_0x278cec+_0x4798('0x59')][_0x4798('0x5a')]({'where':{'id':_0x34d342[_0x4798('0x2b')][_0x4798('0x5b')]},'include':[{'model':db[_0x278cec+_0x4798('0x5c')],'as':_0x4798('0x5c')},{'model':db[_0x278cec+_0x516077],'as':_0x4798('0x56')}]});})[_0x4798('0x16')](function(_0xe04365){if(_[_0x4798('0x58')](_0xe04365)){throw new Error(_0x278cec+_0x4798('0x5d'));}_0x414ed2=_0xe04365;return _0xe04365[_0x4798('0x5e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x157220={'uniqueid':_0x2a692f+'.'+_0x414ed2['id']+'.'+_0x414ed2[_0x4798('0x5c')]['id'],'FromUserId':_0x34d342[_0x4798('0x2d')]['id'],'type':_0x4798('0x5f')};_0x157220[_0x278cec+'MessageId']=_0x414ed2['id'];_0x157220[_0x278cec+_0x4798('0x60')]=_0x414ed2[_0x4798('0x5c')]['id'];_0x157220[_0x4798('0x61')+_0x278cec+_0x516077+'Id']=_0x414ed2[_0x4798('0x56')]['id'];_0x157220['To'+_0x278cec+_0x4798('0x62')]=_0x370132['id'];return db[_0x278cec+'TransferReport'][_0x4798('0x63')](_0x157220);})[_0x4798('0x16')](function(){return respondWithRpcPromise('Start',{'channel':_0x2a692f,'interaction':_0x414ed2['Interaction'],'message':_0x414ed2,'account':_0x414ed2[_0x4798('0x56')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x370132[_0x4798('0x11')]+','+(_0x414ed2[_0x4798('0x56')][_0x4798('0x64')]||0x12c),'interval':_0x4798('0x65')}]},routingClient);})['then'](respondWithResult(_0x154a82,null))[_0x4798('0x17')](handleError(_0x154a82,null));};};exports[_0x4798('0x66')]=function(_0x5a5e49,_0x3dc9f0){var _0x57e130,_0x41b019;if(_[_0x4798('0x58')](_0x5a5e49[_0x4798('0x2b')][_0x4798('0x67')])){throw new Error(_0x4798('0x68'));}var _0x1ecd95=_0x5a5e49['body'][_0x4798('0x67')];var _0x272864=_[_0x4798('0x55')](_0x1ecd95);var _0xa98810=_0x1ecd95==='chat'?_0x4798('0x69'):_0x4798('0x56');return db[_0x4798('0x6a')]['findOne']({'raw':!![],'where':{'id':_0x5a5e49[_0x4798('0x1b')]['id'],'role':_0x4798('0x37')}})[_0x4798('0x16')](function(_0x1b98f9){if(_[_0x4798('0x58')](_0x1b98f9)){throw new Error(_0x4798('0x6b'));}_0x57e130=_0x1b98f9;return db[_0x272864+_0x4798('0x59')][_0x4798('0x5a')]({'where':{'id':_0x5a5e49[_0x4798('0x2b')][_0x4798('0x5b')]},'include':[{'model':db[_0x272864+_0x4798('0x5c')],'as':_0x4798('0x5c')},{'model':db[_0x272864+_0xa98810],'as':'Account'}]});})['then'](function(_0x2980b2){if(_[_0x4798('0x58')](_0x2980b2)){throw new Error(_0x272864+_0x4798('0x5d'));}_0x41b019=_0x2980b2;return _0x2980b2['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x4798('0x16')](function(){var _0xbaecc={'uniqueid':_0x1ecd95+'.'+_0x41b019['id']+'.'+_0x41b019[_0x4798('0x5c')]['id'],'FromUserId':_0x5a5e49[_0x4798('0x2d')]['id'],'type':_0x4798('0x5f'),'ToUserId':_0x57e130['id']};_0xbaecc[_0x272864+_0x4798('0x6c')]=_0x41b019['id'];_0xbaecc[_0x272864+'InteractionId']=_0x41b019[_0x4798('0x5c')]['id'];_0xbaecc[_0x4798('0x61')+_0x272864+_0xa98810+'Id']=_0x41b019['Account']['id'];return db[_0x272864+_0x4798('0x6d')]['create'](_0xbaecc);})[_0x4798('0x16')](function(){return respondWithRpcPromise(_0x4798('0x6e'),{'channel':_0x1ecd95,'interaction':_0x41b019['Interaction'],'message':_0x41b019,'account':_0x41b019['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x4798('0x37'),'appdata':_0x57e130[_0x4798('0x11')]+','+(_0x41b019[_0x4798('0x56')]['agentTransferTimeout']||0x12c),'interval':_0x4798('0x65')}]},routingClient);})[_0x4798('0x16')](respondWithResult(_0x3dc9f0,null))[_0x4798('0x17')](handleError(_0x3dc9f0,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index ec88c2a..861dd5e 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 _0x5916=['../../config/environment','get','isAuthenticated','index','/:id','show','/:id/run','run','post','create','put','update','destroy','path','express','Router'];(function(_0x2e2586,_0x4ca6be){var _0x47c85d=function(_0x111352){while(--_0x111352){_0x2e2586['push'](_0x2e2586['shift']());}};_0x47c85d(++_0x4ca6be);}(_0x5916,0xbd));var _0x6591=function(_0x39f311,_0x3de2ed){_0x39f311=_0x39f311-0x0;var _0x5179e6=_0x5916[_0x39f311];return _0x5179e6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6591('0x0'));var timeout=require('connect-timeout');var express=require(_0x6591('0x1'));var router=express[_0x6591('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6591('0x3'));var controller=require('./schedule.controller');router[_0x6591('0x4')]('/',auth[_0x6591('0x5')](),controller[_0x6591('0x6')]);router['get'](_0x6591('0x7'),auth[_0x6591('0x5')](),controller[_0x6591('0x8')]);router[_0x6591('0x4')](_0x6591('0x9'),auth[_0x6591('0x5')](),controller[_0x6591('0xa')]);router[_0x6591('0xb')]('/',auth['isAuthenticated'](),controller[_0x6591('0xc')]);router[_0x6591('0xd')](_0x6591('0x7'),auth[_0x6591('0x5')](),controller[_0x6591('0xe')]);router['delete'](_0x6591('0x7'),auth[_0x6591('0x5')](),controller[_0x6591('0xf')]);module['exports']=router; \ No newline at end of file +var _0xd170=['show','get','/:id/run','run','post','create','put','update','destroy','exports','multer','util','path','express','index','/:id','isAuthenticated'];(function(_0x11ee71,_0x4eef5c){var _0x57ffd6=function(_0x1b84f2){while(--_0x1b84f2){_0x11ee71['push'](_0x11ee71['shift']());}};_0x57ffd6(++_0x4eef5c);}(_0xd170,0x191));var _0x0d17=function(_0x53f122,_0x2cdeca){_0x53f122=_0x53f122-0x0;var _0x59a134=_0xd170[_0x53f122];return _0x59a134;};'use strict';var multer=require(_0x0d17('0x0'));var util=require(_0x0d17('0x1'));var path=require(_0x0d17('0x2'));var timeout=require('connect-timeout');var express=require(_0x0d17('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('./schedule.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0d17('0x4')]);router['get'](_0x0d17('0x5'),auth[_0x0d17('0x6')](),controller[_0x0d17('0x7')]);router[_0x0d17('0x8')](_0x0d17('0x9'),auth[_0x0d17('0x6')](),controller[_0x0d17('0xa')]);router[_0x0d17('0xb')]('/',auth[_0x0d17('0x6')](),controller[_0x0d17('0xc')]);router[_0x0d17('0xd')]('/:id',auth[_0x0d17('0x6')](),controller[_0x0d17('0xe')]);router['delete'](_0x0d17('0x5'),auth[_0x0d17('0x6')](),controller[_0x0d17('0xf')]);module[_0x0d17('0x10')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index cc39516..85af9ba 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 _0xc14a=['hours','minutes','ENUM','csv','pdf','xlsx','default','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','quarters','months','days'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xc14a,0xa9));var _0xac14=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc14a[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xac14('0x0'));module[_0xac14('0x1')]={'name':{'type':Sequelize[_0xac14('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xac14('0x2')]},'active':{'type':Sequelize[_0xac14('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xac14('0x4')},'startAt':{'type':Sequelize[_0xac14('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xac14('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xac14('0x7'),_0xac14('0x8'),_0xac14('0x9'),'weeks',_0xac14('0xa'),_0xac14('0xb'),_0xac14('0xc')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xac14('0xd')](_0xac14('0xe'),_0xac14('0xf'),_0xac14('0x10')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xac14('0xd')]('custom',_0xac14('0x11')),'allowNull':![],'defaultValue':_0xac14('0x12')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xac14('0x13')]},'bcc':{'type':Sequelize[_0xac14('0x13')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xfcf0=['days','minutes','pdf','xlsx','csv','custom','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks'];(function(_0x1e1b5a,_0x13b534){var _0x3206db=function(_0x5d6c2f){while(--_0x5d6c2f){_0x1e1b5a['push'](_0x1e1b5a['shift']());}};_0x3206db(++_0x13b534);}(_0xfcf0,0x138));var _0x0fcf=function(_0x59f0dc,_0x1e2497){_0x59f0dc=_0x59f0dc-0x0;var _0x5b5445=_0xfcf0[_0x59f0dc];return _0x5b5445;};'use strict';var Sequelize=require(_0x0fcf('0x0'));module[_0x0fcf('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x0fcf('0x2')]},'active':{'type':Sequelize[_0x0fcf('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x0fcf('0x2')],'allowNull':![],'defaultValue':_0x0fcf('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x0fcf('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x0fcf('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x0fcf('0x7')](_0x0fcf('0x8'),_0x0fcf('0x9'),_0x0fcf('0xa'),_0x0fcf('0xb'),_0x0fcf('0xc'),'hours',_0x0fcf('0xd')),'allowNull':![],'defaultValue':_0x0fcf('0xc')},'output':{'type':Sequelize[_0x0fcf('0x7')]('csv',_0x0fcf('0xe'),_0x0fcf('0xf')),'allowNull':![],'defaultValue':_0x0fcf('0x10')},'type':{'type':Sequelize['ENUM'](_0x0fcf('0x11'),'default'),'allowNull':![],'defaultValue':_0x0fcf('0x11')},'sendMail':{'type':Sequelize[_0x0fcf('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x0fcf('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x0fcf('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 4c6edcf..aff6158 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 _0x2019=['type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','count','include','rows','catch','show','params','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','run','../../config/schedule','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','get','Scheduler','UserProfileResource','error','name','send','index','map','Schedule','rawAttributes'];(function(_0x55f4ba,_0x287c29){var _0x5ac767=function(_0x42adcd){while(--_0x42adcd){_0x55f4ba['push'](_0x55f4ba['shift']());}};_0x5ac767(++_0x287c29);}(_0x2019,0x120));var _0x9201=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x2019[_0x5f0089];return _0x193892;};'use strict';var pdf=require(_0x9201('0x0'));var emlformat=require(_0x9201('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9201('0x2'));var jsonpatch=require(_0x9201('0x3'));var rp=require('request-promise');var moment=require(_0x9201('0x4'));var BPromise=require(_0x9201('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9201('0x6'));var sox=require(_0x9201('0x7'));var csv=require(_0x9201('0x8'));var ejs=require(_0x9201('0x9'));var fs=require('fs');var _=require(_0x9201('0xa'));var squel=require(_0x9201('0xb'));var crypto=require(_0x9201('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9201('0xd'));var toCsv=require(_0x9201('0x8'));var querystring=require('querystring');var Papa=require(_0x9201('0xe'));var Redis=require(_0x9201('0xf'));var authService=require(_0x9201('0x10'));var qs=require(_0x9201('0x11'));var as=require(_0x9201('0x12'));var hardwareService=require(_0x9201('0x13'));var logger=require(_0x9201('0x14'))(_0x9201('0x15'));var utils=require(_0x9201('0x16'));var config=require(_0x9201('0x17'));var db=require(_0x9201('0x18'))['db'];function respondWithStatusCode(_0x23cdca,_0x2ee7bf){_0x2ee7bf=_0x2ee7bf||0xcc;return function(_0x2507a6){if(_0x2507a6){return _0x23cdca[_0x9201('0x19')](_0x2ee7bf);}return _0x23cdca['status'](_0x2ee7bf)[_0x9201('0x1a')]();};}function respondWithResult(_0x4f3fa1,_0x32e8d0){_0x32e8d0=_0x32e8d0||0xc8;return function(_0x153645){if(_0x153645){return _0x4f3fa1['status'](_0x32e8d0)[_0x9201('0x1b')](_0x153645);}};}function respondWithFilteredResult(_0x5d6180,_0x5d4f8f){return function(_0x1c55e7){if(_0x1c55e7){var _0x2c7c25=_0x1c55e7['count'],_0x37a4eb=_0x5d4f8f[_0x9201('0x1c')],_0x1f7961=_0x5d4f8f[_0x9201('0x1c')]+_0x5d4f8f[_0x9201('0x1d')],_0x37fffa;if(_0x1f7961>=_0x2c7c25){_0x1f7961=_0x2c7c25;_0x37fffa=0xc8;}else{_0x37fffa=0xce;}_0x5d6180[_0x9201('0x1e')](_0x37fffa);return _0x5d6180[_0x9201('0x1f')](_0x9201('0x20'),_0x37a4eb+'-'+_0x1f7961+'/'+_0x2c7c25)[_0x9201('0x1b')](_0x1c55e7);}return null;};}function patchUpdates(_0x5b49e1){return function(_0x55abbc){try{jsonpatch[_0x9201('0x21')](_0x55abbc,_0x5b49e1,!![]);}catch(_0x2a99fd){return BPromise[_0x9201('0x22')](_0x2a99fd);}return _0x55abbc['save']();};}function saveUpdates(_0x116fbb,_0x390448){return function(_0x4afa7a){if(_0x4afa7a){return _0x4afa7a[_0x9201('0x23')](_0x116fbb)[_0x9201('0x24')](function(_0x3bf8dd){return _0x3bf8dd;});}return null;};}function removeEntity(_0x15635c,_0x4ad128){return function(_0x45f46a){if(_0x45f46a){return _0x45f46a[_0x9201('0x25')]()[_0x9201('0x24')](function(){var _0x415e28=_0x45f46a[_0x9201('0x26')]({'plain':!![]});var _0x28b59c=_0x9201('0x27');return db[_0x9201('0x28')]['destroy']({'where':{'type':_0x28b59c,'resourceId':_0x415e28['id']}})[_0x9201('0x24')](function(){return _0x45f46a;});})[_0x9201('0x24')](function(){_0x15635c['status'](0xcc)[_0x9201('0x1a')]();});}};}function handleEntityNotFound(_0x98207,_0x1acf5d){return function(_0x8e1e68){if(!_0x8e1e68){_0x98207['sendStatus'](0x194);}return _0x8e1e68;};}function handleError(_0x5a9e4f,_0x198e71){_0x198e71=_0x198e71||0x1f4;return function(_0x2d11b0){logger[_0x9201('0x29')](_0x2d11b0['stack']);if(_0x2d11b0['name']){delete _0x2d11b0[_0x9201('0x2a')];}_0x5a9e4f[_0x9201('0x1e')](_0x198e71)[_0x9201('0x2b')](_0x2d11b0);};}exports[_0x9201('0x2c')]=function(_0x54e075,_0x256522){var _0x55481f={},_0x447135={},_0x18d80e={'count':0x0,'rows':[]};var _0x146b10=_[_0x9201('0x2d')](db[_0x9201('0x2e')][_0x9201('0x2f')],function(_0x23bdd7){return{'name':_0x23bdd7['fieldName'],'type':_0x23bdd7[_0x9201('0x30')]['key']};});_0x447135[_0x9201('0x31')]=_['map'](_0x146b10,_0x9201('0x2a'));_0x447135[_0x9201('0x32')]=_[_0x9201('0x33')](_0x54e075[_0x9201('0x32')]);_0x447135[_0x9201('0x34')]=_[_0x9201('0x35')](_0x447135[_0x9201('0x31')],_0x447135[_0x9201('0x32')]);_0x55481f[_0x9201('0x36')]=_['intersection'](_0x447135[_0x9201('0x31')],qs[_0x9201('0x37')](_0x54e075[_0x9201('0x32')]['fields']));_0x55481f['attributes']=_0x55481f[_0x9201('0x36')][_0x9201('0x38')]?_0x55481f[_0x9201('0x36')]:_0x447135['model'];if(!_0x54e075[_0x9201('0x32')][_0x9201('0x39')](_0x9201('0x3a'))){_0x55481f[_0x9201('0x1d')]=qs[_0x9201('0x1d')](_0x54e075[_0x9201('0x32')][_0x9201('0x1d')]);_0x55481f['offset']=qs[_0x9201('0x1c')](_0x54e075[_0x9201('0x32')][_0x9201('0x1c')]);}_0x55481f['order']=qs[_0x9201('0x3b')](_0x54e075[_0x9201('0x32')]['sort']);_0x55481f[_0x9201('0x3c')]=qs[_0x9201('0x34')](_['pick'](_0x54e075['query'],_0x447135['filters']));if(_0x54e075[_0x9201('0x32')]['filter']){_0x55481f[_0x9201('0x3c')]=_[_0x9201('0x3d')](_0x55481f[_0x9201('0x3c')],{'$or':_['map'](_0x146b10,function(_0x10a499){if(_0x10a499['type']!==_0x9201('0x3e')){var _0x440ca0={};_0x440ca0[_0x10a499[_0x9201('0x2a')]]={'$like':'%'+_0x54e075['query'][_0x9201('0x3f')]+'%'};return _0x440ca0;}})});}_0x55481f=_[_0x9201('0x3d')]({},_0x55481f,_0x54e075[_0x9201('0x40')]);var _0x2d5d68={'where':_0x55481f['where']};return db[_0x9201('0x2e')][_0x9201('0x41')](_0x2d5d68)[_0x9201('0x24')](function(_0x1e93ea){_0x18d80e[_0x9201('0x41')]=_0x1e93ea;if(_0x54e075[_0x9201('0x32')]['includeAll']){_0x55481f[_0x9201('0x42')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x55481f);})[_0x9201('0x24')](function(_0x8b1308){_0x18d80e[_0x9201('0x43')]=_0x8b1308;return _0x18d80e;})[_0x9201('0x24')](respondWithFilteredResult(_0x256522,_0x55481f))[_0x9201('0x44')](handleError(_0x256522,null));};exports[_0x9201('0x45')]=function(_0x4f21ca,_0xa3defa){var _0x183e4f={'raw':![],'where':{'id':_0x4f21ca[_0x9201('0x46')]['id']}},_0x15ac19={};_0x15ac19['model']=_[_0x9201('0x33')](db[_0x9201('0x2e')][_0x9201('0x2f')]);_0x15ac19['query']=_[_0x9201('0x33')](_0x4f21ca[_0x9201('0x32')]);_0x15ac19[_0x9201('0x34')]=_[_0x9201('0x35')](_0x15ac19[_0x9201('0x31')],_0x15ac19['query']);_0x183e4f[_0x9201('0x36')]=_[_0x9201('0x35')](_0x15ac19[_0x9201('0x31')],qs['fields'](_0x4f21ca[_0x9201('0x32')]['fields']));_0x183e4f['attributes']=_0x183e4f['attributes'][_0x9201('0x38')]?_0x183e4f[_0x9201('0x36')]:_0x15ac19[_0x9201('0x31')];if(_0x4f21ca[_0x9201('0x32')][_0x9201('0x47')]){_0x183e4f[_0x9201('0x42')]=[{'all':!![]}];}_0x183e4f=_[_0x9201('0x3d')]({},_0x183e4f,_0x4f21ca[_0x9201('0x40')]);return db[_0x9201('0x2e')][_0x9201('0x48')](_0x183e4f)['then'](handleEntityNotFound(_0xa3defa,null))[_0x9201('0x24')](respondWithResult(_0xa3defa,null))[_0x9201('0x44')](handleError(_0xa3defa,null));};exports[_0x9201('0x49')]=function(_0x4a6f87,_0x884af0){return db[_0x9201('0x2e')]['create'](_0x4a6f87[_0x9201('0x4a')],{})['then'](function(_0x7af4f2){var _0x37bd2a=_0x4a6f87[_0x9201('0x4b')][_0x9201('0x26')]({'plain':!![]});if(!_0x37bd2a)throw new Error(_0x9201('0x4c'));if(_0x37bd2a[_0x9201('0x4d')]===_0x9201('0x4b')){var _0x3d75d7=_0x7af4f2[_0x9201('0x26')]({'plain':!![]});var _0x13d2ce='Scheduler';return db[_0x9201('0x4e')][_0x9201('0x48')]({'where':{'name':_0x13d2ce,'userProfileId':_0x37bd2a[_0x9201('0x4f')]},'raw':!![]})[_0x9201('0x24')](function(_0x50dfc7){if(_0x50dfc7&&_0x50dfc7[_0x9201('0x50')]===0x0){return db[_0x9201('0x28')]['create']({'name':_0x3d75d7[_0x9201('0x2a')],'resourceId':_0x3d75d7['id'],'type':_0x50dfc7[_0x9201('0x2a')],'sectionId':_0x50dfc7['id']},{})[_0x9201('0x24')](function(){return _0x7af4f2;});}else{return _0x7af4f2;}})[_0x9201('0x44')](function(_0x5a6f10){logger[_0x9201('0x29')](_0x9201('0x51'),_0x5a6f10);throw _0x5a6f10;});}return _0x7af4f2;})['then'](respondWithResult(_0x884af0,0xc9))['catch'](handleError(_0x884af0,null));};exports[_0x9201('0x23')]=function(_0x319cbf,_0x534a55){if(_0x319cbf[_0x9201('0x4a')]['id']){delete _0x319cbf[_0x9201('0x4a')]['id'];}return db[_0x9201('0x2e')][_0x9201('0x48')]({'where':{'id':_0x319cbf[_0x9201('0x46')]['id']}})[_0x9201('0x24')](handleEntityNotFound(_0x534a55,null))[_0x9201('0x24')](saveUpdates(_0x319cbf['body'],null))[_0x9201('0x24')](respondWithResult(_0x534a55,null))[_0x9201('0x44')](handleError(_0x534a55,null));};exports[_0x9201('0x25')]=function(_0x22e6d2,_0x43c626){return db[_0x9201('0x2e')][_0x9201('0x48')]({'where':{'id':_0x22e6d2[_0x9201('0x46')]['id']}})['then'](handleEntityNotFound(_0x43c626,null))['then'](removeEntity(_0x43c626,null))[_0x9201('0x44')](handleError(_0x43c626,null));};exports[_0x9201('0x52')]=function(_0x433112,_0x22a559,_0x4b9f59){var _0x2dd663=require(_0x9201('0x53'));return db[_0x9201('0x2e')][_0x9201('0x48')]({'where':{'id':_0x433112['params']['id']},'raw':!![]})[_0x9201('0x24')](handleEntityNotFound(_0x22a559,null))[_0x9201('0x24')](function(){_0x2dd663[_0x9201('0x52')](_0x433112[_0x9201('0x46')]['id']);})[_0x9201('0x24')](respondWithStatusCode(_0x22a559,null))[_0x9201('0x44')](handleError(_0x22a559,null));}; \ No newline at end of file +var _0x8f0c=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','../../config/schedule','run','html-pdf','eml-format','rimraf','request-promise','bluebird','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','save','update','destroy','then','get','Scheduler','error','name','index','Schedule','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','count','includeAll','include','catch','params','keys','length'];(function(_0x38d3a6,_0x42e34a){var _0x49ba72=function(_0x446e74){while(--_0x446e74){_0x38d3a6['push'](_0x38d3a6['shift']());}};_0x49ba72(++_0x42e34a);}(_0x8f0c,0x137));var _0xc8f0=function(_0x3f5210,_0x32f195){_0x3f5210=_0x3f5210-0x0;var _0x53c3ab=_0x8f0c[_0x3f5210];return _0x53c3ab;};'use strict';var pdf=require(_0xc8f0('0x0'));var emlformat=require(_0xc8f0('0x1'));var rimraf=require(_0xc8f0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc8f0('0x3'));var moment=require('moment');var BPromise=require(_0xc8f0('0x4'));var Mustache=require('mustache');var util=require(_0xc8f0('0x5'));var path=require('path');var sox=require(_0xc8f0('0x6'));var csv=require(_0xc8f0('0x7'));var ejs=require(_0xc8f0('0x8'));var fs=require('fs');var _=require(_0xc8f0('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc8f0('0xa'));var deskjs=require(_0xc8f0('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc8f0('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc8f0('0xd'));var qs=require(_0xc8f0('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc8f0('0xf'));var logger=require('../../config/logger')(_0xc8f0('0x10'));var utils=require(_0xc8f0('0x11'));var config=require(_0xc8f0('0x12'));var db=require(_0xc8f0('0x13'))['db'];function respondWithStatusCode(_0x2048f7,_0x505df7){_0x505df7=_0x505df7||0xcc;return function(_0x43dd4c){if(_0x43dd4c){return _0x2048f7[_0xc8f0('0x14')](_0x505df7);}return _0x2048f7[_0xc8f0('0x15')](_0x505df7)[_0xc8f0('0x16')]();};}function respondWithResult(_0x1e70c2,_0x584726){_0x584726=_0x584726||0xc8;return function(_0x1210fc){if(_0x1210fc){return _0x1e70c2[_0xc8f0('0x15')](_0x584726)[_0xc8f0('0x17')](_0x1210fc);}};}function respondWithFilteredResult(_0x519b42,_0xe688fb){return function(_0x47122d){if(_0x47122d){var _0x13b4b1=_0x47122d['count'],_0x3b1173=_0xe688fb['offset'],_0x2f4366=_0xe688fb[_0xc8f0('0x18')]+_0xe688fb[_0xc8f0('0x19')],_0xe4e274;if(_0x2f4366>=_0x13b4b1){_0x2f4366=_0x13b4b1;_0xe4e274=0xc8;}else{_0xe4e274=0xce;}_0x519b42[_0xc8f0('0x15')](_0xe4e274);return _0x519b42[_0xc8f0('0x1a')]('Content-Range',_0x3b1173+'-'+_0x2f4366+'/'+_0x13b4b1)[_0xc8f0('0x17')](_0x47122d);}return null;};}function patchUpdates(_0x107fee){return function(_0x436958){try{jsonpatch[_0xc8f0('0x1b')](_0x436958,_0x107fee,!![]);}catch(_0x56f996){return BPromise['reject'](_0x56f996);}return _0x436958[_0xc8f0('0x1c')]();};}function saveUpdates(_0x31c7e7,_0x1fa21d){return function(_0x1b6ce6){if(_0x1b6ce6){return _0x1b6ce6[_0xc8f0('0x1d')](_0x31c7e7)['then'](function(_0x5d2b00){return _0x5d2b00;});}return null;};}function removeEntity(_0x3f7678,_0x173824){return function(_0x5629a4){if(_0x5629a4){return _0x5629a4[_0xc8f0('0x1e')]()[_0xc8f0('0x1f')](function(){var _0x680ce2=_0x5629a4[_0xc8f0('0x20')]({'plain':!![]});var _0x91a592=_0xc8f0('0x21');return db['UserProfileResource']['destroy']({'where':{'type':_0x91a592,'resourceId':_0x680ce2['id']}})['then'](function(){return _0x5629a4;});})[_0xc8f0('0x1f')](function(){_0x3f7678['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d4e3c,_0x500e31){return function(_0x12c4d8){if(!_0x12c4d8){_0x1d4e3c[_0xc8f0('0x14')](0x194);}return _0x12c4d8;};}function handleError(_0x15b367,_0x3eba99){_0x3eba99=_0x3eba99||0x1f4;return function(_0x41ba26){logger[_0xc8f0('0x22')](_0x41ba26['stack']);if(_0x41ba26['name']){delete _0x41ba26[_0xc8f0('0x23')];}_0x15b367[_0xc8f0('0x15')](_0x3eba99)['send'](_0x41ba26);};}exports[_0xc8f0('0x24')]=function(_0x195cf2,_0x365023){var _0x45e311={},_0x322247={},_0x2c9586={'count':0x0,'rows':[]};var _0x3f7c6d=_['map'](db[_0xc8f0('0x25')][_0xc8f0('0x26')],function(_0x368e16){return{'name':_0x368e16[_0xc8f0('0x27')],'type':_0x368e16['type'][_0xc8f0('0x28')]};});_0x322247[_0xc8f0('0x29')]=_[_0xc8f0('0x2a')](_0x3f7c6d,'name');_0x322247[_0xc8f0('0x2b')]=_['keys'](_0x195cf2['query']);_0x322247[_0xc8f0('0x2c')]=_[_0xc8f0('0x2d')](_0x322247[_0xc8f0('0x29')],_0x322247[_0xc8f0('0x2b')]);_0x45e311[_0xc8f0('0x2e')]=_[_0xc8f0('0x2d')](_0x322247[_0xc8f0('0x29')],qs[_0xc8f0('0x2f')](_0x195cf2[_0xc8f0('0x2b')][_0xc8f0('0x2f')]));_0x45e311[_0xc8f0('0x2e')]=_0x45e311[_0xc8f0('0x2e')]['length']?_0x45e311['attributes']:_0x322247[_0xc8f0('0x29')];if(!_0x195cf2[_0xc8f0('0x2b')][_0xc8f0('0x30')]('nolimit')){_0x45e311[_0xc8f0('0x19')]=qs[_0xc8f0('0x19')](_0x195cf2[_0xc8f0('0x2b')][_0xc8f0('0x19')]);_0x45e311['offset']=qs[_0xc8f0('0x18')](_0x195cf2[_0xc8f0('0x2b')][_0xc8f0('0x18')]);}_0x45e311[_0xc8f0('0x31')]=qs[_0xc8f0('0x32')](_0x195cf2[_0xc8f0('0x2b')][_0xc8f0('0x32')]);_0x45e311[_0xc8f0('0x33')]=qs[_0xc8f0('0x2c')](_[_0xc8f0('0x34')](_0x195cf2['query'],_0x322247[_0xc8f0('0x2c')]));if(_0x195cf2['query'][_0xc8f0('0x35')]){_0x45e311[_0xc8f0('0x33')]=_[_0xc8f0('0x36')](_0x45e311['where'],{'$or':_[_0xc8f0('0x2a')](_0x3f7c6d,function(_0x3ff7a2){if(_0x3ff7a2[_0xc8f0('0x37')]!==_0xc8f0('0x38')){var _0x34dad8={};_0x34dad8[_0x3ff7a2[_0xc8f0('0x23')]]={'$like':'%'+_0x195cf2['query'][_0xc8f0('0x35')]+'%'};return _0x34dad8;}})});}_0x45e311=_['merge']({},_0x45e311,_0x195cf2['options']);var _0x15329a={'where':_0x45e311[_0xc8f0('0x33')]};return db[_0xc8f0('0x25')]['count'](_0x15329a)[_0xc8f0('0x1f')](function(_0x3853df){_0x2c9586[_0xc8f0('0x39')]=_0x3853df;if(_0x195cf2[_0xc8f0('0x2b')][_0xc8f0('0x3a')]){_0x45e311[_0xc8f0('0x3b')]=[{'all':!![]}];}return db[_0xc8f0('0x25')]['findAll'](_0x45e311);})[_0xc8f0('0x1f')](function(_0x4dd7f5){_0x2c9586['rows']=_0x4dd7f5;return _0x2c9586;})['then'](respondWithFilteredResult(_0x365023,_0x45e311))[_0xc8f0('0x3c')](handleError(_0x365023,null));};exports['show']=function(_0x33463a,_0x4b3a28){var _0x2a80f4={'raw':![],'where':{'id':_0x33463a[_0xc8f0('0x3d')]['id']}},_0x1b2b2c={};_0x1b2b2c[_0xc8f0('0x29')]=_[_0xc8f0('0x3e')](db[_0xc8f0('0x25')][_0xc8f0('0x26')]);_0x1b2b2c[_0xc8f0('0x2b')]=_[_0xc8f0('0x3e')](_0x33463a['query']);_0x1b2b2c[_0xc8f0('0x2c')]=_[_0xc8f0('0x2d')](_0x1b2b2c[_0xc8f0('0x29')],_0x1b2b2c[_0xc8f0('0x2b')]);_0x2a80f4[_0xc8f0('0x2e')]=_['intersection'](_0x1b2b2c['model'],qs['fields'](_0x33463a[_0xc8f0('0x2b')][_0xc8f0('0x2f')]));_0x2a80f4['attributes']=_0x2a80f4[_0xc8f0('0x2e')][_0xc8f0('0x3f')]?_0x2a80f4[_0xc8f0('0x2e')]:_0x1b2b2c[_0xc8f0('0x29')];if(_0x33463a[_0xc8f0('0x2b')][_0xc8f0('0x3a')]){_0x2a80f4[_0xc8f0('0x3b')]=[{'all':!![]}];}_0x2a80f4=_[_0xc8f0('0x36')]({},_0x2a80f4,_0x33463a['options']);return db[_0xc8f0('0x25')][_0xc8f0('0x40')](_0x2a80f4)[_0xc8f0('0x1f')](handleEntityNotFound(_0x4b3a28,null))[_0xc8f0('0x1f')](respondWithResult(_0x4b3a28,null))['catch'](handleError(_0x4b3a28,null));};exports[_0xc8f0('0x41')]=function(_0x673c28,_0x4a1e2f){return db[_0xc8f0('0x25')][_0xc8f0('0x41')](_0x673c28[_0xc8f0('0x42')],{})[_0xc8f0('0x1f')](function(_0x58d4f3){var _0x2cc955=_0x673c28[_0xc8f0('0x43')][_0xc8f0('0x20')]({'plain':!![]});if(!_0x2cc955)throw new Error(_0xc8f0('0x44'));if(_0x2cc955[_0xc8f0('0x45')]===_0xc8f0('0x43')){var _0x9cc038=_0x58d4f3[_0xc8f0('0x20')]({'plain':!![]});var _0x40ba0e=_0xc8f0('0x21');return db[_0xc8f0('0x46')][_0xc8f0('0x40')]({'where':{'name':_0x40ba0e,'userProfileId':_0x2cc955[_0xc8f0('0x47')]},'raw':!![]})[_0xc8f0('0x1f')](function(_0xedbf57){if(_0xedbf57&&_0xedbf57['autoAssociation']===0x0){return db['UserProfileResource'][_0xc8f0('0x41')]({'name':_0x9cc038[_0xc8f0('0x23')],'resourceId':_0x9cc038['id'],'type':_0xedbf57['name'],'sectionId':_0xedbf57['id']},{})[_0xc8f0('0x1f')](function(){return _0x58d4f3;});}else{return _0x58d4f3;}})['catch'](function(_0x401aae){logger[_0xc8f0('0x22')](_0xc8f0('0x48'),_0x401aae);throw _0x401aae;});}return _0x58d4f3;})[_0xc8f0('0x1f')](respondWithResult(_0x4a1e2f,0xc9))[_0xc8f0('0x3c')](handleError(_0x4a1e2f,null));};exports['update']=function(_0x2c1f6a,_0x35920c){if(_0x2c1f6a[_0xc8f0('0x42')]['id']){delete _0x2c1f6a[_0xc8f0('0x42')]['id'];}return db[_0xc8f0('0x25')][_0xc8f0('0x40')]({'where':{'id':_0x2c1f6a[_0xc8f0('0x3d')]['id']}})[_0xc8f0('0x1f')](handleEntityNotFound(_0x35920c,null))[_0xc8f0('0x1f')](saveUpdates(_0x2c1f6a[_0xc8f0('0x42')],null))[_0xc8f0('0x1f')](respondWithResult(_0x35920c,null))[_0xc8f0('0x3c')](handleError(_0x35920c,null));};exports['destroy']=function(_0x18c788,_0x281036){return db[_0xc8f0('0x25')][_0xc8f0('0x40')]({'where':{'id':_0x18c788[_0xc8f0('0x3d')]['id']}})[_0xc8f0('0x1f')](handleEntityNotFound(_0x281036,null))[_0xc8f0('0x1f')](removeEntity(_0x281036,null))[_0xc8f0('0x3c')](handleError(_0x281036,null));};exports['run']=function(_0x9d0ac9,_0x41a61b,_0x8ff8c4){var _0x107890=require(_0xc8f0('0x49'));return db[_0xc8f0('0x25')][_0xc8f0('0x40')]({'where':{'id':_0x9d0ac9[_0xc8f0('0x3d')]['id']},'raw':!![]})[_0xc8f0('0x1f')](handleEntityNotFound(_0x41a61b,null))[_0xc8f0('0x1f')](function(){_0x107890[_0xc8f0('0x4a')](_0x9d0ac9[_0xc8f0('0x3d')]['id']);})[_0xc8f0('0x1f')](respondWithStatusCode(_0x41a61b,null))[_0xc8f0('0x3c')](handleError(_0x41a61b,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index a777ac5..d6dc57a 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 _0x2c7b=['rimraf','../../config/environment','./schedule.attributes','Schedule','tools_schedules','lodash','util','api','bluebird','request-promise','path'];(function(_0x19017b,_0x56d52c){var _0x3becdc=function(_0x1e0fde){while(--_0x1e0fde){_0x19017b['push'](_0x19017b['shift']());}};_0x3becdc(++_0x56d52c);}(_0x2c7b,0x1c8));var _0xb2c7=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x2c7b[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xb2c7('0x0'));var util=require(_0xb2c7('0x1'));var logger=require('../../config/logger')(_0xb2c7('0x2'));var moment=require('moment');var BPromise=require(_0xb2c7('0x3'));var rp=require(_0xb2c7('0x4'));var fs=require('fs');var path=require(_0xb2c7('0x5'));var rimraf=require(_0xb2c7('0x6'));var config=require(_0xb2c7('0x7'));var attributes=require(_0xb2c7('0x8'));module['exports']=function(_0x403884,_0x46edb1){return _0x403884['define'](_0xb2c7('0x9'),attributes,{'tableName':_0xb2c7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe393=['api','moment','request-promise','path','rimraf','exports','Schedule','lodash','util','../../config/logger'];(function(_0x1c7137,_0x4c7c26){var _0xeb4432=function(_0x26d850){while(--_0x26d850){_0x1c7137['push'](_0x1c7137['shift']());}};_0xeb4432(++_0x4c7c26);}(_0xe393,0xe3));var _0x3e39=function(_0x5eed57,_0x224dc5){_0x5eed57=_0x5eed57-0x0;var _0x1ca877=_0xe393[_0x5eed57];return _0x1ca877;};'use strict';var _=require(_0x3e39('0x0'));var util=require(_0x3e39('0x1'));var logger=require(_0x3e39('0x2'))(_0x3e39('0x3'));var moment=require(_0x3e39('0x4'));var BPromise=require('bluebird');var rp=require(_0x3e39('0x5'));var fs=require('fs');var path=require(_0x3e39('0x6'));var rimraf=require(_0x3e39('0x7'));var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0x3e39('0x8')]=function(_0x51148e,_0x1c964b){return _0x51148e['define'](_0x3e39('0x9'),attributes,{'tableName':'tools_schedules','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 0b968c8..9c68b04 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 _0xbbb9=['moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x562fb6,_0x547e8b){var _0x26bb3a=function(_0x22a01e){while(--_0x22a01e){_0x562fb6['push'](_0x562fb6['shift']());}};_0x26bb3a(++_0x547e8b);}(_0xbbb9,0x16e));var _0x9bbb=function(_0x56f9ed,_0x4e58ee){_0x56f9ed=_0x56f9ed-0x0;var _0x253109=_0xbbb9[_0x56f9ed];return _0x253109;};'use strict';var _=require(_0x9bbb('0x0'));var util=require(_0x9bbb('0x1'));var moment=require(_0x9bbb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bbb('0x3'))['db'];var utils=require(_0x9bbb('0x4'));var logger=require(_0x9bbb('0x5'))(_0x9bbb('0x6'));var config=require(_0x9bbb('0x7'));var jayson=require(_0x9bbb('0x8'));var client=jayson['client'][_0x9bbb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d1072,_0xec20bb,_0x4420b5){return new BPromise(function(_0x9a7ed6,_0x50ec4a){return client[_0x9bbb('0xa')](_0x3d1072,_0x4420b5)[_0x9bbb('0xb')](function(_0x59fb69){logger['info'](_0x9bbb('0xc'),_0xec20bb,_0x9bbb('0xd'));logger[_0x9bbb('0xe')](_0x9bbb('0xf'),_0xec20bb,_0x9bbb('0xd'),JSON[_0x9bbb('0x10')](_0x59fb69));if(_0x59fb69[_0x9bbb('0x11')]){if(_0x59fb69['error'][_0x9bbb('0x12')]===0x1f4){logger[_0x9bbb('0x11')](_0x9bbb('0xc'),_0xec20bb,_0x59fb69[_0x9bbb('0x11')][_0x9bbb('0x13')]);return _0x50ec4a(_0x59fb69[_0x9bbb('0x11')][_0x9bbb('0x13')]);}logger[_0x9bbb('0x11')](_0x9bbb('0xc'),_0xec20bb,_0x59fb69[_0x9bbb('0x11')][_0x9bbb('0x13')]);return _0x9a7ed6(_0x59fb69[_0x9bbb('0x11')][_0x9bbb('0x13')]);}else{logger[_0x9bbb('0x14')](_0x9bbb('0xc'),_0xec20bb,_0x9bbb('0xd'));_0x9a7ed6(_0x59fb69[_0x9bbb('0x15')]['message']);}})[_0x9bbb('0x16')](function(_0x2386d8){logger['error'](_0x9bbb('0xc'),_0xec20bb,_0x2386d8);_0x50ec4a(_0x2386d8);});});} \ No newline at end of file +var _0xa40c=['code','Schedule,\x20%s,\x20%s','message','info','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2cc664,_0x37bb01){var _0x2f218b=function(_0x3d2271){while(--_0x3d2271){_0x2cc664['push'](_0x2cc664['shift']());}};_0x2f218b(++_0x37bb01);}(_0xa40c,0xdd));var _0xca40=function(_0x15b539,_0x4ece18){_0x15b539=_0x15b539-0x0;var _0x2b6dbe=_0xa40c[_0x15b539];return _0x2b6dbe;};'use strict';var _=require('lodash');var util=require(_0xca40('0x0'));var moment=require(_0xca40('0x1'));var BPromise=require('bluebird');var rs=require(_0xca40('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca40('0x3'))['db'];var utils=require(_0xca40('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xca40('0x5'));var jayson=require(_0xca40('0x6'));var client=jayson[_0xca40('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23892c,_0x418287,_0x290a40){return new BPromise(function(_0x174ef4,_0x4bb9b4){return client[_0xca40('0x8')](_0x23892c,_0x290a40)['then'](function(_0x473626){logger['info']('Schedule,\x20%s,\x20%s',_0x418287,_0xca40('0x9'));logger['debug'](_0xca40('0xa'),_0x418287,_0xca40('0x9'),JSON[_0xca40('0xb')](_0x473626));if(_0x473626[_0xca40('0xc')]){if(_0x473626[_0xca40('0xc')][_0xca40('0xd')]===0x1f4){logger[_0xca40('0xc')](_0xca40('0xe'),_0x418287,_0x473626['error'][_0xca40('0xf')]);return _0x4bb9b4(_0x473626[_0xca40('0xc')][_0xca40('0xf')]);}logger[_0xca40('0xc')](_0xca40('0xe'),_0x418287,_0x473626[_0xca40('0xc')][_0xca40('0xf')]);return _0x174ef4(_0x473626[_0xca40('0xc')][_0xca40('0xf')]);}else{logger[_0xca40('0x10')](_0xca40('0xe'),_0x418287,_0xca40('0x9'));_0x174ef4(_0x473626['result']['message']);}})[_0xca40('0x11')](function(_0x3a28c3){logger[_0xca40('0xc')](_0xca40('0xe'),_0x418287,_0x3a28c3);_0x4bb9b4(_0x3a28c3);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index f2a9a9c..36af495 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 _0xbfe4=['/:id','show','/:id/download','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x355727,_0x417965){var _0x42367b=function(_0x2cdd69){while(--_0x2cdd69){_0x355727['push'](_0x355727['shift']());}};_0x42367b(++_0x417965);}(_0xbfe4,0x78));var _0x4bfe=function(_0xcd6acd,_0x48491f){_0xcd6acd=_0xcd6acd-0x0;var _0x2b1dab=_0xbfe4[_0xcd6acd];return _0x2b1dab;};'use strict';var multer=require(_0x4bfe('0x0'));var util=require(_0x4bfe('0x1'));var path=require(_0x4bfe('0x2'));var timeout=require(_0x4bfe('0x3'));var express=require(_0x4bfe('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4bfe('0x5'));var config=require(_0x4bfe('0x6'));var controller=require(_0x4bfe('0x7'));router[_0x4bfe('0x8')]('/',auth[_0x4bfe('0x9')](),controller[_0x4bfe('0xa')]);router[_0x4bfe('0x8')](_0x4bfe('0xb'),auth['isAuthenticated'](),controller[_0x4bfe('0xc')]);router[_0x4bfe('0x8')](_0x4bfe('0xd'),auth[_0x4bfe('0x9')](),controller[_0x4bfe('0xe')]);router['get'](_0x4bfe('0xf'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x4bfe('0xd'),auth[_0x4bfe('0x9')](),controller['update']);router[_0x4bfe('0x10')](_0x4bfe('0xd'),auth[_0x4bfe('0x9')](),controller[_0x4bfe('0x11')]);module[_0x4bfe('0x12')]=router; \ No newline at end of file +var _0x8bed=['../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','create','put','delete','multer','util','path','express','Router'];(function(_0x2f9c02,_0x15719e){var _0x5d33f3=function(_0x534f68){while(--_0x534f68){_0x2f9c02['push'](_0x2f9c02['shift']());}};_0x5d33f3(++_0x15719e);}(_0x8bed,0x1f3));var _0xd8be=function(_0x381f7f,_0x1321a9){_0x381f7f=_0x381f7f-0x0;var _0xd2ae6d=_0x8bed[_0x381f7f];return _0xd2ae6d;};'use strict';var multer=require(_0xd8be('0x0'));var util=require(_0xd8be('0x1'));var path=require(_0xd8be('0x2'));var timeout=require('connect-timeout');var express=require(_0xd8be('0x3'));var router=express[_0xd8be('0x4')]();var auth=require(_0xd8be('0x5'));var interaction=require(_0xd8be('0x6'));var config=require(_0xd8be('0x7'));var controller=require(_0xd8be('0x8'));router[_0xd8be('0x9')]('/',auth[_0xd8be('0xa')](),controller[_0xd8be('0xb')]);router[_0xd8be('0x9')](_0xd8be('0xc'),auth[_0xd8be('0xa')](),controller[_0xd8be('0xd')]);router[_0xd8be('0x9')](_0xd8be('0xe'),auth['isAuthenticated'](),controller[_0xd8be('0xf')]);router[_0xd8be('0x9')](_0xd8be('0x10'),auth[_0xd8be('0xa')](),controller[_0xd8be('0x11')]);router['post']('/',auth[_0xd8be('0xa')](),controller[_0xd8be('0x12')]);router[_0xd8be('0x13')](_0xd8be('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xd8be('0x14')](_0xd8be('0xe'),auth[_0xd8be('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index b026d40..7b8dd82 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 _0xae24=['value','STRING','setDataValue','subtract','closedAt','DATE','getDataValue','startedAt','MM-DD-YYYY\x20HH:mm','toString','format','updatedAt','sequelize','path','exports','VIRTUAL','extname'];(function(_0x48b025,_0x5e879f){var _0x4ba995=function(_0x1fdc2b){while(--_0x1fdc2b){_0x48b025['push'](_0x48b025['shift']());}};_0x4ba995(++_0x5e879f);}(_0xae24,0x182));var _0x4ae2=function(_0x5942f2,_0x5b248b){_0x5942f2=_0x5942f2-0x0;var _0x3724b1=_0xae24[_0x5942f2];return _0x3724b1;};'use strict';var Sequelize=require(_0x4ae2('0x0'));var moment=require('moment');var path=require(_0x4ae2('0x1'));var config=require('../../config/environment');module[_0x4ae2('0x2')]={'format':{'type':Sequelize[_0x4ae2('0x3')],'get':function(){return this['getDataValue']('value')?path[_0x4ae2('0x4')](this['getDataValue'](_0x4ae2('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x4ae2('0x6')]},'channel':{'type':Sequelize[_0x4ae2('0x6')]},'value':{'type':Sequelize[_0x4ae2('0x6')],'set':function(_0x428054){var _0x307247=_0x428054['replace'](/\\/g,'/');this['setDataValue'](_0x4ae2('0x5'),_0x307247);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0xb5587a){this[_0x4ae2('0x7')]('startedAt',moment()[_0x4ae2('0x8')](_0xb5587a,'ms'));this[_0x4ae2('0x7')](_0x4ae2('0x9'),moment());this[_0x4ae2('0x7')]('duration',_0xb5587a);}},'startedAt':{'type':Sequelize[_0x4ae2('0xa')],'get':function(){return moment(this[_0x4ae2('0xb')](_0x4ae2('0xc')))['format'](_0x4ae2('0xd'))[_0x4ae2('0xe')]();}},'closedAt':{'type':Sequelize[_0x4ae2('0xa')],'get':function(){return moment(this[_0x4ae2('0xb')](_0x4ae2('0x9')))[_0x4ae2('0xf')](_0x4ae2('0xd'))[_0x4ae2('0xe')]();}},'createdAt':{'type':Sequelize[_0x4ae2('0xa')],'get':function(){return moment(this['getDataValue']('createdAt'))['format'](_0x4ae2('0xd'))[_0x4ae2('0xe')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x4ae2('0xb')](_0x4ae2('0x10')))[_0x4ae2('0xf')](_0x4ae2('0xd'))[_0x4ae2('0xe')]();}}}; \ No newline at end of file +var _0x4bc3=['setDataValue','INTEGER','closedAt','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','../../config/environment','exports','getDataValue','value','extname','STRING'];(function(_0x52c2d4,_0x57969d){var _0x2f42b7=function(_0x5e17e6){while(--_0x5e17e6){_0x52c2d4['push'](_0x52c2d4['shift']());}};_0x2f42b7(++_0x57969d);}(_0x4bc3,0x16e));var _0x34bc=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x4bc3[_0x5f1391];return _0x50ebe3;};'use strict';var Sequelize=require(_0x34bc('0x0'));var moment=require(_0x34bc('0x1'));var path=require('path');var config=require(_0x34bc('0x2'));module[_0x34bc('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x34bc('0x4')](_0x34bc('0x5'))?path[_0x34bc('0x6')](this[_0x34bc('0x4')](_0x34bc('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x34bc('0x7')]},'channel':{'type':Sequelize[_0x34bc('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x21451b){var _0x50320d=_0x21451b['replace'](/\\/g,'/');this[_0x34bc('0x8')](_0x34bc('0x5'),_0x50320d);}},'rating':{'type':Sequelize[_0x34bc('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x34bc('0x9')],'set':function(_0x409105){this[_0x34bc('0x8')]('startedAt',moment()['subtract'](_0x409105,'ms'));this[_0x34bc('0x8')](_0x34bc('0xa'),moment());this[_0x34bc('0x8')]('duration',_0x409105);}},'startedAt':{'type':Sequelize[_0x34bc('0xb')],'get':function(){return moment(this['getDataValue'](_0x34bc('0xc')))[_0x34bc('0xd')](_0x34bc('0xe'))['toString']();}},'closedAt':{'type':Sequelize[_0x34bc('0xb')],'get':function(){return moment(this['getDataValue'](_0x34bc('0xa')))[_0x34bc('0xd')](_0x34bc('0xe'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x34bc('0x4')]('createdAt'))[_0x34bc('0xd')](_0x34bc('0xe'))[_0x34bc('0xf')]();}},'updatedAt':{'type':Sequelize[_0x34bc('0xb')],'get':function(){return moment(this[_0x34bc('0x4')](_0x34bc('0x10')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 3fb84b7..ea9ff5b 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 _0xa5b6=['util','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','differenceBy','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','ScreenRecording','includeAll','include','findAll','catch','params','find','create','body','duration','createdAt','closedAt','value','describe','download','uniqueid','join','root','server/files/screen_recordings','format','decryptFile','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','existsSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','rimraf','fast-json-patch','bluebird','mustache'];(function(_0x5ef758,_0x2e8112){var _0x599ddc=function(_0x35b91b){while(--_0x35b91b){_0x5ef758['push'](_0x5ef758['shift']());}};_0x599ddc(++_0x2e8112);}(_0xa5b6,0x1e0));var _0x6a5b=function(_0x41382c,_0xc3ffd1){_0x41382c=_0x41382c-0x0;var _0x4da35b=_0xa5b6[_0x41382c];return _0x4da35b;};'use strict';var pdf=require(_0x6a5b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6a5b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6a5b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6a5b('0x3'));var Mustache=require(_0x6a5b('0x4'));var util=require(_0x6a5b('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6a5b('0x6'));var fs=require('fs');var _=require(_0x6a5b('0x7'));var squel=require(_0x6a5b('0x8'));var crypto=require(_0x6a5b('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x6a5b('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6a5b('0xb'));var Redis=require(_0x6a5b('0xc'));var authService=require(_0x6a5b('0xd'));var qs=require(_0x6a5b('0xe'));var as=require(_0x6a5b('0xf'));var hardwareService=require(_0x6a5b('0x10'));var logger=require(_0x6a5b('0x11'))(_0x6a5b('0x12'));var utils=require(_0x6a5b('0x13'));var config=require(_0x6a5b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1edb9a,_0x167177){_0x167177=_0x167177||0xcc;return function(_0x173ff5){if(_0x173ff5){return _0x1edb9a[_0x6a5b('0x15')](_0x167177);}return _0x1edb9a[_0x6a5b('0x16')](_0x167177)[_0x6a5b('0x17')]();};}function respondWithResult(_0x2b6424,_0x45cc06){_0x45cc06=_0x45cc06||0xc8;return function(_0x195806){if(_0x195806){return _0x2b6424[_0x6a5b('0x16')](_0x45cc06)['json'](_0x195806);}};}function respondWithFilteredResult(_0x946e8e,_0x355439){return function(_0x497e67){if(_0x497e67){var _0x2d5883=_0x497e67[_0x6a5b('0x18')],_0x3281f1=_0x355439[_0x6a5b('0x19')],_0x12243c=_0x355439[_0x6a5b('0x19')]+_0x355439[_0x6a5b('0x1a')],_0x545e8c;if(_0x12243c>=_0x2d5883){_0x12243c=_0x2d5883;_0x545e8c=0xc8;}else{_0x545e8c=0xce;}_0x946e8e[_0x6a5b('0x16')](_0x545e8c);return _0x946e8e[_0x6a5b('0x1b')](_0x6a5b('0x1c'),_0x3281f1+'-'+_0x12243c+'/'+_0x2d5883)[_0x6a5b('0x1d')](_0x497e67);}return null;};}function patchUpdates(_0x27f0e7){return function(_0x371791){try{jsonpatch[_0x6a5b('0x1e')](_0x371791,_0x27f0e7,!![]);}catch(_0x23cbac){return BPromise['reject'](_0x23cbac);}return _0x371791['save']();};}function saveUpdates(_0x315a35,_0x5d87f7){return function(_0x110701){if(_0x110701){return _0x110701[_0x6a5b('0x1f')](_0x315a35)[_0x6a5b('0x20')](function(_0x4695c5){return _0x4695c5;});}return null;};}function removeEntity(_0x3c4a46,_0x41f913){return function(_0x5cd26d){if(_0x5cd26d){return _0x5cd26d['destroy']()[_0x6a5b('0x20')](function(){_0x3c4a46[_0x6a5b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x345076,_0x543ca5){return function(_0x117eda){if(!_0x117eda){_0x345076[_0x6a5b('0x15')](0x194);}return _0x117eda;};}function handleError(_0x3a73d7,_0x3892f1){_0x3892f1=_0x3892f1||0x1f4;return function(_0x4e9786){logger['error'](_0x4e9786[_0x6a5b('0x21')]);if(_0x4e9786['name']){delete _0x4e9786[_0x6a5b('0x22')];}_0x3a73d7[_0x6a5b('0x16')](_0x3892f1)[_0x6a5b('0x23')](_0x4e9786);};}exports[_0x6a5b('0x24')]=function(_0x29af91,_0xea3706){var _0x1b8c1d={},_0x3b5142={},_0x3d0fcf={'count':0x0,'rows':[]};var _0x179219=_[_0x6a5b('0x25')](db['ScreenRecording'][_0x6a5b('0x26')],function(_0x46a674){return{'name':_0x46a674[_0x6a5b('0x27')],'type':_0x46a674[_0x6a5b('0x28')][_0x6a5b('0x29')]};});_0x3b5142['model']=_[_0x6a5b('0x2a')](_['map'](_0x179219,_0x6a5b('0x22')),['format']);_0x3b5142[_0x6a5b('0x2b')]=_[_0x6a5b('0x2c')](_0x29af91[_0x6a5b('0x2b')]);_0x3b5142[_0x6a5b('0x2d')]=_[_0x6a5b('0x2e')](_0x3b5142[_0x6a5b('0x2f')],_0x3b5142['query']);_0x1b8c1d[_0x6a5b('0x30')]=_[_0x6a5b('0x2e')](_0x3b5142['model'],qs['fields'](_0x29af91[_0x6a5b('0x2b')][_0x6a5b('0x31')]));_0x1b8c1d[_0x6a5b('0x30')]=_0x1b8c1d[_0x6a5b('0x30')][_0x6a5b('0x32')]?_0x1b8c1d[_0x6a5b('0x30')]:_0x3b5142[_0x6a5b('0x2f')];if(!_0x29af91[_0x6a5b('0x2b')][_0x6a5b('0x33')](_0x6a5b('0x34'))){_0x1b8c1d[_0x6a5b('0x1a')]=qs['limit'](_0x29af91[_0x6a5b('0x2b')][_0x6a5b('0x1a')]);_0x1b8c1d[_0x6a5b('0x19')]=qs[_0x6a5b('0x19')](_0x29af91[_0x6a5b('0x2b')][_0x6a5b('0x19')]);}_0x1b8c1d[_0x6a5b('0x35')]=qs[_0x6a5b('0x36')](_0x29af91[_0x6a5b('0x2b')][_0x6a5b('0x36')]);_0x1b8c1d[_0x6a5b('0x37')]=qs['filters'](_[_0x6a5b('0x38')](_0x29af91[_0x6a5b('0x2b')],_0x3b5142[_0x6a5b('0x2d')]));if(_0x29af91['query'][_0x6a5b('0x39')]){_0x1b8c1d[_0x6a5b('0x37')]=_['merge'](_0x1b8c1d[_0x6a5b('0x37')],{'$or':_[_0x6a5b('0x25')](_0x179219,function(_0x5957bd){if(_0x5957bd[_0x6a5b('0x28')]!==_0x6a5b('0x3a')){var _0x101ce0={};_0x101ce0[_0x5957bd['name']]={'$like':'%'+_0x29af91['query'][_0x6a5b('0x39')]+'%'};return _0x101ce0;}})});}_0x1b8c1d=_['merge']({},_0x1b8c1d,_0x29af91[_0x6a5b('0x3b')]);var _0x5ad116={'where':_0x1b8c1d[_0x6a5b('0x37')]};return db[_0x6a5b('0x3c')]['count'](_0x5ad116)['then'](function(_0x11f389){_0x3d0fcf['count']=_0x11f389;if(_0x29af91[_0x6a5b('0x2b')][_0x6a5b('0x3d')]){_0x1b8c1d[_0x6a5b('0x3e')]=[{'all':!![]}];}return db[_0x6a5b('0x3c')][_0x6a5b('0x3f')](_0x1b8c1d);})[_0x6a5b('0x20')](function(_0x1c8b0d){_0x3d0fcf['rows']=_0x1c8b0d;return _0x3d0fcf;})[_0x6a5b('0x20')](respondWithFilteredResult(_0xea3706,_0x1b8c1d))[_0x6a5b('0x40')](handleError(_0xea3706,null));};exports['show']=function(_0x104143,_0x32f542){var _0x183c60={'raw':![],'where':{'id':_0x104143[_0x6a5b('0x41')]['id']}},_0x1efb71={};_0x1efb71[_0x6a5b('0x2f')]=_[_0x6a5b('0x2c')](db[_0x6a5b('0x3c')][_0x6a5b('0x26')]);_0x1efb71[_0x6a5b('0x2b')]=_['keys'](_0x104143['query']);_0x1efb71[_0x6a5b('0x2d')]=_['intersection'](_0x1efb71[_0x6a5b('0x2f')],_0x1efb71[_0x6a5b('0x2b')]);_0x183c60[_0x6a5b('0x30')]=_['intersection'](_0x1efb71[_0x6a5b('0x2f')],qs['fields'](_0x104143[_0x6a5b('0x2b')][_0x6a5b('0x31')]));_0x183c60[_0x6a5b('0x30')]=_0x183c60['attributes']['length']?_0x183c60['attributes']:_0x1efb71[_0x6a5b('0x2f')];if(_0x104143[_0x6a5b('0x2b')][_0x6a5b('0x3d')]){_0x183c60['include']=[{'all':!![]}];}_0x183c60=_['merge']({},_0x183c60,_0x104143[_0x6a5b('0x3b')]);return db[_0x6a5b('0x3c')][_0x6a5b('0x42')](_0x183c60)['then'](handleEntityNotFound(_0x32f542,null))['then'](respondWithResult(_0x32f542,null))[_0x6a5b('0x40')](handleError(_0x32f542,null));};exports[_0x6a5b('0x43')]=function(_0x40f9bb,_0x3f144e){return db['ScreenRecording'][_0x6a5b('0x43')](_0x40f9bb[_0x6a5b('0x44')],{})[_0x6a5b('0x20')](respondWithResult(_0x3f144e,0xc9))[_0x6a5b('0x40')](handleError(_0x3f144e,null));};exports[_0x6a5b('0x1f')]=function(_0x399461,_0x4e2134){if(_0x399461[_0x6a5b('0x44')]['id']){delete _0x399461[_0x6a5b('0x44')]['id'];}delete _0x399461[_0x6a5b('0x44')][_0x6a5b('0x45')];delete _0x399461['body'][_0x6a5b('0x46')];delete _0x399461[_0x6a5b('0x44')][_0x6a5b('0x47')];delete _0x399461[_0x6a5b('0x44')][_0x6a5b('0x48')];return db[_0x6a5b('0x3c')][_0x6a5b('0x42')]({'where':{'id':_0x399461[_0x6a5b('0x41')]['id']}})[_0x6a5b('0x20')](handleEntityNotFound(_0x4e2134,null))[_0x6a5b('0x20')](saveUpdates(_0x399461['body'],null))[_0x6a5b('0x20')](respondWithResult(_0x4e2134,null))[_0x6a5b('0x40')](handleError(_0x4e2134,null));};exports[_0x6a5b('0x49')]=function(_0x1c49d9,_0x38df41){return db[_0x6a5b('0x3c')][_0x6a5b('0x49')]()[_0x6a5b('0x20')](respondWithResult(_0x38df41,null))[_0x6a5b('0x40')](handleError(_0x38df41,null));};exports[_0x6a5b('0x4a')]=function(_0x9c2c66,_0x4080e0,_0x8066c7){var _0x691c03=require('../../components/encryptor');var _0x416e51=![];var _0x2c7ff4={};if(_0x9c2c66[_0x6a5b('0x2b')]['type']&&_0x9c2c66['query'][_0x6a5b('0x28')]===_0x6a5b('0x4b')){_0x2c7ff4[_0x6a5b('0x4b')]=_0x9c2c66[_0x6a5b('0x41')]['id'];}else{_0x2c7ff4['id']=_0x9c2c66[_0x6a5b('0x41')]['id'];}return db[_0x6a5b('0x3c')][_0x6a5b('0x42')]({'where':_0x2c7ff4,'attributes':['id','value'],'raw':!![]})[_0x6a5b('0x20')](handleEntityNotFound(_0x4080e0,null))[_0x6a5b('0x20')](function(_0x4b3767){if(_0x4b3767){var _0x27cbe6=path[_0x6a5b('0x4c')](config[_0x6a5b('0x4d')],_0x6a5b('0x4e'),_0x4b3767[_0x6a5b('0x48')]);var _0x29165b=util[_0x6a5b('0x4f')]('%s.cypher',_0x27cbe6);if(fs['existsSync'](_0x29165b)){_0x416e51=!![];return _0x691c03[_0x6a5b('0x50')](_0x29165b,_0x27cbe6,config['secrets'][_0x6a5b('0x51')])[_0x6a5b('0x20')](function(){return _0x4b3767;});}return _0x4b3767;}})[_0x6a5b('0x20')](function(_0x12e339){if(_0x12e339){var _0x13fde8=path[_0x6a5b('0x4c')](config[_0x6a5b('0x4d')],'server/files/screen_recordings',_0x12e339[_0x6a5b('0x48')]);if(!fs['existsSync'](_0x13fde8)){throw new db[(_0x6a5b('0x52'))][(_0x6a5b('0x53'))](_0x6a5b('0x54'));}if(_0x12e339[_0x6a5b('0x55')]){return _0x4080e0[_0x6a5b('0x4a')](_0x13fde8,_0x12e339[_0x6a5b('0x55')]+path[_0x6a5b('0x56')](_0x13fde8),function(){if(_0x416e51){fs['unlink'](_0x13fde8);}});}else{return _0x4080e0[_0x6a5b('0x4a')](_0x13fde8,function(_0x5f5be9){if(_0x416e51){fs[_0x6a5b('0x57')](_0x13fde8);}});}}})[_0x6a5b('0x40')](function(_0x3c21f7){if(_0x3c21f7['message']===_0x6a5b('0x54')){_0x4080e0[_0x6a5b('0x16')](0x194)['send'](_0x6a5b('0x58'));}else{return handleError(_0x4080e0,null);}});};exports[_0x6a5b('0x59')]=function(_0x137af3,_0x458ec1){return db[_0x6a5b('0x3c')][_0x6a5b('0x42')]({'where':{'id':_0x137af3[_0x6a5b('0x41')]['id']}})[_0x6a5b('0x20')](function(_0x5adeec){if(!_0x5adeec)throw new ReferenceError(_0x6a5b('0x5a'));return _0x5adeec;})['then'](function(_0x4e0413){var _0x750d75=path[_0x6a5b('0x4c')](config[_0x6a5b('0x4d')],'server/files/screen_recordings',_0x4e0413['value']);logger[_0x6a5b('0x5b')](_0x6a5b('0x5c'),_0x750d75);if(!_[_0x6a5b('0x5d')](_0x4e0413[_0x6a5b('0x48')])&&fs[_0x6a5b('0x5e')](_0x750d75)){logger[_0x6a5b('0x5b')]('File:\x20\x22'+_0x750d75+_0x6a5b('0x5f'));fs[_0x6a5b('0x60')](_0x750d75);}_0x750d75=_0x750d75+'.cypher';if(!_[_0x6a5b('0x5d')](_0x4e0413['value'])&&fs[_0x6a5b('0x5e')](_0x750d75)){logger[_0x6a5b('0x5b')]('File:\x20\x22'+_0x750d75+_0x6a5b('0x5f'));fs[_0x6a5b('0x60')](_0x750d75);}return _0x4e0413;})['then'](function(_0x384ae1){if(!_0x384ae1)throw new InternalError();return _0x384ae1[_0x6a5b('0x59')]();})[_0x6a5b('0x20')](function(){_0x458ec1[_0x6a5b('0x16')](0xcc)['end']();})[_0x6a5b('0x40')](handleError(_0x458ec1,null));}; \ No newline at end of file +var _0x28e4=['uniqueid','join','root','secrets','recording','server/files/screen_recordings','existsSync','ValidationError','ScreenRecording\x20not\x20found','download','filename','extname','unlink','message','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','update','then','error','stack','name','send','map','rawAttributes','fieldName','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','ScreenRecording','include','findAll','rows','catch','show','params','includeAll','create','body','duration','createdAt','closedAt','value','find','describe','../../components/encryptor'];(function(_0x45c99e,_0x8e5f89){var _0x3de3a8=function(_0x821196){while(--_0x821196){_0x45c99e['push'](_0x45c99e['shift']());}};_0x3de3a8(++_0x8e5f89);}(_0x28e4,0x81));var _0x428e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x28e4[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x428e('0x0'));var rimraf=require(_0x428e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x428e('0x2'));var rp=require(_0x428e('0x3'));var moment=require(_0x428e('0x4'));var BPromise=require(_0x428e('0x5'));var Mustache=require(_0x428e('0x6'));var util=require(_0x428e('0x7'));var path=require(_0x428e('0x8'));var sox=require('sox');var csv=require(_0x428e('0x9'));var ejs=require(_0x428e('0xa'));var fs=require('fs');var _=require(_0x428e('0xb'));var squel=require(_0x428e('0xc'));var crypto=require(_0x428e('0xd'));var jsforce=require(_0x428e('0xe'));var deskjs=require(_0x428e('0xf'));var toCsv=require(_0x428e('0x9'));var querystring=require(_0x428e('0x10'));var Papa=require(_0x428e('0x11'));var Redis=require(_0x428e('0x12'));var authService=require(_0x428e('0x13'));var qs=require(_0x428e('0x14'));var as=require(_0x428e('0x15'));var hardwareService=require(_0x428e('0x16'));var logger=require(_0x428e('0x17'))('api');var utils=require(_0x428e('0x18'));var config=require(_0x428e('0x19'));var db=require(_0x428e('0x1a'))['db'];function respondWithStatusCode(_0x19db24,_0xd3aa67){_0xd3aa67=_0xd3aa67||0xcc;return function(_0x29b975){if(_0x29b975){return _0x19db24[_0x428e('0x1b')](_0xd3aa67);}return _0x19db24[_0x428e('0x1c')](_0xd3aa67)[_0x428e('0x1d')]();};}function respondWithResult(_0x348193,_0x217be1){_0x217be1=_0x217be1||0xc8;return function(_0x2da3e7){if(_0x2da3e7){return _0x348193[_0x428e('0x1c')](_0x217be1)[_0x428e('0x1e')](_0x2da3e7);}};}function respondWithFilteredResult(_0x44f87f,_0x431d19){return function(_0x11a0cd){if(_0x11a0cd){var _0x2d5732=_0x11a0cd[_0x428e('0x1f')],_0x3ad8e0=_0x431d19[_0x428e('0x20')],_0x22f35e=_0x431d19['offset']+_0x431d19['limit'],_0xda71d7;if(_0x22f35e>=_0x2d5732){_0x22f35e=_0x2d5732;_0xda71d7=0xc8;}else{_0xda71d7=0xce;}_0x44f87f['status'](_0xda71d7);return _0x44f87f[_0x428e('0x21')](_0x428e('0x22'),_0x3ad8e0+'-'+_0x22f35e+'/'+_0x2d5732)[_0x428e('0x1e')](_0x11a0cd);}return null;};}function patchUpdates(_0x3e929a){return function(_0xb4c1bd){try{jsonpatch[_0x428e('0x23')](_0xb4c1bd,_0x3e929a,!![]);}catch(_0x24e2b1){return BPromise['reject'](_0x24e2b1);}return _0xb4c1bd['save']();};}function saveUpdates(_0x35a568,_0x25b1a1){return function(_0x4e77fa){if(_0x4e77fa){return _0x4e77fa[_0x428e('0x24')](_0x35a568)[_0x428e('0x25')](function(_0x303422){return _0x303422;});}return null;};}function removeEntity(_0x151992,_0x4d550d){return function(_0x56341a){if(_0x56341a){return _0x56341a['destroy']()[_0x428e('0x25')](function(){_0x151992[_0x428e('0x1c')](0xcc)[_0x428e('0x1d')]();});}};}function handleEntityNotFound(_0x6bd8b3,_0x4c70bb){return function(_0x24ef03){if(!_0x24ef03){_0x6bd8b3['sendStatus'](0x194);}return _0x24ef03;};}function handleError(_0x28ac72,_0xf6c82d){_0xf6c82d=_0xf6c82d||0x1f4;return function(_0x2d7a5f){logger[_0x428e('0x26')](_0x2d7a5f[_0x428e('0x27')]);if(_0x2d7a5f[_0x428e('0x28')]){delete _0x2d7a5f['name'];}_0x28ac72[_0x428e('0x1c')](_0xf6c82d)[_0x428e('0x29')](_0x2d7a5f);};}exports['index']=function(_0x475982,_0x2f93d3){var _0x19be88={},_0x695ba0={},_0x453bcb={'count':0x0,'rows':[]};var _0x4bfed1=_[_0x428e('0x2a')](db['ScreenRecording'][_0x428e('0x2b')],function(_0x3fc015){return{'name':_0x3fc015[_0x428e('0x2c')],'type':_0x3fc015[_0x428e('0x2d')]['key']};});_0x695ba0[_0x428e('0x2e')]=_[_0x428e('0x2f')](_[_0x428e('0x2a')](_0x4bfed1,_0x428e('0x28')),[_0x428e('0x30')]);_0x695ba0[_0x428e('0x31')]=_[_0x428e('0x32')](_0x475982['query']);_0x695ba0[_0x428e('0x33')]=_[_0x428e('0x34')](_0x695ba0['model'],_0x695ba0['query']);_0x19be88[_0x428e('0x35')]=_[_0x428e('0x34')](_0x695ba0[_0x428e('0x2e')],qs[_0x428e('0x36')](_0x475982['query'][_0x428e('0x36')]));_0x19be88[_0x428e('0x35')]=_0x19be88[_0x428e('0x35')][_0x428e('0x37')]?_0x19be88[_0x428e('0x35')]:_0x695ba0['model'];if(!_0x475982[_0x428e('0x31')]['hasOwnProperty'](_0x428e('0x38'))){_0x19be88['limit']=qs['limit'](_0x475982[_0x428e('0x31')][_0x428e('0x39')]);_0x19be88['offset']=qs['offset'](_0x475982[_0x428e('0x31')][_0x428e('0x20')]);}_0x19be88[_0x428e('0x3a')]=qs[_0x428e('0x3b')](_0x475982[_0x428e('0x31')]['sort']);_0x19be88[_0x428e('0x3c')]=qs['filters'](_[_0x428e('0x3d')](_0x475982[_0x428e('0x31')],_0x695ba0[_0x428e('0x33')]));if(_0x475982[_0x428e('0x31')]['filter']){_0x19be88['where']=_['merge'](_0x19be88[_0x428e('0x3c')],{'$or':_[_0x428e('0x2a')](_0x4bfed1,function(_0x263476){if(_0x263476[_0x428e('0x2d')]!==_0x428e('0x3e')){var _0x710a87={};_0x710a87[_0x263476['name']]={'$like':'%'+_0x475982['query'][_0x428e('0x3f')]+'%'};return _0x710a87;}})});}_0x19be88=_[_0x428e('0x40')]({},_0x19be88,_0x475982[_0x428e('0x41')]);var _0x1a91ea={'where':_0x19be88[_0x428e('0x3c')]};return db[_0x428e('0x42')][_0x428e('0x1f')](_0x1a91ea)[_0x428e('0x25')](function(_0xe9b7b7){_0x453bcb['count']=_0xe9b7b7;if(_0x475982[_0x428e('0x31')]['includeAll']){_0x19be88[_0x428e('0x43')]=[{'all':!![]}];}return db[_0x428e('0x42')][_0x428e('0x44')](_0x19be88);})[_0x428e('0x25')](function(_0x2c3e41){_0x453bcb[_0x428e('0x45')]=_0x2c3e41;return _0x453bcb;})[_0x428e('0x25')](respondWithFilteredResult(_0x2f93d3,_0x19be88))[_0x428e('0x46')](handleError(_0x2f93d3,null));};exports[_0x428e('0x47')]=function(_0x29e416,_0xf9b382){var _0x58b48b={'raw':![],'where':{'id':_0x29e416[_0x428e('0x48')]['id']}},_0x5dfa3a={};_0x5dfa3a[_0x428e('0x2e')]=_[_0x428e('0x32')](db[_0x428e('0x42')][_0x428e('0x2b')]);_0x5dfa3a[_0x428e('0x31')]=_[_0x428e('0x32')](_0x29e416[_0x428e('0x31')]);_0x5dfa3a[_0x428e('0x33')]=_[_0x428e('0x34')](_0x5dfa3a[_0x428e('0x2e')],_0x5dfa3a['query']);_0x58b48b[_0x428e('0x35')]=_['intersection'](_0x5dfa3a['model'],qs[_0x428e('0x36')](_0x29e416['query'][_0x428e('0x36')]));_0x58b48b[_0x428e('0x35')]=_0x58b48b[_0x428e('0x35')][_0x428e('0x37')]?_0x58b48b[_0x428e('0x35')]:_0x5dfa3a[_0x428e('0x2e')];if(_0x29e416[_0x428e('0x31')][_0x428e('0x49')]){_0x58b48b[_0x428e('0x43')]=[{'all':!![]}];}_0x58b48b=_['merge']({},_0x58b48b,_0x29e416[_0x428e('0x41')]);return db['ScreenRecording']['find'](_0x58b48b)[_0x428e('0x25')](handleEntityNotFound(_0xf9b382,null))[_0x428e('0x25')](respondWithResult(_0xf9b382,null))[_0x428e('0x46')](handleError(_0xf9b382,null));};exports[_0x428e('0x4a')]=function(_0x5af646,_0x38bffb){return db[_0x428e('0x42')][_0x428e('0x4a')](_0x5af646[_0x428e('0x4b')],{})[_0x428e('0x25')](respondWithResult(_0x38bffb,0xc9))[_0x428e('0x46')](handleError(_0x38bffb,null));};exports['update']=function(_0x4a4ed9,_0x58d971){if(_0x4a4ed9[_0x428e('0x4b')]['id']){delete _0x4a4ed9[_0x428e('0x4b')]['id'];}delete _0x4a4ed9[_0x428e('0x4b')][_0x428e('0x4c')];delete _0x4a4ed9[_0x428e('0x4b')][_0x428e('0x4d')];delete _0x4a4ed9[_0x428e('0x4b')][_0x428e('0x4e')];delete _0x4a4ed9[_0x428e('0x4b')][_0x428e('0x4f')];return db[_0x428e('0x42')][_0x428e('0x50')]({'where':{'id':_0x4a4ed9[_0x428e('0x48')]['id']}})['then'](handleEntityNotFound(_0x58d971,null))[_0x428e('0x25')](saveUpdates(_0x4a4ed9['body'],null))['then'](respondWithResult(_0x58d971,null))[_0x428e('0x46')](handleError(_0x58d971,null));};exports['describe']=function(_0x167ae6,_0xb3cfcb){return db[_0x428e('0x42')][_0x428e('0x51')]()[_0x428e('0x25')](respondWithResult(_0xb3cfcb,null))[_0x428e('0x46')](handleError(_0xb3cfcb,null));};exports['download']=function(_0x3f8ccd,_0x44fb19,_0x3a6e71){var _0xad865e=require(_0x428e('0x52'));var _0x17e766=![];var _0x5b616e={};if(_0x3f8ccd[_0x428e('0x31')][_0x428e('0x2d')]&&_0x3f8ccd['query'][_0x428e('0x2d')]===_0x428e('0x53')){_0x5b616e[_0x428e('0x53')]=_0x3f8ccd[_0x428e('0x48')]['id'];}else{_0x5b616e['id']=_0x3f8ccd['params']['id'];}return db['ScreenRecording'][_0x428e('0x50')]({'where':_0x5b616e,'attributes':['id',_0x428e('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x44fb19,null))['then'](function(_0x5dc157){if(_0x5dc157){var _0x340756=path[_0x428e('0x54')](config[_0x428e('0x55')],'server/files/screen_recordings',_0x5dc157['value']);var _0x5cba48=util[_0x428e('0x30')]('%s.cypher',_0x340756);if(fs['existsSync'](_0x5cba48)){_0x17e766=!![];return _0xad865e['decryptFile'](_0x5cba48,_0x340756,config[_0x428e('0x56')][_0x428e('0x57')])[_0x428e('0x25')](function(){return _0x5dc157;});}return _0x5dc157;}})[_0x428e('0x25')](function(_0x1ef356){if(_0x1ef356){var _0x17651d=path[_0x428e('0x54')](config[_0x428e('0x55')],_0x428e('0x58'),_0x1ef356['value']);if(!fs[_0x428e('0x59')](_0x17651d)){throw new db['Sequelize'][(_0x428e('0x5a'))](_0x428e('0x5b'));}if(_0x1ef356['filename']){return _0x44fb19[_0x428e('0x5c')](_0x17651d,_0x1ef356[_0x428e('0x5d')]+path[_0x428e('0x5e')](_0x17651d),function(){if(_0x17e766){fs[_0x428e('0x5f')](_0x17651d);}});}else{return _0x44fb19['download'](_0x17651d,function(_0x262fc1){if(_0x17e766){fs['unlink'](_0x17651d);}});}}})[_0x428e('0x46')](function(_0x3c28aa){if(_0x3c28aa[_0x428e('0x60')]===_0x428e('0x5b')){_0x44fb19[_0x428e('0x1c')](0x194)['send']('Not\x20found');}else{return handleError(_0x44fb19,null);}});};exports[_0x428e('0x61')]=function(_0x25712d,_0x2245c3){return db['ScreenRecording'][_0x428e('0x50')]({'where':{'id':_0x25712d[_0x428e('0x48')]['id']}})['then'](function(_0x23a2d1){if(!_0x23a2d1)throw new ReferenceError(_0x428e('0x62'));return _0x23a2d1;})[_0x428e('0x25')](function(_0x172d18){var _0x5cdc92=path[_0x428e('0x54')](config['root'],'server/files/screen_recordings',_0x172d18[_0x428e('0x4f')]);logger[_0x428e('0x63')](_0x428e('0x64'),_0x5cdc92);if(!_[_0x428e('0x65')](_0x172d18[_0x428e('0x4f')])&&fs['existsSync'](_0x5cdc92)){logger[_0x428e('0x63')](_0x428e('0x66')+_0x5cdc92+_0x428e('0x67'));fs['unlinkSync'](_0x5cdc92);}_0x5cdc92=_0x5cdc92+_0x428e('0x68');if(!_['isNil'](_0x172d18[_0x428e('0x4f')])&&fs[_0x428e('0x59')](_0x5cdc92)){logger[_0x428e('0x63')](_0x428e('0x66')+_0x5cdc92+_0x428e('0x67'));fs[_0x428e('0x69')](_0x5cdc92);}return _0x172d18;})[_0x428e('0x25')](function(_0x27b6b0){if(!_0x27b6b0)throw new InternalError();return _0x27b6b0[_0x428e('0x61')]();})[_0x428e('0x25')](function(){_0x2245c3[_0x428e('0x1c')](0xcc)[_0x428e('0x1d')]();})[_0x428e('0x46')](handleError(_0x2245c3,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index edc9d52..f194c67 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 _0xb5d5=['bluebird','rimraf','../../config/environment','./screenRecording.attributes','exports','define','screen_recordings','interactionid','lodash','util','api','moment'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xb5d5,0xd4));var _0x5b5d=function(_0x36cd0a,_0x36c909){_0x36cd0a=_0x36cd0a-0x0;var _0x33e762=_0xb5d5[_0x36cd0a];return _0x33e762;};'use strict';var _=require(_0x5b5d('0x0'));var util=require(_0x5b5d('0x1'));var logger=require('../../config/logger')(_0x5b5d('0x2'));var moment=require(_0x5b5d('0x3'));var BPromise=require(_0x5b5d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5b5d('0x5'));var config=require(_0x5b5d('0x6'));var attributes=require(_0x5b5d('0x7'));module[_0x5b5d('0x8')]=function(_0x3b3134,_0x4ecd9f){return _0x3b3134[_0x5b5d('0x9')]('ScreenRecording',attributes,{'tableName':_0x5b5d('0xa'),'paranoid':![],'indexes':[{'name':_0x5b5d('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x432c=['./screenRecording.attributes','define','interactionid','lodash','util','api','moment','path','rimraf','../../config/environment'];(function(_0x5e6c6b,_0x394668){var _0x14a242=function(_0x5dc425){while(--_0x5dc425){_0x5e6c6b['push'](_0x5e6c6b['shift']());}};_0x14a242(++_0x394668);}(_0x432c,0x16b));var _0xc432=function(_0x2da563,_0x52eb28){_0x2da563=_0x2da563-0x0;var _0x518093=_0x432c[_0x2da563];return _0x518093;};'use strict';var _=require(_0xc432('0x0'));var util=require(_0xc432('0x1'));var logger=require('../../config/logger')(_0xc432('0x2'));var moment=require(_0xc432('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc432('0x4'));var rimraf=require(_0xc432('0x5'));var config=require(_0xc432('0x6'));var attributes=require(_0xc432('0x7'));module['exports']=function(_0x173fb9,_0x1c7b6f){return _0x173fb9[_0xc432('0x8')]('ScreenRecording',attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xc432('0x9'),'fields':[_0xc432('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index ab8ee76..78e183d 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(_0x243be0,_0x22a423){var _0x2dd517=function(_0x4ca7d2){while(--_0x4ca7d2){_0x243be0['push'](_0x243be0['shift']());}};_0x2dd517(++_0x22a423);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ 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(_0x170af3,_0x430995){var _0x130f53=function(_0x1235a3){while(--_0x1235a3){_0x170af3['push'](_0x170af3['shift']());}};_0x130f53(++_0x430995);}(_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);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index d88ac10..ad39d89 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 _0x6c2d=['/:id/favicon','diskStorage','join','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','file','addLogo','logologin','addLogoLogin','root','preferred','favicon','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/logo','/:id/logo_login','gdpr','/:id/preferred','getPreferred'];(function(_0x4811a5,_0x48fadc){var _0x1c6a8a=function(_0x2435e2){while(--_0x2435e2){_0x4811a5['push'](_0x4811a5['shift']());}};_0x1c6a8a(++_0x48fadc);}(_0x6c2d,0x1d0));var _0xd6c2=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0x6c2d[_0x5d4f12];return _0x4eb577;};'use strict';var multer=require(_0xd6c2('0x0'));var util=require(_0xd6c2('0x1'));var path=require(_0xd6c2('0x2'));var timeout=require(_0xd6c2('0x3'));var express=require(_0xd6c2('0x4'));var router=express['Router']();var auth=require(_0xd6c2('0x5'));var interaction=require(_0xd6c2('0x6'));var config=require(_0xd6c2('0x7'));var controller=require('./setting.controller');router[_0xd6c2('0x8')]('/',auth[_0xd6c2('0x9')](),controller['index']);router[_0xd6c2('0x8')](_0xd6c2('0xa'),controller[_0xd6c2('0xb')]);router[_0xd6c2('0x8')](_0xd6c2('0xc'),controller['getLogo']);router[_0xd6c2('0x8')](_0xd6c2('0xd'),controller['getLogoLogin']);router[_0xd6c2('0x8')]('/:id/gdpr',controller[_0xd6c2('0xe')]);router[_0xd6c2('0x8')](_0xd6c2('0xf'),controller[_0xd6c2('0x10')]);router[_0xd6c2('0x8')](_0xd6c2('0x11'),controller['getFavicon']);var upload=multer({'storage':multer[_0xd6c2('0x12')]({'destination':function(_0x1bd8b8,_0x1c5a03,_0x3bdca7){_0x3bdca7(null,path[_0xd6c2('0x13')](config['root'],_0xd6c2('0x14')));},'filename':function(_0xc9baf7,_0x482fd2,_0x4793ba){_0x4793ba(null,util[_0xd6c2('0x15')](_0xd6c2('0x16'),_0xd6c2('0x17'),path[_0xd6c2('0x18')](_0x482fd2[_0xd6c2('0x19')])));}})});router[_0xd6c2('0x1a')](_0xd6c2('0xc'),upload[_0xd6c2('0x1b')](_0xd6c2('0x1c')),controller[_0xd6c2('0x1d')]);var upload=multer({'storage':multer[_0xd6c2('0x12')]({'destination':function(_0x5e7d6e,_0x5e61ea,_0x58c868){_0x58c868(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x322c07,_0x2ed791,_0x2f0395){_0x2f0395(null,util[_0xd6c2('0x15')]('%s%s',_0xd6c2('0x1e'),path['extname'](_0x2ed791[_0xd6c2('0x19')])));}})});router[_0xd6c2('0x1a')](_0xd6c2('0xd'),upload[_0xd6c2('0x1b')](_0xd6c2('0x1c')),controller[_0xd6c2('0x1f')]);var upload=multer({'storage':multer[_0xd6c2('0x12')]({'destination':function(_0xb7cf79,_0x4e7c6b,_0x4cad0c){_0x4cad0c(null,path[_0xd6c2('0x13')](config[_0xd6c2('0x20')],_0xd6c2('0x14')));},'filename':function(_0x16404a,_0x64a2a2,_0x2d8d12){_0x2d8d12(null,util['format']('%s%s',_0xd6c2('0x21'),path[_0xd6c2('0x18')](_0x64a2a2[_0xd6c2('0x19')])));}})});router[_0xd6c2('0x1a')](_0xd6c2('0xf'),upload[_0xd6c2('0x1b')](_0xd6c2('0x1c')),controller['addPreferred']);var upload=multer({'storage':multer[_0xd6c2('0x12')]({'destination':function(_0x33511c,_0x5e774a,_0x3751f3){_0x3751f3(null,path[_0xd6c2('0x13')](config[_0xd6c2('0x20')],_0xd6c2('0x14')));},'filename':function(_0x4ee6e9,_0x5cba4c,_0x129961){_0x129961(null,util['format'](_0xd6c2('0x16'),_0xd6c2('0x22'),path[_0xd6c2('0x18')](_0x5cba4c[_0xd6c2('0x19')])));}})});router[_0xd6c2('0x1a')](_0xd6c2('0x11'),upload[_0xd6c2('0x1b')](_0xd6c2('0x1c')),controller['addFavicon']);router['put']('/:id',auth[_0xd6c2('0x9')](),controller[_0xd6c2('0x23')]);module[_0xd6c2('0x24')]=router; \ No newline at end of file +var _0x5966=['/:id/gdpr','/:id/preferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','originalname','post','file','addLogo','addLogoLogin','preferred','extname','single','addPreferred','favicon','put','isAuthenticated','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./setting.controller','get','index','/:id','show','/:id/logo','/:id/logo_login'];(function(_0x29e314,_0x19d592){var _0x4c9fcb=function(_0xcb1c9){while(--_0xcb1c9){_0x29e314['push'](_0x29e314['shift']());}};_0x4c9fcb(++_0x19d592);}(_0x5966,0xd0));var _0x6596=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0x5966[_0x119280];return _0x481797;};'use strict';var multer=require(_0x6596('0x0'));var util=require(_0x6596('0x1'));var path=require('path');var timeout=require(_0x6596('0x2'));var express=require(_0x6596('0x3'));var router=express[_0x6596('0x4')]();var auth=require(_0x6596('0x5'));var interaction=require(_0x6596('0x6'));var config=require('../../config/environment');var controller=require(_0x6596('0x7'));router[_0x6596('0x8')]('/',auth['isAuthenticated'](),controller[_0x6596('0x9')]);router[_0x6596('0x8')](_0x6596('0xa'),controller[_0x6596('0xb')]);router[_0x6596('0x8')](_0x6596('0xc'),controller['getLogo']);router[_0x6596('0x8')](_0x6596('0xd'),controller['getLogoLogin']);router[_0x6596('0x8')](_0x6596('0xe'),controller['gdpr']);router[_0x6596('0x8')](_0x6596('0xf'),controller['getPreferred']);router[_0x6596('0x8')](_0x6596('0x10'),controller['getFavicon']);var upload=multer({'storage':multer[_0x6596('0x11')]({'destination':function(_0x4c54f3,_0x1b79c9,_0x56e99f){_0x56e99f(null,path[_0x6596('0x12')](config[_0x6596('0x13')],_0x6596('0x14')));},'filename':function(_0x5235ef,_0x50bbd2,_0x3c01fc){_0x3c01fc(null,util[_0x6596('0x15')](_0x6596('0x16'),'logo',path['extname'](_0x50bbd2[_0x6596('0x17')])));}})});router[_0x6596('0x18')](_0x6596('0xc'),upload['single'](_0x6596('0x19')),controller[_0x6596('0x1a')]);var upload=multer({'storage':multer[_0x6596('0x11')]({'destination':function(_0x2ff9ac,_0x325c96,_0x482edc){_0x482edc(null,path[_0x6596('0x12')](config[_0x6596('0x13')],_0x6596('0x14')));},'filename':function(_0x229153,_0x5f0b81,_0x35f580){_0x35f580(null,util[_0x6596('0x15')](_0x6596('0x16'),'logologin',path['extname'](_0x5f0b81[_0x6596('0x17')])));}})});router[_0x6596('0x18')](_0x6596('0xd'),upload['single'](_0x6596('0x19')),controller[_0x6596('0x1b')]);var upload=multer({'storage':multer[_0x6596('0x11')]({'destination':function(_0x1ff19e,_0x475baf,_0x520f1b){_0x520f1b(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x3877f0,_0x9041ac,_0x186f66){_0x186f66(null,util[_0x6596('0x15')](_0x6596('0x16'),_0x6596('0x1c'),path[_0x6596('0x1d')](_0x9041ac[_0x6596('0x17')])));}})});router[_0x6596('0x18')](_0x6596('0xf'),upload[_0x6596('0x1e')](_0x6596('0x19')),controller[_0x6596('0x1f')]);var upload=multer({'storage':multer[_0x6596('0x11')]({'destination':function(_0x3eede5,_0x2f7600,_0xa29dda){_0xa29dda(null,path['join'](config[_0x6596('0x13')],_0x6596('0x14')));},'filename':function(_0x3dde3a,_0x4a25da,_0x1d2acc){_0x1d2acc(null,util[_0x6596('0x15')]('%s%s',_0x6596('0x20'),path[_0x6596('0x1d')](_0x4a25da[_0x6596('0x17')])));}})});router[_0x6596('0x18')]('/:id/favicon',upload[_0x6596('0x1e')]('file'),controller['addFavicon']);router[_0x6596('0x21')](_0x6596('0xa'),auth[_0x6596('0x22')](),controller[_0x6596('0x23')]);module[_0x6596('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 3ffd59d..fe8576c 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 _0xbf64=['alternate','exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml'];(function(_0x2cf42b,_0x476858){var _0x5771f8=function(_0x1fd08b){while(--_0x1fd08b){_0x2cf42b['push'](_0x2cf42b['shift']());}};_0x5771f8(++_0x476858);}(_0xbf64,0x76));var _0x4bf6=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0xbf64[_0x119280];return _0x481797;};'use strict';var Sequelize=require('sequelize');module[_0x4bf6('0x0')]={'min_internal':{'type':Sequelize[_0x4bf6('0x1')](0xb),'unique':_0x4bf6('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x4bf6('0x1')](0xb),'unique':_0x4bf6('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x4bf6('0x4')],'defaultValue':_0x4bf6('0x5')},'logo':{'type':Sequelize[_0x4bf6('0x4')]},'defaultLogo':{'type':Sequelize[_0x4bf6('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x4bf6('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x4bf6('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x4bf6('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x4bf6('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x4bf6('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x4bf6('0x4')]},'turnusername':{'type':Sequelize[_0x4bf6('0x4')]},'turnpassword':{'type':Sequelize[_0x4bf6('0x4')]},'pageTitle':{'type':Sequelize[_0x4bf6('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x4bf6('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x4bf6('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x4bf6('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x4bf6('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x4bf6('0x4')],'defaultValue':_0x4bf6('0x7')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x4bf6('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x4bf6('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x4bf6('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x4bf6('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x4bf6('0x4')],'defaultValue':_0x4bf6('0x8')},'chatTimeout':{'type':Sequelize[_0x4bf6('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x4bf6('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x4bf6('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x4bf6('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x4bf6('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x4bf6('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x4bf6('0x4')]},'defaultFavicon':{'type':Sequelize[_0x4bf6('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x4bf6('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'googleSsoEnabled':{'type':Sequelize[_0x4bf6('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x96c6=['INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize','exports'];(function(_0x1698f6,_0x441e4b){var _0x11d58f=function(_0x4034db){while(--_0x4034db){_0x1698f6['push'](_0x1698f6['shift']());}};_0x11d58f(++_0x441e4b);}(_0x96c6,0x94));var _0x696c=function(_0x8457c6,_0x562d38){_0x8457c6=_0x8457c6-0x0;var _0x113d02=_0x96c6[_0x8457c6];return _0x113d02;};'use strict';var Sequelize=require(_0x696c('0x0'));module[_0x696c('0x1')]={'min_internal':{'type':Sequelize[_0x696c('0x2')](0xb),'unique':_0x696c('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x696c('0x2')](0xb),'unique':_0x696c('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x696c('0x5')],'defaultValue':_0x696c('0x6')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x696c('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x696c('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x696c('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x696c('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x696c('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x696c('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x696c('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x696c('0x5')]},'turnusername':{'type':Sequelize[_0x696c('0x5')]},'turnpassword':{'type':Sequelize[_0x696c('0x5')]},'pageTitle':{'type':Sequelize[_0x696c('0x5')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x696c('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x696c('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x696c('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x696c('0x5')],'defaultValue':_0x696c('0x8')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x696c('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x696c('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x696c('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x696c('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x696c('0x5')],'defaultValue':_0x696c('0x9')},'chatTimeout':{'type':Sequelize[_0x696c('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x696c('0x5')]},'defaultPreferred':{'type':Sequelize[_0x696c('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x696c('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x696c('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x696c('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x696c('0x5')]},'defaultFavicon':{'type':Sequelize[_0x696c('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x696c('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'googleSsoEnabled':{'type':Sequelize[_0x696c('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 66fd1f2..d8952f0 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 _0xf646=['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','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','Setting','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','length','find','body','file','filename','logo','params','../../config/license/util','server/files/images/logos','getLicense','loginLogo','preferred','defaultLoginLogo','defaultPreferred','root','toLower','join','default_logo.png','default','upperFirst','custom','getLogoLogin','favicon','defaultLogo','defaultFavicon','existsSync','default_loginLogo.png','\x20not\x20found','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','download','addFavicon','getFavicon','default_favicon.ico','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x391106,_0x42fef8){var _0x5956f7=function(_0x2d6ee8){while(--_0x2d6ee8){_0x391106['push'](_0x391106['shift']());}};_0x5956f7(++_0x42fef8);}(_0xf646,0x1cf));var _0x6f64=function(_0xc027c6,_0x2b925b){_0xc027c6=_0xc027c6-0x0;var _0xea4f56=_0xf646[_0xc027c6];return _0xea4f56;};'use strict';var pdf=require(_0x6f64('0x0'));var emlformat=require(_0x6f64('0x1'));var rimraf=require(_0x6f64('0x2'));var zipdir=require(_0x6f64('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6f64('0x4'));var BPromise=require(_0x6f64('0x5'));var Mustache=require(_0x6f64('0x6'));var util=require(_0x6f64('0x7'));var path=require('path');var sox=require(_0x6f64('0x8'));var csv=require('to-csv');var ejs=require(_0x6f64('0x9'));var fs=require('fs');var _=require(_0x6f64('0xa'));var squel=require('squel');var crypto=require(_0x6f64('0xb'));var jsforce=require(_0x6f64('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6f64('0xd'));var Papa=require('papaparse');var Redis=require(_0x6f64('0xe'));var authService=require(_0x6f64('0xf'));var qs=require(_0x6f64('0x10'));var as=require(_0x6f64('0x11'));var hardwareService=require(_0x6f64('0x12'));var logger=require(_0x6f64('0x13'))(_0x6f64('0x14'));var utils=require(_0x6f64('0x15'));var config=require(_0x6f64('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x6f64('0x17'));var client=jayson[_0x6f64('0x18')][_0x6f64('0x19')]({'port':0x232a});function checkPasswordPattern(_0x3ee0e8,_0x899254,_0x51dfbf){if(_0x51dfbf){var _0x4f2a75=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4f2a75[_0x6f64('0x1a')](_0x899254)){return _0x3ee0e8;}else{throw new db[(_0x6f64('0x1b'))][(_0x6f64('0x1c'))](_0x6f64('0x1d'));}}else{return _0x3ee0e8;}}function respondWithRpcPromise(_0x165bd4,_0x9789a3,_0x134b83,_0x1c8279){return new BPromise(function(_0x4e05a5,_0x403f81){var _0x3e285c=_0x1c8279||client;return _0x3e285c[_0x6f64('0x1e')](_0x165bd4,_0x134b83)[_0x6f64('0x1f')](function(_0x83220a){logger[_0x6f64('0x20')](_0x6f64('0x21'),_0x9789a3,_0x6f64('0x22'));logger[_0x6f64('0x23')](_0x6f64('0x24'),_0x9789a3,_0x6f64('0x22'),JSON[_0x6f64('0x25')](_0x83220a));if(_0x83220a['error']){if(_0x83220a[_0x6f64('0x26')]['code']===0x1f4){logger[_0x6f64('0x26')](_0x6f64('0x21'),_0x9789a3,_0x83220a[_0x6f64('0x26')][_0x6f64('0x27')]);return _0x403f81(_0x83220a[_0x6f64('0x26')][_0x6f64('0x27')]);}logger[_0x6f64('0x26')]('Setting,\x20%s,\x20%s',_0x9789a3,_0x83220a[_0x6f64('0x26')][_0x6f64('0x27')]);return _0x4e05a5(_0x83220a['error'][_0x6f64('0x27')]);}else{logger[_0x6f64('0x20')](_0x6f64('0x21'),_0x9789a3,_0x6f64('0x22'));_0x4e05a5(_0x83220a[_0x6f64('0x28')][_0x6f64('0x27')]);}})[_0x6f64('0x29')](function(_0x35bfbc){logger['error'](_0x6f64('0x21'),_0x9789a3,_0x35bfbc);_0x403f81(_0x35bfbc);});});}function respondWithStatusCode(_0x4ab12e,_0x3e3443){_0x3e3443=_0x3e3443||0xcc;return function(_0x1370c5){if(_0x1370c5){return _0x4ab12e[_0x6f64('0x2a')](_0x3e3443);}return _0x4ab12e[_0x6f64('0x2b')](_0x3e3443)[_0x6f64('0x2c')]();};}function respondWithResult(_0x1ce3c8,_0x3d9e55){_0x3d9e55=_0x3d9e55||0xc8;return function(_0x4a635f){if(_0x4a635f){return _0x1ce3c8[_0x6f64('0x2b')](_0x3d9e55)[_0x6f64('0x2d')](_0x4a635f);}};}function respondWithFilteredResult(_0xd1516c,_0x1245a4){return function(_0x3e7b7a){if(_0x3e7b7a){var _0x4f2f73=_0x3e7b7a[_0x6f64('0x2e')],_0x1de67e=_0x1245a4[_0x6f64('0x2f')],_0x3847c=_0x1245a4[_0x6f64('0x2f')]+_0x1245a4['limit'],_0x4cd31d;if(_0x3847c>=_0x4f2f73){_0x3847c=_0x4f2f73;_0x4cd31d=0xc8;}else{_0x4cd31d=0xce;}_0xd1516c[_0x6f64('0x2b')](_0x4cd31d);return _0xd1516c[_0x6f64('0x30')](_0x6f64('0x31'),_0x1de67e+'-'+_0x3847c+'/'+_0x4f2f73)[_0x6f64('0x2d')](_0x3e7b7a);}return null;};}function patchUpdates(_0xf5b456){return function(_0x4982bc){try{jsonpatch[_0x6f64('0x32')](_0x4982bc,_0xf5b456,!![]);}catch(_0x3ddfd2){return BPromise[_0x6f64('0x33')](_0x3ddfd2);}return _0x4982bc[_0x6f64('0x34')]();};}function saveUpdates(_0x583aca,_0x7db3da){return function(_0x2800fa){if(_0x2800fa){return _0x2800fa[_0x6f64('0x35')](_0x583aca)[_0x6f64('0x1f')](function(_0x5949ac){return _0x5949ac;});}return null;};}function removeEntity(_0x4644bf,_0x51c02f){return function(_0x33312f){if(_0x33312f){return _0x33312f[_0x6f64('0x36')]()[_0x6f64('0x1f')](function(){_0x4644bf[_0x6f64('0x2b')](0xcc)[_0x6f64('0x2c')]();});}};}function handleEntityNotFound(_0x119908,_0x881de9){return function(_0x529beb){if(!_0x529beb){_0x119908[_0x6f64('0x2a')](0x194);}return _0x529beb;};}function handleError(_0x191155,_0x4ef055){_0x4ef055=_0x4ef055||0x1f4;return function(_0x59ff7b){logger[_0x6f64('0x26')](_0x59ff7b[_0x6f64('0x37')]);if(_0x59ff7b[_0x6f64('0x38')]){delete _0x59ff7b[_0x6f64('0x38')];}_0x191155[_0x6f64('0x2b')](_0x4ef055)['send'](_0x59ff7b);};}exports[_0x6f64('0x39')]=function(_0x19556f,_0x592070){var _0x537897={},_0x42bfea={},_0x2df7d2={'count':0x0,'rows':[]};var _0x48a2a6=_['map'](db[_0x6f64('0x3a')][_0x6f64('0x3b')],function(_0x3107a1){return{'name':_0x3107a1[_0x6f64('0x3c')],'type':_0x3107a1[_0x6f64('0x3d')]['key']};});_0x42bfea['model']=_[_0x6f64('0x3e')](_0x48a2a6,'name');_0x42bfea[_0x6f64('0x3f')]=_[_0x6f64('0x40')](_0x19556f[_0x6f64('0x3f')]);_0x42bfea[_0x6f64('0x41')]=_[_0x6f64('0x42')](_0x42bfea[_0x6f64('0x43')],_0x42bfea[_0x6f64('0x3f')]);_0x537897['attributes']=_['intersection'](_0x42bfea[_0x6f64('0x43')],qs[_0x6f64('0x44')](_0x19556f[_0x6f64('0x3f')][_0x6f64('0x44')]));_0x537897[_0x6f64('0x45')]=_0x537897['attributes']['length']?_0x537897['attributes']:_0x42bfea[_0x6f64('0x43')];if(!_0x19556f[_0x6f64('0x3f')][_0x6f64('0x46')](_0x6f64('0x47'))){_0x537897[_0x6f64('0x48')]=qs[_0x6f64('0x48')](_0x19556f[_0x6f64('0x3f')]['limit']);_0x537897[_0x6f64('0x2f')]=qs['offset'](_0x19556f[_0x6f64('0x3f')][_0x6f64('0x2f')]);}_0x537897[_0x6f64('0x49')]=qs[_0x6f64('0x4a')](_0x19556f['query'][_0x6f64('0x4a')]);_0x537897[_0x6f64('0x4b')]=qs[_0x6f64('0x41')](_[_0x6f64('0x4c')](_0x19556f['query'],_0x42bfea[_0x6f64('0x41')]));if(_0x19556f[_0x6f64('0x3f')][_0x6f64('0x4d')]){_0x537897[_0x6f64('0x4b')]=_[_0x6f64('0x4e')](_0x537897[_0x6f64('0x4b')],{'$or':_[_0x6f64('0x3e')](_0x48a2a6,function(_0x37cb74){if(_0x37cb74[_0x6f64('0x3d')]!==_0x6f64('0x4f')){var _0x5bbba0={};_0x5bbba0[_0x37cb74[_0x6f64('0x38')]]={'$like':'%'+_0x19556f['query'][_0x6f64('0x4d')]+'%'};return _0x5bbba0;}})});}_0x537897=_['merge']({},_0x537897,_0x19556f[_0x6f64('0x50')]);var _0x3b00ee={'where':_0x537897[_0x6f64('0x4b')]};return db[_0x6f64('0x3a')][_0x6f64('0x2e')](_0x3b00ee)[_0x6f64('0x1f')](function(_0x14eebb){_0x2df7d2[_0x6f64('0x2e')]=_0x14eebb;if(_0x19556f[_0x6f64('0x3f')][_0x6f64('0x51')]){_0x537897[_0x6f64('0x52')]=[{'all':!![]}];}return db['Setting'][_0x6f64('0x53')](_0x537897);})[_0x6f64('0x1f')](function(_0x172181){_0x2df7d2[_0x6f64('0x54')]=_0x172181;return _0x2df7d2;})['then'](respondWithFilteredResult(_0x592070,_0x537897))[_0x6f64('0x29')](handleError(_0x592070,null));};exports['show']=function(_0x5369c9,_0xc615c6){var _0x1372cb={'raw':![],'where':{'id':_0x5369c9['params']['id']}},_0x3d5c4d={};_0x3d5c4d[_0x6f64('0x43')]=_[_0x6f64('0x40')](db[_0x6f64('0x3a')]['rawAttributes']);_0x3d5c4d[_0x6f64('0x3f')]=_['keys'](_0x5369c9[_0x6f64('0x3f')]);_0x3d5c4d[_0x6f64('0x41')]=_[_0x6f64('0x42')](_0x3d5c4d['model'],_0x3d5c4d[_0x6f64('0x3f')]);_0x1372cb[_0x6f64('0x45')]=_[_0x6f64('0x42')](_0x3d5c4d[_0x6f64('0x43')],qs[_0x6f64('0x44')](_0x5369c9[_0x6f64('0x3f')][_0x6f64('0x44')]));_0x1372cb[_0x6f64('0x45')]=_0x1372cb['attributes'][_0x6f64('0x55')]?_0x1372cb[_0x6f64('0x45')]:_0x3d5c4d[_0x6f64('0x43')];if(_0x5369c9['query'][_0x6f64('0x51')]){_0x1372cb[_0x6f64('0x52')]=[{'all':!![]}];}_0x1372cb=_[_0x6f64('0x4e')]({},_0x1372cb,_0x5369c9['options']);return db[_0x6f64('0x3a')][_0x6f64('0x56')](_0x1372cb)[_0x6f64('0x1f')](handleEntityNotFound(_0xc615c6,null))['then'](respondWithResult(_0xc615c6,null))[_0x6f64('0x29')](handleError(_0xc615c6,null));};exports['update']=function(_0x3e45db,_0x316046){if(_0x3e45db[_0x6f64('0x57')]['id']){delete _0x3e45db[_0x6f64('0x57')]['id'];}return db[_0x6f64('0x3a')][_0x6f64('0x56')]({'where':{'id':_0x3e45db['params']['id']}})['then'](handleEntityNotFound(_0x316046,null))['then'](saveUpdates(_0x3e45db[_0x6f64('0x57')],null))['then'](respondWithResult(_0x316046,null))[_0x6f64('0x29')](handleError(_0x316046,null));};exports['addLogo']=function(_0x4f80c3,_0x1f6c6c,_0x2a9ce7){if(_0x4f80c3[_0x6f64('0x58')]&&_0x4f80c3[_0x6f64('0x58')][_0x6f64('0x59')]){_0x4f80c3[_0x6f64('0x57')][_0x6f64('0x5a')]=_0x4f80c3['file'][_0x6f64('0x59')];}return db[_0x6f64('0x3a')]['find']({'where':{'id':_0x4f80c3['params']['id']}})[_0x6f64('0x1f')](handleEntityNotFound(_0x1f6c6c,null))[_0x6f64('0x1f')](saveUpdates(_0x4f80c3[_0x6f64('0x57')],null))[_0x6f64('0x1f')](respondWithResult(_0x1f6c6c,null))[_0x6f64('0x29')](handleError(_0x1f6c6c,null));};exports['addLogoLogin']=function(_0x1bbcc6,_0x20e9bc,_0x569eec){if(_0x1bbcc6['file']&&_0x1bbcc6[_0x6f64('0x58')][_0x6f64('0x59')]){_0x1bbcc6['body']['loginLogo']=_0x1bbcc6[_0x6f64('0x58')][_0x6f64('0x59')];}return db['Setting'][_0x6f64('0x56')]({'where':{'id':_0x1bbcc6[_0x6f64('0x5b')]['id']}})[_0x6f64('0x1f')](handleEntityNotFound(_0x20e9bc,null))[_0x6f64('0x1f')](saveUpdates(_0x1bbcc6[_0x6f64('0x57')],null))[_0x6f64('0x1f')](respondWithResult(_0x20e9bc,null))[_0x6f64('0x29')](handleError(_0x20e9bc,null));};var utilLicense=require(_0x6f64('0x5c'));exports['getLogo']=function(_0x1d6736,_0x4581d7,_0x3be63e){var _0x3d0954=_0x6f64('0x5d');var _0x4dc75b={'custom':![]};return utilLicense[_0x6f64('0x5e')]()[_0x6f64('0x1f')](function(_0x463582){if(_0x463582){_0x4dc75b=_0x463582;}return db[_0x6f64('0x3a')][_0x6f64('0x56')]({'where':{'id':_0x1d6736[_0x6f64('0x5b')]['id']},'attributes':[_0x6f64('0x5a'),_0x6f64('0x5f'),_0x6f64('0x60'),'favicon','defaultLogo',_0x6f64('0x61'),_0x6f64('0x62'),'defaultFavicon'],'raw':!![]});})[_0x6f64('0x1f')](handleEntityNotFound(_0x4581d7,null))[_0x6f64('0x1f')](function(_0x3aea5e){if(_0x3aea5e){var _0x1011a8=_0x3aea5e[_0x6f64('0x5a')]&&fs['existsSync'](path['join'](config[_0x6f64('0x63')],_0x3d0954,_[_0x6f64('0x64')](_0x3aea5e[_0x6f64('0x5a')])))?path[_0x6f64('0x65')](config[_0x6f64('0x63')],_0x3d0954,_[_0x6f64('0x64')](_0x3aea5e[_0x6f64('0x5a')])):path['join'](config[_0x6f64('0x63')],_0x3d0954,_[_0x6f64('0x64')](_0x6f64('0x66')));var _0x3c2c1b=_0x6f64('0x67')+_[_0x6f64('0x68')](_0x6f64('0x5a'));if(_0x3aea5e[_0x3c2c1b]||!_0x4dc75b[_0x6f64('0x69')]){_0x1011a8=path[_0x6f64('0x65')](config['root'],_0x3d0954,_[_0x6f64('0x64')](_0x6f64('0x66')));}if(!fs['existsSync'](_0x1011a8)){throw new db[(_0x6f64('0x1b'))]['ValidationError'](_['upperFirst']('logo')+'\x20not\x20found');}return _0x4581d7['download'](_0x1011a8);}})[_0x6f64('0x29')](handleError(_0x4581d7,null));};var utilLicense=require(_0x6f64('0x5c'));exports[_0x6f64('0x6a')]=function(_0x35aa50,_0xe3fe2,_0x2223fc){var _0x497b34=_0x6f64('0x5d');var _0xfc5af3={'custom':![]};return utilLicense[_0x6f64('0x5e')]()['then'](function(_0x1bcdd1){if(_0x1bcdd1){_0xfc5af3=_0x1bcdd1;}return db[_0x6f64('0x3a')]['find']({'where':{'id':_0x35aa50[_0x6f64('0x5b')]['id']},'attributes':[_0x6f64('0x5a'),_0x6f64('0x5f'),_0x6f64('0x60'),_0x6f64('0x6b'),_0x6f64('0x6c'),_0x6f64('0x61'),_0x6f64('0x62'),_0x6f64('0x6d')],'raw':!![]});})['then'](handleEntityNotFound(_0xe3fe2,null))[_0x6f64('0x1f')](function(_0x40320a){if(_0x40320a){var _0xbf5b09=_0x40320a[_0x6f64('0x5f')]&&fs[_0x6f64('0x6e')](path[_0x6f64('0x65')](config[_0x6f64('0x63')],_0x497b34,_['toLower'](_0x40320a[_0x6f64('0x5f')])))?path['join'](config['root'],_0x497b34,_[_0x6f64('0x64')](_0x40320a[_0x6f64('0x5f')])):path[_0x6f64('0x65')](config[_0x6f64('0x63')],_0x497b34,_[_0x6f64('0x64')](_0x6f64('0x6f')));var _0x44d14f=_0x6f64('0x67')+_['upperFirst']('loginLogo');if(_0x40320a[_0x44d14f]||!_0xfc5af3[_0x6f64('0x69')]){_0xbf5b09=path[_0x6f64('0x65')](config[_0x6f64('0x63')],_0x497b34,_[_0x6f64('0x64')]('default_loginLogo.png'));}if(!fs['existsSync'](_0xbf5b09)){throw new db[(_0x6f64('0x1b'))]['ValidationError'](_['upperFirst']('loginLogo')+_0x6f64('0x70'));}return _0xe3fe2['download'](_0xbf5b09);}})['catch'](handleError(_0xe3fe2,null));};exports[_0x6f64('0x71')]=function(_0x2ccb6f,_0x1b42f5){return db[_0x6f64('0x3a')][_0x6f64('0x56')]({'where':{'id':_0x2ccb6f[_0x6f64('0x5b')]['id']},'attributes':[_0x6f64('0x72')]})[_0x6f64('0x1f')](respondWithResult(_0x1b42f5,null))[_0x6f64('0x29')](handleError(_0x1b42f5,null));};exports[_0x6f64('0x73')]=function(_0x31bdd3,_0x10dfb4,_0x4bd6b4){if(_0x31bdd3['file']&&_0x31bdd3[_0x6f64('0x58')]['filename']){_0x31bdd3[_0x6f64('0x57')][_0x6f64('0x60')]=_0x31bdd3[_0x6f64('0x58')][_0x6f64('0x59')];}return db[_0x6f64('0x3a')][_0x6f64('0x56')]({'where':{'id':_0x31bdd3[_0x6f64('0x5b')]['id']}})['then'](handleEntityNotFound(_0x10dfb4,null))['then'](saveUpdates(_0x31bdd3['body'],null))['then'](respondWithResult(_0x10dfb4,null))['catch'](handleError(_0x10dfb4,null));};var utilLicense=require(_0x6f64('0x5c'));exports[_0x6f64('0x74')]=function(_0x362722,_0x23a7b3,_0x214bde){var _0x29af6f=_0x6f64('0x5d');var _0xb09c8e={'custom':![]};return utilLicense[_0x6f64('0x5e')]()[_0x6f64('0x1f')](function(_0x109242){if(_0x109242){_0xb09c8e=_0x109242;}return db[_0x6f64('0x3a')][_0x6f64('0x56')]({'where':{'id':_0x362722[_0x6f64('0x5b')]['id']},'attributes':[_0x6f64('0x5a'),_0x6f64('0x5f'),'preferred',_0x6f64('0x6b'),_0x6f64('0x6c'),_0x6f64('0x61'),_0x6f64('0x62'),'defaultFavicon'],'raw':!![]});})[_0x6f64('0x1f')](handleEntityNotFound(_0x23a7b3,null))['then'](function(_0x1d0ca3){if(_0x1d0ca3){var _0x59a5d0=_0x1d0ca3[_0x6f64('0x60')]&&fs['existsSync'](path[_0x6f64('0x65')](config['root'],_0x29af6f,_[_0x6f64('0x64')](_0x1d0ca3[_0x6f64('0x60')])))?path[_0x6f64('0x65')](config[_0x6f64('0x63')],_0x29af6f,_['toLower'](_0x1d0ca3[_0x6f64('0x60')])):path[_0x6f64('0x65')](config[_0x6f64('0x63')],_0x29af6f,_[_0x6f64('0x64')](_0x6f64('0x75')));var _0x1c2584=_0x6f64('0x67')+_[_0x6f64('0x68')](_0x6f64('0x60'));if(_0x1d0ca3[_0x1c2584]||!_0xb09c8e['custom']||!_0xb09c8e[_0x6f64('0x60')]){_0x59a5d0=path[_0x6f64('0x65')](config[_0x6f64('0x63')],_0x29af6f,_['toLower'](_0x6f64('0x75')));}if(!fs['existsSync'](_0x59a5d0)){throw new db['Sequelize'][(_0x6f64('0x1c'))](_['upperFirst'](_0x6f64('0x60'))+'\x20not\x20found');}return _0x23a7b3[_0x6f64('0x76')](_0x59a5d0);}})[_0x6f64('0x29')](handleError(_0x23a7b3,null));};exports[_0x6f64('0x77')]=function(_0x293cb1,_0xc72945,_0x4e10e2){if(_0x293cb1[_0x6f64('0x58')]&&_0x293cb1[_0x6f64('0x58')][_0x6f64('0x59')]){_0x293cb1[_0x6f64('0x57')][_0x6f64('0x6b')]=_0x293cb1[_0x6f64('0x58')]['filename'];}return db[_0x6f64('0x3a')][_0x6f64('0x56')]({'where':{'id':_0x293cb1[_0x6f64('0x5b')]['id']}})[_0x6f64('0x1f')](handleEntityNotFound(_0xc72945,null))['then'](saveUpdates(_0x293cb1[_0x6f64('0x57')],null))['then'](respondWithResult(_0xc72945,null))[_0x6f64('0x29')](handleError(_0xc72945,null));};var utilLicense=require(_0x6f64('0x5c'));exports[_0x6f64('0x78')]=function(_0x49a568,_0x12bc3b,_0xdf2d3b){var _0x22eaff='server/files/images/logos';var _0x33098e={'custom':![]};return utilLicense[_0x6f64('0x5e')]()[_0x6f64('0x1f')](function(_0x47ab4c){if(_0x47ab4c){_0x33098e=_0x47ab4c;}return db[_0x6f64('0x3a')][_0x6f64('0x56')]({'where':{'id':_0x49a568[_0x6f64('0x5b')]['id']},'attributes':[_0x6f64('0x5a'),_0x6f64('0x5f'),_0x6f64('0x60'),'favicon',_0x6f64('0x6c'),_0x6f64('0x61'),_0x6f64('0x62'),_0x6f64('0x6d')],'raw':!![]});})[_0x6f64('0x1f')](handleEntityNotFound(_0x12bc3b,null))[_0x6f64('0x1f')](function(_0x3f654b){if(_0x3f654b){var _0x39b88d=_0x3f654b['favicon']&&fs[_0x6f64('0x6e')](path[_0x6f64('0x65')](config['root'],_0x22eaff,_[_0x6f64('0x64')](_0x3f654b[_0x6f64('0x6b')])))?path[_0x6f64('0x65')](config[_0x6f64('0x63')],_0x22eaff,_[_0x6f64('0x64')](_0x3f654b['favicon'])):path['join'](config['root'],_0x22eaff,_[_0x6f64('0x64')](_0x6f64('0x79')));var _0x46e550=_0x6f64('0x67')+_[_0x6f64('0x68')](_0x6f64('0x6b'));if(_0x3f654b[_0x46e550]||!_0x33098e['custom']){_0x39b88d=path[_0x6f64('0x65')](config[_0x6f64('0x63')],_0x22eaff,_[_0x6f64('0x64')](_0x6f64('0x79')));}if(!fs[_0x6f64('0x6e')](_0x39b88d)){throw new db[(_0x6f64('0x1b'))][(_0x6f64('0x1c'))](_[_0x6f64('0x68')]('favicon')+_0x6f64('0x70'));}return _0x12bc3b[_0x6f64('0x76')](_0x39b88d);}})['catch'](handleError(_0x12bc3b,null));}; \ No newline at end of file +var _0xff4b=['request\x20sent','stringify','error','code','message','Setting,\x20%s,\x20%s','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','save','destroy','sendStatus','stack','name','send','index','map','Setting','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','body','addLogo','file','logo','filename','addLogoLogin','loginLogo','../../config/license/util','getLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultPreferred','toLower','join','root','default','upperFirst','custom','default_logo.png','existsSync','download','preferred','defaultFavicon','default_loginLogo.png','\x20not\x20found','gdpr','securePassword','addPreferred','defaultLoginLogo','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','html-pdf','eml-format','rimraf','zip-dir','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','debug','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xff4b,0x1b9));var _0xbff4=function(_0x216bff,_0x139a65){_0x216bff=_0x216bff-0x0;var _0x1f66a9=_0xff4b[_0x216bff];return _0x1f66a9;};'use strict';var pdf=require(_0xbff4('0x0'));var emlformat=require(_0xbff4('0x1'));var rimraf=require(_0xbff4('0x2'));var zipdir=require(_0xbff4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbff4('0x4'));var Mustache=require('mustache');var util=require(_0xbff4('0x5'));var path=require('path');var sox=require(_0xbff4('0x6'));var csv=require(_0xbff4('0x7'));var ejs=require(_0xbff4('0x8'));var fs=require('fs');var _=require(_0xbff4('0x9'));var squel=require(_0xbff4('0xa'));var crypto=require(_0xbff4('0xb'));var jsforce=require(_0xbff4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbff4('0x7'));var querystring=require('querystring');var Papa=require(_0xbff4('0xd'));var Redis=require('ioredis');var authService=require(_0xbff4('0xe'));var qs=require(_0xbff4('0xf'));var as=require(_0xbff4('0x10'));var hardwareService=require(_0xbff4('0x11'));var logger=require('../../config/logger')(_0xbff4('0x12'));var utils=require(_0xbff4('0x13'));var config=require('../../config/environment');var db=require(_0xbff4('0x14'))['db'];var jayson=require(_0xbff4('0x15'));var client=jayson['client'][_0xbff4('0x16')]({'port':0x232a});function checkPasswordPattern(_0x59a890,_0x46c767,_0x3e7848){if(_0x3e7848){var _0x4f590f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4f590f['test'](_0x46c767)){return _0x59a890;}else{throw new db[(_0xbff4('0x17'))][(_0xbff4('0x18'))](_0xbff4('0x19'));}}else{return _0x59a890;}}function respondWithRpcPromise(_0x562556,_0x3ec2a1,_0x6944fa,_0x5edfd8){return new BPromise(function(_0x4c7ce0,_0x18ad90){var _0x10be39=_0x5edfd8||client;return _0x10be39[_0xbff4('0x1a')](_0x562556,_0x6944fa)[_0xbff4('0x1b')](function(_0x5c1d73){logger[_0xbff4('0x1c')]('Setting,\x20%s,\x20%s',_0x3ec2a1,'request\x20sent');logger[_0xbff4('0x1d')](_0xbff4('0x1e'),_0x3ec2a1,_0xbff4('0x1f'),JSON[_0xbff4('0x20')](_0x5c1d73));if(_0x5c1d73[_0xbff4('0x21')]){if(_0x5c1d73[_0xbff4('0x21')][_0xbff4('0x22')]===0x1f4){logger[_0xbff4('0x21')]('Setting,\x20%s,\x20%s',_0x3ec2a1,_0x5c1d73['error'][_0xbff4('0x23')]);return _0x18ad90(_0x5c1d73[_0xbff4('0x21')][_0xbff4('0x23')]);}logger['error'](_0xbff4('0x24'),_0x3ec2a1,_0x5c1d73['error']['message']);return _0x4c7ce0(_0x5c1d73[_0xbff4('0x21')][_0xbff4('0x23')]);}else{logger[_0xbff4('0x1c')]('Setting,\x20%s,\x20%s',_0x3ec2a1,'request\x20sent');_0x4c7ce0(_0x5c1d73[_0xbff4('0x25')][_0xbff4('0x23')]);}})[_0xbff4('0x26')](function(_0x3a27e3){logger[_0xbff4('0x21')](_0xbff4('0x24'),_0x3ec2a1,_0x3a27e3);_0x18ad90(_0x3a27e3);});});}function respondWithStatusCode(_0x49ee22,_0x40990a){_0x40990a=_0x40990a||0xcc;return function(_0x4994be){if(_0x4994be){return _0x49ee22['sendStatus'](_0x40990a);}return _0x49ee22[_0xbff4('0x27')](_0x40990a)[_0xbff4('0x28')]();};}function respondWithResult(_0x38451e,_0x3acf4d){_0x3acf4d=_0x3acf4d||0xc8;return function(_0x507b4a){if(_0x507b4a){return _0x38451e[_0xbff4('0x27')](_0x3acf4d)[_0xbff4('0x29')](_0x507b4a);}};}function respondWithFilteredResult(_0x2e0997,_0x3e6578){return function(_0x2698fa){if(_0x2698fa){var _0x245833=_0x2698fa[_0xbff4('0x2a')],_0x3b4d47=_0x3e6578['offset'],_0x37fba2=_0x3e6578[_0xbff4('0x2b')]+_0x3e6578[_0xbff4('0x2c')],_0x3af36d;if(_0x37fba2>=_0x245833){_0x37fba2=_0x245833;_0x3af36d=0xc8;}else{_0x3af36d=0xce;}_0x2e0997['status'](_0x3af36d);return _0x2e0997[_0xbff4('0x2d')](_0xbff4('0x2e'),_0x3b4d47+'-'+_0x37fba2+'/'+_0x245833)[_0xbff4('0x29')](_0x2698fa);}return null;};}function patchUpdates(_0x1ef59a){return function(_0x39771c){try{jsonpatch[_0xbff4('0x2f')](_0x39771c,_0x1ef59a,!![]);}catch(_0x1d7817){return BPromise['reject'](_0x1d7817);}return _0x39771c[_0xbff4('0x30')]();};}function saveUpdates(_0x147b42,_0x428d9d){return function(_0x2526e3){if(_0x2526e3){return _0x2526e3['update'](_0x147b42)[_0xbff4('0x1b')](function(_0x4bbd5b){return _0x4bbd5b;});}return null;};}function removeEntity(_0x350dc9,_0x4470ab){return function(_0xbe29b8){if(_0xbe29b8){return _0xbe29b8[_0xbff4('0x31')]()[_0xbff4('0x1b')](function(){_0x350dc9[_0xbff4('0x27')](0xcc)[_0xbff4('0x28')]();});}};}function handleEntityNotFound(_0x499f81,_0x3d1972){return function(_0x5262e3){if(!_0x5262e3){_0x499f81[_0xbff4('0x32')](0x194);}return _0x5262e3;};}function handleError(_0x2db166,_0x1fc958){_0x1fc958=_0x1fc958||0x1f4;return function(_0x425cda){logger['error'](_0x425cda[_0xbff4('0x33')]);if(_0x425cda['name']){delete _0x425cda[_0xbff4('0x34')];}_0x2db166[_0xbff4('0x27')](_0x1fc958)[_0xbff4('0x35')](_0x425cda);};}exports[_0xbff4('0x36')]=function(_0x3abd8c,_0xee3ae5){var _0xd6ba7b={},_0x40e42c={},_0x1d170b={'count':0x0,'rows':[]};var _0xc25776=_[_0xbff4('0x37')](db[_0xbff4('0x38')][_0xbff4('0x39')],function(_0x222f77){return{'name':_0x222f77['fieldName'],'type':_0x222f77['type']['key']};});_0x40e42c[_0xbff4('0x3a')]=_[_0xbff4('0x37')](_0xc25776,'name');_0x40e42c[_0xbff4('0x3b')]=_[_0xbff4('0x3c')](_0x3abd8c[_0xbff4('0x3b')]);_0x40e42c[_0xbff4('0x3d')]=_[_0xbff4('0x3e')](_0x40e42c[_0xbff4('0x3a')],_0x40e42c[_0xbff4('0x3b')]);_0xd6ba7b[_0xbff4('0x3f')]=_[_0xbff4('0x3e')](_0x40e42c[_0xbff4('0x3a')],qs[_0xbff4('0x40')](_0x3abd8c[_0xbff4('0x3b')]['fields']));_0xd6ba7b['attributes']=_0xd6ba7b[_0xbff4('0x3f')][_0xbff4('0x41')]?_0xd6ba7b[_0xbff4('0x3f')]:_0x40e42c[_0xbff4('0x3a')];if(!_0x3abd8c[_0xbff4('0x3b')][_0xbff4('0x42')]('nolimit')){_0xd6ba7b[_0xbff4('0x2c')]=qs[_0xbff4('0x2c')](_0x3abd8c[_0xbff4('0x3b')]['limit']);_0xd6ba7b[_0xbff4('0x2b')]=qs[_0xbff4('0x2b')](_0x3abd8c[_0xbff4('0x3b')][_0xbff4('0x2b')]);}_0xd6ba7b[_0xbff4('0x43')]=qs[_0xbff4('0x44')](_0x3abd8c[_0xbff4('0x3b')][_0xbff4('0x44')]);_0xd6ba7b['where']=qs['filters'](_[_0xbff4('0x45')](_0x3abd8c[_0xbff4('0x3b')],_0x40e42c['filters']));if(_0x3abd8c['query']['filter']){_0xd6ba7b[_0xbff4('0x46')]=_[_0xbff4('0x47')](_0xd6ba7b['where'],{'$or':_['map'](_0xc25776,function(_0xa62c7c){if(_0xa62c7c[_0xbff4('0x48')]!==_0xbff4('0x49')){var _0x5bae12={};_0x5bae12[_0xa62c7c[_0xbff4('0x34')]]={'$like':'%'+_0x3abd8c[_0xbff4('0x3b')][_0xbff4('0x4a')]+'%'};return _0x5bae12;}})});}_0xd6ba7b=_['merge']({},_0xd6ba7b,_0x3abd8c[_0xbff4('0x4b')]);var _0x1d9e1b={'where':_0xd6ba7b[_0xbff4('0x46')]};return db[_0xbff4('0x38')][_0xbff4('0x2a')](_0x1d9e1b)[_0xbff4('0x1b')](function(_0x3e68e3){_0x1d170b[_0xbff4('0x2a')]=_0x3e68e3;if(_0x3abd8c['query'][_0xbff4('0x4c')]){_0xd6ba7b['include']=[{'all':!![]}];}return db[_0xbff4('0x38')][_0xbff4('0x4d')](_0xd6ba7b);})[_0xbff4('0x1b')](function(_0x346a7b){_0x1d170b[_0xbff4('0x4e')]=_0x346a7b;return _0x1d170b;})[_0xbff4('0x1b')](respondWithFilteredResult(_0xee3ae5,_0xd6ba7b))[_0xbff4('0x26')](handleError(_0xee3ae5,null));};exports[_0xbff4('0x4f')]=function(_0x30b12d,_0x12cfa9){var _0x5cd908={'raw':![],'where':{'id':_0x30b12d[_0xbff4('0x50')]['id']}},_0xb57baa={};_0xb57baa[_0xbff4('0x3a')]=_[_0xbff4('0x3c')](db[_0xbff4('0x38')]['rawAttributes']);_0xb57baa[_0xbff4('0x3b')]=_[_0xbff4('0x3c')](_0x30b12d[_0xbff4('0x3b')]);_0xb57baa[_0xbff4('0x3d')]=_[_0xbff4('0x3e')](_0xb57baa['model'],_0xb57baa[_0xbff4('0x3b')]);_0x5cd908[_0xbff4('0x3f')]=_[_0xbff4('0x3e')](_0xb57baa[_0xbff4('0x3a')],qs[_0xbff4('0x40')](_0x30b12d['query'][_0xbff4('0x40')]));_0x5cd908[_0xbff4('0x3f')]=_0x5cd908[_0xbff4('0x3f')]['length']?_0x5cd908['attributes']:_0xb57baa['model'];if(_0x30b12d[_0xbff4('0x3b')]['includeAll']){_0x5cd908[_0xbff4('0x51')]=[{'all':!![]}];}_0x5cd908=_[_0xbff4('0x47')]({},_0x5cd908,_0x30b12d['options']);return db['Setting'][_0xbff4('0x52')](_0x5cd908)[_0xbff4('0x1b')](handleEntityNotFound(_0x12cfa9,null))[_0xbff4('0x1b')](respondWithResult(_0x12cfa9,null))[_0xbff4('0x26')](handleError(_0x12cfa9,null));};exports['update']=function(_0x2face1,_0x30bc31){if(_0x2face1[_0xbff4('0x53')]['id']){delete _0x2face1['body']['id'];}return db[_0xbff4('0x38')][_0xbff4('0x52')]({'where':{'id':_0x2face1['params']['id']}})['then'](handleEntityNotFound(_0x30bc31,null))[_0xbff4('0x1b')](saveUpdates(_0x2face1['body'],null))['then'](respondWithResult(_0x30bc31,null))['catch'](handleError(_0x30bc31,null));};exports[_0xbff4('0x54')]=function(_0xc599b7,_0x5e0629,_0x2b9750){if(_0xc599b7[_0xbff4('0x55')]&&_0xc599b7[_0xbff4('0x55')]['filename']){_0xc599b7[_0xbff4('0x53')][_0xbff4('0x56')]=_0xc599b7[_0xbff4('0x55')][_0xbff4('0x57')];}return db['Setting'][_0xbff4('0x52')]({'where':{'id':_0xc599b7[_0xbff4('0x50')]['id']}})[_0xbff4('0x1b')](handleEntityNotFound(_0x5e0629,null))[_0xbff4('0x1b')](saveUpdates(_0xc599b7[_0xbff4('0x53')],null))[_0xbff4('0x1b')](respondWithResult(_0x5e0629,null))[_0xbff4('0x26')](handleError(_0x5e0629,null));};exports[_0xbff4('0x58')]=function(_0x5c5d1d,_0x482562,_0x2fbd71){if(_0x5c5d1d['file']&&_0x5c5d1d[_0xbff4('0x55')]['filename']){_0x5c5d1d[_0xbff4('0x53')][_0xbff4('0x59')]=_0x5c5d1d[_0xbff4('0x55')][_0xbff4('0x57')];}return db[_0xbff4('0x38')][_0xbff4('0x52')]({'where':{'id':_0x5c5d1d[_0xbff4('0x50')]['id']}})['then'](handleEntityNotFound(_0x482562,null))[_0xbff4('0x1b')](saveUpdates(_0x5c5d1d['body'],null))['then'](respondWithResult(_0x482562,null))[_0xbff4('0x26')](handleError(_0x482562,null));};var utilLicense=require(_0xbff4('0x5a'));exports[_0xbff4('0x5b')]=function(_0x376226,_0x58a6b7,_0x4f7184){var _0x3db6c6=_0xbff4('0x5c');var _0x526434={'custom':![]};return utilLicense[_0xbff4('0x5d')]()['then'](function(_0x159ac9){if(_0x159ac9){_0x526434=_0x159ac9;}return db[_0xbff4('0x38')][_0xbff4('0x52')]({'where':{'id':_0x376226[_0xbff4('0x50')]['id']},'attributes':['logo','loginLogo','preferred',_0xbff4('0x5e'),_0xbff4('0x5f'),'defaultLoginLogo',_0xbff4('0x60'),'defaultFavicon'],'raw':!![]});})[_0xbff4('0x1b')](handleEntityNotFound(_0x58a6b7,null))[_0xbff4('0x1b')](function(_0x250003){if(_0x250003){var _0x459feb=_0x250003[_0xbff4('0x56')]&&fs['existsSync'](path['join'](config['root'],_0x3db6c6,_[_0xbff4('0x61')](_0x250003[_0xbff4('0x56')])))?path[_0xbff4('0x62')](config[_0xbff4('0x63')],_0x3db6c6,_[_0xbff4('0x61')](_0x250003[_0xbff4('0x56')])):path[_0xbff4('0x62')](config[_0xbff4('0x63')],_0x3db6c6,_[_0xbff4('0x61')]('default_logo.png'));var _0x5c3f51=_0xbff4('0x64')+_[_0xbff4('0x65')](_0xbff4('0x56'));if(_0x250003[_0x5c3f51]||!_0x526434[_0xbff4('0x66')]){_0x459feb=path[_0xbff4('0x62')](config['root'],_0x3db6c6,_[_0xbff4('0x61')](_0xbff4('0x67')));}if(!fs[_0xbff4('0x68')](_0x459feb)){throw new db['Sequelize'][(_0xbff4('0x18'))](_[_0xbff4('0x65')](_0xbff4('0x56'))+'\x20not\x20found');}return _0x58a6b7[_0xbff4('0x69')](_0x459feb);}})['catch'](handleError(_0x58a6b7,null));};var utilLicense=require(_0xbff4('0x5a'));exports['getLogoLogin']=function(_0x4170af,_0x1e144f,_0x563857){var _0x5c266f='server/files/images/logos';var _0x5ac598={'custom':![]};return utilLicense[_0xbff4('0x5d')]()[_0xbff4('0x1b')](function(_0x5440cb){if(_0x5440cb){_0x5ac598=_0x5440cb;}return db[_0xbff4('0x38')][_0xbff4('0x52')]({'where':{'id':_0x4170af[_0xbff4('0x50')]['id']},'attributes':[_0xbff4('0x56'),'loginLogo',_0xbff4('0x6a'),_0xbff4('0x5e'),_0xbff4('0x5f'),'defaultLoginLogo',_0xbff4('0x60'),_0xbff4('0x6b')],'raw':!![]});})[_0xbff4('0x1b')](handleEntityNotFound(_0x1e144f,null))['then'](function(_0x5794c7){if(_0x5794c7){var _0x2b0ae8=_0x5794c7[_0xbff4('0x59')]&&fs[_0xbff4('0x68')](path[_0xbff4('0x62')](config[_0xbff4('0x63')],_0x5c266f,_['toLower'](_0x5794c7['loginLogo'])))?path[_0xbff4('0x62')](config[_0xbff4('0x63')],_0x5c266f,_[_0xbff4('0x61')](_0x5794c7[_0xbff4('0x59')])):path[_0xbff4('0x62')](config[_0xbff4('0x63')],_0x5c266f,_[_0xbff4('0x61')]('default_loginLogo.png'));var _0x502533=_0xbff4('0x64')+_['upperFirst'](_0xbff4('0x59'));if(_0x5794c7[_0x502533]||!_0x5ac598['custom']){_0x2b0ae8=path[_0xbff4('0x62')](config[_0xbff4('0x63')],_0x5c266f,_['toLower'](_0xbff4('0x6c')));}if(!fs['existsSync'](_0x2b0ae8)){throw new db['Sequelize'][(_0xbff4('0x18'))](_[_0xbff4('0x65')](_0xbff4('0x59'))+_0xbff4('0x6d'));}return _0x1e144f[_0xbff4('0x69')](_0x2b0ae8);}})[_0xbff4('0x26')](handleError(_0x1e144f,null));};exports[_0xbff4('0x6e')]=function(_0x521764,_0x3ed2a9){return db['Setting'][_0xbff4('0x52')]({'where':{'id':_0x521764[_0xbff4('0x50')]['id']},'attributes':[_0xbff4('0x6f')]})['then'](respondWithResult(_0x3ed2a9,null))['catch'](handleError(_0x3ed2a9,null));};exports[_0xbff4('0x70')]=function(_0x349ee2,_0x432475,_0x4aa14b){if(_0x349ee2[_0xbff4('0x55')]&&_0x349ee2[_0xbff4('0x55')]['filename']){_0x349ee2[_0xbff4('0x53')]['preferred']=_0x349ee2['file'][_0xbff4('0x57')];}return db[_0xbff4('0x38')]['find']({'where':{'id':_0x349ee2[_0xbff4('0x50')]['id']}})['then'](handleEntityNotFound(_0x432475,null))[_0xbff4('0x1b')](saveUpdates(_0x349ee2['body'],null))[_0xbff4('0x1b')](respondWithResult(_0x432475,null))[_0xbff4('0x26')](handleError(_0x432475,null));};var utilLicense=require(_0xbff4('0x5a'));exports['getPreferred']=function(_0x4d8eb3,_0x235550,_0x281730){var _0x526f35=_0xbff4('0x5c');var _0x1f63ff={'custom':![]};return utilLicense[_0xbff4('0x5d')]()[_0xbff4('0x1b')](function(_0x24dacd){if(_0x24dacd){_0x1f63ff=_0x24dacd;}return db['Setting']['find']({'where':{'id':_0x4d8eb3[_0xbff4('0x50')]['id']},'attributes':[_0xbff4('0x56'),'loginLogo',_0xbff4('0x6a'),_0xbff4('0x5e'),_0xbff4('0x5f'),_0xbff4('0x71'),_0xbff4('0x60'),_0xbff4('0x6b')],'raw':!![]});})[_0xbff4('0x1b')](handleEntityNotFound(_0x235550,null))['then'](function(_0x3e83f3){if(_0x3e83f3){var _0x45892a=_0x3e83f3[_0xbff4('0x6a')]&&fs[_0xbff4('0x68')](path[_0xbff4('0x62')](config[_0xbff4('0x63')],_0x526f35,_[_0xbff4('0x61')](_0x3e83f3['preferred'])))?path['join'](config['root'],_0x526f35,_[_0xbff4('0x61')](_0x3e83f3[_0xbff4('0x6a')])):path['join'](config[_0xbff4('0x63')],_0x526f35,_[_0xbff4('0x61')](_0xbff4('0x72')));var _0x4a4ba5=_0xbff4('0x64')+_[_0xbff4('0x65')](_0xbff4('0x6a'));if(_0x3e83f3[_0x4a4ba5]||!_0x1f63ff[_0xbff4('0x66')]||!_0x1f63ff['preferred']){_0x45892a=path['join'](config['root'],_0x526f35,_[_0xbff4('0x61')](_0xbff4('0x72')));}if(!fs[_0xbff4('0x68')](_0x45892a)){throw new db[(_0xbff4('0x17'))][(_0xbff4('0x18'))](_[_0xbff4('0x65')](_0xbff4('0x6a'))+'\x20not\x20found');}return _0x235550[_0xbff4('0x69')](_0x45892a);}})[_0xbff4('0x26')](handleError(_0x235550,null));};exports[_0xbff4('0x73')]=function(_0x423105,_0x19d441,_0x194a50){if(_0x423105[_0xbff4('0x55')]&&_0x423105[_0xbff4('0x55')][_0xbff4('0x57')]){_0x423105[_0xbff4('0x53')][_0xbff4('0x5e')]=_0x423105[_0xbff4('0x55')][_0xbff4('0x57')];}return db[_0xbff4('0x38')][_0xbff4('0x52')]({'where':{'id':_0x423105[_0xbff4('0x50')]['id']}})[_0xbff4('0x1b')](handleEntityNotFound(_0x19d441,null))[_0xbff4('0x1b')](saveUpdates(_0x423105[_0xbff4('0x53')],null))[_0xbff4('0x1b')](respondWithResult(_0x19d441,null))[_0xbff4('0x26')](handleError(_0x19d441,null));};var utilLicense=require(_0xbff4('0x5a'));exports[_0xbff4('0x74')]=function(_0x571374,_0x43b2f5,_0x28206f){var _0x29889e=_0xbff4('0x5c');var _0x1253d8={'custom':![]};return utilLicense['getLicense']()[_0xbff4('0x1b')](function(_0x4a86d2){if(_0x4a86d2){_0x1253d8=_0x4a86d2;}return db[_0xbff4('0x38')][_0xbff4('0x52')]({'where':{'id':_0x571374[_0xbff4('0x50')]['id']},'attributes':[_0xbff4('0x56'),_0xbff4('0x59'),_0xbff4('0x6a'),_0xbff4('0x5e'),_0xbff4('0x5f'),_0xbff4('0x71'),'defaultPreferred',_0xbff4('0x6b')],'raw':!![]});})['then'](handleEntityNotFound(_0x43b2f5,null))[_0xbff4('0x1b')](function(_0x27e7be){if(_0x27e7be){var _0x5d3059=_0x27e7be[_0xbff4('0x5e')]&&fs[_0xbff4('0x68')](path['join'](config[_0xbff4('0x63')],_0x29889e,_['toLower'](_0x27e7be[_0xbff4('0x5e')])))?path[_0xbff4('0x62')](config[_0xbff4('0x63')],_0x29889e,_[_0xbff4('0x61')](_0x27e7be[_0xbff4('0x5e')])):path['join'](config['root'],_0x29889e,_[_0xbff4('0x61')](_0xbff4('0x75')));var _0x49ba4b='default'+_[_0xbff4('0x65')]('favicon');if(_0x27e7be[_0x49ba4b]||!_0x1253d8[_0xbff4('0x66')]){_0x5d3059=path[_0xbff4('0x62')](config[_0xbff4('0x63')],_0x29889e,_[_0xbff4('0x61')](_0xbff4('0x75')));}if(!fs['existsSync'](_0x5d3059)){throw new db[(_0xbff4('0x17'))]['ValidationError'](_['upperFirst'](_0xbff4('0x5e'))+_0xbff4('0x6d'));}return _0x43b2f5[_0xbff4('0x69')](_0x5d3059);}})[_0xbff4('0x26')](handleError(_0x43b2f5,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index ae0b1e3..3b872fa 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 _0x2261=['./setting.attributes','exports','define','Setting','settings','lodash','util','../../config/logger','api','bluebird','../../config/environment'];(function(_0x246115,_0x398123){var _0x385878=function(_0x534a9c){while(--_0x534a9c){_0x246115['push'](_0x246115['shift']());}};_0x385878(++_0x398123);}(_0x2261,0x1c8));var _0x1226=function(_0x51c745,_0x439a91){_0x51c745=_0x51c745-0x0;var _0x20e209=_0x2261[_0x51c745];return _0x20e209;};'use strict';var _=require(_0x1226('0x0'));var util=require(_0x1226('0x1'));var logger=require(_0x1226('0x2'))(_0x1226('0x3'));var moment=require('moment');var BPromise=require(_0x1226('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1226('0x5'));var attributes=require(_0x1226('0x6'));module[_0x1226('0x7')]=function(_0x43b1b4,_0x29493f){return _0x43b1b4[_0x1226('0x8')](_0x1226('0x9'),attributes,{'tableName':_0x1226('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e33=['Setting','settings','lodash','util','api','bluebird','path','rimraf','./setting.attributes','exports'];(function(_0x43018,_0x538c11){var _0x185071=function(_0x3b9248){while(--_0x3b9248){_0x43018['push'](_0x43018['shift']());}};_0x185071(++_0x538c11);}(_0x3e33,0x1ec));var _0x33e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e33[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x33e3('0x0'));var util=require(_0x33e3('0x1'));var logger=require('../../config/logger')(_0x33e3('0x2'));var moment=require('moment');var BPromise=require(_0x33e3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x33e3('0x4'));var rimraf=require(_0x33e3('0x5'));var config=require('../../config/environment');var attributes=require(_0x33e3('0x6'));module[_0x33e3('0x7')]=function(_0x377d8d,_0x33beee){return _0x377d8d['define'](_0x33e3('0x8'),attributes,{'tableName':_0x33e3('0x9'),'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 49cfd0e..e654aa9 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 _0x3a27=['http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x3a27,0x156));var _0x73a2=function(_0x40f58d,_0x56e58f){_0x40f58d=_0x40f58d-0x0;var _0x1afd58=_0x3a27[_0x40f58d];return _0x1afd58;};'use strict';var _=require(_0x73a2('0x0'));var util=require('util');var moment=require(_0x73a2('0x1'));var BPromise=require(_0x73a2('0x2'));var rs=require(_0x73a2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73a2('0x4'))['db'];var utils=require(_0x73a2('0x5'));var logger=require('../../config/logger')(_0x73a2('0x6'));var config=require(_0x73a2('0x7'));var jayson=require(_0x73a2('0x8'));var client=jayson[_0x73a2('0x9')][_0x73a2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39f925,_0x2d8169,_0x70f8e2){return new BPromise(function(_0x40448c,_0xc2ecf4){return client[_0x73a2('0xb')](_0x39f925,_0x70f8e2)[_0x73a2('0xc')](function(_0x503b82){logger[_0x73a2('0xd')](_0x73a2('0xe'),_0x2d8169,_0x73a2('0xf'));logger[_0x73a2('0x10')]('Setting,\x20%s,\x20%s,\x20%s',_0x2d8169,_0x73a2('0xf'),JSON[_0x73a2('0x11')](_0x503b82));if(_0x503b82[_0x73a2('0x12')]){if(_0x503b82[_0x73a2('0x12')][_0x73a2('0x13')]===0x1f4){logger[_0x73a2('0x12')](_0x73a2('0xe'),_0x2d8169,_0x503b82[_0x73a2('0x12')][_0x73a2('0x14')]);return _0xc2ecf4(_0x503b82[_0x73a2('0x12')]['message']);}logger[_0x73a2('0x12')](_0x73a2('0xe'),_0x2d8169,_0x503b82[_0x73a2('0x12')][_0x73a2('0x14')]);return _0x40448c(_0x503b82[_0x73a2('0x12')][_0x73a2('0x14')]);}else{logger[_0x73a2('0xd')](_0x73a2('0xe'),_0x2d8169,'request\x20sent');_0x40448c(_0x503b82[_0x73a2('0x15')][_0x73a2('0x14')]);}})['catch'](function(_0x4fcf69){logger['error'](_0x73a2('0xe'),_0x2d8169,_0x4fcf69);_0xc2ecf4(_0x4fcf69);});});} \ No newline at end of file +var _0x36ac=['request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0xb96fb8,_0x480337){var _0x32dd5c=function(_0x3f2bae){while(--_0x3f2bae){_0xb96fb8['push'](_0xb96fb8['shift']());}};_0x32dd5c(++_0x480337);}(_0x36ac,0xe7));var _0xc36a=function(_0x2e7155,_0x5dea87){_0x2e7155=_0x2e7155-0x0;var _0x22e6dd=_0x36ac[_0x2e7155];return _0x22e6dd;};'use strict';var _=require(_0xc36a('0x0'));var util=require('util');var moment=require(_0xc36a('0x1'));var BPromise=require(_0xc36a('0x2'));var rs=require(_0xc36a('0x3'));var fs=require('fs');var Redis=require(_0xc36a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc36a('0x5'));var logger=require(_0xc36a('0x6'))(_0xc36a('0x7'));var config=require(_0xc36a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc36a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2299ee,_0x4b48a8,_0x17b470){return new BPromise(function(_0x266b76,_0x285684){return client[_0xc36a('0xa')](_0x2299ee,_0x17b470)['then'](function(_0x328d49){logger['info']('Setting,\x20%s,\x20%s',_0x4b48a8,_0xc36a('0xb'));logger[_0xc36a('0xc')](_0xc36a('0xd'),_0x4b48a8,_0xc36a('0xb'),JSON[_0xc36a('0xe')](_0x328d49));if(_0x328d49[_0xc36a('0xf')]){if(_0x328d49['error'][_0xc36a('0x10')]===0x1f4){logger[_0xc36a('0xf')](_0xc36a('0x11'),_0x4b48a8,_0x328d49['error'][_0xc36a('0x12')]);return _0x285684(_0x328d49[_0xc36a('0xf')]['message']);}logger[_0xc36a('0xf')](_0xc36a('0x11'),_0x4b48a8,_0x328d49[_0xc36a('0xf')]['message']);return _0x266b76(_0x328d49['error']['message']);}else{logger[_0xc36a('0x13')]('Setting,\x20%s,\x20%s',_0x4b48a8,_0xc36a('0xb'));_0x266b76(_0x328d49[_0xc36a('0x14')][_0xc36a('0x12')]);}})[_0xc36a('0x15')](function(_0x119a6b){logger[_0xc36a('0xf')](_0xc36a('0x11'),_0x4b48a8,_0x119a6b);_0x285684(_0x119a6b);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 31933bf..f3acbe3 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 _0x962b=['notify','/:id/applications','/:id/send','send','status','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','getInteractions','/:id/status','statusGet','/:id/users','post','addDisposition','addAnswer','/:id/notify'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x962b,0x1ec));var _0xb962=function(_0x59a689,_0x503306){_0x59a689=_0x59a689-0x0;var _0x4e7c31=_0x962b[_0x59a689];return _0x4e7c31;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb962('0x0'));var timeout=require(_0xb962('0x1'));var express=require(_0xb962('0x2'));var router=express[_0xb962('0x3')]();var auth=require(_0xb962('0x4'));var interaction=require(_0xb962('0x5'));var config=require('../../config/environment');var controller=require(_0xb962('0x6'));router[_0xb962('0x7')]('/',auth[_0xb962('0x8')](),controller['index']);router[_0xb962('0x7')](_0xb962('0x9'),auth[_0xb962('0x8')](),controller[_0xb962('0xa')]);router[_0xb962('0x7')](_0xb962('0xb'),auth[_0xb962('0x8')](),controller[_0xb962('0xc')]);router['get'](_0xb962('0xd'),auth[_0xb962('0x8')](),controller[_0xb962('0xe')]);router[_0xb962('0x7')](_0xb962('0xf'),auth[_0xb962('0x8')](),controller[_0xb962('0x10')]);router[_0xb962('0x7')]('/:id/applications',auth[_0xb962('0x8')](),controller[_0xb962('0x11')]);router['get']('/:id/interactions',auth[_0xb962('0x8')](),controller[_0xb962('0x12')]);router[_0xb962('0x7')](_0xb962('0x13'),controller[_0xb962('0x14')]);router[_0xb962('0x7')](_0xb962('0x15'),auth[_0xb962('0x8')](),controller['getAgents']);router[_0xb962('0x16')]('/',auth[_0xb962('0x8')](),controller['create']);router[_0xb962('0x16')](_0xb962('0xd'),auth[_0xb962('0x8')](),controller[_0xb962('0x17')]);router[_0xb962('0x16')](_0xb962('0xf'),auth[_0xb962('0x8')](),controller[_0xb962('0x18')]);router[_0xb962('0x16')](_0xb962('0x19'),controller[_0xb962('0x1a')]);router[_0xb962('0x16')](_0xb962('0x1b'),auth[_0xb962('0x8')](),controller['addApplications']);router['post'](_0xb962('0x1c'),auth[_0xb962('0x8')](),controller[_0xb962('0x1d')]);router[_0xb962('0x16')](_0xb962('0x13'),controller[_0xb962('0x1e')]);router[_0xb962('0x16')](_0xb962('0x15'),auth[_0xb962('0x8')](),controller['addAgents']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb962('0x1f')]);router[_0xb962('0x20')]('/:id',auth[_0xb962('0x8')](),controller[_0xb962('0x21')]);router[_0xb962('0x20')](_0xb962('0xd'),auth['isAuthenticated'](),controller[_0xb962('0x22')]);router[_0xb962('0x20')](_0xb962('0xf'),auth['isAuthenticated'](),controller[_0xb962('0x23')]);router[_0xb962('0x20')](_0xb962('0x15'),auth[_0xb962('0x8')](),controller[_0xb962('0x24')]);module['exports']=router; \ No newline at end of file +var _0xa174=['/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','getAgents','create','post','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','status','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id/dispositions'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xa174,0x1df));var _0x4a17=function(_0x5e57fc,_0x4acb27){_0x5e57fc=_0x5e57fc-0x0;var _0x384442=_0xa174[_0x5e57fc];return _0x384442;};'use strict';var multer=require('multer');var util=require(_0x4a17('0x0'));var path=require(_0x4a17('0x1'));var timeout=require(_0x4a17('0x2'));var express=require(_0x4a17('0x3'));var router=express[_0x4a17('0x4')]();var auth=require(_0x4a17('0x5'));var interaction=require(_0x4a17('0x6'));var config=require(_0x4a17('0x7'));var controller=require('./smsAccount.controller');router[_0x4a17('0x8')]('/',auth['isAuthenticated'](),controller[_0x4a17('0x9')]);router[_0x4a17('0x8')]('/describe',auth[_0x4a17('0xa')](),controller[_0x4a17('0xb')]);router['get']('/:id',auth[_0x4a17('0xa')](),controller['show']);router[_0x4a17('0x8')](_0x4a17('0xc'),auth[_0x4a17('0xa')](),controller['getDispositions']);router[_0x4a17('0x8')](_0x4a17('0xd'),auth[_0x4a17('0xa')](),controller[_0x4a17('0xe')]);router['get'](_0x4a17('0xf'),auth['isAuthenticated'](),controller['getApplications']);router[_0x4a17('0x8')](_0x4a17('0x10'),auth[_0x4a17('0xa')](),controller[_0x4a17('0x11')]);router['get'](_0x4a17('0x12'),controller[_0x4a17('0x13')]);router['get'](_0x4a17('0x14'),auth[_0x4a17('0xa')](),controller[_0x4a17('0x15')]);router['post']('/',auth[_0x4a17('0xa')](),controller[_0x4a17('0x16')]);router[_0x4a17('0x17')]('/:id/dispositions',auth[_0x4a17('0xa')](),controller[_0x4a17('0x18')]);router[_0x4a17('0x17')](_0x4a17('0xd'),auth['isAuthenticated'](),controller[_0x4a17('0x19')]);router[_0x4a17('0x17')](_0x4a17('0x1a'),controller[_0x4a17('0x1b')]);router[_0x4a17('0x17')](_0x4a17('0xf'),auth[_0x4a17('0xa')](),controller[_0x4a17('0x1c')]);router[_0x4a17('0x17')](_0x4a17('0x1d'),auth[_0x4a17('0xa')](),controller[_0x4a17('0x1e')]);router[_0x4a17('0x17')](_0x4a17('0x12'),controller[_0x4a17('0x1f')]);router[_0x4a17('0x17')](_0x4a17('0x14'),auth[_0x4a17('0xa')](),controller[_0x4a17('0x20')]);router[_0x4a17('0x21')](_0x4a17('0x22'),auth[_0x4a17('0xa')](),controller[_0x4a17('0x23')]);router[_0x4a17('0x24')](_0x4a17('0x22'),auth[_0x4a17('0xa')](),controller['destroy']);router[_0x4a17('0x24')](_0x4a17('0xc'),auth[_0x4a17('0xa')](),controller[_0x4a17('0x25')]);router['delete']('/:id/canned_answers',auth[_0x4a17('0xa')](),controller[_0x4a17('0x26')]);router[_0x4a17('0x24')](_0x4a17('0x14'),auth[_0x4a17('0xa')](),controller[_0x4a17('0x27')]);module[_0x4a17('0x28')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 82113f8..23db481 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 _0x4d1f=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','generate','ENUM','twilio','connectel','clicksend','plivo','clickatell','csc','infobip','intelepeer','BOOLEAN','TEXT'];(function(_0x22d43a,_0x5c78e9){var _0x3a1bbd=function(_0x46c1b9){while(--_0x46c1b9){_0x22d43a['push'](_0x22d43a['shift']());}};_0x3a1bbd(++_0x5c78e9);}(_0x4d1f,0x16b));var _0xf4d1=function(_0x2338ae,_0x1896f8){_0x2338ae=_0x2338ae-0x0;var _0x4adad9=_0x4d1f[_0x2338ae];return _0x4adad9;};'use strict';var Sequelize=require(_0xf4d1('0x0'));var rs=require('randomstring');module[_0xf4d1('0x1')]={'name':{'type':Sequelize[_0xf4d1('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xf4d1('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xf4d1('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xf4d1('0x2')],'defaultValue':function(){return rs[_0xf4d1('0x3')]();}},'phone':{'type':Sequelize[_0xf4d1('0x2')]},'type':{'type':Sequelize[_0xf4d1('0x4')](_0xf4d1('0x5'),'skebby',_0xf4d1('0x6'),_0xf4d1('0x7'),_0xf4d1('0x8'),_0xf4d1('0x9'),_0xf4d1('0xa'),_0xf4d1('0xb'),_0xf4d1('0xc'))},'accountSid':{'type':Sequelize[_0xf4d1('0x2')]},'authId':{'type':Sequelize[_0xf4d1('0x2')]},'authToken':{'type':Sequelize[_0xf4d1('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xf4d1('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0xf4d1('0x2')]},'notificationTemplate':{'type':Sequelize[_0xf4d1('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xf4d1('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf4d1('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf4d1('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf4d1('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf4d1('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf4d1('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xf4d1('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf4d1('0xf')],'comment':_0xf4d1('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xf4d1('0xd')],'defaultValue':![],'comment':_0xf4d1('0x11'),'set':function(_0x4977b3){if(!_0x4977b3)this[_0xf4d1('0x12')](_0xf4d1('0x13'),null);this[_0xf4d1('0x12')](_0xf4d1('0x14'),_0x4977b3);}}}; \ No newline at end of file +var _0x01a2=['STRING','ENUM','connectel','plivo','csc','infobip','BOOLEAN','TEXT','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x01a2,0x18d));var _0x201a=function(_0x16b2a4,_0x45602c){_0x16b2a4=_0x16b2a4-0x0;var _0x4ba3b3=_0x01a2[_0x16b2a4];return _0x4ba3b3;};'use strict';var Sequelize=require(_0x201a('0x0'));var rs=require('randomstring');module[_0x201a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x201a('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x201a('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x201a('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x201a('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x201a('0x3')]},'type':{'type':Sequelize[_0x201a('0x4')]('twilio','skebby',_0x201a('0x5'),'clicksend',_0x201a('0x6'),'clickatell',_0x201a('0x7'),_0x201a('0x8'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x201a('0x3')]},'authToken':{'type':Sequelize[_0x201a('0x3')]},'smsMethod':{'type':Sequelize[_0x201a('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x201a('0x3')]},'password':{'type':Sequelize[_0x201a('0x3')]},'apiKey':{'type':Sequelize[_0x201a('0x3')]},'senderString':{'type':Sequelize[_0x201a('0x3')]},'deliveryReport':{'type':Sequelize[_0x201a('0x9')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x201a('0xa')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x201a('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x201a('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x201a('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x201a('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x201a('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x201a('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x201a('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x201a('0x9')],'defaultValue':![],'comment':_0x201a('0xc'),'set':function(_0x356195){if(!_0x356195)this[_0x201a('0xd')](_0x201a('0xe'),null);this[_0x201a('0xd')](_0x201a('0xf'),_0x356195);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 09d06e5..a72d0b6 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 _0x896e=['Start','startRouting','receiveMessage','entity\x20found','stringify','set','Content-Type','text/xml','addApplications','sequelize','transaction','findAndCountAll','getApplications','Contact','User','fullname','internal','Tags','color','tag','List','out','spread','Messages','dataValues','log','endpoint\x20/status\x20POST\x20/','SmsAccount,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','intelepeer','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','Sequelize','ValidationError','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','status','end','count','offset','limit','Content-Range','json','destroy','get','SmsAccounts','UserProfileResource','sendStatus','name','send','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','fields','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','update','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','hasOwnProperty','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','sms','SmsApplication','Applications','account','applications','priority','asc','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','messageId','MessageSid','skebby','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','clickatell','replyMessageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','omit','mapKey','SmsInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent'];(function(_0x151d04,_0x31e9f0){var _0x2c0ef5=function(_0x450056){while(--_0x450056){_0x151d04['push'](_0x151d04['shift']());}};_0x2c0ef5(++_0x31e9f0);}(_0x896e,0x1e9));var _0xe896=function(_0x176a8f,_0x4c468f){_0x176a8f=_0x176a8f-0x0;var _0x4a15a5=_0x896e[_0x176a8f];return _0x4a15a5;};'use strict';var pdf=require(_0xe896('0x0'));var emlformat=require(_0xe896('0x1'));var rimraf=require(_0xe896('0x2'));var zipdir=require(_0xe896('0x3'));var jsonpatch=require(_0xe896('0x4'));var rp=require(_0xe896('0x5'));var moment=require(_0xe896('0x6'));var BPromise=require(_0xe896('0x7'));var Mustache=require(_0xe896('0x8'));var util=require(_0xe896('0x9'));var path=require(_0xe896('0xa'));var sox=require(_0xe896('0xb'));var csv=require('to-csv');var ejs=require(_0xe896('0xc'));var fs=require('fs');var _=require(_0xe896('0xd'));var squel=require(_0xe896('0xe'));var crypto=require(_0xe896('0xf'));var jsforce=require(_0xe896('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe896('0x11'));var querystring=require(_0xe896('0x12'));var Papa=require(_0xe896('0x13'));var Redis=require('ioredis');var authService=require(_0xe896('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe896('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe896('0x16'))(_0xe896('0x17'));var utils=require(_0xe896('0x18'));var config=require('../../config/environment');var db=require(_0xe896('0x19'))['db'];config[_0xe896('0x1a')]=_[_0xe896('0x1b')](config['redis'],{'host':_0xe896('0x1c'),'port':0x18eb});var socket=require(_0xe896('0x1d'))(new Redis(config[_0xe896('0x1a')]));require('./smsAccount.socket')[_0xe896('0x1e')](socket);var jayson=require(_0xe896('0x1f'));var client=jayson[_0xe896('0x20')]['http']({'port':0x232c});function checkPasswordPattern(_0x5a7957,_0x446ce2,_0x25606b){if(_0x25606b){var _0x51e7b7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x51e7b7['test'](_0x446ce2)){return _0x5a7957;}else{throw new db[(_0xe896('0x21'))][(_0xe896('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 _0x5a7957;}}function respondWithRpcPromise(_0x50d224,_0x4e062a,_0x41cbd7,_0x32f86d){return new BPromise(function(_0x2d4cf0,_0x5dc89d){var _0x782813=_0x32f86d||client;return _0x782813[_0xe896('0x23')](_0x50d224,_0x41cbd7)[_0xe896('0x24')](function(_0xbebbe1){logger[_0xe896('0x25')](_0xe896('0x26'),_0x4e062a,_0xe896('0x27'));logger[_0xe896('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4e062a,_0xe896('0x27'),JSON['stringify'](_0xbebbe1));if(_0xbebbe1['error']){if(_0xbebbe1[_0xe896('0x29')][_0xe896('0x2a')]===0x1f4){logger[_0xe896('0x29')](_0xe896('0x26'),_0x4e062a,_0xbebbe1['error'][_0xe896('0x2b')]);return _0x5dc89d(_0xbebbe1['error']['message']);}logger[_0xe896('0x29')](_0xe896('0x26'),_0x4e062a,_0xbebbe1[_0xe896('0x29')][_0xe896('0x2b')]);return _0x2d4cf0(_0xbebbe1[_0xe896('0x29')][_0xe896('0x2b')]);}else{logger[_0xe896('0x25')]('SmsAccount,\x20%s,\x20%s',_0x4e062a,_0xe896('0x27'));_0x2d4cf0(_0xbebbe1[_0xe896('0x2c')][_0xe896('0x2b')]);}})['catch'](function(_0x26635e){logger[_0xe896('0x29')](_0xe896('0x26'),_0x4e062a,_0x26635e);_0x5dc89d(_0x26635e);});});}function respondWithStatusCode(_0xe93aa0,_0x2d8a7b){_0x2d8a7b=_0x2d8a7b||0xcc;return function(_0x3f8ceb){if(_0x3f8ceb){return _0xe93aa0['sendStatus'](_0x2d8a7b);}return _0xe93aa0[_0xe896('0x2d')](_0x2d8a7b)[_0xe896('0x2e')]();};}function respondWithResult(_0x201653,_0xbfb15b){_0xbfb15b=_0xbfb15b||0xc8;return function(_0xace03f){if(_0xace03f){return _0x201653['status'](_0xbfb15b)['json'](_0xace03f);}};}function respondWithFilteredResult(_0x5c7dae,_0x504d7c){return function(_0x562ddd){if(_0x562ddd){var _0x291290=_0x562ddd[_0xe896('0x2f')],_0x29a18e=_0x504d7c[_0xe896('0x30')],_0x10fd26=_0x504d7c[_0xe896('0x30')]+_0x504d7c[_0xe896('0x31')],_0x76c781;if(_0x10fd26>=_0x291290){_0x10fd26=_0x291290;_0x76c781=0xc8;}else{_0x76c781=0xce;}_0x5c7dae['status'](_0x76c781);return _0x5c7dae['set'](_0xe896('0x32'),_0x29a18e+'-'+_0x10fd26+'/'+_0x291290)[_0xe896('0x33')](_0x562ddd);}return null;};}function patchUpdates(_0x29be89){return function(_0x76c0c3){try{jsonpatch['apply'](_0x76c0c3,_0x29be89,!![]);}catch(_0x14ad7a){return BPromise['reject'](_0x14ad7a);}return _0x76c0c3['save']();};}function saveUpdates(_0x166b86,_0x363fd8){return function(_0x266c0e){if(_0x266c0e){return _0x266c0e['update'](_0x166b86)['then'](function(_0x567589){return _0x567589;});}return null;};}function removeEntity(_0x46c8ae,_0x1493b8){return function(_0x10fa64){if(_0x10fa64){return _0x10fa64[_0xe896('0x34')]()[_0xe896('0x24')](function(){var _0x486eb5=_0x10fa64[_0xe896('0x35')]({'plain':!![]});var _0x394257=_0xe896('0x36');return db[_0xe896('0x37')][_0xe896('0x34')]({'where':{'type':_0x394257,'resourceId':_0x486eb5['id']}})[_0xe896('0x24')](function(){return _0x10fa64;});})[_0xe896('0x24')](function(){_0x46c8ae[_0xe896('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42f3fb,_0x1ad362){return function(_0x5a2dd2){if(!_0x5a2dd2){_0x42f3fb[_0xe896('0x38')](0x194);}return _0x5a2dd2;};}function handleError(_0x4baad4,_0x43ecc4){_0x43ecc4=_0x43ecc4||0x1f4;return function(_0x4f164f){logger[_0xe896('0x29')](_0x4f164f['stack']);if(_0x4f164f[_0xe896('0x39')]){delete _0x4f164f[_0xe896('0x39')];}_0x4baad4[_0xe896('0x2d')](_0x43ecc4)[_0xe896('0x3a')](_0x4f164f);};}exports[_0xe896('0x3b')]=function(_0x533173,_0x480b8a){var _0x203aea={'include':[{'model':db[_0xe896('0x3c')],'as':_0xe896('0x3d')}]},_0x2ea387={},_0x387cc6={'count':0x0,'rows':[]};var _0x4c0ef0=_['map'](db[_0xe896('0x3e')][_0xe896('0x3f')],function(_0x5890b1){return{'name':_0x5890b1['fieldName'],'type':_0x5890b1[_0xe896('0x40')][_0xe896('0x41')]};});_0x2ea387[_0xe896('0x42')]=_[_0xe896('0x43')](_0x4c0ef0,_0xe896('0x39'));_0x2ea387[_0xe896('0x44')]=_[_0xe896('0x45')](_0x533173[_0xe896('0x44')]);_0x2ea387[_0xe896('0x46')]=_[_0xe896('0x47')](_0x2ea387[_0xe896('0x42')],_0x2ea387[_0xe896('0x44')]);_0x203aea['attributes']=_[_0xe896('0x47')](_0x2ea387[_0xe896('0x42')],qs['fields'](_0x533173['query']['fields']));_0x203aea[_0xe896('0x48')]=_0x203aea[_0xe896('0x48')][_0xe896('0x49')]?_0x203aea['attributes']:_0x2ea387[_0xe896('0x42')];if(!_0x533173[_0xe896('0x44')]['hasOwnProperty']('nolimit')){_0x203aea['limit']=qs[_0xe896('0x31')](_0x533173[_0xe896('0x44')][_0xe896('0x31')]);_0x203aea[_0xe896('0x30')]=qs[_0xe896('0x30')](_0x533173[_0xe896('0x44')]['offset']);}_0x203aea[_0xe896('0x4a')]=qs[_0xe896('0x4b')](_0x533173['query'][_0xe896('0x4b')]);_0x203aea[_0xe896('0x4c')]=qs[_0xe896('0x46')](_[_0xe896('0x4d')](_0x533173['query'],_0x2ea387[_0xe896('0x46')]));if(_0x533173[_0xe896('0x44')][_0xe896('0x4e')]){_0x203aea[_0xe896('0x4c')]=_[_0xe896('0x4f')](_0x203aea[_0xe896('0x4c')],{'$or':_['map'](_0x4c0ef0,function(_0x353534){if(_0x353534['type']!==_0xe896('0x50')){var _0x1c6ae1={};_0x1c6ae1[_0x353534[_0xe896('0x39')]]={'$like':'%'+_0x533173[_0xe896('0x44')][_0xe896('0x4e')]+'%'};return _0x1c6ae1;}})});}_0x203aea=_[_0xe896('0x4f')]({},_0x203aea,_0x533173['options']);var _0xbb7658={'where':_0x203aea[_0xe896('0x4c')]};return db['SmsAccount'][_0xe896('0x2f')](_0xbb7658)[_0xe896('0x24')](function(_0x4d0047){_0x387cc6[_0xe896('0x2f')]=_0x4d0047;if(_0x533173['query'][_0xe896('0x51')]){_0x203aea[_0xe896('0x52')]=[{'all':!![]}];}return db[_0xe896('0x3e')][_0xe896('0x53')](_0x203aea);})[_0xe896('0x24')](function(_0x4d607e){_0x387cc6[_0xe896('0x54')]=_0x4d607e;return _0x387cc6;})[_0xe896('0x24')](respondWithFilteredResult(_0x480b8a,_0x203aea))[_0xe896('0x55')](handleError(_0x480b8a,null));};exports['show']=function(_0x2ceae5,_0x5d205b){var _0x4a08f6={'raw':![],'where':{'id':_0x2ceae5[_0xe896('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0xe896('0x3d')}]},_0x388375={};_0x388375[_0xe896('0x42')]=_['keys'](db['SmsAccount'][_0xe896('0x3f')]);_0x388375[_0xe896('0x44')]=_['keys'](_0x2ceae5[_0xe896('0x44')]);_0x388375[_0xe896('0x46')]=_[_0xe896('0x47')](_0x388375[_0xe896('0x42')],_0x388375[_0xe896('0x44')]);_0x4a08f6[_0xe896('0x48')]=_[_0xe896('0x47')](_0x388375[_0xe896('0x42')],qs[_0xe896('0x57')](_0x2ceae5[_0xe896('0x44')][_0xe896('0x57')]));_0x4a08f6['attributes']=_0x4a08f6[_0xe896('0x48')][_0xe896('0x49')]?_0x4a08f6[_0xe896('0x48')]:_0x388375[_0xe896('0x42')];if(_0x2ceae5[_0xe896('0x44')][_0xe896('0x51')]){_0x4a08f6[_0xe896('0x52')]=[{'all':!![]}];}_0x4a08f6=_[_0xe896('0x4f')]({},_0x4a08f6,_0x2ceae5[_0xe896('0x58')]);return db[_0xe896('0x3e')][_0xe896('0x59')](_0x4a08f6)[_0xe896('0x24')](handleEntityNotFound(_0x5d205b,null))['then'](respondWithResult(_0x5d205b,null))[_0xe896('0x55')](handleError(_0x5d205b,null));};exports[_0xe896('0x5a')]=function(_0x156867,_0x5180b6){return db['SmsAccount']['create'](_0x156867[_0xe896('0x5b')],{})[_0xe896('0x24')](function(_0x20cadc){var _0x2496d4=_0x156867['user'][_0xe896('0x35')]({'plain':!![]});if(!_0x2496d4)throw new Error(_0xe896('0x5c'));if(_0x2496d4[_0xe896('0x5d')]===_0xe896('0x5e')){var _0x5d6c1c=_0x20cadc[_0xe896('0x35')]({'plain':!![]});var _0x18d29a='SmsAccounts';return db[_0xe896('0x5f')][_0xe896('0x59')]({'where':{'name':_0x18d29a,'userProfileId':_0x2496d4['userProfileId']},'raw':!![]})['then'](function(_0x2a5e68){if(_0x2a5e68&&_0x2a5e68[_0xe896('0x60')]===0x0){return db[_0xe896('0x37')][_0xe896('0x5a')]({'name':_0x5d6c1c[_0xe896('0x39')],'resourceId':_0x5d6c1c['id'],'type':_0x2a5e68['name'],'sectionId':_0x2a5e68['id']},{})[_0xe896('0x24')](function(){return _0x20cadc;});}else{return _0x20cadc;}})[_0xe896('0x55')](function(_0x113b00){logger[_0xe896('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x113b00);throw _0x113b00;});}return _0x20cadc;})['then'](respondWithResult(_0x5180b6,0xc9))[_0xe896('0x55')](handleError(_0x5180b6,null));};exports[_0xe896('0x61')]=function(_0x4b4903,_0x1f0eeb){if(_0x4b4903['body']['id']){delete _0x4b4903[_0xe896('0x5b')]['id'];}return db[_0xe896('0x3e')][_0xe896('0x59')]({'where':{'id':_0x4b4903[_0xe896('0x56')]['id']},'include':[{'model':db[_0xe896('0x3c')],'as':_0xe896('0x3d')}]})[_0xe896('0x24')](handleEntityNotFound(_0x1f0eeb,null))[_0xe896('0x24')](saveUpdates(_0x4b4903[_0xe896('0x5b')],null))[_0xe896('0x24')](respondWithResult(_0x1f0eeb,null))[_0xe896('0x55')](handleError(_0x1f0eeb,null));};exports[_0xe896('0x34')]=function(_0x41ec26,_0x14d88e){return db[_0xe896('0x3e')][_0xe896('0x59')]({'where':{'id':_0x41ec26[_0xe896('0x56')]['id']}})[_0xe896('0x24')](handleEntityNotFound(_0x14d88e,null))[_0xe896('0x24')](removeEntity(_0x14d88e,null))[_0xe896('0x55')](handleError(_0x14d88e,null));};exports[_0xe896('0x62')]=function(_0x35381d,_0x512930){return db['SmsAccount'][_0xe896('0x62')]()[_0xe896('0x24')](respondWithResult(_0x512930,null))['catch'](handleError(_0x512930,null));};exports[_0xe896('0x63')]=function(_0x3f8feb,_0x2da4ca,_0x186ddc){if(_0x3f8feb[_0xe896('0x5b')]['id']){delete _0x3f8feb[_0xe896('0x5b')]['id'];}return db[_0xe896('0x3e')][_0xe896('0x59')]({'where':{'id':_0x3f8feb[_0xe896('0x56')]['id']}})[_0xe896('0x24')](handleEntityNotFound(_0x2da4ca,null))[_0xe896('0x24')](function(_0x4e417a){if(_0x4e417a){_0x3f8feb[_0xe896('0x5b')][_0xe896('0x64')]=_0x4e417a['id'];return db['Disposition'][_0xe896('0x5a')](_0x3f8feb['body']);}})['then'](respondWithResult(_0x2da4ca,null))[_0xe896('0x55')](handleError(_0x2da4ca,null));};exports[_0xe896('0x65')]=function(_0x4fd476,_0x56223c,_0x2695a5){var _0x4a39b3={'raw':![],'where':{}};var _0x4deba7={};var _0x162bb0={'count':0x0,'rows':[]};return db[_0xe896('0x3e')][_0xe896('0x66')]({'where':{'id':_0x4fd476['params']['id']}})[_0xe896('0x24')](handleEntityNotFound(_0x56223c,null))[_0xe896('0x24')](function(_0x43229b){if(_0x43229b){_0x4deba7['model']=_[_0xe896('0x45')](db[_0xe896('0x67')][_0xe896('0x3f')]);_0x4deba7[_0xe896('0x44')]=_['keys'](_0x4fd476[_0xe896('0x44')]);_0x4deba7[_0xe896('0x46')]=_[_0xe896('0x47')](_0x4deba7[_0xe896('0x42')],_0x4deba7['query']);_0x4a39b3[_0xe896('0x48')]=_[_0xe896('0x47')](_0x4deba7['model'],qs[_0xe896('0x57')](_0x4fd476[_0xe896('0x44')][_0xe896('0x57')]));_0x4a39b3[_0xe896('0x48')]=_0x4a39b3['attributes'][_0xe896('0x49')]?_0x4a39b3[_0xe896('0x48')]:_0x4deba7[_0xe896('0x42')];if(!_0x4fd476[_0xe896('0x44')][_0xe896('0x68')](_0xe896('0x69'))){_0x4a39b3['limit']=qs['limit'](_0x4fd476['query'][_0xe896('0x31')]);_0x4a39b3[_0xe896('0x30')]=qs[_0xe896('0x30')](_0x4fd476[_0xe896('0x44')][_0xe896('0x30')]);}_0x4a39b3[_0xe896('0x4a')]=qs[_0xe896('0x4b')](_0x4fd476['query']['sort']);_0x4a39b3[_0xe896('0x4c')]=qs['filters'](_[_0xe896('0x4d')](_0x4fd476['query'],_0x4deba7[_0xe896('0x46')]));_0x4a39b3['where'][_0xe896('0x64')]=_0x43229b['id'];if(_0x4fd476[_0xe896('0x44')][_0xe896('0x4e')]){_0x4a39b3[_0xe896('0x4c')]=_[_0xe896('0x4f')](_0x4a39b3['where'],{'$or':_[_0xe896('0x43')](_0x4a39b3[_0xe896('0x48')],function(_0x690a75){var _0x1bcfda={};_0x1bcfda[_0x690a75]={'$like':'%'+_0x4fd476[_0xe896('0x44')][_0xe896('0x4e')]+'%'};return _0x1bcfda;})});}_0x4a39b3=_[_0xe896('0x4f')]({},_0x4a39b3,_0x4fd476['options']);return db[_0xe896('0x67')]['count']({'where':_0x4a39b3[_0xe896('0x4c')]})[_0xe896('0x24')](function(_0x474a31){_0x162bb0['count']=_0x474a31;if(_0x4fd476[_0xe896('0x44')][_0xe896('0x51')]){_0x4a39b3[_0xe896('0x52')]=[{'all':!![]}];}return db[_0xe896('0x67')][_0xe896('0x53')](_0x4a39b3);})[_0xe896('0x24')](function(_0x319393){_0x162bb0[_0xe896('0x54')]=_0x319393;return _0x162bb0;});}})[_0xe896('0x24')](respondWithFilteredResult(_0x56223c,_0x4a39b3))[_0xe896('0x55')](handleError(_0x56223c,null));};exports[_0xe896('0x6a')]=function(_0x52bf17,_0x801b67,_0x317880){return db[_0xe896('0x3e')][_0xe896('0x59')]({'where':{'id':_0x52bf17['params']['id']}})[_0xe896('0x24')](handleEntityNotFound(_0x801b67,null))[_0xe896('0x24')](function(_0x8089){if(_0x8089){return _0x8089[_0xe896('0x6a')](_0x52bf17[_0xe896('0x44')][_0xe896('0x6b')]);}})[_0xe896('0x24')](respondWithStatusCode(_0x801b67,null))[_0xe896('0x55')](handleError(_0x801b67,null));};exports[_0xe896('0x6c')]=function(_0x9e5ed4,_0x26bfac,_0x3b4258){if(_0x9e5ed4['body']['id']){delete _0x9e5ed4[_0xe896('0x5b')]['id'];}return db[_0xe896('0x3e')][_0xe896('0x59')]({'where':{'id':_0x9e5ed4['params']['id']}})[_0xe896('0x24')](handleEntityNotFound(_0x26bfac,null))['then'](function(_0x50e997){if(_0x50e997){_0x9e5ed4[_0xe896('0x5b')][_0xe896('0x64')]=_0x50e997['id'];return db[_0xe896('0x6d')]['create'](_0x9e5ed4[_0xe896('0x5b')]);}})[_0xe896('0x24')](respondWithResult(_0x26bfac,null))['catch'](handleError(_0x26bfac,null));};exports['getAnswers']=function(_0x1514c0,_0x19c9e0,_0x32d2f5){var _0x24924e={'raw':![],'where':{}};var _0x3bbcb2={};var _0x295c34={'count':0x0,'rows':[]};return db[_0xe896('0x3e')]['findOne']({'where':{'id':_0x1514c0['params']['id']}})[_0xe896('0x24')](handleEntityNotFound(_0x19c9e0,null))['then'](function(_0x4cb0a7){if(_0x4cb0a7){_0x3bbcb2[_0xe896('0x42')]=_[_0xe896('0x45')](db[_0xe896('0x6d')][_0xe896('0x3f')]);_0x3bbcb2['query']=_[_0xe896('0x45')](_0x1514c0[_0xe896('0x44')]);_0x3bbcb2['filters']=_[_0xe896('0x47')](_0x3bbcb2[_0xe896('0x42')],_0x3bbcb2[_0xe896('0x44')]);_0x24924e[_0xe896('0x48')]=_[_0xe896('0x47')](_0x3bbcb2[_0xe896('0x42')],qs[_0xe896('0x57')](_0x1514c0[_0xe896('0x44')][_0xe896('0x57')]));_0x24924e[_0xe896('0x48')]=_0x24924e[_0xe896('0x48')][_0xe896('0x49')]?_0x24924e[_0xe896('0x48')]:_0x3bbcb2['model'];if(!_0x1514c0[_0xe896('0x44')][_0xe896('0x68')](_0xe896('0x69'))){_0x24924e[_0xe896('0x31')]=qs[_0xe896('0x31')](_0x1514c0[_0xe896('0x44')][_0xe896('0x31')]);_0x24924e[_0xe896('0x30')]=qs[_0xe896('0x30')](_0x1514c0[_0xe896('0x44')]['offset']);}_0x24924e['order']=qs[_0xe896('0x4b')](_0x1514c0[_0xe896('0x44')][_0xe896('0x4b')]);_0x24924e['where']=qs[_0xe896('0x46')](_[_0xe896('0x4d')](_0x1514c0['query'],_0x3bbcb2[_0xe896('0x46')]));_0x24924e[_0xe896('0x4c')]['SmsAccountId']=_0x4cb0a7['id'];if(_0x1514c0[_0xe896('0x44')][_0xe896('0x4e')]){_0x24924e[_0xe896('0x4c')]=_[_0xe896('0x4f')](_0x24924e[_0xe896('0x4c')],{'$or':_[_0xe896('0x43')](_0x24924e[_0xe896('0x48')],function(_0x1682ff){var _0x59626a={};_0x59626a[_0x1682ff]={'$like':'%'+_0x1514c0[_0xe896('0x44')][_0xe896('0x4e')]+'%'};return _0x59626a;})});}_0x24924e=_[_0xe896('0x4f')]({},_0x24924e,_0x1514c0[_0xe896('0x58')]);return db[_0xe896('0x6d')]['count']({'where':_0x24924e[_0xe896('0x4c')]})[_0xe896('0x24')](function(_0x8c17af){_0x295c34['count']=_0x8c17af;if(_0x1514c0[_0xe896('0x44')][_0xe896('0x51')]){_0x24924e[_0xe896('0x52')]=[{'all':!![]}];}return db[_0xe896('0x6d')][_0xe896('0x53')](_0x24924e);})[_0xe896('0x24')](function(_0x206d04){_0x295c34[_0xe896('0x54')]=_0x206d04;return _0x295c34;});}})[_0xe896('0x24')](respondWithFilteredResult(_0x19c9e0,_0x24924e))['catch'](handleError(_0x19c9e0,null));};exports[_0xe896('0x6e')]=function(_0x542868,_0xc23269,_0x5e2f73){return db[_0xe896('0x3e')][_0xe896('0x59')]({'where':{'id':_0x542868['params']['id']}})[_0xe896('0x24')](handleEntityNotFound(_0xc23269,null))[_0xe896('0x24')](function(_0x50a004){if(_0x50a004){return _0x50a004[_0xe896('0x6e')](_0x542868[_0xe896('0x44')][_0xe896('0x6b')]);}})['then'](respondWithStatusCode(_0xc23269,null))[_0xe896('0x55')](handleError(_0xc23269,null));};exports['notify']=function(_0x575983,_0x19a967,_0xbebca5){var _0x5c4826={'channel':_0xe896('0x6f')};var _0xd0e5ca=[];var _0x50e5e7=[];var _0x529df2={};return db['SmsAccount']['find']({'where':{'id':_0x575983[_0xe896('0x56')]['id']},'include':[{'model':db[_0xe896('0x70')],'as':_0xe896('0x71')}]})[_0xe896('0x24')](handleEntityNotFound(_0x19a967,null))[_0xe896('0x24')](function(_0x21aa01){_0x5c4826[_0xe896('0x72')]=_0x21aa01;_0x5c4826[_0xe896('0x73')]=_['orderBy'](_0x21aa01[_0xe896('0x71')],[_0xe896('0x74')],[_0xe896('0x75')]);if(_0x5c4826[_0xe896('0x72')]['Applications']){delete _0x5c4826['account'][_0xe896('0x71')];}return db[_0xe896('0x76')]['describe']();})['then'](function(_0x419fc7){if(!_0x419fc7){throw new db[(_0xe896('0x21'))][(_0xe896('0x22'))](_0xe896('0x77'));}_0xd0e5ca=_[_0xe896('0x78')](_['keys'](_0x419fc7),[_0xe896('0x79'),_0xe896('0x7a')]);_0x50e5e7=_[_0xe896('0x78')](_['keys'](_0x419fc7),[_0xe896('0x79'),_0xe896('0x7a'),_0xe896('0x7b'),_0xe896('0x7c')]);_0x5c4826[_0xe896('0x5b')]={'mapKey':'mobile'};if(_0x5c4826[_0xe896('0x72')][_0xe896('0x40')]){switch(_0x5c4826[_0xe896('0x72')]['type']){case _0xe896('0x7d'):_0x5c4826['body'][_0xe896('0x7e')]=_0x575983[_0xe896('0x5b')][_0xe896('0x7f')];_0x5c4826[_0xe896('0x5b')][_0xe896('0x5b')]=_0x575983[_0xe896('0x5b')]['Body'];_0x5c4826['body'][_0xe896('0x80')]=_0x575983['body'][_0xe896('0x81')];break;case _0xe896('0x82'):_0x5c4826['body'][_0xe896('0x7e')]='+'+_0x575983[_0xe896('0x5b')]['sender'];_0x5c4826[_0xe896('0x5b')]['body']=_0x575983[_0xe896('0x5b')][_0xe896('0x83')];break;case _0xe896('0x84'):_0x5c4826[_0xe896('0x5b')]['from']=_0x575983[_0xe896('0x5b')][_0xe896('0x7e')];_0x5c4826[_0xe896('0x5b')][_0xe896('0x5b')]=_0x575983[_0xe896('0x5b')][_0xe896('0x2b')];break;case _0xe896('0x85'):_0x5c4826[_0xe896('0x5b')][_0xe896('0x7e')]=_0x575983[_0xe896('0x5b')][_0xe896('0x7e')];_0x5c4826[_0xe896('0x5b')][_0xe896('0x5b')]=_0x575983[_0xe896('0x5b')][_0xe896('0x5b')];_0x5c4826[_0xe896('0x5b')][_0xe896('0x80')]=_0x575983['body'][_0xe896('0x86')];break;case _0xe896('0x87'):_0x5c4826['body']['from']=_0x575983[_0xe896('0x5b')][_0xe896('0x7f')];_0x5c4826[_0xe896('0x5b')][_0xe896('0x5b')]=_0x575983[_0xe896('0x5b')][_0xe896('0x88')];_0x5c4826[_0xe896('0x5b')][_0xe896('0x80')]=_0x575983['body'][_0xe896('0x89')];break;case _0xe896('0x8a'):_0x5c4826[_0xe896('0x5b')][_0xe896('0x7e')]='+'+_0x575983['body'][_0xe896('0x8b')][0x0]['from'];_0x5c4826['body'][_0xe896('0x5b')]=_0x575983[_0xe896('0x5b')][_0xe896('0x8b')][0x0][_0xe896('0x83')];_0x5c4826[_0xe896('0x5b')][_0xe896('0x80')]=_0x575983[_0xe896('0x5b')]['results'][0x0][_0xe896('0x80')];break;case _0xe896('0x8c'):_0x5c4826[_0xe896('0x5b')][_0xe896('0x7e')]=_0x575983[_0xe896('0x5b')][_0xe896('0x8d')];_0x5c4826[_0xe896('0x5b')][_0xe896('0x5b')]=_0x575983[_0xe896('0x5b')]['segmentedMessage'][_0xe896('0x2b')];break;case _0xe896('0x8e'):_0x5c4826['body'][_0xe896('0x7e')]=_0x575983['body']['fromNumber'];_0x5c4826[_0xe896('0x5b')]['body']=_0x575983['body'][_0xe896('0x83')];_0x5c4826[_0xe896('0x5b')][_0xe896('0x80')]=_0x575983['body'][_0xe896('0x8f')];break;case'intelepeer':_0x5c4826[_0xe896('0x5b')][_0xe896('0x7e')]=_0x575983['body'][_0xe896('0x7e')];_0x5c4826[_0xe896('0x5b')]['body']=_0x575983[_0xe896('0x5b')]['message'];_0x5c4826['body']['messageId']=_0x575983[_0xe896('0x5b')]['refid'];break;}}if(_0x5c4826[_0xe896('0x5b')]['id']){delete _0x5c4826[_0xe896('0x5b')]['id'];}if(_[_0xe896('0x90')](_0x5c4826[_0xe896('0x5b')]['from'])){throw new db[(_0xe896('0x21'))][(_0xe896('0x22'))](_0xe896('0x91'));}if(_[_0xe896('0x90')](_0x5c4826['body'][_0xe896('0x5b')])||_0x5c4826['body'][_0xe896('0x5b')]===''){throw new db[(_0xe896('0x21'))][(_0xe896('0x22'))](_0xe896('0x92'));}if(_['isNil'](_0x5c4826[_0xe896('0x5b')]['mapKey'])){throw new db[(_0xe896('0x21'))]['ValidationError'](_0xe896('0x93')+_0x50e5e7);}if(!_[_0xe896('0x94')](_0x50e5e7,_0x5c4826[_0xe896('0x5b')]['mapKey'])){throw new db[(_0xe896('0x21'))]['ValidationError'](_0xe896('0x95')+_0x50e5e7);}_0x529df2[_0x5c4826[_0xe896('0x5b')]['mapKey']]=_0x5c4826[_0xe896('0x5b')][_0xe896('0x7e')];return db['CmList'][_0xe896('0x59')]({'where':{'id':_0x5c4826[_0xe896('0x72')][_0xe896('0x7c')]},'include':[{'model':db[_0xe896('0x76')],'as':_0xe896('0x96'),'where':_0x529df2,'limit':0x1,'order':[[_0xe896('0x7a'),_0xe896('0x97')]]}]});})[_0xe896('0x24')](handleEntityNotFound(_0x19a967,null))[_0xe896('0x24')](function(_0x5e4bdb){if(_0x5e4bdb){_0x5c4826['list']=_[_0xe896('0x98')](_0x5e4bdb,[_0xe896('0x96')]);if(_0x5e4bdb['Contacts'][_0xe896('0x49')]){return _0x5e4bdb[_0xe896('0x96')][0x0];}var _0x4b5af4=_['defaults'](_0x5c4826[_0xe896('0x5b')],{'firstName':_0x5c4826[_0xe896('0x5b')]['from'],'ListId':_0x5e4bdb['id']});_0x4b5af4[_0x5c4826[_0xe896('0x5b')][_0xe896('0x99')]]=_0x5c4826['body'][_0xe896('0x7e')];return db[_0xe896('0x76')][_0xe896('0x5a')](_0x4b5af4,{'fields':_0xd0e5ca,'raw':!![]});}})['then'](handleEntityNotFound(_0x19a967,null))[_0xe896('0x24')](function(_0x40bdca){if(_0x40bdca){_0x5c4826['contact']=_0x40bdca;var _0x476416={'ContactId':_0x40bdca['id'],'phone':_0x5c4826[_0xe896('0x5b')][_0xe896('0x7e')],'SmsAccountId':_0x575983[_0xe896('0x56')]['id']};var _0x265206={'ContactId':_0x40bdca['id'],'SmsAccountId':_0x575983[_0xe896('0x56')]['id'],'closed':![]};return db[_0xe896('0x9a')][_0xe896('0x59')]({'where':_0x265206})[_0xe896('0x24')](function(_0x2a4adf){if(_0x2a4adf){return[_0x2a4adf,![]];}return db[_0xe896('0x9a')][_0xe896('0x5a')](_0x476416)[_0xe896('0x24')](function(_0x3e8a68){return[_0x3e8a68,!![]];});});}})['spread'](function(_0x37bd83,_0x5223c5){_0x5c4826[_0xe896('0x9b')]=_0x37bd83[_0xe896('0x35')]({'plain':!![]});_0x5c4826['interaction'][_0xe896('0x9c')]=![];if(_0x5223c5){if(_0x5c4826[_0xe896('0x72')][_0xe896('0x9d')]){_0x5c4826['applications'][_0xe896('0x9e')]({'id':0x0,'priority':_0x5c4826[_0xe896('0x73')][_0xe896('0x49')]+0x1,'app':_0xe896('0x9f'),'appdata':_0xe896('0xa0'),'interval':_0xe896('0xa1')});}_0x5c4826[_0xe896('0x9b')][_0xe896('0x9c')]=!![];}return db[_0xe896('0xa2')]['create']({'phone':_0x5c4826['body']['from'],'messageId':_0x5c4826[_0xe896('0x5b')]['messageId'],'body':_0x5c4826['body'][_0xe896('0x5b')],'SmsAccountId':_0x575983['params']['id'],'SmsInteractionId':_0x37bd83['id'],'direction':'in','ContactId':_0x37bd83['ContactId'],'AttachmentId':_0x5c4826['body'][_0xe896('0xa3')]});})['then'](function(_0x4a52c6){_0x5c4826[_0xe896('0x2b')]=_0x4a52c6;if(_0x5c4826[_0xe896('0x9b')][_0xe896('0xa4')]){return db['User'][_0xe896('0x59')]({'attributes':['id',_0xe896('0x39')],'where':{'id':_0x5c4826[_0xe896('0x9b')][_0xe896('0xa4')]}})[_0xe896('0x24')](function(_0x5e8f10){if(_0x5e8f10){_0x5c4826['applications'][_0xe896('0xa5')]({'id':0x0,'priority':0x0,'app':_0xe896('0xa6'),'appdata':_0x5e8f10['name']+','+(_0x5c4826[_0xe896('0x72')][_0xe896('0xa7')]||0xa),'interval':_0xe896('0xa1')});}return respondWithRpcPromise(_0xe896('0xa8'),_0xe896('0xa9'),_0x5c4826);});}return respondWithRpcPromise(_0xe896('0xa8'),_0xe896('0xa9'),_0x5c4826);})[_0xe896('0x24')](function(_0x2f9697){if(_0x2f9697){var _0x38fe54=0xc8;var _0x1941b6=_0xe896('0xaa');logger[_0xe896('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1941b6,_0x38fe54,_0xe896('0xab'));logger[_0xe896('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1941b6,_0x38fe54,_0xe896('0xab'),JSON[_0xe896('0xac')](_0x2f9697));if(_0x5c4826[_0xe896('0x72')][_0xe896('0x40')]===_0xe896('0x7d')){return _0x19a967[_0xe896('0x2d')](_0x38fe54)[_0xe896('0xad')](_0xe896('0xae'),_0xe896('0xaf'))[_0xe896('0x3a')]('\x0a');}else{return _0x19a967[_0xe896('0x2d')](_0x38fe54)['json'](_0x2f9697);}}})[_0xe896('0x55')](handleError(_0x19a967,null));};exports[_0xe896('0xb0')]=function(_0xb528ff,_0x372a5d,_0x3bf04c){return db[_0xe896('0x3e')][_0xe896('0x66')]({'where':{'id':_0xb528ff[_0xe896('0x56')]['id']}})['then'](handleEntityNotFound(_0x372a5d,null))[_0xe896('0x24')](function(_0x27684f){if(_0x27684f){return db[_0xe896('0xb1')][_0xe896('0xb2')](function(_0x882a0e){return db[_0xe896('0x70')][_0xe896('0x34')]({'where':{'SmsAccountId':_0xb528ff[_0xe896('0x56')]['id']},'transaction':_0x882a0e})['then'](function(_0x2c7636){var _0x2d9eae=_[_0xe896('0x43')](_0xb528ff['body'],function(_0x52f6d6){_0x52f6d6[_0xe896('0x64')]=_0xb528ff[_0xe896('0x56')]['id'];return _0x52f6d6;});return db[_0xe896('0x70')]['bulkCreate'](_0x2d9eae,{'transaction':_0x882a0e});});})['then'](function(){return db[_0xe896('0x70')][_0xe896('0xb3')]({'where':{'SmsAccountId':_0xb528ff['params']['id']},'order':_0xe896('0x74')});});}})[_0xe896('0x24')](respondWithResult(_0x372a5d,null))[_0xe896('0x55')](handleError(_0x372a5d,null));};exports[_0xe896('0xb4')]=function(_0x3b28ea,_0x2ed294,_0x4d31dc){var _0x272bc8={};var _0x833d6e={};var _0x49b7a9;var _0x256cb6;return db[_0xe896('0x3e')]['findOne']({'where':{'id':_0x3b28ea['params']['id']}})['then'](handleEntityNotFound(_0x2ed294,null))['then'](function(_0x2973b8){if(_0x2973b8){_0x49b7a9=_0x2973b8;_0x833d6e[_0xe896('0x42')]=_[_0xe896('0x45')](db[_0xe896('0x70')][_0xe896('0x3f')]);_0x833d6e[_0xe896('0x44')]=_['keys'](_0x3b28ea[_0xe896('0x44')]);_0x833d6e['filters']=_[_0xe896('0x47')](_0x833d6e['model'],_0x833d6e[_0xe896('0x44')]);_0x272bc8[_0xe896('0x48')]=_['intersection'](_0x833d6e['model'],qs[_0xe896('0x57')](_0x3b28ea[_0xe896('0x44')]['fields']));_0x272bc8['attributes']=_0x272bc8[_0xe896('0x48')][_0xe896('0x49')]?_0x272bc8[_0xe896('0x48')]:_0x833d6e[_0xe896('0x42')];_0x272bc8[_0xe896('0x4a')]=qs[_0xe896('0x4b')](_0x3b28ea[_0xe896('0x44')][_0xe896('0x4b')]);_0x272bc8[_0xe896('0x4c')]=qs[_0xe896('0x46')](_[_0xe896('0x4d')](_0x3b28ea[_0xe896('0x44')],_0x833d6e[_0xe896('0x46')]));if(_0x3b28ea['query']['filter']){_0x272bc8[_0xe896('0x4c')]=_[_0xe896('0x4f')](_0x272bc8[_0xe896('0x4c')],{'$or':_[_0xe896('0x43')](_0x272bc8[_0xe896('0x48')],function(_0x8e7800){var _0x1cc10a={};_0x1cc10a[_0x8e7800]={'$like':'%'+_0x3b28ea[_0xe896('0x44')][_0xe896('0x4e')]+'%'};return _0x1cc10a;})});}_0x272bc8=_[_0xe896('0x4f')]({},_0x272bc8,_0x3b28ea[_0xe896('0x58')]);return _0x49b7a9[_0xe896('0xb4')](_0x272bc8);}})[_0xe896('0x24')](function(_0x21efd3){if(_0x21efd3){_0x256cb6=_0x21efd3[_0xe896('0x49')];if(!_0x3b28ea[_0xe896('0x44')]['hasOwnProperty']('nolimit')){_0x272bc8['limit']=qs[_0xe896('0x31')](_0x3b28ea[_0xe896('0x44')][_0xe896('0x31')]);_0x272bc8[_0xe896('0x30')]=qs[_0xe896('0x30')](_0x3b28ea[_0xe896('0x44')][_0xe896('0x30')]);}return _0x49b7a9['getApplications'](_0x272bc8);}})['then'](function(_0x61ad73){if(_0x61ad73){return _0x61ad73?{'count':_0x256cb6,'rows':_0x61ad73}:null;}})[_0xe896('0x24')](respondWithResult(_0x2ed294,null))['catch'](handleError(_0x2ed294,null));};exports['getInteractions']=function(_0x201c1e,_0x2112ed,_0x14da55){var _0x5656d0={'raw':![],'where':{}};var _0x31ca0b={};var _0x80a8a3={'count':0x0,'rows':[]};return db[_0xe896('0x3e')][_0xe896('0x66')]({'where':{'id':_0x201c1e['params']['id']}})['then'](handleEntityNotFound(_0x2112ed,null))['then'](function(_0x18fe0a){if(_0x18fe0a){_0x31ca0b[_0xe896('0x42')]=_['keys'](db[_0xe896('0x9a')][_0xe896('0x3f')]);_0x31ca0b[_0xe896('0x44')]=_[_0xe896('0x45')](_0x201c1e['query']);_0x31ca0b[_0xe896('0x46')]=_[_0xe896('0x47')](_0x31ca0b[_0xe896('0x42')],_0x31ca0b[_0xe896('0x44')]);_0x5656d0[_0xe896('0x48')]=_[_0xe896('0x47')](_0x31ca0b[_0xe896('0x42')],qs[_0xe896('0x57')](_0x201c1e[_0xe896('0x44')][_0xe896('0x57')]));_0x5656d0[_0xe896('0x48')]=_0x5656d0[_0xe896('0x48')][_0xe896('0x49')]?_0x5656d0[_0xe896('0x48')]:_0x31ca0b['model'];if(!_0x201c1e[_0xe896('0x44')]['hasOwnProperty'](_0xe896('0x69'))){_0x5656d0[_0xe896('0x31')]=qs['limit'](_0x201c1e['query'][_0xe896('0x31')]);_0x5656d0[_0xe896('0x30')]=qs[_0xe896('0x30')](_0x201c1e['query'][_0xe896('0x30')]);}_0x5656d0[_0xe896('0x4a')]=qs[_0xe896('0x4b')](_0x201c1e['query'][_0xe896('0x4b')]);_0x5656d0[_0xe896('0x4c')]=qs[_0xe896('0x46')](_['pick'](_0x201c1e['query'],_0x31ca0b[_0xe896('0x46')]));_0x5656d0['where'][_0xe896('0x64')]=_0x18fe0a['id'];if(_0x201c1e[_0xe896('0x44')][_0xe896('0x4e')]){_0x5656d0[_0xe896('0x4c')]=_[_0xe896('0x4f')](_0x5656d0[_0xe896('0x4c')],{'$or':_[_0xe896('0x43')](_0x5656d0['attributes'],function(_0x5ee204){var _0x30b28d={};_0x30b28d[_0x5ee204]={'$like':'%'+_0x201c1e[_0xe896('0x44')]['filter']+'%'};return _0x30b28d;})});}_0x5656d0=_[_0xe896('0x4f')]({},_0x5656d0,_0x201c1e[_0xe896('0x58')]);return db['SmsInteraction']['count']({'where':_0x5656d0['where']})['then'](function(_0x52c0ee){_0x80a8a3['count']=_0x52c0ee;if(_0x201c1e[_0xe896('0x44')]['includeAll']){_0x5656d0[_0xe896('0x52')]=[{'model':db[_0xe896('0x76')],'as':_0xe896('0xb5'),'required':![]},{'model':db[_0xe896('0xb6')],'as':'Owner','attributes':[_0xe896('0x39'),_0xe896('0xb7'),_0xe896('0xb8')],'required':![]},{'model':db['Tag'],'as':_0xe896('0xb9'),'attributes':['id',_0xe896('0x39'),_0xe896('0xba')],'where':_0x201c1e[_0xe896('0x44')][_0xe896('0xbb')]?{'id':_0x201c1e[_0xe896('0x44')][_0xe896('0xbb')]}:undefined,'required':_0x201c1e[_0xe896('0x44')][_0xe896('0xbb')]?!![]:![]}];}return db[_0xe896('0x9a')]['findAll'](_0x5656d0);})[_0xe896('0x24')](function(_0x22119c){_0x80a8a3[_0xe896('0x54')]=_0x22119c;return _0x80a8a3;});}})[_0xe896('0x24')](respondWithFilteredResult(_0x2112ed,_0x5656d0))['catch'](handleError(_0x2112ed,null));};exports[_0xe896('0x3a')]=function(_0xaee8f9,_0x2001eb,_0x3bee56){var _0x24da09,_0x3d5073,_0x51d508;if(_['isNil'](_0xaee8f9[_0xe896('0x5b')]['body'])||_0xaee8f9['body'][_0xe896('0x5b')]===''){throw new db[(_0xe896('0x21'))][(_0xe896('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe896('0x90')](_0xaee8f9['body']['to'])){throw new db[(_0xe896('0x21'))][(_0xe896('0x22'))]('to\x20is\x20mandatory');}_0x24da09=_0xaee8f9[_0xe896('0x5b')]['to'];return db[_0xe896('0x3e')][_0xe896('0x59')]({'where':{'id':_0xaee8f9[_0xe896('0x56')]['id']},'include':[{'model':db['CmList'],'as':_0xe896('0xbc'),'include':[{'model':db['CmContact'],'as':_0xe896('0x96'),'where':{'mobile':_0x24da09},'limit':0x1,'order':[[_0xe896('0x7a'),_0xe896('0x97')]]}]}]})['then'](handleEntityNotFound(_0x2001eb,null))['then'](function(_0x20618c){if(_0x20618c&&_0x20618c[_0xe896('0xbc')]){_0x3d5073=_0x20618c[_0xe896('0x35')]({'plain':!![]});if(_0x3d5073[_0xe896('0xbc')]&&_0x3d5073[_0xe896('0xbc')][_0xe896('0x96')][_0xe896('0x49')]){return _0x3d5073[_0xe896('0xbc')]['Contacts'][0x0];}return db[_0xe896('0x76')][_0xe896('0x5a')](_['defaults'](_0xaee8f9[_0xe896('0x5b')],{'firstName':_0x24da09,'mobile':_0x24da09,'phone':_0x24da09,'ListId':_0x3d5073['ListId']}));}})['then'](handleEntityNotFound(_0x2001eb,null))[_0xe896('0x24')](function(_0x2cc935){if(_0x2cc935){_0x51d508=_0x2cc935;return db[_0xe896('0x9a')][_0xe896('0x59')]({'where':{'ContactId':_0x51d508['id'],'closed':![],'SmsAccountId':_0x3d5073['id']}})[_0xe896('0x24')](function(_0x4f1c40){if(_0x4f1c40){return[_0x4f1c40,![]];}return db[_0xe896('0x9a')][_0xe896('0x5a')]({'UserId':_0xaee8f9[_0xe896('0x5e')]['id'],'ContactId':_0x51d508['id'],'SmsAccountId':_0x3d5073['id'],'phone':_0x24da09,'firstMsgDirection':_0xe896('0xbd'),'Messages':[_[_0xe896('0x4f')](_0xaee8f9['body'],{'read':![],'body':_0xaee8f9[_0xe896('0x5b')][_0xe896('0x5b')],'phone':_0x24da09,'SmsAccountId':_0x3d5073['id'],'UserId':_0xaee8f9[_0xe896('0x5e')]['id'],'ContactId':_0x51d508['id']})]},{'include':[{'model':db[_0xe896('0xa2')],'as':'Messages'}]})[_0xe896('0x24')](function(_0x3c92da){return[_0x3c92da,!![]];});});}})[_0xe896('0xbe')](function(_0x3e9cda,_0x5378ae){if(_0x5378ae){return _0x3e9cda;}return db[_0xe896('0xa2')][_0xe896('0x5a')](_[_0xe896('0x4f')](_0xaee8f9[_0xe896('0x5b')],{'read':![],'body':_0xaee8f9[_0xe896('0x5b')]['body'],'phone':_0x24da09,'SmsAccountId':_0x3d5073['id'],'SmsInteractionId':_0x3e9cda['id'],'UserId':_0xaee8f9[_0xe896('0x5e')]['id'],'ContactId':_0x51d508['id']}))[_0xe896('0x24')](function(_0x4c777b){_0x3e9cda['dataValues'][_0xe896('0xbf')]=[];_0x3e9cda[_0xe896('0xc0')][_0xe896('0xbf')][_0xe896('0x9e')](_0x4c777b['dataValues']);return _0x3e9cda;});})[_0xe896('0x24')](respondWithResult(_0x2001eb,null))[_0xe896('0x55')](handleError(_0x2001eb,null));};exports[_0xe896('0x2d')]=function(_0x460cfd,_0x53250f,_0x52ef16){if(_0x460cfd['body']['id']){delete _0x460cfd[_0xe896('0x5b')]['id'];}console[_0xe896('0xc1')](_0xe896('0xc2'),_0x460cfd[_0xe896('0x5b')]);var _0x32d1ab,_0x55187f,_0x39a498;return db[_0xe896('0x3e')]['find']({'where':{'id':_0x460cfd[_0xe896('0x56')]['id']}})[_0xe896('0x24')](handleEntityNotFound(_0x53250f,null))[_0xe896('0x24')](function(_0x49e5c7){if(_0x49e5c7){_0x39a498=_0x49e5c7;logger[_0xe896('0x28')](_0xe896('0xc3'),_0xe896('0x2d'),_0xe896('0xc4'),_0x49e5c7[_0xe896('0x40')],util[_0xe896('0xc5')](_0x460cfd['body'],{'showHidden':![],'depth':null}));switch(_0x49e5c7[_0xe896('0x40')]){case _0xe896('0x82'):if(_0x460cfd['body'][_0xe896('0xc6')]&&_0x460cfd[_0xe896('0x5b')]['status']){_0x55187f=_0x460cfd[_0xe896('0x5b')][_0xe896('0x2d')];return db['SmsMessage']['find']({'where':{'messageId':_0x460cfd[_0xe896('0x5b')][_0xe896('0xc6')]}});}break;case'connectel':if(_0x460cfd[_0xe896('0x5b')][_0xe896('0xc7')]&&_0x460cfd['body'][_0xe896('0xc8')]){_0x55187f=_0x460cfd[_0xe896('0x5b')][_0xe896('0xc8')];return db[_0xe896('0xa2')][_0xe896('0x59')]({'where':{'messageId':_0x460cfd[_0xe896('0x5b')][_0xe896('0xc7')]}});}break;case _0xe896('0x85'):if(_0x460cfd[_0xe896('0x5b')][_0xe896('0x86')]&&_0x460cfd['body'][_0xe896('0xc9')]){_0x55187f=_0x460cfd['body']['status_code'];return db[_0xe896('0xa2')][_0xe896('0x59')]({'where':{'messageId':_0x460cfd['body']['message_id']}});}break;case _0xe896('0x8a'):var _0xdd5641=_0x460cfd[_0xe896('0x5b')]['results'][0x0];if(_0xdd5641[_0xe896('0x80')]&&_0xdd5641[_0xe896('0x2d')][_0xe896('0xca')]===_0xe896('0xcb')){_0x55187f=_0xdd5641[_0xe896('0x2d')]['groupName'];return db[_0xe896('0xa2')][_0xe896('0x59')]({'where':{'messageId':_0xdd5641[_0xe896('0x80')]}});}break;case'clickatell':if(_0x460cfd[_0xe896('0x5b')][_0xe896('0x80')]&&_0x460cfd[_0xe896('0x5b')][_0xe896('0x2d')]){_0x55187f=_0x460cfd[_0xe896('0x5b')]['status'];return db['SmsMessage'][_0xe896('0x59')]({'where':{'messageId':_0x460cfd['body'][_0xe896('0x80')]}});}break;case _0xe896('0xcc'):if(_0x460cfd[_0xe896('0x5b')][_0xe896('0xcd')]&&_0x460cfd['body'][_0xe896('0x2d')]){_0x55187f=_0x460cfd[_0xe896('0x5b')][_0xe896('0x2d')];return db['SmsMessage'][_0xe896('0x59')]({'where':{'messageId':_0x460cfd[_0xe896('0x5b')]['redif']}});}break;}}})[_0xe896('0x24')](handleEntityNotFound(_0x53250f,null))[_0xe896('0x24')](function(_0x11f77f){if(_0x11f77f){_0x32d1ab=_0x11f77f;switch(_0x39a498[_0xe896('0x40')]){case _0xe896('0x82'):if(_0x55187f===_0xe896('0xcb')){return _0x32d1ab[_0xe896('0x61')]({'read':!![]});}else{logger['error'](_0xe896('0xc3'),_0xe896('0x2d'),_0xe896('0x82'),util[_0xe896('0xc5')](_0x460cfd[_0xe896('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe896('0x84'):if(_0x55187f==='1'){return _0x32d1ab[_0xe896('0x61')]({'read':!![]});}else{logger[_0xe896('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe896('0x2d'),_0xe896('0x82'),util[_0xe896('0xc5')](_0x460cfd['body'],{'showHidden':![],'depth':null}));}break;case _0xe896('0x85'):if(!_0x460cfd[_0xe896('0x5b')][_0xe896('0xce')]&&_0x55187f>=0xc8&&_0x55187f<=0xce){return _0x32d1ab[_0xe896('0x61')]({'read':!![]});}else{logger['error'](_0xe896('0xc3'),_0xe896('0x2d'),_0xe896('0x85'),util[_0xe896('0xc5')](_0x460cfd[_0xe896('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe896('0x8a'):var _0x40af4c=_0x460cfd[_0xe896('0x5b')][_0xe896('0x8b')][0x0];if(_0x40af4c[_0xe896('0x2d')][_0xe896('0xca')]===_0xe896('0xcb')){return _0x32d1ab[_0xe896('0x61')]({'read':!![]});}else{logger[_0xe896('0x29')](_0xe896('0xc3'),'status','infobip',util['inspect'](_0x460cfd[_0xe896('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe896('0x8e'):if(_0x55187f==_0xe896('0xcf')||_0x55187f==_0xe896('0xd0')){return _0x32d1ab[_0xe896('0x61')]({'read':!![]});}else{logger[_0xe896('0x29')](_0xe896('0xc3'),_0xe896('0x2d'),_0xe896('0x8e'),util[_0xe896('0xc5')](_0x460cfd['body'],{'showHidden':![],'depth':null}));}break;case _0xe896('0xcc'):if(_0x55187f==='DELIVRD'||_0x55187f==='ACCEPTD'){return _0x32d1ab[_0xe896('0x61')]({'read':!![]});}else{logger[_0xe896('0x29')](_0xe896('0xc3'),_0xe896('0x2d'),'intelepeer',util[_0xe896('0xc5')](_0x460cfd[_0xe896('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x32d1ab;}})['then'](respondWithResult(_0x53250f,null))[_0xe896('0x55')](handleError(_0x53250f,null));};exports[_0xe896('0xd1')]=function(_0xad0a96,_0xa4bad0,_0x4d88ca){var _0x13a4fd,_0x52ac82,_0x45cfa7;return db[_0xe896('0x3e')][_0xe896('0x59')]({'where':{'id':_0xad0a96[_0xe896('0x56')]['id']}})[_0xe896('0x24')](handleEntityNotFound(_0xa4bad0,null))[_0xe896('0x24')](function(_0x4bbc46){if(_0x4bbc46){_0x45cfa7=_0x4bbc46;logger[_0xe896('0x28')](_0xe896('0xc3'),_0xe896('0x2d'),_0xe896('0xc4'),_0x4bbc46['type'],util[_0xe896('0xc5')](_0xad0a96[_0xe896('0x44')],{'showHidden':![],'depth':null}));switch(_0x4bbc46[_0xe896('0x40')]){case _0xe896('0x8c'):if(_0xad0a96['query'][_0xe896('0xd2')]&&_0xad0a96[_0xe896('0x44')][_0xe896('0xd3')]){_0x52ac82=_0xad0a96[_0xe896('0x44')][_0xe896('0xd3')];return db[_0xe896('0xa2')][_0xe896('0x59')]({'where':{'messageId':_0xad0a96[_0xe896('0x44')]['message-id']}});}break;}}})['then'](handleEntityNotFound(_0xa4bad0,null))[_0xe896('0x24')](function(_0x2d8efa){if(_0x2d8efa){_0x13a4fd=_0x2d8efa;switch(_0x45cfa7[_0xe896('0x40')]){case _0xe896('0x8c'):if(_0x52ac82==='2'||_0x52ac82==='6'){return _0x13a4fd['update']({'read':!![]});}else{logger[_0xe896('0x29')](_0xe896('0xc3'),_0xe896('0x2d'),_0xe896('0x8c'),util[_0xe896('0xc5')](_0xad0a96[_0xe896('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x13a4fd;}})[_0xe896('0x24')](respondWithResult(_0xa4bad0,null))['catch'](handleError(_0xa4bad0,null));};exports[_0xe896('0xd4')]=function(_0x18e918,_0x2bca25,_0x2b4377){return db[_0xe896('0x3e')]['find']({'where':{'id':_0x18e918[_0xe896('0x56')]['id']}})['then'](handleEntityNotFound(_0x2bca25,null))[_0xe896('0x24')](function(_0x50d56b){if(_0x50d56b){return _0x50d56b['addAgents'](_0x18e918[_0xe896('0x5b')][_0xe896('0x6b')],_[_0xe896('0x98')](_0x18e918[_0xe896('0x5b')],[_0xe896('0x6b'),'id'])||{})[_0xe896('0xbe')](function(_0x1cd8b4){for(var _0x399827=0x0;_0x399827<_0x18e918[_0xe896('0x5b')][_0xe896('0x6b')][_0xe896('0x49')];_0x399827+=0x1){socket[_0xe896('0xd5')](_0xe896('0xd6'),{'UserId':_0x18e918['body'][_0xe896('0x6b')][_0x399827],'SmsAccountId':_0x18e918[_0xe896('0x56')]['id']});}return _0x1cd8b4;});}})['then'](respondWithResult(_0x2bca25,null))[_0xe896('0x55')](handleError(_0x2bca25,null));};exports[_0xe896('0xd7')]=function(_0x4fcd1c,_0x2e2c18,_0x189786){return db[_0xe896('0x3e')][_0xe896('0x59')]({'where':{'id':_0x4fcd1c['params']['id']}})['then'](handleEntityNotFound(_0x2e2c18,null))['then'](function(_0x4d7cb9){if(_0x4d7cb9){return _0x4d7cb9[_0xe896('0xd7')](_0x4fcd1c[_0xe896('0x44')][_0xe896('0x6b')])[_0xe896('0x24')](function(){if(_[_0xe896('0xd8')](_0x4fcd1c[_0xe896('0x44')]['ids'])){for(var _0x3dc7fa=0x0;_0x3dc7fa<_0x4fcd1c['query'][_0xe896('0x6b')][_0xe896('0x49')];_0x3dc7fa+=0x1){socket[_0xe896('0xd5')](_0xe896('0xd9'),{'UserId':Number(_0x4fcd1c[_0xe896('0x44')][_0xe896('0x6b')][_0x3dc7fa]),'SmsAccountId':Number(_0x4fcd1c[_0xe896('0x56')]['id'])});}}else{socket[_0xe896('0xd5')](_0xe896('0xd9'),{'UserId':Number(_0x4fcd1c[_0xe896('0x44')][_0xe896('0x6b')]),'SmsAccountId':Number(_0x4fcd1c['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2e2c18,null))[_0xe896('0x55')](handleError(_0x2e2c18,null));};exports[_0xe896('0xda')]=function(_0x130eaa,_0x4dbba5,_0x559910){var _0x565a88={};var _0x4f53e2={};var _0x2647bb;var _0x46d13e;return db['SmsAccount'][_0xe896('0x66')]({'where':{'id':_0x130eaa[_0xe896('0x56')]['id']}})[_0xe896('0x24')](handleEntityNotFound(_0x4dbba5,null))[_0xe896('0x24')](function(_0x3b1e18){if(_0x3b1e18){_0x2647bb=_0x3b1e18;_0x4f53e2[_0xe896('0x42')]=_[_0xe896('0x45')](db[_0xe896('0xb6')]['rawAttributes']);_0x4f53e2[_0xe896('0x44')]=_[_0xe896('0x45')](_0x130eaa[_0xe896('0x44')]);_0x4f53e2[_0xe896('0x46')]=_[_0xe896('0x47')](_0x4f53e2[_0xe896('0x42')],_0x4f53e2['query']);_0x565a88['attributes']=_['intersection'](_0x4f53e2['model'],qs[_0xe896('0x57')](_0x130eaa[_0xe896('0x44')][_0xe896('0x57')]));_0x565a88['attributes']=_0x565a88['attributes'][_0xe896('0x49')]?_0x565a88[_0xe896('0x48')]:_0x4f53e2[_0xe896('0x42')];_0x565a88[_0xe896('0x4a')]=qs[_0xe896('0x4b')](_0x130eaa[_0xe896('0x44')][_0xe896('0x4b')]);_0x565a88[_0xe896('0x4c')]=qs[_0xe896('0x46')](_[_0xe896('0x4d')](_0x130eaa['query'],_0x4f53e2['filters']));if(_0x130eaa['query']['filter']){_0x565a88['where']=_[_0xe896('0x4f')](_0x565a88[_0xe896('0x4c')],{'$or':_[_0xe896('0x43')](_0x565a88[_0xe896('0x48')],function(_0x345c91){var _0xefea89={};_0xefea89[_0x345c91]={'$like':'%'+_0x130eaa['query']['filter']+'%'};return _0xefea89;})});}_0x565a88=_['merge']({},_0x565a88,_0x130eaa[_0xe896('0x58')]);return _0x2647bb[_0xe896('0xda')](_0x565a88);}})[_0xe896('0x24')](function(_0x88015e){if(_0x88015e){_0x46d13e=_0x88015e[_0xe896('0x49')];if(!_0x130eaa[_0xe896('0x44')][_0xe896('0x68')]('nolimit')){_0x565a88['limit']=qs['limit'](_0x130eaa[_0xe896('0x44')][_0xe896('0x31')]);_0x565a88['offset']=qs[_0xe896('0x30')](_0x130eaa[_0xe896('0x44')]['offset']);}return _0x2647bb[_0xe896('0xda')](_0x565a88);}})[_0xe896('0x24')](function(_0x1a4b7e){if(_0x1a4b7e){return _0x1a4b7e?{'count':_0x46d13e,'rows':_0x1a4b7e}:null;}})[_0xe896('0x24')](respondWithResult(_0x4dbba5,null))[_0xe896('0x55')](handleError(_0x4dbba5,null));}; \ No newline at end of file +var _0x1189=['Pause','mandatoryDispositionPause','map','type','model','keys','query','intersection','fields','attributes','nolimit','offset','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','params','SmsAccount','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','rawAttributes','hasOwnProperty','pick','findAll','rows','removeDispositions','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','Body','MessageSid','skebby','sender','text','from','clicksend','messageId','message_id','From','Text','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','spread','interaction','autoclose','push','unmanaged','*,*,*,*','created','SmsMessage','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','Content-Type','text/xml','transaction','findAndCountAll','priority','getApplications','getInteractions','SmsInteraction','Contact','Owner','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','List','out','Messages','dataValues','log','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','DELIVERED','error_code','RECEIVED_BY_RECIPIENT','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','ids','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.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','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','limit','set','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','index'];(function(_0x35abe6,_0xacd625){var _0x81e954=function(_0x1f3a55){while(--_0x1f3a55){_0x35abe6['push'](_0x35abe6['shift']());}};_0x81e954(++_0xacd625);}(_0x1189,0x17f));var _0x9118=function(_0x286c82,_0x563a51){_0x286c82=_0x286c82-0x0;var _0x5265a4=_0x1189[_0x286c82];return _0x5265a4;};'use strict';var pdf=require(_0x9118('0x0'));var emlformat=require(_0x9118('0x1'));var rimraf=require(_0x9118('0x2'));var zipdir=require(_0x9118('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9118('0x4'));var moment=require(_0x9118('0x5'));var BPromise=require(_0x9118('0x6'));var Mustache=require(_0x9118('0x7'));var util=require(_0x9118('0x8'));var path=require(_0x9118('0x9'));var sox=require(_0x9118('0xa'));var csv=require('to-csv');var ejs=require(_0x9118('0xb'));var fs=require('fs');var _=require(_0x9118('0xc'));var squel=require(_0x9118('0xd'));var crypto=require(_0x9118('0xe'));var jsforce=require(_0x9118('0xf'));var deskjs=require(_0x9118('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9118('0x11'));var Papa=require(_0x9118('0x12'));var Redis=require(_0x9118('0x13'));var authService=require(_0x9118('0x14'));var qs=require(_0x9118('0x15'));var as=require(_0x9118('0x16'));var hardwareService=require(_0x9118('0x17'));var logger=require('../../config/logger')(_0x9118('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x9118('0x19'))['db'];config[_0x9118('0x1a')]=_['defaults'](config[_0x9118('0x1a')],{'host':_0x9118('0x1b'),'port':0x18eb});var socket=require(_0x9118('0x1c'))(new Redis(config[_0x9118('0x1a')]));require(_0x9118('0x1d'))[_0x9118('0x1e')](socket);var jayson=require(_0x9118('0x1f'));var client=jayson[_0x9118('0x20')][_0x9118('0x21')]({'port':0x232c});function checkPasswordPattern(_0x389301,_0x2c1ab4,_0x48e13a){if(_0x48e13a){var _0x5c403d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5c403d[_0x9118('0x22')](_0x2c1ab4)){return _0x389301;}else{throw new db['Sequelize'][(_0x9118('0x23'))](_0x9118('0x24'));}}else{return _0x389301;}}function respondWithRpcPromise(_0x37a481,_0x1f0b31,_0x48cad0,_0x3b37ac){return new BPromise(function(_0x5ec298,_0x1240da){var _0x48560f=_0x3b37ac||client;return _0x48560f[_0x9118('0x25')](_0x37a481,_0x48cad0)[_0x9118('0x26')](function(_0x4d4826){logger[_0x9118('0x27')](_0x9118('0x28'),_0x1f0b31,_0x9118('0x29'));logger[_0x9118('0x2a')](_0x9118('0x2b'),_0x1f0b31,'request\x20sent',JSON[_0x9118('0x2c')](_0x4d4826));if(_0x4d4826[_0x9118('0x2d')]){if(_0x4d4826[_0x9118('0x2d')][_0x9118('0x2e')]===0x1f4){logger[_0x9118('0x2d')](_0x9118('0x28'),_0x1f0b31,_0x4d4826[_0x9118('0x2d')][_0x9118('0x2f')]);return _0x1240da(_0x4d4826[_0x9118('0x2d')][_0x9118('0x2f')]);}logger['error'](_0x9118('0x28'),_0x1f0b31,_0x4d4826['error'][_0x9118('0x2f')]);return _0x5ec298(_0x4d4826[_0x9118('0x2d')][_0x9118('0x2f')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x1f0b31,_0x9118('0x29'));_0x5ec298(_0x4d4826[_0x9118('0x30')]['message']);}})[_0x9118('0x31')](function(_0x15ed8d){logger[_0x9118('0x2d')](_0x9118('0x28'),_0x1f0b31,_0x15ed8d);_0x1240da(_0x15ed8d);});});}function respondWithStatusCode(_0x730b31,_0x12c254){_0x12c254=_0x12c254||0xcc;return function(_0x3ff148){if(_0x3ff148){return _0x730b31[_0x9118('0x32')](_0x12c254);}return _0x730b31['status'](_0x12c254)[_0x9118('0x33')]();};}function respondWithResult(_0x28429c,_0x25f3ec){_0x25f3ec=_0x25f3ec||0xc8;return function(_0x71cd37){if(_0x71cd37){return _0x28429c[_0x9118('0x34')](_0x25f3ec)[_0x9118('0x35')](_0x71cd37);}};}function respondWithFilteredResult(_0x12d7da,_0x6db51c){return function(_0x57c5d2){if(_0x57c5d2){var _0x41f842=_0x57c5d2['count'],_0x450c78=_0x6db51c['offset'],_0x5c1d8f=_0x6db51c['offset']+_0x6db51c[_0x9118('0x36')],_0x10a2bf;if(_0x5c1d8f>=_0x41f842){_0x5c1d8f=_0x41f842;_0x10a2bf=0xc8;}else{_0x10a2bf=0xce;}_0x12d7da[_0x9118('0x34')](_0x10a2bf);return _0x12d7da[_0x9118('0x37')](_0x9118('0x38'),_0x450c78+'-'+_0x5c1d8f+'/'+_0x41f842)[_0x9118('0x35')](_0x57c5d2);}return null;};}function patchUpdates(_0x446af9){return function(_0x38662f){try{jsonpatch[_0x9118('0x39')](_0x38662f,_0x446af9,!![]);}catch(_0x5eb995){return BPromise[_0x9118('0x3a')](_0x5eb995);}return _0x38662f[_0x9118('0x3b')]();};}function saveUpdates(_0x175f85,_0x5aa4a5){return function(_0x33a43f){if(_0x33a43f){return _0x33a43f[_0x9118('0x3c')](_0x175f85)[_0x9118('0x26')](function(_0x590d78){return _0x590d78;});}return null;};}function removeEntity(_0x356855,_0x5d5042){return function(_0x572649){if(_0x572649){return _0x572649[_0x9118('0x3d')]()['then'](function(){var _0x443b4f=_0x572649[_0x9118('0x3e')]({'plain':!![]});var _0x450a4c=_0x9118('0x3f');return db[_0x9118('0x40')][_0x9118('0x3d')]({'where':{'type':_0x450a4c,'resourceId':_0x443b4f['id']}})[_0x9118('0x26')](function(){return _0x572649;});})['then'](function(){_0x356855['status'](0xcc)[_0x9118('0x33')]();});}};}function handleEntityNotFound(_0x659431,_0x4f3862){return function(_0x185d0c){if(!_0x185d0c){_0x659431[_0x9118('0x32')](0x194);}return _0x185d0c;};}function handleError(_0x279a7c,_0x48dc97){_0x48dc97=_0x48dc97||0x1f4;return function(_0x1ffb75){logger[_0x9118('0x2d')](_0x1ffb75[_0x9118('0x41')]);if(_0x1ffb75[_0x9118('0x42')]){delete _0x1ffb75[_0x9118('0x42')];}_0x279a7c[_0x9118('0x34')](_0x48dc97)[_0x9118('0x43')](_0x1ffb75);};}exports[_0x9118('0x44')]=function(_0x4a4c22,_0x32b48c){var _0x49ac97={'include':[{'model':db[_0x9118('0x45')],'as':_0x9118('0x46')}]},_0x5d2cb4={},_0x2d004d={'count':0x0,'rows':[]};var _0x5584c3=_[_0x9118('0x47')](db['SmsAccount']['rawAttributes'],function(_0x5082aa){return{'name':_0x5082aa['fieldName'],'type':_0x5082aa[_0x9118('0x48')]['key']};});_0x5d2cb4[_0x9118('0x49')]=_[_0x9118('0x47')](_0x5584c3,_0x9118('0x42'));_0x5d2cb4['query']=_[_0x9118('0x4a')](_0x4a4c22[_0x9118('0x4b')]);_0x5d2cb4['filters']=_['intersection'](_0x5d2cb4[_0x9118('0x49')],_0x5d2cb4[_0x9118('0x4b')]);_0x49ac97['attributes']=_[_0x9118('0x4c')](_0x5d2cb4[_0x9118('0x49')],qs['fields'](_0x4a4c22[_0x9118('0x4b')][_0x9118('0x4d')]));_0x49ac97[_0x9118('0x4e')]=_0x49ac97[_0x9118('0x4e')]['length']?_0x49ac97[_0x9118('0x4e')]:_0x5d2cb4[_0x9118('0x49')];if(!_0x4a4c22[_0x9118('0x4b')]['hasOwnProperty'](_0x9118('0x4f'))){_0x49ac97[_0x9118('0x36')]=qs[_0x9118('0x36')](_0x4a4c22['query'][_0x9118('0x36')]);_0x49ac97[_0x9118('0x50')]=qs[_0x9118('0x50')](_0x4a4c22[_0x9118('0x4b')][_0x9118('0x50')]);}_0x49ac97[_0x9118('0x51')]=qs['sort'](_0x4a4c22[_0x9118('0x4b')][_0x9118('0x52')]);_0x49ac97[_0x9118('0x53')]=qs[_0x9118('0x54')](_['pick'](_0x4a4c22[_0x9118('0x4b')],_0x5d2cb4[_0x9118('0x54')]));if(_0x4a4c22[_0x9118('0x4b')][_0x9118('0x55')]){_0x49ac97[_0x9118('0x53')]=_[_0x9118('0x56')](_0x49ac97[_0x9118('0x53')],{'$or':_[_0x9118('0x47')](_0x5584c3,function(_0x538c65){if(_0x538c65[_0x9118('0x48')]!==_0x9118('0x57')){var _0x336f05={};_0x336f05[_0x538c65['name']]={'$like':'%'+_0x4a4c22[_0x9118('0x4b')][_0x9118('0x55')]+'%'};return _0x336f05;}})});}_0x49ac97=_['merge']({},_0x49ac97,_0x4a4c22[_0x9118('0x58')]);var _0x57f26e={'where':_0x49ac97['where']};return db['SmsAccount'][_0x9118('0x59')](_0x57f26e)[_0x9118('0x26')](function(_0x21b4b9){_0x2d004d[_0x9118('0x59')]=_0x21b4b9;if(_0x4a4c22[_0x9118('0x4b')][_0x9118('0x5a')]){_0x49ac97[_0x9118('0x5b')]=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x49ac97);})[_0x9118('0x26')](function(_0x1e3da9){_0x2d004d['rows']=_0x1e3da9;return _0x2d004d;})['then'](respondWithFilteredResult(_0x32b48c,_0x49ac97))[_0x9118('0x31')](handleError(_0x32b48c,null));};exports['show']=function(_0x479965,_0x17be38){var _0x26af50={'raw':![],'where':{'id':_0x479965[_0x9118('0x5c')]['id']},'include':[{'model':db[_0x9118('0x45')],'as':_0x9118('0x46')}]},_0x3edea6={};_0x3edea6[_0x9118('0x49')]=_[_0x9118('0x4a')](db[_0x9118('0x5d')]['rawAttributes']);_0x3edea6[_0x9118('0x4b')]=_[_0x9118('0x4a')](_0x479965[_0x9118('0x4b')]);_0x3edea6['filters']=_[_0x9118('0x4c')](_0x3edea6[_0x9118('0x49')],_0x3edea6[_0x9118('0x4b')]);_0x26af50['attributes']=_[_0x9118('0x4c')](_0x3edea6[_0x9118('0x49')],qs['fields'](_0x479965[_0x9118('0x4b')][_0x9118('0x4d')]));_0x26af50[_0x9118('0x4e')]=_0x26af50[_0x9118('0x4e')][_0x9118('0x5e')]?_0x26af50[_0x9118('0x4e')]:_0x3edea6[_0x9118('0x49')];if(_0x479965['query'][_0x9118('0x5a')]){_0x26af50[_0x9118('0x5b')]=[{'all':!![]}];}_0x26af50=_['merge']({},_0x26af50,_0x479965[_0x9118('0x58')]);return db[_0x9118('0x5d')][_0x9118('0x5f')](_0x26af50)[_0x9118('0x26')](handleEntityNotFound(_0x17be38,null))[_0x9118('0x26')](respondWithResult(_0x17be38,null))['catch'](handleError(_0x17be38,null));};exports[_0x9118('0x60')]=function(_0x2033c0,_0x308336){return db[_0x9118('0x5d')][_0x9118('0x60')](_0x2033c0['body'],{})[_0x9118('0x26')](function(_0x2ba6dd){var _0x14f016=_0x2033c0[_0x9118('0x61')]['get']({'plain':!![]});if(!_0x14f016)throw new Error(_0x9118('0x62'));if(_0x14f016[_0x9118('0x63')]===_0x9118('0x61')){var _0x337513=_0x2ba6dd[_0x9118('0x3e')]({'plain':!![]});var _0x2c15a7='SmsAccounts';return db[_0x9118('0x64')][_0x9118('0x5f')]({'where':{'name':_0x2c15a7,'userProfileId':_0x14f016[_0x9118('0x65')]},'raw':!![]})[_0x9118('0x26')](function(_0x2609aa){if(_0x2609aa&&_0x2609aa[_0x9118('0x66')]===0x0){return db[_0x9118('0x40')][_0x9118('0x60')]({'name':_0x337513[_0x9118('0x42')],'resourceId':_0x337513['id'],'type':_0x2609aa[_0x9118('0x42')],'sectionId':_0x2609aa['id']},{})[_0x9118('0x26')](function(){return _0x2ba6dd;});}else{return _0x2ba6dd;}})[_0x9118('0x31')](function(_0x5b7cde){logger['error'](_0x9118('0x67'),_0x5b7cde);throw _0x5b7cde;});}return _0x2ba6dd;})[_0x9118('0x26')](respondWithResult(_0x308336,0xc9))[_0x9118('0x31')](handleError(_0x308336,null));};exports['update']=function(_0x57c584,_0x52ff9c){if(_0x57c584[_0x9118('0x68')]['id']){delete _0x57c584[_0x9118('0x68')]['id'];}return db[_0x9118('0x5d')][_0x9118('0x5f')]({'where':{'id':_0x57c584[_0x9118('0x5c')]['id']},'include':[{'model':db[_0x9118('0x45')],'as':_0x9118('0x46')}]})[_0x9118('0x26')](handleEntityNotFound(_0x52ff9c,null))[_0x9118('0x26')](saveUpdates(_0x57c584['body'],null))[_0x9118('0x26')](respondWithResult(_0x52ff9c,null))[_0x9118('0x31')](handleError(_0x52ff9c,null));};exports[_0x9118('0x3d')]=function(_0x57a3ec,_0x385f54){return db[_0x9118('0x5d')][_0x9118('0x5f')]({'where':{'id':_0x57a3ec[_0x9118('0x5c')]['id']}})[_0x9118('0x26')](handleEntityNotFound(_0x385f54,null))[_0x9118('0x26')](removeEntity(_0x385f54,null))[_0x9118('0x31')](handleError(_0x385f54,null));};exports[_0x9118('0x69')]=function(_0xffb394,_0x591ff7){return db[_0x9118('0x5d')][_0x9118('0x69')]()[_0x9118('0x26')](respondWithResult(_0x591ff7,null))[_0x9118('0x31')](handleError(_0x591ff7,null));};exports[_0x9118('0x6a')]=function(_0x8873ae,_0x29fa2e,_0x2620df){if(_0x8873ae[_0x9118('0x68')]['id']){delete _0x8873ae['body']['id'];}return db['SmsAccount'][_0x9118('0x5f')]({'where':{'id':_0x8873ae['params']['id']}})[_0x9118('0x26')](handleEntityNotFound(_0x29fa2e,null))['then'](function(_0x15a2f2){if(_0x15a2f2){_0x8873ae[_0x9118('0x68')][_0x9118('0x6b')]=_0x15a2f2['id'];return db[_0x9118('0x6c')]['create'](_0x8873ae[_0x9118('0x68')]);}})[_0x9118('0x26')](respondWithResult(_0x29fa2e,null))[_0x9118('0x31')](handleError(_0x29fa2e,null));};exports[_0x9118('0x6d')]=function(_0xff9178,_0x212fb1,_0x5a17f4){var _0x47d793={'raw':![],'where':{}};var _0x13c36f={};var _0x3c8cf5={'count':0x0,'rows':[]};return db[_0x9118('0x5d')][_0x9118('0x6e')]({'where':{'id':_0xff9178[_0x9118('0x5c')]['id']}})[_0x9118('0x26')](handleEntityNotFound(_0x212fb1,null))['then'](function(_0x5bcc95){if(_0x5bcc95){_0x13c36f['model']=_[_0x9118('0x4a')](db[_0x9118('0x6c')][_0x9118('0x6f')]);_0x13c36f[_0x9118('0x4b')]=_['keys'](_0xff9178[_0x9118('0x4b')]);_0x13c36f[_0x9118('0x54')]=_[_0x9118('0x4c')](_0x13c36f[_0x9118('0x49')],_0x13c36f[_0x9118('0x4b')]);_0x47d793[_0x9118('0x4e')]=_[_0x9118('0x4c')](_0x13c36f[_0x9118('0x49')],qs[_0x9118('0x4d')](_0xff9178[_0x9118('0x4b')][_0x9118('0x4d')]));_0x47d793[_0x9118('0x4e')]=_0x47d793[_0x9118('0x4e')][_0x9118('0x5e')]?_0x47d793['attributes']:_0x13c36f['model'];if(!_0xff9178[_0x9118('0x4b')][_0x9118('0x70')](_0x9118('0x4f'))){_0x47d793[_0x9118('0x36')]=qs[_0x9118('0x36')](_0xff9178[_0x9118('0x4b')][_0x9118('0x36')]);_0x47d793[_0x9118('0x50')]=qs[_0x9118('0x50')](_0xff9178[_0x9118('0x4b')][_0x9118('0x50')]);}_0x47d793['order']=qs[_0x9118('0x52')](_0xff9178[_0x9118('0x4b')]['sort']);_0x47d793[_0x9118('0x53')]=qs[_0x9118('0x54')](_[_0x9118('0x71')](_0xff9178[_0x9118('0x4b')],_0x13c36f['filters']));_0x47d793[_0x9118('0x53')]['SmsAccountId']=_0x5bcc95['id'];if(_0xff9178[_0x9118('0x4b')][_0x9118('0x55')]){_0x47d793[_0x9118('0x53')]=_[_0x9118('0x56')](_0x47d793[_0x9118('0x53')],{'$or':_[_0x9118('0x47')](_0x47d793['attributes'],function(_0x17b746){var _0x1c60d3={};_0x1c60d3[_0x17b746]={'$like':'%'+_0xff9178[_0x9118('0x4b')]['filter']+'%'};return _0x1c60d3;})});}_0x47d793=_[_0x9118('0x56')]({},_0x47d793,_0xff9178['options']);return db[_0x9118('0x6c')]['count']({'where':_0x47d793[_0x9118('0x53')]})[_0x9118('0x26')](function(_0x39155c){_0x3c8cf5[_0x9118('0x59')]=_0x39155c;if(_0xff9178[_0x9118('0x4b')]['includeAll']){_0x47d793[_0x9118('0x5b')]=[{'all':!![]}];}return db[_0x9118('0x6c')][_0x9118('0x72')](_0x47d793);})[_0x9118('0x26')](function(_0x50a95a){_0x3c8cf5[_0x9118('0x73')]=_0x50a95a;return _0x3c8cf5;});}})[_0x9118('0x26')](respondWithFilteredResult(_0x212fb1,_0x47d793))[_0x9118('0x31')](handleError(_0x212fb1,null));};exports[_0x9118('0x74')]=function(_0x5d446a,_0x4d29ff,_0x21c84a){return db[_0x9118('0x5d')][_0x9118('0x5f')]({'where':{'id':_0x5d446a[_0x9118('0x5c')]['id']}})[_0x9118('0x26')](handleEntityNotFound(_0x4d29ff,null))[_0x9118('0x26')](function(_0x3f51e4){if(_0x3f51e4){return _0x3f51e4['removeDispositions'](_0x5d446a[_0x9118('0x4b')]['ids']);}})[_0x9118('0x26')](respondWithStatusCode(_0x4d29ff,null))[_0x9118('0x31')](handleError(_0x4d29ff,null));};exports['addAnswer']=function(_0x55e51e,_0x167b63,_0x4aed6b){if(_0x55e51e[_0x9118('0x68')]['id']){delete _0x55e51e[_0x9118('0x68')]['id'];}return db[_0x9118('0x5d')][_0x9118('0x5f')]({'where':{'id':_0x55e51e[_0x9118('0x5c')]['id']}})[_0x9118('0x26')](handleEntityNotFound(_0x167b63,null))['then'](function(_0x1b1080){if(_0x1b1080){_0x55e51e[_0x9118('0x68')]['SmsAccountId']=_0x1b1080['id'];return db['CannedAnswer'][_0x9118('0x60')](_0x55e51e[_0x9118('0x68')]);}})[_0x9118('0x26')](respondWithResult(_0x167b63,null))[_0x9118('0x31')](handleError(_0x167b63,null));};exports['getAnswers']=function(_0x2ec3a7,_0x2f0323,_0x38ba5a){var _0x239485={'raw':![],'where':{}};var _0x29d752={};var _0x11dd1f={'count':0x0,'rows':[]};return db['SmsAccount'][_0x9118('0x6e')]({'where':{'id':_0x2ec3a7['params']['id']}})[_0x9118('0x26')](handleEntityNotFound(_0x2f0323,null))[_0x9118('0x26')](function(_0x105778){if(_0x105778){_0x29d752[_0x9118('0x49')]=_[_0x9118('0x4a')](db['CannedAnswer'][_0x9118('0x6f')]);_0x29d752['query']=_['keys'](_0x2ec3a7['query']);_0x29d752[_0x9118('0x54')]=_['intersection'](_0x29d752[_0x9118('0x49')],_0x29d752[_0x9118('0x4b')]);_0x239485['attributes']=_[_0x9118('0x4c')](_0x29d752[_0x9118('0x49')],qs['fields'](_0x2ec3a7[_0x9118('0x4b')][_0x9118('0x4d')]));_0x239485[_0x9118('0x4e')]=_0x239485[_0x9118('0x4e')]['length']?_0x239485['attributes']:_0x29d752[_0x9118('0x49')];if(!_0x2ec3a7['query'][_0x9118('0x70')](_0x9118('0x4f'))){_0x239485[_0x9118('0x36')]=qs['limit'](_0x2ec3a7['query'][_0x9118('0x36')]);_0x239485[_0x9118('0x50')]=qs['offset'](_0x2ec3a7[_0x9118('0x4b')][_0x9118('0x50')]);}_0x239485[_0x9118('0x51')]=qs[_0x9118('0x52')](_0x2ec3a7['query'][_0x9118('0x52')]);_0x239485[_0x9118('0x53')]=qs[_0x9118('0x54')](_['pick'](_0x2ec3a7[_0x9118('0x4b')],_0x29d752[_0x9118('0x54')]));_0x239485['where']['SmsAccountId']=_0x105778['id'];if(_0x2ec3a7[_0x9118('0x4b')][_0x9118('0x55')]){_0x239485[_0x9118('0x53')]=_[_0x9118('0x56')](_0x239485[_0x9118('0x53')],{'$or':_[_0x9118('0x47')](_0x239485[_0x9118('0x4e')],function(_0x29ca6d){var _0x5dcc61={};_0x5dcc61[_0x29ca6d]={'$like':'%'+_0x2ec3a7[_0x9118('0x4b')][_0x9118('0x55')]+'%'};return _0x5dcc61;})});}_0x239485=_[_0x9118('0x56')]({},_0x239485,_0x2ec3a7[_0x9118('0x58')]);return db['CannedAnswer']['count']({'where':_0x239485[_0x9118('0x53')]})[_0x9118('0x26')](function(_0x21d459){_0x11dd1f[_0x9118('0x59')]=_0x21d459;if(_0x2ec3a7[_0x9118('0x4b')]['includeAll']){_0x239485[_0x9118('0x5b')]=[{'all':!![]}];}return db[_0x9118('0x75')][_0x9118('0x72')](_0x239485);})['then'](function(_0x24e97d){_0x11dd1f[_0x9118('0x73')]=_0x24e97d;return _0x11dd1f;});}})[_0x9118('0x26')](respondWithFilteredResult(_0x2f0323,_0x239485))['catch'](handleError(_0x2f0323,null));};exports['removeAnswers']=function(_0x29b736,_0x492bcd,_0x218cbc){return db[_0x9118('0x5d')][_0x9118('0x5f')]({'where':{'id':_0x29b736[_0x9118('0x5c')]['id']}})['then'](handleEntityNotFound(_0x492bcd,null))['then'](function(_0x4ccfcb){if(_0x4ccfcb){return _0x4ccfcb[_0x9118('0x76')](_0x29b736['query']['ids']);}})[_0x9118('0x26')](respondWithStatusCode(_0x492bcd,null))['catch'](handleError(_0x492bcd,null));};exports[_0x9118('0x77')]=function(_0x186145,_0x4e77da,_0x23acd1){var _0x194d5b={'channel':_0x9118('0x78')};var _0x47c93d=[];var _0x3b6146=[];var _0x3ef8ac={};return db[_0x9118('0x5d')][_0x9118('0x5f')]({'where':{'id':_0x186145[_0x9118('0x5c')]['id']},'include':[{'model':db[_0x9118('0x79')],'as':_0x9118('0x7a')}]})[_0x9118('0x26')](handleEntityNotFound(_0x4e77da,null))[_0x9118('0x26')](function(_0x5e264c){_0x194d5b[_0x9118('0x7b')]=_0x5e264c;_0x194d5b[_0x9118('0x7c')]=_['orderBy'](_0x5e264c[_0x9118('0x7a')],['priority'],[_0x9118('0x7d')]);if(_0x194d5b[_0x9118('0x7b')][_0x9118('0x7a')]){delete _0x194d5b[_0x9118('0x7b')][_0x9118('0x7a')];}return db[_0x9118('0x7e')][_0x9118('0x69')]();})[_0x9118('0x26')](function(_0x12a412){if(!_0x12a412){throw new db[(_0x9118('0x7f'))][(_0x9118('0x23'))](_0x9118('0x80'));}_0x47c93d=_[_0x9118('0x81')](_[_0x9118('0x4a')](_0x12a412),['createdAt','updatedAt']);_0x3b6146=_['difference'](_[_0x9118('0x4a')](_0x12a412),[_0x9118('0x82'),_0x9118('0x83'),_0x9118('0x84'),_0x9118('0x85')]);_0x194d5b[_0x9118('0x68')]={'mapKey':_0x9118('0x86')};if(_0x194d5b[_0x9118('0x7b')][_0x9118('0x48')]){switch(_0x194d5b[_0x9118('0x7b')][_0x9118('0x48')]){case _0x9118('0x87'):_0x194d5b[_0x9118('0x68')]['from']=_0x186145[_0x9118('0x68')]['From'];_0x194d5b[_0x9118('0x68')][_0x9118('0x68')]=_0x186145[_0x9118('0x68')][_0x9118('0x88')];_0x194d5b[_0x9118('0x68')]['messageId']=_0x186145[_0x9118('0x68')][_0x9118('0x89')];break;case _0x9118('0x8a'):_0x194d5b[_0x9118('0x68')]['from']='+'+_0x186145[_0x9118('0x68')][_0x9118('0x8b')];_0x194d5b['body']['body']=_0x186145[_0x9118('0x68')][_0x9118('0x8c')];break;case'connectel':_0x194d5b['body'][_0x9118('0x8d')]=_0x186145['body'][_0x9118('0x8d')];_0x194d5b[_0x9118('0x68')][_0x9118('0x68')]=_0x186145['body'][_0x9118('0x2f')];break;case _0x9118('0x8e'):_0x194d5b[_0x9118('0x68')]['from']=_0x186145['body'][_0x9118('0x8d')];_0x194d5b[_0x9118('0x68')][_0x9118('0x68')]=_0x186145[_0x9118('0x68')][_0x9118('0x68')];_0x194d5b[_0x9118('0x68')][_0x9118('0x8f')]=_0x186145[_0x9118('0x68')][_0x9118('0x90')];break;case'plivo':_0x194d5b[_0x9118('0x68')][_0x9118('0x8d')]=_0x186145[_0x9118('0x68')][_0x9118('0x91')];_0x194d5b[_0x9118('0x68')][_0x9118('0x68')]=_0x186145[_0x9118('0x68')][_0x9118('0x92')];_0x194d5b['body']['messageId']=_0x186145[_0x9118('0x68')]['MessageUUID'];break;case _0x9118('0x93'):_0x194d5b[_0x9118('0x68')]['from']='+'+_0x186145['body']['results'][0x0][_0x9118('0x8d')];_0x194d5b['body']['body']=_0x186145['body'][_0x9118('0x94')][0x0]['text'];_0x194d5b[_0x9118('0x68')]['messageId']=_0x186145[_0x9118('0x68')][_0x9118('0x94')][0x0][_0x9118('0x8f')];break;case _0x9118('0x95'):_0x194d5b[_0x9118('0x68')][_0x9118('0x8d')]=_0x186145['body'][_0x9118('0x96')];_0x194d5b[_0x9118('0x68')][_0x9118('0x68')]=_0x186145[_0x9118('0x68')][_0x9118('0x97')]['message'];break;case _0x9118('0x98'):_0x194d5b['body'][_0x9118('0x8d')]=_0x186145[_0x9118('0x68')]['fromNumber'];_0x194d5b[_0x9118('0x68')][_0x9118('0x68')]=_0x186145['body'][_0x9118('0x8c')];_0x194d5b[_0x9118('0x68')]['messageId']=_0x186145['body'][_0x9118('0x99')];break;case _0x9118('0x9a'):_0x194d5b[_0x9118('0x68')][_0x9118('0x8d')]=_0x186145[_0x9118('0x68')][_0x9118('0x8d')];_0x194d5b[_0x9118('0x68')][_0x9118('0x68')]=_0x186145[_0x9118('0x68')][_0x9118('0x2f')];_0x194d5b[_0x9118('0x68')][_0x9118('0x8f')]=_0x186145[_0x9118('0x68')][_0x9118('0x9b')];break;}}if(_0x194d5b[_0x9118('0x68')]['id']){delete _0x194d5b['body']['id'];}if(_[_0x9118('0x9c')](_0x194d5b[_0x9118('0x68')][_0x9118('0x8d')])){throw new db[(_0x9118('0x7f'))]['ValidationError'](_0x9118('0x9d'));}if(_[_0x9118('0x9c')](_0x194d5b[_0x9118('0x68')]['body'])||_0x194d5b['body'][_0x9118('0x68')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9118('0x9c')](_0x194d5b[_0x9118('0x68')][_0x9118('0x9e')])){throw new db[(_0x9118('0x7f'))][(_0x9118('0x23'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3b6146);}if(!_[_0x9118('0x9f')](_0x3b6146,_0x194d5b[_0x9118('0x68')][_0x9118('0x9e')])){throw new db[(_0x9118('0x7f'))][(_0x9118('0x23'))](_0x9118('0xa0')+_0x3b6146);}_0x3ef8ac[_0x194d5b['body'][_0x9118('0x9e')]]=_0x194d5b[_0x9118('0x68')][_0x9118('0x8d')];return db[_0x9118('0xa1')][_0x9118('0x5f')]({'where':{'id':_0x194d5b[_0x9118('0x7b')][_0x9118('0x85')]},'include':[{'model':db['CmContact'],'as':_0x9118('0xa2'),'where':_0x3ef8ac,'limit':0x1,'order':[[_0x9118('0x83'),_0x9118('0xa3')]]}]});})[_0x9118('0x26')](handleEntityNotFound(_0x4e77da,null))[_0x9118('0x26')](function(_0x10d01e){if(_0x10d01e){_0x194d5b[_0x9118('0xa4')]=_[_0x9118('0xa5')](_0x10d01e,[_0x9118('0xa2')]);if(_0x10d01e[_0x9118('0xa2')][_0x9118('0x5e')]){return _0x10d01e[_0x9118('0xa2')][0x0];}var _0x648d5=_['defaults'](_0x194d5b[_0x9118('0x68')],{'firstName':_0x194d5b[_0x9118('0x68')][_0x9118('0x8d')],'ListId':_0x10d01e['id']});_0x648d5[_0x194d5b[_0x9118('0x68')][_0x9118('0x9e')]]=_0x194d5b[_0x9118('0x68')]['from'];return db[_0x9118('0x7e')][_0x9118('0x60')](_0x648d5,{'fields':_0x47c93d,'raw':!![]});}})[_0x9118('0x26')](handleEntityNotFound(_0x4e77da,null))[_0x9118('0x26')](function(_0x24251a){if(_0x24251a){_0x194d5b[_0x9118('0xa6')]=_0x24251a;var _0x1ecbe9={'ContactId':_0x24251a['id'],'phone':_0x194d5b[_0x9118('0x68')][_0x9118('0x8d')],'SmsAccountId':_0x186145['params']['id']};var _0xa04e03={'ContactId':_0x24251a['id'],'SmsAccountId':_0x186145[_0x9118('0x5c')]['id'],'closed':![]};return db['SmsInteraction'][_0x9118('0x5f')]({'where':_0xa04e03})['then'](function(_0x24a06f){if(_0x24a06f){return[_0x24a06f,![]];}return db['SmsInteraction']['create'](_0x1ecbe9)[_0x9118('0x26')](function(_0x40d677){return[_0x40d677,!![]];});});}})[_0x9118('0xa7')](function(_0x249f1a,_0x19cc25){_0x194d5b[_0x9118('0xa8')]=_0x249f1a['get']({'plain':!![]});_0x194d5b[_0x9118('0xa8')]['created']=![];if(_0x19cc25){if(_0x194d5b[_0x9118('0x7b')][_0x9118('0xa9')]){_0x194d5b[_0x9118('0x7c')][_0x9118('0xaa')]({'id':0x0,'priority':_0x194d5b[_0x9118('0x7c')][_0x9118('0x5e')]+0x1,'app':'close','appdata':_0x9118('0xab'),'interval':_0x9118('0xac')});}_0x194d5b[_0x9118('0xa8')][_0x9118('0xad')]=!![];}return db[_0x9118('0xae')][_0x9118('0x60')]({'phone':_0x194d5b[_0x9118('0x68')][_0x9118('0x8d')],'messageId':_0x194d5b[_0x9118('0x68')][_0x9118('0x8f')],'body':_0x194d5b[_0x9118('0x68')]['body'],'SmsAccountId':_0x186145[_0x9118('0x5c')]['id'],'SmsInteractionId':_0x249f1a['id'],'direction':'in','ContactId':_0x249f1a['ContactId'],'AttachmentId':_0x194d5b[_0x9118('0x68')][_0x9118('0xaf')]});})[_0x9118('0x26')](function(_0x5b0d98){_0x194d5b['message']=_0x5b0d98;if(_0x194d5b[_0x9118('0xa8')]['UserId']){return db[_0x9118('0xb0')][_0x9118('0x5f')]({'attributes':['id',_0x9118('0x42')],'where':{'id':_0x194d5b[_0x9118('0xa8')]['UserId']}})[_0x9118('0x26')](function(_0x3bd4a3){if(_0x3bd4a3){_0x194d5b[_0x9118('0x7c')][_0x9118('0xb1')]({'id':0x0,'priority':0x0,'app':_0x9118('0xb2'),'appdata':_0x3bd4a3[_0x9118('0x42')]+','+(_0x194d5b[_0x9118('0x7b')][_0x9118('0xb3')]||0xa),'interval':_0x9118('0xac')});}return respondWithRpcPromise(_0x9118('0xb4'),_0x9118('0xb5'),_0x194d5b);});}return respondWithRpcPromise(_0x9118('0xb4'),_0x9118('0xb5'),_0x194d5b);})[_0x9118('0x26')](function(_0xf2cd5b){if(_0xf2cd5b){var _0x13f6d7=0xc8;var _0x5d15bb='receiveMessage';logger['info'](_0x9118('0x2b'),_0x5d15bb,_0x13f6d7,_0x9118('0xb6'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x5d15bb,_0x13f6d7,_0x9118('0xb6'),JSON[_0x9118('0x2c')](_0xf2cd5b));if(_0x194d5b['account'][_0x9118('0x48')]===_0x9118('0x87')){return _0x4e77da[_0x9118('0x34')](_0x13f6d7)[_0x9118('0x37')](_0x9118('0xb7'),_0x9118('0xb8'))[_0x9118('0x43')]('\x0a');}else{return _0x4e77da['status'](_0x13f6d7)[_0x9118('0x35')](_0xf2cd5b);}}})[_0x9118('0x31')](handleError(_0x4e77da,null));};exports['addApplications']=function(_0x1ce740,_0x100038,_0x2dcfa7){return db[_0x9118('0x5d')][_0x9118('0x6e')]({'where':{'id':_0x1ce740[_0x9118('0x5c')]['id']}})['then'](handleEntityNotFound(_0x100038,null))['then'](function(_0x154cdd){if(_0x154cdd){return db['sequelize'][_0x9118('0xb9')](function(_0x13dc81){return db[_0x9118('0x79')]['destroy']({'where':{'SmsAccountId':_0x1ce740[_0x9118('0x5c')]['id']},'transaction':_0x13dc81})['then'](function(_0x349b5b){var _0x170301=_[_0x9118('0x47')](_0x1ce740[_0x9118('0x68')],function(_0x26d72f){_0x26d72f['SmsAccountId']=_0x1ce740[_0x9118('0x5c')]['id'];return _0x26d72f;});return db[_0x9118('0x79')]['bulkCreate'](_0x170301,{'transaction':_0x13dc81});});})[_0x9118('0x26')](function(){return db[_0x9118('0x79')][_0x9118('0xba')]({'where':{'SmsAccountId':_0x1ce740[_0x9118('0x5c')]['id']},'order':_0x9118('0xbb')});});}})[_0x9118('0x26')](respondWithResult(_0x100038,null))[_0x9118('0x31')](handleError(_0x100038,null));};exports['getApplications']=function(_0x1e7f27,_0x46c7e6,_0x2ec2b8){var _0x257460={};var _0x1a6e03={};var _0x5956ac;var _0x58a414;return db['SmsAccount'][_0x9118('0x6e')]({'where':{'id':_0x1e7f27[_0x9118('0x5c')]['id']}})[_0x9118('0x26')](handleEntityNotFound(_0x46c7e6,null))[_0x9118('0x26')](function(_0x4c2624){if(_0x4c2624){_0x5956ac=_0x4c2624;_0x1a6e03[_0x9118('0x49')]=_['keys'](db[_0x9118('0x79')]['rawAttributes']);_0x1a6e03[_0x9118('0x4b')]=_[_0x9118('0x4a')](_0x1e7f27['query']);_0x1a6e03['filters']=_['intersection'](_0x1a6e03[_0x9118('0x49')],_0x1a6e03[_0x9118('0x4b')]);_0x257460[_0x9118('0x4e')]=_[_0x9118('0x4c')](_0x1a6e03[_0x9118('0x49')],qs[_0x9118('0x4d')](_0x1e7f27[_0x9118('0x4b')]['fields']));_0x257460[_0x9118('0x4e')]=_0x257460[_0x9118('0x4e')][_0x9118('0x5e')]?_0x257460[_0x9118('0x4e')]:_0x1a6e03[_0x9118('0x49')];_0x257460[_0x9118('0x51')]=qs['sort'](_0x1e7f27[_0x9118('0x4b')][_0x9118('0x52')]);_0x257460[_0x9118('0x53')]=qs[_0x9118('0x54')](_[_0x9118('0x71')](_0x1e7f27[_0x9118('0x4b')],_0x1a6e03[_0x9118('0x54')]));if(_0x1e7f27[_0x9118('0x4b')][_0x9118('0x55')]){_0x257460[_0x9118('0x53')]=_[_0x9118('0x56')](_0x257460[_0x9118('0x53')],{'$or':_['map'](_0x257460[_0x9118('0x4e')],function(_0x9a7ca1){var _0x3f9dc8={};_0x3f9dc8[_0x9a7ca1]={'$like':'%'+_0x1e7f27[_0x9118('0x4b')][_0x9118('0x55')]+'%'};return _0x3f9dc8;})});}_0x257460=_[_0x9118('0x56')]({},_0x257460,_0x1e7f27[_0x9118('0x58')]);return _0x5956ac['getApplications'](_0x257460);}})[_0x9118('0x26')](function(_0x5bd0d0){if(_0x5bd0d0){_0x58a414=_0x5bd0d0[_0x9118('0x5e')];if(!_0x1e7f27[_0x9118('0x4b')]['hasOwnProperty']('nolimit')){_0x257460[_0x9118('0x36')]=qs[_0x9118('0x36')](_0x1e7f27['query'][_0x9118('0x36')]);_0x257460[_0x9118('0x50')]=qs[_0x9118('0x50')](_0x1e7f27[_0x9118('0x4b')]['offset']);}return _0x5956ac[_0x9118('0xbc')](_0x257460);}})[_0x9118('0x26')](function(_0x4719cf){if(_0x4719cf){return _0x4719cf?{'count':_0x58a414,'rows':_0x4719cf}:null;}})['then'](respondWithResult(_0x46c7e6,null))[_0x9118('0x31')](handleError(_0x46c7e6,null));};exports[_0x9118('0xbd')]=function(_0x3f4e59,_0x4c9abb,_0x205b9a){var _0x5c53aa={'raw':![],'where':{}};var _0x101665={};var _0x336571={'count':0x0,'rows':[]};return db['SmsAccount'][_0x9118('0x6e')]({'where':{'id':_0x3f4e59[_0x9118('0x5c')]['id']}})[_0x9118('0x26')](handleEntityNotFound(_0x4c9abb,null))['then'](function(_0x4046a7){if(_0x4046a7){_0x101665[_0x9118('0x49')]=_[_0x9118('0x4a')](db['SmsInteraction'][_0x9118('0x6f')]);_0x101665['query']=_[_0x9118('0x4a')](_0x3f4e59[_0x9118('0x4b')]);_0x101665[_0x9118('0x54')]=_['intersection'](_0x101665[_0x9118('0x49')],_0x101665[_0x9118('0x4b')]);_0x5c53aa[_0x9118('0x4e')]=_[_0x9118('0x4c')](_0x101665[_0x9118('0x49')],qs[_0x9118('0x4d')](_0x3f4e59[_0x9118('0x4b')][_0x9118('0x4d')]));_0x5c53aa[_0x9118('0x4e')]=_0x5c53aa[_0x9118('0x4e')][_0x9118('0x5e')]?_0x5c53aa[_0x9118('0x4e')]:_0x101665['model'];if(!_0x3f4e59['query'][_0x9118('0x70')](_0x9118('0x4f'))){_0x5c53aa[_0x9118('0x36')]=qs[_0x9118('0x36')](_0x3f4e59[_0x9118('0x4b')][_0x9118('0x36')]);_0x5c53aa[_0x9118('0x50')]=qs[_0x9118('0x50')](_0x3f4e59[_0x9118('0x4b')]['offset']);}_0x5c53aa[_0x9118('0x51')]=qs[_0x9118('0x52')](_0x3f4e59[_0x9118('0x4b')][_0x9118('0x52')]);_0x5c53aa['where']=qs['filters'](_[_0x9118('0x71')](_0x3f4e59['query'],_0x101665['filters']));_0x5c53aa[_0x9118('0x53')][_0x9118('0x6b')]=_0x4046a7['id'];if(_0x3f4e59[_0x9118('0x4b')][_0x9118('0x55')]){_0x5c53aa[_0x9118('0x53')]=_['merge'](_0x5c53aa[_0x9118('0x53')],{'$or':_[_0x9118('0x47')](_0x5c53aa[_0x9118('0x4e')],function(_0x331ec7){var _0x12818e={};_0x12818e[_0x331ec7]={'$like':'%'+_0x3f4e59[_0x9118('0x4b')][_0x9118('0x55')]+'%'};return _0x12818e;})});}_0x5c53aa=_[_0x9118('0x56')]({},_0x5c53aa,_0x3f4e59['options']);return db[_0x9118('0xbe')][_0x9118('0x59')]({'where':_0x5c53aa[_0x9118('0x53')]})[_0x9118('0x26')](function(_0x44e244){_0x336571[_0x9118('0x59')]=_0x44e244;if(_0x3f4e59['query']['includeAll']){_0x5c53aa[_0x9118('0x5b')]=[{'model':db[_0x9118('0x7e')],'as':_0x9118('0xbf'),'required':![]},{'model':db['User'],'as':_0x9118('0xc0'),'attributes':['name',_0x9118('0xc1'),_0x9118('0xc2')],'required':![]},{'model':db[_0x9118('0xc3')],'as':_0x9118('0xc4'),'attributes':['id',_0x9118('0x42'),_0x9118('0xc5')],'where':_0x3f4e59[_0x9118('0x4b')][_0x9118('0xc6')]?{'id':_0x3f4e59[_0x9118('0x4b')][_0x9118('0xc6')]}:undefined,'required':_0x3f4e59[_0x9118('0x4b')][_0x9118('0xc6')]?!![]:![]}];}return db[_0x9118('0xbe')][_0x9118('0x72')](_0x5c53aa);})['then'](function(_0x4a2697){_0x336571['rows']=_0x4a2697;return _0x336571;});}})[_0x9118('0x26')](respondWithFilteredResult(_0x4c9abb,_0x5c53aa))[_0x9118('0x31')](handleError(_0x4c9abb,null));};exports[_0x9118('0x43')]=function(_0x5e4817,_0x297be6,_0x162580){var _0x418756,_0x541b5e,_0x594dbe;if(_[_0x9118('0x9c')](_0x5e4817[_0x9118('0x68')][_0x9118('0x68')])||_0x5e4817['body'][_0x9118('0x68')]===''){throw new db[(_0x9118('0x7f'))][(_0x9118('0x23'))](_0x9118('0xc7'));}if(_[_0x9118('0x9c')](_0x5e4817[_0x9118('0x68')]['to'])){throw new db[(_0x9118('0x7f'))][(_0x9118('0x23'))]('to\x20is\x20mandatory');}_0x418756=_0x5e4817['body']['to'];return db[_0x9118('0x5d')][_0x9118('0x5f')]({'where':{'id':_0x5e4817[_0x9118('0x5c')]['id']},'include':[{'model':db[_0x9118('0xa1')],'as':_0x9118('0xc8'),'include':[{'model':db[_0x9118('0x7e')],'as':'Contacts','where':{'mobile':_0x418756},'limit':0x1,'order':[[_0x9118('0x83'),_0x9118('0xa3')]]}]}]})[_0x9118('0x26')](handleEntityNotFound(_0x297be6,null))['then'](function(_0x504b22){if(_0x504b22&&_0x504b22[_0x9118('0xc8')]){_0x541b5e=_0x504b22['get']({'plain':!![]});if(_0x541b5e[_0x9118('0xc8')]&&_0x541b5e[_0x9118('0xc8')][_0x9118('0xa2')]['length']){return _0x541b5e[_0x9118('0xc8')][_0x9118('0xa2')][0x0];}return db[_0x9118('0x7e')][_0x9118('0x60')](_['defaults'](_0x5e4817[_0x9118('0x68')],{'firstName':_0x418756,'mobile':_0x418756,'phone':_0x418756,'ListId':_0x541b5e[_0x9118('0x85')]}));}})['then'](handleEntityNotFound(_0x297be6,null))[_0x9118('0x26')](function(_0x351e3b){if(_0x351e3b){_0x594dbe=_0x351e3b;return db[_0x9118('0xbe')][_0x9118('0x5f')]({'where':{'ContactId':_0x594dbe['id'],'closed':![],'SmsAccountId':_0x541b5e['id']}})[_0x9118('0x26')](function(_0x59cc74){if(_0x59cc74){return[_0x59cc74,![]];}return db[_0x9118('0xbe')]['create']({'UserId':_0x5e4817[_0x9118('0x61')]['id'],'ContactId':_0x594dbe['id'],'SmsAccountId':_0x541b5e['id'],'phone':_0x418756,'firstMsgDirection':_0x9118('0xc9'),'Messages':[_[_0x9118('0x56')](_0x5e4817[_0x9118('0x68')],{'read':![],'body':_0x5e4817[_0x9118('0x68')][_0x9118('0x68')],'phone':_0x418756,'SmsAccountId':_0x541b5e['id'],'UserId':_0x5e4817[_0x9118('0x61')]['id'],'ContactId':_0x594dbe['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x9118('0xca')}]})[_0x9118('0x26')](function(_0x10735a){return[_0x10735a,!![]];});});}})['spread'](function(_0x52199c,_0x1dffce){if(_0x1dffce){return _0x52199c;}return db['SmsMessage'][_0x9118('0x60')](_[_0x9118('0x56')](_0x5e4817[_0x9118('0x68')],{'read':![],'body':_0x5e4817[_0x9118('0x68')][_0x9118('0x68')],'phone':_0x418756,'SmsAccountId':_0x541b5e['id'],'SmsInteractionId':_0x52199c['id'],'UserId':_0x5e4817[_0x9118('0x61')]['id'],'ContactId':_0x594dbe['id']}))['then'](function(_0x1657e4){_0x52199c[_0x9118('0xcb')][_0x9118('0xca')]=[];_0x52199c['dataValues'][_0x9118('0xca')][_0x9118('0xaa')](_0x1657e4[_0x9118('0xcb')]);return _0x52199c;});})['then'](respondWithResult(_0x297be6,null))[_0x9118('0x31')](handleError(_0x297be6,null));};exports['status']=function(_0x3d68ce,_0x3f73b1,_0x5975a2){if(_0x3d68ce['body']['id']){delete _0x3d68ce[_0x9118('0x68')]['id'];}console[_0x9118('0xcc')]('endpoint\x20/status\x20POST\x20/',_0x3d68ce[_0x9118('0x68')]);var _0x13deb7,_0x29c958,_0x356572;return db['SmsAccount']['find']({'where':{'id':_0x3d68ce[_0x9118('0x5c')]['id']}})[_0x9118('0x26')](handleEntityNotFound(_0x3f73b1,null))[_0x9118('0x26')](function(_0x5458ec){if(_0x5458ec){_0x356572=_0x5458ec;logger[_0x9118('0x2a')](_0x9118('0x2b'),_0x9118('0x34'),'received\x20delivery\x20report\x20from',_0x5458ec[_0x9118('0x48')],util[_0x9118('0xcd')](_0x3d68ce[_0x9118('0x68')],{'showHidden':![],'depth':null}));switch(_0x5458ec[_0x9118('0x48')]){case _0x9118('0x8a'):if(_0x3d68ce['body'][_0x9118('0xce')]&&_0x3d68ce['body'][_0x9118('0x34')]){_0x29c958=_0x3d68ce[_0x9118('0x68')][_0x9118('0x34')];return db['SmsMessage'][_0x9118('0x5f')]({'where':{'messageId':_0x3d68ce[_0x9118('0x68')]['skebby_dispatch_id']}});}break;case _0x9118('0xcf'):if(_0x3d68ce['body'][_0x9118('0xd0')]&&_0x3d68ce[_0x9118('0x68')]['statusInt']){_0x29c958=_0x3d68ce[_0x9118('0x68')][_0x9118('0xd1')];return db[_0x9118('0xae')][_0x9118('0x5f')]({'where':{'messageId':_0x3d68ce[_0x9118('0x68')][_0x9118('0xd0')]}});}break;case _0x9118('0x8e'):if(_0x3d68ce[_0x9118('0x68')][_0x9118('0x90')]&&_0x3d68ce[_0x9118('0x68')][_0x9118('0xd2')]){_0x29c958=_0x3d68ce[_0x9118('0x68')][_0x9118('0xd2')];return db[_0x9118('0xae')][_0x9118('0x5f')]({'where':{'messageId':_0x3d68ce[_0x9118('0x68')][_0x9118('0x90')]}});}break;case'infobip':var _0x5c46bc=_0x3d68ce[_0x9118('0x68')][_0x9118('0x94')][0x0];if(_0x5c46bc['messageId']&&_0x5c46bc[_0x9118('0x34')][_0x9118('0xd3')]==='DELIVERED'){_0x29c958=_0x5c46bc[_0x9118('0x34')][_0x9118('0xd3')];return db['SmsMessage']['find']({'where':{'messageId':_0x5c46bc['messageId']}});}break;case _0x9118('0x98'):if(_0x3d68ce['body'][_0x9118('0x8f')]&&_0x3d68ce[_0x9118('0x68')]['status']){_0x29c958=_0x3d68ce[_0x9118('0x68')][_0x9118('0x34')];return db[_0x9118('0xae')]['find']({'where':{'messageId':_0x3d68ce[_0x9118('0x68')]['messageId']}});}break;case'intelepeer':if(_0x3d68ce[_0x9118('0x68')]['redif']&&_0x3d68ce[_0x9118('0x68')][_0x9118('0x34')]){_0x29c958=_0x3d68ce[_0x9118('0x68')][_0x9118('0x34')];return db['SmsMessage'][_0x9118('0x5f')]({'where':{'messageId':_0x3d68ce[_0x9118('0x68')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x3f73b1,null))[_0x9118('0x26')](function(_0x457ef9){if(_0x457ef9){_0x13deb7=_0x457ef9;switch(_0x356572[_0x9118('0x48')]){case _0x9118('0x8a'):if(_0x29c958===_0x9118('0xd4')){return _0x13deb7[_0x9118('0x3c')]({'read':!![]});}else{logger[_0x9118('0x2d')](_0x9118('0x2b'),_0x9118('0x34'),_0x9118('0x8a'),util[_0x9118('0xcd')](_0x3d68ce[_0x9118('0x68')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x29c958==='1'){return _0x13deb7['update']({'read':!![]});}else{logger[_0x9118('0x2d')](_0x9118('0x2b'),_0x9118('0x34'),_0x9118('0x8a'),util[_0x9118('0xcd')](_0x3d68ce[_0x9118('0x68')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x3d68ce['body'][_0x9118('0xd5')]&&_0x29c958>=0xc8&&_0x29c958<=0xce){return _0x13deb7[_0x9118('0x3c')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9118('0x34'),'clicksend',util[_0x9118('0xcd')](_0x3d68ce[_0x9118('0x68')],{'showHidden':![],'depth':null}));}break;case _0x9118('0x93'):var _0x2f9ac0=_0x3d68ce[_0x9118('0x68')]['results'][0x0];if(_0x2f9ac0[_0x9118('0x34')][_0x9118('0xd3')]===_0x9118('0xd4')){return _0x13deb7[_0x9118('0x3c')]({'read':!![]});}else{logger[_0x9118('0x2d')](_0x9118('0x2b'),'status',_0x9118('0x93'),util[_0x9118('0xcd')](_0x3d68ce[_0x9118('0x68')],{'showHidden':![],'depth':null}));}break;case _0x9118('0x98'):if(_0x29c958=='DELIVERED_TO_GATEWAY'||_0x29c958==_0x9118('0xd6')){return _0x13deb7['update']({'read':!![]});}else{logger[_0x9118('0x2d')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x9118('0x98'),util[_0x9118('0xcd')](_0x3d68ce['body'],{'showHidden':![],'depth':null}));}break;case _0x9118('0x9a'):if(_0x29c958==='DELIVRD'||_0x29c958===_0x9118('0xd7')){return _0x13deb7[_0x9118('0x3c')]({'read':!![]});}else{logger[_0x9118('0x2d')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9118('0x34'),_0x9118('0x9a'),util[_0x9118('0xcd')](_0x3d68ce[_0x9118('0x68')],{'showHidden':![],'depth':null}));}break;}return _0x13deb7;}})['then'](respondWithResult(_0x3f73b1,null))[_0x9118('0x31')](handleError(_0x3f73b1,null));};exports[_0x9118('0xd8')]=function(_0x539f6f,_0x5d1179,_0x59ad7f){var _0x16c92a,_0x332ddb,_0x237cb7;return db['SmsAccount'][_0x9118('0x5f')]({'where':{'id':_0x539f6f[_0x9118('0x5c')]['id']}})[_0x9118('0x26')](handleEntityNotFound(_0x5d1179,null))[_0x9118('0x26')](function(_0x1852b8){if(_0x1852b8){_0x237cb7=_0x1852b8;logger[_0x9118('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x9118('0x34'),_0x9118('0xd9'),_0x1852b8['type'],util[_0x9118('0xcd')](_0x539f6f[_0x9118('0x4b')],{'showHidden':![],'depth':null}));switch(_0x1852b8[_0x9118('0x48')]){case _0x9118('0x95'):if(_0x539f6f[_0x9118('0x4b')][_0x9118('0xda')]&&_0x539f6f[_0x9118('0x4b')][_0x9118('0xdb')]){_0x332ddb=_0x539f6f[_0x9118('0x4b')][_0x9118('0xdb')];return db[_0x9118('0xae')]['find']({'where':{'messageId':_0x539f6f[_0x9118('0x4b')]['message-id']}});}break;}}})[_0x9118('0x26')](handleEntityNotFound(_0x5d1179,null))[_0x9118('0x26')](function(_0x247287){if(_0x247287){_0x16c92a=_0x247287;switch(_0x237cb7[_0x9118('0x48')]){case _0x9118('0x95'):if(_0x332ddb==='2'||_0x332ddb==='6'){return _0x16c92a['update']({'read':!![]});}else{logger[_0x9118('0x2d')](_0x9118('0x2b'),_0x9118('0x34'),_0x9118('0x95'),util[_0x9118('0xcd')](_0x539f6f[_0x9118('0x4b')],{'showHidden':![],'depth':null}));};break;}return _0x16c92a;}})[_0x9118('0x26')](respondWithResult(_0x5d1179,null))[_0x9118('0x31')](handleError(_0x5d1179,null));};exports['addAgents']=function(_0x383541,_0x2204c9,_0x233f3f){return db['SmsAccount']['find']({'where':{'id':_0x383541[_0x9118('0x5c')]['id']}})[_0x9118('0x26')](handleEntityNotFound(_0x2204c9,null))[_0x9118('0x26')](function(_0x2f94d8){if(_0x2f94d8){return _0x2f94d8['addAgents'](_0x383541['body'][_0x9118('0xdc')],_[_0x9118('0xa5')](_0x383541[_0x9118('0x68')],[_0x9118('0xdc'),'id'])||{})['spread'](function(_0xa8753c){for(var _0x599466=0x0;_0x599466<_0x383541['body'][_0x9118('0xdc')][_0x9118('0x5e')];_0x599466+=0x1){socket['emit']('userSmsAccount:save',{'UserId':_0x383541['body'][_0x9118('0xdc')][_0x599466],'SmsAccountId':_0x383541[_0x9118('0x5c')]['id']});}return _0xa8753c;});}})[_0x9118('0x26')](respondWithResult(_0x2204c9,null))[_0x9118('0x31')](handleError(_0x2204c9,null));};exports[_0x9118('0xdd')]=function(_0x332104,_0x2a8410,_0x521391){return db[_0x9118('0x5d')][_0x9118('0x5f')]({'where':{'id':_0x332104[_0x9118('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2a8410,null))[_0x9118('0x26')](function(_0x338d4a){if(_0x338d4a){return _0x338d4a[_0x9118('0xdd')](_0x332104['query'][_0x9118('0xdc')])['then'](function(){if(_[_0x9118('0xde')](_0x332104[_0x9118('0x4b')]['ids'])){for(var _0x361a8a=0x0;_0x361a8a<_0x332104[_0x9118('0x4b')]['ids']['length'];_0x361a8a+=0x1){socket[_0x9118('0xdf')](_0x9118('0xe0'),{'UserId':Number(_0x332104[_0x9118('0x4b')][_0x9118('0xdc')][_0x361a8a]),'SmsAccountId':Number(_0x332104[_0x9118('0x5c')]['id'])});}}else{socket[_0x9118('0xdf')]('userSmsAccount:remove',{'UserId':Number(_0x332104['query']['ids']),'SmsAccountId':Number(_0x332104['params']['id'])});}});}})[_0x9118('0x26')](respondWithStatusCode(_0x2a8410,null))['catch'](handleError(_0x2a8410,null));};exports[_0x9118('0xe1')]=function(_0x5bddcb,_0x244228,_0x1c4de4){var _0xf5cc92={};var _0x4a77b0={};var _0xb68f26;var _0x349b6d;return db['SmsAccount'][_0x9118('0x6e')]({'where':{'id':_0x5bddcb[_0x9118('0x5c')]['id']}})[_0x9118('0x26')](handleEntityNotFound(_0x244228,null))[_0x9118('0x26')](function(_0x14d746){if(_0x14d746){_0xb68f26=_0x14d746;_0x4a77b0['model']=_[_0x9118('0x4a')](db[_0x9118('0xb0')][_0x9118('0x6f')]);_0x4a77b0[_0x9118('0x4b')]=_['keys'](_0x5bddcb[_0x9118('0x4b')]);_0x4a77b0[_0x9118('0x54')]=_['intersection'](_0x4a77b0[_0x9118('0x49')],_0x4a77b0['query']);_0xf5cc92[_0x9118('0x4e')]=_['intersection'](_0x4a77b0['model'],qs['fields'](_0x5bddcb[_0x9118('0x4b')][_0x9118('0x4d')]));_0xf5cc92[_0x9118('0x4e')]=_0xf5cc92[_0x9118('0x4e')][_0x9118('0x5e')]?_0xf5cc92[_0x9118('0x4e')]:_0x4a77b0[_0x9118('0x49')];_0xf5cc92[_0x9118('0x51')]=qs[_0x9118('0x52')](_0x5bddcb[_0x9118('0x4b')][_0x9118('0x52')]);_0xf5cc92[_0x9118('0x53')]=qs[_0x9118('0x54')](_[_0x9118('0x71')](_0x5bddcb[_0x9118('0x4b')],_0x4a77b0[_0x9118('0x54')]));if(_0x5bddcb[_0x9118('0x4b')][_0x9118('0x55')]){_0xf5cc92[_0x9118('0x53')]=_[_0x9118('0x56')](_0xf5cc92[_0x9118('0x53')],{'$or':_[_0x9118('0x47')](_0xf5cc92[_0x9118('0x4e')],function(_0x1ba2bb){var _0x4c0f45={};_0x4c0f45[_0x1ba2bb]={'$like':'%'+_0x5bddcb[_0x9118('0x4b')]['filter']+'%'};return _0x4c0f45;})});}_0xf5cc92=_[_0x9118('0x56')]({},_0xf5cc92,_0x5bddcb[_0x9118('0x58')]);return _0xb68f26[_0x9118('0xe1')](_0xf5cc92);}})[_0x9118('0x26')](function(_0x4c0711){if(_0x4c0711){_0x349b6d=_0x4c0711[_0x9118('0x5e')];if(!_0x5bddcb[_0x9118('0x4b')][_0x9118('0x70')](_0x9118('0x4f'))){_0xf5cc92[_0x9118('0x36')]=qs[_0x9118('0x36')](_0x5bddcb[_0x9118('0x4b')][_0x9118('0x36')]);_0xf5cc92['offset']=qs[_0x9118('0x50')](_0x5bddcb[_0x9118('0x4b')]['offset']);}return _0xb68f26[_0x9118('0xe1')](_0xf5cc92);}})[_0x9118('0x26')](function(_0x242d7f){if(_0x242d7f){return _0x242d7f?{'count':_0x349b6d,'rows':_0x242d7f}:null;}})[_0x9118('0x26')](respondWithResult(_0x244228,null))['catch'](handleError(_0x244228,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index bf27d54..3e11831 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 _0xd0f7=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xd0f7,0x144));var _0x7d0f=function(_0x3ad8ad,_0x2851dc){_0x3ad8ad=_0x3ad8ad-0x0;var _0x2a517a=_0xd0f7[_0x3ad8ad];return _0x2a517a;};'use strict';var EventEmitter=require(_0x7d0f('0x0'));var SmsAccount=require(_0x7d0f('0x1'))['db'][_0x7d0f('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x7d0f('0x3')](0x0);var events={'afterCreate':_0x7d0f('0x4'),'afterUpdate':_0x7d0f('0x5'),'afterDestroy':_0x7d0f('0x6')};function emitEvent(_0xfcd628){return function(_0x244da0,_0x3b2c4b,_0xcd84c7){SmsAccountEvents[_0x7d0f('0x7')](_0xfcd628+':'+_0x244da0['id'],_0x244da0);SmsAccountEvents[_0x7d0f('0x7')](_0xfcd628,_0x244da0);_0xcd84c7(null);};}for(var e in events){if(events[_0x7d0f('0x8')](e)){var event=events[e];SmsAccount[_0x7d0f('0x9')](e,emitEvent(event));}}module[_0x7d0f('0xa')]=SmsAccountEvents; \ No newline at end of file +var _0x179d=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x179d,0x85));var _0xd179=function(_0xf4b799,_0x547a5a){_0xf4b799=_0xf4b799-0x0;var _0x879443=_0x179d[_0xf4b799];return _0x879443;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xd179('0x0'))['db'][_0xd179('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xd179('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd179('0x3'),'afterDestroy':'remove'};function emitEvent(_0x595fd6){return function(_0x3f667f,_0x45aab8,_0x3dcc18){SmsAccountEvents[_0xd179('0x4')](_0x595fd6+':'+_0x3f667f['id'],_0x3f667f);SmsAccountEvents[_0xd179('0x4')](_0x595fd6,_0x3f667f);_0x3dcc18(null);};}for(var e in events){if(events[_0xd179('0x5')](e)){var event=events[e];SmsAccount[_0xd179('0x6')](e,emitEvent(event));}}module[_0xd179('0x7')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index cdec3f7..d88b6e4 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 _0x7ea3=['define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','./smsAccount.attributes','exports'];(function(_0x441981,_0x12a3eb){var _0x19ce77=function(_0x26973d){while(--_0x26973d){_0x441981['push'](_0x441981['shift']());}};_0x19ce77(++_0x12a3eb);}(_0x7ea3,0x18f));var _0x37ea=function(_0x2ae489,_0x9f8183){_0x2ae489=_0x2ae489-0x0;var _0x144cd2=_0x7ea3[_0x2ae489];return _0x144cd2;};'use strict';var _=require(_0x37ea('0x0'));var util=require(_0x37ea('0x1'));var logger=require(_0x37ea('0x2'))(_0x37ea('0x3'));var moment=require(_0x37ea('0x4'));var BPromise=require(_0x37ea('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x37ea('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x37ea('0x7'));module[_0x37ea('0x8')]=function(_0x4c7904,_0x15fc92){return _0x4c7904[_0x37ea('0x9')](_0x37ea('0xa'),attributes,{'tableName':_0x37ea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9eee=['exports','define','SmsAccount','sms_accounts','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x9eee,0x17a));var _0xe9ee=function(_0x531577,_0x440165){_0x531577=_0x531577-0x0;var _0x36e512=_0x9eee[_0x531577];return _0x36e512;};'use strict';var _=require('lodash');var util=require(_0xe9ee('0x0'));var logger=require(_0xe9ee('0x1'))(_0xe9ee('0x2'));var moment=require('moment');var BPromise=require(_0xe9ee('0x3'));var rp=require(_0xe9ee('0x4'));var fs=require('fs');var path=require(_0xe9ee('0x5'));var rimraf=require(_0xe9ee('0x6'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0xe9ee('0x7')]=function(_0x41a86a,_0x6da294){return _0x41a86a[_0xe9ee('0x8')](_0xe9ee('0x9'),attributes,{'tableName':_0xe9ee('0xa'),'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 f1cb9ad..c2edd53 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 _0xb6cd=['error','code','message','catch','ShowSmsAccount','SmsAccount','find','options','raw','attributes','include','map','model','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xb6cd,0x152));var _0xdb6c=function(_0x14575d,_0x908745){_0x14575d=_0x14575d-0x0;var _0x58eb07=_0xb6cd[_0x14575d];return _0x58eb07;};'use strict';var _=require(_0xdb6c('0x0'));var util=require(_0xdb6c('0x1'));var moment=require(_0xdb6c('0x2'));var BPromise=require('bluebird');var rs=require(_0xdb6c('0x3'));var fs=require('fs');var Redis=require(_0xdb6c('0x4'));var db=require(_0xdb6c('0x5'))['db'];var utils=require(_0xdb6c('0x6'));var logger=require('../../config/logger')(_0xdb6c('0x7'));var config=require(_0xdb6c('0x8'));var jayson=require(_0xdb6c('0x9'));var client=jayson[_0xdb6c('0xa')][_0xdb6c('0xb')]({'port':0x232a});config[_0xdb6c('0xc')]=_['defaults'](config[_0xdb6c('0xc')],{'host':_0xdb6c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdb6c('0xc')]));require('./smsAccount.socket')[_0xdb6c('0xe')](socket);function respondWithRpcPromise(_0xa3fb12,_0x464233,_0x439871){return new BPromise(function(_0x41b97e,_0x2d176c){return client[_0xdb6c('0xf')](_0xa3fb12,_0x439871)['then'](function(_0x786609){logger[_0xdb6c('0x10')](_0xdb6c('0x11'),_0x464233,'request\x20sent');logger[_0xdb6c('0x12')](_0xdb6c('0x13'),_0x464233,_0xdb6c('0x14'),JSON[_0xdb6c('0x15')](_0x786609));if(_0x786609[_0xdb6c('0x16')]){if(_0x786609[_0xdb6c('0x16')][_0xdb6c('0x17')]===0x1f4){logger[_0xdb6c('0x16')](_0xdb6c('0x11'),_0x464233,_0x786609[_0xdb6c('0x16')]['message']);return _0x2d176c(_0x786609[_0xdb6c('0x16')][_0xdb6c('0x18')]);}logger[_0xdb6c('0x16')]('SmsAccount,\x20%s,\x20%s',_0x464233,_0x786609[_0xdb6c('0x16')]['message']);return _0x41b97e(_0x786609[_0xdb6c('0x16')][_0xdb6c('0x18')]);}else{logger[_0xdb6c('0x10')](_0xdb6c('0x11'),_0x464233,_0xdb6c('0x14'));_0x41b97e(_0x786609['result'][_0xdb6c('0x18')]);}})[_0xdb6c('0x19')](function(_0x181898){logger[_0xdb6c('0x16')](_0xdb6c('0x11'),_0x464233,_0x181898);_0x2d176c(_0x181898);});});}exports[_0xdb6c('0x1a')]=function(_0x2527fa){var _0x5265a=this;return new Promise(function(_0x1410d9,_0x5f4a32){return db[_0xdb6c('0x1b')][_0xdb6c('0x1c')]({'raw':_0x2527fa[_0xdb6c('0x1d')]?_0x2527fa['options'][_0xdb6c('0x1e')]===undefined?!![]:![]:!![],'where':_0x2527fa[_0xdb6c('0x1d')]?_0x2527fa[_0xdb6c('0x1d')]['where']||null:null,'attributes':_0x2527fa[_0xdb6c('0x1d')]?_0x2527fa[_0xdb6c('0x1d')][_0xdb6c('0x1f')]||null:null,'include':_0x2527fa[_0xdb6c('0x1d')]?_0x2527fa[_0xdb6c('0x1d')][_0xdb6c('0x20')]?_[_0xdb6c('0x21')](_0x2527fa[_0xdb6c('0x1d')]['include'],function(_0x494bce){return{'model':db[_0x494bce['model']],'as':_0x494bce['as'],'attributes':_0x494bce[_0xdb6c('0x1f')],'include':_0x494bce[_0xdb6c('0x20')]?_[_0xdb6c('0x21')](_0x494bce[_0xdb6c('0x20')],function(_0x25e18f){return{'model':db[_0x25e18f[_0xdb6c('0x22')]],'as':_0x25e18f['as'],'attributes':_0x25e18f[_0xdb6c('0x1f')],'include':_0x25e18f[_0xdb6c('0x20')]?_[_0xdb6c('0x21')](_0x25e18f['include'],function(_0x351d66){return{'model':db[_0x351d66[_0xdb6c('0x22')]],'as':_0x351d66['as'],'attributes':_0x351d66[_0xdb6c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdb6c('0x23')](function(_0x5d9261){logger[_0xdb6c('0x10')](_0xdb6c('0x1a'),_0x2527fa);logger[_0xdb6c('0x12')](_0xdb6c('0x1a'),_0x2527fa,JSON['stringify'](_0x5d9261));_0x1410d9(_0x5d9261);})[_0xdb6c('0x19')](function(_0x22d553){logger[_0xdb6c('0x16')](_0xdb6c('0x1a'),_0x22d553['message'],_0x2527fa);_0x5f4a32(_0x5265a[_0xdb6c('0x16')](0x1f4,_0x22d553[_0xdb6c('0x18')]));});});}; \ No newline at end of file +var _0x429f=['raw','where','include','map','model','attributes','then','debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSmsAccount','SmsAccount','find','options'];(function(_0x1ea18e,_0x1d18e0){var _0x3a7823=function(_0x151b76){while(--_0x151b76){_0x1ea18e['push'](_0x1ea18e['shift']());}};_0x3a7823(++_0x1d18e0);}(_0x429f,0x1dc));var _0xf429=function(_0x3afece,_0x112b15){_0x3afece=_0x3afece-0x0;var _0x1dcdc2=_0x429f[_0x3afece];return _0x1dcdc2;};'use strict';var _=require(_0xf429('0x0'));var util=require(_0xf429('0x1'));var moment=require('moment');var BPromise=require(_0xf429('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf429('0x3'));var db=require(_0xf429('0x4'))['db'];var utils=require(_0xf429('0x5'));var logger=require(_0xf429('0x6'))('rpc');var config=require(_0xf429('0x7'));var jayson=require(_0xf429('0x8'));var client=jayson[_0xf429('0x9')][_0xf429('0xa')]({'port':0x232a});config[_0xf429('0xb')]=_[_0xf429('0xc')](config[_0xf429('0xb')],{'host':_0xf429('0xd'),'port':0x18eb});var socket=require(_0xf429('0xe'))(new Redis(config['redis']));require('./smsAccount.socket')[_0xf429('0xf')](socket);function respondWithRpcPromise(_0x207c30,_0x4d537c,_0x243027){return new BPromise(function(_0x7746cb,_0x5d8860){return client[_0xf429('0x10')](_0x207c30,_0x243027)['then'](function(_0x4178e2){logger['info'](_0xf429('0x11'),_0x4d537c,_0xf429('0x12'));logger['debug'](_0xf429('0x13'),_0x4d537c,_0xf429('0x12'),JSON[_0xf429('0x14')](_0x4178e2));if(_0x4178e2[_0xf429('0x15')]){if(_0x4178e2[_0xf429('0x15')][_0xf429('0x16')]===0x1f4){logger[_0xf429('0x15')](_0xf429('0x11'),_0x4d537c,_0x4178e2['error']['message']);return _0x5d8860(_0x4178e2[_0xf429('0x15')][_0xf429('0x17')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x4d537c,_0x4178e2[_0xf429('0x15')][_0xf429('0x17')]);return _0x7746cb(_0x4178e2['error'][_0xf429('0x17')]);}else{logger[_0xf429('0x18')]('SmsAccount,\x20%s,\x20%s',_0x4d537c,_0xf429('0x12'));_0x7746cb(_0x4178e2[_0xf429('0x19')]['message']);}})[_0xf429('0x1a')](function(_0x386837){logger['error'](_0xf429('0x11'),_0x4d537c,_0x386837);_0x5d8860(_0x386837);});});}exports[_0xf429('0x1b')]=function(_0x2eff80){var _0x372c6e=this;return new Promise(function(_0x25387a,_0x2ae162){return db[_0xf429('0x1c')][_0xf429('0x1d')]({'raw':_0x2eff80[_0xf429('0x1e')]?_0x2eff80[_0xf429('0x1e')][_0xf429('0x1f')]===undefined?!![]:![]:!![],'where':_0x2eff80[_0xf429('0x1e')]?_0x2eff80[_0xf429('0x1e')][_0xf429('0x20')]||null:null,'attributes':_0x2eff80[_0xf429('0x1e')]?_0x2eff80[_0xf429('0x1e')]['attributes']||null:null,'include':_0x2eff80[_0xf429('0x1e')]?_0x2eff80[_0xf429('0x1e')][_0xf429('0x21')]?_[_0xf429('0x22')](_0x2eff80['options'][_0xf429('0x21')],function(_0x36e8be){return{'model':db[_0x36e8be[_0xf429('0x23')]],'as':_0x36e8be['as'],'attributes':_0x36e8be[_0xf429('0x24')],'include':_0x36e8be[_0xf429('0x21')]?_['map'](_0x36e8be[_0xf429('0x21')],function(_0x1bc672){return{'model':db[_0x1bc672[_0xf429('0x23')]],'as':_0x1bc672['as'],'attributes':_0x1bc672[_0xf429('0x24')],'include':_0x1bc672[_0xf429('0x21')]?_[_0xf429('0x22')](_0x1bc672[_0xf429('0x21')],function(_0x21b18e){return{'model':db[_0x21b18e[_0xf429('0x23')]],'as':_0x21b18e['as'],'attributes':_0x21b18e[_0xf429('0x24')]};}):[]};}):[]};}):[]:[]})[_0xf429('0x25')](function(_0x5042ae){logger[_0xf429('0x18')](_0xf429('0x1b'),_0x2eff80);logger[_0xf429('0x26')](_0xf429('0x1b'),_0x2eff80,JSON['stringify'](_0x5042ae));_0x25387a(_0x5042ae);})[_0xf429('0x1a')](function(_0x572218){logger[_0xf429('0x15')](_0xf429('0x1b'),_0x572218[_0xf429('0x17')],_0x2eff80);_0x2ae162(_0x372c6e[_0xf429('0x15')](0x1f4,_0x572218[_0xf429('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 1579b0c..aaff2ad 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 _0x2c42=['./smsAccount.events','save','remove','update','emit','register','length','smsAccount:'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x2c42,0x78));var _0x22c4=function(_0x35461f,_0x299002){_0x35461f=_0x35461f-0x0;var _0x59a5ed=_0x2c42[_0x35461f];return _0x59a5ed;};'use strict';var SmsAccountEvents=require(_0x22c4('0x0'));var events=[_0x22c4('0x1'),_0x22c4('0x2'),_0x22c4('0x3')];function createListener(_0x356932,_0x4db281){return function(_0x57dd1d){_0x4db281[_0x22c4('0x4')](_0x356932,_0x57dd1d);};}function removeListener(_0x516fad,_0x2336d4){return function(){SmsAccountEvents['removeListener'](_0x516fad,_0x2336d4);};}exports[_0x22c4('0x5')]=function(_0x158f69){for(var _0x1ced74=0x0,_0x5af8ac=events[_0x22c4('0x6')];_0x1ced74<_0x5af8ac;_0x1ced74++){var _0x491a88=events[_0x1ced74];var _0x142287=createListener(_0x22c4('0x7')+_0x491a88,_0x158f69);SmsAccountEvents['on'](_0x491a88,_0x142287);}}; \ No newline at end of file +var _0xb665=['register','smsAccount:','save','remove','emit','removeListener'];(function(_0x8e8ca7,_0x5a5e07){var _0x561381=function(_0x2f4bda){while(--_0x2f4bda){_0x8e8ca7['push'](_0x8e8ca7['shift']());}};_0x561381(++_0x5a5e07);}(_0xb665,0x128));var _0x5b66=function(_0x346ba5,_0x190f6c){_0x346ba5=_0x346ba5-0x0;var _0x4a3521=_0xb665[_0x346ba5];return _0x4a3521;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0x5b66('0x0'),_0x5b66('0x1'),'update'];function createListener(_0x3848fa,_0x331890){return function(_0x1115bc){_0x331890[_0x5b66('0x2')](_0x3848fa,_0x1115bc);};}function removeListener(_0x245874,_0x441f81){return function(){SmsAccountEvents[_0x5b66('0x3')](_0x245874,_0x441f81);};}exports[_0x5b66('0x4')]=function(_0x2b4f4d){for(var _0x598e94=0x0,_0x1bf631=events['length'];_0x598e94<_0x1bf631;_0x598e94++){var _0x581e33=events[_0x598e94];var _0x49e969=createListener(_0x5b66('0x5')+_0x581e33,_0x2b4f4d);SmsAccountEvents['on'](_0x581e33,_0x49e969);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 2008c88..6a43f7e 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 _0x584c=['create','update','destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','post'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x584c,0x12a));var _0xc584=function(_0x1fe7e4,_0x5d39a4){_0x1fe7e4=_0x1fe7e4-0x0;var _0x4b3e54=_0x584c[_0x1fe7e4];return _0x4b3e54;};'use strict';var multer=require(_0xc584('0x0'));var util=require(_0xc584('0x1'));var path=require(_0xc584('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xc584('0x3'));var interaction=require(_0xc584('0x4'));var config=require('../../config/environment');var controller=require('./smsApplication.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc584('0x5')]);router[_0xc584('0x6')](_0xc584('0x7'),auth[_0xc584('0x8')](),controller['show']);router[_0xc584('0x9')]('/',auth[_0xc584('0x8')](),controller[_0xc584('0xa')]);router['put'](_0xc584('0x7'),auth[_0xc584('0x8')](),controller[_0xc584('0xb')]);router['delete'](_0xc584('0x7'),auth['isAuthenticated'](),controller[_0xc584('0xc')]);module[_0xc584('0xd')]=router; \ No newline at end of file +var _0x0bce=['get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./smsApplication.controller'];(function(_0x19cae9,_0xd6039b){var _0x163452=function(_0xee5d92){while(--_0xee5d92){_0x19cae9['push'](_0x19cae9['shift']());}};_0x163452(++_0xd6039b);}(_0x0bce,0xbe));var _0xe0bc=function(_0x20cb54,_0x465e21){_0x20cb54=_0x20cb54-0x0;var _0x1960c9=_0x0bce[_0x20cb54];return _0x1960c9;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe0bc('0x0'));var express=require('express');var router=express[_0xe0bc('0x1')]();var auth=require(_0xe0bc('0x2'));var interaction=require(_0xe0bc('0x3'));var config=require('../../config/environment');var controller=require(_0xe0bc('0x4'));router[_0xe0bc('0x5')]('/',auth[_0xe0bc('0x6')](),controller[_0xe0bc('0x7')]);router['get'](_0xe0bc('0x8'),auth[_0xe0bc('0x6')](),controller['show']);router[_0xe0bc('0x9')]('/',auth['isAuthenticated'](),controller[_0xe0bc('0xa')]);router[_0xe0bc('0xb')]('/:id',auth[_0xe0bc('0x6')](),controller[_0xe0bc('0xc')]);router['delete']('/:id',auth[_0xe0bc('0x6')](),controller[_0xe0bc('0xd')]);module[_0xe0bc('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 a450b88..47c8189 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 _0xc302=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x1ac2ab,_0x1f65a2){var _0x5c6291=function(_0x494787){while(--_0x494787){_0x1ac2ab['push'](_0x1ac2ab['shift']());}};_0x5c6291(++_0x1f65a2);}(_0xc302,0x18d));var _0x2c30=function(_0x439315,_0x366b94){_0x439315=_0x439315-0x0;var _0x5bf47e=_0xc302[_0x439315];return _0x5bf47e;};'use strict';var Sequelize=require(_0x2c30('0x0'));module[_0x2c30('0x1')]={'priority':{'type':Sequelize[_0x2c30('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2c30('0x3')],'allowNull':![],'defaultValue':_0x2c30('0x4')},'appdata':{'type':Sequelize[_0x2c30('0x5')]()},'description':{'type':Sequelize[_0x2c30('0x3')]},'interval':{'type':Sequelize[_0x2c30('0x3')],'defaultValue':_0x2c30('0x6')}}; \ No newline at end of file +var _0xaf0e=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x5c9a21,_0x55a94e){var _0x54a38f=function(_0x2a78b4){while(--_0x2a78b4){_0x5c9a21['push'](_0x5c9a21['shift']());}};_0x54a38f(++_0x55a94e);}(_0xaf0e,0x138));var _0xeaf0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xaf0e[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xeaf0('0x0'));module[_0xeaf0('0x1')]={'priority':{'type':Sequelize[_0xeaf0('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xeaf0('0x3')],'allowNull':![],'defaultValue':_0xeaf0('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xeaf0('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index badf3fd..3e8c67f 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 _0x7621=['type','VIRTUAL','count','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','update','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','status','end','json','offset','limit','set','Content-Range','apply','reject','save','destroy','sendStatus','error','stack','name','send','index','map','SmsApplication','fieldName','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge'];(function(_0x31b5b2,_0x5ab927){var _0x364f13=function(_0x163bd0){while(--_0x163bd0){_0x31b5b2['push'](_0x31b5b2['shift']());}};_0x364f13(++_0x5ab927);}(_0x7621,0x1c1));var _0x1762=function(_0xb5c0f,_0xf29ace){_0xb5c0f=_0xb5c0f-0x0;var _0x49d105=_0x7621[_0xb5c0f];return _0x49d105;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1762('0x0'));var rimraf=require(_0x1762('0x1'));var zipdir=require(_0x1762('0x2'));var jsonpatch=require(_0x1762('0x3'));var rp=require('request-promise');var moment=require(_0x1762('0x4'));var BPromise=require(_0x1762('0x5'));var Mustache=require(_0x1762('0x6'));var util=require(_0x1762('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x1762('0x8'));var ejs=require(_0x1762('0x9'));var fs=require('fs');var _=require(_0x1762('0xa'));var squel=require(_0x1762('0xb'));var crypto=require(_0x1762('0xc'));var jsforce=require(_0x1762('0xd'));var deskjs=require(_0x1762('0xe'));var toCsv=require(_0x1762('0x8'));var querystring=require('querystring');var Papa=require(_0x1762('0xf'));var Redis=require(_0x1762('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1762('0x11'));var as=require(_0x1762('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1762('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e002d,_0x126eda){_0x126eda=_0x126eda||0xcc;return function(_0x3b0da2){if(_0x3b0da2){return _0x4e002d['sendStatus'](_0x126eda);}return _0x4e002d[_0x1762('0x14')](_0x126eda)[_0x1762('0x15')]();};}function respondWithResult(_0x2fca93,_0x22491f){_0x22491f=_0x22491f||0xc8;return function(_0x544e29){if(_0x544e29){return _0x2fca93['status'](_0x22491f)[_0x1762('0x16')](_0x544e29);}};}function respondWithFilteredResult(_0xb1e2f,_0x2caee9){return function(_0x32696a){if(_0x32696a){var _0x2f88a7=_0x32696a['count'],_0x844902=_0x2caee9[_0x1762('0x17')],_0x4cc30a=_0x2caee9[_0x1762('0x17')]+_0x2caee9[_0x1762('0x18')],_0x169a9a;if(_0x4cc30a>=_0x2f88a7){_0x4cc30a=_0x2f88a7;_0x169a9a=0xc8;}else{_0x169a9a=0xce;}_0xb1e2f[_0x1762('0x14')](_0x169a9a);return _0xb1e2f[_0x1762('0x19')](_0x1762('0x1a'),_0x844902+'-'+_0x4cc30a+'/'+_0x2f88a7)[_0x1762('0x16')](_0x32696a);}return null;};}function patchUpdates(_0x2636a4){return function(_0x9b310c){try{jsonpatch[_0x1762('0x1b')](_0x9b310c,_0x2636a4,!![]);}catch(_0x315bfd){return BPromise[_0x1762('0x1c')](_0x315bfd);}return _0x9b310c[_0x1762('0x1d')]();};}function saveUpdates(_0x92dc9a,_0x102d8e){return function(_0x5d050e){if(_0x5d050e){return _0x5d050e['update'](_0x92dc9a)['then'](function(_0x6b9208){return _0x6b9208;});}return null;};}function removeEntity(_0x34148d,_0x17f705){return function(_0x295f32){if(_0x295f32){return _0x295f32[_0x1762('0x1e')]()['then'](function(){_0x34148d[_0x1762('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51e827,_0x58c280){return function(_0x2816a6){if(!_0x2816a6){_0x51e827[_0x1762('0x1f')](0x194);}return _0x2816a6;};}function handleError(_0x29810e,_0x59df6e){_0x59df6e=_0x59df6e||0x1f4;return function(_0x20cad5){logger[_0x1762('0x20')](_0x20cad5[_0x1762('0x21')]);if(_0x20cad5['name']){delete _0x20cad5[_0x1762('0x22')];}_0x29810e[_0x1762('0x14')](_0x59df6e)[_0x1762('0x23')](_0x20cad5);};}exports[_0x1762('0x24')]=function(_0x2d6952,_0x255075){var _0x23075c={},_0x1959bd={},_0x2ee5e9={'count':0x0,'rows':[]};var _0x1e9c08=_[_0x1762('0x25')](db[_0x1762('0x26')]['rawAttributes'],function(_0x5efaa5){return{'name':_0x5efaa5[_0x1762('0x27')],'type':_0x5efaa5['type']['key']};});_0x1959bd['model']=_['map'](_0x1e9c08,_0x1762('0x22'));_0x1959bd[_0x1762('0x28')]=_[_0x1762('0x29')](_0x2d6952[_0x1762('0x28')]);_0x1959bd[_0x1762('0x2a')]=_[_0x1762('0x2b')](_0x1959bd[_0x1762('0x2c')],_0x1959bd['query']);_0x23075c['attributes']=_[_0x1762('0x2b')](_0x1959bd[_0x1762('0x2c')],qs[_0x1762('0x2d')](_0x2d6952[_0x1762('0x28')]['fields']));_0x23075c[_0x1762('0x2e')]=_0x23075c['attributes'][_0x1762('0x2f')]?_0x23075c[_0x1762('0x2e')]:_0x1959bd[_0x1762('0x2c')];if(!_0x2d6952[_0x1762('0x28')][_0x1762('0x30')](_0x1762('0x31'))){_0x23075c[_0x1762('0x18')]=qs[_0x1762('0x18')](_0x2d6952[_0x1762('0x28')][_0x1762('0x18')]);_0x23075c[_0x1762('0x17')]=qs[_0x1762('0x17')](_0x2d6952[_0x1762('0x28')][_0x1762('0x17')]);}_0x23075c['order']=qs[_0x1762('0x32')](_0x2d6952[_0x1762('0x28')]['sort']);_0x23075c[_0x1762('0x33')]=qs[_0x1762('0x2a')](_[_0x1762('0x34')](_0x2d6952[_0x1762('0x28')],_0x1959bd['filters']));if(_0x2d6952[_0x1762('0x28')][_0x1762('0x35')]){_0x23075c['where']=_[_0x1762('0x36')](_0x23075c[_0x1762('0x33')],{'$or':_[_0x1762('0x25')](_0x1e9c08,function(_0x942b35){if(_0x942b35[_0x1762('0x37')]!==_0x1762('0x38')){var _0x4dc15a={};_0x4dc15a[_0x942b35[_0x1762('0x22')]]={'$like':'%'+_0x2d6952[_0x1762('0x28')][_0x1762('0x35')]+'%'};return _0x4dc15a;}})});}_0x23075c=_['merge']({},_0x23075c,_0x2d6952['options']);var _0xfc9e8d={'where':_0x23075c[_0x1762('0x33')]};return db[_0x1762('0x26')][_0x1762('0x39')](_0xfc9e8d)[_0x1762('0x3a')](function(_0x537247){_0x2ee5e9[_0x1762('0x39')]=_0x537247;if(_0x2d6952[_0x1762('0x28')][_0x1762('0x3b')]){_0x23075c[_0x1762('0x3c')]=[{'all':!![]}];}return db[_0x1762('0x26')][_0x1762('0x3d')](_0x23075c);})[_0x1762('0x3a')](function(_0x249fdd){_0x2ee5e9[_0x1762('0x3e')]=_0x249fdd;return _0x2ee5e9;})[_0x1762('0x3a')](respondWithFilteredResult(_0x255075,_0x23075c))[_0x1762('0x3f')](handleError(_0x255075,null));};exports[_0x1762('0x40')]=function(_0x4d5977,_0x3c3f1d){var _0x178fb5={'raw':!![],'where':{'id':_0x4d5977[_0x1762('0x41')]['id']}},_0xcee19b={};_0xcee19b['model']=_[_0x1762('0x29')](db[_0x1762('0x26')][_0x1762('0x42')]);_0xcee19b[_0x1762('0x28')]=_['keys'](_0x4d5977[_0x1762('0x28')]);_0xcee19b['filters']=_[_0x1762('0x2b')](_0xcee19b[_0x1762('0x2c')],_0xcee19b[_0x1762('0x28')]);_0x178fb5[_0x1762('0x2e')]=_[_0x1762('0x2b')](_0xcee19b[_0x1762('0x2c')],qs['fields'](_0x4d5977[_0x1762('0x28')][_0x1762('0x2d')]));_0x178fb5[_0x1762('0x2e')]=_0x178fb5[_0x1762('0x2e')][_0x1762('0x2f')]?_0x178fb5[_0x1762('0x2e')]:_0xcee19b[_0x1762('0x2c')];if(_0x4d5977['query'][_0x1762('0x3b')]){_0x178fb5['include']=[{'all':!![]}];}_0x178fb5=_[_0x1762('0x36')]({},_0x178fb5,_0x4d5977[_0x1762('0x43')]);return db[_0x1762('0x26')]['find'](_0x178fb5)[_0x1762('0x3a')](handleEntityNotFound(_0x3c3f1d,null))[_0x1762('0x3a')](respondWithResult(_0x3c3f1d,null))['catch'](handleError(_0x3c3f1d,null));};exports['create']=function(_0x88e966,_0x2a08cf){return db['SmsApplication'][_0x1762('0x44')](_0x88e966['body'],{})[_0x1762('0x3a')](respondWithResult(_0x2a08cf,0xc9))[_0x1762('0x3f')](handleError(_0x2a08cf,null));};exports[_0x1762('0x45')]=function(_0x58c961,_0x2f5584){if(_0x58c961[_0x1762('0x46')]['id']){delete _0x58c961[_0x1762('0x46')]['id'];}return db[_0x1762('0x26')][_0x1762('0x47')]({'where':{'id':_0x58c961[_0x1762('0x41')]['id']}})[_0x1762('0x3a')](handleEntityNotFound(_0x2f5584,null))['then'](saveUpdates(_0x58c961[_0x1762('0x46')],null))[_0x1762('0x3a')](respondWithResult(_0x2f5584,null))['catch'](handleError(_0x2f5584,null));};exports[_0x1762('0x1e')]=function(_0x5981e4,_0x410d27){return db[_0x1762('0x26')][_0x1762('0x47')]({'where':{'id':_0x5981e4[_0x1762('0x41')]['id']}})[_0x1762('0x3a')](handleEntityNotFound(_0x410d27,null))['then'](removeEntity(_0x410d27,null))['catch'](handleError(_0x410d27,null));}; \ No newline at end of file +var _0x7751=['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','../../config/environment','../../mysqldb','status','end','json','count','offset','Content-Range','reject','save','update','destroy','then','sendStatus','stack','name','index','map','SmsApplication','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path'];(function(_0x8e5c29,_0x217d0f){var _0x1d353e=function(_0x34024a){while(--_0x34024a){_0x8e5c29['push'](_0x8e5c29['shift']());}};_0x1d353e(++_0x217d0f);}(_0x7751,0x11c));var _0x1775=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7751[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1775('0x0'));var rimraf=require(_0x1775('0x1'));var zipdir=require(_0x1775('0x2'));var jsonpatch=require(_0x1775('0x3'));var rp=require(_0x1775('0x4'));var moment=require(_0x1775('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1775('0x6'));var path=require(_0x1775('0x7'));var sox=require(_0x1775('0x8'));var csv=require(_0x1775('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1775('0xa'));var squel=require(_0x1775('0xb'));var crypto=require(_0x1775('0xc'));var jsforce=require(_0x1775('0xd'));var deskjs=require(_0x1775('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1775('0xf'));var Papa=require(_0x1775('0x10'));var Redis=require(_0x1775('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1775('0x12'));var as=require(_0x1775('0x13'));var hardwareService=require(_0x1775('0x14'));var logger=require(_0x1775('0x15'))(_0x1775('0x16'));var utils=require(_0x1775('0x17'));var config=require(_0x1775('0x18'));var db=require(_0x1775('0x19'))['db'];function respondWithStatusCode(_0x185869,_0x5277bd){_0x5277bd=_0x5277bd||0xcc;return function(_0x37b69a){if(_0x37b69a){return _0x185869['sendStatus'](_0x5277bd);}return _0x185869[_0x1775('0x1a')](_0x5277bd)[_0x1775('0x1b')]();};}function respondWithResult(_0x3e29ef,_0x4051c2){_0x4051c2=_0x4051c2||0xc8;return function(_0x20fc24){if(_0x20fc24){return _0x3e29ef[_0x1775('0x1a')](_0x4051c2)[_0x1775('0x1c')](_0x20fc24);}};}function respondWithFilteredResult(_0xa88319,_0x24235f){return function(_0x5773c8){if(_0x5773c8){var _0x51421f=_0x5773c8[_0x1775('0x1d')],_0x4d9c41=_0x24235f[_0x1775('0x1e')],_0x2f2c06=_0x24235f[_0x1775('0x1e')]+_0x24235f['limit'],_0x1e4701;if(_0x2f2c06>=_0x51421f){_0x2f2c06=_0x51421f;_0x1e4701=0xc8;}else{_0x1e4701=0xce;}_0xa88319[_0x1775('0x1a')](_0x1e4701);return _0xa88319['set'](_0x1775('0x1f'),_0x4d9c41+'-'+_0x2f2c06+'/'+_0x51421f)[_0x1775('0x1c')](_0x5773c8);}return null;};}function patchUpdates(_0x41a685){return function(_0x4ef683){try{jsonpatch['apply'](_0x4ef683,_0x41a685,!![]);}catch(_0x137c25){return BPromise[_0x1775('0x20')](_0x137c25);}return _0x4ef683[_0x1775('0x21')]();};}function saveUpdates(_0x25f149,_0xd38b74){return function(_0x518d65){if(_0x518d65){return _0x518d65[_0x1775('0x22')](_0x25f149)['then'](function(_0x176dd3){return _0x176dd3;});}return null;};}function removeEntity(_0x4b93e8,_0x4dbc2b){return function(_0x4d2ea3){if(_0x4d2ea3){return _0x4d2ea3[_0x1775('0x23')]()[_0x1775('0x24')](function(){_0x4b93e8[_0x1775('0x1a')](0xcc)[_0x1775('0x1b')]();});}};}function handleEntityNotFound(_0x2830c3,_0x54b7fc){return function(_0x461f46){if(!_0x461f46){_0x2830c3[_0x1775('0x25')](0x194);}return _0x461f46;};}function handleError(_0x3a9e3d,_0x49c80f){_0x49c80f=_0x49c80f||0x1f4;return function(_0x3bf379){logger['error'](_0x3bf379[_0x1775('0x26')]);if(_0x3bf379[_0x1775('0x27')]){delete _0x3bf379[_0x1775('0x27')];}_0x3a9e3d[_0x1775('0x1a')](_0x49c80f)['send'](_0x3bf379);};}exports[_0x1775('0x28')]=function(_0x2e45bc,_0x56a4b3){var _0x539c32={},_0x5bcff9={},_0x40c9cc={'count':0x0,'rows':[]};var _0xc545a1=_[_0x1775('0x29')](db[_0x1775('0x2a')][_0x1775('0x2b')],function(_0x6daa41){return{'name':_0x6daa41['fieldName'],'type':_0x6daa41[_0x1775('0x2c')][_0x1775('0x2d')]};});_0x5bcff9[_0x1775('0x2e')]=_[_0x1775('0x29')](_0xc545a1,_0x1775('0x27'));_0x5bcff9[_0x1775('0x2f')]=_[_0x1775('0x30')](_0x2e45bc[_0x1775('0x2f')]);_0x5bcff9[_0x1775('0x31')]=_[_0x1775('0x32')](_0x5bcff9[_0x1775('0x2e')],_0x5bcff9[_0x1775('0x2f')]);_0x539c32[_0x1775('0x33')]=_['intersection'](_0x5bcff9[_0x1775('0x2e')],qs[_0x1775('0x34')](_0x2e45bc[_0x1775('0x2f')][_0x1775('0x34')]));_0x539c32[_0x1775('0x33')]=_0x539c32[_0x1775('0x33')]['length']?_0x539c32[_0x1775('0x33')]:_0x5bcff9[_0x1775('0x2e')];if(!_0x2e45bc[_0x1775('0x2f')][_0x1775('0x35')]('nolimit')){_0x539c32['limit']=qs[_0x1775('0x36')](_0x2e45bc[_0x1775('0x2f')][_0x1775('0x36')]);_0x539c32[_0x1775('0x1e')]=qs[_0x1775('0x1e')](_0x2e45bc[_0x1775('0x2f')][_0x1775('0x1e')]);}_0x539c32[_0x1775('0x37')]=qs['sort'](_0x2e45bc[_0x1775('0x2f')][_0x1775('0x38')]);_0x539c32['where']=qs[_0x1775('0x31')](_[_0x1775('0x39')](_0x2e45bc[_0x1775('0x2f')],_0x5bcff9[_0x1775('0x31')]));if(_0x2e45bc[_0x1775('0x2f')][_0x1775('0x3a')]){_0x539c32[_0x1775('0x3b')]=_[_0x1775('0x3c')](_0x539c32[_0x1775('0x3b')],{'$or':_[_0x1775('0x29')](_0xc545a1,function(_0x36b8aa){if(_0x36b8aa[_0x1775('0x2c')]!=='VIRTUAL'){var _0x26a9be={};_0x26a9be[_0x36b8aa[_0x1775('0x27')]]={'$like':'%'+_0x2e45bc['query'][_0x1775('0x3a')]+'%'};return _0x26a9be;}})});}_0x539c32=_['merge']({},_0x539c32,_0x2e45bc[_0x1775('0x3d')]);var _0x14684f={'where':_0x539c32[_0x1775('0x3b')]};return db[_0x1775('0x2a')][_0x1775('0x1d')](_0x14684f)[_0x1775('0x24')](function(_0x275929){_0x40c9cc['count']=_0x275929;if(_0x2e45bc[_0x1775('0x2f')][_0x1775('0x3e')]){_0x539c32[_0x1775('0x3f')]=[{'all':!![]}];}return db['SmsApplication'][_0x1775('0x40')](_0x539c32);})[_0x1775('0x24')](function(_0x1a4433){_0x40c9cc[_0x1775('0x41')]=_0x1a4433;return _0x40c9cc;})[_0x1775('0x24')](respondWithFilteredResult(_0x56a4b3,_0x539c32))[_0x1775('0x42')](handleError(_0x56a4b3,null));};exports[_0x1775('0x43')]=function(_0x3501d1,_0x36fa04){var _0x3bd893={'raw':!![],'where':{'id':_0x3501d1[_0x1775('0x44')]['id']}},_0x190acc={};_0x190acc[_0x1775('0x2e')]=_[_0x1775('0x30')](db[_0x1775('0x2a')][_0x1775('0x2b')]);_0x190acc[_0x1775('0x2f')]=_['keys'](_0x3501d1['query']);_0x190acc[_0x1775('0x31')]=_[_0x1775('0x32')](_0x190acc[_0x1775('0x2e')],_0x190acc[_0x1775('0x2f')]);_0x3bd893[_0x1775('0x33')]=_['intersection'](_0x190acc[_0x1775('0x2e')],qs['fields'](_0x3501d1[_0x1775('0x2f')][_0x1775('0x34')]));_0x3bd893[_0x1775('0x33')]=_0x3bd893[_0x1775('0x33')][_0x1775('0x45')]?_0x3bd893[_0x1775('0x33')]:_0x190acc['model'];if(_0x3501d1[_0x1775('0x2f')][_0x1775('0x3e')]){_0x3bd893[_0x1775('0x3f')]=[{'all':!![]}];}_0x3bd893=_[_0x1775('0x3c')]({},_0x3bd893,_0x3501d1[_0x1775('0x3d')]);return db[_0x1775('0x2a')]['find'](_0x3bd893)[_0x1775('0x24')](handleEntityNotFound(_0x36fa04,null))[_0x1775('0x24')](respondWithResult(_0x36fa04,null))[_0x1775('0x42')](handleError(_0x36fa04,null));};exports['create']=function(_0x35266b,_0x529496){return db[_0x1775('0x2a')][_0x1775('0x46')](_0x35266b[_0x1775('0x47')],{})[_0x1775('0x24')](respondWithResult(_0x529496,0xc9))[_0x1775('0x42')](handleError(_0x529496,null));};exports['update']=function(_0x566ad9,_0x4da296){if(_0x566ad9[_0x1775('0x47')]['id']){delete _0x566ad9[_0x1775('0x47')]['id'];}return db[_0x1775('0x2a')][_0x1775('0x48')]({'where':{'id':_0x566ad9[_0x1775('0x44')]['id']}})[_0x1775('0x24')](handleEntityNotFound(_0x4da296,null))[_0x1775('0x24')](saveUpdates(_0x566ad9[_0x1775('0x47')],null))[_0x1775('0x24')](respondWithResult(_0x4da296,null))[_0x1775('0x42')](handleError(_0x4da296,null));};exports[_0x1775('0x23')]=function(_0x552e49,_0x1d639f){return db[_0x1775('0x2a')][_0x1775('0x48')]({'where':{'id':_0x552e49[_0x1775('0x44')]['id']}})[_0x1775('0x24')](handleEntityNotFound(_0x1d639f,null))['then'](removeEntity(_0x1d639f,null))[_0x1775('0x42')](handleError(_0x1d639f,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index be87296..7e14872 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 _0x1913=['sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsApplication.attributes','exports','define','SmsApplication'];(function(_0x1471d4,_0x12913d){var _0x14b18f=function(_0x5f5bca){while(--_0x5f5bca){_0x1471d4['push'](_0x1471d4['shift']());}};_0x14b18f(++_0x12913d);}(_0x1913,0x8a));var _0x3191=function(_0x4d07ef,_0x2f686d){_0x4d07ef=_0x4d07ef-0x0;var _0x13a823=_0x1913[_0x4d07ef];return _0x13a823;};'use strict';var _=require('lodash');var util=require(_0x3191('0x0'));var logger=require(_0x3191('0x1'))(_0x3191('0x2'));var moment=require(_0x3191('0x3'));var BPromise=require(_0x3191('0x4'));var rp=require(_0x3191('0x5'));var fs=require('fs');var path=require(_0x3191('0x6'));var rimraf=require(_0x3191('0x7'));var config=require('../../config/environment');var attributes=require(_0x3191('0x8'));module[_0x3191('0x9')]=function(_0x130894,_0x372b0a){return _0x130894[_0x3191('0xa')](_0x3191('0xb'),attributes,{'tableName':_0x3191('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3191('0xd'),'collate':_0x3191('0xe')});}; \ No newline at end of file +var _0xeeea=['exports','SmsApplication','sms_applications','utf8mb4_unicode_ci','../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsApplication.attributes'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xeeea,0x11c));var _0xaeee=function(_0xdf7d13,_0x231843){_0xdf7d13=_0xdf7d13-0x0;var _0x19c158=_0xeeea[_0xdf7d13];return _0x19c158;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaeee('0x0'))('api');var moment=require(_0xaeee('0x1'));var BPromise=require('bluebird');var rp=require(_0xaeee('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaeee('0x3'));var config=require(_0xaeee('0x4'));var attributes=require(_0xaeee('0x5'));module[_0xaeee('0x6')]=function(_0x43153f,_0x422826){return _0x43153f['define'](_0xaeee('0x7'),attributes,{'tableName':_0xaeee('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xaeee('0x9')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index a3a7f52..94092c7 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 _0x535f=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','SmsApplication,\x20%s,\x20%s','message','result','catch'];(function(_0x479188,_0x505a1c){var _0x466b0d=function(_0x57c2c8){while(--_0x57c2c8){_0x479188['push'](_0x479188['shift']());}};_0x466b0d(++_0x505a1c);}(_0x535f,0x111));var _0xf535=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x535f[_0x1f36bb];return _0xaf97fa;};'use strict';var _=require('lodash');var util=require(_0xf535('0x0'));var moment=require(_0xf535('0x1'));var BPromise=require('bluebird');var rs=require(_0xf535('0x2'));var fs=require('fs');var Redis=require(_0xf535('0x3'));var db=require(_0xf535('0x4'))['db'];var utils=require(_0xf535('0x5'));var logger=require('../../config/logger')(_0xf535('0x6'));var config=require(_0xf535('0x7'));var jayson=require(_0xf535('0x8'));var client=jayson[_0xf535('0x9')][_0xf535('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc74104,_0x580328,_0x510b86){return new BPromise(function(_0x17f72e,_0x156c64){return client[_0xf535('0xb')](_0xc74104,_0x510b86)['then'](function(_0x244189){logger[_0xf535('0xc')]('SmsApplication,\x20%s,\x20%s',_0x580328,'request\x20sent');logger[_0xf535('0xd')](_0xf535('0xe'),_0x580328,'request\x20sent',JSON['stringify'](_0x244189));if(_0x244189[_0xf535('0xf')]){if(_0x244189[_0xf535('0xf')][_0xf535('0x10')]===0x1f4){logger[_0xf535('0xf')](_0xf535('0x11'),_0x580328,_0x244189['error'][_0xf535('0x12')]);return _0x156c64(_0x244189[_0xf535('0xf')][_0xf535('0x12')]);}logger[_0xf535('0xf')](_0xf535('0x11'),_0x580328,_0x244189[_0xf535('0xf')][_0xf535('0x12')]);return _0x17f72e(_0x244189[_0xf535('0xf')][_0xf535('0x12')]);}else{logger[_0xf535('0xc')](_0xf535('0x11'),_0x580328,'request\x20sent');_0x17f72e(_0x244189[_0xf535('0x13')][_0xf535('0x12')]);}})[_0xf535('0x14')](function(_0x3ffb1b){logger[_0xf535('0xf')](_0xf535('0x11'),_0x580328,_0x3ffb1b);_0x156c64(_0x3ffb1b);});});} \ No newline at end of file +var _0xc99e=['SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4365c2,_0x37e7ee){var _0x428a34=function(_0x57687e){while(--_0x57687e){_0x4365c2['push'](_0x4365c2['shift']());}};_0x428a34(++_0x37e7ee);}(_0xc99e,0x6e));var _0xec99=function(_0x1fccc9,_0x4538ed){_0x1fccc9=_0x1fccc9-0x0;var _0x2c9b35=_0xc99e[_0x1fccc9];return _0x2c9b35;};'use strict';var _=require(_0xec99('0x0'));var util=require(_0xec99('0x1'));var moment=require(_0xec99('0x2'));var BPromise=require(_0xec99('0x3'));var rs=require(_0xec99('0x4'));var fs=require('fs');var Redis=require(_0xec99('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xec99('0x6'));var logger=require(_0xec99('0x7'))(_0xec99('0x8'));var config=require(_0xec99('0x9'));var jayson=require(_0xec99('0xa'));var client=jayson[_0xec99('0xb')][_0xec99('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x470d70,_0x558b08,_0x797806){return new BPromise(function(_0x425a61,_0x546391){return client[_0xec99('0xd')](_0x470d70,_0x797806)[_0xec99('0xe')](function(_0x47ecf6){logger['info'](_0xec99('0xf'),_0x558b08,_0xec99('0x10'));logger[_0xec99('0x11')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x558b08,_0xec99('0x10'),JSON[_0xec99('0x12')](_0x47ecf6));if(_0x47ecf6[_0xec99('0x13')]){if(_0x47ecf6[_0xec99('0x13')][_0xec99('0x14')]===0x1f4){logger[_0xec99('0x13')]('SmsApplication,\x20%s,\x20%s',_0x558b08,_0x47ecf6[_0xec99('0x13')]['message']);return _0x546391(_0x47ecf6[_0xec99('0x13')]['message']);}logger[_0xec99('0x13')]('SmsApplication,\x20%s,\x20%s',_0x558b08,_0x47ecf6['error'][_0xec99('0x15')]);return _0x425a61(_0x47ecf6['error'][_0xec99('0x15')]);}else{logger[_0xec99('0x16')](_0xec99('0xf'),_0x558b08,_0xec99('0x10'));_0x425a61(_0x47ecf6[_0xec99('0x17')][_0xec99('0x15')]);}})[_0xec99('0x18')](function(_0x4e03db){logger[_0xec99('0x13')](_0xec99('0xf'),_0x558b08,_0x4e03db);_0x546391(_0x4e03db);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index b40ce09..e27ac7a 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 _0xb36b=['tracked','sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','update','delete','smsinteraction:destroy','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','show','getMessages','/:id/download','post','create','addMessage','/:id/tags'];(function(_0x21fdfb,_0x57415d){var _0x2e72b2=function(_0x154e36){while(--_0x154e36){_0x21fdfb['push'](_0x21fdfb['shift']());}};_0x2e72b2(++_0x57415d);}(_0xb36b,0xac));var _0xbb36=function(_0x2331a8,_0x5b8ae1){_0x2331a8=_0x2331a8-0x0;var _0x59aa31=_0xb36b[_0x2331a8];return _0x59aa31;};'use strict';var multer=require(_0xbb36('0x0'));var util=require('util');var path=require(_0xbb36('0x1'));var timeout=require(_0xbb36('0x2'));var express=require(_0xbb36('0x3'));var router=express[_0xbb36('0x4')]();var auth=require(_0xbb36('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbb36('0x6'));var controller=require(_0xbb36('0x7'));router[_0xbb36('0x8')]('/',auth[_0xbb36('0x9')](),controller[_0xbb36('0xa')]);router[_0xbb36('0x8')](_0xbb36('0xb'),auth[_0xbb36('0x9')](),controller[_0xbb36('0xc')]);router[_0xbb36('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xbb36('0xd')]);router['get']('/:id/messages',auth[_0xbb36('0x9')](),controller[_0xbb36('0xe')]);router[_0xbb36('0x8')](_0xbb36('0xf'),auth[_0xbb36('0x9')](),controller['download']);router[_0xbb36('0x10')]('/',auth[_0xbb36('0x9')](),controller[_0xbb36('0x11')]);router[_0xbb36('0x10')]('/:id/messages',auth[_0xbb36('0x9')](),controller[_0xbb36('0x12')]);router[_0xbb36('0x10')](_0xbb36('0x13'),auth[_0xbb36('0x9')](),interaction[_0xbb36('0x14')](_0xbb36('0x15'),_0xbb36('0x16')),controller[_0xbb36('0x17')]);router[_0xbb36('0x18')](_0xbb36('0x19'),auth['isAuthenticated'](),interaction[_0xbb36('0x14')](_0xbb36('0x15'),_0xbb36('0x1a')),controller[_0xbb36('0x1b')]);router[_0xbb36('0x1c')](_0xbb36('0x19'),auth[_0xbb36('0x9')](),interaction[_0xbb36('0x14')](_0xbb36('0x15'),_0xbb36('0x1d')),controller['destroy']);router['delete'](_0xbb36('0x13'),auth[_0xbb36('0x9')](),controller[_0xbb36('0x1e')]);module[_0xbb36('0x1f')]=router; \ No newline at end of file +var _0xb4d9=['/describe','describe','getMessages','/:id/download','download','post','create','/:id/messages','/:id/tags','tracked','smsinteraction:addtags','/:id','sms','smsinteraction:update','update','smsinteraction:destroy','destroy','delete','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index'];(function(_0xc1a6af,_0x1d8b1d){var _0x2df048=function(_0x31d965){while(--_0x31d965){_0xc1a6af['push'](_0xc1a6af['shift']());}};_0x2df048(++_0x1d8b1d);}(_0xb4d9,0xce));var _0x9b4d=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xb4d9[_0x5f309e];return _0x487b5e;};'use strict';var multer=require(_0x9b4d('0x0'));var util=require(_0x9b4d('0x1'));var path=require('path');var timeout=require(_0x9b4d('0x2'));var express=require(_0x9b4d('0x3'));var router=express[_0x9b4d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9b4d('0x5'));var config=require(_0x9b4d('0x6'));var controller=require(_0x9b4d('0x7'));router[_0x9b4d('0x8')]('/',auth[_0x9b4d('0x9')](),controller[_0x9b4d('0xa')]);router[_0x9b4d('0x8')](_0x9b4d('0xb'),auth[_0x9b4d('0x9')](),controller[_0x9b4d('0xc')]);router[_0x9b4d('0x8')]('/:id',auth[_0x9b4d('0x9')](),controller['show']);router[_0x9b4d('0x8')]('/:id/messages',auth[_0x9b4d('0x9')](),controller[_0x9b4d('0xd')]);router[_0x9b4d('0x8')](_0x9b4d('0xe'),auth[_0x9b4d('0x9')](),controller[_0x9b4d('0xf')]);router[_0x9b4d('0x10')]('/',auth[_0x9b4d('0x9')](),controller[_0x9b4d('0x11')]);router[_0x9b4d('0x10')](_0x9b4d('0x12'),auth[_0x9b4d('0x9')](),controller['addMessage']);router[_0x9b4d('0x10')](_0x9b4d('0x13'),auth[_0x9b4d('0x9')](),interaction[_0x9b4d('0x14')]('sms',_0x9b4d('0x15')),controller['addTags']);router['put'](_0x9b4d('0x16'),auth[_0x9b4d('0x9')](),interaction[_0x9b4d('0x14')](_0x9b4d('0x17'),_0x9b4d('0x18')),controller[_0x9b4d('0x19')]);router['delete']('/:id',auth[_0x9b4d('0x9')](),interaction[_0x9b4d('0x14')](_0x9b4d('0x17'),_0x9b4d('0x1a')),controller[_0x9b4d('0x1b')]);router[_0x9b4d('0x1c')](_0x9b4d('0x13'),auth[_0x9b4d('0x9')](),controller[_0x9b4d('0x1d')]);module[_0x9b4d('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index d495a41..0dc5b97 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 _0xb7e7=['out','sequelize','exports','DATE','STRING','ENUM'];(function(_0x56746f,_0x4c963f){var _0x332f23=function(_0x361b7a){while(--_0x361b7a){_0x56746f['push'](_0x56746f['shift']());}};_0x332f23(++_0x4c963f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xb7e7[_0x1beef3];return _0x5af964;};'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 +var _0xd8b0=['moment','STRING','DATE','ENUM','out','sequelize'];(function(_0x152ca2,_0x5abd1b){var _0x58fbd2=function(_0x128b08){while(--_0x128b08){_0x152ca2['push'](_0x152ca2['shift']());}};_0x58fbd2(++_0x5abd1b);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0d8b('0x2')]},'note':{'type':Sequelize[_0x0d8b('0x2')]},'phone':{'type':Sequelize[_0x0d8b('0x2')]},'read1stAt':{'type':Sequelize[_0x0d8b('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0d8b('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x0d8b('0x4')]('in',_0x0d8b('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 294ba9f..3c493d1 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 _0x4bd3=['t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','having','`\x20>\x200','Contact','$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','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','some','compact','isEmpty','concat','createdAt','$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.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)','unreadMessages','order','DESC','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','i.SmsAccountId\x20IN\x20?','sequelize','toString','keyBy','SmsInteraction','attributes','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','all','rows','catch','params','includeAll','include','merge','options','create','body','describe','addMessage','SmsMessage','ids','omit','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','Messages','secret','SmsAccount','Account','Owner','get','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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.','closed','disposition','direction','out','lastName','renderFile','views','downloadInteraction.html','toFile','transcript-','log','err','unlinkSync','html-pdf','rimraf','zip-dir','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','end','stack','name','send','Users','fullname','TagIds','split','forEach','push','then','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','select','field','color','from','tools_tags','u.id','u.fullname','users','sms_interactions','left_join','o.id\x20=\x20i.UserId','sms_accounts','it.SmsInteractionId\x20=\x20i.id'];(function(_0x434903,_0x2bae84){var _0x31021e=function(_0x176a5f){while(--_0x176a5f){_0x434903['push'](_0x434903['shift']());}};_0x31021e(++_0x2bae84);}(_0x4bd3,0x174));var _0x34bd=function(_0x36612f,_0x3fc55a){_0x36612f=_0x36612f-0x0;var _0x2a58f1=_0x4bd3[_0x36612f];return _0x2a58f1;};'use strict';var pdf=require(_0x34bd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x34bd('0x1'));var zipdir=require(_0x34bd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x34bd('0x3'));var Mustache=require(_0x34bd('0x4'));var util=require(_0x34bd('0x5'));var path=require('path');var sox=require(_0x34bd('0x6'));var csv=require(_0x34bd('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x34bd('0x8'));var squel=require(_0x34bd('0x9'));var crypto=require('crypto');var jsforce=require(_0x34bd('0xa'));var deskjs=require(_0x34bd('0xb'));var toCsv=require(_0x34bd('0x7'));var querystring=require(_0x34bd('0xc'));var Papa=require(_0x34bd('0xd'));var Redis=require(_0x34bd('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x34bd('0xf'));var as=require(_0x34bd('0x10'));var hardwareService=require(_0x34bd('0x11'));var logger=require(_0x34bd('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x34bd('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x34bd('0x14')](config[_0x34bd('0x15')],{'host':_0x34bd('0x16'),'port':0x18eb});var socket=require(_0x34bd('0x17'))(new Redis(config[_0x34bd('0x15')]));require(_0x34bd('0x18'))[_0x34bd('0x19')](socket);function respondWithStatusCode(_0x236f6b,_0xf6d2f2){_0xf6d2f2=_0xf6d2f2||0xcc;return function(_0x59ed5d){if(_0x59ed5d){return _0x236f6b[_0x34bd('0x1a')](_0xf6d2f2);}return _0x236f6b['status'](_0xf6d2f2)['end']();};}function respondWithResult(_0x6638ed,_0x30b3f2){_0x30b3f2=_0x30b3f2||0xc8;return function(_0x280c1a){if(_0x280c1a){return _0x6638ed[_0x34bd('0x1b')](_0x30b3f2)[_0x34bd('0x1c')](_0x280c1a);}};}function respondWithFilteredResult(_0x1643af,_0xd39d72){return function(_0x1c12e8){if(_0x1c12e8){var _0x3b4bf8=_0x1c12e8[_0x34bd('0x1d')],_0x72b197=_0xd39d72[_0x34bd('0x1e')],_0x4b5ebb=_0xd39d72[_0x34bd('0x1e')]+_0xd39d72[_0x34bd('0x1f')],_0x48d2ba;if(_0x4b5ebb>=_0x3b4bf8){_0x4b5ebb=_0x3b4bf8;_0x48d2ba=0xc8;}else{_0x48d2ba=0xce;}_0x1643af[_0x34bd('0x1b')](_0x48d2ba);return _0x1643af[_0x34bd('0x20')](_0x34bd('0x21'),_0x72b197+'-'+_0x4b5ebb+'/'+_0x3b4bf8)[_0x34bd('0x1c')](_0x1c12e8);}return null;};}function patchUpdates(_0x130bd0){return function(_0x55538e){try{jsonpatch[_0x34bd('0x22')](_0x55538e,_0x130bd0,!![]);}catch(_0xe02cc5){return BPromise[_0x34bd('0x23')](_0xe02cc5);}return _0x55538e[_0x34bd('0x24')]();};}function saveUpdates(_0x463224,_0x5e0c06){return function(_0x582772){if(_0x582772){return _0x582772['update'](_0x463224)['then'](function(_0x3dafe8){return _0x3dafe8;});}return null;};}function removeEntity(_0x503a60,_0x10fc4b){return function(_0x1c2282){if(_0x1c2282){return _0x1c2282[_0x34bd('0x25')]()['then'](function(){_0x503a60[_0x34bd('0x1b')](0xcc)[_0x34bd('0x26')]();});}};}function handleEntityNotFound(_0x4f0dff,_0x457006){return function(_0x5be702){if(!_0x5be702){_0x4f0dff[_0x34bd('0x1a')](0x194);}return _0x5be702;};}function handleError(_0xb256e8,_0x264c94){_0x264c94=_0x264c94||0x1f4;return function(_0x3e4dc3){logger['error'](_0x3e4dc3[_0x34bd('0x27')]);if(_0x3e4dc3[_0x34bd('0x28')]){delete _0x3e4dc3['name'];}_0xb256e8[_0x34bd('0x1b')](_0x264c94)[_0x34bd('0x29')](_0x3e4dc3);};}function getInteractionUsers(_0x16581f,_0x3f675c){return new BPromise(function(_0x26b8e7,_0x4500c8){try{if(_0x3f675c[_0x16581f['id']]){_0x16581f[_0x34bd('0x2a')]=_['map'](_0x3f675c[_0x16581f['id']],function(_0x43b92d){return{'id':_0x43b92d['id'],'fullname':_0x43b92d[_0x34bd('0x2b')]};});}}catch(_0x56d3b9){_0x4500c8(_0x56d3b9);}_0x26b8e7(_0x16581f);});}function getInteractionTags(_0x5d1662,_0x38bdba){return new BPromise(function(_0xca9897,_0xd176f7){try{if(_0x5d1662['TagIds']){_0x5d1662['Tags']=[];_0x5d1662[_0x34bd('0x2c')][_0x34bd('0x2d')](',')[_0x34bd('0x2e')](function(_0x19eb5d){_0x5d1662['Tags'][_0x34bd('0x2f')](_0x38bdba[_0x19eb5d]);});}delete _0x5d1662[_0x34bd('0x2c')];}catch(_0x41ca58){_0xd176f7(_0x41ca58);}_0xca9897(_0x5d1662);});}function updateSmsInteraction(_0x17296b,_0x2ef58f,_0x375cc7){return new BPromise(function(_0x4ae886,_0x72bb10){return getInteractionUsers(_0x17296b,_0x375cc7)['then'](function(_0xadfa97){return getInteractionTags(_0xadfa97,_0x2ef58f);})[_0x34bd('0x30')](function(_0xf12ee6){_0x4ae886(_0xf12ee6);})['catch'](function(_0x2ff72e){_0x72bb10(_0x2ff72e);});});}exports[_0x34bd('0x31')]=function(_0x497774,_0x3c5e1d){var _0x21c7d6={},_0x2b81ca={},_0x4d0a02={'count':0x0,'rows':[]};var _0x1574c8=_[_0x34bd('0x32')](db['SmsInteraction'][_0x34bd('0x33')],function(_0x41c377){return{'name':_0x41c377[_0x34bd('0x34')],'type':_0x41c377[_0x34bd('0x35')][_0x34bd('0x36')]};});_0x2b81ca[_0x34bd('0x37')]=_['map'](_0x1574c8,'name');_0x2b81ca['query']=_[_0x34bd('0x38')](_0x497774[_0x34bd('0x39')]);_0x2b81ca['filters']=_['intersection'](_0x2b81ca[_0x34bd('0x37')],_0x2b81ca['query']);_0x21c7d6['attributes']=_[_0x34bd('0x3a')](_0x2b81ca[_0x34bd('0x37')],qs[_0x34bd('0x3b')](_0x497774[_0x34bd('0x39')][_0x34bd('0x3b')]));_0x21c7d6['attributes']=_0x21c7d6['attributes'][_0x34bd('0x3c')]?_0x21c7d6['attributes']:_0x2b81ca[_0x34bd('0x37')];if(!_0x497774[_0x34bd('0x39')][_0x34bd('0x3d')](_0x34bd('0x3e'))){_0x21c7d6[_0x34bd('0x1f')]=qs['limit'](_0x497774[_0x34bd('0x39')][_0x34bd('0x1f')]);_0x21c7d6[_0x34bd('0x1e')]=qs[_0x34bd('0x1e')](_0x497774['query'][_0x34bd('0x1e')]);}_0x21c7d6['order']=qs[_0x34bd('0x3f')](_0x497774[_0x34bd('0x39')]['sort']);_0x21c7d6[_0x34bd('0x40')]=qs['filters'](_[_0x34bd('0x41')](_0x497774[_0x34bd('0x39')],_0x2b81ca[_0x34bd('0x42')]));var _0x42a424=[];var _0x26d73e=squel[_0x34bd('0x43')]()[_0x34bd('0x44')]('id')['field']('name')['field'](_0x34bd('0x45'))[_0x34bd('0x46')](_0x34bd('0x47'));var _0x787f74=squel['select']()[_0x34bd('0x44')](_0x34bd('0x48'))[_0x34bd('0x44')](_0x34bd('0x49'))[_0x34bd('0x44')]('ui.SmsInteractionId')[_0x34bd('0x46')]('user_has_sms_interactions','ui')['left_join'](_0x34bd('0x4a'),'u','u.id\x20=\x20ui.UserId');var _0x8474fb=squel[_0x34bd('0x43')]()[_0x34bd('0x46')](_0x34bd('0x4b'),'i')[_0x34bd('0x4c')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x34bd('0x4c')]('users','o',_0x34bd('0x4d'))[_0x34bd('0x4c')](_0x34bd('0x4e'),'a','a.id\x20=\x20i.SmsAccountId')['left_join']('sms_messages','me','me.SmsInteractionId\x20=\x20i.id')[_0x34bd('0x4c')]('sms_interaction_has_tags','it',_0x34bd('0x4f'))['left_join'](_0x34bd('0x47'),'t',_0x34bd('0x50'));var _0x1fa341=squel[_0x34bd('0x51')]();var _0x2da5c5=[];var _0x5273b1=squel[_0x34bd('0x51')]();var _0x162229;if(_0x497774[_0x34bd('0x39')][_0x34bd('0x52')]){_0x162229=as[_0x34bd('0x53')](_0x497774['query'][_0x34bd('0x52')]);var _0x3bfd9d=_0x162229['sqlOperator'];for(var _0x1fc735=0x0;_0x1fc735<_0x162229[_0x34bd('0x54')]['length'];_0x1fc735++){var _0x561d77=_0x162229[_0x34bd('0x54')][_0x1fc735];var _0x4e9d52='i';var _0x499642=_[_0x34bd('0x55')](_0x1574c8,[_0x34bd('0x28'),_0x561d77['field']]);if(!_0x499642){switch(_0x561d77['field']){case'unreadMessages':if(_0x561d77['value']==0x1){_0x8474fb[_0x34bd('0x56')]('`'+_0x561d77[_0x34bd('0x44')]+'`\x20=\x200');}else{_0x8474fb['having']('`'+_0x561d77['field']+_0x34bd('0x57'));}break;case _0x34bd('0x58'):if(_0x561d77['operator']===_0x34bd('0x59')){if(_0x561d77[_0x34bd('0x5a')][_0x34bd('0x2d')]('\x20')[_0x34bd('0x3c')]>0x1){_0x1fa341[_0x3bfd9d](_0x34bd('0x5b'),qs[_0x34bd('0x5c')](_0x561d77['value']),null);}else{var _0x3241e1='%'+_0x561d77[_0x34bd('0x5a')]+'%';_0x1fa341[_0x3bfd9d](_0x34bd('0x5d'),_0x3241e1,_0x3241e1,_0x3241e1);}}else{_0x499642=_[_0x34bd('0x55')](_0x1574c8,['name',_0x34bd('0x5e')]);_0x561d77['field']=_0x34bd('0x5e');_0x5d4833=as['buildExpression'](_0x4e9d52,_0x499642[_0x34bd('0x35')],_0x561d77);_0x1fa341[_0x3bfd9d](_0x5d4833[_0x34bd('0x5f')],_0x5d4833[_0x34bd('0x5a')][_0x34bd('0x60')],_0x5d4833[_0x34bd('0x5a')][_0x34bd('0x26')]);}break;case _0x34bd('0x61'):var _0x28394c=_0x561d77[_0x34bd('0x5a')][_0x34bd('0x2d')](',')[_0x34bd('0x32')](function(_0x5ddb03){return Number(_0x5ddb03);});_0x28394c[_0x34bd('0x2e')](function(_0x55f72e){_0x5273b1['or'](_0x34bd('0x62'),'%,'+_0x55f72e+',%');});_0x2da5c5=_['union'](_0x2da5c5,_0x28394c);break;case _0x34bd('0x63'):if(_0x561d77['operator']===_0x34bd('0x59')){_0x1fa341[_0x3bfd9d](_0x34bd('0x64'),'%'+_0x561d77[_0x34bd('0x5a')]+'%',null);}else{_0x499642=_[_0x34bd('0x55')](_0x1574c8,[_0x34bd('0x28'),_0x34bd('0x65')]);_0x561d77[_0x34bd('0x44')]=_0x34bd('0x65');_0x5d4833=as[_0x34bd('0x66')](_0x4e9d52,_0x499642[_0x34bd('0x35')],_0x561d77);_0x1fa341[_0x3bfd9d](_0x5d4833[_0x34bd('0x5f')],_0x5d4833[_0x34bd('0x5a')][_0x34bd('0x60')],_0x5d4833[_0x34bd('0x5a')][_0x34bd('0x26')]);}break;case'body':_0x5d4833=as['buildExpression']('me',null,_0x561d77);_0x1fa341[_0x3bfd9d](_0x5d4833[_0x34bd('0x5f')],_0x5d4833[_0x34bd('0x5a')][_0x34bd('0x60')],_0x5d4833[_0x34bd('0x5a')][_0x34bd('0x26')]);break;}}else{var _0x5d4833=as['buildExpression'](_0x4e9d52,_0x499642['type'],_0x561d77);_0x1fa341[_0x3bfd9d](_0x5d4833['text'],_0x5d4833[_0x34bd('0x5a')][_0x34bd('0x60')],_0x5d4833['value'][_0x34bd('0x26')]);}}}else{var _0xfa0814=_(_0x497774[_0x34bd('0x39')])['keys']()[_0x34bd('0x32')](function(_0x341273){return _[_0x34bd('0x67')](_0x1574c8,[_0x34bd('0x28'),_0x341273])?_0x341273:undefined;})[_0x34bd('0x68')]()[_0x34bd('0x5a')]();if(!_[_0x34bd('0x69')](_0xfa0814)){_0xfa0814[_0x34bd('0x2e')](function(_0x57fc2b){if(_0x57fc2b==='SmsAccountId'){_0x8474fb[_0x34bd('0x40')]('i.SmsAccountId\x20IN\x20?',[][_0x34bd('0x6a')](_0x497774[_0x34bd('0x39')][_0x57fc2b]));}else if(_0x57fc2b===_0x34bd('0x6b')){var _0x58a6eb=JSON['parse'](_0x497774[_0x34bd('0x39')][_0x57fc2b])[_0x34bd('0x6c')];var _0x3c2e61=JSON['parse'](_0x497774['query'][_0x57fc2b])[_0x34bd('0x6d')];_0x8474fb[_0x34bd('0x40')](_0x34bd('0x6e'),_0x58a6eb,_0x3c2e61);}else{if(_0x497774[_0x34bd('0x39')][_0x57fc2b]===_0x34bd('0x6f')){_0x8474fb[_0x34bd('0x40')]('i.'+_0x57fc2b+_0x34bd('0x70'));}else{_0x8474fb[_0x34bd('0x40')]('i.'+_0x57fc2b+_0x34bd('0x71'),_0x497774['query'][_0x57fc2b]);}}});}if(_0x497774['query'][_0x34bd('0x72')]){if(_0x497774['query'][_0x34bd('0x72')]==0x1){_0x8474fb[_0x34bd('0x56')](_0x34bd('0x73'));}else{_0x8474fb[_0x34bd('0x56')]('`unreadMessages`\x20>\x200');}}if(_0x497774['query'][_0x34bd('0x74')]){_0x2da5c5=_[_0x34bd('0x75')](_0x497774[_0x34bd('0x39')]['tag'])?_0x497774[_0x34bd('0x39')]['tag']:new Array(_0x497774[_0x34bd('0x39')][_0x34bd('0x74')]);_0x2da5c5[_0x34bd('0x2e')](function(_0x55876d){_0x5273b1['or'](_0x34bd('0x62'),'%,'+_0x55876d+',%');});}if(_0x497774['query']['filter']){var _0x3cf4c3=_0x497774[_0x34bd('0x39')][_0x34bd('0x76')]['replace']('\x5c','\x5c\x5c')[_0x34bd('0x77')]('\x27\x27',_0x34bd('0x78'));if(qs[_0x34bd('0x79')](_0x3cf4c3)){_0x1fa341['or']('i.id\x20LIKE\x20?',_0x3cf4c3+'%')['or'](_0x34bd('0x7a'),_0x3cf4c3+'%');}else{_0x1fa341['or'](_0x34bd('0x7b'),qs[_0x34bd('0x5c')](_0x3cf4c3))['or'](_0x34bd('0x7c'),_0x3cf4c3+'%');}}}_0x8474fb[_0x34bd('0x40')](_0x1fa341);_0x8474fb[_0x34bd('0x7d')](_0x34bd('0x7e'));var _0x2297f6={'type':db[_0x34bd('0x7f')][_0x34bd('0x80')][_0x34bd('0x81')],'raw':!![]};var _0x59e377=_0x8474fb[_0x34bd('0x82')]();_0x59e377['field'](_0x34bd('0x7e'));_0x59e377['field'](_0x34bd('0x83'),_0x34bd('0x84'));if(_0x21c7d6[_0x34bd('0x85')]){_0x21c7d6[_0x34bd('0x85')][_0x34bd('0x2e')](function(_0x4556ce){_0x8474fb[_0x34bd('0x85')]('i.'+_0x4556ce[0x0],_0x4556ce[0x1]===_0x34bd('0x86')?![]:!![]);});}if(!_[_0x34bd('0x69')](_0x2da5c5)){_0x8474fb[_0x34bd('0x56')](_0x5273b1);_0x59e377['where']('t.id\x20IN\x20?',_0x2da5c5);}BPromise[_0x34bd('0x87')]()[_0x34bd('0x30')](function(){if(!_0x162229){if(_0x497774[_0x34bd('0x39')]['SmsAccountId']||_0x497774['query']['journey'])return;_0x59e377[_0x34bd('0x40')](_0x34bd('0x88'));_0x8474fb[_0x34bd('0x40')](_0x34bd('0x88'));return;}return _0x497774[_0x34bd('0x89')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x34bd('0x30')](function(_0x4d94d0){if(_[_0x34bd('0x69')](_0x4d94d0)){_0x59e377[_0x34bd('0x40')]('i.SmsAccountId\x20IS\x20NULL');_0x8474fb[_0x34bd('0x40')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x59e377[_0x34bd('0x40')]('i.SmsAccountId\x20IN\x20?',_[_0x34bd('0x32')](_0x4d94d0,'id'));_0x8474fb['where'](_0x34bd('0x8a'),_[_0x34bd('0x32')](_0x4d94d0,'id'));}});})[_0x34bd('0x30')](function(){db[_0x34bd('0x8b')][_0x34bd('0x39')](_0x59e377[_0x34bd('0x8c')](),_0x2297f6)[_0x34bd('0x30')](function(_0x24a745){_0x4d0a02['count']=_0x24a745[_0x34bd('0x3c')];if(_0x4d0a02[_0x34bd('0x1d')]===0x0)return[];return db[_0x34bd('0x8b')]['query'](_0x26d73e['toString'](),_0x2297f6)['then'](function(_0x2f1299){_0x42a424=_[_0x34bd('0x8d')](_0x2f1299,'id');_0x2297f6=_['merge'](_0x2297f6,{'model':db[_0x34bd('0x8e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x497774['query'][_0x34bd('0x3b')]){_0x21c7d6[_0x34bd('0x8f')][_0x34bd('0x2e')](function(_0x4c6508){_0x8474fb[_0x34bd('0x44')]('i.'+_0x4c6508);});}else{_0x8474fb['field'](_0x34bd('0x83'),_0x34bd('0x84'));_0x8474fb[_0x34bd('0x44')](_0x34bd('0x90'),_0x34bd('0x91'));_0x8474fb[_0x34bd('0x44')](_0x34bd('0x92'),_0x34bd('0x93'));_0x8474fb[_0x34bd('0x44')](_0x34bd('0x94'));_0x8474fb[_0x34bd('0x44')](_0x34bd('0x95'),_0x34bd('0x96'));_0x8474fb[_0x34bd('0x44')]('c.lastName',_0x34bd('0x97'));_0x8474fb[_0x34bd('0x44')](_0x34bd('0x98'),_0x34bd('0x99'));_0x8474fb[_0x34bd('0x44')]('c.phone',_0x34bd('0x9a'));_0x8474fb[_0x34bd('0x44')](_0x34bd('0x9b'),_0x34bd('0x9c'));_0x8474fb['field'](_0x34bd('0x9d'),'Contact.fax');_0x8474fb['field']('o.fullname','Owner.fullname');_0x8474fb[_0x34bd('0x44')](_0x34bd('0x9e'),_0x34bd('0x9f'));_0x8474fb['field'](_0x34bd('0xa0'),_0x34bd('0x2c'));}_0x8474fb[_0x34bd('0x1f')](_0x21c7d6[_0x34bd('0x1f')]);_0x8474fb[_0x34bd('0x1e')](_0x21c7d6[_0x34bd('0x1e')]);return db[_0x34bd('0x8b')][_0x34bd('0x39')](_0x8474fb[_0x34bd('0x8c')](),_0x2297f6);})[_0x34bd('0x30')](function(_0x4451ef){_0x787f74['where']('ui.SmsInteractionId\x20IN\x20?',_[_0x34bd('0x32')](_0x4451ef,'id'));return db['sequelize'][_0x34bd('0x39')](_0x787f74[_0x34bd('0x8c')](),_0x2297f6)[_0x34bd('0x30')](function(_0x9f4df7){var _0x22aa49=_[_0x34bd('0xa1')](_0x9f4df7,_0x34bd('0xa2'));var _0xf45fee=[];_0x4451ef['forEach'](function(_0x8d35a9){_0xf45fee[_0x34bd('0x2f')](updateSmsInteraction(_0x8d35a9,_0x42a424,_0x22aa49));});return BPromise[_0x34bd('0xa3')](_0xf45fee);});});})['then'](function(_0x2b56eb){_0x4d0a02[_0x34bd('0xa4')]=_0x2b56eb;return _0x4d0a02;})[_0x34bd('0x30')](respondWithFilteredResult(_0x3c5e1d,_0x21c7d6));})[_0x34bd('0xa5')](handleError(_0x3c5e1d,null));};exports['show']=function(_0x429609,_0x3fe460){var _0x246fb3={'raw':![],'where':{'id':_0x429609[_0x34bd('0xa6')]['id']}},_0x5f2e77={};_0x5f2e77[_0x34bd('0x37')]=_[_0x34bd('0x38')](db[_0x34bd('0x8e')][_0x34bd('0x33')]);_0x5f2e77[_0x34bd('0x39')]=_['keys'](_0x429609[_0x34bd('0x39')]);_0x5f2e77[_0x34bd('0x42')]=_[_0x34bd('0x3a')](_0x5f2e77[_0x34bd('0x37')],_0x5f2e77[_0x34bd('0x39')]);_0x246fb3[_0x34bd('0x8f')]=_[_0x34bd('0x3a')](_0x5f2e77[_0x34bd('0x37')],qs[_0x34bd('0x3b')](_0x429609[_0x34bd('0x39')][_0x34bd('0x3b')]));_0x246fb3[_0x34bd('0x8f')]=_0x246fb3[_0x34bd('0x8f')][_0x34bd('0x3c')]?_0x246fb3['attributes']:_0x5f2e77[_0x34bd('0x37')];if(_0x429609['query'][_0x34bd('0xa7')]){_0x246fb3[_0x34bd('0xa8')]=[{'all':!![]}];}_0x246fb3=_[_0x34bd('0xa9')]({},_0x246fb3,_0x429609[_0x34bd('0xaa')]);return db[_0x34bd('0x8e')][_0x34bd('0x55')](_0x246fb3)[_0x34bd('0x30')](handleEntityNotFound(_0x3fe460,null))[_0x34bd('0x30')](respondWithResult(_0x3fe460,null))['catch'](handleError(_0x3fe460,null));};exports[_0x34bd('0xab')]=function(_0x10463f,_0x3efd93){return db['SmsInteraction'][_0x34bd('0xab')](_0x10463f[_0x34bd('0xac')],{})[_0x34bd('0x30')](respondWithResult(_0x3efd93,0xc9))[_0x34bd('0xa5')](handleError(_0x3efd93,null));};exports['update']=function(_0xa2e88f,_0x48acaa){if(_0xa2e88f[_0x34bd('0xac')]['id']){delete _0xa2e88f[_0x34bd('0xac')]['id'];}return db[_0x34bd('0x8e')]['find']({'where':{'id':_0xa2e88f[_0x34bd('0xa6')]['id']}})['then'](handleEntityNotFound(_0x48acaa,null))['then'](saveUpdates(_0xa2e88f[_0x34bd('0xac')],null))[_0x34bd('0x30')](respondWithResult(_0x48acaa,null))[_0x34bd('0xa5')](handleError(_0x48acaa,null));};exports['destroy']=function(_0x20cc16,_0x5cea3e){return db[_0x34bd('0x8e')][_0x34bd('0x55')]({'where':{'id':_0x20cc16['params']['id']}})['then'](handleEntityNotFound(_0x5cea3e,null))['then'](removeEntity(_0x5cea3e,null))[_0x34bd('0xa5')](handleError(_0x5cea3e,null));};exports[_0x34bd('0xad')]=function(_0x563e11,_0x476c1f){return db['SmsInteraction'][_0x34bd('0xad')]()[_0x34bd('0x30')](respondWithResult(_0x476c1f,null))[_0x34bd('0xa5')](handleError(_0x476c1f,null));};exports[_0x34bd('0xae')]=function(_0x3045c7,_0x459be1,_0x239e74){return db[_0x34bd('0xaf')]['find']({'where':{'id':_0x3045c7[_0x34bd('0xa6')]['id']}})[_0x34bd('0x30')](handleEntityNotFound(_0x459be1,null))[_0x34bd('0x30')](function(_0x2e9d66){if(_0x2e9d66){return _0x2e9d66[_0x34bd('0xae')](_0x3045c7[_0x34bd('0xac')][_0x34bd('0xb0')],_[_0x34bd('0xb1')](_0x3045c7[_0x34bd('0xac')],[_0x34bd('0xb0'),'id'])||{});}})['then'](respondWithResult(_0x459be1,null))[_0x34bd('0xa5')](handleError(_0x459be1,null));};exports['getMessages']=function(_0x53deea,_0x36eb45,_0x4490b3){var _0x1b8318={'raw':![],'where':{}};var _0x19671c={};var _0x49c4e6={'count':0x0,'rows':[]};return db[_0x34bd('0x8e')][_0x34bd('0xb2')]({'where':{'id':_0x53deea[_0x34bd('0xa6')]['id']}})[_0x34bd('0x30')](handleEntityNotFound(_0x36eb45,null))['then'](function(_0x5d0e56){if(_0x5d0e56){_0x19671c[_0x34bd('0x37')]=_[_0x34bd('0x38')](db['SmsMessage'][_0x34bd('0x33')]);_0x19671c[_0x34bd('0x39')]=_['keys'](_0x53deea[_0x34bd('0x39')]);_0x19671c[_0x34bd('0x42')]=_[_0x34bd('0x3a')](_0x19671c[_0x34bd('0x37')],_0x19671c[_0x34bd('0x39')]);_0x1b8318[_0x34bd('0x8f')]=_[_0x34bd('0x3a')](_0x19671c[_0x34bd('0x37')],qs['fields'](_0x53deea['query'][_0x34bd('0x3b')]));_0x1b8318[_0x34bd('0x8f')]=_0x1b8318[_0x34bd('0x8f')][_0x34bd('0x3c')]?_0x1b8318[_0x34bd('0x8f')]:_0x19671c['model'];if(!_0x53deea[_0x34bd('0x39')]['hasOwnProperty'](_0x34bd('0x3e'))){_0x1b8318[_0x34bd('0x1f')]=qs[_0x34bd('0x1f')](_0x53deea[_0x34bd('0x39')][_0x34bd('0x1f')]);_0x1b8318[_0x34bd('0x1e')]=qs['offset'](_0x53deea['query'][_0x34bd('0x1e')]);}_0x1b8318[_0x34bd('0x85')]=qs[_0x34bd('0x3f')](_0x53deea[_0x34bd('0x39')]['sort']);_0x1b8318[_0x34bd('0x40')]=qs[_0x34bd('0x42')](_[_0x34bd('0x41')](_0x53deea[_0x34bd('0x39')],_0x19671c[_0x34bd('0x42')]));_0x1b8318[_0x34bd('0x40')][_0x34bd('0xa2')]=_0x5d0e56['id'];if(_0x53deea['query']['filter']){_0x1b8318[_0x34bd('0x40')]=_['merge'](_0x1b8318[_0x34bd('0x40')],{'$or':_[_0x34bd('0x32')](_0x1b8318['attributes'],function(_0x25e21d){var _0xf55e5f={};_0xf55e5f[_0x25e21d]={'$like':'%'+_0x53deea['query'][_0x34bd('0x76')]+'%'};return _0xf55e5f;})});}if(_0x53deea[_0x34bd('0x39')]['$gte']){var _0x5b76a8=_0x53deea[_0x34bd('0x39')]['$gte'][_0x34bd('0x2d')](',');var _0x7a7cc7={};_0x7a7cc7[_0x5b76a8[0x0]]={'$gte':moment(_0x5b76a8[0x1])[_0x34bd('0xb3')](_0x34bd('0xb4'))};_0x1b8318[_0x34bd('0x40')]=_[_0x34bd('0xa9')](_0x1b8318[_0x34bd('0x40')],_0x7a7cc7);}_0x1b8318=_[_0x34bd('0xa9')]({},_0x1b8318,_0x53deea[_0x34bd('0xaa')]);return db[_0x34bd('0xaf')]['count']({'where':_0x1b8318[_0x34bd('0x40')]})[_0x34bd('0x30')](function(_0x47d136){_0x49c4e6[_0x34bd('0x1d')]=_0x47d136;if(_0x53deea[_0x34bd('0x39')][_0x34bd('0xa7')]){_0x1b8318['include']=[{'all':!![]}];}return db[_0x34bd('0xaf')][_0x34bd('0xb5')](_0x1b8318);})['then'](function(_0x5dedd4){_0x49c4e6[_0x34bd('0xa4')]=_0x5dedd4;return _0x49c4e6;});}})[_0x34bd('0x30')](respondWithFilteredResult(_0x36eb45,_0x1b8318))[_0x34bd('0xa5')](handleError(_0x36eb45,null));};exports['addTags']=function(_0x3d0ade,_0x43cf22,_0x1d7da8){return db[_0x34bd('0x8e')][_0x34bd('0x55')]({'where':{'id':_0x3d0ade['params']['id']}})['then'](handleEntityNotFound(_0x43cf22,null))[_0x34bd('0x30')](function(_0x2ac369){if(_0x2ac369){return _0x2ac369[_0x34bd('0xb6')](_0x3d0ade[_0x34bd('0xac')][_0x34bd('0xb0')],_['omit'](_0x3d0ade['body'],[_0x34bd('0xb0'),'id'])||{})[_0x34bd('0xb7')](function(){return db[_0x34bd('0x61')][_0x34bd('0xb5')]({'attributes':['id',_0x34bd('0x28'),_0x34bd('0x45')],'where':{'id':_0x3d0ade[_0x34bd('0xac')][_0x34bd('0xb0')]}});})[_0x34bd('0x30')](function(_0x5eec5b){socket[_0x34bd('0xb8')](_0x34bd('0xb9'),{'id':Number(_0x3d0ade['params']['id']),'tags':_0x5eec5b||[]});return{'id':Number(_0x3d0ade[_0x34bd('0xa6')]['id']),'tags':_0x5eec5b||[]};});}})[_0x34bd('0x30')](respondWithResult(_0x43cf22,null))[_0x34bd('0xa5')](handleError(_0x43cf22,null));};exports[_0x34bd('0xba')]=function(_0x4f9b3e,_0x3c40f2,_0x223165){return db['SmsInteraction'][_0x34bd('0x55')]({'where':{'id':_0x4f9b3e['params']['id']}})[_0x34bd('0x30')](handleEntityNotFound(_0x3c40f2,null))[_0x34bd('0x30')](function(_0x571612){if(_0x571612){return _0x571612[_0x34bd('0xba')](_0x4f9b3e[_0x34bd('0x39')]['ids']);}})[_0x34bd('0x30')](respondWithStatusCode(_0x3c40f2,null))[_0x34bd('0xa5')](handleError(_0x3c40f2,null));};exports[_0x34bd('0xbb')]=function(_0x57b59c,_0x415980){var _0x285c64=moment()[_0x34bd('0xbc')]()[_0x34bd('0x8c')]();var _0x24e21c=path[_0x34bd('0xbd')](config[_0x34bd('0xbe')],_0x34bd('0xbf'),_0x34bd('0xc0'),_0x34bd('0xc1'));var _0x4df088=path['join'](config[_0x34bd('0xbe')],_0x34bd('0xbf'),_0x34bd('0xc0'),_0x34bd('0xc2'));var _0x321218=path[_0x34bd('0xbd')](_0x24e21c,_0x285c64);var _0x51245a=util[_0x34bd('0xb3')](_0x34bd('0xc3'),_0x57b59c['params']['id'],_0x285c64);var _0x1d71a9=path[_0x34bd('0xbd')](_0x24e21c,_0x51245a);var _0x2caf8d=[];_0x2caf8d[_0x34bd('0x2f')]({'model':db[_0x34bd('0x63')],'as':_0x34bd('0x63'),'attributes':['id',_0x34bd('0x2b')],'raw':!![]});_0x2caf8d[_0x34bd('0x2f')]({'model':db[_0x34bd('0xc4')],'as':_0x34bd('0x58'),'attributes':['id',_0x34bd('0xc5'),'lastName'],'raw':!![]});var _0x1804cc=[{'model':db[_0x34bd('0xaf')],'as':_0x34bd('0xc6'),'attributes':['id',_0x34bd('0xac'),_0x34bd('0x6b'),'direction',_0x34bd('0xc7'),'read'],'include':_0x2caf8d}];_0x1804cc[_0x34bd('0x2f')]({'model':db[_0x34bd('0xc8')],'as':_0x34bd('0xc9'),'attributes':['id',_0x34bd('0x28')]});_0x1804cc[_0x34bd('0x2f')]({'model':db[_0x34bd('0x63')],'as':_0x34bd('0xca'),'attributes':['id',_0x34bd('0x2b')]});return db[_0x34bd('0x8e')]['find']({'where':{'id':_0x57b59c[_0x34bd('0xa6')]['id']},'include':_0x1804cc})[_0x34bd('0x30')](handleEntityNotFound(_0x415980,null))['then'](function(_0xcdc6a8){if(_0xcdc6a8){var _0x421b39=_0xcdc6a8[_0x34bd('0xcb')]({'plain':!![]});fs[_0x34bd('0xcc')](_0x321218);var _0x1cc454={'format':'A4','border':_0x34bd('0xcd'),'header':{'height':'40px','contents':{'first':_0x34bd('0xce')}},'footer':{'height':_0x34bd('0xcf'),'contents':{'default':util[_0x34bd('0xb3')](_0x34bd('0xd0'),util[_0x34bd('0xb3')](_0x34bd('0xd1'),_0x34bd('0xd2'),_0x421b39['id']),moment()[_0x34bd('0xb3')](_0x34bd('0xd3'))[_0x34bd('0x8c')]())}}};var _0x2ee173={'channel':_0x34bd('0xd2'),'account':_0x421b39[_0x34bd('0xc9')]['name'],'agent':_0x421b39[_0x34bd('0xca')]?_0x421b39[_0x34bd('0xca')][_0x34bd('0x2b')]:_0x34bd('0xd4'),'createdAt':moment(_0x421b39['createdAt'])[_0x34bd('0xb3')](_0x34bd('0xb4'))[_0x34bd('0x8c')](),'closedAt':_0x421b39[_0x34bd('0xd5')]?moment(_0x421b39['closedAt'])[_0x34bd('0xb3')](_0x34bd('0xb4'))[_0x34bd('0x8c')]():'','disposition':_0x421b39[_0x34bd('0xd6')],'messages':_(_0x421b39[_0x34bd('0xc6')])[_0x34bd('0x76')]({'secret':![]})[_0x34bd('0x32')](function(_0x12ef1c){return{'date':moment(_0x12ef1c[_0x34bd('0x6b')])[_0x34bd('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')[_0x34bd('0x8c')](),'sender':_0x12ef1c[_0x34bd('0xd7')]===_0x34bd('0xd8')?_0x12ef1c['User']?_0x12ef1c[_0x34bd('0x63')][_0x34bd('0x2b')]:'System':_0x12ef1c[_0x34bd('0x58')][_0x34bd('0xc5')]+(_0x12ef1c[_0x34bd('0x58')][_0x34bd('0xd9')]?'\x20'+_0x12ef1c[_0x34bd('0x58')][_0x34bd('0xd9')]:''),'body':_0x12ef1c[_0x34bd('0xac')],'direction':_0x12ef1c[_0x34bd('0xd7')]===_0x34bd('0xd8')?'A':'C','secret':_0x12ef1c['secret'],'read':_0x12ef1c[_0x34bd('0x72')]};})['value']()};return ejs[_0x34bd('0xda')](path[_0x34bd('0xbd')](config[_0x34bd('0xbe')],_0x34bd('0xbf'),_0x34bd('0xdb'),_0x34bd('0xdc')),{'interaction':_0x2ee173})[_0x34bd('0x30')](function(_0x5c0f31){return new BPromise(function(_0x58415b,_0x5ba1f4){pdf[_0x34bd('0xab')](_0x5c0f31,_0x1cc454)[_0x34bd('0xdd')](path[_0x34bd('0xbd')](_0x321218,_0x34bd('0xde')+_0x421b39['id']+'-'+_0x285c64+'.pdf'),function(_0x26a737,_0x4307ae){if(_0x26a737)return _0x5ba1f4(_0x26a737);_0x58415b(_0x4307ae);});});})[_0x34bd('0x30')](function(){return new BPromise(function(_0x3bea8f,_0x1d2dac){zipdir(_0x321218,{'saveTo':_0x1d71a9},function(_0xebc491,_0x314c92){if(_0xebc491)return _0x1d2dac(_0xebc491);return _0x3bea8f(_0x314c92);});})[_0x34bd('0x30')](function(){return new BPromise(function(_0x4c34a4,_0x57bd6c){rimraf(_0x321218,function(_0x84b401){if(_0x84b401)_0x57bd6c(_0x84b401);return _0x4c34a4();});});})[_0x34bd('0x30')](function(){return _0x415980[_0x34bd('0xbb')](_0x1d71a9,_0x51245a,function(_0x195ed6){if(_0x195ed6){console[_0x34bd('0xdf')](_0x34bd('0xe0'),_0x195ed6);}else{fs[_0x34bd('0xe1')](_0x1d71a9);}});});});}else{return _0x415980[_0x34bd('0x1a')](0xc8);}})[_0x34bd('0xa5')](handleError(_0x415980,null));}; \ No newline at end of file +var _0x5f66=['stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','catch','SmsInteraction','rawAttributes','fieldName','type','key','keys','filters','intersection','query','model','fields','attributes','length','nolimit','limit','order','sort','where','pick','select','field','color','from','tools_tags','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','sms_interactions','cm_contacts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','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','UserId','buildExpression','start','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','i.id','QueryTypes','clone','DESC','t.id\x20IN\x20?','i.SmsAccountId\x20IS\x20NOT\x20NULL','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','SmsInteractionId','all','rows','show','include','options','create','body','describe','addMessage','params','ids','getMessages','SmsMessage','hasOwnProperty','format','findAll','addTags','setTags','omit','spread','smsInteractionTags:save','removeTags','unix','server','files','tmp','root','attachments','join','transcript-%d-%s.zip','CmContact','lastName','Messages','direction','SmsAccount','Account','Owner','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','Sms','YYYY-MM-DD','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','System','firstName','out','secret','renderFile','views','transcript-','.pdf','download','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./smsInteraction.socket','register','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','then','destroy','end'];(function(_0x28d880,_0x5ec393){var _0x57ff26=function(_0x2268b5){while(--_0x2268b5){_0x28d880['push'](_0x28d880['shift']());}};_0x57ff26(++_0x5ec393);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x65f6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x65f6('0x1'));var jsonpatch=require(_0x65f6('0x2'));var rp=require(_0x65f6('0x3'));var moment=require(_0x65f6('0x4'));var BPromise=require(_0x65f6('0x5'));var Mustache=require('mustache');var util=require(_0x65f6('0x6'));var path=require('path');var sox=require(_0x65f6('0x7'));var csv=require(_0x65f6('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x8'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x65f6('0x13'))['db'];config['redis']=_[_0x65f6('0x14')](config['redis'],{'host':_0x65f6('0x15'),'port':0x18eb});var socket=require(_0x65f6('0x16'))(new Redis(config[_0x65f6('0x17')]));require(_0x65f6('0x18'))[_0x65f6('0x19')](socket);function respondWithStatusCode(_0x1d29fd,_0x44144b){_0x44144b=_0x44144b||0xcc;return function(_0xb1d40a){if(_0xb1d40a){return _0x1d29fd[_0x65f6('0x1a')](_0x44144b);}return _0x1d29fd[_0x65f6('0x1b')](_0x44144b)['end']();};}function respondWithResult(_0x19b9ff,_0x49a913){_0x49a913=_0x49a913||0xc8;return function(_0x5dd324){if(_0x5dd324){return _0x19b9ff[_0x65f6('0x1b')](_0x49a913)[_0x65f6('0x1c')](_0x5dd324);}};}function respondWithFilteredResult(_0x37330d,_0x1c955c){return function(_0x1b1cbb){if(_0x1b1cbb){var _0x1f974c=_0x1b1cbb['count'],_0xc8660c=_0x1c955c[_0x65f6('0x1d')],_0x18380e=_0x1c955c['offset']+_0x1c955c['limit'],_0x495dd6;if(_0x18380e>=_0x1f974c){_0x18380e=_0x1f974c;_0x495dd6=0xc8;}else{_0x495dd6=0xce;}_0x37330d['status'](_0x495dd6);return _0x37330d[_0x65f6('0x1e')](_0x65f6('0x1f'),_0xc8660c+'-'+_0x18380e+'/'+_0x1f974c)['json'](_0x1b1cbb);}return null;};}function patchUpdates(_0x39e19f){return function(_0x270893){try{jsonpatch[_0x65f6('0x20')](_0x270893,_0x39e19f,!![]);}catch(_0x3876ed){return BPromise[_0x65f6('0x21')](_0x3876ed);}return _0x270893[_0x65f6('0x22')]();};}function saveUpdates(_0x581374,_0x197a49){return function(_0x4bb39e){if(_0x4bb39e){return _0x4bb39e['update'](_0x581374)[_0x65f6('0x23')](function(_0xd173f4){return _0xd173f4;});}return null;};}function removeEntity(_0x524e42,_0x1eeaaa){return function(_0x471a33){if(_0x471a33){return _0x471a33[_0x65f6('0x24')]()[_0x65f6('0x23')](function(){_0x524e42['status'](0xcc)[_0x65f6('0x25')]();});}};}function handleEntityNotFound(_0x59ea32,_0x20a161){return function(_0x5963e0){if(!_0x5963e0){_0x59ea32['sendStatus'](0x194);}return _0x5963e0;};}function handleError(_0x4fde2f,_0x29abdb){_0x29abdb=_0x29abdb||0x1f4;return function(_0x16cde8){logger['error'](_0x16cde8[_0x65f6('0x26')]);if(_0x16cde8[_0x65f6('0x27')]){delete _0x16cde8['name'];}_0x4fde2f[_0x65f6('0x1b')](_0x29abdb)[_0x65f6('0x28')](_0x16cde8);};}function getInteractionUsers(_0x28d0df,_0x559330){return new BPromise(function(_0x4ac04b,_0x488d36){try{if(_0x559330[_0x28d0df['id']]){_0x28d0df[_0x65f6('0x29')]=_[_0x65f6('0x2a')](_0x559330[_0x28d0df['id']],function(_0x4344b3){return{'id':_0x4344b3['id'],'fullname':_0x4344b3[_0x65f6('0x2b')]};});}}catch(_0x518cac){_0x488d36(_0x518cac);}_0x4ac04b(_0x28d0df);});}function getInteractionTags(_0x14a387,_0x144e55){return new BPromise(function(_0x4ace4c,_0x4ea23d){try{if(_0x14a387[_0x65f6('0x2c')]){_0x14a387[_0x65f6('0x2d')]=[];_0x14a387['TagIds']['split'](',')[_0x65f6('0x2e')](function(_0x1ce43c){_0x14a387[_0x65f6('0x2d')][_0x65f6('0x2f')](_0x144e55[_0x1ce43c]);});}delete _0x14a387[_0x65f6('0x2c')];}catch(_0x2d32be){_0x4ea23d(_0x2d32be);}_0x4ace4c(_0x14a387);});}function updateSmsInteraction(_0x5792a0,_0x103265,_0x38f3c6){return new BPromise(function(_0x46f03c,_0x4bc037){return getInteractionUsers(_0x5792a0,_0x38f3c6)[_0x65f6('0x23')](function(_0x2a7aa8){return getInteractionTags(_0x2a7aa8,_0x103265);})[_0x65f6('0x23')](function(_0x45510a){_0x46f03c(_0x45510a);})[_0x65f6('0x30')](function(_0x2f054c){_0x4bc037(_0x2f054c);});});}exports['index']=function(_0x3c7c58,_0x1b24ea){var _0x4f3e22={},_0x36dbf4={},_0x5a740a={'count':0x0,'rows':[]};var _0x2b403b=_['map'](db[_0x65f6('0x31')][_0x65f6('0x32')],function(_0x5ce050){return{'name':_0x5ce050[_0x65f6('0x33')],'type':_0x5ce050[_0x65f6('0x34')][_0x65f6('0x35')]};});_0x36dbf4['model']=_['map'](_0x2b403b,_0x65f6('0x27'));_0x36dbf4['query']=_[_0x65f6('0x36')](_0x3c7c58['query']);_0x36dbf4[_0x65f6('0x37')]=_[_0x65f6('0x38')](_0x36dbf4['model'],_0x36dbf4[_0x65f6('0x39')]);_0x4f3e22['attributes']=_['intersection'](_0x36dbf4[_0x65f6('0x3a')],qs[_0x65f6('0x3b')](_0x3c7c58[_0x65f6('0x39')][_0x65f6('0x3b')]));_0x4f3e22[_0x65f6('0x3c')]=_0x4f3e22[_0x65f6('0x3c')][_0x65f6('0x3d')]?_0x4f3e22[_0x65f6('0x3c')]:_0x36dbf4['model'];if(!_0x3c7c58[_0x65f6('0x39')]['hasOwnProperty'](_0x65f6('0x3e'))){_0x4f3e22[_0x65f6('0x3f')]=qs[_0x65f6('0x3f')](_0x3c7c58[_0x65f6('0x39')]['limit']);_0x4f3e22[_0x65f6('0x1d')]=qs[_0x65f6('0x1d')](_0x3c7c58[_0x65f6('0x39')][_0x65f6('0x1d')]);}_0x4f3e22[_0x65f6('0x40')]=qs[_0x65f6('0x41')](_0x3c7c58[_0x65f6('0x39')][_0x65f6('0x41')]);_0x4f3e22[_0x65f6('0x42')]=qs['filters'](_[_0x65f6('0x43')](_0x3c7c58[_0x65f6('0x39')],_0x36dbf4[_0x65f6('0x37')]));var _0x181798=[];var _0x83e2d9=squel[_0x65f6('0x44')]()[_0x65f6('0x45')]('id')[_0x65f6('0x45')](_0x65f6('0x27'))[_0x65f6('0x45')](_0x65f6('0x46'))[_0x65f6('0x47')](_0x65f6('0x48'));var _0x27157d=squel[_0x65f6('0x44')]()[_0x65f6('0x45')]('u.id')[_0x65f6('0x45')](_0x65f6('0x49'))[_0x65f6('0x45')](_0x65f6('0x4a'))['from'](_0x65f6('0x4b'),'ui')[_0x65f6('0x4c')](_0x65f6('0x4d'),'u','u.id\x20=\x20ui.UserId');var _0x2dbab3=squel[_0x65f6('0x44')]()[_0x65f6('0x47')](_0x65f6('0x4e'),'i')['left_join'](_0x65f6('0x4f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x65f6('0x4c')](_0x65f6('0x4d'),'o','o.id\x20=\x20i.UserId')[_0x65f6('0x4c')]('sms_accounts','a',_0x65f6('0x50'))[_0x65f6('0x4c')](_0x65f6('0x51'),'me',_0x65f6('0x52'))[_0x65f6('0x4c')](_0x65f6('0x53'),'it','it.SmsInteractionId\x20=\x20i.id')['left_join'](_0x65f6('0x48'),'t',_0x65f6('0x54'));var _0x3b647a=squel[_0x65f6('0x55')]();var _0x3b907c=[];var _0x2d6ab9=squel[_0x65f6('0x55')]();var _0x41690c;if(_0x3c7c58[_0x65f6('0x39')]['search']){_0x41690c=as[_0x65f6('0x56')](_0x3c7c58[_0x65f6('0x39')][_0x65f6('0x57')]);var _0x492071=_0x41690c[_0x65f6('0x58')];for(var _0x42d453=0x0;_0x42d453<_0x41690c['conditions'][_0x65f6('0x3d')];_0x42d453++){var _0x253d52=_0x41690c['conditions'][_0x42d453];var _0x309ec6='i';var _0x4f96c4=_[_0x65f6('0x59')](_0x2b403b,[_0x65f6('0x27'),_0x253d52[_0x65f6('0x45')]]);if(!_0x4f96c4){switch(_0x253d52['field']){case _0x65f6('0x5a'):if(_0x253d52[_0x65f6('0x5b')]==0x1){_0x2dbab3['having']('`'+_0x253d52[_0x65f6('0x45')]+_0x65f6('0x5c'));}else{_0x2dbab3['having']('`'+_0x253d52[_0x65f6('0x45')]+_0x65f6('0x5d'));}break;case _0x65f6('0x5e'):if(_0x253d52[_0x65f6('0x5f')]===_0x65f6('0x60')){if(_0x253d52[_0x65f6('0x5b')][_0x65f6('0x61')]('\x20')[_0x65f6('0x3d')]>0x1){_0x3b647a[_0x492071]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x253d52['value']),null);}else{var _0x19f40c='%'+_0x253d52[_0x65f6('0x5b')]+'%';_0x3b647a[_0x492071](_0x65f6('0x62'),_0x19f40c,_0x19f40c,_0x19f40c);}}else{_0x4f96c4=_[_0x65f6('0x59')](_0x2b403b,['name',_0x65f6('0x63')]);_0x253d52[_0x65f6('0x45')]=_0x65f6('0x63');_0x51549d=as['buildExpression'](_0x309ec6,_0x4f96c4[_0x65f6('0x34')],_0x253d52);_0x3b647a[_0x492071](_0x51549d[_0x65f6('0x64')],_0x51549d[_0x65f6('0x5b')]['start'],_0x51549d['value'][_0x65f6('0x25')]);}break;case _0x65f6('0x65'):var _0x4125cb=_0x253d52[_0x65f6('0x5b')][_0x65f6('0x61')](',')[_0x65f6('0x2a')](function(_0x35d77f){return Number(_0x35d77f);});_0x4125cb[_0x65f6('0x2e')](function(_0x2d8b5b){_0x2d6ab9['or'](_0x65f6('0x66'),'%,'+_0x2d8b5b+',%');});_0x3b907c=_[_0x65f6('0x67')](_0x3b907c,_0x4125cb);break;case _0x65f6('0x68'):if(_0x253d52[_0x65f6('0x5f')]===_0x65f6('0x60')){_0x3b647a[_0x492071]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x253d52[_0x65f6('0x5b')]+'%',null);}else{_0x4f96c4=_[_0x65f6('0x59')](_0x2b403b,[_0x65f6('0x27'),'UserId']);_0x253d52[_0x65f6('0x45')]=_0x65f6('0x69');_0x51549d=as[_0x65f6('0x6a')](_0x309ec6,_0x4f96c4[_0x65f6('0x34')],_0x253d52);_0x3b647a[_0x492071](_0x51549d['text'],_0x51549d[_0x65f6('0x5b')][_0x65f6('0x6b')],_0x51549d[_0x65f6('0x5b')][_0x65f6('0x25')]);}break;case'body':_0x51549d=as[_0x65f6('0x6a')]('me',null,_0x253d52);_0x3b647a[_0x492071](_0x51549d[_0x65f6('0x64')],_0x51549d['value'][_0x65f6('0x6b')],_0x51549d[_0x65f6('0x5b')][_0x65f6('0x25')]);break;}}else{var _0x51549d=as[_0x65f6('0x6a')](_0x309ec6,_0x4f96c4[_0x65f6('0x34')],_0x253d52);_0x3b647a[_0x492071](_0x51549d[_0x65f6('0x64')],_0x51549d[_0x65f6('0x5b')][_0x65f6('0x6b')],_0x51549d[_0x65f6('0x5b')]['end']);}}}else{var _0x4ee8bd=_(_0x3c7c58['query'])[_0x65f6('0x36')]()[_0x65f6('0x2a')](function(_0x376a79){return _[_0x65f6('0x6c')](_0x2b403b,[_0x65f6('0x27'),_0x376a79])?_0x376a79:undefined;})[_0x65f6('0x6d')]()['value']();if(!_[_0x65f6('0x6e')](_0x4ee8bd)){_0x4ee8bd[_0x65f6('0x2e')](function(_0x54b569){if(_0x54b569===_0x65f6('0x6f')){_0x2dbab3[_0x65f6('0x42')](_0x65f6('0x70'),[]['concat'](_0x3c7c58[_0x65f6('0x39')][_0x54b569]));}else if(_0x54b569===_0x65f6('0x71')){var _0x4e83dc=JSON[_0x65f6('0x72')](_0x3c7c58[_0x65f6('0x39')][_0x54b569])[_0x65f6('0x73')];var _0x417b44=JSON[_0x65f6('0x72')](_0x3c7c58[_0x65f6('0x39')][_0x54b569])[_0x65f6('0x74')];_0x2dbab3['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4e83dc,_0x417b44);}else{if(_0x3c7c58[_0x65f6('0x39')][_0x54b569]===_0x65f6('0x75')){_0x2dbab3['where']('i.'+_0x54b569+_0x65f6('0x76'));}else{_0x2dbab3['where']('i.'+_0x54b569+_0x65f6('0x77'),_0x3c7c58['query'][_0x54b569]);}}});}if(_0x3c7c58[_0x65f6('0x39')][_0x65f6('0x78')]){if(_0x3c7c58[_0x65f6('0x39')][_0x65f6('0x78')]==0x1){_0x2dbab3[_0x65f6('0x79')](_0x65f6('0x7a'));}else{_0x2dbab3[_0x65f6('0x79')](_0x65f6('0x7b'));}}if(_0x3c7c58[_0x65f6('0x39')]['tag']){_0x3b907c=_['isArray'](_0x3c7c58[_0x65f6('0x39')][_0x65f6('0x7c')])?_0x3c7c58[_0x65f6('0x39')]['tag']:new Array(_0x3c7c58['query'][_0x65f6('0x7c')]);_0x3b907c[_0x65f6('0x2e')](function(_0x4526e6){_0x2d6ab9['or'](_0x65f6('0x66'),'%,'+_0x4526e6+',%');});}if(_0x3c7c58[_0x65f6('0x39')][_0x65f6('0x7d')]){var _0x522d32=_0x3c7c58['query'][_0x65f6('0x7d')][_0x65f6('0x7e')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x65f6('0x7f'));if(qs['isNumeric'](_0x522d32)){_0x3b647a['or'](_0x65f6('0x80'),_0x522d32+'%')['or'](_0x65f6('0x81'),_0x522d32+'%');}else{_0x3b647a['or'](_0x65f6('0x82'),qs[_0x65f6('0x83')](_0x522d32))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x522d32+'%');}}}_0x2dbab3[_0x65f6('0x42')](_0x3b647a);_0x2dbab3[_0x65f6('0x84')](_0x65f6('0x85'));var _0x59131c={'type':db['Sequelize'][_0x65f6('0x86')]['SELECT'],'raw':!![]};var _0x305967=_0x2dbab3[_0x65f6('0x87')]();_0x305967[_0x65f6('0x45')](_0x65f6('0x85'));_0x305967['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x4f3e22[_0x65f6('0x40')]){_0x4f3e22[_0x65f6('0x40')][_0x65f6('0x2e')](function(_0x57464e){_0x2dbab3[_0x65f6('0x40')]('i.'+_0x57464e[0x0],_0x57464e[0x1]===_0x65f6('0x88')?![]:!![]);});}if(!_[_0x65f6('0x6e')](_0x3b907c)){_0x2dbab3['having'](_0x2d6ab9);_0x305967[_0x65f6('0x42')](_0x65f6('0x89'),_0x3b907c);}BPromise['resolve']()[_0x65f6('0x23')](function(){if(!_0x41690c){if(_0x3c7c58[_0x65f6('0x39')]['SmsAccountId']||_0x3c7c58[_0x65f6('0x39')]['journey'])return;_0x305967[_0x65f6('0x42')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x2dbab3[_0x65f6('0x42')](_0x65f6('0x8a'));return;}return _0x3c7c58['user'][_0x65f6('0x8b')]({'attributes':['id'],'raw':!![]})[_0x65f6('0x23')](function(_0x2a700b){if(_[_0x65f6('0x6e')](_0x2a700b)){_0x305967[_0x65f6('0x42')](_0x65f6('0x8c'));_0x2dbab3[_0x65f6('0x42')](_0x65f6('0x8c'));}else{_0x305967[_0x65f6('0x42')](_0x65f6('0x70'),_[_0x65f6('0x2a')](_0x2a700b,'id'));_0x2dbab3['where'](_0x65f6('0x70'),_[_0x65f6('0x2a')](_0x2a700b,'id'));}});})[_0x65f6('0x23')](function(){db[_0x65f6('0x8d')]['query'](_0x305967[_0x65f6('0x8e')](),_0x59131c)[_0x65f6('0x23')](function(_0x4a7928){_0x5a740a[_0x65f6('0x8f')]=_0x4a7928['length'];if(_0x5a740a[_0x65f6('0x8f')]===0x0)return[];return db['sequelize'][_0x65f6('0x39')](_0x83e2d9[_0x65f6('0x8e')](),_0x59131c)['then'](function(_0x4946c7){_0x181798=_[_0x65f6('0x90')](_0x4946c7,'id');_0x59131c=_[_0x65f6('0x91')](_0x59131c,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3c7c58[_0x65f6('0x39')][_0x65f6('0x3b')]){_0x4f3e22[_0x65f6('0x3c')]['forEach'](function(_0x1348ec){_0x2dbab3[_0x65f6('0x45')]('i.'+_0x1348ec);});}else{_0x2dbab3['field'](_0x65f6('0x92'),'unreadMessages');_0x2dbab3[_0x65f6('0x45')]('a.key','Account.key');_0x2dbab3[_0x65f6('0x45')](_0x65f6('0x93'),_0x65f6('0x94'));_0x2dbab3[_0x65f6('0x45')](_0x65f6('0x95'));_0x2dbab3[_0x65f6('0x45')](_0x65f6('0x96'),_0x65f6('0x97'));_0x2dbab3['field']('c.lastName',_0x65f6('0x98'));_0x2dbab3['field'](_0x65f6('0x99'),_0x65f6('0x9a'));_0x2dbab3[_0x65f6('0x45')](_0x65f6('0x9b'),_0x65f6('0x9c'));_0x2dbab3['field'](_0x65f6('0x9d'),_0x65f6('0x9e'));_0x2dbab3[_0x65f6('0x45')]('c.fax',_0x65f6('0x9f'));_0x2dbab3[_0x65f6('0x45')](_0x65f6('0xa0'),_0x65f6('0xa1'));_0x2dbab3[_0x65f6('0x45')](_0x65f6('0xa2'),'Owner.internal');_0x2dbab3['field'](_0x65f6('0xa3'),_0x65f6('0x2c'));}_0x2dbab3[_0x65f6('0x3f')](_0x4f3e22[_0x65f6('0x3f')]);_0x2dbab3['offset'](_0x4f3e22['offset']);return db[_0x65f6('0x8d')][_0x65f6('0x39')](_0x2dbab3[_0x65f6('0x8e')](),_0x59131c);})[_0x65f6('0x23')](function(_0x21c0a7){_0x27157d[_0x65f6('0x42')]('ui.SmsInteractionId\x20IN\x20?',_['map'](_0x21c0a7,'id'));return db['sequelize'][_0x65f6('0x39')](_0x27157d[_0x65f6('0x8e')](),_0x59131c)[_0x65f6('0x23')](function(_0x101588){var _0x53b11c=_['groupBy'](_0x101588,_0x65f6('0xa4'));var _0x27e44b=[];_0x21c0a7['forEach'](function(_0x346fa9){_0x27e44b['push'](updateSmsInteraction(_0x346fa9,_0x181798,_0x53b11c));});return BPromise[_0x65f6('0xa5')](_0x27e44b);});});})['then'](function(_0x3a30ed){_0x5a740a[_0x65f6('0xa6')]=_0x3a30ed;return _0x5a740a;})['then'](respondWithFilteredResult(_0x1b24ea,_0x4f3e22));})[_0x65f6('0x30')](handleError(_0x1b24ea,null));};exports[_0x65f6('0xa7')]=function(_0x13c03b,_0x9f6e0c){var _0xec6a56={'raw':![],'where':{'id':_0x13c03b['params']['id']}},_0x144db0={};_0x144db0[_0x65f6('0x3a')]=_['keys'](db[_0x65f6('0x31')]['rawAttributes']);_0x144db0[_0x65f6('0x39')]=_[_0x65f6('0x36')](_0x13c03b[_0x65f6('0x39')]);_0x144db0[_0x65f6('0x37')]=_['intersection'](_0x144db0[_0x65f6('0x3a')],_0x144db0[_0x65f6('0x39')]);_0xec6a56[_0x65f6('0x3c')]=_['intersection'](_0x144db0['model'],qs[_0x65f6('0x3b')](_0x13c03b[_0x65f6('0x39')]['fields']));_0xec6a56[_0x65f6('0x3c')]=_0xec6a56[_0x65f6('0x3c')][_0x65f6('0x3d')]?_0xec6a56['attributes']:_0x144db0[_0x65f6('0x3a')];if(_0x13c03b[_0x65f6('0x39')]['includeAll']){_0xec6a56[_0x65f6('0xa8')]=[{'all':!![]}];}_0xec6a56=_[_0x65f6('0x91')]({},_0xec6a56,_0x13c03b[_0x65f6('0xa9')]);return db['SmsInteraction'][_0x65f6('0x59')](_0xec6a56)[_0x65f6('0x23')](handleEntityNotFound(_0x9f6e0c,null))[_0x65f6('0x23')](respondWithResult(_0x9f6e0c,null))['catch'](handleError(_0x9f6e0c,null));};exports[_0x65f6('0xaa')]=function(_0x4febfa,_0x1beaa7){return db[_0x65f6('0x31')][_0x65f6('0xaa')](_0x4febfa[_0x65f6('0xab')],{})[_0x65f6('0x23')](respondWithResult(_0x1beaa7,0xc9))[_0x65f6('0x30')](handleError(_0x1beaa7,null));};exports['update']=function(_0x284473,_0xeabe72){if(_0x284473[_0x65f6('0xab')]['id']){delete _0x284473[_0x65f6('0xab')]['id'];}return db[_0x65f6('0x31')]['find']({'where':{'id':_0x284473['params']['id']}})['then'](handleEntityNotFound(_0xeabe72,null))[_0x65f6('0x23')](saveUpdates(_0x284473[_0x65f6('0xab')],null))[_0x65f6('0x23')](respondWithResult(_0xeabe72,null))['catch'](handleError(_0xeabe72,null));};exports[_0x65f6('0x24')]=function(_0x4de6fa,_0x4b2edb){return db[_0x65f6('0x31')][_0x65f6('0x59')]({'where':{'id':_0x4de6fa['params']['id']}})[_0x65f6('0x23')](handleEntityNotFound(_0x4b2edb,null))[_0x65f6('0x23')](removeEntity(_0x4b2edb,null))[_0x65f6('0x30')](handleError(_0x4b2edb,null));};exports[_0x65f6('0xac')]=function(_0x10520e,_0x1bd68f){return db[_0x65f6('0x31')][_0x65f6('0xac')]()[_0x65f6('0x23')](respondWithResult(_0x1bd68f,null))[_0x65f6('0x30')](handleError(_0x1bd68f,null));};exports[_0x65f6('0xad')]=function(_0x2ddda4,_0x5c9cc0,_0x349af7){return db['SmsMessage']['find']({'where':{'id':_0x2ddda4[_0x65f6('0xae')]['id']}})[_0x65f6('0x23')](handleEntityNotFound(_0x5c9cc0,null))[_0x65f6('0x23')](function(_0x3727f9){if(_0x3727f9){return _0x3727f9['addMessage'](_0x2ddda4[_0x65f6('0xab')]['ids'],_['omit'](_0x2ddda4[_0x65f6('0xab')],[_0x65f6('0xaf'),'id'])||{});}})[_0x65f6('0x23')](respondWithResult(_0x5c9cc0,null))[_0x65f6('0x30')](handleError(_0x5c9cc0,null));};exports[_0x65f6('0xb0')]=function(_0xcdfebe,_0x5a33cf,_0x5c8131){var _0x56bf49={'raw':![],'where':{}};var _0x1ef2a0={};var _0x330b4e={'count':0x0,'rows':[]};return db[_0x65f6('0x31')]['findOne']({'where':{'id':_0xcdfebe[_0x65f6('0xae')]['id']}})['then'](handleEntityNotFound(_0x5a33cf,null))['then'](function(_0x377d5e){if(_0x377d5e){_0x1ef2a0[_0x65f6('0x3a')]=_[_0x65f6('0x36')](db[_0x65f6('0xb1')][_0x65f6('0x32')]);_0x1ef2a0['query']=_[_0x65f6('0x36')](_0xcdfebe[_0x65f6('0x39')]);_0x1ef2a0[_0x65f6('0x37')]=_[_0x65f6('0x38')](_0x1ef2a0['model'],_0x1ef2a0[_0x65f6('0x39')]);_0x56bf49[_0x65f6('0x3c')]=_[_0x65f6('0x38')](_0x1ef2a0[_0x65f6('0x3a')],qs[_0x65f6('0x3b')](_0xcdfebe[_0x65f6('0x39')][_0x65f6('0x3b')]));_0x56bf49[_0x65f6('0x3c')]=_0x56bf49['attributes'][_0x65f6('0x3d')]?_0x56bf49[_0x65f6('0x3c')]:_0x1ef2a0[_0x65f6('0x3a')];if(!_0xcdfebe[_0x65f6('0x39')][_0x65f6('0xb2')](_0x65f6('0x3e'))){_0x56bf49['limit']=qs[_0x65f6('0x3f')](_0xcdfebe[_0x65f6('0x39')]['limit']);_0x56bf49[_0x65f6('0x1d')]=qs['offset'](_0xcdfebe[_0x65f6('0x39')][_0x65f6('0x1d')]);}_0x56bf49[_0x65f6('0x40')]=qs[_0x65f6('0x41')](_0xcdfebe[_0x65f6('0x39')]['sort']);_0x56bf49[_0x65f6('0x42')]=qs[_0x65f6('0x37')](_[_0x65f6('0x43')](_0xcdfebe[_0x65f6('0x39')],_0x1ef2a0[_0x65f6('0x37')]));_0x56bf49['where']['SmsInteractionId']=_0x377d5e['id'];if(_0xcdfebe[_0x65f6('0x39')][_0x65f6('0x7d')]){_0x56bf49[_0x65f6('0x42')]=_[_0x65f6('0x91')](_0x56bf49['where'],{'$or':_['map'](_0x56bf49['attributes'],function(_0x42a2f6){var _0x3b0a97={};_0x3b0a97[_0x42a2f6]={'$like':'%'+_0xcdfebe[_0x65f6('0x39')]['filter']+'%'};return _0x3b0a97;})});}if(_0xcdfebe[_0x65f6('0x39')][_0x65f6('0x73')]){var _0x1ce7cb=_0xcdfebe[_0x65f6('0x39')][_0x65f6('0x73')]['split'](',');var _0x35b13c={};_0x35b13c[_0x1ce7cb[0x0]]={'$gte':moment(_0x1ce7cb[0x1])[_0x65f6('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x56bf49['where']=_[_0x65f6('0x91')](_0x56bf49[_0x65f6('0x42')],_0x35b13c);}_0x56bf49=_[_0x65f6('0x91')]({},_0x56bf49,_0xcdfebe[_0x65f6('0xa9')]);return db[_0x65f6('0xb1')]['count']({'where':_0x56bf49[_0x65f6('0x42')]})['then'](function(_0x280c96){_0x330b4e['count']=_0x280c96;if(_0xcdfebe[_0x65f6('0x39')]['includeAll']){_0x56bf49[_0x65f6('0xa8')]=[{'all':!![]}];}return db['SmsMessage'][_0x65f6('0xb4')](_0x56bf49);})[_0x65f6('0x23')](function(_0x494f9c){_0x330b4e['rows']=_0x494f9c;return _0x330b4e;});}})[_0x65f6('0x23')](respondWithFilteredResult(_0x5a33cf,_0x56bf49))[_0x65f6('0x30')](handleError(_0x5a33cf,null));};exports[_0x65f6('0xb5')]=function(_0xcc2932,_0x861892,_0xf862e3){return db[_0x65f6('0x31')][_0x65f6('0x59')]({'where':{'id':_0xcc2932[_0x65f6('0xae')]['id']}})[_0x65f6('0x23')](handleEntityNotFound(_0x861892,null))[_0x65f6('0x23')](function(_0x6babec){if(_0x6babec){return _0x6babec[_0x65f6('0xb6')](_0xcc2932[_0x65f6('0xab')][_0x65f6('0xaf')],_[_0x65f6('0xb7')](_0xcc2932[_0x65f6('0xab')],['ids','id'])||{})[_0x65f6('0xb8')](function(){return db[_0x65f6('0x65')][_0x65f6('0xb4')]({'attributes':['id',_0x65f6('0x27'),_0x65f6('0x46')],'where':{'id':_0xcc2932[_0x65f6('0xab')][_0x65f6('0xaf')]}});})[_0x65f6('0x23')](function(_0x3c9d49){socket['emit'](_0x65f6('0xb9'),{'id':Number(_0xcc2932[_0x65f6('0xae')]['id']),'tags':_0x3c9d49||[]});return{'id':Number(_0xcc2932[_0x65f6('0xae')]['id']),'tags':_0x3c9d49||[]};});}})[_0x65f6('0x23')](respondWithResult(_0x861892,null))['catch'](handleError(_0x861892,null));};exports[_0x65f6('0xba')]=function(_0x39dedf,_0x5c7462,_0x425e10){return db[_0x65f6('0x31')][_0x65f6('0x59')]({'where':{'id':_0x39dedf[_0x65f6('0xae')]['id']}})[_0x65f6('0x23')](handleEntityNotFound(_0x5c7462,null))[_0x65f6('0x23')](function(_0x5f068a){if(_0x5f068a){return _0x5f068a[_0x65f6('0xba')](_0x39dedf[_0x65f6('0x39')][_0x65f6('0xaf')]);}})[_0x65f6('0x23')](respondWithStatusCode(_0x5c7462,null))['catch'](handleError(_0x5c7462,null));};exports['download']=function(_0x5d710b,_0x83e627){var _0x2e1ec7=moment()[_0x65f6('0xbb')]()[_0x65f6('0x8e')]();var _0x366af4=path['join'](config['root'],_0x65f6('0xbc'),_0x65f6('0xbd'),_0x65f6('0xbe'));var _0x5e105d=path['join'](config[_0x65f6('0xbf')],'server',_0x65f6('0xbd'),_0x65f6('0xc0'));var _0x4058f6=path[_0x65f6('0xc1')](_0x366af4,_0x2e1ec7);var _0x4632d0=util[_0x65f6('0xb3')](_0x65f6('0xc2'),_0x5d710b[_0x65f6('0xae')]['id'],_0x2e1ec7);var _0x8f7173=path['join'](_0x366af4,_0x4632d0);var _0x2d0e53=[];_0x2d0e53[_0x65f6('0x2f')]({'model':db['User'],'as':_0x65f6('0x68'),'attributes':['id','fullname'],'raw':!![]});_0x2d0e53[_0x65f6('0x2f')]({'model':db[_0x65f6('0xc3')],'as':_0x65f6('0x5e'),'attributes':['id','firstName',_0x65f6('0xc4')],'raw':!![]});var _0x5745e8=[{'model':db['SmsMessage'],'as':_0x65f6('0xc5'),'attributes':['id',_0x65f6('0xab'),'createdAt',_0x65f6('0xc6'),'secret',_0x65f6('0x78')],'include':_0x2d0e53}];_0x5745e8[_0x65f6('0x2f')]({'model':db[_0x65f6('0xc7')],'as':_0x65f6('0xc8'),'attributes':['id',_0x65f6('0x27')]});_0x5745e8[_0x65f6('0x2f')]({'model':db[_0x65f6('0x68')],'as':_0x65f6('0xc9'),'attributes':['id','fullname']});return db[_0x65f6('0x31')][_0x65f6('0x59')]({'where':{'id':_0x5d710b[_0x65f6('0xae')]['id']},'include':_0x5745e8})[_0x65f6('0x23')](handleEntityNotFound(_0x83e627,null))[_0x65f6('0x23')](function(_0x545cda){if(_0x545cda){var _0x3ef1ac=_0x545cda['get']({'plain':!![]});fs[_0x65f6('0xca')](_0x4058f6);var _0x47e48b={'format':'A4','border':_0x65f6('0xcb'),'header':{'height':_0x65f6('0xcc'),'contents':{'first':_0x65f6('0xcd')}},'footer':{'height':_0x65f6('0xce'),'contents':{'default':util[_0x65f6('0xb3')](_0x65f6('0xcf'),util[_0x65f6('0xb3')](_0x65f6('0xd0'),_0x65f6('0xd1'),_0x3ef1ac['id']),moment()[_0x65f6('0xb3')](_0x65f6('0xd2'))[_0x65f6('0x8e')]())}}};var _0x3739fd={'channel':_0x65f6('0xd1'),'account':_0x3ef1ac[_0x65f6('0xc8')][_0x65f6('0x27')],'agent':_0x3ef1ac[_0x65f6('0xc9')]?_0x3ef1ac['Owner'][_0x65f6('0x2b')]:'N.A.','createdAt':moment(_0x3ef1ac[_0x65f6('0x71')])[_0x65f6('0xb3')](_0x65f6('0xd3'))[_0x65f6('0x8e')](),'closedAt':_0x3ef1ac[_0x65f6('0xd4')]?moment(_0x3ef1ac[_0x65f6('0xd5')])['format'](_0x65f6('0xd3'))[_0x65f6('0x8e')]():'','disposition':_0x3ef1ac[_0x65f6('0xd6')],'messages':_(_0x3ef1ac[_0x65f6('0xc5')])[_0x65f6('0x7d')]({'secret':![]})[_0x65f6('0x2a')](function(_0x967b39){return{'date':moment(_0x967b39[_0x65f6('0x71')])[_0x65f6('0xb3')](_0x65f6('0xd3'))[_0x65f6('0x8e')](),'sender':_0x967b39['direction']==='out'?_0x967b39[_0x65f6('0x68')]?_0x967b39[_0x65f6('0x68')][_0x65f6('0x2b')]:_0x65f6('0xd7'):_0x967b39[_0x65f6('0x5e')][_0x65f6('0xd8')]+(_0x967b39[_0x65f6('0x5e')]['lastName']?'\x20'+_0x967b39[_0x65f6('0x5e')][_0x65f6('0xc4')]:''),'body':_0x967b39[_0x65f6('0xab')],'direction':_0x967b39[_0x65f6('0xc6')]===_0x65f6('0xd9')?'A':'C','secret':_0x967b39[_0x65f6('0xda')],'read':_0x967b39[_0x65f6('0x78')]};})[_0x65f6('0x5b')]()};return ejs[_0x65f6('0xdb')](path[_0x65f6('0xc1')](config[_0x65f6('0xbf')],_0x65f6('0xbc'),_0x65f6('0xdc'),'downloadInteraction.html'),{'interaction':_0x3739fd})['then'](function(_0x56e0c0){return new BPromise(function(_0x3227ce,_0x3edd09){pdf[_0x65f6('0xaa')](_0x56e0c0,_0x47e48b)['toFile'](path[_0x65f6('0xc1')](_0x4058f6,_0x65f6('0xdd')+_0x3ef1ac['id']+'-'+_0x2e1ec7+_0x65f6('0xde')),function(_0x5e5853,_0x245821){if(_0x5e5853)return _0x3edd09(_0x5e5853);_0x3227ce(_0x245821);});});})[_0x65f6('0x23')](function(){return new BPromise(function(_0x49a815,_0x346aa3){zipdir(_0x4058f6,{'saveTo':_0x8f7173},function(_0x1f4a0d,_0x3369b6){if(_0x1f4a0d)return _0x346aa3(_0x1f4a0d);return _0x49a815(_0x3369b6);});})['then'](function(){return new BPromise(function(_0x3654ce,_0x9dcb18){rimraf(_0x4058f6,function(_0x29656f){if(_0x29656f)_0x9dcb18(_0x29656f);return _0x3654ce();});});})[_0x65f6('0x23')](function(){return _0x83e627[_0x65f6('0xdf')](_0x8f7173,_0x4632d0,function(_0x15624a){if(_0x15624a){console[_0x65f6('0xe0')](_0x65f6('0xe1'),_0x15624a);}else{fs[_0x65f6('0xe2')](_0x8f7173);}});});});}else{return _0x83e627[_0x65f6('0x1a')](0xc8);}})['catch'](handleError(_0x83e627,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 27ad7ac..fa33eae 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 _0xdb94=['update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save'];(function(_0x5b91e5,_0x11ae2d){var _0xc062e2=function(_0x26cca1){while(--_0x26cca1){_0x5b91e5['push'](_0x5b91e5['shift']());}};_0xc062e2(++_0x11ae2d);}(_0xdb94,0xe5));var _0x4db9=function(_0x53dcad,_0x5ca61f){_0x53dcad=_0x53dcad-0x0;var _0x7ac9a6=_0xdb94[_0x53dcad];return _0x7ac9a6;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x4db9('0x0'))['db'][_0x4db9('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0x4db9('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x4db9('0x3')](0x0);var events={'afterCreate':_0x4db9('0x4'),'afterUpdate':_0x4db9('0x5'),'afterDestroy':_0x4db9('0x6')};function emitEvent(_0x592097){return function(_0x39eccb,_0x541226,_0x1d21a8){_0x39eccb[_0x4db9('0x7')]({'attributes':['id'],'raw':!![]})[_0x4db9('0x8')](function(_0x3404f6){_0x39eccb[_0x4db9('0x9')]('Users',_0x3404f6[_0x4db9('0xa')](function(_0x4376c8){return{'id':_0x4376c8['id']};}));return SmsMessage[_0x4db9('0xb')]({'where':{'SmsInteractionId':_0x39eccb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4db9('0x8')](function(_0x402132){_0x39eccb['setDataValue'](_0x4db9('0xc'),_0x402132[_0x4db9('0xd')]);SmsInteractionEvents[_0x4db9('0xe')](_0x592097+':'+_0x39eccb['id'],_0x39eccb);SmsInteractionEvents[_0x4db9('0xe')](_0x592097,_0x39eccb);_0x1d21a8(null);})[_0x4db9('0xf')](_0x1d21a8(null));};}for(var e in events){if(events[_0x4db9('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x4db9('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x6aa7=['../../mysqldb','SmsMessage','setMaxListeners','update','remove','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','SmsInteraction'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x6aa7,0x178));var _0x76aa=function(_0x30a136,_0x401fc6){_0x30a136=_0x30a136-0x0;var _0x3d369e=_0x6aa7[_0x30a136];return _0x3d369e;};'use strict';var EventEmitter=require(_0x76aa('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x76aa('0x1')];var SmsMessage=require(_0x76aa('0x2'))['db'][_0x76aa('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x76aa('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x76aa('0x5'),'afterDestroy':_0x76aa('0x6')};function emitEvent(_0x1d6e04){return function(_0x511588,_0x588e62,_0x1aceaa){_0x511588['getUsers']({'attributes':['id'],'raw':!![]})[_0x76aa('0x7')](function(_0x36d12b){_0x511588[_0x76aa('0x8')]('Users',_0x36d12b[_0x76aa('0x9')](function(_0x266bd5){return{'id':_0x266bd5['id']};}));return SmsMessage[_0x76aa('0xa')]({'where':{'SmsInteractionId':_0x511588['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xcd99aa){_0x511588[_0x76aa('0x8')](_0x76aa('0xb'),_0xcd99aa[_0x76aa('0xc')]);SmsInteractionEvents[_0x76aa('0xd')](_0x1d6e04+':'+_0x511588['id'],_0x511588);SmsInteractionEvents[_0x76aa('0xd')](_0x1d6e04,_0x511588);_0x1aceaa(null);})[_0x76aa('0xe')](_0x1aceaa(null));};}for(var e in events){if(events[_0x76aa('0xf')](e)){var event=events[e];SmsInteraction[_0x76aa('0x10')](e,emitEvent(event));}}module[_0x76aa('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index ea5a35e..b92ea84 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 _0xc762=['format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsInteraction.attributes','define','sms_interactions','changed','closed','closedAt'];(function(_0x472173,_0x140ece){var _0x5abc10=function(_0x248388){while(--_0x248388){_0x472173['push'](_0x472173['shift']());}};_0x5abc10(++_0x140ece);}(_0xc762,0x132));var _0x2c76=function(_0x2cde2a,_0x4325c4){_0x2cde2a=_0x2cde2a-0x0;var _0x110f55=_0xc762[_0x2cde2a];return _0x110f55;};'use strict';var _=require('lodash');var util=require(_0x2c76('0x0'));var logger=require(_0x2c76('0x1'))(_0x2c76('0x2'));var moment=require(_0x2c76('0x3'));var BPromise=require(_0x2c76('0x4'));var rp=require(_0x2c76('0x5'));var fs=require('fs');var path=require(_0x2c76('0x6'));var rimraf=require('rimraf');var config=require(_0x2c76('0x7'));var attributes=require(_0x2c76('0x8'));module['exports']=function(_0x18beea,_0x2ff514){return _0x18beea[_0x2c76('0x9')]('SmsInteraction',attributes,{'tableName':_0x2c76('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d2d27,_0x368db9,_0x12ffd8){if(_0x2d2d27[_0x2c76('0xb')](_0x2c76('0xc'))){_0x2d2d27[_0x2c76('0xd')]=moment()[_0x2c76('0xe')](_0x2c76('0xf'));}_0x12ffd8(null,_0x2d2d27);}}});}; \ No newline at end of file +var _0xf73c=['sms_interactions','changed','closed','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction'];(function(_0x38c396,_0x496001){var _0x87469d=function(_0x1ee7b7){while(--_0x1ee7b7){_0x38c396['push'](_0x38c396['shift']());}};_0x87469d(++_0x496001);}(_0xf73c,0x169));var _0xcf73=function(_0x5147f7,_0x1ec566){_0x5147f7=_0x5147f7-0x0;var _0x3aa06a=_0xf73c[_0x5147f7];return _0x3aa06a;};'use strict';var _=require(_0xcf73('0x0'));var util=require(_0xcf73('0x1'));var logger=require(_0xcf73('0x2'))(_0xcf73('0x3'));var moment=require(_0xcf73('0x4'));var BPromise=require(_0xcf73('0x5'));var rp=require(_0xcf73('0x6'));var fs=require('fs');var path=require(_0xcf73('0x7'));var rimraf=require(_0xcf73('0x8'));var config=require(_0xcf73('0x9'));var attributes=require(_0xcf73('0xa'));module[_0xcf73('0xb')]=function(_0x59f949,_0x4541b9){return _0x59f949['define'](_0xcf73('0xc'),attributes,{'tableName':_0xcf73('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3eeb3f,_0x196770,_0x3ee9ed){if(_0x3eeb3f[_0xcf73('0xe')](_0xcf73('0xf'))){_0x3eeb3f['closedAt']=moment()[_0xcf73('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3ee9ed(null,_0x3eeb3f);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 7a499eb..1185161 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 _0x1fd8=['UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','limit','debug','AddTagsToSmsInteraction','find','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1fd8,0x12c));var _0x81fd=function(_0x1c8129,_0x4a7d4e){_0x1c8129=_0x1c8129-0x0;var _0x49c3fa=_0x1fd8[_0x1c8129];return _0x49c3fa;};'use strict';var _=require(_0x81fd('0x0'));var util=require(_0x81fd('0x1'));var moment=require(_0x81fd('0x2'));var BPromise=require(_0x81fd('0x3'));var rs=require(_0x81fd('0x4'));var fs=require('fs');var Redis=require(_0x81fd('0x5'));var db=require(_0x81fd('0x6'))['db'];var utils=require(_0x81fd('0x7'));var logger=require(_0x81fd('0x8'))(_0x81fd('0x9'));var config=require(_0x81fd('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x81fd('0xb')][_0x81fd('0xc')]({'port':0x232a});config[_0x81fd('0xd')]=_['defaults'](config[_0x81fd('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x81fd('0xe'))(new Redis(config[_0x81fd('0xd')]));require(_0x81fd('0xf'))['register'](socket);function respondWithRpcPromise(_0x59ad15,_0x357df0,_0xfeb611){return new BPromise(function(_0x50b2b5,_0x4f76db){return client[_0x81fd('0x10')](_0x59ad15,_0xfeb611)[_0x81fd('0x11')](function(_0xe41fc6){logger[_0x81fd('0x12')](_0x81fd('0x13'),_0x357df0,_0x81fd('0x14'));logger['debug'](_0x81fd('0x15'),_0x357df0,_0x81fd('0x14'),JSON[_0x81fd('0x16')](_0xe41fc6));if(_0xe41fc6[_0x81fd('0x17')]){if(_0xe41fc6[_0x81fd('0x17')][_0x81fd('0x18')]===0x1f4){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x357df0,_0xe41fc6[_0x81fd('0x17')][_0x81fd('0x19')]);return _0x4f76db(_0xe41fc6[_0x81fd('0x17')]['message']);}logger[_0x81fd('0x17')](_0x81fd('0x13'),_0x357df0,_0xe41fc6[_0x81fd('0x17')]['message']);return _0x50b2b5(_0xe41fc6[_0x81fd('0x17')][_0x81fd('0x19')]);}else{logger[_0x81fd('0x12')](_0x81fd('0x13'),_0x357df0,_0x81fd('0x14'));_0x50b2b5(_0xe41fc6[_0x81fd('0x1a')][_0x81fd('0x19')]);}})[_0x81fd('0x1b')](function(_0x29eb69){logger[_0x81fd('0x17')](_0x81fd('0x13'),_0x357df0,_0x29eb69);_0x4f76db(_0x29eb69);});});}exports[_0x81fd('0x1c')]=function(_0x31b211){var _0x10810e=this;return new Promise(function(_0x1ad748,_0x134b56){return db[_0x81fd('0x1d')][_0x81fd('0x1e')](_0x31b211[_0x81fd('0x1f')],{'raw':_0x31b211['options']?_0x31b211[_0x81fd('0x20')][_0x81fd('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31b211[_0x81fd('0x20')]?_0x31b211['options'][_0x81fd('0x22')]||null:null,'attributes':_0x31b211['options']?_0x31b211[_0x81fd('0x20')]['attributes']||null:null,'limit':_0x31b211['options']?_0x31b211['options'][_0x81fd('0x23')]||null:null})[_0x81fd('0x11')](function(_0x1251f0){logger[_0x81fd('0x12')](_0x81fd('0x1c'),_0x31b211);logger[_0x81fd('0x24')]('UpdateSmsInteraction',_0x31b211,JSON[_0x81fd('0x16')](_0x1251f0));_0x1ad748(_0x1251f0);})[_0x81fd('0x1b')](function(_0x277ee2){logger['error'](_0x81fd('0x1c'),_0x277ee2[_0x81fd('0x19')],_0x31b211);_0x134b56(_0x10810e[_0x81fd('0x17')](0x1f4,_0x277ee2['message']));});});};exports[_0x81fd('0x25')]=function(_0x9f97cc){return new Promise(function(_0x4a4a15,_0x4cc6b3){return db[_0x81fd('0x1d')][_0x81fd('0x26')]({'where':_0x9f97cc[_0x81fd('0x20')]?_0x9f97cc['options'][_0x81fd('0x22')]||null:null})['then'](function(_0x5cc022){if(_0x5cc022){return _0x5cc022['addTags'](_0x9f97cc[_0x81fd('0x1f')][_0x81fd('0x27')],_['omit'](_0x9f97cc[_0x81fd('0x1f')],[_0x81fd('0x27'),'id'])||{});}})['spread'](function(_0x649d38){logger[_0x81fd('0x12')](_0x81fd('0x28'),_0x9f97cc);logger[_0x81fd('0x24')](_0x81fd('0x28'),_0x9f97cc,JSON[_0x81fd('0x16')](_0x649d38));_0x4a4a15(_0x649d38);})[_0x81fd('0x1b')](function(_0x4c9540){logger['error'](_0x81fd('0x28'),_0x4c9540[_0x81fd('0x19')],_0x9f97cc);_0x4cc6b3(_this['error'](0x1f4,_0x4c9540['message']));});});}; \ No newline at end of file +var _0xc587=['message','result','update','body','options','raw','where','attributes','limit','UpdateSmsInteraction','catch','SmsInteraction','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x410fee,_0xe4f568){var _0x2d1946=function(_0x204519){while(--_0x204519){_0x410fee['push'](_0x410fee['shift']());}};_0x2d1946(++_0xe4f568);}(_0xc587,0x181));var _0x7c58=function(_0x1af480,_0x123e76){_0x1af480=_0x1af480-0x0;var _0x2cb9a3=_0xc587[_0x1af480];return _0x2cb9a3;};'use strict';var _=require(_0x7c58('0x0'));var util=require(_0x7c58('0x1'));var moment=require('moment');var BPromise=require(_0x7c58('0x2'));var rs=require(_0x7c58('0x3'));var fs=require('fs');var Redis=require(_0x7c58('0x4'));var db=require(_0x7c58('0x5'))['db'];var utils=require(_0x7c58('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x7c58('0x7'));var jayson=require(_0x7c58('0x8'));var client=jayson[_0x7c58('0x9')]['http']({'port':0x232a});config[_0x7c58('0xa')]=_[_0x7c58('0xb')](config['redis'],{'host':_0x7c58('0xc'),'port':0x18eb});var socket=require(_0x7c58('0xd'))(new Redis(config[_0x7c58('0xa')]));require('./smsInteraction.socket')[_0x7c58('0xe')](socket);function respondWithRpcPromise(_0x5da255,_0x34f19b,_0x3ed97b){return new BPromise(function(_0x4682f8,_0x20179a){return client[_0x7c58('0xf')](_0x5da255,_0x3ed97b)[_0x7c58('0x10')](function(_0x1debd6){logger[_0x7c58('0x11')](_0x7c58('0x12'),_0x34f19b,'request\x20sent');logger[_0x7c58('0x13')](_0x7c58('0x14'),_0x34f19b,_0x7c58('0x15'),JSON[_0x7c58('0x16')](_0x1debd6));if(_0x1debd6[_0x7c58('0x17')]){if(_0x1debd6['error'][_0x7c58('0x18')]===0x1f4){logger[_0x7c58('0x17')](_0x7c58('0x12'),_0x34f19b,_0x1debd6[_0x7c58('0x17')][_0x7c58('0x19')]);return _0x20179a(_0x1debd6['error'][_0x7c58('0x19')]);}logger['error'](_0x7c58('0x12'),_0x34f19b,_0x1debd6[_0x7c58('0x17')]['message']);return _0x4682f8(_0x1debd6[_0x7c58('0x17')]['message']);}else{logger[_0x7c58('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x34f19b,_0x7c58('0x15'));_0x4682f8(_0x1debd6[_0x7c58('0x1a')][_0x7c58('0x19')]);}})['catch'](function(_0x266649){logger[_0x7c58('0x17')](_0x7c58('0x12'),_0x34f19b,_0x266649);_0x20179a(_0x266649);});});}exports['UpdateSmsInteraction']=function(_0x569d5b){var _0x3ba675=this;return new Promise(function(_0x79fac4,_0x577316){return db['SmsInteraction'][_0x7c58('0x1b')](_0x569d5b[_0x7c58('0x1c')],{'raw':_0x569d5b[_0x7c58('0x1d')]?_0x569d5b[_0x7c58('0x1d')][_0x7c58('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x569d5b[_0x7c58('0x1d')]?_0x569d5b[_0x7c58('0x1d')][_0x7c58('0x1f')]||null:null,'attributes':_0x569d5b['options']?_0x569d5b[_0x7c58('0x1d')][_0x7c58('0x20')]||null:null,'limit':_0x569d5b[_0x7c58('0x1d')]?_0x569d5b['options'][_0x7c58('0x21')]||null:null})[_0x7c58('0x10')](function(_0x381b0b){logger[_0x7c58('0x11')](_0x7c58('0x22'),_0x569d5b);logger['debug'](_0x7c58('0x22'),_0x569d5b,JSON[_0x7c58('0x16')](_0x381b0b));_0x79fac4(_0x381b0b);})[_0x7c58('0x23')](function(_0x5cadaa){logger['error'](_0x7c58('0x22'),_0x5cadaa['message'],_0x569d5b);_0x577316(_0x3ba675[_0x7c58('0x17')](0x1f4,_0x5cadaa[_0x7c58('0x19')]));});});};exports['AddTagsToSmsInteraction']=function(_0x53947a){return new Promise(function(_0x164bee,_0x4eae10){return db[_0x7c58('0x24')]['find']({'where':_0x53947a[_0x7c58('0x1d')]?_0x53947a[_0x7c58('0x1d')][_0x7c58('0x1f')]||null:null})[_0x7c58('0x10')](function(_0x37d4be){if(_0x37d4be){return _0x37d4be['addTags'](_0x53947a[_0x7c58('0x1c')][_0x7c58('0x25')],_[_0x7c58('0x26')](_0x53947a['body'],[_0x7c58('0x25'),'id'])||{});}})[_0x7c58('0x27')](function(_0x1e4ea4){logger['info'](_0x7c58('0x28'),_0x53947a);logger[_0x7c58('0x13')](_0x7c58('0x28'),_0x53947a,JSON['stringify'](_0x1e4ea4));_0x164bee(_0x1e4ea4);})[_0x7c58('0x23')](function(_0x196860){logger[_0x7c58('0x17')](_0x7c58('0x28'),_0x196860[_0x7c58('0x19')],_0x53947a);_0x4eae10(_this['error'](0x1f4,_0x196860['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 74256cd..2376380 100644 --- a/server/api/smsInteraction/smsInteraction.socket.js +++ b/server/api/smsInteraction/smsInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['save','remove','emit','removeListener','register','smsInteraction:'];(function(_0xf9df02,_0x303c83){var _0x3e4fa8=function(_0x2ae6e4){while(--_0x2ae6e4){_0xf9df02['push'](_0xf9df02['shift']());}};_0x3e4fa8(++_0x303c83);}(_0x757a,0xde));var _0xa757=function(_0x383f6b,_0x465c59){_0x383f6b=_0x383f6b-0x0;var _0x44a7b4=_0x757a[_0x383f6b];return _0x44a7b4;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xa757('0x0'),_0xa757('0x1'),'update'];function createListener(_0x5c03c3,_0x5709ed){return function(_0x32be3b){_0x5709ed[_0xa757('0x2')](_0x5c03c3,_0x32be3b);};}function removeListener(_0x1c2932,_0x453d07){return function(){SmsInteractionEvents[_0xa757('0x3')](_0x1c2932,_0x453d07);};}exports[_0xa757('0x4')]=function(_0x5edca8){for(var _0xae0e7c=0x0,_0x4343b6=events['length'];_0xae0e7c<_0x4343b6;_0xae0e7c++){var _0x2930fa=events[_0xae0e7c];var _0x2f7793=createListener(_0xa757('0x5')+_0x2930fa,_0x5edca8);SmsInteractionEvents['on'](_0x2930fa,_0x2f7793);}}; \ No newline at end of file +var _0xd8b0=['save','emit','./smsInteraction.events'];(function(_0x139a72,_0x30d9dd){var _0x54767e=function(_0x13d62f){while(--_0x13d62f){_0x139a72['push'](_0x139a72['shift']());}};_0x54767e(++_0x30d9dd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var SmsInteractionEvents=require(_0x0d8b('0x0'));var events=[_0x0d8b('0x1'),'remove','update'];function createListener(_0x4b72b0,_0x3ff8df){return function(_0x5b9b89){_0x3ff8df[_0x0d8b('0x2')](_0x4b72b0,_0x5b9b89);};}function removeListener(_0x364286,_0x8196ed){return function(){SmsInteractionEvents['removeListener'](_0x364286,_0x8196ed);};}exports['register']=function(_0x3f8b6f){for(var _0x227c63=0x0,_0x39f43a=events['length'];_0x227c63<_0x39f43a;_0x227c63++){var _0x413284=events[_0x227c63];var _0x284169=createListener('smsInteraction:'+_0x413284,_0x3f8b6f);SmsInteractionEvents['on'](_0x413284,_0x284169);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 2198db7..a2d056d 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 _0x39e0=['sms','create','/:id/status','status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','show','post','tracked'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0x39e0,0x1a4));var _0x039e=function(_0x5a5ad4,_0x3a22ee){_0x5a5ad4=_0x5a5ad4-0x0;var _0x7228a=_0x39e0[_0x5a5ad4];return _0x7228a;};'use strict';var multer=require(_0x039e('0x0'));var util=require(_0x039e('0x1'));var path=require(_0x039e('0x2'));var timeout=require(_0x039e('0x3'));var express=require('express');var router=express[_0x039e('0x4')]();var auth=require(_0x039e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x039e('0x6'));var controller=require('./smsMessage.controller');router['get']('/',auth[_0x039e('0x7')](),controller[_0x039e('0x8')]);router[_0x039e('0x9')](_0x039e('0xa'),auth['isAuthenticated'](),controller[_0x039e('0xb')]);router[_0x039e('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x039e('0xc')]);router[_0x039e('0xd')]('/',auth[_0x039e('0x7')](),interaction[_0x039e('0xe')](_0x039e('0xf'),'smsmessage:create'),controller[_0x039e('0x10')]);router[_0x039e('0xd')](_0x039e('0x11'),controller[_0x039e('0x12')]);router[_0x039e('0x13')](_0x039e('0x14'),auth[_0x039e('0x7')](),controller[_0x039e('0x15')]);router[_0x039e('0x13')](_0x039e('0x16'),auth[_0x039e('0x7')](),controller[_0x039e('0x17')]);router[_0x039e('0x13')](_0x039e('0x18'),auth[_0x039e('0x7')](),controller[_0x039e('0x19')]);router[_0x039e('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x039e('0x1b')]);module[_0x039e('0x1c')]=router; \ No newline at end of file +var _0xbcd6=['/:id/reject','delete','destroy','exports','util','path','Router','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','/:id/status','status','put','update','/:id/accept','accept'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xbcd6,0x70));var _0x6bcd=function(_0x5185b1,_0x476b76){_0x5185b1=_0x5185b1-0x0;var _0x51396c=_0xbcd6[_0x5185b1];return _0x51396c;};'use strict';var multer=require('multer');var util=require(_0x6bcd('0x0'));var path=require(_0x6bcd('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6bcd('0x2')]();var auth=require(_0x6bcd('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6bcd('0x4'));var controller=require(_0x6bcd('0x5'));router[_0x6bcd('0x6')]('/',auth[_0x6bcd('0x7')](),controller[_0x6bcd('0x8')]);router[_0x6bcd('0x6')](_0x6bcd('0x9'),auth['isAuthenticated'](),controller[_0x6bcd('0xa')]);router[_0x6bcd('0x6')](_0x6bcd('0xb'),auth[_0x6bcd('0x7')](),controller[_0x6bcd('0xc')]);router[_0x6bcd('0xd')]('/',auth[_0x6bcd('0x7')](),interaction[_0x6bcd('0xe')](_0x6bcd('0xf'),_0x6bcd('0x10')),controller['create']);router[_0x6bcd('0xd')](_0x6bcd('0x11'),controller[_0x6bcd('0x12')]);router[_0x6bcd('0x13')]('/:id',auth[_0x6bcd('0x7')](),controller[_0x6bcd('0x14')]);router['put'](_0x6bcd('0x15'),auth[_0x6bcd('0x7')](),controller[_0x6bcd('0x16')]);router[_0x6bcd('0x13')](_0x6bcd('0x17'),auth[_0x6bcd('0x7')](),controller['reject']);router[_0x6bcd('0x18')](_0x6bcd('0xb'),auth['isAuthenticated'](),controller[_0x6bcd('0x19')]);module[_0x6bcd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 872eba8..44b964c 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 _0xfaf0=['TEXT','medium','ENUM','out','STRING','BOOLEAN','sequelize'];(function(_0x134b6e,_0x21b5ca){var _0x2229a9=function(_0x3fd3f5){while(--_0x3fd3f5){_0x134b6e['push'](_0x134b6e['shift']());}};_0x2229a9(++_0x21b5ca);}(_0xfaf0,0x1b8));var _0x0faf=function(_0xcb8a91,_0x217c89){_0xcb8a91=_0xcb8a91-0x0;var _0x11f4bd=_0xfaf0[_0xcb8a91];return _0x11f4bd;};'use strict';var Sequelize=require(_0x0faf('0x0'));module['exports']={'body':{'type':Sequelize[_0x0faf('0x1')](_0x0faf('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0faf('0x3')]('in',_0x0faf('0x4')),'defaultValue':_0x0faf('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x0faf('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x0faf('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x5e36=['exports','TEXT','BOOLEAN','ENUM','out','STRING','DATE','sequelize'];(function(_0x1117d8,_0x22bce5){var _0x3d3acc=function(_0x220164){while(--_0x220164){_0x1117d8['push'](_0x1117d8['shift']());}};_0x3d3acc(++_0x22bce5);}(_0x5e36,0x97));var _0x65e3=function(_0x5620ef,_0x5bc979){_0x5620ef=_0x5620ef-0x0;var _0x3c3780=_0x5e36[_0x5620ef];return _0x3c3780;};'use strict';var Sequelize=require(_0x65e3('0x0'));module[_0x65e3('0x1')]={'body':{'type':Sequelize[_0x65e3('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x65e3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x65e3('0x4')]('in',_0x65e3('0x5')),'defaultValue':_0x65e3('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x65e3('0x6')](0xbe)},'phone':{'type':Sequelize[_0x65e3('0x6')]},'readAt':{'type':Sequelize[_0x65e3('0x7')]},'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 d77da0f..7372324 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 _0x0bdb=['results','groupName','DELIVERED','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','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','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','end','name','send','index','map','SmsMessage','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','options','find','create','body','params','describe','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','role','null','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','interface','rejectmessage','SmsAccount','SmsAccountId','MessageSid','twilio','plivo','MessageUUID','messageId','indexOf','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','inspect'];(function(_0x389c9f,_0x554ddd){var _0x22e663=function(_0xd9998e){while(--_0xd9998e){_0x389c9f['push'](_0x389c9f['shift']());}};_0x22e663(++_0x554ddd);}(_0x0bdb,0x11f));var _0xb0bd=function(_0x436019,_0x3030a5){_0x436019=_0x436019-0x0;var _0x387dda=_0x0bdb[_0x436019];return _0x387dda;};'use strict';var pdf=require(_0xb0bd('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb0bd('0x1'));var jsonpatch=require(_0xb0bd('0x2'));var rp=require(_0xb0bd('0x3'));var moment=require(_0xb0bd('0x4'));var BPromise=require(_0xb0bd('0x5'));var Mustache=require(_0xb0bd('0x6'));var util=require(_0xb0bd('0x7'));var path=require(_0xb0bd('0x8'));var sox=require(_0xb0bd('0x9'));var csv=require(_0xb0bd('0xa'));var ejs=require(_0xb0bd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb0bd('0xc'));var crypto=require(_0xb0bd('0xd'));var jsforce=require(_0xb0bd('0xe'));var deskjs=require(_0xb0bd('0xf'));var toCsv=require(_0xb0bd('0xa'));var querystring=require(_0xb0bd('0x10'));var Papa=require('papaparse');var Redis=require(_0xb0bd('0x11'));var authService=require(_0xb0bd('0x12'));var qs=require(_0xb0bd('0x13'));var as=require(_0xb0bd('0x14'));var hardwareService=require(_0xb0bd('0x15'));var logger=require(_0xb0bd('0x16'))(_0xb0bd('0x17'));var utils=require(_0xb0bd('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xb0bd('0x19')]=_[_0xb0bd('0x1a')](config['redis'],{'host':_0xb0bd('0x1b'),'port':0x18eb});var socket=require(_0xb0bd('0x1c'))(new Redis(config['redis']));require(_0xb0bd('0x1d'))[_0xb0bd('0x1e')](socket);var jayson=require(_0xb0bd('0x1f'));var client=jayson[_0xb0bd('0x20')][_0xb0bd('0x21')]({'port':0x232c});var client9002=jayson[_0xb0bd('0x20')][_0xb0bd('0x21')]({'port':0x232a});function checkPasswordPattern(_0x4eb525,_0x1df700,_0x3d6a44){if(_0x3d6a44){var _0x2e7add=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2e7add[_0xb0bd('0x22')](_0x1df700)){return _0x4eb525;}else{throw new db[(_0xb0bd('0x23'))]['ValidationError'](_0xb0bd('0x24'));}}else{return _0x4eb525;}}function respondWithRpcPromise(_0x4a412c,_0x2322d8,_0x3690fb,_0x2026eb){return new BPromise(function(_0x15e034,_0x490538){var _0x1ccb0f=_0x2026eb||client;return _0x1ccb0f[_0xb0bd('0x25')](_0x4a412c,_0x3690fb)[_0xb0bd('0x26')](function(_0x2a088b){logger[_0xb0bd('0x27')](_0xb0bd('0x28'),_0x2322d8,_0xb0bd('0x29'));logger[_0xb0bd('0x2a')](_0xb0bd('0x2b'),_0x2322d8,_0xb0bd('0x29'),JSON[_0xb0bd('0x2c')](_0x2a088b));if(_0x2a088b[_0xb0bd('0x2d')]){if(_0x2a088b[_0xb0bd('0x2d')][_0xb0bd('0x2e')]===0x1f4){logger[_0xb0bd('0x2d')](_0xb0bd('0x28'),_0x2322d8,_0x2a088b['error'][_0xb0bd('0x2f')]);return _0x490538(_0x2a088b[_0xb0bd('0x2d')][_0xb0bd('0x2f')]);}logger[_0xb0bd('0x2d')]('SmsMessage,\x20%s,\x20%s',_0x2322d8,_0x2a088b['error']['message']);return _0x15e034(_0x2a088b[_0xb0bd('0x2d')][_0xb0bd('0x2f')]);}else{logger['info'](_0xb0bd('0x28'),_0x2322d8,_0xb0bd('0x29'));_0x15e034(_0x2a088b[_0xb0bd('0x30')][_0xb0bd('0x2f')]);}})[_0xb0bd('0x31')](function(_0x1a6dcb){logger[_0xb0bd('0x2d')](_0xb0bd('0x28'),_0x2322d8,_0x1a6dcb);_0x490538(_0x1a6dcb);});});}function respondWithStatusCode(_0x48b781,_0x282727){_0x282727=_0x282727||0xcc;return function(_0x2d1360){if(_0x2d1360){return _0x48b781[_0xb0bd('0x32')](_0x282727);}return _0x48b781[_0xb0bd('0x33')](_0x282727)['end']();};}function respondWithResult(_0x2b3742,_0x47ee8d){_0x47ee8d=_0x47ee8d||0xc8;return function(_0x49006f){if(_0x49006f){return _0x2b3742[_0xb0bd('0x33')](_0x47ee8d)[_0xb0bd('0x34')](_0x49006f);}};}function respondWithFilteredResult(_0x2ce53d,_0x37cb6b){return function(_0x276514){if(_0x276514){var _0x11898a=_0x276514[_0xb0bd('0x35')],_0x529d56=_0x37cb6b[_0xb0bd('0x36')],_0x54eb81=_0x37cb6b[_0xb0bd('0x36')]+_0x37cb6b[_0xb0bd('0x37')],_0x7f669b;if(_0x54eb81>=_0x11898a){_0x54eb81=_0x11898a;_0x7f669b=0xc8;}else{_0x7f669b=0xce;}_0x2ce53d[_0xb0bd('0x33')](_0x7f669b);return _0x2ce53d[_0xb0bd('0x38')](_0xb0bd('0x39'),_0x529d56+'-'+_0x54eb81+'/'+_0x11898a)[_0xb0bd('0x34')](_0x276514);}return null;};}function patchUpdates(_0x1c85b6){return function(_0x37146c){try{jsonpatch[_0xb0bd('0x3a')](_0x37146c,_0x1c85b6,!![]);}catch(_0x3dfdc1){return BPromise[_0xb0bd('0x3b')](_0x3dfdc1);}return _0x37146c['save']();};}function saveUpdates(_0x281e65,_0x3f19f1){return function(_0x392696){if(_0x392696){return _0x392696[_0xb0bd('0x3c')](_0x281e65)[_0xb0bd('0x26')](function(_0x3075df){return _0x3075df;});}return null;};}function removeEntity(_0x255a0f,_0x24886b){return function(_0x3fa015){if(_0x3fa015){return _0x3fa015[_0xb0bd('0x3d')]()[_0xb0bd('0x26')](function(){_0x255a0f[_0xb0bd('0x33')](0xcc)[_0xb0bd('0x3e')]();});}};}function handleEntityNotFound(_0x23c2e0,_0x22bd5c){return function(_0x454e0b){if(!_0x454e0b){_0x23c2e0[_0xb0bd('0x32')](0x194);}return _0x454e0b;};}function handleError(_0x1d13d5,_0x45b529){_0x45b529=_0x45b529||0x1f4;return function(_0x4c07b3){logger[_0xb0bd('0x2d')](_0x4c07b3['stack']);if(_0x4c07b3[_0xb0bd('0x3f')]){delete _0x4c07b3[_0xb0bd('0x3f')];}_0x1d13d5[_0xb0bd('0x33')](_0x45b529)[_0xb0bd('0x40')](_0x4c07b3);};}exports[_0xb0bd('0x41')]=function(_0x1494e8,_0x117bda){var _0x64b7dc={},_0x236b7b={},_0x14cd75={'count':0x0,'rows':[]};var _0x29cd5a=_[_0xb0bd('0x42')](db[_0xb0bd('0x43')][_0xb0bd('0x44')],function(_0x52ca19){return{'name':_0x52ca19[_0xb0bd('0x45')],'type':_0x52ca19['type']['key']};});_0x236b7b[_0xb0bd('0x46')]=_[_0xb0bd('0x42')](_0x29cd5a,_0xb0bd('0x3f'));_0x236b7b[_0xb0bd('0x47')]=_[_0xb0bd('0x48')](_0x1494e8[_0xb0bd('0x47')]);_0x236b7b['filters']=_[_0xb0bd('0x49')](_0x236b7b[_0xb0bd('0x46')],_0x236b7b[_0xb0bd('0x47')]);_0x64b7dc['attributes']=_[_0xb0bd('0x49')](_0x236b7b['model'],qs[_0xb0bd('0x4a')](_0x1494e8[_0xb0bd('0x47')][_0xb0bd('0x4a')]));_0x64b7dc['attributes']=_0x64b7dc[_0xb0bd('0x4b')][_0xb0bd('0x4c')]?_0x64b7dc[_0xb0bd('0x4b')]:_0x236b7b[_0xb0bd('0x46')];if(!_0x1494e8[_0xb0bd('0x47')][_0xb0bd('0x4d')](_0xb0bd('0x4e'))){_0x64b7dc[_0xb0bd('0x37')]=qs['limit'](_0x1494e8[_0xb0bd('0x47')][_0xb0bd('0x37')]);_0x64b7dc[_0xb0bd('0x36')]=qs[_0xb0bd('0x36')](_0x1494e8[_0xb0bd('0x47')]['offset']);}_0x64b7dc[_0xb0bd('0x4f')]=qs['sort'](_0x1494e8[_0xb0bd('0x47')]['sort']);_0x64b7dc[_0xb0bd('0x50')]=qs[_0xb0bd('0x51')](_[_0xb0bd('0x52')](_0x1494e8[_0xb0bd('0x47')],_0x236b7b[_0xb0bd('0x51')]));if(_0x1494e8[_0xb0bd('0x47')][_0xb0bd('0x53')]){_0x64b7dc[_0xb0bd('0x50')]=_[_0xb0bd('0x54')](_0x64b7dc[_0xb0bd('0x50')],{'$or':_['map'](_0x29cd5a,function(_0x3fcbe6){if(_0x3fcbe6[_0xb0bd('0x55')]!==_0xb0bd('0x56')){var _0x5ced8e={};_0x5ced8e[_0x3fcbe6[_0xb0bd('0x3f')]]={'$like':'%'+_0x1494e8[_0xb0bd('0x47')]['filter']+'%'};return _0x5ced8e;}})});}_0x64b7dc=_['merge']({},_0x64b7dc,_0x1494e8['options']);var _0x29e928={'where':_0x64b7dc[_0xb0bd('0x50')]};return db[_0xb0bd('0x43')][_0xb0bd('0x35')](_0x29e928)['then'](function(_0x45e4f5){_0x14cd75[_0xb0bd('0x35')]=_0x45e4f5;if(_0x1494e8[_0xb0bd('0x47')][_0xb0bd('0x57')]){_0x64b7dc[_0xb0bd('0x58')]=[{'all':!![]}];}return db[_0xb0bd('0x43')][_0xb0bd('0x59')](_0x64b7dc);})[_0xb0bd('0x26')](function(_0x1197b7){_0x14cd75[_0xb0bd('0x5a')]=_0x1197b7;return _0x14cd75;})[_0xb0bd('0x26')](respondWithFilteredResult(_0x117bda,_0x64b7dc))['catch'](handleError(_0x117bda,null));};exports[_0xb0bd('0x5b')]=function(_0x1e6d9e,_0x124430){var _0x53ed27={'raw':!![],'where':{'id':_0x1e6d9e['params']['id']}},_0x38512b={};_0x38512b[_0xb0bd('0x46')]=_[_0xb0bd('0x48')](db['SmsMessage'][_0xb0bd('0x44')]);_0x38512b[_0xb0bd('0x47')]=_[_0xb0bd('0x48')](_0x1e6d9e[_0xb0bd('0x47')]);_0x38512b['filters']=_['intersection'](_0x38512b['model'],_0x38512b['query']);_0x53ed27[_0xb0bd('0x4b')]=_[_0xb0bd('0x49')](_0x38512b[_0xb0bd('0x46')],qs[_0xb0bd('0x4a')](_0x1e6d9e[_0xb0bd('0x47')][_0xb0bd('0x4a')]));_0x53ed27[_0xb0bd('0x4b')]=_0x53ed27['attributes'][_0xb0bd('0x4c')]?_0x53ed27[_0xb0bd('0x4b')]:_0x38512b[_0xb0bd('0x46')];if(_0x1e6d9e['query']['includeAll']){_0x53ed27[_0xb0bd('0x58')]=[{'all':!![]}];}_0x53ed27=_[_0xb0bd('0x54')]({},_0x53ed27,_0x1e6d9e[_0xb0bd('0x5c')]);return db['SmsMessage'][_0xb0bd('0x5d')](_0x53ed27)[_0xb0bd('0x26')](handleEntityNotFound(_0x124430,null))[_0xb0bd('0x26')](respondWithResult(_0x124430,null))[_0xb0bd('0x31')](handleError(_0x124430,null));};exports['create']=function(_0x568f2a,_0x3b24b7){return db[_0xb0bd('0x43')][_0xb0bd('0x5e')](_0x568f2a[_0xb0bd('0x5f')],{})[_0xb0bd('0x26')](respondWithResult(_0x3b24b7,0xc9))['catch'](handleError(_0x3b24b7,null));};exports[_0xb0bd('0x3c')]=function(_0x540ef4,_0x592a7d){if(_0x540ef4[_0xb0bd('0x5f')]['id']){delete _0x540ef4[_0xb0bd('0x5f')]['id'];}return db[_0xb0bd('0x43')][_0xb0bd('0x5d')]({'where':{'id':_0x540ef4[_0xb0bd('0x60')]['id']}})[_0xb0bd('0x26')](handleEntityNotFound(_0x592a7d,null))[_0xb0bd('0x26')](saveUpdates(_0x540ef4[_0xb0bd('0x5f')],null))['then'](respondWithResult(_0x592a7d,null))[_0xb0bd('0x31')](handleError(_0x592a7d,null));};exports[_0xb0bd('0x3d')]=function(_0x20eaf3,_0x182016){return db[_0xb0bd('0x43')]['find']({'where':{'id':_0x20eaf3[_0xb0bd('0x60')]['id']}})[_0xb0bd('0x26')](handleEntityNotFound(_0x182016,null))[_0xb0bd('0x26')](removeEntity(_0x182016,null))[_0xb0bd('0x31')](handleError(_0x182016,null));};exports[_0xb0bd('0x61')]=function(_0x7bcd0c,_0x3d9d51){return db[_0xb0bd('0x43')][_0xb0bd('0x61')]()[_0xb0bd('0x26')](respondWithResult(_0x3d9d51,null))[_0xb0bd('0x31')](handleError(_0x3d9d51,null));};var interaction_log=require('../../config/logger')(_0xb0bd('0x62'));exports['accept']=function(_0x237d46,_0x1f9481,_0xfa901a){var _0x5eeb65={'channel':_0xb0bd('0x63')};if(_0x237d46['body']['id']){delete _0x237d46['body']['id'];}_0x237d46[_0xb0bd('0x5f')][_0xb0bd('0x64')]=!![];_0x237d46[_0xb0bd('0x5f')][_0xb0bd('0x65')]=moment()[_0xb0bd('0x66')](_0xb0bd('0x67'));_0x237d46[_0xb0bd('0x5f')][_0xb0bd('0x68')]=_0x237d46[_0xb0bd('0x5f')]['UserId']||_0x237d46[_0xb0bd('0x69')]['id'];return db[_0xb0bd('0x43')][_0xb0bd('0x5d')]({'where':{'id':_0x237d46[_0xb0bd('0x60')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xb0bd('0x6a')}]})[_0xb0bd('0x26')](handleEntityNotFound(_0x1f9481,null))[_0xb0bd('0x26')](saveUpdates(_0x237d46[_0xb0bd('0x5f')],null))[_0xb0bd('0x26')](function(_0x5243bd){if(_0x5243bd){_0x5eeb65[_0xb0bd('0x2f')]=_0x5243bd[_0xb0bd('0x6b')]({'plain':!![]});return db[_0xb0bd('0x6c')][_0xb0bd('0x5d')]({'where':{'id':_0x5243bd[_0xb0bd('0x6d')]}});}return null;})[_0xb0bd('0x26')](handleEntityNotFound(_0x1f9481,null))[_0xb0bd('0x26')](function(_0x63f847){if(_0x63f847){return _0x63f847[_0xb0bd('0x3c')]({'UserId':_0x237d46[_0xb0bd('0x5f')][_0xb0bd('0x68')],'read1stAt':_[_0xb0bd('0x6e')](_0x63f847[_0xb0bd('0x6f')])?moment()[_0xb0bd('0x66')](_0xb0bd('0x67')):undefined});}return null;})['then'](function(_0x447010){if(_0x447010){_0x5eeb65[_0xb0bd('0x70')]=_0x447010[_0xb0bd('0x6b')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x237d46['user']['id'],_0x237d46[_0xb0bd('0x69')][_0xb0bd('0x3f')],_0x237d46[_0xb0bd('0x69')][_0xb0bd('0x71')],_0x5eeb65[_0xb0bd('0x70')]['id'],_0x237d46[_0xb0bd('0x5f')]?JSON['stringify'](_0x237d46[_0xb0bd('0x5f')]):_0xb0bd('0x72'));return respondWithRpcPromise('AcceptMessage',_0xb0bd('0x73'),_0x5eeb65);}return null;})[_0xb0bd('0x26')](function(_0x5e0d50){if(_0x5e0d50){if(_0x237d46[_0xb0bd('0x5f')][_0xb0bd('0x74')]){_0x5eeb65[_0xb0bd('0x2f')]['interface']=util[_0xb0bd('0x66')](_0xb0bd('0x75'),_0x237d46[_0xb0bd('0x69')][_0xb0bd('0x3f')]);_0x5eeb65[_0xb0bd('0x2f')][_0xb0bd('0x76')]=_0x5eeb65['channel'];_0x5eeb65[_0xb0bd('0x2f')][_0xb0bd('0x77')]='accept';return respondWithRpcPromise(_0xb0bd('0x78'),'EventManager',{'event':_0xb0bd('0x79'),'message':_0x5eeb65[_0xb0bd('0x2f')]},client9002)[_0xb0bd('0x26')](function(){return _0x5eeb65;});}return _0x5eeb65;}return null;})[_0xb0bd('0x26')](respondWithResult(_0x1f9481,null))[_0xb0bd('0x31')](handleError(_0x1f9481,null));};var interaction_log=require(_0xb0bd('0x16'))('sms-interactions');exports[_0xb0bd('0x3b')]=function(_0x20babd,_0x3d24fb,_0x17af05){var _0x395be9={'agent':{},'channel':'sms'};if(_0x20babd[_0xb0bd('0x5f')]['id']){delete _0x20babd[_0xb0bd('0x5f')]['id'];}_0x20babd[_0xb0bd('0x5f')][_0xb0bd('0x68')]=_0x20babd[_0xb0bd('0x5f')][_0xb0bd('0x68')]||_0x20babd[_0xb0bd('0x69')]['id'];_0x395be9['agent']['id']=_0x20babd[_0xb0bd('0x5f')][_0xb0bd('0x68')];return db[_0xb0bd('0x43')][_0xb0bd('0x5d')]({'where':{'id':_0x20babd['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3d24fb,null))['then'](function(_0x2c538d){if(_0x2c538d){_0x395be9[_0xb0bd('0x2f')]=_0x2c538d[_0xb0bd('0x6b')]({'plain':!![]});return db[_0xb0bd('0x6c')][_0xb0bd('0x5d')]({'where':{'id':_0x2c538d[_0xb0bd('0x6d')]}});}return null;})[_0xb0bd('0x26')](handleEntityNotFound(_0x3d24fb,null))[_0xb0bd('0x26')](function(_0x5b0863){if(_0x5b0863){_0x395be9[_0xb0bd('0x70')]=_0x5b0863[_0xb0bd('0x6b')]({'plain':!![]});interaction_log[_0xb0bd('0x27')](_0xb0bd('0x7a'),_0x20babd[_0xb0bd('0x69')]['id'],_0x20babd[_0xb0bd('0x69')][_0xb0bd('0x3f')],_0x20babd['user']['role'],_0x395be9[_0xb0bd('0x70')]['id'],_0x20babd[_0xb0bd('0x5f')]?JSON[_0xb0bd('0x2c')](_0x20babd[_0xb0bd('0x5f')]):'null');return respondWithRpcPromise(_0xb0bd('0x7b'),'rejectMessage',_0x395be9);}return null;})['then'](function(_0x2dd837){if(_0x2dd837){_0x2dd837['message'][_0xb0bd('0x7c')]=util[_0xb0bd('0x66')](_0xb0bd('0x75'),_0x20babd[_0xb0bd('0x69')][_0xb0bd('0x3f')]);_0x2dd837[_0xb0bd('0x2f')]['channel']=_0x395be9['channel'];_0x2dd837[_0xb0bd('0x2f')]['event']='reject';respondWithRpcPromise(_0xb0bd('0x78'),_0xb0bd('0x78'),{'event':_0xb0bd('0x7d'),'message':_0x2dd837['message']},client9002);return _0x395be9;}return null;})['then'](respondWithResult(_0x3d24fb,null))[_0xb0bd('0x31')](handleError(_0x3d24fb,null));};exports[_0xb0bd('0x33')]=function(_0x6e8443,_0x36819e,_0x538ea0){if(_0x6e8443[_0xb0bd('0x5f')]['id']){delete _0x6e8443['body']['id'];}var _0x3410f8;return db[_0xb0bd('0x43')][_0xb0bd('0x5d')]({'where':{'id':_0x6e8443[_0xb0bd('0x60')]['id']}})[_0xb0bd('0x26')](handleEntityNotFound(_0x36819e,null))[_0xb0bd('0x26')](function(_0x73d75e){if(_0x73d75e){_0x3410f8=_0x73d75e;return db[_0xb0bd('0x7e')][_0xb0bd('0x5d')]({'where':{'id':_0x73d75e[_0xb0bd('0x7f')]}});}})[_0xb0bd('0x26')](handleEntityNotFound(_0x36819e,null))[_0xb0bd('0x26')](function(_0x5510d1){if(_0x5510d1){logger['debug'](_0xb0bd('0x2b'),_0xb0bd('0x33'),'received\x20delivery\x20report\x20from',_0x5510d1[_0xb0bd('0x55')],util['inspect'](_0x6e8443[_0xb0bd('0x5f')],{'showHidden':![],'depth':null}));switch(_0x5510d1[_0xb0bd('0x55')]){case'twilio':if(_0x6e8443['body'][_0xb0bd('0x80')]&&_0x6e8443[_0xb0bd('0x5f')][_0xb0bd('0x80')]===_0x3410f8['messageId']){return _0x3410f8['update']({'read':!![]});}else{logger[_0xb0bd('0x2d')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb0bd('0x33'),_0xb0bd('0x81'),util['inspect'](_0x6e8443[_0xb0bd('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xb0bd('0x82'):if(_0x6e8443[_0xb0bd('0x5f')][_0xb0bd('0x83')]&&_0x6e8443[_0xb0bd('0x5f')]['MessageUUID']===_0x3410f8[_0xb0bd('0x84')]&&_[_0xb0bd('0x85')](['sent',_0xb0bd('0x86')],_0x6e8443[_0xb0bd('0x5f')][_0xb0bd('0x87')])>=0x0){return _0x3410f8['update']({'read':!![]});}else{logger[_0xb0bd('0x2d')](_0xb0bd('0x88'),'status',_0xb0bd('0x89'),util[_0xb0bd('0x8a')](_0x6e8443[_0xb0bd('0x5f')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x232533=_0x6e8443[_0xb0bd('0x5f')][_0xb0bd('0x8b')][0x0];if(_0x232533['status'][_0xb0bd('0x8c')]===_0xb0bd('0x8d')){return _0x3410f8[_0xb0bd('0x3c')]({'read':!![]});}else{logger['error'](_0xb0bd('0x88'),_0xb0bd('0x33'),'infobip',util['inspect'](_0x6e8443['body'],{'showHidden':![],'depth':null}));}break;}return _0x3410f8;}})['then'](respondWithResult(_0x36819e,null))[_0xb0bd('0x31')](handleError(_0x36819e,null));}; \ No newline at end of file +var _0x97e4=['describe','accept','sms','read','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','user','role','stringify','null','AcceptMessage','acceptMessage','interface','format','SIP/%s','channel','EventManager','acceptmessage','sms-interactions','reject','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','SmsAccount','SmsAccountId','debug','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','plivo','MessageUUID','indexOf','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','to-csv','ejs','lodash','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','redis','localhost','./smsMessage.socket','jayson/promise','client','http','test','Sequelize','ValidationError','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','error','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','destroy','stack','name','send','index','SmsMessage','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','includeAll','include','rows','catch','show','options','create','body','update','find','params'];(function(_0x27c16f,_0x5f3b82){var _0x16798f=function(_0x50ebc5){while(--_0x50ebc5){_0x27c16f['push'](_0x27c16f['shift']());}};_0x16798f(++_0x5f3b82);}(_0x97e4,0x13f));var _0x497e=function(_0x200aa5,_0x197802){_0x200aa5=_0x200aa5-0x0;var _0x458200=_0x97e4[_0x200aa5];return _0x458200;};'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(_0x497e('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x497e('0x7'));var ejs=require(_0x497e('0x8'));var fs=require('fs');var _=require(_0x497e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x497e('0xa'));var Redis=require(_0x497e('0xb'));var authService=require(_0x497e('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x497e('0xd'))(_0x497e('0xe'));var utils=require(_0x497e('0xf'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x497e('0x10')]=_['defaults'](config['redis'],{'host':_0x497e('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x497e('0x10')]));require(_0x497e('0x12'))['register'](socket);var jayson=require(_0x497e('0x13'));var client=jayson[_0x497e('0x14')][_0x497e('0x15')]({'port':0x232c});var client9002=jayson['client'][_0x497e('0x15')]({'port':0x232a});function checkPasswordPattern(_0x2449c1,_0x3a4412,_0x49bf9c){if(_0x49bf9c){var _0x55d464=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x55d464[_0x497e('0x16')](_0x3a4412)){return _0x2449c1;}else{throw new db[(_0x497e('0x17'))][(_0x497e('0x18'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2449c1;}}function respondWithRpcPromise(_0x1a5f84,_0x42ab9b,_0x4b3da5,_0x2bd315){return new BPromise(function(_0x8b7601,_0x2c715f){var _0x183dc4=_0x2bd315||client;return _0x183dc4['request'](_0x1a5f84,_0x4b3da5)[_0x497e('0x19')](function(_0x5eb439){logger[_0x497e('0x1a')](_0x497e('0x1b'),_0x42ab9b,_0x497e('0x1c'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x42ab9b,'request\x20sent',JSON['stringify'](_0x5eb439));if(_0x5eb439[_0x497e('0x1d')]){if(_0x5eb439[_0x497e('0x1d')]['code']===0x1f4){logger[_0x497e('0x1d')](_0x497e('0x1b'),_0x42ab9b,_0x5eb439[_0x497e('0x1d')][_0x497e('0x1e')]);return _0x2c715f(_0x5eb439[_0x497e('0x1d')][_0x497e('0x1e')]);}logger[_0x497e('0x1d')]('SmsMessage,\x20%s,\x20%s',_0x42ab9b,_0x5eb439[_0x497e('0x1d')][_0x497e('0x1e')]);return _0x8b7601(_0x5eb439[_0x497e('0x1d')]['message']);}else{logger[_0x497e('0x1a')]('SmsMessage,\x20%s,\x20%s',_0x42ab9b,'request\x20sent');_0x8b7601(_0x5eb439[_0x497e('0x1f')][_0x497e('0x1e')]);}})['catch'](function(_0x59536e){logger[_0x497e('0x1d')](_0x497e('0x1b'),_0x42ab9b,_0x59536e);_0x2c715f(_0x59536e);});});}function respondWithStatusCode(_0x216ebc,_0x2a3eda){_0x2a3eda=_0x2a3eda||0xcc;return function(_0x4fc241){if(_0x4fc241){return _0x216ebc[_0x497e('0x20')](_0x2a3eda);}return _0x216ebc[_0x497e('0x21')](_0x2a3eda)[_0x497e('0x22')]();};}function respondWithResult(_0x24abf9,_0x2fe6e4){_0x2fe6e4=_0x2fe6e4||0xc8;return function(_0x264af7){if(_0x264af7){return _0x24abf9[_0x497e('0x21')](_0x2fe6e4)[_0x497e('0x23')](_0x264af7);}};}function respondWithFilteredResult(_0x198bd7,_0x4768d3){return function(_0x25b0a9){if(_0x25b0a9){var _0x322ca2=_0x25b0a9[_0x497e('0x24')],_0x376a3f=_0x4768d3[_0x497e('0x25')],_0x81f803=_0x4768d3[_0x497e('0x25')]+_0x4768d3[_0x497e('0x26')],_0xd64c57;if(_0x81f803>=_0x322ca2){_0x81f803=_0x322ca2;_0xd64c57=0xc8;}else{_0xd64c57=0xce;}_0x198bd7[_0x497e('0x21')](_0xd64c57);return _0x198bd7[_0x497e('0x27')](_0x497e('0x28'),_0x376a3f+'-'+_0x81f803+'/'+_0x322ca2)[_0x497e('0x23')](_0x25b0a9);}return null;};}function patchUpdates(_0x3d73fd){return function(_0x5046d4){try{jsonpatch['apply'](_0x5046d4,_0x3d73fd,!![]);}catch(_0x53c64a){return BPromise['reject'](_0x53c64a);}return _0x5046d4[_0x497e('0x29')]();};}function saveUpdates(_0x484ff4,_0x14c850){return function(_0x7b14b8){if(_0x7b14b8){return _0x7b14b8['update'](_0x484ff4)[_0x497e('0x19')](function(_0x40749b){return _0x40749b;});}return null;};}function removeEntity(_0x33db1d,_0x3fa3f0){return function(_0x5a2105){if(_0x5a2105){return _0x5a2105[_0x497e('0x2a')]()['then'](function(){_0x33db1d[_0x497e('0x21')](0xcc)[_0x497e('0x22')]();});}};}function handleEntityNotFound(_0x478b5e,_0x1d13f4){return function(_0x24f8cf){if(!_0x24f8cf){_0x478b5e[_0x497e('0x20')](0x194);}return _0x24f8cf;};}function handleError(_0x450ad4,_0x484320){_0x484320=_0x484320||0x1f4;return function(_0x41236b){logger[_0x497e('0x1d')](_0x41236b[_0x497e('0x2b')]);if(_0x41236b[_0x497e('0x2c')]){delete _0x41236b[_0x497e('0x2c')];}_0x450ad4[_0x497e('0x21')](_0x484320)[_0x497e('0x2d')](_0x41236b);};}exports[_0x497e('0x2e')]=function(_0x149bae,_0x422757){var _0x43427f={},_0x1871bc={},_0xb2bef9={'count':0x0,'rows':[]};var _0x189292=_['map'](db[_0x497e('0x2f')][_0x497e('0x30')],function(_0x1168a1){return{'name':_0x1168a1[_0x497e('0x31')],'type':_0x1168a1['type'][_0x497e('0x32')]};});_0x1871bc[_0x497e('0x33')]=_[_0x497e('0x34')](_0x189292,_0x497e('0x2c'));_0x1871bc[_0x497e('0x35')]=_[_0x497e('0x36')](_0x149bae['query']);_0x1871bc['filters']=_[_0x497e('0x37')](_0x1871bc[_0x497e('0x33')],_0x1871bc[_0x497e('0x35')]);_0x43427f[_0x497e('0x38')]=_[_0x497e('0x37')](_0x1871bc['model'],qs[_0x497e('0x39')](_0x149bae[_0x497e('0x35')][_0x497e('0x39')]));_0x43427f[_0x497e('0x38')]=_0x43427f[_0x497e('0x38')][_0x497e('0x3a')]?_0x43427f[_0x497e('0x38')]:_0x1871bc['model'];if(!_0x149bae['query']['hasOwnProperty'](_0x497e('0x3b'))){_0x43427f[_0x497e('0x26')]=qs[_0x497e('0x26')](_0x149bae['query'][_0x497e('0x26')]);_0x43427f[_0x497e('0x25')]=qs[_0x497e('0x25')](_0x149bae[_0x497e('0x35')][_0x497e('0x25')]);}_0x43427f[_0x497e('0x3c')]=qs[_0x497e('0x3d')](_0x149bae[_0x497e('0x35')][_0x497e('0x3d')]);_0x43427f['where']=qs[_0x497e('0x3e')](_[_0x497e('0x3f')](_0x149bae[_0x497e('0x35')],_0x1871bc[_0x497e('0x3e')]));if(_0x149bae[_0x497e('0x35')][_0x497e('0x40')]){_0x43427f[_0x497e('0x41')]=_[_0x497e('0x42')](_0x43427f['where'],{'$or':_['map'](_0x189292,function(_0x52066d){if(_0x52066d[_0x497e('0x43')]!==_0x497e('0x44')){var _0x53a786={};_0x53a786[_0x52066d[_0x497e('0x2c')]]={'$like':'%'+_0x149bae['query'][_0x497e('0x40')]+'%'};return _0x53a786;}})});}_0x43427f=_[_0x497e('0x42')]({},_0x43427f,_0x149bae['options']);var _0x2c9a32={'where':_0x43427f[_0x497e('0x41')]};return db[_0x497e('0x2f')][_0x497e('0x24')](_0x2c9a32)[_0x497e('0x19')](function(_0x31ed96){_0xb2bef9[_0x497e('0x24')]=_0x31ed96;if(_0x149bae[_0x497e('0x35')][_0x497e('0x45')]){_0x43427f[_0x497e('0x46')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x43427f);})['then'](function(_0x1ede44){_0xb2bef9[_0x497e('0x47')]=_0x1ede44;return _0xb2bef9;})['then'](respondWithFilteredResult(_0x422757,_0x43427f))[_0x497e('0x48')](handleError(_0x422757,null));};exports[_0x497e('0x49')]=function(_0x45d8ab,_0x56b381){var _0x8c32c0={'raw':!![],'where':{'id':_0x45d8ab['params']['id']}},_0x20c146={};_0x20c146[_0x497e('0x33')]=_[_0x497e('0x36')](db[_0x497e('0x2f')][_0x497e('0x30')]);_0x20c146[_0x497e('0x35')]=_[_0x497e('0x36')](_0x45d8ab['query']);_0x20c146[_0x497e('0x3e')]=_[_0x497e('0x37')](_0x20c146[_0x497e('0x33')],_0x20c146[_0x497e('0x35')]);_0x8c32c0[_0x497e('0x38')]=_[_0x497e('0x37')](_0x20c146[_0x497e('0x33')],qs['fields'](_0x45d8ab['query'][_0x497e('0x39')]));_0x8c32c0[_0x497e('0x38')]=_0x8c32c0[_0x497e('0x38')][_0x497e('0x3a')]?_0x8c32c0[_0x497e('0x38')]:_0x20c146[_0x497e('0x33')];if(_0x45d8ab[_0x497e('0x35')][_0x497e('0x45')]){_0x8c32c0['include']=[{'all':!![]}];}_0x8c32c0=_[_0x497e('0x42')]({},_0x8c32c0,_0x45d8ab[_0x497e('0x4a')]);return db['SmsMessage']['find'](_0x8c32c0)[_0x497e('0x19')](handleEntityNotFound(_0x56b381,null))[_0x497e('0x19')](respondWithResult(_0x56b381,null))['catch'](handleError(_0x56b381,null));};exports[_0x497e('0x4b')]=function(_0x1b9d53,_0x237e77){return db[_0x497e('0x2f')][_0x497e('0x4b')](_0x1b9d53[_0x497e('0x4c')],{})[_0x497e('0x19')](respondWithResult(_0x237e77,0xc9))[_0x497e('0x48')](handleError(_0x237e77,null));};exports[_0x497e('0x4d')]=function(_0x32ea23,_0x435944){if(_0x32ea23[_0x497e('0x4c')]['id']){delete _0x32ea23['body']['id'];}return db[_0x497e('0x2f')][_0x497e('0x4e')]({'where':{'id':_0x32ea23[_0x497e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x435944,null))[_0x497e('0x19')](saveUpdates(_0x32ea23['body'],null))[_0x497e('0x19')](respondWithResult(_0x435944,null))[_0x497e('0x48')](handleError(_0x435944,null));};exports['destroy']=function(_0xd0ffd7,_0x34b0be){return db[_0x497e('0x2f')]['find']({'where':{'id':_0xd0ffd7[_0x497e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x34b0be,null))[_0x497e('0x19')](removeEntity(_0x34b0be,null))['catch'](handleError(_0x34b0be,null));};exports[_0x497e('0x50')]=function(_0xaad0af,_0x53ae04){return db[_0x497e('0x2f')]['describe']()[_0x497e('0x19')](respondWithResult(_0x53ae04,null))[_0x497e('0x48')](handleError(_0x53ae04,null));};var interaction_log=require(_0x497e('0xd'))('sms-interactions');exports[_0x497e('0x51')]=function(_0x10a9a8,_0x2fa2aa,_0x1cd8f1){var _0x51a4e8={'channel':_0x497e('0x52')};if(_0x10a9a8[_0x497e('0x4c')]['id']){delete _0x10a9a8[_0x497e('0x4c')]['id'];}_0x10a9a8[_0x497e('0x4c')][_0x497e('0x53')]=!![];_0x10a9a8[_0x497e('0x4c')]['readAt']=moment()['format'](_0x497e('0x54'));_0x10a9a8[_0x497e('0x4c')][_0x497e('0x55')]=_0x10a9a8['body']['UserId']||_0x10a9a8['user']['id'];return db[_0x497e('0x2f')][_0x497e('0x4e')]({'where':{'id':_0x10a9a8[_0x497e('0x4f')]['id'],'UserId':null},'include':[{'model':db[_0x497e('0x56')],'as':_0x497e('0x57')}]})[_0x497e('0x19')](handleEntityNotFound(_0x2fa2aa,null))[_0x497e('0x19')](saveUpdates(_0x10a9a8[_0x497e('0x4c')],null))['then'](function(_0x1e5cd4){if(_0x1e5cd4){_0x51a4e8[_0x497e('0x1e')]=_0x1e5cd4[_0x497e('0x58')]({'plain':!![]});return db[_0x497e('0x59')][_0x497e('0x4e')]({'where':{'id':_0x1e5cd4[_0x497e('0x5a')]}});}return null;})[_0x497e('0x19')](handleEntityNotFound(_0x2fa2aa,null))['then'](function(_0x5efa44){if(_0x5efa44){return _0x5efa44[_0x497e('0x4d')]({'UserId':_0x10a9a8[_0x497e('0x4c')]['UserId'],'read1stAt':_[_0x497e('0x5b')](_0x5efa44[_0x497e('0x5c')])?moment()['format'](_0x497e('0x54')):undefined});}return null;})[_0x497e('0x19')](function(_0x38acaa){if(_0x38acaa){_0x51a4e8[_0x497e('0x5d')]=_0x38acaa[_0x497e('0x58')]({'plain':!![]});interaction_log[_0x497e('0x1a')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x10a9a8[_0x497e('0x5e')]['id'],_0x10a9a8[_0x497e('0x5e')][_0x497e('0x2c')],_0x10a9a8['user'][_0x497e('0x5f')],_0x51a4e8[_0x497e('0x5d')]['id'],_0x10a9a8[_0x497e('0x4c')]?JSON[_0x497e('0x60')](_0x10a9a8[_0x497e('0x4c')]):_0x497e('0x61'));return respondWithRpcPromise(_0x497e('0x62'),_0x497e('0x63'),_0x51a4e8);}return null;})[_0x497e('0x19')](function(_0x2cdc23){if(_0x2cdc23){if(_0x10a9a8[_0x497e('0x4c')]['manual']){_0x51a4e8[_0x497e('0x1e')][_0x497e('0x64')]=util[_0x497e('0x65')](_0x497e('0x66'),_0x10a9a8[_0x497e('0x5e')]['name']);_0x51a4e8[_0x497e('0x1e')]['channel']=_0x51a4e8[_0x497e('0x67')];_0x51a4e8[_0x497e('0x1e')]['event']='accept';return respondWithRpcPromise(_0x497e('0x68'),'EventManager',{'event':_0x497e('0x69'),'message':_0x51a4e8[_0x497e('0x1e')]},client9002)[_0x497e('0x19')](function(){return _0x51a4e8;});}return _0x51a4e8;}return null;})[_0x497e('0x19')](respondWithResult(_0x2fa2aa,null))[_0x497e('0x48')](handleError(_0x2fa2aa,null));};var interaction_log=require(_0x497e('0xd'))(_0x497e('0x6a'));exports[_0x497e('0x6b')]=function(_0x5392e4,_0x149d2e,_0x54ee6a){var _0x3251be={'agent':{},'channel':_0x497e('0x52')};if(_0x5392e4['body']['id']){delete _0x5392e4[_0x497e('0x4c')]['id'];}_0x5392e4[_0x497e('0x4c')][_0x497e('0x55')]=_0x5392e4['body']['UserId']||_0x5392e4[_0x497e('0x5e')]['id'];_0x3251be['agent']['id']=_0x5392e4[_0x497e('0x4c')][_0x497e('0x55')];return db[_0x497e('0x2f')][_0x497e('0x4e')]({'where':{'id':_0x5392e4[_0x497e('0x4f')]['id'],'UserId':null}})[_0x497e('0x19')](handleEntityNotFound(_0x149d2e,null))[_0x497e('0x19')](function(_0x564766){if(_0x564766){_0x3251be[_0x497e('0x1e')]=_0x564766['get']({'plain':!![]});return db[_0x497e('0x59')][_0x497e('0x4e')]({'where':{'id':_0x564766['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x149d2e,null))[_0x497e('0x19')](function(_0x1edfde){if(_0x1edfde){_0x3251be[_0x497e('0x5d')]=_0x1edfde[_0x497e('0x58')]({'plain':!![]});interaction_log[_0x497e('0x1a')](_0x497e('0x6c'),_0x5392e4[_0x497e('0x5e')]['id'],_0x5392e4['user']['name'],_0x5392e4['user'][_0x497e('0x5f')],_0x3251be[_0x497e('0x5d')]['id'],_0x5392e4[_0x497e('0x4c')]?JSON[_0x497e('0x60')](_0x5392e4[_0x497e('0x4c')]):_0x497e('0x61'));return respondWithRpcPromise(_0x497e('0x6d'),_0x497e('0x6e'),_0x3251be);}return null;})[_0x497e('0x19')](function(_0x5e2a17){if(_0x5e2a17){_0x5e2a17[_0x497e('0x1e')][_0x497e('0x64')]=util[_0x497e('0x65')](_0x497e('0x66'),_0x5392e4[_0x497e('0x5e')][_0x497e('0x2c')]);_0x5e2a17['message'][_0x497e('0x67')]=_0x3251be[_0x497e('0x67')];_0x5e2a17['message']['event']=_0x497e('0x6b');respondWithRpcPromise('EventManager',_0x497e('0x68'),{'event':_0x497e('0x6f'),'message':_0x5e2a17[_0x497e('0x1e')]},client9002);return _0x3251be;}return null;})[_0x497e('0x19')](respondWithResult(_0x149d2e,null))['catch'](handleError(_0x149d2e,null));};exports['status']=function(_0x1771e5,_0xe44011,_0x44b001){if(_0x1771e5[_0x497e('0x4c')]['id']){delete _0x1771e5['body']['id'];}var _0x2f62cf;return db['SmsMessage'][_0x497e('0x4e')]({'where':{'id':_0x1771e5[_0x497e('0x4f')]['id']}})[_0x497e('0x19')](handleEntityNotFound(_0xe44011,null))[_0x497e('0x19')](function(_0x12f389){if(_0x12f389){_0x2f62cf=_0x12f389;return db[_0x497e('0x70')]['find']({'where':{'id':_0x12f389[_0x497e('0x71')]}});}})['then'](handleEntityNotFound(_0xe44011,null))[_0x497e('0x19')](function(_0x175f30){if(_0x175f30){logger[_0x497e('0x72')](_0x497e('0x73'),_0x497e('0x21'),_0x497e('0x74'),_0x175f30[_0x497e('0x43')],util[_0x497e('0x75')](_0x1771e5['body'],{'showHidden':![],'depth':null}));switch(_0x175f30['type']){case _0x497e('0x76'):if(_0x1771e5[_0x497e('0x4c')][_0x497e('0x77')]&&_0x1771e5[_0x497e('0x4c')]['MessageSid']===_0x2f62cf[_0x497e('0x78')]){return _0x2f62cf['update']({'read':!![]});}else{logger[_0x497e('0x1d')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x497e('0x21'),'twilio',util[_0x497e('0x75')](_0x1771e5['body'],{'showHidden':![],'depth':null}));}break;case _0x497e('0x79'):if(_0x1771e5[_0x497e('0x4c')][_0x497e('0x7a')]&&_0x1771e5[_0x497e('0x4c')][_0x497e('0x7a')]===_0x2f62cf[_0x497e('0x78')]&&_[_0x497e('0x7b')]([_0x497e('0x7c'),_0x497e('0x7d')],_0x1771e5['body'][_0x497e('0x7e')])>=0x0){return _0x2f62cf[_0x497e('0x4d')]({'read':!![]});}else{logger[_0x497e('0x1d')](_0x497e('0x7f'),'status',_0x497e('0x80'),util[_0x497e('0x75')](_0x1771e5[_0x497e('0x4c')],{'showHidden':![],'depth':null}));}break;case _0x497e('0x81'):var _0x482570=_0x1771e5[_0x497e('0x4c')][_0x497e('0x82')][0x0];if(_0x482570[_0x497e('0x21')][_0x497e('0x83')]===_0x497e('0x84')){return _0x2f62cf['update']({'read':!![]});}else{logger[_0x497e('0x1d')](_0x497e('0x7f'),_0x497e('0x21'),_0x497e('0x81'),util[_0x497e('0x75')](_0x1771e5[_0x497e('0x4c')],{'showHidden':![],'depth':null}));}break;}return _0x2f62cf;}})[_0x497e('0x19')](respondWithResult(_0xe44011,null))[_0x497e('0x48')](handleError(_0xe44011,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 754d56b..a81835a 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 _0x4859=['../../mysqldb','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5cf817,_0x1e6449){var _0x134e04=function(_0x3419ca){while(--_0x3419ca){_0x5cf817['push'](_0x5cf817['shift']());}};_0x134e04(++_0x1e6449);}(_0x4859,0xb8));var _0x9485=function(_0x38af9c,_0x1a28bb){_0x38af9c=_0x38af9c-0x0;var _0xbf220c=_0x4859[_0x38af9c];return _0xbf220c;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x9485('0x0'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9485('0x1'),'afterUpdate':_0x9485('0x2'),'afterDestroy':_0x9485('0x3')};function emitEvent(_0x126411){return function(_0x2b5313,_0x240e41,_0x1a5ac4){SmsMessageEvents[_0x9485('0x4')](_0x126411+':'+_0x2b5313['id'],_0x2b5313);SmsMessageEvents[_0x9485('0x4')](_0x126411,_0x2b5313);_0x1a5ac4(null);};}for(var e in events){if(events[_0x9485('0x5')](e)){var event=events[e];SmsMessage[_0x9485('0x6')](e,emitEvent(event));}}module[_0x9485('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x60f3=['update','emit','hasOwnProperty','hook','events','../../mysqldb','SmsMessage','setMaxListeners','save'];(function(_0x263f4c,_0x438626){var _0x3a78d3=function(_0xbdb00f){while(--_0xbdb00f){_0x263f4c['push'](_0x263f4c['shift']());}};_0x3a78d3(++_0x438626);}(_0x60f3,0x1f3));var _0x360f=function(_0x312abc,_0x17f25c){_0x312abc=_0x312abc-0x0;var _0x314298=_0x60f3[_0x312abc];return _0x314298;};'use strict';var EventEmitter=require(_0x360f('0x0'));var SmsMessage=require(_0x360f('0x1'))['db'][_0x360f('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x360f('0x3')](0x0);var events={'afterCreate':_0x360f('0x4'),'afterUpdate':_0x360f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x240aa3){return function(_0x3dd0ca,_0x1cb25b,_0x3f880e){SmsMessageEvents[_0x360f('0x6')](_0x240aa3+':'+_0x3dd0ca['id'],_0x3dd0ca);SmsMessageEvents[_0x360f('0x6')](_0x240aa3,_0x3dd0ca);_0x3f880e(null);};}for(var e in events){if(events[_0x360f('0x7')](e)){var event=events[e];SmsMessage[_0x360f('0x8')](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 ad376d4..8819ee8 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 _0x9abf=['data','queued_count','clickSend','plivo','authId','remote','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','infobip','baseUrl','token','application/json','Missing\x20parameters:\x20base_url','csc','apiKey','login','text','timestamp','keys','sort','createHash','digest','hex','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','intelepeer','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','Token\x20not\x20received','finally','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','catch','error','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','messages','phone','/api/sms/messages/','/status?token=','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','total_sent','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/send/','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code'];(function(_0x449699,_0x428665){var _0x2f0414=function(_0x2f0957){while(--_0x2f0957){_0x449699['push'](_0x449699['shift']());}};_0x2f0414(++_0x428665);}(_0x9abf,0x104));var _0xf9ab=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9abf[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf9ab('0x0'))(_0xf9ab('0x1'));var moment=require(_0xf9ab('0x2'));var BPromise=require(_0xf9ab('0x3'));var rp=require(_0xf9ab('0x4'));var fs=require('fs');var path=require(_0xf9ab('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0xf9ab('0x6')]=function(_0x531e8d,_0x5c503f){return _0x531e8d[_0xf9ab('0x7')](_0xf9ab('0x8'),attributes,{'tableName':_0xf9ab('0x9'),'paranoid':![],'indexes':[{'name':_0xf9ab('0xa'),'fields':[_0xf9ab('0xa')]},{'name':_0xf9ab('0xb'),'fields':[_0xf9ab('0xc')],'type':_0xf9ab('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4e4712,_0x46d90c,_0x57d003){var _0x3bd975=_0x531e8d['models'];var _0x394dab=_0x4e4712['get']({'plain':!![]});if(_0x394dab[_0xf9ab('0xe')][_0xf9ab('0xf')]()==='in'||_0x394dab[_0xf9ab('0xe')]['toLowerCase']()===_0xf9ab('0x10')&&!_0x394dab[_0xf9ab('0x11')]&&!_[_0xf9ab('0x12')](_0x394dab[_0xf9ab('0x13')])){_0x3bd975[_0xf9ab('0x14')][_0xf9ab('0x15')]({'where':{'id':_0x394dab[_0xf9ab('0x16')]}})[_0xf9ab('0x17')](function(_0x2e566f){if(_0x2e566f){_0x2e566f[_0xf9ab('0x18')]({'lastMsgAt':_0x394dab['createdAt'],'lastMsgDirection':_0x394dab['direction']['toLowerCase']()});}})[_0xf9ab('0x19')](function(_0x27fa7e){console[_0xf9ab('0x1a')](_0x27fa7e);});}if(_0x394dab['direction']==='out'&&!_0x394dab[_0xf9ab('0x11')]){var _0x2e0e14;_0x3bd975[_0xf9ab('0x1b')]['find']({'where':{'id':_0x394dab[_0xf9ab('0x1c')]},'raw':!![]})['then'](function(_0x36d796){_0x2e0e14=_0x36d796;if(_0x2e0e14&&_0x2e0e14[_0xf9ab('0x1d')]){switch(_0x2e0e14['type']){case _0xf9ab('0x1e'):var _0x5a6306=require(_0xf9ab('0x1e'));if(_0x2e0e14[_0xf9ab('0x1f')]&&_0x2e0e14[_0xf9ab('0x20')]&&_0x2e0e14['phone']){var _0xd51bd9=new _0x5a6306(_0x2e0e14['accountSid'],_0x2e0e14[_0xf9ab('0x20')]);_0xd51bd9[_0xf9ab('0x21')]['create']({'body':_0x394dab[_0xf9ab('0xc')],'to':_0x394dab[_0xf9ab('0x22')],'from':_0x2e0e14['phone'],'statusCallback':_0x2e0e14['remote']+_0xf9ab('0x23')+_0x394dab['id']+_0xf9ab('0x24')+_0x2e0e14['token']})[_0xf9ab('0x17')](function(_0x3326bd){if(_0x3326bd['sid']){return _0x4e4712[_0xf9ab('0x18')]({'messageId':_0x3326bd['sid']});}})[_0xf9ab('0x19')](function(_0x45daa1){logger[_0xf9ab('0x1a')](_0xf9ab('0x25'),_0xf9ab('0x26'),_0xf9ab('0x1e'),util[_0xf9ab('0x27')](_0x45daa1,{'showHidden':![],'depth':null}));});}else{logger[_0xf9ab('0x1a')](_0xf9ab('0x25'),_0xf9ab('0x26'),'twilio',_0xf9ab('0x28'));}break;case'skebby':var _0x7735a0=_0xf9ab('0x29');if(_0x2e0e14[_0xf9ab('0x2a')]&&_0x2e0e14[_0xf9ab('0x2b')]){var _0x370a8e={'recipient':[_0x394dab[_0xf9ab('0x22')]],'message':_0x394dab[_0xf9ab('0xc')],'message_type':_0x2e0e14[_0xf9ab('0x2c')]};if(_0x2e0e14[_0xf9ab('0x2c')]&&_0x2e0e14['smsMethod']!=='SI'){_0x370a8e[_0xf9ab('0x2d')]=_0x2e0e14[_0xf9ab('0x22')];}var _0x229215={'url':_0x7735a0+_0xf9ab('0x2e')+_0x2e0e14[_0xf9ab('0x2a')]+_0xf9ab('0x2f')+_0x2e0e14[_0xf9ab('0x2b')],'method':_0xf9ab('0x30')};rp(_0x229215)[_0xf9ab('0x17')](function(_0x3a53f9){var _0x14051f=_0x3a53f9[_0xf9ab('0x31')](';');var _0x4f78a1={'user_key':_0x14051f[0x0],'session_key':_0x14051f[0x1]};_0x229215={'url':_0x7735a0+_0xf9ab('0x32'),'method':_0xf9ab('0x33'),'headers':{'user_key':_0x4f78a1[_0xf9ab('0x34')],'Session_key':_0x4f78a1['session_key']},'json':!![],'body':_0x370a8e};return rp(_0x229215);})['then'](function(_0x5c7cbc){if(_0x5c7cbc[_0xf9ab('0x35')]>=0x1){var _0x31930f={'messageId':_0x5c7cbc[_0xf9ab('0x36')]};if(_0x2e0e14['smsMethod']!=='GP'||!_0x2e0e14[_0xf9ab('0x37')]){_0x31930f[_0xf9ab('0x38')]=!![];}return _0x4e4712['update'](_0x31930f);}else{return logger[_0xf9ab('0x1a')](_0xf9ab('0x25'),_0xf9ab('0x26'),'skebby',util['inspect'](_0x5c7cbc,{'showHidden':![],'depth':null}));}})[_0xf9ab('0x19')](function(_0x460a6f){return logger[_0xf9ab('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf9ab('0x26'),'skebby',util[_0xf9ab('0x27')](_0x460a6f,{'showHidden':![],'depth':null}));});}else{logger[_0xf9ab('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf9ab('0x26'),_0xf9ab('0x39'),_0xf9ab('0x3a'));}break;case'connectel':if(_0x2e0e14['authToken']){var _0x568ada={'recipient':_0x394dab[_0xf9ab('0x22')],'message':_0x394dab['body'],'sender':_0x2e0e14[_0xf9ab('0x3b')]||_0x2e0e14[_0xf9ab('0x22')],'authorization':_0x2e0e14[_0xf9ab('0x20')]};var _0x46d90c={'method':'POST','uri':_0xf9ab('0x3c'),'body':_0x568ada,'json':!![]};rp(_0x46d90c)[_0xf9ab('0x17')](function(_0x42905a){var _0x280ae4={'messageId':_0x42905a[_0xf9ab('0x3d')]};if(!_0x2e0e14[_0xf9ab('0x37')]){_0x280ae4[_0xf9ab('0x38')]=!![];}return _0x4e4712['update'](_0x280ae4);})[_0xf9ab('0x19')](function(_0x10733b){logger[_0xf9ab('0x1a')](_0xf9ab('0x25'),_0xf9ab('0x26'),'connectel',util[_0xf9ab('0x27')](_0x10733b,{'showHidden':![],'depth':null}));});}else{logger[_0xf9ab('0x1a')](_0xf9ab('0x25'),_0xf9ab('0x26'),_0xf9ab('0x3e'),_0xf9ab('0x3f'));}break;case _0xf9ab('0x40'):if(_0x2e0e14[_0xf9ab('0x2a')]&&_0x2e0e14[_0xf9ab('0x2b')]){var _0x568ada={'messages':[{'source':_0xf9ab('0x41'),'to':_0x394dab[_0xf9ab('0x22')],'body':_0x394dab['body'],'from':_0x2e0e14[_0xf9ab('0x3b')]||_0x2e0e14[_0xf9ab('0x22')]}]};var _0x5024ce=util[_0xf9ab('0x42')](_0xf9ab('0x43'),_0x2e0e14['username'],_0x2e0e14[_0xf9ab('0x2b')]);var _0x46d90c={'method':'POST','uri':_0xf9ab('0x44'),'body':_0x568ada,'headers':{'Authorization':util[_0xf9ab('0x42')](_0xf9ab('0x45'),new Buffer(_0x5024ce)[_0xf9ab('0x46')](_0xf9ab('0x47')))},'json':!![]};rp(_0x46d90c)[_0xf9ab('0x17')](function(_0x106f82){if(_0x106f82[_0xf9ab('0x48')]>=0xc8&&_0x106f82['http_code']<=0xce){if(_0x106f82[_0xf9ab('0x49')]&&_0x106f82['data'][_0xf9ab('0x4a')]>0x0){var _0x422aed=_['head'](_0x106f82[_0xf9ab('0x49')]['messages']);var _0x5d3664={'messageId':_0x422aed['message_id']};if(!_0x2e0e14[_0xf9ab('0x37')]){_0x5d3664[_0xf9ab('0x38')]=!![];}return _0x4e4712[_0xf9ab('0x18')](_0x5d3664);}else{logger[_0xf9ab('0x1a')](_0xf9ab('0x25'),_0xf9ab('0x26'),_0xf9ab('0x4b'),util['inspect'](_0x106f82,{'showHidden':![],'depth':null}));}}else{logger[_0xf9ab('0x1a')](_0xf9ab('0x25'),'afterCreate','clickSend',util['inspect'](_0x106f82,{'showHidden':![],'depth':null}));}})['catch'](function(_0x49a7bc){logger[_0xf9ab('0x1a')](_0xf9ab('0x25'),_0xf9ab('0x26'),_0xf9ab('0x4b'),util[_0xf9ab('0x27')](_0x49a7bc,{'showHidden':![],'depth':null}));});}else{logger[_0xf9ab('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf9ab('0x26'),'clickSend',_0xf9ab('0x3a'));}break;case _0xf9ab('0x4c'):if(_0x2e0e14[_0xf9ab('0x4d')]&&_0x2e0e14[_0xf9ab('0x20')]){var _0x568ada={'dst':_0x394dab[_0xf9ab('0x22')],'text':_0x394dab['body'],'src':_0x2e0e14['senderString']||_0x2e0e14[_0xf9ab('0x22')],'url':_0x2e0e14[_0xf9ab('0x4e')]+'/api/sms/messages/'+_0x394dab['id']+_0xf9ab('0x24')+_0x2e0e14['token']};var _0x5024ce=util['format'](_0xf9ab('0x43'),_0x2e0e14['authId'],_0x2e0e14[_0xf9ab('0x20')]);var _0x46d90c={'method':'POST','uri':util[_0xf9ab('0x42')](_0xf9ab('0x4f'),_0x2e0e14[_0xf9ab('0x4d')]),'body':_0x568ada,'headers':{'Authorization':util[_0xf9ab('0x42')](_0xf9ab('0x45'),new Buffer(_0x5024ce)['toString'](_0xf9ab('0x47')))},'json':!![]};rp(_0x46d90c)[_0xf9ab('0x17')](function(_0x4d585c){var _0xc957c9={'messageId':_0x4d585c[_0xf9ab('0x50')][0x0]};return _0x4e4712['update'](_0xc957c9);})[_0xf9ab('0x19')](function(_0x5f5269){logger[_0xf9ab('0x1a')](_0xf9ab('0x25'),_0xf9ab('0x26'),_0xf9ab('0x4c'),util['inspect'](_0x5f5269,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf9ab('0x25'),_0xf9ab('0x26'),_0xf9ab('0x4c'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xf9ab('0x51'):if(_0x2e0e14['username']&&_0x2e0e14[_0xf9ab('0x2b')]){if(_0x2e0e14[_0xf9ab('0x52')]){var _0x64f413={'method':_0xf9ab('0x33'),'uri':_0x2e0e14['baseUrl']+'/auth/1/session','body':{'username':_0x2e0e14[_0xf9ab('0x2a')],'password':_0x2e0e14[_0xf9ab('0x2b')]},'json':!![]};return rp(_0x64f413)[_0xf9ab('0x17')](function(_0x2abf03){var _0x513124={'method':_0xf9ab('0x33'),'uri':_0x2e0e14[_0xf9ab('0x52')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x2e0e14[_0xf9ab('0x22')],'destinations':[{'to':_0x394dab[_0xf9ab('0x22')]}],'text':_0x394dab[_0xf9ab('0xc')],'notifyUrl':_0x2e0e14[_0xf9ab('0x4e')]+_0xf9ab('0x23')+_0x394dab['id']+_0xf9ab('0x24')+_0x2e0e14[_0xf9ab('0x53')],'notifyContentType':_0xf9ab('0x54'),'callbackData':_0x2e0e14[_0xf9ab('0x22')]+';'+_0x394dab[_0xf9ab('0xc')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x2abf03[_0xf9ab('0x53')]},'json':!![]};return rp(_0x513124)['then'](function(_0x264ad6){if(_0x264ad6[_0xf9ab('0x21')]){var _0x6c291b={'messageId':_0x264ad6[_0xf9ab('0x21')][0x0][_0xf9ab('0xa')]};if(!_0x2e0e14[_0xf9ab('0x37')]){_0x6c291b[_0xf9ab('0x38')]=!![];}return _0x4e4712['update'](_0x6c291b);}else{return logger[_0xf9ab('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf9ab('0x26'),_0xf9ab('0x51'),util[_0xf9ab('0x27')](_0x264ad6,{'showHidden':![],'depth':null}));}});})[_0xf9ab('0x19')](function(_0x13eb39){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf9ab('0x26'),_0xf9ab('0x51'),util['inspect'](_0x13eb39,{'showHidden':![],'depth':null}));});}else{logger[_0xf9ab('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf9ab('0x26'),_0xf9ab('0x51'),_0xf9ab('0x55'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf9ab('0x26'),'infobip',_0xf9ab('0x3a'));}break;case _0xf9ab('0x56'):var _0x47f069=require('crypto');if(_0x2e0e14[_0xf9ab('0x57')]){var _0x16d4ec={};_0x16d4ec[_0xf9ab('0x58')]=_0x2e0e14[_0xf9ab('0x2a')];_0x16d4ec['phone']=_0x394dab[_0xf9ab('0x22')];_0x16d4ec[_0xf9ab('0x2d')]=_0x2e0e14[_0xf9ab('0x22')];_0x16d4ec[_0xf9ab('0x59')]=_0x394dab[_0xf9ab('0xc')];_0x16d4ec[_0xf9ab('0x5a')]=+new Date();var _0x549308='';var _0x35b21d='';var _0x45a40f=Object[_0xf9ab('0x5b')](_0x16d4ec);_0x45a40f[_0xf9ab('0x5c')]();for(var _0x55b187=0x0;_0x55b187<_0x45a40f['length'];_0x55b187++){if(_0x549308!=''){_0x549308+='&';}_0x549308+=_0x45a40f[_0x55b187]+'='+encodeURIComponent(_0x16d4ec[_0x45a40f[_0x55b187]]);_0x35b21d+=_0x16d4ec[_0x45a40f[_0x55b187]];}_0x35b21d+=_0x2e0e14[_0xf9ab('0x57')];_0x35b21d=_0x47f069[_0xf9ab('0x5d')]('md5')[_0xf9ab('0x18')](_0x35b21d)[_0xf9ab('0x5e')](_0xf9ab('0x5f'));if(_0x549308!==''){_0x549308+='&';}_0x549308+='signature='+_0x35b21d;var _0x229215={'method':'GET','uri':_0x2e0e14[_0xf9ab('0x52')]+_0xf9ab('0x60')+_0x549308,'json':!![]};return rp(_0x229215)[_0xf9ab('0x17')](function(_0x9ac507){var _0x50cc0d=Object[_0xf9ab('0x5b')](_0x9ac507);if(_0x9ac507[_0x50cc0d[0x0]][_0xf9ab('0x1a')]&&parseInt(_0x9ac507[_0x50cc0d[0x0]][_0xf9ab('0x1a')])===0x0){var _0x1c9c06={'messageId':_0x9ac507[_0x50cc0d[0x0]]['id_sms']};if(!_0x2e0e14[_0xf9ab('0x37')]){_0x1c9c06[_0xf9ab('0x38')]=!![];}return _0x4e4712[_0xf9ab('0x18')](_0x1c9c06);}else{return logger[_0xf9ab('0x1a')](_0xf9ab('0x25'),_0xf9ab('0x26'),_0xf9ab('0x56'),util[_0xf9ab('0x27')](_0x9ac507[_0xf9ab('0x1a')],{'showHidden':![],'depth':null}));}})[_0xf9ab('0x19')](function(_0x42e3e1){return logger[_0xf9ab('0x1a')](_0xf9ab('0x25'),_0xf9ab('0x26'),_0xf9ab('0x56'),util['inspect'](_0x42e3e1,{'showHidden':![],'depth':null}));});}else{logger[_0xf9ab('0x1a')](_0xf9ab('0x25'),_0xf9ab('0x26'),'csc',_0xf9ab('0x61'));}break;case _0xf9ab('0x62'):if(_0x2e0e14[_0xf9ab('0x57')]){var _0x512f13={'method':_0xf9ab('0x33'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x2e0e14[_0xf9ab('0x57')]},'body':{'content':_0x394dab['body'],'to':[_0x394dab[_0xf9ab('0x22')]],'from':_0x2e0e14[_0xf9ab('0x22')],'binary':![],'clientMessageId':_0xf9ab('0x63'),'charset':_0xf9ab('0x64')},'json':!![]};rp(_0x512f13)['then'](function(_0x365a9d){if(!_0x365a9d[_0xf9ab('0x1a')]){var _0x4fa1a6={'messageId':_0x365a9d['messages'][0x0][_0xf9ab('0x65')]};if(!_0x2e0e14[_0xf9ab('0x37')]){_0x4fa1a6[_0xf9ab('0x38')]=!![];}return _0x4e4712['update'](_0x4fa1a6);}else{return logger[_0xf9ab('0x1a')](_0xf9ab('0x25'),'afterCreate',_0xf9ab('0x62'),util[_0xf9ab('0x27')](_0x365a9d[_0xf9ab('0x1a')],{'showHidden':![],'depth':null}));}})[_0xf9ab('0x19')](function(_0x1aa102){return logger[_0xf9ab('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf9ab('0x26'),_0xf9ab('0x62'),util[_0xf9ab('0x27')](_0x1aa102,{'showHidden':![],'depth':null}));});}else{logger[_0xf9ab('0x1a')](_0xf9ab('0x25'),_0xf9ab('0x26'),_0xf9ab('0x62'),'Missing\x20parameters:\x20apiKey');}break;case _0xf9ab('0x66'):if(_0x2e0e14[_0xf9ab('0x57')]){var _0x8c7bfa={};var _0x229215={'method':_0xf9ab('0x33'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x2e0e14[_0xf9ab('0x57')],'Content-Type':_0xf9ab('0x54')},'body':{'from':_0x2e0e14['phone'],'to':_0x394dab['phone'],'text':_0x394dab[_0xf9ab('0xc')]},'json':!![]};return rp(_0x229215)['then'](function(_0x328ddc){if(_0x328ddc[_0xf9ab('0x67')]==0xca){_0x8c7bfa[_0xf9ab('0x68')]=_0x328ddc;var _0x49aa11={'method':_0xf9ab('0x33'),'uri':_0xf9ab('0x69'),'headers':{'Authorization':_0xf9ab('0x6a')+_0x2e0e14['apiKey'],'Content-Type':_0xf9ab('0x54')},'body':{'refid':_0x8c7bfa[_0xf9ab('0x68')][_0xf9ab('0x6b')]},'json':!![]};return rp(_0x49aa11)['then'](function(_0x4dc447){_0x8c7bfa[_0xf9ab('0x6c')]=_0x4dc447;var _0x8ee959={'messageId':_0x8c7bfa[_0xf9ab('0x68')][_0xf9ab('0x6b')],'read':!![]};return _0x4e4712['update'](_0x8ee959);});}else{return logger['error'](_0xf9ab('0x25'),_0xf9ab('0x26'),_0xf9ab('0x66'),util[_0xf9ab('0x27')](_0x328ddc,{'showHidden':![],'depth':null}));}})['catch'](function(_0x401075){return logger[_0xf9ab('0x1a')](_0xf9ab('0x25'),_0xf9ab('0x26'),'intelepeer',util[_0xf9ab('0x27')](_0x401075,{'showHidden':![],'depth':null}));});}else{return logger[_0xf9ab('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf9ab('0x26'),_0xf9ab('0x66'),_0xf9ab('0x6d'));}break;}}})[_0xf9ab('0x6e')](function(){_0x57d003();});}else{_0x57d003();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc99c=['sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','error','secret','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','sid','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/send/','requestid','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','head','message_id','clickSend','plivo','authId','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','token','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','timestamp','keys','length','createHash','hex','signature=','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xc99c,0x70));var _0xcc99=function(_0x3e3c42,_0x4e24e2){_0x3e3c42=_0x3e3c42-0x0;var _0xd2a37d=_0xc99c[_0x3e3c42];return _0xd2a37d;};'use strict';var _=require(_0xcc99('0x0'));var util=require(_0xcc99('0x1'));var logger=require(_0xcc99('0x2'))('api');var moment=require(_0xcc99('0x3'));var BPromise=require(_0xcc99('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc99('0x5'));var rimraf=require(_0xcc99('0x6'));var config=require(_0xcc99('0x7'));var attributes=require(_0xcc99('0x8'));module[_0xcc99('0x9')]=function(_0x2163e7,_0x23f6bc){return _0x2163e7[_0xcc99('0xa')](_0xcc99('0xb'),attributes,{'tableName':_0xcc99('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xcc99('0xd')]},{'name':_0xcc99('0xe'),'fields':[_0xcc99('0xf')],'type':_0xcc99('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2956b8,_0x22afb8,_0x1ebe1a){var _0x49dab8=_0x2163e7[_0xcc99('0x11')];var _0x285a53=_0x2956b8[_0xcc99('0x12')]({'plain':!![]});if(_0x285a53[_0xcc99('0x13')][_0xcc99('0x14')]()==='in'||_0x285a53['direction'][_0xcc99('0x14')]()===_0xcc99('0x15')&&!_0x285a53['secret']&&!_[_0xcc99('0x16')](_0x285a53[_0xcc99('0x17')])){_0x49dab8[_0xcc99('0x18')][_0xcc99('0x19')]({'where':{'id':_0x285a53[_0xcc99('0x1a')]}})[_0xcc99('0x1b')](function(_0x3b2305){if(_0x3b2305){_0x3b2305[_0xcc99('0x1c')]({'lastMsgAt':_0x285a53[_0xcc99('0x1d')],'lastMsgDirection':_0x285a53[_0xcc99('0x13')][_0xcc99('0x14')]()});}})[_0xcc99('0x1e')](function(_0xcff861){console[_0xcc99('0x1f')](_0xcff861);});}if(_0x285a53['direction']===_0xcc99('0x15')&&!_0x285a53[_0xcc99('0x20')]){var _0x22596d;_0x49dab8['SmsAccount'][_0xcc99('0x21')]({'where':{'id':_0x285a53[_0xcc99('0x22')]},'raw':!![]})[_0xcc99('0x1b')](function(_0x1237d3){_0x22596d=_0x1237d3;if(_0x22596d&&_0x22596d[_0xcc99('0x23')]){switch(_0x22596d[_0xcc99('0x23')]){case _0xcc99('0x24'):var _0x147e41=require(_0xcc99('0x24'));if(_0x22596d[_0xcc99('0x25')]&&_0x22596d[_0xcc99('0x26')]&&_0x22596d[_0xcc99('0x27')]){var _0x25ba77=new _0x147e41(_0x22596d['accountSid'],_0x22596d[_0xcc99('0x26')]);_0x25ba77[_0xcc99('0x28')][_0xcc99('0x29')]({'body':_0x285a53[_0xcc99('0xf')],'to':_0x285a53[_0xcc99('0x27')],'from':_0x22596d[_0xcc99('0x27')],'statusCallback':_0x22596d[_0xcc99('0x2a')]+_0xcc99('0x2b')+_0x285a53['id']+_0xcc99('0x2c')+_0x22596d['token']})[_0xcc99('0x1b')](function(_0x29b6d5){if(_0x29b6d5['sid']){return _0x2956b8[_0xcc99('0x1c')]({'messageId':_0x29b6d5[_0xcc99('0x2d')]});}})[_0xcc99('0x1e')](function(_0x46b9a4){logger[_0xcc99('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcc99('0x2e'),'twilio',util[_0xcc99('0x2f')](_0x46b9a4,{'showHidden':![],'depth':null}));});}else{logger[_0xcc99('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcc99('0x2e'),'twilio',_0xcc99('0x30'));}break;case _0xcc99('0x31'):var _0x222670='https://api.skebby.it/API/v1.0/REST/';if(_0x22596d[_0xcc99('0x32')]&&_0x22596d[_0xcc99('0x33')]){var _0x5b2d1c={'recipient':[_0x285a53[_0xcc99('0x27')]],'message':_0x285a53[_0xcc99('0xf')],'message_type':_0x22596d[_0xcc99('0x34')]};if(_0x22596d['smsMethod']&&_0x22596d['smsMethod']!=='SI'){_0x5b2d1c[_0xcc99('0x35')]=_0x22596d[_0xcc99('0x27')];}var _0x36a7ba={'url':_0x222670+_0xcc99('0x36')+_0x22596d['username']+_0xcc99('0x37')+_0x22596d[_0xcc99('0x33')],'method':_0xcc99('0x38')};rp(_0x36a7ba)[_0xcc99('0x1b')](function(_0x591a27){var _0x4bc303=_0x591a27[_0xcc99('0x39')](';');var _0x57bb3d={'user_key':_0x4bc303[0x0],'session_key':_0x4bc303[0x1]};_0x36a7ba={'url':_0x222670+_0xcc99('0x3a'),'method':'POST','headers':{'user_key':_0x57bb3d[_0xcc99('0x3b')],'Session_key':_0x57bb3d[_0xcc99('0x3c')]},'json':!![],'body':_0x5b2d1c};return rp(_0x36a7ba);})[_0xcc99('0x1b')](function(_0x5dfccd){if(_0x5dfccd[_0xcc99('0x3d')]>=0x1){var _0x21d49f={'messageId':_0x5dfccd[_0xcc99('0x3e')]};if(_0x22596d[_0xcc99('0x34')]!=='GP'||!_0x22596d[_0xcc99('0x3f')]){_0x21d49f[_0xcc99('0x40')]=!![];}return _0x2956b8[_0xcc99('0x1c')](_0x21d49f);}else{return logger[_0xcc99('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcc99('0x2e'),_0xcc99('0x31'),util[_0xcc99('0x2f')](_0x5dfccd,{'showHidden':![],'depth':null}));}})[_0xcc99('0x1e')](function(_0x3aa033){return logger[_0xcc99('0x1f')](_0xcc99('0x41'),_0xcc99('0x2e'),_0xcc99('0x31'),util[_0xcc99('0x2f')](_0x3aa033,{'showHidden':![],'depth':null}));});}else{logger[_0xcc99('0x1f')](_0xcc99('0x41'),'afterCreate',_0xcc99('0x31'),_0xcc99('0x42'));}break;case _0xcc99('0x43'):if(_0x22596d[_0xcc99('0x26')]){var _0x45d6a1={'recipient':_0x285a53[_0xcc99('0x27')],'message':_0x285a53['body'],'sender':_0x22596d[_0xcc99('0x44')]||_0x22596d['phone'],'authorization':_0x22596d[_0xcc99('0x26')]};var _0x22afb8={'method':_0xcc99('0x45'),'uri':_0xcc99('0x46'),'body':_0x45d6a1,'json':!![]};rp(_0x22afb8)[_0xcc99('0x1b')](function(_0x7dcaf6){var _0x4650fa={'messageId':_0x7dcaf6[_0xcc99('0x47')]};if(!_0x22596d[_0xcc99('0x3f')]){_0x4650fa['read']=!![];}return _0x2956b8[_0xcc99('0x1c')](_0x4650fa);})[_0xcc99('0x1e')](function(_0x18fbf9){logger[_0xcc99('0x1f')](_0xcc99('0x41'),_0xcc99('0x2e'),_0xcc99('0x43'),util[_0xcc99('0x2f')](_0x18fbf9,{'showHidden':![],'depth':null}));});}else{logger[_0xcc99('0x1f')](_0xcc99('0x41'),_0xcc99('0x2e'),'connectel','Missing\x20parameters:\x20authToken');}break;case _0xcc99('0x48'):if(_0x22596d[_0xcc99('0x32')]&&_0x22596d[_0xcc99('0x33')]){var _0x45d6a1={'messages':[{'source':'xCALLY\x20Motion','to':_0x285a53['phone'],'body':_0x285a53[_0xcc99('0xf')],'from':_0x22596d[_0xcc99('0x44')]||_0x22596d[_0xcc99('0x27')]}]};var _0x35b73e=util[_0xcc99('0x49')](_0xcc99('0x4a'),_0x22596d[_0xcc99('0x32')],_0x22596d[_0xcc99('0x33')]);var _0x22afb8={'method':_0xcc99('0x45'),'uri':_0xcc99('0x4b'),'body':_0x45d6a1,'headers':{'Authorization':util['format'](_0xcc99('0x4c'),new Buffer(_0x35b73e)['toString'](_0xcc99('0x4d')))},'json':!![]};rp(_0x22afb8)[_0xcc99('0x1b')](function(_0x3316fb){if(_0x3316fb[_0xcc99('0x4e')]>=0xc8&&_0x3316fb[_0xcc99('0x4e')]<=0xce){if(_0x3316fb[_0xcc99('0x4f')]&&_0x3316fb[_0xcc99('0x4f')]['queued_count']>0x0){var _0x3537e6=_[_0xcc99('0x50')](_0x3316fb[_0xcc99('0x4f')][_0xcc99('0x28')]);var _0x35e0d7={'messageId':_0x3537e6[_0xcc99('0x51')]};if(!_0x22596d['deliveryReport']){_0x35e0d7['read']=!![];}return _0x2956b8[_0xcc99('0x1c')](_0x35e0d7);}else{logger['error'](_0xcc99('0x41'),_0xcc99('0x2e'),'clickSend',util[_0xcc99('0x2f')](_0x3316fb,{'showHidden':![],'depth':null}));}}else{logger[_0xcc99('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcc99('0x2e'),_0xcc99('0x52'),util[_0xcc99('0x2f')](_0x3316fb,{'showHidden':![],'depth':null}));}})[_0xcc99('0x1e')](function(_0x379075){logger['error'](_0xcc99('0x41'),'afterCreate',_0xcc99('0x52'),util[_0xcc99('0x2f')](_0x379075,{'showHidden':![],'depth':null}));});}else{logger[_0xcc99('0x1f')](_0xcc99('0x41'),_0xcc99('0x2e'),'clickSend',_0xcc99('0x42'));}break;case _0xcc99('0x53'):if(_0x22596d[_0xcc99('0x54')]&&_0x22596d[_0xcc99('0x26')]){var _0x45d6a1={'dst':_0x285a53['phone'],'text':_0x285a53[_0xcc99('0xf')],'src':_0x22596d[_0xcc99('0x44')]||_0x22596d[_0xcc99('0x27')],'url':_0x22596d[_0xcc99('0x2a')]+'/api/sms/messages/'+_0x285a53['id']+_0xcc99('0x2c')+_0x22596d['token']};var _0x35b73e=util[_0xcc99('0x49')]('%s:%s',_0x22596d[_0xcc99('0x54')],_0x22596d['authToken']);var _0x22afb8={'method':_0xcc99('0x45'),'uri':util[_0xcc99('0x49')]('https://api.plivo.com/v1/Account/%s/Message/',_0x22596d[_0xcc99('0x54')]),'body':_0x45d6a1,'headers':{'Authorization':util[_0xcc99('0x49')](_0xcc99('0x4c'),new Buffer(_0x35b73e)[_0xcc99('0x55')]('base64'))},'json':!![]};rp(_0x22afb8)[_0xcc99('0x1b')](function(_0x3d7b42){var _0x13b5c7={'messageId':_0x3d7b42[_0xcc99('0x56')][0x0]};return _0x2956b8[_0xcc99('0x1c')](_0x13b5c7);})[_0xcc99('0x1e')](function(_0x2d3c4c){logger['error'](_0xcc99('0x41'),_0xcc99('0x2e'),_0xcc99('0x53'),util[_0xcc99('0x2f')](_0x2d3c4c,{'showHidden':![],'depth':null}));});}else{logger[_0xcc99('0x1f')](_0xcc99('0x41'),'afterCreate',_0xcc99('0x53'),_0xcc99('0x57'));}break;case _0xcc99('0x58'):if(_0x22596d[_0xcc99('0x32')]&&_0x22596d[_0xcc99('0x33')]){if(_0x22596d[_0xcc99('0x59')]){var _0x2cc95d={'method':'POST','uri':_0x22596d[_0xcc99('0x59')]+_0xcc99('0x5a'),'body':{'username':_0x22596d[_0xcc99('0x32')],'password':_0x22596d[_0xcc99('0x33')]},'json':!![]};return rp(_0x2cc95d)[_0xcc99('0x1b')](function(_0x5cdb73){var _0x38553f={'method':_0xcc99('0x45'),'uri':_0x22596d[_0xcc99('0x59')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x22596d['phone'],'destinations':[{'to':_0x285a53[_0xcc99('0x27')]}],'text':_0x285a53['body'],'notifyUrl':_0x22596d[_0xcc99('0x2a')]+_0xcc99('0x2b')+_0x285a53['id']+_0xcc99('0x2c')+_0x22596d[_0xcc99('0x5b')],'notifyContentType':_0xcc99('0x5c'),'callbackData':_0x22596d[_0xcc99('0x27')]+';'+_0x285a53[_0xcc99('0xf')]}]},'headers':{'Authorization':_0xcc99('0x5d')+_0x5cdb73[_0xcc99('0x5b')]},'json':!![]};return rp(_0x38553f)['then'](function(_0x4d60d8){if(_0x4d60d8[_0xcc99('0x28')]){var _0x83c60a={'messageId':_0x4d60d8[_0xcc99('0x28')][0x0][_0xcc99('0xd')]};if(!_0x22596d[_0xcc99('0x3f')]){_0x83c60a[_0xcc99('0x40')]=!![];}return _0x2956b8['update'](_0x83c60a);}else{return logger[_0xcc99('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcc99('0x2e'),_0xcc99('0x58'),util[_0xcc99('0x2f')](_0x4d60d8,{'showHidden':![],'depth':null}));}});})[_0xcc99('0x1e')](function(_0x3fcc34){return logger[_0xcc99('0x1f')](_0xcc99('0x41'),'afterCreate','infobip',util[_0xcc99('0x2f')](_0x3fcc34,{'showHidden':![],'depth':null}));});}else{logger[_0xcc99('0x1f')](_0xcc99('0x41'),_0xcc99('0x2e'),'infobip',_0xcc99('0x5e'));}}else{logger[_0xcc99('0x1f')](_0xcc99('0x41'),'afterCreate',_0xcc99('0x58'),_0xcc99('0x42'));}break;case _0xcc99('0x5f'):var _0x561d1b=require(_0xcc99('0x60'));if(_0x22596d[_0xcc99('0x61')]){var _0x47be37={};_0x47be37[_0xcc99('0x62')]=_0x22596d[_0xcc99('0x32')];_0x47be37[_0xcc99('0x27')]=_0x285a53[_0xcc99('0x27')];_0x47be37[_0xcc99('0x35')]=_0x22596d[_0xcc99('0x27')];_0x47be37['text']=_0x285a53[_0xcc99('0xf')];_0x47be37[_0xcc99('0x63')]=+new Date();var _0x3d8016='';var _0x33e410='';var _0x18ff40=Object[_0xcc99('0x64')](_0x47be37);_0x18ff40['sort']();for(var _0x3fdd2a=0x0;_0x3fdd2a<_0x18ff40[_0xcc99('0x65')];_0x3fdd2a++){if(_0x3d8016!=''){_0x3d8016+='&';}_0x3d8016+=_0x18ff40[_0x3fdd2a]+'='+encodeURIComponent(_0x47be37[_0x18ff40[_0x3fdd2a]]);_0x33e410+=_0x47be37[_0x18ff40[_0x3fdd2a]];}_0x33e410+=_0x22596d[_0xcc99('0x61')];_0x33e410=_0x561d1b[_0xcc99('0x66')]('md5')[_0xcc99('0x1c')](_0x33e410)['digest'](_0xcc99('0x67'));if(_0x3d8016!==''){_0x3d8016+='&';}_0x3d8016+=_0xcc99('0x68')+_0x33e410;var _0x36a7ba={'method':_0xcc99('0x38'),'uri':_0x22596d['baseUrl']+_0xcc99('0x69')+_0x3d8016,'json':!![]};return rp(_0x36a7ba)['then'](function(_0x20dde4){var _0x1bea1b=Object[_0xcc99('0x64')](_0x20dde4);if(_0x20dde4[_0x1bea1b[0x0]][_0xcc99('0x1f')]&&parseInt(_0x20dde4[_0x1bea1b[0x0]][_0xcc99('0x1f')])===0x0){var _0x21592c={'messageId':_0x20dde4[_0x1bea1b[0x0]][_0xcc99('0x6a')]};if(!_0x22596d['deliveryReport']){_0x21592c[_0xcc99('0x40')]=!![];}return _0x2956b8[_0xcc99('0x1c')](_0x21592c);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcc99('0x2e'),_0xcc99('0x5f'),util['inspect'](_0x20dde4['error'],{'showHidden':![],'depth':null}));}})[_0xcc99('0x1e')](function(_0x32382e){return logger[_0xcc99('0x1f')](_0xcc99('0x41'),_0xcc99('0x2e'),_0xcc99('0x5f'),util[_0xcc99('0x2f')](_0x32382e,{'showHidden':![],'depth':null}));});}else{logger[_0xcc99('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xcc99('0x5f'),'Missing\x20parameters:\x20apiKey');}break;case _0xcc99('0x6b'):if(_0x22596d['apiKey']){var _0x32868={'method':_0xcc99('0x45'),'uri':_0xcc99('0x6c'),'headers':{'Authorization':_0x22596d[_0xcc99('0x61')]},'body':{'content':_0x285a53['body'],'to':[_0x285a53[_0xcc99('0x27')]],'from':_0x22596d[_0xcc99('0x27')],'binary':![],'clientMessageId':_0xcc99('0x6d'),'charset':_0xcc99('0x6e')},'json':!![]};rp(_0x32868)[_0xcc99('0x1b')](function(_0x46ccf6){if(!_0x46ccf6[_0xcc99('0x1f')]){var _0xab9e59={'messageId':_0x46ccf6[_0xcc99('0x28')][0x0][_0xcc99('0x6f')]};if(!_0x22596d['deliveryReport']){_0xab9e59['read']=!![];}return _0x2956b8['update'](_0xab9e59);}else{return logger[_0xcc99('0x1f')](_0xcc99('0x41'),'afterCreate',_0xcc99('0x6b'),util['inspect'](_0x46ccf6[_0xcc99('0x1f')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x1f86a0){return logger[_0xcc99('0x1f')](_0xcc99('0x41'),_0xcc99('0x2e'),_0xcc99('0x6b'),util[_0xcc99('0x2f')](_0x1f86a0,{'showHidden':![],'depth':null}));});}else{logger[_0xcc99('0x1f')](_0xcc99('0x41'),_0xcc99('0x2e'),'clickatell',_0xcc99('0x70'));}break;case _0xcc99('0x71'):if(_0x22596d[_0xcc99('0x61')]){var _0x207969={};var _0x36a7ba={'method':_0xcc99('0x45'),'uri':_0xcc99('0x72'),'headers':{'Authorization':_0xcc99('0x73')+_0x22596d[_0xcc99('0x61')],'Content-Type':_0xcc99('0x5c')},'body':{'from':_0x22596d['phone'],'to':_0x285a53[_0xcc99('0x27')],'text':_0x285a53[_0xcc99('0xf')]},'json':!![]};return rp(_0x36a7ba)['then'](function(_0x4b2724){if(_0x4b2724[_0xcc99('0x74')]==0xca){_0x207969[_0xcc99('0x75')]=_0x4b2724;var _0x5e29a1={'method':'POST','uri':_0xcc99('0x76'),'headers':{'Authorization':_0xcc99('0x73')+_0x22596d[_0xcc99('0x61')],'Content-Type':_0xcc99('0x5c')},'body':{'refid':_0x207969[_0xcc99('0x75')][_0xcc99('0x77')]},'json':!![]};return rp(_0x5e29a1)[_0xcc99('0x1b')](function(_0x319e8d){_0x207969[_0xcc99('0x78')]=_0x319e8d;var _0x191ddb={'messageId':_0x207969[_0xcc99('0x75')][_0xcc99('0x77')],'read':!![]};return _0x2956b8[_0xcc99('0x1c')](_0x191ddb);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcc99('0x2e'),_0xcc99('0x71'),util[_0xcc99('0x2f')](_0x4b2724,{'showHidden':![],'depth':null}));}})[_0xcc99('0x1e')](function(_0x102537){return logger[_0xcc99('0x1f')](_0xcc99('0x41'),_0xcc99('0x2e'),_0xcc99('0x71'),util[_0xcc99('0x2f')](_0x102537,{'showHidden':![],'depth':null}));});}else{return logger[_0xcc99('0x1f')](_0xcc99('0x41'),_0xcc99('0x2e'),'intelepeer','Token\x20not\x20received');}break;}}})[_0xcc99('0x79')](function(){_0x1ebe1a();});}else{_0x1ebe1a();}}},'charset':_0xcc99('0x7a'),'collate':_0xcc99('0x7b')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index ae965b7..630bda7 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 _0x2032=['register','request','SmsMessage,\x20%s,\x20%s','request\x20sent','error','message','info','result','CreateSmsMessage','create','options','then','stringify','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x2032,0xd9));var _0x2203=function(_0x52572e,_0x41f5b2){_0x52572e=_0x52572e-0x0;var _0x27bee7=_0x2032[_0x52572e];return _0x27bee7;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});config[_0x2203('0xb')]=_[_0x2203('0xc')](config[_0x2203('0xb')],{'host':_0x2203('0xd'),'port':0x18eb});var socket=require(_0x2203('0xe'))(new Redis(config['redis']));require('./smsMessage.socket')[_0x2203('0xf')](socket);function respondWithRpcPromise(_0x549908,_0x27081c,_0x2972f3){return new BPromise(function(_0x6339c4,_0x5b19df){return client[_0x2203('0x10')](_0x549908,_0x2972f3)['then'](function(_0x3f690a){logger['info'](_0x2203('0x11'),_0x27081c,_0x2203('0x12'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x27081c,'request\x20sent',JSON['stringify'](_0x3f690a));if(_0x3f690a['error']){if(_0x3f690a[_0x2203('0x13')]['code']===0x1f4){logger['error'](_0x2203('0x11'),_0x27081c,_0x3f690a[_0x2203('0x13')][_0x2203('0x14')]);return _0x5b19df(_0x3f690a[_0x2203('0x13')][_0x2203('0x14')]);}logger[_0x2203('0x13')](_0x2203('0x11'),_0x27081c,_0x3f690a[_0x2203('0x13')][_0x2203('0x14')]);return _0x6339c4(_0x3f690a[_0x2203('0x13')]['message']);}else{logger[_0x2203('0x15')](_0x2203('0x11'),_0x27081c,'request\x20sent');_0x6339c4(_0x3f690a[_0x2203('0x16')][_0x2203('0x14')]);}})['catch'](function(_0x30c6f7){logger['error'](_0x2203('0x11'),_0x27081c,_0x30c6f7);_0x5b19df(_0x30c6f7);});});}exports[_0x2203('0x17')]=function(_0x3c8c34){var _0x3b4034=this;return new Promise(function(_0x15cb1a,_0x449039){return db['SmsMessage'][_0x2203('0x18')](_0x3c8c34['body'],{'raw':_0x3c8c34['options']?_0x3c8c34[_0x2203('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x2203('0x1a')](function(_0x5bfe61){logger['info'](_0x2203('0x17'),_0x3c8c34);logger['debug']('CreateSmsMessage',_0x3c8c34,JSON[_0x2203('0x1b')](_0x5bfe61));_0x15cb1a(_0x5bfe61);})[_0x2203('0x1c')](function(_0x21f930){logger[_0x2203('0x13')](_0x2203('0x17'),_0x21f930[_0x2203('0x14')],_0x3c8c34);_0x449039(_0x3b4034[_0x2203('0x13')](0x1f4,_0x21f930[_0x2203('0x14')]));});});}; \ No newline at end of file +var _0x5eb8=['client','http','defaults','redis','localhost','register','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','SmsMessage,\x20%s,\x20%s','message','result','catch','options','raw','then','stringify','CreateSmsMessage','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x503780,_0x444d8c){var _0x15df1c=function(_0x100042){while(--_0x100042){_0x503780['push'](_0x503780['shift']());}};_0x15df1c(++_0x444d8c);}(_0x5eb8,0xb0));var _0x85eb=function(_0x2ed7d1,_0x363741){_0x2ed7d1=_0x2ed7d1-0x0;var _0x38ae3c=_0x5eb8[_0x2ed7d1];return _0x38ae3c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});config['redis']=_[_0x85eb('0xc')](config[_0x85eb('0xd')],{'host':_0x85eb('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85eb('0xd')]));require('./smsMessage.socket')[_0x85eb('0xf')](socket);function respondWithRpcPromise(_0x40d6b6,_0x673228,_0x29030b){return new BPromise(function(_0x1dacf2,_0x73e6d0){return client[_0x85eb('0x10')](_0x40d6b6,_0x29030b)['then'](function(_0x163f32){logger[_0x85eb('0x11')]('SmsMessage,\x20%s,\x20%s',_0x673228,_0x85eb('0x12'));logger[_0x85eb('0x13')](_0x85eb('0x14'),_0x673228,_0x85eb('0x12'),JSON['stringify'](_0x163f32));if(_0x163f32['error']){if(_0x163f32[_0x85eb('0x15')]['code']===0x1f4){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x73e6d0(_0x163f32[_0x85eb('0x15')]['message']);}logger[_0x85eb('0x15')]('SmsMessage,\x20%s,\x20%s',_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x1dacf2(_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x673228,'request\x20sent');_0x1dacf2(_0x163f32[_0x85eb('0x18')][_0x85eb('0x17')]);}})[_0x85eb('0x19')](function(_0x2e986c){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x2e986c);_0x73e6d0(_0x2e986c);});});}exports['CreateSmsMessage']=function(_0x24cf28){var _0x7244fc=this;return new Promise(function(_0xd9f06d,_0x4e8041){return db['SmsMessage']['create'](_0x24cf28['body'],{'raw':_0x24cf28[_0x85eb('0x1a')]?_0x24cf28[_0x85eb('0x1a')][_0x85eb('0x1b')]===undefined?!![]:![]:!![]})[_0x85eb('0x1c')](function(_0x465c74){logger[_0x85eb('0x11')]('CreateSmsMessage',_0x24cf28);logger['debug']('CreateSmsMessage',_0x24cf28,JSON[_0x85eb('0x1d')](_0x465c74));_0xd9f06d(_0x465c74);})[_0x85eb('0x19')](function(_0x3f7a4d){logger[_0x85eb('0x15')](_0x85eb('0x1e'),_0x3f7a4d[_0x85eb('0x17')],_0x24cf28);_0x4e8041(_0x7244fc['error'](0x1f4,_0x3f7a4d[_0x85eb('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index bbf2f97..075f53d 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 _0x15d7=['save','remove','update','emit','removeListener','length','smsMessage:','./smsMessage.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x15d7,0x1b7));var _0x715d=function(_0x373006,_0x1f57bd){_0x373006=_0x373006-0x0;var _0x1f3254=_0x15d7[_0x373006];return _0x1f3254;};'use strict';var SmsMessageEvents=require(_0x715d('0x0'));var events=[_0x715d('0x1'),_0x715d('0x2'),_0x715d('0x3')];function createListener(_0x13145d,_0x42d9c7){return function(_0x114961){_0x42d9c7[_0x715d('0x4')](_0x13145d,_0x114961);};}function removeListener(_0x5dde95,_0x2a637c){return function(){SmsMessageEvents[_0x715d('0x5')](_0x5dde95,_0x2a637c);};}exports['register']=function(_0x372388){for(var _0x4c5185=0x0,_0x24dc86=events[_0x715d('0x6')];_0x4c5185<_0x24dc86;_0x4c5185++){var _0x15e09c=events[_0x4c5185];var _0x138bae=createListener(_0x715d('0x7')+_0x15e09c,_0x372388);SmsMessageEvents['on'](_0x15e09c,_0x138bae);}}; \ No newline at end of file +var _0x137b=['length','smsMessage:','update','removeListener','register'];(function(_0x46cf00,_0x3ab273){var _0x2c4964=function(_0x22db82){while(--_0x22db82){_0x46cf00['push'](_0x46cf00['shift']());}};_0x2c4964(++_0x3ab273);}(_0x137b,0x6b));var _0xb137=function(_0x14d770,_0x41b389){_0x14d770=_0x14d770-0x0;var _0x4283a5=_0x137b[_0x14d770];return _0x4283a5;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save','remove',_0xb137('0x0')];function createListener(_0x302bfc,_0x3ff6fe){return function(_0x418301){_0x3ff6fe['emit'](_0x302bfc,_0x418301);};}function removeListener(_0x5b7e0c,_0x2a9efd){return function(){SmsMessageEvents[_0xb137('0x1')](_0x5b7e0c,_0x2a9efd);};}exports[_0xb137('0x2')]=function(_0x25ac84){for(var _0x21f266=0x0,_0x12b556=events[_0xb137('0x3')];_0x21f266<_0x12b556;_0x21f266++){var _0x5ae2d7=events[_0x21f266];var _0x23eb16=createListener(_0xb137('0x4')+_0x5ae2d7,_0x25ac84);SmsMessageEvents['on'](_0x5ae2d7,_0x23eb16);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 11bc25f..7517c8c 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 _0x2bae=['isAuthenticated','index','get','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./smsQueue.controller'];(function(_0x428d97,_0x566fe2){var _0x33e829=function(_0x1c6bb6){while(--_0x1c6bb6){_0x428d97['push'](_0x428d97['shift']());}};_0x33e829(++_0x566fe2);}(_0x2bae,0x164));var _0xe2ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bae[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe2ba('0x0'));var util=require(_0xe2ba('0x1'));var path=require(_0xe2ba('0x2'));var timeout=require(_0xe2ba('0x3'));var express=require(_0xe2ba('0x4'));var router=express[_0xe2ba('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe2ba('0x6'));var config=require('../../config/environment');var controller=require(_0xe2ba('0x7'));router['get']('/',auth[_0xe2ba('0x8')](),controller[_0xe2ba('0x9')]);router[_0xe2ba('0xa')]('/describe',auth[_0xe2ba('0x8')](),controller[_0xe2ba('0xb')]);router[_0xe2ba('0xa')](_0xe2ba('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xe2ba('0xa')](_0xe2ba('0xd'),auth[_0xe2ba('0x8')](),controller[_0xe2ba('0xe')]);router[_0xe2ba('0xa')]('/:id/teams',auth[_0xe2ba('0x8')](),controller[_0xe2ba('0xf')]);router[_0xe2ba('0xa')](_0xe2ba('0x10'),auth[_0xe2ba('0x8')](),controller[_0xe2ba('0x11')]);router[_0xe2ba('0x12')]('/',auth[_0xe2ba('0x8')](),controller[_0xe2ba('0x13')]);router[_0xe2ba('0x12')](_0xe2ba('0x14'),auth['isAuthenticated'](),controller[_0xe2ba('0x15')]);router[_0xe2ba('0x12')](_0xe2ba('0x10'),auth[_0xe2ba('0x8')](),controller[_0xe2ba('0x16')]);router[_0xe2ba('0x17')](_0xe2ba('0xc'),auth[_0xe2ba('0x8')](),controller['update']);router[_0xe2ba('0x18')](_0xe2ba('0xc'),auth[_0xe2ba('0x8')](),controller['destroy']);router[_0xe2ba('0x18')](_0xe2ba('0x14'),auth[_0xe2ba('0x8')](),controller[_0xe2ba('0x19')]);router[_0xe2ba('0x18')](_0xe2ba('0x10'),auth[_0xe2ba('0x8')](),controller[_0xe2ba('0x1a')]);module[_0xe2ba('0x1b')]=router; \ No newline at end of file +var _0xb1ef=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','destroy','/:id/teams','removeAgents','exports','multer','util','connect-timeout'];(function(_0x56ab65,_0x4001e3){var _0x21c785=function(_0x4f42af){while(--_0x4f42af){_0x56ab65['push'](_0x56ab65['shift']());}};_0x21c785(++_0x4001e3);}(_0xb1ef,0x93));var _0xfb1e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb1ef[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xfb1e('0x0'));var util=require(_0xfb1e('0x1'));var path=require('path');var timeout=require(_0xfb1e('0x2'));var express=require(_0xfb1e('0x3'));var router=express[_0xfb1e('0x4')]();var auth=require(_0xfb1e('0x5'));var interaction=require(_0xfb1e('0x6'));var config=require(_0xfb1e('0x7'));var controller=require(_0xfb1e('0x8'));router[_0xfb1e('0x9')]('/',auth['isAuthenticated'](),controller[_0xfb1e('0xa')]);router[_0xfb1e('0x9')](_0xfb1e('0xb'),auth[_0xfb1e('0xc')](),controller['describe']);router['get'](_0xfb1e('0xd'),auth[_0xfb1e('0xc')](),controller[_0xfb1e('0xe')]);router[_0xfb1e('0x9')](_0xfb1e('0xf'),auth[_0xfb1e('0xc')](),controller[_0xfb1e('0x10')]);router[_0xfb1e('0x9')]('/:id/teams',auth[_0xfb1e('0xc')](),controller[_0xfb1e('0x11')]);router[_0xfb1e('0x9')](_0xfb1e('0x12'),auth[_0xfb1e('0xc')](),controller[_0xfb1e('0x13')]);router[_0xfb1e('0x14')]('/',auth['isAuthenticated'](),controller[_0xfb1e('0x15')]);router[_0xfb1e('0x14')]('/:id/teams',auth[_0xfb1e('0xc')](),controller[_0xfb1e('0x16')]);router[_0xfb1e('0x14')](_0xfb1e('0x12'),auth[_0xfb1e('0xc')](),controller['addAgents']);router[_0xfb1e('0x17')](_0xfb1e('0xd'),auth[_0xfb1e('0xc')](),controller[_0xfb1e('0x18')]);router[_0xfb1e('0x19')]('/:id',auth[_0xfb1e('0xc')](),controller[_0xfb1e('0x1a')]);router[_0xfb1e('0x19')](_0xfb1e('0x1b'),auth[_0xfb1e('0xc')](),controller['removeTeams']);router[_0xfb1e('0x19')](_0xfb1e('0x12'),auth[_0xfb1e('0xc')](),controller[_0xfb1e('0x1c')]);module[_0xfb1e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 7f353ed..aac5368 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 _0xd787=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd787,0x84));var _0x7d78=function(_0x10eb4f,_0x356f91){_0x10eb4f=_0x10eb4f-0x0;var _0x4743ff=_0xd787[_0x10eb4f];return _0x4743ff;};'use strict';var Sequelize=require(_0x7d78('0x0'));module[_0x7d78('0x1')]={'name':{'type':Sequelize[_0x7d78('0x2')],'unique':_0x7d78('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7d78('0x2')]},'timeout':{'type':Sequelize[_0x7d78('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7d78('0x5')](_0x7d78('0x6'),_0x7d78('0x7'),_0x7d78('0x8'))}}; \ No newline at end of file +var _0x9a50=['ENUM','rrmemory','beepall','roundrobin','STRING','name'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0x9a50,0xdc));var _0x09a5=function(_0x40fede,_0x203a11){_0x40fede=_0x40fede-0x0;var _0x482694=_0x9a50[_0x40fede];return _0x482694;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x09a5('0x0')],'unique':_0x09a5('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x09a5('0x2')](_0x09a5('0x3'),_0x09a5('0x4'),_0x09a5('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 1e5d50f..f650310 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 _0x8603=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','SmsQueues','UserProfileResource','error','name','send','index','SmsQueue','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','merge','then','includeAll','include','findAll','rows','show','keys','rawAttributes','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','SmsQueueId','UserSmsQueue','User','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','each','findOrCreate','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?','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','every','includes','all','compact','transaction','isEmpty','removeAgents','forEach','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','order','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse'];(function(_0x284807,_0x4be925){var _0x50c774=function(_0xf56cf7){while(--_0xf56cf7){_0x284807['push'](_0x284807['shift']());}};_0x50c774(++_0x4be925);}(_0x8603,0x190));var _0x3860=function(_0x55a3c2,_0x3b79be){_0x55a3c2=_0x55a3c2-0x0;var _0x1484c7=_0x8603[_0x55a3c2];return _0x1484c7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3860('0x0'));var rimraf=require(_0x3860('0x1'));var zipdir=require(_0x3860('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3860('0x3'));var BPromise=require(_0x3860('0x4'));var Mustache=require(_0x3860('0x5'));var util=require('util');var path=require(_0x3860('0x6'));var sox=require('sox');var csv=require(_0x3860('0x7'));var ejs=require(_0x3860('0x8'));var fs=require('fs');var _=require(_0x3860('0x9'));var squel=require(_0x3860('0xa'));var crypto=require(_0x3860('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3860('0xc'));var Papa=require(_0x3860('0xd'));var Redis=require('ioredis');var authService=require(_0x3860('0xe'));var qs=require(_0x3860('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3860('0x10'));var logger=require(_0x3860('0x11'))('api');var utils=require(_0x3860('0x12'));var config=require(_0x3860('0x13'));var db=require('../../mysqldb')['db'];config[_0x3860('0x14')]=_[_0x3860('0x15')](config[_0x3860('0x14')],{'host':_0x3860('0x16'),'port':0x18eb});var socket=require(_0x3860('0x17'))(new Redis(config[_0x3860('0x14')]));require(_0x3860('0x18'))[_0x3860('0x19')](socket);function respondWithStatusCode(_0x465d8d,_0x46264d){_0x46264d=_0x46264d||0xcc;return function(_0x54dbc3){if(_0x54dbc3){return _0x465d8d[_0x3860('0x1a')](_0x46264d);}return _0x465d8d[_0x3860('0x1b')](_0x46264d)[_0x3860('0x1c')]();};}function respondWithResult(_0x37d9ab,_0x1055b3){_0x1055b3=_0x1055b3||0xc8;return function(_0xfa0c9a){if(_0xfa0c9a){return _0x37d9ab[_0x3860('0x1b')](_0x1055b3)[_0x3860('0x1d')](_0xfa0c9a);}};}function respondWithFilteredResult(_0x311fdb,_0x3c0d91){return function(_0x3e51b4){if(_0x3e51b4){var _0x45b799=_0x3e51b4[_0x3860('0x1e')],_0x4b6b15=_0x3c0d91[_0x3860('0x1f')],_0x4863bd=_0x3c0d91['offset']+_0x3c0d91[_0x3860('0x20')],_0x373b06;if(_0x4863bd>=_0x45b799){_0x4863bd=_0x45b799;_0x373b06=0xc8;}else{_0x373b06=0xce;}_0x311fdb[_0x3860('0x1b')](_0x373b06);return _0x311fdb[_0x3860('0x21')](_0x3860('0x22'),_0x4b6b15+'-'+_0x4863bd+'/'+_0x45b799)[_0x3860('0x1d')](_0x3e51b4);}return null;};}function patchUpdates(_0x45081f){return function(_0xc06ba1){try{jsonpatch[_0x3860('0x23')](_0xc06ba1,_0x45081f,!![]);}catch(_0x21d179){return BPromise[_0x3860('0x24')](_0x21d179);}return _0xc06ba1[_0x3860('0x25')]();};}function saveUpdates(_0x2e0b6e,_0x280ea9){return function(_0x9eaaa1){if(_0x9eaaa1){return _0x9eaaa1[_0x3860('0x26')](_0x2e0b6e)['then'](function(_0xfc10a5){return _0xfc10a5;});}return null;};}function removeEntity(_0x133093,_0x2b91f2){return function(_0x301e03){if(_0x301e03){return _0x301e03[_0x3860('0x27')]()['then'](function(){var _0x29ea87=_0x301e03['get']({'plain':!![]});var _0x577750=_0x3860('0x28');return db[_0x3860('0x29')]['destroy']({'where':{'type':_0x577750,'resourceId':_0x29ea87['id']}})['then'](function(){return _0x301e03;});})['then'](function(){_0x133093[_0x3860('0x1b')](0xcc)[_0x3860('0x1c')]();});}};}function handleEntityNotFound(_0xb25cc2,_0x371f3a){return function(_0x9332a5){if(!_0x9332a5){_0xb25cc2[_0x3860('0x1a')](0x194);}return _0x9332a5;};}function handleError(_0x544b9a,_0x4c4314){_0x4c4314=_0x4c4314||0x1f4;return function(_0x389bd0){logger[_0x3860('0x2a')](_0x389bd0['stack']);if(_0x389bd0[_0x3860('0x2b')]){delete _0x389bd0[_0x3860('0x2b')];}_0x544b9a[_0x3860('0x1b')](_0x4c4314)[_0x3860('0x2c')](_0x389bd0);};}exports[_0x3860('0x2d')]=function(_0x4bbae9,_0x36ae2b){var _0xf624ba={},_0x367b14={},_0x4bd90c={'count':0x0,'rows':[]};var _0x45d24f=_['map'](db[_0x3860('0x2e')]['rawAttributes'],function(_0x1c498c){return{'name':_0x1c498c[_0x3860('0x2f')],'type':_0x1c498c[_0x3860('0x30')]['key']};});_0x367b14[_0x3860('0x31')]=_[_0x3860('0x32')](_0x45d24f,'name');_0x367b14[_0x3860('0x33')]=_['keys'](_0x4bbae9[_0x3860('0x33')]);_0x367b14[_0x3860('0x34')]=_[_0x3860('0x35')](_0x367b14[_0x3860('0x31')],_0x367b14[_0x3860('0x33')]);_0xf624ba[_0x3860('0x36')]=_[_0x3860('0x35')](_0x367b14['model'],qs[_0x3860('0x37')](_0x4bbae9[_0x3860('0x33')]['fields']));_0xf624ba[_0x3860('0x36')]=_0xf624ba[_0x3860('0x36')][_0x3860('0x38')]?_0xf624ba['attributes']:_0x367b14['model'];if(!_0x4bbae9[_0x3860('0x33')][_0x3860('0x39')](_0x3860('0x3a'))){_0xf624ba[_0x3860('0x20')]=qs['limit'](_0x4bbae9['query'][_0x3860('0x20')]);_0xf624ba[_0x3860('0x1f')]=qs[_0x3860('0x1f')](_0x4bbae9[_0x3860('0x33')][_0x3860('0x1f')]);}_0xf624ba['order']=qs[_0x3860('0x3b')](_0x4bbae9[_0x3860('0x33')]['sort']);_0xf624ba['where']=qs[_0x3860('0x34')](_[_0x3860('0x3c')](_0x4bbae9[_0x3860('0x33')],_0x367b14[_0x3860('0x34')]));if(_0x4bbae9[_0x3860('0x33')]['filter']){_0xf624ba[_0x3860('0x3d')]=_['merge'](_0xf624ba[_0x3860('0x3d')],{'$or':_[_0x3860('0x32')](_0x45d24f,function(_0x53d443){if(_0x53d443[_0x3860('0x30')]!==_0x3860('0x3e')){var _0x4f3303={};_0x4f3303[_0x53d443[_0x3860('0x2b')]]={'$like':'%'+_0x4bbae9[_0x3860('0x33')][_0x3860('0x3f')]+'%'};return _0x4f3303;}})});}_0xf624ba=_[_0x3860('0x40')]({},_0xf624ba,_0x4bbae9['options']);var _0x312ffc={'where':_0xf624ba[_0x3860('0x3d')]};return db[_0x3860('0x2e')]['count'](_0x312ffc)[_0x3860('0x41')](function(_0x4e27c4){_0x4bd90c[_0x3860('0x1e')]=_0x4e27c4;if(_0x4bbae9[_0x3860('0x33')][_0x3860('0x42')]){_0xf624ba[_0x3860('0x43')]=[{'all':!![]}];}return db[_0x3860('0x2e')][_0x3860('0x44')](_0xf624ba);})['then'](function(_0xbbbf01){_0x4bd90c[_0x3860('0x45')]=_0xbbbf01;return _0x4bd90c;})['then'](respondWithFilteredResult(_0x36ae2b,_0xf624ba))['catch'](handleError(_0x36ae2b,null));};exports[_0x3860('0x46')]=function(_0x5840f7,_0x4f2f53){var _0x164a77={'raw':!![],'where':{'id':_0x5840f7['params']['id']}},_0x30d8eb={};_0x30d8eb[_0x3860('0x31')]=_[_0x3860('0x47')](db[_0x3860('0x2e')][_0x3860('0x48')]);_0x30d8eb[_0x3860('0x33')]=_[_0x3860('0x47')](_0x5840f7[_0x3860('0x33')]);_0x30d8eb[_0x3860('0x34')]=_[_0x3860('0x35')](_0x30d8eb[_0x3860('0x31')],_0x30d8eb[_0x3860('0x33')]);_0x164a77[_0x3860('0x36')]=_[_0x3860('0x35')](_0x30d8eb['model'],qs[_0x3860('0x37')](_0x5840f7['query'][_0x3860('0x37')]));_0x164a77[_0x3860('0x36')]=_0x164a77[_0x3860('0x36')][_0x3860('0x38')]?_0x164a77[_0x3860('0x36')]:_0x30d8eb[_0x3860('0x31')];if(_0x5840f7[_0x3860('0x33')][_0x3860('0x42')]){_0x164a77['include']=[{'all':!![]}];}_0x164a77=_[_0x3860('0x40')]({},_0x164a77,_0x5840f7[_0x3860('0x49')]);return db[_0x3860('0x2e')]['find'](_0x164a77)[_0x3860('0x41')](handleEntityNotFound(_0x4f2f53,null))[_0x3860('0x41')](respondWithResult(_0x4f2f53,null))[_0x3860('0x4a')](handleError(_0x4f2f53,null));};exports[_0x3860('0x4b')]=function(_0x5ed2db,_0x5bb2d1){return db[_0x3860('0x2e')]['create'](_0x5ed2db[_0x3860('0x4c')],{})[_0x3860('0x41')](function(_0x410dab){var _0x52456e=_0x5ed2db[_0x3860('0x4d')]['get']({'plain':!![]});if(!_0x52456e)throw new Error(_0x3860('0x4e'));if(_0x52456e['role']===_0x3860('0x4d')){var _0x25d22f=_0x410dab[_0x3860('0x4f')]({'plain':!![]});var _0x4b5790='SmsQueues';return db[_0x3860('0x50')][_0x3860('0x51')]({'where':{'name':_0x4b5790,'userProfileId':_0x52456e['userProfileId']},'raw':!![]})[_0x3860('0x41')](function(_0x58237e){if(_0x58237e&&_0x58237e[_0x3860('0x52')]===0x0){return db[_0x3860('0x29')][_0x3860('0x4b')]({'name':_0x25d22f[_0x3860('0x2b')],'resourceId':_0x25d22f['id'],'type':_0x58237e[_0x3860('0x2b')],'sectionId':_0x58237e['id']},{})[_0x3860('0x41')](function(){return _0x410dab;});}else{return _0x410dab;}})[_0x3860('0x4a')](function(_0x5a9987){logger[_0x3860('0x2a')](_0x3860('0x53'),_0x5a9987);throw _0x5a9987;});}return _0x410dab;})[_0x3860('0x41')](respondWithResult(_0x5bb2d1,0xc9))[_0x3860('0x4a')](handleError(_0x5bb2d1,null));};exports[_0x3860('0x26')]=function(_0x447163,_0x47ff99){if(_0x447163[_0x3860('0x4c')]['id']){delete _0x447163[_0x3860('0x4c')]['id'];}return db[_0x3860('0x2e')][_0x3860('0x51')]({'where':{'id':_0x447163[_0x3860('0x54')]['id']}})[_0x3860('0x41')](handleEntityNotFound(_0x47ff99,null))[_0x3860('0x41')](saveUpdates(_0x447163[_0x3860('0x4c')],null))['then'](respondWithResult(_0x47ff99,null))[_0x3860('0x4a')](handleError(_0x47ff99,null));};exports[_0x3860('0x27')]=function(_0x53a669,_0x1fe680){return db[_0x3860('0x2e')][_0x3860('0x51')]({'where':{'id':_0x53a669['params']['id']}})[_0x3860('0x41')](handleEntityNotFound(_0x1fe680,null))['then'](removeEntity(_0x1fe680,null))[_0x3860('0x4a')](handleError(_0x1fe680,null));};exports[_0x3860('0x55')]=function(_0x13b978,_0x2cc119){return db[_0x3860('0x2e')][_0x3860('0x55')]()[_0x3860('0x41')](respondWithResult(_0x2cc119,null))[_0x3860('0x4a')](handleError(_0x2cc119,null));};exports[_0x3860('0x56')]=function(_0x151492,_0x3ba9a1,_0x2bac24){var _0x58147d={'raw':!![],'where':{}},_0x5ce9a4={},_0x5111e0;return db[_0x3860('0x2e')]['findOne']({'where':{'id':_0x151492['params']['id']}})[_0x3860('0x41')](handleEntityNotFound(_0x3ba9a1,null))[_0x3860('0x41')](function(_0x2ff440){if(_0x2ff440){_0x5111e0=_0x2ff440[_0x3860('0x4f')]({'plain':!![]});_0x5ce9a4[_0x3860('0x31')]=_[_0x3860('0x47')](db['UserSmsQueue']['rawAttributes']);_0x5ce9a4['query']=_[_0x3860('0x47')](_0x151492[_0x3860('0x33')]);_0x5ce9a4[_0x3860('0x34')]=_['intersection'](_0x5ce9a4[_0x3860('0x31')],_0x5ce9a4['query']);_0x58147d[_0x3860('0x36')]=_[_0x3860('0x35')](_0x5ce9a4['model'],qs[_0x3860('0x37')](_0x151492[_0x3860('0x33')][_0x3860('0x37')]));_0x58147d[_0x3860('0x36')]=_0x58147d['attributes'][_0x3860('0x38')]?_0x58147d[_0x3860('0x36')]:_0x5ce9a4[_0x3860('0x31')];if(!_0x151492['query']['hasOwnProperty'](_0x3860('0x3a'))){_0x58147d[_0x3860('0x20')]=qs[_0x3860('0x20')](_0x151492[_0x3860('0x33')][_0x3860('0x20')]);_0x58147d[_0x3860('0x1f')]=qs['offset'](_0x151492[_0x3860('0x33')][_0x3860('0x1f')]);}_0x58147d['order']=qs[_0x3860('0x3b')](_0x151492[_0x3860('0x33')][_0x3860('0x3b')]);_0x58147d[_0x3860('0x3d')]=qs[_0x3860('0x34')](_[_0x3860('0x3c')](_0x151492['query'],_0x5ce9a4[_0x3860('0x34')]));_0x58147d[_0x3860('0x3d')][_0x3860('0x57')]=_0x2ff440['id'];if(_0x151492[_0x3860('0x33')][_0x3860('0x3f')]){_0x58147d[_0x3860('0x3d')]=_['merge'](_0x58147d[_0x3860('0x3d')],{'$or':_[_0x3860('0x32')](_0x58147d[_0x3860('0x36')],function(_0x5ebf70){var _0x4e386e={};_0x4e386e[_0x5ebf70]={'$like':'%'+_0x151492[_0x3860('0x33')][_0x3860('0x3f')]+'%'};return _0x4e386e;})});}_0x58147d=_[_0x3860('0x40')]({},_0x58147d,_0x151492[_0x3860('0x49')]);return db[_0x3860('0x58')]['findAll'](_0x58147d);}})['then'](function(_0x2db53f){if(_0x2db53f){return db[_0x3860('0x59')]['findAndCountAll']({'where':{'id':_['map'](_0x2db53f,_0x3860('0x5a')),'role':_0x3860('0x5b')},'attributes':['id','name',_0x3860('0x5c'),_0x3860('0x5d'),_0x3860('0x5e')]});}})[_0x3860('0x41')](function(_0x495167){if(_0x495167){return{'count':_0x495167[_0x3860('0x1e')],'rows':_[_0x3860('0x32')](_0x495167['rows'],function(_0x57e944){return{'membername':_0x57e944[_0x3860('0x2b')],'UserId':_0x57e944['id'],'queue_name':_0x5111e0[_0x3860('0x2b')],'SmsQueueId':_0x5111e0['id'],'interface':util['format'](_0x3860('0x5f'),'SIP',_0x57e944[_0x3860('0x2b')]),'penalty':0x0,'paused':_0x57e944['smsPause'],'createdAt':_0x57e944['createdAt'],'updatedAt':_0x57e944[_0x3860('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3ba9a1,_0x58147d))[_0x3860('0x4a')](handleError(_0x3ba9a1,null));};exports[_0x3860('0x60')]=function(_0x29eb2c,_0x2fd2f4,_0x19f717){var _0x43c5a1={};var _0x4b3447={};var _0x3756b3;var _0x297321;return db[_0x3860('0x2e')]['findOne']({'where':{'id':_0x29eb2c[_0x3860('0x54')]['id']}})['then'](handleEntityNotFound(_0x2fd2f4,null))[_0x3860('0x41')](function(_0x3dc2c5){if(_0x3dc2c5){_0x3756b3=_0x3dc2c5;_0x4b3447['model']=_[_0x3860('0x47')](db[_0x3860('0x61')][_0x3860('0x48')]);_0x4b3447['query']=_['keys'](_0x29eb2c['query']);_0x4b3447['filters']=_[_0x3860('0x35')](_0x4b3447[_0x3860('0x31')],_0x4b3447[_0x3860('0x33')]);_0x43c5a1[_0x3860('0x36')]=_['intersection'](_0x4b3447['model'],qs[_0x3860('0x37')](_0x29eb2c[_0x3860('0x33')][_0x3860('0x37')]));_0x43c5a1[_0x3860('0x36')]=_0x43c5a1['attributes'][_0x3860('0x38')]?_0x43c5a1[_0x3860('0x36')]:_0x4b3447['model'];_0x43c5a1['order']=qs[_0x3860('0x3b')](_0x29eb2c[_0x3860('0x33')][_0x3860('0x3b')]);_0x43c5a1[_0x3860('0x3d')]=qs['filters'](_['pick'](_0x29eb2c[_0x3860('0x33')],_0x4b3447['filters']));if(_0x29eb2c[_0x3860('0x33')][_0x3860('0x3f')]){_0x43c5a1['where']=_['merge'](_0x43c5a1['where'],{'$or':_[_0x3860('0x32')](_0x43c5a1[_0x3860('0x36')],function(_0x507480){var _0x22177b={};_0x22177b[_0x507480]={'$like':'%'+_0x29eb2c[_0x3860('0x33')][_0x3860('0x3f')]+'%'};return _0x22177b;})});}_0x43c5a1=_[_0x3860('0x40')]({},_0x43c5a1,_0x29eb2c[_0x3860('0x49')]);return _0x3756b3['getTeams'](_0x43c5a1);}})[_0x3860('0x41')](function(_0x31e791){if(_0x31e791){_0x297321=_0x31e791[_0x3860('0x38')];if(!_0x29eb2c[_0x3860('0x33')][_0x3860('0x39')]('nolimit')){_0x43c5a1[_0x3860('0x20')]=qs[_0x3860('0x20')](_0x29eb2c[_0x3860('0x33')][_0x3860('0x20')]);_0x43c5a1[_0x3860('0x1f')]=qs['offset'](_0x29eb2c['query'][_0x3860('0x1f')]);}return _0x3756b3[_0x3860('0x60')](_0x43c5a1);}})[_0x3860('0x41')](function(_0xf950d8){if(_0xf950d8){return _0xf950d8?{'count':_0x297321,'rows':_0xf950d8}:null;}})[_0x3860('0x41')](respondWithResult(_0x2fd2f4,null))[_0x3860('0x4a')](handleError(_0x2fd2f4,null));};exports[_0x3860('0x62')]=function(_0x532163,_0x458c1b,_0x3eb292){var _0x58eddd=_0x532163[_0x3860('0x4c')][_0x3860('0x63')];return db[_0x3860('0x61')]['findAll']({'where':{'id':_0x58eddd},'attributes':['id'],'include':[{'model':db[_0x3860('0x59')],'as':_0x3860('0x64'),'attributes':['id','name',_0x3860('0x65'),'voicePause',_0x3860('0x66')],'raw':!![]}]})[_0x3860('0x41')](function(_0x479d65){if(_0x479d65){var _0x330fd0=_[_0x3860('0x67')](_0x479d65,function(_0x361113){var _0x37b34a=_0x361113[_0x3860('0x4f')]({'plain':!![]});return _0x37b34a['Agents'];});return db[_0x3860('0x2e')][_0x3860('0x51')]({'where':{'id':_0x532163[_0x3860('0x54')]['id']}})[_0x3860('0x41')](function(_0x3c9837){return db['sequelize']['transaction'](function(_0x170554){return _0x3c9837[_0x3860('0x62')](_0x58eddd,{'transaction':_0x170554})['then'](function(){return BPromise[_0x3860('0x68')](_0x330fd0,function(_0x27ef52){return db[_0x3860('0x58')][_0x3860('0x69')]({'where':{'UserId':_0x27ef52['id'],'SmsQueueId':_0x532163['params']['id']},'transaction':_0x170554});});})[_0x3860('0x41')](function(){_0x330fd0['forEach'](function(_0x1a0768){socket[_0x3860('0x6a')](_0x3860('0x6b'),{'UserId':_0x1a0768['id'],'SmsQueueId':_0x3c9837['id']});});});});});}})[_0x3860('0x41')](respondWithStatusCode(_0x458c1b,null))[_0x3860('0x4a')](handleError(_0x458c1b,null));};exports[_0x3860('0x6c')]=function(_0x467b1b,_0x4936e7,_0x277aba){return db[_0x3860('0x61')]['findAll']({'where':{'id':_0x467b1b['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3860('0x64'),'attributes':['id'],'raw':!![]}]})[_0x3860('0x41')](handleEntityNotFound(_0x4936e7,null))[_0x3860('0x41')](function(_0x1482cd){var _0x1d989c=_[_0x3860('0x32')](_0x1482cd,'id');var _0x51999d=[];var _0x204da6=[];var _0x5e2959=squel[_0x3860('0x6d')]();_0x5e2959[_0x3860('0x6e')](_0x3860('0x6f'))[_0x3860('0x70')](_0x3860('0x71'),'tq')[_0x3860('0x72')](_0x3860('0x73'),'ut',_0x3860('0x74'))[_0x3860('0x3d')](_0x3860('0x75'),_0x467b1b[_0x3860('0x54')]['id']);for(var _0x5bdd94=0x0;_0x5bdd94<_0x1482cd[_0x3860('0x38')];_0x5bdd94+=0x1){let _0x304c95=_0x1482cd[_0x5bdd94];for(var _0x1c87bd=0x0;_0x1c87bd<_0x304c95['Agents'][_0x3860('0x38')];_0x1c87bd+=0x1){let _0x2fb8fc=_0x304c95[_0x3860('0x64')][_0x1c87bd];var _0x3d4469=_0x5e2959['clone']();_0x3d4469[_0x3860('0x3d')](_0x3860('0x76'),_0x2fb8fc['id']);_0x204da6[_0x3860('0x77')](db['sequelize'][_0x3860('0x33')](_0x3d4469[_0x3860('0x78')](),{'type':db[_0x3860('0x79')]['QueryTypes'][_0x3860('0x7a')]})[_0x3860('0x41')](function(_0x171400){if(_0x171400['length']===0x1){return _0x2fb8fc['id'];}else{var _0x11d103=_[_0x3860('0x7b')](_[_0x3860('0x32')](_0x171400,'TeamId'),function(_0x3c6005){return _[_0x3860('0x7c')](_0x1d989c,_0x3c6005);});if(_0x11d103){return _0x2fb8fc['id'];}}}));}}return BPromise[_0x3860('0x7d')](_0x204da6)['then'](function(_0x213c8f){_0x51999d=_(_0x51999d)['union'](_0x213c8f)[_0x3860('0x7e')]()['value']();return db[_0x3860('0x2e')][_0x3860('0x51')]({'where':{'id':_0x467b1b[_0x3860('0x54')]['id']}})[_0x3860('0x41')](function(_0xcf291){return db[_0x3860('0x79')][_0x3860('0x7f')](function(_0x3c9ccc){return _0xcf291[_0x3860('0x6c')](_0x467b1b[_0x3860('0x33')][_0x3860('0x63')],{'transaction':_0x3c9ccc})[_0x3860('0x41')](function(){if(!_[_0x3860('0x80')](_0x51999d)){return _0xcf291[_0x3860('0x81')](_0x51999d,{'transaction':_0x3c9ccc});}})[_0x3860('0x41')](function(){_0x51999d[_0x3860('0x82')](function(_0x46661f){socket[_0x3860('0x6a')]('userSmsQueue:remove',{'UserId':_0x46661f,'SmsQueueId':_0xcf291['id']});});});});});});})[_0x3860('0x41')](respondWithStatusCode(_0x4936e7,null))[_0x3860('0x4a')](handleError(_0x4936e7,null));};exports[_0x3860('0x83')]=function(_0x28cf53,_0x3e6bf8,_0x27802b){return db[_0x3860('0x2e')][_0x3860('0x51')]({'where':{'id':_0x28cf53[_0x3860('0x54')]['id']}})[_0x3860('0x41')](handleEntityNotFound(_0x3e6bf8,null))[_0x3860('0x41')](function(_0x50a18b){if(_0x50a18b){return _0x50a18b[_0x3860('0x83')](_0x28cf53[_0x3860('0x4c')][_0x3860('0x63')],_[_0x3860('0x84')](_0x28cf53['body'],[_0x3860('0x63'),'id'])||{})[_0x3860('0x85')](function(_0x2fcf2c){for(var _0x20d615=0x0;_0x20d615<_0x28cf53['body'][_0x3860('0x63')]['length'];_0x20d615+=0x1){socket['emit'](_0x3860('0x6b'),{'UserId':_0x28cf53[_0x3860('0x4c')][_0x3860('0x63')][_0x20d615],'SmsQueueId':_0x28cf53[_0x3860('0x54')]['id']});}return _0x2fcf2c;});}})[_0x3860('0x41')](respondWithResult(_0x3e6bf8,null))[_0x3860('0x4a')](handleError(_0x3e6bf8,null));};exports[_0x3860('0x81')]=function(_0x273fed,_0x3e4a88,_0x468e83){return db[_0x3860('0x2e')][_0x3860('0x51')]({'where':{'id':_0x273fed[_0x3860('0x54')]['id']}})['then'](handleEntityNotFound(_0x3e4a88,null))[_0x3860('0x41')](function(_0x509122){if(_0x509122){return _0x509122[_0x3860('0x81')](_0x273fed[_0x3860('0x33')]['ids'])[_0x3860('0x41')](function(){if(_[_0x3860('0x86')](_0x273fed[_0x3860('0x33')][_0x3860('0x63')])){for(var _0x959e5b=0x0;_0x959e5b<_0x273fed[_0x3860('0x33')][_0x3860('0x63')]['length'];_0x959e5b+=0x1){socket[_0x3860('0x6a')](_0x3860('0x87'),{'UserId':Number(_0x273fed[_0x3860('0x33')][_0x3860('0x63')][_0x959e5b]),'SmsQueueId':Number(_0x273fed[_0x3860('0x54')]['id'])});}}else{socket['emit'](_0x3860('0x87'),{'UserId':Number(_0x273fed['query']['ids']),'SmsQueueId':Number(_0x273fed['params']['id'])});}});}})[_0x3860('0x41')](respondWithStatusCode(_0x3e4a88,null))[_0x3860('0x4a')](handleError(_0x3e4a88,null));};exports[_0x3860('0x88')]=function(_0x1558dc,_0x161efa,_0x276a75){var _0x270ca1={};var _0xe24a1d={};var _0x59c203;var _0x3c738a;return db[_0x3860('0x2e')]['findOne']({'where':{'id':_0x1558dc['params']['id']}})[_0x3860('0x41')](handleEntityNotFound(_0x161efa,null))[_0x3860('0x41')](function(_0x1cf541){if(_0x1cf541){_0x59c203=_0x1cf541;_0xe24a1d['model']=_[_0x3860('0x47')](db['User'][_0x3860('0x48')]);_0xe24a1d['query']=_[_0x3860('0x47')](_0x1558dc[_0x3860('0x33')]);_0xe24a1d['filters']=_[_0x3860('0x35')](_0xe24a1d[_0x3860('0x31')],_0xe24a1d['query']);_0x270ca1[_0x3860('0x36')]=_[_0x3860('0x35')](_0xe24a1d[_0x3860('0x31')],qs['fields'](_0x1558dc[_0x3860('0x33')]['fields']));_0x270ca1[_0x3860('0x36')]=_0x270ca1[_0x3860('0x36')]['length']?_0x270ca1[_0x3860('0x36')]:_0xe24a1d[_0x3860('0x31')];_0x270ca1[_0x3860('0x89')]=qs[_0x3860('0x3b')](_0x1558dc[_0x3860('0x33')]['sort']);_0x270ca1[_0x3860('0x3d')]=qs[_0x3860('0x34')](_['pick'](_0x1558dc['query'],_0xe24a1d[_0x3860('0x34')]));if(_0x1558dc['query'][_0x3860('0x3f')]){_0x270ca1[_0x3860('0x3d')]=_['merge'](_0x270ca1[_0x3860('0x3d')],{'$or':_['map'](_0x270ca1[_0x3860('0x36')],function(_0x4b8128){var _0x10c82d={};_0x10c82d[_0x4b8128]={'$like':'%'+_0x1558dc[_0x3860('0x33')][_0x3860('0x3f')]+'%'};return _0x10c82d;})});}_0x270ca1=_[_0x3860('0x40')]({},_0x270ca1,_0x1558dc['options']);return _0x59c203[_0x3860('0x88')](_0x270ca1);}})[_0x3860('0x41')](function(_0x20071c){if(_0x20071c){_0x3c738a=_0x20071c[_0x3860('0x38')];if(!_0x1558dc['query'][_0x3860('0x39')](_0x3860('0x3a'))){_0x270ca1['limit']=qs[_0x3860('0x20')](_0x1558dc[_0x3860('0x33')][_0x3860('0x20')]);_0x270ca1[_0x3860('0x1f')]=qs['offset'](_0x1558dc[_0x3860('0x33')][_0x3860('0x1f')]);}return _0x59c203[_0x3860('0x88')](_0x270ca1);}})[_0x3860('0x41')](function(_0x48b8a8){if(_0x48b8a8){return _0x48b8a8?{'count':_0x3c738a,'rows':_0x48b8a8}:null;}})[_0x3860('0x41')](respondWithResult(_0x161efa,null))['catch'](handleError(_0x161efa,null));}; \ No newline at end of file +var _0xadb5=['flatMap','transaction','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','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','SmsQueues','stack','name','send','map','SmsQueue','rawAttributes','type','model','query','keys','intersection','fields','attributes','limit','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','get','UserSmsQueue','length','hasOwnProperty','nolimit','order','User','findAndCountAll','UserId','agent','createdAt','count','format','SIP','smsPause','updatedAt','getTeams','Team','addTeams','ids','Agents','online','interface'];(function(_0x435909,_0x30d85a){var _0x957660=function(_0x520531){while(--_0x520531){_0x435909['push'](_0x435909['shift']());}};_0x957660(++_0x30d85a);}(_0xadb5,0xad));var _0x5adb=function(_0x11e94c,_0x4d3b5e){_0x11e94c=_0x11e94c-0x0;var _0x2d0645=_0xadb5[_0x11e94c];return _0x2d0645;};'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('./smsQueue.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(){var _0xeb556c=_0x373cc3['get']({'plain':!![]});var _0x2fee18=_0x5adb('0x29');return db['UserProfileResource'][_0x5adb('0x28')]({'where':{'type':_0x2fee18,'resourceId':_0xeb556c['id']}})[_0x5adb('0x27')](function(){return _0x373cc3;});})[_0x5adb('0x27')](function(){_0x4ca150['status'](0xcc)[_0x5adb('0x1e')]();});}};}function handleEntityNotFound(_0xbe21b1,_0x3a4fca){return function(_0x2c64a3){if(!_0x2c64a3){_0xbe21b1[_0x5adb('0x1d')](0x194);}return _0x2c64a3;};}function handleError(_0x1c06c4,_0x4a5d46){_0x4a5d46=_0x4a5d46||0x1f4;return function(_0x49992e){logger['error'](_0x49992e[_0x5adb('0x2a')]);if(_0x49992e[_0x5adb('0x2b')]){delete _0x49992e[_0x5adb('0x2b')];}_0x1c06c4[_0x5adb('0x1f')](_0x4a5d46)[_0x5adb('0x2c')](_0x49992e);};}exports['index']=function(_0x11ec2a,_0x34b793){var _0x372da1={},_0x3b1fed={},_0x450169={'count':0x0,'rows':[]};var _0x3145f2=_[_0x5adb('0x2d')](db[_0x5adb('0x2e')][_0x5adb('0x2f')],function(_0x260295){return{'name':_0x260295['fieldName'],'type':_0x260295[_0x5adb('0x30')]['key']};});_0x3b1fed[_0x5adb('0x31')]=_[_0x5adb('0x2d')](_0x3145f2,'name');_0x3b1fed[_0x5adb('0x32')]=_[_0x5adb('0x33')](_0x11ec2a[_0x5adb('0x32')]);_0x3b1fed['filters']=_[_0x5adb('0x34')](_0x3b1fed[_0x5adb('0x31')],_0x3b1fed['query']);_0x372da1['attributes']=_[_0x5adb('0x34')](_0x3b1fed['model'],qs[_0x5adb('0x35')](_0x11ec2a[_0x5adb('0x32')][_0x5adb('0x35')]));_0x372da1[_0x5adb('0x36')]=_0x372da1[_0x5adb('0x36')]['length']?_0x372da1[_0x5adb('0x36')]:_0x3b1fed[_0x5adb('0x31')];if(!_0x11ec2a[_0x5adb('0x32')]['hasOwnProperty']('nolimit')){_0x372da1[_0x5adb('0x37')]=qs[_0x5adb('0x37')](_0x11ec2a['query'][_0x5adb('0x37')]);_0x372da1['offset']=qs[_0x5adb('0x21')](_0x11ec2a['query'][_0x5adb('0x21')]);}_0x372da1['order']=qs[_0x5adb('0x38')](_0x11ec2a[_0x5adb('0x32')]['sort']);_0x372da1[_0x5adb('0x39')]=qs['filters'](_[_0x5adb('0x3a')](_0x11ec2a[_0x5adb('0x32')],_0x3b1fed[_0x5adb('0x3b')]));if(_0x11ec2a['query'][_0x5adb('0x3c')]){_0x372da1[_0x5adb('0x39')]=_[_0x5adb('0x3d')](_0x372da1[_0x5adb('0x39')],{'$or':_[_0x5adb('0x2d')](_0x3145f2,function(_0x52d74f){if(_0x52d74f['type']!=='VIRTUAL'){var _0x599999={};_0x599999[_0x52d74f[_0x5adb('0x2b')]]={'$like':'%'+_0x11ec2a[_0x5adb('0x32')][_0x5adb('0x3c')]+'%'};return _0x599999;}})});}_0x372da1=_[_0x5adb('0x3d')]({},_0x372da1,_0x11ec2a[_0x5adb('0x3e')]);var _0xd1c3c2={'where':_0x372da1[_0x5adb('0x39')]};return db[_0x5adb('0x2e')]['count'](_0xd1c3c2)['then'](function(_0x27dbb7){_0x450169['count']=_0x27dbb7;if(_0x11ec2a[_0x5adb('0x32')][_0x5adb('0x3f')]){_0x372da1[_0x5adb('0x40')]=[{'all':!![]}];}return db[_0x5adb('0x2e')][_0x5adb('0x41')](_0x372da1);})['then'](function(_0x43d320){_0x450169[_0x5adb('0x42')]=_0x43d320;return _0x450169;})['then'](respondWithFilteredResult(_0x34b793,_0x372da1))[_0x5adb('0x43')](handleError(_0x34b793,null));};exports[_0x5adb('0x44')]=function(_0x5833c8,_0x120497){var _0x407a4c={'raw':!![],'where':{'id':_0x5833c8[_0x5adb('0x45')]['id']}},_0x1d6bef={};_0x1d6bef[_0x5adb('0x31')]=_[_0x5adb('0x33')](db[_0x5adb('0x2e')]['rawAttributes']);_0x1d6bef['query']=_[_0x5adb('0x33')](_0x5833c8[_0x5adb('0x32')]);_0x1d6bef[_0x5adb('0x3b')]=_[_0x5adb('0x34')](_0x1d6bef['model'],_0x1d6bef['query']);_0x407a4c[_0x5adb('0x36')]=_[_0x5adb('0x34')](_0x1d6bef[_0x5adb('0x31')],qs[_0x5adb('0x35')](_0x5833c8[_0x5adb('0x32')]['fields']));_0x407a4c[_0x5adb('0x36')]=_0x407a4c[_0x5adb('0x36')]['length']?_0x407a4c[_0x5adb('0x36')]:_0x1d6bef[_0x5adb('0x31')];if(_0x5833c8[_0x5adb('0x32')][_0x5adb('0x3f')]){_0x407a4c[_0x5adb('0x40')]=[{'all':!![]}];}_0x407a4c=_[_0x5adb('0x3d')]({},_0x407a4c,_0x5833c8[_0x5adb('0x3e')]);return db[_0x5adb('0x2e')]['find'](_0x407a4c)[_0x5adb('0x27')](handleEntityNotFound(_0x120497,null))['then'](respondWithResult(_0x120497,null))['catch'](handleError(_0x120497,null));};exports['create']=function(_0x3cd211,_0x3fbac8){return db[_0x5adb('0x2e')]['create'](_0x3cd211[_0x5adb('0x46')],{})['then'](function(_0x177a81){var _0x2c3f21=_0x3cd211[_0x5adb('0x47')]['get']({'plain':!![]});if(!_0x2c3f21)throw new Error(_0x5adb('0x48'));if(_0x2c3f21['role']===_0x5adb('0x47')){var _0x6dc067=_0x177a81['get']({'plain':!![]});var _0x2402a3=_0x5adb('0x29');return db[_0x5adb('0x49')][_0x5adb('0x4a')]({'where':{'name':_0x2402a3,'userProfileId':_0x2c3f21[_0x5adb('0x4b')]},'raw':!![]})['then'](function(_0x36b847){if(_0x36b847&&_0x36b847[_0x5adb('0x4c')]===0x0){return db[_0x5adb('0x4d')][_0x5adb('0x4e')]({'name':_0x6dc067['name'],'resourceId':_0x6dc067['id'],'type':_0x36b847[_0x5adb('0x2b')],'sectionId':_0x36b847['id']},{})[_0x5adb('0x27')](function(){return _0x177a81;});}else{return _0x177a81;}})[_0x5adb('0x43')](function(_0x4d98d0){logger[_0x5adb('0x4f')](_0x5adb('0x50'),_0x4d98d0);throw _0x4d98d0;});}return _0x177a81;})[_0x5adb('0x27')](respondWithResult(_0x3fbac8,0xc9))[_0x5adb('0x43')](handleError(_0x3fbac8,null));};exports['update']=function(_0x3f5c8e,_0x91775c){if(_0x3f5c8e[_0x5adb('0x46')]['id']){delete _0x3f5c8e[_0x5adb('0x46')]['id'];}return db[_0x5adb('0x2e')]['find']({'where':{'id':_0x3f5c8e[_0x5adb('0x45')]['id']}})['then'](handleEntityNotFound(_0x91775c,null))[_0x5adb('0x27')](saveUpdates(_0x3f5c8e['body'],null))[_0x5adb('0x27')](respondWithResult(_0x91775c,null))[_0x5adb('0x43')](handleError(_0x91775c,null));};exports[_0x5adb('0x28')]=function(_0x42f6d9,_0x59b512){return db[_0x5adb('0x2e')][_0x5adb('0x4a')]({'where':{'id':_0x42f6d9[_0x5adb('0x45')]['id']}})['then'](handleEntityNotFound(_0x59b512,null))['then'](removeEntity(_0x59b512,null))['catch'](handleError(_0x59b512,null));};exports[_0x5adb('0x51')]=function(_0x31a1f9,_0xa5ecc0){return db[_0x5adb('0x2e')][_0x5adb('0x51')]()[_0x5adb('0x27')](respondWithResult(_0xa5ecc0,null))[_0x5adb('0x43')](handleError(_0xa5ecc0,null));};exports[_0x5adb('0x52')]=function(_0xc880af,_0x380d76,_0x452767){var _0x1df439={'raw':!![],'where':{}},_0x2c2357={},_0x511746;return db['SmsQueue'][_0x5adb('0x53')]({'where':{'id':_0xc880af[_0x5adb('0x45')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x380d76,null))[_0x5adb('0x27')](function(_0x5d7a9f){if(_0x5d7a9f){_0x511746=_0x5d7a9f[_0x5adb('0x54')]({'plain':!![]});_0x2c2357[_0x5adb('0x31')]=_['keys'](db[_0x5adb('0x55')][_0x5adb('0x2f')]);_0x2c2357[_0x5adb('0x32')]=_['keys'](_0xc880af[_0x5adb('0x32')]);_0x2c2357[_0x5adb('0x3b')]=_[_0x5adb('0x34')](_0x2c2357[_0x5adb('0x31')],_0x2c2357[_0x5adb('0x32')]);_0x1df439[_0x5adb('0x36')]=_['intersection'](_0x2c2357[_0x5adb('0x31')],qs[_0x5adb('0x35')](_0xc880af[_0x5adb('0x32')]['fields']));_0x1df439[_0x5adb('0x36')]=_0x1df439[_0x5adb('0x36')][_0x5adb('0x56')]?_0x1df439['attributes']:_0x2c2357[_0x5adb('0x31')];if(!_0xc880af['query'][_0x5adb('0x57')](_0x5adb('0x58'))){_0x1df439[_0x5adb('0x37')]=qs['limit'](_0xc880af[_0x5adb('0x32')][_0x5adb('0x37')]);_0x1df439['offset']=qs[_0x5adb('0x21')](_0xc880af[_0x5adb('0x32')][_0x5adb('0x21')]);}_0x1df439[_0x5adb('0x59')]=qs['sort'](_0xc880af[_0x5adb('0x32')][_0x5adb('0x38')]);_0x1df439[_0x5adb('0x39')]=qs[_0x5adb('0x3b')](_['pick'](_0xc880af['query'],_0x2c2357[_0x5adb('0x3b')]));_0x1df439['where']['SmsQueueId']=_0x5d7a9f['id'];if(_0xc880af['query'][_0x5adb('0x3c')]){_0x1df439[_0x5adb('0x39')]=_['merge'](_0x1df439[_0x5adb('0x39')],{'$or':_[_0x5adb('0x2d')](_0x1df439[_0x5adb('0x36')],function(_0xf6ef8a){var _0x358a23={};_0x358a23[_0xf6ef8a]={'$like':'%'+_0xc880af[_0x5adb('0x32')][_0x5adb('0x3c')]+'%'};return _0x358a23;})});}_0x1df439=_[_0x5adb('0x3d')]({},_0x1df439,_0xc880af['options']);return db['UserSmsQueue']['findAll'](_0x1df439);}})[_0x5adb('0x27')](function(_0x4357a6){if(_0x4357a6){return db[_0x5adb('0x5a')][_0x5adb('0x5b')]({'where':{'id':_[_0x5adb('0x2d')](_0x4357a6,_0x5adb('0x5c')),'role':_0x5adb('0x5d')},'attributes':['id',_0x5adb('0x2b'),'smsPause','updatedAt',_0x5adb('0x5e')]});}})[_0x5adb('0x27')](function(_0x114ee4){if(_0x114ee4){return{'count':_0x114ee4[_0x5adb('0x5f')],'rows':_[_0x5adb('0x2d')](_0x114ee4[_0x5adb('0x42')],function(_0x40140f){return{'membername':_0x40140f[_0x5adb('0x2b')],'UserId':_0x40140f['id'],'queue_name':_0x511746[_0x5adb('0x2b')],'SmsQueueId':_0x511746['id'],'interface':util[_0x5adb('0x60')]('%s/%s',_0x5adb('0x61'),_0x40140f[_0x5adb('0x2b')]),'penalty':0x0,'paused':_0x40140f[_0x5adb('0x62')],'createdAt':_0x40140f['createdAt'],'updatedAt':_0x40140f[_0x5adb('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5adb('0x27')](respondWithFilteredResult(_0x380d76,_0x1df439))['catch'](handleError(_0x380d76,null));};exports[_0x5adb('0x64')]=function(_0x494526,_0x473538,_0x31555a){var _0x5ea16a={};var _0x4734c6={};var _0x1ceb72;var _0x3d49f2;return db[_0x5adb('0x2e')][_0x5adb('0x53')]({'where':{'id':_0x494526[_0x5adb('0x45')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x473538,null))[_0x5adb('0x27')](function(_0x49a8a6){if(_0x49a8a6){_0x1ceb72=_0x49a8a6;_0x4734c6[_0x5adb('0x31')]=_[_0x5adb('0x33')](db[_0x5adb('0x65')]['rawAttributes']);_0x4734c6['query']=_[_0x5adb('0x33')](_0x494526['query']);_0x4734c6[_0x5adb('0x3b')]=_[_0x5adb('0x34')](_0x4734c6[_0x5adb('0x31')],_0x4734c6['query']);_0x5ea16a[_0x5adb('0x36')]=_[_0x5adb('0x34')](_0x4734c6[_0x5adb('0x31')],qs[_0x5adb('0x35')](_0x494526[_0x5adb('0x32')]['fields']));_0x5ea16a[_0x5adb('0x36')]=_0x5ea16a[_0x5adb('0x36')][_0x5adb('0x56')]?_0x5ea16a[_0x5adb('0x36')]:_0x4734c6['model'];_0x5ea16a[_0x5adb('0x59')]=qs[_0x5adb('0x38')](_0x494526[_0x5adb('0x32')][_0x5adb('0x38')]);_0x5ea16a[_0x5adb('0x39')]=qs[_0x5adb('0x3b')](_[_0x5adb('0x3a')](_0x494526['query'],_0x4734c6[_0x5adb('0x3b')]));if(_0x494526[_0x5adb('0x32')]['filter']){_0x5ea16a[_0x5adb('0x39')]=_[_0x5adb('0x3d')](_0x5ea16a['where'],{'$or':_[_0x5adb('0x2d')](_0x5ea16a['attributes'],function(_0x372354){var _0x268df2={};_0x268df2[_0x372354]={'$like':'%'+_0x494526['query'][_0x5adb('0x3c')]+'%'};return _0x268df2;})});}_0x5ea16a=_['merge']({},_0x5ea16a,_0x494526[_0x5adb('0x3e')]);return _0x1ceb72[_0x5adb('0x64')](_0x5ea16a);}})[_0x5adb('0x27')](function(_0x3a4a28){if(_0x3a4a28){_0x3d49f2=_0x3a4a28[_0x5adb('0x56')];if(!_0x494526['query'][_0x5adb('0x57')](_0x5adb('0x58'))){_0x5ea16a[_0x5adb('0x37')]=qs[_0x5adb('0x37')](_0x494526['query']['limit']);_0x5ea16a[_0x5adb('0x21')]=qs[_0x5adb('0x21')](_0x494526[_0x5adb('0x32')][_0x5adb('0x21')]);}return _0x1ceb72[_0x5adb('0x64')](_0x5ea16a);}})[_0x5adb('0x27')](function(_0x31f5b2){if(_0x31f5b2){return _0x31f5b2?{'count':_0x3d49f2,'rows':_0x31f5b2}:null;}})['then'](respondWithResult(_0x473538,null))[_0x5adb('0x43')](handleError(_0x473538,null));};exports[_0x5adb('0x66')]=function(_0x1883bd,_0x43b3a8,_0x55a9e8){var _0x450f90=_0x1883bd[_0x5adb('0x46')][_0x5adb('0x67')];return db[_0x5adb('0x65')][_0x5adb('0x41')]({'where':{'id':_0x450f90},'attributes':['id'],'include':[{'model':db[_0x5adb('0x5a')],'as':_0x5adb('0x68'),'attributes':['id',_0x5adb('0x2b'),_0x5adb('0x69'),'voicePause',_0x5adb('0x6a')],'raw':!![]}]})[_0x5adb('0x27')](function(_0x5c55ee){if(_0x5c55ee){var _0x44d50f=_[_0x5adb('0x6b')](_0x5c55ee,function(_0x2b8915){var _0x3bb3fc=_0x2b8915[_0x5adb('0x54')]({'plain':!![]});return _0x3bb3fc[_0x5adb('0x68')];});return db[_0x5adb('0x2e')][_0x5adb('0x4a')]({'where':{'id':_0x1883bd['params']['id']}})[_0x5adb('0x27')](function(_0x2386c0){return db['sequelize'][_0x5adb('0x6c')](function(_0x58a26f){return _0x2386c0[_0x5adb('0x66')](_0x450f90,{'transaction':_0x58a26f})['then'](function(){return BPromise['each'](_0x44d50f,function(_0x2d7a9f){return db[_0x5adb('0x55')][_0x5adb('0x6d')]({'where':{'UserId':_0x2d7a9f['id'],'SmsQueueId':_0x1883bd['params']['id']},'transaction':_0x58a26f});});})[_0x5adb('0x27')](function(){_0x44d50f[_0x5adb('0x6e')](function(_0x3ac059){socket[_0x5adb('0x6f')](_0x5adb('0x70'),{'UserId':_0x3ac059['id'],'SmsQueueId':_0x2386c0['id']});});});});});}})[_0x5adb('0x27')](respondWithStatusCode(_0x43b3a8,null))[_0x5adb('0x43')](handleError(_0x43b3a8,null));};exports[_0x5adb('0x71')]=function(_0x28bd33,_0x3e8a17,_0x423b80){return db[_0x5adb('0x65')]['findAll']({'where':{'id':_0x28bd33['query'][_0x5adb('0x67')]},'attributes':['id'],'include':[{'model':db[_0x5adb('0x5a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5adb('0x27')](handleEntityNotFound(_0x3e8a17,null))[_0x5adb('0x27')](function(_0x38acde){var _0x1a39b4=_[_0x5adb('0x2d')](_0x38acde,'id');var _0x24cd3b=[];var _0x15626b=[];var _0x327ac6=squel[_0x5adb('0x72')]();_0x327ac6['field'](_0x5adb('0x73'))[_0x5adb('0x74')](_0x5adb('0x75'),'tq')['join'](_0x5adb('0x76'),'ut',_0x5adb('0x77'))[_0x5adb('0x39')](_0x5adb('0x78'),_0x28bd33[_0x5adb('0x45')]['id']);for(var _0x2a78f9=0x0;_0x2a78f9<_0x38acde['length'];_0x2a78f9+=0x1){let _0x13a4aa=_0x38acde[_0x2a78f9];for(var _0x2c4129=0x0;_0x2c4129<_0x13a4aa[_0x5adb('0x68')][_0x5adb('0x56')];_0x2c4129+=0x1){let _0x2c3af8=_0x13a4aa[_0x5adb('0x68')][_0x2c4129];var _0x95fb11=_0x327ac6[_0x5adb('0x79')]();_0x95fb11[_0x5adb('0x39')](_0x5adb('0x7a'),_0x2c3af8['id']);_0x15626b['push'](db[_0x5adb('0x7b')]['query'](_0x95fb11[_0x5adb('0x7c')](),{'type':db[_0x5adb('0x7b')][_0x5adb('0x7d')][_0x5adb('0x7e')]})[_0x5adb('0x27')](function(_0x5c7b1b){if(_0x5c7b1b['length']===0x1){return _0x2c3af8['id'];}else{var _0x1aa301=_[_0x5adb('0x7f')](_[_0x5adb('0x2d')](_0x5c7b1b,_0x5adb('0x80')),function(_0x3c1a6f){return _[_0x5adb('0x81')](_0x1a39b4,_0x3c1a6f);});if(_0x1aa301){return _0x2c3af8['id'];}}}));}}return BPromise['all'](_0x15626b)['then'](function(_0x38c4a5){_0x24cd3b=_(_0x24cd3b)[_0x5adb('0x82')](_0x38c4a5)[_0x5adb('0x83')]()['value']();return db['SmsQueue'][_0x5adb('0x4a')]({'where':{'id':_0x28bd33['params']['id']}})[_0x5adb('0x27')](function(_0x169848){return db['sequelize']['transaction'](function(_0x43b91c){return _0x169848['removeTeams'](_0x28bd33['query'][_0x5adb('0x67')],{'transaction':_0x43b91c})[_0x5adb('0x27')](function(){if(!_[_0x5adb('0x84')](_0x24cd3b)){return _0x169848[_0x5adb('0x85')](_0x24cd3b,{'transaction':_0x43b91c});}})[_0x5adb('0x27')](function(){_0x24cd3b[_0x5adb('0x6e')](function(_0xa51ffc){socket[_0x5adb('0x6f')](_0x5adb('0x86'),{'UserId':_0xa51ffc,'SmsQueueId':_0x169848['id']});});});});});});})[_0x5adb('0x27')](respondWithStatusCode(_0x3e8a17,null))[_0x5adb('0x43')](handleError(_0x3e8a17,null));};exports[_0x5adb('0x87')]=function(_0x2808e4,_0x4f4898,_0xb3a828){return db['SmsQueue'][_0x5adb('0x4a')]({'where':{'id':_0x2808e4[_0x5adb('0x45')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x4f4898,null))[_0x5adb('0x27')](function(_0x460a76){if(_0x460a76){return _0x460a76[_0x5adb('0x87')](_0x2808e4[_0x5adb('0x46')][_0x5adb('0x67')],_[_0x5adb('0x88')](_0x2808e4[_0x5adb('0x46')],[_0x5adb('0x67'),'id'])||{})[_0x5adb('0x89')](function(_0x4884a0){for(var _0x3a9cc8=0x0;_0x3a9cc8<_0x2808e4[_0x5adb('0x46')][_0x5adb('0x67')][_0x5adb('0x56')];_0x3a9cc8+=0x1){socket[_0x5adb('0x6f')](_0x5adb('0x70'),{'UserId':_0x2808e4[_0x5adb('0x46')][_0x5adb('0x67')][_0x3a9cc8],'SmsQueueId':_0x2808e4['params']['id']});}return _0x4884a0;});}})[_0x5adb('0x27')](respondWithResult(_0x4f4898,null))[_0x5adb('0x43')](handleError(_0x4f4898,null));};exports[_0x5adb('0x85')]=function(_0x50cf0b,_0x469810,_0x4ae211){return db[_0x5adb('0x2e')]['find']({'where':{'id':_0x50cf0b['params']['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x469810,null))[_0x5adb('0x27')](function(_0x356224){if(_0x356224){return _0x356224[_0x5adb('0x85')](_0x50cf0b[_0x5adb('0x32')][_0x5adb('0x67')])[_0x5adb('0x27')](function(){if(_[_0x5adb('0x8a')](_0x50cf0b[_0x5adb('0x32')][_0x5adb('0x67')])){for(var _0x45ce02=0x0;_0x45ce02<_0x50cf0b[_0x5adb('0x32')]['ids'][_0x5adb('0x56')];_0x45ce02+=0x1){socket['emit'](_0x5adb('0x86'),{'UserId':Number(_0x50cf0b[_0x5adb('0x32')]['ids'][_0x45ce02]),'SmsQueueId':Number(_0x50cf0b[_0x5adb('0x45')]['id'])});}}else{socket[_0x5adb('0x6f')]('userSmsQueue:remove',{'UserId':Number(_0x50cf0b['query'][_0x5adb('0x67')]),'SmsQueueId':Number(_0x50cf0b[_0x5adb('0x45')]['id'])});}});}})[_0x5adb('0x27')](respondWithStatusCode(_0x469810,null))[_0x5adb('0x43')](handleError(_0x469810,null));};exports[_0x5adb('0x8b')]=function(_0x2ea29b,_0x5dd55f,_0x4293e5){var _0x263421={};var _0x88aac7={};var _0x379419;var _0x22d299;return db['SmsQueue']['findOne']({'where':{'id':_0x2ea29b[_0x5adb('0x45')]['id']}})[_0x5adb('0x27')](handleEntityNotFound(_0x5dd55f,null))[_0x5adb('0x27')](function(_0xaf0b4){if(_0xaf0b4){_0x379419=_0xaf0b4;_0x88aac7[_0x5adb('0x31')]=_[_0x5adb('0x33')](db[_0x5adb('0x5a')][_0x5adb('0x2f')]);_0x88aac7[_0x5adb('0x32')]=_['keys'](_0x2ea29b[_0x5adb('0x32')]);_0x88aac7[_0x5adb('0x3b')]=_['intersection'](_0x88aac7['model'],_0x88aac7['query']);_0x263421[_0x5adb('0x36')]=_[_0x5adb('0x34')](_0x88aac7[_0x5adb('0x31')],qs['fields'](_0x2ea29b['query'][_0x5adb('0x35')]));_0x263421[_0x5adb('0x36')]=_0x263421[_0x5adb('0x36')][_0x5adb('0x56')]?_0x263421[_0x5adb('0x36')]:_0x88aac7[_0x5adb('0x31')];_0x263421['order']=qs['sort'](_0x2ea29b[_0x5adb('0x32')]['sort']);_0x263421[_0x5adb('0x39')]=qs[_0x5adb('0x3b')](_['pick'](_0x2ea29b[_0x5adb('0x32')],_0x88aac7[_0x5adb('0x3b')]));if(_0x2ea29b[_0x5adb('0x32')][_0x5adb('0x3c')]){_0x263421['where']=_[_0x5adb('0x3d')](_0x263421[_0x5adb('0x39')],{'$or':_[_0x5adb('0x2d')](_0x263421[_0x5adb('0x36')],function(_0x4ec5bd){var _0xb4a84b={};_0xb4a84b[_0x4ec5bd]={'$like':'%'+_0x2ea29b['query'][_0x5adb('0x3c')]+'%'};return _0xb4a84b;})});}_0x263421=_[_0x5adb('0x3d')]({},_0x263421,_0x2ea29b[_0x5adb('0x3e')]);return _0x379419[_0x5adb('0x8b')](_0x263421);}})[_0x5adb('0x27')](function(_0x190c08){if(_0x190c08){_0x22d299=_0x190c08['length'];if(!_0x2ea29b[_0x5adb('0x32')][_0x5adb('0x57')](_0x5adb('0x58'))){_0x263421[_0x5adb('0x37')]=qs['limit'](_0x2ea29b[_0x5adb('0x32')]['limit']);_0x263421['offset']=qs['offset'](_0x2ea29b[_0x5adb('0x32')]['offset']);}return _0x379419['getAgents'](_0x263421);}})[_0x5adb('0x27')](function(_0x143f33){if(_0x143f33){return _0x143f33?{'count':_0x22d299,'rows':_0x143f33}:null;}})[_0x5adb('0x27')](respondWithResult(_0x5dd55f,null))[_0x5adb('0x43')](handleError(_0x5dd55f,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index f3fc593..c40326b 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 _0xcbfa=['exports','events','../../mysqldb','SmsQueue','save','update','emit','hasOwnProperty','hook'];(function(_0x3e17c4,_0x41b284){var _0x388f5a=function(_0x3c3be2){while(--_0x3c3be2){_0x3e17c4['push'](_0x3e17c4['shift']());}};_0x388f5a(++_0x41b284);}(_0xcbfa,0x1f0));var _0xacbf=function(_0x39fb6a,_0x8b07ae){_0x39fb6a=_0x39fb6a-0x0;var _0x1452a1=_0xcbfa[_0x39fb6a];return _0x1452a1;};'use strict';var EventEmitter=require(_0xacbf('0x0'));var SmsQueue=require(_0xacbf('0x1'))['db'][_0xacbf('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xacbf('0x3'),'afterUpdate':_0xacbf('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4d6a68){return function(_0x36ebbd,_0x55dd50,_0x350e06){SmsQueueEvents[_0xacbf('0x5')](_0x4d6a68+':'+_0x36ebbd['id'],_0x36ebbd);SmsQueueEvents[_0xacbf('0x5')](_0x4d6a68,_0x36ebbd);_0x350e06(null);};}for(var e in events){if(events[_0xacbf('0x6')](e)){var event=events[e];SmsQueue[_0xacbf('0x7')](e,emitEvent(event));}}module[_0xacbf('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0xd461=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x58ad46,_0x4515c0){var _0x2ae0ae=function(_0x3e166c){while(--_0x3e166c){_0x58ad46['push'](_0x58ad46['shift']());}};_0x2ae0ae(++_0x4515c0);}(_0xd461,0x13f));var _0x1d46=function(_0x16617e,_0x1e96cb){_0x16617e=_0x16617e-0x0;var _0x26be3b=_0xd461[_0x16617e];return _0x26be3b;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x1d46('0x0'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1d46('0x1')](0x0);var events={'afterCreate':_0x1d46('0x2'),'afterUpdate':_0x1d46('0x3'),'afterDestroy':_0x1d46('0x4')};function emitEvent(_0x3d1b18){return function(_0x1b82cb,_0x4d08cc,_0x4cee42){SmsQueueEvents[_0x1d46('0x5')](_0x3d1b18+':'+_0x1b82cb['id'],_0x1b82cb);SmsQueueEvents['emit'](_0x3d1b18,_0x1b82cb);_0x4cee42(null);};}for(var e in events){if(events[_0x1d46('0x6')](e)){var event=events[e];SmsQueue[_0x1d46('0x7')](e,emitEvent(event));}}module[_0x1d46('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 2e82caa..40eba08 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 _0x1fb5=['exports','define','SmsQueue','sms_queues','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x8e8eb2,_0x255fbc){var _0x143b80=function(_0x1fc2d9){while(--_0x1fc2d9){_0x8e8eb2['push'](_0x8e8eb2['shift']());}};_0x143b80(++_0x255fbc);}(_0x1fb5,0xae));var _0x51fb=function(_0x3dedb3,_0x5d2209){_0x3dedb3=_0x3dedb3-0x0;var _0x290b92=_0x1fb5[_0x3dedb3];return _0x290b92;};'use strict';var _=require('lodash');var util=require(_0x51fb('0x0'));var logger=require(_0x51fb('0x1'))('api');var moment=require(_0x51fb('0x2'));var BPromise=require(_0x51fb('0x3'));var rp=require(_0x51fb('0x4'));var fs=require('fs');var path=require(_0x51fb('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0x51fb('0x6')]=function(_0x2f7ff0,_0x2b2849){return _0x2f7ff0[_0x51fb('0x7')](_0x51fb('0x8'),attributes,{'tableName':_0x51fb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9192=['request-promise','path','../../config/environment','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5e81a1,_0x423aac){var _0x173291=function(_0x4a0c18){while(--_0x4a0c18){_0x5e81a1['push'](_0x5e81a1['shift']());}};_0x173291(++_0x423aac);}(_0x9192,0x1a7));var _0x2919=function(_0xd7b7c4,_0x3bde33){_0xd7b7c4=_0xd7b7c4-0x0;var _0x3701d4=_0x9192[_0xd7b7c4];return _0x3701d4;};'use strict';var _=require(_0x2919('0x0'));var util=require(_0x2919('0x1'));var logger=require(_0x2919('0x2'))(_0x2919('0x3'));var moment=require(_0x2919('0x4'));var BPromise=require(_0x2919('0x5'));var rp=require(_0x2919('0x6'));var fs=require('fs');var path=require(_0x2919('0x7'));var rimraf=require('rimraf');var config=require(_0x2919('0x8'));var attributes=require('./smsQueue.attributes');module[_0x2919('0x9')]=function(_0x119a63,_0x48fbec){return _0x119a63[_0x2919('0xa')](_0x2919('0xb'),attributes,{'tableName':_0x2919('0xc'),'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 23db381..356daf0 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 _0x06e5=['info','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','include','model','map','then','find','ShowSmsQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x4955b8,_0x50557d){var _0x1acb71=function(_0x2b3004){while(--_0x2b3004){_0x4955b8['push'](_0x4955b8['shift']());}};_0x1acb71(++_0x50557d);}(_0x06e5,0x81));var _0x506e=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x06e5[_0x279d37];return _0x530173;};'use strict';var _=require(_0x506e('0x0'));var util=require('util');var moment=require(_0x506e('0x1'));var BPromise=require(_0x506e('0x2'));var rs=require(_0x506e('0x3'));var fs=require('fs');var Redis=require(_0x506e('0x4'));var db=require(_0x506e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x506e('0x6'))(_0x506e('0x7'));var config=require('../../config/environment');var jayson=require(_0x506e('0x8'));var client=jayson[_0x506e('0x9')][_0x506e('0xa')]({'port':0x232a});config['redis']=_[_0x506e('0xb')](config[_0x506e('0xc')],{'host':_0x506e('0xd'),'port':0x18eb});var socket=require(_0x506e('0xe'))(new Redis(config['redis']));require(_0x506e('0xf'))['register'](socket);function respondWithRpcPromise(_0x553fc5,_0x32d9b4,_0x5eb944){return new BPromise(function(_0xda0f9f,_0x1c6422){return client['request'](_0x553fc5,_0x5eb944)['then'](function(_0x45be92){logger['info'](_0x506e('0x10'),_0x32d9b4,_0x506e('0x11'));logger[_0x506e('0x12')](_0x506e('0x13'),_0x32d9b4,_0x506e('0x11'),JSON[_0x506e('0x14')](_0x45be92));if(_0x45be92[_0x506e('0x15')]){if(_0x45be92[_0x506e('0x15')]['code']===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0x32d9b4,_0x45be92[_0x506e('0x15')][_0x506e('0x16')]);return _0x1c6422(_0x45be92[_0x506e('0x15')][_0x506e('0x16')]);}logger[_0x506e('0x15')](_0x506e('0x10'),_0x32d9b4,_0x45be92[_0x506e('0x15')][_0x506e('0x16')]);return _0xda0f9f(_0x45be92[_0x506e('0x15')][_0x506e('0x16')]);}else{logger[_0x506e('0x17')](_0x506e('0x10'),_0x32d9b4,_0x506e('0x11'));_0xda0f9f(_0x45be92['result'][_0x506e('0x16')]);}})[_0x506e('0x18')](function(_0x5b5c15){logger['error']('SmsQueue,\x20%s,\x20%s',_0x32d9b4,_0x5b5c15);_0x1c6422(_0x5b5c15);});});}exports[_0x506e('0x19')]=function(_0x506843){var _0x9548e8=this;return new Promise(function(_0x111ab1,_0x323ad7){return db[_0x506e('0x1a')][_0x506e('0x1b')]({'raw':_0x506843[_0x506e('0x1c')]?_0x506843[_0x506e('0x1c')][_0x506e('0x1d')]===undefined?!![]:![]:!![],'where':_0x506843[_0x506e('0x1c')]?_0x506843['options'][_0x506e('0x1e')]||null:null,'attributes':_0x506843[_0x506e('0x1c')]?_0x506843[_0x506e('0x1c')][_0x506e('0x1f')]||null:null,'limit':_0x506843[_0x506e('0x1c')]?_0x506843['options']['limit']||null:null,'include':_0x506843[_0x506e('0x1c')]?_0x506843[_0x506e('0x1c')][_0x506e('0x20')]?_['map'](_0x506843[_0x506e('0x1c')][_0x506e('0x20')],function(_0xfd7367){return{'model':db[_0xfd7367[_0x506e('0x21')]],'as':_0xfd7367['as'],'attributes':_0xfd7367[_0x506e('0x1f')],'include':_0xfd7367[_0x506e('0x20')]?_['map'](_0xfd7367[_0x506e('0x20')],function(_0x203c86){return{'model':db[_0x203c86[_0x506e('0x21')]],'as':_0x203c86['as'],'attributes':_0x203c86[_0x506e('0x1f')],'include':_0x203c86['include']?_[_0x506e('0x22')](_0x203c86[_0x506e('0x20')],function(_0x27af40){return{'model':db[_0x27af40[_0x506e('0x21')]],'as':_0x27af40['as'],'attributes':_0x27af40[_0x506e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x506e('0x23')](function(_0xf02f9d){logger[_0x506e('0x17')](_0x506e('0x19'),_0x506843);logger[_0x506e('0x12')](_0x506e('0x19'),_0x506843,JSON[_0x506e('0x14')](_0xf02f9d));_0x111ab1(_0xf02f9d);})[_0x506e('0x18')](function(_0x423c90){logger[_0x506e('0x15')]('GetSmsQueue',_0x423c90[_0x506e('0x16')],_0x506843);_0x323ad7(_0x9548e8['error'](0x1f4,_0x423c90[_0x506e('0x16')]));});});};exports['ShowSmsQueue']=function(_0x471cca){var _0x1c1c1e=this;return new Promise(function(_0x3c2b2e,_0x5da148){return db[_0x506e('0x1a')][_0x506e('0x24')]({'raw':_0x471cca[_0x506e('0x1c')]?_0x471cca[_0x506e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x471cca[_0x506e('0x1c')]?_0x471cca[_0x506e('0x1c')][_0x506e('0x1e')]||null:null,'attributes':_0x471cca[_0x506e('0x1c')]?_0x471cca[_0x506e('0x1c')][_0x506e('0x1f')]||null:null,'include':_0x471cca[_0x506e('0x1c')]?_0x471cca[_0x506e('0x1c')][_0x506e('0x20')]?_[_0x506e('0x22')](_0x471cca[_0x506e('0x1c')][_0x506e('0x20')],function(_0x5c1ec6){return{'model':db[_0x5c1ec6[_0x506e('0x21')]],'as':_0x5c1ec6['as'],'attributes':_0x5c1ec6[_0x506e('0x1f')],'include':_0x5c1ec6['include']?_['map'](_0x5c1ec6[_0x506e('0x20')],function(_0x1f33f2){return{'model':db[_0x1f33f2['model']],'as':_0x1f33f2['as'],'attributes':_0x1f33f2[_0x506e('0x1f')],'include':_0x1f33f2['include']?_[_0x506e('0x22')](_0x1f33f2[_0x506e('0x20')],function(_0x231fed){return{'model':db[_0x231fed[_0x506e('0x21')]],'as':_0x231fed['as'],'attributes':_0x231fed[_0x506e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x506e('0x23')](function(_0x48984c){logger[_0x506e('0x17')]('ShowSmsQueue',_0x471cca);logger[_0x506e('0x12')](_0x506e('0x25'),_0x471cca,JSON[_0x506e('0x14')](_0x48984c));_0x3c2b2e(_0x48984c);})[_0x506e('0x18')](function(_0x25ab83){logger[_0x506e('0x15')](_0x506e('0x25'),_0x25ab83['message'],_0x471cca);_0x5da148(_0x1c1c1e['error'](0x1f4,_0x25ab83['message']));});});}; \ No newline at end of file +var _0x657f=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','SmsQueue,\x20%s,\x20%s','result','GetSmsQueue','SmsQueue','findAll','options','attributes','limit','include','model','map','ShowSmsQueue','find','raw','where','catch','util','moment','bluebird'];(function(_0x50bd0f,_0x170f9a){var _0x4702ca=function(_0x448461){while(--_0x448461){_0x50bd0f['push'](_0x50bd0f['shift']());}};_0x4702ca(++_0x170f9a);}(_0x657f,0x123));var _0xf657=function(_0x2ade6f,_0x18d576){_0x2ade6f=_0x2ade6f-0x0;var _0x28fa0f=_0x657f[_0x2ade6f];return _0x28fa0f;};'use strict';var _=require('lodash');var util=require(_0xf657('0x0'));var moment=require(_0xf657('0x1'));var BPromise=require(_0xf657('0x2'));var rs=require(_0xf657('0x3'));var fs=require('fs');var Redis=require(_0xf657('0x4'));var db=require(_0xf657('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf657('0x6'))(_0xf657('0x7'));var config=require(_0xf657('0x8'));var jayson=require(_0xf657('0x9'));var client=jayson[_0xf657('0xa')][_0xf657('0xb')]({'port':0x232a});config[_0xf657('0xc')]=_[_0xf657('0xd')](config[_0xf657('0xc')],{'host':_0xf657('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf657('0xc')]));require('./smsQueue.socket')[_0xf657('0xf')](socket);function respondWithRpcPromise(_0x47276e,_0x2535c1,_0x31ea61){return new BPromise(function(_0x4fbca7,_0x475635){return client[_0xf657('0x10')](_0x47276e,_0x31ea61)[_0xf657('0x11')](function(_0x19a620){logger[_0xf657('0x12')]('SmsQueue,\x20%s,\x20%s',_0x2535c1,_0xf657('0x13'));logger[_0xf657('0x14')](_0xf657('0x15'),_0x2535c1,_0xf657('0x13'),JSON[_0xf657('0x16')](_0x19a620));if(_0x19a620['error']){if(_0x19a620['error'][_0xf657('0x17')]===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0x2535c1,_0x19a620[_0xf657('0x18')]['message']);return _0x475635(_0x19a620[_0xf657('0x18')][_0xf657('0x19')]);}logger[_0xf657('0x18')](_0xf657('0x1a'),_0x2535c1,_0x19a620[_0xf657('0x18')][_0xf657('0x19')]);return _0x4fbca7(_0x19a620[_0xf657('0x18')][_0xf657('0x19')]);}else{logger[_0xf657('0x12')](_0xf657('0x1a'),_0x2535c1,_0xf657('0x13'));_0x4fbca7(_0x19a620[_0xf657('0x1b')]['message']);}})['catch'](function(_0x419db3){logger[_0xf657('0x18')](_0xf657('0x1a'),_0x2535c1,_0x419db3);_0x475635(_0x419db3);});});}exports[_0xf657('0x1c')]=function(_0x3f81b4){var _0x1d8996=this;return new Promise(function(_0x48508a,_0xc19837){return db[_0xf657('0x1d')][_0xf657('0x1e')]({'raw':_0x3f81b4[_0xf657('0x1f')]?_0x3f81b4[_0xf657('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x3f81b4[_0xf657('0x1f')]?_0x3f81b4[_0xf657('0x1f')]['where']||null:null,'attributes':_0x3f81b4['options']?_0x3f81b4[_0xf657('0x1f')][_0xf657('0x20')]||null:null,'limit':_0x3f81b4[_0xf657('0x1f')]?_0x3f81b4[_0xf657('0x1f')][_0xf657('0x21')]||null:null,'include':_0x3f81b4[_0xf657('0x1f')]?_0x3f81b4[_0xf657('0x1f')][_0xf657('0x22')]?_['map'](_0x3f81b4['options']['include'],function(_0x688f11){return{'model':db[_0x688f11[_0xf657('0x23')]],'as':_0x688f11['as'],'attributes':_0x688f11[_0xf657('0x20')],'include':_0x688f11[_0xf657('0x22')]?_[_0xf657('0x24')](_0x688f11['include'],function(_0x242848){return{'model':db[_0x242848[_0xf657('0x23')]],'as':_0x242848['as'],'attributes':_0x242848[_0xf657('0x20')],'include':_0x242848['include']?_[_0xf657('0x24')](_0x242848[_0xf657('0x22')],function(_0x1197b4){return{'model':db[_0x1197b4['model']],'as':_0x1197b4['as'],'attributes':_0x1197b4['attributes']};}):[]};}):[]};}):[]:[]})[_0xf657('0x11')](function(_0x4f9b7e){logger[_0xf657('0x12')](_0xf657('0x1c'),_0x3f81b4);logger[_0xf657('0x14')]('GetSmsQueue',_0x3f81b4,JSON['stringify'](_0x4f9b7e));_0x48508a(_0x4f9b7e);})['catch'](function(_0x2acf74){logger[_0xf657('0x18')](_0xf657('0x1c'),_0x2acf74[_0xf657('0x19')],_0x3f81b4);_0xc19837(_0x1d8996['error'](0x1f4,_0x2acf74[_0xf657('0x19')]));});});};exports[_0xf657('0x25')]=function(_0x165073){var _0x505974=this;return new Promise(function(_0x1c555c,_0x134e63){return db[_0xf657('0x1d')][_0xf657('0x26')]({'raw':_0x165073['options']?_0x165073[_0xf657('0x1f')][_0xf657('0x27')]===undefined?!![]:![]:!![],'where':_0x165073[_0xf657('0x1f')]?_0x165073[_0xf657('0x1f')][_0xf657('0x28')]||null:null,'attributes':_0x165073['options']?_0x165073[_0xf657('0x1f')]['attributes']||null:null,'include':_0x165073[_0xf657('0x1f')]?_0x165073['options'][_0xf657('0x22')]?_[_0xf657('0x24')](_0x165073[_0xf657('0x1f')][_0xf657('0x22')],function(_0x484600){return{'model':db[_0x484600[_0xf657('0x23')]],'as':_0x484600['as'],'attributes':_0x484600[_0xf657('0x20')],'include':_0x484600[_0xf657('0x22')]?_[_0xf657('0x24')](_0x484600[_0xf657('0x22')],function(_0x29cf5d){return{'model':db[_0x29cf5d[_0xf657('0x23')]],'as':_0x29cf5d['as'],'attributes':_0x29cf5d[_0xf657('0x20')],'include':_0x29cf5d['include']?_['map'](_0x29cf5d['include'],function(_0x15b645){return{'model':db[_0x15b645['model']],'as':_0x15b645['as'],'attributes':_0x15b645[_0xf657('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf657('0x11')](function(_0x1af147){logger['info']('ShowSmsQueue',_0x165073);logger[_0xf657('0x14')](_0xf657('0x25'),_0x165073,JSON[_0xf657('0x16')](_0x1af147));_0x1c555c(_0x1af147);})[_0xf657('0x29')](function(_0x36e860){logger[_0xf657('0x18')](_0xf657('0x25'),_0x36e860[_0xf657('0x19')],_0x165073);_0x134e63(_0x505974[_0xf657('0x18')](0x1f4,_0x36e860['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 2c21709..ac21627 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 _0x8d31=['emit','removeListener','register'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0x8d31,0xcf));var _0x18d3=function(_0x1d6263,_0x34f981){_0x1d6263=_0x1d6263-0x0;var _0xabc62=_0x8d31[_0x1d6263];return _0xabc62;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save','remove','update'];function createListener(_0x232508,_0x455b25){return function(_0x30ce2a){_0x455b25[_0x18d3('0x0')](_0x232508,_0x30ce2a);};}function removeListener(_0xa30f2a,_0x2f35e6){return function(){SmsQueueEvents[_0x18d3('0x1')](_0xa30f2a,_0x2f35e6);};}exports[_0x18d3('0x2')]=function(_0x4a8639){for(var _0x79e1a9=0x0,_0x4c7b95=events['length'];_0x79e1a9<_0x4c7b95;_0x79e1a9++){var _0x1ee1c6=events[_0x79e1a9];var _0x3e7da4=createListener('smsQueue:'+_0x1ee1c6,_0x4a8639);SmsQueueEvents['on'](_0x1ee1c6,_0x3e7da4);}}; \ No newline at end of file +var _0x2101=['register','smsQueue:','./smsQueue.events','save','update','emit'];(function(_0x33dfb3,_0x1cb807){var _0x4d0fdc=function(_0x1eddfe){while(--_0x1eddfe){_0x33dfb3['push'](_0x33dfb3['shift']());}};_0x4d0fdc(++_0x1cb807);}(_0x2101,0xa4));var _0x1210=function(_0x43d49e,_0xa99956){_0x43d49e=_0x43d49e-0x0;var _0x1e4ade=_0x2101[_0x43d49e];return _0x1e4ade;};'use strict';var SmsQueueEvents=require(_0x1210('0x0'));var events=[_0x1210('0x1'),'remove',_0x1210('0x2')];function createListener(_0x31d687,_0x4ec352){return function(_0x2e694b){_0x4ec352[_0x1210('0x3')](_0x31d687,_0x2e694b);};}function removeListener(_0x268b26,_0x3ae638){return function(){SmsQueueEvents['removeListener'](_0x268b26,_0x3ae638);};}exports[_0x1210('0x4')]=function(_0x4ab837){for(var _0x39d5e3=0x0,_0x15f888=events['length'];_0x39d5e3<_0x15f888;_0x39d5e3++){var _0x4b29fe=events[_0x39d5e3];var _0x40a567=createListener(_0x1210('0x5')+_0x4b29fe,_0x4ab837);SmsQueueEvents['on'](_0x4b29fe,_0x40a567);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 79834ef..2f55248 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 _0x04de=['/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','isAuthenticated','describe'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x04de,0x1d7));var _0xe04d=function(_0x1470dd,_0x3b0d0d){_0x1470dd=_0x1470dd-0x0;var _0x337714=_0x04de[_0x1470dd];return _0x337714;};'use strict';var multer=require(_0xe04d('0x0'));var util=require('util');var path=require(_0xe04d('0x1'));var timeout=require(_0xe04d('0x2'));var express=require(_0xe04d('0x3'));var router=express[_0xe04d('0x4')]();var auth=require(_0xe04d('0x5'));var interaction=require(_0xe04d('0x6'));var config=require(_0xe04d('0x7'));var controller=require(_0xe04d('0x8'));router[_0xe04d('0x9')]('/',auth['isAuthenticated'](),controller[_0xe04d('0xa')]);router['get']('/describe',auth[_0xe04d('0xb')](),controller[_0xe04d('0xc')]);router['get'](_0xe04d('0xd'),auth[_0xe04d('0xb')](),controller[_0xe04d('0xe')]);router[_0xe04d('0xf')]('/',auth[_0xe04d('0xb')](),controller[_0xe04d('0x10')]);router[_0xe04d('0x11')]('/:id',auth[_0xe04d('0xb')](),controller[_0xe04d('0x12')]);router[_0xe04d('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xe04d('0x14')]);module[_0xe04d('0x15')]=router; \ No newline at end of file +var _0x645d=['connect-timeout','Router','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','destroy','exports','util','path'];(function(_0x17618a,_0x43bd98){var _0x4bb4eb=function(_0x3e3f97){while(--_0x3e3f97){_0x17618a['push'](_0x17618a['shift']());}};_0x4bb4eb(++_0x43bd98);}(_0x645d,0x17a));var _0xd645=function(_0x16270b,_0x4ff120){_0x16270b=_0x16270b-0x0;var _0x2cd122=_0x645d[_0x16270b];return _0x2cd122;};'use strict';var multer=require('multer');var util=require(_0xd645('0x0'));var path=require(_0xd645('0x1'));var timeout=require(_0xd645('0x2'));var express=require('express');var router=express[_0xd645('0x3')]();var auth=require(_0xd645('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd645('0x5'));var controller=require(_0xd645('0x6'));router[_0xd645('0x7')]('/',auth[_0xd645('0x8')](),controller[_0xd645('0x9')]);router[_0xd645('0x7')](_0xd645('0xa'),auth[_0xd645('0x8')](),controller[_0xd645('0xb')]);router[_0xd645('0x7')](_0xd645('0xc'),auth[_0xd645('0x8')](),controller[_0xd645('0xd')]);router[_0xd645('0xe')]('/',auth[_0xd645('0x8')](),controller[_0xd645('0xf')]);router[_0xd645('0x10')](_0xd645('0xc'),auth[_0xd645('0x8')](),controller['update']);router['delete'](_0xd645('0xc'),auth[_0xd645('0x8')](),controller[_0xd645('0x11')]);module[_0xd645('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index b8ebf12..e0eb360 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 _0xba91=['DATE','STRING','moment','sequelize','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xba91,0x133));var _0x1ba9=function(_0x1b1f52,_0x47899a){_0x1b1f52=_0x1b1f52-0x0;var _0x31ec65=_0xba91[_0x1b1f52];return _0x31ec65;};'use strict';var moment=require(_0x1ba9('0x0'));var Sequelize=require(_0x1ba9('0x1'));module[_0x1ba9('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x1ba9('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x1ba9('0x3')]},'exitAt':{'type':Sequelize[_0x1ba9('0x3')]},'reason':{'type':Sequelize[_0x1ba9('0x4')]}}; \ No newline at end of file +var _0x89b2=['DATE','moment','sequelize','exports','STRING'];(function(_0x39dee9,_0x47db8f){var _0x15b583=function(_0x32140e){while(--_0x32140e){_0x39dee9['push'](_0x39dee9['shift']());}};_0x15b583(++_0x47db8f);}(_0x89b2,0x17d));var _0x289b=function(_0x215971,_0x37ea84){_0x215971=_0x215971-0x0;var _0x1031a4=_0x89b2[_0x215971];return _0x1031a4;};'use strict';var moment=require(_0x289b('0x0'));var Sequelize=require(_0x289b('0x1'));module[_0x289b('0x2')]={'uniqueid':{'type':Sequelize[_0x289b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x289b('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x289b('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x289b('0x4')]},'reason':{'type':Sequelize[_0x289b('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 8189663..c1130f3 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 _0x44d1=['rows','catch','show','params','keys','length','includeAll','options','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','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','../../mysqldb','status','json','offset','limit','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','key','query','filters','intersection','attributes','model','fields','nolimit','order','sort','pick','filter','merge','type','VIRTUAL','where','count','include'];(function(_0x5a60ce,_0x48f080){var _0x393e5e=function(_0x1c58fc){while(--_0x1c58fc){_0x5a60ce['push'](_0x5a60ce['shift']());}};_0x393e5e(++_0x48f080);}(_0x44d1,0x1da));var _0x144d=function(_0x34c382,_0x3f45c3){_0x34c382=_0x34c382-0x0;var _0x2fcb3c=_0x44d1[_0x34c382];return _0x2fcb3c;};'use strict';var pdf=require(_0x144d('0x0'));var emlformat=require(_0x144d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x144d('0x2'));var jsonpatch=require(_0x144d('0x3'));var rp=require('request-promise');var moment=require(_0x144d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x144d('0x5'));var util=require('util');var path=require(_0x144d('0x6'));var sox=require(_0x144d('0x7'));var csv=require(_0x144d('0x8'));var ejs=require(_0x144d('0x9'));var fs=require('fs');var _=require(_0x144d('0xa'));var squel=require(_0x144d('0xb'));var crypto=require(_0x144d('0xc'));var jsforce=require(_0x144d('0xd'));var deskjs=require(_0x144d('0xe'));var toCsv=require(_0x144d('0x8'));var querystring=require(_0x144d('0xf'));var Papa=require(_0x144d('0x10'));var Redis=require(_0x144d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x144d('0x12'));var as=require(_0x144d('0x13'));var hardwareService=require(_0x144d('0x14'));var logger=require(_0x144d('0x15'))(_0x144d('0x16'));var utils=require(_0x144d('0x17'));var config=require(_0x144d('0x18'));var db=require(_0x144d('0x19'))['db'];function respondWithStatusCode(_0x160f76,_0x22973d){_0x22973d=_0x22973d||0xcc;return function(_0x3855e1){if(_0x3855e1){return _0x160f76['sendStatus'](_0x22973d);}return _0x160f76['status'](_0x22973d)['end']();};}function respondWithResult(_0x47e4f7,_0x4076e8){_0x4076e8=_0x4076e8||0xc8;return function(_0x22b704){if(_0x22b704){return _0x47e4f7[_0x144d('0x1a')](_0x4076e8)[_0x144d('0x1b')](_0x22b704);}};}function respondWithFilteredResult(_0x4d74af,_0x58aece){return function(_0x3bb686){if(_0x3bb686){var _0x2d42e0=_0x3bb686['count'],_0x545986=_0x58aece[_0x144d('0x1c')],_0x1c500c=_0x58aece[_0x144d('0x1c')]+_0x58aece[_0x144d('0x1d')],_0x45c105;if(_0x1c500c>=_0x2d42e0){_0x1c500c=_0x2d42e0;_0x45c105=0xc8;}else{_0x45c105=0xce;}_0x4d74af[_0x144d('0x1a')](_0x45c105);return _0x4d74af['set'](_0x144d('0x1e'),_0x545986+'-'+_0x1c500c+'/'+_0x2d42e0)[_0x144d('0x1b')](_0x3bb686);}return null;};}function patchUpdates(_0x5c1e08){return function(_0x3bdbc5){try{jsonpatch[_0x144d('0x1f')](_0x3bdbc5,_0x5c1e08,!![]);}catch(_0x252f0f){return BPromise[_0x144d('0x20')](_0x252f0f);}return _0x3bdbc5['save']();};}function saveUpdates(_0x5c7fa9,_0x23d87c){return function(_0x121c92){if(_0x121c92){return _0x121c92[_0x144d('0x21')](_0x5c7fa9)[_0x144d('0x22')](function(_0x2ec0d2){return _0x2ec0d2;});}return null;};}function removeEntity(_0x11253,_0x36ce7a){return function(_0x1eb513){if(_0x1eb513){return _0x1eb513[_0x144d('0x23')]()['then'](function(){_0x11253['status'](0xcc)[_0x144d('0x24')]();});}};}function handleEntityNotFound(_0x2c2601,_0x3ea7eb){return function(_0x46e0ea){if(!_0x46e0ea){_0x2c2601[_0x144d('0x25')](0x194);}return _0x46e0ea;};}function handleError(_0x3bc778,_0x2cdf3d){_0x2cdf3d=_0x2cdf3d||0x1f4;return function(_0x4d8ad8){logger[_0x144d('0x26')](_0x4d8ad8[_0x144d('0x27')]);if(_0x4d8ad8[_0x144d('0x28')]){delete _0x4d8ad8[_0x144d('0x28')];}_0x3bc778[_0x144d('0x1a')](_0x2cdf3d)[_0x144d('0x29')](_0x4d8ad8);};}exports[_0x144d('0x2a')]=function(_0x26dca8,_0x1d1385){var _0x19a631={},_0x5697b8={},_0x5275db={'count':0x0,'rows':[]};var _0x2daa90=_[_0x144d('0x2b')](db[_0x144d('0x2c')][_0x144d('0x2d')],function(_0x390b4c){return{'name':_0x390b4c[_0x144d('0x2e')],'type':_0x390b4c['type'][_0x144d('0x2f')]};});_0x5697b8['model']=_['map'](_0x2daa90,'name');_0x5697b8[_0x144d('0x30')]=_['keys'](_0x26dca8[_0x144d('0x30')]);_0x5697b8[_0x144d('0x31')]=_[_0x144d('0x32')](_0x5697b8['model'],_0x5697b8[_0x144d('0x30')]);_0x19a631[_0x144d('0x33')]=_[_0x144d('0x32')](_0x5697b8[_0x144d('0x34')],qs['fields'](_0x26dca8['query'][_0x144d('0x35')]));_0x19a631['attributes']=_0x19a631[_0x144d('0x33')]['length']?_0x19a631['attributes']:_0x5697b8[_0x144d('0x34')];if(!_0x26dca8['query']['hasOwnProperty'](_0x144d('0x36'))){_0x19a631[_0x144d('0x1d')]=qs[_0x144d('0x1d')](_0x26dca8[_0x144d('0x30')][_0x144d('0x1d')]);_0x19a631[_0x144d('0x1c')]=qs['offset'](_0x26dca8[_0x144d('0x30')][_0x144d('0x1c')]);}_0x19a631[_0x144d('0x37')]=qs[_0x144d('0x38')](_0x26dca8[_0x144d('0x30')][_0x144d('0x38')]);_0x19a631['where']=qs[_0x144d('0x31')](_[_0x144d('0x39')](_0x26dca8[_0x144d('0x30')],_0x5697b8['filters']));if(_0x26dca8[_0x144d('0x30')][_0x144d('0x3a')]){_0x19a631['where']=_[_0x144d('0x3b')](_0x19a631['where'],{'$or':_[_0x144d('0x2b')](_0x2daa90,function(_0x44e8c1){if(_0x44e8c1[_0x144d('0x3c')]!==_0x144d('0x3d')){var _0x97c9b9={};_0x97c9b9[_0x44e8c1[_0x144d('0x28')]]={'$like':'%'+_0x26dca8[_0x144d('0x30')][_0x144d('0x3a')]+'%'};return _0x97c9b9;}})});}_0x19a631=_['merge']({},_0x19a631,_0x26dca8['options']);var _0x351133={'where':_0x19a631[_0x144d('0x3e')]};return db[_0x144d('0x2c')]['count'](_0x351133)[_0x144d('0x22')](function(_0x380101){_0x5275db[_0x144d('0x3f')]=_0x380101;if(_0x26dca8[_0x144d('0x30')]['includeAll']){_0x19a631[_0x144d('0x40')]=[{'all':!![]}];}return db[_0x144d('0x2c')]['findAll'](_0x19a631);})['then'](function(_0x570d03){_0x5275db[_0x144d('0x41')]=_0x570d03;return _0x5275db;})['then'](respondWithFilteredResult(_0x1d1385,_0x19a631))[_0x144d('0x42')](handleError(_0x1d1385,null));};exports[_0x144d('0x43')]=function(_0x2ea181,_0x2eb903){var _0x24864b={'raw':!![],'where':{'id':_0x2ea181[_0x144d('0x44')]['id']}},_0x3695c5={};_0x3695c5[_0x144d('0x34')]=_[_0x144d('0x45')](db[_0x144d('0x2c')][_0x144d('0x2d')]);_0x3695c5[_0x144d('0x30')]=_[_0x144d('0x45')](_0x2ea181['query']);_0x3695c5[_0x144d('0x31')]=_['intersection'](_0x3695c5[_0x144d('0x34')],_0x3695c5[_0x144d('0x30')]);_0x24864b['attributes']=_['intersection'](_0x3695c5[_0x144d('0x34')],qs[_0x144d('0x35')](_0x2ea181[_0x144d('0x30')][_0x144d('0x35')]));_0x24864b['attributes']=_0x24864b[_0x144d('0x33')][_0x144d('0x46')]?_0x24864b[_0x144d('0x33')]:_0x3695c5[_0x144d('0x34')];if(_0x2ea181[_0x144d('0x30')][_0x144d('0x47')]){_0x24864b[_0x144d('0x40')]=[{'all':!![]}];}_0x24864b=_[_0x144d('0x3b')]({},_0x24864b,_0x2ea181[_0x144d('0x48')]);return db[_0x144d('0x2c')]['find'](_0x24864b)[_0x144d('0x22')](handleEntityNotFound(_0x2eb903,null))[_0x144d('0x22')](respondWithResult(_0x2eb903,null))['catch'](handleError(_0x2eb903,null));};exports['create']=function(_0x69b7e5,_0x5be65f){return db[_0x144d('0x2c')][_0x144d('0x49')](_0x69b7e5['body'],{})[_0x144d('0x22')](respondWithResult(_0x5be65f,0xc9))[_0x144d('0x42')](handleError(_0x5be65f,null));};exports[_0x144d('0x21')]=function(_0x2560e9,_0x528e87){if(_0x2560e9[_0x144d('0x4a')]['id']){delete _0x2560e9['body']['id'];}return db['SmsQueueReport'][_0x144d('0x4b')]({'where':{'id':_0x2560e9[_0x144d('0x44')]['id']}})[_0x144d('0x22')](handleEntityNotFound(_0x528e87,null))[_0x144d('0x22')](saveUpdates(_0x2560e9[_0x144d('0x4a')],null))[_0x144d('0x22')](respondWithResult(_0x528e87,null))['catch'](handleError(_0x528e87,null));};exports[_0x144d('0x23')]=function(_0x3adbfb,_0x59abdf){return db[_0x144d('0x2c')][_0x144d('0x4b')]({'where':{'id':_0x3adbfb[_0x144d('0x44')]['id']}})['then'](handleEntityNotFound(_0x59abdf,null))[_0x144d('0x22')](removeEntity(_0x59abdf,null))[_0x144d('0x42')](handleError(_0x59abdf,null));};exports['describe']=function(_0xc60e7c,_0x489a2c){return db[_0x144d('0x2c')][_0x144d('0x4c')]()['then'](respondWithResult(_0x489a2c,null))[_0x144d('0x42')](handleError(_0x489a2c,null));}; \ No newline at end of file +var _0x1af1=['create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SmsQueueReport','count','includeAll','findAll','rows','catch','show','params','include','find'];(function(_0x4431c2,_0x1d8359){var _0x448334=function(_0x3b2ff0){while(--_0x3b2ff0){_0x4431c2['push'](_0x4431c2['shift']());}};_0x448334(++_0x1d8359);}(_0x1af1,0x97));var _0x11af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1af1[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x11af('0x0'));var emlformat=require(_0x11af('0x1'));var rimraf=require(_0x11af('0x2'));var zipdir=require(_0x11af('0x3'));var jsonpatch=require(_0x11af('0x4'));var rp=require(_0x11af('0x5'));var moment=require('moment');var BPromise=require(_0x11af('0x6'));var Mustache=require(_0x11af('0x7'));var util=require('util');var path=require('path');var sox=require(_0x11af('0x8'));var csv=require(_0x11af('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x11af('0xa'));var squel=require(_0x11af('0xb'));var crypto=require(_0x11af('0xc'));var jsforce=require(_0x11af('0xd'));var deskjs=require(_0x11af('0xe'));var toCsv=require(_0x11af('0x9'));var querystring=require(_0x11af('0xf'));var Papa=require(_0x11af('0x10'));var Redis=require(_0x11af('0x11'));var authService=require(_0x11af('0x12'));var qs=require(_0x11af('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x11af('0x14'));var logger=require('../../config/logger')(_0x11af('0x15'));var utils=require(_0x11af('0x16'));var config=require('../../config/environment');var db=require(_0x11af('0x17'))['db'];function respondWithStatusCode(_0x4716a1,_0x2ddbd){_0x2ddbd=_0x2ddbd||0xcc;return function(_0x25bba1){if(_0x25bba1){return _0x4716a1['sendStatus'](_0x2ddbd);}return _0x4716a1[_0x11af('0x18')](_0x2ddbd)[_0x11af('0x19')]();};}function respondWithResult(_0xf5f40f,_0x29a162){_0x29a162=_0x29a162||0xc8;return function(_0x271e4b){if(_0x271e4b){return _0xf5f40f[_0x11af('0x18')](_0x29a162)[_0x11af('0x1a')](_0x271e4b);}};}function respondWithFilteredResult(_0xe8a28c,_0x471b14){return function(_0xb31b5c){if(_0xb31b5c){var _0x33542f=_0xb31b5c['count'],_0x483405=_0x471b14[_0x11af('0x1b')],_0x1d40c0=_0x471b14[_0x11af('0x1b')]+_0x471b14[_0x11af('0x1c')],_0x373978;if(_0x1d40c0>=_0x33542f){_0x1d40c0=_0x33542f;_0x373978=0xc8;}else{_0x373978=0xce;}_0xe8a28c[_0x11af('0x18')](_0x373978);return _0xe8a28c[_0x11af('0x1d')](_0x11af('0x1e'),_0x483405+'-'+_0x1d40c0+'/'+_0x33542f)[_0x11af('0x1a')](_0xb31b5c);}return null;};}function patchUpdates(_0x376833){return function(_0x555dad){try{jsonpatch[_0x11af('0x1f')](_0x555dad,_0x376833,!![]);}catch(_0xb2cff){return BPromise[_0x11af('0x20')](_0xb2cff);}return _0x555dad[_0x11af('0x21')]();};}function saveUpdates(_0x81b6eb,_0x275570){return function(_0x22ff99){if(_0x22ff99){return _0x22ff99[_0x11af('0x22')](_0x81b6eb)[_0x11af('0x23')](function(_0x1f4704){return _0x1f4704;});}return null;};}function removeEntity(_0xf8dfa8,_0x464002){return function(_0x49ee44){if(_0x49ee44){return _0x49ee44[_0x11af('0x24')]()[_0x11af('0x23')](function(){_0xf8dfa8['status'](0xcc)[_0x11af('0x19')]();});}};}function handleEntityNotFound(_0x11515b,_0x329f5d){return function(_0x52c79b){if(!_0x52c79b){_0x11515b[_0x11af('0x25')](0x194);}return _0x52c79b;};}function handleError(_0x29a105,_0x29e08c){_0x29e08c=_0x29e08c||0x1f4;return function(_0x2ca90a){logger[_0x11af('0x26')](_0x2ca90a['stack']);if(_0x2ca90a['name']){delete _0x2ca90a[_0x11af('0x27')];}_0x29a105[_0x11af('0x18')](_0x29e08c)['send'](_0x2ca90a);};}exports[_0x11af('0x28')]=function(_0x229fbd,_0x41f6ff){var _0x5de97a={},_0x1beef2={},_0x48ee87={'count':0x0,'rows':[]};var _0x428f67=_[_0x11af('0x29')](db['SmsQueueReport'][_0x11af('0x2a')],function(_0x2957d0){return{'name':_0x2957d0['fieldName'],'type':_0x2957d0['type'][_0x11af('0x2b')]};});_0x1beef2[_0x11af('0x2c')]=_[_0x11af('0x29')](_0x428f67,_0x11af('0x27'));_0x1beef2[_0x11af('0x2d')]=_[_0x11af('0x2e')](_0x229fbd[_0x11af('0x2d')]);_0x1beef2[_0x11af('0x2f')]=_[_0x11af('0x30')](_0x1beef2[_0x11af('0x2c')],_0x1beef2['query']);_0x5de97a[_0x11af('0x31')]=_[_0x11af('0x30')](_0x1beef2[_0x11af('0x2c')],qs[_0x11af('0x32')](_0x229fbd[_0x11af('0x2d')]['fields']));_0x5de97a[_0x11af('0x31')]=_0x5de97a[_0x11af('0x31')][_0x11af('0x33')]?_0x5de97a[_0x11af('0x31')]:_0x1beef2[_0x11af('0x2c')];if(!_0x229fbd['query']['hasOwnProperty'](_0x11af('0x34'))){_0x5de97a[_0x11af('0x1c')]=qs['limit'](_0x229fbd['query'][_0x11af('0x1c')]);_0x5de97a['offset']=qs[_0x11af('0x1b')](_0x229fbd[_0x11af('0x2d')][_0x11af('0x1b')]);}_0x5de97a[_0x11af('0x35')]=qs['sort'](_0x229fbd[_0x11af('0x2d')][_0x11af('0x36')]);_0x5de97a[_0x11af('0x37')]=qs[_0x11af('0x2f')](_[_0x11af('0x38')](_0x229fbd[_0x11af('0x2d')],_0x1beef2[_0x11af('0x2f')]));if(_0x229fbd[_0x11af('0x2d')][_0x11af('0x39')]){_0x5de97a['where']=_[_0x11af('0x3a')](_0x5de97a[_0x11af('0x37')],{'$or':_['map'](_0x428f67,function(_0x106386){if(_0x106386['type']!==_0x11af('0x3b')){var _0x35e311={};_0x35e311[_0x106386['name']]={'$like':'%'+_0x229fbd[_0x11af('0x2d')]['filter']+'%'};return _0x35e311;}})});}_0x5de97a=_['merge']({},_0x5de97a,_0x229fbd[_0x11af('0x3c')]);var _0x182fc1={'where':_0x5de97a[_0x11af('0x37')]};return db[_0x11af('0x3d')]['count'](_0x182fc1)[_0x11af('0x23')](function(_0x588cad){_0x48ee87[_0x11af('0x3e')]=_0x588cad;if(_0x229fbd[_0x11af('0x2d')][_0x11af('0x3f')]){_0x5de97a['include']=[{'all':!![]}];}return db[_0x11af('0x3d')][_0x11af('0x40')](_0x5de97a);})['then'](function(_0x3b507f){_0x48ee87[_0x11af('0x41')]=_0x3b507f;return _0x48ee87;})[_0x11af('0x23')](respondWithFilteredResult(_0x41f6ff,_0x5de97a))[_0x11af('0x42')](handleError(_0x41f6ff,null));};exports[_0x11af('0x43')]=function(_0x2eff24,_0x4c4d20){var _0x2d0ec6={'raw':!![],'where':{'id':_0x2eff24[_0x11af('0x44')]['id']}},_0xa5cdd9={};_0xa5cdd9[_0x11af('0x2c')]=_[_0x11af('0x2e')](db[_0x11af('0x3d')][_0x11af('0x2a')]);_0xa5cdd9[_0x11af('0x2d')]=_[_0x11af('0x2e')](_0x2eff24[_0x11af('0x2d')]);_0xa5cdd9[_0x11af('0x2f')]=_['intersection'](_0xa5cdd9[_0x11af('0x2c')],_0xa5cdd9[_0x11af('0x2d')]);_0x2d0ec6[_0x11af('0x31')]=_[_0x11af('0x30')](_0xa5cdd9[_0x11af('0x2c')],qs[_0x11af('0x32')](_0x2eff24[_0x11af('0x2d')]['fields']));_0x2d0ec6[_0x11af('0x31')]=_0x2d0ec6[_0x11af('0x31')][_0x11af('0x33')]?_0x2d0ec6[_0x11af('0x31')]:_0xa5cdd9[_0x11af('0x2c')];if(_0x2eff24[_0x11af('0x2d')][_0x11af('0x3f')]){_0x2d0ec6[_0x11af('0x45')]=[{'all':!![]}];}_0x2d0ec6=_[_0x11af('0x3a')]({},_0x2d0ec6,_0x2eff24[_0x11af('0x3c')]);return db[_0x11af('0x3d')][_0x11af('0x46')](_0x2d0ec6)[_0x11af('0x23')](handleEntityNotFound(_0x4c4d20,null))[_0x11af('0x23')](respondWithResult(_0x4c4d20,null))[_0x11af('0x42')](handleError(_0x4c4d20,null));};exports['create']=function(_0x37fce7,_0x56e59a){return db[_0x11af('0x3d')][_0x11af('0x47')](_0x37fce7['body'],{})[_0x11af('0x23')](respondWithResult(_0x56e59a,0xc9))[_0x11af('0x42')](handleError(_0x56e59a,null));};exports[_0x11af('0x22')]=function(_0x4fe393,_0x3d69b1){if(_0x4fe393[_0x11af('0x48')]['id']){delete _0x4fe393[_0x11af('0x48')]['id'];}return db[_0x11af('0x3d')]['find']({'where':{'id':_0x4fe393['params']['id']}})['then'](handleEntityNotFound(_0x3d69b1,null))[_0x11af('0x23')](saveUpdates(_0x4fe393[_0x11af('0x48')],null))['then'](respondWithResult(_0x3d69b1,null))['catch'](handleError(_0x3d69b1,null));};exports[_0x11af('0x24')]=function(_0x1f72c5,_0x856317){return db[_0x11af('0x3d')][_0x11af('0x46')]({'where':{'id':_0x1f72c5['params']['id']}})[_0x11af('0x23')](handleEntityNotFound(_0x856317,null))[_0x11af('0x23')](removeEntity(_0x856317,null))[_0x11af('0x42')](handleError(_0x856317,null));};exports[_0x11af('0x49')]=function(_0x349467,_0x44bc74){return db[_0x11af('0x3d')][_0x11af('0x49')]()['then'](respondWithResult(_0x44bc74,null))[_0x11af('0x42')](handleError(_0x44bc74,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index d8ac96e..07998e8 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 _0xcecb=['bluebird','request-promise','path','rimraf','exports','define','SmsQueueReport','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xcecb,0xf8));var _0xbcec=function(_0x3762cd,_0x43838a){_0x3762cd=_0x3762cd-0x0;var _0x29b8e9=_0xcecb[_0x3762cd];return _0x29b8e9;};'use strict';var _=require(_0xbcec('0x0'));var util=require('util');var logger=require(_0xbcec('0x1'))(_0xbcec('0x2'));var moment=require(_0xbcec('0x3'));var BPromise=require(_0xbcec('0x4'));var rp=require(_0xbcec('0x5'));var fs=require('fs');var path=require(_0xbcec('0x6'));var rimraf=require(_0xbcec('0x7'));var config=require('../../config/environment');var attributes=require('./smsQueueReport.attributes');module[_0xbcec('0x8')]=function(_0x5efc49,_0x2c24fb){return _0x5efc49[_0xbcec('0x9')](_0xbcec('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0xbcec('0xb'),'fields':[_0xbcec('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x58a7=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsQueueReport.attributes','exports','SmsQueueReport','uniqueid'];(function(_0x2587ee,_0x5d8b3e){var _0x12a07d=function(_0x3c5b28){while(--_0x3c5b28){_0x2587ee['push'](_0x2587ee['shift']());}};_0x12a07d(++_0x5d8b3e);}(_0x58a7,0xf7));var _0x758a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x58a7[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x758a('0x0'));var util=require(_0x758a('0x1'));var logger=require(_0x758a('0x2'))(_0x758a('0x3'));var moment=require(_0x758a('0x4'));var BPromise=require(_0x758a('0x5'));var rp=require(_0x758a('0x6'));var fs=require('fs');var path=require(_0x758a('0x7'));var rimraf=require('rimraf');var config=require(_0x758a('0x8'));var attributes=require(_0x758a('0x9'));module[_0x758a('0xa')]=function(_0x294cf3,_0x5a34af){return _0x294cf3['define'](_0x758a('0xb'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x758a('0xc'),'fields':[_0x758a('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 a2ffa35..35216e6 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 _0xe52b=['update','where','attributes','limit','lodash','util','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','info','UpdateSmsQueueReport'];(function(_0x2b05d2,_0x4b9a1c){var _0x18e4e3=function(_0x3ef5d9){while(--_0x3ef5d9){_0x2b05d2['push'](_0x2b05d2['shift']());}};_0x18e4e3(++_0x4b9a1c);}(_0xe52b,0x16c));var _0xbe52=function(_0x4c0a33,_0xc859ab){_0x4c0a33=_0x4c0a33-0x0;var _0x557abb=_0xe52b[_0x4c0a33];return _0x557abb;};'use strict';var _=require(_0xbe52('0x0'));var util=require(_0xbe52('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe52('0x2'));var fs=require('fs');var Redis=require(_0xbe52('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbe52('0x4'));var config=require(_0xbe52('0x5'));var jayson=require(_0xbe52('0x6'));var client=jayson[_0xbe52('0x7')][_0xbe52('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24b7e5,_0x214caf,_0x3864f3){return new BPromise(function(_0x4065ff,_0x32d014){return client['request'](_0x24b7e5,_0x3864f3)[_0xbe52('0x9')](function(_0x319fce){logger['info'](_0xbe52('0xa'),_0x214caf,_0xbe52('0xb'));logger[_0xbe52('0xc')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x214caf,_0xbe52('0xb'),JSON[_0xbe52('0xd')](_0x319fce));if(_0x319fce[_0xbe52('0xe')]){if(_0x319fce[_0xbe52('0xe')][_0xbe52('0xf')]===0x1f4){logger[_0xbe52('0xe')](_0xbe52('0xa'),_0x214caf,_0x319fce[_0xbe52('0xe')]['message']);return _0x32d014(_0x319fce['error'][_0xbe52('0x10')]);}logger[_0xbe52('0xe')](_0xbe52('0xa'),_0x214caf,_0x319fce['error'][_0xbe52('0x10')]);return _0x4065ff(_0x319fce[_0xbe52('0xe')][_0xbe52('0x10')]);}else{logger['info'](_0xbe52('0xa'),_0x214caf,_0xbe52('0xb'));_0x4065ff(_0x319fce['result'][_0xbe52('0x10')]);}})[_0xbe52('0x11')](function(_0x1f99b6){logger[_0xbe52('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x214caf,_0x1f99b6);_0x32d014(_0x1f99b6);});});}exports[_0xbe52('0x12')]=function(_0x1d7e96){var _0x12ff2c=this;return new Promise(function(_0x3f2e26,_0x23e85b){return db[_0xbe52('0x13')][_0xbe52('0x14')](_0x1d7e96[_0xbe52('0x15')],{'raw':_0x1d7e96['options']?_0x1d7e96[_0xbe52('0x16')][_0xbe52('0x17')]===undefined?!![]:![]:!![]})[_0xbe52('0x9')](function(_0x9c23c){logger[_0xbe52('0x18')](_0xbe52('0x12'),_0x1d7e96);logger['debug'](_0xbe52('0x12'),_0x1d7e96,JSON[_0xbe52('0xd')](_0x9c23c));_0x3f2e26(_0x9c23c);})['catch'](function(_0x21b9aa){logger['error']('CreateSmsQueueReport',_0x21b9aa[_0xbe52('0x10')],_0x1d7e96);_0x23e85b(_0x12ff2c[_0xbe52('0xe')](0x1f4,_0x21b9aa[_0xbe52('0x10')]));});});};exports[_0xbe52('0x19')]=function(_0x1b367e){var _0x544822=this;return new Promise(function(_0x44be26,_0x8e8041){return db[_0xbe52('0x13')][_0xbe52('0x1a')](_0x1b367e['body'],{'raw':_0x1b367e[_0xbe52('0x16')]?_0x1b367e[_0xbe52('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b367e[_0xbe52('0x16')]?_0x1b367e[_0xbe52('0x16')][_0xbe52('0x1b')]||null:null,'attributes':_0x1b367e[_0xbe52('0x16')]?_0x1b367e[_0xbe52('0x16')][_0xbe52('0x1c')]||null:null,'limit':_0x1b367e['options']?_0x1b367e[_0xbe52('0x16')][_0xbe52('0x1d')]||null:null})[_0xbe52('0x9')](function(_0x1c45e4){logger['info']('UpdateSmsQueueReport',_0x1b367e);logger['debug'](_0xbe52('0x19'),_0x1b367e,JSON[_0xbe52('0xd')](_0x1c45e4));_0x44be26(_0x1c45e4);})[_0xbe52('0x11')](function(_0x110f73){logger[_0xbe52('0xe')]('UpdateSmsQueueReport',_0x110f73[_0xbe52('0x10')],_0x1b367e);_0x8e8041(_0x544822[_0xbe52('0xe')](0x1f4,_0x110f73['message']));});});}; \ No newline at end of file +var _0xa67b=['update','attributes','limit','UpdateSmsQueueReport','stringify','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','SmsQueueReport,\x20%s,\x20%s','result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa67b,0xfd));var _0xba67=function(_0x595311,_0x363980){_0x595311=_0x595311-0x0;var _0x3ddd83=_0xa67b[_0x595311];return _0x3ddd83;};'use strict';var _=require('lodash');var util=require(_0xba67('0x0'));var moment=require(_0xba67('0x1'));var BPromise=require('bluebird');var rs=require(_0xba67('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba67('0x3'))['db'];var utils=require(_0xba67('0x4'));var logger=require(_0xba67('0x5'))('rpc');var config=require(_0xba67('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xba67('0x7')][_0xba67('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a8d84,_0x188528,_0x3f5904){return new BPromise(function(_0x3ab578,_0x4de12a){return client[_0xba67('0x9')](_0x1a8d84,_0x3f5904)[_0xba67('0xa')](function(_0x51461c){logger[_0xba67('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x188528,_0xba67('0xc'));logger[_0xba67('0xd')](_0xba67('0xe'),_0x188528,_0xba67('0xc'),JSON['stringify'](_0x51461c));if(_0x51461c['error']){if(_0x51461c[_0xba67('0xf')][_0xba67('0x10')]===0x1f4){logger[_0xba67('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x188528,_0x51461c[_0xba67('0xf')][_0xba67('0x11')]);return _0x4de12a(_0x51461c['error'][_0xba67('0x11')]);}logger[_0xba67('0xf')](_0xba67('0x12'),_0x188528,_0x51461c['error'][_0xba67('0x11')]);return _0x3ab578(_0x51461c[_0xba67('0xf')][_0xba67('0x11')]);}else{logger[_0xba67('0xb')](_0xba67('0x12'),_0x188528,_0xba67('0xc'));_0x3ab578(_0x51461c[_0xba67('0x13')][_0xba67('0x11')]);}})[_0xba67('0x14')](function(_0x342158){logger[_0xba67('0xf')](_0xba67('0x12'),_0x188528,_0x342158);_0x4de12a(_0x342158);});});}exports[_0xba67('0x15')]=function(_0x29fdd7){var _0x1ce386=this;return new Promise(function(_0x54f33e,_0x3ed8ad){return db[_0xba67('0x16')]['create'](_0x29fdd7[_0xba67('0x17')],{'raw':_0x29fdd7[_0xba67('0x18')]?_0x29fdd7[_0xba67('0x18')][_0xba67('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x237adb){logger[_0xba67('0xb')]('CreateSmsQueueReport',_0x29fdd7);logger[_0xba67('0xd')](_0xba67('0x15'),_0x29fdd7,JSON['stringify'](_0x237adb));_0x54f33e(_0x237adb);})['catch'](function(_0x13789c){logger[_0xba67('0xf')]('CreateSmsQueueReport',_0x13789c[_0xba67('0x11')],_0x29fdd7);_0x3ed8ad(_0x1ce386[_0xba67('0xf')](0x1f4,_0x13789c[_0xba67('0x11')]));});});};exports['UpdateSmsQueueReport']=function(_0x1e227a){var _0xdc6d63=this;return new Promise(function(_0x9b9a74,_0x4ca94f){return db['SmsQueueReport'][_0xba67('0x1a')](_0x1e227a['body'],{'raw':_0x1e227a[_0xba67('0x18')]?_0x1e227a[_0xba67('0x18')][_0xba67('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e227a[_0xba67('0x18')]?_0x1e227a[_0xba67('0x18')]['where']||null:null,'attributes':_0x1e227a[_0xba67('0x18')]?_0x1e227a[_0xba67('0x18')][_0xba67('0x1b')]||null:null,'limit':_0x1e227a[_0xba67('0x18')]?_0x1e227a[_0xba67('0x18')][_0xba67('0x1c')]||null:null})[_0xba67('0xa')](function(_0x288391){logger[_0xba67('0xb')](_0xba67('0x1d'),_0x1e227a);logger[_0xba67('0xd')](_0xba67('0x1d'),_0x1e227a,JSON[_0xba67('0x1e')](_0x288391));_0x9b9a74(_0x288391);})[_0xba67('0x14')](function(_0x4b8b0a){logger['error'](_0xba67('0x1d'),_0x4b8b0a['message'],_0x1e227a);_0x4ca94f(_0xdc6d63[_0xba67('0xf')](0x1f4,_0x4b8b0a['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index cb9ba5c..2adebf3 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 _0x34b7=['/:id','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe'];(function(_0x2d9904,_0x1c3fae){var _0x5bd668=function(_0x2ce46d){while(--_0x2ce46d){_0x2d9904['push'](_0x2d9904['shift']());}};_0x5bd668(++_0x1c3fae);}(_0x34b7,0x196));var _0x734b=function(_0x51f632,_0x5a14d5){_0x51f632=_0x51f632-0x0;var _0x24cf36=_0x34b7[_0x51f632];return _0x24cf36;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var auth=require(_0x734b('0x4'));var interaction=require(_0x734b('0x5'));var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router[_0x734b('0x6')]('/',auth[_0x734b('0x7')](),controller[_0x734b('0x8')]);router[_0x734b('0x6')](_0x734b('0x9'),auth[_0x734b('0x7')](),controller['describe']);router[_0x734b('0x6')](_0x734b('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x734b('0x7')](),controller['create']);router[_0x734b('0xb')](_0x734b('0xa'),auth[_0x734b('0x7')](),controller[_0x734b('0xc')]);router[_0x734b('0xd')](_0x734b('0xa'),auth[_0x734b('0x7')](),controller[_0x734b('0xe')]);module[_0x734b('0xf')]=router; \ No newline at end of file +var _0x0713=['create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x3279a9,_0x3a966c){var _0x48bd4d=function(_0x59b3f6){while(--_0x59b3f6){_0x3279a9['push'](_0x3279a9['shift']());}};_0x48bd4d(++_0x3a966c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['post']('/',auth[_0x3071('0x8')](),controller[_0x3071('0xe')]);router[_0x3071('0xf')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller['update']);router[_0x3071('0x10')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0x11')]);module[_0x3071('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 7acb73b..856c48c 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 _0x2af0=['moment','sequelize','exports','STRING','ENUM','account','agent','queue','DATE','NOW'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x2af0,0x17c));var _0x02af=function(_0x43704b,_0x4f60db){_0x43704b=_0x43704b-0x0;var _0x160d44=_0x2af0[_0x43704b];return _0x160d44;};'use strict';var moment=require(_0x02af('0x0'));var Sequelize=require(_0x02af('0x1'));module[_0x02af('0x2')]={'uniqueid':{'type':Sequelize[_0x02af('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x02af('0x4')](_0x02af('0x5'),_0x02af('0x6'),_0x02af('0x7')),'allowNull':![],'defaultValue':_0x02af('0x7')},'transferredAt':{'type':Sequelize[_0x02af('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x02af('0x9')]}}; \ No newline at end of file +var _0x13f8=['moment','sequelize','exports','ENUM','account','agent','queue'];(function(_0x20c290,_0x47e736){var _0x3d7b3b=function(_0x5d837f){while(--_0x5d837f){_0x20c290['push'](_0x20c290['shift']());}};_0x3d7b3b(++_0x47e736);}(_0x13f8,0x18f));var _0x813f=function(_0x282c21,_0x46bf4d){_0x282c21=_0x282c21-0x0;var _0x131a05=_0x13f8[_0x282c21];return _0x131a05;};'use strict';var moment=require(_0x813f('0x0'));var Sequelize=require(_0x813f('0x1'));module[_0x813f('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x813f('0x3')](_0x813f('0x4'),_0x813f('0x5'),_0x813f('0x6')),'allowNull':![],'defaultValue':_0x813f('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index e7578cb..b8820c1 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 _0x3279=['describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','index','map','SmsTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','then','includeAll','include','rows','catch','show','create','body','find'];(function(_0x37da46,_0xeb1d89){var _0x16fee7=function(_0x2ba731){while(--_0x2ba731){_0x37da46['push'](_0x37da46['shift']());}};_0x16fee7(++_0xeb1d89);}(_0x3279,0x173));var _0x9327=function(_0xd084c5,_0x4aade1){_0xd084c5=_0xd084c5-0x0;var _0x41a91d=_0x3279[_0xd084c5];return _0x41a91d;};'use strict';var pdf=require(_0x9327('0x0'));var emlformat=require(_0x9327('0x1'));var rimraf=require(_0x9327('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9327('0x3'));var rp=require(_0x9327('0x4'));var moment=require(_0x9327('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9327('0x6'));var util=require(_0x9327('0x7'));var path=require(_0x9327('0x8'));var sox=require(_0x9327('0x9'));var csv=require(_0x9327('0xa'));var ejs=require(_0x9327('0xb'));var fs=require('fs');var _=require(_0x9327('0xc'));var squel=require(_0x9327('0xd'));var crypto=require(_0x9327('0xe'));var jsforce=require(_0x9327('0xf'));var deskjs=require(_0x9327('0x10'));var toCsv=require(_0x9327('0xa'));var querystring=require(_0x9327('0x11'));var Papa=require(_0x9327('0x12'));var Redis=require(_0x9327('0x13'));var authService=require(_0x9327('0x14'));var qs=require(_0x9327('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9327('0x16'))(_0x9327('0x17'));var utils=require(_0x9327('0x18'));var config=require('../../config/environment');var db=require(_0x9327('0x19'))['db'];function respondWithStatusCode(_0x486d7c,_0x2b76e9){_0x2b76e9=_0x2b76e9||0xcc;return function(_0x2e7553){if(_0x2e7553){return _0x486d7c[_0x9327('0x1a')](_0x2b76e9);}return _0x486d7c[_0x9327('0x1b')](_0x2b76e9)['end']();};}function respondWithResult(_0x342d96,_0x52cee9){_0x52cee9=_0x52cee9||0xc8;return function(_0x298623){if(_0x298623){return _0x342d96[_0x9327('0x1b')](_0x52cee9)[_0x9327('0x1c')](_0x298623);}};}function respondWithFilteredResult(_0x4d09d2,_0x2e7dfb){return function(_0x8bceae){if(_0x8bceae){var _0x4a64c6=_0x8bceae[_0x9327('0x1d')],_0x1f98f0=_0x2e7dfb[_0x9327('0x1e')],_0x3a175e=_0x2e7dfb[_0x9327('0x1e')]+_0x2e7dfb[_0x9327('0x1f')],_0x21fa7f;if(_0x3a175e>=_0x4a64c6){_0x3a175e=_0x4a64c6;_0x21fa7f=0xc8;}else{_0x21fa7f=0xce;}_0x4d09d2['status'](_0x21fa7f);return _0x4d09d2['set'](_0x9327('0x20'),_0x1f98f0+'-'+_0x3a175e+'/'+_0x4a64c6)[_0x9327('0x1c')](_0x8bceae);}return null;};}function patchUpdates(_0x288d48){return function(_0x5cb392){try{jsonpatch[_0x9327('0x21')](_0x5cb392,_0x288d48,!![]);}catch(_0x2abad0){return BPromise[_0x9327('0x22')](_0x2abad0);}return _0x5cb392[_0x9327('0x23')]();};}function saveUpdates(_0x4e7d56,_0xbba6cf){return function(_0x3efd79){if(_0x3efd79){return _0x3efd79[_0x9327('0x24')](_0x4e7d56)['then'](function(_0x1c1843){return _0x1c1843;});}return null;};}function removeEntity(_0x4ddc0c,_0x406cf0){return function(_0x2b57f9){if(_0x2b57f9){return _0x2b57f9[_0x9327('0x25')]()['then'](function(){_0x4ddc0c[_0x9327('0x1b')](0xcc)[_0x9327('0x26')]();});}};}function handleEntityNotFound(_0x4a3122,_0x48dab4){return function(_0xfb6190){if(!_0xfb6190){_0x4a3122[_0x9327('0x1a')](0x194);}return _0xfb6190;};}function handleError(_0x306592,_0x11561e){_0x11561e=_0x11561e||0x1f4;return function(_0x39988d){logger[_0x9327('0x27')](_0x39988d[_0x9327('0x28')]);if(_0x39988d[_0x9327('0x29')]){delete _0x39988d[_0x9327('0x29')];}_0x306592[_0x9327('0x1b')](_0x11561e)['send'](_0x39988d);};}exports[_0x9327('0x2a')]=function(_0x30a817,_0x234bdf){var _0x320c69={},_0x5cc6c2={},_0x55b764={'count':0x0,'rows':[]};var _0x25cf6d=_[_0x9327('0x2b')](db[_0x9327('0x2c')][_0x9327('0x2d')],function(_0x4f6d7c){return{'name':_0x4f6d7c['fieldName'],'type':_0x4f6d7c[_0x9327('0x2e')][_0x9327('0x2f')]};});_0x5cc6c2[_0x9327('0x30')]=_['map'](_0x25cf6d,_0x9327('0x29'));_0x5cc6c2[_0x9327('0x31')]=_[_0x9327('0x32')](_0x30a817['query']);_0x5cc6c2[_0x9327('0x33')]=_[_0x9327('0x34')](_0x5cc6c2[_0x9327('0x30')],_0x5cc6c2[_0x9327('0x31')]);_0x320c69[_0x9327('0x35')]=_[_0x9327('0x34')](_0x5cc6c2[_0x9327('0x30')],qs[_0x9327('0x36')](_0x30a817[_0x9327('0x31')][_0x9327('0x36')]));_0x320c69[_0x9327('0x35')]=_0x320c69['attributes'][_0x9327('0x37')]?_0x320c69[_0x9327('0x35')]:_0x5cc6c2[_0x9327('0x30')];if(!_0x30a817['query'][_0x9327('0x38')]('nolimit')){_0x320c69[_0x9327('0x1f')]=qs[_0x9327('0x1f')](_0x30a817['query']['limit']);_0x320c69[_0x9327('0x1e')]=qs[_0x9327('0x1e')](_0x30a817[_0x9327('0x31')][_0x9327('0x1e')]);}_0x320c69[_0x9327('0x39')]=qs['sort'](_0x30a817[_0x9327('0x31')][_0x9327('0x3a')]);_0x320c69[_0x9327('0x3b')]=qs['filters'](_['pick'](_0x30a817[_0x9327('0x31')],_0x5cc6c2[_0x9327('0x33')]));if(_0x30a817[_0x9327('0x31')][_0x9327('0x3c')]){_0x320c69[_0x9327('0x3b')]=_[_0x9327('0x3d')](_0x320c69[_0x9327('0x3b')],{'$or':_['map'](_0x25cf6d,function(_0x1a1cc8){if(_0x1a1cc8[_0x9327('0x2e')]!==_0x9327('0x3e')){var _0x55ff29={};_0x55ff29[_0x1a1cc8[_0x9327('0x29')]]={'$like':'%'+_0x30a817[_0x9327('0x31')][_0x9327('0x3c')]+'%'};return _0x55ff29;}})});}_0x320c69=_[_0x9327('0x3d')]({},_0x320c69,_0x30a817[_0x9327('0x3f')]);var _0x2ad7c3={'where':_0x320c69[_0x9327('0x3b')]};return db[_0x9327('0x2c')][_0x9327('0x1d')](_0x2ad7c3)[_0x9327('0x40')](function(_0x389708){_0x55b764[_0x9327('0x1d')]=_0x389708;if(_0x30a817[_0x9327('0x31')][_0x9327('0x41')]){_0x320c69[_0x9327('0x42')]=[{'all':!![]}];}return db[_0x9327('0x2c')]['findAll'](_0x320c69);})[_0x9327('0x40')](function(_0x5cdf34){_0x55b764[_0x9327('0x43')]=_0x5cdf34;return _0x55b764;})[_0x9327('0x40')](respondWithFilteredResult(_0x234bdf,_0x320c69))[_0x9327('0x44')](handleError(_0x234bdf,null));};exports[_0x9327('0x45')]=function(_0x28cb66,_0x9a86f){var _0x5a83de={'raw':!![],'where':{'id':_0x28cb66['params']['id']}},_0x2074dc={};_0x2074dc[_0x9327('0x30')]=_['keys'](db['SmsTransferReport'][_0x9327('0x2d')]);_0x2074dc[_0x9327('0x31')]=_[_0x9327('0x32')](_0x28cb66[_0x9327('0x31')]);_0x2074dc[_0x9327('0x33')]=_[_0x9327('0x34')](_0x2074dc[_0x9327('0x30')],_0x2074dc[_0x9327('0x31')]);_0x5a83de[_0x9327('0x35')]=_[_0x9327('0x34')](_0x2074dc[_0x9327('0x30')],qs[_0x9327('0x36')](_0x28cb66[_0x9327('0x31')][_0x9327('0x36')]));_0x5a83de[_0x9327('0x35')]=_0x5a83de[_0x9327('0x35')][_0x9327('0x37')]?_0x5a83de['attributes']:_0x2074dc[_0x9327('0x30')];if(_0x28cb66['query'][_0x9327('0x41')]){_0x5a83de['include']=[{'all':!![]}];}_0x5a83de=_[_0x9327('0x3d')]({},_0x5a83de,_0x28cb66[_0x9327('0x3f')]);return db[_0x9327('0x2c')]['find'](_0x5a83de)[_0x9327('0x40')](handleEntityNotFound(_0x9a86f,null))[_0x9327('0x40')](respondWithResult(_0x9a86f,null))[_0x9327('0x44')](handleError(_0x9a86f,null));};exports[_0x9327('0x46')]=function(_0x2c4362,_0xeadf40){return db['SmsTransferReport'][_0x9327('0x46')](_0x2c4362[_0x9327('0x47')],{})[_0x9327('0x40')](respondWithResult(_0xeadf40,0xc9))[_0x9327('0x44')](handleError(_0xeadf40,null));};exports[_0x9327('0x24')]=function(_0x1f2760,_0x53a26c){if(_0x1f2760[_0x9327('0x47')]['id']){delete _0x1f2760[_0x9327('0x47')]['id'];}return db[_0x9327('0x2c')][_0x9327('0x48')]({'where':{'id':_0x1f2760['params']['id']}})[_0x9327('0x40')](handleEntityNotFound(_0x53a26c,null))['then'](saveUpdates(_0x1f2760[_0x9327('0x47')],null))[_0x9327('0x40')](respondWithResult(_0x53a26c,null))['catch'](handleError(_0x53a26c,null));};exports[_0x9327('0x25')]=function(_0x2ea110,_0x3915bf){return db[_0x9327('0x2c')][_0x9327('0x48')]({'where':{'id':_0x2ea110['params']['id']}})['then'](handleEntityNotFound(_0x3915bf,null))[_0x9327('0x40')](removeEntity(_0x3915bf,null))[_0x9327('0x44')](handleError(_0x3915bf,null));};exports[_0x9327('0x49')]=function(_0x10ee5e,_0x683f6c){return db[_0x9327('0x2c')][_0x9327('0x49')]()[_0x9327('0x40')](respondWithResult(_0x683f6c,null))[_0x9327('0x44')](handleError(_0x683f6c,null));}; \ No newline at end of file +var _0xb691=['to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','stack','name','send','index','map','SmsTransferReport','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','catch','params','includeAll','find','create','body','describe','fast-json-patch','moment','mustache','path'];(function(_0x4d81ac,_0x35dd5d){var _0x56937b=function(_0x5155ee){while(--_0x5155ee){_0x4d81ac['push'](_0x4d81ac['shift']());}};_0x56937b(++_0x35dd5d);}(_0xb691,0x104));var _0x1b69=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0xb691[_0x56740a];return _0x257144;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1b69('0x0'));var rp=require('request-promise');var moment=require(_0x1b69('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x1b69('0x2'));var util=require('util');var path=require(_0x1b69('0x3'));var sox=require('sox');var csv=require(_0x1b69('0x4'));var ejs=require(_0x1b69('0x5'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1b69('0x6'));var deskjs=require(_0x1b69('0x7'));var toCsv=require(_0x1b69('0x4'));var querystring=require('querystring');var Papa=require(_0x1b69('0x8'));var Redis=require(_0x1b69('0x9'));var authService=require(_0x1b69('0xa'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b69('0xb'));var logger=require(_0x1b69('0xc'))('api');var utils=require(_0x1b69('0xd'));var config=require(_0x1b69('0xe'));var db=require(_0x1b69('0xf'))['db'];function respondWithStatusCode(_0x830080,_0x12c1bb){_0x12c1bb=_0x12c1bb||0xcc;return function(_0x252dd1){if(_0x252dd1){return _0x830080[_0x1b69('0x10')](_0x12c1bb);}return _0x830080[_0x1b69('0x11')](_0x12c1bb)['end']();};}function respondWithResult(_0xc3bde6,_0x4a7391){_0x4a7391=_0x4a7391||0xc8;return function(_0x37e9bb){if(_0x37e9bb){return _0xc3bde6[_0x1b69('0x11')](_0x4a7391)[_0x1b69('0x12')](_0x37e9bb);}};}function respondWithFilteredResult(_0x4a8566,_0x14f1c7){return function(_0x392ab2){if(_0x392ab2){var _0x54eca8=_0x392ab2[_0x1b69('0x13')],_0x16b167=_0x14f1c7[_0x1b69('0x14')],_0x1d190c=_0x14f1c7[_0x1b69('0x14')]+_0x14f1c7[_0x1b69('0x15')],_0x1e0ab8;if(_0x1d190c>=_0x54eca8){_0x1d190c=_0x54eca8;_0x1e0ab8=0xc8;}else{_0x1e0ab8=0xce;}_0x4a8566[_0x1b69('0x11')](_0x1e0ab8);return _0x4a8566[_0x1b69('0x16')](_0x1b69('0x17'),_0x16b167+'-'+_0x1d190c+'/'+_0x54eca8)[_0x1b69('0x12')](_0x392ab2);}return null;};}function patchUpdates(_0x596de6){return function(_0xc3b5d8){try{jsonpatch[_0x1b69('0x18')](_0xc3b5d8,_0x596de6,!![]);}catch(_0x359405){return BPromise[_0x1b69('0x19')](_0x359405);}return _0xc3b5d8[_0x1b69('0x1a')]();};}function saveUpdates(_0x36aad4,_0x4075b6){return function(_0x429b5d){if(_0x429b5d){return _0x429b5d[_0x1b69('0x1b')](_0x36aad4)['then'](function(_0x3ebc89){return _0x3ebc89;});}return null;};}function removeEntity(_0x131406,_0x184117){return function(_0x825237){if(_0x825237){return _0x825237[_0x1b69('0x1c')]()[_0x1b69('0x1d')](function(){_0x131406[_0x1b69('0x11')](0xcc)[_0x1b69('0x1e')]();});}};}function handleEntityNotFound(_0x18f7b0,_0x291138){return function(_0x10b75e){if(!_0x10b75e){_0x18f7b0[_0x1b69('0x10')](0x194);}return _0x10b75e;};}function handleError(_0x5178b3,_0x38a6ab){_0x38a6ab=_0x38a6ab||0x1f4;return function(_0x2dbfdd){logger['error'](_0x2dbfdd[_0x1b69('0x1f')]);if(_0x2dbfdd[_0x1b69('0x20')]){delete _0x2dbfdd[_0x1b69('0x20')];}_0x5178b3['status'](_0x38a6ab)[_0x1b69('0x21')](_0x2dbfdd);};}exports[_0x1b69('0x22')]=function(_0x2d444a,_0x170b2d){var _0x3a6346={},_0x1e1dc5={},_0x41b697={'count':0x0,'rows':[]};var _0x2e19fa=_[_0x1b69('0x23')](db[_0x1b69('0x24')][_0x1b69('0x25')],function(_0x4bcc6b){return{'name':_0x4bcc6b['fieldName'],'type':_0x4bcc6b[_0x1b69('0x26')][_0x1b69('0x27')]};});_0x1e1dc5[_0x1b69('0x28')]=_[_0x1b69('0x23')](_0x2e19fa,_0x1b69('0x20'));_0x1e1dc5[_0x1b69('0x29')]=_[_0x1b69('0x2a')](_0x2d444a[_0x1b69('0x29')]);_0x1e1dc5['filters']=_['intersection'](_0x1e1dc5['model'],_0x1e1dc5[_0x1b69('0x29')]);_0x3a6346[_0x1b69('0x2b')]=_[_0x1b69('0x2c')](_0x1e1dc5[_0x1b69('0x28')],qs[_0x1b69('0x2d')](_0x2d444a[_0x1b69('0x29')]['fields']));_0x3a6346['attributes']=_0x3a6346[_0x1b69('0x2b')][_0x1b69('0x2e')]?_0x3a6346[_0x1b69('0x2b')]:_0x1e1dc5[_0x1b69('0x28')];if(!_0x2d444a[_0x1b69('0x29')][_0x1b69('0x2f')](_0x1b69('0x30'))){_0x3a6346[_0x1b69('0x15')]=qs[_0x1b69('0x15')](_0x2d444a[_0x1b69('0x29')][_0x1b69('0x15')]);_0x3a6346['offset']=qs[_0x1b69('0x14')](_0x2d444a[_0x1b69('0x29')]['offset']);}_0x3a6346[_0x1b69('0x31')]=qs['sort'](_0x2d444a[_0x1b69('0x29')][_0x1b69('0x32')]);_0x3a6346[_0x1b69('0x33')]=qs[_0x1b69('0x34')](_[_0x1b69('0x35')](_0x2d444a[_0x1b69('0x29')],_0x1e1dc5['filters']));if(_0x2d444a[_0x1b69('0x29')][_0x1b69('0x36')]){_0x3a6346[_0x1b69('0x33')]=_[_0x1b69('0x37')](_0x3a6346[_0x1b69('0x33')],{'$or':_['map'](_0x2e19fa,function(_0x1bdd0c){if(_0x1bdd0c['type']!==_0x1b69('0x38')){var _0x47be1e={};_0x47be1e[_0x1bdd0c['name']]={'$like':'%'+_0x2d444a[_0x1b69('0x29')][_0x1b69('0x36')]+'%'};return _0x47be1e;}})});}_0x3a6346=_['merge']({},_0x3a6346,_0x2d444a[_0x1b69('0x39')]);var _0x2c404f={'where':_0x3a6346[_0x1b69('0x33')]};return db['SmsTransferReport']['count'](_0x2c404f)[_0x1b69('0x1d')](function(_0x337d52){_0x41b697[_0x1b69('0x13')]=_0x337d52;if(_0x2d444a[_0x1b69('0x29')]['includeAll']){_0x3a6346[_0x1b69('0x3a')]=[{'all':!![]}];}return db[_0x1b69('0x24')]['findAll'](_0x3a6346);})[_0x1b69('0x1d')](function(_0x495654){_0x41b697['rows']=_0x495654;return _0x41b697;})[_0x1b69('0x1d')](respondWithFilteredResult(_0x170b2d,_0x3a6346))[_0x1b69('0x3b')](handleError(_0x170b2d,null));};exports['show']=function(_0x1eed4c,_0x443d09){var _0x16d94f={'raw':!![],'where':{'id':_0x1eed4c[_0x1b69('0x3c')]['id']}},_0x5d8adc={};_0x5d8adc[_0x1b69('0x28')]=_[_0x1b69('0x2a')](db['SmsTransferReport'][_0x1b69('0x25')]);_0x5d8adc[_0x1b69('0x29')]=_[_0x1b69('0x2a')](_0x1eed4c[_0x1b69('0x29')]);_0x5d8adc['filters']=_[_0x1b69('0x2c')](_0x5d8adc[_0x1b69('0x28')],_0x5d8adc['query']);_0x16d94f[_0x1b69('0x2b')]=_[_0x1b69('0x2c')](_0x5d8adc[_0x1b69('0x28')],qs[_0x1b69('0x2d')](_0x1eed4c['query'][_0x1b69('0x2d')]));_0x16d94f['attributes']=_0x16d94f[_0x1b69('0x2b')][_0x1b69('0x2e')]?_0x16d94f[_0x1b69('0x2b')]:_0x5d8adc[_0x1b69('0x28')];if(_0x1eed4c[_0x1b69('0x29')][_0x1b69('0x3d')]){_0x16d94f['include']=[{'all':!![]}];}_0x16d94f=_[_0x1b69('0x37')]({},_0x16d94f,_0x1eed4c['options']);return db[_0x1b69('0x24')][_0x1b69('0x3e')](_0x16d94f)['then'](handleEntityNotFound(_0x443d09,null))[_0x1b69('0x1d')](respondWithResult(_0x443d09,null))[_0x1b69('0x3b')](handleError(_0x443d09,null));};exports[_0x1b69('0x3f')]=function(_0x5548e1,_0x1f1c06){return db[_0x1b69('0x24')][_0x1b69('0x3f')](_0x5548e1[_0x1b69('0x40')],{})['then'](respondWithResult(_0x1f1c06,0xc9))['catch'](handleError(_0x1f1c06,null));};exports[_0x1b69('0x1b')]=function(_0x494349,_0x1e3a8f){if(_0x494349[_0x1b69('0x40')]['id']){delete _0x494349[_0x1b69('0x40')]['id'];}return db[_0x1b69('0x24')][_0x1b69('0x3e')]({'where':{'id':_0x494349['params']['id']}})[_0x1b69('0x1d')](handleEntityNotFound(_0x1e3a8f,null))[_0x1b69('0x1d')](saveUpdates(_0x494349[_0x1b69('0x40')],null))[_0x1b69('0x1d')](respondWithResult(_0x1e3a8f,null))[_0x1b69('0x3b')](handleError(_0x1e3a8f,null));};exports[_0x1b69('0x1c')]=function(_0x3323d5,_0x44979d){return db[_0x1b69('0x24')][_0x1b69('0x3e')]({'where':{'id':_0x3323d5[_0x1b69('0x3c')]['id']}})[_0x1b69('0x1d')](handleEntityNotFound(_0x44979d,null))[_0x1b69('0x1d')](removeEntity(_0x44979d,null))[_0x1b69('0x3b')](handleError(_0x44979d,null));};exports[_0x1b69('0x41')]=function(_0x5b9bcc,_0x5014ca){return db[_0x1b69('0x24')][_0x1b69('0x41')]()[_0x1b69('0x1d')](respondWithResult(_0x5014ca,null))[_0x1b69('0x3b')](handleError(_0x5014ca,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index cd8b9ea..7d0343c 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 _0x4745=['rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x114c53,_0x2249c6){var _0x4e0c14=function(_0x1fe406){while(--_0x1fe406){_0x114c53['push'](_0x114c53['shift']());}};_0x4e0c14(++_0x2249c6);}(_0x4745,0x1e7));var _0x5474=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x4745[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var logger=require(_0x5474('0x2'))(_0x5474('0x3'));var moment=require(_0x5474('0x4'));var BPromise=require(_0x5474('0x5'));var rp=require(_0x5474('0x6'));var fs=require('fs');var path=require(_0x5474('0x7'));var rimraf=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var attributes=require(_0x5474('0xa'));module[_0x5474('0xb')]=function(_0x4e7ce7,_0x3d1e1){return _0x4e7ce7[_0x5474('0xc')]('SmsTransferReport',attributes,{'tableName':_0x5474('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5474('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c6=['rimraf','exports','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x3d46cb,_0x535d47){_0x3d46cb=_0x3d46cb-0x0;var _0x3c66fb=_0xc1c6[_0x3d46cb];return _0x3c66fb;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./smsTransferReport.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[{'name':_0x6c1c('0xa'),'fields':[_0x6c1c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 675cde4..a14ef5a 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 _0x0d88=['rpc','jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4e6bf8,_0xf73311){var _0xd66d7a=function(_0x5510e2){while(--_0x5510e2){_0x4e6bf8['push'](_0x4e6bf8['shift']());}};_0xd66d7a(++_0xf73311);}(_0x0d88,0x1dc));var _0x80d8=function(_0x47030f,_0x110a0d){_0x47030f=_0x47030f-0x0;var _0x7a532e=_0x0d88[_0x47030f];return _0x7a532e;};'use strict';var _=require('lodash');var util=require(_0x80d8('0x0'));var moment=require(_0x80d8('0x1'));var BPromise=require('bluebird');var rs=require(_0x80d8('0x2'));var fs=require('fs');var Redis=require(_0x80d8('0x3'));var db=require(_0x80d8('0x4'))['db'];var utils=require(_0x80d8('0x5'));var logger=require(_0x80d8('0x6'))(_0x80d8('0x7'));var config=require('../../config/environment');var jayson=require(_0x80d8('0x8'));var client=jayson[_0x80d8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40602f,_0x1b2a67,_0x5ac840){return new BPromise(function(_0x3601a9,_0x2ff726){return client[_0x80d8('0xa')](_0x40602f,_0x5ac840)[_0x80d8('0xb')](function(_0x4c19ff){logger[_0x80d8('0xc')](_0x80d8('0xd'),_0x1b2a67,'request\x20sent');logger['debug'](_0x80d8('0xe'),_0x1b2a67,_0x80d8('0xf'),JSON[_0x80d8('0x10')](_0x4c19ff));if(_0x4c19ff[_0x80d8('0x11')]){if(_0x4c19ff[_0x80d8('0x11')][_0x80d8('0x12')]===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x1b2a67,_0x4c19ff[_0x80d8('0x11')][_0x80d8('0x13')]);return _0x2ff726(_0x4c19ff[_0x80d8('0x11')][_0x80d8('0x13')]);}logger[_0x80d8('0x11')](_0x80d8('0xd'),_0x1b2a67,_0x4c19ff['error'][_0x80d8('0x13')]);return _0x3601a9(_0x4c19ff[_0x80d8('0x11')][_0x80d8('0x13')]);}else{logger[_0x80d8('0xc')](_0x80d8('0xd'),_0x1b2a67,_0x80d8('0xf'));_0x3601a9(_0x4c19ff[_0x80d8('0x14')][_0x80d8('0x13')]);}})['catch'](function(_0x163ec1){logger[_0x80d8('0x11')](_0x80d8('0xd'),_0x1b2a67,_0x163ec1);_0x2ff726(_0x163ec1);});});} \ No newline at end of file +var _0xed6f=['http','request','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x4c7fde,_0x37112c){var _0x49fe4d=function(_0x5f32c5){while(--_0x5f32c5){_0x4c7fde['push'](_0x4c7fde['shift']());}};_0x49fe4d(++_0x37112c);}(_0xed6f,0x69));var _0xfed6=function(_0x428edf,_0x9af371){_0x428edf=_0x428edf-0x0;var _0x2262bc=_0xed6f[_0x428edf];return _0x2262bc;};'use strict';var _=require(_0xfed6('0x0'));var util=require('util');var moment=require(_0xfed6('0x1'));var BPromise=require(_0xfed6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfed6('0x3'));var db=require(_0xfed6('0x4'))['db'];var utils=require(_0xfed6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xfed6('0x6'));var jayson=require(_0xfed6('0x7'));var client=jayson[_0xfed6('0x8')][_0xfed6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58c354,_0x46a399,_0xf2cc53){return new BPromise(function(_0x30e98b,_0x2fb3ab){return client[_0xfed6('0xa')](_0x58c354,_0xf2cc53)['then'](function(_0x45a862){logger['info'](_0xfed6('0xb'),_0x46a399,_0xfed6('0xc'));logger[_0xfed6('0xd')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x46a399,_0xfed6('0xc'),JSON['stringify'](_0x45a862));if(_0x45a862[_0xfed6('0xe')]){if(_0x45a862[_0xfed6('0xe')][_0xfed6('0xf')]===0x1f4){logger[_0xfed6('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x46a399,_0x45a862[_0xfed6('0xe')][_0xfed6('0x10')]);return _0x2fb3ab(_0x45a862['error']['message']);}logger[_0xfed6('0xe')](_0xfed6('0xb'),_0x46a399,_0x45a862[_0xfed6('0xe')][_0xfed6('0x10')]);return _0x30e98b(_0x45a862[_0xfed6('0xe')][_0xfed6('0x10')]);}else{logger[_0xfed6('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x46a399,'request\x20sent');_0x30e98b(_0x45a862['result'][_0xfed6('0x10')]);}})[_0xfed6('0x12')](function(_0x527810){logger[_0xfed6('0xe')](_0xfed6('0xb'),_0x46a399,_0x527810);_0x2fb3ab(_0x527810);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index b7a0bdd..0670334 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 _0x4819=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','basename','extname','now','post','single','file','put','delete','exports','multer','util','path','connect-timeout'];(function(_0x40b493,_0x4050de){var _0x548365=function(_0x8ceba7){while(--_0x8ceba7){_0x40b493['push'](_0x40b493['shift']());}};_0x548365(++_0x4050de);}(_0x4819,0x1be));var _0x9481=function(_0x3f70cd,_0x6bf4ed){_0x3f70cd=_0x3f70cd-0x0;var _0x3feb93=_0x4819[_0x3f70cd];return _0x3feb93;};'use strict';var multer=require(_0x9481('0x0'));var util=require(_0x9481('0x1'));var path=require(_0x9481('0x2'));var timeout=require(_0x9481('0x3'));var express=require(_0x9481('0x4'));var router=express['Router']();var auth=require(_0x9481('0x5'));var interaction=require(_0x9481('0x6'));var config=require(_0x9481('0x7'));var controller=require(_0x9481('0x8'));router[_0x9481('0x9')]('/',auth[_0x9481('0xa')](),controller[_0x9481('0xb')]);router[_0x9481('0x9')](_0x9481('0xc'),auth[_0x9481('0xa')](),controller[_0x9481('0xd')]);router[_0x9481('0x9')](_0x9481('0xe'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x9481('0xf')]({'destination':function(_0x334f3a,_0x1bf360,_0x5129bd){_0x5129bd(null,path['join'](config[_0x9481('0x10')],_0x9481('0x11')));},'filename':function(_0x39a725,_0x205321,_0x1ed30e){_0x205321[_0x9481('0x12')]=_0x205321[_0x9481('0x12')][_0x9481('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1ed30e(null,util[_0x9481('0x14')]('%s-%s%s',path[_0x9481('0x15')](_0x205321[_0x9481('0x12')],path[_0x9481('0x16')](_0x205321[_0x9481('0x12')])),Date[_0x9481('0x17')](),path[_0x9481('0x16')](_0x205321[_0x9481('0x12')])));}})});router[_0x9481('0x18')]('/',upload[_0x9481('0x19')](_0x9481('0x1a')),controller['create']);router[_0x9481('0x1b')](_0x9481('0xc'),auth[_0x9481('0xa')](),controller['update']);router['delete'](_0x9481('0xc'),auth[_0x9481('0xa')](),controller[_0x9481('0x1c')]);module[_0x9481('0x1d')]=router; \ No newline at end of file +var _0xe674=['/:id/download','download','diskStorage','root','server/files/sounds/original/','replace','%s-%s%s','extname','now','originalname','single','file','create','put','update','delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','/:id','show'];(function(_0x4df6f9,_0x44bd65){var _0x4b1a73=function(_0xf5adb7){while(--_0xf5adb7){_0x4df6f9['push'](_0x4df6f9['shift']());}};_0x4b1a73(++_0x44bd65);}(_0xe674,0x1c3));var _0x4e67=function(_0x44396f,_0x3d229b){_0x44396f=_0x44396f-0x0;var _0x59bda3=_0xe674[_0x44396f];return _0x59bda3;};'use strict';var multer=require(_0x4e67('0x0'));var util=require(_0x4e67('0x1'));var path=require(_0x4e67('0x2'));var timeout=require(_0x4e67('0x3'));var express=require('express');var router=express[_0x4e67('0x4')]();var auth=require(_0x4e67('0x5'));var interaction=require(_0x4e67('0x6'));var config=require(_0x4e67('0x7'));var controller=require(_0x4e67('0x8'));router[_0x4e67('0x9')]('/',auth[_0x4e67('0xa')](),controller['index']);router[_0x4e67('0x9')](_0x4e67('0xb'),auth[_0x4e67('0xa')](),controller[_0x4e67('0xc')]);router[_0x4e67('0x9')](_0x4e67('0xd'),auth[_0x4e67('0xa')](),controller[_0x4e67('0xe')]);var upload=multer({'storage':multer[_0x4e67('0xf')]({'destination':function(_0x267508,_0x111767,_0x23ded2){_0x23ded2(null,path['join'](config[_0x4e67('0x10')],_0x4e67('0x11')));},'filename':function(_0x4dcc6c,_0x11b836,_0x1db089){_0x11b836['originalname']=_0x11b836['originalname'][_0x4e67('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1db089(null,util['format'](_0x4e67('0x13'),path['basename'](_0x11b836['originalname'],path[_0x4e67('0x14')](_0x11b836['originalname'])),Date[_0x4e67('0x15')](),path[_0x4e67('0x14')](_0x11b836[_0x4e67('0x16')])));}})});router['post']('/',upload[_0x4e67('0x17')](_0x4e67('0x18')),controller[_0x4e67('0x19')]);router[_0x4e67('0x1a')]('/:id',auth[_0x4e67('0xa')](),controller[_0x4e67('0x1b')]);router['delete'](_0x4e67('0xb'),auth[_0x4e67('0xa')](),controller[_0x4e67('0x1c')]);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 71e7345..7d12aa7 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 _0xe4aa=['FLOAT','INTEGER','BIGINT','sequelize','exports','name','STRING'];(function(_0x348860,_0x4531f6){var _0x2fc2ad=function(_0x3b449f){while(--_0x3b449f){_0x348860['push'](_0x348860['shift']());}};_0x2fc2ad(++_0x4531f6);}(_0xe4aa,0x1d1));var _0xae4a=function(_0xe2aeea,_0x2dd3af){_0xe2aeea=_0xe2aeea-0x0;var _0x331e5f=_0xe4aa[_0xe2aeea];return _0x331e5f;};'use strict';var Sequelize=require(_0xae4a('0x0'));module[_0xae4a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xae4a('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xae4a('0x3')]},'display_name':{'type':Sequelize[_0xae4a('0x3')],'defaultValue':''},'description':{'type':Sequelize[_0xae4a('0x3')]},'original_format':{'type':Sequelize[_0xae4a('0x3')]},'original_duration':{'type':Sequelize[_0xae4a('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xae4a('0x5')]},'original_bitRate':{'type':Sequelize[_0xae4a('0x6')]},'original_sampleRate':{'type':Sequelize[_0xae4a('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xae4a('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xae4a('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xae4a('0x5')]}}; \ No newline at end of file +var _0xcc97=['FLOAT','BIGINT','INTEGER','sequelize','STRING','name'];(function(_0xe7f7c8,_0x1e634d){var _0x26be43=function(_0x377311){while(--_0x377311){_0xe7f7c8['push'](_0xe7f7c8['shift']());}};_0x26be43(++_0x1e634d);}(_0xcc97,0x111));var _0x7cc9=function(_0x43b446,_0x578439){_0x43b446=_0x43b446-0x0;var _0x4db480=_0xcc97[_0x43b446];return _0x4db480;};'use strict';var Sequelize=require(_0x7cc9('0x0'));module['exports']={'name':{'type':Sequelize[_0x7cc9('0x1')],'unique':_0x7cc9('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x7cc9('0x1')]},'display_name':{'type':Sequelize[_0x7cc9('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x7cc9('0x1')]},'original_duration':{'type':Sequelize[_0x7cc9('0x3')]},'original_sampleCount':{'type':Sequelize[_0x7cc9('0x4')]},'original_channelCount':{'type':Sequelize[_0x7cc9('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x7cc9('0x5')]},'converted_format':{'type':Sequelize[_0x7cc9('0x1')]},'converted_duration':{'type':Sequelize[_0x7cc9('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x7cc9('0x4')]},'converted_channelCount':{'type':Sequelize[_0x7cc9('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 7953f38..68ba81b 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 _0x35ef=['lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','stack','name','send','index','Sound','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','download','params','save_name','converted_format','existsSync','join','root','Sequelize','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','create','originalname','extname','file','basename','filename','substring','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','error','unlinkSync','src','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','sampleRate','dest','converted_duration','duration','converted_sampleCount','converted_channelCount','converted_bitRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','delete','server/files/sounds/original','original_format','html-pdf','eml-format','rimraf','request-promise','mustache','util','path','to-csv'];(function(_0x47bed4,_0x71b623){var _0x118b9e=function(_0x52bf2a){while(--_0x52bf2a){_0x47bed4['push'](_0x47bed4['shift']());}};_0x118b9e(++_0x71b623);}(_0x35ef,0xf0));var _0xf35e=function(_0x153356,_0x4fcdaa){_0x153356=_0x153356-0x0;var _0x468f1a=_0x35ef[_0x153356];return _0x468f1a;};'use strict';var pdf=require(_0xf35e('0x0'));var emlformat=require(_0xf35e('0x1'));var rimraf=require(_0xf35e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf35e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf35e('0x4'));var util=require(_0xf35e('0x5'));var path=require(_0xf35e('0x6'));var sox=require('sox');var csv=require(_0xf35e('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf35e('0x8'));var squel=require(_0xf35e('0x9'));var crypto=require(_0xf35e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf35e('0xb'));var toCsv=require(_0xf35e('0x7'));var querystring=require(_0xf35e('0xc'));var Papa=require('papaparse');var Redis=require(_0xf35e('0xd'));var authService=require(_0xf35e('0xe'));var qs=require(_0xf35e('0xf'));var as=require(_0xf35e('0x10'));var hardwareService=require(_0xf35e('0x11'));var logger=require('../../config/logger')(_0xf35e('0x12'));var utils=require(_0xf35e('0x13'));var config=require(_0xf35e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e216d,_0x3e0de1){_0x3e0de1=_0x3e0de1||0xcc;return function(_0x56aa85){if(_0x56aa85){return _0x5e216d[_0xf35e('0x15')](_0x3e0de1);}return _0x5e216d[_0xf35e('0x16')](_0x3e0de1)['end']();};}function respondWithResult(_0x455c44,_0x258d9e){_0x258d9e=_0x258d9e||0xc8;return function(_0x47084e){if(_0x47084e){return _0x455c44['status'](_0x258d9e)[_0xf35e('0x17')](_0x47084e);}};}function respondWithFilteredResult(_0x1d77d5,_0x4e371c){return function(_0x915351){if(_0x915351){var _0xb7e665=_0x915351[_0xf35e('0x18')],_0xc7687c=_0x4e371c[_0xf35e('0x19')],_0x153572=_0x4e371c['offset']+_0x4e371c[_0xf35e('0x1a')],_0x309e5e;if(_0x153572>=_0xb7e665){_0x153572=_0xb7e665;_0x309e5e=0xc8;}else{_0x309e5e=0xce;}_0x1d77d5[_0xf35e('0x16')](_0x309e5e);return _0x1d77d5[_0xf35e('0x1b')](_0xf35e('0x1c'),_0xc7687c+'-'+_0x153572+'/'+_0xb7e665)['json'](_0x915351);}return null;};}function patchUpdates(_0x33fe89){return function(_0x54defb){try{jsonpatch[_0xf35e('0x1d')](_0x54defb,_0x33fe89,!![]);}catch(_0x2b1113){return BPromise[_0xf35e('0x1e')](_0x2b1113);}return _0x54defb[_0xf35e('0x1f')]();};}function saveUpdates(_0x4d104b,_0x1b2432){return function(_0x3d7e1a){if(_0x3d7e1a){return _0x3d7e1a[_0xf35e('0x20')](_0x4d104b)[_0xf35e('0x21')](function(_0x523fcc){return _0x523fcc;});}return null;};}function removeEntity(_0x43a4be,_0x14e601){return function(_0x6db8dd){if(_0x6db8dd){return _0x6db8dd[_0xf35e('0x22')]()[_0xf35e('0x21')](function(){var _0x5072f3=_0x6db8dd[_0xf35e('0x23')]({'plain':!![]});var _0x571eeb='Sounds';return db[_0xf35e('0x24')][_0xf35e('0x22')]({'where':{'type':_0x571eeb,'resourceId':_0x5072f3['id']}})[_0xf35e('0x21')](function(){return _0x6db8dd;});})[_0xf35e('0x21')](function(){_0x43a4be['status'](0xcc)[_0xf35e('0x25')]();});}};}function handleEntityNotFound(_0x29cdad,_0x2cfb07){return function(_0x260d50){if(!_0x260d50){_0x29cdad[_0xf35e('0x15')](0x194);}return _0x260d50;};}function handleError(_0x442b8e,_0x4330e9){_0x4330e9=_0x4330e9||0x1f4;return function(_0xbda0de){logger['error'](_0xbda0de[_0xf35e('0x26')]);if(_0xbda0de[_0xf35e('0x27')]){delete _0xbda0de[_0xf35e('0x27')];}_0x442b8e[_0xf35e('0x16')](_0x4330e9)[_0xf35e('0x28')](_0xbda0de);};}exports[_0xf35e('0x29')]=function(_0x5aa874,_0x3e6353){var _0x2caee2={},_0x482cec={},_0x3669b4={'count':0x0,'rows':[]};var _0x409283=_['map'](db[_0xf35e('0x2a')][_0xf35e('0x2b')],function(_0x4fba29){return{'name':_0x4fba29['fieldName'],'type':_0x4fba29[_0xf35e('0x2c')][_0xf35e('0x2d')]};});_0x482cec[_0xf35e('0x2e')]=_[_0xf35e('0x2f')](_0x409283,_0xf35e('0x27'));_0x482cec[_0xf35e('0x30')]=_[_0xf35e('0x31')](_0x5aa874['query']);_0x482cec['filters']=_[_0xf35e('0x32')](_0x482cec[_0xf35e('0x2e')],_0x482cec[_0xf35e('0x30')]);_0x2caee2[_0xf35e('0x33')]=_[_0xf35e('0x32')](_0x482cec[_0xf35e('0x2e')],qs[_0xf35e('0x34')](_0x5aa874['query'][_0xf35e('0x34')]));_0x2caee2['attributes']=_0x2caee2[_0xf35e('0x33')][_0xf35e('0x35')]?_0x2caee2[_0xf35e('0x33')]:_0x482cec[_0xf35e('0x2e')];if(!_0x5aa874['query'][_0xf35e('0x36')](_0xf35e('0x37'))){_0x2caee2[_0xf35e('0x1a')]=qs[_0xf35e('0x1a')](_0x5aa874[_0xf35e('0x30')][_0xf35e('0x1a')]);_0x2caee2[_0xf35e('0x19')]=qs[_0xf35e('0x19')](_0x5aa874[_0xf35e('0x30')]['offset']);}_0x2caee2[_0xf35e('0x38')]=qs[_0xf35e('0x39')](_0x5aa874['query'][_0xf35e('0x39')]);_0x2caee2[_0xf35e('0x3a')]=qs[_0xf35e('0x3b')](_[_0xf35e('0x3c')](_0x5aa874[_0xf35e('0x30')],_0x482cec[_0xf35e('0x3b')]));if(_0x5aa874[_0xf35e('0x30')][_0xf35e('0x3d')]){_0x2caee2[_0xf35e('0x3a')]=_[_0xf35e('0x3e')](_0x2caee2[_0xf35e('0x3a')],{'$or':_[_0xf35e('0x2f')](_0x409283,function(_0x1160e1){if(_0x1160e1[_0xf35e('0x2c')]!==_0xf35e('0x3f')){var _0x4076f5={};_0x4076f5[_0x1160e1['name']]={'$like':'%'+_0x5aa874['query']['filter']+'%'};return _0x4076f5;}})});}_0x2caee2=_[_0xf35e('0x3e')]({},_0x2caee2,_0x5aa874[_0xf35e('0x40')]);var _0x3c6373={'where':_0x2caee2['where']};return db[_0xf35e('0x2a')][_0xf35e('0x18')](_0x3c6373)[_0xf35e('0x21')](function(_0x123e86){_0x3669b4[_0xf35e('0x18')]=_0x123e86;if(_0x5aa874[_0xf35e('0x30')][_0xf35e('0x41')]){_0x2caee2[_0xf35e('0x42')]=[{'all':!![]}];}return db[_0xf35e('0x2a')][_0xf35e('0x43')](_0x2caee2);})[_0xf35e('0x21')](function(_0x2f4e3e){_0x3669b4[_0xf35e('0x44')]=_0x2f4e3e;return _0x3669b4;})['then'](respondWithFilteredResult(_0x3e6353,_0x2caee2))[_0xf35e('0x45')](handleError(_0x3e6353,null));};exports['show']=function(_0x500e45,_0x4b7424){var _0x55eb1e={'raw':!![],'where':{'id':_0x500e45['params']['id']}},_0x4c6c9={};_0x4c6c9[_0xf35e('0x2e')]=_['keys'](db[_0xf35e('0x2a')]['rawAttributes']);_0x4c6c9['query']=_[_0xf35e('0x31')](_0x500e45[_0xf35e('0x30')]);_0x4c6c9[_0xf35e('0x3b')]=_['intersection'](_0x4c6c9['model'],_0x4c6c9[_0xf35e('0x30')]);_0x55eb1e[_0xf35e('0x33')]=_['intersection'](_0x4c6c9[_0xf35e('0x2e')],qs[_0xf35e('0x34')](_0x500e45[_0xf35e('0x30')][_0xf35e('0x34')]));_0x55eb1e[_0xf35e('0x33')]=_0x55eb1e[_0xf35e('0x33')]['length']?_0x55eb1e[_0xf35e('0x33')]:_0x4c6c9['model'];if(_0x500e45['query']['includeAll']){_0x55eb1e[_0xf35e('0x42')]=[{'all':!![]}];}_0x55eb1e=_[_0xf35e('0x3e')]({},_0x55eb1e,_0x500e45[_0xf35e('0x40')]);return db[_0xf35e('0x2a')][_0xf35e('0x46')](_0x55eb1e)[_0xf35e('0x21')](handleEntityNotFound(_0x4b7424,null))[_0xf35e('0x21')](respondWithResult(_0x4b7424,null))[_0xf35e('0x45')](handleError(_0x4b7424,null));};exports[_0xf35e('0x47')]=function(_0x3523ad,_0x5c14c4,_0x3a1511){return db[_0xf35e('0x2a')]['find']({'where':{'id':_0x3523ad[_0xf35e('0x48')]['id']},'attributes':[_0xf35e('0x27'),_0xf35e('0x49'),_0xf35e('0x4a')],'raw':!![]})[_0xf35e('0x21')](handleEntityNotFound(_0x5c14c4,null))[_0xf35e('0x21')](function(_0x22fba2){if(_0x22fba2){if(!fs[_0xf35e('0x4b')](path[_0xf35e('0x4c')](config[_0xf35e('0x4d')],'server/files/sounds/converted',_0x22fba2[_0xf35e('0x49')]+'.'+_0x22fba2[_0xf35e('0x4a')]))){throw new db[(_0xf35e('0x4e'))][(_0xf35e('0x4f'))](_0xf35e('0x50'));}return _0x5c14c4['download'](path['join'](config[_0xf35e('0x4d')],_0xf35e('0x51'),util[_0xf35e('0x52')]('%s.%s',_0x22fba2[_0xf35e('0x49')],_0x22fba2[_0xf35e('0x4a')])),util[_0xf35e('0x52')](_0xf35e('0x53'),_0x22fba2[_0xf35e('0x27')],_0x22fba2[_0xf35e('0x4a')]));}return null;})[_0xf35e('0x45')](handleError(_0x5c14c4,null));};exports[_0xf35e('0x54')]=function(_0x4bab39,_0x2c7811,_0x3aa6ef){var _0x65e68={'name':path['basename'](_0x4bab39['file'][_0xf35e('0x55')],path[_0xf35e('0x56')](_0x4bab39[_0xf35e('0x57')][_0xf35e('0x55')])),'save_name':path[_0xf35e('0x58')](_0x4bab39['file'][_0xf35e('0x59')],path[_0xf35e('0x56')](_0x4bab39[_0xf35e('0x57')][_0xf35e('0x59')])),'original_format':path['extname'](_0x4bab39[_0xf35e('0x57')]['originalname'])[_0xf35e('0x5a')](0x1),'converted_format':'wav'};var _0x2ecc13=path[_0xf35e('0x4c')](config[_0xf35e('0x4d')],'server/files/sounds/original',_0x4bab39[_0xf35e('0x57')][_0xf35e('0x59')]);var _0x4dae9e=path['join'](config[_0xf35e('0x4d')],_0xf35e('0x51'),util['format'](_0xf35e('0x53'),path[_0xf35e('0x58')](_0x4bab39[_0xf35e('0x57')]['filename'],path['extname'](_0x4bab39[_0xf35e('0x57')]['filename'])),_0x65e68[_0xf35e('0x4a')]));logger[_0xf35e('0x5b')](_0xf35e('0x5c'),_0x2ecc13);logger['info'](_0xf35e('0x5d'),_0x4dae9e);try{fs[_0xf35e('0x5e')](_0x2ecc13,parseInt(_0xf35e('0x5f'),0x8));var _0x3a1f5c=sox[_0xf35e('0x60')](_0x2ecc13,_0x4dae9e,{'sampleRate':0x1f40,'format':_0xf35e('0x61'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3a1f5c['on'](_0xf35e('0x62'),function(_0x551b0a){fs[_0xf35e('0x63')](_0x2ecc13);_0x2c7811[_0xf35e('0x16')](0x1f4)['send'](_0x551b0a);});_0x3a1f5c['on'](_0xf35e('0x64'),function(_0x2e420c){_0x65e68['original_duration']=isNaN(_0x2e420c['duration'])?null:_0x2e420c['duration']*0x3e8;_0x65e68[_0xf35e('0x65')]=isNaN(_0x2e420c[_0xf35e('0x66')])?null:_0x2e420c[_0xf35e('0x66')];_0x65e68[_0xf35e('0x67')]=isNaN(_0x2e420c[_0xf35e('0x68')])?null:_0x2e420c[_0xf35e('0x68')];_0x65e68['original_bitRate']=isNaN(_0x2e420c['bitRate'])?null:_0x2e420c[_0xf35e('0x69')];_0x65e68['original_sampleRate']=isNaN(_0x2e420c[_0xf35e('0x6a')])?null:_0x2e420c['sampleRate'];});_0x3a1f5c['on'](_0xf35e('0x6b'),function(_0x2981a7){_0x65e68[_0xf35e('0x6c')]=isNaN(_0x2981a7[_0xf35e('0x6d')])?null:_0x2981a7[_0xf35e('0x6d')]*0x3e8;_0x65e68[_0xf35e('0x6e')]=isNaN(_0x2981a7[_0xf35e('0x66')])?null:_0x2981a7['sampleCount'];_0x65e68[_0xf35e('0x6f')]=isNaN(_0x2981a7[_0xf35e('0x68')])?null:_0x2981a7[_0xf35e('0x68')];_0x65e68[_0xf35e('0x70')]=isNaN(_0x2981a7[_0xf35e('0x69')])?null:_0x2981a7[_0xf35e('0x69')];_0x65e68['converted_sampleRate']=isNaN(_0x2981a7[_0xf35e('0x6a')])?null:_0x2981a7[_0xf35e('0x6a')];});_0x3a1f5c['on']('end',function(){fs[_0xf35e('0x5e')](_0x4dae9e,parseInt('0777',0x8));return db[_0xf35e('0x2a')]['create'](_0x65e68)[_0xf35e('0x21')](function(_0x2436ff){var _0x5d3c20={'role':_0x4bab39[_0xf35e('0x71')]['role'],'userProfileId':_0x4bab39[_0xf35e('0x71')][_0xf35e('0x72')]};if(!_0x5d3c20)throw new Error(_0xf35e('0x73'));if(_0x5d3c20[_0xf35e('0x74')]===_0xf35e('0x75')){var _0x5bf706=_0x2436ff[_0xf35e('0x23')]({'plain':!![]});return db[_0xf35e('0x76')][_0xf35e('0x46')]({'where':{'name':'Sounds','userProfileId':_0x5d3c20[_0xf35e('0x72')]},'raw':!![]})['then'](function(_0x3b93f6){if(_0x3b93f6&&_0x3b93f6[_0xf35e('0x77')]===0x0){return db['UserProfileResource'][_0xf35e('0x54')]({'name':_0x5bf706[_0xf35e('0x27')],'resourceId':_0x5bf706['id'],'type':_0x3b93f6[_0xf35e('0x27')],'sectionId':_0x3b93f6['id']},{})[_0xf35e('0x21')](function(){return _0x2436ff;});}else{return _0x2436ff;}})['catch'](function(_0x127630){logger[_0xf35e('0x62')](_0xf35e('0x78'),_0x127630);throw _0x127630;});}return _0x2436ff;})[_0xf35e('0x21')](respondWithResult(_0x2c7811,null))[_0xf35e('0x45')](handleError(_0x2c7811,null));});_0x3a1f5c['start']();}catch(_0x1cb4bb){_0x2c7811[_0xf35e('0x16')](0x1f4)['send'](_0x1cb4bb);}};exports[_0xf35e('0x20')]=function(_0x5e9dbb,_0x3560bd,_0x101298){return db[_0xf35e('0x2a')][_0xf35e('0x46')]({'where':{'id':_0x5e9dbb[_0xf35e('0x48')]['id']}})[_0xf35e('0x21')](handleEntityNotFound(_0x3560bd,null))['then'](saveUpdates(_['pick'](_0x5e9dbb[_0xf35e('0x71')],[_0xf35e('0x27'),'description']),null))[_0xf35e('0x21')](respondWithResult(_0x3560bd,null))[_0xf35e('0x45')](handleError(_0x3560bd,null));};exports[_0xf35e('0x79')]=function(_0x59acd5,_0x2611c9,_0x25620d){return db['Sound'][_0xf35e('0x46')]({'where':{'id':_0x59acd5[_0xf35e('0x48')]['id']}})[_0xf35e('0x21')](function(_0x53e04c){if(_0x53e04c){return _0x53e04c[_0xf35e('0x22')]();}})[_0xf35e('0x21')](function(_0x2b2e50){var _0x37aec9=path['join'](config[_0xf35e('0x4d')],_0xf35e('0x7a'),util[_0xf35e('0x52')](_0xf35e('0x53'),_0x2b2e50['save_name'],_0x2b2e50[_0xf35e('0x7b')]));var _0x4cae7d=path[_0xf35e('0x4c')](config[_0xf35e('0x4d')],_0xf35e('0x51'),util[_0xf35e('0x52')](_0xf35e('0x53'),_0x2b2e50[_0xf35e('0x49')],_0x2b2e50['converted_format']));fs[_0xf35e('0x63')](_0x37aec9);fs['unlinkSync'](_0x4cae7d);return _0x2b2e50;})[_0xf35e('0x21')](function(_0xf38c3){if(_0xf38c3){return _0x2611c9[_0xf35e('0x16')](0xcc)[_0xf35e('0x25')]();}})['then'](handleEntityNotFound(_0x2611c9,null))[_0xf35e('0x45')](handleError(_0x2611c9,null));}; \ No newline at end of file +var _0x1892=['send','src','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','chmodSync','0777','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Sounds','end','name','index','map','Sound','rawAttributes','fieldName','key','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','intersection','options','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','format','%s.%s','originalname','extname','file','basename','substring','wav','server/files/sounds/original','filename','info','Sound\x20upload\x20filepath:\x20%s','transcode','error','unlinkSync'];(function(_0x1e6c47,_0x38c428){var _0x1d6f5f=function(_0xa6007d){while(--_0xa6007d){_0x1e6c47['push'](_0x1e6c47['shift']());}};_0x1d6f5f(++_0x38c428);}(_0x1892,0x9a));var _0x2189=function(_0x273a74,_0x60b699){_0x273a74=_0x273a74-0x0;var _0x2dec64=_0x1892[_0x273a74];return _0x2dec64;};'use strict';var pdf=require(_0x2189('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2189('0x1'));var zipdir=require(_0x2189('0x2'));var jsonpatch=require(_0x2189('0x3'));var rp=require('request-promise');var moment=require(_0x2189('0x4'));var BPromise=require(_0x2189('0x5'));var Mustache=require(_0x2189('0x6'));var util=require(_0x2189('0x7'));var path=require('path');var sox=require(_0x2189('0x8'));var csv=require(_0x2189('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2189('0xa'));var squel=require(_0x2189('0xb'));var crypto=require('crypto');var jsforce=require(_0x2189('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2189('0xd'));var Papa=require(_0x2189('0xe'));var Redis=require(_0x2189('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2189('0x10'));var as=require(_0x2189('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2189('0x12'));var config=require(_0x2189('0x13'));var db=require(_0x2189('0x14'))['db'];function respondWithStatusCode(_0x4cf968,_0xb36a6f){_0xb36a6f=_0xb36a6f||0xcc;return function(_0x304d6a){if(_0x304d6a){return _0x4cf968[_0x2189('0x15')](_0xb36a6f);}return _0x4cf968[_0x2189('0x16')](_0xb36a6f)['end']();};}function respondWithResult(_0x170110,_0x182c76){_0x182c76=_0x182c76||0xc8;return function(_0x5b420d){if(_0x5b420d){return _0x170110[_0x2189('0x16')](_0x182c76)[_0x2189('0x17')](_0x5b420d);}};}function respondWithFilteredResult(_0xded407,_0xc49692){return function(_0x49dbe1){if(_0x49dbe1){var _0x349ca2=_0x49dbe1[_0x2189('0x18')],_0x4574c6=_0xc49692['offset'],_0xba1ef=_0xc49692['offset']+_0xc49692['limit'],_0x37c2e0;if(_0xba1ef>=_0x349ca2){_0xba1ef=_0x349ca2;_0x37c2e0=0xc8;}else{_0x37c2e0=0xce;}_0xded407[_0x2189('0x16')](_0x37c2e0);return _0xded407[_0x2189('0x19')](_0x2189('0x1a'),_0x4574c6+'-'+_0xba1ef+'/'+_0x349ca2)[_0x2189('0x17')](_0x49dbe1);}return null;};}function patchUpdates(_0x5eb6d6){return function(_0x141b33){try{jsonpatch[_0x2189('0x1b')](_0x141b33,_0x5eb6d6,!![]);}catch(_0x2e1745){return BPromise[_0x2189('0x1c')](_0x2e1745);}return _0x141b33[_0x2189('0x1d')]();};}function saveUpdates(_0x408a54,_0x58ff09){return function(_0x5b9fb3){if(_0x5b9fb3){return _0x5b9fb3[_0x2189('0x1e')](_0x408a54)['then'](function(_0x1920d5){return _0x1920d5;});}return null;};}function removeEntity(_0x283f2c,_0x1ff0b5){return function(_0x58e7f8){if(_0x58e7f8){return _0x58e7f8[_0x2189('0x1f')]()[_0x2189('0x20')](function(){var _0x8b1b1a=_0x58e7f8[_0x2189('0x21')]({'plain':!![]});var _0x58649c=_0x2189('0x22');return db['UserProfileResource'][_0x2189('0x1f')]({'where':{'type':_0x58649c,'resourceId':_0x8b1b1a['id']}})[_0x2189('0x20')](function(){return _0x58e7f8;});})['then'](function(){_0x283f2c[_0x2189('0x16')](0xcc)[_0x2189('0x23')]();});}};}function handleEntityNotFound(_0x34e75a,_0x49673c){return function(_0x4c6aa6){if(!_0x4c6aa6){_0x34e75a['sendStatus'](0x194);}return _0x4c6aa6;};}function handleError(_0x3c68a1,_0x3ab4c6){_0x3ab4c6=_0x3ab4c6||0x1f4;return function(_0x5be6a2){logger['error'](_0x5be6a2['stack']);if(_0x5be6a2[_0x2189('0x24')]){delete _0x5be6a2[_0x2189('0x24')];}_0x3c68a1['status'](_0x3ab4c6)['send'](_0x5be6a2);};}exports[_0x2189('0x25')]=function(_0x5d2f3e,_0x49b23d){var _0x4d6c3b={},_0x4f91a5={},_0x22f8e9={'count':0x0,'rows':[]};var _0x1bd7c9=_[_0x2189('0x26')](db[_0x2189('0x27')][_0x2189('0x28')],function(_0x44cb6f){return{'name':_0x44cb6f[_0x2189('0x29')],'type':_0x44cb6f['type'][_0x2189('0x2a')]};});_0x4f91a5[_0x2189('0x2b')]=_['map'](_0x1bd7c9,'name');_0x4f91a5['query']=_[_0x2189('0x2c')](_0x5d2f3e[_0x2189('0x2d')]);_0x4f91a5['filters']=_['intersection'](_0x4f91a5['model'],_0x4f91a5['query']);_0x4d6c3b[_0x2189('0x2e')]=_['intersection'](_0x4f91a5[_0x2189('0x2b')],qs[_0x2189('0x2f')](_0x5d2f3e[_0x2189('0x2d')][_0x2189('0x2f')]));_0x4d6c3b['attributes']=_0x4d6c3b['attributes'][_0x2189('0x30')]?_0x4d6c3b[_0x2189('0x2e')]:_0x4f91a5[_0x2189('0x2b')];if(!_0x5d2f3e[_0x2189('0x2d')][_0x2189('0x31')](_0x2189('0x32'))){_0x4d6c3b['limit']=qs[_0x2189('0x33')](_0x5d2f3e['query'][_0x2189('0x33')]);_0x4d6c3b[_0x2189('0x34')]=qs['offset'](_0x5d2f3e[_0x2189('0x2d')][_0x2189('0x34')]);}_0x4d6c3b['order']=qs[_0x2189('0x35')](_0x5d2f3e['query'][_0x2189('0x35')]);_0x4d6c3b[_0x2189('0x36')]=qs[_0x2189('0x37')](_[_0x2189('0x38')](_0x5d2f3e[_0x2189('0x2d')],_0x4f91a5[_0x2189('0x37')]));if(_0x5d2f3e[_0x2189('0x2d')][_0x2189('0x39')]){_0x4d6c3b[_0x2189('0x36')]=_[_0x2189('0x3a')](_0x4d6c3b[_0x2189('0x36')],{'$or':_[_0x2189('0x26')](_0x1bd7c9,function(_0x4c6a0c){if(_0x4c6a0c[_0x2189('0x3b')]!==_0x2189('0x3c')){var _0x277751={};_0x277751[_0x4c6a0c[_0x2189('0x24')]]={'$like':'%'+_0x5d2f3e['query'][_0x2189('0x39')]+'%'};return _0x277751;}})});}_0x4d6c3b=_[_0x2189('0x3a')]({},_0x4d6c3b,_0x5d2f3e['options']);var _0x155b55={'where':_0x4d6c3b[_0x2189('0x36')]};return db[_0x2189('0x27')][_0x2189('0x18')](_0x155b55)[_0x2189('0x20')](function(_0x5db829){_0x22f8e9[_0x2189('0x18')]=_0x5db829;if(_0x5d2f3e[_0x2189('0x2d')][_0x2189('0x3d')]){_0x4d6c3b[_0x2189('0x3e')]=[{'all':!![]}];}return db[_0x2189('0x27')][_0x2189('0x3f')](_0x4d6c3b);})[_0x2189('0x20')](function(_0xbba475){_0x22f8e9[_0x2189('0x40')]=_0xbba475;return _0x22f8e9;})['then'](respondWithFilteredResult(_0x49b23d,_0x4d6c3b))[_0x2189('0x41')](handleError(_0x49b23d,null));};exports[_0x2189('0x42')]=function(_0x41d132,_0x1a27f8){var _0x586c41={'raw':!![],'where':{'id':_0x41d132[_0x2189('0x43')]['id']}},_0x35537f={};_0x35537f[_0x2189('0x2b')]=_['keys'](db[_0x2189('0x27')][_0x2189('0x28')]);_0x35537f['query']=_[_0x2189('0x2c')](_0x41d132[_0x2189('0x2d')]);_0x35537f[_0x2189('0x37')]=_[_0x2189('0x44')](_0x35537f['model'],_0x35537f['query']);_0x586c41[_0x2189('0x2e')]=_[_0x2189('0x44')](_0x35537f[_0x2189('0x2b')],qs[_0x2189('0x2f')](_0x41d132[_0x2189('0x2d')][_0x2189('0x2f')]));_0x586c41[_0x2189('0x2e')]=_0x586c41['attributes'][_0x2189('0x30')]?_0x586c41[_0x2189('0x2e')]:_0x35537f[_0x2189('0x2b')];if(_0x41d132[_0x2189('0x2d')][_0x2189('0x3d')]){_0x586c41[_0x2189('0x3e')]=[{'all':!![]}];}_0x586c41=_['merge']({},_0x586c41,_0x41d132[_0x2189('0x45')]);return db[_0x2189('0x27')][_0x2189('0x46')](_0x586c41)[_0x2189('0x20')](handleEntityNotFound(_0x1a27f8,null))[_0x2189('0x20')](respondWithResult(_0x1a27f8,null))[_0x2189('0x41')](handleError(_0x1a27f8,null));};exports['download']=function(_0x38cdad,_0x3ac706,_0x4c882e){return db['Sound'][_0x2189('0x46')]({'where':{'id':_0x38cdad[_0x2189('0x43')]['id']},'attributes':[_0x2189('0x24'),_0x2189('0x47'),_0x2189('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x3ac706,null))['then'](function(_0x5d32ed){if(_0x5d32ed){if(!fs[_0x2189('0x49')](path[_0x2189('0x4a')](config[_0x2189('0x4b')],_0x2189('0x4c'),_0x5d32ed[_0x2189('0x47')]+'.'+_0x5d32ed[_0x2189('0x48')]))){throw new db['Sequelize'][(_0x2189('0x4d'))](_0x2189('0x4e'));}return _0x3ac706['download'](path[_0x2189('0x4a')](config[_0x2189('0x4b')],'server/files/sounds/converted',util[_0x2189('0x4f')]('%s.%s',_0x5d32ed['save_name'],_0x5d32ed['converted_format'])),util[_0x2189('0x4f')](_0x2189('0x50'),_0x5d32ed[_0x2189('0x24')],_0x5d32ed[_0x2189('0x48')]));}return null;})[_0x2189('0x41')](handleError(_0x3ac706,null));};exports['create']=function(_0x32205c,_0x5935dd,_0x261a19){var _0x21d12e={'name':path['basename'](_0x32205c['file'][_0x2189('0x51')],path[_0x2189('0x52')](_0x32205c[_0x2189('0x53')][_0x2189('0x51')])),'save_name':path[_0x2189('0x54')](_0x32205c[_0x2189('0x53')]['filename'],path[_0x2189('0x52')](_0x32205c['file']['filename'])),'original_format':path[_0x2189('0x52')](_0x32205c[_0x2189('0x53')]['originalname'])[_0x2189('0x55')](0x1),'converted_format':_0x2189('0x56')};var _0x110023=path[_0x2189('0x4a')](config['root'],_0x2189('0x57'),_0x32205c[_0x2189('0x53')][_0x2189('0x58')]);var _0x36f2c4=path[_0x2189('0x4a')](config[_0x2189('0x4b')],_0x2189('0x4c'),util[_0x2189('0x4f')](_0x2189('0x50'),path['basename'](_0x32205c[_0x2189('0x53')]['filename'],path['extname'](_0x32205c[_0x2189('0x53')][_0x2189('0x58')])),_0x21d12e[_0x2189('0x48')]));logger[_0x2189('0x59')](_0x2189('0x5a'),_0x110023);logger[_0x2189('0x59')]('Sound\x20upload\x20destination:\x20%s',_0x36f2c4);try{fs['chmodSync'](_0x110023,parseInt('0777',0x8));var _0x319ab4=sox[_0x2189('0x5b')](_0x110023,_0x36f2c4,{'sampleRate':0x1f40,'format':_0x2189('0x56'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x319ab4['on'](_0x2189('0x5c'),function(_0x45ca51){fs[_0x2189('0x5d')](_0x110023);_0x5935dd[_0x2189('0x16')](0x1f4)[_0x2189('0x5e')](_0x45ca51);});_0x319ab4['on'](_0x2189('0x5f'),function(_0x3cb737){_0x21d12e['original_duration']=isNaN(_0x3cb737[_0x2189('0x60')])?null:_0x3cb737[_0x2189('0x60')]*0x3e8;_0x21d12e[_0x2189('0x61')]=isNaN(_0x3cb737[_0x2189('0x62')])?null:_0x3cb737[_0x2189('0x62')];_0x21d12e['original_channelCount']=isNaN(_0x3cb737['channelCount'])?null:_0x3cb737[_0x2189('0x63')];_0x21d12e[_0x2189('0x64')]=isNaN(_0x3cb737[_0x2189('0x65')])?null:_0x3cb737['bitRate'];_0x21d12e[_0x2189('0x66')]=isNaN(_0x3cb737[_0x2189('0x67')])?null:_0x3cb737[_0x2189('0x67')];});_0x319ab4['on'](_0x2189('0x68'),function(_0x2c1799){_0x21d12e[_0x2189('0x69')]=isNaN(_0x2c1799[_0x2189('0x60')])?null:_0x2c1799['duration']*0x3e8;_0x21d12e[_0x2189('0x6a')]=isNaN(_0x2c1799[_0x2189('0x62')])?null:_0x2c1799[_0x2189('0x62')];_0x21d12e['converted_channelCount']=isNaN(_0x2c1799[_0x2189('0x63')])?null:_0x2c1799[_0x2189('0x63')];_0x21d12e[_0x2189('0x6b')]=isNaN(_0x2c1799['bitRate'])?null:_0x2c1799[_0x2189('0x65')];_0x21d12e['converted_sampleRate']=isNaN(_0x2c1799[_0x2189('0x67')])?null:_0x2c1799[_0x2189('0x67')];});_0x319ab4['on']('end',function(){fs[_0x2189('0x6c')](_0x36f2c4,parseInt(_0x2189('0x6d'),0x8));return db['Sound'][_0x2189('0x6e')](_0x21d12e)[_0x2189('0x20')](function(_0x1e6880){var _0x224ac7={'role':_0x32205c[_0x2189('0x6f')][_0x2189('0x70')],'userProfileId':_0x32205c[_0x2189('0x6f')][_0x2189('0x71')]};if(!_0x224ac7)throw new Error(_0x2189('0x72'));if(_0x224ac7[_0x2189('0x70')]===_0x2189('0x73')){var _0x2e9836=_0x1e6880[_0x2189('0x21')]({'plain':!![]});return db[_0x2189('0x74')]['find']({'where':{'name':_0x2189('0x22'),'userProfileId':_0x224ac7[_0x2189('0x71')]},'raw':!![]})[_0x2189('0x20')](function(_0x3e83d3){if(_0x3e83d3&&_0x3e83d3[_0x2189('0x75')]===0x0){return db[_0x2189('0x76')][_0x2189('0x6e')]({'name':_0x2e9836['name'],'resourceId':_0x2e9836['id'],'type':_0x3e83d3['name'],'sectionId':_0x3e83d3['id']},{})['then'](function(){return _0x1e6880;});}else{return _0x1e6880;}})[_0x2189('0x41')](function(_0x36483b){logger[_0x2189('0x5c')](_0x2189('0x77'),_0x36483b);throw _0x36483b;});}return _0x1e6880;})[_0x2189('0x20')](respondWithResult(_0x5935dd,null))[_0x2189('0x41')](handleError(_0x5935dd,null));});_0x319ab4[_0x2189('0x78')]();}catch(_0x3a1d90){_0x5935dd[_0x2189('0x16')](0x1f4)['send'](_0x3a1d90);}};exports[_0x2189('0x1e')]=function(_0x4133b6,_0x4fe9e8,_0x30de50){return db['Sound']['find']({'where':{'id':_0x4133b6[_0x2189('0x43')]['id']}})['then'](handleEntityNotFound(_0x4fe9e8,null))['then'](saveUpdates(_[_0x2189('0x38')](_0x4133b6[_0x2189('0x6f')],['name',_0x2189('0x79')]),null))['then'](respondWithResult(_0x4fe9e8,null))[_0x2189('0x41')](handleError(_0x4fe9e8,null));};exports[_0x2189('0x7a')]=function(_0x32d0ea,_0x3f6ddb,_0x148a3c){return db['Sound'][_0x2189('0x46')]({'where':{'id':_0x32d0ea[_0x2189('0x43')]['id']}})[_0x2189('0x20')](function(_0x265218){if(_0x265218){return _0x265218[_0x2189('0x1f')]();}})[_0x2189('0x20')](function(_0x3ecf5c){var _0x5372bf=path[_0x2189('0x4a')](config[_0x2189('0x4b')],'server/files/sounds/original',util[_0x2189('0x4f')](_0x2189('0x50'),_0x3ecf5c[_0x2189('0x47')],_0x3ecf5c[_0x2189('0x7b')]));var _0x1077f1=path['join'](config[_0x2189('0x4b')],'server/files/sounds/converted',util['format'](_0x2189('0x50'),_0x3ecf5c[_0x2189('0x47')],_0x3ecf5c['converted_format']));fs[_0x2189('0x5d')](_0x5372bf);fs[_0x2189('0x5d')](_0x1077f1);return _0x3ecf5c;})['then'](function(_0x798eb6){if(_0x798eb6){return _0x3f6ddb[_0x2189('0x16')](0xcc)[_0x2189('0x23')]();}})[_0x2189('0x20')](handleEntityNotFound(_0x3f6ddb,null))[_0x2189('0x41')](handleError(_0x3f6ddb,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index e386375..c6f2d82 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 _0x52a2=['../../config/environment','./sound.attributes','exports','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x50cdb3,_0x2b0731){var _0x23ffb6=function(_0x4b9ab3){while(--_0x4b9ab3){_0x50cdb3['push'](_0x50cdb3['shift']());}};_0x23ffb6(++_0x2b0731);}(_0x52a2,0x185));var _0x252a=function(_0x216c2f,_0xaf2d0e){_0x216c2f=_0x216c2f-0x0;var _0x1b6b9a=_0x52a2[_0x216c2f];return _0x1b6b9a;};'use strict';var _=require(_0x252a('0x0'));var util=require(_0x252a('0x1'));var logger=require(_0x252a('0x2'))(_0x252a('0x3'));var moment=require(_0x252a('0x4'));var BPromise=require(_0x252a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x252a('0x6'));var rimraf=require('rimraf');var config=require(_0x252a('0x7'));var attributes=require(_0x252a('0x8'));module[_0x252a('0x9')]=function(_0x4087cc,_0x311903){return _0x4087cc['define']('Sound',attributes,{'tableName':_0x252a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8517=['rimraf','../../config/environment','./sound.attributes','define','Sound','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xa1e030,_0x579969){var _0x1619bb=function(_0x108f53){while(--_0x108f53){_0xa1e030['push'](_0xa1e030['shift']());}};_0x1619bb(++_0x579969);}(_0x8517,0x65));var _0x7851=function(_0x26e85e,_0x77a7f0){_0x26e85e=_0x26e85e-0x0;var _0x3135ee=_0x8517[_0x26e85e];return _0x3135ee;};'use strict';var _=require(_0x7851('0x0'));var util=require('util');var logger=require(_0x7851('0x1'))(_0x7851('0x2'));var moment=require(_0x7851('0x3'));var BPromise=require(_0x7851('0x4'));var rp=require(_0x7851('0x5'));var fs=require('fs');var path=require(_0x7851('0x6'));var rimraf=require(_0x7851('0x7'));var config=require(_0x7851('0x8'));var attributes=require(_0x7851('0x9'));module['exports']=function(_0x407295,_0xbfad0c){return _0x407295[_0x7851('0xa')](_0x7851('0xb'),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 7bba48d..6077d94 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 _0xc9d8=['stringify','error','code','message','catch','ShowSound','Sound','find','options','where','include','map','model','attributes','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s'];(function(_0x599d7f,_0xc586e8){var _0x3346d3=function(_0x56b820){while(--_0x56b820){_0x599d7f['push'](_0x599d7f['shift']());}};_0x3346d3(++_0xc586e8);}(_0xc9d8,0x1ef));var _0x8c9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc9d8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8c9d('0x0'));var util=require('util');var moment=require(_0x8c9d('0x1'));var BPromise=require(_0x8c9d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c9d('0x3'));var db=require(_0x8c9d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c9d('0x5'))(_0x8c9d('0x6'));var config=require(_0x8c9d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8c9d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8f0c71,_0x751ed4,_0x354937){return new BPromise(function(_0x43ae02,_0x4b5fe1){return client[_0x8c9d('0x9')](_0x8f0c71,_0x354937)[_0x8c9d('0xa')](function(_0x4a0031){logger[_0x8c9d('0xb')](_0x8c9d('0xc'),_0x751ed4,_0x8c9d('0xd'));logger['debug'](_0x8c9d('0xe'),_0x751ed4,'request\x20sent',JSON[_0x8c9d('0xf')](_0x4a0031));if(_0x4a0031['error']){if(_0x4a0031[_0x8c9d('0x10')][_0x8c9d('0x11')]===0x1f4){logger[_0x8c9d('0x10')](_0x8c9d('0xc'),_0x751ed4,_0x4a0031[_0x8c9d('0x10')][_0x8c9d('0x12')]);return _0x4b5fe1(_0x4a0031[_0x8c9d('0x10')][_0x8c9d('0x12')]);}logger['error']('Sound,\x20%s,\x20%s',_0x751ed4,_0x4a0031['error']['message']);return _0x43ae02(_0x4a0031['error']['message']);}else{logger[_0x8c9d('0xb')](_0x8c9d('0xc'),_0x751ed4,_0x8c9d('0xd'));_0x43ae02(_0x4a0031['result'][_0x8c9d('0x12')]);}})[_0x8c9d('0x13')](function(_0x320369){logger[_0x8c9d('0x10')](_0x8c9d('0xc'),_0x751ed4,_0x320369);_0x4b5fe1(_0x320369);});});}exports[_0x8c9d('0x14')]=function(_0xdc96a0){var _0x2d77b6=this;return new Promise(function(_0x1af937,_0x4abaeb){return db[_0x8c9d('0x15')][_0x8c9d('0x16')]({'raw':_0xdc96a0[_0x8c9d('0x17')]?_0xdc96a0['options']['raw']===undefined?!![]:![]:!![],'where':_0xdc96a0[_0x8c9d('0x17')]?_0xdc96a0['options'][_0x8c9d('0x18')]||null:null,'attributes':_0xdc96a0[_0x8c9d('0x17')]?_0xdc96a0[_0x8c9d('0x17')]['attributes']||null:null,'include':_0xdc96a0['options']?_0xdc96a0[_0x8c9d('0x17')][_0x8c9d('0x19')]?_[_0x8c9d('0x1a')](_0xdc96a0['options'][_0x8c9d('0x19')],function(_0xe0f2f5){return{'model':db[_0xe0f2f5[_0x8c9d('0x1b')]],'as':_0xe0f2f5['as'],'attributes':_0xe0f2f5[_0x8c9d('0x1c')],'include':_0xe0f2f5['include']?_[_0x8c9d('0x1a')](_0xe0f2f5[_0x8c9d('0x19')],function(_0x33353a){return{'model':db[_0x33353a['model']],'as':_0x33353a['as'],'attributes':_0x33353a[_0x8c9d('0x1c')],'include':_0x33353a[_0x8c9d('0x19')]?_[_0x8c9d('0x1a')](_0x33353a['include'],function(_0x2c1af7){return{'model':db[_0x2c1af7[_0x8c9d('0x1b')]],'as':_0x2c1af7['as'],'attributes':_0x2c1af7[_0x8c9d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8c9d('0xa')](function(_0x2fa5e4){logger['info'](_0x8c9d('0x14'),_0xdc96a0);logger[_0x8c9d('0x1d')](_0x8c9d('0x14'),_0xdc96a0,JSON['stringify'](_0x2fa5e4));_0x1af937(_0x2fa5e4);})['catch'](function(_0x53904e){logger['error'](_0x8c9d('0x14'),_0x53904e[_0x8c9d('0x12')],_0xdc96a0);_0x4abaeb(_0x2d77b6[_0x8c9d('0x10')](0x1f4,_0x53904e[_0x8c9d('0x12')]));});});}; \ No newline at end of file +var _0xa858=['code','message','result','Sound','find','options','raw','where','attributes','map','include','model','ShowSound','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa858,0x1a1));var _0x8a85=function(_0x245116,_0x3cea29){_0x245116=_0x245116-0x0;var _0x47ce00=_0xa858[_0x245116];return _0x47ce00;};'use strict';var _=require(_0x8a85('0x0'));var util=require(_0x8a85('0x1'));var moment=require('moment');var BPromise=require(_0x8a85('0x2'));var rs=require(_0x8a85('0x3'));var fs=require('fs');var Redis=require(_0x8a85('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8a85('0x5'))(_0x8a85('0x6'));var config=require(_0x8a85('0x7'));var jayson=require(_0x8a85('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfd2e89,_0x4cd1ef,_0x2714e5){return new BPromise(function(_0x2a4364,_0x536c6f){return client['request'](_0xfd2e89,_0x2714e5)[_0x8a85('0x9')](function(_0x4fe94a){logger[_0x8a85('0xa')](_0x8a85('0xb'),_0x4cd1ef,_0x8a85('0xc'));logger[_0x8a85('0xd')](_0x8a85('0xe'),_0x4cd1ef,_0x8a85('0xc'),JSON[_0x8a85('0xf')](_0x4fe94a));if(_0x4fe94a[_0x8a85('0x10')]){if(_0x4fe94a[_0x8a85('0x10')][_0x8a85('0x11')]===0x1f4){logger[_0x8a85('0x10')](_0x8a85('0xb'),_0x4cd1ef,_0x4fe94a['error'][_0x8a85('0x12')]);return _0x536c6f(_0x4fe94a[_0x8a85('0x10')][_0x8a85('0x12')]);}logger[_0x8a85('0x10')](_0x8a85('0xb'),_0x4cd1ef,_0x4fe94a[_0x8a85('0x10')][_0x8a85('0x12')]);return _0x2a4364(_0x4fe94a[_0x8a85('0x10')]['message']);}else{logger[_0x8a85('0xa')](_0x8a85('0xb'),_0x4cd1ef,_0x8a85('0xc'));_0x2a4364(_0x4fe94a[_0x8a85('0x13')][_0x8a85('0x12')]);}})['catch'](function(_0x46c31c){logger[_0x8a85('0x10')]('Sound,\x20%s,\x20%s',_0x4cd1ef,_0x46c31c);_0x536c6f(_0x46c31c);});});}exports['ShowSound']=function(_0x21165e){var _0x22a1b2=this;return new Promise(function(_0x4293d5,_0x5a7f56){return db[_0x8a85('0x14')][_0x8a85('0x15')]({'raw':_0x21165e[_0x8a85('0x16')]?_0x21165e[_0x8a85('0x16')][_0x8a85('0x17')]===undefined?!![]:![]:!![],'where':_0x21165e['options']?_0x21165e[_0x8a85('0x16')][_0x8a85('0x18')]||null:null,'attributes':_0x21165e[_0x8a85('0x16')]?_0x21165e[_0x8a85('0x16')][_0x8a85('0x19')]||null:null,'include':_0x21165e[_0x8a85('0x16')]?_0x21165e[_0x8a85('0x16')]['include']?_[_0x8a85('0x1a')](_0x21165e[_0x8a85('0x16')][_0x8a85('0x1b')],function(_0x4013db){return{'model':db[_0x4013db[_0x8a85('0x1c')]],'as':_0x4013db['as'],'attributes':_0x4013db['attributes'],'include':_0x4013db[_0x8a85('0x1b')]?_[_0x8a85('0x1a')](_0x4013db[_0x8a85('0x1b')],function(_0xbe83e4){return{'model':db[_0xbe83e4[_0x8a85('0x1c')]],'as':_0xbe83e4['as'],'attributes':_0xbe83e4[_0x8a85('0x19')],'include':_0xbe83e4['include']?_['map'](_0xbe83e4[_0x8a85('0x1b')],function(_0x5c626d){return{'model':db[_0x5c626d[_0x8a85('0x1c')]],'as':_0x5c626d['as'],'attributes':_0x5c626d[_0x8a85('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ac25a){logger['info']('ShowSound',_0x21165e);logger[_0x8a85('0xd')](_0x8a85('0x1d'),_0x21165e,JSON['stringify'](_0x5ac25a));_0x4293d5(_0x5ac25a);})[_0x8a85('0x1e')](function(_0xb44ea3){logger[_0x8a85('0x10')](_0x8a85('0x1d'),_0xb44ea3['message'],_0x21165e);_0x5a7f56(_0x22a1b2[_0x8a85('0x10')](0x1f4,_0xb44ea3[_0x8a85('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 48420be..07d9a41 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 _0x2c63=['get','/:id','show','post','create','put','update','delete','destroy','multer','util','path','express','../../config/environment','./squareMessage.controller','isAuthenticated','index'];(function(_0xfaf19d,_0x57304b){var _0x14a9d9=function(_0x5337fc){while(--_0x5337fc){_0xfaf19d['push'](_0xfaf19d['shift']());}};_0x14a9d9(++_0x57304b);}(_0x2c63,0x15d));var _0x32c6=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0x2c63[_0x547456];return _0xc1fd7b;};'use strict';var multer=require(_0x32c6('0x0'));var util=require(_0x32c6('0x1'));var path=require(_0x32c6('0x2'));var timeout=require('connect-timeout');var express=require(_0x32c6('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x32c6('0x4'));var controller=require(_0x32c6('0x5'));router['get']('/',auth[_0x32c6('0x6')](),controller[_0x32c6('0x7')]);router[_0x32c6('0x8')](_0x32c6('0x9'),auth[_0x32c6('0x6')](),controller[_0x32c6('0xa')]);router[_0x32c6('0xb')]('/',auth[_0x32c6('0x6')](),controller[_0x32c6('0xc')]);router[_0x32c6('0xd')]('/:id',auth[_0x32c6('0x6')](),controller[_0x32c6('0xe')]);router[_0x32c6('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x32c6('0x10')]);module['exports']=router; \ No newline at end of file +var _0x3ba7=['isAuthenticated','/:id','show','post','put','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x3ba7,0x17e));var _0x73ba=function(_0x219db8,_0x81ddfd){_0x219db8=_0x219db8-0x0;var _0x2b5e14=_0x3ba7[_0x219db8];return _0x2b5e14;};'use strict';var multer=require(_0x73ba('0x0'));var util=require('util');var path=require(_0x73ba('0x1'));var timeout=require(_0x73ba('0x2'));var express=require('express');var router=express[_0x73ba('0x3')]();var auth=require(_0x73ba('0x4'));var interaction=require(_0x73ba('0x5'));var config=require(_0x73ba('0x6'));var controller=require('./squareMessage.controller');router[_0x73ba('0x7')]('/',auth[_0x73ba('0x8')](),controller['index']);router[_0x73ba('0x7')](_0x73ba('0x9'),auth[_0x73ba('0x8')](),controller[_0x73ba('0xa')]);router[_0x73ba('0xb')]('/',auth[_0x73ba('0x8')](),controller['create']);router[_0x73ba('0xc')](_0x73ba('0x9'),auth[_0x73ba('0x8')](),controller['update']);router[_0x73ba('0xd')](_0x73ba('0x9'),auth[_0x73ba('0x8')](),controller['destroy']);module[_0x73ba('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index c0ac56d..003ecf2 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 _0xd292=['exports','TEXT','medium','ENUM','out','sequelize'];(function(_0x2f536,_0x1db833){var _0x643c53=function(_0x3b48a7){while(--_0x3b48a7){_0x2f536['push'](_0x2f536['shift']());}};_0x643c53(++_0x1db833);}(_0xd292,0x95));var _0x2d29=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd292[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2d29('0x0'));module[_0x2d29('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x2d29('0x2')](_0x2d29('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x2d29('0x4')]('in',_0x2d29('0x5')),'defaultValue':_0x2d29('0x5'),'allowNull':![]}}; \ No newline at end of file +var _0x8a11=['ENUM','out','sequelize','exports','STRING'];(function(_0x5c97ad,_0x5abf1c){var _0x439b7a=function(_0x574e30){while(--_0x574e30){_0x5c97ad['push'](_0x5c97ad['shift']());}};_0x439b7a(++_0x5abf1c);}(_0x8a11,0x9d));var _0x18a1=function(_0x3fb9dd,_0x174fff){_0x3fb9dd=_0x3fb9dd-0x0;var _0x20136a=_0x8a11[_0x3fb9dd];return _0x20136a;};'use strict';var Sequelize=require(_0x18a1('0x0'));module[_0x18a1('0x1')]={'uniqueid':{'type':Sequelize[_0x18a1('0x2')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x18a1('0x3')]('in',_0x18a1('0x4')),'defaultValue':_0x18a1('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 c147ec7..85d311c 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 _0xe0e2=['status','end','json','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SquareMessage','rawAttributes','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','create','body','html-pdf','rimraf','fast-json-patch','request-promise','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus'];(function(_0x3ae456,_0x21b486){var _0x279632=function(_0x1aa826){while(--_0x1aa826){_0x3ae456['push'](_0x3ae456['shift']());}};_0x279632(++_0x21b486);}(_0xe0e2,0x13c));var _0x2e0e=function(_0x1245c1,_0x4d0f6e){_0x1245c1=_0x1245c1-0x0;var _0x140053=_0xe0e2[_0x1245c1];return _0x140053;};'use strict';var pdf=require(_0x2e0e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2e0e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2e0e('0x2'));var rp=require(_0x2e0e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2e0e('0x4'));var path=require(_0x2e0e('0x5'));var sox=require('sox');var csv=require(_0x2e0e('0x6'));var ejs=require(_0x2e0e('0x7'));var fs=require('fs');var _=require(_0x2e0e('0x8'));var squel=require('squel');var crypto=require(_0x2e0e('0x9'));var jsforce=require(_0x2e0e('0xa'));var deskjs=require(_0x2e0e('0xb'));var toCsv=require(_0x2e0e('0x6'));var querystring=require(_0x2e0e('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2e0e('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2e0e('0xe'));var logger=require(_0x2e0e('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x2e0e('0x10'));var db=require(_0x2e0e('0x11'))['db'];function respondWithStatusCode(_0xec2621,_0x3afd18){_0x3afd18=_0x3afd18||0xcc;return function(_0x30d798){if(_0x30d798){return _0xec2621[_0x2e0e('0x12')](_0x3afd18);}return _0xec2621[_0x2e0e('0x13')](_0x3afd18)[_0x2e0e('0x14')]();};}function respondWithResult(_0x4eca39,_0x5b5114){_0x5b5114=_0x5b5114||0xc8;return function(_0x370a72){if(_0x370a72){return _0x4eca39[_0x2e0e('0x13')](_0x5b5114)[_0x2e0e('0x15')](_0x370a72);}};}function respondWithFilteredResult(_0xc6331b,_0x1f9b6b){return function(_0x452a9d){if(_0x452a9d){var _0x41f684=_0x452a9d['count'],_0x1ce98c=_0x1f9b6b[_0x2e0e('0x16')],_0x3b7c9d=_0x1f9b6b['offset']+_0x1f9b6b[_0x2e0e('0x17')],_0x238761;if(_0x3b7c9d>=_0x41f684){_0x3b7c9d=_0x41f684;_0x238761=0xc8;}else{_0x238761=0xce;}_0xc6331b[_0x2e0e('0x13')](_0x238761);return _0xc6331b['set'](_0x2e0e('0x18'),_0x1ce98c+'-'+_0x3b7c9d+'/'+_0x41f684)[_0x2e0e('0x15')](_0x452a9d);}return null;};}function patchUpdates(_0x9bdd58){return function(_0x2c7d9f){try{jsonpatch[_0x2e0e('0x19')](_0x2c7d9f,_0x9bdd58,!![]);}catch(_0x212b96){return BPromise[_0x2e0e('0x1a')](_0x212b96);}return _0x2c7d9f[_0x2e0e('0x1b')]();};}function saveUpdates(_0x2493d0,_0x1eab01){return function(_0x4409dd){if(_0x4409dd){return _0x4409dd['update'](_0x2493d0)[_0x2e0e('0x1c')](function(_0x47f1b8){return _0x47f1b8;});}return null;};}function removeEntity(_0x16b5c2,_0x22ace4){return function(_0x2b6aa9){if(_0x2b6aa9){return _0x2b6aa9[_0x2e0e('0x1d')]()['then'](function(){_0x16b5c2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f56a1,_0x544e2a){return function(_0x3b434a){if(!_0x3b434a){_0x5f56a1[_0x2e0e('0x12')](0x194);}return _0x3b434a;};}function handleError(_0x22ac7b,_0x34b7d9){_0x34b7d9=_0x34b7d9||0x1f4;return function(_0x2300a0){logger[_0x2e0e('0x1e')](_0x2300a0[_0x2e0e('0x1f')]);if(_0x2300a0[_0x2e0e('0x20')]){delete _0x2300a0['name'];}_0x22ac7b[_0x2e0e('0x13')](_0x34b7d9)[_0x2e0e('0x21')](_0x2300a0);};}exports[_0x2e0e('0x22')]=function(_0x3e1759,_0x2e311b){var _0x220af6={},_0x28434d={},_0x270a1f={'count':0x0,'rows':[]};var _0x27b2f2=_[_0x2e0e('0x23')](db[_0x2e0e('0x24')][_0x2e0e('0x25')],function(_0x5e3f3a){return{'name':_0x5e3f3a['fieldName'],'type':_0x5e3f3a['type'][_0x2e0e('0x26')]};});_0x28434d[_0x2e0e('0x27')]=_[_0x2e0e('0x23')](_0x27b2f2,_0x2e0e('0x20'));_0x28434d[_0x2e0e('0x28')]=_['keys'](_0x3e1759[_0x2e0e('0x28')]);_0x28434d[_0x2e0e('0x29')]=_[_0x2e0e('0x2a')](_0x28434d[_0x2e0e('0x27')],_0x28434d[_0x2e0e('0x28')]);_0x220af6[_0x2e0e('0x2b')]=_[_0x2e0e('0x2a')](_0x28434d[_0x2e0e('0x27')],qs[_0x2e0e('0x2c')](_0x3e1759['query'][_0x2e0e('0x2c')]));_0x220af6[_0x2e0e('0x2b')]=_0x220af6['attributes']['length']?_0x220af6[_0x2e0e('0x2b')]:_0x28434d[_0x2e0e('0x27')];if(!_0x3e1759['query'][_0x2e0e('0x2d')]('nolimit')){_0x220af6[_0x2e0e('0x17')]=qs[_0x2e0e('0x17')](_0x3e1759[_0x2e0e('0x28')][_0x2e0e('0x17')]);_0x220af6[_0x2e0e('0x16')]=qs['offset'](_0x3e1759[_0x2e0e('0x28')][_0x2e0e('0x16')]);}_0x220af6[_0x2e0e('0x2e')]=qs[_0x2e0e('0x2f')](_0x3e1759[_0x2e0e('0x28')]['sort']);_0x220af6[_0x2e0e('0x30')]=qs[_0x2e0e('0x29')](_[_0x2e0e('0x31')](_0x3e1759[_0x2e0e('0x28')],_0x28434d[_0x2e0e('0x29')]));if(_0x3e1759[_0x2e0e('0x28')][_0x2e0e('0x32')]){_0x220af6[_0x2e0e('0x30')]=_[_0x2e0e('0x33')](_0x220af6[_0x2e0e('0x30')],{'$or':_[_0x2e0e('0x23')](_0x27b2f2,function(_0x165d9f){if(_0x165d9f['type']!==_0x2e0e('0x34')){var _0x55a918={};_0x55a918[_0x165d9f['name']]={'$like':'%'+_0x3e1759[_0x2e0e('0x28')][_0x2e0e('0x32')]+'%'};return _0x55a918;}})});}_0x220af6=_[_0x2e0e('0x33')]({},_0x220af6,_0x3e1759['options']);var _0x59a8fd={'where':_0x220af6[_0x2e0e('0x30')]};return db[_0x2e0e('0x24')]['count'](_0x59a8fd)[_0x2e0e('0x1c')](function(_0x3916e){_0x270a1f[_0x2e0e('0x35')]=_0x3916e;if(_0x3e1759['query'][_0x2e0e('0x36')]){_0x220af6[_0x2e0e('0x37')]=[{'all':!![]}];}return db['SquareMessage'][_0x2e0e('0x38')](_0x220af6);})['then'](function(_0x4160aa){_0x270a1f[_0x2e0e('0x39')]=_0x4160aa;return _0x270a1f;})[_0x2e0e('0x1c')](respondWithFilteredResult(_0x2e311b,_0x220af6))[_0x2e0e('0x3a')](handleError(_0x2e311b,null));};exports[_0x2e0e('0x3b')]=function(_0x47ff84,_0x503b57){var _0xfd037a={'raw':!![],'where':{'id':_0x47ff84[_0x2e0e('0x3c')]['id']}},_0x2d5285={};_0x2d5285[_0x2e0e('0x27')]=_[_0x2e0e('0x3d')](db[_0x2e0e('0x24')][_0x2e0e('0x25')]);_0x2d5285[_0x2e0e('0x28')]=_[_0x2e0e('0x3d')](_0x47ff84[_0x2e0e('0x28')]);_0x2d5285['filters']=_['intersection'](_0x2d5285[_0x2e0e('0x27')],_0x2d5285[_0x2e0e('0x28')]);_0xfd037a[_0x2e0e('0x2b')]=_[_0x2e0e('0x2a')](_0x2d5285[_0x2e0e('0x27')],qs[_0x2e0e('0x2c')](_0x47ff84[_0x2e0e('0x28')][_0x2e0e('0x2c')]));_0xfd037a['attributes']=_0xfd037a['attributes'][_0x2e0e('0x3e')]?_0xfd037a[_0x2e0e('0x2b')]:_0x2d5285[_0x2e0e('0x27')];if(_0x47ff84['query']['includeAll']){_0xfd037a['include']=[{'all':!![]}];}_0xfd037a=_[_0x2e0e('0x33')]({},_0xfd037a,_0x47ff84[_0x2e0e('0x3f')]);return db[_0x2e0e('0x24')][_0x2e0e('0x40')](_0xfd037a)[_0x2e0e('0x1c')](handleEntityNotFound(_0x503b57,null))[_0x2e0e('0x1c')](respondWithResult(_0x503b57,null))[_0x2e0e('0x3a')](handleError(_0x503b57,null));};exports['create']=function(_0x5b2da0,_0x5ba2d8){return db[_0x2e0e('0x24')][_0x2e0e('0x41')](_0x5b2da0[_0x2e0e('0x42')],{})[_0x2e0e('0x1c')](respondWithResult(_0x5ba2d8,0xc9))['catch'](handleError(_0x5ba2d8,null));};exports['update']=function(_0x4ab9d0,_0x5d0cbe){if(_0x4ab9d0[_0x2e0e('0x42')]['id']){delete _0x4ab9d0[_0x2e0e('0x42')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x4ab9d0['params']['id']}})[_0x2e0e('0x1c')](handleEntityNotFound(_0x5d0cbe,null))[_0x2e0e('0x1c')](saveUpdates(_0x4ab9d0[_0x2e0e('0x42')],null))[_0x2e0e('0x1c')](respondWithResult(_0x5d0cbe,null))[_0x2e0e('0x3a')](handleError(_0x5d0cbe,null));};exports['destroy']=function(_0x36184c,_0x1ba05e){return db[_0x2e0e('0x24')][_0x2e0e('0x40')]({'where':{'id':_0x36184c['params']['id']}})[_0x2e0e('0x1c')](handleEntityNotFound(_0x1ba05e,null))[_0x2e0e('0x1c')](removeEntity(_0x1ba05e,null))['catch'](handleError(_0x1ba05e,null));}; \ No newline at end of file +var _0x0b37=['save','update','then','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply'];(function(_0x16d29b,_0x459e09){var _0x20fa6f=function(_0x40a5a8){while(--_0x40a5a8){_0x16d29b['push'](_0x16d29b['shift']());}};_0x20fa6f(++_0x459e09);}(_0x0b37,0x1d7));var _0x70b3=function(_0x35416e,_0xca80e8){_0x35416e=_0x35416e-0x0;var _0x4a3c7a=_0x0b37[_0x35416e];return _0x4a3c7a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x70b3('0x0'));var rimraf=require(_0x70b3('0x1'));var zipdir=require(_0x70b3('0x2'));var jsonpatch=require(_0x70b3('0x3'));var rp=require('request-promise');var moment=require(_0x70b3('0x4'));var BPromise=require(_0x70b3('0x5'));var Mustache=require(_0x70b3('0x6'));var util=require(_0x70b3('0x7'));var path=require(_0x70b3('0x8'));var sox=require(_0x70b3('0x9'));var csv=require('to-csv');var ejs=require(_0x70b3('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x70b3('0xb'));var crypto=require(_0x70b3('0xc'));var jsforce=require(_0x70b3('0xd'));var deskjs=require(_0x70b3('0xe'));var toCsv=require(_0x70b3('0xf'));var querystring=require('querystring');var Papa=require(_0x70b3('0x10'));var Redis=require('ioredis');var authService=require(_0x70b3('0x11'));var qs=require(_0x70b3('0x12'));var as=require(_0x70b3('0x13'));var hardwareService=require(_0x70b3('0x14'));var logger=require(_0x70b3('0x15'))('api');var utils=require(_0x70b3('0x16'));var config=require(_0x70b3('0x17'));var db=require(_0x70b3('0x18'))['db'];function respondWithStatusCode(_0x4102d8,_0x419c0b){_0x419c0b=_0x419c0b||0xcc;return function(_0xe0df0c){if(_0xe0df0c){return _0x4102d8[_0x70b3('0x19')](_0x419c0b);}return _0x4102d8['status'](_0x419c0b)['end']();};}function respondWithResult(_0x987a13,_0x5b9c4a){_0x5b9c4a=_0x5b9c4a||0xc8;return function(_0x3c035d){if(_0x3c035d){return _0x987a13[_0x70b3('0x1a')](_0x5b9c4a)[_0x70b3('0x1b')](_0x3c035d);}};}function respondWithFilteredResult(_0x28d356,_0x357a7a){return function(_0x42bcd2){if(_0x42bcd2){var _0x182819=_0x42bcd2[_0x70b3('0x1c')],_0x33acbd=_0x357a7a[_0x70b3('0x1d')],_0x363007=_0x357a7a[_0x70b3('0x1d')]+_0x357a7a['limit'],_0x58cf8f;if(_0x363007>=_0x182819){_0x363007=_0x182819;_0x58cf8f=0xc8;}else{_0x58cf8f=0xce;}_0x28d356[_0x70b3('0x1a')](_0x58cf8f);return _0x28d356[_0x70b3('0x1e')](_0x70b3('0x1f'),_0x33acbd+'-'+_0x363007+'/'+_0x182819)['json'](_0x42bcd2);}return null;};}function patchUpdates(_0x4cedc3){return function(_0x4b512f){try{jsonpatch[_0x70b3('0x20')](_0x4b512f,_0x4cedc3,!![]);}catch(_0x50189b){return BPromise['reject'](_0x50189b);}return _0x4b512f[_0x70b3('0x21')]();};}function saveUpdates(_0x38fbba,_0x22db68){return function(_0x4cf2c3){if(_0x4cf2c3){return _0x4cf2c3[_0x70b3('0x22')](_0x38fbba)[_0x70b3('0x23')](function(_0x29cfcf){return _0x29cfcf;});}return null;};}function removeEntity(_0x23c7f6,_0x37ee57){return function(_0x183481){if(_0x183481){return _0x183481['destroy']()[_0x70b3('0x23')](function(){_0x23c7f6[_0x70b3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54e284,_0x336d7d){return function(_0xa530ab){if(!_0xa530ab){_0x54e284[_0x70b3('0x19')](0x194);}return _0xa530ab;};}function handleError(_0x1f0227,_0x4f15d3){_0x4f15d3=_0x4f15d3||0x1f4;return function(_0x530d7d){logger[_0x70b3('0x24')](_0x530d7d[_0x70b3('0x25')]);if(_0x530d7d[_0x70b3('0x26')]){delete _0x530d7d['name'];}_0x1f0227[_0x70b3('0x1a')](_0x4f15d3)[_0x70b3('0x27')](_0x530d7d);};}exports[_0x70b3('0x28')]=function(_0x10f83f,_0x26b2b3){var _0x44a25f={},_0x1c1fc0={},_0x4ed57b={'count':0x0,'rows':[]};var _0x14b6a5=_[_0x70b3('0x29')](db[_0x70b3('0x2a')][_0x70b3('0x2b')],function(_0x530ce5){return{'name':_0x530ce5[_0x70b3('0x2c')],'type':_0x530ce5[_0x70b3('0x2d')][_0x70b3('0x2e')]};});_0x1c1fc0['model']=_[_0x70b3('0x29')](_0x14b6a5,'name');_0x1c1fc0[_0x70b3('0x2f')]=_['keys'](_0x10f83f[_0x70b3('0x2f')]);_0x1c1fc0[_0x70b3('0x30')]=_[_0x70b3('0x31')](_0x1c1fc0[_0x70b3('0x32')],_0x1c1fc0['query']);_0x44a25f['attributes']=_[_0x70b3('0x31')](_0x1c1fc0[_0x70b3('0x32')],qs['fields'](_0x10f83f[_0x70b3('0x2f')][_0x70b3('0x33')]));_0x44a25f[_0x70b3('0x34')]=_0x44a25f[_0x70b3('0x34')][_0x70b3('0x35')]?_0x44a25f[_0x70b3('0x34')]:_0x1c1fc0[_0x70b3('0x32')];if(!_0x10f83f[_0x70b3('0x2f')][_0x70b3('0x36')]('nolimit')){_0x44a25f['limit']=qs['limit'](_0x10f83f['query'][_0x70b3('0x37')]);_0x44a25f[_0x70b3('0x1d')]=qs[_0x70b3('0x1d')](_0x10f83f[_0x70b3('0x2f')][_0x70b3('0x1d')]);}_0x44a25f[_0x70b3('0x38')]=qs[_0x70b3('0x39')](_0x10f83f['query']['sort']);_0x44a25f[_0x70b3('0x3a')]=qs[_0x70b3('0x30')](_['pick'](_0x10f83f[_0x70b3('0x2f')],_0x1c1fc0[_0x70b3('0x30')]));if(_0x10f83f[_0x70b3('0x2f')][_0x70b3('0x3b')]){_0x44a25f[_0x70b3('0x3a')]=_['merge'](_0x44a25f[_0x70b3('0x3a')],{'$or':_[_0x70b3('0x29')](_0x14b6a5,function(_0x5c2b93){if(_0x5c2b93[_0x70b3('0x2d')]!==_0x70b3('0x3c')){var _0x49e1d6={};_0x49e1d6[_0x5c2b93[_0x70b3('0x26')]]={'$like':'%'+_0x10f83f[_0x70b3('0x2f')]['filter']+'%'};return _0x49e1d6;}})});}_0x44a25f=_[_0x70b3('0x3d')]({},_0x44a25f,_0x10f83f[_0x70b3('0x3e')]);var _0x5d16bf={'where':_0x44a25f[_0x70b3('0x3a')]};return db[_0x70b3('0x2a')]['count'](_0x5d16bf)['then'](function(_0x3a16c9){_0x4ed57b[_0x70b3('0x1c')]=_0x3a16c9;if(_0x10f83f[_0x70b3('0x2f')][_0x70b3('0x3f')]){_0x44a25f[_0x70b3('0x40')]=[{'all':!![]}];}return db['SquareMessage'][_0x70b3('0x41')](_0x44a25f);})[_0x70b3('0x23')](function(_0x2351fb){_0x4ed57b[_0x70b3('0x42')]=_0x2351fb;return _0x4ed57b;})[_0x70b3('0x23')](respondWithFilteredResult(_0x26b2b3,_0x44a25f))[_0x70b3('0x43')](handleError(_0x26b2b3,null));};exports['show']=function(_0x3ceb5a,_0x4cbcb4){var _0x56a88e={'raw':!![],'where':{'id':_0x3ceb5a[_0x70b3('0x44')]['id']}},_0x49f6b6={};_0x49f6b6[_0x70b3('0x32')]=_['keys'](db[_0x70b3('0x2a')][_0x70b3('0x2b')]);_0x49f6b6[_0x70b3('0x2f')]=_['keys'](_0x3ceb5a[_0x70b3('0x2f')]);_0x49f6b6['filters']=_['intersection'](_0x49f6b6[_0x70b3('0x32')],_0x49f6b6[_0x70b3('0x2f')]);_0x56a88e[_0x70b3('0x34')]=_['intersection'](_0x49f6b6[_0x70b3('0x32')],qs[_0x70b3('0x33')](_0x3ceb5a[_0x70b3('0x2f')][_0x70b3('0x33')]));_0x56a88e['attributes']=_0x56a88e[_0x70b3('0x34')][_0x70b3('0x35')]?_0x56a88e[_0x70b3('0x34')]:_0x49f6b6[_0x70b3('0x32')];if(_0x3ceb5a[_0x70b3('0x2f')]['includeAll']){_0x56a88e[_0x70b3('0x40')]=[{'all':!![]}];}_0x56a88e=_['merge']({},_0x56a88e,_0x3ceb5a[_0x70b3('0x3e')]);return db[_0x70b3('0x2a')]['find'](_0x56a88e)[_0x70b3('0x23')](handleEntityNotFound(_0x4cbcb4,null))['then'](respondWithResult(_0x4cbcb4,null))[_0x70b3('0x43')](handleError(_0x4cbcb4,null));};exports[_0x70b3('0x45')]=function(_0x2afb35,_0x1e9482){return db[_0x70b3('0x2a')]['create'](_0x2afb35[_0x70b3('0x46')],{})[_0x70b3('0x23')](respondWithResult(_0x1e9482,0xc9))[_0x70b3('0x43')](handleError(_0x1e9482,null));};exports[_0x70b3('0x22')]=function(_0x361e15,_0x44b6ab){if(_0x361e15[_0x70b3('0x46')]['id']){delete _0x361e15[_0x70b3('0x46')]['id'];}return db[_0x70b3('0x2a')][_0x70b3('0x47')]({'where':{'id':_0x361e15[_0x70b3('0x44')]['id']}})[_0x70b3('0x23')](handleEntityNotFound(_0x44b6ab,null))[_0x70b3('0x23')](saveUpdates(_0x361e15[_0x70b3('0x46')],null))[_0x70b3('0x23')](respondWithResult(_0x44b6ab,null))[_0x70b3('0x43')](handleError(_0x44b6ab,null));};exports['destroy']=function(_0x2aedd0,_0xfb50aa){return db[_0x70b3('0x2a')][_0x70b3('0x47')]({'where':{'id':_0x2aedd0[_0x70b3('0x44')]['id']}})[_0x70b3('0x23')](handleEntityNotFound(_0xfb50aa,null))[_0x70b3('0x23')](removeEntity(_0xfb50aa,null))[_0x70b3('0x43')](handleError(_0xfb50aa,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index f90cf2d..36b3301 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 _0xa5d7=['bluebird','request-promise','rimraf','./squareMessage.attributes','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa5d7,0x67));var _0x7a5d=function(_0x209d13,_0x2a48b3){_0x209d13=_0x209d13-0x0;var _0x3e3b59=_0xa5d7[_0x209d13];return _0x3e3b59;};'use strict';var _=require(_0x7a5d('0x0'));var util=require(_0x7a5d('0x1'));var logger=require(_0x7a5d('0x2'))(_0x7a5d('0x3'));var moment=require(_0x7a5d('0x4'));var BPromise=require(_0x7a5d('0x5'));var rp=require(_0x7a5d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7a5d('0x7'));var config=require('../../config/environment');var attributes=require(_0x7a5d('0x8'));module['exports']=function(_0x3b6084,_0x57785e){return _0x3b6084[_0x7a5d('0x9')](_0x7a5d('0xa'),attributes,{'tableName':_0x7a5d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x86aa=['path','../../config/environment','./squareMessage.attributes','define','SquareMessage','lodash','util','api','moment','request-promise'];(function(_0x594879,_0x630f04){var _0x3e8937=function(_0x2c2d69){while(--_0x2c2d69){_0x594879['push'](_0x594879['shift']());}};_0x3e8937(++_0x630f04);}(_0x86aa,0x73));var _0xa86a=function(_0xc7d96f,_0x1cb824){_0xc7d96f=_0xc7d96f-0x0;var _0x5b21d8=_0x86aa[_0xc7d96f];return _0x5b21d8;};'use strict';var _=require(_0xa86a('0x0'));var util=require(_0xa86a('0x1'));var logger=require('../../config/logger')(_0xa86a('0x2'));var moment=require(_0xa86a('0x3'));var BPromise=require('bluebird');var rp=require(_0xa86a('0x4'));var fs=require('fs');var path=require(_0xa86a('0x5'));var rimraf=require('rimraf');var config=require(_0xa86a('0x6'));var attributes=require(_0xa86a('0x7'));module['exports']=function(_0x1d0c37,_0x2b1d72){return _0x1d0c37[_0xa86a('0x8')](_0xa86a('0x9'),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 100d581..5dbdea2 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 _0xaf11=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','body','options','raw','then','lodash','util','moment','bluebird','ioredis'];(function(_0xe78c88,_0x2ec39a){var _0x5c226d=function(_0x5b41cb){while(--_0x5b41cb){_0xe78c88['push'](_0xe78c88['shift']());}};_0x5c226d(++_0x2ec39a);}(_0xaf11,0x12f));var _0x1af1=function(_0x24bc10,_0x266e36){_0x24bc10=_0x24bc10-0x0;var _0x1bbcfd=_0xaf11[_0x24bc10];return _0x1bbcfd;};'use strict';var _=require(_0x1af1('0x0'));var util=require(_0x1af1('0x1'));var moment=require(_0x1af1('0x2'));var BPromise=require(_0x1af1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1af1('0x4'));var db=require(_0x1af1('0x5'))['db'];var utils=require(_0x1af1('0x6'));var logger=require('../../config/logger')(_0x1af1('0x7'));var config=require(_0x1af1('0x8'));var jayson=require(_0x1af1('0x9'));var client=jayson['client'][_0x1af1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5dbe9d,_0x20ba8b,_0x26d917){return new BPromise(function(_0x48b286,_0x260799){return client['request'](_0x5dbe9d,_0x26d917)['then'](function(_0x2d8327){logger[_0x1af1('0xb')](_0x1af1('0xc'),_0x20ba8b,_0x1af1('0xd'));logger[_0x1af1('0xe')](_0x1af1('0xf'),_0x20ba8b,'request\x20sent',JSON[_0x1af1('0x10')](_0x2d8327));if(_0x2d8327[_0x1af1('0x11')]){if(_0x2d8327[_0x1af1('0x11')][_0x1af1('0x12')]===0x1f4){logger[_0x1af1('0x11')](_0x1af1('0xc'),_0x20ba8b,_0x2d8327[_0x1af1('0x11')]['message']);return _0x260799(_0x2d8327[_0x1af1('0x11')][_0x1af1('0x13')]);}logger[_0x1af1('0x11')](_0x1af1('0xc'),_0x20ba8b,_0x2d8327['error'][_0x1af1('0x13')]);return _0x48b286(_0x2d8327[_0x1af1('0x11')][_0x1af1('0x13')]);}else{logger['info'](_0x1af1('0xc'),_0x20ba8b,_0x1af1('0xd'));_0x48b286(_0x2d8327[_0x1af1('0x14')][_0x1af1('0x13')]);}})[_0x1af1('0x15')](function(_0x359eaf){logger[_0x1af1('0x11')](_0x1af1('0xc'),_0x20ba8b,_0x359eaf);_0x260799(_0x359eaf);});});}exports[_0x1af1('0x16')]=function(_0x20c17b){var _0x52c11b=this;return new Promise(function(_0x4da591,_0x54d2d7){return db[_0x1af1('0x17')]['create'](_0x20c17b[_0x1af1('0x18')],{'raw':_0x20c17b[_0x1af1('0x19')]?_0x20c17b[_0x1af1('0x19')][_0x1af1('0x1a')]===undefined?!![]:![]:!![]})[_0x1af1('0x1b')](function(_0x5d336){logger['info'](_0x1af1('0x16'),_0x20c17b);logger[_0x1af1('0xe')](_0x1af1('0x16'),_0x20c17b,JSON['stringify'](_0x5d336));_0x4da591(_0x5d336);})[_0x1af1('0x15')](function(_0xca2e20){logger['error'](_0x1af1('0x16'),_0xca2e20[_0x1af1('0x13')],_0x20c17b);_0x54d2d7(_0x52c11b[_0x1af1('0x11')](0x1f4,_0xca2e20['message']));});});}; \ No newline at end of file +var _0x81d4=['moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','result','SquareMessage','body','options','CreateSquareMessage','catch','util'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0x81d4,0x197));var _0x481d=function(_0x19b2a8,_0x4eea6a){_0x19b2a8=_0x19b2a8-0x0;var _0x482f2c=_0x81d4[_0x19b2a8];return _0x482f2c;};'use strict';var _=require('lodash');var util=require(_0x481d('0x0'));var moment=require(_0x481d('0x1'));var BPromise=require('bluebird');var rs=require(_0x481d('0x2'));var fs=require('fs');var Redis=require(_0x481d('0x3'));var db=require(_0x481d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x481d('0x5'));var config=require(_0x481d('0x6'));var jayson=require(_0x481d('0x7'));var client=jayson['client'][_0x481d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x17d32a,_0x2f91fd,_0x271b33){return new BPromise(function(_0x1d9263,_0x25adbb){return client['request'](_0x17d32a,_0x271b33)[_0x481d('0x9')](function(_0x1cf758){logger[_0x481d('0xa')]('SquareMessage,\x20%s,\x20%s',_0x2f91fd,_0x481d('0xb'));logger[_0x481d('0xc')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x2f91fd,_0x481d('0xb'),JSON[_0x481d('0xd')](_0x1cf758));if(_0x1cf758[_0x481d('0xe')]){if(_0x1cf758[_0x481d('0xe')][_0x481d('0xf')]===0x1f4){logger[_0x481d('0xe')](_0x481d('0x10'),_0x2f91fd,_0x1cf758['error'][_0x481d('0x11')]);return _0x25adbb(_0x1cf758['error']['message']);}logger[_0x481d('0xe')](_0x481d('0x10'),_0x2f91fd,_0x1cf758[_0x481d('0xe')]['message']);return _0x1d9263(_0x1cf758[_0x481d('0xe')]['message']);}else{logger[_0x481d('0xa')](_0x481d('0x10'),_0x2f91fd,_0x481d('0xb'));_0x1d9263(_0x1cf758[_0x481d('0x12')][_0x481d('0x11')]);}})['catch'](function(_0x63b8c1){logger[_0x481d('0xe')](_0x481d('0x10'),_0x2f91fd,_0x63b8c1);_0x25adbb(_0x63b8c1);});});}exports['CreateSquareMessage']=function(_0x21e2a5){var _0x5056c7=this;return new Promise(function(_0x3ef7c6,_0x534a99){return db[_0x481d('0x13')]['create'](_0x21e2a5[_0x481d('0x14')],{'raw':_0x21e2a5['options']?_0x21e2a5[_0x481d('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x481d('0x9')](function(_0x41a4de){logger['info'](_0x481d('0x16'),_0x21e2a5);logger[_0x481d('0xc')](_0x481d('0x16'),_0x21e2a5,JSON['stringify'](_0x41a4de));_0x3ef7c6(_0x41a4de);})[_0x481d('0x17')](function(_0x4ab1e8){logger['error']('CreateSquareMessage',_0x4ab1e8[_0x481d('0x11')],_0x21e2a5);_0x534a99(_0x5056c7['error'](0x1f4,_0x4ab1e8['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 4e52b1a..2ec6572 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 _0x10be=['get','index','/:id','isAuthenticated','show','/:id/test','test','post','create','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./squareOdbc.controller'];(function(_0x41d15a,_0x129763){var _0x36a469=function(_0x7fa686){while(--_0x7fa686){_0x41d15a['push'](_0x41d15a['shift']());}};_0x36a469(++_0x129763);}(_0x10be,0x161));var _0xe10b=function(_0x416e89,_0x117957){_0x416e89=_0x416e89-0x0;var _0x31e5c5=_0x10be[_0x416e89];return _0x31e5c5;};'use strict';var multer=require(_0xe10b('0x0'));var util=require('util');var path=require(_0xe10b('0x1'));var timeout=require(_0xe10b('0x2'));var express=require('express');var router=express[_0xe10b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xe10b('0x4'));var config=require(_0xe10b('0x5'));var controller=require(_0xe10b('0x6'));router[_0xe10b('0x7')]('/',auth['isAuthenticated'](),controller[_0xe10b('0x8')]);router[_0xe10b('0x7')](_0xe10b('0x9'),auth[_0xe10b('0xa')](),controller[_0xe10b('0xb')]);router[_0xe10b('0x7')](_0xe10b('0xc'),auth[_0xe10b('0xa')](),timeout('15s'),controller[_0xe10b('0xd')]);router[_0xe10b('0xe')]('/',auth[_0xe10b('0xa')](),controller[_0xe10b('0xf')]);router['put'](_0xe10b('0x9'),auth[_0xe10b('0xa')](),controller[_0xe10b('0x10')]);router[_0xe10b('0x11')]('/:id',auth[_0xe10b('0xa')](),controller[_0xe10b('0x12')]);module[_0xe10b('0x13')]=router; \ No newline at end of file +var _0x5620=['path','connect-timeout','../../components/interaction/service','./squareOdbc.controller','isAuthenticated','index','get','/:id','show','test','post','create','put','update','delete','multer'];(function(_0x2b91cd,_0x30b99f){var _0x4b6db4=function(_0x5b582f){while(--_0x5b582f){_0x2b91cd['push'](_0x2b91cd['shift']());}};_0x4b6db4(++_0x30b99f);}(_0x5620,0xbf));var _0x0562=function(_0x18ea8a,_0x32f09f){_0x18ea8a=_0x18ea8a-0x0;var _0x19c99a=_0x5620[_0x18ea8a];return _0x19c99a;};'use strict';var multer=require(_0x0562('0x0'));var util=require('util');var path=require(_0x0562('0x1'));var timeout=require(_0x0562('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0562('0x3'));var config=require('../../config/environment');var controller=require(_0x0562('0x4'));router['get']('/',auth[_0x0562('0x5')](),controller[_0x0562('0x6')]);router[_0x0562('0x7')](_0x0562('0x8'),auth[_0x0562('0x5')](),controller[_0x0562('0x9')]);router['get']('/:id/test',auth[_0x0562('0x5')](),timeout('15s'),controller[_0x0562('0xa')]);router[_0x0562('0xb')]('/',auth[_0x0562('0x5')](),controller[_0x0562('0xc')]);router[_0x0562('0xd')]('/:id',auth[_0x0562('0x5')](),controller[_0x0562('0xe')]);router[_0x0562('0xf')](_0x0562('0x8'),auth[_0x0562('0x5')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index d37f9c3..3b69662 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 _0xab47=['STRING','name','exports'];(function(_0x53034d,_0xcb5b){var _0x4f925b=function(_0x5f4832){while(--_0x5f4832){_0x53034d['push'](_0x53034d['shift']());}};_0x4f925b(++_0xcb5b);}(_0xab47,0x113));var _0x7ab4=function(_0x2338fa,_0x80579a){_0x2338fa=_0x2338fa-0x0;var _0x42df9b=_0xab47[_0x2338fa];return _0x42df9b;};'use strict';var Sequelize=require('sequelize');module[_0x7ab4('0x0')]={'name':{'type':Sequelize[_0x7ab4('0x1')],'unique':_0x7ab4('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7ab4('0x1')]}}; \ No newline at end of file +var _0xdc4e=['sequelize','STRING','name'];(function(_0x3b2c8e,_0x53910b){var _0x3ebe3d=function(_0x57220b){while(--_0x57220b){_0x3b2c8e['push'](_0x3b2c8e['shift']());}};_0x3ebe3d(++_0x53910b);}(_0xdc4e,0xf3));var _0xedc4=function(_0x4458a2,_0x288e43){_0x4458a2=_0x4458a2-0x0;var _0x52dc0e=_0xdc4e[_0x4458a2];return _0x52dc0e;};'use strict';var Sequelize=require(_0xedc4('0x0'));module['exports']={'name':{'type':Sequelize[_0xedc4('0x1')],'unique':_0xedc4('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xedc4('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 7dc5449..6e55433 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 _0x1213=['find','userProfileId','params','dsn','closeSync','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','error','stack','name','send','index','map','SquareOdbc','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x51d6d5,_0x482724){var _0x34b11e=function(_0x3bf6f8){while(--_0x3bf6f8){_0x51d6d5['push'](_0x51d6d5['shift']());}};_0x34b11e(++_0x482724);}(_0x1213,0x9f));var _0x3121=function(_0x5550b3,_0x2d0ee0){_0x5550b3=_0x5550b3-0x0;var _0x4b8fc4=_0x1213[_0x5550b3];return _0x4b8fc4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3121('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3121('0x1'));var rp=require(_0x3121('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3121('0x3'));var util=require(_0x3121('0x4'));var path=require(_0x3121('0x5'));var sox=require(_0x3121('0x6'));var csv=require(_0x3121('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3121('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3121('0x9'));var Redis=require(_0x3121('0xa'));var authService=require(_0x3121('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0x3121('0xc'));var hardwareService=require(_0x3121('0xd'));var logger=require(_0x3121('0xe'))('api');var utils=require('../../config/utils');var config=require(_0x3121('0xf'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x451431,_0x15ac99){_0x15ac99=_0x15ac99||0xcc;return function(_0x11a500){if(_0x11a500){return _0x451431[_0x3121('0x10')](_0x15ac99);}return _0x451431[_0x3121('0x11')](_0x15ac99)[_0x3121('0x12')]();};}function respondWithResult(_0x1ac58f,_0x13b6e6){_0x13b6e6=_0x13b6e6||0xc8;return function(_0x3f067b){if(_0x3f067b){return _0x1ac58f['status'](_0x13b6e6)['json'](_0x3f067b);}};}function respondWithFilteredResult(_0x42f117,_0x5621b3){return function(_0x5c0350){if(_0x5c0350){var _0x133e1d=_0x5c0350[_0x3121('0x13')],_0x3de2db=_0x5621b3[_0x3121('0x14')],_0x43ae67=_0x5621b3[_0x3121('0x14')]+_0x5621b3['limit'],_0x46f9cb;if(_0x43ae67>=_0x133e1d){_0x43ae67=_0x133e1d;_0x46f9cb=0xc8;}else{_0x46f9cb=0xce;}_0x42f117['status'](_0x46f9cb);return _0x42f117[_0x3121('0x15')](_0x3121('0x16'),_0x3de2db+'-'+_0x43ae67+'/'+_0x133e1d)[_0x3121('0x17')](_0x5c0350);}return null;};}function patchUpdates(_0x42688f){return function(_0xcf04cd){try{jsonpatch[_0x3121('0x18')](_0xcf04cd,_0x42688f,!![]);}catch(_0x2d6861){return BPromise[_0x3121('0x19')](_0x2d6861);}return _0xcf04cd[_0x3121('0x1a')]();};}function saveUpdates(_0x41f44f,_0x53a464){return function(_0x5e3c1a){if(_0x5e3c1a){return _0x5e3c1a[_0x3121('0x1b')](_0x41f44f)[_0x3121('0x1c')](function(_0x51bcb1){return _0x51bcb1;});}return null;};}function removeEntity(_0x7fdc05,_0xf665b9){return function(_0x230bee){if(_0x230bee){return _0x230bee[_0x3121('0x1d')]()['then'](function(){var _0x5c16a4=_0x230bee[_0x3121('0x1e')]({'plain':!![]});var _0x32ab30=_0x3121('0x1f');return db[_0x3121('0x20')][_0x3121('0x1d')]({'where':{'type':_0x32ab30,'resourceId':_0x5c16a4['id']}})[_0x3121('0x1c')](function(){return _0x230bee;});})[_0x3121('0x1c')](function(){_0x7fdc05[_0x3121('0x11')](0xcc)[_0x3121('0x12')]();});}};}function handleEntityNotFound(_0x4c3f45,_0x340963){return function(_0xbdcab4){if(!_0xbdcab4){_0x4c3f45[_0x3121('0x10')](0x194);}return _0xbdcab4;};}function handleError(_0x2cde53,_0x5d4db6){_0x5d4db6=_0x5d4db6||0x1f4;return function(_0x42b748){logger[_0x3121('0x21')](_0x42b748[_0x3121('0x22')]);if(_0x42b748[_0x3121('0x23')]){delete _0x42b748['name'];}_0x2cde53[_0x3121('0x11')](_0x5d4db6)[_0x3121('0x24')](_0x42b748);};}exports[_0x3121('0x25')]=function(_0x26a98b,_0x47ae07){var _0x12bd3f={},_0x50c5d8={},_0x3cb545={'count':0x0,'rows':[]};var _0x3a5cca=_[_0x3121('0x26')](db[_0x3121('0x27')]['rawAttributes'],function(_0x2a1526){return{'name':_0x2a1526[_0x3121('0x28')],'type':_0x2a1526['type'][_0x3121('0x29')]};});_0x50c5d8[_0x3121('0x2a')]=_['map'](_0x3a5cca,'name');_0x50c5d8[_0x3121('0x2b')]=_[_0x3121('0x2c')](_0x26a98b['query']);_0x50c5d8['filters']=_[_0x3121('0x2d')](_0x50c5d8[_0x3121('0x2a')],_0x50c5d8[_0x3121('0x2b')]);_0x12bd3f['attributes']=_[_0x3121('0x2d')](_0x50c5d8[_0x3121('0x2a')],qs[_0x3121('0x2e')](_0x26a98b[_0x3121('0x2b')][_0x3121('0x2e')]));_0x12bd3f['attributes']=_0x12bd3f[_0x3121('0x2f')][_0x3121('0x30')]?_0x12bd3f[_0x3121('0x2f')]:_0x50c5d8[_0x3121('0x2a')];if(!_0x26a98b[_0x3121('0x2b')][_0x3121('0x31')](_0x3121('0x32'))){_0x12bd3f[_0x3121('0x33')]=qs[_0x3121('0x33')](_0x26a98b[_0x3121('0x2b')][_0x3121('0x33')]);_0x12bd3f[_0x3121('0x14')]=qs[_0x3121('0x14')](_0x26a98b['query'][_0x3121('0x14')]);}_0x12bd3f['order']=qs[_0x3121('0x34')](_0x26a98b[_0x3121('0x2b')][_0x3121('0x34')]);_0x12bd3f['where']=qs[_0x3121('0x35')](_[_0x3121('0x36')](_0x26a98b[_0x3121('0x2b')],_0x50c5d8[_0x3121('0x35')]));if(_0x26a98b[_0x3121('0x2b')][_0x3121('0x37')]){_0x12bd3f[_0x3121('0x38')]=_[_0x3121('0x39')](_0x12bd3f[_0x3121('0x38')],{'$or':_[_0x3121('0x26')](_0x3a5cca,function(_0x236641){if(_0x236641['type']!==_0x3121('0x3a')){var _0x5d831a={};_0x5d831a[_0x236641[_0x3121('0x23')]]={'$like':'%'+_0x26a98b[_0x3121('0x2b')][_0x3121('0x37')]+'%'};return _0x5d831a;}})});}_0x12bd3f=_[_0x3121('0x39')]({},_0x12bd3f,_0x26a98b[_0x3121('0x3b')]);var _0x1a0b4b={'where':_0x12bd3f[_0x3121('0x38')]};return db[_0x3121('0x27')]['count'](_0x1a0b4b)[_0x3121('0x1c')](function(_0x7244b9){_0x3cb545['count']=_0x7244b9;if(_0x26a98b[_0x3121('0x2b')][_0x3121('0x3c')]){_0x12bd3f[_0x3121('0x3d')]=[{'all':!![]}];}return db[_0x3121('0x27')][_0x3121('0x3e')](_0x12bd3f);})[_0x3121('0x1c')](function(_0x367389){_0x3cb545[_0x3121('0x3f')]=_0x367389;return _0x3cb545;})[_0x3121('0x1c')](respondWithFilteredResult(_0x47ae07,_0x12bd3f))[_0x3121('0x40')](handleError(_0x47ae07,null));};exports['show']=function(_0x42a018,_0x56494e){var _0x3deb08={'raw':!![],'where':{'id':_0x42a018['params']['id']}},_0x1cc5de={};_0x1cc5de['model']=_[_0x3121('0x2c')](db['SquareOdbc'][_0x3121('0x41')]);_0x1cc5de['query']=_['keys'](_0x42a018[_0x3121('0x2b')]);_0x1cc5de[_0x3121('0x35')]=_[_0x3121('0x2d')](_0x1cc5de[_0x3121('0x2a')],_0x1cc5de[_0x3121('0x2b')]);_0x3deb08[_0x3121('0x2f')]=_['intersection'](_0x1cc5de[_0x3121('0x2a')],qs[_0x3121('0x2e')](_0x42a018[_0x3121('0x2b')]['fields']));_0x3deb08[_0x3121('0x2f')]=_0x3deb08[_0x3121('0x2f')][_0x3121('0x30')]?_0x3deb08[_0x3121('0x2f')]:_0x1cc5de['model'];if(_0x42a018[_0x3121('0x2b')][_0x3121('0x3c')]){_0x3deb08[_0x3121('0x3d')]=[{'all':!![]}];}_0x3deb08=_['merge']({},_0x3deb08,_0x42a018[_0x3121('0x3b')]);return db['SquareOdbc']['find'](_0x3deb08)['then'](handleEntityNotFound(_0x56494e,null))[_0x3121('0x1c')](respondWithResult(_0x56494e,null))[_0x3121('0x40')](handleError(_0x56494e,null));};exports[_0x3121('0x42')]=function(_0x54bd35,_0x1ac782){return db['SquareOdbc'][_0x3121('0x42')](_0x54bd35[_0x3121('0x43')],{})[_0x3121('0x1c')](function(_0x3bfbaf){var _0x3af118=_0x54bd35[_0x3121('0x44')]['get']({'plain':!![]});if(!_0x3af118)throw new Error(_0x3121('0x45'));if(_0x3af118[_0x3121('0x46')]===_0x3121('0x44')){var _0x17b2ff=_0x3bfbaf[_0x3121('0x1e')]({'plain':!![]});var _0x41b2d6=_0x3121('0x1f');return db[_0x3121('0x47')][_0x3121('0x48')]({'where':{'name':_0x41b2d6,'userProfileId':_0x3af118[_0x3121('0x49')]},'raw':!![]})[_0x3121('0x1c')](function(_0x34a625){if(_0x34a625&&_0x34a625['autoAssociation']===0x0){return db[_0x3121('0x20')][_0x3121('0x42')]({'name':_0x17b2ff[_0x3121('0x23')],'resourceId':_0x17b2ff['id'],'type':_0x34a625['name'],'sectionId':_0x34a625['id']},{})[_0x3121('0x1c')](function(){return _0x3bfbaf;});}else{return _0x3bfbaf;}})[_0x3121('0x40')](function(_0x461dee){logger[_0x3121('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x461dee);throw _0x461dee;});}return _0x3bfbaf;})[_0x3121('0x1c')](respondWithResult(_0x1ac782,0xc9))[_0x3121('0x40')](handleError(_0x1ac782,null));};exports[_0x3121('0x1b')]=function(_0x5f4664,_0x2c2be8){if(_0x5f4664[_0x3121('0x43')]['id']){delete _0x5f4664[_0x3121('0x43')]['id'];}return db[_0x3121('0x27')][_0x3121('0x48')]({'where':{'id':_0x5f4664[_0x3121('0x4a')]['id']}})[_0x3121('0x1c')](handleEntityNotFound(_0x2c2be8,null))['then'](saveUpdates(_0x5f4664[_0x3121('0x43')],null))[_0x3121('0x1c')](respondWithResult(_0x2c2be8,null))[_0x3121('0x40')](handleError(_0x2c2be8,null));};exports['destroy']=function(_0xc32492,_0x3946d1){return db[_0x3121('0x27')]['find']({'where':{'id':_0xc32492[_0x3121('0x4a')]['id']}})[_0x3121('0x1c')](handleEntityNotFound(_0x3946d1,null))[_0x3121('0x1c')](removeEntity(_0x3946d1,null))[_0x3121('0x40')](handleError(_0x3946d1,null));};exports['test']=function(_0x4b3e82,_0x37e533,_0x206ce3){var _0x1adeba;return db[_0x3121('0x27')][_0x3121('0x48')]({'where':{'id':_0x4b3e82[_0x3121('0x4a')]['id']},'attributes':['id',_0x3121('0x4b')]})[_0x3121('0x1c')](handleEntityNotFound(_0x37e533,null))[_0x3121('0x1c')](function(_0x191fec){if(_0x191fec){var _0x55cb6a=require('odbc')();_0x55cb6a['openSync'](_0x191fec[_0x3121('0x4b')]);_0x55cb6a[_0x3121('0x4c')]();return _0x191fec;}})['then'](respondWithResult(_0x37e533,null))[_0x3121('0x40')](handleError(_0x37e533,null));}; \ No newline at end of file +var _0xf034=['key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','userProfileId','test','odbc','openSync','dsn','closeSync','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','UserProfileResource','destroy','error','stack','name','send','index','SquareOdbc','fieldName'];(function(_0x4694d9,_0x4b935b){var _0x370f3f=function(_0x5e4cc5){while(--_0x5e4cc5){_0x4694d9['push'](_0x4694d9['shift']());}};_0x370f3f(++_0x4b935b);}(_0xf034,0xd0));var _0x4f03=function(_0x5a58c,_0xd87e09){_0x5a58c=_0x5a58c-0x0;var _0x415cd7=_0xf034[_0x5a58c];return _0x415cd7;};'use strict';var pdf=require(_0x4f03('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4f03('0x1'));var zipdir=require(_0x4f03('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4f03('0x3'));var BPromise=require(_0x4f03('0x4'));var Mustache=require(_0x4f03('0x5'));var util=require(_0x4f03('0x6'));var path=require(_0x4f03('0x7'));var sox=require(_0x4f03('0x8'));var csv=require('to-csv');var ejs=require(_0x4f03('0x9'));var fs=require('fs');var _=require(_0x4f03('0xa'));var squel=require(_0x4f03('0xb'));var crypto=require(_0x4f03('0xc'));var jsforce=require(_0x4f03('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4f03('0xe'));var querystring=require(_0x4f03('0xf'));var Papa=require(_0x4f03('0x10'));var Redis=require(_0x4f03('0x11'));var authService=require(_0x4f03('0x12'));var qs=require(_0x4f03('0x13'));var as=require(_0x4f03('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f03('0x15'))(_0x4f03('0x16'));var utils=require(_0x4f03('0x17'));var config=require(_0x4f03('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x345ac,_0x49db58){_0x49db58=_0x49db58||0xcc;return function(_0x3c4166){if(_0x3c4166){return _0x345ac[_0x4f03('0x19')](_0x49db58);}return _0x345ac[_0x4f03('0x1a')](_0x49db58)[_0x4f03('0x1b')]();};}function respondWithResult(_0x719ea7,_0x3750cd){_0x3750cd=_0x3750cd||0xc8;return function(_0x299a61){if(_0x299a61){return _0x719ea7[_0x4f03('0x1a')](_0x3750cd)[_0x4f03('0x1c')](_0x299a61);}};}function respondWithFilteredResult(_0x57d7a2,_0x17ccf0){return function(_0x139c6c){if(_0x139c6c){var _0x1d9c75=_0x139c6c[_0x4f03('0x1d')],_0x205f9c=_0x17ccf0[_0x4f03('0x1e')],_0x5e54f8=_0x17ccf0[_0x4f03('0x1e')]+_0x17ccf0[_0x4f03('0x1f')],_0x35ea5b;if(_0x5e54f8>=_0x1d9c75){_0x5e54f8=_0x1d9c75;_0x35ea5b=0xc8;}else{_0x35ea5b=0xce;}_0x57d7a2['status'](_0x35ea5b);return _0x57d7a2[_0x4f03('0x20')](_0x4f03('0x21'),_0x205f9c+'-'+_0x5e54f8+'/'+_0x1d9c75)[_0x4f03('0x1c')](_0x139c6c);}return null;};}function patchUpdates(_0x1f59ae){return function(_0x2f5f16){try{jsonpatch['apply'](_0x2f5f16,_0x1f59ae,!![]);}catch(_0x172ebd){return BPromise[_0x4f03('0x22')](_0x172ebd);}return _0x2f5f16[_0x4f03('0x23')]();};}function saveUpdates(_0x1ba6a3,_0x29dcf6){return function(_0x249d99){if(_0x249d99){return _0x249d99[_0x4f03('0x24')](_0x1ba6a3)[_0x4f03('0x25')](function(_0x39a227){return _0x39a227;});}return null;};}function removeEntity(_0x91fa8f,_0x98b09){return function(_0x3f199f){if(_0x3f199f){return _0x3f199f['destroy']()[_0x4f03('0x25')](function(){var _0xb08ce8=_0x3f199f['get']({'plain':!![]});var _0x4081ba='ODBC';return db[_0x4f03('0x26')][_0x4f03('0x27')]({'where':{'type':_0x4081ba,'resourceId':_0xb08ce8['id']}})[_0x4f03('0x25')](function(){return _0x3f199f;});})['then'](function(){_0x91fa8f[_0x4f03('0x1a')](0xcc)[_0x4f03('0x1b')]();});}};}function handleEntityNotFound(_0x42cb64,_0x237e4f){return function(_0x1eba25){if(!_0x1eba25){_0x42cb64[_0x4f03('0x19')](0x194);}return _0x1eba25;};}function handleError(_0x3aa2ee,_0x504b6b){_0x504b6b=_0x504b6b||0x1f4;return function(_0x285e34){logger[_0x4f03('0x28')](_0x285e34[_0x4f03('0x29')]);if(_0x285e34[_0x4f03('0x2a')]){delete _0x285e34['name'];}_0x3aa2ee[_0x4f03('0x1a')](_0x504b6b)[_0x4f03('0x2b')](_0x285e34);};}exports[_0x4f03('0x2c')]=function(_0x324fb5,_0x3d9140){var _0x58ac7c={},_0x4795f7={},_0x78bf54={'count':0x0,'rows':[]};var _0x7e91fb=_['map'](db[_0x4f03('0x2d')]['rawAttributes'],function(_0x137861){return{'name':_0x137861[_0x4f03('0x2e')],'type':_0x137861['type'][_0x4f03('0x2f')]};});_0x4795f7[_0x4f03('0x30')]=_[_0x4f03('0x31')](_0x7e91fb,_0x4f03('0x2a'));_0x4795f7[_0x4f03('0x32')]=_[_0x4f03('0x33')](_0x324fb5['query']);_0x4795f7[_0x4f03('0x34')]=_[_0x4f03('0x35')](_0x4795f7['model'],_0x4795f7[_0x4f03('0x32')]);_0x58ac7c[_0x4f03('0x36')]=_[_0x4f03('0x35')](_0x4795f7['model'],qs[_0x4f03('0x37')](_0x324fb5['query'][_0x4f03('0x37')]));_0x58ac7c[_0x4f03('0x36')]=_0x58ac7c[_0x4f03('0x36')]['length']?_0x58ac7c['attributes']:_0x4795f7[_0x4f03('0x30')];if(!_0x324fb5[_0x4f03('0x32')][_0x4f03('0x38')]('nolimit')){_0x58ac7c['limit']=qs['limit'](_0x324fb5[_0x4f03('0x32')][_0x4f03('0x1f')]);_0x58ac7c[_0x4f03('0x1e')]=qs[_0x4f03('0x1e')](_0x324fb5['query']['offset']);}_0x58ac7c['order']=qs['sort'](_0x324fb5[_0x4f03('0x32')]['sort']);_0x58ac7c['where']=qs['filters'](_[_0x4f03('0x39')](_0x324fb5['query'],_0x4795f7['filters']));if(_0x324fb5[_0x4f03('0x32')][_0x4f03('0x3a')]){_0x58ac7c['where']=_['merge'](_0x58ac7c[_0x4f03('0x3b')],{'$or':_[_0x4f03('0x31')](_0x7e91fb,function(_0x3fe515){if(_0x3fe515[_0x4f03('0x3c')]!==_0x4f03('0x3d')){var _0x531fde={};_0x531fde[_0x3fe515['name']]={'$like':'%'+_0x324fb5[_0x4f03('0x32')]['filter']+'%'};return _0x531fde;}})});}_0x58ac7c=_[_0x4f03('0x3e')]({},_0x58ac7c,_0x324fb5[_0x4f03('0x3f')]);var _0x14d8c6={'where':_0x58ac7c[_0x4f03('0x3b')]};return db[_0x4f03('0x2d')][_0x4f03('0x1d')](_0x14d8c6)['then'](function(_0x562b9e){_0x78bf54[_0x4f03('0x1d')]=_0x562b9e;if(_0x324fb5[_0x4f03('0x32')][_0x4f03('0x40')]){_0x58ac7c[_0x4f03('0x41')]=[{'all':!![]}];}return db['SquareOdbc'][_0x4f03('0x42')](_0x58ac7c);})[_0x4f03('0x25')](function(_0xaf08e1){_0x78bf54[_0x4f03('0x43')]=_0xaf08e1;return _0x78bf54;})[_0x4f03('0x25')](respondWithFilteredResult(_0x3d9140,_0x58ac7c))['catch'](handleError(_0x3d9140,null));};exports['show']=function(_0x13981b,_0x34c712){var _0x3e2405={'raw':!![],'where':{'id':_0x13981b[_0x4f03('0x44')]['id']}},_0x38ad00={};_0x38ad00[_0x4f03('0x30')]=_[_0x4f03('0x33')](db[_0x4f03('0x2d')]['rawAttributes']);_0x38ad00[_0x4f03('0x32')]=_['keys'](_0x13981b['query']);_0x38ad00[_0x4f03('0x34')]=_['intersection'](_0x38ad00['model'],_0x38ad00['query']);_0x3e2405[_0x4f03('0x36')]=_[_0x4f03('0x35')](_0x38ad00[_0x4f03('0x30')],qs['fields'](_0x13981b[_0x4f03('0x32')][_0x4f03('0x37')]));_0x3e2405[_0x4f03('0x36')]=_0x3e2405[_0x4f03('0x36')]['length']?_0x3e2405[_0x4f03('0x36')]:_0x38ad00[_0x4f03('0x30')];if(_0x13981b[_0x4f03('0x32')][_0x4f03('0x40')]){_0x3e2405[_0x4f03('0x41')]=[{'all':!![]}];}_0x3e2405=_['merge']({},_0x3e2405,_0x13981b[_0x4f03('0x3f')]);return db[_0x4f03('0x2d')][_0x4f03('0x45')](_0x3e2405)['then'](handleEntityNotFound(_0x34c712,null))[_0x4f03('0x25')](respondWithResult(_0x34c712,null))[_0x4f03('0x46')](handleError(_0x34c712,null));};exports['create']=function(_0x143d7b,_0x40a7ad){return db['SquareOdbc'][_0x4f03('0x47')](_0x143d7b[_0x4f03('0x48')],{})[_0x4f03('0x25')](function(_0x267ea5){var _0xb57cfc=_0x143d7b[_0x4f03('0x49')][_0x4f03('0x4a')]({'plain':!![]});if(!_0xb57cfc)throw new Error(_0x4f03('0x4b'));if(_0xb57cfc[_0x4f03('0x4c')]==='user'){var _0xe7f516=_0x267ea5[_0x4f03('0x4a')]({'plain':!![]});var _0x596404=_0x4f03('0x4d');return db[_0x4f03('0x4e')][_0x4f03('0x45')]({'where':{'name':_0x596404,'userProfileId':_0xb57cfc[_0x4f03('0x4f')]},'raw':!![]})[_0x4f03('0x25')](function(_0x29ea45){if(_0x29ea45&&_0x29ea45['autoAssociation']===0x0){return db[_0x4f03('0x26')][_0x4f03('0x47')]({'name':_0xe7f516[_0x4f03('0x2a')],'resourceId':_0xe7f516['id'],'type':_0x29ea45[_0x4f03('0x2a')],'sectionId':_0x29ea45['id']},{})['then'](function(){return _0x267ea5;});}else{return _0x267ea5;}})[_0x4f03('0x46')](function(_0x5dce2a){logger[_0x4f03('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dce2a);throw _0x5dce2a;});}return _0x267ea5;})['then'](respondWithResult(_0x40a7ad,0xc9))[_0x4f03('0x46')](handleError(_0x40a7ad,null));};exports[_0x4f03('0x24')]=function(_0x89e11e,_0xe442d2){if(_0x89e11e['body']['id']){delete _0x89e11e[_0x4f03('0x48')]['id'];}return db[_0x4f03('0x2d')][_0x4f03('0x45')]({'where':{'id':_0x89e11e[_0x4f03('0x44')]['id']}})[_0x4f03('0x25')](handleEntityNotFound(_0xe442d2,null))[_0x4f03('0x25')](saveUpdates(_0x89e11e[_0x4f03('0x48')],null))['then'](respondWithResult(_0xe442d2,null))[_0x4f03('0x46')](handleError(_0xe442d2,null));};exports['destroy']=function(_0x6cc0e2,_0x11d268){return db[_0x4f03('0x2d')][_0x4f03('0x45')]({'where':{'id':_0x6cc0e2['params']['id']}})['then'](handleEntityNotFound(_0x11d268,null))[_0x4f03('0x25')](removeEntity(_0x11d268,null))[_0x4f03('0x46')](handleError(_0x11d268,null));};exports[_0x4f03('0x50')]=function(_0x34b914,_0x4930b0,_0x17133d){var _0x3b2ef0;return db[_0x4f03('0x2d')][_0x4f03('0x45')]({'where':{'id':_0x34b914[_0x4f03('0x44')]['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x4930b0,null))[_0x4f03('0x25')](function(_0x2cfed4){if(_0x2cfed4){var _0x34994e=require(_0x4f03('0x51'))();_0x34994e[_0x4f03('0x52')](_0x2cfed4[_0x4f03('0x53')]);_0x34994e[_0x4f03('0x54')]();return _0x2cfed4;}})[_0x4f03('0x25')](respondWithResult(_0x4930b0,null))[_0x4f03('0x46')](handleError(_0x4930b0,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 17c994e..b30652f 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 _0xcb1e=['lodash','moment','bluebird','request-promise','path','rimraf','define','square_odbc'];(function(_0x58ceb8,_0x13b01c){var _0x4517e1=function(_0x3088f7){while(--_0x3088f7){_0x58ceb8['push'](_0x58ceb8['shift']());}};_0x4517e1(++_0x13b01c);}(_0xcb1e,0x1b8));var _0xecb1=function(_0x265003,_0xf0f023){_0x265003=_0x265003-0x0;var _0x33c743=_0xcb1e[_0x265003];return _0x33c743;};'use strict';var _=require(_0xecb1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xecb1('0x1'));var BPromise=require(_0xecb1('0x2'));var rp=require(_0xecb1('0x3'));var fs=require('fs');var path=require(_0xecb1('0x4'));var rimraf=require(_0xecb1('0x5'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x15cde1,_0x551f50){return _0x15cde1[_0xecb1('0x6')]('SquareOdbc',attributes,{'tableName':_0xecb1('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a3e=['api','request-promise','path','rimraf','../../config/environment','exports','define','SquareOdbc','lodash','util','../../config/logger'];(function(_0x2cc38c,_0x53bd58){var _0x3a6039=function(_0x4c5ca3){while(--_0x4c5ca3){_0x2cc38c['push'](_0x2cc38c['shift']());}};_0x3a6039(++_0x53bd58);}(_0x1a3e,0xad));var _0xe1a3=function(_0x426da5,_0x242e46){_0x426da5=_0x426da5-0x0;var _0x3df7c6=_0x1a3e[_0x426da5];return _0x3df7c6;};'use strict';var _=require(_0xe1a3('0x0'));var util=require(_0xe1a3('0x1'));var logger=require(_0xe1a3('0x2'))(_0xe1a3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe1a3('0x4'));var fs=require('fs');var path=require(_0xe1a3('0x5'));var rimraf=require(_0xe1a3('0x6'));var config=require(_0xe1a3('0x7'));var attributes=require('./squareOdbc.attributes');module[_0xe1a3('0x8')]=function(_0x399c17,_0x3d706f){return _0x399c17[_0xe1a3('0x9')](_0xe1a3('0xa'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 48df6ec..48d9773 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','SquareOdbc,\x20%s,\x20%s','result','catch','ShowSquareOdbc','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x567ec0,_0x676a8e){var _0x109c75=function(_0x3087d5){while(--_0x3087d5){_0x567ec0['push'](_0x567ec0['shift']());}};_0x109c75(++_0x676a8e);}(_0x5fc3,0xa8));var _0x35fc=function(_0x48961c,_0x280e9d){_0x48961c=_0x48961c-0x0;var _0x1d895d=_0x5fc3[_0x48961c];return _0x1d895d;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['SquareOdbc'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file +var _0x3e74=['catch','SquareOdbc','find','options','raw','where','attributes','include','map','model','then','ShowSquareOdbc','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','SquareOdbc,\x20%s,\x20%s','message','info'];(function(_0x5d2a5d,_0x55d114){var _0x66550d=function(_0x9dcfb3){while(--_0x9dcfb3){_0x5d2a5d['push'](_0x5d2a5d['shift']());}};_0x66550d(++_0x55d114);}(_0x3e74,0x175));var _0x43e7=function(_0xddbe34,_0x2ce08e){_0xddbe34=_0xddbe34-0x0;var _0x4d312f=_0x3e74[_0xddbe34];return _0x4d312f;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowSquareOdbc']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 15bbe77..ae10ad6 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 _0xa5fa=['post','put','update','delete','removeUsers','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users'];(function(_0x38a34e,_0x42896c){var _0x94a171=function(_0x48e5db){while(--_0x48e5db){_0x38a34e['push'](_0x38a34e['shift']());}};_0x94a171(++_0x42896c);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x232715,_0x4bd63e){_0x232715=_0x232715-0x0;var _0x1e6090=_0xa5fa[_0x232715];return _0x1e6090;};'use strict';var multer=require('multer');var util=require(_0xaa5f('0x0'));var path=require(_0xaa5f('0x1'));var timeout=require(_0xaa5f('0x2'));var express=require(_0xaa5f('0x3'));var router=express['Router']();var auth=require(_0xaa5f('0x4'));var interaction=require(_0xaa5f('0x5'));var config=require('../../config/environment');var controller=require(_0xaa5f('0x6'));router[_0xaa5f('0x7')]('/',auth[_0xaa5f('0x8')](),controller[_0xaa5f('0x9')]);router[_0xaa5f('0x7')](_0xaa5f('0xa'),auth[_0xaa5f('0x8')](),controller[_0xaa5f('0xb')]);router[_0xaa5f('0x7')](_0xaa5f('0xc'),auth[_0xaa5f('0x8')](),controller['getUsers']);router[_0xaa5f('0xd')]('/',auth[_0xaa5f('0x8')](),controller['create']);router['post'](_0xaa5f('0xc'),auth['isAuthenticated'](),controller['addUsers']);router[_0xaa5f('0xe')]('/:id',auth[_0xaa5f('0x8')](),controller[_0xaa5f('0xf')]);router[_0xaa5f('0x10')](_0xaa5f('0xa'),auth[_0xaa5f('0x8')](),controller['destroy']);router[_0xaa5f('0x10')]('/:id/users',auth[_0xaa5f('0x8')](),controller[_0xaa5f('0x11')]);module[_0xaa5f('0x12')]=router; \ No newline at end of file +var _0x5423=['post','addUsers','put','update','delete','destroy','removeUsers','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','index','get','/:id','/:id/users'];(function(_0x3a8a05,_0x4df4e1){var _0x204721=function(_0xea1ec9){while(--_0xea1ec9){_0x3a8a05['push'](_0x3a8a05['shift']());}};_0x204721(++_0x4df4e1);}(_0x5423,0xe3));var _0x3542=function(_0x572a50,_0x44e294){_0x572a50=_0x572a50-0x0;var _0x25b39d=_0x5423[_0x572a50];return _0x25b39d;};'use strict';var multer=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var path=require('path');var timeout=require(_0x3542('0x2'));var express=require(_0x3542('0x3'));var router=express['Router']();var auth=require(_0x3542('0x4'));var interaction=require(_0x3542('0x5'));var config=require(_0x3542('0x6'));var controller=require(_0x3542('0x7'));router['get']('/',auth[_0x3542('0x8')](),controller[_0x3542('0x9')]);router[_0x3542('0xa')](_0x3542('0xb'),auth[_0x3542('0x8')](),controller['show']);router['get'](_0x3542('0xc'),auth[_0x3542('0x8')](),controller['getUsers']);router[_0x3542('0xd')]('/',auth[_0x3542('0x8')](),controller['create']);router[_0x3542('0xd')](_0x3542('0xc'),auth['isAuthenticated'](),controller[_0x3542('0xe')]);router[_0x3542('0xf')](_0x3542('0xb'),auth[_0x3542('0x8')](),controller[_0x3542('0x10')]);router[_0x3542('0x11')](_0x3542('0xb'),auth[_0x3542('0x8')](),controller[_0x3542('0x12')]);router[_0x3542('0x11')](_0x3542('0xc'),auth[_0x3542('0x8')](),controller[_0x3542('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 e64fae3..9ccff6a 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 _0x0074=['preproduction','toString','utf8','production','sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue'];(function(_0x723dc9,_0x2fd7bc){var _0x10cf0f=function(_0x1e8f7a){while(--_0x1e8f7a){_0x723dc9['push'](_0x723dc9['shift']());}};_0x10cf0f(++_0x2fd7bc);}(_0x0074,0x1c0));var _0x4007=function(_0x3de6bc,_0x519d8c){_0x3de6bc=_0x3de6bc-0x0;var _0x5f3ef6=_0x0074[_0x3de6bc];return _0x5f3ef6;};'use strict';var Sequelize=require(_0x4007('0x0'));module[_0x4007('0x1')]={'name':{'type':Sequelize[_0x4007('0x2')],'unique':_0x4007('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x4007('0x2')]},'notes':{'type':Sequelize[_0x4007('0x4')]},'preproduction':{'type':Sequelize[_0x4007('0x5')](_0x4007('0x6')),'get':function(){if(this[_0x4007('0x7')](_0x4007('0x8'))){return this[_0x4007('0x7')](_0x4007('0x8'))[_0x4007('0x9')](_0x4007('0xa'));}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x4007('0x7')](_0x4007('0xb'))){return this['getDataValue'](_0x4007('0xb'))['toString'](_0x4007('0xa'));}}}}; \ No newline at end of file +var _0xc509=['TEXT','BLOB','long','getDataValue','toString','utf8','production','sequelize','exports','name','STRING'];(function(_0x2a8d0f,_0x42983b){var _0xf4cc50=function(_0x15f048){while(--_0x15f048){_0x2a8d0f['push'](_0x2a8d0f['shift']());}};_0xf4cc50(++_0x42983b);}(_0xc509,0xc2));var _0x9c50=function(_0x33c61f,_0x3c2c7a){_0x33c61f=_0x33c61f-0x0;var _0x387396=_0xc509[_0x33c61f];return _0x387396;};'use strict';var Sequelize=require(_0x9c50('0x0'));module[_0x9c50('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9c50('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9c50('0x3')]},'notes':{'type':Sequelize[_0x9c50('0x4')]},'preproduction':{'type':Sequelize[_0x9c50('0x5')](_0x9c50('0x6')),'get':function(){if(this[_0x9c50('0x7')]('preproduction')){return this[_0x9c50('0x7')]('preproduction')[_0x9c50('0x8')](_0x9c50('0x9'));}}},'production':{'type':Sequelize[_0x9c50('0x5')](_0x9c50('0x6')),'get':function(){if(this[_0x9c50('0x7')](_0x9c50('0xa'))){return this[_0x9c50('0x7')]('production')['toString'](_0x9c50('0x9'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 6e69c89..1856210 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 _0xa75b=['getUsers','findOne','User','filter','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','register','status','end','json','count','offset','limit','save','update','then','get','SquareProjects','UserProfileResource','destroy','error','stack','name','send','index','map','SquareProject','fieldName','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','merge','type','VIRTUAL','includeAll','include','catch','show','params','rawAttributes','length','options','find','create','body','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0xa75b,0x170));var _0xba75=function(_0x63767,_0x3c85da){_0x63767=_0x63767-0x0;var _0x51cc04=_0xa75b[_0x63767];return _0x51cc04;};'use strict';var pdf=require(_0xba75('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xba75('0x1'));var jsonpatch=require(_0xba75('0x2'));var rp=require(_0xba75('0x3'));var moment=require(_0xba75('0x4'));var BPromise=require(_0xba75('0x5'));var Mustache=require(_0xba75('0x6'));var util=require(_0xba75('0x7'));var path=require(_0xba75('0x8'));var sox=require(_0xba75('0x9'));var csv=require(_0xba75('0xa'));var ejs=require(_0xba75('0xb'));var fs=require('fs');var _=require(_0xba75('0xc'));var squel=require(_0xba75('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xba75('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xba75('0xf'));var Redis=require('ioredis');var authService=require(_0xba75('0x10'));var qs=require(_0xba75('0x11'));var as=require(_0xba75('0x12'));var hardwareService=require(_0xba75('0x13'));var logger=require(_0xba75('0x14'))(_0xba75('0x15'));var utils=require(_0xba75('0x16'));var config=require(_0xba75('0x17'));var db=require(_0xba75('0x18'))['db'];config[_0xba75('0x19')]=_[_0xba75('0x1a')](config[_0xba75('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba75('0x19')]));require('./squareProject.socket')[_0xba75('0x1b')](socket);function respondWithStatusCode(_0x2df615,_0xa27f76){_0xa27f76=_0xa27f76||0xcc;return function(_0x383b1e){if(_0x383b1e){return _0x2df615['sendStatus'](_0xa27f76);}return _0x2df615[_0xba75('0x1c')](_0xa27f76)[_0xba75('0x1d')]();};}function respondWithResult(_0x256678,_0x4028f9){_0x4028f9=_0x4028f9||0xc8;return function(_0x41c9e5){if(_0x41c9e5){return _0x256678['status'](_0x4028f9)[_0xba75('0x1e')](_0x41c9e5);}};}function respondWithFilteredResult(_0x2bf023,_0x14bd83){return function(_0x47be93){if(_0x47be93){var _0x2822af=_0x47be93[_0xba75('0x1f')],_0xd8850f=_0x14bd83[_0xba75('0x20')],_0xc4bf17=_0x14bd83['offset']+_0x14bd83[_0xba75('0x21')],_0x132750;if(_0xc4bf17>=_0x2822af){_0xc4bf17=_0x2822af;_0x132750=0xc8;}else{_0x132750=0xce;}_0x2bf023[_0xba75('0x1c')](_0x132750);return _0x2bf023['set']('Content-Range',_0xd8850f+'-'+_0xc4bf17+'/'+_0x2822af)[_0xba75('0x1e')](_0x47be93);}return null;};}function patchUpdates(_0x31bc33){return function(_0x496cfc){try{jsonpatch['apply'](_0x496cfc,_0x31bc33,!![]);}catch(_0x30f482){return BPromise['reject'](_0x30f482);}return _0x496cfc[_0xba75('0x22')]();};}function saveUpdates(_0x2ece41,_0x19b2d7){return function(_0x4efad7){if(_0x4efad7){return _0x4efad7[_0xba75('0x23')](_0x2ece41)[_0xba75('0x24')](function(_0x139fa4){return _0x139fa4;});}return null;};}function removeEntity(_0x3e9bd9,_0x14c54b){return function(_0x29b14c){if(_0x29b14c){return _0x29b14c['destroy']()[_0xba75('0x24')](function(){var _0x112198=_0x29b14c[_0xba75('0x25')]({'plain':!![]});var _0x5ec733=_0xba75('0x26');return db[_0xba75('0x27')][_0xba75('0x28')]({'where':{'type':_0x5ec733,'resourceId':_0x112198['id']}})[_0xba75('0x24')](function(){return _0x29b14c;});})[_0xba75('0x24')](function(){_0x3e9bd9[_0xba75('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c8d02,_0x4e1987){return function(_0x240522){if(!_0x240522){_0x4c8d02['sendStatus'](0x194);}return _0x240522;};}function handleError(_0x42cefb,_0x58ea2d){_0x58ea2d=_0x58ea2d||0x1f4;return function(_0x15b5bc){logger[_0xba75('0x29')](_0x15b5bc[_0xba75('0x2a')]);if(_0x15b5bc['name']){delete _0x15b5bc[_0xba75('0x2b')];}_0x42cefb[_0xba75('0x1c')](_0x58ea2d)[_0xba75('0x2c')](_0x15b5bc);};}exports[_0xba75('0x2d')]=function(_0x5d9f78,_0x4791a5){var _0x200715={},_0x481a04={},_0x5a85ee={'count':0x0,'rows':[]};var _0x3061ac=_[_0xba75('0x2e')](db[_0xba75('0x2f')]['rawAttributes'],function(_0x238271){return{'name':_0x238271[_0xba75('0x30')],'type':_0x238271['type'][_0xba75('0x31')]};});_0x481a04[_0xba75('0x32')]=_[_0xba75('0x2e')](_0x3061ac,_0xba75('0x2b'));_0x481a04['query']=_[_0xba75('0x33')](_0x5d9f78[_0xba75('0x34')]);_0x481a04['filters']=_[_0xba75('0x35')](_0x481a04[_0xba75('0x32')],_0x481a04[_0xba75('0x34')]);_0x200715['attributes']=_[_0xba75('0x35')](_0x481a04[_0xba75('0x32')],qs[_0xba75('0x36')](_0x5d9f78[_0xba75('0x34')][_0xba75('0x36')]));_0x200715[_0xba75('0x37')]=_0x200715[_0xba75('0x37')]['length']?_0x200715['attributes']:_0x481a04[_0xba75('0x32')];if(!_0x5d9f78[_0xba75('0x34')][_0xba75('0x38')]('nolimit')){_0x200715[_0xba75('0x21')]=qs[_0xba75('0x21')](_0x5d9f78['query']['limit']);_0x200715[_0xba75('0x20')]=qs[_0xba75('0x20')](_0x5d9f78[_0xba75('0x34')][_0xba75('0x20')]);}_0x200715[_0xba75('0x39')]=qs['sort'](_0x5d9f78['query'][_0xba75('0x3a')]);_0x200715[_0xba75('0x3b')]=qs[_0xba75('0x3c')](_[_0xba75('0x3d')](_0x5d9f78[_0xba75('0x34')],_0x481a04[_0xba75('0x3c')]));if(_0x5d9f78[_0xba75('0x34')]['filter']){_0x200715[_0xba75('0x3b')]=_[_0xba75('0x3e')](_0x200715['where'],{'$or':_[_0xba75('0x2e')](_0x3061ac,function(_0x3740bd){if(_0x3740bd[_0xba75('0x3f')]!==_0xba75('0x40')){var _0x360bf7={};_0x360bf7[_0x3740bd[_0xba75('0x2b')]]={'$like':'%'+_0x5d9f78[_0xba75('0x34')]['filter']+'%'};return _0x360bf7;}})});}_0x200715=_[_0xba75('0x3e')]({},_0x200715,_0x5d9f78['options']);var _0x44b0a5={'where':_0x200715['where']};return db[_0xba75('0x2f')][_0xba75('0x1f')](_0x44b0a5)[_0xba75('0x24')](function(_0x169233){_0x5a85ee[_0xba75('0x1f')]=_0x169233;if(_0x5d9f78[_0xba75('0x34')][_0xba75('0x41')]){_0x200715[_0xba75('0x42')]=[{'all':!![]}];}return db[_0xba75('0x2f')]['findAll'](_0x200715);})[_0xba75('0x24')](function(_0x8d9eae){_0x5a85ee['rows']=_0x8d9eae;return _0x5a85ee;})[_0xba75('0x24')](respondWithFilteredResult(_0x4791a5,_0x200715))[_0xba75('0x43')](handleError(_0x4791a5,null));};exports[_0xba75('0x44')]=function(_0x5bf935,_0x5043a5){var _0x5c6491={'raw':![],'where':{'id':_0x5bf935[_0xba75('0x45')]['id']}},_0x5f008b={};_0x5f008b['model']=_[_0xba75('0x33')](db[_0xba75('0x2f')][_0xba75('0x46')]);_0x5f008b[_0xba75('0x34')]=_[_0xba75('0x33')](_0x5bf935['query']);_0x5f008b['filters']=_[_0xba75('0x35')](_0x5f008b['model'],_0x5f008b[_0xba75('0x34')]);_0x5c6491['attributes']=_[_0xba75('0x35')](_0x5f008b[_0xba75('0x32')],qs[_0xba75('0x36')](_0x5bf935[_0xba75('0x34')]['fields']));_0x5c6491[_0xba75('0x37')]=_0x5c6491[_0xba75('0x37')][_0xba75('0x47')]?_0x5c6491[_0xba75('0x37')]:_0x5f008b[_0xba75('0x32')];if(_0x5bf935[_0xba75('0x34')][_0xba75('0x41')]){_0x5c6491[_0xba75('0x42')]=[{'all':!![]}];}_0x5c6491=_['merge']({},_0x5c6491,_0x5bf935[_0xba75('0x48')]);return db[_0xba75('0x2f')][_0xba75('0x49')](_0x5c6491)[_0xba75('0x24')](handleEntityNotFound(_0x5043a5,null))[_0xba75('0x24')](respondWithResult(_0x5043a5,null))['catch'](handleError(_0x5043a5,null));};exports[_0xba75('0x4a')]=function(_0x25ae33,_0x1ca578){return db[_0xba75('0x2f')][_0xba75('0x4a')](_0x25ae33[_0xba75('0x4b')],{})[_0xba75('0x24')](function(_0x5dc5f8){var _0x141f2a=_0x25ae33[_0xba75('0x4c')][_0xba75('0x25')]({'plain':!![]});if(!_0x141f2a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x141f2a[_0xba75('0x4d')]===_0xba75('0x4c')){var _0x559f6f=_0x5dc5f8['get']({'plain':!![]});var _0x2d7f85='SquareProjects';return db['UserProfileSection'][_0xba75('0x49')]({'where':{'name':_0x2d7f85,'userProfileId':_0x141f2a['userProfileId']},'raw':!![]})[_0xba75('0x24')](function(_0x269245){if(_0x269245&&_0x269245[_0xba75('0x4e')]===0x0){return db[_0xba75('0x27')][_0xba75('0x4a')]({'name':_0x559f6f['name'],'resourceId':_0x559f6f['id'],'type':_0x269245[_0xba75('0x2b')],'sectionId':_0x269245['id']},{})[_0xba75('0x24')](function(){return _0x5dc5f8;});}else{return _0x5dc5f8;}})['catch'](function(_0x475179){logger[_0xba75('0x29')](_0xba75('0x4f'),_0x475179);throw _0x475179;});}return _0x5dc5f8;})[_0xba75('0x24')](respondWithResult(_0x1ca578,0xc9))[_0xba75('0x43')](handleError(_0x1ca578,null));};exports['update']=function(_0x43f4b7,_0x26b5db){if(_0x43f4b7['body']['id']){delete _0x43f4b7[_0xba75('0x4b')]['id'];}return db[_0xba75('0x2f')][_0xba75('0x49')]({'where':{'id':_0x43f4b7[_0xba75('0x45')]['id']}})[_0xba75('0x24')](handleEntityNotFound(_0x26b5db,null))[_0xba75('0x24')](saveUpdates(_0x43f4b7['body'],null))[_0xba75('0x24')](respondWithResult(_0x26b5db,null))[_0xba75('0x43')](handleError(_0x26b5db,null));};exports[_0xba75('0x28')]=function(_0x429e26,_0x38129c){return db[_0xba75('0x2f')]['find']({'where':{'id':_0x429e26['params']['id']}})['then'](handleEntityNotFound(_0x38129c,null))['then'](removeEntity(_0x38129c,null))[_0xba75('0x43')](handleError(_0x38129c,null));};exports[_0xba75('0x50')]=function(_0x2991e5,_0x11bfcb,_0x3716c6){return db[_0xba75('0x2f')][_0xba75('0x49')]({'where':{'id':_0x2991e5['params']['id']}})[_0xba75('0x24')](handleEntityNotFound(_0x11bfcb,null))[_0xba75('0x24')](function(_0x287f30){if(_0x287f30){return _0x287f30[_0xba75('0x50')](_0x2991e5['body'][_0xba75('0x51')],_[_0xba75('0x52')](_0x2991e5['body'],[_0xba75('0x51'),'id'])||{});}})['then'](respondWithResult(_0x11bfcb,null))[_0xba75('0x43')](handleError(_0x11bfcb,null));};exports[_0xba75('0x53')]=function(_0x57eceb,_0x276757,_0x3d5ff9){return db['SquareProject']['find']({'where':{'id':_0x57eceb[_0xba75('0x45')]['id']}})['then'](handleEntityNotFound(_0x276757,null))[_0xba75('0x24')](function(_0x5d5ef5){if(_0x5d5ef5){return _0x5d5ef5[_0xba75('0x53')](_0x57eceb[_0xba75('0x34')][_0xba75('0x51')])[_0xba75('0x24')](function(){if(_[_0xba75('0x54')](_0x57eceb['query'][_0xba75('0x51')])){for(var _0x32e2ae=0x0;_0x32e2ae<_0x57eceb['query'][_0xba75('0x51')][_0xba75('0x47')];_0x32e2ae+=0x1){socket[_0xba75('0x55')](_0xba75('0x56'),{'UserId':Number(_0x57eceb[_0xba75('0x34')][_0xba75('0x51')][_0x32e2ae]),'SquareProjectId':Number(_0x57eceb[_0xba75('0x45')]['id'])});}}else{socket[_0xba75('0x55')](_0xba75('0x56'),{'UserId':Number(_0x57eceb[_0xba75('0x34')][_0xba75('0x51')]),'SquareProjectId':Number(_0x57eceb[_0xba75('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0x276757,null))['catch'](handleError(_0x276757,null));};exports[_0xba75('0x57')]=function(_0x31e3b6,_0x46f3ed,_0x441462){var _0x8c4900={};var _0x33dda1={};var _0x1e1064;var _0x115798;return db[_0xba75('0x2f')][_0xba75('0x58')]({'where':{'id':_0x31e3b6[_0xba75('0x45')]['id']}})['then'](handleEntityNotFound(_0x46f3ed,null))[_0xba75('0x24')](function(_0x5c1e1d){if(_0x5c1e1d){_0x1e1064=_0x5c1e1d;_0x33dda1[_0xba75('0x32')]=_[_0xba75('0x33')](db[_0xba75('0x59')][_0xba75('0x46')]);_0x33dda1[_0xba75('0x34')]=_[_0xba75('0x33')](_0x31e3b6['query']);_0x33dda1[_0xba75('0x3c')]=_['intersection'](_0x33dda1[_0xba75('0x32')],_0x33dda1[_0xba75('0x34')]);_0x8c4900['attributes']=_['intersection'](_0x33dda1[_0xba75('0x32')],qs[_0xba75('0x36')](_0x31e3b6[_0xba75('0x34')][_0xba75('0x36')]));_0x8c4900[_0xba75('0x37')]=_0x8c4900[_0xba75('0x37')]['length']?_0x8c4900[_0xba75('0x37')]:_0x33dda1[_0xba75('0x32')];_0x8c4900['order']=qs[_0xba75('0x3a')](_0x31e3b6[_0xba75('0x34')][_0xba75('0x3a')]);_0x8c4900[_0xba75('0x3b')]=qs[_0xba75('0x3c')](_['pick'](_0x31e3b6[_0xba75('0x34')],_0x33dda1['filters']));if(_0x31e3b6[_0xba75('0x34')][_0xba75('0x5a')]){_0x8c4900[_0xba75('0x3b')]=_[_0xba75('0x3e')](_0x8c4900[_0xba75('0x3b')],{'$or':_[_0xba75('0x2e')](_0x8c4900['attributes'],function(_0x4d8b8e){var _0x1ae4d6={};_0x1ae4d6[_0x4d8b8e]={'$like':'%'+_0x31e3b6['query'][_0xba75('0x5a')]+'%'};return _0x1ae4d6;})});}_0x8c4900=_[_0xba75('0x3e')]({},_0x8c4900,_0x31e3b6['options']);return _0x1e1064[_0xba75('0x57')](_0x8c4900);}})[_0xba75('0x24')](function(_0x859f12){if(_0x859f12){_0x115798=_0x859f12['length'];if(!_0x31e3b6['query']['hasOwnProperty']('nolimit')){_0x8c4900['limit']=qs[_0xba75('0x21')](_0x31e3b6['query'][_0xba75('0x21')]);_0x8c4900[_0xba75('0x20')]=qs[_0xba75('0x20')](_0x31e3b6[_0xba75('0x34')][_0xba75('0x20')]);}return _0x1e1064[_0xba75('0x57')](_0x8c4900);}})[_0xba75('0x24')](function(_0x482033){if(_0x482033){return _0x482033?{'count':_0x115798,'rows':_0x482033}:null;}})['then'](respondWithResult(_0x46f3ed,null))[_0xba75('0x43')](handleError(_0x46f3ed,null));}; \ No newline at end of file +var _0xfe57=['get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','omit','ids','removeUsers','isArray','userSquareProject:remove','emit','getUsers','User','order','pick','hasOwnProperty','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','SquareProjects','UserProfileResource','then','error','stack','name','send','map','SquareProject','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','sort','where','filter','merge','include','findAll','rows','catch','params','rawAttributes','length','includeAll','options','find','create'];(function(_0xdaab62,_0x2728ab){var _0x13d767=function(_0x14bf14){while(--_0x14bf14){_0xdaab62['push'](_0xdaab62['shift']());}};_0x13d767(++_0x2728ab);}(_0xfe57,0x195));var _0x7fe5=function(_0x54b062,_0x264bb5){_0x54b062=_0x54b062-0x0;var _0x255e41=_0xfe57[_0x54b062];return _0x255e41;};'use strict';var pdf=require(_0x7fe5('0x0'));var emlformat=require(_0x7fe5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7fe5('0x2'));var rp=require(_0x7fe5('0x3'));var moment=require(_0x7fe5('0x4'));var BPromise=require(_0x7fe5('0x5'));var Mustache=require(_0x7fe5('0x6'));var util=require(_0x7fe5('0x7'));var path=require(_0x7fe5('0x8'));var sox=require(_0x7fe5('0x9'));var csv=require(_0x7fe5('0xa'));var ejs=require(_0x7fe5('0xb'));var fs=require('fs');var _=require(_0x7fe5('0xc'));var squel=require(_0x7fe5('0xd'));var crypto=require(_0x7fe5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7fe5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7fe5('0x10'));var Papa=require(_0x7fe5('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7fe5('0x12'));var as=require(_0x7fe5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fe5('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7fe5('0x15'));var db=require(_0x7fe5('0x16'))['db'];config[_0x7fe5('0x17')]=_[_0x7fe5('0x18')](config['redis'],{'host':_0x7fe5('0x19'),'port':0x18eb});var socket=require(_0x7fe5('0x1a'))(new Redis(config['redis']));require(_0x7fe5('0x1b'))['register'](socket);function respondWithStatusCode(_0x1f84b5,_0x2d297b){_0x2d297b=_0x2d297b||0xcc;return function(_0x4e8ea0){if(_0x4e8ea0){return _0x1f84b5[_0x7fe5('0x1c')](_0x2d297b);}return _0x1f84b5['status'](_0x2d297b)[_0x7fe5('0x1d')]();};}function respondWithResult(_0x221ab2,_0xbdf0a4){_0xbdf0a4=_0xbdf0a4||0xc8;return function(_0x4989a){if(_0x4989a){return _0x221ab2[_0x7fe5('0x1e')](_0xbdf0a4)[_0x7fe5('0x1f')](_0x4989a);}};}function respondWithFilteredResult(_0x4b9726,_0x166e23){return function(_0x3c7dd3){if(_0x3c7dd3){var _0x340d5e=_0x3c7dd3[_0x7fe5('0x20')],_0x1be963=_0x166e23[_0x7fe5('0x21')],_0x2533db=_0x166e23[_0x7fe5('0x21')]+_0x166e23[_0x7fe5('0x22')],_0x9a3022;if(_0x2533db>=_0x340d5e){_0x2533db=_0x340d5e;_0x9a3022=0xc8;}else{_0x9a3022=0xce;}_0x4b9726['status'](_0x9a3022);return _0x4b9726['set'](_0x7fe5('0x23'),_0x1be963+'-'+_0x2533db+'/'+_0x340d5e)[_0x7fe5('0x1f')](_0x3c7dd3);}return null;};}function patchUpdates(_0x2f6592){return function(_0x327301){try{jsonpatch[_0x7fe5('0x24')](_0x327301,_0x2f6592,!![]);}catch(_0x39c3ba){return BPromise[_0x7fe5('0x25')](_0x39c3ba);}return _0x327301[_0x7fe5('0x26')]();};}function saveUpdates(_0x1b271c,_0x28a7fd){return function(_0xb8dfe){if(_0xb8dfe){return _0xb8dfe[_0x7fe5('0x27')](_0x1b271c)['then'](function(_0x3e7340){return _0x3e7340;});}return null;};}function removeEntity(_0x2f39e0,_0x43e547){return function(_0x508826){if(_0x508826){return _0x508826[_0x7fe5('0x28')]()['then'](function(){var _0xf358ed=_0x508826['get']({'plain':!![]});var _0x5c3b37=_0x7fe5('0x29');return db[_0x7fe5('0x2a')][_0x7fe5('0x28')]({'where':{'type':_0x5c3b37,'resourceId':_0xf358ed['id']}})[_0x7fe5('0x2b')](function(){return _0x508826;});})[_0x7fe5('0x2b')](function(){_0x2f39e0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x417a56,_0x450759){return function(_0x27b66d){if(!_0x27b66d){_0x417a56[_0x7fe5('0x1c')](0x194);}return _0x27b66d;};}function handleError(_0x51407b,_0x46f816){_0x46f816=_0x46f816||0x1f4;return function(_0x4a77e9){logger[_0x7fe5('0x2c')](_0x4a77e9[_0x7fe5('0x2d')]);if(_0x4a77e9[_0x7fe5('0x2e')]){delete _0x4a77e9[_0x7fe5('0x2e')];}_0x51407b[_0x7fe5('0x1e')](_0x46f816)[_0x7fe5('0x2f')](_0x4a77e9);};}exports['index']=function(_0xe521c6,_0x423da8){var _0x5ec0b4={},_0xfc1189={},_0x246b70={'count':0x0,'rows':[]};var _0x360f6f=_[_0x7fe5('0x30')](db[_0x7fe5('0x31')]['rawAttributes'],function(_0x55577c){return{'name':_0x55577c[_0x7fe5('0x32')],'type':_0x55577c[_0x7fe5('0x33')][_0x7fe5('0x34')]};});_0xfc1189[_0x7fe5('0x35')]=_['map'](_0x360f6f,_0x7fe5('0x2e'));_0xfc1189[_0x7fe5('0x36')]=_[_0x7fe5('0x37')](_0xe521c6[_0x7fe5('0x36')]);_0xfc1189[_0x7fe5('0x38')]=_[_0x7fe5('0x39')](_0xfc1189['model'],_0xfc1189[_0x7fe5('0x36')]);_0x5ec0b4[_0x7fe5('0x3a')]=_[_0x7fe5('0x39')](_0xfc1189[_0x7fe5('0x35')],qs['fields'](_0xe521c6['query'][_0x7fe5('0x3b')]));_0x5ec0b4['attributes']=_0x5ec0b4[_0x7fe5('0x3a')]['length']?_0x5ec0b4[_0x7fe5('0x3a')]:_0xfc1189['model'];if(!_0xe521c6['query']['hasOwnProperty']('nolimit')){_0x5ec0b4[_0x7fe5('0x22')]=qs[_0x7fe5('0x22')](_0xe521c6['query'][_0x7fe5('0x22')]);_0x5ec0b4[_0x7fe5('0x21')]=qs['offset'](_0xe521c6[_0x7fe5('0x36')]['offset']);}_0x5ec0b4['order']=qs[_0x7fe5('0x3c')](_0xe521c6[_0x7fe5('0x36')][_0x7fe5('0x3c')]);_0x5ec0b4[_0x7fe5('0x3d')]=qs[_0x7fe5('0x38')](_['pick'](_0xe521c6[_0x7fe5('0x36')],_0xfc1189[_0x7fe5('0x38')]));if(_0xe521c6['query'][_0x7fe5('0x3e')]){_0x5ec0b4[_0x7fe5('0x3d')]=_[_0x7fe5('0x3f')](_0x5ec0b4[_0x7fe5('0x3d')],{'$or':_[_0x7fe5('0x30')](_0x360f6f,function(_0x1c81c8){if(_0x1c81c8[_0x7fe5('0x33')]!=='VIRTUAL'){var _0x527ff7={};_0x527ff7[_0x1c81c8[_0x7fe5('0x2e')]]={'$like':'%'+_0xe521c6['query'][_0x7fe5('0x3e')]+'%'};return _0x527ff7;}})});}_0x5ec0b4=_[_0x7fe5('0x3f')]({},_0x5ec0b4,_0xe521c6['options']);var _0x288792={'where':_0x5ec0b4[_0x7fe5('0x3d')]};return db[_0x7fe5('0x31')][_0x7fe5('0x20')](_0x288792)[_0x7fe5('0x2b')](function(_0x2a31c0){_0x246b70[_0x7fe5('0x20')]=_0x2a31c0;if(_0xe521c6['query']['includeAll']){_0x5ec0b4[_0x7fe5('0x40')]=[{'all':!![]}];}return db['SquareProject'][_0x7fe5('0x41')](_0x5ec0b4);})[_0x7fe5('0x2b')](function(_0x453066){_0x246b70[_0x7fe5('0x42')]=_0x453066;return _0x246b70;})['then'](respondWithFilteredResult(_0x423da8,_0x5ec0b4))[_0x7fe5('0x43')](handleError(_0x423da8,null));};exports['show']=function(_0x498312,_0x14a570){var _0x585f27={'raw':![],'where':{'id':_0x498312[_0x7fe5('0x44')]['id']}},_0x4f4c38={};_0x4f4c38[_0x7fe5('0x35')]=_[_0x7fe5('0x37')](db[_0x7fe5('0x31')][_0x7fe5('0x45')]);_0x4f4c38['query']=_[_0x7fe5('0x37')](_0x498312[_0x7fe5('0x36')]);_0x4f4c38['filters']=_[_0x7fe5('0x39')](_0x4f4c38[_0x7fe5('0x35')],_0x4f4c38[_0x7fe5('0x36')]);_0x585f27[_0x7fe5('0x3a')]=_['intersection'](_0x4f4c38[_0x7fe5('0x35')],qs[_0x7fe5('0x3b')](_0x498312[_0x7fe5('0x36')]['fields']));_0x585f27[_0x7fe5('0x3a')]=_0x585f27[_0x7fe5('0x3a')][_0x7fe5('0x46')]?_0x585f27['attributes']:_0x4f4c38[_0x7fe5('0x35')];if(_0x498312[_0x7fe5('0x36')][_0x7fe5('0x47')]){_0x585f27['include']=[{'all':!![]}];}_0x585f27=_[_0x7fe5('0x3f')]({},_0x585f27,_0x498312[_0x7fe5('0x48')]);return db[_0x7fe5('0x31')][_0x7fe5('0x49')](_0x585f27)[_0x7fe5('0x2b')](handleEntityNotFound(_0x14a570,null))[_0x7fe5('0x2b')](respondWithResult(_0x14a570,null))[_0x7fe5('0x43')](handleError(_0x14a570,null));};exports[_0x7fe5('0x4a')]=function(_0x446f01,_0xa8e2d3){return db[_0x7fe5('0x31')]['create'](_0x446f01['body'],{})['then'](function(_0x5f2232){var _0x402c09=_0x446f01['user'][_0x7fe5('0x4b')]({'plain':!![]});if(!_0x402c09)throw new Error(_0x7fe5('0x4c'));if(_0x402c09[_0x7fe5('0x4d')]===_0x7fe5('0x4e')){var _0x362f33=_0x5f2232['get']({'plain':!![]});var _0x2aca4b=_0x7fe5('0x29');return db[_0x7fe5('0x4f')][_0x7fe5('0x49')]({'where':{'name':_0x2aca4b,'userProfileId':_0x402c09[_0x7fe5('0x50')]},'raw':!![]})[_0x7fe5('0x2b')](function(_0x16ccca){if(_0x16ccca&&_0x16ccca[_0x7fe5('0x51')]===0x0){return db[_0x7fe5('0x2a')][_0x7fe5('0x4a')]({'name':_0x362f33['name'],'resourceId':_0x362f33['id'],'type':_0x16ccca[_0x7fe5('0x2e')],'sectionId':_0x16ccca['id']},{})[_0x7fe5('0x2b')](function(){return _0x5f2232;});}else{return _0x5f2232;}})[_0x7fe5('0x43')](function(_0x18781c){logger[_0x7fe5('0x2c')](_0x7fe5('0x52'),_0x18781c);throw _0x18781c;});}return _0x5f2232;})['then'](respondWithResult(_0xa8e2d3,0xc9))[_0x7fe5('0x43')](handleError(_0xa8e2d3,null));};exports[_0x7fe5('0x27')]=function(_0x3d83fd,_0x457cae){if(_0x3d83fd[_0x7fe5('0x53')]['id']){delete _0x3d83fd[_0x7fe5('0x53')]['id'];}return db[_0x7fe5('0x31')]['find']({'where':{'id':_0x3d83fd[_0x7fe5('0x44')]['id']}})[_0x7fe5('0x2b')](handleEntityNotFound(_0x457cae,null))[_0x7fe5('0x2b')](saveUpdates(_0x3d83fd[_0x7fe5('0x53')],null))[_0x7fe5('0x2b')](respondWithResult(_0x457cae,null))['catch'](handleError(_0x457cae,null));};exports[_0x7fe5('0x28')]=function(_0x34a430,_0x168e59){return db[_0x7fe5('0x31')]['find']({'where':{'id':_0x34a430[_0x7fe5('0x44')]['id']}})[_0x7fe5('0x2b')](handleEntityNotFound(_0x168e59,null))[_0x7fe5('0x2b')](removeEntity(_0x168e59,null))[_0x7fe5('0x43')](handleError(_0x168e59,null));};exports[_0x7fe5('0x54')]=function(_0x25e583,_0x466c72,_0x26607a){return db[_0x7fe5('0x31')][_0x7fe5('0x49')]({'where':{'id':_0x25e583[_0x7fe5('0x44')]['id']}})['then'](handleEntityNotFound(_0x466c72,null))[_0x7fe5('0x2b')](function(_0x1ce47c){if(_0x1ce47c){return _0x1ce47c[_0x7fe5('0x54')](_0x25e583['body']['ids'],_[_0x7fe5('0x55')](_0x25e583['body'],[_0x7fe5('0x56'),'id'])||{});}})[_0x7fe5('0x2b')](respondWithResult(_0x466c72,null))['catch'](handleError(_0x466c72,null));};exports[_0x7fe5('0x57')]=function(_0x47c811,_0x1fd083,_0x23f2c8){return db[_0x7fe5('0x31')][_0x7fe5('0x49')]({'where':{'id':_0x47c811[_0x7fe5('0x44')]['id']}})[_0x7fe5('0x2b')](handleEntityNotFound(_0x1fd083,null))['then'](function(_0x4cfef9){if(_0x4cfef9){return _0x4cfef9[_0x7fe5('0x57')](_0x47c811[_0x7fe5('0x36')][_0x7fe5('0x56')])[_0x7fe5('0x2b')](function(){if(_[_0x7fe5('0x58')](_0x47c811['query'][_0x7fe5('0x56')])){for(var _0x42d329=0x0;_0x42d329<_0x47c811[_0x7fe5('0x36')][_0x7fe5('0x56')][_0x7fe5('0x46')];_0x42d329+=0x1){socket['emit'](_0x7fe5('0x59'),{'UserId':Number(_0x47c811[_0x7fe5('0x36')][_0x7fe5('0x56')][_0x42d329]),'SquareProjectId':Number(_0x47c811[_0x7fe5('0x44')]['id'])});}}else{socket[_0x7fe5('0x5a')](_0x7fe5('0x59'),{'UserId':Number(_0x47c811[_0x7fe5('0x36')]['ids']),'SquareProjectId':Number(_0x47c811[_0x7fe5('0x44')]['id'])});}});}})[_0x7fe5('0x2b')](respondWithStatusCode(_0x1fd083,null))[_0x7fe5('0x43')](handleError(_0x1fd083,null));};exports[_0x7fe5('0x5b')]=function(_0x87af50,_0x2f1b18,_0x9d0a0c){var _0x52e990={};var _0x4e2104={};var _0x345990;var _0x4c3ee6;return db[_0x7fe5('0x31')]['findOne']({'where':{'id':_0x87af50[_0x7fe5('0x44')]['id']}})[_0x7fe5('0x2b')](handleEntityNotFound(_0x2f1b18,null))[_0x7fe5('0x2b')](function(_0x31eb57){if(_0x31eb57){_0x345990=_0x31eb57;_0x4e2104[_0x7fe5('0x35')]=_[_0x7fe5('0x37')](db[_0x7fe5('0x5c')][_0x7fe5('0x45')]);_0x4e2104['query']=_[_0x7fe5('0x37')](_0x87af50['query']);_0x4e2104[_0x7fe5('0x38')]=_[_0x7fe5('0x39')](_0x4e2104[_0x7fe5('0x35')],_0x4e2104['query']);_0x52e990[_0x7fe5('0x3a')]=_[_0x7fe5('0x39')](_0x4e2104[_0x7fe5('0x35')],qs[_0x7fe5('0x3b')](_0x87af50[_0x7fe5('0x36')][_0x7fe5('0x3b')]));_0x52e990['attributes']=_0x52e990[_0x7fe5('0x3a')][_0x7fe5('0x46')]?_0x52e990['attributes']:_0x4e2104[_0x7fe5('0x35')];_0x52e990[_0x7fe5('0x5d')]=qs['sort'](_0x87af50[_0x7fe5('0x36')]['sort']);_0x52e990[_0x7fe5('0x3d')]=qs[_0x7fe5('0x38')](_[_0x7fe5('0x5e')](_0x87af50[_0x7fe5('0x36')],_0x4e2104[_0x7fe5('0x38')]));if(_0x87af50['query'][_0x7fe5('0x3e')]){_0x52e990['where']=_[_0x7fe5('0x3f')](_0x52e990[_0x7fe5('0x3d')],{'$or':_[_0x7fe5('0x30')](_0x52e990[_0x7fe5('0x3a')],function(_0x4d9a04){var _0x3917f4={};_0x3917f4[_0x4d9a04]={'$like':'%'+_0x87af50['query'][_0x7fe5('0x3e')]+'%'};return _0x3917f4;})});}_0x52e990=_[_0x7fe5('0x3f')]({},_0x52e990,_0x87af50['options']);return _0x345990[_0x7fe5('0x5b')](_0x52e990);}})[_0x7fe5('0x2b')](function(_0x536107){if(_0x536107){_0x4c3ee6=_0x536107[_0x7fe5('0x46')];if(!_0x87af50[_0x7fe5('0x36')][_0x7fe5('0x5f')]('nolimit')){_0x52e990[_0x7fe5('0x22')]=qs[_0x7fe5('0x22')](_0x87af50['query'][_0x7fe5('0x22')]);_0x52e990[_0x7fe5('0x21')]=qs['offset'](_0x87af50[_0x7fe5('0x36')]['offset']);}return _0x345990['getUsers'](_0x52e990);}})[_0x7fe5('0x2b')](function(_0x2d06a3){if(_0x2d06a3){return _0x2d06a3?{'count':_0x4c3ee6,'rows':_0x2d06a3}:null;}})['then'](respondWithResult(_0x2f1b18,null))['catch'](handleError(_0x2f1b18,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 35072bc..c944c31 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 _0xc431=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc431,0x15c));var _0x1c43=function(_0x4c7d1a,_0x4a709d){_0x4c7d1a=_0x4c7d1a-0x0;var _0x135b84=_0xc431[_0x4c7d1a];return _0x135b84;};'use strict';var EventEmitter=require(_0x1c43('0x0'));var SquareProject=require(_0x1c43('0x1'))['db'][_0x1c43('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x1c43('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1c43('0x4'),'afterDestroy':'remove'};function emitEvent(_0x45ae5c){return function(_0x433447,_0x2e94f3,_0x57b72a){SquareProjectEvents[_0x1c43('0x5')](_0x45ae5c+':'+_0x433447['id'],_0x433447);SquareProjectEvents[_0x1c43('0x5')](_0x45ae5c,_0x433447);_0x57b72a(null);};}for(var e in events){if(events[_0x1c43('0x6')](e)){var event=events[e];SquareProject[_0x1c43('0x7')](e,emitEvent(event));}}module[_0x1c43('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x49a4=['save','update','remove','emit','hasOwnProperty','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x49a4,0x149));var _0x449a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x49a4[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x449a('0x0')](0x0);var events={'afterCreate':_0x449a('0x1'),'afterUpdate':_0x449a('0x2'),'afterDestroy':_0x449a('0x3')};function emitEvent(_0x15b00d){return function(_0xe9f405,_0x412661,_0x97b119){SquareProjectEvents[_0x449a('0x4')](_0x15b00d+':'+_0xe9f405['id'],_0xe9f405);SquareProjectEvents[_0x449a('0x4')](_0x15b00d,_0xe9f405);_0x97b119(null);};}for(var e in events){if(events[_0x449a('0x5')](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 71f988b..5418955 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 _0xaa9c=['request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','lodash','util','api','moment','bluebird'];(function(_0x43f99c,_0x167e26){var _0x4df22a=function(_0x3b0320){while(--_0x3b0320){_0x43f99c['push'](_0x43f99c['shift']());}};_0x4df22a(++_0x167e26);}(_0xaa9c,0xcd));var _0xcaa9=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xaa9c[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0xcaa9('0x0'));var util=require(_0xcaa9('0x1'));var logger=require('../../config/logger')(_0xcaa9('0x2'));var moment=require(_0xcaa9('0x3'));var BPromise=require(_0xcaa9('0x4'));var rp=require(_0xcaa9('0x5'));var fs=require('fs');var path=require(_0xcaa9('0x6'));var rimraf=require(_0xcaa9('0x7'));var config=require(_0xcaa9('0x8'));var attributes=require(_0xcaa9('0x9'));module[_0xcaa9('0xa')]=function(_0x371d72,_0x5f046f){return _0x371d72[_0xcaa9('0xb')](_0xcaa9('0xc'),attributes,{'tableName':_0xcaa9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x49d1=['define','SquareProject','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./squareProject.attributes','exports'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x49d1,0x14c));var _0x149d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x49d1[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x149d('0x0'));var logger=require(_0x149d('0x1'))(_0x149d('0x2'));var moment=require('moment');var BPromise=require(_0x149d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x149d('0x4'));var rimraf=require(_0x149d('0x5'));var config=require(_0x149d('0x6'));var attributes=require(_0x149d('0x7'));module[_0x149d('0x8')]=function(_0x1921c8,_0x1d7af2){return _0x1921c8[_0x149d('0x9')](_0x149d('0xa'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 6006cd3..0f1415b 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 _0x4675=['model','ShowSquareProject','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./squareProject.socket','then','info','SquareProject,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','find','options','raw','where','attributes','map','include'];(function(_0x303862,_0x20b5ab){var _0xe6f228=function(_0x41fc5a){while(--_0x41fc5a){_0x303862['push'](_0x303862['shift']());}};_0xe6f228(++_0x20b5ab);}(_0x4675,0x1d0));var _0x5467=function(_0x15966d,_0x1bd4d6){_0x15966d=_0x15966d-0x0;var _0x32d8b9=_0x4675[_0x15966d];return _0x32d8b9;};'use strict';var _=require('lodash');var util=require(_0x5467('0x0'));var moment=require(_0x5467('0x1'));var BPromise=require('bluebird');var rs=require(_0x5467('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5467('0x3'))['db'];var utils=require(_0x5467('0x4'));var logger=require(_0x5467('0x5'))(_0x5467('0x6'));var config=require(_0x5467('0x7'));var jayson=require(_0x5467('0x8'));var client=jayson[_0x5467('0x9')][_0x5467('0xa')]({'port':0x232a});config[_0x5467('0xb')]=_[_0x5467('0xc')](config[_0x5467('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5467('0xd'))['register'](socket);function respondWithRpcPromise(_0x3db30b,_0x56cf89,_0x3f5901){return new BPromise(function(_0x74c209,_0x2704c5){return client['request'](_0x3db30b,_0x3f5901)[_0x5467('0xe')](function(_0x49ce31){logger[_0x5467('0xf')](_0x5467('0x10'),_0x56cf89,'request\x20sent');logger[_0x5467('0x11')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x56cf89,_0x5467('0x12'),JSON[_0x5467('0x13')](_0x49ce31));if(_0x49ce31['error']){if(_0x49ce31['error']['code']===0x1f4){logger['error'](_0x5467('0x10'),_0x56cf89,_0x49ce31[_0x5467('0x14')][_0x5467('0x15')]);return _0x2704c5(_0x49ce31['error'][_0x5467('0x15')]);}logger[_0x5467('0x14')](_0x5467('0x10'),_0x56cf89,_0x49ce31[_0x5467('0x14')]['message']);return _0x74c209(_0x49ce31[_0x5467('0x14')][_0x5467('0x15')]);}else{logger['info'](_0x5467('0x10'),_0x56cf89,_0x5467('0x12'));_0x74c209(_0x49ce31[_0x5467('0x16')][_0x5467('0x15')]);}})[_0x5467('0x17')](function(_0x4f6044){logger['error'](_0x5467('0x10'),_0x56cf89,_0x4f6044);_0x2704c5(_0x4f6044);});});}exports['ShowSquareProject']=function(_0x720d2c){var _0x530625=this;return new Promise(function(_0x144408,_0x11ba2e){return db['SquareProject'][_0x5467('0x18')]({'raw':_0x720d2c[_0x5467('0x19')]?_0x720d2c[_0x5467('0x19')][_0x5467('0x1a')]===undefined?!![]:![]:!![],'where':_0x720d2c[_0x5467('0x19')]?_0x720d2c[_0x5467('0x19')][_0x5467('0x1b')]||null:null,'attributes':_0x720d2c[_0x5467('0x19')]?_0x720d2c[_0x5467('0x19')][_0x5467('0x1c')]||null:null,'include':_0x720d2c[_0x5467('0x19')]?_0x720d2c[_0x5467('0x19')]['include']?_[_0x5467('0x1d')](_0x720d2c[_0x5467('0x19')][_0x5467('0x1e')],function(_0x3e31b3){return{'model':db[_0x3e31b3['model']],'as':_0x3e31b3['as'],'attributes':_0x3e31b3[_0x5467('0x1c')],'include':_0x3e31b3['include']?_['map'](_0x3e31b3['include'],function(_0x4c16e1){return{'model':db[_0x4c16e1[_0x5467('0x1f')]],'as':_0x4c16e1['as'],'attributes':_0x4c16e1['attributes'],'include':_0x4c16e1[_0x5467('0x1e')]?_[_0x5467('0x1d')](_0x4c16e1['include'],function(_0x437fce){return{'model':db[_0x437fce['model']],'as':_0x437fce['as'],'attributes':_0x437fce[_0x5467('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5467('0xe')](function(_0x550d6e){logger[_0x5467('0xf')]('ShowSquareProject',_0x720d2c);logger['debug'](_0x5467('0x20'),_0x720d2c,JSON[_0x5467('0x13')](_0x550d6e));_0x144408(_0x550d6e);})[_0x5467('0x17')](function(_0x299e20){logger[_0x5467('0x14')]('ShowSquareProject',_0x299e20['message'],_0x720d2c);_0x11ba2e(_0x530625[_0x5467('0x14')](0x1f4,_0x299e20[_0x5467('0x15')]));});});}; \ No newline at end of file +var _0x1d9a=['SquareProject,\x20%s,\x20%s','result','catch','ShowSquareProject','find','options','where','attributes','include','map','model','then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./squareProject.socket','request','info','debug','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x4b7e08,_0x4297c3){var _0x144c2b=function(_0x404056){while(--_0x404056){_0x4b7e08['push'](_0x4b7e08['shift']());}};_0x144c2b(++_0x4297c3);}(_0x1d9a,0x1c9));var _0xa1d9=function(_0x183463,_0x47dbc8){_0x183463=_0x183463-0x0;var _0x55ba1c=_0x1d9a[_0x183463];return _0x55ba1c;};'use strict';var _=require(_0xa1d9('0x0'));var util=require(_0xa1d9('0x1'));var moment=require(_0xa1d9('0x2'));var BPromise=require(_0xa1d9('0x3'));var rs=require(_0xa1d9('0x4'));var fs=require('fs');var Redis=require(_0xa1d9('0x5'));var db=require(_0xa1d9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1d9('0x7'))('rpc');var config=require(_0xa1d9('0x8'));var jayson=require(_0xa1d9('0x9'));var client=jayson[_0xa1d9('0xa')][_0xa1d9('0xb')]({'port':0x232a});config[_0xa1d9('0xc')]=_[_0xa1d9('0xd')](config[_0xa1d9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xa1d9('0xe'))(new Redis(config[_0xa1d9('0xc')]));require(_0xa1d9('0xf'))['register'](socket);function respondWithRpcPromise(_0x109c4b,_0x4cd187,_0x1d2f0d){return new BPromise(function(_0x354375,_0x2b6de7){return client[_0xa1d9('0x10')](_0x109c4b,_0x1d2f0d)['then'](function(_0x40549f){logger[_0xa1d9('0x11')]('SquareProject,\x20%s,\x20%s',_0x4cd187,'request\x20sent');logger[_0xa1d9('0x12')](_0xa1d9('0x13'),_0x4cd187,_0xa1d9('0x14'),JSON['stringify'](_0x40549f));if(_0x40549f[_0xa1d9('0x15')]){if(_0x40549f[_0xa1d9('0x15')][_0xa1d9('0x16')]===0x1f4){logger[_0xa1d9('0x15')]('SquareProject,\x20%s,\x20%s',_0x4cd187,_0x40549f[_0xa1d9('0x15')][_0xa1d9('0x17')]);return _0x2b6de7(_0x40549f['error'][_0xa1d9('0x17')]);}logger[_0xa1d9('0x15')](_0xa1d9('0x18'),_0x4cd187,_0x40549f[_0xa1d9('0x15')]['message']);return _0x354375(_0x40549f[_0xa1d9('0x15')][_0xa1d9('0x17')]);}else{logger[_0xa1d9('0x11')](_0xa1d9('0x18'),_0x4cd187,_0xa1d9('0x14'));_0x354375(_0x40549f[_0xa1d9('0x19')]['message']);}})[_0xa1d9('0x1a')](function(_0x1baf3e){logger[_0xa1d9('0x15')](_0xa1d9('0x18'),_0x4cd187,_0x1baf3e);_0x2b6de7(_0x1baf3e);});});}exports[_0xa1d9('0x1b')]=function(_0x472f28){var _0x3758ce=this;return new Promise(function(_0x5aed08,_0x3cb22b){return db['SquareProject'][_0xa1d9('0x1c')]({'raw':_0x472f28[_0xa1d9('0x1d')]?_0x472f28[_0xa1d9('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x472f28[_0xa1d9('0x1d')]?_0x472f28[_0xa1d9('0x1d')][_0xa1d9('0x1e')]||null:null,'attributes':_0x472f28['options']?_0x472f28[_0xa1d9('0x1d')][_0xa1d9('0x1f')]||null:null,'include':_0x472f28[_0xa1d9('0x1d')]?_0x472f28[_0xa1d9('0x1d')][_0xa1d9('0x20')]?_[_0xa1d9('0x21')](_0x472f28[_0xa1d9('0x1d')][_0xa1d9('0x20')],function(_0x4a95b0){return{'model':db[_0x4a95b0[_0xa1d9('0x22')]],'as':_0x4a95b0['as'],'attributes':_0x4a95b0['attributes'],'include':_0x4a95b0[_0xa1d9('0x20')]?_[_0xa1d9('0x21')](_0x4a95b0[_0xa1d9('0x20')],function(_0x5bba80){return{'model':db[_0x5bba80[_0xa1d9('0x22')]],'as':_0x5bba80['as'],'attributes':_0x5bba80[_0xa1d9('0x1f')],'include':_0x5bba80['include']?_['map'](_0x5bba80[_0xa1d9('0x20')],function(_0x2235f3){return{'model':db[_0x2235f3[_0xa1d9('0x22')]],'as':_0x2235f3['as'],'attributes':_0x2235f3[_0xa1d9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa1d9('0x23')](function(_0x4ac5cb){logger['info']('ShowSquareProject',_0x472f28);logger[_0xa1d9('0x12')](_0xa1d9('0x1b'),_0x472f28,JSON[_0xa1d9('0x24')](_0x4ac5cb));_0x5aed08(_0x4ac5cb);})['catch'](function(_0xe83296){logger[_0xa1d9('0x15')](_0xa1d9('0x1b'),_0xe83296[_0xa1d9('0x17')],_0x472f28);_0x3cb22b(_0x3758ce[_0xa1d9('0x15')](0x1f4,_0xe83296[_0xa1d9('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 36bb3d5..e9c6c89 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 _0x33af=['emit','removeListener','register','length','squareProject:','save','update'];(function(_0x17607d,_0x41c4f7){var _0x53f4b1=function(_0x2c89bb){while(--_0x2c89bb){_0x17607d['push'](_0x17607d['shift']());}};_0x53f4b1(++_0x41c4f7);}(_0x33af,0xec));var _0xf33a=function(_0x2d7842,_0x5e1932){_0x2d7842=_0x2d7842-0x0;var _0x35485d=_0x33af[_0x2d7842];return _0x35485d;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xf33a('0x0'),'remove',_0xf33a('0x1')];function createListener(_0x1111c6,_0x267057){return function(_0x4303f1){_0x267057[_0xf33a('0x2')](_0x1111c6,_0x4303f1);};}function removeListener(_0x25f156,_0x4c734e){return function(){SquareProjectEvents[_0xf33a('0x3')](_0x25f156,_0x4c734e);};}exports[_0xf33a('0x4')]=function(_0x583e54){for(var _0xc0dd13=0x0,_0x384b14=events[_0xf33a('0x5')];_0xc0dd13<_0x384b14;_0xc0dd13++){var _0x2f3730=events[_0xc0dd13];var _0x2baabb=createListener(_0xf33a('0x6')+_0x2f3730,_0x583e54);SquareProjectEvents['on'](_0x2f3730,_0x2baabb);}}; \ No newline at end of file +var _0x71ab=['length','squareProject:','save','update','emit','removeListener','register'];(function(_0x25d64b,_0xbbe11a){var _0x333c30=function(_0x163c11){while(--_0x163c11){_0x25d64b['push'](_0x25d64b['shift']());}};_0x333c30(++_0xbbe11a);}(_0x71ab,0x64));var _0xb71a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x71ab[_0x3947c9];return _0x2e7871;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xb71a('0x0'),'remove',_0xb71a('0x1')];function createListener(_0x5bdf89,_0x3e985a){return function(_0x3f0529){_0x3e985a[_0xb71a('0x2')](_0x5bdf89,_0x3f0529);};}function removeListener(_0x4094b2,_0x37ce74){return function(){SquareProjectEvents[_0xb71a('0x3')](_0x4094b2,_0x37ce74);};}exports[_0xb71a('0x4')]=function(_0x38d931){for(var _0x22c072=0x0,_0x35a84e=events[_0xb71a('0x5')];_0x22c072<_0x35a84e;_0x22c072++){var _0x2a4c86=events[_0x22c072];var _0x43ca14=createListener(_0xb71a('0x6')+_0x2a4c86,_0x38d931);SquareProjectEvents['on'](_0x2a4c86,_0x43ca14);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index d4b7170..4e90471 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 _0xcb63=['download','post','/:id/delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download'];(function(_0x42ad41,_0x48938c){var _0x292362=function(_0x55be21){while(--_0x55be21){_0x42ad41['push'](_0x42ad41['shift']());}};_0x292362(++_0x48938c);}(_0xcb63,0x69));var _0x3cb6=function(_0x35f877,_0x338413){_0x35f877=_0x35f877-0x0;var _0x1e8a93=_0xcb63[_0x35f877];return _0x1e8a93;};'use strict';var multer=require(_0x3cb6('0x0'));var util=require(_0x3cb6('0x1'));var path=require(_0x3cb6('0x2'));var timeout=require(_0x3cb6('0x3'));var express=require('express');var router=express[_0x3cb6('0x4')]();var auth=require(_0x3cb6('0x5'));var interaction=require(_0x3cb6('0x6'));var config=require(_0x3cb6('0x7'));var controller=require(_0x3cb6('0x8'));router[_0x3cb6('0x9')]('/',auth['isAuthenticated'](),controller[_0x3cb6('0xa')]);router[_0x3cb6('0x9')](_0x3cb6('0xb'),auth[_0x3cb6('0xc')](),controller[_0x3cb6('0xd')]);router[_0x3cb6('0x9')](_0x3cb6('0xe'),auth[_0x3cb6('0xc')](),controller[_0x3cb6('0xf')]);router[_0x3cb6('0x10')]('/',auth[_0x3cb6('0xc')](),controller['create']);router['put'](_0x3cb6('0xb'),auth[_0x3cb6('0xc')](),controller['update']);router['delete'](_0x3cb6('0x11'),auth[_0x3cb6('0xc')](),controller[_0x3cb6('0x12')]);module[_0x3cb6('0x13')]=router; \ No newline at end of file +var _0x39bd=['../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','/:id','/:id/download','download','post','create','put','delete','destroy','path','connect-timeout','express','../../components/auth/service'];(function(_0x158993,_0x44e746){var _0x10cd7a=function(_0x4a3e8b){while(--_0x4a3e8b){_0x158993['push'](_0x158993['shift']());}};_0x10cd7a(++_0x44e746);}(_0x39bd,0x14c));var _0xd39b=function(_0x1be575,_0xc144c8){_0x1be575=_0x1be575-0x0;var _0x214d25=_0x39bd[_0x1be575];return _0x214d25;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd39b('0x0'));var timeout=require(_0xd39b('0x1'));var express=require(_0xd39b('0x2'));var router=express['Router']();var auth=require(_0xd39b('0x3'));var interaction=require(_0xd39b('0x4'));var config=require('../../config/environment');var controller=require(_0xd39b('0x5'));router[_0xd39b('0x6')]('/',auth[_0xd39b('0x7')](),controller['index']);router[_0xd39b('0x6')](_0xd39b('0x8'),auth[_0xd39b('0x7')](),controller['show']);router[_0xd39b('0x6')](_0xd39b('0x9'),auth[_0xd39b('0x7')](),controller[_0xd39b('0xa')]);router[_0xd39b('0xb')]('/',auth['isAuthenticated'](),controller[_0xd39b('0xc')]);router[_0xd39b('0xd')]('/:id',auth[_0xd39b('0x7')](),controller['update']);router[_0xd39b('0xe')]('/:id/delete',auth[_0xd39b('0x7')](),controller[_0xd39b('0xf')]);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 1950bbc..689d0c4 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 _0x687f=['substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','savePath'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x687f,0x113));var _0xf687=function(_0x3df223,_0x1740fc){_0x3df223=_0x3df223-0x0;var _0x562d11=_0x687f[_0x3df223];return _0x562d11;};'use strict';var Sequelize=require(_0xf687('0x0'));module[_0xf687('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf687('0x2')]},'calleridname':{'type':Sequelize[_0xf687('0x2')]},'context':{'type':Sequelize[_0xf687('0x2')]},'extension':{'type':Sequelize[_0xf687('0x2')]},'priority':{'type':Sequelize[_0xf687('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xf687('0x2')]},'projectName':{'type':Sequelize[_0xf687('0x2')]},'saveName':{'type':Sequelize[_0xf687('0x2')]},'filename':{'type':Sequelize[_0xf687('0x2')]},'savePath':{'type':Sequelize[_0xf687('0x2')]},'format':{'type':Sequelize[_0xf687('0x3')],'get':function(){var _0x28979b='';var _0x1ab59d=this['getDataValue'](_0xf687('0x4'));if(_0x1ab59d){_0x28979b=_0x1ab59d[_0xf687('0x5')](_0x1ab59d[_0xf687('0x6')]('.'));}return _0x28979b;}}}; \ No newline at end of file +var _0x6de2=['STRING','VIRTUAL','savePath','sequelize','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6de2,0x152));var _0x26de=function(_0x322171,_0x5de772){_0x322171=_0x322171-0x0;var _0xd779b2=_0x6de2[_0x322171];return _0xd779b2;};'use strict';var Sequelize=require(_0x26de('0x0'));module[_0x26de('0x1')]={'uniqueid':{'type':Sequelize[_0x26de('0x2')]},'callerid':{'type':Sequelize[_0x26de('0x2')]},'calleridname':{'type':Sequelize[_0x26de('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x26de('0x2')]},'priority':{'type':Sequelize[_0x26de('0x2')]},'accountcode':{'type':Sequelize[_0x26de('0x2')]},'dnid':{'type':Sequelize[_0x26de('0x2')]},'projectName':{'type':Sequelize[_0x26de('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x26de('0x2')]},'savePath':{'type':Sequelize[_0x26de('0x2')]},'format':{'type':Sequelize[_0x26de('0x3')],'get':function(){var _0x202f57='';var _0x48ddb0=this['getDataValue'](_0x26de('0x4'));if(_0x48ddb0){_0x202f57=_0x48ddb0['substring'](_0x48ddb0['lastIndexOf']('.'));}return _0x202f57;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 10b0d31..02b3940 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 _0x6a3e=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','SquareRecording','count','includeAll','include','findAll','rows','catch','show','intersection','options','find','create','body','update','params','download','uniqueid','savePath','filename','format','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','existsSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','set','apply','reject','save','then','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x30b861,_0x511cb0){var _0x28600d=function(_0x54aa03){while(--_0x54aa03){_0x30b861['push'](_0x30b861['shift']());}};_0x28600d(++_0x511cb0);}(_0x6a3e,0xe9));var _0xe6a3=function(_0x2791ee,_0x4495c7){_0x2791ee=_0x2791ee-0x0;var _0x5e20c8=_0x6a3e[_0x2791ee];return _0x5e20c8;};'use strict';var pdf=require(_0xe6a3('0x0'));var emlformat=require(_0xe6a3('0x1'));var rimraf=require(_0xe6a3('0x2'));var zipdir=require(_0xe6a3('0x3'));var jsonpatch=require(_0xe6a3('0x4'));var rp=require('request-promise');var moment=require(_0xe6a3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe6a3('0x6'));var util=require(_0xe6a3('0x7'));var path=require('path');var sox=require(_0xe6a3('0x8'));var csv=require(_0xe6a3('0x9'));var ejs=require(_0xe6a3('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe6a3('0xb'));var crypto=require(_0xe6a3('0xc'));var jsforce=require(_0xe6a3('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe6a3('0xe'));var Redis=require('ioredis');var authService=require(_0xe6a3('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6a3('0x10'));var logger=require('../../config/logger')(_0xe6a3('0x11'));var utils=require(_0xe6a3('0x12'));var config=require(_0xe6a3('0x13'));var db=require(_0xe6a3('0x14'))['db'];function respondWithStatusCode(_0x3d9e7c,_0x22b7b7){_0x22b7b7=_0x22b7b7||0xcc;return function(_0x366ce0){if(_0x366ce0){return _0x3d9e7c[_0xe6a3('0x15')](_0x22b7b7);}return _0x3d9e7c[_0xe6a3('0x16')](_0x22b7b7)['end']();};}function respondWithResult(_0x4c9d6d,_0x52f9ed){_0x52f9ed=_0x52f9ed||0xc8;return function(_0x43bfca){if(_0x43bfca){return _0x4c9d6d[_0xe6a3('0x16')](_0x52f9ed)['json'](_0x43bfca);}};}function respondWithFilteredResult(_0x2c0edf,_0x37f0c2){return function(_0x269d74){if(_0x269d74){var _0x5b6df4=_0x269d74['count'],_0x50a6c2=_0x37f0c2[_0xe6a3('0x17')],_0x52fcb1=_0x37f0c2[_0xe6a3('0x17')]+_0x37f0c2[_0xe6a3('0x18')],_0x163365;if(_0x52fcb1>=_0x5b6df4){_0x52fcb1=_0x5b6df4;_0x163365=0xc8;}else{_0x163365=0xce;}_0x2c0edf[_0xe6a3('0x16')](_0x163365);return _0x2c0edf[_0xe6a3('0x19')]('Content-Range',_0x50a6c2+'-'+_0x52fcb1+'/'+_0x5b6df4)['json'](_0x269d74);}return null;};}function patchUpdates(_0x1b6bab){return function(_0x444a5d){try{jsonpatch[_0xe6a3('0x1a')](_0x444a5d,_0x1b6bab,!![]);}catch(_0x342adc){return BPromise[_0xe6a3('0x1b')](_0x342adc);}return _0x444a5d[_0xe6a3('0x1c')]();};}function saveUpdates(_0x5a8fc7,_0x337f1a){return function(_0x882f65){if(_0x882f65){return _0x882f65['update'](_0x5a8fc7)[_0xe6a3('0x1d')](function(_0x35688c){return _0x35688c;});}return null;};}function removeEntity(_0xc46107,_0x227559){return function(_0xf84172){if(_0xf84172){return _0xf84172[_0xe6a3('0x1e')]()[_0xe6a3('0x1d')](function(){_0xc46107[_0xe6a3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8ff738,_0xb5052f){return function(_0x2bc095){if(!_0x2bc095){_0x8ff738['sendStatus'](0x194);}return _0x2bc095;};}function handleError(_0x1f0234,_0x1b9064){_0x1b9064=_0x1b9064||0x1f4;return function(_0x5812bf){logger['error'](_0x5812bf['stack']);if(_0x5812bf[_0xe6a3('0x1f')]){delete _0x5812bf[_0xe6a3('0x1f')];}_0x1f0234[_0xe6a3('0x16')](_0x1b9064)[_0xe6a3('0x20')](_0x5812bf);};}exports[_0xe6a3('0x21')]=function(_0x37a760,_0x3f8c2f){var _0x4c114d={},_0x174d93={},_0x27b06e={'count':0x0,'rows':[]};var _0x2356d2=_[_0xe6a3('0x22')](db['SquareRecording'][_0xe6a3('0x23')],function(_0x259753){return{'name':_0x259753[_0xe6a3('0x24')],'type':_0x259753[_0xe6a3('0x25')][_0xe6a3('0x26')]};});_0x174d93[_0xe6a3('0x27')]=_[_0xe6a3('0x22')](_0x2356d2,_0xe6a3('0x1f'));_0x174d93[_0xe6a3('0x28')]=_[_0xe6a3('0x29')](_0x37a760['query']);_0x174d93[_0xe6a3('0x2a')]=_['intersection'](_0x174d93[_0xe6a3('0x27')],_0x174d93[_0xe6a3('0x28')]);_0x4c114d[_0xe6a3('0x2b')]=_['intersection'](_0x174d93['model'],qs['fields'](_0x37a760[_0xe6a3('0x28')][_0xe6a3('0x2c')]));_0x4c114d[_0xe6a3('0x2b')]=_0x4c114d['attributes'][_0xe6a3('0x2d')]?_0x4c114d[_0xe6a3('0x2b')]:_0x174d93['model'];if(!_0x37a760[_0xe6a3('0x28')][_0xe6a3('0x2e')](_0xe6a3('0x2f'))){_0x4c114d[_0xe6a3('0x18')]=qs[_0xe6a3('0x18')](_0x37a760['query']['limit']);_0x4c114d['offset']=qs['offset'](_0x37a760['query'][_0xe6a3('0x17')]);}_0x4c114d[_0xe6a3('0x30')]=qs[_0xe6a3('0x31')](_0x37a760[_0xe6a3('0x28')][_0xe6a3('0x31')]);_0x4c114d[_0xe6a3('0x32')]=qs[_0xe6a3('0x2a')](_[_0xe6a3('0x33')](_0x37a760[_0xe6a3('0x28')],_0x174d93[_0xe6a3('0x2a')]));if(_0x37a760[_0xe6a3('0x28')][_0xe6a3('0x34')]){_0x4c114d[_0xe6a3('0x32')]=_[_0xe6a3('0x35')](_0x4c114d['where'],{'$or':_[_0xe6a3('0x22')](_0x2356d2,function(_0x2b877d){if(_0x2b877d[_0xe6a3('0x25')]!=='VIRTUAL'){var _0x199b91={};_0x199b91[_0x2b877d[_0xe6a3('0x1f')]]={'$like':'%'+_0x37a760[_0xe6a3('0x28')]['filter']+'%'};return _0x199b91;}})});}_0x4c114d=_['merge']({},_0x4c114d,_0x37a760['options']);var _0x291585={'where':_0x4c114d['where']};return db[_0xe6a3('0x36')][_0xe6a3('0x37')](_0x291585)[_0xe6a3('0x1d')](function(_0x16529e){_0x27b06e['count']=_0x16529e;if(_0x37a760[_0xe6a3('0x28')][_0xe6a3('0x38')]){_0x4c114d[_0xe6a3('0x39')]=[{'all':!![]}];}return db['SquareRecording'][_0xe6a3('0x3a')](_0x4c114d);})[_0xe6a3('0x1d')](function(_0x3e7358){_0x27b06e[_0xe6a3('0x3b')]=_0x3e7358;return _0x27b06e;})[_0xe6a3('0x1d')](respondWithFilteredResult(_0x3f8c2f,_0x4c114d))[_0xe6a3('0x3c')](handleError(_0x3f8c2f,null));};exports[_0xe6a3('0x3d')]=function(_0x145118,_0x3b5bb2){var _0x57c661={'raw':!![],'where':{'id':_0x145118['params']['id']}},_0xaa1669={};_0xaa1669[_0xe6a3('0x27')]=_[_0xe6a3('0x29')](db['SquareRecording']['rawAttributes']);_0xaa1669['query']=_['keys'](_0x145118['query']);_0xaa1669[_0xe6a3('0x2a')]=_[_0xe6a3('0x3e')](_0xaa1669[_0xe6a3('0x27')],_0xaa1669['query']);_0x57c661[_0xe6a3('0x2b')]=_[_0xe6a3('0x3e')](_0xaa1669['model'],qs[_0xe6a3('0x2c')](_0x145118['query']['fields']));_0x57c661[_0xe6a3('0x2b')]=_0x57c661[_0xe6a3('0x2b')]['length']?_0x57c661['attributes']:_0xaa1669['model'];if(_0x145118[_0xe6a3('0x28')][_0xe6a3('0x38')]){_0x57c661[_0xe6a3('0x39')]=[{'all':!![]}];}_0x57c661=_[_0xe6a3('0x35')]({},_0x57c661,_0x145118[_0xe6a3('0x3f')]);return db['SquareRecording'][_0xe6a3('0x40')](_0x57c661)[_0xe6a3('0x1d')](handleEntityNotFound(_0x3b5bb2,null))[_0xe6a3('0x1d')](respondWithResult(_0x3b5bb2,null))['catch'](handleError(_0x3b5bb2,null));};exports[_0xe6a3('0x41')]=function(_0x24e9dc,_0x5b4627){return db['SquareRecording'][_0xe6a3('0x41')](_0x24e9dc[_0xe6a3('0x42')],{})[_0xe6a3('0x1d')](respondWithResult(_0x5b4627,0xc9))[_0xe6a3('0x3c')](handleError(_0x5b4627,null));};exports[_0xe6a3('0x43')]=function(_0x574571,_0x1939fa){if(_0x574571[_0xe6a3('0x42')]['id']){delete _0x574571[_0xe6a3('0x42')]['id'];}return db[_0xe6a3('0x36')][_0xe6a3('0x40')]({'where':{'id':_0x574571[_0xe6a3('0x44')]['id']}})[_0xe6a3('0x1d')](handleEntityNotFound(_0x1939fa,null))['then'](saveUpdates(_0x574571[_0xe6a3('0x42')],null))[_0xe6a3('0x1d')](respondWithResult(_0x1939fa,null))[_0xe6a3('0x3c')](handleError(_0x1939fa,null));};exports[_0xe6a3('0x45')]=function(_0x10da2a,_0x4d1382,_0x2ec81a){var _0x444010=require('../../components/encryptor');var _0x1b1bc1=![];var _0x5a627b={};if(_0x10da2a['query']['type']&&_0x10da2a[_0xe6a3('0x28')][_0xe6a3('0x25')]===_0xe6a3('0x46')){_0x5a627b[_0xe6a3('0x46')]=_0x10da2a['params']['id'];}else{_0x5a627b['id']=_0x10da2a[_0xe6a3('0x44')]['id'];}return db['SquareRecording'][_0xe6a3('0x40')]({'where':_0x5a627b,'attributes':['id',_0xe6a3('0x47'),_0xe6a3('0x48')],'raw':!![]})[_0xe6a3('0x1d')](handleEntityNotFound(_0x4d1382,null))[_0xe6a3('0x1d')](function(_0x54857b){if(_0x54857b){var _0x5ed4cd=_0x54857b[_0xe6a3('0x47')];var _0x2d3887=util[_0xe6a3('0x49')]('%s.cypher',_0x5ed4cd);if(fs['existsSync'](_0x2d3887)){_0x1b1bc1=!![];return _0x444010[_0xe6a3('0x4a')](_0x2d3887,_0x5ed4cd,config[_0xe6a3('0x4b')][_0xe6a3('0x4c')])[_0xe6a3('0x1d')](function(){return _0x54857b;});}return _0x54857b;}})[_0xe6a3('0x1d')](function(_0x3d0a2c){if(_0x3d0a2c){var _0x4867e7=_0x3d0a2c[_0xe6a3('0x47')];if(!fs['existsSync'](_0x4867e7)){throw new db[(_0xe6a3('0x4d'))][(_0xe6a3('0x4e'))](_0xe6a3('0x4f'));}if(_0x3d0a2c[_0xe6a3('0x48')]){return _0x4d1382[_0xe6a3('0x45')](_0x4867e7,_0x3d0a2c[_0xe6a3('0x48')]+path['extname'](_0x4867e7),function(){if(_0x1b1bc1){fs[_0xe6a3('0x50')](_0x4867e7);}});}else{return _0x4d1382[_0xe6a3('0x45')](_0x4867e7,function(_0x3fcfde){if(_0x1b1bc1){fs[_0xe6a3('0x50')](_0x4867e7);}});}}})[_0xe6a3('0x3c')](function(_0x3416bf){if(_0x3416bf[_0xe6a3('0x51')]===_0xe6a3('0x4f')){_0x4d1382[_0xe6a3('0x16')](0x194)['send'](_0xe6a3('0x52'));}else{return handleError(_0x4d1382,null);}});};exports['destroy']=function(_0x1d3e20,_0x42d4e7){return db['SquareRecording']['find']({'where':{'id':_0x1d3e20[_0xe6a3('0x44')]['id']}})[_0xe6a3('0x1d')](function(_0x4d0f35){if(!_0x4d0f35)throw new ReferenceError(_0xe6a3('0x53'));return _0x4d0f35;})[_0xe6a3('0x1d')](function(_0x1a5314){var _0x5e1822=_0x1a5314[_0xe6a3('0x47')];logger[_0xe6a3('0x54')](_0xe6a3('0x55'),_0x5e1822);if(!_[_0xe6a3('0x56')](_0x1a5314[_0xe6a3('0x47')])&&fs[_0xe6a3('0x57')](_0x5e1822)){logger[_0xe6a3('0x54')](_0xe6a3('0x58')+_0x5e1822+_0xe6a3('0x59'));fs[_0xe6a3('0x5a')](_0x5e1822);}_0x5e1822=_0x5e1822+_0xe6a3('0x5b');if(!_[_0xe6a3('0x56')](_0x1a5314[_0xe6a3('0x47')])&&fs['existsSync'](_0x5e1822)){logger['info'](_0xe6a3('0x58')+_0x5e1822+_0xe6a3('0x59'));fs[_0xe6a3('0x5a')](_0x5e1822);}return _0x1a5314;})[_0xe6a3('0x1d')](function(_0x50226c){if(!_0x50226c)throw new InternalError();return _0x50226c[_0xe6a3('0x1e')]();})[_0xe6a3('0x1d')](function(){_0x42d4e7['status'](0xcc)['end']();})[_0xe6a3('0x3c')](handleError(_0x42d4e7,null));}; \ No newline at end of file +var _0x9b20=['includeAll','create','update','body','find','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','download','unlink','SquareRecording\x20not\x20found','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','then','end','error','stack','name','send','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','catch','show','params','SquareRecording'];(function(_0x36ef2c,_0x378575){var _0x345b23=function(_0x50e02e){while(--_0x50e02e){_0x36ef2c['push'](_0x36ef2c['shift']());}};_0x345b23(++_0x378575);}(_0x9b20,0x192));var _0x09b2=function(_0xa9d7d7,_0x193073){_0xa9d7d7=_0xa9d7d7-0x0;var _0x123d42=_0x9b20[_0xa9d7d7];return _0x123d42;};'use strict';var pdf=require(_0x09b2('0x0'));var emlformat=require(_0x09b2('0x1'));var rimraf=require(_0x09b2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x09b2('0x3'));var rp=require(_0x09b2('0x4'));var moment=require(_0x09b2('0x5'));var BPromise=require(_0x09b2('0x6'));var Mustache=require(_0x09b2('0x7'));var util=require('util');var path=require(_0x09b2('0x8'));var sox=require('sox');var csv=require(_0x09b2('0x9'));var ejs=require(_0x09b2('0xa'));var fs=require('fs');var _=require(_0x09b2('0xb'));var squel=require(_0x09b2('0xc'));var crypto=require(_0x09b2('0xd'));var jsforce=require(_0x09b2('0xe'));var deskjs=require(_0x09b2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x09b2('0x10'));var Papa=require(_0x09b2('0x11'));var Redis=require(_0x09b2('0x12'));var authService=require(_0x09b2('0x13'));var qs=require(_0x09b2('0x14'));var as=require(_0x09b2('0x15'));var hardwareService=require(_0x09b2('0x16'));var logger=require(_0x09b2('0x17'))(_0x09b2('0x18'));var utils=require(_0x09b2('0x19'));var config=require('../../config/environment');var db=require(_0x09b2('0x1a'))['db'];function respondWithStatusCode(_0x298a4a,_0x3249c6){_0x3249c6=_0x3249c6||0xcc;return function(_0x578c0e){if(_0x578c0e){return _0x298a4a[_0x09b2('0x1b')](_0x3249c6);}return _0x298a4a[_0x09b2('0x1c')](_0x3249c6)['end']();};}function respondWithResult(_0x1f9954,_0x123577){_0x123577=_0x123577||0xc8;return function(_0x186971){if(_0x186971){return _0x1f9954['status'](_0x123577)[_0x09b2('0x1d')](_0x186971);}};}function respondWithFilteredResult(_0x355c6b,_0x34e81d){return function(_0x513249){if(_0x513249){var _0x2d203b=_0x513249[_0x09b2('0x1e')],_0x427ec6=_0x34e81d[_0x09b2('0x1f')],_0x2b06e0=_0x34e81d[_0x09b2('0x1f')]+_0x34e81d[_0x09b2('0x20')],_0x152569;if(_0x2b06e0>=_0x2d203b){_0x2b06e0=_0x2d203b;_0x152569=0xc8;}else{_0x152569=0xce;}_0x355c6b[_0x09b2('0x1c')](_0x152569);return _0x355c6b[_0x09b2('0x21')](_0x09b2('0x22'),_0x427ec6+'-'+_0x2b06e0+'/'+_0x2d203b)['json'](_0x513249);}return null;};}function patchUpdates(_0x16884a){return function(_0x4485df){try{jsonpatch[_0x09b2('0x23')](_0x4485df,_0x16884a,!![]);}catch(_0x239c99){return BPromise['reject'](_0x239c99);}return _0x4485df[_0x09b2('0x24')]();};}function saveUpdates(_0x2aa819,_0x2aff0e){return function(_0x2c0ca9){if(_0x2c0ca9){return _0x2c0ca9['update'](_0x2aa819)['then'](function(_0x3922ac){return _0x3922ac;});}return null;};}function removeEntity(_0x101381,_0x58d68b){return function(_0x1a3f2c){if(_0x1a3f2c){return _0x1a3f2c['destroy']()[_0x09b2('0x25')](function(){_0x101381['status'](0xcc)[_0x09b2('0x26')]();});}};}function handleEntityNotFound(_0x3337fe,_0x4357a6){return function(_0x49dee1){if(!_0x49dee1){_0x3337fe[_0x09b2('0x1b')](0x194);}return _0x49dee1;};}function handleError(_0x57193c,_0x135ebb){_0x135ebb=_0x135ebb||0x1f4;return function(_0x4b64f9){logger[_0x09b2('0x27')](_0x4b64f9[_0x09b2('0x28')]);if(_0x4b64f9[_0x09b2('0x29')]){delete _0x4b64f9[_0x09b2('0x29')];}_0x57193c[_0x09b2('0x1c')](_0x135ebb)[_0x09b2('0x2a')](_0x4b64f9);};}exports['index']=function(_0x109e9e,_0x3e9603){var _0x5c493c={},_0x2a107a={},_0xf295c={'count':0x0,'rows':[]};var _0x2ba8c4=_[_0x09b2('0x2b')](db['SquareRecording'][_0x09b2('0x2c')],function(_0x42f983){return{'name':_0x42f983['fieldName'],'type':_0x42f983[_0x09b2('0x2d')]['key']};});_0x2a107a[_0x09b2('0x2e')]=_[_0x09b2('0x2b')](_0x2ba8c4,'name');_0x2a107a[_0x09b2('0x2f')]=_[_0x09b2('0x30')](_0x109e9e['query']);_0x2a107a[_0x09b2('0x31')]=_[_0x09b2('0x32')](_0x2a107a[_0x09b2('0x2e')],_0x2a107a['query']);_0x5c493c[_0x09b2('0x33')]=_[_0x09b2('0x32')](_0x2a107a['model'],qs[_0x09b2('0x34')](_0x109e9e[_0x09b2('0x2f')][_0x09b2('0x34')]));_0x5c493c[_0x09b2('0x33')]=_0x5c493c['attributes'][_0x09b2('0x35')]?_0x5c493c[_0x09b2('0x33')]:_0x2a107a['model'];if(!_0x109e9e[_0x09b2('0x2f')][_0x09b2('0x36')](_0x09b2('0x37'))){_0x5c493c[_0x09b2('0x20')]=qs[_0x09b2('0x20')](_0x109e9e[_0x09b2('0x2f')][_0x09b2('0x20')]);_0x5c493c[_0x09b2('0x1f')]=qs[_0x09b2('0x1f')](_0x109e9e['query'][_0x09b2('0x1f')]);}_0x5c493c[_0x09b2('0x38')]=qs['sort'](_0x109e9e[_0x09b2('0x2f')][_0x09b2('0x39')]);_0x5c493c[_0x09b2('0x3a')]=qs[_0x09b2('0x31')](_[_0x09b2('0x3b')](_0x109e9e[_0x09b2('0x2f')],_0x2a107a[_0x09b2('0x31')]));if(_0x109e9e[_0x09b2('0x2f')]['filter']){_0x5c493c[_0x09b2('0x3a')]=_[_0x09b2('0x3c')](_0x5c493c['where'],{'$or':_[_0x09b2('0x2b')](_0x2ba8c4,function(_0x1c0764){if(_0x1c0764[_0x09b2('0x2d')]!==_0x09b2('0x3d')){var _0x52aa81={};_0x52aa81[_0x1c0764[_0x09b2('0x29')]]={'$like':'%'+_0x109e9e['query']['filter']+'%'};return _0x52aa81;}})});}_0x5c493c=_[_0x09b2('0x3c')]({},_0x5c493c,_0x109e9e[_0x09b2('0x3e')]);var _0x225115={'where':_0x5c493c[_0x09b2('0x3a')]};return db['SquareRecording'][_0x09b2('0x1e')](_0x225115)[_0x09b2('0x25')](function(_0x4d8de4){_0xf295c['count']=_0x4d8de4;if(_0x109e9e[_0x09b2('0x2f')]['includeAll']){_0x5c493c[_0x09b2('0x3f')]=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x5c493c);})['then'](function(_0x2992d4){_0xf295c['rows']=_0x2992d4;return _0xf295c;})[_0x09b2('0x25')](respondWithFilteredResult(_0x3e9603,_0x5c493c))[_0x09b2('0x40')](handleError(_0x3e9603,null));};exports[_0x09b2('0x41')]=function(_0x4bf5b1,_0x3459a1){var _0x17bc66={'raw':!![],'where':{'id':_0x4bf5b1[_0x09b2('0x42')]['id']}},_0x2a8535={};_0x2a8535[_0x09b2('0x2e')]=_[_0x09b2('0x30')](db[_0x09b2('0x43')][_0x09b2('0x2c')]);_0x2a8535[_0x09b2('0x2f')]=_['keys'](_0x4bf5b1[_0x09b2('0x2f')]);_0x2a8535[_0x09b2('0x31')]=_[_0x09b2('0x32')](_0x2a8535[_0x09b2('0x2e')],_0x2a8535[_0x09b2('0x2f')]);_0x17bc66[_0x09b2('0x33')]=_[_0x09b2('0x32')](_0x2a8535[_0x09b2('0x2e')],qs[_0x09b2('0x34')](_0x4bf5b1['query'][_0x09b2('0x34')]));_0x17bc66[_0x09b2('0x33')]=_0x17bc66[_0x09b2('0x33')][_0x09b2('0x35')]?_0x17bc66[_0x09b2('0x33')]:_0x2a8535[_0x09b2('0x2e')];if(_0x4bf5b1[_0x09b2('0x2f')][_0x09b2('0x44')]){_0x17bc66[_0x09b2('0x3f')]=[{'all':!![]}];}_0x17bc66=_[_0x09b2('0x3c')]({},_0x17bc66,_0x4bf5b1['options']);return db[_0x09b2('0x43')]['find'](_0x17bc66)[_0x09b2('0x25')](handleEntityNotFound(_0x3459a1,null))[_0x09b2('0x25')](respondWithResult(_0x3459a1,null))[_0x09b2('0x40')](handleError(_0x3459a1,null));};exports[_0x09b2('0x45')]=function(_0x1a8ad1,_0x9cc171){return db[_0x09b2('0x43')][_0x09b2('0x45')](_0x1a8ad1['body'],{})['then'](respondWithResult(_0x9cc171,0xc9))['catch'](handleError(_0x9cc171,null));};exports[_0x09b2('0x46')]=function(_0x5f2ca8,_0x5d04ce){if(_0x5f2ca8[_0x09b2('0x47')]['id']){delete _0x5f2ca8['body']['id'];}return db[_0x09b2('0x43')][_0x09b2('0x48')]({'where':{'id':_0x5f2ca8[_0x09b2('0x42')]['id']}})[_0x09b2('0x25')](handleEntityNotFound(_0x5d04ce,null))[_0x09b2('0x25')](saveUpdates(_0x5f2ca8[_0x09b2('0x47')],null))[_0x09b2('0x25')](respondWithResult(_0x5d04ce,null))[_0x09b2('0x40')](handleError(_0x5d04ce,null));};exports['download']=function(_0x32244b,_0x52b06d,_0x633b46){var _0x3265aa=require(_0x09b2('0x49'));var _0x440cf2=![];var _0x15777d={};if(_0x32244b[_0x09b2('0x2f')][_0x09b2('0x2d')]&&_0x32244b[_0x09b2('0x2f')][_0x09b2('0x2d')]===_0x09b2('0x4a')){_0x15777d['uniqueid']=_0x32244b[_0x09b2('0x42')]['id'];}else{_0x15777d['id']=_0x32244b[_0x09b2('0x42')]['id'];}return db['SquareRecording']['find']({'where':_0x15777d,'attributes':['id',_0x09b2('0x4b'),_0x09b2('0x4c')],'raw':!![]})[_0x09b2('0x25')](handleEntityNotFound(_0x52b06d,null))[_0x09b2('0x25')](function(_0x4ff003){if(_0x4ff003){var _0x2e07cd=_0x4ff003['savePath'];var _0x1d06c8=util[_0x09b2('0x4d')](_0x09b2('0x4e'),_0x2e07cd);if(fs[_0x09b2('0x4f')](_0x1d06c8)){_0x440cf2=!![];return _0x3265aa['decryptFile'](_0x1d06c8,_0x2e07cd,config[_0x09b2('0x50')][_0x09b2('0x51')])[_0x09b2('0x25')](function(){return _0x4ff003;});}return _0x4ff003;}})[_0x09b2('0x25')](function(_0x32a344){if(_0x32a344){var _0x418e60=_0x32a344['savePath'];if(!fs[_0x09b2('0x4f')](_0x418e60)){throw new db[(_0x09b2('0x52'))][(_0x09b2('0x53'))]('SquareRecording\x20not\x20found');}if(_0x32a344[_0x09b2('0x4c')]){return _0x52b06d['download'](_0x418e60,_0x32a344[_0x09b2('0x4c')]+path['extname'](_0x418e60),function(){if(_0x440cf2){fs['unlink'](_0x418e60);}});}else{return _0x52b06d[_0x09b2('0x54')](_0x418e60,function(_0x56454f){if(_0x440cf2){fs[_0x09b2('0x55')](_0x418e60);}});}}})[_0x09b2('0x40')](function(_0x4c9d27){if(_0x4c9d27['message']===_0x09b2('0x56')){_0x52b06d[_0x09b2('0x1c')](0x194)['send']('Not\x20found');}else{return handleError(_0x52b06d,null);}});};exports['destroy']=function(_0x341240,_0x504aa4){return db[_0x09b2('0x43')][_0x09b2('0x48')]({'where':{'id':_0x341240['params']['id']}})[_0x09b2('0x25')](function(_0xc3831f){if(!_0xc3831f)throw new ReferenceError(_0x09b2('0x57'));return _0xc3831f;})['then'](function(_0x25d397){var _0x56fc07=_0x25d397[_0x09b2('0x4b')];logger[_0x09b2('0x58')]('cancellazione\x20fisica\x20documento\x20%s',_0x56fc07);if(!_['isNil'](_0x25d397[_0x09b2('0x4b')])&&fs[_0x09b2('0x4f')](_0x56fc07)){logger[_0x09b2('0x58')](_0x09b2('0x59')+_0x56fc07+_0x09b2('0x5a'));fs[_0x09b2('0x5b')](_0x56fc07);}_0x56fc07=_0x56fc07+'.cypher';if(!_[_0x09b2('0x5c')](_0x25d397['savePath'])&&fs[_0x09b2('0x4f')](_0x56fc07)){logger[_0x09b2('0x58')](_0x09b2('0x59')+_0x56fc07+_0x09b2('0x5a'));fs['unlinkSync'](_0x56fc07);}return _0x25d397;})[_0x09b2('0x25')](function(_0xfc7c6a){if(!_0xfc7c6a)throw new InternalError();return _0xfc7c6a[_0x09b2('0x5d')]();})[_0x09b2('0x25')](function(){_0x504aa4[_0x09b2('0x1c')](0xcc)[_0x09b2('0x26')]();})[_0x09b2('0x40')](handleError(_0x504aa4,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index fbd57ab..9c2ca24 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 _0x79a3=['./squareRecording.attributes','exports','lodash','../../config/logger','api','bluebird','../../config/environment'];(function(_0x19c46c,_0x70a6a0){var _0x4ca8f5=function(_0x9b008d){while(--_0x9b008d){_0x19c46c['push'](_0x19c46c['shift']());}};_0x4ca8f5(++_0x70a6a0);}(_0x79a3,0x80));var _0x379a=function(_0x186934,_0x235035){_0x186934=_0x186934-0x0;var _0x5f38b7=_0x79a3[_0x186934];return _0x5f38b7;};'use strict';var _=require(_0x379a('0x0'));var util=require('util');var logger=require(_0x379a('0x1'))(_0x379a('0x2'));var moment=require('moment');var BPromise=require(_0x379a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x379a('0x4'));var attributes=require(_0x379a('0x5'));module[_0x379a('0x6')]=function(_0x14907a,_0x9e6da6){return _0x14907a['define']('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68a5=['define','SquareRecording','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./squareRecording.attributes'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x68a5,0xfc));var _0x568a=function(_0x19a1e8,_0x255e19){_0x19a1e8=_0x19a1e8-0x0;var _0x45240b=_0x68a5[_0x19a1e8];return _0x45240b;};'use strict';var _=require(_0x568a('0x0'));var util=require('util');var logger=require(_0x568a('0x1'))(_0x568a('0x2'));var moment=require('moment');var BPromise=require(_0x568a('0x3'));var rp=require(_0x568a('0x4'));var fs=require('fs');var path=require(_0x568a('0x5'));var rimraf=require(_0x568a('0x6'));var config=require('../../config/environment');var attributes=require(_0x568a('0x7'));module['exports']=function(_0x26db0e,_0x467a4f){return _0x26db0e[_0x568a('0x8')](_0x568a('0x9'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 8c781ac..cacbef2 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 _0x47ab=['rpc','jayson/promise','client','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareRecording','SquareRecording','create','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x47ab,0x18d));var _0xb47a=function(_0x3642ab,_0x23d7f8){_0x3642ab=_0x3642ab-0x0;var _0x38e987=_0x47ab[_0x3642ab];return _0x38e987;};'use strict';var _=require(_0xb47a('0x0'));var util=require(_0xb47a('0x1'));var moment=require(_0xb47a('0x2'));var BPromise=require(_0xb47a('0x3'));var rs=require(_0xb47a('0x4'));var fs=require('fs');var Redis=require(_0xb47a('0x5'));var db=require(_0xb47a('0x6'))['db'];var utils=require(_0xb47a('0x7'));var logger=require('../../config/logger')(_0xb47a('0x8'));var config=require('../../config/environment');var jayson=require(_0xb47a('0x9'));var client=jayson[_0xb47a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17b7ec,_0x5cf991,_0x3ea685){return new BPromise(function(_0x50f6b7,_0x38354e){return client['request'](_0x17b7ec,_0x3ea685)[_0xb47a('0xb')](function(_0x393050){logger[_0xb47a('0xc')](_0xb47a('0xd'),_0x5cf991,_0xb47a('0xe'));logger[_0xb47a('0xf')](_0xb47a('0x10'),_0x5cf991,_0xb47a('0xe'),JSON[_0xb47a('0x11')](_0x393050));if(_0x393050[_0xb47a('0x12')]){if(_0x393050[_0xb47a('0x12')]['code']===0x1f4){logger[_0xb47a('0x12')](_0xb47a('0xd'),_0x5cf991,_0x393050['error'][_0xb47a('0x13')]);return _0x38354e(_0x393050['error'][_0xb47a('0x13')]);}logger['error'](_0xb47a('0xd'),_0x5cf991,_0x393050[_0xb47a('0x12')]['message']);return _0x50f6b7(_0x393050[_0xb47a('0x12')]['message']);}else{logger[_0xb47a('0xc')](_0xb47a('0xd'),_0x5cf991,'request\x20sent');_0x50f6b7(_0x393050[_0xb47a('0x14')][_0xb47a('0x13')]);}})[_0xb47a('0x15')](function(_0xb08b09){logger[_0xb47a('0x12')](_0xb47a('0xd'),_0x5cf991,_0xb08b09);_0x38354e(_0xb08b09);});});}exports[_0xb47a('0x16')]=function(_0x4fef3c){var _0x4b5b9e=this;return new Promise(function(_0x3733e3,_0x41f44a){return db[_0xb47a('0x17')][_0xb47a('0x18')](_0x4fef3c['body'],{'raw':_0x4fef3c[_0xb47a('0x19')]?_0x4fef3c[_0xb47a('0x19')][_0xb47a('0x1a')]===undefined?!![]:![]:!![]})[_0xb47a('0xb')](function(_0x5200a6){logger[_0xb47a('0xc')](_0xb47a('0x16'),_0x4fef3c);logger['debug'](_0xb47a('0x16'),_0x4fef3c,JSON[_0xb47a('0x11')](_0x5200a6));_0x3733e3(_0x5200a6);})[_0xb47a('0x15')](function(_0x4e9327){logger[_0xb47a('0x12')](_0xb47a('0x16'),_0x4e9327[_0xb47a('0x13')],_0x4fef3c);_0x41f44a(_0x4b5b9e[_0xb47a('0x12')](0x1f4,_0x4e9327[_0xb47a('0x13')]));});});}; \ No newline at end of file +var _0xf3b8=['request','info','SquareRecording,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','CreateSquareRecording','SquareRecording','body','options','raw','then','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x909dfe,_0x36e38a){var _0x5cb58f=function(_0x3f3000){while(--_0x3f3000){_0x909dfe['push'](_0x909dfe['shift']());}};_0x5cb58f(++_0x36e38a);}(_0xf3b8,0x12f));var _0x8f3b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xf3b8[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x8f3b('0x0'));var util=require('util');var moment=require(_0x8f3b('0x1'));var BPromise=require(_0x8f3b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f3b('0x3'));var db=require(_0x8f3b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f3b('0x5'))('rpc');var config=require(_0x8f3b('0x6'));var jayson=require(_0x8f3b('0x7'));var client=jayson[_0x8f3b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x362061,_0x33c106,_0x31344b){return new BPromise(function(_0x39d438,_0x966180){return client[_0x8f3b('0x9')](_0x362061,_0x31344b)['then'](function(_0x100854){logger[_0x8f3b('0xa')](_0x8f3b('0xb'),_0x33c106,'request\x20sent');logger[_0x8f3b('0xc')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x33c106,'request\x20sent',JSON[_0x8f3b('0xd')](_0x100854));if(_0x100854[_0x8f3b('0xe')]){if(_0x100854[_0x8f3b('0xe')][_0x8f3b('0xf')]===0x1f4){logger[_0x8f3b('0xe')](_0x8f3b('0xb'),_0x33c106,_0x100854['error'][_0x8f3b('0x10')]);return _0x966180(_0x100854[_0x8f3b('0xe')]['message']);}logger['error'](_0x8f3b('0xb'),_0x33c106,_0x100854['error'][_0x8f3b('0x10')]);return _0x39d438(_0x100854['error'][_0x8f3b('0x10')]);}else{logger['info'](_0x8f3b('0xb'),_0x33c106,_0x8f3b('0x11'));_0x39d438(_0x100854[_0x8f3b('0x12')][_0x8f3b('0x10')]);}})['catch'](function(_0x1e25eb){logger['error'](_0x8f3b('0xb'),_0x33c106,_0x1e25eb);_0x966180(_0x1e25eb);});});}exports[_0x8f3b('0x13')]=function(_0x56e8f1){var _0x3b4327=this;return new Promise(function(_0x313871,_0x5d4106){return db[_0x8f3b('0x14')]['create'](_0x56e8f1[_0x8f3b('0x15')],{'raw':_0x56e8f1[_0x8f3b('0x16')]?_0x56e8f1[_0x8f3b('0x16')][_0x8f3b('0x17')]===undefined?!![]:![]:!![]})[_0x8f3b('0x18')](function(_0x412ece){logger[_0x8f3b('0xa')](_0x8f3b('0x13'),_0x56e8f1);logger[_0x8f3b('0xc')](_0x8f3b('0x13'),_0x56e8f1,JSON['stringify'](_0x412ece));_0x313871(_0x412ece);})[_0x8f3b('0x19')](function(_0x4e35d0){logger[_0x8f3b('0xe')](_0x8f3b('0x13'),_0x4e35d0[_0x8f3b('0x10')],_0x56e8f1);_0x5d4106(_0x3b4327[_0x8f3b('0xe')](0x1f4,_0x4e35d0[_0x8f3b('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 708b9c8..34d201e 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 _0x0378=['show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0378,0x8c));var _0x8037=function(_0x100df7,_0x44b613){_0x100df7=_0x100df7-0x0;var _0x36568b=_0x0378[_0x100df7];return _0x36568b;};'use strict';var multer=require(_0x8037('0x0'));var util=require('util');var path=require(_0x8037('0x1'));var timeout=require(_0x8037('0x2'));var express=require(_0x8037('0x3'));var router=express[_0x8037('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8037('0x5'));var config=require('../../config/environment');var controller=require('./squareReport.controller');router[_0x8037('0x6')]('/',auth[_0x8037('0x7')](),controller[_0x8037('0x8')]);router['get'](_0x8037('0x9'),auth['isAuthenticated'](),controller[_0x8037('0xa')]);router[_0x8037('0x6')](_0x8037('0xb'),auth[_0x8037('0x7')](),controller[_0x8037('0xc')]);router[_0x8037('0xd')]('/',auth[_0x8037('0x7')](),controller[_0x8037('0xe')]);router[_0x8037('0xf')](_0x8037('0xb'),auth[_0x8037('0x7')](),controller[_0x8037('0x10')]);router['delete']('/:id',auth[_0x8037('0x7')](),controller[_0x8037('0x11')]);module[_0x8037('0x12')]=router; \ No newline at end of file +var _0xd478=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show','post','create','put','update'];(function(_0x501525,_0x4f222f){var _0x370f49=function(_0x5f5442){while(--_0x5f5442){_0x501525['push'](_0x501525['shift']());}};_0x370f49(++_0x4f222f);}(_0xd478,0xa1));var _0x8d47=function(_0x455ac0,_0x1d5f16){_0x455ac0=_0x455ac0-0x0;var _0xfb9257=_0xd478[_0x455ac0];return _0xfb9257;};'use strict';var multer=require(_0x8d47('0x0'));var util=require(_0x8d47('0x1'));var path=require('path');var timeout=require(_0x8d47('0x2'));var express=require(_0x8d47('0x3'));var router=express[_0x8d47('0x4')]();var auth=require(_0x8d47('0x5'));var interaction=require(_0x8d47('0x6'));var config=require(_0x8d47('0x7'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x8d47('0x8')](),controller[_0x8d47('0x9')]);router['get'](_0x8d47('0xa'),auth[_0x8d47('0x8')](),controller[_0x8d47('0xb')]);router[_0x8d47('0xc')](_0x8d47('0xd'),auth[_0x8d47('0x8')](),controller[_0x8d47('0xe')]);router[_0x8d47('0xf')]('/',auth[_0x8d47('0x8')](),controller[_0x8d47('0x10')]);router[_0x8d47('0x11')]('/:id',auth[_0x8d47('0x8')](),controller[_0x8d47('0x12')]);router['delete'](_0x8d47('0xd'),auth[_0x8d47('0x8')](),controller['destroy']);module[_0x8d47('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 200da81..d6ba72a 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 _0x68e7=['STRING','DATE','BOOLEAN','sequelize'];(function(_0x1d3546,_0x539c31){var _0x495482=function(_0x144467){while(--_0x144467){_0x1d3546['push'](_0x1d3546['shift']());}};_0x495482(++_0x539c31);}(_0x68e7,0xbb));var _0x768e=function(_0x463bda,_0x6db53f){_0x463bda=_0x463bda-0x0;var _0x4990bb=_0x68e7[_0x463bda];return _0x4990bb;};'use strict';var Sequelize=require(_0x768e('0x0'));module['exports']={'network':{'type':Sequelize[_0x768e('0x1')]},'network_script':{'type':Sequelize[_0x768e('0x1')]},'request':{'type':Sequelize[_0x768e('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x768e('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x768e('0x1')]},'version':{'type':Sequelize[_0x768e('0x1')]},'callerid':{'type':Sequelize[_0x768e('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x768e('0x1')]},'callington':{'type':Sequelize[_0x768e('0x1')]},'callingtns':{'type':Sequelize[_0x768e('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x768e('0x1')]},'extension':{'type':Sequelize[_0x768e('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x768e('0x1')]},'accountcode':{'type':Sequelize[_0x768e('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x768e('0x1')]},'joinAt':{'type':Sequelize[_0x768e('0x2')]},'leaveAt':{'type':Sequelize[_0x768e('0x2')]},'bot':{'type':Sequelize[_0x768e('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xedf8=['STRING','DATE','exports'];(function(_0x5b2537,_0x1768fa){var _0x5a30b7=function(_0x26211c){while(--_0x26211c){_0x5b2537['push'](_0x5b2537['shift']());}};_0x5a30b7(++_0x1768fa);}(_0xedf8,0x18b));var _0x8edf=function(_0x5d97a5,_0x48e47c){_0x5d97a5=_0x5d97a5-0x0;var _0x2beced=_0xedf8[_0x5d97a5];return _0x2beced;};'use strict';var Sequelize=require('sequelize');module[_0x8edf('0x0')]={'network':{'type':Sequelize[_0x8edf('0x1')]},'network_script':{'type':Sequelize[_0x8edf('0x1')]},'request':{'type':Sequelize[_0x8edf('0x1')]},'channel':{'type':Sequelize[_0x8edf('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8edf('0x1')]},'uniqueid':{'type':Sequelize[_0x8edf('0x1')]},'version':{'type':Sequelize[_0x8edf('0x1')]},'callerid':{'type':Sequelize[_0x8edf('0x1')]},'calleridname':{'type':Sequelize[_0x8edf('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x8edf('0x1')]},'callingtns':{'type':Sequelize[_0x8edf('0x1')]},'dnid':{'type':Sequelize[_0x8edf('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8edf('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x8edf('0x1')]},'enhanced':{'type':Sequelize[_0x8edf('0x1')]},'accountcode':{'type':Sequelize[_0x8edf('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8edf('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 48ac4f1..cd61df9 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 _0x1cb9=['end','json','count','offset','limit','set','apply','save','then','destroy','error','stack','index','map','SquareReport','rawAttributes','type','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','rows','catch','show','params','includeAll','options','find','create','body','update','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status'];(function(_0x232740,_0x748d7b){var _0x4cd790=function(_0x460554){while(--_0x460554){_0x232740['push'](_0x232740['shift']());}};_0x4cd790(++_0x748d7b);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3ae1f3,_0x1d7163){_0x3ae1f3=_0x3ae1f3-0x0;var _0x1f54c2=_0x1cb9[_0x3ae1f3];return _0x1f54c2;};'use strict';var pdf=require(_0x91cb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x91cb('0x1'));var zipdir=require(_0x91cb('0x2'));var jsonpatch=require(_0x91cb('0x3'));var rp=require(_0x91cb('0x4'));var moment=require('moment');var BPromise=require(_0x91cb('0x5'));var Mustache=require(_0x91cb('0x6'));var util=require('util');var path=require(_0x91cb('0x7'));var sox=require(_0x91cb('0x8'));var csv=require(_0x91cb('0x9'));var ejs=require(_0x91cb('0xa'));var fs=require('fs');var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x9'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c1f56,_0x366f09){_0x366f09=_0x366f09||0xcc;return function(_0x4ba2f2){if(_0x4ba2f2){return _0x3c1f56[_0x91cb('0x18')](_0x366f09);}return _0x3c1f56[_0x91cb('0x19')](_0x366f09)[_0x91cb('0x1a')]();};}function respondWithResult(_0x2c7d40,_0x4a7d45){_0x4a7d45=_0x4a7d45||0xc8;return function(_0x4cc6ef){if(_0x4cc6ef){return _0x2c7d40[_0x91cb('0x19')](_0x4a7d45)[_0x91cb('0x1b')](_0x4cc6ef);}};}function respondWithFilteredResult(_0x585470,_0x528f73){return function(_0x576369){if(_0x576369){var _0xc3629e=_0x576369[_0x91cb('0x1c')],_0x347980=_0x528f73['offset'],_0x5ea796=_0x528f73[_0x91cb('0x1d')]+_0x528f73[_0x91cb('0x1e')],_0x238f11;if(_0x5ea796>=_0xc3629e){_0x5ea796=_0xc3629e;_0x238f11=0xc8;}else{_0x238f11=0xce;}_0x585470[_0x91cb('0x19')](_0x238f11);return _0x585470[_0x91cb('0x1f')]('Content-Range',_0x347980+'-'+_0x5ea796+'/'+_0xc3629e)[_0x91cb('0x1b')](_0x576369);}return null;};}function patchUpdates(_0x7dcf60){return function(_0x4ca8e8){try{jsonpatch[_0x91cb('0x20')](_0x4ca8e8,_0x7dcf60,!![]);}catch(_0x4c9fb2){return BPromise['reject'](_0x4c9fb2);}return _0x4ca8e8[_0x91cb('0x21')]();};}function saveUpdates(_0x160ded,_0x56e409){return function(_0x51a1d5){if(_0x51a1d5){return _0x51a1d5['update'](_0x160ded)[_0x91cb('0x22')](function(_0x18827b){return _0x18827b;});}return null;};}function removeEntity(_0x20aff5,_0x1dbee2){return function(_0x5c6a15){if(_0x5c6a15){return _0x5c6a15[_0x91cb('0x23')]()[_0x91cb('0x22')](function(){_0x20aff5[_0x91cb('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(!_0x2447e7){_0x26f18f[_0x91cb('0x18')](0x194);}return _0x2447e7;};}function handleError(_0x3ca500,_0x7ad361){_0x7ad361=_0x7ad361||0x1f4;return function(_0x414e60){logger[_0x91cb('0x24')](_0x414e60[_0x91cb('0x25')]);if(_0x414e60['name']){delete _0x414e60['name'];}_0x3ca500[_0x91cb('0x19')](_0x7ad361)['send'](_0x414e60);};}exports[_0x91cb('0x26')]=function(_0x34d372,_0x318031){var _0x5595c5={},_0x9b26a6={},_0x4f5a7b={'count':0x0,'rows':[]};var _0x4572f6=_[_0x91cb('0x27')](db[_0x91cb('0x28')][_0x91cb('0x29')],function(_0x468908){return{'name':_0x468908['fieldName'],'type':_0x468908[_0x91cb('0x2a')]['key']};});_0x9b26a6[_0x91cb('0x2b')]=_[_0x91cb('0x27')](_0x4572f6,_0x91cb('0x2c'));_0x9b26a6['query']=_[_0x91cb('0x2d')](_0x34d372[_0x91cb('0x2e')]);_0x9b26a6[_0x91cb('0x2f')]=_[_0x91cb('0x30')](_0x9b26a6[_0x91cb('0x2b')],_0x9b26a6[_0x91cb('0x2e')]);_0x5595c5[_0x91cb('0x31')]=_[_0x91cb('0x30')](_0x9b26a6[_0x91cb('0x2b')],qs['fields'](_0x34d372[_0x91cb('0x2e')][_0x91cb('0x32')]));_0x5595c5[_0x91cb('0x31')]=_0x5595c5[_0x91cb('0x31')][_0x91cb('0x33')]?_0x5595c5['attributes']:_0x9b26a6[_0x91cb('0x2b')];if(!_0x34d372[_0x91cb('0x2e')][_0x91cb('0x34')](_0x91cb('0x35'))){_0x5595c5[_0x91cb('0x1e')]=qs['limit'](_0x34d372[_0x91cb('0x2e')]['limit']);_0x5595c5['offset']=qs['offset'](_0x34d372[_0x91cb('0x2e')]['offset']);}_0x5595c5[_0x91cb('0x36')]=qs['sort'](_0x34d372['query'][_0x91cb('0x37')]);_0x5595c5[_0x91cb('0x38')]=qs[_0x91cb('0x2f')](_[_0x91cb('0x39')](_0x34d372[_0x91cb('0x2e')],_0x9b26a6['filters']));if(_0x34d372[_0x91cb('0x2e')][_0x91cb('0x3a')]){_0x5595c5[_0x91cb('0x38')]=_[_0x91cb('0x3b')](_0x5595c5['where'],{'$or':_['map'](_0x4572f6,function(_0x1eed21){if(_0x1eed21[_0x91cb('0x2a')]!=='VIRTUAL'){var _0x39bd64={};_0x39bd64[_0x1eed21[_0x91cb('0x2c')]]={'$like':'%'+_0x34d372['query'][_0x91cb('0x3a')]+'%'};return _0x39bd64;}})});}_0x5595c5=_[_0x91cb('0x3b')]({},_0x5595c5,_0x34d372['options']);var _0x43d4fe={'where':_0x5595c5['where']};return db[_0x91cb('0x28')][_0x91cb('0x1c')](_0x43d4fe)[_0x91cb('0x22')](function(_0x279ad5){_0x4f5a7b[_0x91cb('0x1c')]=_0x279ad5;if(_0x34d372[_0x91cb('0x2e')]['includeAll']){_0x5595c5[_0x91cb('0x3c')]=[{'all':!![]}];}return db[_0x91cb('0x28')]['findAll'](_0x5595c5);})[_0x91cb('0x22')](function(_0x4ecbd7){_0x4f5a7b[_0x91cb('0x3d')]=_0x4ecbd7;return _0x4f5a7b;})[_0x91cb('0x22')](respondWithFilteredResult(_0x318031,_0x5595c5))[_0x91cb('0x3e')](handleError(_0x318031,null));};exports[_0x91cb('0x3f')]=function(_0x5e98c4,_0x435fff){var _0x5af0e6={'raw':!![],'where':{'id':_0x5e98c4[_0x91cb('0x40')]['id']}},_0x2cf27e={};_0x2cf27e[_0x91cb('0x2b')]=_[_0x91cb('0x2d')](db[_0x91cb('0x28')][_0x91cb('0x29')]);_0x2cf27e[_0x91cb('0x2e')]=_[_0x91cb('0x2d')](_0x5e98c4['query']);_0x2cf27e[_0x91cb('0x2f')]=_['intersection'](_0x2cf27e[_0x91cb('0x2b')],_0x2cf27e['query']);_0x5af0e6[_0x91cb('0x31')]=_['intersection'](_0x2cf27e[_0x91cb('0x2b')],qs[_0x91cb('0x32')](_0x5e98c4[_0x91cb('0x2e')][_0x91cb('0x32')]));_0x5af0e6['attributes']=_0x5af0e6[_0x91cb('0x31')][_0x91cb('0x33')]?_0x5af0e6['attributes']:_0x2cf27e[_0x91cb('0x2b')];if(_0x5e98c4[_0x91cb('0x2e')][_0x91cb('0x41')]){_0x5af0e6[_0x91cb('0x3c')]=[{'all':!![]}];}_0x5af0e6=_[_0x91cb('0x3b')]({},_0x5af0e6,_0x5e98c4[_0x91cb('0x42')]);return db[_0x91cb('0x28')][_0x91cb('0x43')](_0x5af0e6)[_0x91cb('0x22')](handleEntityNotFound(_0x435fff,null))['then'](respondWithResult(_0x435fff,null))[_0x91cb('0x3e')](handleError(_0x435fff,null));};exports[_0x91cb('0x44')]=function(_0x2b7323,_0x470996){return db[_0x91cb('0x28')][_0x91cb('0x44')](_0x2b7323[_0x91cb('0x45')],{})[_0x91cb('0x22')](respondWithResult(_0x470996,0xc9))['catch'](handleError(_0x470996,null));};exports[_0x91cb('0x46')]=function(_0x46caf1,_0x2b8b7f){if(_0x46caf1[_0x91cb('0x45')]['id']){delete _0x46caf1['body']['id'];}return db[_0x91cb('0x28')][_0x91cb('0x43')]({'where':{'id':_0x46caf1['params']['id']}})[_0x91cb('0x22')](handleEntityNotFound(_0x2b8b7f,null))['then'](saveUpdates(_0x46caf1[_0x91cb('0x45')],null))['then'](respondWithResult(_0x2b8b7f,null))['catch'](handleError(_0x2b8b7f,null));};exports['destroy']=function(_0x98245b,_0xff3d11){return db[_0x91cb('0x28')][_0x91cb('0x43')]({'where':{'id':_0x98245b[_0x91cb('0x40')]['id']}})['then'](handleEntityNotFound(_0xff3d11,null))['then'](removeEntity(_0xff3d11,null))[_0x91cb('0x3e')](handleError(_0xff3d11,null));};exports[_0x91cb('0x47')]=function(_0x140994,_0x14eaab){return db['SquareReport']['describe']()['then'](respondWithResult(_0x14eaab,null))[_0x91cb('0x3e')](handleError(_0x14eaab,null));}; \ No newline at end of file +var _0x1261=['model','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','merge','options','includeAll','findAll','rows','show','params','keys','length','include','catch','create','body','update','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','error','stack','name','index','SquareReport','rawAttributes','fieldName','key','map','query','intersection'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x1261,0x144));var _0x1126=function(_0x1aa883,_0x50f53b){_0x1aa883=_0x1aa883-0x0;var _0x5e9fb5=_0x1261[_0x1aa883];return _0x5e9fb5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1126('0x0'));var rimraf=require(_0x1126('0x1'));var zipdir=require(_0x1126('0x2'));var jsonpatch=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var moment=require(_0x1126('0x5'));var BPromise=require(_0x1126('0x6'));var Mustache=require(_0x1126('0x7'));var util=require(_0x1126('0x8'));var path=require(_0x1126('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1126('0xa'));var fs=require('fs');var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var db=require(_0x1126('0x16'))['db'];function respondWithStatusCode(_0x1b364a,_0xd26a32){_0xd26a32=_0xd26a32||0xcc;return function(_0x273896){if(_0x273896){return _0x1b364a[_0x1126('0x17')](_0xd26a32);}return _0x1b364a[_0x1126('0x18')](_0xd26a32)[_0x1126('0x19')]();};}function respondWithResult(_0x2048ad,_0x43850b){_0x43850b=_0x43850b||0xc8;return function(_0x53a8f0){if(_0x53a8f0){return _0x2048ad['status'](_0x43850b)[_0x1126('0x1a')](_0x53a8f0);}};}function respondWithFilteredResult(_0x154e20,_0x279455){return function(_0x4be0c6){if(_0x4be0c6){var _0x45149c=_0x4be0c6[_0x1126('0x1b')],_0x4794a7=_0x279455['offset'],_0x35fe9f=_0x279455[_0x1126('0x1c')]+_0x279455[_0x1126('0x1d')],_0x42f379;if(_0x35fe9f>=_0x45149c){_0x35fe9f=_0x45149c;_0x42f379=0xc8;}else{_0x42f379=0xce;}_0x154e20['status'](_0x42f379);return _0x154e20['set'](_0x1126('0x1e'),_0x4794a7+'-'+_0x35fe9f+'/'+_0x45149c)[_0x1126('0x1a')](_0x4be0c6);}return null;};}function patchUpdates(_0x58d11a){return function(_0x548359){try{jsonpatch[_0x1126('0x1f')](_0x548359,_0x58d11a,!![]);}catch(_0x58b109){return BPromise[_0x1126('0x20')](_0x58b109);}return _0x548359[_0x1126('0x21')]();};}function saveUpdates(_0x2f70ac,_0x54400a){return function(_0x2a08ba){if(_0x2a08ba){return _0x2a08ba['update'](_0x2f70ac)['then'](function(_0x30f6b3){return _0x30f6b3;});}return null;};}function removeEntity(_0x3a9bed,_0x25b24b){return function(_0x36d254){if(_0x36d254){return _0x36d254['destroy']()[_0x1126('0x22')](function(){_0x3a9bed[_0x1126('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(!_0x529dd9){_0x2175fa['sendStatus'](0x194);}return _0x529dd9;};}function handleError(_0x2199d9,_0x15bcc3){_0x15bcc3=_0x15bcc3||0x1f4;return function(_0x329914){logger[_0x1126('0x23')](_0x329914[_0x1126('0x24')]);if(_0x329914[_0x1126('0x25')]){delete _0x329914[_0x1126('0x25')];}_0x2199d9[_0x1126('0x18')](_0x15bcc3)['send'](_0x329914);};}exports[_0x1126('0x26')]=function(_0x375e59,_0xa293f4){var _0x5ddf63={},_0x541bc9={},_0xeb7d89={'count':0x0,'rows':[]};var _0x39bf0e=_['map'](db[_0x1126('0x27')][_0x1126('0x28')],function(_0x4a334a){return{'name':_0x4a334a[_0x1126('0x29')],'type':_0x4a334a['type'][_0x1126('0x2a')]};});_0x541bc9['model']=_[_0x1126('0x2b')](_0x39bf0e,'name');_0x541bc9[_0x1126('0x2c')]=_['keys'](_0x375e59['query']);_0x541bc9['filters']=_[_0x1126('0x2d')](_0x541bc9[_0x1126('0x2e')],_0x541bc9[_0x1126('0x2c')]);_0x5ddf63['attributes']=_[_0x1126('0x2d')](_0x541bc9[_0x1126('0x2e')],qs['fields'](_0x375e59[_0x1126('0x2c')][_0x1126('0x2f')]));_0x5ddf63[_0x1126('0x30')]=_0x5ddf63[_0x1126('0x30')]['length']?_0x5ddf63['attributes']:_0x541bc9[_0x1126('0x2e')];if(!_0x375e59[_0x1126('0x2c')][_0x1126('0x31')](_0x1126('0x32'))){_0x5ddf63['limit']=qs[_0x1126('0x1d')](_0x375e59[_0x1126('0x2c')][_0x1126('0x1d')]);_0x5ddf63[_0x1126('0x1c')]=qs[_0x1126('0x1c')](_0x375e59['query'][_0x1126('0x1c')]);}_0x5ddf63[_0x1126('0x33')]=qs[_0x1126('0x34')](_0x375e59[_0x1126('0x2c')]['sort']);_0x5ddf63['where']=qs[_0x1126('0x35')](_[_0x1126('0x36')](_0x375e59['query'],_0x541bc9[_0x1126('0x35')]));if(_0x375e59[_0x1126('0x2c')][_0x1126('0x37')]){_0x5ddf63['where']=_['merge'](_0x5ddf63[_0x1126('0x38')],{'$or':_[_0x1126('0x2b')](_0x39bf0e,function(_0x3aa08f){if(_0x3aa08f[_0x1126('0x39')]!=='VIRTUAL'){var _0x428d3d={};_0x428d3d[_0x3aa08f['name']]={'$like':'%'+_0x375e59[_0x1126('0x2c')][_0x1126('0x37')]+'%'};return _0x428d3d;}})});}_0x5ddf63=_[_0x1126('0x3a')]({},_0x5ddf63,_0x375e59[_0x1126('0x3b')]);var _0x57e5d2={'where':_0x5ddf63['where']};return db[_0x1126('0x27')][_0x1126('0x1b')](_0x57e5d2)[_0x1126('0x22')](function(_0x397e3b){_0xeb7d89[_0x1126('0x1b')]=_0x397e3b;if(_0x375e59[_0x1126('0x2c')][_0x1126('0x3c')]){_0x5ddf63['include']=[{'all':!![]}];}return db[_0x1126('0x27')][_0x1126('0x3d')](_0x5ddf63);})[_0x1126('0x22')](function(_0xf3a0bd){_0xeb7d89[_0x1126('0x3e')]=_0xf3a0bd;return _0xeb7d89;})['then'](respondWithFilteredResult(_0xa293f4,_0x5ddf63))['catch'](handleError(_0xa293f4,null));};exports[_0x1126('0x3f')]=function(_0x219bcc,_0xcee9de){var _0x21c38e={'raw':!![],'where':{'id':_0x219bcc[_0x1126('0x40')]['id']}},_0x18b496={};_0x18b496['model']=_['keys'](db['SquareReport'][_0x1126('0x28')]);_0x18b496['query']=_[_0x1126('0x41')](_0x219bcc[_0x1126('0x2c')]);_0x18b496[_0x1126('0x35')]=_[_0x1126('0x2d')](_0x18b496['model'],_0x18b496['query']);_0x21c38e[_0x1126('0x30')]=_[_0x1126('0x2d')](_0x18b496[_0x1126('0x2e')],qs['fields'](_0x219bcc[_0x1126('0x2c')]['fields']));_0x21c38e[_0x1126('0x30')]=_0x21c38e['attributes'][_0x1126('0x42')]?_0x21c38e[_0x1126('0x30')]:_0x18b496[_0x1126('0x2e')];if(_0x219bcc['query'][_0x1126('0x3c')]){_0x21c38e[_0x1126('0x43')]=[{'all':!![]}];}_0x21c38e=_[_0x1126('0x3a')]({},_0x21c38e,_0x219bcc['options']);return db['SquareReport']['find'](_0x21c38e)[_0x1126('0x22')](handleEntityNotFound(_0xcee9de,null))['then'](respondWithResult(_0xcee9de,null))[_0x1126('0x44')](handleError(_0xcee9de,null));};exports['create']=function(_0x2f45b9,_0x323499){return db[_0x1126('0x27')][_0x1126('0x45')](_0x2f45b9[_0x1126('0x46')],{})['then'](respondWithResult(_0x323499,0xc9))[_0x1126('0x44')](handleError(_0x323499,null));};exports[_0x1126('0x47')]=function(_0x5111d3,_0x1a15f8){if(_0x5111d3[_0x1126('0x46')]['id']){delete _0x5111d3['body']['id'];}return db[_0x1126('0x27')][_0x1126('0x48')]({'where':{'id':_0x5111d3['params']['id']}})[_0x1126('0x22')](handleEntityNotFound(_0x1a15f8,null))[_0x1126('0x22')](saveUpdates(_0x5111d3[_0x1126('0x46')],null))['then'](respondWithResult(_0x1a15f8,null))[_0x1126('0x44')](handleError(_0x1a15f8,null));};exports[_0x1126('0x49')]=function(_0x411c89,_0x5878bb){return db[_0x1126('0x27')][_0x1126('0x48')]({'where':{'id':_0x411c89[_0x1126('0x40')]['id']}})[_0x1126('0x22')](handleEntityNotFound(_0x5878bb,null))['then'](removeEntity(_0x5878bb,null))[_0x1126('0x44')](handleError(_0x5878bb,null));};exports['describe']=function(_0x40168e,_0x2ad118){return db['SquareReport']['describe']()[_0x1126('0x22')](respondWithResult(_0x2ad118,null))[_0x1126('0x44')](handleError(_0x2ad118,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index e56bfbf..113cb01 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 _0x0af6=['bluebird','path','rimraf','../../config/environment','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','../../config/logger','api','moment'];(function(_0x4fc293,_0x128084){var _0x32394c=function(_0x5a1442){while(--_0x5a1442){_0x4fc293['push'](_0x4fc293['shift']());}};_0x32394c(++_0x128084);}(_0x0af6,0xed));var _0x60af=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x0af6[_0x2064e5];return _0x21a233;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x60af('0x0'))(_0x60af('0x1'));var moment=require(_0x60af('0x2'));var BPromise=require(_0x60af('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x60af('0x4'));var rimraf=require(_0x60af('0x5'));var config=require(_0x60af('0x6'));var attributes=require('./squareReport.attributes');module[_0x60af('0x7')]=function(_0x1240d8,_0x5eb31d){return _0x1240d8[_0x60af('0x8')](_0x60af('0x9'),attributes,{'tableName':_0x60af('0xa'),'paranoid':![],'indexes':[{'name':_0x60af('0xb'),'fields':[_0x60af('0xc'),_0x60af('0xd')]},{'name':'leaveAt','fields':[_0x60af('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9aba=['../../config/logger','api','moment','bluebird','path','../../config/environment','./squareReport.attributes','exports','uid_pname','project_name','leaveAt','lodash','util'];(function(_0x2c0fbe,_0x104d76){var _0x18ecdd=function(_0x297a51){while(--_0x297a51){_0x2c0fbe['push'](_0x2c0fbe['shift']());}};_0x18ecdd(++_0x104d76);}(_0x9aba,0x1c5));var _0xa9ab=function(_0x1cab49,_0x372fa3){_0x1cab49=_0x1cab49-0x0;var _0x535677=_0x9aba[_0x1cab49];return _0x535677;};'use strict';var _=require(_0xa9ab('0x0'));var util=require(_0xa9ab('0x1'));var logger=require(_0xa9ab('0x2'))(_0xa9ab('0x3'));var moment=require(_0xa9ab('0x4'));var BPromise=require(_0xa9ab('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa9ab('0x6'));var rimraf=require('rimraf');var config=require(_0xa9ab('0x7'));var attributes=require(_0xa9ab('0x8'));module[_0xa9ab('0x9')]=function(_0x5c16f8,_0x4b543c){return _0x5c16f8['define']('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xa9ab('0xa'),'fields':['uniqueid',_0xa9ab('0xb')]},{'name':_0xa9ab('0xc'),'fields':[_0xa9ab('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 60777d1..a7720e2 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 _0xa208=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','SquareReport,\x20%s,\x20%s','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareReport','create','body','options','CreateSquareReport','debug','update','raw','where','attributes','limit','UpdateSquareReport'];(function(_0x4c6e06,_0x43e49d){var _0x59f589=function(_0x5e8e17){while(--_0x5e8e17){_0x4c6e06['push'](_0x4c6e06['shift']());}};_0x59f589(++_0x43e49d);}(_0xa208,0x13b));var _0x8a20=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa208[_0x138f59];return _0x3d114d;};'use strict';var _=require(_0x8a20('0x0'));var util=require(_0x8a20('0x1'));var moment=require(_0x8a20('0x2'));var BPromise=require(_0x8a20('0x3'));var rs=require(_0x8a20('0x4'));var fs=require('fs');var Redis=require(_0x8a20('0x5'));var db=require(_0x8a20('0x6'))['db'];var utils=require(_0x8a20('0x7'));var logger=require(_0x8a20('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8a20('0x9'));var client=jayson['client'][_0x8a20('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa406a2,_0x481ce8,_0x532cb7){return new BPromise(function(_0xd67b4c,_0x38f5b2){return client[_0x8a20('0xb')](_0xa406a2,_0x532cb7)[_0x8a20('0xc')](function(_0x4993d5){logger[_0x8a20('0xd')](_0x8a20('0xe'),_0x481ce8,'request\x20sent');logger['debug'](_0x8a20('0xf'),_0x481ce8,_0x8a20('0x10'),JSON[_0x8a20('0x11')](_0x4993d5));if(_0x4993d5[_0x8a20('0x12')]){if(_0x4993d5[_0x8a20('0x12')][_0x8a20('0x13')]===0x1f4){logger[_0x8a20('0x12')](_0x8a20('0xe'),_0x481ce8,_0x4993d5[_0x8a20('0x12')]['message']);return _0x38f5b2(_0x4993d5[_0x8a20('0x12')]['message']);}logger['error'](_0x8a20('0xe'),_0x481ce8,_0x4993d5['error'][_0x8a20('0x14')]);return _0xd67b4c(_0x4993d5[_0x8a20('0x12')][_0x8a20('0x14')]);}else{logger['info'](_0x8a20('0xe'),_0x481ce8,_0x8a20('0x10'));_0xd67b4c(_0x4993d5[_0x8a20('0x15')][_0x8a20('0x14')]);}})[_0x8a20('0x16')](function(_0x291e19){logger['error'](_0x8a20('0xe'),_0x481ce8,_0x291e19);_0x38f5b2(_0x291e19);});});}exports['CreateSquareReport']=function(_0x5ddcca){var _0x38f717=this;return new Promise(function(_0xfb72ba,_0x4e9d07){return db[_0x8a20('0x17')][_0x8a20('0x18')](_0x5ddcca[_0x8a20('0x19')],{'raw':_0x5ddcca[_0x8a20('0x1a')]?_0x5ddcca[_0x8a20('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x8a20('0xc')](function(_0x20a838){logger['info'](_0x8a20('0x1b'),_0x5ddcca);logger[_0x8a20('0x1c')](_0x8a20('0x1b'),_0x5ddcca,JSON[_0x8a20('0x11')](_0x20a838));_0xfb72ba(_0x20a838);})['catch'](function(_0x41a5b5){logger[_0x8a20('0x12')](_0x8a20('0x1b'),_0x41a5b5[_0x8a20('0x14')],_0x5ddcca);_0x4e9d07(_0x38f717['error'](0x1f4,_0x41a5b5['message']));});});};exports['UpdateSquareReport']=function(_0x516086){var _0x267e8e=this;return new Promise(function(_0x4972bf,_0x522a9c){return db[_0x8a20('0x17')][_0x8a20('0x1d')](_0x516086[_0x8a20('0x19')],{'raw':_0x516086['options']?_0x516086[_0x8a20('0x1a')][_0x8a20('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x516086['options']?_0x516086['options'][_0x8a20('0x1f')]||null:null,'attributes':_0x516086['options']?_0x516086['options'][_0x8a20('0x20')]||null:null,'limit':_0x516086[_0x8a20('0x1a')]?_0x516086['options'][_0x8a20('0x21')]||null:null})[_0x8a20('0xc')](function(_0x2977e5){logger[_0x8a20('0xd')](_0x8a20('0x22'),_0x516086);logger[_0x8a20('0x1c')](_0x8a20('0x22'),_0x516086,JSON[_0x8a20('0x11')](_0x2977e5));_0x4972bf(_0x2977e5);})['catch'](function(_0x168e0b){logger[_0x8a20('0x12')](_0x8a20('0x22'),_0x168e0b[_0x8a20('0x14')],_0x516086);_0x522a9c(_0x267e8e[_0x8a20('0x12')](0x1f4,_0x168e0b[_0x8a20('0x14')]));});});}; \ No newline at end of file +var _0xb897=['info','request\x20sent','debug','stringify','error','code','SquareReport,\x20%s,\x20%s','message','result','catch','CreateSquareReport','create','body','options','raw','then','UpdateSquareReport','SquareReport','update','where','lodash','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request'];(function(_0x2971e2,_0x4bffb6){var _0x56f67b=function(_0x5f0a73){while(--_0x5f0a73){_0x2971e2['push'](_0x2971e2['shift']());}};_0x56f67b(++_0x4bffb6);}(_0xb897,0x19a));var _0x7b89=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xb897[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7b89('0x0'));var util=require('util');var moment=require(_0x7b89('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b89('0x2'));var fs=require('fs');var Redis=require(_0x7b89('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b89('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x7b89('0x5'));var jayson=require(_0x7b89('0x6'));var client=jayson[_0x7b89('0x7')][_0x7b89('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x432d95,_0x56edd6,_0x2b34f3){return new BPromise(function(_0x23de2c,_0x27c751){return client[_0x7b89('0x9')](_0x432d95,_0x2b34f3)['then'](function(_0xc0419){logger[_0x7b89('0xa')]('SquareReport,\x20%s,\x20%s',_0x56edd6,_0x7b89('0xb'));logger[_0x7b89('0xc')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x56edd6,_0x7b89('0xb'),JSON[_0x7b89('0xd')](_0xc0419));if(_0xc0419[_0x7b89('0xe')]){if(_0xc0419[_0x7b89('0xe')][_0x7b89('0xf')]===0x1f4){logger[_0x7b89('0xe')](_0x7b89('0x10'),_0x56edd6,_0xc0419['error'][_0x7b89('0x11')]);return _0x27c751(_0xc0419[_0x7b89('0xe')][_0x7b89('0x11')]);}logger['error'](_0x7b89('0x10'),_0x56edd6,_0xc0419['error']['message']);return _0x23de2c(_0xc0419['error'][_0x7b89('0x11')]);}else{logger['info']('SquareReport,\x20%s,\x20%s',_0x56edd6,_0x7b89('0xb'));_0x23de2c(_0xc0419[_0x7b89('0x12')][_0x7b89('0x11')]);}})[_0x7b89('0x13')](function(_0xac8b8a){logger[_0x7b89('0xe')](_0x7b89('0x10'),_0x56edd6,_0xac8b8a);_0x27c751(_0xac8b8a);});});}exports[_0x7b89('0x14')]=function(_0x20d862){var _0x34da1c=this;return new Promise(function(_0x48d7f3,_0x42d7cd){return db['SquareReport'][_0x7b89('0x15')](_0x20d862[_0x7b89('0x16')],{'raw':_0x20d862[_0x7b89('0x17')]?_0x20d862[_0x7b89('0x17')][_0x7b89('0x18')]===undefined?!![]:![]:!![]})[_0x7b89('0x19')](function(_0x1f7c05){logger[_0x7b89('0xa')](_0x7b89('0x14'),_0x20d862);logger[_0x7b89('0xc')]('CreateSquareReport',_0x20d862,JSON[_0x7b89('0xd')](_0x1f7c05));_0x48d7f3(_0x1f7c05);})[_0x7b89('0x13')](function(_0xc78fd0){logger['error']('CreateSquareReport',_0xc78fd0[_0x7b89('0x11')],_0x20d862);_0x42d7cd(_0x34da1c[_0x7b89('0xe')](0x1f4,_0xc78fd0[_0x7b89('0x11')]));});});};exports[_0x7b89('0x1a')]=function(_0x4d90eb){var _0x580568=this;return new Promise(function(_0x4d3e38,_0x5de111){return db[_0x7b89('0x1b')][_0x7b89('0x1c')](_0x4d90eb[_0x7b89('0x16')],{'raw':_0x4d90eb[_0x7b89('0x17')]?_0x4d90eb[_0x7b89('0x17')][_0x7b89('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d90eb[_0x7b89('0x17')]?_0x4d90eb[_0x7b89('0x17')][_0x7b89('0x1d')]||null:null,'attributes':_0x4d90eb[_0x7b89('0x17')]?_0x4d90eb['options']['attributes']||null:null,'limit':_0x4d90eb[_0x7b89('0x17')]?_0x4d90eb['options']['limit']||null:null})[_0x7b89('0x19')](function(_0x14b23c){logger[_0x7b89('0xa')]('UpdateSquareReport',_0x4d90eb);logger[_0x7b89('0xc')]('UpdateSquareReport',_0x4d90eb,JSON[_0x7b89('0xd')](_0x14b23c));_0x4d3e38(_0x14b23c);})['catch'](function(_0xafffa1){logger[_0x7b89('0xe')](_0x7b89('0x1a'),_0xafffa1[_0x7b89('0x11')],_0x4d90eb);_0x5de111(_0x580568[_0x7b89('0xe')](0x1f4,_0xafffa1['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 1ea8100..2b5369e 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 _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x814b,0x1a2));var _0xb814=function(_0x3ec333,_0x26bcbe){_0x3ec333=_0x3ec333-0x0;var _0x15ccb8=_0x814b[_0x3ec333];return _0x15ccb8;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['describe']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xd'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file +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(_0x144b25,_0x58db9d){var _0xce094=function(_0xd8f4bc){while(--_0xd8f4bc){_0x144b25['push'](_0x144b25['shift']());}};_0xce094(++_0x58db9d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x59a82e,_0x1518b9){_0x59a82e=_0x59a82e-0x0;var _0x24f7e1=_0x5f2f[_0x59a82e];return _0x24f7e1;};'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 f1bdb12..d78127b 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 _0x2a45=['exports','STRING','TEXT','sequelize'];(function(_0x40017b,_0x29eea0){var _0x43c057=function(_0x54b75a){while(--_0x54b75a){_0x40017b['push'](_0x40017b['shift']());}};_0x43c057(++_0x29eea0);}(_0x2a45,0x133));var _0x52a4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x2a45[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require(_0x52a4('0x0'));module[_0x52a4('0x1')]={'uniqueid':{'type':Sequelize[_0x52a4('0x2')]},'node':{'type':Sequelize[_0x52a4('0x2')]},'application':{'type':Sequelize[_0x52a4('0x2')]},'data':{'type':Sequelize[_0x52a4('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x52a4('0x2')]}}; \ No newline at end of file +var _0xaa92=['TEXT','sequelize','exports','STRING'];(function(_0x9e2f8b,_0x304317){var _0x4152e9=function(_0x409677){while(--_0x409677){_0x9e2f8b['push'](_0x9e2f8b['shift']());}};_0x4152e9(++_0x304317);}(_0xaa92,0xe9));var _0x2aa9=function(_0x102881,_0x58d723){_0x102881=_0x102881-0x0;var _0x5c63d0=_0xaa92[_0x102881];return _0x5c63d0;};'use strict';var Sequelize=require(_0x2aa9('0x0'));module[_0x2aa9('0x1')]={'uniqueid':{'type':Sequelize[_0x2aa9('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x2aa9('0x3')]},'project_name':{'type':Sequelize[_0x2aa9('0x2')]},'callerid':{'type':Sequelize[_0x2aa9('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 1a7aee8..df8d7dc 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 _0x4c89=['findAll','rows','catch','show','params','keys','fields','includeAll','include','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','index','SquareDetailsReport','rawAttributes','fieldName','type','key','model','name','query','attributes','intersection','hasOwnProperty','order','sort','where','filters','pick','filter','merge'];(function(_0x3ca115,_0x286520){var _0x1538bc=function(_0x2f891b){while(--_0x2f891b){_0x3ca115['push'](_0x3ca115['shift']());}};_0x1538bc(++_0x286520);}(_0x4c89,0x1c9));var _0x94c8=function(_0x342e03,_0x3f9210){_0x342e03=_0x342e03-0x0;var _0x5eeb14=_0x4c89[_0x342e03];return _0x5eeb14;};'use strict';var pdf=require(_0x94c8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x94c8('0x1'));var zipdir=require(_0x94c8('0x2'));var jsonpatch=require(_0x94c8('0x3'));var rp=require(_0x94c8('0x4'));var moment=require(_0x94c8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x94c8('0x6'));var util=require('util');var path=require(_0x94c8('0x7'));var sox=require(_0x94c8('0x8'));var csv=require(_0x94c8('0x9'));var ejs=require(_0x94c8('0xa'));var fs=require('fs');var _=require(_0x94c8('0xb'));var squel=require(_0x94c8('0xc'));var crypto=require(_0x94c8('0xd'));var jsforce=require(_0x94c8('0xe'));var deskjs=require(_0x94c8('0xf'));var toCsv=require(_0x94c8('0x9'));var querystring=require(_0x94c8('0x10'));var Papa=require(_0x94c8('0x11'));var Redis=require('ioredis');var authService=require(_0x94c8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x94c8('0x13'));var hardwareService=require(_0x94c8('0x14'));var logger=require('../../config/logger')(_0x94c8('0x15'));var utils=require(_0x94c8('0x16'));var config=require(_0x94c8('0x17'));var db=require(_0x94c8('0x18'))['db'];function respondWithStatusCode(_0x50b263,_0x7c601d){_0x7c601d=_0x7c601d||0xcc;return function(_0x326b80){if(_0x326b80){return _0x50b263[_0x94c8('0x19')](_0x7c601d);}return _0x50b263[_0x94c8('0x1a')](_0x7c601d)[_0x94c8('0x1b')]();};}function respondWithResult(_0x1a28c5,_0xcd7552){_0xcd7552=_0xcd7552||0xc8;return function(_0x2fe646){if(_0x2fe646){return _0x1a28c5['status'](_0xcd7552)['json'](_0x2fe646);}};}function respondWithFilteredResult(_0x49f695,_0x4002d7){return function(_0x57fd8f){if(_0x57fd8f){var _0x171bea=_0x57fd8f[_0x94c8('0x1c')],_0x35c33f=_0x4002d7['offset'],_0x323835=_0x4002d7[_0x94c8('0x1d')]+_0x4002d7[_0x94c8('0x1e')],_0x38b2f8;if(_0x323835>=_0x171bea){_0x323835=_0x171bea;_0x38b2f8=0xc8;}else{_0x38b2f8=0xce;}_0x49f695['status'](_0x38b2f8);return _0x49f695[_0x94c8('0x1f')](_0x94c8('0x20'),_0x35c33f+'-'+_0x323835+'/'+_0x171bea)[_0x94c8('0x21')](_0x57fd8f);}return null;};}function patchUpdates(_0x429e90){return function(_0x4bf214){try{jsonpatch[_0x94c8('0x22')](_0x4bf214,_0x429e90,!![]);}catch(_0x4b7896){return BPromise[_0x94c8('0x23')](_0x4b7896);}return _0x4bf214[_0x94c8('0x24')]();};}function saveUpdates(_0x5b389b,_0x3238f5){return function(_0x2e05ed){if(_0x2e05ed){return _0x2e05ed[_0x94c8('0x25')](_0x5b389b)[_0x94c8('0x26')](function(_0x4c26df){return _0x4c26df;});}return null;};}function removeEntity(_0x242ed9,_0x1e73c7){return function(_0x3e7a18){if(_0x3e7a18){return _0x3e7a18[_0x94c8('0x27')]()['then'](function(){_0x242ed9[_0x94c8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dd5c3,_0x25d543){return function(_0x9881fe){if(!_0x9881fe){_0x5dd5c3[_0x94c8('0x19')](0x194);}return _0x9881fe;};}function handleError(_0x51f4bf,_0x1d8f6e){_0x1d8f6e=_0x1d8f6e||0x1f4;return function(_0x11ff53){logger[_0x94c8('0x28')](_0x11ff53[_0x94c8('0x29')]);if(_0x11ff53['name']){delete _0x11ff53['name'];}_0x51f4bf[_0x94c8('0x1a')](_0x1d8f6e)['send'](_0x11ff53);};}exports[_0x94c8('0x2a')]=function(_0x179753,_0x18ceb9){var _0x5143f9={},_0x1f13e8={},_0x30f706={'count':0x0,'rows':[]};var _0x97f3d6=_['map'](db[_0x94c8('0x2b')][_0x94c8('0x2c')],function(_0x397120){return{'name':_0x397120[_0x94c8('0x2d')],'type':_0x397120[_0x94c8('0x2e')][_0x94c8('0x2f')]};});_0x1f13e8[_0x94c8('0x30')]=_['map'](_0x97f3d6,_0x94c8('0x31'));_0x1f13e8[_0x94c8('0x32')]=_['keys'](_0x179753['query']);_0x1f13e8['filters']=_['intersection'](_0x1f13e8[_0x94c8('0x30')],_0x1f13e8[_0x94c8('0x32')]);_0x5143f9[_0x94c8('0x33')]=_[_0x94c8('0x34')](_0x1f13e8[_0x94c8('0x30')],qs['fields'](_0x179753['query']['fields']));_0x5143f9['attributes']=_0x5143f9[_0x94c8('0x33')]['length']?_0x5143f9[_0x94c8('0x33')]:_0x1f13e8[_0x94c8('0x30')];if(!_0x179753['query'][_0x94c8('0x35')]('nolimit')){_0x5143f9['limit']=qs[_0x94c8('0x1e')](_0x179753['query']['limit']);_0x5143f9['offset']=qs['offset'](_0x179753[_0x94c8('0x32')][_0x94c8('0x1d')]);}_0x5143f9[_0x94c8('0x36')]=qs[_0x94c8('0x37')](_0x179753['query'][_0x94c8('0x37')]);_0x5143f9[_0x94c8('0x38')]=qs[_0x94c8('0x39')](_[_0x94c8('0x3a')](_0x179753[_0x94c8('0x32')],_0x1f13e8[_0x94c8('0x39')]));if(_0x179753[_0x94c8('0x32')][_0x94c8('0x3b')]){_0x5143f9['where']=_[_0x94c8('0x3c')](_0x5143f9[_0x94c8('0x38')],{'$or':_['map'](_0x97f3d6,function(_0x468fe0){if(_0x468fe0[_0x94c8('0x2e')]!=='VIRTUAL'){var _0x1ddb4a={};_0x1ddb4a[_0x468fe0['name']]={'$like':'%'+_0x179753[_0x94c8('0x32')][_0x94c8('0x3b')]+'%'};return _0x1ddb4a;}})});}_0x5143f9=_[_0x94c8('0x3c')]({},_0x5143f9,_0x179753['options']);var _0x46c274={'where':_0x5143f9[_0x94c8('0x38')]};return db[_0x94c8('0x2b')][_0x94c8('0x1c')](_0x46c274)[_0x94c8('0x26')](function(_0x3cdba7){_0x30f706[_0x94c8('0x1c')]=_0x3cdba7;if(_0x179753[_0x94c8('0x32')]['includeAll']){_0x5143f9['include']=[{'all':!![]}];}return db[_0x94c8('0x2b')][_0x94c8('0x3d')](_0x5143f9);})['then'](function(_0x58c5c9){_0x30f706[_0x94c8('0x3e')]=_0x58c5c9;return _0x30f706;})['then'](respondWithFilteredResult(_0x18ceb9,_0x5143f9))[_0x94c8('0x3f')](handleError(_0x18ceb9,null));};exports[_0x94c8('0x40')]=function(_0x45c009,_0x278d41){var _0x1047ad={'raw':!![],'where':{'id':_0x45c009[_0x94c8('0x41')]['id']}},_0x3193f5={};_0x3193f5[_0x94c8('0x30')]=_[_0x94c8('0x42')](db[_0x94c8('0x2b')]['rawAttributes']);_0x3193f5[_0x94c8('0x32')]=_[_0x94c8('0x42')](_0x45c009[_0x94c8('0x32')]);_0x3193f5[_0x94c8('0x39')]=_[_0x94c8('0x34')](_0x3193f5[_0x94c8('0x30')],_0x3193f5[_0x94c8('0x32')]);_0x1047ad['attributes']=_[_0x94c8('0x34')](_0x3193f5[_0x94c8('0x30')],qs[_0x94c8('0x43')](_0x45c009['query']['fields']));_0x1047ad['attributes']=_0x1047ad[_0x94c8('0x33')]['length']?_0x1047ad[_0x94c8('0x33')]:_0x3193f5[_0x94c8('0x30')];if(_0x45c009['query'][_0x94c8('0x44')]){_0x1047ad[_0x94c8('0x45')]=[{'all':!![]}];}_0x1047ad=_[_0x94c8('0x3c')]({},_0x1047ad,_0x45c009['options']);return db[_0x94c8('0x2b')][_0x94c8('0x46')](_0x1047ad)[_0x94c8('0x26')](handleEntityNotFound(_0x278d41,null))[_0x94c8('0x26')](respondWithResult(_0x278d41,null))[_0x94c8('0x3f')](handleError(_0x278d41,null));};exports[_0x94c8('0x47')]=function(_0x182276,_0x55bcfe){return db[_0x94c8('0x2b')][_0x94c8('0x47')](_0x182276[_0x94c8('0x48')],{})[_0x94c8('0x26')](respondWithResult(_0x55bcfe,0xc9))[_0x94c8('0x3f')](handleError(_0x55bcfe,null));};exports['update']=function(_0x56cecd,_0x2795b7){if(_0x56cecd[_0x94c8('0x48')]['id']){delete _0x56cecd[_0x94c8('0x48')]['id'];}return db[_0x94c8('0x2b')][_0x94c8('0x46')]({'where':{'id':_0x56cecd[_0x94c8('0x41')]['id']}})[_0x94c8('0x26')](handleEntityNotFound(_0x2795b7,null))[_0x94c8('0x26')](saveUpdates(_0x56cecd[_0x94c8('0x48')],null))[_0x94c8('0x26')](respondWithResult(_0x2795b7,null))[_0x94c8('0x3f')](handleError(_0x2795b7,null));};exports['destroy']=function(_0x137923,_0x15bf97){return db['SquareDetailsReport'][_0x94c8('0x46')]({'where':{'id':_0x137923[_0x94c8('0x41')]['id']}})[_0x94c8('0x26')](handleEntityNotFound(_0x15bf97,null))[_0x94c8('0x26')](removeEntity(_0x15bf97,null))[_0x94c8('0x3f')](handleError(_0x15bf97,null));};exports[_0x94c8('0x49')]=function(_0x49c973,_0x5ba0f8){return db['SquareDetailsReport'][_0x94c8('0x49')]()['then'](respondWithResult(_0x5ba0f8,null))[_0x94c8('0x3f')](handleError(_0x5ba0f8,null));}; \ No newline at end of file +var _0xed6a=['then','error','stack','name','send','index','map','SquareDetailsReport','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/environment','sendStatus','end','status','count','offset','set','Content-Range','update'];(function(_0x5b7a2f,_0xc4ee8a){var _0x3088e0=function(_0x17fc52){while(--_0x17fc52){_0x5b7a2f['push'](_0x5b7a2f['shift']());}};_0x3088e0(++_0xc4ee8a);}(_0xed6a,0x144));var _0xaed6=function(_0x176fb2,_0x68e393){_0x176fb2=_0x176fb2-0x0;var _0x4b2b1d=_0xed6a[_0x176fb2];return _0x4b2b1d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaed6('0x0'));var rimraf=require(_0xaed6('0x1'));var zipdir=require(_0xaed6('0x2'));var jsonpatch=require(_0xaed6('0x3'));var rp=require(_0xaed6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaed6('0x5'));var util=require(_0xaed6('0x6'));var path=require(_0xaed6('0x7'));var sox=require(_0xaed6('0x8'));var csv=require(_0xaed6('0x9'));var ejs=require(_0xaed6('0xa'));var fs=require('fs');var _=require(_0xaed6('0xb'));var squel=require(_0xaed6('0xc'));var crypto=require(_0xaed6('0xd'));var jsforce=require(_0xaed6('0xe'));var deskjs=require(_0xaed6('0xf'));var toCsv=require(_0xaed6('0x9'));var querystring=require(_0xaed6('0x10'));var Papa=require(_0xaed6('0x11'));var Redis=require(_0xaed6('0x12'));var authService=require(_0xaed6('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaed6('0x14'))(_0xaed6('0x15'));var utils=require('../../config/utils');var config=require(_0xaed6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30a3d2,_0x29e0d1){_0x29e0d1=_0x29e0d1||0xcc;return function(_0x3bd0eb){if(_0x3bd0eb){return _0x30a3d2[_0xaed6('0x17')](_0x29e0d1);}return _0x30a3d2['status'](_0x29e0d1)[_0xaed6('0x18')]();};}function respondWithResult(_0x1f04da,_0x551bc4){_0x551bc4=_0x551bc4||0xc8;return function(_0x2fa685){if(_0x2fa685){return _0x1f04da[_0xaed6('0x19')](_0x551bc4)['json'](_0x2fa685);}};}function respondWithFilteredResult(_0x12bf12,_0x4f922f){return function(_0x3e28e3){if(_0x3e28e3){var _0x5578fb=_0x3e28e3[_0xaed6('0x1a')],_0x7dfe2=_0x4f922f[_0xaed6('0x1b')],_0x50a001=_0x4f922f[_0xaed6('0x1b')]+_0x4f922f['limit'],_0x4ff91d;if(_0x50a001>=_0x5578fb){_0x50a001=_0x5578fb;_0x4ff91d=0xc8;}else{_0x4ff91d=0xce;}_0x12bf12[_0xaed6('0x19')](_0x4ff91d);return _0x12bf12[_0xaed6('0x1c')](_0xaed6('0x1d'),_0x7dfe2+'-'+_0x50a001+'/'+_0x5578fb)['json'](_0x3e28e3);}return null;};}function patchUpdates(_0x30ab9c){return function(_0x41aee8){try{jsonpatch['apply'](_0x41aee8,_0x30ab9c,!![]);}catch(_0x34ebb4){return BPromise['reject'](_0x34ebb4);}return _0x41aee8['save']();};}function saveUpdates(_0x1b0ae7,_0x2c2fd4){return function(_0x48e4ee){if(_0x48e4ee){return _0x48e4ee[_0xaed6('0x1e')](_0x1b0ae7)[_0xaed6('0x1f')](function(_0x42b59e){return _0x42b59e;});}return null;};}function removeEntity(_0x940ef3,_0x3177e1){return function(_0xb78c8e){if(_0xb78c8e){return _0xb78c8e['destroy']()[_0xaed6('0x1f')](function(){_0x940ef3[_0xaed6('0x19')](0xcc)[_0xaed6('0x18')]();});}};}function handleEntityNotFound(_0x177191,_0x4a5fe0){return function(_0x154eda){if(!_0x154eda){_0x177191[_0xaed6('0x17')](0x194);}return _0x154eda;};}function handleError(_0x1ab52c,_0x2b89c3){_0x2b89c3=_0x2b89c3||0x1f4;return function(_0x2b4f1c){logger[_0xaed6('0x20')](_0x2b4f1c[_0xaed6('0x21')]);if(_0x2b4f1c[_0xaed6('0x22')]){delete _0x2b4f1c[_0xaed6('0x22')];}_0x1ab52c[_0xaed6('0x19')](_0x2b89c3)[_0xaed6('0x23')](_0x2b4f1c);};}exports[_0xaed6('0x24')]=function(_0x89271c,_0x2b0d2e){var _0x5e00de={},_0x4a220c={},_0x4b5c0b={'count':0x0,'rows':[]};var _0x33bd2e=_[_0xaed6('0x25')](db[_0xaed6('0x26')]['rawAttributes'],function(_0x26adff){return{'name':_0x26adff['fieldName'],'type':_0x26adff[_0xaed6('0x27')][_0xaed6('0x28')]};});_0x4a220c['model']=_[_0xaed6('0x25')](_0x33bd2e,_0xaed6('0x22'));_0x4a220c[_0xaed6('0x29')]=_[_0xaed6('0x2a')](_0x89271c['query']);_0x4a220c[_0xaed6('0x2b')]=_[_0xaed6('0x2c')](_0x4a220c[_0xaed6('0x2d')],_0x4a220c['query']);_0x5e00de[_0xaed6('0x2e')]=_[_0xaed6('0x2c')](_0x4a220c[_0xaed6('0x2d')],qs[_0xaed6('0x2f')](_0x89271c[_0xaed6('0x29')][_0xaed6('0x2f')]));_0x5e00de[_0xaed6('0x2e')]=_0x5e00de['attributes'][_0xaed6('0x30')]?_0x5e00de['attributes']:_0x4a220c['model'];if(!_0x89271c[_0xaed6('0x29')][_0xaed6('0x31')](_0xaed6('0x32'))){_0x5e00de['limit']=qs[_0xaed6('0x33')](_0x89271c[_0xaed6('0x29')][_0xaed6('0x33')]);_0x5e00de[_0xaed6('0x1b')]=qs[_0xaed6('0x1b')](_0x89271c[_0xaed6('0x29')][_0xaed6('0x1b')]);}_0x5e00de[_0xaed6('0x34')]=qs['sort'](_0x89271c[_0xaed6('0x29')][_0xaed6('0x35')]);_0x5e00de['where']=qs['filters'](_[_0xaed6('0x36')](_0x89271c[_0xaed6('0x29')],_0x4a220c[_0xaed6('0x2b')]));if(_0x89271c['query'][_0xaed6('0x37')]){_0x5e00de[_0xaed6('0x38')]=_[_0xaed6('0x39')](_0x5e00de[_0xaed6('0x38')],{'$or':_[_0xaed6('0x25')](_0x33bd2e,function(_0x201163){if(_0x201163[_0xaed6('0x27')]!==_0xaed6('0x3a')){var _0x2f781a={};_0x2f781a[_0x201163['name']]={'$like':'%'+_0x89271c[_0xaed6('0x29')]['filter']+'%'};return _0x2f781a;}})});}_0x5e00de=_[_0xaed6('0x39')]({},_0x5e00de,_0x89271c['options']);var _0x2d3465={'where':_0x5e00de[_0xaed6('0x38')]};return db[_0xaed6('0x26')][_0xaed6('0x1a')](_0x2d3465)[_0xaed6('0x1f')](function(_0x4028f1){_0x4b5c0b[_0xaed6('0x1a')]=_0x4028f1;if(_0x89271c['query'][_0xaed6('0x3b')]){_0x5e00de[_0xaed6('0x3c')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0xaed6('0x3d')](_0x5e00de);})[_0xaed6('0x1f')](function(_0x5636bf){_0x4b5c0b[_0xaed6('0x3e')]=_0x5636bf;return _0x4b5c0b;})['then'](respondWithFilteredResult(_0x2b0d2e,_0x5e00de))[_0xaed6('0x3f')](handleError(_0x2b0d2e,null));};exports[_0xaed6('0x40')]=function(_0x689de7,_0x2d737e){var _0x43acdc={'raw':!![],'where':{'id':_0x689de7[_0xaed6('0x41')]['id']}},_0x50e5a4={};_0x50e5a4['model']=_[_0xaed6('0x2a')](db[_0xaed6('0x26')]['rawAttributes']);_0x50e5a4[_0xaed6('0x29')]=_[_0xaed6('0x2a')](_0x689de7[_0xaed6('0x29')]);_0x50e5a4[_0xaed6('0x2b')]=_[_0xaed6('0x2c')](_0x50e5a4[_0xaed6('0x2d')],_0x50e5a4['query']);_0x43acdc[_0xaed6('0x2e')]=_[_0xaed6('0x2c')](_0x50e5a4[_0xaed6('0x2d')],qs[_0xaed6('0x2f')](_0x689de7[_0xaed6('0x29')][_0xaed6('0x2f')]));_0x43acdc['attributes']=_0x43acdc['attributes'][_0xaed6('0x30')]?_0x43acdc['attributes']:_0x50e5a4[_0xaed6('0x2d')];if(_0x689de7[_0xaed6('0x29')][_0xaed6('0x3b')]){_0x43acdc[_0xaed6('0x3c')]=[{'all':!![]}];}_0x43acdc=_[_0xaed6('0x39')]({},_0x43acdc,_0x689de7['options']);return db['SquareDetailsReport'][_0xaed6('0x42')](_0x43acdc)[_0xaed6('0x1f')](handleEntityNotFound(_0x2d737e,null))['then'](respondWithResult(_0x2d737e,null))[_0xaed6('0x3f')](handleError(_0x2d737e,null));};exports[_0xaed6('0x43')]=function(_0x25cd30,_0x3a31d4){return db['SquareDetailsReport'][_0xaed6('0x43')](_0x25cd30[_0xaed6('0x44')],{})[_0xaed6('0x1f')](respondWithResult(_0x3a31d4,0xc9))[_0xaed6('0x3f')](handleError(_0x3a31d4,null));};exports[_0xaed6('0x1e')]=function(_0x42acbb,_0x3e3544){if(_0x42acbb[_0xaed6('0x44')]['id']){delete _0x42acbb[_0xaed6('0x44')]['id'];}return db[_0xaed6('0x26')][_0xaed6('0x42')]({'where':{'id':_0x42acbb[_0xaed6('0x41')]['id']}})['then'](handleEntityNotFound(_0x3e3544,null))['then'](saveUpdates(_0x42acbb['body'],null))[_0xaed6('0x1f')](respondWithResult(_0x3e3544,null))['catch'](handleError(_0x3e3544,null));};exports[_0xaed6('0x45')]=function(_0x5e9688,_0x1b7436){return db['SquareDetailsReport'][_0xaed6('0x42')]({'where':{'id':_0x5e9688[_0xaed6('0x41')]['id']}})[_0xaed6('0x1f')](handleEntityNotFound(_0x1b7436,null))[_0xaed6('0x1f')](removeEntity(_0x1b7436,null))[_0xaed6('0x3f')](handleError(_0x1b7436,null));};exports[_0xaed6('0x46')]=function(_0x2801dd,_0x4b3f3f){return db[_0xaed6('0x26')][_0xaed6('0x46')]()[_0xaed6('0x1f')](respondWithResult(_0x4b3f3f,null))[_0xaed6('0x3f')](handleError(_0x4b3f3f,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index bcc04c6..66ffc12 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 _0x29dd=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','util'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x29dd,0x1d3));var _0xd29d=function(_0x5378d1,_0x5463df){_0x5378d1=_0x5378d1-0x0;var _0x49247b=_0x29dd[_0x5378d1];return _0x49247b;};'use strict';var _=require('lodash');var util=require(_0xd29d('0x0'));var logger=require(_0xd29d('0x1'))('api');var moment=require(_0xd29d('0x2'));var BPromise=require(_0xd29d('0x3'));var rp=require(_0xd29d('0x4'));var fs=require('fs');var path=require(_0xd29d('0x5'));var rimraf=require('rimraf');var config=require(_0xd29d('0x6'));var attributes=require(_0xd29d('0x7'));module[_0xd29d('0x8')]=function(_0x176588,_0x52b7f8){return _0x176588[_0xd29d('0x9')](_0xd29d('0xa'),attributes,{'tableName':_0xd29d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f1e=['bluebird','request-promise','path','rimraf','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger'];(function(_0x59ae56,_0x1a1aaf){var _0x839b0f=function(_0x56cc1c){while(--_0x56cc1c){_0x59ae56['push'](_0x59ae56['shift']());}};_0x839b0f(++_0x1a1aaf);}(_0x2f1e,0xd9));var _0xe2f1=function(_0x2c944e,_0x26f659){_0x2c944e=_0x2c944e-0x0;var _0x2cc529=_0x2f1e[_0x2c944e];return _0x2cc529;};'use strict';var _=require(_0xe2f1('0x0'));var util=require(_0xe2f1('0x1'));var logger=require(_0xe2f1('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe2f1('0x3'));var rp=require(_0xe2f1('0x4'));var fs=require('fs');var path=require(_0xe2f1('0x5'));var rimraf=require(_0xe2f1('0x6'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x561d2c,_0xdaef9f){return _0x561d2c[_0xe2f1('0x7')](_0xe2f1('0x8'),attributes,{'tableName':_0xe2f1('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 a3822ae..dfa5595 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 _0x23fd=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','SquareDetailsReport,\x20%s,\x20%s','error','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x23fd,0xba));var _0xd23f=function(_0x43cf8c,_0x28bf58){_0x43cf8c=_0x43cf8c-0x0;var _0x5482bf=_0x23fd[_0x43cf8c];return _0x5482bf;};'use strict';var _=require(_0xd23f('0x0'));var util=require(_0xd23f('0x1'));var moment=require(_0xd23f('0x2'));var BPromise=require(_0xd23f('0x3'));var rs=require(_0xd23f('0x4'));var fs=require('fs');var Redis=require(_0xd23f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd23f('0x6'));var logger=require(_0xd23f('0x7'))(_0xd23f('0x8'));var config=require(_0xd23f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd23f('0xa')][_0xd23f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c2dbb,_0x1d788c,_0x11654c){return new BPromise(function(_0x490025,_0x93a6a3){return client[_0xd23f('0xc')](_0x2c2dbb,_0x11654c)[_0xd23f('0xd')](function(_0x28703f){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x1d788c,_0xd23f('0xe'));logger[_0xd23f('0xf')](_0xd23f('0x10'),_0x1d788c,_0xd23f('0xe'),JSON[_0xd23f('0x11')](_0x28703f));if(_0x28703f['error']){if(_0x28703f['error']['code']===0x1f4){logger['error'](_0xd23f('0x12'),_0x1d788c,_0x28703f[_0xd23f('0x13')][_0xd23f('0x14')]);return _0x93a6a3(_0x28703f[_0xd23f('0x13')]['message']);}logger[_0xd23f('0x13')](_0xd23f('0x12'),_0x1d788c,_0x28703f[_0xd23f('0x13')][_0xd23f('0x14')]);return _0x490025(_0x28703f[_0xd23f('0x13')][_0xd23f('0x14')]);}else{logger['info'](_0xd23f('0x12'),_0x1d788c,_0xd23f('0xe'));_0x490025(_0x28703f['result'][_0xd23f('0x14')]);}})[_0xd23f('0x15')](function(_0x53aae0){logger[_0xd23f('0x13')](_0xd23f('0x12'),_0x1d788c,_0x53aae0);_0x93a6a3(_0x53aae0);});});}exports[_0xd23f('0x16')]=function(_0x5c537c){var _0x28078a=this;return new Promise(function(_0x4bef65,_0x25c822){return db[_0xd23f('0x17')][_0xd23f('0x18')](_0x5c537c[_0xd23f('0x19')],{'raw':_0x5c537c[_0xd23f('0x1a')]?_0x5c537c[_0xd23f('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xd23f('0xd')](function(_0x3ba24f){logger['info'](_0xd23f('0x16'),_0x5c537c);logger['debug'](_0xd23f('0x16'),_0x5c537c,JSON[_0xd23f('0x11')](_0x3ba24f));_0x4bef65(_0x3ba24f);})['catch'](function(_0x50e967){logger[_0xd23f('0x13')](_0xd23f('0x16'),_0x50e967['message'],_0x5c537c);_0x25c822(_0x28078a[_0xd23f('0x13')](0x1f4,_0x50e967['message']));});});}; \ No newline at end of file +var _0xdfdd=['jayson/promise','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','SquareDetailsReport','body','options','raw','CreateSquareDetailsReport','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x33a0a7,_0xab4c3e){var _0x2fd532=function(_0x5ef1e2){while(--_0x5ef1e2){_0x33a0a7['push'](_0x33a0a7['shift']());}};_0x2fd532(++_0xab4c3e);}(_0xdfdd,0x99));var _0xddfd=function(_0x19785b,_0x10c241){_0x19785b=_0x19785b-0x0;var _0x203674=_0xdfdd[_0x19785b];return _0x203674;};'use strict';var _=require(_0xddfd('0x0'));var util=require('util');var moment=require(_0xddfd('0x1'));var BPromise=require(_0xddfd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xddfd('0x3'));var db=require(_0xddfd('0x4'))['db'];var utils=require(_0xddfd('0x5'));var logger=require(_0xddfd('0x6'))(_0xddfd('0x7'));var config=require(_0xddfd('0x8'));var jayson=require(_0xddfd('0x9'));var client=jayson['client'][_0xddfd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x113c95,_0x1e760a,_0x22423a){return new BPromise(function(_0x1b7206,_0xa4a129){return client[_0xddfd('0xb')](_0x113c95,_0x22423a)[_0xddfd('0xc')](function(_0x44b3ff){logger[_0xddfd('0xd')](_0xddfd('0xe'),_0x1e760a,_0xddfd('0xf'));logger[_0xddfd('0x10')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x1e760a,_0xddfd('0xf'),JSON[_0xddfd('0x11')](_0x44b3ff));if(_0x44b3ff[_0xddfd('0x12')]){if(_0x44b3ff[_0xddfd('0x12')]['code']===0x1f4){logger[_0xddfd('0x12')](_0xddfd('0xe'),_0x1e760a,_0x44b3ff[_0xddfd('0x12')][_0xddfd('0x13')]);return _0xa4a129(_0x44b3ff[_0xddfd('0x12')]['message']);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x1e760a,_0x44b3ff['error']['message']);return _0x1b7206(_0x44b3ff[_0xddfd('0x12')][_0xddfd('0x13')]);}else{logger[_0xddfd('0xd')](_0xddfd('0xe'),_0x1e760a,'request\x20sent');_0x1b7206(_0x44b3ff[_0xddfd('0x14')][_0xddfd('0x13')]);}})['catch'](function(_0x4a25c9){logger[_0xddfd('0x12')](_0xddfd('0xe'),_0x1e760a,_0x4a25c9);_0xa4a129(_0x4a25c9);});});}exports['CreateSquareDetailsReport']=function(_0x39c89c){var _0x22a5cc=this;return new Promise(function(_0x17f811,_0x3e1f7f){return db[_0xddfd('0x15')]['create'](_0x39c89c[_0xddfd('0x16')],{'raw':_0x39c89c[_0xddfd('0x17')]?_0x39c89c[_0xddfd('0x17')][_0xddfd('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x56323e){logger['info'](_0xddfd('0x19'),_0x39c89c);logger[_0xddfd('0x10')](_0xddfd('0x19'),_0x39c89c,JSON[_0xddfd('0x11')](_0x56323e));_0x17f811(_0x56323e);})[_0xddfd('0x1a')](function(_0x90c40){logger[_0xddfd('0x12')](_0xddfd('0x19'),_0x90c40['message'],_0x39c89c);_0x3e1f7f(_0x22a5cc[_0xddfd('0x12')](0x1f4,_0x90c40[_0xddfd('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 50c71db..e2d18ff 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 _0x7ad0=['isAuthenticated','killProcess','express','../../components/auth/service','./system.controller','get','/process/:pid/kill'];(function(_0x592df4,_0x4e719b){var _0x3b4fe4=function(_0x5ebf53){while(--_0x5ebf53){_0x592df4['push'](_0x592df4['shift']());}};_0x3b4fe4(++_0x4e719b);}(_0x7ad0,0x11a));var _0x07ad=function(_0x5abc57,_0x2ec2bc){_0x5abc57=_0x5abc57-0x0;var _0x5c7c7a=_0x7ad0[_0x5abc57];return _0x5c7c7a;};'use strict';var express=require(_0x07ad('0x0'));var router=express['Router']();var auth=require(_0x07ad('0x1'));var controller=require(_0x07ad('0x2'));router[_0x07ad('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0x07ad('0x3')](_0x07ad('0x4'),auth[_0x07ad('0x5')](),controller[_0x07ad('0x6')]);module['exports']=router; \ No newline at end of file +var _0x4cb8=['killProcess','exports','Router','../../components/auth/service','get'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4cb8,0xf2));var _0x84cb=function(_0x25cc7a,_0x2c688e){_0x25cc7a=_0x25cc7a-0x0;var _0x1e6fb0=_0x4cb8[_0x25cc7a];return _0x1e6fb0;};'use strict';var express=require('express');var router=express[_0x84cb('0x0')]();var auth=require(_0x84cb('0x1'));var controller=require('./system.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x84cb('0x2')]('/process/:pid/kill',auth['isAuthenticated'](),controller[_0x84cb('0x3')]);module[_0x84cb('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 5278765..70d54a2 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 _0x5733=['SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','killProcess','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','json','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','split','kill'];(function(_0x113f2b,_0x42336e){var _0x42402a=function(_0x41b00c){while(--_0x41b00c){_0x113f2b['push'](_0x113f2b['shift']());}};_0x42402a(++_0x42336e);}(_0x5733,0x163));var _0x3573=function(_0x43ff8e,_0x4b5b7e){_0x43ff8e=_0x43ff8e-0x0;var _0x11e1b3=_0x5733[_0x43ff8e];return _0x11e1b3;};'use strict';var info=require(_0x3573('0x0'));var exec=require(_0x3573('0x1'))[_0x3573('0x2')];var logger=require(_0x3573('0x3'))(_0x3573('0x4'));var util=require(_0x3573('0x5'));var BPromise=require(_0x3573('0x6'));var _=require(_0x3573('0x7'));function handleError(_0x4599c1,_0x574ff1,_0x448d8f){_0x574ff1=_0x574ff1||0x1f4;return function(_0x4a8dd2){logger['error'](_0x3573('0x8'),_0x448d8f,_0x574ff1,util[_0x3573('0x9')](_0x4a8dd2,{'showHidden':![],'depth':null}));delete _0x4a8dd2[_0x3573('0xa')];_0x4599c1[_0x3573('0xb')](_0x574ff1)[_0x3573('0xc')](_0x4a8dd2);};}exports[_0x3573('0xd')]=function(_0x15fa83,_0x333aff){return info[_0x3573('0xe')]()['then'](function(_0x3586cd){return _0x333aff[_0x3573('0xb')](0xc8)['json'](_0x3586cd);})['catch'](function(_0x1c5681){return _0x333aff['status'](0x1f4)[_0x3573('0xf')](_0x1c5681);});};exports['killProcess']=function(_0x37db70,_0x5e8a3f){var _0x34941e=['components/import/cm'];return new BPromise(function(_0x1b6464,_0x219979){return exec(util[_0x3573('0x10')](_0x3573('0x11'),_0x37db70[_0x3573('0x12')][_0x3573('0x13')]),function(_0x205618,_0x316c08,_0x2eeda9){if(_0x205618){return _0x219979(_0x205618);}return _0x1b6464(_0x316c08);});})[_0x3573('0x14')](function(_0xe3d986){var _0xfc8c73=![];var _0x1da685=_0xe3d986[_0x3573('0x15')](/\n/);for(var _0x169a8d=0x0,_0x4f7eb7=_0x34941e['length'];_0x169a8d<_0x4f7eb7,_0xfc8c73===![];_0x169a8d+=0x1){if(_0xe3d986['indexOf'](_0x34941e[_0x169a8d])>=0x0){_0xfc8c73=!![];}}if(!_0xfc8c73){throw new Error(util[_0x3573('0x10')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x37db70[_0x3573('0x12')][_0x3573('0x13')]));}process[_0x3573('0x16')](_0x37db70['params'][_0x3573('0x13')],_0x3573('0x17'));return _0x5e8a3f[_0x3573('0xb')](0xc8)[_0x3573('0xf')]({'message':util['format'](_0x3573('0x18'),_0x37db70[_0x3573('0x12')][_0x3573('0x13')])});})[_0x3573('0x19')](handleError(_0x5e8a3f,null,_0x3573('0x1a')));}; \ No newline at end of file +var _0x19af=['then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','util','error','status','send','index','getAllData'];(function(_0x5080b0,_0x516278){var _0x567789=function(_0x4d597b){while(--_0x4d597b){_0x5080b0['push'](_0x5080b0['shift']());}};_0x567789(++_0x516278);}(_0x19af,0xe6));var _0xf19a=function(_0x366368,_0x31d41e){_0x366368=_0x366368-0x0;var _0x43434d=_0x19af[_0x366368];return _0x43434d;};'use strict';var info=require(_0xf19a('0x0'));var exec=require(_0xf19a('0x1'))['exec'];var logger=require(_0xf19a('0x2'))(_0xf19a('0x3'));var util=require(_0xf19a('0x4'));var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x29cd06,_0x548fab,_0x5bdd87){_0x548fab=_0x548fab||0x1f4;return function(_0x383655){logger[_0xf19a('0x5')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x5bdd87,_0x548fab,util['inspect'](_0x383655,{'showHidden':![],'depth':null}));delete _0x383655['name'];_0x29cd06[_0xf19a('0x6')](_0x548fab)[_0xf19a('0x7')](_0x383655);};}exports[_0xf19a('0x8')]=function(_0x4aaec5,_0x2ca081){return info[_0xf19a('0x9')]()[_0xf19a('0xa')](function(_0x2879f8){return _0x2ca081[_0xf19a('0x6')](0xc8)[_0xf19a('0xb')](_0x2879f8);})[_0xf19a('0xc')](function(_0x3571d8){return _0x2ca081[_0xf19a('0x6')](0x1f4)[_0xf19a('0xb')](_0x3571d8);});};exports[_0xf19a('0xd')]=function(_0x2a2b7c,_0x548ddb){var _0x4e3714=[_0xf19a('0xe')];return new BPromise(function(_0x5c74d3,_0x35bfaf){return exec(util[_0xf19a('0xf')](_0xf19a('0x10'),_0x2a2b7c[_0xf19a('0x11')][_0xf19a('0x12')]),function(_0x3e61d8,_0x218c9f,_0xd9c5fb){if(_0x3e61d8){return _0x35bfaf(_0x3e61d8);}return _0x5c74d3(_0x218c9f);});})['then'](function(_0x2b416d){var _0x5612a9=![];var _0x49585a=_0x2b416d['split'](/\n/);for(var _0x11ffb2=0x0,_0x154fe0=_0x4e3714[_0xf19a('0x13')];_0x11ffb2<_0x154fe0,_0x5612a9===![];_0x11ffb2+=0x1){if(_0x2b416d[_0xf19a('0x14')](_0x4e3714[_0x11ffb2])>=0x0){_0x5612a9=!![];}}if(!_0x5612a9){throw new Error(util['format'](_0xf19a('0x15'),_0x2a2b7c[_0xf19a('0x11')]['pid']));}process[_0xf19a('0x16')](_0x2a2b7c[_0xf19a('0x11')][_0xf19a('0x12')],'SIGINT');return _0x548ddb['status'](0xc8)[_0xf19a('0xb')]({'message':util['format'](_0xf19a('0x17'),_0x2a2b7c[_0xf19a('0x11')][_0xf19a('0x12')])});})['catch'](handleError(_0x548ddb,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index dcbae35..4cc63b2 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 _0x702d=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','get','/:id','post','create','put'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x702d,0x147));var _0xd702=function(_0x593575,_0x59f29a){_0x593575=_0x593575-0x0;var _0x3ebad0=_0x702d[_0x593575];return _0x3ebad0;};'use strict';var multer=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var path=require(_0xd702('0x2'));var timeout=require(_0xd702('0x3'));var express=require(_0xd702('0x4'));var router=express['Router']();var auth=require(_0xd702('0x5'));var interaction=require(_0xd702('0x6'));var config=require(_0xd702('0x7'));var controller=require(_0xd702('0x8'));router['get']('/',auth[_0xd702('0x9')](),controller['index']);router[_0xd702('0xa')](_0xd702('0xb'),auth[_0xd702('0x9')](),controller['show']);router[_0xd702('0xc')]('/',auth['isAuthenticated'](),controller[_0xd702('0xd')]);router[_0xd702('0xe')](_0xd702('0xb'),auth[_0xd702('0x9')](),controller[_0xd702('0xf')]);router[_0xd702('0x10')](_0xd702('0xb'),auth[_0xd702('0x9')](),controller[_0xd702('0x11')]);module[_0xd702('0x12')]=router; \ No newline at end of file +var _0x702d=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','get','/:id','post','create','put'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x702d,0x147));var _0xd702=function(_0x1f6800,_0x112f4a){_0x1f6800=_0x1f6800-0x0;var _0x365db9=_0x702d[_0x1f6800];return _0x365db9;};'use strict';var multer=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var path=require(_0xd702('0x2'));var timeout=require(_0xd702('0x3'));var express=require(_0xd702('0x4'));var router=express['Router']();var auth=require(_0xd702('0x5'));var interaction=require(_0xd702('0x6'));var config=require(_0xd702('0x7'));var controller=require(_0xd702('0x8'));router['get']('/',auth[_0xd702('0x9')](),controller['index']);router[_0xd702('0xa')](_0xd702('0xb'),auth[_0xd702('0x9')](),controller['show']);router[_0xd702('0xc')]('/',auth['isAuthenticated'](),controller[_0xd702('0xd')]);router[_0xd702('0xe')](_0xd702('0xb'),auth[_0xd702('0x9')](),controller[_0xd702('0xf')]);router[_0xd702('0x10')](_0xd702('0xb'),auth[_0xd702('0x9')](),controller[_0xd702('0x11')]);module[_0xd702('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 3f35318..31747fa 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 _0x4483=['exports','STRING','#0091EA','sequelize'];(function(_0x57ed68,_0x13cab4){var _0x5a46f9=function(_0x40d889){while(--_0x40d889){_0x57ed68['push'](_0x57ed68['shift']());}};_0x5a46f9(++_0x13cab4);}(_0x4483,0x1a3));var _0x3448=function(_0x5eaa3a,_0x1f53bc){_0x5eaa3a=_0x5eaa3a-0x0;var _0x551ca8=_0x4483[_0x5eaa3a];return _0x551ca8;};'use strict';var Sequelize=require(_0x3448('0x0'));module[_0x3448('0x1')]={'name':{'type':Sequelize[_0x3448('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x3448('0x2')],'defaultValue':_0x3448('0x3')},'description':{'type':Sequelize[_0x3448('0x2')]}}; \ No newline at end of file +var _0xda3f=['exports','STRING'];(function(_0x4b17d2,_0x3769b7){var _0xf639ea=function(_0x16a890){while(--_0x16a890){_0x4b17d2['push'](_0x4b17d2['shift']());}};_0xf639ea(++_0x3769b7);}(_0xda3f,0xec));var _0xfda3=function(_0x5caced,_0xa22506){_0x5caced=_0x5caced-0x0;var _0x20114a=_0xda3f[_0x5caced];return _0x20114a;};'use strict';var Sequelize=require('sequelize');module[_0xfda3('0x0')]={'name':{'type':Sequelize[_0xfda3('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xfda3('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index e42c732..45b13c8 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 _0x136c=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Tags','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','Tag','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x4c77ca,_0x31a18a){var _0x1d0252=function(_0x1c430e){while(--_0x1c430e){_0x4c77ca['push'](_0x4c77ca['shift']());}};_0x1d0252(++_0x31a18a);}(_0x136c,0x195));var _0xc136=function(_0x213332,_0x5d7a64){_0x213332=_0x213332-0x0;var _0x194ef0=_0x136c[_0x213332];return _0x194ef0;};'use strict';var pdf=require(_0xc136('0x0'));var emlformat=require(_0xc136('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc136('0x2'));var jsonpatch=require(_0xc136('0x3'));var rp=require(_0xc136('0x4'));var moment=require(_0xc136('0x5'));var BPromise=require(_0xc136('0x6'));var Mustache=require(_0xc136('0x7'));var util=require(_0xc136('0x8'));var path=require(_0xc136('0x9'));var sox=require(_0xc136('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc136('0xb'));var squel=require(_0xc136('0xc'));var crypto=require(_0xc136('0xd'));var jsforce=require(_0xc136('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc136('0xf'));var querystring=require(_0xc136('0x10'));var Papa=require(_0xc136('0x11'));var Redis=require(_0xc136('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc136('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc136('0x14'));var logger=require(_0xc136('0x15'))(_0xc136('0x16'));var utils=require(_0xc136('0x17'));var config=require(_0xc136('0x18'));var db=require(_0xc136('0x19'))['db'];function respondWithStatusCode(_0x32cf00,_0xe87d9){_0xe87d9=_0xe87d9||0xcc;return function(_0x29b02c){if(_0x29b02c){return _0x32cf00['sendStatus'](_0xe87d9);}return _0x32cf00[_0xc136('0x1a')](_0xe87d9)[_0xc136('0x1b')]();};}function respondWithResult(_0x3a6919,_0x5ac0f1){_0x5ac0f1=_0x5ac0f1||0xc8;return function(_0x5e6b6b){if(_0x5e6b6b){return _0x3a6919[_0xc136('0x1a')](_0x5ac0f1)[_0xc136('0x1c')](_0x5e6b6b);}};}function respondWithFilteredResult(_0x2d1921,_0x24251f){return function(_0x28fb9f){if(_0x28fb9f){var _0x302ad4=_0x28fb9f[_0xc136('0x1d')],_0x12432f=_0x24251f[_0xc136('0x1e')],_0x53f199=_0x24251f[_0xc136('0x1e')]+_0x24251f[_0xc136('0x1f')],_0x32797b;if(_0x53f199>=_0x302ad4){_0x53f199=_0x302ad4;_0x32797b=0xc8;}else{_0x32797b=0xce;}_0x2d1921[_0xc136('0x1a')](_0x32797b);return _0x2d1921[_0xc136('0x20')](_0xc136('0x21'),_0x12432f+'-'+_0x53f199+'/'+_0x302ad4)[_0xc136('0x1c')](_0x28fb9f);}return null;};}function patchUpdates(_0x5a92cc){return function(_0x5773c8){try{jsonpatch[_0xc136('0x22')](_0x5773c8,_0x5a92cc,!![]);}catch(_0x42603c){return BPromise[_0xc136('0x23')](_0x42603c);}return _0x5773c8[_0xc136('0x24')]();};}function saveUpdates(_0x5848a7,_0x3cc71d){return function(_0x297e78){if(_0x297e78){return _0x297e78[_0xc136('0x25')](_0x5848a7)[_0xc136('0x26')](function(_0x54d9e6){return _0x54d9e6;});}return null;};}function removeEntity(_0x45b6eb,_0xf30f9e){return function(_0x340721){if(_0x340721){return _0x340721['destroy']()[_0xc136('0x26')](function(){var _0x42064b=_0x340721[_0xc136('0x27')]({'plain':!![]});var _0x26be0f=_0xc136('0x28');return db[_0xc136('0x29')][_0xc136('0x2a')]({'where':{'type':_0x26be0f,'resourceId':_0x42064b['id']}})[_0xc136('0x26')](function(){return _0x340721;});})['then'](function(){_0x45b6eb[_0xc136('0x1a')](0xcc)[_0xc136('0x1b')]();});}};}function handleEntityNotFound(_0xe1d577,_0x522a98){return function(_0x576cac){if(!_0x576cac){_0xe1d577[_0xc136('0x2b')](0x194);}return _0x576cac;};}function handleError(_0x29f304,_0x31862a){_0x31862a=_0x31862a||0x1f4;return function(_0x1a2a5f){logger[_0xc136('0x2c')](_0x1a2a5f[_0xc136('0x2d')]);if(_0x1a2a5f[_0xc136('0x2e')]){delete _0x1a2a5f['name'];}_0x29f304[_0xc136('0x1a')](_0x31862a)[_0xc136('0x2f')](_0x1a2a5f);};}exports[_0xc136('0x30')]=function(_0x51db5b,_0x2514cf){var _0x2dbb01={},_0x32770f={},_0x21e454={'count':0x0,'rows':[]};var _0x523c86=_[_0xc136('0x31')](db[_0xc136('0x32')]['rawAttributes'],function(_0x154b68){return{'name':_0x154b68[_0xc136('0x33')],'type':_0x154b68[_0xc136('0x34')][_0xc136('0x35')]};});_0x32770f[_0xc136('0x36')]=_[_0xc136('0x31')](_0x523c86,_0xc136('0x2e'));_0x32770f['query']=_[_0xc136('0x37')](_0x51db5b[_0xc136('0x38')]);_0x32770f[_0xc136('0x39')]=_[_0xc136('0x3a')](_0x32770f[_0xc136('0x36')],_0x32770f[_0xc136('0x38')]);_0x2dbb01[_0xc136('0x3b')]=_[_0xc136('0x3a')](_0x32770f['model'],qs[_0xc136('0x3c')](_0x51db5b[_0xc136('0x38')][_0xc136('0x3c')]));_0x2dbb01[_0xc136('0x3b')]=_0x2dbb01['attributes']['length']?_0x2dbb01[_0xc136('0x3b')]:_0x32770f[_0xc136('0x36')];if(!_0x51db5b[_0xc136('0x38')]['hasOwnProperty'](_0xc136('0x3d'))){_0x2dbb01[_0xc136('0x1f')]=qs[_0xc136('0x1f')](_0x51db5b[_0xc136('0x38')][_0xc136('0x1f')]);_0x2dbb01[_0xc136('0x1e')]=qs[_0xc136('0x1e')](_0x51db5b[_0xc136('0x38')][_0xc136('0x1e')]);}_0x2dbb01[_0xc136('0x3e')]=qs[_0xc136('0x3f')](_0x51db5b[_0xc136('0x38')][_0xc136('0x3f')]);_0x2dbb01[_0xc136('0x40')]=qs[_0xc136('0x39')](_['pick'](_0x51db5b['query'],_0x32770f[_0xc136('0x39')]));if(_0x51db5b['query'][_0xc136('0x41')]){_0x2dbb01[_0xc136('0x40')]=_[_0xc136('0x42')](_0x2dbb01[_0xc136('0x40')],{'$or':_[_0xc136('0x31')](_0x523c86,function(_0x32a86c){if(_0x32a86c[_0xc136('0x34')]!=='VIRTUAL'){var _0x916668={};_0x916668[_0x32a86c[_0xc136('0x2e')]]={'$like':'%'+_0x51db5b[_0xc136('0x38')][_0xc136('0x41')]+'%'};return _0x916668;}})});}_0x2dbb01=_['merge']({},_0x2dbb01,_0x51db5b[_0xc136('0x43')]);var _0x98a45c={'where':_0x2dbb01[_0xc136('0x40')]};return db[_0xc136('0x32')]['count'](_0x98a45c)[_0xc136('0x26')](function(_0x984f99){_0x21e454['count']=_0x984f99;if(_0x51db5b[_0xc136('0x38')][_0xc136('0x44')]){_0x2dbb01[_0xc136('0x45')]=[{'all':!![]}];}return db[_0xc136('0x32')][_0xc136('0x46')](_0x2dbb01);})[_0xc136('0x26')](function(_0x1de3be){_0x21e454[_0xc136('0x47')]=_0x1de3be;return _0x21e454;})[_0xc136('0x26')](respondWithFilteredResult(_0x2514cf,_0x2dbb01))[_0xc136('0x48')](handleError(_0x2514cf,null));};exports[_0xc136('0x49')]=function(_0x442243,_0x2e89fd){var _0x215d38={'raw':!![],'where':{'id':_0x442243['params']['id']}},_0x61ab1a={};_0x61ab1a[_0xc136('0x36')]=_[_0xc136('0x37')](db[_0xc136('0x32')][_0xc136('0x4a')]);_0x61ab1a[_0xc136('0x38')]=_[_0xc136('0x37')](_0x442243[_0xc136('0x38')]);_0x61ab1a[_0xc136('0x39')]=_['intersection'](_0x61ab1a['model'],_0x61ab1a[_0xc136('0x38')]);_0x215d38[_0xc136('0x3b')]=_['intersection'](_0x61ab1a[_0xc136('0x36')],qs[_0xc136('0x3c')](_0x442243[_0xc136('0x38')][_0xc136('0x3c')]));_0x215d38['attributes']=_0x215d38[_0xc136('0x3b')][_0xc136('0x4b')]?_0x215d38[_0xc136('0x3b')]:_0x61ab1a[_0xc136('0x36')];if(_0x442243['query'][_0xc136('0x44')]){_0x215d38[_0xc136('0x45')]=[{'all':!![]}];}_0x215d38=_[_0xc136('0x42')]({},_0x215d38,_0x442243[_0xc136('0x43')]);return db[_0xc136('0x32')]['find'](_0x215d38)[_0xc136('0x26')](handleEntityNotFound(_0x2e89fd,null))[_0xc136('0x26')](respondWithResult(_0x2e89fd,null))['catch'](handleError(_0x2e89fd,null));};exports[_0xc136('0x4c')]=function(_0x4cd1f7,_0x2a0f7e){return db[_0xc136('0x32')][_0xc136('0x4c')](_0x4cd1f7[_0xc136('0x4d')],{})[_0xc136('0x26')](function(_0x1f79de){var _0x2f67d8=_0x4cd1f7[_0xc136('0x4e')][_0xc136('0x27')]({'plain':!![]});if(!_0x2f67d8)throw new Error(_0xc136('0x4f'));if(_0x2f67d8[_0xc136('0x50')]===_0xc136('0x4e')){var _0x4765be=_0x1f79de[_0xc136('0x27')]({'plain':!![]});var _0x40a40c=_0xc136('0x28');return db[_0xc136('0x51')][_0xc136('0x52')]({'where':{'name':_0x40a40c,'userProfileId':_0x2f67d8[_0xc136('0x53')]},'raw':!![]})[_0xc136('0x26')](function(_0x1574ef){if(_0x1574ef&&_0x1574ef['autoAssociation']===0x0){return db[_0xc136('0x29')]['create']({'name':_0x4765be[_0xc136('0x2e')],'resourceId':_0x4765be['id'],'type':_0x1574ef[_0xc136('0x2e')],'sectionId':_0x1574ef['id']},{})[_0xc136('0x26')](function(){return _0x1f79de;});}else{return _0x1f79de;}})[_0xc136('0x48')](function(_0x6a7368){logger[_0xc136('0x2c')](_0xc136('0x54'),_0x6a7368);throw _0x6a7368;});}return _0x1f79de;})[_0xc136('0x26')](respondWithResult(_0x2a0f7e,0xc9))[_0xc136('0x48')](handleError(_0x2a0f7e,null));};exports['update']=function(_0x7e25b3,_0x3bc7d0){if(_0x7e25b3['body']['id']){delete _0x7e25b3[_0xc136('0x4d')]['id'];}return db[_0xc136('0x32')]['find']({'where':{'id':_0x7e25b3['params']['id']}})['then'](handleEntityNotFound(_0x3bc7d0,null))['then'](saveUpdates(_0x7e25b3[_0xc136('0x4d')],null))[_0xc136('0x26')](respondWithResult(_0x3bc7d0,null))[_0xc136('0x48')](handleError(_0x3bc7d0,null));};exports[_0xc136('0x2a')]=function(_0x35d278,_0x4c0a96){return db[_0xc136('0x32')][_0xc136('0x52')]({'where':{'id':_0x35d278['params']['id']}})[_0xc136('0x26')](handleEntityNotFound(_0x4c0a96,null))[_0xc136('0x26')](removeEntity(_0x4c0a96,null))[_0xc136('0x48')](handleError(_0x4c0a96,null));}; \ No newline at end of file +var _0xc86f=['save','update','then','UserProfileResource','destroy','error','name','send','index','map','Tag','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','fields','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','status','end','json','count','offset','limit','set','apply','reject'];(function(_0x44dcc8,_0x5815a6){var _0x2c4c12=function(_0x4126ef){while(--_0x4126ef){_0x44dcc8['push'](_0x44dcc8['shift']());}};_0x2c4c12(++_0x5815a6);}(_0xc86f,0x1ba));var _0xfc86=function(_0x38fcbb,_0xd2b478){_0x38fcbb=_0x38fcbb-0x0;var _0x4bbb75=_0xc86f[_0x38fcbb];return _0x4bbb75;};'use strict';var pdf=require(_0xfc86('0x0'));var emlformat=require(_0xfc86('0x1'));var rimraf=require(_0xfc86('0x2'));var zipdir=require(_0xfc86('0x3'));var jsonpatch=require(_0xfc86('0x4'));var rp=require(_0xfc86('0x5'));var moment=require(_0xfc86('0x6'));var BPromise=require(_0xfc86('0x7'));var Mustache=require(_0xfc86('0x8'));var util=require(_0xfc86('0x9'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfc86('0xa'));var fs=require('fs');var _=require(_0xfc86('0xb'));var squel=require(_0xfc86('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfc86('0xd'));var toCsv=require(_0xfc86('0xe'));var querystring=require('querystring');var Papa=require(_0xfc86('0xf'));var Redis=require(_0xfc86('0x10'));var authService=require(_0xfc86('0x11'));var qs=require(_0xfc86('0x12'));var as=require(_0xfc86('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc86('0x14'))(_0xfc86('0x15'));var utils=require('../../config/utils');var config=require(_0xfc86('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15cdbc,_0x34a9ad){_0x34a9ad=_0x34a9ad||0xcc;return function(_0x1c0f80){if(_0x1c0f80){return _0x15cdbc['sendStatus'](_0x34a9ad);}return _0x15cdbc[_0xfc86('0x17')](_0x34a9ad)[_0xfc86('0x18')]();};}function respondWithResult(_0x360112,_0x10e0fe){_0x10e0fe=_0x10e0fe||0xc8;return function(_0x11611b){if(_0x11611b){return _0x360112['status'](_0x10e0fe)[_0xfc86('0x19')](_0x11611b);}};}function respondWithFilteredResult(_0x1764fc,_0x4b82a1){return function(_0x3c134b){if(_0x3c134b){var _0x4aad03=_0x3c134b[_0xfc86('0x1a')],_0x54a0a1=_0x4b82a1[_0xfc86('0x1b')],_0x3a1d45=_0x4b82a1[_0xfc86('0x1b')]+_0x4b82a1[_0xfc86('0x1c')],_0x1f4abc;if(_0x3a1d45>=_0x4aad03){_0x3a1d45=_0x4aad03;_0x1f4abc=0xc8;}else{_0x1f4abc=0xce;}_0x1764fc['status'](_0x1f4abc);return _0x1764fc[_0xfc86('0x1d')]('Content-Range',_0x54a0a1+'-'+_0x3a1d45+'/'+_0x4aad03)[_0xfc86('0x19')](_0x3c134b);}return null;};}function patchUpdates(_0x1738e4){return function(_0x5c2877){try{jsonpatch[_0xfc86('0x1e')](_0x5c2877,_0x1738e4,!![]);}catch(_0x48624d){return BPromise[_0xfc86('0x1f')](_0x48624d);}return _0x5c2877[_0xfc86('0x20')]();};}function saveUpdates(_0x3297e0,_0x5d3066){return function(_0x47d396){if(_0x47d396){return _0x47d396[_0xfc86('0x21')](_0x3297e0)[_0xfc86('0x22')](function(_0x3676a3){return _0x3676a3;});}return null;};}function removeEntity(_0x22305e,_0x12e191){return function(_0x4a300c){if(_0x4a300c){return _0x4a300c['destroy']()[_0xfc86('0x22')](function(){var _0x50c833=_0x4a300c['get']({'plain':!![]});var _0x9a5914='Tags';return db[_0xfc86('0x23')][_0xfc86('0x24')]({'where':{'type':_0x9a5914,'resourceId':_0x50c833['id']}})[_0xfc86('0x22')](function(){return _0x4a300c;});})[_0xfc86('0x22')](function(){_0x22305e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x21418d,_0x1bc111){return function(_0x418891){if(!_0x418891){_0x21418d['sendStatus'](0x194);}return _0x418891;};}function handleError(_0x1f4b1e,_0x5378c8){_0x5378c8=_0x5378c8||0x1f4;return function(_0x49484b){logger[_0xfc86('0x25')](_0x49484b['stack']);if(_0x49484b[_0xfc86('0x26')]){delete _0x49484b[_0xfc86('0x26')];}_0x1f4b1e[_0xfc86('0x17')](_0x5378c8)[_0xfc86('0x27')](_0x49484b);};}exports[_0xfc86('0x28')]=function(_0x247696,_0x24a6e3){var _0x29532f={},_0x299932={},_0x4879d5={'count':0x0,'rows':[]};var _0x138663=_[_0xfc86('0x29')](db[_0xfc86('0x2a')]['rawAttributes'],function(_0x54f582){return{'name':_0x54f582[_0xfc86('0x2b')],'type':_0x54f582[_0xfc86('0x2c')][_0xfc86('0x2d')]};});_0x299932[_0xfc86('0x2e')]=_[_0xfc86('0x29')](_0x138663,'name');_0x299932[_0xfc86('0x2f')]=_[_0xfc86('0x30')](_0x247696[_0xfc86('0x2f')]);_0x299932[_0xfc86('0x31')]=_[_0xfc86('0x32')](_0x299932['model'],_0x299932[_0xfc86('0x2f')]);_0x29532f[_0xfc86('0x33')]=_[_0xfc86('0x32')](_0x299932[_0xfc86('0x2e')],qs['fields'](_0x247696[_0xfc86('0x2f')]['fields']));_0x29532f[_0xfc86('0x33')]=_0x29532f[_0xfc86('0x33')][_0xfc86('0x34')]?_0x29532f[_0xfc86('0x33')]:_0x299932[_0xfc86('0x2e')];if(!_0x247696[_0xfc86('0x2f')][_0xfc86('0x35')](_0xfc86('0x36'))){_0x29532f[_0xfc86('0x1c')]=qs[_0xfc86('0x1c')](_0x247696[_0xfc86('0x2f')]['limit']);_0x29532f[_0xfc86('0x1b')]=qs['offset'](_0x247696[_0xfc86('0x2f')][_0xfc86('0x1b')]);}_0x29532f[_0xfc86('0x37')]=qs[_0xfc86('0x38')](_0x247696[_0xfc86('0x2f')][_0xfc86('0x38')]);_0x29532f[_0xfc86('0x39')]=qs[_0xfc86('0x31')](_['pick'](_0x247696['query'],_0x299932[_0xfc86('0x31')]));if(_0x247696['query'][_0xfc86('0x3a')]){_0x29532f[_0xfc86('0x39')]=_[_0xfc86('0x3b')](_0x29532f[_0xfc86('0x39')],{'$or':_[_0xfc86('0x29')](_0x138663,function(_0x12ee4a){if(_0x12ee4a[_0xfc86('0x2c')]!==_0xfc86('0x3c')){var _0x4a40ec={};_0x4a40ec[_0x12ee4a[_0xfc86('0x26')]]={'$like':'%'+_0x247696['query'][_0xfc86('0x3a')]+'%'};return _0x4a40ec;}})});}_0x29532f=_[_0xfc86('0x3b')]({},_0x29532f,_0x247696[_0xfc86('0x3d')]);var _0x4cf05e={'where':_0x29532f[_0xfc86('0x39')]};return db[_0xfc86('0x2a')][_0xfc86('0x1a')](_0x4cf05e)['then'](function(_0x362dd5){_0x4879d5[_0xfc86('0x1a')]=_0x362dd5;if(_0x247696[_0xfc86('0x2f')][_0xfc86('0x3e')]){_0x29532f[_0xfc86('0x3f')]=[{'all':!![]}];}return db['Tag'][_0xfc86('0x40')](_0x29532f);})[_0xfc86('0x22')](function(_0x2c71e6){_0x4879d5['rows']=_0x2c71e6;return _0x4879d5;})[_0xfc86('0x22')](respondWithFilteredResult(_0x24a6e3,_0x29532f))[_0xfc86('0x41')](handleError(_0x24a6e3,null));};exports['show']=function(_0x2e784e,_0x6b4e8e){var _0x2e0c05={'raw':!![],'where':{'id':_0x2e784e[_0xfc86('0x42')]['id']}},_0x341f7f={};_0x341f7f[_0xfc86('0x2e')]=_[_0xfc86('0x30')](db[_0xfc86('0x2a')][_0xfc86('0x43')]);_0x341f7f[_0xfc86('0x2f')]=_[_0xfc86('0x30')](_0x2e784e[_0xfc86('0x2f')]);_0x341f7f['filters']=_[_0xfc86('0x32')](_0x341f7f[_0xfc86('0x2e')],_0x341f7f[_0xfc86('0x2f')]);_0x2e0c05[_0xfc86('0x33')]=_[_0xfc86('0x32')](_0x341f7f[_0xfc86('0x2e')],qs[_0xfc86('0x44')](_0x2e784e['query'][_0xfc86('0x44')]));_0x2e0c05[_0xfc86('0x33')]=_0x2e0c05[_0xfc86('0x33')][_0xfc86('0x34')]?_0x2e0c05[_0xfc86('0x33')]:_0x341f7f[_0xfc86('0x2e')];if(_0x2e784e[_0xfc86('0x2f')]['includeAll']){_0x2e0c05[_0xfc86('0x3f')]=[{'all':!![]}];}_0x2e0c05=_[_0xfc86('0x3b')]({},_0x2e0c05,_0x2e784e['options']);return db[_0xfc86('0x2a')]['find'](_0x2e0c05)[_0xfc86('0x22')](handleEntityNotFound(_0x6b4e8e,null))['then'](respondWithResult(_0x6b4e8e,null))[_0xfc86('0x41')](handleError(_0x6b4e8e,null));};exports['create']=function(_0x472e55,_0x279064){return db['Tag'][_0xfc86('0x45')](_0x472e55['body'],{})['then'](function(_0x3ed48e){var _0x22ceb4=_0x472e55[_0xfc86('0x46')]['get']({'plain':!![]});if(!_0x22ceb4)throw new Error(_0xfc86('0x47'));if(_0x22ceb4[_0xfc86('0x48')]===_0xfc86('0x46')){var _0x255d84=_0x3ed48e['get']({'plain':!![]});var _0x564a5e='Tags';return db[_0xfc86('0x49')]['find']({'where':{'name':_0x564a5e,'userProfileId':_0x22ceb4[_0xfc86('0x4a')]},'raw':!![]})[_0xfc86('0x22')](function(_0x5b9816){if(_0x5b9816&&_0x5b9816[_0xfc86('0x4b')]===0x0){return db[_0xfc86('0x23')][_0xfc86('0x45')]({'name':_0x255d84[_0xfc86('0x26')],'resourceId':_0x255d84['id'],'type':_0x5b9816[_0xfc86('0x26')],'sectionId':_0x5b9816['id']},{})[_0xfc86('0x22')](function(){return _0x3ed48e;});}else{return _0x3ed48e;}})['catch'](function(_0x305c75){logger['error'](_0xfc86('0x4c'),_0x305c75);throw _0x305c75;});}return _0x3ed48e;})[_0xfc86('0x22')](respondWithResult(_0x279064,0xc9))['catch'](handleError(_0x279064,null));};exports[_0xfc86('0x21')]=function(_0x5a7dc4,_0x4fb97b){if(_0x5a7dc4[_0xfc86('0x4d')]['id']){delete _0x5a7dc4[_0xfc86('0x4d')]['id'];}return db[_0xfc86('0x2a')][_0xfc86('0x4e')]({'where':{'id':_0x5a7dc4['params']['id']}})['then'](handleEntityNotFound(_0x4fb97b,null))['then'](saveUpdates(_0x5a7dc4[_0xfc86('0x4d')],null))[_0xfc86('0x22')](respondWithResult(_0x4fb97b,null))['catch'](handleError(_0x4fb97b,null));};exports['destroy']=function(_0x3c67b0,_0x582e23){return db[_0xfc86('0x2a')][_0xfc86('0x4e')]({'where':{'id':_0x3c67b0['params']['id']}})['then'](handleEntityNotFound(_0x582e23,null))[_0xfc86('0x22')](removeEntity(_0x582e23,null))[_0xfc86('0x41')](handleError(_0x582e23,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 04eb457..04ace63 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 _0x8ce2=['util','api','moment','bluebird','request-promise','path','rimraf','./tag.attributes','exports','define','lodash'];(function(_0x588438,_0x3a5f90){var _0x4b792e=function(_0x3aa840){while(--_0x3aa840){_0x588438['push'](_0x588438['shift']());}};_0x4b792e(++_0x3a5f90);}(_0x8ce2,0x18b));var _0x28ce=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x8ce2[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x28ce('0x0'));var util=require(_0x28ce('0x1'));var logger=require('../../config/logger')(_0x28ce('0x2'));var moment=require(_0x28ce('0x3'));var BPromise=require(_0x28ce('0x4'));var rp=require(_0x28ce('0x5'));var fs=require('fs');var path=require(_0x28ce('0x6'));var rimraf=require(_0x28ce('0x7'));var config=require('../../config/environment');var attributes=require(_0x28ce('0x8'));module[_0x28ce('0x9')]=function(_0x24278a,_0x1a8370){return _0x24278a[_0x28ce('0xa')]('Tag',attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e88=['moment','request-promise','path','rimraf','./tag.attributes','exports','define','Tag','tools_tags','lodash','../../config/logger','api'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x7e88,0x81));var _0x87e8=function(_0x1ebb6b,_0x1e0257){_0x1ebb6b=_0x1ebb6b-0x0;var _0x24029a=_0x7e88[_0x1ebb6b];return _0x24029a;};'use strict';var _=require(_0x87e8('0x0'));var util=require('util');var logger=require(_0x87e8('0x1'))(_0x87e8('0x2'));var moment=require(_0x87e8('0x3'));var BPromise=require('bluebird');var rp=require(_0x87e8('0x4'));var fs=require('fs');var path=require(_0x87e8('0x5'));var rimraf=require(_0x87e8('0x6'));var config=require('../../config/environment');var attributes=require(_0x87e8('0x7'));module[_0x87e8('0x8')]=function(_0x3e4844,_0x8859eb){return _0x3e4844[_0x87e8('0x9')](_0x87e8('0xa'),attributes,{'tableName':_0x87e8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 9b4313a..faeedd1 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 _0xf72b=['../../config/environment','jayson/promise','client','request','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xf72b,0x1d9));var _0xbf72=function(_0x4893c0,_0x291502){_0x4893c0=_0x4893c0-0x0;var _0x4ab1f0=_0xf72b[_0x4893c0];return _0x4ab1f0;};'use strict';var _=require(_0xbf72('0x0'));var util=require('util');var moment=require(_0xbf72('0x1'));var BPromise=require('bluebird');var rs=require(_0xbf72('0x2'));var fs=require('fs');var Redis=require(_0xbf72('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf72('0x4'));var logger=require(_0xbf72('0x5'))(_0xbf72('0x6'));var config=require(_0xbf72('0x7'));var jayson=require(_0xbf72('0x8'));var client=jayson[_0xbf72('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41c11d,_0xc0842b,_0x119807){return new BPromise(function(_0xd0402c,_0xdd6177){return client[_0xbf72('0xa')](_0x41c11d,_0x119807)['then'](function(_0x455891){logger['info'](_0xbf72('0xb'),_0xc0842b,_0xbf72('0xc'));logger['debug'](_0xbf72('0xd'),_0xc0842b,_0xbf72('0xc'),JSON[_0xbf72('0xe')](_0x455891));if(_0x455891[_0xbf72('0xf')]){if(_0x455891[_0xbf72('0xf')][_0xbf72('0x10')]===0x1f4){logger[_0xbf72('0xf')](_0xbf72('0xb'),_0xc0842b,_0x455891['error'][_0xbf72('0x11')]);return _0xdd6177(_0x455891[_0xbf72('0xf')][_0xbf72('0x11')]);}logger['error'](_0xbf72('0xb'),_0xc0842b,_0x455891['error']['message']);return _0xd0402c(_0x455891['error'][_0xbf72('0x11')]);}else{logger[_0xbf72('0x12')](_0xbf72('0xb'),_0xc0842b,_0xbf72('0xc'));_0xd0402c(_0x455891[_0xbf72('0x13')][_0xbf72('0x11')]);}})['catch'](function(_0x266ce2){logger[_0xbf72('0xf')](_0xbf72('0xb'),_0xc0842b,_0x266ce2);_0xdd6177(_0x266ce2);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Tag,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0xd52042,_0xd9545f){var _0x599420=function(_0x24c1ce){while(--_0x24c1ce){_0xd52042['push'](_0xd52042['shift']());}};_0x599420(++_0xd9545f);}(_0xb43b,0x1b2));var _0xbb43=function(_0x13df16,_0x26ea4c){_0x13df16=_0x13df16-0x0;var _0x13b38b=_0xb43b[_0x13df16];return _0x13b38b;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('Tag,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('Tag,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('Tag,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 34843e2..1ae023b 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 _0xad45=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','index','/:id','show','/:id/users','getAgents','post','create','/:id/queues','addQueues','put','update','delete','removeQueues','removeAgents','exports','util'];(function(_0x5adf4d,_0xdfd7ef){var _0x17b2db=function(_0x5a9a2f){while(--_0x5a9a2f){_0x5adf4d['push'](_0x5adf4d['shift']());}};_0x17b2db(++_0xdfd7ef);}(_0xad45,0xe9));var _0x5ad4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xad45[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x5ad4('0x0'));var path=require(_0x5ad4('0x1'));var timeout=require(_0x5ad4('0x2'));var express=require(_0x5ad4('0x3'));var router=express[_0x5ad4('0x4')]();var auth=require(_0x5ad4('0x5'));var interaction=require(_0x5ad4('0x6'));var config=require(_0x5ad4('0x7'));var controller=require(_0x5ad4('0x8'));router[_0x5ad4('0x9')]('/',auth[_0x5ad4('0xa')](),controller[_0x5ad4('0xb')]);router[_0x5ad4('0x9')](_0x5ad4('0xc'),auth[_0x5ad4('0xa')](),controller[_0x5ad4('0xd')]);router['get']('/:id/queues',auth['isAuthenticated'](),controller['getQueues']);router['get'](_0x5ad4('0xe'),auth[_0x5ad4('0xa')](),controller[_0x5ad4('0xf')]);router[_0x5ad4('0x10')]('/',auth[_0x5ad4('0xa')](),controller[_0x5ad4('0x11')]);router[_0x5ad4('0x10')](_0x5ad4('0x12'),auth[_0x5ad4('0xa')](),controller[_0x5ad4('0x13')]);router[_0x5ad4('0x10')](_0x5ad4('0xe'),auth[_0x5ad4('0xa')](),controller['addAgents']);router[_0x5ad4('0x14')](_0x5ad4('0xc'),auth[_0x5ad4('0xa')](),controller[_0x5ad4('0x15')]);router[_0x5ad4('0x16')](_0x5ad4('0xc'),auth[_0x5ad4('0xa')](),controller['destroy']);router[_0x5ad4('0x16')](_0x5ad4('0x12'),auth[_0x5ad4('0xa')](),controller[_0x5ad4('0x17')]);router['delete'](_0x5ad4('0xe'),auth[_0x5ad4('0xa')](),controller[_0x5ad4('0x18')]);module[_0x5ad4('0x19')]=router; \ No newline at end of file +var _0xd72b=['/:id','update','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../config/environment','get','isAuthenticated','show','/:id/queues','getQueues','/:id/users','getAgents','post','create','addQueues','addAgents','put'];(function(_0x3c0ff8,_0x57501b){var _0x3821e3=function(_0x3fbfd7){while(--_0x3fbfd7){_0x3c0ff8['push'](_0x3c0ff8['shift']());}};_0x3821e3(++_0x57501b);}(_0xd72b,0x123));var _0xbd72=function(_0x3c8f92,_0x557ddc){_0x3c8f92=_0x3c8f92-0x0;var _0x2bc367=_0xd72b[_0x3c8f92];return _0x2bc367;};'use strict';var multer=require('multer');var util=require(_0xbd72('0x0'));var path=require(_0xbd72('0x1'));var timeout=require(_0xbd72('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xbd72('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xbd72('0x4'));var controller=require('./team.controller');router[_0xbd72('0x5')]('/',auth[_0xbd72('0x6')](),controller['index']);router['get']('/:id',auth[_0xbd72('0x6')](),controller[_0xbd72('0x7')]);router[_0xbd72('0x5')](_0xbd72('0x8'),auth['isAuthenticated'](),controller[_0xbd72('0x9')]);router[_0xbd72('0x5')](_0xbd72('0xa'),auth[_0xbd72('0x6')](),controller[_0xbd72('0xb')]);router[_0xbd72('0xc')]('/',auth[_0xbd72('0x6')](),controller[_0xbd72('0xd')]);router[_0xbd72('0xc')](_0xbd72('0x8'),auth[_0xbd72('0x6')](),controller[_0xbd72('0xe')]);router['post'](_0xbd72('0xa'),auth[_0xbd72('0x6')](),controller[_0xbd72('0xf')]);router[_0xbd72('0x10')](_0xbd72('0x11'),auth['isAuthenticated'](),controller[_0xbd72('0x12')]);router[_0xbd72('0x13')](_0xbd72('0x11'),auth[_0xbd72('0x6')](),controller[_0xbd72('0x14')]);router[_0xbd72('0x13')](_0xbd72('0x8'),auth[_0xbd72('0x6')](),controller['removeQueues']);router[_0xbd72('0x13')](_0xbd72('0xa'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xbd72('0x15')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index d4651fb..0a522a4 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 _0xc59d=['STRING','sequelize','exports'];(function(_0x9cfe28,_0x1a335c){var _0x54a1d0=function(_0x46bc02){while(--_0x46bc02){_0x9cfe28['push'](_0x9cfe28['shift']());}};_0x54a1d0(++_0x1a335c);}(_0xc59d,0xf1));var _0xdc59=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xc59d[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xdc59('0x0'));module[_0xdc59('0x1')]={'name':{'type':Sequelize[_0xdc59('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0xdc59('0x2')]}}; \ No newline at end of file +var _0xef7c=['name','sequelize','exports','STRING'];(function(_0x2f2360,_0x151089){var _0x1cc8d3=function(_0x5e356f){while(--_0x5e356f){_0x2f2360['push'](_0x2f2360['shift']());}};_0x1cc8d3(++_0x151089);}(_0xef7c,0xe5));var _0xcef7=function(_0x48530f,_0x77bd1d){_0x48530f=_0x48530f-0x0;var _0x3edc05=_0xef7c[_0x48530f];return _0x3edc05;};'use strict';var Sequelize=require(_0xcef7('0x0'));module[_0xcef7('0x1')]={'name':{'type':Sequelize[_0xcef7('0x2')],'allowNull':![],'unique':_0xcef7('0x3')},'description':{'type':Sequelize[_0xcef7('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 3d68424..b0760f4 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 _0x7fee=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','findOne','channel','isValidChannel','Sequelize','Unknown\x20channel','toLowerCase','Queue','pick','capitalize','Queues','addQueues','ValidationError','ids','removeQueues','addAgents','Mail','Openchannel','each','Voice','User','online','interface','upsert','isNil','format','SIP/%s','omit','spread','emit','removeAgents','voice','mail','fax','openchannel','UserVoiceQueueRt','userTeam:remove','nolimit','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','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./team.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','get','Teams','UserProfileResource','error','stack','name','send','Team','rawAttributes','type','key','model','map','query','keys'];(function(_0x3c37e5,_0x2b9d54){var _0x181e13=function(_0x57b408){while(--_0x57b408){_0x3c37e5['push'](_0x3c37e5['shift']());}};_0x181e13(++_0x2b9d54);}(_0x7fee,0x1a6));var _0xe7fe=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x7fee[_0x1f9f37];return _0x21c080;};'use strict';var pdf=require(_0xe7fe('0x0'));var emlformat=require(_0xe7fe('0x1'));var rimraf=require(_0xe7fe('0x2'));var zipdir=require(_0xe7fe('0x3'));var jsonpatch=require(_0xe7fe('0x4'));var rp=require(_0xe7fe('0x5'));var moment=require('moment');var BPromise=require(_0xe7fe('0x6'));var Mustache=require(_0xe7fe('0x7'));var util=require(_0xe7fe('0x8'));var path=require('path');var sox=require(_0xe7fe('0x9'));var csv=require('to-csv');var ejs=require(_0xe7fe('0xa'));var fs=require('fs');var _=require(_0xe7fe('0xb'));var squel=require(_0xe7fe('0xc'));var crypto=require(_0xe7fe('0xd'));var jsforce=require(_0xe7fe('0xe'));var deskjs=require(_0xe7fe('0xf'));var toCsv=require(_0xe7fe('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fe('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe7fe('0x12'));var hardwareService=require(_0xe7fe('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xe7fe('0x14'));var config=require(_0xe7fe('0x15'));var db=require('../../mysqldb')['db'];config[_0xe7fe('0x16')]=_[_0xe7fe('0x17')](config[_0xe7fe('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xe7fe('0x18'))(new Redis(config[_0xe7fe('0x16')]));require(_0xe7fe('0x19'))['register'](socket);function respondWithStatusCode(_0x32f8b3,_0x29e745){_0x29e745=_0x29e745||0xcc;return function(_0x22f9fb){if(_0x22f9fb){return _0x32f8b3[_0xe7fe('0x1a')](_0x29e745);}return _0x32f8b3[_0xe7fe('0x1b')](_0x29e745)[_0xe7fe('0x1c')]();};}function respondWithResult(_0x14172e,_0x1647fd){_0x1647fd=_0x1647fd||0xc8;return function(_0xd1a481){if(_0xd1a481){return _0x14172e[_0xe7fe('0x1b')](_0x1647fd)[_0xe7fe('0x1d')](_0xd1a481);}};}function respondWithFilteredResult(_0xdccde3,_0x382093){return function(_0x33bf2e){if(_0x33bf2e){var _0x141908=_0x33bf2e[_0xe7fe('0x1e')],_0xf7f6fe=_0x382093[_0xe7fe('0x1f')],_0x5e16a8=_0x382093[_0xe7fe('0x1f')]+_0x382093[_0xe7fe('0x20')],_0x1390ea;if(_0x5e16a8>=_0x141908){_0x5e16a8=_0x141908;_0x1390ea=0xc8;}else{_0x1390ea=0xce;}_0xdccde3['status'](_0x1390ea);return _0xdccde3[_0xe7fe('0x21')](_0xe7fe('0x22'),_0xf7f6fe+'-'+_0x5e16a8+'/'+_0x141908)[_0xe7fe('0x1d')](_0x33bf2e);}return null;};}function patchUpdates(_0x584779){return function(_0x11fdf3){try{jsonpatch['apply'](_0x11fdf3,_0x584779,!![]);}catch(_0x1a9484){return BPromise['reject'](_0x1a9484);}return _0x11fdf3[_0xe7fe('0x23')]();};}function saveUpdates(_0x545b49,_0x23d8b8){return function(_0x2a6eeb){if(_0x2a6eeb){return _0x2a6eeb[_0xe7fe('0x24')](_0x545b49)[_0xe7fe('0x25')](function(_0x14e73b){return _0x14e73b;});}return null;};}function removeEntity(_0x276a00,_0x18b0e9){return function(_0x3962bc){if(_0x3962bc){return _0x3962bc[_0xe7fe('0x26')]()[_0xe7fe('0x25')](function(){var _0x3c5528=_0x3962bc[_0xe7fe('0x27')]({'plain':!![]});var _0x34652a=_0xe7fe('0x28');return db[_0xe7fe('0x29')][_0xe7fe('0x26')]({'where':{'type':_0x34652a,'resourceId':_0x3c5528['id']}})[_0xe7fe('0x25')](function(){return _0x3962bc;});})[_0xe7fe('0x25')](function(){_0x276a00['status'](0xcc)[_0xe7fe('0x1c')]();});}};}function handleEntityNotFound(_0x536bd9,_0x28d237){return function(_0x11d763){if(!_0x11d763){_0x536bd9['sendStatus'](0x194);}return _0x11d763;};}function handleError(_0x48fa94,_0x2adb68){_0x2adb68=_0x2adb68||0x1f4;return function(_0x115208){logger[_0xe7fe('0x2a')](_0x115208[_0xe7fe('0x2b')]);if(_0x115208[_0xe7fe('0x2c')]){delete _0x115208['name'];}_0x48fa94[_0xe7fe('0x1b')](_0x2adb68)[_0xe7fe('0x2d')](_0x115208);};}exports['index']=function(_0x4dcd4a,_0x1de7c2){var _0x3d575a={},_0x4a92e7={},_0x58267f={'count':0x0,'rows':[]};var _0xeaeb12=_['map'](db[_0xe7fe('0x2e')][_0xe7fe('0x2f')],function(_0x4de331){return{'name':_0x4de331['fieldName'],'type':_0x4de331[_0xe7fe('0x30')][_0xe7fe('0x31')]};});_0x4a92e7[_0xe7fe('0x32')]=_[_0xe7fe('0x33')](_0xeaeb12,_0xe7fe('0x2c'));_0x4a92e7[_0xe7fe('0x34')]=_[_0xe7fe('0x35')](_0x4dcd4a[_0xe7fe('0x34')]);_0x4a92e7[_0xe7fe('0x36')]=_[_0xe7fe('0x37')](_0x4a92e7['model'],_0x4a92e7[_0xe7fe('0x34')]);_0x3d575a[_0xe7fe('0x38')]=_[_0xe7fe('0x37')](_0x4a92e7[_0xe7fe('0x32')],qs[_0xe7fe('0x39')](_0x4dcd4a[_0xe7fe('0x34')][_0xe7fe('0x39')]));_0x3d575a[_0xe7fe('0x38')]=_0x3d575a[_0xe7fe('0x38')][_0xe7fe('0x3a')]?_0x3d575a[_0xe7fe('0x38')]:_0x4a92e7[_0xe7fe('0x32')];if(!_0x4dcd4a[_0xe7fe('0x34')][_0xe7fe('0x3b')]('nolimit')){_0x3d575a['limit']=qs[_0xe7fe('0x20')](_0x4dcd4a[_0xe7fe('0x34')][_0xe7fe('0x20')]);_0x3d575a[_0xe7fe('0x1f')]=qs['offset'](_0x4dcd4a['query'][_0xe7fe('0x1f')]);}_0x3d575a[_0xe7fe('0x3c')]=qs['sort'](_0x4dcd4a[_0xe7fe('0x34')][_0xe7fe('0x3d')]);_0x3d575a[_0xe7fe('0x3e')]=qs[_0xe7fe('0x36')](_['pick'](_0x4dcd4a[_0xe7fe('0x34')],_0x4a92e7[_0xe7fe('0x36')]));if(_0x4dcd4a[_0xe7fe('0x34')]['filter']){_0x3d575a[_0xe7fe('0x3e')]=_['merge'](_0x3d575a[_0xe7fe('0x3e')],{'$or':_[_0xe7fe('0x33')](_0xeaeb12,function(_0xf24835){if(_0xf24835['type']!==_0xe7fe('0x3f')){var _0x21578={};_0x21578[_0xf24835[_0xe7fe('0x2c')]]={'$like':'%'+_0x4dcd4a[_0xe7fe('0x34')][_0xe7fe('0x40')]+'%'};return _0x21578;}})});}_0x3d575a=_[_0xe7fe('0x41')]({},_0x3d575a,_0x4dcd4a[_0xe7fe('0x42')]);var _0x2a3f73={'where':_0x3d575a['where']};return db[_0xe7fe('0x2e')]['count'](_0x2a3f73)[_0xe7fe('0x25')](function(_0x1cea52){_0x58267f[_0xe7fe('0x1e')]=_0x1cea52;if(_0x4dcd4a['query']['includeAll']){_0x3d575a[_0xe7fe('0x43')]=[{'all':!![]}];}return db['Team'][_0xe7fe('0x44')](_0x3d575a);})[_0xe7fe('0x25')](function(_0x14dd6e){_0x58267f[_0xe7fe('0x45')]=_0x14dd6e;return _0x58267f;})[_0xe7fe('0x25')](respondWithFilteredResult(_0x1de7c2,_0x3d575a))[_0xe7fe('0x46')](handleError(_0x1de7c2,null));};exports[_0xe7fe('0x47')]=function(_0x540766,_0x300f73){var _0x378383={'raw':![],'where':{'id':_0x540766[_0xe7fe('0x48')]['id']}},_0x6cf2b1={};_0x6cf2b1['model']=_[_0xe7fe('0x35')](db[_0xe7fe('0x2e')][_0xe7fe('0x2f')]);_0x6cf2b1['query']=_[_0xe7fe('0x35')](_0x540766[_0xe7fe('0x34')]);_0x6cf2b1[_0xe7fe('0x36')]=_[_0xe7fe('0x37')](_0x6cf2b1['model'],_0x6cf2b1[_0xe7fe('0x34')]);_0x378383['attributes']=_['intersection'](_0x6cf2b1[_0xe7fe('0x32')],qs[_0xe7fe('0x39')](_0x540766[_0xe7fe('0x34')]['fields']));_0x378383[_0xe7fe('0x38')]=_0x378383[_0xe7fe('0x38')][_0xe7fe('0x3a')]?_0x378383['attributes']:_0x6cf2b1[_0xe7fe('0x32')];if(_0x540766[_0xe7fe('0x34')]['includeAll']){_0x378383[_0xe7fe('0x43')]=[{'all':!![]}];}_0x378383=_['merge']({},_0x378383,_0x540766[_0xe7fe('0x42')]);return db[_0xe7fe('0x2e')][_0xe7fe('0x49')](_0x378383)[_0xe7fe('0x25')](handleEntityNotFound(_0x300f73,null))[_0xe7fe('0x25')](respondWithResult(_0x300f73,null))[_0xe7fe('0x46')](handleError(_0x300f73,null));};exports[_0xe7fe('0x4a')]=function(_0x3f8d80,_0x383a3f){return db['Team'][_0xe7fe('0x4a')](_0x3f8d80['body'],{})[_0xe7fe('0x25')](function(_0x41d07c){var _0x529233=_0x3f8d80[_0xe7fe('0x4b')][_0xe7fe('0x27')]({'plain':!![]});if(!_0x529233)throw new Error(_0xe7fe('0x4c'));if(_0x529233[_0xe7fe('0x4d')]===_0xe7fe('0x4b')){var _0x54cda8=_0x41d07c[_0xe7fe('0x27')]({'plain':!![]});var _0x51e26c=_0xe7fe('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x51e26c,'userProfileId':_0x529233[_0xe7fe('0x4e')]},'raw':!![]})[_0xe7fe('0x25')](function(_0x2ead94){if(_0x2ead94&&_0x2ead94['autoAssociation']===0x0){return db['UserProfileResource'][_0xe7fe('0x4a')]({'name':_0x54cda8['name'],'resourceId':_0x54cda8['id'],'type':_0x2ead94['name'],'sectionId':_0x2ead94['id']},{})[_0xe7fe('0x25')](function(){return _0x41d07c;});}else{return _0x41d07c;}})[_0xe7fe('0x46')](function(_0x1e1255){logger[_0xe7fe('0x2a')](_0xe7fe('0x4f'),_0x1e1255);throw _0x1e1255;});}return _0x41d07c;})[_0xe7fe('0x25')](respondWithResult(_0x383a3f,0xc9))[_0xe7fe('0x46')](handleError(_0x383a3f,null));};exports['update']=function(_0x35eb55,_0x30616c){if(_0x35eb55[_0xe7fe('0x50')]['id']){delete _0x35eb55[_0xe7fe('0x50')]['id'];}return db[_0xe7fe('0x2e')]['find']({'where':{'id':_0x35eb55[_0xe7fe('0x48')]['id']}})[_0xe7fe('0x25')](handleEntityNotFound(_0x30616c,null))['then'](saveUpdates(_0x35eb55[_0xe7fe('0x50')],null))[_0xe7fe('0x25')](respondWithResult(_0x30616c,null))[_0xe7fe('0x46')](handleError(_0x30616c,null));};exports[_0xe7fe('0x26')]=function(_0x2ab39f,_0x43293b){return db[_0xe7fe('0x2e')][_0xe7fe('0x49')]({'where':{'id':_0x2ab39f[_0xe7fe('0x48')]['id']}})[_0xe7fe('0x25')](handleEntityNotFound(_0x43293b,null))['then'](removeEntity(_0x43293b,null))[_0xe7fe('0x46')](handleError(_0x43293b,null));};exports['getQueues']=function(_0x396c3f,_0x3f9820,_0xde2e33){return db[_0xe7fe('0x2e')][_0xe7fe('0x51')]({'where':{'id':_0x396c3f[_0xe7fe('0x48')]['id']}})[_0xe7fe('0x25')](handleEntityNotFound(_0x3f9820,null))['then'](function(_0x4e470a){if(!_0x396c3f['query'][_0xe7fe('0x52')]||!utils[_0xe7fe('0x53')](_0x396c3f[_0xe7fe('0x34')][_0xe7fe('0x52')])){throw new db[(_0xe7fe('0x54'))]['ValidationError'](_0xe7fe('0x55'));}var _0x2a7aba={};var _0x25ca76={};_0x25ca76['model']=_[_0xe7fe('0x35')](db[_['capitalize'](_0x396c3f[_0xe7fe('0x34')][_0xe7fe('0x52')][_0xe7fe('0x56')]())+_0xe7fe('0x57')][_0xe7fe('0x2f')]);_0x25ca76['query']=_[_0xe7fe('0x35')](_0x396c3f[_0xe7fe('0x34')]);_0x25ca76[_0xe7fe('0x36')]=_[_0xe7fe('0x37')](_0x25ca76[_0xe7fe('0x32')],_0x25ca76[_0xe7fe('0x34')]);_0x2a7aba[_0xe7fe('0x38')]=_['intersection'](_0x25ca76[_0xe7fe('0x32')],qs[_0xe7fe('0x39')](_0x396c3f[_0xe7fe('0x34')][_0xe7fe('0x39')]));_0x2a7aba[_0xe7fe('0x38')]=_0x2a7aba[_0xe7fe('0x38')][_0xe7fe('0x3a')]?_0x2a7aba['attributes']:_0x25ca76[_0xe7fe('0x32')];_0x2a7aba['limit']=qs[_0xe7fe('0x20')](_0x396c3f[_0xe7fe('0x34')]['limit']);_0x2a7aba[_0xe7fe('0x1f')]=qs[_0xe7fe('0x1f')](_0x396c3f[_0xe7fe('0x34')][_0xe7fe('0x1f')]);_0x2a7aba[_0xe7fe('0x3c')]=qs[_0xe7fe('0x3d')](_0x396c3f['query'][_0xe7fe('0x3d')]);_0x2a7aba[_0xe7fe('0x3e')]=qs['filters'](_[_0xe7fe('0x58')](_0x396c3f[_0xe7fe('0x34')],_0x25ca76['filters']));_0x2a7aba=_[_0xe7fe('0x41')]({},_0x2a7aba,_0x396c3f[_0xe7fe('0x42')]);return _0x4e470a['get'+_[_0xe7fe('0x59')](_0x396c3f[_0xe7fe('0x34')][_0xe7fe('0x52')]['toLowerCase']())+_0xe7fe('0x5a')](_0x2a7aba);})['then'](respondWithResult(_0x3f9820,null))['catch'](handleError(_0x3f9820,null));};exports[_0xe7fe('0x5b')]=function(_0x338e73,_0x407061,_0x5580a6){return db[_0xe7fe('0x2e')]['findOne']({'where':{'id':_0x338e73[_0xe7fe('0x48')]['id']}})[_0xe7fe('0x25')](function(_0x58a17c){if(_0x58a17c){if(!_0x338e73[_0xe7fe('0x50')][_0xe7fe('0x52')]||!utils[_0xe7fe('0x53')](_0x338e73[_0xe7fe('0x50')][_0xe7fe('0x52')])){throw new db[(_0xe7fe('0x54'))][(_0xe7fe('0x5c'))]('Unknown\x20channel');}return _0x58a17c['add'+_[_0xe7fe('0x59')](_0x338e73['body'][_0xe7fe('0x52')][_0xe7fe('0x56')]())+_0xe7fe('0x5a')](_0x338e73[_0xe7fe('0x50')][_0xe7fe('0x5d')]);}return null;})['then'](handleEntityNotFound(_0x407061,null))[_0xe7fe('0x25')](respondWithStatusCode(_0x407061,null))[_0xe7fe('0x46')](handleError(_0x407061,null));};exports[_0xe7fe('0x5e')]=function(_0x3bff59,_0x107773,_0x58476c){return db[_0xe7fe('0x2e')][_0xe7fe('0x51')]({'where':{'id':_0x3bff59[_0xe7fe('0x48')]['id']}})[_0xe7fe('0x25')](function(_0x44327d){if(_0x44327d){if(!_0x3bff59[_0xe7fe('0x34')][_0xe7fe('0x52')]||!utils[_0xe7fe('0x53')](_0x3bff59[_0xe7fe('0x34')][_0xe7fe('0x52')])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0x44327d['remove'+_[_0xe7fe('0x59')](_0x3bff59[_0xe7fe('0x34')][_0xe7fe('0x52')]['toLowerCase']())+_0xe7fe('0x5a')](_0x3bff59['query'][_0xe7fe('0x5d')]);}return null;})[_0xe7fe('0x25')](handleEntityNotFound(_0x107773,null))[_0xe7fe('0x25')](respondWithStatusCode(_0x107773,null))[_0xe7fe('0x46')](handleError(_0x107773,null));};exports[_0xe7fe('0x5f')]=function(_0x33d590,_0x5cf9b6,_0x442e3d){return db['Team']['find']({'where':{'id':_0x33d590['params']['id']}})[_0xe7fe('0x25')](handleEntityNotFound(_0x5cf9b6,null))['then'](function(_0x4832c9){if(_0x4832c9){var _0x528216=['Voice','Chat',_0xe7fe('0x60'),'Sms','Fax',_0xe7fe('0x61')];return BPromise[_0xe7fe('0x62')](_0x528216,function(_0xe1b7df){return _0x4832c9[_0xe7fe('0x27')+_0xe1b7df+_0xe7fe('0x5a')]({'attributes':['id',_0xe7fe('0x2c')]})[_0xe7fe('0x25')](function(_0x33864a){return BPromise[_0xe7fe('0x62')](_0x33864a,function(_0x402b74){return _0x402b74[_0xe7fe('0x5f')](_0x33d590[_0xe7fe('0x50')][_0xe7fe('0x5d')])[_0xe7fe('0x25')](function(){if(_0xe1b7df===_0xe7fe('0x63')){return db[_0xe7fe('0x64')][_0xe7fe('0x44')]({'where':{'id':_0x33d590[_0xe7fe('0x50')][_0xe7fe('0x5d')]},'attributes':['id',_0xe7fe('0x2c'),_0xe7fe('0x65'),'voicePause',_0xe7fe('0x66')],'raw':!![]})[_0xe7fe('0x25')](function(_0x29170b){return BPromise[_0xe7fe('0x62')](_[_0xe7fe('0x40')](_0x29170b,{'online':0x1}),function(_0x47e7da){return db['UserVoiceQueueRt'][_0xe7fe('0x67')]({'membername':_0x47e7da['name'],'UserId':_0x47e7da['id'],'queue_name':_0x402b74[_0xe7fe('0x2c')],'VoiceQueueId':_0x402b74['id'],'interface':_[_0xe7fe('0x68')](_0x47e7da['interface'])?util[_0xe7fe('0x69')](_0xe7fe('0x6a'),_0x47e7da[_0xe7fe('0x2c')]):_0x47e7da[_0xe7fe('0x66')],'paused':_0x47e7da['voicePause']||![],'penalty':0x0});});});}});});})['then'](function(){return _0x4832c9;});})[_0xe7fe('0x25')](function(){return _0x4832c9;});}})[_0xe7fe('0x25')](function(_0x24d89f){if(_0x24d89f){return _0x24d89f[_0xe7fe('0x5f')](_0x33d590[_0xe7fe('0x50')]['ids'],_[_0xe7fe('0x6b')](_0x33d590['body'],[_0xe7fe('0x5d'),'id'])||{})[_0xe7fe('0x6c')](function(_0xeaa266){for(var _0x51e739=0x0;_0x51e739<_0x33d590[_0xe7fe('0x50')]['ids'][_0xe7fe('0x3a')];_0x51e739+=0x1){socket[_0xe7fe('0x6d')]('userTeam:save',{'UserId':_0x33d590[_0xe7fe('0x50')][_0xe7fe('0x5d')][_0x51e739],'TeamId':_0x33d590[_0xe7fe('0x48')]['id']});}return _0xeaa266;});}})['then'](respondWithResult(_0x5cf9b6,null))[_0xe7fe('0x46')](handleError(_0x5cf9b6,null));};exports[_0xe7fe('0x6e')]=function(_0x28cdd2,_0x2c9e5a,_0x4f28e5){return db[_0xe7fe('0x2e')][_0xe7fe('0x49')]({'where':{'id':_0x28cdd2[_0xe7fe('0x48')]['id']}})['then'](handleEntityNotFound(_0x2c9e5a,null))[_0xe7fe('0x25')](function(_0x3144dd){if(_0x3144dd){return BPromise[_0xe7fe('0x62')]([_0xe7fe('0x6f'),'chat',_0xe7fe('0x70'),'sms',_0xe7fe('0x71'),_0xe7fe('0x72')],function(_0x33f30f){return _0x3144dd['get'+_[_0xe7fe('0x59')](_0x33f30f)+'Queues']({'attributes':['id','name']})['then'](function(_0x183dab){return BPromise['each'](_0x183dab,function(_0x2f89bb){return _0x2f89bb[_0xe7fe('0x6e')](_0x28cdd2['query'][_0xe7fe('0x5d')])[_0xe7fe('0x25')](function(){if(_0x33f30f===_0xe7fe('0x6f')){return db[_0xe7fe('0x73')]['destroy']({'where':{'VoiceQueueId':_0x2f89bb['id'],'UserId':_0x28cdd2[_0xe7fe('0x34')][_0xe7fe('0x5d')]}});}});});})[_0xe7fe('0x25')](function(){return _0x3144dd;});})[_0xe7fe('0x25')](function(){return _0x3144dd;});}})[_0xe7fe('0x25')](function(_0x2b626b){if(_0x2b626b){return _0x2b626b[_0xe7fe('0x6e')](_0x28cdd2[_0xe7fe('0x34')][_0xe7fe('0x5d')])['then'](function(){if(_['isArray'](_0x28cdd2[_0xe7fe('0x34')]['ids'])){for(var _0x3ea226=0x0;_0x3ea226<_0x28cdd2[_0xe7fe('0x34')]['ids'][_0xe7fe('0x3a')];_0x3ea226+=0x1){socket['emit']('userTeam:remove',{'UserId':Number(_0x28cdd2[_0xe7fe('0x34')][_0xe7fe('0x5d')][_0x3ea226]),'TeamId':Number(_0x28cdd2[_0xe7fe('0x48')]['id'])});}}else{socket[_0xe7fe('0x6d')](_0xe7fe('0x74'),{'UserId':Number(_0x28cdd2[_0xe7fe('0x34')][_0xe7fe('0x5d')]),'TeamId':Number(_0x28cdd2[_0xe7fe('0x48')]['id'])});}});}})[_0xe7fe('0x25')](respondWithStatusCode(_0x2c9e5a,null))[_0xe7fe('0x46')](handleError(_0x2c9e5a,null));};exports['getAgents']=function(_0x4af4fb,_0x3c5a16,_0x415230){var _0x3a01d0={};var _0x4957d5={};var _0x3e8112;var _0x3748ed;return db['Team'][_0xe7fe('0x51')]({'where':{'id':_0x4af4fb[_0xe7fe('0x48')]['id']}})[_0xe7fe('0x25')](handleEntityNotFound(_0x3c5a16,null))[_0xe7fe('0x25')](function(_0x3c1739){if(_0x3c1739){_0x3e8112=_0x3c1739;_0x4957d5['model']=_[_0xe7fe('0x35')](db[_0xe7fe('0x64')][_0xe7fe('0x2f')]);_0x4957d5[_0xe7fe('0x34')]=_[_0xe7fe('0x35')](_0x4af4fb[_0xe7fe('0x34')]);_0x4957d5[_0xe7fe('0x36')]=_[_0xe7fe('0x37')](_0x4957d5[_0xe7fe('0x32')],_0x4957d5[_0xe7fe('0x34')]);_0x3a01d0['attributes']=_['intersection'](_0x4957d5[_0xe7fe('0x32')],qs[_0xe7fe('0x39')](_0x4af4fb[_0xe7fe('0x34')]['fields']));_0x3a01d0[_0xe7fe('0x38')]=_0x3a01d0[_0xe7fe('0x38')]['length']?_0x3a01d0[_0xe7fe('0x38')]:_0x4957d5['model'];_0x3a01d0['order']=qs['sort'](_0x4af4fb['query'][_0xe7fe('0x3d')]);_0x3a01d0[_0xe7fe('0x3e')]=qs[_0xe7fe('0x36')](_[_0xe7fe('0x58')](_0x4af4fb[_0xe7fe('0x34')],_0x4957d5['filters']));if(_0x4af4fb[_0xe7fe('0x34')][_0xe7fe('0x40')]){_0x3a01d0[_0xe7fe('0x3e')]=_[_0xe7fe('0x41')](_0x3a01d0[_0xe7fe('0x3e')],{'$or':_[_0xe7fe('0x33')](_0x3a01d0[_0xe7fe('0x38')],function(_0x163d52){var _0x6794c6={};_0x6794c6[_0x163d52]={'$like':'%'+_0x4af4fb[_0xe7fe('0x34')][_0xe7fe('0x40')]+'%'};return _0x6794c6;})});}_0x3a01d0=_['merge']({},_0x3a01d0,_0x4af4fb['options']);return _0x3e8112['getAgents'](_0x3a01d0);}})[_0xe7fe('0x25')](function(_0x5d4cd7){if(_0x5d4cd7){_0x3748ed=_0x5d4cd7[_0xe7fe('0x3a')];if(!_0x4af4fb[_0xe7fe('0x34')][_0xe7fe('0x3b')](_0xe7fe('0x75'))){_0x3a01d0['limit']=qs[_0xe7fe('0x20')](_0x4af4fb[_0xe7fe('0x34')][_0xe7fe('0x20')]);_0x3a01d0[_0xe7fe('0x1f')]=qs[_0xe7fe('0x1f')](_0x4af4fb[_0xe7fe('0x34')]['offset']);}return _0x3e8112[_0xe7fe('0x76')](_0x3a01d0);}})[_0xe7fe('0x25')](function(_0x31f0c7){if(_0x31f0c7){return _0x31f0c7?{'count':_0x3748ed,'rows':_0x31f0c7}:null;}})[_0xe7fe('0x25')](respondWithResult(_0x3c5a16,null))['catch'](handleError(_0x3c5a16,null));}; \ No newline at end of file +var _0x9d62=['get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','channel','isValidChannel','Sequelize','ValidationError','toLowerCase','Queue','Queues','Unknown\x20channel','capitalize','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Fax','each','User','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','omit','emit','userTeam:save','removeAgents','voice','chat','fax','openchannel','isArray','userTeam:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','end','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','sendStatus','error','name','send','Team','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','user'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9d62,0xaf));var _0x29d6=function(_0xe4429,_0x32f927){_0xe4429=_0xe4429-0x0;var _0x19288f=_0x9d62[_0xe4429];return _0x19288f;};'use strict';var pdf=require(_0x29d6('0x0'));var emlformat=require(_0x29d6('0x1'));var rimraf=require(_0x29d6('0x2'));var zipdir=require(_0x29d6('0x3'));var jsonpatch=require(_0x29d6('0x4'));var rp=require('request-promise');var moment=require(_0x29d6('0x5'));var BPromise=require(_0x29d6('0x6'));var Mustache=require(_0x29d6('0x7'));var util=require(_0x29d6('0x8'));var path=require(_0x29d6('0x9'));var sox=require('sox');var csv=require(_0x29d6('0xa'));var ejs=require(_0x29d6('0xb'));var fs=require('fs');var _=require(_0x29d6('0xc'));var squel=require(_0x29d6('0xd'));var crypto=require(_0x29d6('0xe'));var jsforce=require(_0x29d6('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x29d6('0xa'));var querystring=require(_0x29d6('0x10'));var Papa=require(_0x29d6('0x11'));var Redis=require(_0x29d6('0x12'));var authService=require(_0x29d6('0x13'));var qs=require(_0x29d6('0x14'));var as=require(_0x29d6('0x15'));var hardwareService=require(_0x29d6('0x16'));var logger=require('../../config/logger')(_0x29d6('0x17'));var utils=require(_0x29d6('0x18'));var config=require(_0x29d6('0x19'));var db=require(_0x29d6('0x1a'))['db'];config[_0x29d6('0x1b')]=_[_0x29d6('0x1c')](config[_0x29d6('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x29d6('0x1d'))(new Redis(config['redis']));require(_0x29d6('0x1e'))[_0x29d6('0x1f')](socket);function respondWithStatusCode(_0x2f4968,_0x305a69){_0x305a69=_0x305a69||0xcc;return function(_0x5aba64){if(_0x5aba64){return _0x2f4968['sendStatus'](_0x305a69);}return _0x2f4968['status'](_0x305a69)[_0x29d6('0x20')]();};}function respondWithResult(_0x30d39f,_0x261225){_0x261225=_0x261225||0xc8;return function(_0x93bf56){if(_0x93bf56){return _0x30d39f[_0x29d6('0x21')](_0x261225)[_0x29d6('0x22')](_0x93bf56);}};}function respondWithFilteredResult(_0x3fe751,_0x59355a){return function(_0x434b91){if(_0x434b91){var _0x46307e=_0x434b91[_0x29d6('0x23')],_0x6861fe=_0x59355a[_0x29d6('0x24')],_0x50c734=_0x59355a[_0x29d6('0x24')]+_0x59355a[_0x29d6('0x25')],_0x397937;if(_0x50c734>=_0x46307e){_0x50c734=_0x46307e;_0x397937=0xc8;}else{_0x397937=0xce;}_0x3fe751[_0x29d6('0x21')](_0x397937);return _0x3fe751[_0x29d6('0x26')](_0x29d6('0x27'),_0x6861fe+'-'+_0x50c734+'/'+_0x46307e)['json'](_0x434b91);}return null;};}function patchUpdates(_0x4701ca){return function(_0x425263){try{jsonpatch['apply'](_0x425263,_0x4701ca,!![]);}catch(_0x30c120){return BPromise[_0x29d6('0x28')](_0x30c120);}return _0x425263[_0x29d6('0x29')]();};}function saveUpdates(_0x585e72,_0x53f285){return function(_0x1d8d32){if(_0x1d8d32){return _0x1d8d32['update'](_0x585e72)[_0x29d6('0x2a')](function(_0x1c2920){return _0x1c2920;});}return null;};}function removeEntity(_0x51cff7,_0x8d91f5){return function(_0x28370b){if(_0x28370b){return _0x28370b[_0x29d6('0x2b')]()[_0x29d6('0x2a')](function(){var _0x18ad77=_0x28370b['get']({'plain':!![]});var _0x29c1fd='Teams';return db['UserProfileResource']['destroy']({'where':{'type':_0x29c1fd,'resourceId':_0x18ad77['id']}})[_0x29d6('0x2a')](function(){return _0x28370b;});})['then'](function(){_0x51cff7[_0x29d6('0x21')](0xcc)[_0x29d6('0x20')]();});}};}function handleEntityNotFound(_0x54ea45,_0x210ee1){return function(_0x53830a){if(!_0x53830a){_0x54ea45[_0x29d6('0x2c')](0x194);}return _0x53830a;};}function handleError(_0x4abf4f,_0x4af26f){_0x4af26f=_0x4af26f||0x1f4;return function(_0x110dc5){logger[_0x29d6('0x2d')](_0x110dc5['stack']);if(_0x110dc5[_0x29d6('0x2e')]){delete _0x110dc5[_0x29d6('0x2e')];}_0x4abf4f[_0x29d6('0x21')](_0x4af26f)[_0x29d6('0x2f')](_0x110dc5);};}exports['index']=function(_0xa9b5e,_0x5eb783){var _0x49abc9={},_0x47ebba={},_0x420a15={'count':0x0,'rows':[]};var _0x7665c4=_['map'](db[_0x29d6('0x30')][_0x29d6('0x31')],function(_0x34099b){return{'name':_0x34099b[_0x29d6('0x32')],'type':_0x34099b[_0x29d6('0x33')]['key']};});_0x47ebba[_0x29d6('0x34')]=_[_0x29d6('0x35')](_0x7665c4,_0x29d6('0x2e'));_0x47ebba[_0x29d6('0x36')]=_['keys'](_0xa9b5e[_0x29d6('0x36')]);_0x47ebba[_0x29d6('0x37')]=_[_0x29d6('0x38')](_0x47ebba[_0x29d6('0x34')],_0x47ebba[_0x29d6('0x36')]);_0x49abc9['attributes']=_[_0x29d6('0x38')](_0x47ebba[_0x29d6('0x34')],qs[_0x29d6('0x39')](_0xa9b5e[_0x29d6('0x36')][_0x29d6('0x39')]));_0x49abc9[_0x29d6('0x3a')]=_0x49abc9[_0x29d6('0x3a')][_0x29d6('0x3b')]?_0x49abc9[_0x29d6('0x3a')]:_0x47ebba[_0x29d6('0x34')];if(!_0xa9b5e[_0x29d6('0x36')][_0x29d6('0x3c')]('nolimit')){_0x49abc9['limit']=qs['limit'](_0xa9b5e[_0x29d6('0x36')][_0x29d6('0x25')]);_0x49abc9['offset']=qs[_0x29d6('0x24')](_0xa9b5e[_0x29d6('0x36')][_0x29d6('0x24')]);}_0x49abc9[_0x29d6('0x3d')]=qs[_0x29d6('0x3e')](_0xa9b5e[_0x29d6('0x36')]['sort']);_0x49abc9[_0x29d6('0x3f')]=qs[_0x29d6('0x37')](_[_0x29d6('0x40')](_0xa9b5e[_0x29d6('0x36')],_0x47ebba[_0x29d6('0x37')]));if(_0xa9b5e[_0x29d6('0x36')][_0x29d6('0x41')]){_0x49abc9[_0x29d6('0x3f')]=_[_0x29d6('0x42')](_0x49abc9[_0x29d6('0x3f')],{'$or':_[_0x29d6('0x35')](_0x7665c4,function(_0x16bd41){if(_0x16bd41[_0x29d6('0x33')]!==_0x29d6('0x43')){var _0x2a62f9={};_0x2a62f9[_0x16bd41[_0x29d6('0x2e')]]={'$like':'%'+_0xa9b5e[_0x29d6('0x36')]['filter']+'%'};return _0x2a62f9;}})});}_0x49abc9=_['merge']({},_0x49abc9,_0xa9b5e[_0x29d6('0x44')]);var _0x1af0de={'where':_0x49abc9[_0x29d6('0x3f')]};return db[_0x29d6('0x30')][_0x29d6('0x23')](_0x1af0de)[_0x29d6('0x2a')](function(_0x2f9d2a){_0x420a15[_0x29d6('0x23')]=_0x2f9d2a;if(_0xa9b5e['query'][_0x29d6('0x45')]){_0x49abc9[_0x29d6('0x46')]=[{'all':!![]}];}return db[_0x29d6('0x30')][_0x29d6('0x47')](_0x49abc9);})[_0x29d6('0x2a')](function(_0x18e160){_0x420a15[_0x29d6('0x48')]=_0x18e160;return _0x420a15;})[_0x29d6('0x2a')](respondWithFilteredResult(_0x5eb783,_0x49abc9))['catch'](handleError(_0x5eb783,null));};exports[_0x29d6('0x49')]=function(_0x3df6a3,_0x2c3cd5){var _0x43042d={'raw':![],'where':{'id':_0x3df6a3[_0x29d6('0x4a')]['id']}},_0x5038ef={};_0x5038ef[_0x29d6('0x34')]=_[_0x29d6('0x4b')](db[_0x29d6('0x30')][_0x29d6('0x31')]);_0x5038ef[_0x29d6('0x36')]=_[_0x29d6('0x4b')](_0x3df6a3['query']);_0x5038ef[_0x29d6('0x37')]=_[_0x29d6('0x38')](_0x5038ef[_0x29d6('0x34')],_0x5038ef['query']);_0x43042d['attributes']=_[_0x29d6('0x38')](_0x5038ef[_0x29d6('0x34')],qs[_0x29d6('0x39')](_0x3df6a3[_0x29d6('0x36')][_0x29d6('0x39')]));_0x43042d['attributes']=_0x43042d[_0x29d6('0x3a')][_0x29d6('0x3b')]?_0x43042d['attributes']:_0x5038ef['model'];if(_0x3df6a3['query'][_0x29d6('0x45')]){_0x43042d[_0x29d6('0x46')]=[{'all':!![]}];}_0x43042d=_[_0x29d6('0x42')]({},_0x43042d,_0x3df6a3[_0x29d6('0x44')]);return db[_0x29d6('0x30')][_0x29d6('0x4c')](_0x43042d)[_0x29d6('0x2a')](handleEntityNotFound(_0x2c3cd5,null))['then'](respondWithResult(_0x2c3cd5,null))[_0x29d6('0x4d')](handleError(_0x2c3cd5,null));};exports[_0x29d6('0x4e')]=function(_0x2979c1,_0x570a3c){return db[_0x29d6('0x30')][_0x29d6('0x4e')](_0x2979c1[_0x29d6('0x4f')],{})[_0x29d6('0x2a')](function(_0x1eb37d){var _0x3341f2=_0x2979c1[_0x29d6('0x50')][_0x29d6('0x51')]({'plain':!![]});if(!_0x3341f2)throw new Error(_0x29d6('0x52'));if(_0x3341f2['role']===_0x29d6('0x50')){var _0xa14176=_0x1eb37d[_0x29d6('0x51')]({'plain':!![]});var _0x7551=_0x29d6('0x53');return db[_0x29d6('0x54')][_0x29d6('0x4c')]({'where':{'name':_0x7551,'userProfileId':_0x3341f2[_0x29d6('0x55')]},'raw':!![]})['then'](function(_0x13beed){if(_0x13beed&&_0x13beed[_0x29d6('0x56')]===0x0){return db[_0x29d6('0x57')]['create']({'name':_0xa14176[_0x29d6('0x2e')],'resourceId':_0xa14176['id'],'type':_0x13beed[_0x29d6('0x2e')],'sectionId':_0x13beed['id']},{})['then'](function(){return _0x1eb37d;});}else{return _0x1eb37d;}})[_0x29d6('0x4d')](function(_0x19e0cb){logger[_0x29d6('0x2d')](_0x29d6('0x58'),_0x19e0cb);throw _0x19e0cb;});}return _0x1eb37d;})[_0x29d6('0x2a')](respondWithResult(_0x570a3c,0xc9))[_0x29d6('0x4d')](handleError(_0x570a3c,null));};exports['update']=function(_0x152148,_0x59f9ea){if(_0x152148['body']['id']){delete _0x152148[_0x29d6('0x4f')]['id'];}return db[_0x29d6('0x30')]['find']({'where':{'id':_0x152148[_0x29d6('0x4a')]['id']}})[_0x29d6('0x2a')](handleEntityNotFound(_0x59f9ea,null))['then'](saveUpdates(_0x152148[_0x29d6('0x4f')],null))[_0x29d6('0x2a')](respondWithResult(_0x59f9ea,null))[_0x29d6('0x4d')](handleError(_0x59f9ea,null));};exports[_0x29d6('0x2b')]=function(_0x2d8892,_0x279ec8){return db[_0x29d6('0x30')][_0x29d6('0x4c')]({'where':{'id':_0x2d8892[_0x29d6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x279ec8,null))[_0x29d6('0x2a')](removeEntity(_0x279ec8,null))[_0x29d6('0x4d')](handleError(_0x279ec8,null));};exports['getQueues']=function(_0x315329,_0x52c285,_0x13c26a){return db[_0x29d6('0x30')][_0x29d6('0x59')]({'where':{'id':_0x315329[_0x29d6('0x4a')]['id']}})[_0x29d6('0x2a')](handleEntityNotFound(_0x52c285,null))[_0x29d6('0x2a')](function(_0x1bffc4){if(!_0x315329[_0x29d6('0x36')][_0x29d6('0x5a')]||!utils[_0x29d6('0x5b')](_0x315329[_0x29d6('0x36')][_0x29d6('0x5a')])){throw new db[(_0x29d6('0x5c'))][(_0x29d6('0x5d'))]('Unknown\x20channel');}var _0x1383f4={};var _0x4028e4={};_0x4028e4[_0x29d6('0x34')]=_[_0x29d6('0x4b')](db[_['capitalize'](_0x315329['query'][_0x29d6('0x5a')][_0x29d6('0x5e')]())+_0x29d6('0x5f')][_0x29d6('0x31')]);_0x4028e4[_0x29d6('0x36')]=_[_0x29d6('0x4b')](_0x315329['query']);_0x4028e4[_0x29d6('0x37')]=_['intersection'](_0x4028e4['model'],_0x4028e4[_0x29d6('0x36')]);_0x1383f4[_0x29d6('0x3a')]=_[_0x29d6('0x38')](_0x4028e4[_0x29d6('0x34')],qs[_0x29d6('0x39')](_0x315329['query'][_0x29d6('0x39')]));_0x1383f4[_0x29d6('0x3a')]=_0x1383f4[_0x29d6('0x3a')][_0x29d6('0x3b')]?_0x1383f4[_0x29d6('0x3a')]:_0x4028e4['model'];_0x1383f4[_0x29d6('0x25')]=qs[_0x29d6('0x25')](_0x315329['query'][_0x29d6('0x25')]);_0x1383f4[_0x29d6('0x24')]=qs[_0x29d6('0x24')](_0x315329['query']['offset']);_0x1383f4['order']=qs[_0x29d6('0x3e')](_0x315329[_0x29d6('0x36')][_0x29d6('0x3e')]);_0x1383f4[_0x29d6('0x3f')]=qs[_0x29d6('0x37')](_['pick'](_0x315329[_0x29d6('0x36')],_0x4028e4['filters']));_0x1383f4=_[_0x29d6('0x42')]({},_0x1383f4,_0x315329['options']);return _0x1bffc4['get'+_['capitalize'](_0x315329[_0x29d6('0x36')][_0x29d6('0x5a')]['toLowerCase']())+_0x29d6('0x60')](_0x1383f4);})[_0x29d6('0x2a')](respondWithResult(_0x52c285,null))['catch'](handleError(_0x52c285,null));};exports['addQueues']=function(_0x1eedd6,_0x56aae8,_0x166d9f){return db['Team']['findOne']({'where':{'id':_0x1eedd6['params']['id']}})[_0x29d6('0x2a')](function(_0x437724){if(_0x437724){if(!_0x1eedd6[_0x29d6('0x4f')][_0x29d6('0x5a')]||!utils[_0x29d6('0x5b')](_0x1eedd6[_0x29d6('0x4f')][_0x29d6('0x5a')])){throw new db[(_0x29d6('0x5c'))][(_0x29d6('0x5d'))](_0x29d6('0x61'));}return _0x437724['add'+_[_0x29d6('0x62')](_0x1eedd6[_0x29d6('0x4f')]['channel']['toLowerCase']())+_0x29d6('0x60')](_0x1eedd6[_0x29d6('0x4f')][_0x29d6('0x63')]);}return null;})[_0x29d6('0x2a')](handleEntityNotFound(_0x56aae8,null))[_0x29d6('0x2a')](respondWithStatusCode(_0x56aae8,null))[_0x29d6('0x4d')](handleError(_0x56aae8,null));};exports[_0x29d6('0x64')]=function(_0x520a89,_0x30e230,_0x1b78e5){return db[_0x29d6('0x30')][_0x29d6('0x59')]({'where':{'id':_0x520a89['params']['id']}})['then'](function(_0x66e866){if(_0x66e866){if(!_0x520a89[_0x29d6('0x36')]['channel']||!utils[_0x29d6('0x5b')](_0x520a89[_0x29d6('0x36')][_0x29d6('0x5a')])){throw new db[(_0x29d6('0x5c'))][(_0x29d6('0x5d'))](_0x29d6('0x61'));}return _0x66e866[_0x29d6('0x65')+_[_0x29d6('0x62')](_0x520a89[_0x29d6('0x36')][_0x29d6('0x5a')][_0x29d6('0x5e')]())+_0x29d6('0x60')](_0x520a89[_0x29d6('0x36')][_0x29d6('0x63')]);}return null;})[_0x29d6('0x2a')](handleEntityNotFound(_0x30e230,null))['then'](respondWithStatusCode(_0x30e230,null))[_0x29d6('0x4d')](handleError(_0x30e230,null));};exports[_0x29d6('0x66')]=function(_0x1b62e7,_0x3b3cf4,_0x291dee){return db['Team'][_0x29d6('0x4c')]({'where':{'id':_0x1b62e7[_0x29d6('0x4a')]['id']}})[_0x29d6('0x2a')](handleEntityNotFound(_0x3b3cf4,null))[_0x29d6('0x2a')](function(_0xece856){if(_0xece856){var _0x7559da=[_0x29d6('0x67'),_0x29d6('0x68'),_0x29d6('0x69'),_0x29d6('0x6a'),_0x29d6('0x6b'),'Openchannel'];return BPromise['each'](_0x7559da,function(_0x417ac2){return _0xece856[_0x29d6('0x51')+_0x417ac2+_0x29d6('0x60')]({'attributes':['id','name']})[_0x29d6('0x2a')](function(_0x12de98){return BPromise[_0x29d6('0x6c')](_0x12de98,function(_0x53f2d4){return _0x53f2d4['addAgents'](_0x1b62e7[_0x29d6('0x4f')][_0x29d6('0x63')])[_0x29d6('0x2a')](function(){if(_0x417ac2===_0x29d6('0x67')){return db[_0x29d6('0x6d')][_0x29d6('0x47')]({'where':{'id':_0x1b62e7[_0x29d6('0x4f')][_0x29d6('0x63')]},'attributes':['id',_0x29d6('0x2e'),_0x29d6('0x6e'),_0x29d6('0x6f'),_0x29d6('0x70')],'raw':!![]})[_0x29d6('0x2a')](function(_0x4457ac){return BPromise[_0x29d6('0x6c')](_[_0x29d6('0x41')](_0x4457ac,{'online':0x1}),function(_0x35a791){return db[_0x29d6('0x71')][_0x29d6('0x72')]({'membername':_0x35a791[_0x29d6('0x2e')],'UserId':_0x35a791['id'],'queue_name':_0x53f2d4[_0x29d6('0x2e')],'VoiceQueueId':_0x53f2d4['id'],'interface':_[_0x29d6('0x73')](_0x35a791['interface'])?util[_0x29d6('0x74')]('SIP/%s',_0x35a791[_0x29d6('0x2e')]):_0x35a791['interface'],'paused':_0x35a791['voicePause']||![],'penalty':0x0});});});}});});})[_0x29d6('0x2a')](function(){return _0xece856;});})['then'](function(){return _0xece856;});}})[_0x29d6('0x2a')](function(_0x4024f5){if(_0x4024f5){return _0x4024f5[_0x29d6('0x66')](_0x1b62e7[_0x29d6('0x4f')][_0x29d6('0x63')],_[_0x29d6('0x75')](_0x1b62e7[_0x29d6('0x4f')],[_0x29d6('0x63'),'id'])||{})['spread'](function(_0x4a7e32){for(var _0x4d5679=0x0;_0x4d5679<_0x1b62e7['body']['ids'][_0x29d6('0x3b')];_0x4d5679+=0x1){socket[_0x29d6('0x76')](_0x29d6('0x77'),{'UserId':_0x1b62e7['body'][_0x29d6('0x63')][_0x4d5679],'TeamId':_0x1b62e7[_0x29d6('0x4a')]['id']});}return _0x4a7e32;});}})[_0x29d6('0x2a')](respondWithResult(_0x3b3cf4,null))[_0x29d6('0x4d')](handleError(_0x3b3cf4,null));};exports[_0x29d6('0x78')]=function(_0x5982bb,_0xa6eec0,_0x26bc17){return db[_0x29d6('0x30')][_0x29d6('0x4c')]({'where':{'id':_0x5982bb[_0x29d6('0x4a')]['id']}})['then'](handleEntityNotFound(_0xa6eec0,null))['then'](function(_0x26bd09){if(_0x26bd09){return BPromise[_0x29d6('0x6c')]([_0x29d6('0x79'),_0x29d6('0x7a'),'mail','sms',_0x29d6('0x7b'),_0x29d6('0x7c')],function(_0x5dd181){return _0x26bd09['get'+_[_0x29d6('0x62')](_0x5dd181)+_0x29d6('0x60')]({'attributes':['id','name']})['then'](function(_0xc61c5a){return BPromise[_0x29d6('0x6c')](_0xc61c5a,function(_0x14f895){return _0x14f895[_0x29d6('0x78')](_0x5982bb[_0x29d6('0x36')][_0x29d6('0x63')])[_0x29d6('0x2a')](function(){if(_0x5dd181===_0x29d6('0x79')){return db[_0x29d6('0x71')][_0x29d6('0x2b')]({'where':{'VoiceQueueId':_0x14f895['id'],'UserId':_0x5982bb['query']['ids']}});}});});})['then'](function(){return _0x26bd09;});})[_0x29d6('0x2a')](function(){return _0x26bd09;});}})[_0x29d6('0x2a')](function(_0x317882){if(_0x317882){return _0x317882[_0x29d6('0x78')](_0x5982bb[_0x29d6('0x36')][_0x29d6('0x63')])['then'](function(){if(_[_0x29d6('0x7d')](_0x5982bb[_0x29d6('0x36')]['ids'])){for(var _0x245c72=0x0;_0x245c72<_0x5982bb[_0x29d6('0x36')][_0x29d6('0x63')][_0x29d6('0x3b')];_0x245c72+=0x1){socket['emit'](_0x29d6('0x7e'),{'UserId':Number(_0x5982bb['query'][_0x29d6('0x63')][_0x245c72]),'TeamId':Number(_0x5982bb[_0x29d6('0x4a')]['id'])});}}else{socket['emit'](_0x29d6('0x7e'),{'UserId':Number(_0x5982bb[_0x29d6('0x36')][_0x29d6('0x63')]),'TeamId':Number(_0x5982bb[_0x29d6('0x4a')]['id'])});}});}})[_0x29d6('0x2a')](respondWithStatusCode(_0xa6eec0,null))['catch'](handleError(_0xa6eec0,null));};exports[_0x29d6('0x7f')]=function(_0x299805,_0xcb84fb,_0x514728){var _0x472e20={};var _0x1d0567={};var _0x1217e4;var _0x2dd860;return db[_0x29d6('0x30')][_0x29d6('0x59')]({'where':{'id':_0x299805['params']['id']}})[_0x29d6('0x2a')](handleEntityNotFound(_0xcb84fb,null))[_0x29d6('0x2a')](function(_0x428775){if(_0x428775){_0x1217e4=_0x428775;_0x1d0567[_0x29d6('0x34')]=_[_0x29d6('0x4b')](db[_0x29d6('0x6d')]['rawAttributes']);_0x1d0567[_0x29d6('0x36')]=_[_0x29d6('0x4b')](_0x299805[_0x29d6('0x36')]);_0x1d0567[_0x29d6('0x37')]=_[_0x29d6('0x38')](_0x1d0567[_0x29d6('0x34')],_0x1d0567['query']);_0x472e20[_0x29d6('0x3a')]=_[_0x29d6('0x38')](_0x1d0567['model'],qs[_0x29d6('0x39')](_0x299805[_0x29d6('0x36')][_0x29d6('0x39')]));_0x472e20[_0x29d6('0x3a')]=_0x472e20[_0x29d6('0x3a')][_0x29d6('0x3b')]?_0x472e20[_0x29d6('0x3a')]:_0x1d0567[_0x29d6('0x34')];_0x472e20[_0x29d6('0x3d')]=qs[_0x29d6('0x3e')](_0x299805[_0x29d6('0x36')][_0x29d6('0x3e')]);_0x472e20[_0x29d6('0x3f')]=qs[_0x29d6('0x37')](_[_0x29d6('0x40')](_0x299805[_0x29d6('0x36')],_0x1d0567[_0x29d6('0x37')]));if(_0x299805[_0x29d6('0x36')][_0x29d6('0x41')]){_0x472e20[_0x29d6('0x3f')]=_[_0x29d6('0x42')](_0x472e20[_0x29d6('0x3f')],{'$or':_['map'](_0x472e20[_0x29d6('0x3a')],function(_0x39e027){var _0x578816={};_0x578816[_0x39e027]={'$like':'%'+_0x299805[_0x29d6('0x36')][_0x29d6('0x41')]+'%'};return _0x578816;})});}_0x472e20=_[_0x29d6('0x42')]({},_0x472e20,_0x299805[_0x29d6('0x44')]);return _0x1217e4[_0x29d6('0x7f')](_0x472e20);}})[_0x29d6('0x2a')](function(_0x2a87ae){if(_0x2a87ae){_0x2dd860=_0x2a87ae['length'];if(!_0x299805[_0x29d6('0x36')][_0x29d6('0x3c')]('nolimit')){_0x472e20[_0x29d6('0x25')]=qs[_0x29d6('0x25')](_0x299805['query']['limit']);_0x472e20['offset']=qs[_0x29d6('0x24')](_0x299805[_0x29d6('0x36')][_0x29d6('0x24')]);}return _0x1217e4['getAgents'](_0x472e20);}})[_0x29d6('0x2a')](function(_0x143780){if(_0x143780){return _0x143780?{'count':_0x2dd860,'rows':_0x143780}:null;}})[_0x29d6('0x2a')](respondWithResult(_0xcb84fb,null))['catch'](handleError(_0xcb84fb,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 2818eeb..22a1ae6 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 _0x79a5=['hook','exports','../../mysqldb','Team','setMaxListeners','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79a5,0x14a));var _0x579a=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x79a5[_0x9fd887];return _0x1a54ab;};'use strict';var EventEmitter=require('events');var Team=require(_0x579a('0x0'))['db'][_0x579a('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x579a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x579a('0x3'),'afterDestroy':_0x579a('0x4')};function emitEvent(_0x11d09c){return function(_0x376a25,_0x149892,_0x52b78c){TeamEvents[_0x579a('0x5')](_0x11d09c+':'+_0x376a25['id'],_0x376a25);TeamEvents[_0x579a('0x5')](_0x11d09c,_0x376a25);_0x52b78c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x579a('0x6')](e,emitEvent(event));}}module[_0x579a('0x7')]=TeamEvents; \ No newline at end of file +var _0x3402=['events','Team','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x3402,0x78));var _0x2340=function(_0x35a105,_0x1d1934){_0x35a105=_0x35a105-0x0;var _0x131da4=_0x3402[_0x35a105];return _0x131da4;};'use strict';var EventEmitter=require(_0x2340('0x0'));var Team=require('../../mysqldb')['db'][_0x2340('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2340('0x2'),'afterUpdate':'update','afterDestroy':_0x2340('0x3')};function emitEvent(_0x369e5a){return function(_0x945302,_0x37d9ac,_0x1200d1){TeamEvents[_0x2340('0x4')](_0x369e5a+':'+_0x945302['id'],_0x945302);TeamEvents['emit'](_0x369e5a,_0x945302);_0x1200d1(null);};}for(var e in events){if(events[_0x2340('0x5')](e)){var event=events[e];Team[_0x2340('0x6')](e,emitEvent(event));}}module[_0x2340('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 1c40240..dbcd694 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 _0x3ebe=['rimraf','../../config/environment','exports','define','teams','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ebe,0x1e9));var _0xe3eb=function(_0x2eaba2,_0x53be18){_0x2eaba2=_0x2eaba2-0x0;var _0x12c25b=_0x3ebe[_0x2eaba2];return _0x12c25b;};'use strict';var _=require(_0xe3eb('0x0'));var util=require(_0xe3eb('0x1'));var logger=require(_0xe3eb('0x2'))(_0xe3eb('0x3'));var moment=require(_0xe3eb('0x4'));var BPromise=require('bluebird');var rp=require(_0xe3eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe3eb('0x6'));var config=require(_0xe3eb('0x7'));var attributes=require('./team.attributes');module[_0xe3eb('0x8')]=function(_0xcaf395,_0x497cd0){return _0xcaf395[_0xe3eb('0x9')]('Team',attributes,{'tableName':_0xe3eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc52b=['rimraf','Team','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x3e7f83,_0x77ebd0){var _0x266369=function(_0x5842a7){while(--_0x5842a7){_0x3e7f83['push'](_0x3e7f83['shift']());}};_0x266369(++_0x77ebd0);}(_0xc52b,0x1b2));var _0xbc52=function(_0x2a2530,_0x5d18c2){_0x2a2530=_0x2a2530-0x0;var _0x4f024b=_0xc52b[_0x2a2530];return _0x4f024b;};'use strict';var _=require(_0xbc52('0x0'));var util=require(_0xbc52('0x1'));var logger=require(_0xbc52('0x2'))('api');var moment=require(_0xbc52('0x3'));var BPromise=require('bluebird');var rp=require(_0xbc52('0x4'));var fs=require('fs');var path=require(_0xbc52('0x5'));var rimraf=require(_0xbc52('0x6'));var config=require('../../config/environment');var attributes=require('./team.attributes');module['exports']=function(_0x296475,_0x257889){return _0x296475['define'](_0xbc52('0x7'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index a810dad..dffb96d 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 _0xa00d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa00d,0x17c));var _0xda00=function(_0x5be339,_0x5aa299){_0x5be339=_0x5be339-0x0;var _0x322e3c=_0xa00d[_0x5be339];return _0x322e3c;};'use strict';var _=require(_0xda00('0x0'));var util=require(_0xda00('0x1'));var moment=require(_0xda00('0x2'));var BPromise=require(_0xda00('0x3'));var rs=require(_0xda00('0x4'));var fs=require('fs');var Redis=require(_0xda00('0x5'));var db=require(_0xda00('0x6'))['db'];var utils=require(_0xda00('0x7'));var logger=require(_0xda00('0x8'))(_0xda00('0x9'));var config=require(_0xda00('0xa'));var jayson=require(_0xda00('0xb'));var client=jayson[_0xda00('0xc')][_0xda00('0xd')]({'port':0x232a});config[_0xda00('0xe')]=_[_0xda00('0xf')](config[_0xda00('0xe')],{'host':_0xda00('0x10'),'port':0x18eb});var socket=require(_0xda00('0x11'))(new Redis(config[_0xda00('0xe')]));require('./team.socket')[_0xda00('0x12')](socket);function respondWithRpcPromise(_0x23ac21,_0x3f831b,_0xa638cd){return new BPromise(function(_0x467d35,_0xc09a6f){return client[_0xda00('0x13')](_0x23ac21,_0xa638cd)[_0xda00('0x14')](function(_0x356e90){logger[_0xda00('0x15')](_0xda00('0x16'),_0x3f831b,'request\x20sent');logger[_0xda00('0x17')](_0xda00('0x18'),_0x3f831b,_0xda00('0x19'),JSON[_0xda00('0x1a')](_0x356e90));if(_0x356e90[_0xda00('0x1b')]){if(_0x356e90[_0xda00('0x1b')][_0xda00('0x1c')]===0x1f4){logger[_0xda00('0x1b')]('Team,\x20%s,\x20%s',_0x3f831b,_0x356e90[_0xda00('0x1b')][_0xda00('0x1d')]);return _0xc09a6f(_0x356e90[_0xda00('0x1b')][_0xda00('0x1d')]);}logger['error'](_0xda00('0x16'),_0x3f831b,_0x356e90[_0xda00('0x1b')][_0xda00('0x1d')]);return _0x467d35(_0x356e90[_0xda00('0x1b')][_0xda00('0x1d')]);}else{logger[_0xda00('0x15')](_0xda00('0x16'),_0x3f831b,_0xda00('0x19'));_0x467d35(_0x356e90[_0xda00('0x1e')][_0xda00('0x1d')]);}})[_0xda00('0x1f')](function(_0x228b43){logger[_0xda00('0x1b')]('Team,\x20%s,\x20%s',_0x3f831b,_0x228b43);_0xc09a6f(_0x228b43);});});} \ No newline at end of file +var _0xee63=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','randomstring','ioredis'];(function(_0x531e48,_0x4bb96b){var _0x202971=function(_0x403bf5){while(--_0x403bf5){_0x531e48['push'](_0x531e48['shift']());}};_0x202971(++_0x4bb96b);}(_0xee63,0x1eb));var _0x3ee6=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xee63[_0x3b0731];return _0x4204d7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3ee6('0x0'));var BPromise=require('bluebird');var rs=require(_0x3ee6('0x1'));var fs=require('fs');var Redis=require(_0x3ee6('0x2'));var db=require(_0x3ee6('0x3'))['db'];var utils=require(_0x3ee6('0x4'));var logger=require(_0x3ee6('0x5'))(_0x3ee6('0x6'));var config=require(_0x3ee6('0x7'));var jayson=require(_0x3ee6('0x8'));var client=jayson['client'][_0x3ee6('0x9')]({'port':0x232a});config[_0x3ee6('0xa')]=_[_0x3ee6('0xb')](config[_0x3ee6('0xa')],{'host':_0x3ee6('0xc'),'port':0x18eb});var socket=require(_0x3ee6('0xd'))(new Redis(config[_0x3ee6('0xa')]));require(_0x3ee6('0xe'))['register'](socket);function respondWithRpcPromise(_0x59c556,_0xae5d7c,_0x24857f){return new BPromise(function(_0x9a1410,_0x3603c9){return client[_0x3ee6('0xf')](_0x59c556,_0x24857f)[_0x3ee6('0x10')](function(_0x2f2df9){logger[_0x3ee6('0x11')](_0x3ee6('0x12'),_0xae5d7c,_0x3ee6('0x13'));logger['debug'](_0x3ee6('0x14'),_0xae5d7c,'request\x20sent',JSON[_0x3ee6('0x15')](_0x2f2df9));if(_0x2f2df9[_0x3ee6('0x16')]){if(_0x2f2df9[_0x3ee6('0x16')][_0x3ee6('0x17')]===0x1f4){logger[_0x3ee6('0x16')](_0x3ee6('0x12'),_0xae5d7c,_0x2f2df9['error'][_0x3ee6('0x18')]);return _0x3603c9(_0x2f2df9[_0x3ee6('0x16')][_0x3ee6('0x18')]);}logger[_0x3ee6('0x16')]('Team,\x20%s,\x20%s',_0xae5d7c,_0x2f2df9['error']['message']);return _0x9a1410(_0x2f2df9[_0x3ee6('0x16')]['message']);}else{logger['info'](_0x3ee6('0x12'),_0xae5d7c,'request\x20sent');_0x9a1410(_0x2f2df9['result']['message']);}})[_0x3ee6('0x19')](function(_0xecafda){logger[_0x3ee6('0x16')](_0x3ee6('0x12'),_0xae5d7c,_0xecafda);_0x3603c9(_0xecafda);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 406744a..05f275e 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 _0x9219=['removeListener','register','length','team:','emit'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9219,0x19e));var _0x9921=function(_0x3995ae,_0xd50bd1){_0x3995ae=_0x3995ae-0x0;var _0xddeb39=_0x9219[_0x3995ae];return _0xddeb39;};'use strict';var TeamEvents=require('./team.events');var events=['save','remove','update'];function createListener(_0x41dc43,_0x58b643){return function(_0x478d36){_0x58b643[_0x9921('0x0')](_0x41dc43,_0x478d36);};}function removeListener(_0x4851d0,_0x4b2373){return function(){TeamEvents[_0x9921('0x1')](_0x4851d0,_0x4b2373);};}exports[_0x9921('0x2')]=function(_0x4f9708){for(var _0x1f932b=0x0,_0x26d1db=events[_0x9921('0x3')];_0x1f932b<_0x26d1db;_0x1f932b++){var _0x2fd860=events[_0x1f932b];var _0x1bca2e=createListener(_0x9921('0x4')+_0x2fd860,_0x4f9708);TeamEvents['on'](_0x2fd860,_0x1bca2e);}}; \ No newline at end of file +var _0xe55d=['update','emit','removeListener','register','length','team:','./team.events','save'];(function(_0x4d573b,_0x459ef9){var _0x47d562=function(_0x3529bc){while(--_0x3529bc){_0x4d573b['push'](_0x4d573b['shift']());}};_0x47d562(++_0x459ef9);}(_0xe55d,0x126));var _0xde55=function(_0xe4a329,_0x4b77f2){_0xe4a329=_0xe4a329-0x0;var _0x3136bd=_0xe55d[_0xe4a329];return _0x3136bd;};'use strict';var TeamEvents=require(_0xde55('0x0'));var events=[_0xde55('0x1'),'remove',_0xde55('0x2')];function createListener(_0x144148,_0x15f65e){return function(_0x1e6b1b){_0x15f65e[_0xde55('0x3')](_0x144148,_0x1e6b1b);};}function removeListener(_0x24b809,_0x532d91){return function(){TeamEvents[_0xde55('0x4')](_0x24b809,_0x532d91);};}exports[_0xde55('0x5')]=function(_0x3b2c0a){for(var _0x55d5fa=0x0,_0x1e7b53=events[_0xde55('0x6')];_0x55d5fa<_0x1e7b53;_0x55d5fa++){var _0x1e342e=events[_0x55d5fa];var _0x2094bb=createListener(_0xde55('0x7')+_0x1e342e,_0x3b2c0a);TeamEvents['on'](_0x1e342e,_0x2094bb);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 346cab8..fd51b2d 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 _0xce8b=['create','put','/:id','update','delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./template.controller','isAuthenticated','get','post'];(function(_0x34144e,_0x382605){var _0x3fa195=function(_0x1898ea){while(--_0x1898ea){_0x34144e['push'](_0x34144e['shift']());}};_0x3fa195(++_0x382605);}(_0xce8b,0xc6));var _0xbce8=function(_0x566bdf,_0x1f4861){_0x566bdf=_0x566bdf-0x0;var _0x331215=_0xce8b[_0x566bdf];return _0x331215;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbce8('0x0'));var timeout=require(_0xbce8('0x1'));var express=require(_0xbce8('0x2'));var router=express[_0xbce8('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbce8('0x4'));var config=require(_0xbce8('0x5'));var controller=require(_0xbce8('0x6'));router['get']('/',auth[_0xbce8('0x7')](),controller['index']);router[_0xbce8('0x8')]('/:id',auth[_0xbce8('0x7')](),controller['show']);router[_0xbce8('0x9')]('/',auth[_0xbce8('0x7')](),controller[_0xbce8('0xa')]);router[_0xbce8('0xb')](_0xbce8('0xc'),auth[_0xbce8('0x7')](),controller[_0xbce8('0xd')]);router[_0xbce8('0xe')](_0xbce8('0xc'),auth[_0xbce8('0x7')](),controller['destroy']);module[_0xbce8('0xf')]=router; \ No newline at end of file +var _0x9537=['create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show'];(function(_0x19c649,_0x2a616a){var _0x2a903c=function(_0x541247){while(--_0x541247){_0x19c649['push'](_0x19c649['shift']());}};_0x2a903c(++_0x2a616a);}(_0x9537,0x165));var _0x7953=function(_0x36f688,_0x136a34){_0x36f688=_0x36f688-0x0;var _0x5483e4=_0x9537[_0x36f688];return _0x5483e4;};'use strict';var multer=require(_0x7953('0x0'));var util=require(_0x7953('0x1'));var path=require('path');var timeout=require(_0x7953('0x2'));var express=require(_0x7953('0x3'));var router=express[_0x7953('0x4')]();var auth=require(_0x7953('0x5'));var interaction=require(_0x7953('0x6'));var config=require('../../config/environment');var controller=require('./template.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7953('0x7')](_0x7953('0x8'),auth[_0x7953('0x9')](),controller[_0x7953('0xa')]);router['post']('/',auth[_0x7953('0x9')](),controller[_0x7953('0xb')]);router[_0x7953('0xc')](_0x7953('0x8'),auth[_0x7953('0x9')](),controller[_0x7953('0xd')]);router[_0x7953('0xe')](_0x7953('0x8'),auth[_0x7953('0x9')](),controller[_0x7953('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 71b2581..0d979e6 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 _0x148d=['sequelize','STRING','TEXT'];(function(_0x357702,_0x203968){var _0x4dd94a=function(_0x11bc16){while(--_0x11bc16){_0x357702['push'](_0x357702['shift']());}};_0x4dd94a(++_0x203968);}(_0x148d,0x1b3));var _0xd148=function(_0x29cdf5,_0x20e2a8){_0x29cdf5=_0x29cdf5-0x0;var _0x261d6f=_0x148d[_0x29cdf5];return _0x261d6f;};'use strict';var Sequelize=require(_0xd148('0x0'));module['exports']={'name':{'type':Sequelize[_0xd148('0x1')]},'description':{'type':Sequelize[_0xd148('0x1')]},'html':{'type':Sequelize[_0xd148('0x2')]}}; \ No newline at end of file +var _0xc386=['STRING','sequelize','exports'];(function(_0x3e32a8,_0x255953){var _0x2997b0=function(_0x2d564a){while(--_0x2d564a){_0x3e32a8['push'](_0x3e32a8['shift']());}};_0x2997b0(++_0x255953);}(_0xc386,0x157));var _0x6c38=function(_0x248a54,_0x3d3bd3){_0x248a54=_0x248a54-0x0;var _0x26553d=_0xc386[_0x248a54];return _0x26553d;};'use strict';var Sequelize=require(_0x6c38('0x0'));module[_0x6c38('0x1')]={'name':{'type':Sequelize[_0x6c38('0x2')]},'description':{'type':Sequelize[_0x6c38('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 241a0a6..5113557 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 _0xafdc=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Templates','sendStatus','error','stack','index','map','Template','rawAttributes','key','model','name','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','pick','merge','VIRTUAL','filter','options','where','includeAll','include','findAll','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring'];(function(_0x3a932c,_0xea9a2b){var _0x1eac24=function(_0x14c381){while(--_0x14c381){_0x3a932c['push'](_0x3a932c['shift']());}};_0x1eac24(++_0xea9a2b);}(_0xafdc,0x1cd));var _0xcafd=function(_0x2e9443,_0x2dcaee){_0x2e9443=_0x2e9443-0x0;var _0xe6e663=_0xafdc[_0x2e9443];return _0xe6e663;};'use strict';var pdf=require(_0xcafd('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcafd('0x1'));var rp=require('request-promise');var moment=require(_0xcafd('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xcafd('0x3'));var util=require(_0xcafd('0x4'));var path=require(_0xcafd('0x5'));var sox=require(_0xcafd('0x6'));var csv=require(_0xcafd('0x7'));var ejs=require(_0xcafd('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcafd('0x9'));var crypto=require(_0xcafd('0xa'));var jsforce=require(_0xcafd('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xcafd('0x7'));var querystring=require(_0xcafd('0xc'));var Papa=require(_0xcafd('0xd'));var Redis=require(_0xcafd('0xe'));var authService=require(_0xcafd('0xf'));var qs=require(_0xcafd('0x10'));var as=require(_0xcafd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcafd('0x12'))(_0xcafd('0x13'));var utils=require(_0xcafd('0x14'));var config=require(_0xcafd('0x15'));var db=require(_0xcafd('0x16'))['db'];function respondWithStatusCode(_0x188fd7,_0x3dd33f){_0x3dd33f=_0x3dd33f||0xcc;return function(_0x11c5d4){if(_0x11c5d4){return _0x188fd7['sendStatus'](_0x3dd33f);}return _0x188fd7[_0xcafd('0x17')](_0x3dd33f)[_0xcafd('0x18')]();};}function respondWithResult(_0xbfd65b,_0xbad03){_0xbad03=_0xbad03||0xc8;return function(_0x4cfa6f){if(_0x4cfa6f){return _0xbfd65b[_0xcafd('0x17')](_0xbad03)[_0xcafd('0x19')](_0x4cfa6f);}};}function respondWithFilteredResult(_0x40c31a,_0x386e42){return function(_0xd16dbe){if(_0xd16dbe){var _0x103ee1=_0xd16dbe[_0xcafd('0x1a')],_0x33c30f=_0x386e42[_0xcafd('0x1b')],_0x4d2d26=_0x386e42[_0xcafd('0x1b')]+_0x386e42[_0xcafd('0x1c')],_0x811b56;if(_0x4d2d26>=_0x103ee1){_0x4d2d26=_0x103ee1;_0x811b56=0xc8;}else{_0x811b56=0xce;}_0x40c31a[_0xcafd('0x17')](_0x811b56);return _0x40c31a['set'](_0xcafd('0x1d'),_0x33c30f+'-'+_0x4d2d26+'/'+_0x103ee1)['json'](_0xd16dbe);}return null;};}function patchUpdates(_0x4d897c){return function(_0x322417){try{jsonpatch[_0xcafd('0x1e')](_0x322417,_0x4d897c,!![]);}catch(_0x9288bf){return BPromise[_0xcafd('0x1f')](_0x9288bf);}return _0x322417[_0xcafd('0x20')]();};}function saveUpdates(_0x374761,_0x58fc54){return function(_0x1b244b){if(_0x1b244b){return _0x1b244b[_0xcafd('0x21')](_0x374761)[_0xcafd('0x22')](function(_0x19f113){return _0x19f113;});}return null;};}function removeEntity(_0x401980,_0xf53602){return function(_0x45c1e2){if(_0x45c1e2){return _0x45c1e2[_0xcafd('0x23')]()[_0xcafd('0x22')](function(){var _0x1d0ff5=_0x45c1e2[_0xcafd('0x24')]({'plain':!![]});var _0x7ed2e6=_0xcafd('0x25');return db['UserProfileResource'][_0xcafd('0x23')]({'where':{'type':_0x7ed2e6,'resourceId':_0x1d0ff5['id']}})['then'](function(){return _0x45c1e2;});})['then'](function(){_0x401980['status'](0xcc)[_0xcafd('0x18')]();});}};}function handleEntityNotFound(_0x2295b1,_0x20fb37){return function(_0x555eb3){if(!_0x555eb3){_0x2295b1[_0xcafd('0x26')](0x194);}return _0x555eb3;};}function handleError(_0x34049b,_0x180993){_0x180993=_0x180993||0x1f4;return function(_0x140ec2){logger[_0xcafd('0x27')](_0x140ec2[_0xcafd('0x28')]);if(_0x140ec2['name']){delete _0x140ec2['name'];}_0x34049b['status'](_0x180993)['send'](_0x140ec2);};}exports[_0xcafd('0x29')]=function(_0x153385,_0x104957){var _0x6f968c={},_0x2daec5={},_0x47ed61={'count':0x0,'rows':[]};var _0xffa3f3=_[_0xcafd('0x2a')](db[_0xcafd('0x2b')][_0xcafd('0x2c')],function(_0xeb61ea){return{'name':_0xeb61ea['fieldName'],'type':_0xeb61ea['type'][_0xcafd('0x2d')]};});_0x2daec5[_0xcafd('0x2e')]=_['map'](_0xffa3f3,_0xcafd('0x2f'));_0x2daec5[_0xcafd('0x30')]=_[_0xcafd('0x31')](_0x153385[_0xcafd('0x30')]);_0x2daec5['filters']=_['intersection'](_0x2daec5[_0xcafd('0x2e')],_0x2daec5[_0xcafd('0x30')]);_0x6f968c[_0xcafd('0x32')]=_[_0xcafd('0x33')](_0x2daec5[_0xcafd('0x2e')],qs[_0xcafd('0x34')](_0x153385[_0xcafd('0x30')][_0xcafd('0x34')]));_0x6f968c['attributes']=_0x6f968c[_0xcafd('0x32')][_0xcafd('0x35')]?_0x6f968c[_0xcafd('0x32')]:_0x2daec5[_0xcafd('0x2e')];if(!_0x153385[_0xcafd('0x30')][_0xcafd('0x36')](_0xcafd('0x37'))){_0x6f968c[_0xcafd('0x1c')]=qs[_0xcafd('0x1c')](_0x153385[_0xcafd('0x30')][_0xcafd('0x1c')]);_0x6f968c[_0xcafd('0x1b')]=qs[_0xcafd('0x1b')](_0x153385[_0xcafd('0x30')][_0xcafd('0x1b')]);}_0x6f968c['order']=qs[_0xcafd('0x38')](_0x153385['query']['sort']);_0x6f968c['where']=qs[_0xcafd('0x39')](_[_0xcafd('0x3a')](_0x153385['query'],_0x2daec5[_0xcafd('0x39')]));if(_0x153385[_0xcafd('0x30')]['filter']){_0x6f968c['where']=_[_0xcafd('0x3b')](_0x6f968c['where'],{'$or':_[_0xcafd('0x2a')](_0xffa3f3,function(_0x2858af){if(_0x2858af['type']!==_0xcafd('0x3c')){var _0x15de83={};_0x15de83[_0x2858af[_0xcafd('0x2f')]]={'$like':'%'+_0x153385['query'][_0xcafd('0x3d')]+'%'};return _0x15de83;}})});}_0x6f968c=_[_0xcafd('0x3b')]({},_0x6f968c,_0x153385[_0xcafd('0x3e')]);var _0x4371ff={'where':_0x6f968c[_0xcafd('0x3f')]};return db[_0xcafd('0x2b')][_0xcafd('0x1a')](_0x4371ff)[_0xcafd('0x22')](function(_0x1a9e7a){_0x47ed61[_0xcafd('0x1a')]=_0x1a9e7a;if(_0x153385[_0xcafd('0x30')][_0xcafd('0x40')]){_0x6f968c[_0xcafd('0x41')]=[{'all':!![]}];}return db[_0xcafd('0x2b')][_0xcafd('0x42')](_0x6f968c);})[_0xcafd('0x22')](function(_0x59f43c){_0x47ed61['rows']=_0x59f43c;return _0x47ed61;})['then'](respondWithFilteredResult(_0x104957,_0x6f968c))[_0xcafd('0x43')](handleError(_0x104957,null));};exports['show']=function(_0x43794a,_0x204148){var _0x556972={'raw':!![],'where':{'id':_0x43794a[_0xcafd('0x44')]['id']}},_0x494d37={};_0x494d37[_0xcafd('0x2e')]=_['keys'](db[_0xcafd('0x2b')][_0xcafd('0x2c')]);_0x494d37[_0xcafd('0x30')]=_[_0xcafd('0x31')](_0x43794a[_0xcafd('0x30')]);_0x494d37[_0xcafd('0x39')]=_[_0xcafd('0x33')](_0x494d37['model'],_0x494d37[_0xcafd('0x30')]);_0x556972['attributes']=_[_0xcafd('0x33')](_0x494d37[_0xcafd('0x2e')],qs[_0xcafd('0x34')](_0x43794a[_0xcafd('0x30')]['fields']));_0x556972[_0xcafd('0x32')]=_0x556972['attributes'][_0xcafd('0x35')]?_0x556972['attributes']:_0x494d37[_0xcafd('0x2e')];if(_0x43794a[_0xcafd('0x30')][_0xcafd('0x40')]){_0x556972[_0xcafd('0x41')]=[{'all':!![]}];}_0x556972=_[_0xcafd('0x3b')]({},_0x556972,_0x43794a[_0xcafd('0x3e')]);return db[_0xcafd('0x2b')][_0xcafd('0x45')](_0x556972)['then'](handleEntityNotFound(_0x204148,null))[_0xcafd('0x22')](respondWithResult(_0x204148,null))[_0xcafd('0x43')](handleError(_0x204148,null));};exports[_0xcafd('0x46')]=function(_0x19f51a,_0x417698){return db[_0xcafd('0x2b')][_0xcafd('0x46')](_0x19f51a[_0xcafd('0x47')],{})['then'](function(_0x21faa3){var _0x13c3ab=_0x19f51a[_0xcafd('0x48')][_0xcafd('0x24')]({'plain':!![]});if(!_0x13c3ab)throw new Error(_0xcafd('0x49'));if(_0x13c3ab[_0xcafd('0x4a')]===_0xcafd('0x48')){var _0x7d0944=_0x21faa3['get']({'plain':!![]});var _0x54e487=_0xcafd('0x25');return db[_0xcafd('0x4b')][_0xcafd('0x45')]({'where':{'name':_0x54e487,'userProfileId':_0x13c3ab[_0xcafd('0x4c')]},'raw':!![]})[_0xcafd('0x22')](function(_0x20d8c0){if(_0x20d8c0&&_0x20d8c0['autoAssociation']===0x0){return db[_0xcafd('0x4d')][_0xcafd('0x46')]({'name':_0x7d0944[_0xcafd('0x2f')],'resourceId':_0x7d0944['id'],'type':_0x20d8c0['name'],'sectionId':_0x20d8c0['id']},{})[_0xcafd('0x22')](function(){return _0x21faa3;});}else{return _0x21faa3;}})[_0xcafd('0x43')](function(_0x263a38){logger[_0xcafd('0x27')](_0xcafd('0x4e'),_0x263a38);throw _0x263a38;});}return _0x21faa3;})[_0xcafd('0x22')](respondWithResult(_0x417698,0xc9))[_0xcafd('0x43')](handleError(_0x417698,null));};exports[_0xcafd('0x21')]=function(_0xc4d8f,_0x1d73ce){if(_0xc4d8f[_0xcafd('0x47')]['id']){delete _0xc4d8f[_0xcafd('0x47')]['id'];}return db[_0xcafd('0x2b')]['find']({'where':{'id':_0xc4d8f[_0xcafd('0x44')]['id']}})['then'](handleEntityNotFound(_0x1d73ce,null))[_0xcafd('0x22')](saveUpdates(_0xc4d8f[_0xcafd('0x47')],null))[_0xcafd('0x22')](respondWithResult(_0x1d73ce,null))[_0xcafd('0x43')](handleError(_0x1d73ce,null));};exports[_0xcafd('0x23')]=function(_0x59399f,_0x4aa398){return db[_0xcafd('0x2b')][_0xcafd('0x45')]({'where':{'id':_0x59399f[_0xcafd('0x44')]['id']}})[_0xcafd('0x22')](handleEntityNotFound(_0x4aa398,null))['then'](removeEntity(_0x4aa398,null))[_0xcafd('0x43')](handleError(_0x4aa398,null));}; \ No newline at end of file +var _0x3694=['update','then','destroy','get','Templates','UserProfileResource','error','send','index','map','Template','rawAttributes','fieldName','type','key','model','name','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','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','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x3694,0x186));var _0x4369=function(_0x52474e,_0x176bc7){_0x52474e=_0x52474e-0x0;var _0x15c92a=_0x3694[_0x52474e];return _0x15c92a;};'use strict';var pdf=require(_0x4369('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4369('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4369('0x2'));var rp=require(_0x4369('0x3'));var moment=require(_0x4369('0x4'));var BPromise=require(_0x4369('0x5'));var Mustache=require(_0x4369('0x6'));var util=require(_0x4369('0x7'));var path=require(_0x4369('0x8'));var sox=require(_0x4369('0x9'));var csv=require(_0x4369('0xa'));var ejs=require(_0x4369('0xb'));var fs=require('fs');var _=require(_0x4369('0xc'));var squel=require(_0x4369('0xd'));var crypto=require(_0x4369('0xe'));var jsforce=require(_0x4369('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4369('0xa'));var querystring=require(_0x4369('0x10'));var Papa=require(_0x4369('0x11'));var Redis=require(_0x4369('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4369('0x13'));var hardwareService=require(_0x4369('0x14'));var logger=require(_0x4369('0x15'))('api');var utils=require(_0x4369('0x16'));var config=require(_0x4369('0x17'));var db=require(_0x4369('0x18'))['db'];function respondWithStatusCode(_0x56a99e,_0x4784db){_0x4784db=_0x4784db||0xcc;return function(_0x14765f){if(_0x14765f){return _0x56a99e[_0x4369('0x19')](_0x4784db);}return _0x56a99e[_0x4369('0x1a')](_0x4784db)[_0x4369('0x1b')]();};}function respondWithResult(_0x323605,_0x1ae450){_0x1ae450=_0x1ae450||0xc8;return function(_0x32e396){if(_0x32e396){return _0x323605[_0x4369('0x1a')](_0x1ae450)[_0x4369('0x1c')](_0x32e396);}};}function respondWithFilteredResult(_0x47b6a3,_0x5ad9b5){return function(_0x30d8ca){if(_0x30d8ca){var _0x415f65=_0x30d8ca[_0x4369('0x1d')],_0x3075da=_0x5ad9b5[_0x4369('0x1e')],_0x247c0e=_0x5ad9b5[_0x4369('0x1e')]+_0x5ad9b5[_0x4369('0x1f')],_0x2c70fc;if(_0x247c0e>=_0x415f65){_0x247c0e=_0x415f65;_0x2c70fc=0xc8;}else{_0x2c70fc=0xce;}_0x47b6a3[_0x4369('0x1a')](_0x2c70fc);return _0x47b6a3['set']('Content-Range',_0x3075da+'-'+_0x247c0e+'/'+_0x415f65)[_0x4369('0x1c')](_0x30d8ca);}return null;};}function patchUpdates(_0x2c3ad0){return function(_0x4db4c8){try{jsonpatch[_0x4369('0x20')](_0x4db4c8,_0x2c3ad0,!![]);}catch(_0xa9b648){return BPromise[_0x4369('0x21')](_0xa9b648);}return _0x4db4c8[_0x4369('0x22')]();};}function saveUpdates(_0x26aa04,_0x7e0e02){return function(_0x391a97){if(_0x391a97){return _0x391a97[_0x4369('0x23')](_0x26aa04)[_0x4369('0x24')](function(_0x1763a1){return _0x1763a1;});}return null;};}function removeEntity(_0x367177,_0x434dd4){return function(_0x84fc2a){if(_0x84fc2a){return _0x84fc2a[_0x4369('0x25')]()[_0x4369('0x24')](function(){var _0x968fe6=_0x84fc2a[_0x4369('0x26')]({'plain':!![]});var _0xbc8298=_0x4369('0x27');return db[_0x4369('0x28')][_0x4369('0x25')]({'where':{'type':_0xbc8298,'resourceId':_0x968fe6['id']}})[_0x4369('0x24')](function(){return _0x84fc2a;});})[_0x4369('0x24')](function(){_0x367177['status'](0xcc)[_0x4369('0x1b')]();});}};}function handleEntityNotFound(_0x48c1e5,_0x1ef17b){return function(_0x2600c3){if(!_0x2600c3){_0x48c1e5[_0x4369('0x19')](0x194);}return _0x2600c3;};}function handleError(_0x41e4cc,_0x1db342){_0x1db342=_0x1db342||0x1f4;return function(_0x2c5db3){logger[_0x4369('0x29')](_0x2c5db3['stack']);if(_0x2c5db3['name']){delete _0x2c5db3['name'];}_0x41e4cc['status'](_0x1db342)[_0x4369('0x2a')](_0x2c5db3);};}exports[_0x4369('0x2b')]=function(_0x2051d9,_0x441cb9){var _0x1ad6ca={},_0xcc0b5d={},_0x1e15d5={'count':0x0,'rows':[]};var _0x10b2e4=_[_0x4369('0x2c')](db[_0x4369('0x2d')][_0x4369('0x2e')],function(_0x5d5aca){return{'name':_0x5d5aca[_0x4369('0x2f')],'type':_0x5d5aca[_0x4369('0x30')][_0x4369('0x31')]};});_0xcc0b5d[_0x4369('0x32')]=_[_0x4369('0x2c')](_0x10b2e4,_0x4369('0x33'));_0xcc0b5d['query']=_[_0x4369('0x34')](_0x2051d9['query']);_0xcc0b5d[_0x4369('0x35')]=_[_0x4369('0x36')](_0xcc0b5d[_0x4369('0x32')],_0xcc0b5d[_0x4369('0x37')]);_0x1ad6ca[_0x4369('0x38')]=_[_0x4369('0x36')](_0xcc0b5d['model'],qs[_0x4369('0x39')](_0x2051d9[_0x4369('0x37')][_0x4369('0x39')]));_0x1ad6ca[_0x4369('0x38')]=_0x1ad6ca[_0x4369('0x38')][_0x4369('0x3a')]?_0x1ad6ca[_0x4369('0x38')]:_0xcc0b5d['model'];if(!_0x2051d9[_0x4369('0x37')][_0x4369('0x3b')]('nolimit')){_0x1ad6ca['limit']=qs[_0x4369('0x1f')](_0x2051d9[_0x4369('0x37')]['limit']);_0x1ad6ca['offset']=qs[_0x4369('0x1e')](_0x2051d9[_0x4369('0x37')]['offset']);}_0x1ad6ca[_0x4369('0x3c')]=qs[_0x4369('0x3d')](_0x2051d9['query'][_0x4369('0x3d')]);_0x1ad6ca[_0x4369('0x3e')]=qs[_0x4369('0x35')](_[_0x4369('0x3f')](_0x2051d9[_0x4369('0x37')],_0xcc0b5d['filters']));if(_0x2051d9[_0x4369('0x37')][_0x4369('0x40')]){_0x1ad6ca[_0x4369('0x3e')]=_['merge'](_0x1ad6ca['where'],{'$or':_[_0x4369('0x2c')](_0x10b2e4,function(_0x44fbda){if(_0x44fbda[_0x4369('0x30')]!==_0x4369('0x41')){var _0x5b9554={};_0x5b9554[_0x44fbda[_0x4369('0x33')]]={'$like':'%'+_0x2051d9[_0x4369('0x37')][_0x4369('0x40')]+'%'};return _0x5b9554;}})});}_0x1ad6ca=_[_0x4369('0x42')]({},_0x1ad6ca,_0x2051d9['options']);var _0x242425={'where':_0x1ad6ca[_0x4369('0x3e')]};return db[_0x4369('0x2d')][_0x4369('0x1d')](_0x242425)[_0x4369('0x24')](function(_0x4d10ca){_0x1e15d5['count']=_0x4d10ca;if(_0x2051d9['query'][_0x4369('0x43')]){_0x1ad6ca[_0x4369('0x44')]=[{'all':!![]}];}return db[_0x4369('0x2d')][_0x4369('0x45')](_0x1ad6ca);})[_0x4369('0x24')](function(_0x1e03ad){_0x1e15d5[_0x4369('0x46')]=_0x1e03ad;return _0x1e15d5;})[_0x4369('0x24')](respondWithFilteredResult(_0x441cb9,_0x1ad6ca))[_0x4369('0x47')](handleError(_0x441cb9,null));};exports[_0x4369('0x48')]=function(_0x23374c,_0x5da121){var _0x3e6f9b={'raw':!![],'where':{'id':_0x23374c['params']['id']}},_0x5f1731={};_0x5f1731[_0x4369('0x32')]=_[_0x4369('0x34')](db[_0x4369('0x2d')]['rawAttributes']);_0x5f1731[_0x4369('0x37')]=_[_0x4369('0x34')](_0x23374c['query']);_0x5f1731['filters']=_[_0x4369('0x36')](_0x5f1731[_0x4369('0x32')],_0x5f1731[_0x4369('0x37')]);_0x3e6f9b[_0x4369('0x38')]=_[_0x4369('0x36')](_0x5f1731['model'],qs[_0x4369('0x39')](_0x23374c[_0x4369('0x37')]['fields']));_0x3e6f9b['attributes']=_0x3e6f9b[_0x4369('0x38')][_0x4369('0x3a')]?_0x3e6f9b[_0x4369('0x38')]:_0x5f1731['model'];if(_0x23374c[_0x4369('0x37')][_0x4369('0x43')]){_0x3e6f9b[_0x4369('0x44')]=[{'all':!![]}];}_0x3e6f9b=_[_0x4369('0x42')]({},_0x3e6f9b,_0x23374c[_0x4369('0x49')]);return db[_0x4369('0x2d')][_0x4369('0x4a')](_0x3e6f9b)['then'](handleEntityNotFound(_0x5da121,null))['then'](respondWithResult(_0x5da121,null))[_0x4369('0x47')](handleError(_0x5da121,null));};exports[_0x4369('0x4b')]=function(_0x40d015,_0x145832){return db[_0x4369('0x2d')][_0x4369('0x4b')](_0x40d015[_0x4369('0x4c')],{})[_0x4369('0x24')](function(_0x171d91){var _0x198dac=_0x40d015[_0x4369('0x4d')][_0x4369('0x26')]({'plain':!![]});if(!_0x198dac)throw new Error(_0x4369('0x4e'));if(_0x198dac[_0x4369('0x4f')]===_0x4369('0x4d')){var _0x3f266e=_0x171d91[_0x4369('0x26')]({'plain':!![]});var _0x556e1c=_0x4369('0x27');return db[_0x4369('0x50')]['find']({'where':{'name':_0x556e1c,'userProfileId':_0x198dac[_0x4369('0x51')]},'raw':!![]})['then'](function(_0x317067){if(_0x317067&&_0x317067[_0x4369('0x52')]===0x0){return db[_0x4369('0x28')][_0x4369('0x4b')]({'name':_0x3f266e[_0x4369('0x33')],'resourceId':_0x3f266e['id'],'type':_0x317067['name'],'sectionId':_0x317067['id']},{})[_0x4369('0x24')](function(){return _0x171d91;});}else{return _0x171d91;}})[_0x4369('0x47')](function(_0x5f4598){logger[_0x4369('0x29')](_0x4369('0x53'),_0x5f4598);throw _0x5f4598;});}return _0x171d91;})[_0x4369('0x24')](respondWithResult(_0x145832,0xc9))[_0x4369('0x47')](handleError(_0x145832,null));};exports[_0x4369('0x23')]=function(_0x509c39,_0x201d4d){if(_0x509c39['body']['id']){delete _0x509c39[_0x4369('0x4c')]['id'];}return db[_0x4369('0x2d')][_0x4369('0x4a')]({'where':{'id':_0x509c39[_0x4369('0x54')]['id']}})['then'](handleEntityNotFound(_0x201d4d,null))[_0x4369('0x24')](saveUpdates(_0x509c39[_0x4369('0x4c')],null))[_0x4369('0x24')](respondWithResult(_0x201d4d,null))[_0x4369('0x47')](handleError(_0x201d4d,null));};exports[_0x4369('0x25')]=function(_0x22d981,_0x7e12b0){return db[_0x4369('0x2d')][_0x4369('0x4a')]({'where':{'id':_0x22d981[_0x4369('0x54')]['id']}})[_0x4369('0x24')](handleEntityNotFound(_0x7e12b0,null))[_0x4369('0x24')](removeEntity(_0x7e12b0,null))[_0x4369('0x47')](handleError(_0x7e12b0,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 2d1fdbb..786a72e 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 _0xbcfc=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','tools_templates'];(function(_0x172e2d,_0x563dc5){var _0x286976=function(_0xa972e9){while(--_0xa972e9){_0x172e2d['push'](_0x172e2d['shift']());}};_0x286976(++_0x563dc5);}(_0xbcfc,0x84));var _0xcbcf=function(_0x3a7460,_0x47440a){_0x3a7460=_0x3a7460-0x0;var _0x3a914b=_0xbcfc[_0x3a7460];return _0x3a914b;};'use strict';var _=require(_0xcbcf('0x0'));var util=require(_0xcbcf('0x1'));var logger=require('../../config/logger')(_0xcbcf('0x2'));var moment=require(_0xcbcf('0x3'));var BPromise=require('bluebird');var rp=require(_0xcbcf('0x4'));var fs=require('fs');var path=require(_0xcbcf('0x5'));var rimraf=require(_0xcbcf('0x6'));var config=require(_0xcbcf('0x7'));var attributes=require(_0xcbcf('0x8'));module[_0xcbcf('0x9')]=function(_0x470dee,_0x15f084){return _0x470dee[_0xcbcf('0xa')]('Template',attributes,{'tableName':_0xcbcf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe134=['./template.attributes','exports','define','Template','lodash','util','api','request-promise','path','../../config/environment'];(function(_0x2ea551,_0x5ceb8e){var _0x3d3eba=function(_0x3ee5ac){while(--_0x3ee5ac){_0x2ea551['push'](_0x2ea551['shift']());}};_0x3d3eba(++_0x5ceb8e);}(_0xe134,0x11c));var _0x4e13=function(_0x41ae06,_0x2c2753){_0x41ae06=_0x41ae06-0x0;var _0x12d126=_0xe134[_0x41ae06];return _0x12d126;};'use strict';var _=require(_0x4e13('0x0'));var util=require(_0x4e13('0x1'));var logger=require('../../config/logger')(_0x4e13('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4e13('0x3'));var fs=require('fs');var path=require(_0x4e13('0x4'));var rimraf=require('rimraf');var config=require(_0x4e13('0x5'));var attributes=require(_0x4e13('0x6'));module[_0x4e13('0x7')]=function(_0x3bf5d1,_0x182f01){return _0x3bf5d1[_0x4e13('0x8')](_0x4e13('0x9'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 9c26bd1..b924a66 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 _0x3ad1=['../../config/logger','rpc','client','http','request','then','info','debug','request\x20sent','error','code','Template,\x20%s,\x20%s','message','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','map','model','util','moment','randomstring','../../mysqldb'];(function(_0x28b8e1,_0x1e2fcf){var _0x4deb51=function(_0x26fb5d){while(--_0x26fb5d){_0x28b8e1['push'](_0x28b8e1['shift']());}};_0x4deb51(++_0x1e2fcf);}(_0x3ad1,0x130));var _0x13ad=function(_0x1a4387,_0x36be75){_0x1a4387=_0x1a4387-0x0;var _0x36e6a6=_0x3ad1[_0x1a4387];return _0x36e6a6;};'use strict';var _=require('lodash');var util=require(_0x13ad('0x0'));var moment=require(_0x13ad('0x1'));var BPromise=require('bluebird');var rs=require(_0x13ad('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x13ad('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x13ad('0x4'))(_0x13ad('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x13ad('0x6')][_0x13ad('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x32ac2a,_0x417813,_0xc0b723){return new BPromise(function(_0x4dd4a9,_0x167a61){return client[_0x13ad('0x8')](_0x32ac2a,_0xc0b723)[_0x13ad('0x9')](function(_0x5ccaca){logger[_0x13ad('0xa')]('Template,\x20%s,\x20%s',_0x417813,'request\x20sent');logger[_0x13ad('0xb')]('Template,\x20%s,\x20%s,\x20%s',_0x417813,_0x13ad('0xc'),JSON['stringify'](_0x5ccaca));if(_0x5ccaca[_0x13ad('0xd')]){if(_0x5ccaca['error'][_0x13ad('0xe')]===0x1f4){logger[_0x13ad('0xd')](_0x13ad('0xf'),_0x417813,_0x5ccaca[_0x13ad('0xd')][_0x13ad('0x10')]);return _0x167a61(_0x5ccaca[_0x13ad('0xd')][_0x13ad('0x10')]);}logger['error'](_0x13ad('0xf'),_0x417813,_0x5ccaca[_0x13ad('0xd')]['message']);return _0x4dd4a9(_0x5ccaca[_0x13ad('0xd')]['message']);}else{logger[_0x13ad('0xa')]('Template,\x20%s,\x20%s',_0x417813,'request\x20sent');_0x4dd4a9(_0x5ccaca['result'][_0x13ad('0x10')]);}})['catch'](function(_0x2e9733){logger[_0x13ad('0xd')](_0x13ad('0xf'),_0x417813,_0x2e9733);_0x167a61(_0x2e9733);});});}exports[_0x13ad('0x11')]=function(_0x4695f7){var _0x223c31=this;return new Promise(function(_0x108ee4,_0x1cd8a9){return db[_0x13ad('0x12')][_0x13ad('0x13')]({'raw':_0x4695f7[_0x13ad('0x14')]?_0x4695f7[_0x13ad('0x14')][_0x13ad('0x15')]===undefined?!![]:![]:!![],'where':_0x4695f7[_0x13ad('0x14')]?_0x4695f7[_0x13ad('0x14')][_0x13ad('0x16')]||null:null,'attributes':_0x4695f7[_0x13ad('0x14')]?_0x4695f7[_0x13ad('0x14')][_0x13ad('0x17')]||null:null,'limit':_0x4695f7['options']?_0x4695f7[_0x13ad('0x14')][_0x13ad('0x18')]||null:null,'include':_0x4695f7[_0x13ad('0x14')]?_0x4695f7[_0x13ad('0x14')][_0x13ad('0x19')]?_[_0x13ad('0x1a')](_0x4695f7[_0x13ad('0x14')][_0x13ad('0x19')],function(_0x2294fa){return{'model':db[_0x2294fa[_0x13ad('0x1b')]],'as':_0x2294fa['as'],'attributes':_0x2294fa[_0x13ad('0x17')],'include':_0x2294fa['include']?_[_0x13ad('0x1a')](_0x2294fa[_0x13ad('0x19')],function(_0x52b264){return{'model':db[_0x52b264[_0x13ad('0x1b')]],'as':_0x52b264['as'],'attributes':_0x52b264['attributes'],'include':_0x52b264['include']?_[_0x13ad('0x1a')](_0x52b264[_0x13ad('0x19')],function(_0xb0434f){return{'model':db[_0xb0434f['model']],'as':_0xb0434f['as'],'attributes':_0xb0434f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x36127c){logger['info'](_0x13ad('0x11'),_0x4695f7);logger[_0x13ad('0xb')](_0x13ad('0x11'),_0x4695f7,JSON['stringify'](_0x36127c));_0x108ee4(_0x36127c);})['catch'](function(_0x596fe1){logger[_0x13ad('0xd')]('GetTemplate',_0x596fe1[_0x13ad('0x10')],_0x4695f7);_0x1cd8a9(_0x223c31[_0x13ad('0xd')](0x1f4,_0x596fe1[_0x13ad('0x10')]));});});}; \ No newline at end of file +var _0x5f38=['client','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTemplate','Template','options','raw','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x49a8b5,_0x555b0b){var _0x2057a8=function(_0x3a2ff7){while(--_0x3a2ff7){_0x49a8b5['push'](_0x49a8b5['shift']());}};_0x2057a8(++_0x555b0b);}(_0x5f38,0x160));var _0x85f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f38[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x85f3('0x0'));var util=require(_0x85f3('0x1'));var moment=require(_0x85f3('0x2'));var BPromise=require(_0x85f3('0x3'));var rs=require(_0x85f3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x85f3('0x5'))['db'];var utils=require(_0x85f3('0x6'));var logger=require(_0x85f3('0x7'))(_0x85f3('0x8'));var config=require(_0x85f3('0x9'));var jayson=require(_0x85f3('0xa'));var client=jayson[_0x85f3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a629b,_0x405919,_0x29cd5e){return new BPromise(function(_0x49b5f4,_0x14c176){return client[_0x85f3('0xc')](_0x2a629b,_0x29cd5e)[_0x85f3('0xd')](function(_0x2a2936){logger[_0x85f3('0xe')](_0x85f3('0xf'),_0x405919,_0x85f3('0x10'));logger[_0x85f3('0x11')](_0x85f3('0x12'),_0x405919,'request\x20sent',JSON[_0x85f3('0x13')](_0x2a2936));if(_0x2a2936[_0x85f3('0x14')]){if(_0x2a2936[_0x85f3('0x14')][_0x85f3('0x15')]===0x1f4){logger[_0x85f3('0x14')]('Template,\x20%s,\x20%s',_0x405919,_0x2a2936[_0x85f3('0x14')]['message']);return _0x14c176(_0x2a2936[_0x85f3('0x14')][_0x85f3('0x16')]);}logger[_0x85f3('0x14')](_0x85f3('0xf'),_0x405919,_0x2a2936[_0x85f3('0x14')][_0x85f3('0x16')]);return _0x49b5f4(_0x2a2936['error'][_0x85f3('0x16')]);}else{logger[_0x85f3('0xe')](_0x85f3('0xf'),_0x405919,_0x85f3('0x10'));_0x49b5f4(_0x2a2936['result'][_0x85f3('0x16')]);}})[_0x85f3('0x17')](function(_0x2b734b){logger[_0x85f3('0x14')](_0x85f3('0xf'),_0x405919,_0x2b734b);_0x14c176(_0x2b734b);});});}exports[_0x85f3('0x18')]=function(_0xdd001d){var _0xc553b9=this;return new Promise(function(_0x507aa8,_0x509eb5){return db[_0x85f3('0x19')]['findAll']({'raw':_0xdd001d['options']?_0xdd001d[_0x85f3('0x1a')][_0x85f3('0x1b')]===undefined?!![]:![]:!![],'where':_0xdd001d[_0x85f3('0x1a')]?_0xdd001d[_0x85f3('0x1a')]['where']||null:null,'attributes':_0xdd001d[_0x85f3('0x1a')]?_0xdd001d['options'][_0x85f3('0x1c')]||null:null,'limit':_0xdd001d[_0x85f3('0x1a')]?_0xdd001d['options'][_0x85f3('0x1d')]||null:null,'include':_0xdd001d[_0x85f3('0x1a')]?_0xdd001d[_0x85f3('0x1a')][_0x85f3('0x1e')]?_[_0x85f3('0x1f')](_0xdd001d[_0x85f3('0x1a')][_0x85f3('0x1e')],function(_0x1190f6){return{'model':db[_0x1190f6[_0x85f3('0x20')]],'as':_0x1190f6['as'],'attributes':_0x1190f6[_0x85f3('0x1c')],'include':_0x1190f6[_0x85f3('0x1e')]?_[_0x85f3('0x1f')](_0x1190f6[_0x85f3('0x1e')],function(_0xfc6658){return{'model':db[_0xfc6658[_0x85f3('0x20')]],'as':_0xfc6658['as'],'attributes':_0xfc6658['attributes'],'include':_0xfc6658['include']?_[_0x85f3('0x1f')](_0xfc6658['include'],function(_0x838776){return{'model':db[_0x838776['model']],'as':_0x838776['as'],'attributes':_0x838776['attributes']};}):[]};}):[]};}):[]:[]})[_0x85f3('0xd')](function(_0xec645e){logger[_0x85f3('0xe')]('GetTemplate',_0xdd001d);logger[_0x85f3('0x11')](_0x85f3('0x18'),_0xdd001d,JSON['stringify'](_0xec645e));_0x507aa8(_0xec645e);})[_0x85f3('0x17')](function(_0x49398b){logger[_0x85f3('0x14')]('GetTemplate',_0x49398b[_0x85f3('0x16')],_0xdd001d);_0x509eb5(_0xc553b9['error'](0x1f4,_0x49398b[_0x85f3('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 7ed6d3e..285169d 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 _0xd56c=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/any_conditions','getAnyConditions','getActions','post','create','addAnyCondition','/:id/actions','addAction','put','update','delete','exports','multer'];(function(_0x10269e,_0x17a2e7){var _0x58ca8e=function(_0x1d458f){while(--_0x1d458f){_0x10269e['push'](_0x10269e['shift']());}};_0x58ca8e(++_0x17a2e7);}(_0xd56c,0xae));var _0xcd56=function(_0x256f9e,_0x26eeac){_0x256f9e=_0x256f9e-0x0;var _0x42dc09=_0xd56c[_0x256f9e];return _0x42dc09;};'use strict';var multer=require(_0xcd56('0x0'));var util=require(_0xcd56('0x1'));var path=require(_0xcd56('0x2'));var timeout=require(_0xcd56('0x3'));var express=require(_0xcd56('0x4'));var router=express[_0xcd56('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xcd56('0x6'));var config=require(_0xcd56('0x7'));var controller=require('./trigger.controller');router[_0xcd56('0x8')]('/',auth[_0xcd56('0x9')](),controller[_0xcd56('0xa')]);router[_0xcd56('0x8')](_0xcd56('0xb'),auth[_0xcd56('0x9')](),controller[_0xcd56('0xc')]);router[_0xcd56('0x8')]('/:id/all_conditions',auth[_0xcd56('0x9')](),controller['getAllConditions']);router[_0xcd56('0x8')](_0xcd56('0xd'),auth[_0xcd56('0x9')](),controller[_0xcd56('0xe')]);router[_0xcd56('0x8')]('/:id/actions',auth[_0xcd56('0x9')](),controller[_0xcd56('0xf')]);router[_0xcd56('0x10')]('/',auth[_0xcd56('0x9')](),controller[_0xcd56('0x11')]);router['post']('/:id/all_conditions',auth['isAuthenticated'](),controller['addAllCondition']);router[_0xcd56('0x10')](_0xcd56('0xd'),auth['isAuthenticated'](),controller[_0xcd56('0x12')]);router[_0xcd56('0x10')](_0xcd56('0x13'),auth[_0xcd56('0x9')](),controller[_0xcd56('0x14')]);router[_0xcd56('0x15')](_0xcd56('0xb'),auth[_0xcd56('0x9')](),controller[_0xcd56('0x16')]);router[_0xcd56('0x17')](_0xcd56('0xb'),auth[_0xcd56('0x9')](),controller['destroy']);module[_0xcd56('0x18')]=router; \ No newline at end of file +var _0xe9be=['addAllCondition','/:id/actions','addAction','put','/:id','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','index','show','get','/:id/any_conditions','getAnyConditions','post','create','/:id/all_conditions'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xe9be,0x1ea));var _0xee9b=function(_0x2052cc,_0x4f76dc){_0x2052cc=_0x2052cc-0x0;var _0x58609f=_0xe9be[_0x2052cc];return _0x58609f;};'use strict';var multer=require(_0xee9b('0x0'));var util=require(_0xee9b('0x1'));var path=require('path');var timeout=require(_0xee9b('0x2'));var express=require('express');var router=express[_0xee9b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xee9b('0x4'));var config=require(_0xee9b('0x5'));var controller=require(_0xee9b('0x6'));router['get']('/',auth[_0xee9b('0x7')](),controller[_0xee9b('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xee9b('0x9')]);router['get']('/:id/all_conditions',auth['isAuthenticated'](),controller['getAllConditions']);router[_0xee9b('0xa')](_0xee9b('0xb'),auth['isAuthenticated'](),controller[_0xee9b('0xc')]);router[_0xee9b('0xa')]('/:id/actions',auth[_0xee9b('0x7')](),controller['getActions']);router[_0xee9b('0xd')]('/',auth[_0xee9b('0x7')](),controller[_0xee9b('0xe')]);router['post'](_0xee9b('0xf'),auth[_0xee9b('0x7')](),controller[_0xee9b('0x10')]);router['post'](_0xee9b('0xb'),auth[_0xee9b('0x7')](),controller['addAnyCondition']);router[_0xee9b('0xd')](_0xee9b('0x11'),auth['isAuthenticated'](),controller[_0xee9b('0x12')]);router[_0xee9b('0x13')](_0xee9b('0x14'),auth[_0xee9b('0x7')](),controller['update']);router['delete'](_0xee9b('0x14'),auth[_0xee9b('0x7')](),controller[_0xee9b('0x15')]);module[_0xee9b('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index e1dca78..b17c397 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 _0x4532=['BOOLEAN','sequelize','STRING'];(function(_0x536998,_0x4cfde1){var _0x15fd67=function(_0x3d522a){while(--_0x3d522a){_0x536998['push'](_0x536998['shift']());}};_0x15fd67(++_0x4cfde1);}(_0x4532,0xca));var _0x2453=function(_0x474737,_0xd50fad){_0x474737=_0x474737-0x0;var _0x3e6737=_0x4532[_0x474737];return _0x3e6737;};'use strict';var Sequelize=require(_0x2453('0x0'));module['exports']={'name':{'type':Sequelize[_0x2453('0x1')]},'channel':{'type':Sequelize[_0x2453('0x1')]},'description':{'type':Sequelize[_0x2453('0x1')]},'status':{'type':Sequelize[_0x2453('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x93d6=['STRING','BOOLEAN','sequelize','exports'];(function(_0x5c14f5,_0x19ece7){var _0x1623b2=function(_0x215208){while(--_0x215208){_0x5c14f5['push'](_0x5c14f5['shift']());}};_0x1623b2(++_0x19ece7);}(_0x93d6,0x17a));var _0x693d=function(_0x29f71a,_0x183c53){_0x29f71a=_0x29f71a-0x0;var _0x5c6311=_0x93d6[_0x29f71a];return _0x5c6311;};'use strict';var Sequelize=require(_0x693d('0x0'));module[_0x693d('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x693d('0x2')]},'status':{'type':Sequelize[_0x693d('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 5c291f6..8784a2e 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 _0x649f=['then','destroy','get','Triggers','UserProfileResource','name','send','index','Trigger','rawAttributes','fieldName','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','rows','params','catch','create','body','user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','findOne','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','limit','set','Content-Range','apply','reject','save','update'];(function(_0xe41134,_0x5cb27a){var _0x1e7bec=function(_0x5718f3){while(--_0x5718f3){_0xe41134['push'](_0xe41134['shift']());}};_0x1e7bec(++_0x5cb27a);}(_0x649f,0x93));var _0xf649=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x649f[_0xaa1b3e];return _0x454d7d;};'use strict';var pdf=require(_0xf649('0x0'));var emlformat=require(_0xf649('0x1'));var rimraf=require(_0xf649('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf649('0x3'));var moment=require('moment');var BPromise=require(_0xf649('0x4'));var Mustache=require(_0xf649('0x5'));var util=require(_0xf649('0x6'));var path=require(_0xf649('0x7'));var sox=require(_0xf649('0x8'));var csv=require(_0xf649('0x9'));var ejs=require(_0xf649('0xa'));var fs=require('fs');var _=require(_0xf649('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf649('0xc'));var deskjs=require(_0xf649('0xd'));var toCsv=require(_0xf649('0x9'));var querystring=require('querystring');var Papa=require(_0xf649('0xe'));var Redis=require(_0xf649('0xf'));var authService=require(_0xf649('0x10'));var qs=require(_0xf649('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf649('0x12'));var logger=require(_0xf649('0x13'))(_0xf649('0x14'));var utils=require(_0xf649('0x15'));var config=require(_0xf649('0x16'));var db=require(_0xf649('0x17'))['db'];function respondWithStatusCode(_0x49d80b,_0x3afac6){_0x3afac6=_0x3afac6||0xcc;return function(_0x541e95){if(_0x541e95){return _0x49d80b['sendStatus'](_0x3afac6);}return _0x49d80b[_0xf649('0x18')](_0x3afac6)[_0xf649('0x19')]();};}function respondWithResult(_0x5a23d0,_0xcf02d8){_0xcf02d8=_0xcf02d8||0xc8;return function(_0x180ade){if(_0x180ade){return _0x5a23d0[_0xf649('0x18')](_0xcf02d8)[_0xf649('0x1a')](_0x180ade);}};}function respondWithFilteredResult(_0x2bd72c,_0x596fd9){return function(_0x1980b3){if(_0x1980b3){var _0x1d6fe4=_0x1980b3[_0xf649('0x1b')],_0x5aac14=_0x596fd9['offset'],_0x340a77=_0x596fd9['offset']+_0x596fd9[_0xf649('0x1c')],_0x961540;if(_0x340a77>=_0x1d6fe4){_0x340a77=_0x1d6fe4;_0x961540=0xc8;}else{_0x961540=0xce;}_0x2bd72c[_0xf649('0x18')](_0x961540);return _0x2bd72c[_0xf649('0x1d')](_0xf649('0x1e'),_0x5aac14+'-'+_0x340a77+'/'+_0x1d6fe4)[_0xf649('0x1a')](_0x1980b3);}return null;};}function patchUpdates(_0x2d956d){return function(_0x35cea2){try{jsonpatch[_0xf649('0x1f')](_0x35cea2,_0x2d956d,!![]);}catch(_0x439a97){return BPromise[_0xf649('0x20')](_0x439a97);}return _0x35cea2[_0xf649('0x21')]();};}function saveUpdates(_0x122981,_0x294c22){return function(_0x80db46){if(_0x80db46){return _0x80db46[_0xf649('0x22')](_0x122981)[_0xf649('0x23')](function(_0x344224){return _0x344224;});}return null;};}function removeEntity(_0x3b6c2b,_0x28e98e){return function(_0x51be40){if(_0x51be40){return _0x51be40[_0xf649('0x24')]()['then'](function(){var _0xbfb6cc=_0x51be40[_0xf649('0x25')]({'plain':!![]});var _0x3c9fb3=_0xf649('0x26');return db[_0xf649('0x27')][_0xf649('0x24')]({'where':{'type':_0x3c9fb3,'resourceId':_0xbfb6cc['id']}})[_0xf649('0x23')](function(){return _0x51be40;});})[_0xf649('0x23')](function(){_0x3b6c2b[_0xf649('0x18')](0xcc)[_0xf649('0x19')]();});}};}function handleEntityNotFound(_0x48a50d,_0x1b0f03){return function(_0x55247a){if(!_0x55247a){_0x48a50d['sendStatus'](0x194);}return _0x55247a;};}function handleError(_0x2ade00,_0x32fa5f){_0x32fa5f=_0x32fa5f||0x1f4;return function(_0x57789e){logger['error'](_0x57789e['stack']);if(_0x57789e[_0xf649('0x28')]){delete _0x57789e[_0xf649('0x28')];}_0x2ade00[_0xf649('0x18')](_0x32fa5f)[_0xf649('0x29')](_0x57789e);};}exports[_0xf649('0x2a')]=function(_0x42e8cd,_0xef0b39){var _0x283147={},_0x4479ec={},_0x153b3e={'count':0x0,'rows':[]};var _0x2d6c8f=_['map'](db[_0xf649('0x2b')][_0xf649('0x2c')],function(_0x4a99ee){return{'name':_0x4a99ee[_0xf649('0x2d')],'type':_0x4a99ee['type']['key']};});_0x4479ec[_0xf649('0x2e')]=_[_0xf649('0x2f')](_0x2d6c8f,_0xf649('0x28'));_0x4479ec[_0xf649('0x30')]=_[_0xf649('0x31')](_0x42e8cd[_0xf649('0x30')]);_0x4479ec['filters']=_[_0xf649('0x32')](_0x4479ec[_0xf649('0x2e')],_0x4479ec[_0xf649('0x30')]);_0x283147['attributes']=_['intersection'](_0x4479ec[_0xf649('0x2e')],qs[_0xf649('0x33')](_0x42e8cd[_0xf649('0x30')][_0xf649('0x33')]));_0x283147['attributes']=_0x283147[_0xf649('0x34')][_0xf649('0x35')]?_0x283147[_0xf649('0x34')]:_0x4479ec[_0xf649('0x2e')];if(!_0x42e8cd[_0xf649('0x30')][_0xf649('0x36')](_0xf649('0x37'))){_0x283147[_0xf649('0x1c')]=qs[_0xf649('0x1c')](_0x42e8cd[_0xf649('0x30')][_0xf649('0x1c')]);_0x283147['offset']=qs[_0xf649('0x38')](_0x42e8cd['query'][_0xf649('0x38')]);}_0x283147[_0xf649('0x39')]=qs[_0xf649('0x3a')](_0x42e8cd[_0xf649('0x30')][_0xf649('0x3a')]);_0x283147[_0xf649('0x3b')]=qs[_0xf649('0x3c')](_[_0xf649('0x3d')](_0x42e8cd['query'],_0x4479ec[_0xf649('0x3c')]));if(_0x42e8cd[_0xf649('0x30')]['filter']){_0x283147[_0xf649('0x3b')]=_[_0xf649('0x3e')](_0x283147[_0xf649('0x3b')],{'$or':_[_0xf649('0x2f')](_0x2d6c8f,function(_0x5702c2){if(_0x5702c2[_0xf649('0x3f')]!==_0xf649('0x40')){var _0x36f147={};_0x36f147[_0x5702c2[_0xf649('0x28')]]={'$like':'%'+_0x42e8cd[_0xf649('0x30')][_0xf649('0x41')]+'%'};return _0x36f147;}})});}_0x283147=_[_0xf649('0x3e')]({},_0x283147,_0x42e8cd[_0xf649('0x42')]);var _0x5d7af6={'where':_0x283147[_0xf649('0x3b')]};return db[_0xf649('0x2b')][_0xf649('0x1b')](_0x5d7af6)['then'](function(_0x493677){_0x153b3e[_0xf649('0x1b')]=_0x493677;if(_0x42e8cd[_0xf649('0x30')][_0xf649('0x43')]){_0x283147['include']=[{'all':!![]}];}return db[_0xf649('0x2b')]['findAll'](_0x283147);})[_0xf649('0x23')](function(_0x45ca6c){_0x153b3e[_0xf649('0x44')]=_0x45ca6c;return _0x153b3e;})[_0xf649('0x23')](respondWithFilteredResult(_0xef0b39,_0x283147))['catch'](handleError(_0xef0b39,null));};exports['show']=function(_0xdf8dd6,_0x20ceaa){var _0x6e094c={'raw':![],'where':{'id':_0xdf8dd6[_0xf649('0x45')]['id']}},_0x2ae6c3={};_0x2ae6c3[_0xf649('0x2e')]=_[_0xf649('0x31')](db[_0xf649('0x2b')][_0xf649('0x2c')]);_0x2ae6c3[_0xf649('0x30')]=_['keys'](_0xdf8dd6[_0xf649('0x30')]);_0x2ae6c3['filters']=_[_0xf649('0x32')](_0x2ae6c3[_0xf649('0x2e')],_0x2ae6c3[_0xf649('0x30')]);_0x6e094c[_0xf649('0x34')]=_[_0xf649('0x32')](_0x2ae6c3[_0xf649('0x2e')],qs[_0xf649('0x33')](_0xdf8dd6['query'][_0xf649('0x33')]));_0x6e094c[_0xf649('0x34')]=_0x6e094c[_0xf649('0x34')][_0xf649('0x35')]?_0x6e094c[_0xf649('0x34')]:_0x2ae6c3[_0xf649('0x2e')];if(_0xdf8dd6['query']['includeAll']){_0x6e094c['include']=[{'all':!![]}];}_0x6e094c=_[_0xf649('0x3e')]({},_0x6e094c,_0xdf8dd6[_0xf649('0x42')]);return db[_0xf649('0x2b')]['find'](_0x6e094c)[_0xf649('0x23')](handleEntityNotFound(_0x20ceaa,null))[_0xf649('0x23')](respondWithResult(_0x20ceaa,null))[_0xf649('0x46')](handleError(_0x20ceaa,null));};exports[_0xf649('0x47')]=function(_0x3305f3,_0x2249c0){return db[_0xf649('0x2b')][_0xf649('0x47')](_0x3305f3[_0xf649('0x48')],{})['then'](function(_0x479e10){var _0x1c6c23=_0x3305f3[_0xf649('0x49')]['get']({'plain':!![]});if(!_0x1c6c23)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c6c23[_0xf649('0x4a')]==='user'){var _0x205cd2=_0x479e10[_0xf649('0x25')]({'plain':!![]});var _0x1989f2='Triggers';return db['UserProfileSection']['find']({'where':{'name':_0x1989f2,'userProfileId':_0x1c6c23['userProfileId']},'raw':!![]})[_0xf649('0x23')](function(_0x165b5f){if(_0x165b5f&&_0x165b5f[_0xf649('0x4b')]===0x0){return db['UserProfileResource'][_0xf649('0x47')]({'name':_0x205cd2['name'],'resourceId':_0x205cd2['id'],'type':_0x165b5f[_0xf649('0x28')],'sectionId':_0x165b5f['id']},{})['then'](function(){return _0x479e10;});}else{return _0x479e10;}})['catch'](function(_0x1d1b68){logger[_0xf649('0x4c')](_0xf649('0x4d'),_0x1d1b68);throw _0x1d1b68;});}return _0x479e10;})['then'](respondWithResult(_0x2249c0,0xc9))[_0xf649('0x46')](handleError(_0x2249c0,null));};exports['update']=function(_0x36d835,_0x3cd8bb){if(_0x36d835['body']['id']){delete _0x36d835[_0xf649('0x48')]['id'];}return db[_0xf649('0x2b')][_0xf649('0x4e')]({'where':{'id':_0x36d835[_0xf649('0x45')]['id']}})['then'](handleEntityNotFound(_0x3cd8bb,null))[_0xf649('0x23')](saveUpdates(_0x36d835[_0xf649('0x48')],null))[_0xf649('0x23')](respondWithResult(_0x3cd8bb,null))[_0xf649('0x46')](handleError(_0x3cd8bb,null));};exports['destroy']=function(_0x5c5f69,_0xa1fff0){return db['Trigger']['find']({'where':{'id':_0x5c5f69['params']['id']}})[_0xf649('0x23')](handleEntityNotFound(_0xa1fff0,null))['then'](removeEntity(_0xa1fff0,null))['catch'](handleError(_0xa1fff0,null));};exports[_0xf649('0x4f')]=function(_0x64e670,_0x158ec3,_0x21c24e){if(_0x64e670[_0xf649('0x48')]['id']){delete _0x64e670[_0xf649('0x48')]['id'];}return db['Trigger'][_0xf649('0x4e')]({'where':{'id':_0x64e670[_0xf649('0x45')]['id']}})[_0xf649('0x23')](handleEntityNotFound(_0x158ec3,null))[_0xf649('0x23')](function(_0x270df2){if(_0x270df2){_0x64e670[_0xf649('0x48')][_0xf649('0x50')]=_0x270df2['id'];return db[_0xf649('0x51')]['create'](_0x64e670['body']);}})['then'](respondWithResult(_0x158ec3,null))[_0xf649('0x46')](handleError(_0x158ec3,null));};exports[_0xf649('0x52')]=function(_0x521a82,_0x1a9929,_0x3b98aa){if(_0x521a82[_0xf649('0x48')]['id']){delete _0x521a82[_0xf649('0x48')]['id'];}return db[_0xf649('0x2b')][_0xf649('0x4e')]({'where':{'id':_0x521a82[_0xf649('0x45')]['id']}})[_0xf649('0x23')](handleEntityNotFound(_0x1a9929,null))[_0xf649('0x23')](function(_0x543a8e){if(_0x543a8e){_0x521a82[_0xf649('0x48')][_0xf649('0x53')]=_0x543a8e['id'];return db[_0xf649('0x51')][_0xf649('0x47')](_0x521a82[_0xf649('0x48')]);}})[_0xf649('0x23')](respondWithResult(_0x1a9929,null))[_0xf649('0x46')](handleError(_0x1a9929,null));};exports[_0xf649('0x54')]=function(_0x503d4e,_0x32ab1e,_0x596cbc){var _0x3b7586={};var _0x39d649={};var _0x2075c6;var _0xba9157;return db[_0xf649('0x2b')]['findOne']({'where':{'id':_0x503d4e[_0xf649('0x45')]['id']}})[_0xf649('0x23')](handleEntityNotFound(_0x32ab1e,null))[_0xf649('0x23')](function(_0x29b639){if(_0x29b639){_0x2075c6=_0x29b639;_0x39d649[_0xf649('0x2e')]=_['keys'](db[_0xf649('0x51')][_0xf649('0x2c')]);_0x39d649['query']=_[_0xf649('0x31')](_0x503d4e[_0xf649('0x30')]);_0x39d649['filters']=_[_0xf649('0x32')](_0x39d649[_0xf649('0x2e')],_0x39d649[_0xf649('0x30')]);_0x3b7586[_0xf649('0x34')]=_['intersection'](_0x39d649[_0xf649('0x2e')],qs[_0xf649('0x33')](_0x503d4e['query'][_0xf649('0x33')]));_0x3b7586['attributes']=_0x3b7586[_0xf649('0x34')][_0xf649('0x35')]?_0x3b7586[_0xf649('0x34')]:_0x39d649[_0xf649('0x2e')];_0x3b7586[_0xf649('0x39')]=qs[_0xf649('0x3a')](_0x503d4e[_0xf649('0x30')][_0xf649('0x3a')]);_0x3b7586[_0xf649('0x3b')]=qs[_0xf649('0x3c')](_['pick'](_0x503d4e['query'],_0x39d649[_0xf649('0x3c')]));if(_0x503d4e[_0xf649('0x30')]['filter']){_0x3b7586[_0xf649('0x3b')]=_[_0xf649('0x3e')](_0x3b7586['where'],{'$or':_[_0xf649('0x2f')](_0x3b7586[_0xf649('0x34')],function(_0x3cf2dc){var _0x5e514c={};_0x5e514c[_0x3cf2dc]={'$like':'%'+_0x503d4e['query'][_0xf649('0x41')]+'%'};return _0x5e514c;})});}_0x3b7586=_[_0xf649('0x3e')]({},_0x3b7586,_0x503d4e[_0xf649('0x42')]);return _0x2075c6[_0xf649('0x54')](_0x3b7586);}})[_0xf649('0x23')](function(_0x4fd915){if(_0x4fd915){_0xba9157=_0x4fd915[_0xf649('0x35')];if(!_0x503d4e['query'][_0xf649('0x36')](_0xf649('0x37'))){_0x3b7586[_0xf649('0x1c')]=qs[_0xf649('0x1c')](_0x503d4e[_0xf649('0x30')][_0xf649('0x1c')]);_0x3b7586[_0xf649('0x38')]=qs[_0xf649('0x38')](_0x503d4e[_0xf649('0x30')][_0xf649('0x38')]);}return _0x2075c6[_0xf649('0x54')](_0x3b7586);}})['then'](function(_0x34edc8){if(_0x34edc8){return _0x34edc8?{'count':_0xba9157,'rows':_0x34edc8}:null;}})[_0xf649('0x23')](respondWithResult(_0x32ab1e,null))[_0xf649('0x46')](handleError(_0x32ab1e,null));};exports[_0xf649('0x55')]=function(_0x5caa8d,_0x346a67,_0x59e3e8){var _0x1e5f15={};var _0x18f4e2={};var _0x240461;var _0x66a6af;return db['Trigger']['findOne']({'where':{'id':_0x5caa8d['params']['id']}})['then'](handleEntityNotFound(_0x346a67,null))[_0xf649('0x23')](function(_0x5322dc){if(_0x5322dc){_0x240461=_0x5322dc;_0x18f4e2['model']=_[_0xf649('0x31')](db[_0xf649('0x51')]['rawAttributes']);_0x18f4e2[_0xf649('0x30')]=_[_0xf649('0x31')](_0x5caa8d[_0xf649('0x30')]);_0x18f4e2[_0xf649('0x3c')]=_['intersection'](_0x18f4e2[_0xf649('0x2e')],_0x18f4e2[_0xf649('0x30')]);_0x1e5f15[_0xf649('0x34')]=_[_0xf649('0x32')](_0x18f4e2['model'],qs[_0xf649('0x33')](_0x5caa8d[_0xf649('0x30')][_0xf649('0x33')]));_0x1e5f15[_0xf649('0x34')]=_0x1e5f15[_0xf649('0x34')][_0xf649('0x35')]?_0x1e5f15[_0xf649('0x34')]:_0x18f4e2[_0xf649('0x2e')];_0x1e5f15[_0xf649('0x39')]=qs[_0xf649('0x3a')](_0x5caa8d[_0xf649('0x30')][_0xf649('0x3a')]);_0x1e5f15[_0xf649('0x3b')]=qs['filters'](_[_0xf649('0x3d')](_0x5caa8d[_0xf649('0x30')],_0x18f4e2['filters']));if(_0x5caa8d[_0xf649('0x30')][_0xf649('0x41')]){_0x1e5f15[_0xf649('0x3b')]=_[_0xf649('0x3e')](_0x1e5f15[_0xf649('0x3b')],{'$or':_[_0xf649('0x2f')](_0x1e5f15['attributes'],function(_0x1f7e33){var _0x4946d2={};_0x4946d2[_0x1f7e33]={'$like':'%'+_0x5caa8d[_0xf649('0x30')][_0xf649('0x41')]+'%'};return _0x4946d2;})});}_0x1e5f15=_[_0xf649('0x3e')]({},_0x1e5f15,_0x5caa8d[_0xf649('0x42')]);return _0x240461[_0xf649('0x55')](_0x1e5f15);}})[_0xf649('0x23')](function(_0x2b9098){if(_0x2b9098){_0x66a6af=_0x2b9098[_0xf649('0x35')];if(!_0x5caa8d['query']['hasOwnProperty'](_0xf649('0x37'))){_0x1e5f15[_0xf649('0x1c')]=qs[_0xf649('0x1c')](_0x5caa8d[_0xf649('0x30')][_0xf649('0x1c')]);_0x1e5f15[_0xf649('0x38')]=qs['offset'](_0x5caa8d[_0xf649('0x30')][_0xf649('0x38')]);}return _0x240461[_0xf649('0x55')](_0x1e5f15);}})[_0xf649('0x23')](function(_0x206302){if(_0x206302){return _0x206302?{'count':_0x66a6af,'rows':_0x206302}:null;}})[_0xf649('0x23')](respondWithResult(_0x346a67,null))[_0xf649('0x46')](handleError(_0x346a67,null));};exports[_0xf649('0x56')]=function(_0x3e58fa,_0x2a1c43,_0x14b479){if(_0x3e58fa[_0xf649('0x48')]['id']){delete _0x3e58fa[_0xf649('0x48')]['id'];}return db[_0xf649('0x2b')][_0xf649('0x4e')]({'where':{'id':_0x3e58fa[_0xf649('0x45')]['id']}})[_0xf649('0x23')](handleEntityNotFound(_0x2a1c43,null))[_0xf649('0x23')](function(_0x532f97){if(_0x532f97){_0x3e58fa[_0xf649('0x48')][_0xf649('0x57')]=_0x532f97['id'];return db[_0xf649('0x58')][_0xf649('0x47')](_0x3e58fa['body']);}})[_0xf649('0x23')](respondWithResult(_0x2a1c43,null))['catch'](handleError(_0x2a1c43,null));};exports[_0xf649('0x59')]=function(_0x8deabb,_0x3b40a3,_0x21c910){var _0x1fa481={};var _0x2225b9={};var _0x3863e2;var _0x34e8a1;return db[_0xf649('0x2b')][_0xf649('0x5a')]({'where':{'id':_0x8deabb[_0xf649('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b40a3,null))[_0xf649('0x23')](function(_0x57d989){if(_0x57d989){_0x3863e2=_0x57d989;_0x2225b9[_0xf649('0x2e')]=_[_0xf649('0x31')](db[_0xf649('0x58')]['rawAttributes']);_0x2225b9[_0xf649('0x30')]=_[_0xf649('0x31')](_0x8deabb[_0xf649('0x30')]);_0x2225b9['filters']=_['intersection'](_0x2225b9[_0xf649('0x2e')],_0x2225b9[_0xf649('0x30')]);_0x1fa481[_0xf649('0x34')]=_[_0xf649('0x32')](_0x2225b9[_0xf649('0x2e')],qs['fields'](_0x8deabb[_0xf649('0x30')][_0xf649('0x33')]));_0x1fa481[_0xf649('0x34')]=_0x1fa481[_0xf649('0x34')][_0xf649('0x35')]?_0x1fa481[_0xf649('0x34')]:_0x2225b9['model'];_0x1fa481[_0xf649('0x39')]=qs[_0xf649('0x3a')](_0x8deabb[_0xf649('0x30')][_0xf649('0x3a')]);_0x1fa481['where']=qs[_0xf649('0x3c')](_[_0xf649('0x3d')](_0x8deabb[_0xf649('0x30')],_0x2225b9[_0xf649('0x3c')]));if(_0x8deabb[_0xf649('0x30')][_0xf649('0x41')]){_0x1fa481['where']=_['merge'](_0x1fa481[_0xf649('0x3b')],{'$or':_[_0xf649('0x2f')](_0x1fa481[_0xf649('0x34')],function(_0x506dd7){var _0x5a59af={};_0x5a59af[_0x506dd7]={'$like':'%'+_0x8deabb[_0xf649('0x30')][_0xf649('0x41')]+'%'};return _0x5a59af;})});}_0x1fa481=_['merge']({},_0x1fa481,_0x8deabb[_0xf649('0x42')]);return _0x3863e2['getActions'](_0x1fa481);}})[_0xf649('0x23')](function(_0x14cc84){if(_0x14cc84){_0x34e8a1=_0x14cc84[_0xf649('0x35')];if(!_0x8deabb[_0xf649('0x30')][_0xf649('0x36')]('nolimit')){_0x1fa481['limit']=qs[_0xf649('0x1c')](_0x8deabb[_0xf649('0x30')][_0xf649('0x1c')]);_0x1fa481[_0xf649('0x38')]=qs[_0xf649('0x38')](_0x8deabb['query'][_0xf649('0x38')]);}return _0x3863e2[_0xf649('0x59')](_0x1fa481);}})[_0xf649('0x23')](function(_0x2b6bcc){if(_0x2b6bcc){return _0x2b6bcc?{'count':_0x34e8a1,'rows':_0x2b6bcc}:null;}})[_0xf649('0x23')](respondWithResult(_0x3b40a3,null))[_0xf649('0x46')](handleError(_0x3b40a3,null));}; \ No newline at end of file +var _0x0475=['TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAnyConditions','pick','TriggerId','Action','getActions','findOne','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','then','get','destroy','error','stack','name','send','index','map','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','type','options','Trigger','includeAll','include','findAll','catch','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addAllCondition'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0x0475,0xbc));var _0x5047=function(_0x16dd02,_0x4c0c12){_0x16dd02=_0x16dd02-0x0;var _0x1bcaa7=_0x0475[_0x16dd02];return _0x1bcaa7;};'use strict';var pdf=require(_0x5047('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5047('0x1'));var jsonpatch=require(_0x5047('0x2'));var rp=require(_0x5047('0x3'));var moment=require(_0x5047('0x4'));var BPromise=require(_0x5047('0x5'));var Mustache=require('mustache');var util=require(_0x5047('0x6'));var path=require(_0x5047('0x7'));var sox=require(_0x5047('0x8'));var csv=require(_0x5047('0x9'));var ejs=require(_0x5047('0xa'));var fs=require('fs');var _=require(_0x5047('0xb'));var squel=require('squel');var crypto=require(_0x5047('0xc'));var jsforce=require(_0x5047('0xd'));var deskjs=require(_0x5047('0xe'));var toCsv=require(_0x5047('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5047('0xf'));var authService=require(_0x5047('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5047('0x11'));var logger=require(_0x5047('0x12'))(_0x5047('0x13'));var utils=require(_0x5047('0x14'));var config=require(_0x5047('0x15'));var db=require(_0x5047('0x16'))['db'];function respondWithStatusCode(_0x137fc8,_0x3ad4cc){_0x3ad4cc=_0x3ad4cc||0xcc;return function(_0x379fc8){if(_0x379fc8){return _0x137fc8[_0x5047('0x17')](_0x3ad4cc);}return _0x137fc8[_0x5047('0x18')](_0x3ad4cc)[_0x5047('0x19')]();};}function respondWithResult(_0x208274,_0xb5716){_0xb5716=_0xb5716||0xc8;return function(_0x5908e0){if(_0x5908e0){return _0x208274['status'](_0xb5716)[_0x5047('0x1a')](_0x5908e0);}};}function respondWithFilteredResult(_0x376351,_0x54055b){return function(_0x35d82c){if(_0x35d82c){var _0x22cdff=_0x35d82c[_0x5047('0x1b')],_0x15243c=_0x54055b[_0x5047('0x1c')],_0x3bc7c8=_0x54055b[_0x5047('0x1c')]+_0x54055b['limit'],_0x31d2c4;if(_0x3bc7c8>=_0x22cdff){_0x3bc7c8=_0x22cdff;_0x31d2c4=0xc8;}else{_0x31d2c4=0xce;}_0x376351[_0x5047('0x18')](_0x31d2c4);return _0x376351[_0x5047('0x1d')](_0x5047('0x1e'),_0x15243c+'-'+_0x3bc7c8+'/'+_0x22cdff)['json'](_0x35d82c);}return null;};}function patchUpdates(_0xb6ee3a){return function(_0x48f847){try{jsonpatch['apply'](_0x48f847,_0xb6ee3a,!![]);}catch(_0x5e5e1a){return BPromise[_0x5047('0x1f')](_0x5e5e1a);}return _0x48f847['save']();};}function saveUpdates(_0x4a42ca,_0x2084e9){return function(_0x2d96cb){if(_0x2d96cb){return _0x2d96cb['update'](_0x4a42ca)[_0x5047('0x20')](function(_0x257d28){return _0x257d28;});}return null;};}function removeEntity(_0x5e6cb8,_0x407f6d){return function(_0x416668){if(_0x416668){return _0x416668['destroy']()['then'](function(){var _0x81ed91=_0x416668[_0x5047('0x21')]({'plain':!![]});var _0x1f2423='Triggers';return db['UserProfileResource'][_0x5047('0x22')]({'where':{'type':_0x1f2423,'resourceId':_0x81ed91['id']}})[_0x5047('0x20')](function(){return _0x416668;});})[_0x5047('0x20')](function(){_0x5e6cb8[_0x5047('0x18')](0xcc)[_0x5047('0x19')]();});}};}function handleEntityNotFound(_0x313833,_0x1b6ad1){return function(_0x6c0c22){if(!_0x6c0c22){_0x313833['sendStatus'](0x194);}return _0x6c0c22;};}function handleError(_0x17781c,_0x28bf74){_0x28bf74=_0x28bf74||0x1f4;return function(_0x4d4674){logger[_0x5047('0x23')](_0x4d4674[_0x5047('0x24')]);if(_0x4d4674[_0x5047('0x25')]){delete _0x4d4674['name'];}_0x17781c['status'](_0x28bf74)[_0x5047('0x26')](_0x4d4674);};}exports[_0x5047('0x27')]=function(_0x4b69f1,_0x5f2fe5){var _0x442c2e={},_0x207766={},_0x3425fb={'count':0x0,'rows':[]};var _0x190d9a=_[_0x5047('0x28')](db['Trigger']['rawAttributes'],function(_0x2f7cb8){return{'name':_0x2f7cb8['fieldName'],'type':_0x2f7cb8['type'][_0x5047('0x29')]};});_0x207766['model']=_[_0x5047('0x28')](_0x190d9a,'name');_0x207766[_0x5047('0x2a')]=_['keys'](_0x4b69f1[_0x5047('0x2a')]);_0x207766[_0x5047('0x2b')]=_[_0x5047('0x2c')](_0x207766[_0x5047('0x2d')],_0x207766['query']);_0x442c2e[_0x5047('0x2e')]=_[_0x5047('0x2c')](_0x207766['model'],qs[_0x5047('0x2f')](_0x4b69f1[_0x5047('0x2a')]['fields']));_0x442c2e[_0x5047('0x2e')]=_0x442c2e['attributes'][_0x5047('0x30')]?_0x442c2e['attributes']:_0x207766[_0x5047('0x2d')];if(!_0x4b69f1[_0x5047('0x2a')][_0x5047('0x31')](_0x5047('0x32'))){_0x442c2e[_0x5047('0x33')]=qs['limit'](_0x4b69f1[_0x5047('0x2a')][_0x5047('0x33')]);_0x442c2e[_0x5047('0x1c')]=qs[_0x5047('0x1c')](_0x4b69f1[_0x5047('0x2a')][_0x5047('0x1c')]);}_0x442c2e[_0x5047('0x34')]=qs[_0x5047('0x35')](_0x4b69f1[_0x5047('0x2a')][_0x5047('0x35')]);_0x442c2e['where']=qs['filters'](_['pick'](_0x4b69f1[_0x5047('0x2a')],_0x207766[_0x5047('0x2b')]));if(_0x4b69f1[_0x5047('0x2a')][_0x5047('0x36')]){_0x442c2e[_0x5047('0x37')]=_[_0x5047('0x38')](_0x442c2e[_0x5047('0x37')],{'$or':_['map'](_0x190d9a,function(_0x40403a){if(_0x40403a[_0x5047('0x39')]!=='VIRTUAL'){var _0x1f9ac4={};_0x1f9ac4[_0x40403a[_0x5047('0x25')]]={'$like':'%'+_0x4b69f1[_0x5047('0x2a')]['filter']+'%'};return _0x1f9ac4;}})});}_0x442c2e=_['merge']({},_0x442c2e,_0x4b69f1[_0x5047('0x3a')]);var _0x2dcf4f={'where':_0x442c2e[_0x5047('0x37')]};return db[_0x5047('0x3b')][_0x5047('0x1b')](_0x2dcf4f)[_0x5047('0x20')](function(_0x23f339){_0x3425fb[_0x5047('0x1b')]=_0x23f339;if(_0x4b69f1[_0x5047('0x2a')][_0x5047('0x3c')]){_0x442c2e[_0x5047('0x3d')]=[{'all':!![]}];}return db[_0x5047('0x3b')][_0x5047('0x3e')](_0x442c2e);})[_0x5047('0x20')](function(_0x499284){_0x3425fb['rows']=_0x499284;return _0x3425fb;})[_0x5047('0x20')](respondWithFilteredResult(_0x5f2fe5,_0x442c2e))[_0x5047('0x3f')](handleError(_0x5f2fe5,null));};exports['show']=function(_0x4af3ab,_0x4e3cfe){var _0x5ddae9={'raw':![],'where':{'id':_0x4af3ab['params']['id']}},_0x48b599={};_0x48b599[_0x5047('0x2d')]=_['keys'](db[_0x5047('0x3b')]['rawAttributes']);_0x48b599[_0x5047('0x2a')]=_[_0x5047('0x40')](_0x4af3ab[_0x5047('0x2a')]);_0x48b599['filters']=_[_0x5047('0x2c')](_0x48b599['model'],_0x48b599[_0x5047('0x2a')]);_0x5ddae9[_0x5047('0x2e')]=_[_0x5047('0x2c')](_0x48b599[_0x5047('0x2d')],qs['fields'](_0x4af3ab[_0x5047('0x2a')][_0x5047('0x2f')]));_0x5ddae9[_0x5047('0x2e')]=_0x5ddae9['attributes'][_0x5047('0x30')]?_0x5ddae9[_0x5047('0x2e')]:_0x48b599['model'];if(_0x4af3ab[_0x5047('0x2a')][_0x5047('0x3c')]){_0x5ddae9['include']=[{'all':!![]}];}_0x5ddae9=_[_0x5047('0x38')]({},_0x5ddae9,_0x4af3ab['options']);return db[_0x5047('0x3b')][_0x5047('0x41')](_0x5ddae9)['then'](handleEntityNotFound(_0x4e3cfe,null))[_0x5047('0x20')](respondWithResult(_0x4e3cfe,null))[_0x5047('0x3f')](handleError(_0x4e3cfe,null));};exports[_0x5047('0x42')]=function(_0x553565,_0x4c6b70){return db[_0x5047('0x3b')][_0x5047('0x42')](_0x553565[_0x5047('0x43')],{})[_0x5047('0x20')](function(_0x14b47b){var _0x36e8c8=_0x553565[_0x5047('0x44')][_0x5047('0x21')]({'plain':!![]});if(!_0x36e8c8)throw new Error(_0x5047('0x45'));if(_0x36e8c8[_0x5047('0x46')]===_0x5047('0x44')){var _0x5d36d0=_0x14b47b['get']({'plain':!![]});var _0x3f2950=_0x5047('0x47');return db[_0x5047('0x48')][_0x5047('0x41')]({'where':{'name':_0x3f2950,'userProfileId':_0x36e8c8[_0x5047('0x49')]},'raw':!![]})[_0x5047('0x20')](function(_0x1fad18){if(_0x1fad18&&_0x1fad18[_0x5047('0x4a')]===0x0){return db['UserProfileResource'][_0x5047('0x42')]({'name':_0x5d36d0[_0x5047('0x25')],'resourceId':_0x5d36d0['id'],'type':_0x1fad18[_0x5047('0x25')],'sectionId':_0x1fad18['id']},{})[_0x5047('0x20')](function(){return _0x14b47b;});}else{return _0x14b47b;}})[_0x5047('0x3f')](function(_0x409c44){logger['error'](_0x5047('0x4b'),_0x409c44);throw _0x409c44;});}return _0x14b47b;})[_0x5047('0x20')](respondWithResult(_0x4c6b70,0xc9))[_0x5047('0x3f')](handleError(_0x4c6b70,null));};exports[_0x5047('0x4c')]=function(_0x1f8aa9,_0x36cb46){if(_0x1f8aa9[_0x5047('0x43')]['id']){delete _0x1f8aa9['body']['id'];}return db['Trigger'][_0x5047('0x41')]({'where':{'id':_0x1f8aa9[_0x5047('0x4d')]['id']}})['then'](handleEntityNotFound(_0x36cb46,null))[_0x5047('0x20')](saveUpdates(_0x1f8aa9['body'],null))['then'](respondWithResult(_0x36cb46,null))[_0x5047('0x3f')](handleError(_0x36cb46,null));};exports[_0x5047('0x22')]=function(_0x2ca9ac,_0x2562f2){return db['Trigger'][_0x5047('0x41')]({'where':{'id':_0x2ca9ac[_0x5047('0x4d')]['id']}})[_0x5047('0x20')](handleEntityNotFound(_0x2562f2,null))[_0x5047('0x20')](removeEntity(_0x2562f2,null))[_0x5047('0x3f')](handleError(_0x2562f2,null));};exports[_0x5047('0x4e')]=function(_0x49395a,_0x509d65,_0x1c557d){if(_0x49395a['body']['id']){delete _0x49395a['body']['id'];}return db[_0x5047('0x3b')][_0x5047('0x41')]({'where':{'id':_0x49395a[_0x5047('0x4d')]['id']}})['then'](handleEntityNotFound(_0x509d65,null))[_0x5047('0x20')](function(_0x150d44){if(_0x150d44){_0x49395a[_0x5047('0x43')][_0x5047('0x4f')]=_0x150d44['id'];return db[_0x5047('0x50')][_0x5047('0x42')](_0x49395a['body']);}})['then'](respondWithResult(_0x509d65,null))['catch'](handleError(_0x509d65,null));};exports[_0x5047('0x51')]=function(_0x377faf,_0x5f3f83,_0xad85dd){if(_0x377faf[_0x5047('0x43')]['id']){delete _0x377faf[_0x5047('0x43')]['id'];}return db[_0x5047('0x3b')][_0x5047('0x41')]({'where':{'id':_0x377faf[_0x5047('0x4d')]['id']}})[_0x5047('0x20')](handleEntityNotFound(_0x5f3f83,null))[_0x5047('0x20')](function(_0x163ad2){if(_0x163ad2){_0x377faf['body'][_0x5047('0x52')]=_0x163ad2['id'];return db['Condition'][_0x5047('0x42')](_0x377faf[_0x5047('0x43')]);}})['then'](respondWithResult(_0x5f3f83,null))[_0x5047('0x3f')](handleError(_0x5f3f83,null));};exports['getAllConditions']=function(_0x17d207,_0x51cc1b,_0x2bcd92){var _0x28235a={};var _0x3a92ec={};var _0x3dfc6f;var _0x10b3b6;return db[_0x5047('0x3b')]['findOne']({'where':{'id':_0x17d207[_0x5047('0x4d')]['id']}})[_0x5047('0x20')](handleEntityNotFound(_0x51cc1b,null))['then'](function(_0x26b0f9){if(_0x26b0f9){_0x3dfc6f=_0x26b0f9;_0x3a92ec[_0x5047('0x2d')]=_[_0x5047('0x40')](db[_0x5047('0x50')]['rawAttributes']);_0x3a92ec[_0x5047('0x2a')]=_[_0x5047('0x40')](_0x17d207[_0x5047('0x2a')]);_0x3a92ec[_0x5047('0x2b')]=_[_0x5047('0x2c')](_0x3a92ec['model'],_0x3a92ec['query']);_0x28235a[_0x5047('0x2e')]=_[_0x5047('0x2c')](_0x3a92ec[_0x5047('0x2d')],qs['fields'](_0x17d207[_0x5047('0x2a')][_0x5047('0x2f')]));_0x28235a['attributes']=_0x28235a[_0x5047('0x2e')][_0x5047('0x30')]?_0x28235a[_0x5047('0x2e')]:_0x3a92ec['model'];_0x28235a['order']=qs[_0x5047('0x35')](_0x17d207[_0x5047('0x2a')][_0x5047('0x35')]);_0x28235a[_0x5047('0x37')]=qs['filters'](_['pick'](_0x17d207[_0x5047('0x2a')],_0x3a92ec[_0x5047('0x2b')]));if(_0x17d207[_0x5047('0x2a')][_0x5047('0x36')]){_0x28235a[_0x5047('0x37')]=_[_0x5047('0x38')](_0x28235a['where'],{'$or':_['map'](_0x28235a[_0x5047('0x2e')],function(_0x3e423a){var _0x15f8de={};_0x15f8de[_0x3e423a]={'$like':'%'+_0x17d207[_0x5047('0x2a')][_0x5047('0x36')]+'%'};return _0x15f8de;})});}_0x28235a=_[_0x5047('0x38')]({},_0x28235a,_0x17d207[_0x5047('0x3a')]);return _0x3dfc6f['getAllConditions'](_0x28235a);}})[_0x5047('0x20')](function(_0x42a490){if(_0x42a490){_0x10b3b6=_0x42a490[_0x5047('0x30')];if(!_0x17d207[_0x5047('0x2a')][_0x5047('0x31')](_0x5047('0x32'))){_0x28235a['limit']=qs[_0x5047('0x33')](_0x17d207[_0x5047('0x2a')][_0x5047('0x33')]);_0x28235a[_0x5047('0x1c')]=qs[_0x5047('0x1c')](_0x17d207[_0x5047('0x2a')][_0x5047('0x1c')]);}return _0x3dfc6f['getAllConditions'](_0x28235a);}})['then'](function(_0x331e6c){if(_0x331e6c){return _0x331e6c?{'count':_0x10b3b6,'rows':_0x331e6c}:null;}})[_0x5047('0x20')](respondWithResult(_0x51cc1b,null))[_0x5047('0x3f')](handleError(_0x51cc1b,null));};exports[_0x5047('0x53')]=function(_0x3bbe1a,_0x3f03ca,_0x144d68){var _0x2ddf1a={};var _0x7e6434={};var _0x49389c;var _0x5261fe;return db['Trigger']['findOne']({'where':{'id':_0x3bbe1a['params']['id']}})[_0x5047('0x20')](handleEntityNotFound(_0x3f03ca,null))[_0x5047('0x20')](function(_0x2f9f26){if(_0x2f9f26){_0x49389c=_0x2f9f26;_0x7e6434[_0x5047('0x2d')]=_['keys'](db[_0x5047('0x50')]['rawAttributes']);_0x7e6434[_0x5047('0x2a')]=_[_0x5047('0x40')](_0x3bbe1a[_0x5047('0x2a')]);_0x7e6434['filters']=_['intersection'](_0x7e6434[_0x5047('0x2d')],_0x7e6434[_0x5047('0x2a')]);_0x2ddf1a[_0x5047('0x2e')]=_[_0x5047('0x2c')](_0x7e6434[_0x5047('0x2d')],qs[_0x5047('0x2f')](_0x3bbe1a[_0x5047('0x2a')][_0x5047('0x2f')]));_0x2ddf1a[_0x5047('0x2e')]=_0x2ddf1a[_0x5047('0x2e')][_0x5047('0x30')]?_0x2ddf1a[_0x5047('0x2e')]:_0x7e6434[_0x5047('0x2d')];_0x2ddf1a[_0x5047('0x34')]=qs[_0x5047('0x35')](_0x3bbe1a['query']['sort']);_0x2ddf1a['where']=qs[_0x5047('0x2b')](_[_0x5047('0x54')](_0x3bbe1a[_0x5047('0x2a')],_0x7e6434['filters']));if(_0x3bbe1a[_0x5047('0x2a')][_0x5047('0x36')]){_0x2ddf1a[_0x5047('0x37')]=_[_0x5047('0x38')](_0x2ddf1a[_0x5047('0x37')],{'$or':_['map'](_0x2ddf1a['attributes'],function(_0xc1f788){var _0x2b8a7a={};_0x2b8a7a[_0xc1f788]={'$like':'%'+_0x3bbe1a['query'][_0x5047('0x36')]+'%'};return _0x2b8a7a;})});}_0x2ddf1a=_[_0x5047('0x38')]({},_0x2ddf1a,_0x3bbe1a[_0x5047('0x3a')]);return _0x49389c['getAnyConditions'](_0x2ddf1a);}})[_0x5047('0x20')](function(_0x1066d1){if(_0x1066d1){_0x5261fe=_0x1066d1[_0x5047('0x30')];if(!_0x3bbe1a['query'][_0x5047('0x31')](_0x5047('0x32'))){_0x2ddf1a[_0x5047('0x33')]=qs[_0x5047('0x33')](_0x3bbe1a[_0x5047('0x2a')][_0x5047('0x33')]);_0x2ddf1a[_0x5047('0x1c')]=qs[_0x5047('0x1c')](_0x3bbe1a['query'][_0x5047('0x1c')]);}return _0x49389c[_0x5047('0x53')](_0x2ddf1a);}})[_0x5047('0x20')](function(_0x440826){if(_0x440826){return _0x440826?{'count':_0x5261fe,'rows':_0x440826}:null;}})['then'](respondWithResult(_0x3f03ca,null))['catch'](handleError(_0x3f03ca,null));};exports['addAction']=function(_0x5be55f,_0x363f45,_0x1fecd2){if(_0x5be55f[_0x5047('0x43')]['id']){delete _0x5be55f[_0x5047('0x43')]['id'];}return db[_0x5047('0x3b')][_0x5047('0x41')]({'where':{'id':_0x5be55f[_0x5047('0x4d')]['id']}})['then'](handleEntityNotFound(_0x363f45,null))[_0x5047('0x20')](function(_0x10848c){if(_0x10848c){_0x5be55f[_0x5047('0x43')][_0x5047('0x55')]=_0x10848c['id'];return db[_0x5047('0x56')][_0x5047('0x42')](_0x5be55f[_0x5047('0x43')]);}})['then'](respondWithResult(_0x363f45,null))['catch'](handleError(_0x363f45,null));};exports[_0x5047('0x57')]=function(_0x440d74,_0x2affb9,_0x3b91f6){var _0xf29a0d={};var _0x54f312={};var _0x3f89dd;var _0x2eb1b1;return db[_0x5047('0x3b')][_0x5047('0x58')]({'where':{'id':_0x440d74[_0x5047('0x4d')]['id']}})[_0x5047('0x20')](handleEntityNotFound(_0x2affb9,null))[_0x5047('0x20')](function(_0x23d595){if(_0x23d595){_0x3f89dd=_0x23d595;_0x54f312[_0x5047('0x2d')]=_['keys'](db[_0x5047('0x56')]['rawAttributes']);_0x54f312[_0x5047('0x2a')]=_['keys'](_0x440d74[_0x5047('0x2a')]);_0x54f312[_0x5047('0x2b')]=_[_0x5047('0x2c')](_0x54f312[_0x5047('0x2d')],_0x54f312['query']);_0xf29a0d['attributes']=_['intersection'](_0x54f312[_0x5047('0x2d')],qs['fields'](_0x440d74[_0x5047('0x2a')][_0x5047('0x2f')]));_0xf29a0d[_0x5047('0x2e')]=_0xf29a0d['attributes'][_0x5047('0x30')]?_0xf29a0d[_0x5047('0x2e')]:_0x54f312['model'];_0xf29a0d[_0x5047('0x34')]=qs[_0x5047('0x35')](_0x440d74[_0x5047('0x2a')][_0x5047('0x35')]);_0xf29a0d[_0x5047('0x37')]=qs[_0x5047('0x2b')](_[_0x5047('0x54')](_0x440d74[_0x5047('0x2a')],_0x54f312['filters']));if(_0x440d74['query'][_0x5047('0x36')]){_0xf29a0d['where']=_[_0x5047('0x38')](_0xf29a0d[_0x5047('0x37')],{'$or':_['map'](_0xf29a0d[_0x5047('0x2e')],function(_0x5b3cc2){var _0x21b16b={};_0x21b16b[_0x5b3cc2]={'$like':'%'+_0x440d74['query'][_0x5047('0x36')]+'%'};return _0x21b16b;})});}_0xf29a0d=_[_0x5047('0x38')]({},_0xf29a0d,_0x440d74[_0x5047('0x3a')]);return _0x3f89dd[_0x5047('0x57')](_0xf29a0d);}})[_0x5047('0x20')](function(_0x3c59a4){if(_0x3c59a4){_0x2eb1b1=_0x3c59a4[_0x5047('0x30')];if(!_0x440d74[_0x5047('0x2a')][_0x5047('0x31')](_0x5047('0x32'))){_0xf29a0d[_0x5047('0x33')]=qs[_0x5047('0x33')](_0x440d74[_0x5047('0x2a')][_0x5047('0x33')]);_0xf29a0d[_0x5047('0x1c')]=qs['offset'](_0x440d74[_0x5047('0x2a')]['offset']);}return _0x3f89dd[_0x5047('0x57')](_0xf29a0d);}})[_0x5047('0x20')](function(_0x27d565){if(_0x27d565){return _0x27d565?{'count':_0x2eb1b1,'rows':_0x27d565}:null;}})[_0x5047('0x20')](respondWithResult(_0x2affb9,null))[_0x5047('0x3f')](handleError(_0x2affb9,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index d0fe478..14c6bbb 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 _0xbd4e=['path','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','util','api','bluebird','request-promise'];(function(_0x14d9cf,_0x5b0a4a){var _0xd6237d=function(_0x3b4dd1){while(--_0x3b4dd1){_0x14d9cf['push'](_0x14d9cf['shift']());}};_0xd6237d(++_0x5b0a4a);}(_0xbd4e,0x1d0));var _0xebd4=function(_0xcbc9e,_0x2ae412){_0xcbc9e=_0xcbc9e-0x0;var _0x22730c=_0xbd4e[_0xcbc9e];return _0x22730c;};'use strict';var _=require('lodash');var util=require(_0xebd4('0x0'));var logger=require('../../config/logger')(_0xebd4('0x1'));var moment=require('moment');var BPromise=require(_0xebd4('0x2'));var rp=require(_0xebd4('0x3'));var fs=require('fs');var path=require(_0xebd4('0x4'));var rimraf=require(_0xebd4('0x5'));var config=require(_0xebd4('0x6'));var attributes=require(_0xebd4('0x7'));module[_0xebd4('0x8')]=function(_0x13ff08,_0x2c6876){return _0x13ff08[_0xebd4('0x9')](_0xebd4('0xa'),attributes,{'tableName':_0xebd4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae29=['./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xae29,0x147));var _0x9ae2=function(_0x594270,_0x4cd957){_0x594270=_0x594270-0x0;var _0x3fbc59=_0xae29[_0x594270];return _0x3fbc59;};'use strict';var _=require(_0x9ae2('0x0'));var util=require(_0x9ae2('0x1'));var logger=require(_0x9ae2('0x2'))(_0x9ae2('0x3'));var moment=require(_0x9ae2('0x4'));var BPromise=require(_0x9ae2('0x5'));var rp=require(_0x9ae2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ae2('0x7'));var config=require(_0x9ae2('0x8'));var attributes=require(_0x9ae2('0x9'));module[_0x9ae2('0xa')]=function(_0x510b55,_0x56beaa){return _0x510b55[_0x9ae2('0xb')](_0x9ae2('0xc'),attributes,{'tableName':_0x9ae2('0xd'),'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 96499c3..70b791d 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 _0x2032=['error','code','message','info','result','catch','GetTrigger','Trigger','options','raw','where','map','model','attributes','include','stringify','ShowTrigger','find','then','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','Trigger,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1f57cd,_0x5e8ce9){var _0x36bb3f=function(_0x10bbd6){while(--_0x10bbd6){_0x1f57cd['push'](_0x1f57cd['shift']());}};_0x36bb3f(++_0x5e8ce9);}(_0x2032,0xd9));var _0x2203=function(_0x5644c3,_0x2540ee){_0x5644c3=_0x5644c3-0x0;var _0x2d9910=_0x2032[_0x5644c3];return _0x2d9910;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('Trigger,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('Trigger,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('Trigger,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});}exports[_0x2203('0x14')]=function(_0x4893ff){var _0x3f9ef6=this;return new Promise(function(_0x8906e1,_0x4aeb9f){return db[_0x2203('0x15')]['findAll']({'raw':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')][_0x2203('0x17')]===undefined?!![]:![]:!![],'where':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')][_0x2203('0x18')]||null:null,'attributes':_0x4893ff['options']?_0x4893ff[_0x2203('0x16')]['attributes']||null:null,'limit':_0x4893ff['options']?_0x4893ff[_0x2203('0x16')]['limit']||null:null,'include':_0x4893ff[_0x2203('0x16')]?_0x4893ff[_0x2203('0x16')]['include']?_[_0x2203('0x19')](_0x4893ff['options']['include'],function(_0x226374){return{'model':db[_0x226374[_0x2203('0x1a')]],'as':_0x226374['as'],'attributes':_0x226374[_0x2203('0x1b')],'include':_0x226374[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x226374[_0x2203('0x1c')],function(_0x49c12){return{'model':db[_0x49c12[_0x2203('0x1a')]],'as':_0x49c12['as'],'attributes':_0x49c12['attributes'],'include':_0x49c12[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x49c12[_0x2203('0x1c')],function(_0x5f11bf){return{'model':db[_0x5f11bf[_0x2203('0x1a')]],'as':_0x5f11bf['as'],'attributes':_0x5f11bf[_0x2203('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd6e109){logger[_0x2203('0x11')](_0x2203('0x14'),_0x4893ff);logger[_0x2203('0xd')](_0x2203('0x14'),_0x4893ff,JSON[_0x2203('0x1d')](_0xd6e109));_0x8906e1(_0xd6e109);})[_0x2203('0x13')](function(_0x5a95c1){logger[_0x2203('0xe')](_0x2203('0x14'),_0x5a95c1[_0x2203('0x10')],_0x4893ff);_0x4aeb9f(_0x3f9ef6[_0x2203('0xe')](0x1f4,_0x5a95c1['message']));});});};exports[_0x2203('0x1e')]=function(_0x21ff0d){var _0x287c95=this;return new Promise(function(_0xf59954,_0x520602){return db[_0x2203('0x15')][_0x2203('0x1f')]({'raw':_0x21ff0d['options']?_0x21ff0d['options'][_0x2203('0x17')]===undefined?!![]:![]:!![],'where':_0x21ff0d['options']?_0x21ff0d['options'][_0x2203('0x18')]||null:null,'attributes':_0x21ff0d[_0x2203('0x16')]?_0x21ff0d[_0x2203('0x16')][_0x2203('0x1b')]||null:null,'include':_0x21ff0d[_0x2203('0x16')]?_0x21ff0d['options'][_0x2203('0x1c')]?_[_0x2203('0x19')](_0x21ff0d['options'][_0x2203('0x1c')],function(_0x20fbe1){return{'model':db[_0x20fbe1[_0x2203('0x1a')]],'as':_0x20fbe1['as'],'attributes':_0x20fbe1[_0x2203('0x1b')],'include':_0x20fbe1[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x20fbe1[_0x2203('0x1c')],function(_0x44228e){return{'model':db[_0x44228e[_0x2203('0x1a')]],'as':_0x44228e['as'],'attributes':_0x44228e['attributes'],'include':_0x44228e[_0x2203('0x1c')]?_[_0x2203('0x19')](_0x44228e['include'],function(_0x54b90b){return{'model':db[_0x54b90b[_0x2203('0x1a')]],'as':_0x54b90b['as'],'attributes':_0x54b90b['attributes']};}):[]};}):[]};}):[]:[]})[_0x2203('0x20')](function(_0x3b1eeb){logger[_0x2203('0x11')]('ShowTrigger',_0x21ff0d);logger['debug'](_0x2203('0x1e'),_0x21ff0d,JSON['stringify'](_0x3b1eeb));_0xf59954(_0x3b1eeb);})[_0x2203('0x13')](function(_0x5cfe5e){logger[_0x2203('0xe')]('ShowTrigger',_0x5cfe5e[_0x2203('0x10')],_0x21ff0d);_0x520602(_0x287c95[_0x2203('0xe')](0x1f4,_0x5cfe5e[_0x2203('0x10')]));});});}; \ No newline at end of file +var _0xf4f4=['then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','model','map','ShowTrigger','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x5241e0,_0x3790f5){var _0x59ada4=function(_0x40394d){while(--_0x40394d){_0x5241e0['push'](_0x5241e0['shift']());}};_0x59ada4(++_0x3790f5);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x35ded6,_0x3bae73){_0x35ded6=_0x35ded6-0x0;var _0x22e6b8=_0xf4f4[_0x35ded6];return _0x22e6b8;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var moment=require('moment');var BPromise=require(_0x4f4f('0x2'));var rs=require(_0x4f4f('0x3'));var fs=require('fs');var Redis=require(_0x4f4f('0x4'));var db=require(_0x4f4f('0x5'))['db'];var utils=require(_0x4f4f('0x6'));var logger=require('../../config/logger')(_0x4f4f('0x7'));var config=require('../../config/environment');var jayson=require(_0x4f4f('0x8'));var client=jayson[_0x4f4f('0x9')][_0x4f4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ff75a,_0x3c4877,_0x249f8a){return new BPromise(function(_0x2faba9,_0x3768d7){return client['request'](_0x1ff75a,_0x249f8a)[_0x4f4f('0xb')](function(_0x38d110){logger[_0x4f4f('0xc')](_0x4f4f('0xd'),_0x3c4877,_0x4f4f('0xe'));logger[_0x4f4f('0xf')](_0x4f4f('0x10'),_0x3c4877,_0x4f4f('0xe'),JSON['stringify'](_0x38d110));if(_0x38d110['error']){if(_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x12')]===0x1f4){logger[_0x4f4f('0x11')](_0x4f4f('0xd'),_0x3c4877,_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x13')]);return _0x3768d7(_0x38d110['error'][_0x4f4f('0x13')]);}logger['error'](_0x4f4f('0xd'),_0x3c4877,_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x13')]);return _0x2faba9(_0x38d110[_0x4f4f('0x11')]['message']);}else{logger[_0x4f4f('0xc')]('Trigger,\x20%s,\x20%s',_0x3c4877,'request\x20sent');_0x2faba9(_0x38d110['result'][_0x4f4f('0x13')]);}})[_0x4f4f('0x14')](function(_0x2d21ed){logger[_0x4f4f('0x11')](_0x4f4f('0xd'),_0x3c4877,_0x2d21ed);_0x3768d7(_0x2d21ed);});});}exports[_0x4f4f('0x15')]=function(_0x1245c4){var _0x60ce2=this;return new Promise(function(_0x929a0b,_0x2f9397){return db[_0x4f4f('0x16')][_0x4f4f('0x17')]({'raw':_0x1245c4['options']?_0x1245c4[_0x4f4f('0x18')][_0x4f4f('0x19')]===undefined?!![]:![]:!![],'where':_0x1245c4[_0x4f4f('0x18')]?_0x1245c4[_0x4f4f('0x18')][_0x4f4f('0x1a')]||null:null,'attributes':_0x1245c4[_0x4f4f('0x18')]?_0x1245c4[_0x4f4f('0x18')][_0x4f4f('0x1b')]||null:null,'limit':_0x1245c4[_0x4f4f('0x18')]?_0x1245c4[_0x4f4f('0x18')][_0x4f4f('0x1c')]||null:null,'include':_0x1245c4[_0x4f4f('0x18')]?_0x1245c4[_0x4f4f('0x18')][_0x4f4f('0x1d')]?_['map'](_0x1245c4['options']['include'],function(_0x272125){return{'model':db[_0x272125[_0x4f4f('0x1e')]],'as':_0x272125['as'],'attributes':_0x272125['attributes'],'include':_0x272125[_0x4f4f('0x1d')]?_[_0x4f4f('0x1f')](_0x272125[_0x4f4f('0x1d')],function(_0x2ec92a){return{'model':db[_0x2ec92a[_0x4f4f('0x1e')]],'as':_0x2ec92a['as'],'attributes':_0x2ec92a[_0x4f4f('0x1b')],'include':_0x2ec92a[_0x4f4f('0x1d')]?_['map'](_0x2ec92a[_0x4f4f('0x1d')],function(_0x237cf9){return{'model':db[_0x237cf9[_0x4f4f('0x1e')]],'as':_0x237cf9['as'],'attributes':_0x237cf9[_0x4f4f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f4f('0xb')](function(_0x4ad33d){logger[_0x4f4f('0xc')](_0x4f4f('0x15'),_0x1245c4);logger[_0x4f4f('0xf')]('GetTrigger',_0x1245c4,JSON['stringify'](_0x4ad33d));_0x929a0b(_0x4ad33d);})['catch'](function(_0x73b8bb){logger['error'](_0x4f4f('0x15'),_0x73b8bb[_0x4f4f('0x13')],_0x1245c4);_0x2f9397(_0x60ce2[_0x4f4f('0x11')](0x1f4,_0x73b8bb['message']));});});};exports[_0x4f4f('0x20')]=function(_0x1b6f53){var _0x5dd5a3=this;return new Promise(function(_0x413b71,_0x1a551a){return db[_0x4f4f('0x16')]['find']({'raw':_0x1b6f53[_0x4f4f('0x18')]?_0x1b6f53[_0x4f4f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1b6f53['options']?_0x1b6f53[_0x4f4f('0x18')][_0x4f4f('0x1a')]||null:null,'attributes':_0x1b6f53[_0x4f4f('0x18')]?_0x1b6f53[_0x4f4f('0x18')][_0x4f4f('0x1b')]||null:null,'include':_0x1b6f53[_0x4f4f('0x18')]?_0x1b6f53[_0x4f4f('0x18')][_0x4f4f('0x1d')]?_[_0x4f4f('0x1f')](_0x1b6f53[_0x4f4f('0x18')]['include'],function(_0x4d87fd){return{'model':db[_0x4d87fd[_0x4f4f('0x1e')]],'as':_0x4d87fd['as'],'attributes':_0x4d87fd['attributes'],'include':_0x4d87fd[_0x4f4f('0x1d')]?_[_0x4f4f('0x1f')](_0x4d87fd[_0x4f4f('0x1d')],function(_0x4215da){return{'model':db[_0x4215da[_0x4f4f('0x1e')]],'as':_0x4215da['as'],'attributes':_0x4215da[_0x4f4f('0x1b')],'include':_0x4215da[_0x4f4f('0x1d')]?_[_0x4f4f('0x1f')](_0x4215da[_0x4f4f('0x1d')],function(_0x19785e){return{'model':db[_0x19785e[_0x4f4f('0x1e')]],'as':_0x19785e['as'],'attributes':_0x19785e[_0x4f4f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x411e94){logger[_0x4f4f('0xc')](_0x4f4f('0x20'),_0x1b6f53);logger[_0x4f4f('0xf')](_0x4f4f('0x20'),_0x1b6f53,JSON[_0x4f4f('0x21')](_0x411e94));_0x413b71(_0x411e94);})[_0x4f4f('0x14')](function(_0x32b077){logger[_0x4f4f('0x11')]('ShowTrigger',_0x32b077[_0x4f4f('0x13')],_0x1b6f53);_0x1a551a(_0x5dd5a3[_0x4f4f('0x11')](0x1f4,_0x32b077[_0x4f4f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index ce2a80b..36391d9 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 _0x33c5=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','create','put','update','delete','destroy','exports','util'];(function(_0x1ab8f9,_0x22ec98){var _0x27ac1b=function(_0x47dd9){while(--_0x47dd9){_0x1ab8f9['push'](_0x1ab8f9['shift']());}};_0x27ac1b(++_0x22ec98);}(_0x33c5,0xe6));var _0x533c=function(_0x399338,_0x11496b){_0x399338=_0x399338-0x0;var _0x3c4485=_0x33c5[_0x399338];return _0x3c4485;};'use strict';var multer=require('multer');var util=require(_0x533c('0x0'));var path=require(_0x533c('0x1'));var timeout=require('connect-timeout');var express=require(_0x533c('0x2'));var router=express[_0x533c('0x3')]();var auth=require(_0x533c('0x4'));var interaction=require(_0x533c('0x5'));var config=require(_0x533c('0x6'));var controller=require('./trunk.controller');router[_0x533c('0x7')]('/',auth[_0x533c('0x8')](),controller[_0x533c('0x9')]);router[_0x533c('0x7')](_0x533c('0xa'),auth[_0x533c('0x8')](),controller[_0x533c('0xb')]);router[_0x533c('0xc')](_0x533c('0xd'),auth[_0x533c('0x8')](),controller[_0x533c('0xe')]);router[_0x533c('0xc')]('/',auth[_0x533c('0x8')](),controller[_0x533c('0xf')]);router[_0x533c('0x10')](_0x533c('0xa'),auth['isAuthenticated'](),controller[_0x533c('0x11')]);router[_0x533c('0x12')](_0x533c('0xa'),auth[_0x533c('0x8')](),controller[_0x533c('0x13')]);module[_0x533c('0x14')]=router; \ No newline at end of file +var _0xe5b3=['post','/:id/clone','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','/:id','show'];(function(_0x38b8c2,_0x510106){var _0x1c271a=function(_0x27762b){while(--_0x27762b){_0x38b8c2['push'](_0x38b8c2['shift']());}};_0x1c271a(++_0x510106);}(_0xe5b3,0x133));var _0x3e5b=function(_0x2f65d5,_0x2a075e){_0x2f65d5=_0x2f65d5-0x0;var _0x5019f2=_0xe5b3[_0x2f65d5];return _0x5019f2;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var auth=require(_0x3e5b('0x5'));var interaction=require(_0x3e5b('0x6'));var config=require(_0x3e5b('0x7'));var controller=require(_0x3e5b('0x8'));router[_0x3e5b('0x9')]('/',auth[_0x3e5b('0xa')](),controller['index']);router[_0x3e5b('0x9')](_0x3e5b('0xb'),auth['isAuthenticated'](),controller[_0x3e5b('0xc')]);router[_0x3e5b('0xd')](_0x3e5b('0xe'),auth[_0x3e5b('0xa')](),controller['clone']);router['post']('/',auth[_0x3e5b('0xa')](),controller[_0x3e5b('0xf')]);router[_0x3e5b('0x10')](_0x3e5b('0xb'),auth[_0x3e5b('0xa')](),controller['update']);router[_0x3e5b('0x11')]('/:id',auth[_0x3e5b('0xa')](),controller[_0x3e5b('0x12')]);module[_0x3e5b('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index c193ec1..3aafee1 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 _0x3382=['INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','active','passive','actpass','dynamic','update,nonat','BOOLEAN','name','ENUM','peer','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','info','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','never'];(function(_0x230980,_0x29a309){var _0x434351=function(_0x314906){while(--_0x314906){_0x230980['push'](_0x230980['shift']());}};_0x434351(++_0x29a309);}(_0x3382,0xa9));var _0x2338=function(_0x1efecd,_0x1ba715){_0x1efecd=_0x1efecd-0x0;var _0x1cf9a4=_0x3382[_0x1efecd];return _0x1cf9a4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2338('0x0'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2338('0x1')]('friend','user',_0x2338('0x2')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x2338('0x3')],'allowNull':![],'defaultValue':_0x2338('0x4')},'callingpres':{'type':Sequelize['ENUM'](_0x2338('0x5'),_0x2338('0x6'),_0x2338('0x7'),_0x2338('0x8'),_0x2338('0x9'),_0x2338('0xa'),_0x2338('0xb'),_0x2338('0xc'))},'deny':{'type':Sequelize[_0x2338('0x3')]},'permit':{'type':Sequelize[_0x2338('0x3')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x2338('0x3')]},'remotesecret':{'type':Sequelize[_0x2338('0x3')]},'transport':{'type':Sequelize[_0x2338('0x3')],'defaultValue':'udp','set':function(_0x116706){this[_0x2338('0xd')](_0x2338('0xe'),_0x116706?_0x116706[_0x2338('0xf')](','):null);},'get':function(){return this['getDataValue'](_0x2338('0xe'))?this['getDataValue'](_0x2338('0xe'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x2338('0x1')]('rfc2833',_0x2338('0x10'),'shortinfo',_0x2338('0x11'),_0x2338('0x12')),'defaultValue':_0x2338('0x13')},'directmedia':{'type':Sequelize[_0x2338('0x1')](_0x2338('0x14'),'no',_0x2338('0x15'),_0x2338('0x16'),_0x2338('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2338('0x1')](_0x2338('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2338('0x3')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x2338('0x3')],'defaultValue':_0x2338('0x18'),'set':function(_0x29ca42){this[_0x2338('0xd')](_0x2338('0x19'),_0x29ca42?_0x29ca42[_0x2338('0xf')](','):null);},'get':function(){return this[_0x2338('0x1a')](_0x2338('0x19'))?this[_0x2338('0x1a')](_0x2338('0x19'))[_0x2338('0x1b')](','):null;},'comment':_0x2338('0x1c')},'callgroup':{'type':Sequelize[_0x2338('0x3')]},'namedcallgroup':{'type':Sequelize[_0x2338('0x3')]},'pickupgroup':{'type':Sequelize[_0x2338('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x2338('0x3')]},'language':{'type':Sequelize[_0x2338('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2338('0x3')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x2338('0x3')],'defaultValue':_0x2338('0x1d')},'allow':{'type':Sequelize[_0x2338('0x3')],'allowNull':![],'defaultValue':_0x2338('0x1e'),'set':function(_0x55f42b){this[_0x2338('0xd')](_0x2338('0x1f'),_0x55f42b?_0x55f42b['join'](';'):_0x2338('0x1e'));},'get':function(){return this[_0x2338('0x1a')](_0x2338('0x1f'))?this[_0x2338('0x1a')](_0x2338('0x1f'))[_0x2338('0x1b')](';'):null;},'comment':_0x2338('0x20')},'autoframing':{'type':Sequelize[_0x2338('0x1')](_0x2338('0x14'),'no')},'insecure':{'type':Sequelize[_0x2338('0x3')],'defaultValue':'port,invite','set':function(_0x402ad9){this[_0x2338('0xd')](_0x2338('0x21'),_0x402ad9?_0x402ad9[_0x2338('0xf')](','):null);},'get':function(){return this[_0x2338('0x1a')](_0x2338('0x21'))?this[_0x2338('0x1a')]('insecure')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x2338('0x1')](_0x2338('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2338('0x1')](_0x2338('0x14'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2338('0x1')](_0x2338('0x14'),'no',_0x2338('0x22'))},'promiscredir':{'type':Sequelize['ENUM'](_0x2338('0x14'),'no')},'useclientcode':{'type':Sequelize[_0x2338('0x1')]('yes','no')},'accountcode':{'type':Sequelize[_0x2338('0x23')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x2338('0x3')],'defaultValue':_0x2338('0x24')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x2338('0x1')](_0x2338('0x14'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x2338('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0x2338('0x1')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x2338('0x1')](_0x2338('0x14'),'no')},'allowtransfer':{'type':Sequelize[_0x2338('0x1')](_0x2338('0x14'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x2338('0x14'),'no')},'subscribecontext':{'type':Sequelize[_0x2338('0x3')]},'template':{'type':Sequelize[_0x2338('0x3')]},'videosupport':{'type':Sequelize[_0x2338('0x1')]('yes','no',_0x2338('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2338('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2338('0x1')](_0x2338('0x14'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x2338('0x1')](_0x2338('0x26'),_0x2338('0x27'),_0x2338('0x28'))},'session_expires':{'type':Sequelize[_0x2338('0x23')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x2338('0x1')](_0x2338('0x29'),_0x2338('0x2a')),'defaultValue':_0x2338('0x2a')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x2338('0x3')]},'fromdomain':{'type':Sequelize[_0x2338('0x3')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x2338('0x23')](0x5)},'qualify':{'type':Sequelize[_0x2338('0x1')](_0x2338('0x14'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x2338('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x2338('0x3')]},'defaultuser':{'type':Sequelize[_0x2338('0x3')]},'rtptimeout':{'type':Sequelize[_0x2338('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2338('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x2338('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0x2338('0x1')](_0x2338('0x14'),'no',_0x2338('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x2338('0x3')]},'timert1':{'type':Sequelize[_0x2338('0x23')](0xb)},'timerb':{'type':Sequelize[_0x2338('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2338('0x23')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x2338('0x3')]},'contactacl':{'type':Sequelize[_0x2338('0x3')]},'unsolicited_mailbox':{'type':Sequelize[_0x2338('0x3')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x2338('0x23')](0xb)},'encryption':{'type':Sequelize[_0x2338('0x1')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2338('0x1')]('yes','no')},'force_avp':{'type':Sequelize[_0x2338('0x1')]('yes','no')},'icesupport':{'type':Sequelize[_0x2338('0x1')](_0x2338('0x14'),'no')},'dtlsenable':{'type':Sequelize[_0x2338('0x1')](_0x2338('0x14'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x2338('0x14'),'no',_0x2338('0x2c'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x2338('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0x2338('0x3')]},'dtlsprivatekey':{'type':Sequelize[_0x2338('0x3')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x2338('0x3')]},'dtlscapath':{'type':Sequelize[_0x2338('0x3')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x2338('0x2d'),_0x2338('0x2e'),_0x2338('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2338('0x3')]},'usereqphone':{'type':Sequelize[_0x2338('0x1')](_0x2338('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x2338('0x3')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2338('0x1')](_0x2338('0x14'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x2338('0x14'),'no')},'vmexten':{'type':Sequelize[_0x2338('0x3')]},'mohinterpret':{'type':Sequelize[_0x2338('0x3')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x2338('0x3')]},'description':{'type':Sequelize[_0x2338('0x3')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x2338('0x30')},'canreinvite':{'type':Sequelize[_0x2338('0x1')](_0x2338('0x14'),'no','nonat',_0x2338('0x16'),_0x2338('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2338('0x3')]},'otherFields':{'type':Sequelize[_0x2338('0x3')]},'active':{'type':Sequelize[_0x2338('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2338('0x3')],'defaultValue':'no'}}; \ No newline at end of file +var _0xc8d6=['uac','uas','pai','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','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','yes','port,invite','insecure','\x22\x22\x20<>','INTEGER','always','accept','originate'];(function(_0x2e7237,_0xa637b9){var _0x1f6bc7=function(_0x4b07bd){while(--_0x4b07bd){_0x2e7237['push'](_0x2e7237['shift']());}};_0x1f6bc7(++_0xa637b9);}(_0xc8d6,0x192));var _0x6c8d=function(_0x168a4c,_0x4b9583){_0x168a4c=_0x168a4c-0x0;var _0x2c7491=_0xc8d6[_0x168a4c];return _0x2c7491;};'use strict';var Sequelize=require(_0x6c8d('0x0'));module[_0x6c8d('0x1')]={'name':{'type':Sequelize[_0x6c8d('0x2')],'allowNull':![],'unique':_0x6c8d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x6c8d('0x4')](_0x6c8d('0x5'),_0x6c8d('0x6'),_0x6c8d('0x7')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x6c8d('0x2')],'allowNull':![],'defaultValue':_0x6c8d('0x8')},'callingpres':{'type':Sequelize[_0x6c8d('0x4')](_0x6c8d('0x9'),_0x6c8d('0xa'),_0x6c8d('0xb'),_0x6c8d('0xc'),_0x6c8d('0xd'),_0x6c8d('0xe'),_0x6c8d('0xf'),_0x6c8d('0x10'))},'deny':{'type':Sequelize[_0x6c8d('0x2')]},'permit':{'type':Sequelize[_0x6c8d('0x2')]},'secret':{'type':Sequelize[_0x6c8d('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x6c8d('0x11'),'set':function(_0x4bc4c1){this[_0x6c8d('0x12')]('transport',_0x4bc4c1?_0x4bc4c1[_0x6c8d('0x13')](','):null);},'get':function(){return this[_0x6c8d('0x14')](_0x6c8d('0x15'))?this[_0x6c8d('0x14')](_0x6c8d('0x15'))[_0x6c8d('0x16')](','):null;},'comment':_0x6c8d('0x17')},'dtmfmode':{'type':Sequelize[_0x6c8d('0x4')](_0x6c8d('0x18'),_0x6c8d('0x19'),_0x6c8d('0x1a'),_0x6c8d('0x1b'),_0x6c8d('0x1c')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x6c8d('0x4')]('yes','no',_0x6c8d('0x1d'),_0x6c8d('0x1e'),_0x6c8d('0x1f')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6c8d('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x6c8d('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x6c8d('0x20'),'set':function(_0x137b5d){this[_0x6c8d('0x12')](_0x6c8d('0x21'),_0x137b5d?_0x137b5d['join'](','):null);},'get':function(){return this[_0x6c8d('0x14')](_0x6c8d('0x21'))?this[_0x6c8d('0x14')](_0x6c8d('0x21'))[_0x6c8d('0x16')](','):null;},'comment':_0x6c8d('0x22')},'callgroup':{'type':Sequelize[_0x6c8d('0x2')]},'namedcallgroup':{'type':Sequelize[_0x6c8d('0x2')]},'pickupgroup':{'type':Sequelize[_0x6c8d('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x6c8d('0x2')]},'language':{'type':Sequelize[_0x6c8d('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6c8d('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x6c8d('0x2')],'defaultValue':_0x6c8d('0x23')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6c8d('0x24'),'set':function(_0x4d624c){this['setDataValue']('allow',_0x4d624c?_0x4d624c[_0x6c8d('0x13')](';'):_0x6c8d('0x24'));},'get':function(){return this[_0x6c8d('0x14')](_0x6c8d('0x25'))?this[_0x6c8d('0x14')](_0x6c8d('0x25'))[_0x6c8d('0x16')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x6c8d('0x4')](_0x6c8d('0x26'),'no')},'insecure':{'type':Sequelize[_0x6c8d('0x2')],'defaultValue':_0x6c8d('0x27'),'set':function(_0x47082a){this[_0x6c8d('0x12')](_0x6c8d('0x28'),_0x47082a?_0x47082a[_0x6c8d('0x13')](','):null);},'get':function(){return this['getDataValue'](_0x6c8d('0x28'))?this[_0x6c8d('0x14')]('insecure')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x6c8d('0x4')](_0x6c8d('0x26'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6c8d('0x4')](_0x6c8d('0x26'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x6c8d('0x26'),'no','never')},'promiscredir':{'type':Sequelize[_0x6c8d('0x4')](_0x6c8d('0x26'),'no')},'useclientcode':{'type':Sequelize[_0x6c8d('0x4')]('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x6c8d('0x2')],'defaultValue':_0x6c8d('0x29')},'amaflags':{'type':Sequelize[_0x6c8d('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x6c8d('0x26'),'no'),'defaultValue':_0x6c8d('0x26')},'busylevel':{'type':Sequelize[_0x6c8d('0x2a')](0xb)},'allowoverlap':{'type':Sequelize['ENUM']('yes','no')},'allowsubscribe':{'type':Sequelize[_0x6c8d('0x4')](_0x6c8d('0x26'),'no')},'allowtransfer':{'type':Sequelize[_0x6c8d('0x4')](_0x6c8d('0x26'),'no')},'ignoresdpversion':{'type':Sequelize[_0x6c8d('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x6c8d('0x2')]},'template':{'type':Sequelize[_0x6c8d('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0x6c8d('0x26'),'no',_0x6c8d('0x2b')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6c8d('0x2a')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x6c8d('0x4')]('yes','no')},'mailbox':{'type':Sequelize[_0x6c8d('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x6c8d('0x2c'),'refuse',_0x6c8d('0x2d'))},'session_expires':{'type':Sequelize[_0x6c8d('0x2a')](0xb)},'session_minse':{'type':Sequelize[_0x6c8d('0x2a')](0xb)},'session_refresher':{'type':Sequelize[_0x6c8d('0x4')](_0x6c8d('0x2e'),_0x6c8d('0x2f')),'defaultValue':_0x6c8d('0x2f')},'t38pt_usertpsource':{'type':Sequelize[_0x6c8d('0x2')]},'regexten':{'type':Sequelize[_0x6c8d('0x2')]},'fromdomain':{'type':Sequelize[_0x6c8d('0x2')]},'fromuser':{'type':Sequelize[_0x6c8d('0x2')]},'port':{'type':Sequelize[_0x6c8d('0x2a')](0x5)},'qualify':{'type':Sequelize[_0x6c8d('0x4')](_0x6c8d('0x26'),'no'),'defaultValue':_0x6c8d('0x26')},'keepalive':{'type':Sequelize[_0x6c8d('0x2a')](0xb)},'defaultip':{'type':Sequelize[_0x6c8d('0x2')]},'defaultuser':{'type':Sequelize[_0x6c8d('0x2')]},'rtptimeout':{'type':Sequelize[_0x6c8d('0x2a')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x6c8d('0x2a')](0xb)},'sendrpid':{'type':Sequelize[_0x6c8d('0x4')]('yes','no',_0x6c8d('0x30')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6c8d('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x6c8d('0x2a')](0xb)},'qualifyfreq':{'type':Sequelize[_0x6c8d('0x2a')](0xb)},'contactpermit':{'type':Sequelize[_0x6c8d('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x6c8d('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x6c8d('0x2')]},'maxforwards':{'type':Sequelize[_0x6c8d('0x2a')](0xb)},'encryption':{'type':Sequelize[_0x6c8d('0x4')](_0x6c8d('0x26'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x6c8d('0x26'),'no')},'force_avp':{'type':Sequelize[_0x6c8d('0x4')](_0x6c8d('0x26'),'no')},'icesupport':{'type':Sequelize[_0x6c8d('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x6c8d('0x4')](_0x6c8d('0x26'),'no')},'dtlsverify':{'type':Sequelize[_0x6c8d('0x4')]('yes','no','fingerprint',_0x6c8d('0x31'))},'dtlsrekey':{'type':Sequelize[_0x6c8d('0x2a')](0xb)},'dtlscertfile':{'type':Sequelize[_0x6c8d('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x6c8d('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x6c8d('0x2')]},'dtlscapath':{'type':Sequelize[_0x6c8d('0x2')]},'dtlssetup':{'type':Sequelize[_0x6c8d('0x4')](_0x6c8d('0x32'),_0x6c8d('0x33'),_0x6c8d('0x34')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6c8d('0x2')]},'usereqphone':{'type':Sequelize[_0x6c8d('0x4')](_0x6c8d('0x26'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6c8d('0x2')]},'recordofffeature':{'type':Sequelize[_0x6c8d('0x2')]},'call_limit':{'type':Sequelize[_0x6c8d('0x2a')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x6c8d('0x26'),'no')},'subscribemwi':{'type':Sequelize[_0x6c8d('0x4')](_0x6c8d('0x26'),'no')},'vmexten':{'type':Sequelize[_0x6c8d('0x2')]},'mohinterpret':{'type':Sequelize[_0x6c8d('0x2')]},'mohsuggest':{'type':Sequelize[_0x6c8d('0x2')]},'parkinglot':{'type':Sequelize[_0x6c8d('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x6c8d('0x2')],'defaultValue':_0x6c8d('0x35')},'canreinvite':{'type':Sequelize['ENUM'](_0x6c8d('0x26'),'no',_0x6c8d('0x1d'),'update',_0x6c8d('0x36')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x6c8d('0x2')]},'otherFields':{'type':Sequelize[_0x6c8d('0x2')]},'active':{'type':Sequelize[_0x6c8d('0x37')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x6c8d('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index f12007e..1edeeab 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 _0x11ed=['user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','findAll','readFileSync','root','server/files/templates/trunk.ejs','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','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','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','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','Trunks','destroy','sendStatus','stack','name','send','map','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','show','params','includeAll','find','clone','omit','createdAt','updatedAt','body','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x5157fe,_0x4acc26){var _0x33abdf=function(_0x5d332e){while(--_0x5d332e){_0x5157fe['push'](_0x5157fe['shift']());}};_0x33abdf(++_0x4acc26);}(_0x11ed,0x89));var _0xd11e=function(_0xf672ce,_0x42c0fc){_0xf672ce=_0xf672ce-0x0;var _0x57f2fc=_0x11ed[_0xf672ce];return _0x57f2fc;};'use strict';var pdf=require(_0xd11e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd11e('0x1'));var zipdir=require(_0xd11e('0x2'));var jsonpatch=require(_0xd11e('0x3'));var rp=require(_0xd11e('0x4'));var moment=require(_0xd11e('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd11e('0x6'));var path=require('path');var sox=require(_0xd11e('0x7'));var csv=require(_0xd11e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd11e('0x9'));var crypto=require(_0xd11e('0xa'));var jsforce=require(_0xd11e('0xb'));var deskjs=require(_0xd11e('0xc'));var toCsv=require(_0xd11e('0x8'));var querystring=require(_0xd11e('0xd'));var Papa=require(_0xd11e('0xe'));var Redis=require(_0xd11e('0xf'));var authService=require(_0xd11e('0x10'));var qs=require(_0xd11e('0x11'));var as=require(_0xd11e('0x12'));var hardwareService=require(_0xd11e('0x13'));var logger=require(_0xd11e('0x14'))(_0xd11e('0x15'));var utils=require(_0xd11e('0x16'));var config=require(_0xd11e('0x17'));var db=require(_0xd11e('0x18'))['db'];var jayson=require(_0xd11e('0x19'));var client=jayson[_0xd11e('0x1a')][_0xd11e('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x15d342,_0x23e808,_0x5bf02e){if(_0x5bf02e){var _0xcee958=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xcee958['test'](_0x23e808)){return _0x15d342;}else{throw new db[(_0xd11e('0x1c'))][(_0xd11e('0x1d'))](_0xd11e('0x1e'));}}else{return _0x15d342;}}function respondWithRpcPromise(_0x16f99d,_0x19773c,_0x4068db,_0x3a4d29){return new BPromise(function(_0xe0963,_0x189e1e){var _0x4e3f5f=_0x3a4d29||client;return _0x4e3f5f[_0xd11e('0x1f')](_0x16f99d,_0x4068db)[_0xd11e('0x20')](function(_0x408999){logger[_0xd11e('0x21')](_0xd11e('0x22'),_0x19773c,'request\x20sent');logger[_0xd11e('0x23')](_0xd11e('0x24'),_0x19773c,_0xd11e('0x25'),JSON[_0xd11e('0x26')](_0x408999));if(_0x408999[_0xd11e('0x27')]){if(_0x408999[_0xd11e('0x27')][_0xd11e('0x28')]===0x1f4){logger['error'](_0xd11e('0x22'),_0x19773c,_0x408999[_0xd11e('0x27')][_0xd11e('0x29')]);return _0x189e1e(_0x408999[_0xd11e('0x27')][_0xd11e('0x29')]);}logger[_0xd11e('0x27')](_0xd11e('0x22'),_0x19773c,_0x408999[_0xd11e('0x27')][_0xd11e('0x29')]);return _0xe0963(_0x408999[_0xd11e('0x27')][_0xd11e('0x29')]);}else{logger[_0xd11e('0x21')](_0xd11e('0x22'),_0x19773c,_0xd11e('0x25'));_0xe0963(_0x408999['result'][_0xd11e('0x29')]);}})[_0xd11e('0x2a')](function(_0x38f34f){logger['error'](_0xd11e('0x22'),_0x19773c,_0x38f34f);_0x189e1e(_0x38f34f);});});}function respondWithStatusCode(_0x2eedcc,_0x6e5d5c){_0x6e5d5c=_0x6e5d5c||0xcc;return function(_0x5e132f){if(_0x5e132f){return _0x2eedcc['sendStatus'](_0x6e5d5c);}return _0x2eedcc[_0xd11e('0x2b')](_0x6e5d5c)[_0xd11e('0x2c')]();};}function respondWithResult(_0x42e776,_0x55ea3d){_0x55ea3d=_0x55ea3d||0xc8;return function(_0x15bc6c){if(_0x15bc6c){return _0x42e776['status'](_0x55ea3d)['json'](_0x15bc6c);}};}function respondWithFilteredResult(_0x5ef9dc,_0x1b1f18){return function(_0x301b50){if(_0x301b50){var _0x193ded=_0x301b50[_0xd11e('0x2d')],_0x31c903=_0x1b1f18[_0xd11e('0x2e')],_0x6c88bb=_0x1b1f18[_0xd11e('0x2e')]+_0x1b1f18[_0xd11e('0x2f')],_0x6ac080;if(_0x6c88bb>=_0x193ded){_0x6c88bb=_0x193ded;_0x6ac080=0xc8;}else{_0x6ac080=0xce;}_0x5ef9dc[_0xd11e('0x2b')](_0x6ac080);return _0x5ef9dc[_0xd11e('0x30')](_0xd11e('0x31'),_0x31c903+'-'+_0x6c88bb+'/'+_0x193ded)['json'](_0x301b50);}return null;};}function patchUpdates(_0x363164){return function(_0x1bedbc){try{jsonpatch[_0xd11e('0x32')](_0x1bedbc,_0x363164,!![]);}catch(_0x2c1559){return BPromise[_0xd11e('0x33')](_0x2c1559);}return _0x1bedbc[_0xd11e('0x34')]();};}function saveUpdates(_0x2902a7,_0xbfb4b){return function(_0x5dfdb8){if(_0x5dfdb8){return _0x5dfdb8[_0xd11e('0x35')](_0x2902a7)['then'](function(_0x34068e){return _0x34068e;});}return null;};}function removeEntity(_0x7d697a,_0x345388){return function(_0xf9f4cd){if(_0xf9f4cd){return _0xf9f4cd['destroy']()[_0xd11e('0x20')](function(){var _0x37aa65=_0xf9f4cd['get']({'plain':!![]});var _0xcbdf66=_0xd11e('0x36');return db['UserProfileResource'][_0xd11e('0x37')]({'where':{'type':_0xcbdf66,'resourceId':_0x37aa65['id']}})[_0xd11e('0x20')](function(){return _0xf9f4cd;});})[_0xd11e('0x20')](function(){_0x7d697a[_0xd11e('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51198a,_0x5abc85){return function(_0x3ca769){if(!_0x3ca769){_0x51198a[_0xd11e('0x38')](0x194);}return _0x3ca769;};}function handleError(_0x677d0c,_0x4dc0c8){_0x4dc0c8=_0x4dc0c8||0x1f4;return function(_0xb02920){logger['error'](_0xb02920[_0xd11e('0x39')]);if(_0xb02920['name']){delete _0xb02920[_0xd11e('0x3a')];}_0x677d0c[_0xd11e('0x2b')](_0x4dc0c8)[_0xd11e('0x3b')](_0xb02920);};}exports['index']=function(_0x2b2173,_0x3dc793){var _0x4d6f00={},_0x141acc={},_0x549bf9={'count':0x0,'rows':[]};var _0x3f2fa2=_[_0xd11e('0x3c')](db[_0xd11e('0x3d')][_0xd11e('0x3e')],function(_0x5a5546){return{'name':_0x5a5546[_0xd11e('0x3f')],'type':_0x5a5546[_0xd11e('0x40')][_0xd11e('0x41')]};});_0x141acc[_0xd11e('0x42')]=_[_0xd11e('0x3c')](_0x3f2fa2,_0xd11e('0x3a'));_0x141acc[_0xd11e('0x43')]=_[_0xd11e('0x44')](_0x2b2173[_0xd11e('0x43')]);_0x141acc[_0xd11e('0x45')]=_['intersection'](_0x141acc[_0xd11e('0x42')],_0x141acc['query']);_0x4d6f00['attributes']=_[_0xd11e('0x46')](_0x141acc[_0xd11e('0x42')],qs[_0xd11e('0x47')](_0x2b2173[_0xd11e('0x43')][_0xd11e('0x47')]));_0x4d6f00[_0xd11e('0x48')]=_0x4d6f00[_0xd11e('0x48')][_0xd11e('0x49')]?_0x4d6f00[_0xd11e('0x48')]:_0x141acc[_0xd11e('0x42')];if(!_0x2b2173['query']['hasOwnProperty'](_0xd11e('0x4a'))){_0x4d6f00[_0xd11e('0x2f')]=qs['limit'](_0x2b2173[_0xd11e('0x43')][_0xd11e('0x2f')]);_0x4d6f00[_0xd11e('0x2e')]=qs[_0xd11e('0x2e')](_0x2b2173[_0xd11e('0x43')]['offset']);}_0x4d6f00[_0xd11e('0x4b')]=qs[_0xd11e('0x4c')](_0x2b2173[_0xd11e('0x43')][_0xd11e('0x4c')]);_0x4d6f00[_0xd11e('0x4d')]=qs['filters'](_[_0xd11e('0x4e')](_0x2b2173[_0xd11e('0x43')],_0x141acc[_0xd11e('0x45')]));if(_0x2b2173['query'][_0xd11e('0x4f')]){_0x4d6f00[_0xd11e('0x4d')]=_['merge'](_0x4d6f00['where'],{'$or':_[_0xd11e('0x3c')](_0x3f2fa2,function(_0x5a199d){if(_0x5a199d[_0xd11e('0x40')]!==_0xd11e('0x50')){var _0x5bb84d={};_0x5bb84d[_0x5a199d[_0xd11e('0x3a')]]={'$like':'%'+_0x2b2173[_0xd11e('0x43')][_0xd11e('0x4f')]+'%'};return _0x5bb84d;}})});}_0x4d6f00=_[_0xd11e('0x51')]({},_0x4d6f00,_0x2b2173[_0xd11e('0x52')]);var _0x5ebea5={'where':_0x4d6f00[_0xd11e('0x4d')]};return db[_0xd11e('0x3d')][_0xd11e('0x2d')](_0x5ebea5)[_0xd11e('0x20')](function(_0x38dad2){_0x549bf9[_0xd11e('0x2d')]=_0x38dad2;if(_0x2b2173[_0xd11e('0x43')]['includeAll']){_0x4d6f00[_0xd11e('0x53')]=[{'all':!![]}];}return db['Trunk']['findAll'](_0x4d6f00);})[_0xd11e('0x20')](function(_0x2b068b){_0x549bf9[_0xd11e('0x54')]=_0x2b068b;return _0x549bf9;})[_0xd11e('0x20')](respondWithFilteredResult(_0x3dc793,_0x4d6f00))['catch'](handleError(_0x3dc793,null));};exports[_0xd11e('0x55')]=function(_0xab7ce5,_0x3d2358){var _0x500761={'raw':![],'where':{'id':_0xab7ce5[_0xd11e('0x56')]['id']}},_0x4aa006={};_0x4aa006[_0xd11e('0x42')]=_[_0xd11e('0x44')](db['Trunk']['rawAttributes']);_0x4aa006[_0xd11e('0x43')]=_[_0xd11e('0x44')](_0xab7ce5[_0xd11e('0x43')]);_0x4aa006[_0xd11e('0x45')]=_[_0xd11e('0x46')](_0x4aa006[_0xd11e('0x42')],_0x4aa006[_0xd11e('0x43')]);_0x500761[_0xd11e('0x48')]=_['intersection'](_0x4aa006[_0xd11e('0x42')],qs[_0xd11e('0x47')](_0xab7ce5[_0xd11e('0x43')]['fields']));_0x500761[_0xd11e('0x48')]=_0x500761[_0xd11e('0x48')][_0xd11e('0x49')]?_0x500761['attributes']:_0x4aa006['model'];if(_0xab7ce5[_0xd11e('0x43')][_0xd11e('0x57')]){_0x500761[_0xd11e('0x53')]=[{'all':!![]}];}_0x500761=_[_0xd11e('0x51')]({},_0x500761,_0xab7ce5[_0xd11e('0x52')]);return db[_0xd11e('0x3d')][_0xd11e('0x58')](_0x500761)['then'](handleEntityNotFound(_0x3d2358,null))['then'](respondWithResult(_0x3d2358,null))[_0xd11e('0x2a')](handleError(_0x3d2358,null));};exports[_0xd11e('0x59')]=function(_0x399acb,_0x1b2638){var _0x5beff2={'where':{'id':_0x399acb[_0xd11e('0x56')]['id']}},_0x2f5391={};_0x2f5391[_0xd11e('0x42')]=_[_0xd11e('0x44')](db[_0xd11e('0x3d')]['rawAttributes']);_0x5beff2[_0xd11e('0x48')]=_[_0xd11e('0x46')](_0x2f5391['model'],qs['fields'](_0x399acb[_0xd11e('0x43')][_0xd11e('0x47')]));_0x5beff2[_0xd11e('0x48')]=_0x5beff2[_0xd11e('0x48')][_0xd11e('0x49')]?_0x5beff2['attributes']:_0x2f5391['model'];if(_0x399acb[_0xd11e('0x43')][_0xd11e('0x57')]){_0x5beff2[_0xd11e('0x53')]=[{'all':!![]}];}_0x5beff2=_[_0xd11e('0x51')]({},_0x5beff2,_0x399acb[_0xd11e('0x52')]);return db[_0xd11e('0x3d')][_0xd11e('0x58')](_0x5beff2)[_0xd11e('0x20')](handleEntityNotFound(_0x1b2638,null))['then'](function(_0x53adbe){if(_0x53adbe){var _0x44e83f=_0x53adbe['get']({'plain':!![]});_0x44e83f=qs[_0xd11e('0x5a')](_0x44e83f,['id',_0xd11e('0x5b'),_0xd11e('0x5c')]);_0x399acb[_0xd11e('0x5d')]=_[_0xd11e('0x5a')](_0x399acb[_0xd11e('0x5d')],['id','createdAt',_0xd11e('0x5c')]);return db['Trunk'][_0xd11e('0x5e')](_[_0xd11e('0x51')](_0x44e83f,_0x399acb[_0xd11e('0x5d')]),{'include':_0x399acb[_0xd11e('0x43')][_0xd11e('0x57')]?[{'all':!![]}]:undefined})[_0xd11e('0x20')](function(_0x308174){var _0x3c9ade=_0x399acb['user']['get']({'plain':!![]});if(!_0x3c9ade)throw new Error(_0xd11e('0x5f'));if(_0x3c9ade[_0xd11e('0x60')]===_0xd11e('0x61')){var _0x204e71=_0x308174[_0xd11e('0x62')]({'plain':!![]});var _0x55cd4e=_0xd11e('0x36');return db[_0xd11e('0x63')]['find']({'where':{'name':_0x55cd4e,'userProfileId':_0x3c9ade[_0xd11e('0x64')]},'raw':!![]})[_0xd11e('0x20')](function(_0x44c1d6){if(_0x44c1d6&&_0x44c1d6[_0xd11e('0x65')]===0x0){return db[_0xd11e('0x66')][_0xd11e('0x5e')]({'name':_0x204e71[_0xd11e('0x3a')],'resourceId':_0x204e71['id'],'type':_0x44c1d6[_0xd11e('0x3a')],'sectionId':_0x44c1d6['id']},{})['then'](function(){return _0x308174;});}else{return _0x308174;}})[_0xd11e('0x2a')](function(_0x9bf136){logger[_0xd11e('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9bf136);throw _0x9bf136;});}return _0x308174;});}})[_0xd11e('0x20')](respondWithResult(_0x1b2638,0xc9))[_0xd11e('0x2a')](handleError(_0x1b2638,null));};exports['create']=function(_0x26b21a,_0x35e1ee,_0x53e93c){var _0x1813d9;return db[_0xd11e('0x3d')]['create'](_0x26b21a[_0xd11e('0x5d')],{'raw':!![]})[_0xd11e('0x20')](function(_0x48c03b){_0x1813d9=_0x48c03b;return db[_0xd11e('0x3d')][_0xd11e('0x67')]({'raw':!![]});})['then'](function(_0x3ccada){var _0x1486ae=fs[_0xd11e('0x68')](path['join'](config[_0xd11e('0x69')],_0xd11e('0x6a')),_0xd11e('0x6b'));var _0x4e1ebd=fs[_0xd11e('0x68')](path[_0xd11e('0x6c')](config['root'],_0xd11e('0x6d')),'utf8');var _0x37fe96=ejs[_0xd11e('0x6e')](_0x1486ae,{'trunks':_0x3ccada||[]});fs[_0xd11e('0x6f')](_0xd11e('0x70'),_0x37fe96);if(_0x1813d9['registry']){var _0xf76a9e=ejs[_0xd11e('0x6e')](_0x4e1ebd,{'trunks':_0x3ccada||[]});fs[_0xd11e('0x6f')](_0xd11e('0x71'),_0xf76a9e);}})[_0xd11e('0x20')](function(){return respondWithRpcPromise(_0xd11e('0x72'),_0xd11e('0x5e'),{'module':_0xd11e('0x73')});})[_0xd11e('0x20')](function(){var _0x25e28c=_0x26b21a[_0xd11e('0x61')][_0xd11e('0x62')]({'plain':!![]});if(!_0x25e28c)throw new Error(_0xd11e('0x5f'));if(_0x25e28c[_0xd11e('0x60')]===_0xd11e('0x61')){var _0x3e6230=_0x1813d9[_0xd11e('0x62')]({'plain':!![]});return db[_0xd11e('0x63')][_0xd11e('0x58')]({'where':{'name':_0xd11e('0x36'),'userProfileId':_0x25e28c[_0xd11e('0x64')]},'raw':!![]})[_0xd11e('0x20')](function(_0x4a64f7){if(_0x4a64f7&&_0x4a64f7[_0xd11e('0x65')]===0x0){return db[_0xd11e('0x66')][_0xd11e('0x5e')]({'name':_0x3e6230['name'],'resourceId':_0x3e6230['id'],'type':_0x4a64f7[_0xd11e('0x3a')],'sectionId':_0x4a64f7['id']},{})[_0xd11e('0x20')](function(){return _0x1813d9;});}else{return _0x1813d9;}})['catch'](function(_0x5cbd1){logger[_0xd11e('0x27')](_0xd11e('0x74'),_0x5cbd1);throw _0x5cbd1;});}return _0x1813d9;})[_0xd11e('0x20')](respondWithResult(_0x35e1ee,0xc9))[_0xd11e('0x2a')](handleError(_0x35e1ee,null));};exports[_0xd11e('0x35')]=function(_0x176696,_0x4f7ea8,_0x106d24){var _0x57b723;return db[_0xd11e('0x3d')][_0xd11e('0x58')]({'where':{'id':_0x176696[_0xd11e('0x56')]['id']}})[_0xd11e('0x20')](handleEntityNotFound(_0x4f7ea8,null))[_0xd11e('0x20')](saveUpdates(_0x176696[_0xd11e('0x5d')],null))[_0xd11e('0x20')](function(_0x49e981){if(_0x49e981){_0x57b723=_0x49e981;return db[_0xd11e('0x3d')][_0xd11e('0x67')]({'raw':!![]});}})[_0xd11e('0x20')](function(_0x47389c){if(_0x47389c){var _0x498997=fs[_0xd11e('0x68')](path[_0xd11e('0x6c')](config[_0xd11e('0x69')],'server/files/templates/trunk.ejs'),_0xd11e('0x6b'));var _0xd5c2cc=fs[_0xd11e('0x68')](path[_0xd11e('0x6c')](config['root'],_0xd11e('0x6d')),_0xd11e('0x6b'));var _0x283285=ejs[_0xd11e('0x6e')](_0x498997,{'trunks':_0x47389c||[]});fs[_0xd11e('0x6f')]('/etc/asterisk/sip_xcally_trunks.conf',_0x283285);var _0x2ee09c=ejs['render'](_0xd5c2cc,{'trunks':_0x47389c||[]});fs[_0xd11e('0x6f')](_0xd11e('0x71'),_0x2ee09c);return respondWithRpcPromise(_0xd11e('0x72'),_0xd11e('0x35'),{'module':_0xd11e('0x73')});}return null;})['then'](function(_0x1ea927){if(_0x1ea927){return _0x57b723;}})[_0xd11e('0x20')](respondWithResult(_0x4f7ea8,null))[_0xd11e('0x2a')](handleError(_0x4f7ea8,null));};exports[_0xd11e('0x37')]=function(_0x9316e8,_0x15edd1,_0x5d44ed){var _0x7afb5e;return db[_0xd11e('0x3d')][_0xd11e('0x58')]({'where':{'id':_0x9316e8['params']['id']}})['then'](handleEntityNotFound(_0x15edd1,null))[_0xd11e('0x20')](removeEntity(_0x15edd1,null))[_0xd11e('0x20')](function(){return db[_0xd11e('0x3d')][_0xd11e('0x67')]({'raw':!![]});})[_0xd11e('0x20')](function(_0x5481a1){var _0x46f896=fs[_0xd11e('0x68')](path[_0xd11e('0x6c')](config[_0xd11e('0x69')],_0xd11e('0x6a')),_0xd11e('0x6b'));var _0x257e14=fs[_0xd11e('0x68')](path[_0xd11e('0x6c')](config[_0xd11e('0x69')],_0xd11e('0x6d')),_0xd11e('0x6b'));var _0x4b7b80=ejs[_0xd11e('0x6e')](_0x46f896,{'trunks':_0x5481a1});var _0x1ea749=ejs[_0xd11e('0x6e')](_0x257e14,{'trunks':_0x5481a1});fs[_0xd11e('0x6f')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4b7b80);fs['writeFileSync'](_0xd11e('0x71'),_0x1ea749);return respondWithRpcPromise(_0xd11e('0x72'),'destroy',{'module':'chan_sip.so'});})[_0xd11e('0x2a')](handleError(_0x15edd1,null));}; \ No newline at end of file +var _0x002d=['jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','reject','save','update','destroy','UserProfileResource','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','options','Trunk','includeAll','include','findAll','rows','params','find','clone','merge','get','omit','createdAt','updatedAt','body','create','user','role','Trunks','userProfileId','autoAssociation','join','readFileSync','server/files/templates/registry.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','server/files/templates/trunk.ejs','chan_sip.so','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x447b93,_0x2670ae){var _0x1fd738=function(_0x52dab5){while(--_0x52dab5){_0x447b93['push'](_0x447b93['shift']());}};_0x1fd738(++_0x2670ae);}(_0x002d,0xca));var _0xd002=function(_0xe86e4e,_0x354795){_0xe86e4e=_0xe86e4e-0x0;var _0x508f6e=_0x002d[_0xe86e4e];return _0x508f6e;};'use strict';var pdf=require(_0xd002('0x0'));var emlformat=require(_0xd002('0x1'));var rimraf=require(_0xd002('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd002('0x3'));var moment=require(_0xd002('0x4'));var BPromise=require(_0xd002('0x5'));var Mustache=require(_0xd002('0x6'));var util=require(_0xd002('0x7'));var path=require(_0xd002('0x8'));var sox=require(_0xd002('0x9'));var csv=require(_0xd002('0xa'));var ejs=require(_0xd002('0xb'));var fs=require('fs');var _=require(_0xd002('0xc'));var squel=require(_0xd002('0xd'));var crypto=require(_0xd002('0xe'));var jsforce=require(_0xd002('0xf'));var deskjs=require(_0xd002('0x10'));var toCsv=require(_0xd002('0xa'));var querystring=require(_0xd002('0x11'));var Papa=require(_0xd002('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd002('0x13'));var as=require(_0xd002('0x14'));var hardwareService=require(_0xd002('0x15'));var logger=require('../../config/logger')(_0xd002('0x16'));var utils=require(_0xd002('0x17'));var config=require(_0xd002('0x18'));var db=require(_0xd002('0x19'))['db'];var jayson=require(_0xd002('0x1a'));var client=jayson[_0xd002('0x1b')][_0xd002('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x28920f,_0xd3bb8a,_0x37410c){if(_0x37410c){var _0x2df661=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2df661[_0xd002('0x1d')](_0xd3bb8a)){return _0x28920f;}else{throw new db[(_0xd002('0x1e'))][(_0xd002('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 _0x28920f;}}function respondWithRpcPromise(_0x498590,_0x5bc910,_0x460e7b,_0x53cd4b){return new BPromise(function(_0x13acd5,_0x6a612b){var _0xc75841=_0x53cd4b||client;return _0xc75841[_0xd002('0x20')](_0x498590,_0x460e7b)[_0xd002('0x21')](function(_0x124d97){logger[_0xd002('0x22')]('Trunk,\x20%s,\x20%s',_0x5bc910,_0xd002('0x23'));logger[_0xd002('0x24')](_0xd002('0x25'),_0x5bc910,_0xd002('0x23'),JSON[_0xd002('0x26')](_0x124d97));if(_0x124d97['error']){if(_0x124d97[_0xd002('0x27')][_0xd002('0x28')]===0x1f4){logger[_0xd002('0x27')](_0xd002('0x29'),_0x5bc910,_0x124d97[_0xd002('0x27')][_0xd002('0x2a')]);return _0x6a612b(_0x124d97['error']['message']);}logger[_0xd002('0x27')](_0xd002('0x29'),_0x5bc910,_0x124d97[_0xd002('0x27')][_0xd002('0x2a')]);return _0x13acd5(_0x124d97[_0xd002('0x27')][_0xd002('0x2a')]);}else{logger[_0xd002('0x22')](_0xd002('0x29'),_0x5bc910,_0xd002('0x23'));_0x13acd5(_0x124d97[_0xd002('0x2b')][_0xd002('0x2a')]);}})[_0xd002('0x2c')](function(_0x55f0c5){logger[_0xd002('0x27')](_0xd002('0x29'),_0x5bc910,_0x55f0c5);_0x6a612b(_0x55f0c5);});});}function respondWithStatusCode(_0x55e3be,_0x32ac79){_0x32ac79=_0x32ac79||0xcc;return function(_0x21fe25){if(_0x21fe25){return _0x55e3be[_0xd002('0x2d')](_0x32ac79);}return _0x55e3be['status'](_0x32ac79)[_0xd002('0x2e')]();};}function respondWithResult(_0x4f58fa,_0x4985a7){_0x4985a7=_0x4985a7||0xc8;return function(_0x5095d2){if(_0x5095d2){return _0x4f58fa[_0xd002('0x2f')](_0x4985a7)[_0xd002('0x30')](_0x5095d2);}};}function respondWithFilteredResult(_0x1f4ae6,_0x31e576){return function(_0x358509){if(_0x358509){var _0x24722d=_0x358509[_0xd002('0x31')],_0x1648e1=_0x31e576['offset'],_0x3e0cc2=_0x31e576[_0xd002('0x32')]+_0x31e576[_0xd002('0x33')],_0x9999ea;if(_0x3e0cc2>=_0x24722d){_0x3e0cc2=_0x24722d;_0x9999ea=0xc8;}else{_0x9999ea=0xce;}_0x1f4ae6[_0xd002('0x2f')](_0x9999ea);return _0x1f4ae6[_0xd002('0x34')]('Content-Range',_0x1648e1+'-'+_0x3e0cc2+'/'+_0x24722d)[_0xd002('0x30')](_0x358509);}return null;};}function patchUpdates(_0x568d90){return function(_0x41ebcc){try{jsonpatch['apply'](_0x41ebcc,_0x568d90,!![]);}catch(_0x3f271e){return BPromise[_0xd002('0x35')](_0x3f271e);}return _0x41ebcc[_0xd002('0x36')]();};}function saveUpdates(_0x458f3f,_0x15c485){return function(_0x72e8c3){if(_0x72e8c3){return _0x72e8c3[_0xd002('0x37')](_0x458f3f)[_0xd002('0x21')](function(_0x5e703f){return _0x5e703f;});}return null;};}function removeEntity(_0x26d8be,_0x49bd87){return function(_0x111b91){if(_0x111b91){return _0x111b91[_0xd002('0x38')]()[_0xd002('0x21')](function(){var _0x1326dd=_0x111b91['get']({'plain':!![]});var _0x58411e='Trunks';return db[_0xd002('0x39')]['destroy']({'where':{'type':_0x58411e,'resourceId':_0x1326dd['id']}})[_0xd002('0x21')](function(){return _0x111b91;});})[_0xd002('0x21')](function(){_0x26d8be[_0xd002('0x2f')](0xcc)[_0xd002('0x2e')]();});}};}function handleEntityNotFound(_0x3e626b,_0x35433e){return function(_0x14008a){if(!_0x14008a){_0x3e626b[_0xd002('0x2d')](0x194);}return _0x14008a;};}function handleError(_0x5430bc,_0x1189c0){_0x1189c0=_0x1189c0||0x1f4;return function(_0x21bc92){logger['error'](_0x21bc92['stack']);if(_0x21bc92[_0xd002('0x3a')]){delete _0x21bc92[_0xd002('0x3a')];}_0x5430bc[_0xd002('0x2f')](_0x1189c0)[_0xd002('0x3b')](_0x21bc92);};}exports['index']=function(_0x1e4a98,_0x5545f2){var _0x16d23d={},_0x45f7f0={},_0x347baa={'count':0x0,'rows':[]};var _0x59c394=_[_0xd002('0x3c')](db['Trunk'][_0xd002('0x3d')],function(_0x7a9e84){return{'name':_0x7a9e84[_0xd002('0x3e')],'type':_0x7a9e84[_0xd002('0x3f')][_0xd002('0x40')]};});_0x45f7f0[_0xd002('0x41')]=_[_0xd002('0x3c')](_0x59c394,_0xd002('0x3a'));_0x45f7f0[_0xd002('0x42')]=_[_0xd002('0x43')](_0x1e4a98[_0xd002('0x42')]);_0x45f7f0[_0xd002('0x44')]=_[_0xd002('0x45')](_0x45f7f0[_0xd002('0x41')],_0x45f7f0[_0xd002('0x42')]);_0x16d23d[_0xd002('0x46')]=_['intersection'](_0x45f7f0[_0xd002('0x41')],qs[_0xd002('0x47')](_0x1e4a98[_0xd002('0x42')][_0xd002('0x47')]));_0x16d23d['attributes']=_0x16d23d[_0xd002('0x46')][_0xd002('0x48')]?_0x16d23d['attributes']:_0x45f7f0['model'];if(!_0x1e4a98[_0xd002('0x42')][_0xd002('0x49')](_0xd002('0x4a'))){_0x16d23d['limit']=qs[_0xd002('0x33')](_0x1e4a98['query']['limit']);_0x16d23d[_0xd002('0x32')]=qs['offset'](_0x1e4a98[_0xd002('0x42')][_0xd002('0x32')]);}_0x16d23d['order']=qs[_0xd002('0x4b')](_0x1e4a98[_0xd002('0x42')][_0xd002('0x4b')]);_0x16d23d[_0xd002('0x4c')]=qs[_0xd002('0x44')](_['pick'](_0x1e4a98['query'],_0x45f7f0[_0xd002('0x44')]));if(_0x1e4a98['query'][_0xd002('0x4d')]){_0x16d23d[_0xd002('0x4c')]=_['merge'](_0x16d23d['where'],{'$or':_[_0xd002('0x3c')](_0x59c394,function(_0x585357){if(_0x585357[_0xd002('0x3f')]!=='VIRTUAL'){var _0x366421={};_0x366421[_0x585357['name']]={'$like':'%'+_0x1e4a98[_0xd002('0x42')][_0xd002('0x4d')]+'%'};return _0x366421;}})});}_0x16d23d=_['merge']({},_0x16d23d,_0x1e4a98[_0xd002('0x4e')]);var _0x32a8e5={'where':_0x16d23d[_0xd002('0x4c')]};return db[_0xd002('0x4f')][_0xd002('0x31')](_0x32a8e5)[_0xd002('0x21')](function(_0x54eeab){_0x347baa[_0xd002('0x31')]=_0x54eeab;if(_0x1e4a98[_0xd002('0x42')][_0xd002('0x50')]){_0x16d23d[_0xd002('0x51')]=[{'all':!![]}];}return db['Trunk'][_0xd002('0x52')](_0x16d23d);})[_0xd002('0x21')](function(_0x286c9b){_0x347baa[_0xd002('0x53')]=_0x286c9b;return _0x347baa;})[_0xd002('0x21')](respondWithFilteredResult(_0x5545f2,_0x16d23d))[_0xd002('0x2c')](handleError(_0x5545f2,null));};exports['show']=function(_0x153e32,_0x3dc8c7){var _0x468eff={'raw':![],'where':{'id':_0x153e32[_0xd002('0x54')]['id']}},_0x31e607={};_0x31e607[_0xd002('0x41')]=_[_0xd002('0x43')](db[_0xd002('0x4f')][_0xd002('0x3d')]);_0x31e607[_0xd002('0x42')]=_['keys'](_0x153e32[_0xd002('0x42')]);_0x31e607[_0xd002('0x44')]=_[_0xd002('0x45')](_0x31e607[_0xd002('0x41')],_0x31e607[_0xd002('0x42')]);_0x468eff[_0xd002('0x46')]=_[_0xd002('0x45')](_0x31e607[_0xd002('0x41')],qs['fields'](_0x153e32['query'][_0xd002('0x47')]));_0x468eff[_0xd002('0x46')]=_0x468eff[_0xd002('0x46')][_0xd002('0x48')]?_0x468eff['attributes']:_0x31e607[_0xd002('0x41')];if(_0x153e32[_0xd002('0x42')][_0xd002('0x50')]){_0x468eff[_0xd002('0x51')]=[{'all':!![]}];}_0x468eff=_['merge']({},_0x468eff,_0x153e32[_0xd002('0x4e')]);return db[_0xd002('0x4f')][_0xd002('0x55')](_0x468eff)[_0xd002('0x21')](handleEntityNotFound(_0x3dc8c7,null))['then'](respondWithResult(_0x3dc8c7,null))[_0xd002('0x2c')](handleError(_0x3dc8c7,null));};exports[_0xd002('0x56')]=function(_0x3db9bb,_0x51c36d){var _0x319f00={'where':{'id':_0x3db9bb['params']['id']}},_0x532aa6={};_0x532aa6[_0xd002('0x41')]=_[_0xd002('0x43')](db[_0xd002('0x4f')][_0xd002('0x3d')]);_0x319f00['attributes']=_[_0xd002('0x45')](_0x532aa6['model'],qs[_0xd002('0x47')](_0x3db9bb[_0xd002('0x42')][_0xd002('0x47')]));_0x319f00['attributes']=_0x319f00['attributes'][_0xd002('0x48')]?_0x319f00['attributes']:_0x532aa6['model'];if(_0x3db9bb['query'][_0xd002('0x50')]){_0x319f00[_0xd002('0x51')]=[{'all':!![]}];}_0x319f00=_[_0xd002('0x57')]({},_0x319f00,_0x3db9bb['options']);return db[_0xd002('0x4f')][_0xd002('0x55')](_0x319f00)[_0xd002('0x21')](handleEntityNotFound(_0x51c36d,null))[_0xd002('0x21')](function(_0x1b3dbb){if(_0x1b3dbb){var _0x3b7e78=_0x1b3dbb[_0xd002('0x58')]({'plain':!![]});_0x3b7e78=qs[_0xd002('0x59')](_0x3b7e78,['id',_0xd002('0x5a'),_0xd002('0x5b')]);_0x3db9bb['body']=_[_0xd002('0x59')](_0x3db9bb[_0xd002('0x5c')],['id','createdAt',_0xd002('0x5b')]);return db[_0xd002('0x4f')][_0xd002('0x5d')](_[_0xd002('0x57')](_0x3b7e78,_0x3db9bb['body']),{'include':_0x3db9bb[_0xd002('0x42')][_0xd002('0x50')]?[{'all':!![]}]:undefined})[_0xd002('0x21')](function(_0x5e4aaf){var _0x189aea=_0x3db9bb[_0xd002('0x5e')]['get']({'plain':!![]});if(!_0x189aea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x189aea[_0xd002('0x5f')]==='user'){var _0x145576=_0x5e4aaf[_0xd002('0x58')]({'plain':!![]});var _0x3b75d0=_0xd002('0x60');return db['UserProfileSection'][_0xd002('0x55')]({'where':{'name':_0x3b75d0,'userProfileId':_0x189aea[_0xd002('0x61')]},'raw':!![]})[_0xd002('0x21')](function(_0x51286a){if(_0x51286a&&_0x51286a[_0xd002('0x62')]===0x0){return db[_0xd002('0x39')][_0xd002('0x5d')]({'name':_0x145576['name'],'resourceId':_0x145576['id'],'type':_0x51286a[_0xd002('0x3a')],'sectionId':_0x51286a['id']},{})['then'](function(){return _0x5e4aaf;});}else{return _0x5e4aaf;}})[_0xd002('0x2c')](function(_0x192100){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x192100);throw _0x192100;});}return _0x5e4aaf;});}})[_0xd002('0x21')](respondWithResult(_0x51c36d,0xc9))['catch'](handleError(_0x51c36d,null));};exports[_0xd002('0x5d')]=function(_0x5187db,_0xc0d5c1,_0x309d24){var _0x3555b2;return db['Trunk'][_0xd002('0x5d')](_0x5187db['body'],{'raw':!![]})[_0xd002('0x21')](function(_0x185a49){_0x3555b2=_0x185a49;return db[_0xd002('0x4f')][_0xd002('0x52')]({'raw':!![]});})['then'](function(_0x35c9f2){var _0x3aab86=fs['readFileSync'](path[_0xd002('0x63')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x364f7d=fs[_0xd002('0x64')](path[_0xd002('0x63')](config['root'],_0xd002('0x65')),_0xd002('0x66'));var _0x3c96e9=ejs[_0xd002('0x67')](_0x3aab86,{'trunks':_0x35c9f2||[]});fs[_0xd002('0x68')](_0xd002('0x69'),_0x3c96e9);if(_0x3555b2[_0xd002('0x6a')]){var _0x51943a=ejs[_0xd002('0x67')](_0x364f7d,{'trunks':_0x35c9f2||[]});fs[_0xd002('0x68')](_0xd002('0x6b'),_0x51943a);}})[_0xd002('0x21')](function(){return respondWithRpcPromise(_0xd002('0x6c'),_0xd002('0x5d'),{'module':'chan_sip.so'});})['then'](function(){var _0x4821b8=_0x5187db[_0xd002('0x5e')]['get']({'plain':!![]});if(!_0x4821b8)throw new Error(_0xd002('0x6d'));if(_0x4821b8['role']===_0xd002('0x5e')){var _0x50fedd=_0x3555b2[_0xd002('0x58')]({'plain':!![]});return db['UserProfileSection'][_0xd002('0x55')]({'where':{'name':_0xd002('0x60'),'userProfileId':_0x4821b8[_0xd002('0x61')]},'raw':!![]})[_0xd002('0x21')](function(_0x561c47){if(_0x561c47&&_0x561c47['autoAssociation']===0x0){return db[_0xd002('0x39')][_0xd002('0x5d')]({'name':_0x50fedd[_0xd002('0x3a')],'resourceId':_0x50fedd['id'],'type':_0x561c47[_0xd002('0x3a')],'sectionId':_0x561c47['id']},{})[_0xd002('0x21')](function(){return _0x3555b2;});}else{return _0x3555b2;}})[_0xd002('0x2c')](function(_0x21571c){logger[_0xd002('0x27')](_0xd002('0x6e'),_0x21571c);throw _0x21571c;});}return _0x3555b2;})[_0xd002('0x21')](respondWithResult(_0xc0d5c1,0xc9))[_0xd002('0x2c')](handleError(_0xc0d5c1,null));};exports[_0xd002('0x37')]=function(_0xa7f9d5,_0x4be6c1,_0x45e080){var _0x3466d8;return db[_0xd002('0x4f')]['find']({'where':{'id':_0xa7f9d5[_0xd002('0x54')]['id']}})[_0xd002('0x21')](handleEntityNotFound(_0x4be6c1,null))[_0xd002('0x21')](saveUpdates(_0xa7f9d5[_0xd002('0x5c')],null))[_0xd002('0x21')](function(_0x324bee){if(_0x324bee){_0x3466d8=_0x324bee;return db[_0xd002('0x4f')][_0xd002('0x52')]({'raw':!![]});}})[_0xd002('0x21')](function(_0x1edc01){if(_0x1edc01){var _0xf1129d=fs[_0xd002('0x64')](path[_0xd002('0x63')](config[_0xd002('0x6f')],_0xd002('0x70')),'utf8');var _0x444490=fs[_0xd002('0x64')](path[_0xd002('0x63')](config[_0xd002('0x6f')],_0xd002('0x65')),'utf8');var _0x55a350=ejs[_0xd002('0x67')](_0xf1129d,{'trunks':_0x1edc01||[]});fs[_0xd002('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x55a350);var _0x1fc672=ejs[_0xd002('0x67')](_0x444490,{'trunks':_0x1edc01||[]});fs['writeFileSync'](_0xd002('0x6b'),_0x1fc672);return respondWithRpcPromise(_0xd002('0x6c'),'update',{'module':'chan_sip.so'});}return null;})[_0xd002('0x21')](function(_0x14f42d){if(_0x14f42d){return _0x3466d8;}})[_0xd002('0x21')](respondWithResult(_0x4be6c1,null))['catch'](handleError(_0x4be6c1,null));};exports[_0xd002('0x38')]=function(_0x17c8bf,_0x28dc05,_0x24b170){var _0x56b13d;return db[_0xd002('0x4f')][_0xd002('0x55')]({'where':{'id':_0x17c8bf[_0xd002('0x54')]['id']}})['then'](handleEntityNotFound(_0x28dc05,null))['then'](removeEntity(_0x28dc05,null))[_0xd002('0x21')](function(){return db['Trunk'][_0xd002('0x52')]({'raw':!![]});})['then'](function(_0x30f56c){var _0x31878b=fs[_0xd002('0x64')](path['join'](config[_0xd002('0x6f')],_0xd002('0x70')),'utf8');var _0x4e431e=fs[_0xd002('0x64')](path[_0xd002('0x63')](config['root'],_0xd002('0x65')),_0xd002('0x66'));var _0x2f1803=ejs[_0xd002('0x67')](_0x31878b,{'trunks':_0x30f56c});var _0x3c7c31=ejs[_0xd002('0x67')](_0x4e431e,{'trunks':_0x30f56c});fs['writeFileSync'](_0xd002('0x69'),_0x2f1803);fs[_0xd002('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x3c7c31);return respondWithRpcPromise(_0xd002('0x6c'),_0xd002('0x38'),{'module':_0xd002('0x71')});})[_0xd002('0x2c')](handleError(_0x28dc05,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 8522890..f229501 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 _0x626a=['path','rimraf','../../config/environment','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment'];(function(_0x1d1512,_0x365777){var _0x575f7c=function(_0x4ccfe0){while(--_0x4ccfe0){_0x1d1512['push'](_0x1d1512['shift']());}};_0x575f7c(++_0x365777);}(_0x626a,0xa3));var _0xa626=function(_0x2d255b,_0x444be5){_0x2d255b=_0x2d255b-0x0;var _0x5bbc36=_0x626a[_0x2d255b];return _0x5bbc36;};'use strict';var _=require(_0xa626('0x0'));var util=require(_0xa626('0x1'));var logger=require(_0xa626('0x2'))(_0xa626('0x3'));var moment=require(_0xa626('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa626('0x5'));var rimraf=require(_0xa626('0x6'));var config=require(_0xa626('0x7'));var attributes=require('./trunk.attributes');module[_0xa626('0x8')]=function(_0x364171,_0x4b23fe){return _0x364171[_0xa626('0x9')](_0xa626('0xa'),attributes,{'tableName':_0xa626('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd32d=['request-promise','rimraf','../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks','lodash','../../config/logger','api','moment','bluebird'];(function(_0x11f1a3,_0x29909f){var _0x20252c=function(_0xe357e9){while(--_0xe357e9){_0x11f1a3['push'](_0x11f1a3['shift']());}};_0x20252c(++_0x29909f);}(_0xd32d,0xc7));var _0xdd32=function(_0x35e7e8,_0x3dfa23){_0x35e7e8=_0x35e7e8-0x0;var _0x70709b=_0xd32d[_0x35e7e8];return _0x70709b;};'use strict';var _=require(_0xdd32('0x0'));var util=require('util');var logger=require(_0xdd32('0x1'))(_0xdd32('0x2'));var moment=require(_0xdd32('0x3'));var BPromise=require(_0xdd32('0x4'));var rp=require(_0xdd32('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdd32('0x6'));var config=require(_0xdd32('0x7'));var attributes=require(_0xdd32('0x8'));module[_0xdd32('0x9')]=function(_0x52dad4,_0x223869){return _0x52dad4['define'](_0xdd32('0xa'),attributes,{'tableName':_0xdd32('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 a4a20b7..b009dec 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 _0x9ffd=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Trunk,\x20%s,\x20%s','info','catch','GetTrunk','Trunk','findAll','options','raw','include','map','model','attributes','where','ShowTrunk'];(function(_0x4e3228,_0x44c3c3){var _0x1ece57=function(_0x529d8e){while(--_0x529d8e){_0x4e3228['push'](_0x4e3228['shift']());}};_0x1ece57(++_0x44c3c3);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x293f51,_0x50480e){_0x293f51=_0x293f51-0x0;var _0xe8cef1=_0x9ffd[_0x293f51];return _0xe8cef1;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('Trunk,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('Trunk,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('Trunk,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});}exports[_0xd9ff('0x17')]=function(_0x3afd19){var _0x5f45c4=this;return new Promise(function(_0x2d4df1,_0x3ccf15){return db[_0xd9ff('0x18')][_0xd9ff('0x19')]({'raw':_0x3afd19[_0xd9ff('0x1a')]?_0x3afd19[_0xd9ff('0x1a')][_0xd9ff('0x1b')]===undefined?!![]:![]:!![],'where':_0x3afd19[_0xd9ff('0x1a')]?_0x3afd19['options']['where']||null:null,'attributes':_0x3afd19[_0xd9ff('0x1a')]?_0x3afd19[_0xd9ff('0x1a')]['attributes']||null:null,'limit':_0x3afd19['options']?_0x3afd19['options']['limit']||null:null,'include':_0x3afd19[_0xd9ff('0x1a')]?_0x3afd19['options'][_0xd9ff('0x1c')]?_[_0xd9ff('0x1d')](_0x3afd19[_0xd9ff('0x1a')][_0xd9ff('0x1c')],function(_0x278b66){return{'model':db[_0x278b66[_0xd9ff('0x1e')]],'as':_0x278b66['as'],'attributes':_0x278b66['attributes'],'include':_0x278b66['include']?_[_0xd9ff('0x1d')](_0x278b66['include'],function(_0x3ca906){return{'model':db[_0x3ca906['model']],'as':_0x3ca906['as'],'attributes':_0x3ca906[_0xd9ff('0x1f')],'include':_0x3ca906['include']?_[_0xd9ff('0x1d')](_0x3ca906[_0xd9ff('0x1c')],function(_0x2138b4){return{'model':db[_0x2138b4[_0xd9ff('0x1e')]],'as':_0x2138b4['as'],'attributes':_0x2138b4['attributes']};}):[]};}):[]};}):[]:[]})[_0xd9ff('0xc')](function(_0xe11f88){logger[_0xd9ff('0x15')](_0xd9ff('0x17'),_0x3afd19);logger['debug'](_0xd9ff('0x17'),_0x3afd19,JSON[_0xd9ff('0x10')](_0xe11f88));_0x2d4df1(_0xe11f88);})[_0xd9ff('0x16')](function(_0x45fb63){logger[_0xd9ff('0x11')](_0xd9ff('0x17'),_0x45fb63[_0xd9ff('0x13')],_0x3afd19);_0x3ccf15(_0x5f45c4[_0xd9ff('0x11')](0x1f4,_0x45fb63[_0xd9ff('0x13')]));});});};exports['ShowTrunk']=function(_0xcea5db){var _0x4ba2be=this;return new Promise(function(_0x1d55fd,_0x29c532){return db[_0xd9ff('0x18')]['find']({'raw':_0xcea5db[_0xd9ff('0x1a')]?_0xcea5db[_0xd9ff('0x1a')][_0xd9ff('0x1b')]===undefined?!![]:![]:!![],'where':_0xcea5db[_0xd9ff('0x1a')]?_0xcea5db['options'][_0xd9ff('0x20')]||null:null,'attributes':_0xcea5db['options']?_0xcea5db[_0xd9ff('0x1a')][_0xd9ff('0x1f')]||null:null,'include':_0xcea5db[_0xd9ff('0x1a')]?_0xcea5db[_0xd9ff('0x1a')][_0xd9ff('0x1c')]?_[_0xd9ff('0x1d')](_0xcea5db[_0xd9ff('0x1a')][_0xd9ff('0x1c')],function(_0x36749c){return{'model':db[_0x36749c[_0xd9ff('0x1e')]],'as':_0x36749c['as'],'attributes':_0x36749c[_0xd9ff('0x1f')],'include':_0x36749c[_0xd9ff('0x1c')]?_[_0xd9ff('0x1d')](_0x36749c[_0xd9ff('0x1c')],function(_0x498025){return{'model':db[_0x498025[_0xd9ff('0x1e')]],'as':_0x498025['as'],'attributes':_0x498025[_0xd9ff('0x1f')],'include':_0x498025[_0xd9ff('0x1c')]?_['map'](_0x498025[_0xd9ff('0x1c')],function(_0x5e3ff9){return{'model':db[_0x5e3ff9[_0xd9ff('0x1e')]],'as':_0x5e3ff9['as'],'attributes':_0x5e3ff9['attributes']};}):[]};}):[]};}):[]:[]})[_0xd9ff('0xc')](function(_0x5db498){logger[_0xd9ff('0x15')](_0xd9ff('0x21'),_0xcea5db);logger[_0xd9ff('0xd')]('ShowTrunk',_0xcea5db,JSON['stringify'](_0x5db498));_0x1d55fd(_0x5db498);})['catch'](function(_0x7ac3d1){logger[_0xd9ff('0x11')](_0xd9ff('0x21'),_0x7ac3d1[_0xd9ff('0x13')],_0xcea5db);_0x29c532(_0x4ba2be[_0xd9ff('0x11')](0x1f4,_0x7ac3d1[_0xd9ff('0x13')]));});});}; \ No newline at end of file +var _0xbaf0=['Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','model','map','ShowTrunk','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x139b63,_0x389ca8){var _0x2493f2=function(_0x137a08){while(--_0x137a08){_0x139b63['push'](_0x139b63['shift']());}};_0x2493f2(++_0x389ca8);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('Trunk,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetTrunk',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowTrunk',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 386b9d7..a6ae9d0 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 _0x5f2f=['createApiKey','update','/:id/password','changePassword','removeQueues','removeTeams','destroy','delete','removeFaxInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/whoami','/:id','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','/:id/api_key','getApiKey','post','/create_many','bulkCreate','addContacts','create','addQueues','join','root','server/files/images/','format','%s-%s','originalname','/:id/avatar','file','addAvatar','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addSquareProjects'];(function(_0x459b74,_0x5773bd){var _0x46cb16=function(_0x97867f){while(--_0x97867f){_0x459b74['push'](_0x459b74['shift']());}};_0x46cb16(++_0x5773bd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x525733,_0x24af7c){_0x525733=_0x525733-0x0;var _0x5a7982=_0x5f2f[_0x525733];return _0x5a7982;};'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('./user.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['whoami']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')]('/:id/avatar',controller['getAvatar']);router[_0xf5f2('0x8')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x8')](_0xf5f2('0x10'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x11')]);router[_0xf5f2('0x8')]('/:id/queues_rt',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x8')](_0xf5f2('0x13'),auth[_0xf5f2('0x9')](),controller['getGroups']);router[_0xf5f2('0x8')](_0xf5f2('0x14'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x15')]);router[_0xf5f2('0x8')](_0xf5f2('0x16'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x17')]);router[_0xf5f2('0x8')](_0xf5f2('0x18'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x19')]);router[_0xf5f2('0x8')](_0xf5f2('0x1a'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x1b')]);router[_0xf5f2('0x8')]('/:id/mail/interactions',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x1c')]);router['get']('/:id/sms/interactions',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x1d')]);router['get'](_0xf5f2('0x1e'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x1f')]);router[_0xf5f2('0x8')](_0xf5f2('0x20'),auth['isAuthenticated'](),controller[_0xf5f2('0x21')]);router[_0xf5f2('0x8')](_0xf5f2('0x22'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x23')]);router['get']('/:id/agents',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x24')]);router[_0xf5f2('0x8')](_0xf5f2('0x25'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x26')]);router[_0xf5f2('0x8')](_0xf5f2('0x27'),auth[_0xf5f2('0x9')](),controller['getFaxAccounts']);router[_0xf5f2('0x8')](_0xf5f2('0x28'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x29')]);router[_0xf5f2('0x8')](_0xf5f2('0x2a'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router[_0xf5f2('0x8')](_0xf5f2('0x2b'),auth[_0xf5f2('0x9')](),controller['getSmsAccounts']);router['get'](_0xf5f2('0x2c'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x2d')]);router[_0xf5f2('0x8')](_0xf5f2('0x2e'),auth['isAuthenticated'](),controller['getSquareProjects']);router[_0xf5f2('0x8')]('/:id/scheduled_calls',auth[_0xf5f2('0x9')](),controller['getScheduledCalls']);router[_0xf5f2('0x8')](_0xf5f2('0x2f'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x30')]);router[_0xf5f2('0x31')](_0xf5f2('0x32'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x33')]);router['post'](_0xf5f2('0xe'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x34')]);router[_0xf5f2('0x31')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x35')]);router[_0xf5f2('0x31')]('/:id/queues',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x36')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3fc168,_0x4b8c42,_0x18ae07){_0x18ae07(null,path[_0xf5f2('0x37')](config[_0xf5f2('0x38')],_0xf5f2('0x39')));},'filename':function(_0x59a6dd,_0x5a98d7,_0x41088b){_0x41088b(null,util[_0xf5f2('0x3a')](_0xf5f2('0x3b'),Date['now'](),_0x5a98d7[_0xf5f2('0x3c')]));}})});router['post'](_0xf5f2('0x3d'),upload['single'](_0xf5f2('0x3e')),controller[_0xf5f2('0x3f')]);router['post'](_0xf5f2('0x40'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x41')]);router[_0xf5f2('0x31')]('/:id/logout',auth['isAuthenticated'](),controller[_0xf5f2('0x42')]);router[_0xf5f2('0x31')](_0xf5f2('0x43'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x44')]);router[_0xf5f2('0x31')](_0xf5f2('0x45'),auth['isAuthenticated'](),controller[_0xf5f2('0x46')]);router[_0xf5f2('0x31')]('/:id/teams',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x47')]);router[_0xf5f2('0x31')](_0xf5f2('0x48'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x49')]);router[_0xf5f2('0x31')](_0xf5f2('0x4a'),auth['isAuthenticated'](),controller[_0xf5f2('0x4b')]);router[_0xf5f2('0x31')](_0xf5f2('0x4c'),auth['isAuthenticated'](),controller['addFaxInteractions']);router['post'](_0xf5f2('0x4d'),auth[_0xf5f2('0x9')](),controller['addSmsInteractions']);router[_0xf5f2('0x31')](_0xf5f2('0x4e'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x4f')]);router[_0xf5f2('0x31')](_0xf5f2('0x27'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x50')]);router[_0xf5f2('0x31')](_0xf5f2('0x28'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x51')]);router[_0xf5f2('0x31')](_0xf5f2('0x2a'),auth['isAuthenticated'](),controller[_0xf5f2('0x52')]);router['post'](_0xf5f2('0x2b'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x53')]);router[_0xf5f2('0x31')](_0xf5f2('0x2c'),auth[_0xf5f2('0x9')](),controller['addChatWebsites']);router[_0xf5f2('0x31')](_0xf5f2('0x2e'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x54')]);router[_0xf5f2('0x31')](_0xf5f2('0x2f'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x55')]);router['put'](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x56')]);router['put'](_0xf5f2('0x57'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x58')]);router['delete']('/:id/queues',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x59')]);router['delete'](_0xf5f2('0x20'),auth['isAuthenticated'](),controller[_0xf5f2('0x5a')]);router['delete'](_0xf5f2('0xd'),auth['isAuthenticated'](),controller[_0xf5f2('0x5b')]);router[_0xf5f2('0x5c')](_0xf5f2('0x48'),auth[_0xf5f2('0x9')](),controller['removeChatInteractions']);router[_0xf5f2('0x5c')](_0xf5f2('0x4a'),auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0xf5f2('0x5c')](_0xf5f2('0x4c'),auth['isAuthenticated'](),controller[_0xf5f2('0x5d')]);router[_0xf5f2('0x5c')](_0xf5f2('0x4d'),auth[_0xf5f2('0x9')](),controller['removeSmsInteractions']);router['delete'](_0xf5f2('0x4e'),auth[_0xf5f2('0x9')](),controller['removeOpenchannelInteractions']);router[_0xf5f2('0x5c')](_0xf5f2('0x27'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x5e')]);router[_0xf5f2('0x5c')](_0xf5f2('0x28'),auth[_0xf5f2('0x9')](),controller['removeMailAccounts']);router['delete'](_0xf5f2('0x2a'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x5f')]);router[_0xf5f2('0x5c')](_0xf5f2('0x2b'),auth['isAuthenticated'](),controller[_0xf5f2('0x60')]);router[_0xf5f2('0x5c')](_0xf5f2('0x2c'),auth['isAuthenticated'](),controller[_0xf5f2('0x61')]);router['delete'](_0xf5f2('0x2e'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x62')]);router[_0xf5f2('0x5c')]('/:id/api_key',auth['isAuthenticated'](),controller[_0xf5f2('0x63')]);module['exports']=router; \ No newline at end of file +var _0xc4aa=['put','update','changePassword','removeQueues','removeTeams','delete','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','./user.controller','get','isAuthenticated','index','/describe','describe','whoami','show','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','/:id/square_projects','getSquareProjects','getApiKey','post','/create_many','bulkCreate','addContacts','create','addQueues','root','server/files/images/','format','%s-%s','originalname','/:id/avatar','file','addAvatar','login','pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addSquareProjects','/:id/api_key'];(function(_0x520e16,_0x545cb6){var _0x4771b5=function(_0x5e3a50){while(--_0x5e3a50){_0x520e16['push'](_0x520e16['shift']());}};_0x4771b5(++_0x545cb6);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc4aa[_0xa148b7];return _0x51efd3;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xac4a('0x6'));router[_0xac4a('0x7')]('/',auth[_0xac4a('0x8')](),controller[_0xac4a('0x9')]);router[_0xac4a('0x7')](_0xac4a('0xa'),auth[_0xac4a('0x8')](),controller[_0xac4a('0xb')]);router['get']('/whoami',auth[_0xac4a('0x8')](),controller[_0xac4a('0xc')]);router[_0xac4a('0x7')]('/:id',auth[_0xac4a('0x8')](),controller[_0xac4a('0xd')]);router[_0xac4a('0x7')]('/:id/avatar',controller[_0xac4a('0xe')]);router['get'](_0xac4a('0xf'),auth['isAuthenticated'](),controller[_0xac4a('0x10')]);router[_0xac4a('0x7')](_0xac4a('0x11'),auth['isAuthenticated'](),controller[_0xac4a('0x12')]);router[_0xac4a('0x7')](_0xac4a('0x13'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x14')]);router[_0xac4a('0x7')](_0xac4a('0x15'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x16')]);router[_0xac4a('0x7')](_0xac4a('0x17'),auth[_0xac4a('0x8')](),controller['getRecordings']);router[_0xac4a('0x7')](_0xac4a('0x18'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x7')](_0xac4a('0x1a'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x1b')]);router['get']('/:id/openchannel/interactions',auth[_0xac4a('0x8')](),controller[_0xac4a('0x1c')]);router[_0xac4a('0x7')]('/:id/mail/interactions',auth[_0xac4a('0x8')](),controller[_0xac4a('0x1d')]);router[_0xac4a('0x7')](_0xac4a('0x1e'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x1f')]);router[_0xac4a('0x7')](_0xac4a('0x20'),auth['isAuthenticated'](),controller[_0xac4a('0x21')]);router[_0xac4a('0x7')]('/:id/teams',auth[_0xac4a('0x8')](),controller[_0xac4a('0x22')]);router[_0xac4a('0x7')](_0xac4a('0x23'),auth['isAuthenticated'](),controller[_0xac4a('0x24')]);router[_0xac4a('0x7')](_0xac4a('0x25'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x7')](_0xac4a('0x27'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x28')]);router[_0xac4a('0x7')](_0xac4a('0x29'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x2a')]);router[_0xac4a('0x7')](_0xac4a('0x2b'),auth[_0xac4a('0x8')](),controller['getMailAccounts']);router[_0xac4a('0x7')](_0xac4a('0x2c'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x2d')]);router[_0xac4a('0x7')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xac4a('0x2e')]);router[_0xac4a('0x7')](_0xac4a('0x2f'),auth['isAuthenticated'](),controller['getChatWebsites']);router[_0xac4a('0x7')](_0xac4a('0x30'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x31')]);router[_0xac4a('0x7')]('/:id/scheduled_calls',auth[_0xac4a('0x8')](),controller['getScheduledCalls']);router[_0xac4a('0x7')]('/:id/api_key',auth[_0xac4a('0x8')](),controller[_0xac4a('0x32')]);router[_0xac4a('0x33')](_0xac4a('0x34'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x35')]);router[_0xac4a('0x33')](_0xac4a('0xf'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x36')]);router[_0xac4a('0x33')]('/',auth[_0xac4a('0x8')](),controller[_0xac4a('0x37')]);router[_0xac4a('0x33')]('/:id/queues',auth[_0xac4a('0x8')](),controller[_0xac4a('0x38')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2a5419,_0x1af1c1,_0x565164){_0x565164(null,path['join'](config[_0xac4a('0x39')],_0xac4a('0x3a')));},'filename':function(_0x1b42b6,_0x3de9e2,_0x4f5986){_0x4f5986(null,util[_0xac4a('0x3b')](_0xac4a('0x3c'),Date['now'](),_0x3de9e2[_0xac4a('0x3d')]));}})});router[_0xac4a('0x33')](_0xac4a('0x3e'),upload['single'](_0xac4a('0x3f')),controller[_0xac4a('0x40')]);router[_0xac4a('0x33')]('/:id/login',auth[_0xac4a('0x8')](),controller[_0xac4a('0x41')]);router['post']('/:id/logout',auth[_0xac4a('0x8')](),controller['logout']);router['post']('/:id/pause',auth['isAuthenticated'](),controller[_0xac4a('0x42')]);router[_0xac4a('0x33')](_0xac4a('0x43'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x44')]);router[_0xac4a('0x33')](_0xac4a('0x45'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x46')]);router[_0xac4a('0x33')](_0xac4a('0x47'),auth[_0xac4a('0x8')](),controller['addChatInteractions']);router['post']('/:id/mail_interactions',auth[_0xac4a('0x8')](),controller[_0xac4a('0x48')]);router[_0xac4a('0x33')](_0xac4a('0x49'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x4a')]);router[_0xac4a('0x33')](_0xac4a('0x4b'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x4c')]);router['post'](_0xac4a('0x4d'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x4e')]);router[_0xac4a('0x33')](_0xac4a('0x29'),auth['isAuthenticated'](),controller[_0xac4a('0x4f')]);router[_0xac4a('0x33')]('/:id/mail_accounts',auth[_0xac4a('0x8')](),controller['addMailAccounts']);router[_0xac4a('0x33')](_0xac4a('0x2c'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x50')]);router[_0xac4a('0x33')](_0xac4a('0x51'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x52')]);router[_0xac4a('0x33')](_0xac4a('0x2f'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x53')]);router['post'](_0xac4a('0x30'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x54')]);router['post'](_0xac4a('0x55'),auth[_0xac4a('0x8')](),controller['createApiKey']);router[_0xac4a('0x56')]('/:id',auth[_0xac4a('0x8')](),controller[_0xac4a('0x57')]);router[_0xac4a('0x56')]('/:id/password',auth['isAuthenticated'](),controller[_0xac4a('0x58')]);router['delete'](_0xac4a('0x11'),auth['isAuthenticated'](),controller[_0xac4a('0x59')]);router['delete'](_0xac4a('0x45'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x5a')]);router[_0xac4a('0x5b')]('/:id',auth[_0xac4a('0x8')](),controller[_0xac4a('0x5c')]);router[_0xac4a('0x5b')](_0xac4a('0x47'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x5d')]);router[_0xac4a('0x5b')]('/:id/mail_interactions',auth[_0xac4a('0x8')](),controller[_0xac4a('0x5e')]);router['delete'](_0xac4a('0x49'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x5f')]);router[_0xac4a('0x5b')]('/:id/sms_interactions',auth[_0xac4a('0x8')](),controller[_0xac4a('0x60')]);router[_0xac4a('0x5b')](_0xac4a('0x4d'),auth[_0xac4a('0x8')](),controller['removeOpenchannelInteractions']);router[_0xac4a('0x5b')]('/:id/fax_accounts',auth[_0xac4a('0x8')](),controller[_0xac4a('0x61')]);router['delete']('/:id/mail_accounts',auth[_0xac4a('0x8')](),controller[_0xac4a('0x62')]);router['delete'](_0xac4a('0x2c'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x63')]);router[_0xac4a('0x5b')]('/:id/sms_accounts',auth[_0xac4a('0x8')](),controller[_0xac4a('0x64')]);router[_0xac4a('0x5b')](_0xac4a('0x2f'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x65')]);router[_0xac4a('0x5b')]('/:id/square_projects',auth[_0xac4a('0x8')](),controller[_0xac4a('0x66')]);router[_0xac4a('0x5b')](_0xac4a('0x55'),auth[_0xac4a('0x8')](),controller[_0xac4a('0x67')]);module[_0xac4a('0x68')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index c439f9c..816b1d6 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 _0xa9e0=['\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','passive','update,nonat','showWebBar','get','wss','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','encryption','icesupport','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','ENUM','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','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'];(function(_0xbd39e8,_0x52d8c4){var _0xf1170b=function(_0x5411be){while(--_0x5411be){_0xbd39e8['push'](_0xbd39e8['shift']());}};_0xf1170b(++_0x52d8c4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':_0x0a9e('0x14')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')]('friend',_0x0a9e('0xc'),_0x0a9e('0x16')),'allowNull':!![],'defaultValue':_0x0a9e('0x17')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x19'),_0x0a9e('0x1a'),'ALLOWED_FAILED_SCREEN',_0x0a9e('0x1b'),_0x0a9e('0x1c'),_0x0a9e('0x1d'),_0x0a9e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x2e8759){this[_0x0a9e('0x4')]('transport',_0x2e8759?_0x2e8759[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x23')},'dtmfmode':{'type':Sequelize['ENUM'](_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27'),_0x0a9e('0x28')),'allowNull':!![],'defaultValue':_0x0a9e('0x24')},'directmedia':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0xd1836d){this[_0x0a9e('0x4')](_0x0a9e('0x2c'),_0xd1836d?_0xd1836d['join'](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this['getDataValue'](_0x0a9e('0x2c'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x2d')},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':_0x0a9e('0x2e')},'allow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x546ef8){this[_0x0a9e('0x4')](_0x0a9e('0x2f'),_0x546ef8?_0x546ef8['join'](';'):_0x0a9e('0x30'));},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x2f'))?this[_0x0a9e('0x8')]('allow')['split'](';'):null;},'comment':_0x0a9e('0x31')},'autoframing':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x1dec2e){this[_0x0a9e('0x4')]('insecure',_0x1dec2e?_0x1dec2e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x32'))?this[_0x0a9e('0x8')](_0x0a9e('0x32'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x33')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no',_0x0a9e('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x35')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38'),_0x0a9e('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x3a'),'uas'),'allowNull':!![],'defaultValue':_0x0a9e('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no',_0x0a9e('0x3c'),_0x0a9e('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),_0x0a9e('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x0a9e('0x13')]},'showWebBar':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0,'set':function(_0x5d86e9){this[_0x0a9e('0x4')](_0x0a9e('0x40'),_0x5d86e9);var _0x5239ef=this[_0x0a9e('0x41')]({'plain':!![]});switch(_0x5d86e9){case 0x0:case 0x1:var _0x5cc8fb=_0x5239ef[_0x0a9e('0x21')]?_['isArray'](_0x5239ef['transport'])?_0x5239ef['transport'][_0x0a9e('0x20')]():_0x5239ef['transport']:_0x0a9e('0x1f');if(_0x5cc8fb===_0x0a9e('0x42')){_0x5cc8fb=_0x0a9e('0x1f');}this[_0x0a9e('0x4')](_0x0a9e('0x21'),_0x5cc8fb);this[_0x0a9e('0x4')]('encryption','no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('icesupport',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this['setDataValue'](_0x0a9e('0x46'),null);this[_0x0a9e('0x4')]('dtlscertfile',null);this[_0x0a9e('0x4')](_0x0a9e('0x47'),null);this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x42'));this[_0x0a9e('0x4')](_0x0a9e('0x49'),'yes');this[_0x0a9e('0x4')]('avpf','yes');this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x4a'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x45'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x4b'));this[_0x0a9e('0x4')](_0x0a9e('0x4c'),_0x5239ef[_0x0a9e('0x4c')]||_0x0a9e('0x4d'));this['setDataValue'](_0x0a9e('0x47'),_0x5239ef[_0x0a9e('0x47')]||_0x0a9e('0x4e'));this['setDataValue'](_0x0a9e('0x48'),_0x0a9e('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x83f0b2){this[_0x0a9e('0x4')](_0x0a9e('0x4f'),_0x83f0b2?_0x83f0b2[_0x0a9e('0x20')](','):[]);},'get':function(){return this[_0x0a9e('0x8')]('permissions')?_['map'](this['getDataValue'](_0x0a9e('0x4f'))[_0x0a9e('0x22')](','),function(_0x1104ad){return parseInt(_0x1104ad,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x0a9e('0x3')]},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x50'))?this[_0x0a9e('0x8')](_0x0a9e('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x30a4c7){if(typeof _0x30a4c7===_0x0a9e('0x51')){var _0x332367=_0x30a4c7==='1'?!![]:_0x30a4c7==='0'?![]:_0x30a4c7===_0x0a9e('0x52')?!![]:_0x30a4c7===_0x0a9e('0x53')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x332367);}else{this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x30a4c7);}}},'blocked':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x25744a){this[_0x0a9e('0x4')]('blocked',_0x25744a);if(_0x25744a===!![]){this[_0x0a9e('0x4')](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')]('loginAttempts',0x0);}else{this[_0x0a9e('0x4')](_0x0a9e('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa9e0=['\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','passive','update,nonat','showWebBar','get','wss','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','encryption','icesupport','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','ENUM','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','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'];(function(_0x3e568e,_0x14c979){var _0x4de323=function(_0x2eaa2a){while(--_0x2eaa2a){_0x3e568e['push'](_0x3e568e['shift']());}};_0x4de323(++_0x14c979);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':_0x0a9e('0x14')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')]('friend',_0x0a9e('0xc'),_0x0a9e('0x16')),'allowNull':!![],'defaultValue':_0x0a9e('0x17')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x19'),_0x0a9e('0x1a'),'ALLOWED_FAILED_SCREEN',_0x0a9e('0x1b'),_0x0a9e('0x1c'),_0x0a9e('0x1d'),_0x0a9e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x2e8759){this[_0x0a9e('0x4')]('transport',_0x2e8759?_0x2e8759[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x23')},'dtmfmode':{'type':Sequelize['ENUM'](_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27'),_0x0a9e('0x28')),'allowNull':!![],'defaultValue':_0x0a9e('0x24')},'directmedia':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0xd1836d){this[_0x0a9e('0x4')](_0x0a9e('0x2c'),_0xd1836d?_0xd1836d['join'](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this['getDataValue'](_0x0a9e('0x2c'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x2d')},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':_0x0a9e('0x2e')},'allow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x546ef8){this[_0x0a9e('0x4')](_0x0a9e('0x2f'),_0x546ef8?_0x546ef8['join'](';'):_0x0a9e('0x30'));},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x2f'))?this[_0x0a9e('0x8')]('allow')['split'](';'):null;},'comment':_0x0a9e('0x31')},'autoframing':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x1dec2e){this[_0x0a9e('0x4')]('insecure',_0x1dec2e?_0x1dec2e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x32'))?this[_0x0a9e('0x8')](_0x0a9e('0x32'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x33')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no',_0x0a9e('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x35')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38'),_0x0a9e('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x3a'),'uas'),'allowNull':!![],'defaultValue':_0x0a9e('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no',_0x0a9e('0x3c'),_0x0a9e('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),_0x0a9e('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x0a9e('0x13')]},'showWebBar':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0,'set':function(_0x5d86e9){this[_0x0a9e('0x4')](_0x0a9e('0x40'),_0x5d86e9);var _0x5239ef=this[_0x0a9e('0x41')]({'plain':!![]});switch(_0x5d86e9){case 0x0:case 0x1:var _0x5cc8fb=_0x5239ef[_0x0a9e('0x21')]?_['isArray'](_0x5239ef['transport'])?_0x5239ef['transport'][_0x0a9e('0x20')]():_0x5239ef['transport']:_0x0a9e('0x1f');if(_0x5cc8fb===_0x0a9e('0x42')){_0x5cc8fb=_0x0a9e('0x1f');}this[_0x0a9e('0x4')](_0x0a9e('0x21'),_0x5cc8fb);this[_0x0a9e('0x4')]('encryption','no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('icesupport',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this['setDataValue'](_0x0a9e('0x46'),null);this[_0x0a9e('0x4')]('dtlscertfile',null);this[_0x0a9e('0x4')](_0x0a9e('0x47'),null);this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x42'));this[_0x0a9e('0x4')](_0x0a9e('0x49'),'yes');this[_0x0a9e('0x4')]('avpf','yes');this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x4a'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x45'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x4b'));this[_0x0a9e('0x4')](_0x0a9e('0x4c'),_0x5239ef[_0x0a9e('0x4c')]||_0x0a9e('0x4d'));this['setDataValue'](_0x0a9e('0x47'),_0x5239ef[_0x0a9e('0x47')]||_0x0a9e('0x4e'));this['setDataValue'](_0x0a9e('0x48'),_0x0a9e('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x83f0b2){this[_0x0a9e('0x4')](_0x0a9e('0x4f'),_0x83f0b2?_0x83f0b2[_0x0a9e('0x20')](','):[]);},'get':function(){return this[_0x0a9e('0x8')]('permissions')?_['map'](this['getDataValue'](_0x0a9e('0x4f'))[_0x0a9e('0x22')](','),function(_0x1104ad){return parseInt(_0x1104ad,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x0a9e('0x3')]},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x50'))?this[_0x0a9e('0x8')](_0x0a9e('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x30a4c7){if(typeof _0x30a4c7===_0x0a9e('0x51')){var _0x332367=_0x30a4c7==='1'?!![]:_0x30a4c7==='0'?![]:_0x30a4c7===_0x0a9e('0x52')?!![]:_0x30a4c7===_0x0a9e('0x53')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x332367);}else{this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x30a4c7);}}},'blocked':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x25744a){this[_0x0a9e('0x4')]('blocked',_0x25744a);if(_0x25744a===!![]){this[_0x0a9e('0x4')](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')]('loginAttempts',0x0);}else{this[_0x0a9e('0x4')](_0x0a9e('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'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 6ea6cc8..3ef3149 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 _0xbe51=['socket','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','MemberReport','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','device','PAUSE','LOGININPAUSE','isMiddleware','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','openchannelPause','smsPause','pauseType','lastPauseAt','QueuePause','manual','mail','sms','openchannel','%s%s','all','getTeams','addTeams','Team','setDataValue','Voice','getChatQueues','Chat','getSmsQueues','getFaxQueues','getOpenchannelQueues','Openchannel','transaction','addAgent','getDataValue','removeTeams','getVoiceQueues','getMailQueues','Mail','Sms','Fax','flatten','removeAgent','getLists','addChatInteractions','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getSquareProjects','addSquareProjects','removeSquareProjects','concat','$and','$or','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notLike','$iLike','$notILike','$overlap','$contained','CmHopper','firstName','lastName','CmContact','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','iat','nonce','apiKeyNonce','API\x20key\x20not\x20available','whoami','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','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~!@#$%^&-_=+[{]}.','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','Users','Agents','Telephones','telephone','filter','map','value','includes','role','find','stack','name','send','User','rawAttributes','fieldName','type','key','differenceBy','password','salt','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','sequelize','col','options','includeAll','include','findAll','rows','show','params','length','bulkCreate','body','describe','addContacts','omit','ids','agent','agent\x20role','admin','../../config/license/util','getLicense','telephones','users','isNil','License\x20limit\x20reached','format','internal','Setting','findById','securePassword','min_internal','max','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','mailbox','VoiceMail','fullname','email','permissions','101','102','103','104','105','106','107','108','111','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','oldPassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','toLowerCase','Queues','penalty','spread','QueueId','emit','capitalize','Queue:save','voice','push','SIP/%s','each','UserVoiceQueueRt','upsert','Unknown\x20channel','remove','Queue:remove','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getContacts','order','pick','CmList','Tags','color','tag','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','login','phone','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','remoteAddress'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xbe51,0x1e2));var _0x1be5=function(_0x19f008,_0xbec22b){_0x19f008=_0x19f008-0x0;var _0xaa946b=_0xbe51[_0x19f008];return _0xaa946b;};'use strict';var pdf=require(_0x1be5('0x0'));var emlformat=require(_0x1be5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1be5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1be5('0x3'));var moment=require(_0x1be5('0x4'));var BPromise=require(_0x1be5('0x5'));var Mustache=require(_0x1be5('0x6'));var util=require(_0x1be5('0x7'));var path=require(_0x1be5('0x8'));var sox=require(_0x1be5('0x9'));var csv=require(_0x1be5('0xa'));var ejs=require(_0x1be5('0xb'));var fs=require('fs');var _=require(_0x1be5('0xc'));var squel=require(_0x1be5('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1be5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1be5('0xf'));var Papa=require(_0x1be5('0x10'));var Redis=require('ioredis');var authService=require(_0x1be5('0x11'));var qs=require(_0x1be5('0x12'));var as=require(_0x1be5('0x13'));var hardwareService=require(_0x1be5('0x14'));var logger=require(_0x1be5('0x15'))(_0x1be5('0x16'));var utils=require(_0x1be5('0x17'));var config=require('../../config/environment');var db=require(_0x1be5('0x18'))['db'];config['redis']=_[_0x1be5('0x19')](config[_0x1be5('0x1a')],{'host':_0x1be5('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1be5('0x1a')]));require('./user.socket')[_0x1be5('0x1c')](socket);var jayson=require(_0x1be5('0x1d'));var client=jayson[_0x1be5('0x1e')][_0x1be5('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x1b4d73,_0x3f09dd,_0x1c2523){if(_0x1c2523){var _0x5db6ba=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5db6ba[_0x1be5('0x20')](_0x3f09dd)){return _0x1b4d73;}else{throw new db[(_0x1be5('0x21'))][(_0x1be5('0x22'))](_0x1be5('0x23'));}}else{return _0x1b4d73;}}function respondWithRpcPromise(_0x968179,_0x292659,_0x497320,_0x3a1fe3){return new BPromise(function(_0x4e777a,_0x3020fc){var _0x33cf5d=_0x3a1fe3||client;return _0x33cf5d['request'](_0x968179,_0x497320)['then'](function(_0x5b776c){logger[_0x1be5('0x24')](_0x1be5('0x25'),_0x292659,_0x1be5('0x26'));logger[_0x1be5('0x27')](_0x1be5('0x28'),_0x292659,'request\x20sent',JSON[_0x1be5('0x29')](_0x5b776c));if(_0x5b776c['error']){if(_0x5b776c['error'][_0x1be5('0x2a')]===0x1f4){logger[_0x1be5('0x2b')](_0x1be5('0x25'),_0x292659,_0x5b776c[_0x1be5('0x2b')][_0x1be5('0x2c')]);return _0x3020fc(_0x5b776c[_0x1be5('0x2b')][_0x1be5('0x2c')]);}logger[_0x1be5('0x2b')]('User,\x20%s,\x20%s',_0x292659,_0x5b776c[_0x1be5('0x2b')][_0x1be5('0x2c')]);return _0x4e777a(_0x5b776c[_0x1be5('0x2b')][_0x1be5('0x2c')]);}else{logger[_0x1be5('0x24')](_0x1be5('0x25'),_0x292659,_0x1be5('0x26'));_0x4e777a(_0x5b776c[_0x1be5('0x2d')]['message']);}})[_0x1be5('0x2e')](function(_0x5577f8){logger[_0x1be5('0x2b')](_0x1be5('0x25'),_0x292659,_0x5577f8);_0x3020fc(_0x5577f8);});});}function respondWithStatusCode(_0x236d7c,_0x2d5498){_0x2d5498=_0x2d5498||0xcc;return function(_0x59beb3){if(_0x59beb3){return _0x236d7c[_0x1be5('0x2f')](_0x2d5498);}return _0x236d7c[_0x1be5('0x30')](_0x2d5498)[_0x1be5('0x31')]();};}function respondWithResult(_0x1de91f,_0x1ddf40){_0x1ddf40=_0x1ddf40||0xc8;return function(_0x56d946){if(_0x56d946){return _0x1de91f[_0x1be5('0x30')](_0x1ddf40)[_0x1be5('0x32')](_0x56d946);}};}function respondWithFilteredResult(_0x407a48,_0x1ec64b){return function(_0x2833ba){if(_0x2833ba){var _0x5cd51b=_0x2833ba[_0x1be5('0x33')],_0x35a336=_0x1ec64b['offset'],_0x303f6f=_0x1ec64b[_0x1be5('0x34')]+_0x1ec64b[_0x1be5('0x35')],_0x9fbfa9;if(_0x303f6f>=_0x5cd51b){_0x303f6f=_0x5cd51b;_0x9fbfa9=0xc8;}else{_0x9fbfa9=0xce;}_0x407a48['status'](_0x9fbfa9);return _0x407a48[_0x1be5('0x36')](_0x1be5('0x37'),_0x35a336+'-'+_0x303f6f+'/'+_0x5cd51b)['json'](_0x2833ba);}return null;};}function patchUpdates(_0x5bd223){return function(_0xa84d12){try{jsonpatch[_0x1be5('0x38')](_0xa84d12,_0x5bd223,!![]);}catch(_0x2473e3){return BPromise[_0x1be5('0x39')](_0x2473e3);}return _0xa84d12['save']();};}function saveUpdates(_0x1ecf5b,_0x19d32c){return function(_0x3ba8ec){if(_0x3ba8ec){return _0x3ba8ec[_0x1be5('0x3a')](_0x1ecf5b)[_0x1be5('0x3b')](function(_0x5b5f17){return _0x5b5f17;});}return null;};}function removeEntity(_0x126e94,_0x371b87){return function(_0x506e2f){if(_0x506e2f){return _0x506e2f[_0x1be5('0x3c')]()['then'](function(){var _0x4d5e55=_0x506e2f[_0x1be5('0x3d')]({'plain':!![]});var _0x17eb83=[{'name':_0x1be5('0x3e'),'value':'user','ignore':!![]},{'name':_0x1be5('0x3f'),'value':'agent','ignore':![]},{'name':_0x1be5('0x40'),'value':_0x1be5('0x41'),'ignore':![]}];var _0x10a78b=_(_0x17eb83)[_0x1be5('0x42')]('ignore')[_0x1be5('0x43')](_0x1be5('0x44'))[_0x1be5('0x44')]();if(_[_0x1be5('0x45')](_0x10a78b,_0x4d5e55[_0x1be5('0x46')])){return;}var _0x10eb63=_[_0x1be5('0x47')](_0x17eb83,[_0x1be5('0x44'),_0x4d5e55[_0x1be5('0x46')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x10eb63,'resourceId':_0x4d5e55['id']}})[_0x1be5('0x3b')](function(){return _0x506e2f;});})[_0x1be5('0x3b')](function(){_0x126e94[_0x1be5('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33e272,_0x5c373c){return function(_0x2c0d5d){if(!_0x2c0d5d){_0x33e272[_0x1be5('0x2f')](0x194);}return _0x2c0d5d;};}function handleError(_0xf5b7e4,_0x20496d){_0x20496d=_0x20496d||0x1f4;return function(_0x978767){logger[_0x1be5('0x2b')](_0x978767[_0x1be5('0x48')]);if(_0x978767[_0x1be5('0x49')]){delete _0x978767[_0x1be5('0x49')];}_0xf5b7e4['status'](_0x20496d)[_0x1be5('0x4a')](_0x978767);};}exports['index']=function(_0x168bda,_0x338359){var _0x29bb39={},_0x3fd64c={},_0x439f63={'count':0x0,'rows':[]};var _0x272c98=_['map'](db[_0x1be5('0x4b')][_0x1be5('0x4c')],function(_0x26dd0f){return{'name':_0x26dd0f[_0x1be5('0x4d')],'type':_0x26dd0f[_0x1be5('0x4e')][_0x1be5('0x4f')]};});_0x3fd64c['model']=_[_0x1be5('0x50')](_[_0x1be5('0x43')](_0x272c98,'name'),[_0x1be5('0x51'),_0x1be5('0x52')]);_0x3fd64c[_0x1be5('0x53')]=_[_0x1be5('0x54')](_0x168bda[_0x1be5('0x53')]);_0x3fd64c[_0x1be5('0x55')]=_[_0x1be5('0x56')](_0x3fd64c[_0x1be5('0x57')],_0x3fd64c[_0x1be5('0x53')]);_0x29bb39[_0x1be5('0x58')]=_['intersection'](_0x3fd64c['model'],qs['fields'](_0x168bda[_0x1be5('0x53')][_0x1be5('0x59')]));_0x29bb39[_0x1be5('0x58')]=_0x29bb39[_0x1be5('0x58')]['length']?_0x29bb39[_0x1be5('0x58')]:_0x3fd64c['model'];if(!_0x168bda[_0x1be5('0x53')][_0x1be5('0x5a')](_0x1be5('0x5b'))){_0x29bb39['limit']=qs['limit'](_0x168bda[_0x1be5('0x53')]['limit']);_0x29bb39[_0x1be5('0x34')]=qs[_0x1be5('0x34')](_0x168bda[_0x1be5('0x53')][_0x1be5('0x34')]);}_0x29bb39['order']=qs['sort'](_0x168bda['query'][_0x1be5('0x5c')]);_0x29bb39['where']=qs[_0x1be5('0x55')](_['pick'](_0x168bda[_0x1be5('0x53')],_0x3fd64c['filters']));if(_0x168bda['query']['filter']){_0x29bb39[_0x1be5('0x5d')]=_[_0x1be5('0x5e')](_0x29bb39[_0x1be5('0x5d')],{'$or':_['map'](_0x272c98,function(_0x1e7a12){if(_0x1e7a12['type']!==_0x1be5('0x5f')){return db['sequelize'][_0x1be5('0x5d')](db[_0x1be5('0x60')]['fn']('lower',db[_0x1be5('0x60')][_0x1be5('0x61')](_0x1e7a12[_0x1be5('0x49')])),{'$like':db[_0x1be5('0x60')]['fn']('lower','%'+_0x168bda['query'][_0x1be5('0x42')]+'%')});}})});}_0x29bb39=_[_0x1be5('0x5e')]({},_0x29bb39,_0x168bda[_0x1be5('0x62')]);var _0x3a83c3={'where':_0x29bb39[_0x1be5('0x5d')]};return db[_0x1be5('0x4b')][_0x1be5('0x33')](_0x3a83c3)[_0x1be5('0x3b')](function(_0x5e89f2){_0x439f63[_0x1be5('0x33')]=_0x5e89f2;if(_0x168bda[_0x1be5('0x53')][_0x1be5('0x63')]){_0x29bb39[_0x1be5('0x64')]=[{'all':!![]}];}return db[_0x1be5('0x4b')][_0x1be5('0x65')](_0x29bb39);})[_0x1be5('0x3b')](function(_0x509aec){_0x439f63[_0x1be5('0x66')]=_0x509aec;return _0x439f63;})[_0x1be5('0x3b')](respondWithFilteredResult(_0x338359,_0x29bb39))[_0x1be5('0x2e')](handleError(_0x338359,null));};exports[_0x1be5('0x67')]=function(_0x4770de,_0x2ca519){var _0x5eef0d={'raw':![],'where':{'id':_0x4770de[_0x1be5('0x68')]['id']}},_0x4231c5={};_0x4231c5[_0x1be5('0x57')]=_['differenceBy'](_[_0x1be5('0x54')](db[_0x1be5('0x4b')][_0x1be5('0x4c')]),[_0x1be5('0x51'),'salt']);_0x4231c5[_0x1be5('0x53')]=_[_0x1be5('0x54')](_0x4770de[_0x1be5('0x53')]);_0x4231c5['filters']=_['intersection'](_0x4231c5['model'],_0x4231c5[_0x1be5('0x53')]);_0x5eef0d[_0x1be5('0x58')]=_[_0x1be5('0x56')](_0x4231c5[_0x1be5('0x57')],qs[_0x1be5('0x59')](_0x4770de[_0x1be5('0x53')]['fields']));_0x5eef0d[_0x1be5('0x58')]=_0x5eef0d[_0x1be5('0x58')][_0x1be5('0x69')]?_0x5eef0d[_0x1be5('0x58')]:_0x4231c5['model'];if(_0x4770de['query'][_0x1be5('0x63')]){_0x5eef0d[_0x1be5('0x64')]=[{'all':!![]}];}_0x5eef0d=_[_0x1be5('0x5e')]({},_0x5eef0d,_0x4770de['options']);return db[_0x1be5('0x4b')]['find'](_0x5eef0d)['then'](handleEntityNotFound(_0x2ca519,null))[_0x1be5('0x3b')](respondWithResult(_0x2ca519,null))[_0x1be5('0x2e')](handleError(_0x2ca519,null));};exports[_0x1be5('0x6a')]=function(_0x495935,_0x3f1ca4){return db[_0x1be5('0x4b')][_0x1be5('0x6a')](_0x495935[_0x1be5('0x6b')],{'raw':![],'individualHooks':!![]})[_0x1be5('0x3b')](respondWithResult(_0x3f1ca4,0xc9))[_0x1be5('0x2e')](handleError(_0x3f1ca4,null));};exports['update']=function(_0x587de8,_0x54410b){if(_0x587de8['body']['id']){delete _0x587de8[_0x1be5('0x6b')]['id'];}delete _0x587de8[_0x1be5('0x6b')][_0x1be5('0x46')];return db['User'][_0x1be5('0x47')]({'where':{'id':_0x587de8['params']['id']}})[_0x1be5('0x3b')](handleEntityNotFound(_0x54410b,null))[_0x1be5('0x3b')](saveUpdates(_0x587de8['body'],null))['then'](respondWithResult(_0x54410b,null))[_0x1be5('0x2e')](handleError(_0x54410b,null));};exports[_0x1be5('0x6c')]=function(_0x41ffa0,_0x17d8c6){return db[_0x1be5('0x4b')]['describe']()['then'](respondWithResult(_0x17d8c6,null))[_0x1be5('0x2e')](handleError(_0x17d8c6,null));};exports[_0x1be5('0x6d')]=function(_0x626393,_0xc80d90,_0x84b69d){return db['User']['find']({'where':{'id':_0x626393[_0x1be5('0x68')]['id']}})[_0x1be5('0x3b')](handleEntityNotFound(_0xc80d90,null))['then'](function(_0xd8cb9e){if(_0xd8cb9e){return _0xd8cb9e[_0x1be5('0x6d')](_0x626393['body']['ids'],_[_0x1be5('0x6e')](_0x626393[_0x1be5('0x6b')],[_0x1be5('0x6f'),'id'])||{});}})[_0x1be5('0x3b')](respondWithResult(_0xc80d90,null))['catch'](handleError(_0xc80d90,null));};var getLicense=function(_0x42fc20){return new BPromise(function(_0x46f339,_0x165709){var _0x165184=0x0;_0x42fc20['body'][_0x1be5('0x46')]===_0x1be5('0x70')&&_0x46f339(_0x1be5('0x71'));return db[_0x1be5('0x4b')]['count']({'where':{'$or':[{'role':_0x42fc20[_0x1be5('0x6b')][_0x1be5('0x46')]==='telephone'?_0x1be5('0x41'):[_0x1be5('0x72'),'user']}]}})[_0x1be5('0x3b')](function(_0x372cff){_0x165184=_0x372cff;return require(_0x1be5('0x73'))[_0x1be5('0x74')]();})[_0x1be5('0x3b')](function(_0x52fa90){var _0x143a6f=_0x42fc20[_0x1be5('0x6b')][_0x1be5('0x46')]==='telephone'?_0x1be5('0x75'):_0x1be5('0x76');if(!_[_0x1be5('0x77')](_0x52fa90[_0x143a6f])&&_0x165184>=_0x52fa90[_0x143a6f]){return _0x165709({'message':_0x1be5('0x78')});}return _0x46f339(util[_0x1be5('0x79')]('count\x20%s:\x20%s',_0x143a6f,_0x165184));})['catch'](function(_0x7d1a43){return _0x165709(_0x7d1a43);});});};exports['create']=function(_0x15b330,_0x554f8a){return getLicense(_0x15b330)[_0x1be5('0x3b')](function(_0x527564){if(!_0x15b330[_0x1be5('0x6b')][_0x1be5('0x7a')]){var _0x49bdb0;return db[_0x1be5('0x7b')][_0x1be5('0x7c')](0x1)[_0x1be5('0x3b')](function(_0x19bc1c){return checkPasswordPattern(_0x19bc1c,_0x15b330[_0x1be5('0x6b')][_0x1be5('0x51')],_0x19bc1c[_0x1be5('0x7d')]);})[_0x1be5('0x3b')](function(_0x2158ac){_0x49bdb0=_0x2158ac[_0x1be5('0x7e')];return db[_0x1be5('0x4b')][_0x1be5('0x7f')](_0x1be5('0x7a'));})['then'](function(_0x102a5e){if(_[_0x1be5('0x77')](_0x102a5e)){if(_0x49bdb0){_0x15b330[_0x1be5('0x6b')][_0x1be5('0x7a')]=_0x49bdb0;}else{_0x15b330[_0x1be5('0x6b')]['internal']=0x1;}}else{if(_[_0x1be5('0x77')](_0x49bdb0)||_0x49bdb0==_0x102a5e){_0x15b330[_0x1be5('0x6b')]['internal']=_0x102a5e+0x1;}else if(_0x49bdb0>_0x102a5e){_0x15b330['body'][_0x1be5('0x7a')]=_0x49bdb0;}else{return db['sequelize'][_0x1be5('0x53')](_0x1be5('0x80'),{'type':db[_0x1be5('0x60')][_0x1be5('0x81')][_0x1be5('0x82')]})[_0x1be5('0x3b')](function(_0x46773b){if(_0x46773b&&_0x46773b['length']){for(var _0x5da6d9=0x0,_0xd57951=_0x46773b[_0x1be5('0x69')];_0x5da6d9<_0xd57951&&_['isNil'](_0x15b330['body'][_0x1be5('0x7a')]);_0x5da6d9++){if(_0x49bdb0<=_0x46773b[_0x5da6d9][_0x1be5('0x83')]){_0x15b330['body'][_0x1be5('0x7a')]=_0x46773b[_0x5da6d9]['from'];}else if(_0x49bdb0>_0x46773b[_0x5da6d9][_0x1be5('0x83')]&&_0x49bdb0<=_0x46773b[_0x5da6d9]['to']){_0x15b330[_0x1be5('0x6b')][_0x1be5('0x7a')]=_0x49bdb0;}}}if(_[_0x1be5('0x77')](_0x15b330[_0x1be5('0x6b')]['internal'])){_0x15b330[_0x1be5('0x6b')][_0x1be5('0x7a')]=_0x102a5e+0x1;}});}}});}})[_0x1be5('0x3b')](function(){if(_0x15b330[_0x1be5('0x6b')]['voicemail']){_0x15b330[_0x1be5('0x6b')][_0x1be5('0x84')]=_0x15b330[_0x1be5('0x6b')][_0x1be5('0x7a')];_0x15b330[_0x1be5('0x6b')][_0x1be5('0x85')]={'mailbox':_0x15b330[_0x1be5('0x6b')][_0x1be5('0x7a')],'password':_0x15b330[_0x1be5('0x6b')]['password'],'fullname':_0x15b330[_0x1be5('0x6b')][_0x1be5('0x86')],'email':_0x15b330[_0x1be5('0x6b')][_0x1be5('0x87')]};}if(_0x15b330['body']&&_0x15b330[_0x1be5('0x6b')]['role']===_0x1be5('0x70')){_0x15b330['body'][_0x1be5('0x88')]=[_0x1be5('0x89'),_0x1be5('0x8a'),_0x1be5('0x8b'),'110',_0x1be5('0x8c'),_0x1be5('0x8d'),_0x1be5('0x8e'),_0x1be5('0x8f'),_0x1be5('0x90'),'109','100',_0x1be5('0x91')];}return db[_0x1be5('0x4b')][_0x1be5('0x92')](_0x15b330[_0x1be5('0x6b')],{'include':[{'model':db[_0x1be5('0x85')],'as':_0x1be5('0x85')}]});})[_0x1be5('0x3b')](function(_0x8aa76b){if(_0x15b330['body'][_0x1be5('0x46')]===_0x1be5('0x93'))return _0x8aa76b;var _0x1a3179=_0x15b330[_0x1be5('0x93')][_0x1be5('0x3d')]({'plain':!![]});if(!_0x1a3179)throw new Error(_0x1be5('0x94'));if(_0x1a3179['role']==='user'){var _0x31eaa4=_0x8aa76b[_0x1be5('0x3d')]({'plain':!![]});var _0x3dfc27=[{'name':_0x1be5('0x3f'),'value':_0x1be5('0x70')},{'name':_0x1be5('0x40'),'value':'telephone'}];var _0x11ddb2=_[_0x1be5('0x47')](_0x3dfc27,['value',_0x31eaa4[_0x1be5('0x46')]])[_0x1be5('0x49')];return db[_0x1be5('0x95')][_0x1be5('0x47')]({'where':{'name':_0x11ddb2,'userProfileId':_0x1a3179['userProfileId']},'raw':!![]})[_0x1be5('0x3b')](function(_0x4e6adc){if(_0x4e6adc&&_0x4e6adc[_0x1be5('0x96')]===0x0){return db[_0x1be5('0x97')][_0x1be5('0x92')]({'name':_0x31eaa4[_0x1be5('0x49')],'resourceId':_0x31eaa4['id'],'type':_0x4e6adc[_0x1be5('0x49')],'sectionId':_0x4e6adc['id']},{})[_0x1be5('0x3b')](function(){return _0x8aa76b;});}else{return _0x8aa76b;}})[_0x1be5('0x2e')](function(_0x4162dd){logger[_0x1be5('0x2b')](_0x1be5('0x98'),_0x4162dd);throw _0x4162dd;});}return _0x8aa76b;})[_0x1be5('0x3b')](respondWithResult(_0x554f8a,0xc9))[_0x1be5('0x2e')](handleError(_0x554f8a,null));};exports['changePassword']=function(_0x24fc10,_0x2a943,_0x37d089){var _0x534afb=![];if(_0x24fc10['body']['id']){delete _0x24fc10[_0x1be5('0x6b')]['id'];}return db[_0x1be5('0x7b')][_0x1be5('0x99')]({'attributes':['id','securePassword']})[_0x1be5('0x3b')](function(_0x285176){_0x534afb=_0x285176['securePassword'];return db[_0x1be5('0x4b')][_0x1be5('0x47')]({'where':{'id':_0x24fc10[_0x1be5('0x68')]['id']}});})[_0x1be5('0x3b')](function(_0x2ece75){if(_0x2ece75){if(_0x2ece75['id']==_0x24fc10['user']['id']){if(!_0x24fc10[_0x1be5('0x6b')][_0x1be5('0x9a')]||!_0x24fc10['body'][_0x1be5('0x9b')]){throw new db['Sequelize'][(_0x1be5('0x22'))](_0x1be5('0x9c'));}if(!_0x2ece75['authenticate'](_0x24fc10[_0x1be5('0x6b')]['oldPassword'])){throw new db[(_0x1be5('0x21'))][(_0x1be5('0x22'))](_0x1be5('0x9d'));}if(_0x24fc10[_0x1be5('0x6b')][_0x1be5('0x9a')]==_0x24fc10[_0x1be5('0x6b')][_0x1be5('0x9b')]){throw new db[(_0x1be5('0x21'))][(_0x1be5('0x22'))](_0x1be5('0x9e'));}return _0x2ece75;}else if(_0x24fc10[_0x1be5('0x93')]['role']=='admin'){if(!_0x24fc10[_0x1be5('0x6b')][_0x1be5('0x9b')]){throw new db[(_0x1be5('0x21'))]['ValidationError'](_0x1be5('0x9f'));}return _0x2ece75;}else if(_0x24fc10['user'][_0x1be5('0x46')]==_0x1be5('0x93')){if(!_0x24fc10[_0x1be5('0x6b')][_0x1be5('0x9b')]){throw new db[(_0x1be5('0x21'))]['ValidationError'](_0x1be5('0x9f'));}if(_0x2ece75[_0x1be5('0x46')]!=_0x1be5('0x70')){throw new db['Sequelize']['ValidationError']('Unauthorized');}return _0x2ece75;}else{throw new db['Sequelize'][(_0x1be5('0x22'))](_0x1be5('0xa0'));}}return null;})[_0x1be5('0x3b')](handleEntityNotFound(_0x2a943,null))[_0x1be5('0x3b')](function(_0x3d2359){return checkPasswordPattern(_0x3d2359,_0x24fc10['body'][_0x1be5('0x9b')],_0x534afb);})[_0x1be5('0x3b')](saveUpdates({'password':_0x24fc10[_0x1be5('0x6b')]['newPassword'],'passwordResetAt':_0x24fc10['user']['id']==_0x24fc10[_0x1be5('0x68')]['id']?moment():null},null))['then'](respondWithResult(_0x2a943,null))[_0x1be5('0x2e')](handleError(_0x2a943,null));};exports[_0x1be5('0xa1')]=function(_0x1447d8,_0x410d00,_0x299996){var _0x97ca7c=_0x1447d8[_0x1be5('0x6b')][_0x1be5('0xa2')];return db[_0x1be5('0x4b')][_0x1be5('0x47')]({'where':{'id':_0x1447d8[_0x1be5('0x68')]['id']},'attributes':['id',_0x1be5('0x49'),_0x1be5('0x46'),_0x1be5('0xa3'),_0x1be5('0xa4'),_0x1be5('0xa5'),_0x1be5('0xa6')]})[_0x1be5('0x3b')](handleEntityNotFound(_0x410d00,null))['then'](function(_0x123724){if(_0x123724){if(!utils[_0x1be5('0xa7')](_0x97ca7c)){throw new db[(_0x1be5('0x21'))][(_0x1be5('0x22'))]('Unknown\x20channel');}return _0x123724['add'+_['capitalize'](_0x97ca7c[_0x1be5('0xa8')]())+_0x1be5('0xa9')](_0x1447d8['body'][_0x1be5('0x6f')],{'penalty':_0x1447d8[_0x1be5('0x6b')][_0x1be5('0xaa')]||0x0})[_0x1be5('0xab')](function(_0x2cda1b){for(var _0x551777=0x0;_0x551777<_0x1447d8['body'][_0x1be5('0x6f')][_0x1be5('0x69')];_0x551777+=0x1){var _0x441c95={'UserId':_0x1447d8[_0x1be5('0x68')]['id']};_0x441c95[_['capitalize'](_0x97ca7c['toLowerCase']())+_0x1be5('0xac')]=_0x1447d8['body']['ids'][_0x551777];socket[_0x1be5('0xad')]('user'+_[_0x1be5('0xae')](_0x97ca7c[_0x1be5('0xa8')]())+_0x1be5('0xaf'),_0x441c95);}return _0x2cda1b;})[_0x1be5('0x3b')](function(){if(_0x97ca7c===_0x1be5('0xb0')){return db['VoiceQueue']['findAll']({'where':{'id':_0x1447d8['body']['ids']||[]},'raw':!![],'attributes':['id',_0x1be5('0x49')]});}})[_0x1be5('0x3b')](function(_0x47fe92){var _0x512b5b=_0x123724[_0x1be5('0x3d')]({'plain':!![]});var _0x16bf0a=[];if(_0x97ca7c==='voice'&&_0x512b5b[_0x1be5('0x46')]===_0x1be5('0x70')&&_0x512b5b[_0x1be5('0xa3')]){for(var _0x2b9a4a=0x0;_0x2b9a4a<_0x47fe92[_0x1be5('0x69')];_0x2b9a4a+=0x1){_0x16bf0a[_0x1be5('0xb1')]({'membername':_0x512b5b[_0x1be5('0x49')],'UserId':_0x512b5b['id'],'queue_name':_0x47fe92[_0x2b9a4a][_0x1be5('0x49')],'VoiceQueueId':_0x47fe92[_0x2b9a4a]['id'],'interface':_[_0x1be5('0x77')](_0x512b5b[_0x1be5('0xa6')])?util[_0x1be5('0x79')](_0x1be5('0xb2'),_0x512b5b[_0x1be5('0x49')]):_0x512b5b[_0x1be5('0xa6')],'paused':_0x512b5b[_0x1be5('0xa5')]||![],'penalty':_0x1447d8[_0x1be5('0x6b')][_0x1be5('0xaa')]||0x0});}return BPromise[_0x1be5('0xb3')](_0x16bf0a,function(_0xebcf67){return db[_0x1be5('0xb4')][_0x1be5('0xb5')](_0xebcf67);});}return _0x123724;});}})[_0x1be5('0x3b')](respondWithStatusCode(_0x410d00,null))[_0x1be5('0x2e')](handleError(_0x410d00,null));};exports['removeQueues']=function(_0x249346,_0x3aadf8,_0x1587e5){var _0x39e094;return db[_0x1be5('0x4b')][_0x1be5('0x47')]({'where':{'id':_0x249346['params']['id']},'attributes':['id','name',_0x1be5('0x46')]})[_0x1be5('0x3b')](handleEntityNotFound(_0x3aadf8,null))[_0x1be5('0x3b')](function(_0x321276){if(_0x321276){_0x39e094=_0x321276;if(!_0x249346[_0x1be5('0x53')][_0x1be5('0xa2')]||!utils['isValidChannel'](_0x249346['query'][_0x1be5('0xa2')])){throw new db[(_0x1be5('0x21'))][(_0x1be5('0x22'))](_0x1be5('0xb6'));}return _0x321276[_0x1be5('0xb7')+_[_0x1be5('0xae')](_0x249346[_0x1be5('0x53')]['channel'][_0x1be5('0xa8')]())+'Queues'](_0x249346[_0x1be5('0x53')][_0x1be5('0x6f')]);}})[_0x1be5('0x3b')](function(_0x1cfb03){for(var _0x47e335=0x0;_0x47e335<_0x249346['query']['ids']['length'];_0x47e335+=0x1){var _0x319155={'UserId':_0x249346['params']['id']};_0x319155[_['capitalize'](_0x249346[_0x1be5('0x53')][_0x1be5('0xa2')][_0x1be5('0xa8')]())+_0x1be5('0xac')]=_0x249346[_0x1be5('0x53')][_0x1be5('0x6f')][_0x47e335];socket[_0x1be5('0xad')](_0x1be5('0x93')+_['capitalize'](_0x249346['query']['channel'][_0x1be5('0xa8')]())+_0x1be5('0xb8'),_0x319155);}return _0x1cfb03;})[_0x1be5('0x3b')](function(){if(_0x249346[_0x1be5('0x53')][_0x1be5('0xa2')]==='voice'){return db[_0x1be5('0xb4')][_0x1be5('0x3c')]({'where':{'UserId':_0x249346[_0x1be5('0x68')]['id'],'VoiceQueueId':_0x249346['query'][_0x1be5('0x6f')]},'individualHooks':!![]})['then'](function(){return _0x39e094;});}return _0x39e094;})[_0x1be5('0x3b')](respondWithStatusCode(_0x3aadf8,null))['catch'](handleError(_0x3aadf8,null));};exports[_0x1be5('0xb9')]=function(_0x2b4b15,_0x5b010e,_0x4616a0){_0x2b4b15[_0x1be5('0x6b')][_0x1be5('0xba')]=_0x2b4b15[_0x1be5('0xbb')][_0x1be5('0xbc')];return db[_0x1be5('0x4b')][_0x1be5('0x47')]({'where':{'id':_0x2b4b15[_0x1be5('0x68')]['id']}})[_0x1be5('0x3b')](handleEntityNotFound(_0x5b010e,null))[_0x1be5('0x3b')](saveUpdates(_0x2b4b15['body'],null))['then'](respondWithResult(_0x5b010e,null))[_0x1be5('0x2e')](handleError(_0x5b010e,null));};exports[_0x1be5('0xbd')]=function(_0x39cc74,_0x3b7970,_0x152d21){var _0x5bfdd1=path[_0x1be5('0xbe')](config[_0x1be5('0xbf')],_0x1be5('0xc0'));return db[_0x1be5('0x4b')]['find']({'where':{'id':_0x39cc74['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x1be5('0x3b')](handleEntityNotFound(_0x3b7970,null))[_0x1be5('0x3b')](function(_0x35202c){if(_0x35202c){if(_[_0x1be5('0x77')](_0x35202c[_0x1be5('0xba')])){return _0x3b7970[_0x1be5('0xc1')](_0x5bfdd1);}else{if(!fs[_0x1be5('0xc2')](path[_0x1be5('0xbe')](config[_0x1be5('0xbf')],_0x1be5('0xc3'),_0x35202c[_0x1be5('0xba')]))){return _0x3b7970[_0x1be5('0xc1')](_0x5bfdd1);}return _0x3b7970[_0x1be5('0xc1')](path[_0x1be5('0xbe')](config['root'],_0x1be5('0xc3'),_0x35202c[_0x1be5('0xba')]));}}})['catch'](handleError(_0x3b7970,null));};exports[_0x1be5('0xc4')]=function(_0x541e73,_0x395314,_0x1d33f1){var _0x499d92={};var _0x3fdf49={};var _0x364fc2;var _0x305ccd;return db['User'][_0x1be5('0x99')]({'where':{'id':_0x541e73[_0x1be5('0x68')]['id']}})[_0x1be5('0x3b')](handleEntityNotFound(_0x395314,null))[_0x1be5('0x3b')](function(_0x3e59cd){if(_0x3e59cd){_0x364fc2=_0x3e59cd;_0x3fdf49[_0x1be5('0x57')]=_[_0x1be5('0x54')](db['CmContact'][_0x1be5('0x4c')]);_0x3fdf49[_0x1be5('0x53')]=_[_0x1be5('0x54')](_0x541e73[_0x1be5('0x53')]);_0x3fdf49['filters']=_[_0x1be5('0x56')](_0x3fdf49[_0x1be5('0x57')],_0x3fdf49[_0x1be5('0x53')]);_0x499d92[_0x1be5('0x58')]=_[_0x1be5('0x56')](_0x3fdf49[_0x1be5('0x57')],qs[_0x1be5('0x59')](_0x541e73[_0x1be5('0x53')][_0x1be5('0x59')]));_0x499d92['attributes']=_0x499d92['attributes'][_0x1be5('0x69')]?_0x499d92[_0x1be5('0x58')]:_0x3fdf49[_0x1be5('0x57')];_0x499d92[_0x1be5('0xc5')]=qs['sort'](_0x541e73[_0x1be5('0x53')][_0x1be5('0x5c')]);_0x499d92[_0x1be5('0x5d')]=qs['filters'](_[_0x1be5('0xc6')](_0x541e73['query'],_0x3fdf49['filters']));if(_0x541e73[_0x1be5('0x53')]['filter']){_0x499d92[_0x1be5('0x5d')]=_[_0x1be5('0x5e')](_0x499d92[_0x1be5('0x5d')],{'$or':_[_0x1be5('0x43')](_0x499d92['attributes'],function(_0x6c6229){var _0x4fe622={};_0x4fe622[_0x6c6229]={'$like':'%'+_0x541e73[_0x1be5('0x53')][_0x1be5('0x42')]+'%'};return _0x4fe622;})});}_0x499d92=_['merge']({},_0x499d92,_0x541e73['options']);return _0x364fc2[_0x1be5('0xc4')](_0x499d92);}})[_0x1be5('0x3b')](function(_0x228dfa){if(_0x228dfa){_0x305ccd=_0x228dfa[_0x1be5('0x69')];if(_0x541e73[_0x1be5('0x53')][_0x1be5('0x5a')](_0x1be5('0x63'))){_0x499d92[_0x1be5('0x64')]=[{'model':db[_0x1be5('0xc7')],'as':'List','required':![]},{'model':db['Tag'],'as':_0x1be5('0xc8'),'attributes':['id',_0x1be5('0x49'),_0x1be5('0xc9')],'where':_0x541e73[_0x1be5('0x53')][_0x1be5('0xca')]?{'id':_0x541e73[_0x1be5('0x53')]['tag']}:undefined,'required':_0x541e73['query'][_0x1be5('0xca')]?!![]:![]}];}if(!_0x541e73['query'][_0x1be5('0x5a')](_0x1be5('0x5b'))){_0x499d92[_0x1be5('0x35')]=qs[_0x1be5('0x35')](_0x541e73[_0x1be5('0x53')][_0x1be5('0x35')]);_0x499d92['offset']=qs['offset'](_0x541e73[_0x1be5('0x53')][_0x1be5('0x34')]);}return _0x364fc2[_0x1be5('0xc4')](_0x499d92);}})[_0x1be5('0x3b')](function(_0xa48d86){if(_0xa48d86){return _0xa48d86?{'count':_0x305ccd,'rows':_0xa48d86}:null;}})[_0x1be5('0x3b')](respondWithResult(_0x395314,null))[_0x1be5('0x2e')](handleError(_0x395314,null));};exports['getQueues']=function(_0x4bd755,_0x552329,_0x47c15b){var _0x393273;var _0x5f0d8a;var _0x194abb={};var _0x3fd40f;return db['User'][_0x1be5('0x99')]({'where':{'id':_0x4bd755[_0x1be5('0x68')]['id']},'attributes':['id',_0x1be5('0x49'),_0x1be5('0x46')]})[_0x1be5('0x3b')](handleEntityNotFound(_0x552329,null))[_0x1be5('0x3b')](function(_0xf6b76e){if(!utils['isValidChannel'](_0x4bd755[_0x1be5('0x53')][_0x1be5('0xa2')])){throw new db[(_0x1be5('0x21'))][(_0x1be5('0x22'))](_0x1be5('0xb6'));}_0x393273=_0xf6b76e;var _0xa6b15d={};_0xa6b15d['model']=_[_0x1be5('0x54')](db[_[_0x1be5('0xae')](_0x4bd755[_0x1be5('0x53')][_0x1be5('0xa2')])+_0x1be5('0xcb')][_0x1be5('0x4c')]);_0xa6b15d['query']=_[_0x1be5('0x54')](_0x4bd755['query']);_0xa6b15d[_0x1be5('0x55')]=_[_0x1be5('0x56')](_0xa6b15d[_0x1be5('0x57')],_0xa6b15d[_0x1be5('0x53')]);_0x194abb[_0x1be5('0x58')]=_[_0x1be5('0x56')](_0xa6b15d[_0x1be5('0x57')],qs[_0x1be5('0x59')](_0x4bd755[_0x1be5('0x53')][_0x1be5('0x59')]));_0x194abb[_0x1be5('0x58')]=_0x194abb[_0x1be5('0x58')][_0x1be5('0x69')]?_0x194abb[_0x1be5('0x58')]:_0xa6b15d[_0x1be5('0x57')];_0x194abb['order']=qs[_0x1be5('0x5c')](_0x4bd755[_0x1be5('0x53')][_0x1be5('0x5c')]);_0x194abb['where']=qs[_0x1be5('0x55')](_[_0x1be5('0xc6')](_0x4bd755[_0x1be5('0x53')],_0xa6b15d['filters']));if(_0x4bd755[_0x1be5('0x53')][_0x1be5('0x42')]){_0x194abb[_0x1be5('0x5d')]=_[_0x1be5('0x5e')](_0x194abb[_0x1be5('0x5d')],{'$or':_[_0x1be5('0x43')](_0x194abb[_0x1be5('0x58')],function(_0x196f83){var _0x213c6e={};_0x213c6e[_0x196f83]={'$like':'%'+_0x4bd755['query']['filter']+'%'};return _0x213c6e;})});}_0x194abb=_[_0x1be5('0x5e')]({},_0x194abb,_0x4bd755[_0x1be5('0x62')]);switch(_0x393273[_0x1be5('0x46')]){case _0x1be5('0x72'):return db[_[_0x1be5('0xae')](_0x4bd755['query'][_0x1be5('0xa2')])+_0x1be5('0xcb')][_0x1be5('0x65')](_0x194abb);case'user':case'agent':return _0x393273['get'+_[_0x1be5('0xae')](_0x4bd755[_0x1be5('0x53')]['channel'])+_0x1be5('0xa9')](_0x194abb);default:throw new db['Sequelize']['ValidationError'](_0x1be5('0xcc'));}})[_0x1be5('0x3b')](function(_0x3ecf0e){_0x3fd40f=_0x3ecf0e[_0x1be5('0x69')];if(!_0x4bd755['query'][_0x1be5('0x5a')](_0x1be5('0x5b'))){_0x194abb[_0x1be5('0x35')]=qs['limit'](_0x4bd755[_0x1be5('0x53')][_0x1be5('0x35')]);_0x194abb[_0x1be5('0x34')]=qs['offset'](_0x4bd755['query'][_0x1be5('0x34')]);}switch(_0x393273['role']){case _0x1be5('0x72'):return db[_[_0x1be5('0xae')](_0x4bd755[_0x1be5('0x53')][_0x1be5('0xa2')])+_0x1be5('0xcb')]['findAll'](_0x194abb);case'user':case'agent':return _0x393273[_0x1be5('0x3d')+_['capitalize'](_0x4bd755[_0x1be5('0x53')][_0x1be5('0xa2')])+_0x1be5('0xa9')](_0x194abb);}})[_0x1be5('0x3b')](function(_0x1c837f){return{'count':_0x3fd40f,'rows':_0x1c837f};})['then'](respondWithResult(_0x552329,null))['catch'](handleError(_0x552329,null));};exports[_0x1be5('0xcd')]=function(_0x19bdd7,_0x44c40a,_0xfa89f3){var _0x120f94={};var _0xa857b8={};var _0x1b6d57;var _0x596cec;return db[_0x1be5('0x4b')]['findOne']({'where':{'id':_0x19bdd7[_0x1be5('0x68')]['id']}})[_0x1be5('0x3b')](handleEntityNotFound(_0x44c40a,null))[_0x1be5('0x3b')](function(_0x3e201b){if(_0x3e201b){_0x1b6d57=_0x3e201b;_0xa857b8[_0x1be5('0x57')]=_['keys'](db['UserVoiceQueueRt'][_0x1be5('0x4c')]);_0xa857b8[_0x1be5('0x53')]=_[_0x1be5('0x54')](_0x19bdd7['query']);_0xa857b8[_0x1be5('0x55')]=_[_0x1be5('0x56')](_0xa857b8['model'],_0xa857b8[_0x1be5('0x53')]);_0x120f94[_0x1be5('0x58')]=_['intersection'](_0xa857b8[_0x1be5('0x57')],qs[_0x1be5('0x59')](_0x19bdd7[_0x1be5('0x53')][_0x1be5('0x59')]));_0x120f94[_0x1be5('0x58')]=_0x120f94[_0x1be5('0x58')][_0x1be5('0x69')]?_0x120f94[_0x1be5('0x58')]:_0xa857b8[_0x1be5('0x57')];_0x120f94[_0x1be5('0xc5')]=qs[_0x1be5('0x5c')](_0x19bdd7[_0x1be5('0x53')]['sort']);_0x120f94['where']=qs[_0x1be5('0x55')](_['pick'](_0x19bdd7[_0x1be5('0x53')],_0xa857b8['filters']));if(_0x19bdd7['query']['filter']){_0x120f94['where']=_[_0x1be5('0x5e')](_0x120f94['where'],{'$or':_[_0x1be5('0x43')](_0x120f94['attributes'],function(_0x56c660){var _0x4bb98e={};_0x4bb98e[_0x56c660]={'$like':'%'+_0x19bdd7[_0x1be5('0x53')][_0x1be5('0x42')]+'%'};return _0x4bb98e;})});}_0x120f94=_[_0x1be5('0x5e')]({},_0x120f94,_0x19bdd7[_0x1be5('0x62')]);return _0x1b6d57[_0x1be5('0xcd')](_0x120f94);}})[_0x1be5('0x3b')](function(_0x5a911a){if(_0x5a911a){_0x596cec=_0x5a911a['length'];if(!_0x19bdd7[_0x1be5('0x53')][_0x1be5('0x5a')](_0x1be5('0x5b'))){_0x120f94[_0x1be5('0x35')]=qs[_0x1be5('0x35')](_0x19bdd7['query'][_0x1be5('0x35')]);_0x120f94[_0x1be5('0x34')]=qs[_0x1be5('0x34')](_0x19bdd7['query'][_0x1be5('0x34')]);}return _0x1b6d57[_0x1be5('0xcd')](_0x120f94);}})[_0x1be5('0x3b')](function(_0x519d68){if(_0x519d68){return _0x519d68?{'count':_0x596cec,'rows':_0x519d68}:null;}})['then'](respondWithResult(_0x44c40a,null))[_0x1be5('0x2e')](handleError(_0x44c40a,null));};exports[_0x1be5('0xce')]=function(_0x942ef8,_0x282009,_0x10ac03){var _0x3fc570={};var _0x208c95={};var _0x4421be;var _0x18e9b1;return db[_0x1be5('0x4b')]['findOne']({'where':{'id':_0x942ef8[_0x1be5('0x68')]['id']}})[_0x1be5('0x3b')](handleEntityNotFound(_0x282009,null))[_0x1be5('0x3b')](function(_0xbabe14){if(_0xbabe14){_0x4421be=_0xbabe14;_0x208c95['model']=_[_0x1be5('0x54')](db[_0x1be5('0xcf')][_0x1be5('0x4c')]);_0x208c95[_0x1be5('0x53')]=_[_0x1be5('0x54')](_0x942ef8['query']);_0x208c95['filters']=_[_0x1be5('0x56')](_0x208c95[_0x1be5('0x57')],_0x208c95[_0x1be5('0x53')]);_0x3fc570[_0x1be5('0x58')]=_[_0x1be5('0x56')](_0x208c95[_0x1be5('0x57')],qs[_0x1be5('0x59')](_0x942ef8[_0x1be5('0x53')]['fields']));_0x3fc570[_0x1be5('0x58')]=_0x3fc570[_0x1be5('0x58')][_0x1be5('0x69')]?_0x3fc570[_0x1be5('0x58')]:_0x208c95['model'];_0x3fc570[_0x1be5('0xc5')]=qs[_0x1be5('0x5c')](_0x942ef8['query'][_0x1be5('0x5c')]);_0x3fc570[_0x1be5('0x5d')]=qs[_0x1be5('0x55')](_[_0x1be5('0xc6')](_0x942ef8[_0x1be5('0x53')],_0x208c95[_0x1be5('0x55')]));if(_0x942ef8[_0x1be5('0x53')][_0x1be5('0x42')]){_0x3fc570['where']=_[_0x1be5('0x5e')](_0x3fc570[_0x1be5('0x5d')],{'$or':_[_0x1be5('0x43')](_0x3fc570[_0x1be5('0x58')],function(_0x3d800b){var _0x317e66={};_0x317e66[_0x3d800b]={'$like':'%'+_0x942ef8['query'][_0x1be5('0x42')]+'%'};return _0x317e66;})});}_0x3fc570=_[_0x1be5('0x5e')]({},_0x3fc570,_0x942ef8[_0x1be5('0x62')]);return _0x4421be[_0x1be5('0xce')](_0x3fc570);}})[_0x1be5('0x3b')](function(_0x468d9f){if(_0x468d9f){_0x18e9b1=_0x468d9f['length'];if(!_0x942ef8[_0x1be5('0x53')]['hasOwnProperty'](_0x1be5('0x5b'))){_0x3fc570[_0x1be5('0x35')]=qs['limit'](_0x942ef8[_0x1be5('0x53')]['limit']);_0x3fc570[_0x1be5('0x34')]=qs[_0x1be5('0x34')](_0x942ef8[_0x1be5('0x53')][_0x1be5('0x34')]);}return _0x4421be[_0x1be5('0xce')](_0x3fc570);}})[_0x1be5('0x3b')](function(_0x14bff8){if(_0x14bff8){return _0x14bff8?{'count':_0x18e9b1,'rows':_0x14bff8}:null;}})[_0x1be5('0x3b')](respondWithResult(_0x282009,null))[_0x1be5('0x2e')](handleError(_0x282009,null));};exports[_0x1be5('0xd0')]=function(_0x3f6f27,_0x235120,_0xec1f67){var _0x49f962={'raw':!![],'where':{}};var _0x5589a2={};var _0x1bf63d={'count':0x0,'rows':[]};return db[_0x1be5('0x4b')][_0x1be5('0x99')]({'where':{'id':_0x3f6f27[_0x1be5('0x68')]['id']}})[_0x1be5('0x3b')](handleEntityNotFound(_0x235120,null))['then'](function(_0x1589a4){if(_0x1589a4){_0x5589a2[_0x1be5('0x57')]=_['keys'](db[_0x1be5('0xd1')][_0x1be5('0x4c')]);_0x5589a2[_0x1be5('0x53')]=_[_0x1be5('0x54')](_0x3f6f27[_0x1be5('0x53')]);_0x5589a2[_0x1be5('0x55')]=_[_0x1be5('0x56')](_0x5589a2['model'],_0x5589a2['query']);_0x49f962[_0x1be5('0x58')]=_[_0x1be5('0x56')](_0x5589a2['model'],qs['fields'](_0x3f6f27[_0x1be5('0x53')][_0x1be5('0x59')]));_0x49f962[_0x1be5('0x58')]=_0x49f962[_0x1be5('0x58')][_0x1be5('0x69')]?_0x49f962[_0x1be5('0x58')]:_0x5589a2[_0x1be5('0x57')];if(!_0x3f6f27[_0x1be5('0x53')]['hasOwnProperty'](_0x1be5('0x5b'))){_0x49f962['limit']=qs[_0x1be5('0x35')](_0x3f6f27['query']['limit']);_0x49f962[_0x1be5('0x34')]=qs[_0x1be5('0x34')](_0x3f6f27[_0x1be5('0x53')][_0x1be5('0x34')]);}_0x49f962[_0x1be5('0xc5')]=qs[_0x1be5('0x5c')](_0x3f6f27[_0x1be5('0x53')]['sort']);_0x49f962[_0x1be5('0x5d')]=qs[_0x1be5('0x55')](_[_0x1be5('0xc6')](_0x3f6f27[_0x1be5('0x53')],_0x5589a2['filters']));_0x49f962[_0x1be5('0x5d')][_0x1be5('0xd2')]=_0x1589a4['id'];if(_0x3f6f27[_0x1be5('0x53')][_0x1be5('0x42')]){_0x49f962[_0x1be5('0x5d')]=_[_0x1be5('0x5e')](_0x49f962[_0x1be5('0x5d')],{'$or':_[_0x1be5('0x43')](_0x49f962['attributes'],function(_0x95726f){var _0x304fd2={};_0x304fd2[_0x95726f]={'$like':'%'+_0x3f6f27[_0x1be5('0x53')][_0x1be5('0x42')]+'%'};return _0x304fd2;})});}_0x49f962=_['merge']({},_0x49f962,_0x3f6f27[_0x1be5('0x62')]);return db['VoiceRecording'][_0x1be5('0x33')]({'where':_0x49f962[_0x1be5('0x5d')]})[_0x1be5('0x3b')](function(_0x46e786){_0x1bf63d[_0x1be5('0x33')]=_0x46e786;if(_0x3f6f27['query'][_0x1be5('0x63')]){_0x49f962['include']=[{'all':!![]}];}return db[_0x1be5('0xd1')][_0x1be5('0x65')](_0x49f962);})[_0x1be5('0x3b')](function(_0x3a3370){_0x1bf63d[_0x1be5('0x66')]=_0x3a3370;return _0x1bf63d;});}})[_0x1be5('0x3b')](respondWithFilteredResult(_0x235120,_0x49f962))['catch'](handleError(_0x235120,null));};exports[_0x1be5('0xd3')]=function(_0x3f1118,_0x325cff,_0x5d3237){var _0x2dc899={'raw':!![],'where':{}};var _0x17f325={};var _0x2bf1a0={'count':0x0,'rows':[]};return db[_0x1be5('0x4b')]['findOne']({'where':{'id':_0x3f1118[_0x1be5('0x68')]['id']}})[_0x1be5('0x3b')](handleEntityNotFound(_0x325cff,null))[_0x1be5('0x3b')](function(_0x546564){if(_0x546564){_0x17f325[_0x1be5('0x57')]=_[_0x1be5('0x54')](db[_0x1be5('0xd4')][_0x1be5('0x4c')]);_0x17f325['query']=_['keys'](_0x3f1118[_0x1be5('0x53')]);_0x17f325['filters']=_[_0x1be5('0x56')](_0x17f325[_0x1be5('0x57')],_0x17f325['query']);_0x2dc899[_0x1be5('0x58')]=_[_0x1be5('0x56')](_0x17f325['model'],qs[_0x1be5('0x59')](_0x3f1118[_0x1be5('0x53')][_0x1be5('0x59')]));_0x2dc899['attributes']=_0x2dc899[_0x1be5('0x58')]['length']?_0x2dc899[_0x1be5('0x58')]:_0x17f325['model'];if(!_0x3f1118[_0x1be5('0x53')][_0x1be5('0x5a')](_0x1be5('0x5b'))){_0x2dc899[_0x1be5('0x35')]=qs['limit'](_0x3f1118[_0x1be5('0x53')][_0x1be5('0x35')]);_0x2dc899[_0x1be5('0x34')]=qs['offset'](_0x3f1118[_0x1be5('0x53')][_0x1be5('0x34')]);}_0x2dc899[_0x1be5('0xc5')]=qs[_0x1be5('0x5c')](_0x3f1118[_0x1be5('0x53')]['sort']);_0x2dc899[_0x1be5('0x5d')]=qs[_0x1be5('0x55')](_[_0x1be5('0xc6')](_0x3f1118[_0x1be5('0x53')],_0x17f325[_0x1be5('0x55')]));_0x2dc899['where']['UserId']=_0x546564['id'];if(_0x3f1118['query']['filter']){_0x2dc899['where']=_[_0x1be5('0x5e')](_0x2dc899[_0x1be5('0x5d')],{'$or':_[_0x1be5('0x43')](_0x2dc899[_0x1be5('0x58')],function(_0x3a53a1){var _0xb4e4ca={};_0xb4e4ca[_0x3a53a1]={'$like':'%'+_0x3f1118[_0x1be5('0x53')]['filter']+'%'};return _0xb4e4ca;})});}_0x2dc899=_[_0x1be5('0x5e')]({},_0x2dc899,_0x3f1118['options']);return db[_0x1be5('0xd4')][_0x1be5('0x33')]({'where':_0x2dc899['where']})[_0x1be5('0x3b')](function(_0x5273dd){_0x2bf1a0['count']=_0x5273dd;if(_0x3f1118[_0x1be5('0x53')][_0x1be5('0x63')]){_0x2dc899[_0x1be5('0x64')]=[{'all':!![]}];}return db[_0x1be5('0xd4')][_0x1be5('0x65')](_0x2dc899);})[_0x1be5('0x3b')](function(_0xf5fdc4){_0x2bf1a0[_0x1be5('0x66')]=_0xf5fdc4;return _0x2bf1a0;});}})['then'](respondWithFilteredResult(_0x325cff,_0x2dc899))['catch'](handleError(_0x325cff,null));};exports[_0x1be5('0xd5')]=function(_0x538b18,_0x5afd06,_0x4eb7cc){var _0x20f548={};var _0x21d6e1={};var _0xfc6976;var _0x582367;return db['User']['findOne']({'where':{'id':_0x538b18['params']['id']}})['then'](handleEntityNotFound(_0x5afd06,null))[_0x1be5('0x3b')](function(_0x565992){if(_0x565992){_0xfc6976=_0x565992;_0x21d6e1[_0x1be5('0x57')]=_['keys'](db['ChatInteraction']['rawAttributes']);_0x21d6e1[_0x1be5('0x53')]=_['keys'](_0x538b18[_0x1be5('0x53')]);_0x21d6e1[_0x1be5('0x55')]=_['intersection'](_0x21d6e1[_0x1be5('0x57')],_0x21d6e1[_0x1be5('0x53')]);_0x20f548[_0x1be5('0x58')]=_[_0x1be5('0x56')](_0x21d6e1[_0x1be5('0x57')],qs[_0x1be5('0x59')](_0x538b18[_0x1be5('0x53')][_0x1be5('0x59')]));_0x20f548[_0x1be5('0x58')]=_0x20f548[_0x1be5('0x58')]['length']?_0x20f548['attributes']:_0x21d6e1[_0x1be5('0x57')];_0x20f548[_0x1be5('0xc5')]=qs['sort'](_0x538b18['query']['sort']);_0x20f548[_0x1be5('0x5d')]=qs[_0x1be5('0x55')](_[_0x1be5('0xc6')](_0x538b18[_0x1be5('0x53')],_0x21d6e1[_0x1be5('0x55')]));if(_0x538b18[_0x1be5('0x53')][_0x1be5('0x42')]){_0x20f548[_0x1be5('0x5d')]=_[_0x1be5('0x5e')](_0x20f548['where'],{'$or':_['map'](_0x20f548['attributes'],function(_0x147ac0){var _0x9e3efc={};_0x9e3efc[_0x147ac0]={'$like':'%'+_0x538b18[_0x1be5('0x53')][_0x1be5('0x42')]+'%'};return _0x9e3efc;})});}_0x20f548=_['merge']({},_0x20f548,_0x538b18[_0x1be5('0x62')]);return _0xfc6976[_0x1be5('0xd5')](_0x20f548);}})[_0x1be5('0x3b')](function(_0xa2c77b){if(_0xa2c77b){_0x582367=_0xa2c77b['length'];if(!_0x538b18[_0x1be5('0x53')][_0x1be5('0x5a')](_0x1be5('0x5b'))){_0x20f548['limit']=qs[_0x1be5('0x35')](_0x538b18[_0x1be5('0x53')]['limit']);_0x20f548[_0x1be5('0x34')]=qs[_0x1be5('0x34')](_0x538b18[_0x1be5('0x53')]['offset']);}return _0xfc6976[_0x1be5('0xd5')](_0x20f548);}})[_0x1be5('0x3b')](function(_0x4b6926){if(_0x4b6926){return _0x4b6926?{'count':_0x582367,'rows':_0x4b6926}:null;}})[_0x1be5('0x3b')](respondWithResult(_0x5afd06,null))[_0x1be5('0x2e')](handleError(_0x5afd06,null));};exports[_0x1be5('0xd6')]=function(_0xeb516e,_0xb8f11,_0x448e01){var _0x13ff54={};var _0x2d1d53={};var _0x35c5a5;var _0x44680d;return db[_0x1be5('0x4b')][_0x1be5('0x99')]({'where':{'id':_0xeb516e[_0x1be5('0x68')]['id']}})[_0x1be5('0x3b')](handleEntityNotFound(_0xb8f11,null))[_0x1be5('0x3b')](function(_0x3a2346){if(_0x3a2346){_0x35c5a5=_0x3a2346;_0x2d1d53[_0x1be5('0x57')]=_[_0x1be5('0x54')](db[_0x1be5('0xd7')][_0x1be5('0x4c')]);_0x2d1d53[_0x1be5('0x53')]=_[_0x1be5('0x54')](_0xeb516e[_0x1be5('0x53')]);_0x2d1d53[_0x1be5('0x55')]=_[_0x1be5('0x56')](_0x2d1d53['model'],_0x2d1d53[_0x1be5('0x53')]);_0x13ff54['attributes']=_[_0x1be5('0x56')](_0x2d1d53[_0x1be5('0x57')],qs[_0x1be5('0x59')](_0xeb516e[_0x1be5('0x53')][_0x1be5('0x59')]));_0x13ff54[_0x1be5('0x58')]=_0x13ff54[_0x1be5('0x58')][_0x1be5('0x69')]?_0x13ff54[_0x1be5('0x58')]:_0x2d1d53[_0x1be5('0x57')];_0x13ff54[_0x1be5('0xc5')]=qs[_0x1be5('0x5c')](_0xeb516e[_0x1be5('0x53')]['sort']);_0x13ff54[_0x1be5('0x5d')]=qs[_0x1be5('0x55')](_[_0x1be5('0xc6')](_0xeb516e[_0x1be5('0x53')],_0x2d1d53[_0x1be5('0x55')]));if(_0xeb516e[_0x1be5('0x53')][_0x1be5('0x42')]){_0x13ff54[_0x1be5('0x5d')]=_[_0x1be5('0x5e')](_0x13ff54[_0x1be5('0x5d')],{'$or':_[_0x1be5('0x43')](_0x13ff54['attributes'],function(_0x48bf10){var _0x42a5e4={};_0x42a5e4[_0x48bf10]={'$like':'%'+_0xeb516e['query'][_0x1be5('0x42')]+'%'};return _0x42a5e4;})});}_0x13ff54=_['merge']({},_0x13ff54,_0xeb516e['options']);return _0x35c5a5[_0x1be5('0xd6')](_0x13ff54);}})[_0x1be5('0x3b')](function(_0x32e2c4){if(_0x32e2c4){_0x44680d=_0x32e2c4['length'];if(!_0xeb516e[_0x1be5('0x53')][_0x1be5('0x5a')]('nolimit')){_0x13ff54[_0x1be5('0x35')]=qs['limit'](_0xeb516e[_0x1be5('0x53')][_0x1be5('0x35')]);_0x13ff54[_0x1be5('0x34')]=qs[_0x1be5('0x34')](_0xeb516e[_0x1be5('0x53')][_0x1be5('0x34')]);}return _0x35c5a5[_0x1be5('0xd6')](_0x13ff54);}})[_0x1be5('0x3b')](function(_0xbaaba8){if(_0xbaaba8){return _0xbaaba8?{'count':_0x44680d,'rows':_0xbaaba8}:null;}})[_0x1be5('0x3b')](respondWithResult(_0xb8f11,null))[_0x1be5('0x2e')](handleError(_0xb8f11,null));};exports[_0x1be5('0xd8')]=function(_0x7f2b3f,_0x1bdfea,_0x194102){var _0x39eeda={'raw':!![],'where':{}};var _0x4e918f={};var _0x37944f={'count':0x0,'rows':[]};return db[_0x1be5('0x4b')]['findOne']({'where':{'id':_0x7f2b3f[_0x1be5('0x68')]['id']}})[_0x1be5('0x3b')](handleEntityNotFound(_0x1bdfea,null))[_0x1be5('0x3b')](function(_0x362118){if(_0x362118){_0x4e918f[_0x1be5('0x57')]=_['keys'](db[_0x1be5('0xd9')][_0x1be5('0x4c')]);_0x4e918f[_0x1be5('0x53')]=_[_0x1be5('0x54')](_0x7f2b3f['query']);_0x4e918f[_0x1be5('0x55')]=_[_0x1be5('0x56')](_0x4e918f[_0x1be5('0x57')],_0x4e918f[_0x1be5('0x53')]);_0x39eeda[_0x1be5('0x58')]=_[_0x1be5('0x56')](_0x4e918f[_0x1be5('0x57')],qs['fields'](_0x7f2b3f[_0x1be5('0x53')]['fields']));_0x39eeda[_0x1be5('0x58')]=_0x39eeda[_0x1be5('0x58')][_0x1be5('0x69')]?_0x39eeda[_0x1be5('0x58')]:_0x4e918f[_0x1be5('0x57')];if(!_0x7f2b3f['query'][_0x1be5('0x5a')]('nolimit')){_0x39eeda[_0x1be5('0x35')]=qs[_0x1be5('0x35')](_0x7f2b3f['query'][_0x1be5('0x35')]);_0x39eeda['offset']=qs['offset'](_0x7f2b3f[_0x1be5('0x53')][_0x1be5('0x34')]);}_0x39eeda[_0x1be5('0xc5')]=qs[_0x1be5('0x5c')](_0x7f2b3f[_0x1be5('0x53')]['sort']);_0x39eeda[_0x1be5('0x5d')]=qs[_0x1be5('0x55')](_[_0x1be5('0xc6')](_0x7f2b3f[_0x1be5('0x53')],_0x4e918f['filters']));_0x39eeda[_0x1be5('0x5d')][_0x1be5('0xd2')]=_0x362118['id'];if(_0x7f2b3f[_0x1be5('0x53')]['filter']){_0x39eeda[_0x1be5('0x5d')]=_[_0x1be5('0x5e')](_0x39eeda[_0x1be5('0x5d')],{'$or':_[_0x1be5('0x43')](_0x39eeda['attributes'],function(_0x1737bd){var _0x513d18={};_0x513d18[_0x1737bd]={'$like':'%'+_0x7f2b3f[_0x1be5('0x53')]['filter']+'%'};return _0x513d18;})});}_0x39eeda=_['merge']({},_0x39eeda,_0x7f2b3f['options']);return db[_0x1be5('0xd9')][_0x1be5('0x33')]({'where':_0x39eeda[_0x1be5('0x5d')]})[_0x1be5('0x3b')](function(_0x199dfb){_0x37944f[_0x1be5('0x33')]=_0x199dfb;if(_0x7f2b3f[_0x1be5('0x53')]['includeAll']){_0x39eeda[_0x1be5('0x64')]=[{'all':!![]}];}return db['MailInteraction'][_0x1be5('0x65')](_0x39eeda);})[_0x1be5('0x3b')](function(_0x13b4fc){_0x37944f['rows']=_0x13b4fc;return _0x37944f;});}})[_0x1be5('0x3b')](respondWithFilteredResult(_0x1bdfea,_0x39eeda))[_0x1be5('0x2e')](handleError(_0x1bdfea,null));};exports[_0x1be5('0xda')]=function(_0x3dbd24,_0x16ef0a,_0x25cd8e){var _0x5b6b92={};var _0xc7f337={};var _0x18257a;var _0x1da4bb;return db['User'][_0x1be5('0x99')]({'where':{'id':_0x3dbd24['params']['id']}})[_0x1be5('0x3b')](handleEntityNotFound(_0x16ef0a,null))['then'](function(_0x29f4cc){if(_0x29f4cc){_0x18257a=_0x29f4cc;_0xc7f337['model']=_[_0x1be5('0x54')](db[_0x1be5('0xdb')][_0x1be5('0x4c')]);_0xc7f337[_0x1be5('0x53')]=_[_0x1be5('0x54')](_0x3dbd24[_0x1be5('0x53')]);_0xc7f337[_0x1be5('0x55')]=_[_0x1be5('0x56')](_0xc7f337[_0x1be5('0x57')],_0xc7f337[_0x1be5('0x53')]);_0x5b6b92[_0x1be5('0x58')]=_[_0x1be5('0x56')](_0xc7f337[_0x1be5('0x57')],qs[_0x1be5('0x59')](_0x3dbd24[_0x1be5('0x53')][_0x1be5('0x59')]));_0x5b6b92['attributes']=_0x5b6b92[_0x1be5('0x58')][_0x1be5('0x69')]?_0x5b6b92[_0x1be5('0x58')]:_0xc7f337[_0x1be5('0x57')];_0x5b6b92[_0x1be5('0xc5')]=qs[_0x1be5('0x5c')](_0x3dbd24[_0x1be5('0x53')][_0x1be5('0x5c')]);_0x5b6b92[_0x1be5('0x5d')]=qs[_0x1be5('0x55')](_[_0x1be5('0xc6')](_0x3dbd24['query'],_0xc7f337[_0x1be5('0x55')]));if(_0x3dbd24[_0x1be5('0x53')][_0x1be5('0x42')]){_0x5b6b92[_0x1be5('0x5d')]=_[_0x1be5('0x5e')](_0x5b6b92[_0x1be5('0x5d')],{'$or':_[_0x1be5('0x43')](_0x5b6b92[_0x1be5('0x58')],function(_0x194e84){var _0x2f69b7={};_0x2f69b7[_0x194e84]={'$like':'%'+_0x3dbd24[_0x1be5('0x53')]['filter']+'%'};return _0x2f69b7;})});}_0x5b6b92=_[_0x1be5('0x5e')]({},_0x5b6b92,_0x3dbd24[_0x1be5('0x62')]);return _0x18257a[_0x1be5('0xda')](_0x5b6b92);}})[_0x1be5('0x3b')](function(_0x366fe3){if(_0x366fe3){_0x1da4bb=_0x366fe3[_0x1be5('0x69')];if(!_0x3dbd24['query']['hasOwnProperty']('nolimit')){_0x5b6b92['limit']=qs[_0x1be5('0x35')](_0x3dbd24[_0x1be5('0x53')][_0x1be5('0x35')]);_0x5b6b92[_0x1be5('0x34')]=qs[_0x1be5('0x34')](_0x3dbd24[_0x1be5('0x53')][_0x1be5('0x34')]);}return _0x18257a[_0x1be5('0xda')](_0x5b6b92);}})[_0x1be5('0x3b')](function(_0x5d8e9a){if(_0x5d8e9a){return _0x5d8e9a?{'count':_0x1da4bb,'rows':_0x5d8e9a}:null;}})[_0x1be5('0x3b')](respondWithResult(_0x16ef0a,null))['catch'](handleError(_0x16ef0a,null));};exports[_0x1be5('0xdc')]=function(_0x4f3f04,_0x593d26,_0x24b216){var _0x4c2540={};var _0x13500e={};var _0x30ea02;var _0x5705b5;return db['User'][_0x1be5('0x99')]({'where':{'id':_0x4f3f04[_0x1be5('0x68')]['id']}})[_0x1be5('0x3b')](handleEntityNotFound(_0x593d26,null))[_0x1be5('0x3b')](function(_0x553920){if(_0x553920){_0x30ea02=_0x553920;_0x13500e['model']=_['keys'](db[_0x1be5('0xdd')][_0x1be5('0x4c')]);_0x13500e[_0x1be5('0x53')]=_[_0x1be5('0x54')](_0x4f3f04[_0x1be5('0x53')]);_0x13500e[_0x1be5('0x55')]=_[_0x1be5('0x56')](_0x13500e[_0x1be5('0x57')],_0x13500e[_0x1be5('0x53')]);_0x4c2540[_0x1be5('0x58')]=_[_0x1be5('0x56')](_0x13500e[_0x1be5('0x57')],qs[_0x1be5('0x59')](_0x4f3f04['query'][_0x1be5('0x59')]));_0x4c2540[_0x1be5('0x58')]=_0x4c2540[_0x1be5('0x58')][_0x1be5('0x69')]?_0x4c2540[_0x1be5('0x58')]:_0x13500e[_0x1be5('0x57')];_0x4c2540[_0x1be5('0xc5')]=qs[_0x1be5('0x5c')](_0x4f3f04[_0x1be5('0x53')][_0x1be5('0x5c')]);_0x4c2540[_0x1be5('0x5d')]=qs[_0x1be5('0x55')](_[_0x1be5('0xc6')](_0x4f3f04[_0x1be5('0x53')],_0x13500e[_0x1be5('0x55')]));if(_0x4f3f04[_0x1be5('0x53')][_0x1be5('0x42')]){_0x4c2540[_0x1be5('0x5d')]=_[_0x1be5('0x5e')](_0x4c2540[_0x1be5('0x5d')],{'$or':_[_0x1be5('0x43')](_0x4c2540[_0x1be5('0x58')],function(_0x34cb93){var _0x12b64d={};_0x12b64d[_0x34cb93]={'$like':'%'+_0x4f3f04[_0x1be5('0x53')][_0x1be5('0x42')]+'%'};return _0x12b64d;})});}_0x4c2540=_['merge']({},_0x4c2540,_0x4f3f04['options']);return _0x30ea02[_0x1be5('0xdc')](_0x4c2540);}})['then'](function(_0x3d7eaf){if(_0x3d7eaf){_0x5705b5=_0x3d7eaf[_0x1be5('0x69')];if(!_0x4f3f04[_0x1be5('0x53')][_0x1be5('0x5a')](_0x1be5('0x5b'))){_0x4c2540[_0x1be5('0x35')]=qs['limit'](_0x4f3f04[_0x1be5('0x53')]['limit']);_0x4c2540[_0x1be5('0x34')]=qs[_0x1be5('0x34')](_0x4f3f04[_0x1be5('0x53')][_0x1be5('0x34')]);}return _0x30ea02[_0x1be5('0xdc')](_0x4c2540);}})[_0x1be5('0x3b')](function(_0x6e3c66){if(_0x6e3c66){return _0x6e3c66?{'count':_0x5705b5,'rows':_0x6e3c66}:null;}})[_0x1be5('0x3b')](respondWithResult(_0x593d26,null))['catch'](handleError(_0x593d26,null));};exports[_0x1be5('0xde')]=function(_0x3035c7,_0x3c063a,_0x4618cd){var _0x19525b;var _0x54633f;var _0x103006;var _0x291168=!_[_0x1be5('0x77')](_0x3035c7['params']['id'])?_0x3035c7[_0x1be5('0x68')]['id']:!_[_0x1be5('0x77')](_0x3035c7[_0x1be5('0x93')]['id'])?_0x3035c7[_0x1be5('0x93')]['id']:null;return db[_0x1be5('0x4b')][_0x1be5('0x47')]({'where':{'id':_0x291168,'role':{'$or':[_0x1be5('0x72'),_0x1be5('0x93'),_0x1be5('0x70')]}},'attributes':['id',_0x1be5('0x49'),_0x1be5('0xdf'),'mobile',_0x1be5('0x46'),_0x1be5('0x7a'),_0x1be5('0xa4')]})['then'](function(_0x109c77){if(_0x109c77){if(_0x109c77['role']===_0x1be5('0x70')){_0x19525b=_0x109c77;if(_0x3035c7[_0x1be5('0x6b')][_0x1be5('0xa6')]){_0x103006=util[_0x1be5('0x79')](_0x1be5('0xe0'),_0x19525b[_0x3035c7[_0x1be5('0x6b')][_0x1be5('0xa6')]]);}else if(_0x3035c7[_0x1be5('0x6b')][_0x1be5('0xe1')]){_0x103006=util[_0x1be5('0x79')](_0x1be5('0xb2'),_0x3035c7[_0x1be5('0x6b')]['intrf']);}else{_0x103006=util['format']('SIP/%s',_0x19525b[_0x1be5('0x49')]);}socket['to'](util[_0x1be5('0x79')](_0x1be5('0xe2'),_0x19525b['name']))[_0x1be5('0xad')](_0x1be5('0xe3'),{'ip':_0x3035c7[_0x1be5('0xe4')]['x-forwarded-for']||_0x3035c7['connection'][_0x1be5('0xe5')]||_0x3035c7[_0x1be5('0xe6')][_0x1be5('0xe5')]||_0x3035c7[_0x1be5('0xe7')][_0x1be5('0xe6')][_0x1be5('0xe5')]});return db[_0x1be5('0xb4')][_0x1be5('0x3c')]({'where':{'membername':_0x19525b['name']},'individualHooks':!![]});}}else{throw new db[(_0x1be5('0x21'))]['ValidationError'](_0x1be5('0xe8'));}})[_0x1be5('0x3b')](function(){if(_0x19525b){return _0x19525b['getVoiceQueues']({'raw':!![]});}})[_0x1be5('0x3b')](function(_0x206ad8){if(_0x19525b){var _0x3d1c6e=[];if(_0x206ad8){_0x54633f=_0x206ad8;if(_0x54633f['length']){for(var _0x109800=0x0;_0x109800<_0x54633f[_0x1be5('0x69')];_0x109800++){_0x3d1c6e[_0x1be5('0xb1')]({'membername':_0x19525b['name'],'UserId':_0x19525b['id'],'queue_name':_0x54633f[_0x109800][_0x1be5('0x49')],'VoiceQueueId':_0x54633f[_0x109800]['id'],'interface':_0x103006,'paused':_0x19525b[_0x1be5('0xa4')]||![],'penalty':_0x54633f[_0x109800]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0x1be5('0xb3')](_0x3d1c6e,function(_0x24ad44){return db[_0x1be5('0xb4')][_0x1be5('0xb5')](_0x24ad44);});}}}})['then'](function(){if(_0x19525b){return db[_0x1be5('0xe9')][_0x1be5('0x65')]({'where':{'membername':_0x19525b['name'],'exitAt':null}});}})['then'](function(_0x599ae5){if(_0x19525b){var _0x9c8421=[];_0x599ae5[_0x1be5('0xea')](function(_0x3f4a67){_0x9c8421[_0x1be5('0xb1')](_0x3f4a67[_0x1be5('0x3a')]({'exitAt':moment()[_0x1be5('0x79')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x9c8421);}})[_0x1be5('0x3b')](function(){if(_0x19525b){var _0x4b63e1=[];var _0x3313a7=[];var _0x133355=utils[_0x1be5('0xeb')]();var _0xac870d={'membername':_0x19525b['name'],'interface':_0x103006,'enterAt':moment()[_0x1be5('0x79')](_0x1be5('0xec')),'role':_0x19525b[_0x1be5('0x46')],'internal':_0x19525b['internal']};_0x133355[_0x1be5('0xea')](function(_0x304219){_0x4b63e1[_0x1be5('0xb1')](_['merge']({'channel':_0x304219,'type':'LOGIN','data1':_0x3035c7[_0x1be5('0x6b')][_0x1be5('0xed')],'data2':_0x103006},_0xac870d));if(_0x19525b[_0x1be5('0xa4')]){_0x3313a7[_0x1be5('0xb1')](_[_0x1be5('0x5e')]({'channel':_0x304219,'type':_0x1be5('0xee'),'data1':_0x1be5('0xef')},_0xac870d));}});return db['MemberReport']['bulkCreate'](_0x4b63e1['concat'](_0x3313a7),{'individualHooks':!![]});}})[_0x1be5('0x3b')](function(){if(_0x19525b){return _0x19525b[_0x1be5('0x3a')]({'online':!![],'lastLoginAt':moment()[_0x1be5('0x79')](_0x1be5('0xec')),'voicePause':_0x19525b['loginInPause']||![],'mailPause':_0x19525b[_0x1be5('0xa4')]||![],'chatPause':_0x19525b['loginInPause']||![],'faxPause':_0x19525b['loginInPause']||![],'smsPause':_0x19525b['loginInPause']||![],'openchannelPause':_0x19525b[_0x1be5('0xa4')]||![],'pauseType':_0x19525b[_0x1be5('0xa4')]?_0x1be5('0xef'):null,'interface':_0x103006,'lastPauseAt':moment()[_0x1be5('0x79')](_0x1be5('0xec'))});}})['then'](function(_0x14e146){if(_0x3035c7[_0x1be5('0xf0')]){return _0x4618cd();}else{return BPromise['resolve'](_0x14e146)[_0x1be5('0x3b')](respondWithResult(_0x3c063a,null));}})[_0x1be5('0x2e')](handleError(_0x3c063a,null));};exports['logout']=function(_0xcc14a3,_0x46e7fe,_0x318d41){var _0x5476e4;return db[_0x1be5('0x4b')]['find']({'where':{'id':_0xcc14a3[_0x1be5('0x68')]['id'],'role':_0x1be5('0x70')},'attributes':['id',_0x1be5('0x49'),_0x1be5('0x46')]})[_0x1be5('0x3b')](handleEntityNotFound(_0x46e7fe,null))['then'](function(_0x2d10a6){if(_0x2d10a6){_0x5476e4=_0x2d10a6;return db['UserVoiceQueueRt'][_0x1be5('0x3c')]({'where':{'membername':_0x5476e4['name']},'individualHooks':!![]});}})['then'](function(){return db[_0x1be5('0xe9')][_0x1be5('0x65')]({'where':{'membername':_0x5476e4[_0x1be5('0x49')],'exitAt':null}});})['then'](function(_0x4a8cbf){var _0x77d5ea=[];_0x4a8cbf['forEach'](function(_0x4d4a82){_0x77d5ea['push'](_0x4d4a82['update']({'exitAt':moment()[_0x1be5('0x79')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x77d5ea);})[_0x1be5('0x3b')](function(){return _0x5476e4[_0x1be5('0x3a')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})[_0x1be5('0x3b')](respondWithResult(_0x46e7fe,null))[_0x1be5('0x2e')](handleError(_0x46e7fe,null));};exports[_0x1be5('0xf1')]=function(_0x224abc,_0xb8cd2b,_0x346ce5){var _0x39d1d3;return db[_0x1be5('0xb4')][_0x1be5('0x3a')]({'paused':0x1},{'where':{'UserId':_0x224abc[_0x1be5('0x68')]['id']},'individualHooks':!![]})[_0x1be5('0x3b')](function(){return db[_0x1be5('0x4b')][_0x1be5('0x47')]({'where':{'id':_0x224abc[_0x1be5('0x68')]['id'],'role':_0x1be5('0x70')},'attributes':['id','name',_0x1be5('0x46'),_0x1be5('0x7a'),_0x1be5('0xa6')]});})[_0x1be5('0x3b')](handleEntityNotFound(_0xb8cd2b,null))[_0x1be5('0x3b')](function(_0x185826){if(_0x185826){_0x39d1d3=_0x185826;return respondWithRpcPromise('QueuePause',_0x1be5('0xf1'),{'id':_0x39d1d3['id'],'name':_0x39d1d3[_0x1be5('0x49')],'pause':!![]});}})[_0x1be5('0x3b')](function(){if(_0x39d1d3){return db[_0x1be5('0xe9')]['findAll']({'where':{'membername':_0x39d1d3[_0x1be5('0x49')],'type':_0x1be5('0xee'),'exitAt':null}});}})['then'](function(_0x283ad0){if(_0x283ad0[_0x1be5('0x69')]){var _0x2f58b2=moment()[_0x1be5('0x79')](_0x1be5('0xec'));for(var _0x122d8d=0x0,_0x405b60=_0x283ad0['length'];_0x122d8d<_0x405b60;_0x122d8d++){_0x283ad0[_0x122d8d][_0x1be5('0xf2')]({'exitAt':_0x2f58b2});}}})[_0x1be5('0x3b')](function(){var _0x1568ad=[];var _0x556dc3=utils[_0x1be5('0xeb')]();_0x556dc3['forEach'](function(_0xf8a9fd){_0x1568ad[_0x1be5('0xb1')]({'channel':_0xf8a9fd,'membername':_0x39d1d3[_0x1be5('0x49')],'interface':_[_0x1be5('0x77')](_0x39d1d3[_0x1be5('0xa6')])?util[_0x1be5('0x79')](_0x1be5('0xb2'),_0x39d1d3['name']):_0x39d1d3[_0x1be5('0xa6')],'type':'PAUSE','enterAt':moment()['format'](_0x1be5('0xec')),'data1':_0x224abc[_0x1be5('0x6b')][_0x1be5('0x4e')]||_0x1be5('0xf3'),'role':_0x39d1d3[_0x1be5('0x46')],'internal':_0x39d1d3['internal']});});return db[_0x1be5('0xe9')][_0x1be5('0x6a')](_0x1568ad,{'individualHooks':!![]});})[_0x1be5('0x3b')](function(){return _0x39d1d3[_0x1be5('0x3a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x224abc[_0x1be5('0x6b')][_0x1be5('0x4e')]||_0x1be5('0xf3'),'lastPauseAt':moment()[_0x1be5('0x79')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x1be5('0x3b')](respondWithResult(_0xb8cd2b,null))[_0x1be5('0x2e')](handleError(_0xb8cd2b,null));};exports[_0x1be5('0xf4')]=function(_0x51acf4,_0xfada47,_0x24123a){var _0x3722f4;return db[_0x1be5('0x4b')][_0x1be5('0x47')]({'where':{'id':_0x51acf4[_0x1be5('0x68')]['id']},'attributes':['id',_0x1be5('0x49'),_0x1be5('0x46'),_0x1be5('0xa5'),_0x1be5('0xf5'),'chatPause',_0x1be5('0xf6'),_0x1be5('0xf7'),_0x1be5('0xf8'),_0x1be5('0xf9'),_0x1be5('0xfa')]})[_0x1be5('0x3b')](handleEntityNotFound(_0xfada47,null))['then'](function(_0x5d7a23){if(_0x5d7a23){_0x3722f4=_0x5d7a23;if(_0x51acf4[_0x1be5('0x6b')]['channel']&&!utils['isValidChannel'](_0x51acf4[_0x1be5('0x6b')]['channel'])){throw new db['Sequelize'][(_0x1be5('0x22'))](_0x1be5('0xb6'));}switch(_0x51acf4[_0x1be5('0x6b')][_0x1be5('0xa2')]){case'voice':return respondWithRpcPromise(_0x1be5('0xfb'),_0x1be5('0xf4'),{'id':_0x3722f4['id'],'name':_0x3722f4[_0x1be5('0x49')],'pause':![]})[_0x1be5('0x3b')](function(){return db[_0x1be5('0xb4')][_0x1be5('0x3a')]({'paused':0x0},{'where':{'UserId':_0x3722f4['id']},'individualHooks':!![]});})[_0x1be5('0x3b')](function(){return db[_0x1be5('0xe9')][_0x1be5('0x47')]({'where':{'channel':_0x51acf4[_0x1be5('0x6b')]['channel'],'membername':_0x3722f4[_0x1be5('0x49')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x3b00a6){if(_0x3b00a6){return _0x3b00a6['update']({'exitAt':moment()['format'](_0x1be5('0xec')),'data2':_0x1be5('0xfc')},{'individualHooks':!![]});}return null;})[_0x1be5('0x3b')](function(){return _0x3722f4[_0x1be5('0x3a')]({'voicePause':![]});});case _0x1be5('0xfd'):case'chat':case'fax':case _0x1be5('0xfe'):case _0x1be5('0xff'):return db[_0x1be5('0xe9')][_0x1be5('0x47')]({'where':{'channel':_0x51acf4[_0x1be5('0x6b')]['channel'],'membername':_0x3722f4[_0x1be5('0x49')],'type':_0x1be5('0xee'),'exitAt':null}})[_0x1be5('0x3b')](function(_0x49f741){if(_0x49f741){return _0x49f741[_0x1be5('0x3a')]({'exitAt':moment()[_0x1be5('0x79')](_0x1be5('0xec')),'data2':_0x1be5('0xfc')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x356e95={};_[_0x1be5('0x36')](_0x356e95,util['format'](_0x1be5('0x100'),_0x51acf4[_0x1be5('0x6b')]['channel'],'Pause'),![]);return _0x3722f4[_0x1be5('0x3a')](_0x356e95);});default:return respondWithRpcPromise(_0x1be5('0xfb'),_0x1be5('0xf4'),{'id':_0x3722f4['id'],'name':_0x3722f4[_0x1be5('0x49')],'pause':![]})[_0x1be5('0x3b')](function(){return db[_0x1be5('0xb4')][_0x1be5('0x3a')]({'paused':0x0},{'where':{'UserId':_0x3722f4['id']}});})[_0x1be5('0x3b')](function(){return db['MemberReport'][_0x1be5('0x65')]({'where':{'membername':_0x3722f4[_0x1be5('0x49')],'type':'PAUSE','exitAt':null}});})[_0x1be5('0x3b')](function(_0x491fbd){var _0x5bfb5a=[];_0x491fbd[_0x1be5('0xea')](function(_0x4436eb){_0x5bfb5a[_0x1be5('0xb1')](_0x4436eb[_0x1be5('0x3a')]({'exitAt':moment()[_0x1be5('0x79')](_0x1be5('0xec')),'data2':_0x1be5('0xfc')}));});return BPromise[_0x1be5('0x101')](_0x5bfb5a);})['then'](function(){return _0x3722f4['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0xfada47,null))[_0x1be5('0x2e')](handleError(_0xfada47,null));};exports[_0x1be5('0x102')]=function(_0x2da2a3,_0x575d38,_0x14843a){var _0x2c2477={};var _0x4b9133={};var _0xb36eb8;var _0x443c0a;return db[_0x1be5('0x4b')][_0x1be5('0x99')]({'where':{'id':_0x2da2a3['params']['id']}})[_0x1be5('0x3b')](handleEntityNotFound(_0x575d38,null))[_0x1be5('0x3b')](function(_0x33a358){if(_0x33a358){_0xb36eb8=_0x33a358;_0x4b9133[_0x1be5('0x57')]=_[_0x1be5('0x54')](db['Team'][_0x1be5('0x4c')]);_0x4b9133[_0x1be5('0x53')]=_[_0x1be5('0x54')](_0x2da2a3[_0x1be5('0x53')]);_0x4b9133[_0x1be5('0x55')]=_[_0x1be5('0x56')](_0x4b9133[_0x1be5('0x57')],_0x4b9133[_0x1be5('0x53')]);_0x2c2477['attributes']=_[_0x1be5('0x56')](_0x4b9133['model'],qs[_0x1be5('0x59')](_0x2da2a3[_0x1be5('0x53')][_0x1be5('0x59')]));_0x2c2477['attributes']=_0x2c2477[_0x1be5('0x58')][_0x1be5('0x69')]?_0x2c2477[_0x1be5('0x58')]:_0x4b9133[_0x1be5('0x57')];_0x2c2477['order']=qs[_0x1be5('0x5c')](_0x2da2a3[_0x1be5('0x53')][_0x1be5('0x5c')]);_0x2c2477[_0x1be5('0x5d')]=qs[_0x1be5('0x55')](_[_0x1be5('0xc6')](_0x2da2a3['query'],_0x4b9133[_0x1be5('0x55')]));if(_0x2da2a3['query'][_0x1be5('0x42')]){_0x2c2477[_0x1be5('0x5d')]=_['merge'](_0x2c2477[_0x1be5('0x5d')],{'$or':_[_0x1be5('0x43')](_0x2c2477[_0x1be5('0x58')],function(_0x5292fd){var _0x67b7e={};_0x67b7e[_0x5292fd]={'$like':'%'+_0x2da2a3[_0x1be5('0x53')][_0x1be5('0x42')]+'%'};return _0x67b7e;})});}_0x2c2477=_[_0x1be5('0x5e')]({},_0x2c2477,_0x2da2a3[_0x1be5('0x62')]);return _0xb36eb8[_0x1be5('0x102')](_0x2c2477);}})[_0x1be5('0x3b')](function(_0x24a756){if(_0x24a756){_0x443c0a=_0x24a756['length'];if(!_0x2da2a3[_0x1be5('0x53')][_0x1be5('0x5a')]('nolimit')){_0x2c2477[_0x1be5('0x35')]=qs['limit'](_0x2da2a3[_0x1be5('0x53')][_0x1be5('0x35')]);_0x2c2477['offset']=qs[_0x1be5('0x34')](_0x2da2a3['query']['offset']);}return _0xb36eb8[_0x1be5('0x102')](_0x2c2477);}})[_0x1be5('0x3b')](function(_0x5ca325){if(_0x5ca325){return _0x5ca325?{'count':_0x443c0a,'rows':_0x5ca325}:null;}})[_0x1be5('0x3b')](respondWithResult(_0x575d38,null))[_0x1be5('0x2e')](handleError(_0x575d38,null));};exports[_0x1be5('0x103')]=function(_0x11e929,_0xe0f93c){return db['User']['find']({'where':{'id':_0x11e929['params']['id']}})[_0x1be5('0x3b')](handleEntityNotFound(_0xe0f93c,null))[_0x1be5('0x3b')](function(_0x571070){if(_0x571070){var _0x1501fc=_0x571070[_0x1be5('0x3d')]({'plain':!![]});return _0x571070[_0x1be5('0x103')](_0x11e929[_0x1be5('0x6b')][_0x1be5('0x6f')],_['omit'](_0x11e929[_0x1be5('0x6b')],['ids','id'])||{})[_0x1be5('0x3b')](function(){for(var _0x26590e=0x0;_0x26590e<_0x11e929[_0x1be5('0x6b')][_0x1be5('0x6f')][_0x1be5('0x69')];_0x26590e++){var _0x359cff=[];db[_0x1be5('0x104')][_0x1be5('0x99')]({'where':{'id':_0x11e929['body'][_0x1be5('0x6f')][_0x26590e]}})[_0x1be5('0x3b')](function(_0x48fd7e){_0x359cff[_0x1be5('0xb1')](_0x48fd7e['getVoiceQueues']()['then'](function(_0x632a2f){for(var _0x50bcb6=0x0;_0x50bcb6<_0x632a2f[_0x1be5('0x69')];_0x50bcb6++){_0x632a2f[_0x50bcb6][_0x1be5('0x105')]('channel',_0x1be5('0x106'));}return _0x632a2f;}));_0x359cff['push'](_0x48fd7e[_0x1be5('0x107')]()[_0x1be5('0x3b')](function(_0x57cee2){for(var _0x47840d=0x0;_0x47840d<_0x57cee2[_0x1be5('0x69')];_0x47840d++){_0x57cee2[_0x47840d]['setDataValue'](_0x1be5('0xa2'),_0x1be5('0x108'));}return _0x57cee2;}));_0x359cff[_0x1be5('0xb1')](_0x48fd7e['getMailQueues']()['then'](function(_0x462171){for(var _0x38bd25=0x0;_0x38bd25<_0x462171[_0x1be5('0x69')];_0x38bd25++){_0x462171[_0x38bd25]['setDataValue']('channel','Mail');}return _0x462171;}));_0x359cff[_0x1be5('0xb1')](_0x48fd7e[_0x1be5('0x109')]()[_0x1be5('0x3b')](function(_0x1f5b42){for(var _0x30d599=0x0;_0x30d599<_0x1f5b42[_0x1be5('0x69')];_0x30d599++){_0x1f5b42[_0x30d599][_0x1be5('0x105')](_0x1be5('0xa2'),'Sms');}return _0x1f5b42;}));_0x359cff[_0x1be5('0xb1')](_0x48fd7e[_0x1be5('0x10a')]()[_0x1be5('0x3b')](function(_0x1055e0){for(var _0x41d76a=0x0;_0x41d76a<_0x1055e0['length'];_0x41d76a++){_0x1055e0[_0x41d76a]['setDataValue'](_0x1be5('0xa2'),'Fax');}return _0x1055e0;}));_0x359cff['push'](_0x48fd7e[_0x1be5('0x10b')]()[_0x1be5('0x3b')](function(_0xae7bcb){for(var _0x39c818=0x0;_0x39c818<_0xae7bcb[_0x1be5('0x69')];_0x39c818++){_0xae7bcb[_0x39c818][_0x1be5('0x105')]('channel',_0x1be5('0x10c'));}return _0xae7bcb;}));return BPromise['all'](_0x359cff);})[_0x1be5('0x3b')](function(_0x1c4259){var _0x42e24f=_['flatten'](_0x1c4259);_0x359cff=[];return db['sequelize'][_0x1be5('0x10d')](function(_0xda2429){for(var _0x1f4f84=0x0;_0x1f4f84<_0x42e24f[_0x1be5('0x69')];_0x1f4f84++){_0x359cff['push'](_0x42e24f[_0x1f4f84][_0x1be5('0x10e')](_0x1501fc['id']),{'transaction':_0xda2429});}return BPromise['all'](_0x359cff)[_0x1be5('0x3b')](function(){if(_0x1501fc[_0x1be5('0xa3')]){return BPromise['each'](_[_0x1be5('0x42')](_0x42e24f,function(_0x383db9){return _0x383db9[_0x1be5('0x10f')](_0x1be5('0xa2'))==='Voice';}),function(_0x475580){return db[_0x1be5('0xb4')][_0x1be5('0xb5')]({'membername':_0x1501fc['name'],'UserId':_0x1501fc['id'],'queue_name':_0x475580[_0x1be5('0x49')],'VoiceQueueId':_0x475580['id'],'interface':_['isNil'](_0x1501fc['interface'])?util[_0x1be5('0x79')](_0x1be5('0xb2'),_0x1501fc['name']):_0x1501fc[_0x1be5('0xa6')],'paused':_0x1501fc[_0x1be5('0xa5')]||![],'penalty':_0x1501fc[_0x1be5('0xaa')]},{'transaction':_0xda2429});});}else{return;}})[_0x1be5('0x3b')](function(){for(var _0x44ddfd=0x0;_0x44ddfd<_0x42e24f[_0x1be5('0x69')];_0x44ddfd++){var _0x67501f=_0x42e24f[_0x44ddfd]['getDataValue'](_0x1be5('0xa2'));var _0x2db25e=_0x67501f+'QueueId';socket[_0x1be5('0xad')](_0x1be5('0x93')+_0x67501f+_0x1be5('0xaf'),{'UserId':_0x1501fc['id'],['queueField']:_0x42e24f[_0x44ddfd]['id']});}});});});}});}})[_0x1be5('0x3b')](respondWithStatusCode(_0xe0f93c,null))[_0x1be5('0x2e')](handleError(_0xe0f93c,null));};exports[_0x1be5('0x110')]=function(_0x4f8c35,_0x2045ef){return db[_0x1be5('0x4b')]['findOne']({'where':{'id':_0x4f8c35['params']['id']}})[_0x1be5('0x3b')](handleEntityNotFound(_0x2045ef,null))[_0x1be5('0x3b')](function(_0x2baa69){if(_0x2baa69){var _0xa18fbc=_0x2baa69[_0x1be5('0x3d')]({'plain':!![]});var _0x59cde1=_0x4f8c35[_0x1be5('0x53')][_0x1be5('0x6f')];return _0x2baa69[_0x1be5('0x110')](_0x59cde1)[_0x1be5('0x3b')](function(){for(var _0x2ddd94=0x0;_0x2ddd94<_0x59cde1[_0x1be5('0x69')];_0x2ddd94++){var _0x11fc44=[];db[_0x1be5('0x104')][_0x1be5('0x99')]({'where':{'id':_0x59cde1[_0x2ddd94]}})[_0x1be5('0x3b')](function(_0x2ab597){_0x11fc44[_0x1be5('0xb1')](_0x2ab597[_0x1be5('0x111')]()[_0x1be5('0x3b')](function(_0x569a54){for(var _0x31ff6f=0x0;_0x31ff6f<_0x569a54[_0x1be5('0x69')];_0x31ff6f++){_0x569a54[_0x31ff6f][_0x1be5('0x105')](_0x1be5('0xa2'),'Voice');}return _0x569a54;}));_0x11fc44['push'](_0x2ab597[_0x1be5('0x107')]()['then'](function(_0x3d95ad){for(var _0x565172=0x0;_0x565172<_0x3d95ad[_0x1be5('0x69')];_0x565172++){_0x3d95ad[_0x565172][_0x1be5('0x105')]('channel',_0x1be5('0x108'));}return _0x3d95ad;}));_0x11fc44[_0x1be5('0xb1')](_0x2ab597[_0x1be5('0x112')]()['then'](function(_0x5f70dc){for(var _0x1bb995=0x0;_0x1bb995<_0x5f70dc[_0x1be5('0x69')];_0x1bb995++){_0x5f70dc[_0x1bb995]['setDataValue']('channel',_0x1be5('0x113'));}return _0x5f70dc;}));_0x11fc44[_0x1be5('0xb1')](_0x2ab597['getSmsQueues']()[_0x1be5('0x3b')](function(_0x1a3b47){for(var _0x29bf4f=0x0;_0x29bf4f<_0x1a3b47[_0x1be5('0x69')];_0x29bf4f++){_0x1a3b47[_0x29bf4f][_0x1be5('0x105')](_0x1be5('0xa2'),_0x1be5('0x114'));}return _0x1a3b47;}));_0x11fc44['push'](_0x2ab597[_0x1be5('0x10a')]()[_0x1be5('0x3b')](function(_0x53ebff){for(var _0x5977a7=0x0;_0x5977a7<_0x53ebff[_0x1be5('0x69')];_0x5977a7++){_0x53ebff[_0x5977a7][_0x1be5('0x105')](_0x1be5('0xa2'),_0x1be5('0x115'));}return _0x53ebff;}));_0x11fc44[_0x1be5('0xb1')](_0x2ab597[_0x1be5('0x10b')]()[_0x1be5('0x3b')](function(_0x45717d){for(var _0x11f8a9=0x0;_0x11f8a9<_0x45717d[_0x1be5('0x69')];_0x11f8a9++){_0x45717d[_0x11f8a9][_0x1be5('0x105')](_0x1be5('0xa2'),_0x1be5('0x10c'));}return _0x45717d;}));return BPromise[_0x1be5('0x101')](_0x11fc44);})[_0x1be5('0x3b')](function(_0x2ffec7){var _0x20a167=_[_0x1be5('0x116')](_0x2ffec7);_0x11fc44=[];return db[_0x1be5('0x60')]['transaction'](function(_0x256a0f){for(var _0x4d5f8f=0x0;_0x4d5f8f<_0x20a167['length'];_0x4d5f8f++){_0x11fc44['push'](_0x20a167[_0x4d5f8f][_0x1be5('0x117')](_0xa18fbc['id']),{'transaction':_0x256a0f});}return BPromise['all'](_0x11fc44)[_0x1be5('0x3b')](function(){if(_0xa18fbc['online']){return BPromise['each'](_['filter'](_0x20a167,function(_0x3ae275){return _0x3ae275['getDataValue'](_0x1be5('0xa2'))===_0x1be5('0x106');}),function(_0x4b271a){return db[_0x1be5('0xb4')][_0x1be5('0x3c')]({'where':{'VoiceQueueId':_0x4b271a['id'],'UserId':_0xa18fbc['id']},'transaction':_0x256a0f});});}else{return;}})[_0x1be5('0x3b')](function(){for(var _0x56ab49=0x0;_0x56ab49<_0x20a167[_0x1be5('0x69')];_0x56ab49++){var _0x353cb4=_0x20a167[_0x56ab49][_0x1be5('0x10f')](_0x1be5('0xa2'));var _0x25bf20=_0x353cb4+_0x1be5('0xac');socket[_0x1be5('0xad')](_0x1be5('0x93')+_0x353cb4+'Queue:remove',{'UserId':_0xa18fbc['id'],['queueField']:_0x20a167[_0x56ab49]['id']});}});});});}});}})[_0x1be5('0x3b')](respondWithStatusCode(_0x2045ef,null))[_0x1be5('0x2e')](handleError(_0x2045ef,null));};exports[_0x1be5('0x118')]=function(_0x2ce557,_0x4635b4,_0x24ec3e){var _0x4dbaa7={};var _0x25e36b={};var _0x4e7310;var _0x5d1e45;return db[_0x1be5('0x4b')][_0x1be5('0x99')]({'where':{'id':_0x2ce557[_0x1be5('0x68')]['id']}})[_0x1be5('0x3b')](handleEntityNotFound(_0x4635b4,null))['then'](function(_0x2bad27){if(_0x2bad27){_0x4e7310=_0x2bad27;_0x25e36b[_0x1be5('0x57')]=_[_0x1be5('0x54')](db['CmList'][_0x1be5('0x4c')]);_0x25e36b['query']=_[_0x1be5('0x54')](_0x2ce557[_0x1be5('0x53')]);_0x25e36b[_0x1be5('0x55')]=_['intersection'](_0x25e36b[_0x1be5('0x57')],_0x25e36b[_0x1be5('0x53')]);_0x4dbaa7['attributes']=_[_0x1be5('0x56')](_0x25e36b[_0x1be5('0x57')],qs[_0x1be5('0x59')](_0x2ce557[_0x1be5('0x53')][_0x1be5('0x59')]));_0x4dbaa7['attributes']=_0x4dbaa7['attributes'][_0x1be5('0x69')]?_0x4dbaa7['attributes']:_0x25e36b['model'];_0x4dbaa7['order']=qs[_0x1be5('0x5c')](_0x2ce557[_0x1be5('0x53')][_0x1be5('0x5c')]);_0x4dbaa7[_0x1be5('0x5d')]=qs[_0x1be5('0x55')](_[_0x1be5('0xc6')](_0x2ce557[_0x1be5('0x53')],_0x25e36b[_0x1be5('0x55')]));if(_0x2ce557[_0x1be5('0x53')][_0x1be5('0x42')]){_0x4dbaa7['where']=_[_0x1be5('0x5e')](_0x4dbaa7[_0x1be5('0x5d')],{'$or':_[_0x1be5('0x43')](_0x4dbaa7[_0x1be5('0x58')],function(_0x4f5097){var _0x5319b0={};_0x5319b0[_0x4f5097]={'$like':'%'+_0x2ce557[_0x1be5('0x53')][_0x1be5('0x42')]+'%'};return _0x5319b0;})});}_0x4dbaa7=_[_0x1be5('0x5e')]({},_0x4dbaa7,_0x2ce557['options']);return _0x4e7310[_0x1be5('0x118')](_0x4dbaa7);}})['then'](function(_0x242006){if(_0x242006){_0x5d1e45=_0x242006[_0x1be5('0x69')];if(!_0x2ce557[_0x1be5('0x53')][_0x1be5('0x5a')]('nolimit')){_0x4dbaa7[_0x1be5('0x35')]=qs[_0x1be5('0x35')](_0x2ce557[_0x1be5('0x53')]['limit']);_0x4dbaa7[_0x1be5('0x34')]=qs[_0x1be5('0x34')](_0x2ce557[_0x1be5('0x53')][_0x1be5('0x34')]);}return _0x4e7310[_0x1be5('0x118')](_0x4dbaa7);}})[_0x1be5('0x3b')](function(_0xb27016){if(_0xb27016){return _0xb27016?{'count':_0x5d1e45,'rows':_0xb27016}:null;}})[_0x1be5('0x3b')](respondWithResult(_0x4635b4,null))['catch'](handleError(_0x4635b4,null));};exports['getAgents']=function(_0x69816b,_0x1c4683,_0x190a04){var _0x23c722={};var _0x59f640={};var _0x4923b0;var _0x46be79;return db[_0x1be5('0x4b')][_0x1be5('0x99')]({'where':{'id':_0x69816b[_0x1be5('0x68')]['id']}})[_0x1be5('0x3b')](handleEntityNotFound(_0x1c4683,null))[_0x1be5('0x3b')](function(_0x19bbf5){if(_0x19bbf5){_0x4923b0=_0x19bbf5;_0x59f640[_0x1be5('0x57')]=_['keys'](db[_0x1be5('0x4b')][_0x1be5('0x4c')]);_0x59f640['query']=_['keys'](_0x69816b[_0x1be5('0x53')]);_0x59f640['filters']=_[_0x1be5('0x56')](_0x59f640[_0x1be5('0x57')],_0x59f640[_0x1be5('0x53')]);_0x23c722['attributes']=_[_0x1be5('0x56')](_0x59f640[_0x1be5('0x57')],qs['fields'](_0x69816b['query']['fields']));_0x23c722[_0x1be5('0x58')]=_0x23c722['attributes'][_0x1be5('0x69')]?_0x23c722[_0x1be5('0x58')]:_0x59f640[_0x1be5('0x57')];_0x23c722['order']=qs['sort'](_0x69816b[_0x1be5('0x53')]['sort']);_0x23c722[_0x1be5('0x5d')]=qs[_0x1be5('0x55')](_[_0x1be5('0xc6')](_0x69816b[_0x1be5('0x53')],_0x59f640[_0x1be5('0x55')]));if(_0x69816b[_0x1be5('0x53')][_0x1be5('0x42')]){_0x23c722['where']=_['merge'](_0x23c722[_0x1be5('0x5d')],{'$or':_[_0x1be5('0x43')](_0x23c722['attributes'],function(_0x381241){var _0xb794d9={};_0xb794d9[_0x381241]={'$like':'%'+_0x69816b[_0x1be5('0x53')][_0x1be5('0x42')]+'%'};return _0xb794d9;})});}_0x23c722[_0x1be5('0x57')]=db[_0x1be5('0x4b')];_0x23c722['as']=_0x1be5('0x3f');_0x23c722=_['merge']({},_0x23c722,_0x69816b[_0x1be5('0x62')]);return _0x4923b0[_0x1be5('0x111')]({'include':[_0x23c722]});}})[_0x1be5('0x3b')](function(_0x4b407f){if(_0x4b407f){var _0xceba90={},_0x5cb792=[],_0x251adc=0x0;for(var _0xf37311=0x0;_0xf37311<_0x4b407f[_0x1be5('0x69')];_0xf37311+=0x1){for(var _0x5a00ca=0x0,_0x197d27;_0x5a00ca<_0x4b407f[_0xf37311][_0x1be5('0x3f')]['length'];_0x5a00ca+=0x1){_0x197d27=_0x4b407f[_0xf37311]['Agents'][_0x5a00ca][_0x1be5('0x3d')]({'plain':!![]});_0xceba90[_0x197d27['id']]=_0x197d27;}}_0xceba90=_['values'](_0xceba90);for(var _0x32828b=qs[_0x1be5('0x34')](_0x69816b[_0x1be5('0x53')][_0x1be5('0x34')]);_0x32828b<_0xceba90[_0x1be5('0x69')]&&_0x5cb792[_0x1be5('0x69')]=_0x29229f){_0x23f68e=_0x29229f;_0x538866=0xc8;}else{_0x538866=0xce;}_0x598973[_0xdcef('0x30')](_0x538866);return _0x598973[_0xdcef('0x33')](_0xdcef('0x34'),_0x2ee1a3+'-'+_0x23f68e+'/'+_0x29229f)[_0xdcef('0x35')](_0x477478);}return null;};}function patchUpdates(_0x5d58e9){return function(_0x10df6b){try{jsonpatch[_0xdcef('0x36')](_0x10df6b,_0x5d58e9,!![]);}catch(_0x33672c){return BPromise['reject'](_0x33672c);}return _0x10df6b[_0xdcef('0x37')]();};}function saveUpdates(_0x6e7bc1,_0x4f85c8){return function(_0x4123b6){if(_0x4123b6){return _0x4123b6['update'](_0x6e7bc1)[_0xdcef('0x38')](function(_0x3c71a8){return _0x3c71a8;});}return null;};}function removeEntity(_0x13bec8,_0x364d73){return function(_0x36c629){if(_0x36c629){return _0x36c629['destroy']()['then'](function(){var _0x51d1aa=_0x36c629[_0xdcef('0x39')]({'plain':!![]});var _0xef2940=[{'name':_0xdcef('0x3a'),'value':_0xdcef('0x3b'),'ignore':!![]},{'name':'Agents','value':_0xdcef('0x3c'),'ignore':![]},{'name':_0xdcef('0x3d'),'value':_0xdcef('0x3e'),'ignore':![]}];var _0x117a26=_(_0xef2940)[_0xdcef('0x3f')](_0xdcef('0x40'))[_0xdcef('0x41')](_0xdcef('0x42'))[_0xdcef('0x42')]();if(_['includes'](_0x117a26,_0x51d1aa[_0xdcef('0x43')])){return;}var _0x14516d=_[_0xdcef('0x44')](_0xef2940,[_0xdcef('0x42'),_0x51d1aa['role']])[_0xdcef('0x45')];return db['UserProfileResource'][_0xdcef('0x46')]({'where':{'type':_0x14516d,'resourceId':_0x51d1aa['id']}})[_0xdcef('0x38')](function(){return _0x36c629;});})[_0xdcef('0x38')](function(){_0x13bec8[_0xdcef('0x30')](0xcc)[_0xdcef('0x2f')]();});}};}function handleEntityNotFound(_0x294bef,_0x270940){return function(_0x5a3efb){if(!_0x5a3efb){_0x294bef[_0xdcef('0x2e')](0x194);}return _0x5a3efb;};}function handleError(_0x28212b,_0x3c2ae0){_0x3c2ae0=_0x3c2ae0||0x1f4;return function(_0x51fee9){logger['error'](_0x51fee9[_0xdcef('0x47')]);if(_0x51fee9[_0xdcef('0x45')]){delete _0x51fee9['name'];}_0x28212b[_0xdcef('0x30')](_0x3c2ae0)[_0xdcef('0x48')](_0x51fee9);};}exports[_0xdcef('0x49')]=function(_0x2f89b5,_0x32655a){var _0x2b1f39={},_0x207467={},_0x4d1a9b={'count':0x0,'rows':[]};var _0x550ac1=_[_0xdcef('0x41')](db[_0xdcef('0x4a')]['rawAttributes'],function(_0x5e525f){return{'name':_0x5e525f[_0xdcef('0x4b')],'type':_0x5e525f['type'][_0xdcef('0x4c')]};});_0x207467[_0xdcef('0x4d')]=_[_0xdcef('0x4e')](_[_0xdcef('0x41')](_0x550ac1,'name'),[_0xdcef('0x4f'),_0xdcef('0x50')]);_0x207467[_0xdcef('0x51')]=_[_0xdcef('0x52')](_0x2f89b5[_0xdcef('0x51')]);_0x207467[_0xdcef('0x53')]=_['intersection'](_0x207467[_0xdcef('0x4d')],_0x207467[_0xdcef('0x51')]);_0x2b1f39['attributes']=_[_0xdcef('0x54')](_0x207467[_0xdcef('0x4d')],qs['fields'](_0x2f89b5[_0xdcef('0x51')]['fields']));_0x2b1f39[_0xdcef('0x55')]=_0x2b1f39[_0xdcef('0x55')]['length']?_0x2b1f39[_0xdcef('0x55')]:_0x207467['model'];if(!_0x2f89b5[_0xdcef('0x51')]['hasOwnProperty'](_0xdcef('0x56'))){_0x2b1f39[_0xdcef('0x32')]=qs[_0xdcef('0x32')](_0x2f89b5[_0xdcef('0x51')][_0xdcef('0x32')]);_0x2b1f39[_0xdcef('0x31')]=qs['offset'](_0x2f89b5['query'][_0xdcef('0x31')]);}_0x2b1f39['order']=qs[_0xdcef('0x57')](_0x2f89b5['query'][_0xdcef('0x57')]);_0x2b1f39['where']=qs[_0xdcef('0x53')](_[_0xdcef('0x58')](_0x2f89b5[_0xdcef('0x51')],_0x207467['filters']));if(_0x2f89b5['query'][_0xdcef('0x3f')]){_0x2b1f39[_0xdcef('0x59')]=_[_0xdcef('0x5a')](_0x2b1f39[_0xdcef('0x59')],{'$or':_[_0xdcef('0x41')](_0x550ac1,function(_0x41b5cb){if(_0x41b5cb[_0xdcef('0x5b')]!=='VIRTUAL'){return db[_0xdcef('0x5c')][_0xdcef('0x59')](db[_0xdcef('0x5c')]['fn']('lower',db[_0xdcef('0x5c')][_0xdcef('0x5d')](_0x41b5cb[_0xdcef('0x45')])),{'$like':db['sequelize']['fn'](_0xdcef('0x5e'),'%'+_0x2f89b5[_0xdcef('0x51')][_0xdcef('0x3f')]+'%')});}})});}_0x2b1f39=_[_0xdcef('0x5a')]({},_0x2b1f39,_0x2f89b5[_0xdcef('0x5f')]);var _0x2f6b79={'where':_0x2b1f39[_0xdcef('0x59')]};return db[_0xdcef('0x4a')]['count'](_0x2f6b79)[_0xdcef('0x38')](function(_0xb58fa){_0x4d1a9b[_0xdcef('0x60')]=_0xb58fa;if(_0x2f89b5[_0xdcef('0x51')][_0xdcef('0x61')]){_0x2b1f39[_0xdcef('0x62')]=[{'all':!![]}];}return db[_0xdcef('0x4a')][_0xdcef('0x63')](_0x2b1f39);})['then'](function(_0x45b3ef){_0x4d1a9b['rows']=_0x45b3ef;return _0x4d1a9b;})[_0xdcef('0x38')](respondWithFilteredResult(_0x32655a,_0x2b1f39))[_0xdcef('0x2d')](handleError(_0x32655a,null));};exports[_0xdcef('0x64')]=function(_0x512a3d,_0xac00ca){var _0x4b1951={'raw':![],'where':{'id':_0x512a3d[_0xdcef('0x65')]['id']}},_0x9b9bb5={};_0x9b9bb5[_0xdcef('0x4d')]=_['differenceBy'](_[_0xdcef('0x52')](db['User'][_0xdcef('0x66')]),[_0xdcef('0x4f'),_0xdcef('0x50')]);_0x9b9bb5[_0xdcef('0x51')]=_[_0xdcef('0x52')](_0x512a3d[_0xdcef('0x51')]);_0x9b9bb5['filters']=_[_0xdcef('0x54')](_0x9b9bb5[_0xdcef('0x4d')],_0x9b9bb5[_0xdcef('0x51')]);_0x4b1951[_0xdcef('0x55')]=_[_0xdcef('0x54')](_0x9b9bb5[_0xdcef('0x4d')],qs[_0xdcef('0x67')](_0x512a3d['query']['fields']));_0x4b1951[_0xdcef('0x55')]=_0x4b1951[_0xdcef('0x55')][_0xdcef('0x68')]?_0x4b1951[_0xdcef('0x55')]:_0x9b9bb5['model'];if(_0x512a3d['query']['includeAll']){_0x4b1951[_0xdcef('0x62')]=[{'all':!![]}];}_0x4b1951=_[_0xdcef('0x5a')]({},_0x4b1951,_0x512a3d[_0xdcef('0x5f')]);return db[_0xdcef('0x4a')][_0xdcef('0x44')](_0x4b1951)[_0xdcef('0x38')](handleEntityNotFound(_0xac00ca,null))['then'](respondWithResult(_0xac00ca,null))[_0xdcef('0x2d')](handleError(_0xac00ca,null));};exports[_0xdcef('0x69')]=function(_0x99cbb4,_0x3eca5b){return db[_0xdcef('0x4a')][_0xdcef('0x69')](_0x99cbb4[_0xdcef('0x6a')],{'raw':![],'individualHooks':!![]})[_0xdcef('0x38')](respondWithResult(_0x3eca5b,0xc9))['catch'](handleError(_0x3eca5b,null));};exports['update']=function(_0x255dd5,_0x5fb379){if(_0x255dd5['body']['id']){delete _0x255dd5[_0xdcef('0x6a')]['id'];}delete _0x255dd5[_0xdcef('0x6a')][_0xdcef('0x43')];return db[_0xdcef('0x4a')][_0xdcef('0x44')]({'where':{'id':_0x255dd5[_0xdcef('0x65')]['id']}})[_0xdcef('0x38')](handleEntityNotFound(_0x5fb379,null))['then'](saveUpdates(_0x255dd5['body'],null))['then'](respondWithResult(_0x5fb379,null))[_0xdcef('0x2d')](handleError(_0x5fb379,null));};exports['describe']=function(_0x44521e,_0xcbef15){return db['User']['describe']()[_0xdcef('0x38')](respondWithResult(_0xcbef15,null))[_0xdcef('0x2d')](handleError(_0xcbef15,null));};exports[_0xdcef('0x6b')]=function(_0x181293,_0x17f25e,_0x174626){return db[_0xdcef('0x4a')][_0xdcef('0x44')]({'where':{'id':_0x181293['params']['id']}})[_0xdcef('0x38')](handleEntityNotFound(_0x17f25e,null))[_0xdcef('0x38')](function(_0x3f8857){if(_0x3f8857){return _0x3f8857[_0xdcef('0x6b')](_0x181293['body'][_0xdcef('0x6c')],_['omit'](_0x181293['body'],['ids','id'])||{});}})[_0xdcef('0x38')](respondWithResult(_0x17f25e,null))[_0xdcef('0x2d')](handleError(_0x17f25e,null));};var getLicense=function(_0x1185dc){return new BPromise(function(_0x5edcf8,_0x243b90){var _0x49c23a=0x0;_0x1185dc[_0xdcef('0x6a')][_0xdcef('0x43')]===_0xdcef('0x3c')&&_0x5edcf8(_0xdcef('0x6d'));return db[_0xdcef('0x4a')]['count']({'where':{'$or':[{'role':_0x1185dc['body'][_0xdcef('0x43')]==='telephone'?'telephone':[_0xdcef('0x6e'),_0xdcef('0x3b')]}]}})[_0xdcef('0x38')](function(_0x53eb6a){_0x49c23a=_0x53eb6a;return require(_0xdcef('0x6f'))['getLicense']();})[_0xdcef('0x38')](function(_0x2b605a){var _0x280117=_0x1185dc['body'][_0xdcef('0x43')]===_0xdcef('0x3e')?'telephones':_0xdcef('0x70');if(!_[_0xdcef('0x71')](_0x2b605a[_0x280117])&&_0x49c23a>=_0x2b605a[_0x280117]){return _0x243b90({'message':_0xdcef('0x72')});}return _0x5edcf8(util[_0xdcef('0x73')](_0xdcef('0x74'),_0x280117,_0x49c23a));})[_0xdcef('0x2d')](function(_0x3e3ecb){return _0x243b90(_0x3e3ecb);});});};exports[_0xdcef('0x75')]=function(_0x4b852f,_0x5d1e9c){return getLicense(_0x4b852f)['then'](function(_0x482632){if(!_0x4b852f[_0xdcef('0x6a')][_0xdcef('0x76')]){var _0x593489;return db[_0xdcef('0x77')][_0xdcef('0x78')](0x1)['then'](function(_0x39e0f7){return checkPasswordPattern(_0x39e0f7,_0x4b852f[_0xdcef('0x6a')][_0xdcef('0x4f')],_0x39e0f7[_0xdcef('0x79')]);})[_0xdcef('0x38')](function(_0x202964){_0x593489=_0x202964[_0xdcef('0x7a')];return db[_0xdcef('0x4a')][_0xdcef('0x7b')]('internal');})['then'](function(_0x3cf13b){if(_[_0xdcef('0x71')](_0x3cf13b)){if(_0x593489){_0x4b852f[_0xdcef('0x6a')][_0xdcef('0x76')]=_0x593489;}else{_0x4b852f['body'][_0xdcef('0x76')]=0x1;}}else{if(_[_0xdcef('0x71')](_0x593489)||_0x593489==_0x3cf13b){_0x4b852f[_0xdcef('0x6a')]['internal']=_0x3cf13b+0x1;}else if(_0x593489>_0x3cf13b){_0x4b852f[_0xdcef('0x6a')][_0xdcef('0x76')]=_0x593489;}else{return db[_0xdcef('0x5c')]['query'](_0xdcef('0x7c'),{'type':db[_0xdcef('0x5c')][_0xdcef('0x7d')][_0xdcef('0x7e')]})[_0xdcef('0x38')](function(_0x24ec42){if(_0x24ec42&&_0x24ec42[_0xdcef('0x68')]){for(var _0x1e1684=0x0,_0x133878=_0x24ec42[_0xdcef('0x68')];_0x1e1684<_0x133878&&_[_0xdcef('0x71')](_0x4b852f['body']['internal']);_0x1e1684++){if(_0x593489<=_0x24ec42[_0x1e1684][_0xdcef('0x7f')]){_0x4b852f[_0xdcef('0x6a')][_0xdcef('0x76')]=_0x24ec42[_0x1e1684]['from'];}else if(_0x593489>_0x24ec42[_0x1e1684]['from']&&_0x593489<=_0x24ec42[_0x1e1684]['to']){_0x4b852f[_0xdcef('0x6a')][_0xdcef('0x76')]=_0x593489;}}}if(_[_0xdcef('0x71')](_0x4b852f[_0xdcef('0x6a')]['internal'])){_0x4b852f[_0xdcef('0x6a')][_0xdcef('0x76')]=_0x3cf13b+0x1;}});}}});}})[_0xdcef('0x38')](function(){if(_0x4b852f[_0xdcef('0x6a')][_0xdcef('0x80')]){_0x4b852f[_0xdcef('0x6a')][_0xdcef('0x81')]=_0x4b852f[_0xdcef('0x6a')][_0xdcef('0x76')];_0x4b852f[_0xdcef('0x6a')]['VoiceMail']={'mailbox':_0x4b852f[_0xdcef('0x6a')][_0xdcef('0x76')],'password':_0x4b852f[_0xdcef('0x6a')][_0xdcef('0x4f')],'fullname':_0x4b852f[_0xdcef('0x6a')][_0xdcef('0x82')],'email':_0x4b852f[_0xdcef('0x6a')]['email']};}if(_0x4b852f[_0xdcef('0x6a')]&&_0x4b852f[_0xdcef('0x6a')]['role']===_0xdcef('0x3c')){_0x4b852f[_0xdcef('0x6a')]['permissions']=['101',_0xdcef('0x83'),_0xdcef('0x84'),_0xdcef('0x85'),'104','105','106',_0xdcef('0x86'),'108','109','100',_0xdcef('0x87')];}return db[_0xdcef('0x4a')][_0xdcef('0x75')](_0x4b852f[_0xdcef('0x6a')],{'include':[{'model':db[_0xdcef('0x88')],'as':_0xdcef('0x88')}]});})[_0xdcef('0x38')](function(_0x419872){if(_0x4b852f[_0xdcef('0x6a')][_0xdcef('0x43')]==='user')return _0x419872;var _0x213073=_0x4b852f[_0xdcef('0x3b')][_0xdcef('0x39')]({'plain':!![]});if(!_0x213073)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x213073[_0xdcef('0x43')]===_0xdcef('0x3b')){var _0x40c69c=_0x419872[_0xdcef('0x39')]({'plain':!![]});var _0xf998c0=[{'name':_0xdcef('0x89'),'value':_0xdcef('0x3c')},{'name':_0xdcef('0x3d'),'value':_0xdcef('0x3e')}];var _0x221cf7=_[_0xdcef('0x44')](_0xf998c0,['value',_0x40c69c['role']])['name'];return db[_0xdcef('0x8a')]['find']({'where':{'name':_0x221cf7,'userProfileId':_0x213073['userProfileId']},'raw':!![]})[_0xdcef('0x38')](function(_0x2b0358){if(_0x2b0358&&_0x2b0358['autoAssociation']===0x0){return db[_0xdcef('0x8b')][_0xdcef('0x75')]({'name':_0x40c69c[_0xdcef('0x45')],'resourceId':_0x40c69c['id'],'type':_0x2b0358['name'],'sectionId':_0x2b0358['id']},{})['then'](function(){return _0x419872;});}else{return _0x419872;}})[_0xdcef('0x2d')](function(_0x320ab0){logger[_0xdcef('0x29')](_0xdcef('0x8c'),_0x320ab0);throw _0x320ab0;});}return _0x419872;})['then'](respondWithResult(_0x5d1e9c,0xc9))[_0xdcef('0x2d')](handleError(_0x5d1e9c,null));};exports[_0xdcef('0x8d')]=function(_0x231359,_0x14a000,_0x28e839){var _0x74e9ef=![];if(_0x231359['body']['id']){delete _0x231359[_0xdcef('0x6a')]['id'];}return db[_0xdcef('0x77')][_0xdcef('0x8e')]({'attributes':['id',_0xdcef('0x79')]})['then'](function(_0x10b368){_0x74e9ef=_0x10b368[_0xdcef('0x79')];return db[_0xdcef('0x4a')][_0xdcef('0x44')]({'where':{'id':_0x231359[_0xdcef('0x65')]['id']}});})['then'](function(_0x557121){if(_0x557121){if(_0x557121['id']==_0x231359[_0xdcef('0x3b')]['id']){if(!_0x231359[_0xdcef('0x6a')]['oldPassword']||!_0x231359[_0xdcef('0x6a')]['newPassword']){throw new db[(_0xdcef('0x8f'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword');}if(!_0x557121[_0xdcef('0x90')](_0x231359[_0xdcef('0x6a')][_0xdcef('0x91')])){throw new db['Sequelize'][(_0xdcef('0x92'))](_0xdcef('0x93'));}if(_0x231359[_0xdcef('0x6a')]['oldPassword']==_0x231359[_0xdcef('0x6a')]['newPassword']){throw new db[(_0xdcef('0x8f'))][(_0xdcef('0x92'))](_0xdcef('0x94'));}return _0x557121;}else if(_0x231359[_0xdcef('0x3b')][_0xdcef('0x43')]==_0xdcef('0x6e')){if(!_0x231359[_0xdcef('0x6a')]['newPassword']){throw new db[(_0xdcef('0x8f'))][(_0xdcef('0x92'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}return _0x557121;}else if(_0x231359[_0xdcef('0x3b')]['role']==_0xdcef('0x3b')){if(!_0x231359[_0xdcef('0x6a')][_0xdcef('0x95')]){throw new db[(_0xdcef('0x8f'))][(_0xdcef('0x92'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x557121[_0xdcef('0x43')]!=_0xdcef('0x3c')){throw new db['Sequelize'][(_0xdcef('0x92'))](_0xdcef('0x96'));}return _0x557121;}else{throw new db[(_0xdcef('0x8f'))][(_0xdcef('0x92'))]('Unauthorized');}}return null;})[_0xdcef('0x38')](handleEntityNotFound(_0x14a000,null))[_0xdcef('0x38')](function(_0x5b7ac7){return checkPasswordPattern(_0x5b7ac7,_0x231359[_0xdcef('0x6a')]['newPassword'],_0x74e9ef);})['then'](saveUpdates({'password':_0x231359[_0xdcef('0x6a')]['newPassword'],'passwordResetAt':_0x231359[_0xdcef('0x3b')]['id']==_0x231359[_0xdcef('0x65')]['id']?moment():null},null))[_0xdcef('0x38')](respondWithResult(_0x14a000,null))['catch'](handleError(_0x14a000,null));};exports[_0xdcef('0x97')]=function(_0x2052d4,_0x13ea60,_0x5d0fd8){var _0x1709f5=_0x2052d4[_0xdcef('0x6a')][_0xdcef('0x98')];return db[_0xdcef('0x4a')][_0xdcef('0x44')]({'where':{'id':_0x2052d4[_0xdcef('0x65')]['id']},'attributes':['id',_0xdcef('0x45'),_0xdcef('0x43'),_0xdcef('0x99'),_0xdcef('0x9a'),_0xdcef('0x9b'),_0xdcef('0x9c')]})[_0xdcef('0x38')](handleEntityNotFound(_0x13ea60,null))[_0xdcef('0x38')](function(_0x52bb9c){if(_0x52bb9c){if(!utils['isValidChannel'](_0x1709f5)){throw new db['Sequelize'][(_0xdcef('0x92'))](_0xdcef('0x9d'));}return _0x52bb9c[_0xdcef('0x9e')+_[_0xdcef('0x9f')](_0x1709f5[_0xdcef('0xa0')]())+_0xdcef('0xa1')](_0x2052d4['body'][_0xdcef('0x6c')],{'penalty':_0x2052d4['body'][_0xdcef('0xa2')]||0x0})['spread'](function(_0x59408d){for(var _0xee6502=0x0;_0xee6502<_0x2052d4[_0xdcef('0x6a')]['ids']['length'];_0xee6502+=0x1){var _0x30f125={'UserId':_0x2052d4[_0xdcef('0x65')]['id']};_0x30f125[_[_0xdcef('0x9f')](_0x1709f5['toLowerCase']())+_0xdcef('0xa3')]=_0x2052d4['body'][_0xdcef('0x6c')][_0xee6502];socket[_0xdcef('0xa4')](_0xdcef('0x3b')+_[_0xdcef('0x9f')](_0x1709f5['toLowerCase']())+_0xdcef('0xa5'),_0x30f125);}return _0x59408d;})['then'](function(){if(_0x1709f5===_0xdcef('0xa6')){return db[_0xdcef('0xa7')][_0xdcef('0x63')]({'where':{'id':_0x2052d4[_0xdcef('0x6a')][_0xdcef('0x6c')]||[]},'raw':!![],'attributes':['id',_0xdcef('0x45')]});}})['then'](function(_0x1175ca){var _0x4ebb87=_0x52bb9c[_0xdcef('0x39')]({'plain':!![]});var _0x5abf74=[];if(_0x1709f5===_0xdcef('0xa6')&&_0x4ebb87[_0xdcef('0x43')]==='agent'&&_0x4ebb87[_0xdcef('0x99')]){for(var _0x2370c9=0x0;_0x2370c9<_0x1175ca[_0xdcef('0x68')];_0x2370c9+=0x1){_0x5abf74['push']({'membername':_0x4ebb87[_0xdcef('0x45')],'UserId':_0x4ebb87['id'],'queue_name':_0x1175ca[_0x2370c9]['name'],'VoiceQueueId':_0x1175ca[_0x2370c9]['id'],'interface':_[_0xdcef('0x71')](_0x4ebb87['interface'])?util[_0xdcef('0x73')](_0xdcef('0xa8'),_0x4ebb87[_0xdcef('0x45')]):_0x4ebb87[_0xdcef('0x9c')],'paused':_0x4ebb87[_0xdcef('0x9b')]||![],'penalty':_0x2052d4[_0xdcef('0x6a')][_0xdcef('0xa2')]||0x0});}return BPromise['each'](_0x5abf74,function(_0x458d08){return db[_0xdcef('0xa9')][_0xdcef('0xaa')](_0x458d08);});}return _0x52bb9c;});}})[_0xdcef('0x38')](respondWithStatusCode(_0x13ea60,null))[_0xdcef('0x2d')](handleError(_0x13ea60,null));};exports['removeQueues']=function(_0x30111e,_0x75d46b,_0x16b7e2){var _0x5ac3d7;return db[_0xdcef('0x4a')][_0xdcef('0x44')]({'where':{'id':_0x30111e[_0xdcef('0x65')]['id']},'attributes':['id',_0xdcef('0x45'),_0xdcef('0x43')]})[_0xdcef('0x38')](handleEntityNotFound(_0x75d46b,null))['then'](function(_0x44c278){if(_0x44c278){_0x5ac3d7=_0x44c278;if(!_0x30111e[_0xdcef('0x51')][_0xdcef('0x98')]||!utils['isValidChannel'](_0x30111e[_0xdcef('0x51')][_0xdcef('0x98')])){throw new db[(_0xdcef('0x8f'))]['ValidationError'](_0xdcef('0x9d'));}return _0x44c278[_0xdcef('0xab')+_[_0xdcef('0x9f')](_0x30111e['query'][_0xdcef('0x98')][_0xdcef('0xa0')]())+_0xdcef('0xa1')](_0x30111e[_0xdcef('0x51')][_0xdcef('0x6c')]);}})[_0xdcef('0x38')](function(_0x5cf6a5){for(var _0x2f63d6=0x0;_0x2f63d6<_0x30111e[_0xdcef('0x51')]['ids'][_0xdcef('0x68')];_0x2f63d6+=0x1){var _0x1860a2={'UserId':_0x30111e['params']['id']};_0x1860a2[_[_0xdcef('0x9f')](_0x30111e['query'][_0xdcef('0x98')][_0xdcef('0xa0')]())+_0xdcef('0xa3')]=_0x30111e[_0xdcef('0x51')]['ids'][_0x2f63d6];socket[_0xdcef('0xa4')](_0xdcef('0x3b')+_['capitalize'](_0x30111e[_0xdcef('0x51')][_0xdcef('0x98')][_0xdcef('0xa0')]())+_0xdcef('0xac'),_0x1860a2);}return _0x5cf6a5;})[_0xdcef('0x38')](function(){if(_0x30111e['query']['channel']===_0xdcef('0xa6')){return db[_0xdcef('0xa9')]['destroy']({'where':{'UserId':_0x30111e['params']['id'],'VoiceQueueId':_0x30111e[_0xdcef('0x51')][_0xdcef('0x6c')]},'individualHooks':!![]})[_0xdcef('0x38')](function(){return _0x5ac3d7;});}return _0x5ac3d7;})[_0xdcef('0x38')](respondWithStatusCode(_0x75d46b,null))[_0xdcef('0x2d')](handleError(_0x75d46b,null));};exports[_0xdcef('0xad')]=function(_0x91a8fc,_0x7e48c5,_0x26eefe){_0x91a8fc[_0xdcef('0x6a')][_0xdcef('0xae')]=_0x91a8fc[_0xdcef('0xaf')][_0xdcef('0xb0')];return db[_0xdcef('0x4a')]['find']({'where':{'id':_0x91a8fc[_0xdcef('0x65')]['id']}})[_0xdcef('0x38')](handleEntityNotFound(_0x7e48c5,null))[_0xdcef('0x38')](saveUpdates(_0x91a8fc['body'],null))[_0xdcef('0x38')](respondWithResult(_0x7e48c5,null))[_0xdcef('0x2d')](handleError(_0x7e48c5,null));};exports[_0xdcef('0xb1')]=function(_0x4e3423,_0x2bb59e,_0x1ed804){var _0x3ed587=path['join'](config[_0xdcef('0xb2')],_0xdcef('0xb3'));return db[_0xdcef('0x4a')]['find']({'where':{'id':_0x4e3423[_0xdcef('0x65')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0xdcef('0x38')](handleEntityNotFound(_0x2bb59e,null))[_0xdcef('0x38')](function(_0x442414){if(_0x442414){if(_[_0xdcef('0x71')](_0x442414[_0xdcef('0xae')])){return _0x2bb59e[_0xdcef('0xb4')](_0x3ed587);}else{if(!fs['existsSync'](path['join'](config[_0xdcef('0xb2')],_0xdcef('0xb5'),_0x442414[_0xdcef('0xae')]))){return _0x2bb59e[_0xdcef('0xb4')](_0x3ed587);}return _0x2bb59e['download'](path[_0xdcef('0xb6')](config[_0xdcef('0xb2')],_0xdcef('0xb5'),_0x442414['userpic']));}}})[_0xdcef('0x2d')](handleError(_0x2bb59e,null));};exports[_0xdcef('0xb7')]=function(_0x94ef09,_0x48dd98,_0x47c765){var _0x6003f7={};var _0x1b56f1={};var _0x2174f4;var _0x112cb9;return db[_0xdcef('0x4a')][_0xdcef('0x8e')]({'where':{'id':_0x94ef09[_0xdcef('0x65')]['id']}})[_0xdcef('0x38')](handleEntityNotFound(_0x48dd98,null))['then'](function(_0x49c32b){if(_0x49c32b){_0x2174f4=_0x49c32b;_0x1b56f1[_0xdcef('0x4d')]=_[_0xdcef('0x52')](db[_0xdcef('0xb8')][_0xdcef('0x66')]);_0x1b56f1['query']=_['keys'](_0x94ef09['query']);_0x1b56f1['filters']=_[_0xdcef('0x54')](_0x1b56f1[_0xdcef('0x4d')],_0x1b56f1[_0xdcef('0x51')]);_0x6003f7[_0xdcef('0x55')]=_[_0xdcef('0x54')](_0x1b56f1[_0xdcef('0x4d')],qs['fields'](_0x94ef09[_0xdcef('0x51')][_0xdcef('0x67')]));_0x6003f7[_0xdcef('0x55')]=_0x6003f7[_0xdcef('0x55')][_0xdcef('0x68')]?_0x6003f7[_0xdcef('0x55')]:_0x1b56f1[_0xdcef('0x4d')];_0x6003f7[_0xdcef('0xb9')]=qs[_0xdcef('0x57')](_0x94ef09[_0xdcef('0x51')][_0xdcef('0x57')]);_0x6003f7[_0xdcef('0x59')]=qs['filters'](_[_0xdcef('0x58')](_0x94ef09[_0xdcef('0x51')],_0x1b56f1[_0xdcef('0x53')]));if(_0x94ef09[_0xdcef('0x51')][_0xdcef('0x3f')]){_0x6003f7['where']=_[_0xdcef('0x5a')](_0x6003f7['where'],{'$or':_[_0xdcef('0x41')](_0x6003f7['attributes'],function(_0x344ea8){var _0x18b3c0={};_0x18b3c0[_0x344ea8]={'$like':'%'+_0x94ef09[_0xdcef('0x51')][_0xdcef('0x3f')]+'%'};return _0x18b3c0;})});}_0x6003f7=_[_0xdcef('0x5a')]({},_0x6003f7,_0x94ef09[_0xdcef('0x5f')]);return _0x2174f4[_0xdcef('0xb7')](_0x6003f7);}})['then'](function(_0x5ed350){if(_0x5ed350){_0x112cb9=_0x5ed350[_0xdcef('0x68')];if(_0x94ef09['query'][_0xdcef('0xba')](_0xdcef('0x61'))){_0x6003f7[_0xdcef('0x62')]=[{'model':db[_0xdcef('0xbb')],'as':_0xdcef('0xbc'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xdcef('0x45'),'color'],'where':_0x94ef09[_0xdcef('0x51')][_0xdcef('0xbd')]?{'id':_0x94ef09[_0xdcef('0x51')][_0xdcef('0xbd')]}:undefined,'required':_0x94ef09[_0xdcef('0x51')][_0xdcef('0xbd')]?!![]:![]}];}if(!_0x94ef09[_0xdcef('0x51')]['hasOwnProperty'](_0xdcef('0x56'))){_0x6003f7[_0xdcef('0x32')]=qs[_0xdcef('0x32')](_0x94ef09[_0xdcef('0x51')][_0xdcef('0x32')]);_0x6003f7[_0xdcef('0x31')]=qs[_0xdcef('0x31')](_0x94ef09[_0xdcef('0x51')][_0xdcef('0x31')]);}return _0x2174f4['getContacts'](_0x6003f7);}})[_0xdcef('0x38')](function(_0x29276f){if(_0x29276f){return _0x29276f?{'count':_0x112cb9,'rows':_0x29276f}:null;}})[_0xdcef('0x38')](respondWithResult(_0x48dd98,null))[_0xdcef('0x2d')](handleError(_0x48dd98,null));};exports[_0xdcef('0xbe')]=function(_0x306732,_0x2276b8,_0x50b2c6){var _0x345db5;var _0x47d637;var _0x40386e={};var _0x173541;return db[_0xdcef('0x4a')][_0xdcef('0x8e')]({'where':{'id':_0x306732[_0xdcef('0x65')]['id']},'attributes':['id',_0xdcef('0x45'),_0xdcef('0x43')]})['then'](handleEntityNotFound(_0x2276b8,null))[_0xdcef('0x38')](function(_0x5f4294){if(!utils[_0xdcef('0xbf')](_0x306732[_0xdcef('0x51')][_0xdcef('0x98')])){throw new db[(_0xdcef('0x8f'))][(_0xdcef('0x92'))](_0xdcef('0x9d'));}_0x345db5=_0x5f4294;var _0x51af39={};_0x51af39[_0xdcef('0x4d')]=_[_0xdcef('0x52')](db[_[_0xdcef('0x9f')](_0x306732['query'][_0xdcef('0x98')])+_0xdcef('0xc0')][_0xdcef('0x66')]);_0x51af39[_0xdcef('0x51')]=_[_0xdcef('0x52')](_0x306732[_0xdcef('0x51')]);_0x51af39[_0xdcef('0x53')]=_[_0xdcef('0x54')](_0x51af39[_0xdcef('0x4d')],_0x51af39[_0xdcef('0x51')]);_0x40386e[_0xdcef('0x55')]=_[_0xdcef('0x54')](_0x51af39[_0xdcef('0x4d')],qs['fields'](_0x306732[_0xdcef('0x51')][_0xdcef('0x67')]));_0x40386e['attributes']=_0x40386e[_0xdcef('0x55')][_0xdcef('0x68')]?_0x40386e['attributes']:_0x51af39[_0xdcef('0x4d')];_0x40386e['order']=qs[_0xdcef('0x57')](_0x306732[_0xdcef('0x51')]['sort']);_0x40386e[_0xdcef('0x59')]=qs['filters'](_[_0xdcef('0x58')](_0x306732[_0xdcef('0x51')],_0x51af39[_0xdcef('0x53')]));if(_0x306732['query'][_0xdcef('0x3f')]){_0x40386e[_0xdcef('0x59')]=_[_0xdcef('0x5a')](_0x40386e[_0xdcef('0x59')],{'$or':_['map'](_0x40386e[_0xdcef('0x55')],function(_0x16e8ad){var _0x57aa69={};_0x57aa69[_0x16e8ad]={'$like':'%'+_0x306732[_0xdcef('0x51')][_0xdcef('0x3f')]+'%'};return _0x57aa69;})});}_0x40386e=_[_0xdcef('0x5a')]({},_0x40386e,_0x306732['options']);switch(_0x345db5[_0xdcef('0x43')]){case _0xdcef('0x6e'):return db[_[_0xdcef('0x9f')](_0x306732[_0xdcef('0x51')][_0xdcef('0x98')])+'Queue']['findAll'](_0x40386e);case'user':case _0xdcef('0x3c'):return _0x345db5[_0xdcef('0x39')+_[_0xdcef('0x9f')](_0x306732['query'][_0xdcef('0x98')])+_0xdcef('0xa1')](_0x40386e);default:throw new db[(_0xdcef('0x8f'))][(_0xdcef('0x92'))](_0xdcef('0xc1'));}})[_0xdcef('0x38')](function(_0x35e94d){_0x173541=_0x35e94d[_0xdcef('0x68')];if(!_0x306732[_0xdcef('0x51')][_0xdcef('0xba')]('nolimit')){_0x40386e['limit']=qs[_0xdcef('0x32')](_0x306732[_0xdcef('0x51')]['limit']);_0x40386e[_0xdcef('0x31')]=qs[_0xdcef('0x31')](_0x306732[_0xdcef('0x51')][_0xdcef('0x31')]);}switch(_0x345db5[_0xdcef('0x43')]){case _0xdcef('0x6e'):return db[_[_0xdcef('0x9f')](_0x306732[_0xdcef('0x51')][_0xdcef('0x98')])+_0xdcef('0xc0')][_0xdcef('0x63')](_0x40386e);case'user':case _0xdcef('0x3c'):return _0x345db5[_0xdcef('0x39')+_[_0xdcef('0x9f')](_0x306732['query']['channel'])+_0xdcef('0xa1')](_0x40386e);}})[_0xdcef('0x38')](function(_0x55ec43){return{'count':_0x173541,'rows':_0x55ec43};})[_0xdcef('0x38')](respondWithResult(_0x2276b8,null))[_0xdcef('0x2d')](handleError(_0x2276b8,null));};exports['getVoiceQueuesRt']=function(_0xecce62,_0x1327ce,_0x342be8){var _0x1a8757={};var _0x2f2b50={};var _0x49a085;var _0x18cf44;return db[_0xdcef('0x4a')]['findOne']({'where':{'id':_0xecce62[_0xdcef('0x65')]['id']}})[_0xdcef('0x38')](handleEntityNotFound(_0x1327ce,null))[_0xdcef('0x38')](function(_0x5c370f){if(_0x5c370f){_0x49a085=_0x5c370f;_0x2f2b50[_0xdcef('0x4d')]=_['keys'](db[_0xdcef('0xa9')][_0xdcef('0x66')]);_0x2f2b50[_0xdcef('0x51')]=_['keys'](_0xecce62[_0xdcef('0x51')]);_0x2f2b50[_0xdcef('0x53')]=_[_0xdcef('0x54')](_0x2f2b50['model'],_0x2f2b50[_0xdcef('0x51')]);_0x1a8757['attributes']=_[_0xdcef('0x54')](_0x2f2b50[_0xdcef('0x4d')],qs[_0xdcef('0x67')](_0xecce62[_0xdcef('0x51')]['fields']));_0x1a8757[_0xdcef('0x55')]=_0x1a8757[_0xdcef('0x55')][_0xdcef('0x68')]?_0x1a8757[_0xdcef('0x55')]:_0x2f2b50[_0xdcef('0x4d')];_0x1a8757['order']=qs[_0xdcef('0x57')](_0xecce62[_0xdcef('0x51')]['sort']);_0x1a8757[_0xdcef('0x59')]=qs[_0xdcef('0x53')](_[_0xdcef('0x58')](_0xecce62[_0xdcef('0x51')],_0x2f2b50[_0xdcef('0x53')]));if(_0xecce62[_0xdcef('0x51')][_0xdcef('0x3f')]){_0x1a8757['where']=_[_0xdcef('0x5a')](_0x1a8757[_0xdcef('0x59')],{'$or':_[_0xdcef('0x41')](_0x1a8757[_0xdcef('0x55')],function(_0x296187){var _0x3bd567={};_0x3bd567[_0x296187]={'$like':'%'+_0xecce62[_0xdcef('0x51')][_0xdcef('0x3f')]+'%'};return _0x3bd567;})});}_0x1a8757=_['merge']({},_0x1a8757,_0xecce62[_0xdcef('0x5f')]);return _0x49a085['getVoiceQueuesRt'](_0x1a8757);}})[_0xdcef('0x38')](function(_0x2cc370){if(_0x2cc370){_0x18cf44=_0x2cc370[_0xdcef('0x68')];if(!_0xecce62[_0xdcef('0x51')]['hasOwnProperty'](_0xdcef('0x56'))){_0x1a8757[_0xdcef('0x32')]=qs[_0xdcef('0x32')](_0xecce62['query'][_0xdcef('0x32')]);_0x1a8757[_0xdcef('0x31')]=qs[_0xdcef('0x31')](_0xecce62[_0xdcef('0x51')][_0xdcef('0x31')]);}return _0x49a085[_0xdcef('0xc2')](_0x1a8757);}})[_0xdcef('0x38')](function(_0x1308b3){if(_0x1308b3){return _0x1308b3?{'count':_0x18cf44,'rows':_0x1308b3}:null;}})[_0xdcef('0x38')](respondWithResult(_0x1327ce,null))['catch'](handleError(_0x1327ce,null));};exports[_0xdcef('0xc3')]=function(_0x38cf11,_0x1ae3de,_0x3f2ffe){var _0xa5d2b8={};var _0x59c8d6={};var _0x13a6de;var _0x4b7a16;return db[_0xdcef('0x4a')]['findOne']({'where':{'id':_0x38cf11['params']['id']}})[_0xdcef('0x38')](handleEntityNotFound(_0x1ae3de,null))[_0xdcef('0x38')](function(_0x3415c6){if(_0x3415c6){_0x13a6de=_0x3415c6;_0x59c8d6['model']=_[_0xdcef('0x52')](db[_0xdcef('0xc4')][_0xdcef('0x66')]);_0x59c8d6[_0xdcef('0x51')]=_[_0xdcef('0x52')](_0x38cf11[_0xdcef('0x51')]);_0x59c8d6[_0xdcef('0x53')]=_['intersection'](_0x59c8d6['model'],_0x59c8d6[_0xdcef('0x51')]);_0xa5d2b8[_0xdcef('0x55')]=_['intersection'](_0x59c8d6[_0xdcef('0x4d')],qs['fields'](_0x38cf11[_0xdcef('0x51')][_0xdcef('0x67')]));_0xa5d2b8[_0xdcef('0x55')]=_0xa5d2b8[_0xdcef('0x55')]['length']?_0xa5d2b8['attributes']:_0x59c8d6[_0xdcef('0x4d')];_0xa5d2b8[_0xdcef('0xb9')]=qs['sort'](_0x38cf11[_0xdcef('0x51')][_0xdcef('0x57')]);_0xa5d2b8[_0xdcef('0x59')]=qs[_0xdcef('0x53')](_['pick'](_0x38cf11['query'],_0x59c8d6['filters']));if(_0x38cf11[_0xdcef('0x51')][_0xdcef('0x3f')]){_0xa5d2b8[_0xdcef('0x59')]=_[_0xdcef('0x5a')](_0xa5d2b8[_0xdcef('0x59')],{'$or':_[_0xdcef('0x41')](_0xa5d2b8['attributes'],function(_0x3f3a0b){var _0x9401ef={};_0x9401ef[_0x3f3a0b]={'$like':'%'+_0x38cf11[_0xdcef('0x51')][_0xdcef('0x3f')]+'%'};return _0x9401ef;})});}_0xa5d2b8=_['merge']({},_0xa5d2b8,_0x38cf11[_0xdcef('0x5f')]);return _0x13a6de[_0xdcef('0xc3')](_0xa5d2b8);}})['then'](function(_0x460f59){if(_0x460f59){_0x4b7a16=_0x460f59[_0xdcef('0x68')];if(!_0x38cf11['query']['hasOwnProperty'](_0xdcef('0x56'))){_0xa5d2b8[_0xdcef('0x32')]=qs[_0xdcef('0x32')](_0x38cf11[_0xdcef('0x51')][_0xdcef('0x32')]);_0xa5d2b8['offset']=qs[_0xdcef('0x31')](_0x38cf11[_0xdcef('0x51')][_0xdcef('0x31')]);}return _0x13a6de[_0xdcef('0xc3')](_0xa5d2b8);}})[_0xdcef('0x38')](function(_0x2f36aa){if(_0x2f36aa){return _0x2f36aa?{'count':_0x4b7a16,'rows':_0x2f36aa}:null;}})[_0xdcef('0x38')](respondWithResult(_0x1ae3de,null))[_0xdcef('0x2d')](handleError(_0x1ae3de,null));};exports[_0xdcef('0xc5')]=function(_0x48346c,_0x3dc51c,_0x42d0f5){var _0x355925={'raw':!![],'where':{}};var _0x3d63fb={};var _0x34a815={'count':0x0,'rows':[]};return db['User'][_0xdcef('0x8e')]({'where':{'id':_0x48346c[_0xdcef('0x65')]['id']}})[_0xdcef('0x38')](handleEntityNotFound(_0x3dc51c,null))[_0xdcef('0x38')](function(_0x296424){if(_0x296424){_0x3d63fb[_0xdcef('0x4d')]=_[_0xdcef('0x52')](db[_0xdcef('0xc6')][_0xdcef('0x66')]);_0x3d63fb['query']=_[_0xdcef('0x52')](_0x48346c[_0xdcef('0x51')]);_0x3d63fb[_0xdcef('0x53')]=_[_0xdcef('0x54')](_0x3d63fb[_0xdcef('0x4d')],_0x3d63fb[_0xdcef('0x51')]);_0x355925[_0xdcef('0x55')]=_[_0xdcef('0x54')](_0x3d63fb[_0xdcef('0x4d')],qs[_0xdcef('0x67')](_0x48346c[_0xdcef('0x51')][_0xdcef('0x67')]));_0x355925[_0xdcef('0x55')]=_0x355925[_0xdcef('0x55')][_0xdcef('0x68')]?_0x355925['attributes']:_0x3d63fb[_0xdcef('0x4d')];if(!_0x48346c[_0xdcef('0x51')]['hasOwnProperty'](_0xdcef('0x56'))){_0x355925[_0xdcef('0x32')]=qs[_0xdcef('0x32')](_0x48346c[_0xdcef('0x51')][_0xdcef('0x32')]);_0x355925[_0xdcef('0x31')]=qs[_0xdcef('0x31')](_0x48346c[_0xdcef('0x51')][_0xdcef('0x31')]);}_0x355925[_0xdcef('0xb9')]=qs[_0xdcef('0x57')](_0x48346c['query'][_0xdcef('0x57')]);_0x355925[_0xdcef('0x59')]=qs[_0xdcef('0x53')](_[_0xdcef('0x58')](_0x48346c[_0xdcef('0x51')],_0x3d63fb[_0xdcef('0x53')]));_0x355925[_0xdcef('0x59')][_0xdcef('0xc7')]=_0x296424['id'];if(_0x48346c[_0xdcef('0x51')][_0xdcef('0x3f')]){_0x355925[_0xdcef('0x59')]=_[_0xdcef('0x5a')](_0x355925['where'],{'$or':_[_0xdcef('0x41')](_0x355925['attributes'],function(_0x5f3c22){var _0x37f93a={};_0x37f93a[_0x5f3c22]={'$like':'%'+_0x48346c[_0xdcef('0x51')][_0xdcef('0x3f')]+'%'};return _0x37f93a;})});}_0x355925=_[_0xdcef('0x5a')]({},_0x355925,_0x48346c['options']);return db[_0xdcef('0xc6')][_0xdcef('0x60')]({'where':_0x355925[_0xdcef('0x59')]})[_0xdcef('0x38')](function(_0x42ca25){_0x34a815[_0xdcef('0x60')]=_0x42ca25;if(_0x48346c[_0xdcef('0x51')]['includeAll']){_0x355925['include']=[{'all':!![]}];}return db[_0xdcef('0xc6')][_0xdcef('0x63')](_0x355925);})[_0xdcef('0x38')](function(_0x12f899){_0x34a815[_0xdcef('0xc8')]=_0x12f899;return _0x34a815;});}})[_0xdcef('0x38')](respondWithFilteredResult(_0x3dc51c,_0x355925))[_0xdcef('0x2d')](handleError(_0x3dc51c,null));};exports[_0xdcef('0xc9')]=function(_0x4ec3c5,_0x1f63cd,_0x42fca1){var _0x2def38={'raw':!![],'where':{}};var _0x51b298={};var _0x43668d={'count':0x0,'rows':[]};return db[_0xdcef('0x4a')]['findOne']({'where':{'id':_0x4ec3c5['params']['id']}})[_0xdcef('0x38')](handleEntityNotFound(_0x1f63cd,null))['then'](function(_0x1df926){if(_0x1df926){_0x51b298[_0xdcef('0x4d')]=_[_0xdcef('0x52')](db[_0xdcef('0xca')]['rawAttributes']);_0x51b298['query']=_[_0xdcef('0x52')](_0x4ec3c5[_0xdcef('0x51')]);_0x51b298[_0xdcef('0x53')]=_['intersection'](_0x51b298[_0xdcef('0x4d')],_0x51b298[_0xdcef('0x51')]);_0x2def38[_0xdcef('0x55')]=_[_0xdcef('0x54')](_0x51b298[_0xdcef('0x4d')],qs[_0xdcef('0x67')](_0x4ec3c5[_0xdcef('0x51')][_0xdcef('0x67')]));_0x2def38[_0xdcef('0x55')]=_0x2def38[_0xdcef('0x55')]['length']?_0x2def38[_0xdcef('0x55')]:_0x51b298[_0xdcef('0x4d')];if(!_0x4ec3c5[_0xdcef('0x51')][_0xdcef('0xba')](_0xdcef('0x56'))){_0x2def38[_0xdcef('0x32')]=qs[_0xdcef('0x32')](_0x4ec3c5[_0xdcef('0x51')]['limit']);_0x2def38['offset']=qs[_0xdcef('0x31')](_0x4ec3c5[_0xdcef('0x51')][_0xdcef('0x31')]);}_0x2def38[_0xdcef('0xb9')]=qs[_0xdcef('0x57')](_0x4ec3c5[_0xdcef('0x51')][_0xdcef('0x57')]);_0x2def38[_0xdcef('0x59')]=qs['filters'](_[_0xdcef('0x58')](_0x4ec3c5[_0xdcef('0x51')],_0x51b298[_0xdcef('0x53')]));_0x2def38[_0xdcef('0x59')]['UserId']=_0x1df926['id'];if(_0x4ec3c5[_0xdcef('0x51')]['filter']){_0x2def38[_0xdcef('0x59')]=_[_0xdcef('0x5a')](_0x2def38[_0xdcef('0x59')],{'$or':_[_0xdcef('0x41')](_0x2def38[_0xdcef('0x55')],function(_0x3bf65a){var _0x29f95a={};_0x29f95a[_0x3bf65a]={'$like':'%'+_0x4ec3c5[_0xdcef('0x51')][_0xdcef('0x3f')]+'%'};return _0x29f95a;})});}_0x2def38=_[_0xdcef('0x5a')]({},_0x2def38,_0x4ec3c5[_0xdcef('0x5f')]);return db[_0xdcef('0xca')][_0xdcef('0x60')]({'where':_0x2def38[_0xdcef('0x59')]})[_0xdcef('0x38')](function(_0x5cc063){_0x43668d['count']=_0x5cc063;if(_0x4ec3c5['query']['includeAll']){_0x2def38[_0xdcef('0x62')]=[{'all':!![]}];}return db[_0xdcef('0xca')][_0xdcef('0x63')](_0x2def38);})[_0xdcef('0x38')](function(_0x4a4c66){_0x43668d[_0xdcef('0xc8')]=_0x4a4c66;return _0x43668d;});}})[_0xdcef('0x38')](respondWithFilteredResult(_0x1f63cd,_0x2def38))[_0xdcef('0x2d')](handleError(_0x1f63cd,null));};exports[_0xdcef('0xcb')]=function(_0x17296c,_0x58ebc2,_0x556d53){var _0x5ea8c2={};var _0x5a3b0e={};var _0x26a72a;var _0x31aec7;return db['User'][_0xdcef('0x8e')]({'where':{'id':_0x17296c[_0xdcef('0x65')]['id']}})[_0xdcef('0x38')](handleEntityNotFound(_0x58ebc2,null))['then'](function(_0x4f35cb){if(_0x4f35cb){_0x26a72a=_0x4f35cb;_0x5a3b0e['model']=_[_0xdcef('0x52')](db[_0xdcef('0xcc')][_0xdcef('0x66')]);_0x5a3b0e[_0xdcef('0x51')]=_['keys'](_0x17296c[_0xdcef('0x51')]);_0x5a3b0e[_0xdcef('0x53')]=_[_0xdcef('0x54')](_0x5a3b0e[_0xdcef('0x4d')],_0x5a3b0e[_0xdcef('0x51')]);_0x5ea8c2[_0xdcef('0x55')]=_[_0xdcef('0x54')](_0x5a3b0e[_0xdcef('0x4d')],qs[_0xdcef('0x67')](_0x17296c[_0xdcef('0x51')]['fields']));_0x5ea8c2[_0xdcef('0x55')]=_0x5ea8c2[_0xdcef('0x55')][_0xdcef('0x68')]?_0x5ea8c2[_0xdcef('0x55')]:_0x5a3b0e['model'];_0x5ea8c2[_0xdcef('0xb9')]=qs[_0xdcef('0x57')](_0x17296c[_0xdcef('0x51')][_0xdcef('0x57')]);_0x5ea8c2[_0xdcef('0x59')]=qs['filters'](_[_0xdcef('0x58')](_0x17296c['query'],_0x5a3b0e[_0xdcef('0x53')]));if(_0x17296c[_0xdcef('0x51')]['filter']){_0x5ea8c2[_0xdcef('0x59')]=_['merge'](_0x5ea8c2['where'],{'$or':_[_0xdcef('0x41')](_0x5ea8c2['attributes'],function(_0x1386a7){var _0xc861e0={};_0xc861e0[_0x1386a7]={'$like':'%'+_0x17296c[_0xdcef('0x51')][_0xdcef('0x3f')]+'%'};return _0xc861e0;})});}_0x5ea8c2=_[_0xdcef('0x5a')]({},_0x5ea8c2,_0x17296c[_0xdcef('0x5f')]);return _0x26a72a[_0xdcef('0xcb')](_0x5ea8c2);}})['then'](function(_0x3edb8){if(_0x3edb8){_0x31aec7=_0x3edb8[_0xdcef('0x68')];if(!_0x17296c[_0xdcef('0x51')][_0xdcef('0xba')](_0xdcef('0x56'))){_0x5ea8c2['limit']=qs[_0xdcef('0x32')](_0x17296c[_0xdcef('0x51')][_0xdcef('0x32')]);_0x5ea8c2[_0xdcef('0x31')]=qs[_0xdcef('0x31')](_0x17296c[_0xdcef('0x51')][_0xdcef('0x31')]);}return _0x26a72a[_0xdcef('0xcb')](_0x5ea8c2);}})[_0xdcef('0x38')](function(_0x27df53){if(_0x27df53){return _0x27df53?{'count':_0x31aec7,'rows':_0x27df53}:null;}})[_0xdcef('0x38')](respondWithResult(_0x58ebc2,null))[_0xdcef('0x2d')](handleError(_0x58ebc2,null));};exports[_0xdcef('0xcd')]=function(_0x1f3908,_0x30792d,_0x104516){var _0xd64fb8={};var _0x346a42={};var _0x41ccea;var _0x188351;return db[_0xdcef('0x4a')]['findOne']({'where':{'id':_0x1f3908[_0xdcef('0x65')]['id']}})[_0xdcef('0x38')](handleEntityNotFound(_0x30792d,null))[_0xdcef('0x38')](function(_0x23bd8b){if(_0x23bd8b){_0x41ccea=_0x23bd8b;_0x346a42[_0xdcef('0x4d')]=_[_0xdcef('0x52')](db[_0xdcef('0xce')][_0xdcef('0x66')]);_0x346a42[_0xdcef('0x51')]=_[_0xdcef('0x52')](_0x1f3908[_0xdcef('0x51')]);_0x346a42[_0xdcef('0x53')]=_[_0xdcef('0x54')](_0x346a42[_0xdcef('0x4d')],_0x346a42[_0xdcef('0x51')]);_0xd64fb8[_0xdcef('0x55')]=_['intersection'](_0x346a42['model'],qs[_0xdcef('0x67')](_0x1f3908['query']['fields']));_0xd64fb8['attributes']=_0xd64fb8[_0xdcef('0x55')][_0xdcef('0x68')]?_0xd64fb8['attributes']:_0x346a42[_0xdcef('0x4d')];_0xd64fb8[_0xdcef('0xb9')]=qs[_0xdcef('0x57')](_0x1f3908[_0xdcef('0x51')][_0xdcef('0x57')]);_0xd64fb8[_0xdcef('0x59')]=qs['filters'](_[_0xdcef('0x58')](_0x1f3908[_0xdcef('0x51')],_0x346a42[_0xdcef('0x53')]));if(_0x1f3908['query'][_0xdcef('0x3f')]){_0xd64fb8['where']=_[_0xdcef('0x5a')](_0xd64fb8['where'],{'$or':_[_0xdcef('0x41')](_0xd64fb8['attributes'],function(_0x1f8b83){var _0x2f4ae1={};_0x2f4ae1[_0x1f8b83]={'$like':'%'+_0x1f3908['query'][_0xdcef('0x3f')]+'%'};return _0x2f4ae1;})});}_0xd64fb8=_[_0xdcef('0x5a')]({},_0xd64fb8,_0x1f3908[_0xdcef('0x5f')]);return _0x41ccea[_0xdcef('0xcd')](_0xd64fb8);}})['then'](function(_0x1cec30){if(_0x1cec30){_0x188351=_0x1cec30[_0xdcef('0x68')];if(!_0x1f3908[_0xdcef('0x51')][_0xdcef('0xba')](_0xdcef('0x56'))){_0xd64fb8['limit']=qs['limit'](_0x1f3908[_0xdcef('0x51')][_0xdcef('0x32')]);_0xd64fb8[_0xdcef('0x31')]=qs[_0xdcef('0x31')](_0x1f3908[_0xdcef('0x51')]['offset']);}return _0x41ccea['getOpenchannelInteractions'](_0xd64fb8);}})[_0xdcef('0x38')](function(_0x1931cf){if(_0x1931cf){return _0x1931cf?{'count':_0x188351,'rows':_0x1931cf}:null;}})[_0xdcef('0x38')](respondWithResult(_0x30792d,null))[_0xdcef('0x2d')](handleError(_0x30792d,null));};exports['getMailInteractions']=function(_0x1633de,_0x56b1ea,_0x353448){var _0x4e9611={'raw':!![],'where':{}};var _0x1e0a9c={};var _0x3b16cc={'count':0x0,'rows':[]};return db[_0xdcef('0x4a')]['findOne']({'where':{'id':_0x1633de['params']['id']}})['then'](handleEntityNotFound(_0x56b1ea,null))[_0xdcef('0x38')](function(_0x49fc10){if(_0x49fc10){_0x1e0a9c[_0xdcef('0x4d')]=_[_0xdcef('0x52')](db[_0xdcef('0xcf')][_0xdcef('0x66')]);_0x1e0a9c[_0xdcef('0x51')]=_[_0xdcef('0x52')](_0x1633de[_0xdcef('0x51')]);_0x1e0a9c[_0xdcef('0x53')]=_[_0xdcef('0x54')](_0x1e0a9c[_0xdcef('0x4d')],_0x1e0a9c['query']);_0x4e9611[_0xdcef('0x55')]=_[_0xdcef('0x54')](_0x1e0a9c[_0xdcef('0x4d')],qs[_0xdcef('0x67')](_0x1633de[_0xdcef('0x51')][_0xdcef('0x67')]));_0x4e9611[_0xdcef('0x55')]=_0x4e9611[_0xdcef('0x55')][_0xdcef('0x68')]?_0x4e9611[_0xdcef('0x55')]:_0x1e0a9c[_0xdcef('0x4d')];if(!_0x1633de[_0xdcef('0x51')][_0xdcef('0xba')](_0xdcef('0x56'))){_0x4e9611[_0xdcef('0x32')]=qs[_0xdcef('0x32')](_0x1633de[_0xdcef('0x51')][_0xdcef('0x32')]);_0x4e9611['offset']=qs['offset'](_0x1633de['query'][_0xdcef('0x31')]);}_0x4e9611['order']=qs['sort'](_0x1633de[_0xdcef('0x51')][_0xdcef('0x57')]);_0x4e9611['where']=qs[_0xdcef('0x53')](_[_0xdcef('0x58')](_0x1633de[_0xdcef('0x51')],_0x1e0a9c[_0xdcef('0x53')]));_0x4e9611[_0xdcef('0x59')][_0xdcef('0xc7')]=_0x49fc10['id'];if(_0x1633de[_0xdcef('0x51')][_0xdcef('0x3f')]){_0x4e9611[_0xdcef('0x59')]=_[_0xdcef('0x5a')](_0x4e9611[_0xdcef('0x59')],{'$or':_['map'](_0x4e9611[_0xdcef('0x55')],function(_0x4ed2dd){var _0x3b2653={};_0x3b2653[_0x4ed2dd]={'$like':'%'+_0x1633de[_0xdcef('0x51')]['filter']+'%'};return _0x3b2653;})});}_0x4e9611=_['merge']({},_0x4e9611,_0x1633de['options']);return db[_0xdcef('0xcf')][_0xdcef('0x60')]({'where':_0x4e9611[_0xdcef('0x59')]})[_0xdcef('0x38')](function(_0x5b4e67){_0x3b16cc['count']=_0x5b4e67;if(_0x1633de[_0xdcef('0x51')][_0xdcef('0x61')]){_0x4e9611[_0xdcef('0x62')]=[{'all':!![]}];}return db[_0xdcef('0xcf')][_0xdcef('0x63')](_0x4e9611);})[_0xdcef('0x38')](function(_0x5b958e){_0x3b16cc[_0xdcef('0xc8')]=_0x5b958e;return _0x3b16cc;});}})[_0xdcef('0x38')](respondWithFilteredResult(_0x56b1ea,_0x4e9611))[_0xdcef('0x2d')](handleError(_0x56b1ea,null));};exports[_0xdcef('0xd0')]=function(_0x32bbe5,_0x358a2d,_0x47be66){var _0x2925ed={};var _0x2a6441={};var _0x58bc1c;var _0x2ecf4e;return db['User']['findOne']({'where':{'id':_0x32bbe5[_0xdcef('0x65')]['id']}})[_0xdcef('0x38')](handleEntityNotFound(_0x358a2d,null))[_0xdcef('0x38')](function(_0x4ca505){if(_0x4ca505){_0x58bc1c=_0x4ca505;_0x2a6441[_0xdcef('0x4d')]=_[_0xdcef('0x52')](db[_0xdcef('0xd1')][_0xdcef('0x66')]);_0x2a6441[_0xdcef('0x51')]=_[_0xdcef('0x52')](_0x32bbe5[_0xdcef('0x51')]);_0x2a6441[_0xdcef('0x53')]=_[_0xdcef('0x54')](_0x2a6441[_0xdcef('0x4d')],_0x2a6441[_0xdcef('0x51')]);_0x2925ed[_0xdcef('0x55')]=_[_0xdcef('0x54')](_0x2a6441[_0xdcef('0x4d')],qs[_0xdcef('0x67')](_0x32bbe5[_0xdcef('0x51')][_0xdcef('0x67')]));_0x2925ed[_0xdcef('0x55')]=_0x2925ed[_0xdcef('0x55')][_0xdcef('0x68')]?_0x2925ed[_0xdcef('0x55')]:_0x2a6441['model'];_0x2925ed[_0xdcef('0xb9')]=qs[_0xdcef('0x57')](_0x32bbe5[_0xdcef('0x51')]['sort']);_0x2925ed[_0xdcef('0x59')]=qs[_0xdcef('0x53')](_[_0xdcef('0x58')](_0x32bbe5[_0xdcef('0x51')],_0x2a6441[_0xdcef('0x53')]));if(_0x32bbe5['query']['filter']){_0x2925ed[_0xdcef('0x59')]=_[_0xdcef('0x5a')](_0x2925ed['where'],{'$or':_[_0xdcef('0x41')](_0x2925ed[_0xdcef('0x55')],function(_0x4e7e0d){var _0x5c77ca={};_0x5c77ca[_0x4e7e0d]={'$like':'%'+_0x32bbe5[_0xdcef('0x51')][_0xdcef('0x3f')]+'%'};return _0x5c77ca;})});}_0x2925ed=_[_0xdcef('0x5a')]({},_0x2925ed,_0x32bbe5['options']);return _0x58bc1c[_0xdcef('0xd0')](_0x2925ed);}})[_0xdcef('0x38')](function(_0x556b68){if(_0x556b68){_0x2ecf4e=_0x556b68[_0xdcef('0x68')];if(!_0x32bbe5[_0xdcef('0x51')]['hasOwnProperty']('nolimit')){_0x2925ed[_0xdcef('0x32')]=qs[_0xdcef('0x32')](_0x32bbe5['query'][_0xdcef('0x32')]);_0x2925ed[_0xdcef('0x31')]=qs[_0xdcef('0x31')](_0x32bbe5['query'][_0xdcef('0x31')]);}return _0x58bc1c[_0xdcef('0xd0')](_0x2925ed);}})[_0xdcef('0x38')](function(_0x5bfab0){if(_0x5bfab0){return _0x5bfab0?{'count':_0x2ecf4e,'rows':_0x5bfab0}:null;}})[_0xdcef('0x38')](respondWithResult(_0x358a2d,null))[_0xdcef('0x2d')](handleError(_0x358a2d,null));};exports['getFaxInteractions']=function(_0x4ab070,_0x37a0ba,_0x176a3d){var _0xbbfc7={};var _0x4e9b94={};var _0x552102;var _0x4e31a3;return db[_0xdcef('0x4a')][_0xdcef('0x8e')]({'where':{'id':_0x4ab070[_0xdcef('0x65')]['id']}})['then'](handleEntityNotFound(_0x37a0ba,null))[_0xdcef('0x38')](function(_0x2da458){if(_0x2da458){_0x552102=_0x2da458;_0x4e9b94[_0xdcef('0x4d')]=_['keys'](db[_0xdcef('0xd2')][_0xdcef('0x66')]);_0x4e9b94[_0xdcef('0x51')]=_[_0xdcef('0x52')](_0x4ab070['query']);_0x4e9b94['filters']=_[_0xdcef('0x54')](_0x4e9b94['model'],_0x4e9b94[_0xdcef('0x51')]);_0xbbfc7['attributes']=_[_0xdcef('0x54')](_0x4e9b94[_0xdcef('0x4d')],qs['fields'](_0x4ab070[_0xdcef('0x51')][_0xdcef('0x67')]));_0xbbfc7[_0xdcef('0x55')]=_0xbbfc7[_0xdcef('0x55')]['length']?_0xbbfc7['attributes']:_0x4e9b94['model'];_0xbbfc7[_0xdcef('0xb9')]=qs[_0xdcef('0x57')](_0x4ab070['query'][_0xdcef('0x57')]);_0xbbfc7[_0xdcef('0x59')]=qs[_0xdcef('0x53')](_[_0xdcef('0x58')](_0x4ab070[_0xdcef('0x51')],_0x4e9b94[_0xdcef('0x53')]));if(_0x4ab070['query']['filter']){_0xbbfc7[_0xdcef('0x59')]=_['merge'](_0xbbfc7[_0xdcef('0x59')],{'$or':_[_0xdcef('0x41')](_0xbbfc7[_0xdcef('0x55')],function(_0x38c9c3){var _0x1c73c1={};_0x1c73c1[_0x38c9c3]={'$like':'%'+_0x4ab070['query']['filter']+'%'};return _0x1c73c1;})});}_0xbbfc7=_[_0xdcef('0x5a')]({},_0xbbfc7,_0x4ab070['options']);return _0x552102[_0xdcef('0xd3')](_0xbbfc7);}})[_0xdcef('0x38')](function(_0x11911d){if(_0x11911d){_0x4e31a3=_0x11911d['length'];if(!_0x4ab070[_0xdcef('0x51')]['hasOwnProperty'](_0xdcef('0x56'))){_0xbbfc7[_0xdcef('0x32')]=qs[_0xdcef('0x32')](_0x4ab070['query'][_0xdcef('0x32')]);_0xbbfc7[_0xdcef('0x31')]=qs[_0xdcef('0x31')](_0x4ab070['query']['offset']);}return _0x552102['getFaxInteractions'](_0xbbfc7);}})[_0xdcef('0x38')](function(_0xa2f16){if(_0xa2f16){return _0xa2f16?{'count':_0x4e31a3,'rows':_0xa2f16}:null;}})['then'](respondWithResult(_0x37a0ba,null))[_0xdcef('0x2d')](handleError(_0x37a0ba,null));};exports[_0xdcef('0xd4')]=function(_0x41a279,_0x3bbc5b,_0x3ebb06){var _0x368b41;var _0x6a1e1d;var _0x43571c;var _0x366088=!_[_0xdcef('0x71')](_0x41a279['params']['id'])?_0x41a279['params']['id']:!_[_0xdcef('0x71')](_0x41a279['user']['id'])?_0x41a279[_0xdcef('0x3b')]['id']:null;return db[_0xdcef('0x4a')][_0xdcef('0x44')]({'where':{'id':_0x366088,'role':{'$or':[_0xdcef('0x6e'),_0xdcef('0x3b'),_0xdcef('0x3c')]}},'attributes':['id',_0xdcef('0x45'),_0xdcef('0xd5'),_0xdcef('0xd6'),'role',_0xdcef('0x76'),'loginInPause']})['then'](function(_0x4e241f){if(_0x4e241f){if(_0x4e241f[_0xdcef('0x43')]==='agent'){_0x368b41=_0x4e241f;if(_0x41a279[_0xdcef('0x6a')][_0xdcef('0x9c')]){_0x43571c=util[_0xdcef('0x73')](_0xdcef('0xd7'),_0x368b41[_0x41a279[_0xdcef('0x6a')][_0xdcef('0x9c')]]);}else if(_0x41a279['body'][_0xdcef('0xd8')]){_0x43571c=util[_0xdcef('0x73')](_0xdcef('0xa8'),_0x41a279[_0xdcef('0x6a')][_0xdcef('0xd8')]);}else{_0x43571c=util[_0xdcef('0x73')](_0xdcef('0xa8'),_0x368b41[_0xdcef('0x45')]);}socket['to'](util['format']('user:%s',_0x368b41[_0xdcef('0x45')]))[_0xdcef('0xa4')](_0xdcef('0xd9'),{'ip':_0x41a279[_0xdcef('0xda')][_0xdcef('0xdb')]||_0x41a279[_0xdcef('0xdc')][_0xdcef('0xdd')]||_0x41a279[_0xdcef('0xde')][_0xdcef('0xdd')]||_0x41a279['connection'][_0xdcef('0xde')][_0xdcef('0xdd')]});return db[_0xdcef('0xa9')]['destroy']({'where':{'membername':_0x368b41['name']},'individualHooks':!![]});}}else{throw new db[(_0xdcef('0x8f'))][(_0xdcef('0x92'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0xdcef('0x38')](function(){if(_0x368b41){return _0x368b41[_0xdcef('0xdf')]({'raw':!![]});}})[_0xdcef('0x38')](function(_0x526786){if(_0x368b41){var _0x5d2a50=[];if(_0x526786){_0x6a1e1d=_0x526786;if(_0x6a1e1d[_0xdcef('0x68')]){for(var _0x34cd29=0x0;_0x34cd29<_0x6a1e1d[_0xdcef('0x68')];_0x34cd29++){_0x5d2a50[_0xdcef('0xe0')]({'membername':_0x368b41[_0xdcef('0x45')],'UserId':_0x368b41['id'],'queue_name':_0x6a1e1d[_0x34cd29]['name'],'VoiceQueueId':_0x6a1e1d[_0x34cd29]['id'],'interface':_0x43571c,'paused':_0x368b41[_0xdcef('0x9a')]||![],'penalty':_0x6a1e1d[_0x34cd29]['UserVoiceQueue.penalty']||0x0});}return BPromise['each'](_0x5d2a50,function(_0x185940){return db[_0xdcef('0xa9')]['upsert'](_0x185940);});}}}})['then'](function(){if(_0x368b41){return db[_0xdcef('0xe1')][_0xdcef('0x63')]({'where':{'membername':_0x368b41[_0xdcef('0x45')],'exitAt':null}});}})[_0xdcef('0x38')](function(_0x528431){if(_0x368b41){var _0x4998e9=[];_0x528431[_0xdcef('0xe2')](function(_0x4929cb){_0x4998e9[_0xdcef('0xe0')](_0x4929cb['update']({'exitAt':moment()[_0xdcef('0x73')](_0xdcef('0xe3'))}));});return BPromise[_0xdcef('0xe4')](_0x4998e9);}})[_0xdcef('0x38')](function(){if(_0x368b41){var _0x5bf8a8=[];var _0x36c17d=[];var _0x53a0aa=utils[_0xdcef('0xe5')]();var _0xc81e5d={'membername':_0x368b41[_0xdcef('0x45')],'interface':_0x43571c,'enterAt':moment()[_0xdcef('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x368b41[_0xdcef('0x43')],'internal':_0x368b41['internal']};_0x53a0aa[_0xdcef('0xe2')](function(_0x1745d3){_0x5bf8a8[_0xdcef('0xe0')](_[_0xdcef('0x5a')]({'channel':_0x1745d3,'type':'LOGIN','data1':_0x41a279['body'][_0xdcef('0xe6')],'data2':_0x43571c},_0xc81e5d));if(_0x368b41[_0xdcef('0x9a')]){_0x36c17d['push'](_[_0xdcef('0x5a')]({'channel':_0x1745d3,'type':_0xdcef('0xe7'),'data1':'LOGININPAUSE'},_0xc81e5d));}});return db[_0xdcef('0xe1')]['bulkCreate'](_0x5bf8a8[_0xdcef('0xe8')](_0x36c17d),{'individualHooks':!![]});}})[_0xdcef('0x38')](function(){if(_0x368b41){return _0x368b41[_0xdcef('0xe9')]({'online':!![],'lastLoginAt':moment()['format'](_0xdcef('0xe3')),'voicePause':_0x368b41[_0xdcef('0x9a')]||![],'mailPause':_0x368b41['loginInPause']||![],'chatPause':_0x368b41[_0xdcef('0x9a')]||![],'faxPause':_0x368b41[_0xdcef('0x9a')]||![],'smsPause':_0x368b41[_0xdcef('0x9a')]||![],'openchannelPause':_0x368b41[_0xdcef('0x9a')]||![],'pauseType':_0x368b41[_0xdcef('0x9a')]?_0xdcef('0xea'):null,'interface':_0x43571c,'lastPauseAt':moment()[_0xdcef('0x73')](_0xdcef('0xe3'))});}})[_0xdcef('0x38')](function(_0x2b6763){if(_0x41a279[_0xdcef('0xeb')]){return _0x3ebb06();}else{return BPromise[_0xdcef('0xec')](_0x2b6763)['then'](respondWithResult(_0x3bbc5b,null));}})['catch'](handleError(_0x3bbc5b,null));};exports[_0xdcef('0xed')]=function(_0x2aefa9,_0x4d20d0,_0x1dd1da){var _0xbd6e19;return db[_0xdcef('0x4a')][_0xdcef('0x44')]({'where':{'id':_0x2aefa9[_0xdcef('0x65')]['id'],'role':_0xdcef('0x3c')},'attributes':['id',_0xdcef('0x45'),_0xdcef('0x43')]})[_0xdcef('0x38')](handleEntityNotFound(_0x4d20d0,null))['then'](function(_0x2c1595){if(_0x2c1595){_0xbd6e19=_0x2c1595;return db[_0xdcef('0xa9')][_0xdcef('0x46')]({'where':{'membername':_0xbd6e19[_0xdcef('0x45')]},'individualHooks':!![]});}})['then'](function(){return db[_0xdcef('0xe1')][_0xdcef('0x63')]({'where':{'membername':_0xbd6e19[_0xdcef('0x45')],'exitAt':null}});})[_0xdcef('0x38')](function(_0x203948){var _0x50604c=[];_0x203948['forEach'](function(_0x34ffb5){_0x50604c[_0xdcef('0xe0')](_0x34ffb5[_0xdcef('0xe9')]({'exitAt':moment()[_0xdcef('0x73')](_0xdcef('0xe3'))}));});return BPromise[_0xdcef('0xe4')](_0x50604c);})['then'](function(){return _0xbd6e19[_0xdcef('0xe9')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})['then'](respondWithResult(_0x4d20d0,null))['catch'](handleError(_0x4d20d0,null));};exports[_0xdcef('0xee')]=function(_0x4c25b5,_0x31015e,_0x3e98d1){var _0x530e95;return db[_0xdcef('0xa9')][_0xdcef('0xe9')]({'paused':0x1},{'where':{'UserId':_0x4c25b5['params']['id']},'individualHooks':!![]})[_0xdcef('0x38')](function(){return db[_0xdcef('0x4a')][_0xdcef('0x44')]({'where':{'id':_0x4c25b5[_0xdcef('0x65')]['id'],'role':_0xdcef('0x3c')},'attributes':['id','name',_0xdcef('0x43'),_0xdcef('0x76'),_0xdcef('0x9c')]});})[_0xdcef('0x38')](handleEntityNotFound(_0x31015e,null))[_0xdcef('0x38')](function(_0x224b3f){if(_0x224b3f){_0x530e95=_0x224b3f;return respondWithRpcPromise(_0xdcef('0xef'),_0xdcef('0xee'),{'id':_0x530e95['id'],'name':_0x530e95[_0xdcef('0x45')],'pause':!![]});}})[_0xdcef('0x38')](function(){if(_0x530e95){return db[_0xdcef('0xe1')][_0xdcef('0x63')]({'where':{'membername':_0x530e95[_0xdcef('0x45')],'type':_0xdcef('0xe7'),'exitAt':null}});}})[_0xdcef('0x38')](function(_0x581876){if(_0x581876[_0xdcef('0x68')]){var _0xc81ac=moment()['format'](_0xdcef('0xe3'));for(var _0x44dac6=0x0,_0x3cc0d2=_0x581876[_0xdcef('0x68')];_0x44dac6<_0x3cc0d2;_0x44dac6++){_0x581876[_0x44dac6][_0xdcef('0xf0')]({'exitAt':_0xc81ac});}}})[_0xdcef('0x38')](function(){var _0x2824c9=[];var _0x5c2bed=utils[_0xdcef('0xe5')]();_0x5c2bed['forEach'](function(_0x484191){_0x2824c9[_0xdcef('0xe0')]({'channel':_0x484191,'membername':_0x530e95[_0xdcef('0x45')],'interface':_[_0xdcef('0x71')](_0x530e95[_0xdcef('0x9c')])?util[_0xdcef('0x73')]('SIP/%s',_0x530e95[_0xdcef('0x45')]):_0x530e95['interface'],'type':_0xdcef('0xe7'),'enterAt':moment()[_0xdcef('0x73')](_0xdcef('0xe3')),'data1':_0x4c25b5['body'][_0xdcef('0x5b')]||_0xdcef('0xf1'),'role':_0x530e95[_0xdcef('0x43')],'internal':_0x530e95['internal']});});return db[_0xdcef('0xe1')]['bulkCreate'](_0x2824c9,{'individualHooks':!![]});})[_0xdcef('0x38')](function(){return _0x530e95[_0xdcef('0xe9')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x4c25b5[_0xdcef('0x6a')]['type']||_0xdcef('0xf1'),'lastPauseAt':moment()[_0xdcef('0x73')](_0xdcef('0xe3'))});})['then'](respondWithResult(_0x31015e,null))['catch'](handleError(_0x31015e,null));};exports[_0xdcef('0xf2')]=function(_0x3e4dfe,_0x453f7c,_0x27a6ea){var _0x254fe5;return db[_0xdcef('0x4a')][_0xdcef('0x44')]({'where':{'id':_0x3e4dfe[_0xdcef('0x65')]['id']},'attributes':['id',_0xdcef('0x45'),_0xdcef('0x43'),'voicePause','mailPause','chatPause','faxPause',_0xdcef('0xf3'),_0xdcef('0xf4'),'pauseType','lastPauseAt']})['then'](handleEntityNotFound(_0x453f7c,null))[_0xdcef('0x38')](function(_0x30f892){if(_0x30f892){_0x254fe5=_0x30f892;if(_0x3e4dfe['body'][_0xdcef('0x98')]&&!utils['isValidChannel'](_0x3e4dfe[_0xdcef('0x6a')]['channel'])){throw new db[(_0xdcef('0x8f'))]['ValidationError'](_0xdcef('0x9d'));}switch(_0x3e4dfe['body'][_0xdcef('0x98')]){case _0xdcef('0xa6'):return respondWithRpcPromise('QueuePause',_0xdcef('0xf2'),{'id':_0x254fe5['id'],'name':_0x254fe5[_0xdcef('0x45')],'pause':![]})[_0xdcef('0x38')](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x254fe5['id']},'individualHooks':!![]});})[_0xdcef('0x38')](function(){return db[_0xdcef('0xe1')]['find']({'where':{'channel':_0x3e4dfe['body'][_0xdcef('0x98')],'membername':_0x254fe5[_0xdcef('0x45')],'type':_0xdcef('0xe7'),'exitAt':null}});})[_0xdcef('0x38')](function(_0x485235){if(_0x485235){return _0x485235[_0xdcef('0xe9')]({'exitAt':moment()[_0xdcef('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xdcef('0xf5')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x254fe5['update']({'voicePause':![]});});case _0xdcef('0xf6'):case _0xdcef('0xf7'):case'fax':case'sms':case _0xdcef('0xf8'):return db[_0xdcef('0xe1')][_0xdcef('0x44')]({'where':{'channel':_0x3e4dfe[_0xdcef('0x6a')][_0xdcef('0x98')],'membername':_0x254fe5[_0xdcef('0x45')],'type':_0xdcef('0xe7'),'exitAt':null}})[_0xdcef('0x38')](function(_0x458c9c){if(_0x458c9c){return _0x458c9c[_0xdcef('0xe9')]({'exitAt':moment()[_0xdcef('0x73')](_0xdcef('0xe3')),'data2':_0xdcef('0xf5')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x5bbad1={};_[_0xdcef('0x33')](_0x5bbad1,util['format'](_0xdcef('0xf9'),_0x3e4dfe['body'][_0xdcef('0x98')],'Pause'),![]);return _0x254fe5[_0xdcef('0xe9')](_0x5bbad1);});default:return respondWithRpcPromise(_0xdcef('0xef'),_0xdcef('0xf2'),{'id':_0x254fe5['id'],'name':_0x254fe5[_0xdcef('0x45')],'pause':![]})[_0xdcef('0x38')](function(){return db[_0xdcef('0xa9')][_0xdcef('0xe9')]({'paused':0x0},{'where':{'UserId':_0x254fe5['id']}});})[_0xdcef('0x38')](function(){return db[_0xdcef('0xe1')][_0xdcef('0x63')]({'where':{'membername':_0x254fe5['name'],'type':_0xdcef('0xe7'),'exitAt':null}});})[_0xdcef('0x38')](function(_0x21c26c){var _0x2daeca=[];_0x21c26c['forEach'](function(_0xadcf85){_0x2daeca[_0xdcef('0xe0')](_0xadcf85[_0xdcef('0xe9')]({'exitAt':moment()[_0xdcef('0x73')](_0xdcef('0xe3')),'data2':_0xdcef('0xf5')}));});return BPromise['all'](_0x2daeca);})[_0xdcef('0x38')](function(){return _0x254fe5[_0xdcef('0xe9')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xdcef('0x38')](respondWithResult(_0x453f7c,null))['catch'](handleError(_0x453f7c,null));};exports[_0xdcef('0xfa')]=function(_0x5ee3c1,_0x584f54,_0x4672c6){var _0x1a26f0={};var _0x411080={};var _0x45c04d;var _0xa8ac2a;return db[_0xdcef('0x4a')][_0xdcef('0x8e')]({'where':{'id':_0x5ee3c1[_0xdcef('0x65')]['id']}})[_0xdcef('0x38')](handleEntityNotFound(_0x584f54,null))['then'](function(_0x4d89aa){if(_0x4d89aa){_0x45c04d=_0x4d89aa;_0x411080[_0xdcef('0x4d')]=_[_0xdcef('0x52')](db['Team']['rawAttributes']);_0x411080[_0xdcef('0x51')]=_['keys'](_0x5ee3c1[_0xdcef('0x51')]);_0x411080[_0xdcef('0x53')]=_[_0xdcef('0x54')](_0x411080[_0xdcef('0x4d')],_0x411080[_0xdcef('0x51')]);_0x1a26f0[_0xdcef('0x55')]=_[_0xdcef('0x54')](_0x411080[_0xdcef('0x4d')],qs['fields'](_0x5ee3c1[_0xdcef('0x51')][_0xdcef('0x67')]));_0x1a26f0[_0xdcef('0x55')]=_0x1a26f0[_0xdcef('0x55')][_0xdcef('0x68')]?_0x1a26f0[_0xdcef('0x55')]:_0x411080[_0xdcef('0x4d')];_0x1a26f0['order']=qs[_0xdcef('0x57')](_0x5ee3c1[_0xdcef('0x51')][_0xdcef('0x57')]);_0x1a26f0[_0xdcef('0x59')]=qs[_0xdcef('0x53')](_[_0xdcef('0x58')](_0x5ee3c1[_0xdcef('0x51')],_0x411080[_0xdcef('0x53')]));if(_0x5ee3c1['query']['filter']){_0x1a26f0[_0xdcef('0x59')]=_['merge'](_0x1a26f0[_0xdcef('0x59')],{'$or':_[_0xdcef('0x41')](_0x1a26f0[_0xdcef('0x55')],function(_0x493e19){var _0x557518={};_0x557518[_0x493e19]={'$like':'%'+_0x5ee3c1[_0xdcef('0x51')][_0xdcef('0x3f')]+'%'};return _0x557518;})});}_0x1a26f0=_[_0xdcef('0x5a')]({},_0x1a26f0,_0x5ee3c1[_0xdcef('0x5f')]);return _0x45c04d[_0xdcef('0xfa')](_0x1a26f0);}})[_0xdcef('0x38')](function(_0x4c0756){if(_0x4c0756){_0xa8ac2a=_0x4c0756[_0xdcef('0x68')];if(!_0x5ee3c1[_0xdcef('0x51')][_0xdcef('0xba')](_0xdcef('0x56'))){_0x1a26f0[_0xdcef('0x32')]=qs[_0xdcef('0x32')](_0x5ee3c1[_0xdcef('0x51')][_0xdcef('0x32')]);_0x1a26f0[_0xdcef('0x31')]=qs[_0xdcef('0x31')](_0x5ee3c1[_0xdcef('0x51')][_0xdcef('0x31')]);}return _0x45c04d['getTeams'](_0x1a26f0);}})[_0xdcef('0x38')](function(_0x347e9b){if(_0x347e9b){return _0x347e9b?{'count':_0xa8ac2a,'rows':_0x347e9b}:null;}})[_0xdcef('0x38')](respondWithResult(_0x584f54,null))[_0xdcef('0x2d')](handleError(_0x584f54,null));};exports[_0xdcef('0xfb')]=function(_0x352aad,_0x3438ef){return db[_0xdcef('0x4a')][_0xdcef('0x44')]({'where':{'id':_0x352aad[_0xdcef('0x65')]['id']}})[_0xdcef('0x38')](handleEntityNotFound(_0x3438ef,null))[_0xdcef('0x38')](function(_0x4bc849){if(_0x4bc849){var _0x2a9664=_0x4bc849['get']({'plain':!![]});return _0x4bc849[_0xdcef('0xfb')](_0x352aad['body'][_0xdcef('0x6c')],_['omit'](_0x352aad[_0xdcef('0x6a')],[_0xdcef('0x6c'),'id'])||{})['then'](function(){for(var _0x194703=0x0;_0x194703<_0x352aad[_0xdcef('0x6a')][_0xdcef('0x6c')][_0xdcef('0x68')];_0x194703++){var _0x13c337=[];db[_0xdcef('0xfc')][_0xdcef('0x8e')]({'where':{'id':_0x352aad[_0xdcef('0x6a')][_0xdcef('0x6c')][_0x194703]}})[_0xdcef('0x38')](function(_0x4d3c64){_0x13c337[_0xdcef('0xe0')](_0x4d3c64[_0xdcef('0xdf')]()['then'](function(_0x2b334f){for(var _0x3bbeae=0x0;_0x3bbeae<_0x2b334f[_0xdcef('0x68')];_0x3bbeae++){_0x2b334f[_0x3bbeae]['setDataValue'](_0xdcef('0x98'),'Voice');}return _0x2b334f;}));_0x13c337['push'](_0x4d3c64[_0xdcef('0xfd')]()['then'](function(_0x40003f){for(var _0x506271=0x0;_0x506271<_0x40003f[_0xdcef('0x68')];_0x506271++){_0x40003f[_0x506271][_0xdcef('0xfe')]('channel',_0xdcef('0xff'));}return _0x40003f;}));_0x13c337[_0xdcef('0xe0')](_0x4d3c64['getMailQueues']()[_0xdcef('0x38')](function(_0x1200f7){for(var _0x3c31a0=0x0;_0x3c31a0<_0x1200f7[_0xdcef('0x68')];_0x3c31a0++){_0x1200f7[_0x3c31a0][_0xdcef('0xfe')](_0xdcef('0x98'),_0xdcef('0x100'));}return _0x1200f7;}));_0x13c337[_0xdcef('0xe0')](_0x4d3c64[_0xdcef('0x101')]()[_0xdcef('0x38')](function(_0x366751){for(var _0x5b94e2=0x0;_0x5b94e2<_0x366751[_0xdcef('0x68')];_0x5b94e2++){_0x366751[_0x5b94e2][_0xdcef('0xfe')](_0xdcef('0x98'),_0xdcef('0x102'));}return _0x366751;}));_0x13c337[_0xdcef('0xe0')](_0x4d3c64[_0xdcef('0x103')]()[_0xdcef('0x38')](function(_0xdd50d3){for(var _0x53a609=0x0;_0x53a609<_0xdd50d3[_0xdcef('0x68')];_0x53a609++){_0xdd50d3[_0x53a609][_0xdcef('0xfe')](_0xdcef('0x98'),_0xdcef('0x104'));}return _0xdd50d3;}));_0x13c337[_0xdcef('0xe0')](_0x4d3c64['getOpenchannelQueues']()[_0xdcef('0x38')](function(_0x27112d){for(var _0x4fcd08=0x0;_0x4fcd08<_0x27112d['length'];_0x4fcd08++){_0x27112d[_0x4fcd08][_0xdcef('0xfe')](_0xdcef('0x98'),_0xdcef('0x105'));}return _0x27112d;}));return BPromise[_0xdcef('0xe4')](_0x13c337);})[_0xdcef('0x38')](function(_0x5c7a79){var _0x559fa4=_[_0xdcef('0x106')](_0x5c7a79);_0x13c337=[];return db[_0xdcef('0x5c')][_0xdcef('0x107')](function(_0x25de82){for(var _0x435746=0x0;_0x435746<_0x559fa4[_0xdcef('0x68')];_0x435746++){_0x13c337[_0xdcef('0xe0')](_0x559fa4[_0x435746][_0xdcef('0x108')](_0x2a9664['id']),{'transaction':_0x25de82});}return BPromise[_0xdcef('0xe4')](_0x13c337)[_0xdcef('0x38')](function(){if(_0x2a9664['online']){return BPromise[_0xdcef('0x109')](_[_0xdcef('0x3f')](_0x559fa4,function(_0x22ec1c){return _0x22ec1c[_0xdcef('0x10a')](_0xdcef('0x98'))===_0xdcef('0x10b');}),function(_0x1411ab){return db[_0xdcef('0xa9')][_0xdcef('0xaa')]({'membername':_0x2a9664[_0xdcef('0x45')],'UserId':_0x2a9664['id'],'queue_name':_0x1411ab[_0xdcef('0x45')],'VoiceQueueId':_0x1411ab['id'],'interface':_[_0xdcef('0x71')](_0x2a9664[_0xdcef('0x9c')])?util[_0xdcef('0x73')](_0xdcef('0xa8'),_0x2a9664[_0xdcef('0x45')]):_0x2a9664[_0xdcef('0x9c')],'paused':_0x2a9664[_0xdcef('0x9b')]||![],'penalty':_0x2a9664['penalty']},{'transaction':_0x25de82});});}else{return;}})[_0xdcef('0x38')](function(){for(var _0x471ccc=0x0;_0x471ccc<_0x559fa4['length'];_0x471ccc++){var _0x54fbd5=_0x559fa4[_0x471ccc]['getDataValue']('channel');var _0x316006=_0x54fbd5+_0xdcef('0xa3');socket[_0xdcef('0xa4')]('user'+_0x54fbd5+_0xdcef('0xa5'),{'UserId':_0x2a9664['id'],['queueField']:_0x559fa4[_0x471ccc]['id']});}});});});}});}})[_0xdcef('0x38')](respondWithStatusCode(_0x3438ef,null))[_0xdcef('0x2d')](handleError(_0x3438ef,null));};exports[_0xdcef('0x10c')]=function(_0x535c29,_0x659aa3){return db[_0xdcef('0x4a')][_0xdcef('0x8e')]({'where':{'id':_0x535c29[_0xdcef('0x65')]['id']}})[_0xdcef('0x38')](handleEntityNotFound(_0x659aa3,null))[_0xdcef('0x38')](function(_0x2e7f8e){if(_0x2e7f8e){var _0x286979=_0x2e7f8e[_0xdcef('0x39')]({'plain':!![]});var _0x14e1bc=_0x535c29[_0xdcef('0x51')][_0xdcef('0x6c')];return _0x2e7f8e[_0xdcef('0x10c')](_0x14e1bc)[_0xdcef('0x38')](function(){for(var _0xf04dd6=0x0;_0xf04dd6<_0x14e1bc[_0xdcef('0x68')];_0xf04dd6++){var _0x186be1=[];db[_0xdcef('0xfc')][_0xdcef('0x8e')]({'where':{'id':_0x14e1bc[_0xf04dd6]}})['then'](function(_0x52ae72){_0x186be1[_0xdcef('0xe0')](_0x52ae72[_0xdcef('0xdf')]()[_0xdcef('0x38')](function(_0x211d20){for(var _0x199ead=0x0;_0x199ead<_0x211d20[_0xdcef('0x68')];_0x199ead++){_0x211d20[_0x199ead][_0xdcef('0xfe')](_0xdcef('0x98'),_0xdcef('0x10b'));}return _0x211d20;}));_0x186be1['push'](_0x52ae72[_0xdcef('0xfd')]()[_0xdcef('0x38')](function(_0xaeefe1){for(var _0x38c8fb=0x0;_0x38c8fb<_0xaeefe1[_0xdcef('0x68')];_0x38c8fb++){_0xaeefe1[_0x38c8fb][_0xdcef('0xfe')](_0xdcef('0x98'),'Chat');}return _0xaeefe1;}));_0x186be1[_0xdcef('0xe0')](_0x52ae72[_0xdcef('0x10d')]()[_0xdcef('0x38')](function(_0xf1f14d){for(var _0x32efb3=0x0;_0x32efb3<_0xf1f14d['length'];_0x32efb3++){_0xf1f14d[_0x32efb3]['setDataValue'](_0xdcef('0x98'),_0xdcef('0x100'));}return _0xf1f14d;}));_0x186be1['push'](_0x52ae72[_0xdcef('0x101')]()[_0xdcef('0x38')](function(_0xa7cc64){for(var _0x24821c=0x0;_0x24821c<_0xa7cc64[_0xdcef('0x68')];_0x24821c++){_0xa7cc64[_0x24821c][_0xdcef('0xfe')]('channel',_0xdcef('0x102'));}return _0xa7cc64;}));_0x186be1[_0xdcef('0xe0')](_0x52ae72[_0xdcef('0x103')]()[_0xdcef('0x38')](function(_0x449628){for(var _0x5906f5=0x0;_0x5906f5<_0x449628['length'];_0x5906f5++){_0x449628[_0x5906f5]['setDataValue']('channel',_0xdcef('0x104'));}return _0x449628;}));_0x186be1[_0xdcef('0xe0')](_0x52ae72[_0xdcef('0x10e')]()[_0xdcef('0x38')](function(_0x129029){for(var _0xd636ea=0x0;_0xd636ea<_0x129029['length'];_0xd636ea++){_0x129029[_0xd636ea][_0xdcef('0xfe')](_0xdcef('0x98'),_0xdcef('0x105'));}return _0x129029;}));return BPromise[_0xdcef('0xe4')](_0x186be1);})[_0xdcef('0x38')](function(_0x4e9bff){var _0x378dde=_[_0xdcef('0x106')](_0x4e9bff);_0x186be1=[];return db[_0xdcef('0x5c')][_0xdcef('0x107')](function(_0x56e366){for(var _0x3aff38=0x0;_0x3aff38<_0x378dde[_0xdcef('0x68')];_0x3aff38++){_0x186be1[_0xdcef('0xe0')](_0x378dde[_0x3aff38][_0xdcef('0x10f')](_0x286979['id']),{'transaction':_0x56e366});}return BPromise['all'](_0x186be1)['then'](function(){if(_0x286979[_0xdcef('0x99')]){return BPromise[_0xdcef('0x109')](_[_0xdcef('0x3f')](_0x378dde,function(_0x17d330){return _0x17d330[_0xdcef('0x10a')]('channel')==='Voice';}),function(_0x5ddd19){return db[_0xdcef('0xa9')][_0xdcef('0x46')]({'where':{'VoiceQueueId':_0x5ddd19['id'],'UserId':_0x286979['id']},'transaction':_0x56e366});});}else{return;}})[_0xdcef('0x38')](function(){for(var _0x4f489a=0x0;_0x4f489a<_0x378dde[_0xdcef('0x68')];_0x4f489a++){var _0x4d51c4=_0x378dde[_0x4f489a][_0xdcef('0x10a')](_0xdcef('0x98'));var _0x5a311d=_0x4d51c4+_0xdcef('0xa3');socket[_0xdcef('0xa4')](_0xdcef('0x3b')+_0x4d51c4+_0xdcef('0xac'),{'UserId':_0x286979['id'],['queueField']:_0x378dde[_0x4f489a]['id']});}});});});}});}})[_0xdcef('0x38')](respondWithStatusCode(_0x659aa3,null))[_0xdcef('0x2d')](handleError(_0x659aa3,null));};exports[_0xdcef('0x110')]=function(_0x278b74,_0x5cb46a,_0x3d4cf4){var _0x1d9fbc={};var _0x3f14b9={};var _0x1605c3;var _0x30529d;return db['User'][_0xdcef('0x8e')]({'where':{'id':_0x278b74[_0xdcef('0x65')]['id']}})[_0xdcef('0x38')](handleEntityNotFound(_0x5cb46a,null))[_0xdcef('0x38')](function(_0x9cd9be){if(_0x9cd9be){_0x1605c3=_0x9cd9be;_0x3f14b9['model']=_[_0xdcef('0x52')](db[_0xdcef('0xbb')][_0xdcef('0x66')]);_0x3f14b9[_0xdcef('0x51')]=_['keys'](_0x278b74[_0xdcef('0x51')]);_0x3f14b9[_0xdcef('0x53')]=_['intersection'](_0x3f14b9[_0xdcef('0x4d')],_0x3f14b9['query']);_0x1d9fbc[_0xdcef('0x55')]=_[_0xdcef('0x54')](_0x3f14b9[_0xdcef('0x4d')],qs['fields'](_0x278b74[_0xdcef('0x51')][_0xdcef('0x67')]));_0x1d9fbc['attributes']=_0x1d9fbc['attributes'][_0xdcef('0x68')]?_0x1d9fbc[_0xdcef('0x55')]:_0x3f14b9['model'];_0x1d9fbc[_0xdcef('0xb9')]=qs[_0xdcef('0x57')](_0x278b74['query'][_0xdcef('0x57')]);_0x1d9fbc['where']=qs[_0xdcef('0x53')](_[_0xdcef('0x58')](_0x278b74['query'],_0x3f14b9[_0xdcef('0x53')]));if(_0x278b74['query']['filter']){_0x1d9fbc[_0xdcef('0x59')]=_[_0xdcef('0x5a')](_0x1d9fbc[_0xdcef('0x59')],{'$or':_['map'](_0x1d9fbc[_0xdcef('0x55')],function(_0x321ac6){var _0x448b92={};_0x448b92[_0x321ac6]={'$like':'%'+_0x278b74[_0xdcef('0x51')]['filter']+'%'};return _0x448b92;})});}_0x1d9fbc=_[_0xdcef('0x5a')]({},_0x1d9fbc,_0x278b74['options']);return _0x1605c3[_0xdcef('0x110')](_0x1d9fbc);}})[_0xdcef('0x38')](function(_0x564f8c){if(_0x564f8c){_0x30529d=_0x564f8c[_0xdcef('0x68')];if(!_0x278b74[_0xdcef('0x51')]['hasOwnProperty'](_0xdcef('0x56'))){_0x1d9fbc['limit']=qs[_0xdcef('0x32')](_0x278b74[_0xdcef('0x51')][_0xdcef('0x32')]);_0x1d9fbc[_0xdcef('0x31')]=qs[_0xdcef('0x31')](_0x278b74[_0xdcef('0x51')]['offset']);}return _0x1605c3[_0xdcef('0x110')](_0x1d9fbc);}})[_0xdcef('0x38')](function(_0x3d23ce){if(_0x3d23ce){return _0x3d23ce?{'count':_0x30529d,'rows':_0x3d23ce}:null;}})[_0xdcef('0x38')](respondWithResult(_0x5cb46a,null))['catch'](handleError(_0x5cb46a,null));};exports['getAgents']=function(_0x409daa,_0x5af950,_0x27e4b9){var _0x102c73={};var _0x46cabe={};var _0x2a3191;var _0xa19c54;return db[_0xdcef('0x4a')][_0xdcef('0x8e')]({'where':{'id':_0x409daa['params']['id']}})['then'](handleEntityNotFound(_0x5af950,null))[_0xdcef('0x38')](function(_0x2cbaa7){if(_0x2cbaa7){_0x2a3191=_0x2cbaa7;_0x46cabe['model']=_[_0xdcef('0x52')](db[_0xdcef('0x4a')]['rawAttributes']);_0x46cabe[_0xdcef('0x51')]=_['keys'](_0x409daa[_0xdcef('0x51')]);_0x46cabe['filters']=_['intersection'](_0x46cabe[_0xdcef('0x4d')],_0x46cabe[_0xdcef('0x51')]);_0x102c73[_0xdcef('0x55')]=_[_0xdcef('0x54')](_0x46cabe['model'],qs[_0xdcef('0x67')](_0x409daa[_0xdcef('0x51')][_0xdcef('0x67')]));_0x102c73['attributes']=_0x102c73[_0xdcef('0x55')][_0xdcef('0x68')]?_0x102c73['attributes']:_0x46cabe['model'];_0x102c73[_0xdcef('0xb9')]=qs[_0xdcef('0x57')](_0x409daa[_0xdcef('0x51')][_0xdcef('0x57')]);_0x102c73[_0xdcef('0x59')]=qs[_0xdcef('0x53')](_[_0xdcef('0x58')](_0x409daa['query'],_0x46cabe[_0xdcef('0x53')]));if(_0x409daa[_0xdcef('0x51')][_0xdcef('0x3f')]){_0x102c73[_0xdcef('0x59')]=_[_0xdcef('0x5a')](_0x102c73[_0xdcef('0x59')],{'$or':_[_0xdcef('0x41')](_0x102c73[_0xdcef('0x55')],function(_0x39df1a){var _0x3d42e4={};_0x3d42e4[_0x39df1a]={'$like':'%'+_0x409daa['query'][_0xdcef('0x3f')]+'%'};return _0x3d42e4;})});}_0x102c73[_0xdcef('0x4d')]=db[_0xdcef('0x4a')];_0x102c73['as']=_0xdcef('0x89');_0x102c73=_['merge']({},_0x102c73,_0x409daa[_0xdcef('0x5f')]);return _0x2a3191[_0xdcef('0xdf')]({'include':[_0x102c73]});}})['then'](function(_0x15474a){if(_0x15474a){var _0x3afff3={},_0x40620d=[],_0x3e0d27=0x0;for(var _0x580474=0x0;_0x580474<_0x15474a[_0xdcef('0x68')];_0x580474+=0x1){for(var _0x40b4aa=0x0,_0x37fbba;_0x40b4aa<_0x15474a[_0x580474][_0xdcef('0x89')][_0xdcef('0x68')];_0x40b4aa+=0x1){_0x37fbba=_0x15474a[_0x580474]['Agents'][_0x40b4aa][_0xdcef('0x39')]({'plain':!![]});_0x3afff3[_0x37fbba['id']]=_0x37fbba;}}_0x3afff3=_['values'](_0x3afff3);for(var _0x2a367b=qs[_0xdcef('0x31')](_0x409daa[_0xdcef('0x51')]['offset']);_0x2a367b<_0x3afff3[_0xdcef('0x68')]&&_0x40620d['length']=_0x5843aa[_0x19c9('0x4b')]){throw new Error(_0x19c9('0x4c'));}})[_0x19c9('0xf')](function(){if(_0x48d765){return db[_0x19c9('0x28')]['destroy']({'where':{'membername':_0x48d765['name']},'individualHooks':!![]});}})[_0x19c9('0xf')](function(){if(_0x48d765){return _0x48d765[_0x19c9('0x4d')]({'raw':!![]});}})['then'](function(_0xe33f11){if(_0x48d765){if(_0xe33f11){var _0x14acc1=[];_0x13f084=_0xe33f11;if(_0x13f084[_0x19c9('0x2c')]){for(var _0x47a1da=0x0;_0x47a1da<_0x13f084[_0x19c9('0x2c')];_0x47a1da++){_0x14acc1['push'](db[_0x19c9('0x28')][_0x19c9('0x4e')]({'membername':_0x48d765[_0x19c9('0x31')],'UserId':_0x48d765['id'],'queue_name':_0x13f084[_0x47a1da][_0x19c9('0x31')],'VoiceQueueId':_0x13f084[_0x47a1da]['id'],'interface':_0x2f9d26,'paused':_0x48d765['loginInPause']||![],'penalty':_0x13f084[_0x47a1da][_0x19c9('0x4f')]||0x0}));}return BPromise[_0x19c9('0x41')](_0x14acc1);}}}})[_0x19c9('0xf')](function(){if(_0x48d765){return db['MemberReport'][_0x19c9('0x19')]({'where':{'membername':_0x48d765['name'],'exitAt':null}});}})['then'](function(_0x21a93a){if(_0x48d765){if(_0x21a93a&&_0x21a93a[_0x19c9('0x2c')]){var _0xfcb456=[];_0x21a93a[_0x19c9('0x2f')](function(_0x937260){_0xfcb456[_0x19c9('0x30')](_0x937260[_0x19c9('0x29')]({'exitAt':moment()[_0x19c9('0x2d')](_0x19c9('0x34'))}));});return BPromise[_0x19c9('0x41')](_0xfcb456);}}})[_0x19c9('0xf')](function(_0x106986){if(_0x48d765){var _0x48486b=[];var _0x3ff135=[];var _0x3ba2e0=utils[_0x19c9('0x50')]();var _0xeaba56={'membername':_0x48d765[_0x19c9('0x31')],'interface':_0x2f9d26,'enterAt':moment()[_0x19c9('0x2d')](_0x19c9('0x34')),'role':_0x48d765[_0x19c9('0x27')],'internal':_0x48d765[_0x19c9('0x36')]};_0x3ba2e0[_0x19c9('0x2f')](function(_0x2f8f0b){_0x48486b[_0x19c9('0x30')](_['merge']({'channel':_0x2f8f0b,'type':_0x19c9('0x51'),'data1':_0x19c9('0x52'),'data2':_0x2f9d26},_0xeaba56));if(_0x48d765[_0x19c9('0x53')]){_0x3ff135[_0x19c9('0x30')](_[_0x19c9('0x54')]({'channel':_0x2f8f0b,'type':_0x19c9('0x2b'),'data1':_0x19c9('0x55')},_0xeaba56));}});return db[_0x19c9('0x2a')][_0x19c9('0x39')](_0x48486b[_0x19c9('0x56')](_0x3ff135),{'individualHooks':!![]});}})[_0x19c9('0xf')](function(){if(_0x48d765){return _0x48d765['update']({'online':!![],'lastLoginAt':moment()['format'](_0x19c9('0x34')),'voicePause':_0x48d765[_0x19c9('0x53')]||![],'mailPause':_0x48d765[_0x19c9('0x53')]||![],'chatPause':_0x48d765[_0x19c9('0x53')]||![],'faxPause':_0x48d765[_0x19c9('0x53')]||![],'smsPause':_0x48d765[_0x19c9('0x53')]||![],'openchannelPause':_0x48d765[_0x19c9('0x53')]||![],'pauseType':_0x48d765[_0x19c9('0x53')]?_0x19c9('0x55'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x2f9d26});}})[_0x19c9('0xf')](function(_0x2784ff){_0x14eac7(_0x2784ff);})['catch'](function(_0x2b48da){_0x584add(_0x39005a[_0x19c9('0x15')](0x1f4,_0x2b48da['message']));});});}; \ No newline at end of file +var _0xa74e=['findAll','options','raw','where','attributes','include','map','model','then','ShowUser','find','PauseUser','interface','UserVoiceQueueRt','update','MemberReport','name','PAUSE','length','format','forEach','push','isNil','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','body','type','DEFAULT\x20PAUSE','role','internal','bulkCreate','UnpauseUser','findOne','channel','Unknown\x20channel','voice','system','mail','chat','sms','openchannel','set','%s%s','Pause','all','LogoutUser','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','getChannels','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','request','info','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetUser','User'];(function(_0x1385dc,_0x2c7fd7){var _0x2f6469=function(_0x47ed8a){while(--_0x47ed8a){_0x1385dc['push'](_0x1385dc['shift']());}};_0x2f6469(++_0x2c7fd7);}(_0xa74e,0x14e));var _0xea74=function(_0x3d4d5e,_0x4aeb41){_0x3d4d5e=_0x3d4d5e-0x0;var _0x1f6e42=_0xa74e[_0x3d4d5e];return _0x1f6e42;};'use strict';var _=require(_0xea74('0x0'));var util=require(_0xea74('0x1'));var moment=require(_0xea74('0x2'));var BPromise=require(_0xea74('0x3'));var rs=require(_0xea74('0x4'));var fs=require('fs');var Redis=require(_0xea74('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xea74('0x6'));var logger=require('../../config/logger')(_0xea74('0x7'));var config=require(_0xea74('0x8'));var jayson=require(_0xea74('0x9'));var client=jayson['client'][_0xea74('0xa')]({'port':0x232a});config[_0xea74('0xb')]=_['defaults'](config[_0xea74('0xb')],{'host':_0xea74('0xc'),'port':0x18eb});var socket=require(_0xea74('0xd'))(new Redis(config[_0xea74('0xb')]));require('./user.socket')['register'](socket);function respondWithRpcPromise(_0x55a6e4,_0x3cf375,_0x6e826a){return new BPromise(function(_0x3e3ad9,_0x2e4b8c){return client[_0xea74('0xe')](_0x55a6e4,_0x6e826a)['then'](function(_0x91191e){logger[_0xea74('0xf')](_0xea74('0x10'),_0x3cf375,_0xea74('0x11'));logger[_0xea74('0x12')]('User,\x20%s,\x20%s,\x20%s',_0x3cf375,_0xea74('0x11'),JSON[_0xea74('0x13')](_0x91191e));if(_0x91191e[_0xea74('0x14')]){if(_0x91191e[_0xea74('0x14')][_0xea74('0x15')]===0x1f4){logger[_0xea74('0x14')](_0xea74('0x10'),_0x3cf375,_0x91191e[_0xea74('0x14')][_0xea74('0x16')]);return _0x2e4b8c(_0x91191e['error']['message']);}logger[_0xea74('0x14')](_0xea74('0x10'),_0x3cf375,_0x91191e['error'][_0xea74('0x16')]);return _0x3e3ad9(_0x91191e[_0xea74('0x14')][_0xea74('0x16')]);}else{logger['info']('User,\x20%s,\x20%s',_0x3cf375,_0xea74('0x11'));_0x3e3ad9(_0x91191e['result'][_0xea74('0x16')]);}})[_0xea74('0x17')](function(_0x20c882){logger[_0xea74('0x14')](_0xea74('0x10'),_0x3cf375,_0x20c882);_0x2e4b8c(_0x20c882);});});}exports[_0xea74('0x18')]=function(_0x5916e3){var _0xdbe54e=this;return new Promise(function(_0x4fff8e,_0x5be580){return db[_0xea74('0x19')][_0xea74('0x1a')]({'raw':_0x5916e3[_0xea74('0x1b')]?_0x5916e3[_0xea74('0x1b')][_0xea74('0x1c')]===undefined?!![]:![]:!![],'where':_0x5916e3['options']?_0x5916e3['options'][_0xea74('0x1d')]||null:null,'attributes':_0x5916e3['options']?_0x5916e3[_0xea74('0x1b')][_0xea74('0x1e')]||null:null,'limit':_0x5916e3[_0xea74('0x1b')]?_0x5916e3[_0xea74('0x1b')]['limit']||null:null,'include':_0x5916e3[_0xea74('0x1b')]?_0x5916e3[_0xea74('0x1b')][_0xea74('0x1f')]?_[_0xea74('0x20')](_0x5916e3[_0xea74('0x1b')][_0xea74('0x1f')],function(_0x52d98c){return{'model':db[_0x52d98c['model']],'as':_0x52d98c['as'],'attributes':_0x52d98c[_0xea74('0x1e')],'include':_0x52d98c[_0xea74('0x1f')]?_[_0xea74('0x20')](_0x52d98c[_0xea74('0x1f')],function(_0x101d7d){return{'model':db[_0x101d7d[_0xea74('0x21')]],'as':_0x101d7d['as'],'attributes':_0x101d7d[_0xea74('0x1e')],'include':_0x101d7d[_0xea74('0x1f')]?_[_0xea74('0x20')](_0x101d7d[_0xea74('0x1f')],function(_0x184739){return{'model':db[_0x184739[_0xea74('0x21')]],'as':_0x184739['as'],'attributes':_0x184739[_0xea74('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xea74('0x22')](function(_0x575de5){logger['info'](_0xea74('0x18'),_0x5916e3);logger[_0xea74('0x12')]('GetUser',_0x5916e3,JSON[_0xea74('0x13')](_0x575de5));_0x4fff8e(_0x575de5);})[_0xea74('0x17')](function(_0x1e2e24){logger[_0xea74('0x14')](_0xea74('0x18'),_0x1e2e24[_0xea74('0x16')],_0x5916e3);_0x5be580(_0xdbe54e[_0xea74('0x14')](0x1f4,_0x1e2e24['message']));});});};exports[_0xea74('0x23')]=function(_0x39d8d9){var _0x2194d8=this;return new Promise(function(_0x280572,_0xbca32a){return db[_0xea74('0x19')][_0xea74('0x24')]({'raw':_0x39d8d9['options']?_0x39d8d9[_0xea74('0x1b')][_0xea74('0x1c')]===undefined?!![]:![]:!![],'where':_0x39d8d9[_0xea74('0x1b')]?_0x39d8d9['options'][_0xea74('0x1d')]||null:null,'attributes':_0x39d8d9[_0xea74('0x1b')]?_0x39d8d9[_0xea74('0x1b')]['attributes']||null:null,'include':_0x39d8d9['options']?_0x39d8d9['options'][_0xea74('0x1f')]?_[_0xea74('0x20')](_0x39d8d9['options'][_0xea74('0x1f')],function(_0x25495c){return{'model':db[_0x25495c[_0xea74('0x21')]],'as':_0x25495c['as'],'attributes':_0x25495c[_0xea74('0x1e')],'include':_0x25495c[_0xea74('0x1f')]?_[_0xea74('0x20')](_0x25495c['include'],function(_0x15d830){return{'model':db[_0x15d830['model']],'as':_0x15d830['as'],'attributes':_0x15d830[_0xea74('0x1e')],'include':_0x15d830['include']?_[_0xea74('0x20')](_0x15d830['include'],function(_0x3aabdd){return{'model':db[_0x3aabdd['model']],'as':_0x3aabdd['as'],'attributes':_0x3aabdd[_0xea74('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xea74('0x22')](function(_0x151c9b){logger['info'](_0xea74('0x23'),_0x39d8d9);logger[_0xea74('0x12')](_0xea74('0x23'),_0x39d8d9,JSON[_0xea74('0x13')](_0x151c9b));_0x280572(_0x151c9b);})['catch'](function(_0x282ce5){logger[_0xea74('0x14')](_0xea74('0x23'),_0x282ce5[_0xea74('0x16')],_0x39d8d9);_0xbca32a(_0x2194d8[_0xea74('0x14')](0x1f4,_0x282ce5[_0xea74('0x16')]));});});};exports[_0xea74('0x25')]=function(_0x5abb5f){var _0x343bf3=this;return new Promise(function(_0x1823ab,_0x447eac){var _0x323080;return db[_0xea74('0x19')][_0xea74('0x24')]({'where':_0x5abb5f[_0xea74('0x1b')][_0xea74('0x1d')]||{},'attributes':['id','name','role','internal',_0xea74('0x26')]})[_0xea74('0x22')](function(_0x19a08c){if(_0x19a08c){_0x323080=_0x19a08c;return db[_0xea74('0x27')][_0xea74('0x28')]({'paused':0x1},{'where':{'UserId':_0x323080['id']},'individualHooks':!![]});}})['then'](function(){if(_0x323080){return db[_0xea74('0x29')]['findAll']({'where':{'membername':_0x323080[_0xea74('0x2a')],'type':_0xea74('0x2b'),'exitAt':null}});}})[_0xea74('0x22')](function(_0x57b494){if(_0x323080){if(_0x57b494&&_0x57b494[_0xea74('0x2c')]){var _0x50df0e=moment()[_0xea74('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x3b0bcf=0x0,_0x4521e5=_0x57b494[_0xea74('0x2c')];_0x3b0bcf<_0x4521e5;_0x3b0bcf++){_0x57b494[_0x3b0bcf]['updateAttributes']({'exitAt':_0x50df0e});}}}})[_0xea74('0x22')](function(){if(_0x323080){var _0x1fddfd=[];var _0xd30f5c=utils['getChannels']();_0xd30f5c[_0xea74('0x2e')](function(_0x569702){_0x1fddfd[_0xea74('0x2f')]({'channel':_0x569702,'membername':_0x323080['name'],'interface':_[_0xea74('0x30')](_0x323080['interface'])?util[_0xea74('0x2d')](_0xea74('0x31'),_0x323080[_0xea74('0x2a')]):_0x323080['interface'],'type':_0xea74('0x2b'),'enterAt':moment()['format'](_0xea74('0x32')),'data1':_0x5abb5f[_0xea74('0x33')][_0xea74('0x34')]||_0xea74('0x35'),'role':_0x323080[_0xea74('0x36')],'internal':_0x323080[_0xea74('0x37')],'uniqueid':_0x5abb5f[_0xea74('0x33')]['uniqueid']||null});});return db['MemberReport'][_0xea74('0x38')](_0x1fddfd,{'individualHooks':!![]});}})[_0xea74('0x22')](function(){if(_0x323080){return _0x323080[_0xea74('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x5abb5f['body']['type']||_0xea74('0x35'),'lastPauseAt':moment()[_0xea74('0x2d')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xea74('0x22')](function(_0x2c4804){_0x1823ab(_0x2c4804);})[_0xea74('0x17')](function(_0x5925ff){_0x447eac(_0x343bf3['error'](0x1f4,_0x5925ff['message']));});});};exports[_0xea74('0x39')]=function(_0x29cc7a){var _0xd18370=this;return new Promise(function(_0x457a7e,_0x424068){var _0x3fb12d;return db['User'][_0xea74('0x3a')]({'where':_0x29cc7a[_0xea74('0x1b')][_0xea74('0x1d')]||{},'attributes':['id',_0xea74('0x2a')]})[_0xea74('0x22')](function(_0x10dcf7){if(_0x10dcf7){_0x3fb12d=_0x10dcf7;if(_0x29cc7a[_0xea74('0x33')][_0xea74('0x3b')]&&!utils['isValidChannel'](_0x29cc7a['body'][_0xea74('0x3b')])){throw new Error(_0xea74('0x3c'));}switch(_0x29cc7a[_0xea74('0x33')][_0xea74('0x3b')]){case _0xea74('0x3d'):return db[_0xea74('0x27')][_0xea74('0x28')]({'paused':0x0},{'where':{'UserId':_0x3fb12d['id']}})[_0xea74('0x22')](function(){return db[_0xea74('0x29')][_0xea74('0x24')]({'where':{'channel':_0x29cc7a[_0xea74('0x33')][_0xea74('0x3b')],'membername':_0x3fb12d[_0xea74('0x2a')],'type':_0xea74('0x2b'),'exitAt':null}});})[_0xea74('0x22')](function(_0x4a1f7){if(_0x4a1f7){return _0x4a1f7[_0xea74('0x28')]({'exitAt':moment()[_0xea74('0x2d')](_0xea74('0x32')),'data2':_0xea74('0x3e')},{'individualHooks':!![]});}return null;})[_0xea74('0x22')](function(){return _0x3fb12d[_0xea74('0x28')]({'voicePause':![]});});case _0xea74('0x3f'):case _0xea74('0x40'):case'fax':case _0xea74('0x41'):case _0xea74('0x42'):return db['MemberReport']['find']({'where':{'channel':_0x29cc7a[_0xea74('0x33')][_0xea74('0x3b')],'membername':_0x3fb12d[_0xea74('0x2a')],'type':'PAUSE','exitAt':null}})[_0xea74('0x22')](function(_0x2191d0){return _0x2191d0[_0xea74('0x28')]({'exitAt':moment()['format'](_0xea74('0x32')),'data2':_0xea74('0x3e')},{'individualHooks':!![]});})[_0xea74('0x22')](function(){var _0x4552d1={};_[_0xea74('0x43')](_0x4552d1,util[_0xea74('0x2d')](_0xea74('0x44'),_0x29cc7a[_0xea74('0x33')][_0xea74('0x3b')],_0xea74('0x45')),![]);return _0x3fb12d[_0xea74('0x28')](_0x4552d1);});default:return db[_0xea74('0x27')]['update']({'paused':0x0},{'where':{'UserId':_0x3fb12d['id']}})[_0xea74('0x22')](function(){return db[_0xea74('0x29')][_0xea74('0x1a')]({'where':{'membername':_0x3fb12d[_0xea74('0x2a')],'type':_0xea74('0x2b'),'exitAt':null}});})[_0xea74('0x22')](function(_0x3803b5){var _0x346fc1=[];_0x3803b5[_0xea74('0x2e')](function(_0x1dc828){_0x346fc1[_0xea74('0x2f')](_0x1dc828[_0xea74('0x28')]({'exitAt':moment()['format'](_0xea74('0x32')),'data2':_0xea74('0x3e')}));});return BPromise[_0xea74('0x46')](_0x346fc1);})[_0xea74('0x22')](function(){return _0x3fb12d[_0xea74('0x28')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xea74('0x22')](function(_0x246b2b){_0x457a7e(_0x246b2b);})[_0xea74('0x17')](function(_0x467789){_0x424068(_0xd18370['error'](0x1f4,_0x467789[_0xea74('0x16')]));});});};exports[_0xea74('0x47')]=function(_0x28e8ee){var _0x1494c1=this;return new Promise(function(_0x145627,_0x3195fe){var _0x4ee6ac;return db['User'][_0xea74('0x3a')]({'where':_0x28e8ee[_0xea74('0x1b')][_0xea74('0x1d')]||{},'attributes':['id',_0xea74('0x2a')]})[_0xea74('0x22')](function(_0x1d87ab){if(_0x1d87ab){_0x4ee6ac=_0x1d87ab;return db[_0xea74('0x27')]['destroy']({'where':{'membername':_0x4ee6ac[_0xea74('0x2a')]},'individualHooks':!![]});}})['then'](function(){if(_0x4ee6ac){return db['MemberReport'][_0xea74('0x1a')]({'where':{'membername':_0x4ee6ac[_0xea74('0x2a')],'exitAt':null}});}})['then'](function(_0x2ef6bb){if(_0x4ee6ac){if(_0x2ef6bb&&_0x2ef6bb['length']){var _0x345a4b=[];_0x2ef6bb[_0xea74('0x2e')](function(_0x34a241){_0x345a4b['push'](_0x34a241[_0xea74('0x28')]({'exitAt':moment()[_0xea74('0x2d')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xea74('0x46')](_0x345a4b);}}})[_0xea74('0x22')](function(){if(_0x4ee6ac){return _0x4ee6ac[_0xea74('0x28')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xea74('0x22')](function(_0x5c7fa9){_0x145627(_0x5c7fa9);})[_0xea74('0x17')](function(_0x338573){_0x3195fe(_0x1494c1[_0xea74('0x14')](0x1f4,_0x338573[_0xea74('0x16')]));});});};exports[_0xea74('0x48')]=function(_0x126a2a){var _0x748885=this;return new Promise(function(_0x555eb1,_0x4f5ced){var _0x44a972;var _0x52a06d;var _0x4e6ce3;var _0x59baf2;return db['User'][_0xea74('0x3a')]({'where':_0x126a2a[_0xea74('0x1b')][_0xea74('0x1d')]||{},'attributes':['id','name','role',_0xea74('0x49'),_0xea74('0x4a'),_0xea74('0x37'),_0xea74('0x4b'),_0xea74('0x26')]})['then'](function(_0x8265d2){if(_0x8265d2){_0x44a972=_0x8265d2;_0x59baf2=_0x126a2a[_0xea74('0x33')][_0xea74('0x26')]?_0x126a2a['body'][_0xea74('0x26')]:util[_0xea74('0x2d')](_0xea74('0x31'),_0x44a972['name']);return db['User'][_0xea74('0x4c')]({'where':{'role':_0xea74('0x4d'),'online':!![],'id':{'$ne':_0x44a972['id']}}});}})[_0xea74('0x22')](function(_0x2af13a){if(_0x2af13a){_0x4e6ce3=_0x2af13a;return require(_0xea74('0x4e'))[_0xea74('0x4f')]();}})[_0xea74('0x22')](function(_0x3682a8){if(_0x3682a8&&_0x3682a8[_0xea74('0x50')]&&_0x4e6ce3>=_0x3682a8[_0xea74('0x50')]){throw new Error(_0xea74('0x51'));}})[_0xea74('0x22')](function(){if(_0x44a972){return db[_0xea74('0x27')]['destroy']({'where':{'membername':_0x44a972[_0xea74('0x2a')]},'individualHooks':!![]});}})['then'](function(){if(_0x44a972){return _0x44a972[_0xea74('0x52')]({'raw':!![]});}})[_0xea74('0x22')](function(_0x3a6bec){if(_0x44a972){if(_0x3a6bec){var _0x172514=[];_0x52a06d=_0x3a6bec;if(_0x52a06d[_0xea74('0x2c')]){for(var _0x161344=0x0;_0x161344<_0x52a06d[_0xea74('0x2c')];_0x161344++){_0x172514[_0xea74('0x2f')](db[_0xea74('0x27')][_0xea74('0x53')]({'membername':_0x44a972[_0xea74('0x2a')],'UserId':_0x44a972['id'],'queue_name':_0x52a06d[_0x161344]['name'],'VoiceQueueId':_0x52a06d[_0x161344]['id'],'interface':_0x59baf2,'paused':_0x44a972['loginInPause']||![],'penalty':_0x52a06d[_0x161344]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xea74('0x46')](_0x172514);}}}})[_0xea74('0x22')](function(){if(_0x44a972){return db[_0xea74('0x29')]['findAll']({'where':{'membername':_0x44a972[_0xea74('0x2a')],'exitAt':null}});}})[_0xea74('0x22')](function(_0x32eeb7){if(_0x44a972){if(_0x32eeb7&&_0x32eeb7[_0xea74('0x2c')]){var _0x2628f1=[];_0x32eeb7[_0xea74('0x2e')](function(_0x49e7e0){_0x2628f1[_0xea74('0x2f')](_0x49e7e0[_0xea74('0x28')]({'exitAt':moment()[_0xea74('0x2d')](_0xea74('0x32'))}));});return BPromise['all'](_0x2628f1);}}})[_0xea74('0x22')](function(_0x45b56a){if(_0x44a972){var _0x45b72e=[];var _0x3db7bc=[];var _0xa98a53=utils[_0xea74('0x54')]();var _0x183017={'membername':_0x44a972[_0xea74('0x2a')],'interface':_0x59baf2,'enterAt':moment()[_0xea74('0x2d')](_0xea74('0x32')),'role':_0x44a972['role'],'internal':_0x44a972[_0xea74('0x37')]};_0xa98a53[_0xea74('0x2e')](function(_0x28732e){_0x45b72e[_0xea74('0x2f')](_[_0xea74('0x55')]({'channel':_0x28732e,'type':_0xea74('0x56'),'data1':_0xea74('0x57'),'data2':_0x59baf2},_0x183017));if(_0x44a972[_0xea74('0x4b')]){_0x3db7bc[_0xea74('0x2f')](_['merge']({'channel':_0x28732e,'type':'PAUSE','data1':_0xea74('0x58')},_0x183017));}});return db[_0xea74('0x29')][_0xea74('0x38')](_0x45b72e[_0xea74('0x59')](_0x3db7bc),{'individualHooks':!![]});}})['then'](function(){if(_0x44a972){return _0x44a972['update']({'online':!![],'lastLoginAt':moment()['format'](_0xea74('0x32')),'voicePause':_0x44a972['loginInPause']||![],'mailPause':_0x44a972[_0xea74('0x4b')]||![],'chatPause':_0x44a972[_0xea74('0x4b')]||![],'faxPause':_0x44a972['loginInPause']||![],'smsPause':_0x44a972[_0xea74('0x4b')]||![],'openchannelPause':_0x44a972['loginInPause']||![],'pauseType':_0x44a972[_0xea74('0x4b')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xea74('0x2d')](_0xea74('0x32')),'interface':_0x59baf2});}})['then'](function(_0x188078){_0x555eb1(_0x188078);})[_0xea74('0x17')](function(_0x4adbdb){_0x4f5ced(_0x748885['error'](0x1f4,_0x4adbdb[_0xea74('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 5ffeeac..f6279c8 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 _0x6f40=['./user.events','remove','update','emit','register','user:'];(function(_0x183f0a,_0x4fa8fc){var _0xe55457=function(_0x37f7d1){while(--_0x37f7d1){_0x183f0a['push'](_0x183f0a['shift']());}};_0xe55457(++_0x4fa8fc);}(_0x6f40,0x1ce));var _0x06f4=function(_0x4988d1,_0x11ce15){_0x4988d1=_0x4988d1-0x0;var _0x6640a7=_0x6f40[_0x4988d1];return _0x6640a7;};'use strict';var UserEvents=require(_0x06f4('0x0'));var events=['save',_0x06f4('0x1'),_0x06f4('0x2')];function createListener(_0xa7c170,_0x2c05dd){return function(_0x355add){_0x2c05dd[_0x06f4('0x3')](_0xa7c170,_0x355add);};}function removeListener(_0xbf74f7,_0x3f3a07){return function(){UserEvents['removeListener'](_0xbf74f7,_0x3f3a07);};}exports[_0x06f4('0x4')]=function(_0x406724){for(var _0x554504=0x0,_0xcf6d0c=events['length'];_0x554504<_0xcf6d0c;_0x554504++){var _0x14f493=events[_0x554504];var _0x2cd7f3=createListener(_0x06f4('0x5')+_0x14f493,_0x406724);UserEvents['on'](_0x14f493,_0x2cd7f3);}}; \ No newline at end of file +var _0xf0f3=['./user.events','save','remove','update','emit','removeListener','register','length','user:'];(function(_0x29dda1,_0x508e13){var _0x21b0ef=function(_0x118906){while(--_0x118906){_0x29dda1['push'](_0x29dda1['shift']());}};_0x21b0ef(++_0x508e13);}(_0xf0f3,0xea));var _0x3f0f=function(_0x146cb6,_0x3ee1bc){_0x146cb6=_0x146cb6-0x0;var _0x69472=_0xf0f3[_0x146cb6];return _0x69472;};'use strict';var UserEvents=require(_0x3f0f('0x0'));var events=[_0x3f0f('0x1'),_0x3f0f('0x2'),_0x3f0f('0x3')];function createListener(_0x3cdfc7,_0x216a08){return function(_0x29b5ec){_0x216a08[_0x3f0f('0x4')](_0x3cdfc7,_0x29b5ec);};}function removeListener(_0x3f4c49,_0x484899){return function(){UserEvents[_0x3f0f('0x5')](_0x3f4c49,_0x484899);};}exports[_0x3f0f('0x6')]=function(_0x5e1f89){for(var _0xfdf297=0x0,_0x4c4885=events[_0x3f0f('0x7')];_0xfdf297<_0x4c4885;_0xfdf297++){var _0x4a5089=events[_0xfdf297];var _0x5a5539=createListener(_0x3f0f('0x8')+_0x4a5089,_0x5e1f89);UserEvents['on'](_0x4a5089,_0x5a5539);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 4888d48..01681fe 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 _0x15c5=['exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x15c5,0xe8));var _0x515c=function(_0x5093e9,_0x5154d0){_0x5093e9=_0x5093e9-0x0;var _0x4c9a22=_0x15c5[_0x5093e9];return _0x4c9a22;};'use strict';var multer=require(_0x515c('0x0'));var util=require(_0x515c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x515c('0x2'));var router=express['Router']();var auth=require(_0x515c('0x3'));var interaction=require(_0x515c('0x4'));var config=require(_0x515c('0x5'));module[_0x515c('0x6')]=router; \ No newline at end of file +var _0x2df4=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','express','Router'];(function(_0x239b31,_0x44a64d){var _0x41c8be=function(_0x27f031){while(--_0x27f031){_0x239b31['push'](_0x239b31['shift']());}};_0x41c8be(++_0x44a64d);}(_0x2df4,0x1b3));var _0x42df=function(_0xaf025d,_0x586d7a){_0xaf025d=_0xaf025d-0x0;var _0x1c77cb=_0x2df4[_0xaf025d];return _0x1c77cb;};'use strict';var multer=require(_0x42df('0x0'));var util=require(_0x42df('0x1'));var path=require(_0x42df('0x2'));var timeout=require('connect-timeout');var express=require(_0x42df('0x3'));var router=express[_0x42df('0x4')]();var auth=require(_0x42df('0x5'));var interaction=require(_0x42df('0x6'));var config=require('../../config/environment');module[_0x42df('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 95ef1a1..32ba65a 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(_0x3e451f,_0x10500d){var _0x57978f=function(_0x52f960){while(--_0x52f960){_0x3e451f['push'](_0x3e451f['shift']());}};_0x57978f(++_0x10500d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x13639d,_0x3c996b){var _0x52ef14=function(_0x3faf51){while(--_0x3faf51){_0x13639d['push'](_0x13639d['shift']());}};_0x52ef14(++_0x3c996b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'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/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 58b410e..90a971c 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 _0x94e6=['moment','bluebird','request-promise','path','../../config/environment','./userChatQueue.attributes','define','UserChatQueue','lodash','../../config/logger','api'];(function(_0x2d6d0f,_0x3cf2a5){var _0xd2bee6=function(_0x2fc9cd){while(--_0x2fc9cd){_0x2d6d0f['push'](_0x2d6d0f['shift']());}};_0xd2bee6(++_0x3cf2a5);}(_0x94e6,0x194));var _0x694e=function(_0x380f10,_0x2a59b9){_0x380f10=_0x380f10-0x0;var _0x54f735=_0x94e6[_0x380f10];return _0x54f735;};'use strict';var _=require(_0x694e('0x0'));var util=require('util');var logger=require(_0x694e('0x1'))(_0x694e('0x2'));var moment=require(_0x694e('0x3'));var BPromise=require(_0x694e('0x4'));var rp=require(_0x694e('0x5'));var fs=require('fs');var path=require(_0x694e('0x6'));var rimraf=require('rimraf');var config=require(_0x694e('0x7'));var attributes=require(_0x694e('0x8'));module['exports']=function(_0x59abaf,_0x43238f){return _0x59abaf[_0x694e('0x9')](_0x694e('0xa'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb35e=['rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x475421,_0x49f93b){var _0xc17842=function(_0x4e6c75){while(--_0x4e6c75){_0x475421['push'](_0x475421['shift']());}};_0xc17842(++_0x49f93b);}(_0xb35e,0x96));var _0xeb35=function(_0x3445fa,_0x4deceb){_0x3445fa=_0x3445fa-0x0;var _0x1dd4a4=_0xb35e[_0x3445fa];return _0x1dd4a4;};'use strict';var _=require('lodash');var util=require(_0xeb35('0x0'));var logger=require(_0xeb35('0x1'))(_0xeb35('0x2'));var moment=require(_0xeb35('0x3'));var BPromise=require(_0xeb35('0x4'));var rp=require(_0xeb35('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb35('0x6'));var config=require(_0xeb35('0x7'));var attributes=require(_0xeb35('0x8'));module[_0xeb35('0x9')]=function(_0x49e097,_0x147eeb){return _0x49e097[_0xeb35('0xa')](_0xeb35('0xb'),attributes,{'tableName':_0xeb35('0xc'),'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 4bbc47b..133a683 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 _0x6e13=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','util','moment'];(function(_0x224cb5,_0x2984fe){var _0x5ba5fb=function(_0x3a2887){while(--_0x3a2887){_0x224cb5['push'](_0x224cb5['shift']());}};_0x5ba5fb(++_0x2984fe);}(_0x6e13,0xfb));var _0x36e1=function(_0xb6dfed,_0x5d1355){_0xb6dfed=_0xb6dfed-0x0;var _0x260f26=_0x6e13[_0xb6dfed];return _0x260f26;};'use strict';var _=require('lodash');var util=require(_0x36e1('0x0'));var moment=require(_0x36e1('0x1'));var BPromise=require(_0x36e1('0x2'));var rs=require(_0x36e1('0x3'));var fs=require('fs');var Redis=require(_0x36e1('0x4'));var db=require(_0x36e1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x36e1('0x6'))(_0x36e1('0x7'));var config=require('../../config/environment');var jayson=require(_0x36e1('0x8'));var client=jayson[_0x36e1('0x9')][_0x36e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57f882,_0x211cdc,_0x249347){return new BPromise(function(_0x2a8722,_0x443f49){return client[_0x36e1('0xb')](_0x57f882,_0x249347)[_0x36e1('0xc')](function(_0xbd0c14){logger[_0x36e1('0xd')](_0x36e1('0xe'),_0x211cdc,'request\x20sent');logger[_0x36e1('0xf')](_0x36e1('0x10'),_0x211cdc,'request\x20sent',JSON[_0x36e1('0x11')](_0xbd0c14));if(_0xbd0c14[_0x36e1('0x12')]){if(_0xbd0c14[_0x36e1('0x12')][_0x36e1('0x13')]===0x1f4){logger[_0x36e1('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x211cdc,_0xbd0c14['error'][_0x36e1('0x14')]);return _0x443f49(_0xbd0c14['error'][_0x36e1('0x14')]);}logger[_0x36e1('0x12')](_0x36e1('0xe'),_0x211cdc,_0xbd0c14[_0x36e1('0x12')][_0x36e1('0x14')]);return _0x2a8722(_0xbd0c14[_0x36e1('0x12')]['message']);}else{logger['info'](_0x36e1('0xe'),_0x211cdc,_0x36e1('0x15'));_0x2a8722(_0xbd0c14['result'][_0x36e1('0x14')]);}})[_0x36e1('0x16')](function(_0x5ecbe7){logger[_0x36e1('0x12')](_0x36e1('0xe'),_0x211cdc,_0x5ecbe7);_0x443f49(_0x5ecbe7);});});} \ No newline at end of file +var _0xb961=['http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x240cdb,_0x2474a1){var _0x223938=function(_0x3ad79f){while(--_0x3ad79f){_0x240cdb['push'](_0x240cdb['shift']());}};_0x223938(++_0x2474a1);}(_0xb961,0x150));var _0x1b96=function(_0x4be9cc,_0x13cf88){_0x4be9cc=_0x4be9cc-0x0;var _0x24b3b6=_0xb961[_0x4be9cc];return _0x24b3b6;};'use strict';var _=require(_0x1b96('0x0'));var util=require(_0x1b96('0x1'));var moment=require(_0x1b96('0x2'));var BPromise=require(_0x1b96('0x3'));var rs=require(_0x1b96('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b96('0x5'))['db'];var utils=require(_0x1b96('0x6'));var logger=require('../../config/logger')(_0x1b96('0x7'));var config=require(_0x1b96('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1b96('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x580030,_0x5c04e2,_0x34ab00){return new BPromise(function(_0x4aabb7,_0x1ab5c5){return client[_0x1b96('0xa')](_0x580030,_0x34ab00)[_0x1b96('0xb')](function(_0x316f9d){logger['info'](_0x1b96('0xc'),_0x5c04e2,_0x1b96('0xd'));logger[_0x1b96('0xe')](_0x1b96('0xf'),_0x5c04e2,_0x1b96('0xd'),JSON[_0x1b96('0x10')](_0x316f9d));if(_0x316f9d['error']){if(_0x316f9d[_0x1b96('0x11')][_0x1b96('0x12')]===0x1f4){logger['error'](_0x1b96('0xc'),_0x5c04e2,_0x316f9d[_0x1b96('0x11')][_0x1b96('0x13')]);return _0x1ab5c5(_0x316f9d['error'][_0x1b96('0x13')]);}logger[_0x1b96('0x11')](_0x1b96('0xc'),_0x5c04e2,_0x316f9d['error'][_0x1b96('0x13')]);return _0x4aabb7(_0x316f9d[_0x1b96('0x11')][_0x1b96('0x13')]);}else{logger[_0x1b96('0x14')](_0x1b96('0xc'),_0x5c04e2,_0x1b96('0xd'));_0x4aabb7(_0x316f9d[_0x1b96('0x15')][_0x1b96('0x13')]);}})[_0x1b96('0x16')](function(_0x36977d){logger['error'](_0x1b96('0xc'),_0x5c04e2,_0x36977d);_0x1ab5c5(_0x36977d);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 0962bc6..3d4f93f 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 _0xfad3=['../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout','Router'];(function(_0x4147dd,_0x3e8700){var _0x3f3959=function(_0x4ff70a){while(--_0x4ff70a){_0x4147dd['push'](_0x4147dd['shift']());}};_0x3f3959(++_0x3e8700);}(_0xfad3,0x13d));var _0x3fad=function(_0x1162b1,_0x35b69f){_0x1162b1=_0x1162b1-0x0;var _0x2165b0=_0xfad3[_0x1162b1];return _0x2165b0;};'use strict';var multer=require(_0x3fad('0x0'));var util=require(_0x3fad('0x1'));var path=require(_0x3fad('0x2'));var timeout=require(_0x3fad('0x3'));var express=require('express');var router=express[_0x3fad('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3fad('0x5'));var config=require(_0x3fad('0x6'));module['exports']=router; \ No newline at end of file +var _0x78fc=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x27d402,_0x26a705){var _0x383012=function(_0x3b406f){while(--_0x3b406f){_0x27d402['push'](_0x27d402['shift']());}};_0x383012(++_0x26a705);}(_0x78fc,0x19f));var _0xc78f=function(_0x3d9b04,_0x1e851a){_0x3d9b04=_0x3d9b04-0x0;var _0x557936=_0x78fc[_0x3d9b04];return _0x557936;};'use strict';var multer=require('multer');var util=require(_0xc78f('0x0'));var path=require(_0xc78f('0x1'));var timeout=require(_0xc78f('0x2'));var express=require(_0xc78f('0x3'));var router=express[_0xc78f('0x4')]();var auth=require(_0xc78f('0x5'));var interaction=require(_0xc78f('0x6'));var config=require(_0xc78f('0x7'));module[_0xc78f('0x8')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index e82d3d2..c9bd96e 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 _0x34b7=['INTEGER','STRING'];(function(_0x66efbd,_0x8967a8){var _0x1c55ce=function(_0x5f3eb1){while(--_0x5f3eb1){_0x66efbd['push'](_0x66efbd['shift']());}};_0x1c55ce(++_0x8967a8);}(_0x34b7,0x196));var _0x734b=function(_0x5d672b,_0x28f0e4){_0x5d672b=_0x5d672b-0x0;var _0x3268fc=_0x34b7[_0x5d672b];return _0x3268fc;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x734b('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x734b('0x0')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x734b('0x1')]}}; \ No newline at end of file +var _0x7916=['sequelize','INTEGER'];(function(_0x3f6565,_0x12a8bb){var _0x4abd23=function(_0x56dce7){while(--_0x56dce7){_0x3f6565['push'](_0x3f6565['shift']());}};_0x4abd23(++_0x12a8bb);}(_0x7916,0x128));var _0x6791=function(_0xa76900,_0x505859){_0xa76900=_0xa76900-0x0;var _0x32e47a=_0x7916[_0xa76900];return _0x32e47a;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x6791('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6791('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 0ca9038..63a85d7 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 _0x06d9=['define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./userFaxQueue.attributes','exports'];(function(_0x285db,_0x4f4926){var _0x2ebec6=function(_0x3a08c3){while(--_0x3a08c3){_0x285db['push'](_0x285db['shift']());}};_0x2ebec6(++_0x4f4926);}(_0x06d9,0xab));var _0x906d=function(_0x235904,_0x23660b){_0x235904=_0x235904-0x0;var _0x4fd850=_0x06d9[_0x235904];return _0x4fd850;};'use strict';var _=require(_0x906d('0x0'));var util=require(_0x906d('0x1'));var logger=require(_0x906d('0x2'))('api');var moment=require(_0x906d('0x3'));var BPromise=require(_0x906d('0x4'));var rp=require(_0x906d('0x5'));var fs=require('fs');var path=require(_0x906d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x906d('0x7'));module[_0x906d('0x8')]=function(_0x2e0a10,_0x3f4b9c){return _0x2e0a10[_0x906d('0x9')](_0x906d('0xa'),attributes,{'tableName':_0x906d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ef2=['api','bluebird','request-promise','../../config/environment','./userFaxQueue.attributes','define','user_has_fax_queues','lodash','../../config/logger'];(function(_0x2e58a5,_0x5d77ec){var _0x452d1b=function(_0x346d44){while(--_0x346d44){_0x2e58a5['push'](_0x2e58a5['shift']());}};_0x452d1b(++_0x5d77ec);}(_0x7ef2,0x15d));var _0x27ef=function(_0x25857d,_0x10e441){_0x25857d=_0x25857d-0x0;var _0x149bbc=_0x7ef2[_0x25857d];return _0x149bbc;};'use strict';var _=require(_0x27ef('0x0'));var util=require('util');var logger=require(_0x27ef('0x1'))(_0x27ef('0x2'));var moment=require('moment');var BPromise=require(_0x27ef('0x3'));var rp=require(_0x27ef('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x27ef('0x5'));var attributes=require(_0x27ef('0x6'));module['exports']=function(_0x2416e9,_0x294340){return _0x2416e9[_0x27ef('0x7')]('UserFaxQueue',attributes,{'tableName':_0x27ef('0x8'),'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 92d22f6..5659f96 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 _0xdc3f=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x59c508,_0x190bdd){var _0xf3dcdf=function(_0xdfa4d4){while(--_0xdfa4d4){_0x59c508['push'](_0x59c508['shift']());}};_0xf3dcdf(++_0x190bdd);}(_0xdc3f,0xaf));var _0xfdc3=function(_0x13b8dc,_0x5920a7){_0x13b8dc=_0x13b8dc-0x0;var _0x6b1dc8=_0xdc3f[_0x13b8dc];return _0x6b1dc8;};'use strict';var _=require(_0xfdc3('0x0'));var util=require(_0xfdc3('0x1'));var moment=require(_0xfdc3('0x2'));var BPromise=require(_0xfdc3('0x3'));var rs=require(_0xfdc3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfdc3('0x5'))['db'];var utils=require(_0xfdc3('0x6'));var logger=require(_0xfdc3('0x7'))('rpc');var config=require(_0xfdc3('0x8'));var jayson=require(_0xfdc3('0x9'));var client=jayson[_0xfdc3('0xa')][_0xfdc3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27ed9a,_0x4bece2,_0x20bed5){return new BPromise(function(_0x2fb217,_0x195fb1){return client['request'](_0x27ed9a,_0x20bed5)[_0xfdc3('0xc')](function(_0x396eb4){logger['info'](_0xfdc3('0xd'),_0x4bece2,'request\x20sent');logger[_0xfdc3('0xe')](_0xfdc3('0xf'),_0x4bece2,_0xfdc3('0x10'),JSON[_0xfdc3('0x11')](_0x396eb4));if(_0x396eb4[_0xfdc3('0x12')]){if(_0x396eb4[_0xfdc3('0x12')][_0xfdc3('0x13')]===0x1f4){logger['error'](_0xfdc3('0xd'),_0x4bece2,_0x396eb4[_0xfdc3('0x12')][_0xfdc3('0x14')]);return _0x195fb1(_0x396eb4[_0xfdc3('0x12')]['message']);}logger[_0xfdc3('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x4bece2,_0x396eb4['error']['message']);return _0x2fb217(_0x396eb4[_0xfdc3('0x12')][_0xfdc3('0x14')]);}else{logger[_0xfdc3('0x15')](_0xfdc3('0xd'),_0x4bece2,_0xfdc3('0x10'));_0x2fb217(_0x396eb4[_0xfdc3('0x16')][_0xfdc3('0x14')]);}})[_0xfdc3('0x17')](function(_0x51c76c){logger[_0xfdc3('0x12')](_0xfdc3('0xd'),_0x4bece2,_0x51c76c);_0x195fb1(_0x51c76c);});});} \ No newline at end of file +var _0x22ea=['request','then','info','request\x20sent','debug','stringify','error','UserFaxQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2f0c0a,_0x28851b){var _0x13d13e=function(_0x486d0b){while(--_0x486d0b){_0x2f0c0a['push'](_0x2f0c0a['shift']());}};_0x13d13e(++_0x28851b);}(_0x22ea,0xb3));var _0xa22e=function(_0xba2236,_0x56bf52){_0xba2236=_0xba2236-0x0;var _0x4c951e=_0x22ea[_0xba2236];return _0x4c951e;};'use strict';var _=require(_0xa22e('0x0'));var util=require(_0xa22e('0x1'));var moment=require(_0xa22e('0x2'));var BPromise=require(_0xa22e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa22e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa22e('0x5'));var logger=require(_0xa22e('0x6'))(_0xa22e('0x7'));var config=require(_0xa22e('0x8'));var jayson=require(_0xa22e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x172a46,_0x2088bc,_0x35d380){return new BPromise(function(_0x8bb3e3,_0x326dfb){return client[_0xa22e('0xa')](_0x172a46,_0x35d380)[_0xa22e('0xb')](function(_0xd970e6){logger[_0xa22e('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x2088bc,_0xa22e('0xd'));logger[_0xa22e('0xe')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x2088bc,_0xa22e('0xd'),JSON[_0xa22e('0xf')](_0xd970e6));if(_0xd970e6[_0xa22e('0x10')]){if(_0xd970e6[_0xa22e('0x10')]['code']===0x1f4){logger['error'](_0xa22e('0x11'),_0x2088bc,_0xd970e6[_0xa22e('0x10')][_0xa22e('0x12')]);return _0x326dfb(_0xd970e6[_0xa22e('0x10')][_0xa22e('0x12')]);}logger[_0xa22e('0x10')](_0xa22e('0x11'),_0x2088bc,_0xd970e6[_0xa22e('0x10')][_0xa22e('0x12')]);return _0x8bb3e3(_0xd970e6[_0xa22e('0x10')][_0xa22e('0x12')]);}else{logger[_0xa22e('0xc')](_0xa22e('0x11'),_0x2088bc,_0xa22e('0xd'));_0x8bb3e3(_0xd970e6[_0xa22e('0x13')][_0xa22e('0x12')]);}})[_0xa22e('0x14')](function(_0x1c72d5){logger[_0xa22e('0x10')](_0xa22e('0x11'),_0x2088bc,_0x1c72d5);_0x326dfb(_0x1c72d5);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index c23f977..149a1db 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 _0x56a4=['../../components/interaction/service','exports','multer','util','path','express'];(function(_0x41e114,_0x3a15b7){var _0x4bb441=function(_0x1946a6){while(--_0x1946a6){_0x41e114['push'](_0x41e114['shift']());}};_0x4bb441(++_0x3a15b7);}(_0x56a4,0x1d0));var _0x456a=function(_0x231a42,_0x39f4db){_0x231a42=_0x231a42-0x0;var _0x3c2a56=_0x56a4[_0x231a42];return _0x3c2a56;};'use strict';var multer=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var path=require(_0x456a('0x2'));var timeout=require('connect-timeout');var express=require(_0x456a('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x456a('0x4'));var config=require('../../config/environment');module[_0x456a('0x5')]=router; \ No newline at end of file +var _0xf02d=['../../config/environment','exports','multer','util','express','../../components/auth/service','../../components/interaction/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf02d,0x1c2));var _0xdf02=function(_0x1eee23,_0x33da43){_0x1eee23=_0x1eee23-0x0;var _0x3a601b=_0xf02d[_0x1eee23];return _0x3a601b;};'use strict';var multer=require(_0xdf02('0x0'));var util=require(_0xdf02('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdf02('0x2'));var router=express['Router']();var auth=require(_0xdf02('0x3'));var interaction=require(_0xdf02('0x4'));var config=require(_0xdf02('0x5'));module[_0xdf02('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 22ca62b..9690910 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 _0xb10b=['sequelize','INTEGER'];(function(_0x23bc1b,_0x3fd4b2){var _0x5d84d9=function(_0x46b8cf){while(--_0x46b8cf){_0x23bc1b['push'](_0x23bc1b['shift']());}};_0x5d84d9(++_0x3fd4b2);}(_0xb10b,0x12a));var _0xbb10=function(_0x7cb905,_0x5c2772){_0x7cb905=_0x7cb905-0x0;var _0x411552=_0xb10b[_0x7cb905];return _0x411552;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x469665,_0x394876){var _0x291ab5=function(_0x55c1c7){while(--_0x55c1c7){_0x469665['push'](_0x469665['shift']());}};_0x291ab5(++_0x394876);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 337d1d0..5536bb3 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 _0x757a=['define','user_has_mail_queues','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x350182,_0x2a9feb){var _0x4a0892=function(_0x2c994d){while(--_0x2c994d){_0x350182['push'](_0x350182['shift']());}};_0x4a0892(++_0x2a9feb);}(_0x757a,0xde));var _0xa757=function(_0x344c56,_0x3cb133){_0x344c56=_0x344c56-0x0;var _0x541348=_0x757a[_0x344c56];return _0x541348;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('UserMailQueue',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['define','user_has_mail_queues','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x2f8000,_0x37c02b){var _0x25cfee=function(_0x56aca2){while(--_0x56aca2){_0x2f8000['push'](_0x2f8000['shift']());}};_0x25cfee(++_0x37c02b);}(_0x757a,0xde));var _0xa757=function(_0x47fc88,_0x38e22b){_0x47fc88=_0x47fc88-0x0;var _0x3c62b8=_0x757a[_0x47fc88];return _0x3c62b8;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('UserMailQueue',attributes,{'tableName':_0xa757('0x9'),'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 ab3c38f..03e0cae 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 _0x2171=['util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','result'];(function(_0x372e56,_0x598ae9){var _0xd50420=function(_0x1b72b3){while(--_0x1b72b3){_0x372e56['push'](_0x372e56['shift']());}};_0xd50420(++_0x598ae9);}(_0x2171,0x143));var _0x1217=function(_0x13552a,_0x428e20){_0x13552a=_0x13552a-0x0;var _0x18deab=_0x2171[_0x13552a];return _0x18deab;};'use strict';var _=require('lodash');var util=require(_0x1217('0x0'));var moment=require(_0x1217('0x1'));var BPromise=require(_0x1217('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1217('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1217('0x4'))(_0x1217('0x5'));var config=require(_0x1217('0x6'));var jayson=require(_0x1217('0x7'));var client=jayson['client'][_0x1217('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8742bc,_0x32a022,_0x5bde7e){return new BPromise(function(_0x46474e,_0x2a3c36){return client[_0x1217('0x9')](_0x8742bc,_0x5bde7e)[_0x1217('0xa')](function(_0x152be6){logger[_0x1217('0xb')]('UserMailQueue,\x20%s,\x20%s',_0x32a022,_0x1217('0xc'));logger['debug'](_0x1217('0xd'),_0x32a022,_0x1217('0xc'),JSON[_0x1217('0xe')](_0x152be6));if(_0x152be6[_0x1217('0xf')]){if(_0x152be6[_0x1217('0xf')]['code']===0x1f4){logger[_0x1217('0xf')](_0x1217('0x10'),_0x32a022,_0x152be6[_0x1217('0xf')][_0x1217('0x11')]);return _0x2a3c36(_0x152be6[_0x1217('0xf')]['message']);}logger['error'](_0x1217('0x10'),_0x32a022,_0x152be6['error']['message']);return _0x46474e(_0x152be6[_0x1217('0xf')]['message']);}else{logger['info'](_0x1217('0x10'),_0x32a022,_0x1217('0xc'));_0x46474e(_0x152be6[_0x1217('0x12')][_0x1217('0x11')]);}})['catch'](function(_0x3ff82d){logger[_0x1217('0xf')](_0x1217('0x10'),_0x32a022,_0x3ff82d);_0x2a3c36(_0x3ff82d);});});} \ No newline at end of file +var _0x0c85=['error','code','UserMailQueue,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x5bb068,_0x38b1fc){var _0x494663=function(_0x24d8cc){while(--_0x24d8cc){_0x5bb068['push'](_0x5bb068['shift']());}};_0x494663(++_0x38b1fc);}(_0x0c85,0x14f));var _0x50c8=function(_0x57f5dd,_0x588c9c){_0x57f5dd=_0x57f5dd-0x0;var _0x223485=_0x0c85[_0x57f5dd];return _0x223485;};'use strict';var _=require(_0x50c8('0x0'));var util=require(_0x50c8('0x1'));var moment=require(_0x50c8('0x2'));var BPromise=require('bluebird');var rs=require(_0x50c8('0x3'));var fs=require('fs');var Redis=require(_0x50c8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x50c8('0x5'));var logger=require(_0x50c8('0x6'))(_0x50c8('0x7'));var config=require(_0x50c8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x50c8('0x9')][_0x50c8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ee0f3,_0x3f7d4d,_0x4ae724){return new BPromise(function(_0x515cdb,_0x51d8e4){return client[_0x50c8('0xb')](_0x5ee0f3,_0x4ae724)[_0x50c8('0xc')](function(_0x5df8d6){logger[_0x50c8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x3f7d4d,_0x50c8('0xe'));logger[_0x50c8('0xf')](_0x50c8('0x10'),_0x3f7d4d,_0x50c8('0xe'),JSON['stringify'](_0x5df8d6));if(_0x5df8d6['error']){if(_0x5df8d6[_0x50c8('0x11')][_0x50c8('0x12')]===0x1f4){logger['error'](_0x50c8('0x13'),_0x3f7d4d,_0x5df8d6[_0x50c8('0x11')][_0x50c8('0x14')]);return _0x51d8e4(_0x5df8d6['error'][_0x50c8('0x14')]);}logger[_0x50c8('0x11')](_0x50c8('0x13'),_0x3f7d4d,_0x5df8d6[_0x50c8('0x11')][_0x50c8('0x14')]);return _0x515cdb(_0x5df8d6[_0x50c8('0x11')]['message']);}else{logger[_0x50c8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x3f7d4d,'request\x20sent');_0x515cdb(_0x5df8d6[_0x50c8('0x15')]['message']);}})['catch'](function(_0x5a5167){logger['error'](_0x50c8('0x13'),_0x3f7d4d,_0x5a5167);_0x51d8e4(_0x5a5167);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 8824929..aa0c2be 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 _0x950d=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','multer','util'];(function(_0x146be0,_0x39a85e){var _0x1bcc25=function(_0x4f871f){while(--_0x4f871f){_0x146be0['push'](_0x146be0['shift']());}};_0x1bcc25(++_0x39a85e);}(_0x950d,0x96));var _0xd950=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x950d[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0xd950('0x0'));var util=require(_0xd950('0x1'));var path=require(_0xd950('0x2'));var timeout=require(_0xd950('0x3'));var express=require(_0xd950('0x4'));var router=express[_0xd950('0x5')]();var auth=require(_0xd950('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd950('0x7'));module['exports']=router; \ No newline at end of file +var _0x5874=['path','express','Router','../../components/auth/service','../../config/environment','exports','multer'];(function(_0x562638,_0x52c539){var _0x275811=function(_0x48e209){while(--_0x48e209){_0x562638['push'](_0x562638['shift']());}};_0x275811(++_0x52c539);}(_0x5874,0x11e));var _0x4587=function(_0x3ba835,_0x4102d7){_0x3ba835=_0x3ba835-0x0;var _0x4aa500=_0x5874[_0x3ba835];return _0x4aa500;};'use strict';var multer=require(_0x4587('0x0'));var util=require('util');var path=require(_0x4587('0x1'));var timeout=require('connect-timeout');var express=require(_0x4587('0x2'));var router=express[_0x4587('0x3')]();var auth=require(_0x4587('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4587('0x5'));module[_0x4587('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 0b8566d..0203f6e 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x166f53,_0x56b484){var _0x5848a8=function(_0x4c4c89){while(--_0x4c4c89){_0x166f53['push'](_0x166f53['shift']());}};_0x5848a8(++_0x56b484);}(_0xe706,0xa3));var _0x6e70=function(_0x3f00ee,_0x1d1673){_0x3f00ee=_0x3f00ee-0x0;var _0x18a07e=_0xe706[_0x3f00ee];return _0x18a07e;};'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(_0x5ec365,_0x49930c){var _0xab187d=function(_0x4d4bbd){while(--_0x4d4bbd){_0x5ec365['push'](_0x5ec365['shift']());}};_0xab187d(++_0x49930c);}(_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 diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 05c92ca..35f967d 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 _0xdba7=['exports','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','api','moment','request-promise','../../config/environment','./userOpenchannelQueue.attributes'];(function(_0x35485a,_0x91cdd4){var _0x5148e6=function(_0x27ed1d){while(--_0x27ed1d){_0x35485a['push'](_0x35485a['shift']());}};_0x5148e6(++_0x91cdd4);}(_0xdba7,0x1c5));var _0x7dba=function(_0x2755ba,_0x5e0e39){_0x2755ba=_0x2755ba-0x0;var _0x2c3a3d=_0xdba7[_0x2755ba];return _0x2c3a3d;};'use strict';var _=require(_0x7dba('0x0'));var util=require(_0x7dba('0x1'));var logger=require('../../config/logger')(_0x7dba('0x2'));var moment=require(_0x7dba('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dba('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7dba('0x5'));var attributes=require(_0x7dba('0x6'));module[_0x7dba('0x7')]=function(_0x4afe75,_0x55c8a1){return _0x4afe75['define'](_0x7dba('0x8'),attributes,{'tableName':_0x7dba('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d21=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger'];(function(_0x2c5a16,_0x1c7d1d){var _0x40cd8e=function(_0x26a6e1){while(--_0x26a6e1){_0x2c5a16['push'](_0x2c5a16['shift']());}};_0x40cd8e(++_0x1c7d1d);}(_0x0d21,0x9a));var _0x10d2=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x0d21[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require('lodash');var util=require(_0x10d2('0x0'));var logger=require(_0x10d2('0x1'))('api');var moment=require(_0x10d2('0x2'));var BPromise=require(_0x10d2('0x3'));var rp=require(_0x10d2('0x4'));var fs=require('fs');var path=require(_0x10d2('0x5'));var rimraf=require(_0x10d2('0x6'));var config=require(_0x10d2('0x7'));var attributes=require(_0x10d2('0x8'));module[_0x10d2('0x9')]=function(_0x464b8d,_0x3a00f0){return _0x464b8d[_0x10d2('0xa')](_0x10d2('0xb'),attributes,{'tableName':_0x10d2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 8eced5d..6e21d9b 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 _0x468e=['../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','error','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4619eb,_0x2abc00){var _0x108a1b=function(_0x150509){while(--_0x150509){_0x4619eb['push'](_0x4619eb['shift']());}};_0x108a1b(++_0x2abc00);}(_0x468e,0x1f2));var _0xe468=function(_0x4423e1,_0x513c2c){_0x4423e1=_0x4423e1-0x0;var _0x3c3986=_0x468e[_0x4423e1];return _0x3c3986;};'use strict';var _=require(_0xe468('0x0'));var util=require(_0xe468('0x1'));var moment=require(_0xe468('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe468('0x3'));var db=require(_0xe468('0x4'))['db'];var utils=require(_0xe468('0x5'));var logger=require(_0xe468('0x6'))(_0xe468('0x7'));var config=require(_0xe468('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe468('0x9')][_0xe468('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ce0a6,_0x365265,_0x21f124){return new BPromise(function(_0x5da14a,_0x3f57a8){return client[_0xe468('0xb')](_0x2ce0a6,_0x21f124)[_0xe468('0xc')](function(_0x2a90e7){logger[_0xe468('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x365265,_0xe468('0xe'));logger[_0xe468('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x365265,_0xe468('0xe'),JSON[_0xe468('0x10')](_0x2a90e7));if(_0x2a90e7[_0xe468('0x11')]){if(_0x2a90e7[_0xe468('0x11')]['code']===0x1f4){logger[_0xe468('0x11')](_0xe468('0x12'),_0x365265,_0x2a90e7[_0xe468('0x11')]['message']);return _0x3f57a8(_0x2a90e7[_0xe468('0x11')][_0xe468('0x13')]);}logger['error'](_0xe468('0x12'),_0x365265,_0x2a90e7[_0xe468('0x11')][_0xe468('0x13')]);return _0x5da14a(_0x2a90e7['error'][_0xe468('0x13')]);}else{logger[_0xe468('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x365265,_0xe468('0xe'));_0x5da14a(_0x2a90e7[_0xe468('0x14')][_0xe468('0x13')]);}})[_0xe468('0x15')](function(_0x34ec9b){logger[_0xe468('0x11')](_0xe468('0x12'),_0x365265,_0x34ec9b);_0x3f57a8(_0x34ec9b);});});} \ No newline at end of file +var _0x29ed=['request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserOpenchannelQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1754e3,_0x19fad9){var _0x42f5c0=function(_0x2214bb){while(--_0x2214bb){_0x1754e3['push'](_0x1754e3['shift']());}};_0x42f5c0(++_0x19fad9);}(_0x29ed,0xb9));var _0xd29e=function(_0x1bfb97,_0x33280e){_0x1bfb97=_0x1bfb97-0x0;var _0x2b6881=_0x29ed[_0x1bfb97];return _0x2b6881;};'use strict';var _=require(_0xd29e('0x0'));var util=require(_0xd29e('0x1'));var moment=require(_0xd29e('0x2'));var BPromise=require(_0xd29e('0x3'));var rs=require(_0xd29e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd29e('0x5'))['db'];var utils=require(_0xd29e('0x6'));var logger=require(_0xd29e('0x7'))(_0xd29e('0x8'));var config=require(_0xd29e('0x9'));var jayson=require(_0xd29e('0xa'));var client=jayson[_0xd29e('0xb')][_0xd29e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42e24d,_0x4df1ad,_0x4e8ae6){return new BPromise(function(_0x14c0fa,_0x48d9c2){return client[_0xd29e('0xd')](_0x42e24d,_0x4e8ae6)[_0xd29e('0xe')](function(_0x636b5c){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4df1ad,_0xd29e('0xf'));logger[_0xd29e('0x10')](_0xd29e('0x11'),_0x4df1ad,_0xd29e('0xf'),JSON[_0xd29e('0x12')](_0x636b5c));if(_0x636b5c[_0xd29e('0x13')]){if(_0x636b5c[_0xd29e('0x13')]['code']===0x1f4){logger[_0xd29e('0x13')](_0xd29e('0x14'),_0x4df1ad,_0x636b5c[_0xd29e('0x13')][_0xd29e('0x15')]);return _0x48d9c2(_0x636b5c[_0xd29e('0x13')][_0xd29e('0x15')]);}logger[_0xd29e('0x13')](_0xd29e('0x14'),_0x4df1ad,_0x636b5c['error'][_0xd29e('0x15')]);return _0x14c0fa(_0x636b5c['error'][_0xd29e('0x15')]);}else{logger[_0xd29e('0x16')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4df1ad,_0xd29e('0xf'));_0x14c0fa(_0x636b5c[_0xd29e('0x17')]['message']);}})[_0xd29e('0x18')](function(_0x38ade7){logger[_0xd29e('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4df1ad,_0x38ade7);_0x48d9c2(_0x38ade7);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 8eb1239..2c4f7fe 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 _0x29b5=['/:id/sections','getSections','/:id/resources','getResources','create','post','/:id/clone','clone','addSections','addResources','put','update','delete','destroy','removeSections','removeResources','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfile.controller','isAuthenticated','index','get','describe','/:id','show'];(function(_0x1396d4,_0x1b1f3d){var _0x533cf1=function(_0xece410){while(--_0xece410){_0x1396d4['push'](_0x1396d4['shift']());}};_0x533cf1(++_0x1b1f3d);}(_0x29b5,0xcb));var _0x529b=function(_0x4fa3ce,_0x429688){_0x4fa3ce=_0x4fa3ce-0x0;var _0x194f86=_0x29b5[_0x4fa3ce];return _0x194f86;};'use strict';var multer=require(_0x529b('0x0'));var util=require(_0x529b('0x1'));var path=require('path');var timeout=require(_0x529b('0x2'));var express=require(_0x529b('0x3'));var router=express[_0x529b('0x4')]();var auth=require(_0x529b('0x5'));var interaction=require(_0x529b('0x6'));var config=require('../../config/environment');var controller=require(_0x529b('0x7'));router['get']('/',auth[_0x529b('0x8')](),controller[_0x529b('0x9')]);router[_0x529b('0xa')]('/describe',auth[_0x529b('0x8')](),controller[_0x529b('0xb')]);router['get'](_0x529b('0xc'),auth[_0x529b('0x8')](),controller[_0x529b('0xd')]);router[_0x529b('0xa')](_0x529b('0xe'),auth[_0x529b('0x8')](),controller[_0x529b('0xf')]);router[_0x529b('0xa')](_0x529b('0x10'),auth[_0x529b('0x8')](),controller[_0x529b('0x11')]);router['post']('/',auth[_0x529b('0x8')](),controller[_0x529b('0x12')]);router[_0x529b('0x13')](_0x529b('0x14'),auth['isAuthenticated'](),controller[_0x529b('0x15')]);router[_0x529b('0x13')](_0x529b('0xe'),auth[_0x529b('0x8')](),controller[_0x529b('0x16')]);router[_0x529b('0x13')](_0x529b('0x10'),auth[_0x529b('0x8')](),controller[_0x529b('0x17')]);router[_0x529b('0x18')](_0x529b('0xc'),auth[_0x529b('0x8')](),controller[_0x529b('0x19')]);router[_0x529b('0x1a')](_0x529b('0xc'),auth[_0x529b('0x8')](),controller[_0x529b('0x1b')]);router[_0x529b('0x1a')]('/:id/sections',auth[_0x529b('0x8')](),controller[_0x529b('0x1c')]);router[_0x529b('0x1a')](_0x529b('0x10'),auth[_0x529b('0x8')](),controller[_0x529b('0x1d')]);module[_0x529b('0x1e')]=router; \ No newline at end of file +var _0x4c13=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','getSections','getResources','post','create','/:id/clone','clone','/:id/sections','addSections','/:id/resources','addResources','put','destroy','delete','removeResources','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x5dd7e2,_0x47fb52){var _0x37ae17=function(_0x3c11ab){while(--_0x3c11ab){_0x5dd7e2['push'](_0x5dd7e2['shift']());}};_0x37ae17(++_0x47fb52);}(_0x4c13,0x167));var _0x34c1=function(_0x16cb9f,_0x5f467a){_0x16cb9f=_0x16cb9f-0x0;var _0x2063a3=_0x4c13[_0x16cb9f];return _0x2063a3;};'use strict';var multer=require(_0x34c1('0x0'));var util=require('util');var path=require(_0x34c1('0x1'));var timeout=require(_0x34c1('0x2'));var express=require(_0x34c1('0x3'));var router=express['Router']();var auth=require(_0x34c1('0x4'));var interaction=require(_0x34c1('0x5'));var config=require(_0x34c1('0x6'));var controller=require('./userProfile.controller');router[_0x34c1('0x7')]('/',auth[_0x34c1('0x8')](),controller[_0x34c1('0x9')]);router[_0x34c1('0x7')](_0x34c1('0xa'),auth[_0x34c1('0x8')](),controller[_0x34c1('0xb')]);router['get'](_0x34c1('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x34c1('0x7')]('/:id/sections',auth[_0x34c1('0x8')](),controller[_0x34c1('0xd')]);router[_0x34c1('0x7')]('/:id/resources',auth[_0x34c1('0x8')](),controller[_0x34c1('0xe')]);router[_0x34c1('0xf')]('/',auth['isAuthenticated'](),controller[_0x34c1('0x10')]);router[_0x34c1('0xf')](_0x34c1('0x11'),auth[_0x34c1('0x8')](),controller[_0x34c1('0x12')]);router['post'](_0x34c1('0x13'),auth[_0x34c1('0x8')](),controller[_0x34c1('0x14')]);router[_0x34c1('0xf')](_0x34c1('0x15'),auth[_0x34c1('0x8')](),controller[_0x34c1('0x16')]);router[_0x34c1('0x17')](_0x34c1('0xc'),auth[_0x34c1('0x8')](),controller['update']);router['delete']('/:id',auth[_0x34c1('0x8')](),controller[_0x34c1('0x18')]);router[_0x34c1('0x19')]('/:id/sections',auth[_0x34c1('0x8')](),controller['removeSections']);router['delete'](_0x34c1('0x15'),auth[_0x34c1('0x8')](),controller[_0x34c1('0x1a')]);module[_0x34c1('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 88dc765..12bc996 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 _0x0d5a=['split','exports','name','STRING','setDataValue','crudPermissions','getDataValue'];(function(_0x4e170e,_0x207e58){var _0x338291=function(_0x4cb198){while(--_0x4cb198){_0x4e170e['push'](_0x4e170e['shift']());}};_0x338291(++_0x207e58);}(_0x0d5a,0xe8));var _0xa0d5=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x0d5a[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require('sequelize');module[_0xa0d5('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa0d5('0x1')},'crudPermissions':{'type':Sequelize[_0xa0d5('0x2')],'set':function(_0x424def){this[_0xa0d5('0x3')](_0xa0d5('0x4'),_0x424def?_0x424def['join'](''):[]);},'get':function(){return this[_0xa0d5('0x5')](_0xa0d5('0x4'))?this[_0xa0d5('0x5')](_0xa0d5('0x4'))[_0xa0d5('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xbaca=['setDataValue','join','getDataValue','crudPermissions','sequelize','exports','name','STRING'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xbaca,0xfc));var _0xabac=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0xbaca[_0x43f881];return _0x365c14;};'use strict';var Sequelize=require(_0xabac('0x0'));module[_0xabac('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xabac('0x2')},'crudPermissions':{'type':Sequelize[_0xabac('0x3')],'set':function(_0x599bac){this[_0xabac('0x4')]('crudPermissions',_0x599bac?_0x599bac[_0xabac('0x5')](''):[]);},'get':function(){return this[_0xabac('0x6')](_0xabac('0x7'))?this[_0xabac('0x6')](_0xabac('0x7'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 765f6bb..843b255 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 _0x0bb6=['OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','teams','Team','voicequeues','queuecampaigns','QueueCampaigns','users','agents','telephones','Users','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','customdashboards','Interval','pauses','Pause','scheduler','Schedule','sounds','tags','templates','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','extractedreports','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','end','status','offset','limit','set','Content-Range','json','save','update','then','destroy','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','clone','params','get','omit','crudPermissions','createdAt','updatedAt','each','autoAssociation','UserProfileResource','userProfileId','UserProfileSection','Resources','describe','addSections','sequelize','transaction','sectionId','push','removeSections','ids','getSections','filter','enabled','includes','isEmpty','subsections','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','findOne','all','ignore','union','field','AnalyticExtractedReport','associatedResources','foreignKey','DefaultReports','reportId','CmContact','Tag','Tags','color','tag','value','SquareProject','odbc','SquareOdbc','squarerecordings','SquareProjects','projectName','projects','Lists','ListId','lists','CmList','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus'];(function(_0x59ab95,_0x122377){var _0x86a4fd=function(_0x1d81ee){while(--_0x1d81ee){_0x59ab95['push'](_0x59ab95['shift']());}};_0x86a4fd(++_0x122377);}(_0x0bb6,0x112));var _0x60bb=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0bb6[_0x57b54c];return _0x59cc19;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x60bb('0x0'));var rimraf=require(_0x60bb('0x1'));var zipdir=require(_0x60bb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x60bb('0x3'));var moment=require(_0x60bb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x60bb('0x5'));var util=require(_0x60bb('0x6'));var path=require(_0x60bb('0x7'));var sox=require(_0x60bb('0x8'));var csv=require(_0x60bb('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x60bb('0xa'));var squel=require(_0x60bb('0xb'));var crypto=require(_0x60bb('0xc'));var jsforce=require(_0x60bb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x60bb('0x9'));var querystring=require('querystring');var Papa=require(_0x60bb('0xe'));var Redis=require(_0x60bb('0xf'));var authService=require(_0x60bb('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x60bb('0x11'));var hardwareService=require(_0x60bb('0x12'));var logger=require(_0x60bb('0x13'))(_0x60bb('0x14'));var utils=require(_0x60bb('0x15'));var config=require(_0x60bb('0x16'));var db=require(_0x60bb('0x17'))['db'];config[_0x60bb('0x18')]=_['defaults'](config[_0x60bb('0x18')],{'host':_0x60bb('0x19'),'port':0x18eb});var socket=require(_0x60bb('0x1a'))(new Redis(config[_0x60bb('0x18')]));require(_0x60bb('0x1b'))[_0x60bb('0x1c')](socket);function respondWithStatusCode(_0x617bac,_0x41ea52){_0x41ea52=_0x41ea52||0xcc;return function(_0x5e6c95){if(_0x5e6c95){return _0x617bac[_0x60bb('0x1d')](_0x41ea52);}return _0x617bac['status'](_0x41ea52)[_0x60bb('0x1e')]();};}function respondWithResult(_0x4fcc25,_0x1075a5){_0x1075a5=_0x1075a5||0xc8;return function(_0x40ae8d){if(_0x40ae8d){return _0x4fcc25[_0x60bb('0x1f')](_0x1075a5)['json'](_0x40ae8d);}};}function respondWithFilteredResult(_0x57e075,_0x2b7cb8){return function(_0x457e3f){if(_0x457e3f){var _0x3569ba=_0x457e3f['count'],_0x3a098e=_0x2b7cb8[_0x60bb('0x20')],_0x377244=_0x2b7cb8['offset']+_0x2b7cb8[_0x60bb('0x21')],_0x1fca03;if(_0x377244>=_0x3569ba){_0x377244=_0x3569ba;_0x1fca03=0xc8;}else{_0x1fca03=0xce;}_0x57e075[_0x60bb('0x1f')](_0x1fca03);return _0x57e075[_0x60bb('0x22')](_0x60bb('0x23'),_0x3a098e+'-'+_0x377244+'/'+_0x3569ba)[_0x60bb('0x24')](_0x457e3f);}return null;};}function patchUpdates(_0x17689f){return function(_0x1cf93e){try{jsonpatch['apply'](_0x1cf93e,_0x17689f,!![]);}catch(_0x5d4ce4){return BPromise['reject'](_0x5d4ce4);}return _0x1cf93e[_0x60bb('0x25')]();};}function saveUpdates(_0x23a75d,_0x20aef1){return function(_0x42e585){if(_0x42e585){return _0x42e585[_0x60bb('0x26')](_0x23a75d)[_0x60bb('0x27')](function(_0x24a232){return _0x24a232;});}return null;};}function removeEntity(_0x14011e,_0x438a5c){return function(_0xe4f2fe){if(_0xe4f2fe){return _0xe4f2fe[_0x60bb('0x28')]()['then'](function(){_0x14011e[_0x60bb('0x1f')](0xcc)[_0x60bb('0x1e')]();});}};}function handleEntityNotFound(_0x15cd1b,_0x4479ed){return function(_0x565e1e){if(!_0x565e1e){_0x15cd1b[_0x60bb('0x1d')](0x194);}return _0x565e1e;};}function handleError(_0x5ca2e7,_0x4476c8){_0x4476c8=_0x4476c8||0x1f4;return function(_0x4569dc){logger['error'](_0x4569dc[_0x60bb('0x29')]);if(_0x4569dc[_0x60bb('0x2a')]){delete _0x4569dc['name'];}_0x5ca2e7[_0x60bb('0x1f')](_0x4476c8)[_0x60bb('0x2b')](_0x4569dc);};}exports[_0x60bb('0x2c')]=function(_0x3602e5,_0x490d90){var _0x19af4b={},_0x3a3312={},_0x5e7a8b={'count':0x0,'rows':[]};var _0x1dfdc3=_[_0x60bb('0x2d')](db[_0x60bb('0x2e')][_0x60bb('0x2f')],function(_0x4379f7){return{'name':_0x4379f7[_0x60bb('0x30')],'type':_0x4379f7[_0x60bb('0x31')][_0x60bb('0x32')]};});_0x3a3312[_0x60bb('0x33')]=_[_0x60bb('0x2d')](_0x1dfdc3,_0x60bb('0x2a'));_0x3a3312[_0x60bb('0x34')]=_[_0x60bb('0x35')](_0x3602e5[_0x60bb('0x34')]);_0x3a3312[_0x60bb('0x36')]=_[_0x60bb('0x37')](_0x3a3312[_0x60bb('0x33')],_0x3a3312[_0x60bb('0x34')]);_0x19af4b[_0x60bb('0x38')]=_['intersection'](_0x3a3312[_0x60bb('0x33')],qs[_0x60bb('0x39')](_0x3602e5[_0x60bb('0x34')][_0x60bb('0x39')]));_0x19af4b[_0x60bb('0x38')]=_0x19af4b[_0x60bb('0x38')][_0x60bb('0x3a')]?_0x19af4b[_0x60bb('0x38')]:_0x3a3312[_0x60bb('0x33')];if(!_0x3602e5[_0x60bb('0x34')][_0x60bb('0x3b')](_0x60bb('0x3c'))){_0x19af4b['limit']=qs['limit'](_0x3602e5['query'][_0x60bb('0x21')]);_0x19af4b['offset']=qs[_0x60bb('0x20')](_0x3602e5[_0x60bb('0x34')][_0x60bb('0x20')]);}_0x19af4b[_0x60bb('0x3d')]=qs[_0x60bb('0x3e')](_0x3602e5[_0x60bb('0x34')]['sort']);_0x19af4b[_0x60bb('0x3f')]=qs[_0x60bb('0x36')](_[_0x60bb('0x40')](_0x3602e5['query'],_0x3a3312[_0x60bb('0x36')]));if(_0x3602e5['query']['filter']){_0x19af4b['where']=_[_0x60bb('0x41')](_0x19af4b[_0x60bb('0x3f')],{'$or':_[_0x60bb('0x2d')](_0x1dfdc3,function(_0x5e2ac1){if(_0x5e2ac1[_0x60bb('0x31')]!==_0x60bb('0x42')){var _0x223da5={};_0x223da5[_0x5e2ac1[_0x60bb('0x2a')]]={'$like':'%'+_0x3602e5[_0x60bb('0x34')]['filter']+'%'};return _0x223da5;}})});}_0x19af4b=_[_0x60bb('0x41')]({},_0x19af4b,_0x3602e5[_0x60bb('0x43')]);var _0x1e790d={'where':_0x19af4b[_0x60bb('0x3f')]};return db[_0x60bb('0x2e')]['count'](_0x1e790d)['then'](function(_0x2f116d){_0x5e7a8b[_0x60bb('0x44')]=_0x2f116d;if(_0x3602e5[_0x60bb('0x34')][_0x60bb('0x45')]){_0x19af4b[_0x60bb('0x46')]=[{'all':!![]}];}return db[_0x60bb('0x2e')][_0x60bb('0x47')](_0x19af4b);})[_0x60bb('0x27')](function(_0x5407e2){_0x5e7a8b[_0x60bb('0x48')]=_0x5407e2;return _0x5e7a8b;})[_0x60bb('0x27')](respondWithFilteredResult(_0x490d90,_0x19af4b))[_0x60bb('0x49')](handleError(_0x490d90,null));};exports[_0x60bb('0x4a')]=function(_0x5f0701,_0xfbe81e){var _0x4a2cd9={'raw':![],'where':{'id':_0x5f0701['params']['id']}},_0x1ef08c={};_0x1ef08c[_0x60bb('0x33')]=_[_0x60bb('0x35')](db[_0x60bb('0x2e')][_0x60bb('0x2f')]);_0x1ef08c[_0x60bb('0x34')]=_[_0x60bb('0x35')](_0x5f0701[_0x60bb('0x34')]);_0x1ef08c[_0x60bb('0x36')]=_[_0x60bb('0x37')](_0x1ef08c[_0x60bb('0x33')],_0x1ef08c[_0x60bb('0x34')]);_0x4a2cd9['attributes']=_['intersection'](_0x1ef08c['model'],qs['fields'](_0x5f0701[_0x60bb('0x34')][_0x60bb('0x39')]));_0x4a2cd9['attributes']=_0x4a2cd9['attributes'][_0x60bb('0x3a')]?_0x4a2cd9[_0x60bb('0x38')]:_0x1ef08c[_0x60bb('0x33')];if(_0x5f0701[_0x60bb('0x34')]['includeAll']){_0x4a2cd9[_0x60bb('0x46')]=[{'all':!![]}];}_0x4a2cd9=_[_0x60bb('0x41')]({},_0x4a2cd9,_0x5f0701[_0x60bb('0x43')]);return db[_0x60bb('0x2e')][_0x60bb('0x4b')](_0x4a2cd9)['then'](handleEntityNotFound(_0xfbe81e,null))[_0x60bb('0x27')](respondWithResult(_0xfbe81e,null))[_0x60bb('0x49')](handleError(_0xfbe81e,null));};exports['create']=function(_0x1ad174,_0x5cff88){return db[_0x60bb('0x2e')][_0x60bb('0x4c')](_0x1ad174[_0x60bb('0x4d')],{})[_0x60bb('0x27')](respondWithResult(_0x5cff88,0xc9))['catch'](handleError(_0x5cff88,null));};exports[_0x60bb('0x4e')]=function(_0x3ffefd,_0x5312dc){var _0x31a54d={'where':{'id':_0x3ffefd[_0x60bb('0x4f')]['id']}},_0x105ca0={};_0x105ca0['model']=_[_0x60bb('0x35')](db[_0x60bb('0x2e')][_0x60bb('0x2f')]);_0x31a54d[_0x60bb('0x38')]=_[_0x60bb('0x37')](_0x105ca0[_0x60bb('0x33')],qs[_0x60bb('0x39')](_0x3ffefd[_0x60bb('0x34')]['fields']));_0x31a54d[_0x60bb('0x38')]=_0x31a54d[_0x60bb('0x38')][_0x60bb('0x3a')]?_0x31a54d[_0x60bb('0x38')]:_0x105ca0[_0x60bb('0x33')];if(_0x3ffefd['query']['includeAll']){_0x31a54d[_0x60bb('0x46')]=[{'all':!![]}];}_0x31a54d=_['merge']({},_0x31a54d,_0x3ffefd[_0x60bb('0x43')]);return db[_0x60bb('0x2e')][_0x60bb('0x4b')](_0x31a54d)[_0x60bb('0x27')](handleEntityNotFound(_0x5312dc,null))['then'](function(_0x15a91f){if(_0x15a91f){var _0x3000fd=_0x15a91f[_0x60bb('0x50')]({'plain':!![]});_0x3000fd=qs[_0x60bb('0x51')](_0x3000fd,['id','createdAt','updatedAt',_0x60bb('0x52')]);_0x3ffefd[_0x60bb('0x4d')]=_[_0x60bb('0x51')](_0x3ffefd[_0x60bb('0x4d')],['id',_0x60bb('0x53'),_0x60bb('0x54')]);return db['sequelize']['transaction'](function(_0x482dbe){return db[_0x60bb('0x2e')][_0x60bb('0x4c')](_[_0x60bb('0x41')](_0x3000fd,_0x3ffefd[_0x60bb('0x4d')]),{'include':_0x3ffefd[_0x60bb('0x34')][_0x60bb('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x482dbe})[_0x60bb('0x27')](function(_0x301f87){var _0x2f8f03=_0x301f87[_0x60bb('0x50')]({'plain':!![]});return db['UserProfileSection'][_0x60bb('0x47')]({'where':{'userProfileId':_0x3ffefd[_0x60bb('0x4f')]['id']},'raw':!![]})['then'](function(_0x35703a){if(_0x35703a){return BPromise[_0x60bb('0x55')](_0x35703a,function(_0x1ee659){return new BPromise(function(_0x3d1466,_0x59f8dd){if(_0x1ee659[_0x60bb('0x56')]===null||_0x1ee659[_0x60bb('0x56')]===0x1)_0x3d1466(null);return db[_0x60bb('0x57')]['findAll']({'where':{'sectionId':_0x1ee659['id']},'raw':!![]})[_0x60bb('0x27')](function(_0x2d78f6){var _0x1c5155=_[_0x60bb('0x2d')](_0x2d78f6,function(_0x227630){return qs[_0x60bb('0x51')](_0x227630,['id',_0x60bb('0x53'),_0x60bb('0x54'),'sectionId']);});_0x3d1466(_0x1c5155);})[_0x60bb('0x49')](function(_0xa29c02){_0x59f8dd(_0xa29c02);});})[_0x60bb('0x27')](function(_0x9840ee){var _0x528ad3=qs[_0x60bb('0x51')](_0x1ee659,['id',_0x60bb('0x53'),'updatedAt']);_0x528ad3[_0x60bb('0x58')]=_0x2f8f03['id'];if(_0x9840ee)_0x528ad3['Resources']=_0x9840ee;return _0x528ad3;})[_0x60bb('0x27')](function(_0x37fa61){return db[_0x60bb('0x59')][_0x60bb('0x4c')](_0x37fa61,{'include':[{'model':db[_0x60bb('0x57')],'as':_0x60bb('0x5a')}],'raw':!![],'transaction':_0x482dbe});});})[_0x60bb('0x27')](function(){return _0x2f8f03;});}});});});}})[_0x60bb('0x27')](respondWithResult(_0x5312dc,0xc9))[_0x60bb('0x49')](handleError(_0x5312dc,null));};exports['update']=function(_0x4aa27a,_0x5c3fe5){if(_0x4aa27a['body']['id']){delete _0x4aa27a[_0x60bb('0x4d')]['id'];}return db['UserProfile'][_0x60bb('0x4b')]({'where':{'id':_0x4aa27a[_0x60bb('0x4f')]['id']}})[_0x60bb('0x27')](handleEntityNotFound(_0x5c3fe5,null))[_0x60bb('0x27')](saveUpdates(_0x4aa27a[_0x60bb('0x4d')],null))[_0x60bb('0x27')](respondWithResult(_0x5c3fe5,null))[_0x60bb('0x49')](handleError(_0x5c3fe5,null));};exports['destroy']=function(_0x282357,_0x409ada){return db[_0x60bb('0x2e')][_0x60bb('0x4b')]({'where':{'id':_0x282357[_0x60bb('0x4f')]['id']}})[_0x60bb('0x27')](handleEntityNotFound(_0x409ada,null))[_0x60bb('0x27')](removeEntity(_0x409ada,null))['catch'](handleError(_0x409ada,null));};exports[_0x60bb('0x5b')]=function(_0x3d5e1e,_0x39ba73){return db[_0x60bb('0x2e')][_0x60bb('0x5b')]()[_0x60bb('0x27')](respondWithResult(_0x39ba73,null))[_0x60bb('0x49')](handleError(_0x39ba73,null));};exports[_0x60bb('0x5c')]=function(_0x4a9b38,_0x40baa7){var _0x5b64d6=_0x4a9b38[_0x60bb('0x4d')];return db[_0x60bb('0x2e')]['find']({'where':{'id':_0x4a9b38[_0x60bb('0x4f')]['id']}})['then'](handleEntityNotFound(_0x40baa7,null))[_0x60bb('0x27')](function(_0x278628){if(_0x278628){return db[_0x60bb('0x5d')][_0x60bb('0x5e')](function(_0x14262a){return db[_0x60bb('0x59')][_0x60bb('0x28')]({'where':{'userProfileId':_0x4a9b38[_0x60bb('0x4f')]['id'],'sectionId':_['map'](_0x5b64d6,function(_0x4402b3){return _0x4402b3[_0x60bb('0x5f')];})},'transaction':_0x14262a})['then'](function(){var _0x2c04dd=_['map'](_0x5b64d6,function(_0x794cbd){_0x794cbd[_0x60bb('0x58')]=_0x4a9b38[_0x60bb('0x4f')]['id'];return _0x794cbd;});var _0x588f79=[];return BPromise[_0x60bb('0x55')](_0x2c04dd,function(_0x48618a){return db[_0x60bb('0x59')]['create'](_0x48618a,{'include':[{'model':db[_0x60bb('0x57')],'as':_0x60bb('0x5a')}],'raw':!![],'transaction':_0x14262a})[_0x60bb('0x27')](function(_0x37103b){_0x588f79[_0x60bb('0x60')](_0x37103b[_0x60bb('0x50')]({'plain':!![]}));});})['then'](function(){return _0x588f79;});});});}})[_0x60bb('0x27')](function(_0x40d8ae){return _0x40d8ae;})[_0x60bb('0x27')](respondWithResult(_0x40baa7,null))['catch'](handleError(_0x40baa7,null));};exports[_0x60bb('0x61')]=function(_0x2f451c,_0x2bbcbe){var _0x43088f;return db['UserProfile'][_0x60bb('0x4b')]({'where':{'id':_0x2f451c['params']['id']},'attributes':['id',_0x60bb('0x2a')]})[_0x60bb('0x27')](handleEntityNotFound(_0x2bbcbe,null))['then'](function(_0x13c39c){if(_0x13c39c){_0x43088f=_0x13c39c;return db[_0x60bb('0x59')][_0x60bb('0x28')]({'where':{'userProfileId':_0x2f451c[_0x60bb('0x4f')]['id'],'sectionId':_0x2f451c['query'][_0x60bb('0x62')]}});}})[_0x60bb('0x27')](function(){return _0x43088f;})[_0x60bb('0x27')](respondWithStatusCode(_0x2bbcbe,null))[_0x60bb('0x49')](handleError(_0x2bbcbe,null));};exports[_0x60bb('0x63')]=function(_0x3b7c9,_0x298753){var _0x398e95=[];var _0x249832=[];return db[_0x60bb('0x59')][_0x60bb('0x47')]({'where':{'userProfileId':_0x3b7c9['params']['id']},'raw':!![]})['then'](function(_0x57db1f){_0x398e95=_[_0x60bb('0x64')](_0x57db1f,function(_0x3c3847){return _0x3c3847[_0x60bb('0x65')]===0x1||_[_0x60bb('0x66')]([0x3eb,0x709],_0x3c3847[_0x60bb('0x5f')]);});if(!_[_0x60bb('0x67')](_0x398e95)){return _[_0x60bb('0x2d')](_0x398e95,function(_0x3f7256){return _0x3f7256[_0x60bb('0x5f')];});}else{return;}})[_0x60bb('0x27')](function(_0x4a0ff5){if(_0x4a0ff5)_0x249832=_0x4a0ff5;if(_[_0x60bb('0x66')](_0x249832,0x64)){var _0x41b44f=_[_0x60bb('0x4b')](_0x398e95,{'sectionId':0x64});return hasDefaultDashboard(_0x41b44f)[_0x60bb('0x27')](function(_0x413b72){return _[_0x60bb('0x2d')](_0x398e95,function(_0x3782ac){if(_0x3782ac[_0x60bb('0x5f')]===0x64){_0x3782ac['subsections']=_0x413b72;}return _0x3782ac;});});}else{return;}})[_0x60bb('0x27')](function(_0x39280d){if(_0x39280d)_0x398e95=_0x39280d;if(_[_0x60bb('0x66')](_0x249832,0x3eb)){var _0x2483c2=_[_0x60bb('0x4b')](_0x398e95,{'sectionId':0x3eb});return getCustomDashboards(_0x2483c2)[_0x60bb('0x27')](function(_0x50eee0){return _[_0x60bb('0x2d')](_0x398e95,function(_0x2d450d){if(_0x2483c2['enabled']){if(_0x2d450d[_0x60bb('0x5f')]===0x3eb){_0x2d450d[_0x60bb('0x68')]=_0x50eee0;}}else{if(_0x2d450d[_0x60bb('0x5f')]===0x64){_0x2d450d[_0x60bb('0x68')]=_0x50eee0;}}return _0x2d450d;});});}else{return;}})[_0x60bb('0x27')](function(_0x2aaa26){if(_0x2aaa26)_0x398e95=_0x2aaa26;if(_['includes'](_0x249832,0x709)){var _0x38980a=_['find'](_0x398e95,{'sectionId':0x709});return getPlugins(_0x38980a)[_0x60bb('0x27')](function(_0x37534c){if(_0x38980a['enabled']){return _['map'](_0x398e95,function(_0x2d170f){if(_0x2d170f[_0x60bb('0x5f')]===0x709){_0x2d170f[_0x60bb('0x68')]=_0x37534c;}return _0x2d170f;});}else{var _0x1714b9={'sectionId':0x76c,'enabled':0x1,'subsections':_0x37534c};var _0x21ac0f=_['map'](_0x398e95);_0x21ac0f['push'](_0x1714b9);return _0x21ac0f;}});}else{return;}})[_0x60bb('0x27')](function(_0x22bfbf){if(_0x22bfbf)_0x398e95=_0x22bfbf;return _[_0x60bb('0x64')](_0x398e95,[_0x60bb('0x65'),0x1]);})[_0x60bb('0x27')](respondWithResult(_0x298753,null))[_0x60bb('0x49')](handleError(_0x298753,null));};function hasDefaultDashboard(_0x3c88c6){var _0xebc665=[0x65];return new BPromise(function(_0x51a70b,_0x426097){try{if(_0x3c88c6[_0x60bb('0x56')]){_0x51a70b(_0xebc665);}else{return db[_0x60bb('0x57')]['findOne']({'where':{'sectionId':_0x3c88c6['id']},'raw':!![]})[_0x60bb('0x27')](function(_0x1782ad){_0x1782ad?_0x51a70b(_0xebc665):_0x51a70b();});}}catch(_0x37e8a8){_0x426097(_0x37e8a8);}});}function getCustomDashboards(_0xa6a175){var _0x119835=[];return new BPromise(function(_0x1bc9d7,_0x733358){try{if(_0xa6a175['autoAssociation']){return db[_0x60bb('0x69')]['findAll']({'raw':!![]})[_0x60bb('0x27')](function(_0x7d416b){_0x7d416b[_0x60bb('0x6a')](function(_0x5a75d0){_0x119835[_0x60bb('0x60')](_0x5a75d0['id']+0x1869f);});_0x1bc9d7(_0x119835);});}else{return db['UserProfileResource'][_0x60bb('0x47')]({'where':{'sectionId':_0xa6a175['id']},'raw':!![]})['then'](function(_0x129d47){_0x129d47['forEach'](function(_0x58e36b){_0x119835[_0x60bb('0x60')](_0x58e36b[_0x60bb('0x6b')]+0x1869f);});_0x1bc9d7(_0x119835);});}}catch(_0x25e668){_0x733358(_0x25e668);}});}function getPlugins(_0x2787ab){var _0x4c2c2e=[];return new BPromise(function(_0x3cd5c8,_0x23a8eb){try{if(_0x2787ab[_0x60bb('0x56')]){return db[_0x60bb('0x6c')][_0x60bb('0x47')]({'raw':!![]})['then'](function(_0x468885){_0x468885[_0x60bb('0x6a')](function(_0x44c077){_0x4c2c2e[_0x60bb('0x60')](_0x44c077['id']+0x15b38);});_0x3cd5c8(_0x4c2c2e);});}else{return db[_0x60bb('0x57')]['findAll']({'where':{'sectionId':_0x2787ab['id']},'raw':!![]})[_0x60bb('0x27')](function(_0x408e2f){_0x408e2f[_0x60bb('0x6a')](function(_0x553907){_0x4c2c2e[_0x60bb('0x60')](_0x553907[_0x60bb('0x6b')]+0x15b38);});_0x3cd5c8(_0x4c2c2e);});}}catch(_0x10f351){_0x23a8eb(_0x10f351);}});}exports['addResources']=function(_0x5dd8ff,_0x279ab0){return db[_0x60bb('0x2e')][_0x60bb('0x4b')]({'where':{'id':_0x5dd8ff[_0x60bb('0x4f')]['id']}})['then'](handleEntityNotFound(_0x279ab0,null))[_0x60bb('0x27')](function(_0xe8012b){if(_0xe8012b){return db[_0x60bb('0x5d')][_0x60bb('0x5e')](function(_0x2802b6){return db['UserProfileSection'][_0x60bb('0x47')]({'where':{'userProfileId':_0x5dd8ff['params']['id']},'attributes':['id'],'raw':!![]})[_0x60bb('0x27')](function(_0x3d1cd3){if(_0x3d1cd3){return db[_0x60bb('0x59')][_0x60bb('0x28')]({'where':{'userProfileId':_0x5dd8ff['params']['id'],'id':_[_0x60bb('0x2d')](_0x3d1cd3,function(_0x2b5eb8){return _0x2b5eb8['id'];})},'transaction':_0x2802b6});}})[_0x60bb('0x27')](function(_0x51d416){var _0x478e27=_[_0x60bb('0x2d')](_0x5dd8ff[_0x60bb('0x4d')],function(_0x5bf682){_0x5bf682[_0x60bb('0x58')]=_0x5dd8ff[_0x60bb('0x4f')]['id'];return _0x5bf682;});return db[_0x60bb('0x59')][_0x60bb('0x6d')](_0x478e27,{'raw':!![],'transaction':_0x2802b6});})[_0x60bb('0x27')](function(_0x10013a){var _0x359266=_['filter'](_[_0x60bb('0x2d')](_0x10013a,function(_0x1b2c29){return _0x1b2c29[_0x60bb('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x359266){return db[_0x60bb('0x59')]['findAll']({'where':{'userProfileId':_0x5dd8ff['params']['id'],'sectionId':_[_0x60bb('0x2d')](_0x359266,function(_0x95e1e8){return _0x95e1e8['sectionId'];})},'attributes':['id',_0x60bb('0x5f')],'raw':!![]})[_0x60bb('0x27')](function(_0x44966c){var _0x27abf9=_[_0x60bb('0x2d')](_0x5dd8ff['body'],function(_0x86e851){_0x86e851[_0x60bb('0x58')]=_0x5dd8ff[_0x60bb('0x4f')]['id'];return _0x86e851;});return db['UserProfileResource'][_0x60bb('0x6d')](_0x27abf9,{'raw':!![],'transaction':_0x2802b6});});}})['catch'](handleError(_0x279ab0,null));});}})[_0x60bb('0x27')](function(_0x4264d8){var _0x4e9ad9=_[_0x60bb('0x2d')](_0x4264d8,function(_0x28d6f1){return _0x28d6f1['get']({'plain':!![]});});})[_0x60bb('0x27')](respondWithResult(_0x279ab0,null))[_0x60bb('0x49')](handleError(_0x279ab0,null));};exports[_0x60bb('0x6e')]=function(_0x56f7ea,_0x3274d4,_0x2e5e1c){return db[_0x60bb('0x2e')][_0x60bb('0x4b')]({'where':{'id':_0x56f7ea[_0x60bb('0x4f')]['id']}})[_0x60bb('0x27')](handleEntityNotFound(_0x3274d4,null))[_0x60bb('0x27')](function(_0x2192e5){if(_0x2192e5){return _0x2192e5['removeResources'](_0x56f7ea[_0x60bb('0x34')]['ids']);}})[_0x60bb('0x27')](respondWithStatusCode(_0x3274d4,null))[_0x60bb('0x49')](handleError(_0x3274d4,null));};exports[_0x60bb('0x6f')]=function(_0x4e4482,_0xcda9cd){var _0x6dc110={'raw':![],'where':{}};var _0x7ab736={};var _0x5e09d2={'count':0x0,'rows':[]};var _0x57ade7=_0x4e4482[_0x60bb('0x34')][_0x60bb('0x70')];if(typeof _0x57ade7===_0x60bb('0x71')){throw new db[(_0x60bb('0x72'))][(_0x60bb('0x73'))](_0x60bb('0x74'));}var _0x584c35=_0x4e4482[_0x60bb('0x34')][_0x60bb('0x75')]||![];var _0x5cb051=getQueryModels(_0x57ade7,_0x584c35);if(typeof _0x5cb051[_0x60bb('0x76')]==='undefined'){throw new db[(_0x60bb('0x72'))][(_0x60bb('0x73'))](_0x60bb('0x77')+_0x57ade7+'\x27');}var _0x489655=[];if(!_[_0x60bb('0x67')](_0x5cb051[_0x60bb('0x78')])){_0x489655=_0x5cb051[_0x60bb('0x78')];}else{_0x489655=[{'name':_0x57ade7}];}return db[_0x60bb('0x2e')][_0x60bb('0x79')]({'where':{'id':_0x4e4482[_0x60bb('0x4f')]['id']}})['then'](handleEntityNotFound(_0xcda9cd,null))[_0x60bb('0x27')](function(_0x12850f){if(_0x12850f){var _0x44e10b=[];for(var _0x3abf00=0x0;_0x3abf00<_0x489655[_0x60bb('0x3a')];_0x3abf00++){_0x44e10b[_0x60bb('0x60')](db['UserProfileSection'][_0x60bb('0x79')]({'where':{'userProfileId':_0x12850f['id'],'name':_0x489655[_0x3abf00][_0x60bb('0x2a')]},'raw':!![]}));}return BPromise[_0x60bb('0x7a')](_0x44e10b);}})[_0x60bb('0x27')](function(_0x2ed928){var _0x179357=_['filter'](_0x2ed928,function(_0x5769b3){return _0x5769b3?_0x5769b3:undefined;});var _0x52965b=_['filter'](_0x489655,[_0x60bb('0x7b'),!![]]);var _0x191c18=_[_0x60bb('0x67')](_0x179357)&&_[_0x60bb('0x67')](_0x52965b)?null:_[_0x60bb('0x7c')](_0x52965b,_0x179357);if(_0x191c18){var _0x38bd75=[];for(var _0x4a045c=0x0;_0x4a045c<_0x191c18[_0x60bb('0x3a')];_0x4a045c++){var _0x1f8254=_['find'](_0x489655,function(_0x318958){return _0x191c18[_0x4a045c]?_0x318958[_0x60bb('0x2a')]===_0x191c18[_0x4a045c][_0x60bb('0x2a')]:null;});if(_0x1f8254){if(_0x191c18[_0x4a045c]['ignore']){_0x38bd75[_0x60bb('0x60')](getAllResources(_0x5cb051[_0x60bb('0x76')],_0x191c18[_0x4a045c]));}else{if(!_0x191c18[_0x4a045c][_0x60bb('0x56')]){_0x38bd75[_0x60bb('0x60')](getAllowedResources(_0x1f8254,_0x191c18[_0x4a045c],_0x5cb051[_0x60bb('0x76')]));}else{if(_0x1f8254[_0x60bb('0x33')]){_0x38bd75[_0x60bb('0x60')](getAllFilteredResources(_0x1f8254,_0x191c18[_0x4a045c]));}}}}}return BPromise['all'](_0x38bd75);}else{return null;}})[_0x60bb('0x27')](function(_0x3a6310){var _0x5f40a7=_0x3a6310;var _0x504582=null;if(_0x5f40a7){_0x504582=_0x5f40a7[_0x60bb('0x3a')]===0x1?_0x5f40a7[0x0]:null;}if(_0x504582||_0x5f40a7){var _0x2c47db=db[_0x5cb051[_0x60bb('0x76')]]['rawAttributes'];_0x7ab736[_0x60bb('0x33')]=_[_0x60bb('0x35')](_0x2c47db);_0x7ab736['query']=_[_0x60bb('0x35')](_0x4e4482[_0x60bb('0x34')]);_0x7ab736[_0x60bb('0x36')]=_['intersection'](_0x7ab736['model'],_0x7ab736[_0x60bb('0x34')]);_0x6dc110[_0x60bb('0x38')]=_[_0x60bb('0x37')](_0x7ab736[_0x60bb('0x33')],qs[_0x60bb('0x39')](_0x4e4482[_0x60bb('0x34')][_0x60bb('0x39')]));_0x6dc110['attributes']=_0x6dc110[_0x60bb('0x38')][_0x60bb('0x3a')]?_0x6dc110[_0x60bb('0x38')]:_0x7ab736[_0x60bb('0x33')];if(!_0x4e4482[_0x60bb('0x34')][_0x60bb('0x3b')](_0x60bb('0x3c'))){_0x6dc110['limit']=qs['limit'](_0x4e4482[_0x60bb('0x34')]['limit']);_0x6dc110['offset']=qs[_0x60bb('0x20')](_0x4e4482['query'][_0x60bb('0x20')]);}_0x6dc110[_0x60bb('0x3d')]=qs[_0x60bb('0x3e')](_0x4e4482[_0x60bb('0x34')][_0x60bb('0x3e')]);_0x6dc110['where']=qs[_0x60bb('0x36')](_['pick'](_0x4e4482['query'],_0x7ab736[_0x60bb('0x36')]));if(_0x4e4482[_0x60bb('0x34')][_0x60bb('0x64')]){_0x6dc110[_0x60bb('0x3f')]=_['merge'](_0x6dc110[_0x60bb('0x3f')],{'$or':_[_0x60bb('0x2d')](_0x2c47db,function(_0x2c6622){if(_0x2c6622[_0x60bb('0x31')][_0x60bb('0x32')]!==_0x60bb('0x42')){var _0x3d7e9d={};_0x3d7e9d[_0x2c6622[_0x60bb('0x7d')]]={'$like':'%'+_0x4e4482[_0x60bb('0x34')][_0x60bb('0x64')]+'%'};return _0x3d7e9d;}})});}var _0x359ce2=[];if(_0x504582){var _0x65e682=_['find'](_0x489655,['name',_0x504582[_0x60bb('0x2a')]]);if(_0x65e682['field']){var _0x197a2a={};if(_0x5cb051['childModel']===_0x60bb('0x7e')){_0x197a2a[_0x65e682['foreignKey']]=_[_0x60bb('0x2d')](_0x504582[_0x60bb('0x7f')],'id');}else{_0x197a2a[_0x65e682[_0x60bb('0x80')]]=_0x504582[_0x60bb('0x7f')];}_0x359ce2[_0x60bb('0x60')](_0x197a2a);}else{_0x6dc110[_0x60bb('0x3f')]['id']=_0x504582[_0x60bb('0x7f')];}}else{for(var _0x15000a=0x0;_0x15000a<_0x5f40a7['length'];_0x15000a++){var _0x65e682=_[_0x60bb('0x4b')](_0x489655,[_0x60bb('0x2a'),_0x5f40a7[_0x15000a][_0x60bb('0x2a')]]);if(_0x65e682[_0x60bb('0x7d')]){var _0x197a2a={};_0x197a2a[_0x65e682[_0x60bb('0x80')]]=_0x5f40a7[_0x15000a]['associatedResources'];_0x359ce2[_0x60bb('0x60')](_0x197a2a);}else{if(!_0x6dc110[_0x60bb('0x3f')]['id'])_0x6dc110['where']['id']=[];_0x5f40a7[_0x15000a][_0x60bb('0x7f')]['forEach'](function(_0x14b71b){_0x6dc110['where']['id']['push'](_0x14b71b);});}}}if(!_[_0x60bb('0x67')](_0x359ce2)){_0x6dc110[_0x60bb('0x3f')]=_[_0x60bb('0x41')](_0x6dc110['where'],{'$and':{'$or':_0x359ce2}});}_0x6dc110=_[_0x60bb('0x41')]({},_0x6dc110,_0x4e4482[_0x60bb('0x43')]);if(_0x504582&&!_0x504582[_0x60bb('0x56')]&&_0x5cb051[_0x60bb('0x76')]===_0x60bb('0x7e')){if(_0x4e4482['query'][_0x60bb('0x45')]){_0x6dc110[_0x60bb('0x46')]=[{'all':!![]}];}return db[_0x5cb051['childModel']][_0x60bb('0x47')](_0x6dc110)[_0x60bb('0x27')](function(_0x135d31){var _0x413dc4=[];_0x135d31[_0x60bb('0x6a')](function(_0x48842){var _0x788c6c;switch(_0x48842['reportType']){case'default':_0x788c6c=_[_0x60bb('0x4b')](_0x504582[_0x60bb('0x7f')],function(_0x206b68){return _0x206b68['id']===_0x48842['reportId']&&_0x206b68[_0x60bb('0x31')]===_0x60bb('0x81');});break;case'custom':_0x788c6c=_[_0x60bb('0x4b')](_0x504582[_0x60bb('0x7f')],function(_0x5a9009){return _0x5a9009['id']===_0x48842[_0x60bb('0x82')]&&_0x5a9009[_0x60bb('0x31')]==='CustomReports';});break;}if(_0x788c6c)_0x413dc4[_0x60bb('0x60')](_0x48842);});_0x5e09d2['count']=_0x413dc4[_0x60bb('0x3a')];_0x5e09d2[_0x60bb('0x48')]=_0x413dc4;return _0x5e09d2;});}else{return db[_0x5cb051[_0x60bb('0x76')]]['count']({'where':_0x6dc110[_0x60bb('0x3f')]})[_0x60bb('0x27')](function(_0x37d3c1){_0x5e09d2[_0x60bb('0x44')]=_0x37d3c1;if(_0x4e4482[_0x60bb('0x34')][_0x60bb('0x45')]){if(_0x5cb051[_0x60bb('0x76')]===_0x60bb('0x83')){_0x6dc110[_0x60bb('0x46')]=[{'model':db[_0x60bb('0x84')],'as':_0x60bb('0x85'),'attributes':['id','name',_0x60bb('0x86')],'required':_0x4e4482[_0x60bb('0x34')]['tag']?!![]:![]},{'model':db[_0x60bb('0x84')],'as':'ThroughTags','attributes':['id',_0x60bb('0x2a'),_0x60bb('0x86')],'through':_0x4e4482['query'][_0x60bb('0x87')]?{'attributes':[],'where':{'TagId':_0x4e4482[_0x60bb('0x34')]['tag']||undefined}}:{},'required':_0x4e4482[_0x60bb('0x34')]['tag']?!![]:![]}];}else{_0x6dc110[_0x60bb('0x46')]=[{'all':!![]}];}}return db[_0x5cb051[_0x60bb('0x76')]][_0x60bb('0x47')](_0x6dc110);})[_0x60bb('0x27')](function(_0x1a9ba8){_0x5e09d2['rows']=_0x1a9ba8;return _0x5e09d2;});}}else{return _0x5e09d2;}})[_0x60bb('0x27')](respondWithFilteredResult(_0xcda9cd,_0x6dc110))[_0x60bb('0x49')](handleError(_0xcda9cd,null));};function getAllResources(_0x1bb21b,_0x479388){return new BPromise(function(_0x56cfa1,_0x302997){if(_0x479388){var _0x1b89dd=_0x479388[_0x60bb('0x64')]?{[_0x479388[_0x60bb('0x64')][_0x60bb('0x7d')]]:_0x479388[_0x60bb('0x64')]['value']}:undefined;return db[_0x1bb21b][_0x60bb('0x47')]({'where':_0x1b89dd,'raw':!![]})[_0x60bb('0x27')](function(_0x4b7c6f){_0x479388[_0x60bb('0x7f')]=_[_0x60bb('0x2d')](_0x4b7c6f,'id');_0x56cfa1(_0x479388);})[_0x60bb('0x49')](function(_0x419717){_0x302997(_0x419717);});}else{_0x56cfa1(null);}});}function getAllFilteredResources(_0x5df904,_0x9582c7){return new BPromise(function(_0x48c85c,_0x4f7130){var _0x571d62=_0x5df904['filter']?{[_0x5df904['filter'][_0x60bb('0x7d')]]:_0x5df904[_0x60bb('0x64')][_0x60bb('0x88')]}:undefined;return db[_0x5df904[_0x60bb('0x33')]][_0x60bb('0x47')]({'where':_0x571d62,'raw':!![]})[_0x60bb('0x27')](function(_0xc0b8a9){_0x9582c7[_0x60bb('0x7f')]=_['map'](_0xc0b8a9,function(_0x4ac874){return _0x4ac874[_0x60bb('0x2a')];});_0x48c85c(_0x9582c7);})[_0x60bb('0x49')](function(_0xe4d538){_0x4f7130(_0xe4d538);});});}function getAllowedResources(_0x31cf55,_0x5653e7,_0x32f4f0){return new BPromise(function(_0x13aecd,_0x1f6565){if(_0x5653e7){return db[_0x60bb('0x57')]['findAll']({'where':{'sectionId':_0x5653e7['id']},'raw':!![]})[_0x60bb('0x27')](function(_0x51b850){if(_0x31cf55[_0x60bb('0x7d')]&&_0x31cf55['field']!=='id'){_0x5653e7[_0x60bb('0x7f')]=_[_0x60bb('0x2d')](_0x51b850,function(_0x9fb2d4){return _0x9fb2d4[_0x31cf55['field']];});}else{if(_0x32f4f0==='AnalyticExtractedReport'){_0x5653e7[_0x60bb('0x7f')]=_[_0x60bb('0x2d')](_0x51b850,function(_0x23a2b3){return{'id':_0x23a2b3['resourceId'],'type':_0x23a2b3['type']};});}else{_0x5653e7[_0x60bb('0x7f')]=_[_0x60bb('0x2d')](_0x51b850,function(_0x56cfeb){return _0x56cfeb[_0x60bb('0x6b')];});}}_0x13aecd(_0x5653e7);})[_0x60bb('0x49')](function(_0x2d304f){_0x1f6565(_0x2d304f);});}else{_0x13aecd(null);}});}function getQueryModels(_0xddb4b5,_0x3e3565){var _0x4d4eca=_0xddb4b5['toLowerCase']();var _0x345152={'childModel':undefined,'parentSections':[]};switch(_0x4d4eca){case'squareprojects':_0x345152[_0x60bb('0x76')]=_0x60bb('0x89');break;case _0x60bb('0x8a'):_0x345152[_0x60bb('0x76')]=_0x60bb('0x8b');break;case _0x60bb('0x8c'):_0x345152[_0x60bb('0x76')]='SquareRecording';_0x345152[_0x60bb('0x78')]=[{'name':_0x60bb('0x8d'),'field':_0x60bb('0x2a'),'foreignKey':_0x60bb('0x8e')}];break;case _0x60bb('0x8f'):_0x345152[_0x60bb('0x76')]='JscriptyProject';break;case'contacts':_0x345152[_0x60bb('0x76')]=_0x60bb('0x83');_0x345152[_0x60bb('0x78')]=[{'name':_0x60bb('0x90'),'field':'id','foreignKey':_0x60bb('0x91')}];break;case _0x60bb('0x92'):_0x345152[_0x60bb('0x76')]=_0x60bb('0x93');break;case _0x60bb('0x94'):_0x345152[_0x60bb('0x76')]='CmCompany';break;case _0x60bb('0x95'):_0x345152[_0x60bb('0x76')]=_0x60bb('0x96');break;case _0x60bb('0x97'):_0x345152[_0x60bb('0x76')]=_0x60bb('0x98');break;case _0x60bb('0x99'):_0x345152[_0x60bb('0x76')]=_0x60bb('0x9a');break;case _0x60bb('0x9b'):_0x345152['childModel']=_0x60bb('0x9c');break;case _0x60bb('0x9d'):_0x345152[_0x60bb('0x76')]=_0x60bb('0x9e');break;case _0x60bb('0x9f'):case _0x60bb('0xa0'):case _0x60bb('0xa1'):_0x345152[_0x60bb('0x76')]='VoiceExtension';break;case _0x60bb('0xa2'):_0x345152[_0x60bb('0x76')]=_0x60bb('0xa3');break;case _0x60bb('0xa4'):_0x345152['childModel']=_0x60bb('0xa5');break;case'voicerecordings':_0x345152[_0x60bb('0x76')]='VoiceRecording';_0x345152[_0x60bb('0x78')]=[{'name':_0x60bb('0xa6'),'field':_0x60bb('0x2a'),'foreignKey':_0x60bb('0xa7'),'model':_0x60bb('0xa8'),'filter':{'field':_0x60bb('0xa9'),'value':[_0x60bb('0xaa')]}},{'name':_0x60bb('0xab'),'field':'name','foreignKey':_0x60bb('0xa7'),'model':_0x60bb('0xa8'),'filter':{'field':_0x60bb('0xa9'),'value':[_0x60bb('0xac')]}},{'name':_0x60bb('0xad'),'field':'name','foreignKey':_0x60bb('0xae'),'model':_0x60bb('0xaf'),'filter':{'field':'type','value':[_0x60bb('0xb0')]}},{'name':'QueueCampaigns','field':'name','foreignKey':_0x60bb('0xae'),'model':_0x60bb('0xaf'),'filter':{'field':_0x60bb('0x31'),'value':[_0x60bb('0xb1')]}}];break;case _0x60bb('0xb2'):_0x345152['childModel']=_0x60bb('0xb3');break;case _0x60bb('0xb4'):_0x345152[_0x60bb('0x76')]='VoiceChanSpy';break;case _0x60bb('0xb5'):_0x345152[_0x60bb('0x76')]='VoicePrefix';break;case'ivrcampaigns':_0x345152[_0x60bb('0x76')]=_0x60bb('0xb6');break;case _0x60bb('0xb7'):_0x345152['childModel']=_0x60bb('0xb8');break;case'mailaccounts':_0x345152[_0x60bb('0x76')]=_0x60bb('0xb9');break;case _0x60bb('0xba'):_0x345152[_0x60bb('0x76')]=_0x60bb('0xbb');break;case'openchannelqueues':_0x345152[_0x60bb('0x76')]=_0x60bb('0xbc');break;case _0x60bb('0xbd'):_0x345152[_0x60bb('0x76')]='OpenchannelAccount';break;case _0x60bb('0xbe'):_0x345152['childModel']=_0x60bb('0xbf');break;case _0x60bb('0xc0'):_0x345152['childModel']='SmsAccount';break;case _0x60bb('0xc1'):_0x345152[_0x60bb('0x76')]=_0x60bb('0xc2');break;case _0x60bb('0xc3'):case _0x60bb('0xc4'):_0x345152[_0x60bb('0x76')]=_0x60bb('0xaf');if(_0x3e3565){_0x345152[_0x60bb('0x78')]=[{'name':_0x60bb('0xad')},{'name':_0x60bb('0xc5')}];}break;case _0x60bb('0xc6'):case _0x60bb('0xc7'):case _0x60bb('0xc8'):_0x345152[_0x60bb('0x76')]=_0x60bb('0xa8');if(_0x3e3565){_0x345152['parentSections']=[{'name':_0x60bb('0xc9'),'filter':{'field':_0x60bb('0xa9'),'value':['admin','user']},'ignore':!![]},{'name':_0x60bb('0xa6')},{'name':_0x60bb('0xab')}];}break;case _0x60bb('0xca'):_0x345152['childModel']=_0x60bb('0xcb');break;case _0x60bb('0xcc'):_0x345152['childModel']='SalesforceAccount';break;case _0x60bb('0xcd'):_0x345152['childModel']=_0x60bb('0xce');break;case _0x60bb('0xcf'):_0x345152['childModel']='SugarcrmAccount';break;case'deskaccounts':_0x345152['childModel']='DeskAccount';break;case _0x60bb('0xd0'):_0x345152[_0x60bb('0x76')]=_0x60bb('0xd1');break;case _0x60bb('0xd2'):_0x345152[_0x60bb('0x76')]=_0x60bb('0xa8');break;case _0x60bb('0xd3'):_0x345152['childModel']=_0x60bb('0xd4');break;case _0x60bb('0xd5'):_0x345152[_0x60bb('0x76')]='Disposition';break;case _0x60bb('0xd6'):_0x345152[_0x60bb('0x76')]='Dashboard';break;case'intervals':_0x345152['childModel']=_0x60bb('0xd7');break;case _0x60bb('0xd8'):_0x345152['childModel']=_0x60bb('0xd9');break;case _0x60bb('0xda'):_0x345152[_0x60bb('0x76')]=_0x60bb('0xdb');break;case _0x60bb('0xdc'):_0x345152['childModel']='Sound';break;case _0x60bb('0xdd'):_0x345152[_0x60bb('0x76')]=_0x60bb('0x84');break;case _0x60bb('0xde'):_0x345152[_0x60bb('0x76')]=_0x60bb('0xdf');break;case _0x60bb('0xe0'):_0x345152['childModel']=_0x60bb('0xe1');break;case _0x60bb('0xe2'):_0x345152[_0x60bb('0x76')]=_0x60bb('0xe3');break;case'variables':_0x345152[_0x60bb('0x76')]=_0x60bb('0xe4');break;case _0x60bb('0xe5'):_0x345152[_0x60bb('0x76')]=_0x60bb('0x6c');break;case _0x60bb('0xe6'):_0x345152[_0x60bb('0x76')]=_0x60bb('0x7e');_0x345152['parentSections']=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case'metrics':_0x345152[_0x60bb('0x76')]='AnalyticMetric';break;default:return _0x345152;}return _0x345152;} \ No newline at end of file +var _0x3b32=['sounds','Sound','tags','templates','triggers','trunks','Trunk','variables','extractedreports','Reports','metrics','AnalyticMetric','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','squel','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','type','key','query','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','UserProfile','count','include','findAll','rows','catch','show','keys','length','find','create','clone','params','rawAttributes','includeAll','get','crudPermissions','omit','body','createdAt','sequelize','UserProfileSection','each','autoAssociation','UserProfileResource','userProfileId','Resources','describe','transaction','sectionId','push','removeSections','getSections','enabled','includes','isEmpty','subsections','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','getResources','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','parentSections','findOne','union','ignore','all','nolimit','pick','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','custom','CmContact','Tags','color','tag','Tag','value','toLowerCase','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','contacts','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','membername','User','Telephones','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','mailsubstatuses','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','SmsAccount','teams','Team','voicequeues','queuecampaigns','agents','telephones','Users','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Interval','pauses','scheduler'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3b32,0x1e2));var _0x23b3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x3b32[_0x21a9d9];return _0x46adce;};'use strict';var pdf=require(_0x23b3('0x0'));var emlformat=require(_0x23b3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x23b3('0x2'));var jsonpatch=require(_0x23b3('0x3'));var rp=require('request-promise');var moment=require(_0x23b3('0x4'));var BPromise=require(_0x23b3('0x5'));var Mustache=require(_0x23b3('0x6'));var util=require(_0x23b3('0x7'));var path=require(_0x23b3('0x8'));var sox=require(_0x23b3('0x9'));var csv=require(_0x23b3('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x23b3('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x23b3('0xc'));var toCsv=require(_0x23b3('0xa'));var querystring=require('querystring');var Papa=require(_0x23b3('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x23b3('0xe'));var as=require(_0x23b3('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x23b3('0x10'))(_0x23b3('0x11'));var utils=require(_0x23b3('0x12'));var config=require(_0x23b3('0x13'));var db=require(_0x23b3('0x14'))['db'];config[_0x23b3('0x15')]=_[_0x23b3('0x16')](config[_0x23b3('0x15')],{'host':_0x23b3('0x17'),'port':0x18eb});var socket=require(_0x23b3('0x18'))(new Redis(config[_0x23b3('0x15')]));require(_0x23b3('0x19'))['register'](socket);function respondWithStatusCode(_0x184df5,_0x320557){_0x320557=_0x320557||0xcc;return function(_0x475636){if(_0x475636){return _0x184df5[_0x23b3('0x1a')](_0x320557);}return _0x184df5[_0x23b3('0x1b')](_0x320557)[_0x23b3('0x1c')]();};}function respondWithResult(_0x252ec8,_0x189371){_0x189371=_0x189371||0xc8;return function(_0x12350e){if(_0x12350e){return _0x252ec8[_0x23b3('0x1b')](_0x189371)[_0x23b3('0x1d')](_0x12350e);}};}function respondWithFilteredResult(_0x4c6415,_0x1a045d){return function(_0x395c0b){if(_0x395c0b){var _0x422901=_0x395c0b['count'],_0x4fe92f=_0x1a045d[_0x23b3('0x1e')],_0x51fe5d=_0x1a045d['offset']+_0x1a045d[_0x23b3('0x1f')],_0x1c684e;if(_0x51fe5d>=_0x422901){_0x51fe5d=_0x422901;_0x1c684e=0xc8;}else{_0x1c684e=0xce;}_0x4c6415[_0x23b3('0x1b')](_0x1c684e);return _0x4c6415['set'](_0x23b3('0x20'),_0x4fe92f+'-'+_0x51fe5d+'/'+_0x422901)['json'](_0x395c0b);}return null;};}function patchUpdates(_0x5ece26){return function(_0x6c3306){try{jsonpatch[_0x23b3('0x21')](_0x6c3306,_0x5ece26,!![]);}catch(_0x44aa7f){return BPromise[_0x23b3('0x22')](_0x44aa7f);}return _0x6c3306[_0x23b3('0x23')]();};}function saveUpdates(_0x2aa2b4,_0x420965){return function(_0x9a30d7){if(_0x9a30d7){return _0x9a30d7[_0x23b3('0x24')](_0x2aa2b4)[_0x23b3('0x25')](function(_0x110459){return _0x110459;});}return null;};}function removeEntity(_0x33cc45,_0x1d9ed4){return function(_0x199fa6){if(_0x199fa6){return _0x199fa6[_0x23b3('0x26')]()[_0x23b3('0x25')](function(){_0x33cc45[_0x23b3('0x1b')](0xcc)[_0x23b3('0x1c')]();});}};}function handleEntityNotFound(_0x4c9bf4,_0x58bc74){return function(_0x55670d){if(!_0x55670d){_0x4c9bf4[_0x23b3('0x1a')](0x194);}return _0x55670d;};}function handleError(_0x38a884,_0x1920ca){_0x1920ca=_0x1920ca||0x1f4;return function(_0xa2266e){logger[_0x23b3('0x27')](_0xa2266e['stack']);if(_0xa2266e[_0x23b3('0x28')]){delete _0xa2266e['name'];}_0x38a884[_0x23b3('0x1b')](_0x1920ca)[_0x23b3('0x29')](_0xa2266e);};}exports[_0x23b3('0x2a')]=function(_0x364b91,_0x4a062d){var _0x760bdc={},_0x1625a4={},_0x3bd969={'count':0x0,'rows':[]};var _0x1dbc20=_[_0x23b3('0x2b')](db['UserProfile']['rawAttributes'],function(_0x52c206){return{'name':_0x52c206['fieldName'],'type':_0x52c206[_0x23b3('0x2c')][_0x23b3('0x2d')]};});_0x1625a4['model']=_[_0x23b3('0x2b')](_0x1dbc20,'name');_0x1625a4[_0x23b3('0x2e')]=_['keys'](_0x364b91['query']);_0x1625a4['filters']=_[_0x23b3('0x2f')](_0x1625a4[_0x23b3('0x30')],_0x1625a4[_0x23b3('0x2e')]);_0x760bdc[_0x23b3('0x31')]=_['intersection'](_0x1625a4[_0x23b3('0x30')],qs[_0x23b3('0x32')](_0x364b91[_0x23b3('0x2e')][_0x23b3('0x32')]));_0x760bdc['attributes']=_0x760bdc[_0x23b3('0x31')]['length']?_0x760bdc['attributes']:_0x1625a4[_0x23b3('0x30')];if(!_0x364b91[_0x23b3('0x2e')][_0x23b3('0x33')]('nolimit')){_0x760bdc[_0x23b3('0x1f')]=qs[_0x23b3('0x1f')](_0x364b91[_0x23b3('0x2e')][_0x23b3('0x1f')]);_0x760bdc[_0x23b3('0x1e')]=qs[_0x23b3('0x1e')](_0x364b91['query']['offset']);}_0x760bdc[_0x23b3('0x34')]=qs[_0x23b3('0x35')](_0x364b91[_0x23b3('0x2e')][_0x23b3('0x35')]);_0x760bdc[_0x23b3('0x36')]=qs[_0x23b3('0x37')](_['pick'](_0x364b91[_0x23b3('0x2e')],_0x1625a4[_0x23b3('0x37')]));if(_0x364b91[_0x23b3('0x2e')][_0x23b3('0x38')]){_0x760bdc[_0x23b3('0x36')]=_[_0x23b3('0x39')](_0x760bdc[_0x23b3('0x36')],{'$or':_[_0x23b3('0x2b')](_0x1dbc20,function(_0x4f579e){if(_0x4f579e[_0x23b3('0x2c')]!==_0x23b3('0x3a')){var _0x4dd55b={};_0x4dd55b[_0x4f579e[_0x23b3('0x28')]]={'$like':'%'+_0x364b91['query']['filter']+'%'};return _0x4dd55b;}})});}_0x760bdc=_[_0x23b3('0x39')]({},_0x760bdc,_0x364b91[_0x23b3('0x3b')]);var _0xc155dc={'where':_0x760bdc[_0x23b3('0x36')]};return db[_0x23b3('0x3c')][_0x23b3('0x3d')](_0xc155dc)[_0x23b3('0x25')](function(_0x341682){_0x3bd969[_0x23b3('0x3d')]=_0x341682;if(_0x364b91['query']['includeAll']){_0x760bdc[_0x23b3('0x3e')]=[{'all':!![]}];}return db[_0x23b3('0x3c')][_0x23b3('0x3f')](_0x760bdc);})[_0x23b3('0x25')](function(_0x456539){_0x3bd969[_0x23b3('0x40')]=_0x456539;return _0x3bd969;})['then'](respondWithFilteredResult(_0x4a062d,_0x760bdc))[_0x23b3('0x41')](handleError(_0x4a062d,null));};exports[_0x23b3('0x42')]=function(_0x315d86,_0x4c28ac){var _0x4161e2={'raw':![],'where':{'id':_0x315d86['params']['id']}},_0x287f36={};_0x287f36[_0x23b3('0x30')]=_[_0x23b3('0x43')](db[_0x23b3('0x3c')]['rawAttributes']);_0x287f36[_0x23b3('0x2e')]=_[_0x23b3('0x43')](_0x315d86['query']);_0x287f36[_0x23b3('0x37')]=_[_0x23b3('0x2f')](_0x287f36[_0x23b3('0x30')],_0x287f36[_0x23b3('0x2e')]);_0x4161e2['attributes']=_[_0x23b3('0x2f')](_0x287f36[_0x23b3('0x30')],qs[_0x23b3('0x32')](_0x315d86[_0x23b3('0x2e')][_0x23b3('0x32')]));_0x4161e2[_0x23b3('0x31')]=_0x4161e2[_0x23b3('0x31')][_0x23b3('0x44')]?_0x4161e2[_0x23b3('0x31')]:_0x287f36[_0x23b3('0x30')];if(_0x315d86['query']['includeAll']){_0x4161e2[_0x23b3('0x3e')]=[{'all':!![]}];}_0x4161e2=_['merge']({},_0x4161e2,_0x315d86[_0x23b3('0x3b')]);return db[_0x23b3('0x3c')][_0x23b3('0x45')](_0x4161e2)[_0x23b3('0x25')](handleEntityNotFound(_0x4c28ac,null))[_0x23b3('0x25')](respondWithResult(_0x4c28ac,null))[_0x23b3('0x41')](handleError(_0x4c28ac,null));};exports[_0x23b3('0x46')]=function(_0x1a229c,_0x2312b4){return db[_0x23b3('0x3c')][_0x23b3('0x46')](_0x1a229c['body'],{})[_0x23b3('0x25')](respondWithResult(_0x2312b4,0xc9))[_0x23b3('0x41')](handleError(_0x2312b4,null));};exports[_0x23b3('0x47')]=function(_0x5513ed,_0x273ecb){var _0x5f2a06={'where':{'id':_0x5513ed[_0x23b3('0x48')]['id']}},_0x5f3514={};_0x5f3514[_0x23b3('0x30')]=_[_0x23b3('0x43')](db[_0x23b3('0x3c')][_0x23b3('0x49')]);_0x5f2a06[_0x23b3('0x31')]=_[_0x23b3('0x2f')](_0x5f3514[_0x23b3('0x30')],qs[_0x23b3('0x32')](_0x5513ed[_0x23b3('0x2e')][_0x23b3('0x32')]));_0x5f2a06[_0x23b3('0x31')]=_0x5f2a06['attributes'][_0x23b3('0x44')]?_0x5f2a06[_0x23b3('0x31')]:_0x5f3514['model'];if(_0x5513ed['query'][_0x23b3('0x4a')]){_0x5f2a06[_0x23b3('0x3e')]=[{'all':!![]}];}_0x5f2a06=_[_0x23b3('0x39')]({},_0x5f2a06,_0x5513ed[_0x23b3('0x3b')]);return db[_0x23b3('0x3c')][_0x23b3('0x45')](_0x5f2a06)[_0x23b3('0x25')](handleEntityNotFound(_0x273ecb,null))[_0x23b3('0x25')](function(_0x3de4cd){if(_0x3de4cd){var _0x3f8494=_0x3de4cd[_0x23b3('0x4b')]({'plain':!![]});_0x3f8494=qs['omit'](_0x3f8494,['id','createdAt','updatedAt',_0x23b3('0x4c')]);_0x5513ed['body']=_[_0x23b3('0x4d')](_0x5513ed[_0x23b3('0x4e')],['id',_0x23b3('0x4f'),'updatedAt']);return db[_0x23b3('0x50')]['transaction'](function(_0x4b30b4){return db[_0x23b3('0x3c')]['create'](_[_0x23b3('0x39')](_0x3f8494,_0x5513ed[_0x23b3('0x4e')]),{'include':_0x5513ed[_0x23b3('0x2e')][_0x23b3('0x4a')]?[{'all':!![]}]:undefined,'transaction':_0x4b30b4})[_0x23b3('0x25')](function(_0x2eba32){var _0x1cbafc=_0x2eba32[_0x23b3('0x4b')]({'plain':!![]});return db[_0x23b3('0x51')][_0x23b3('0x3f')]({'where':{'userProfileId':_0x5513ed[_0x23b3('0x48')]['id']},'raw':!![]})[_0x23b3('0x25')](function(_0x18d013){if(_0x18d013){return BPromise[_0x23b3('0x52')](_0x18d013,function(_0xe2bef1){return new BPromise(function(_0x40fb5a,_0x56c217){if(_0xe2bef1[_0x23b3('0x53')]===null||_0xe2bef1[_0x23b3('0x53')]===0x1)_0x40fb5a(null);return db[_0x23b3('0x54')]['findAll']({'where':{'sectionId':_0xe2bef1['id']},'raw':!![]})['then'](function(_0x5be1d0){var _0x5ddb11=_[_0x23b3('0x2b')](_0x5be1d0,function(_0x54a830){return qs[_0x23b3('0x4d')](_0x54a830,['id',_0x23b3('0x4f'),'updatedAt','sectionId']);});_0x40fb5a(_0x5ddb11);})[_0x23b3('0x41')](function(_0x35b459){_0x56c217(_0x35b459);});})[_0x23b3('0x25')](function(_0x341ca0){var _0x1f9512=qs[_0x23b3('0x4d')](_0xe2bef1,['id',_0x23b3('0x4f'),'updatedAt']);_0x1f9512[_0x23b3('0x55')]=_0x1cbafc['id'];if(_0x341ca0)_0x1f9512[_0x23b3('0x56')]=_0x341ca0;return _0x1f9512;})[_0x23b3('0x25')](function(_0x49c3af){return db['UserProfileSection'][_0x23b3('0x46')](_0x49c3af,{'include':[{'model':db[_0x23b3('0x54')],'as':_0x23b3('0x56')}],'raw':!![],'transaction':_0x4b30b4});});})[_0x23b3('0x25')](function(){return _0x1cbafc;});}});});});}})[_0x23b3('0x25')](respondWithResult(_0x273ecb,0xc9))[_0x23b3('0x41')](handleError(_0x273ecb,null));};exports['update']=function(_0x1cf528,_0x45857e){if(_0x1cf528[_0x23b3('0x4e')]['id']){delete _0x1cf528['body']['id'];}return db['UserProfile']['find']({'where':{'id':_0x1cf528[_0x23b3('0x48')]['id']}})[_0x23b3('0x25')](handleEntityNotFound(_0x45857e,null))[_0x23b3('0x25')](saveUpdates(_0x1cf528[_0x23b3('0x4e')],null))[_0x23b3('0x25')](respondWithResult(_0x45857e,null))[_0x23b3('0x41')](handleError(_0x45857e,null));};exports['destroy']=function(_0xc83a62,_0x1cdb06){return db[_0x23b3('0x3c')][_0x23b3('0x45')]({'where':{'id':_0xc83a62[_0x23b3('0x48')]['id']}})[_0x23b3('0x25')](handleEntityNotFound(_0x1cdb06,null))[_0x23b3('0x25')](removeEntity(_0x1cdb06,null))['catch'](handleError(_0x1cdb06,null));};exports[_0x23b3('0x57')]=function(_0x2d45be,_0x23032e){return db[_0x23b3('0x3c')][_0x23b3('0x57')]()[_0x23b3('0x25')](respondWithResult(_0x23032e,null))[_0x23b3('0x41')](handleError(_0x23032e,null));};exports['addSections']=function(_0x3adfe9,_0x4a694){var _0x223c64=_0x3adfe9[_0x23b3('0x4e')];return db[_0x23b3('0x3c')][_0x23b3('0x45')]({'where':{'id':_0x3adfe9['params']['id']}})['then'](handleEntityNotFound(_0x4a694,null))[_0x23b3('0x25')](function(_0x2c2731){if(_0x2c2731){return db[_0x23b3('0x50')][_0x23b3('0x58')](function(_0xb43972){return db[_0x23b3('0x51')][_0x23b3('0x26')]({'where':{'userProfileId':_0x3adfe9[_0x23b3('0x48')]['id'],'sectionId':_[_0x23b3('0x2b')](_0x223c64,function(_0x2bbb5e){return _0x2bbb5e[_0x23b3('0x59')];})},'transaction':_0xb43972})[_0x23b3('0x25')](function(){var _0x529347=_['map'](_0x223c64,function(_0x1f22c2){_0x1f22c2['userProfileId']=_0x3adfe9['params']['id'];return _0x1f22c2;});var _0x1e5e0e=[];return BPromise['each'](_0x529347,function(_0x211e00){return db[_0x23b3('0x51')][_0x23b3('0x46')](_0x211e00,{'include':[{'model':db[_0x23b3('0x54')],'as':_0x23b3('0x56')}],'raw':!![],'transaction':_0xb43972})['then'](function(_0x36261a){_0x1e5e0e[_0x23b3('0x5a')](_0x36261a[_0x23b3('0x4b')]({'plain':!![]}));});})[_0x23b3('0x25')](function(){return _0x1e5e0e;});});});}})[_0x23b3('0x25')](function(_0x1baf39){return _0x1baf39;})[_0x23b3('0x25')](respondWithResult(_0x4a694,null))[_0x23b3('0x41')](handleError(_0x4a694,null));};exports[_0x23b3('0x5b')]=function(_0x374931,_0x720748){var _0x44c772;return db['UserProfile'][_0x23b3('0x45')]({'where':{'id':_0x374931[_0x23b3('0x48')]['id']},'attributes':['id',_0x23b3('0x28')]})[_0x23b3('0x25')](handleEntityNotFound(_0x720748,null))[_0x23b3('0x25')](function(_0x2e35df){if(_0x2e35df){_0x44c772=_0x2e35df;return db[_0x23b3('0x51')][_0x23b3('0x26')]({'where':{'userProfileId':_0x374931[_0x23b3('0x48')]['id'],'sectionId':_0x374931[_0x23b3('0x2e')]['ids']}});}})['then'](function(){return _0x44c772;})[_0x23b3('0x25')](respondWithStatusCode(_0x720748,null))[_0x23b3('0x41')](handleError(_0x720748,null));};exports[_0x23b3('0x5c')]=function(_0x140a15,_0x18863d){var _0x5418dc=[];var _0x548ad0=[];return db[_0x23b3('0x51')][_0x23b3('0x3f')]({'where':{'userProfileId':_0x140a15[_0x23b3('0x48')]['id']},'raw':!![]})[_0x23b3('0x25')](function(_0x140267){_0x5418dc=_[_0x23b3('0x38')](_0x140267,function(_0x2c9a30){return _0x2c9a30[_0x23b3('0x5d')]===0x1||_[_0x23b3('0x5e')]([0x3eb,0x709],_0x2c9a30[_0x23b3('0x59')]);});if(!_[_0x23b3('0x5f')](_0x5418dc)){return _['map'](_0x5418dc,function(_0x12463d){return _0x12463d[_0x23b3('0x59')];});}else{return;}})[_0x23b3('0x25')](function(_0x3931e4){if(_0x3931e4)_0x548ad0=_0x3931e4;if(_[_0x23b3('0x5e')](_0x548ad0,0x64)){var _0x1c1f90=_[_0x23b3('0x45')](_0x5418dc,{'sectionId':0x64});return hasDefaultDashboard(_0x1c1f90)[_0x23b3('0x25')](function(_0x370ff5){return _['map'](_0x5418dc,function(_0x590fa0){if(_0x590fa0[_0x23b3('0x59')]===0x64){_0x590fa0[_0x23b3('0x60')]=_0x370ff5;}return _0x590fa0;});});}else{return;}})[_0x23b3('0x25')](function(_0x3ebabb){if(_0x3ebabb)_0x5418dc=_0x3ebabb;if(_['includes'](_0x548ad0,0x3eb)){var _0x5dd6f0=_[_0x23b3('0x45')](_0x5418dc,{'sectionId':0x3eb});return getCustomDashboards(_0x5dd6f0)['then'](function(_0x2ec4b1){return _['map'](_0x5418dc,function(_0x524ba1){if(_0x5dd6f0[_0x23b3('0x5d')]){if(_0x524ba1[_0x23b3('0x59')]===0x3eb){_0x524ba1[_0x23b3('0x60')]=_0x2ec4b1;}}else{if(_0x524ba1[_0x23b3('0x59')]===0x64){_0x524ba1[_0x23b3('0x60')]=_0x2ec4b1;}}return _0x524ba1;});});}else{return;}})[_0x23b3('0x25')](function(_0x3ec99a){if(_0x3ec99a)_0x5418dc=_0x3ec99a;if(_[_0x23b3('0x5e')](_0x548ad0,0x709)){var _0x4cf8f2=_[_0x23b3('0x45')](_0x5418dc,{'sectionId':0x709});return getPlugins(_0x4cf8f2)[_0x23b3('0x25')](function(_0x138915){if(_0x4cf8f2[_0x23b3('0x5d')]){return _[_0x23b3('0x2b')](_0x5418dc,function(_0x206326){if(_0x206326[_0x23b3('0x59')]===0x709){_0x206326[_0x23b3('0x60')]=_0x138915;}return _0x206326;});}else{var _0x57670b={'sectionId':0x76c,'enabled':0x1,'subsections':_0x138915};var _0x43550d=_[_0x23b3('0x2b')](_0x5418dc);_0x43550d[_0x23b3('0x5a')](_0x57670b);return _0x43550d;}});}else{return;}})[_0x23b3('0x25')](function(_0x498706){if(_0x498706)_0x5418dc=_0x498706;return _[_0x23b3('0x38')](_0x5418dc,['enabled',0x1]);})[_0x23b3('0x25')](respondWithResult(_0x18863d,null))[_0x23b3('0x41')](handleError(_0x18863d,null));};function hasDefaultDashboard(_0x463d78){var _0x3bee75=[0x65];return new BPromise(function(_0x271390,_0x123a18){try{if(_0x463d78['autoAssociation']){_0x271390(_0x3bee75);}else{return db[_0x23b3('0x54')]['findOne']({'where':{'sectionId':_0x463d78['id']},'raw':!![]})[_0x23b3('0x25')](function(_0x39e891){_0x39e891?_0x271390(_0x3bee75):_0x271390();});}}catch(_0x19b70c){_0x123a18(_0x19b70c);}});}function getCustomDashboards(_0x1afd81){var _0x307933=[];return new BPromise(function(_0x290d2f,_0x542d25){try{if(_0x1afd81[_0x23b3('0x53')]){return db[_0x23b3('0x61')][_0x23b3('0x3f')]({'raw':!![]})[_0x23b3('0x25')](function(_0x4c5825){_0x4c5825[_0x23b3('0x62')](function(_0x111661){_0x307933[_0x23b3('0x5a')](_0x111661['id']+0x1869f);});_0x290d2f(_0x307933);});}else{return db[_0x23b3('0x54')][_0x23b3('0x3f')]({'where':{'sectionId':_0x1afd81['id']},'raw':!![]})[_0x23b3('0x25')](function(_0x3f3d84){_0x3f3d84[_0x23b3('0x62')](function(_0x357945){_0x307933[_0x23b3('0x5a')](_0x357945[_0x23b3('0x63')]+0x1869f);});_0x290d2f(_0x307933);});}}catch(_0x3c1958){_0x542d25(_0x3c1958);}});}function getPlugins(_0x2b6c60){var _0x481228=[];return new BPromise(function(_0x18c4ba,_0x1878dc){try{if(_0x2b6c60[_0x23b3('0x53')]){return db[_0x23b3('0x64')][_0x23b3('0x3f')]({'raw':!![]})[_0x23b3('0x25')](function(_0x46e934){_0x46e934[_0x23b3('0x62')](function(_0x8c42cb){_0x481228[_0x23b3('0x5a')](_0x8c42cb['id']+0x15b38);});_0x18c4ba(_0x481228);});}else{return db[_0x23b3('0x54')]['findAll']({'where':{'sectionId':_0x2b6c60['id']},'raw':!![]})['then'](function(_0x40a633){_0x40a633[_0x23b3('0x62')](function(_0x263194){_0x481228[_0x23b3('0x5a')](_0x263194[_0x23b3('0x63')]+0x15b38);});_0x18c4ba(_0x481228);});}}catch(_0x491388){_0x1878dc(_0x491388);}});}exports[_0x23b3('0x65')]=function(_0x6b8b42,_0x33e4d3){return db[_0x23b3('0x3c')][_0x23b3('0x45')]({'where':{'id':_0x6b8b42[_0x23b3('0x48')]['id']}})[_0x23b3('0x25')](handleEntityNotFound(_0x33e4d3,null))[_0x23b3('0x25')](function(_0x4d7172){if(_0x4d7172){return db['sequelize'][_0x23b3('0x58')](function(_0x342c82){return db['UserProfileSection'][_0x23b3('0x3f')]({'where':{'userProfileId':_0x6b8b42[_0x23b3('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0x23b3('0x25')](function(_0x167946){if(_0x167946){return db['UserProfileSection'][_0x23b3('0x26')]({'where':{'userProfileId':_0x6b8b42[_0x23b3('0x48')]['id'],'id':_[_0x23b3('0x2b')](_0x167946,function(_0xd06612){return _0xd06612['id'];})},'transaction':_0x342c82});}})[_0x23b3('0x25')](function(_0x47b773){var _0x255593=_[_0x23b3('0x2b')](_0x6b8b42[_0x23b3('0x4e')],function(_0x4bb758){_0x4bb758[_0x23b3('0x55')]=_0x6b8b42[_0x23b3('0x48')]['id'];return _0x4bb758;});return db[_0x23b3('0x51')][_0x23b3('0x66')](_0x255593,{'raw':!![],'transaction':_0x342c82});})[_0x23b3('0x25')](function(_0x5bb96a){var _0x4e915a=_[_0x23b3('0x38')](_[_0x23b3('0x2b')](_0x5bb96a,function(_0x43f937){return _0x43f937[_0x23b3('0x4b')]({'plain':!![]});}),{'includeAll':![]});if(_0x4e915a){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x6b8b42[_0x23b3('0x48')]['id'],'sectionId':_[_0x23b3('0x2b')](_0x4e915a,function(_0x217113){return _0x217113['sectionId'];})},'attributes':['id',_0x23b3('0x59')],'raw':!![]})[_0x23b3('0x25')](function(_0x3028eb){var _0x1a5d7d=_[_0x23b3('0x2b')](_0x6b8b42[_0x23b3('0x4e')],function(_0x441015){_0x441015['userProfileId']=_0x6b8b42[_0x23b3('0x48')]['id'];return _0x441015;});return db['UserProfileResource'][_0x23b3('0x66')](_0x1a5d7d,{'raw':!![],'transaction':_0x342c82});});}})['catch'](handleError(_0x33e4d3,null));});}})[_0x23b3('0x25')](function(_0x382bf6){var _0x129e7e=_[_0x23b3('0x2b')](_0x382bf6,function(_0x149e94){return _0x149e94[_0x23b3('0x4b')]({'plain':!![]});});})['then'](respondWithResult(_0x33e4d3,null))['catch'](handleError(_0x33e4d3,null));};exports[_0x23b3('0x67')]=function(_0x236a0d,_0x42d173,_0x4f1dc6){return db[_0x23b3('0x3c')]['find']({'where':{'id':_0x236a0d[_0x23b3('0x48')]['id']}})[_0x23b3('0x25')](handleEntityNotFound(_0x42d173,null))['then'](function(_0x5202e7){if(_0x5202e7){return _0x5202e7['removeResources'](_0x236a0d['query'][_0x23b3('0x68')]);}})[_0x23b3('0x25')](respondWithStatusCode(_0x42d173,null))[_0x23b3('0x41')](handleError(_0x42d173,null));};exports[_0x23b3('0x69')]=function(_0x3342ad,_0x36f166){var _0x2eabd5={'raw':![],'where':{}};var _0x463415={};var _0x5a772f={'count':0x0,'rows':[]};var _0x172c9c=_0x3342ad[_0x23b3('0x2e')]['section'];if(typeof _0x172c9c===_0x23b3('0x6a')){throw new db[(_0x23b3('0x6b'))][(_0x23b3('0x6c'))](_0x23b3('0x6d'));}var _0x5035ac=_0x3342ad[_0x23b3('0x2e')][_0x23b3('0x6e')]||![];var _0x903952=getQueryModels(_0x172c9c,_0x5035ac);if(typeof _0x903952[_0x23b3('0x6f')]==='undefined'){throw new db[(_0x23b3('0x6b'))][(_0x23b3('0x6c'))]('Invalid\x20section\x20\x27'+_0x172c9c+'\x27');}var _0x3abbb6=[];if(!_[_0x23b3('0x5f')](_0x903952[_0x23b3('0x70')])){_0x3abbb6=_0x903952['parentSections'];}else{_0x3abbb6=[{'name':_0x172c9c}];}return db[_0x23b3('0x3c')][_0x23b3('0x71')]({'where':{'id':_0x3342ad['params']['id']}})['then'](handleEntityNotFound(_0x36f166,null))[_0x23b3('0x25')](function(_0x3b8e71){if(_0x3b8e71){var _0x4ff3a3=[];for(var _0x27f851=0x0;_0x27f851<_0x3abbb6[_0x23b3('0x44')];_0x27f851++){_0x4ff3a3[_0x23b3('0x5a')](db[_0x23b3('0x51')][_0x23b3('0x71')]({'where':{'userProfileId':_0x3b8e71['id'],'name':_0x3abbb6[_0x27f851][_0x23b3('0x28')]},'raw':!![]}));}return BPromise['all'](_0x4ff3a3);}})[_0x23b3('0x25')](function(_0x4fadd3){var _0x4bd9c3=_['filter'](_0x4fadd3,function(_0x1714a9){return _0x1714a9?_0x1714a9:undefined;});var _0x182b6f=_[_0x23b3('0x38')](_0x3abbb6,['ignore',!![]]);var _0x1f2e9c=_[_0x23b3('0x5f')](_0x4bd9c3)&&_[_0x23b3('0x5f')](_0x182b6f)?null:_[_0x23b3('0x72')](_0x182b6f,_0x4bd9c3);if(_0x1f2e9c){var _0x1fb939=[];for(var _0x35deab=0x0;_0x35deab<_0x1f2e9c[_0x23b3('0x44')];_0x35deab++){var _0x144484=_[_0x23b3('0x45')](_0x3abbb6,function(_0x4571a9){return _0x1f2e9c[_0x35deab]?_0x4571a9[_0x23b3('0x28')]===_0x1f2e9c[_0x35deab][_0x23b3('0x28')]:null;});if(_0x144484){if(_0x1f2e9c[_0x35deab][_0x23b3('0x73')]){_0x1fb939[_0x23b3('0x5a')](getAllResources(_0x903952['childModel'],_0x1f2e9c[_0x35deab]));}else{if(!_0x1f2e9c[_0x35deab]['autoAssociation']){_0x1fb939[_0x23b3('0x5a')](getAllowedResources(_0x144484,_0x1f2e9c[_0x35deab],_0x903952[_0x23b3('0x6f')]));}else{if(_0x144484['model']){_0x1fb939[_0x23b3('0x5a')](getAllFilteredResources(_0x144484,_0x1f2e9c[_0x35deab]));}}}}}return BPromise[_0x23b3('0x74')](_0x1fb939);}else{return null;}})[_0x23b3('0x25')](function(_0x490ddd){var _0x5b2b80=_0x490ddd;var _0x4fc403=null;if(_0x5b2b80){_0x4fc403=_0x5b2b80[_0x23b3('0x44')]===0x1?_0x5b2b80[0x0]:null;}if(_0x4fc403||_0x5b2b80){var _0x1cc599=db[_0x903952['childModel']][_0x23b3('0x49')];_0x463415[_0x23b3('0x30')]=_[_0x23b3('0x43')](_0x1cc599);_0x463415['query']=_[_0x23b3('0x43')](_0x3342ad[_0x23b3('0x2e')]);_0x463415[_0x23b3('0x37')]=_[_0x23b3('0x2f')](_0x463415[_0x23b3('0x30')],_0x463415[_0x23b3('0x2e')]);_0x2eabd5['attributes']=_[_0x23b3('0x2f')](_0x463415[_0x23b3('0x30')],qs[_0x23b3('0x32')](_0x3342ad[_0x23b3('0x2e')][_0x23b3('0x32')]));_0x2eabd5['attributes']=_0x2eabd5[_0x23b3('0x31')][_0x23b3('0x44')]?_0x2eabd5[_0x23b3('0x31')]:_0x463415['model'];if(!_0x3342ad['query'][_0x23b3('0x33')](_0x23b3('0x75'))){_0x2eabd5[_0x23b3('0x1f')]=qs[_0x23b3('0x1f')](_0x3342ad[_0x23b3('0x2e')][_0x23b3('0x1f')]);_0x2eabd5[_0x23b3('0x1e')]=qs[_0x23b3('0x1e')](_0x3342ad[_0x23b3('0x2e')]['offset']);}_0x2eabd5[_0x23b3('0x34')]=qs[_0x23b3('0x35')](_0x3342ad[_0x23b3('0x2e')][_0x23b3('0x35')]);_0x2eabd5[_0x23b3('0x36')]=qs[_0x23b3('0x37')](_[_0x23b3('0x76')](_0x3342ad['query'],_0x463415['filters']));if(_0x3342ad[_0x23b3('0x2e')][_0x23b3('0x38')]){_0x2eabd5[_0x23b3('0x36')]=_[_0x23b3('0x39')](_0x2eabd5['where'],{'$or':_[_0x23b3('0x2b')](_0x1cc599,function(_0x379723){if(_0x379723[_0x23b3('0x2c')][_0x23b3('0x2d')]!==_0x23b3('0x3a')){var _0x3a3515={};_0x3a3515[_0x379723[_0x23b3('0x77')]]={'$like':'%'+_0x3342ad[_0x23b3('0x2e')]['filter']+'%'};return _0x3a3515;}})});}var _0x4ead9d=[];if(_0x4fc403){var _0x539064=_[_0x23b3('0x45')](_0x3abbb6,[_0x23b3('0x28'),_0x4fc403[_0x23b3('0x28')]]);if(_0x539064[_0x23b3('0x77')]){var _0x2a6c08={};if(_0x903952[_0x23b3('0x6f')]===_0x23b3('0x78')){_0x2a6c08[_0x539064[_0x23b3('0x79')]]=_[_0x23b3('0x2b')](_0x4fc403['associatedResources'],'id');}else{_0x2a6c08[_0x539064[_0x23b3('0x79')]]=_0x4fc403['associatedResources'];}_0x4ead9d[_0x23b3('0x5a')](_0x2a6c08);}else{_0x2eabd5[_0x23b3('0x36')]['id']=_0x4fc403[_0x23b3('0x7a')];}}else{for(var _0x4f2bfb=0x0;_0x4f2bfb<_0x5b2b80[_0x23b3('0x44')];_0x4f2bfb++){var _0x539064=_['find'](_0x3abbb6,['name',_0x5b2b80[_0x4f2bfb]['name']]);if(_0x539064[_0x23b3('0x77')]){var _0x2a6c08={};_0x2a6c08[_0x539064[_0x23b3('0x79')]]=_0x5b2b80[_0x4f2bfb][_0x23b3('0x7a')];_0x4ead9d['push'](_0x2a6c08);}else{if(!_0x2eabd5[_0x23b3('0x36')]['id'])_0x2eabd5['where']['id']=[];_0x5b2b80[_0x4f2bfb][_0x23b3('0x7a')]['forEach'](function(_0xe44cec){_0x2eabd5[_0x23b3('0x36')]['id'][_0x23b3('0x5a')](_0xe44cec);});}}}if(!_['isEmpty'](_0x4ead9d)){_0x2eabd5['where']=_[_0x23b3('0x39')](_0x2eabd5['where'],{'$and':{'$or':_0x4ead9d}});}_0x2eabd5=_[_0x23b3('0x39')]({},_0x2eabd5,_0x3342ad[_0x23b3('0x3b')]);if(_0x4fc403&&!_0x4fc403[_0x23b3('0x53')]&&_0x903952['childModel']===_0x23b3('0x78')){if(_0x3342ad['query']['includeAll']){_0x2eabd5[_0x23b3('0x3e')]=[{'all':!![]}];}return db[_0x903952['childModel']]['findAll'](_0x2eabd5)[_0x23b3('0x25')](function(_0x465c41){var _0x21ef1e=[];_0x465c41[_0x23b3('0x62')](function(_0x493ffc){var _0x4ec210;switch(_0x493ffc[_0x23b3('0x7b')]){case _0x23b3('0x7c'):_0x4ec210=_[_0x23b3('0x45')](_0x4fc403[_0x23b3('0x7a')],function(_0x56703f){return _0x56703f['id']===_0x493ffc[_0x23b3('0x7d')]&&_0x56703f[_0x23b3('0x2c')]===_0x23b3('0x7e');});break;case _0x23b3('0x7f'):_0x4ec210=_[_0x23b3('0x45')](_0x4fc403['associatedResources'],function(_0x3fad5f){return _0x3fad5f['id']===_0x493ffc[_0x23b3('0x7d')]&&_0x3fad5f[_0x23b3('0x2c')]==='CustomReports';});break;}if(_0x4ec210)_0x21ef1e[_0x23b3('0x5a')](_0x493ffc);});_0x5a772f[_0x23b3('0x3d')]=_0x21ef1e[_0x23b3('0x44')];_0x5a772f['rows']=_0x21ef1e;return _0x5a772f;});}else{return db[_0x903952[_0x23b3('0x6f')]]['count']({'where':_0x2eabd5[_0x23b3('0x36')]})[_0x23b3('0x25')](function(_0x151c40){_0x5a772f[_0x23b3('0x3d')]=_0x151c40;if(_0x3342ad['query']['includeAll']){if(_0x903952[_0x23b3('0x6f')]===_0x23b3('0x80')){_0x2eabd5['include']=[{'model':db['Tag'],'as':_0x23b3('0x81'),'attributes':['id','name',_0x23b3('0x82')],'required':_0x3342ad[_0x23b3('0x2e')][_0x23b3('0x83')]?!![]:![]},{'model':db[_0x23b3('0x84')],'as':'ThroughTags','attributes':['id',_0x23b3('0x28'),_0x23b3('0x82')],'through':_0x3342ad[_0x23b3('0x2e')][_0x23b3('0x83')]?{'attributes':[],'where':{'TagId':_0x3342ad[_0x23b3('0x2e')][_0x23b3('0x83')]||undefined}}:{},'required':_0x3342ad[_0x23b3('0x2e')][_0x23b3('0x83')]?!![]:![]}];}else{_0x2eabd5[_0x23b3('0x3e')]=[{'all':!![]}];}}return db[_0x903952[_0x23b3('0x6f')]]['findAll'](_0x2eabd5);})['then'](function(_0x764955){_0x5a772f['rows']=_0x764955;return _0x5a772f;});}}else{return _0x5a772f;}})[_0x23b3('0x25')](respondWithFilteredResult(_0x36f166,_0x2eabd5))[_0x23b3('0x41')](handleError(_0x36f166,null));};function getAllResources(_0x405de5,_0x35c068){return new BPromise(function(_0x1de6d6,_0x5c54f1){if(_0x35c068){var _0x34fa25=_0x35c068[_0x23b3('0x38')]?{[_0x35c068[_0x23b3('0x38')][_0x23b3('0x77')]]:_0x35c068[_0x23b3('0x38')][_0x23b3('0x85')]}:undefined;return db[_0x405de5][_0x23b3('0x3f')]({'where':_0x34fa25,'raw':!![]})[_0x23b3('0x25')](function(_0x531b24){_0x35c068[_0x23b3('0x7a')]=_[_0x23b3('0x2b')](_0x531b24,'id');_0x1de6d6(_0x35c068);})[_0x23b3('0x41')](function(_0x32ad29){_0x5c54f1(_0x32ad29);});}else{_0x1de6d6(null);}});}function getAllFilteredResources(_0x1d69f7,_0x1b0fde){return new BPromise(function(_0x2559a0,_0x4e0855){var _0x121009=_0x1d69f7[_0x23b3('0x38')]?{[_0x1d69f7['filter'][_0x23b3('0x77')]]:_0x1d69f7['filter']['value']}:undefined;return db[_0x1d69f7['model']]['findAll']({'where':_0x121009,'raw':!![]})[_0x23b3('0x25')](function(_0x393028){_0x1b0fde['associatedResources']=_[_0x23b3('0x2b')](_0x393028,function(_0x457936){return _0x457936[_0x23b3('0x28')];});_0x2559a0(_0x1b0fde);})[_0x23b3('0x41')](function(_0x459c25){_0x4e0855(_0x459c25);});});}function getAllowedResources(_0x44872a,_0x3b8cb4,_0x1fccfa){return new BPromise(function(_0x5285fe,_0xc3fb8a){if(_0x3b8cb4){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x3b8cb4['id']},'raw':!![]})[_0x23b3('0x25')](function(_0x18c020){if(_0x44872a['field']&&_0x44872a['field']!=='id'){_0x3b8cb4['associatedResources']=_[_0x23b3('0x2b')](_0x18c020,function(_0x25f8c2){return _0x25f8c2[_0x44872a[_0x23b3('0x77')]];});}else{if(_0x1fccfa===_0x23b3('0x78')){_0x3b8cb4[_0x23b3('0x7a')]=_[_0x23b3('0x2b')](_0x18c020,function(_0x356362){return{'id':_0x356362[_0x23b3('0x63')],'type':_0x356362['type']};});}else{_0x3b8cb4[_0x23b3('0x7a')]=_[_0x23b3('0x2b')](_0x18c020,function(_0x5b94fd){return _0x5b94fd[_0x23b3('0x63')];});}}_0x5285fe(_0x3b8cb4);})[_0x23b3('0x41')](function(_0x4a1db4){_0xc3fb8a(_0x4a1db4);});}else{_0x5285fe(null);}});}function getQueryModels(_0x4ed238,_0x5ece4c){var _0x55d337=_0x4ed238[_0x23b3('0x86')]();var _0x81a515={'childModel':undefined,'parentSections':[]};switch(_0x55d337){case'squareprojects':_0x81a515[_0x23b3('0x6f')]=_0x23b3('0x87');break;case _0x23b3('0x88'):_0x81a515[_0x23b3('0x6f')]=_0x23b3('0x89');break;case _0x23b3('0x8a'):_0x81a515[_0x23b3('0x6f')]=_0x23b3('0x8b');_0x81a515[_0x23b3('0x70')]=[{'name':_0x23b3('0x8c'),'field':'name','foreignKey':_0x23b3('0x8d')}];break;case _0x23b3('0x8e'):_0x81a515[_0x23b3('0x6f')]='JscriptyProject';break;case _0x23b3('0x8f'):_0x81a515['childModel']='CmContact';_0x81a515[_0x23b3('0x70')]=[{'name':_0x23b3('0x90'),'field':'id','foreignKey':_0x23b3('0x91')}];break;case _0x23b3('0x92'):_0x81a515[_0x23b3('0x6f')]=_0x23b3('0x93');break;case _0x23b3('0x94'):_0x81a515[_0x23b3('0x6f')]=_0x23b3('0x95');break;case _0x23b3('0x96'):_0x81a515[_0x23b3('0x6f')]=_0x23b3('0x97');break;case _0x23b3('0x98'):_0x81a515['childModel']=_0x23b3('0x99');break;case _0x23b3('0x9a'):_0x81a515[_0x23b3('0x6f')]=_0x23b3('0x9b');break;case _0x23b3('0x9c'):_0x81a515[_0x23b3('0x6f')]=_0x23b3('0x9d');break;case'faxaccounts':_0x81a515[_0x23b3('0x6f')]='FaxAccount';break;case _0x23b3('0x9e'):case _0x23b3('0x9f'):case _0x23b3('0xa0'):_0x81a515[_0x23b3('0x6f')]=_0x23b3('0xa1');break;case _0x23b3('0xa2'):_0x81a515[_0x23b3('0x6f')]=_0x23b3('0xa3');break;case _0x23b3('0xa4'):_0x81a515['childModel']=_0x23b3('0xa5');break;case _0x23b3('0xa6'):_0x81a515[_0x23b3('0x6f')]='VoiceRecording';_0x81a515[_0x23b3('0x70')]=[{'name':_0x23b3('0xa7'),'field':_0x23b3('0x28'),'foreignKey':_0x23b3('0xa8'),'model':_0x23b3('0xa9'),'filter':{'field':'role','value':['agent']}},{'name':_0x23b3('0xaa'),'field':_0x23b3('0x28'),'foreignKey':_0x23b3('0xa8'),'model':'User','filter':{'field':_0x23b3('0xab'),'value':[_0x23b3('0xac')]}},{'name':_0x23b3('0xad'),'field':_0x23b3('0x28'),'foreignKey':_0x23b3('0xae'),'model':_0x23b3('0xaf'),'filter':{'field':_0x23b3('0x2c'),'value':[_0x23b3('0xb0')]}},{'name':_0x23b3('0xb1'),'field':_0x23b3('0x28'),'foreignKey':_0x23b3('0xae'),'model':_0x23b3('0xaf'),'filter':{'field':'type','value':[_0x23b3('0xb2')]}}];break;case _0x23b3('0xb3'):_0x81a515[_0x23b3('0x6f')]=_0x23b3('0xb4');break;case _0x23b3('0xb5'):_0x81a515['childModel']=_0x23b3('0xb6');break;case _0x23b3('0xb7'):_0x81a515[_0x23b3('0x6f')]=_0x23b3('0xb8');break;case _0x23b3('0xb9'):_0x81a515[_0x23b3('0x6f')]='Campaign';break;case _0x23b3('0xba'):_0x81a515[_0x23b3('0x6f')]=_0x23b3('0xbb');break;case _0x23b3('0xbc'):_0x81a515[_0x23b3('0x6f')]='MailAccount';break;case _0x23b3('0xbd'):_0x81a515[_0x23b3('0x6f')]='MailSubstatus';break;case'openchannelqueues':_0x81a515[_0x23b3('0x6f')]=_0x23b3('0xbe');break;case _0x23b3('0xbf'):_0x81a515['childModel']=_0x23b3('0xc0');break;case'smsqueues':_0x81a515[_0x23b3('0x6f')]=_0x23b3('0xc1');break;case'smsaccounts':_0x81a515[_0x23b3('0x6f')]=_0x23b3('0xc2');break;case _0x23b3('0xc3'):_0x81a515[_0x23b3('0x6f')]=_0x23b3('0xc4');break;case _0x23b3('0xc5'):case _0x23b3('0xc6'):_0x81a515['childModel']=_0x23b3('0xaf');if(_0x5ece4c){_0x81a515[_0x23b3('0x70')]=[{'name':_0x23b3('0xad')},{'name':_0x23b3('0xb1')}];}break;case'users':case _0x23b3('0xc7'):case _0x23b3('0xc8'):_0x81a515['childModel']=_0x23b3('0xa9');if(_0x5ece4c){_0x81a515[_0x23b3('0x70')]=[{'name':_0x23b3('0xc9'),'filter':{'field':_0x23b3('0xab'),'value':['admin',_0x23b3('0xca')]},'ignore':!![]},{'name':_0x23b3('0xa7')},{'name':'Telephones'}];}break;case _0x23b3('0xcb'):_0x81a515[_0x23b3('0x6f')]=_0x23b3('0xcc');break;case _0x23b3('0xcd'):_0x81a515[_0x23b3('0x6f')]=_0x23b3('0xce');break;case _0x23b3('0xcf'):_0x81a515['childModel']=_0x23b3('0xd0');break;case'sugarcrmaccounts':_0x81a515['childModel']=_0x23b3('0xd1');break;case _0x23b3('0xd2'):_0x81a515['childModel']=_0x23b3('0xd3');break;case _0x23b3('0xd4'):_0x81a515[_0x23b3('0x6f')]=_0x23b3('0xd5');break;case _0x23b3('0xd6'):_0x81a515[_0x23b3('0x6f')]=_0x23b3('0xa9');break;case _0x23b3('0xd7'):_0x81a515[_0x23b3('0x6f')]=_0x23b3('0xd8');break;case _0x23b3('0xd9'):_0x81a515['childModel']=_0x23b3('0xda');break;case _0x23b3('0xdb'):_0x81a515[_0x23b3('0x6f')]='Dashboard';break;case'intervals':_0x81a515[_0x23b3('0x6f')]=_0x23b3('0xdc');break;case _0x23b3('0xdd'):_0x81a515[_0x23b3('0x6f')]='Pause';break;case _0x23b3('0xde'):_0x81a515[_0x23b3('0x6f')]='Schedule';break;case _0x23b3('0xdf'):_0x81a515[_0x23b3('0x6f')]=_0x23b3('0xe0');break;case _0x23b3('0xe1'):_0x81a515[_0x23b3('0x6f')]=_0x23b3('0x84');break;case _0x23b3('0xe2'):_0x81a515[_0x23b3('0x6f')]='Template';break;case _0x23b3('0xe3'):_0x81a515['childModel']='Trigger';break;case _0x23b3('0xe4'):_0x81a515[_0x23b3('0x6f')]=_0x23b3('0xe5');break;case _0x23b3('0xe6'):_0x81a515[_0x23b3('0x6f')]='Variable';break;case'plugins':_0x81a515[_0x23b3('0x6f')]=_0x23b3('0x64');break;case _0x23b3('0xe7'):_0x81a515['childModel']=_0x23b3('0x78');_0x81a515[_0x23b3('0x70')]=[{'name':_0x23b3('0xe8'),'field':'id','foreignKey':_0x23b3('0x7d')}];break;case _0x23b3('0xe9'):_0x81a515[_0x23b3('0x6f')]=_0x23b3('0xea');break;default:return _0x81a515;}return _0x81a515;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 0c2a004..8f6861f 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 _0x39e4=['save','update','emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners'];(function(_0x17b178,_0x591046){var _0x1bae80=function(_0x12552a){while(--_0x12552a){_0x17b178['push'](_0x17b178['shift']());}};_0x1bae80(++_0x591046);}(_0x39e4,0x91));var _0x439e=function(_0x234614,_0x89f8ab){_0x234614=_0x234614-0x0;var _0x3cbc7e=_0x39e4[_0x234614];return _0x3cbc7e;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x439e('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x439e('0x1')](0x0);var events={'afterCreate':_0x439e('0x2'),'afterUpdate':_0x439e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x512210){return function(_0x1a5e3f,_0x35fcef,_0x3bda54){UserProfileEvents[_0x439e('0x4')](_0x512210+':'+_0x1a5e3f['id'],_0x1a5e3f);UserProfileEvents[_0x439e('0x4')](_0x512210,_0x1a5e3f);_0x3bda54(null);};}for(var e in events){if(events[_0x439e('0x5')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x439e('0x6')]=UserProfileEvents; \ No newline at end of file +var _0x6ca4=['emit','exports','../../mysqldb','UserProfile','setMaxListeners','save','remove'];(function(_0x2a276d,_0x482b0c){var _0x2914cd=function(_0x452b8b){while(--_0x452b8b){_0x2a276d['push'](_0x2a276d['shift']());}};_0x2914cd(++_0x482b0c);}(_0x6ca4,0xbf));var _0x46ca=function(_0x3bc030,_0x272450){_0x3bc030=_0x3bc030-0x0;var _0x5a14df=_0x6ca4[_0x3bc030];return _0x5a14df;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x46ca('0x0'))['db'][_0x46ca('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x46ca('0x2')](0x0);var events={'afterCreate':_0x46ca('0x3'),'afterUpdate':'update','afterDestroy':_0x46ca('0x4')};function emitEvent(_0x9d816d){return function(_0x4d13fe,_0x3c835e,_0x20e08f){UserProfileEvents['emit'](_0x9d816d+':'+_0x4d13fe['id'],_0x4d13fe);UserProfileEvents[_0x46ca('0x5')](_0x9d816d,_0x4d13fe);_0x20e08f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x46ca('0x6')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 44facea..d2fc154 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 _0x9024=['./userProfile.attributes','exports','define','UserProfile','user_profiles','lodash','../../config/logger','api','moment','path','rimraf'];(function(_0x3fd3d4,_0x2a04c9){var _0x3b2c1d=function(_0x2a2422){while(--_0x2a2422){_0x3fd3d4['push'](_0x3fd3d4['shift']());}};_0x3b2c1d(++_0x2a04c9);}(_0x9024,0x139));var _0x4902=function(_0x49ac7e,_0x198bf3){_0x49ac7e=_0x49ac7e-0x0;var _0x3d2601=_0x9024[_0x49ac7e];return _0x3d2601;};'use strict';var _=require(_0x4902('0x0'));var util=require('util');var logger=require(_0x4902('0x1'))(_0x4902('0x2'));var moment=require(_0x4902('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4902('0x4'));var rimraf=require(_0x4902('0x5'));var config=require('../../config/environment');var attributes=require(_0x4902('0x6'));module[_0x4902('0x7')]=function(_0x11f05a,_0xf927fc){return _0x11f05a[_0x4902('0x8')](_0x4902('0x9'),attributes,{'tableName':_0x4902('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x829b=['request-promise','rimraf','exports','UserProfile','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x545ced,_0x2eb3d3){var _0x40da32=function(_0x2eb6ef){while(--_0x2eb6ef){_0x545ced['push'](_0x545ced['shift']());}};_0x40da32(++_0x2eb3d3);}(_0x829b,0x176));var _0xb829=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x829b[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xb829('0x0'));var util=require(_0xb829('0x1'));var logger=require(_0xb829('0x2'))(_0xb829('0x3'));var moment=require(_0xb829('0x4'));var BPromise=require(_0xb829('0x5'));var rp=require(_0xb829('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb829('0x7'));var config=require('../../config/environment');var attributes=require('./userProfile.attributes');module[_0xb829('0x8')]=function(_0x3275db,_0x7fb08b){return _0x3275db['define'](_0xb829('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 7ab84ba..116ff97 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 _0x71ab=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','request\x20sent','stringify','error','message','UserProfile,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x49bcaa,_0x21fe96){var _0x33022e=function(_0x14ea2f){while(--_0x14ea2f){_0x49bcaa['push'](_0x49bcaa['shift']());}};_0x33022e(++_0x21fe96);}(_0x71ab,0x64));var _0xb71a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x71ab[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var moment=require('moment');var BPromise=require(_0xb71a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb71a('0x2'));var db=require(_0xb71a('0x3'))['db'];var utils=require(_0xb71a('0x4'));var logger=require(_0xb71a('0x5'))(_0xb71a('0x6'));var config=require(_0xb71a('0x7'));var jayson=require(_0xb71a('0x8'));var client=jayson[_0xb71a('0x9')][_0xb71a('0xa')]({'port':0x232a});config[_0xb71a('0xb')]=_[_0xb71a('0xc')](config[_0xb71a('0xb')],{'host':_0xb71a('0xd'),'port':0x18eb});var socket=require(_0xb71a('0xe'))(new Redis(config[_0xb71a('0xb')]));require(_0xb71a('0xf'))[_0xb71a('0x10')](socket);function respondWithRpcPromise(_0x2e8883,_0x517eed,_0xfec897){return new BPromise(function(_0x58956d,_0x3d7bd7){return client[_0xb71a('0x11')](_0x2e8883,_0xfec897)[_0xb71a('0x12')](function(_0x591311){logger[_0xb71a('0x13')]('UserProfile,\x20%s,\x20%s',_0x517eed,_0xb71a('0x14'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x517eed,_0xb71a('0x14'),JSON[_0xb71a('0x15')](_0x591311));if(_0x591311[_0xb71a('0x16')]){if(_0x591311[_0xb71a('0x16')]['code']===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x517eed,_0x591311[_0xb71a('0x16')][_0xb71a('0x17')]);return _0x3d7bd7(_0x591311[_0xb71a('0x16')][_0xb71a('0x17')]);}logger[_0xb71a('0x16')](_0xb71a('0x18'),_0x517eed,_0x591311[_0xb71a('0x16')][_0xb71a('0x17')]);return _0x58956d(_0x591311[_0xb71a('0x16')]['message']);}else{logger[_0xb71a('0x13')](_0xb71a('0x18'),_0x517eed,_0xb71a('0x14'));_0x58956d(_0x591311[_0xb71a('0x19')][_0xb71a('0x17')]);}})[_0xb71a('0x1a')](function(_0x349de1){logger[_0xb71a('0x16')](_0xb71a('0x18'),_0x517eed,_0x349de1);_0x3d7bd7(_0x349de1);});});} \ No newline at end of file +var _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x4d8a8f,_0x2afd4c){var _0xfc4adc=function(_0xb89886){while(--_0xb89886){_0x4d8a8f['push'](_0x4d8a8f['shift']());}};_0xfc4adc(++_0x2afd4c);}(_0xabce,0x103));var _0xeabc=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xabce[_0xdc37a1];return _0x99b4fe;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});config[_0xeabc('0x9')]=_['defaults'](config[_0xeabc('0x9')],{'host':_0xeabc('0xa'),'port':0x18eb});var socket=require(_0xeabc('0xb'))(new Redis(config['redis']));require(_0xeabc('0xc'))[_0xeabc('0xd')](socket);function respondWithRpcPromise(_0x2f73e9,_0x1b4d1b,_0x4301e4){return new BPromise(function(_0x283cdf,_0x111aaf){return client[_0xeabc('0xe')](_0x2f73e9,_0x4301e4)[_0xeabc('0xf')](function(_0xf0d9c0){logger[_0xeabc('0x10')](_0xeabc('0x11'),_0x1b4d1b,_0xeabc('0x12'));logger[_0xeabc('0x13')](_0xeabc('0x14'),_0x1b4d1b,_0xeabc('0x12'),JSON['stringify'](_0xf0d9c0));if(_0xf0d9c0[_0xeabc('0x15')]){if(_0xf0d9c0[_0xeabc('0x15')][_0xeabc('0x16')]===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x1b4d1b,_0xf0d9c0[_0xeabc('0x15')][_0xeabc('0x17')]);return _0x111aaf(_0xf0d9c0[_0xeabc('0x15')]['message']);}logger[_0xeabc('0x15')](_0xeabc('0x11'),_0x1b4d1b,_0xf0d9c0['error']['message']);return _0x283cdf(_0xf0d9c0[_0xeabc('0x15')]['message']);}else{logger[_0xeabc('0x10')](_0xeabc('0x11'),_0x1b4d1b,_0xeabc('0x12'));_0x283cdf(_0xf0d9c0[_0xeabc('0x18')][_0xeabc('0x17')]);}})[_0xeabc('0x19')](function(_0x384be5){logger[_0xeabc('0x15')]('UserProfile,\x20%s,\x20%s',_0x1b4d1b,_0x384be5);_0x111aaf(_0x384be5);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index cfe5302..936dea6 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 _0x0430=['remove','update','emit','register','length','userProfile:','save'];(function(_0x968411,_0x151619){var _0x46e3e5=function(_0x3c621e){while(--_0x3c621e){_0x968411['push'](_0x968411['shift']());}};_0x46e3e5(++_0x151619);}(_0x0430,0xa7));var _0x0043=function(_0xca69aa,_0x23561d){_0xca69aa=_0xca69aa-0x0;var _0x2330d8=_0x0430[_0xca69aa];return _0x2330d8;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x0043('0x0'),_0x0043('0x1'),_0x0043('0x2')];function createListener(_0x138848,_0x1658e8){return function(_0x2e63d0){_0x1658e8[_0x0043('0x3')](_0x138848,_0x2e63d0);};}function removeListener(_0x3faef2,_0x3cb370){return function(){UserProfileEvents['removeListener'](_0x3faef2,_0x3cb370);};}exports[_0x0043('0x4')]=function(_0x210912){for(var _0x577b70=0x0,_0x3eee5b=events[_0x0043('0x5')];_0x577b70<_0x3eee5b;_0x577b70++){var _0x121cf9=events[_0x577b70];var _0x32fa3a=createListener(_0x0043('0x6')+_0x121cf9,_0x210912);UserProfileEvents['on'](_0x121cf9,_0x32fa3a);}}; \ No newline at end of file +var _0x5d9c=['remove','update','emit','register','length','userProfile:','./userProfile.events','save'];(function(_0xf74ddb,_0x8383bd){var _0x44e4cd=function(_0x20be15){while(--_0x20be15){_0xf74ddb['push'](_0xf74ddb['shift']());}};_0x44e4cd(++_0x8383bd);}(_0x5d9c,0xe6));var _0xc5d9=function(_0x4036da,_0x5c9b61){_0x4036da=_0x4036da-0x0;var _0x3d4d84=_0x5d9c[_0x4036da];return _0x3d4d84;};'use strict';var UserProfileEvents=require(_0xc5d9('0x0'));var events=[_0xc5d9('0x1'),_0xc5d9('0x2'),_0xc5d9('0x3')];function createListener(_0x2a746a,_0x4fc036){return function(_0x3336d8){_0x4fc036[_0xc5d9('0x4')](_0x2a746a,_0x3336d8);};}function removeListener(_0x9140f3,_0x223473){return function(){UserProfileEvents['removeListener'](_0x9140f3,_0x223473);};}exports[_0xc5d9('0x5')]=function(_0x431828){for(var _0xd5e941=0x0,_0x2cd4a6=events[_0xc5d9('0x6')];_0xd5e941<_0x2cd4a6;_0xd5e941++){var _0x19ba1b=events[_0xd5e941];var _0x275f9a=createListener(_0xc5d9('0x7')+_0x19ba1b,_0x431828);UserProfileEvents['on'](_0x19ba1b,_0x275f9a);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 95e5ee2..11ee38a 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 _0xe96f=['/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','show','create'];(function(_0x485abd,_0x32c7c1){var _0x3379f1=function(_0x36b528){while(--_0x36b528){_0x485abd['push'](_0x485abd['shift']());}};_0x3379f1(++_0x32c7c1);}(_0xe96f,0x158));var _0xfe96=function(_0x339413,_0x23c6ac){_0x339413=_0x339413-0x0;var _0x260e4b=_0xe96f[_0x339413];return _0x260e4b;};'use strict';var multer=require(_0xfe96('0x0'));var util=require(_0xfe96('0x1'));var path=require(_0xfe96('0x2'));var timeout=require(_0xfe96('0x3'));var express=require(_0xfe96('0x4'));var router=express[_0xfe96('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xfe96('0x6'));var config=require(_0xfe96('0x7'));var controller=require(_0xfe96('0x8'));router[_0xfe96('0x9')]('/',auth[_0xfe96('0xa')](),controller[_0xfe96('0xb')]);router[_0xfe96('0x9')](_0xfe96('0xc'),auth[_0xfe96('0xa')](),controller[_0xfe96('0xd')]);router['get']('/:id',auth[_0xfe96('0xa')](),controller[_0xfe96('0xe')]);router['post']('/',auth[_0xfe96('0xa')](),controller[_0xfe96('0xf')]);router['put'](_0xfe96('0x10'),auth[_0xfe96('0xa')](),controller[_0xfe96('0x11')]);router[_0xfe96('0x12')](_0xfe96('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0xfe96('0x13')]=router; \ No newline at end of file +var _0xe5ae=['update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','post','create','put'];(function(_0x5bbb42,_0xdfb244){var _0x1ef8d4=function(_0x2d29ee){while(--_0x2d29ee){_0x5bbb42['push'](_0x5bbb42['shift']());}};_0x1ef8d4(++_0xdfb244);}(_0xe5ae,0x120));var _0xee5a=function(_0x152136,_0x4f14f1){_0x152136=_0x152136-0x0;var _0x20df44=_0xe5ae[_0x152136];return _0x20df44;};'use strict';var multer=require(_0xee5a('0x0'));var util=require(_0xee5a('0x1'));var path=require(_0xee5a('0x2'));var timeout=require(_0xee5a('0x3'));var express=require(_0xee5a('0x4'));var router=express['Router']();var auth=require(_0xee5a('0x5'));var interaction=require(_0xee5a('0x6'));var config=require(_0xee5a('0x7'));var controller=require('./userProfileResource.controller');router[_0xee5a('0x8')]('/',auth['isAuthenticated'](),controller[_0xee5a('0x9')]);router[_0xee5a('0x8')]('/describe',auth[_0xee5a('0xa')](),controller[_0xee5a('0xb')]);router[_0xee5a('0x8')](_0xee5a('0xc'),auth[_0xee5a('0xa')](),controller['show']);router[_0xee5a('0xd')]('/',auth[_0xee5a('0xa')](),controller[_0xee5a('0xe')]);router[_0xee5a('0xf')](_0xee5a('0xc'),auth[_0xee5a('0xa')](),controller[_0xee5a('0x10')]);router[_0xee5a('0x11')](_0xee5a('0xc'),auth[_0xee5a('0xa')](),controller['destroy']);module[_0xee5a('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 8b61135..83d1e92 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 _0x53c9=['exports','STRING','INTEGER','sequelize'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0x53c9,0xab));var _0x953c=function(_0x2b68e4,_0x339afe){_0x2b68e4=_0x2b68e4-0x0;var _0xcb45cf=_0x53c9[_0x2b68e4];return _0xcb45cf;};'use strict';var Sequelize=require(_0x953c('0x0'));module[_0x953c('0x1')]={'name':{'type':Sequelize[_0x953c('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x953c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x953c('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7156=['STRING'];(function(_0x19ff50,_0x4ec334){var _0x33b996=function(_0x203a79){while(--_0x203a79){_0x19ff50['push'](_0x19ff50['shift']());}};_0x33b996(++_0x4ec334);}(_0x7156,0x109));var _0x6715=function(_0x22601b,_0x1fe519){_0x22601b=_0x22601b-0x0;var _0x565d2e=_0x7156[_0x22601b];return _0x565d2e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6715('0x0')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x6715('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 853db4f..58ad3d3 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 _0x5d20=['keys','length','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','UserProfileResource','includeAll','include','findAll','catch','show','params'];(function(_0x5c9b8d,_0x539fd0){var _0x72bd16=function(_0x12040f){while(--_0x12040f){_0x5c9b8d['push'](_0x5c9b8d['shift']());}};_0x72bd16(++_0x539fd0);}(_0x5d20,0x1c3));var _0x05d2=function(_0x41de92,_0x4ee8b6){_0x41de92=_0x41de92-0x0;var _0xaa1224=_0x5d20[_0x41de92];return _0xaa1224;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x05d2('0x0'));var rimraf=require(_0x05d2('0x1'));var zipdir=require(_0x05d2('0x2'));var jsonpatch=require(_0x05d2('0x3'));var rp=require('request-promise');var moment=require(_0x05d2('0x4'));var BPromise=require(_0x05d2('0x5'));var Mustache=require(_0x05d2('0x6'));var util=require('util');var path=require(_0x05d2('0x7'));var sox=require(_0x05d2('0x8'));var csv=require(_0x05d2('0x9'));var ejs=require(_0x05d2('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x05d2('0xb'));var crypto=require(_0x05d2('0xc'));var jsforce=require(_0x05d2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x05d2('0x9'));var querystring=require(_0x05d2('0xe'));var Papa=require('papaparse');var Redis=require(_0x05d2('0xf'));var authService=require(_0x05d2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x05d2('0x11'));var hardwareService=require(_0x05d2('0x12'));var logger=require(_0x05d2('0x13'))(_0x05d2('0x14'));var utils=require(_0x05d2('0x15'));var config=require(_0x05d2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ccbb7,_0x14c283){_0x14c283=_0x14c283||0xcc;return function(_0x146265){if(_0x146265){return _0x1ccbb7[_0x05d2('0x17')](_0x14c283);}return _0x1ccbb7[_0x05d2('0x18')](_0x14c283)[_0x05d2('0x19')]();};}function respondWithResult(_0x19572c,_0x509140){_0x509140=_0x509140||0xc8;return function(_0x3dc704){if(_0x3dc704){return _0x19572c[_0x05d2('0x18')](_0x509140)[_0x05d2('0x1a')](_0x3dc704);}};}function respondWithFilteredResult(_0x1022b1,_0x5dd979){return function(_0x222031){if(_0x222031){var _0x2c4f0d=_0x222031[_0x05d2('0x1b')],_0x2e009c=_0x5dd979['offset'],_0x2e760c=_0x5dd979[_0x05d2('0x1c')]+_0x5dd979[_0x05d2('0x1d')],_0x75d13a;if(_0x2e760c>=_0x2c4f0d){_0x2e760c=_0x2c4f0d;_0x75d13a=0xc8;}else{_0x75d13a=0xce;}_0x1022b1[_0x05d2('0x18')](_0x75d13a);return _0x1022b1[_0x05d2('0x1e')](_0x05d2('0x1f'),_0x2e009c+'-'+_0x2e760c+'/'+_0x2c4f0d)['json'](_0x222031);}return null;};}function patchUpdates(_0x30b03d){return function(_0x504c3e){try{jsonpatch['apply'](_0x504c3e,_0x30b03d,!![]);}catch(_0x21d818){return BPromise[_0x05d2('0x20')](_0x21d818);}return _0x504c3e[_0x05d2('0x21')]();};}function saveUpdates(_0x3c7cfc,_0x157c9b){return function(_0x416ff1){if(_0x416ff1){return _0x416ff1['update'](_0x3c7cfc)[_0x05d2('0x22')](function(_0x25f732){return _0x25f732;});}return null;};}function removeEntity(_0x4ac0a2,_0x1a4455){return function(_0xda35b7){if(_0xda35b7){return _0xda35b7[_0x05d2('0x23')]()[_0x05d2('0x22')](function(){_0x4ac0a2[_0x05d2('0x18')](0xcc)[_0x05d2('0x19')]();});}};}function handleEntityNotFound(_0x26a79b,_0x19373c){return function(_0xb03df8){if(!_0xb03df8){_0x26a79b[_0x05d2('0x17')](0x194);}return _0xb03df8;};}function handleError(_0x2878bd,_0x4ba633){_0x4ba633=_0x4ba633||0x1f4;return function(_0x120a47){logger[_0x05d2('0x24')](_0x120a47[_0x05d2('0x25')]);if(_0x120a47[_0x05d2('0x26')]){delete _0x120a47[_0x05d2('0x26')];}_0x2878bd['status'](_0x4ba633)[_0x05d2('0x27')](_0x120a47);};}exports[_0x05d2('0x28')]=function(_0x264026,_0x35260c){var _0x15e34f={},_0x5824b0={},_0x1f4da2={'count':0x0,'rows':[]};var _0x2715d8=_[_0x05d2('0x29')](db['UserProfileResource']['rawAttributes'],function(_0x20ebc4){return{'name':_0x20ebc4[_0x05d2('0x2a')],'type':_0x20ebc4[_0x05d2('0x2b')][_0x05d2('0x2c')]};});_0x5824b0['model']=_['map'](_0x2715d8,_0x05d2('0x26'));_0x5824b0['query']=_['keys'](_0x264026[_0x05d2('0x2d')]);_0x5824b0[_0x05d2('0x2e')]=_[_0x05d2('0x2f')](_0x5824b0[_0x05d2('0x30')],_0x5824b0[_0x05d2('0x2d')]);_0x15e34f['attributes']=_[_0x05d2('0x2f')](_0x5824b0[_0x05d2('0x30')],qs[_0x05d2('0x31')](_0x264026[_0x05d2('0x2d')][_0x05d2('0x31')]));_0x15e34f[_0x05d2('0x32')]=_0x15e34f[_0x05d2('0x32')]['length']?_0x15e34f['attributes']:_0x5824b0[_0x05d2('0x30')];if(!_0x264026[_0x05d2('0x2d')][_0x05d2('0x33')](_0x05d2('0x34'))){_0x15e34f[_0x05d2('0x1d')]=qs[_0x05d2('0x1d')](_0x264026[_0x05d2('0x2d')][_0x05d2('0x1d')]);_0x15e34f[_0x05d2('0x1c')]=qs[_0x05d2('0x1c')](_0x264026[_0x05d2('0x2d')][_0x05d2('0x1c')]);}_0x15e34f['order']=qs[_0x05d2('0x35')](_0x264026[_0x05d2('0x2d')]['sort']);_0x15e34f[_0x05d2('0x36')]=qs[_0x05d2('0x2e')](_[_0x05d2('0x37')](_0x264026['query'],_0x5824b0[_0x05d2('0x2e')]));if(_0x264026[_0x05d2('0x2d')]['filter']){_0x15e34f[_0x05d2('0x36')]=_[_0x05d2('0x38')](_0x15e34f[_0x05d2('0x36')],{'$or':_['map'](_0x2715d8,function(_0x397b73){if(_0x397b73['type']!==_0x05d2('0x39')){var _0x391351={};_0x391351[_0x397b73[_0x05d2('0x26')]]={'$like':'%'+_0x264026[_0x05d2('0x2d')][_0x05d2('0x3a')]+'%'};return _0x391351;}})});}_0x15e34f=_[_0x05d2('0x38')]({},_0x15e34f,_0x264026[_0x05d2('0x3b')]);var _0xb78fdf={'where':_0x15e34f['where']};return db[_0x05d2('0x3c')][_0x05d2('0x1b')](_0xb78fdf)[_0x05d2('0x22')](function(_0x1e68c7){_0x1f4da2[_0x05d2('0x1b')]=_0x1e68c7;if(_0x264026['query'][_0x05d2('0x3d')]){_0x15e34f[_0x05d2('0x3e')]=[{'all':!![]}];}return db['UserProfileResource'][_0x05d2('0x3f')](_0x15e34f);})[_0x05d2('0x22')](function(_0x3afaa0){_0x1f4da2['rows']=_0x3afaa0;return _0x1f4da2;})[_0x05d2('0x22')](respondWithFilteredResult(_0x35260c,_0x15e34f))[_0x05d2('0x40')](handleError(_0x35260c,null));};exports[_0x05d2('0x41')]=function(_0xad1933,_0x1f5555){var _0x2d3e58={'raw':![],'where':{'id':_0xad1933[_0x05d2('0x42')]['id']}},_0x155443={};_0x155443[_0x05d2('0x30')]=_[_0x05d2('0x43')](db[_0x05d2('0x3c')]['rawAttributes']);_0x155443['query']=_[_0x05d2('0x43')](_0xad1933['query']);_0x155443[_0x05d2('0x2e')]=_[_0x05d2('0x2f')](_0x155443[_0x05d2('0x30')],_0x155443[_0x05d2('0x2d')]);_0x2d3e58[_0x05d2('0x32')]=_[_0x05d2('0x2f')](_0x155443[_0x05d2('0x30')],qs[_0x05d2('0x31')](_0xad1933['query'][_0x05d2('0x31')]));_0x2d3e58['attributes']=_0x2d3e58[_0x05d2('0x32')][_0x05d2('0x44')]?_0x2d3e58['attributes']:_0x155443['model'];if(_0xad1933['query'][_0x05d2('0x3d')]){_0x2d3e58[_0x05d2('0x3e')]=[{'all':!![]}];}_0x2d3e58=_[_0x05d2('0x38')]({},_0x2d3e58,_0xad1933[_0x05d2('0x3b')]);return db[_0x05d2('0x3c')][_0x05d2('0x45')](_0x2d3e58)[_0x05d2('0x22')](handleEntityNotFound(_0x1f5555,null))[_0x05d2('0x22')](respondWithResult(_0x1f5555,null))['catch'](handleError(_0x1f5555,null));};exports[_0x05d2('0x46')]=function(_0x2ec4c,_0x52c7fc){return db[_0x05d2('0x3c')][_0x05d2('0x46')](_0x2ec4c[_0x05d2('0x47')],{})['then'](respondWithResult(_0x52c7fc,0xc9))[_0x05d2('0x40')](handleError(_0x52c7fc,null));};exports[_0x05d2('0x48')]=function(_0x1804b2,_0x292af1){if(_0x1804b2[_0x05d2('0x47')]['id']){delete _0x1804b2[_0x05d2('0x47')]['id'];}return db[_0x05d2('0x3c')]['find']({'where':{'id':_0x1804b2['params']['id']}})[_0x05d2('0x22')](handleEntityNotFound(_0x292af1,null))[_0x05d2('0x22')](saveUpdates(_0x1804b2[_0x05d2('0x47')],null))['then'](respondWithResult(_0x292af1,null))['catch'](handleError(_0x292af1,null));};exports[_0x05d2('0x23')]=function(_0x453865,_0x5be2b1){return db[_0x05d2('0x3c')][_0x05d2('0x45')]({'where':{'id':_0x453865[_0x05d2('0x42')]['id']}})[_0x05d2('0x22')](handleEntityNotFound(_0x5be2b1,null))['then'](removeEntity(_0x5be2b1,null))[_0x05d2('0x40')](handleError(_0x5be2b1,null));};exports[_0x05d2('0x49')]=function(_0x398e19,_0x5991bf){return db['UserProfileResource'][_0x05d2('0x49')]()[_0x05d2('0x22')](respondWithResult(_0x5991bf,null))['catch'](handleError(_0x5991bf,null));}; \ No newline at end of file +var _0x0c8f=['status','end','json','count','offset','limit','set','apply','save','update','then','destroy','error','name','send','index','map','UserProfileResource','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','merge','VIRTUAL','filter','options','include','rows','catch','show','params','keys','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb'];(function(_0x310b92,_0x5b90bc){var _0x304a8f=function(_0x39a3ff){while(--_0x39a3ff){_0x310b92['push'](_0x310b92['shift']());}};_0x304a8f(++_0x5b90bc);}(_0x0c8f,0x1a5));var _0xf0c8=function(_0x2ca2bf,_0x342dea){_0x2ca2bf=_0x2ca2bf-0x0;var _0x3b9019=_0x0c8f[_0x2ca2bf];return _0x3b9019;};'use strict';var pdf=require(_0xf0c8('0x0'));var emlformat=require(_0xf0c8('0x1'));var rimraf=require(_0xf0c8('0x2'));var zipdir=require(_0xf0c8('0x3'));var jsonpatch=require(_0xf0c8('0x4'));var rp=require(_0xf0c8('0x5'));var moment=require(_0xf0c8('0x6'));var BPromise=require(_0xf0c8('0x7'));var Mustache=require(_0xf0c8('0x8'));var util=require(_0xf0c8('0x9'));var path=require(_0xf0c8('0xa'));var sox=require(_0xf0c8('0xb'));var csv=require(_0xf0c8('0xc'));var ejs=require(_0xf0c8('0xd'));var fs=require('fs');var _=require(_0xf0c8('0xe'));var squel=require(_0xf0c8('0xf'));var crypto=require(_0xf0c8('0x10'));var jsforce=require(_0xf0c8('0x11'));var deskjs=require(_0xf0c8('0x12'));var toCsv=require('to-csv');var querystring=require(_0xf0c8('0x13'));var Papa=require(_0xf0c8('0x14'));var Redis=require(_0xf0c8('0x15'));var authService=require(_0xf0c8('0x16'));var qs=require(_0xf0c8('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0c8('0x18'));var logger=require(_0xf0c8('0x19'))(_0xf0c8('0x1a'));var utils=require(_0xf0c8('0x1b'));var config=require('../../config/environment');var db=require(_0xf0c8('0x1c'))['db'];function respondWithStatusCode(_0x3271b8,_0x4e6ab3){_0x4e6ab3=_0x4e6ab3||0xcc;return function(_0x2a7763){if(_0x2a7763){return _0x3271b8['sendStatus'](_0x4e6ab3);}return _0x3271b8[_0xf0c8('0x1d')](_0x4e6ab3)[_0xf0c8('0x1e')]();};}function respondWithResult(_0x6ab72a,_0x2a0ced){_0x2a0ced=_0x2a0ced||0xc8;return function(_0xfa68f2){if(_0xfa68f2){return _0x6ab72a[_0xf0c8('0x1d')](_0x2a0ced)[_0xf0c8('0x1f')](_0xfa68f2);}};}function respondWithFilteredResult(_0xeb9ba0,_0x25cfce){return function(_0x5e3ff6){if(_0x5e3ff6){var _0x47da8b=_0x5e3ff6[_0xf0c8('0x20')],_0x5b149b=_0x25cfce[_0xf0c8('0x21')],_0x4d0657=_0x25cfce[_0xf0c8('0x21')]+_0x25cfce[_0xf0c8('0x22')],_0x5f0502;if(_0x4d0657>=_0x47da8b){_0x4d0657=_0x47da8b;_0x5f0502=0xc8;}else{_0x5f0502=0xce;}_0xeb9ba0['status'](_0x5f0502);return _0xeb9ba0[_0xf0c8('0x23')]('Content-Range',_0x5b149b+'-'+_0x4d0657+'/'+_0x47da8b)[_0xf0c8('0x1f')](_0x5e3ff6);}return null;};}function patchUpdates(_0xdb9187){return function(_0x271133){try{jsonpatch[_0xf0c8('0x24')](_0x271133,_0xdb9187,!![]);}catch(_0x2eb970){return BPromise['reject'](_0x2eb970);}return _0x271133[_0xf0c8('0x25')]();};}function saveUpdates(_0x2f9095,_0xd40247){return function(_0xa48484){if(_0xa48484){return _0xa48484[_0xf0c8('0x26')](_0x2f9095)[_0xf0c8('0x27')](function(_0x223566){return _0x223566;});}return null;};}function removeEntity(_0x40b40b,_0x244a96){return function(_0x223f1c){if(_0x223f1c){return _0x223f1c[_0xf0c8('0x28')]()[_0xf0c8('0x27')](function(){_0x40b40b[_0xf0c8('0x1d')](0xcc)[_0xf0c8('0x1e')]();});}};}function handleEntityNotFound(_0x348141,_0x4ba7fd){return function(_0x5c60f1){if(!_0x5c60f1){_0x348141['sendStatus'](0x194);}return _0x5c60f1;};}function handleError(_0x472685,_0x3e7718){_0x3e7718=_0x3e7718||0x1f4;return function(_0x3856ba){logger[_0xf0c8('0x29')](_0x3856ba['stack']);if(_0x3856ba[_0xf0c8('0x2a')]){delete _0x3856ba[_0xf0c8('0x2a')];}_0x472685['status'](_0x3e7718)[_0xf0c8('0x2b')](_0x3856ba);};}exports[_0xf0c8('0x2c')]=function(_0xe163a4,_0xf92fa6){var _0x2424a2={},_0x4f0658={},_0x5cae07={'count':0x0,'rows':[]};var _0x10f491=_[_0xf0c8('0x2d')](db[_0xf0c8('0x2e')][_0xf0c8('0x2f')],function(_0x41a44d){return{'name':_0x41a44d['fieldName'],'type':_0x41a44d[_0xf0c8('0x30')][_0xf0c8('0x31')]};});_0x4f0658[_0xf0c8('0x32')]=_[_0xf0c8('0x2d')](_0x10f491,_0xf0c8('0x2a'));_0x4f0658[_0xf0c8('0x33')]=_['keys'](_0xe163a4[_0xf0c8('0x33')]);_0x4f0658[_0xf0c8('0x34')]=_[_0xf0c8('0x35')](_0x4f0658[_0xf0c8('0x32')],_0x4f0658[_0xf0c8('0x33')]);_0x2424a2[_0xf0c8('0x36')]=_[_0xf0c8('0x35')](_0x4f0658['model'],qs[_0xf0c8('0x37')](_0xe163a4[_0xf0c8('0x33')]['fields']));_0x2424a2[_0xf0c8('0x36')]=_0x2424a2[_0xf0c8('0x36')][_0xf0c8('0x38')]?_0x2424a2[_0xf0c8('0x36')]:_0x4f0658[_0xf0c8('0x32')];if(!_0xe163a4[_0xf0c8('0x33')][_0xf0c8('0x39')]('nolimit')){_0x2424a2['limit']=qs[_0xf0c8('0x22')](_0xe163a4['query'][_0xf0c8('0x22')]);_0x2424a2[_0xf0c8('0x21')]=qs[_0xf0c8('0x21')](_0xe163a4['query']['offset']);}_0x2424a2[_0xf0c8('0x3a')]=qs['sort'](_0xe163a4[_0xf0c8('0x33')]['sort']);_0x2424a2['where']=qs[_0xf0c8('0x34')](_['pick'](_0xe163a4[_0xf0c8('0x33')],_0x4f0658[_0xf0c8('0x34')]));if(_0xe163a4[_0xf0c8('0x33')]['filter']){_0x2424a2[_0xf0c8('0x3b')]=_[_0xf0c8('0x3c')](_0x2424a2[_0xf0c8('0x3b')],{'$or':_[_0xf0c8('0x2d')](_0x10f491,function(_0x5de96a){if(_0x5de96a[_0xf0c8('0x30')]!==_0xf0c8('0x3d')){var _0x30e12a={};_0x30e12a[_0x5de96a[_0xf0c8('0x2a')]]={'$like':'%'+_0xe163a4['query'][_0xf0c8('0x3e')]+'%'};return _0x30e12a;}})});}_0x2424a2=_[_0xf0c8('0x3c')]({},_0x2424a2,_0xe163a4[_0xf0c8('0x3f')]);var _0x4976f5={'where':_0x2424a2[_0xf0c8('0x3b')]};return db[_0xf0c8('0x2e')]['count'](_0x4976f5)[_0xf0c8('0x27')](function(_0x3fcd1a){_0x5cae07[_0xf0c8('0x20')]=_0x3fcd1a;if(_0xe163a4[_0xf0c8('0x33')]['includeAll']){_0x2424a2[_0xf0c8('0x40')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x2424a2);})[_0xf0c8('0x27')](function(_0x7aa67a){_0x5cae07[_0xf0c8('0x41')]=_0x7aa67a;return _0x5cae07;})[_0xf0c8('0x27')](respondWithFilteredResult(_0xf92fa6,_0x2424a2))[_0xf0c8('0x42')](handleError(_0xf92fa6,null));};exports[_0xf0c8('0x43')]=function(_0x14d724,_0x3d2fef){var _0x5454ee={'raw':![],'where':{'id':_0x14d724[_0xf0c8('0x44')]['id']}},_0x31cd47={};_0x31cd47[_0xf0c8('0x32')]=_['keys'](db[_0xf0c8('0x2e')][_0xf0c8('0x2f')]);_0x31cd47[_0xf0c8('0x33')]=_[_0xf0c8('0x45')](_0x14d724['query']);_0x31cd47[_0xf0c8('0x34')]=_[_0xf0c8('0x35')](_0x31cd47['model'],_0x31cd47['query']);_0x5454ee[_0xf0c8('0x36')]=_['intersection'](_0x31cd47['model'],qs[_0xf0c8('0x37')](_0x14d724[_0xf0c8('0x33')][_0xf0c8('0x37')]));_0x5454ee[_0xf0c8('0x36')]=_0x5454ee[_0xf0c8('0x36')][_0xf0c8('0x38')]?_0x5454ee['attributes']:_0x31cd47[_0xf0c8('0x32')];if(_0x14d724[_0xf0c8('0x33')][_0xf0c8('0x46')]){_0x5454ee['include']=[{'all':!![]}];}_0x5454ee=_['merge']({},_0x5454ee,_0x14d724[_0xf0c8('0x3f')]);return db[_0xf0c8('0x2e')][_0xf0c8('0x47')](_0x5454ee)[_0xf0c8('0x27')](handleEntityNotFound(_0x3d2fef,null))['then'](respondWithResult(_0x3d2fef,null))[_0xf0c8('0x42')](handleError(_0x3d2fef,null));};exports[_0xf0c8('0x48')]=function(_0x335819,_0x5809aa){return db[_0xf0c8('0x2e')]['create'](_0x335819['body'],{})[_0xf0c8('0x27')](respondWithResult(_0x5809aa,0xc9))[_0xf0c8('0x42')](handleError(_0x5809aa,null));};exports[_0xf0c8('0x26')]=function(_0x2f6185,_0x6a4901){if(_0x2f6185[_0xf0c8('0x49')]['id']){delete _0x2f6185[_0xf0c8('0x49')]['id'];}return db[_0xf0c8('0x2e')][_0xf0c8('0x47')]({'where':{'id':_0x2f6185[_0xf0c8('0x44')]['id']}})[_0xf0c8('0x27')](handleEntityNotFound(_0x6a4901,null))['then'](saveUpdates(_0x2f6185[_0xf0c8('0x49')],null))[_0xf0c8('0x27')](respondWithResult(_0x6a4901,null))[_0xf0c8('0x42')](handleError(_0x6a4901,null));};exports[_0xf0c8('0x28')]=function(_0x34a39c,_0x475655){return db[_0xf0c8('0x2e')][_0xf0c8('0x47')]({'where':{'id':_0x34a39c[_0xf0c8('0x44')]['id']}})[_0xf0c8('0x27')](handleEntityNotFound(_0x475655,null))['then'](removeEntity(_0x475655,null))[_0xf0c8('0x42')](handleError(_0x475655,null));};exports[_0xf0c8('0x4a')]=function(_0x1cefb0,_0x535cd5){return db['UserProfileResource'][_0xf0c8('0x4a')]()['then'](respondWithResult(_0x535cd5,null))[_0xf0c8('0x42')](handleError(_0x535cd5,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 8f56afd..0ab6546 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 _0xde3d=['api','moment','request-promise','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','resourceId','sectionId','lodash'];(function(_0x36e7bb,_0x316e81){var _0x36f82b=function(_0x5cb735){while(--_0x5cb735){_0x36e7bb['push'](_0x36e7bb['shift']());}};_0x36f82b(++_0x316e81);}(_0xde3d,0x137));var _0xdde3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xde3d[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xdde3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdde3('0x1'));var moment=require(_0xdde3('0x2'));var BPromise=require('bluebird');var rp=require(_0xdde3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdde3('0x4'));var config=require(_0xdde3('0x5'));var attributes=require(_0xdde3('0x6'));module[_0xdde3('0x7')]=function(_0x56e82b,_0x47691e){return _0x56e82b[_0xdde3('0x8')](_0xdde3('0x9'),attributes,{'tableName':_0xdde3('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xdde3('0xb'),_0xdde3('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8e6=['user_profile_has_resources','compositeIndex','resourceId','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','define','UserProfileResource'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8e6,0x12e));var _0x6d8e=function(_0x50b6d0,_0x43f018){_0x50b6d0=_0x50b6d0-0x0;var _0x5ed418=_0xd8e6[_0x50b6d0];return _0x5ed418;};'use strict';var _=require(_0x6d8e('0x0'));var util=require(_0x6d8e('0x1'));var logger=require(_0x6d8e('0x2'))(_0x6d8e('0x3'));var moment=require('moment');var BPromise=require(_0x6d8e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d8e('0x5'));var rimraf=require(_0x6d8e('0x6'));var config=require(_0x6d8e('0x7'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x58f578,_0x443c97){return _0x58f578[_0x6d8e('0x8')](_0x6d8e('0x9'),attributes,{'tableName':_0x6d8e('0xa'),'paranoid':![],'indexes':[{'name':_0x6d8e('0xb'),'fields':[_0x6d8e('0xc'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 8eb4f3b..8dc4cac 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 _0xf141=['UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','info','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xf141,0xcf));var _0x1f14=function(_0xe54a5a,_0x5f4377){_0xe54a5a=_0xe54a5a-0x0;var _0x3cea78=_0xf141[_0xe54a5a];return _0x3cea78;};'use strict';var _=require('lodash');var util=require(_0x1f14('0x0'));var moment=require(_0x1f14('0x1'));var BPromise=require(_0x1f14('0x2'));var rs=require(_0x1f14('0x3'));var fs=require('fs');var Redis=require(_0x1f14('0x4'));var db=require(_0x1f14('0x5'))['db'];var utils=require(_0x1f14('0x6'));var logger=require(_0x1f14('0x7'))(_0x1f14('0x8'));var config=require(_0x1f14('0x9'));var jayson=require(_0x1f14('0xa'));var client=jayson[_0x1f14('0xb')][_0x1f14('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36923a,_0x301a09,_0x59651f){return new BPromise(function(_0x46265c,_0x218415){return client['request'](_0x36923a,_0x59651f)['then'](function(_0x39185d){logger['info'](_0x1f14('0xd'),_0x301a09,_0x1f14('0xe'));logger[_0x1f14('0xf')](_0x1f14('0x10'),_0x301a09,_0x1f14('0xe'),JSON['stringify'](_0x39185d));if(_0x39185d[_0x1f14('0x11')]){if(_0x39185d[_0x1f14('0x11')][_0x1f14('0x12')]===0x1f4){logger[_0x1f14('0x11')](_0x1f14('0xd'),_0x301a09,_0x39185d['error'][_0x1f14('0x13')]);return _0x218415(_0x39185d[_0x1f14('0x11')]['message']);}logger[_0x1f14('0x11')](_0x1f14('0xd'),_0x301a09,_0x39185d['error'][_0x1f14('0x13')]);return _0x46265c(_0x39185d[_0x1f14('0x11')][_0x1f14('0x13')]);}else{logger[_0x1f14('0x14')](_0x1f14('0xd'),_0x301a09,_0x1f14('0xe'));_0x46265c(_0x39185d[_0x1f14('0x15')][_0x1f14('0x13')]);}})['catch'](function(_0x1c96aa){logger[_0x1f14('0x11')](_0x1f14('0xd'),_0x301a09,_0x1c96aa);_0x218415(_0x1c96aa);});});} \ No newline at end of file +var _0x4908=['jayson/promise','client','http','request','info','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserProfileResource,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x4d216c,_0x363a80){var _0x36fe74=function(_0x460e09){while(--_0x460e09){_0x4d216c['push'](_0x4d216c['shift']());}};_0x36fe74(++_0x363a80);}(_0x4908,0x1c5));var _0x8490=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x4908[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0x8490('0x0'));var util=require(_0x8490('0x1'));var moment=require(_0x8490('0x2'));var BPromise=require(_0x8490('0x3'));var rs=require(_0x8490('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8490('0x5'))['db'];var utils=require(_0x8490('0x6'));var logger=require('../../config/logger')(_0x8490('0x7'));var config=require(_0x8490('0x8'));var jayson=require(_0x8490('0x9'));var client=jayson[_0x8490('0xa')][_0x8490('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3cc85e,_0x37b3c4,_0x545651){return new BPromise(function(_0x43b11d,_0x19cc71){return client[_0x8490('0xc')](_0x3cc85e,_0x545651)['then'](function(_0x419703){logger[_0x8490('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x37b3c4,'request\x20sent');logger['debug'](_0x8490('0xe'),_0x37b3c4,_0x8490('0xf'),JSON['stringify'](_0x419703));if(_0x419703[_0x8490('0x10')]){if(_0x419703[_0x8490('0x10')][_0x8490('0x11')]===0x1f4){logger[_0x8490('0x10')](_0x8490('0x12'),_0x37b3c4,_0x419703[_0x8490('0x10')][_0x8490('0x13')]);return _0x19cc71(_0x419703[_0x8490('0x10')]['message']);}logger[_0x8490('0x10')](_0x8490('0x12'),_0x37b3c4,_0x419703[_0x8490('0x10')]['message']);return _0x43b11d(_0x419703[_0x8490('0x10')][_0x8490('0x13')]);}else{logger[_0x8490('0xd')](_0x8490('0x12'),_0x37b3c4,'request\x20sent');_0x43b11d(_0x419703['result'][_0x8490('0x13')]);}})[_0x8490('0x14')](function(_0x34ca43){logger[_0x8490('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x37b3c4,_0x34ca43);_0x19cc71(_0x34ca43);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 034cbf2..91cd41f 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 _0xb2b4=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1c3b41,_0x50f776){var _0x41e3fe=function(_0x512069){while(--_0x512069){_0x1c3b41['push'](_0x1c3b41['shift']());}};_0x41e3fe(++_0x50f776);}(_0xb2b4,0x1b4));var _0x4b2b=function(_0x1e5068,_0x31e9c4){_0x1e5068=_0x1e5068-0x0;var _0x2230b6=_0xb2b4[_0x1e5068];return _0x2230b6;};'use strict';var multer=require(_0x4b2b('0x0'));var util=require(_0x4b2b('0x1'));var path=require(_0x4b2b('0x2'));var timeout=require(_0x4b2b('0x3'));var express=require('express');var router=express[_0x4b2b('0x4')]();var auth=require(_0x4b2b('0x5'));var interaction=require(_0x4b2b('0x6'));var config=require(_0x4b2b('0x7'));var controller=require('./userProfileSection.controller');router[_0x4b2b('0x8')]('/',auth[_0x4b2b('0x9')](),controller[_0x4b2b('0xa')]);router[_0x4b2b('0x8')](_0x4b2b('0xb'),auth[_0x4b2b('0x9')](),controller[_0x4b2b('0xc')]);router[_0x4b2b('0x8')](_0x4b2b('0xd'),auth[_0x4b2b('0x9')](),controller[_0x4b2b('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4b2b('0xf')]);router['put'](_0x4b2b('0xd'),auth['isAuthenticated'](),controller[_0x4b2b('0x10')]);router[_0x4b2b('0x11')](_0x4b2b('0xd'),auth['isAuthenticated'](),controller[_0x4b2b('0x12')]);module[_0x4b2b('0x13')]=router; \ No newline at end of file +var _0xf908=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfileSection.controller'];(function(_0x10d427,_0x39eb62){var _0x4ff197=function(_0x59eddd){while(--_0x59eddd){_0x10d427['push'](_0x10d427['shift']());}};_0x4ff197(++_0x39eb62);}(_0xf908,0x1b0));var _0x8f90=function(_0x3ba262,_0x311fed){_0x3ba262=_0x3ba262-0x0;var _0xbf36ff=_0xf908[_0x3ba262];return _0xbf36ff;};'use strict';var multer=require(_0x8f90('0x0'));var util=require(_0x8f90('0x1'));var path=require(_0x8f90('0x2'));var timeout=require(_0x8f90('0x3'));var express=require(_0x8f90('0x4'));var router=express[_0x8f90('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x8f90('0x6'));var config=require(_0x8f90('0x7'));var controller=require(_0x8f90('0x8'));router[_0x8f90('0x9')]('/',auth[_0x8f90('0xa')](),controller[_0x8f90('0xb')]);router[_0x8f90('0x9')](_0x8f90('0xc'),auth[_0x8f90('0xa')](),controller[_0x8f90('0xd')]);router[_0x8f90('0x9')](_0x8f90('0xe'),auth[_0x8f90('0xa')](),controller[_0x8f90('0xf')]);router[_0x8f90('0x10')]('/',auth['isAuthenticated'](),controller[_0x8f90('0x11')]);router[_0x8f90('0x12')](_0x8f90('0xe'),auth[_0x8f90('0xa')](),controller[_0x8f90('0x13')]);router['delete'](_0x8f90('0xe'),auth[_0x8f90('0xa')](),controller[_0x8f90('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index f91e379..60106a7 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 _0x40ca=['BOOLEAN','crudPermissions','getDataValue','split','sequelize','STRING','INTEGER'];(function(_0x3f0406,_0x3d338d){var _0x667f30=function(_0x5e5a7a){while(--_0x5e5a7a){_0x3f0406['push'](_0x3f0406['shift']());}};_0x667f30(++_0x3d338d);}(_0x40ca,0x1a1));var _0xa40c=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x40ca[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0xa40c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xa40c('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xa40c('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xa40c('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xa40c('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x11f66d){this['setDataValue'](_0xa40c('0x4'),_0x11f66d?_0x11f66d['join'](''):[]);},'get':function(){return this[_0xa40c('0x5')]('crudPermissions')?this[_0xa40c('0x5')](_0xa40c('0x4'))[_0xa40c('0x6')](''):[];}}}; \ No newline at end of file +var _0xb205=['sequelize','exports','STRING','INTEGER','setDataValue','crudPermissions','getDataValue','split'];(function(_0x39fa69,_0x4994b9){var _0x3460ce=function(_0x160686){while(--_0x160686){_0x39fa69['push'](_0x39fa69['shift']());}};_0x3460ce(++_0x4994b9);}(_0xb205,0xf0));var _0x5b20=function(_0x51b9ff,_0x3bac01){_0x51b9ff=_0x51b9ff-0x0;var _0x41581c=_0xb205[_0x51b9ff];return _0x41581c;};'use strict';var Sequelize=require(_0x5b20('0x0'));module[_0x5b20('0x1')]={'name':{'type':Sequelize[_0x5b20('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x5b20('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x5b20('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x5b20('0x2')],'set':function(_0x573200){this[_0x5b20('0x4')](_0x5b20('0x5'),_0x573200?_0x573200['join'](''):[]);},'get':function(){return this[_0x5b20('0x6')](_0x5b20('0x5'))?this[_0x5b20('0x6')]('crudPermissions')[_0x5b20('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 7cd7162..9bfc465 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 _0xf684=['sendStatus','end','status','json','count','offset','limit','set','Content-Range','save','then','error','stack','name','send','index','UserProfileSection','rawAttributes','fieldName','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','show','params','include','merge','create','body','catch','destroy','find','describe','html-pdf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x142c93,_0x479053){var _0xb9d62b=function(_0xc99b03){while(--_0xc99b03){_0x142c93['push'](_0x142c93['shift']());}};_0xb9d62b(++_0x479053);}(_0xf684,0xff));var _0x4f68=function(_0x50f1fc,_0x4a669d){_0x50f1fc=_0x50f1fc-0x0;var _0x4f91b5=_0xf684[_0x50f1fc];return _0x4f91b5;};'use strict';var pdf=require(_0x4f68('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4f68('0x1'));var jsonpatch=require(_0x4f68('0x2'));var rp=require(_0x4f68('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4f68('0x4'));var util=require(_0x4f68('0x5'));var path=require(_0x4f68('0x6'));var sox=require(_0x4f68('0x7'));var csv=require('to-csv');var ejs=require(_0x4f68('0x8'));var fs=require('fs');var _=require(_0x4f68('0x9'));var squel=require(_0x4f68('0xa'));var crypto=require(_0x4f68('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4f68('0xc'));var toCsv=require(_0x4f68('0xd'));var querystring=require(_0x4f68('0xe'));var Papa=require('papaparse');var Redis=require(_0x4f68('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f68('0x10'))(_0x4f68('0x11'));var utils=require(_0x4f68('0x12'));var config=require(_0x4f68('0x13'));var db=require(_0x4f68('0x14'))['db'];function respondWithStatusCode(_0x5233d4,_0x307e63){_0x307e63=_0x307e63||0xcc;return function(_0x2ab4dd){if(_0x2ab4dd){return _0x5233d4[_0x4f68('0x15')](_0x307e63);}return _0x5233d4['status'](_0x307e63)[_0x4f68('0x16')]();};}function respondWithResult(_0x394fca,_0x5167e8){_0x5167e8=_0x5167e8||0xc8;return function(_0x22c57f){if(_0x22c57f){return _0x394fca[_0x4f68('0x17')](_0x5167e8)[_0x4f68('0x18')](_0x22c57f);}};}function respondWithFilteredResult(_0x1ba013,_0xc993a1){return function(_0x5dc654){if(_0x5dc654){var _0x2e2c6a=_0x5dc654[_0x4f68('0x19')],_0x41c82a=_0xc993a1['offset'],_0x1ead8a=_0xc993a1[_0x4f68('0x1a')]+_0xc993a1[_0x4f68('0x1b')],_0x581069;if(_0x1ead8a>=_0x2e2c6a){_0x1ead8a=_0x2e2c6a;_0x581069=0xc8;}else{_0x581069=0xce;}_0x1ba013[_0x4f68('0x17')](_0x581069);return _0x1ba013[_0x4f68('0x1c')](_0x4f68('0x1d'),_0x41c82a+'-'+_0x1ead8a+'/'+_0x2e2c6a)[_0x4f68('0x18')](_0x5dc654);}return null;};}function patchUpdates(_0x51d7d5){return function(_0x1e14de){try{jsonpatch['apply'](_0x1e14de,_0x51d7d5,!![]);}catch(_0x572bd9){return BPromise['reject'](_0x572bd9);}return _0x1e14de[_0x4f68('0x1e')]();};}function saveUpdates(_0x1ea6e8,_0x10351c){return function(_0x40afda){if(_0x40afda){return _0x40afda['update'](_0x1ea6e8)[_0x4f68('0x1f')](function(_0x2649f0){return _0x2649f0;});}return null;};}function removeEntity(_0x45bd3f,_0x57bed4){return function(_0x936582){if(_0x936582){return _0x936582['destroy']()[_0x4f68('0x1f')](function(){_0x45bd3f[_0x4f68('0x17')](0xcc)[_0x4f68('0x16')]();});}};}function handleEntityNotFound(_0x12f079,_0x4c4802){return function(_0x4ce04f){if(!_0x4ce04f){_0x12f079[_0x4f68('0x15')](0x194);}return _0x4ce04f;};}function handleError(_0x13024c,_0x575607){_0x575607=_0x575607||0x1f4;return function(_0x2eb746){logger[_0x4f68('0x20')](_0x2eb746[_0x4f68('0x21')]);if(_0x2eb746[_0x4f68('0x22')]){delete _0x2eb746[_0x4f68('0x22')];}_0x13024c[_0x4f68('0x17')](_0x575607)[_0x4f68('0x23')](_0x2eb746);};}exports[_0x4f68('0x24')]=function(_0x1e4ca0,_0x4542cb){var _0x35d668={},_0x31a9bc={},_0xe16b5d={'count':0x0,'rows':[]};var _0x3e6fca=_['map'](db[_0x4f68('0x25')][_0x4f68('0x26')],function(_0xa1647b){return{'name':_0xa1647b[_0x4f68('0x27')],'type':_0xa1647b['type']['key']};});_0x31a9bc['model']=_[_0x4f68('0x28')](_0x3e6fca,'name');_0x31a9bc[_0x4f68('0x29')]=_[_0x4f68('0x2a')](_0x1e4ca0[_0x4f68('0x29')]);_0x31a9bc[_0x4f68('0x2b')]=_[_0x4f68('0x2c')](_0x31a9bc[_0x4f68('0x2d')],_0x31a9bc[_0x4f68('0x29')]);_0x35d668[_0x4f68('0x2e')]=_[_0x4f68('0x2c')](_0x31a9bc['model'],qs['fields'](_0x1e4ca0[_0x4f68('0x29')][_0x4f68('0x2f')]));_0x35d668[_0x4f68('0x2e')]=_0x35d668['attributes'][_0x4f68('0x30')]?_0x35d668[_0x4f68('0x2e')]:_0x31a9bc[_0x4f68('0x2d')];if(!_0x1e4ca0[_0x4f68('0x29')][_0x4f68('0x31')]('nolimit')){_0x35d668[_0x4f68('0x1b')]=qs[_0x4f68('0x1b')](_0x1e4ca0[_0x4f68('0x29')][_0x4f68('0x1b')]);_0x35d668['offset']=qs['offset'](_0x1e4ca0[_0x4f68('0x29')][_0x4f68('0x1a')]);}_0x35d668['order']=qs[_0x4f68('0x32')](_0x1e4ca0[_0x4f68('0x29')]['sort']);_0x35d668[_0x4f68('0x33')]=qs[_0x4f68('0x2b')](_[_0x4f68('0x34')](_0x1e4ca0[_0x4f68('0x29')],_0x31a9bc[_0x4f68('0x2b')]));if(_0x1e4ca0[_0x4f68('0x29')][_0x4f68('0x35')]){_0x35d668['where']=_['merge'](_0x35d668[_0x4f68('0x33')],{'$or':_['map'](_0x3e6fca,function(_0xc577d3){if(_0xc577d3['type']!==_0x4f68('0x36')){var _0x714fe6={};_0x714fe6[_0xc577d3[_0x4f68('0x22')]]={'$like':'%'+_0x1e4ca0[_0x4f68('0x29')][_0x4f68('0x35')]+'%'};return _0x714fe6;}})});}_0x35d668=_['merge']({},_0x35d668,_0x1e4ca0[_0x4f68('0x37')]);var _0x494a61={'where':_0x35d668[_0x4f68('0x33')]};return db[_0x4f68('0x25')]['count'](_0x494a61)['then'](function(_0x42213a){_0xe16b5d[_0x4f68('0x19')]=_0x42213a;if(_0x1e4ca0[_0x4f68('0x29')][_0x4f68('0x38')]){_0x35d668['include']=[{'all':!![]}];}return db[_0x4f68('0x25')][_0x4f68('0x39')](_0x35d668);})[_0x4f68('0x1f')](function(_0x37c7e3){_0xe16b5d[_0x4f68('0x3a')]=_0x37c7e3;return _0xe16b5d;})[_0x4f68('0x1f')](respondWithFilteredResult(_0x4542cb,_0x35d668))['catch'](handleError(_0x4542cb,null));};exports[_0x4f68('0x3b')]=function(_0x268d23,_0x3cf03a){var _0x441d00={'raw':![],'where':{'id':_0x268d23[_0x4f68('0x3c')]['id']}},_0x2234fd={};_0x2234fd['model']=_[_0x4f68('0x2a')](db['UserProfileSection']['rawAttributes']);_0x2234fd[_0x4f68('0x29')]=_[_0x4f68('0x2a')](_0x268d23[_0x4f68('0x29')]);_0x2234fd[_0x4f68('0x2b')]=_['intersection'](_0x2234fd[_0x4f68('0x2d')],_0x2234fd['query']);_0x441d00[_0x4f68('0x2e')]=_[_0x4f68('0x2c')](_0x2234fd[_0x4f68('0x2d')],qs['fields'](_0x268d23['query'][_0x4f68('0x2f')]));_0x441d00['attributes']=_0x441d00[_0x4f68('0x2e')][_0x4f68('0x30')]?_0x441d00[_0x4f68('0x2e')]:_0x2234fd['model'];if(_0x268d23['query']['includeAll']){_0x441d00[_0x4f68('0x3d')]=[{'all':!![]}];}_0x441d00=_[_0x4f68('0x3e')]({},_0x441d00,_0x268d23['options']);return db[_0x4f68('0x25')]['find'](_0x441d00)[_0x4f68('0x1f')](handleEntityNotFound(_0x3cf03a,null))['then'](respondWithResult(_0x3cf03a,null))['catch'](handleError(_0x3cf03a,null));};exports['create']=function(_0x38560f,_0x2021a6){return db[_0x4f68('0x25')][_0x4f68('0x3f')](_0x38560f[_0x4f68('0x40')],{})[_0x4f68('0x1f')](respondWithResult(_0x2021a6,0xc9))[_0x4f68('0x41')](handleError(_0x2021a6,null));};exports['update']=function(_0x1b7524,_0x4a67b6){if(_0x1b7524[_0x4f68('0x40')]['id']){delete _0x1b7524[_0x4f68('0x40')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x1b7524[_0x4f68('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4a67b6,null))[_0x4f68('0x1f')](saveUpdates(_0x1b7524['body'],null))['then'](respondWithResult(_0x4a67b6,null))[_0x4f68('0x41')](handleError(_0x4a67b6,null));};exports[_0x4f68('0x42')]=function(_0x310fbe,_0x5bec27){return db[_0x4f68('0x25')][_0x4f68('0x43')]({'where':{'id':_0x310fbe[_0x4f68('0x3c')]['id']}})['then'](handleEntityNotFound(_0x5bec27,null))[_0x4f68('0x1f')](removeEntity(_0x5bec27,null))[_0x4f68('0x41')](handleError(_0x5bec27,null));};exports[_0x4f68('0x44')]=function(_0x9a6900,_0x3983cc){return db[_0x4f68('0x25')][_0x4f68('0x44')]()[_0x4f68('0x1f')](respondWithResult(_0x3983cc,null))[_0x4f68('0x41')](handleError(_0x3983cc,null));}; \ No newline at end of file +var _0x4913=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','UserProfileSection','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','order','sort','where','filter','merge','options','include','rows','show','params','includeAll','catch','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x4cb54f,_0x1f48e3){var _0x5b7a30=function(_0x30b77e){while(--_0x30b77e){_0x4cb54f['push'](_0x4cb54f['shift']());}};_0x5b7a30(++_0x1f48e3);}(_0x4913,0x1d2));var _0x3491=function(_0x3ed38f,_0x507e86){_0x3ed38f=_0x3ed38f-0x0;var _0xc69794=_0x4913[_0x3ed38f];return _0xc69794;};'use strict';var pdf=require(_0x3491('0x0'));var emlformat=require(_0x3491('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3491('0x2'));var jsonpatch=require(_0x3491('0x3'));var rp=require(_0x3491('0x4'));var moment=require('moment');var BPromise=require(_0x3491('0x5'));var Mustache=require(_0x3491('0x6'));var util=require(_0x3491('0x7'));var path=require(_0x3491('0x8'));var sox=require(_0x3491('0x9'));var csv=require(_0x3491('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3491('0xb'));var squel=require(_0x3491('0xc'));var crypto=require(_0x3491('0xd'));var jsforce=require(_0x3491('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3491('0xa'));var querystring=require(_0x3491('0xf'));var Papa=require(_0x3491('0x10'));var Redis=require(_0x3491('0x11'));var authService=require(_0x3491('0x12'));var qs=require(_0x3491('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3491('0x14'));var logger=require('../../config/logger')(_0x3491('0x15'));var utils=require(_0x3491('0x16'));var config=require(_0x3491('0x17'));var db=require(_0x3491('0x18'))['db'];function respondWithStatusCode(_0x10f813,_0x275f52){_0x275f52=_0x275f52||0xcc;return function(_0x350e02){if(_0x350e02){return _0x10f813['sendStatus'](_0x275f52);}return _0x10f813[_0x3491('0x19')](_0x275f52)[_0x3491('0x1a')]();};}function respondWithResult(_0x153b44,_0x5e7638){_0x5e7638=_0x5e7638||0xc8;return function(_0x454417){if(_0x454417){return _0x153b44[_0x3491('0x19')](_0x5e7638)[_0x3491('0x1b')](_0x454417);}};}function respondWithFilteredResult(_0x4cf85f,_0x29295d){return function(_0x5c3b00){if(_0x5c3b00){var _0x45b81a=_0x5c3b00[_0x3491('0x1c')],_0x5eac49=_0x29295d[_0x3491('0x1d')],_0x5eb57c=_0x29295d[_0x3491('0x1d')]+_0x29295d[_0x3491('0x1e')],_0x5bd34d;if(_0x5eb57c>=_0x45b81a){_0x5eb57c=_0x45b81a;_0x5bd34d=0xc8;}else{_0x5bd34d=0xce;}_0x4cf85f[_0x3491('0x19')](_0x5bd34d);return _0x4cf85f[_0x3491('0x1f')](_0x3491('0x20'),_0x5eac49+'-'+_0x5eb57c+'/'+_0x45b81a)[_0x3491('0x1b')](_0x5c3b00);}return null;};}function patchUpdates(_0x55d812){return function(_0x354221){try{jsonpatch[_0x3491('0x21')](_0x354221,_0x55d812,!![]);}catch(_0xf029d8){return BPromise['reject'](_0xf029d8);}return _0x354221[_0x3491('0x22')]();};}function saveUpdates(_0x40d350,_0x4532c1){return function(_0x20d570){if(_0x20d570){return _0x20d570[_0x3491('0x23')](_0x40d350)[_0x3491('0x24')](function(_0x128ab1){return _0x128ab1;});}return null;};}function removeEntity(_0x561024,_0x122545){return function(_0x5a04f7){if(_0x5a04f7){return _0x5a04f7[_0x3491('0x25')]()['then'](function(){_0x561024[_0x3491('0x19')](0xcc)[_0x3491('0x1a')]();});}};}function handleEntityNotFound(_0x40d986,_0x579cc3){return function(_0x311369){if(!_0x311369){_0x40d986['sendStatus'](0x194);}return _0x311369;};}function handleError(_0x5f5932,_0x1f3b37){_0x1f3b37=_0x1f3b37||0x1f4;return function(_0x21c442){logger[_0x3491('0x26')](_0x21c442['stack']);if(_0x21c442[_0x3491('0x27')]){delete _0x21c442[_0x3491('0x27')];}_0x5f5932['status'](_0x1f3b37)[_0x3491('0x28')](_0x21c442);};}exports[_0x3491('0x29')]=function(_0x3f816c,_0x4350f4){var _0x1dd5e1={},_0x148872={},_0x27f34a={'count':0x0,'rows':[]};var _0x28456a=_[_0x3491('0x2a')](db[_0x3491('0x2b')][_0x3491('0x2c')],function(_0x4e89d4){return{'name':_0x4e89d4['fieldName'],'type':_0x4e89d4[_0x3491('0x2d')]['key']};});_0x148872[_0x3491('0x2e')]=_[_0x3491('0x2a')](_0x28456a,'name');_0x148872[_0x3491('0x2f')]=_[_0x3491('0x30')](_0x3f816c['query']);_0x148872[_0x3491('0x31')]=_[_0x3491('0x32')](_0x148872[_0x3491('0x2e')],_0x148872[_0x3491('0x2f')]);_0x1dd5e1[_0x3491('0x33')]=_['intersection'](_0x148872[_0x3491('0x2e')],qs['fields'](_0x3f816c['query'][_0x3491('0x34')]));_0x1dd5e1['attributes']=_0x1dd5e1[_0x3491('0x33')]['length']?_0x1dd5e1[_0x3491('0x33')]:_0x148872[_0x3491('0x2e')];if(!_0x3f816c['query']['hasOwnProperty']('nolimit')){_0x1dd5e1['limit']=qs[_0x3491('0x1e')](_0x3f816c[_0x3491('0x2f')][_0x3491('0x1e')]);_0x1dd5e1[_0x3491('0x1d')]=qs[_0x3491('0x1d')](_0x3f816c[_0x3491('0x2f')]['offset']);}_0x1dd5e1[_0x3491('0x35')]=qs[_0x3491('0x36')](_0x3f816c[_0x3491('0x2f')][_0x3491('0x36')]);_0x1dd5e1[_0x3491('0x37')]=qs[_0x3491('0x31')](_['pick'](_0x3f816c[_0x3491('0x2f')],_0x148872[_0x3491('0x31')]));if(_0x3f816c['query'][_0x3491('0x38')]){_0x1dd5e1['where']=_[_0x3491('0x39')](_0x1dd5e1[_0x3491('0x37')],{'$or':_[_0x3491('0x2a')](_0x28456a,function(_0x4b36de){if(_0x4b36de[_0x3491('0x2d')]!=='VIRTUAL'){var _0x33a94a={};_0x33a94a[_0x4b36de[_0x3491('0x27')]]={'$like':'%'+_0x3f816c[_0x3491('0x2f')]['filter']+'%'};return _0x33a94a;}})});}_0x1dd5e1=_['merge']({},_0x1dd5e1,_0x3f816c[_0x3491('0x3a')]);var _0xddc3a4={'where':_0x1dd5e1[_0x3491('0x37')]};return db[_0x3491('0x2b')][_0x3491('0x1c')](_0xddc3a4)[_0x3491('0x24')](function(_0x107d67){_0x27f34a[_0x3491('0x1c')]=_0x107d67;if(_0x3f816c[_0x3491('0x2f')]['includeAll']){_0x1dd5e1[_0x3491('0x3b')]=[{'all':!![]}];}return db[_0x3491('0x2b')]['findAll'](_0x1dd5e1);})[_0x3491('0x24')](function(_0x19aa69){_0x27f34a[_0x3491('0x3c')]=_0x19aa69;return _0x27f34a;})['then'](respondWithFilteredResult(_0x4350f4,_0x1dd5e1))['catch'](handleError(_0x4350f4,null));};exports[_0x3491('0x3d')]=function(_0x2174f8,_0x2267fa){var _0x116cad={'raw':![],'where':{'id':_0x2174f8[_0x3491('0x3e')]['id']}},_0x4b91d={};_0x4b91d[_0x3491('0x2e')]=_[_0x3491('0x30')](db[_0x3491('0x2b')]['rawAttributes']);_0x4b91d['query']=_[_0x3491('0x30')](_0x2174f8['query']);_0x4b91d[_0x3491('0x31')]=_[_0x3491('0x32')](_0x4b91d[_0x3491('0x2e')],_0x4b91d[_0x3491('0x2f')]);_0x116cad['attributes']=_[_0x3491('0x32')](_0x4b91d['model'],qs['fields'](_0x2174f8[_0x3491('0x2f')][_0x3491('0x34')]));_0x116cad['attributes']=_0x116cad[_0x3491('0x33')]['length']?_0x116cad[_0x3491('0x33')]:_0x4b91d[_0x3491('0x2e')];if(_0x2174f8[_0x3491('0x2f')][_0x3491('0x3f')]){_0x116cad['include']=[{'all':!![]}];}_0x116cad=_[_0x3491('0x39')]({},_0x116cad,_0x2174f8[_0x3491('0x3a')]);return db['UserProfileSection']['find'](_0x116cad)['then'](handleEntityNotFound(_0x2267fa,null))[_0x3491('0x24')](respondWithResult(_0x2267fa,null))[_0x3491('0x40')](handleError(_0x2267fa,null));};exports[_0x3491('0x41')]=function(_0x45e8d1,_0x39289d){return db[_0x3491('0x2b')][_0x3491('0x41')](_0x45e8d1['body'],{})[_0x3491('0x24')](respondWithResult(_0x39289d,0xc9))[_0x3491('0x40')](handleError(_0x39289d,null));};exports[_0x3491('0x23')]=function(_0x313a69,_0x240973){if(_0x313a69['body']['id']){delete _0x313a69[_0x3491('0x42')]['id'];}return db[_0x3491('0x2b')][_0x3491('0x43')]({'where':{'id':_0x313a69[_0x3491('0x3e')]['id']}})[_0x3491('0x24')](handleEntityNotFound(_0x240973,null))[_0x3491('0x24')](saveUpdates(_0x313a69['body'],null))['then'](respondWithResult(_0x240973,null))[_0x3491('0x40')](handleError(_0x240973,null));};exports[_0x3491('0x25')]=function(_0x542e29,_0xb70d07){return db[_0x3491('0x2b')][_0x3491('0x43')]({'where':{'id':_0x542e29[_0x3491('0x3e')]['id']}})['then'](handleEntityNotFound(_0xb70d07,null))['then'](removeEntity(_0xb70d07,null))[_0x3491('0x40')](handleError(_0xb70d07,null));};exports[_0x3491('0x44')]=function(_0x399252,_0xaa8c66){return db['UserProfileSection'][_0x3491('0x44')]()[_0x3491('0x24')](respondWithResult(_0xaa8c66,null))[_0x3491('0x40')](handleError(_0xaa8c66,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 9899a75..425ce33 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 _0x9db7=['user_profile_has_sections','userProfileId','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection'];(function(_0x4a53e5,_0xc703ce){var _0x44597a=function(_0x225eea){while(--_0x225eea){_0x4a53e5['push'](_0x4a53e5['shift']());}};_0x44597a(++_0xc703ce);}(_0x9db7,0x176));var _0x79db=function(_0x1c8f5f,_0x257e11){_0x1c8f5f=_0x1c8f5f-0x0;var _0x202063=_0x9db7[_0x1c8f5f];return _0x202063;};'use strict';var _=require('lodash');var util=require(_0x79db('0x0'));var logger=require(_0x79db('0x1'))('api');var moment=require(_0x79db('0x2'));var BPromise=require(_0x79db('0x3'));var rp=require(_0x79db('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x79db('0x5'));var attributes=require(_0x79db('0x6'));module[_0x79db('0x7')]=function(_0x21c2e8,_0x5ece38){return _0x21c2e8[_0x79db('0x8')](_0x79db('0x9'),attributes,{'tableName':_0x79db('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0x79db('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc3a6=['define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileSection.attributes','exports'];(function(_0x322a06,_0x1b38eb){var _0x109686=function(_0x304bc5){while(--_0x304bc5){_0x322a06['push'](_0x322a06['shift']());}};_0x109686(++_0x1b38eb);}(_0xc3a6,0x116));var _0x6c3a=function(_0x20f60b,_0x3d4649){_0x20f60b=_0x20f60b-0x0;var _0x42c65c=_0xc3a6[_0x20f60b];return _0x42c65c;};'use strict';var _=require(_0x6c3a('0x0'));var util=require('util');var logger=require(_0x6c3a('0x1'))(_0x6c3a('0x2'));var moment=require(_0x6c3a('0x3'));var BPromise=require(_0x6c3a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c3a('0x5'));var rimraf=require(_0x6c3a('0x6'));var config=require(_0x6c3a('0x7'));var attributes=require(_0x6c3a('0x8'));module[_0x6c3a('0x9')]=function(_0x65b400,_0x543cc9){return _0x65b400[_0x6c3a('0xa')](_0x6c3a('0xb'),attributes,{'tableName':_0x6c3a('0xc'),'paranoid':![],'indexes':[{'name':_0x6c3a('0xd'),'fields':[_0x6c3a('0xe'),_0x6c3a('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index d7efa86..3ef2aec 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 _0x8fa6=['stringify','error','code','message','result','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2637ac,_0x377857){var _0x4a5758=function(_0x5d5043){while(--_0x5d5043){_0x2637ac['push'](_0x2637ac['shift']());}};_0x4a5758(++_0x377857);}(_0x8fa6,0x8a));var _0x68fa=function(_0x40572a,_0x322d3b){_0x40572a=_0x40572a-0x0;var _0x40c524=_0x8fa6[_0x40572a];return _0x40c524;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x68fa('0x0'));var BPromise=require('bluebird');var rs=require(_0x68fa('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x68fa('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x68fa('0x3'))('rpc');var config=require(_0x68fa('0x4'));var jayson=require(_0x68fa('0x5'));var client=jayson[_0x68fa('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1000f1,_0x53f109,_0x4ee85b){return new BPromise(function(_0x3091a3,_0x416475){return client[_0x68fa('0x7')](_0x1000f1,_0x4ee85b)[_0x68fa('0x8')](function(_0x65b910){logger[_0x68fa('0x9')](_0x68fa('0xa'),_0x53f109,'request\x20sent');logger[_0x68fa('0xb')](_0x68fa('0xc'),_0x53f109,_0x68fa('0xd'),JSON[_0x68fa('0xe')](_0x65b910));if(_0x65b910['error']){if(_0x65b910[_0x68fa('0xf')][_0x68fa('0x10')]===0x1f4){logger[_0x68fa('0xf')](_0x68fa('0xa'),_0x53f109,_0x65b910['error']['message']);return _0x416475(_0x65b910['error']['message']);}logger[_0x68fa('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x53f109,_0x65b910['error'][_0x68fa('0x11')]);return _0x3091a3(_0x65b910[_0x68fa('0xf')][_0x68fa('0x11')]);}else{logger[_0x68fa('0x9')](_0x68fa('0xa'),_0x53f109,_0x68fa('0xd'));_0x3091a3(_0x65b910[_0x68fa('0x12')][_0x68fa('0x11')]);}})['catch'](function(_0x55e2de){logger[_0x68fa('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x53f109,_0x55e2de);_0x416475(_0x55e2de);});});} \ No newline at end of file +var _0x86ce=['http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x2493f7,_0x49c670){var _0x594ab2=function(_0x344ec2){while(--_0x344ec2){_0x2493f7['push'](_0x2493f7['shift']());}};_0x594ab2(++_0x49c670);}(_0x86ce,0xbc));var _0xe86c=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x86ce[_0x521929];return _0x632436;};'use strict';var _=require(_0xe86c('0x0'));var util=require(_0xe86c('0x1'));var moment=require(_0xe86c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe86c('0x3'));var db=require(_0xe86c('0x4'))['db'];var utils=require(_0xe86c('0x5'));var logger=require('../../config/logger')(_0xe86c('0x6'));var config=require(_0xe86c('0x7'));var jayson=require(_0xe86c('0x8'));var client=jayson[_0xe86c('0x9')][_0xe86c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x563ecf,_0x4dd34f,_0x5566ec){return new BPromise(function(_0x534f58,_0x4b9e75){return client[_0xe86c('0xb')](_0x563ecf,_0x5566ec)[_0xe86c('0xc')](function(_0x55be4b){logger[_0xe86c('0xd')](_0xe86c('0xe'),_0x4dd34f,_0xe86c('0xf'));logger[_0xe86c('0x10')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x4dd34f,_0xe86c('0xf'),JSON[_0xe86c('0x11')](_0x55be4b));if(_0x55be4b[_0xe86c('0x12')]){if(_0x55be4b[_0xe86c('0x12')]['code']===0x1f4){logger['error'](_0xe86c('0xe'),_0x4dd34f,_0x55be4b[_0xe86c('0x12')][_0xe86c('0x13')]);return _0x4b9e75(_0x55be4b[_0xe86c('0x12')]['message']);}logger[_0xe86c('0x12')](_0xe86c('0xe'),_0x4dd34f,_0x55be4b[_0xe86c('0x12')][_0xe86c('0x13')]);return _0x534f58(_0x55be4b[_0xe86c('0x12')][_0xe86c('0x13')]);}else{logger[_0xe86c('0xd')](_0xe86c('0xe'),_0x4dd34f,'request\x20sent');_0x534f58(_0x55be4b[_0xe86c('0x14')][_0xe86c('0x13')]);}})[_0xe86c('0x15')](function(_0x3c3498){logger[_0xe86c('0x12')](_0xe86c('0xe'),_0x4dd34f,_0x3c3498);_0x4b9e75(_0x3c3498);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 06c3ac1..2204a3b 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 _0x5ce1=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout','Router'];(function(_0x4d77b8,_0x208e64){var _0x82da62=function(_0x30f96){while(--_0x30f96){_0x4d77b8['push'](_0x4d77b8['shift']());}};_0x82da62(++_0x208e64);}(_0x5ce1,0xd4));var _0x15ce=function(_0x1c986e,_0x9589fe){_0x1c986e=_0x1c986e-0x0;var _0x5c5c38=_0x5ce1[_0x1c986e];return _0x5c5c38;};'use strict';var multer=require('multer');var util=require(_0x15ce('0x0'));var path=require(_0x15ce('0x1'));var timeout=require(_0x15ce('0x2'));var express=require('express');var router=express[_0x15ce('0x3')]();var auth=require(_0x15ce('0x4'));var interaction=require(_0x15ce('0x5'));var config=require(_0x15ce('0x6'));module[_0x15ce('0x7')]=router; \ No newline at end of file +var _0x3630=['../../components/interaction/service','../../config/environment','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x57c4ff,_0x102e4e){var _0x21649c=function(_0x5a4fa9){while(--_0x5a4fa9){_0x57c4ff['push'](_0x57c4ff['shift']());}};_0x21649c(++_0x102e4e);}(_0x3630,0x66));var _0x0363=function(_0x303ef7,_0x3a976a){_0x303ef7=_0x303ef7-0x0;var _0x538606=_0x3630[_0x303ef7];return _0x538606;};'use strict';var multer=require(_0x0363('0x0'));var util=require('util');var path=require(_0x0363('0x1'));var timeout=require(_0x0363('0x2'));var express=require(_0x0363('0x3'));var router=express[_0x0363('0x4')]();var auth=require(_0x0363('0x5'));var interaction=require(_0x0363('0x6'));var config=require(_0x0363('0x7'));module[_0x0363('0x8')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 7d70239..003f49e 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 _0xbaf0=['exports','INTEGER'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x22f286,_0x53b3c5){var _0x41b9aa=function(_0x2b0553){while(--_0x2b0553){_0x22f286['push'](_0x22f286['shift']());}};_0x41b9aa(++_0x53b3c5);}(_0xe706,0xa3));var _0x6e70=function(_0x836465,_0x5442ae){_0x836465=_0x836465-0x0;var _0x2150ea=_0xe706[_0x836465];return _0x2150ea;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 10b0d03..7ce81fd 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 _0x7723=['define','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x1e0ca5,_0x57fd4f){var _0x410923=function(_0x5bd94d){while(--_0x5bd94d){_0x1e0ca5['push'](_0x1e0ca5['shift']());}};_0x410923(++_0x57fd4f);}(_0x7723,0x88));var _0x3772=function(_0x1f0f9d,_0x59d25e){_0x1f0f9d=_0x1f0f9d-0x0;var _0x4e1d78=_0x7723[_0x1f0f9d];return _0x4e1d78;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3772('0x0'))(_0x3772('0x1'));var moment=require('moment');var BPromise=require(_0x3772('0x2'));var rp=require(_0x3772('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3772('0x4'));var config=require(_0x3772('0x5'));var attributes=require(_0x3772('0x6'));module[_0x3772('0x7')]=function(_0x55f433,_0xc5834d){return _0x55f433[_0x3772('0x8')]('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa98=['request-promise','path','rimraf','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','util','../../config/logger','api'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xfa98,0x104));var _0x8fa9=function(_0x1a9d04,_0x2cc514){_0x1a9d04=_0x1a9d04-0x0;var _0x21b065=_0xfa98[_0x1a9d04];return _0x21b065;};'use strict';var _=require(_0x8fa9('0x0'));var util=require(_0x8fa9('0x1'));var logger=require(_0x8fa9('0x2'))(_0x8fa9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8fa9('0x4'));var fs=require('fs');var path=require(_0x8fa9('0x5'));var rimraf=require(_0x8fa9('0x6'));var config=require('../../config/environment');var attributes=require(_0x8fa9('0x7'));module[_0x8fa9('0x8')]=function(_0x4d9703,_0xba973d){return _0x4d9703[_0x8fa9('0x9')]('UserSmsQueue',attributes,{'tableName':_0x8fa9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 6844e99..8938965 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 _0xd6d3=['request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x286673,_0x1ac38a){var _0x39a02b=function(_0x5e8cf6){while(--_0x5e8cf6){_0x286673['push'](_0x286673['shift']());}};_0x39a02b(++_0x1ac38a);}(_0xd6d3,0xbb));var _0x3d6d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd6d3[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x3d6d('0x0'));var moment=require(_0x3d6d('0x1'));var BPromise=require(_0x3d6d('0x2'));var rs=require(_0x3d6d('0x3'));var fs=require('fs');var Redis=require(_0x3d6d('0x4'));var db=require(_0x3d6d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3d6d('0x6'))(_0x3d6d('0x7'));var config=require('../../config/environment');var jayson=require(_0x3d6d('0x8'));var client=jayson[_0x3d6d('0x9')][_0x3d6d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x438bd4,_0x4a265e,_0x1e81f7){return new BPromise(function(_0x2f65a,_0x1e946d){return client[_0x3d6d('0xb')](_0x438bd4,_0x1e81f7)[_0x3d6d('0xc')](function(_0x4b77b1){logger[_0x3d6d('0xd')](_0x3d6d('0xe'),_0x4a265e,_0x3d6d('0xf'));logger['debug'](_0x3d6d('0x10'),_0x4a265e,_0x3d6d('0xf'),JSON[_0x3d6d('0x11')](_0x4b77b1));if(_0x4b77b1[_0x3d6d('0x12')]){if(_0x4b77b1['error']['code']===0x1f4){logger[_0x3d6d('0x12')](_0x3d6d('0xe'),_0x4a265e,_0x4b77b1[_0x3d6d('0x12')][_0x3d6d('0x13')]);return _0x1e946d(_0x4b77b1[_0x3d6d('0x12')][_0x3d6d('0x13')]);}logger[_0x3d6d('0x12')](_0x3d6d('0xe'),_0x4a265e,_0x4b77b1[_0x3d6d('0x12')][_0x3d6d('0x13')]);return _0x2f65a(_0x4b77b1[_0x3d6d('0x12')][_0x3d6d('0x13')]);}else{logger[_0x3d6d('0xd')](_0x3d6d('0xe'),_0x4a265e,_0x3d6d('0xf'));_0x2f65a(_0x4b77b1[_0x3d6d('0x14')][_0x3d6d('0x13')]);}})[_0x3d6d('0x15')](function(_0x39103f){logger[_0x3d6d('0x12')](_0x3d6d('0xe'),_0x4a265e,_0x39103f);_0x1e946d(_0x39103f);});});} \ No newline at end of file +var _0x505c=['jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserSmsQueue,\x20%s,\x20%s','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x2ba425,_0x58d262){var _0x5dee4f=function(_0x4f74a6){while(--_0x4f74a6){_0x2ba425['push'](_0x2ba425['shift']());}};_0x5dee4f(++_0x58d262);}(_0x505c,0x1be));var _0xc505=function(_0x15411f,_0x42bef8){_0x15411f=_0x15411f-0x0;var _0x555650=_0x505c[_0x15411f];return _0x555650;};'use strict';var _=require(_0xc505('0x0'));var util=require(_0xc505('0x1'));var moment=require(_0xc505('0x2'));var BPromise=require(_0xc505('0x3'));var rs=require(_0xc505('0x4'));var fs=require('fs');var Redis=require(_0xc505('0x5'));var db=require(_0xc505('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc505('0x7'))(_0xc505('0x8'));var config=require(_0xc505('0x9'));var jayson=require(_0xc505('0xa'));var client=jayson[_0xc505('0xb')][_0xc505('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3063c2,_0x20576a,_0x136150){return new BPromise(function(_0x433581,_0x23206f){return client[_0xc505('0xd')](_0x3063c2,_0x136150)[_0xc505('0xe')](function(_0x5eb268){logger[_0xc505('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x20576a,'request\x20sent');logger['debug'](_0xc505('0x10'),_0x20576a,'request\x20sent',JSON[_0xc505('0x11')](_0x5eb268));if(_0x5eb268[_0xc505('0x12')]){if(_0x5eb268[_0xc505('0x12')][_0xc505('0x13')]===0x1f4){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x20576a,_0x5eb268[_0xc505('0x12')][_0xc505('0x14')]);return _0x23206f(_0x5eb268[_0xc505('0x12')][_0xc505('0x14')]);}logger[_0xc505('0x12')](_0xc505('0x15'),_0x20576a,_0x5eb268[_0xc505('0x12')][_0xc505('0x14')]);return _0x433581(_0x5eb268['error'][_0xc505('0x14')]);}else{logger[_0xc505('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x20576a,_0xc505('0x16'));_0x433581(_0x5eb268[_0xc505('0x17')][_0xc505('0x14')]);}})['catch'](function(_0x4b50ec){logger[_0xc505('0x12')](_0xc505('0x15'),_0x20576a,_0x4b50ec);_0x23206f(_0x4b50ec);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index feb5bdb..e811661 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 _0x43c2=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x28d87c,_0x2bd17b){var _0x208681=function(_0x47fa4a){while(--_0x47fa4a){_0x28d87c['push'](_0x28d87c['shift']());}};_0x208681(++_0x2bd17b);}(_0x43c2,0x1e7));var _0x243c=function(_0x1eb5fd,_0x53bc5e){_0x1eb5fd=_0x1eb5fd-0x0;var _0x1b7650=_0x43c2[_0x1eb5fd];return _0x1b7650;};'use strict';var multer=require(_0x243c('0x0'));var util=require(_0x243c('0x1'));var path=require(_0x243c('0x2'));var timeout=require(_0x243c('0x3'));var express=require(_0x243c('0x4'));var router=express[_0x243c('0x5')]();var auth=require(_0x243c('0x6'));var interaction=require(_0x243c('0x7'));var config=require(_0x243c('0x8'));module[_0x243c('0x9')]=router; \ No newline at end of file +var _0xfb80=['../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout','express','Router'];(function(_0x3520ab,_0x4910f5){var _0x19fd8f=function(_0x4fb71b){while(--_0x4fb71b){_0x3520ab['push'](_0x3520ab['shift']());}};_0x19fd8f(++_0x4910f5);}(_0xfb80,0x1f2));var _0x0fb8=function(_0x23546c,_0x298e5e){_0x23546c=_0x23546c-0x0;var _0x534c79=_0xfb80[_0x23546c];return _0x534c79;};'use strict';var multer=require(_0x0fb8('0x0'));var util=require(_0x0fb8('0x1'));var path=require(_0x0fb8('0x2'));var timeout=require(_0x0fb8('0x3'));var express=require(_0x0fb8('0x4'));var router=express[_0x0fb8('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0fb8('0x6'));var config=require(_0x0fb8('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 6013725..5cd3065 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x41842f,_0x1efd4b){var _0x214ca3=function(_0x3d08f6){while(--_0x3d08f6){_0x41842f['push'](_0x41842f['shift']());}};_0x214ca3(++_0x1efd4b);}(_0xe706,0xa3));var _0x6e70=function(_0x4279e1,_0x39cda4){_0x4279e1=_0x4279e1-0x0;var _0x1e33ea=_0xe706[_0x4279e1];return _0x1e33ea;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x258196,_0x235f4e){var _0x3df790=function(_0x344d50){while(--_0x344d50){_0x258196['push'](_0x258196['shift']());}};_0x3df790(++_0x235f4e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index bfc96b8..e2b745c 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 _0xf3cd=['path','rimraf','../../config/environment','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4ac724,_0x417652){var _0x1752af=function(_0x687d6d){while(--_0x687d6d){_0x4ac724['push'](_0x4ac724['shift']());}};_0x1752af(++_0x417652);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xf3cd[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./userVoiceQueue.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda55=['util','moment','bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues','lodash'];(function(_0x54b643,_0x10f0d9){var _0x595525=function(_0x1a6162){while(--_0x1a6162){_0x54b643['push'](_0x54b643['shift']());}};_0x595525(++_0x10f0d9);}(_0xda55,0x6d));var _0x5da5=function(_0x5bb85c,_0x2a41da){_0x5bb85c=_0x5bb85c-0x0;var _0x180e0b=_0xda55[_0x5bb85c];return _0x180e0b;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5da5('0x2'));var BPromise=require(_0x5da5('0x3'));var rp=require(_0x5da5('0x4'));var fs=require('fs');var path=require(_0x5da5('0x5'));var rimraf=require(_0x5da5('0x6'));var config=require('../../config/environment');var attributes=require(_0x5da5('0x7'));module['exports']=function(_0x356a37,_0x58e7b3){return _0x356a37[_0x5da5('0x8')](_0x5da5('0x9'),attributes,{'tableName':_0x5da5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 8731567..13466a8 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 _0x40da=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserVoiceQueue,\x20%s,\x20%s','message','info','result','catch','lodash','bluebird','../../config/logger','../../config/environment','client','http','then','debug'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x40da,0xb3));var _0xa40d=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x40da[_0x2064e5];return _0x21a233;};'use strict';var _=require(_0xa40d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa40d('0x1'));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(_0xa40d('0x2'))('rpc');var config=require(_0xa40d('0x3'));var jayson=require('jayson/promise');var client=jayson[_0xa40d('0x4')][_0xa40d('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x50ef67,_0x37f37b,_0x43173e){return new BPromise(function(_0x2fda08,_0x49b3c6){return client['request'](_0x50ef67,_0x43173e)[_0xa40d('0x6')](function(_0x187685){logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x37f37b,'request\x20sent');logger[_0xa40d('0x7')](_0xa40d('0x8'),_0x37f37b,_0xa40d('0x9'),JSON['stringify'](_0x187685));if(_0x187685['error']){if(_0x187685[_0xa40d('0xa')][_0xa40d('0xb')]===0x1f4){logger[_0xa40d('0xa')](_0xa40d('0xc'),_0x37f37b,_0x187685[_0xa40d('0xa')][_0xa40d('0xd')]);return _0x49b3c6(_0x187685['error'][_0xa40d('0xd')]);}logger[_0xa40d('0xa')](_0xa40d('0xc'),_0x37f37b,_0x187685[_0xa40d('0xa')]['message']);return _0x2fda08(_0x187685['error']['message']);}else{logger[_0xa40d('0xe')](_0xa40d('0xc'),_0x37f37b,_0xa40d('0x9'));_0x2fda08(_0x187685[_0xa40d('0xf')][_0xa40d('0xd')]);}})[_0xa40d('0x10')](function(_0xc848ec){logger[_0xa40d('0xa')](_0xa40d('0xc'),_0x37f37b,_0xc848ec);_0x49b3c6(_0xc848ec);});});} \ No newline at end of file +var _0xad50=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x119b3e,_0x588d50){var _0x1169ae=function(_0x377422){while(--_0x377422){_0x119b3e['push'](_0x119b3e['shift']());}};_0x1169ae(++_0x588d50);}(_0xad50,0x1e3));var _0x0ad5=function(_0x38eb23,_0x196e8b){_0x38eb23=_0x38eb23-0x0;var _0x48506a=_0xad50[_0x38eb23];return _0x48506a;};'use strict';var _=require(_0x0ad5('0x0'));var util=require('util');var moment=require(_0x0ad5('0x1'));var BPromise=require(_0x0ad5('0x2'));var rs=require(_0x0ad5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ad5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ad5('0x5'))(_0x0ad5('0x6'));var config=require(_0x0ad5('0x7'));var jayson=require(_0x0ad5('0x8'));var client=jayson[_0x0ad5('0x9')][_0x0ad5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16ae3b,_0x40e7d2,_0x25a9a6){return new BPromise(function(_0x1c5de0,_0x1207a6){return client[_0x0ad5('0xb')](_0x16ae3b,_0x25a9a6)[_0x0ad5('0xc')](function(_0x3dd40f){logger[_0x0ad5('0xd')](_0x0ad5('0xe'),_0x40e7d2,_0x0ad5('0xf'));logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x40e7d2,'request\x20sent',JSON[_0x0ad5('0x10')](_0x3dd40f));if(_0x3dd40f[_0x0ad5('0x11')]){if(_0x3dd40f[_0x0ad5('0x11')][_0x0ad5('0x12')]===0x1f4){logger[_0x0ad5('0x11')](_0x0ad5('0xe'),_0x40e7d2,_0x3dd40f[_0x0ad5('0x11')]['message']);return _0x1207a6(_0x3dd40f['error'][_0x0ad5('0x13')]);}logger[_0x0ad5('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x40e7d2,_0x3dd40f[_0x0ad5('0x11')][_0x0ad5('0x13')]);return _0x1c5de0(_0x3dd40f[_0x0ad5('0x11')]['message']);}else{logger['info'](_0x0ad5('0xe'),_0x40e7d2,_0x0ad5('0xf'));_0x1c5de0(_0x3dd40f['result'][_0x0ad5('0x13')]);}})[_0x0ad5('0x14')](function(_0x3f9e19){logger[_0x0ad5('0x11')](_0x0ad5('0xe'),_0x40e7d2,_0x3f9e19);_0x1207a6(_0x3f9e19);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index e33dcac..01903ed 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 _0x75d4=['../../config/environment','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x75d4,0x1a1));var _0x475d=function(_0x41bc01,_0x268525){_0x41bc01=_0x41bc01-0x0;var _0x5aefb2=_0x75d4[_0x41bc01];return _0x5aefb2;};'use strict';var multer=require(_0x475d('0x0'));var util=require(_0x475d('0x1'));var path=require(_0x475d('0x2'));var timeout=require('connect-timeout');var express=require(_0x475d('0x3'));var router=express[_0x475d('0x4')]();var auth=require(_0x475d('0x5'));var interaction=require(_0x475d('0x6'));var config=require(_0x475d('0x7'));module['exports']=router; \ No newline at end of file +var _0x96fa=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x96fa,0x167));var _0xa96f=function(_0xfa436f,_0x5a2e94){_0xfa436f=_0xfa436f-0x0;var _0x5f07d0=_0x96fa[_0xfa436f];return _0x5f07d0;};'use strict';var multer=require('multer');var util=require(_0xa96f('0x0'));var path=require(_0xa96f('0x1'));var timeout=require(_0xa96f('0x2'));var express=require(_0xa96f('0x3'));var router=express[_0xa96f('0x4')]();var auth=require(_0xa96f('0x5'));var interaction=require(_0xa96f('0x6'));var config=require(_0xa96f('0x7'));module[_0xa96f('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 7a3d0b4..76b6834 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 _0xabdc=['sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0xed4881,_0x45771c){var _0x7fcbd5=function(_0x36b960){while(--_0x36b960){_0xed4881['push'](_0xed4881['shift']());}};_0x7fcbd5(++_0x45771c);}(_0xabdc,0x168));var _0xcabd=function(_0x3dd01c,_0x1537f9){_0x3dd01c=_0x3dd01c-0x0;var _0x431868=_0xabdc[_0x3dd01c];return _0x431868;};'use strict';var Sequelize=require(_0xcabd('0x0'));module[_0xcabd('0x1')]={'uniqueid':{'type':Sequelize[_0xcabd('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xcabd('0x3')},'UserId':{'type':Sequelize[_0xcabd('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xcabd('0x4')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xcabd('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xcabd('0x4')],'allowNull':![],'unique':_0xcabd('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xcabd('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xcabd('0x2')](0xb),'defaultValue':0x0,'comment':_0xcabd('0x3')}}; \ No newline at end of file +var _0xfbcb=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports','INTEGER'];(function(_0x4fd701,_0x4dd637){var _0xb61e42=function(_0x56eff4){while(--_0x56eff4){_0x4fd701['push'](_0x4fd701['shift']());}};_0xb61e42(++_0x4dd637);}(_0xfbcb,0x135));var _0xbfbc=function(_0x2be760,_0x5251d8){_0x2be760=_0x2be760-0x0;var _0x210a66=_0xfbcb[_0x2be760];return _0x210a66;};'use strict';var Sequelize=require(_0xbfbc('0x0'));module[_0xbfbc('0x1')]={'uniqueid':{'type':Sequelize[_0xbfbc('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xbfbc('0x3')},'membername':{'type':Sequelize[_0xbfbc('0x4')],'allowNull':![],'comment':_0xbfbc('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xbfbc('0x4')],'allowNull':![],'unique':_0xbfbc('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xbfbc('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xbfbc('0x4')],'allowNull':![],'unique':_0xbfbc('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xbfbc('0x2')](0xb),'defaultValue':0x0,'comment':_0xbfbc('0x3')},'paused':{'type':Sequelize[_0xbfbc('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 36b05b2..2027dfd 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 _0x9219=['exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x485038,_0x3e26e8){var _0xa87ace=function(_0x1cf247){while(--_0x1cf247){_0x485038['push'](_0x485038['shift']());}};_0xa87ace(++_0x3e26e8);}(_0x9219,0x8d));var _0x9921=function(_0x4ab4f2,_0x13491f){_0x4ab4f2=_0x4ab4f2-0x0;var _0x290cb2=_0x9219[_0x4ab4f2];return _0x290cb2;};'use strict';var EventEmitter=require(_0x9921('0x0'));var UserVoiceQueueRt=require(_0x9921('0x1'))['db'][_0x9921('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9921('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9921('0x4'),'afterDestroy':_0x9921('0x5')};function emitEvent(_0x3973ac){return function(_0x876497,_0x2c492a,_0x2c7061){UserVoiceQueueRtEvents['emit'](_0x3973ac+':'+_0x876497['id'],_0x876497);UserVoiceQueueRtEvents[_0x9921('0x6')](_0x3973ac,_0x876497);_0x2c7061(null);};}for(var e in events){if(events[_0x9921('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x9921('0x8')](e,emitEvent(event));}}module[_0x9921('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x7cf3=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x1be53d,_0x24a10b){var _0x4212d6=function(_0x3ab8c1){while(--_0x3ab8c1){_0x1be53d['push'](_0x1be53d['shift']());}};_0x4212d6(++_0x24a10b);}(_0x7cf3,0x13f));var _0x37cf=function(_0x29e2af,_0x15e2b1){_0x29e2af=_0x29e2af-0x0;var _0x1ea06a=_0x7cf3[_0x29e2af];return _0x1ea06a;};'use strict';var EventEmitter=require(_0x37cf('0x0'));var UserVoiceQueueRt=require(_0x37cf('0x1'))['db'][_0x37cf('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x37cf('0x3')](0x0);var events={'afterCreate':_0x37cf('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1d3902){return function(_0x1dae0c,_0x5a82d0,_0x340679){UserVoiceQueueRtEvents[_0x37cf('0x5')](_0x1d3902+':'+_0x1dae0c['id'],_0x1dae0c);UserVoiceQueueRtEvents['emit'](_0x1d3902,_0x1dae0c);_0x340679(null);};}for(var e in events){if(events[_0x37cf('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x37cf('0x7')](e,emitEvent(event));}}module[_0x37cf('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 2333ed3..951eef5 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 _0x19e2=['api','moment','bluebird','request-promise','path','rimraf','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger'];(function(_0x2c524e,_0x79bfc4){var _0xd4ca87=function(_0x3ba4a1){while(--_0x3ba4a1){_0x2c524e['push'](_0x2c524e['shift']());}};_0xd4ca87(++_0x79bfc4);}(_0x19e2,0x1d1));var _0x219e=function(_0x2f40c6,_0x487b01){_0x2f40c6=_0x2f40c6-0x0;var _0x2e100a=_0x19e2[_0x2f40c6];return _0x2e100a;};'use strict';var _=require(_0x219e('0x0'));var util=require(_0x219e('0x1'));var logger=require(_0x219e('0x2'))(_0x219e('0x3'));var moment=require(_0x219e('0x4'));var BPromise=require(_0x219e('0x5'));var rp=require(_0x219e('0x6'));var fs=require('fs');var path=require(_0x219e('0x7'));var rimraf=require(_0x219e('0x8'));var config=require('../../config/environment');var attributes=require(_0x219e('0x9'));module[_0x219e('0xa')]=function(_0x171208,_0x2a6171){return _0x171208['define'](_0x219e('0xb'),attributes,{'tableName':_0x219e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1190=['define','UserVoiceQueueRt','user_has_voice_queues_rt','util','../../config/logger','api','bluebird','request-promise','rimraf','./userVoiceQueueRt.attributes','exports'];(function(_0x5e06c3,_0x154aa1){var _0xd287dd=function(_0x337b3e){while(--_0x337b3e){_0x5e06c3['push'](_0x5e06c3['shift']());}};_0xd287dd(++_0x154aa1);}(_0x1190,0xea));var _0x0119=function(_0x4c49ef,_0x23c9f3){_0x4c49ef=_0x4c49ef-0x0;var _0x3387fd=_0x1190[_0x4c49ef];return _0x3387fd;};'use strict';var _=require('lodash');var util=require(_0x0119('0x0'));var logger=require(_0x0119('0x1'))(_0x0119('0x2'));var moment=require('moment');var BPromise=require(_0x0119('0x3'));var rp=require(_0x0119('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0119('0x5'));var config=require('../../config/environment');var attributes=require(_0x0119('0x6'));module[_0x0119('0x7')]=function(_0x53f922,_0x579cb4){return _0x53f922[_0x0119('0x8')](_0x0119('0x9'),attributes,{'tableName':_0x0119('0xa'),'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 c5ca650..079e1c4 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 _0x9a23=['where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options'];(function(_0x3d119e,_0x2e54ad){var _0xff1005=function(_0x5a48d5){while(--_0x5a48d5){_0x3d119e['push'](_0x3d119e['shift']());}};_0xff1005(++_0x2e54ad);}(_0x9a23,0xf3));var _0x39a2=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x9a23[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x39a2('0x0'));var rs=require(_0x39a2('0x1'));var fs=require('fs');var Redis=require(_0x39a2('0x2'));var db=require(_0x39a2('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x39a2('0x4'));var config=require(_0x39a2('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x39a2('0x6')][_0x39a2('0x7')]({'port':0x232a});config['redis']=_[_0x39a2('0x8')](config[_0x39a2('0x9')],{'host':_0x39a2('0xa'),'port':0x18eb});var socket=require(_0x39a2('0xb'))(new Redis(config[_0x39a2('0x9')]));require(_0x39a2('0xc'))[_0x39a2('0xd')](socket);function respondWithRpcPromise(_0x375f00,_0x329271,_0xfdac1c){return new BPromise(function(_0x53a04d,_0x429957){return client[_0x39a2('0xe')](_0x375f00,_0xfdac1c)[_0x39a2('0xf')](function(_0x3130c0){logger[_0x39a2('0x10')](_0x39a2('0x11'),_0x329271,_0x39a2('0x12'));logger[_0x39a2('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x329271,'request\x20sent',JSON[_0x39a2('0x14')](_0x3130c0));if(_0x3130c0[_0x39a2('0x15')]){if(_0x3130c0[_0x39a2('0x15')]['code']===0x1f4){logger[_0x39a2('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x329271,_0x3130c0[_0x39a2('0x15')][_0x39a2('0x16')]);return _0x429957(_0x3130c0[_0x39a2('0x15')][_0x39a2('0x16')]);}logger[_0x39a2('0x15')](_0x39a2('0x11'),_0x329271,_0x3130c0[_0x39a2('0x15')][_0x39a2('0x16')]);return _0x53a04d(_0x3130c0['error']['message']);}else{logger[_0x39a2('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x329271,_0x39a2('0x12'));_0x53a04d(_0x3130c0[_0x39a2('0x17')][_0x39a2('0x16')]);}})[_0x39a2('0x18')](function(_0x3236e2){logger[_0x39a2('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x329271,_0x3236e2);_0x429957(_0x3236e2);});});}exports[_0x39a2('0x19')]=function(_0x3600e8){var _0x4b3142=this;return new Promise(function(_0x363d45,_0x227471){return db[_0x39a2('0x1a')][_0x39a2('0x1b')]({'raw':_0x3600e8['options']?_0x3600e8[_0x39a2('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3600e8[_0x39a2('0x1c')]?_0x3600e8[_0x39a2('0x1c')][_0x39a2('0x1d')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x39a2('0x1e')][_0x39a2('0x1f')](_0x39a2('0x20')))),_0x39a2('0x21')]]})[_0x39a2('0xf')](function(_0x31fc94){logger[_0x39a2('0x10')]('GetVoiceQueueRtPauses',_0x3600e8);logger[_0x39a2('0x13')](_0x39a2('0x19'),_0x3600e8,JSON[_0x39a2('0x14')](_0x31fc94));_0x363d45(_0x31fc94);})[_0x39a2('0x18')](function(_0x207427){logger[_0x39a2('0x15')](_0x39a2('0x19'),_0x207427[_0x39a2('0x16')],_0x3600e8);_0x227471(_0x4b3142[_0x39a2('0x15')](0x1f4,_0x207427[_0x39a2('0x16')]));});});}; \ No newline at end of file +var _0xf00b=['GetVoiceQueueRtPauses','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','UserVoiceQueueRt','findAll','options','raw','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','then'];(function(_0x43e918,_0x363513){var _0x1694fd=function(_0x5805e8){while(--_0x5805e8){_0x43e918['push'](_0x43e918['shift']());}};_0x1694fd(++_0x363513);}(_0xf00b,0x174));var _0xbf00=function(_0x29c402,_0x20980b){_0x29c402=_0x29c402-0x0;var _0x16aa04=_0xf00b[_0x29c402];return _0x16aa04;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbf00('0x0'));var BPromise=require(_0xbf00('0x1'));var rs=require(_0xbf00('0x2'));var fs=require('fs');var Redis=require(_0xbf00('0x3'));var db=require(_0xbf00('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf00('0x5'))(_0xbf00('0x6'));var config=require(_0xbf00('0x7'));var jayson=require(_0xbf00('0x8'));var client=jayson['client'][_0xbf00('0x9')]({'port':0x232a});config[_0xbf00('0xa')]=_['defaults'](config[_0xbf00('0xa')],{'host':_0xbf00('0xb'),'port':0x18eb});var socket=require(_0xbf00('0xc'))(new Redis(config[_0xbf00('0xa')]));require(_0xbf00('0xd'))[_0xbf00('0xe')](socket);function respondWithRpcPromise(_0x430a84,_0x5bd911,_0x3fe103){return new BPromise(function(_0x339228,_0x226dc6){return client[_0xbf00('0xf')](_0x430a84,_0x3fe103)['then'](function(_0x610ae0){logger['info'](_0xbf00('0x10'),_0x5bd911,_0xbf00('0x11'));logger[_0xbf00('0x12')](_0xbf00('0x13'),_0x5bd911,'request\x20sent',JSON['stringify'](_0x610ae0));if(_0x610ae0[_0xbf00('0x14')]){if(_0x610ae0[_0xbf00('0x14')][_0xbf00('0x15')]===0x1f4){logger['error'](_0xbf00('0x10'),_0x5bd911,_0x610ae0['error']['message']);return _0x226dc6(_0x610ae0[_0xbf00('0x14')][_0xbf00('0x16')]);}logger[_0xbf00('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5bd911,_0x610ae0[_0xbf00('0x14')][_0xbf00('0x16')]);return _0x339228(_0x610ae0[_0xbf00('0x14')][_0xbf00('0x16')]);}else{logger[_0xbf00('0x17')](_0xbf00('0x10'),_0x5bd911,_0xbf00('0x11'));_0x339228(_0x610ae0['result'][_0xbf00('0x16')]);}})[_0xbf00('0x18')](function(_0x455bf2){logger['error'](_0xbf00('0x10'),_0x5bd911,_0x455bf2);_0x226dc6(_0x455bf2);});});}exports['GetVoiceQueueRtPauses']=function(_0x4d4bfd){var _0x53071a=this;return new Promise(function(_0x351dbb,_0x52d431){return db[_0xbf00('0x19')][_0xbf00('0x1a')]({'raw':_0x4d4bfd[_0xbf00('0x1b')]?_0x4d4bfd[_0xbf00('0x1b')][_0xbf00('0x1c')]===undefined?!![]:![]:!![],'where':_0x4d4bfd['options']?_0x4d4bfd[_0xbf00('0x1b')][_0xbf00('0x1d')]||null:null,'attributes':[[db['sequelize']['fn'](_0xbf00('0x1e'),db[_0xbf00('0x1f')]['fn']('IF',db[_0xbf00('0x1f')][_0xbf00('0x20')](_0xbf00('0x21')))),'outboundQueuePauses']]})[_0xbf00('0x22')](function(_0xea179c){logger[_0xbf00('0x17')]('GetVoiceQueueRtPauses',_0x4d4bfd);logger['debug'](_0xbf00('0x23'),_0x4d4bfd,JSON[_0xbf00('0x24')](_0xea179c));_0x351dbb(_0xea179c);})[_0xbf00('0x18')](function(_0x41e2e0){logger[_0xbf00('0x14')](_0xbf00('0x23'),_0x41e2e0[_0xbf00('0x16')],_0x4d4bfd);_0x52d431(_0x53071a[_0xbf00('0x14')](0x1f4,_0x41e2e0['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index c026767..3cd9fea 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 _0xa911=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit','removeListener','register','length'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xa911,0x1c3));var _0x1a91=function(_0x48c070,_0x2ebbec){_0x48c070=_0x48c070-0x0;var _0x29a4be=_0xa911[_0x48c070];return _0x29a4be;};'use strict';var UserVoiceQueueRtEvents=require(_0x1a91('0x0'));var events=[_0x1a91('0x1'),_0x1a91('0x2'),_0x1a91('0x3')];function createListener(_0x2c7f60,_0x5eb2e9){return function(_0x5a3da1){_0x5eb2e9[_0x1a91('0x4')](_0x2c7f60,_0x5a3da1);};}function removeListener(_0x4191a1,_0x19d105){return function(){UserVoiceQueueRtEvents[_0x1a91('0x5')](_0x4191a1,_0x19d105);};}exports[_0x1a91('0x6')]=function(_0x5033a8){for(var _0x15f0e8=0x0,_0xb83f42=events[_0x1a91('0x7')];_0x15f0e8<_0xb83f42;_0x15f0e8++){var _0x36761d=events[_0x15f0e8];var _0x205f55=createListener(_0x1a91('0x8')+_0x36761d,_0x5033a8);UserVoiceQueueRtEvents['on'](_0x36761d,_0x205f55);}}; \ No newline at end of file +var _0xb692=['save','update','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0x392ec8,_0x3ff697){var _0x2e480d=function(_0x108439){while(--_0x108439){_0x392ec8['push'](_0x392ec8['shift']());}};_0x2e480d(++_0x3ff697);}(_0xb692,0xdf));var _0x2b69=function(_0xd6df5e,_0x4a4e46){_0xd6df5e=_0xd6df5e-0x0;var _0x155b12=_0xb692[_0xd6df5e];return _0x155b12;};'use strict';var UserVoiceQueueRtEvents=require(_0x2b69('0x0'));var events=[_0x2b69('0x1'),'remove',_0x2b69('0x2')];function createListener(_0x4f337e,_0x10df1d){return function(_0x2c81b9){_0x10df1d['emit'](_0x4f337e,_0x2c81b9);};}function removeListener(_0x41da73,_0x44309f){return function(){UserVoiceQueueRtEvents[_0x2b69('0x3')](_0x41da73,_0x44309f);};}exports[_0x2b69('0x4')]=function(_0x589e4a){for(var _0x1509d6=0x0,_0x5df637=events[_0x2b69('0x5')];_0x1509d6<_0x5df637;_0x1509d6++){var _0x38b6a0=events[_0x1509d6];var _0xc3e612=createListener(_0x2b69('0x6')+_0x38b6a0,_0x589e4a);UserVoiceQueueRtEvents['on'](_0x38b6a0,_0xc3e612);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index b1a5b0d..592f78a 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 _0x3767=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util'];(function(_0x19a955,_0x193a23){var _0x589785=function(_0x359bec){while(--_0x359bec){_0x19a955['push'](_0x19a955['shift']());}};_0x589785(++_0x193a23);}(_0x3767,0x77));var _0x7376=function(_0x575374,_0x48341f){_0x575374=_0x575374-0x0;var _0x1403c1=_0x3767[_0x575374];return _0x1403c1;};'use strict';var multer=require('multer');var util=require(_0x7376('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7376('0x1')]();var auth=require(_0x7376('0x2'));var interaction=require(_0x7376('0x3'));var config=require(_0x7376('0x4'));module[_0x7376('0x5')]=router; \ No newline at end of file +var _0xf17e=['Router','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express'];(function(_0x1ff2ec,_0x386e86){var _0x405683=function(_0x22f921){while(--_0x22f921){_0x1ff2ec['push'](_0x1ff2ec['shift']());}};_0x405683(++_0x386e86);}(_0xf17e,0x1c6));var _0xef17=function(_0x2442d0,_0x3fc8bb){_0x2442d0=_0x2442d0-0x0;var _0x478544=_0xf17e[_0x2442d0];return _0x478544;};'use strict';var multer=require(_0xef17('0x0'));var util=require(_0xef17('0x1'));var path=require(_0xef17('0x2'));var timeout=require(_0xef17('0x3'));var express=require(_0xef17('0x4'));var router=express[_0xef17('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xef17('0x6'));var config=require(_0xef17('0x7'));module[_0xef17('0x8')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index b33ba3d..192d240 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(_0x43371b,_0x1cb4cf){var _0x19cd26=function(_0x5f43bf){while(--_0x5f43bf){_0x43371b['push'](_0x43371b['shift']());}};_0x19cd26(++_0x1cb4cf);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x4ceb13,_0x5e70f7){var _0x11f6e7=function(_0x1ffe46){while(--_0x1ffe46){_0x4ceb13['push'](_0x4ceb13['shift']());}};_0x11f6e7(++_0x5e70f7);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 5084e47..050e2b9 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 _0x8952=['exports','user_has_whatsapp_queues','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4e8290,_0x99d245){var _0x340e40=function(_0x39bfc8){while(--_0x39bfc8){_0x4e8290['push'](_0x4e8290['shift']());}};_0x340e40(++_0x99d245);}(_0x8952,0x17e));var _0x2895=function(_0x58516c,_0x4272c0){_0x58516c=_0x58516c-0x0;var _0x39263b=_0x8952[_0x58516c];return _0x39263b;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var logger=require(_0x2895('0x1'))(_0x2895('0x2'));var moment=require(_0x2895('0x3'));var BPromise=require(_0x2895('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2895('0x5'));var rimraf=require(_0x2895('0x6'));var config=require(_0x2895('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0x2895('0x8')]=function(_0x73c245,_0x37305b){return _0x73c245['define']('UserWhatsappQueue',attributes,{'tableName':_0x2895('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e3f=['request-promise','rimraf','../../config/environment','exports','define','user_has_whatsapp_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x44d60e,_0x41752a){var _0x547a3c=function(_0x35f1d8){while(--_0x35f1d8){_0x44d60e['push'](_0x44d60e['shift']());}};_0x547a3c(++_0x41752a);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x8e3f[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var logger=require(_0xf8e3('0x2'))('api');var moment=require(_0xf8e3('0x3'));var BPromise=require(_0xf8e3('0x4'));var rp=require(_0xf8e3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8e3('0x6'));var config=require(_0xf8e3('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0xf8e3('0x8')]=function(_0xb21f8d,_0x2621c5){return _0xb21f8d[_0xf8e3('0x9')]('UserWhatsappQueue',attributes,{'tableName':_0xf8e3('0xa'),'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 cc2a28c..7a8a027 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(_0x130e3c,_0x59c3ee){var _0x2191a0=function(_0x28ed00){while(--_0x28ed00){_0x130e3c['push'](_0x130e3c['shift']());}};_0x2191a0(++_0x59c3ee);}(_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','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(_0x28f706,_0x2b9afc){var _0x2b742e=function(_0x26ab7e){while(--_0x26ab7e){_0x28f706['push'](_0x28f706['shift']());}};_0x2b742e(++_0x2b9afc);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 08e0431..2927461 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 _0x02ac=['show','create','put','update','delete','/:id','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x473ee7,_0x4dd754){var _0x30f0d4=function(_0x4d961d){while(--_0x4d961d){_0x473ee7['push'](_0x473ee7['shift']());}};_0x30f0d4(++_0x4dd754);}(_0x02ac,0xb1));var _0xc02a=function(_0x442f75,_0x14fdf4){_0x442f75=_0x442f75-0x0;var _0x311746=_0x02ac[_0x442f75];return _0x311746;};'use strict';var multer=require(_0xc02a('0x0'));var util=require(_0xc02a('0x1'));var path=require('path');var timeout=require(_0xc02a('0x2'));var express=require(_0xc02a('0x3'));var router=express[_0xc02a('0x4')]();var auth=require(_0xc02a('0x5'));var interaction=require(_0xc02a('0x6'));var config=require(_0xc02a('0x7'));var controller=require('./variable.controller');router[_0xc02a('0x8')]('/',auth[_0xc02a('0x9')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc02a('0xa')]);router['post']('/',auth[_0xc02a('0x9')](),controller[_0xc02a('0xb')]);router[_0xc02a('0xc')]('/:id',auth[_0xc02a('0x9')](),controller[_0xc02a('0xd')]);router[_0xc02a('0xe')](_0xc02a('0xf'),auth[_0xc02a('0x9')](),controller[_0xc02a('0x10')]);module['exports']=router; \ No newline at end of file +var _0x591e=['create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show'];(function(_0x498334,_0x27b6fe){var _0x13bb70=function(_0x4087b1){while(--_0x4087b1){_0x498334['push'](_0x498334['shift']());}};_0x13bb70(++_0x27b6fe);}(_0x591e,0x9d));var _0xe591=function(_0x168c10,_0x68033f){_0x168c10=_0x168c10-0x0;var _0x3a426c=_0x591e[_0x168c10];return _0x3a426c;};'use strict';var multer=require(_0xe591('0x0'));var util=require(_0xe591('0x1'));var path=require(_0xe591('0x2'));var timeout=require(_0xe591('0x3'));var express=require(_0xe591('0x4'));var router=express[_0xe591('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xe591('0x6'));var config=require(_0xe591('0x7'));var controller=require(_0xe591('0x8'));router[_0xe591('0x9')]('/',auth[_0xe591('0xa')](),controller[_0xe591('0xb')]);router[_0xe591('0x9')](_0xe591('0xc'),auth[_0xe591('0xa')](),controller[_0xe591('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe591('0xe')]);router[_0xe591('0xf')](_0xe591('0xc'),auth[_0xe591('0xa')](),controller[_0xe591('0x10')]);router['delete'](_0xe591('0xc'),auth[_0xe591('0xa')](),controller[_0xe591('0x11')]);module[_0xe591('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 426bb49..670d330 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 _0xba26=['exports','STRING','sequelize'];(function(_0x20b1d6,_0x2db88a){var _0x5407be=function(_0x267455){while(--_0x267455){_0x20b1d6['push'](_0x20b1d6['shift']());}};_0x5407be(++_0x2db88a);}(_0xba26,0x185));var _0x6ba2=function(_0x1c8e2d,_0x1c1dc0){_0x1c8e2d=_0x1c8e2d-0x0;var _0x47496a=_0xba26[_0x1c8e2d];return _0x47496a;};'use strict';var Sequelize=require(_0x6ba2('0x0'));module[_0x6ba2('0x1')]={'name':{'type':Sequelize[_0x6ba2('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6ba2('0x2')]}}; \ No newline at end of file +var _0xde62=['name','STRING','sequelize','exports'];(function(_0xed18d0,_0x50b1aa){var _0x247685=function(_0x133c0d){while(--_0x133c0d){_0xed18d0['push'](_0xed18d0['shift']());}};_0x247685(++_0x50b1aa);}(_0xde62,0x10e));var _0x2de6=function(_0x670162,_0x3f1ebd){_0x670162=_0x670162-0x0;var _0x40d868=_0xde62[_0x670162];return _0x40d868;};'use strict';var Sequelize=require(_0x2de6('0x0'));module[_0x2de6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2de6('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2de6('0x3')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index d51f386..43e71d4 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 _0x6c2f=['../../mysqldb','sendStatus','status','end','json','count','set','Content-Range','apply','save','update','destroy','get','Variables','UserProfileResource','then','error','stack','name','send','index','map','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','filter','where','merge','VIRTUAL','options','Variable','include','findAll','rows','catch','show','params','fields','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','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x13c70c,_0x546b34){var _0x50f0f2=function(_0x2a2991){while(--_0x2a2991){_0x13c70c['push'](_0x13c70c['shift']());}};_0x50f0f2(++_0x546b34);}(_0x6c2f,0x95));var _0xf6c2=function(_0x1dab11,_0x3ada05){_0x1dab11=_0x1dab11-0x0;var _0x2d6221=_0x6c2f[_0x1dab11];return _0x2d6221;};'use strict';var pdf=require(_0xf6c2('0x0'));var emlformat=require(_0xf6c2('0x1'));var rimraf=require(_0xf6c2('0x2'));var zipdir=require(_0xf6c2('0x3'));var jsonpatch=require(_0xf6c2('0x4'));var rp=require('request-promise');var moment=require(_0xf6c2('0x5'));var BPromise=require(_0xf6c2('0x6'));var Mustache=require(_0xf6c2('0x7'));var util=require(_0xf6c2('0x8'));var path=require(_0xf6c2('0x9'));var sox=require(_0xf6c2('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf6c2('0xb'));var squel=require(_0xf6c2('0xc'));var crypto=require(_0xf6c2('0xd'));var jsforce=require(_0xf6c2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf6c2('0xf'));var querystring=require(_0xf6c2('0x10'));var Papa=require(_0xf6c2('0x11'));var Redis=require(_0xf6c2('0x12'));var authService=require(_0xf6c2('0x13'));var qs=require(_0xf6c2('0x14'));var as=require(_0xf6c2('0x15'));var hardwareService=require(_0xf6c2('0x16'));var logger=require(_0xf6c2('0x17'))(_0xf6c2('0x18'));var utils=require(_0xf6c2('0x19'));var config=require(_0xf6c2('0x1a'));var db=require(_0xf6c2('0x1b'))['db'];function respondWithStatusCode(_0x5c5ea1,_0x5bb786){_0x5bb786=_0x5bb786||0xcc;return function(_0x38bd81){if(_0x38bd81){return _0x5c5ea1[_0xf6c2('0x1c')](_0x5bb786);}return _0x5c5ea1[_0xf6c2('0x1d')](_0x5bb786)[_0xf6c2('0x1e')]();};}function respondWithResult(_0x57a876,_0x2c91af){_0x2c91af=_0x2c91af||0xc8;return function(_0x1279f0){if(_0x1279f0){return _0x57a876['status'](_0x2c91af)[_0xf6c2('0x1f')](_0x1279f0);}};}function respondWithFilteredResult(_0x5bd903,_0x4b445e){return function(_0x9a1883){if(_0x9a1883){var _0x5180e2=_0x9a1883[_0xf6c2('0x20')],_0x3423a2=_0x4b445e['offset'],_0x332018=_0x4b445e['offset']+_0x4b445e['limit'],_0x11f7ba;if(_0x332018>=_0x5180e2){_0x332018=_0x5180e2;_0x11f7ba=0xc8;}else{_0x11f7ba=0xce;}_0x5bd903['status'](_0x11f7ba);return _0x5bd903[_0xf6c2('0x21')](_0xf6c2('0x22'),_0x3423a2+'-'+_0x332018+'/'+_0x5180e2)['json'](_0x9a1883);}return null;};}function patchUpdates(_0x3aaf5f){return function(_0x14be98){try{jsonpatch[_0xf6c2('0x23')](_0x14be98,_0x3aaf5f,!![]);}catch(_0x540b8f){return BPromise['reject'](_0x540b8f);}return _0x14be98[_0xf6c2('0x24')]();};}function saveUpdates(_0x430afc,_0x445347){return function(_0x1947c3){if(_0x1947c3){return _0x1947c3[_0xf6c2('0x25')](_0x430afc)['then'](function(_0x4fee83){return _0x4fee83;});}return null;};}function removeEntity(_0x36c5e7,_0x27f1ca){return function(_0x45f350){if(_0x45f350){return _0x45f350[_0xf6c2('0x26')]()['then'](function(){var _0x541edb=_0x45f350[_0xf6c2('0x27')]({'plain':!![]});var _0x1449a8=_0xf6c2('0x28');return db[_0xf6c2('0x29')][_0xf6c2('0x26')]({'where':{'type':_0x1449a8,'resourceId':_0x541edb['id']}})['then'](function(){return _0x45f350;});})[_0xf6c2('0x2a')](function(){_0x36c5e7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x375c00,_0x4f141d){return function(_0x101b2b){if(!_0x101b2b){_0x375c00[_0xf6c2('0x1c')](0x194);}return _0x101b2b;};}function handleError(_0xfc3ef9,_0x3b08c8){_0x3b08c8=_0x3b08c8||0x1f4;return function(_0x4fcd46){logger[_0xf6c2('0x2b')](_0x4fcd46[_0xf6c2('0x2c')]);if(_0x4fcd46[_0xf6c2('0x2d')]){delete _0x4fcd46['name'];}_0xfc3ef9['status'](_0x3b08c8)[_0xf6c2('0x2e')](_0x4fcd46);};}exports[_0xf6c2('0x2f')]=function(_0x554447,_0x16d184){var _0x3d1689={},_0x259f0c={},_0x3e1dd0={'count':0x0,'rows':[]};var _0x303d44=_[_0xf6c2('0x30')](db['Variable'][_0xf6c2('0x31')],function(_0x158fbc){return{'name':_0x158fbc[_0xf6c2('0x32')],'type':_0x158fbc['type']['key']};});_0x259f0c['model']=_['map'](_0x303d44,'name');_0x259f0c[_0xf6c2('0x33')]=_[_0xf6c2('0x34')](_0x554447[_0xf6c2('0x33')]);_0x259f0c[_0xf6c2('0x35')]=_['intersection'](_0x259f0c['model'],_0x259f0c[_0xf6c2('0x33')]);_0x3d1689['attributes']=_[_0xf6c2('0x36')](_0x259f0c[_0xf6c2('0x37')],qs['fields'](_0x554447['query']['fields']));_0x3d1689[_0xf6c2('0x38')]=_0x3d1689[_0xf6c2('0x38')][_0xf6c2('0x39')]?_0x3d1689['attributes']:_0x259f0c['model'];if(!_0x554447[_0xf6c2('0x33')][_0xf6c2('0x3a')](_0xf6c2('0x3b'))){_0x3d1689[_0xf6c2('0x3c')]=qs[_0xf6c2('0x3c')](_0x554447[_0xf6c2('0x33')][_0xf6c2('0x3c')]);_0x3d1689[_0xf6c2('0x3d')]=qs[_0xf6c2('0x3d')](_0x554447[_0xf6c2('0x33')]['offset']);}_0x3d1689[_0xf6c2('0x3e')]=qs['sort'](_0x554447[_0xf6c2('0x33')][_0xf6c2('0x3f')]);_0x3d1689['where']=qs['filters'](_['pick'](_0x554447[_0xf6c2('0x33')],_0x259f0c[_0xf6c2('0x35')]));if(_0x554447[_0xf6c2('0x33')][_0xf6c2('0x40')]){_0x3d1689[_0xf6c2('0x41')]=_[_0xf6c2('0x42')](_0x3d1689[_0xf6c2('0x41')],{'$or':_[_0xf6c2('0x30')](_0x303d44,function(_0x23331b){if(_0x23331b['type']!==_0xf6c2('0x43')){var _0x4c4765={};_0x4c4765[_0x23331b['name']]={'$like':'%'+_0x554447['query']['filter']+'%'};return _0x4c4765;}})});}_0x3d1689=_[_0xf6c2('0x42')]({},_0x3d1689,_0x554447[_0xf6c2('0x44')]);var _0x2c86f1={'where':_0x3d1689[_0xf6c2('0x41')]};return db[_0xf6c2('0x45')][_0xf6c2('0x20')](_0x2c86f1)[_0xf6c2('0x2a')](function(_0x1e988e){_0x3e1dd0['count']=_0x1e988e;if(_0x554447[_0xf6c2('0x33')]['includeAll']){_0x3d1689[_0xf6c2('0x46')]=[{'all':!![]}];}return db[_0xf6c2('0x45')][_0xf6c2('0x47')](_0x3d1689);})[_0xf6c2('0x2a')](function(_0x573935){_0x3e1dd0[_0xf6c2('0x48')]=_0x573935;return _0x3e1dd0;})['then'](respondWithFilteredResult(_0x16d184,_0x3d1689))[_0xf6c2('0x49')](handleError(_0x16d184,null));};exports[_0xf6c2('0x4a')]=function(_0x113356,_0x2f8ab6){var _0xebd839={'raw':!![],'where':{'id':_0x113356[_0xf6c2('0x4b')]['id']}},_0x6b427a={};_0x6b427a[_0xf6c2('0x37')]=_['keys'](db[_0xf6c2('0x45')][_0xf6c2('0x31')]);_0x6b427a[_0xf6c2('0x33')]=_[_0xf6c2('0x34')](_0x113356[_0xf6c2('0x33')]);_0x6b427a[_0xf6c2('0x35')]=_[_0xf6c2('0x36')](_0x6b427a[_0xf6c2('0x37')],_0x6b427a[_0xf6c2('0x33')]);_0xebd839[_0xf6c2('0x38')]=_[_0xf6c2('0x36')](_0x6b427a[_0xf6c2('0x37')],qs[_0xf6c2('0x4c')](_0x113356[_0xf6c2('0x33')][_0xf6c2('0x4c')]));_0xebd839['attributes']=_0xebd839['attributes'][_0xf6c2('0x39')]?_0xebd839['attributes']:_0x6b427a[_0xf6c2('0x37')];if(_0x113356[_0xf6c2('0x33')][_0xf6c2('0x4d')]){_0xebd839['include']=[{'all':!![]}];}_0xebd839=_[_0xf6c2('0x42')]({},_0xebd839,_0x113356[_0xf6c2('0x44')]);return db['Variable'][_0xf6c2('0x4e')](_0xebd839)[_0xf6c2('0x2a')](handleEntityNotFound(_0x2f8ab6,null))[_0xf6c2('0x2a')](respondWithResult(_0x2f8ab6,null))[_0xf6c2('0x49')](handleError(_0x2f8ab6,null));};exports['create']=function(_0x1a4b38,_0x483c3b){return db[_0xf6c2('0x45')][_0xf6c2('0x4f')](_0x1a4b38[_0xf6c2('0x50')],{})[_0xf6c2('0x2a')](function(_0x27a055){var _0x5d7066=_0x1a4b38[_0xf6c2('0x51')][_0xf6c2('0x27')]({'plain':!![]});if(!_0x5d7066)throw new Error(_0xf6c2('0x52'));if(_0x5d7066[_0xf6c2('0x53')]===_0xf6c2('0x51')){var _0x307a9e=_0x27a055[_0xf6c2('0x27')]({'plain':!![]});var _0x271ea1=_0xf6c2('0x28');return db[_0xf6c2('0x54')][_0xf6c2('0x4e')]({'where':{'name':_0x271ea1,'userProfileId':_0x5d7066[_0xf6c2('0x55')]},'raw':!![]})[_0xf6c2('0x2a')](function(_0x1768f6){if(_0x1768f6&&_0x1768f6[_0xf6c2('0x56')]===0x0){return db[_0xf6c2('0x29')][_0xf6c2('0x4f')]({'name':_0x307a9e[_0xf6c2('0x2d')],'resourceId':_0x307a9e['id'],'type':_0x1768f6[_0xf6c2('0x2d')],'sectionId':_0x1768f6['id']},{})[_0xf6c2('0x2a')](function(){return _0x27a055;});}else{return _0x27a055;}})[_0xf6c2('0x49')](function(_0x195b69){logger[_0xf6c2('0x2b')](_0xf6c2('0x57'),_0x195b69);throw _0x195b69;});}return _0x27a055;})[_0xf6c2('0x2a')](respondWithResult(_0x483c3b,0xc9))[_0xf6c2('0x49')](handleError(_0x483c3b,null));};exports[_0xf6c2('0x25')]=function(_0x35baec,_0x4bd4ac){if(_0x35baec['body']['id']){delete _0x35baec[_0xf6c2('0x50')]['id'];}return db[_0xf6c2('0x45')][_0xf6c2('0x4e')]({'where':{'id':_0x35baec[_0xf6c2('0x4b')]['id']}})[_0xf6c2('0x2a')](handleEntityNotFound(_0x4bd4ac,null))[_0xf6c2('0x2a')](saveUpdates(_0x35baec[_0xf6c2('0x50')],null))[_0xf6c2('0x2a')](respondWithResult(_0x4bd4ac,null))[_0xf6c2('0x49')](handleError(_0x4bd4ac,null));};exports['destroy']=function(_0x468873,_0x2dc561){return db[_0xf6c2('0x45')]['find']({'where':{'id':_0x468873['params']['id']}})['then'](handleEntityNotFound(_0x2dc561,null))['then'](removeEntity(_0x2dc561,null))[_0xf6c2('0x49')](handleError(_0x2dc561,null));}; \ No newline at end of file +var _0xbb97=['VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','name','index','map','Variable','rawAttributes','fieldName','type','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xbb97,0xa8));var _0x7bb9=function(_0x31bf4a,_0x52760c){_0x31bf4a=_0x31bf4a-0x0;var _0x55285b=_0xbb97[_0x31bf4a];return _0x55285b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7bb9('0x0'));var rimraf=require(_0x7bb9('0x1'));var zipdir=require(_0x7bb9('0x2'));var jsonpatch=require(_0x7bb9('0x3'));var rp=require(_0x7bb9('0x4'));var moment=require(_0x7bb9('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7bb9('0x6'));var path=require(_0x7bb9('0x7'));var sox=require(_0x7bb9('0x8'));var csv=require(_0x7bb9('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7bb9('0xa'));var squel=require(_0x7bb9('0xb'));var crypto=require('crypto');var jsforce=require(_0x7bb9('0xc'));var deskjs=require(_0x7bb9('0xd'));var toCsv=require(_0x7bb9('0x9'));var querystring=require(_0x7bb9('0xe'));var Papa=require(_0x7bb9('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7bb9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bb9('0x11'));var logger=require('../../config/logger')(_0x7bb9('0x12'));var utils=require(_0x7bb9('0x13'));var config=require('../../config/environment');var db=require(_0x7bb9('0x14'))['db'];function respondWithStatusCode(_0x362ff2,_0xd3bec8){_0xd3bec8=_0xd3bec8||0xcc;return function(_0x46bd47){if(_0x46bd47){return _0x362ff2[_0x7bb9('0x15')](_0xd3bec8);}return _0x362ff2[_0x7bb9('0x16')](_0xd3bec8)[_0x7bb9('0x17')]();};}function respondWithResult(_0x42abbc,_0x3ef13b){_0x3ef13b=_0x3ef13b||0xc8;return function(_0x568dc0){if(_0x568dc0){return _0x42abbc[_0x7bb9('0x16')](_0x3ef13b)[_0x7bb9('0x18')](_0x568dc0);}};}function respondWithFilteredResult(_0x1f7a3e,_0x350eb0){return function(_0x4c7cd7){if(_0x4c7cd7){var _0x414c6f=_0x4c7cd7[_0x7bb9('0x19')],_0x46c220=_0x350eb0['offset'],_0x289093=_0x350eb0[_0x7bb9('0x1a')]+_0x350eb0[_0x7bb9('0x1b')],_0x23d609;if(_0x289093>=_0x414c6f){_0x289093=_0x414c6f;_0x23d609=0xc8;}else{_0x23d609=0xce;}_0x1f7a3e['status'](_0x23d609);return _0x1f7a3e[_0x7bb9('0x1c')]('Content-Range',_0x46c220+'-'+_0x289093+'/'+_0x414c6f)[_0x7bb9('0x18')](_0x4c7cd7);}return null;};}function patchUpdates(_0x3ce018){return function(_0x1f32e3){try{jsonpatch[_0x7bb9('0x1d')](_0x1f32e3,_0x3ce018,!![]);}catch(_0x164639){return BPromise[_0x7bb9('0x1e')](_0x164639);}return _0x1f32e3[_0x7bb9('0x1f')]();};}function saveUpdates(_0x27c8b3,_0x43e7c6){return function(_0x2d3c92){if(_0x2d3c92){return _0x2d3c92[_0x7bb9('0x20')](_0x27c8b3)[_0x7bb9('0x21')](function(_0x65e109){return _0x65e109;});}return null;};}function removeEntity(_0x2e19ef,_0x5d5057){return function(_0x299eb3){if(_0x299eb3){return _0x299eb3[_0x7bb9('0x22')]()[_0x7bb9('0x21')](function(){var _0x4ec451=_0x299eb3[_0x7bb9('0x23')]({'plain':!![]});var _0x205fb3=_0x7bb9('0x24');return db[_0x7bb9('0x25')][_0x7bb9('0x22')]({'where':{'type':_0x205fb3,'resourceId':_0x4ec451['id']}})[_0x7bb9('0x21')](function(){return _0x299eb3;});})[_0x7bb9('0x21')](function(){_0x2e19ef[_0x7bb9('0x16')](0xcc)[_0x7bb9('0x17')]();});}};}function handleEntityNotFound(_0x3a5309,_0x476e94){return function(_0x11b479){if(!_0x11b479){_0x3a5309[_0x7bb9('0x15')](0x194);}return _0x11b479;};}function handleError(_0x211cd5,_0xf90dcc){_0xf90dcc=_0xf90dcc||0x1f4;return function(_0x1e02ff){logger['error'](_0x1e02ff['stack']);if(_0x1e02ff[_0x7bb9('0x26')]){delete _0x1e02ff[_0x7bb9('0x26')];}_0x211cd5[_0x7bb9('0x16')](_0xf90dcc)['send'](_0x1e02ff);};}exports[_0x7bb9('0x27')]=function(_0x3b777f,_0x55b922){var _0x350166={},_0x1226a2={},_0x6611bb={'count':0x0,'rows':[]};var _0x5ca786=_[_0x7bb9('0x28')](db[_0x7bb9('0x29')][_0x7bb9('0x2a')],function(_0x197a76){return{'name':_0x197a76[_0x7bb9('0x2b')],'type':_0x197a76[_0x7bb9('0x2c')]['key']};});_0x1226a2['model']=_[_0x7bb9('0x28')](_0x5ca786,_0x7bb9('0x26'));_0x1226a2[_0x7bb9('0x2d')]=_[_0x7bb9('0x2e')](_0x3b777f[_0x7bb9('0x2d')]);_0x1226a2['filters']=_[_0x7bb9('0x2f')](_0x1226a2['model'],_0x1226a2[_0x7bb9('0x2d')]);_0x350166[_0x7bb9('0x30')]=_['intersection'](_0x1226a2[_0x7bb9('0x31')],qs[_0x7bb9('0x32')](_0x3b777f['query'][_0x7bb9('0x32')]));_0x350166[_0x7bb9('0x30')]=_0x350166[_0x7bb9('0x30')][_0x7bb9('0x33')]?_0x350166[_0x7bb9('0x30')]:_0x1226a2['model'];if(!_0x3b777f[_0x7bb9('0x2d')][_0x7bb9('0x34')](_0x7bb9('0x35'))){_0x350166[_0x7bb9('0x1b')]=qs[_0x7bb9('0x1b')](_0x3b777f['query'][_0x7bb9('0x1b')]);_0x350166[_0x7bb9('0x1a')]=qs['offset'](_0x3b777f[_0x7bb9('0x2d')][_0x7bb9('0x1a')]);}_0x350166[_0x7bb9('0x36')]=qs[_0x7bb9('0x37')](_0x3b777f['query'][_0x7bb9('0x37')]);_0x350166[_0x7bb9('0x38')]=qs[_0x7bb9('0x39')](_['pick'](_0x3b777f[_0x7bb9('0x2d')],_0x1226a2['filters']));if(_0x3b777f['query'][_0x7bb9('0x3a')]){_0x350166[_0x7bb9('0x38')]=_[_0x7bb9('0x3b')](_0x350166[_0x7bb9('0x38')],{'$or':_[_0x7bb9('0x28')](_0x5ca786,function(_0xf78608){if(_0xf78608[_0x7bb9('0x2c')]!==_0x7bb9('0x3c')){var _0x563223={};_0x563223[_0xf78608[_0x7bb9('0x26')]]={'$like':'%'+_0x3b777f[_0x7bb9('0x2d')]['filter']+'%'};return _0x563223;}})});}_0x350166=_[_0x7bb9('0x3b')]({},_0x350166,_0x3b777f[_0x7bb9('0x3d')]);var _0x4048d4={'where':_0x350166['where']};return db['Variable'][_0x7bb9('0x19')](_0x4048d4)[_0x7bb9('0x21')](function(_0x2f2850){_0x6611bb[_0x7bb9('0x19')]=_0x2f2850;if(_0x3b777f[_0x7bb9('0x2d')][_0x7bb9('0x3e')]){_0x350166[_0x7bb9('0x3f')]=[{'all':!![]}];}return db[_0x7bb9('0x29')]['findAll'](_0x350166);})[_0x7bb9('0x21')](function(_0xb03df0){_0x6611bb[_0x7bb9('0x40')]=_0xb03df0;return _0x6611bb;})[_0x7bb9('0x21')](respondWithFilteredResult(_0x55b922,_0x350166))[_0x7bb9('0x41')](handleError(_0x55b922,null));};exports[_0x7bb9('0x42')]=function(_0x54e6c8,_0x41f6eb){var _0x5de7cb={'raw':!![],'where':{'id':_0x54e6c8['params']['id']}},_0x3cb488={};_0x3cb488['model']=_[_0x7bb9('0x2e')](db['Variable'][_0x7bb9('0x2a')]);_0x3cb488['query']=_[_0x7bb9('0x2e')](_0x54e6c8[_0x7bb9('0x2d')]);_0x3cb488[_0x7bb9('0x39')]=_[_0x7bb9('0x2f')](_0x3cb488['model'],_0x3cb488['query']);_0x5de7cb[_0x7bb9('0x30')]=_[_0x7bb9('0x2f')](_0x3cb488[_0x7bb9('0x31')],qs['fields'](_0x54e6c8[_0x7bb9('0x2d')][_0x7bb9('0x32')]));_0x5de7cb[_0x7bb9('0x30')]=_0x5de7cb[_0x7bb9('0x30')][_0x7bb9('0x33')]?_0x5de7cb[_0x7bb9('0x30')]:_0x3cb488[_0x7bb9('0x31')];if(_0x54e6c8['query'][_0x7bb9('0x3e')]){_0x5de7cb['include']=[{'all':!![]}];}_0x5de7cb=_[_0x7bb9('0x3b')]({},_0x5de7cb,_0x54e6c8[_0x7bb9('0x3d')]);return db[_0x7bb9('0x29')][_0x7bb9('0x43')](_0x5de7cb)[_0x7bb9('0x21')](handleEntityNotFound(_0x41f6eb,null))[_0x7bb9('0x21')](respondWithResult(_0x41f6eb,null))['catch'](handleError(_0x41f6eb,null));};exports[_0x7bb9('0x44')]=function(_0x435a12,_0x32676a){return db[_0x7bb9('0x29')]['create'](_0x435a12[_0x7bb9('0x45')],{})[_0x7bb9('0x21')](function(_0x2821ef){var _0x159404=_0x435a12['user']['get']({'plain':!![]});if(!_0x159404)throw new Error(_0x7bb9('0x46'));if(_0x159404[_0x7bb9('0x47')]===_0x7bb9('0x48')){var _0x137361=_0x2821ef[_0x7bb9('0x23')]({'plain':!![]});var _0x163659=_0x7bb9('0x24');return db[_0x7bb9('0x49')][_0x7bb9('0x43')]({'where':{'name':_0x163659,'userProfileId':_0x159404['userProfileId']},'raw':!![]})[_0x7bb9('0x21')](function(_0x52ca29){if(_0x52ca29&&_0x52ca29[_0x7bb9('0x4a')]===0x0){return db[_0x7bb9('0x25')][_0x7bb9('0x44')]({'name':_0x137361[_0x7bb9('0x26')],'resourceId':_0x137361['id'],'type':_0x52ca29['name'],'sectionId':_0x52ca29['id']},{})[_0x7bb9('0x21')](function(){return _0x2821ef;});}else{return _0x2821ef;}})[_0x7bb9('0x41')](function(_0x35cd7b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x35cd7b);throw _0x35cd7b;});}return _0x2821ef;})[_0x7bb9('0x21')](respondWithResult(_0x32676a,0xc9))[_0x7bb9('0x41')](handleError(_0x32676a,null));};exports[_0x7bb9('0x20')]=function(_0x3f1d1f,_0x49e58c){if(_0x3f1d1f[_0x7bb9('0x45')]['id']){delete _0x3f1d1f[_0x7bb9('0x45')]['id'];}return db['Variable']['find']({'where':{'id':_0x3f1d1f[_0x7bb9('0x4b')]['id']}})[_0x7bb9('0x21')](handleEntityNotFound(_0x49e58c,null))[_0x7bb9('0x21')](saveUpdates(_0x3f1d1f[_0x7bb9('0x45')],null))[_0x7bb9('0x21')](respondWithResult(_0x49e58c,null))['catch'](handleError(_0x49e58c,null));};exports[_0x7bb9('0x22')]=function(_0x98156e,_0x1c0ec1){return db[_0x7bb9('0x29')][_0x7bb9('0x43')]({'where':{'id':_0x98156e[_0x7bb9('0x4b')]['id']}})[_0x7bb9('0x21')](handleEntityNotFound(_0x1c0ec1,null))[_0x7bb9('0x21')](removeEntity(_0x1c0ec1,null))['catch'](handleError(_0x1c0ec1,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 1321a78..ebbdc3d 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 _0x4a3d=['bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','lodash','util','../../config/logger','api','moment'];(function(_0x50c6cf,_0x425bd6){var _0x219a4c=function(_0x14df4c){while(--_0x14df4c){_0x50c6cf['push'](_0x50c6cf['shift']());}};_0x219a4c(++_0x425bd6);}(_0x4a3d,0x79));var _0xd4a3=function(_0x5c2ea5,_0x3e01ec){_0x5c2ea5=_0x5c2ea5-0x0;var _0x55e6ef=_0x4a3d[_0x5c2ea5];return _0x55e6ef;};'use strict';var _=require(_0xd4a3('0x0'));var util=require(_0xd4a3('0x1'));var logger=require(_0xd4a3('0x2'))(_0xd4a3('0x3'));var moment=require(_0xd4a3('0x4'));var BPromise=require(_0xd4a3('0x5'));var rp=require(_0xd4a3('0x6'));var fs=require('fs');var path=require(_0xd4a3('0x7'));var rimraf=require(_0xd4a3('0x8'));var config=require(_0xd4a3('0x9'));var attributes=require(_0xd4a3('0xa'));module[_0xd4a3('0xb')]=function(_0x52ffaf,_0x523038){return _0x52ffaf[_0xd4a3('0xc')](_0xd4a3('0xd'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x915a=['moment','request-promise','../../config/environment','./variable.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0xa6adf5,_0x37a5bf){var _0x96981f=function(_0x47d9c7){while(--_0x47d9c7){_0xa6adf5['push'](_0xa6adf5['shift']());}};_0x96981f(++_0x37a5bf);}(_0x915a,0x1d2));var _0xa915=function(_0x4e652b,_0x40dc3f){_0x4e652b=_0x4e652b-0x0;var _0x2ccafe=_0x915a[_0x4e652b];return _0x2ccafe;};'use strict';var _=require(_0xa915('0x0'));var util=require(_0xa915('0x1'));var logger=require(_0xa915('0x2'))(_0xa915('0x3'));var moment=require(_0xa915('0x4'));var BPromise=require('bluebird');var rp=require(_0xa915('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa915('0x6'));var attributes=require(_0xa915('0x7'));module[_0xa915('0x8')]=function(_0xb6900c,_0x1ed01d){return _0xb6900c[_0xa915('0x9')]('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index df52700..64c3b7c 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 _0x94b0=['Variable','find','options','raw','where','map','include','model','attributes','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','Variable,\x20%s,\x20%s','message','result','catch','ShowVariable'];(function(_0x74745d,_0x177606){var _0x174ab3=function(_0x1c94e9){while(--_0x1c94e9){_0x74745d['push'](_0x74745d['shift']());}};_0x174ab3(++_0x177606);}(_0x94b0,0x11a));var _0x094b=function(_0x76a409,_0x2306c6){_0x76a409=_0x76a409-0x0;var _0x71f1ac=_0x94b0[_0x76a409];return _0x71f1ac;};'use strict';var _=require(_0x094b('0x0'));var util=require('util');var moment=require(_0x094b('0x1'));var BPromise=require(_0x094b('0x2'));var rs=require(_0x094b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x094b('0x4'))['db'];var utils=require(_0x094b('0x5'));var logger=require(_0x094b('0x6'))('rpc');var config=require(_0x094b('0x7'));var jayson=require(_0x094b('0x8'));var client=jayson[_0x094b('0x9')][_0x094b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf4e744,_0x19f0d1,_0x4ca365){return new BPromise(function(_0x1115fa,_0x110faa){return client[_0x094b('0xb')](_0xf4e744,_0x4ca365)[_0x094b('0xc')](function(_0x5888ce){logger[_0x094b('0xd')]('Variable,\x20%s,\x20%s',_0x19f0d1,_0x094b('0xe'));logger[_0x094b('0xf')](_0x094b('0x10'),_0x19f0d1,_0x094b('0xe'),JSON['stringify'](_0x5888ce));if(_0x5888ce[_0x094b('0x11')]){if(_0x5888ce[_0x094b('0x11')][_0x094b('0x12')]===0x1f4){logger[_0x094b('0x11')](_0x094b('0x13'),_0x19f0d1,_0x5888ce[_0x094b('0x11')][_0x094b('0x14')]);return _0x110faa(_0x5888ce[_0x094b('0x11')]['message']);}logger[_0x094b('0x11')](_0x094b('0x13'),_0x19f0d1,_0x5888ce[_0x094b('0x11')]['message']);return _0x1115fa(_0x5888ce[_0x094b('0x11')]['message']);}else{logger['info']('Variable,\x20%s,\x20%s',_0x19f0d1,_0x094b('0xe'));_0x1115fa(_0x5888ce[_0x094b('0x15')][_0x094b('0x14')]);}})[_0x094b('0x16')](function(_0x41b106){logger[_0x094b('0x11')](_0x094b('0x13'),_0x19f0d1,_0x41b106);_0x110faa(_0x41b106);});});}exports[_0x094b('0x17')]=function(_0xd985e4){var _0x295b49=this;return new Promise(function(_0x207274,_0x259d78){return db[_0x094b('0x18')][_0x094b('0x19')]({'raw':_0xd985e4[_0x094b('0x1a')]?_0xd985e4[_0x094b('0x1a')][_0x094b('0x1b')]===undefined?!![]:![]:!![],'where':_0xd985e4['options']?_0xd985e4[_0x094b('0x1a')][_0x094b('0x1c')]||null:null,'attributes':_0xd985e4[_0x094b('0x1a')]?_0xd985e4[_0x094b('0x1a')]['attributes']||null:null,'include':_0xd985e4[_0x094b('0x1a')]?_0xd985e4[_0x094b('0x1a')]['include']?_[_0x094b('0x1d')](_0xd985e4[_0x094b('0x1a')][_0x094b('0x1e')],function(_0x18c87a){return{'model':db[_0x18c87a[_0x094b('0x1f')]],'as':_0x18c87a['as'],'attributes':_0x18c87a[_0x094b('0x20')],'include':_0x18c87a['include']?_[_0x094b('0x1d')](_0x18c87a[_0x094b('0x1e')],function(_0x1fde0b){return{'model':db[_0x1fde0b[_0x094b('0x1f')]],'as':_0x1fde0b['as'],'attributes':_0x1fde0b[_0x094b('0x20')],'include':_0x1fde0b[_0x094b('0x1e')]?_['map'](_0x1fde0b[_0x094b('0x1e')],function(_0x84299c){return{'model':db[_0x84299c[_0x094b('0x1f')]],'as':_0x84299c['as'],'attributes':_0x84299c['attributes']};}):[]};}):[]};}):[]:[]})[_0x094b('0xc')](function(_0x407f34){logger[_0x094b('0xd')](_0x094b('0x17'),_0xd985e4);logger['debug'](_0x094b('0x17'),_0xd985e4,JSON[_0x094b('0x21')](_0x407f34));_0x207274(_0x407f34);})[_0x094b('0x16')](function(_0x31f984){logger[_0x094b('0x11')](_0x094b('0x17'),_0x31f984[_0x094b('0x14')],_0xd985e4);_0x259d78(_0x295b49[_0x094b('0x11')](0x1f4,_0x31f984['message']));});});}; \ No newline at end of file +var _0xc541=['Variable,\x20%s,\x20%s','message','result','catch','Variable','find','options','raw','where','attributes','include','model','map','ShowVariable','debug','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x4004ff,_0x199dde){var _0x1e23fb=function(_0x3e552a){while(--_0x3e552a){_0x4004ff['push'](_0x4004ff['shift']());}};_0x1e23fb(++_0x199dde);}(_0xc541,0x1ec));var _0x1c54=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0xc541[_0x510c60];return _0x49c4aa;};'use strict';var _=require(_0x1c54('0x0'));var util=require(_0x1c54('0x1'));var moment=require(_0x1c54('0x2'));var BPromise=require(_0x1c54('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c54('0x4'));var db=require(_0x1c54('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c54('0x6'))(_0x1c54('0x7'));var config=require(_0x1c54('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1c54('0x9')][_0x1c54('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x138408,_0x2a7ea1,_0x427be2){return new BPromise(function(_0x144a80,_0x1af595){return client[_0x1c54('0xb')](_0x138408,_0x427be2)[_0x1c54('0xc')](function(_0x1cbecc){logger[_0x1c54('0xd')]('Variable,\x20%s,\x20%s',_0x2a7ea1,'request\x20sent');logger['debug'](_0x1c54('0xe'),_0x2a7ea1,_0x1c54('0xf'),JSON['stringify'](_0x1cbecc));if(_0x1cbecc[_0x1c54('0x10')]){if(_0x1cbecc['error'][_0x1c54('0x11')]===0x1f4){logger[_0x1c54('0x10')](_0x1c54('0x12'),_0x2a7ea1,_0x1cbecc[_0x1c54('0x10')][_0x1c54('0x13')]);return _0x1af595(_0x1cbecc[_0x1c54('0x10')][_0x1c54('0x13')]);}logger['error']('Variable,\x20%s,\x20%s',_0x2a7ea1,_0x1cbecc['error'][_0x1c54('0x13')]);return _0x144a80(_0x1cbecc[_0x1c54('0x10')][_0x1c54('0x13')]);}else{logger[_0x1c54('0xd')](_0x1c54('0x12'),_0x2a7ea1,_0x1c54('0xf'));_0x144a80(_0x1cbecc[_0x1c54('0x14')]['message']);}})[_0x1c54('0x15')](function(_0x3508eb){logger[_0x1c54('0x10')]('Variable,\x20%s,\x20%s',_0x2a7ea1,_0x3508eb);_0x1af595(_0x3508eb);});});}exports['ShowVariable']=function(_0x1577a8){var _0x28dcf9=this;return new Promise(function(_0x59c07a,_0x19b1dd){return db[_0x1c54('0x16')][_0x1c54('0x17')]({'raw':_0x1577a8[_0x1c54('0x18')]?_0x1577a8[_0x1c54('0x18')][_0x1c54('0x19')]===undefined?!![]:![]:!![],'where':_0x1577a8[_0x1c54('0x18')]?_0x1577a8[_0x1c54('0x18')][_0x1c54('0x1a')]||null:null,'attributes':_0x1577a8[_0x1c54('0x18')]?_0x1577a8['options'][_0x1c54('0x1b')]||null:null,'include':_0x1577a8['options']?_0x1577a8[_0x1c54('0x18')]['include']?_['map'](_0x1577a8[_0x1c54('0x18')][_0x1c54('0x1c')],function(_0x49e0f5){return{'model':db[_0x49e0f5[_0x1c54('0x1d')]],'as':_0x49e0f5['as'],'attributes':_0x49e0f5['attributes'],'include':_0x49e0f5['include']?_['map'](_0x49e0f5['include'],function(_0x10b842){return{'model':db[_0x10b842[_0x1c54('0x1d')]],'as':_0x10b842['as'],'attributes':_0x10b842[_0x1c54('0x1b')],'include':_0x10b842[_0x1c54('0x1c')]?_[_0x1c54('0x1e')](_0x10b842['include'],function(_0x1e861e){return{'model':db[_0x1e861e[_0x1c54('0x1d')]],'as':_0x1e861e['as'],'attributes':_0x1e861e[_0x1c54('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1c54('0xc')](function(_0x26f11b){logger['info'](_0x1c54('0x1f'),_0x1577a8);logger[_0x1c54('0x20')](_0x1c54('0x1f'),_0x1577a8,JSON[_0x1c54('0x21')](_0x26f11b));_0x59c07a(_0x26f11b);})['catch'](function(_0x21e8a7){logger[_0x1c54('0x10')]('ShowVariable',_0x21e8a7['message'],_0x1577a8);_0x19b1dd(_0x28dcf9[_0x1c54('0x10')](0x1f4,_0x21e8a7[_0x1c54('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index bd320ad..5e83fdb 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 _0x430c=['isAuthenticated','canUpdate','reset','/migrations','exports','Router','./version.controller','get','index','/fetch'];(function(_0x31e543,_0x5163a1){var _0x1d373e=function(_0x2bb355){while(--_0x2bb355){_0x31e543['push'](_0x31e543['shift']());}};_0x1d373e(++_0x5163a1);}(_0x430c,0x177));var _0xc430=function(_0x5a5395,_0x5361f6){_0x5a5395=_0x5a5395-0x0;var _0x4da43d=_0x430c[_0x5a5395];return _0x4da43d;};'use strict';var express=require('express');var router=express[_0xc430('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xc430('0x1'));router[_0xc430('0x2')]('/',controller[_0xc430('0x3')]);router[_0xc430('0x2')](_0xc430('0x4'),auth[_0xc430('0x5')](),auth[_0xc430('0x6')](),controller['fetch']);router[_0xc430('0x2')]('/reset',auth[_0xc430('0x5')](),auth[_0xc430('0x6')](),controller[_0xc430('0x7')]);router[_0xc430('0x2')]('/pull',auth[_0xc430('0x5')](),auth['canUpdate'](),controller['pull']);router[_0xc430('0x2')]('/restart',auth[_0xc430('0x5')](),controller['restart']);router[_0xc430('0x2')](_0xc430('0x8'),controller['migrations']);module[_0xc430('0x9')]=router; \ No newline at end of file +var _0xd2ce=['./version.controller','get','index','/fetch','fetch','isAuthenticated','canUpdate','reset','/pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service'];(function(_0x50a964,_0x57e2f9){var _0x5e2b8b=function(_0x3216e3){while(--_0x3216e3){_0x50a964['push'](_0x50a964['shift']());}};_0x5e2b8b(++_0x57e2f9);}(_0xd2ce,0x151));var _0xed2c=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xd2ce[_0x1b349a];return _0x5d1f7c;};'use strict';var express=require(_0xed2c('0x0'));var router=express[_0xed2c('0x1')]();var auth=require(_0xed2c('0x2'));var controller=require(_0xed2c('0x3'));router[_0xed2c('0x4')]('/',controller[_0xed2c('0x5')]);router['get'](_0xed2c('0x6'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xed2c('0x7')]);router['get']('/reset',auth[_0xed2c('0x8')](),auth[_0xed2c('0x9')](),controller[_0xed2c('0xa')]);router['get'](_0xed2c('0xb'),auth[_0xed2c('0x8')](),auth['canUpdate'](),controller['pull']);router[_0xed2c('0x4')](_0xed2c('0xc'),auth[_0xed2c('0x8')](),controller[_0xed2c('0xd')]);router[_0xed2c('0x4')](_0xed2c('0xe'),controller[_0xed2c('0xf')]);module[_0xed2c('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 5fd629c..2fd23f4 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 _0x8506=['--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','error','restart','motion2','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','server','length','replace','.js','push','sort','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','Database\x20already\x20up-to-date','path','pkginfo','compare-versions','exec','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','root','exports','version','latest','fetch','tags','2.0.0','status','json','origin','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset'];(function(_0x23f739,_0x3048bf){var _0x56be94=function(_0x5af33b){while(--_0x5af33b){_0x23f739['push'](_0x23f739['shift']());}};_0x56be94(++_0x3048bf);}(_0x8506,0xe8));var _0x6850=function(_0x59182d,_0x54f085){_0x59182d=_0x59182d-0x0;var _0x3f7906=_0x8506[_0x59182d];return _0x3f7906;};'use strict';var Umzug=require('umzug');var path=require(_0x6850('0x0'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x6850('0x1'))(module,'version');var compareVersions=require(_0x6850('0x2'));var exec=require('child_process')[_0x6850('0x3')];var db=require(_0x6850('0x4'))['db'];var config=require(_0x6850('0x5'));var pm2=require('../../config/pm2');var logger=require(_0x6850('0x6'))(_0x6850('0x7'));var git=require(_0x6850('0x8'))(config[_0x6850('0x9')]);exports['index']=function(_0x51c0ad,_0x5466ee){var _0x117706={'current':module[_0x6850('0xa')][_0x6850('0xb')],'phonebar':0x2};if(_0x51c0ad['query']&&_0x51c0ad['query'][_0x6850('0xc')]){return git[_0x6850('0xd')]()[_0x6850('0xe')](function(_0x178197,_0xa24cab){_0x117706['latest']=(_0x178197?module[_0x6850('0xa')][_0x6850('0xb')]:_0xa24cab[_0x6850('0xc')])||_0x6850('0xf');return _0x5466ee[_0x6850('0x10')](0xc8)[_0x6850('0x11')](_0x117706);});}else{return _0x5466ee['status'](0xc8)[_0x6850('0x11')](_0x117706);}};exports[_0x6850('0xd')]=function(_0x3b4dc5,_0x774bc5){return git[_0x6850('0xd')]([_0x6850('0x12'),'master'],function(_0x223e40){if(_0x223e40){logger['error'](_0x223e40);return _0x774bc5[_0x6850('0x10')](0x1f4)[_0x6850('0x11')](_0x223e40);}logger[_0x6850('0x13')](_0x6850('0x14'));return _0x774bc5[_0x6850('0x10')](0xc8)[_0x6850('0x11')]({'output':_0x6850('0x15')});});};exports[_0x6850('0x16')]=function(_0x426c0a,_0x441f79){return git[_0x6850('0x16')]([_0x6850('0x17'),_0x6850('0x18')],function(_0x1bd938){if(_0x1bd938){logger['error'](_0x1bd938);return _0x441f79['status'](0x1f4)[_0x6850('0x11')](_0x1bd938);}logger[_0x6850('0x13')](_0x6850('0x19'));return _0x441f79[_0x6850('0x10')](0xc8)[_0x6850('0x11')]({'output':_0x6850('0x1a')});});};exports['pull']=function(_0x1e6e90,_0x343825){exec(_0x6850('0x1b'),function(_0x40f659,_0x2978a1,_0x173537){logger[_0x6850('0x13')](_0x2978a1);logger[_0x6850('0x13')](_0x173537);if(_0x40f659){logger[_0x6850('0x1c')](_0x40f659);return _0x343825[_0x6850('0x10')](0x1f4)[_0x6850('0x11')](_0x40f659);}return _0x343825[_0x6850('0x10')](0xc8)[_0x6850('0x11')]({'output':_0x2978a1});});};exports[_0x6850('0x1d')]=function(_0x46a82d,_0xeef1ff){return pm2['restart'](_0x6850('0x1e'))['then'](function(_0x51f7ec){logger[_0x6850('0x13')](_0x6850('0x1f'),_0x51f7ec);return _0xeef1ff[_0x6850('0x10')](0xc8)[_0x6850('0x11')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x6850('0x20')](function(_0x1cf6db){logger['error'](_0x1cf6db);return _0xeef1ff[_0x6850('0x10')](0x1f4)[_0x6850('0x11')](_0x1cf6db);});};exports[_0x6850('0x21')]=function(_0x97f08f,_0x5428d1){var _0x2230ca=fs[_0x6850('0x22')](path['join'](config['root'],_0x6850('0x23'),_0x6850('0x21')));var _0x5d25a5=[];for(var _0xc5d8a9=0x0;_0xc5d8a9<_0x2230ca[_0x6850('0x24')];_0xc5d8a9++){var _0x29fc20=_0x2230ca[_0xc5d8a9][_0x6850('0x25')](_0x6850('0x26'),'');if(compareVersions(module[_0x6850('0xa')][_0x6850('0xb')],_0x29fc20)===-0x1){_0x5d25a5[_0x6850('0x27')](_0x29fc20);}}if(_0x5d25a5['length']){var _0x58ef15=_0x5d25a5[_0x6850('0x28')](compareVersions);var _0x341b06=new Umzug({'storage':_0x6850('0x29'),'storageOptions':{'model':db[_0x6850('0x2a')],'modelName':_0x6850('0x2a'),'columnName':_0x6850('0xb')},'migrations':{'params':[db[_0x6850('0x29')]['getQueryInterface'](),db[_0x6850('0x29')][_0x6850('0x2b')],function(){throw new Error(_0x6850('0x2c'));}],'path':path[_0x6850('0x2d')](config[_0x6850('0x9')],_0x6850('0x23'),_0x6850('0x21')),'pattern':/\.js$/}});_0x341b06['up']({'migrations':_[_0x6850('0x2e')](_0x58ef15,function(_0x490589){return _0x490589+_0x6850('0x26');})})[_0x6850('0x2f')](function(){return _0x5428d1[_0x6850('0x10')](0xc8)['json']({'output':_0x6850('0x30')+module['exports'][_0x6850('0xb')]+_0x6850('0x31')+_['last'](_0x58ef15),'migrations':_[_0x6850('0x2d')](_0x58ef15)});})[_0x6850('0x20')](function(_0x259b7d){if(_0x259b7d instanceof db['sequelize']['UniqueConstraintError']){return _0x5428d1[_0x6850('0x10')](0xc8)[_0x6850('0x11')]({'output':_0x6850('0x32')});}else{return _0x5428d1['status'](0x1f4)[_0x6850('0x11')](_0x259b7d);}});}else{return _0x5428d1['status'](0xc8)[_0x6850('0x11')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0xeda7=['Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','then','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','fetch','tags','latest','2.0.0','status','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','json','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','constructor'];(function(_0x55a48d,_0x5a5ed5){var _0x5bc872=function(_0x487b26){while(--_0x487b26){_0x55a48d['push'](_0x55a48d['shift']());}};_0x5bc872(++_0x5a5ed5);}(_0xeda7,0x196));var _0x7eda=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xeda7[_0x5f1391];return _0x50ebe3;};'use strict';var Umzug=require(_0x7eda('0x0'));var path=require(_0x7eda('0x1'));var fs=require('fs');var _=require(_0x7eda('0x2'));var pkginfo=require(_0x7eda('0x3'))(module,_0x7eda('0x4'));var compareVersions=require(_0x7eda('0x5'));var exec=require(_0x7eda('0x6'))[_0x7eda('0x7')];var db=require(_0x7eda('0x8'))['db'];var config=require(_0x7eda('0x9'));var pm2=require(_0x7eda('0xa'));var logger=require(_0x7eda('0xb'))(_0x7eda('0xc'));var git=require(_0x7eda('0xd'))(config[_0x7eda('0xe')]);exports[_0x7eda('0xf')]=function(_0x163427,_0x2bc200){var _0x11576a={'current':module[_0x7eda('0x10')]['version'],'phonebar':0x2};if(_0x163427[_0x7eda('0x11')]&&_0x163427['query']['latest']){return git[_0x7eda('0x12')]()[_0x7eda('0x13')](function(_0x3dfcdb,_0x17b2a9){_0x11576a['latest']=(_0x3dfcdb?module['exports'][_0x7eda('0x4')]:_0x17b2a9[_0x7eda('0x14')])||_0x7eda('0x15');return _0x2bc200[_0x7eda('0x16')](0xc8)['json'](_0x11576a);});}else{return _0x2bc200[_0x7eda('0x16')](0xc8)['json'](_0x11576a);}};exports[_0x7eda('0x12')]=function(_0x406ee0,_0x1353e7){return git[_0x7eda('0x12')]([_0x7eda('0x17'),_0x7eda('0x18')],function(_0x951dfa){if(_0x951dfa){logger[_0x7eda('0x19')](_0x951dfa);return _0x1353e7[_0x7eda('0x16')](0x1f4)['json'](_0x951dfa);}logger['info'](_0x7eda('0x1a'));return _0x1353e7['status'](0xc8)['json']({'output':_0x7eda('0x1b')});});};exports[_0x7eda('0x1c')]=function(_0x97792c,_0x8a1a07){return git[_0x7eda('0x1c')](['--hard','FETCH_HEAD'],function(_0x5dc833){if(_0x5dc833){logger[_0x7eda('0x19')](_0x5dc833);return _0x8a1a07['status'](0x1f4)[_0x7eda('0x1d')](_0x5dc833);}logger[_0x7eda('0x1e')](_0x7eda('0x1f'));return _0x8a1a07[_0x7eda('0x16')](0xc8)['json']({'output':_0x7eda('0x20')});});};exports[_0x7eda('0x21')]=function(_0x3d73ce,_0x35be2c){exec('npm\x20install\x20--production',function(_0x5f0965,_0x1dddc1,_0x58c409){logger[_0x7eda('0x1e')](_0x1dddc1);logger[_0x7eda('0x1e')](_0x58c409);if(_0x5f0965){logger[_0x7eda('0x19')](_0x5f0965);return _0x35be2c[_0x7eda('0x16')](0x1f4)[_0x7eda('0x1d')](_0x5f0965);}return _0x35be2c[_0x7eda('0x16')](0xc8)[_0x7eda('0x1d')]({'output':_0x1dddc1});});};exports[_0x7eda('0x22')]=function(_0x58869c,_0x16cda7){return pm2[_0x7eda('0x22')](_0x7eda('0x23'))['then'](function(_0x30fc8e){logger[_0x7eda('0x1e')](_0x7eda('0x24'),_0x30fc8e);return _0x16cda7[_0x7eda('0x16')](0xc8)[_0x7eda('0x1d')]({'output':_0x7eda('0x25')});})[_0x7eda('0x26')](function(_0x241b6f){logger[_0x7eda('0x19')](_0x241b6f);return _0x16cda7[_0x7eda('0x16')](0x1f4)['json'](_0x241b6f);});};exports[_0x7eda('0x27')]=function(_0x3e1a08,_0x300e20){var _0x2c5af0=fs['readdirSync'](path[_0x7eda('0x28')](config[_0x7eda('0xe')],'server',_0x7eda('0x27')));var _0x4655a9=[];for(var _0x4adb03=0x0;_0x4adb03<_0x2c5af0[_0x7eda('0x29')];_0x4adb03++){var _0x24db5a=_0x2c5af0[_0x4adb03][_0x7eda('0x2a')](_0x7eda('0x2b'),'');if(compareVersions(module[_0x7eda('0x10')][_0x7eda('0x4')],_0x24db5a)===-0x1){_0x4655a9[_0x7eda('0x2c')](_0x24db5a);}}if(_0x4655a9[_0x7eda('0x29')]){var _0xac4dc7=_0x4655a9[_0x7eda('0x2d')](compareVersions);var _0x516b44=new Umzug({'storage':_0x7eda('0x2e'),'storageOptions':{'model':db['Migration'],'modelName':_0x7eda('0x2f'),'columnName':_0x7eda('0x4')},'migrations':{'params':[db[_0x7eda('0x2e')][_0x7eda('0x30')](),db['sequelize'][_0x7eda('0x31')],function(){throw new Error(_0x7eda('0x32'));}],'path':path[_0x7eda('0x28')](config['root'],_0x7eda('0x33'),_0x7eda('0x27')),'pattern':/\.js$/}});_0x516b44['up']({'migrations':_[_0x7eda('0x34')](_0xac4dc7,function(_0x5e050f){return _0x5e050f+_0x7eda('0x2b');})})[_0x7eda('0x35')](function(){return _0x300e20[_0x7eda('0x16')](0xc8)[_0x7eda('0x1d')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x7eda('0x10')][_0x7eda('0x4')]+'\x20to\x20'+_[_0x7eda('0x36')](_0xac4dc7),'migrations':_[_0x7eda('0x28')](_0xac4dc7)});})[_0x7eda('0x26')](function(_0x138644){if(_0x138644 instanceof db['sequelize'][_0x7eda('0x37')]){return _0x300e20[_0x7eda('0x16')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x300e20[_0x7eda('0x16')](0x1f4)[_0x7eda('0x1d')](_0x138644);}});}else{return _0x300e20['status'](0xc8)[_0x7eda('0x1d')]({'output':_0x7eda('0x38')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 631505d..915018f 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 _0x534f=['/:id','post','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','/describe','isAuthenticated','describe'];(function(_0x381fa6,_0x5532d9){var _0x488bb5=function(_0x271fc9){while(--_0x271fc9){_0x381fa6['push'](_0x381fa6['shift']());}};_0x488bb5(++_0x5532d9);}(_0x534f,0xcc));var _0xf534=function(_0x14852f,_0x3c79f8){_0x14852f=_0x14852f-0x0;var _0x46cf14=_0x534f[_0x14852f];return _0x46cf14;};'use strict';var multer=require(_0xf534('0x0'));var util=require(_0xf534('0x1'));var path=require(_0xf534('0x2'));var timeout=require(_0xf534('0x3'));var express=require('express');var router=express[_0xf534('0x4')]();var auth=require(_0xf534('0x5'));var interaction=require(_0xf534('0x6'));var config=require('../../config/environment');var controller=require(_0xf534('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf534('0x8')](_0xf534('0x9'),auth[_0xf534('0xa')](),controller[_0xf534('0xb')]);router[_0xf534('0x8')](_0xf534('0xc'),auth[_0xf534('0xa')](),controller['show']);router[_0xf534('0xd')]('/',auth[_0xf534('0xa')](),controller['create']);router['put'](_0xf534('0xc'),auth[_0xf534('0xa')](),controller[_0xf534('0xe')]);router[_0xf534('0xf')](_0xf534('0xc'),auth[_0xf534('0xa')](),controller[_0xf534('0x10')]);module[_0xf534('0x11')]=router; \ No newline at end of file +var _0xe1ab=['../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','get','/describe','describe','show','create','put','/:id','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x186226,_0x1327d7){var _0x4ece60=function(_0x4505f0){while(--_0x4505f0){_0x186226['push'](_0x186226['shift']());}};_0x4ece60(++_0x1327d7);}(_0xe1ab,0x79));var _0xbe1a=function(_0x170772,_0x1f1ee7){_0x170772=_0x170772-0x0;var _0x3ef69c=_0xe1ab[_0x170772];return _0x3ef69c;};'use strict';var multer=require(_0xbe1a('0x0'));var util=require(_0xbe1a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe1a('0x2'));var router=express[_0xbe1a('0x3')]();var auth=require(_0xbe1a('0x4'));var interaction=require(_0xbe1a('0x5'));var config=require(_0xbe1a('0x6'));var controller=require(_0xbe1a('0x7'));router['get']('/',auth[_0xbe1a('0x8')](),controller[_0xbe1a('0x9')]);router[_0xbe1a('0xa')](_0xbe1a('0xb'),auth['isAuthenticated'](),controller[_0xbe1a('0xc')]);router[_0xbe1a('0xa')]('/:id',auth[_0xbe1a('0x8')](),controller[_0xbe1a('0xd')]);router['post']('/',auth[_0xbe1a('0x8')](),controller[_0xbe1a('0xe')]);router[_0xbe1a('0xf')](_0xbe1a('0x10'),auth[_0xbe1a('0x8')](),controller[_0xbe1a('0x11')]);router[_0xbe1a('0x12')](_0xbe1a('0x10'),auth[_0xbe1a('0x8')](),controller[_0xbe1a('0x13')]);module[_0xbe1a('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 66e8969..dd0a7c6 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 _0xed1f=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xed1f,0x6a));var _0xfed1=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xed1f[_0x2080a3];return _0x8d7d17;};'use strict';var Sequelize=require(_0xfed1('0x0'));module[_0xfed1('0x1')]={'type':{'type':Sequelize[_0xfed1('0x2')]},'uniqueid':{'type':Sequelize[_0xfed1('0x2')]},'calleridnum':{'type':Sequelize[_0xfed1('0x2')]},'calleridname':{'type':Sequelize[_0xfed1('0x2')]},'queue':{'type':Sequelize[_0xfed1('0x2')]},'interface':{'type':Sequelize[_0xfed1('0x2')]},'membername':{'type':Sequelize[_0xfed1('0x2')]},'agentcalledAt':{'type':Sequelize[_0xfed1('0x3')]},'agentconnectAt':{'type':Sequelize[_0xfed1('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xfed1('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xfed1('0x3')]},'agentdumpAt':{'type':Sequelize[_0xfed1('0x3')]},'holdtime':{'type':Sequelize[_0xfed1('0x4')]},'agentcomplete':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xfed1('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xfed1('0x2')]},'channel':{'type':Sequelize[_0xfed1('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xfed1('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xfed1('0x2')]},'language':{'type':Sequelize[_0xfed1('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xfed1('0x2')]},'priority':{'type':Sequelize[_0xfed1('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xfed1('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xfed1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xfed1('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xfed1('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xfed1('0x2')]},'destpriority':{'type':Sequelize[_0xfed1('0x2')]},'destuniqueid':{'type':Sequelize[_0xfed1('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xfed1('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xfed1('0x6')},'transferexten':{'type':Sequelize[_0xfed1('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xfed1('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x31f0=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x31f0,0xb7));var _0x031f=function(_0x190a4e,_0x1999ae){_0x190a4e=_0x190a4e-0x0;var _0x2b5bbc=_0x31f0[_0x190a4e];return _0x2b5bbc;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'type':{'type':Sequelize[_0x031f('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x031f('0x1')]},'calleridname':{'type':Sequelize[_0x031f('0x1')]},'queue':{'type':Sequelize[_0x031f('0x1')]},'interface':{'type':Sequelize[_0x031f('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x031f('0x2')]},'agentconnectAt':{'type':Sequelize[_0x031f('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x031f('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x031f('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x031f('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x031f('0x3')]},'agentacw':{'type':Sequelize[_0x031f('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x031f('0x1')]},'lastevent':{'type':Sequelize[_0x031f('0x1')]},'channel':{'type':Sequelize[_0x031f('0x1')]},'channelstate':{'type':Sequelize[_0x031f('0x3')]},'channelstatedesc':{'type':Sequelize[_0x031f('0x1')]},'connectedlinenum':{'type':Sequelize[_0x031f('0x1')]},'connectedlinename':{'type':Sequelize[_0x031f('0x1')]},'language':{'type':Sequelize[_0x031f('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x031f('0x1')]},'exten':{'type':Sequelize[_0x031f('0x1')]},'priority':{'type':Sequelize[_0x031f('0x1')]},'destchannel':{'type':Sequelize[_0x031f('0x1')]},'destchannelstate':{'type':Sequelize[_0x031f('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x031f('0x1')]},'destcalleridnum':{'type':Sequelize[_0x031f('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x031f('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x031f('0x1')]},'destlanguage':{'type':Sequelize[_0x031f('0x1')]},'destaccountcode':{'type':Sequelize[_0x031f('0x1')]},'destcontext':{'type':Sequelize[_0x031f('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x031f('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x031f('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x031f('0x1')]},'transfer':{'type':Sequelize[_0x031f('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x031f('0x5')},'transferexten':{'type':Sequelize[_0x031f('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x031f('0x3')],'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 cfd4c45..532215c 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 _0x3cb9=['../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','error','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','find','create','body','params','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3cb9,0x79));var _0x93cb=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x3cb9[_0x341e0f];return _0x59555a;};'use strict';var pdf=require(_0x93cb('0x0'));var emlformat=require(_0x93cb('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x93cb('0x2'));var rp=require(_0x93cb('0x3'));var moment=require(_0x93cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x93cb('0x5'));var util=require(_0x93cb('0x6'));var path=require(_0x93cb('0x7'));var sox=require('sox');var csv=require(_0x93cb('0x8'));var ejs=require(_0x93cb('0x9'));var fs=require('fs');var _=require(_0x93cb('0xa'));var squel=require('squel');var crypto=require(_0x93cb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x93cb('0xc'));var toCsv=require(_0x93cb('0x8'));var querystring=require(_0x93cb('0xd'));var Papa=require('papaparse');var Redis=require(_0x93cb('0xe'));var authService=require(_0x93cb('0xf'));var qs=require(_0x93cb('0x10'));var as=require(_0x93cb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x93cb('0x12'))(_0x93cb('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x93cb('0x14'))['db'];function respondWithStatusCode(_0x196740,_0x379671){_0x379671=_0x379671||0xcc;return function(_0x32e67a){if(_0x32e67a){return _0x196740[_0x93cb('0x15')](_0x379671);}return _0x196740[_0x93cb('0x16')](_0x379671)[_0x93cb('0x17')]();};}function respondWithResult(_0x3aae66,_0x391677){_0x391677=_0x391677||0xc8;return function(_0x195351){if(_0x195351){return _0x3aae66[_0x93cb('0x16')](_0x391677)[_0x93cb('0x18')](_0x195351);}};}function respondWithFilteredResult(_0x2c5be0,_0x4becaa){return function(_0x24bc94){if(_0x24bc94){var _0x3d91dc=_0x24bc94[_0x93cb('0x19')],_0x1d794d=_0x4becaa[_0x93cb('0x1a')],_0x59b45d=_0x4becaa[_0x93cb('0x1a')]+_0x4becaa[_0x93cb('0x1b')],_0xa5d3b1;if(_0x59b45d>=_0x3d91dc){_0x59b45d=_0x3d91dc;_0xa5d3b1=0xc8;}else{_0xa5d3b1=0xce;}_0x2c5be0[_0x93cb('0x16')](_0xa5d3b1);return _0x2c5be0[_0x93cb('0x1c')]('Content-Range',_0x1d794d+'-'+_0x59b45d+'/'+_0x3d91dc)[_0x93cb('0x18')](_0x24bc94);}return null;};}function patchUpdates(_0x5bd0c8){return function(_0x34de5d){try{jsonpatch[_0x93cb('0x1d')](_0x34de5d,_0x5bd0c8,!![]);}catch(_0x19c22a){return BPromise['reject'](_0x19c22a);}return _0x34de5d[_0x93cb('0x1e')]();};}function saveUpdates(_0x5ba942,_0x11b3d0){return function(_0x3a7452){if(_0x3a7452){return _0x3a7452[_0x93cb('0x1f')](_0x5ba942)[_0x93cb('0x20')](function(_0x5acc40){return _0x5acc40;});}return null;};}function removeEntity(_0x263c90,_0x52bd2e){return function(_0x35035c){if(_0x35035c){return _0x35035c[_0x93cb('0x21')]()['then'](function(){_0x263c90[_0x93cb('0x16')](0xcc)[_0x93cb('0x17')]();});}};}function handleEntityNotFound(_0x54099c,_0x110f7a){return function(_0x1bb551){if(!_0x1bb551){_0x54099c[_0x93cb('0x15')](0x194);}return _0x1bb551;};}function handleError(_0x347eef,_0x14957a){_0x14957a=_0x14957a||0x1f4;return function(_0x53abb3){logger[_0x93cb('0x22')](_0x53abb3['stack']);if(_0x53abb3[_0x93cb('0x23')]){delete _0x53abb3['name'];}_0x347eef[_0x93cb('0x16')](_0x14957a)[_0x93cb('0x24')](_0x53abb3);};}exports[_0x93cb('0x25')]=function(_0xe32990,_0x4f836f){var _0x14b75f={},_0x465271={},_0x4cb8f8={'count':0x0,'rows':[]};var _0x585dd9=_['map'](db[_0x93cb('0x26')][_0x93cb('0x27')],function(_0x5943ed){return{'name':_0x5943ed[_0x93cb('0x28')],'type':_0x5943ed['type'][_0x93cb('0x29')]};});_0x465271[_0x93cb('0x2a')]=_[_0x93cb('0x2b')](_0x585dd9,_0x93cb('0x23'));_0x465271[_0x93cb('0x2c')]=_[_0x93cb('0x2d')](_0xe32990[_0x93cb('0x2c')]);_0x465271['filters']=_['intersection'](_0x465271[_0x93cb('0x2a')],_0x465271[_0x93cb('0x2c')]);_0x14b75f['attributes']=_[_0x93cb('0x2e')](_0x465271[_0x93cb('0x2a')],qs[_0x93cb('0x2f')](_0xe32990[_0x93cb('0x2c')]['fields']));_0x14b75f[_0x93cb('0x30')]=_0x14b75f[_0x93cb('0x30')][_0x93cb('0x31')]?_0x14b75f[_0x93cb('0x30')]:_0x465271[_0x93cb('0x2a')];if(!_0xe32990[_0x93cb('0x2c')][_0x93cb('0x32')](_0x93cb('0x33'))){_0x14b75f[_0x93cb('0x1b')]=qs[_0x93cb('0x1b')](_0xe32990[_0x93cb('0x2c')][_0x93cb('0x1b')]);_0x14b75f[_0x93cb('0x1a')]=qs[_0x93cb('0x1a')](_0xe32990['query'][_0x93cb('0x1a')]);}_0x14b75f[_0x93cb('0x34')]=qs[_0x93cb('0x35')](_0xe32990[_0x93cb('0x2c')][_0x93cb('0x35')]);_0x14b75f[_0x93cb('0x36')]=qs[_0x93cb('0x37')](_[_0x93cb('0x38')](_0xe32990[_0x93cb('0x2c')],_0x465271[_0x93cb('0x37')]));if(_0xe32990[_0x93cb('0x2c')][_0x93cb('0x39')]){_0x14b75f[_0x93cb('0x36')]=_[_0x93cb('0x3a')](_0x14b75f[_0x93cb('0x36')],{'$or':_['map'](_0x585dd9,function(_0x4ee4a8){if(_0x4ee4a8['type']!=='VIRTUAL'){var _0x27170e={};_0x27170e[_0x4ee4a8['name']]={'$like':'%'+_0xe32990[_0x93cb('0x2c')][_0x93cb('0x39')]+'%'};return _0x27170e;}})});}_0x14b75f=_['merge']({},_0x14b75f,_0xe32990[_0x93cb('0x3b')]);var _0x1d25a2={'where':_0x14b75f[_0x93cb('0x36')]};return db[_0x93cb('0x26')]['count'](_0x1d25a2)[_0x93cb('0x20')](function(_0x3e0411){_0x4cb8f8[_0x93cb('0x19')]=_0x3e0411;if(_0xe32990[_0x93cb('0x2c')][_0x93cb('0x3c')]){_0x14b75f[_0x93cb('0x3d')]=[{'all':!![]}];}return db[_0x93cb('0x26')]['findAll'](_0x14b75f);})[_0x93cb('0x20')](function(_0x1ed78f){_0x4cb8f8[_0x93cb('0x3e')]=_0x1ed78f;return _0x4cb8f8;})['then'](respondWithFilteredResult(_0x4f836f,_0x14b75f))[_0x93cb('0x3f')](handleError(_0x4f836f,null));};exports['show']=function(_0x2cec06,_0x23860f){var _0x57d2a9={'raw':![],'where':{'id':_0x2cec06['params']['id']}},_0x15a410={};_0x15a410[_0x93cb('0x2a')]=_['keys'](db[_0x93cb('0x26')]['rawAttributes']);_0x15a410[_0x93cb('0x2c')]=_[_0x93cb('0x2d')](_0x2cec06[_0x93cb('0x2c')]);_0x15a410[_0x93cb('0x37')]=_['intersection'](_0x15a410['model'],_0x15a410['query']);_0x57d2a9[_0x93cb('0x30')]=_[_0x93cb('0x2e')](_0x15a410[_0x93cb('0x2a')],qs[_0x93cb('0x2f')](_0x2cec06['query'][_0x93cb('0x2f')]));_0x57d2a9['attributes']=_0x57d2a9[_0x93cb('0x30')][_0x93cb('0x31')]?_0x57d2a9[_0x93cb('0x30')]:_0x15a410[_0x93cb('0x2a')];if(_0x2cec06[_0x93cb('0x2c')][_0x93cb('0x3c')]){_0x57d2a9[_0x93cb('0x3d')]=[{'all':!![]}];}_0x57d2a9=_['merge']({},_0x57d2a9,_0x2cec06['options']);return db['VoiceAgentReport'][_0x93cb('0x40')](_0x57d2a9)[_0x93cb('0x20')](handleEntityNotFound(_0x23860f,null))[_0x93cb('0x20')](respondWithResult(_0x23860f,null))['catch'](handleError(_0x23860f,null));};exports[_0x93cb('0x41')]=function(_0x5b6e4a,_0x5dbfc4){return db[_0x93cb('0x26')]['create'](_0x5b6e4a['body'],{})[_0x93cb('0x20')](respondWithResult(_0x5dbfc4,0xc9))[_0x93cb('0x3f')](handleError(_0x5dbfc4,null));};exports[_0x93cb('0x1f')]=function(_0x258804,_0x527786){if(_0x258804['body']['id']){delete _0x258804[_0x93cb('0x42')]['id'];}return db[_0x93cb('0x26')][_0x93cb('0x40')]({'where':{'id':_0x258804[_0x93cb('0x43')]['id']}})[_0x93cb('0x20')](handleEntityNotFound(_0x527786,null))[_0x93cb('0x20')](saveUpdates(_0x258804[_0x93cb('0x42')],null))['then'](respondWithResult(_0x527786,null))['catch'](handleError(_0x527786,null));};exports[_0x93cb('0x21')]=function(_0x2ea1f5,_0x58eff9){return db[_0x93cb('0x26')][_0x93cb('0x40')]({'where':{'id':_0x2ea1f5[_0x93cb('0x43')]['id']}})[_0x93cb('0x20')](handleEntityNotFound(_0x58eff9,null))[_0x93cb('0x20')](removeEntity(_0x58eff9,null))['catch'](handleError(_0x58eff9,null));};exports[_0x93cb('0x44')]=function(_0x2ad526,_0xcbdf32){return db[_0x93cb('0x26')][_0x93cb('0x44')]()['then'](respondWithResult(_0xcbdf32,null))[_0x93cb('0x3f')](handleError(_0xcbdf32,null));}; \ No newline at end of file +var _0x2b55=['hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','update','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length'];(function(_0xd065d0,_0x407664){var _0x5e1b10=function(_0x14889d){while(--_0x14889d){_0xd065d0['push'](_0xd065d0['shift']());}};_0x5e1b10(++_0x407664);}(_0x2b55,0x1f0));var _0x52b5=function(_0x5ab335,_0x2c0183){_0x5ab335=_0x5ab335-0x0;var _0x2471c6=_0x2b55[_0x5ab335];return _0x2471c6;};'use strict';var pdf=require(_0x52b5('0x0'));var emlformat=require(_0x52b5('0x1'));var rimraf=require(_0x52b5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x52b5('0x3'));var rp=require(_0x52b5('0x4'));var moment=require('moment');var BPromise=require(_0x52b5('0x5'));var Mustache=require(_0x52b5('0x6'));var util=require(_0x52b5('0x7'));var path=require(_0x52b5('0x8'));var sox=require(_0x52b5('0x9'));var csv=require('to-csv');var ejs=require(_0x52b5('0xa'));var fs=require('fs');var _=require(_0x52b5('0xb'));var squel=require(_0x52b5('0xc'));var crypto=require(_0x52b5('0xd'));var jsforce=require(_0x52b5('0xe'));var deskjs=require(_0x52b5('0xf'));var toCsv=require(_0x52b5('0x10'));var querystring=require(_0x52b5('0x11'));var Papa=require(_0x52b5('0x12'));var Redis=require(_0x52b5('0x13'));var authService=require(_0x52b5('0x14'));var qs=require(_0x52b5('0x15'));var as=require(_0x52b5('0x16'));var hardwareService=require(_0x52b5('0x17'));var logger=require(_0x52b5('0x18'))('api');var utils=require(_0x52b5('0x19'));var config=require(_0x52b5('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ec257,_0x29680c){_0x29680c=_0x29680c||0xcc;return function(_0x23cf09){if(_0x23cf09){return _0x1ec257[_0x52b5('0x1b')](_0x29680c);}return _0x1ec257[_0x52b5('0x1c')](_0x29680c)[_0x52b5('0x1d')]();};}function respondWithResult(_0x152f71,_0x5dbe66){_0x5dbe66=_0x5dbe66||0xc8;return function(_0x20f22e){if(_0x20f22e){return _0x152f71[_0x52b5('0x1c')](_0x5dbe66)[_0x52b5('0x1e')](_0x20f22e);}};}function respondWithFilteredResult(_0x1aa68f,_0x4bc5e2){return function(_0x48efe3){if(_0x48efe3){var _0x35d016=_0x48efe3[_0x52b5('0x1f')],_0x46fe96=_0x4bc5e2[_0x52b5('0x20')],_0x1cf6e9=_0x4bc5e2['offset']+_0x4bc5e2[_0x52b5('0x21')],_0x544355;if(_0x1cf6e9>=_0x35d016){_0x1cf6e9=_0x35d016;_0x544355=0xc8;}else{_0x544355=0xce;}_0x1aa68f[_0x52b5('0x1c')](_0x544355);return _0x1aa68f[_0x52b5('0x22')](_0x52b5('0x23'),_0x46fe96+'-'+_0x1cf6e9+'/'+_0x35d016)[_0x52b5('0x1e')](_0x48efe3);}return null;};}function patchUpdates(_0x238da6){return function(_0x53c58e){try{jsonpatch[_0x52b5('0x24')](_0x53c58e,_0x238da6,!![]);}catch(_0x1cb2b3){return BPromise[_0x52b5('0x25')](_0x1cb2b3);}return _0x53c58e[_0x52b5('0x26')]();};}function saveUpdates(_0x2132ee,_0x1e4bad){return function(_0x57a730){if(_0x57a730){return _0x57a730['update'](_0x2132ee)[_0x52b5('0x27')](function(_0x1f71f5){return _0x1f71f5;});}return null;};}function removeEntity(_0x11ee39,_0x26afa5){return function(_0x168273){if(_0x168273){return _0x168273['destroy']()[_0x52b5('0x27')](function(){_0x11ee39[_0x52b5('0x1c')](0xcc)[_0x52b5('0x1d')]();});}};}function handleEntityNotFound(_0x451c5b,_0x39d109){return function(_0x1b6254){if(!_0x1b6254){_0x451c5b['sendStatus'](0x194);}return _0x1b6254;};}function handleError(_0x38411f,_0x528539){_0x528539=_0x528539||0x1f4;return function(_0x13ce54){logger[_0x52b5('0x28')](_0x13ce54[_0x52b5('0x29')]);if(_0x13ce54[_0x52b5('0x2a')]){delete _0x13ce54[_0x52b5('0x2a')];}_0x38411f[_0x52b5('0x1c')](_0x528539)[_0x52b5('0x2b')](_0x13ce54);};}exports[_0x52b5('0x2c')]=function(_0x34e12f,_0x483bad){var _0xcbe829={},_0x3a6b82={},_0x4a4f53={'count':0x0,'rows':[]};var _0x203dca=_['map'](db[_0x52b5('0x2d')][_0x52b5('0x2e')],function(_0xa594be){return{'name':_0xa594be[_0x52b5('0x2f')],'type':_0xa594be[_0x52b5('0x30')][_0x52b5('0x31')]};});_0x3a6b82['model']=_['map'](_0x203dca,_0x52b5('0x2a'));_0x3a6b82['query']=_[_0x52b5('0x32')](_0x34e12f[_0x52b5('0x33')]);_0x3a6b82['filters']=_[_0x52b5('0x34')](_0x3a6b82[_0x52b5('0x35')],_0x3a6b82[_0x52b5('0x33')]);_0xcbe829[_0x52b5('0x36')]=_[_0x52b5('0x34')](_0x3a6b82[_0x52b5('0x35')],qs[_0x52b5('0x37')](_0x34e12f[_0x52b5('0x33')][_0x52b5('0x37')]));_0xcbe829[_0x52b5('0x36')]=_0xcbe829[_0x52b5('0x36')][_0x52b5('0x38')]?_0xcbe829['attributes']:_0x3a6b82[_0x52b5('0x35')];if(!_0x34e12f['query'][_0x52b5('0x39')](_0x52b5('0x3a'))){_0xcbe829['limit']=qs[_0x52b5('0x21')](_0x34e12f[_0x52b5('0x33')][_0x52b5('0x21')]);_0xcbe829['offset']=qs['offset'](_0x34e12f['query'][_0x52b5('0x20')]);}_0xcbe829[_0x52b5('0x3b')]=qs['sort'](_0x34e12f[_0x52b5('0x33')][_0x52b5('0x3c')]);_0xcbe829['where']=qs[_0x52b5('0x3d')](_[_0x52b5('0x3e')](_0x34e12f[_0x52b5('0x33')],_0x3a6b82[_0x52b5('0x3d')]));if(_0x34e12f[_0x52b5('0x33')][_0x52b5('0x3f')]){_0xcbe829[_0x52b5('0x40')]=_[_0x52b5('0x41')](_0xcbe829[_0x52b5('0x40')],{'$or':_['map'](_0x203dca,function(_0x244cce){if(_0x244cce['type']!==_0x52b5('0x42')){var _0x438d44={};_0x438d44[_0x244cce[_0x52b5('0x2a')]]={'$like':'%'+_0x34e12f[_0x52b5('0x33')][_0x52b5('0x3f')]+'%'};return _0x438d44;}})});}_0xcbe829=_[_0x52b5('0x41')]({},_0xcbe829,_0x34e12f[_0x52b5('0x43')]);var _0x24e157={'where':_0xcbe829[_0x52b5('0x40')]};return db['VoiceAgentReport']['count'](_0x24e157)[_0x52b5('0x27')](function(_0x5d4761){_0x4a4f53[_0x52b5('0x1f')]=_0x5d4761;if(_0x34e12f['query'][_0x52b5('0x44')]){_0xcbe829[_0x52b5('0x45')]=[{'all':!![]}];}return db[_0x52b5('0x2d')][_0x52b5('0x46')](_0xcbe829);})[_0x52b5('0x27')](function(_0x9420f9){_0x4a4f53['rows']=_0x9420f9;return _0x4a4f53;})[_0x52b5('0x27')](respondWithFilteredResult(_0x483bad,_0xcbe829))[_0x52b5('0x47')](handleError(_0x483bad,null));};exports[_0x52b5('0x48')]=function(_0x494aa3,_0x502095){var _0x3dbf26={'raw':![],'where':{'id':_0x494aa3['params']['id']}},_0x1fb5dd={};_0x1fb5dd[_0x52b5('0x35')]=_[_0x52b5('0x32')](db[_0x52b5('0x2d')][_0x52b5('0x2e')]);_0x1fb5dd['query']=_[_0x52b5('0x32')](_0x494aa3['query']);_0x1fb5dd[_0x52b5('0x3d')]=_['intersection'](_0x1fb5dd[_0x52b5('0x35')],_0x1fb5dd[_0x52b5('0x33')]);_0x3dbf26['attributes']=_[_0x52b5('0x34')](_0x1fb5dd[_0x52b5('0x35')],qs[_0x52b5('0x37')](_0x494aa3[_0x52b5('0x33')][_0x52b5('0x37')]));_0x3dbf26[_0x52b5('0x36')]=_0x3dbf26[_0x52b5('0x36')][_0x52b5('0x38')]?_0x3dbf26[_0x52b5('0x36')]:_0x1fb5dd['model'];if(_0x494aa3['query'][_0x52b5('0x44')]){_0x3dbf26[_0x52b5('0x45')]=[{'all':!![]}];}_0x3dbf26=_['merge']({},_0x3dbf26,_0x494aa3[_0x52b5('0x43')]);return db['VoiceAgentReport'][_0x52b5('0x49')](_0x3dbf26)[_0x52b5('0x27')](handleEntityNotFound(_0x502095,null))[_0x52b5('0x27')](respondWithResult(_0x502095,null))[_0x52b5('0x47')](handleError(_0x502095,null));};exports[_0x52b5('0x4a')]=function(_0x23dcb6,_0x1e0681){return db[_0x52b5('0x2d')][_0x52b5('0x4a')](_0x23dcb6[_0x52b5('0x4b')],{})[_0x52b5('0x27')](respondWithResult(_0x1e0681,0xc9))[_0x52b5('0x47')](handleError(_0x1e0681,null));};exports[_0x52b5('0x4c')]=function(_0x228893,_0x2eb478){if(_0x228893[_0x52b5('0x4b')]['id']){delete _0x228893[_0x52b5('0x4b')]['id'];}return db[_0x52b5('0x2d')][_0x52b5('0x49')]({'where':{'id':_0x228893['params']['id']}})['then'](handleEntityNotFound(_0x2eb478,null))[_0x52b5('0x27')](saveUpdates(_0x228893[_0x52b5('0x4b')],null))[_0x52b5('0x27')](respondWithResult(_0x2eb478,null))[_0x52b5('0x47')](handleError(_0x2eb478,null));};exports[_0x52b5('0x4d')]=function(_0x15ee6e,_0x304e43){return db[_0x52b5('0x2d')][_0x52b5('0x49')]({'where':{'id':_0x15ee6e['params']['id']}})[_0x52b5('0x27')](handleEntityNotFound(_0x304e43,null))[_0x52b5('0x27')](removeEntity(_0x304e43,null))['catch'](handleError(_0x304e43,null));};exports[_0x52b5('0x4e')]=function(_0x37487e,_0x12b3df){return db[_0x52b5('0x2d')][_0x52b5('0x4e')]()['then'](respondWithResult(_0x12b3df,null))['catch'](handleError(_0x12b3df,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index eeb917b..537d24b 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 _0xa8f4=['../../config/environment','exports','VoiceAgentReport','report_agent','uniqueid','destuniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x3cc51a,_0x18c7a4){var _0x4f2698=function(_0x5ee8c5){while(--_0x5ee8c5){_0x3cc51a['push'](_0x3cc51a['shift']());}};_0x4f2698(++_0x18c7a4);}(_0xa8f4,0x13e));var _0x4a8f=function(_0x4d771f,_0x545ac4){_0x4d771f=_0x4d771f-0x0;var _0x5275c2=_0xa8f4[_0x4d771f];return _0x5275c2;};'use strict';var _=require('lodash');var util=require(_0x4a8f('0x0'));var logger=require(_0x4a8f('0x1'))(_0x4a8f('0x2'));var moment=require('moment');var BPromise=require(_0x4a8f('0x3'));var rp=require(_0x4a8f('0x4'));var fs=require('fs');var path=require(_0x4a8f('0x5'));var rimraf=require(_0x4a8f('0x6'));var config=require(_0x4a8f('0x7'));var attributes=require('./voiceAgentReport.attributes');module[_0x4a8f('0x8')]=function(_0x5ee793,_0x236a05){return _0x5ee793['define'](_0x4a8f('0x9'),attributes,{'tableName':_0x4a8f('0xa'),'paranoid':![],'indexes':[{'fields':[_0x4a8f('0xb'),_0x4a8f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8c97=['request-promise','path','rimraf','../../config/environment','define','VoiceAgentReport','uniqueid','destuniqueid','util','../../config/logger','api','moment'];(function(_0x4c9afd,_0x21af7a){var _0x4ecefe=function(_0x4d67a1){while(--_0x4d67a1){_0x4c9afd['push'](_0x4c9afd['shift']());}};_0x4ecefe(++_0x21af7a);}(_0x8c97,0x158));var _0x78c9=function(_0x230e3e,_0x403251){_0x230e3e=_0x230e3e-0x0;var _0xb94d32=_0x8c97[_0x230e3e];return _0xb94d32;};'use strict';var _=require('lodash');var util=require(_0x78c9('0x0'));var logger=require(_0x78c9('0x1'))(_0x78c9('0x2'));var moment=require(_0x78c9('0x3'));var BPromise=require('bluebird');var rp=require(_0x78c9('0x4'));var fs=require('fs');var path=require(_0x78c9('0x5'));var rimraf=require(_0x78c9('0x6'));var config=require(_0x78c9('0x7'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x36a59c,_0x145e59){return _0x36a59c[_0x78c9('0x8')](_0x78c9('0x9'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x78c9('0xa'),_0x78c9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index f2893c3..b067a5e 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 _0xbbd2=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','then','UpdateVoiceAgentReport','update','raw','where','attributes','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x14cc28,_0x4c288a){var _0x37e547=function(_0xa71d6b){while(--_0xa71d6b){_0x14cc28['push'](_0x14cc28['shift']());}};_0x37e547(++_0x4c288a);}(_0xbbd2,0x13b));var _0x2bbd=function(_0xea35d1,_0x302471){_0xea35d1=_0xea35d1-0x0;var _0x1d7a7c=_0xbbd2[_0xea35d1];return _0x1d7a7c;};'use strict';var _=require('lodash');var util=require(_0x2bbd('0x0'));var moment=require('moment');var BPromise=require(_0x2bbd('0x1'));var rs=require(_0x2bbd('0x2'));var fs=require('fs');var Redis=require(_0x2bbd('0x3'));var db=require(_0x2bbd('0x4'))['db'];var utils=require(_0x2bbd('0x5'));var logger=require(_0x2bbd('0x6'))(_0x2bbd('0x7'));var config=require(_0x2bbd('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2bbd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ee340,_0x161000,_0xad98a5){return new BPromise(function(_0x365c2e,_0x52caae){return client[_0x2bbd('0xa')](_0x1ee340,_0xad98a5)['then'](function(_0x36f23c){logger[_0x2bbd('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x161000,_0x2bbd('0xc'));logger[_0x2bbd('0xd')](_0x2bbd('0xe'),_0x161000,_0x2bbd('0xc'),JSON[_0x2bbd('0xf')](_0x36f23c));if(_0x36f23c['error']){if(_0x36f23c[_0x2bbd('0x10')][_0x2bbd('0x11')]===0x1f4){logger[_0x2bbd('0x10')](_0x2bbd('0x12'),_0x161000,_0x36f23c[_0x2bbd('0x10')][_0x2bbd('0x13')]);return _0x52caae(_0x36f23c[_0x2bbd('0x10')][_0x2bbd('0x13')]);}logger[_0x2bbd('0x10')](_0x2bbd('0x12'),_0x161000,_0x36f23c[_0x2bbd('0x10')][_0x2bbd('0x13')]);return _0x365c2e(_0x36f23c[_0x2bbd('0x10')][_0x2bbd('0x13')]);}else{logger[_0x2bbd('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x161000,_0x2bbd('0xc'));_0x365c2e(_0x36f23c[_0x2bbd('0x14')]['message']);}})[_0x2bbd('0x15')](function(_0x3e771e){logger[_0x2bbd('0x10')](_0x2bbd('0x12'),_0x161000,_0x3e771e);_0x52caae(_0x3e771e);});});}exports[_0x2bbd('0x16')]=function(_0x4c2a52){var _0x85650=this;return new Promise(function(_0x286d72,_0x4acccc){return db[_0x2bbd('0x17')]['create'](_0x4c2a52[_0x2bbd('0x18')],{'raw':_0x4c2a52['options']?_0x4c2a52[_0x2bbd('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x2bbd('0x1a')](function(_0x413e1f){logger[_0x2bbd('0xb')](_0x2bbd('0x16'),_0x4c2a52);logger['debug']('CreateVoiceAgentReport',_0x4c2a52,JSON['stringify'](_0x413e1f));_0x286d72(_0x413e1f);})['catch'](function(_0x3c0ee0){logger[_0x2bbd('0x10')]('CreateVoiceAgentReport',_0x3c0ee0[_0x2bbd('0x13')],_0x4c2a52);_0x4acccc(_0x85650[_0x2bbd('0x10')](0x1f4,_0x3c0ee0[_0x2bbd('0x13')]));});});};exports[_0x2bbd('0x1b')]=function(_0x5a205d){var _0x3099ad=this;return new Promise(function(_0xa31110,_0x34f3ea){return db[_0x2bbd('0x17')][_0x2bbd('0x1c')](_0x5a205d[_0x2bbd('0x18')],{'raw':_0x5a205d['options']?_0x5a205d[_0x2bbd('0x19')][_0x2bbd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a205d[_0x2bbd('0x19')]?_0x5a205d[_0x2bbd('0x19')][_0x2bbd('0x1e')]||null:null,'attributes':_0x5a205d['options']?_0x5a205d[_0x2bbd('0x19')][_0x2bbd('0x1f')]||null:null,'limit':_0x5a205d[_0x2bbd('0x19')]?_0x5a205d[_0x2bbd('0x19')]['limit']||null:null})[_0x2bbd('0x1a')](function(_0x4eaaef){logger[_0x2bbd('0xb')](_0x2bbd('0x1b'),_0x5a205d);logger[_0x2bbd('0xd')](_0x2bbd('0x1b'),_0x5a205d,JSON[_0x2bbd('0xf')](_0x4eaaef));_0xa31110(_0x4eaaef);})['catch'](function(_0x3b96aa){logger[_0x2bbd('0x10')]('UpdateVoiceAgentReport',_0x3b96aa[_0x2bbd('0x13')],_0x5a205d);_0x34f3ea(_0x3099ad['error'](0x1f4,_0x3b96aa[_0x2bbd('0x13')]));});});}; \ No newline at end of file +var _0xf522=['request\x20sent','error','message','result','catch','create','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','where','limit','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s'];(function(_0x2a0ca3,_0x1ddad3){var _0x11b2e8=function(_0x10c246){while(--_0x10c246){_0x2a0ca3['push'](_0x2a0ca3['shift']());}};_0x11b2e8(++_0x1ddad3);}(_0xf522,0x15d));var _0x2f52=function(_0x48b484,_0x5dff13){_0x48b484=_0x48b484-0x0;var _0x1cfee1=_0xf522[_0x48b484];return _0x1cfee1;};'use strict';var _=require(_0x2f52('0x0'));var util=require(_0x2f52('0x1'));var moment=require(_0x2f52('0x2'));var BPromise=require('bluebird');var rs=require(_0x2f52('0x3'));var fs=require('fs');var Redis=require(_0x2f52('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f52('0x5'));var logger=require(_0x2f52('0x6'))('rpc');var config=require(_0x2f52('0x7'));var jayson=require(_0x2f52('0x8'));var client=jayson['client'][_0x2f52('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30f134,_0x15338d,_0xe25f6){return new BPromise(function(_0x1e36bc,_0xd1c069){return client['request'](_0x30f134,_0xe25f6)[_0x2f52('0xa')](function(_0x39ed78){logger[_0x2f52('0xb')](_0x2f52('0xc'),_0x15338d,'request\x20sent');logger[_0x2f52('0xd')](_0x2f52('0xe'),_0x15338d,_0x2f52('0xf'),JSON['stringify'](_0x39ed78));if(_0x39ed78[_0x2f52('0x10')]){if(_0x39ed78['error']['code']===0x1f4){logger[_0x2f52('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x15338d,_0x39ed78[_0x2f52('0x10')][_0x2f52('0x11')]);return _0xd1c069(_0x39ed78['error']['message']);}logger[_0x2f52('0x10')](_0x2f52('0xc'),_0x15338d,_0x39ed78[_0x2f52('0x10')][_0x2f52('0x11')]);return _0x1e36bc(_0x39ed78[_0x2f52('0x10')][_0x2f52('0x11')]);}else{logger['info'](_0x2f52('0xc'),_0x15338d,_0x2f52('0xf'));_0x1e36bc(_0x39ed78[_0x2f52('0x12')]['message']);}})[_0x2f52('0x13')](function(_0x596124){logger[_0x2f52('0x10')](_0x2f52('0xc'),_0x15338d,_0x596124);_0xd1c069(_0x596124);});});}exports['CreateVoiceAgentReport']=function(_0x24263b){var _0x4d781c=this;return new Promise(function(_0x25d9a4,_0x475aec){return db['VoiceAgentReport'][_0x2f52('0x14')](_0x24263b[_0x2f52('0x15')],{'raw':_0x24263b[_0x2f52('0x16')]?_0x24263b[_0x2f52('0x16')][_0x2f52('0x17')]===undefined?!![]:![]:!![]})[_0x2f52('0xa')](function(_0x4e7ca5){logger[_0x2f52('0xb')](_0x2f52('0x18'),_0x24263b);logger[_0x2f52('0xd')](_0x2f52('0x18'),_0x24263b,JSON['stringify'](_0x4e7ca5));_0x25d9a4(_0x4e7ca5);})[_0x2f52('0x13')](function(_0x6ab590){logger[_0x2f52('0x10')]('CreateVoiceAgentReport',_0x6ab590[_0x2f52('0x11')],_0x24263b);_0x475aec(_0x4d781c[_0x2f52('0x10')](0x1f4,_0x6ab590['message']));});});};exports[_0x2f52('0x19')]=function(_0x5eab1d){var _0x104b24=this;return new Promise(function(_0x2215ca,_0x2b1062){return db['VoiceAgentReport']['update'](_0x5eab1d[_0x2f52('0x15')],{'raw':_0x5eab1d['options']?_0x5eab1d[_0x2f52('0x16')][_0x2f52('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5eab1d[_0x2f52('0x16')]?_0x5eab1d[_0x2f52('0x16')][_0x2f52('0x1a')]||null:null,'attributes':_0x5eab1d['options']?_0x5eab1d[_0x2f52('0x16')]['attributes']||null:null,'limit':_0x5eab1d['options']?_0x5eab1d[_0x2f52('0x16')][_0x2f52('0x1b')]||null:null})[_0x2f52('0xa')](function(_0x54af64){logger[_0x2f52('0xb')]('UpdateVoiceAgentReport',_0x5eab1d);logger[_0x2f52('0xd')](_0x2f52('0x19'),_0x5eab1d,JSON['stringify'](_0x54af64));_0x2215ca(_0x54af64);})[_0x2f52('0x13')](function(_0x4158f3){logger[_0x2f52('0x10')](_0x2f52('0x19'),_0x4158f3[_0x2f52('0x11')],_0x5eab1d);_0x2b1062(_0x104b24[_0x2f52('0x10')](0x1f4,_0x4158f3['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 5100340..bf3fc9c 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 _0xf675=['Router','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x383dbb,_0x17d41b){var _0x6e8bde=function(_0x2740f1){while(--_0x2740f1){_0x383dbb['push'](_0x383dbb['shift']());}};_0x6e8bde(++_0x17d41b);}(_0xf675,0xe4));var _0x5f67=function(_0xb68772,_0x5253ac){_0xb68772=_0xb68772-0x0;var _0x4189bb=_0xf675[_0xb68772];return _0x4189bb;};'use strict';var multer=require(_0x5f67('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5f67('0x1'));var express=require(_0x5f67('0x2'));var router=express[_0x5f67('0x3')]();var auth=require(_0x5f67('0x4'));var interaction=require(_0x5f67('0x5'));var config=require('../../config/environment');var controller=require(_0x5f67('0x6'));router[_0x5f67('0x7')]('/',auth[_0x5f67('0x8')](),controller[_0x5f67('0x9')]);router[_0x5f67('0x7')](_0x5f67('0xa'),auth['isAuthenticated'](),controller[_0x5f67('0xb')]);router[_0x5f67('0x7')](_0x5f67('0xc'),auth['isAuthenticated'](),controller[_0x5f67('0xd')]);router[_0x5f67('0xe')]('/',auth[_0x5f67('0x8')](),controller[_0x5f67('0xf')]);router[_0x5f67('0x10')](_0x5f67('0xc'),auth[_0x5f67('0x8')](),controller[_0x5f67('0x11')]);router[_0x5f67('0x12')]('/:id',auth[_0x5f67('0x8')](),controller[_0x5f67('0x13')]);module[_0x5f67('0x14')]=router; \ No newline at end of file +var _0x1048=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','get','describe','/:id','show','create','update','delete','destroy'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x1048,0xa1));var _0x8104=function(_0x1d510f,_0x458041){_0x1d510f=_0x1d510f-0x0;var _0x3ecc91=_0x1048[_0x1d510f];return _0x3ecc91;};'use strict';var multer=require(_0x8104('0x0'));var util=require('util');var path=require(_0x8104('0x1'));var timeout=require(_0x8104('0x2'));var express=require(_0x8104('0x3'));var router=express[_0x8104('0x4')]();var auth=require(_0x8104('0x5'));var interaction=require(_0x8104('0x6'));var config=require(_0x8104('0x7'));var controller=require(_0x8104('0x8'));router['get']('/',auth[_0x8104('0x9')](),controller[_0x8104('0xa')]);router[_0x8104('0xb')]('/describe',auth[_0x8104('0x9')](),controller[_0x8104('0xc')]);router[_0x8104('0xb')](_0x8104('0xd'),auth[_0x8104('0x9')](),controller[_0x8104('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8104('0xf')]);router['put'](_0x8104('0xd'),auth['isAuthenticated'](),controller[_0x8104('0x10')]);router[_0x8104('0x11')](_0x8104('0xd'),auth[_0x8104('0x9')](),controller[_0x8104('0x12')]);module[_0x8104('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 f4ea735..2e434ce 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(_0x31e9a5,_0x520323){var _0x96859d=function(_0x4a5606){while(--_0x4a5606){_0x31e9a5['push'](_0x31e9a5['shift']());}};_0x96859d(++_0x520323);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x25c9ce,_0x10152a){var _0xcc7ac0=function(_0x363263){while(--_0x363263){_0x25c9ce['push'](_0x25c9ce['shift']());}};_0xcc7ac0(++_0x10152a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 4b8471d..c45bb08 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 _0x9bf4=['moment','bluebird','util','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','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','apply','reject','update','destroy','then','error','name','send','map','VoiceCallReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','VIRTUAL','merge','includeAll','include','fullname','alias','User','findAll','rows','show','params','find','catch','create','body','describe','uniqueid','html-pdf','eml-format','zip-dir','fast-json-patch'];(function(_0x4bb40d,_0x4c7fbb){var _0x5561c5=function(_0x25e26a){while(--_0x25e26a){_0x4bb40d['push'](_0x4bb40d['shift']());}};_0x5561c5(++_0x4c7fbb);}(_0x9bf4,0x124));var _0x49bf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9bf4[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x49bf('0x0'));var emlformat=require(_0x49bf('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x49bf('0x2'));var jsonpatch=require(_0x49bf('0x3'));var rp=require('request-promise');var moment=require(_0x49bf('0x4'));var BPromise=require(_0x49bf('0x5'));var Mustache=require('mustache');var util=require(_0x49bf('0x6'));var path=require(_0x49bf('0x7'));var sox=require(_0x49bf('0x8'));var csv=require(_0x49bf('0x9'));var ejs=require(_0x49bf('0xa'));var fs=require('fs');var _=require(_0x49bf('0xb'));var squel=require('squel');var crypto=require(_0x49bf('0xc'));var jsforce=require(_0x49bf('0xd'));var deskjs=require(_0x49bf('0xe'));var toCsv=require(_0x49bf('0x9'));var querystring=require('querystring');var Papa=require(_0x49bf('0xf'));var Redis=require(_0x49bf('0x10'));var authService=require(_0x49bf('0x11'));var qs=require(_0x49bf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x49bf('0x13'));var logger=require(_0x49bf('0x14'))(_0x49bf('0x15'));var utils=require(_0x49bf('0x16'));var config=require(_0x49bf('0x17'));var db=require(_0x49bf('0x18'))['db'];function respondWithStatusCode(_0x3f751c,_0x18d226){_0x18d226=_0x18d226||0xcc;return function(_0x106b36){if(_0x106b36){return _0x3f751c[_0x49bf('0x19')](_0x18d226);}return _0x3f751c['status'](_0x18d226)['end']();};}function respondWithResult(_0x2ba499,_0x414b49){_0x414b49=_0x414b49||0xc8;return function(_0x379879){if(_0x379879){return _0x2ba499[_0x49bf('0x1a')](_0x414b49)[_0x49bf('0x1b')](_0x379879);}};}function respondWithFilteredResult(_0x35896f,_0x41fb33){return function(_0x42f98d){if(_0x42f98d){var _0x2db5db=_0x42f98d[_0x49bf('0x1c')],_0x20ab80=_0x41fb33[_0x49bf('0x1d')],_0x13b14e=_0x41fb33[_0x49bf('0x1d')]+_0x41fb33['limit'],_0x4fcb9b;if(_0x13b14e>=_0x2db5db){_0x13b14e=_0x2db5db;_0x4fcb9b=0xc8;}else{_0x4fcb9b=0xce;}_0x35896f[_0x49bf('0x1a')](_0x4fcb9b);return _0x35896f['set'](_0x49bf('0x1e'),_0x20ab80+'-'+_0x13b14e+'/'+_0x2db5db)[_0x49bf('0x1b')](_0x42f98d);}return null;};}function patchUpdates(_0x1bc004){return function(_0x350cca){try{jsonpatch[_0x49bf('0x1f')](_0x350cca,_0x1bc004,!![]);}catch(_0x2fe520){return BPromise[_0x49bf('0x20')](_0x2fe520);}return _0x350cca['save']();};}function saveUpdates(_0x38d587,_0x499874){return function(_0x2fa81b){if(_0x2fa81b){return _0x2fa81b[_0x49bf('0x21')](_0x38d587)['then'](function(_0x16120b){return _0x16120b;});}return null;};}function removeEntity(_0x2996c5,_0x5153b1){return function(_0x18076e){if(_0x18076e){return _0x18076e[_0x49bf('0x22')]()[_0x49bf('0x23')](function(){_0x2996c5[_0x49bf('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11fb98,_0x3ec3ba){return function(_0x26d571){if(!_0x26d571){_0x11fb98[_0x49bf('0x19')](0x194);}return _0x26d571;};}function handleError(_0x2b3c8a,_0x242ce1){_0x242ce1=_0x242ce1||0x1f4;return function(_0x1c1a75){logger[_0x49bf('0x24')](_0x1c1a75['stack']);if(_0x1c1a75[_0x49bf('0x25')]){delete _0x1c1a75[_0x49bf('0x25')];}_0x2b3c8a[_0x49bf('0x1a')](_0x242ce1)[_0x49bf('0x26')](_0x1c1a75);};}exports['index']=function(_0x4f4a63,_0x5a53c7){var _0x8c51b9={},_0x3865df={},_0xb6a7e3={'count':0x0,'rows':[]};var _0x2dac06=_[_0x49bf('0x27')](db[_0x49bf('0x28')][_0x49bf('0x29')],function(_0x4ef769){return{'name':_0x4ef769['fieldName'],'type':_0x4ef769[_0x49bf('0x2a')][_0x49bf('0x2b')]};});_0x3865df['model']=_['map'](_0x2dac06,'name');_0x3865df[_0x49bf('0x2c')]=_[_0x49bf('0x2d')](_0x4f4a63[_0x49bf('0x2c')]);_0x3865df[_0x49bf('0x2e')]=_[_0x49bf('0x2f')](_0x3865df[_0x49bf('0x30')],_0x3865df[_0x49bf('0x2c')]);_0x8c51b9[_0x49bf('0x31')]=_[_0x49bf('0x2f')](_0x3865df[_0x49bf('0x30')],qs[_0x49bf('0x32')](_0x4f4a63[_0x49bf('0x2c')][_0x49bf('0x32')]));_0x8c51b9[_0x49bf('0x31')]=_0x8c51b9[_0x49bf('0x31')][_0x49bf('0x33')]?_0x8c51b9[_0x49bf('0x31')]:_0x3865df[_0x49bf('0x30')];if(!_0x4f4a63[_0x49bf('0x2c')]['hasOwnProperty'](_0x49bf('0x34'))){_0x8c51b9['limit']=qs[_0x49bf('0x35')](_0x4f4a63['query'][_0x49bf('0x35')]);_0x8c51b9[_0x49bf('0x1d')]=qs['offset'](_0x4f4a63['query']['offset']);}_0x8c51b9[_0x49bf('0x36')]=qs[_0x49bf('0x37')](_0x4f4a63[_0x49bf('0x2c')][_0x49bf('0x37')]);_0x8c51b9['where']=qs['filters'](_['pick'](_0x4f4a63[_0x49bf('0x2c')],_0x3865df['filters']));if(_0x4f4a63['query']['filter']){_0x8c51b9[_0x49bf('0x38')]=_['merge'](_0x8c51b9[_0x49bf('0x38')],{'$or':_[_0x49bf('0x27')](_0x2dac06,function(_0x3355fd){if(_0x3355fd[_0x49bf('0x2a')]!==_0x49bf('0x39')){var _0x2e1d2f={};_0x2e1d2f[_0x3355fd[_0x49bf('0x25')]]={'$like':'%'+_0x4f4a63['query']['filter']+'%'};return _0x2e1d2f;}})});}_0x8c51b9=_[_0x49bf('0x3a')]({},_0x8c51b9,_0x4f4a63['options']);var _0x416af8={'where':_0x8c51b9[_0x49bf('0x38')]};return db[_0x49bf('0x28')]['count'](_0x416af8)[_0x49bf('0x23')](function(_0x3cbe4e){_0xb6a7e3[_0x49bf('0x1c')]=_0x3cbe4e;if(_0x4f4a63['query'][_0x49bf('0x3b')]){_0x8c51b9[_0x49bf('0x3c')]=[{'attributes':['id','name',_0x49bf('0x3d'),_0x49bf('0x3e')],'model':db[_0x49bf('0x3f')],'as':'User'}];}return db[_0x49bf('0x28')][_0x49bf('0x40')](_0x8c51b9);})[_0x49bf('0x23')](function(_0x2414eb){_0xb6a7e3[_0x49bf('0x41')]=_0x2414eb;return _0xb6a7e3;})[_0x49bf('0x23')](respondWithFilteredResult(_0x5a53c7,_0x8c51b9))['catch'](handleError(_0x5a53c7,null));};exports[_0x49bf('0x42')]=function(_0x4d40b5,_0x1429e4){var _0x4eee72={'raw':!![],'where':{'id':_0x4d40b5[_0x49bf('0x43')]['id']}},_0x1a0300={};_0x1a0300['model']=_[_0x49bf('0x2d')](db[_0x49bf('0x28')][_0x49bf('0x29')]);_0x1a0300[_0x49bf('0x2c')]=_['keys'](_0x4d40b5[_0x49bf('0x2c')]);_0x1a0300[_0x49bf('0x2e')]=_[_0x49bf('0x2f')](_0x1a0300[_0x49bf('0x30')],_0x1a0300['query']);_0x4eee72[_0x49bf('0x31')]=_[_0x49bf('0x2f')](_0x1a0300[_0x49bf('0x30')],qs[_0x49bf('0x32')](_0x4d40b5[_0x49bf('0x2c')][_0x49bf('0x32')]));_0x4eee72['attributes']=_0x4eee72['attributes'][_0x49bf('0x33')]?_0x4eee72['attributes']:_0x1a0300[_0x49bf('0x30')];if(_0x4d40b5['query']['includeAll']){_0x4eee72[_0x49bf('0x3c')]=[{'all':!![]}];}_0x4eee72=_[_0x49bf('0x3a')]({},_0x4eee72,_0x4d40b5['options']);return db[_0x49bf('0x28')][_0x49bf('0x44')](_0x4eee72)[_0x49bf('0x23')](handleEntityNotFound(_0x1429e4,null))['then'](respondWithResult(_0x1429e4,null))[_0x49bf('0x45')](handleError(_0x1429e4,null));};exports[_0x49bf('0x46')]=function(_0x3612b2,_0x54a1f0){return db[_0x49bf('0x28')][_0x49bf('0x46')](_0x3612b2[_0x49bf('0x47')],{})[_0x49bf('0x23')](respondWithResult(_0x54a1f0,0xc9))[_0x49bf('0x45')](handleError(_0x54a1f0,null));};exports['destroy']=function(_0x4be1e7,_0x314b55){return db[_0x49bf('0x28')][_0x49bf('0x44')]({'where':{'id':_0x4be1e7[_0x49bf('0x43')]['id']}})[_0x49bf('0x23')](handleEntityNotFound(_0x314b55,null))['then'](removeEntity(_0x314b55,null))[_0x49bf('0x45')](handleError(_0x314b55,null));};exports[_0x49bf('0x48')]=function(_0x8a9a5a,_0x228cf4){return db[_0x49bf('0x28')]['describe']()['then'](respondWithResult(_0x228cf4,null))[_0x49bf('0x45')](handleError(_0x228cf4,null));};exports[_0x49bf('0x21')]=function(_0x22b79c,_0x4aeee7){if(_0x22b79c[_0x49bf('0x47')][_0x49bf('0x49')]){delete _0x22b79c[_0x49bf('0x47')]['uniqueid'];}return db[_0x49bf('0x28')]['find']({'where':{'uniqueid':_0x22b79c[_0x49bf('0x43')]['id'],'UserId':{'$or':[null,_0x22b79c['user']['id']]}}})['then'](handleEntityNotFound(_0x4aeee7,null))[_0x49bf('0x23')](saveUpdates(_0x22b79c[_0x49bf('0x47')],null))[_0x49bf('0x23')](respondWithResult(_0x4aeee7,null))[_0x49bf('0x45')](handleError(_0x4aeee7,null));}; \ No newline at end of file +var _0xd139=['VIRTUAL','merge','options','count','includeAll','fullname','User','findAll','rows','show','params','include','find','create','catch','body','uniqueid','user','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','offset','limit','set','json','apply','reject','save','update','then','destroy','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','sort','where','pick','filter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd139,0x1d4));var _0x9d13=function(_0xff4aca,_0x1363c9){_0xff4aca=_0xff4aca-0x0;var _0x2c2580=_0xd139[_0xff4aca];return _0x2c2580;};'use strict';var pdf=require(_0x9d13('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9d13('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9d13('0x2'));var moment=require(_0x9d13('0x3'));var BPromise=require(_0x9d13('0x4'));var Mustache=require(_0x9d13('0x5'));var util=require(_0x9d13('0x6'));var path=require(_0x9d13('0x7'));var sox=require(_0x9d13('0x8'));var csv=require(_0x9d13('0x9'));var ejs=require(_0x9d13('0xa'));var fs=require('fs');var _=require(_0x9d13('0xb'));var squel=require(_0x9d13('0xc'));var crypto=require(_0x9d13('0xd'));var jsforce=require(_0x9d13('0xe'));var deskjs=require(_0x9d13('0xf'));var toCsv=require(_0x9d13('0x9'));var querystring=require(_0x9d13('0x10'));var Papa=require(_0x9d13('0x11'));var Redis=require(_0x9d13('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9d13('0x13'));var hardwareService=require(_0x9d13('0x14'));var logger=require(_0x9d13('0x15'))(_0x9d13('0x16'));var utils=require('../../config/utils');var config=require(_0x9d13('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28502e,_0x479ce3){_0x479ce3=_0x479ce3||0xcc;return function(_0x54e814){if(_0x54e814){return _0x28502e[_0x9d13('0x18')](_0x479ce3);}return _0x28502e['status'](_0x479ce3)[_0x9d13('0x19')]();};}function respondWithResult(_0xab2ea1,_0x2aeebc){_0x2aeebc=_0x2aeebc||0xc8;return function(_0x6a58b4){if(_0x6a58b4){return _0xab2ea1[_0x9d13('0x1a')](_0x2aeebc)['json'](_0x6a58b4);}};}function respondWithFilteredResult(_0x4e3dcf,_0x4bcbc1){return function(_0x1eff65){if(_0x1eff65){var _0x4b2727=_0x1eff65['count'],_0x1e3a2b=_0x4bcbc1[_0x9d13('0x1b')],_0x5bd207=_0x4bcbc1[_0x9d13('0x1b')]+_0x4bcbc1[_0x9d13('0x1c')],_0x56e20b;if(_0x5bd207>=_0x4b2727){_0x5bd207=_0x4b2727;_0x56e20b=0xc8;}else{_0x56e20b=0xce;}_0x4e3dcf[_0x9d13('0x1a')](_0x56e20b);return _0x4e3dcf[_0x9d13('0x1d')]('Content-Range',_0x1e3a2b+'-'+_0x5bd207+'/'+_0x4b2727)[_0x9d13('0x1e')](_0x1eff65);}return null;};}function patchUpdates(_0x1ff7f2){return function(_0x3fc5d0){try{jsonpatch[_0x9d13('0x1f')](_0x3fc5d0,_0x1ff7f2,!![]);}catch(_0xfcd95f){return BPromise[_0x9d13('0x20')](_0xfcd95f);}return _0x3fc5d0[_0x9d13('0x21')]();};}function saveUpdates(_0x26d534,_0x508166){return function(_0xa225a3){if(_0xa225a3){return _0xa225a3[_0x9d13('0x22')](_0x26d534)[_0x9d13('0x23')](function(_0x3d2618){return _0x3d2618;});}return null;};}function removeEntity(_0x59f5b9,_0x139086){return function(_0x143c56){if(_0x143c56){return _0x143c56[_0x9d13('0x24')]()['then'](function(){_0x59f5b9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c9858,_0x2d6ab7){return function(_0x57b0d4){if(!_0x57b0d4){_0x4c9858[_0x9d13('0x18')](0x194);}return _0x57b0d4;};}function handleError(_0x3768be,_0x392a12){_0x392a12=_0x392a12||0x1f4;return function(_0x48b3ee){logger['error'](_0x48b3ee[_0x9d13('0x25')]);if(_0x48b3ee[_0x9d13('0x26')]){delete _0x48b3ee[_0x9d13('0x26')];}_0x3768be[_0x9d13('0x1a')](_0x392a12)['send'](_0x48b3ee);};}exports[_0x9d13('0x27')]=function(_0x125874,_0x5c6fd5){var _0x410ee5={},_0xa0f2d9={},_0x57f2ac={'count':0x0,'rows':[]};var _0x8f093=_[_0x9d13('0x28')](db[_0x9d13('0x29')][_0x9d13('0x2a')],function(_0x565617){return{'name':_0x565617[_0x9d13('0x2b')],'type':_0x565617[_0x9d13('0x2c')]['key']};});_0xa0f2d9[_0x9d13('0x2d')]=_[_0x9d13('0x28')](_0x8f093,_0x9d13('0x26'));_0xa0f2d9['query']=_[_0x9d13('0x2e')](_0x125874[_0x9d13('0x2f')]);_0xa0f2d9[_0x9d13('0x30')]=_[_0x9d13('0x31')](_0xa0f2d9[_0x9d13('0x2d')],_0xa0f2d9[_0x9d13('0x2f')]);_0x410ee5[_0x9d13('0x32')]=_[_0x9d13('0x31')](_0xa0f2d9['model'],qs[_0x9d13('0x33')](_0x125874[_0x9d13('0x2f')][_0x9d13('0x33')]));_0x410ee5[_0x9d13('0x32')]=_0x410ee5[_0x9d13('0x32')][_0x9d13('0x34')]?_0x410ee5[_0x9d13('0x32')]:_0xa0f2d9[_0x9d13('0x2d')];if(!_0x125874['query']['hasOwnProperty']('nolimit')){_0x410ee5[_0x9d13('0x1c')]=qs[_0x9d13('0x1c')](_0x125874[_0x9d13('0x2f')][_0x9d13('0x1c')]);_0x410ee5[_0x9d13('0x1b')]=qs[_0x9d13('0x1b')](_0x125874['query']['offset']);}_0x410ee5['order']=qs[_0x9d13('0x35')](_0x125874[_0x9d13('0x2f')]['sort']);_0x410ee5[_0x9d13('0x36')]=qs[_0x9d13('0x30')](_[_0x9d13('0x37')](_0x125874[_0x9d13('0x2f')],_0xa0f2d9[_0x9d13('0x30')]));if(_0x125874[_0x9d13('0x2f')][_0x9d13('0x38')]){_0x410ee5['where']=_['merge'](_0x410ee5['where'],{'$or':_['map'](_0x8f093,function(_0x30ae43){if(_0x30ae43['type']!==_0x9d13('0x39')){var _0xff8011={};_0xff8011[_0x30ae43[_0x9d13('0x26')]]={'$like':'%'+_0x125874[_0x9d13('0x2f')]['filter']+'%'};return _0xff8011;}})});}_0x410ee5=_[_0x9d13('0x3a')]({},_0x410ee5,_0x125874[_0x9d13('0x3b')]);var _0x52df0a={'where':_0x410ee5[_0x9d13('0x36')]};return db[_0x9d13('0x29')][_0x9d13('0x3c')](_0x52df0a)[_0x9d13('0x23')](function(_0x4e0bdb){_0x57f2ac[_0x9d13('0x3c')]=_0x4e0bdb;if(_0x125874[_0x9d13('0x2f')][_0x9d13('0x3d')]){_0x410ee5['include']=[{'attributes':['id',_0x9d13('0x26'),_0x9d13('0x3e'),'alias'],'model':db[_0x9d13('0x3f')],'as':'User'}];}return db[_0x9d13('0x29')][_0x9d13('0x40')](_0x410ee5);})['then'](function(_0x30c5eb){_0x57f2ac[_0x9d13('0x41')]=_0x30c5eb;return _0x57f2ac;})[_0x9d13('0x23')](respondWithFilteredResult(_0x5c6fd5,_0x410ee5))['catch'](handleError(_0x5c6fd5,null));};exports[_0x9d13('0x42')]=function(_0x274d1c,_0x2fdbfd){var _0x1648dd={'raw':!![],'where':{'id':_0x274d1c[_0x9d13('0x43')]['id']}},_0x309440={};_0x309440[_0x9d13('0x2d')]=_['keys'](db[_0x9d13('0x29')][_0x9d13('0x2a')]);_0x309440[_0x9d13('0x2f')]=_[_0x9d13('0x2e')](_0x274d1c[_0x9d13('0x2f')]);_0x309440[_0x9d13('0x30')]=_[_0x9d13('0x31')](_0x309440[_0x9d13('0x2d')],_0x309440[_0x9d13('0x2f')]);_0x1648dd[_0x9d13('0x32')]=_[_0x9d13('0x31')](_0x309440['model'],qs['fields'](_0x274d1c[_0x9d13('0x2f')][_0x9d13('0x33')]));_0x1648dd['attributes']=_0x1648dd[_0x9d13('0x32')][_0x9d13('0x34')]?_0x1648dd[_0x9d13('0x32')]:_0x309440[_0x9d13('0x2d')];if(_0x274d1c[_0x9d13('0x2f')][_0x9d13('0x3d')]){_0x1648dd[_0x9d13('0x44')]=[{'all':!![]}];}_0x1648dd=_[_0x9d13('0x3a')]({},_0x1648dd,_0x274d1c[_0x9d13('0x3b')]);return db[_0x9d13('0x29')][_0x9d13('0x45')](_0x1648dd)[_0x9d13('0x23')](handleEntityNotFound(_0x2fdbfd,null))['then'](respondWithResult(_0x2fdbfd,null))['catch'](handleError(_0x2fdbfd,null));};exports[_0x9d13('0x46')]=function(_0x4024d8,_0x430eb2){return db[_0x9d13('0x29')][_0x9d13('0x46')](_0x4024d8['body'],{})[_0x9d13('0x23')](respondWithResult(_0x430eb2,0xc9))[_0x9d13('0x47')](handleError(_0x430eb2,null));};exports['destroy']=function(_0x48c3a2,_0x42065c){return db['VoiceCallReport'][_0x9d13('0x45')]({'where':{'id':_0x48c3a2[_0x9d13('0x43')]['id']}})['then'](handleEntityNotFound(_0x42065c,null))[_0x9d13('0x23')](removeEntity(_0x42065c,null))[_0x9d13('0x47')](handleError(_0x42065c,null));};exports['describe']=function(_0x55f757,_0x23f30e){return db[_0x9d13('0x29')]['describe']()['then'](respondWithResult(_0x23f30e,null))[_0x9d13('0x47')](handleError(_0x23f30e,null));};exports[_0x9d13('0x22')]=function(_0x3072b6,_0x261664){if(_0x3072b6[_0x9d13('0x48')][_0x9d13('0x49')]){delete _0x3072b6[_0x9d13('0x48')]['uniqueid'];}return db[_0x9d13('0x29')]['find']({'where':{'uniqueid':_0x3072b6[_0x9d13('0x43')]['id'],'UserId':{'$or':[null,_0x3072b6[_0x9d13('0x4a')]['id']]}}})[_0x9d13('0x23')](handleEntityNotFound(_0x261664,null))[_0x9d13('0x23')](saveUpdates(_0x3072b6['body'],null))[_0x9d13('0x23')](respondWithResult(_0x261664,null))[_0x9d13('0x47')](handleError(_0x261664,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index de392de..eee9e92 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 _0x6bf2=['define','VoiceCallReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','./voiceCallReport.attributes','exports'];(function(_0x181466,_0x4afe92){var _0x457a5b=function(_0x55ae04){while(--_0x55ae04){_0x181466['push'](_0x181466['shift']());}};_0x457a5b(++_0x4afe92);}(_0x6bf2,0x14d));var _0x26bf=function(_0x59fffc,_0x526e06){_0x59fffc=_0x59fffc-0x0;var _0x4e168e=_0x6bf2[_0x59fffc];return _0x4e168e;};'use strict';var _=require(_0x26bf('0x0'));var util=require(_0x26bf('0x1'));var logger=require(_0x26bf('0x2'))('api');var moment=require('moment');var BPromise=require(_0x26bf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x26bf('0x4'));var rimraf=require(_0x26bf('0x5'));var config=require('../../config/environment');var attributes=require(_0x26bf('0x6'));module[_0x26bf('0x7')]=function(_0xb20616,_0x318c19){return _0xb20616[_0x26bf('0x8')](_0x26bf('0x9'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x26bf('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2aa5=['./voiceCallReport.attributes','exports','define','report_call','lodash','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);}(_0x2aa5,0x12a));var _0x52aa=function(_0x520fad,_0x2fc7dc){_0x520fad=_0x520fad-0x0;var _0x1e871e=_0x2aa5[_0x520fad];return _0x1e871e;};'use strict';var _=require(_0x52aa('0x0'));var util=require(_0x52aa('0x1'));var logger=require(_0x52aa('0x2'))(_0x52aa('0x3'));var moment=require(_0x52aa('0x4'));var BPromise=require(_0x52aa('0x5'));var rp=require(_0x52aa('0x6'));var fs=require('fs');var path=require(_0x52aa('0x7'));var rimraf=require(_0x52aa('0x8'));var config=require(_0x52aa('0x9'));var attributes=require(_0x52aa('0xa'));module[_0x52aa('0xb')]=function(_0x3dcbe1,_0x3299a7){return _0x3dcbe1[_0x52aa('0xc')]('VoiceCallReport',attributes,{'tableName':_0x52aa('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index b402fbb..2fc256a 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 _0x36be=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVoiceCallReport','VoiceCallReport','findAll','options','limit','include','map','attributes','model','catch','CreateVoiceCallReport','body','UpdateVoiceCallReport','update','raw','where','lodash','util'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x36be,0x1b6));var _0xe36b=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x36be[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0xe36b('0x0'));var util=require(_0xe36b('0x1'));var moment=require(_0xe36b('0x2'));var BPromise=require(_0xe36b('0x3'));var rs=require(_0xe36b('0x4'));var fs=require('fs');var Redis=require(_0xe36b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe36b('0x6'));var logger=require(_0xe36b('0x7'))(_0xe36b('0x8'));var config=require(_0xe36b('0x9'));var jayson=require(_0xe36b('0xa'));var client=jayson[_0xe36b('0xb')][_0xe36b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x539b19,_0x1ad2f0,_0x15e148){return new BPromise(function(_0x1734d7,_0x4ed839){return client[_0xe36b('0xd')](_0x539b19,_0x15e148)[_0xe36b('0xe')](function(_0x172578){logger[_0xe36b('0xf')](_0xe36b('0x10'),_0x1ad2f0,_0xe36b('0x11'));logger[_0xe36b('0x12')](_0xe36b('0x13'),_0x1ad2f0,_0xe36b('0x11'),JSON[_0xe36b('0x14')](_0x172578));if(_0x172578['error']){if(_0x172578[_0xe36b('0x15')][_0xe36b('0x16')]===0x1f4){logger['error'](_0xe36b('0x10'),_0x1ad2f0,_0x172578['error'][_0xe36b('0x17')]);return _0x4ed839(_0x172578[_0xe36b('0x15')][_0xe36b('0x17')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x1ad2f0,_0x172578[_0xe36b('0x15')][_0xe36b('0x17')]);return _0x1734d7(_0x172578[_0xe36b('0x15')][_0xe36b('0x17')]);}else{logger[_0xe36b('0xf')](_0xe36b('0x10'),_0x1ad2f0,'request\x20sent');_0x1734d7(_0x172578['result'][_0xe36b('0x17')]);}})['catch'](function(_0x5e452b){logger[_0xe36b('0x15')](_0xe36b('0x10'),_0x1ad2f0,_0x5e452b);_0x4ed839(_0x5e452b);});});}exports[_0xe36b('0x18')]=function(_0x29c945){var _0x408613=this;return new Promise(function(_0x54b8f6,_0x45e9da){return db[_0xe36b('0x19')][_0xe36b('0x1a')]({'raw':_0x29c945[_0xe36b('0x1b')]?_0x29c945['options']['raw']===undefined?!![]:![]:!![],'where':_0x29c945[_0xe36b('0x1b')]?_0x29c945[_0xe36b('0x1b')]['where']||null:null,'attributes':_0x29c945[_0xe36b('0x1b')]?_0x29c945['options']['attributes']||null:null,'limit':_0x29c945[_0xe36b('0x1b')]?_0x29c945[_0xe36b('0x1b')][_0xe36b('0x1c')]||null:null,'include':_0x29c945[_0xe36b('0x1b')]?_0x29c945[_0xe36b('0x1b')][_0xe36b('0x1d')]?_[_0xe36b('0x1e')](_0x29c945[_0xe36b('0x1b')][_0xe36b('0x1d')],function(_0x2c91a2){return{'model':db[_0x2c91a2['model']],'as':_0x2c91a2['as'],'attributes':_0x2c91a2[_0xe36b('0x1f')],'include':_0x2c91a2[_0xe36b('0x1d')]?_[_0xe36b('0x1e')](_0x2c91a2[_0xe36b('0x1d')],function(_0x5b2885){return{'model':db[_0x5b2885[_0xe36b('0x20')]],'as':_0x5b2885['as'],'attributes':_0x5b2885['attributes'],'include':_0x5b2885[_0xe36b('0x1d')]?_[_0xe36b('0x1e')](_0x5b2885[_0xe36b('0x1d')],function(_0x43b651){return{'model':db[_0x43b651[_0xe36b('0x20')]],'as':_0x43b651['as'],'attributes':_0x43b651['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a7a8f){logger[_0xe36b('0xf')](_0xe36b('0x18'),_0x29c945);logger['debug'](_0xe36b('0x18'),_0x29c945,JSON['stringify'](_0x5a7a8f));_0x54b8f6(_0x5a7a8f);})[_0xe36b('0x21')](function(_0xf08b5f){logger[_0xe36b('0x15')](_0xe36b('0x18'),_0xf08b5f[_0xe36b('0x17')],_0x29c945);_0x45e9da(_0x408613[_0xe36b('0x15')](0x1f4,_0xf08b5f['message']));});});};exports[_0xe36b('0x22')]=function(_0x588167){var _0x1213e3=this;return new Promise(function(_0xb22580,_0x12afd2){return db['VoiceCallReport']['create'](_0x588167[_0xe36b('0x23')],{'raw':_0x588167[_0xe36b('0x1b')]?_0x588167[_0xe36b('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0xe36b('0xe')](function(_0x554e05){logger['info'](_0xe36b('0x22'),_0x588167);logger['debug']('CreateVoiceCallReport',_0x588167,JSON[_0xe36b('0x14')](_0x554e05));_0xb22580(_0x554e05);})[_0xe36b('0x21')](function(_0x2cf3a0){logger[_0xe36b('0x15')]('CreateVoiceCallReport',_0x2cf3a0[_0xe36b('0x17')],_0x588167);_0x12afd2(_0x1213e3[_0xe36b('0x15')](0x1f4,_0x2cf3a0['message']));});});};exports[_0xe36b('0x24')]=function(_0x5c1aa2){var _0x1c7e95=this;return new Promise(function(_0x179a20,_0x542da1){return db[_0xe36b('0x19')][_0xe36b('0x25')](_0x5c1aa2[_0xe36b('0x23')],{'raw':_0x5c1aa2[_0xe36b('0x1b')]?_0x5c1aa2['options'][_0xe36b('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c1aa2['options']?_0x5c1aa2[_0xe36b('0x1b')][_0xe36b('0x27')]||null:null,'attributes':_0x5c1aa2[_0xe36b('0x1b')]?_0x5c1aa2[_0xe36b('0x1b')][_0xe36b('0x1f')]||null:null,'limit':_0x5c1aa2['options']?_0x5c1aa2[_0xe36b('0x1b')][_0xe36b('0x1c')]||null:null})[_0xe36b('0xe')](function(_0x54a9ca){logger['info'](_0xe36b('0x24'),_0x5c1aa2);logger[_0xe36b('0x12')](_0xe36b('0x24'),_0x5c1aa2,JSON[_0xe36b('0x14')](_0x54a9ca));_0x179a20(_0x54a9ca);})[_0xe36b('0x21')](function(_0x3960d2){logger[_0xe36b('0x15')](_0xe36b('0x24'),_0x3960d2[_0xe36b('0x17')],_0x5c1aa2);_0x542da1(_0x1c7e95['error'](0x1f4,_0x3960d2[_0xe36b('0x17')]));});});}; \ No newline at end of file +var _0x8cc1=['attributes','map','GetVoiceCallReport','CreateVoiceCallReport','create','body','raw','update','UpdateVoiceCallReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','catch','VoiceCallReport','findAll','options','where','limit','include','model'];(function(_0x4ce1b9,_0x397a4b){var _0x2bb15d=function(_0x3790ad){while(--_0x3790ad){_0x4ce1b9['push'](_0x4ce1b9['shift']());}};_0x2bb15d(++_0x397a4b);}(_0x8cc1,0x7b));var _0x18cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8cc1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x18cc('0x0'));var util=require('util');var moment=require(_0x18cc('0x1'));var BPromise=require(_0x18cc('0x2'));var rs=require(_0x18cc('0x3'));var fs=require('fs');var Redis=require(_0x18cc('0x4'));var db=require(_0x18cc('0x5'))['db'];var utils=require(_0x18cc('0x6'));var logger=require(_0x18cc('0x7'))('rpc');var config=require(_0x18cc('0x8'));var jayson=require(_0x18cc('0x9'));var client=jayson['client'][_0x18cc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34c460,_0x18030e,_0xd7b407){return new BPromise(function(_0x19850d,_0x6c0d72){return client[_0x18cc('0xb')](_0x34c460,_0xd7b407)[_0x18cc('0xc')](function(_0x517678){logger[_0x18cc('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x18030e,_0x18cc('0xe'));logger[_0x18cc('0xf')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x18030e,_0x18cc('0xe'),JSON[_0x18cc('0x10')](_0x517678));if(_0x517678[_0x18cc('0x11')]){if(_0x517678['error'][_0x18cc('0x12')]===0x1f4){logger[_0x18cc('0x11')](_0x18cc('0x13'),_0x18030e,_0x517678[_0x18cc('0x11')][_0x18cc('0x14')]);return _0x6c0d72(_0x517678[_0x18cc('0x11')][_0x18cc('0x14')]);}logger[_0x18cc('0x11')](_0x18cc('0x13'),_0x18030e,_0x517678[_0x18cc('0x11')][_0x18cc('0x14')]);return _0x19850d(_0x517678[_0x18cc('0x11')]['message']);}else{logger[_0x18cc('0xd')](_0x18cc('0x13'),_0x18030e,_0x18cc('0xe'));_0x19850d(_0x517678['result']['message']);}})[_0x18cc('0x15')](function(_0x3f6ea1){logger[_0x18cc('0x11')](_0x18cc('0x13'),_0x18030e,_0x3f6ea1);_0x6c0d72(_0x3f6ea1);});});}exports['GetVoiceCallReport']=function(_0xd11c12){var _0x5b9a95=this;return new Promise(function(_0x330e73,_0x11bd5d){return db[_0x18cc('0x16')][_0x18cc('0x17')]({'raw':_0xd11c12[_0x18cc('0x18')]?_0xd11c12['options']['raw']===undefined?!![]:![]:!![],'where':_0xd11c12['options']?_0xd11c12[_0x18cc('0x18')][_0x18cc('0x19')]||null:null,'attributes':_0xd11c12[_0x18cc('0x18')]?_0xd11c12[_0x18cc('0x18')]['attributes']||null:null,'limit':_0xd11c12['options']?_0xd11c12[_0x18cc('0x18')][_0x18cc('0x1a')]||null:null,'include':_0xd11c12[_0x18cc('0x18')]?_0xd11c12['options'][_0x18cc('0x1b')]?_['map'](_0xd11c12[_0x18cc('0x18')]['include'],function(_0x309294){return{'model':db[_0x309294[_0x18cc('0x1c')]],'as':_0x309294['as'],'attributes':_0x309294[_0x18cc('0x1d')],'include':_0x309294[_0x18cc('0x1b')]?_[_0x18cc('0x1e')](_0x309294['include'],function(_0x251124){return{'model':db[_0x251124[_0x18cc('0x1c')]],'as':_0x251124['as'],'attributes':_0x251124[_0x18cc('0x1d')],'include':_0x251124[_0x18cc('0x1b')]?_[_0x18cc('0x1e')](_0x251124['include'],function(_0x416f1d){return{'model':db[_0x416f1d[_0x18cc('0x1c')]],'as':_0x416f1d['as'],'attributes':_0x416f1d['attributes']};}):[]};}):[]};}):[]:[]})[_0x18cc('0xc')](function(_0x5c2b39){logger['info']('GetVoiceCallReport',_0xd11c12);logger[_0x18cc('0xf')](_0x18cc('0x1f'),_0xd11c12,JSON['stringify'](_0x5c2b39));_0x330e73(_0x5c2b39);})[_0x18cc('0x15')](function(_0x360b85){logger[_0x18cc('0x11')](_0x18cc('0x1f'),_0x360b85[_0x18cc('0x14')],_0xd11c12);_0x11bd5d(_0x5b9a95['error'](0x1f4,_0x360b85[_0x18cc('0x14')]));});});};exports[_0x18cc('0x20')]=function(_0x41f881){var _0x617760=this;return new Promise(function(_0x290235,_0xe871f){return db[_0x18cc('0x16')][_0x18cc('0x21')](_0x41f881[_0x18cc('0x22')],{'raw':_0x41f881[_0x18cc('0x18')]?_0x41f881[_0x18cc('0x18')][_0x18cc('0x23')]===undefined?!![]:![]:!![]})[_0x18cc('0xc')](function(_0x1cb20a){logger[_0x18cc('0xd')](_0x18cc('0x20'),_0x41f881);logger['debug'](_0x18cc('0x20'),_0x41f881,JSON[_0x18cc('0x10')](_0x1cb20a));_0x290235(_0x1cb20a);})[_0x18cc('0x15')](function(_0x420590){logger['error'](_0x18cc('0x20'),_0x420590[_0x18cc('0x14')],_0x41f881);_0xe871f(_0x617760[_0x18cc('0x11')](0x1f4,_0x420590[_0x18cc('0x14')]));});});};exports['UpdateVoiceCallReport']=function(_0x12d25c){var _0x562c4e=this;return new Promise(function(_0x445dcc,_0x57ff8e){return db[_0x18cc('0x16')][_0x18cc('0x24')](_0x12d25c[_0x18cc('0x22')],{'raw':_0x12d25c[_0x18cc('0x18')]?_0x12d25c[_0x18cc('0x18')][_0x18cc('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12d25c[_0x18cc('0x18')]?_0x12d25c[_0x18cc('0x18')][_0x18cc('0x19')]||null:null,'attributes':_0x12d25c['options']?_0x12d25c[_0x18cc('0x18')]['attributes']||null:null,'limit':_0x12d25c['options']?_0x12d25c[_0x18cc('0x18')][_0x18cc('0x1a')]||null:null})['then'](function(_0x3b35a0){logger[_0x18cc('0xd')]('UpdateVoiceCallReport',_0x12d25c);logger[_0x18cc('0xf')](_0x18cc('0x25'),_0x12d25c,JSON[_0x18cc('0x10')](_0x3b35a0));_0x445dcc(_0x3b35a0);})[_0x18cc('0x15')](function(_0x45ca53){logger[_0x18cc('0x11')](_0x18cc('0x25'),_0x45ca53['message'],_0x12d25c);_0x57ff8e(_0x562c4e[_0x18cc('0x11')](0x1f4,_0x45ca53[_0x18cc('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 6e683c6..16dd9c9 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 _0x245c=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports'];(function(_0x4358f5,_0x5b1ac6){var _0x4d8104=function(_0x1d4aee){while(--_0x1d4aee){_0x4358f5['push'](_0x4358f5['shift']());}};_0x4d8104(++_0x5b1ac6);}(_0x245c,0x10a));var _0xc245=function(_0x519d97,_0x490a76){_0x519d97=_0x519d97-0x0;var _0x1e492a=_0x245c[_0x519d97];return _0x1e492a;};'use strict';var multer=require('multer');var util=require(_0xc245('0x0'));var path=require('path');var timeout=require(_0xc245('0x1'));var express=require(_0xc245('0x2'));var router=express[_0xc245('0x3')]();var auth=require(_0xc245('0x4'));var interaction=require(_0xc245('0x5'));var config=require(_0xc245('0x6'));var controller=require(_0xc245('0x7'));router[_0xc245('0x8')]('/',auth[_0xc245('0x9')](),controller['index']);router['get']('/:id',auth[_0xc245('0x9')](),controller[_0xc245('0xa')]);router[_0xc245('0xb')]('/',auth['isAuthenticated'](),controller[_0xc245('0xc')]);router[_0xc245('0xd')]('/:id',auth[_0xc245('0x9')](),controller[_0xc245('0xe')]);router[_0xc245('0xf')](_0xc245('0x10'),auth[_0xc245('0x9')](),controller[_0xc245('0x11')]);module[_0xc245('0x12')]=router; \ No newline at end of file +var _0x5c91=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index','get','/:id','post','create','update','destroy','multer','util','path','express'];(function(_0x1ce030,_0x4d0eda){var _0xdd4bc8=function(_0x1fba01){while(--_0x1fba01){_0x1ce030['push'](_0x1ce030['shift']());}};_0xdd4bc8(++_0x4d0eda);}(_0x5c91,0x1e9));var _0x15c9=function(_0xddb364,_0x43cd01){_0xddb364=_0xddb364-0x0;var _0x41a503=_0x5c91[_0xddb364];return _0x41a503;};'use strict';var multer=require(_0x15c9('0x0'));var util=require(_0x15c9('0x1'));var path=require(_0x15c9('0x2'));var timeout=require('connect-timeout');var express=require(_0x15c9('0x3'));var router=express[_0x15c9('0x4')]();var auth=require(_0x15c9('0x5'));var interaction=require(_0x15c9('0x6'));var config=require(_0x15c9('0x7'));var controller=require(_0x15c9('0x8'));router['get']('/',auth[_0x15c9('0x9')](),controller[_0x15c9('0xa')]);router[_0x15c9('0xb')](_0x15c9('0xc'),auth[_0x15c9('0x9')](),controller['show']);router[_0x15c9('0xd')]('/',auth[_0x15c9('0x9')](),controller[_0x15c9('0xe')]);router['put'](_0x15c9('0xc'),auth[_0x15c9('0x9')](),controller[_0x15c9('0xf')]);router['delete']('/:id',auth[_0x15c9('0x9')](),controller[_0x15c9('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 6963a4f..4c52ada 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 _0xa702=['setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name'];(function(_0xfc36ea,_0x21ac9){var _0x88da33=function(_0x573824){while(--_0x573824){_0xfc36ea['push'](_0xfc36ea['shift']());}};_0x88da33(++_0x21ac9);}(_0xa702,0x182));var _0x2a70=function(_0x5f3aad,_0x59decc){_0x5f3aad=_0x5f3aad-0x0;var _0x579347=_0xa702[_0x5f3aad];return _0x579347;};'use strict';var Sequelize=require(_0x2a70('0x0'));module[_0x2a70('0x1')]={'name':{'type':Sequelize[_0x2a70('0x2')]},'prefix':{'type':Sequelize[_0x2a70('0x2')],'unique':_0x2a70('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x2a70('0x2')],'set':function(_0x2d292e){this[_0x2a70('0x4')](_0x2a70('0x5'),_0x2d292e?_0x2d292e[_0x2a70('0x6')](''):[]);},'get':function(){return this[_0x2a70('0x7')](_0x2a70('0x5'))?this['getDataValue']('options')[_0x2a70('0x8')](''):[];}},'auth':{'type':Sequelize[_0x2a70('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x2a70('0x2')]},'record':{'type':Sequelize[_0x2a70('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x2a70('0x2')]},'description':{'type':Sequelize[_0x2a70('0x2')]}}; \ No newline at end of file +var _0x28a6=['join','getDataValue','split','BOOLEAN','sequelize','exports','name','STRING','setDataValue','options'];(function(_0x387e89,_0x5a55e0){var _0x32fb81=function(_0x2f4f22){while(--_0x2f4f22){_0x387e89['push'](_0x387e89['shift']());}};_0x32fb81(++_0x5a55e0);}(_0x28a6,0x1c6));var _0x628a=function(_0x40aaa4,_0x3b22f4){_0x40aaa4=_0x40aaa4-0x0;var _0x4e21e5=_0x28a6[_0x40aaa4];return _0x4e21e5;};'use strict';var Sequelize=require(_0x628a('0x0'));module[_0x628a('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0x628a('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x628a('0x3')],'set':function(_0x1880cf){this[_0x628a('0x4')](_0x628a('0x5'),_0x1880cf?_0x1880cf[_0x628a('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0x628a('0x5'))?this[_0x628a('0x7')](_0x628a('0x5'))[_0x628a('0x8')](''):[];}},'auth':{'type':Sequelize[_0x628a('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x628a('0x3')]},'record':{'type':Sequelize[_0x628a('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x628a('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index e66cbd2..f519dbc 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 _0xffdc=['key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','VoiceChanSpy','includeAll','include','findAll','rows','catch','params','fields','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','update','then','UserProfileResource','destroy','error','name','send','index','map','rawAttributes','fieldName'];(function(_0xb56652,_0x4f1917){var _0x32ca6b=function(_0x2c0479){while(--_0x2c0479){_0xb56652['push'](_0xb56652['shift']());}};_0x32ca6b(++_0x4f1917);}(_0xffdc,0x71));var _0xcffd=function(_0x405d46,_0x478e6a){_0x405d46=_0x405d46-0x0;var _0x53ca91=_0xffdc[_0x405d46];return _0x53ca91;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcffd('0x0'));var rimraf=require(_0xcffd('0x1'));var zipdir=require(_0xcffd('0x2'));var jsonpatch=require(_0xcffd('0x3'));var rp=require(_0xcffd('0x4'));var moment=require(_0xcffd('0x5'));var BPromise=require(_0xcffd('0x6'));var Mustache=require(_0xcffd('0x7'));var util=require('util');var path=require('path');var sox=require(_0xcffd('0x8'));var csv=require(_0xcffd('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcffd('0xa'));var squel=require(_0xcffd('0xb'));var crypto=require('crypto');var jsforce=require(_0xcffd('0xc'));var deskjs=require(_0xcffd('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcffd('0xe'));var Papa=require('papaparse');var Redis=require(_0xcffd('0xf'));var authService=require(_0xcffd('0x10'));var qs=require(_0xcffd('0x11'));var as=require(_0xcffd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcffd('0x13'))(_0xcffd('0x14'));var utils=require(_0xcffd('0x15'));var config=require(_0xcffd('0x16'));var db=require(_0xcffd('0x17'))['db'];function respondWithStatusCode(_0x2f70ea,_0x2bf1fa){_0x2bf1fa=_0x2bf1fa||0xcc;return function(_0x911241){if(_0x911241){return _0x2f70ea[_0xcffd('0x18')](_0x2bf1fa);}return _0x2f70ea[_0xcffd('0x19')](_0x2bf1fa)[_0xcffd('0x1a')]();};}function respondWithResult(_0x289db4,_0x3e36f3){_0x3e36f3=_0x3e36f3||0xc8;return function(_0x10df91){if(_0x10df91){return _0x289db4[_0xcffd('0x19')](_0x3e36f3)['json'](_0x10df91);}};}function respondWithFilteredResult(_0x501e67,_0x3a6b69){return function(_0x1dafdc){if(_0x1dafdc){var _0x27a6f7=_0x1dafdc[_0xcffd('0x1b')],_0x3e9a16=_0x3a6b69[_0xcffd('0x1c')],_0x325d2f=_0x3a6b69[_0xcffd('0x1c')]+_0x3a6b69[_0xcffd('0x1d')],_0x5c9a96;if(_0x325d2f>=_0x27a6f7){_0x325d2f=_0x27a6f7;_0x5c9a96=0xc8;}else{_0x5c9a96=0xce;}_0x501e67[_0xcffd('0x19')](_0x5c9a96);return _0x501e67[_0xcffd('0x1e')](_0xcffd('0x1f'),_0x3e9a16+'-'+_0x325d2f+'/'+_0x27a6f7)['json'](_0x1dafdc);}return null;};}function patchUpdates(_0x353062){return function(_0x3fe53f){try{jsonpatch['apply'](_0x3fe53f,_0x353062,!![]);}catch(_0x2747cc){return BPromise['reject'](_0x2747cc);}return _0x3fe53f['save']();};}function saveUpdates(_0x4a15c8,_0x4561e2){return function(_0x30bd53){if(_0x30bd53){return _0x30bd53[_0xcffd('0x20')](_0x4a15c8)[_0xcffd('0x21')](function(_0x4b2e65){return _0x4b2e65;});}return null;};}function removeEntity(_0x1161b5,_0xff6c41){return function(_0x2c159c){if(_0x2c159c){return _0x2c159c['destroy']()[_0xcffd('0x21')](function(){var _0x3a8016=_0x2c159c['get']({'plain':!![]});var _0x4e0db4='ChanSpies';return db[_0xcffd('0x22')][_0xcffd('0x23')]({'where':{'type':_0x4e0db4,'resourceId':_0x3a8016['id']}})[_0xcffd('0x21')](function(){return _0x2c159c;});})[_0xcffd('0x21')](function(){_0x1161b5[_0xcffd('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x596a7c,_0x3ac063){return function(_0x317f79){if(!_0x317f79){_0x596a7c[_0xcffd('0x18')](0x194);}return _0x317f79;};}function handleError(_0x47fc16,_0x3e6212){_0x3e6212=_0x3e6212||0x1f4;return function(_0x24cbb5){logger[_0xcffd('0x24')](_0x24cbb5['stack']);if(_0x24cbb5[_0xcffd('0x25')]){delete _0x24cbb5[_0xcffd('0x25')];}_0x47fc16[_0xcffd('0x19')](_0x3e6212)[_0xcffd('0x26')](_0x24cbb5);};}exports[_0xcffd('0x27')]=function(_0x2d3029,_0x44c030){var _0x15b25a={},_0xc9e6a2={},_0x23fd3d={'count':0x0,'rows':[]};var _0x3b5ffc=_[_0xcffd('0x28')](db['VoiceChanSpy'][_0xcffd('0x29')],function(_0x5b3169){return{'name':_0x5b3169[_0xcffd('0x2a')],'type':_0x5b3169['type'][_0xcffd('0x2b')]};});_0xc9e6a2[_0xcffd('0x2c')]=_[_0xcffd('0x28')](_0x3b5ffc,_0xcffd('0x25'));_0xc9e6a2[_0xcffd('0x2d')]=_[_0xcffd('0x2e')](_0x2d3029[_0xcffd('0x2d')]);_0xc9e6a2[_0xcffd('0x2f')]=_[_0xcffd('0x30')](_0xc9e6a2[_0xcffd('0x2c')],_0xc9e6a2['query']);_0x15b25a[_0xcffd('0x31')]=_['intersection'](_0xc9e6a2[_0xcffd('0x2c')],qs['fields'](_0x2d3029[_0xcffd('0x2d')]['fields']));_0x15b25a[_0xcffd('0x31')]=_0x15b25a['attributes'][_0xcffd('0x32')]?_0x15b25a[_0xcffd('0x31')]:_0xc9e6a2[_0xcffd('0x2c')];if(!_0x2d3029['query']['hasOwnProperty'](_0xcffd('0x33'))){_0x15b25a['limit']=qs[_0xcffd('0x1d')](_0x2d3029[_0xcffd('0x2d')]['limit']);_0x15b25a[_0xcffd('0x1c')]=qs['offset'](_0x2d3029[_0xcffd('0x2d')][_0xcffd('0x1c')]);}_0x15b25a[_0xcffd('0x34')]=qs[_0xcffd('0x35')](_0x2d3029[_0xcffd('0x2d')]['sort']);_0x15b25a['where']=qs[_0xcffd('0x2f')](_['pick'](_0x2d3029[_0xcffd('0x2d')],_0xc9e6a2[_0xcffd('0x2f')]));if(_0x2d3029[_0xcffd('0x2d')]['filter']){_0x15b25a[_0xcffd('0x36')]=_['merge'](_0x15b25a['where'],{'$or':_[_0xcffd('0x28')](_0x3b5ffc,function(_0x32f3fb){if(_0x32f3fb[_0xcffd('0x37')]!==_0xcffd('0x38')){var _0x5ed781={};_0x5ed781[_0x32f3fb['name']]={'$like':'%'+_0x2d3029[_0xcffd('0x2d')][_0xcffd('0x39')]+'%'};return _0x5ed781;}})});}_0x15b25a=_[_0xcffd('0x3a')]({},_0x15b25a,_0x2d3029[_0xcffd('0x3b')]);var _0x55cd57={'where':_0x15b25a[_0xcffd('0x36')]};return db[_0xcffd('0x3c')][_0xcffd('0x1b')](_0x55cd57)[_0xcffd('0x21')](function(_0x1ede6d){_0x23fd3d[_0xcffd('0x1b')]=_0x1ede6d;if(_0x2d3029[_0xcffd('0x2d')][_0xcffd('0x3d')]){_0x15b25a[_0xcffd('0x3e')]=[{'all':!![]}];}return db[_0xcffd('0x3c')][_0xcffd('0x3f')](_0x15b25a);})[_0xcffd('0x21')](function(_0x1e105b){_0x23fd3d[_0xcffd('0x40')]=_0x1e105b;return _0x23fd3d;})[_0xcffd('0x21')](respondWithFilteredResult(_0x44c030,_0x15b25a))[_0xcffd('0x41')](handleError(_0x44c030,null));};exports['show']=function(_0x4def2f,_0x5a1045){var _0x281f2c={'raw':![],'where':{'id':_0x4def2f[_0xcffd('0x42')]['id']}},_0x32e1f0={};_0x32e1f0[_0xcffd('0x2c')]=_[_0xcffd('0x2e')](db[_0xcffd('0x3c')][_0xcffd('0x29')]);_0x32e1f0[_0xcffd('0x2d')]=_[_0xcffd('0x2e')](_0x4def2f[_0xcffd('0x2d')]);_0x32e1f0[_0xcffd('0x2f')]=_[_0xcffd('0x30')](_0x32e1f0[_0xcffd('0x2c')],_0x32e1f0['query']);_0x281f2c['attributes']=_[_0xcffd('0x30')](_0x32e1f0[_0xcffd('0x2c')],qs[_0xcffd('0x43')](_0x4def2f[_0xcffd('0x2d')][_0xcffd('0x43')]));_0x281f2c[_0xcffd('0x31')]=_0x281f2c[_0xcffd('0x31')]['length']?_0x281f2c[_0xcffd('0x31')]:_0x32e1f0[_0xcffd('0x2c')];if(_0x4def2f['query'][_0xcffd('0x3d')]){_0x281f2c[_0xcffd('0x3e')]=[{'all':!![]}];}_0x281f2c=_[_0xcffd('0x3a')]({},_0x281f2c,_0x4def2f[_0xcffd('0x3b')]);return db[_0xcffd('0x3c')][_0xcffd('0x44')](_0x281f2c)[_0xcffd('0x21')](handleEntityNotFound(_0x5a1045,null))[_0xcffd('0x21')](respondWithResult(_0x5a1045,null))[_0xcffd('0x41')](handleError(_0x5a1045,null));};exports[_0xcffd('0x45')]=function(_0x368c38,_0x1f309b){return db[_0xcffd('0x3c')]['create'](_0x368c38[_0xcffd('0x46')],{})[_0xcffd('0x21')](function(_0x1af13b){var _0x2075b5=_0x368c38[_0xcffd('0x47')][_0xcffd('0x48')]({'plain':!![]});if(!_0x2075b5)throw new Error(_0xcffd('0x49'));if(_0x2075b5[_0xcffd('0x4a')]==='user'){var _0x201e9a=_0x1af13b[_0xcffd('0x48')]({'plain':!![]});var _0x1e0e67='ChanSpies';return db[_0xcffd('0x4b')]['find']({'where':{'name':_0x1e0e67,'userProfileId':_0x2075b5[_0xcffd('0x4c')]},'raw':!![]})['then'](function(_0x2ccca3){if(_0x2ccca3&&_0x2ccca3['autoAssociation']===0x0){return db[_0xcffd('0x22')]['create']({'name':_0x201e9a[_0xcffd('0x25')],'resourceId':_0x201e9a['id'],'type':_0x2ccca3[_0xcffd('0x25')],'sectionId':_0x2ccca3['id']},{})[_0xcffd('0x21')](function(){return _0x1af13b;});}else{return _0x1af13b;}})[_0xcffd('0x41')](function(_0x663a30){logger[_0xcffd('0x24')](_0xcffd('0x4d'),_0x663a30);throw _0x663a30;});}return _0x1af13b;})[_0xcffd('0x21')](respondWithResult(_0x1f309b,0xc9))[_0xcffd('0x41')](handleError(_0x1f309b,null));};exports['update']=function(_0x4ca187,_0x3dd28a){if(_0x4ca187['body']['id']){delete _0x4ca187[_0xcffd('0x46')]['id'];}return db[_0xcffd('0x3c')][_0xcffd('0x44')]({'where':{'id':_0x4ca187[_0xcffd('0x42')]['id']}})[_0xcffd('0x21')](handleEntityNotFound(_0x3dd28a,null))[_0xcffd('0x21')](saveUpdates(_0x4ca187[_0xcffd('0x46')],null))[_0xcffd('0x21')](respondWithResult(_0x3dd28a,null))['catch'](handleError(_0x3dd28a,null));};exports['destroy']=function(_0x32f09b,_0xcaeeaf){return db[_0xcffd('0x3c')][_0xcffd('0x44')]({'where':{'id':_0x32f09b[_0xcffd('0x42')]['id']}})[_0xcffd('0x21')](handleEntityNotFound(_0xcaeeaf,null))[_0xcffd('0x21')](removeEntity(_0xcaeeaf,null))['catch'](handleError(_0xcaeeaf,null));}; \ No newline at end of file +var _0xba2b=['intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filters','merge','map','where','VoiceChanSpy','include','findAll','catch','show','params','rawAttributes','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','ChanSpies','end','stack','name','send','index','fieldName','type','model','keys','query'];(function(_0x4ad1f7,_0x19af76){var _0x229f7d=function(_0x2f7bfc){while(--_0x2f7bfc){_0x4ad1f7['push'](_0x4ad1f7['shift']());}};_0x229f7d(++_0x19af76);}(_0xba2b,0x16a));var _0xbba2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xba2b[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xbba2('0x0'));var emlformat=require(_0xbba2('0x1'));var rimraf=require(_0xbba2('0x2'));var zipdir=require(_0xbba2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbba2('0x4'));var moment=require('moment');var BPromise=require(_0xbba2('0x5'));var Mustache=require(_0xbba2('0x6'));var util=require(_0xbba2('0x7'));var path=require(_0xbba2('0x8'));var sox=require(_0xbba2('0x9'));var csv=require(_0xbba2('0xa'));var ejs=require(_0xbba2('0xb'));var fs=require('fs');var _=require(_0xbba2('0xc'));var squel=require(_0xbba2('0xd'));var crypto=require(_0xbba2('0xe'));var jsforce=require(_0xbba2('0xf'));var deskjs=require(_0xbba2('0x10'));var toCsv=require(_0xbba2('0xa'));var querystring=require(_0xbba2('0x11'));var Papa=require(_0xbba2('0x12'));var Redis=require(_0xbba2('0x13'));var authService=require(_0xbba2('0x14'));var qs=require(_0xbba2('0x15'));var as=require(_0xbba2('0x16'));var hardwareService=require(_0xbba2('0x17'));var logger=require(_0xbba2('0x18'))(_0xbba2('0x19'));var utils=require('../../config/utils');var config=require(_0xbba2('0x1a'));var db=require(_0xbba2('0x1b'))['db'];function respondWithStatusCode(_0x48a3fa,_0x47286d){_0x47286d=_0x47286d||0xcc;return function(_0x4b438a){if(_0x4b438a){return _0x48a3fa[_0xbba2('0x1c')](_0x47286d);}return _0x48a3fa[_0xbba2('0x1d')](_0x47286d)['end']();};}function respondWithResult(_0x4aedd8,_0x2af180){_0x2af180=_0x2af180||0xc8;return function(_0x371216){if(_0x371216){return _0x4aedd8[_0xbba2('0x1d')](_0x2af180)[_0xbba2('0x1e')](_0x371216);}};}function respondWithFilteredResult(_0x2f9fcb,_0x288b6b){return function(_0x474c0f){if(_0x474c0f){var _0x5c9193=_0x474c0f[_0xbba2('0x1f')],_0x19c80f=_0x288b6b[_0xbba2('0x20')],_0x5e02ef=_0x288b6b[_0xbba2('0x20')]+_0x288b6b[_0xbba2('0x21')],_0x7d3f7e;if(_0x5e02ef>=_0x5c9193){_0x5e02ef=_0x5c9193;_0x7d3f7e=0xc8;}else{_0x7d3f7e=0xce;}_0x2f9fcb[_0xbba2('0x1d')](_0x7d3f7e);return _0x2f9fcb[_0xbba2('0x22')]('Content-Range',_0x19c80f+'-'+_0x5e02ef+'/'+_0x5c9193)[_0xbba2('0x1e')](_0x474c0f);}return null;};}function patchUpdates(_0x423ef2){return function(_0xee07ec){try{jsonpatch[_0xbba2('0x23')](_0xee07ec,_0x423ef2,!![]);}catch(_0x57b277){return BPromise[_0xbba2('0x24')](_0x57b277);}return _0xee07ec[_0xbba2('0x25')]();};}function saveUpdates(_0x226cc2,_0x5fffef){return function(_0xd66cf9){if(_0xd66cf9){return _0xd66cf9[_0xbba2('0x26')](_0x226cc2)[_0xbba2('0x27')](function(_0xaed97b){return _0xaed97b;});}return null;};}function removeEntity(_0x4739fe,_0x40a2b6){return function(_0x1ef14d){if(_0x1ef14d){return _0x1ef14d[_0xbba2('0x28')]()[_0xbba2('0x27')](function(){var _0x70bf86=_0x1ef14d[_0xbba2('0x29')]({'plain':!![]});var _0x2f6c8b=_0xbba2('0x2a');return db['UserProfileResource'][_0xbba2('0x28')]({'where':{'type':_0x2f6c8b,'resourceId':_0x70bf86['id']}})[_0xbba2('0x27')](function(){return _0x1ef14d;});})['then'](function(){_0x4739fe[_0xbba2('0x1d')](0xcc)[_0xbba2('0x2b')]();});}};}function handleEntityNotFound(_0x5654d0,_0x3f29f3){return function(_0x5b11c7){if(!_0x5b11c7){_0x5654d0[_0xbba2('0x1c')](0x194);}return _0x5b11c7;};}function handleError(_0x4474d3,_0x16893b){_0x16893b=_0x16893b||0x1f4;return function(_0x333985){logger['error'](_0x333985[_0xbba2('0x2c')]);if(_0x333985[_0xbba2('0x2d')]){delete _0x333985[_0xbba2('0x2d')];}_0x4474d3[_0xbba2('0x1d')](_0x16893b)[_0xbba2('0x2e')](_0x333985);};}exports[_0xbba2('0x2f')]=function(_0xf0a072,_0xf8f1cd){var _0x2724a7={},_0x4972ab={},_0x548c6={'count':0x0,'rows':[]};var _0x125240=_['map'](db['VoiceChanSpy']['rawAttributes'],function(_0x26ddfb){return{'name':_0x26ddfb[_0xbba2('0x30')],'type':_0x26ddfb[_0xbba2('0x31')]['key']};});_0x4972ab[_0xbba2('0x32')]=_['map'](_0x125240,_0xbba2('0x2d'));_0x4972ab['query']=_[_0xbba2('0x33')](_0xf0a072[_0xbba2('0x34')]);_0x4972ab['filters']=_[_0xbba2('0x35')](_0x4972ab['model'],_0x4972ab[_0xbba2('0x34')]);_0x2724a7[_0xbba2('0x36')]=_[_0xbba2('0x35')](_0x4972ab['model'],qs[_0xbba2('0x37')](_0xf0a072[_0xbba2('0x34')][_0xbba2('0x37')]));_0x2724a7[_0xbba2('0x36')]=_0x2724a7[_0xbba2('0x36')][_0xbba2('0x38')]?_0x2724a7[_0xbba2('0x36')]:_0x4972ab[_0xbba2('0x32')];if(!_0xf0a072[_0xbba2('0x34')][_0xbba2('0x39')]('nolimit')){_0x2724a7[_0xbba2('0x21')]=qs[_0xbba2('0x21')](_0xf0a072[_0xbba2('0x34')][_0xbba2('0x21')]);_0x2724a7[_0xbba2('0x20')]=qs[_0xbba2('0x20')](_0xf0a072[_0xbba2('0x34')][_0xbba2('0x20')]);}_0x2724a7[_0xbba2('0x3a')]=qs[_0xbba2('0x3b')](_0xf0a072['query'][_0xbba2('0x3b')]);_0x2724a7['where']=qs['filters'](_[_0xbba2('0x3c')](_0xf0a072[_0xbba2('0x34')],_0x4972ab[_0xbba2('0x3d')]));if(_0xf0a072['query']['filter']){_0x2724a7['where']=_[_0xbba2('0x3e')](_0x2724a7['where'],{'$or':_[_0xbba2('0x3f')](_0x125240,function(_0x1f988c){if(_0x1f988c[_0xbba2('0x31')]!=='VIRTUAL'){var _0x205a59={};_0x205a59[_0x1f988c[_0xbba2('0x2d')]]={'$like':'%'+_0xf0a072[_0xbba2('0x34')]['filter']+'%'};return _0x205a59;}})});}_0x2724a7=_['merge']({},_0x2724a7,_0xf0a072['options']);var _0x2d4950={'where':_0x2724a7[_0xbba2('0x40')]};return db[_0xbba2('0x41')][_0xbba2('0x1f')](_0x2d4950)['then'](function(_0x24ed77){_0x548c6['count']=_0x24ed77;if(_0xf0a072[_0xbba2('0x34')]['includeAll']){_0x2724a7[_0xbba2('0x42')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xbba2('0x43')](_0x2724a7);})[_0xbba2('0x27')](function(_0x1761f7){_0x548c6['rows']=_0x1761f7;return _0x548c6;})[_0xbba2('0x27')](respondWithFilteredResult(_0xf8f1cd,_0x2724a7))[_0xbba2('0x44')](handleError(_0xf8f1cd,null));};exports[_0xbba2('0x45')]=function(_0x2312a0,_0x1f0a08){var _0x545a89={'raw':![],'where':{'id':_0x2312a0[_0xbba2('0x46')]['id']}},_0x424fab={};_0x424fab[_0xbba2('0x32')]=_['keys'](db[_0xbba2('0x41')][_0xbba2('0x47')]);_0x424fab['query']=_[_0xbba2('0x33')](_0x2312a0[_0xbba2('0x34')]);_0x424fab[_0xbba2('0x3d')]=_[_0xbba2('0x35')](_0x424fab['model'],_0x424fab[_0xbba2('0x34')]);_0x545a89[_0xbba2('0x36')]=_[_0xbba2('0x35')](_0x424fab['model'],qs[_0xbba2('0x37')](_0x2312a0[_0xbba2('0x34')]['fields']));_0x545a89[_0xbba2('0x36')]=_0x545a89[_0xbba2('0x36')]['length']?_0x545a89['attributes']:_0x424fab[_0xbba2('0x32')];if(_0x2312a0['query']['includeAll']){_0x545a89[_0xbba2('0x42')]=[{'all':!![]}];}_0x545a89=_[_0xbba2('0x3e')]({},_0x545a89,_0x2312a0[_0xbba2('0x48')]);return db['VoiceChanSpy']['find'](_0x545a89)[_0xbba2('0x27')](handleEntityNotFound(_0x1f0a08,null))[_0xbba2('0x27')](respondWithResult(_0x1f0a08,null))[_0xbba2('0x44')](handleError(_0x1f0a08,null));};exports[_0xbba2('0x49')]=function(_0x23af47,_0x3e0561){return db[_0xbba2('0x41')][_0xbba2('0x49')](_0x23af47[_0xbba2('0x4a')],{})[_0xbba2('0x27')](function(_0xa74194){var _0x3c7ee4=_0x23af47[_0xbba2('0x4b')][_0xbba2('0x29')]({'plain':!![]});if(!_0x3c7ee4)throw new Error(_0xbba2('0x4c'));if(_0x3c7ee4[_0xbba2('0x4d')]==='user'){var _0x4c194c=_0xa74194[_0xbba2('0x29')]({'plain':!![]});var _0x444e48=_0xbba2('0x2a');return db[_0xbba2('0x4e')][_0xbba2('0x4f')]({'where':{'name':_0x444e48,'userProfileId':_0x3c7ee4['userProfileId']},'raw':!![]})[_0xbba2('0x27')](function(_0x1aa892){if(_0x1aa892&&_0x1aa892[_0xbba2('0x50')]===0x0){return db[_0xbba2('0x51')]['create']({'name':_0x4c194c['name'],'resourceId':_0x4c194c['id'],'type':_0x1aa892[_0xbba2('0x2d')],'sectionId':_0x1aa892['id']},{})[_0xbba2('0x27')](function(){return _0xa74194;});}else{return _0xa74194;}})[_0xbba2('0x44')](function(_0x37c1b7){logger['error'](_0xbba2('0x52'),_0x37c1b7);throw _0x37c1b7;});}return _0xa74194;})[_0xbba2('0x27')](respondWithResult(_0x3e0561,0xc9))[_0xbba2('0x44')](handleError(_0x3e0561,null));};exports['update']=function(_0x5a5075,_0x5aa35f){if(_0x5a5075[_0xbba2('0x4a')]['id']){delete _0x5a5075['body']['id'];}return db[_0xbba2('0x41')][_0xbba2('0x4f')]({'where':{'id':_0x5a5075[_0xbba2('0x46')]['id']}})['then'](handleEntityNotFound(_0x5aa35f,null))['then'](saveUpdates(_0x5a5075[_0xbba2('0x4a')],null))['then'](respondWithResult(_0x5aa35f,null))[_0xbba2('0x44')](handleError(_0x5aa35f,null));};exports[_0xbba2('0x28')]=function(_0x1ac2ae,_0x3b60d8){return db['VoiceChanSpy'][_0xbba2('0x4f')]({'where':{'id':_0x1ac2ae[_0xbba2('0x46')]['id']}})[_0xbba2('0x27')](handleEntityNotFound(_0x3b60d8,null))[_0xbba2('0x27')](removeEntity(_0x3b60d8,null))[_0xbba2('0x44')](handleError(_0x3b60d8,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index dc6511b..b68a746 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 _0x594f=['options','join','record','StopMixMonitor','length','concat','internal','then','exports','VoiceChanSpy','bulkCreate','catch','VoiceExtension','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip','push','merge','Set','format','CDR(type)=%s','MixMonitor','${UNIQUEID}.%s,ab','recordingFormat','Authenticate','password','SIP/%s,%s','name'];(function(_0x3627d4,_0x445157){var _0x261fa6=function(_0x46c001){while(--_0x46c001){_0x3627d4['push'](_0x3627d4['shift']());}};_0x261fa6(++_0x445157);}(_0x594f,0x1cf));var _0xf594=function(_0xd7a8d,_0x142ef9){_0xd7a8d=_0xd7a8d-0x0;var _0x33f9c5=_0x594f[_0xd7a8d];return _0x33f9c5;};'use strict';var _=require(_0xf594('0x0'));var util=require('util');var BPromise=require(_0xf594('0x1'));var attributes=require(_0xf594('0x2'));var getUserApplications=function(_0x1a6158,_0x2fbcfb,_0x18e84f){var _0xfd43ef=0x1;var _0x453c7d=[];var _0x35325b={'context':_0x2fbcfb[_0xf594('0x3')]||_0xf594('0x4'),'exten':util['format']('%s%s',_0x1a6158['prefix'],_0x18e84f),'type':'system','isApp':![],'ChanSpyId':_0x1a6158['id'],'UserId':_0x2fbcfb['id']};_0x453c7d[_0xf594('0x5')](_[_0xf594('0x6')]({'app':_0xf594('0x7'),'appdata':util[_0xf594('0x8')](_0xf594('0x9'),'chanspy'),'priority':_0xfd43ef++},_0x35325b));if(_0x1a6158['record']){_0x453c7d[_0xf594('0x5')](_[_0xf594('0x6')]({'app':_0xf594('0xa'),'appdata':util[_0xf594('0x8')](_0xf594('0xb'),_0x1a6158[_0xf594('0xc')]),'priority':_0xfd43ef++},_0x35325b));}if(_0x1a6158['auth']){_0x453c7d['push'](_[_0xf594('0x6')]({'app':_0xf594('0xd'),'appdata':_0x1a6158[_0xf594('0xe')],'priority':_0xfd43ef++},_0x35325b));}_0x453c7d[_0xf594('0x5')](_[_0xf594('0x6')]({'app':'ChanSpy','appdata':util[_0xf594('0x8')](_0xf594('0xf'),_0x2fbcfb[_0xf594('0x10')],_0x1a6158['options']?_0x1a6158[_0xf594('0x11')][_0xf594('0x12')](''):''),'priority':_0xfd43ef++},_0x35325b));if(_0x1a6158[_0xf594('0x13')]){_0x453c7d['push'](_[_0xf594('0x6')]({'app':_0xf594('0x14'),'priority':_0xfd43ef++},_0x35325b));}return _0x453c7d;};var getChanSpyApplications=function(_0x39db96,_0x4a5ab2){var _0x4cd843=[];for(var _0x429445=0x0,_0x37eb62=0x1;_0x429445<_0x4a5ab2[_0xf594('0x15')];_0x429445++,_0x37eb62=0x1){_0x4cd843=_0x4cd843[_0xf594('0x16')](getUserApplications(_0x39db96,_0x4a5ab2[_0x429445],_0x4a5ab2[_0x429445][_0xf594('0x17')]));if(_0x4a5ab2[_0x429445]['internal']!=_0x4a5ab2[_0x429445][_0xf594('0x10')]){_0x4cd843=_0x4cd843[_0xf594('0x16')](getUserApplications(_0x39db96,_0x4a5ab2[_0x429445],_0x4a5ab2[_0x429445][_0xf594('0x10')]));}}return _0x4cd843;};var getChanSpyPromise=function(_0x2e046d,_0x3791c5){return new BPromise(function(_0x252061,_0xb7347d){return _0x2e046d['User']['findAll']({'attributes':['id',_0xf594('0x10'),'internal'],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xf594('0x18')](function(_0x1e71db){if(_0x1e71db){return _0x252061(getChanSpyApplications(_0x3791c5,_0x1e71db));}return _0x252061([]);})['catch'](function(_0x1ddf02){_0xb7347d(_0x1ddf02);});});};module[_0xf594('0x19')]=function(_0x487249,_0x410776){var _0x3fafa2=_0x487249['models'];return _0x487249['define'](_0xf594('0x1a'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1ed67c,_0x34eeed,_0x2a9a5a){return getChanSpyPromise(_0x3fafa2,_0x1ed67c)[_0xf594('0x18')](function(_0x37b7a5){if(_0x37b7a5&&_0x37b7a5[_0xf594('0x15')]){return _0x3fafa2['VoiceExtension'][_0xf594('0x1b')](_0x37b7a5);}})[_0xf594('0x18')](function(){_0x2a9a5a();})[_0xf594('0x1c')](function(_0xa46357){_0x2a9a5a(_0xa46357);});},'afterUpdate':function(_0x43018d,_0x17bd1d,_0x3b38f4){return _0x3fafa2[_0xf594('0x1d')]['destroy']({'where':{'ChanSpyId':_0x43018d['id']}})[_0xf594('0x18')](function(){return getChanSpyPromise(_0x3fafa2,_0x43018d);})[_0xf594('0x18')](function(_0x4543b2){if(_0x4543b2&&_0x4543b2[_0xf594('0x15')]){return _0x3fafa2[_0xf594('0x1d')][_0xf594('0x1b')](_0x4543b2);}})[_0xf594('0x18')](function(){_0x3b38f4();})['catch'](function(_0x2da45e){_0x3b38f4(_0x2da45e);});},'afterDestroy':function(_0x1ac74d,_0x531f34,_0xf0b833){return _0x3fafa2['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x1ac74d['id']}})[_0xf594('0x18')](function(){_0xf0b833();})[_0xf594('0x1c')](function(_0x28d2c1){_0xf0b833(_0x28d2c1);});}}});}; \ No newline at end of file +var _0x2fbc=['util','./voiceChanSpy.attributes','format','%s%s','system','push','merge','Set','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,ab','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','concat','User','findAll','exports','models','define','VoiceChanSpy','then','VoiceExtension','bulkCreate','catch','lodash'];(function(_0x218972,_0x1f9794){var _0x1bb1a8=function(_0x3fb962){while(--_0x3fb962){_0x218972['push'](_0x218972['shift']());}};_0x1bb1a8(++_0x1f9794);}(_0x2fbc,0x15d));var _0xc2fb=function(_0x5f0f7d,_0x3eb1c8){_0x5f0f7d=_0x5f0f7d-0x0;var _0x16ef23=_0x2fbc[_0x5f0f7d];return _0x16ef23;};'use strict';var _=require(_0xc2fb('0x0'));var util=require(_0xc2fb('0x1'));var BPromise=require('bluebird');var attributes=require(_0xc2fb('0x2'));var getUserApplications=function(_0x2fa1da,_0x12e3f2,_0x27bb95){var _0x30d5ae=0x1;var _0x208d99=[];var _0x5c727c={'context':_0x12e3f2['context']||'from-sip','exten':util[_0xc2fb('0x3')](_0xc2fb('0x4'),_0x2fa1da['prefix'],_0x27bb95),'type':_0xc2fb('0x5'),'isApp':![],'ChanSpyId':_0x2fa1da['id'],'UserId':_0x12e3f2['id']};_0x208d99[_0xc2fb('0x6')](_[_0xc2fb('0x7')]({'app':_0xc2fb('0x8'),'appdata':util[_0xc2fb('0x3')](_0xc2fb('0x9'),_0xc2fb('0xa')),'priority':_0x30d5ae++},_0x5c727c));if(_0x2fa1da[_0xc2fb('0xb')]){_0x208d99['push'](_[_0xc2fb('0x7')]({'app':'MixMonitor','appdata':util['format'](_0xc2fb('0xc'),_0x2fa1da[_0xc2fb('0xd')]),'priority':_0x30d5ae++},_0x5c727c));}if(_0x2fa1da[_0xc2fb('0xe')]){_0x208d99[_0xc2fb('0x6')](_[_0xc2fb('0x7')]({'app':_0xc2fb('0xf'),'appdata':_0x2fa1da['password'],'priority':_0x30d5ae++},_0x5c727c));}_0x208d99[_0xc2fb('0x6')](_[_0xc2fb('0x7')]({'app':_0xc2fb('0x10'),'appdata':util[_0xc2fb('0x3')](_0xc2fb('0x11'),_0x12e3f2[_0xc2fb('0x12')],_0x2fa1da[_0xc2fb('0x13')]?_0x2fa1da[_0xc2fb('0x13')][_0xc2fb('0x14')](''):''),'priority':_0x30d5ae++},_0x5c727c));if(_0x2fa1da[_0xc2fb('0xb')]){_0x208d99[_0xc2fb('0x6')](_[_0xc2fb('0x7')]({'app':_0xc2fb('0x15'),'priority':_0x30d5ae++},_0x5c727c));}return _0x208d99;};var getChanSpyApplications=function(_0x28470a,_0x43ffdc){var _0x150cb3=[];for(var _0x2e4cf9=0x0,_0x4cc3e1=0x1;_0x2e4cf9<_0x43ffdc[_0xc2fb('0x16')];_0x2e4cf9++,_0x4cc3e1=0x1){_0x150cb3=_0x150cb3['concat'](getUserApplications(_0x28470a,_0x43ffdc[_0x2e4cf9],_0x43ffdc[_0x2e4cf9][_0xc2fb('0x17')]));if(_0x43ffdc[_0x2e4cf9]['internal']!=_0x43ffdc[_0x2e4cf9][_0xc2fb('0x12')]){_0x150cb3=_0x150cb3[_0xc2fb('0x18')](getUserApplications(_0x28470a,_0x43ffdc[_0x2e4cf9],_0x43ffdc[_0x2e4cf9]['name']));}}return _0x150cb3;};var getChanSpyPromise=function(_0x1db943,_0x263b4c){return new BPromise(function(_0x27bac6,_0x202a19){return _0x1db943[_0xc2fb('0x19')][_0xc2fb('0x1a')]({'attributes':['id','name',_0xc2fb('0x17')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x1cf413){if(_0x1cf413){return _0x27bac6(getChanSpyApplications(_0x263b4c,_0x1cf413));}return _0x27bac6([]);})['catch'](function(_0x20e778){_0x202a19(_0x20e778);});});};module[_0xc2fb('0x1b')]=function(_0x1434dc,_0x1fa2f2){var _0x324cdc=_0x1434dc[_0xc2fb('0x1c')];return _0x1434dc[_0xc2fb('0x1d')](_0xc2fb('0x1e'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x768674,_0x1ef605,_0x53ccfb){return getChanSpyPromise(_0x324cdc,_0x768674)[_0xc2fb('0x1f')](function(_0x1d87e3){if(_0x1d87e3&&_0x1d87e3[_0xc2fb('0x16')]){return _0x324cdc[_0xc2fb('0x20')][_0xc2fb('0x21')](_0x1d87e3);}})['then'](function(){_0x53ccfb();})[_0xc2fb('0x22')](function(_0x1e6751){_0x53ccfb(_0x1e6751);});},'afterUpdate':function(_0x59da78,_0x5017c3,_0x41c234){return _0x324cdc[_0xc2fb('0x20')]['destroy']({'where':{'ChanSpyId':_0x59da78['id']}})['then'](function(){return getChanSpyPromise(_0x324cdc,_0x59da78);})[_0xc2fb('0x1f')](function(_0xb26b2c){if(_0xb26b2c&&_0xb26b2c[_0xc2fb('0x16')]){return _0x324cdc['VoiceExtension'][_0xc2fb('0x21')](_0xb26b2c);}})['then'](function(){_0x41c234();})['catch'](function(_0xb4ad9d){_0x41c234(_0xb4ad9d);});},'afterDestroy':function(_0x25e124,_0x25b924,_0x13af53){return _0x324cdc[_0xc2fb('0x20')]['destroy']({'where':{'ChanSpyId':_0x25e124['id']}})['then'](function(){_0x13af53();})[_0xc2fb('0x22')](function(_0x46c6eb){_0x13af53(_0x46c6eb);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 1ecb0aa..bb334d1 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 _0x0e04=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result'];(function(_0x13d153,_0x3edda1){var _0x508a08=function(_0x465db7){while(--_0x465db7){_0x13d153['push'](_0x13d153['shift']());}};_0x508a08(++_0x3edda1);}(_0x0e04,0x118));var _0x40e0=function(_0x299543,_0x3e96ef){_0x299543=_0x299543-0x0;var _0x50f4be=_0x0e04[_0x299543];return _0x50f4be;};'use strict';var _=require(_0x40e0('0x0'));var util=require(_0x40e0('0x1'));var moment=require('moment');var BPromise=require(_0x40e0('0x2'));var rs=require(_0x40e0('0x3'));var fs=require('fs');var Redis=require(_0x40e0('0x4'));var db=require(_0x40e0('0x5'))['db'];var utils=require(_0x40e0('0x6'));var logger=require(_0x40e0('0x7'))(_0x40e0('0x8'));var config=require(_0x40e0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x40e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bea0b,_0xb3372c,_0x764985){return new BPromise(function(_0x1ea0d9,_0x4cbca3){return client[_0x40e0('0xb')](_0x5bea0b,_0x764985)[_0x40e0('0xc')](function(_0x20155a){logger[_0x40e0('0xd')](_0x40e0('0xe'),_0xb3372c,'request\x20sent');logger['debug'](_0x40e0('0xf'),_0xb3372c,_0x40e0('0x10'),JSON['stringify'](_0x20155a));if(_0x20155a['error']){if(_0x20155a['error']['code']===0x1f4){logger[_0x40e0('0x11')](_0x40e0('0xe'),_0xb3372c,_0x20155a[_0x40e0('0x11')][_0x40e0('0x12')]);return _0x4cbca3(_0x20155a['error'][_0x40e0('0x12')]);}logger[_0x40e0('0x11')](_0x40e0('0xe'),_0xb3372c,_0x20155a[_0x40e0('0x11')][_0x40e0('0x12')]);return _0x1ea0d9(_0x20155a['error'][_0x40e0('0x12')]);}else{logger[_0x40e0('0xd')](_0x40e0('0xe'),_0xb3372c,_0x40e0('0x10'));_0x1ea0d9(_0x20155a[_0x40e0('0x13')][_0x40e0('0x12')]);}})['catch'](function(_0x3bc249){logger[_0x40e0('0x11')](_0x40e0('0xe'),_0xb3372c,_0x3bc249);_0x4cbca3(_0x3bc249);});});} \ No newline at end of file +var _0xe222=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xbb67d1,_0x1e3081){var _0x1627c5=function(_0xc15e8f){while(--_0xc15e8f){_0xbb67d1['push'](_0xbb67d1['shift']());}};_0x1627c5(++_0x1e3081);}(_0xe222,0xdb));var _0x2e22=function(_0x1c7f48,_0x255687){_0x1c7f48=_0x1c7f48-0x0;var _0x274c31=_0xe222[_0x1c7f48];return _0x274c31;};'use strict';var _=require(_0x2e22('0x0'));var util=require(_0x2e22('0x1'));var moment=require(_0x2e22('0x2'));var BPromise=require(_0x2e22('0x3'));var rs=require(_0x2e22('0x4'));var fs=require('fs');var Redis=require(_0x2e22('0x5'));var db=require(_0x2e22('0x6'))['db'];var utils=require(_0x2e22('0x7'));var logger=require(_0x2e22('0x8'))(_0x2e22('0x9'));var config=require(_0x2e22('0xa'));var jayson=require(_0x2e22('0xb'));var client=jayson[_0x2e22('0xc')][_0x2e22('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1f5af3,_0x3c7676,_0x223d85){return new BPromise(function(_0x4b125f,_0x533741){return client[_0x2e22('0xe')](_0x1f5af3,_0x223d85)['then'](function(_0x5503be){logger['info'](_0x2e22('0xf'),_0x3c7676,_0x2e22('0x10'));logger[_0x2e22('0x11')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x3c7676,_0x2e22('0x10'),JSON[_0x2e22('0x12')](_0x5503be));if(_0x5503be[_0x2e22('0x13')]){if(_0x5503be['error'][_0x2e22('0x14')]===0x1f4){logger[_0x2e22('0x13')](_0x2e22('0xf'),_0x3c7676,_0x5503be[_0x2e22('0x13')][_0x2e22('0x15')]);return _0x533741(_0x5503be[_0x2e22('0x13')][_0x2e22('0x15')]);}logger[_0x2e22('0x13')](_0x2e22('0xf'),_0x3c7676,_0x5503be[_0x2e22('0x13')][_0x2e22('0x15')]);return _0x4b125f(_0x5503be[_0x2e22('0x13')]['message']);}else{logger[_0x2e22('0x16')](_0x2e22('0xf'),_0x3c7676,_0x2e22('0x10'));_0x4b125f(_0x5503be[_0x2e22('0x17')][_0x2e22('0x15')]);}})[_0x2e22('0x18')](function(_0x236e8e){logger['error'](_0x2e22('0xf'),_0x3c7676,_0x236e8e);_0x533741(_0x236e8e);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index a0e476b..e56cf56 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 _0xa089=['path','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','/:id','update','delete','exports','multer','util'];(function(_0x460666,_0x24bfa0){var _0x555cbf=function(_0x3b4743){while(--_0x3b4743){_0x460666['push'](_0x460666['shift']());}};_0x555cbf(++_0x24bfa0);}(_0xa089,0x1ce));var _0x9a08=function(_0x342fab,_0x1f2b5f){_0x342fab=_0x342fab-0x0;var _0x5454c5=_0xa089[_0x342fab];return _0x5454c5;};'use strict';var multer=require(_0x9a08('0x0'));var util=require(_0x9a08('0x1'));var path=require(_0x9a08('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x9a08('0x3'));var interaction=require(_0x9a08('0x4'));var config=require(_0x9a08('0x5'));var controller=require('./voiceContext.controller');router[_0x9a08('0x6')]('/',auth[_0x9a08('0x7')](),controller[_0x9a08('0x8')]);router[_0x9a08('0x6')]('/:id',auth[_0x9a08('0x7')](),controller[_0x9a08('0x9')]);router[_0x9a08('0xa')]('/',auth[_0x9a08('0x7')](),controller[_0x9a08('0xb')]);router['put'](_0x9a08('0xc'),auth[_0x9a08('0x7')](),controller[_0x9a08('0xd')]);router[_0x9a08('0xe')](_0x9a08('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x9a08('0xf')]=router; \ No newline at end of file +var _0xa895=['exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa895,0xde));var _0x5a89=function(_0x24e6a1,_0x6fcb9a){_0x24e6a1=_0x24e6a1-0x0;var _0x1e0aef=_0xa895[_0x24e6a1];return _0x1e0aef;};'use strict';var multer=require(_0x5a89('0x0'));var util=require(_0x5a89('0x1'));var path=require('path');var timeout=require(_0x5a89('0x2'));var express=require('express');var router=express[_0x5a89('0x3')]();var auth=require(_0x5a89('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5a89('0x5'));var controller=require(_0x5a89('0x6'));router[_0x5a89('0x7')]('/',auth[_0x5a89('0x8')](),controller[_0x5a89('0x9')]);router[_0x5a89('0x7')](_0x5a89('0xa'),auth[_0x5a89('0x8')](),controller[_0x5a89('0xb')]);router[_0x5a89('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5a89('0xd')](_0x5a89('0xa'),auth[_0x5a89('0x8')](),controller[_0x5a89('0xe')]);router['delete']('/:id',auth[_0x5a89('0x8')](),controller[_0x5a89('0xf')]);module[_0x5a89('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index fc8aede..cda70d9 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(_0x1239c8,_0x4006b8){var _0x1beb64=function(_0x4ecaaa){while(--_0x4ecaaa){_0x1239c8['push'](_0x1239c8['shift']());}};_0x1beb64(++_0x4006b8);}(_0x34e8,0x12c));var _0x834e=function(_0x46e1a1,_0x177b20){_0x46e1a1=_0x46e1a1-0x0;var _0x292d51=_0x34e8[_0x46e1a1];return _0x292d51;};'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 _0x3e74=['name','sequelize','STRING'];(function(_0x23603,_0x281eee){var _0x2357a1=function(_0x265b78){while(--_0x265b78){_0x23603['push'](_0x23603['shift']());}};_0x2357a1(++_0x281eee);}(_0x3e74,0x175));var _0x43e7=function(_0x329cdc,_0x6b0bf4){_0x329cdc=_0x329cdc-0x0;var _0x2b9c09=_0x3e74[_0x329cdc];return _0x2b9c09;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 34bddba..15ffb81 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 _0x8eef=['model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','VIRTUAL','merge','VoiceContext','findAll','rows','show','params','includeAll','options','find','create','body','readFileSync','root','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','update','chan_sip.so','destroy','server/files/templates/context.ejs','utf8','writeFileSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','get','Contexts','end','stack','name','send','index','map','rawAttributes','type','key'];(function(_0x1dd516,_0xffafa0){var _0x4d0941=function(_0x1c963b){while(--_0x1c963b){_0x1dd516['push'](_0x1dd516['shift']());}};_0x4d0941(++_0xffafa0);}(_0x8eef,0x173));var _0xf8ee=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x8eef[_0x199572];return _0x13cfa3;};'use strict';var pdf=require(_0xf8ee('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf8ee('0x1'));var zipdir=require(_0xf8ee('0x2'));var jsonpatch=require(_0xf8ee('0x3'));var rp=require(_0xf8ee('0x4'));var moment=require(_0xf8ee('0x5'));var BPromise=require(_0xf8ee('0x6'));var Mustache=require(_0xf8ee('0x7'));var util=require(_0xf8ee('0x8'));var path=require(_0xf8ee('0x9'));var sox=require(_0xf8ee('0xa'));var csv=require('to-csv');var ejs=require(_0xf8ee('0xb'));var fs=require('fs');var _=require(_0xf8ee('0xc'));var squel=require(_0xf8ee('0xd'));var crypto=require(_0xf8ee('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf8ee('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf8ee('0x10'));var Papa=require(_0xf8ee('0x11'));var Redis=require(_0xf8ee('0x12'));var authService=require(_0xf8ee('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf8ee('0x14'));var hardwareService=require(_0xf8ee('0x15'));var logger=require(_0xf8ee('0x16'))(_0xf8ee('0x17'));var utils=require(_0xf8ee('0x18'));var config=require(_0xf8ee('0x19'));var db=require(_0xf8ee('0x1a'))['db'];var jayson=require(_0xf8ee('0x1b'));var client=jayson[_0xf8ee('0x1c')][_0xf8ee('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x50fa41,_0x4cb18e,_0x5a6eb8){if(_0x5a6eb8){var _0x343afe=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x343afe[_0xf8ee('0x1e')](_0x4cb18e)){return _0x50fa41;}else{throw new db[(_0xf8ee('0x1f'))][(_0xf8ee('0x20'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x50fa41;}}function respondWithRpcPromise(_0x5b3fec,_0x12bc56,_0x3c315e,_0x4b664f){return new BPromise(function(_0x4b9585,_0x139868){var _0x2cc1bd=_0x4b664f||client;return _0x2cc1bd[_0xf8ee('0x21')](_0x5b3fec,_0x3c315e)[_0xf8ee('0x22')](function(_0x4af013){logger['info'](_0xf8ee('0x23'),_0x12bc56,_0xf8ee('0x24'));logger[_0xf8ee('0x25')](_0xf8ee('0x26'),_0x12bc56,_0xf8ee('0x24'),JSON[_0xf8ee('0x27')](_0x4af013));if(_0x4af013['error']){if(_0x4af013[_0xf8ee('0x28')][_0xf8ee('0x29')]===0x1f4){logger[_0xf8ee('0x28')](_0xf8ee('0x23'),_0x12bc56,_0x4af013[_0xf8ee('0x28')][_0xf8ee('0x2a')]);return _0x139868(_0x4af013[_0xf8ee('0x28')]['message']);}logger['error'](_0xf8ee('0x23'),_0x12bc56,_0x4af013['error'][_0xf8ee('0x2a')]);return _0x4b9585(_0x4af013[_0xf8ee('0x28')][_0xf8ee('0x2a')]);}else{logger['info'](_0xf8ee('0x23'),_0x12bc56,_0xf8ee('0x24'));_0x4b9585(_0x4af013['result'][_0xf8ee('0x2a')]);}})[_0xf8ee('0x2b')](function(_0x158387){logger[_0xf8ee('0x28')](_0xf8ee('0x23'),_0x12bc56,_0x158387);_0x139868(_0x158387);});});}function respondWithStatusCode(_0x17b459,_0x30f09e){_0x30f09e=_0x30f09e||0xcc;return function(_0x4fbe4d){if(_0x4fbe4d){return _0x17b459[_0xf8ee('0x2c')](_0x30f09e);}return _0x17b459[_0xf8ee('0x2d')](_0x30f09e)['end']();};}function respondWithResult(_0x47d901,_0x17ab17){_0x17ab17=_0x17ab17||0xc8;return function(_0x334762){if(_0x334762){return _0x47d901[_0xf8ee('0x2d')](_0x17ab17)[_0xf8ee('0x2e')](_0x334762);}};}function respondWithFilteredResult(_0x27dcec,_0x23e7e1){return function(_0x5753e7){if(_0x5753e7){var _0x52d5a0=_0x5753e7[_0xf8ee('0x2f')],_0x4e4840=_0x23e7e1[_0xf8ee('0x30')],_0x13741a=_0x23e7e1[_0xf8ee('0x30')]+_0x23e7e1[_0xf8ee('0x31')],_0x295f27;if(_0x13741a>=_0x52d5a0){_0x13741a=_0x52d5a0;_0x295f27=0xc8;}else{_0x295f27=0xce;}_0x27dcec[_0xf8ee('0x2d')](_0x295f27);return _0x27dcec['set'](_0xf8ee('0x32'),_0x4e4840+'-'+_0x13741a+'/'+_0x52d5a0)['json'](_0x5753e7);}return null;};}function patchUpdates(_0x5dbf3b){return function(_0x3583d9){try{jsonpatch[_0xf8ee('0x33')](_0x3583d9,_0x5dbf3b,!![]);}catch(_0x2ab620){return BPromise[_0xf8ee('0x34')](_0x2ab620);}return _0x3583d9[_0xf8ee('0x35')]();};}function saveUpdates(_0x6f93b7,_0x3e11d0){return function(_0xb4ac5){if(_0xb4ac5){return _0xb4ac5['update'](_0x6f93b7)[_0xf8ee('0x22')](function(_0x171599){return _0x171599;});}return null;};}function removeEntity(_0x3eb2bf,_0x34f0d2){return function(_0x3888b5){if(_0x3888b5){return _0x3888b5['destroy']()[_0xf8ee('0x22')](function(){var _0x68909e=_0x3888b5[_0xf8ee('0x36')]({'plain':!![]});var _0x1aeecc=_0xf8ee('0x37');return db['UserProfileResource']['destroy']({'where':{'type':_0x1aeecc,'resourceId':_0x68909e['id']}})['then'](function(){return _0x3888b5;});})[_0xf8ee('0x22')](function(){_0x3eb2bf[_0xf8ee('0x2d')](0xcc)[_0xf8ee('0x38')]();});}};}function handleEntityNotFound(_0x4f3c0e,_0x3456b0){return function(_0x4d21db){if(!_0x4d21db){_0x4f3c0e[_0xf8ee('0x2c')](0x194);}return _0x4d21db;};}function handleError(_0x3ba82d,_0x26a11f){_0x26a11f=_0x26a11f||0x1f4;return function(_0x1aa1e2){logger['error'](_0x1aa1e2[_0xf8ee('0x39')]);if(_0x1aa1e2[_0xf8ee('0x3a')]){delete _0x1aa1e2[_0xf8ee('0x3a')];}_0x3ba82d[_0xf8ee('0x2d')](_0x26a11f)[_0xf8ee('0x3b')](_0x1aa1e2);};}exports[_0xf8ee('0x3c')]=function(_0x395a01,_0xda92e3){var _0x41f0f8={},_0x5ee296={},_0x1be75b={'count':0x0,'rows':[]};var _0x116109=_[_0xf8ee('0x3d')](db['VoiceContext'][_0xf8ee('0x3e')],function(_0x1029cd){return{'name':_0x1029cd['fieldName'],'type':_0x1029cd[_0xf8ee('0x3f')][_0xf8ee('0x40')]};});_0x5ee296[_0xf8ee('0x41')]=_[_0xf8ee('0x3d')](_0x116109,_0xf8ee('0x3a'));_0x5ee296[_0xf8ee('0x42')]=_[_0xf8ee('0x43')](_0x395a01['query']);_0x5ee296[_0xf8ee('0x44')]=_[_0xf8ee('0x45')](_0x5ee296[_0xf8ee('0x41')],_0x5ee296[_0xf8ee('0x42')]);_0x41f0f8[_0xf8ee('0x46')]=_[_0xf8ee('0x45')](_0x5ee296['model'],qs[_0xf8ee('0x47')](_0x395a01[_0xf8ee('0x42')][_0xf8ee('0x47')]));_0x41f0f8[_0xf8ee('0x46')]=_0x41f0f8[_0xf8ee('0x46')][_0xf8ee('0x48')]?_0x41f0f8[_0xf8ee('0x46')]:_0x5ee296[_0xf8ee('0x41')];if(!_0x395a01['query']['hasOwnProperty'](_0xf8ee('0x49'))){_0x41f0f8['limit']=qs[_0xf8ee('0x31')](_0x395a01[_0xf8ee('0x42')][_0xf8ee('0x31')]);_0x41f0f8[_0xf8ee('0x30')]=qs[_0xf8ee('0x30')](_0x395a01[_0xf8ee('0x42')][_0xf8ee('0x30')]);}_0x41f0f8[_0xf8ee('0x4a')]=qs['sort'](_0x395a01['query']['sort']);_0x41f0f8[_0xf8ee('0x4b')]=qs[_0xf8ee('0x44')](_[_0xf8ee('0x4c')](_0x395a01[_0xf8ee('0x42')],_0x5ee296[_0xf8ee('0x44')]));if(_0x395a01['query'][_0xf8ee('0x4d')]){_0x41f0f8[_0xf8ee('0x4b')]=_['merge'](_0x41f0f8[_0xf8ee('0x4b')],{'$or':_[_0xf8ee('0x3d')](_0x116109,function(_0x44ac37){if(_0x44ac37['type']!==_0xf8ee('0x4e')){var _0x1b9907={};_0x1b9907[_0x44ac37[_0xf8ee('0x3a')]]={'$like':'%'+_0x395a01[_0xf8ee('0x42')][_0xf8ee('0x4d')]+'%'};return _0x1b9907;}})});}_0x41f0f8=_[_0xf8ee('0x4f')]({},_0x41f0f8,_0x395a01['options']);var _0x50ecde={'where':_0x41f0f8[_0xf8ee('0x4b')]};return db[_0xf8ee('0x50')][_0xf8ee('0x2f')](_0x50ecde)[_0xf8ee('0x22')](function(_0x40790f){_0x1be75b[_0xf8ee('0x2f')]=_0x40790f;if(_0x395a01[_0xf8ee('0x42')]['includeAll']){_0x41f0f8['include']=[{'all':!![]}];}return db['VoiceContext'][_0xf8ee('0x51')](_0x41f0f8);})[_0xf8ee('0x22')](function(_0x36ffde){_0x1be75b[_0xf8ee('0x52')]=_0x36ffde;return _0x1be75b;})['then'](respondWithFilteredResult(_0xda92e3,_0x41f0f8))['catch'](handleError(_0xda92e3,null));};exports[_0xf8ee('0x53')]=function(_0x49e72a,_0x1a7817){var _0xd387ff={'raw':![],'where':{'id':_0x49e72a[_0xf8ee('0x54')]['id']}},_0x4b61de={};_0x4b61de[_0xf8ee('0x41')]=_[_0xf8ee('0x43')](db['VoiceContext']['rawAttributes']);_0x4b61de[_0xf8ee('0x42')]=_['keys'](_0x49e72a[_0xf8ee('0x42')]);_0x4b61de[_0xf8ee('0x44')]=_[_0xf8ee('0x45')](_0x4b61de[_0xf8ee('0x41')],_0x4b61de[_0xf8ee('0x42')]);_0xd387ff[_0xf8ee('0x46')]=_[_0xf8ee('0x45')](_0x4b61de[_0xf8ee('0x41')],qs[_0xf8ee('0x47')](_0x49e72a['query'][_0xf8ee('0x47')]));_0xd387ff[_0xf8ee('0x46')]=_0xd387ff[_0xf8ee('0x46')][_0xf8ee('0x48')]?_0xd387ff['attributes']:_0x4b61de[_0xf8ee('0x41')];if(_0x49e72a[_0xf8ee('0x42')][_0xf8ee('0x55')]){_0xd387ff['include']=[{'all':!![]}];}_0xd387ff=_[_0xf8ee('0x4f')]({},_0xd387ff,_0x49e72a[_0xf8ee('0x56')]);return db[_0xf8ee('0x50')][_0xf8ee('0x57')](_0xd387ff)[_0xf8ee('0x22')](handleEntityNotFound(_0x1a7817,null))[_0xf8ee('0x22')](respondWithResult(_0x1a7817,null))[_0xf8ee('0x2b')](handleError(_0x1a7817,null));};exports[_0xf8ee('0x58')]=function(_0xa8d055,_0x4e6c3c,_0x134c95){var _0x8455bb;return db[_0xf8ee('0x50')][_0xf8ee('0x58')](_0xa8d055[_0xf8ee('0x59')],{'raw':!![]})['then'](function(_0x485399){_0x8455bb=_0x485399;return db[_0xf8ee('0x50')][_0xf8ee('0x51')]({'raw':!![]});})[_0xf8ee('0x22')](function(_0x653dd7){var _0x569310=fs[_0xf8ee('0x5a')](path['join'](config[_0xf8ee('0x5b')],'server/files/templates/context.ejs'),'utf8');var _0x85eb5c=ejs[_0xf8ee('0x5c')](_0x569310,{'contexts':_0x653dd7||[]});fs['writeFileSync'](_0xf8ee('0x5d'),_0x85eb5c);})[_0xf8ee('0x22')](function(){return respondWithRpcPromise(_0xf8ee('0x5e'),_0xf8ee('0x58'),{'module':'chan_sip.so'});})['then'](function(){var _0x3c61da=_0xa8d055[_0xf8ee('0x5f')][_0xf8ee('0x36')]({'plain':!![]});if(!_0x3c61da)throw new Error(_0xf8ee('0x60'));if(_0x3c61da[_0xf8ee('0x61')]===_0xf8ee('0x5f')){var _0x51d60c=_0x8455bb['get']({'plain':!![]});return db['UserProfileSection'][_0xf8ee('0x57')]({'where':{'name':_0xf8ee('0x37'),'userProfileId':_0x3c61da[_0xf8ee('0x62')]},'raw':!![]})['then'](function(_0x358326){if(_0x358326&&_0x358326[_0xf8ee('0x63')]===0x0){return db[_0xf8ee('0x64')]['create']({'name':_0x51d60c['name'],'resourceId':_0x51d60c['id'],'type':_0x358326['name'],'sectionId':_0x358326['id']},{})[_0xf8ee('0x22')](function(){return _0x8455bb;});}else{return _0x8455bb;}})[_0xf8ee('0x2b')](function(_0x55ae5c){logger['error'](_0xf8ee('0x65'),_0x55ae5c);throw _0x55ae5c;});}return _0x8455bb;})[_0xf8ee('0x22')](respondWithResult(_0x4e6c3c,0xc9))[_0xf8ee('0x2b')](handleError(_0x4e6c3c,null));};exports['update']=function(_0x18983f,_0x520deb,_0x724739){var _0x5aebb3;return db[_0xf8ee('0x50')][_0xf8ee('0x57')]({'where':{'id':_0x18983f[_0xf8ee('0x54')]['id']}})[_0xf8ee('0x22')](handleEntityNotFound(_0x520deb,null))[_0xf8ee('0x22')](saveUpdates(_0x18983f[_0xf8ee('0x59')],null))[_0xf8ee('0x22')](function(_0xd0f26b){if(_0xd0f26b){_0x5aebb3=_0xd0f26b;return db[_0xf8ee('0x50')]['findAll']({'raw':!![]});}})['then'](function(_0x29063f){var _0x50ff51=fs[_0xf8ee('0x5a')](path[_0xf8ee('0x66')](config[_0xf8ee('0x5b')],'server/files/templates/context.ejs'),'utf8');var _0x9e6589=ejs[_0xf8ee('0x5c')](_0x50ff51,{'contexts':_0x29063f||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x9e6589);})[_0xf8ee('0x22')](function(){return respondWithRpcPromise(_0xf8ee('0x5e'),_0xf8ee('0x67'),{'module':_0xf8ee('0x68')});})[_0xf8ee('0x22')](function(){return _0x5aebb3;})['then'](respondWithResult(_0x520deb,null))[_0xf8ee('0x2b')](handleError(_0x520deb,null));};exports[_0xf8ee('0x69')]=function(_0x1f24ed,_0x292105,_0x52fe7f){var _0x57cbbc;return db[_0xf8ee('0x50')][_0xf8ee('0x57')]({'where':{'id':_0x1f24ed[_0xf8ee('0x54')]['id']}})[_0xf8ee('0x22')](handleEntityNotFound(_0x292105,null))['then'](removeEntity(_0x292105,null))[_0xf8ee('0x22')](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0xf8ee('0x22')](function(_0x2b8f1d){var _0x461cf3=fs['readFileSync'](path[_0xf8ee('0x66')](config[_0xf8ee('0x5b')],_0xf8ee('0x6a')),_0xf8ee('0x6b'));var _0x183f9e=ejs[_0xf8ee('0x5c')](_0x461cf3,{'contexts':_0x2b8f1d});fs[_0xf8ee('0x6c')](_0xf8ee('0x5d'),_0x183f9e);return respondWithRpcPromise(_0xf8ee('0x5e'),'destroy',{'module':_0xf8ee('0x68')});})[_0xf8ee('0x2b')](handleError(_0x292105,null));}; \ No newline at end of file +var _0x40df=['keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceContext','includeAll','findAll','rows','show','params','rawAttributes','length','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','writeFileSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','send','index','fieldName','type','key','query'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x40df,0x16c));var _0xf40d=function(_0x20185f,_0x21a8b1){_0x20185f=_0x20185f-0x0;var _0x4827a6=_0x40df[_0x20185f];return _0x4827a6;};'use strict';var pdf=require(_0xf40d('0x0'));var emlformat=require(_0xf40d('0x1'));var rimraf=require(_0xf40d('0x2'));var zipdir=require(_0xf40d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf40d('0x4'));var moment=require(_0xf40d('0x5'));var BPromise=require(_0xf40d('0x6'));var Mustache=require('mustache');var util=require(_0xf40d('0x7'));var path=require(_0xf40d('0x8'));var sox=require(_0xf40d('0x9'));var csv=require(_0xf40d('0xa'));var ejs=require(_0xf40d('0xb'));var fs=require('fs');var _=require(_0xf40d('0xc'));var squel=require(_0xf40d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf40d('0xa'));var querystring=require('querystring');var Papa=require(_0xf40d('0xe'));var Redis=require('ioredis');var authService=require(_0xf40d('0xf'));var qs=require(_0xf40d('0x10'));var as=require(_0xf40d('0x11'));var hardwareService=require(_0xf40d('0x12'));var logger=require(_0xf40d('0x13'))(_0xf40d('0x14'));var utils=require(_0xf40d('0x15'));var config=require(_0xf40d('0x16'));var db=require(_0xf40d('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xf40d('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x4f400e,_0x329b28,_0x524553){if(_0x524553){var _0x3d77ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3d77ce[_0xf40d('0x19')](_0x329b28)){return _0x4f400e;}else{throw new db[(_0xf40d('0x1a'))][(_0xf40d('0x1b'))](_0xf40d('0x1c'));}}else{return _0x4f400e;}}function respondWithRpcPromise(_0x473bee,_0x369e67,_0x3aa1bb,_0x42a60b){return new BPromise(function(_0x13c587,_0x576c10){var _0x4be1e1=_0x42a60b||client;return _0x4be1e1[_0xf40d('0x1d')](_0x473bee,_0x3aa1bb)[_0xf40d('0x1e')](function(_0xae8aee){logger['info'](_0xf40d('0x1f'),_0x369e67,'request\x20sent');logger[_0xf40d('0x20')](_0xf40d('0x21'),_0x369e67,_0xf40d('0x22'),JSON['stringify'](_0xae8aee));if(_0xae8aee[_0xf40d('0x23')]){if(_0xae8aee[_0xf40d('0x23')]['code']===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x369e67,_0xae8aee['error'][_0xf40d('0x24')]);return _0x576c10(_0xae8aee[_0xf40d('0x23')]['message']);}logger['error'](_0xf40d('0x1f'),_0x369e67,_0xae8aee[_0xf40d('0x23')][_0xf40d('0x24')]);return _0x13c587(_0xae8aee[_0xf40d('0x23')]['message']);}else{logger[_0xf40d('0x25')]('VoiceContext,\x20%s,\x20%s',_0x369e67,_0xf40d('0x22'));_0x13c587(_0xae8aee[_0xf40d('0x26')][_0xf40d('0x24')]);}})[_0xf40d('0x27')](function(_0x16ef4f){logger[_0xf40d('0x23')](_0xf40d('0x1f'),_0x369e67,_0x16ef4f);_0x576c10(_0x16ef4f);});});}function respondWithStatusCode(_0x3d7612,_0x201eac){_0x201eac=_0x201eac||0xcc;return function(_0x1147fc){if(_0x1147fc){return _0x3d7612[_0xf40d('0x28')](_0x201eac);}return _0x3d7612['status'](_0x201eac)[_0xf40d('0x29')]();};}function respondWithResult(_0x1e0894,_0x5662b1){_0x5662b1=_0x5662b1||0xc8;return function(_0x2b3c5e){if(_0x2b3c5e){return _0x1e0894[_0xf40d('0x2a')](_0x5662b1)[_0xf40d('0x2b')](_0x2b3c5e);}};}function respondWithFilteredResult(_0x4f2806,_0x9aa6a){return function(_0x5682dc){if(_0x5682dc){var _0x37d128=_0x5682dc[_0xf40d('0x2c')],_0x7ae804=_0x9aa6a[_0xf40d('0x2d')],_0x544c8f=_0x9aa6a[_0xf40d('0x2d')]+_0x9aa6a[_0xf40d('0x2e')],_0x17c640;if(_0x544c8f>=_0x37d128){_0x544c8f=_0x37d128;_0x17c640=0xc8;}else{_0x17c640=0xce;}_0x4f2806[_0xf40d('0x2a')](_0x17c640);return _0x4f2806['set'](_0xf40d('0x2f'),_0x7ae804+'-'+_0x544c8f+'/'+_0x37d128)['json'](_0x5682dc);}return null;};}function patchUpdates(_0x804d61){return function(_0x462509){try{jsonpatch[_0xf40d('0x30')](_0x462509,_0x804d61,!![]);}catch(_0x9a20c6){return BPromise[_0xf40d('0x31')](_0x9a20c6);}return _0x462509[_0xf40d('0x32')]();};}function saveUpdates(_0x1053b4,_0x3da773){return function(_0x499b9c){if(_0x499b9c){return _0x499b9c[_0xf40d('0x33')](_0x1053b4)[_0xf40d('0x1e')](function(_0x46d1bc){return _0x46d1bc;});}return null;};}function removeEntity(_0x428498,_0x4244d0){return function(_0x2fabe1){if(_0x2fabe1){return _0x2fabe1[_0xf40d('0x34')]()[_0xf40d('0x1e')](function(){var _0x19bac6=_0x2fabe1[_0xf40d('0x35')]({'plain':!![]});var _0x535a1d=_0xf40d('0x36');return db[_0xf40d('0x37')][_0xf40d('0x34')]({'where':{'type':_0x535a1d,'resourceId':_0x19bac6['id']}})[_0xf40d('0x1e')](function(){return _0x2fabe1;});})['then'](function(){_0x428498[_0xf40d('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b8fc8,_0x1ca6b9){return function(_0x5e0be2){if(!_0x5e0be2){_0x1b8fc8['sendStatus'](0x194);}return _0x5e0be2;};}function handleError(_0x5794df,_0x173c85){_0x173c85=_0x173c85||0x1f4;return function(_0x48ca3a){logger['error'](_0x48ca3a[_0xf40d('0x38')]);if(_0x48ca3a[_0xf40d('0x39')]){delete _0x48ca3a[_0xf40d('0x39')];}_0x5794df[_0xf40d('0x2a')](_0x173c85)[_0xf40d('0x3a')](_0x48ca3a);};}exports[_0xf40d('0x3b')]=function(_0xe1613f,_0x3c9dcd){var _0xe0789d={},_0x4120e9={},_0x335dd7={'count':0x0,'rows':[]};var _0x402073=_['map'](db['VoiceContext']['rawAttributes'],function(_0x3326dd){return{'name':_0x3326dd[_0xf40d('0x3c')],'type':_0x3326dd[_0xf40d('0x3d')][_0xf40d('0x3e')]};});_0x4120e9['model']=_['map'](_0x402073,_0xf40d('0x39'));_0x4120e9[_0xf40d('0x3f')]=_[_0xf40d('0x40')](_0xe1613f[_0xf40d('0x3f')]);_0x4120e9[_0xf40d('0x41')]=_[_0xf40d('0x42')](_0x4120e9[_0xf40d('0x43')],_0x4120e9[_0xf40d('0x3f')]);_0xe0789d[_0xf40d('0x44')]=_['intersection'](_0x4120e9[_0xf40d('0x43')],qs[_0xf40d('0x45')](_0xe1613f[_0xf40d('0x3f')][_0xf40d('0x45')]));_0xe0789d[_0xf40d('0x44')]=_0xe0789d['attributes']['length']?_0xe0789d[_0xf40d('0x44')]:_0x4120e9[_0xf40d('0x43')];if(!_0xe1613f[_0xf40d('0x3f')][_0xf40d('0x46')](_0xf40d('0x47'))){_0xe0789d[_0xf40d('0x2e')]=qs['limit'](_0xe1613f['query'][_0xf40d('0x2e')]);_0xe0789d[_0xf40d('0x2d')]=qs[_0xf40d('0x2d')](_0xe1613f['query'][_0xf40d('0x2d')]);}_0xe0789d[_0xf40d('0x48')]=qs['sort'](_0xe1613f['query'][_0xf40d('0x49')]);_0xe0789d[_0xf40d('0x4a')]=qs[_0xf40d('0x41')](_[_0xf40d('0x4b')](_0xe1613f[_0xf40d('0x3f')],_0x4120e9['filters']));if(_0xe1613f['query'][_0xf40d('0x4c')]){_0xe0789d[_0xf40d('0x4a')]=_[_0xf40d('0x4d')](_0xe0789d['where'],{'$or':_['map'](_0x402073,function(_0x4b2f18){if(_0x4b2f18[_0xf40d('0x3d')]!==_0xf40d('0x4e')){var _0x29fda6={};_0x29fda6[_0x4b2f18[_0xf40d('0x39')]]={'$like':'%'+_0xe1613f[_0xf40d('0x3f')][_0xf40d('0x4c')]+'%'};return _0x29fda6;}})});}_0xe0789d=_[_0xf40d('0x4d')]({},_0xe0789d,_0xe1613f[_0xf40d('0x4f')]);var _0x5e6a48={'where':_0xe0789d[_0xf40d('0x4a')]};return db[_0xf40d('0x50')][_0xf40d('0x2c')](_0x5e6a48)[_0xf40d('0x1e')](function(_0x5b75c5){_0x335dd7[_0xf40d('0x2c')]=_0x5b75c5;if(_0xe1613f[_0xf40d('0x3f')][_0xf40d('0x51')]){_0xe0789d['include']=[{'all':!![]}];}return db['VoiceContext'][_0xf40d('0x52')](_0xe0789d);})[_0xf40d('0x1e')](function(_0xbd8508){_0x335dd7[_0xf40d('0x53')]=_0xbd8508;return _0x335dd7;})[_0xf40d('0x1e')](respondWithFilteredResult(_0x3c9dcd,_0xe0789d))[_0xf40d('0x27')](handleError(_0x3c9dcd,null));};exports[_0xf40d('0x54')]=function(_0x14f083,_0x31f4d5){var _0x5f4edf={'raw':![],'where':{'id':_0x14f083[_0xf40d('0x55')]['id']}},_0x174188={};_0x174188[_0xf40d('0x43')]=_[_0xf40d('0x40')](db['VoiceContext'][_0xf40d('0x56')]);_0x174188[_0xf40d('0x3f')]=_[_0xf40d('0x40')](_0x14f083[_0xf40d('0x3f')]);_0x174188[_0xf40d('0x41')]=_[_0xf40d('0x42')](_0x174188['model'],_0x174188['query']);_0x5f4edf[_0xf40d('0x44')]=_[_0xf40d('0x42')](_0x174188[_0xf40d('0x43')],qs[_0xf40d('0x45')](_0x14f083[_0xf40d('0x3f')][_0xf40d('0x45')]));_0x5f4edf[_0xf40d('0x44')]=_0x5f4edf[_0xf40d('0x44')][_0xf40d('0x57')]?_0x5f4edf[_0xf40d('0x44')]:_0x174188[_0xf40d('0x43')];if(_0x14f083[_0xf40d('0x3f')]['includeAll']){_0x5f4edf['include']=[{'all':!![]}];}_0x5f4edf=_['merge']({},_0x5f4edf,_0x14f083[_0xf40d('0x4f')]);return db[_0xf40d('0x50')][_0xf40d('0x58')](_0x5f4edf)[_0xf40d('0x1e')](handleEntityNotFound(_0x31f4d5,null))[_0xf40d('0x1e')](respondWithResult(_0x31f4d5,null))[_0xf40d('0x27')](handleError(_0x31f4d5,null));};exports[_0xf40d('0x59')]=function(_0x99002f,_0x4505f5,_0x22abef){var _0x562917;return db[_0xf40d('0x50')][_0xf40d('0x59')](_0x99002f[_0xf40d('0x5a')],{'raw':!![]})[_0xf40d('0x1e')](function(_0xa4c3de){_0x562917=_0xa4c3de;return db[_0xf40d('0x50')][_0xf40d('0x52')]({'raw':!![]});})[_0xf40d('0x1e')](function(_0x19412f){var _0xea5624=fs[_0xf40d('0x5b')](path[_0xf40d('0x5c')](config[_0xf40d('0x5d')],_0xf40d('0x5e')),_0xf40d('0x5f'));var _0x3734c4=ejs[_0xf40d('0x60')](_0xea5624,{'contexts':_0x19412f||[]});fs['writeFileSync'](_0xf40d('0x61'),_0x3734c4);})[_0xf40d('0x1e')](function(){return respondWithRpcPromise(_0xf40d('0x62'),_0xf40d('0x59'),{'module':_0xf40d('0x63')});})[_0xf40d('0x1e')](function(){var _0x43e948=_0x99002f[_0xf40d('0x64')]['get']({'plain':!![]});if(!_0x43e948)throw new Error(_0xf40d('0x65'));if(_0x43e948[_0xf40d('0x66')]==='user'){var _0x22bba1=_0x562917[_0xf40d('0x35')]({'plain':!![]});return db[_0xf40d('0x67')][_0xf40d('0x58')]({'where':{'name':_0xf40d('0x36'),'userProfileId':_0x43e948[_0xf40d('0x68')]},'raw':!![]})['then'](function(_0x146573){if(_0x146573&&_0x146573[_0xf40d('0x69')]===0x0){return db[_0xf40d('0x37')][_0xf40d('0x59')]({'name':_0x22bba1[_0xf40d('0x39')],'resourceId':_0x22bba1['id'],'type':_0x146573[_0xf40d('0x39')],'sectionId':_0x146573['id']},{})[_0xf40d('0x1e')](function(){return _0x562917;});}else{return _0x562917;}})[_0xf40d('0x27')](function(_0x56fa47){logger[_0xf40d('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56fa47);throw _0x56fa47;});}return _0x562917;})[_0xf40d('0x1e')](respondWithResult(_0x4505f5,0xc9))[_0xf40d('0x27')](handleError(_0x4505f5,null));};exports[_0xf40d('0x33')]=function(_0x2f57b7,_0x2b7f8f,_0x5930c1){var _0x842154;return db[_0xf40d('0x50')]['find']({'where':{'id':_0x2f57b7[_0xf40d('0x55')]['id']}})[_0xf40d('0x1e')](handleEntityNotFound(_0x2b7f8f,null))[_0xf40d('0x1e')](saveUpdates(_0x2f57b7[_0xf40d('0x5a')],null))[_0xf40d('0x1e')](function(_0xb9151e){if(_0xb9151e){_0x842154=_0xb9151e;return db['VoiceContext'][_0xf40d('0x52')]({'raw':!![]});}})[_0xf40d('0x1e')](function(_0x2c1872){var _0x2bf7ba=fs['readFileSync'](path[_0xf40d('0x5c')](config[_0xf40d('0x5d')],_0xf40d('0x5e')),_0xf40d('0x5f'));var _0x1ceb6d=ejs['render'](_0x2bf7ba,{'contexts':_0x2c1872||[]});fs[_0xf40d('0x6a')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x1ceb6d);})[_0xf40d('0x1e')](function(){return respondWithRpcPromise(_0xf40d('0x62'),_0xf40d('0x33'),{'module':_0xf40d('0x63')});})[_0xf40d('0x1e')](function(){return _0x842154;})[_0xf40d('0x1e')](respondWithResult(_0x2b7f8f,null))[_0xf40d('0x27')](handleError(_0x2b7f8f,null));};exports[_0xf40d('0x34')]=function(_0x10e08d,_0x48fb4c,_0x1eabe7){var _0x6e72b8;return db[_0xf40d('0x50')][_0xf40d('0x58')]({'where':{'id':_0x10e08d[_0xf40d('0x55')]['id']}})['then'](handleEntityNotFound(_0x48fb4c,null))[_0xf40d('0x1e')](removeEntity(_0x48fb4c,null))[_0xf40d('0x1e')](function(){return db[_0xf40d('0x50')][_0xf40d('0x52')]({'raw':!![]});})[_0xf40d('0x1e')](function(_0x4361b9){var _0xf6748c=fs[_0xf40d('0x5b')](path[_0xf40d('0x5c')](config[_0xf40d('0x5d')],_0xf40d('0x5e')),'utf8');var _0xef43df=ejs[_0xf40d('0x60')](_0xf6748c,{'contexts':_0x4361b9});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0xef43df);return respondWithRpcPromise(_0xf40d('0x62'),_0xf40d('0x34'),{'module':_0xf40d('0x63')});})['catch'](handleError(_0x48fb4c,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index cd54637..5f35439 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 _0xb2ed=['request-promise','path','rimraf','exports','define','VoiceContext','voice_contexts','lodash','util','api','moment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb2ed,0xee));var _0xdb2e=function(_0x31b5b2,_0x5ab927){_0x31b5b2=_0x31b5b2-0x0;var _0x364f13=_0xb2ed[_0x31b5b2];return _0x364f13;};'use strict';var _=require(_0xdb2e('0x0'));var util=require(_0xdb2e('0x1'));var logger=require('../../config/logger')(_0xdb2e('0x2'));var moment=require(_0xdb2e('0x3'));var BPromise=require('bluebird');var rp=require(_0xdb2e('0x4'));var fs=require('fs');var path=require(_0xdb2e('0x5'));var rimraf=require(_0xdb2e('0x6'));var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module[_0xdb2e('0x7')]=function(_0x4a36f5,_0x7da3e1){return _0x4a36f5[_0xdb2e('0x8')](_0xdb2e('0x9'),attributes,{'tableName':_0xdb2e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7976=['../../config/environment','exports','define','VoiceContext','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7976,0x1ee));var _0x6797=function(_0x2f463b,_0x1d9d89){_0x2f463b=_0x2f463b-0x0;var _0x17cf29=_0x7976[_0x2f463b];return _0x17cf29;};'use strict';var _=require('lodash');var util=require(_0x6797('0x0'));var logger=require(_0x6797('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6797('0x2'));var rp=require(_0x6797('0x3'));var fs=require('fs');var path=require(_0x6797('0x4'));var rimraf=require(_0x6797('0x5'));var config=require(_0x6797('0x6'));var attributes=require('./voiceContext.attributes');module[_0x6797('0x7')]=function(_0x582a53,_0x4f9ce7){return _0x582a53[_0x6797('0x8')](_0x6797('0x9'),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 989197d..0c6e89f 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 _0xaf1d=['request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x4849f6,_0x104836){var _0x1a3dcd=function(_0x494d3c){while(--_0x494d3c){_0x4849f6['push'](_0x4849f6['shift']());}};_0x1a3dcd(++_0x104836);}(_0xaf1d,0x9f));var _0xdaf1=function(_0x424ff9,_0x286f67){_0x424ff9=_0x424ff9-0x0;var _0x43f7d6=_0xaf1d[_0x424ff9];return _0x43f7d6;};'use strict';var _=require(_0xdaf1('0x0'));var util=require(_0xdaf1('0x1'));var moment=require(_0xdaf1('0x2'));var BPromise=require(_0xdaf1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdaf1('0x4'));var db=require(_0xdaf1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdaf1('0x6'))(_0xdaf1('0x7'));var config=require(_0xdaf1('0x8'));var jayson=require(_0xdaf1('0x9'));var client=jayson[_0xdaf1('0xa')][_0xdaf1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d6c50,_0x54dc7a,_0x5ed9cd){return new BPromise(function(_0xfb18fc,_0x51a7e9){return client['request'](_0x4d6c50,_0x5ed9cd)[_0xdaf1('0xc')](function(_0x3219da){logger[_0xdaf1('0xd')](_0xdaf1('0xe'),_0x54dc7a,'request\x20sent');logger[_0xdaf1('0xf')](_0xdaf1('0x10'),_0x54dc7a,_0xdaf1('0x11'),JSON[_0xdaf1('0x12')](_0x3219da));if(_0x3219da[_0xdaf1('0x13')]){if(_0x3219da['error'][_0xdaf1('0x14')]===0x1f4){logger[_0xdaf1('0x13')](_0xdaf1('0xe'),_0x54dc7a,_0x3219da[_0xdaf1('0x13')][_0xdaf1('0x15')]);return _0x51a7e9(_0x3219da[_0xdaf1('0x13')][_0xdaf1('0x15')]);}logger[_0xdaf1('0x13')](_0xdaf1('0xe'),_0x54dc7a,_0x3219da[_0xdaf1('0x13')][_0xdaf1('0x15')]);return _0xfb18fc(_0x3219da[_0xdaf1('0x13')][_0xdaf1('0x15')]);}else{logger['info'](_0xdaf1('0xe'),_0x54dc7a,_0xdaf1('0x11'));_0xfb18fc(_0x3219da['result'][_0xdaf1('0x15')]);}})['catch'](function(_0x39d34b){logger[_0xdaf1('0x13')](_0xdaf1('0xe'),_0x54dc7a,_0x39d34b);_0x51a7e9(_0x39d34b);});});} \ No newline at end of file +var _0x1f77=['jayson/promise','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3c130a,_0x3f7d54){var _0x3d5f7f=function(_0x4a3b3a){while(--_0x4a3b3a){_0x3c130a['push'](_0x3c130a['shift']());}};_0x3d5f7f(++_0x3f7d54);}(_0x1f77,0x7c));var _0x71f7=function(_0xc4725c,_0x42b0db){_0xc4725c=_0xc4725c-0x0;var _0x256497=_0x1f77[_0xc4725c];return _0x256497;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x71f7('0x0'));var BPromise=require(_0x71f7('0x1'));var rs=require(_0x71f7('0x2'));var fs=require('fs');var Redis=require(_0x71f7('0x3'));var db=require(_0x71f7('0x4'))['db'];var utils=require(_0x71f7('0x5'));var logger=require(_0x71f7('0x6'))(_0x71f7('0x7'));var config=require('../../config/environment');var jayson=require(_0x71f7('0x8'));var client=jayson['client'][_0x71f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4792fb,_0x20a715,_0x8511fa){return new BPromise(function(_0x3849ed,_0x161149){return client[_0x71f7('0xa')](_0x4792fb,_0x8511fa)[_0x71f7('0xb')](function(_0x27bdd5){logger[_0x71f7('0xc')](_0x71f7('0xd'),_0x20a715,'request\x20sent');logger[_0x71f7('0xe')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x20a715,_0x71f7('0xf'),JSON[_0x71f7('0x10')](_0x27bdd5));if(_0x27bdd5[_0x71f7('0x11')]){if(_0x27bdd5[_0x71f7('0x11')][_0x71f7('0x12')]===0x1f4){logger[_0x71f7('0x11')](_0x71f7('0xd'),_0x20a715,_0x27bdd5['error'][_0x71f7('0x13')]);return _0x161149(_0x27bdd5['error'][_0x71f7('0x13')]);}logger['error'](_0x71f7('0xd'),_0x20a715,_0x27bdd5[_0x71f7('0x11')][_0x71f7('0x13')]);return _0x3849ed(_0x27bdd5['error'][_0x71f7('0x13')]);}else{logger['info'](_0x71f7('0xd'),_0x20a715,_0x71f7('0xf'));_0x3849ed(_0x27bdd5[_0x71f7('0x14')][_0x71f7('0x13')]);}})[_0x71f7('0x15')](function(_0x3cebed){logger[_0x71f7('0x11')](_0x71f7('0xd'),_0x20a715,_0x3cebed);_0x161149(_0x3cebed);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 0dab317..b73691f 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 _0xa95c=['update','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','describe','/:id','isAuthenticated','show','post','create','put'];(function(_0x471540,_0x428580){var _0x10217a=function(_0x15b5f5){while(--_0x15b5f5){_0x471540['push'](_0x471540['shift']());}};_0x10217a(++_0x428580);}(_0xa95c,0xaf));var _0xca95=function(_0x33c0b7,_0x5ae4bf){_0x33c0b7=_0x33c0b7-0x0;var _0x1fcdda=_0xa95c[_0x33c0b7];return _0x1fcdda;};'use strict';var multer=require(_0xca95('0x0'));var util=require(_0xca95('0x1'));var path=require('path');var timeout=require(_0xca95('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xca95('0x3'));var interaction=require(_0xca95('0x4'));var config=require(_0xca95('0x5'));var controller=require(_0xca95('0x6'));router[_0xca95('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xca95('0x8')]);router[_0xca95('0x7')](_0xca95('0x9'),auth[_0xca95('0xa')](),controller[_0xca95('0xb')]);router[_0xca95('0xc')]('/',auth[_0xca95('0xa')](),controller[_0xca95('0xd')]);router[_0xca95('0xe')](_0xca95('0x9'),auth['isAuthenticated'](),controller[_0xca95('0xf')]);router[_0xca95('0x10')](_0xca95('0x9'),auth['isAuthenticated'](),controller[_0xca95('0x11')]);module[_0xca95('0x12')]=router; \ No newline at end of file +var _0xfe81=['/:id','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','/describe','get','show','post','create','put'];(function(_0xf6a0d,_0x5dbbbc){var _0x3c4370=function(_0x4bdc4f){while(--_0x4bdc4f){_0xf6a0d['push'](_0xf6a0d['shift']());}};_0x3c4370(++_0x5dbbbc);}(_0xfe81,0x17f));var _0x1fe8=function(_0x4d8a8f,_0x2afd4c){_0x4d8a8f=_0x4d8a8f-0x0;var _0xfc4adc=_0xfe81[_0x4d8a8f];return _0xfc4adc;};'use strict';var multer=require(_0x1fe8('0x0'));var util=require('util');var path=require(_0x1fe8('0x1'));var timeout=require(_0x1fe8('0x2'));var express=require(_0x1fe8('0x3'));var router=express['Router']();var auth=require(_0x1fe8('0x4'));var interaction=require(_0x1fe8('0x5'));var config=require(_0x1fe8('0x6'));var controller=require(_0x1fe8('0x7'));router['get']('/',auth[_0x1fe8('0x8')](),controller[_0x1fe8('0x9')]);router['get'](_0x1fe8('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x1fe8('0xb')]('/:id',auth[_0x1fe8('0x8')](),controller[_0x1fe8('0xc')]);router[_0x1fe8('0xd')]('/',auth[_0x1fe8('0x8')](),controller[_0x1fe8('0xe')]);router[_0x1fe8('0xf')](_0x1fe8('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x1fe8('0x11')](_0x1fe8('0x10'),auth[_0x1fe8('0x8')](),controller['destroy']);module[_0x1fe8('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index a61e42c..fb0705a 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 _0x9ee9=['STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x374c4a,_0x5afa32){var _0x103f4a=function(_0x5a70e1){while(--_0x5a70e1){_0x374c4a['push'](_0x374c4a['shift']());}};_0x103f4a(++_0x5afa32);}(_0x9ee9,0xe5));var _0x99ee=function(_0x5678d6,_0x2ca8c5){_0x5678d6=_0x5678d6-0x0;var _0x2f9bd9=_0x9ee9[_0x5678d6];return _0x2f9bd9;};'use strict';var Sequelize=require(_0x99ee('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x99ee('0x1')]},'channel':{'type':Sequelize[_0x99ee('0x1')]},'channelstate':{'type':Sequelize[_0x99ee('0x2')]},'channelstatedesc':{'type':Sequelize[_0x99ee('0x1')]},'calleridnum':{'type':Sequelize[_0x99ee('0x1')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x99ee('0x1')]},'connectedlinename':{'type':Sequelize[_0x99ee('0x1')]},'language':{'type':Sequelize[_0x99ee('0x1')]},'accountcode':{'type':Sequelize[_0x99ee('0x1')]},'context':{'type':Sequelize[_0x99ee('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x99ee('0x2')]},'uniqueid':{'type':Sequelize[_0x99ee('0x1')]},'linkedid':{'type':Sequelize[_0x99ee('0x1')]},'destchannel':{'type':Sequelize[_0x99ee('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x99ee('0x1')]},'destcalleridnum':{'type':Sequelize[_0x99ee('0x1')]},'destcalleridname':{'type':Sequelize[_0x99ee('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x99ee('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x99ee('0x1')]},'destlanguage':{'type':Sequelize[_0x99ee('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x99ee('0x1')]},'destexten':{'type':Sequelize[_0x99ee('0x1')]},'destpriority':{'type':Sequelize[_0x99ee('0x2')]},'destuniqueid':{'type':Sequelize[_0x99ee('0x1')]},'destlinkedid':{'type':Sequelize[_0x99ee('0x1')]},'dialstring':{'type':Sequelize[_0x99ee('0x1')]},'dialstatus':{'type':Sequelize[_0x99ee('0x1')]},'starttime':{'type':Sequelize[_0x99ee('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING'],'comment':_0x99ee('0x4')},'routeId':{'type':Sequelize[_0x99ee('0x2')]},'duration':{'type':Sequelize[_0x99ee('0x2')]},'holdtime':{'type':Sequelize[_0x99ee('0x2')]},'billableseconds':{'type':Sequelize[_0x99ee('0x2')]}}; \ No newline at end of file +var _0xb996=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x547160,_0x537a78){var _0x3f7b71=function(_0x58be0c){while(--_0x58be0c){_0x547160['push'](_0x547160['shift']());}};_0x3f7b71(++_0x537a78);}(_0xb996,0x156));var _0x6b99=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xb996[_0x2160a9];return _0xa88cf7;};'use strict';var Sequelize=require(_0x6b99('0x0'));module[_0x6b99('0x1')]={'privilege':{'type':Sequelize[_0x6b99('0x2')]},'channel':{'type':Sequelize[_0x6b99('0x2')]},'channelstate':{'type':Sequelize[_0x6b99('0x3')]},'channelstatedesc':{'type':Sequelize[_0x6b99('0x2')]},'calleridnum':{'type':Sequelize[_0x6b99('0x2')]},'calleridname':{'type':Sequelize[_0x6b99('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6b99('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x6b99('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x6b99('0x2')]},'linkedid':{'type':Sequelize[_0x6b99('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x6b99('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x6b99('0x2')]},'destcalleridnum':{'type':Sequelize[_0x6b99('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6b99('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x6b99('0x2')]},'destlanguage':{'type':Sequelize[_0x6b99('0x2')]},'destaccountcode':{'type':Sequelize[_0x6b99('0x2')]},'destcontext':{'type':Sequelize[_0x6b99('0x2')]},'destexten':{'type':Sequelize[_0x6b99('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x6b99('0x2')]},'destlinkedid':{'type':Sequelize[_0x6b99('0x2')]},'dialstring':{'type':Sequelize[_0x6b99('0x2')]},'dialstatus':{'type':Sequelize[_0x6b99('0x2')]},'starttime':{'type':Sequelize[_0x6b99('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x6b99('0x4')]},'lastevent':{'type':Sequelize[_0x6b99('0x2')],'comment':_0x6b99('0x5')},'routeId':{'type':Sequelize[_0x6b99('0x3')]},'duration':{'type':Sequelize[_0x6b99('0x3')]},'holdtime':{'type':Sequelize[_0x6b99('0x3')]},'billableseconds':{'type':Sequelize[_0x6b99('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index c47618c..3d4999a 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 _0x140c=['type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','filters','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','find','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','stack','name','send','index','map','VoiceDialReport','fieldName'];(function(_0x21698c,_0x2304f6){var _0x2e9d29=function(_0x28fcc2){while(--_0x28fcc2){_0x21698c['push'](_0x21698c['shift']());}};_0x2e9d29(++_0x2304f6);}(_0x140c,0x13d));var _0xc140=function(_0x449ef4,_0x3636ea){_0x449ef4=_0x449ef4-0x0;var _0x515e8a=_0x140c[_0x449ef4];return _0x515e8a;};'use strict';var pdf=require(_0xc140('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc140('0x1'));var jsonpatch=require(_0xc140('0x2'));var rp=require(_0xc140('0x3'));var moment=require(_0xc140('0x4'));var BPromise=require(_0xc140('0x5'));var Mustache=require(_0xc140('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc140('0x7'));var csv=require(_0xc140('0x8'));var ejs=require(_0xc140('0x9'));var fs=require('fs');var _=require(_0xc140('0xa'));var squel=require('squel');var crypto=require(_0xc140('0xb'));var jsforce=require(_0xc140('0xc'));var deskjs=require(_0xc140('0xd'));var toCsv=require(_0xc140('0x8'));var querystring=require(_0xc140('0xe'));var Papa=require(_0xc140('0xf'));var Redis=require(_0xc140('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc140('0x11'));var as=require(_0xc140('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc140('0x13'));var utils=require(_0xc140('0x14'));var config=require(_0xc140('0x15'));var db=require(_0xc140('0x16'))['db'];function respondWithStatusCode(_0x44857e,_0x41071f){_0x41071f=_0x41071f||0xcc;return function(_0x4899aa){if(_0x4899aa){return _0x44857e[_0xc140('0x17')](_0x41071f);}return _0x44857e[_0xc140('0x18')](_0x41071f)[_0xc140('0x19')]();};}function respondWithResult(_0x5b035a,_0x4c65b8){_0x4c65b8=_0x4c65b8||0xc8;return function(_0x2cde01){if(_0x2cde01){return _0x5b035a[_0xc140('0x18')](_0x4c65b8)[_0xc140('0x1a')](_0x2cde01);}};}function respondWithFilteredResult(_0x46d173,_0x5df8f8){return function(_0x3e0965){if(_0x3e0965){var _0xc9dd68=_0x3e0965[_0xc140('0x1b')],_0x228210=_0x5df8f8[_0xc140('0x1c')],_0x4ad9a9=_0x5df8f8[_0xc140('0x1c')]+_0x5df8f8[_0xc140('0x1d')],_0x246d5f;if(_0x4ad9a9>=_0xc9dd68){_0x4ad9a9=_0xc9dd68;_0x246d5f=0xc8;}else{_0x246d5f=0xce;}_0x46d173['status'](_0x246d5f);return _0x46d173[_0xc140('0x1e')](_0xc140('0x1f'),_0x228210+'-'+_0x4ad9a9+'/'+_0xc9dd68)[_0xc140('0x1a')](_0x3e0965);}return null;};}function patchUpdates(_0x392c73){return function(_0x2715f3){try{jsonpatch['apply'](_0x2715f3,_0x392c73,!![]);}catch(_0x566461){return BPromise['reject'](_0x566461);}return _0x2715f3[_0xc140('0x20')]();};}function saveUpdates(_0xd2a7c9,_0x5bedab){return function(_0x5dcbd4){if(_0x5dcbd4){return _0x5dcbd4[_0xc140('0x21')](_0xd2a7c9)[_0xc140('0x22')](function(_0x41f210){return _0x41f210;});}return null;};}function removeEntity(_0x229255,_0x879ede){return function(_0x3aca72){if(_0x3aca72){return _0x3aca72[_0xc140('0x23')]()[_0xc140('0x22')](function(){_0x229255[_0xc140('0x18')](0xcc)[_0xc140('0x19')]();});}};}function handleEntityNotFound(_0x31f627,_0x396353){return function(_0x378c7c){if(!_0x378c7c){_0x31f627['sendStatus'](0x194);}return _0x378c7c;};}function handleError(_0x1506fd,_0x58a0ad){_0x58a0ad=_0x58a0ad||0x1f4;return function(_0xe04c38){logger['error'](_0xe04c38[_0xc140('0x24')]);if(_0xe04c38[_0xc140('0x25')]){delete _0xe04c38[_0xc140('0x25')];}_0x1506fd[_0xc140('0x18')](_0x58a0ad)[_0xc140('0x26')](_0xe04c38);};}exports[_0xc140('0x27')]=function(_0x59008e,_0x1e9e03){var _0x5941dd={},_0x3ee0bc={},_0x3e5034={'count':0x0,'rows':[]};var _0x1453e4=_[_0xc140('0x28')](db[_0xc140('0x29')]['rawAttributes'],function(_0x41ca06){return{'name':_0x41ca06[_0xc140('0x2a')],'type':_0x41ca06[_0xc140('0x2b')][_0xc140('0x2c')]};});_0x3ee0bc[_0xc140('0x2d')]=_[_0xc140('0x28')](_0x1453e4,_0xc140('0x25'));_0x3ee0bc[_0xc140('0x2e')]=_[_0xc140('0x2f')](_0x59008e[_0xc140('0x2e')]);_0x3ee0bc['filters']=_['intersection'](_0x3ee0bc['model'],_0x3ee0bc[_0xc140('0x2e')]);_0x5941dd[_0xc140('0x30')]=_[_0xc140('0x31')](_0x3ee0bc[_0xc140('0x2d')],qs[_0xc140('0x32')](_0x59008e[_0xc140('0x2e')][_0xc140('0x32')]));_0x5941dd[_0xc140('0x30')]=_0x5941dd[_0xc140('0x30')][_0xc140('0x33')]?_0x5941dd[_0xc140('0x30')]:_0x3ee0bc[_0xc140('0x2d')];if(!_0x59008e[_0xc140('0x2e')][_0xc140('0x34')]('nolimit')){_0x5941dd['limit']=qs[_0xc140('0x1d')](_0x59008e[_0xc140('0x2e')][_0xc140('0x1d')]);_0x5941dd['offset']=qs[_0xc140('0x1c')](_0x59008e[_0xc140('0x2e')][_0xc140('0x1c')]);}_0x5941dd['order']=qs['sort'](_0x59008e['query']['sort']);_0x5941dd['where']=qs[_0xc140('0x35')](_[_0xc140('0x36')](_0x59008e[_0xc140('0x2e')],_0x3ee0bc[_0xc140('0x35')]));if(_0x59008e[_0xc140('0x2e')]['filter']){_0x5941dd[_0xc140('0x37')]=_[_0xc140('0x38')](_0x5941dd[_0xc140('0x37')],{'$or':_[_0xc140('0x28')](_0x1453e4,function(_0x5ef11a){if(_0x5ef11a[_0xc140('0x2b')]!==_0xc140('0x39')){var _0x446c51={};_0x446c51[_0x5ef11a[_0xc140('0x25')]]={'$like':'%'+_0x59008e[_0xc140('0x2e')][_0xc140('0x3a')]+'%'};return _0x446c51;}})});}_0x5941dd=_['merge']({},_0x5941dd,_0x59008e['options']);var _0x56f67a={'where':_0x5941dd['where']};return db['VoiceDialReport'][_0xc140('0x1b')](_0x56f67a)[_0xc140('0x22')](function(_0x1f387f){_0x3e5034['count']=_0x1f387f;if(_0x59008e[_0xc140('0x2e')][_0xc140('0x3b')]){_0x5941dd[_0xc140('0x3c')]=[{'all':!![]}];}return db[_0xc140('0x29')][_0xc140('0x3d')](_0x5941dd);})[_0xc140('0x22')](function(_0x48c206){_0x3e5034[_0xc140('0x3e')]=_0x48c206;return _0x3e5034;})[_0xc140('0x22')](respondWithFilteredResult(_0x1e9e03,_0x5941dd))[_0xc140('0x3f')](handleError(_0x1e9e03,null));};exports[_0xc140('0x40')]=function(_0x59b328,_0x30d40e){var _0x591056={'raw':!![],'where':{'id':_0x59b328[_0xc140('0x41')]['id']}},_0x1dc041={};_0x1dc041[_0xc140('0x2d')]=_[_0xc140('0x2f')](db['VoiceDialReport'][_0xc140('0x42')]);_0x1dc041[_0xc140('0x2e')]=_[_0xc140('0x2f')](_0x59b328[_0xc140('0x2e')]);_0x1dc041[_0xc140('0x35')]=_[_0xc140('0x31')](_0x1dc041[_0xc140('0x2d')],_0x1dc041[_0xc140('0x2e')]);_0x591056['attributes']=_['intersection'](_0x1dc041[_0xc140('0x2d')],qs[_0xc140('0x32')](_0x59b328[_0xc140('0x2e')]['fields']));_0x591056['attributes']=_0x591056[_0xc140('0x30')][_0xc140('0x33')]?_0x591056[_0xc140('0x30')]:_0x1dc041[_0xc140('0x2d')];if(_0x59b328['query'][_0xc140('0x3b')]){_0x591056[_0xc140('0x3c')]=[{'all':!![]}];}_0x591056=_[_0xc140('0x38')]({},_0x591056,_0x59b328[_0xc140('0x43')]);return db[_0xc140('0x29')]['find'](_0x591056)[_0xc140('0x22')](handleEntityNotFound(_0x30d40e,null))[_0xc140('0x22')](respondWithResult(_0x30d40e,null))['catch'](handleError(_0x30d40e,null));};exports[_0xc140('0x44')]=function(_0x184c3e,_0x369b10){return db[_0xc140('0x29')][_0xc140('0x44')](_0x184c3e[_0xc140('0x45')],{})[_0xc140('0x22')](respondWithResult(_0x369b10,0xc9))[_0xc140('0x3f')](handleError(_0x369b10,null));};exports[_0xc140('0x21')]=function(_0x241916,_0x14c021){if(_0x241916['body']['id']){delete _0x241916[_0xc140('0x45')]['id'];}return db[_0xc140('0x29')][_0xc140('0x46')]({'where':{'id':_0x241916[_0xc140('0x41')]['id']}})[_0xc140('0x22')](handleEntityNotFound(_0x14c021,null))['then'](saveUpdates(_0x241916[_0xc140('0x45')],null))[_0xc140('0x22')](respondWithResult(_0x14c021,null))[_0xc140('0x3f')](handleError(_0x14c021,null));};exports[_0xc140('0x23')]=function(_0x2f5145,_0x4480b1){return db['VoiceDialReport'][_0xc140('0x46')]({'where':{'id':_0x2f5145[_0xc140('0x41')]['id']}})[_0xc140('0x22')](handleEntityNotFound(_0x4480b1,null))['then'](removeEntity(_0x4480b1,null))[_0xc140('0x3f')](handleError(_0x4480b1,null));};exports[_0xc140('0x47')]=function(_0x3368e0,_0x29bb49){return db[_0xc140('0x29')]['describe']()[_0xc140('0x22')](respondWithResult(_0x29bb49,null))[_0xc140('0x3f')](handleError(_0x29bb49,null));}; \ No newline at end of file +var _0xfa35=['intersection','query','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','options','count','then','include','rows','catch','show','params','length','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','update','destroy','error','stack','name','send','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','keys','filters'];(function(_0x28dce4,_0x338301){var _0x2a35fa=function(_0x270224){while(--_0x270224){_0x28dce4['push'](_0x28dce4['shift']());}};_0x2a35fa(++_0x338301);}(_0xfa35,0x1bc));var _0x5fa3=function(_0x70800b,_0x18c90c){_0x70800b=_0x70800b-0x0;var _0x8db856=_0xfa35[_0x70800b];return _0x8db856;};'use strict';var pdf=require(_0x5fa3('0x0'));var emlformat=require(_0x5fa3('0x1'));var rimraf=require(_0x5fa3('0x2'));var zipdir=require(_0x5fa3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5fa3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5fa3('0x5'));var util=require(_0x5fa3('0x6'));var path=require(_0x5fa3('0x7'));var sox=require(_0x5fa3('0x8'));var csv=require(_0x5fa3('0x9'));var ejs=require(_0x5fa3('0xa'));var fs=require('fs');var _=require(_0x5fa3('0xb'));var squel=require(_0x5fa3('0xc'));var crypto=require(_0x5fa3('0xd'));var jsforce=require(_0x5fa3('0xe'));var deskjs=require(_0x5fa3('0xf'));var toCsv=require(_0x5fa3('0x9'));var querystring=require(_0x5fa3('0x10'));var Papa=require('papaparse');var Redis=require(_0x5fa3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5fa3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5fa3('0x13'))('api');var utils=require(_0x5fa3('0x14'));var config=require('../../config/environment');var db=require(_0x5fa3('0x15'))['db'];function respondWithStatusCode(_0x16297f,_0x140410){_0x140410=_0x140410||0xcc;return function(_0x3b4180){if(_0x3b4180){return _0x16297f[_0x5fa3('0x16')](_0x140410);}return _0x16297f[_0x5fa3('0x17')](_0x140410)[_0x5fa3('0x18')]();};}function respondWithResult(_0x4bc9e2,_0x53031d){_0x53031d=_0x53031d||0xc8;return function(_0x422502){if(_0x422502){return _0x4bc9e2[_0x5fa3('0x17')](_0x53031d)[_0x5fa3('0x19')](_0x422502);}};}function respondWithFilteredResult(_0x50abf2,_0xbc94e9){return function(_0x36e2de){if(_0x36e2de){var _0x26d262=_0x36e2de['count'],_0x3beec5=_0xbc94e9[_0x5fa3('0x1a')],_0x49d594=_0xbc94e9[_0x5fa3('0x1a')]+_0xbc94e9[_0x5fa3('0x1b')],_0x54f632;if(_0x49d594>=_0x26d262){_0x49d594=_0x26d262;_0x54f632=0xc8;}else{_0x54f632=0xce;}_0x50abf2['status'](_0x54f632);return _0x50abf2['set'](_0x5fa3('0x1c'),_0x3beec5+'-'+_0x49d594+'/'+_0x26d262)[_0x5fa3('0x19')](_0x36e2de);}return null;};}function patchUpdates(_0x1d6ea0){return function(_0x4f1989){try{jsonpatch[_0x5fa3('0x1d')](_0x4f1989,_0x1d6ea0,!![]);}catch(_0x2b2450){return BPromise[_0x5fa3('0x1e')](_0x2b2450);}return _0x4f1989['save']();};}function saveUpdates(_0x29a738,_0x1ae415){return function(_0x37113a){if(_0x37113a){return _0x37113a[_0x5fa3('0x1f')](_0x29a738)['then'](function(_0x40ec82){return _0x40ec82;});}return null;};}function removeEntity(_0x422657,_0x3f456e){return function(_0x447a9b){if(_0x447a9b){return _0x447a9b[_0x5fa3('0x20')]()['then'](function(){_0x422657[_0x5fa3('0x17')](0xcc)[_0x5fa3('0x18')]();});}};}function handleEntityNotFound(_0xf0189f,_0x14793c){return function(_0x53128d){if(!_0x53128d){_0xf0189f['sendStatus'](0x194);}return _0x53128d;};}function handleError(_0x10e568,_0xdf42de){_0xdf42de=_0xdf42de||0x1f4;return function(_0x196703){logger[_0x5fa3('0x21')](_0x196703[_0x5fa3('0x22')]);if(_0x196703['name']){delete _0x196703[_0x5fa3('0x23')];}_0x10e568[_0x5fa3('0x17')](_0xdf42de)[_0x5fa3('0x24')](_0x196703);};}exports['index']=function(_0x356344,_0x587984){var _0x1d2645={},_0xc9ed71={},_0x26ec6c={'count':0x0,'rows':[]};var _0x21d4a8=_[_0x5fa3('0x25')](db[_0x5fa3('0x26')][_0x5fa3('0x27')],function(_0x4cda76){return{'name':_0x4cda76[_0x5fa3('0x28')],'type':_0x4cda76[_0x5fa3('0x29')][_0x5fa3('0x2a')]};});_0xc9ed71[_0x5fa3('0x2b')]=_[_0x5fa3('0x25')](_0x21d4a8,_0x5fa3('0x23'));_0xc9ed71['query']=_[_0x5fa3('0x2c')](_0x356344['query']);_0xc9ed71[_0x5fa3('0x2d')]=_[_0x5fa3('0x2e')](_0xc9ed71[_0x5fa3('0x2b')],_0xc9ed71[_0x5fa3('0x2f')]);_0x1d2645[_0x5fa3('0x30')]=_[_0x5fa3('0x2e')](_0xc9ed71[_0x5fa3('0x2b')],qs['fields'](_0x356344[_0x5fa3('0x2f')][_0x5fa3('0x31')]));_0x1d2645[_0x5fa3('0x30')]=_0x1d2645[_0x5fa3('0x30')]['length']?_0x1d2645[_0x5fa3('0x30')]:_0xc9ed71[_0x5fa3('0x2b')];if(!_0x356344[_0x5fa3('0x2f')][_0x5fa3('0x32')]('nolimit')){_0x1d2645[_0x5fa3('0x1b')]=qs[_0x5fa3('0x1b')](_0x356344[_0x5fa3('0x2f')]['limit']);_0x1d2645[_0x5fa3('0x1a')]=qs[_0x5fa3('0x1a')](_0x356344[_0x5fa3('0x2f')]['offset']);}_0x1d2645[_0x5fa3('0x33')]=qs[_0x5fa3('0x34')](_0x356344[_0x5fa3('0x2f')]['sort']);_0x1d2645['where']=qs[_0x5fa3('0x2d')](_[_0x5fa3('0x35')](_0x356344[_0x5fa3('0x2f')],_0xc9ed71[_0x5fa3('0x2d')]));if(_0x356344['query'][_0x5fa3('0x36')]){_0x1d2645[_0x5fa3('0x37')]=_['merge'](_0x1d2645[_0x5fa3('0x37')],{'$or':_['map'](_0x21d4a8,function(_0x5533ca){if(_0x5533ca[_0x5fa3('0x29')]!=='VIRTUAL'){var _0xb51909={};_0xb51909[_0x5533ca[_0x5fa3('0x23')]]={'$like':'%'+_0x356344['query'][_0x5fa3('0x36')]+'%'};return _0xb51909;}})});}_0x1d2645=_[_0x5fa3('0x38')]({},_0x1d2645,_0x356344[_0x5fa3('0x39')]);var _0x468b4b={'where':_0x1d2645[_0x5fa3('0x37')]};return db[_0x5fa3('0x26')][_0x5fa3('0x3a')](_0x468b4b)[_0x5fa3('0x3b')](function(_0x4402e7){_0x26ec6c['count']=_0x4402e7;if(_0x356344[_0x5fa3('0x2f')]['includeAll']){_0x1d2645[_0x5fa3('0x3c')]=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x1d2645);})[_0x5fa3('0x3b')](function(_0x52444d){_0x26ec6c[_0x5fa3('0x3d')]=_0x52444d;return _0x26ec6c;})[_0x5fa3('0x3b')](respondWithFilteredResult(_0x587984,_0x1d2645))[_0x5fa3('0x3e')](handleError(_0x587984,null));};exports[_0x5fa3('0x3f')]=function(_0x4ef962,_0x2b4f30){var _0x3e8e12={'raw':!![],'where':{'id':_0x4ef962[_0x5fa3('0x40')]['id']}},_0x598bd0={};_0x598bd0['model']=_[_0x5fa3('0x2c')](db[_0x5fa3('0x26')][_0x5fa3('0x27')]);_0x598bd0[_0x5fa3('0x2f')]=_[_0x5fa3('0x2c')](_0x4ef962[_0x5fa3('0x2f')]);_0x598bd0[_0x5fa3('0x2d')]=_[_0x5fa3('0x2e')](_0x598bd0['model'],_0x598bd0['query']);_0x3e8e12[_0x5fa3('0x30')]=_[_0x5fa3('0x2e')](_0x598bd0[_0x5fa3('0x2b')],qs[_0x5fa3('0x31')](_0x4ef962['query'][_0x5fa3('0x31')]));_0x3e8e12[_0x5fa3('0x30')]=_0x3e8e12[_0x5fa3('0x30')][_0x5fa3('0x41')]?_0x3e8e12[_0x5fa3('0x30')]:_0x598bd0[_0x5fa3('0x2b')];if(_0x4ef962['query']['includeAll']){_0x3e8e12['include']=[{'all':!![]}];}_0x3e8e12=_[_0x5fa3('0x38')]({},_0x3e8e12,_0x4ef962[_0x5fa3('0x39')]);return db['VoiceDialReport']['find'](_0x3e8e12)[_0x5fa3('0x3b')](handleEntityNotFound(_0x2b4f30,null))[_0x5fa3('0x3b')](respondWithResult(_0x2b4f30,null))[_0x5fa3('0x3e')](handleError(_0x2b4f30,null));};exports[_0x5fa3('0x42')]=function(_0x2fb3d1,_0x5900b4){return db[_0x5fa3('0x26')]['create'](_0x2fb3d1['body'],{})[_0x5fa3('0x3b')](respondWithResult(_0x5900b4,0xc9))[_0x5fa3('0x3e')](handleError(_0x5900b4,null));};exports['update']=function(_0x5d42fa,_0x242c6d){if(_0x5d42fa[_0x5fa3('0x43')]['id']){delete _0x5d42fa[_0x5fa3('0x43')]['id'];}return db[_0x5fa3('0x26')][_0x5fa3('0x44')]({'where':{'id':_0x5d42fa[_0x5fa3('0x40')]['id']}})[_0x5fa3('0x3b')](handleEntityNotFound(_0x242c6d,null))['then'](saveUpdates(_0x5d42fa[_0x5fa3('0x43')],null))[_0x5fa3('0x3b')](respondWithResult(_0x242c6d,null))[_0x5fa3('0x3e')](handleError(_0x242c6d,null));};exports[_0x5fa3('0x20')]=function(_0xc4dfac,_0x402f3a){return db[_0x5fa3('0x26')][_0x5fa3('0x44')]({'where':{'id':_0xc4dfac[_0x5fa3('0x40')]['id']}})['then'](handleEntityNotFound(_0x402f3a,null))[_0x5fa3('0x3b')](removeEntity(_0x402f3a,null))[_0x5fa3('0x3e')](handleError(_0x402f3a,null));};exports[_0x5fa3('0x45')]=function(_0x51ca65,_0x136ff7){return db[_0x5fa3('0x26')][_0x5fa3('0x45')]()[_0x5fa3('0x3b')](respondWithResult(_0x136ff7,null))[_0x5fa3('0x3e')](handleError(_0x136ff7,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 8aaf1c8..5756bac 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 _0x7556=['VoiceDialReport','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define'];(function(_0x3676fc,_0x369252){var _0x305fa1=function(_0x21b996){while(--_0x21b996){_0x3676fc['push'](_0x3676fc['shift']());}};_0x305fa1(++_0x369252);}(_0x7556,0x1af));var _0x6755=function(_0x243efc,_0x21ccd7){_0x243efc=_0x243efc-0x0;var _0x31dc3a=_0x7556[_0x243efc];return _0x31dc3a;};'use strict';var _=require('lodash');var util=require(_0x6755('0x0'));var logger=require(_0x6755('0x1'))(_0x6755('0x2'));var moment=require(_0x6755('0x3'));var BPromise=require(_0x6755('0x4'));var rp=require(_0x6755('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6755('0x6'));var config=require(_0x6755('0x7'));var attributes=require(_0x6755('0x8'));module[_0x6755('0x9')]=function(_0x2afba9,_0x37406c){return _0x2afba9[_0x6755('0xa')](_0x6755('0xb'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x6755('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcda9=['define','VoiceDialReport','report_dial','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x26a6ce,_0x5e31fe){var _0x4517e7=function(_0x1cb991){while(--_0x1cb991){_0x26a6ce['push'](_0x26a6ce['shift']());}};_0x4517e7(++_0x5e31fe);}(_0xcda9,0xee));var _0x9cda=function(_0x159f86,_0x2a0c48){_0x159f86=_0x159f86-0x0;var _0x134d50=_0xcda9[_0x159f86];return _0x134d50;};'use strict';var _=require(_0x9cda('0x0'));var util=require('util');var logger=require(_0x9cda('0x1'))(_0x9cda('0x2'));var moment=require(_0x9cda('0x3'));var BPromise=require(_0x9cda('0x4'));var rp=require(_0x9cda('0x5'));var fs=require('fs');var path=require(_0x9cda('0x6'));var rimraf=require(_0x9cda('0x7'));var config=require(_0x9cda('0x8'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x4b2f45,_0x13c507){return _0x4b2f45[_0x9cda('0x9')](_0x9cda('0xa'),attributes,{'tableName':_0x9cda('0xb'),'paranoid':![],'indexes':[{'fields':[_0x9cda('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 344b4a6..e45ddc8 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 _0x130d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','CreateVoiceDialReport','VoiceDialReport','options','raw','stringify','UpdateVoiceDialReport','update','body','limit','then','lodash','moment','randomstring','ioredis'];(function(_0x31b7ff,_0x4d3503){var _0x33ba84=function(_0x1e90b7){while(--_0x1e90b7){_0x31b7ff['push'](_0x31b7ff['shift']());}};_0x33ba84(++_0x4d3503);}(_0x130d,0x125));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd130('0x0'));var util=require('util');var moment=require(_0xd130('0x1'));var BPromise=require('bluebird');var rs=require(_0xd130('0x2'));var fs=require('fs');var Redis=require(_0xd130('0x3'));var db=require(_0xd130('0x4'))['db'];var utils=require(_0xd130('0x5'));var logger=require(_0xd130('0x6'))(_0xd130('0x7'));var config=require(_0xd130('0x8'));var jayson=require(_0xd130('0x9'));var client=jayson[_0xd130('0xa')][_0xd130('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44c215,_0x168ee7,_0x3f77e1){return new BPromise(function(_0x1b9875,_0x4a3818){return client[_0xd130('0xc')](_0x44c215,_0x3f77e1)['then'](function(_0x1cec3b){logger[_0xd130('0xd')](_0xd130('0xe'),_0x168ee7,'request\x20sent');logger[_0xd130('0xf')](_0xd130('0x10'),_0x168ee7,'request\x20sent',JSON['stringify'](_0x1cec3b));if(_0x1cec3b[_0xd130('0x11')]){if(_0x1cec3b['error'][_0xd130('0x12')]===0x1f4){logger[_0xd130('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x168ee7,_0x1cec3b[_0xd130('0x11')][_0xd130('0x13')]);return _0x4a3818(_0x1cec3b[_0xd130('0x11')]['message']);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x168ee7,_0x1cec3b[_0xd130('0x11')][_0xd130('0x13')]);return _0x1b9875(_0x1cec3b[_0xd130('0x11')][_0xd130('0x13')]);}else{logger[_0xd130('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x168ee7,_0xd130('0x14'));_0x1b9875(_0x1cec3b[_0xd130('0x15')][_0xd130('0x13')]);}})[_0xd130('0x16')](function(_0x57930b){logger[_0xd130('0x11')](_0xd130('0xe'),_0x168ee7,_0x57930b);_0x4a3818(_0x57930b);});});}exports[_0xd130('0x17')]=function(_0xce6d93){var _0x342eb2=this;return new Promise(function(_0xc1c504,_0x43ed26){return db[_0xd130('0x18')]['create'](_0xce6d93['body'],{'raw':_0xce6d93[_0xd130('0x19')]?_0xce6d93[_0xd130('0x19')][_0xd130('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2420fd){logger[_0xd130('0xd')](_0xd130('0x17'),_0xce6d93);logger[_0xd130('0xf')](_0xd130('0x17'),_0xce6d93,JSON[_0xd130('0x1b')](_0x2420fd));_0xc1c504(_0x2420fd);})['catch'](function(_0x311c3a){logger[_0xd130('0x11')](_0xd130('0x17'),_0x311c3a[_0xd130('0x13')],_0xce6d93);_0x43ed26(_0x342eb2[_0xd130('0x11')](0x1f4,_0x311c3a[_0xd130('0x13')]));});});};exports[_0xd130('0x1c')]=function(_0x316540){var _0x1bec98=this;return new Promise(function(_0x1b1ed1,_0x58b7c8){return db[_0xd130('0x18')][_0xd130('0x1d')](_0x316540[_0xd130('0x1e')],{'raw':_0x316540[_0xd130('0x19')]?_0x316540[_0xd130('0x19')][_0xd130('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x316540['options']?_0x316540[_0xd130('0x19')]['where']||null:null,'attributes':_0x316540[_0xd130('0x19')]?_0x316540['options']['attributes']||null:null,'limit':_0x316540['options']?_0x316540[_0xd130('0x19')][_0xd130('0x1f')]||null:null})[_0xd130('0x20')](function(_0x16aac6){logger['info'](_0xd130('0x1c'),_0x316540);logger[_0xd130('0xf')](_0xd130('0x1c'),_0x316540,JSON['stringify'](_0x16aac6));_0x1b1ed1(_0x16aac6);})[_0xd130('0x16')](function(_0x4fee50){logger[_0xd130('0x11')]('UpdateVoiceDialReport',_0x4fee50[_0xd130('0x13')],_0x316540);_0x58b7c8(_0x1bec98[_0xd130('0x11')](0x1f4,_0x4fee50[_0xd130('0x13')]));});});}; \ No newline at end of file +var _0x12cc=['then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','debug','UpdateVoiceDialReport','update','limit','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','http','request'];(function(_0x3b47a5,_0x224b90){var _0x4413d9=function(_0x48578a){while(--_0x48578a){_0x3b47a5['push'](_0x3b47a5['shift']());}};_0x4413d9(++_0x224b90);}(_0x12cc,0xc2));var _0xc12c=function(_0x49711d,_0x3d9d65){_0x49711d=_0x49711d-0x0;var _0x3b57dd=_0x12cc[_0x49711d];return _0x3b57dd;};'use strict';var _=require('lodash');var util=require(_0xc12c('0x0'));var moment=require(_0xc12c('0x1'));var BPromise=require(_0xc12c('0x2'));var rs=require(_0xc12c('0x3'));var fs=require('fs');var Redis=require(_0xc12c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc12c('0x5'))(_0xc12c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc12c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1c0435,_0xe572e1,_0x52017f){return new BPromise(function(_0x488940,_0x2f11ba){return client[_0xc12c('0x8')](_0x1c0435,_0x52017f)[_0xc12c('0x9')](function(_0x53bde7){logger[_0xc12c('0xa')](_0xc12c('0xb'),_0xe572e1,_0xc12c('0xc'));logger['debug'](_0xc12c('0xd'),_0xe572e1,_0xc12c('0xc'),JSON[_0xc12c('0xe')](_0x53bde7));if(_0x53bde7[_0xc12c('0xf')]){if(_0x53bde7[_0xc12c('0xf')][_0xc12c('0x10')]===0x1f4){logger['error'](_0xc12c('0xb'),_0xe572e1,_0x53bde7[_0xc12c('0xf')][_0xc12c('0x11')]);return _0x2f11ba(_0x53bde7['error']['message']);}logger[_0xc12c('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0xe572e1,_0x53bde7[_0xc12c('0xf')][_0xc12c('0x11')]);return _0x488940(_0x53bde7['error'][_0xc12c('0x11')]);}else{logger['info'](_0xc12c('0xb'),_0xe572e1,_0xc12c('0xc'));_0x488940(_0x53bde7['result']['message']);}})[_0xc12c('0x12')](function(_0x18dca7){logger['error'](_0xc12c('0xb'),_0xe572e1,_0x18dca7);_0x2f11ba(_0x18dca7);});});}exports[_0xc12c('0x13')]=function(_0x5c0c82){var _0x9fba66=this;return new Promise(function(_0x19a59a,_0x5ef398){return db[_0xc12c('0x14')][_0xc12c('0x15')](_0x5c0c82[_0xc12c('0x16')],{'raw':_0x5c0c82['options']?_0x5c0c82[_0xc12c('0x17')][_0xc12c('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x493fe9){logger['info'](_0xc12c('0x13'),_0x5c0c82);logger[_0xc12c('0x19')](_0xc12c('0x13'),_0x5c0c82,JSON[_0xc12c('0xe')](_0x493fe9));_0x19a59a(_0x493fe9);})[_0xc12c('0x12')](function(_0xe56d9){logger[_0xc12c('0xf')]('CreateVoiceDialReport',_0xe56d9[_0xc12c('0x11')],_0x5c0c82);_0x5ef398(_0x9fba66[_0xc12c('0xf')](0x1f4,_0xe56d9[_0xc12c('0x11')]));});});};exports[_0xc12c('0x1a')]=function(_0x41e5f7){var _0x423bbd=this;return new Promise(function(_0x8e4d35,_0x3af86d){return db[_0xc12c('0x14')][_0xc12c('0x1b')](_0x41e5f7[_0xc12c('0x16')],{'raw':_0x41e5f7[_0xc12c('0x17')]?_0x41e5f7[_0xc12c('0x17')][_0xc12c('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41e5f7[_0xc12c('0x17')]?_0x41e5f7['options']['where']||null:null,'attributes':_0x41e5f7[_0xc12c('0x17')]?_0x41e5f7[_0xc12c('0x17')]['attributes']||null:null,'limit':_0x41e5f7[_0xc12c('0x17')]?_0x41e5f7[_0xc12c('0x17')][_0xc12c('0x1c')]||null:null})[_0xc12c('0x9')](function(_0x4e0c48){logger[_0xc12c('0xa')](_0xc12c('0x1a'),_0x41e5f7);logger[_0xc12c('0x19')](_0xc12c('0x1a'),_0x41e5f7,JSON['stringify'](_0x4e0c48));_0x8e4d35(_0x4e0c48);})['catch'](function(_0x51e763){logger[_0xc12c('0xf')](_0xc12c('0x1a'),_0x51e763[_0xc12c('0x11')],_0x41e5f7);_0x3af86d(_0x423bbd[_0xc12c('0xf')](0x1f4,_0x51e763['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 0cea33a..54f687c 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 _0xd568=['destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','./voiceExtension.controller','get','index','isAuthenticated','show','create','post','/:id/applications','addApplications'];(function(_0x40d394,_0x27f0de){var _0x4f285d=function(_0x2c6c7e){while(--_0x2c6c7e){_0x40d394['push'](_0x40d394['shift']());}};_0x4f285d(++_0x27f0de);}(_0xd568,0x156));var _0x8d56=function(_0x42118e,_0x4dfb3e){_0x42118e=_0x42118e-0x0;var _0x524646=_0xd568[_0x42118e];return _0x524646;};'use strict';var multer=require(_0x8d56('0x0'));var util=require(_0x8d56('0x1'));var path=require(_0x8d56('0x2'));var timeout=require(_0x8d56('0x3'));var express=require('express');var router=express[_0x8d56('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8d56('0x5'));var controller=require(_0x8d56('0x6'));router[_0x8d56('0x7')]('/',auth['isAuthenticated'](),controller[_0x8d56('0x8')]);router[_0x8d56('0x7')]('/:id',auth[_0x8d56('0x9')](),controller[_0x8d56('0xa')]);router['post']('/',auth[_0x8d56('0x9')](),controller[_0x8d56('0xb')]);router[_0x8d56('0xc')](_0x8d56('0xd'),auth[_0x8d56('0x9')](),controller[_0x8d56('0xe')]);router['put']('/:id',auth[_0x8d56('0x9')](),controller['update']);router['delete']('/:id',auth[_0x8d56('0x9')](),controller[_0x8d56('0xf')]);module[_0x8d56('0x10')]=router; \ No newline at end of file +var _0x2bd2=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','update','exports','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x18d104,_0x46c1ab){var _0x5a0f34=function(_0x3b6a3b){while(--_0x3b6a3b){_0x18d104['push'](_0x18d104['shift']());}};_0x5a0f34(++_0x46c1ab);}(_0x2bd2,0xfa));var _0x22bd=function(_0x578ae6,_0x12b233){_0x578ae6=_0x578ae6-0x0;var _0x3e06c0=_0x2bd2[_0x578ae6];return _0x3e06c0;};'use strict';var multer=require(_0x22bd('0x0'));var util=require(_0x22bd('0x1'));var path=require('path');var timeout=require(_0x22bd('0x2'));var express=require(_0x22bd('0x3'));var router=express['Router']();var auth=require(_0x22bd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x22bd('0x5'));var controller=require('./voiceExtension.controller');router[_0x22bd('0x6')]('/',auth[_0x22bd('0x7')](),controller[_0x22bd('0x8')]);router[_0x22bd('0x6')](_0x22bd('0x9'),auth[_0x22bd('0x7')](),controller[_0x22bd('0xa')]);router[_0x22bd('0xb')]('/',auth[_0x22bd('0x7')](),controller[_0x22bd('0xc')]);router[_0x22bd('0xb')](_0x22bd('0xd'),auth[_0x22bd('0x7')](),controller[_0x22bd('0xe')]);router['put'](_0x22bd('0x9'),auth[_0x22bd('0x7')](),controller[_0x22bd('0xf')]);router['delete'](_0x22bd('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x22bd('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index c54f056..90eecec 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(_0x218fb1,_0x2aa008){var _0x57a5c3=function(_0x5babba){while(--_0x5babba){_0x218fb1['push'](_0x218fb1['shift']());}};_0x57a5c3(++_0x2aa008);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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(_0x3ce33a,_0x19e1d0){var _0x5b61f3=function(_0x2db31b){while(--_0x2db31b){_0x3ce33a['push'](_0x3ce33a['shift']());}};_0x5b61f3(++_0x19e1d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 626be5b..9c6d092 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 _0x865b=['key','query','keys','intersection','model','attributes','fields','order','sort','where','filters','pick','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','length','create','body','startsWith','exten','concat','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','InboundRoutes','OutboundRoutes','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','recordingFormat','cutdigits','addApplications','findOne','transaction','VoiceExtensionId','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','inbound','outbound','InternalRoutes','internal','filter','map','value','includes','type','find','name','UserProfileResource','error','stack','send','index','VoiceExtension','rawAttributes','fieldName'];(function(_0x2c1aa8,_0x3e0609){var _0x4019f5=function(_0x916eac){while(--_0x916eac){_0x2c1aa8['push'](_0x2c1aa8['shift']());}};_0x4019f5(++_0x3e0609);}(_0x865b,0x165));var _0xb865=function(_0x19e211,_0x21229a){_0x19e211=_0x19e211-0x0;var _0x5ea94e=_0x865b[_0x19e211];return _0x5ea94e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb865('0x0'));var rimraf=require(_0xb865('0x1'));var zipdir=require(_0xb865('0x2'));var jsonpatch=require(_0xb865('0x3'));var rp=require(_0xb865('0x4'));var moment=require('moment');var BPromise=require(_0xb865('0x5'));var Mustache=require(_0xb865('0x6'));var util=require(_0xb865('0x7'));var path=require(_0xb865('0x8'));var sox=require(_0xb865('0x9'));var csv=require(_0xb865('0xa'));var ejs=require(_0xb865('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb865('0xc'));var crypto=require(_0xb865('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb865('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb865('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb865('0x10'));var as=require(_0xb865('0x11'));var hardwareService=require(_0xb865('0x12'));var logger=require(_0xb865('0x13'))('api');var utils=require(_0xb865('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xb865('0x15')]=_[_0xb865('0x16')](config[_0xb865('0x15')],{'host':_0xb865('0x17'),'port':0x18eb});var socket=require(_0xb865('0x18'))(new Redis(config[_0xb865('0x15')]));require('./voiceExtension.socket')[_0xb865('0x19')](socket);function respondWithStatusCode(_0x10eb36,_0x3b732f){_0x3b732f=_0x3b732f||0xcc;return function(_0x1c295a){if(_0x1c295a){return _0x10eb36[_0xb865('0x1a')](_0x3b732f);}return _0x10eb36[_0xb865('0x1b')](_0x3b732f)[_0xb865('0x1c')]();};}function respondWithResult(_0x20dfd2,_0x2bcf16){_0x2bcf16=_0x2bcf16||0xc8;return function(_0x35592e){if(_0x35592e){return _0x20dfd2['status'](_0x2bcf16)[_0xb865('0x1d')](_0x35592e);}};}function respondWithFilteredResult(_0x57f5b2,_0x417e08){return function(_0x4c6fcc){if(_0x4c6fcc){var _0x441a1f=_0x4c6fcc['count'],_0xd9e71c=_0x417e08[_0xb865('0x1e')],_0x5c9c18=_0x417e08[_0xb865('0x1e')]+_0x417e08[_0xb865('0x1f')],_0x4b1852;if(_0x5c9c18>=_0x441a1f){_0x5c9c18=_0x441a1f;_0x4b1852=0xc8;}else{_0x4b1852=0xce;}_0x57f5b2[_0xb865('0x1b')](_0x4b1852);return _0x57f5b2[_0xb865('0x20')](_0xb865('0x21'),_0xd9e71c+'-'+_0x5c9c18+'/'+_0x441a1f)[_0xb865('0x1d')](_0x4c6fcc);}return null;};}function patchUpdates(_0x3edb23){return function(_0x4cb841){try{jsonpatch[_0xb865('0x22')](_0x4cb841,_0x3edb23,!![]);}catch(_0x3cfac3){return BPromise[_0xb865('0x23')](_0x3cfac3);}return _0x4cb841[_0xb865('0x24')]();};}function saveUpdates(_0x486934,_0x4bdd24){return function(_0x80ba6d){if(_0x80ba6d){return _0x80ba6d[_0xb865('0x25')](_0x486934)['then'](function(_0x3ec903){return _0x3ec903;});}return null;};}function removeEntity(_0x192fd9,_0x26ac03){return function(_0x113394){if(_0x113394){return _0x113394[_0xb865('0x26')]()[_0xb865('0x27')](function(){var _0x30301b=_0x113394['get']({'plain':!![]});var _0x1b1aad=[{'name':'InboundRoutes','value':_0xb865('0x28'),'ignore':![]},{'name':'OutboundRoutes','value':_0xb865('0x29'),'ignore':![]},{'name':_0xb865('0x2a'),'value':_0xb865('0x2b'),'ignore':![]}];var _0x52a674=_(_0x1b1aad)[_0xb865('0x2c')]('ignore')[_0xb865('0x2d')]('value')[_0xb865('0x2e')]();if(_[_0xb865('0x2f')](_0x52a674,_0x30301b[_0xb865('0x30')])){return;}var _0x4c8d93=_[_0xb865('0x31')](_0x1b1aad,[_0xb865('0x2e'),_0x30301b[_0xb865('0x30')]])[_0xb865('0x32')];return db[_0xb865('0x33')]['destroy']({'where':{'type':_0x4c8d93,'resourceId':_0x30301b['id']}})[_0xb865('0x27')](function(){return _0x113394;});})[_0xb865('0x27')](function(){_0x192fd9[_0xb865('0x1b')](0xcc)[_0xb865('0x1c')]();});}};}function handleEntityNotFound(_0x39365a,_0x260a22){return function(_0x1afd54){if(!_0x1afd54){_0x39365a[_0xb865('0x1a')](0x194);}return _0x1afd54;};}function handleError(_0x5a911c,_0x53617a){_0x53617a=_0x53617a||0x1f4;return function(_0x476f26){logger[_0xb865('0x34')](_0x476f26[_0xb865('0x35')]);if(_0x476f26[_0xb865('0x32')]){delete _0x476f26[_0xb865('0x32')];}_0x5a911c[_0xb865('0x1b')](_0x53617a)[_0xb865('0x36')](_0x476f26);};}exports[_0xb865('0x37')]=function(_0x50aaf1,_0x4ec0a1){var _0x16b540={},_0x15575f={},_0x553a83={'count':0x0,'rows':[]};var _0x46a691=_['map'](db[_0xb865('0x38')][_0xb865('0x39')],function(_0x4fbe9b){return{'name':_0x4fbe9b[_0xb865('0x3a')],'type':_0x4fbe9b[_0xb865('0x30')][_0xb865('0x3b')]};});_0x15575f['model']=_['map'](_0x46a691,'name');_0x15575f[_0xb865('0x3c')]=_[_0xb865('0x3d')](_0x50aaf1[_0xb865('0x3c')]);_0x15575f['filters']=_[_0xb865('0x3e')](_0x15575f[_0xb865('0x3f')],_0x15575f[_0xb865('0x3c')]);_0x16b540[_0xb865('0x40')]=_[_0xb865('0x3e')](_0x15575f['model'],qs[_0xb865('0x41')](_0x50aaf1['query'][_0xb865('0x41')]));_0x16b540['attributes']=_0x16b540[_0xb865('0x40')]['length']?_0x16b540[_0xb865('0x40')]:_0x15575f[_0xb865('0x3f')];if(!_0x50aaf1[_0xb865('0x3c')]['hasOwnProperty']('nolimit')){_0x16b540[_0xb865('0x1f')]=qs[_0xb865('0x1f')](_0x50aaf1[_0xb865('0x3c')][_0xb865('0x1f')]);_0x16b540['offset']=qs[_0xb865('0x1e')](_0x50aaf1['query'][_0xb865('0x1e')]);}_0x16b540[_0xb865('0x42')]=qs[_0xb865('0x43')](_0x50aaf1[_0xb865('0x3c')]['sort']);_0x16b540[_0xb865('0x44')]=qs[_0xb865('0x45')](_[_0xb865('0x46')](_0x50aaf1[_0xb865('0x3c')],_0x15575f[_0xb865('0x45')]));if(_0x50aaf1[_0xb865('0x3c')][_0xb865('0x2c')]){_0x16b540[_0xb865('0x44')]=_[_0xb865('0x47')](_0x16b540['where'],{'$or':_[_0xb865('0x2d')](_0x46a691,function(_0x12722b){if(_0x12722b[_0xb865('0x30')]!==_0xb865('0x48')){var _0x3edd43={};_0x3edd43[_0x12722b['name']]={'$like':'%'+_0x50aaf1['query'][_0xb865('0x2c')]+'%'};return _0x3edd43;}})});}_0x16b540=_['merge']({},_0x16b540,_0x50aaf1[_0xb865('0x49')]);var _0x244f07={'where':_0x16b540[_0xb865('0x44')]};return db[_0xb865('0x38')][_0xb865('0x4a')](_0x244f07)[_0xb865('0x27')](function(_0x36dda8){_0x553a83[_0xb865('0x4a')]=_0x36dda8;if(_0x50aaf1[_0xb865('0x3c')][_0xb865('0x4b')]){_0x16b540['include']=[{'all':!![]}];}return db[_0xb865('0x38')][_0xb865('0x4c')](_0x16b540);})[_0xb865('0x27')](function(_0xa66770){_0x553a83[_0xb865('0x4d')]=_0xa66770;return _0x553a83;})[_0xb865('0x27')](respondWithFilteredResult(_0x4ec0a1,_0x16b540))[_0xb865('0x4e')](handleError(_0x4ec0a1,null));};exports[_0xb865('0x4f')]=function(_0x11c31d,_0x43aded){var _0x24256c={'raw':![],'where':{'id':_0x11c31d[_0xb865('0x50')]['id']}},_0x4f2179={};_0x4f2179[_0xb865('0x3f')]=_[_0xb865('0x3d')](db[_0xb865('0x38')][_0xb865('0x39')]);_0x4f2179[_0xb865('0x3c')]=_['keys'](_0x11c31d[_0xb865('0x3c')]);_0x4f2179[_0xb865('0x45')]=_[_0xb865('0x3e')](_0x4f2179[_0xb865('0x3f')],_0x4f2179['query']);_0x24256c[_0xb865('0x40')]=_['intersection'](_0x4f2179[_0xb865('0x3f')],qs[_0xb865('0x41')](_0x11c31d[_0xb865('0x3c')]['fields']));_0x24256c[_0xb865('0x40')]=_0x24256c[_0xb865('0x40')][_0xb865('0x51')]?_0x24256c[_0xb865('0x40')]:_0x4f2179[_0xb865('0x3f')];if(_0x11c31d[_0xb865('0x3c')][_0xb865('0x4b')]){_0x24256c['include']=[{'all':!![]}];}_0x24256c=_[_0xb865('0x47')]({},_0x24256c,_0x11c31d[_0xb865('0x49')]);return db[_0xb865('0x38')][_0xb865('0x31')](_0x24256c)['then'](handleEntityNotFound(_0x43aded,null))['then'](respondWithResult(_0x43aded,null))['catch'](handleError(_0x43aded,null));};exports[_0xb865('0x26')]=function(_0x121206,_0x49fc70){return db[_0xb865('0x38')][_0xb865('0x31')]({'where':{'id':_0x121206['params']['id']}})[_0xb865('0x27')](handleEntityNotFound(_0x49fc70,null))[_0xb865('0x27')](removeEntity(_0x49fc70,null))[_0xb865('0x4e')](handleError(_0x49fc70,null));};exports[_0xb865('0x52')]=function(_0x43c3b6,_0x3eaac4){if(_0x43c3b6[_0xb865('0x53')][_0xb865('0x30')]===_0xb865('0x29')&&!_[_0xb865('0x54')](_0x43c3b6[_0xb865('0x53')][_0xb865('0x55')],'_')){_0x43c3b6[_0xb865('0x53')][_0xb865('0x55')]='_'[_0xb865('0x56')](_0x43c3b6[_0xb865('0x53')][_0xb865('0x55')]);}return db[_0xb865('0x38')]['create'](_0x43c3b6[_0xb865('0x53')],{'raw':![]})['then'](function(_0x34e6e3){var _0x2342a1=_0x43c3b6['user'][_0xb865('0x57')]({'plain':!![]});if(!_0x2342a1)throw new Error(_0xb865('0x58'));if(_0x2342a1[_0xb865('0x59')]===_0xb865('0x5a')){var _0x17a66b=_0x34e6e3[_0xb865('0x57')]({'plain':!![]});var _0x38c820=[{'name':_0xb865('0x5b'),'value':_0xb865('0x28')},{'name':_0xb865('0x5c'),'value':_0xb865('0x29')},{'name':_0xb865('0x2a'),'value':_0xb865('0x2b')}];var _0x3de886=_[_0xb865('0x31')](_0x38c820,['value',_0x17a66b[_0xb865('0x30')]])[_0xb865('0x32')];return db[_0xb865('0x5d')][_0xb865('0x31')]({'where':{'name':_0x3de886,'userProfileId':_0x2342a1[_0xb865('0x5e')]},'raw':!![]})['then'](function(_0x4f882c){if(_0x4f882c&&_0x4f882c['autoAssociation']===0x0){return db[_0xb865('0x33')][_0xb865('0x52')]({'name':_0x17a66b[_0xb865('0x32')],'resourceId':_0x17a66b['id'],'type':_0x4f882c[_0xb865('0x32')],'sectionId':_0x4f882c['id']},{})[_0xb865('0x27')](function(){return _0x34e6e3;});}else{return _0x34e6e3;}})[_0xb865('0x4e')](function(_0x3524f3){logger['error'](_0xb865('0x5f'),_0x3524f3);throw _0x3524f3;});}return _0x34e6e3;})[_0xb865('0x27')](respondWithResult(_0x3eaac4,0xc9))['catch'](handleError(_0x3eaac4,null));};exports[_0xb865('0x25')]=function(_0x25b352,_0xd6b7ef){if(_0x25b352[_0xb865('0x53')]['id']){delete _0x25b352[_0xb865('0x53')]['id'];}return db[_0xb865('0x38')][_0xb865('0x31')]({'where':{'id':_0x25b352['params']['id']}})[_0xb865('0x27')](handleEntityNotFound(_0xd6b7ef,null))[_0xb865('0x27')](function(_0x20a436){if(_0x20a436){return db['VoiceExtension'][_0xb865('0x25')](_[_0xb865('0x46')](_0x25b352[_0xb865('0x53')],[_0xb865('0x55'),'context',_0xb865('0x60'),_0xb865('0x61'),_0xb865('0x62'),'mandatoryDisposition']),{'where':{'context':_0x20a436['context'],'exten':_0x20a436['exten']},'individualHooks':!![]})[_0xb865('0x27')](function(_0x38dea6){return _0x38dea6;});}return null;})['then'](respondWithStatusCode(_0xd6b7ef,null))['catch'](handleError(_0xd6b7ef,null));};exports[_0xb865('0x63')]=function(_0x1df406,_0x185473,_0x2e10ba){return db[_0xb865('0x38')][_0xb865('0x64')]({'where':{'id':_0x1df406['params']['id']}})[_0xb865('0x27')](handleEntityNotFound(_0x185473,null))['then'](function(_0x589188){if(_0x589188){return db['sequelize'][_0xb865('0x65')](function(_0x22db28){return db[_0xb865('0x38')][_0xb865('0x26')]({'where':{'VoiceExtensionId':_0x1df406['params']['id']},'transaction':_0x22db28})[_0xb865('0x27')](function(_0x29a332){var _0x15cff6=_[_0xb865('0x2d')](_0x1df406[_0xb865('0x53')],function(_0x182c4d){_0x182c4d[_0xb865('0x66')]=_0x1df406[_0xb865('0x50')]['id'];return _0x182c4d;});return db[_0xb865('0x38')][_0xb865('0x67')](_0x15cff6,{'transaction':_0x22db28});});})[_0xb865('0x27')](function(){return db[_0xb865('0x38')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x1df406[_0xb865('0x50')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})['then'](respondWithResult(_0x185473,null))['catch'](handleError(_0x185473,null));}; \ No newline at end of file +var _0xeb38=['exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','mandatoryDisposition','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','send','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','include','findAll','rows','catch','show','params','length','create','body'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xeb38,0x15b));var _0x8eb3=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xeb38[_0x26f702];return _0x11417d;};'use strict';var pdf=require(_0x8eb3('0x0'));var emlformat=require(_0x8eb3('0x1'));var rimraf=require(_0x8eb3('0x2'));var zipdir=require(_0x8eb3('0x3'));var jsonpatch=require(_0x8eb3('0x4'));var rp=require(_0x8eb3('0x5'));var moment=require(_0x8eb3('0x6'));var BPromise=require(_0x8eb3('0x7'));var Mustache=require(_0x8eb3('0x8'));var util=require(_0x8eb3('0x9'));var path=require(_0x8eb3('0xa'));var sox=require(_0x8eb3('0xb'));var csv=require(_0x8eb3('0xc'));var ejs=require(_0x8eb3('0xd'));var fs=require('fs');var _=require(_0x8eb3('0xe'));var squel=require('squel');var crypto=require(_0x8eb3('0xf'));var jsforce=require(_0x8eb3('0x10'));var deskjs=require(_0x8eb3('0x11'));var toCsv=require(_0x8eb3('0xc'));var querystring=require(_0x8eb3('0x12'));var Papa=require(_0x8eb3('0x13'));var Redis=require(_0x8eb3('0x14'));var authService=require(_0x8eb3('0x15'));var qs=require(_0x8eb3('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8eb3('0x17'));var logger=require('../../config/logger')(_0x8eb3('0x18'));var utils=require(_0x8eb3('0x19'));var config=require(_0x8eb3('0x1a'));var db=require(_0x8eb3('0x1b'))['db'];config[_0x8eb3('0x1c')]=_[_0x8eb3('0x1d')](config[_0x8eb3('0x1c')],{'host':_0x8eb3('0x1e'),'port':0x18eb});var socket=require(_0x8eb3('0x1f'))(new Redis(config[_0x8eb3('0x1c')]));require('./voiceExtension.socket')[_0x8eb3('0x20')](socket);function respondWithStatusCode(_0xee19fb,_0x5bf5f7){_0x5bf5f7=_0x5bf5f7||0xcc;return function(_0x35e941){if(_0x35e941){return _0xee19fb[_0x8eb3('0x21')](_0x5bf5f7);}return _0xee19fb['status'](_0x5bf5f7)[_0x8eb3('0x22')]();};}function respondWithResult(_0x27aa4d,_0xdb630e){_0xdb630e=_0xdb630e||0xc8;return function(_0x6140de){if(_0x6140de){return _0x27aa4d[_0x8eb3('0x23')](_0xdb630e)[_0x8eb3('0x24')](_0x6140de);}};}function respondWithFilteredResult(_0x5ed330,_0xa3f853){return function(_0x122c3e){if(_0x122c3e){var _0x5b04af=_0x122c3e[_0x8eb3('0x25')],_0x4f2509=_0xa3f853['offset'],_0x3bbb4c=_0xa3f853[_0x8eb3('0x26')]+_0xa3f853[_0x8eb3('0x27')],_0x54d2c4;if(_0x3bbb4c>=_0x5b04af){_0x3bbb4c=_0x5b04af;_0x54d2c4=0xc8;}else{_0x54d2c4=0xce;}_0x5ed330[_0x8eb3('0x23')](_0x54d2c4);return _0x5ed330[_0x8eb3('0x28')]('Content-Range',_0x4f2509+'-'+_0x3bbb4c+'/'+_0x5b04af)[_0x8eb3('0x24')](_0x122c3e);}return null;};}function patchUpdates(_0xd65370){return function(_0x3c31d5){try{jsonpatch[_0x8eb3('0x29')](_0x3c31d5,_0xd65370,!![]);}catch(_0x3e00e1){return BPromise[_0x8eb3('0x2a')](_0x3e00e1);}return _0x3c31d5[_0x8eb3('0x2b')]();};}function saveUpdates(_0x25a175,_0x31a9d4){return function(_0x27b144){if(_0x27b144){return _0x27b144[_0x8eb3('0x2c')](_0x25a175)[_0x8eb3('0x2d')](function(_0xb8c076){return _0xb8c076;});}return null;};}function removeEntity(_0x30ae7b,_0x1b3273){return function(_0x331be8){if(_0x331be8){return _0x331be8[_0x8eb3('0x2e')]()['then'](function(){var _0x187dbd=_0x331be8[_0x8eb3('0x2f')]({'plain':!![]});var _0x132d49=[{'name':_0x8eb3('0x30'),'value':_0x8eb3('0x31'),'ignore':![]},{'name':_0x8eb3('0x32'),'value':_0x8eb3('0x33'),'ignore':![]},{'name':_0x8eb3('0x34'),'value':_0x8eb3('0x35'),'ignore':![]}];var _0x3acd55=_(_0x132d49)[_0x8eb3('0x36')](_0x8eb3('0x37'))[_0x8eb3('0x38')](_0x8eb3('0x39'))[_0x8eb3('0x39')]();if(_[_0x8eb3('0x3a')](_0x3acd55,_0x187dbd[_0x8eb3('0x3b')])){return;}var _0x178fb6=_[_0x8eb3('0x3c')](_0x132d49,['value',_0x187dbd[_0x8eb3('0x3b')]])[_0x8eb3('0x3d')];return db[_0x8eb3('0x3e')]['destroy']({'where':{'type':_0x178fb6,'resourceId':_0x187dbd['id']}})['then'](function(){return _0x331be8;});})[_0x8eb3('0x2d')](function(){_0x30ae7b['status'](0xcc)[_0x8eb3('0x22')]();});}};}function handleEntityNotFound(_0x425025,_0x228b67){return function(_0x5de70c){if(!_0x5de70c){_0x425025[_0x8eb3('0x21')](0x194);}return _0x5de70c;};}function handleError(_0x10bc88,_0x8e6f83){_0x8e6f83=_0x8e6f83||0x1f4;return function(_0x318ea3){logger[_0x8eb3('0x3f')](_0x318ea3['stack']);if(_0x318ea3[_0x8eb3('0x3d')]){delete _0x318ea3[_0x8eb3('0x3d')];}_0x10bc88[_0x8eb3('0x23')](_0x8e6f83)[_0x8eb3('0x40')](_0x318ea3);};}exports['index']=function(_0x20bcce,_0x44640e){var _0x51a7ac={},_0x2bec21={},_0x40a321={'count':0x0,'rows':[]};var _0x10c721=_['map'](db[_0x8eb3('0x41')][_0x8eb3('0x42')],function(_0x5ef7f0){return{'name':_0x5ef7f0[_0x8eb3('0x43')],'type':_0x5ef7f0[_0x8eb3('0x3b')][_0x8eb3('0x44')]};});_0x2bec21[_0x8eb3('0x45')]=_['map'](_0x10c721,_0x8eb3('0x3d'));_0x2bec21[_0x8eb3('0x46')]=_[_0x8eb3('0x47')](_0x20bcce[_0x8eb3('0x46')]);_0x2bec21['filters']=_[_0x8eb3('0x48')](_0x2bec21['model'],_0x2bec21[_0x8eb3('0x46')]);_0x51a7ac[_0x8eb3('0x49')]=_[_0x8eb3('0x48')](_0x2bec21[_0x8eb3('0x45')],qs[_0x8eb3('0x4a')](_0x20bcce[_0x8eb3('0x46')][_0x8eb3('0x4a')]));_0x51a7ac['attributes']=_0x51a7ac['attributes']['length']?_0x51a7ac[_0x8eb3('0x49')]:_0x2bec21['model'];if(!_0x20bcce['query'][_0x8eb3('0x4b')](_0x8eb3('0x4c'))){_0x51a7ac[_0x8eb3('0x27')]=qs[_0x8eb3('0x27')](_0x20bcce[_0x8eb3('0x46')][_0x8eb3('0x27')]);_0x51a7ac[_0x8eb3('0x26')]=qs[_0x8eb3('0x26')](_0x20bcce[_0x8eb3('0x46')]['offset']);}_0x51a7ac[_0x8eb3('0x4d')]=qs[_0x8eb3('0x4e')](_0x20bcce[_0x8eb3('0x46')][_0x8eb3('0x4e')]);_0x51a7ac[_0x8eb3('0x4f')]=qs[_0x8eb3('0x50')](_[_0x8eb3('0x51')](_0x20bcce[_0x8eb3('0x46')],_0x2bec21[_0x8eb3('0x50')]));if(_0x20bcce[_0x8eb3('0x46')][_0x8eb3('0x36')]){_0x51a7ac[_0x8eb3('0x4f')]=_[_0x8eb3('0x52')](_0x51a7ac[_0x8eb3('0x4f')],{'$or':_[_0x8eb3('0x38')](_0x10c721,function(_0x4ded9b){if(_0x4ded9b[_0x8eb3('0x3b')]!=='VIRTUAL'){var _0x4a27d3={};_0x4a27d3[_0x4ded9b[_0x8eb3('0x3d')]]={'$like':'%'+_0x20bcce[_0x8eb3('0x46')][_0x8eb3('0x36')]+'%'};return _0x4a27d3;}})});}_0x51a7ac=_[_0x8eb3('0x52')]({},_0x51a7ac,_0x20bcce[_0x8eb3('0x53')]);var _0x46e509={'where':_0x51a7ac[_0x8eb3('0x4f')]};return db['VoiceExtension'][_0x8eb3('0x25')](_0x46e509)['then'](function(_0x1203bc){_0x40a321[_0x8eb3('0x25')]=_0x1203bc;if(_0x20bcce[_0x8eb3('0x46')]['includeAll']){_0x51a7ac[_0x8eb3('0x54')]=[{'all':!![]}];}return db[_0x8eb3('0x41')][_0x8eb3('0x55')](_0x51a7ac);})['then'](function(_0xe41392){_0x40a321[_0x8eb3('0x56')]=_0xe41392;return _0x40a321;})[_0x8eb3('0x2d')](respondWithFilteredResult(_0x44640e,_0x51a7ac))[_0x8eb3('0x57')](handleError(_0x44640e,null));};exports[_0x8eb3('0x58')]=function(_0x1a4ec7,_0x3aba57){var _0x428fa6={'raw':![],'where':{'id':_0x1a4ec7[_0x8eb3('0x59')]['id']}},_0x412597={};_0x412597[_0x8eb3('0x45')]=_[_0x8eb3('0x47')](db['VoiceExtension'][_0x8eb3('0x42')]);_0x412597[_0x8eb3('0x46')]=_['keys'](_0x1a4ec7[_0x8eb3('0x46')]);_0x412597[_0x8eb3('0x50')]=_['intersection'](_0x412597[_0x8eb3('0x45')],_0x412597['query']);_0x428fa6[_0x8eb3('0x49')]=_['intersection'](_0x412597[_0x8eb3('0x45')],qs[_0x8eb3('0x4a')](_0x1a4ec7[_0x8eb3('0x46')][_0x8eb3('0x4a')]));_0x428fa6[_0x8eb3('0x49')]=_0x428fa6[_0x8eb3('0x49')][_0x8eb3('0x5a')]?_0x428fa6['attributes']:_0x412597[_0x8eb3('0x45')];if(_0x1a4ec7[_0x8eb3('0x46')]['includeAll']){_0x428fa6[_0x8eb3('0x54')]=[{'all':!![]}];}_0x428fa6=_[_0x8eb3('0x52')]({},_0x428fa6,_0x1a4ec7['options']);return db[_0x8eb3('0x41')][_0x8eb3('0x3c')](_0x428fa6)[_0x8eb3('0x2d')](handleEntityNotFound(_0x3aba57,null))[_0x8eb3('0x2d')](respondWithResult(_0x3aba57,null))['catch'](handleError(_0x3aba57,null));};exports[_0x8eb3('0x2e')]=function(_0x5cad0b,_0x102001){return db['VoiceExtension'][_0x8eb3('0x3c')]({'where':{'id':_0x5cad0b[_0x8eb3('0x59')]['id']}})['then'](handleEntityNotFound(_0x102001,null))[_0x8eb3('0x2d')](removeEntity(_0x102001,null))[_0x8eb3('0x57')](handleError(_0x102001,null));};exports[_0x8eb3('0x5b')]=function(_0x48565a,_0x1d5a23){if(_0x48565a[_0x8eb3('0x5c')][_0x8eb3('0x3b')]===_0x8eb3('0x33')&&!_['startsWith'](_0x48565a[_0x8eb3('0x5c')][_0x8eb3('0x5d')],'_')){_0x48565a[_0x8eb3('0x5c')][_0x8eb3('0x5d')]='_'[_0x8eb3('0x5e')](_0x48565a[_0x8eb3('0x5c')][_0x8eb3('0x5d')]);}return db[_0x8eb3('0x41')]['create'](_0x48565a[_0x8eb3('0x5c')],{'raw':![]})[_0x8eb3('0x2d')](function(_0x2967db){var _0x1d125d=_0x48565a[_0x8eb3('0x5f')][_0x8eb3('0x2f')]({'plain':!![]});if(!_0x1d125d)throw new Error(_0x8eb3('0x60'));if(_0x1d125d[_0x8eb3('0x61')]===_0x8eb3('0x5f')){var _0x1022f7=_0x2967db[_0x8eb3('0x2f')]({'plain':!![]});var _0x491e02=[{'name':'InboundRoutes','value':_0x8eb3('0x31')},{'name':'OutboundRoutes','value':_0x8eb3('0x33')},{'name':_0x8eb3('0x34'),'value':_0x8eb3('0x35')}];var _0x38110d=_['find'](_0x491e02,[_0x8eb3('0x39'),_0x1022f7['type']])[_0x8eb3('0x3d')];return db['UserProfileSection'][_0x8eb3('0x3c')]({'where':{'name':_0x38110d,'userProfileId':_0x1d125d[_0x8eb3('0x62')]},'raw':!![]})[_0x8eb3('0x2d')](function(_0x38aa94){if(_0x38aa94&&_0x38aa94[_0x8eb3('0x63')]===0x0){return db['UserProfileResource'][_0x8eb3('0x5b')]({'name':_0x1022f7[_0x8eb3('0x3d')],'resourceId':_0x1022f7['id'],'type':_0x38aa94[_0x8eb3('0x3d')],'sectionId':_0x38aa94['id']},{})[_0x8eb3('0x2d')](function(){return _0x2967db;});}else{return _0x2967db;}})[_0x8eb3('0x57')](function(_0xc665ce){logger[_0x8eb3('0x3f')](_0x8eb3('0x64'),_0xc665ce);throw _0xc665ce;});}return _0x2967db;})['then'](respondWithResult(_0x1d5a23,0xc9))[_0x8eb3('0x57')](handleError(_0x1d5a23,null));};exports['update']=function(_0xa0b4f6,_0x368f05){if(_0xa0b4f6['body']['id']){delete _0xa0b4f6[_0x8eb3('0x5c')]['id'];}return db[_0x8eb3('0x41')][_0x8eb3('0x3c')]({'where':{'id':_0xa0b4f6[_0x8eb3('0x59')]['id']}})[_0x8eb3('0x2d')](handleEntityNotFound(_0x368f05,null))['then'](function(_0x4b8351){if(_0x4b8351){return db[_0x8eb3('0x41')][_0x8eb3('0x2c')](_[_0x8eb3('0x51')](_0xa0b4f6[_0x8eb3('0x5c')],[_0x8eb3('0x5d'),_0x8eb3('0x65'),_0x8eb3('0x66'),_0x8eb3('0x67'),'cutdigits',_0x8eb3('0x68')]),{'where':{'context':_0x4b8351[_0x8eb3('0x65')],'exten':_0x4b8351[_0x8eb3('0x5d')]},'individualHooks':!![]})[_0x8eb3('0x2d')](function(_0x1a7f5a){return _0x1a7f5a;});}return null;})[_0x8eb3('0x2d')](respondWithStatusCode(_0x368f05,null))['catch'](handleError(_0x368f05,null));};exports['addApplications']=function(_0x279707,_0x404d8f,_0xc9b43b){return db[_0x8eb3('0x41')]['findOne']({'where':{'id':_0x279707['params']['id']}})['then'](handleEntityNotFound(_0x404d8f,null))[_0x8eb3('0x2d')](function(_0x5e4db5){if(_0x5e4db5){return db[_0x8eb3('0x69')][_0x8eb3('0x6a')](function(_0x34ba04){return db[_0x8eb3('0x41')]['destroy']({'where':{'VoiceExtensionId':_0x279707[_0x8eb3('0x59')]['id']},'transaction':_0x34ba04})[_0x8eb3('0x2d')](function(_0x2917e5){var _0x4679d1=_['map'](_0x279707[_0x8eb3('0x5c')],function(_0x15b7a2){_0x15b7a2[_0x8eb3('0x6b')]=_0x279707['params']['id'];return _0x15b7a2;});return db[_0x8eb3('0x41')][_0x8eb3('0x6c')](_0x4679d1,{'transaction':_0x34ba04});});})[_0x8eb3('0x2d')](function(){return db[_0x8eb3('0x41')][_0x8eb3('0x6d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x279707[_0x8eb3('0x59')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})['then'](respondWithResult(_0x404d8f,null))['catch'](handleError(_0x404d8f,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 535aae7..3d9d30b 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 _0x5a2a=['remove','emit','hasOwnProperty','exports','VoiceExtension','setMaxListeners','save'];(function(_0x44e318,_0x4184b1){var _0x30e1c9=function(_0x208990){while(--_0x208990){_0x44e318['push'](_0x44e318['shift']());}};_0x30e1c9(++_0x4184b1);}(_0x5a2a,0x138));var _0xa5a2=function(_0x3e635b,_0x3dec45){_0x3e635b=_0x3e635b-0x0;var _0x47384e=_0x5a2a[_0x3e635b];return _0x47384e;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0xa5a2('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xa5a2('0x1')](0x0);var events={'afterCreate':_0xa5a2('0x2'),'afterUpdate':'update','afterDestroy':_0xa5a2('0x3')};function emitEvent(_0x136acf){return function(_0x5a04cf,_0x2ae3d9,_0x3ece87){VoiceExtensionEvents['emit'](_0x136acf+':'+_0x5a04cf['id'],_0x5a04cf);VoiceExtensionEvents[_0xa5a2('0x4')](_0x136acf,_0x5a04cf);_0x3ece87(null);};}for(var e in events){if(events[_0xa5a2('0x5')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xa5a2('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0x8079=['emit','events','../../mysqldb','VoiceExtension','setMaxListeners','update','remove'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x8079,0x1e4));var _0x9807=function(_0x55677b,_0x3e5655){_0x55677b=_0x55677b-0x0;var _0x104b88=_0x8079[_0x55677b];return _0x104b88;};'use strict';var EventEmitter=require(_0x9807('0x0'));var VoiceExtension=require(_0x9807('0x1'))['db'][_0x9807('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x9807('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9807('0x4'),'afterDestroy':_0x9807('0x5')};function emitEvent(_0x44637a){return function(_0x388292,_0x3f405d,_0x1ddd20){VoiceExtensionEvents[_0x9807('0x6')](_0x44637a+':'+_0x388292['id'],_0x388292);VoiceExtensionEvents[_0x9807('0x6')](_0x44637a,_0x388292);_0x1ddd20(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 6ea003b..7588a04 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 _0xf8e4=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceExtension.attributes','exports','define','VoiceExtension','voice_extensions','lodash'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf8e4,0xc2));var _0x4f8e=function(_0x28edda,_0xbd447a){_0x28edda=_0x28edda-0x0;var _0x21f4a4=_0xf8e4[_0x28edda];return _0x21f4a4;};'use strict';var _=require(_0x4f8e('0x0'));var util=require('util');var logger=require(_0x4f8e('0x1'))(_0x4f8e('0x2'));var moment=require(_0x4f8e('0x3'));var BPromise=require(_0x4f8e('0x4'));var rp=require(_0x4f8e('0x5'));var fs=require('fs');var path=require(_0x4f8e('0x6'));var rimraf=require(_0x4f8e('0x7'));var config=require('../../config/environment');var attributes=require(_0x4f8e('0x8'));module[_0x4f8e('0x9')]=function(_0x50b98d,_0x2ff3b5){return _0x50b98d[_0x4f8e('0xa')](_0x4f8e('0xb'),attributes,{'tableName':_0x4f8e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x959b=['exports','VoiceExtension','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x959b,0xf2));var _0xb959=function(_0x3a57b3,_0xcc3894){_0x3a57b3=_0x3a57b3-0x0;var _0x19888b=_0x959b[_0x3a57b3];return _0x19888b;};'use strict';var _=require(_0xb959('0x0'));var util=require(_0xb959('0x1'));var logger=require(_0xb959('0x2'))(_0xb959('0x3'));var moment=require(_0xb959('0x4'));var BPromise=require(_0xb959('0x5'));var rp=require(_0xb959('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb959('0x7'));var config=require('../../config/environment');var attributes=require('./voiceExtension.attributes');module[_0xb959('0x8')]=function(_0x30088,_0x121c27){return _0x30088['define'](_0xb959('0x9'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index f1d5b78..afba8d3 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 _0x7031=['VoiceExtension','findAll','options','raw','where','limit','include','map','model','attributes','GetVoiceExtension','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x5d1044,_0x18f656){var _0x3cd90e=function(_0x3c40be){while(--_0x3c40be){_0x5d1044['push'](_0x5d1044['shift']());}};_0x3cd90e(++_0x18f656);}(_0x7031,0x12b));var _0x1703=function(_0x542cb1,_0xf79f5d){_0x542cb1=_0x542cb1-0x0;var _0x51efcb=_0x7031[_0x542cb1];return _0x51efcb;};'use strict';var _=require(_0x1703('0x0'));var util=require('util');var moment=require(_0x1703('0x1'));var BPromise=require(_0x1703('0x2'));var rs=require(_0x1703('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1703('0x4'))['db'];var utils=require(_0x1703('0x5'));var logger=require(_0x1703('0x6'))(_0x1703('0x7'));var config=require('../../config/environment');var jayson=require(_0x1703('0x8'));var client=jayson[_0x1703('0x9')][_0x1703('0xa')]({'port':0x232a});config[_0x1703('0xb')]=_[_0x1703('0xc')](config['redis'],{'host':_0x1703('0xd'),'port':0x18eb});var socket=require(_0x1703('0xe'))(new Redis(config['redis']));require(_0x1703('0xf'))[_0x1703('0x10')](socket);function respondWithRpcPromise(_0x138b2f,_0x27e41f,_0x4b9d9a){return new BPromise(function(_0x919ff,_0x1ca506){return client[_0x1703('0x11')](_0x138b2f,_0x4b9d9a)[_0x1703('0x12')](function(_0x2f40b1){logger['info'](_0x1703('0x13'),_0x27e41f,_0x1703('0x14'));logger[_0x1703('0x15')](_0x1703('0x16'),_0x27e41f,_0x1703('0x14'),JSON[_0x1703('0x17')](_0x2f40b1));if(_0x2f40b1['error']){if(_0x2f40b1[_0x1703('0x18')][_0x1703('0x19')]===0x1f4){logger[_0x1703('0x18')](_0x1703('0x13'),_0x27e41f,_0x2f40b1[_0x1703('0x18')]['message']);return _0x1ca506(_0x2f40b1['error']['message']);}logger[_0x1703('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x27e41f,_0x2f40b1[_0x1703('0x18')][_0x1703('0x1a')]);return _0x919ff(_0x2f40b1[_0x1703('0x18')]['message']);}else{logger[_0x1703('0x1b')](_0x1703('0x13'),_0x27e41f,_0x1703('0x14'));_0x919ff(_0x2f40b1[_0x1703('0x1c')][_0x1703('0x1a')]);}})['catch'](function(_0x37bb9d){logger[_0x1703('0x18')](_0x1703('0x13'),_0x27e41f,_0x37bb9d);_0x1ca506(_0x37bb9d);});});}exports['GetVoiceExtension']=function(_0x582a6b){var _0x54832a=this;return new Promise(function(_0x21c2a5,_0x455189){return db[_0x1703('0x1d')][_0x1703('0x1e')]({'raw':_0x582a6b[_0x1703('0x1f')]?_0x582a6b['options'][_0x1703('0x20')]===undefined?!![]:![]:!![],'where':_0x582a6b[_0x1703('0x1f')]?_0x582a6b[_0x1703('0x1f')][_0x1703('0x21')]||null:null,'attributes':_0x582a6b[_0x1703('0x1f')]?_0x582a6b[_0x1703('0x1f')]['attributes']||null:null,'limit':_0x582a6b[_0x1703('0x1f')]?_0x582a6b['options'][_0x1703('0x22')]||null:null,'include':_0x582a6b[_0x1703('0x1f')]?_0x582a6b[_0x1703('0x1f')][_0x1703('0x23')]?_[_0x1703('0x24')](_0x582a6b[_0x1703('0x1f')][_0x1703('0x23')],function(_0x42b65b){return{'model':db[_0x42b65b['model']],'as':_0x42b65b['as'],'attributes':_0x42b65b['attributes'],'include':_0x42b65b[_0x1703('0x23')]?_[_0x1703('0x24')](_0x42b65b['include'],function(_0x4702d2){return{'model':db[_0x4702d2[_0x1703('0x25')]],'as':_0x4702d2['as'],'attributes':_0x4702d2['attributes'],'include':_0x4702d2['include']?_['map'](_0x4702d2[_0x1703('0x23')],function(_0x26a020){return{'model':db[_0x26a020[_0x1703('0x25')]],'as':_0x26a020['as'],'attributes':_0x26a020[_0x1703('0x26')]};}):[]};}):[]};}):[]:[]})[_0x1703('0x12')](function(_0x21a608){logger['info'](_0x1703('0x27'),_0x582a6b);logger[_0x1703('0x15')](_0x1703('0x27'),_0x582a6b,JSON[_0x1703('0x17')](_0x21a608));_0x21c2a5(_0x21a608);})[_0x1703('0x28')](function(_0x47195f){logger['error'](_0x1703('0x27'),_0x47195f[_0x1703('0x1a')],_0x582a6b);_0x455189(_0x54832a[_0x1703('0x18')](0x1f4,_0x47195f['message']));});});}; \ No newline at end of file +var _0xc684=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','include','map','model','catch','lodash','util'];(function(_0x18394a,_0x1c7835){var _0x485d8e=function(_0x3665e3){while(--_0x3665e3){_0x18394a['push'](_0x18394a['shift']());}};_0x485d8e(++_0x1c7835);}(_0xc684,0x10f));var _0x4c68=function(_0x33a260,_0x587075){_0x33a260=_0x33a260-0x0;var _0x1600c8=_0xc684[_0x33a260];return _0x1600c8;};'use strict';var _=require(_0x4c68('0x0'));var util=require(_0x4c68('0x1'));var moment=require(_0x4c68('0x2'));var BPromise=require('bluebird');var rs=require(_0x4c68('0x3'));var fs=require('fs');var Redis=require(_0x4c68('0x4'));var db=require(_0x4c68('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c68('0x6'))(_0x4c68('0x7'));var config=require('../../config/environment');var jayson=require(_0x4c68('0x8'));var client=jayson[_0x4c68('0x9')][_0x4c68('0xa')]({'port':0x232a});config[_0x4c68('0xb')]=_[_0x4c68('0xc')](config[_0x4c68('0xb')],{'host':_0x4c68('0xd'),'port':0x18eb});var socket=require(_0x4c68('0xe'))(new Redis(config['redis']));require(_0x4c68('0xf'))[_0x4c68('0x10')](socket);function respondWithRpcPromise(_0x1f3b6d,_0x243a8a,_0x5293e9){return new BPromise(function(_0x1ef439,_0x30659f){return client[_0x4c68('0x11')](_0x1f3b6d,_0x5293e9)[_0x4c68('0x12')](function(_0x190570){logger[_0x4c68('0x13')](_0x4c68('0x14'),_0x243a8a,'request\x20sent');logger[_0x4c68('0x15')](_0x4c68('0x16'),_0x243a8a,_0x4c68('0x17'),JSON[_0x4c68('0x18')](_0x190570));if(_0x190570[_0x4c68('0x19')]){if(_0x190570[_0x4c68('0x19')][_0x4c68('0x1a')]===0x1f4){logger[_0x4c68('0x19')]('VoiceExtension,\x20%s,\x20%s',_0x243a8a,_0x190570[_0x4c68('0x19')][_0x4c68('0x1b')]);return _0x30659f(_0x190570[_0x4c68('0x19')][_0x4c68('0x1b')]);}logger[_0x4c68('0x19')](_0x4c68('0x14'),_0x243a8a,_0x190570['error']['message']);return _0x1ef439(_0x190570['error'][_0x4c68('0x1b')]);}else{logger['info'](_0x4c68('0x14'),_0x243a8a,_0x4c68('0x17'));_0x1ef439(_0x190570['result'][_0x4c68('0x1b')]);}})['catch'](function(_0x3a4efa){logger[_0x4c68('0x19')](_0x4c68('0x14'),_0x243a8a,_0x3a4efa);_0x30659f(_0x3a4efa);});});}exports[_0x4c68('0x1c')]=function(_0x4bb788){var _0x5895f3=this;return new Promise(function(_0x5d0861,_0x249cd8){return db[_0x4c68('0x1d')][_0x4c68('0x1e')]({'raw':_0x4bb788['options']?_0x4bb788[_0x4c68('0x1f')][_0x4c68('0x20')]===undefined?!![]:![]:!![],'where':_0x4bb788[_0x4c68('0x1f')]?_0x4bb788[_0x4c68('0x1f')][_0x4c68('0x21')]||null:null,'attributes':_0x4bb788[_0x4c68('0x1f')]?_0x4bb788[_0x4c68('0x1f')][_0x4c68('0x22')]||null:null,'limit':_0x4bb788[_0x4c68('0x1f')]?_0x4bb788[_0x4c68('0x1f')]['limit']||null:null,'include':_0x4bb788[_0x4c68('0x1f')]?_0x4bb788['options'][_0x4c68('0x23')]?_[_0x4c68('0x24')](_0x4bb788[_0x4c68('0x1f')]['include'],function(_0x568530){return{'model':db[_0x568530[_0x4c68('0x25')]],'as':_0x568530['as'],'attributes':_0x568530[_0x4c68('0x22')],'include':_0x568530['include']?_[_0x4c68('0x24')](_0x568530[_0x4c68('0x23')],function(_0x13ce22){return{'model':db[_0x13ce22['model']],'as':_0x13ce22['as'],'attributes':_0x13ce22[_0x4c68('0x22')],'include':_0x13ce22['include']?_[_0x4c68('0x24')](_0x13ce22[_0x4c68('0x23')],function(_0x4c3d74){return{'model':db[_0x4c3d74[_0x4c68('0x25')]],'as':_0x4c3d74['as'],'attributes':_0x4c3d74[_0x4c68('0x22')]};}):[]};}):[]};}):[]:[]})[_0x4c68('0x12')](function(_0x5a6ca1){logger[_0x4c68('0x13')](_0x4c68('0x1c'),_0x4bb788);logger[_0x4c68('0x15')](_0x4c68('0x1c'),_0x4bb788,JSON[_0x4c68('0x18')](_0x5a6ca1));_0x5d0861(_0x5a6ca1);})[_0x4c68('0x26')](function(_0x318fcf){logger[_0x4c68('0x19')](_0x4c68('0x1c'),_0x318fcf[_0x4c68('0x1b')],_0x4bb788);_0x249cd8(_0x5895f3[_0x4c68('0x19')](0x1f4,_0x318fcf[_0x4c68('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index f72abca..3543ecf 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 _0x61a6=['remove','update','emit','removeListener','voiceExtension:','save'];(function(_0x565b35,_0x1f11a8){var _0x2aa852=function(_0x44ad53){while(--_0x44ad53){_0x565b35['push'](_0x565b35['shift']());}};_0x2aa852(++_0x1f11a8);}(_0x61a6,0x137));var _0x661a=function(_0x3f88ba,_0x1cc8f2){_0x3f88ba=_0x3f88ba-0x0;var _0xd26dc4=_0x61a6[_0x3f88ba];return _0xd26dc4;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x661a('0x0'),_0x661a('0x1'),_0x661a('0x2')];function createListener(_0x5d3b6e,_0x8b61d6){return function(_0xdd0477){_0x8b61d6[_0x661a('0x3')](_0x5d3b6e,_0xdd0477);};}function removeListener(_0x112448,_0x1613ca){return function(){VoiceExtensionEvents[_0x661a('0x4')](_0x112448,_0x1613ca);};}exports['register']=function(_0xf07e57){for(var _0x438b02=0x0,_0x31a648=events['length'];_0x438b02<_0x31a648;_0x438b02++){var _0x220ba4=events[_0x438b02];var _0x3cd9bc=createListener(_0x661a('0x5')+_0x220ba4,_0xf07e57);VoiceExtensionEvents['on'](_0x220ba4,_0x3cd9bc);}}; \ No newline at end of file +var _0x6414=['removeListener','register','length','voiceExtension:','remove','update'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6414,0x88));var _0x4641=function(_0x4ebc08,_0x21e495){_0x4ebc08=_0x4ebc08-0x0;var _0x1066a1=_0x6414[_0x4ebc08];return _0x1066a1;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=['save',_0x4641('0x0'),_0x4641('0x1')];function createListener(_0x40c81f,_0xb6da45){return function(_0x5adbb4){_0xb6da45['emit'](_0x40c81f,_0x5adbb4);};}function removeListener(_0x3d8f6d,_0x4f9d00){return function(){VoiceExtensionEvents[_0x4641('0x2')](_0x3d8f6d,_0x4f9d00);};}exports[_0x4641('0x3')]=function(_0x457406){for(var _0x5cbf6b=0x0,_0x49445d=events[_0x4641('0x4')];_0x5cbf6b<_0x49445d;_0x5cbf6b++){var _0x14ed10=events[_0x5cbf6b];var _0x574bd5=createListener(_0x4641('0x5')+_0x14ed10,_0x457406);VoiceExtensionEvents['on'](_0x14ed10,_0x574bd5);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 5b187d4..e84f8ba 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 _0xd728=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/messages','getMessages','post'];(function(_0x582b7e,_0x2a244a){var _0x1252ea=function(_0x46bd76){while(--_0x46bd76){_0x582b7e['push'](_0x582b7e['shift']());}};_0x1252ea(++_0x2a244a);}(_0xd728,0x1e8));var _0x8d72=function(_0x91441a,_0xad2af6){_0x91441a=_0x91441a-0x0;var _0x5e25fc=_0xd728[_0x91441a];return _0x5e25fc;};'use strict';var multer=require(_0x8d72('0x0'));var util=require(_0x8d72('0x1'));var path=require(_0x8d72('0x2'));var timeout=require(_0x8d72('0x3'));var express=require(_0x8d72('0x4'));var router=express[_0x8d72('0x5')]();var auth=require(_0x8d72('0x6'));var interaction=require(_0x8d72('0x7'));var config=require(_0x8d72('0x8'));var controller=require('./voiceMail.controller');router['get']('/',auth[_0x8d72('0x9')](),controller[_0x8d72('0xa')]);router[_0x8d72('0xb')](_0x8d72('0xc'),auth[_0x8d72('0x9')](),controller['show']);router[_0x8d72('0xb')](_0x8d72('0xd'),auth[_0x8d72('0x9')](),controller[_0x8d72('0xe')]);router[_0x8d72('0xf')]('/',auth[_0x8d72('0x9')](),controller[_0x8d72('0x10')]);router['put']('/:id',auth[_0x8d72('0x9')](),controller[_0x8d72('0x11')]);router[_0x8d72('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x8d72('0x13')]);module[_0x8d72('0x14')]=router; \ No newline at end of file +var _0xbc79=['../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','show','get','/:id/messages','getMessages','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x45228c,_0x3dfc24){var _0x3d6e61=function(_0x2d6998){while(--_0x2d6998){_0x45228c['push'](_0x45228c['shift']());}};_0x3d6e61(++_0x3dfc24);}(_0xbc79,0x1b3));var _0x9bc7=function(_0x598f8e,_0x36fe8f){_0x598f8e=_0x598f8e-0x0;var _0x7a60b4=_0xbc79[_0x598f8e];return _0x7a60b4;};'use strict';var multer=require(_0x9bc7('0x0'));var util=require(_0x9bc7('0x1'));var path=require(_0x9bc7('0x2'));var timeout=require(_0x9bc7('0x3'));var express=require(_0x9bc7('0x4'));var router=express[_0x9bc7('0x5')]();var auth=require(_0x9bc7('0x6'));var interaction=require(_0x9bc7('0x7'));var config=require(_0x9bc7('0x8'));var controller=require('./voiceMail.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x9bc7('0x9')]);router['get'](_0x9bc7('0xa'),auth[_0x9bc7('0xb')](),controller[_0x9bc7('0xc')]);router[_0x9bc7('0xd')](_0x9bc7('0xe'),auth[_0x9bc7('0xb')](),controller[_0x9bc7('0xf')]);router[_0x9bc7('0x10')]('/',auth[_0x9bc7('0xb')](),controller[_0x9bc7('0x11')]);router[_0x9bc7('0x12')](_0x9bc7('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x9bc7('0x13')](_0x9bc7('0xa'),auth['isAuthenticated'](),controller[_0x9bc7('0x14')]);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 330a524..3f22f80 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 _0x7916=['\x20-\x20','mailbox','sequelize','STRING','contest_mailbox','setDataValue','email','trim','ENUM','yes','TINYINT(4)','INTEGER','getDataValue','fullname'];(function(_0x44031a,_0x729666){var _0x229199=function(_0x366412){while(--_0x366412){_0x44031a['push'](_0x44031a['shift']());}};_0x229199(++_0x729666);}(_0x7916,0x128));var _0x6791=function(_0x17a74f,_0x5be372){_0x17a74f=_0x17a74f-0x0;var _0x21a545=_0x7916[_0x17a74f];return _0x21a545;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x6791('0x1')]},'context':{'type':Sequelize[_0x6791('0x1')],'defaultValue':'from-voicemail','unique':_0x6791('0x2')},'mailbox':{'type':Sequelize[_0x6791('0x1')],'defaultValue':'','allowNull':![],'unique':_0x6791('0x2')},'password':{'type':Sequelize[_0x6791('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x6791('0x1')],'validate':{'isEmail':!![]},'set':function(_0x5a5726){this[_0x6791('0x3')](_0x6791('0x4'),typeof _0x5a5726==='string'&&_0x5a5726[_0x6791('0x5')]()?_0x5a5726['trim']():null);}},'pager':{'type':Sequelize[_0x6791('0x1')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0x6791('0x6')](_0x6791('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x6791('0x6')](_0x6791('0x7'),'no'),'defaultValue':_0x6791('0x7'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x6791('0x1')]},'review':{'type':Sequelize[_0x6791('0x6')](_0x6791('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x6791('0x6')](_0x6791('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x6791('0x6')](_0x6791('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x6791('0x6')](_0x6791('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x6791('0x8'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x6791('0x6')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x6791('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x6791('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x6791('0x6')](_0x6791('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x6791('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x6791('0x7'),'no'),'defaultValue':_0x6791('0x7'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x6791('0x1')]},'emailbody':{'type':Sequelize[_0x6791('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x6791('0x9')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x6791('0xa')](_0x6791('0xb'))+_0x6791('0xc')+this[_0x6791('0xa')](_0x6791('0xd'));}}}; \ No newline at end of file +var _0x6324=['ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','mailbox','sequelize','exports','STRING','contest_mailbox','setDataValue','email','string','trim'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x6324,0x142));var _0x4632=function(_0x5857a7,_0x3f8601){_0x5857a7=_0x5857a7-0x0;var _0x2c35e4=_0x6324[_0x5857a7];return _0x2c35e4;};'use strict';var Sequelize=require(_0x4632('0x0'));module[_0x4632('0x1')]={'customer_id':{'type':Sequelize[_0x4632('0x2')]},'context':{'type':Sequelize[_0x4632('0x2')],'defaultValue':'from-voicemail','unique':_0x4632('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x4632('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x4632('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x140bc7){this[_0x4632('0x4')](_0x4632('0x5'),typeof _0x140bc7===_0x4632('0x6')&&_0x140bc7['trim']()?_0x140bc7[_0x4632('0x7')]():null);}},'pager':{'type':Sequelize[_0x4632('0x2')]},'tz':{'type':Sequelize[_0x4632('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x4632('0x8')](_0x4632('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x4632('0x9'),'no'),'defaultValue':_0x4632('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x4632('0x2')]},'callback':{'type':Sequelize[_0x4632('0x2')]},'review':{'type':Sequelize[_0x4632('0x8')](_0x4632('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x4632('0x8')](_0x4632('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x4632('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x4632('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x4632('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x4632('0x8')](_0x4632('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x4632('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x4632('0x8')](_0x4632('0x9'),'no'),'defaultValue':_0x4632('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x4632('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x4632('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x4632('0x8')](_0x4632('0x9'),'no'),'defaultValue':_0x4632('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x4632('0x2')]},'emailbody':{'type':Sequelize[_0x4632('0x2')]},'maxsecs':{'type':Sequelize[_0x4632('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x4632('0xc')],'get':function(){return this[_0x4632('0xd')]('fullname')+'\x20-\x20'+this[_0x4632('0xd')](_0x4632('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index da91127..6dae49a 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 _0x89e8=['map','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','VoiceMail','include','findAll','show','params','catch','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','mailbox','VoiceMailMessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','then','get','Voicemails','UserProfileResource','destroy','end','error','stack','index','rawAttributes','fieldName','type'];(function(_0x4dd369,_0x437834){var _0x2ff923=function(_0x442826){while(--_0x442826){_0x4dd369['push'](_0x4dd369['shift']());}};_0x2ff923(++_0x437834);}(_0x89e8,0x74));var _0x889e=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x89e8[_0x618414];return _0x21c19a;};'use strict';var pdf=require(_0x889e('0x0'));var emlformat=require(_0x889e('0x1'));var rimraf=require(_0x889e('0x2'));var zipdir=require(_0x889e('0x3'));var jsonpatch=require(_0x889e('0x4'));var rp=require(_0x889e('0x5'));var moment=require(_0x889e('0x6'));var BPromise=require(_0x889e('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x889e('0x8'));var csv=require(_0x889e('0x9'));var ejs=require(_0x889e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x889e('0xb'));var crypto=require('crypto');var jsforce=require(_0x889e('0xc'));var deskjs=require(_0x889e('0xd'));var toCsv=require(_0x889e('0x9'));var querystring=require('querystring');var Papa=require(_0x889e('0xe'));var Redis=require(_0x889e('0xf'));var authService=require(_0x889e('0x10'));var qs=require(_0x889e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x889e('0x12'));var logger=require(_0x889e('0x13'))('api');var utils=require(_0x889e('0x14'));var config=require(_0x889e('0x15'));var db=require(_0x889e('0x16'))['db'];function respondWithStatusCode(_0x272b97,_0x55508d){_0x55508d=_0x55508d||0xcc;return function(_0x3e20e3){if(_0x3e20e3){return _0x272b97[_0x889e('0x17')](_0x55508d);}return _0x272b97[_0x889e('0x18')](_0x55508d)['end']();};}function respondWithResult(_0x5692f2,_0x3617f0){_0x3617f0=_0x3617f0||0xc8;return function(_0x2b69db){if(_0x2b69db){return _0x5692f2[_0x889e('0x18')](_0x3617f0)[_0x889e('0x19')](_0x2b69db);}};}function respondWithFilteredResult(_0x50cd13,_0x4ab3f4){return function(_0x300ce7){if(_0x300ce7){var _0x15cf93=_0x300ce7[_0x889e('0x1a')],_0x335f98=_0x4ab3f4[_0x889e('0x1b')],_0x2de143=_0x4ab3f4['offset']+_0x4ab3f4[_0x889e('0x1c')],_0x50808f;if(_0x2de143>=_0x15cf93){_0x2de143=_0x15cf93;_0x50808f=0xc8;}else{_0x50808f=0xce;}_0x50cd13['status'](_0x50808f);return _0x50cd13[_0x889e('0x1d')](_0x889e('0x1e'),_0x335f98+'-'+_0x2de143+'/'+_0x15cf93)[_0x889e('0x19')](_0x300ce7);}return null;};}function patchUpdates(_0x1bd9ef){return function(_0x24c245){try{jsonpatch['apply'](_0x24c245,_0x1bd9ef,!![]);}catch(_0xa1b610){return BPromise[_0x889e('0x1f')](_0xa1b610);}return _0x24c245['save']();};}function saveUpdates(_0x3c8889,_0x11abba){return function(_0x1db0db){if(_0x1db0db){return _0x1db0db['update'](_0x3c8889)[_0x889e('0x20')](function(_0x2ff8ae){return _0x2ff8ae;});}return null;};}function removeEntity(_0x111733,_0xb52284){return function(_0x590b6f){if(_0x590b6f){return _0x590b6f['destroy']()[_0x889e('0x20')](function(){var _0x274f9b=_0x590b6f[_0x889e('0x21')]({'plain':!![]});var _0x4bb8e1=_0x889e('0x22');return db[_0x889e('0x23')][_0x889e('0x24')]({'where':{'type':_0x4bb8e1,'resourceId':_0x274f9b['id']}})['then'](function(){return _0x590b6f;});})[_0x889e('0x20')](function(){_0x111733['status'](0xcc)[_0x889e('0x25')]();});}};}function handleEntityNotFound(_0x331665,_0x2fc97a){return function(_0x4d0492){if(!_0x4d0492){_0x331665[_0x889e('0x17')](0x194);}return _0x4d0492;};}function handleError(_0x5aa515,_0x34db77){_0x34db77=_0x34db77||0x1f4;return function(_0x2fb8d9){logger[_0x889e('0x26')](_0x2fb8d9[_0x889e('0x27')]);if(_0x2fb8d9['name']){delete _0x2fb8d9['name'];}_0x5aa515[_0x889e('0x18')](_0x34db77)['send'](_0x2fb8d9);};}exports[_0x889e('0x28')]=function(_0x343c01,_0x3b3aad){var _0x9e8192={},_0x2553ff={},_0x484629={'count':0x0,'rows':[]};var _0x5c3da2=_['map'](db['VoiceMail'][_0x889e('0x29')],function(_0x1cb4ed){return{'name':_0x1cb4ed[_0x889e('0x2a')],'type':_0x1cb4ed[_0x889e('0x2b')]['key']};});_0x2553ff['model']=_[_0x889e('0x2c')](_0x5c3da2,_0x889e('0x2d'));_0x2553ff[_0x889e('0x2e')]=_[_0x889e('0x2f')](_0x343c01[_0x889e('0x2e')]);_0x2553ff[_0x889e('0x30')]=_[_0x889e('0x31')](_0x2553ff['model'],_0x2553ff[_0x889e('0x2e')]);_0x9e8192['attributes']=_['intersection'](_0x2553ff[_0x889e('0x32')],qs[_0x889e('0x33')](_0x343c01[_0x889e('0x2e')]['fields']));_0x9e8192[_0x889e('0x34')]=_0x9e8192['attributes'][_0x889e('0x35')]?_0x9e8192[_0x889e('0x34')]:_0x2553ff[_0x889e('0x32')];if(!_0x343c01[_0x889e('0x2e')][_0x889e('0x36')](_0x889e('0x37'))){_0x9e8192[_0x889e('0x1c')]=qs['limit'](_0x343c01[_0x889e('0x2e')]['limit']);_0x9e8192[_0x889e('0x1b')]=qs['offset'](_0x343c01[_0x889e('0x2e')][_0x889e('0x1b')]);}_0x9e8192[_0x889e('0x38')]=qs[_0x889e('0x39')](_0x343c01[_0x889e('0x2e')][_0x889e('0x39')]);_0x9e8192['where']=qs[_0x889e('0x30')](_[_0x889e('0x3a')](_0x343c01[_0x889e('0x2e')],_0x2553ff[_0x889e('0x30')]));if(_0x343c01[_0x889e('0x2e')][_0x889e('0x3b')]){_0x9e8192[_0x889e('0x3c')]=_[_0x889e('0x3d')](_0x9e8192[_0x889e('0x3c')],{'$or':_[_0x889e('0x2c')](_0x5c3da2,function(_0x27e2b9){if(_0x27e2b9[_0x889e('0x2b')]!=='VIRTUAL'){var _0x51f3a8={};_0x51f3a8[_0x27e2b9[_0x889e('0x2d')]]={'$like':'%'+_0x343c01[_0x889e('0x2e')][_0x889e('0x3b')]+'%'};return _0x51f3a8;}})});}_0x9e8192=_['merge']({},_0x9e8192,_0x343c01[_0x889e('0x3e')]);var _0x27757d={'where':_0x9e8192[_0x889e('0x3c')]};return db[_0x889e('0x3f')][_0x889e('0x1a')](_0x27757d)[_0x889e('0x20')](function(_0x5ee0e8){_0x484629[_0x889e('0x1a')]=_0x5ee0e8;if(_0x343c01['query']['includeAll']){_0x9e8192[_0x889e('0x40')]=[{'all':!![]}];}return db[_0x889e('0x3f')][_0x889e('0x41')](_0x9e8192);})[_0x889e('0x20')](function(_0x4d35d0){_0x484629['rows']=_0x4d35d0;return _0x484629;})[_0x889e('0x20')](respondWithFilteredResult(_0x3b3aad,_0x9e8192))['catch'](handleError(_0x3b3aad,null));};exports[_0x889e('0x42')]=function(_0x330ecd,_0x5c7205){var _0x4b89dc={'raw':!![],'where':{'id':_0x330ecd[_0x889e('0x43')]['id']}},_0x18b45b={};_0x18b45b['model']=_[_0x889e('0x2f')](db['VoiceMail'][_0x889e('0x29')]);_0x18b45b[_0x889e('0x2e')]=_[_0x889e('0x2f')](_0x330ecd[_0x889e('0x2e')]);_0x18b45b[_0x889e('0x30')]=_[_0x889e('0x31')](_0x18b45b[_0x889e('0x32')],_0x18b45b[_0x889e('0x2e')]);_0x4b89dc[_0x889e('0x34')]=_[_0x889e('0x31')](_0x18b45b[_0x889e('0x32')],qs[_0x889e('0x33')](_0x330ecd['query'][_0x889e('0x33')]));_0x4b89dc[_0x889e('0x34')]=_0x4b89dc[_0x889e('0x34')][_0x889e('0x35')]?_0x4b89dc['attributes']:_0x18b45b[_0x889e('0x32')];if(_0x330ecd[_0x889e('0x2e')]['includeAll']){_0x4b89dc[_0x889e('0x40')]=[{'all':!![]}];}_0x4b89dc=_[_0x889e('0x3d')]({},_0x4b89dc,_0x330ecd['options']);return db['VoiceMail']['find'](_0x4b89dc)[_0x889e('0x20')](handleEntityNotFound(_0x5c7205,null))['then'](respondWithResult(_0x5c7205,null))[_0x889e('0x44')](handleError(_0x5c7205,null));};exports[_0x889e('0x45')]=function(_0x7bd28c,_0x630b2b){return db[_0x889e('0x3f')]['create'](_0x7bd28c[_0x889e('0x46')],{})[_0x889e('0x20')](function(_0x35f5d5){var _0x2cec3b=_0x7bd28c[_0x889e('0x47')][_0x889e('0x21')]({'plain':!![]});if(!_0x2cec3b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2cec3b['role']===_0x889e('0x47')){var _0x203a84=_0x35f5d5[_0x889e('0x21')]({'plain':!![]});var _0x48183a=_0x889e('0x22');return db[_0x889e('0x48')][_0x889e('0x49')]({'where':{'name':_0x48183a,'userProfileId':_0x2cec3b[_0x889e('0x4a')]},'raw':!![]})[_0x889e('0x20')](function(_0x25337b){if(_0x25337b&&_0x25337b[_0x889e('0x4b')]===0x0){return db[_0x889e('0x23')][_0x889e('0x45')]({'name':_0x203a84[_0x889e('0x2d')],'resourceId':_0x203a84['id'],'type':_0x25337b[_0x889e('0x2d')],'sectionId':_0x25337b['id']},{})[_0x889e('0x20')](function(){return _0x35f5d5;});}else{return _0x35f5d5;}})[_0x889e('0x44')](function(_0x26ba7a){logger[_0x889e('0x26')](_0x889e('0x4c'),_0x26ba7a);throw _0x26ba7a;});}return _0x35f5d5;})[_0x889e('0x20')](respondWithResult(_0x630b2b,0xc9))['catch'](handleError(_0x630b2b,null));};exports['update']=function(_0x4d41ac,_0x419cac){if(_0x4d41ac['body']['id']){delete _0x4d41ac[_0x889e('0x46')]['id'];}return db[_0x889e('0x3f')][_0x889e('0x49')]({'where':{'id':_0x4d41ac[_0x889e('0x43')]['id']}})['then'](handleEntityNotFound(_0x419cac,null))[_0x889e('0x20')](saveUpdates(_0x4d41ac['body'],null))[_0x889e('0x20')](respondWithResult(_0x419cac,null))[_0x889e('0x44')](handleError(_0x419cac,null));};exports[_0x889e('0x24')]=function(_0xd45252,_0x4fe748){return db[_0x889e('0x3f')]['find']({'where':{'id':_0xd45252[_0x889e('0x43')]['id']}})[_0x889e('0x20')](handleEntityNotFound(_0x4fe748,null))[_0x889e('0x20')](removeEntity(_0x4fe748,null))['catch'](handleError(_0x4fe748,null));};exports['getMessages']=function(_0x1ac4b2,_0x13a031,_0xd0e05){return db['VoiceMail'][_0x889e('0x4d')]({'where':{'id':_0x1ac4b2[_0x889e('0x43')]['id']}})['then'](handleEntityNotFound(_0x13a031,null))['then'](function(_0x3f9d3a){var _0xcb9167;var _0x530bf7={},_0x56d352={};_0x56d352[_0x889e('0x32')]=_[_0x889e('0x2f')](db['VoiceMailMessage']['rawAttributes']);_0x56d352[_0x889e('0x2e')]=_[_0x889e('0x2f')](_0x1ac4b2[_0x889e('0x2e')]);_0x56d352[_0x889e('0x30')]=_[_0x889e('0x31')](_0x56d352[_0x889e('0x32')],_0x56d352[_0x889e('0x2e')]);_0x530bf7[_0x889e('0x34')]=_[_0x889e('0x31')](_0x56d352[_0x889e('0x32')],qs[_0x889e('0x33')](_0x1ac4b2[_0x889e('0x2e')][_0x889e('0x33')]));_0x530bf7[_0x889e('0x34')]=_0x530bf7['attributes']['length']?_0x530bf7[_0x889e('0x34')]:_0x56d352['model'];if(!_0x1ac4b2[_0x889e('0x2e')][_0x889e('0x36')](_0x889e('0x37'))){_0x530bf7['limit']=qs['limit'](_0x1ac4b2[_0x889e('0x2e')][_0x889e('0x1c')]);_0x530bf7[_0x889e('0x1b')]=qs[_0x889e('0x1b')](_0x1ac4b2[_0x889e('0x2e')][_0x889e('0x1b')]);}_0x530bf7[_0x889e('0x38')]=qs[_0x889e('0x39')](_0x1ac4b2['query'][_0x889e('0x39')]);_0x530bf7['where']=qs[_0x889e('0x30')](_[_0x889e('0x3a')](_0x1ac4b2[_0x889e('0x2e')],_0x56d352[_0x889e('0x30')]));if(_0x1ac4b2[_0x889e('0x2e')]['filter']){_0x530bf7[_0x889e('0x3c')]=_['merge'](_0x530bf7[_0x889e('0x3c')],{'$or':_[_0x889e('0x2c')](_0x530bf7['attributes'],function(_0x181639){var _0x2afb63={};_0x2afb63[_0x181639]={'$like':'%'+_0x1ac4b2[_0x889e('0x2e')][_0x889e('0x3b')]+'%'};return _0x2afb63;})});}_0x530bf7[_0x889e('0x3c')]=_['merge'](_0x530bf7[_0x889e('0x3c')],{'mailboxuser':_0x3f9d3a[_0x889e('0x4e')]});_0x530bf7=_['merge']({},_0x530bf7,_0x1ac4b2[_0x889e('0x3e')]);return db[_0x889e('0x4f')]['findAndCountAll'](_0x530bf7)[_0x889e('0x20')](respondWithFilteredResult(_0x13a031,_0x530bf7));})[_0x889e('0x44')](handleError(_0x13a031,null));}; \ No newline at end of file +var _0x6625=['../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','update','then','get','Voicemails','UserProfileResource','destroy','error','stack','name','send','map','VoiceMail','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','getMessages','findOne','VoiceMailMessage','rawAttributes','mailbox','options','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment'];(function(_0x2bfd41,_0x1d50d9){var _0x34032e=function(_0x516652){while(--_0x516652){_0x2bfd41['push'](_0x2bfd41['shift']());}};_0x34032e(++_0x1d50d9);}(_0x6625,0x191));var _0x5662=function(_0x5f1608,_0x3372a3){_0x5f1608=_0x5f1608-0x0;var _0x295932=_0x6625[_0x5f1608];return _0x295932;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5662('0x0'));var rimraf=require(_0x5662('0x1'));var zipdir=require(_0x5662('0x2'));var jsonpatch=require(_0x5662('0x3'));var rp=require(_0x5662('0x4'));var moment=require('moment');var BPromise=require(_0x5662('0x5'));var Mustache=require('mustache');var util=require(_0x5662('0x6'));var path=require(_0x5662('0x7'));var sox=require(_0x5662('0x8'));var csv=require('to-csv');var ejs=require(_0x5662('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5662('0xa'));var crypto=require(_0x5662('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5662('0xc'));var toCsv=require(_0x5662('0xd'));var querystring=require('querystring');var Papa=require(_0x5662('0xe'));var Redis=require(_0x5662('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5662('0x10'));var as=require(_0x5662('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x5662('0x12'));var db=require(_0x5662('0x13'))['db'];function respondWithStatusCode(_0x3a79ae,_0x594653){_0x594653=_0x594653||0xcc;return function(_0x308521){if(_0x308521){return _0x3a79ae[_0x5662('0x14')](_0x594653);}return _0x3a79ae['status'](_0x594653)[_0x5662('0x15')]();};}function respondWithResult(_0x32f2cc,_0x409b4c){_0x409b4c=_0x409b4c||0xc8;return function(_0xea35ce){if(_0xea35ce){return _0x32f2cc[_0x5662('0x16')](_0x409b4c)[_0x5662('0x17')](_0xea35ce);}};}function respondWithFilteredResult(_0x549e77,_0x5d67d4){return function(_0x45e7ec){if(_0x45e7ec){var _0x32ffe9=_0x45e7ec[_0x5662('0x18')],_0x50993f=_0x5d67d4['offset'],_0x54c4d8=_0x5d67d4[_0x5662('0x19')]+_0x5d67d4[_0x5662('0x1a')],_0x5ccba4;if(_0x54c4d8>=_0x32ffe9){_0x54c4d8=_0x32ffe9;_0x5ccba4=0xc8;}else{_0x5ccba4=0xce;}_0x549e77[_0x5662('0x16')](_0x5ccba4);return _0x549e77[_0x5662('0x1b')](_0x5662('0x1c'),_0x50993f+'-'+_0x54c4d8+'/'+_0x32ffe9)[_0x5662('0x17')](_0x45e7ec);}return null;};}function patchUpdates(_0x43fbba){return function(_0x4170e3){try{jsonpatch['apply'](_0x4170e3,_0x43fbba,!![]);}catch(_0x3b3f92){return BPromise[_0x5662('0x1d')](_0x3b3f92);}return _0x4170e3['save']();};}function saveUpdates(_0x154bec,_0x4e58a6){return function(_0x39ce59){if(_0x39ce59){return _0x39ce59[_0x5662('0x1e')](_0x154bec)[_0x5662('0x1f')](function(_0x307370){return _0x307370;});}return null;};}function removeEntity(_0x21f052,_0x4c7ddb){return function(_0x60e4d0){if(_0x60e4d0){return _0x60e4d0['destroy']()[_0x5662('0x1f')](function(){var _0x450e8f=_0x60e4d0[_0x5662('0x20')]({'plain':!![]});var _0x5233a3=_0x5662('0x21');return db[_0x5662('0x22')][_0x5662('0x23')]({'where':{'type':_0x5233a3,'resourceId':_0x450e8f['id']}})[_0x5662('0x1f')](function(){return _0x60e4d0;});})[_0x5662('0x1f')](function(){_0x21f052[_0x5662('0x16')](0xcc)[_0x5662('0x15')]();});}};}function handleEntityNotFound(_0x534450,_0x40d639){return function(_0x40d133){if(!_0x40d133){_0x534450[_0x5662('0x14')](0x194);}return _0x40d133;};}function handleError(_0x51f8c5,_0xc06e9a){_0xc06e9a=_0xc06e9a||0x1f4;return function(_0x1108ba){logger[_0x5662('0x24')](_0x1108ba[_0x5662('0x25')]);if(_0x1108ba[_0x5662('0x26')]){delete _0x1108ba['name'];}_0x51f8c5[_0x5662('0x16')](_0xc06e9a)[_0x5662('0x27')](_0x1108ba);};}exports['index']=function(_0x539250,_0x1da0c0){var _0x3c65ea={},_0x577565={},_0xb69aa0={'count':0x0,'rows':[]};var _0x5abc32=_[_0x5662('0x28')](db[_0x5662('0x29')]['rawAttributes'],function(_0x2efc51){return{'name':_0x2efc51['fieldName'],'type':_0x2efc51[_0x5662('0x2a')][_0x5662('0x2b')]};});_0x577565[_0x5662('0x2c')]=_['map'](_0x5abc32,_0x5662('0x26'));_0x577565['query']=_[_0x5662('0x2d')](_0x539250[_0x5662('0x2e')]);_0x577565[_0x5662('0x2f')]=_['intersection'](_0x577565[_0x5662('0x2c')],_0x577565[_0x5662('0x2e')]);_0x3c65ea[_0x5662('0x30')]=_[_0x5662('0x31')](_0x577565[_0x5662('0x2c')],qs['fields'](_0x539250[_0x5662('0x2e')][_0x5662('0x32')]));_0x3c65ea[_0x5662('0x30')]=_0x3c65ea[_0x5662('0x30')]['length']?_0x3c65ea['attributes']:_0x577565['model'];if(!_0x539250[_0x5662('0x2e')][_0x5662('0x33')](_0x5662('0x34'))){_0x3c65ea[_0x5662('0x1a')]=qs[_0x5662('0x1a')](_0x539250[_0x5662('0x2e')][_0x5662('0x1a')]);_0x3c65ea[_0x5662('0x19')]=qs[_0x5662('0x19')](_0x539250[_0x5662('0x2e')][_0x5662('0x19')]);}_0x3c65ea[_0x5662('0x35')]=qs[_0x5662('0x36')](_0x539250[_0x5662('0x2e')]['sort']);_0x3c65ea[_0x5662('0x37')]=qs[_0x5662('0x2f')](_[_0x5662('0x38')](_0x539250[_0x5662('0x2e')],_0x577565[_0x5662('0x2f')]));if(_0x539250[_0x5662('0x2e')][_0x5662('0x39')]){_0x3c65ea[_0x5662('0x37')]=_[_0x5662('0x3a')](_0x3c65ea['where'],{'$or':_['map'](_0x5abc32,function(_0x2e480c){if(_0x2e480c[_0x5662('0x2a')]!==_0x5662('0x3b')){var _0x3119bf={};_0x3119bf[_0x2e480c[_0x5662('0x26')]]={'$like':'%'+_0x539250[_0x5662('0x2e')][_0x5662('0x39')]+'%'};return _0x3119bf;}})});}_0x3c65ea=_[_0x5662('0x3a')]({},_0x3c65ea,_0x539250['options']);var _0x28a0e8={'where':_0x3c65ea[_0x5662('0x37')]};return db[_0x5662('0x29')][_0x5662('0x18')](_0x28a0e8)[_0x5662('0x1f')](function(_0x191ac4){_0xb69aa0[_0x5662('0x18')]=_0x191ac4;if(_0x539250['query'][_0x5662('0x3c')]){_0x3c65ea[_0x5662('0x3d')]=[{'all':!![]}];}return db[_0x5662('0x29')][_0x5662('0x3e')](_0x3c65ea);})[_0x5662('0x1f')](function(_0x4645a8){_0xb69aa0['rows']=_0x4645a8;return _0xb69aa0;})[_0x5662('0x1f')](respondWithFilteredResult(_0x1da0c0,_0x3c65ea))[_0x5662('0x3f')](handleError(_0x1da0c0,null));};exports[_0x5662('0x40')]=function(_0x2646a4,_0xd21ed3){var _0x149082={'raw':!![],'where':{'id':_0x2646a4[_0x5662('0x41')]['id']}},_0x10101c={};_0x10101c[_0x5662('0x2c')]=_[_0x5662('0x2d')](db['VoiceMail']['rawAttributes']);_0x10101c[_0x5662('0x2e')]=_['keys'](_0x2646a4[_0x5662('0x2e')]);_0x10101c[_0x5662('0x2f')]=_[_0x5662('0x31')](_0x10101c[_0x5662('0x2c')],_0x10101c[_0x5662('0x2e')]);_0x149082[_0x5662('0x30')]=_['intersection'](_0x10101c['model'],qs['fields'](_0x2646a4[_0x5662('0x2e')][_0x5662('0x32')]));_0x149082[_0x5662('0x30')]=_0x149082[_0x5662('0x30')][_0x5662('0x42')]?_0x149082[_0x5662('0x30')]:_0x10101c[_0x5662('0x2c')];if(_0x2646a4['query'][_0x5662('0x3c')]){_0x149082[_0x5662('0x3d')]=[{'all':!![]}];}_0x149082=_['merge']({},_0x149082,_0x2646a4['options']);return db[_0x5662('0x29')]['find'](_0x149082)[_0x5662('0x1f')](handleEntityNotFound(_0xd21ed3,null))['then'](respondWithResult(_0xd21ed3,null))['catch'](handleError(_0xd21ed3,null));};exports[_0x5662('0x43')]=function(_0x22458f,_0x543cfa){return db[_0x5662('0x29')][_0x5662('0x43')](_0x22458f[_0x5662('0x44')],{})[_0x5662('0x1f')](function(_0xa98706){var _0x1f9dd7=_0x22458f[_0x5662('0x45')][_0x5662('0x20')]({'plain':!![]});if(!_0x1f9dd7)throw new Error(_0x5662('0x46'));if(_0x1f9dd7[_0x5662('0x47')]===_0x5662('0x45')){var _0x5be829=_0xa98706[_0x5662('0x20')]({'plain':!![]});var _0x37e3ed=_0x5662('0x21');return db[_0x5662('0x48')]['find']({'where':{'name':_0x37e3ed,'userProfileId':_0x1f9dd7[_0x5662('0x49')]},'raw':!![]})[_0x5662('0x1f')](function(_0x4b51a9){if(_0x4b51a9&&_0x4b51a9[_0x5662('0x4a')]===0x0){return db[_0x5662('0x22')][_0x5662('0x43')]({'name':_0x5be829[_0x5662('0x26')],'resourceId':_0x5be829['id'],'type':_0x4b51a9[_0x5662('0x26')],'sectionId':_0x4b51a9['id']},{})[_0x5662('0x1f')](function(){return _0xa98706;});}else{return _0xa98706;}})[_0x5662('0x3f')](function(_0x292fde){logger['error'](_0x5662('0x4b'),_0x292fde);throw _0x292fde;});}return _0xa98706;})[_0x5662('0x1f')](respondWithResult(_0x543cfa,0xc9))[_0x5662('0x3f')](handleError(_0x543cfa,null));};exports['update']=function(_0x46a3f6,_0x206b9a){if(_0x46a3f6[_0x5662('0x44')]['id']){delete _0x46a3f6[_0x5662('0x44')]['id'];}return db[_0x5662('0x29')]['find']({'where':{'id':_0x46a3f6['params']['id']}})[_0x5662('0x1f')](handleEntityNotFound(_0x206b9a,null))[_0x5662('0x1f')](saveUpdates(_0x46a3f6['body'],null))[_0x5662('0x1f')](respondWithResult(_0x206b9a,null))[_0x5662('0x3f')](handleError(_0x206b9a,null));};exports[_0x5662('0x23')]=function(_0x5406e9,_0x329704){return db[_0x5662('0x29')][_0x5662('0x4c')]({'where':{'id':_0x5406e9[_0x5662('0x41')]['id']}})[_0x5662('0x1f')](handleEntityNotFound(_0x329704,null))[_0x5662('0x1f')](removeEntity(_0x329704,null))[_0x5662('0x3f')](handleError(_0x329704,null));};exports[_0x5662('0x4d')]=function(_0x4087bd,_0x138fad,_0x581685){return db[_0x5662('0x29')][_0x5662('0x4e')]({'where':{'id':_0x4087bd[_0x5662('0x41')]['id']}})[_0x5662('0x1f')](handleEntityNotFound(_0x138fad,null))[_0x5662('0x1f')](function(_0x2eac6c){var _0x12f166;var _0x51c40c={},_0x351129={};_0x351129[_0x5662('0x2c')]=_[_0x5662('0x2d')](db[_0x5662('0x4f')][_0x5662('0x50')]);_0x351129[_0x5662('0x2e')]=_[_0x5662('0x2d')](_0x4087bd['query']);_0x351129[_0x5662('0x2f')]=_[_0x5662('0x31')](_0x351129[_0x5662('0x2c')],_0x351129[_0x5662('0x2e')]);_0x51c40c['attributes']=_[_0x5662('0x31')](_0x351129[_0x5662('0x2c')],qs[_0x5662('0x32')](_0x4087bd['query'][_0x5662('0x32')]));_0x51c40c['attributes']=_0x51c40c[_0x5662('0x30')][_0x5662('0x42')]?_0x51c40c[_0x5662('0x30')]:_0x351129[_0x5662('0x2c')];if(!_0x4087bd[_0x5662('0x2e')]['hasOwnProperty'](_0x5662('0x34'))){_0x51c40c[_0x5662('0x1a')]=qs[_0x5662('0x1a')](_0x4087bd[_0x5662('0x2e')][_0x5662('0x1a')]);_0x51c40c['offset']=qs['offset'](_0x4087bd[_0x5662('0x2e')]['offset']);}_0x51c40c['order']=qs[_0x5662('0x36')](_0x4087bd['query'][_0x5662('0x36')]);_0x51c40c[_0x5662('0x37')]=qs['filters'](_[_0x5662('0x38')](_0x4087bd[_0x5662('0x2e')],_0x351129[_0x5662('0x2f')]));if(_0x4087bd[_0x5662('0x2e')]['filter']){_0x51c40c[_0x5662('0x37')]=_[_0x5662('0x3a')](_0x51c40c['where'],{'$or':_[_0x5662('0x28')](_0x51c40c['attributes'],function(_0xe0479c){var _0xb01555={};_0xb01555[_0xe0479c]={'$like':'%'+_0x4087bd['query']['filter']+'%'};return _0xb01555;})});}_0x51c40c['where']=_['merge'](_0x51c40c[_0x5662('0x37')],{'mailboxuser':_0x2eac6c[_0x5662('0x51')]});_0x51c40c=_['merge']({},_0x51c40c,_0x4087bd[_0x5662('0x52')]);return db[_0x5662('0x4f')][_0x5662('0x53')](_0x51c40c)[_0x5662('0x1f')](respondWithFilteredResult(_0x138fad,_0x51c40c));})[_0x5662('0x3f')](handleError(_0x138fad,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index b57468e..f0fe48b 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 _0xc428=['./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox','context','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3658e0,_0x4bb563){var _0x19fd17=function(_0x49d858){while(--_0x49d858){_0x3658e0['push'](_0x3658e0['shift']());}};_0x19fd17(++_0x4bb563);}(_0xc428,0x85));var _0x8c42=function(_0x46d65c,_0x542c27){_0x46d65c=_0x46d65c-0x0;var _0x48473b=_0xc428[_0x46d65c];return _0x48473b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8c42('0x0'));var moment=require(_0x8c42('0x1'));var BPromise=require(_0x8c42('0x2'));var rp=require(_0x8c42('0x3'));var fs=require('fs');var path=require(_0x8c42('0x4'));var rimraf=require(_0x8c42('0x5'));var config=require(_0x8c42('0x6'));var attributes=require(_0x8c42('0x7'));module[_0x8c42('0x8')]=function(_0x2504be,_0x10d339){return _0x2504be[_0x8c42('0x9')](_0x8c42('0xa'),attributes,{'tableName':_0x8c42('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x8c42('0xc'),_0x8c42('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc161=['VoiceMail','voice_voicemail','context','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x52999c,_0xb101a2){var _0x2c7ed2=function(_0x367bd6){while(--_0x367bd6){_0x52999c['push'](_0x52999c['shift']());}};_0x2c7ed2(++_0xb101a2);}(_0xc161,0x6f));var _0x1c16=function(_0x1b96c6,_0x45e55a){_0x1b96c6=_0x1b96c6-0x0;var _0x4a20fa=_0xc161[_0x1b96c6];return _0x4a20fa;};'use strict';var _=require(_0x1c16('0x0'));var util=require(_0x1c16('0x1'));var logger=require(_0x1c16('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1c16('0x3'));var rp=require(_0x1c16('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c16('0x5'));var config=require(_0x1c16('0x6'));var attributes=require('./voiceMail.attributes');module[_0x1c16('0x7')]=function(_0x156b13,_0x373b84){return _0x156b13[_0x1c16('0x8')](_0x1c16('0x9'),attributes,{'tableName':_0x1c16('0xa'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0x1c16('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 956fa14..fe14d6a 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 _0x6d2a=['../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','request\x20sent','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3e8f8e,_0x50e78d){var _0x428d54=function(_0x40fdab){while(--_0x40fdab){_0x3e8f8e['push'](_0x3e8f8e['shift']());}};_0x428d54(++_0x50e78d);}(_0x6d2a,0xe0));var _0xa6d2=function(_0x1c5860,_0x49638a){_0x1c5860=_0x1c5860-0x0;var _0x33970c=_0x6d2a[_0x1c5860];return _0x33970c;};'use strict';var _=require('lodash');var util=require(_0xa6d2('0x0'));var moment=require(_0xa6d2('0x1'));var BPromise=require(_0xa6d2('0x2'));var rs=require(_0xa6d2('0x3'));var fs=require('fs');var Redis=require(_0xa6d2('0x4'));var db=require(_0xa6d2('0x5'))['db'];var utils=require(_0xa6d2('0x6'));var logger=require(_0xa6d2('0x7'))(_0xa6d2('0x8'));var config=require('../../config/environment');var jayson=require(_0xa6d2('0x9'));var client=jayson[_0xa6d2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b311,_0x24a10c,_0xa3b082){return new BPromise(function(_0x3e0f6b,_0xb71712){return client[_0xa6d2('0xb')](_0x10b311,_0xa3b082)[_0xa6d2('0xc')](function(_0x5a6aa8){logger[_0xa6d2('0xd')]('VoiceMail,\x20%s,\x20%s',_0x24a10c,'request\x20sent');logger[_0xa6d2('0xe')](_0xa6d2('0xf'),_0x24a10c,'request\x20sent',JSON[_0xa6d2('0x10')](_0x5a6aa8));if(_0x5a6aa8['error']){if(_0x5a6aa8[_0xa6d2('0x11')][_0xa6d2('0x12')]===0x1f4){logger[_0xa6d2('0x11')](_0xa6d2('0x13'),_0x24a10c,_0x5a6aa8[_0xa6d2('0x11')]['message']);return _0xb71712(_0x5a6aa8[_0xa6d2('0x11')][_0xa6d2('0x14')]);}logger[_0xa6d2('0x11')](_0xa6d2('0x13'),_0x24a10c,_0x5a6aa8[_0xa6d2('0x11')]['message']);return _0x3e0f6b(_0x5a6aa8[_0xa6d2('0x11')][_0xa6d2('0x14')]);}else{logger[_0xa6d2('0xd')](_0xa6d2('0x13'),_0x24a10c,_0xa6d2('0x15'));_0x3e0f6b(_0x5a6aa8['result'][_0xa6d2('0x14')]);}})[_0xa6d2('0x16')](function(_0x512d13){logger[_0xa6d2('0x11')](_0xa6d2('0x13'),_0x24a10c,_0x512d13);_0xb71712(_0x512d13);});});} \ No newline at end of file +var _0xcc9c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment'];(function(_0x36f89d,_0x5f1cf9){var _0x5c776d=function(_0x3c5586){while(--_0x3c5586){_0x36f89d['push'](_0x36f89d['shift']());}};_0x5c776d(++_0x5f1cf9);}(_0xcc9c,0xc4));var _0xccc9=function(_0x36f575,_0x5a11a8){_0x36f575=_0x36f575-0x0;var _0x14796e=_0xcc9c[_0x36f575];return _0x14796e;};'use strict';var _=require(_0xccc9('0x0'));var util=require('util');var moment=require(_0xccc9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xccc9('0x2'));var db=require(_0xccc9('0x3'))['db'];var utils=require(_0xccc9('0x4'));var logger=require(_0xccc9('0x5'))(_0xccc9('0x6'));var config=require(_0xccc9('0x7'));var jayson=require(_0xccc9('0x8'));var client=jayson[_0xccc9('0x9')][_0xccc9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23e10c,_0x21137e,_0x5954f3){return new BPromise(function(_0x14599b,_0x1251cc){return client[_0xccc9('0xb')](_0x23e10c,_0x5954f3)[_0xccc9('0xc')](function(_0x4d89a0){logger[_0xccc9('0xd')](_0xccc9('0xe'),_0x21137e,_0xccc9('0xf'));logger[_0xccc9('0x10')](_0xccc9('0x11'),_0x21137e,_0xccc9('0xf'),JSON[_0xccc9('0x12')](_0x4d89a0));if(_0x4d89a0[_0xccc9('0x13')]){if(_0x4d89a0['error']['code']===0x1f4){logger[_0xccc9('0x13')](_0xccc9('0xe'),_0x21137e,_0x4d89a0[_0xccc9('0x13')]['message']);return _0x1251cc(_0x4d89a0[_0xccc9('0x13')][_0xccc9('0x14')]);}logger['error'](_0xccc9('0xe'),_0x21137e,_0x4d89a0['error'][_0xccc9('0x14')]);return _0x14599b(_0x4d89a0[_0xccc9('0x13')][_0xccc9('0x14')]);}else{logger[_0xccc9('0xd')](_0xccc9('0xe'),_0x21137e,'request\x20sent');_0x14599b(_0x4d89a0[_0xccc9('0x15')][_0xccc9('0x14')]);}})['catch'](function(_0x5d029f){logger[_0xccc9('0x13')](_0xccc9('0xe'),_0x21137e,_0x5d029f);_0x1251cc(_0x5d029f);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 5cc7a4f..7cb689c 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 _0x7fbe=['get','isAuthenticated','index','/:id','/:id/download','download','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller'];(function(_0x553173,_0x4a2f9d){var _0x99e190=function(_0x48ac73){while(--_0x48ac73){_0x553173['push'](_0x553173['shift']());}};_0x99e190(++_0x4a2f9d);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x46b8f8,_0x3f9908){_0x46b8f8=_0x46b8f8-0x0;var _0x28eafe=_0x7fbe[_0x46b8f8];return _0x28eafe;};'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['show']);router[_0xe7fb('0x8')](_0xe7fb('0xc'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe7fb('0xe')]);router[_0xe7fb('0xf')](_0xe7fb('0xb'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x10')]);router[_0xe7fb('0x11')](_0xe7fb('0xb'),auth[_0xe7fb('0x9')](),controller[_0xe7fb('0x12')]);module[_0xe7fb('0x13')]=router; \ No newline at end of file +var _0x7da7=['get','/:id/download','download','create','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','/:id','show'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x7da7,0x10d));var _0x77da=function(_0x3e85a4,_0x18c3a9){_0x3e85a4=_0x3e85a4-0x0;var _0x21e7d1=_0x7da7[_0x3e85a4];return _0x21e7d1;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var auth=require(_0x77da('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x77da('0x5'));var controller=require(_0x77da('0x6'));router['get']('/',auth[_0x77da('0x7')](),controller[_0x77da('0x8')]);router['get'](_0x77da('0x9'),auth['isAuthenticated'](),controller[_0x77da('0xa')]);router[_0x77da('0xb')](_0x77da('0xc'),auth[_0x77da('0x7')](),controller[_0x77da('0xd')]);router['post']('/',auth[_0x77da('0x7')](),controller[_0x77da('0xe')]);router[_0x77da('0xf')]('/:id',auth[_0x77da('0x7')](),controller[_0x77da('0x10')]);router[_0x77da('0x11')](_0x77da('0x9'),auth['isAuthenticated'](),controller[_0x77da('0x12')]);module[_0x77da('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 10ec9c0..6e98d2c 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 _0x78a3=['exports','getDataValue','INTEGER','STRING','BLOB','sequelize'];(function(_0x4bfade,_0xb26c0e){var _0x272465=function(_0x3b38cb){while(--_0x3b38cb){_0x4bfade['push'](_0x4bfade['shift']());}};_0x272465(++_0xb26c0e);}(_0x78a3,0xc5));var _0x378a=function(_0x2db667,_0x193cf5){_0x2db667=_0x2db667-0x0;var _0x83ff9=_0x78a3[_0x2db667];return _0x83ff9;};'use strict';var Sequelize=require(_0x378a('0x0'));module[_0x378a('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2a6777){return this[_0x378a('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x378a('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x378a('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x378a('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x378a('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x378a('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x378a('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x378a('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x378a('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x378a('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file +var _0x3b53=['INTEGER','STRING','BLOB','long','TIMESTAMP','sequelize','VIRTUAL','getDataValue'];(function(_0x23beca,_0x160e9a){var _0x51070a=function(_0x2c1b03){while(--_0x2c1b03){_0x23beca['push'](_0x23beca['shift']());}};_0x51070a(++_0x160e9a);}(_0x3b53,0xcd));var _0x33b5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3b53[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x33b5('0x0'));module['exports']={'name':{'type':Sequelize[_0x33b5('0x1')],'get':function(_0x3a8a0c){return this[_0x33b5('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x33b5('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x33b5('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x33b5('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x33b5('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x33b5('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x33b5('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x33b5('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x33b5('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x33b5('0x5')](_0x33b5('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x33b5('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x33b5('0x4')],'defaultValue':''},'stamp':{'type':_0x33b5('0x7'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 1ee7066..cddb3f5 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 _0xae24=['.wav\x22','html-pdf','rimraf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','then','error','stack','name','send','map','model','differenceBy','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','VoiceMailMessage','include','findAll','catch','show','length','includeAll','find','create','body','params','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22'];(function(_0x38a9e6,_0x138951){var _0x4abe60=function(_0x42fcbb){while(--_0x42fcbb){_0x38a9e6['push'](_0x38a9e6['shift']());}};_0x4abe60(++_0x138951);}(_0xae24,0x182));var _0x4ae2=function(_0x5d3254,_0x55e0a3){_0x5d3254=_0x5d3254-0x0;var _0x4d573d=_0xae24[_0x5d3254];return _0x4d573d;};'use strict';var pdf=require(_0x4ae2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4ae2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4ae2('0x2'));var rp=require(_0x4ae2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4ae2('0x4'));var util=require('util');var path=require(_0x4ae2('0x5'));var sox=require(_0x4ae2('0x6'));var csv=require(_0x4ae2('0x7'));var ejs=require(_0x4ae2('0x8'));var fs=require('fs');var _=require(_0x4ae2('0x9'));var squel=require(_0x4ae2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ae2('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4ae2('0xc'));var Redis=require(_0x4ae2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4ae2('0xe'));var as=require(_0x4ae2('0xf'));var hardwareService=require(_0x4ae2('0x10'));var logger=require(_0x4ae2('0x11'))('api');var utils=require(_0x4ae2('0x12'));var config=require(_0x4ae2('0x13'));var db=require(_0x4ae2('0x14'))['db'];function respondWithStatusCode(_0x4d7dc3,_0x25d2b4){_0x25d2b4=_0x25d2b4||0xcc;return function(_0x22ac1e){if(_0x22ac1e){return _0x4d7dc3[_0x4ae2('0x15')](_0x25d2b4);}return _0x4d7dc3[_0x4ae2('0x16')](_0x25d2b4)[_0x4ae2('0x17')]();};}function respondWithResult(_0x40954f,_0x145287){_0x145287=_0x145287||0xc8;return function(_0x3cabc9){if(_0x3cabc9){return _0x40954f[_0x4ae2('0x16')](_0x145287)['json'](_0x3cabc9);}};}function respondWithFilteredResult(_0x4ec027,_0x4d5cab){return function(_0x2f3936){if(_0x2f3936){var _0xf834a1=_0x2f3936[_0x4ae2('0x18')],_0x5f447a=_0x4d5cab[_0x4ae2('0x19')],_0x463765=_0x4d5cab[_0x4ae2('0x19')]+_0x4d5cab[_0x4ae2('0x1a')],_0x9fb8db;if(_0x463765>=_0xf834a1){_0x463765=_0xf834a1;_0x9fb8db=0xc8;}else{_0x9fb8db=0xce;}_0x4ec027[_0x4ae2('0x16')](_0x9fb8db);return _0x4ec027[_0x4ae2('0x1b')](_0x4ae2('0x1c'),_0x5f447a+'-'+_0x463765+'/'+_0xf834a1)[_0x4ae2('0x1d')](_0x2f3936);}return null;};}function patchUpdates(_0x4d5071){return function(_0x4a97af){try{jsonpatch[_0x4ae2('0x1e')](_0x4a97af,_0x4d5071,!![]);}catch(_0x2d910c){return BPromise['reject'](_0x2d910c);}return _0x4a97af[_0x4ae2('0x1f')]();};}function saveUpdates(_0x343db1,_0xccb3b){return function(_0x2ad222){if(_0x2ad222){return _0x2ad222[_0x4ae2('0x20')](_0x343db1)['then'](function(_0x2bf5fe){return _0x2bf5fe;});}return null;};}function removeEntity(_0x53c686,_0x522165){return function(_0x2ceec4){if(_0x2ceec4){return _0x2ceec4[_0x4ae2('0x21')]()[_0x4ae2('0x22')](function(){_0x53c686[_0x4ae2('0x16')](0xcc)[_0x4ae2('0x17')]();});}};}function handleEntityNotFound(_0x526768,_0x1005e0){return function(_0x4a0ddb){if(!_0x4a0ddb){_0x526768[_0x4ae2('0x15')](0x194);}return _0x4a0ddb;};}function handleError(_0x12b5d2,_0x130239){_0x130239=_0x130239||0x1f4;return function(_0x57933b){logger[_0x4ae2('0x23')](_0x57933b[_0x4ae2('0x24')]);if(_0x57933b[_0x4ae2('0x25')]){delete _0x57933b[_0x4ae2('0x25')];}_0x12b5d2[_0x4ae2('0x16')](_0x130239)[_0x4ae2('0x26')](_0x57933b);};}exports['index']=function(_0x5962b0,_0x9508d7){var _0x3030f8={},_0x3fa514={},_0x329588={'count':0x0,'rows':[]};var _0x3a9b96=_[_0x4ae2('0x27')](db['VoiceMailMessage']['rawAttributes'],function(_0x3e2666){return{'name':_0x3e2666['fieldName'],'type':_0x3e2666['type']['key']};});_0x3fa514[_0x4ae2('0x28')]=_[_0x4ae2('0x29')](_['map'](_0x3a9b96,_0x4ae2('0x25')),[_0x4ae2('0x25')]);_0x3fa514[_0x4ae2('0x2a')]=_[_0x4ae2('0x2b')](_0x5962b0[_0x4ae2('0x2a')]);_0x3fa514[_0x4ae2('0x2c')]=_[_0x4ae2('0x2d')](_0x3fa514[_0x4ae2('0x28')],_0x3fa514[_0x4ae2('0x2a')]);_0x3030f8[_0x4ae2('0x2e')]=_[_0x4ae2('0x2d')](_0x3fa514[_0x4ae2('0x28')],qs[_0x4ae2('0x2f')](_0x5962b0[_0x4ae2('0x2a')][_0x4ae2('0x2f')]));_0x3030f8[_0x4ae2('0x2e')]=_0x3030f8[_0x4ae2('0x2e')]['length']?_0x3030f8[_0x4ae2('0x2e')]:_0x3fa514['model'];if(!_0x5962b0[_0x4ae2('0x2a')][_0x4ae2('0x30')]('nolimit')){_0x3030f8[_0x4ae2('0x1a')]=qs[_0x4ae2('0x1a')](_0x5962b0[_0x4ae2('0x2a')][_0x4ae2('0x1a')]);_0x3030f8['offset']=qs[_0x4ae2('0x19')](_0x5962b0[_0x4ae2('0x2a')][_0x4ae2('0x19')]);}_0x3030f8[_0x4ae2('0x31')]=qs[_0x4ae2('0x32')](_0x5962b0[_0x4ae2('0x2a')][_0x4ae2('0x32')]);_0x3030f8[_0x4ae2('0x33')]=qs[_0x4ae2('0x2c')](_['pick'](_0x5962b0[_0x4ae2('0x2a')],_0x3fa514['filters']));if(_0x5962b0[_0x4ae2('0x2a')][_0x4ae2('0x34')]){_0x3030f8[_0x4ae2('0x33')]=_[_0x4ae2('0x35')](_0x3030f8[_0x4ae2('0x33')],{'$or':_[_0x4ae2('0x27')](_0x3a9b96,function(_0x5e1fa4){if(_0x5e1fa4[_0x4ae2('0x36')]!==_0x4ae2('0x37')){var _0x20d755={};_0x20d755[_0x5e1fa4[_0x4ae2('0x25')]]={'$like':'%'+_0x5962b0['query'][_0x4ae2('0x34')]+'%'};return _0x20d755;}})});}_0x3030f8=_[_0x4ae2('0x35')]({},_0x3030f8,_0x5962b0[_0x4ae2('0x38')]);var _0x2a2dba={'where':_0x3030f8[_0x4ae2('0x33')]};return db[_0x4ae2('0x39')][_0x4ae2('0x18')](_0x2a2dba)[_0x4ae2('0x22')](function(_0x1d5888){_0x329588[_0x4ae2('0x18')]=_0x1d5888;if(_0x5962b0[_0x4ae2('0x2a')]['includeAll']){_0x3030f8[_0x4ae2('0x3a')]=[{'all':!![]}];}return db[_0x4ae2('0x39')][_0x4ae2('0x3b')](_0x3030f8);})[_0x4ae2('0x22')](function(_0x5bade3){_0x329588['rows']=_0x5bade3;return _0x329588;})[_0x4ae2('0x22')](respondWithFilteredResult(_0x9508d7,_0x3030f8))[_0x4ae2('0x3c')](handleError(_0x9508d7,null));};exports[_0x4ae2('0x3d')]=function(_0x3cdf23,_0x567371){var _0x3c0a56={'raw':!![],'where':{'id':_0x3cdf23['params']['id']}},_0x178898={};_0x178898[_0x4ae2('0x28')]=_[_0x4ae2('0x2b')](db[_0x4ae2('0x39')]['rawAttributes']);_0x178898[_0x4ae2('0x2a')]=_[_0x4ae2('0x2b')](_0x3cdf23[_0x4ae2('0x2a')]);_0x178898[_0x4ae2('0x2c')]=_[_0x4ae2('0x2d')](_0x178898[_0x4ae2('0x28')],_0x178898[_0x4ae2('0x2a')]);_0x3c0a56[_0x4ae2('0x2e')]=_['intersection'](_0x178898[_0x4ae2('0x28')],qs[_0x4ae2('0x2f')](_0x3cdf23['query'][_0x4ae2('0x2f')]));_0x3c0a56[_0x4ae2('0x2e')]=_0x3c0a56['attributes'][_0x4ae2('0x3e')]?_0x3c0a56[_0x4ae2('0x2e')]:_0x178898['model'];if(_0x3cdf23[_0x4ae2('0x2a')][_0x4ae2('0x3f')]){_0x3c0a56[_0x4ae2('0x3a')]=[{'all':!![]}];}_0x3c0a56=_['merge']({},_0x3c0a56,_0x3cdf23['options']);return db[_0x4ae2('0x39')][_0x4ae2('0x40')](_0x3c0a56)[_0x4ae2('0x22')](handleEntityNotFound(_0x567371,null))[_0x4ae2('0x22')](respondWithResult(_0x567371,null))['catch'](handleError(_0x567371,null));};exports[_0x4ae2('0x41')]=function(_0x28b33a,_0x163d75){return db['VoiceMailMessage'][_0x4ae2('0x41')](_0x28b33a[_0x4ae2('0x42')],{})[_0x4ae2('0x22')](respondWithResult(_0x163d75,0xc9))['catch'](handleError(_0x163d75,null));};exports[_0x4ae2('0x20')]=function(_0x24ec08,_0x2b596c){if(_0x24ec08[_0x4ae2('0x42')]['id']){delete _0x24ec08[_0x4ae2('0x42')]['id'];}return db[_0x4ae2('0x39')][_0x4ae2('0x40')]({'where':{'id':_0x24ec08[_0x4ae2('0x43')]['id']}})[_0x4ae2('0x22')](handleEntityNotFound(_0x2b596c,null))[_0x4ae2('0x22')](saveUpdates(_0x24ec08['body'],null))[_0x4ae2('0x22')](respondWithResult(_0x2b596c,null))[_0x4ae2('0x3c')](handleError(_0x2b596c,null));};exports[_0x4ae2('0x21')]=function(_0x1c0898,_0x2292ec){return db[_0x4ae2('0x39')][_0x4ae2('0x40')]({'where':{'id':_0x1c0898[_0x4ae2('0x43')]['id']}})['then'](handleEntityNotFound(_0x2292ec,null))[_0x4ae2('0x22')](removeEntity(_0x2292ec,null))[_0x4ae2('0x3c')](handleError(_0x2292ec,null));};exports['download']=function(_0x2fee58,_0x3c5f8d,_0x4f7206){return db[_0x4ae2('0x39')]['find']({'where':{'id':_0x2fee58[_0x4ae2('0x43')]['id']},'attributes':['id','recording',_0x4ae2('0x44')]})[_0x4ae2('0x22')](handleEntityNotFound(_0x3c5f8d,null))[_0x4ae2('0x22')](function(_0x1a21ad){if(_0x1a21ad){if(!_0x1a21ad[_0x4ae2('0x45')]){throw new db[(_0x4ae2('0x46'))][(_0x4ae2('0x47'))](_0x4ae2('0x48'));}var _0x28de70={'Content-Type':'audio/wav','Content-Disposition':_0x4ae2('0x49')};if(_0x1a21ad[_0x4ae2('0x44')]){_0x28de70[_0x4ae2('0x4a')]=_0x4ae2('0x4b')+_0x1a21ad['msg_id']+_0x4ae2('0x4c');}_0x3c5f8d[_0x4ae2('0x1b')](_0x28de70);return _0x3c5f8d[_0x4ae2('0x26')](new Buffer(_0x1a21ad['recording']));}})['catch'](handleError(_0x3c5f8d,null));}; \ No newline at end of file +var _0x72b1=['offset','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','VoiceMailMessage','find','create','body','update','catch','download','recording','msg_id','Sequelize','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','send','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','count','limit','set','Content-Range','apply','reject','save','destroy','then','end','sendStatus','error','stack','name','index','map','rawAttributes','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x72b1,0x16e));var _0x172b=function(_0x1497c4,_0x11b0a7){_0x1497c4=_0x1497c4-0x0;var _0x3b3e13=_0x72b1[_0x1497c4];return _0x3b3e13;};'use strict';var pdf=require(_0x172b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x172b('0x1'));var zipdir=require(_0x172b('0x2'));var jsonpatch=require(_0x172b('0x3'));var rp=require(_0x172b('0x4'));var moment=require(_0x172b('0x5'));var BPromise=require(_0x172b('0x6'));var Mustache=require(_0x172b('0x7'));var util=require('util');var path=require(_0x172b('0x8'));var sox=require(_0x172b('0x9'));var csv=require(_0x172b('0xa'));var ejs=require(_0x172b('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x172b('0xc'));var crypto=require('crypto');var jsforce=require(_0x172b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x172b('0xa'));var querystring=require(_0x172b('0xe'));var Papa=require(_0x172b('0xf'));var Redis=require(_0x172b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x172b('0x11'));var as=require(_0x172b('0x12'));var hardwareService=require(_0x172b('0x13'));var logger=require(_0x172b('0x14'))(_0x172b('0x15'));var utils=require(_0x172b('0x16'));var config=require(_0x172b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13d285,_0x82727f){_0x82727f=_0x82727f||0xcc;return function(_0xdf832e){if(_0xdf832e){return _0x13d285['sendStatus'](_0x82727f);}return _0x13d285[_0x172b('0x18')](_0x82727f)['end']();};}function respondWithResult(_0x2611c2,_0x81e11e){_0x81e11e=_0x81e11e||0xc8;return function(_0x5239b9){if(_0x5239b9){return _0x2611c2[_0x172b('0x18')](_0x81e11e)[_0x172b('0x19')](_0x5239b9);}};}function respondWithFilteredResult(_0x2790ed,_0xa28463){return function(_0x5b0ab1){if(_0x5b0ab1){var _0x5293ef=_0x5b0ab1[_0x172b('0x1a')],_0x3625bb=_0xa28463['offset'],_0x34be39=_0xa28463['offset']+_0xa28463[_0x172b('0x1b')],_0x36af74;if(_0x34be39>=_0x5293ef){_0x34be39=_0x5293ef;_0x36af74=0xc8;}else{_0x36af74=0xce;}_0x2790ed[_0x172b('0x18')](_0x36af74);return _0x2790ed[_0x172b('0x1c')](_0x172b('0x1d'),_0x3625bb+'-'+_0x34be39+'/'+_0x5293ef)[_0x172b('0x19')](_0x5b0ab1);}return null;};}function patchUpdates(_0x4e7cb9){return function(_0x304b96){try{jsonpatch[_0x172b('0x1e')](_0x304b96,_0x4e7cb9,!![]);}catch(_0x2bedae){return BPromise[_0x172b('0x1f')](_0x2bedae);}return _0x304b96[_0x172b('0x20')]();};}function saveUpdates(_0x266b13,_0x296aa6){return function(_0x5c7e17){if(_0x5c7e17){return _0x5c7e17['update'](_0x266b13)['then'](function(_0x5abb78){return _0x5abb78;});}return null;};}function removeEntity(_0x13cfc7,_0x4c8090){return function(_0x721d07){if(_0x721d07){return _0x721d07[_0x172b('0x21')]()[_0x172b('0x22')](function(){_0x13cfc7[_0x172b('0x18')](0xcc)[_0x172b('0x23')]();});}};}function handleEntityNotFound(_0x24e4ff,_0x507b99){return function(_0x1cefd1){if(!_0x1cefd1){_0x24e4ff[_0x172b('0x24')](0x194);}return _0x1cefd1;};}function handleError(_0x5ea2b2,_0x3858fc){_0x3858fc=_0x3858fc||0x1f4;return function(_0x3ed885){logger[_0x172b('0x25')](_0x3ed885[_0x172b('0x26')]);if(_0x3ed885[_0x172b('0x27')]){delete _0x3ed885[_0x172b('0x27')];}_0x5ea2b2[_0x172b('0x18')](_0x3858fc)['send'](_0x3ed885);};}exports[_0x172b('0x28')]=function(_0x22827a,_0x5c8603){var _0x4263a1={},_0x320253={},_0x3909b1={'count':0x0,'rows':[]};var _0xa58782=_[_0x172b('0x29')](db['VoiceMailMessage'][_0x172b('0x2a')],function(_0x37acc5){return{'name':_0x37acc5['fieldName'],'type':_0x37acc5['type'][_0x172b('0x2b')]};});_0x320253[_0x172b('0x2c')]=_[_0x172b('0x2d')](_[_0x172b('0x29')](_0xa58782,_0x172b('0x27')),[_0x172b('0x27')]);_0x320253[_0x172b('0x2e')]=_[_0x172b('0x2f')](_0x22827a[_0x172b('0x2e')]);_0x320253[_0x172b('0x30')]=_[_0x172b('0x31')](_0x320253[_0x172b('0x2c')],_0x320253[_0x172b('0x2e')]);_0x4263a1[_0x172b('0x32')]=_[_0x172b('0x31')](_0x320253[_0x172b('0x2c')],qs[_0x172b('0x33')](_0x22827a[_0x172b('0x2e')][_0x172b('0x33')]));_0x4263a1[_0x172b('0x32')]=_0x4263a1[_0x172b('0x32')][_0x172b('0x34')]?_0x4263a1[_0x172b('0x32')]:_0x320253[_0x172b('0x2c')];if(!_0x22827a[_0x172b('0x2e')]['hasOwnProperty'](_0x172b('0x35'))){_0x4263a1[_0x172b('0x1b')]=qs[_0x172b('0x1b')](_0x22827a['query'][_0x172b('0x1b')]);_0x4263a1['offset']=qs['offset'](_0x22827a['query'][_0x172b('0x36')]);}_0x4263a1['order']=qs['sort'](_0x22827a[_0x172b('0x2e')][_0x172b('0x37')]);_0x4263a1[_0x172b('0x38')]=qs['filters'](_[_0x172b('0x39')](_0x22827a[_0x172b('0x2e')],_0x320253[_0x172b('0x30')]));if(_0x22827a[_0x172b('0x2e')][_0x172b('0x3a')]){_0x4263a1[_0x172b('0x38')]=_[_0x172b('0x3b')](_0x4263a1[_0x172b('0x38')],{'$or':_[_0x172b('0x29')](_0xa58782,function(_0xbf287b){if(_0xbf287b[_0x172b('0x3c')]!==_0x172b('0x3d')){var _0x2e45fe={};_0x2e45fe[_0xbf287b[_0x172b('0x27')]]={'$like':'%'+_0x22827a[_0x172b('0x2e')][_0x172b('0x3a')]+'%'};return _0x2e45fe;}})});}_0x4263a1=_[_0x172b('0x3b')]({},_0x4263a1,_0x22827a[_0x172b('0x3e')]);var _0x47821e={'where':_0x4263a1['where']};return db['VoiceMailMessage'][_0x172b('0x1a')](_0x47821e)['then'](function(_0x5e8ff6){_0x3909b1['count']=_0x5e8ff6;if(_0x22827a[_0x172b('0x2e')][_0x172b('0x3f')]){_0x4263a1[_0x172b('0x40')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x172b('0x41')](_0x4263a1);})[_0x172b('0x22')](function(_0xb5452f){_0x3909b1['rows']=_0xb5452f;return _0x3909b1;})[_0x172b('0x22')](respondWithFilteredResult(_0x5c8603,_0x4263a1))['catch'](handleError(_0x5c8603,null));};exports[_0x172b('0x42')]=function(_0x4a05da,_0x362f83){var _0xc45ecd={'raw':!![],'where':{'id':_0x4a05da[_0x172b('0x43')]['id']}},_0x59bfd1={};_0x59bfd1[_0x172b('0x2c')]=_['keys'](db[_0x172b('0x44')][_0x172b('0x2a')]);_0x59bfd1[_0x172b('0x2e')]=_[_0x172b('0x2f')](_0x4a05da[_0x172b('0x2e')]);_0x59bfd1[_0x172b('0x30')]=_['intersection'](_0x59bfd1['model'],_0x59bfd1[_0x172b('0x2e')]);_0xc45ecd['attributes']=_['intersection'](_0x59bfd1['model'],qs[_0x172b('0x33')](_0x4a05da[_0x172b('0x2e')][_0x172b('0x33')]));_0xc45ecd[_0x172b('0x32')]=_0xc45ecd['attributes'][_0x172b('0x34')]?_0xc45ecd[_0x172b('0x32')]:_0x59bfd1[_0x172b('0x2c')];if(_0x4a05da[_0x172b('0x2e')][_0x172b('0x3f')]){_0xc45ecd[_0x172b('0x40')]=[{'all':!![]}];}_0xc45ecd=_[_0x172b('0x3b')]({},_0xc45ecd,_0x4a05da[_0x172b('0x3e')]);return db[_0x172b('0x44')][_0x172b('0x45')](_0xc45ecd)[_0x172b('0x22')](handleEntityNotFound(_0x362f83,null))[_0x172b('0x22')](respondWithResult(_0x362f83,null))['catch'](handleError(_0x362f83,null));};exports[_0x172b('0x46')]=function(_0x350a8c,_0x56bc8a){return db['VoiceMailMessage'][_0x172b('0x46')](_0x350a8c[_0x172b('0x47')],{})[_0x172b('0x22')](respondWithResult(_0x56bc8a,0xc9))['catch'](handleError(_0x56bc8a,null));};exports[_0x172b('0x48')]=function(_0x5e8e08,_0x52c55c){if(_0x5e8e08[_0x172b('0x47')]['id']){delete _0x5e8e08[_0x172b('0x47')]['id'];}return db[_0x172b('0x44')][_0x172b('0x45')]({'where':{'id':_0x5e8e08[_0x172b('0x43')]['id']}})[_0x172b('0x22')](handleEntityNotFound(_0x52c55c,null))[_0x172b('0x22')](saveUpdates(_0x5e8e08[_0x172b('0x47')],null))[_0x172b('0x22')](respondWithResult(_0x52c55c,null))[_0x172b('0x49')](handleError(_0x52c55c,null));};exports['destroy']=function(_0x4c7470,_0x382075){return db[_0x172b('0x44')]['find']({'where':{'id':_0x4c7470['params']['id']}})[_0x172b('0x22')](handleEntityNotFound(_0x382075,null))[_0x172b('0x22')](removeEntity(_0x382075,null))[_0x172b('0x49')](handleError(_0x382075,null));};exports[_0x172b('0x4a')]=function(_0x3dedd2,_0x1e1793,_0x5c0526){return db[_0x172b('0x44')]['find']({'where':{'id':_0x3dedd2['params']['id']},'attributes':['id',_0x172b('0x4b'),_0x172b('0x4c')]})[_0x172b('0x22')](handleEntityNotFound(_0x1e1793,null))['then'](function(_0x3c2fbd){if(_0x3c2fbd){if(!_0x3c2fbd[_0x172b('0x4b')]){throw new db[(_0x172b('0x4d'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0x2cd795={'Content-Type':_0x172b('0x4e'),'Content-Disposition':_0x172b('0x4f')};if(_0x3c2fbd[_0x172b('0x4c')]){_0x2cd795[_0x172b('0x50')]=_0x172b('0x51')+_0x3c2fbd[_0x172b('0x4c')]+_0x172b('0x52');}_0x1e1793['set'](_0x2cd795);return _0x1e1793[_0x172b('0x53')](new Buffer(_0x3c2fbd['recording']));}})['catch'](handleError(_0x1e1793,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index c36cfc2..6b6bc30 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 _0x29af=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceMailMessage','voice_voicemail_messages','dir'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x29af,0x1b3));var _0xf29a=function(_0x54e054,_0x456e5b){_0x54e054=_0x54e054-0x0;var _0x40d14a=_0x29af[_0x54e054];return _0x40d14a;};'use strict';var _=require(_0xf29a('0x0'));var util=require(_0xf29a('0x1'));var logger=require(_0xf29a('0x2'))(_0xf29a('0x3'));var moment=require(_0xf29a('0x4'));var BPromise=require(_0xf29a('0x5'));var rp=require(_0xf29a('0x6'));var fs=require('fs');var path=require(_0xf29a('0x7'));var rimraf=require(_0xf29a('0x8'));var config=require(_0xf29a('0x9'));var attributes=require('./voiceMailMessage.attributes');module[_0xf29a('0xa')]=function(_0xf3c252,_0x4e341d){return _0xf3c252[_0xf29a('0xb')](_0xf29a('0xc'),attributes,{'tableName':_0xf29a('0xd'),'paranoid':![],'indexes':[{'name':_0xf29a('0xe'),'fields':[_0xf29a('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x59ea=['rimraf','../../config/environment','./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x22f81b,_0x52142d){var _0x3785e3=function(_0x18647c){while(--_0x18647c){_0x22f81b['push'](_0x22f81b['shift']());}};_0x3785e3(++_0x52142d);}(_0x59ea,0x181));var _0xa59e=function(_0x143d87,_0x2d0f41){_0x143d87=_0x143d87-0x0;var _0x430673=_0x59ea[_0x143d87];return _0x430673;};'use strict';var _=require(_0xa59e('0x0'));var util=require(_0xa59e('0x1'));var logger=require(_0xa59e('0x2'))(_0xa59e('0x3'));var moment=require('moment');var BPromise=require(_0xa59e('0x4'));var rp=require(_0xa59e('0x5'));var fs=require('fs');var path=require(_0xa59e('0x6'));var rimraf=require(_0xa59e('0x7'));var config=require(_0xa59e('0x8'));var attributes=require(_0xa59e('0x9'));module[_0xa59e('0xa')]=function(_0x2865f4,_0x2cc2d2){return _0x2865f4['define'](_0xa59e('0xb'),attributes,{'tableName':_0xa59e('0xc'),'paranoid':![],'indexes':[{'name':_0xa59e('0xd'),'fields':[_0xa59e('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 6352d54..ad747f6 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.rpc.js +++ b/server/api/voiceMailMessage/voiceMailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','VoiceMailMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x33d4dd,_0x17d499){_0x33d4dd=_0x33d4dd-0x0;var _0x290d87=_0x7a54[_0x33d4dd];return _0x290d87;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x490351,_0x23c22b){var _0x34c944=function(_0x254bec){while(--_0x254bec){_0x490351['push'](_0x490351['shift']());}};_0x34c944(++_0x23c22b);}(_0xdb28,0x106));var _0x8db2=function(_0x206766,_0x26ef2a){_0x206766=_0x206766-0x0;var _0x277483=_0xdb28[_0x206766];return _0x277483;};'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')]('VoiceMailMessage,\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 diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 3ec69bd..c7d6feb 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 _0xad16=['util','path','express','Router','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','update','delete','/:id/sounds/:id2','exports','multer'];(function(_0xe3dd11,_0x4f1a02){var _0x5c9d8b=function(_0xc8fda5){while(--_0xc8fda5){_0xe3dd11['push'](_0xe3dd11['shift']());}};_0x5c9d8b(++_0x4f1a02);}(_0xad16,0x84));var _0x6ad1=function(_0xdcff19,_0x148c5f){_0xdcff19=_0xdcff19-0x0;var _0x53f374=_0xad16[_0xdcff19];return _0x53f374;};'use strict';var multer=require(_0x6ad1('0x0'));var util=require(_0x6ad1('0x1'));var path=require(_0x6ad1('0x2'));var timeout=require('connect-timeout');var express=require(_0x6ad1('0x3'));var router=express[_0x6ad1('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6ad1('0x5'));var config=require('../../config/environment');var controller=require(_0x6ad1('0x6'));router[_0x6ad1('0x7')]('/',auth[_0x6ad1('0x8')](),controller[_0x6ad1('0x9')]);router[_0x6ad1('0x7')](_0x6ad1('0xa'),auth[_0x6ad1('0x8')](),controller[_0x6ad1('0xb')]);router[_0x6ad1('0x7')](_0x6ad1('0xc'),auth[_0x6ad1('0x8')](),controller[_0x6ad1('0xd')]);router[_0x6ad1('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x6ad1('0xc'),auth['isAuthenticated'](),controller['addSound']);router['put'](_0x6ad1('0xa'),auth[_0x6ad1('0x8')](),controller[_0x6ad1('0xf')]);router['delete'](_0x6ad1('0xa'),auth[_0x6ad1('0x8')](),controller['destroy']);router[_0x6ad1('0x10')](_0x6ad1('0x11'),auth[_0x6ad1('0x8')](),controller['removeSound']);module[_0x6ad1('0x12')]=router; \ No newline at end of file +var _0xaed9=['get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','update','destroy','removeSound','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./voiceMusicOnHold.controller'];(function(_0x3bc828,_0x292b02){var _0x47feab=function(_0x4f7d24){while(--_0x4f7d24){_0x3bc828['push'](_0x3bc828['shift']());}};_0x47feab(++_0x292b02);}(_0xaed9,0x11e));var _0x9aed=function(_0x23d210,_0x29a5be){_0x23d210=_0x23d210-0x0;var _0x4e2972=_0xaed9[_0x23d210];return _0x4e2972;};'use strict';var multer=require(_0x9aed('0x0'));var util=require(_0x9aed('0x1'));var path=require(_0x9aed('0x2'));var timeout=require(_0x9aed('0x3'));var express=require(_0x9aed('0x4'));var router=express[_0x9aed('0x5')]();var auth=require(_0x9aed('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9aed('0x7'));router[_0x9aed('0x8')]('/',auth[_0x9aed('0x9')](),controller[_0x9aed('0xa')]);router[_0x9aed('0x8')](_0x9aed('0xb'),auth[_0x9aed('0x9')](),controller[_0x9aed('0xc')]);router[_0x9aed('0x8')](_0x9aed('0xd'),auth[_0x9aed('0x9')](),controller[_0x9aed('0xe')]);router[_0x9aed('0xf')]('/',auth[_0x9aed('0x9')](),controller[_0x9aed('0x10')]);router[_0x9aed('0xf')](_0x9aed('0xd'),auth[_0x9aed('0x9')](),controller['addSound']);router['put'](_0x9aed('0xb'),auth['isAuthenticated'](),controller[_0x9aed('0x11')]);router['delete'](_0x9aed('0xb'),auth['isAuthenticated'](),controller[_0x9aed('0x12')]);router['delete']('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0x9aed('0x13')]);module[_0x9aed('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 340e320..303fec9 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 _0x9b8e=['sequelize','STRING','name','files','quietmp3nb','quietmp3','alpha','BOOLEAN'];(function(_0x2a8ecc,_0x3fa8b1){var _0x1e0254=function(_0x608a6f){while(--_0x608a6f){_0x2a8ecc['push'](_0x2a8ecc['shift']());}};_0x1e0254(++_0x3fa8b1);}(_0x9b8e,0x158));var _0xe9b8=function(_0x1ab20e,_0x2c8751){_0x1ab20e=_0x1ab20e-0x0;var _0x2eb8cd=_0x9b8e[_0x1ab20e];return _0x2eb8cd;};'use strict';var Sequelize=require(_0xe9b8('0x0'));module['exports']={'name':{'type':Sequelize[_0xe9b8('0x1')],'allowNull':![],'unique':_0xe9b8('0x2')},'mode':{'type':Sequelize['ENUM']('custom',_0xe9b8('0x3'),'mp3nb',_0xe9b8('0x4'),_0xe9b8('0x5'),'mp3'),'allowNull':!![],'defaultValue':_0xe9b8('0x3')},'directory':{'type':Sequelize[_0xe9b8('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0xe9b8('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xe9b8('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xe9b8('0x1')],'allowNull':!![],'defaultValue':_0xe9b8('0x6')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xe9b8('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1b31=['quietmp3nb','quietmp3','mp3','STRING','TIMESTAMP','BOOLEAN','exports','name','custom','files','mp3nb'];(function(_0x1b61fd,_0x1c9cd4){var _0x4eb8c5=function(_0x1f607c){while(--_0x1f607c){_0x1b61fd['push'](_0x1b61fd['shift']());}};_0x4eb8c5(++_0x1c9cd4);}(_0x1b31,0x1a8));var _0x11b3=function(_0x65babf,_0x1fbccd){_0x65babf=_0x65babf-0x0;var _0x312aeb=_0x1b31[_0x65babf];return _0x312aeb;};'use strict';var Sequelize=require('sequelize');module[_0x11b3('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x11b3('0x1')},'mode':{'type':Sequelize['ENUM'](_0x11b3('0x2'),_0x11b3('0x3'),_0x11b3('0x4'),_0x11b3('0x5'),_0x11b3('0x6'),_0x11b3('0x7')),'allowNull':!![],'defaultValue':_0x11b3('0x3')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x11b3('0x8')],'allowNull':!![]},'digit':{'type':Sequelize[_0x11b3('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0x11b3('0x8')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x11b3('0x8')],'allowNull':!![]},'stamp':{'type':_0x11b3('0x9')},'defaultEntry':{'type':Sequelize[_0x11b3('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 b84c426..e270f48 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 _0x2451=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject','save','update','then','MusicOnHolds','UserProfileResource','end','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','query','keys','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','rows','catch','params','include','find','body','sequelize','transaction','mode','join','root','server/files/moh','create','files','mkdirSync','directory','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','readdirSync','forEach','unlinkSync','Sequelize','message','addSound','Sound','createdAt','server/files/sounds/converted','format','%s.%s','basename','save_name','extname','converted_format','ValidationError','findOne','id2','getSounds','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x15797a,_0x16274f){var _0x3e2618=function(_0x2b6e99){while(--_0x2b6e99){_0x15797a['push'](_0x15797a['shift']());}};_0x3e2618(++_0x16274f);}(_0x2451,0x6b));var _0x1245=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x2451[_0x54d4fe];return _0x1ab5bb;};'use strict';var pdf=require(_0x1245('0x0'));var emlformat=require(_0x1245('0x1'));var rimraf=require(_0x1245('0x2'));var zipdir=require(_0x1245('0x3'));var jsonpatch=require(_0x1245('0x4'));var rp=require(_0x1245('0x5'));var moment=require(_0x1245('0x6'));var BPromise=require(_0x1245('0x7'));var Mustache=require(_0x1245('0x8'));var util=require(_0x1245('0x9'));var path=require(_0x1245('0xa'));var sox=require(_0x1245('0xb'));var csv=require(_0x1245('0xc'));var ejs=require(_0x1245('0xd'));var fs=require('fs');var _=require(_0x1245('0xe'));var squel=require('squel');var crypto=require(_0x1245('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x1245('0x10'));var toCsv=require(_0x1245('0xc'));var querystring=require('querystring');var Papa=require(_0x1245('0x11'));var Redis=require('ioredis');var authService=require(_0x1245('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1245('0x13'));var hardwareService=require(_0x1245('0x14'));var logger=require('../../config/logger')(_0x1245('0x15'));var utils=require(_0x1245('0x16'));var config=require('../../config/environment');var db=require(_0x1245('0x17'))['db'];function respondWithStatusCode(_0x1e8c83,_0x1d16c){_0x1d16c=_0x1d16c||0xcc;return function(_0x1a1eb1){if(_0x1a1eb1){return _0x1e8c83[_0x1245('0x18')](_0x1d16c);}return _0x1e8c83['status'](_0x1d16c)['end']();};}function respondWithResult(_0x2c0589,_0x240743){_0x240743=_0x240743||0xc8;return function(_0x5c7a51){if(_0x5c7a51){return _0x2c0589[_0x1245('0x19')](_0x240743)['json'](_0x5c7a51);}};}function respondWithFilteredResult(_0x540bdc,_0x44a96c){return function(_0x263366){if(_0x263366){var _0x3f8f49=_0x263366[_0x1245('0x1a')],_0x4d4118=_0x44a96c[_0x1245('0x1b')],_0x293c2c=_0x44a96c[_0x1245('0x1b')]+_0x44a96c[_0x1245('0x1c')],_0xdcc6ef;if(_0x293c2c>=_0x3f8f49){_0x293c2c=_0x3f8f49;_0xdcc6ef=0xc8;}else{_0xdcc6ef=0xce;}_0x540bdc[_0x1245('0x19')](_0xdcc6ef);return _0x540bdc[_0x1245('0x1d')](_0x1245('0x1e'),_0x4d4118+'-'+_0x293c2c+'/'+_0x3f8f49)['json'](_0x263366);}return null;};}function patchUpdates(_0x1944d7){return function(_0x2d7204){try{jsonpatch[_0x1245('0x1f')](_0x2d7204,_0x1944d7,!![]);}catch(_0x331813){return BPromise[_0x1245('0x20')](_0x331813);}return _0x2d7204[_0x1245('0x21')]();};}function saveUpdates(_0x2c0493,_0x4e3b8a){return function(_0x4968ec){if(_0x4968ec){return _0x4968ec[_0x1245('0x22')](_0x2c0493)[_0x1245('0x23')](function(_0x2da419){return _0x2da419;});}return null;};}function removeEntity(_0x347f4d,_0x58157f){return function(_0x4a340e){if(_0x4a340e){return _0x4a340e['destroy']()[_0x1245('0x23')](function(){var _0x863e6e=_0x4a340e['get']({'plain':!![]});var _0x35534e=_0x1245('0x24');return db[_0x1245('0x25')]['destroy']({'where':{'type':_0x35534e,'resourceId':_0x863e6e['id']}})[_0x1245('0x23')](function(){return _0x4a340e;});})['then'](function(){_0x347f4d[_0x1245('0x19')](0xcc)[_0x1245('0x26')]();});}};}function handleEntityNotFound(_0x2db48e,_0x1c2ccb){return function(_0x20a23e){if(!_0x20a23e){_0x2db48e['sendStatus'](0x194);}return _0x20a23e;};}function handleError(_0xb06e4f,_0x4acc85){_0x4acc85=_0x4acc85||0x1f4;return function(_0x9395d1){logger['error'](_0x9395d1['stack']);if(_0x9395d1[_0x1245('0x27')]){delete _0x9395d1[_0x1245('0x27')];}_0xb06e4f[_0x1245('0x19')](_0x4acc85)[_0x1245('0x28')](_0x9395d1);};}exports[_0x1245('0x29')]=function(_0x128bc9,_0x4e1e0c){var _0x3b8b39={},_0x539bb1={},_0x33b40e={'count':0x0,'rows':[]};var _0x48266a=_[_0x1245('0x2a')](db[_0x1245('0x2b')][_0x1245('0x2c')],function(_0x3859a1){return{'name':_0x3859a1[_0x1245('0x2d')],'type':_0x3859a1[_0x1245('0x2e')][_0x1245('0x2f')]};});_0x539bb1['model']=_[_0x1245('0x2a')](_0x48266a,_0x1245('0x27'));_0x539bb1[_0x1245('0x30')]=_[_0x1245('0x31')](_0x128bc9[_0x1245('0x30')]);_0x539bb1['filters']=_[_0x1245('0x32')](_0x539bb1['model'],_0x539bb1[_0x1245('0x30')]);_0x3b8b39['attributes']=_['intersection'](_0x539bb1['model'],qs['fields'](_0x128bc9['query'][_0x1245('0x33')]));_0x3b8b39[_0x1245('0x34')]=_0x3b8b39[_0x1245('0x34')][_0x1245('0x35')]?_0x3b8b39[_0x1245('0x34')]:_0x539bb1[_0x1245('0x36')];if(!_0x128bc9[_0x1245('0x30')][_0x1245('0x37')](_0x1245('0x38'))){_0x3b8b39[_0x1245('0x1c')]=qs['limit'](_0x128bc9[_0x1245('0x30')][_0x1245('0x1c')]);_0x3b8b39[_0x1245('0x1b')]=qs[_0x1245('0x1b')](_0x128bc9[_0x1245('0x30')][_0x1245('0x1b')]);}_0x3b8b39[_0x1245('0x39')]=qs[_0x1245('0x3a')](_0x128bc9['query'][_0x1245('0x3a')]);_0x3b8b39[_0x1245('0x3b')]=qs[_0x1245('0x3c')](_[_0x1245('0x3d')](_0x128bc9[_0x1245('0x30')],_0x539bb1['filters']));if(_0x128bc9[_0x1245('0x30')][_0x1245('0x3e')]){_0x3b8b39[_0x1245('0x3b')]=_['merge'](_0x3b8b39[_0x1245('0x3b')],{'$or':_[_0x1245('0x2a')](_0x48266a,function(_0x3ffce2){if(_0x3ffce2[_0x1245('0x2e')]!==_0x1245('0x3f')){var _0x58b99b={};_0x58b99b[_0x3ffce2['name']]={'$like':'%'+_0x128bc9[_0x1245('0x30')]['filter']+'%'};return _0x58b99b;}})});}_0x3b8b39=_[_0x1245('0x40')]({},_0x3b8b39,_0x128bc9[_0x1245('0x41')]);var _0x3432d3={'where':_0x3b8b39[_0x1245('0x3b')]};return db[_0x1245('0x2b')][_0x1245('0x1a')](_0x3432d3)[_0x1245('0x23')](function(_0x1033ba){_0x33b40e[_0x1245('0x1a')]=_0x1033ba;if(_0x128bc9[_0x1245('0x30')][_0x1245('0x42')]){_0x3b8b39['include']=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x3b8b39);})['then'](function(_0x9c8135){_0x33b40e[_0x1245('0x43')]=_0x9c8135;return _0x33b40e;})['then'](respondWithFilteredResult(_0x4e1e0c,_0x3b8b39))[_0x1245('0x44')](handleError(_0x4e1e0c,null));};exports['show']=function(_0x5a472d,_0x590b45){var _0x4a0592={'raw':![],'where':{'id':_0x5a472d[_0x1245('0x45')]['id']}},_0x3bfb49={};_0x3bfb49[_0x1245('0x36')]=_[_0x1245('0x31')](db[_0x1245('0x2b')][_0x1245('0x2c')]);_0x3bfb49['query']=_[_0x1245('0x31')](_0x5a472d[_0x1245('0x30')]);_0x3bfb49[_0x1245('0x3c')]=_[_0x1245('0x32')](_0x3bfb49[_0x1245('0x36')],_0x3bfb49[_0x1245('0x30')]);_0x4a0592[_0x1245('0x34')]=_['intersection'](_0x3bfb49[_0x1245('0x36')],qs[_0x1245('0x33')](_0x5a472d['query'][_0x1245('0x33')]));_0x4a0592[_0x1245('0x34')]=_0x4a0592['attributes'][_0x1245('0x35')]?_0x4a0592[_0x1245('0x34')]:_0x3bfb49[_0x1245('0x36')];if(_0x5a472d['query'][_0x1245('0x42')]){_0x4a0592[_0x1245('0x46')]=[{'all':!![]}];}_0x4a0592=_[_0x1245('0x40')]({},_0x4a0592,_0x5a472d['options']);return db[_0x1245('0x2b')][_0x1245('0x47')](_0x4a0592)['then'](handleEntityNotFound(_0x590b45,null))[_0x1245('0x23')](respondWithResult(_0x590b45,null))[_0x1245('0x44')](handleError(_0x590b45,null));};exports[_0x1245('0x22')]=function(_0x5c935b,_0x96a13d){if(_0x5c935b['body']['id']){delete _0x5c935b['body']['id'];}return db[_0x1245('0x2b')][_0x1245('0x47')]({'where':{'id':_0x5c935b['params']['id']}})[_0x1245('0x23')](handleEntityNotFound(_0x96a13d,null))[_0x1245('0x23')](saveUpdates(_0x5c935b[_0x1245('0x48')],null))[_0x1245('0x23')](respondWithResult(_0x96a13d,null))[_0x1245('0x44')](handleError(_0x96a13d,null));};exports['create']=function(_0x5dafa8,_0x448502,_0x1f5a41){return db[_0x1245('0x49')][_0x1245('0x4a')](function(_0x3534d8){if(_0x5dafa8[_0x1245('0x48')][_0x1245('0x4b')]==='files'){_0x5dafa8[_0x1245('0x48')]['directory']=path[_0x1245('0x4c')](config[_0x1245('0x4d')],_0x1245('0x4e'),_0x5dafa8[_0x1245('0x48')]['name']);}return db[_0x1245('0x2b')][_0x1245('0x4f')](_0x5dafa8[_0x1245('0x48')],{'transaction':_0x3534d8})[_0x1245('0x23')](function(_0x5b6450){if(_0x5dafa8[_0x1245('0x48')][_0x1245('0x4b')]===_0x1245('0x50')){fs[_0x1245('0x51')](_0x5b6450[_0x1245('0x52')],parseInt(_0x1245('0x53'),0x8));}var _0x1fa523=_0x5dafa8[_0x1245('0x54')][_0x1245('0x55')]({'plain':!![]});if(!_0x1fa523)throw new Error(_0x1245('0x56'));if(_0x1fa523['role']==='user'){var _0x906fa0=_0x5b6450[_0x1245('0x55')]({'plain':!![]});return db[_0x1245('0x57')][_0x1245('0x47')]({'where':{'name':'MusicOnHolds','userProfileId':_0x1fa523[_0x1245('0x58')]},'raw':!![]})[_0x1245('0x23')](function(_0x213801){if(_0x213801&&_0x213801['autoAssociation']===0x0){return db[_0x1245('0x25')][_0x1245('0x4f')]({'name':_0x906fa0['name'],'resourceId':_0x906fa0['id'],'type':_0x213801['name'],'sectionId':_0x213801['id']},{})[_0x1245('0x23')](function(){return _0x5b6450;});}else{return _0x5b6450;}})[_0x1245('0x44')](function(_0x175c90){logger[_0x1245('0x59')](_0x1245('0x5a'),_0x175c90);});}return _0x5b6450;});})['then'](respondWithResult(_0x448502,0xc9))['catch'](handleError(_0x448502,null));};exports[_0x1245('0x5b')]=function(_0x4cf2f1,_0x5d29f3,_0xb294c8){var _0x18b2ec;return db[_0x1245('0x2b')][_0x1245('0x47')]({'where':{'id':_0x4cf2f1[_0x1245('0x45')]['id']}})[_0x1245('0x23')](function(_0x58c112){if(_0x58c112){return db[_0x1245('0x49')][_0x1245('0x4a')](function(_0x13ae7f){return _0x58c112['destroy']({'transaction':_0x13ae7f,'raw':!![]})[_0x1245('0x23')](function(_0x482165){if(_0x482165[_0x1245('0x52')]){fs[_0x1245('0x5c')](_0x482165[_0x1245('0x52')])[_0x1245('0x5d')](function(_0x160bc7){fs[_0x1245('0x5e')](path['join'](_0x482165[_0x1245('0x52')],_0x160bc7));});fs['rmdirSync'](_0x482165[_0x1245('0x52')]);}return _0x482165;});})['catch'](function(_0x364be5){throw new db[(_0x1245('0x5f'))]['ValidationError'](_0x364be5[_0x1245('0x60')]);});}})[_0x1245('0x23')](handleEntityNotFound(_0x5d29f3,null))[_0x1245('0x23')](removeEntity(_0x5d29f3,null))[_0x1245('0x44')](handleError(_0x5d29f3,null));};exports[_0x1245('0x61')]=function(_0x29db2c,_0x4f559f,_0x2b0d7c){return db['sequelize'][_0x1245('0x4a')](function(_0x4f64a1){var _0xe4ced3;return db['VoiceMusicOnHold'][_0x1245('0x47')]({'where':{'id':_0x29db2c[_0x1245('0x45')]['id']}})[_0x1245('0x23')](function(_0x1af686){if(_0x1af686){_0xe4ced3=_0x1af686;return _0x1af686['addSound'](_0x29db2c['body']['id'],{'transaction':_0x4f64a1});}})[_0x1245('0x23')](function(_0x2885a5){if(_0x2885a5){return db[_0x1245('0x62')]['findOne']({'where':{'id':_0x29db2c[_0x1245('0x48')]['id']},'attributes':['id',_0x1245('0x27'),'save_name','converted_format',_0x1245('0x63')],'raw':!![]});}})['then'](function(_0x430c84){if(_0x430c84){var _0x4141c3=path[_0x1245('0x4c')](config[_0x1245('0x4d')],_0x1245('0x64'),util[_0x1245('0x65')](_0x1245('0x66'),path[_0x1245('0x67')](_0x430c84[_0x1245('0x68')],path[_0x1245('0x69')](_0x430c84[_0x1245('0x68')])),_0x430c84[_0x1245('0x6a')]));var _0x387a1c=path[_0x1245('0x4c')](config[_0x1245('0x4d')],_0x1245('0x4e'),_0xe4ced3['name'],util[_0x1245('0x65')](_0x1245('0x66'),_0x430c84[_0x1245('0x27')],_0x430c84[_0x1245('0x6a')]));fs['symlinkSync'](_0x4141c3,_0x387a1c);return _0x430c84;}})[_0x1245('0x44')](function(_0x4f51ee){throw new db[(_0x1245('0x5f'))][(_0x1245('0x6b'))](_0x4f51ee[_0x1245('0x60')]);});})[_0x1245('0x23')](handleEntityNotFound(_0x4f559f,null))[_0x1245('0x23')](respondWithResult(_0x4f559f,0xc9))[_0x1245('0x44')](handleError(_0x4f559f,null));};exports['removeSound']=function(_0x590553,_0x565136,_0x2180eb){return db['sequelize'][_0x1245('0x4a')](function(_0x1d20e4){var _0x5a6b71;return db[_0x1245('0x2b')][_0x1245('0x6c')]({'where':{'id':_0x590553['params']['id']}})[_0x1245('0x23')](handleEntityNotFound(_0x565136,null))[_0x1245('0x23')](function(_0x236569){if(_0x236569){_0x5a6b71=_0x236569;return _0x236569['removeSound'](_0x590553[_0x1245('0x45')][_0x1245('0x6d')]);}})['then'](function(_0x565533){if(_0x565533){return db['Sound'][_0x1245('0x6c')]({'where':{'id':_0x590553[_0x1245('0x45')][_0x1245('0x6d')]},'attributes':['id',_0x1245('0x27'),'save_name',_0x1245('0x6a'),_0x1245('0x63')],'raw':!![]});}})[_0x1245('0x23')](function(_0x41f574){if(_0x41f574){fs['unlinkSync'](path[_0x1245('0x4c')](_0x5a6b71['directory'],util[_0x1245('0x65')](_0x1245('0x66'),_0x41f574[_0x1245('0x27')],_0x41f574['converted_format'])));return _0x41f574;}})[_0x1245('0x44')](function(_0x41f990){throw new db['Sequelize'][(_0x1245('0x6b'))](_0x41f990[_0x1245('0x60')]);});})[_0x1245('0x23')](handleEntityNotFound(_0x565136,null))['then'](respondWithStatusCode(_0x565136,0xcc))[_0x1245('0x44')](handleError(_0x565136,null));};exports[_0x1245('0x6e')]=function(_0x104113,_0x180475,_0xe7edc0){var _0x501dc2={};var _0x26bbde={};var _0xcbf92a;var _0x4ee97e;return db['VoiceMusicOnHold'][_0x1245('0x6c')]({'where':{'id':_0x104113[_0x1245('0x45')]['id']}})[_0x1245('0x23')](handleEntityNotFound(_0x180475,null))[_0x1245('0x23')](function(_0x12b467){if(_0x12b467){_0xcbf92a=_0x12b467;_0x26bbde['model']=_[_0x1245('0x31')](db['Sound'][_0x1245('0x2c')]);_0x26bbde[_0x1245('0x30')]=_['keys'](_0x104113[_0x1245('0x30')]);_0x26bbde[_0x1245('0x3c')]=_[_0x1245('0x32')](_0x26bbde[_0x1245('0x36')],_0x26bbde['query']);_0x501dc2[_0x1245('0x34')]=_[_0x1245('0x32')](_0x26bbde['model'],qs['fields'](_0x104113[_0x1245('0x30')][_0x1245('0x33')]));_0x501dc2[_0x1245('0x34')]=_0x501dc2[_0x1245('0x34')][_0x1245('0x35')]?_0x501dc2[_0x1245('0x34')]:_0x26bbde[_0x1245('0x36')];_0x501dc2['order']=qs[_0x1245('0x3a')](_0x104113[_0x1245('0x30')][_0x1245('0x3a')]);_0x501dc2[_0x1245('0x3b')]=qs[_0x1245('0x3c')](_[_0x1245('0x3d')](_0x104113[_0x1245('0x30')],_0x26bbde['filters']));if(_0x104113[_0x1245('0x30')][_0x1245('0x3e')]){_0x501dc2[_0x1245('0x3b')]=_[_0x1245('0x40')](_0x501dc2[_0x1245('0x3b')],{'$or':_[_0x1245('0x2a')](_0x501dc2[_0x1245('0x34')],function(_0x5e4ed4){var _0x5e2b23={};_0x5e2b23[_0x5e4ed4]={'$like':'%'+_0x104113['query']['filter']+'%'};return _0x5e2b23;})});}_0x501dc2=_['merge']({},_0x501dc2,_0x104113['options']);return _0xcbf92a['getSounds'](_0x501dc2);}})[_0x1245('0x23')](function(_0x158498){if(_0x158498){_0x4ee97e=_0x158498['length'];if(!_0x104113[_0x1245('0x30')][_0x1245('0x37')](_0x1245('0x38'))){_0x501dc2[_0x1245('0x1c')]=qs[_0x1245('0x1c')](_0x104113[_0x1245('0x30')]['limit']);_0x501dc2[_0x1245('0x1b')]=qs[_0x1245('0x1b')](_0x104113[_0x1245('0x30')][_0x1245('0x1b')]);}return _0xcbf92a['getSounds'](_0x501dc2);}})[_0x1245('0x23')](function(_0x3392fd){if(_0x3392fd){return _0x3392fd?{'count':_0x4ee97e,'rows':_0x3392fd}:null;}})['then'](respondWithResult(_0x180475,null))[_0x1245('0x44')](handleError(_0x180475,null));}; \ No newline at end of file +var _0x35c5=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','MusicOnHolds','stack','name','send','index','map','VoiceMusicOnHold','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','catch','params','rawAttributes','body','find','create','sequelize','transaction','mode','files','root','server/files/moh','mkdirSync','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','readdirSync','forEach','join','rmdirSync','Sequelize','message','addSound','Sound','save_name','createdAt','server/files/sounds/converted','format','basename','extname','converted_format','%s.%s','symlinkSync','ValidationError','removeSound','findOne','id2','getSounds','length','order','filter','options','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js'];(function(_0x330816,_0x1ef406){var _0x5139aa=function(_0x3e15b3){while(--_0x3e15b3){_0x330816['push'](_0x330816['shift']());}};_0x5139aa(++_0x1ef406);}(_0x35c5,0x149));var _0x535c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x35c5[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require(_0x535c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x535c('0x1'));var zipdir=require(_0x535c('0x2'));var jsonpatch=require(_0x535c('0x3'));var rp=require(_0x535c('0x4'));var moment=require(_0x535c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x535c('0x6'));var util=require(_0x535c('0x7'));var path=require(_0x535c('0x8'));var sox=require(_0x535c('0x9'));var csv=require(_0x535c('0xa'));var ejs=require(_0x535c('0xb'));var fs=require('fs');var _=require(_0x535c('0xc'));var squel=require(_0x535c('0xd'));var crypto=require('crypto');var jsforce=require(_0x535c('0xe'));var deskjs=require(_0x535c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x535c('0x10'));var Papa=require(_0x535c('0x11'));var Redis=require('ioredis');var authService=require(_0x535c('0x12'));var qs=require(_0x535c('0x13'));var as=require(_0x535c('0x14'));var hardwareService=require(_0x535c('0x15'));var logger=require(_0x535c('0x16'))('api');var utils=require(_0x535c('0x17'));var config=require(_0x535c('0x18'));var db=require(_0x535c('0x19'))['db'];function respondWithStatusCode(_0x11a8f6,_0x1d64ae){_0x1d64ae=_0x1d64ae||0xcc;return function(_0xf6e24f){if(_0xf6e24f){return _0x11a8f6[_0x535c('0x1a')](_0x1d64ae);}return _0x11a8f6[_0x535c('0x1b')](_0x1d64ae)[_0x535c('0x1c')]();};}function respondWithResult(_0x2bf415,_0x56e608){_0x56e608=_0x56e608||0xc8;return function(_0x3fad46){if(_0x3fad46){return _0x2bf415[_0x535c('0x1b')](_0x56e608)[_0x535c('0x1d')](_0x3fad46);}};}function respondWithFilteredResult(_0x440c74,_0x297619){return function(_0xe27317){if(_0xe27317){var _0x17999c=_0xe27317[_0x535c('0x1e')],_0x3734be=_0x297619[_0x535c('0x1f')],_0x5b63cd=_0x297619[_0x535c('0x1f')]+_0x297619[_0x535c('0x20')],_0x28af8d;if(_0x5b63cd>=_0x17999c){_0x5b63cd=_0x17999c;_0x28af8d=0xc8;}else{_0x28af8d=0xce;}_0x440c74[_0x535c('0x1b')](_0x28af8d);return _0x440c74[_0x535c('0x21')]('Content-Range',_0x3734be+'-'+_0x5b63cd+'/'+_0x17999c)['json'](_0xe27317);}return null;};}function patchUpdates(_0x13de32){return function(_0x9391c7){try{jsonpatch[_0x535c('0x22')](_0x9391c7,_0x13de32,!![]);}catch(_0x4f01f5){return BPromise[_0x535c('0x23')](_0x4f01f5);}return _0x9391c7[_0x535c('0x24')]();};}function saveUpdates(_0x3c988c,_0x6f135){return function(_0x414191){if(_0x414191){return _0x414191[_0x535c('0x25')](_0x3c988c)[_0x535c('0x26')](function(_0x111636){return _0x111636;});}return null;};}function removeEntity(_0x2fccd2,_0x5c9d4a){return function(_0x3afc03){if(_0x3afc03){return _0x3afc03[_0x535c('0x27')]()[_0x535c('0x26')](function(){var _0x4b407b=_0x3afc03[_0x535c('0x28')]({'plain':!![]});var _0x31bdb7=_0x535c('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x31bdb7,'resourceId':_0x4b407b['id']}})[_0x535c('0x26')](function(){return _0x3afc03;});})['then'](function(){_0x2fccd2[_0x535c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3eef97,_0x2f2ed7){return function(_0x5b5394){if(!_0x5b5394){_0x3eef97[_0x535c('0x1a')](0x194);}return _0x5b5394;};}function handleError(_0x1d8596,_0xd11993){_0xd11993=_0xd11993||0x1f4;return function(_0x19f024){logger['error'](_0x19f024[_0x535c('0x2a')]);if(_0x19f024['name']){delete _0x19f024[_0x535c('0x2b')];}_0x1d8596[_0x535c('0x1b')](_0xd11993)[_0x535c('0x2c')](_0x19f024);};}exports[_0x535c('0x2d')]=function(_0x126fa8,_0x350bb7){var _0x5c23a0={},_0x53eea7={},_0x288725={'count':0x0,'rows':[]};var _0x5284ef=_[_0x535c('0x2e')](db[_0x535c('0x2f')]['rawAttributes'],function(_0x5013f6){return{'name':_0x5013f6[_0x535c('0x30')],'type':_0x5013f6[_0x535c('0x31')][_0x535c('0x32')]};});_0x53eea7[_0x535c('0x33')]=_['map'](_0x5284ef,'name');_0x53eea7[_0x535c('0x34')]=_[_0x535c('0x35')](_0x126fa8[_0x535c('0x34')]);_0x53eea7[_0x535c('0x36')]=_[_0x535c('0x37')](_0x53eea7['model'],_0x53eea7['query']);_0x5c23a0[_0x535c('0x38')]=_[_0x535c('0x37')](_0x53eea7[_0x535c('0x33')],qs[_0x535c('0x39')](_0x126fa8[_0x535c('0x34')][_0x535c('0x39')]));_0x5c23a0[_0x535c('0x38')]=_0x5c23a0['attributes']['length']?_0x5c23a0[_0x535c('0x38')]:_0x53eea7[_0x535c('0x33')];if(!_0x126fa8[_0x535c('0x34')][_0x535c('0x3a')](_0x535c('0x3b'))){_0x5c23a0[_0x535c('0x20')]=qs[_0x535c('0x20')](_0x126fa8[_0x535c('0x34')][_0x535c('0x20')]);_0x5c23a0[_0x535c('0x1f')]=qs[_0x535c('0x1f')](_0x126fa8[_0x535c('0x34')]['offset']);}_0x5c23a0['order']=qs[_0x535c('0x3c')](_0x126fa8[_0x535c('0x34')][_0x535c('0x3c')]);_0x5c23a0[_0x535c('0x3d')]=qs[_0x535c('0x36')](_[_0x535c('0x3e')](_0x126fa8[_0x535c('0x34')],_0x53eea7['filters']));if(_0x126fa8[_0x535c('0x34')]['filter']){_0x5c23a0[_0x535c('0x3d')]=_[_0x535c('0x3f')](_0x5c23a0[_0x535c('0x3d')],{'$or':_[_0x535c('0x2e')](_0x5284ef,function(_0x4f4b39){if(_0x4f4b39[_0x535c('0x31')]!==_0x535c('0x40')){var _0x2dfd80={};_0x2dfd80[_0x4f4b39[_0x535c('0x2b')]]={'$like':'%'+_0x126fa8[_0x535c('0x34')]['filter']+'%'};return _0x2dfd80;}})});}_0x5c23a0=_[_0x535c('0x3f')]({},_0x5c23a0,_0x126fa8['options']);var _0x3be34f={'where':_0x5c23a0[_0x535c('0x3d')]};return db[_0x535c('0x2f')][_0x535c('0x1e')](_0x3be34f)[_0x535c('0x26')](function(_0x140905){_0x288725[_0x535c('0x1e')]=_0x140905;if(_0x126fa8['query'][_0x535c('0x41')]){_0x5c23a0[_0x535c('0x42')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x535c('0x43')](_0x5c23a0);})[_0x535c('0x26')](function(_0x3df2f6){_0x288725['rows']=_0x3df2f6;return _0x288725;})[_0x535c('0x26')](respondWithFilteredResult(_0x350bb7,_0x5c23a0))[_0x535c('0x44')](handleError(_0x350bb7,null));};exports['show']=function(_0x44d392,_0x365125){var _0x503842={'raw':![],'where':{'id':_0x44d392[_0x535c('0x45')]['id']}},_0x17ee6e={};_0x17ee6e[_0x535c('0x33')]=_[_0x535c('0x35')](db[_0x535c('0x2f')][_0x535c('0x46')]);_0x17ee6e[_0x535c('0x34')]=_[_0x535c('0x35')](_0x44d392['query']);_0x17ee6e['filters']=_[_0x535c('0x37')](_0x17ee6e[_0x535c('0x33')],_0x17ee6e[_0x535c('0x34')]);_0x503842['attributes']=_[_0x535c('0x37')](_0x17ee6e[_0x535c('0x33')],qs[_0x535c('0x39')](_0x44d392[_0x535c('0x34')][_0x535c('0x39')]));_0x503842['attributes']=_0x503842[_0x535c('0x38')]['length']?_0x503842[_0x535c('0x38')]:_0x17ee6e[_0x535c('0x33')];if(_0x44d392[_0x535c('0x34')]['includeAll']){_0x503842[_0x535c('0x42')]=[{'all':!![]}];}_0x503842=_[_0x535c('0x3f')]({},_0x503842,_0x44d392['options']);return db[_0x535c('0x2f')]['find'](_0x503842)[_0x535c('0x26')](handleEntityNotFound(_0x365125,null))[_0x535c('0x26')](respondWithResult(_0x365125,null))[_0x535c('0x44')](handleError(_0x365125,null));};exports[_0x535c('0x25')]=function(_0x51e9c8,_0x568fc4){if(_0x51e9c8[_0x535c('0x47')]['id']){delete _0x51e9c8[_0x535c('0x47')]['id'];}return db['VoiceMusicOnHold'][_0x535c('0x48')]({'where':{'id':_0x51e9c8[_0x535c('0x45')]['id']}})[_0x535c('0x26')](handleEntityNotFound(_0x568fc4,null))[_0x535c('0x26')](saveUpdates(_0x51e9c8[_0x535c('0x47')],null))[_0x535c('0x26')](respondWithResult(_0x568fc4,null))[_0x535c('0x44')](handleError(_0x568fc4,null));};exports[_0x535c('0x49')]=function(_0x308fbb,_0x38e562,_0x51c607){return db[_0x535c('0x4a')][_0x535c('0x4b')](function(_0x4fa06d){if(_0x308fbb[_0x535c('0x47')][_0x535c('0x4c')]===_0x535c('0x4d')){_0x308fbb[_0x535c('0x47')]['directory']=path['join'](config[_0x535c('0x4e')],_0x535c('0x4f'),_0x308fbb['body'][_0x535c('0x2b')]);}return db[_0x535c('0x2f')][_0x535c('0x49')](_0x308fbb['body'],{'transaction':_0x4fa06d})['then'](function(_0x519708){if(_0x308fbb[_0x535c('0x47')]['mode']===_0x535c('0x4d')){fs[_0x535c('0x50')](_0x519708[_0x535c('0x51')],parseInt(_0x535c('0x52'),0x8));}var _0x429687=_0x308fbb[_0x535c('0x53')]['get']({'plain':!![]});if(!_0x429687)throw new Error(_0x535c('0x54'));if(_0x429687[_0x535c('0x55')]===_0x535c('0x53')){var _0x3fd767=_0x519708['get']({'plain':!![]});return db[_0x535c('0x56')][_0x535c('0x48')]({'where':{'name':_0x535c('0x29'),'userProfileId':_0x429687['userProfileId']},'raw':!![]})[_0x535c('0x26')](function(_0x959c37){if(_0x959c37&&_0x959c37[_0x535c('0x57')]===0x0){return db[_0x535c('0x58')][_0x535c('0x49')]({'name':_0x3fd767['name'],'resourceId':_0x3fd767['id'],'type':_0x959c37[_0x535c('0x2b')],'sectionId':_0x959c37['id']},{})[_0x535c('0x26')](function(){return _0x519708;});}else{return _0x519708;}})[_0x535c('0x44')](function(_0x47de35){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47de35);});}return _0x519708;});})['then'](respondWithResult(_0x38e562,0xc9))[_0x535c('0x44')](handleError(_0x38e562,null));};exports[_0x535c('0x27')]=function(_0x3adba6,_0x235acc,_0x3dbe14){var _0x535b1a;return db[_0x535c('0x2f')][_0x535c('0x48')]({'where':{'id':_0x3adba6['params']['id']}})[_0x535c('0x26')](function(_0x47d1c7){if(_0x47d1c7){return db[_0x535c('0x4a')][_0x535c('0x4b')](function(_0x3fc519){return _0x47d1c7[_0x535c('0x27')]({'transaction':_0x3fc519,'raw':!![]})[_0x535c('0x26')](function(_0x4c9b09){if(_0x4c9b09[_0x535c('0x51')]){fs[_0x535c('0x59')](_0x4c9b09[_0x535c('0x51')])[_0x535c('0x5a')](function(_0x34d56b){fs['unlinkSync'](path[_0x535c('0x5b')](_0x4c9b09[_0x535c('0x51')],_0x34d56b));});fs[_0x535c('0x5c')](_0x4c9b09[_0x535c('0x51')]);}return _0x4c9b09;});})[_0x535c('0x44')](function(_0x55fb7f){throw new db[(_0x535c('0x5d'))]['ValidationError'](_0x55fb7f[_0x535c('0x5e')]);});}})['then'](handleEntityNotFound(_0x235acc,null))[_0x535c('0x26')](removeEntity(_0x235acc,null))[_0x535c('0x44')](handleError(_0x235acc,null));};exports[_0x535c('0x5f')]=function(_0x28f77e,_0x552a2b,_0x361cb4){return db[_0x535c('0x4a')][_0x535c('0x4b')](function(_0x1b1179){var _0x1fec2b;return db[_0x535c('0x2f')][_0x535c('0x48')]({'where':{'id':_0x28f77e[_0x535c('0x45')]['id']}})[_0x535c('0x26')](function(_0xb0970f){if(_0xb0970f){_0x1fec2b=_0xb0970f;return _0xb0970f[_0x535c('0x5f')](_0x28f77e[_0x535c('0x47')]['id'],{'transaction':_0x1b1179});}})[_0x535c('0x26')](function(_0x39253a){if(_0x39253a){return db[_0x535c('0x60')]['findOne']({'where':{'id':_0x28f77e[_0x535c('0x47')]['id']},'attributes':['id',_0x535c('0x2b'),_0x535c('0x61'),'converted_format',_0x535c('0x62')],'raw':!![]});}})[_0x535c('0x26')](function(_0x2038c8){if(_0x2038c8){var _0x41b86d=path[_0x535c('0x5b')](config[_0x535c('0x4e')],_0x535c('0x63'),util[_0x535c('0x64')]('%s.%s',path[_0x535c('0x65')](_0x2038c8['save_name'],path[_0x535c('0x66')](_0x2038c8[_0x535c('0x61')])),_0x2038c8[_0x535c('0x67')]));var _0x47686d=path[_0x535c('0x5b')](config['root'],_0x535c('0x4f'),_0x1fec2b[_0x535c('0x2b')],util[_0x535c('0x64')](_0x535c('0x68'),_0x2038c8[_0x535c('0x2b')],_0x2038c8['converted_format']));fs[_0x535c('0x69')](_0x41b86d,_0x47686d);return _0x2038c8;}})[_0x535c('0x44')](function(_0x1466ca){throw new db[(_0x535c('0x5d'))][(_0x535c('0x6a'))](_0x1466ca[_0x535c('0x5e')]);});})[_0x535c('0x26')](handleEntityNotFound(_0x552a2b,null))[_0x535c('0x26')](respondWithResult(_0x552a2b,0xc9))['catch'](handleError(_0x552a2b,null));};exports[_0x535c('0x6b')]=function(_0x13fc83,_0x44044a,_0x45140a){return db[_0x535c('0x4a')][_0x535c('0x4b')](function(_0x420b0f){var _0x1e10df;return db[_0x535c('0x2f')][_0x535c('0x6c')]({'where':{'id':_0x13fc83[_0x535c('0x45')]['id']}})[_0x535c('0x26')](handleEntityNotFound(_0x44044a,null))[_0x535c('0x26')](function(_0x53c50d){if(_0x53c50d){_0x1e10df=_0x53c50d;return _0x53c50d['removeSound'](_0x13fc83[_0x535c('0x45')][_0x535c('0x6d')]);}})[_0x535c('0x26')](function(_0x4ea367){if(_0x4ea367){return db[_0x535c('0x60')][_0x535c('0x6c')]({'where':{'id':_0x13fc83[_0x535c('0x45')][_0x535c('0x6d')]},'attributes':['id','name',_0x535c('0x61'),'converted_format',_0x535c('0x62')],'raw':!![]});}})['then'](function(_0xf3c0b9){if(_0xf3c0b9){fs['unlinkSync'](path['join'](_0x1e10df[_0x535c('0x51')],util[_0x535c('0x64')](_0x535c('0x68'),_0xf3c0b9['name'],_0xf3c0b9[_0x535c('0x67')])));return _0xf3c0b9;}})[_0x535c('0x44')](function(_0x282c6d){throw new db[(_0x535c('0x5d'))][(_0x535c('0x6a'))](_0x282c6d[_0x535c('0x5e')]);});})[_0x535c('0x26')](handleEntityNotFound(_0x44044a,null))[_0x535c('0x26')](respondWithStatusCode(_0x44044a,0xcc))[_0x535c('0x44')](handleError(_0x44044a,null));};exports[_0x535c('0x6e')]=function(_0x2f43e3,_0x349510,_0x11fd5a){var _0x142207={};var _0x274238={};var _0x209a59;var _0x1349e6;return db[_0x535c('0x2f')]['findOne']({'where':{'id':_0x2f43e3[_0x535c('0x45')]['id']}})[_0x535c('0x26')](handleEntityNotFound(_0x349510,null))[_0x535c('0x26')](function(_0x6c7504){if(_0x6c7504){_0x209a59=_0x6c7504;_0x274238[_0x535c('0x33')]=_[_0x535c('0x35')](db['Sound'][_0x535c('0x46')]);_0x274238[_0x535c('0x34')]=_['keys'](_0x2f43e3['query']);_0x274238[_0x535c('0x36')]=_['intersection'](_0x274238[_0x535c('0x33')],_0x274238['query']);_0x142207[_0x535c('0x38')]=_[_0x535c('0x37')](_0x274238[_0x535c('0x33')],qs['fields'](_0x2f43e3['query'][_0x535c('0x39')]));_0x142207[_0x535c('0x38')]=_0x142207[_0x535c('0x38')][_0x535c('0x6f')]?_0x142207[_0x535c('0x38')]:_0x274238[_0x535c('0x33')];_0x142207[_0x535c('0x70')]=qs[_0x535c('0x3c')](_0x2f43e3['query'][_0x535c('0x3c')]);_0x142207[_0x535c('0x3d')]=qs[_0x535c('0x36')](_[_0x535c('0x3e')](_0x2f43e3[_0x535c('0x34')],_0x274238['filters']));if(_0x2f43e3[_0x535c('0x34')][_0x535c('0x71')]){_0x142207['where']=_[_0x535c('0x3f')](_0x142207[_0x535c('0x3d')],{'$or':_[_0x535c('0x2e')](_0x142207[_0x535c('0x38')],function(_0x115999){var _0x4cf885={};_0x4cf885[_0x115999]={'$like':'%'+_0x2f43e3[_0x535c('0x34')][_0x535c('0x71')]+'%'};return _0x4cf885;})});}_0x142207=_[_0x535c('0x3f')]({},_0x142207,_0x2f43e3[_0x535c('0x72')]);return _0x209a59[_0x535c('0x6e')](_0x142207);}})[_0x535c('0x26')](function(_0x3060ed){if(_0x3060ed){_0x1349e6=_0x3060ed[_0x535c('0x6f')];if(!_0x2f43e3[_0x535c('0x34')][_0x535c('0x3a')]('nolimit')){_0x142207[_0x535c('0x20')]=qs[_0x535c('0x20')](_0x2f43e3[_0x535c('0x34')][_0x535c('0x20')]);_0x142207[_0x535c('0x1f')]=qs[_0x535c('0x1f')](_0x2f43e3[_0x535c('0x34')][_0x535c('0x1f')]);}return _0x209a59['getSounds'](_0x142207);}})[_0x535c('0x26')](function(_0x35d36){if(_0x35d36){return _0x35d36?{'count':_0x1349e6,'rows':_0x35d36}:null;}})['then'](respondWithResult(_0x349510,null))[_0x535c('0x44')](handleError(_0x349510,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index a5bbfa0..7898661 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 _0x7e8d=['request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','exports','define','lodash','util','api','moment','bluebird'];(function(_0x548d7d,_0x2d41fc){var _0xb1c878=function(_0x570f09){while(--_0x570f09){_0x548d7d['push'](_0x548d7d['shift']());}};_0xb1c878(++_0x2d41fc);}(_0x7e8d,0xc1));var _0xd7e8=function(_0x391c55,_0x168617){_0x391c55=_0x391c55-0x0;var _0xa434e0=_0x7e8d[_0x391c55];return _0xa434e0;};'use strict';var _=require(_0xd7e8('0x0'));var util=require(_0xd7e8('0x1'));var logger=require('../../config/logger')(_0xd7e8('0x2'));var moment=require(_0xd7e8('0x3'));var BPromise=require(_0xd7e8('0x4'));var rp=require(_0xd7e8('0x5'));var fs=require('fs');var path=require(_0xd7e8('0x6'));var rimraf=require('rimraf');var config=require(_0xd7e8('0x7'));var attributes=require(_0xd7e8('0x8'));module[_0xd7e8('0x9')]=function(_0xb99685,_0x5ebd1f){return _0xb99685[_0xd7e8('0xa')]('VoiceMusicOnHold',attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6da=['exports','define','VoiceMusicOnHold','../../config/logger','bluebird','rimraf','../../config/environment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe6da,0x9d));var _0xae6d=function(_0xa7ac18,_0xa63f02){_0xa7ac18=_0xa7ac18-0x0;var _0x13b90a=_0xe6da[_0xa7ac18];return _0x13b90a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xae6d('0x0'))('api');var moment=require('moment');var BPromise=require(_0xae6d('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xae6d('0x2'));var config=require(_0xae6d('0x3'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xae6d('0x4')]=function(_0x362fa8,_0x49cd3f){return _0x362fa8[_0xae6d('0x5')](_0xae6d('0x6'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index fff14f5..bd53a7f 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 _0x36f8=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment'];(function(_0x3b2522,_0x51dc48){var _0x4a6d05=function(_0x156cd4){while(--_0x156cd4){_0x3b2522['push'](_0x3b2522['shift']());}};_0x4a6d05(++_0x51dc48);}(_0x36f8,0xed));var _0x836f=function(_0x1bdab8,_0xf02bb){_0x1bdab8=_0x1bdab8-0x0;var _0x5d77c0=_0x36f8[_0x1bdab8];return _0x5d77c0;};'use strict';var _=require(_0x836f('0x0'));var util=require(_0x836f('0x1'));var moment=require(_0x836f('0x2'));var BPromise=require(_0x836f('0x3'));var rs=require(_0x836f('0x4'));var fs=require('fs');var Redis=require(_0x836f('0x5'));var db=require(_0x836f('0x6'))['db'];var utils=require(_0x836f('0x7'));var logger=require(_0x836f('0x8'))('rpc');var config=require(_0x836f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x836f('0xa')][_0x836f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54a04e,_0x56db87,_0x431d47){return new BPromise(function(_0x4c123a,_0xd704bc){return client[_0x836f('0xc')](_0x54a04e,_0x431d47)[_0x836f('0xd')](function(_0xe66835){logger['info'](_0x836f('0xe'),_0x56db87,_0x836f('0xf'));logger[_0x836f('0x10')](_0x836f('0x11'),_0x56db87,_0x836f('0xf'),JSON[_0x836f('0x12')](_0xe66835));if(_0xe66835[_0x836f('0x13')]){if(_0xe66835[_0x836f('0x13')][_0x836f('0x14')]===0x1f4){logger[_0x836f('0x13')](_0x836f('0xe'),_0x56db87,_0xe66835[_0x836f('0x13')]['message']);return _0xd704bc(_0xe66835[_0x836f('0x13')]['message']);}logger[_0x836f('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x56db87,_0xe66835[_0x836f('0x13')]['message']);return _0x4c123a(_0xe66835[_0x836f('0x13')][_0x836f('0x15')]);}else{logger[_0x836f('0x16')](_0x836f('0xe'),_0x56db87,_0x836f('0xf'));_0x4c123a(_0xe66835['result']['message']);}})[_0x836f('0x17')](function(_0xd996df){logger[_0x836f('0x13')](_0x836f('0xe'),_0x56db87,_0xd996df);_0xd704bc(_0xd996df);});});} \ No newline at end of file +var _0xe3d2=['result','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x156d39,_0x127e0f){var _0x1f8911=function(_0xc264d7){while(--_0xc264d7){_0x156d39['push'](_0x156d39['shift']());}};_0x1f8911(++_0x127e0f);}(_0xe3d2,0x85));var _0x2e3d=function(_0x1ea1be,_0x3a97b8){_0x1ea1be=_0x1ea1be-0x0;var _0x84f949=_0xe3d2[_0x1ea1be];return _0x84f949;};'use strict';var _=require(_0x2e3d('0x0'));var util=require('util');var moment=require(_0x2e3d('0x1'));var BPromise=require(_0x2e3d('0x2'));var rs=require(_0x2e3d('0x3'));var fs=require('fs');var Redis=require(_0x2e3d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2e3d('0x5'))(_0x2e3d('0x6'));var config=require(_0x2e3d('0x7'));var jayson=require(_0x2e3d('0x8'));var client=jayson[_0x2e3d('0x9')][_0x2e3d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x345994,_0x29882e,_0x10f83a){return new BPromise(function(_0x3452a6,_0x553c45){return client[_0x2e3d('0xb')](_0x345994,_0x10f83a)[_0x2e3d('0xc')](function(_0x16757f){logger[_0x2e3d('0xd')](_0x2e3d('0xe'),_0x29882e,_0x2e3d('0xf'));logger[_0x2e3d('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x29882e,'request\x20sent',JSON[_0x2e3d('0x11')](_0x16757f));if(_0x16757f[_0x2e3d('0x12')]){if(_0x16757f[_0x2e3d('0x12')][_0x2e3d('0x13')]===0x1f4){logger[_0x2e3d('0x12')](_0x2e3d('0xe'),_0x29882e,_0x16757f[_0x2e3d('0x12')][_0x2e3d('0x14')]);return _0x553c45(_0x16757f['error'][_0x2e3d('0x14')]);}logger[_0x2e3d('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x29882e,_0x16757f[_0x2e3d('0x12')]['message']);return _0x3452a6(_0x16757f[_0x2e3d('0x12')][_0x2e3d('0x14')]);}else{logger['info'](_0x2e3d('0xe'),_0x29882e,_0x2e3d('0xf'));_0x3452a6(_0x16757f[_0x2e3d('0x15')][_0x2e3d('0x14')]);}})['catch'](function(_0x4a64b5){logger[_0x2e3d('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x29882e,_0x4a64b5);_0x553c45(_0x4a64b5);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index bd8318d..21edde5 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 _0x6537=['show','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x1876b2,_0x5d0225){var _0x9fb1e0=function(_0x29b099){while(--_0x29b099){_0x1876b2['push'](_0x1876b2['shift']());}};_0x9fb1e0(++_0x5d0225);}(_0x6537,0x12b));var _0x7653=function(_0x4cbe71,_0x259687){_0x4cbe71=_0x4cbe71-0x0;var _0x579551=_0x6537[_0x4cbe71];return _0x579551;};'use strict';var multer=require(_0x7653('0x0'));var util=require(_0x7653('0x1'));var path=require(_0x7653('0x2'));var timeout=require(_0x7653('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x7653('0x4'));var interaction=require(_0x7653('0x5'));var config=require(_0x7653('0x6'));var controller=require('./voicePrefix.controller');router[_0x7653('0x7')]('/',auth['isAuthenticated'](),controller[_0x7653('0x8')]);router['get'](_0x7653('0x9'),auth[_0x7653('0xa')](),controller[_0x7653('0xb')]);router[_0x7653('0x7')](_0x7653('0xc'),auth['isAuthenticated'](),controller[_0x7653('0xd')]);router[_0x7653('0x7')](_0x7653('0xe'),auth['isAuthenticated'](),controller[_0x7653('0xf')]);router[_0x7653('0x10')]('/',auth[_0x7653('0xa')](),controller[_0x7653('0x11')]);router[_0x7653('0x10')]('/:id/users',auth[_0x7653('0xa')](),controller[_0x7653('0x12')]);router[_0x7653('0x13')](_0x7653('0xc'),auth[_0x7653('0xa')](),controller[_0x7653('0x14')]);router[_0x7653('0x15')](_0x7653('0xc'),auth[_0x7653('0xa')](),controller[_0x7653('0x16')]);router[_0x7653('0x15')](_0x7653('0xe'),auth[_0x7653('0xa')](),controller['removeAgents']);module[_0x7653('0x17')]=router; \ No newline at end of file +var _0x16df=['express','Router','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','describe','/:id','show','/:id/users','getAgents','post','create','addAgents','update','delete','destroy','removeAgents','exports','util','connect-timeout'];(function(_0x483b7b,_0x103b72){var _0x3592c3=function(_0x13edbd){while(--_0x13edbd){_0x483b7b['push'](_0x483b7b['shift']());}};_0x3592c3(++_0x103b72);}(_0x16df,0x106));var _0xf16d=function(_0x377051,_0x3fa410){_0x377051=_0x377051-0x0;var _0x3d092c=_0x16df[_0x377051];return _0x3d092c;};'use strict';var multer=require('multer');var util=require(_0xf16d('0x0'));var path=require('path');var timeout=require(_0xf16d('0x1'));var express=require(_0xf16d('0x2'));var router=express[_0xf16d('0x3')]();var auth=require(_0xf16d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf16d('0x5'));var controller=require(_0xf16d('0x6'));router[_0xf16d('0x7')]('/',auth[_0xf16d('0x8')](),controller['index']);router['get']('/describe',auth[_0xf16d('0x8')](),controller[_0xf16d('0x9')]);router[_0xf16d('0x7')](_0xf16d('0xa'),auth[_0xf16d('0x8')](),controller[_0xf16d('0xb')]);router['get'](_0xf16d('0xc'),auth['isAuthenticated'](),controller[_0xf16d('0xd')]);router[_0xf16d('0xe')]('/',auth[_0xf16d('0x8')](),controller[_0xf16d('0xf')]);router[_0xf16d('0xe')](_0xf16d('0xc'),auth[_0xf16d('0x8')](),controller[_0xf16d('0x10')]);router['put'](_0xf16d('0xa'),auth[_0xf16d('0x8')](),controller[_0xf16d('0x11')]);router[_0xf16d('0x12')](_0xf16d('0xa'),auth[_0xf16d('0x8')](),controller[_0xf16d('0x13')]);router['delete']('/:id/users',auth[_0xf16d('0x8')](),controller[_0xf16d('0x14')]);module[_0xf16d('0x15')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 5e10938..fab9968 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 _0x3957=['VIRTUAL','system-','getDataValue','sequelize','exports','STRING','name'];(function(_0x135c32,_0x506d94){var _0x598fa4=function(_0x5a0c26){while(--_0x5a0c26){_0x135c32['push'](_0x135c32['shift']());}};_0x598fa4(++_0x506d94);}(_0x3957,0x199));var _0x7395=function(_0x3f3f40,_0x4e745f){_0x3f3f40=_0x3f3f40-0x0;var _0x32c366=_0x3957[_0x3f3f40];return _0x32c366;};'use strict';var Sequelize=require(_0x7395('0x0'));module[_0x7395('0x1')]={'name':{'type':Sequelize[_0x7395('0x2')],'allowNull':![],'unique':_0x7395('0x3')},'prefix':{'type':Sequelize[_0x7395('0x4')],'get':function(_0x5e95e5){return _0x7395('0x5')+this[_0x7395('0x6')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x7395('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1354=['INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x45801f,_0x36c9a8){var _0x2e0e12=function(_0x17c05d){while(--_0x17c05d){_0x45801f['push'](_0x45801f['shift']());}};_0x2e0e12(++_0x36c9a8);}(_0x1354,0x1a5));var _0x4135=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0x1354[_0x3d4876];return _0x58ca9d;};'use strict';var Sequelize=require(_0x4135('0x0'));module[_0x4135('0x1')]={'name':{'type':Sequelize[_0x4135('0x2')],'allowNull':![],'unique':_0x4135('0x3')},'prefix':{'type':Sequelize[_0x4135('0x4')],'get':function(_0x45c33f){return _0x4135('0x5')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0x4135('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x4135('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 35cef7d..0612a3d 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 _0xddb3=['merge','VoicePrefix','includeAll','findAll','rows','catch','show','keys','include','params','describe','sequelize','transaction','create','body','VoiceExtension','find','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','context','from-sip','exten','system','description','priority','appdata','NoOp','Voice\x20Prefix','Extensions\x20creation\x20failed','prefix','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','push','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','findOne','User','order','options','hasOwnProperty','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./voicePrefix.socket','register','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','get','VoicePrefixes','destroy','end','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','VIRTUAL'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xddb3,0xbe));var _0x3ddb=function(_0x3e0d87,_0x44b5e4){_0x3e0d87=_0x3e0d87-0x0;var _0x26e7c7=_0xddb3[_0x3e0d87];return _0x26e7c7;};'use strict';var pdf=require(_0x3ddb('0x0'));var emlformat=require(_0x3ddb('0x1'));var rimraf=require(_0x3ddb('0x2'));var zipdir=require(_0x3ddb('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3ddb('0x4'));var moment=require(_0x3ddb('0x5'));var BPromise=require(_0x3ddb('0x6'));var Mustache=require(_0x3ddb('0x7'));var util=require(_0x3ddb('0x8'));var path=require(_0x3ddb('0x9'));var sox=require(_0x3ddb('0xa'));var csv=require(_0x3ddb('0xb'));var ejs=require(_0x3ddb('0xc'));var fs=require('fs');var _=require(_0x3ddb('0xd'));var squel=require(_0x3ddb('0xe'));var crypto=require(_0x3ddb('0xf'));var jsforce=require(_0x3ddb('0x10'));var deskjs=require(_0x3ddb('0x11'));var toCsv=require(_0x3ddb('0xb'));var querystring=require(_0x3ddb('0x12'));var Papa=require(_0x3ddb('0x13'));var Redis=require('ioredis');var authService=require(_0x3ddb('0x14'));var qs=require(_0x3ddb('0x15'));var as=require(_0x3ddb('0x16'));var hardwareService=require(_0x3ddb('0x17'));var logger=require(_0x3ddb('0x18'))(_0x3ddb('0x19'));var utils=require(_0x3ddb('0x1a'));var config=require(_0x3ddb('0x1b'));var db=require(_0x3ddb('0x1c'))['db'];config[_0x3ddb('0x1d')]=_[_0x3ddb('0x1e')](config[_0x3ddb('0x1d')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3ddb('0x1f'))[_0x3ddb('0x20')](socket);function respondWithStatusCode(_0x35540c,_0x5ad942){_0x5ad942=_0x5ad942||0xcc;return function(_0x216e9a){if(_0x216e9a){return _0x35540c['sendStatus'](_0x5ad942);}return _0x35540c[_0x3ddb('0x21')](_0x5ad942)['end']();};}function respondWithResult(_0xb0781,_0x382421){_0x382421=_0x382421||0xc8;return function(_0x34f26e){if(_0x34f26e){return _0xb0781[_0x3ddb('0x21')](_0x382421)[_0x3ddb('0x22')](_0x34f26e);}};}function respondWithFilteredResult(_0x41fec4,_0x3af06a){return function(_0x2662c9){if(_0x2662c9){var _0xdf0138=_0x2662c9[_0x3ddb('0x23')],_0x35a7ed=_0x3af06a[_0x3ddb('0x24')],_0x4bab2d=_0x3af06a[_0x3ddb('0x24')]+_0x3af06a[_0x3ddb('0x25')],_0x39f72b;if(_0x4bab2d>=_0xdf0138){_0x4bab2d=_0xdf0138;_0x39f72b=0xc8;}else{_0x39f72b=0xce;}_0x41fec4[_0x3ddb('0x21')](_0x39f72b);return _0x41fec4[_0x3ddb('0x26')](_0x3ddb('0x27'),_0x35a7ed+'-'+_0x4bab2d+'/'+_0xdf0138)[_0x3ddb('0x22')](_0x2662c9);}return null;};}function patchUpdates(_0x21a347){return function(_0x3e31a2){try{jsonpatch[_0x3ddb('0x28')](_0x3e31a2,_0x21a347,!![]);}catch(_0x65de0f){return BPromise['reject'](_0x65de0f);}return _0x3e31a2[_0x3ddb('0x29')]();};}function saveUpdates(_0x30c6e5,_0xaa6658){return function(_0x247f77){if(_0x247f77){return _0x247f77[_0x3ddb('0x2a')](_0x30c6e5)[_0x3ddb('0x2b')](function(_0x177f37){return _0x177f37;});}return null;};}function removeEntity(_0x243382,_0x4c1cfe){return function(_0x450c39){if(_0x450c39){return _0x450c39['destroy']()['then'](function(){var _0x141ac0=_0x450c39[_0x3ddb('0x2c')]({'plain':!![]});var _0x4317b5=_0x3ddb('0x2d');return db['UserProfileResource'][_0x3ddb('0x2e')]({'where':{'type':_0x4317b5,'resourceId':_0x141ac0['id']}})['then'](function(){return _0x450c39;});})['then'](function(){_0x243382['status'](0xcc)[_0x3ddb('0x2f')]();});}};}function handleEntityNotFound(_0x451e24,_0x33dad4){return function(_0x2a22a0){if(!_0x2a22a0){_0x451e24[_0x3ddb('0x30')](0x194);}return _0x2a22a0;};}function handleError(_0x499f1a,_0x39e5ae){_0x39e5ae=_0x39e5ae||0x1f4;return function(_0x2cc947){logger['error'](_0x2cc947[_0x3ddb('0x31')]);if(_0x2cc947[_0x3ddb('0x32')]){delete _0x2cc947[_0x3ddb('0x32')];}_0x499f1a[_0x3ddb('0x21')](_0x39e5ae)[_0x3ddb('0x33')](_0x2cc947);};}exports['index']=function(_0x496030,_0x2052fb){var _0x32f94f={},_0x24531d={},_0x2ae017={'count':0x0,'rows':[]};var _0x3c948e=_[_0x3ddb('0x34')](db['VoicePrefix'][_0x3ddb('0x35')],function(_0x38bf41){return{'name':_0x38bf41[_0x3ddb('0x36')],'type':_0x38bf41[_0x3ddb('0x37')][_0x3ddb('0x38')]};});_0x24531d[_0x3ddb('0x39')]=_['map'](_0x3c948e,_0x3ddb('0x32'));_0x24531d[_0x3ddb('0x3a')]=_['keys'](_0x496030[_0x3ddb('0x3a')]);_0x24531d['filters']=_[_0x3ddb('0x3b')](_0x24531d[_0x3ddb('0x39')],_0x24531d[_0x3ddb('0x3a')]);_0x32f94f['attributes']=_[_0x3ddb('0x3b')](_0x24531d[_0x3ddb('0x39')],qs['fields'](_0x496030[_0x3ddb('0x3a')][_0x3ddb('0x3c')]));_0x32f94f[_0x3ddb('0x3d')]=_0x32f94f['attributes'][_0x3ddb('0x3e')]?_0x32f94f[_0x3ddb('0x3d')]:_0x24531d[_0x3ddb('0x39')];if(!_0x496030[_0x3ddb('0x3a')]['hasOwnProperty'](_0x3ddb('0x3f'))){_0x32f94f[_0x3ddb('0x25')]=qs[_0x3ddb('0x25')](_0x496030[_0x3ddb('0x3a')][_0x3ddb('0x25')]);_0x32f94f[_0x3ddb('0x24')]=qs['offset'](_0x496030[_0x3ddb('0x3a')][_0x3ddb('0x24')]);}_0x32f94f['order']=qs[_0x3ddb('0x40')](_0x496030[_0x3ddb('0x3a')][_0x3ddb('0x40')]);_0x32f94f[_0x3ddb('0x41')]=qs[_0x3ddb('0x42')](_[_0x3ddb('0x43')](_0x496030[_0x3ddb('0x3a')],_0x24531d[_0x3ddb('0x42')]));if(_0x496030[_0x3ddb('0x3a')][_0x3ddb('0x44')]){_0x32f94f[_0x3ddb('0x41')]=_['merge'](_0x32f94f['where'],{'$or':_[_0x3ddb('0x34')](_0x3c948e,function(_0x5cec44){if(_0x5cec44[_0x3ddb('0x37')]!==_0x3ddb('0x45')){var _0x4d199b={};_0x4d199b[_0x5cec44[_0x3ddb('0x32')]]={'$like':'%'+_0x496030[_0x3ddb('0x3a')][_0x3ddb('0x44')]+'%'};return _0x4d199b;}})});}_0x32f94f=_[_0x3ddb('0x46')]({},_0x32f94f,_0x496030['options']);var _0x4ab103={'where':_0x32f94f[_0x3ddb('0x41')]};return db[_0x3ddb('0x47')][_0x3ddb('0x23')](_0x4ab103)[_0x3ddb('0x2b')](function(_0x2320c2){_0x2ae017[_0x3ddb('0x23')]=_0x2320c2;if(_0x496030[_0x3ddb('0x3a')][_0x3ddb('0x48')]){_0x32f94f['include']=[{'all':!![]}];}return db[_0x3ddb('0x47')][_0x3ddb('0x49')](_0x32f94f);})[_0x3ddb('0x2b')](function(_0x5a3fa9){_0x2ae017[_0x3ddb('0x4a')]=_0x5a3fa9;return _0x2ae017;})[_0x3ddb('0x2b')](respondWithFilteredResult(_0x2052fb,_0x32f94f))[_0x3ddb('0x4b')](handleError(_0x2052fb,null));};exports[_0x3ddb('0x4c')]=function(_0x17e6a6,_0x484c64){var _0x3d9dd0={'raw':![],'where':{'id':_0x17e6a6['params']['id']}},_0x19d825={};_0x19d825[_0x3ddb('0x39')]=_[_0x3ddb('0x4d')](db[_0x3ddb('0x47')][_0x3ddb('0x35')]);_0x19d825[_0x3ddb('0x3a')]=_[_0x3ddb('0x4d')](_0x17e6a6[_0x3ddb('0x3a')]);_0x19d825[_0x3ddb('0x42')]=_[_0x3ddb('0x3b')](_0x19d825[_0x3ddb('0x39')],_0x19d825['query']);_0x3d9dd0[_0x3ddb('0x3d')]=_['intersection'](_0x19d825['model'],qs[_0x3ddb('0x3c')](_0x17e6a6[_0x3ddb('0x3a')]['fields']));_0x3d9dd0[_0x3ddb('0x3d')]=_0x3d9dd0['attributes']['length']?_0x3d9dd0[_0x3ddb('0x3d')]:_0x19d825['model'];if(_0x17e6a6[_0x3ddb('0x3a')]['includeAll']){_0x3d9dd0[_0x3ddb('0x4e')]=[{'all':!![]}];}_0x3d9dd0=_[_0x3ddb('0x46')]({},_0x3d9dd0,_0x17e6a6['options']);return db[_0x3ddb('0x47')]['find'](_0x3d9dd0)[_0x3ddb('0x2b')](handleEntityNotFound(_0x484c64,null))[_0x3ddb('0x2b')](respondWithResult(_0x484c64,null))[_0x3ddb('0x4b')](handleError(_0x484c64,null));};exports[_0x3ddb('0x2e')]=function(_0x12fab9,_0x41b1d7){return db[_0x3ddb('0x47')]['find']({'where':{'id':_0x12fab9[_0x3ddb('0x4f')]['id']}})[_0x3ddb('0x2b')](handleEntityNotFound(_0x41b1d7,null))['then'](removeEntity(_0x41b1d7,null))[_0x3ddb('0x4b')](handleError(_0x41b1d7,null));};exports[_0x3ddb('0x50')]=function(_0x416f47,_0x4219f8){return db[_0x3ddb('0x47')][_0x3ddb('0x50')]()[_0x3ddb('0x2b')](respondWithResult(_0x4219f8,null))[_0x3ddb('0x4b')](handleError(_0x4219f8,null));};exports['create']=function(_0x49b37f,_0xb30423){var _0xfd2137;return db[_0x3ddb('0x51')][_0x3ddb('0x52')](function(_0xe3ac83){return db['VoicePrefix'][_0x3ddb('0x53')](_0x49b37f[_0x3ddb('0x54')],{'transaction':_0xe3ac83})[_0x3ddb('0x2b')](function(_0x38f537){_0xfd2137=_0x38f537[_0x3ddb('0x2c')]({'plain':!![]});return db[_0x3ddb('0x55')][_0x3ddb('0x56')]({'where':{'id':_0xfd2137[_0x3ddb('0x57')]},'raw':!![]})['then'](function(_0x274a58){return createVoicePrefixExtensions(_0xfd2137,_0x274a58,_0xe3ac83);});});})[_0x3ddb('0x2b')](function(){var _0x3950e3=_0x49b37f[_0x3ddb('0x58')][_0x3ddb('0x2c')]({'plain':!![]});if(!_0x3950e3)throw new Error(_0x3ddb('0x59'));if(_0x3950e3[_0x3ddb('0x5a')]===_0x3ddb('0x58')){var _0x1a022e=_0xfd2137;return db[_0x3ddb('0x5b')][_0x3ddb('0x56')]({'where':{'name':_0x3ddb('0x2d'),'userProfileId':_0x3950e3['userProfileId']},'raw':!![]})[_0x3ddb('0x2b')](function(_0x5afdc9){if(_0x5afdc9&&_0x5afdc9[_0x3ddb('0x5c')]===0x0){return db[_0x3ddb('0x5d')][_0x3ddb('0x53')]({'name':_0x1a022e[_0x3ddb('0x32')],'resourceId':_0x1a022e['id'],'type':_0x5afdc9[_0x3ddb('0x32')],'sectionId':_0x5afdc9['id']},{})['then'](function(){return _0xfd2137;});}else{return _0xfd2137;}})[_0x3ddb('0x4b')](function(_0x351a30){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x351a30);throw _0x351a30;});}return _0xfd2137;})[_0x3ddb('0x2b')](respondWithResult(_0xb30423,null))[_0x3ddb('0x4b')](handleError(_0xb30423,null));};function Extension(_0x3afdd5,_0x10d556,_0x5a0d01,_0x308738){this[_0x3ddb('0x5e')]=_0x3ddb('0x5f');this[_0x3ddb('0x60')]=_0x3afdd5;this['app']=_0x5a0d01;this[_0x3ddb('0x37')]=_0x3ddb('0x61');this[_0x3ddb('0x62')]='Voice\x20Prefix\x20Extension';this[_0x3ddb('0x63')]=_0x10d556;this[_0x3ddb('0x64')]=_0x308738;}function createVoicePrefixExtensions(_0x62065c,_0xae1024,_0x35660f){return new BPromise(function(_0x26ea4b,_0x48ae95){var _0x38f34b=new Extension(formatPrefixName(_0x62065c['prefix']),0x1,_0x3ddb('0x65'),_0x3ddb('0x66'));_0x38f34b['VoicePrefixId']=_0x62065c['id'];return db[_0x3ddb('0x55')]['create'](_0x38f34b,{'transaction':_0x35660f})[_0x3ddb('0x2b')](function(_0x19a344){var _0x599320=_0x19a344[_0x3ddb('0x2c')]({'plain':!![]});var _0x18491b=_['map'](addVoicePrefixExtensions(_0x62065c,_0xae1024),function(_0xede6d8){_0xede6d8['VoiceExtensionId']=_0x599320['id'];_0xede6d8['VoicePrefixId']=_0x62065c['id'];return _0xede6d8;});return db[_0x3ddb('0x55')]['bulkCreate'](_0x18491b,{'transaction':_0x35660f})['then'](function(_0x2208ca){if(!_0x2208ca){return _0x48ae95(_0x3ddb('0x67'));}else{return _0x26ea4b(_0x2208ca);}})[_0x3ddb('0x4b')](function(_0x2ee182){return _0x48ae95(_0x2ee182);});});;});};function addVoicePrefixExtensions(_0x27153a,_0x4d5335){var _0x38c0f4=[];var _0x62438f=formatPrefixName(_0x27153a[_0x3ddb('0x68')]);_0x38c0f4['push'](new Extension(_0x62438f,0x2,_0x3ddb('0x69'),_0x3ddb('0x6a')+_0x27153a[_0x3ddb('0x32')]));if(_0x27153a['callerIdAll']){_0x38c0f4['push'](new Extension(_0x62438f,0x3,'Set',_0x3ddb('0x6b')+_0x27153a[_0x3ddb('0x6c')]));}else{_0x38c0f4[_0x3ddb('0x6d')](new Extension(_0x62438f,0x3,'NoOp',_0x3ddb('0x6e')));}_0x38c0f4[_0x3ddb('0x6d')](new Extension(_0x62438f,0x4,_0x3ddb('0x6f'),_0x4d5335[_0x3ddb('0x5e')]+','+_0x3ddb('0x70')+(0x8+_0x27153a[_0x3ddb('0x32')][_0x3ddb('0x3e')])+'}'+','+0x1));return _0x38c0f4;}function formatPrefixName(_0x5f4bd2){var _0x345ead='_';for(var _0x599afd=0x0;_0x599afd<_0x5f4bd2[_0x3ddb('0x3e')];_0x599afd++){if(_0x5f4bd2[_0x3ddb('0x71')](_0x599afd)=='-'){_0x345ead+=_0x5f4bd2[_0x3ddb('0x71')](_0x599afd);}else{_0x345ead+='['+_0x5f4bd2['charAt'](_0x599afd)+']';}}_0x345ead+='.';return _0x345ead;}exports[_0x3ddb('0x2a')]=function(_0x3ce427,_0x5f1382,_0x5b7b2a){var _0x19772c=_0x3ce427['body'];_0x19772c[_0x3ddb('0x68')]=_0x3ddb('0x72')+_0x19772c[_0x3ddb('0x32')]+'-';return db[_0x3ddb('0x51')][_0x3ddb('0x52')](function(_0x568ff3){return db['VoicePrefix'][_0x3ddb('0x2a')](_0x19772c,{'where':{'id':_0x19772c['id']},'transaction':_0x568ff3})[_0x3ddb('0x2b')](function(){return db['VoiceExtension'][_0x3ddb('0x2e')]({'where':{'VoicePrefixId':_0x19772c['id']},'transaction':_0x568ff3})['then'](function(){return db[_0x3ddb('0x55')][_0x3ddb('0x56')]({'where':{'id':_0x19772c[_0x3ddb('0x57')]},'raw':!![]})[_0x3ddb('0x2b')](function(_0x4b079f){return createVoicePrefixExtensions(_0x19772c,_0x4b079f,_0x568ff3);});});});})[_0x3ddb('0x2b')](function(){return db[_0x3ddb('0x47')][_0x3ddb('0x73')](_0x19772c['id']);})['then'](respondWithResult(_0x5f1382,null))[_0x3ddb('0x4b')](handleError(_0x5f1382,null));};exports['addAgents']=function(_0x4c5829,_0x227d6a,_0x2efa5b){return db[_0x3ddb('0x47')][_0x3ddb('0x56')]({'where':{'id':_0x4c5829[_0x3ddb('0x4f')]['id']}})[_0x3ddb('0x2b')](handleEntityNotFound(_0x227d6a,null))['then'](function(_0xdfd811){if(_0xdfd811){return _0xdfd811[_0x3ddb('0x74')](_0x4c5829[_0x3ddb('0x54')][_0x3ddb('0x75')],_[_0x3ddb('0x76')](_0x4c5829['body'],[_0x3ddb('0x75'),'id'])||{})[_0x3ddb('0x77')](function(_0x264cfa){for(var _0x14b9b3=0x0;_0x14b9b3<_0x4c5829[_0x3ddb('0x54')][_0x3ddb('0x75')][_0x3ddb('0x3e')];_0x14b9b3+=0x1){socket[_0x3ddb('0x78')](_0x3ddb('0x79'),{'UserId':_0x4c5829[_0x3ddb('0x54')]['ids'][_0x14b9b3],'VoicePrefixId':_0x4c5829[_0x3ddb('0x4f')]['id']});}return _0x264cfa;});}})[_0x3ddb('0x2b')](respondWithResult(_0x227d6a,null))[_0x3ddb('0x4b')](handleError(_0x227d6a,null));};exports['removeAgents']=function(_0x279877,_0x2e0696,_0x425b7a){return db[_0x3ddb('0x47')][_0x3ddb('0x56')]({'where':{'id':_0x279877[_0x3ddb('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2e0696,null))[_0x3ddb('0x2b')](function(_0x3e1934){if(_0x3e1934){return _0x3e1934[_0x3ddb('0x7a')](_0x279877[_0x3ddb('0x3a')]['ids'])[_0x3ddb('0x2b')](function(){if(_['isArray'](_0x279877['query']['ids'])){for(var _0x2de4a1=0x0;_0x2de4a1<_0x279877[_0x3ddb('0x3a')][_0x3ddb('0x75')][_0x3ddb('0x3e')];_0x2de4a1+=0x1){socket[_0x3ddb('0x78')](_0x3ddb('0x7b'),{'UserId':Number(_0x279877[_0x3ddb('0x3a')][_0x3ddb('0x75')][_0x2de4a1]),'VoicePrefixId':Number(_0x279877[_0x3ddb('0x4f')]['id'])});}}else{socket[_0x3ddb('0x78')]('userVoicePrefix:remove',{'UserId':Number(_0x279877[_0x3ddb('0x3a')]['ids']),'VoicePrefixId':Number(_0x279877[_0x3ddb('0x4f')]['id'])});}});}})[_0x3ddb('0x2b')](respondWithStatusCode(_0x2e0696,null))[_0x3ddb('0x4b')](handleError(_0x2e0696,null));};exports['getAgents']=function(_0x1208bd,_0x527eed,_0x182627){var _0x6d19a={};var _0x5431b0={};var _0x25c146;var _0x2dda4c;return db[_0x3ddb('0x47')][_0x3ddb('0x7c')]({'where':{'id':_0x1208bd[_0x3ddb('0x4f')]['id']}})[_0x3ddb('0x2b')](handleEntityNotFound(_0x527eed,null))[_0x3ddb('0x2b')](function(_0x40feae){if(_0x40feae){_0x25c146=_0x40feae;_0x5431b0[_0x3ddb('0x39')]=_[_0x3ddb('0x4d')](db[_0x3ddb('0x7d')][_0x3ddb('0x35')]);_0x5431b0[_0x3ddb('0x3a')]=_[_0x3ddb('0x4d')](_0x1208bd[_0x3ddb('0x3a')]);_0x5431b0['filters']=_[_0x3ddb('0x3b')](_0x5431b0['model'],_0x5431b0[_0x3ddb('0x3a')]);_0x6d19a['attributes']=_[_0x3ddb('0x3b')](_0x5431b0['model'],qs[_0x3ddb('0x3c')](_0x1208bd[_0x3ddb('0x3a')][_0x3ddb('0x3c')]));_0x6d19a[_0x3ddb('0x3d')]=_0x6d19a[_0x3ddb('0x3d')][_0x3ddb('0x3e')]?_0x6d19a[_0x3ddb('0x3d')]:_0x5431b0[_0x3ddb('0x39')];_0x6d19a[_0x3ddb('0x7e')]=qs[_0x3ddb('0x40')](_0x1208bd['query'][_0x3ddb('0x40')]);_0x6d19a['where']=qs[_0x3ddb('0x42')](_[_0x3ddb('0x43')](_0x1208bd[_0x3ddb('0x3a')],_0x5431b0[_0x3ddb('0x42')]));if(_0x1208bd['query'][_0x3ddb('0x44')]){_0x6d19a['where']=_[_0x3ddb('0x46')](_0x6d19a[_0x3ddb('0x41')],{'$or':_[_0x3ddb('0x34')](_0x6d19a['attributes'],function(_0x3a290a){var _0x3d2a4a={};_0x3d2a4a[_0x3a290a]={'$like':'%'+_0x1208bd[_0x3ddb('0x3a')][_0x3ddb('0x44')]+'%'};return _0x3d2a4a;})});}_0x6d19a=_['merge']({},_0x6d19a,_0x1208bd[_0x3ddb('0x7f')]);return _0x25c146['getAgents'](_0x6d19a);}})[_0x3ddb('0x2b')](function(_0x5e8d6e){if(_0x5e8d6e){_0x2dda4c=_0x5e8d6e[_0x3ddb('0x3e')];if(!_0x1208bd[_0x3ddb('0x3a')][_0x3ddb('0x80')](_0x3ddb('0x3f'))){_0x6d19a['limit']=qs[_0x3ddb('0x25')](_0x1208bd[_0x3ddb('0x3a')]['limit']);_0x6d19a[_0x3ddb('0x24')]=qs[_0x3ddb('0x24')](_0x1208bd['query'][_0x3ddb('0x24')]);}return _0x25c146[_0x3ddb('0x81')](_0x6d19a);}})['then'](function(_0x45e53f){if(_0x45e53f){return _0x45e53f?{'count':_0x2dda4c,'rows':_0x45e53f}:null;}})['then'](respondWithResult(_0x527eed,null))[_0x3ddb('0x4b')](handleError(_0x527eed,null));}; \ No newline at end of file +var _0x9e64=['defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','update','destroy','then','get','VoicePrefixes','UserProfileResource','end','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','pick','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','intersection','length','find','create','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','sequelize','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','emit','getAgents','findOne','User','order','sort','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x9e64,0x69));var _0x49e6=function(_0x5211aa,_0x3a378d){_0x5211aa=_0x5211aa-0x0;var _0x37a773=_0x9e64[_0x5211aa];return _0x37a773;};'use strict';var pdf=require(_0x49e6('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49e6('0x1'));var jsonpatch=require(_0x49e6('0x2'));var rp=require(_0x49e6('0x3'));var moment=require(_0x49e6('0x4'));var BPromise=require(_0x49e6('0x5'));var Mustache=require('mustache');var util=require(_0x49e6('0x6'));var path=require('path');var sox=require(_0x49e6('0x7'));var csv=require(_0x49e6('0x8'));var ejs=require(_0x49e6('0x9'));var fs=require('fs');var _=require(_0x49e6('0xa'));var squel=require('squel');var crypto=require(_0x49e6('0xb'));var jsforce=require(_0x49e6('0xc'));var deskjs=require(_0x49e6('0xd'));var toCsv=require(_0x49e6('0x8'));var querystring=require(_0x49e6('0xe'));var Papa=require(_0x49e6('0xf'));var Redis=require(_0x49e6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x49e6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x49e6('0x12'));var logger=require(_0x49e6('0x13'))(_0x49e6('0x14'));var utils=require(_0x49e6('0x15'));var config=require(_0x49e6('0x16'));var db=require(_0x49e6('0x17'))['db'];config[_0x49e6('0x18')]=_[_0x49e6('0x19')](config[_0x49e6('0x18')],{'host':_0x49e6('0x1a'),'port':0x18eb});var socket=require(_0x49e6('0x1b'))(new Redis(config[_0x49e6('0x18')]));require(_0x49e6('0x1c'))[_0x49e6('0x1d')](socket);function respondWithStatusCode(_0x250849,_0x5e6ba6){_0x5e6ba6=_0x5e6ba6||0xcc;return function(_0x49b269){if(_0x49b269){return _0x250849[_0x49e6('0x1e')](_0x5e6ba6);}return _0x250849[_0x49e6('0x1f')](_0x5e6ba6)['end']();};}function respondWithResult(_0x2e68c5,_0x29185f){_0x29185f=_0x29185f||0xc8;return function(_0x59843b){if(_0x59843b){return _0x2e68c5[_0x49e6('0x1f')](_0x29185f)['json'](_0x59843b);}};}function respondWithFilteredResult(_0x13131b,_0x24fdfd){return function(_0x43b891){if(_0x43b891){var _0x561144=_0x43b891['count'],_0xfffb20=_0x24fdfd[_0x49e6('0x20')],_0x3a1ca3=_0x24fdfd[_0x49e6('0x20')]+_0x24fdfd[_0x49e6('0x21')],_0x1d3f18;if(_0x3a1ca3>=_0x561144){_0x3a1ca3=_0x561144;_0x1d3f18=0xc8;}else{_0x1d3f18=0xce;}_0x13131b[_0x49e6('0x1f')](_0x1d3f18);return _0x13131b[_0x49e6('0x22')](_0x49e6('0x23'),_0xfffb20+'-'+_0x3a1ca3+'/'+_0x561144)[_0x49e6('0x24')](_0x43b891);}return null;};}function patchUpdates(_0x32fd6a){return function(_0x3413d3){try{jsonpatch[_0x49e6('0x25')](_0x3413d3,_0x32fd6a,!![]);}catch(_0x23216d){return BPromise[_0x49e6('0x26')](_0x23216d);}return _0x3413d3['save']();};}function saveUpdates(_0x2cca8d,_0x2d1307){return function(_0x235d2c){if(_0x235d2c){return _0x235d2c[_0x49e6('0x27')](_0x2cca8d)['then'](function(_0x2fbd80){return _0x2fbd80;});}return null;};}function removeEntity(_0x3f6338,_0x1d9a12){return function(_0x13a7d9){if(_0x13a7d9){return _0x13a7d9[_0x49e6('0x28')]()[_0x49e6('0x29')](function(){var _0xdf2b65=_0x13a7d9[_0x49e6('0x2a')]({'plain':!![]});var _0x420763=_0x49e6('0x2b');return db[_0x49e6('0x2c')][_0x49e6('0x28')]({'where':{'type':_0x420763,'resourceId':_0xdf2b65['id']}})['then'](function(){return _0x13a7d9;});})['then'](function(){_0x3f6338[_0x49e6('0x1f')](0xcc)[_0x49e6('0x2d')]();});}};}function handleEntityNotFound(_0x4f009a,_0x4f86d3){return function(_0x226b2f){if(!_0x226b2f){_0x4f009a[_0x49e6('0x1e')](0x194);}return _0x226b2f;};}function handleError(_0x137b04,_0x2b03cc){_0x2b03cc=_0x2b03cc||0x1f4;return function(_0x2f7445){logger['error'](_0x2f7445[_0x49e6('0x2e')]);if(_0x2f7445[_0x49e6('0x2f')]){delete _0x2f7445[_0x49e6('0x2f')];}_0x137b04[_0x49e6('0x1f')](_0x2b03cc)[_0x49e6('0x30')](_0x2f7445);};}exports[_0x49e6('0x31')]=function(_0x3d06f1,_0x5bd1bb){var _0x4d7192={},_0x299f5d={},_0x290a1e={'count':0x0,'rows':[]};var _0x92a9b5=_[_0x49e6('0x32')](db[_0x49e6('0x33')][_0x49e6('0x34')],function(_0x238242){return{'name':_0x238242[_0x49e6('0x35')],'type':_0x238242[_0x49e6('0x36')][_0x49e6('0x37')]};});_0x299f5d[_0x49e6('0x38')]=_[_0x49e6('0x32')](_0x92a9b5,_0x49e6('0x2f'));_0x299f5d[_0x49e6('0x39')]=_[_0x49e6('0x3a')](_0x3d06f1['query']);_0x299f5d[_0x49e6('0x3b')]=_['intersection'](_0x299f5d[_0x49e6('0x38')],_0x299f5d['query']);_0x4d7192[_0x49e6('0x3c')]=_['intersection'](_0x299f5d[_0x49e6('0x38')],qs[_0x49e6('0x3d')](_0x3d06f1[_0x49e6('0x39')][_0x49e6('0x3d')]));_0x4d7192['attributes']=_0x4d7192['attributes']['length']?_0x4d7192[_0x49e6('0x3c')]:_0x299f5d[_0x49e6('0x38')];if(!_0x3d06f1[_0x49e6('0x39')][_0x49e6('0x3e')](_0x49e6('0x3f'))){_0x4d7192[_0x49e6('0x21')]=qs[_0x49e6('0x21')](_0x3d06f1[_0x49e6('0x39')][_0x49e6('0x21')]);_0x4d7192[_0x49e6('0x20')]=qs[_0x49e6('0x20')](_0x3d06f1[_0x49e6('0x39')][_0x49e6('0x20')]);}_0x4d7192['order']=qs['sort'](_0x3d06f1[_0x49e6('0x39')]['sort']);_0x4d7192['where']=qs[_0x49e6('0x3b')](_[_0x49e6('0x40')](_0x3d06f1[_0x49e6('0x39')],_0x299f5d[_0x49e6('0x3b')]));if(_0x3d06f1[_0x49e6('0x39')]['filter']){_0x4d7192[_0x49e6('0x41')]=_[_0x49e6('0x42')](_0x4d7192[_0x49e6('0x41')],{'$or':_[_0x49e6('0x32')](_0x92a9b5,function(_0x4e5d63){if(_0x4e5d63[_0x49e6('0x36')]!==_0x49e6('0x43')){var _0x31b2a2={};_0x31b2a2[_0x4e5d63[_0x49e6('0x2f')]]={'$like':'%'+_0x3d06f1[_0x49e6('0x39')][_0x49e6('0x44')]+'%'};return _0x31b2a2;}})});}_0x4d7192=_[_0x49e6('0x42')]({},_0x4d7192,_0x3d06f1[_0x49e6('0x45')]);var _0x36be01={'where':_0x4d7192[_0x49e6('0x41')]};return db[_0x49e6('0x33')][_0x49e6('0x46')](_0x36be01)[_0x49e6('0x29')](function(_0x14f01f){_0x290a1e[_0x49e6('0x46')]=_0x14f01f;if(_0x3d06f1[_0x49e6('0x39')][_0x49e6('0x47')]){_0x4d7192[_0x49e6('0x48')]=[{'all':!![]}];}return db[_0x49e6('0x33')][_0x49e6('0x49')](_0x4d7192);})[_0x49e6('0x29')](function(_0x183deb){_0x290a1e[_0x49e6('0x4a')]=_0x183deb;return _0x290a1e;})[_0x49e6('0x29')](respondWithFilteredResult(_0x5bd1bb,_0x4d7192))[_0x49e6('0x4b')](handleError(_0x5bd1bb,null));};exports[_0x49e6('0x4c')]=function(_0x2f34bc,_0x2eccae){var _0x5b861b={'raw':![],'where':{'id':_0x2f34bc[_0x49e6('0x4d')]['id']}},_0x151066={};_0x151066['model']=_[_0x49e6('0x3a')](db[_0x49e6('0x33')][_0x49e6('0x34')]);_0x151066[_0x49e6('0x39')]=_[_0x49e6('0x3a')](_0x2f34bc['query']);_0x151066[_0x49e6('0x3b')]=_[_0x49e6('0x4e')](_0x151066[_0x49e6('0x38')],_0x151066[_0x49e6('0x39')]);_0x5b861b[_0x49e6('0x3c')]=_[_0x49e6('0x4e')](_0x151066['model'],qs['fields'](_0x2f34bc[_0x49e6('0x39')][_0x49e6('0x3d')]));_0x5b861b[_0x49e6('0x3c')]=_0x5b861b[_0x49e6('0x3c')][_0x49e6('0x4f')]?_0x5b861b['attributes']:_0x151066[_0x49e6('0x38')];if(_0x2f34bc[_0x49e6('0x39')][_0x49e6('0x47')]){_0x5b861b[_0x49e6('0x48')]=[{'all':!![]}];}_0x5b861b=_[_0x49e6('0x42')]({},_0x5b861b,_0x2f34bc[_0x49e6('0x45')]);return db[_0x49e6('0x33')][_0x49e6('0x50')](_0x5b861b)[_0x49e6('0x29')](handleEntityNotFound(_0x2eccae,null))[_0x49e6('0x29')](respondWithResult(_0x2eccae,null))[_0x49e6('0x4b')](handleError(_0x2eccae,null));};exports[_0x49e6('0x28')]=function(_0x579514,_0x53b3fd){return db['VoicePrefix'][_0x49e6('0x50')]({'where':{'id':_0x579514[_0x49e6('0x4d')]['id']}})[_0x49e6('0x29')](handleEntityNotFound(_0x53b3fd,null))[_0x49e6('0x29')](removeEntity(_0x53b3fd,null))[_0x49e6('0x4b')](handleError(_0x53b3fd,null));};exports['describe']=function(_0x1f0051,_0x497452){return db[_0x49e6('0x33')]['describe']()[_0x49e6('0x29')](respondWithResult(_0x497452,null))[_0x49e6('0x4b')](handleError(_0x497452,null));};exports[_0x49e6('0x51')]=function(_0x486afc,_0x32c1a9){var _0x48509a;return db['sequelize'][_0x49e6('0x52')](function(_0x520df6){return db['VoicePrefix'][_0x49e6('0x51')](_0x486afc[_0x49e6('0x53')],{'transaction':_0x520df6})['then'](function(_0x412084){_0x48509a=_0x412084[_0x49e6('0x2a')]({'plain':!![]});return db[_0x49e6('0x54')][_0x49e6('0x50')]({'where':{'id':_0x48509a[_0x49e6('0x55')]},'raw':!![]})[_0x49e6('0x29')](function(_0x2241a5){return createVoicePrefixExtensions(_0x48509a,_0x2241a5,_0x520df6);});});})[_0x49e6('0x29')](function(){var _0x5a78ff=_0x486afc[_0x49e6('0x56')][_0x49e6('0x2a')]({'plain':!![]});if(!_0x5a78ff)throw new Error(_0x49e6('0x57'));if(_0x5a78ff['role']===_0x49e6('0x56')){var _0x596023=_0x48509a;return db[_0x49e6('0x58')][_0x49e6('0x50')]({'where':{'name':_0x49e6('0x2b'),'userProfileId':_0x5a78ff[_0x49e6('0x59')]},'raw':!![]})['then'](function(_0x477aec){if(_0x477aec&&_0x477aec[_0x49e6('0x5a')]===0x0){return db[_0x49e6('0x2c')]['create']({'name':_0x596023[_0x49e6('0x2f')],'resourceId':_0x596023['id'],'type':_0x477aec[_0x49e6('0x2f')],'sectionId':_0x477aec['id']},{})[_0x49e6('0x29')](function(){return _0x48509a;});}else{return _0x48509a;}})[_0x49e6('0x4b')](function(_0x44467f){logger[_0x49e6('0x5b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44467f);throw _0x44467f;});}return _0x48509a;})[_0x49e6('0x29')](respondWithResult(_0x32c1a9,null))[_0x49e6('0x4b')](handleError(_0x32c1a9,null));};function Extension(_0x545d74,_0x1ff2e5,_0x4f1c37,_0x44e224){this[_0x49e6('0x5c')]=_0x49e6('0x5d');this[_0x49e6('0x5e')]=_0x545d74;this[_0x49e6('0x5f')]=_0x4f1c37;this['type']=_0x49e6('0x60');this[_0x49e6('0x61')]=_0x49e6('0x62');this[_0x49e6('0x63')]=_0x1ff2e5;this[_0x49e6('0x64')]=_0x44e224;}function createVoicePrefixExtensions(_0x74557f,_0x545d19,_0x59f207){return new BPromise(function(_0x3f1fcb,_0x52d219){var _0x2a2bbe=new Extension(formatPrefixName(_0x74557f[_0x49e6('0x65')]),0x1,_0x49e6('0x66'),_0x49e6('0x67'));_0x2a2bbe['VoicePrefixId']=_0x74557f['id'];return db['VoiceExtension']['create'](_0x2a2bbe,{'transaction':_0x59f207})[_0x49e6('0x29')](function(_0x288db9){var _0x5158c1=_0x288db9['get']({'plain':!![]});var _0x160708=_[_0x49e6('0x32')](addVoicePrefixExtensions(_0x74557f,_0x545d19),function(_0x33f389){_0x33f389['VoiceExtensionId']=_0x5158c1['id'];_0x33f389[_0x49e6('0x68')]=_0x74557f['id'];return _0x33f389;});return db[_0x49e6('0x54')]['bulkCreate'](_0x160708,{'transaction':_0x59f207})[_0x49e6('0x29')](function(_0x15def3){if(!_0x15def3){return _0x52d219(_0x49e6('0x69'));}else{return _0x3f1fcb(_0x15def3);}})[_0x49e6('0x4b')](function(_0x57e368){return _0x52d219(_0x57e368);});});;});};function addVoicePrefixExtensions(_0x5c76bb,_0x5bbc4f){var _0x51d7f6=[];var _0x1d7bbb=formatPrefixName(_0x5c76bb[_0x49e6('0x65')]);_0x51d7f6[_0x49e6('0x6a')](new Extension(_0x1d7bbb,0x2,_0x49e6('0x6b'),_0x49e6('0x6c')+_0x5c76bb[_0x49e6('0x2f')]));if(_0x5c76bb[_0x49e6('0x6d')]){_0x51d7f6[_0x49e6('0x6a')](new Extension(_0x1d7bbb,0x3,_0x49e6('0x6b'),_0x49e6('0x6e')+_0x5c76bb[_0x49e6('0x6d')]));}else{_0x51d7f6[_0x49e6('0x6a')](new Extension(_0x1d7bbb,0x3,_0x49e6('0x66'),_0x49e6('0x6f')));}_0x51d7f6[_0x49e6('0x6a')](new Extension(_0x1d7bbb,0x4,_0x49e6('0x70'),_0x5bbc4f[_0x49e6('0x5c')]+','+_0x49e6('0x71')+(0x8+_0x5c76bb[_0x49e6('0x2f')]['length'])+'}'+','+0x1));return _0x51d7f6;}function formatPrefixName(_0x40a21f){var _0x388774='_';for(var _0x46d93e=0x0;_0x46d93e<_0x40a21f[_0x49e6('0x4f')];_0x46d93e++){if(_0x40a21f[_0x49e6('0x72')](_0x46d93e)=='-'){_0x388774+=_0x40a21f[_0x49e6('0x72')](_0x46d93e);}else{_0x388774+='['+_0x40a21f[_0x49e6('0x72')](_0x46d93e)+']';}}_0x388774+='.';return _0x388774;}exports[_0x49e6('0x27')]=function(_0x5e19c9,_0x876cbd,_0x14fa27){var _0x46c10a=_0x5e19c9[_0x49e6('0x53')];_0x46c10a['prefix']='system-'+_0x46c10a[_0x49e6('0x2f')]+'-';return db[_0x49e6('0x73')][_0x49e6('0x52')](function(_0x93155){return db[_0x49e6('0x33')][_0x49e6('0x27')](_0x46c10a,{'where':{'id':_0x46c10a['id']},'transaction':_0x93155})[_0x49e6('0x29')](function(){return db[_0x49e6('0x54')]['destroy']({'where':{'VoicePrefixId':_0x46c10a['id']},'transaction':_0x93155})[_0x49e6('0x29')](function(){return db[_0x49e6('0x54')][_0x49e6('0x50')]({'where':{'id':_0x46c10a[_0x49e6('0x55')]},'raw':!![]})[_0x49e6('0x29')](function(_0xbd98b6){return createVoicePrefixExtensions(_0x46c10a,_0xbd98b6,_0x93155);});});});})[_0x49e6('0x29')](function(){return db[_0x49e6('0x33')]['findById'](_0x46c10a['id']);})[_0x49e6('0x29')](respondWithResult(_0x876cbd,null))[_0x49e6('0x4b')](handleError(_0x876cbd,null));};exports[_0x49e6('0x74')]=function(_0x53133b,_0x3c00c8,_0x3b5cd6){return db[_0x49e6('0x33')][_0x49e6('0x50')]({'where':{'id':_0x53133b['params']['id']}})[_0x49e6('0x29')](handleEntityNotFound(_0x3c00c8,null))[_0x49e6('0x29')](function(_0x59d8ae){if(_0x59d8ae){return _0x59d8ae['addAgents'](_0x53133b[_0x49e6('0x53')][_0x49e6('0x75')],_[_0x49e6('0x76')](_0x53133b[_0x49e6('0x53')],[_0x49e6('0x75'),'id'])||{})[_0x49e6('0x77')](function(_0x37bb15){for(var _0x2d63ca=0x0;_0x2d63ca<_0x53133b[_0x49e6('0x53')][_0x49e6('0x75')]['length'];_0x2d63ca+=0x1){socket['emit'](_0x49e6('0x78'),{'UserId':_0x53133b['body'][_0x49e6('0x75')][_0x2d63ca],'VoicePrefixId':_0x53133b['params']['id']});}return _0x37bb15;});}})['then'](respondWithResult(_0x3c00c8,null))[_0x49e6('0x4b')](handleError(_0x3c00c8,null));};exports[_0x49e6('0x79')]=function(_0x166f8f,_0x585425,_0x3c9ff6){return db['VoicePrefix'][_0x49e6('0x50')]({'where':{'id':_0x166f8f[_0x49e6('0x4d')]['id']}})[_0x49e6('0x29')](handleEntityNotFound(_0x585425,null))[_0x49e6('0x29')](function(_0x1f6031){if(_0x1f6031){return _0x1f6031[_0x49e6('0x79')](_0x166f8f['query'][_0x49e6('0x75')])[_0x49e6('0x29')](function(){if(_[_0x49e6('0x7a')](_0x166f8f[_0x49e6('0x39')]['ids'])){for(var _0x3848a4=0x0;_0x3848a4<_0x166f8f[_0x49e6('0x39')][_0x49e6('0x75')]['length'];_0x3848a4+=0x1){socket['emit'](_0x49e6('0x7b'),{'UserId':Number(_0x166f8f[_0x49e6('0x39')][_0x49e6('0x75')][_0x3848a4]),'VoicePrefixId':Number(_0x166f8f[_0x49e6('0x4d')]['id'])});}}else{socket[_0x49e6('0x7c')](_0x49e6('0x7b'),{'UserId':Number(_0x166f8f[_0x49e6('0x39')][_0x49e6('0x75')]),'VoicePrefixId':Number(_0x166f8f[_0x49e6('0x4d')]['id'])});}});}})[_0x49e6('0x29')](respondWithStatusCode(_0x585425,null))['catch'](handleError(_0x585425,null));};exports[_0x49e6('0x7d')]=function(_0x240ddf,_0x460e38,_0x281a12){var _0x58e1b3={};var _0x9a6795={};var _0x57092d;var _0x553b14;return db[_0x49e6('0x33')][_0x49e6('0x7e')]({'where':{'id':_0x240ddf[_0x49e6('0x4d')]['id']}})['then'](handleEntityNotFound(_0x460e38,null))[_0x49e6('0x29')](function(_0x27318e){if(_0x27318e){_0x57092d=_0x27318e;_0x9a6795[_0x49e6('0x38')]=_['keys'](db[_0x49e6('0x7f')][_0x49e6('0x34')]);_0x9a6795[_0x49e6('0x39')]=_[_0x49e6('0x3a')](_0x240ddf[_0x49e6('0x39')]);_0x9a6795['filters']=_['intersection'](_0x9a6795[_0x49e6('0x38')],_0x9a6795['query']);_0x58e1b3[_0x49e6('0x3c')]=_['intersection'](_0x9a6795[_0x49e6('0x38')],qs[_0x49e6('0x3d')](_0x240ddf['query'][_0x49e6('0x3d')]));_0x58e1b3['attributes']=_0x58e1b3['attributes'][_0x49e6('0x4f')]?_0x58e1b3[_0x49e6('0x3c')]:_0x9a6795[_0x49e6('0x38')];_0x58e1b3[_0x49e6('0x80')]=qs[_0x49e6('0x81')](_0x240ddf[_0x49e6('0x39')]['sort']);_0x58e1b3[_0x49e6('0x41')]=qs[_0x49e6('0x3b')](_['pick'](_0x240ddf[_0x49e6('0x39')],_0x9a6795[_0x49e6('0x3b')]));if(_0x240ddf['query'][_0x49e6('0x44')]){_0x58e1b3[_0x49e6('0x41')]=_[_0x49e6('0x42')](_0x58e1b3[_0x49e6('0x41')],{'$or':_[_0x49e6('0x32')](_0x58e1b3['attributes'],function(_0x4ff97d){var _0x40689b={};_0x40689b[_0x4ff97d]={'$like':'%'+_0x240ddf[_0x49e6('0x39')][_0x49e6('0x44')]+'%'};return _0x40689b;})});}_0x58e1b3=_[_0x49e6('0x42')]({},_0x58e1b3,_0x240ddf['options']);return _0x57092d[_0x49e6('0x7d')](_0x58e1b3);}})[_0x49e6('0x29')](function(_0x15021c){if(_0x15021c){_0x553b14=_0x15021c['length'];if(!_0x240ddf[_0x49e6('0x39')][_0x49e6('0x3e')](_0x49e6('0x3f'))){_0x58e1b3['limit']=qs[_0x49e6('0x21')](_0x240ddf[_0x49e6('0x39')][_0x49e6('0x21')]);_0x58e1b3[_0x49e6('0x20')]=qs[_0x49e6('0x20')](_0x240ddf[_0x49e6('0x39')][_0x49e6('0x20')]);}return _0x57092d[_0x49e6('0x7d')](_0x58e1b3);}})['then'](function(_0x3af90a){if(_0x3af90a){return _0x3af90a?{'count':_0x553b14,'rows':_0x3af90a}:null;}})[_0x49e6('0x29')](respondWithResult(_0x460e38,null))[_0x49e6('0x4b')](handleError(_0x460e38,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index b6dc2eb..2a5a086 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','update','emit'];(function(_0x5f1617,_0x46277b){var _0x3af5da=function(_0x15b934){while(--_0x15b934){_0x5f1617['push'](_0x5f1617['shift']());}};_0x3af5da(++_0x46277b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0x0a9e('0x0'));var VoicePrefix=require(_0x0a9e('0x1'))['db'][_0x0a9e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a9e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x333808){return function(_0x432180,_0x2ab90b,_0x991246){VoicePrefixEvents[_0x0a9e('0x4')](_0x333808+':'+_0x432180['id'],_0x432180);VoicePrefixEvents['emit'](_0x333808,_0x432180);_0x991246(null);};}for(var e in events){if(events[_0x0a9e('0x5')](e)){var event=events[e];VoicePrefix[_0x0a9e('0x6')](e,emitEvent(event));}}module[_0x0a9e('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','VoicePrefix','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x12c9e0,_0x56dc6a){_0x12c9e0=_0x12c9e0-0x0;var _0x1d4990=_0x3e74[_0x12c9e0];return _0x1d4990;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x43e7('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){VoicePrefixEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);VoicePrefixEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index fc7dc26..8c99dea 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 _0xed3a=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix','voice_prefixes'];(function(_0x5fdee9,_0x335104){var _0x1a25a5=function(_0x2c1259){while(--_0x2c1259){_0x5fdee9['push'](_0x5fdee9['shift']());}};_0x1a25a5(++_0x335104);}(_0xed3a,0xd0));var _0xaed3=function(_0x4bc26d,_0x5f0b6a){_0x4bc26d=_0x4bc26d-0x0;var _0x43e74a=_0xed3a[_0x4bc26d];return _0x43e74a;};'use strict';var _=require(_0xaed3('0x0'));var util=require(_0xaed3('0x1'));var logger=require(_0xaed3('0x2'))(_0xaed3('0x3'));var moment=require(_0xaed3('0x4'));var BPromise=require('bluebird');var rp=require(_0xaed3('0x5'));var fs=require('fs');var path=require(_0xaed3('0x6'));var rimraf=require(_0xaed3('0x7'));var config=require(_0xaed3('0x8'));var attributes=require(_0xaed3('0x9'));module[_0xaed3('0xa')]=function(_0x297812,_0x39ca2b){return _0x297812['define'](_0xaed3('0xb'),attributes,{'tableName':_0xaed3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20a7=['rimraf','../../config/environment','define','VoicePrefix','voice_prefixes','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x87d94f,_0xd6a960){var _0x23e7b1=function(_0x3ad4ab){while(--_0x3ad4ab){_0x87d94f['push'](_0x87d94f['shift']());}};_0x23e7b1(++_0xd6a960);}(_0x20a7,0xd1));var _0x720a=function(_0x118c86,_0x38e616){_0x118c86=_0x118c86-0x0;var _0x562e30=_0x20a7[_0x118c86];return _0x562e30;};'use strict';var _=require(_0x720a('0x0'));var util=require('util');var logger=require(_0x720a('0x1'))(_0x720a('0x2'));var moment=require(_0x720a('0x3'));var BPromise=require(_0x720a('0x4'));var rp=require(_0x720a('0x5'));var fs=require('fs');var path=require(_0x720a('0x6'));var rimraf=require(_0x720a('0x7'));var config=require(_0x720a('0x8'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0xad3dd3,_0xaef1c2){return _0xad3dd3[_0x720a('0x9')](_0x720a('0xa'),attributes,{'tableName':_0x720a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 4733e90..65b2c30 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 _0xab3d=['lodash','randomstring','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','result','catch'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xab3d,0xb0));var _0xdab3=function(_0x269728,_0x3383ad){_0x269728=_0x269728-0x0;var _0x28bf4d=_0xab3d[_0x269728];return _0x28bf4d;};'use strict';var _=require(_0xdab3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdab3('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdab3('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0xdab3('0x3'));var jayson=require(_0xdab3('0x4'));var client=jayson['client'][_0xdab3('0x5')]({'port':0x232a});config[_0xdab3('0x6')]=_[_0xdab3('0x7')](config[_0xdab3('0x6')],{'host':_0xdab3('0x8'),'port':0x18eb});var socket=require(_0xdab3('0x9'))(new Redis(config[_0xdab3('0x6')]));require(_0xdab3('0xa'))[_0xdab3('0xb')](socket);function respondWithRpcPromise(_0x35b737,_0xa9aae4,_0x4627f8){return new BPromise(function(_0x70902e,_0x96cd43){return client['request'](_0x35b737,_0x4627f8)[_0xdab3('0xc')](function(_0x46e7a5){logger[_0xdab3('0xd')](_0xdab3('0xe'),_0xa9aae4,_0xdab3('0xf'));logger[_0xdab3('0x10')](_0xdab3('0x11'),_0xa9aae4,_0xdab3('0xf'),JSON['stringify'](_0x46e7a5));if(_0x46e7a5[_0xdab3('0x12')]){if(_0x46e7a5[_0xdab3('0x12')][_0xdab3('0x13')]===0x1f4){logger[_0xdab3('0x12')](_0xdab3('0xe'),_0xa9aae4,_0x46e7a5[_0xdab3('0x12')]['message']);return _0x96cd43(_0x46e7a5[_0xdab3('0x12')]['message']);}logger[_0xdab3('0x12')](_0xdab3('0xe'),_0xa9aae4,_0x46e7a5['error']['message']);return _0x70902e(_0x46e7a5['error']['message']);}else{logger[_0xdab3('0xd')](_0xdab3('0xe'),_0xa9aae4,_0xdab3('0xf'));_0x70902e(_0x46e7a5[_0xdab3('0x14')]['message']);}})[_0xdab3('0x15')](function(_0x3950a3){logger[_0xdab3('0x12')](_0xdab3('0xe'),_0xa9aae4,_0x3950a3);_0x96cd43(_0x3950a3);});});} \ No newline at end of file +var _0x9336=['register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter','./voicePrefix.socket'];(function(_0x2cc37c,_0x201d7a){var _0x2a5110=function(_0x56c409){while(--_0x56c409){_0x2cc37c['push'](_0x2cc37c['shift']());}};_0x2a5110(++_0x201d7a);}(_0x9336,0x112));var _0x6933=function(_0x25dee2,_0x4cc082){_0x25dee2=_0x25dee2-0x0;var _0x49261f=_0x9336[_0x25dee2];return _0x49261f;};'use strict';var _=require(_0x6933('0x0'));var util=require('util');var moment=require(_0x6933('0x1'));var BPromise=require(_0x6933('0x2'));var rs=require(_0x6933('0x3'));var fs=require('fs');var Redis=require(_0x6933('0x4'));var db=require(_0x6933('0x5'))['db'];var utils=require(_0x6933('0x6'));var logger=require(_0x6933('0x7'))('rpc');var config=require(_0x6933('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6933('0x9')]({'port':0x232a});config[_0x6933('0xa')]=_['defaults'](config[_0x6933('0xa')],{'host':_0x6933('0xb'),'port':0x18eb});var socket=require(_0x6933('0xc'))(new Redis(config[_0x6933('0xa')]));require(_0x6933('0xd'))[_0x6933('0xe')](socket);function respondWithRpcPromise(_0x37be45,_0x423504,_0x215d09){return new BPromise(function(_0x4d0cbd,_0x1cf330){return client[_0x6933('0xf')](_0x37be45,_0x215d09)['then'](function(_0x2b23c4){logger[_0x6933('0x10')](_0x6933('0x11'),_0x423504,'request\x20sent');logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x423504,_0x6933('0x12'),JSON[_0x6933('0x13')](_0x2b23c4));if(_0x2b23c4['error']){if(_0x2b23c4[_0x6933('0x14')]['code']===0x1f4){logger[_0x6933('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x423504,_0x2b23c4[_0x6933('0x14')][_0x6933('0x15')]);return _0x1cf330(_0x2b23c4['error'][_0x6933('0x15')]);}logger[_0x6933('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x423504,_0x2b23c4[_0x6933('0x14')][_0x6933('0x15')]);return _0x4d0cbd(_0x2b23c4[_0x6933('0x14')][_0x6933('0x15')]);}else{logger[_0x6933('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x423504,_0x6933('0x12'));_0x4d0cbd(_0x2b23c4[_0x6933('0x16')]['message']);}})[_0x6933('0x17')](function(_0x49c938){logger[_0x6933('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x423504,_0x49c938);_0x1cf330(_0x49c938);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 9c914bd..3ae9ce7 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 _0xdf3a=['voicePrefix:','save','remove','update','emit','removeListener','register','length'];(function(_0x49beea,_0x47add1){var _0x27693a=function(_0x192ed8){while(--_0x192ed8){_0x49beea['push'](_0x49beea['shift']());}};_0x27693a(++_0x47add1);}(_0xdf3a,0x111));var _0xadf3=function(_0x3301d6,_0x3840f9){_0x3301d6=_0x3301d6-0x0;var _0x15ca31=_0xdf3a[_0x3301d6];return _0x15ca31;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xadf3('0x0'),_0xadf3('0x1'),_0xadf3('0x2')];function createListener(_0x30bd91,_0x57aa90){return function(_0x28d0bb){_0x57aa90[_0xadf3('0x3')](_0x30bd91,_0x28d0bb);};}function removeListener(_0x50b16e,_0x3d8479){return function(){VoicePrefixEvents[_0xadf3('0x4')](_0x50b16e,_0x3d8479);};}exports[_0xadf3('0x5')]=function(_0x34c0d2){for(var _0x339aef=0x0,_0x5baf85=events[_0xadf3('0x6')];_0x339aef<_0x5baf85;_0x339aef++){var _0x3cc988=events[_0x339aef];var _0x3e43d2=createListener(_0xadf3('0x7')+_0x3cc988,_0x34c0d2);VoicePrefixEvents['on'](_0x3cc988,_0x3e43d2);}}; \ No newline at end of file +var _0xcc53=['update','emit','register','length','voicePrefix:','./voicePrefix.events'];(function(_0x101207,_0x56586b){var _0xe9aa3d=function(_0xf9662d){while(--_0xf9662d){_0x101207['push'](_0x101207['shift']());}};_0xe9aa3d(++_0x56586b);}(_0xcc53,0x1eb));var _0x3cc5=function(_0x1300a6,_0x110195){_0x1300a6=_0x1300a6-0x0;var _0x206189=_0xcc53[_0x1300a6];return _0x206189;};'use strict';var VoicePrefixEvents=require(_0x3cc5('0x0'));var events=['save','remove',_0x3cc5('0x1')];function createListener(_0xa113a6,_0x24e1e3){return function(_0x14db6a){_0x24e1e3[_0x3cc5('0x2')](_0xa113a6,_0x14db6a);};}function removeListener(_0x2d00e7,_0x55a249){return function(){VoicePrefixEvents['removeListener'](_0x2d00e7,_0x55a249);};}exports[_0x3cc5('0x3')]=function(_0x351652){for(var _0xced6d2=0x0,_0x451a43=events[_0x3cc5('0x4')];_0xced6d2<_0x451a43;_0xced6d2++){var _0x485261=events[_0xced6d2];var _0x1643ce=createListener(_0x3cc5('0x5')+_0x485261,_0x351652);VoicePrefixEvents['on'](_0x485261,_0x1643ce);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 9de7f9e..6c8d3ed 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 _0xc751=['post','create','/:id/clone','clone','/:id/teams','addAgents','addLists','put','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceQueue.controller','isAuthenticated','index','get','/:id','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','getTeams','/:id/users','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists'];(function(_0x56bb63,_0x3e165b){var _0x56a7ec=function(_0x5a1103){while(--_0x5a1103){_0x56bb63['push'](_0x56bb63['shift']());}};_0x56a7ec(++_0x3e165b);}(_0xc751,0xb8));var _0x1c75=function(_0x3a094d,_0x2811f1){_0x3a094d=_0x3a094d-0x0;var _0x2fce9f=_0xc751[_0x3a094d];return _0x2fce9f;};'use strict';var multer=require(_0x1c75('0x0'));var util=require(_0x1c75('0x1'));var path=require(_0x1c75('0x2'));var timeout=require(_0x1c75('0x3'));var express=require(_0x1c75('0x4'));var router=express[_0x1c75('0x5')]();var auth=require(_0x1c75('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1c75('0x7'));var controller=require(_0x1c75('0x8'));router['get']('/',auth[_0x1c75('0x9')](),controller[_0x1c75('0xa')]);router[_0x1c75('0xb')](_0x1c75('0xc'),auth[_0x1c75('0x9')](),controller['show']);router['get']('/:id/hoppers',auth[_0x1c75('0x9')](),controller[_0x1c75('0xd')]);router[_0x1c75('0xb')](_0x1c75('0xe'),auth[_0x1c75('0x9')](),controller[_0x1c75('0xf')]);router[_0x1c75('0xb')](_0x1c75('0x10'),auth[_0x1c75('0x9')](),controller[_0x1c75('0x11')]);router[_0x1c75('0xb')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x1c75('0x12')]);router[_0x1c75('0xb')]('/:id/teams',auth[_0x1c75('0x9')](),controller[_0x1c75('0x13')]);router[_0x1c75('0xb')](_0x1c75('0x14'),auth['isAuthenticated'](),controller['getAgents']);router[_0x1c75('0xb')]('/:id/members',auth[_0x1c75('0x9')](),controller[_0x1c75('0x15')]);router[_0x1c75('0xb')](_0x1c75('0x16'),auth[_0x1c75('0x9')](),controller[_0x1c75('0x17')]);router[_0x1c75('0xb')](_0x1c75('0x18'),auth[_0x1c75('0x9')](),controller[_0x1c75('0x19')]);router[_0x1c75('0x1a')]('/',auth[_0x1c75('0x9')](),controller[_0x1c75('0x1b')]);router[_0x1c75('0x1a')](_0x1c75('0x1c'),auth['isAuthenticated'](),controller[_0x1c75('0x1d')]);router[_0x1c75('0x1a')](_0x1c75('0x1e'),auth['isAuthenticated'](),controller['addTeams']);router[_0x1c75('0x1a')]('/:id/users',auth[_0x1c75('0x9')](),controller[_0x1c75('0x1f')]);router['post'](_0x1c75('0x16'),auth[_0x1c75('0x9')](),controller[_0x1c75('0x20')]);router[_0x1c75('0x1a')](_0x1c75('0x18'),auth[_0x1c75('0x9')](),controller['addBlackLists']);router[_0x1c75('0x21')](_0x1c75('0xc'),auth[_0x1c75('0x9')](),controller[_0x1c75('0x22')]);router[_0x1c75('0x23')](_0x1c75('0xc'),auth[_0x1c75('0x9')](),controller[_0x1c75('0x24')]);router[_0x1c75('0x23')](_0x1c75('0x1e'),auth[_0x1c75('0x9')](),controller[_0x1c75('0x25')]);router[_0x1c75('0x23')]('/:id/users',auth['isAuthenticated'](),controller[_0x1c75('0x26')]);router[_0x1c75('0x23')](_0x1c75('0x16'),auth['isAuthenticated'](),controller[_0x1c75('0x27')]);router[_0x1c75('0x23')](_0x1c75('0x18'),auth[_0x1c75('0x9')](),controller[_0x1c75('0x28')]);module[_0x1c75('0x29')]=router; \ No newline at end of file +var _0x5bb9=['get','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','/:id/teams','getTeams','getAgents','/:id/members','getMembers','/:id/lists','getBlackLists','post','create','clone','addTeams','/:id/users','addAgents','addLists','/:id/blacklists','addBlackLists','put','/:id','update','delete','destroy','removeTeams','removeAgents','removeBlackLists','exports','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5bb9,0x131));var _0x95bb=function(_0x30abc5,_0x178279){_0x30abc5=_0x30abc5-0x0;var _0x4f12b2=_0x5bb9[_0x30abc5];return _0x4f12b2;};'use strict';var multer=require(_0x95bb('0x0'));var util=require(_0x95bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x95bb('0x2'));var interaction=require(_0x95bb('0x3'));var config=require(_0x95bb('0x4'));var controller=require(_0x95bb('0x5'));router['get']('/',auth[_0x95bb('0x6')](),controller['index']);router['get']('/:id',auth[_0x95bb('0x6')](),controller['show']);router[_0x95bb('0x7')](_0x95bb('0x8'),auth[_0x95bb('0x6')](),controller[_0x95bb('0x9')]);router[_0x95bb('0x7')](_0x95bb('0xa'),auth[_0x95bb('0x6')](),controller[_0x95bb('0xb')]);router[_0x95bb('0x7')]('/:id/hopper_finals',auth[_0x95bb('0x6')](),controller[_0x95bb('0xc')]);router[_0x95bb('0x7')](_0x95bb('0xd'),auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0x95bb('0x7')](_0x95bb('0xe'),auth[_0x95bb('0x6')](),controller[_0x95bb('0xf')]);router[_0x95bb('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0x95bb('0x10')]);router[_0x95bb('0x7')](_0x95bb('0x11'),auth[_0x95bb('0x6')](),controller[_0x95bb('0x12')]);router[_0x95bb('0x7')](_0x95bb('0x13'),auth[_0x95bb('0x6')](),controller['getLists']);router[_0x95bb('0x7')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x95bb('0x14')]);router[_0x95bb('0x15')]('/',auth['isAuthenticated'](),controller[_0x95bb('0x16')]);router[_0x95bb('0x15')]('/:id/clone',auth[_0x95bb('0x6')](),controller[_0x95bb('0x17')]);router[_0x95bb('0x15')](_0x95bb('0xe'),auth[_0x95bb('0x6')](),controller[_0x95bb('0x18')]);router[_0x95bb('0x15')](_0x95bb('0x19'),auth[_0x95bb('0x6')](),controller[_0x95bb('0x1a')]);router[_0x95bb('0x15')](_0x95bb('0x13'),auth[_0x95bb('0x6')](),controller[_0x95bb('0x1b')]);router[_0x95bb('0x15')](_0x95bb('0x1c'),auth['isAuthenticated'](),controller[_0x95bb('0x1d')]);router[_0x95bb('0x1e')](_0x95bb('0x1f'),auth['isAuthenticated'](),controller[_0x95bb('0x20')]);router[_0x95bb('0x21')](_0x95bb('0x1f'),auth[_0x95bb('0x6')](),controller[_0x95bb('0x22')]);router[_0x95bb('0x21')]('/:id/teams',auth[_0x95bb('0x6')](),controller[_0x95bb('0x23')]);router[_0x95bb('0x21')](_0x95bb('0x19'),auth[_0x95bb('0x6')](),controller[_0x95bb('0x24')]);router[_0x95bb('0x21')](_0x95bb('0x13'),auth[_0x95bb('0x6')](),controller['removeLists']);router['delete'](_0x95bb('0x1c'),auth[_0x95bb('0x6')](),controller[_0x95bb('0x25')]);module[_0x95bb('0x26')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index e248553..db6c04d 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(_0x1ba523,_0x12e3cd){var _0x321f6b=function(_0x56bafe){while(--_0x56bafe){_0x1ba523['push'](_0x1ba523['shift']());}};_0x321f6b(++_0x12e3cd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x397d31,_0x48c9e9){var _0x256bfc=function(_0x6a7368){while(--_0x6a7368){_0x397d31['push'](_0x397d31['shift']());}};_0x256bfc(++_0x48c9e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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 e9312f8..ec00d04 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 _0x74f4=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','then','get','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type','name','UserProfileResource','error','stack','send','index','map','VoiceQueue','rawAttributes','fieldName','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','user','role','VoiceQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','autoAssociation','update','getHoppers','CmHopper','hasOwnProperty','VoiceQueueId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','User','Agents','online','interface','flatMap','forEach','penalty','transaction','each','UserVoiceQueue','UserVoiceQueueRt','upsert','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','ids','tq.TeamId','from','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','union','compact','isEmpty','userVoiceQueue:remove','addAgents','omit','spread','isNil','removeAgents','isArray','getAgents','getMembers','CmList','getLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','updatedAt','select','field','phone','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','COALESCE(phone,\x27\x27)','all','removeLists','getBlackLists','addBlackLists','phone\x20IS\x20NOT\x20NULL','removeBlackLists','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x1f70f9,_0x4d1f98){var _0x16bae6=function(_0x26ed32){while(--_0x26ed32){_0x1f70f9['push'](_0x1f70f9['shift']());}};_0x16bae6(++_0x4d1f98);}(_0x74f4,0xaa));var _0x474f=function(_0x272179,_0x2d53ea){_0x272179=_0x272179-0x0;var _0x581fa6=_0x74f4[_0x272179];return _0x581fa6;};'use strict';var pdf=require(_0x474f('0x0'));var emlformat=require(_0x474f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x474f('0x2'));var jsonpatch=require(_0x474f('0x3'));var rp=require('request-promise');var moment=require(_0x474f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x474f('0x5'));var util=require(_0x474f('0x6'));var path=require(_0x474f('0x7'));var sox=require('sox');var csv=require(_0x474f('0x8'));var ejs=require(_0x474f('0x9'));var fs=require('fs');var _=require(_0x474f('0xa'));var squel=require(_0x474f('0xb'));var crypto=require(_0x474f('0xc'));var jsforce=require(_0x474f('0xd'));var deskjs=require(_0x474f('0xe'));var toCsv=require(_0x474f('0x8'));var querystring=require(_0x474f('0xf'));var Papa=require(_0x474f('0x10'));var Redis=require(_0x474f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x474f('0x12'));var as=require(_0x474f('0x13'));var hardwareService=require(_0x474f('0x14'));var logger=require('../../config/logger')(_0x474f('0x15'));var utils=require(_0x474f('0x16'));var config=require(_0x474f('0x17'));var db=require('../../mysqldb')['db'];config[_0x474f('0x18')]=_[_0x474f('0x19')](config['redis'],{'host':_0x474f('0x1a'),'port':0x18eb});var socket=require(_0x474f('0x1b'))(new Redis(config[_0x474f('0x18')]));require('./voiceQueue.socket')[_0x474f('0x1c')](socket);function respondWithStatusCode(_0x7ffcb,_0x39885e){_0x39885e=_0x39885e||0xcc;return function(_0x3caae0){if(_0x3caae0){return _0x7ffcb[_0x474f('0x1d')](_0x39885e);}return _0x7ffcb[_0x474f('0x1e')](_0x39885e)[_0x474f('0x1f')]();};}function respondWithResult(_0x591cbd,_0xe4b5d3){_0xe4b5d3=_0xe4b5d3||0xc8;return function(_0x5e1d32){if(_0x5e1d32){return _0x591cbd[_0x474f('0x1e')](_0xe4b5d3)[_0x474f('0x20')](_0x5e1d32);}};}function respondWithFilteredResult(_0x54d0e5,_0x3c5143){return function(_0x47a581){if(_0x47a581){var _0x30ac4b=_0x47a581[_0x474f('0x21')],_0x2a172f=_0x3c5143['offset'],_0x36ef8c=_0x3c5143[_0x474f('0x22')]+_0x3c5143[_0x474f('0x23')],_0x3d13e3;if(_0x36ef8c>=_0x30ac4b){_0x36ef8c=_0x30ac4b;_0x3d13e3=0xc8;}else{_0x3d13e3=0xce;}_0x54d0e5[_0x474f('0x1e')](_0x3d13e3);return _0x54d0e5[_0x474f('0x24')](_0x474f('0x25'),_0x2a172f+'-'+_0x36ef8c+'/'+_0x30ac4b)['json'](_0x47a581);}return null;};}function patchUpdates(_0x4a7df3){return function(_0x14dd1e){try{jsonpatch[_0x474f('0x26')](_0x14dd1e,_0x4a7df3,!![]);}catch(_0x5667af){return BPromise[_0x474f('0x27')](_0x5667af);}return _0x14dd1e['save']();};}function saveUpdates(_0x28dc37,_0x3f93a7){return function(_0x3988ae){if(_0x3988ae){return _0x3988ae['update'](_0x28dc37)['then'](function(_0x20a388){return _0x20a388;});}return null;};}function removeEntity(_0x202600,_0x4fccb6){return function(_0x39d825){if(_0x39d825){return _0x39d825[_0x474f('0x28')]()[_0x474f('0x29')](function(){var _0x211535=_0x39d825[_0x474f('0x2a')]({'plain':!![]});var _0x10f111=[{'name':'VoiceQueues','value':_0x474f('0x2b'),'ignore':![]},{'name':_0x474f('0x2c'),'value':_0x474f('0x2d'),'ignore':![]}];var _0x315074=_(_0x10f111)[_0x474f('0x2e')](_0x474f('0x2f'))['map'](_0x474f('0x30'))[_0x474f('0x30')]();if(_[_0x474f('0x31')](_0x315074,_0x211535[_0x474f('0x32')])){return;}var _0x85adec=_['find'](_0x10f111,['value',_0x211535[_0x474f('0x32')]])[_0x474f('0x33')];return db[_0x474f('0x34')][_0x474f('0x28')]({'where':{'type':_0x85adec,'resourceId':_0x211535['id']}})[_0x474f('0x29')](function(){return _0x39d825;});})[_0x474f('0x29')](function(){_0x202600['status'](0xcc)[_0x474f('0x1f')]();});}};}function handleEntityNotFound(_0x2de99c,_0x582a0a){return function(_0x52a45d){if(!_0x52a45d){_0x2de99c[_0x474f('0x1d')](0x194);}return _0x52a45d;};}function handleError(_0x58b95a,_0x12668f){_0x12668f=_0x12668f||0x1f4;return function(_0x393ad5){logger[_0x474f('0x35')](_0x393ad5[_0x474f('0x36')]);if(_0x393ad5[_0x474f('0x33')]){delete _0x393ad5[_0x474f('0x33')];}_0x58b95a[_0x474f('0x1e')](_0x12668f)[_0x474f('0x37')](_0x393ad5);};}exports[_0x474f('0x38')]=function(_0x2ec478,_0x2b6aad){var _0x4f1fee={},_0x637418={},_0x919844={'count':0x0,'rows':[]};var _0x46979a=_[_0x474f('0x39')](db[_0x474f('0x3a')][_0x474f('0x3b')],function(_0x269fbb){return{'name':_0x269fbb[_0x474f('0x3c')],'type':_0x269fbb[_0x474f('0x32')]['key']};});_0x637418['model']=_['map'](_0x46979a,_0x474f('0x33'));_0x637418['query']=_['keys'](_0x2ec478[_0x474f('0x3d')]);_0x637418[_0x474f('0x3e')]=_[_0x474f('0x3f')](_0x637418['model'],_0x637418[_0x474f('0x3d')]);_0x4f1fee['attributes']=_[_0x474f('0x3f')](_0x637418[_0x474f('0x40')],qs[_0x474f('0x41')](_0x2ec478[_0x474f('0x3d')][_0x474f('0x41')]));_0x4f1fee[_0x474f('0x42')]=_0x4f1fee[_0x474f('0x42')][_0x474f('0x43')]?_0x4f1fee[_0x474f('0x42')]:_0x637418['model'];if(!_0x2ec478['query']['hasOwnProperty'](_0x474f('0x44'))){_0x4f1fee[_0x474f('0x23')]=qs['limit'](_0x2ec478['query']['limit']);_0x4f1fee[_0x474f('0x22')]=qs[_0x474f('0x22')](_0x2ec478[_0x474f('0x3d')][_0x474f('0x22')]);}_0x4f1fee[_0x474f('0x45')]=qs[_0x474f('0x46')](_0x2ec478[_0x474f('0x3d')][_0x474f('0x46')]);_0x4f1fee['where']=qs[_0x474f('0x3e')](_[_0x474f('0x47')](_0x2ec478[_0x474f('0x3d')],_0x637418['filters']));if(_0x2ec478[_0x474f('0x3d')][_0x474f('0x2e')]){_0x4f1fee[_0x474f('0x48')]=_['merge'](_0x4f1fee[_0x474f('0x48')],{'$or':_[_0x474f('0x39')](_0x46979a,function(_0x35cad7){if(_0x35cad7[_0x474f('0x32')]!==_0x474f('0x49')){var _0x11ff6b={};_0x11ff6b[_0x35cad7[_0x474f('0x33')]]={'$like':'%'+_0x2ec478[_0x474f('0x3d')][_0x474f('0x2e')]+'%'};return _0x11ff6b;}})});}_0x4f1fee=_[_0x474f('0x4a')]({},_0x4f1fee,_0x2ec478[_0x474f('0x4b')]);var _0x3e16f9={'where':_0x4f1fee[_0x474f('0x48')]};return db[_0x474f('0x3a')][_0x474f('0x21')](_0x3e16f9)[_0x474f('0x29')](function(_0x2ab767){_0x919844['count']=_0x2ab767;if(_0x2ec478[_0x474f('0x3d')][_0x474f('0x4c')]){_0x4f1fee[_0x474f('0x4d')]=[{'all':!![]}];}return db[_0x474f('0x3a')][_0x474f('0x4e')](_0x4f1fee);})[_0x474f('0x29')](function(_0x4ece30){_0x919844[_0x474f('0x4f')]=_0x4ece30;return _0x919844;})['then'](respondWithFilteredResult(_0x2b6aad,_0x4f1fee))['catch'](handleError(_0x2b6aad,null));};exports[_0x474f('0x50')]=function(_0x4a8d23,_0x366b67){var _0x578243={'raw':![],'where':{'id':_0x4a8d23[_0x474f('0x51')]['id']}},_0x1a88db={};_0x1a88db[_0x474f('0x40')]=_[_0x474f('0x52')](db[_0x474f('0x3a')][_0x474f('0x3b')]);_0x1a88db[_0x474f('0x3d')]=_[_0x474f('0x52')](_0x4a8d23[_0x474f('0x3d')]);_0x1a88db[_0x474f('0x3e')]=_['intersection'](_0x1a88db[_0x474f('0x40')],_0x1a88db[_0x474f('0x3d')]);_0x578243['attributes']=_[_0x474f('0x3f')](_0x1a88db[_0x474f('0x40')],qs[_0x474f('0x41')](_0x4a8d23[_0x474f('0x3d')][_0x474f('0x41')]));_0x578243[_0x474f('0x42')]=_0x578243[_0x474f('0x42')]['length']?_0x578243[_0x474f('0x42')]:_0x1a88db[_0x474f('0x40')];if(_0x4a8d23[_0x474f('0x3d')][_0x474f('0x4c')]){_0x578243[_0x474f('0x4d')]=[{'all':!![]}];}_0x578243=_[_0x474f('0x4a')]({},_0x578243,_0x4a8d23[_0x474f('0x4b')]);return db[_0x474f('0x3a')][_0x474f('0x53')](_0x578243)[_0x474f('0x29')](handleEntityNotFound(_0x366b67,null))[_0x474f('0x29')](respondWithResult(_0x366b67,null))[_0x474f('0x54')](handleError(_0x366b67,null));};exports[_0x474f('0x55')]=function(_0x1c5f00,_0x3f5cdd){return db[_0x474f('0x3a')][_0x474f('0x55')](_0x1c5f00[_0x474f('0x56')],{})['then'](function(_0x3809f8){var _0x598bda=_0x1c5f00[_0x474f('0x57')][_0x474f('0x2a')]({'plain':!![]});if(!_0x598bda)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x598bda[_0x474f('0x58')]===_0x474f('0x57')){var _0x47b137=_0x3809f8[_0x474f('0x2a')]({'plain':!![]});var _0x41e1ed=[{'name':_0x474f('0x59'),'value':_0x474f('0x2b')},{'name':'QueueCampaigns','value':_0x474f('0x2d')}];var _0x44656e=_[_0x474f('0x53')](_0x41e1ed,['value',_0x47b137[_0x474f('0x32')]])['name'];return db[_0x474f('0x5a')][_0x474f('0x53')]({'where':{'name':_0x44656e,'userProfileId':_0x598bda[_0x474f('0x5b')]},'raw':!![]})[_0x474f('0x29')](function(_0x374e50){if(_0x374e50&&_0x374e50['autoAssociation']===0x0){return db[_0x474f('0x34')][_0x474f('0x55')]({'name':_0x47b137[_0x474f('0x33')],'resourceId':_0x47b137['id'],'type':_0x374e50[_0x474f('0x33')],'sectionId':_0x374e50['id']},{})['then'](function(){return _0x3809f8;});}else{return _0x3809f8;}})[_0x474f('0x54')](function(_0x482f13){logger['error'](_0x474f('0x5c'),_0x482f13);throw _0x482f13;});}return _0x3809f8;})[_0x474f('0x29')](respondWithResult(_0x3f5cdd,0xc9))['catch'](handleError(_0x3f5cdd,null));};exports[_0x474f('0x5d')]=function(_0x4addd0,_0x31740f){var _0x5d32ed={'where':{'id':_0x4addd0[_0x474f('0x51')]['id']}},_0x26a8a2={};_0x26a8a2['model']=_['keys'](db[_0x474f('0x3a')]['rawAttributes']);_0x5d32ed[_0x474f('0x42')]=_[_0x474f('0x3f')](_0x26a8a2[_0x474f('0x40')],qs['fields'](_0x4addd0[_0x474f('0x3d')][_0x474f('0x41')]));_0x5d32ed[_0x474f('0x42')]=_0x5d32ed[_0x474f('0x42')][_0x474f('0x43')]?_0x5d32ed[_0x474f('0x42')]:_0x26a8a2['model'];if(_0x4addd0[_0x474f('0x3d')][_0x474f('0x4c')]){_0x5d32ed[_0x474f('0x4d')]=[{'all':!![]}];}_0x5d32ed=_[_0x474f('0x4a')]({},_0x5d32ed,_0x4addd0['options']);return db[_0x474f('0x3a')][_0x474f('0x53')](_0x5d32ed)[_0x474f('0x29')](handleEntityNotFound(_0x31740f,null))[_0x474f('0x29')](function(_0x3a0039){if(_0x3a0039){var _0x15c53c=_0x3a0039['get']({'plain':!![]});_0x15c53c=qs['omit'](_0x15c53c,['id',_0x474f('0x5e'),'updatedAt']);_0x4addd0[_0x474f('0x56')]=_['omit'](_0x4addd0['body'],['id',_0x474f('0x5e'),'updatedAt']);return db[_0x474f('0x3a')][_0x474f('0x55')](_[_0x474f('0x4a')](_0x15c53c,_0x4addd0[_0x474f('0x56')]),{'include':_0x4addd0[_0x474f('0x3d')][_0x474f('0x4c')]?[{'all':!![]}]:undefined})[_0x474f('0x29')](function(_0x1c5ad4){var _0xe8383=_0x4addd0[_0x474f('0x57')][_0x474f('0x2a')]({'plain':!![]});if(!_0xe8383)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe8383['role']==='user'){var _0x2e5e00=_0x1c5ad4[_0x474f('0x2a')]({'plain':!![]});var _0x3dcade=[{'name':_0x474f('0x59'),'value':_0x474f('0x2b')},{'name':'QueueCampaigns','value':'outbound'}];var _0x24fd26=_[_0x474f('0x53')](_0x3dcade,[_0x474f('0x30'),_0x2e5e00[_0x474f('0x32')]])[_0x474f('0x33')];return db[_0x474f('0x5a')]['find']({'where':{'name':_0x24fd26,'userProfileId':_0xe8383['userProfileId']},'raw':!![]})[_0x474f('0x29')](function(_0x106c25){if(_0x106c25&&_0x106c25[_0x474f('0x5f')]===0x0){return db[_0x474f('0x34')][_0x474f('0x55')]({'name':_0x2e5e00[_0x474f('0x33')],'resourceId':_0x2e5e00['id'],'type':_0x106c25[_0x474f('0x33')],'sectionId':_0x106c25['id']},{})['then'](function(){return _0x1c5ad4;});}else{return _0x1c5ad4;}})[_0x474f('0x54')](function(_0x9a14b8){logger[_0x474f('0x35')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9a14b8);throw _0x9a14b8;});}return _0x1c5ad4;});}})[_0x474f('0x29')](respondWithResult(_0x31740f,0xc9))[_0x474f('0x54')](handleError(_0x31740f,null));};exports[_0x474f('0x60')]=function(_0x50d8b9,_0x33c19d){if(_0x50d8b9[_0x474f('0x56')]['id']){delete _0x50d8b9['body']['id'];}return db[_0x474f('0x3a')]['find']({'where':{'id':_0x50d8b9[_0x474f('0x51')]['id']}})['then'](handleEntityNotFound(_0x33c19d,null))[_0x474f('0x29')](saveUpdates(_0x50d8b9[_0x474f('0x56')],null))[_0x474f('0x29')](respondWithResult(_0x33c19d,null))[_0x474f('0x54')](handleError(_0x33c19d,null));};exports[_0x474f('0x28')]=function(_0x158c01,_0x34a2ea){return db['VoiceQueue'][_0x474f('0x53')]({'where':{'id':_0x158c01['params']['id']}})[_0x474f('0x29')](handleEntityNotFound(_0x34a2ea,null))[_0x474f('0x29')](removeEntity(_0x34a2ea,null))[_0x474f('0x54')](handleError(_0x34a2ea,null));};exports[_0x474f('0x61')]=function(_0x30f121,_0x5d7258,_0x5bc7c2){var _0x1d6044={'raw':![],'where':{}};var _0x4806f3={};var _0x233295={'count':0x0,'rows':[]};return db[_0x474f('0x3a')]['findOne']({'where':{'id':_0x30f121[_0x474f('0x51')]['id']}})['then'](handleEntityNotFound(_0x5d7258,null))[_0x474f('0x29')](function(_0x64fd34){if(_0x64fd34){_0x4806f3[_0x474f('0x40')]=_['keys'](db[_0x474f('0x62')]['rawAttributes']);_0x4806f3[_0x474f('0x3d')]=_['keys'](_0x30f121[_0x474f('0x3d')]);_0x4806f3[_0x474f('0x3e')]=_['intersection'](_0x4806f3['model'],_0x4806f3[_0x474f('0x3d')]);_0x1d6044[_0x474f('0x42')]=_['intersection'](_0x4806f3[_0x474f('0x40')],qs[_0x474f('0x41')](_0x30f121[_0x474f('0x3d')][_0x474f('0x41')]));_0x1d6044[_0x474f('0x42')]=_0x1d6044[_0x474f('0x42')][_0x474f('0x43')]?_0x1d6044[_0x474f('0x42')]:_0x4806f3[_0x474f('0x40')];if(!_0x30f121['query'][_0x474f('0x63')](_0x474f('0x44'))){_0x1d6044[_0x474f('0x23')]=qs[_0x474f('0x23')](_0x30f121[_0x474f('0x3d')]['limit']);_0x1d6044[_0x474f('0x22')]=qs[_0x474f('0x22')](_0x30f121['query'][_0x474f('0x22')]);}_0x1d6044['order']=qs[_0x474f('0x46')](_0x30f121['query'][_0x474f('0x46')]);_0x1d6044[_0x474f('0x48')]=qs['filters'](_['pick'](_0x30f121[_0x474f('0x3d')],_0x4806f3['filters']));_0x1d6044[_0x474f('0x48')][_0x474f('0x64')]=_0x64fd34['id'];if(_0x30f121[_0x474f('0x3d')][_0x474f('0x2e')]){_0x1d6044[_0x474f('0x48')]=_[_0x474f('0x4a')](_0x1d6044[_0x474f('0x48')],{'$or':_[_0x474f('0x39')](_0x1d6044[_0x474f('0x42')],function(_0x8d4ea6){var _0x3f104b={};_0x3f104b[_0x8d4ea6]={'$like':'%'+_0x30f121[_0x474f('0x3d')][_0x474f('0x2e')]+'%'};return _0x3f104b;})});}_0x1d6044=_[_0x474f('0x4a')]({},_0x1d6044,_0x30f121[_0x474f('0x4b')]);return db[_0x474f('0x62')][_0x474f('0x21')]({'where':_0x1d6044['where']})[_0x474f('0x29')](function(_0x5c84d1){_0x233295['count']=_0x5c84d1;if(_0x30f121[_0x474f('0x3d')][_0x474f('0x4c')]){_0x1d6044['include']=[{'all':!![]}];}return db[_0x474f('0x62')][_0x474f('0x4e')](_0x1d6044);})[_0x474f('0x29')](function(_0x32ed4f){_0x233295['rows']=_0x32ed4f;return _0x233295;});}})[_0x474f('0x29')](respondWithFilteredResult(_0x5d7258,_0x1d6044))[_0x474f('0x54')](handleError(_0x5d7258,null));};exports[_0x474f('0x65')]=function(_0xb135ff,_0x2e5a1f,_0x522587){var _0xb81ad8={'raw':!![],'where':{}};var _0x1c42b1={};var _0x37fb8a={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x474f('0x66')]({'where':{'id':_0xb135ff[_0x474f('0x51')]['id']}})[_0x474f('0x29')](handleEntityNotFound(_0x2e5a1f,null))[_0x474f('0x29')](function(_0x58ab8d){if(_0x58ab8d){_0x1c42b1[_0x474f('0x40')]=_[_0x474f('0x52')](db[_0x474f('0x67')][_0x474f('0x3b')]);_0x1c42b1['query']=_[_0x474f('0x52')](_0xb135ff[_0x474f('0x3d')]);_0x1c42b1['filters']=_['intersection'](_0x1c42b1['model'],_0x1c42b1[_0x474f('0x3d')]);_0xb81ad8['attributes']=_[_0x474f('0x3f')](_0x1c42b1[_0x474f('0x40')],qs[_0x474f('0x41')](_0xb135ff['query'][_0x474f('0x41')]));_0xb81ad8['attributes']=_0xb81ad8[_0x474f('0x42')]['length']?_0xb81ad8[_0x474f('0x42')]:_0x1c42b1[_0x474f('0x40')];if(!_0xb135ff[_0x474f('0x3d')]['hasOwnProperty'](_0x474f('0x44'))){_0xb81ad8[_0x474f('0x23')]=qs[_0x474f('0x23')](_0xb135ff['query'][_0x474f('0x23')]);_0xb81ad8[_0x474f('0x22')]=qs[_0x474f('0x22')](_0xb135ff[_0x474f('0x3d')]['offset']);}_0xb81ad8[_0x474f('0x45')]=qs[_0x474f('0x46')](_0xb135ff[_0x474f('0x3d')][_0x474f('0x46')]);_0xb81ad8[_0x474f('0x48')]=qs['filters'](_['pick'](_0xb135ff[_0x474f('0x3d')],_0x1c42b1[_0x474f('0x3e')]));_0xb81ad8[_0x474f('0x48')][_0x474f('0x64')]=_0x58ab8d['id'];if(_0xb135ff[_0x474f('0x3d')]['filter']){_0xb81ad8[_0x474f('0x48')]=_['merge'](_0xb81ad8[_0x474f('0x48')],{'$or':_[_0x474f('0x39')](_0xb81ad8[_0x474f('0x42')],function(_0x1142f1){var _0x495556={};_0x495556[_0x1142f1]={'$like':'%'+_0xb135ff['query'][_0x474f('0x2e')]+'%'};return _0x495556;})});}_0xb81ad8=_['merge']({},_0xb81ad8,_0xb135ff['options']);return db[_0x474f('0x67')][_0x474f('0x21')]({'where':_0xb81ad8[_0x474f('0x48')]})[_0x474f('0x29')](function(_0x142c3a){_0x37fb8a['count']=_0x142c3a;if(_0xb135ff[_0x474f('0x3d')][_0x474f('0x4c')]){_0xb81ad8[_0x474f('0x4d')]=[{'all':!![]}];}return db[_0x474f('0x67')][_0x474f('0x4e')](_0xb81ad8);})[_0x474f('0x29')](function(_0x73a3a5){_0x37fb8a[_0x474f('0x4f')]=_0x73a3a5;return _0x37fb8a;});}})[_0x474f('0x29')](respondWithFilteredResult(_0x2e5a1f,_0xb81ad8))[_0x474f('0x54')](handleError(_0x2e5a1f,null));};exports[_0x474f('0x68')]=function(_0x4d6b38,_0x393ec8,_0x1cb025){var _0x3d2afc={'raw':!![],'where':{}};var _0x393dec={};var _0x122fea={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x474f('0x66')]({'where':{'id':_0x4d6b38[_0x474f('0x51')]['id']}})['then'](handleEntityNotFound(_0x393ec8,null))['then'](function(_0x58ffe3){if(_0x58ffe3){_0x393dec[_0x474f('0x40')]=_[_0x474f('0x52')](db[_0x474f('0x69')]['rawAttributes']);_0x393dec['query']=_[_0x474f('0x52')](_0x4d6b38[_0x474f('0x3d')]);_0x393dec['filters']=_[_0x474f('0x3f')](_0x393dec[_0x474f('0x40')],_0x393dec[_0x474f('0x3d')]);_0x3d2afc[_0x474f('0x42')]=_['intersection'](_0x393dec[_0x474f('0x40')],qs[_0x474f('0x41')](_0x4d6b38[_0x474f('0x3d')][_0x474f('0x41')]));_0x3d2afc[_0x474f('0x42')]=_0x3d2afc['attributes'][_0x474f('0x43')]?_0x3d2afc[_0x474f('0x42')]:_0x393dec[_0x474f('0x40')];if(!_0x4d6b38[_0x474f('0x3d')][_0x474f('0x63')]('nolimit')){_0x3d2afc['limit']=qs[_0x474f('0x23')](_0x4d6b38[_0x474f('0x3d')]['limit']);_0x3d2afc[_0x474f('0x22')]=qs[_0x474f('0x22')](_0x4d6b38[_0x474f('0x3d')][_0x474f('0x22')]);}_0x3d2afc[_0x474f('0x45')]=qs[_0x474f('0x46')](_0x4d6b38[_0x474f('0x3d')][_0x474f('0x46')]);_0x3d2afc[_0x474f('0x48')]=qs[_0x474f('0x3e')](_['pick'](_0x4d6b38['query'],_0x393dec[_0x474f('0x3e')]));_0x3d2afc[_0x474f('0x48')][_0x474f('0x64')]=_0x58ffe3['id'];if(_0x4d6b38[_0x474f('0x3d')][_0x474f('0x2e')]){_0x3d2afc[_0x474f('0x48')]=_[_0x474f('0x4a')](_0x3d2afc[_0x474f('0x48')],{'$or':_[_0x474f('0x39')](_0x3d2afc[_0x474f('0x42')],function(_0x51902e){var _0x8e1611={};_0x8e1611[_0x51902e]={'$like':'%'+_0x4d6b38[_0x474f('0x3d')][_0x474f('0x2e')]+'%'};return _0x8e1611;})});}_0x3d2afc=_[_0x474f('0x4a')]({},_0x3d2afc,_0x4d6b38[_0x474f('0x4b')]);return db[_0x474f('0x69')][_0x474f('0x21')]({'where':_0x3d2afc['where']})[_0x474f('0x29')](function(_0x2ef706){_0x122fea[_0x474f('0x21')]=_0x2ef706;if(_0x4d6b38['query'][_0x474f('0x4c')]){_0x3d2afc[_0x474f('0x4d')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x474f('0x4e')](_0x3d2afc);})['then'](function(_0x1c63d9){_0x122fea[_0x474f('0x4f')]=_0x1c63d9;return _0x122fea;});}})[_0x474f('0x29')](respondWithFilteredResult(_0x393ec8,_0x3d2afc))[_0x474f('0x54')](handleError(_0x393ec8,null));};exports[_0x474f('0x6a')]=function(_0x57c2e5,_0x15ba57,_0x3e07f3){var _0x44e797={'raw':!![],'where':{}};var _0x6f0b50={};var _0x5a199f={'count':0x0,'rows':[]};return db[_0x474f('0x3a')][_0x474f('0x66')]({'where':{'id':_0x57c2e5[_0x474f('0x51')]['id']}})['then'](handleEntityNotFound(_0x15ba57,null))[_0x474f('0x29')](function(_0x2b0713){if(_0x2b0713){_0x6f0b50['model']=_['keys'](db[_0x474f('0x6b')][_0x474f('0x3b')]);_0x6f0b50[_0x474f('0x3d')]=_['keys'](_0x57c2e5[_0x474f('0x3d')]);_0x6f0b50[_0x474f('0x3e')]=_[_0x474f('0x3f')](_0x6f0b50[_0x474f('0x40')],_0x6f0b50[_0x474f('0x3d')]);_0x44e797[_0x474f('0x42')]=_[_0x474f('0x3f')](_0x6f0b50[_0x474f('0x40')],qs[_0x474f('0x41')](_0x57c2e5[_0x474f('0x3d')]['fields']));_0x44e797['attributes']=_0x44e797[_0x474f('0x42')][_0x474f('0x43')]?_0x44e797[_0x474f('0x42')]:_0x6f0b50[_0x474f('0x40')];if(!_0x57c2e5[_0x474f('0x3d')]['hasOwnProperty'](_0x474f('0x44'))){_0x44e797['limit']=qs['limit'](_0x57c2e5[_0x474f('0x3d')][_0x474f('0x23')]);_0x44e797['offset']=qs[_0x474f('0x22')](_0x57c2e5[_0x474f('0x3d')][_0x474f('0x22')]);}_0x44e797[_0x474f('0x45')]=qs[_0x474f('0x46')](_0x57c2e5[_0x474f('0x3d')][_0x474f('0x46')]);_0x44e797[_0x474f('0x48')]=qs['filters'](_[_0x474f('0x47')](_0x57c2e5[_0x474f('0x3d')],_0x6f0b50[_0x474f('0x3e')]));_0x44e797[_0x474f('0x48')][_0x474f('0x64')]=_0x2b0713['id'];if(_0x57c2e5['query']['filter']){_0x44e797[_0x474f('0x48')]=_[_0x474f('0x4a')](_0x44e797['where'],{'$or':_[_0x474f('0x39')](_0x44e797[_0x474f('0x42')],function(_0x583ceb){var _0x46a24a={};_0x46a24a[_0x583ceb]={'$like':'%'+_0x57c2e5[_0x474f('0x3d')][_0x474f('0x2e')]+'%'};return _0x46a24a;})});}_0x44e797=_['merge']({},_0x44e797,_0x57c2e5[_0x474f('0x4b')]);return db['CmHopperBlack'][_0x474f('0x21')]({'where':_0x44e797[_0x474f('0x48')]})[_0x474f('0x29')](function(_0x54349e){_0x5a199f[_0x474f('0x21')]=_0x54349e;if(_0x57c2e5['query'][_0x474f('0x4c')]){_0x44e797[_0x474f('0x4d')]=[{'all':!![]}];}return db[_0x474f('0x6b')]['findAll'](_0x44e797);})[_0x474f('0x29')](function(_0x4ba7ab){_0x5a199f[_0x474f('0x4f')]=_0x4ba7ab;return _0x5a199f;});}})[_0x474f('0x29')](respondWithFilteredResult(_0x15ba57,_0x44e797))[_0x474f('0x54')](handleError(_0x15ba57,null));};exports[_0x474f('0x6c')]=function(_0x580786,_0x4d14d4,_0x56a10e){var _0x48d14f={};var _0x13798e={};var _0x15714d;var _0x26ca54;return db['VoiceQueue']['findOne']({'where':{'id':_0x580786[_0x474f('0x51')]['id']}})[_0x474f('0x29')](handleEntityNotFound(_0x4d14d4,null))[_0x474f('0x29')](function(_0x516e78){if(_0x516e78){_0x15714d=_0x516e78;_0x13798e[_0x474f('0x40')]=_[_0x474f('0x52')](db[_0x474f('0x6d')][_0x474f('0x3b')]);_0x13798e[_0x474f('0x3d')]=_['keys'](_0x580786[_0x474f('0x3d')]);_0x13798e[_0x474f('0x3e')]=_[_0x474f('0x3f')](_0x13798e[_0x474f('0x40')],_0x13798e['query']);_0x48d14f[_0x474f('0x42')]=_[_0x474f('0x3f')](_0x13798e[_0x474f('0x40')],qs['fields'](_0x580786[_0x474f('0x3d')][_0x474f('0x41')]));_0x48d14f[_0x474f('0x42')]=_0x48d14f['attributes'][_0x474f('0x43')]?_0x48d14f['attributes']:_0x13798e[_0x474f('0x40')];_0x48d14f[_0x474f('0x45')]=qs[_0x474f('0x46')](_0x580786[_0x474f('0x3d')][_0x474f('0x46')]);_0x48d14f['where']=qs[_0x474f('0x3e')](_['pick'](_0x580786['query'],_0x13798e[_0x474f('0x3e')]));if(_0x580786[_0x474f('0x3d')]['filter']){_0x48d14f['where']=_[_0x474f('0x4a')](_0x48d14f['where'],{'$or':_['map'](_0x48d14f[_0x474f('0x42')],function(_0x2d8b28){var _0x2b2dc5={};_0x2b2dc5[_0x2d8b28]={'$like':'%'+_0x580786[_0x474f('0x3d')][_0x474f('0x2e')]+'%'};return _0x2b2dc5;})});}_0x48d14f=_[_0x474f('0x4a')]({},_0x48d14f,_0x580786[_0x474f('0x4b')]);return _0x15714d['getTeams'](_0x48d14f);}})[_0x474f('0x29')](function(_0x25cab1){if(_0x25cab1){_0x26ca54=_0x25cab1['length'];if(!_0x580786[_0x474f('0x3d')]['hasOwnProperty'](_0x474f('0x44'))){_0x48d14f[_0x474f('0x23')]=qs[_0x474f('0x23')](_0x580786[_0x474f('0x3d')]['limit']);_0x48d14f[_0x474f('0x22')]=qs[_0x474f('0x22')](_0x580786[_0x474f('0x3d')][_0x474f('0x22')]);}return _0x15714d['getTeams'](_0x48d14f);}})[_0x474f('0x29')](function(_0x14a662){if(_0x14a662){return _0x14a662?{'count':_0x26ca54,'rows':_0x14a662}:null;}})[_0x474f('0x29')](respondWithResult(_0x4d14d4,null))[_0x474f('0x54')](handleError(_0x4d14d4,null));};exports[_0x474f('0x6e')]=function(_0x126d29,_0x156d19,_0x546b97){var _0x887a52=_0x126d29['body']['teams'];var _0x28468e=_['map'](_0x887a52,'id');return db[_0x474f('0x6d')]['findAll']({'where':{'id':_0x28468e},'attributes':['id'],'include':[{'model':db[_0x474f('0x6f')],'as':_0x474f('0x70'),'attributes':['id','name',_0x474f('0x71'),'voicePause',_0x474f('0x72')],'raw':!![]}]})[_0x474f('0x29')](function(_0x3cf850){if(_0x3cf850){var _0x133020=_[_0x474f('0x73')](_0x3cf850,function(_0x39ea61){var _0x3c2659=_0x39ea61[_0x474f('0x2a')]({'plain':!![]});_0x3c2659[_0x474f('0x70')][_0x474f('0x74')](function(_0x58a90d){_0x58a90d['penalty']=_[_0x474f('0x53')](_0x887a52,{'id':_0x3c2659['id']})[_0x474f('0x75')];});return _0x3c2659[_0x474f('0x70')];});return db[_0x474f('0x3a')]['find']({'where':{'id':_0x126d29[_0x474f('0x51')]['id']}})[_0x474f('0x29')](function(_0x283672){return db['sequelize'][_0x474f('0x76')](function(_0x359705){return _0x283672[_0x474f('0x6e')](_0x28468e,{'transaction':_0x359705})[_0x474f('0x29')](function(){return BPromise[_0x474f('0x77')](_0x133020,function(_0x313dc2){return db[_0x474f('0x78')]['findOrCreate']({'where':{'UserId':_0x313dc2['id'],'VoiceQueueId':_0x126d29[_0x474f('0x51')]['id']},'defaults':{'penalty':_0x313dc2['penalty']},'transaction':_0x359705});});})[_0x474f('0x29')](function(){return BPromise[_0x474f('0x77')](_['filter'](_0x133020,{'online':!![]}),function(_0x31f52a){return db[_0x474f('0x79')][_0x474f('0x7a')]({'membername':_0x31f52a[_0x474f('0x33')],'UserId':_0x31f52a['id'],'queue_name':_0x283672[_0x474f('0x33')],'VoiceQueueId':_0x283672['id'],'interface':_['isNil'](_0x31f52a[_0x474f('0x72')])?util[_0x474f('0x7b')](_0x474f('0x7c'),_0x31f52a['name']):_0x31f52a[_0x474f('0x72')],'paused':_0x31f52a[_0x474f('0x7d')]||![],'penalty':_0x31f52a[_0x474f('0x75')]},{'transaction':_0x359705});});})[_0x474f('0x29')](function(){_0x133020[_0x474f('0x74')](function(_0x656815){socket[_0x474f('0x7e')](_0x474f('0x7f'),{'UserId':_0x656815['id'],'VoiceQueueId':_0x283672['id']});});});});});}})[_0x474f('0x29')](respondWithStatusCode(_0x156d19,null))['catch'](handleError(_0x156d19,null));};exports[_0x474f('0x80')]=function(_0x4963f0,_0x3273dc,_0x3c5db6){return db[_0x474f('0x6d')][_0x474f('0x4e')]({'where':{'id':_0x4963f0[_0x474f('0x3d')][_0x474f('0x81')]},'attributes':['id'],'include':[{'model':db[_0x474f('0x6f')],'as':_0x474f('0x70'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3273dc,null))['then'](function(_0x84a05){var _0x4570e9=_[_0x474f('0x39')](_0x84a05,'id');var _0x2bde05=[];var _0x2e3d30=[];var _0x11f274=squel['select']();_0x11f274['field'](_0x474f('0x82'))[_0x474f('0x83')]('team_has_voice_queues','tq')[_0x474f('0x84')](_0x474f('0x85'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x474f('0x48')](_0x474f('0x86'),_0x4963f0[_0x474f('0x51')]['id']);for(var _0x20f8aa=0x0;_0x20f8aa<_0x84a05[_0x474f('0x43')];_0x20f8aa+=0x1){let _0x155544=_0x84a05[_0x20f8aa];for(var _0x1ff2ae=0x0;_0x1ff2ae<_0x155544[_0x474f('0x70')][_0x474f('0x43')];_0x1ff2ae+=0x1){let _0x15ad75=_0x155544[_0x474f('0x70')][_0x1ff2ae];var _0x12291c=_0x11f274[_0x474f('0x5d')]();_0x12291c[_0x474f('0x48')](_0x474f('0x87'),_0x15ad75['id']);_0x2e3d30[_0x474f('0x88')](db[_0x474f('0x89')][_0x474f('0x3d')](_0x12291c[_0x474f('0x8a')](),{'type':db[_0x474f('0x89')][_0x474f('0x8b')][_0x474f('0x8c')]})[_0x474f('0x29')](function(_0x2d3234){if(_0x2d3234[_0x474f('0x43')]===0x1){return _0x15ad75['id'];}else{var _0x19621d=_[_0x474f('0x8d')](_[_0x474f('0x39')](_0x2d3234,_0x474f('0x8e')),function(_0x32d071){return _[_0x474f('0x31')](_0x4570e9,_0x32d071);});if(_0x19621d){return _0x15ad75['id'];}}}));}}return BPromise['all'](_0x2e3d30)[_0x474f('0x29')](function(_0x1add08){_0x2bde05=_(_0x2bde05)[_0x474f('0x8f')](_0x1add08)[_0x474f('0x90')]()[_0x474f('0x30')]();return db[_0x474f('0x3a')][_0x474f('0x53')]({'where':{'id':_0x4963f0[_0x474f('0x51')]['id']}})[_0x474f('0x29')](function(_0x208013){return db[_0x474f('0x89')][_0x474f('0x76')](function(_0x42e273){return _0x208013[_0x474f('0x80')](_0x4963f0[_0x474f('0x3d')][_0x474f('0x81')],{'transaction':_0x42e273})['then'](function(){if(!_[_0x474f('0x91')](_0x2bde05)){return _0x208013['removeAgents'](_0x2bde05,{'transaction':_0x42e273})['then'](function(){return db[_0x474f('0x79')]['destroy']({'where':{'VoiceQueueId':_0x4963f0[_0x474f('0x51')]['id'],'UserId':_0x2bde05},'transaction':_0x42e273});});}})[_0x474f('0x29')](function(){_0x2bde05[_0x474f('0x74')](function(_0x1bfb65){socket['emit'](_0x474f('0x92'),{'UserId':_0x1bfb65,'VoiceQueueId':_0x208013['id']});});});});});});})[_0x474f('0x29')](respondWithStatusCode(_0x3273dc,null))[_0x474f('0x54')](handleError(_0x3273dc,null));};exports[_0x474f('0x93')]=function(_0x54785f,_0x2139da,_0xb82d11){var _0xdf6591,_0x570fba;return db[_0x474f('0x3a')][_0x474f('0x53')]({'where':{'id':_0x54785f[_0x474f('0x51')]['id']}})[_0x474f('0x29')](handleEntityNotFound(_0x2139da,null))[_0x474f('0x29')](function(_0x2b62b0){if(_0x2b62b0){_0x570fba=_0x2b62b0;return _0x2b62b0['addAgents'](_0x54785f[_0x474f('0x56')][_0x474f('0x81')],_[_0x474f('0x94')](_0x54785f['body'],['ids','id'])||{})[_0x474f('0x95')](function(_0x565782){for(var _0x498ba8=0x0;_0x498ba8<_0x54785f[_0x474f('0x56')][_0x474f('0x81')]['length'];_0x498ba8+=0x1){socket[_0x474f('0x7e')](_0x474f('0x7f'),{'UserId':_0x54785f['body'][_0x474f('0x81')][_0x498ba8],'VoiceQueueId':_0x54785f[_0x474f('0x51')]['id']});}return _0x565782;});}})['then'](function(_0x51020c){_0xdf6591=_0x51020c||[];if(_0x570fba){return db[_0x474f('0x6f')]['findAll']({'where':{'id':_0x54785f[_0x474f('0x56')]['ids']},'attributes':['id',_0x474f('0x33'),_0x474f('0x71'),_0x474f('0x7d'),_0x474f('0x72')],'raw':!![]});}})[_0x474f('0x29')](function(_0x986181){if(!_['isEmpty'](_0x986181)){var _0x57eba0=[];for(var _0x20b28a=0x0;_0x20b28a<_0x986181[_0x474f('0x43')];_0x20b28a++){if(_0x986181[_0x20b28a][_0x474f('0x71')]){_0x57eba0['push'](db[_0x474f('0x79')][_0x474f('0x7a')]({'membername':_0x986181[_0x20b28a][_0x474f('0x33')],'UserId':_0x986181[_0x20b28a]['id'],'queue_name':_0x570fba[_0x474f('0x33')],'VoiceQueueId':_0x570fba['id'],'interface':_[_0x474f('0x96')](_0x986181[_0x20b28a][_0x474f('0x72')])?util[_0x474f('0x7b')](_0x474f('0x7c'),_0x986181[_0x20b28a][_0x474f('0x33')]):_0x986181[_0x20b28a][_0x474f('0x72')],'paused':_0x986181[_0x20b28a][_0x474f('0x7d')]||![],'penalty':_0x54785f[_0x474f('0x56')][_0x474f('0x75')]||0x0}));}}return BPromise['all'](_0x57eba0);}})[_0x474f('0x29')](function(){return _0xdf6591;})['then'](respondWithResult(_0x2139da,null))[_0x474f('0x54')](handleError(_0x2139da,null));};exports[_0x474f('0x97')]=function(_0x25bc3e,_0xe21df5,_0x25b65c){return db[_0x474f('0x3a')][_0x474f('0x53')]({'where':{'id':_0x25bc3e[_0x474f('0x51')]['id']}})['then'](handleEntityNotFound(_0xe21df5,null))['then'](function(_0x232721){if(_0x232721){return _0x232721['removeAgents'](_0x25bc3e['query']['ids'])['then'](function(){if(_[_0x474f('0x98')](_0x25bc3e['query'][_0x474f('0x81')])){for(var _0x2378d8=0x0;_0x2378d8<_0x25bc3e[_0x474f('0x3d')][_0x474f('0x81')][_0x474f('0x43')];_0x2378d8+=0x1){socket[_0x474f('0x7e')](_0x474f('0x92'),{'UserId':Number(_0x25bc3e[_0x474f('0x3d')][_0x474f('0x81')][_0x2378d8]),'VoiceQueueId':Number(_0x25bc3e[_0x474f('0x51')]['id'])});}}else{socket[_0x474f('0x7e')](_0x474f('0x92'),{'UserId':Number(_0x25bc3e['query']['ids']),'VoiceQueueId':Number(_0x25bc3e['params']['id'])});}});}})[_0x474f('0x29')](function(_0x4a3970){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x25bc3e[_0x474f('0x51')]['id'],'UserId':_0x25bc3e[_0x474f('0x3d')][_0x474f('0x81')]}})[_0x474f('0x29')](function(){return _0x4a3970;});})[_0x474f('0x29')](respondWithStatusCode(_0xe21df5,null))[_0x474f('0x54')](handleError(_0xe21df5,null));};exports[_0x474f('0x99')]=function(_0x443004,_0x416342,_0x35bf99){var _0x17b7f0={};var _0x30869f={};var _0x2f958b;var _0x112cbd;return db[_0x474f('0x3a')][_0x474f('0x66')]({'where':{'id':_0x443004[_0x474f('0x51')]['id']}})[_0x474f('0x29')](handleEntityNotFound(_0x416342,null))[_0x474f('0x29')](function(_0x58dd0d){if(_0x58dd0d){_0x2f958b=_0x58dd0d;_0x30869f[_0x474f('0x40')]=_[_0x474f('0x52')](db[_0x474f('0x6f')][_0x474f('0x3b')]);_0x30869f[_0x474f('0x3d')]=_['keys'](_0x443004[_0x474f('0x3d')]);_0x30869f['filters']=_['intersection'](_0x30869f['model'],_0x30869f['query']);_0x17b7f0[_0x474f('0x42')]=_[_0x474f('0x3f')](_0x30869f[_0x474f('0x40')],qs['fields'](_0x443004[_0x474f('0x3d')][_0x474f('0x41')]));_0x17b7f0[_0x474f('0x42')]=_0x17b7f0[_0x474f('0x42')]['length']?_0x17b7f0[_0x474f('0x42')]:_0x30869f[_0x474f('0x40')];_0x17b7f0['order']=qs[_0x474f('0x46')](_0x443004[_0x474f('0x3d')][_0x474f('0x46')]);_0x17b7f0['where']=qs[_0x474f('0x3e')](_[_0x474f('0x47')](_0x443004[_0x474f('0x3d')],_0x30869f[_0x474f('0x3e')]));if(_0x443004[_0x474f('0x3d')][_0x474f('0x2e')]){_0x17b7f0[_0x474f('0x48')]=_['merge'](_0x17b7f0['where'],{'$or':_['map'](_0x17b7f0['attributes'],function(_0x5a0e25){var _0x59e7eb={};_0x59e7eb[_0x5a0e25]={'$like':'%'+_0x443004[_0x474f('0x3d')][_0x474f('0x2e')]+'%'};return _0x59e7eb;})});}_0x17b7f0=_['merge']({},_0x17b7f0,_0x443004[_0x474f('0x4b')]);return _0x2f958b[_0x474f('0x99')](_0x17b7f0);}})[_0x474f('0x29')](function(_0x2b6b71){if(_0x2b6b71){_0x112cbd=_0x2b6b71[_0x474f('0x43')];if(!_0x443004[_0x474f('0x3d')][_0x474f('0x63')](_0x474f('0x44'))){_0x17b7f0[_0x474f('0x23')]=qs[_0x474f('0x23')](_0x443004[_0x474f('0x3d')][_0x474f('0x23')]);_0x17b7f0[_0x474f('0x22')]=qs['offset'](_0x443004[_0x474f('0x3d')]['offset']);}return _0x2f958b[_0x474f('0x99')](_0x17b7f0);}})[_0x474f('0x29')](function(_0x445801){if(_0x445801){return _0x445801?{'count':_0x112cbd,'rows':_0x445801}:null;}})['then'](respondWithResult(_0x416342,null))[_0x474f('0x54')](handleError(_0x416342,null));};exports[_0x474f('0x9a')]=function(_0x20edb9,_0x1887e3,_0x2e79d4){var _0x41d662={};var _0x1984bd={};var _0x1b8aca;var _0x3e25c5;return db[_0x474f('0x3a')][_0x474f('0x66')]({'where':{'id':_0x20edb9[_0x474f('0x51')]['id']}})[_0x474f('0x29')](handleEntityNotFound(_0x1887e3,null))[_0x474f('0x29')](function(_0x5ca9e7){if(_0x5ca9e7){_0x1b8aca=_0x5ca9e7;_0x1984bd[_0x474f('0x40')]=_[_0x474f('0x52')](db['UserVoiceQueueRt'][_0x474f('0x3b')]);_0x1984bd[_0x474f('0x3d')]=_[_0x474f('0x52')](_0x20edb9[_0x474f('0x3d')]);_0x1984bd[_0x474f('0x3e')]=_['intersection'](_0x1984bd[_0x474f('0x40')],_0x1984bd['query']);_0x41d662[_0x474f('0x42')]=_[_0x474f('0x3f')](_0x1984bd[_0x474f('0x40')],qs['fields'](_0x20edb9['query'][_0x474f('0x41')]));_0x41d662[_0x474f('0x42')]=_0x41d662[_0x474f('0x42')][_0x474f('0x43')]?_0x41d662[_0x474f('0x42')]:_0x1984bd['model'];_0x41d662['order']=qs[_0x474f('0x46')](_0x20edb9[_0x474f('0x3d')][_0x474f('0x46')]);_0x41d662[_0x474f('0x48')]=qs[_0x474f('0x3e')](_[_0x474f('0x47')](_0x20edb9[_0x474f('0x3d')],_0x1984bd[_0x474f('0x3e')]));if(_0x20edb9[_0x474f('0x3d')][_0x474f('0x2e')]){_0x41d662[_0x474f('0x48')]=_[_0x474f('0x4a')](_0x41d662[_0x474f('0x48')],{'$or':_[_0x474f('0x39')](_0x41d662[_0x474f('0x42')],function(_0x5a110b){var _0x2bf131={};_0x2bf131[_0x5a110b]={'$like':'%'+_0x20edb9[_0x474f('0x3d')]['filter']+'%'};return _0x2bf131;})});}_0x41d662=_[_0x474f('0x4a')]({},_0x41d662,_0x20edb9[_0x474f('0x4b')]);return _0x1b8aca[_0x474f('0x9a')](_0x41d662);}})[_0x474f('0x29')](function(_0x27b930){if(_0x27b930){_0x3e25c5=_0x27b930[_0x474f('0x43')];if(!_0x20edb9[_0x474f('0x3d')][_0x474f('0x63')](_0x474f('0x44'))){_0x41d662[_0x474f('0x23')]=qs[_0x474f('0x23')](_0x20edb9[_0x474f('0x3d')][_0x474f('0x23')]);_0x41d662[_0x474f('0x22')]=qs['offset'](_0x20edb9[_0x474f('0x3d')][_0x474f('0x22')]);}return _0x1b8aca['getMembers'](_0x41d662);}})[_0x474f('0x29')](function(_0x378309){return _0x378309?{'count':_0x3e25c5,'rows':_0x378309}:null;})[_0x474f('0x29')](respondWithResult(_0x1887e3,null))[_0x474f('0x54')](handleError(_0x1887e3,null));};exports['getLists']=function(_0xcdca6f,_0x1f8c88,_0x58d00a){var _0x19cb3b={};var _0x2eb1e1={};var _0x15fd34;var _0xff4da;return db['VoiceQueue'][_0x474f('0x66')]({'where':{'id':_0xcdca6f[_0x474f('0x51')]['id']}})['then'](handleEntityNotFound(_0x1f8c88,null))['then'](function(_0x33c1bd){if(_0x33c1bd){_0x15fd34=_0x33c1bd;_0x2eb1e1[_0x474f('0x40')]=_[_0x474f('0x52')](db[_0x474f('0x9b')]['rawAttributes']);_0x2eb1e1[_0x474f('0x3d')]=_['keys'](_0xcdca6f[_0x474f('0x3d')]);_0x2eb1e1[_0x474f('0x3e')]=_['intersection'](_0x2eb1e1[_0x474f('0x40')],_0x2eb1e1[_0x474f('0x3d')]);_0x19cb3b[_0x474f('0x42')]=_['intersection'](_0x2eb1e1[_0x474f('0x40')],qs[_0x474f('0x41')](_0xcdca6f[_0x474f('0x3d')][_0x474f('0x41')]));_0x19cb3b['attributes']=_0x19cb3b[_0x474f('0x42')][_0x474f('0x43')]?_0x19cb3b[_0x474f('0x42')]:_0x2eb1e1[_0x474f('0x40')];_0x19cb3b[_0x474f('0x45')]=qs[_0x474f('0x46')](_0xcdca6f[_0x474f('0x3d')][_0x474f('0x46')]);_0x19cb3b['where']=qs[_0x474f('0x3e')](_[_0x474f('0x47')](_0xcdca6f[_0x474f('0x3d')],_0x2eb1e1['filters']));if(_0xcdca6f['query'][_0x474f('0x2e')]){_0x19cb3b[_0x474f('0x48')]=_['merge'](_0x19cb3b[_0x474f('0x48')],{'$or':_[_0x474f('0x39')](_0x19cb3b[_0x474f('0x42')],function(_0x1623cc){var _0x51a11d={};_0x51a11d[_0x1623cc]={'$like':'%'+_0xcdca6f[_0x474f('0x3d')][_0x474f('0x2e')]+'%'};return _0x51a11d;})});}_0x19cb3b=_[_0x474f('0x4a')]({},_0x19cb3b,_0xcdca6f[_0x474f('0x4b')]);return _0x15fd34['getLists'](_0x19cb3b);}})[_0x474f('0x29')](function(_0x153490){if(_0x153490){_0xff4da=_0x153490[_0x474f('0x43')];if(!_0xcdca6f[_0x474f('0x3d')][_0x474f('0x63')](_0x474f('0x44'))){_0x19cb3b['limit']=qs[_0x474f('0x23')](_0xcdca6f['query']['limit']);_0x19cb3b['offset']=qs[_0x474f('0x22')](_0xcdca6f[_0x474f('0x3d')][_0x474f('0x22')]);}return _0x15fd34[_0x474f('0x9c')](_0x19cb3b);}})['then'](function(_0x2c89dd){if(_0x2c89dd){return _0x2c89dd?{'count':_0xff4da,'rows':_0x2c89dd}:null;}})[_0x474f('0x29')](respondWithResult(_0x1f8c88,null))[_0x474f('0x54')](handleError(_0x1f8c88,null));};exports['addLists']=function(_0x41fa2a,_0x141034,_0x19a658){var _0x11ff9,_0x3a2f3c;return db[_0x474f('0x3a')]['find']({'where':{'id':_0x41fa2a[_0x474f('0x51')]['id']}})[_0x474f('0x29')](handleEntityNotFound(_0x141034,null))[_0x474f('0x29')](function(_0xbb0ae3){if(_0xbb0ae3){_0x3a2f3c=_0xbb0ae3;return _0xbb0ae3['addLists'](_0x41fa2a[_0x474f('0x56')][_0x474f('0x81')],_['omit'](_0x41fa2a['body'],['ids','id'])||{});}return null;})[_0x474f('0x95')](function(_0x8a9fd1){var _0x1c801a;_0x11ff9=_0x8a9fd1||[];var _0xca0077=[];if(_0x8a9fd1){for(var _0x38e77f=0x0;_0x38e77f<_0x8a9fd1['length'];_0x38e77f+=0x1){var _0x15c4ac=_0x8a9fd1[_0x38e77f][_0x474f('0x2a')]({'plain':!![]});_0x3a2f3c['dialCheckDuplicateType']=_0x41fa2a[_0x474f('0x56')]['dialCheckDuplicateType']?_0x41fa2a[_0x474f('0x56')]['dialCheckDuplicateType']:_0x3a2f3c[_0x474f('0x9d')];switch(_0x3a2f3c[_0x474f('0x9d')]){case _0x474f('0x9e'):_0x1c801a=squel[_0x474f('0x9f')]()[_0x474f('0xa0')](_0x474f('0xa1'))[_0x474f('0xa2')](['phone',_0x474f('0xa3'),_0x474f('0xa4'),_0x474f('0xa5'),_0x474f('0x64'),'createdAt',_0x474f('0xa6')],squel[_0x474f('0xa7')]()[_0x474f('0xa8')](_0x474f('0xa9'),_0x474f('0xa9'))['field'](_0x474f('0xaa'),'scheduledAt')[_0x474f('0xa8')]('id',_0x474f('0xa4'))['field'](_0x15c4ac['CmListId'][_0x474f('0x8a')](),_0x474f('0xa5'))['field'](_0x41fa2a[_0x474f('0x51')]['id'][_0x474f('0x8a')](),_0x474f('0x64'))['field'](_0x474f('0xaa'),'createdAt')['field'](_0x474f('0xaa'),'updatedAt')[_0x474f('0x83')](_0x474f('0xab'))[_0x474f('0x48')](_0x474f('0xac'))[_0x474f('0x48')](_0x474f('0xad'),_0x15c4ac[_0x474f('0xae')][_0x474f('0x8a')]())[_0x474f('0x48')]('phone\x20IS\x20NOT\x20NULL')[_0x474f('0x48')](_0x474f('0xaf'),squel[_0x474f('0xa7')]()['field']('COALESCE(calleridnum,\x27\x27)')['from']('cm_hopper_final')[_0x474f('0x48')](_0x474f('0x86'),_0x41fa2a[_0x474f('0x51')]['id'][_0x474f('0x8a')]()))[_0x474f('0x48')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x474f('0xa8')]('COALESCE(phone,\x27\x27)')[_0x474f('0x83')](_0x474f('0xa1'))[_0x474f('0x48')](_0x474f('0x86'),_0x41fa2a['params']['id'][_0x474f('0x8a')]())))[_0x474f('0x8a')]();break;case _0x474f('0xb0'):_0x1c801a=squel['insert']()['into'](_0x474f('0xa1'))[_0x474f('0xa2')]([_0x474f('0xa9'),_0x474f('0xa3'),'ContactId','ListId',_0x474f('0x64'),_0x474f('0x5e'),'updatedAt'],squel[_0x474f('0xa7')]()['field']('phone',_0x474f('0xa9'))[_0x474f('0xa8')](_0x474f('0xaa'),_0x474f('0xa3'))['field']('id',_0x474f('0xa4'))[_0x474f('0xa8')](_0x15c4ac[_0x474f('0xae')][_0x474f('0x8a')](),_0x474f('0xa5'))[_0x474f('0xa8')](_0x41fa2a[_0x474f('0x51')]['id'][_0x474f('0x8a')](),_0x474f('0x64'))[_0x474f('0xa8')](_0x474f('0xaa'),_0x474f('0x5e'))[_0x474f('0xa8')](_0x474f('0xaa'),_0x474f('0xa6'))[_0x474f('0x83')](_0x474f('0xab'))['where'](_0x474f('0xac'))[_0x474f('0x48')](_0x474f('0xad'),_0x15c4ac[_0x474f('0xae')]['toString']())[_0x474f('0x48')]('phone\x20IS\x20NOT\x20NULL')[_0x474f('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0x474f('0xa7')]()[_0x474f('0xa8')](_0x474f('0xb1'))[_0x474f('0x83')](_0x474f('0xa1'))['where'](_0x474f('0x86'),_0x41fa2a[_0x474f('0x51')]['id']['toString']())))[_0x474f('0x8a')]();break;default:_0x1c801a=squel[_0x474f('0x9f')]()[_0x474f('0xa0')](_0x474f('0xa1'))['fromQuery']([_0x474f('0xa9'),_0x474f('0xa3'),'ContactId','ListId',_0x474f('0x64'),_0x474f('0x5e'),_0x474f('0xa6')],squel[_0x474f('0xa7')]()[_0x474f('0xa8')](_0x474f('0xa9'),_0x474f('0xa9'))['field'](_0x474f('0xaa'),'scheduledAt')[_0x474f('0xa8')]('id','ContactId')[_0x474f('0xa8')](_0x15c4ac['CmListId'][_0x474f('0x8a')](),_0x474f('0xa5'))[_0x474f('0xa8')](_0x41fa2a[_0x474f('0x51')]['id'][_0x474f('0x8a')](),'VoiceQueueId')['field'](_0x474f('0xaa'),_0x474f('0x5e'))['field'](_0x474f('0xaa'),'updatedAt')[_0x474f('0x83')](_0x474f('0xab'))['where'](_0x474f('0xac'))[_0x474f('0x48')](_0x474f('0xad'),_0x15c4ac['CmListId'][_0x474f('0x8a')]())[_0x474f('0x48')]('phone\x20IS\x20NOT\x20NULL'))[_0x474f('0x8a')]();}_0xca0077[_0x474f('0x88')](db[_0x474f('0x89')][_0x474f('0x3d')](_0x1c801a));}return BPromise[_0x474f('0xb2')](_0xca0077);}})[_0x474f('0x29')](function(){return _0x11ff9;})[_0x474f('0x29')](respondWithResult(_0x141034,null))[_0x474f('0x54')](handleError(_0x141034,null));};exports[_0x474f('0xb3')]=function(_0x5c818a,_0x321fad,_0x5d1478){return db[_0x474f('0x3a')][_0x474f('0x53')]({'where':{'id':_0x5c818a[_0x474f('0x51')]['id']}})[_0x474f('0x29')](handleEntityNotFound(_0x321fad,null))[_0x474f('0x29')](function(_0xd4f571){if(_0xd4f571){return _0xd4f571[_0x474f('0xb3')](_0x5c818a[_0x474f('0x3d')][_0x474f('0x81')]);}})[_0x474f('0x29')](function(_0x3eabeb){if(_0x3eabeb){return db[_0x474f('0x62')][_0x474f('0x28')]({'where':{'ListId':_0x5c818a[_0x474f('0x3d')][_0x474f('0x81')],'VoiceQueueId':_0x5c818a[_0x474f('0x51')]['id']}})[_0x474f('0x29')](function(){return _0x3eabeb;});}})[_0x474f('0x29')](respondWithStatusCode(_0x321fad,null))[_0x474f('0x54')](handleError(_0x321fad,null));};exports[_0x474f('0xb4')]=function(_0x424a3b,_0x30e061,_0x1db69f){var _0x1e82ab={};var _0x534076={};var _0x5f542f;var _0x3b345f;return db[_0x474f('0x3a')][_0x474f('0x66')]({'where':{'id':_0x424a3b[_0x474f('0x51')]['id']}})['then'](handleEntityNotFound(_0x30e061,null))[_0x474f('0x29')](function(_0x548c93){if(_0x548c93){_0x5f542f=_0x548c93;_0x534076['model']=_['keys'](db[_0x474f('0x9b')][_0x474f('0x3b')]);_0x534076[_0x474f('0x3d')]=_[_0x474f('0x52')](_0x424a3b[_0x474f('0x3d')]);_0x534076[_0x474f('0x3e')]=_[_0x474f('0x3f')](_0x534076['model'],_0x534076[_0x474f('0x3d')]);_0x1e82ab[_0x474f('0x42')]=_[_0x474f('0x3f')](_0x534076[_0x474f('0x40')],qs[_0x474f('0x41')](_0x424a3b[_0x474f('0x3d')][_0x474f('0x41')]));_0x1e82ab['attributes']=_0x1e82ab['attributes']['length']?_0x1e82ab[_0x474f('0x42')]:_0x534076[_0x474f('0x40')];_0x1e82ab[_0x474f('0x45')]=qs[_0x474f('0x46')](_0x424a3b[_0x474f('0x3d')][_0x474f('0x46')]);_0x1e82ab['where']=qs[_0x474f('0x3e')](_['pick'](_0x424a3b[_0x474f('0x3d')],_0x534076[_0x474f('0x3e')]));if(_0x424a3b[_0x474f('0x3d')][_0x474f('0x2e')]){_0x1e82ab[_0x474f('0x48')]=_['merge'](_0x1e82ab[_0x474f('0x48')],{'$or':_[_0x474f('0x39')](_0x1e82ab['attributes'],function(_0xf54b15){var _0x39a1c9={};_0x39a1c9[_0xf54b15]={'$like':'%'+_0x424a3b[_0x474f('0x3d')]['filter']+'%'};return _0x39a1c9;})});}_0x1e82ab=_[_0x474f('0x4a')]({},_0x1e82ab,_0x424a3b['options']);return _0x5f542f[_0x474f('0xb4')](_0x1e82ab);}})['then'](function(_0x50347b){if(_0x50347b){_0x3b345f=_0x50347b[_0x474f('0x43')];if(!_0x424a3b['query'][_0x474f('0x63')](_0x474f('0x44'))){_0x1e82ab[_0x474f('0x23')]=qs[_0x474f('0x23')](_0x424a3b['query'][_0x474f('0x23')]);_0x1e82ab[_0x474f('0x22')]=qs['offset'](_0x424a3b['query']['offset']);}return _0x5f542f['getBlackLists'](_0x1e82ab);}})['then'](function(_0x553b80){if(_0x553b80){return _0x553b80?{'count':_0x3b345f,'rows':_0x553b80}:null;}})['then'](respondWithResult(_0x30e061,null))['catch'](handleError(_0x30e061,null));};exports[_0x474f('0xb5')]=function(_0xcee0e5,_0x4ee563,_0xcc27e){var _0x405ff9,_0x3d17e1;return db[_0x474f('0x3a')][_0x474f('0x53')]({'where':{'id':_0xcee0e5['params']['id']}})['then'](handleEntityNotFound(_0x4ee563,null))[_0x474f('0x29')](function(_0x5372a4){if(_0x5372a4){_0x3d17e1=_0x5372a4;return _0x5372a4[_0x474f('0xb5')](_0xcee0e5[_0x474f('0x56')][_0x474f('0x81')],_[_0x474f('0x94')](_0xcee0e5[_0x474f('0x56')],[_0x474f('0x81'),'id'])||{});}return null;})[_0x474f('0x95')](function(_0x107ee2){var _0x4bd0fd;_0x405ff9=_0x107ee2||[];var _0x50aee7=[];if(_0x107ee2){for(var _0x45bd56=0x0;_0x45bd56<_0x107ee2[_0x474f('0x43')];_0x45bd56+=0x1){var _0x5d6f10=_0x107ee2[_0x45bd56][_0x474f('0x2a')]({'plain':!![]});_0x4bd0fd=squel['insert']()['into']('cm_hopper_black')[_0x474f('0xa2')]([_0x474f('0xa9'),_0x474f('0xa4'),_0x474f('0xa5'),_0x474f('0x64'),_0x474f('0x5e'),_0x474f('0xa6')],squel[_0x474f('0xa7')]()[_0x474f('0xa8')]('phone',_0x474f('0xa9'))[_0x474f('0xa8')]('id',_0x474f('0xa4'))[_0x474f('0xa8')](_0x5d6f10[_0x474f('0xae')][_0x474f('0x8a')](),_0x474f('0xa5'))[_0x474f('0xa8')](_0xcee0e5['params']['id'][_0x474f('0x8a')](),_0x474f('0x64'))[_0x474f('0xa8')]('NOW()',_0x474f('0x5e'))[_0x474f('0xa8')]('NOW()','updatedAt')['from']('cm_contacts')[_0x474f('0x48')]('deletedAt\x20IS\x20NULL')[_0x474f('0x48')](_0x474f('0xad'),_0x5d6f10[_0x474f('0xae')]['toString']())[_0x474f('0x48')](_0x474f('0xb6')))[_0x474f('0x8a')]();_0x50aee7[_0x474f('0x88')](db[_0x474f('0x89')][_0x474f('0x3d')](_0x4bd0fd));}return BPromise[_0x474f('0xb2')](_0x50aee7);}})['then'](function(){return _0x405ff9;})[_0x474f('0x29')](respondWithResult(_0x4ee563,null))[_0x474f('0x54')](handleError(_0x4ee563,null));};exports[_0x474f('0xb7')]=function(_0x594d15,_0x4f6b23,_0xfcb593){return db['VoiceQueue']['find']({'where':{'id':_0x594d15[_0x474f('0x51')]['id']}})[_0x474f('0x29')](handleEntityNotFound(_0x4f6b23,null))[_0x474f('0x29')](function(_0xd27f6b){if(_0xd27f6b){return _0xd27f6b[_0x474f('0xb7')](_0x594d15['query'][_0x474f('0x81')]);}})[_0x474f('0x29')](function(_0x3cf291){if(_0x3cf291){return db[_0x474f('0x6b')][_0x474f('0x28')]({'where':{'ListId':_0x594d15[_0x474f('0x3d')][_0x474f('0x81')],'VoiceQueueId':_0x594d15['params']['id']}})[_0x474f('0x29')](function(){return _0x3cf291;});}})[_0x474f('0x29')](respondWithStatusCode(_0x4f6b23,null))[_0x474f('0x54')](handleError(_0x4f6b23,null));}; \ No newline at end of file +var _0x3176=['keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','role','VoiceQueues','inbound','UserProfileSection','userProfileId','omit','createdAt','autoAssociation','UserProfileResource','findOne','VoiceQueueId','CmHopper','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','interface','flatMap','Agents','forEach','penalty','sequelize','UserVoiceQueue','findOrCreate','each','UserVoiceQueueRt','upsert','isNil','SIP/%s','emit','removeTeams','ids','tq.TeamId','from','user_has_teams','clone','ut.UserId\x20=\x20?','push','every','all','union','compact','removeAgents','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','voicePause','isEmpty','format','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','ListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','cm_contacts','CmList','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','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','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','sendStatus','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','status','end','error','stack','name','index','VoiceQueue','rawAttributes','key','model','query'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x3176,0x1d8));var _0x6317=function(_0x214db4,_0xfc5c8c){_0x214db4=_0x214db4-0x0;var _0x3e6fce=_0x3176[_0x214db4];return _0x3e6fce;};'use strict';var pdf=require(_0x6317('0x0'));var emlformat=require(_0x6317('0x1'));var rimraf=require(_0x6317('0x2'));var zipdir=require(_0x6317('0x3'));var jsonpatch=require(_0x6317('0x4'));var rp=require(_0x6317('0x5'));var moment=require(_0x6317('0x6'));var BPromise=require(_0x6317('0x7'));var Mustache=require(_0x6317('0x8'));var util=require(_0x6317('0x9'));var path=require(_0x6317('0xa'));var sox=require(_0x6317('0xb'));var csv=require(_0x6317('0xc'));var ejs=require(_0x6317('0xd'));var fs=require('fs');var _=require(_0x6317('0xe'));var squel=require(_0x6317('0xf'));var crypto=require('crypto');var jsforce=require(_0x6317('0x10'));var deskjs=require(_0x6317('0x11'));var toCsv=require(_0x6317('0xc'));var querystring=require('querystring');var Papa=require(_0x6317('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6317('0x13'));var as=require(_0x6317('0x14'));var hardwareService=require(_0x6317('0x15'));var logger=require(_0x6317('0x16'))(_0x6317('0x17'));var utils=require('../../config/utils');var config=require(_0x6317('0x18'));var db=require(_0x6317('0x19'))['db'];config['redis']=_[_0x6317('0x1a')](config[_0x6317('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x6317('0x1c'))(new Redis(config[_0x6317('0x1b')]));require('./voiceQueue.socket')[_0x6317('0x1d')](socket);function respondWithStatusCode(_0x1fba31,_0x32ad4a){_0x32ad4a=_0x32ad4a||0xcc;return function(_0x42f2f8){if(_0x42f2f8){return _0x1fba31[_0x6317('0x1e')](_0x32ad4a);}return _0x1fba31['status'](_0x32ad4a)['end']();};}function respondWithResult(_0x560b77,_0x1b42b3){_0x1b42b3=_0x1b42b3||0xc8;return function(_0x55b86a){if(_0x55b86a){return _0x560b77['status'](_0x1b42b3)[_0x6317('0x1f')](_0x55b86a);}};}function respondWithFilteredResult(_0x48f26e,_0x487bbc){return function(_0x35caff){if(_0x35caff){var _0x1d8497=_0x35caff[_0x6317('0x20')],_0x4ad386=_0x487bbc[_0x6317('0x21')],_0xc90572=_0x487bbc[_0x6317('0x21')]+_0x487bbc[_0x6317('0x22')],_0x519851;if(_0xc90572>=_0x1d8497){_0xc90572=_0x1d8497;_0x519851=0xc8;}else{_0x519851=0xce;}_0x48f26e['status'](_0x519851);return _0x48f26e[_0x6317('0x23')](_0x6317('0x24'),_0x4ad386+'-'+_0xc90572+'/'+_0x1d8497)[_0x6317('0x1f')](_0x35caff);}return null;};}function patchUpdates(_0x3687d1){return function(_0x18e081){try{jsonpatch[_0x6317('0x25')](_0x18e081,_0x3687d1,!![]);}catch(_0x8ba880){return BPromise[_0x6317('0x26')](_0x8ba880);}return _0x18e081[_0x6317('0x27')]();};}function saveUpdates(_0x1e9b7e,_0x4b8b11){return function(_0x2bb861){if(_0x2bb861){return _0x2bb861['update'](_0x1e9b7e)[_0x6317('0x28')](function(_0x4a2e3e){return _0x4a2e3e;});}return null;};}function removeEntity(_0x2b7669,_0x2a36ee){return function(_0x2ef902){if(_0x2ef902){return _0x2ef902[_0x6317('0x29')]()[_0x6317('0x28')](function(){var _0x5a1759=_0x2ef902[_0x6317('0x2a')]({'plain':!![]});var _0x14b136=[{'name':'VoiceQueues','value':'inbound','ignore':![]},{'name':_0x6317('0x2b'),'value':_0x6317('0x2c'),'ignore':![]}];var _0x2ca4e7=_(_0x14b136)[_0x6317('0x2d')](_0x6317('0x2e'))[_0x6317('0x2f')](_0x6317('0x30'))['value']();if(_[_0x6317('0x31')](_0x2ca4e7,_0x5a1759[_0x6317('0x32')])){return;}var _0x23d35b=_['find'](_0x14b136,[_0x6317('0x30'),_0x5a1759[_0x6317('0x32')]])['name'];return db['UserProfileResource'][_0x6317('0x29')]({'where':{'type':_0x23d35b,'resourceId':_0x5a1759['id']}})[_0x6317('0x28')](function(){return _0x2ef902;});})['then'](function(){_0x2b7669[_0x6317('0x33')](0xcc)[_0x6317('0x34')]();});}};}function handleEntityNotFound(_0x203a62,_0x2d21b8){return function(_0x242173){if(!_0x242173){_0x203a62[_0x6317('0x1e')](0x194);}return _0x242173;};}function handleError(_0x58923,_0x3796a4){_0x3796a4=_0x3796a4||0x1f4;return function(_0x18fcf6){logger[_0x6317('0x35')](_0x18fcf6[_0x6317('0x36')]);if(_0x18fcf6[_0x6317('0x37')]){delete _0x18fcf6['name'];}_0x58923[_0x6317('0x33')](_0x3796a4)['send'](_0x18fcf6);};}exports[_0x6317('0x38')]=function(_0x26a64f,_0x37c56a){var _0x1a99e3={},_0x3d2f7f={},_0x1161e1={'count':0x0,'rows':[]};var _0x13b816=_[_0x6317('0x2f')](db[_0x6317('0x39')][_0x6317('0x3a')],function(_0x2a5e60){return{'name':_0x2a5e60['fieldName'],'type':_0x2a5e60[_0x6317('0x32')][_0x6317('0x3b')]};});_0x3d2f7f[_0x6317('0x3c')]=_[_0x6317('0x2f')](_0x13b816,_0x6317('0x37'));_0x3d2f7f[_0x6317('0x3d')]=_[_0x6317('0x3e')](_0x26a64f[_0x6317('0x3d')]);_0x3d2f7f['filters']=_[_0x6317('0x3f')](_0x3d2f7f[_0x6317('0x3c')],_0x3d2f7f['query']);_0x1a99e3[_0x6317('0x40')]=_[_0x6317('0x3f')](_0x3d2f7f[_0x6317('0x3c')],qs[_0x6317('0x41')](_0x26a64f['query'][_0x6317('0x41')]));_0x1a99e3[_0x6317('0x40')]=_0x1a99e3['attributes'][_0x6317('0x42')]?_0x1a99e3[_0x6317('0x40')]:_0x3d2f7f[_0x6317('0x3c')];if(!_0x26a64f[_0x6317('0x3d')][_0x6317('0x43')](_0x6317('0x44'))){_0x1a99e3[_0x6317('0x22')]=qs['limit'](_0x26a64f['query'][_0x6317('0x22')]);_0x1a99e3[_0x6317('0x21')]=qs[_0x6317('0x21')](_0x26a64f[_0x6317('0x3d')]['offset']);}_0x1a99e3[_0x6317('0x45')]=qs[_0x6317('0x46')](_0x26a64f[_0x6317('0x3d')][_0x6317('0x46')]);_0x1a99e3[_0x6317('0x47')]=qs['filters'](_[_0x6317('0x48')](_0x26a64f[_0x6317('0x3d')],_0x3d2f7f[_0x6317('0x49')]));if(_0x26a64f[_0x6317('0x3d')][_0x6317('0x2d')]){_0x1a99e3['where']=_[_0x6317('0x4a')](_0x1a99e3[_0x6317('0x47')],{'$or':_['map'](_0x13b816,function(_0x22e639){if(_0x22e639[_0x6317('0x32')]!==_0x6317('0x4b')){var _0x81bea6={};_0x81bea6[_0x22e639[_0x6317('0x37')]]={'$like':'%'+_0x26a64f[_0x6317('0x3d')][_0x6317('0x2d')]+'%'};return _0x81bea6;}})});}_0x1a99e3=_[_0x6317('0x4a')]({},_0x1a99e3,_0x26a64f[_0x6317('0x4c')]);var _0x30d45b={'where':_0x1a99e3[_0x6317('0x47')]};return db['VoiceQueue'][_0x6317('0x20')](_0x30d45b)['then'](function(_0x3873ae){_0x1161e1[_0x6317('0x20')]=_0x3873ae;if(_0x26a64f[_0x6317('0x3d')][_0x6317('0x4d')]){_0x1a99e3[_0x6317('0x4e')]=[{'all':!![]}];}return db[_0x6317('0x39')][_0x6317('0x4f')](_0x1a99e3);})[_0x6317('0x28')](function(_0x1c1fac){_0x1161e1[_0x6317('0x50')]=_0x1c1fac;return _0x1161e1;})[_0x6317('0x28')](respondWithFilteredResult(_0x37c56a,_0x1a99e3))[_0x6317('0x51')](handleError(_0x37c56a,null));};exports[_0x6317('0x52')]=function(_0x114649,_0x3e82d1){var _0x3003e5={'raw':![],'where':{'id':_0x114649[_0x6317('0x53')]['id']}},_0x5089a0={};_0x5089a0[_0x6317('0x3c')]=_[_0x6317('0x3e')](db['VoiceQueue']['rawAttributes']);_0x5089a0[_0x6317('0x3d')]=_[_0x6317('0x3e')](_0x114649['query']);_0x5089a0[_0x6317('0x49')]=_[_0x6317('0x3f')](_0x5089a0[_0x6317('0x3c')],_0x5089a0['query']);_0x3003e5[_0x6317('0x40')]=_[_0x6317('0x3f')](_0x5089a0[_0x6317('0x3c')],qs[_0x6317('0x41')](_0x114649[_0x6317('0x3d')][_0x6317('0x41')]));_0x3003e5[_0x6317('0x40')]=_0x3003e5[_0x6317('0x40')]['length']?_0x3003e5['attributes']:_0x5089a0[_0x6317('0x3c')];if(_0x114649[_0x6317('0x3d')]['includeAll']){_0x3003e5['include']=[{'all':!![]}];}_0x3003e5=_['merge']({},_0x3003e5,_0x114649[_0x6317('0x4c')]);return db[_0x6317('0x39')][_0x6317('0x54')](_0x3003e5)[_0x6317('0x28')](handleEntityNotFound(_0x3e82d1,null))[_0x6317('0x28')](respondWithResult(_0x3e82d1,null))[_0x6317('0x51')](handleError(_0x3e82d1,null));};exports[_0x6317('0x55')]=function(_0x38560b,_0x2ff70a){return db[_0x6317('0x39')][_0x6317('0x55')](_0x38560b[_0x6317('0x56')],{})[_0x6317('0x28')](function(_0x92e80d){var _0x27db7b=_0x38560b[_0x6317('0x57')][_0x6317('0x2a')]({'plain':!![]});if(!_0x27db7b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27db7b[_0x6317('0x58')]===_0x6317('0x57')){var _0x39542d=_0x92e80d[_0x6317('0x2a')]({'plain':!![]});var _0x54a1bf=[{'name':_0x6317('0x59'),'value':_0x6317('0x5a')},{'name':_0x6317('0x2b'),'value':_0x6317('0x2c')}];var _0x4058f9=_[_0x6317('0x54')](_0x54a1bf,['value',_0x39542d['type']])[_0x6317('0x37')];return db[_0x6317('0x5b')][_0x6317('0x54')]({'where':{'name':_0x4058f9,'userProfileId':_0x27db7b[_0x6317('0x5c')]},'raw':!![]})[_0x6317('0x28')](function(_0x19cf02){if(_0x19cf02&&_0x19cf02['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x39542d[_0x6317('0x37')],'resourceId':_0x39542d['id'],'type':_0x19cf02['name'],'sectionId':_0x19cf02['id']},{})[_0x6317('0x28')](function(){return _0x92e80d;});}else{return _0x92e80d;}})['catch'](function(_0x5e3e51){logger[_0x6317('0x35')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e3e51);throw _0x5e3e51;});}return _0x92e80d;})[_0x6317('0x28')](respondWithResult(_0x2ff70a,0xc9))[_0x6317('0x51')](handleError(_0x2ff70a,null));};exports['clone']=function(_0xb53b0f,_0x37ff5e){var _0x346a70={'where':{'id':_0xb53b0f[_0x6317('0x53')]['id']}},_0x31871d={};_0x31871d[_0x6317('0x3c')]=_[_0x6317('0x3e')](db[_0x6317('0x39')][_0x6317('0x3a')]);_0x346a70['attributes']=_['intersection'](_0x31871d[_0x6317('0x3c')],qs['fields'](_0xb53b0f[_0x6317('0x3d')][_0x6317('0x41')]));_0x346a70[_0x6317('0x40')]=_0x346a70[_0x6317('0x40')][_0x6317('0x42')]?_0x346a70[_0x6317('0x40')]:_0x31871d[_0x6317('0x3c')];if(_0xb53b0f[_0x6317('0x3d')][_0x6317('0x4d')]){_0x346a70[_0x6317('0x4e')]=[{'all':!![]}];}_0x346a70=_[_0x6317('0x4a')]({},_0x346a70,_0xb53b0f[_0x6317('0x4c')]);return db[_0x6317('0x39')][_0x6317('0x54')](_0x346a70)[_0x6317('0x28')](handleEntityNotFound(_0x37ff5e,null))[_0x6317('0x28')](function(_0x2d7905){if(_0x2d7905){var _0xec9aaf=_0x2d7905[_0x6317('0x2a')]({'plain':!![]});_0xec9aaf=qs[_0x6317('0x5d')](_0xec9aaf,['id',_0x6317('0x5e'),'updatedAt']);_0xb53b0f[_0x6317('0x56')]=_[_0x6317('0x5d')](_0xb53b0f[_0x6317('0x56')],['id',_0x6317('0x5e'),'updatedAt']);return db['VoiceQueue']['create'](_[_0x6317('0x4a')](_0xec9aaf,_0xb53b0f['body']),{'include':_0xb53b0f[_0x6317('0x3d')][_0x6317('0x4d')]?[{'all':!![]}]:undefined})['then'](function(_0x1a73da){var _0x2ff429=_0xb53b0f[_0x6317('0x57')][_0x6317('0x2a')]({'plain':!![]});if(!_0x2ff429)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ff429[_0x6317('0x58')]===_0x6317('0x57')){var _0x398620=_0x1a73da[_0x6317('0x2a')]({'plain':!![]});var _0x22fd0f=[{'name':_0x6317('0x59'),'value':_0x6317('0x5a')},{'name':_0x6317('0x2b'),'value':_0x6317('0x2c')}];var _0x434aa8=_['find'](_0x22fd0f,[_0x6317('0x30'),_0x398620['type']])[_0x6317('0x37')];return db[_0x6317('0x5b')][_0x6317('0x54')]({'where':{'name':_0x434aa8,'userProfileId':_0x2ff429[_0x6317('0x5c')]},'raw':!![]})[_0x6317('0x28')](function(_0xdb36c9){if(_0xdb36c9&&_0xdb36c9[_0x6317('0x5f')]===0x0){return db[_0x6317('0x60')][_0x6317('0x55')]({'name':_0x398620[_0x6317('0x37')],'resourceId':_0x398620['id'],'type':_0xdb36c9[_0x6317('0x37')],'sectionId':_0xdb36c9['id']},{})[_0x6317('0x28')](function(){return _0x1a73da;});}else{return _0x1a73da;}})[_0x6317('0x51')](function(_0x52fada){logger[_0x6317('0x35')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52fada);throw _0x52fada;});}return _0x1a73da;});}})[_0x6317('0x28')](respondWithResult(_0x37ff5e,0xc9))[_0x6317('0x51')](handleError(_0x37ff5e,null));};exports['update']=function(_0x354066,_0x48ad31){if(_0x354066[_0x6317('0x56')]['id']){delete _0x354066[_0x6317('0x56')]['id'];}return db[_0x6317('0x39')][_0x6317('0x54')]({'where':{'id':_0x354066['params']['id']}})['then'](handleEntityNotFound(_0x48ad31,null))['then'](saveUpdates(_0x354066[_0x6317('0x56')],null))[_0x6317('0x28')](respondWithResult(_0x48ad31,null))[_0x6317('0x51')](handleError(_0x48ad31,null));};exports['destroy']=function(_0x526a73,_0x46cb32){return db[_0x6317('0x39')][_0x6317('0x54')]({'where':{'id':_0x526a73[_0x6317('0x53')]['id']}})[_0x6317('0x28')](handleEntityNotFound(_0x46cb32,null))['then'](removeEntity(_0x46cb32,null))[_0x6317('0x51')](handleError(_0x46cb32,null));};exports['getHoppers']=function(_0x5e32e9,_0x1ea3b0,_0x3bf3c0){var _0x1c5bbe={'raw':![],'where':{}};var _0x371a25={};var _0xa38d56={'count':0x0,'rows':[]};return db[_0x6317('0x39')][_0x6317('0x61')]({'where':{'id':_0x5e32e9[_0x6317('0x53')]['id']}})[_0x6317('0x28')](handleEntityNotFound(_0x1ea3b0,null))[_0x6317('0x28')](function(_0x3dc71c){if(_0x3dc71c){_0x371a25['model']=_[_0x6317('0x3e')](db['CmHopper'][_0x6317('0x3a')]);_0x371a25[_0x6317('0x3d')]=_[_0x6317('0x3e')](_0x5e32e9[_0x6317('0x3d')]);_0x371a25[_0x6317('0x49')]=_['intersection'](_0x371a25[_0x6317('0x3c')],_0x371a25[_0x6317('0x3d')]);_0x1c5bbe[_0x6317('0x40')]=_[_0x6317('0x3f')](_0x371a25[_0x6317('0x3c')],qs['fields'](_0x5e32e9[_0x6317('0x3d')][_0x6317('0x41')]));_0x1c5bbe[_0x6317('0x40')]=_0x1c5bbe[_0x6317('0x40')][_0x6317('0x42')]?_0x1c5bbe[_0x6317('0x40')]:_0x371a25[_0x6317('0x3c')];if(!_0x5e32e9['query'][_0x6317('0x43')](_0x6317('0x44'))){_0x1c5bbe['limit']=qs[_0x6317('0x22')](_0x5e32e9['query']['limit']);_0x1c5bbe[_0x6317('0x21')]=qs[_0x6317('0x21')](_0x5e32e9['query']['offset']);}_0x1c5bbe[_0x6317('0x45')]=qs[_0x6317('0x46')](_0x5e32e9[_0x6317('0x3d')][_0x6317('0x46')]);_0x1c5bbe[_0x6317('0x47')]=qs[_0x6317('0x49')](_[_0x6317('0x48')](_0x5e32e9[_0x6317('0x3d')],_0x371a25[_0x6317('0x49')]));_0x1c5bbe[_0x6317('0x47')][_0x6317('0x62')]=_0x3dc71c['id'];if(_0x5e32e9[_0x6317('0x3d')][_0x6317('0x2d')]){_0x1c5bbe[_0x6317('0x47')]=_['merge'](_0x1c5bbe[_0x6317('0x47')],{'$or':_[_0x6317('0x2f')](_0x1c5bbe[_0x6317('0x40')],function(_0x285d15){var _0x412fea={};_0x412fea[_0x285d15]={'$like':'%'+_0x5e32e9[_0x6317('0x3d')][_0x6317('0x2d')]+'%'};return _0x412fea;})});}_0x1c5bbe=_[_0x6317('0x4a')]({},_0x1c5bbe,_0x5e32e9[_0x6317('0x4c')]);return db[_0x6317('0x63')][_0x6317('0x20')]({'where':_0x1c5bbe[_0x6317('0x47')]})['then'](function(_0xb0eb39){_0xa38d56[_0x6317('0x20')]=_0xb0eb39;if(_0x5e32e9[_0x6317('0x3d')][_0x6317('0x4d')]){_0x1c5bbe[_0x6317('0x4e')]=[{'all':!![]}];}return db[_0x6317('0x63')][_0x6317('0x4f')](_0x1c5bbe);})[_0x6317('0x28')](function(_0x480e09){_0xa38d56['rows']=_0x480e09;return _0xa38d56;});}})[_0x6317('0x28')](respondWithFilteredResult(_0x1ea3b0,_0x1c5bbe))['catch'](handleError(_0x1ea3b0,null));};exports['getHopperHistories']=function(_0x9943cf,_0xb2be70,_0x1f3102){var _0x1c4fcf={'raw':!![],'where':{}};var _0x512995={};var _0x284506={'count':0x0,'rows':[]};return db[_0x6317('0x39')][_0x6317('0x61')]({'where':{'id':_0x9943cf[_0x6317('0x53')]['id']}})[_0x6317('0x28')](handleEntityNotFound(_0xb2be70,null))[_0x6317('0x28')](function(_0x38c52a){if(_0x38c52a){_0x512995[_0x6317('0x3c')]=_[_0x6317('0x3e')](db[_0x6317('0x64')]['rawAttributes']);_0x512995[_0x6317('0x3d')]=_[_0x6317('0x3e')](_0x9943cf[_0x6317('0x3d')]);_0x512995['filters']=_[_0x6317('0x3f')](_0x512995['model'],_0x512995['query']);_0x1c4fcf['attributes']=_['intersection'](_0x512995[_0x6317('0x3c')],qs[_0x6317('0x41')](_0x9943cf[_0x6317('0x3d')][_0x6317('0x41')]));_0x1c4fcf[_0x6317('0x40')]=_0x1c4fcf['attributes'][_0x6317('0x42')]?_0x1c4fcf[_0x6317('0x40')]:_0x512995['model'];if(!_0x9943cf['query'][_0x6317('0x43')](_0x6317('0x44'))){_0x1c4fcf[_0x6317('0x22')]=qs[_0x6317('0x22')](_0x9943cf[_0x6317('0x3d')][_0x6317('0x22')]);_0x1c4fcf['offset']=qs['offset'](_0x9943cf[_0x6317('0x3d')]['offset']);}_0x1c4fcf[_0x6317('0x45')]=qs[_0x6317('0x46')](_0x9943cf['query'][_0x6317('0x46')]);_0x1c4fcf['where']=qs['filters'](_[_0x6317('0x48')](_0x9943cf[_0x6317('0x3d')],_0x512995['filters']));_0x1c4fcf[_0x6317('0x47')][_0x6317('0x62')]=_0x38c52a['id'];if(_0x9943cf[_0x6317('0x3d')]['filter']){_0x1c4fcf[_0x6317('0x47')]=_[_0x6317('0x4a')](_0x1c4fcf[_0x6317('0x47')],{'$or':_[_0x6317('0x2f')](_0x1c4fcf[_0x6317('0x40')],function(_0x1332f6){var _0x2bf7b0={};_0x2bf7b0[_0x1332f6]={'$like':'%'+_0x9943cf[_0x6317('0x3d')]['filter']+'%'};return _0x2bf7b0;})});}_0x1c4fcf=_[_0x6317('0x4a')]({},_0x1c4fcf,_0x9943cf[_0x6317('0x4c')]);return db[_0x6317('0x64')]['count']({'where':_0x1c4fcf[_0x6317('0x47')]})['then'](function(_0x5644c0){_0x284506[_0x6317('0x20')]=_0x5644c0;if(_0x9943cf[_0x6317('0x3d')][_0x6317('0x4d')]){_0x1c4fcf[_0x6317('0x4e')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x6317('0x4f')](_0x1c4fcf);})['then'](function(_0x2aa5af){_0x284506['rows']=_0x2aa5af;return _0x284506;});}})[_0x6317('0x28')](respondWithFilteredResult(_0xb2be70,_0x1c4fcf))[_0x6317('0x51')](handleError(_0xb2be70,null));};exports['getHopperFinals']=function(_0x48f9d8,_0x3e8354,_0x3a95cf){var _0x531177={'raw':!![],'where':{}};var _0x22601a={};var _0x2c7024={'count':0x0,'rows':[]};return db[_0x6317('0x39')]['findOne']({'where':{'id':_0x48f9d8[_0x6317('0x53')]['id']}})[_0x6317('0x28')](handleEntityNotFound(_0x3e8354,null))[_0x6317('0x28')](function(_0x33049e){if(_0x33049e){_0x22601a[_0x6317('0x3c')]=_[_0x6317('0x3e')](db[_0x6317('0x65')]['rawAttributes']);_0x22601a[_0x6317('0x3d')]=_[_0x6317('0x3e')](_0x48f9d8[_0x6317('0x3d')]);_0x22601a[_0x6317('0x49')]=_[_0x6317('0x3f')](_0x22601a[_0x6317('0x3c')],_0x22601a[_0x6317('0x3d')]);_0x531177[_0x6317('0x40')]=_[_0x6317('0x3f')](_0x22601a['model'],qs[_0x6317('0x41')](_0x48f9d8['query']['fields']));_0x531177[_0x6317('0x40')]=_0x531177[_0x6317('0x40')][_0x6317('0x42')]?_0x531177['attributes']:_0x22601a[_0x6317('0x3c')];if(!_0x48f9d8[_0x6317('0x3d')][_0x6317('0x43')](_0x6317('0x44'))){_0x531177['limit']=qs[_0x6317('0x22')](_0x48f9d8[_0x6317('0x3d')][_0x6317('0x22')]);_0x531177['offset']=qs[_0x6317('0x21')](_0x48f9d8[_0x6317('0x3d')]['offset']);}_0x531177[_0x6317('0x45')]=qs[_0x6317('0x46')](_0x48f9d8[_0x6317('0x3d')]['sort']);_0x531177['where']=qs[_0x6317('0x49')](_[_0x6317('0x48')](_0x48f9d8[_0x6317('0x3d')],_0x22601a['filters']));_0x531177['where']['VoiceQueueId']=_0x33049e['id'];if(_0x48f9d8['query'][_0x6317('0x2d')]){_0x531177[_0x6317('0x47')]=_[_0x6317('0x4a')](_0x531177['where'],{'$or':_[_0x6317('0x2f')](_0x531177[_0x6317('0x40')],function(_0x1448d8){var _0x2fd4b5={};_0x2fd4b5[_0x1448d8]={'$like':'%'+_0x48f9d8['query']['filter']+'%'};return _0x2fd4b5;})});}_0x531177=_[_0x6317('0x4a')]({},_0x531177,_0x48f9d8[_0x6317('0x4c')]);return db[_0x6317('0x65')][_0x6317('0x20')]({'where':_0x531177[_0x6317('0x47')]})[_0x6317('0x28')](function(_0x9044cc){_0x2c7024['count']=_0x9044cc;if(_0x48f9d8[_0x6317('0x3d')][_0x6317('0x4d')]){_0x531177[_0x6317('0x4e')]=[{'all':!![]}];}return db[_0x6317('0x65')][_0x6317('0x4f')](_0x531177);})[_0x6317('0x28')](function(_0xf3df25){_0x2c7024[_0x6317('0x50')]=_0xf3df25;return _0x2c7024;});}})['then'](respondWithFilteredResult(_0x3e8354,_0x531177))['catch'](handleError(_0x3e8354,null));};exports[_0x6317('0x66')]=function(_0x5cb173,_0x1344a0,_0x409711){var _0x191f96={'raw':!![],'where':{}};var _0x373c40={};var _0x11d1c6={'count':0x0,'rows':[]};return db[_0x6317('0x39')][_0x6317('0x61')]({'where':{'id':_0x5cb173['params']['id']}})[_0x6317('0x28')](handleEntityNotFound(_0x1344a0,null))[_0x6317('0x28')](function(_0x47ff0a){if(_0x47ff0a){_0x373c40[_0x6317('0x3c')]=_[_0x6317('0x3e')](db[_0x6317('0x67')]['rawAttributes']);_0x373c40[_0x6317('0x3d')]=_[_0x6317('0x3e')](_0x5cb173['query']);_0x373c40['filters']=_[_0x6317('0x3f')](_0x373c40[_0x6317('0x3c')],_0x373c40[_0x6317('0x3d')]);_0x191f96[_0x6317('0x40')]=_['intersection'](_0x373c40[_0x6317('0x3c')],qs[_0x6317('0x41')](_0x5cb173[_0x6317('0x3d')]['fields']));_0x191f96[_0x6317('0x40')]=_0x191f96['attributes'][_0x6317('0x42')]?_0x191f96[_0x6317('0x40')]:_0x373c40['model'];if(!_0x5cb173['query'][_0x6317('0x43')](_0x6317('0x44'))){_0x191f96[_0x6317('0x22')]=qs[_0x6317('0x22')](_0x5cb173['query']['limit']);_0x191f96[_0x6317('0x21')]=qs[_0x6317('0x21')](_0x5cb173[_0x6317('0x3d')][_0x6317('0x21')]);}_0x191f96['order']=qs[_0x6317('0x46')](_0x5cb173['query'][_0x6317('0x46')]);_0x191f96[_0x6317('0x47')]=qs[_0x6317('0x49')](_['pick'](_0x5cb173[_0x6317('0x3d')],_0x373c40[_0x6317('0x49')]));_0x191f96[_0x6317('0x47')]['VoiceQueueId']=_0x47ff0a['id'];if(_0x5cb173[_0x6317('0x3d')][_0x6317('0x2d')]){_0x191f96[_0x6317('0x47')]=_[_0x6317('0x4a')](_0x191f96['where'],{'$or':_[_0x6317('0x2f')](_0x191f96[_0x6317('0x40')],function(_0x4b28ba){var _0x21ce9f={};_0x21ce9f[_0x4b28ba]={'$like':'%'+_0x5cb173[_0x6317('0x3d')][_0x6317('0x2d')]+'%'};return _0x21ce9f;})});}_0x191f96=_[_0x6317('0x4a')]({},_0x191f96,_0x5cb173['options']);return db[_0x6317('0x67')]['count']({'where':_0x191f96[_0x6317('0x47')]})[_0x6317('0x28')](function(_0x1eaa9f){_0x11d1c6[_0x6317('0x20')]=_0x1eaa9f;if(_0x5cb173[_0x6317('0x3d')][_0x6317('0x4d')]){_0x191f96[_0x6317('0x4e')]=[{'all':!![]}];}return db[_0x6317('0x67')][_0x6317('0x4f')](_0x191f96);})[_0x6317('0x28')](function(_0x219967){_0x11d1c6[_0x6317('0x50')]=_0x219967;return _0x11d1c6;});}})[_0x6317('0x28')](respondWithFilteredResult(_0x1344a0,_0x191f96))[_0x6317('0x51')](handleError(_0x1344a0,null));};exports[_0x6317('0x68')]=function(_0x21dbc9,_0x4a50cb,_0x5d41a4){var _0x17f756={};var _0x586f10={};var _0x54c35c;var _0x47f45d;return db[_0x6317('0x39')]['findOne']({'where':{'id':_0x21dbc9['params']['id']}})[_0x6317('0x28')](handleEntityNotFound(_0x4a50cb,null))['then'](function(_0x3edd9e){if(_0x3edd9e){_0x54c35c=_0x3edd9e;_0x586f10[_0x6317('0x3c')]=_[_0x6317('0x3e')](db[_0x6317('0x69')][_0x6317('0x3a')]);_0x586f10[_0x6317('0x3d')]=_['keys'](_0x21dbc9[_0x6317('0x3d')]);_0x586f10[_0x6317('0x49')]=_[_0x6317('0x3f')](_0x586f10[_0x6317('0x3c')],_0x586f10['query']);_0x17f756[_0x6317('0x40')]=_[_0x6317('0x3f')](_0x586f10[_0x6317('0x3c')],qs[_0x6317('0x41')](_0x21dbc9[_0x6317('0x3d')][_0x6317('0x41')]));_0x17f756[_0x6317('0x40')]=_0x17f756[_0x6317('0x40')][_0x6317('0x42')]?_0x17f756[_0x6317('0x40')]:_0x586f10[_0x6317('0x3c')];_0x17f756[_0x6317('0x45')]=qs[_0x6317('0x46')](_0x21dbc9[_0x6317('0x3d')][_0x6317('0x46')]);_0x17f756[_0x6317('0x47')]=qs[_0x6317('0x49')](_[_0x6317('0x48')](_0x21dbc9[_0x6317('0x3d')],_0x586f10[_0x6317('0x49')]));if(_0x21dbc9[_0x6317('0x3d')][_0x6317('0x2d')]){_0x17f756['where']=_[_0x6317('0x4a')](_0x17f756[_0x6317('0x47')],{'$or':_[_0x6317('0x2f')](_0x17f756[_0x6317('0x40')],function(_0x46d9eb){var _0x146a41={};_0x146a41[_0x46d9eb]={'$like':'%'+_0x21dbc9[_0x6317('0x3d')][_0x6317('0x2d')]+'%'};return _0x146a41;})});}_0x17f756=_[_0x6317('0x4a')]({},_0x17f756,_0x21dbc9[_0x6317('0x4c')]);return _0x54c35c[_0x6317('0x68')](_0x17f756);}})[_0x6317('0x28')](function(_0x471ab9){if(_0x471ab9){_0x47f45d=_0x471ab9[_0x6317('0x42')];if(!_0x21dbc9[_0x6317('0x3d')]['hasOwnProperty'](_0x6317('0x44'))){_0x17f756['limit']=qs['limit'](_0x21dbc9[_0x6317('0x3d')]['limit']);_0x17f756[_0x6317('0x21')]=qs[_0x6317('0x21')](_0x21dbc9['query'][_0x6317('0x21')]);}return _0x54c35c[_0x6317('0x68')](_0x17f756);}})[_0x6317('0x28')](function(_0x40090f){if(_0x40090f){return _0x40090f?{'count':_0x47f45d,'rows':_0x40090f}:null;}})[_0x6317('0x28')](respondWithResult(_0x4a50cb,null))[_0x6317('0x51')](handleError(_0x4a50cb,null));};exports[_0x6317('0x6a')]=function(_0x4c9441,_0x163f40,_0x3704b4){var _0xf52839=_0x4c9441[_0x6317('0x56')][_0x6317('0x6b')];var _0x339502=_[_0x6317('0x2f')](_0xf52839,'id');return db[_0x6317('0x69')][_0x6317('0x4f')]({'where':{'id':_0x339502},'attributes':['id'],'include':[{'model':db[_0x6317('0x6c')],'as':'Agents','attributes':['id','name',_0x6317('0x6d'),'voicePause',_0x6317('0x6e')],'raw':!![]}]})['then'](function(_0x3ecc58){if(_0x3ecc58){var _0x2af07f=_[_0x6317('0x6f')](_0x3ecc58,function(_0x14c443){var _0x4ced26=_0x14c443[_0x6317('0x2a')]({'plain':!![]});_0x4ced26[_0x6317('0x70')][_0x6317('0x71')](function(_0x5f111c){_0x5f111c['penalty']=_[_0x6317('0x54')](_0xf52839,{'id':_0x4ced26['id']})[_0x6317('0x72')];});return _0x4ced26['Agents'];});return db[_0x6317('0x39')][_0x6317('0x54')]({'where':{'id':_0x4c9441[_0x6317('0x53')]['id']}})[_0x6317('0x28')](function(_0x39169c){return db[_0x6317('0x73')]['transaction'](function(_0xcb961a){return _0x39169c[_0x6317('0x6a')](_0x339502,{'transaction':_0xcb961a})[_0x6317('0x28')](function(){return BPromise['each'](_0x2af07f,function(_0x123972){return db[_0x6317('0x74')][_0x6317('0x75')]({'where':{'UserId':_0x123972['id'],'VoiceQueueId':_0x4c9441[_0x6317('0x53')]['id']},'defaults':{'penalty':_0x123972['penalty']},'transaction':_0xcb961a});});})[_0x6317('0x28')](function(){return BPromise[_0x6317('0x76')](_[_0x6317('0x2d')](_0x2af07f,{'online':!![]}),function(_0x2d9c97){return db[_0x6317('0x77')][_0x6317('0x78')]({'membername':_0x2d9c97['name'],'UserId':_0x2d9c97['id'],'queue_name':_0x39169c[_0x6317('0x37')],'VoiceQueueId':_0x39169c['id'],'interface':_[_0x6317('0x79')](_0x2d9c97[_0x6317('0x6e')])?util['format'](_0x6317('0x7a'),_0x2d9c97[_0x6317('0x37')]):_0x2d9c97[_0x6317('0x6e')],'paused':_0x2d9c97['voicePause']||![],'penalty':_0x2d9c97['penalty']},{'transaction':_0xcb961a});});})[_0x6317('0x28')](function(){_0x2af07f[_0x6317('0x71')](function(_0x17c3c9){socket[_0x6317('0x7b')]('userVoiceQueue:save',{'UserId':_0x17c3c9['id'],'VoiceQueueId':_0x39169c['id']});});});});});}})[_0x6317('0x28')](respondWithStatusCode(_0x163f40,null))[_0x6317('0x51')](handleError(_0x163f40,null));};exports[_0x6317('0x7c')]=function(_0x30bd7c,_0x67c584,_0x242bc3){return db[_0x6317('0x69')][_0x6317('0x4f')]({'where':{'id':_0x30bd7c[_0x6317('0x3d')][_0x6317('0x7d')]},'attributes':['id'],'include':[{'model':db[_0x6317('0x6c')],'as':_0x6317('0x70'),'attributes':['id'],'raw':!![]}]})[_0x6317('0x28')](handleEntityNotFound(_0x67c584,null))[_0x6317('0x28')](function(_0x4a0a5a){var _0x30e140=_['map'](_0x4a0a5a,'id');var _0xe49bdb=[];var _0x43ab12=[];var _0x462a3a=squel['select']();_0x462a3a['field'](_0x6317('0x7e'))[_0x6317('0x7f')]('team_has_voice_queues','tq')['join'](_0x6317('0x80'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6317('0x47')]('VoiceQueueId\x20=\x20?',_0x30bd7c['params']['id']);for(var _0x2c56ed=0x0;_0x2c56ed<_0x4a0a5a[_0x6317('0x42')];_0x2c56ed+=0x1){let _0x12405a=_0x4a0a5a[_0x2c56ed];for(var _0x31d5ea=0x0;_0x31d5ea<_0x12405a[_0x6317('0x70')]['length'];_0x31d5ea+=0x1){let _0x65c551=_0x12405a[_0x6317('0x70')][_0x31d5ea];var _0x5a1198=_0x462a3a[_0x6317('0x81')]();_0x5a1198['where'](_0x6317('0x82'),_0x65c551['id']);_0x43ab12[_0x6317('0x83')](db['sequelize'][_0x6317('0x3d')](_0x5a1198['toString'](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0x6317('0x28')](function(_0x40bc64){if(_0x40bc64['length']===0x1){return _0x65c551['id'];}else{var _0x4510d0=_[_0x6317('0x84')](_[_0x6317('0x2f')](_0x40bc64,'TeamId'),function(_0x449d08){return _[_0x6317('0x31')](_0x30e140,_0x449d08);});if(_0x4510d0){return _0x65c551['id'];}}}));}}return BPromise[_0x6317('0x85')](_0x43ab12)[_0x6317('0x28')](function(_0x38800f){_0xe49bdb=_(_0xe49bdb)[_0x6317('0x86')](_0x38800f)[_0x6317('0x87')]()[_0x6317('0x30')]();return db[_0x6317('0x39')]['find']({'where':{'id':_0x30bd7c[_0x6317('0x53')]['id']}})[_0x6317('0x28')](function(_0x2e2496){return db[_0x6317('0x73')]['transaction'](function(_0x3f28e2){return _0x2e2496[_0x6317('0x7c')](_0x30bd7c[_0x6317('0x3d')][_0x6317('0x7d')],{'transaction':_0x3f28e2})[_0x6317('0x28')](function(){if(!_['isEmpty'](_0xe49bdb)){return _0x2e2496[_0x6317('0x88')](_0xe49bdb,{'transaction':_0x3f28e2})[_0x6317('0x28')](function(){return db['UserVoiceQueueRt'][_0x6317('0x29')]({'where':{'VoiceQueueId':_0x30bd7c['params']['id'],'UserId':_0xe49bdb},'transaction':_0x3f28e2});});}})['then'](function(){_0xe49bdb[_0x6317('0x71')](function(_0x46b084){socket[_0x6317('0x7b')](_0x6317('0x89'),{'UserId':_0x46b084,'VoiceQueueId':_0x2e2496['id']});});});});});});})[_0x6317('0x28')](respondWithStatusCode(_0x67c584,null))[_0x6317('0x51')](handleError(_0x67c584,null));};exports['addAgents']=function(_0x44ed1f,_0x41a444,_0x3249c9){var _0x9557f,_0x345b2f;return db[_0x6317('0x39')][_0x6317('0x54')]({'where':{'id':_0x44ed1f[_0x6317('0x53')]['id']}})['then'](handleEntityNotFound(_0x41a444,null))[_0x6317('0x28')](function(_0xf9e635){if(_0xf9e635){_0x345b2f=_0xf9e635;return _0xf9e635[_0x6317('0x8a')](_0x44ed1f[_0x6317('0x56')]['ids'],_['omit'](_0x44ed1f[_0x6317('0x56')],['ids','id'])||{})[_0x6317('0x8b')](function(_0x4b3f23){for(var _0x25b52a=0x0;_0x25b52a<_0x44ed1f[_0x6317('0x56')][_0x6317('0x7d')][_0x6317('0x42')];_0x25b52a+=0x1){socket[_0x6317('0x7b')](_0x6317('0x8c'),{'UserId':_0x44ed1f['body'][_0x6317('0x7d')][_0x25b52a],'VoiceQueueId':_0x44ed1f[_0x6317('0x53')]['id']});}return _0x4b3f23;});}})[_0x6317('0x28')](function(_0x3581be){_0x9557f=_0x3581be||[];if(_0x345b2f){return db[_0x6317('0x6c')][_0x6317('0x4f')]({'where':{'id':_0x44ed1f[_0x6317('0x56')]['ids']},'attributes':['id',_0x6317('0x37'),'online',_0x6317('0x8d'),_0x6317('0x6e')],'raw':!![]});}})[_0x6317('0x28')](function(_0x109041){if(!_[_0x6317('0x8e')](_0x109041)){var _0x5ef954=[];for(var _0x552a64=0x0;_0x552a64<_0x109041['length'];_0x552a64++){if(_0x109041[_0x552a64][_0x6317('0x6d')]){_0x5ef954[_0x6317('0x83')](db[_0x6317('0x77')][_0x6317('0x78')]({'membername':_0x109041[_0x552a64][_0x6317('0x37')],'UserId':_0x109041[_0x552a64]['id'],'queue_name':_0x345b2f[_0x6317('0x37')],'VoiceQueueId':_0x345b2f['id'],'interface':_['isNil'](_0x109041[_0x552a64][_0x6317('0x6e')])?util[_0x6317('0x8f')](_0x6317('0x7a'),_0x109041[_0x552a64][_0x6317('0x37')]):_0x109041[_0x552a64][_0x6317('0x6e')],'paused':_0x109041[_0x552a64][_0x6317('0x8d')]||![],'penalty':_0x44ed1f[_0x6317('0x56')][_0x6317('0x72')]||0x0}));}}return BPromise['all'](_0x5ef954);}})[_0x6317('0x28')](function(){return _0x9557f;})[_0x6317('0x28')](respondWithResult(_0x41a444,null))[_0x6317('0x51')](handleError(_0x41a444,null));};exports[_0x6317('0x88')]=function(_0x208ff6,_0x50b846,_0x510458){return db[_0x6317('0x39')]['find']({'where':{'id':_0x208ff6[_0x6317('0x53')]['id']}})[_0x6317('0x28')](handleEntityNotFound(_0x50b846,null))[_0x6317('0x28')](function(_0x552d6a){if(_0x552d6a){return _0x552d6a[_0x6317('0x88')](_0x208ff6[_0x6317('0x3d')][_0x6317('0x7d')])[_0x6317('0x28')](function(){if(_[_0x6317('0x90')](_0x208ff6[_0x6317('0x3d')][_0x6317('0x7d')])){for(var _0x1a2a9f=0x0;_0x1a2a9f<_0x208ff6[_0x6317('0x3d')][_0x6317('0x7d')][_0x6317('0x42')];_0x1a2a9f+=0x1){socket[_0x6317('0x7b')](_0x6317('0x89'),{'UserId':Number(_0x208ff6[_0x6317('0x3d')][_0x6317('0x7d')][_0x1a2a9f]),'VoiceQueueId':Number(_0x208ff6['params']['id'])});}}else{socket[_0x6317('0x7b')](_0x6317('0x89'),{'UserId':Number(_0x208ff6[_0x6317('0x3d')][_0x6317('0x7d')]),'VoiceQueueId':Number(_0x208ff6[_0x6317('0x53')]['id'])});}});}})[_0x6317('0x28')](function(_0x1c6430){return db[_0x6317('0x77')]['destroy']({'where':{'VoiceQueueId':_0x208ff6[_0x6317('0x53')]['id'],'UserId':_0x208ff6['query'][_0x6317('0x7d')]}})[_0x6317('0x28')](function(){return _0x1c6430;});})['then'](respondWithStatusCode(_0x50b846,null))['catch'](handleError(_0x50b846,null));};exports[_0x6317('0x91')]=function(_0x283f8d,_0x3b73ed,_0x26d0f7){var _0x8057f4={};var _0xdbb0cc={};var _0x22107e;var _0x4060bd;return db[_0x6317('0x39')][_0x6317('0x61')]({'where':{'id':_0x283f8d[_0x6317('0x53')]['id']}})['then'](handleEntityNotFound(_0x3b73ed,null))[_0x6317('0x28')](function(_0x12c62e){if(_0x12c62e){_0x22107e=_0x12c62e;_0xdbb0cc[_0x6317('0x3c')]=_['keys'](db[_0x6317('0x6c')][_0x6317('0x3a')]);_0xdbb0cc[_0x6317('0x3d')]=_[_0x6317('0x3e')](_0x283f8d[_0x6317('0x3d')]);_0xdbb0cc[_0x6317('0x49')]=_['intersection'](_0xdbb0cc[_0x6317('0x3c')],_0xdbb0cc[_0x6317('0x3d')]);_0x8057f4[_0x6317('0x40')]=_[_0x6317('0x3f')](_0xdbb0cc[_0x6317('0x3c')],qs[_0x6317('0x41')](_0x283f8d[_0x6317('0x3d')][_0x6317('0x41')]));_0x8057f4[_0x6317('0x40')]=_0x8057f4[_0x6317('0x40')][_0x6317('0x42')]?_0x8057f4['attributes']:_0xdbb0cc[_0x6317('0x3c')];_0x8057f4[_0x6317('0x45')]=qs[_0x6317('0x46')](_0x283f8d[_0x6317('0x3d')][_0x6317('0x46')]);_0x8057f4[_0x6317('0x47')]=qs[_0x6317('0x49')](_['pick'](_0x283f8d['query'],_0xdbb0cc['filters']));if(_0x283f8d[_0x6317('0x3d')][_0x6317('0x2d')]){_0x8057f4['where']=_[_0x6317('0x4a')](_0x8057f4[_0x6317('0x47')],{'$or':_[_0x6317('0x2f')](_0x8057f4[_0x6317('0x40')],function(_0x2a0e07){var _0x554198={};_0x554198[_0x2a0e07]={'$like':'%'+_0x283f8d['query']['filter']+'%'};return _0x554198;})});}_0x8057f4=_[_0x6317('0x4a')]({},_0x8057f4,_0x283f8d[_0x6317('0x4c')]);return _0x22107e[_0x6317('0x91')](_0x8057f4);}})[_0x6317('0x28')](function(_0x56fbf1){if(_0x56fbf1){_0x4060bd=_0x56fbf1['length'];if(!_0x283f8d['query']['hasOwnProperty'](_0x6317('0x44'))){_0x8057f4[_0x6317('0x22')]=qs['limit'](_0x283f8d[_0x6317('0x3d')][_0x6317('0x22')]);_0x8057f4[_0x6317('0x21')]=qs[_0x6317('0x21')](_0x283f8d[_0x6317('0x3d')][_0x6317('0x21')]);}return _0x22107e[_0x6317('0x91')](_0x8057f4);}})['then'](function(_0x516aad){if(_0x516aad){return _0x516aad?{'count':_0x4060bd,'rows':_0x516aad}:null;}})['then'](respondWithResult(_0x3b73ed,null))['catch'](handleError(_0x3b73ed,null));};exports[_0x6317('0x92')]=function(_0x2ae2cc,_0xe92946,_0xacd9e9){var _0x51533c={};var _0x574a3c={};var _0x235195;var _0x466625;return db[_0x6317('0x39')][_0x6317('0x61')]({'where':{'id':_0x2ae2cc[_0x6317('0x53')]['id']}})['then'](handleEntityNotFound(_0xe92946,null))['then'](function(_0x130fb4){if(_0x130fb4){_0x235195=_0x130fb4;_0x574a3c[_0x6317('0x3c')]=_[_0x6317('0x3e')](db[_0x6317('0x77')][_0x6317('0x3a')]);_0x574a3c['query']=_[_0x6317('0x3e')](_0x2ae2cc['query']);_0x574a3c[_0x6317('0x49')]=_[_0x6317('0x3f')](_0x574a3c[_0x6317('0x3c')],_0x574a3c['query']);_0x51533c['attributes']=_[_0x6317('0x3f')](_0x574a3c[_0x6317('0x3c')],qs[_0x6317('0x41')](_0x2ae2cc[_0x6317('0x3d')]['fields']));_0x51533c[_0x6317('0x40')]=_0x51533c[_0x6317('0x40')][_0x6317('0x42')]?_0x51533c[_0x6317('0x40')]:_0x574a3c[_0x6317('0x3c')];_0x51533c[_0x6317('0x45')]=qs[_0x6317('0x46')](_0x2ae2cc['query'][_0x6317('0x46')]);_0x51533c[_0x6317('0x47')]=qs[_0x6317('0x49')](_[_0x6317('0x48')](_0x2ae2cc[_0x6317('0x3d')],_0x574a3c[_0x6317('0x49')]));if(_0x2ae2cc[_0x6317('0x3d')][_0x6317('0x2d')]){_0x51533c[_0x6317('0x47')]=_[_0x6317('0x4a')](_0x51533c[_0x6317('0x47')],{'$or':_['map'](_0x51533c[_0x6317('0x40')],function(_0x5dcb65){var _0x400fad={};_0x400fad[_0x5dcb65]={'$like':'%'+_0x2ae2cc[_0x6317('0x3d')][_0x6317('0x2d')]+'%'};return _0x400fad;})});}_0x51533c=_[_0x6317('0x4a')]({},_0x51533c,_0x2ae2cc[_0x6317('0x4c')]);return _0x235195[_0x6317('0x92')](_0x51533c);}})['then'](function(_0x307699){if(_0x307699){_0x466625=_0x307699[_0x6317('0x42')];if(!_0x2ae2cc[_0x6317('0x3d')][_0x6317('0x43')](_0x6317('0x44'))){_0x51533c[_0x6317('0x22')]=qs[_0x6317('0x22')](_0x2ae2cc[_0x6317('0x3d')][_0x6317('0x22')]);_0x51533c['offset']=qs[_0x6317('0x21')](_0x2ae2cc[_0x6317('0x3d')][_0x6317('0x21')]);}return _0x235195[_0x6317('0x92')](_0x51533c);}})[_0x6317('0x28')](function(_0x4d252b){return _0x4d252b?{'count':_0x466625,'rows':_0x4d252b}:null;})['then'](respondWithResult(_0xe92946,null))[_0x6317('0x51')](handleError(_0xe92946,null));};exports['getLists']=function(_0x41bc21,_0x1d3ca4,_0x3c8b10){var _0x410b3c={};var _0x570286={};var _0x31565c;var _0x4eb323;return db[_0x6317('0x39')][_0x6317('0x61')]({'where':{'id':_0x41bc21[_0x6317('0x53')]['id']}})[_0x6317('0x28')](handleEntityNotFound(_0x1d3ca4,null))[_0x6317('0x28')](function(_0xe1926c){if(_0xe1926c){_0x31565c=_0xe1926c;_0x570286[_0x6317('0x3c')]=_[_0x6317('0x3e')](db['CmList'][_0x6317('0x3a')]);_0x570286[_0x6317('0x3d')]=_[_0x6317('0x3e')](_0x41bc21[_0x6317('0x3d')]);_0x570286['filters']=_[_0x6317('0x3f')](_0x570286[_0x6317('0x3c')],_0x570286[_0x6317('0x3d')]);_0x410b3c[_0x6317('0x40')]=_[_0x6317('0x3f')](_0x570286[_0x6317('0x3c')],qs[_0x6317('0x41')](_0x41bc21[_0x6317('0x3d')][_0x6317('0x41')]));_0x410b3c[_0x6317('0x40')]=_0x410b3c['attributes']['length']?_0x410b3c[_0x6317('0x40')]:_0x570286[_0x6317('0x3c')];_0x410b3c[_0x6317('0x45')]=qs['sort'](_0x41bc21[_0x6317('0x3d')]['sort']);_0x410b3c['where']=qs[_0x6317('0x49')](_[_0x6317('0x48')](_0x41bc21[_0x6317('0x3d')],_0x570286[_0x6317('0x49')]));if(_0x41bc21['query'][_0x6317('0x2d')]){_0x410b3c[_0x6317('0x47')]=_[_0x6317('0x4a')](_0x410b3c[_0x6317('0x47')],{'$or':_[_0x6317('0x2f')](_0x410b3c['attributes'],function(_0x39b1c1){var _0x2f8975={};_0x2f8975[_0x39b1c1]={'$like':'%'+_0x41bc21[_0x6317('0x3d')][_0x6317('0x2d')]+'%'};return _0x2f8975;})});}_0x410b3c=_[_0x6317('0x4a')]({},_0x410b3c,_0x41bc21['options']);return _0x31565c['getLists'](_0x410b3c);}})[_0x6317('0x28')](function(_0x240489){if(_0x240489){_0x4eb323=_0x240489[_0x6317('0x42')];if(!_0x41bc21[_0x6317('0x3d')][_0x6317('0x43')](_0x6317('0x44'))){_0x410b3c[_0x6317('0x22')]=qs[_0x6317('0x22')](_0x41bc21[_0x6317('0x3d')][_0x6317('0x22')]);_0x410b3c[_0x6317('0x21')]=qs['offset'](_0x41bc21[_0x6317('0x3d')][_0x6317('0x21')]);}return _0x31565c[_0x6317('0x93')](_0x410b3c);}})[_0x6317('0x28')](function(_0x15688e){if(_0x15688e){return _0x15688e?{'count':_0x4eb323,'rows':_0x15688e}:null;}})[_0x6317('0x28')](respondWithResult(_0x1d3ca4,null))[_0x6317('0x51')](handleError(_0x1d3ca4,null));};exports[_0x6317('0x94')]=function(_0x886ae9,_0xef49bd,_0x456671){var _0x58d521,_0x58c968;return db['VoiceQueue'][_0x6317('0x54')]({'where':{'id':_0x886ae9[_0x6317('0x53')]['id']}})[_0x6317('0x28')](handleEntityNotFound(_0xef49bd,null))['then'](function(_0x3512af){if(_0x3512af){_0x58c968=_0x3512af;return _0x3512af[_0x6317('0x94')](_0x886ae9['body'][_0x6317('0x7d')],_[_0x6317('0x5d')](_0x886ae9[_0x6317('0x56')],[_0x6317('0x7d'),'id'])||{});}return null;})[_0x6317('0x8b')](function(_0x409341){var _0x2dabb7;_0x58d521=_0x409341||[];var _0x4631a0=[];if(_0x409341){for(var _0x79fde9=0x0;_0x79fde9<_0x409341[_0x6317('0x42')];_0x79fde9+=0x1){var _0x4c4b2d=_0x409341[_0x79fde9][_0x6317('0x2a')]({'plain':!![]});_0x58c968[_0x6317('0x95')]=_0x886ae9[_0x6317('0x56')]['dialCheckDuplicateType']?_0x886ae9[_0x6317('0x56')][_0x6317('0x95')]:_0x58c968[_0x6317('0x95')];switch(_0x58c968['dialCheckDuplicateType']){case _0x6317('0x96'):_0x2dabb7=squel[_0x6317('0x97')]()[_0x6317('0x98')]('cm_hopper')[_0x6317('0x99')]([_0x6317('0x9a'),_0x6317('0x9b'),_0x6317('0x9c'),'ListId',_0x6317('0x62'),_0x6317('0x5e'),_0x6317('0x9d')],squel[_0x6317('0x9e')]()['field'](_0x6317('0x9a'),_0x6317('0x9a'))[_0x6317('0x9f')](_0x6317('0xa0'),_0x6317('0x9b'))[_0x6317('0x9f')]('id',_0x6317('0x9c'))[_0x6317('0x9f')](_0x4c4b2d['CmListId'][_0x6317('0xa1')](),_0x6317('0xa2'))[_0x6317('0x9f')](_0x886ae9[_0x6317('0x53')]['id']['toString'](),_0x6317('0x62'))[_0x6317('0x9f')](_0x6317('0xa0'),_0x6317('0x5e'))[_0x6317('0x9f')]('NOW()',_0x6317('0x9d'))['from']('cm_contacts')['where'](_0x6317('0xa3'))['where'](_0x6317('0xa4'),_0x4c4b2d[_0x6317('0xa5')][_0x6317('0xa1')]())['where'](_0x6317('0xa6'))[_0x6317('0x47')](_0x6317('0xa7'),squel[_0x6317('0x9e')]()[_0x6317('0x9f')]('COALESCE(calleridnum,\x27\x27)')[_0x6317('0x7f')](_0x6317('0xa8'))[_0x6317('0x47')](_0x6317('0xa9'),_0x886ae9['params']['id'][_0x6317('0xa1')]()))[_0x6317('0x47')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6317('0x9e')]()[_0x6317('0x9f')](_0x6317('0xaa'))[_0x6317('0x7f')](_0x6317('0xab'))[_0x6317('0x47')]('VoiceQueueId\x20=\x20?',_0x886ae9[_0x6317('0x53')]['id'][_0x6317('0xa1')]())))[_0x6317('0xa1')]();break;case'onlyIfOpen':_0x2dabb7=squel['insert']()['into'](_0x6317('0xab'))['fromQuery']([_0x6317('0x9a'),_0x6317('0x9b'),_0x6317('0x9c'),_0x6317('0xa2'),'VoiceQueueId',_0x6317('0x5e'),'updatedAt'],squel[_0x6317('0x9e')]()[_0x6317('0x9f')](_0x6317('0x9a'),_0x6317('0x9a'))[_0x6317('0x9f')]('NOW()',_0x6317('0x9b'))[_0x6317('0x9f')]('id',_0x6317('0x9c'))[_0x6317('0x9f')](_0x4c4b2d[_0x6317('0xa5')][_0x6317('0xa1')](),'ListId')[_0x6317('0x9f')](_0x886ae9[_0x6317('0x53')]['id']['toString'](),_0x6317('0x62'))[_0x6317('0x9f')](_0x6317('0xa0'),'createdAt')[_0x6317('0x9f')](_0x6317('0xa0'),_0x6317('0x9d'))[_0x6317('0x7f')](_0x6317('0xac'))['where'](_0x6317('0xa3'))[_0x6317('0x47')]('ListId\x20=\x20?',_0x4c4b2d[_0x6317('0xa5')][_0x6317('0xa1')]())[_0x6317('0x47')](_0x6317('0xa6'))[_0x6317('0x47')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6317('0x9e')]()[_0x6317('0x9f')](_0x6317('0xaa'))[_0x6317('0x7f')](_0x6317('0xab'))[_0x6317('0x47')]('VoiceQueueId\x20=\x20?',_0x886ae9[_0x6317('0x53')]['id']['toString']())))[_0x6317('0xa1')]();break;default:_0x2dabb7=squel['insert']()[_0x6317('0x98')](_0x6317('0xab'))[_0x6317('0x99')]([_0x6317('0x9a'),_0x6317('0x9b'),_0x6317('0x9c'),_0x6317('0xa2'),_0x6317('0x62'),'createdAt',_0x6317('0x9d')],squel[_0x6317('0x9e')]()['field']('phone','phone')['field'](_0x6317('0xa0'),_0x6317('0x9b'))[_0x6317('0x9f')]('id',_0x6317('0x9c'))[_0x6317('0x9f')](_0x4c4b2d[_0x6317('0xa5')][_0x6317('0xa1')](),_0x6317('0xa2'))[_0x6317('0x9f')](_0x886ae9['params']['id'][_0x6317('0xa1')](),_0x6317('0x62'))[_0x6317('0x9f')](_0x6317('0xa0'),'createdAt')['field'](_0x6317('0xa0'),_0x6317('0x9d'))[_0x6317('0x7f')](_0x6317('0xac'))[_0x6317('0x47')](_0x6317('0xa3'))[_0x6317('0x47')](_0x6317('0xa4'),_0x4c4b2d[_0x6317('0xa5')][_0x6317('0xa1')]())['where'](_0x6317('0xa6')))[_0x6317('0xa1')]();}_0x4631a0[_0x6317('0x83')](db[_0x6317('0x73')][_0x6317('0x3d')](_0x2dabb7));}return BPromise[_0x6317('0x85')](_0x4631a0);}})['then'](function(){return _0x58d521;})['then'](respondWithResult(_0xef49bd,null))[_0x6317('0x51')](handleError(_0xef49bd,null));};exports['removeLists']=function(_0x4dc5b3,_0x1ebd47,_0x4e61f9){return db[_0x6317('0x39')][_0x6317('0x54')]({'where':{'id':_0x4dc5b3[_0x6317('0x53')]['id']}})[_0x6317('0x28')](handleEntityNotFound(_0x1ebd47,null))['then'](function(_0x966c0){if(_0x966c0){return _0x966c0['removeLists'](_0x4dc5b3[_0x6317('0x3d')][_0x6317('0x7d')]);}})[_0x6317('0x28')](function(_0x55f7e1){if(_0x55f7e1){return db['CmHopper'][_0x6317('0x29')]({'where':{'ListId':_0x4dc5b3['query'][_0x6317('0x7d')],'VoiceQueueId':_0x4dc5b3[_0x6317('0x53')]['id']}})[_0x6317('0x28')](function(){return _0x55f7e1;});}})[_0x6317('0x28')](respondWithStatusCode(_0x1ebd47,null))[_0x6317('0x51')](handleError(_0x1ebd47,null));};exports['getBlackLists']=function(_0x1b961d,_0x234921,_0x419ec3){var _0x1f3f57={};var _0x3ae263={};var _0x67dc59;var _0x3d2256;return db[_0x6317('0x39')][_0x6317('0x61')]({'where':{'id':_0x1b961d[_0x6317('0x53')]['id']}})['then'](handleEntityNotFound(_0x234921,null))[_0x6317('0x28')](function(_0x40d2e6){if(_0x40d2e6){_0x67dc59=_0x40d2e6;_0x3ae263[_0x6317('0x3c')]=_[_0x6317('0x3e')](db[_0x6317('0xad')]['rawAttributes']);_0x3ae263[_0x6317('0x3d')]=_[_0x6317('0x3e')](_0x1b961d[_0x6317('0x3d')]);_0x3ae263[_0x6317('0x49')]=_['intersection'](_0x3ae263[_0x6317('0x3c')],_0x3ae263[_0x6317('0x3d')]);_0x1f3f57['attributes']=_[_0x6317('0x3f')](_0x3ae263[_0x6317('0x3c')],qs[_0x6317('0x41')](_0x1b961d[_0x6317('0x3d')][_0x6317('0x41')]));_0x1f3f57[_0x6317('0x40')]=_0x1f3f57[_0x6317('0x40')][_0x6317('0x42')]?_0x1f3f57[_0x6317('0x40')]:_0x3ae263[_0x6317('0x3c')];_0x1f3f57[_0x6317('0x45')]=qs['sort'](_0x1b961d[_0x6317('0x3d')][_0x6317('0x46')]);_0x1f3f57['where']=qs[_0x6317('0x49')](_['pick'](_0x1b961d[_0x6317('0x3d')],_0x3ae263[_0x6317('0x49')]));if(_0x1b961d[_0x6317('0x3d')]['filter']){_0x1f3f57['where']=_[_0x6317('0x4a')](_0x1f3f57[_0x6317('0x47')],{'$or':_[_0x6317('0x2f')](_0x1f3f57[_0x6317('0x40')],function(_0x577d71){var _0x22c49f={};_0x22c49f[_0x577d71]={'$like':'%'+_0x1b961d[_0x6317('0x3d')]['filter']+'%'};return _0x22c49f;})});}_0x1f3f57=_['merge']({},_0x1f3f57,_0x1b961d['options']);return _0x67dc59['getBlackLists'](_0x1f3f57);}})[_0x6317('0x28')](function(_0x6450a1){if(_0x6450a1){_0x3d2256=_0x6450a1['length'];if(!_0x1b961d['query'][_0x6317('0x43')]('nolimit')){_0x1f3f57[_0x6317('0x22')]=qs[_0x6317('0x22')](_0x1b961d[_0x6317('0x3d')][_0x6317('0x22')]);_0x1f3f57['offset']=qs[_0x6317('0x21')](_0x1b961d[_0x6317('0x3d')][_0x6317('0x21')]);}return _0x67dc59[_0x6317('0xae')](_0x1f3f57);}})[_0x6317('0x28')](function(_0x5f17d7){if(_0x5f17d7){return _0x5f17d7?{'count':_0x3d2256,'rows':_0x5f17d7}:null;}})[_0x6317('0x28')](respondWithResult(_0x234921,null))[_0x6317('0x51')](handleError(_0x234921,null));};exports[_0x6317('0xaf')]=function(_0x2c9fdd,_0x37efcb,_0x1e2b6b){var _0x3e154f,_0x5a3ed0;return db[_0x6317('0x39')]['find']({'where':{'id':_0x2c9fdd['params']['id']}})[_0x6317('0x28')](handleEntityNotFound(_0x37efcb,null))[_0x6317('0x28')](function(_0x3fd54c){if(_0x3fd54c){_0x5a3ed0=_0x3fd54c;return _0x3fd54c[_0x6317('0xaf')](_0x2c9fdd[_0x6317('0x56')][_0x6317('0x7d')],_['omit'](_0x2c9fdd[_0x6317('0x56')],[_0x6317('0x7d'),'id'])||{});}return null;})[_0x6317('0x8b')](function(_0x39a89a){var _0x4b96ea;_0x3e154f=_0x39a89a||[];var _0x4e0f90=[];if(_0x39a89a){for(var _0x410375=0x0;_0x410375<_0x39a89a[_0x6317('0x42')];_0x410375+=0x1){var _0x27f26e=_0x39a89a[_0x410375][_0x6317('0x2a')]({'plain':!![]});_0x4b96ea=squel['insert']()[_0x6317('0x98')](_0x6317('0xb0'))[_0x6317('0x99')]([_0x6317('0x9a'),_0x6317('0x9c'),_0x6317('0xa2'),_0x6317('0x62'),_0x6317('0x5e'),_0x6317('0x9d')],squel[_0x6317('0x9e')]()[_0x6317('0x9f')]('phone',_0x6317('0x9a'))[_0x6317('0x9f')]('id',_0x6317('0x9c'))[_0x6317('0x9f')](_0x27f26e[_0x6317('0xa5')][_0x6317('0xa1')](),_0x6317('0xa2'))[_0x6317('0x9f')](_0x2c9fdd[_0x6317('0x53')]['id']['toString'](),_0x6317('0x62'))['field'](_0x6317('0xa0'),_0x6317('0x5e'))[_0x6317('0x9f')](_0x6317('0xa0'),_0x6317('0x9d'))['from']('cm_contacts')[_0x6317('0x47')](_0x6317('0xa3'))['where']('ListId\x20=\x20?',_0x27f26e['CmListId'][_0x6317('0xa1')]())['where'](_0x6317('0xa6')))[_0x6317('0xa1')]();_0x4e0f90['push'](db[_0x6317('0x73')][_0x6317('0x3d')](_0x4b96ea));}return BPromise[_0x6317('0x85')](_0x4e0f90);}})[_0x6317('0x28')](function(){return _0x3e154f;})[_0x6317('0x28')](respondWithResult(_0x37efcb,null))[_0x6317('0x51')](handleError(_0x37efcb,null));};exports[_0x6317('0xb1')]=function(_0x24fa3c,_0x188ce7,_0x16a504){return db['VoiceQueue'][_0x6317('0x54')]({'where':{'id':_0x24fa3c[_0x6317('0x53')]['id']}})[_0x6317('0x28')](handleEntityNotFound(_0x188ce7,null))['then'](function(_0xb96a38){if(_0xb96a38){return _0xb96a38[_0x6317('0xb1')](_0x24fa3c['query']['ids']);}})[_0x6317('0x28')](function(_0x2a3336){if(_0x2a3336){return db[_0x6317('0x67')][_0x6317('0x29')]({'where':{'ListId':_0x24fa3c[_0x6317('0x3d')][_0x6317('0x7d')],'VoiceQueueId':_0x24fa3c[_0x6317('0x53')]['id']}})[_0x6317('0x28')](function(){return _0x2a3336;});}})['then'](respondWithStatusCode(_0x188ce7,null))[_0x6317('0x51')](handleError(_0x188ce7,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 1fd3f76..87c7715 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 _0xb78b=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','remove','emit'];(function(_0x3663b9,_0x21dc0e){var _0x2dfe62=function(_0x5913bd){while(--_0x5913bd){_0x3663b9['push'](_0x3663b9['shift']());}};_0x2dfe62(++_0x21dc0e);}(_0xb78b,0xc1));var _0xbb78=function(_0x255850,_0x5511dd){_0x255850=_0x255850-0x0;var _0x5ceacf=_0xb78b[_0x255850];return _0x5ceacf;};'use strict';var EventEmitter=require(_0xbb78('0x0'));var VoiceQueue=require(_0xbb78('0x1'))['db'][_0xbb78('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xbb78('0x3')](0x0);var events={'afterCreate':_0xbb78('0x4'),'afterUpdate':'update','afterDestroy':_0xbb78('0x5')};function emitEvent(_0x2ee158){return function(_0x6ce757,_0x32ccfc,_0x47e4fa){VoiceQueueEvents[_0xbb78('0x6')](_0x2ee158+':'+_0x6ce757['id'],_0x6ce757);VoiceQueueEvents[_0xbb78('0x6')](_0x2ee158,_0x6ce757);_0x47e4fa(null);};}for(var e in events){if(events[_0xbb78('0x7')](e)){var event=events[e];VoiceQueue[_0xbb78('0x8')](e,emitEvent(event));}}module[_0xbb78('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0xde0e=['setMaxListeners','save','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue'];(function(_0x2adc36,_0x5b0adf){var _0x14e8f0=function(_0x120d4b){while(--_0x120d4b){_0x2adc36['push'](_0x2adc36['shift']());}};_0x14e8f0(++_0x5b0adf);}(_0xde0e,0x1d5));var _0xede0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde0e[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xede0('0x0'));var VoiceQueue=require(_0xede0('0x1'))['db'][_0xede0('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xede0('0x3')](0x0);var events={'afterCreate':_0xede0('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1dadab){return function(_0x5e4855,_0x19bea3,_0xeca35){VoiceQueueEvents['emit'](_0x1dadab+':'+_0x5e4855['id'],_0x5e4855);VoiceQueueEvents['emit'](_0x1dadab,_0x5e4855);_0xeca35(null);};}for(var e in events){if(events[_0xede0('0x5')](e)){var event=events[e];VoiceQueue[_0xede0('0x6')](e,emitEvent(event));}}module[_0xede0('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 7970cb4..2d18389 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 _0xed37=['api','moment','rimraf','../../config/environment','exports','VoiceQueue','lodash','util','../../config/logger'];(function(_0x3e9977,_0x28fb68){var _0x1ca2a7=function(_0x276291){while(--_0x276291){_0x3e9977['push'](_0x3e9977['shift']());}};_0x1ca2a7(++_0x28fb68);}(_0xed37,0x1b6));var _0x7ed3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xed37[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x7ed3('0x0'));var util=require(_0x7ed3('0x1'));var logger=require(_0x7ed3('0x2'))(_0x7ed3('0x3'));var moment=require(_0x7ed3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7ed3('0x5'));var config=require(_0x7ed3('0x6'));var attributes=require('./voiceQueue.attributes');module[_0x7ed3('0x7')]=function(_0x4c0e4c,_0x53d85f){return _0x4c0e4c['define'](_0x7ed3('0x8'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1af6=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueue.attributes','VoiceQueue','voice_queues','lodash'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x1af6,0x95));var _0x61af=function(_0x462e80,_0x11908d){_0x462e80=_0x462e80-0x0;var _0x278a87=_0x1af6[_0x462e80];return _0x278a87;};'use strict';var _=require(_0x61af('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x61af('0x1'));var moment=require(_0x61af('0x2'));var BPromise=require(_0x61af('0x3'));var rp=require(_0x61af('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x61af('0x5'));var config=require(_0x61af('0x6'));var attributes=require(_0x61af('0x7'));module['exports']=function(_0x5638d0,_0x640200){return _0x5638d0['define'](_0x61af('0x8'),attributes,{'tableName':_0x61af('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 c64e7fb..009f6fb 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 _0x16e9=['VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVoiceQueue','VoiceQueue','options','raw','where','attributes','include','model','map','then','find','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x30cf5a,_0x247fa1){var _0x240a0a=function(_0x35a17b){while(--_0x35a17b){_0x30cf5a['push'](_0x30cf5a['shift']());}};_0x240a0a(++_0x247fa1);}(_0x16e9,0x197));var _0x916e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x16e9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x916e('0x0'));var util=require(_0x916e('0x1'));var moment=require(_0x916e('0x2'));var BPromise=require(_0x916e('0x3'));var rs=require(_0x916e('0x4'));var fs=require('fs');var Redis=require(_0x916e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x916e('0x6'))(_0x916e('0x7'));var config=require(_0x916e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x916e('0x9')][_0x916e('0xa')]({'port':0x232a});config[_0x916e('0xb')]=_[_0x916e('0xc')](config[_0x916e('0xb')],{'host':_0x916e('0xd'),'port':0x18eb});var socket=require(_0x916e('0xe'))(new Redis(config[_0x916e('0xb')]));require(_0x916e('0xf'))[_0x916e('0x10')](socket);function respondWithRpcPromise(_0x59e834,_0x595aa1,_0x801dc7){return new BPromise(function(_0x4ba26d,_0x297758){return client[_0x916e('0x11')](_0x59e834,_0x801dc7)['then'](function(_0x3226c2){logger[_0x916e('0x12')](_0x916e('0x13'),_0x595aa1,_0x916e('0x14'));logger[_0x916e('0x15')](_0x916e('0x16'),_0x595aa1,'request\x20sent',JSON[_0x916e('0x17')](_0x3226c2));if(_0x3226c2['error']){if(_0x3226c2[_0x916e('0x18')]['code']===0x1f4){logger[_0x916e('0x18')](_0x916e('0x13'),_0x595aa1,_0x3226c2[_0x916e('0x18')][_0x916e('0x19')]);return _0x297758(_0x3226c2[_0x916e('0x18')][_0x916e('0x19')]);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x595aa1,_0x3226c2[_0x916e('0x18')][_0x916e('0x19')]);return _0x4ba26d(_0x3226c2[_0x916e('0x18')][_0x916e('0x19')]);}else{logger['info'](_0x916e('0x13'),_0x595aa1,_0x916e('0x14'));_0x4ba26d(_0x3226c2['result'][_0x916e('0x19')]);}})[_0x916e('0x1a')](function(_0x106ed6){logger[_0x916e('0x18')](_0x916e('0x13'),_0x595aa1,_0x106ed6);_0x297758(_0x106ed6);});});}exports[_0x916e('0x1b')]=function(_0x12e6ae){var _0x27403e=this;return new Promise(function(_0x1dd693,_0x254042){return db[_0x916e('0x1c')]['findAll']({'raw':_0x12e6ae[_0x916e('0x1d')]?_0x12e6ae[_0x916e('0x1d')][_0x916e('0x1e')]===undefined?!![]:![]:!![],'where':_0x12e6ae['options']?_0x12e6ae[_0x916e('0x1d')][_0x916e('0x1f')]||null:null,'attributes':_0x12e6ae['options']?_0x12e6ae['options'][_0x916e('0x20')]||null:null,'limit':_0x12e6ae['options']?_0x12e6ae[_0x916e('0x1d')]['limit']||null:null,'include':_0x12e6ae[_0x916e('0x1d')]?_0x12e6ae['options'][_0x916e('0x21')]?_['map'](_0x12e6ae[_0x916e('0x1d')][_0x916e('0x21')],function(_0x215916){return{'model':db[_0x215916['model']],'as':_0x215916['as'],'attributes':_0x215916[_0x916e('0x20')],'include':_0x215916[_0x916e('0x21')]?_['map'](_0x215916[_0x916e('0x21')],function(_0x10bb15){return{'model':db[_0x10bb15[_0x916e('0x22')]],'as':_0x10bb15['as'],'attributes':_0x10bb15[_0x916e('0x20')],'include':_0x10bb15['include']?_[_0x916e('0x23')](_0x10bb15[_0x916e('0x21')],function(_0x19c9d1){return{'model':db[_0x19c9d1[_0x916e('0x22')]],'as':_0x19c9d1['as'],'attributes':_0x19c9d1['attributes']};}):[]};}):[]};}):[]:[]})[_0x916e('0x24')](function(_0x48c86d){logger[_0x916e('0x12')](_0x916e('0x1b'),_0x12e6ae);logger[_0x916e('0x15')](_0x916e('0x1b'),_0x12e6ae,JSON[_0x916e('0x17')](_0x48c86d));_0x1dd693(_0x48c86d);})[_0x916e('0x1a')](function(_0x334e58){logger['error']('GetVoiceQueue',_0x334e58[_0x916e('0x19')],_0x12e6ae);_0x254042(_0x27403e[_0x916e('0x18')](0x1f4,_0x334e58[_0x916e('0x19')]));});});};exports['ShowVoiceQueue']=function(_0x3153c3){var _0x10be5d=this;return new Promise(function(_0x500930,_0x2d93f8){return db[_0x916e('0x1c')][_0x916e('0x25')]({'raw':_0x3153c3[_0x916e('0x1d')]?_0x3153c3['options']['raw']===undefined?!![]:![]:!![],'where':_0x3153c3[_0x916e('0x1d')]?_0x3153c3['options']['where']||null:null,'attributes':_0x3153c3[_0x916e('0x1d')]?_0x3153c3[_0x916e('0x1d')]['attributes']||null:null,'include':_0x3153c3[_0x916e('0x1d')]?_0x3153c3[_0x916e('0x1d')][_0x916e('0x21')]?_['map'](_0x3153c3[_0x916e('0x1d')]['include'],function(_0x35b14f){return{'model':db[_0x35b14f[_0x916e('0x22')]],'as':_0x35b14f['as'],'attributes':_0x35b14f[_0x916e('0x20')],'include':_0x35b14f['include']?_[_0x916e('0x23')](_0x35b14f[_0x916e('0x21')],function(_0x4a0ce9){return{'model':db[_0x4a0ce9[_0x916e('0x22')]],'as':_0x4a0ce9['as'],'attributes':_0x4a0ce9['attributes'],'include':_0x4a0ce9[_0x916e('0x21')]?_['map'](_0x4a0ce9[_0x916e('0x21')],function(_0xf81b95){return{'model':db[_0xf81b95[_0x916e('0x22')]],'as':_0xf81b95['as'],'attributes':_0xf81b95[_0x916e('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2bc99b){logger[_0x916e('0x12')](_0x916e('0x26'),_0x3153c3);logger[_0x916e('0x15')](_0x916e('0x26'),_0x3153c3,JSON[_0x916e('0x17')](_0x2bc99b));_0x500930(_0x2bc99b);})[_0x916e('0x1a')](function(_0x29e124){logger[_0x916e('0x18')]('ShowVoiceQueue',_0x29e124[_0x916e('0x19')],_0x3153c3);_0x2d93f8(_0x10be5d['error'](0x1f4,_0x29e124['message']));});});}; \ No newline at end of file +var _0xa60f=['./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowVoiceQueue','find','lodash','moment','bluebird','ioredis','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x6863b1,_0x4d9b20){var _0xe7c700=function(_0x83f5d8){while(--_0x83f5d8){_0x6863b1['push'](_0x6863b1['shift']());}};_0xe7c700(++_0x4d9b20);}(_0xa60f,0x1b1));var _0xfa60=function(_0x5051c4,_0xebc58c){_0x5051c4=_0x5051c4-0x0;var _0x5606c2=_0xa60f[_0x5051c4];return _0x5606c2;};'use strict';var _=require(_0xfa60('0x0'));var util=require('util');var moment=require(_0xfa60('0x1'));var BPromise=require(_0xfa60('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfa60('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfa60('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfa60('0x5')][_0xfa60('0x6')]({'port':0x232a});config[_0xfa60('0x7')]=_[_0xfa60('0x8')](config[_0xfa60('0x7')],{'host':_0xfa60('0x9'),'port':0x18eb});var socket=require(_0xfa60('0xa'))(new Redis(config[_0xfa60('0x7')]));require(_0xfa60('0xb'))[_0xfa60('0xc')](socket);function respondWithRpcPromise(_0x1f6ce9,_0x3fa346,_0x48fcf2){return new BPromise(function(_0x140eb8,_0x185bf9){return client['request'](_0x1f6ce9,_0x48fcf2)[_0xfa60('0xd')](function(_0x10db9a){logger[_0xfa60('0xe')](_0xfa60('0xf'),_0x3fa346,_0xfa60('0x10'));logger[_0xfa60('0x11')](_0xfa60('0x12'),_0x3fa346,_0xfa60('0x10'),JSON[_0xfa60('0x13')](_0x10db9a));if(_0x10db9a[_0xfa60('0x14')]){if(_0x10db9a[_0xfa60('0x14')][_0xfa60('0x15')]===0x1f4){logger[_0xfa60('0x14')](_0xfa60('0xf'),_0x3fa346,_0x10db9a[_0xfa60('0x14')][_0xfa60('0x16')]);return _0x185bf9(_0x10db9a[_0xfa60('0x14')]['message']);}logger[_0xfa60('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x3fa346,_0x10db9a[_0xfa60('0x14')][_0xfa60('0x16')]);return _0x140eb8(_0x10db9a[_0xfa60('0x14')][_0xfa60('0x16')]);}else{logger['info'](_0xfa60('0xf'),_0x3fa346,_0xfa60('0x10'));_0x140eb8(_0x10db9a['result']['message']);}})['catch'](function(_0x4e4b11){logger['error'](_0xfa60('0xf'),_0x3fa346,_0x4e4b11);_0x185bf9(_0x4e4b11);});});}exports[_0xfa60('0x17')]=function(_0xa2143e){var _0x46b4ae=this;return new Promise(function(_0x4c5dd7,_0x22105f){return db[_0xfa60('0x18')][_0xfa60('0x19')]({'raw':_0xa2143e[_0xfa60('0x1a')]?_0xa2143e[_0xfa60('0x1a')][_0xfa60('0x1b')]===undefined?!![]:![]:!![],'where':_0xa2143e[_0xfa60('0x1a')]?_0xa2143e['options'][_0xfa60('0x1c')]||null:null,'attributes':_0xa2143e[_0xfa60('0x1a')]?_0xa2143e[_0xfa60('0x1a')][_0xfa60('0x1d')]||null:null,'limit':_0xa2143e['options']?_0xa2143e[_0xfa60('0x1a')][_0xfa60('0x1e')]||null:null,'include':_0xa2143e['options']?_0xa2143e[_0xfa60('0x1a')][_0xfa60('0x1f')]?_[_0xfa60('0x20')](_0xa2143e['options'][_0xfa60('0x1f')],function(_0x29e79e){return{'model':db[_0x29e79e[_0xfa60('0x21')]],'as':_0x29e79e['as'],'attributes':_0x29e79e[_0xfa60('0x1d')],'include':_0x29e79e[_0xfa60('0x1f')]?_[_0xfa60('0x20')](_0x29e79e[_0xfa60('0x1f')],function(_0x1e257e){return{'model':db[_0x1e257e['model']],'as':_0x1e257e['as'],'attributes':_0x1e257e['attributes'],'include':_0x1e257e[_0xfa60('0x1f')]?_[_0xfa60('0x20')](_0x1e257e[_0xfa60('0x1f')],function(_0x3f7560){return{'model':db[_0x3f7560['model']],'as':_0x3f7560['as'],'attributes':_0x3f7560['attributes']};}):[]};}):[]};}):[]:[]})[_0xfa60('0xd')](function(_0x4e2d53){logger[_0xfa60('0xe')](_0xfa60('0x17'),_0xa2143e);logger[_0xfa60('0x11')](_0xfa60('0x17'),_0xa2143e,JSON[_0xfa60('0x13')](_0x4e2d53));_0x4c5dd7(_0x4e2d53);})[_0xfa60('0x22')](function(_0x413e27){logger['error'](_0xfa60('0x17'),_0x413e27[_0xfa60('0x16')],_0xa2143e);_0x22105f(_0x46b4ae[_0xfa60('0x14')](0x1f4,_0x413e27[_0xfa60('0x16')]));});});};exports[_0xfa60('0x23')]=function(_0x33ea79){var _0x31f0be=this;return new Promise(function(_0x111994,_0x50af21){return db[_0xfa60('0x18')][_0xfa60('0x24')]({'raw':_0x33ea79[_0xfa60('0x1a')]?_0x33ea79[_0xfa60('0x1a')][_0xfa60('0x1b')]===undefined?!![]:![]:!![],'where':_0x33ea79[_0xfa60('0x1a')]?_0x33ea79['options']['where']||null:null,'attributes':_0x33ea79['options']?_0x33ea79['options']['attributes']||null:null,'include':_0x33ea79[_0xfa60('0x1a')]?_0x33ea79[_0xfa60('0x1a')]['include']?_[_0xfa60('0x20')](_0x33ea79[_0xfa60('0x1a')][_0xfa60('0x1f')],function(_0x1bcd8b){return{'model':db[_0x1bcd8b[_0xfa60('0x21')]],'as':_0x1bcd8b['as'],'attributes':_0x1bcd8b['attributes'],'include':_0x1bcd8b[_0xfa60('0x1f')]?_[_0xfa60('0x20')](_0x1bcd8b['include'],function(_0x1cebc0){return{'model':db[_0x1cebc0[_0xfa60('0x21')]],'as':_0x1cebc0['as'],'attributes':_0x1cebc0[_0xfa60('0x1d')],'include':_0x1cebc0[_0xfa60('0x1f')]?_[_0xfa60('0x20')](_0x1cebc0[_0xfa60('0x1f')],function(_0x56cac9){return{'model':db[_0x56cac9[_0xfa60('0x21')]],'as':_0x56cac9['as'],'attributes':_0x56cac9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x12937a){logger[_0xfa60('0xe')](_0xfa60('0x23'),_0x33ea79);logger[_0xfa60('0x11')](_0xfa60('0x23'),_0x33ea79,JSON[_0xfa60('0x13')](_0x12937a));_0x111994(_0x12937a);})[_0xfa60('0x22')](function(_0x1f60d7){logger[_0xfa60('0x14')](_0xfa60('0x23'),_0x1f60d7[_0xfa60('0x16')],_0x33ea79);_0x50af21(_0x31f0be[_0xfa60('0x14')](0x1f4,_0x1f60d7[_0xfa60('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 7618fde..8e0f8b5 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 _0x3440=['./voiceQueue.events','save','update','emit','removeListener','register','length'];(function(_0x5d8d5e,_0x4188e4){var _0x3d69f1=function(_0x26dd0f){while(--_0x26dd0f){_0x5d8d5e['push'](_0x5d8d5e['shift']());}};_0x3d69f1(++_0x4188e4);}(_0x3440,0x9a));var _0x0344=function(_0x59cfcb,_0x1c96d2){_0x59cfcb=_0x59cfcb-0x0;var _0x1efad9=_0x3440[_0x59cfcb];return _0x1efad9;};'use strict';var VoiceQueueEvents=require(_0x0344('0x0'));var events=[_0x0344('0x1'),'remove',_0x0344('0x2')];function createListener(_0x50db8f,_0x4cc8c9){return function(_0x2cd023){_0x4cc8c9[_0x0344('0x3')](_0x50db8f,_0x2cd023);};}function removeListener(_0x1499e3,_0x1787a1){return function(){VoiceQueueEvents[_0x0344('0x4')](_0x1499e3,_0x1787a1);};}exports[_0x0344('0x5')]=function(_0x6cb14c){for(var _0x2f8343=0x0,_0x513bf8=events[_0x0344('0x6')];_0x2f8343<_0x513bf8;_0x2f8343++){var _0x19f9fd=events[_0x2f8343];var _0x171d9d=createListener('voiceQueue:'+_0x19f9fd,_0x6cb14c);VoiceQueueEvents['on'](_0x19f9fd,_0x171d9d);}}; \ No newline at end of file +var _0xa105=['./voiceQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0x57c1b6,_0x1a2125){var _0x81434c=function(_0x5835de){while(--_0x5835de){_0x57c1b6['push'](_0x57c1b6['shift']());}};_0x81434c(++_0x1a2125);}(_0xa105,0xe8));var _0x5a10=function(_0x4725c3,_0x3c6398){_0x4725c3=_0x4725c3-0x0;var _0x57df90=_0xa105[_0x4725c3];return _0x57df90;};'use strict';var VoiceQueueEvents=require(_0x5a10('0x0'));var events=[_0x5a10('0x1'),_0x5a10('0x2'),_0x5a10('0x3')];function createListener(_0x200508,_0x396eb1){return function(_0x12d159){_0x396eb1[_0x5a10('0x4')](_0x200508,_0x12d159);};}function removeListener(_0x13e3d5,_0x241404){return function(){VoiceQueueEvents[_0x5a10('0x5')](_0x13e3d5,_0x241404);};}exports[_0x5a10('0x6')]=function(_0x5ee360){for(var _0x118cc6=0x0,_0x403466=events[_0x5a10('0x7')];_0x118cc6<_0x403466;_0x118cc6++){var _0x3c0386=events[_0x118cc6];var _0x2beceb=createListener('voiceQueue:'+_0x3c0386,_0x5ee360);VoiceQueueEvents['on'](_0x3c0386,_0x2beceb);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index f687cdc..3717d4c 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 _0x57ca=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2f7694,_0x27737e){var _0x163ac5=function(_0x2727e8){while(--_0x2727e8){_0x2f7694['push'](_0x2f7694['shift']());}};_0x163ac5(++_0x27737e);}(_0x57ca,0x108));var _0xa57c=function(_0x50d6df,_0x188854){_0x50d6df=_0x50d6df-0x0;var _0x3b56db=_0x57ca[_0x50d6df];return _0x3b56db;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var auth=require(_0xa57c('0x4'));var interaction=require(_0xa57c('0x5'));var config=require(_0xa57c('0x6'));var controller=require('./voiceQueueReport.controller');router[_0xa57c('0x7')]('/',auth[_0xa57c('0x8')](),controller[_0xa57c('0x9')]);router[_0xa57c('0x7')](_0xa57c('0xa'),auth[_0xa57c('0x8')](),controller[_0xa57c('0xb')]);router[_0xa57c('0x7')]('/index',auth[_0xa57c('0x8')](),controller['getVoiceQueuesReport']);router[_0xa57c('0x7')](_0xa57c('0xc'),auth['isAuthenticated'](),controller[_0xa57c('0xd')]);router['post']('/',auth[_0xa57c('0x8')](),controller[_0xa57c('0xe')]);router['put'](_0xa57c('0xc'),auth['isAuthenticated'](),controller[_0xa57c('0xf')]);router[_0xa57c('0x10')](_0xa57c('0xc'),auth[_0xa57c('0x8')](),controller[_0xa57c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x83d0=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','/index','/:id','show','put'];(function(_0x47746e,_0x5e6ee3){var _0x5d0860=function(_0x5bbd83){while(--_0x5bbd83){_0x47746e['push'](_0x47746e['shift']());}};_0x5d0860(++_0x5e6ee3);}(_0x83d0,0xb7));var _0x083d=function(_0x1cde4b,_0x209cd8){_0x1cde4b=_0x1cde4b-0x0;var _0x4a60a8=_0x83d0[_0x1cde4b];return _0x4a60a8;};'use strict';var multer=require(_0x083d('0x0'));var util=require(_0x083d('0x1'));var path=require(_0x083d('0x2'));var timeout=require(_0x083d('0x3'));var express=require(_0x083d('0x4'));var router=express[_0x083d('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x083d('0x6'));var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router[_0x083d('0x7')]('/',auth[_0x083d('0x8')](),controller[_0x083d('0x9')]);router[_0x083d('0x7')](_0x083d('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x083d('0x7')](_0x083d('0xb'),auth[_0x083d('0x8')](),controller['getVoiceQueuesReport']);router[_0x083d('0x7')](_0x083d('0xc'),auth[_0x083d('0x8')](),controller[_0x083d('0xd')]);router['post']('/',auth[_0x083d('0x8')](),controller['create']);router[_0x083d('0xe')](_0x083d('0xc'),auth['isAuthenticated'](),controller[_0x083d('0xf')]);router[_0x083d('0x10')](_0x083d('0xc'),auth[_0x083d('0x8')](),controller[_0x083d('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 4fe72dd..f286d1b 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 _0x9bb3=['holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x9bb3,0x134));var _0x39bb=function(_0x3f1e92,_0x593921){_0x3f1e92=_0x3f1e92-0x0;var _0x2eb985=_0x9bb3[_0x3f1e92];return _0x2eb985;};'use strict';var Sequelize=require(_0x39bb('0x0'));var moment=require(_0x39bb('0x1'));module[_0x39bb('0x2')]={'type':{'type':Sequelize[_0x39bb('0x3')]},'uniqueid':{'type':Sequelize[_0x39bb('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x39bb('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x39bb('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x39bb('0x4')],'set':function(_0x2e238f){var _0x3c4b39=moment(_0x2e238f);var _0x145a6e=moment(this[_0x39bb('0x5')](_0x39bb('0x6')))[_0x39bb('0x7')](_0x39bb('0x8'));var _0x1e4c98=_0x3c4b39[_0x39bb('0x9')](_0x145a6e,_0x39bb('0xa'));this['setDataValue']('queuecallerleaveAt',_0x2e238f);this[_0x39bb('0xb')](_0x39bb('0xc'),_0x1e4c98||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x39bb('0xd')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x39bb('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x39bb('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x39bb('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x39bb('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x39bb('0xd')]},'channel':{'type':Sequelize[_0x39bb('0x3')]},'connectedlinenum':{'type':Sequelize[_0x39bb('0x3')]},'connectedlinename':{'type':Sequelize[_0x39bb('0x3')]},'accountcode':{'type':Sequelize[_0x39bb('0x3')]},'context':{'type':Sequelize[_0x39bb('0x3')]},'exten':{'type':Sequelize[_0x39bb('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x39bb('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x39bb('0x3')]},'transfer':{'type':Sequelize[_0x39bb('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x39bb('0x3')],'comment':_0x39bb('0xf')},'transferexten':{'type':Sequelize[_0x39bb('0x3')]},'transferuniqueid':{'type':Sequelize[_0x39bb('0x3')]},'disposition':{'type':Sequelize[_0x39bb('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x39bb('0xd')],'defaultValue':0x0}}; \ No newline at end of file +var _0x85a0=['format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','sequelize','moment','STRING','DATE','queuecallerjoinAt'];(function(_0xff9362,_0x475eb6){var _0x39ca6b=function(_0x39993e){while(--_0x39993e){_0xff9362['push'](_0xff9362['shift']());}};_0x39ca6b(++_0x475eb6);}(_0x85a0,0xdf));var _0x085a=function(_0x5f24b4,_0x3d512f){_0x5f24b4=_0x5f24b4-0x0;var _0x376b3c=_0x85a0[_0x5f24b4];return _0x376b3c;};'use strict';var Sequelize=require(_0x085a('0x0'));var moment=require(_0x085a('0x1'));module['exports']={'type':{'type':Sequelize[_0x085a('0x2')]},'uniqueid':{'type':Sequelize[_0x085a('0x2')]},'calleridnum':{'type':Sequelize[_0x085a('0x2')]},'calleridname':{'type':Sequelize[_0x085a('0x2')]},'queue':{'type':Sequelize[_0x085a('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x085a('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x29fd45){var _0xd2e32d=moment(_0x29fd45);var _0x50d197=moment(this['getDataValue'](_0x085a('0x4')))[_0x085a('0x5')](_0x085a('0x6'));var _0x28a420=_0xd2e32d['diff'](_0x50d197,_0x085a('0x7'));this[_0x085a('0x8')]('queuecallerleaveAt',_0x29fd45);this['setDataValue'](_0x085a('0x9'),_0x28a420||null);}},'position':{'type':Sequelize[_0x085a('0xa')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x085a('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x085a('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x085a('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x085a('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x085a('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x085a('0x2')]},'connectedlinenum':{'type':Sequelize[_0x085a('0x2')]},'connectedlinename':{'type':Sequelize[_0x085a('0x2')]},'accountcode':{'type':Sequelize[_0x085a('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x085a('0x2')]},'priority':{'type':Sequelize[_0x085a('0x2')]},'holdtime':{'type':Sequelize[_0x085a('0xa')]},'mohtime':{'type':Sequelize[_0x085a('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x085a('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x085a('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x085a('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x085a('0xa')],'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 3b4a568..b42aab4 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 _0xc4aa=['fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','options','VoiceQueueReport','includeAll','rows','catch','show','rawAttributes','include','find','body','params','describe','getVoiceQueuesReport','nolimit','order','findAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0x559baa,_0x5906e4){var _0x49fe5c=function(_0x26e654){while(--_0x26e654){_0x559baa['push'](_0x559baa['shift']());}};_0x49fe5c(++_0x5906e4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc4aa[_0x3ab51d];return _0x29a04e;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];config[_0xac4a('0x16')]=_[_0xac4a('0x17')](config['redis'],{'host':_0xac4a('0x18'),'port':0x18eb});var socket=require(_0xac4a('0x19'))(new Redis(config[_0xac4a('0x16')]));require(_0xac4a('0x1a'))[_0xac4a('0x1b')](socket);function respondWithStatusCode(_0x3b71c0,_0x34bc01){_0x34bc01=_0x34bc01||0xcc;return function(_0x33c287){if(_0x33c287){return _0x3b71c0[_0xac4a('0x1c')](_0x34bc01);}return _0x3b71c0[_0xac4a('0x1d')](_0x34bc01)[_0xac4a('0x1e')]();};}function respondWithResult(_0x26dbb8,_0x4a2119){_0x4a2119=_0x4a2119||0xc8;return function(_0x402fff){if(_0x402fff){return _0x26dbb8[_0xac4a('0x1d')](_0x4a2119)[_0xac4a('0x1f')](_0x402fff);}};}function respondWithFilteredResult(_0x144553,_0x3e88e3){return function(_0x387a54){if(_0x387a54){var _0x28e304=_0x387a54[_0xac4a('0x20')],_0x44ec59=_0x3e88e3[_0xac4a('0x21')],_0x546c5d=_0x3e88e3[_0xac4a('0x21')]+_0x3e88e3['limit'],_0x5ac21e;if(_0x546c5d>=_0x28e304){_0x546c5d=_0x28e304;_0x5ac21e=0xc8;}else{_0x5ac21e=0xce;}_0x144553[_0xac4a('0x1d')](_0x5ac21e);return _0x144553[_0xac4a('0x22')](_0xac4a('0x23'),_0x44ec59+'-'+_0x546c5d+'/'+_0x28e304)[_0xac4a('0x1f')](_0x387a54);}return null;};}function patchUpdates(_0x123694){return function(_0x3e829c){try{jsonpatch[_0xac4a('0x24')](_0x3e829c,_0x123694,!![]);}catch(_0x3ca790){return BPromise['reject'](_0x3ca790);}return _0x3e829c[_0xac4a('0x25')]();};}function saveUpdates(_0x3204ad,_0x599787){return function(_0x3d7ce0){if(_0x3d7ce0){return _0x3d7ce0[_0xac4a('0x26')](_0x3204ad)[_0xac4a('0x27')](function(_0x947d8e){return _0x947d8e;});}return null;};}function removeEntity(_0x4d2d6c,_0x1b7998){return function(_0x2503d8){if(_0x2503d8){return _0x2503d8[_0xac4a('0x28')]()[_0xac4a('0x27')](function(){_0x4d2d6c[_0xac4a('0x1d')](0xcc)[_0xac4a('0x1e')]();});}};}function handleEntityNotFound(_0x222507,_0x36054a){return function(_0x3e2c69){if(!_0x3e2c69){_0x222507[_0xac4a('0x1c')](0x194);}return _0x3e2c69;};}function handleError(_0x1d0539,_0x215a31){_0x215a31=_0x215a31||0x1f4;return function(_0x14832b){logger[_0xac4a('0x29')](_0x14832b[_0xac4a('0x2a')]);if(_0x14832b[_0xac4a('0x2b')]){delete _0x14832b['name'];}_0x1d0539[_0xac4a('0x1d')](_0x215a31)[_0xac4a('0x2c')](_0x14832b);};}exports[_0xac4a('0x2d')]=function(_0x2772fe,_0x116700){var _0x4a5a9e={},_0x47f49c={},_0xdb7e={'count':0x0,'rows':[]};var _0x7a948b=_[_0xac4a('0x2e')](db['VoiceQueueReport']['rawAttributes'],function(_0x355755){return{'name':_0x355755[_0xac4a('0x2f')],'type':_0x355755[_0xac4a('0x30')][_0xac4a('0x31')]};});_0x47f49c[_0xac4a('0x32')]=_['map'](_0x7a948b,_0xac4a('0x2b'));_0x47f49c['query']=_[_0xac4a('0x33')](_0x2772fe['query']);_0x47f49c[_0xac4a('0x34')]=_[_0xac4a('0x35')](_0x47f49c[_0xac4a('0x32')],_0x47f49c[_0xac4a('0x36')]);_0x4a5a9e[_0xac4a('0x37')]=_[_0xac4a('0x35')](_0x47f49c[_0xac4a('0x32')],qs[_0xac4a('0x38')](_0x2772fe[_0xac4a('0x36')][_0xac4a('0x38')]));_0x4a5a9e[_0xac4a('0x37')]=_0x4a5a9e[_0xac4a('0x37')][_0xac4a('0x39')]?_0x4a5a9e[_0xac4a('0x37')]:_0x47f49c['model'];if(!_0x2772fe[_0xac4a('0x36')][_0xac4a('0x3a')]('nolimit')){_0x4a5a9e[_0xac4a('0x3b')]=qs[_0xac4a('0x3b')](_0x2772fe['query']['limit']);_0x4a5a9e[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x2772fe[_0xac4a('0x36')][_0xac4a('0x21')]);}_0x4a5a9e['order']=qs[_0xac4a('0x3c')](_0x2772fe[_0xac4a('0x36')]['sort']);_0x4a5a9e[_0xac4a('0x3d')]=qs[_0xac4a('0x34')](_[_0xac4a('0x3e')](_0x2772fe['query'],_0x47f49c[_0xac4a('0x34')]));if(_0x2772fe[_0xac4a('0x36')][_0xac4a('0x3f')]){_0x4a5a9e['where']=_[_0xac4a('0x40')](_0x4a5a9e[_0xac4a('0x3d')],{'$or':_['map'](_0x7a948b,function(_0x59bebf){if(_0x59bebf[_0xac4a('0x30')]!=='VIRTUAL'){var _0x50e03e={};_0x50e03e[_0x59bebf['name']]={'$like':'%'+_0x2772fe['query'][_0xac4a('0x3f')]+'%'};return _0x50e03e;}})});}_0x4a5a9e=_[_0xac4a('0x40')]({},_0x4a5a9e,_0x2772fe[_0xac4a('0x41')]);var _0x472484={'where':_0x4a5a9e[_0xac4a('0x3d')]};return db[_0xac4a('0x42')][_0xac4a('0x20')](_0x472484)[_0xac4a('0x27')](function(_0x28292c){_0xdb7e[_0xac4a('0x20')]=_0x28292c;if(_0x2772fe[_0xac4a('0x36')][_0xac4a('0x43')]){_0x4a5a9e['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x4a5a9e);})[_0xac4a('0x27')](function(_0x5c46a){_0xdb7e[_0xac4a('0x44')]=_0x5c46a;return _0xdb7e;})[_0xac4a('0x27')](respondWithFilteredResult(_0x116700,_0x4a5a9e))[_0xac4a('0x45')](handleError(_0x116700,null));};exports[_0xac4a('0x46')]=function(_0x8febf0,_0x3441f2){var _0x3e9973={'raw':![],'where':{'id':_0x8febf0['params']['id']}},_0x3edb19={};_0x3edb19[_0xac4a('0x32')]=_[_0xac4a('0x33')](db[_0xac4a('0x42')][_0xac4a('0x47')]);_0x3edb19[_0xac4a('0x36')]=_['keys'](_0x8febf0[_0xac4a('0x36')]);_0x3edb19[_0xac4a('0x34')]=_['intersection'](_0x3edb19[_0xac4a('0x32')],_0x3edb19['query']);_0x3e9973[_0xac4a('0x37')]=_[_0xac4a('0x35')](_0x3edb19[_0xac4a('0x32')],qs[_0xac4a('0x38')](_0x8febf0[_0xac4a('0x36')][_0xac4a('0x38')]));_0x3e9973[_0xac4a('0x37')]=_0x3e9973[_0xac4a('0x37')][_0xac4a('0x39')]?_0x3e9973[_0xac4a('0x37')]:_0x3edb19[_0xac4a('0x32')];if(_0x8febf0[_0xac4a('0x36')]['includeAll']){_0x3e9973[_0xac4a('0x48')]=[{'all':!![]}];}_0x3e9973=_[_0xac4a('0x40')]({},_0x3e9973,_0x8febf0[_0xac4a('0x41')]);return db['VoiceQueueReport'][_0xac4a('0x49')](_0x3e9973)[_0xac4a('0x27')](handleEntityNotFound(_0x3441f2,null))['then'](respondWithResult(_0x3441f2,null))[_0xac4a('0x45')](handleError(_0x3441f2,null));};exports['create']=function(_0x244950,_0xe620f6){return db[_0xac4a('0x42')]['create'](_0x244950['body'],{})[_0xac4a('0x27')](respondWithResult(_0xe620f6,0xc9))['catch'](handleError(_0xe620f6,null));};exports[_0xac4a('0x26')]=function(_0x566258,_0x3d2aaf){if(_0x566258['body']['id']){delete _0x566258[_0xac4a('0x4a')]['id'];}return db[_0xac4a('0x42')][_0xac4a('0x49')]({'where':{'id':_0x566258[_0xac4a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3d2aaf,null))[_0xac4a('0x27')](saveUpdates(_0x566258[_0xac4a('0x4a')],null))[_0xac4a('0x27')](respondWithResult(_0x3d2aaf,null))[_0xac4a('0x45')](handleError(_0x3d2aaf,null));};exports[_0xac4a('0x28')]=function(_0x138876,_0x187306){return db['VoiceQueueReport'][_0xac4a('0x49')]({'where':{'id':_0x138876[_0xac4a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x187306,null))[_0xac4a('0x27')](removeEntity(_0x187306,null))[_0xac4a('0x45')](handleError(_0x187306,null));};exports[_0xac4a('0x4c')]=function(_0x3ac36e,_0x4bb2fb){return db[_0xac4a('0x42')][_0xac4a('0x4c')]()[_0xac4a('0x27')](respondWithResult(_0x4bb2fb,null))[_0xac4a('0x45')](handleError(_0x4bb2fb,null));};exports[_0xac4a('0x4d')]=function(_0x49fbc3,_0x179373){var _0x564b10={},_0x307441={},_0x2c04af={'count':0x0,'rows':[]};_0x307441['model']=_['keys'](db[_0xac4a('0x42')][_0xac4a('0x47')]);_0x307441['query']=_[_0xac4a('0x33')](_0x49fbc3[_0xac4a('0x36')]);_0x307441[_0xac4a('0x34')]=_[_0xac4a('0x35')](_0x307441['model'],_0x307441[_0xac4a('0x36')]);_0x564b10[_0xac4a('0x37')]=_[_0xac4a('0x35')](_0x307441[_0xac4a('0x32')],qs[_0xac4a('0x38')](_0x49fbc3[_0xac4a('0x36')][_0xac4a('0x38')]));_0x564b10['attributes']=_0x564b10[_0xac4a('0x37')][_0xac4a('0x39')]?_0x564b10[_0xac4a('0x37')]:_0x307441[_0xac4a('0x32')];if(!_0x49fbc3[_0xac4a('0x36')][_0xac4a('0x3a')](_0xac4a('0x4e'))){_0x564b10[_0xac4a('0x3b')]=qs[_0xac4a('0x3b')](_0x49fbc3[_0xac4a('0x36')][_0xac4a('0x3b')]);_0x564b10[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x49fbc3[_0xac4a('0x36')][_0xac4a('0x21')]);}_0x564b10[_0xac4a('0x4f')]=qs['sort'](_0x49fbc3[_0xac4a('0x36')]['sort']);_0x564b10[_0xac4a('0x3d')]=qs['filters'](_[_0xac4a('0x3e')](_0x49fbc3['query'],_0x307441[_0xac4a('0x34')]));if(_0x49fbc3['query']['filter']){_0x564b10[_0xac4a('0x3d')]=_[_0xac4a('0x40')](_0x564b10[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2e')](_0x564b10[_0xac4a('0x37')],function(_0xb7b884){var _0x592a4b={};_0x592a4b[_0xb7b884]={'$like':'%'+_0x49fbc3[_0xac4a('0x36')]['filter']+'%'};return _0x592a4b;})});}_0x564b10=_[_0xac4a('0x40')]({},_0x564b10,_0x49fbc3['options']);var _0x347880={'where':_0x564b10[_0xac4a('0x3d')]};return db[_0xac4a('0x42')][_0xac4a('0x20')](_0x347880)[_0xac4a('0x27')](function(_0x2bc39a){_0x2c04af[_0xac4a('0x20')]=_0x2bc39a;if(_0x49fbc3[_0xac4a('0x36')][_0xac4a('0x43')]){_0x564b10[_0xac4a('0x48')]=[{'all':!![]}];}return db[_0xac4a('0x42')][_0xac4a('0x50')](_0x564b10);})[_0xac4a('0x27')](function(_0x2cc410){_0x2c04af[_0xac4a('0x44')]=_0x2cc410;return _0x2c04af;})[_0xac4a('0x27')](respondWithFilteredResult(_0x179373,_0x564b10,_0xac4a('0x4d')))['catch'](handleError(_0x179373,null,_0xac4a('0x4d')));}; \ No newline at end of file +var _0xdb28=['merge','VIRTUAL','filter','options','VoiceQueueReport','count','include','catch','show','rawAttributes','includeAll','find','create','body','params','destroy','describe','getVoiceQueuesReport','rows','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./voiceQueueReport.socket','register','sendStatus','status','end','offset','limit','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters'];(function(_0x1dd208,_0x56ef55){var _0x5cae17=function(_0x34b4ef){while(--_0x34b4ef){_0x1dd208['push'](_0x1dd208['shift']());}};_0x5cae17(++_0x56ef55);}(_0xdb28,0x106));var _0x8db2=function(_0x587d09,_0x404dec){_0x587d09=_0x587d09-0x0;var _0x313a08=_0xdb28[_0x587d09];return _0x313a08;};'use strict';var pdf=require(_0x8db2('0x0'));var emlformat=require(_0x8db2('0x1'));var rimraf=require(_0x8db2('0x2'));var zipdir=require(_0x8db2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8db2('0x4'));var moment=require(_0x8db2('0x5'));var BPromise=require(_0x8db2('0x6'));var Mustache=require(_0x8db2('0x7'));var util=require(_0x8db2('0x8'));var path=require('path');var sox=require(_0x8db2('0x9'));var csv=require(_0x8db2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0xa'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var db=require(_0x8db2('0x17'))['db'];config[_0x8db2('0x18')]=_[_0x8db2('0x19')](config[_0x8db2('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8db2('0x18')]));require(_0x8db2('0x1a'))[_0x8db2('0x1b')](socket);function respondWithStatusCode(_0x1d6a15,_0x227355){_0x227355=_0x227355||0xcc;return function(_0xfa285b){if(_0xfa285b){return _0x1d6a15[_0x8db2('0x1c')](_0x227355);}return _0x1d6a15[_0x8db2('0x1d')](_0x227355)[_0x8db2('0x1e')]();};}function respondWithResult(_0x16c8c2,_0x5489a9){_0x5489a9=_0x5489a9||0xc8;return function(_0x13b0f5){if(_0x13b0f5){return _0x16c8c2[_0x8db2('0x1d')](_0x5489a9)['json'](_0x13b0f5);}};}function respondWithFilteredResult(_0x2b3f73,_0x44957d){return function(_0x21db8c){if(_0x21db8c){var _0x3fddc2=_0x21db8c['count'],_0x2efd06=_0x44957d[_0x8db2('0x1f')],_0x46ce14=_0x44957d[_0x8db2('0x1f')]+_0x44957d[_0x8db2('0x20')],_0x51d60d;if(_0x46ce14>=_0x3fddc2){_0x46ce14=_0x3fddc2;_0x51d60d=0xc8;}else{_0x51d60d=0xce;}_0x2b3f73[_0x8db2('0x1d')](_0x51d60d);return _0x2b3f73['set'](_0x8db2('0x21'),_0x2efd06+'-'+_0x46ce14+'/'+_0x3fddc2)[_0x8db2('0x22')](_0x21db8c);}return null;};}function patchUpdates(_0x260940){return function(_0x297ba3){try{jsonpatch[_0x8db2('0x23')](_0x297ba3,_0x260940,!![]);}catch(_0x597260){return BPromise[_0x8db2('0x24')](_0x597260);}return _0x297ba3[_0x8db2('0x25')]();};}function saveUpdates(_0x18f69c,_0x125be2){return function(_0x2260d8){if(_0x2260d8){return _0x2260d8[_0x8db2('0x26')](_0x18f69c)[_0x8db2('0x27')](function(_0x5c6614){return _0x5c6614;});}return null;};}function removeEntity(_0x256202,_0x4f6516){return function(_0x5725f0){if(_0x5725f0){return _0x5725f0['destroy']()['then'](function(){_0x256202[_0x8db2('0x1d')](0xcc)[_0x8db2('0x1e')]();});}};}function handleEntityNotFound(_0x3be281,_0x2baed0){return function(_0x145328){if(!_0x145328){_0x3be281[_0x8db2('0x1c')](0x194);}return _0x145328;};}function handleError(_0x58cd9d,_0x3544ba){_0x3544ba=_0x3544ba||0x1f4;return function(_0x372311){logger[_0x8db2('0x28')](_0x372311[_0x8db2('0x29')]);if(_0x372311['name']){delete _0x372311[_0x8db2('0x2a')];}_0x58cd9d[_0x8db2('0x1d')](_0x3544ba)[_0x8db2('0x2b')](_0x372311);};}exports[_0x8db2('0x2c')]=function(_0xbe5ece,_0x21bae5){var _0xa54ea3={},_0x3124d5={},_0xbc5366={'count':0x0,'rows':[]};var _0x493cab=_[_0x8db2('0x2d')](db['VoiceQueueReport']['rawAttributes'],function(_0x302188){return{'name':_0x302188[_0x8db2('0x2e')],'type':_0x302188[_0x8db2('0x2f')]['key']};});_0x3124d5[_0x8db2('0x30')]=_['map'](_0x493cab,_0x8db2('0x2a'));_0x3124d5[_0x8db2('0x31')]=_[_0x8db2('0x32')](_0xbe5ece['query']);_0x3124d5['filters']=_[_0x8db2('0x33')](_0x3124d5[_0x8db2('0x30')],_0x3124d5['query']);_0xa54ea3['attributes']=_[_0x8db2('0x33')](_0x3124d5[_0x8db2('0x30')],qs[_0x8db2('0x34')](_0xbe5ece[_0x8db2('0x31')][_0x8db2('0x34')]));_0xa54ea3[_0x8db2('0x35')]=_0xa54ea3[_0x8db2('0x35')][_0x8db2('0x36')]?_0xa54ea3[_0x8db2('0x35')]:_0x3124d5[_0x8db2('0x30')];if(!_0xbe5ece['query'][_0x8db2('0x37')](_0x8db2('0x38'))){_0xa54ea3['limit']=qs[_0x8db2('0x20')](_0xbe5ece[_0x8db2('0x31')]['limit']);_0xa54ea3['offset']=qs[_0x8db2('0x1f')](_0xbe5ece['query'][_0x8db2('0x1f')]);}_0xa54ea3[_0x8db2('0x39')]=qs[_0x8db2('0x3a')](_0xbe5ece[_0x8db2('0x31')]['sort']);_0xa54ea3[_0x8db2('0x3b')]=qs['filters'](_[_0x8db2('0x3c')](_0xbe5ece[_0x8db2('0x31')],_0x3124d5[_0x8db2('0x3d')]));if(_0xbe5ece[_0x8db2('0x31')]['filter']){_0xa54ea3['where']=_[_0x8db2('0x3e')](_0xa54ea3[_0x8db2('0x3b')],{'$or':_['map'](_0x493cab,function(_0x2bac57){if(_0x2bac57[_0x8db2('0x2f')]!==_0x8db2('0x3f')){var _0x4cb253={};_0x4cb253[_0x2bac57[_0x8db2('0x2a')]]={'$like':'%'+_0xbe5ece[_0x8db2('0x31')][_0x8db2('0x40')]+'%'};return _0x4cb253;}})});}_0xa54ea3=_[_0x8db2('0x3e')]({},_0xa54ea3,_0xbe5ece[_0x8db2('0x41')]);var _0x40d82a={'where':_0xa54ea3[_0x8db2('0x3b')]};return db[_0x8db2('0x42')][_0x8db2('0x43')](_0x40d82a)[_0x8db2('0x27')](function(_0x21cf7c){_0xbc5366[_0x8db2('0x43')]=_0x21cf7c;if(_0xbe5ece[_0x8db2('0x31')]['includeAll']){_0xa54ea3[_0x8db2('0x44')]=[{'all':!![]}];}return db[_0x8db2('0x42')]['findAll'](_0xa54ea3);})['then'](function(_0x249c73){_0xbc5366['rows']=_0x249c73;return _0xbc5366;})[_0x8db2('0x27')](respondWithFilteredResult(_0x21bae5,_0xa54ea3))[_0x8db2('0x45')](handleError(_0x21bae5,null));};exports[_0x8db2('0x46')]=function(_0x307783,_0xb4fe2c){var _0x30d606={'raw':![],'where':{'id':_0x307783['params']['id']}},_0xa53fba={};_0xa53fba[_0x8db2('0x30')]=_[_0x8db2('0x32')](db[_0x8db2('0x42')][_0x8db2('0x47')]);_0xa53fba['query']=_[_0x8db2('0x32')](_0x307783[_0x8db2('0x31')]);_0xa53fba[_0x8db2('0x3d')]=_[_0x8db2('0x33')](_0xa53fba['model'],_0xa53fba[_0x8db2('0x31')]);_0x30d606['attributes']=_[_0x8db2('0x33')](_0xa53fba[_0x8db2('0x30')],qs[_0x8db2('0x34')](_0x307783['query']['fields']));_0x30d606[_0x8db2('0x35')]=_0x30d606['attributes'][_0x8db2('0x36')]?_0x30d606[_0x8db2('0x35')]:_0xa53fba[_0x8db2('0x30')];if(_0x307783[_0x8db2('0x31')][_0x8db2('0x48')]){_0x30d606[_0x8db2('0x44')]=[{'all':!![]}];}_0x30d606=_[_0x8db2('0x3e')]({},_0x30d606,_0x307783[_0x8db2('0x41')]);return db[_0x8db2('0x42')][_0x8db2('0x49')](_0x30d606)[_0x8db2('0x27')](handleEntityNotFound(_0xb4fe2c,null))[_0x8db2('0x27')](respondWithResult(_0xb4fe2c,null))['catch'](handleError(_0xb4fe2c,null));};exports[_0x8db2('0x4a')]=function(_0x2ada52,_0xdbba64){return db[_0x8db2('0x42')]['create'](_0x2ada52['body'],{})[_0x8db2('0x27')](respondWithResult(_0xdbba64,0xc9))[_0x8db2('0x45')](handleError(_0xdbba64,null));};exports[_0x8db2('0x26')]=function(_0x4c66e5,_0x540d90){if(_0x4c66e5['body']['id']){delete _0x4c66e5[_0x8db2('0x4b')]['id'];}return db[_0x8db2('0x42')][_0x8db2('0x49')]({'where':{'id':_0x4c66e5[_0x8db2('0x4c')]['id']}})[_0x8db2('0x27')](handleEntityNotFound(_0x540d90,null))[_0x8db2('0x27')](saveUpdates(_0x4c66e5[_0x8db2('0x4b')],null))['then'](respondWithResult(_0x540d90,null))['catch'](handleError(_0x540d90,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x42')][_0x8db2('0x49')]({'where':{'id':_0x18c6ef[_0x8db2('0x4c')]['id']}})[_0x8db2('0x27')](handleEntityNotFound(_0x2908e4,null))[_0x8db2('0x27')](removeEntity(_0x2908e4,null))[_0x8db2('0x45')](handleError(_0x2908e4,null));};exports[_0x8db2('0x4e')]=function(_0x3bc632,_0x319273){return db[_0x8db2('0x42')][_0x8db2('0x4e')]()[_0x8db2('0x27')](respondWithResult(_0x319273,null))['catch'](handleError(_0x319273,null));};exports[_0x8db2('0x4f')]=function(_0xb4b0a,_0x579317){var _0x27b644={},_0xd78022={},_0x3af298={'count':0x0,'rows':[]};_0xd78022['model']=_[_0x8db2('0x32')](db[_0x8db2('0x42')][_0x8db2('0x47')]);_0xd78022[_0x8db2('0x31')]=_[_0x8db2('0x32')](_0xb4b0a['query']);_0xd78022[_0x8db2('0x3d')]=_[_0x8db2('0x33')](_0xd78022[_0x8db2('0x30')],_0xd78022['query']);_0x27b644[_0x8db2('0x35')]=_[_0x8db2('0x33')](_0xd78022[_0x8db2('0x30')],qs[_0x8db2('0x34')](_0xb4b0a[_0x8db2('0x31')][_0x8db2('0x34')]));_0x27b644[_0x8db2('0x35')]=_0x27b644['attributes'][_0x8db2('0x36')]?_0x27b644[_0x8db2('0x35')]:_0xd78022['model'];if(!_0xb4b0a[_0x8db2('0x31')][_0x8db2('0x37')]('nolimit')){_0x27b644[_0x8db2('0x20')]=qs[_0x8db2('0x20')](_0xb4b0a[_0x8db2('0x31')][_0x8db2('0x20')]);_0x27b644[_0x8db2('0x1f')]=qs[_0x8db2('0x1f')](_0xb4b0a[_0x8db2('0x31')][_0x8db2('0x1f')]);}_0x27b644[_0x8db2('0x39')]=qs[_0x8db2('0x3a')](_0xb4b0a[_0x8db2('0x31')][_0x8db2('0x3a')]);_0x27b644[_0x8db2('0x3b')]=qs[_0x8db2('0x3d')](_[_0x8db2('0x3c')](_0xb4b0a[_0x8db2('0x31')],_0xd78022['filters']));if(_0xb4b0a[_0x8db2('0x31')][_0x8db2('0x40')]){_0x27b644[_0x8db2('0x3b')]=_[_0x8db2('0x3e')](_0x27b644[_0x8db2('0x3b')],{'$or':_['map'](_0x27b644[_0x8db2('0x35')],function(_0x2c3087){var _0x3ab670={};_0x3ab670[_0x2c3087]={'$like':'%'+_0xb4b0a[_0x8db2('0x31')][_0x8db2('0x40')]+'%'};return _0x3ab670;})});}_0x27b644=_[_0x8db2('0x3e')]({},_0x27b644,_0xb4b0a[_0x8db2('0x41')]);var _0x2c7b04={'where':_0x27b644[_0x8db2('0x3b')]};return db[_0x8db2('0x42')][_0x8db2('0x43')](_0x2c7b04)[_0x8db2('0x27')](function(_0x170a72){_0x3af298[_0x8db2('0x43')]=_0x170a72;if(_0xb4b0a[_0x8db2('0x31')][_0x8db2('0x48')]){_0x27b644[_0x8db2('0x44')]=[{'all':!![]}];}return db[_0x8db2('0x42')]['findAll'](_0x27b644);})[_0x8db2('0x27')](function(_0x536ac1){_0x3af298[_0x8db2('0x50')]=_0x536ac1;return _0x3af298;})['then'](respondWithFilteredResult(_0x579317,_0x27b644,_0x8db2('0x4f')))[_0x8db2('0x45')](handleError(_0x579317,null,_0x8db2('0x4f')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 55c1437..89cd5c7 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 _0x2327=['../../mysqldb','VoiceQueueReport','save','emit','hasOwnProperty','exports','events'];(function(_0x1e9449,_0x422da){var _0x1740ab=function(_0x2562b8){while(--_0x2562b8){_0x1e9449['push'](_0x1e9449['shift']());}};_0x1740ab(++_0x422da);}(_0x2327,0xae));var _0x7232=function(_0x1b38d8,_0x1a86ac){_0x1b38d8=_0x1b38d8-0x0;var _0x1929af=_0x2327[_0x1b38d8];return _0x1929af;};'use strict';var EventEmitter=require(_0x7232('0x0'));var VoiceQueueReport=require(_0x7232('0x1'))['db'][_0x7232('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7232('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3dd099){return function(_0x6823b3,_0x4c3289,_0x3e4817){VoiceQueueReportEvents[_0x7232('0x4')](_0x3dd099+':'+_0x6823b3['id'],_0x6823b3);VoiceQueueReportEvents[_0x7232('0x4')](_0x3dd099,_0x6823b3);_0x3e4817(null);};}for(var e in events){if(events[_0x7232('0x5')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x7232('0x6')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x7f7a=['update','remove','emit','hasOwnProperty','hook','exports','events','VoiceQueueReport','save'];(function(_0x1ae029,_0x15cc90){var _0x21d90a=function(_0x3f77f5){while(--_0x3f77f5){_0x1ae029['push'](_0x1ae029['shift']());}};_0x21d90a(++_0x15cc90);}(_0x7f7a,0x177));var _0xa7f7=function(_0x327d2b,_0x1109dd){_0x327d2b=_0x327d2b-0x0;var _0xaaa158=_0x7f7a[_0x327d2b];return _0xaaa158;};'use strict';var EventEmitter=require(_0xa7f7('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xa7f7('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa7f7('0x2'),'afterUpdate':_0xa7f7('0x3'),'afterDestroy':_0xa7f7('0x4')};function emitEvent(_0x23f8bc){return function(_0x448d8f,_0x385721,_0x31a7fe){VoiceQueueReportEvents[_0xa7f7('0x5')](_0x23f8bc+':'+_0x448d8f['id'],_0x448d8f);VoiceQueueReportEvents[_0xa7f7('0x5')](_0x23f8bc,_0x448d8f);_0x31a7fe(null);};}for(var e in events){if(events[_0xa7f7('0x6')](e)){var event=events[e];VoiceQueueReport[_0xa7f7('0x7')](e,emitEvent(event));}}module[_0xa7f7('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index f01cdf1..b257538 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 _0x757a=['./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0xfc0957,_0x3a049c){var _0x254ee6=function(_0x594818){while(--_0x594818){_0xfc0957['push'](_0xfc0957['shift']());}};_0x254ee6(++_0x3a049c);}(_0x757a,0xde));var _0xa757=function(_0x584719,_0x17c633){_0x584719=_0x584719-0x0;var _0x2380f1=_0x757a[_0x584719];return _0x2380f1;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('VoiceQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'fields':[_0xa757('0xa')]},{'fields':[_0xa757('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb28=['bluebird','request-promise','path','rimraf','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api'];(function(_0x323fff,_0x38f93e){var _0x326de5=function(_0x5520f9){while(--_0x5520f9){_0x323fff['push'](_0x323fff['shift']());}};_0x326de5(++_0x38f93e);}(_0xdb28,0x106));var _0x8db2=function(_0x20e7d0,_0x20e4ab){_0x20e7d0=_0x20e7d0-0x0;var _0x5052e5=_0xdb28[_0x20e7d0];return _0x5052e5;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var logger=require(_0x8db2('0x2'))(_0x8db2('0x3'));var moment=require('moment');var BPromise=require(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var fs=require('fs');var path=require(_0x8db2('0x6'));var rimraf=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var attributes=require('./voiceQueueReport.attributes');module[_0x8db2('0x9')]=function(_0x1d2dd3,_0x5f42ee){return _0x1d2dd3['define'](_0x8db2('0xa'),attributes,{'tableName':_0x8db2('0xb'),'paranoid':![],'indexes':[{'fields':[_0x8db2('0xc')]},{'fields':[_0x8db2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index a981269..2db2ec9 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 _0x9c60=['debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','include','model','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','update','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x9c60,0x144));var _0x09c6=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c60[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0x09c6('0x0'));var moment=require('moment');var BPromise=require(_0x09c6('0x1'));var rs=require(_0x09c6('0x2'));var fs=require('fs');var Redis=require(_0x09c6('0x3'));var db=require(_0x09c6('0x4'))['db'];var utils=require(_0x09c6('0x5'));var logger=require('../../config/logger')(_0x09c6('0x6'));var config=require(_0x09c6('0x7'));var jayson=require(_0x09c6('0x8'));var client=jayson[_0x09c6('0x9')][_0x09c6('0xa')]({'port':0x232a});config[_0x09c6('0xb')]=_[_0x09c6('0xc')](config[_0x09c6('0xb')],{'host':_0x09c6('0xd'),'port':0x18eb});var socket=require(_0x09c6('0xe'))(new Redis(config[_0x09c6('0xb')]));require(_0x09c6('0xf'))['register'](socket);function respondWithRpcPromise(_0x66dea6,_0x2f3933,_0x2fe433){return new BPromise(function(_0xa829b4,_0x3a47db){return client[_0x09c6('0x10')](_0x66dea6,_0x2fe433)[_0x09c6('0x11')](function(_0x2ce681){logger[_0x09c6('0x12')](_0x09c6('0x13'),_0x2f3933,'request\x20sent');logger[_0x09c6('0x14')](_0x09c6('0x15'),_0x2f3933,_0x09c6('0x16'),JSON[_0x09c6('0x17')](_0x2ce681));if(_0x2ce681[_0x09c6('0x18')]){if(_0x2ce681[_0x09c6('0x18')][_0x09c6('0x19')]===0x1f4){logger[_0x09c6('0x18')](_0x09c6('0x13'),_0x2f3933,_0x2ce681[_0x09c6('0x18')][_0x09c6('0x1a')]);return _0x3a47db(_0x2ce681[_0x09c6('0x18')][_0x09c6('0x1a')]);}logger[_0x09c6('0x18')](_0x09c6('0x13'),_0x2f3933,_0x2ce681['error'][_0x09c6('0x1a')]);return _0xa829b4(_0x2ce681['error'][_0x09c6('0x1a')]);}else{logger[_0x09c6('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x2f3933,_0x09c6('0x16'));_0xa829b4(_0x2ce681[_0x09c6('0x1b')][_0x09c6('0x1a')]);}})[_0x09c6('0x1c')](function(_0x111752){logger[_0x09c6('0x18')](_0x09c6('0x13'),_0x2f3933,_0x111752);_0x3a47db(_0x111752);});});}exports[_0x09c6('0x1d')]=function(_0x3ef7c6){var _0x40694b=this;return new Promise(function(_0x5bc1e5,_0x5c9559){return db[_0x09c6('0x1e')][_0x09c6('0x1f')]({'raw':_0x3ef7c6['options']?_0x3ef7c6[_0x09c6('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x3ef7c6['options']?_0x3ef7c6[_0x09c6('0x20')][_0x09c6('0x21')]||null:null,'attributes':_0x3ef7c6[_0x09c6('0x20')]?_0x3ef7c6[_0x09c6('0x20')][_0x09c6('0x22')]||null:null,'limit':_0x3ef7c6[_0x09c6('0x20')]?_0x3ef7c6[_0x09c6('0x20')][_0x09c6('0x23')]||null:null,'include':_0x3ef7c6['options']?_0x3ef7c6[_0x09c6('0x20')][_0x09c6('0x24')]?_['map'](_0x3ef7c6[_0x09c6('0x20')][_0x09c6('0x24')],function(_0x40eb3a){return{'model':db[_0x40eb3a[_0x09c6('0x25')]],'as':_0x40eb3a['as'],'attributes':_0x40eb3a[_0x09c6('0x22')],'include':_0x40eb3a[_0x09c6('0x24')]?_['map'](_0x40eb3a[_0x09c6('0x24')],function(_0x142fb3){return{'model':db[_0x142fb3[_0x09c6('0x25')]],'as':_0x142fb3['as'],'attributes':_0x142fb3[_0x09c6('0x22')],'include':_0x142fb3[_0x09c6('0x24')]?_['map'](_0x142fb3[_0x09c6('0x24')],function(_0x4b727b){return{'model':db[_0x4b727b['model']],'as':_0x4b727b['as'],'attributes':_0x4b727b[_0x09c6('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dc799){logger[_0x09c6('0x12')]('GetVoiceQueueReport',_0x3ef7c6);logger[_0x09c6('0x14')](_0x09c6('0x1d'),_0x3ef7c6,JSON['stringify'](_0x3dc799));_0x5bc1e5(_0x3dc799);})[_0x09c6('0x1c')](function(_0x913d8){logger[_0x09c6('0x18')](_0x09c6('0x1d'),_0x913d8[_0x09c6('0x1a')],_0x3ef7c6);_0x5c9559(_0x40694b[_0x09c6('0x18')](0x1f4,_0x913d8[_0x09c6('0x1a')]));});});};exports[_0x09c6('0x26')]=function(_0x22fd67){var _0x1b7270=this;return new Promise(function(_0x2c2c12,_0x258982){return db[_0x09c6('0x1e')]['create'](_0x22fd67[_0x09c6('0x27')],{'raw':_0x22fd67['options']?_0x22fd67[_0x09c6('0x20')]['raw']===undefined?!![]:![]:!![]})[_0x09c6('0x11')](function(_0x4a4a87){logger[_0x09c6('0x12')](_0x09c6('0x26'),_0x22fd67);logger[_0x09c6('0x14')](_0x09c6('0x26'),_0x22fd67,JSON[_0x09c6('0x17')](_0x4a4a87));_0x2c2c12(_0x4a4a87);})[_0x09c6('0x1c')](function(_0x3a04df){logger[_0x09c6('0x18')](_0x09c6('0x26'),_0x3a04df[_0x09c6('0x1a')],_0x22fd67);_0x258982(_0x1b7270['error'](0x1f4,_0x3a04df[_0x09c6('0x1a')]));});});};exports[_0x09c6('0x28')]=function(_0x2f80b2){var _0x53651a=this;return new Promise(function(_0xf0a585,_0x41b4d6){return db[_0x09c6('0x1e')][_0x09c6('0x29')](_0x2f80b2['body'],{'raw':_0x2f80b2[_0x09c6('0x20')]?_0x2f80b2[_0x09c6('0x20')][_0x09c6('0x2a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f80b2[_0x09c6('0x20')]?_0x2f80b2[_0x09c6('0x20')][_0x09c6('0x21')]||null:null,'attributes':_0x2f80b2['options']?_0x2f80b2[_0x09c6('0x20')][_0x09c6('0x22')]||null:null,'limit':_0x2f80b2[_0x09c6('0x20')]?_0x2f80b2['options']['limit']||null:null})[_0x09c6('0x11')](function(_0x2bc522){logger[_0x09c6('0x12')](_0x09c6('0x28'),_0x2f80b2);logger[_0x09c6('0x14')](_0x09c6('0x28'),_0x2f80b2,JSON[_0x09c6('0x17')](_0x2bc522));_0xf0a585(_0x2bc522);})[_0x09c6('0x1c')](function(_0x2d73ec){logger['error']('UpdateVoiceQueueReport',_0x2d73ec[_0x09c6('0x1a')],_0x2f80b2);_0x41b4d6(_0x53651a[_0x09c6('0x18')](0x1f4,_0x2d73ec[_0x09c6('0x1a')]));});});}; \ No newline at end of file +var _0x31b6=['include','model','map','create','body','raw','CreateVoiceQueueReport','update','UpdateVoiceQueueReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','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','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x31b6,0xe5));var _0x631b=function(_0x3e079f,_0x189e15){_0x3e079f=_0x3e079f-0x0;var _0x296a34=_0x31b6[_0x3e079f];return _0x296a34;};'use strict';var _=require(_0x631b('0x0'));var util=require(_0x631b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x631b('0x2'));var fs=require('fs');var Redis=require(_0x631b('0x3'));var db=require(_0x631b('0x4'))['db'];var utils=require(_0x631b('0x5'));var logger=require('../../config/logger')(_0x631b('0x6'));var config=require(_0x631b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x631b('0x8')][_0x631b('0x9')]({'port':0x232a});config[_0x631b('0xa')]=_['defaults'](config[_0x631b('0xa')],{'host':_0x631b('0xb'),'port':0x18eb});var socket=require(_0x631b('0xc'))(new Redis(config['redis']));require(_0x631b('0xd'))[_0x631b('0xe')](socket);function respondWithRpcPromise(_0x3c29ee,_0x39f290,_0x16fc7b){return new BPromise(function(_0x5554f8,_0x2f9ad2){return client[_0x631b('0xf')](_0x3c29ee,_0x16fc7b)[_0x631b('0x10')](function(_0x600748){logger['info'](_0x631b('0x11'),_0x39f290,_0x631b('0x12'));logger[_0x631b('0x13')](_0x631b('0x14'),_0x39f290,_0x631b('0x12'),JSON[_0x631b('0x15')](_0x600748));if(_0x600748[_0x631b('0x16')]){if(_0x600748[_0x631b('0x16')][_0x631b('0x17')]===0x1f4){logger['error'](_0x631b('0x11'),_0x39f290,_0x600748[_0x631b('0x16')]['message']);return _0x2f9ad2(_0x600748[_0x631b('0x16')][_0x631b('0x18')]);}logger[_0x631b('0x16')](_0x631b('0x11'),_0x39f290,_0x600748['error']['message']);return _0x5554f8(_0x600748[_0x631b('0x16')][_0x631b('0x18')]);}else{logger[_0x631b('0x19')](_0x631b('0x11'),_0x39f290,_0x631b('0x12'));_0x5554f8(_0x600748[_0x631b('0x1a')][_0x631b('0x18')]);}})[_0x631b('0x1b')](function(_0x5c6460){logger[_0x631b('0x16')]('VoiceQueueReport,\x20%s,\x20%s',_0x39f290,_0x5c6460);_0x2f9ad2(_0x5c6460);});});}exports[_0x631b('0x1c')]=function(_0x2414c5){var _0x26a3af=this;return new Promise(function(_0x211e48,_0x5d8042){return db[_0x631b('0x1d')][_0x631b('0x1e')]({'raw':_0x2414c5[_0x631b('0x1f')]?_0x2414c5[_0x631b('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2414c5[_0x631b('0x1f')]?_0x2414c5[_0x631b('0x1f')][_0x631b('0x20')]||null:null,'attributes':_0x2414c5['options']?_0x2414c5[_0x631b('0x1f')][_0x631b('0x21')]||null:null,'limit':_0x2414c5[_0x631b('0x1f')]?_0x2414c5[_0x631b('0x1f')][_0x631b('0x22')]||null:null,'include':_0x2414c5[_0x631b('0x1f')]?_0x2414c5[_0x631b('0x1f')][_0x631b('0x23')]?_['map'](_0x2414c5[_0x631b('0x1f')][_0x631b('0x23')],function(_0x1509f7){return{'model':db[_0x1509f7[_0x631b('0x24')]],'as':_0x1509f7['as'],'attributes':_0x1509f7[_0x631b('0x21')],'include':_0x1509f7[_0x631b('0x23')]?_[_0x631b('0x25')](_0x1509f7[_0x631b('0x23')],function(_0x4e5ea0){return{'model':db[_0x4e5ea0[_0x631b('0x24')]],'as':_0x4e5ea0['as'],'attributes':_0x4e5ea0[_0x631b('0x21')],'include':_0x4e5ea0[_0x631b('0x23')]?_[_0x631b('0x25')](_0x4e5ea0[_0x631b('0x23')],function(_0x5c29df){return{'model':db[_0x5c29df['model']],'as':_0x5c29df['as'],'attributes':_0x5c29df[_0x631b('0x21')]};}):[]};}):[]};}):[]:[]})[_0x631b('0x10')](function(_0x584144){logger[_0x631b('0x19')](_0x631b('0x1c'),_0x2414c5);logger[_0x631b('0x13')](_0x631b('0x1c'),_0x2414c5,JSON[_0x631b('0x15')](_0x584144));_0x211e48(_0x584144);})['catch'](function(_0x1f9f7b){logger[_0x631b('0x16')](_0x631b('0x1c'),_0x1f9f7b[_0x631b('0x18')],_0x2414c5);_0x5d8042(_0x26a3af[_0x631b('0x16')](0x1f4,_0x1f9f7b[_0x631b('0x18')]));});});};exports['CreateVoiceQueueReport']=function(_0x4c1822){var _0x1b0404=this;return new Promise(function(_0x5e5a31,_0xa30918){return db['VoiceQueueReport'][_0x631b('0x26')](_0x4c1822[_0x631b('0x27')],{'raw':_0x4c1822['options']?_0x4c1822[_0x631b('0x1f')][_0x631b('0x28')]===undefined?!![]:![]:!![]})[_0x631b('0x10')](function(_0x9c4551){logger['info']('CreateVoiceQueueReport',_0x4c1822);logger['debug'](_0x631b('0x29'),_0x4c1822,JSON[_0x631b('0x15')](_0x9c4551));_0x5e5a31(_0x9c4551);})[_0x631b('0x1b')](function(_0xe9f318){logger[_0x631b('0x16')](_0x631b('0x29'),_0xe9f318[_0x631b('0x18')],_0x4c1822);_0xa30918(_0x1b0404[_0x631b('0x16')](0x1f4,_0xe9f318[_0x631b('0x18')]));});});};exports['UpdateVoiceQueueReport']=function(_0x23722a){var _0x42987d=this;return new Promise(function(_0x122c11,_0x241c6b){return db[_0x631b('0x1d')][_0x631b('0x2a')](_0x23722a['body'],{'raw':_0x23722a['options']?_0x23722a[_0x631b('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23722a['options']?_0x23722a[_0x631b('0x1f')][_0x631b('0x20')]||null:null,'attributes':_0x23722a[_0x631b('0x1f')]?_0x23722a[_0x631b('0x1f')][_0x631b('0x21')]||null:null,'limit':_0x23722a['options']?_0x23722a[_0x631b('0x1f')][_0x631b('0x22')]||null:null})[_0x631b('0x10')](function(_0x44f114){logger[_0x631b('0x19')](_0x631b('0x2b'),_0x23722a);logger[_0x631b('0x13')](_0x631b('0x2b'),_0x23722a,JSON['stringify'](_0x44f114));_0x122c11(_0x44f114);})['catch'](function(_0x131be2){logger[_0x631b('0x16')](_0x631b('0x2b'),_0x131be2[_0x631b('0x18')],_0x23722a);_0x241c6b(_0x42987d['error'](0x1f4,_0x131be2[_0x631b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 9a6a9b8..53cebd7 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 _0x0876=['length','./voiceQueueReport.events','save','emit','register'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0876,0xb5));var _0x6087=function(_0x380518,_0x43eae7){_0x380518=_0x380518-0x0;var _0x3ea4a2=_0x0876[_0x380518];return _0x3ea4a2;};'use strict';var VoiceQueueReportEvents=require(_0x6087('0x0'));var events=[_0x6087('0x1'),'remove','update'];function createListener(_0x52fb6c,_0x23cd67){return function(_0x27e1a0){_0x23cd67[_0x6087('0x2')](_0x52fb6c,_0x27e1a0);};}function removeListener(_0x554117,_0x307540){return function(){VoiceQueueReportEvents['removeListener'](_0x554117,_0x307540);};}exports[_0x6087('0x3')]=function(_0x5a5af5){for(var _0x56bcd0=0x0,_0x21d17a=events[_0x6087('0x4')];_0x56bcd0<_0x21d17a;_0x56bcd0++){var _0x1b9bb7=events[_0x56bcd0];var _0x485acf=createListener('voiceQueueReport:'+_0x1b9bb7,_0x5a5af5);VoiceQueueReportEvents['on'](_0x1b9bb7,_0x485acf);}}; \ No newline at end of file +var _0x3471=['voiceQueueReport:','./voiceQueueReport.events','save','update','emit','removeListener','length'];(function(_0x83b8ee,_0x2e97b0){var _0x26bf01=function(_0x571bbf){while(--_0x571bbf){_0x83b8ee['push'](_0x83b8ee['shift']());}};_0x26bf01(++_0x2e97b0);}(_0x3471,0x143));var _0x1347=function(_0x507661,_0x1564df){_0x507661=_0x507661-0x0;var _0x38fcc3=_0x3471[_0x507661];return _0x38fcc3;};'use strict';var VoiceQueueReportEvents=require(_0x1347('0x0'));var events=[_0x1347('0x1'),'remove',_0x1347('0x2')];function createListener(_0x2899ec,_0x5d7a68){return function(_0x5f3078){_0x5d7a68[_0x1347('0x3')](_0x2899ec,_0x5f3078);};}function removeListener(_0x487587,_0x26097e){return function(){VoiceQueueReportEvents[_0x1347('0x4')](_0x487587,_0x26097e);};}exports['register']=function(_0x1ad7d5){for(var _0x8ed533=0x0,_0x42e4dd=events[_0x1347('0x5')];_0x8ed533<_0x42e4dd;_0x8ed533++){var _0x1d1756=events[_0x8ed533];var _0x4965e1=createListener(_0x1347('0x6')+_0x1d1756,_0x1ad7d5);VoiceQueueReportEvents['on'](_0x1d1756,_0x4965e1);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index ba840d0..5fa94d6 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 _0xbebf=['../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5b0208,_0x58666d){var _0x5800b4=function(_0x21dfc5){while(--_0x21dfc5){_0x5b0208['push'](_0x5b0208['shift']());}};_0x5800b4(++_0x58666d);}(_0xbebf,0xf9));var _0xfbeb=function(_0x25dac1,_0x1575de){_0x25dac1=_0x25dac1-0x0;var _0x3691ea=_0xbebf[_0x25dac1];return _0x3691ea;};'use strict';var multer=require(_0xfbeb('0x0'));var util=require('util');var path=require(_0xfbeb('0x1'));var timeout=require(_0xfbeb('0x2'));var express=require(_0xfbeb('0x3'));var router=express[_0xfbeb('0x4')]();var auth=require(_0xfbeb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfbeb('0x6'));var controller=require(_0xfbeb('0x7'));router[_0xfbeb('0x8')]('/',auth[_0xfbeb('0x9')](),controller[_0xfbeb('0xa')]);router['get'](_0xfbeb('0xb'),auth[_0xfbeb('0x9')](),controller[_0xfbeb('0xc')]);router[_0xfbeb('0xd')]('/',auth[_0xfbeb('0x9')](),controller[_0xfbeb('0xe')]);router['put'](_0xfbeb('0xb'),auth[_0xfbeb('0x9')](),controller[_0xfbeb('0xf')]);router['delete'](_0xfbeb('0xb'),auth[_0xfbeb('0x9')](),controller[_0xfbeb('0x10')]);module['exports']=router; \ No newline at end of file +var _0x03c6=['post','create','put','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show'];(function(_0x5a25f2,_0x4178ef){var _0x5da3dd=function(_0x4012b4){while(--_0x4012b4){_0x5a25f2['push'](_0x5a25f2['shift']());}};_0x5da3dd(++_0x4178ef);}(_0x03c6,0x84));var _0x603c=function(_0x39e85c,_0x1e0894){_0x39e85c=_0x39e85c-0x0;var _0x3f9257=_0x03c6[_0x39e85c];return _0x3f9257;};'use strict';var multer=require('multer');var util=require(_0x603c('0x0'));var path=require(_0x603c('0x1'));var timeout=require(_0x603c('0x2'));var express=require('express');var router=express[_0x603c('0x3')]();var auth=require(_0x603c('0x4'));var interaction=require(_0x603c('0x5'));var config=require(_0x603c('0x6'));var controller=require(_0x603c('0x7'));router[_0x603c('0x8')]('/',auth[_0x603c('0x9')](),controller['index']);router[_0x603c('0x8')](_0x603c('0xa'),auth[_0x603c('0x9')](),controller[_0x603c('0xb')]);router[_0x603c('0xc')]('/',auth[_0x603c('0x9')](),controller[_0x603c('0xd')]);router[_0x603c('0xe')](_0x603c('0xa'),auth[_0x603c('0x9')](),controller[_0x603c('0xf')]);router['delete'](_0x603c('0xa'),auth['isAuthenticated'](),controller[_0x603c('0x10')]);module[_0x603c('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 e6cd6c7..ded8bde 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 _0xffcd=['YYYY-MM-DD\x20HH:mm:ss','STRING','DATE','format'];(function(_0x22358c,_0x454fdd){var _0x254350=function(_0x297aa7){while(--_0x297aa7){_0x22358c['push'](_0x22358c['shift']());}};_0x254350(++_0x454fdd);}(_0xffcd,0xd1));var _0xdffc=function(_0x2b1944,_0x47f074){_0x2b1944=_0x2b1944-0x0;var _0x3db94e=_0xffcd[_0x2b1944];return _0x3db94e;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0xdffc('0x0')]},'callid':{'type':Sequelize[_0xdffc('0x0')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xdffc('0x0')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xdffc('0x0')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xdffc('0x0')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xdffc('0x0')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xdffc('0x0')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xdffc('0x1')],'allowNull':![],'defaultValue':moment()[_0xdffc('0x2')](_0xdffc('0x3'))}}; \ No newline at end of file +var _0x55f1=['STRING','DATE','format','moment'];(function(_0x502e15,_0x49ff8f){var _0xadd0c4=function(_0xa1776){while(--_0xa1776){_0x502e15['push'](_0x502e15['shift']());}};_0xadd0c4(++_0x49ff8f);}(_0x55f1,0x163));var _0x155f=function(_0x474f67,_0x1580cf){_0x474f67=_0x474f67-0x0;var _0x3f5702=_0x55f1[_0x474f67];return _0x3f5702;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x155f('0x0'));module['exports']={'time':{'type':Sequelize[_0x155f('0x1')]},'callid':{'type':Sequelize[_0x155f('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x155f('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x155f('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x155f('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x155f('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x155f('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x155f('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x155f('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x155f('0x2')],'allowNull':![],'defaultValue':moment()[_0x155f('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 a284368..a0a7b11 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 _0x8d3b=['destroy','then','error','stack','name','map','VoiceQueuesLog','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','include','findAll','catch','params','includeAll','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0x247f65,_0xed3ce7){var _0x213ae5=function(_0x20f457){while(--_0x20f457){_0x247f65['push'](_0x247f65['shift']());}};_0x213ae5(++_0xed3ce7);}(_0x8d3b,0x1bf));var _0xb8d3=function(_0x2ca692,_0x9988b9){_0x2ca692=_0x2ca692-0x0;var _0x4ce215=_0x8d3b[_0x2ca692];return _0x4ce215;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb8d3('0x0'));var rimraf=require(_0xb8d3('0x1'));var zipdir=require(_0xb8d3('0x2'));var jsonpatch=require(_0xb8d3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb8d3('0x4'));var util=require(_0xb8d3('0x5'));var path=require(_0xb8d3('0x6'));var sox=require(_0xb8d3('0x7'));var csv=require('to-csv');var ejs=require(_0xb8d3('0x8'));var fs=require('fs');var _=require(_0xb8d3('0x9'));var squel=require(_0xb8d3('0xa'));var crypto=require(_0xb8d3('0xb'));var jsforce=require(_0xb8d3('0xc'));var deskjs=require(_0xb8d3('0xd'));var toCsv=require(_0xb8d3('0xe'));var querystring=require(_0xb8d3('0xf'));var Papa=require(_0xb8d3('0x10'));var Redis=require(_0xb8d3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb8d3('0x12'));var hardwareService=require(_0xb8d3('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb8d3('0x14'));var config=require(_0xb8d3('0x15'));var db=require(_0xb8d3('0x16'))['db'];function respondWithStatusCode(_0x13e47c,_0x4b06e6){_0x4b06e6=_0x4b06e6||0xcc;return function(_0x364b83){if(_0x364b83){return _0x13e47c[_0xb8d3('0x17')](_0x4b06e6);}return _0x13e47c[_0xb8d3('0x18')](_0x4b06e6)[_0xb8d3('0x19')]();};}function respondWithResult(_0x236c1d,_0x5a0d52){_0x5a0d52=_0x5a0d52||0xc8;return function(_0x5f342f){if(_0x5f342f){return _0x236c1d[_0xb8d3('0x18')](_0x5a0d52)[_0xb8d3('0x1a')](_0x5f342f);}};}function respondWithFilteredResult(_0x21c07b,_0x1aaea2){return function(_0x51205a){if(_0x51205a){var _0x2494d8=_0x51205a[_0xb8d3('0x1b')],_0x369583=_0x1aaea2[_0xb8d3('0x1c')],_0xdae577=_0x1aaea2[_0xb8d3('0x1c')]+_0x1aaea2[_0xb8d3('0x1d')],_0x7cdbef;if(_0xdae577>=_0x2494d8){_0xdae577=_0x2494d8;_0x7cdbef=0xc8;}else{_0x7cdbef=0xce;}_0x21c07b['status'](_0x7cdbef);return _0x21c07b[_0xb8d3('0x1e')](_0xb8d3('0x1f'),_0x369583+'-'+_0xdae577+'/'+_0x2494d8)[_0xb8d3('0x1a')](_0x51205a);}return null;};}function patchUpdates(_0xf06504){return function(_0x476b29){try{jsonpatch[_0xb8d3('0x20')](_0x476b29,_0xf06504,!![]);}catch(_0x15f731){return BPromise[_0xb8d3('0x21')](_0x15f731);}return _0x476b29[_0xb8d3('0x22')]();};}function saveUpdates(_0x42db44,_0x351481){return function(_0x3aa40b){if(_0x3aa40b){return _0x3aa40b[_0xb8d3('0x23')](_0x42db44)['then'](function(_0x35833a){return _0x35833a;});}return null;};}function removeEntity(_0x403483,_0x3bd74b){return function(_0xb84421){if(_0xb84421){return _0xb84421[_0xb8d3('0x24')]()[_0xb8d3('0x25')](function(){_0x403483[_0xb8d3('0x18')](0xcc)[_0xb8d3('0x19')]();});}};}function handleEntityNotFound(_0x517f14,_0x35d3ab){return function(_0x3debc5){if(!_0x3debc5){_0x517f14[_0xb8d3('0x17')](0x194);}return _0x3debc5;};}function handleError(_0x4b0e76,_0x561172){_0x561172=_0x561172||0x1f4;return function(_0x174d24){logger[_0xb8d3('0x26')](_0x174d24[_0xb8d3('0x27')]);if(_0x174d24['name']){delete _0x174d24[_0xb8d3('0x28')];}_0x4b0e76[_0xb8d3('0x18')](_0x561172)['send'](_0x174d24);};}exports['index']=function(_0x17f8ef,_0x3ac481){var _0xeeab7e={},_0x351ff0={},_0x3601de={'count':0x0,'rows':[]};var _0xc9f0a6=_[_0xb8d3('0x29')](db[_0xb8d3('0x2a')][_0xb8d3('0x2b')],function(_0x4853b2){return{'name':_0x4853b2['fieldName'],'type':_0x4853b2[_0xb8d3('0x2c')]['key']};});_0x351ff0[_0xb8d3('0x2d')]=_[_0xb8d3('0x29')](_0xc9f0a6,_0xb8d3('0x28'));_0x351ff0[_0xb8d3('0x2e')]=_[_0xb8d3('0x2f')](_0x17f8ef[_0xb8d3('0x2e')]);_0x351ff0[_0xb8d3('0x30')]=_['intersection'](_0x351ff0[_0xb8d3('0x2d')],_0x351ff0[_0xb8d3('0x2e')]);_0xeeab7e[_0xb8d3('0x31')]=_[_0xb8d3('0x32')](_0x351ff0[_0xb8d3('0x2d')],qs[_0xb8d3('0x33')](_0x17f8ef[_0xb8d3('0x2e')]['fields']));_0xeeab7e['attributes']=_0xeeab7e['attributes'][_0xb8d3('0x34')]?_0xeeab7e['attributes']:_0x351ff0[_0xb8d3('0x2d')];if(!_0x17f8ef[_0xb8d3('0x2e')]['hasOwnProperty'](_0xb8d3('0x35'))){_0xeeab7e[_0xb8d3('0x1d')]=qs['limit'](_0x17f8ef[_0xb8d3('0x2e')][_0xb8d3('0x1d')]);_0xeeab7e[_0xb8d3('0x1c')]=qs['offset'](_0x17f8ef[_0xb8d3('0x2e')][_0xb8d3('0x1c')]);}_0xeeab7e[_0xb8d3('0x36')]=qs[_0xb8d3('0x37')](_0x17f8ef[_0xb8d3('0x2e')][_0xb8d3('0x37')]);_0xeeab7e[_0xb8d3('0x38')]=qs[_0xb8d3('0x30')](_[_0xb8d3('0x39')](_0x17f8ef[_0xb8d3('0x2e')],_0x351ff0[_0xb8d3('0x30')]));if(_0x17f8ef[_0xb8d3('0x2e')][_0xb8d3('0x3a')]){_0xeeab7e['where']=_[_0xb8d3('0x3b')](_0xeeab7e[_0xb8d3('0x38')],{'$or':_['map'](_0xc9f0a6,function(_0x569a63){if(_0x569a63[_0xb8d3('0x2c')]!=='VIRTUAL'){var _0x51fcb0={};_0x51fcb0[_0x569a63['name']]={'$like':'%'+_0x17f8ef['query']['filter']+'%'};return _0x51fcb0;}})});}_0xeeab7e=_['merge']({},_0xeeab7e,_0x17f8ef['options']);var _0x529d18={'where':_0xeeab7e[_0xb8d3('0x38')]};return db['VoiceQueuesLog']['count'](_0x529d18)[_0xb8d3('0x25')](function(_0x589050){_0x3601de['count']=_0x589050;if(_0x17f8ef[_0xb8d3('0x2e')]['includeAll']){_0xeeab7e[_0xb8d3('0x3c')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xb8d3('0x3d')](_0xeeab7e);})[_0xb8d3('0x25')](function(_0x484a4f){_0x3601de['rows']=_0x484a4f;return _0x3601de;})['then'](respondWithFilteredResult(_0x3ac481,_0xeeab7e))[_0xb8d3('0x3e')](handleError(_0x3ac481,null));};exports['show']=function(_0xd25289,_0x34e726){var _0x4db76a={'raw':!![],'where':{'id':_0xd25289[_0xb8d3('0x3f')]['id']}},_0x18b6df={};_0x18b6df['model']=_[_0xb8d3('0x2f')](db[_0xb8d3('0x2a')][_0xb8d3('0x2b')]);_0x18b6df[_0xb8d3('0x2e')]=_['keys'](_0xd25289[_0xb8d3('0x2e')]);_0x18b6df[_0xb8d3('0x30')]=_['intersection'](_0x18b6df[_0xb8d3('0x2d')],_0x18b6df[_0xb8d3('0x2e')]);_0x4db76a[_0xb8d3('0x31')]=_['intersection'](_0x18b6df['model'],qs[_0xb8d3('0x33')](_0xd25289['query']['fields']));_0x4db76a[_0xb8d3('0x31')]=_0x4db76a[_0xb8d3('0x31')][_0xb8d3('0x34')]?_0x4db76a[_0xb8d3('0x31')]:_0x18b6df[_0xb8d3('0x2d')];if(_0xd25289['query'][_0xb8d3('0x40')]){_0x4db76a[_0xb8d3('0x3c')]=[{'all':!![]}];}_0x4db76a=_[_0xb8d3('0x3b')]({},_0x4db76a,_0xd25289[_0xb8d3('0x41')]);return db['VoiceQueuesLog'][_0xb8d3('0x42')](_0x4db76a)[_0xb8d3('0x25')](handleEntityNotFound(_0x34e726,null))[_0xb8d3('0x25')](respondWithResult(_0x34e726,null))[_0xb8d3('0x3e')](handleError(_0x34e726,null));};exports[_0xb8d3('0x43')]=function(_0x263818,_0x365d5d){return db[_0xb8d3('0x2a')][_0xb8d3('0x43')](_0x263818[_0xb8d3('0x44')],{})[_0xb8d3('0x25')](respondWithResult(_0x365d5d,0xc9))[_0xb8d3('0x3e')](handleError(_0x365d5d,null));};exports[_0xb8d3('0x23')]=function(_0x204487,_0x45e47f){if(_0x204487[_0xb8d3('0x44')]['id']){delete _0x204487[_0xb8d3('0x44')]['id'];}return db[_0xb8d3('0x2a')][_0xb8d3('0x42')]({'where':{'id':_0x204487['params']['id']}})[_0xb8d3('0x25')](handleEntityNotFound(_0x45e47f,null))[_0xb8d3('0x25')](saveUpdates(_0x204487[_0xb8d3('0x44')],null))[_0xb8d3('0x25')](respondWithResult(_0x45e47f,null))[_0xb8d3('0x3e')](handleError(_0x45e47f,null));};exports[_0xb8d3('0x24')]=function(_0x146183,_0x1102f1){return db[_0xb8d3('0x2a')]['find']({'where':{'id':_0x146183[_0xb8d3('0x3f')]['id']}})[_0xb8d3('0x25')](handleEntityNotFound(_0x1102f1,null))[_0xb8d3('0x25')](removeEntity(_0x1102f1,null))['catch'](handleError(_0x1102f1,null));}; \ No newline at end of file +var _0xff10=['findAll','rows','catch','show','params','rawAttributes','options','create','body','destroy','find','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','error','stack','name','index','map','VoiceQueuesLog','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include'];(function(_0x53f04f,_0x419aa8){var _0x16a824=function(_0x5712c9){while(--_0x5712c9){_0x53f04f['push'](_0x53f04f['shift']());}};_0x16a824(++_0x419aa8);}(_0xff10,0xec));var _0x0ff1=function(_0x5045c0,_0x20fd77){_0x5045c0=_0x5045c0-0x0;var _0x4e769d=_0xff10[_0x5045c0];return _0x4e769d;};'use strict';var pdf=require(_0x0ff1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0ff1('0x1'));var zipdir=require(_0x0ff1('0x2'));var jsonpatch=require(_0x0ff1('0x3'));var rp=require('request-promise');var moment=require(_0x0ff1('0x4'));var BPromise=require(_0x0ff1('0x5'));var Mustache=require(_0x0ff1('0x6'));var util=require(_0x0ff1('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x0ff1('0x8'));var ejs=require(_0x0ff1('0x9'));var fs=require('fs');var _=require(_0x0ff1('0xa'));var squel=require(_0x0ff1('0xb'));var crypto=require(_0x0ff1('0xc'));var jsforce=require(_0x0ff1('0xd'));var deskjs=require(_0x0ff1('0xe'));var toCsv=require(_0x0ff1('0x8'));var querystring=require(_0x0ff1('0xf'));var Papa=require(_0x0ff1('0x10'));var Redis=require(_0x0ff1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0ff1('0x12'));var as=require(_0x0ff1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ff1('0x14'))(_0x0ff1('0x15'));var utils=require(_0x0ff1('0x16'));var config=require('../../config/environment');var db=require(_0x0ff1('0x17'))['db'];function respondWithStatusCode(_0x27c1e8,_0x24e7e4){_0x24e7e4=_0x24e7e4||0xcc;return function(_0x4cc2a2){if(_0x4cc2a2){return _0x27c1e8[_0x0ff1('0x18')](_0x24e7e4);}return _0x27c1e8[_0x0ff1('0x19')](_0x24e7e4)[_0x0ff1('0x1a')]();};}function respondWithResult(_0x409c45,_0x24d941){_0x24d941=_0x24d941||0xc8;return function(_0x3b6bb3){if(_0x3b6bb3){return _0x409c45[_0x0ff1('0x19')](_0x24d941)[_0x0ff1('0x1b')](_0x3b6bb3);}};}function respondWithFilteredResult(_0x32c741,_0x360f8c){return function(_0x304c07){if(_0x304c07){var _0x25186e=_0x304c07[_0x0ff1('0x1c')],_0x3ca224=_0x360f8c[_0x0ff1('0x1d')],_0x3bc67e=_0x360f8c[_0x0ff1('0x1d')]+_0x360f8c[_0x0ff1('0x1e')],_0xbeaca1;if(_0x3bc67e>=_0x25186e){_0x3bc67e=_0x25186e;_0xbeaca1=0xc8;}else{_0xbeaca1=0xce;}_0x32c741[_0x0ff1('0x19')](_0xbeaca1);return _0x32c741['set'](_0x0ff1('0x1f'),_0x3ca224+'-'+_0x3bc67e+'/'+_0x25186e)[_0x0ff1('0x1b')](_0x304c07);}return null;};}function patchUpdates(_0xb67dd2){return function(_0x2051a3){try{jsonpatch['apply'](_0x2051a3,_0xb67dd2,!![]);}catch(_0x390c9a){return BPromise[_0x0ff1('0x20')](_0x390c9a);}return _0x2051a3[_0x0ff1('0x21')]();};}function saveUpdates(_0xa0c849,_0x4d8644){return function(_0x4839db){if(_0x4839db){return _0x4839db[_0x0ff1('0x22')](_0xa0c849)[_0x0ff1('0x23')](function(_0x36baae){return _0x36baae;});}return null;};}function removeEntity(_0x4792f0,_0x522f32){return function(_0x30f5f8){if(_0x30f5f8){return _0x30f5f8['destroy']()[_0x0ff1('0x23')](function(){_0x4792f0['status'](0xcc)[_0x0ff1('0x1a')]();});}};}function handleEntityNotFound(_0x5a5831,_0x15b29b){return function(_0xc012ac){if(!_0xc012ac){_0x5a5831[_0x0ff1('0x18')](0x194);}return _0xc012ac;};}function handleError(_0x16ce78,_0x5bceec){_0x5bceec=_0x5bceec||0x1f4;return function(_0x565d0f){logger[_0x0ff1('0x24')](_0x565d0f[_0x0ff1('0x25')]);if(_0x565d0f['name']){delete _0x565d0f[_0x0ff1('0x26')];}_0x16ce78[_0x0ff1('0x19')](_0x5bceec)['send'](_0x565d0f);};}exports[_0x0ff1('0x27')]=function(_0x3c73d7,_0x7d771a){var _0x433d28={},_0x2c9960={},_0x58b5de={'count':0x0,'rows':[]};var _0x5148d4=_[_0x0ff1('0x28')](db[_0x0ff1('0x29')]['rawAttributes'],function(_0x3dcc08){return{'name':_0x3dcc08[_0x0ff1('0x2a')],'type':_0x3dcc08[_0x0ff1('0x2b')][_0x0ff1('0x2c')]};});_0x2c9960[_0x0ff1('0x2d')]=_[_0x0ff1('0x28')](_0x5148d4,'name');_0x2c9960[_0x0ff1('0x2e')]=_[_0x0ff1('0x2f')](_0x3c73d7[_0x0ff1('0x2e')]);_0x2c9960[_0x0ff1('0x30')]=_[_0x0ff1('0x31')](_0x2c9960[_0x0ff1('0x2d')],_0x2c9960[_0x0ff1('0x2e')]);_0x433d28[_0x0ff1('0x32')]=_[_0x0ff1('0x31')](_0x2c9960[_0x0ff1('0x2d')],qs[_0x0ff1('0x33')](_0x3c73d7[_0x0ff1('0x2e')][_0x0ff1('0x33')]));_0x433d28[_0x0ff1('0x32')]=_0x433d28[_0x0ff1('0x32')][_0x0ff1('0x34')]?_0x433d28[_0x0ff1('0x32')]:_0x2c9960[_0x0ff1('0x2d')];if(!_0x3c73d7[_0x0ff1('0x2e')][_0x0ff1('0x35')](_0x0ff1('0x36'))){_0x433d28[_0x0ff1('0x1e')]=qs['limit'](_0x3c73d7[_0x0ff1('0x2e')][_0x0ff1('0x1e')]);_0x433d28['offset']=qs[_0x0ff1('0x1d')](_0x3c73d7[_0x0ff1('0x2e')][_0x0ff1('0x1d')]);}_0x433d28[_0x0ff1('0x37')]=qs[_0x0ff1('0x38')](_0x3c73d7[_0x0ff1('0x2e')][_0x0ff1('0x38')]);_0x433d28['where']=qs[_0x0ff1('0x30')](_[_0x0ff1('0x39')](_0x3c73d7[_0x0ff1('0x2e')],_0x2c9960[_0x0ff1('0x30')]));if(_0x3c73d7[_0x0ff1('0x2e')][_0x0ff1('0x3a')]){_0x433d28[_0x0ff1('0x3b')]=_[_0x0ff1('0x3c')](_0x433d28[_0x0ff1('0x3b')],{'$or':_[_0x0ff1('0x28')](_0x5148d4,function(_0x550514){if(_0x550514[_0x0ff1('0x2b')]!==_0x0ff1('0x3d')){var _0x10fab0={};_0x10fab0[_0x550514[_0x0ff1('0x26')]]={'$like':'%'+_0x3c73d7[_0x0ff1('0x2e')]['filter']+'%'};return _0x10fab0;}})});}_0x433d28=_[_0x0ff1('0x3c')]({},_0x433d28,_0x3c73d7['options']);var _0x129cc5={'where':_0x433d28['where']};return db['VoiceQueuesLog'][_0x0ff1('0x1c')](_0x129cc5)[_0x0ff1('0x23')](function(_0x673738){_0x58b5de[_0x0ff1('0x1c')]=_0x673738;if(_0x3c73d7[_0x0ff1('0x2e')][_0x0ff1('0x3e')]){_0x433d28[_0x0ff1('0x3f')]=[{'all':!![]}];}return db[_0x0ff1('0x29')][_0x0ff1('0x40')](_0x433d28);})[_0x0ff1('0x23')](function(_0x3fabf4){_0x58b5de[_0x0ff1('0x41')]=_0x3fabf4;return _0x58b5de;})[_0x0ff1('0x23')](respondWithFilteredResult(_0x7d771a,_0x433d28))[_0x0ff1('0x42')](handleError(_0x7d771a,null));};exports[_0x0ff1('0x43')]=function(_0x52ff56,_0x2269bf){var _0x4fc430={'raw':!![],'where':{'id':_0x52ff56[_0x0ff1('0x44')]['id']}},_0x5a218b={};_0x5a218b[_0x0ff1('0x2d')]=_[_0x0ff1('0x2f')](db['VoiceQueuesLog'][_0x0ff1('0x45')]);_0x5a218b[_0x0ff1('0x2e')]=_[_0x0ff1('0x2f')](_0x52ff56[_0x0ff1('0x2e')]);_0x5a218b[_0x0ff1('0x30')]=_[_0x0ff1('0x31')](_0x5a218b[_0x0ff1('0x2d')],_0x5a218b['query']);_0x4fc430[_0x0ff1('0x32')]=_[_0x0ff1('0x31')](_0x5a218b[_0x0ff1('0x2d')],qs[_0x0ff1('0x33')](_0x52ff56[_0x0ff1('0x2e')][_0x0ff1('0x33')]));_0x4fc430[_0x0ff1('0x32')]=_0x4fc430[_0x0ff1('0x32')][_0x0ff1('0x34')]?_0x4fc430[_0x0ff1('0x32')]:_0x5a218b[_0x0ff1('0x2d')];if(_0x52ff56[_0x0ff1('0x2e')][_0x0ff1('0x3e')]){_0x4fc430[_0x0ff1('0x3f')]=[{'all':!![]}];}_0x4fc430=_[_0x0ff1('0x3c')]({},_0x4fc430,_0x52ff56[_0x0ff1('0x46')]);return db[_0x0ff1('0x29')]['find'](_0x4fc430)[_0x0ff1('0x23')](handleEntityNotFound(_0x2269bf,null))['then'](respondWithResult(_0x2269bf,null))[_0x0ff1('0x42')](handleError(_0x2269bf,null));};exports[_0x0ff1('0x47')]=function(_0x5570d5,_0x8f0c26){return db[_0x0ff1('0x29')][_0x0ff1('0x47')](_0x5570d5[_0x0ff1('0x48')],{})[_0x0ff1('0x23')](respondWithResult(_0x8f0c26,0xc9))[_0x0ff1('0x42')](handleError(_0x8f0c26,null));};exports[_0x0ff1('0x22')]=function(_0x1e848e,_0x3dd332){if(_0x1e848e[_0x0ff1('0x48')]['id']){delete _0x1e848e[_0x0ff1('0x48')]['id'];}return db['VoiceQueuesLog']['find']({'where':{'id':_0x1e848e[_0x0ff1('0x44')]['id']}})['then'](handleEntityNotFound(_0x3dd332,null))['then'](saveUpdates(_0x1e848e[_0x0ff1('0x48')],null))[_0x0ff1('0x23')](respondWithResult(_0x3dd332,null))['catch'](handleError(_0x3dd332,null));};exports[_0x0ff1('0x49')]=function(_0x4c2729,_0x444901){return db[_0x0ff1('0x29')][_0x0ff1('0x4a')]({'where':{'id':_0x4c2729[_0x0ff1('0x44')]['id']}})[_0x0ff1('0x23')](handleEntityNotFound(_0x444901,null))['then'](removeEntity(_0x444901,null))['catch'](handleError(_0x444901,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 0dc4b87..af11814 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 _0x2aea=['voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','bluebird','path','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog'];(function(_0x107da6,_0x16ed29){var _0x3f2f21=function(_0x3b356d){while(--_0x3b356d){_0x107da6['push'](_0x107da6['shift']());}};_0x3f2f21(++_0x16ed29);}(_0x2aea,0x17e));var _0xa2ae=function(_0x16a223,_0x31b6e8){_0x16a223=_0x16a223-0x0;var _0x5ded66=_0x2aea[_0x16a223];return _0x5ded66;};'use strict';var _=require(_0xa2ae('0x0'));var util=require(_0xa2ae('0x1'));var logger=require(_0xa2ae('0x2'))(_0xa2ae('0x3'));var moment=require('moment');var BPromise=require(_0xa2ae('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2ae('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa2ae('0x6'));module[_0xa2ae('0x7')]=function(_0x26a0cd,_0x1f427a){return _0x26a0cd[_0xa2ae('0x8')](_0xa2ae('0x9'),attributes,{'tableName':_0xa2ae('0xa'),'paranoid':![],'indexes':[{'name':_0xa2ae('0xb'),'fields':[_0xa2ae('0xc'),_0xa2ae('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xce54=['api','moment','request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','event','dtm','lodash','../../config/logger'];(function(_0xe42761,_0x171d63){var _0x3aa1bf=function(_0x38c834){while(--_0x38c834){_0xe42761['push'](_0xe42761['shift']());}};_0x3aa1bf(++_0x171d63);}(_0xce54,0x14e));var _0x4ce5=function(_0x1af41d,_0xfb56ea){_0x1af41d=_0x1af41d-0x0;var _0x4a2229=_0xce54[_0x1af41d];return _0x4a2229;};'use strict';var _=require(_0x4ce5('0x0'));var util=require('util');var logger=require(_0x4ce5('0x1'))(_0x4ce5('0x2'));var moment=require(_0x4ce5('0x3'));var BPromise=require('bluebird');var rp=require(_0x4ce5('0x4'));var fs=require('fs');var path=require(_0x4ce5('0x5'));var rimraf=require(_0x4ce5('0x6'));var config=require('../../config/environment');var attributes=require(_0x4ce5('0x7'));module[_0x4ce5('0x8')]=function(_0x40cd59,_0x11462f){return _0x40cd59[_0x4ce5('0x9')](_0x4ce5('0xa'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x4ce5('0xb'),'fields':[_0x4ce5('0xc'),_0x4ce5('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index dec87e6..3c2915c 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa478=['http','then','info','request\x20sent','debug','error','code','message','VoiceQueuesLog,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x9db5d3,_0x4eea5e){var _0x477a81=function(_0x28e774){while(--_0x28e774){_0x9db5d3['push'](_0x9db5d3['shift']());}};_0x477a81(++_0x4eea5e);}(_0xa478,0x136));var _0x8a47=function(_0x28394f,_0x5ebdd2){_0x28394f=_0x28394f-0x0;var _0x2618d2=_0xa478[_0x28394f];return _0x2618d2;};'use strict';var _=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var moment=require(_0x8a47('0x2'));var BPromise=require(_0x8a47('0x3'));var rs=require(_0x8a47('0x4'));var fs=require('fs');var Redis=require(_0x8a47('0x5'));var db=require(_0x8a47('0x6'))['db'];var utils=require(_0x8a47('0x7'));var logger=require(_0x8a47('0x8'))(_0x8a47('0x9'));var config=require(_0x8a47('0xa'));var jayson=require(_0x8a47('0xb'));var client=jayson['client'][_0x8a47('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d62a6,_0x3de815,_0x3cb340){return new BPromise(function(_0x56884b,_0x384886){return client['request'](_0x2d62a6,_0x3cb340)[_0x8a47('0xd')](function(_0x369fc9){logger[_0x8a47('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3de815,_0x8a47('0xf'));logger[_0x8a47('0x10')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x3de815,_0x8a47('0xf'),JSON['stringify'](_0x369fc9));if(_0x369fc9[_0x8a47('0x11')]){if(_0x369fc9[_0x8a47('0x11')][_0x8a47('0x12')]===0x1f4){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x3de815,_0x369fc9['error'][_0x8a47('0x13')]);return _0x384886(_0x369fc9[_0x8a47('0x11')]['message']);}logger[_0x8a47('0x11')](_0x8a47('0x14'),_0x3de815,_0x369fc9[_0x8a47('0x11')][_0x8a47('0x13')]);return _0x56884b(_0x369fc9[_0x8a47('0x11')][_0x8a47('0x13')]);}else{logger[_0x8a47('0xe')](_0x8a47('0x14'),_0x3de815,_0x8a47('0xf'));_0x56884b(_0x369fc9[_0x8a47('0x15')][_0x8a47('0x13')]);}})[_0x8a47('0x16')](function(_0x2917d9){logger['error'](_0x8a47('0x14'),_0x3de815,_0x2917d9);_0x384886(_0x2917d9);});});} \ No newline at end of file +var _0x7d25=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','request','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment'];(function(_0x4abd08,_0x1a03d1){var _0xd926e6=function(_0x49ab35){while(--_0x49ab35){_0x4abd08['push'](_0x4abd08['shift']());}};_0xd926e6(++_0x1a03d1);}(_0x7d25,0x8a));var _0x57d2=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x7d25[_0x616290];return _0x453879;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var moment=require(_0x57d2('0x1'));var BPromise=require(_0x57d2('0x2'));var rs=require(_0x57d2('0x3'));var fs=require('fs');var Redis=require(_0x57d2('0x4'));var db=require(_0x57d2('0x5'))['db'];var utils=require(_0x57d2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x57d2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f43b2,_0x263d35,_0x147194){return new BPromise(function(_0x59ae87,_0x49e3e5){return client[_0x57d2('0x8')](_0x1f43b2,_0x147194)['then'](function(_0x3a1ec5){logger[_0x57d2('0x9')](_0x57d2('0xa'),_0x263d35,'request\x20sent');logger[_0x57d2('0xb')](_0x57d2('0xc'),_0x263d35,_0x57d2('0xd'),JSON[_0x57d2('0xe')](_0x3a1ec5));if(_0x3a1ec5[_0x57d2('0xf')]){if(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x10')]===0x1f4){logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);return _0x49e3e5(_0x3a1ec5[_0x57d2('0xf')][_0x57d2('0x11')]);}logger[_0x57d2('0xf')](_0x57d2('0xa'),_0x263d35,_0x3a1ec5[_0x57d2('0xf')]['message']);return _0x59ae87(_0x3a1ec5['error'][_0x57d2('0x11')]);}else{logger[_0x57d2('0x9')]('VoiceQueuesLog,\x20%s,\x20%s',_0x263d35,_0x57d2('0xd'));_0x59ae87(_0x3a1ec5[_0x57d2('0x12')]['message']);}})[_0x57d2('0x13')](function(_0x4986ad){logger[_0x57d2('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x263d35,_0x4986ad);_0x49e3e5(_0x4986ad);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 2624c7f..9c08a1c 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 _0x3a81=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','/:id/downloads','downloads','post','create','put','update','delete','exports','multer','util'];(function(_0x5b156d,_0x576cf6){var _0x3531ec=function(_0x81d6b5){while(--_0x81d6b5){_0x5b156d['push'](_0x5b156d['shift']());}};_0x3531ec(++_0x576cf6);}(_0x3a81,0x136));var _0x13a8=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x3a81[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x13a8('0x0'));var util=require(_0x13a8('0x1'));var path=require('path');var timeout=require(_0x13a8('0x2'));var express=require(_0x13a8('0x3'));var router=express[_0x13a8('0x4')]();var auth=require(_0x13a8('0x5'));var interaction=require(_0x13a8('0x6'));var config=require('../../config/environment');var controller=require(_0x13a8('0x7'));router[_0x13a8('0x8')]('/',auth[_0x13a8('0x9')](),controller[_0x13a8('0xa')]);router[_0x13a8('0x8')](_0x13a8('0xb'),auth[_0x13a8('0x9')](),controller[_0x13a8('0xc')]);router['get'](_0x13a8('0xd'),auth[_0x13a8('0x9')](),controller[_0x13a8('0xe')]);router[_0x13a8('0x8')](_0x13a8('0xf'),auth[_0x13a8('0x9')](),controller['download']);router[_0x13a8('0x8')](_0x13a8('0x10'),controller[_0x13a8('0x11')]);router[_0x13a8('0x12')]('/',auth[_0x13a8('0x9')](),controller[_0x13a8('0x13')]);router[_0x13a8('0x14')]('/:id',auth[_0x13a8('0x9')](),controller[_0x13a8('0x15')]);router[_0x13a8('0x16')](_0x13a8('0xd'),auth[_0x13a8('0x9')](),controller['destroy']);module[_0x13a8('0x17')]=router; \ No newline at end of file +var _0x3f58=['/:id/download','download','/:id/downloads','downloads','post','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x1a409e,_0x20682a){var _0x2b3734=function(_0x2daf69){while(--_0x2daf69){_0x1a409e['push'](_0x1a409e['shift']());}};_0x2b3734(++_0x20682a);}(_0x3f58,0x6e));var _0x83f5=function(_0x335dd2,_0x4ccec0){_0x335dd2=_0x335dd2-0x0;var _0x313ea7=_0x3f58[_0x335dd2];return _0x313ea7;};'use strict';var multer=require(_0x83f5('0x0'));var util=require(_0x83f5('0x1'));var path=require(_0x83f5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x83f5('0x3')]();var auth=require(_0x83f5('0x4'));var interaction=require(_0x83f5('0x5'));var config=require(_0x83f5('0x6'));var controller=require(_0x83f5('0x7'));router[_0x83f5('0x8')]('/',auth[_0x83f5('0x9')](),controller[_0x83f5('0xa')]);router[_0x83f5('0x8')](_0x83f5('0xb'),auth[_0x83f5('0x9')](),controller[_0x83f5('0xc')]);router[_0x83f5('0x8')](_0x83f5('0xd'),auth[_0x83f5('0x9')](),controller[_0x83f5('0xe')]);router[_0x83f5('0x8')](_0x83f5('0xf'),auth['isAuthenticated'](),controller[_0x83f5('0x10')]);router[_0x83f5('0x8')](_0x83f5('0x11'),controller[_0x83f5('0x12')]);router[_0x83f5('0x13')]('/',auth[_0x83f5('0x9')](),controller['create']);router[_0x83f5('0x14')](_0x83f5('0xd'),auth[_0x83f5('0x9')](),controller[_0x83f5('0x15')]);router[_0x83f5('0x16')](_0x83f5('0xd'),auth[_0x83f5('0x9')](),controller[_0x83f5('0x17')]);module[_0x83f5('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 93a1b78..04c624e 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 _0x9bee=['toString','updatedAt','sequelize','moment','path','exports','getDataValue','value','STRING','split','INTEGER','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm'];(function(_0x4c57c7,_0x3c7976){var _0x2563eb=function(_0x1994d0){while(--_0x1994d0){_0x4c57c7['push'](_0x4c57c7['shift']());}};_0x2563eb(++_0x3c7976);}(_0x9bee,0x110));var _0xe9be=function(_0x566c5a,_0x42e09c){_0x566c5a=_0x566c5a-0x0;var _0x3c4abe=_0x9bee[_0x566c5a];return _0x3c4abe;};'use strict';var Sequelize=require(_0xe9be('0x0'));var moment=require(_0xe9be('0x1'));var path=require(_0xe9be('0x2'));module[_0xe9be('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('value')?path['extname'](this[_0xe9be('0x4')](_0xe9be('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0xe9be('0x6')]},'channel':{'type':Sequelize[_0xe9be('0x6')],'set':function(_0x1a3413){if(_0x1a3413){this['setDataValue']('channel',_0x1a3413);this['setDataValue']('membername',_0x1a3413[_0xe9be('0x7')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xe9be('0x6')]},'calleridnum':{'type':Sequelize[_0xe9be('0x6')]},'calleridname':{'type':Sequelize[_0xe9be('0x6')]},'connectedlinenum':{'type':Sequelize[_0xe9be('0x6')]},'connectedlinename':{'type':Sequelize[_0xe9be('0x6')]},'accountcode':{'type':Sequelize[_0xe9be('0x6')]},'context':{'type':Sequelize[_0xe9be('0x6')]},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xe9be('0x6')]},'type':{'type':Sequelize[_0xe9be('0x6')]},'rating':{'type':Sequelize[_0xe9be('0x8')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xe9be('0x6')]},'userDisposition':{'type':Sequelize[_0xe9be('0x6')]},'createdAt':{'type':Sequelize[_0xe9be('0x9')],'get':function(){return moment(this[_0xe9be('0x4')](_0xe9be('0xa')))[_0xe9be('0xb')](_0xe9be('0xc'))[_0xe9be('0xd')]();}},'updatedAt':{'type':Sequelize[_0xe9be('0x9')],'get':function(){return moment(this['getDataValue'](_0xe9be('0xe')))['format']('MM-DD-YYYY\x20HH:mm')[_0xe9be('0xd')]();}}}; \ No newline at end of file +var _0x14e2=['createdAt','updatedAt','format','toString','sequelize','path','VIRTUAL','getDataValue','value','extname','STRING','channel','setDataValue','membername','split','INTEGER','DATE'];(function(_0x3d2478,_0x107a0a){var _0x1b874f=function(_0x52c5ed){while(--_0x52c5ed){_0x3d2478['push'](_0x3d2478['shift']());}};_0x1b874f(++_0x107a0a);}(_0x14e2,0xe1));var _0x214e=function(_0x2d2e85,_0x22faa9){_0x2d2e85=_0x2d2e85-0x0;var _0x3e9f5e=_0x14e2[_0x2d2e85];return _0x3e9f5e;};'use strict';var Sequelize=require(_0x214e('0x0'));var moment=require('moment');var path=require(_0x214e('0x1'));module['exports']={'format':{'type':Sequelize[_0x214e('0x2')],'get':function(){return this[_0x214e('0x3')](_0x214e('0x4'))?path[_0x214e('0x5')](this[_0x214e('0x3')](_0x214e('0x4'))):undefined;}},'uniqueid':{'type':Sequelize[_0x214e('0x6')]},'channel':{'type':Sequelize['STRING'],'set':function(_0x3cdbff){if(_0x3cdbff){this['setDataValue'](_0x214e('0x7'),_0x3cdbff);this[_0x214e('0x8')](_0x214e('0x9'),_0x3cdbff[_0x214e('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x214e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x214e('0x6')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x214e('0x6')]},'accountcode':{'type':Sequelize[_0x214e('0x6')]},'context':{'type':Sequelize[_0x214e('0x6')]},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x214e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0x214e('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x214e('0x6')]},'userDisposition':{'type':Sequelize[_0x214e('0x6')]},'createdAt':{'type':Sequelize[_0x214e('0xc')],'get':function(){return moment(this[_0x214e('0x3')](_0x214e('0xd')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize[_0x214e('0xc')],'get':function(){return moment(this['getDataValue'](_0x214e('0xe')))[_0x214e('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x214e('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index cf3ccae..e195793 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 _0xc0af=['hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','options','VoiceRecording','includeAll','include','rows','catch','show','params','length','find','create','body','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','token','$and','%s.cypher','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','differenceBy','format','query','keys','filters','intersection','model','fields','attributes'];(function(_0x10d2cd,_0x48316f){var _0x59594f=function(_0xa9764){while(--_0xa9764){_0x10d2cd['push'](_0x10d2cd['shift']());}};_0x59594f(++_0x48316f);}(_0xc0af,0x92));var _0xfc0a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc0af[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfc0a('0x0'));var rimraf=require(_0xfc0a('0x1'));var zipdir=require(_0xfc0a('0x2'));var jsonpatch=require(_0xfc0a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfc0a('0x4'));var util=require(_0xfc0a('0x5'));var path=require('path');var sox=require(_0xfc0a('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xfc0a('0x7'));var squel=require(_0xfc0a('0x8'));var crypto=require(_0xfc0a('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfc0a('0xa'));var querystring=require(_0xfc0a('0xb'));var Papa=require(_0xfc0a('0xc'));var Redis=require(_0xfc0a('0xd'));var authService=require(_0xfc0a('0xe'));var qs=require(_0xfc0a('0xf'));var as=require(_0xfc0a('0x10'));var hardwareService=require(_0xfc0a('0x11'));var logger=require(_0xfc0a('0x12'))(_0xfc0a('0x13'));var utils=require('../../config/utils');var config=require(_0xfc0a('0x14'));var db=require(_0xfc0a('0x15'))['db'];function respondWithStatusCode(_0x303514,_0x17e4ce){_0x17e4ce=_0x17e4ce||0xcc;return function(_0x1540fe){if(_0x1540fe){return _0x303514[_0xfc0a('0x16')](_0x17e4ce);}return _0x303514[_0xfc0a('0x17')](_0x17e4ce)[_0xfc0a('0x18')]();};}function respondWithResult(_0x144a8d,_0xf89a65){_0xf89a65=_0xf89a65||0xc8;return function(_0x117932){if(_0x117932){return _0x144a8d[_0xfc0a('0x17')](_0xf89a65)[_0xfc0a('0x19')](_0x117932);}};}function respondWithFilteredResult(_0x7a7a4e,_0x33c938){return function(_0x5e2e16){if(_0x5e2e16){var _0x1c54fe=_0x5e2e16[_0xfc0a('0x1a')],_0x29f8ce=_0x33c938[_0xfc0a('0x1b')],_0x579ab0=_0x33c938['offset']+_0x33c938['limit'],_0x38f523;if(_0x579ab0>=_0x1c54fe){_0x579ab0=_0x1c54fe;_0x38f523=0xc8;}else{_0x38f523=0xce;}_0x7a7a4e[_0xfc0a('0x17')](_0x38f523);return _0x7a7a4e[_0xfc0a('0x1c')]('Content-Range',_0x29f8ce+'-'+_0x579ab0+'/'+_0x1c54fe)[_0xfc0a('0x19')](_0x5e2e16);}return null;};}function patchUpdates(_0x2e941b){return function(_0x4a2893){try{jsonpatch['apply'](_0x4a2893,_0x2e941b,!![]);}catch(_0x3ac21c){return BPromise[_0xfc0a('0x1d')](_0x3ac21c);}return _0x4a2893['save']();};}function saveUpdates(_0x41bf50,_0x5cbb24){return function(_0x34c6d8){if(_0x34c6d8){return _0x34c6d8[_0xfc0a('0x1e')](_0x41bf50)[_0xfc0a('0x1f')](function(_0x5212ec){return _0x5212ec;});}return null;};}function removeEntity(_0x5d450e,_0x520099){return function(_0x3be0d4){if(_0x3be0d4){return _0x3be0d4[_0xfc0a('0x20')]()[_0xfc0a('0x1f')](function(){_0x5d450e[_0xfc0a('0x17')](0xcc)[_0xfc0a('0x18')]();});}};}function handleEntityNotFound(_0x4077f1,_0x1d914c){return function(_0x4bc74a){if(!_0x4bc74a){_0x4077f1[_0xfc0a('0x16')](0x194);}return _0x4bc74a;};}function handleError(_0x4fe330,_0x39aeef){_0x39aeef=_0x39aeef||0x1f4;return function(_0x492e7b){logger[_0xfc0a('0x21')](_0x492e7b[_0xfc0a('0x22')]);if(_0x492e7b[_0xfc0a('0x23')]){delete _0x492e7b[_0xfc0a('0x23')];}_0x4fe330[_0xfc0a('0x17')](_0x39aeef)[_0xfc0a('0x24')](_0x492e7b);};}exports[_0xfc0a('0x25')]=function(_0x2e8033,_0x11e63c){var _0x452097={},_0x5a2f97={},_0x389713={'count':0x0,'rows':[]};var _0x15aad7=_[_0xfc0a('0x26')](db['VoiceRecording'][_0xfc0a('0x27')],function(_0x3a3dd6){return{'name':_0x3a3dd6[_0xfc0a('0x28')],'type':_0x3a3dd6[_0xfc0a('0x29')][_0xfc0a('0x2a')]};});_0x5a2f97['model']=_[_0xfc0a('0x2b')](_['map'](_0x15aad7,'name'),[_0xfc0a('0x2c')]);_0x5a2f97[_0xfc0a('0x2d')]=_[_0xfc0a('0x2e')](_0x2e8033[_0xfc0a('0x2d')]);_0x5a2f97[_0xfc0a('0x2f')]=_[_0xfc0a('0x30')](_0x5a2f97[_0xfc0a('0x31')],_0x5a2f97[_0xfc0a('0x2d')]);_0x452097['attributes']=_[_0xfc0a('0x30')](_0x5a2f97[_0xfc0a('0x31')],qs[_0xfc0a('0x32')](_0x2e8033['query'][_0xfc0a('0x32')]));_0x452097[_0xfc0a('0x33')]=_0x452097['attributes']['length']?_0x452097[_0xfc0a('0x33')]:_0x5a2f97[_0xfc0a('0x31')];if(!_0x2e8033[_0xfc0a('0x2d')][_0xfc0a('0x34')](_0xfc0a('0x35'))){_0x452097[_0xfc0a('0x36')]=qs[_0xfc0a('0x36')](_0x2e8033[_0xfc0a('0x2d')][_0xfc0a('0x36')]);_0x452097[_0xfc0a('0x1b')]=qs[_0xfc0a('0x1b')](_0x2e8033[_0xfc0a('0x2d')]['offset']);}_0x452097[_0xfc0a('0x37')]=qs['sort'](_0x2e8033['query']['sort']);_0x452097[_0xfc0a('0x38')]=qs[_0xfc0a('0x2f')](_[_0xfc0a('0x39')](_0x2e8033[_0xfc0a('0x2d')],_0x5a2f97[_0xfc0a('0x2f')]));if(_0x2e8033['query'][_0xfc0a('0x3a')]){_0x452097['where']=_[_0xfc0a('0x3b')](_0x452097[_0xfc0a('0x38')],{'$or':_[_0xfc0a('0x26')](_0x15aad7,function(_0x3fb8c2){if(_0x3fb8c2[_0xfc0a('0x29')]!=='VIRTUAL'){var _0x56e4cf={};_0x56e4cf[_0x3fb8c2[_0xfc0a('0x23')]]={'$like':'%'+_0x2e8033[_0xfc0a('0x2d')][_0xfc0a('0x3a')]+'%'};return _0x56e4cf;}})});}_0x452097=_[_0xfc0a('0x3b')]({},_0x452097,_0x2e8033[_0xfc0a('0x3c')]);var _0xf9515b={'where':_0x452097[_0xfc0a('0x38')]};return db[_0xfc0a('0x3d')][_0xfc0a('0x1a')](_0xf9515b)[_0xfc0a('0x1f')](function(_0x31e633){_0x389713[_0xfc0a('0x1a')]=_0x31e633;if(_0x2e8033[_0xfc0a('0x2d')][_0xfc0a('0x3e')]){_0x452097[_0xfc0a('0x3f')]=[{'all':!![]}];}return db[_0xfc0a('0x3d')]['findAll'](_0x452097);})[_0xfc0a('0x1f')](function(_0x565c9b){_0x389713[_0xfc0a('0x40')]=_0x565c9b;return _0x389713;})['then'](respondWithFilteredResult(_0x11e63c,_0x452097))[_0xfc0a('0x41')](handleError(_0x11e63c,null));};exports[_0xfc0a('0x42')]=function(_0x1f422d,_0xac227){var _0x143fd1={'raw':![],'where':{'id':_0x1f422d[_0xfc0a('0x43')]['id']}},_0x56fa7b={};_0x56fa7b[_0xfc0a('0x31')]=_[_0xfc0a('0x2e')](db[_0xfc0a('0x3d')]['rawAttributes']);_0x56fa7b[_0xfc0a('0x2d')]=_[_0xfc0a('0x2e')](_0x1f422d['query']);_0x56fa7b[_0xfc0a('0x2f')]=_[_0xfc0a('0x30')](_0x56fa7b[_0xfc0a('0x31')],_0x56fa7b[_0xfc0a('0x2d')]);_0x143fd1['attributes']=_[_0xfc0a('0x30')](_0x56fa7b[_0xfc0a('0x31')],qs['fields'](_0x1f422d[_0xfc0a('0x2d')]['fields']));_0x143fd1[_0xfc0a('0x33')]=_0x143fd1['attributes'][_0xfc0a('0x44')]?_0x143fd1[_0xfc0a('0x33')]:_0x56fa7b['model'];if(_0x1f422d[_0xfc0a('0x2d')][_0xfc0a('0x3e')]){_0x143fd1[_0xfc0a('0x3f')]=[{'all':!![]}];}_0x143fd1=_['merge']({},_0x143fd1,_0x1f422d['options']);return db[_0xfc0a('0x3d')][_0xfc0a('0x45')](_0x143fd1)[_0xfc0a('0x1f')](handleEntityNotFound(_0xac227,null))[_0xfc0a('0x1f')](respondWithResult(_0xac227,null))['catch'](handleError(_0xac227,null));};exports[_0xfc0a('0x46')]=function(_0x27104c,_0x1bb5f2){return db[_0xfc0a('0x3d')][_0xfc0a('0x46')](_0x27104c[_0xfc0a('0x47')],{})['then'](respondWithResult(_0x1bb5f2,0xc9))['catch'](handleError(_0x1bb5f2,null));};exports[_0xfc0a('0x1e')]=function(_0x5102af,_0x60e687){if(_0x5102af[_0xfc0a('0x47')]['id']){delete _0x5102af[_0xfc0a('0x47')]['id'];}return db[_0xfc0a('0x3d')][_0xfc0a('0x45')]({'where':{'id':_0x5102af[_0xfc0a('0x43')]['id']}})[_0xfc0a('0x1f')](handleEntityNotFound(_0x60e687,null))['then'](saveUpdates(_0x5102af[_0xfc0a('0x47')],null))[_0xfc0a('0x1f')](respondWithResult(_0x60e687,null))[_0xfc0a('0x41')](handleError(_0x60e687,null));};exports['describe']=function(_0x26e464,_0x3947f9){return db[_0xfc0a('0x3d')][_0xfc0a('0x48')]()[_0xfc0a('0x1f')](respondWithResult(_0x3947f9,null))[_0xfc0a('0x41')](handleError(_0x3947f9,null));};exports[_0xfc0a('0x49')]=function(_0x34424e,_0x5eaea1,_0x26a551){var _0x49d68f=require(_0xfc0a('0x4a'));var _0x4c5676=![];var _0x2bb86c={};if(_0x34424e[_0xfc0a('0x2d')][_0xfc0a('0x29')]&&_0x34424e[_0xfc0a('0x2d')][_0xfc0a('0x29')]===_0xfc0a('0x4b')){_0x2bb86c['uniqueid']=_0x34424e[_0xfc0a('0x43')]['id'];}else{_0x2bb86c['id']=_0x34424e[_0xfc0a('0x43')]['id'];}return db[_0xfc0a('0x3d')][_0xfc0a('0x45')]({'where':_0x2bb86c,'attributes':['id',_0xfc0a('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x5eaea1,null))[_0xfc0a('0x1f')](function(_0x3e521a){if(_0x3e521a){var _0x5f25b6=_0x3e521a['value'];var _0x701877=util[_0xfc0a('0x2c')]('%s.cypher',_0x5f25b6);if(fs[_0xfc0a('0x4d')](_0x701877)){_0x4c5676=!![];return _0x49d68f[_0xfc0a('0x4e')](_0x701877,_0x5f25b6,config[_0xfc0a('0x4f')][_0xfc0a('0x50')])['then'](function(){return _0x3e521a;});}return _0x3e521a;}})[_0xfc0a('0x1f')](function(_0x34037f){if(_0x34037f){var _0x14546e=_0x34037f[_0xfc0a('0x4c')];if(!fs[_0xfc0a('0x4d')](_0x14546e)){throw new db[(_0xfc0a('0x51'))][(_0xfc0a('0x52'))](_0xfc0a('0x53'));}if(_0x34037f[_0xfc0a('0x54')]){return _0x5eaea1[_0xfc0a('0x49')](_0x14546e,_0x34037f['filename']+path[_0xfc0a('0x55')](_0x14546e),function(){if(_0x4c5676){fs[_0xfc0a('0x56')](_0x14546e);}});}else{return _0x5eaea1[_0xfc0a('0x49')](_0x14546e,function(_0x11a512){if(_0x4c5676){fs['unlink'](_0x14546e);}});}}})[_0xfc0a('0x41')](function(_0xcf5e0e){if(_0xcf5e0e[_0xfc0a('0x57')]===_0xfc0a('0x53')){_0x5eaea1[_0xfc0a('0x17')](0x194)[_0xfc0a('0x24')]('Not\x20found');}else{return handleError(_0x5eaea1,null);}});};exports[_0xfc0a('0x58')]=function(_0x1d6918,_0x598abe,_0x514958){var _0x4ccf8b=require('../../components/encryptor');var _0x450259=![];var _0x5826cb={'$and':[db['sequelize']['where'](db['sequelize']['fn']('MD5',db['sequelize']['col'](_0xfc0a('0x4b'))),_0x1d6918['query'][_0xfc0a('0x59')])]};if(_0x1d6918['query'][_0xfc0a('0x29')]&&_0x1d6918[_0xfc0a('0x2d')][_0xfc0a('0x29')]===_0xfc0a('0x4b')){_0x5826cb[_0xfc0a('0x5a')]['push']({'uniqueid':_0x1d6918['params']['id']});}else{_0x5826cb[_0xfc0a('0x5a')]['push']({'id':_0x1d6918[_0xfc0a('0x43')]['id']});}return db[_0xfc0a('0x3d')][_0xfc0a('0x45')]({'where':_0x5826cb,'attributes':['id',_0xfc0a('0x4c')],'raw':!![]})[_0xfc0a('0x1f')](handleEntityNotFound(_0x598abe,null))[_0xfc0a('0x1f')](function(_0x400cdd){if(_0x400cdd){var _0xbe437f=util[_0xfc0a('0x2c')](_0xfc0a('0x5b'),_0x400cdd['value']);if(fs[_0xfc0a('0x4d')](_0xbe437f)){_0x450259=!![];return _0x4ccf8b[_0xfc0a('0x4e')](_0xbe437f,_0x400cdd['value'],config[_0xfc0a('0x4f')][_0xfc0a('0x50')])[_0xfc0a('0x1f')](function(){return _0x400cdd;});}return _0x400cdd;}})[_0xfc0a('0x1f')](function(_0x92bde6){if(_0x92bde6){if(!fs[_0xfc0a('0x4d')](_0x92bde6[_0xfc0a('0x4c')])){throw new db[(_0xfc0a('0x51'))][(_0xfc0a('0x52'))]('VoiceRecording\x20not\x20found');}if(_0x92bde6[_0xfc0a('0x54')]){return _0x598abe['download'](_0x92bde6['value'],_0x92bde6[_0xfc0a('0x54')]+path[_0xfc0a('0x55')](_0x92bde6[_0xfc0a('0x4c')]),function(){if(_0x450259){fs[_0xfc0a('0x56')](_0x92bde6[_0xfc0a('0x4c')]);}});}else{return _0x598abe[_0xfc0a('0x49')](_0x92bde6[_0xfc0a('0x4c')],function(_0x20b902){if(_0x450259){fs[_0xfc0a('0x56')](_0x92bde6['value']);}});}}})[_0xfc0a('0x41')](handleError(_0x598abe,null));};exports[_0xfc0a('0x20')]=function(_0x1627ed,_0x204793){return db[_0xfc0a('0x3d')][_0xfc0a('0x45')]({'where':{'id':_0x1627ed[_0xfc0a('0x43')]['id']}})['then'](function(_0x5e2e12){if(!_0x5e2e12)throw new ReferenceError('Entity\x20not\x20found');return _0x5e2e12;})['then'](function(_0x2314e5){var _0x1182a8=_0x2314e5[_0xfc0a('0x4c')];logger[_0xfc0a('0x5c')](_0xfc0a('0x5d'),_0x1182a8);if(!_[_0xfc0a('0x5e')](_0x2314e5[_0xfc0a('0x4c')])&&fs['existsSync'](_0x1182a8)){logger[_0xfc0a('0x5c')](_0xfc0a('0x5f')+_0x1182a8+_0xfc0a('0x60'));fs[_0xfc0a('0x61')](_0x1182a8);}_0x1182a8=_0x1182a8+_0xfc0a('0x62');if(!_[_0xfc0a('0x5e')](_0x2314e5[_0xfc0a('0x4c')])&&fs[_0xfc0a('0x4d')](_0x1182a8)){logger[_0xfc0a('0x5c')](_0xfc0a('0x5f')+_0x1182a8+_0xfc0a('0x60'));fs['unlinkSync'](_0x1182a8);}return _0x2314e5;})[_0xfc0a('0x1f')](function(_0x3cda92){if(!_0x3cda92)throw new InternalError();return _0x3cda92[_0xfc0a('0x20')]();})[_0xfc0a('0x1f')](function(){_0x204793[_0xfc0a('0x17')](0xcc)[_0xfc0a('0x18')]();})['catch'](handleError(_0x204793,null));}; \ No newline at end of file +var _0xd4dd=['filter','options','count','includeAll','include','findAll','rows','catch','params','length','merge','find','create','body','describe','download','../../components/encryptor','uniqueid','%s.cypher','existsSync','decryptFile','secrets','recording','value','Sequelize','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','sequelize','MD5','col','$and','push','ValidationError','extname','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','set','reject','save','update','then','destroy','error','stack','name','send','index','VoiceRecording','rawAttributes','key','model','differenceBy','map','format','query','keys','filters','intersection','fields','attributes','hasOwnProperty','offset','order','sort','where','type','VIRTUAL'];(function(_0x219d87,_0x1cb6f7){var _0x22823d=function(_0x5357bf){while(--_0x5357bf){_0x219d87['push'](_0x219d87['shift']());}};_0x22823d(++_0x1cb6f7);}(_0xd4dd,0x175));var _0xdd4d=function(_0x27cff7,_0x464e16){_0x27cff7=_0x27cff7-0x0;var _0x375e12=_0xd4dd[_0x27cff7];return _0x375e12;};'use strict';var pdf=require(_0xdd4d('0x0'));var emlformat=require(_0xdd4d('0x1'));var rimraf=require(_0xdd4d('0x2'));var zipdir=require(_0xdd4d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd4d('0x4'));var moment=require(_0xdd4d('0x5'));var BPromise=require(_0xdd4d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdd4d('0x7'));var sox=require(_0xdd4d('0x8'));var csv=require(_0xdd4d('0x9'));var ejs=require(_0xdd4d('0xa'));var fs=require('fs');var _=require(_0xdd4d('0xb'));var squel=require(_0xdd4d('0xc'));var crypto=require(_0xdd4d('0xd'));var jsforce=require(_0xdd4d('0xe'));var deskjs=require(_0xdd4d('0xf'));var toCsv=require(_0xdd4d('0x9'));var querystring=require(_0xdd4d('0x10'));var Papa=require(_0xdd4d('0x11'));var Redis=require(_0xdd4d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xdd4d('0x13'));var as=require(_0xdd4d('0x14'));var hardwareService=require(_0xdd4d('0x15'));var logger=require(_0xdd4d('0x16'))(_0xdd4d('0x17'));var utils=require(_0xdd4d('0x18'));var config=require(_0xdd4d('0x19'));var db=require(_0xdd4d('0x1a'))['db'];function respondWithStatusCode(_0x52b5e3,_0x550ff0){_0x550ff0=_0x550ff0||0xcc;return function(_0x3b11fc){if(_0x3b11fc){return _0x52b5e3[_0xdd4d('0x1b')](_0x550ff0);}return _0x52b5e3[_0xdd4d('0x1c')](_0x550ff0)[_0xdd4d('0x1d')]();};}function respondWithResult(_0x22b961,_0x305d46){_0x305d46=_0x305d46||0xc8;return function(_0xff1d8f){if(_0xff1d8f){return _0x22b961['status'](_0x305d46)[_0xdd4d('0x1e')](_0xff1d8f);}};}function respondWithFilteredResult(_0x11d3c5,_0x37c40c){return function(_0x5d593f){if(_0x5d593f){var _0x26e899=_0x5d593f['count'],_0x30792d=_0x37c40c['offset'],_0x23a6c5=_0x37c40c['offset']+_0x37c40c[_0xdd4d('0x1f')],_0x481c21;if(_0x23a6c5>=_0x26e899){_0x23a6c5=_0x26e899;_0x481c21=0xc8;}else{_0x481c21=0xce;}_0x11d3c5['status'](_0x481c21);return _0x11d3c5[_0xdd4d('0x20')]('Content-Range',_0x30792d+'-'+_0x23a6c5+'/'+_0x26e899)['json'](_0x5d593f);}return null;};}function patchUpdates(_0xf059b8){return function(_0x293257){try{jsonpatch['apply'](_0x293257,_0xf059b8,!![]);}catch(_0xe665de){return BPromise[_0xdd4d('0x21')](_0xe665de);}return _0x293257[_0xdd4d('0x22')]();};}function saveUpdates(_0x288a9f,_0x25c1e0){return function(_0x269381){if(_0x269381){return _0x269381[_0xdd4d('0x23')](_0x288a9f)[_0xdd4d('0x24')](function(_0x24eceb){return _0x24eceb;});}return null;};}function removeEntity(_0x13b750,_0x4a3bd4){return function(_0x41215b){if(_0x41215b){return _0x41215b[_0xdd4d('0x25')]()['then'](function(){_0x13b750[_0xdd4d('0x1c')](0xcc)[_0xdd4d('0x1d')]();});}};}function handleEntityNotFound(_0x451172,_0x2b62ec){return function(_0x2c6330){if(!_0x2c6330){_0x451172[_0xdd4d('0x1b')](0x194);}return _0x2c6330;};}function handleError(_0x107570,_0x847270){_0x847270=_0x847270||0x1f4;return function(_0x35c084){logger[_0xdd4d('0x26')](_0x35c084[_0xdd4d('0x27')]);if(_0x35c084['name']){delete _0x35c084[_0xdd4d('0x28')];}_0x107570[_0xdd4d('0x1c')](_0x847270)[_0xdd4d('0x29')](_0x35c084);};}exports[_0xdd4d('0x2a')]=function(_0x380009,_0x99606f){var _0x5ba302={},_0x470baa={},_0x1ab0d5={'count':0x0,'rows':[]};var _0x5f362c=_['map'](db[_0xdd4d('0x2b')][_0xdd4d('0x2c')],function(_0x24038c){return{'name':_0x24038c['fieldName'],'type':_0x24038c['type'][_0xdd4d('0x2d')]};});_0x470baa[_0xdd4d('0x2e')]=_[_0xdd4d('0x2f')](_[_0xdd4d('0x30')](_0x5f362c,'name'),[_0xdd4d('0x31')]);_0x470baa[_0xdd4d('0x32')]=_[_0xdd4d('0x33')](_0x380009[_0xdd4d('0x32')]);_0x470baa[_0xdd4d('0x34')]=_[_0xdd4d('0x35')](_0x470baa[_0xdd4d('0x2e')],_0x470baa[_0xdd4d('0x32')]);_0x5ba302['attributes']=_[_0xdd4d('0x35')](_0x470baa[_0xdd4d('0x2e')],qs[_0xdd4d('0x36')](_0x380009[_0xdd4d('0x32')][_0xdd4d('0x36')]));_0x5ba302[_0xdd4d('0x37')]=_0x5ba302[_0xdd4d('0x37')]['length']?_0x5ba302[_0xdd4d('0x37')]:_0x470baa[_0xdd4d('0x2e')];if(!_0x380009[_0xdd4d('0x32')][_0xdd4d('0x38')]('nolimit')){_0x5ba302[_0xdd4d('0x1f')]=qs[_0xdd4d('0x1f')](_0x380009[_0xdd4d('0x32')][_0xdd4d('0x1f')]);_0x5ba302['offset']=qs[_0xdd4d('0x39')](_0x380009[_0xdd4d('0x32')][_0xdd4d('0x39')]);}_0x5ba302[_0xdd4d('0x3a')]=qs[_0xdd4d('0x3b')](_0x380009[_0xdd4d('0x32')][_0xdd4d('0x3b')]);_0x5ba302[_0xdd4d('0x3c')]=qs[_0xdd4d('0x34')](_['pick'](_0x380009[_0xdd4d('0x32')],_0x470baa[_0xdd4d('0x34')]));if(_0x380009['query']['filter']){_0x5ba302[_0xdd4d('0x3c')]=_['merge'](_0x5ba302['where'],{'$or':_['map'](_0x5f362c,function(_0x198bdb){if(_0x198bdb[_0xdd4d('0x3d')]!==_0xdd4d('0x3e')){var _0x37e5c2={};_0x37e5c2[_0x198bdb[_0xdd4d('0x28')]]={'$like':'%'+_0x380009['query'][_0xdd4d('0x3f')]+'%'};return _0x37e5c2;}})});}_0x5ba302=_['merge']({},_0x5ba302,_0x380009[_0xdd4d('0x40')]);var _0x52564b={'where':_0x5ba302[_0xdd4d('0x3c')]};return db[_0xdd4d('0x2b')][_0xdd4d('0x41')](_0x52564b)[_0xdd4d('0x24')](function(_0x5061c5){_0x1ab0d5['count']=_0x5061c5;if(_0x380009[_0xdd4d('0x32')][_0xdd4d('0x42')]){_0x5ba302[_0xdd4d('0x43')]=[{'all':!![]}];}return db[_0xdd4d('0x2b')][_0xdd4d('0x44')](_0x5ba302);})[_0xdd4d('0x24')](function(_0x4913cf){_0x1ab0d5[_0xdd4d('0x45')]=_0x4913cf;return _0x1ab0d5;})[_0xdd4d('0x24')](respondWithFilteredResult(_0x99606f,_0x5ba302))[_0xdd4d('0x46')](handleError(_0x99606f,null));};exports['show']=function(_0x49aea3,_0x5b4cf1){var _0x2e429f={'raw':![],'where':{'id':_0x49aea3[_0xdd4d('0x47')]['id']}},_0xff8225={};_0xff8225[_0xdd4d('0x2e')]=_['keys'](db[_0xdd4d('0x2b')]['rawAttributes']);_0xff8225[_0xdd4d('0x32')]=_[_0xdd4d('0x33')](_0x49aea3['query']);_0xff8225[_0xdd4d('0x34')]=_[_0xdd4d('0x35')](_0xff8225[_0xdd4d('0x2e')],_0xff8225[_0xdd4d('0x32')]);_0x2e429f['attributes']=_[_0xdd4d('0x35')](_0xff8225[_0xdd4d('0x2e')],qs[_0xdd4d('0x36')](_0x49aea3[_0xdd4d('0x32')][_0xdd4d('0x36')]));_0x2e429f[_0xdd4d('0x37')]=_0x2e429f[_0xdd4d('0x37')][_0xdd4d('0x48')]?_0x2e429f[_0xdd4d('0x37')]:_0xff8225[_0xdd4d('0x2e')];if(_0x49aea3[_0xdd4d('0x32')][_0xdd4d('0x42')]){_0x2e429f[_0xdd4d('0x43')]=[{'all':!![]}];}_0x2e429f=_[_0xdd4d('0x49')]({},_0x2e429f,_0x49aea3[_0xdd4d('0x40')]);return db[_0xdd4d('0x2b')][_0xdd4d('0x4a')](_0x2e429f)[_0xdd4d('0x24')](handleEntityNotFound(_0x5b4cf1,null))[_0xdd4d('0x24')](respondWithResult(_0x5b4cf1,null))[_0xdd4d('0x46')](handleError(_0x5b4cf1,null));};exports[_0xdd4d('0x4b')]=function(_0x3ba405,_0x39f377){return db[_0xdd4d('0x2b')]['create'](_0x3ba405[_0xdd4d('0x4c')],{})[_0xdd4d('0x24')](respondWithResult(_0x39f377,0xc9))['catch'](handleError(_0x39f377,null));};exports[_0xdd4d('0x23')]=function(_0x1037be,_0x1b76e9){if(_0x1037be[_0xdd4d('0x4c')]['id']){delete _0x1037be[_0xdd4d('0x4c')]['id'];}return db[_0xdd4d('0x2b')][_0xdd4d('0x4a')]({'where':{'id':_0x1037be[_0xdd4d('0x47')]['id']}})[_0xdd4d('0x24')](handleEntityNotFound(_0x1b76e9,null))[_0xdd4d('0x24')](saveUpdates(_0x1037be['body'],null))[_0xdd4d('0x24')](respondWithResult(_0x1b76e9,null))[_0xdd4d('0x46')](handleError(_0x1b76e9,null));};exports[_0xdd4d('0x4d')]=function(_0x1f0f8c,_0x5f7b40){return db[_0xdd4d('0x2b')][_0xdd4d('0x4d')]()[_0xdd4d('0x24')](respondWithResult(_0x5f7b40,null))[_0xdd4d('0x46')](handleError(_0x5f7b40,null));};exports[_0xdd4d('0x4e')]=function(_0x57508f,_0x53deec,_0x3fbc31){var _0x34fedb=require(_0xdd4d('0x4f'));var _0x3f61b5=![];var _0xa10550={};if(_0x57508f[_0xdd4d('0x32')][_0xdd4d('0x3d')]&&_0x57508f[_0xdd4d('0x32')][_0xdd4d('0x3d')]===_0xdd4d('0x50')){_0xa10550[_0xdd4d('0x50')]=_0x57508f['params']['id'];}else{_0xa10550['id']=_0x57508f[_0xdd4d('0x47')]['id'];}return db[_0xdd4d('0x2b')]['find']({'where':_0xa10550,'attributes':['id','value'],'raw':!![]})[_0xdd4d('0x24')](handleEntityNotFound(_0x53deec,null))[_0xdd4d('0x24')](function(_0x1c325b){if(_0x1c325b){var _0x55dadd=_0x1c325b['value'];var _0x2648a0=util[_0xdd4d('0x31')](_0xdd4d('0x51'),_0x55dadd);if(fs[_0xdd4d('0x52')](_0x2648a0)){_0x3f61b5=!![];return _0x34fedb[_0xdd4d('0x53')](_0x2648a0,_0x55dadd,config[_0xdd4d('0x54')][_0xdd4d('0x55')])['then'](function(){return _0x1c325b;});}return _0x1c325b;}})['then'](function(_0x99118d){if(_0x99118d){var _0x3aa5d9=_0x99118d[_0xdd4d('0x56')];if(!fs['existsSync'](_0x3aa5d9)){throw new db[(_0xdd4d('0x57'))]['ValidationError'](_0xdd4d('0x58'));}if(_0x99118d[_0xdd4d('0x59')]){return _0x53deec[_0xdd4d('0x4e')](_0x3aa5d9,_0x99118d['filename']+path['extname'](_0x3aa5d9),function(){if(_0x3f61b5){fs['unlink'](_0x3aa5d9);}});}else{return _0x53deec['download'](_0x3aa5d9,function(_0x2784ba){if(_0x3f61b5){fs[_0xdd4d('0x5a')](_0x3aa5d9);}});}}})['catch'](function(_0x5dcce4){if(_0x5dcce4[_0xdd4d('0x5b')]===_0xdd4d('0x58')){_0x53deec[_0xdd4d('0x1c')](0x194)[_0xdd4d('0x29')](_0xdd4d('0x5c'));}else{return handleError(_0x53deec,null);}});};exports[_0xdd4d('0x5d')]=function(_0x10bf3e,_0x4df036,_0x473605){var _0x1e4c06=require(_0xdd4d('0x4f'));var _0x11955b=![];var _0x5b1ee2={'$and':[db[_0xdd4d('0x5e')]['where'](db[_0xdd4d('0x5e')]['fn'](_0xdd4d('0x5f'),db['sequelize'][_0xdd4d('0x60')](_0xdd4d('0x50'))),_0x10bf3e['query']['token'])]};if(_0x10bf3e[_0xdd4d('0x32')][_0xdd4d('0x3d')]&&_0x10bf3e['query'][_0xdd4d('0x3d')]===_0xdd4d('0x50')){_0x5b1ee2[_0xdd4d('0x61')][_0xdd4d('0x62')]({'uniqueid':_0x10bf3e[_0xdd4d('0x47')]['id']});}else{_0x5b1ee2[_0xdd4d('0x61')]['push']({'id':_0x10bf3e['params']['id']});}return db[_0xdd4d('0x2b')][_0xdd4d('0x4a')]({'where':_0x5b1ee2,'attributes':['id','value'],'raw':!![]})[_0xdd4d('0x24')](handleEntityNotFound(_0x4df036,null))[_0xdd4d('0x24')](function(_0x43de30){if(_0x43de30){var _0xa69b4c=util[_0xdd4d('0x31')](_0xdd4d('0x51'),_0x43de30[_0xdd4d('0x56')]);if(fs[_0xdd4d('0x52')](_0xa69b4c)){_0x11955b=!![];return _0x1e4c06[_0xdd4d('0x53')](_0xa69b4c,_0x43de30['value'],config[_0xdd4d('0x54')]['recording'])[_0xdd4d('0x24')](function(){return _0x43de30;});}return _0x43de30;}})[_0xdd4d('0x24')](function(_0x4cba96){if(_0x4cba96){if(!fs[_0xdd4d('0x52')](_0x4cba96[_0xdd4d('0x56')])){throw new db[(_0xdd4d('0x57'))][(_0xdd4d('0x63'))](_0xdd4d('0x58'));}if(_0x4cba96[_0xdd4d('0x59')]){return _0x4df036['download'](_0x4cba96[_0xdd4d('0x56')],_0x4cba96[_0xdd4d('0x59')]+path[_0xdd4d('0x64')](_0x4cba96['value']),function(){if(_0x11955b){fs[_0xdd4d('0x5a')](_0x4cba96[_0xdd4d('0x56')]);}});}else{return _0x4df036[_0xdd4d('0x4e')](_0x4cba96[_0xdd4d('0x56')],function(_0x261680){if(_0x11955b){fs[_0xdd4d('0x5a')](_0x4cba96[_0xdd4d('0x56')]);}});}}})[_0xdd4d('0x46')](handleError(_0x4df036,null));};exports[_0xdd4d('0x25')]=function(_0x196c89,_0x1fc871){return db[_0xdd4d('0x2b')]['find']({'where':{'id':_0x196c89[_0xdd4d('0x47')]['id']}})[_0xdd4d('0x24')](function(_0x2032ef){if(!_0x2032ef)throw new ReferenceError(_0xdd4d('0x65'));return _0x2032ef;})[_0xdd4d('0x24')](function(_0x10da34){var _0x92ff54=_0x10da34[_0xdd4d('0x56')];logger['info'](_0xdd4d('0x66'),_0x92ff54);if(!_[_0xdd4d('0x67')](_0x10da34[_0xdd4d('0x56')])&&fs['existsSync'](_0x92ff54)){logger[_0xdd4d('0x68')](_0xdd4d('0x69')+_0x92ff54+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xdd4d('0x6a')](_0x92ff54);}_0x92ff54=_0x92ff54+_0xdd4d('0x6b');if(!_[_0xdd4d('0x67')](_0x10da34[_0xdd4d('0x56')])&&fs[_0xdd4d('0x52')](_0x92ff54)){logger[_0xdd4d('0x68')]('File:\x20\x22'+_0x92ff54+_0xdd4d('0x6c'));fs['unlinkSync'](_0x92ff54);}return _0x10da34;})[_0xdd4d('0x24')](function(_0x30eaf9){if(!_0x30eaf9)throw new InternalError();return _0x30eaf9['destroy']();})['then'](function(){_0x1fc871['status'](0xcc)[_0xdd4d('0x1d')]();})[_0xdd4d('0x46')](handleError(_0x1fc871,null));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index bea4d7a..b14cb75 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 _0x7f73=['uniqueid','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','voice_recordings'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x7f73,0x15f));var _0x37f7=function(_0x150778,_0x56cfff){_0x150778=_0x150778-0x0;var _0x48e522=_0x7f73[_0x150778];return _0x48e522;};'use strict';var _=require('lodash');var util=require(_0x37f7('0x0'));var logger=require(_0x37f7('0x1'))(_0x37f7('0x2'));var moment=require('moment');var BPromise=require(_0x37f7('0x3'));var rp=require(_0x37f7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x37f7('0x5'));var config=require(_0x37f7('0x6'));var attributes=require('./voiceRecording.attributes');module[_0x37f7('0x7')]=function(_0x76ad7b,_0x295b8f){return _0x76ad7b['define']('VoiceRecording',attributes,{'tableName':_0x37f7('0x8'),'paranoid':![],'indexes':[{'name':_0x37f7('0x9'),'fields':[_0x37f7('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb815=['api','moment','bluebird','request-promise','rimraf','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger'];(function(_0x563bad,_0x19d7a6){var _0x303852=function(_0x38075f){while(--_0x38075f){_0x563bad['push'](_0x563bad['shift']());}};_0x303852(++_0x19d7a6);}(_0xb815,0x10e));var _0x5b81=function(_0x39a387,_0x496459){_0x39a387=_0x39a387-0x0;var _0x4d9420=_0xb815[_0x39a387];return _0x4d9420;};'use strict';var _=require(_0x5b81('0x0'));var util=require(_0x5b81('0x1'));var logger=require(_0x5b81('0x2'))(_0x5b81('0x3'));var moment=require(_0x5b81('0x4'));var BPromise=require(_0x5b81('0x5'));var rp=require(_0x5b81('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5b81('0x7'));var config=require('../../config/environment');var attributes=require('./voiceRecording.attributes');module[_0x5b81('0x8')]=function(_0x2caac9,_0x278944){return _0x2caac9[_0x5b81('0x9')](_0x5b81('0xa'),attributes,{'tableName':_0x5b81('0xb'),'paranoid':![],'indexes':[{'name':_0x5b81('0xc'),'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 adab60a..cdcf04f 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(_0x47c39a,_0x165a5d){var _0x590928=function(_0x20f3a5){while(--_0x20f3a5){_0x47c39a['push'](_0x47c39a['shift']());}};_0x590928(++_0x165a5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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(_0x2ef16b,_0x4b612a){var _0x53a7eb=function(_0x58d59d){while(--_0x58d59d){_0x2ef16b['push'](_0x2ef16b['shift']());}};_0x53a7eb(++_0x4b612a);}(_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);});});}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 591c244..f5bd2e1 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 _0x7a54=['Router','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','show','update','/:id','exports','multer','util','path','express'];(function(_0x42937a,_0x1bc014){var _0xb374a3=function(_0x36f1ca){while(--_0x36f1ca){_0x42937a['push'](_0x42937a['shift']());}};_0xb374a3(++_0x1bc014);}(_0x7a54,0x106));var _0x47a5=function(_0x6f463e,_0x2bea73){_0x6f463e=_0x6f463e-0x0;var _0x42dab7=_0x7a54[_0x6f463e];return _0x42dab7;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/:id',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['post']('/',auth[_0x47a5('0x9')](),controller['create']);router['put']('/:id',auth[_0x47a5('0x9')](),controller[_0x47a5('0xb')]);router['delete'](_0x47a5('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x47a5('0xd')]=router; \ No newline at end of file +var _0xdbf5=['index','/:id','show','put','update','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated'];(function(_0x371f8d,_0x49b418){var _0x137c59=function(_0x51798e){while(--_0x51798e){_0x371f8d['push'](_0x371f8d['shift']());}};_0x137c59(++_0x49b418);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x2235ae,_0x212481){_0x2235ae=_0x2235ae-0x0;var _0x3c02c1=_0xdbf5[_0x2235ae];return _0x3c02c1;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var auth=require(_0x5dbf('0x3'));var interaction=require(_0x5dbf('0x4'));var config=require(_0x5dbf('0x5'));var controller=require(_0x5dbf('0x6'));router[_0x5dbf('0x7')]('/',auth[_0x5dbf('0x8')](),controller[_0x5dbf('0x9')]);router[_0x5dbf('0x7')](_0x5dbf('0xa'),auth[_0x5dbf('0x8')](),controller[_0x5dbf('0xb')]);router['post']('/',auth[_0x5dbf('0x8')](),controller['create']);router[_0x5dbf('0xc')](_0x5dbf('0xa'),auth[_0x5dbf('0x8')](),controller[_0x5dbf('0xd')]);router['delete'](_0x5dbf('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x5dbf('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index ef81117..9c7fa55 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 _0xbb5d=['STRING','ENUM','Yes','sequelize','moment','exports','blind','attended'];(function(_0x2822c7,_0x53e602){var _0x2f4209=function(_0x235add){while(--_0x235add){_0x2822c7['push'](_0x2822c7['shift']());}};_0x2f4209(++_0x53e602);}(_0xbb5d,0x1bb));var _0xdbb5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbb5d[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xdbb5('0x0'));var moment=require(_0xdbb5('0x1'));module[_0xdbb5('0x2')]={'type':{'type':Sequelize['ENUM'](_0xdbb5('0x3'),_0xdbb5('0x4'))},'result':{'type':Sequelize[_0xdbb5('0x5')]},'transfererchannel':{'type':Sequelize[_0xdbb5('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xdbb5('0x5')]},'transferercalleridname':{'type':Sequelize[_0xdbb5('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xdbb5('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xdbb5('0x5')]},'transferercontext':{'type':Sequelize[_0xdbb5('0x5')]},'transfererexten':{'type':Sequelize[_0xdbb5('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xdbb5('0x5')]},'transfereechannel':{'type':Sequelize[_0xdbb5('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xdbb5('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xdbb5('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xdbb5('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xdbb5('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xdbb5('0x5')]},'transfereecontext':{'type':Sequelize[_0xdbb5('0x5')]},'transfereeexten':{'type':Sequelize[_0xdbb5('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xdbb5('0x5')]},'isexternal':{'type':Sequelize[_0xdbb5('0x6')](_0xdbb5('0x7'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6017=['ENUM','blind','attended','STRING'];(function(_0x2a031d,_0x396202){var _0x510db2=function(_0x18626c){while(--_0x18626c){_0x2a031d['push'](_0x2a031d['shift']());}};_0x510db2(++_0x396202);}(_0x6017,0x7c));var _0x7601=function(_0x4b6805,_0x277f47){_0x4b6805=_0x4b6805-0x0;var _0x16ce97=_0x6017[_0x4b6805];return _0x16ce97;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x7601('0x0')](_0x7601('0x1'),_0x7601('0x2'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x7601('0x3')]},'transferercalleridnum':{'type':Sequelize[_0x7601('0x3')]},'transferercalleridname':{'type':Sequelize[_0x7601('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0x7601('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0x7601('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x7601('0x3')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x7601('0x3')]},'transfereechannel':{'type':Sequelize[_0x7601('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x7601('0x3')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x7601('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0x7601('0x3')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x7601('0x0')]('Yes','No')},'context':{'type':Sequelize[_0x7601('0x3')]},'extension':{'type':Sequelize[_0x7601('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 0a696c1..2933bce 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 _0xac4a=['set','apply','reject','save','update','destroy','then','sendStatus','error','send','index','map','VoiceTransferReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','keys','rawAttributes','find','create','params','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','count','offset','limit'];(function(_0x1146d7,_0xa4368d){var _0x3fb9b2=function(_0x3992db){while(--_0x3992db){_0x1146d7['push'](_0x1146d7['shift']());}};_0x3fb9b2(++_0xa4368d);}(_0xac4a,0x13f));var _0xaac4=function(_0x3b0e77,_0x2cd67f){_0x3b0e77=_0x3b0e77-0x0;var _0x15ab48=_0xac4a[_0x3b0e77];return _0x15ab48;};'use strict';var pdf=require(_0xaac4('0x0'));var emlformat=require(_0xaac4('0x1'));var rimraf=require(_0xaac4('0x2'));var zipdir=require(_0xaac4('0x3'));var jsonpatch=require(_0xaac4('0x4'));var rp=require(_0xaac4('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaac4('0x6'));var util=require(_0xaac4('0x7'));var path=require(_0xaac4('0x8'));var sox=require('sox');var csv=require(_0xaac4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2348c2,_0x2e2d02){_0x2e2d02=_0x2e2d02||0xcc;return function(_0x45e512){if(_0x45e512){return _0x2348c2['sendStatus'](_0x2e2d02);}return _0x2348c2[_0xaac4('0x14')](_0x2e2d02)[_0xaac4('0x15')]();};}function respondWithResult(_0x5bcacd,_0xf06b1d){_0xf06b1d=_0xf06b1d||0xc8;return function(_0x2b20d0){if(_0x2b20d0){return _0x5bcacd[_0xaac4('0x14')](_0xf06b1d)[_0xaac4('0x16')](_0x2b20d0);}};}function respondWithFilteredResult(_0x187624,_0x2fbeb7){return function(_0x31b7e5){if(_0x31b7e5){var _0x1df9ae=_0x31b7e5[_0xaac4('0x17')],_0x233278=_0x2fbeb7[_0xaac4('0x18')],_0xb8466e=_0x2fbeb7['offset']+_0x2fbeb7[_0xaac4('0x19')],_0x35bc32;if(_0xb8466e>=_0x1df9ae){_0xb8466e=_0x1df9ae;_0x35bc32=0xc8;}else{_0x35bc32=0xce;}_0x187624['status'](_0x35bc32);return _0x187624[_0xaac4('0x1a')]('Content-Range',_0x233278+'-'+_0xb8466e+'/'+_0x1df9ae)[_0xaac4('0x16')](_0x31b7e5);}return null;};}function patchUpdates(_0x27fe7b){return function(_0xa22b76){try{jsonpatch[_0xaac4('0x1b')](_0xa22b76,_0x27fe7b,!![]);}catch(_0x3cbcb1){return BPromise[_0xaac4('0x1c')](_0x3cbcb1);}return _0xa22b76[_0xaac4('0x1d')]();};}function saveUpdates(_0x25b946,_0x4166ee){return function(_0x480fb0){if(_0x480fb0){return _0x480fb0[_0xaac4('0x1e')](_0x25b946)['then'](function(_0x3303f1){return _0x3303f1;});}return null;};}function removeEntity(_0x2013b7,_0x43625c){return function(_0x477b77){if(_0x477b77){return _0x477b77[_0xaac4('0x1f')]()[_0xaac4('0x20')](function(){_0x2013b7['status'](0xcc)[_0xaac4('0x15')]();});}};}function handleEntityNotFound(_0x27a84d,_0x174860){return function(_0x4f10ec){if(!_0x4f10ec){_0x27a84d[_0xaac4('0x21')](0x194);}return _0x4f10ec;};}function handleError(_0x2dcc59,_0xb2577b){_0xb2577b=_0xb2577b||0x1f4;return function(_0x577b3d){logger[_0xaac4('0x22')](_0x577b3d['stack']);if(_0x577b3d['name']){delete _0x577b3d['name'];}_0x2dcc59['status'](_0xb2577b)[_0xaac4('0x23')](_0x577b3d);};}exports[_0xaac4('0x24')]=function(_0x22cda2,_0xe93120){var _0x3c1445={},_0x249a5d={},_0x43b122={'count':0x0,'rows':[]};var _0x2d68b6=_[_0xaac4('0x25')](db[_0xaac4('0x26')]['rawAttributes'],function(_0x316445){return{'name':_0x316445[_0xaac4('0x27')],'type':_0x316445[_0xaac4('0x28')][_0xaac4('0x29')]};});_0x249a5d[_0xaac4('0x2a')]=_[_0xaac4('0x25')](_0x2d68b6,'name');_0x249a5d[_0xaac4('0x2b')]=_['keys'](_0x22cda2[_0xaac4('0x2b')]);_0x249a5d[_0xaac4('0x2c')]=_[_0xaac4('0x2d')](_0x249a5d[_0xaac4('0x2a')],_0x249a5d['query']);_0x3c1445['attributes']=_['intersection'](_0x249a5d[_0xaac4('0x2a')],qs[_0xaac4('0x2e')](_0x22cda2[_0xaac4('0x2b')][_0xaac4('0x2e')]));_0x3c1445[_0xaac4('0x2f')]=_0x3c1445[_0xaac4('0x2f')][_0xaac4('0x30')]?_0x3c1445[_0xaac4('0x2f')]:_0x249a5d[_0xaac4('0x2a')];if(!_0x22cda2[_0xaac4('0x2b')][_0xaac4('0x31')](_0xaac4('0x32'))){_0x3c1445[_0xaac4('0x19')]=qs[_0xaac4('0x19')](_0x22cda2[_0xaac4('0x2b')]['limit']);_0x3c1445['offset']=qs[_0xaac4('0x18')](_0x22cda2[_0xaac4('0x2b')][_0xaac4('0x18')]);}_0x3c1445['order']=qs[_0xaac4('0x33')](_0x22cda2[_0xaac4('0x2b')][_0xaac4('0x33')]);_0x3c1445[_0xaac4('0x34')]=qs[_0xaac4('0x2c')](_[_0xaac4('0x35')](_0x22cda2[_0xaac4('0x2b')],_0x249a5d['filters']));if(_0x22cda2[_0xaac4('0x2b')][_0xaac4('0x36')]){_0x3c1445[_0xaac4('0x34')]=_['merge'](_0x3c1445[_0xaac4('0x34')],{'$or':_['map'](_0x2d68b6,function(_0x577b5b){if(_0x577b5b[_0xaac4('0x28')]!==_0xaac4('0x37')){var _0x2da28a={};_0x2da28a[_0x577b5b['name']]={'$like':'%'+_0x22cda2['query'][_0xaac4('0x36')]+'%'};return _0x2da28a;}})});}_0x3c1445=_[_0xaac4('0x38')]({},_0x3c1445,_0x22cda2[_0xaac4('0x39')]);var _0x268295={'where':_0x3c1445[_0xaac4('0x34')]};return db[_0xaac4('0x26')]['count'](_0x268295)['then'](function(_0x220bdc){_0x43b122[_0xaac4('0x17')]=_0x220bdc;if(_0x22cda2['query'][_0xaac4('0x3a')]){_0x3c1445[_0xaac4('0x3b')]=[{'all':!![]}];}return db[_0xaac4('0x26')]['findAll'](_0x3c1445);})[_0xaac4('0x20')](function(_0x4a4773){_0x43b122[_0xaac4('0x3c')]=_0x4a4773;return _0x43b122;})['then'](respondWithFilteredResult(_0xe93120,_0x3c1445))[_0xaac4('0x3d')](handleError(_0xe93120,null));};exports[_0xaac4('0x3e')]=function(_0x3dcade,_0x33bf83){var _0x51e59d={'raw':!![],'where':{'id':_0x3dcade['params']['id']}},_0x247fea={};_0x247fea['model']=_[_0xaac4('0x3f')](db[_0xaac4('0x26')][_0xaac4('0x40')]);_0x247fea[_0xaac4('0x2b')]=_[_0xaac4('0x3f')](_0x3dcade[_0xaac4('0x2b')]);_0x247fea[_0xaac4('0x2c')]=_[_0xaac4('0x2d')](_0x247fea['model'],_0x247fea[_0xaac4('0x2b')]);_0x51e59d[_0xaac4('0x2f')]=_[_0xaac4('0x2d')](_0x247fea[_0xaac4('0x2a')],qs['fields'](_0x3dcade[_0xaac4('0x2b')][_0xaac4('0x2e')]));_0x51e59d[_0xaac4('0x2f')]=_0x51e59d['attributes'][_0xaac4('0x30')]?_0x51e59d[_0xaac4('0x2f')]:_0x247fea[_0xaac4('0x2a')];if(_0x3dcade[_0xaac4('0x2b')]['includeAll']){_0x51e59d[_0xaac4('0x3b')]=[{'all':!![]}];}_0x51e59d=_[_0xaac4('0x38')]({},_0x51e59d,_0x3dcade[_0xaac4('0x39')]);return db['VoiceTransferReport'][_0xaac4('0x41')](_0x51e59d)[_0xaac4('0x20')](handleEntityNotFound(_0x33bf83,null))[_0xaac4('0x20')](respondWithResult(_0x33bf83,null))[_0xaac4('0x3d')](handleError(_0x33bf83,null));};exports[_0xaac4('0x42')]=function(_0x1ad713,_0x25e1b1){return db[_0xaac4('0x26')][_0xaac4('0x42')](_0x1ad713['body'],{})[_0xaac4('0x20')](respondWithResult(_0x25e1b1,0xc9))[_0xaac4('0x3d')](handleError(_0x25e1b1,null));};exports[_0xaac4('0x1e')]=function(_0x360420,_0x130bb5){if(_0x360420['body']['id']){delete _0x360420['body']['id'];}return db[_0xaac4('0x26')][_0xaac4('0x41')]({'where':{'id':_0x360420[_0xaac4('0x43')]['id']}})[_0xaac4('0x20')](handleEntityNotFound(_0x130bb5,null))['then'](saveUpdates(_0x360420[_0xaac4('0x44')],null))['then'](respondWithResult(_0x130bb5,null))[_0xaac4('0x3d')](handleError(_0x130bb5,null));};exports[_0xaac4('0x1f')]=function(_0x487203,_0x282de3){return db[_0xaac4('0x26')][_0xaac4('0x41')]({'where':{'id':_0x487203['params']['id']}})['then'](handleEntityNotFound(_0x282de3,null))[_0xaac4('0x20')](removeEntity(_0x282de3,null))[_0xaac4('0x3d')](handleError(_0x282de3,null));}; \ No newline at end of file +var _0xda3f=['pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','keys','includeAll','find','create','body','params','eml-format','rimraf','moment','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x1d3720,_0x1deff3){var _0x8dfb11=function(_0x9c67fa){while(--_0x9c67fa){_0x1d3720['push'](_0x1d3720['shift']());}};_0x8dfb11(++_0x1deff3);}(_0xda3f,0xec));var _0xfda3=function(_0x58374f,_0x138993){_0x58374f=_0x58374f-0x0;var _0x4f0679=_0xda3f[_0x58374f];return _0x4f0679;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfda3('0x0'));var rimraf=require(_0xfda3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfda3('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfda3('0x3'));var util=require(_0xfda3('0x4'));var path=require('path');var sox=require(_0xfda3('0x5'));var csv=require(_0xfda3('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x6'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var db=require(_0xfda3('0x15'))['db'];function respondWithStatusCode(_0x1443f4,_0x4b77ea){_0x4b77ea=_0x4b77ea||0xcc;return function(_0x583125){if(_0x583125){return _0x1443f4['sendStatus'](_0x4b77ea);}return _0x1443f4[_0xfda3('0x16')](_0x4b77ea)[_0xfda3('0x17')]();};}function respondWithResult(_0x4929fa,_0x501588){_0x501588=_0x501588||0xc8;return function(_0x587e9b){if(_0x587e9b){return _0x4929fa[_0xfda3('0x16')](_0x501588)[_0xfda3('0x18')](_0x587e9b);}};}function respondWithFilteredResult(_0x5ea793,_0x57a229){return function(_0x533365){if(_0x533365){var _0x80ea80=_0x533365[_0xfda3('0x19')],_0x474707=_0x57a229[_0xfda3('0x1a')],_0x249dc6=_0x57a229[_0xfda3('0x1a')]+_0x57a229[_0xfda3('0x1b')],_0x3d8bcd;if(_0x249dc6>=_0x80ea80){_0x249dc6=_0x80ea80;_0x3d8bcd=0xc8;}else{_0x3d8bcd=0xce;}_0x5ea793[_0xfda3('0x16')](_0x3d8bcd);return _0x5ea793[_0xfda3('0x1c')]('Content-Range',_0x474707+'-'+_0x249dc6+'/'+_0x80ea80)[_0xfda3('0x18')](_0x533365);}return null;};}function patchUpdates(_0x1bbdda){return function(_0x12d568){try{jsonpatch[_0xfda3('0x1d')](_0x12d568,_0x1bbdda,!![]);}catch(_0x59a887){return BPromise[_0xfda3('0x1e')](_0x59a887);}return _0x12d568[_0xfda3('0x1f')]();};}function saveUpdates(_0x2ee74c,_0x51e731){return function(_0x5ad52a){if(_0x5ad52a){return _0x5ad52a[_0xfda3('0x20')](_0x2ee74c)[_0xfda3('0x21')](function(_0x4ea9f5){return _0x4ea9f5;});}return null;};}function removeEntity(_0x545320,_0x3cf5a9){return function(_0xef2535){if(_0xef2535){return _0xef2535[_0xfda3('0x22')]()[_0xfda3('0x21')](function(){_0x545320[_0xfda3('0x16')](0xcc)[_0xfda3('0x17')]();});}};}function handleEntityNotFound(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(!_0x16eaa6){_0x2677f6['sendStatus'](0x194);}return _0x16eaa6;};}function handleError(_0x82341b,_0x2d5b44){_0x2d5b44=_0x2d5b44||0x1f4;return function(_0x2e8bf8){logger['error'](_0x2e8bf8[_0xfda3('0x23')]);if(_0x2e8bf8[_0xfda3('0x24')]){delete _0x2e8bf8[_0xfda3('0x24')];}_0x82341b[_0xfda3('0x16')](_0x2d5b44)[_0xfda3('0x25')](_0x2e8bf8);};}exports[_0xfda3('0x26')]=function(_0x514d2a,_0x3c6d7d){var _0x1e87fe={},_0x2bef2b={},_0x1f2884={'count':0x0,'rows':[]};var _0x33ffd4=_['map'](db[_0xfda3('0x27')][_0xfda3('0x28')],function(_0x301509){return{'name':_0x301509[_0xfda3('0x29')],'type':_0x301509[_0xfda3('0x2a')][_0xfda3('0x2b')]};});_0x2bef2b[_0xfda3('0x2c')]=_['map'](_0x33ffd4,'name');_0x2bef2b[_0xfda3('0x2d')]=_['keys'](_0x514d2a['query']);_0x2bef2b[_0xfda3('0x2e')]=_[_0xfda3('0x2f')](_0x2bef2b[_0xfda3('0x2c')],_0x2bef2b[_0xfda3('0x2d')]);_0x1e87fe[_0xfda3('0x30')]=_[_0xfda3('0x2f')](_0x2bef2b[_0xfda3('0x2c')],qs[_0xfda3('0x31')](_0x514d2a[_0xfda3('0x2d')]['fields']));_0x1e87fe[_0xfda3('0x30')]=_0x1e87fe[_0xfda3('0x30')][_0xfda3('0x32')]?_0x1e87fe[_0xfda3('0x30')]:_0x2bef2b[_0xfda3('0x2c')];if(!_0x514d2a[_0xfda3('0x2d')][_0xfda3('0x33')](_0xfda3('0x34'))){_0x1e87fe[_0xfda3('0x1b')]=qs['limit'](_0x514d2a['query'][_0xfda3('0x1b')]);_0x1e87fe[_0xfda3('0x1a')]=qs['offset'](_0x514d2a[_0xfda3('0x2d')][_0xfda3('0x1a')]);}_0x1e87fe[_0xfda3('0x35')]=qs['sort'](_0x514d2a[_0xfda3('0x2d')][_0xfda3('0x36')]);_0x1e87fe[_0xfda3('0x37')]=qs[_0xfda3('0x2e')](_[_0xfda3('0x38')](_0x514d2a['query'],_0x2bef2b[_0xfda3('0x2e')]));if(_0x514d2a[_0xfda3('0x2d')][_0xfda3('0x39')]){_0x1e87fe['where']=_[_0xfda3('0x3a')](_0x1e87fe['where'],{'$or':_[_0xfda3('0x3b')](_0x33ffd4,function(_0x5469df){if(_0x5469df[_0xfda3('0x2a')]!==_0xfda3('0x3c')){var _0x21c5cc={};_0x21c5cc[_0x5469df[_0xfda3('0x24')]]={'$like':'%'+_0x514d2a[_0xfda3('0x2d')][_0xfda3('0x39')]+'%'};return _0x21c5cc;}})});}_0x1e87fe=_['merge']({},_0x1e87fe,_0x514d2a[_0xfda3('0x3d')]);var _0xbfbc01={'where':_0x1e87fe[_0xfda3('0x37')]};return db[_0xfda3('0x27')]['count'](_0xbfbc01)[_0xfda3('0x21')](function(_0xf0a183){_0x1f2884[_0xfda3('0x19')]=_0xf0a183;if(_0x514d2a['query']['includeAll']){_0x1e87fe[_0xfda3('0x3e')]=[{'all':!![]}];}return db[_0xfda3('0x27')][_0xfda3('0x3f')](_0x1e87fe);})[_0xfda3('0x21')](function(_0x2b415d){_0x1f2884[_0xfda3('0x40')]=_0x2b415d;return _0x1f2884;})[_0xfda3('0x21')](respondWithFilteredResult(_0x3c6d7d,_0x1e87fe))[_0xfda3('0x41')](handleError(_0x3c6d7d,null));};exports[_0xfda3('0x42')]=function(_0x272d65,_0x4d3b1c){var _0x27200f={'raw':!![],'where':{'id':_0x272d65['params']['id']}},_0x22b848={};_0x22b848[_0xfda3('0x2c')]=_['keys'](db['VoiceTransferReport']['rawAttributes']);_0x22b848[_0xfda3('0x2d')]=_[_0xfda3('0x43')](_0x272d65[_0xfda3('0x2d')]);_0x22b848[_0xfda3('0x2e')]=_['intersection'](_0x22b848[_0xfda3('0x2c')],_0x22b848[_0xfda3('0x2d')]);_0x27200f[_0xfda3('0x30')]=_[_0xfda3('0x2f')](_0x22b848['model'],qs[_0xfda3('0x31')](_0x272d65[_0xfda3('0x2d')][_0xfda3('0x31')]));_0x27200f['attributes']=_0x27200f['attributes'][_0xfda3('0x32')]?_0x27200f[_0xfda3('0x30')]:_0x22b848[_0xfda3('0x2c')];if(_0x272d65[_0xfda3('0x2d')][_0xfda3('0x44')]){_0x27200f[_0xfda3('0x3e')]=[{'all':!![]}];}_0x27200f=_[_0xfda3('0x3a')]({},_0x27200f,_0x272d65[_0xfda3('0x3d')]);return db[_0xfda3('0x27')][_0xfda3('0x45')](_0x27200f)[_0xfda3('0x21')](handleEntityNotFound(_0x4d3b1c,null))[_0xfda3('0x21')](respondWithResult(_0x4d3b1c,null))[_0xfda3('0x41')](handleError(_0x4d3b1c,null));};exports[_0xfda3('0x46')]=function(_0x57013b,_0x4a0cbd){return db[_0xfda3('0x27')][_0xfda3('0x46')](_0x57013b[_0xfda3('0x47')],{})[_0xfda3('0x21')](respondWithResult(_0x4a0cbd,0xc9))[_0xfda3('0x41')](handleError(_0x4a0cbd,null));};exports[_0xfda3('0x20')]=function(_0x192133,_0x125f5a){if(_0x192133[_0xfda3('0x47')]['id']){delete _0x192133[_0xfda3('0x47')]['id'];}return db['VoiceTransferReport'][_0xfda3('0x45')]({'where':{'id':_0x192133[_0xfda3('0x48')]['id']}})[_0xfda3('0x21')](handleEntityNotFound(_0x125f5a,null))[_0xfda3('0x21')](saveUpdates(_0x192133[_0xfda3('0x47')],null))['then'](respondWithResult(_0x125f5a,null))[_0xfda3('0x41')](handleError(_0x125f5a,null));};exports[_0xfda3('0x22')]=function(_0x15eb87,_0x4bcd2b){return db[_0xfda3('0x27')][_0xfda3('0x45')]({'where':{'id':_0x15eb87[_0xfda3('0x48')]['id']}})['then'](handleEntityNotFound(_0x4bcd2b,null))[_0xfda3('0x21')](removeEntity(_0x4bcd2b,null))[_0xfda3('0x41')](handleError(_0x4bcd2b,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 38b54f6..980b092 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 _0x5d44=['../../config/logger','api','moment','bluebird','request-promise','rimraf','VoiceTransferReport','report_call_transfer','lodash','util'];(function(_0x3e5e99,_0x6af833){var _0x4b48e3=function(_0x22e71e){while(--_0x22e71e){_0x3e5e99['push'](_0x3e5e99['shift']());}};_0x4b48e3(++_0x6af833);}(_0x5d44,0x6c));var _0x45d4=function(_0x14b16d,_0x139aed){_0x14b16d=_0x14b16d-0x0;var _0x2e49df=_0x5d44[_0x14b16d];return _0x2e49df;};'use strict';var _=require(_0x45d4('0x0'));var util=require(_0x45d4('0x1'));var logger=require(_0x45d4('0x2'))(_0x45d4('0x3'));var moment=require(_0x45d4('0x4'));var BPromise=require(_0x45d4('0x5'));var rp=require(_0x45d4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x45d4('0x7'));var config=require('../../config/environment');var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x56d86f,_0xff8609){return _0x56d86f['define'](_0x45d4('0x8'),attributes,{'tableName':_0x45d4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x927e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x927e,0x1ab));var _0xe927=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x927e[_0x310504];return _0x5b36d0;};'use strict';var _=require(_0xe927('0x0'));var util=require(_0xe927('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe927('0x2'));var BPromise=require(_0xe927('0x3'));var rp=require(_0xe927('0x4'));var fs=require('fs');var path=require(_0xe927('0x5'));var rimraf=require(_0xe927('0x6'));var config=require(_0xe927('0x7'));var attributes=require(_0xe927('0x8'));module[_0xe927('0x9')]=function(_0x4681ee,_0x2719a6){return _0x4681ee[_0xe927('0xa')](_0xe927('0xb'),attributes,{'tableName':_0xe927('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 971b0d9..eb3efc0 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 _0x52ce=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','stringify','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x52ce,0x1ae));var _0xe52c=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0x52ce[_0x264b9b];return _0x4c7a0e;};'use strict';var _=require(_0xe52c('0x0'));var util=require(_0xe52c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe52c('0x2'));var fs=require('fs');var Redis=require(_0xe52c('0x3'));var db=require(_0xe52c('0x4'))['db'];var utils=require(_0xe52c('0x5'));var logger=require(_0xe52c('0x6'))(_0xe52c('0x7'));var config=require(_0xe52c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe52c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41427d,_0xb9a4d7,_0x17b89f){return new BPromise(function(_0x274df3,_0x38277a){return client[_0xe52c('0xa')](_0x41427d,_0x17b89f)[_0xe52c('0xb')](function(_0x3b926e){logger[_0xe52c('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0xb9a4d7,_0xe52c('0xd'));logger[_0xe52c('0xe')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0xb9a4d7,_0xe52c('0xd'),JSON['stringify'](_0x3b926e));if(_0x3b926e[_0xe52c('0xf')]){if(_0x3b926e[_0xe52c('0xf')][_0xe52c('0x10')]===0x1f4){logger[_0xe52c('0xf')](_0xe52c('0x11'),_0xb9a4d7,_0x3b926e['error'][_0xe52c('0x12')]);return _0x38277a(_0x3b926e[_0xe52c('0xf')]['message']);}logger['error'](_0xe52c('0x11'),_0xb9a4d7,_0x3b926e[_0xe52c('0xf')]['message']);return _0x274df3(_0x3b926e[_0xe52c('0xf')][_0xe52c('0x12')]);}else{logger[_0xe52c('0xc')](_0xe52c('0x11'),_0xb9a4d7,_0xe52c('0xd'));_0x274df3(_0x3b926e[_0xe52c('0x13')][_0xe52c('0x12')]);}})['catch'](function(_0x50d1fc){logger[_0xe52c('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0xb9a4d7,_0x50d1fc);_0x38277a(_0x50d1fc);});});}exports[_0xe52c('0x14')]=function(_0x58235){var _0x10b2a9=this;return new Promise(function(_0x203ca2,_0xe8f840){return db[_0xe52c('0x15')][_0xe52c('0x16')](_0x58235['body'],{'raw':_0x58235[_0xe52c('0x17')]?_0x58235[_0xe52c('0x17')][_0xe52c('0x18')]===undefined?!![]:![]:!![]})[_0xe52c('0xb')](function(_0x46cfd4){logger[_0xe52c('0xc')]('CreateVoiceTransferReport',_0x58235);logger[_0xe52c('0xe')](_0xe52c('0x14'),_0x58235,JSON[_0xe52c('0x19')](_0x46cfd4));_0x203ca2(_0x46cfd4);})[_0xe52c('0x1a')](function(_0x329d7a){logger[_0xe52c('0xf')]('CreateVoiceTransferReport',_0x329d7a['message'],_0x58235);_0xe8f840(_0x10b2a9['error'](0x1f4,_0x329d7a[_0xe52c('0x12')]));});});}; \ No newline at end of file +var _0xcdde=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../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','stringify','code','error','message','request\x20sent','result','body','options','raw','CreateVoiceTransferReport'];(function(_0x4b170a,_0x4529d3){var _0x3f759e=function(_0xef9af1){while(--_0xef9af1){_0x4b170a['push'](_0x4b170a['shift']());}};_0x3f759e(++_0x4529d3);}(_0xcdde,0x106));var _0xecdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdde[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xecdd('0x0'));var util=require(_0xecdd('0x1'));var moment=require(_0xecdd('0x2'));var BPromise=require(_0xecdd('0x3'));var rs=require(_0xecdd('0x4'));var fs=require('fs');var Redis=require(_0xecdd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xecdd('0x6'));var logger=require('../../config/logger')(_0xecdd('0x7'));var config=require(_0xecdd('0x8'));var jayson=require(_0xecdd('0x9'));var client=jayson[_0xecdd('0xa')][_0xecdd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f2318,_0x416f33,_0x4c59aa){return new BPromise(function(_0x21ae23,_0x4e9b3e){return client[_0xecdd('0xc')](_0x4f2318,_0x4c59aa)[_0xecdd('0xd')](function(_0x663773){logger[_0xecdd('0xe')](_0xecdd('0xf'),_0x416f33,'request\x20sent');logger[_0xecdd('0x10')](_0xecdd('0x11'),_0x416f33,'request\x20sent',JSON[_0xecdd('0x12')](_0x663773));if(_0x663773['error']){if(_0x663773['error'][_0xecdd('0x13')]===0x1f4){logger[_0xecdd('0x14')](_0xecdd('0xf'),_0x416f33,_0x663773[_0xecdd('0x14')][_0xecdd('0x15')]);return _0x4e9b3e(_0x663773[_0xecdd('0x14')]['message']);}logger[_0xecdd('0x14')](_0xecdd('0xf'),_0x416f33,_0x663773[_0xecdd('0x14')]['message']);return _0x21ae23(_0x663773[_0xecdd('0x14')][_0xecdd('0x15')]);}else{logger['info'](_0xecdd('0xf'),_0x416f33,_0xecdd('0x16'));_0x21ae23(_0x663773[_0xecdd('0x17')][_0xecdd('0x15')]);}})['catch'](function(_0x304bc7){logger[_0xecdd('0x14')](_0xecdd('0xf'),_0x416f33,_0x304bc7);_0x4e9b3e(_0x304bc7);});});}exports['CreateVoiceTransferReport']=function(_0x110ef3){var _0x502709=this;return new Promise(function(_0x163876,_0x75754c){return db['VoiceTransferReport']['create'](_0x110ef3[_0xecdd('0x18')],{'raw':_0x110ef3[_0xecdd('0x19')]?_0x110ef3[_0xecdd('0x19')][_0xecdd('0x1a')]===undefined?!![]:![]:!![]})[_0xecdd('0xd')](function(_0x233ea5){logger[_0xecdd('0xe')](_0xecdd('0x1b'),_0x110ef3);logger[_0xecdd('0x10')](_0xecdd('0x1b'),_0x110ef3,JSON[_0xecdd('0x12')](_0x233ea5));_0x163876(_0x233ea5);})[_0xecdd('0x1c')](function(_0x571434){logger['error'](_0xecdd('0x1b'),_0x571434[_0xecdd('0x15')],_0x110ef3);_0x75754c(_0x502709['error'](0x1f4,_0x571434[_0xecdd('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 359cff3..87fc45e 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 _0x6364=['/hold','hold','/unhold','unhold','/calls','calls','/transfer','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','canUpdate','originate','hangup','/answer','answer'];(function(_0x537c32,_0x5c0845){var _0x2524d7=function(_0x2a30c3){while(--_0x2a30c3){_0x537c32['push'](_0x537c32['shift']());}};_0x2524d7(++_0x5c0845);}(_0x6364,0x8f));var _0x4636=function(_0x217bd9,_0x4d2376){_0x217bd9=_0x217bd9-0x0;var _0x4713cb=_0x6364[_0x217bd9];return _0x4713cb;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x4636('0x0'));var controller=require(_0x4636('0x1'));router[_0x4636('0x2')](_0x4636('0x3'),auth[_0x4636('0x4')](),auth[_0x4636('0x5')](),controller[_0x4636('0x6')]);router[_0x4636('0x2')]('/hangup',auth[_0x4636('0x4')](),auth[_0x4636('0x5')](),controller[_0x4636('0x7')]);router[_0x4636('0x2')](_0x4636('0x8'),auth['isAuthenticated'](),auth[_0x4636('0x5')](),controller[_0x4636('0x9')]);router[_0x4636('0x2')](_0x4636('0xa'),auth['isAuthenticated'](),auth[_0x4636('0x5')](),controller[_0x4636('0xb')]);router[_0x4636('0x2')](_0x4636('0xc'),auth[_0x4636('0x4')](),auth['canUpdate'](),controller[_0x4636('0xd')]);router[_0x4636('0x2')](_0x4636('0xe'),auth[_0x4636('0x4')](),auth['canUpdate'](),controller[_0x4636('0xf')]);router[_0x4636('0x2')](_0x4636('0x10'),auth[_0x4636('0x4')](),auth[_0x4636('0x5')](),controller['transfer']);module['exports']=router; \ No newline at end of file +var _0x80c7=['transfer','express','Router','../../components/auth/service','./webbar.controller','isAuthenticated','originate','post','/hangup','canUpdate','hangup','/answer','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer'];(function(_0x51065f,_0xd93aa8){var _0x42bed3=function(_0x2063d5){while(--_0x2063d5){_0x51065f['push'](_0x51065f['shift']());}};_0x42bed3(++_0xd93aa8);}(_0x80c7,0x8d));var _0x780c=function(_0x20ab85,_0x1858ff){_0x20ab85=_0x20ab85-0x0;var _0x16e59f=_0x80c7[_0x20ab85];return _0x16e59f;};'use strict';var express=require(_0x780c('0x0'));var router=express[_0x780c('0x1')]();var auth=require(_0x780c('0x2'));var controller=require(_0x780c('0x3'));router['post']('/originate',auth[_0x780c('0x4')](),auth['canUpdate'](),controller[_0x780c('0x5')]);router[_0x780c('0x6')](_0x780c('0x7'),auth[_0x780c('0x4')](),auth[_0x780c('0x8')](),controller[_0x780c('0x9')]);router[_0x780c('0x6')](_0x780c('0xa'),auth[_0x780c('0x4')](),auth[_0x780c('0x8')](),controller[_0x780c('0xb')]);router['post'](_0x780c('0xc'),auth[_0x780c('0x4')](),auth['canUpdate'](),controller[_0x780c('0xd')]);router[_0x780c('0x6')](_0x780c('0xe'),auth['isAuthenticated'](),auth[_0x780c('0x8')](),controller[_0x780c('0xf')]);router[_0x780c('0x6')](_0x780c('0x10'),auth[_0x780c('0x4')](),auth[_0x780c('0x8')](),controller[_0x780c('0x11')]);router[_0x780c('0x6')](_0x780c('0x12'),auth[_0x780c('0x4')](),auth[_0x780c('0x8')](),controller[_0x780c('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 15d67f1..7c3ab74 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 _0x1978=['calls','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','stringify','handleError:','error','name','status','send','NotFound','request','then','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','info','originate\x20fired:','json','userId','body','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','webbar:hangup','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold\x20fired:','unhold\x20executed!'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1978,0x174));var _0x8197=function(_0x8dfbb9,_0x41b2d7){_0x8dfbb9=_0x8dfbb9-0x0;var _0x3eb1f9=_0x1978[_0x8dfbb9];return _0x3eb1f9;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x8197('0x0'));var db=require(_0x8197('0x1'))['db'];var config=require(_0x8197('0x2'));var util=require(_0x8197('0x3'));var BPromise=require(_0x8197('0x4'));var jayson=require(_0x8197('0x5'));var amiClient=jayson[_0x8197('0x6')][_0x8197('0x7')]({'port':0x232a});var logger=require(_0x8197('0x8'))(_0x8197('0x9'));var Redis=require('ioredis');config[_0x8197('0xa')]=_[_0x8197('0xb')](config[_0x8197('0xa')],{'host':_0x8197('0xc'),'port':0x18eb});var io=require(_0x8197('0xd'))(new Redis(config[_0x8197('0xa')]));var Schema=require(_0x8197('0xe'));var originateValidation=new Schema({'userId':{'type':_0x8197('0xf'),'required':[!![],_0x8197('0x10')]},'callNumber':{'type':_0x8197('0x11'),'required':[!![],_0x8197('0x12')]},'callerId':{'type':_0x8197('0x11')},'callbackUrl':{'type':_0x8197('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0x8197('0xf'),'required':[!![],_0x8197('0x10')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x8197('0xf'),'required':[!![],_0x8197('0x10')]},'sessionId':{'type':_0x8197('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x8197('0xf'),'required':[!![],_0x8197('0x10')]},'sessionId':{'type':_0x8197('0x11'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],_0x8197('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0x8197('0xf'),'required':[!![],_0x8197('0x10')]},'sessionId':{'type':_0x8197('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8197('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x8197('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8197('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8197('0x10')]}});function emit(_0x4d60fb,_0x233202,_0x12015d){logger['info'](_0x4d60fb,_0x233202,JSON[_0x8197('0x14')](_0x12015d));io['to'](_0x4d60fb)['emit'](_0x233202,_0x12015d);}function handleError(_0x4ad61a){return function(_0x4695a5){console['log'](_0x8197('0x15'),_0x4695a5,_0x4695a5 instanceof RangeError);logger[_0x8197('0x16')](_0x4695a5['stack']);if(_0x4695a5 instanceof RangeError){if(_0x4695a5[_0x8197('0x17')]){delete _0x4695a5['name'];}_0x4ad61a[_0x8197('0x18')](0x194)[_0x8197('0x19')](_0x4695a5);}else{if(_0x4695a5[_0x8197('0x17')]){delete _0x4695a5[_0x8197('0x17')];}_0x4ad61a[_0x8197('0x18')](0x1f4)[_0x8197('0x19')](_0x4695a5);}};}function checkError(){return function(_0x58e763){if(!_0x58e763){throw new RangeError(_0x8197('0x1a'));}return _0x58e763;};}function respondWithRpcPromise(_0x46b971,_0x100852){return new BPromise(function(_0x505ea8,_0x4c06d1){var _0x137d60=amiClient;return _0x137d60[_0x8197('0x1b')](_0x46b971,_0x100852)[_0x8197('0x1c')](function(_0x4c8e6f){if(_0x4c8e6f[_0x8197('0x16')]){if(_0x4c8e6f[_0x8197('0x16')]['code']===0x1f4){return _0x4c06d1(_0x4c8e6f[_0x8197('0x16')][_0x8197('0x1d')]);}return _0x505ea8(_0x4c8e6f[_0x8197('0x16')]['message']);}else{_0x505ea8(_0x4c8e6f[_0x8197('0x1e')]);}})[_0x8197('0x1f')](function(_0x276d45){_0x4c06d1(_0x276d45);});});}function getAgent(_0x279a9d){return db[_0x8197('0x20')][_0x8197('0x21')]({'where':{'id':_0x279a9d,'role':_0x8197('0x22')}})['then'](checkError());}function getAgentCheckSession(_0x88c64e,_0x4640cb){return new BPromise(function(_0x1344bf,_0x2def83){var _0x1b80b8=respondWithRpcPromise(_0x8197('0x23'));var _0x4b8729=getAgent(_0x88c64e);Promise[_0x8197('0x24')]([_0x1b80b8,_0x4b8729])[_0x8197('0x1c')](function(_0x485692){var _0x456d95=_0x485692[0x0];var _0x23d374=_0x485692[0x1];var _0x554325=_[_0x8197('0x25')](_0x456d95[_0x8197('0x26')],function(_0x18fbc0){return _0x18fbc0[_0x8197('0x27')]==_0x23d374['id']&&_0x18fbc0[_0x8197('0x28')]==_0x4640cb;});if(_0x554325[_0x8197('0x29')]==0x1){_0x1344bf(_0x23d374);}else{_0x2def83(new RangeError(_0x8197('0x2a')+_0x4640cb+'\x20not\x20found!'));}});});}exports['originate']=function(_0x485f8e,_0x2d8a49){logger[_0x8197('0x2b')](_0x8197('0x2c'),_0x485f8e['body']);var _0x23740e=originateValidation[_0x8197('0xe')](_0x485f8e['body']);if(_0x23740e['length']>0x0){return _0x2d8a49[_0x8197('0x18')](0x190)[_0x8197('0x2d')](_0x23740e);}var _0x4c5882=_0x485f8e['body'][_0x8197('0x2e')];var _0x217cd7=_0x485f8e[_0x8197('0x2f')][_0x8197('0x30')];var _0x3867e2=_0x485f8e[_0x8197('0x2f')][_0x8197('0x31')];var _0x39d77d=_0x485f8e[_0x8197('0x2f')][_0x8197('0x32')];return getAgent(_0x4c5882)[_0x8197('0x1c')](function(_0x404da3){logger[_0x8197('0x2b')](_0x8197('0x33'),_0x404da3[_0x8197('0x17')]);emit(util[_0x8197('0x34')](_0x8197('0x35'),_0x404da3[_0x8197('0x17')]),_0x8197('0x36'),{'callNumber':_0x217cd7,'callerId':_0x3867e2,'callbackUrl':_0x39d77d});return _0x2d8a49[_0x8197('0x18')](0xc8)[_0x8197('0x2d')]({'error':![],'message':_0x8197('0x37')});})[_0x8197('0x1f')](handleError(_0x2d8a49));};exports['hangup']=function(_0x76b35a,_0x4ce35e){logger[_0x8197('0x2b')]('hangup\x20fired:',_0x76b35a[_0x8197('0x2f')]);var _0x31beee=hangupValidation[_0x8197('0xe')](_0x76b35a[_0x8197('0x2f')]);if(_0x31beee[_0x8197('0x29')]>0x0){return _0x4ce35e[_0x8197('0x18')](0x190)[_0x8197('0x2d')](_0x31beee);}var _0x335cb9=_0x76b35a['body'][_0x8197('0x2e')];var _0x4752f6=_0x76b35a[_0x8197('0x2f')][_0x8197('0x28')];return getAgent(_0x335cb9)[_0x8197('0x1c')](function(_0x1a2d7e){logger[_0x8197('0x2b')](_0x8197('0x33'),_0x1a2d7e[_0x8197('0x17')]);emit(util[_0x8197('0x34')](_0x8197('0x35'),_0x1a2d7e[_0x8197('0x17')]),_0x8197('0x38'),{'sessionId':_0x4752f6});return _0x4ce35e[_0x8197('0x18')](0xc8)[_0x8197('0x2d')]({'error':![],'message':_0x8197('0x39')});})[_0x8197('0x1f')](handleError(_0x4ce35e));};exports['answer']=function(_0x56aa31,_0x44f452){logger[_0x8197('0x2b')](_0x8197('0x3a'),_0x56aa31[_0x8197('0x2f')]);var _0x2bfe7b=answerValidation[_0x8197('0xe')](_0x56aa31[_0x8197('0x2f')]);if(_0x2bfe7b[_0x8197('0x29')]>0x0){return _0x44f452[_0x8197('0x18')](0x190)[_0x8197('0x2d')](_0x2bfe7b);}var _0x3d7490=_0x56aa31['body']['userId'];var _0x37c0fc=_0x56aa31[_0x8197('0x2f')]['sessionId'];return getAgent(_0x3d7490)['then'](function(_0x1eb7d7){logger['info']('entityFound:',_0x1eb7d7[_0x8197('0x17')]);emit(util['format'](_0x8197('0x35'),_0x1eb7d7[_0x8197('0x17')]),_0x8197('0x3b'),{'sessionId':_0x37c0fc});return _0x44f452[_0x8197('0x18')](0xc8)[_0x8197('0x2d')]({'error':![],'message':_0x8197('0x3c')});})[_0x8197('0x1f')](handleError(_0x44f452));};exports[_0x8197('0x3d')]=function(_0x2c2d35,_0x39a319){logger[_0x8197('0x2b')](_0x8197('0x3e'),_0x2c2d35['body']);var _0x25f0eb=holdValidation[_0x8197('0xe')](_0x2c2d35[_0x8197('0x2f')]);if(_0x25f0eb[_0x8197('0x29')]>0x0){return _0x39a319[_0x8197('0x18')](0x190)[_0x8197('0x2d')](_0x25f0eb);}var _0xdd3927=_0x2c2d35[_0x8197('0x2f')][_0x8197('0x2e')];var _0x46788b=_0x2c2d35[_0x8197('0x2f')][_0x8197('0x28')];return getAgent(_0xdd3927)[_0x8197('0x1c')](function(_0x177af5){logger[_0x8197('0x2b')](_0x8197('0x33'),_0x177af5['name']);emit(util['format'](_0x8197('0x35'),_0x177af5[_0x8197('0x17')]),'webbar:hold',{'sessionId':_0x46788b});return _0x39a319['status'](0xc8)['json']({'error':![],'message':_0x8197('0x3f')});})['catch'](handleError(_0x39a319));};exports['unhold']=function(_0x58fde1,_0x4c9122){logger[_0x8197('0x2b')](_0x8197('0x40'),_0x58fde1['body']);var _0x3b41f9=unholdValidation[_0x8197('0xe')](_0x58fde1[_0x8197('0x2f')]);if(_0x3b41f9['length']>0x0){return _0x4c9122[_0x8197('0x18')](0x190)[_0x8197('0x2d')](_0x3b41f9);}var _0x9d5f02=_0x58fde1[_0x8197('0x2f')][_0x8197('0x2e')];var _0x9ed42d=_0x58fde1['body'][_0x8197('0x28')];return getAgent(_0x9d5f02)[_0x8197('0x1c')](function(_0x2b14ff){logger[_0x8197('0x2b')](_0x8197('0x33'),_0x2b14ff['name']);emit(util[_0x8197('0x34')](_0x8197('0x35'),_0x2b14ff['name']),'webbar:unhold',{'sessionId':_0x9ed42d});return _0x4c9122['status'](0xc8)['json']({'error':![],'message':_0x8197('0x41')});})[_0x8197('0x1f')](handleError(_0x4c9122));};exports[_0x8197('0x42')]=function(_0x56a880,_0x523e35){logger['info'](_0x8197('0x43'),_0x523e35[_0x8197('0x2f')]);var _0x1480b0=callsValidation['validate'](_0x56a880[_0x8197('0x2f')]);if(_0x1480b0[_0x8197('0x29')]>0x0){return _0x523e35[_0x8197('0x18')](0x190)['json'](_0x1480b0);}var _0x46f775=_0x56a880[_0x8197('0x2f')][_0x8197('0x2e')];var _0x26c0e8=respondWithRpcPromise(_0x8197('0x23'));var _0x16e339=getAgent(_0x46f775);return Promise[_0x8197('0x24')]([_0x26c0e8,_0x16e339])['then'](function(_0xfcc56){var _0x42227a=_0xfcc56[0x0];var _0x1ee075=_0xfcc56[0x1];var _0x456846=_[_0x8197('0x25')](_0x42227a[_0x8197('0x26')],function(_0x894a6e){return _0x894a6e[_0x8197('0x27')]==_0x1ee075['id'];});return _0x523e35[_0x8197('0x18')](0xc8)[_0x8197('0x2d')]({'count':_0x456846['length'],'rows':_0x456846});})[_0x8197('0x1f')](handleError(_0x523e35));};exports[_0x8197('0x44')]=function(_0x4930de,_0x3b3df0){logger[_0x8197('0x2b')](_0x8197('0x45'),_0x4930de[_0x8197('0x2f')]);var _0x347a69=conferenceValidation[_0x8197('0xe')](_0x4930de[_0x8197('0x2f')]);if(_0x347a69['length']>0x0){return _0x3b3df0[_0x8197('0x18')](0x190)[_0x8197('0x2d')](_0x347a69);}var _0x3aaaa8=_0x4930de[_0x8197('0x2f')]['userId'];return getAgent(_0x3aaaa8)[_0x8197('0x1c')](function(_0x57a4c0){logger['info'](_0x8197('0x33'),_0x57a4c0['name']);emit(util['format'](_0x8197('0x35'),_0x57a4c0[_0x8197('0x17')]),'webbar:conference');return _0x3b3df0[_0x8197('0x18')](0xc8)[_0x8197('0x2d')]({'error':![],'message':_0x8197('0x46')});})[_0x8197('0x1f')](handleError(_0x3b3df0));};exports[_0x8197('0x47')]=function(_0x1cabb4,_0x375f73){logger[_0x8197('0x2b')](_0x8197('0x48'),_0x1cabb4[_0x8197('0x2f')]);var _0x34e0a7=transferValidation['validate'](_0x1cabb4[_0x8197('0x2f')]);if(_0x34e0a7[_0x8197('0x29')]>0x0){return _0x375f73[_0x8197('0x18')](0x190)[_0x8197('0x2d')](_0x34e0a7);}var _0x134131=_0x1cabb4[_0x8197('0x2f')][_0x8197('0x2e')];var _0x357f7c=_0x1cabb4['body']['sessionId'];var _0x506796=_0x1cabb4[_0x8197('0x2f')]['transferNumber'];return getAgent(_0x134131)[_0x8197('0x1c')](function(_0x44e212){logger['info']('entityFound:',_0x44e212[_0x8197('0x17')]);emit(util[_0x8197('0x34')](_0x8197('0x35'),_0x44e212[_0x8197('0x17')]),'webbar:transfer',{'sessionId':_0x357f7c,'transferNumber':_0x506796});return _0x375f73[_0x8197('0x18')](0xc8)[_0x8197('0x2d')]({'error':![],'message':'transfer\x20executed!'});})[_0x8197('0x1f')](handleError(_0x375f73));}; \ No newline at end of file +var _0xad36=['number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','log','error','stack','name','status','send','NotFound','request','then','message','catch','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','info','originate\x20fired:','body','validate','json','userId','callNumber','callerId','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer','transferNumber','webbar:transfer','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','ioredis','redis','defaults'];(function(_0x1f6e18,_0xc8a42a){var _0x1c60e1=function(_0x16f1d2){while(--_0x16f1d2){_0x1f6e18['push'](_0x1f6e18['shift']());}};_0x1c60e1(++_0xc8a42a);}(_0xad36,0x11c));var _0x6ad3=function(_0x35acd5,_0x532ca6){_0x35acd5=_0x35acd5-0x0;var _0x4dfcab=_0xad36[_0x35acd5];return _0x4dfcab;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x6ad3('0x0'));var db=require(_0x6ad3('0x1'))['db'];var config=require(_0x6ad3('0x2'));var util=require(_0x6ad3('0x3'));var BPromise=require(_0x6ad3('0x4'));var jayson=require(_0x6ad3('0x5'));var amiClient=jayson[_0x6ad3('0x6')][_0x6ad3('0x7')]({'port':0x232a});var logger=require(_0x6ad3('0x8'))('webbarapi');var Redis=require(_0x6ad3('0x9'));config[_0x6ad3('0xa')]=_[_0x6ad3('0xb')](config[_0x6ad3('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x6ad3('0xc'),'required':[!![],_0x6ad3('0xd')]},'callNumber':{'type':_0x6ad3('0xe'),'required':[!![],_0x6ad3('0xf')]},'callerId':{'type':_0x6ad3('0xe')},'callbackUrl':{'type':_0x6ad3('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x6ad3('0xc'),'required':[!![],_0x6ad3('0xd')]},'sessionId':{'type':_0x6ad3('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6ad3('0xd')]},'sessionId':{'type':_0x6ad3('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x6ad3('0xc'),'required':[!![],_0x6ad3('0xd')]},'sessionId':{'type':_0x6ad3('0xe'),'required':[!![],_0x6ad3('0x10')]},'transferNumber':{'type':_0x6ad3('0xe'),'required':[!![],_0x6ad3('0x11')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6ad3('0xd')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x6ad3('0xc'),'required':[!![],_0x6ad3('0xd')]},'sessionId':{'type':_0x6ad3('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x6ad3('0xc'),'required':[!![],_0x6ad3('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6ad3('0xd')]}});function emit(_0x45aa65,_0xf81b3,_0x4c52c2){logger['info'](_0x45aa65,_0xf81b3,JSON['stringify'](_0x4c52c2));io['to'](_0x45aa65)['emit'](_0xf81b3,_0x4c52c2);}function handleError(_0x2c6f96){return function(_0x4d031b){console[_0x6ad3('0x12')]('handleError:',_0x4d031b,_0x4d031b instanceof RangeError);logger[_0x6ad3('0x13')](_0x4d031b[_0x6ad3('0x14')]);if(_0x4d031b instanceof RangeError){if(_0x4d031b[_0x6ad3('0x15')]){delete _0x4d031b[_0x6ad3('0x15')];}_0x2c6f96['status'](0x194)['send'](_0x4d031b);}else{if(_0x4d031b[_0x6ad3('0x15')]){delete _0x4d031b[_0x6ad3('0x15')];}_0x2c6f96[_0x6ad3('0x16')](0x1f4)[_0x6ad3('0x17')](_0x4d031b);}};}function checkError(){return function(_0x3b3f8b){if(!_0x3b3f8b){throw new RangeError(_0x6ad3('0x18'));}return _0x3b3f8b;};}function respondWithRpcPromise(_0x19ff5e,_0x3dbfb6){return new BPromise(function(_0xe5b2ad,_0x4cb79d){var _0x33e11b=amiClient;return _0x33e11b[_0x6ad3('0x19')](_0x19ff5e,_0x3dbfb6)[_0x6ad3('0x1a')](function(_0x1fcdf9){if(_0x1fcdf9[_0x6ad3('0x13')]){if(_0x1fcdf9[_0x6ad3('0x13')]['code']===0x1f4){return _0x4cb79d(_0x1fcdf9[_0x6ad3('0x13')][_0x6ad3('0x1b')]);}return _0xe5b2ad(_0x1fcdf9[_0x6ad3('0x13')]['message']);}else{_0xe5b2ad(_0x1fcdf9['result']);}})[_0x6ad3('0x1c')](function(_0x13bff5){_0x4cb79d(_0x13bff5);});});}function getAgent(_0x508bb1){return db['User'][_0x6ad3('0x1d')]({'where':{'id':_0x508bb1,'role':_0x6ad3('0x1e')}})[_0x6ad3('0x1a')](checkError());}function getAgentCheckSession(_0xf857f4,_0x467512){return new BPromise(function(_0x3a8774,_0x4f692d){var _0x4f40ef=respondWithRpcPromise(_0x6ad3('0x1f'));var _0x3e8d2a=getAgent(_0xf857f4);Promise[_0x6ad3('0x20')]([_0x4f40ef,_0x3e8d2a])[_0x6ad3('0x1a')](function(_0x4ee707){var _0x5ca9a4=_0x4ee707[0x0];var _0x2f1d01=_0x4ee707[0x1];var _0x23a0ad=_[_0x6ad3('0x21')](_0x5ca9a4[_0x6ad3('0x22')],function(_0x1602df){return _0x1602df[_0x6ad3('0x23')]==_0x2f1d01['id']&&_0x1602df[_0x6ad3('0x24')]==_0x467512;});if(_0x23a0ad[_0x6ad3('0x25')]==0x1){_0x3a8774(_0x2f1d01);}else{_0x4f692d(new RangeError('sessionId\x20'+_0x467512+_0x6ad3('0x26')));}});});}exports[_0x6ad3('0x27')]=function(_0x4fe3e9,_0x298476){logger[_0x6ad3('0x28')](_0x6ad3('0x29'),_0x4fe3e9[_0x6ad3('0x2a')]);var _0x4be46c=originateValidation[_0x6ad3('0x2b')](_0x4fe3e9['body']);if(_0x4be46c[_0x6ad3('0x25')]>0x0){return _0x298476[_0x6ad3('0x16')](0x190)[_0x6ad3('0x2c')](_0x4be46c);}var _0x148c69=_0x4fe3e9[_0x6ad3('0x2a')][_0x6ad3('0x2d')];var _0x4e12ef=_0x4fe3e9[_0x6ad3('0x2a')][_0x6ad3('0x2e')];var _0x11c4a8=_0x4fe3e9[_0x6ad3('0x2a')][_0x6ad3('0x2f')];var _0x5f08b5=_0x4fe3e9[_0x6ad3('0x2a')]['callbackUrl'];return getAgent(_0x148c69)[_0x6ad3('0x1a')](function(_0x2bdaeb){logger[_0x6ad3('0x28')](_0x6ad3('0x30'),_0x2bdaeb[_0x6ad3('0x15')]);emit(util[_0x6ad3('0x31')](_0x6ad3('0x32'),_0x2bdaeb[_0x6ad3('0x15')]),_0x6ad3('0x33'),{'callNumber':_0x4e12ef,'callerId':_0x11c4a8,'callbackUrl':_0x5f08b5});return _0x298476['status'](0xc8)[_0x6ad3('0x2c')]({'error':![],'message':_0x6ad3('0x34')});})[_0x6ad3('0x1c')](handleError(_0x298476));};exports[_0x6ad3('0x35')]=function(_0x12c5be,_0x3ed7b9){logger[_0x6ad3('0x28')]('hangup\x20fired:',_0x12c5be['body']);var _0x427af8=hangupValidation[_0x6ad3('0x2b')](_0x12c5be[_0x6ad3('0x2a')]);if(_0x427af8[_0x6ad3('0x25')]>0x0){return _0x3ed7b9[_0x6ad3('0x16')](0x190)[_0x6ad3('0x2c')](_0x427af8);}var _0xf52e=_0x12c5be['body'][_0x6ad3('0x2d')];var _0x3518dd=_0x12c5be[_0x6ad3('0x2a')]['sessionId'];return getAgent(_0xf52e)[_0x6ad3('0x1a')](function(_0x4e4599){logger['info'](_0x6ad3('0x30'),_0x4e4599['name']);emit(util[_0x6ad3('0x31')](_0x6ad3('0x32'),_0x4e4599[_0x6ad3('0x15')]),_0x6ad3('0x36'),{'sessionId':_0x3518dd});return _0x3ed7b9[_0x6ad3('0x16')](0xc8)[_0x6ad3('0x2c')]({'error':![],'message':_0x6ad3('0x37')});})['catch'](handleError(_0x3ed7b9));};exports[_0x6ad3('0x38')]=function(_0x23a7a9,_0x162133){logger[_0x6ad3('0x28')](_0x6ad3('0x39'),_0x23a7a9[_0x6ad3('0x2a')]);var _0x209b11=answerValidation['validate'](_0x23a7a9[_0x6ad3('0x2a')]);if(_0x209b11[_0x6ad3('0x25')]>0x0){return _0x162133[_0x6ad3('0x16')](0x190)[_0x6ad3('0x2c')](_0x209b11);}var _0x1d8630=_0x23a7a9[_0x6ad3('0x2a')][_0x6ad3('0x2d')];var _0x3618c4=_0x23a7a9[_0x6ad3('0x2a')][_0x6ad3('0x24')];return getAgent(_0x1d8630)[_0x6ad3('0x1a')](function(_0x4d0df3){logger[_0x6ad3('0x28')](_0x6ad3('0x30'),_0x4d0df3[_0x6ad3('0x15')]);emit(util[_0x6ad3('0x31')](_0x6ad3('0x32'),_0x4d0df3['name']),'webbar:answer',{'sessionId':_0x3618c4});return _0x162133['status'](0xc8)['json']({'error':![],'message':_0x6ad3('0x3a')});})[_0x6ad3('0x1c')](handleError(_0x162133));};exports[_0x6ad3('0x3b')]=function(_0x29dbb6,_0xee8368){logger[_0x6ad3('0x28')](_0x6ad3('0x3c'),_0x29dbb6[_0x6ad3('0x2a')]);var _0x8ebb90=holdValidation['validate'](_0x29dbb6[_0x6ad3('0x2a')]);if(_0x8ebb90[_0x6ad3('0x25')]>0x0){return _0xee8368['status'](0x190)['json'](_0x8ebb90);}var _0x1439fe=_0x29dbb6[_0x6ad3('0x2a')]['userId'];var _0x2849b0=_0x29dbb6[_0x6ad3('0x2a')][_0x6ad3('0x24')];return getAgent(_0x1439fe)[_0x6ad3('0x1a')](function(_0x3b615d){logger['info'](_0x6ad3('0x30'),_0x3b615d['name']);emit(util[_0x6ad3('0x31')]('user:%s',_0x3b615d[_0x6ad3('0x15')]),_0x6ad3('0x3d'),{'sessionId':_0x2849b0});return _0xee8368['status'](0xc8)['json']({'error':![],'message':_0x6ad3('0x3e')});})[_0x6ad3('0x1c')](handleError(_0xee8368));};exports[_0x6ad3('0x3f')]=function(_0x201ee7,_0x253a96){logger[_0x6ad3('0x28')](_0x6ad3('0x40'),_0x201ee7[_0x6ad3('0x2a')]);var _0x449871=unholdValidation[_0x6ad3('0x2b')](_0x201ee7[_0x6ad3('0x2a')]);if(_0x449871[_0x6ad3('0x25')]>0x0){return _0x253a96['status'](0x190)[_0x6ad3('0x2c')](_0x449871);}var _0x34bd5c=_0x201ee7['body']['userId'];var _0x2f71e4=_0x201ee7[_0x6ad3('0x2a')][_0x6ad3('0x24')];return getAgent(_0x34bd5c)[_0x6ad3('0x1a')](function(_0x5990d8){logger[_0x6ad3('0x28')](_0x6ad3('0x30'),_0x5990d8[_0x6ad3('0x15')]);emit(util[_0x6ad3('0x31')]('user:%s',_0x5990d8['name']),_0x6ad3('0x41'),{'sessionId':_0x2f71e4});return _0x253a96[_0x6ad3('0x16')](0xc8)[_0x6ad3('0x2c')]({'error':![],'message':'unhold\x20executed!'});})[_0x6ad3('0x1c')](handleError(_0x253a96));};exports[_0x6ad3('0x42')]=function(_0x52d790,_0x42a98e){logger[_0x6ad3('0x28')](_0x6ad3('0x43'),_0x42a98e[_0x6ad3('0x2a')]);var _0x9e4a24=callsValidation[_0x6ad3('0x2b')](_0x52d790[_0x6ad3('0x2a')]);if(_0x9e4a24['length']>0x0){return _0x42a98e['status'](0x190)['json'](_0x9e4a24);}var _0x1e14ee=_0x52d790['body'][_0x6ad3('0x2d')];var _0x28078a=respondWithRpcPromise(_0x6ad3('0x1f'));var _0x37bd7b=getAgent(_0x1e14ee);return Promise[_0x6ad3('0x20')]([_0x28078a,_0x37bd7b])[_0x6ad3('0x1a')](function(_0x48e2eb){var _0x4bbb84=_0x48e2eb[0x0];var _0x2ae4de=_0x48e2eb[0x1];var _0x48416a=_[_0x6ad3('0x21')](_0x4bbb84[_0x6ad3('0x22')],function(_0x1d8454){return _0x1d8454[_0x6ad3('0x23')]==_0x2ae4de['id'];});return _0x42a98e[_0x6ad3('0x16')](0xc8)[_0x6ad3('0x2c')]({'count':_0x48416a['length'],'rows':_0x48416a});})['catch'](handleError(_0x42a98e));};exports[_0x6ad3('0x44')]=function(_0x28e190,_0x51f821){logger[_0x6ad3('0x28')](_0x6ad3('0x45'),_0x28e190[_0x6ad3('0x2a')]);var _0x5436a6=conferenceValidation['validate'](_0x28e190[_0x6ad3('0x2a')]);if(_0x5436a6['length']>0x0){return _0x51f821[_0x6ad3('0x16')](0x190)[_0x6ad3('0x2c')](_0x5436a6);}var _0x47017d=_0x28e190[_0x6ad3('0x2a')]['userId'];return getAgent(_0x47017d)[_0x6ad3('0x1a')](function(_0x24cad6){logger['info'](_0x6ad3('0x30'),_0x24cad6[_0x6ad3('0x15')]);emit(util[_0x6ad3('0x31')](_0x6ad3('0x32'),_0x24cad6[_0x6ad3('0x15')]),'webbar:conference');return _0x51f821[_0x6ad3('0x16')](0xc8)['json']({'error':![],'message':_0x6ad3('0x46')});})[_0x6ad3('0x1c')](handleError(_0x51f821));};exports[_0x6ad3('0x47')]=function(_0x2e9204,_0x315064){logger[_0x6ad3('0x28')]('transfer\x20fired:',_0x2e9204['body']);var _0x55ba64=transferValidation['validate'](_0x2e9204[_0x6ad3('0x2a')]);if(_0x55ba64[_0x6ad3('0x25')]>0x0){return _0x315064[_0x6ad3('0x16')](0x190)[_0x6ad3('0x2c')](_0x55ba64);}var _0x516372=_0x2e9204[_0x6ad3('0x2a')]['userId'];var _0x3f9a3a=_0x2e9204[_0x6ad3('0x2a')][_0x6ad3('0x24')];var _0x5b8ac2=_0x2e9204['body'][_0x6ad3('0x48')];return getAgent(_0x516372)[_0x6ad3('0x1a')](function(_0x2ed539){logger[_0x6ad3('0x28')]('entityFound:',_0x2ed539[_0x6ad3('0x15')]);emit(util[_0x6ad3('0x31')](_0x6ad3('0x32'),_0x2ed539[_0x6ad3('0x15')]),_0x6ad3('0x49'),{'sessionId':_0x3f9a3a,'transferNumber':_0x5b8ac2});return _0x315064[_0x6ad3('0x16')](0xc8)[_0x6ad3('0x2c')]({'error':![],'message':'transfer\x20executed!'});})[_0x6ad3('0x1c')](handleError(_0x315064));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 77371b7..7c91708 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 _0x0db0=['/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAgents','/:id/notify','notify','/:id/send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions'];(function(_0x56039b,_0x3de8d8){var _0xc90792=function(_0x300c35){while(--_0x300c35){_0x56039b['push'](_0x56039b['shift']());}};_0xc90792(++_0x3de8d8);}(_0x0db0,0x83));var _0x00db=function(_0x50c96f,_0x2ee009){_0x50c96f=_0x50c96f-0x0;var _0x38fcf2=_0x0db0[_0x50c96f];return _0x38fcf2;};'use strict';var multer=require(_0x00db('0x0'));var util=require(_0x00db('0x1'));var path=require(_0x00db('0x2'));var timeout=require(_0x00db('0x3'));var express=require(_0x00db('0x4'));var router=express['Router']();var auth=require(_0x00db('0x5'));var interaction=require(_0x00db('0x6'));var config=require(_0x00db('0x7'));var controller=require(_0x00db('0x8'));router[_0x00db('0x9')]('/',auth['isAuthenticated'](),controller[_0x00db('0xa')]);router[_0x00db('0x9')]('/describe',auth[_0x00db('0xb')](),controller[_0x00db('0xc')]);router['get'](_0x00db('0xd'),auth[_0x00db('0xb')](),controller[_0x00db('0xe')]);router['get'](_0x00db('0xf'),auth[_0x00db('0xb')](),controller[_0x00db('0x10')]);router['get'](_0x00db('0x11'),auth[_0x00db('0xb')](),controller[_0x00db('0x12')]);router['get'](_0x00db('0x13'),auth[_0x00db('0xb')](),controller[_0x00db('0x14')]);router[_0x00db('0x9')](_0x00db('0x15'),auth['isAuthenticated'](),controller[_0x00db('0x16')]);router[_0x00db('0x17')]('/',auth[_0x00db('0xb')](),controller[_0x00db('0x18')]);router[_0x00db('0x17')]('/:id/dispositions',auth[_0x00db('0xb')](),controller[_0x00db('0x19')]);router[_0x00db('0x17')](_0x00db('0x11'),auth[_0x00db('0xb')](),controller['addAnswer']);router[_0x00db('0x17')]('/:id/users',auth[_0x00db('0xb')](),controller[_0x00db('0x1a')]);router[_0x00db('0x17')]('/:id/applications',auth[_0x00db('0xb')](),controller['addApplications']);router[_0x00db('0x17')](_0x00db('0x1b'),controller[_0x00db('0x1c')]);router[_0x00db('0x17')](_0x00db('0x1d'),auth[_0x00db('0xb')](),controller['send']);router[_0x00db('0x1e')](_0x00db('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x00db('0x1f')](_0x00db('0xd'),auth[_0x00db('0xb')](),controller[_0x00db('0x20')]);router[_0x00db('0x1f')](_0x00db('0xf'),auth['isAuthenticated'](),controller[_0x00db('0x21')]);router['delete']('/:id/canned_answers',auth[_0x00db('0xb')](),controller[_0x00db('0x22')]);router[_0x00db('0x1f')](_0x00db('0x13'),auth[_0x00db('0xb')](),controller[_0x00db('0x23')]);module[_0x00db('0x24')]=router; \ No newline at end of file +var _0xa7f4=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer'];(function(_0x13e968,_0x2d702a){var _0x97f2fc=function(_0x2188f2){while(--_0x2188f2){_0x13e968['push'](_0x13e968['shift']());}};_0x97f2fc(++_0x2d702a);}(_0xa7f4,0x1a1));var _0x4a7f=function(_0x3f60ff,_0x359ec1){_0x3f60ff=_0x3f60ff-0x0;var _0x45ac13=_0xa7f4[_0x3f60ff];return _0x45ac13;};'use strict';var multer=require(_0x4a7f('0x0'));var util=require(_0x4a7f('0x1'));var path=require(_0x4a7f('0x2'));var timeout=require(_0x4a7f('0x3'));var express=require(_0x4a7f('0x4'));var router=express[_0x4a7f('0x5')]();var auth=require(_0x4a7f('0x6'));var interaction=require(_0x4a7f('0x7'));var config=require(_0x4a7f('0x8'));var controller=require(_0x4a7f('0x9'));router[_0x4a7f('0xa')]('/',auth[_0x4a7f('0xb')](),controller['index']);router[_0x4a7f('0xa')](_0x4a7f('0xc'),auth['isAuthenticated'](),controller[_0x4a7f('0xd')]);router[_0x4a7f('0xa')](_0x4a7f('0xe'),auth[_0x4a7f('0xb')](),controller['show']);router[_0x4a7f('0xa')](_0x4a7f('0xf'),auth[_0x4a7f('0xb')](),controller['getDispositions']);router[_0x4a7f('0xa')](_0x4a7f('0x10'),auth[_0x4a7f('0xb')](),controller[_0x4a7f('0x11')]);router[_0x4a7f('0xa')](_0x4a7f('0x12'),auth[_0x4a7f('0xb')](),controller[_0x4a7f('0x13')]);router[_0x4a7f('0xa')](_0x4a7f('0x14'),auth['isAuthenticated'](),controller[_0x4a7f('0x15')]);router[_0x4a7f('0x16')]('/',auth[_0x4a7f('0xb')](),controller[_0x4a7f('0x17')]);router[_0x4a7f('0x16')](_0x4a7f('0xf'),auth[_0x4a7f('0xb')](),controller['addDisposition']);router[_0x4a7f('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x4a7f('0x18')]);router[_0x4a7f('0x16')](_0x4a7f('0x12'),auth['isAuthenticated'](),controller[_0x4a7f('0x19')]);router['post']('/:id/applications',auth[_0x4a7f('0xb')](),controller[_0x4a7f('0x1a')]);router[_0x4a7f('0x16')](_0x4a7f('0x1b'),controller[_0x4a7f('0x1c')]);router['post'](_0x4a7f('0x1d'),auth['isAuthenticated'](),controller[_0x4a7f('0x1e')]);router['put'](_0x4a7f('0xe'),auth[_0x4a7f('0xb')](),controller[_0x4a7f('0x1f')]);router[_0x4a7f('0x20')](_0x4a7f('0xe'),auth['isAuthenticated'](),controller[_0x4a7f('0x21')]);router[_0x4a7f('0x20')](_0x4a7f('0xf'),auth[_0x4a7f('0xb')](),controller[_0x4a7f('0x22')]);router[_0x4a7f('0x20')](_0x4a7f('0x10'),auth['isAuthenticated'](),controller[_0x4a7f('0x23')]);router[_0x4a7f('0x20')](_0x4a7f('0x12'),auth['isAuthenticated'](),controller[_0x4a7f('0x24')]);module[_0x4a7f('0x25')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index a18304e..2efb936 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 _0x9a69=['STRING','name','generate','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','exports'];(function(_0x33c2ce,_0x2ed4a2){var _0x561ab9=function(_0x5d0e35){while(--_0x5d0e35){_0x33c2ce['push'](_0x33c2ce['shift']());}};_0x561ab9(++_0x2ed4a2);}(_0x9a69,0x144));var _0x99a6=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9a69[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x99a6('0x0')]={'name':{'type':Sequelize[_0x99a6('0x1')],'unique':_0x99a6('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x99a6('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x99a6('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x99a6('0x1')],'defaultValue':function(){return rs[_0x99a6('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x99a6('0x4')]('twilio')},'accountSid':{'type':Sequelize[_0x99a6('0x1')]},'authToken':{'type':Sequelize[_0x99a6('0x1')]},'notificationTemplate':{'type':Sequelize[_0x99a6('0x5')],'defaultValue':function(){return _0x99a6('0x6');}},'notificationSound':{'type':Sequelize[_0x99a6('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x99a6('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x99a6('0x8')],'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[_0x99a6('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x99a6('0x8')],'comment':_0x99a6('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x99a6('0x7')],'defaultValue':![],'comment':_0x99a6('0xa'),'set':function(_0x56f011){if(!_0x56f011){this['setDataValue'](_0x99a6('0xb'),null);}this[_0x99a6('0xc')]('mandatoryDisposition',_0x56f011);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3b48=['generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name'];(function(_0x5ccb61,_0x4446f7){var _0x4117ca=function(_0x24ea5b){while(--_0x24ea5b){_0x5ccb61['push'](_0x5ccb61['shift']());}};_0x4117ca(++_0x4446f7);}(_0x3b48,0x1ea));var _0x83b4=function(_0x41b137,_0x2ac2e3){_0x41b137=_0x41b137-0x0;var _0x2f312e=_0x3b48[_0x41b137];return _0x2f312e;};'use strict';var Sequelize=require(_0x83b4('0x0'));var rs=require('randomstring');module[_0x83b4('0x1')]={'name':{'type':Sequelize[_0x83b4('0x2')],'unique':_0x83b4('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x83b4('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x83b4('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x83b4('0x2')],'defaultValue':function(){return rs[_0x83b4('0x4')]();}},'phone':{'type':Sequelize[_0x83b4('0x2')]},'type':{'type':Sequelize['ENUM']('twilio')},'accountSid':{'type':Sequelize[_0x83b4('0x2')]},'authToken':{'type':Sequelize[_0x83b4('0x2')]},'notificationTemplate':{'type':Sequelize[_0x83b4('0x5')],'defaultValue':function(){return _0x83b4('0x6');}},'notificationSound':{'type':Sequelize[_0x83b4('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x83b4('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x83b4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x83b4('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x83b4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x83b4('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x83b4('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x83b4('0x7')],'defaultValue':![],'comment':_0x83b4('0x9'),'set':function(_0xe14bb9){if(!_0xe14bb9){this[_0x83b4('0xa')](_0x83b4('0xb'),null);}this['setDataValue'](_0x83b4('0xc'),_0xe14bb9);}},'description':{'type':Sequelize[_0x83b4('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 421cad7..5666653 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 _0xa902=['message','result','status','count','offset','set','Content-Range','apply','save','update','destroy','get','WhatsappAccounts','UserProfileResource','end','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','WhatsappAccountId','findOne','nolimit','order','Disposition','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','whatsapp','account','applications','orderBy','Applications','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','mobile','From','replace','whatsapp:','Body','messageId','MessageSid','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','defaults','contact','WhatsappInteraction','interaction','autoclose','close','created','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','entity\x20found','Content-Type','\x0a','json','List','out','Messages','dataValues','push','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./whatsappAccount.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','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0xa902,0x8d));var _0x2a90=function(_0x509fb3,_0x5457de){_0x509fb3=_0x509fb3-0x0;var _0xde30b2=_0xa902[_0x509fb3];return _0xde30b2;};'use strict';var pdf=require(_0x2a90('0x0'));var emlformat=require(_0x2a90('0x1'));var rimraf=require(_0x2a90('0x2'));var zipdir=require(_0x2a90('0x3'));var jsonpatch=require(_0x2a90('0x4'));var rp=require('request-promise');var moment=require(_0x2a90('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2a90('0x6'));var path=require(_0x2a90('0x7'));var sox=require(_0x2a90('0x8'));var csv=require(_0x2a90('0x9'));var ejs=require(_0x2a90('0xa'));var fs=require('fs');var _=require(_0x2a90('0xb'));var squel=require('squel');var crypto=require(_0x2a90('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2a90('0x9'));var querystring=require(_0x2a90('0xd'));var Papa=require(_0x2a90('0xe'));var Redis=require(_0x2a90('0xf'));var authService=require(_0x2a90('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2a90('0x11'));var hardwareService=require(_0x2a90('0x12'));var logger=require(_0x2a90('0x13'))(_0x2a90('0x14'));var utils=require('../../config/utils');var config=require(_0x2a90('0x15'));var db=require('../../mysqldb')['db'];config[_0x2a90('0x16')]=_['defaults'](config[_0x2a90('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x2a90('0x17'))(new Redis(config[_0x2a90('0x16')]));require(_0x2a90('0x18'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x2a90('0x19')]({'port':0x232c});function checkPasswordPattern(_0x3a42df,_0x5a2682,_0x1ff63d){if(_0x1ff63d){var _0x21c648=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x21c648[_0x2a90('0x1a')](_0x5a2682)){return _0x3a42df;}else{throw new db[(_0x2a90('0x1b'))][(_0x2a90('0x1c'))](_0x2a90('0x1d'));}}else{return _0x3a42df;}}function respondWithRpcPromise(_0x2fa60f,_0x10cf94,_0x43eea5,_0x5c3e4b){return new BPromise(function(_0x162f0b,_0x1d9a28){var _0x4190ff=_0x5c3e4b||client;return _0x4190ff['request'](_0x2fa60f,_0x43eea5)[_0x2a90('0x1e')](function(_0x1f51a6){logger[_0x2a90('0x1f')](_0x2a90('0x20'),_0x10cf94,_0x2a90('0x21'));logger[_0x2a90('0x22')](_0x2a90('0x23'),_0x10cf94,_0x2a90('0x21'),JSON[_0x2a90('0x24')](_0x1f51a6));if(_0x1f51a6[_0x2a90('0x25')]){if(_0x1f51a6[_0x2a90('0x25')][_0x2a90('0x26')]===0x1f4){logger['error'](_0x2a90('0x20'),_0x10cf94,_0x1f51a6[_0x2a90('0x25')][_0x2a90('0x27')]);return _0x1d9a28(_0x1f51a6[_0x2a90('0x25')]['message']);}logger[_0x2a90('0x25')](_0x2a90('0x20'),_0x10cf94,_0x1f51a6['error'][_0x2a90('0x27')]);return _0x162f0b(_0x1f51a6[_0x2a90('0x25')][_0x2a90('0x27')]);}else{logger[_0x2a90('0x1f')](_0x2a90('0x20'),_0x10cf94,_0x2a90('0x21'));_0x162f0b(_0x1f51a6[_0x2a90('0x28')][_0x2a90('0x27')]);}})['catch'](function(_0x27f883){logger[_0x2a90('0x25')](_0x2a90('0x20'),_0x10cf94,_0x27f883);_0x1d9a28(_0x27f883);});});}function respondWithStatusCode(_0x40c61a,_0x8544e5){_0x8544e5=_0x8544e5||0xcc;return function(_0x5208d8){if(_0x5208d8){return _0x40c61a['sendStatus'](_0x8544e5);}return _0x40c61a[_0x2a90('0x29')](_0x8544e5)['end']();};}function respondWithResult(_0x53391e,_0x4969c3){_0x4969c3=_0x4969c3||0xc8;return function(_0x2d83b3){if(_0x2d83b3){return _0x53391e[_0x2a90('0x29')](_0x4969c3)['json'](_0x2d83b3);}};}function respondWithFilteredResult(_0x5bd700,_0x1add9a){return function(_0x5b5cc1){if(_0x5b5cc1){var _0x35570e=_0x5b5cc1[_0x2a90('0x2a')],_0x6892e1=_0x1add9a[_0x2a90('0x2b')],_0x3b580f=_0x1add9a[_0x2a90('0x2b')]+_0x1add9a['limit'],_0x27b6b6;if(_0x3b580f>=_0x35570e){_0x3b580f=_0x35570e;_0x27b6b6=0xc8;}else{_0x27b6b6=0xce;}_0x5bd700[_0x2a90('0x29')](_0x27b6b6);return _0x5bd700[_0x2a90('0x2c')](_0x2a90('0x2d'),_0x6892e1+'-'+_0x3b580f+'/'+_0x35570e)['json'](_0x5b5cc1);}return null;};}function patchUpdates(_0x770b19){return function(_0x425d03){try{jsonpatch[_0x2a90('0x2e')](_0x425d03,_0x770b19,!![]);}catch(_0x17dce6){return BPromise['reject'](_0x17dce6);}return _0x425d03[_0x2a90('0x2f')]();};}function saveUpdates(_0x1b5f73,_0xee69e4){return function(_0x38158b){if(_0x38158b){return _0x38158b[_0x2a90('0x30')](_0x1b5f73)[_0x2a90('0x1e')](function(_0x4d4149){return _0x4d4149;});}return null;};}function removeEntity(_0x625c6c,_0xe649cf){return function(_0x1bdebf){if(_0x1bdebf){return _0x1bdebf[_0x2a90('0x31')]()['then'](function(){var _0x1bab1d=_0x1bdebf[_0x2a90('0x32')]({'plain':!![]});var _0x4a8870=_0x2a90('0x33');return db[_0x2a90('0x34')]['destroy']({'where':{'type':_0x4a8870,'resourceId':_0x1bab1d['id']}})['then'](function(){return _0x1bdebf;});})[_0x2a90('0x1e')](function(){_0x625c6c[_0x2a90('0x29')](0xcc)[_0x2a90('0x35')]();});}};}function handleEntityNotFound(_0x4cd36c,_0x445a4a){return function(_0x58c869){if(!_0x58c869){_0x4cd36c[_0x2a90('0x36')](0x194);}return _0x58c869;};}function handleError(_0x4a3e12,_0x347fe2){_0x347fe2=_0x347fe2||0x1f4;return function(_0x5e79ca){logger['error'](_0x5e79ca[_0x2a90('0x37')]);if(_0x5e79ca['name']){delete _0x5e79ca[_0x2a90('0x38')];}_0x4a3e12[_0x2a90('0x29')](_0x347fe2)[_0x2a90('0x39')](_0x5e79ca);};}exports['index']=function(_0x57a2a5,_0x12f858){var _0x3be438={'include':[{'model':db[_0x2a90('0x3a')],'as':_0x2a90('0x3b')}]},_0x4eb7d9={},_0x1cecc2={'count':0x0,'rows':[]};var _0x580667=_[_0x2a90('0x3c')](db[_0x2a90('0x3d')]['rawAttributes'],function(_0x2771e8){return{'name':_0x2771e8[_0x2a90('0x3e')],'type':_0x2771e8[_0x2a90('0x3f')][_0x2a90('0x40')]};});_0x4eb7d9[_0x2a90('0x41')]=_[_0x2a90('0x3c')](_0x580667,_0x2a90('0x38'));_0x4eb7d9[_0x2a90('0x42')]=_[_0x2a90('0x43')](_0x57a2a5[_0x2a90('0x42')]);_0x4eb7d9[_0x2a90('0x44')]=_[_0x2a90('0x45')](_0x4eb7d9[_0x2a90('0x41')],_0x4eb7d9[_0x2a90('0x42')]);_0x3be438['attributes']=_[_0x2a90('0x45')](_0x4eb7d9[_0x2a90('0x41')],qs['fields'](_0x57a2a5[_0x2a90('0x42')][_0x2a90('0x46')]));_0x3be438[_0x2a90('0x47')]=_0x3be438[_0x2a90('0x47')][_0x2a90('0x48')]?_0x3be438['attributes']:_0x4eb7d9[_0x2a90('0x41')];if(!_0x57a2a5['query'][_0x2a90('0x49')]('nolimit')){_0x3be438[_0x2a90('0x4a')]=qs[_0x2a90('0x4a')](_0x57a2a5[_0x2a90('0x42')][_0x2a90('0x4a')]);_0x3be438[_0x2a90('0x2b')]=qs[_0x2a90('0x2b')](_0x57a2a5[_0x2a90('0x42')]['offset']);}_0x3be438['order']=qs[_0x2a90('0x4b')](_0x57a2a5[_0x2a90('0x42')][_0x2a90('0x4b')]);_0x3be438[_0x2a90('0x4c')]=qs[_0x2a90('0x44')](_[_0x2a90('0x4d')](_0x57a2a5[_0x2a90('0x42')],_0x4eb7d9[_0x2a90('0x44')]),_0x580667);if(_0x57a2a5['query'][_0x2a90('0x4e')]){_0x3be438['where']=_[_0x2a90('0x4f')](_0x3be438[_0x2a90('0x4c')],{'$or':_['map'](_0x580667,function(_0x317f63){if(_0x317f63[_0x2a90('0x3f')]!==_0x2a90('0x50')){var _0x1d55db={};_0x1d55db[_0x317f63[_0x2a90('0x38')]]={'$like':'%'+_0x57a2a5[_0x2a90('0x42')][_0x2a90('0x4e')]+'%'};return _0x1d55db;}})});}_0x3be438=_['merge']({},_0x3be438,_0x57a2a5['options']);var _0x34e2a3={'where':_0x3be438[_0x2a90('0x4c')]};return db[_0x2a90('0x3d')][_0x2a90('0x2a')](_0x34e2a3)[_0x2a90('0x1e')](function(_0x5e203f){_0x1cecc2['count']=_0x5e203f;if(_0x57a2a5[_0x2a90('0x42')][_0x2a90('0x51')]){_0x3be438['include']=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x3be438);})[_0x2a90('0x1e')](function(_0x56c5c4){_0x1cecc2[_0x2a90('0x52')]=_0x56c5c4;return _0x1cecc2;})[_0x2a90('0x1e')](respondWithFilteredResult(_0x12f858,_0x3be438))[_0x2a90('0x53')](handleError(_0x12f858,null));};exports[_0x2a90('0x54')]=function(_0x3b2630,_0x3ade08){var _0x4f507a={'raw':![],'where':{'id':_0x3b2630[_0x2a90('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x2a90('0x3b')}]},_0x37f783={};_0x37f783['model']=_['keys'](db[_0x2a90('0x3d')][_0x2a90('0x56')]);_0x37f783['query']=_['keys'](_0x3b2630[_0x2a90('0x42')]);_0x37f783['filters']=_[_0x2a90('0x45')](_0x37f783[_0x2a90('0x41')],_0x37f783['query']);_0x4f507a[_0x2a90('0x47')]=_[_0x2a90('0x45')](_0x37f783[_0x2a90('0x41')],qs['fields'](_0x3b2630[_0x2a90('0x42')][_0x2a90('0x46')]));_0x4f507a['attributes']=_0x4f507a['attributes'][_0x2a90('0x48')]?_0x4f507a[_0x2a90('0x47')]:_0x37f783['model'];if(_0x3b2630[_0x2a90('0x42')]['includeAll']){_0x4f507a[_0x2a90('0x57')]=[{'all':!![]}];}_0x4f507a=_['merge']({},_0x4f507a,_0x3b2630[_0x2a90('0x58')]);return db[_0x2a90('0x3d')][_0x2a90('0x59')](_0x4f507a)['then'](handleEntityNotFound(_0x3ade08,null))['then'](respondWithResult(_0x3ade08,null))['catch'](handleError(_0x3ade08,null));};exports[_0x2a90('0x5a')]=function(_0x37adad,_0x3793e5){return db[_0x2a90('0x3d')][_0x2a90('0x5a')](_0x37adad[_0x2a90('0x5b')],{})[_0x2a90('0x1e')](function(_0x37f34b){var _0x69c213=_0x37adad[_0x2a90('0x5c')][_0x2a90('0x32')]({'plain':!![]});if(!_0x69c213)throw new Error(_0x2a90('0x5d'));if(_0x69c213[_0x2a90('0x5e')]==='user'){var _0x5b99be=_0x37f34b['get']({'plain':!![]});var _0x3550c1=_0x2a90('0x33');return db[_0x2a90('0x5f')][_0x2a90('0x59')]({'where':{'name':_0x3550c1,'userProfileId':_0x69c213[_0x2a90('0x60')]},'raw':!![]})[_0x2a90('0x1e')](function(_0xa82304){if(_0xa82304&&_0xa82304[_0x2a90('0x61')]===0x0){return db[_0x2a90('0x34')][_0x2a90('0x5a')]({'name':_0x5b99be[_0x2a90('0x38')],'resourceId':_0x5b99be['id'],'type':_0xa82304[_0x2a90('0x38')],'sectionId':_0xa82304['id']},{})[_0x2a90('0x1e')](function(){return _0x37f34b;});}else{return _0x37f34b;}})[_0x2a90('0x53')](function(_0x1e370e){logger[_0x2a90('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e370e);throw _0x1e370e;});}return _0x37f34b;})[_0x2a90('0x1e')](respondWithResult(_0x3793e5,0xc9))['catch'](handleError(_0x3793e5,null));};exports[_0x2a90('0x30')]=function(_0x303aae,_0x1a176f){if(_0x303aae[_0x2a90('0x5b')]['id']){delete _0x303aae[_0x2a90('0x5b')]['id'];}return db[_0x2a90('0x3d')][_0x2a90('0x59')]({'where':{'id':_0x303aae['params']['id']},'include':[{'model':db[_0x2a90('0x3a')],'as':_0x2a90('0x3b')}]})[_0x2a90('0x1e')](handleEntityNotFound(_0x1a176f,null))['then'](saveUpdates(_0x303aae[_0x2a90('0x5b')],null))[_0x2a90('0x1e')](respondWithResult(_0x1a176f,null))[_0x2a90('0x53')](handleError(_0x1a176f,null));};exports[_0x2a90('0x31')]=function(_0x502856,_0x18dce7){return db['WhatsappAccount'][_0x2a90('0x59')]({'where':{'id':_0x502856[_0x2a90('0x55')]['id']}})[_0x2a90('0x1e')](handleEntityNotFound(_0x18dce7,null))[_0x2a90('0x1e')](removeEntity(_0x18dce7,null))[_0x2a90('0x53')](handleError(_0x18dce7,null));};exports[_0x2a90('0x62')]=function(_0x4e541a,_0x466513){return db[_0x2a90('0x3d')][_0x2a90('0x62')]()[_0x2a90('0x1e')](respondWithResult(_0x466513,null))[_0x2a90('0x53')](handleError(_0x466513,null));};exports[_0x2a90('0x63')]=function(_0x1bf4f0,_0x3dc85f,_0x1ccf69){if(_0x1bf4f0['body']['id']){delete _0x1bf4f0[_0x2a90('0x5b')]['id'];}return db[_0x2a90('0x3d')][_0x2a90('0x59')]({'where':{'id':_0x1bf4f0['params']['id']}})[_0x2a90('0x1e')](handleEntityNotFound(_0x3dc85f,null))[_0x2a90('0x1e')](function(_0x4565c6){if(_0x4565c6){_0x1bf4f0[_0x2a90('0x5b')][_0x2a90('0x64')]=_0x4565c6['id'];return db['Disposition'][_0x2a90('0x5a')](_0x1bf4f0['body']);}})['then'](respondWithResult(_0x3dc85f,null))[_0x2a90('0x53')](handleError(_0x3dc85f,null));};exports['getDispositions']=function(_0x49dcda,_0x3b24ee,_0x5f3ae1){var _0xac4adb={'raw':![],'where':{}};var _0x1f7261={};var _0x4d680b={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x2a90('0x65')]({'where':{'id':_0x49dcda['params']['id']}})['then'](handleEntityNotFound(_0x3b24ee,null))[_0x2a90('0x1e')](function(_0x164bfd){if(_0x164bfd){_0x1f7261[_0x2a90('0x41')]=_[_0x2a90('0x43')](db['Disposition']['rawAttributes']);_0x1f7261[_0x2a90('0x42')]=_[_0x2a90('0x43')](_0x49dcda[_0x2a90('0x42')]);_0x1f7261[_0x2a90('0x44')]=_[_0x2a90('0x45')](_0x1f7261[_0x2a90('0x41')],_0x1f7261[_0x2a90('0x42')]);_0xac4adb[_0x2a90('0x47')]=_[_0x2a90('0x45')](_0x1f7261[_0x2a90('0x41')],qs[_0x2a90('0x46')](_0x49dcda[_0x2a90('0x42')]['fields']));_0xac4adb[_0x2a90('0x47')]=_0xac4adb['attributes'][_0x2a90('0x48')]?_0xac4adb['attributes']:_0x1f7261[_0x2a90('0x41')];if(!_0x49dcda['query']['hasOwnProperty'](_0x2a90('0x66'))){_0xac4adb[_0x2a90('0x4a')]=qs[_0x2a90('0x4a')](_0x49dcda[_0x2a90('0x42')]['limit']);_0xac4adb['offset']=qs[_0x2a90('0x2b')](_0x49dcda[_0x2a90('0x42')][_0x2a90('0x2b')]);}_0xac4adb[_0x2a90('0x67')]=qs[_0x2a90('0x4b')](_0x49dcda[_0x2a90('0x42')][_0x2a90('0x4b')]);_0xac4adb[_0x2a90('0x4c')]=qs[_0x2a90('0x44')](_[_0x2a90('0x4d')](_0x49dcda[_0x2a90('0x42')],_0x1f7261[_0x2a90('0x44')]));_0xac4adb['where'][_0x2a90('0x64')]=_0x164bfd['id'];if(_0x49dcda[_0x2a90('0x42')][_0x2a90('0x4e')]){_0xac4adb[_0x2a90('0x4c')]=_[_0x2a90('0x4f')](_0xac4adb[_0x2a90('0x4c')],{'$or':_[_0x2a90('0x3c')](_0xac4adb[_0x2a90('0x47')],function(_0x555159){var _0x3de173={};_0x3de173[_0x555159]={'$like':'%'+_0x49dcda[_0x2a90('0x42')]['filter']+'%'};return _0x3de173;})});}_0xac4adb=_[_0x2a90('0x4f')]({},_0xac4adb,_0x49dcda[_0x2a90('0x58')]);return db[_0x2a90('0x68')][_0x2a90('0x2a')]({'where':_0xac4adb[_0x2a90('0x4c')]})[_0x2a90('0x1e')](function(_0x4b4a47){_0x4d680b[_0x2a90('0x2a')]=_0x4b4a47;if(_0x49dcda[_0x2a90('0x42')][_0x2a90('0x51')]){_0xac4adb[_0x2a90('0x57')]=[{'all':!![]}];}return db[_0x2a90('0x68')][_0x2a90('0x69')](_0xac4adb);})[_0x2a90('0x1e')](function(_0x39ffac){_0x4d680b['rows']=_0x39ffac;return _0x4d680b;});}})[_0x2a90('0x1e')](respondWithFilteredResult(_0x3b24ee,_0xac4adb))[_0x2a90('0x53')](handleError(_0x3b24ee,null));};exports[_0x2a90('0x6a')]=function(_0x256346,_0xb6fded,_0x14138e){return db['WhatsappAccount'][_0x2a90('0x59')]({'where':{'id':_0x256346[_0x2a90('0x55')]['id']}})[_0x2a90('0x1e')](handleEntityNotFound(_0xb6fded,null))['then'](function(_0x1e5301){if(_0x1e5301){return _0x1e5301[_0x2a90('0x6a')](_0x256346[_0x2a90('0x42')]['ids']);}})['then'](respondWithStatusCode(_0xb6fded,null))[_0x2a90('0x53')](handleError(_0xb6fded,null));};exports[_0x2a90('0x6b')]=function(_0x4b3965,_0x475fe8,_0x138b07){if(_0x4b3965['body']['id']){delete _0x4b3965[_0x2a90('0x5b')]['id'];}return db[_0x2a90('0x3d')]['find']({'where':{'id':_0x4b3965[_0x2a90('0x55')]['id']}})[_0x2a90('0x1e')](handleEntityNotFound(_0x475fe8,null))['then'](function(_0x58905e){if(_0x58905e){_0x4b3965[_0x2a90('0x5b')][_0x2a90('0x64')]=_0x58905e['id'];return db[_0x2a90('0x6c')][_0x2a90('0x5a')](_0x4b3965[_0x2a90('0x5b')]);}})[_0x2a90('0x1e')](respondWithResult(_0x475fe8,null))[_0x2a90('0x53')](handleError(_0x475fe8,null));};exports[_0x2a90('0x6d')]=function(_0x7c2ab8,_0x9c11df,_0x9019e7){var _0x5ca0fd={'raw':![],'where':{}};var _0x426d21={};var _0x42bac8={'count':0x0,'rows':[]};return db[_0x2a90('0x3d')]['findOne']({'where':{'id':_0x7c2ab8[_0x2a90('0x55')]['id']}})[_0x2a90('0x1e')](handleEntityNotFound(_0x9c11df,null))[_0x2a90('0x1e')](function(_0x480af9){if(_0x480af9){_0x426d21[_0x2a90('0x41')]=_[_0x2a90('0x43')](db[_0x2a90('0x6c')][_0x2a90('0x56')]);_0x426d21[_0x2a90('0x42')]=_[_0x2a90('0x43')](_0x7c2ab8[_0x2a90('0x42')]);_0x426d21['filters']=_['intersection'](_0x426d21[_0x2a90('0x41')],_0x426d21['query']);_0x5ca0fd[_0x2a90('0x47')]=_[_0x2a90('0x45')](_0x426d21['model'],qs[_0x2a90('0x46')](_0x7c2ab8[_0x2a90('0x42')][_0x2a90('0x46')]));_0x5ca0fd[_0x2a90('0x47')]=_0x5ca0fd[_0x2a90('0x47')][_0x2a90('0x48')]?_0x5ca0fd[_0x2a90('0x47')]:_0x426d21[_0x2a90('0x41')];if(!_0x7c2ab8[_0x2a90('0x42')]['hasOwnProperty']('nolimit')){_0x5ca0fd[_0x2a90('0x4a')]=qs[_0x2a90('0x4a')](_0x7c2ab8[_0x2a90('0x42')][_0x2a90('0x4a')]);_0x5ca0fd[_0x2a90('0x2b')]=qs[_0x2a90('0x2b')](_0x7c2ab8[_0x2a90('0x42')][_0x2a90('0x2b')]);}_0x5ca0fd[_0x2a90('0x67')]=qs[_0x2a90('0x4b')](_0x7c2ab8[_0x2a90('0x42')][_0x2a90('0x4b')]);_0x5ca0fd[_0x2a90('0x4c')]=qs[_0x2a90('0x44')](_[_0x2a90('0x4d')](_0x7c2ab8[_0x2a90('0x42')],_0x426d21[_0x2a90('0x44')]));_0x5ca0fd['where'][_0x2a90('0x64')]=_0x480af9['id'];if(_0x7c2ab8[_0x2a90('0x42')][_0x2a90('0x4e')]){_0x5ca0fd[_0x2a90('0x4c')]=_['merge'](_0x5ca0fd[_0x2a90('0x4c')],{'$or':_[_0x2a90('0x3c')](_0x5ca0fd[_0x2a90('0x47')],function(_0x58110b){var _0x33aa20={};_0x33aa20[_0x58110b]={'$like':'%'+_0x7c2ab8[_0x2a90('0x42')][_0x2a90('0x4e')]+'%'};return _0x33aa20;})});}_0x5ca0fd=_[_0x2a90('0x4f')]({},_0x5ca0fd,_0x7c2ab8[_0x2a90('0x58')]);return db['CannedAnswer']['count']({'where':_0x5ca0fd[_0x2a90('0x4c')]})[_0x2a90('0x1e')](function(_0x4ea9f2){_0x42bac8[_0x2a90('0x2a')]=_0x4ea9f2;if(_0x7c2ab8[_0x2a90('0x42')][_0x2a90('0x51')]){_0x5ca0fd[_0x2a90('0x57')]=[{'all':!![]}];}return db[_0x2a90('0x6c')][_0x2a90('0x69')](_0x5ca0fd);})[_0x2a90('0x1e')](function(_0x3411a6){_0x42bac8[_0x2a90('0x52')]=_0x3411a6;return _0x42bac8;});}})[_0x2a90('0x1e')](respondWithFilteredResult(_0x9c11df,_0x5ca0fd))['catch'](handleError(_0x9c11df,null));};exports[_0x2a90('0x6e')]=function(_0xff2b9c,_0x2a6d16,_0x25bf30){return db[_0x2a90('0x3d')][_0x2a90('0x59')]({'where':{'id':_0xff2b9c[_0x2a90('0x55')]['id']}})[_0x2a90('0x1e')](handleEntityNotFound(_0x2a6d16,null))[_0x2a90('0x1e')](function(_0x19347a){if(_0x19347a){return _0x19347a['removeAnswers'](_0xff2b9c[_0x2a90('0x42')][_0x2a90('0x6f')]);}})[_0x2a90('0x1e')](respondWithStatusCode(_0x2a6d16,null))['catch'](handleError(_0x2a6d16,null));};exports[_0x2a90('0x70')]=function(_0x3d639e,_0x1788b5,_0x15ed31){return db[_0x2a90('0x3d')]['find']({'where':{'id':_0x3d639e['params']['id']}})['then'](handleEntityNotFound(_0x1788b5,null))[_0x2a90('0x1e')](function(_0x2815a8){if(_0x2815a8){return _0x2815a8[_0x2a90('0x70')](_0x3d639e[_0x2a90('0x5b')][_0x2a90('0x6f')],_[_0x2a90('0x71')](_0x3d639e[_0x2a90('0x5b')],[_0x2a90('0x6f'),'id'])||{})['spread'](function(_0xb90308){for(var _0x2a141d=0x0;_0x2a141d<_0x3d639e[_0x2a90('0x5b')][_0x2a90('0x6f')][_0x2a90('0x48')];_0x2a141d+=0x1){socket[_0x2a90('0x72')](_0x2a90('0x73'),{'UserId':_0x3d639e[_0x2a90('0x5b')][_0x2a90('0x6f')][_0x2a141d],'WhatsappAccountId':_0x3d639e['params']['id']});}return _0xb90308;});}})[_0x2a90('0x1e')](respondWithResult(_0x1788b5,null))[_0x2a90('0x53')](handleError(_0x1788b5,null));};exports[_0x2a90('0x74')]=function(_0x31c32d,_0x3802fb,_0x2ab408){return db['WhatsappAccount'][_0x2a90('0x59')]({'where':{'id':_0x31c32d[_0x2a90('0x55')]['id']}})[_0x2a90('0x1e')](handleEntityNotFound(_0x3802fb,null))[_0x2a90('0x1e')](function(_0x99b63c){if(_0x99b63c){return _0x99b63c['removeAgents'](_0x31c32d[_0x2a90('0x42')][_0x2a90('0x6f')])[_0x2a90('0x1e')](function(){if(_[_0x2a90('0x75')](_0x31c32d['query'][_0x2a90('0x6f')])){for(var _0x1b0f9a=0x0;_0x1b0f9a<_0x31c32d[_0x2a90('0x42')][_0x2a90('0x6f')]['length'];_0x1b0f9a+=0x1){socket['emit'](_0x2a90('0x76'),{'UserId':Number(_0x31c32d['query'][_0x2a90('0x6f')][_0x1b0f9a]),'WhatsappAccountId':Number(_0x31c32d['params']['id'])});}}else{socket['emit'](_0x2a90('0x76'),{'UserId':Number(_0x31c32d['query'][_0x2a90('0x6f')]),'WhatsappAccountId':Number(_0x31c32d[_0x2a90('0x55')]['id'])});}});}})[_0x2a90('0x1e')](respondWithStatusCode(_0x3802fb,null))[_0x2a90('0x53')](handleError(_0x3802fb,null));};exports[_0x2a90('0x77')]=function(_0x1f2e2a,_0x21ed4c,_0x3fad53){var _0x98059e={};var _0x113799={};var _0x57bf22;var _0x5dd2a5;return db[_0x2a90('0x3d')][_0x2a90('0x65')]({'where':{'id':_0x1f2e2a[_0x2a90('0x55')]['id']}})[_0x2a90('0x1e')](handleEntityNotFound(_0x21ed4c,null))[_0x2a90('0x1e')](function(_0x502829){if(_0x502829){_0x57bf22=_0x502829;_0x113799['model']=_[_0x2a90('0x43')](db[_0x2a90('0x78')][_0x2a90('0x56')]);_0x113799[_0x2a90('0x42')]=_[_0x2a90('0x43')](_0x1f2e2a[_0x2a90('0x42')]);_0x113799[_0x2a90('0x44')]=_[_0x2a90('0x45')](_0x113799['model'],_0x113799[_0x2a90('0x42')]);_0x98059e[_0x2a90('0x47')]=_[_0x2a90('0x45')](_0x113799['model'],qs[_0x2a90('0x46')](_0x1f2e2a[_0x2a90('0x42')][_0x2a90('0x46')]));_0x98059e['attributes']=_0x98059e[_0x2a90('0x47')]['length']?_0x98059e[_0x2a90('0x47')]:_0x113799['model'];_0x98059e[_0x2a90('0x67')]=qs[_0x2a90('0x4b')](_0x1f2e2a[_0x2a90('0x42')][_0x2a90('0x4b')]);_0x98059e[_0x2a90('0x4c')]=qs[_0x2a90('0x44')](_[_0x2a90('0x4d')](_0x1f2e2a[_0x2a90('0x42')],_0x113799[_0x2a90('0x44')]));if(_0x1f2e2a[_0x2a90('0x42')]['filter']){_0x98059e['where']=_[_0x2a90('0x4f')](_0x98059e[_0x2a90('0x4c')],{'$or':_['map'](_0x98059e[_0x2a90('0x47')],function(_0x5650a9){var _0x5cfd26={};_0x5cfd26[_0x5650a9]={'$like':'%'+_0x1f2e2a[_0x2a90('0x42')][_0x2a90('0x4e')]+'%'};return _0x5cfd26;})});}_0x98059e=_[_0x2a90('0x4f')]({},_0x98059e,_0x1f2e2a[_0x2a90('0x58')]);return _0x57bf22[_0x2a90('0x77')](_0x98059e);}})[_0x2a90('0x1e')](function(_0x4efc9f){if(_0x4efc9f){_0x5dd2a5=_0x4efc9f['length'];if(!_0x1f2e2a[_0x2a90('0x42')]['hasOwnProperty'](_0x2a90('0x66'))){_0x98059e[_0x2a90('0x4a')]=qs[_0x2a90('0x4a')](_0x1f2e2a[_0x2a90('0x42')][_0x2a90('0x4a')]);_0x98059e[_0x2a90('0x2b')]=qs[_0x2a90('0x2b')](_0x1f2e2a['query'][_0x2a90('0x2b')]);}return _0x57bf22[_0x2a90('0x77')](_0x98059e);}})[_0x2a90('0x1e')](function(_0x151cdf){if(_0x151cdf){return _0x151cdf?{'count':_0x5dd2a5,'rows':_0x151cdf}:null;}})[_0x2a90('0x1e')](respondWithResult(_0x21ed4c,null))['catch'](handleError(_0x21ed4c,null));};exports[_0x2a90('0x79')]=function(_0x5afd41,_0x59c2e6,_0x490f4a){return db[_0x2a90('0x3d')][_0x2a90('0x65')]({'where':{'id':_0x5afd41[_0x2a90('0x55')]['id']}})['then'](handleEntityNotFound(_0x59c2e6,null))[_0x2a90('0x1e')](function(_0x1232aa){if(_0x1232aa){return db['sequelize'][_0x2a90('0x7a')](function(_0x49842c){return db[_0x2a90('0x7b')]['destroy']({'where':{'WhatsappAccountId':_0x5afd41[_0x2a90('0x55')]['id']},'transaction':_0x49842c})[_0x2a90('0x1e')](function(_0xe7782c){var _0x71a4c1=_[_0x2a90('0x3c')](_0x5afd41[_0x2a90('0x5b')],function(_0x2ffce5){_0x2ffce5['WhatsappAccountId']=_0x5afd41[_0x2a90('0x55')]['id'];return _0x2ffce5;});return db['WhatsappApplication'][_0x2a90('0x7c')](_0x71a4c1,{'transaction':_0x49842c});});})[_0x2a90('0x1e')](function(){return db[_0x2a90('0x7b')][_0x2a90('0x7d')]({'where':{'WhatsappAccountId':_0x5afd41[_0x2a90('0x55')]['id']},'order':_0x2a90('0x7e')});});}})[_0x2a90('0x1e')](respondWithResult(_0x59c2e6,null))[_0x2a90('0x53')](handleError(_0x59c2e6,null));};exports['getApplications']=function(_0x4c51b1,_0x218641,_0x14ca71){var _0x851e88={};var _0x3d9e0e={};var _0x335ed9;var _0x2f901f;return db[_0x2a90('0x3d')][_0x2a90('0x65')]({'where':{'id':_0x4c51b1[_0x2a90('0x55')]['id']}})['then'](handleEntityNotFound(_0x218641,null))['then'](function(_0x4cbd91){if(_0x4cbd91){_0x335ed9=_0x4cbd91;_0x3d9e0e[_0x2a90('0x41')]=_[_0x2a90('0x43')](db[_0x2a90('0x7b')]['rawAttributes']);_0x3d9e0e['query']=_['keys'](_0x4c51b1[_0x2a90('0x42')]);_0x3d9e0e['filters']=_[_0x2a90('0x45')](_0x3d9e0e[_0x2a90('0x41')],_0x3d9e0e[_0x2a90('0x42')]);_0x851e88[_0x2a90('0x47')]=_[_0x2a90('0x45')](_0x3d9e0e[_0x2a90('0x41')],qs[_0x2a90('0x46')](_0x4c51b1[_0x2a90('0x42')]['fields']));_0x851e88[_0x2a90('0x47')]=_0x851e88[_0x2a90('0x47')][_0x2a90('0x48')]?_0x851e88['attributes']:_0x3d9e0e[_0x2a90('0x41')];_0x851e88[_0x2a90('0x67')]=qs[_0x2a90('0x4b')](_0x4c51b1[_0x2a90('0x42')][_0x2a90('0x4b')]);_0x851e88[_0x2a90('0x4c')]=qs[_0x2a90('0x44')](_[_0x2a90('0x4d')](_0x4c51b1['query'],_0x3d9e0e['filters']));if(_0x4c51b1[_0x2a90('0x42')][_0x2a90('0x4e')]){_0x851e88[_0x2a90('0x4c')]=_[_0x2a90('0x4f')](_0x851e88[_0x2a90('0x4c')],{'$or':_['map'](_0x851e88[_0x2a90('0x47')],function(_0x22b28d){var _0x5921b2={};_0x5921b2[_0x22b28d]={'$like':'%'+_0x4c51b1[_0x2a90('0x42')][_0x2a90('0x4e')]+'%'};return _0x5921b2;})});}_0x851e88=_[_0x2a90('0x4f')]({},_0x851e88,_0x4c51b1[_0x2a90('0x58')]);return _0x335ed9[_0x2a90('0x7f')](_0x851e88);}})[_0x2a90('0x1e')](function(_0x2ab2c9){if(_0x2ab2c9){_0x2f901f=_0x2ab2c9[_0x2a90('0x48')];if(!_0x4c51b1[_0x2a90('0x42')]['hasOwnProperty'](_0x2a90('0x66'))){_0x851e88[_0x2a90('0x4a')]=qs[_0x2a90('0x4a')](_0x4c51b1[_0x2a90('0x42')][_0x2a90('0x4a')]);_0x851e88[_0x2a90('0x2b')]=qs[_0x2a90('0x2b')](_0x4c51b1[_0x2a90('0x42')][_0x2a90('0x2b')]);}return _0x335ed9[_0x2a90('0x7f')](_0x851e88);}})[_0x2a90('0x1e')](function(_0x49a248){if(_0x49a248){return _0x49a248?{'count':_0x2f901f,'rows':_0x49a248}:null;}})['then'](respondWithResult(_0x218641,null))[_0x2a90('0x53')](handleError(_0x218641,null));};exports['notify']=function(_0x151dbe,_0x425d34,_0x3e73ba){var _0x279610={'channel':_0x2a90('0x80')};var _0x446263=[];var _0xa52475=[];var _0x4f5bbf={};return db[_0x2a90('0x3d')]['find']({'where':{'id':_0x151dbe[_0x2a90('0x55')]['id']},'include':[{'model':db[_0x2a90('0x7b')],'as':'Applications'}]})[_0x2a90('0x1e')](handleEntityNotFound(_0x425d34,null))[_0x2a90('0x1e')](function(_0x369dca){_0x279610[_0x2a90('0x81')]=_0x369dca;_0x279610[_0x2a90('0x82')]=_[_0x2a90('0x83')](_0x369dca[_0x2a90('0x84')],[_0x2a90('0x7e')],['asc']);if(_0x279610['account']['Applications']){delete _0x279610[_0x2a90('0x81')]['Applications'];}return db['CmContact'][_0x2a90('0x62')]();})['then'](function(_0x596b9e){if(!_0x596b9e){throw new db[(_0x2a90('0x1b'))][(_0x2a90('0x1c'))](_0x2a90('0x85'));}_0x446263=_['difference'](_[_0x2a90('0x43')](_0x596b9e),[_0x2a90('0x86'),_0x2a90('0x87')]);_0xa52475=_[_0x2a90('0x88')](_['keys'](_0x596b9e),[_0x2a90('0x86'),_0x2a90('0x87'),_0x2a90('0x89'),_0x2a90('0x8a')]);_0x279610[_0x2a90('0x5b')]={'mapKey':_0x2a90('0x8b')};if(_0x279610[_0x2a90('0x81')][_0x2a90('0x3f')]&&_0x279610['account'][_0x2a90('0x3f')]==='twilio'){_0x279610[_0x2a90('0x5b')]['from']=_0x151dbe[_0x2a90('0x5b')][_0x2a90('0x8c')][_0x2a90('0x8d')](_0x2a90('0x8e'),'');_0x279610[_0x2a90('0x5b')][_0x2a90('0x5b')]=_0x151dbe[_0x2a90('0x5b')][_0x2a90('0x8f')];_0x279610[_0x2a90('0x5b')][_0x2a90('0x90')]=_0x151dbe[_0x2a90('0x5b')][_0x2a90('0x91')];}if(_0x279610[_0x2a90('0x5b')]['id']){delete _0x279610[_0x2a90('0x5b')]['id'];}if(_['isNil'](_0x279610[_0x2a90('0x5b')][_0x2a90('0x92')])){throw new db[(_0x2a90('0x1b'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x2a90('0x93')](_0x279610[_0x2a90('0x5b')][_0x2a90('0x5b')])||_0x279610[_0x2a90('0x5b')][_0x2a90('0x5b')]===''){throw new db[(_0x2a90('0x1b'))][(_0x2a90('0x1c'))](_0x2a90('0x94'));}if(_[_0x2a90('0x93')](_0x279610['body'][_0x2a90('0x95')])){throw new db['Sequelize']['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xa52475);}if(!_['includes'](_0xa52475,_0x279610[_0x2a90('0x5b')][_0x2a90('0x95')])){throw new db['Sequelize'][(_0x2a90('0x1c'))](_0x2a90('0x96')+_0xa52475);}_0x4f5bbf[_0x279610['body'][_0x2a90('0x95')]]=_0x279610[_0x2a90('0x5b')]['from'];return db[_0x2a90('0x97')][_0x2a90('0x59')]({'where':{'id':_0x279610[_0x2a90('0x81')][_0x2a90('0x8a')]},'include':[{'model':db[_0x2a90('0x98')],'as':_0x2a90('0x99'),'where':_0x4f5bbf,'limit':0x1,'order':[[_0x2a90('0x87'),_0x2a90('0x9a')]]}]});})[_0x2a90('0x1e')](handleEntityNotFound(_0x425d34,null))[_0x2a90('0x1e')](function(_0x4c21a3){if(_0x4c21a3){_0x279610['list']=_[_0x2a90('0x71')](_0x4c21a3,[_0x2a90('0x99')]);if(_0x4c21a3['Contacts'][_0x2a90('0x48')]){return _0x4c21a3[_0x2a90('0x99')][0x0];}var _0x28c8c3=_[_0x2a90('0x9b')](_0x279610[_0x2a90('0x5b')],{'firstName':_0x279610[_0x2a90('0x5b')][_0x2a90('0x92')],'ListId':_0x4c21a3['id']});_0x28c8c3[_0x279610['body']['mapKey']]=_0x279610[_0x2a90('0x5b')]['from'];return db[_0x2a90('0x98')][_0x2a90('0x5a')](_0x28c8c3,{'fields':_0x446263,'raw':!![]});}})[_0x2a90('0x1e')](handleEntityNotFound(_0x425d34,null))[_0x2a90('0x1e')](function(_0x226ed8){if(_0x226ed8){_0x279610[_0x2a90('0x9c')]=_0x226ed8;var _0x13513a={'ContactId':_0x226ed8['id'],'phone':_0x279610['body']['from'],'WhatsappAccountId':_0x151dbe[_0x2a90('0x55')]['id']};var _0x34b8bd={'ContactId':_0x226ed8['id'],'WhatsappAccountId':_0x151dbe['params']['id'],'closed':![]};return db[_0x2a90('0x9d')]['find']({'where':_0x34b8bd})[_0x2a90('0x1e')](function(_0x5092af){if(_0x5092af){return[_0x5092af,![]];}return db[_0x2a90('0x9d')][_0x2a90('0x5a')](_0x13513a)['then'](function(_0x5ad42e){return[_0x5ad42e,!![]];});});}})['spread'](function(_0x1f88bf,_0x3f3c49){_0x279610[_0x2a90('0x9e')]=_0x1f88bf[_0x2a90('0x32')]({'plain':!![]});_0x279610[_0x2a90('0x9e')]['created']=![];if(_0x3f3c49){if(_0x279610[_0x2a90('0x81')][_0x2a90('0x9f')]){_0x279610[_0x2a90('0x82')]['push']({'id':0x0,'priority':_0x279610['applications'][_0x2a90('0x48')]+0x1,'app':_0x2a90('0xa0'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x279610[_0x2a90('0x9e')][_0x2a90('0xa1')]=!![];}return db[_0x2a90('0xa2')]['create']({'phone':_0x279610[_0x2a90('0x5b')][_0x2a90('0x92')],'messageId':_0x279610[_0x2a90('0x5b')]['messageId'],'body':_0x279610[_0x2a90('0x5b')][_0x2a90('0x5b')],'WhatsappAccountId':_0x151dbe['params']['id'],'WhatsappInteractionId':_0x1f88bf['id'],'direction':'in','ContactId':_0x1f88bf[_0x2a90('0xa3')],'AttachmentId':_0x279610[_0x2a90('0x5b')][_0x2a90('0xa4')]});})['then'](function(_0x497267){_0x279610[_0x2a90('0x27')]=_0x497267;if(_0x279610['interaction'][_0x2a90('0xa5')]){return db[_0x2a90('0x78')][_0x2a90('0x59')]({'attributes':['id',_0x2a90('0x38')],'where':{'id':_0x279610[_0x2a90('0x9e')][_0x2a90('0xa5')]}})[_0x2a90('0x1e')](function(_0x4a73d1){if(_0x4a73d1){_0x279610[_0x2a90('0x82')][_0x2a90('0xa6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4a73d1['name']+','+(_0x279610['account'][_0x2a90('0xa7')]||0xa),'interval':_0x2a90('0xa8')});}return respondWithRpcPromise('Start','startRouting',_0x279610);});}return respondWithRpcPromise(_0x2a90('0xa9'),_0x2a90('0xaa'),_0x279610);})[_0x2a90('0x1e')](function(_0x49f096){if(_0x49f096){var _0x4d75d8=0xc8;var _0x8fd8dd='receiveMessage';logger[_0x2a90('0x1f')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x8fd8dd,_0x4d75d8,_0x2a90('0xab'));logger[_0x2a90('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x8fd8dd,_0x4d75d8,'entity\x20found',JSON[_0x2a90('0x24')](_0x49f096));if(_0x279610[_0x2a90('0x81')][_0x2a90('0x3f')]==='twilio'){return _0x425d34['status'](_0x4d75d8)['set'](_0x2a90('0xac'),'text/xml')['send'](_0x2a90('0xad'));}else{return _0x425d34[_0x2a90('0x29')](_0x4d75d8)[_0x2a90('0xae')](_0x49f096);}}})['catch'](handleError(_0x425d34,null));};exports[_0x2a90('0x39')]=function(_0x433a9a,_0x476423,_0x2b3904){var _0x55a871,_0x5c0658,_0x351590;if(_[_0x2a90('0x93')](_0x433a9a[_0x2a90('0x5b')]['body'])||_0x433a9a[_0x2a90('0x5b')][_0x2a90('0x5b')]===''){throw new db[(_0x2a90('0x1b'))]['ValidationError'](_0x2a90('0x94'));}if(_[_0x2a90('0x93')](_0x433a9a['body']['to'])){throw new db[(_0x2a90('0x1b'))][(_0x2a90('0x1c'))]('to\x20is\x20mandatory');}_0x55a871=_0x433a9a[_0x2a90('0x5b')]['to'];return db[_0x2a90('0x3d')][_0x2a90('0x59')]({'where':{'id':_0x433a9a[_0x2a90('0x55')]['id']},'include':[{'model':db[_0x2a90('0x97')],'as':'List','include':[{'model':db[_0x2a90('0x98')],'as':'Contacts','where':{'mobile':_0x55a871},'limit':0x1,'order':[[_0x2a90('0x87'),'DESC']]}]}]})[_0x2a90('0x1e')](handleEntityNotFound(_0x476423,null))[_0x2a90('0x1e')](function(_0x3f9db7){if(_0x3f9db7&&_0x3f9db7[_0x2a90('0xaf')]){_0x5c0658=_0x3f9db7[_0x2a90('0x32')]({'plain':!![]});if(_0x5c0658[_0x2a90('0xaf')]&&_0x5c0658[_0x2a90('0xaf')][_0x2a90('0x99')][_0x2a90('0x48')]){return _0x5c0658['List'][_0x2a90('0x99')][0x0];}return db[_0x2a90('0x98')][_0x2a90('0x5a')](_['defaults'](_0x433a9a['body'],{'firstName':_0x55a871,'mobile':_0x55a871,'phone':_0x55a871,'ListId':_0x5c0658[_0x2a90('0x8a')]}));}})[_0x2a90('0x1e')](handleEntityNotFound(_0x476423,null))[_0x2a90('0x1e')](function(_0x2bf494){if(_0x2bf494){_0x351590=_0x2bf494;return db['WhatsappInteraction']['find']({'where':{'ContactId':_0x351590['id'],'closed':![],'WhatsappAccountId':_0x5c0658['id']}})[_0x2a90('0x1e')](function(_0x417458){if(_0x417458){return[_0x417458,![]];}return db[_0x2a90('0x9d')]['create']({'UserId':_0x433a9a['user']['id'],'ContactId':_0x351590['id'],'WhatsappAccountId':_0x5c0658['id'],'phone':_0x55a871,'firstMsgDirection':_0x2a90('0xb0'),'Messages':[_['merge'](_0x433a9a['body'],{'read':![],'body':_0x433a9a[_0x2a90('0x5b')]['body'],'phone':_0x55a871,'WhatsappAccountId':_0x5c0658['id'],'UserId':_0x433a9a[_0x2a90('0x5c')]['id'],'ContactId':_0x351590['id']})]},{'include':[{'model':db[_0x2a90('0xa2')],'as':_0x2a90('0xb1')}]})[_0x2a90('0x1e')](function(_0x498f3f){return[_0x498f3f,!![]];});});}})['spread'](function(_0x1bf247,_0x5ddce2){if(_0x5ddce2){return _0x1bf247;}return db['WhatsappMessage'][_0x2a90('0x5a')](_['merge'](_0x433a9a[_0x2a90('0x5b')],{'read':![],'body':_0x433a9a['body'][_0x2a90('0x5b')],'phone':_0x55a871,'WhatsappAccountId':_0x5c0658['id'],'WhatsappInteractionId':_0x1bf247['id'],'UserId':_0x433a9a[_0x2a90('0x5c')]['id'],'ContactId':_0x351590['id']}))['then'](function(_0x2022c8){_0x1bf247[_0x2a90('0xb2')][_0x2a90('0xb1')]=[];_0x1bf247[_0x2a90('0xb2')][_0x2a90('0xb1')][_0x2a90('0xb3')](_0x2022c8[_0x2a90('0xb2')]);return _0x1bf247;});})[_0x2a90('0x1e')](respondWithResult(_0x476423,null))[_0x2a90('0x53')](handleError(_0x476423,null));}; \ No newline at end of file +var _0x702d=['offset','set','Content-Range','reject','save','destroy','get','WhatsappAccounts','UserProfileResource','name','index','Pause','WhatsappAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','includeAll','findAll','rows','show','mandatoryDispositionPause','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','update','params','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','nolimit','pick','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','include','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','User','getAgents','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','whatsapp','Applications','account','applications','orderBy','asc','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','replace','whatsapp:','MessageSid','isNil','from','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','DESC','list','omit','Contacts','WhatsappInteraction','created','autoclose','push','close','*,*,*,*','interaction','messageId','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','send','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','WhatsappMessage','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','count'];(function(_0x48368d,_0x5e13b8){var _0x375672=function(_0x5d9601){while(--_0x5d9601){_0x48368d['push'](_0x48368d['shift']());}};_0x375672(++_0x5e13b8);}(_0x702d,0x147));var _0xd702=function(_0x34bb0b,_0x5f2fbc){_0x34bb0b=_0x34bb0b-0x0;var _0x1b331a=_0x702d[_0x34bb0b];return _0x1b331a;};'use strict';var pdf=require(_0xd702('0x0'));var emlformat=require(_0xd702('0x1'));var rimraf=require(_0xd702('0x2'));var zipdir=require(_0xd702('0x3'));var jsonpatch=require(_0xd702('0x4'));var rp=require('request-promise');var moment=require(_0xd702('0x5'));var BPromise=require(_0xd702('0x6'));var Mustache=require(_0xd702('0x7'));var util=require(_0xd702('0x8'));var path=require('path');var sox=require(_0xd702('0x9'));var csv=require('to-csv');var ejs=require(_0xd702('0xa'));var fs=require('fs');var _=require(_0xd702('0xb'));var squel=require(_0xd702('0xc'));var crypto=require('crypto');var jsforce=require(_0xd702('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd702('0xe'));var querystring=require(_0xd702('0xf'));var Papa=require(_0xd702('0x10'));var Redis=require(_0xd702('0x11'));var authService=require(_0xd702('0x12'));var qs=require(_0xd702('0x13'));var as=require(_0xd702('0x14'));var hardwareService=require(_0xd702('0x15'));var logger=require(_0xd702('0x16'))(_0xd702('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xd702('0x18'))['db'];config[_0xd702('0x19')]=_[_0xd702('0x1a')](config['redis'],{'host':_0xd702('0x1b'),'port':0x18eb});var socket=require(_0xd702('0x1c'))(new Redis(config[_0xd702('0x19')]));require(_0xd702('0x1d'))[_0xd702('0x1e')](socket);var jayson=require(_0xd702('0x1f'));var client=jayson['client'][_0xd702('0x20')]({'port':0x232c});function checkPasswordPattern(_0x3ea0ab,_0x5d7978,_0x707b9){if(_0x707b9){var _0x4922f8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4922f8[_0xd702('0x21')](_0x5d7978)){return _0x3ea0ab;}else{throw new db[(_0xd702('0x22'))]['ValidationError'](_0xd702('0x23'));}}else{return _0x3ea0ab;}}function respondWithRpcPromise(_0x2f3e1f,_0x2a87f2,_0x4fdbbd,_0x5b3b1d){return new BPromise(function(_0x2205de,_0x5a296e){var _0x3fbcec=_0x5b3b1d||client;return _0x3fbcec[_0xd702('0x24')](_0x2f3e1f,_0x4fdbbd)[_0xd702('0x25')](function(_0x265b1b){logger[_0xd702('0x26')](_0xd702('0x27'),_0x2a87f2,_0xd702('0x28'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2a87f2,'request\x20sent',JSON[_0xd702('0x29')](_0x265b1b));if(_0x265b1b[_0xd702('0x2a')]){if(_0x265b1b['error'][_0xd702('0x2b')]===0x1f4){logger['error'](_0xd702('0x27'),_0x2a87f2,_0x265b1b['error']['message']);return _0x5a296e(_0x265b1b['error'][_0xd702('0x2c')]);}logger[_0xd702('0x2a')](_0xd702('0x27'),_0x2a87f2,_0x265b1b['error'][_0xd702('0x2c')]);return _0x2205de(_0x265b1b[_0xd702('0x2a')][_0xd702('0x2c')]);}else{logger[_0xd702('0x26')](_0xd702('0x27'),_0x2a87f2,_0xd702('0x28'));_0x2205de(_0x265b1b[_0xd702('0x2d')][_0xd702('0x2c')]);}})[_0xd702('0x2e')](function(_0x50d7ad){logger[_0xd702('0x2a')](_0xd702('0x27'),_0x2a87f2,_0x50d7ad);_0x5a296e(_0x50d7ad);});});}function respondWithStatusCode(_0x25e96a,_0x335202){_0x335202=_0x335202||0xcc;return function(_0xbe4518){if(_0xbe4518){return _0x25e96a[_0xd702('0x2f')](_0x335202);}return _0x25e96a[_0xd702('0x30')](_0x335202)[_0xd702('0x31')]();};}function respondWithResult(_0x5f1084,_0x47c9a2){_0x47c9a2=_0x47c9a2||0xc8;return function(_0x1870b7){if(_0x1870b7){return _0x5f1084[_0xd702('0x30')](_0x47c9a2)['json'](_0x1870b7);}};}function respondWithFilteredResult(_0x45cd22,_0xee8bf1){return function(_0xffdb54){if(_0xffdb54){var _0x2946ae=_0xffdb54[_0xd702('0x32')],_0x56e9cd=_0xee8bf1[_0xd702('0x33')],_0x213c31=_0xee8bf1[_0xd702('0x33')]+_0xee8bf1['limit'],_0x313281;if(_0x213c31>=_0x2946ae){_0x213c31=_0x2946ae;_0x313281=0xc8;}else{_0x313281=0xce;}_0x45cd22[_0xd702('0x30')](_0x313281);return _0x45cd22[_0xd702('0x34')](_0xd702('0x35'),_0x56e9cd+'-'+_0x213c31+'/'+_0x2946ae)['json'](_0xffdb54);}return null;};}function patchUpdates(_0x44f198){return function(_0x563103){try{jsonpatch['apply'](_0x563103,_0x44f198,!![]);}catch(_0xe2fef6){return BPromise[_0xd702('0x36')](_0xe2fef6);}return _0x563103[_0xd702('0x37')]();};}function saveUpdates(_0x4ef1b3,_0x7b8af3){return function(_0x45e31a){if(_0x45e31a){return _0x45e31a['update'](_0x4ef1b3)[_0xd702('0x25')](function(_0x1f7c7e){return _0x1f7c7e;});}return null;};}function removeEntity(_0x10c590,_0xd244cc){return function(_0xa6b40a){if(_0xa6b40a){return _0xa6b40a[_0xd702('0x38')]()[_0xd702('0x25')](function(){var _0x25d2cd=_0xa6b40a[_0xd702('0x39')]({'plain':!![]});var _0x16ea6d=_0xd702('0x3a');return db[_0xd702('0x3b')][_0xd702('0x38')]({'where':{'type':_0x16ea6d,'resourceId':_0x25d2cd['id']}})['then'](function(){return _0xa6b40a;});})[_0xd702('0x25')](function(){_0x10c590[_0xd702('0x30')](0xcc)[_0xd702('0x31')]();});}};}function handleEntityNotFound(_0x36a94b,_0x4733d6){return function(_0x2a2fe0){if(!_0x2a2fe0){_0x36a94b[_0xd702('0x2f')](0x194);}return _0x2a2fe0;};}function handleError(_0x538035,_0x487fe1){_0x487fe1=_0x487fe1||0x1f4;return function(_0x138d54){logger[_0xd702('0x2a')](_0x138d54['stack']);if(_0x138d54['name']){delete _0x138d54[_0xd702('0x3c')];}_0x538035[_0xd702('0x30')](_0x487fe1)['send'](_0x138d54);};}exports[_0xd702('0x3d')]=function(_0x2d810b,_0x2978f7){var _0x4822d9={'include':[{'model':db[_0xd702('0x3e')],'as':'mandatoryDispositionPause'}]},_0x3444c8={},_0x17fa8d={'count':0x0,'rows':[]};var _0x45acfc=_['map'](db[_0xd702('0x3f')][_0xd702('0x40')],function(_0x1ba18e){return{'name':_0x1ba18e[_0xd702('0x41')],'type':_0x1ba18e[_0xd702('0x42')][_0xd702('0x43')]};});_0x3444c8[_0xd702('0x44')]=_[_0xd702('0x45')](_0x45acfc,'name');_0x3444c8[_0xd702('0x46')]=_[_0xd702('0x47')](_0x2d810b[_0xd702('0x46')]);_0x3444c8[_0xd702('0x48')]=_[_0xd702('0x49')](_0x3444c8['model'],_0x3444c8[_0xd702('0x46')]);_0x4822d9[_0xd702('0x4a')]=_[_0xd702('0x49')](_0x3444c8['model'],qs[_0xd702('0x4b')](_0x2d810b[_0xd702('0x46')][_0xd702('0x4b')]));_0x4822d9[_0xd702('0x4a')]=_0x4822d9['attributes'][_0xd702('0x4c')]?_0x4822d9[_0xd702('0x4a')]:_0x3444c8[_0xd702('0x44')];if(!_0x2d810b[_0xd702('0x46')][_0xd702('0x4d')]('nolimit')){_0x4822d9[_0xd702('0x4e')]=qs[_0xd702('0x4e')](_0x2d810b['query']['limit']);_0x4822d9[_0xd702('0x33')]=qs[_0xd702('0x33')](_0x2d810b[_0xd702('0x46')][_0xd702('0x33')]);}_0x4822d9[_0xd702('0x4f')]=qs[_0xd702('0x50')](_0x2d810b[_0xd702('0x46')][_0xd702('0x50')]);_0x4822d9[_0xd702('0x51')]=qs['filters'](_['pick'](_0x2d810b[_0xd702('0x46')],_0x3444c8['filters']),_0x45acfc);if(_0x2d810b[_0xd702('0x46')]['filter']){_0x4822d9[_0xd702('0x51')]=_['merge'](_0x4822d9[_0xd702('0x51')],{'$or':_['map'](_0x45acfc,function(_0x3b712c){if(_0x3b712c[_0xd702('0x42')]!=='VIRTUAL'){var _0x160f5e={};_0x160f5e[_0x3b712c[_0xd702('0x3c')]]={'$like':'%'+_0x2d810b[_0xd702('0x46')][_0xd702('0x52')]+'%'};return _0x160f5e;}})});}_0x4822d9=_[_0xd702('0x53')]({},_0x4822d9,_0x2d810b['options']);var _0x31c4ea={'where':_0x4822d9[_0xd702('0x51')]};return db[_0xd702('0x3f')]['count'](_0x31c4ea)[_0xd702('0x25')](function(_0x4c9d5c){_0x17fa8d[_0xd702('0x32')]=_0x4c9d5c;if(_0x2d810b[_0xd702('0x46')][_0xd702('0x54')]){_0x4822d9['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0xd702('0x55')](_0x4822d9);})[_0xd702('0x25')](function(_0x21cc89){_0x17fa8d[_0xd702('0x56')]=_0x21cc89;return _0x17fa8d;})[_0xd702('0x25')](respondWithFilteredResult(_0x2978f7,_0x4822d9))[_0xd702('0x2e')](handleError(_0x2978f7,null));};exports[_0xd702('0x57')]=function(_0xbd8515,_0x7da555){var _0x20f879={'raw':![],'where':{'id':_0xbd8515['params']['id']},'include':[{'model':db[_0xd702('0x3e')],'as':_0xd702('0x58')}]},_0x4e7c4d={};_0x4e7c4d[_0xd702('0x44')]=_['keys'](db['WhatsappAccount'][_0xd702('0x40')]);_0x4e7c4d['query']=_[_0xd702('0x47')](_0xbd8515[_0xd702('0x46')]);_0x4e7c4d[_0xd702('0x48')]=_[_0xd702('0x49')](_0x4e7c4d[_0xd702('0x44')],_0x4e7c4d[_0xd702('0x46')]);_0x20f879[_0xd702('0x4a')]=_[_0xd702('0x49')](_0x4e7c4d[_0xd702('0x44')],qs['fields'](_0xbd8515[_0xd702('0x46')][_0xd702('0x4b')]));_0x20f879[_0xd702('0x4a')]=_0x20f879[_0xd702('0x4a')]['length']?_0x20f879[_0xd702('0x4a')]:_0x4e7c4d['model'];if(_0xbd8515[_0xd702('0x46')]['includeAll']){_0x20f879['include']=[{'all':!![]}];}_0x20f879=_[_0xd702('0x53')]({},_0x20f879,_0xbd8515[_0xd702('0x59')]);return db[_0xd702('0x3f')][_0xd702('0x5a')](_0x20f879)[_0xd702('0x25')](handleEntityNotFound(_0x7da555,null))[_0xd702('0x25')](respondWithResult(_0x7da555,null))['catch'](handleError(_0x7da555,null));};exports[_0xd702('0x5b')]=function(_0x211c71,_0x55719b){return db[_0xd702('0x3f')][_0xd702('0x5b')](_0x211c71[_0xd702('0x5c')],{})[_0xd702('0x25')](function(_0x34a194){var _0x27e588=_0x211c71['user'][_0xd702('0x39')]({'plain':!![]});if(!_0x27e588)throw new Error(_0xd702('0x5d'));if(_0x27e588[_0xd702('0x5e')]===_0xd702('0x5f')){var _0xd35a05=_0x34a194['get']({'plain':!![]});var _0x56ae09=_0xd702('0x3a');return db['UserProfileSection']['find']({'where':{'name':_0x56ae09,'userProfileId':_0x27e588[_0xd702('0x60')]},'raw':!![]})['then'](function(_0x2a30cf){if(_0x2a30cf&&_0x2a30cf[_0xd702('0x61')]===0x0){return db[_0xd702('0x3b')][_0xd702('0x5b')]({'name':_0xd35a05['name'],'resourceId':_0xd35a05['id'],'type':_0x2a30cf[_0xd702('0x3c')],'sectionId':_0x2a30cf['id']},{})['then'](function(){return _0x34a194;});}else{return _0x34a194;}})[_0xd702('0x2e')](function(_0x540b95){logger[_0xd702('0x2a')](_0xd702('0x62'),_0x540b95);throw _0x540b95;});}return _0x34a194;})[_0xd702('0x25')](respondWithResult(_0x55719b,0xc9))[_0xd702('0x2e')](handleError(_0x55719b,null));};exports[_0xd702('0x63')]=function(_0x1b9588,_0x1ae410){if(_0x1b9588['body']['id']){delete _0x1b9588['body']['id'];}return db[_0xd702('0x3f')]['find']({'where':{'id':_0x1b9588[_0xd702('0x64')]['id']},'include':[{'model':db[_0xd702('0x3e')],'as':'mandatoryDispositionPause'}]})[_0xd702('0x25')](handleEntityNotFound(_0x1ae410,null))[_0xd702('0x25')](saveUpdates(_0x1b9588['body'],null))[_0xd702('0x25')](respondWithResult(_0x1ae410,null))['catch'](handleError(_0x1ae410,null));};exports[_0xd702('0x38')]=function(_0x392618,_0x47576e){return db[_0xd702('0x3f')]['find']({'where':{'id':_0x392618[_0xd702('0x64')]['id']}})[_0xd702('0x25')](handleEntityNotFound(_0x47576e,null))[_0xd702('0x25')](removeEntity(_0x47576e,null))[_0xd702('0x2e')](handleError(_0x47576e,null));};exports[_0xd702('0x65')]=function(_0x5a04c7,_0x42be8f){return db[_0xd702('0x3f')][_0xd702('0x65')]()[_0xd702('0x25')](respondWithResult(_0x42be8f,null))[_0xd702('0x2e')](handleError(_0x42be8f,null));};exports[_0xd702('0x66')]=function(_0x4faf20,_0x2e0d0b,_0x4f3e4f){if(_0x4faf20[_0xd702('0x5c')]['id']){delete _0x4faf20[_0xd702('0x5c')]['id'];}return db[_0xd702('0x3f')][_0xd702('0x5a')]({'where':{'id':_0x4faf20['params']['id']}})[_0xd702('0x25')](handleEntityNotFound(_0x2e0d0b,null))[_0xd702('0x25')](function(_0x43f5bf){if(_0x43f5bf){_0x4faf20[_0xd702('0x5c')][_0xd702('0x67')]=_0x43f5bf['id'];return db['Disposition']['create'](_0x4faf20[_0xd702('0x5c')]);}})[_0xd702('0x25')](respondWithResult(_0x2e0d0b,null))[_0xd702('0x2e')](handleError(_0x2e0d0b,null));};exports[_0xd702('0x68')]=function(_0x3fb0b1,_0x3cbc7c,_0x117820){var _0xdeae4a={'raw':![],'where':{}};var _0xb40a91={};var _0x36226b={'count':0x0,'rows':[]};return db[_0xd702('0x3f')][_0xd702('0x69')]({'where':{'id':_0x3fb0b1[_0xd702('0x64')]['id']}})[_0xd702('0x25')](handleEntityNotFound(_0x3cbc7c,null))[_0xd702('0x25')](function(_0x1dc107){if(_0x1dc107){_0xb40a91['model']=_[_0xd702('0x47')](db['Disposition']['rawAttributes']);_0xb40a91[_0xd702('0x46')]=_['keys'](_0x3fb0b1[_0xd702('0x46')]);_0xb40a91[_0xd702('0x48')]=_[_0xd702('0x49')](_0xb40a91[_0xd702('0x44')],_0xb40a91[_0xd702('0x46')]);_0xdeae4a[_0xd702('0x4a')]=_[_0xd702('0x49')](_0xb40a91[_0xd702('0x44')],qs[_0xd702('0x4b')](_0x3fb0b1[_0xd702('0x46')][_0xd702('0x4b')]));_0xdeae4a[_0xd702('0x4a')]=_0xdeae4a[_0xd702('0x4a')][_0xd702('0x4c')]?_0xdeae4a[_0xd702('0x4a')]:_0xb40a91[_0xd702('0x44')];if(!_0x3fb0b1[_0xd702('0x46')][_0xd702('0x4d')](_0xd702('0x6a'))){_0xdeae4a['limit']=qs[_0xd702('0x4e')](_0x3fb0b1[_0xd702('0x46')][_0xd702('0x4e')]);_0xdeae4a[_0xd702('0x33')]=qs[_0xd702('0x33')](_0x3fb0b1['query'][_0xd702('0x33')]);}_0xdeae4a[_0xd702('0x4f')]=qs['sort'](_0x3fb0b1[_0xd702('0x46')][_0xd702('0x50')]);_0xdeae4a[_0xd702('0x51')]=qs['filters'](_[_0xd702('0x6b')](_0x3fb0b1[_0xd702('0x46')],_0xb40a91['filters']));_0xdeae4a[_0xd702('0x51')][_0xd702('0x67')]=_0x1dc107['id'];if(_0x3fb0b1[_0xd702('0x46')][_0xd702('0x52')]){_0xdeae4a[_0xd702('0x51')]=_[_0xd702('0x53')](_0xdeae4a[_0xd702('0x51')],{'$or':_[_0xd702('0x45')](_0xdeae4a[_0xd702('0x4a')],function(_0x2426d7){var _0x1e7dfd={};_0x1e7dfd[_0x2426d7]={'$like':'%'+_0x3fb0b1['query'][_0xd702('0x52')]+'%'};return _0x1e7dfd;})});}_0xdeae4a=_[_0xd702('0x53')]({},_0xdeae4a,_0x3fb0b1['options']);return db[_0xd702('0x6c')][_0xd702('0x32')]({'where':_0xdeae4a[_0xd702('0x51')]})[_0xd702('0x25')](function(_0x117745){_0x36226b['count']=_0x117745;if(_0x3fb0b1['query'][_0xd702('0x54')]){_0xdeae4a['include']=[{'all':!![]}];}return db[_0xd702('0x6c')][_0xd702('0x55')](_0xdeae4a);})[_0xd702('0x25')](function(_0x2eb542){_0x36226b[_0xd702('0x56')]=_0x2eb542;return _0x36226b;});}})['then'](respondWithFilteredResult(_0x3cbc7c,_0xdeae4a))[_0xd702('0x2e')](handleError(_0x3cbc7c,null));};exports['removeDispositions']=function(_0x12e796,_0x45ba8b,_0x42c4c0){return db[_0xd702('0x3f')][_0xd702('0x5a')]({'where':{'id':_0x12e796[_0xd702('0x64')]['id']}})['then'](handleEntityNotFound(_0x45ba8b,null))['then'](function(_0x337be0){if(_0x337be0){return _0x337be0[_0xd702('0x6d')](_0x12e796['query'][_0xd702('0x6e')]);}})[_0xd702('0x25')](respondWithStatusCode(_0x45ba8b,null))['catch'](handleError(_0x45ba8b,null));};exports['addAnswer']=function(_0x3d4efc,_0x1622c2,_0x303ed9){if(_0x3d4efc['body']['id']){delete _0x3d4efc[_0xd702('0x5c')]['id'];}return db[_0xd702('0x3f')][_0xd702('0x5a')]({'where':{'id':_0x3d4efc[_0xd702('0x64')]['id']}})[_0xd702('0x25')](handleEntityNotFound(_0x1622c2,null))[_0xd702('0x25')](function(_0x2d2b99){if(_0x2d2b99){_0x3d4efc[_0xd702('0x5c')][_0xd702('0x67')]=_0x2d2b99['id'];return db[_0xd702('0x6f')]['create'](_0x3d4efc[_0xd702('0x5c')]);}})[_0xd702('0x25')](respondWithResult(_0x1622c2,null))[_0xd702('0x2e')](handleError(_0x1622c2,null));};exports[_0xd702('0x70')]=function(_0x5149e2,_0x3c40d7,_0x2248fa){var _0x273e98={'raw':![],'where':{}};var _0x89c45={};var _0x2f3abf={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x5149e2['params']['id']}})[_0xd702('0x25')](handleEntityNotFound(_0x3c40d7,null))[_0xd702('0x25')](function(_0x209a8d){if(_0x209a8d){_0x89c45[_0xd702('0x44')]=_[_0xd702('0x47')](db[_0xd702('0x6f')][_0xd702('0x40')]);_0x89c45['query']=_[_0xd702('0x47')](_0x5149e2[_0xd702('0x46')]);_0x89c45[_0xd702('0x48')]=_['intersection'](_0x89c45['model'],_0x89c45[_0xd702('0x46')]);_0x273e98['attributes']=_['intersection'](_0x89c45[_0xd702('0x44')],qs['fields'](_0x5149e2['query']['fields']));_0x273e98[_0xd702('0x4a')]=_0x273e98[_0xd702('0x4a')]['length']?_0x273e98[_0xd702('0x4a')]:_0x89c45['model'];if(!_0x5149e2[_0xd702('0x46')][_0xd702('0x4d')](_0xd702('0x6a'))){_0x273e98['limit']=qs['limit'](_0x5149e2[_0xd702('0x46')][_0xd702('0x4e')]);_0x273e98[_0xd702('0x33')]=qs['offset'](_0x5149e2[_0xd702('0x46')][_0xd702('0x33')]);}_0x273e98['order']=qs['sort'](_0x5149e2[_0xd702('0x46')][_0xd702('0x50')]);_0x273e98[_0xd702('0x51')]=qs[_0xd702('0x48')](_['pick'](_0x5149e2[_0xd702('0x46')],_0x89c45[_0xd702('0x48')]));_0x273e98['where'][_0xd702('0x67')]=_0x209a8d['id'];if(_0x5149e2[_0xd702('0x46')][_0xd702('0x52')]){_0x273e98['where']=_['merge'](_0x273e98[_0xd702('0x51')],{'$or':_[_0xd702('0x45')](_0x273e98['attributes'],function(_0x34ac3c){var _0x218dc8={};_0x218dc8[_0x34ac3c]={'$like':'%'+_0x5149e2[_0xd702('0x46')][_0xd702('0x52')]+'%'};return _0x218dc8;})});}_0x273e98=_[_0xd702('0x53')]({},_0x273e98,_0x5149e2[_0xd702('0x59')]);return db['CannedAnswer'][_0xd702('0x32')]({'where':_0x273e98['where']})['then'](function(_0x3e84ac){_0x2f3abf[_0xd702('0x32')]=_0x3e84ac;if(_0x5149e2['query'][_0xd702('0x54')]){_0x273e98[_0xd702('0x71')]=[{'all':!![]}];}return db[_0xd702('0x6f')][_0xd702('0x55')](_0x273e98);})[_0xd702('0x25')](function(_0x34800e){_0x2f3abf['rows']=_0x34800e;return _0x2f3abf;});}})[_0xd702('0x25')](respondWithFilteredResult(_0x3c40d7,_0x273e98))[_0xd702('0x2e')](handleError(_0x3c40d7,null));};exports[_0xd702('0x72')]=function(_0x404240,_0x269402,_0x50b784){return db[_0xd702('0x3f')][_0xd702('0x5a')]({'where':{'id':_0x404240[_0xd702('0x64')]['id']}})[_0xd702('0x25')](handleEntityNotFound(_0x269402,null))['then'](function(_0x276aab){if(_0x276aab){return _0x276aab[_0xd702('0x72')](_0x404240[_0xd702('0x46')][_0xd702('0x6e')]);}})[_0xd702('0x25')](respondWithStatusCode(_0x269402,null))['catch'](handleError(_0x269402,null));};exports[_0xd702('0x73')]=function(_0x4e375c,_0x31a2e6,_0x53d1ce){return db[_0xd702('0x3f')][_0xd702('0x5a')]({'where':{'id':_0x4e375c[_0xd702('0x64')]['id']}})[_0xd702('0x25')](handleEntityNotFound(_0x31a2e6,null))['then'](function(_0x3c2c50){if(_0x3c2c50){return _0x3c2c50[_0xd702('0x73')](_0x4e375c[_0xd702('0x5c')][_0xd702('0x6e')],_['omit'](_0x4e375c[_0xd702('0x5c')],[_0xd702('0x6e'),'id'])||{})[_0xd702('0x74')](function(_0xd85103){for(var _0xb2daad=0x0;_0xb2daad<_0x4e375c[_0xd702('0x5c')][_0xd702('0x6e')][_0xd702('0x4c')];_0xb2daad+=0x1){socket[_0xd702('0x75')](_0xd702('0x76'),{'UserId':_0x4e375c[_0xd702('0x5c')][_0xd702('0x6e')][_0xb2daad],'WhatsappAccountId':_0x4e375c['params']['id']});}return _0xd85103;});}})[_0xd702('0x25')](respondWithResult(_0x31a2e6,null))[_0xd702('0x2e')](handleError(_0x31a2e6,null));};exports[_0xd702('0x77')]=function(_0x21c5e9,_0x5959cd,_0x45b898){return db[_0xd702('0x3f')][_0xd702('0x5a')]({'where':{'id':_0x21c5e9['params']['id']}})[_0xd702('0x25')](handleEntityNotFound(_0x5959cd,null))[_0xd702('0x25')](function(_0x13b45c){if(_0x13b45c){return _0x13b45c['removeAgents'](_0x21c5e9['query'][_0xd702('0x6e')])['then'](function(){if(_['isArray'](_0x21c5e9[_0xd702('0x46')][_0xd702('0x6e')])){for(var _0x1cb93d=0x0;_0x1cb93d<_0x21c5e9[_0xd702('0x46')][_0xd702('0x6e')][_0xd702('0x4c')];_0x1cb93d+=0x1){socket[_0xd702('0x75')](_0xd702('0x78'),{'UserId':Number(_0x21c5e9[_0xd702('0x46')][_0xd702('0x6e')][_0x1cb93d]),'WhatsappAccountId':Number(_0x21c5e9['params']['id'])});}}else{socket[_0xd702('0x75')](_0xd702('0x78'),{'UserId':Number(_0x21c5e9[_0xd702('0x46')]['ids']),'WhatsappAccountId':Number(_0x21c5e9[_0xd702('0x64')]['id'])});}});}})[_0xd702('0x25')](respondWithStatusCode(_0x5959cd,null))[_0xd702('0x2e')](handleError(_0x5959cd,null));};exports['getAgents']=function(_0x4b3919,_0x547810,_0x5d65eb){var _0x15dc8d={};var _0x8418f4={};var _0x297bd5;var _0x3e3cbf;return db[_0xd702('0x3f')][_0xd702('0x69')]({'where':{'id':_0x4b3919['params']['id']}})[_0xd702('0x25')](handleEntityNotFound(_0x547810,null))[_0xd702('0x25')](function(_0x18498d){if(_0x18498d){_0x297bd5=_0x18498d;_0x8418f4[_0xd702('0x44')]=_[_0xd702('0x47')](db[_0xd702('0x79')]['rawAttributes']);_0x8418f4[_0xd702('0x46')]=_[_0xd702('0x47')](_0x4b3919[_0xd702('0x46')]);_0x8418f4[_0xd702('0x48')]=_[_0xd702('0x49')](_0x8418f4[_0xd702('0x44')],_0x8418f4[_0xd702('0x46')]);_0x15dc8d[_0xd702('0x4a')]=_['intersection'](_0x8418f4[_0xd702('0x44')],qs[_0xd702('0x4b')](_0x4b3919['query'][_0xd702('0x4b')]));_0x15dc8d['attributes']=_0x15dc8d[_0xd702('0x4a')][_0xd702('0x4c')]?_0x15dc8d['attributes']:_0x8418f4[_0xd702('0x44')];_0x15dc8d[_0xd702('0x4f')]=qs[_0xd702('0x50')](_0x4b3919[_0xd702('0x46')][_0xd702('0x50')]);_0x15dc8d[_0xd702('0x51')]=qs[_0xd702('0x48')](_[_0xd702('0x6b')](_0x4b3919[_0xd702('0x46')],_0x8418f4['filters']));if(_0x4b3919[_0xd702('0x46')][_0xd702('0x52')]){_0x15dc8d['where']=_['merge'](_0x15dc8d[_0xd702('0x51')],{'$or':_[_0xd702('0x45')](_0x15dc8d[_0xd702('0x4a')],function(_0x4b6ea3){var _0x584ac3={};_0x584ac3[_0x4b6ea3]={'$like':'%'+_0x4b3919[_0xd702('0x46')][_0xd702('0x52')]+'%'};return _0x584ac3;})});}_0x15dc8d=_[_0xd702('0x53')]({},_0x15dc8d,_0x4b3919[_0xd702('0x59')]);return _0x297bd5[_0xd702('0x7a')](_0x15dc8d);}})[_0xd702('0x25')](function(_0x199291){if(_0x199291){_0x3e3cbf=_0x199291[_0xd702('0x4c')];if(!_0x4b3919['query'][_0xd702('0x4d')](_0xd702('0x6a'))){_0x15dc8d['limit']=qs['limit'](_0x4b3919[_0xd702('0x46')][_0xd702('0x4e')]);_0x15dc8d['offset']=qs[_0xd702('0x33')](_0x4b3919[_0xd702('0x46')]['offset']);}return _0x297bd5['getAgents'](_0x15dc8d);}})[_0xd702('0x25')](function(_0x5afa90){if(_0x5afa90){return _0x5afa90?{'count':_0x3e3cbf,'rows':_0x5afa90}:null;}})['then'](respondWithResult(_0x547810,null))[_0xd702('0x2e')](handleError(_0x547810,null));};exports['addApplications']=function(_0x146046,_0x29e224,_0x2a47be){return db[_0xd702('0x3f')]['findOne']({'where':{'id':_0x146046['params']['id']}})[_0xd702('0x25')](handleEntityNotFound(_0x29e224,null))[_0xd702('0x25')](function(_0x1c8bbb){if(_0x1c8bbb){return db['sequelize'][_0xd702('0x7b')](function(_0x1f09a6){return db[_0xd702('0x7c')][_0xd702('0x38')]({'where':{'WhatsappAccountId':_0x146046['params']['id']},'transaction':_0x1f09a6})[_0xd702('0x25')](function(_0x412684){var _0x32d262=_['map'](_0x146046['body'],function(_0x3369e3){_0x3369e3['WhatsappAccountId']=_0x146046[_0xd702('0x64')]['id'];return _0x3369e3;});return db[_0xd702('0x7c')][_0xd702('0x7d')](_0x32d262,{'transaction':_0x1f09a6});});})[_0xd702('0x25')](function(){return db[_0xd702('0x7c')][_0xd702('0x7e')]({'where':{'WhatsappAccountId':_0x146046[_0xd702('0x64')]['id']},'order':_0xd702('0x7f')});});}})[_0xd702('0x25')](respondWithResult(_0x29e224,null))[_0xd702('0x2e')](handleError(_0x29e224,null));};exports['getApplications']=function(_0x540de7,_0x458e64,_0x380508){var _0x1fb877={};var _0x4a50d9={};var _0x45c55f;var _0x5c956d;return db[_0xd702('0x3f')][_0xd702('0x69')]({'where':{'id':_0x540de7['params']['id']}})['then'](handleEntityNotFound(_0x458e64,null))[_0xd702('0x25')](function(_0x4600dd){if(_0x4600dd){_0x45c55f=_0x4600dd;_0x4a50d9[_0xd702('0x44')]=_[_0xd702('0x47')](db[_0xd702('0x7c')][_0xd702('0x40')]);_0x4a50d9['query']=_[_0xd702('0x47')](_0x540de7[_0xd702('0x46')]);_0x4a50d9['filters']=_[_0xd702('0x49')](_0x4a50d9[_0xd702('0x44')],_0x4a50d9[_0xd702('0x46')]);_0x1fb877[_0xd702('0x4a')]=_[_0xd702('0x49')](_0x4a50d9['model'],qs[_0xd702('0x4b')](_0x540de7[_0xd702('0x46')][_0xd702('0x4b')]));_0x1fb877['attributes']=_0x1fb877[_0xd702('0x4a')][_0xd702('0x4c')]?_0x1fb877[_0xd702('0x4a')]:_0x4a50d9[_0xd702('0x44')];_0x1fb877[_0xd702('0x4f')]=qs[_0xd702('0x50')](_0x540de7[_0xd702('0x46')][_0xd702('0x50')]);_0x1fb877[_0xd702('0x51')]=qs[_0xd702('0x48')](_['pick'](_0x540de7['query'],_0x4a50d9[_0xd702('0x48')]));if(_0x540de7[_0xd702('0x46')][_0xd702('0x52')]){_0x1fb877['where']=_[_0xd702('0x53')](_0x1fb877['where'],{'$or':_[_0xd702('0x45')](_0x1fb877[_0xd702('0x4a')],function(_0x2c5aed){var _0x5133dd={};_0x5133dd[_0x2c5aed]={'$like':'%'+_0x540de7[_0xd702('0x46')]['filter']+'%'};return _0x5133dd;})});}_0x1fb877=_[_0xd702('0x53')]({},_0x1fb877,_0x540de7[_0xd702('0x59')]);return _0x45c55f[_0xd702('0x80')](_0x1fb877);}})[_0xd702('0x25')](function(_0x3b8d97){if(_0x3b8d97){_0x5c956d=_0x3b8d97[_0xd702('0x4c')];if(!_0x540de7[_0xd702('0x46')][_0xd702('0x4d')]('nolimit')){_0x1fb877[_0xd702('0x4e')]=qs['limit'](_0x540de7[_0xd702('0x46')][_0xd702('0x4e')]);_0x1fb877[_0xd702('0x33')]=qs[_0xd702('0x33')](_0x540de7[_0xd702('0x46')][_0xd702('0x33')]);}return _0x45c55f[_0xd702('0x80')](_0x1fb877);}})[_0xd702('0x25')](function(_0x286adf){if(_0x286adf){return _0x286adf?{'count':_0x5c956d,'rows':_0x286adf}:null;}})[_0xd702('0x25')](respondWithResult(_0x458e64,null))[_0xd702('0x2e')](handleError(_0x458e64,null));};exports['notify']=function(_0x46a4f7,_0x590813,_0x2113a6){var _0x2acf66={'channel':_0xd702('0x81')};var _0x4bf3db=[];var _0x374feb=[];var _0x28e50a={};return db['WhatsappAccount'][_0xd702('0x5a')]({'where':{'id':_0x46a4f7[_0xd702('0x64')]['id']},'include':[{'model':db[_0xd702('0x7c')],'as':_0xd702('0x82')}]})[_0xd702('0x25')](handleEntityNotFound(_0x590813,null))['then'](function(_0x523214){_0x2acf66[_0xd702('0x83')]=_0x523214;_0x2acf66[_0xd702('0x84')]=_[_0xd702('0x85')](_0x523214['Applications'],['priority'],[_0xd702('0x86')]);if(_0x2acf66[_0xd702('0x83')][_0xd702('0x82')]){delete _0x2acf66[_0xd702('0x83')][_0xd702('0x82')];}return db[_0xd702('0x87')][_0xd702('0x65')]();})[_0xd702('0x25')](function(_0x146d17){if(!_0x146d17){throw new db[(_0xd702('0x22'))]['ValidationError'](_0xd702('0x88'));}_0x4bf3db=_[_0xd702('0x89')](_[_0xd702('0x47')](_0x146d17),[_0xd702('0x8a'),'updatedAt']);_0x374feb=_[_0xd702('0x89')](_[_0xd702('0x47')](_0x146d17),[_0xd702('0x8a'),_0xd702('0x8b'),_0xd702('0x8c'),_0xd702('0x8d')]);_0x2acf66[_0xd702('0x5c')]={'mapKey':_0xd702('0x8e')};if(_0x2acf66[_0xd702('0x83')][_0xd702('0x42')]&&_0x2acf66[_0xd702('0x83')][_0xd702('0x42')]===_0xd702('0x8f')){_0x2acf66[_0xd702('0x5c')]['from']=_0x46a4f7[_0xd702('0x5c')][_0xd702('0x90')][_0xd702('0x91')](_0xd702('0x92'),'');_0x2acf66['body'][_0xd702('0x5c')]=_0x46a4f7[_0xd702('0x5c')]['Body'];_0x2acf66[_0xd702('0x5c')]['messageId']=_0x46a4f7['body'][_0xd702('0x93')];}if(_0x2acf66[_0xd702('0x5c')]['id']){delete _0x2acf66[_0xd702('0x5c')]['id'];}if(_[_0xd702('0x94')](_0x2acf66[_0xd702('0x5c')][_0xd702('0x95')])){throw new db[(_0xd702('0x22'))][(_0xd702('0x96'))](_0xd702('0x97'));}if(_[_0xd702('0x94')](_0x2acf66[_0xd702('0x5c')][_0xd702('0x5c')])||_0x2acf66['body']['body']===''){throw new db['Sequelize'][(_0xd702('0x96'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xd702('0x94')](_0x2acf66[_0xd702('0x5c')][_0xd702('0x98')])){throw new db[(_0xd702('0x22'))]['ValidationError'](_0xd702('0x99')+_0x374feb);}if(!_[_0xd702('0x9a')](_0x374feb,_0x2acf66['body'][_0xd702('0x98')])){throw new db[(_0xd702('0x22'))][(_0xd702('0x96'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x374feb);}_0x28e50a[_0x2acf66[_0xd702('0x5c')][_0xd702('0x98')]]=_0x2acf66[_0xd702('0x5c')][_0xd702('0x95')];return db[_0xd702('0x9b')]['find']({'where':{'id':_0x2acf66[_0xd702('0x83')][_0xd702('0x8d')]},'include':[{'model':db[_0xd702('0x87')],'as':'Contacts','where':_0x28e50a,'limit':0x1,'order':[['updatedAt',_0xd702('0x9c')]]}]});})[_0xd702('0x25')](handleEntityNotFound(_0x590813,null))[_0xd702('0x25')](function(_0x1a898c){if(_0x1a898c){_0x2acf66[_0xd702('0x9d')]=_[_0xd702('0x9e')](_0x1a898c,['Contacts']);if(_0x1a898c['Contacts'][_0xd702('0x4c')]){return _0x1a898c[_0xd702('0x9f')][0x0];}var _0x122bcc=_[_0xd702('0x1a')](_0x2acf66['body'],{'firstName':_0x2acf66['body']['from'],'ListId':_0x1a898c['id']});_0x122bcc[_0x2acf66['body']['mapKey']]=_0x2acf66[_0xd702('0x5c')][_0xd702('0x95')];return db[_0xd702('0x87')][_0xd702('0x5b')](_0x122bcc,{'fields':_0x4bf3db,'raw':!![]});}})[_0xd702('0x25')](handleEntityNotFound(_0x590813,null))['then'](function(_0x16f39b){if(_0x16f39b){_0x2acf66['contact']=_0x16f39b;var _0x53371c={'ContactId':_0x16f39b['id'],'phone':_0x2acf66[_0xd702('0x5c')][_0xd702('0x95')],'WhatsappAccountId':_0x46a4f7[_0xd702('0x64')]['id']};var _0x20f258={'ContactId':_0x16f39b['id'],'WhatsappAccountId':_0x46a4f7[_0xd702('0x64')]['id'],'closed':![]};return db[_0xd702('0xa0')][_0xd702('0x5a')]({'where':_0x20f258})[_0xd702('0x25')](function(_0x9edf97){if(_0x9edf97){return[_0x9edf97,![]];}return db[_0xd702('0xa0')][_0xd702('0x5b')](_0x53371c)[_0xd702('0x25')](function(_0x2d79af){return[_0x2d79af,!![]];});});}})[_0xd702('0x74')](function(_0x40e7fd,_0x1fa6fe){_0x2acf66['interaction']=_0x40e7fd[_0xd702('0x39')]({'plain':!![]});_0x2acf66['interaction'][_0xd702('0xa1')]=![];if(_0x1fa6fe){if(_0x2acf66[_0xd702('0x83')][_0xd702('0xa2')]){_0x2acf66[_0xd702('0x84')][_0xd702('0xa3')]({'id':0x0,'priority':_0x2acf66[_0xd702('0x84')]['length']+0x1,'app':_0xd702('0xa4'),'appdata':'unmanaged','interval':_0xd702('0xa5')});}_0x2acf66[_0xd702('0xa6')][_0xd702('0xa1')]=!![];}return db['WhatsappMessage'][_0xd702('0x5b')]({'phone':_0x2acf66[_0xd702('0x5c')][_0xd702('0x95')],'messageId':_0x2acf66[_0xd702('0x5c')][_0xd702('0xa7')],'body':_0x2acf66[_0xd702('0x5c')][_0xd702('0x5c')],'WhatsappAccountId':_0x46a4f7[_0xd702('0x64')]['id'],'WhatsappInteractionId':_0x40e7fd['id'],'direction':'in','ContactId':_0x40e7fd[_0xd702('0xa8')],'AttachmentId':_0x2acf66[_0xd702('0x5c')][_0xd702('0xa9')]});})[_0xd702('0x25')](function(_0x357d06){_0x2acf66[_0xd702('0x2c')]=_0x357d06;if(_0x2acf66['interaction'][_0xd702('0xaa')]){return db['User'][_0xd702('0x5a')]({'attributes':['id',_0xd702('0x3c')],'where':{'id':_0x2acf66[_0xd702('0xa6')]['UserId']}})['then'](function(_0x57abaf){if(_0x57abaf){_0x2acf66[_0xd702('0x84')][_0xd702('0xab')]({'id':0x0,'priority':0x0,'app':_0xd702('0xac'),'appdata':_0x57abaf[_0xd702('0x3c')]+','+(_0x2acf66['account'][_0xd702('0xad')]||0xa),'interval':_0xd702('0xa5')});}return respondWithRpcPromise('Start',_0xd702('0xae'),_0x2acf66);});}return respondWithRpcPromise(_0xd702('0xaf'),_0xd702('0xae'),_0x2acf66);})[_0xd702('0x25')](function(_0x541d4d){if(_0x541d4d){var _0x140f98=0xc8;var _0x1f7072=_0xd702('0xb0');logger[_0xd702('0x26')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1f7072,_0x140f98,_0xd702('0xb1'));logger['debug'](_0xd702('0xb2'),_0x1f7072,_0x140f98,'entity\x20found',JSON[_0xd702('0x29')](_0x541d4d));if(_0x2acf66[_0xd702('0x83')][_0xd702('0x42')]===_0xd702('0x8f')){return _0x590813[_0xd702('0x30')](_0x140f98)[_0xd702('0x34')](_0xd702('0xb3'),_0xd702('0xb4'))['send'](_0xd702('0xb5'));}else{return _0x590813[_0xd702('0x30')](_0x140f98)['json'](_0x541d4d);}}})['catch'](handleError(_0x590813,null));};exports[_0xd702('0xb6')]=function(_0x50ad0f,_0x34ad1d,_0x3b90e7){var _0x2fb84a,_0x3c2f2a,_0x51143d;if(_[_0xd702('0x94')](_0x50ad0f['body'][_0xd702('0x5c')])||_0x50ad0f[_0xd702('0x5c')][_0xd702('0x5c')]===''){throw new db[(_0xd702('0x22'))][(_0xd702('0x96'))](_0xd702('0xb7'));}if(_[_0xd702('0x94')](_0x50ad0f['body']['to'])){throw new db[(_0xd702('0x22'))][(_0xd702('0x96'))](_0xd702('0xb8'));}_0x2fb84a=_0x50ad0f[_0xd702('0x5c')]['to'];return db[_0xd702('0x3f')][_0xd702('0x5a')]({'where':{'id':_0x50ad0f[_0xd702('0x64')]['id']},'include':[{'model':db[_0xd702('0x9b')],'as':_0xd702('0xb9'),'include':[{'model':db['CmContact'],'as':_0xd702('0x9f'),'where':{'mobile':_0x2fb84a},'limit':0x1,'order':[[_0xd702('0x8b'),'DESC']]}]}]})[_0xd702('0x25')](handleEntityNotFound(_0x34ad1d,null))[_0xd702('0x25')](function(_0x7bdf82){if(_0x7bdf82&&_0x7bdf82['List']){_0x3c2f2a=_0x7bdf82[_0xd702('0x39')]({'plain':!![]});if(_0x3c2f2a[_0xd702('0xb9')]&&_0x3c2f2a[_0xd702('0xb9')][_0xd702('0x9f')][_0xd702('0x4c')]){return _0x3c2f2a[_0xd702('0xb9')][_0xd702('0x9f')][0x0];}return db['CmContact'][_0xd702('0x5b')](_[_0xd702('0x1a')](_0x50ad0f[_0xd702('0x5c')],{'firstName':_0x2fb84a,'mobile':_0x2fb84a,'phone':_0x2fb84a,'ListId':_0x3c2f2a[_0xd702('0x8d')]}));}})[_0xd702('0x25')](handleEntityNotFound(_0x34ad1d,null))[_0xd702('0x25')](function(_0x578ff5){if(_0x578ff5){_0x51143d=_0x578ff5;return db[_0xd702('0xa0')][_0xd702('0x5a')]({'where':{'ContactId':_0x51143d['id'],'closed':![],'WhatsappAccountId':_0x3c2f2a['id']}})[_0xd702('0x25')](function(_0xf5b643){if(_0xf5b643){return[_0xf5b643,![]];}return db[_0xd702('0xa0')][_0xd702('0x5b')]({'UserId':_0x50ad0f['user']['id'],'ContactId':_0x51143d['id'],'WhatsappAccountId':_0x3c2f2a['id'],'phone':_0x2fb84a,'firstMsgDirection':'out','Messages':[_[_0xd702('0x53')](_0x50ad0f[_0xd702('0x5c')],{'read':![],'body':_0x50ad0f['body'][_0xd702('0x5c')],'phone':_0x2fb84a,'WhatsappAccountId':_0x3c2f2a['id'],'UserId':_0x50ad0f[_0xd702('0x5f')]['id'],'ContactId':_0x51143d['id']})]},{'include':[{'model':db[_0xd702('0xba')],'as':_0xd702('0xbb')}]})[_0xd702('0x25')](function(_0x5510f1){return[_0x5510f1,!![]];});});}})[_0xd702('0x74')](function(_0x579e17,_0x342c6d){if(_0x342c6d){return _0x579e17;}return db[_0xd702('0xba')][_0xd702('0x5b')](_[_0xd702('0x53')](_0x50ad0f[_0xd702('0x5c')],{'read':![],'body':_0x50ad0f[_0xd702('0x5c')][_0xd702('0x5c')],'phone':_0x2fb84a,'WhatsappAccountId':_0x3c2f2a['id'],'WhatsappInteractionId':_0x579e17['id'],'UserId':_0x50ad0f[_0xd702('0x5f')]['id'],'ContactId':_0x51143d['id']}))[_0xd702('0x25')](function(_0x19bc8c){_0x579e17[_0xd702('0xbc')][_0xd702('0xbb')]=[];_0x579e17[_0xd702('0xbc')][_0xd702('0xbb')][_0xd702('0xa3')](_0x19bc8c['dataValues']);return _0x579e17;});})[_0xd702('0x25')](respondWithResult(_0x34ad1d,null))[_0xd702('0x2e')](handleError(_0x34ad1d,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 74aa7a8..0273b9b 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 _0xeda8=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xeda8,0x104));var _0x8eda=function(_0x2f991a,_0x2f7c94){_0x2f991a=_0x2f991a-0x0;var _0x2280f9=_0xeda8[_0x2f991a];return _0x2280f9;};'use strict';var EventEmitter=require(_0x8eda('0x0'));var WhatsappAccount=require(_0x8eda('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x8eda('0x2')](0x0);var events={'afterCreate':_0x8eda('0x3'),'afterUpdate':_0x8eda('0x4'),'afterDestroy':_0x8eda('0x5')};function emitEvent(_0x37ab2c){return function(_0x94b83f,_0x25b19a,_0x3eb7b1){WhatsappAccountEvents[_0x8eda('0x6')](_0x37ab2c+':'+_0x94b83f['id'],_0x94b83f);WhatsappAccountEvents[_0x8eda('0x6')](_0x37ab2c,_0x94b83f);_0x3eb7b1(null);};}for(var e in events){if(events[_0x8eda('0x7')](e)){var event=events[e];WhatsappAccount[_0x8eda('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x36c3=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x510e49,_0x175854){var _0x354c5f=function(_0x460e3d){while(--_0x460e3d){_0x510e49['push'](_0x510e49['shift']());}};_0x354c5f(++_0x175854);}(_0x36c3,0x1a6));var _0x336c=function(_0x2f831f,_0x412036){_0x2f831f=_0x2f831f-0x0;var _0x245a02=_0x36c3[_0x2f831f];return _0x245a02;};'use strict';var EventEmitter=require(_0x336c('0x0'));var WhatsappAccount=require(_0x336c('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x336c('0x2')](0x0);var events={'afterCreate':_0x336c('0x3'),'afterUpdate':_0x336c('0x4'),'afterDestroy':_0x336c('0x5')};function emitEvent(_0x32aed2){return function(_0x2b1194,_0x39ed12,_0x4e4c07){WhatsappAccountEvents[_0x336c('0x6')](_0x32aed2+':'+_0x2b1194['id'],_0x2b1194);WhatsappAccountEvents[_0x336c('0x6')](_0x32aed2,_0x2b1194);_0x4e4c07(null);};}for(var e in events){if(events[_0x336c('0x7')](e)){var event=events[e];WhatsappAccount[_0x336c('0x8')](e,emitEvent(event));}}module[_0x336c('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 7487784..5e4adfd 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 _0xb120=['path','rimraf','./whatsappAccount.attributes','exports','define','util','moment','bluebird','request-promise'];(function(_0x12152c,_0x506592){var _0x309af9=function(_0x35d483){while(--_0x35d483){_0x12152c['push'](_0x12152c['shift']());}};_0x309af9(++_0x506592);}(_0xb120,0x1eb));var _0x0b12=function(_0x1d9d82,_0x256573){_0x1d9d82=_0x1d9d82-0x0;var _0x2b02bd=_0xb120[_0x1d9d82];return _0x2b02bd;};'use strict';var _=require('lodash');var util=require(_0x0b12('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0b12('0x1'));var BPromise=require(_0x0b12('0x2'));var rp=require(_0x0b12('0x3'));var fs=require('fs');var path=require(_0x0b12('0x4'));var rimraf=require(_0x0b12('0x5'));var config=require('../../config/environment');var attributes=require(_0x0b12('0x6'));module[_0x0b12('0x7')]=function(_0x5d36ed,_0x25a034){return _0x5d36ed[_0x0b12('0x8')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7199=['./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5be42b,_0x4f0f1a){var _0x3731f3=function(_0x474b7c){while(--_0x474b7c){_0x5be42b['push'](_0x5be42b['shift']());}};_0x3731f3(++_0x4f0f1a);}(_0x7199,0xf3));var _0x9719=function(_0x5001fe,_0x536ea4){_0x5001fe=_0x5001fe-0x0;var _0x4b419b=_0x7199[_0x5001fe];return _0x4b419b;};'use strict';var _=require(_0x9719('0x0'));var util=require(_0x9719('0x1'));var logger=require('../../config/logger')(_0x9719('0x2'));var moment=require(_0x9719('0x3'));var BPromise=require(_0x9719('0x4'));var rp=require(_0x9719('0x5'));var fs=require('fs');var path=require(_0x9719('0x6'));var rimraf=require(_0x9719('0x7'));var config=require(_0x9719('0x8'));var attributes=require(_0x9719('0x9'));module[_0x9719('0xa')]=function(_0x35a214,_0x878f0e){return _0x35a214[_0x9719('0xb')](_0x9719('0xc'),attributes,{'tableName':_0x9719('0xd'),'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 69fda39..5e8a4d5 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 _0x2162=['find','options','raw','include','map','model','attributes','ShowWhatsappAccount','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch'];(function(_0x4904af,_0x4418bc){var _0x2a2f45=function(_0x282c43){while(--_0x282c43){_0x4904af['push'](_0x4904af['shift']());}};_0x2a2f45(++_0x4418bc);}(_0x2162,0x110));var _0x2216=function(_0x8a5fd8,_0x1273e7){_0x8a5fd8=_0x8a5fd8-0x0;var _0xd1b48a=_0x2162[_0x8a5fd8];return _0xd1b48a;};'use strict';var _=require('lodash');var util=require(_0x2216('0x0'));var moment=require('moment');var BPromise=require(_0x2216('0x1'));var rs=require(_0x2216('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2216('0x3'))['db'];var utils=require(_0x2216('0x4'));var logger=require('../../config/logger')(_0x2216('0x5'));var config=require(_0x2216('0x6'));var jayson=require(_0x2216('0x7'));var client=jayson['client'][_0x2216('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2216('0x9')],{'host':_0x2216('0xa'),'port':0x18eb});var socket=require(_0x2216('0xb'))(new Redis(config[_0x2216('0x9')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x5ef687,_0x4b16f8,_0x26087b){return new BPromise(function(_0x291559,_0x4bae57){return client[_0x2216('0xc')](_0x5ef687,_0x26087b)[_0x2216('0xd')](function(_0x462180){logger[_0x2216('0xe')]('WhatsappAccount,\x20%s,\x20%s',_0x4b16f8,_0x2216('0xf'));logger[_0x2216('0x10')](_0x2216('0x11'),_0x4b16f8,_0x2216('0xf'),JSON[_0x2216('0x12')](_0x462180));if(_0x462180[_0x2216('0x13')]){if(_0x462180[_0x2216('0x13')][_0x2216('0x14')]===0x1f4){logger['error'](_0x2216('0x15'),_0x4b16f8,_0x462180[_0x2216('0x13')]['message']);return _0x4bae57(_0x462180[_0x2216('0x13')]['message']);}logger[_0x2216('0x13')](_0x2216('0x15'),_0x4b16f8,_0x462180[_0x2216('0x13')][_0x2216('0x16')]);return _0x291559(_0x462180[_0x2216('0x13')][_0x2216('0x16')]);}else{logger[_0x2216('0xe')](_0x2216('0x15'),_0x4b16f8,_0x2216('0xf'));_0x291559(_0x462180[_0x2216('0x17')][_0x2216('0x16')]);}})[_0x2216('0x18')](function(_0x376a36){logger[_0x2216('0x13')](_0x2216('0x15'),_0x4b16f8,_0x376a36);_0x4bae57(_0x376a36);});});}exports['ShowWhatsappAccount']=function(_0x1157f7){var _0x36708c=this;return new Promise(function(_0x41ac4b,_0x230faa){return db['WhatsappAccount'][_0x2216('0x19')]({'raw':_0x1157f7[_0x2216('0x1a')]?_0x1157f7[_0x2216('0x1a')][_0x2216('0x1b')]===undefined?!![]:![]:!![],'where':_0x1157f7['options']?_0x1157f7['options']['where']||null:null,'attributes':_0x1157f7[_0x2216('0x1a')]?_0x1157f7[_0x2216('0x1a')]['attributes']||null:null,'include':_0x1157f7[_0x2216('0x1a')]?_0x1157f7[_0x2216('0x1a')][_0x2216('0x1c')]?_[_0x2216('0x1d')](_0x1157f7[_0x2216('0x1a')]['include'],function(_0x204cd3){return{'model':db[_0x204cd3[_0x2216('0x1e')]],'as':_0x204cd3['as'],'attributes':_0x204cd3[_0x2216('0x1f')],'include':_0x204cd3[_0x2216('0x1c')]?_['map'](_0x204cd3[_0x2216('0x1c')],function(_0x2399aa){return{'model':db[_0x2399aa[_0x2216('0x1e')]],'as':_0x2399aa['as'],'attributes':_0x2399aa[_0x2216('0x1f')],'include':_0x2399aa[_0x2216('0x1c')]?_[_0x2216('0x1d')](_0x2399aa[_0x2216('0x1c')],function(_0x208d9f){return{'model':db[_0x208d9f['model']],'as':_0x208d9f['as'],'attributes':_0x208d9f[_0x2216('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d8bfc){logger[_0x2216('0xe')]('ShowWhatsappAccount',_0x1157f7);logger[_0x2216('0x10')]('ShowWhatsappAccount',_0x1157f7,JSON[_0x2216('0x12')](_0x4d8bfc));_0x41ac4b(_0x4d8bfc);})[_0x2216('0x18')](function(_0x43d172){logger[_0x2216('0x13')](_0x2216('0x20'),_0x43d172[_0x2216('0x16')],_0x1157f7);_0x230faa(_0x36708c[_0x2216('0x13')](0x1f4,_0x43d172[_0x2216('0x16')]));});});}; \ No newline at end of file +var _0x57ff=['bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','defaults','localhost','redis','./whatsappAccount.socket','request','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include','map','model','info','stringify','catch','lodash','util'];(function(_0x18b3d9,_0x5af99f){var _0x15197d=function(_0x36b190){while(--_0x36b190){_0x18b3d9['push'](_0x18b3d9['shift']());}};_0x15197d(++_0x5af99f);}(_0x57ff,0x127));var _0xf57f=function(_0x5d7866,_0x440af2){_0x5d7866=_0x5d7866-0x0;var _0x429213=_0x57ff[_0x5d7866];return _0x429213;};'use strict';var _=require(_0xf57f('0x0'));var util=require(_0xf57f('0x1'));var moment=require('moment');var BPromise=require(_0xf57f('0x2'));var rs=require(_0xf57f('0x3'));var fs=require('fs');var Redis=require(_0xf57f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf57f('0x5'));var logger=require('../../config/logger')(_0xf57f('0x6'));var config=require('../../config/environment');var jayson=require(_0xf57f('0x7'));var client=jayson[_0xf57f('0x8')][_0xf57f('0x9')]({'port':0x232a});config['redis']=_[_0xf57f('0xa')](config['redis'],{'host':_0xf57f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf57f('0xc')]));require(_0xf57f('0xd'))['register'](socket);function respondWithRpcPromise(_0x53ed49,_0x2a412a,_0x44317c){return new BPromise(function(_0x5b5392,_0x538a7b){return client[_0xf57f('0xe')](_0x53ed49,_0x44317c)['then'](function(_0x181948){logger['info'](_0xf57f('0xf'),_0x2a412a,'request\x20sent');logger[_0xf57f('0x10')](_0xf57f('0x11'),_0x2a412a,'request\x20sent',JSON['stringify'](_0x181948));if(_0x181948[_0xf57f('0x12')]){if(_0x181948[_0xf57f('0x12')]['code']===0x1f4){logger[_0xf57f('0x12')](_0xf57f('0xf'),_0x2a412a,_0x181948[_0xf57f('0x12')][_0xf57f('0x13')]);return _0x538a7b(_0x181948[_0xf57f('0x12')]['message']);}logger[_0xf57f('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x2a412a,_0x181948[_0xf57f('0x12')]['message']);return _0x5b5392(_0x181948[_0xf57f('0x12')][_0xf57f('0x13')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x2a412a,'request\x20sent');_0x5b5392(_0x181948[_0xf57f('0x14')][_0xf57f('0x13')]);}})['catch'](function(_0x2495be){logger[_0xf57f('0x12')](_0xf57f('0xf'),_0x2a412a,_0x2495be);_0x538a7b(_0x2495be);});});}exports[_0xf57f('0x15')]=function(_0x34990a){var _0x53d8c2=this;return new Promise(function(_0x7aa56b,_0xfdb61c){return db[_0xf57f('0x16')][_0xf57f('0x17')]({'raw':_0x34990a['options']?_0x34990a[_0xf57f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x34990a['options']?_0x34990a[_0xf57f('0x18')][_0xf57f('0x19')]||null:null,'attributes':_0x34990a[_0xf57f('0x18')]?_0x34990a[_0xf57f('0x18')][_0xf57f('0x1a')]||null:null,'include':_0x34990a[_0xf57f('0x18')]?_0x34990a['options'][_0xf57f('0x1b')]?_[_0xf57f('0x1c')](_0x34990a['options'][_0xf57f('0x1b')],function(_0x314b7d){return{'model':db[_0x314b7d['model']],'as':_0x314b7d['as'],'attributes':_0x314b7d[_0xf57f('0x1a')],'include':_0x314b7d[_0xf57f('0x1b')]?_[_0xf57f('0x1c')](_0x314b7d[_0xf57f('0x1b')],function(_0x1d3acf){return{'model':db[_0x1d3acf[_0xf57f('0x1d')]],'as':_0x1d3acf['as'],'attributes':_0x1d3acf[_0xf57f('0x1a')],'include':_0x1d3acf['include']?_[_0xf57f('0x1c')](_0x1d3acf[_0xf57f('0x1b')],function(_0x5ac761){return{'model':db[_0x5ac761[_0xf57f('0x1d')]],'as':_0x5ac761['as'],'attributes':_0x5ac761[_0xf57f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x38e4a0){logger[_0xf57f('0x1e')]('ShowWhatsappAccount',_0x34990a);logger['debug'](_0xf57f('0x15'),_0x34990a,JSON[_0xf57f('0x1f')](_0x38e4a0));_0x7aa56b(_0x38e4a0);})[_0xf57f('0x20')](function(_0x1002bb){logger[_0xf57f('0x12')](_0xf57f('0x15'),_0x1002bb[_0xf57f('0x13')],_0x34990a);_0xfdb61c(_0x53d8c2['error'](0x1f4,_0x1002bb[_0xf57f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 2249b12..9f4cd56 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 _0x64ac=['./whatsappAccount.events','save','remove','update','removeListener','register','length','whatsappAccount:'];(function(_0x2424da,_0x4f3961){var _0x5a2920=function(_0x2d8264){while(--_0x2d8264){_0x2424da['push'](_0x2424da['shift']());}};_0x5a2920(++_0x4f3961);}(_0x64ac,0x1a0));var _0xc64a=function(_0x2bd014,_0x4912ff){_0x2bd014=_0x2bd014-0x0;var _0x370575=_0x64ac[_0x2bd014];return _0x370575;};'use strict';var WhatsappAccountEvents=require(_0xc64a('0x0'));var events=[_0xc64a('0x1'),_0xc64a('0x2'),_0xc64a('0x3')];function createListener(_0x33527e,_0xd3f6cc){return function(_0x322eb7){_0xd3f6cc['emit'](_0x33527e,_0x322eb7);};}function removeListener(_0x2f975b,_0x2403fd){return function(){WhatsappAccountEvents[_0xc64a('0x4')](_0x2f975b,_0x2403fd);};}exports[_0xc64a('0x5')]=function(_0x3eb58b){for(var _0x45d94d=0x0,_0x3e2d48=events[_0xc64a('0x6')];_0x45d94d<_0x3e2d48;_0x45d94d++){var _0x14bdbe=events[_0x45d94d];var _0x151fc2=createListener(_0xc64a('0x7')+_0x14bdbe,_0x3eb58b);WhatsappAccountEvents['on'](_0x14bdbe,_0x151fc2);}}; \ No newline at end of file +var _0x97b2=['remove','update','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x97b2,0x66));var _0x297b=function(_0x122e9b,_0x391bf4){_0x122e9b=_0x122e9b-0x0;var _0x22c247=_0x97b2[_0x122e9b];return _0x22c247;};'use strict';var WhatsappAccountEvents=require(_0x297b('0x0'));var events=[_0x297b('0x1'),_0x297b('0x2'),_0x297b('0x3')];function createListener(_0x2b2a77,_0x17a2a9){return function(_0x9ca20d){_0x17a2a9['emit'](_0x2b2a77,_0x9ca20d);};}function removeListener(_0x3ac559,_0x20ae97){return function(){WhatsappAccountEvents[_0x297b('0x4')](_0x3ac559,_0x20ae97);};}exports[_0x297b('0x5')]=function(_0x31044e){for(var _0x297244=0x0,_0x6f94d9=events[_0x297b('0x6')];_0x297244<_0x6f94d9;_0x297244++){var _0x4d8070=events[_0x297244];var _0x3cf193=createListener(_0x297b('0x7')+_0x4d8070,_0x31044e);WhatsappAccountEvents['on'](_0x4d8070,_0x3cf193);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index d6f4f51..3f7ed6f 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 _0x2bec=['update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x7b2422,_0x1d50d2){var _0x4c9642=function(_0x919578){while(--_0x919578){_0x7b2422['push'](_0x7b2422['shift']());}};_0x4c9642(++_0x1d50d2);}(_0x2bec,0x159));var _0xc2be=function(_0x219c8c,_0x428175){_0x219c8c=_0x219c8c-0x0;var _0x28f172=_0x2bec[_0x219c8c];return _0x28f172;};'use strict';var multer=require(_0xc2be('0x0'));var util=require(_0xc2be('0x1'));var path=require(_0xc2be('0x2'));var timeout=require(_0xc2be('0x3'));var express=require('express');var router=express[_0xc2be('0x4')]();var auth=require(_0xc2be('0x5'));var interaction=require(_0xc2be('0x6'));var config=require(_0xc2be('0x7'));var controller=require('./whatsappApplication.controller');router[_0xc2be('0x8')]('/',auth[_0xc2be('0x9')](),controller[_0xc2be('0xa')]);router[_0xc2be('0x8')](_0xc2be('0xb'),auth['isAuthenticated'](),controller[_0xc2be('0xc')]);router[_0xc2be('0xd')]('/',auth[_0xc2be('0x9')](),controller[_0xc2be('0xe')]);router[_0xc2be('0xf')](_0xc2be('0xb'),auth[_0xc2be('0x9')](),controller[_0xc2be('0x10')]);router[_0xc2be('0x11')](_0xc2be('0xb'),auth[_0xc2be('0x9')](),controller[_0xc2be('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5b52=['connect-timeout','express','../../config/environment','get','isAuthenticated','/:id','show','create','put','update','exports','path'];(function(_0x4b0d3c,_0x2e2f88){var _0x46a07b=function(_0x17bfec){while(--_0x17bfec){_0x4b0d3c['push'](_0x4b0d3c['shift']());}};_0x46a07b(++_0x2e2f88);}(_0x5b52,0x143));var _0x25b5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5b52[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x25b5('0x0'));var timeout=require(_0x25b5('0x1'));var express=require(_0x25b5('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x25b5('0x3'));var controller=require('./whatsappApplication.controller');router[_0x25b5('0x4')]('/',auth[_0x25b5('0x5')](),controller['index']);router[_0x25b5('0x4')](_0x25b5('0x6'),auth[_0x25b5('0x5')](),controller[_0x25b5('0x7')]);router['post']('/',auth[_0x25b5('0x5')](),controller[_0x25b5('0x8')]);router[_0x25b5('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x25b5('0xa')]);router['delete'](_0x25b5('0x6'),auth[_0x25b5('0x5')](),controller['destroy']);module[_0x25b5('0xb')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index b519989..a87505d 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 _0x4a8b=['*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x2c602e,_0x1d26f5){var _0x1a2650=function(_0x2370d1){while(--_0x2370d1){_0x2c602e['push'](_0x2c602e['shift']());}};_0x1a2650(++_0x1d26f5);}(_0x4a8b,0x92));var _0xb4a8=function(_0x11d541,_0xc8fe9){_0x11d541=_0x11d541-0x0;var _0x3e612a=_0x4a8b[_0x11d541];return _0x3e612a;};'use strict';var Sequelize=require(_0xb4a8('0x0'));module[_0xb4a8('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb4a8('0x2')],'allowNull':![],'defaultValue':_0xb4a8('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xb4a8('0x2')]},'interval':{'type':Sequelize[_0xb4a8('0x2')],'defaultValue':_0xb4a8('0x4')}}; \ No newline at end of file +var _0xd418=['sequelize','exports','STRING','*,*,*,*'];(function(_0x3961c8,_0x3aab67){var _0x223c47=function(_0x5f1031){while(--_0x5f1031){_0x3961c8['push'](_0x3961c8['shift']());}};_0x223c47(++_0x3aab67);}(_0xd418,0xc8));var _0x8d41=function(_0x4a8e7b,_0x26db36){_0x4a8e7b=_0x4a8e7b-0x0;var _0x443a8=_0xd418[_0x4a8e7b];return _0x443a8;};'use strict';var Sequelize=require(_0x8d41('0x0'));module[_0x8d41('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x8d41('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x8d41('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x8d41('0x3')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 56e7055..9512cd0 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 _0x48df=['options','includeAll','catch','show','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','error','name','send','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL'];(function(_0x4b761d,_0x2685c7){var _0x1d417d=function(_0xf8877a){while(--_0xf8877a){_0x4b761d['push'](_0x4b761d['shift']());}};_0x1d417d(++_0x2685c7);}(_0x48df,0x170));var _0xf48d=function(_0x136619,_0x31c9b2){_0x136619=_0x136619-0x0;var _0x38c4a5=_0x48df[_0x136619];return _0x38c4a5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf48d('0x0'));var rimraf=require(_0xf48d('0x1'));var zipdir=require(_0xf48d('0x2'));var jsonpatch=require(_0xf48d('0x3'));var rp=require(_0xf48d('0x4'));var moment=require('moment');var BPromise=require(_0xf48d('0x5'));var Mustache=require(_0xf48d('0x6'));var util=require(_0xf48d('0x7'));var path=require(_0xf48d('0x8'));var sox=require(_0xf48d('0x9'));var csv=require(_0xf48d('0xa'));var ejs=require(_0xf48d('0xb'));var fs=require('fs');var _=require(_0xf48d('0xc'));var squel=require(_0xf48d('0xd'));var crypto=require('crypto');var jsforce=require(_0xf48d('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf48d('0xf'));var Papa=require(_0xf48d('0x10'));var Redis=require('ioredis');var authService=require(_0xf48d('0x11'));var qs=require(_0xf48d('0x12'));var as=require(_0xf48d('0x13'));var hardwareService=require(_0xf48d('0x14'));var logger=require(_0xf48d('0x15'))(_0xf48d('0x16'));var utils=require(_0xf48d('0x17'));var config=require(_0xf48d('0x18'));var db=require(_0xf48d('0x19'))['db'];function respondWithStatusCode(_0x1db0b1,_0x31a740){_0x31a740=_0x31a740||0xcc;return function(_0x4f0570){if(_0x4f0570){return _0x1db0b1[_0xf48d('0x1a')](_0x31a740);}return _0x1db0b1[_0xf48d('0x1b')](_0x31a740)[_0xf48d('0x1c')]();};}function respondWithResult(_0x40d056,_0x1051fd){_0x1051fd=_0x1051fd||0xc8;return function(_0x259f2){if(_0x259f2){return _0x40d056['status'](_0x1051fd)[_0xf48d('0x1d')](_0x259f2);}};}function respondWithFilteredResult(_0x40c735,_0x50ead7){return function(_0x4b065a){if(_0x4b065a){var _0x2e4d5c=_0x4b065a[_0xf48d('0x1e')],_0x33b665=_0x50ead7[_0xf48d('0x1f')],_0x8b4f40=_0x50ead7[_0xf48d('0x1f')]+_0x50ead7[_0xf48d('0x20')],_0x2cf880;if(_0x8b4f40>=_0x2e4d5c){_0x8b4f40=_0x2e4d5c;_0x2cf880=0xc8;}else{_0x2cf880=0xce;}_0x40c735[_0xf48d('0x1b')](_0x2cf880);return _0x40c735[_0xf48d('0x21')](_0xf48d('0x22'),_0x33b665+'-'+_0x8b4f40+'/'+_0x2e4d5c)[_0xf48d('0x1d')](_0x4b065a);}return null;};}function patchUpdates(_0x5949a6){return function(_0x49e714){try{jsonpatch['apply'](_0x49e714,_0x5949a6,!![]);}catch(_0x103dd8){return BPromise[_0xf48d('0x23')](_0x103dd8);}return _0x49e714['save']();};}function saveUpdates(_0x39603e,_0x97448f){return function(_0x58bf9f){if(_0x58bf9f){return _0x58bf9f[_0xf48d('0x24')](_0x39603e)[_0xf48d('0x25')](function(_0x26deaf){return _0x26deaf;});}return null;};}function removeEntity(_0xf3899c,_0x1d9d85){return function(_0x4ede99){if(_0x4ede99){return _0x4ede99[_0xf48d('0x26')]()[_0xf48d('0x25')](function(){_0xf3899c[_0xf48d('0x1b')](0xcc)[_0xf48d('0x1c')]();});}};}function handleEntityNotFound(_0x19d859,_0x2e04b8){return function(_0x47feb6){if(!_0x47feb6){_0x19d859['sendStatus'](0x194);}return _0x47feb6;};}function handleError(_0x4d1908,_0x557236){_0x557236=_0x557236||0x1f4;return function(_0x1666fb){logger[_0xf48d('0x27')](_0x1666fb['stack']);if(_0x1666fb[_0xf48d('0x28')]){delete _0x1666fb[_0xf48d('0x28')];}_0x4d1908[_0xf48d('0x1b')](_0x557236)[_0xf48d('0x29')](_0x1666fb);};}exports['index']=function(_0x2a6124,_0x1aa7cc){var _0x5c2a66={},_0x8c3281={},_0x8b264c={'count':0x0,'rows':[]};var _0x371e45=_[_0xf48d('0x2a')](db[_0xf48d('0x2b')][_0xf48d('0x2c')],function(_0x3fd061){return{'name':_0x3fd061[_0xf48d('0x2d')],'type':_0x3fd061[_0xf48d('0x2e')][_0xf48d('0x2f')]};});_0x8c3281[_0xf48d('0x30')]=_[_0xf48d('0x2a')](_0x371e45,_0xf48d('0x28'));_0x8c3281[_0xf48d('0x31')]=_[_0xf48d('0x32')](_0x2a6124[_0xf48d('0x31')]);_0x8c3281['filters']=_[_0xf48d('0x33')](_0x8c3281[_0xf48d('0x30')],_0x8c3281[_0xf48d('0x31')]);_0x5c2a66[_0xf48d('0x34')]=_['intersection'](_0x8c3281[_0xf48d('0x30')],qs['fields'](_0x2a6124[_0xf48d('0x31')][_0xf48d('0x35')]));_0x5c2a66[_0xf48d('0x34')]=_0x5c2a66[_0xf48d('0x34')][_0xf48d('0x36')]?_0x5c2a66['attributes']:_0x8c3281['model'];if(!_0x2a6124[_0xf48d('0x31')][_0xf48d('0x37')]('nolimit')){_0x5c2a66[_0xf48d('0x20')]=qs[_0xf48d('0x20')](_0x2a6124[_0xf48d('0x31')][_0xf48d('0x20')]);_0x5c2a66[_0xf48d('0x1f')]=qs[_0xf48d('0x1f')](_0x2a6124[_0xf48d('0x31')][_0xf48d('0x1f')]);}_0x5c2a66[_0xf48d('0x38')]=qs[_0xf48d('0x39')](_0x2a6124[_0xf48d('0x31')][_0xf48d('0x39')]);_0x5c2a66[_0xf48d('0x3a')]=qs[_0xf48d('0x3b')](_[_0xf48d('0x3c')](_0x2a6124[_0xf48d('0x31')],_0x8c3281['filters']),_0x371e45);if(_0x2a6124[_0xf48d('0x31')][_0xf48d('0x3d')]){_0x5c2a66[_0xf48d('0x3a')]=_[_0xf48d('0x3e')](_0x5c2a66[_0xf48d('0x3a')],{'$or':_[_0xf48d('0x2a')](_0x371e45,function(_0x51875f){if(_0x51875f['type']!==_0xf48d('0x3f')){var _0x226618={};_0x226618[_0x51875f['name']]={'$like':'%'+_0x2a6124[_0xf48d('0x31')]['filter']+'%'};return _0x226618;}})});}_0x5c2a66=_['merge']({},_0x5c2a66,_0x2a6124[_0xf48d('0x40')]);var _0x547e0b={'where':_0x5c2a66[_0xf48d('0x3a')]};return db[_0xf48d('0x2b')][_0xf48d('0x1e')](_0x547e0b)[_0xf48d('0x25')](function(_0x44e2bf){_0x8b264c[_0xf48d('0x1e')]=_0x44e2bf;if(_0x2a6124[_0xf48d('0x31')][_0xf48d('0x41')]){_0x5c2a66['include']=[{'all':!![]}];}return db[_0xf48d('0x2b')]['findAll'](_0x5c2a66);})[_0xf48d('0x25')](function(_0x3a74dc){_0x8b264c['rows']=_0x3a74dc;return _0x8b264c;})['then'](respondWithFilteredResult(_0x1aa7cc,_0x5c2a66))[_0xf48d('0x42')](handleError(_0x1aa7cc,null));};exports[_0xf48d('0x43')]=function(_0x3089b2,_0x4a5895){var _0x1b23e2={'raw':!![],'where':{'id':_0x3089b2['params']['id']}},_0x1bac46={};_0x1bac46[_0xf48d('0x30')]=_['keys'](db[_0xf48d('0x2b')]['rawAttributes']);_0x1bac46[_0xf48d('0x31')]=_[_0xf48d('0x32')](_0x3089b2[_0xf48d('0x31')]);_0x1bac46[_0xf48d('0x3b')]=_[_0xf48d('0x33')](_0x1bac46['model'],_0x1bac46[_0xf48d('0x31')]);_0x1b23e2[_0xf48d('0x34')]=_[_0xf48d('0x33')](_0x1bac46[_0xf48d('0x30')],qs[_0xf48d('0x35')](_0x3089b2['query'][_0xf48d('0x35')]));_0x1b23e2[_0xf48d('0x34')]=_0x1b23e2[_0xf48d('0x34')][_0xf48d('0x36')]?_0x1b23e2[_0xf48d('0x34')]:_0x1bac46[_0xf48d('0x30')];if(_0x3089b2['query']['includeAll']){_0x1b23e2['include']=[{'all':!![]}];}_0x1b23e2=_['merge']({},_0x1b23e2,_0x3089b2[_0xf48d('0x40')]);return db['WhatsappApplication']['find'](_0x1b23e2)[_0xf48d('0x25')](handleEntityNotFound(_0x4a5895,null))[_0xf48d('0x25')](respondWithResult(_0x4a5895,null))['catch'](handleError(_0x4a5895,null));};exports[_0xf48d('0x44')]=function(_0x5b3cb0,_0x536f73){return db[_0xf48d('0x2b')][_0xf48d('0x44')](_0x5b3cb0[_0xf48d('0x45')],{})[_0xf48d('0x25')](respondWithResult(_0x536f73,0xc9))['catch'](handleError(_0x536f73,null));};exports['update']=function(_0x4e5cd1,_0x27d46e){if(_0x4e5cd1[_0xf48d('0x45')]['id']){delete _0x4e5cd1[_0xf48d('0x45')]['id'];}return db['WhatsappApplication'][_0xf48d('0x46')]({'where':{'id':_0x4e5cd1[_0xf48d('0x47')]['id']}})['then'](handleEntityNotFound(_0x27d46e,null))[_0xf48d('0x25')](saveUpdates(_0x4e5cd1[_0xf48d('0x45')],null))['then'](respondWithResult(_0x27d46e,null))[_0xf48d('0x42')](handleError(_0x27d46e,null));};exports[_0xf48d('0x26')]=function(_0x1441d9,_0x5c6831){return db[_0xf48d('0x2b')][_0xf48d('0x46')]({'where':{'id':_0x1441d9[_0xf48d('0x47')]['id']}})[_0xf48d('0x25')](handleEntityNotFound(_0x5c6831,null))[_0xf48d('0x25')](removeEntity(_0x5c6831,null))[_0xf48d('0x42')](handleError(_0x5c6831,null));}; \ No newline at end of file +var _0x7922=['count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappApplication','includeAll','findAll','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json'];(function(_0x5153eb,_0x4c2e64){var _0x6f5fd1=function(_0x4095a9){while(--_0x4095a9){_0x5153eb['push'](_0x5153eb['shift']());}};_0x6f5fd1(++_0x4c2e64);}(_0x7922,0x106));var _0x2792=function(_0x41b810,_0x19ab01){_0x41b810=_0x41b810-0x0;var _0x13196a=_0x7922[_0x41b810];return _0x13196a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2792('0x0'));var rimraf=require(_0x2792('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2792('0x2'));var rp=require(_0x2792('0x3'));var moment=require(_0x2792('0x4'));var BPromise=require(_0x2792('0x5'));var Mustache=require('mustache');var util=require(_0x2792('0x6'));var path=require(_0x2792('0x7'));var sox=require('sox');var csv=require(_0x2792('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2792('0x9'));var squel=require(_0x2792('0xa'));var crypto=require(_0x2792('0xb'));var jsforce=require(_0x2792('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2792('0x8'));var querystring=require(_0x2792('0xd'));var Papa=require(_0x2792('0xe'));var Redis=require('ioredis');var authService=require(_0x2792('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2792('0x10'));var hardwareService=require(_0x2792('0x11'));var logger=require(_0x2792('0x12'))(_0x2792('0x13'));var utils=require('../../config/utils');var config=require(_0x2792('0x14'));var db=require(_0x2792('0x15'))['db'];function respondWithStatusCode(_0x3edab1,_0x39c244){_0x39c244=_0x39c244||0xcc;return function(_0x16bf07){if(_0x16bf07){return _0x3edab1[_0x2792('0x16')](_0x39c244);}return _0x3edab1['status'](_0x39c244)[_0x2792('0x17')]();};}function respondWithResult(_0x56bb9b,_0x659314){_0x659314=_0x659314||0xc8;return function(_0x2902b7){if(_0x2902b7){return _0x56bb9b[_0x2792('0x18')](_0x659314)[_0x2792('0x19')](_0x2902b7);}};}function respondWithFilteredResult(_0x51068f,_0x3c8e00){return function(_0x3500b8){if(_0x3500b8){var _0x5e53a3=_0x3500b8[_0x2792('0x1a')],_0x5bcadf=_0x3c8e00[_0x2792('0x1b')],_0x43e1be=_0x3c8e00['offset']+_0x3c8e00[_0x2792('0x1c')],_0x126e9f;if(_0x43e1be>=_0x5e53a3){_0x43e1be=_0x5e53a3;_0x126e9f=0xc8;}else{_0x126e9f=0xce;}_0x51068f[_0x2792('0x18')](_0x126e9f);return _0x51068f['set'](_0x2792('0x1d'),_0x5bcadf+'-'+_0x43e1be+'/'+_0x5e53a3)[_0x2792('0x19')](_0x3500b8);}return null;};}function patchUpdates(_0x2861cf){return function(_0x58ba19){try{jsonpatch[_0x2792('0x1e')](_0x58ba19,_0x2861cf,!![]);}catch(_0x30df11){return BPromise[_0x2792('0x1f')](_0x30df11);}return _0x58ba19[_0x2792('0x20')]();};}function saveUpdates(_0x2c5689,_0x1bc838){return function(_0x1c8e85){if(_0x1c8e85){return _0x1c8e85[_0x2792('0x21')](_0x2c5689)[_0x2792('0x22')](function(_0x44c71d){return _0x44c71d;});}return null;};}function removeEntity(_0xd02669,_0xfe378a){return function(_0x420f63){if(_0x420f63){return _0x420f63[_0x2792('0x23')]()[_0x2792('0x22')](function(){_0xd02669[_0x2792('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x210e09,_0x159e9d){return function(_0x13a4ae){if(!_0x13a4ae){_0x210e09['sendStatus'](0x194);}return _0x13a4ae;};}function handleError(_0x14c203,_0x183c7f){_0x183c7f=_0x183c7f||0x1f4;return function(_0x1bf0b0){logger[_0x2792('0x24')](_0x1bf0b0['stack']);if(_0x1bf0b0[_0x2792('0x25')]){delete _0x1bf0b0[_0x2792('0x25')];}_0x14c203[_0x2792('0x18')](_0x183c7f)[_0x2792('0x26')](_0x1bf0b0);};}exports[_0x2792('0x27')]=function(_0x23bc98,_0xd99061){var _0x49b56c={},_0x4ee69f={},_0x54b00e={'count':0x0,'rows':[]};var _0x5c142d=_['map'](db['WhatsappApplication'][_0x2792('0x28')],function(_0x254fb0){return{'name':_0x254fb0[_0x2792('0x29')],'type':_0x254fb0[_0x2792('0x2a')][_0x2792('0x2b')]};});_0x4ee69f[_0x2792('0x2c')]=_[_0x2792('0x2d')](_0x5c142d,_0x2792('0x25'));_0x4ee69f[_0x2792('0x2e')]=_[_0x2792('0x2f')](_0x23bc98['query']);_0x4ee69f[_0x2792('0x30')]=_[_0x2792('0x31')](_0x4ee69f[_0x2792('0x2c')],_0x4ee69f[_0x2792('0x2e')]);_0x49b56c[_0x2792('0x32')]=_[_0x2792('0x31')](_0x4ee69f[_0x2792('0x2c')],qs[_0x2792('0x33')](_0x23bc98[_0x2792('0x2e')]['fields']));_0x49b56c[_0x2792('0x32')]=_0x49b56c[_0x2792('0x32')][_0x2792('0x34')]?_0x49b56c['attributes']:_0x4ee69f[_0x2792('0x2c')];if(!_0x23bc98[_0x2792('0x2e')][_0x2792('0x35')](_0x2792('0x36'))){_0x49b56c[_0x2792('0x1c')]=qs['limit'](_0x23bc98[_0x2792('0x2e')][_0x2792('0x1c')]);_0x49b56c[_0x2792('0x1b')]=qs[_0x2792('0x1b')](_0x23bc98['query'][_0x2792('0x1b')]);}_0x49b56c[_0x2792('0x37')]=qs[_0x2792('0x38')](_0x23bc98[_0x2792('0x2e')]['sort']);_0x49b56c[_0x2792('0x39')]=qs['filters'](_[_0x2792('0x3a')](_0x23bc98[_0x2792('0x2e')],_0x4ee69f['filters']),_0x5c142d);if(_0x23bc98['query'][_0x2792('0x3b')]){_0x49b56c[_0x2792('0x39')]=_[_0x2792('0x3c')](_0x49b56c[_0x2792('0x39')],{'$or':_[_0x2792('0x2d')](_0x5c142d,function(_0x37ba57){if(_0x37ba57['type']!==_0x2792('0x3d')){var _0x4c664a={};_0x4c664a[_0x37ba57[_0x2792('0x25')]]={'$like':'%'+_0x23bc98[_0x2792('0x2e')]['filter']+'%'};return _0x4c664a;}})});}_0x49b56c=_['merge']({},_0x49b56c,_0x23bc98[_0x2792('0x3e')]);var _0x17c2ff={'where':_0x49b56c[_0x2792('0x39')]};return db[_0x2792('0x3f')]['count'](_0x17c2ff)[_0x2792('0x22')](function(_0x20b82d){_0x54b00e[_0x2792('0x1a')]=_0x20b82d;if(_0x23bc98['query'][_0x2792('0x40')]){_0x49b56c['include']=[{'all':!![]}];}return db[_0x2792('0x3f')][_0x2792('0x41')](_0x49b56c);})['then'](function(_0x26578a){_0x54b00e['rows']=_0x26578a;return _0x54b00e;})[_0x2792('0x22')](respondWithFilteredResult(_0xd99061,_0x49b56c))[_0x2792('0x42')](handleError(_0xd99061,null));};exports[_0x2792('0x43')]=function(_0x4bb824,_0x3c55fe){var _0x3e9544={'raw':!![],'where':{'id':_0x4bb824[_0x2792('0x44')]['id']}},_0x1b9fd1={};_0x1b9fd1[_0x2792('0x2c')]=_[_0x2792('0x2f')](db[_0x2792('0x3f')][_0x2792('0x28')]);_0x1b9fd1[_0x2792('0x2e')]=_[_0x2792('0x2f')](_0x4bb824[_0x2792('0x2e')]);_0x1b9fd1[_0x2792('0x30')]=_['intersection'](_0x1b9fd1[_0x2792('0x2c')],_0x1b9fd1[_0x2792('0x2e')]);_0x3e9544['attributes']=_[_0x2792('0x31')](_0x1b9fd1[_0x2792('0x2c')],qs[_0x2792('0x33')](_0x4bb824[_0x2792('0x2e')]['fields']));_0x3e9544[_0x2792('0x32')]=_0x3e9544['attributes']['length']?_0x3e9544[_0x2792('0x32')]:_0x1b9fd1[_0x2792('0x2c')];if(_0x4bb824[_0x2792('0x2e')][_0x2792('0x40')]){_0x3e9544['include']=[{'all':!![]}];}_0x3e9544=_[_0x2792('0x3c')]({},_0x3e9544,_0x4bb824[_0x2792('0x3e')]);return db['WhatsappApplication'][_0x2792('0x45')](_0x3e9544)[_0x2792('0x22')](handleEntityNotFound(_0x3c55fe,null))[_0x2792('0x22')](respondWithResult(_0x3c55fe,null))[_0x2792('0x42')](handleError(_0x3c55fe,null));};exports[_0x2792('0x46')]=function(_0x4e1553,_0x27703b){return db['WhatsappApplication']['create'](_0x4e1553[_0x2792('0x47')],{})[_0x2792('0x22')](respondWithResult(_0x27703b,0xc9))[_0x2792('0x42')](handleError(_0x27703b,null));};exports[_0x2792('0x21')]=function(_0x312f68,_0x1f5101){if(_0x312f68['body']['id']){delete _0x312f68[_0x2792('0x47')]['id'];}return db[_0x2792('0x3f')]['find']({'where':{'id':_0x312f68[_0x2792('0x44')]['id']}})[_0x2792('0x22')](handleEntityNotFound(_0x1f5101,null))[_0x2792('0x22')](saveUpdates(_0x312f68['body'],null))['then'](respondWithResult(_0x1f5101,null))[_0x2792('0x42')](handleError(_0x1f5101,null));};exports['destroy']=function(_0x537133,_0x51827a){return db[_0x2792('0x3f')]['find']({'where':{'id':_0x537133['params']['id']}})[_0x2792('0x22')](handleEntityNotFound(_0x51827a,null))[_0x2792('0x22')](removeEntity(_0x51827a,null))[_0x2792('0x42')](handleError(_0x51827a,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 9722848..0347e3d 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 _0x3974=['utf8mb4','utf8mb4_unicode_ci','util','api','path','rimraf','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications'];(function(_0x3d9557,_0x5d09d2){var _0x359ff8=function(_0x784fa){while(--_0x784fa){_0x3d9557['push'](_0x3d9557['shift']());}};_0x359ff8(++_0x5d09d2);}(_0x3974,0x162));var _0x4397=function(_0x15e87c,_0x2ef1f2){_0x15e87c=_0x15e87c-0x0;var _0x172220=_0x3974[_0x15e87c];return _0x172220;};'use strict';var _=require('lodash');var util=require(_0x4397('0x0'));var logger=require('../../config/logger')(_0x4397('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4397('0x2'));var rimraf=require(_0x4397('0x3'));var config=require('../../config/environment');var attributes=require(_0x4397('0x4'));module[_0x4397('0x5')]=function(_0x1f487c,_0x17b0a6){return _0x1f487c[_0x4397('0x6')](_0x4397('0x7'),attributes,{'tableName':_0x4397('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4397('0x9'),'collate':_0x4397('0xa')});}; \ No newline at end of file +var _0x2bce=['./whatsappApplication.attributes','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xcd41d5,_0x1775bc){var _0x6f0b28=function(_0x34c784){while(--_0x34c784){_0xcd41d5['push'](_0xcd41d5['shift']());}};_0x6f0b28(++_0x1775bc);}(_0x2bce,0x1cd));var _0xe2bc=function(_0x6da433,_0x38cf77){_0x6da433=_0x6da433-0x0;var _0x214d4d=_0x2bce[_0x6da433];return _0x214d4d;};'use strict';var _=require(_0xe2bc('0x0'));var util=require('util');var logger=require(_0xe2bc('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe2bc('0x2'));var rp=require(_0xe2bc('0x3'));var fs=require('fs');var path=require(_0xe2bc('0x4'));var rimraf=require(_0xe2bc('0x5'));var config=require(_0xe2bc('0x6'));var attributes=require(_0xe2bc('0x7'));module['exports']=function(_0x5a96ff,_0xfe0085){return _0x5a96ff[_0xe2bc('0x8')](_0xe2bc('0x9'),attributes,{'tableName':_0xe2bc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe2bc('0xb'),'collate':_0xe2bc('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 1258e38..07e7249 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 _0x1883=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x36ce78,_0x2fa42e){var _0x63dda3=function(_0x12d342){while(--_0x12d342){_0x36ce78['push'](_0x36ce78['shift']());}};_0x63dda3(++_0x2fa42e);}(_0x1883,0xab));var _0x3188=function(_0x940009,_0x32b94b){_0x940009=_0x940009-0x0;var _0x1529d2=_0x1883[_0x940009];return _0x1529d2;};'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});function respondWithRpcPromise(_0x24f2f1,_0x3ce7fd,_0x3e3afb){return new BPromise(function(_0x5c8f26,_0x446ab7){return client[_0x3188('0xe')](_0x24f2f1,_0x3e3afb)['then'](function(_0x2213b5){logger['info'](_0x3188('0xf'),_0x3ce7fd,_0x3188('0x10'));logger[_0x3188('0x11')](_0x3188('0x12'),_0x3ce7fd,'request\x20sent',JSON[_0x3188('0x13')](_0x2213b5));if(_0x2213b5[_0x3188('0x14')]){if(_0x2213b5['error']['code']===0x1f4){logger[_0x3188('0x14')](_0x3188('0xf'),_0x3ce7fd,_0x2213b5[_0x3188('0x14')][_0x3188('0x15')]);return _0x446ab7(_0x2213b5[_0x3188('0x14')][_0x3188('0x15')]);}logger['error'](_0x3188('0xf'),_0x3ce7fd,_0x2213b5['error']['message']);return _0x5c8f26(_0x2213b5[_0x3188('0x14')]['message']);}else{logger['info'](_0x3188('0xf'),_0x3ce7fd,_0x3188('0x10'));_0x5c8f26(_0x2213b5[_0x3188('0x16')][_0x3188('0x15')]);}})[_0x3188('0x17')](function(_0x259321){logger['error'](_0x3188('0xf'),_0x3ce7fd,_0x259321);_0x446ab7(_0x259321);});});} \ No newline at end of file +var _0x8085=['client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0x8085,0x71));var _0x5808=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0x8085[_0x2aecb2];return _0x3ebb80;};'use strict';var _=require(_0x5808('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5808('0x1'));var rs=require(_0x5808('0x2'));var fs=require('fs');var Redis=require(_0x5808('0x3'));var db=require(_0x5808('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5808('0x5'));var config=require(_0x5808('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5808('0x7')][_0x5808('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39458f,_0x2d204e,_0x2a9716){return new BPromise(function(_0x5b30b9,_0x30e63c){return client[_0x5808('0x9')](_0x39458f,_0x2a9716)[_0x5808('0xa')](function(_0x447811){logger[_0x5808('0xb')](_0x5808('0xc'),_0x2d204e,_0x5808('0xd'));logger[_0x5808('0xe')](_0x5808('0xf'),_0x2d204e,'request\x20sent',JSON['stringify'](_0x447811));if(_0x447811[_0x5808('0x10')]){if(_0x447811[_0x5808('0x10')][_0x5808('0x11')]===0x1f4){logger[_0x5808('0x10')](_0x5808('0xc'),_0x2d204e,_0x447811[_0x5808('0x10')][_0x5808('0x12')]);return _0x30e63c(_0x447811['error']['message']);}logger[_0x5808('0x10')](_0x5808('0xc'),_0x2d204e,_0x447811[_0x5808('0x10')][_0x5808('0x12')]);return _0x5b30b9(_0x447811[_0x5808('0x10')][_0x5808('0x12')]);}else{logger[_0x5808('0xb')](_0x5808('0xc'),_0x2d204e,_0x5808('0xd'));_0x5b30b9(_0x447811[_0x5808('0x13')][_0x5808('0x12')]);}})['catch'](function(_0x3342ae){logger['error'](_0x5808('0xc'),_0x2d204e,_0x3342ae);_0x30e63c(_0x3342ae);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index d55eb49..e05d3c0 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 _0x3924=['post','create','/:id/messages','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','getMessages','/:id/download','download'];(function(_0x23f4ad,_0xb1c02f){var _0x42e2ec=function(_0x4f39e0){while(--_0x4f39e0){_0x23f4ad['push'](_0x23f4ad['shift']());}};_0x42e2ec(++_0xb1c02f);}(_0x3924,0x74));var _0x4392=function(_0xbfaf33,_0x189d81){_0xbfaf33=_0xbfaf33-0x0;var _0x1e7fb4=_0x3924[_0xbfaf33];return _0x1e7fb4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4392('0x0'));var timeout=require(_0x4392('0x1'));var express=require(_0x4392('0x2'));var router=express[_0x4392('0x3')]();var auth=require(_0x4392('0x4'));var interaction=require(_0x4392('0x5'));var config=require(_0x4392('0x6'));var controller=require('./whatsappInteraction.controller');router[_0x4392('0x7')]('/',auth[_0x4392('0x8')](),controller[_0x4392('0x9')]);router[_0x4392('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x4392('0xa')]);router[_0x4392('0x7')](_0x4392('0xb'),auth[_0x4392('0x8')](),controller[_0x4392('0xc')]);router['get']('/:id/messages',auth[_0x4392('0x8')](),controller[_0x4392('0xd')]);router[_0x4392('0x7')](_0x4392('0xe'),auth[_0x4392('0x8')](),controller[_0x4392('0xf')]);router[_0x4392('0x10')]('/',auth[_0x4392('0x8')](),controller[_0x4392('0x11')]);router['post'](_0x4392('0x12'),auth[_0x4392('0x8')](),controller[_0x4392('0x13')]);router[_0x4392('0x10')](_0x4392('0x14'),auth[_0x4392('0x8')](),interaction[_0x4392('0x15')](_0x4392('0x16'),_0x4392('0x17')),controller[_0x4392('0x18')]);router[_0x4392('0x19')](_0x4392('0xb'),auth[_0x4392('0x8')](),interaction[_0x4392('0x15')](_0x4392('0x16'),_0x4392('0x1a')),controller[_0x4392('0x1b')]);router[_0x4392('0x1c')](_0x4392('0xb'),auth[_0x4392('0x8')](),interaction['tracked'](_0x4392('0x16'),_0x4392('0x1d')),controller[_0x4392('0x1e')]);router['delete'](_0x4392('0x14'),auth[_0x4392('0x8')](),controller[_0x4392('0x1f')]);module[_0x4392('0x20')]=router; \ No newline at end of file +var _0xdc39=['addTags','put','tracked','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','/:id','isAuthenticated','show','getMessages','download','post','create','/:id/messages','addMessage','/:id/tags','whatsapp','whatsappinteraction:addtags'];(function(_0x5b7ad3,_0x25de02){var _0x174385=function(_0x1572a0){while(--_0x1572a0){_0x5b7ad3['push'](_0x5b7ad3['shift']());}};_0x174385(++_0x25de02);}(_0xdc39,0x169));var _0x9dc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc39[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x9dc3('0x0'));var path=require(_0x9dc3('0x1'));var timeout=require(_0x9dc3('0x2'));var express=require(_0x9dc3('0x3'));var router=express[_0x9dc3('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9dc3('0x5'));var config=require(_0x9dc3('0x6'));var controller=require(_0x9dc3('0x7'));router[_0x9dc3('0x8')]('/',auth['isAuthenticated'](),controller[_0x9dc3('0x9')]);router[_0x9dc3('0x8')](_0x9dc3('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x9dc3('0x8')](_0x9dc3('0xb'),auth[_0x9dc3('0xc')](),controller[_0x9dc3('0xd')]);router['get']('/:id/messages',auth[_0x9dc3('0xc')](),controller[_0x9dc3('0xe')]);router[_0x9dc3('0x8')]('/:id/download',auth[_0x9dc3('0xc')](),controller[_0x9dc3('0xf')]);router[_0x9dc3('0x10')]('/',auth[_0x9dc3('0xc')](),controller[_0x9dc3('0x11')]);router[_0x9dc3('0x10')](_0x9dc3('0x12'),auth[_0x9dc3('0xc')](),controller[_0x9dc3('0x13')]);router[_0x9dc3('0x10')](_0x9dc3('0x14'),auth['isAuthenticated'](),interaction['tracked'](_0x9dc3('0x15'),_0x9dc3('0x16')),controller[_0x9dc3('0x17')]);router[_0x9dc3('0x18')](_0x9dc3('0xb'),auth[_0x9dc3('0xc')](),interaction[_0x9dc3('0x19')]('whatsapp',_0x9dc3('0x1a')),controller[_0x9dc3('0x1b')]);router['delete'](_0x9dc3('0xb'),auth[_0x9dc3('0xc')](),interaction[_0x9dc3('0x19')](_0x9dc3('0x15'),_0x9dc3('0x1c')),controller[_0x9dc3('0x1d')]);router['delete'](_0x9dc3('0x14'),auth[_0x9dc3('0xc')](),controller[_0x9dc3('0x1e')]);module[_0x9dc3('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 9e89ac1..f825921 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 _0x5837=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x38c814,_0x489779){var _0x5bb0bd=function(_0x16a8fc){while(--_0x16a8fc){_0x38c814['push'](_0x38c814['shift']());}};_0x5bb0bd(++_0x489779);}(_0x5837,0x14f));var _0x7583=function(_0x16bd44,_0x3c91ba){_0x16bd44=_0x16bd44-0x0;var _0x368a61=_0x5837[_0x16bd44];return _0x368a61;};'use strict';var Sequelize=require(_0x7583('0x0'));var moment=require('moment');module[_0x7583('0x1')]={'closed':{'type':Sequelize[_0x7583('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7583('0x3')]},'disposition':{'type':Sequelize[_0x7583('0x4')]},'note':{'type':Sequelize[_0x7583('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x7583('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x7583('0x5')]('in',_0x7583('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7583('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x37f2=['DATE','STRING','out','ENUM','sequelize','moment','exports','BOOLEAN'];(function(_0x3bc0f5,_0x27e4fd){var _0x4aa96b=function(_0x2d79ea){while(--_0x2d79ea){_0x3bc0f5['push'](_0x3bc0f5['shift']());}};_0x4aa96b(++_0x27e4fd);}(_0x37f2,0xcc));var _0x237f=function(_0x5e9c30,_0x482ea6){_0x5e9c30=_0x5e9c30-0x0;var _0x19c00b=_0x37f2[_0x5e9c30];return _0x19c00b;};'use strict';var Sequelize=require(_0x237f('0x0'));var moment=require(_0x237f('0x1'));module[_0x237f('0x2')]={'closed':{'type':Sequelize[_0x237f('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x237f('0x4')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x237f('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x237f('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x237f('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x237f('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x237f('0x7')]('in',_0x237f('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index eaa6932..f2fad5a 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.controller.js +++ b/server/api/whatsappInteraction/whatsappInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['index','rawAttributes','type','key','model','query','intersection','attributes','length','nolimit','limit','order','sort','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','body','keys','some','compact','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$lte','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','getWhatsappAccounts','toString','count','sequelize','fields','a.key','Account.key','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','rows','show','params','WhatsappInteraction','includeAll','merge','options','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','hasOwnProperty','WhatsappInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','User','fullname','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','10px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Whatsapp','YYYY-MM-DD','closedAt','disposition','existsSync','basename','out','System','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','map','TagIds','split','forEach','push','catch'];(function(_0x3a1e51,_0x3a1067){var _0x546c2c=function(_0x48d402){while(--_0x48d402){_0x3a1e51['push'](_0x3a1e51['shift']());}};_0x546c2c(++_0x3a1067);}(_0x814b,0x1a2));var _0xb814=function(_0x1857c6,_0x48840c){_0x1857c6=_0x1857c6-0x0;var _0x51011c=_0x814b[_0x1857c6];return _0x51011c;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];config[_0xb814('0x1a')]=_[_0xb814('0x1b')](config[_0xb814('0x1a')],{'host':_0xb814('0x1c'),'port':0x18eb});var socket=require(_0xb814('0x1d'))(new Redis(config[_0xb814('0x1a')]));require(_0xb814('0x1e'))[_0xb814('0x1f')](socket);function respondWithStatusCode(_0x2ab627,_0x3f4881){_0x3f4881=_0x3f4881||0xcc;return function(_0x44fb96){if(_0x44fb96){return _0x2ab627[_0xb814('0x20')](_0x3f4881);}return _0x2ab627[_0xb814('0x21')](_0x3f4881)[_0xb814('0x22')]();};}function respondWithResult(_0x3a71d6,_0x45e0d0){_0x45e0d0=_0x45e0d0||0xc8;return function(_0x265a83){if(_0x265a83){return _0x3a71d6[_0xb814('0x21')](_0x45e0d0)[_0xb814('0x23')](_0x265a83);}};}function respondWithFilteredResult(_0x7a21ef,_0x48c9df){return function(_0x168a48){if(_0x168a48){var _0x55ba16=_0x168a48['count'],_0x270598=_0x48c9df['offset'],_0xfac75b=_0x48c9df[_0xb814('0x24')]+_0x48c9df['limit'],_0x4c3007;if(_0xfac75b>=_0x55ba16){_0xfac75b=_0x55ba16;_0x4c3007=0xc8;}else{_0x4c3007=0xce;}_0x7a21ef['status'](_0x4c3007);return _0x7a21ef[_0xb814('0x25')](_0xb814('0x26'),_0x270598+'-'+_0xfac75b+'/'+_0x55ba16)[_0xb814('0x23')](_0x168a48);}return null;};}function patchUpdates(_0x4e139e){return function(_0xf5b8aa){try{jsonpatch['apply'](_0xf5b8aa,_0x4e139e,!![]);}catch(_0x1e6393){return BPromise[_0xb814('0x27')](_0x1e6393);}return _0xf5b8aa[_0xb814('0x28')]();};}function saveUpdates(_0x470e81,_0x27352e){return function(_0x2bd039){if(_0x2bd039){return _0x2bd039[_0xb814('0x29')](_0x470e81)['then'](function(_0x2ead86){return _0x2ead86;});}return null;};}function removeEntity(_0x52b7a3,_0x3f81d0){return function(_0x457dac){if(_0x457dac){return _0x457dac[_0xb814('0x2a')]()[_0xb814('0x2b')](function(){_0x52b7a3[_0xb814('0x21')](0xcc)[_0xb814('0x22')]();});}};}function handleEntityNotFound(_0x3d836c,_0x5755ea){return function(_0x392222){if(!_0x392222){_0x3d836c[_0xb814('0x20')](0x194);}return _0x392222;};}function handleError(_0x1c2625,_0x349394){_0x349394=_0x349394||0x1f4;return function(_0x32ed56){logger[_0xb814('0x2c')](_0x32ed56[_0xb814('0x2d')]);if(_0x32ed56[_0xb814('0x2e')]){delete _0x32ed56['name'];}_0x1c2625[_0xb814('0x21')](_0x349394)[_0xb814('0x2f')](_0x32ed56);};}function getInteractionUsers(_0x52ed64,_0x9008b2){return new BPromise(function(_0x37d24d,_0x530744){try{if(_0x9008b2[_0x52ed64['id']]){_0x52ed64['Users']=_[_0xb814('0x30')](_0x9008b2[_0x52ed64['id']],function(_0x2051d0){return{'id':_0x2051d0['id'],'fullname':_0x2051d0['fullname']};});}}catch(_0x338a28){_0x530744(_0x338a28);}_0x37d24d(_0x52ed64);});}function getInteractionTags(_0x526610,_0x6efe9a){return new BPromise(function(_0x5f3e9b,_0x4cfc58){try{if(_0x526610[_0xb814('0x31')]){_0x526610['Tags']=[];_0x526610[_0xb814('0x31')][_0xb814('0x32')](',')[_0xb814('0x33')](function(_0x599f9f){_0x526610['Tags'][_0xb814('0x34')](_0x6efe9a[_0x599f9f]);});}delete _0x526610[_0xb814('0x31')];}catch(_0x523566){_0x4cfc58(_0x523566);}_0x5f3e9b(_0x526610);});}function updateWhatsappInteraction(_0x2c8943,_0xe558d5,_0x692c72){return new BPromise(function(_0x217b7e,_0x1b78de){return getInteractionUsers(_0x2c8943,_0x692c72)[_0xb814('0x2b')](function(_0x3672f3){return getInteractionTags(_0x3672f3,_0xe558d5);})['then'](function(_0x3207ec){_0x217b7e(_0x3207ec);})[_0xb814('0x35')](function(_0x30de5a){_0x1b78de(_0x30de5a);});});}exports[_0xb814('0x36')]=function(_0x14100d,_0x4ff31a){var _0x16ef82={},_0x57e6e6={},_0x43db67={'count':0x0,'rows':[]};var _0x16e21c=_[_0xb814('0x30')](db['WhatsappInteraction'][_0xb814('0x37')],function(_0xbdb3e9){return{'name':_0xbdb3e9['fieldName'],'type':_0xbdb3e9[_0xb814('0x38')][_0xb814('0x39')]};});_0x57e6e6[_0xb814('0x3a')]=_[_0xb814('0x30')](_0x16e21c,_0xb814('0x2e'));_0x57e6e6[_0xb814('0x3b')]=_['keys'](_0x14100d[_0xb814('0x3b')]);_0x57e6e6['filters']=_[_0xb814('0x3c')](_0x57e6e6['model'],_0x57e6e6[_0xb814('0x3b')]);_0x16ef82['attributes']=_[_0xb814('0x3c')](_0x57e6e6[_0xb814('0x3a')],qs['fields'](_0x14100d['query']['fields']));_0x16ef82['attributes']=_0x16ef82[_0xb814('0x3d')][_0xb814('0x3e')]?_0x16ef82[_0xb814('0x3d')]:_0x57e6e6[_0xb814('0x3a')];if(!_0x14100d['query']['hasOwnProperty'](_0xb814('0x3f'))){_0x16ef82['limit']=qs[_0xb814('0x40')](_0x14100d[_0xb814('0x3b')][_0xb814('0x40')]);_0x16ef82[_0xb814('0x24')]=qs[_0xb814('0x24')](_0x14100d[_0xb814('0x3b')][_0xb814('0x24')]);}_0x16ef82[_0xb814('0x41')]=qs[_0xb814('0x42')](_0x14100d['query']['sort']);_0x16ef82['where']=qs[_0xb814('0x43')](_['pick'](_0x14100d[_0xb814('0x3b')],_0x57e6e6['filters']),_0x16e21c);var _0x411723=[];var _0x44ff56=squel[_0xb814('0x44')]()[_0xb814('0x45')]('id')['field'](_0xb814('0x2e'))[_0xb814('0x45')](_0xb814('0x46'))[_0xb814('0x47')](_0xb814('0x48'));var _0x450a08=squel['select']()[_0xb814('0x45')](_0xb814('0x49'))[_0xb814('0x45')](_0xb814('0x4a'))[_0xb814('0x45')](_0xb814('0x4b'))[_0xb814('0x47')]('user_has_whatsapp_interactions','ui')['left_join'](_0xb814('0x4c'),'u',_0xb814('0x4d'));var _0x4c08d6=squel[_0xb814('0x44')]()[_0xb814('0x47')](_0xb814('0x4e'),'i')[_0xb814('0x4f')](_0xb814('0x50'),'c',_0xb814('0x51'))[_0xb814('0x4f')](_0xb814('0x4c'),'o','o.id\x20=\x20i.UserId')[_0xb814('0x4f')](_0xb814('0x52'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0xb814('0x4f')]('whatsapp_messages','me',_0xb814('0x53'))[_0xb814('0x4f')](_0xb814('0x54'),'it',_0xb814('0x55'))[_0xb814('0x4f')](_0xb814('0x48'),'t',_0xb814('0x56'));var _0x45480e=squel[_0xb814('0x57')]();var _0x2a422a=[];var _0x5e6df7=squel['expr']();var _0x32eca6;if(_0x14100d[_0xb814('0x3b')][_0xb814('0x58')]){_0x32eca6=as[_0xb814('0x59')](_0x14100d[_0xb814('0x3b')][_0xb814('0x58')]);var _0x135208=_0x32eca6['sqlOperator'];for(var _0x26fd0b=0x0;_0x26fd0b<_0x32eca6[_0xb814('0x5a')][_0xb814('0x3e')];_0x26fd0b++){var _0x5a916d=_0x32eca6[_0xb814('0x5a')][_0x26fd0b];var _0x4e6f3c='i';var _0x252293=_['find'](_0x16e21c,[_0xb814('0x2e'),_0x5a916d[_0xb814('0x45')]]);if(!_0x252293){switch(_0x5a916d['field']){case _0xb814('0x5b'):if(_0x5a916d[_0xb814('0x5c')]==0x1){_0x4c08d6[_0xb814('0x5d')]('`'+_0x5a916d['field']+_0xb814('0x5e'));}else{_0x4c08d6['having']('`'+_0x5a916d[_0xb814('0x45')]+_0xb814('0x5f'));}break;case'Contact':if(_0x5a916d[_0xb814('0x60')]==='$substring'){if(_0x5a916d['value'][_0xb814('0x32')]('\x20')[_0xb814('0x3e')]>0x1){_0x45480e[_0x135208](_0xb814('0x61'),qs['getFullTextValue'](_0x5a916d[_0xb814('0x5c')]),null);}else{var _0x538b0f='%'+_0x5a916d[_0xb814('0x5c')]+'%';_0x45480e[_0x135208](_0xb814('0x62'),_0x538b0f,_0x538b0f,_0x538b0f);}}else{_0x252293=_['find'](_0x16e21c,[_0xb814('0x2e'),'ContactId']);_0x5a916d[_0xb814('0x45')]=_0xb814('0x63');_0x135e13=as[_0xb814('0x64')](_0x4e6f3c,_0x252293[_0xb814('0x38')],_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')][_0xb814('0x66')],_0x135e13[_0xb814('0x5c')]['end']);}break;case _0xb814('0x67'):var _0x5441c5=_0x5a916d['value'][_0xb814('0x32')](',')[_0xb814('0x30')](function(_0x4d13db){return Number(_0x4d13db);});_0x5441c5[_0xb814('0x33')](function(_0x58b9a6){_0x5e6df7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x58b9a6+',%');});_0x2a422a=_[_0xb814('0x68')](_0x2a422a,_0x5441c5);break;case'User':if(_0x5a916d[_0xb814('0x60')]===_0xb814('0x69')){_0x45480e[_0x135208](_0xb814('0x6a'),'%'+_0x5a916d['value']+'%',null);}else{_0x252293=_[_0xb814('0x6b')](_0x16e21c,['name',_0xb814('0x6c')]);_0x5a916d[_0xb814('0x45')]=_0xb814('0x6c');_0x135e13=as[_0xb814('0x64')](_0x4e6f3c,_0x252293[_0xb814('0x38')],_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')][_0xb814('0x66')],_0x135e13[_0xb814('0x5c')]['end']);}break;case _0xb814('0x6d'):_0x135e13=as[_0xb814('0x64')]('me',null,_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')][_0xb814('0x66')],_0x135e13[_0xb814('0x5c')]['end']);break;}}else{var _0x135e13=as['buildExpression'](_0x4e6f3c,_0x252293[_0xb814('0x38')],_0x5a916d);_0x45480e[_0x135208](_0x135e13[_0xb814('0x65')],_0x135e13[_0xb814('0x5c')]['start'],_0x135e13[_0xb814('0x5c')]['end']);}}}else{var _0x37e9c5=_(_0x14100d['query'])[_0xb814('0x6e')]()[_0xb814('0x30')](function(_0xa03cd2){return _[_0xb814('0x6f')](_0x16e21c,[_0xb814('0x2e'),_0xa03cd2])?_0xa03cd2:undefined;})[_0xb814('0x70')]()[_0xb814('0x5c')]();if(!_['isEmpty'](_0x37e9c5)){_0x37e9c5[_0xb814('0x33')](function(_0x51ca51){if(_0x51ca51===_0xb814('0x71')){_0x4c08d6[_0xb814('0x72')](_0xb814('0x73'),[][_0xb814('0x74')](_0x14100d[_0xb814('0x3b')][_0x51ca51]));}else if(_0x51ca51===_0xb814('0x75')){var _0x514dab=JSON[_0xb814('0x76')](_0x14100d[_0xb814('0x3b')][_0x51ca51])['$gte'];var _0x3bb2b4=JSON[_0xb814('0x76')](_0x14100d[_0xb814('0x3b')][_0x51ca51])[_0xb814('0x77')];_0x4c08d6[_0xb814('0x72')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x514dab,_0x3bb2b4);}else{if(_0x14100d[_0xb814('0x3b')][_0x51ca51]==='null'){_0x4c08d6[_0xb814('0x72')]('i.'+_0x51ca51+_0xb814('0x78'));}else{_0x4c08d6[_0xb814('0x72')]('i.'+_0x51ca51+_0xb814('0x79'),_0x14100d[_0xb814('0x3b')][_0x51ca51]);}}});}if(_0x14100d[_0xb814('0x3b')]['read']){if(_0x14100d['query']['read']==0x1){_0x4c08d6[_0xb814('0x5d')]('`unreadMessages`\x20=\x200');}else{_0x4c08d6[_0xb814('0x5d')](_0xb814('0x7a'));}}if(_0x14100d[_0xb814('0x3b')]['tag']){_0x2a422a=_[_0xb814('0x7b')](_0x14100d[_0xb814('0x3b')][_0xb814('0x7c')])?_0x14100d['query'][_0xb814('0x7c')]:new Array(_0x14100d[_0xb814('0x3b')][_0xb814('0x7c')]);_0x2a422a[_0xb814('0x33')](function(_0x555be0){_0x5e6df7['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x555be0+',%');});}if(_0x14100d[_0xb814('0x3b')][_0xb814('0x7d')]){var _0x39863d=_0x14100d[_0xb814('0x3b')][_0xb814('0x7d')][_0xb814('0x7e')]('\x5c','\x5c\x5c')[_0xb814('0x7e')]('\x27\x27',_0xb814('0x7f'));if(qs[_0xb814('0x80')](_0x39863d)){_0x45480e['or'](_0xb814('0x81'),_0x39863d+'%')['or'](_0xb814('0x82'),_0x39863d+'%');}else{_0x45480e['or'](_0xb814('0x83'),qs[_0xb814('0x84')](_0x39863d))['or'](_0xb814('0x85'),_0x39863d+'%');}}}_0x4c08d6[_0xb814('0x72')](_0x45480e);_0x4c08d6['group'](_0xb814('0x86'));var _0x33cfc4={'type':db[_0xb814('0x87')][_0xb814('0x88')][_0xb814('0x89')],'raw':!![]};var _0x283b0f=_0x4c08d6['clone']();_0x283b0f[_0xb814('0x45')]('i.id');_0x283b0f[_0xb814('0x45')](_0xb814('0x8a'),_0xb814('0x5b'));if(_0x16ef82[_0xb814('0x41')]){_0x16ef82[_0xb814('0x41')]['forEach'](function(_0x4c44ee){_0x4c08d6[_0xb814('0x41')]('i.'+_0x4c44ee[0x0],_0x4c44ee[0x1]===_0xb814('0x8b')?![]:!![]);});}if(!_[_0xb814('0x8c')](_0x2a422a)){_0x4c08d6[_0xb814('0x5d')](_0x5e6df7);_0x283b0f['where'](_0xb814('0x8d'),_0x2a422a);}BPromise['resolve']()[_0xb814('0x2b')](function(){if(!_0x32eca6){if(_0x14100d[_0xb814('0x3b')]['WhatsappAccountId']||_0x14100d['query'][_0xb814('0x8e')])return;_0x283b0f['where'](_0xb814('0x8f'));_0x4c08d6[_0xb814('0x72')](_0xb814('0x8f'));return;}return _0x14100d[_0xb814('0x90')][_0xb814('0x91')]({'attributes':['id'],'raw':!![]})[_0xb814('0x2b')](function(_0x40fe4a){if(_['isEmpty'](_0x40fe4a)){_0x283b0f[_0xb814('0x72')]('i.WhatsappAccountId\x20IS\x20NULL');_0x4c08d6[_0xb814('0x72')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x283b0f[_0xb814('0x72')](_0xb814('0x73'),_['map'](_0x40fe4a,'id'));_0x4c08d6[_0xb814('0x72')]('i.WhatsappAccountId\x20IN\x20?',_[_0xb814('0x30')](_0x40fe4a,'id'));}});})[_0xb814('0x2b')](function(){db['sequelize']['query'](_0x283b0f[_0xb814('0x92')](),_0x33cfc4)[_0xb814('0x2b')](function(_0x3309c5){_0x43db67[_0xb814('0x93')]=_0x3309c5[_0xb814('0x3e')];if(_0x43db67[_0xb814('0x93')]===0x0)return[];return db[_0xb814('0x94')][_0xb814('0x3b')](_0x44ff56[_0xb814('0x92')](),_0x33cfc4)[_0xb814('0x2b')](function(_0x53e705){_0x411723=_['keyBy'](_0x53e705,'id');_0x33cfc4=_['merge'](_0x33cfc4,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x14100d['query'][_0xb814('0x95')]){_0x16ef82[_0xb814('0x3d')][_0xb814('0x33')](function(_0x59f3ff){_0x4c08d6[_0xb814('0x45')]('i.'+_0x59f3ff);});}else{_0x4c08d6[_0xb814('0x45')](_0xb814('0x8a'),_0xb814('0x5b'));_0x4c08d6[_0xb814('0x45')](_0xb814('0x96'),_0xb814('0x97'));_0x4c08d6[_0xb814('0x45')]('a.mandatoryDisposition',_0xb814('0x98'));_0x4c08d6[_0xb814('0x45')](_0xb814('0x99'));_0x4c08d6[_0xb814('0x45')]('c.firstName',_0xb814('0x9a'));_0x4c08d6[_0xb814('0x45')](_0xb814('0x9b'),_0xb814('0x9c'));_0x4c08d6[_0xb814('0x45')]('c.email','Contact.email');_0x4c08d6[_0xb814('0x45')]('c.phone',_0xb814('0x9d'));_0x4c08d6[_0xb814('0x45')]('c.mobile',_0xb814('0x9e'));_0x4c08d6['field'](_0xb814('0x9f'),'Contact.fax');_0x4c08d6[_0xb814('0x45')](_0xb814('0xa0'),_0xb814('0xa1'));_0x4c08d6[_0xb814('0x45')](_0xb814('0xa2'),_0xb814('0xa3'));_0x4c08d6[_0xb814('0x45')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x16ef82[_0xb814('0x40')])_0x4c08d6['limit'](_0x16ef82['limit']);if(_0x16ef82[_0xb814('0x24')])_0x4c08d6[_0xb814('0x24')](_0x16ef82[_0xb814('0x24')]);return db['sequelize'][_0xb814('0x3b')](_0x4c08d6['toString'](),_0x33cfc4);})[_0xb814('0x2b')](function(_0x19d508){_0x450a08[_0xb814('0x72')](_0xb814('0xa4'),_['map'](_0x19d508,'id'));return db[_0xb814('0x94')][_0xb814('0x3b')](_0x450a08[_0xb814('0x92')](),_0x33cfc4)['then'](function(_0x1ebbf6){var _0x3fc77d=_[_0xb814('0xa5')](_0x1ebbf6,'WhatsappInteractionId');var _0x5d8626=[];_0x19d508[_0xb814('0x33')](function(_0x9dc06b){_0x5d8626[_0xb814('0x34')](updateWhatsappInteraction(_0x9dc06b,_0x411723,_0x3fc77d));});return BPromise[_0xb814('0xa6')](_0x5d8626);});});})[_0xb814('0x2b')](function(_0x37a7ab){_0x43db67[_0xb814('0xa7')]=_0x37a7ab;return _0x43db67;})[_0xb814('0x2b')](respondWithFilteredResult(_0x4ff31a,_0x16ef82));})[_0xb814('0x35')](handleError(_0x4ff31a,null));};exports[_0xb814('0xa8')]=function(_0x2569a5,_0x2a13fb){var _0x5b8d2e={'raw':![],'where':{'id':_0x2569a5[_0xb814('0xa9')]['id']}},_0x5416dc={};_0x5416dc['model']=_[_0xb814('0x6e')](db[_0xb814('0xaa')][_0xb814('0x37')]);_0x5416dc[_0xb814('0x3b')]=_[_0xb814('0x6e')](_0x2569a5[_0xb814('0x3b')]);_0x5416dc[_0xb814('0x43')]=_['intersection'](_0x5416dc['model'],_0x5416dc[_0xb814('0x3b')]);_0x5b8d2e['attributes']=_[_0xb814('0x3c')](_0x5416dc[_0xb814('0x3a')],qs[_0xb814('0x95')](_0x2569a5['query'][_0xb814('0x95')]));_0x5b8d2e[_0xb814('0x3d')]=_0x5b8d2e[_0xb814('0x3d')][_0xb814('0x3e')]?_0x5b8d2e[_0xb814('0x3d')]:_0x5416dc['model'];if(_0x2569a5[_0xb814('0x3b')][_0xb814('0xab')]){_0x5b8d2e['include']=[{'all':!![]}];}_0x5b8d2e=_[_0xb814('0xac')]({},_0x5b8d2e,_0x2569a5[_0xb814('0xad')]);return db[_0xb814('0xaa')]['find'](_0x5b8d2e)[_0xb814('0x2b')](handleEntityNotFound(_0x2a13fb,null))[_0xb814('0x2b')](respondWithResult(_0x2a13fb,null))['catch'](handleError(_0x2a13fb,null));};exports[_0xb814('0xae')]=function(_0x171f83,_0x5b5634){return db[_0xb814('0xaa')][_0xb814('0xae')](_0x171f83[_0xb814('0x6d')],{})[_0xb814('0x2b')](respondWithResult(_0x5b5634,0xc9))[_0xb814('0x35')](handleError(_0x5b5634,null));};exports[_0xb814('0x29')]=function(_0x40ae0b,_0x336a8f){if(_0x40ae0b[_0xb814('0x6d')]['id']){delete _0x40ae0b[_0xb814('0x6d')]['id'];}return db[_0xb814('0xaa')][_0xb814('0x6b')]({'where':{'id':_0x40ae0b['params']['id']}})['then'](handleEntityNotFound(_0x336a8f,null))[_0xb814('0x2b')](saveUpdates(_0x40ae0b['body'],null))['then'](respondWithResult(_0x336a8f,null))[_0xb814('0x35')](handleError(_0x336a8f,null));};exports['destroy']=function(_0x4f0427,_0x50cb34){return db[_0xb814('0xaa')][_0xb814('0x6b')]({'where':{'id':_0x4f0427[_0xb814('0xa9')]['id']}})['then'](handleEntityNotFound(_0x50cb34,null))[_0xb814('0x2b')](removeEntity(_0x50cb34,null))['catch'](handleError(_0x50cb34,null));};exports[_0xb814('0xaf')]=function(_0x2e6660,_0x49a8de){return db[_0xb814('0xaa')]['describe']()[_0xb814('0x2b')](respondWithResult(_0x49a8de,null))[_0xb814('0x35')](handleError(_0x49a8de,null));};exports[_0xb814('0xb0')]=function(_0x39ce17,_0x11efb8,_0xaf705d){return db[_0xb814('0xb1')][_0xb814('0x6b')]({'where':{'id':_0x39ce17[_0xb814('0xa9')]['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x11efb8,null))[_0xb814('0x2b')](function(_0x3e7a9a){if(_0x3e7a9a){return _0x3e7a9a[_0xb814('0xb0')](_0x39ce17[_0xb814('0x6d')][_0xb814('0xb2')],_['omit'](_0x39ce17[_0xb814('0x6d')],[_0xb814('0xb2'),'id'])||{});}})['then'](respondWithResult(_0x11efb8,null))[_0xb814('0x35')](handleError(_0x11efb8,null));};exports[_0xb814('0xb3')]=function(_0x1868d9,_0x570191,_0x56b2aa){var _0x473b30={'raw':![],'where':{}};var _0x4af71e={};var _0x2d40e6={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xb814('0xb4')]({'where':{'id':_0x1868d9['params']['id']}})['then'](handleEntityNotFound(_0x570191,null))[_0xb814('0x2b')](function(_0x32c956){if(_0x32c956){_0x4af71e[_0xb814('0x3a')]=_[_0xb814('0x6e')](db[_0xb814('0xb1')][_0xb814('0x37')]);_0x4af71e[_0xb814('0x3b')]=_[_0xb814('0x6e')](_0x1868d9[_0xb814('0x3b')]);_0x4af71e[_0xb814('0x43')]=_[_0xb814('0x3c')](_0x4af71e['model'],_0x4af71e[_0xb814('0x3b')]);_0x473b30['attributes']=_[_0xb814('0x3c')](_0x4af71e[_0xb814('0x3a')],qs[_0xb814('0x95')](_0x1868d9['query'][_0xb814('0x95')]));_0x473b30[_0xb814('0x3d')]=_0x473b30[_0xb814('0x3d')][_0xb814('0x3e')]?_0x473b30[_0xb814('0x3d')]:_0x4af71e[_0xb814('0x3a')];if(!_0x1868d9[_0xb814('0x3b')][_0xb814('0xb5')](_0xb814('0x3f'))){_0x473b30[_0xb814('0x40')]=qs[_0xb814('0x40')](_0x1868d9[_0xb814('0x3b')][_0xb814('0x40')]);_0x473b30[_0xb814('0x24')]=qs[_0xb814('0x24')](_0x1868d9['query'][_0xb814('0x24')]);}_0x473b30[_0xb814('0x41')]=qs[_0xb814('0x42')](_0x1868d9['query']['sort']);_0x473b30[_0xb814('0x72')]=qs['filters'](_['pick'](_0x1868d9['query'],_0x4af71e['filters']));_0x473b30[_0xb814('0x72')][_0xb814('0xb6')]=_0x32c956['id'];if(_0x1868d9['query'][_0xb814('0x7d')]){_0x473b30[_0xb814('0x72')]=_[_0xb814('0xac')](_0x473b30[_0xb814('0x72')],{'$or':_[_0xb814('0x30')](_0x473b30[_0xb814('0x3d')],function(_0x20e608){var _0x7b9948={};_0x7b9948[_0x20e608]={'$like':'%'+_0x1868d9[_0xb814('0x3b')][_0xb814('0x7d')]+'%'};return _0x7b9948;})});}if(_0x1868d9[_0xb814('0x3b')]['$gte']){var _0x2a5dff=_0x1868d9['query'][_0xb814('0xb7')][_0xb814('0x32')](',');var _0x35e8f7={};_0x35e8f7[_0x2a5dff[0x0]]={'$gte':moment(_0x2a5dff[0x1])[_0xb814('0xb8')](_0xb814('0xb9'))};_0x473b30[_0xb814('0x72')]=_[_0xb814('0xac')](_0x473b30[_0xb814('0x72')],_0x35e8f7);}_0x473b30=_['merge']({},_0x473b30,_0x1868d9['options']);return db['WhatsappMessage'][_0xb814('0x93')]({'where':_0x473b30[_0xb814('0x72')]})[_0xb814('0x2b')](function(_0x3b7bee){_0x2d40e6[_0xb814('0x93')]=_0x3b7bee;if(_0x1868d9[_0xb814('0x3b')][_0xb814('0xab')]){_0x473b30[_0xb814('0xba')]=[{'all':!![]}];}return db[_0xb814('0xb1')][_0xb814('0xbb')](_0x473b30);})['then'](function(_0x5c989a){_0x2d40e6[_0xb814('0xa7')]=_0x5c989a;return _0x2d40e6;});}})[_0xb814('0x2b')](respondWithFilteredResult(_0x570191,_0x473b30))[_0xb814('0x35')](handleError(_0x570191,null));};exports[_0xb814('0xbc')]=function(_0x3f0c9c,_0x2642ab,_0x48358c){return db[_0xb814('0xaa')]['find']({'where':{'id':_0x3f0c9c[_0xb814('0xa9')]['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x2642ab,null))[_0xb814('0x2b')](function(_0x94aa05){if(_0x94aa05){return _0x94aa05[_0xb814('0xbd')](_0x3f0c9c[_0xb814('0x6d')][_0xb814('0xb2')],_['omit'](_0x3f0c9c[_0xb814('0x6d')],[_0xb814('0xb2'),'id'])||{})[_0xb814('0xbe')](function(){return db[_0xb814('0x67')]['findAll']({'attributes':['id',_0xb814('0x2e'),_0xb814('0x46')],'where':{'id':_0x3f0c9c[_0xb814('0x6d')][_0xb814('0xb2')]}});})[_0xb814('0x2b')](function(_0x4a2aa5){socket[_0xb814('0xbf')](_0xb814('0xc0'),{'id':Number(_0x3f0c9c[_0xb814('0xa9')]['id']),'tags':_0x4a2aa5||[]});return{'id':Number(_0x3f0c9c['params']['id']),'tags':_0x4a2aa5||[]};});}})[_0xb814('0x2b')](respondWithResult(_0x2642ab,null))['catch'](handleError(_0x2642ab,null));};exports[_0xb814('0xc1')]=function(_0x5b4315,_0x22f6f1,_0x3467bd){return db[_0xb814('0xaa')][_0xb814('0x6b')]({'where':{'id':_0x5b4315['params']['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x22f6f1,null))[_0xb814('0x2b')](function(_0x3fda0d){if(_0x3fda0d){return _0x3fda0d[_0xb814('0xc1')](_0x5b4315[_0xb814('0x3b')][_0xb814('0xb2')]);}})[_0xb814('0x2b')](respondWithStatusCode(_0x22f6f1,null))[_0xb814('0x35')](handleError(_0x22f6f1,null));};exports[_0xb814('0xc2')]=function(_0x152260,_0x3bc03a){var _0x368696=moment()[_0xb814('0xc3')]()[_0xb814('0x92')]();var _0x8e882a=path['join'](config[_0xb814('0xc4')],_0xb814('0xc5'),_0xb814('0xc6'),_0xb814('0xc7'));var _0x4017b6=path[_0xb814('0xc8')](config['root'],_0xb814('0xc5'),_0xb814('0xc6'),_0xb814('0xc9'));var _0x31b4f5=path['join'](_0x8e882a,_0x368696);var _0x5b5a26=util[_0xb814('0xb8')](_0xb814('0xca'),_0x152260[_0xb814('0xa9')]['id'],_0x368696);var _0x667ca1=path[_0xb814('0xc8')](_0x8e882a,_0x5b5a26);var _0x2c510a=[];_0x2c510a['push']({'model':db[_0xb814('0xcb')],'as':_0xb814('0xcb'),'attributes':['id',_0xb814('0xcc')],'raw':!![]});_0x2c510a[_0xb814('0x34')]({'model':db['CmContact'],'as':_0xb814('0xcd'),'attributes':['id',_0xb814('0xce'),_0xb814('0xcf')],'raw':!![]});if(_0x152260[_0xb814('0x3b')][_0xb814('0xc9')]){_0x2c510a['push']({'model':db[_0xb814('0xd0')],'as':_0xb814('0xd0'),'raw':!![]});}var _0x371dd7=[{'model':db[_0xb814('0xb1')],'as':_0xb814('0xd1'),'attributes':['id',_0xb814('0x6d'),_0xb814('0x75'),_0xb814('0xd2'),_0xb814('0xd3'),_0xb814('0xd4')],'include':_0x2c510a}];_0x371dd7[_0xb814('0x34')]({'model':db[_0xb814('0xd5')],'as':_0xb814('0xd6'),'attributes':['id','name']});_0x371dd7['push']({'model':db[_0xb814('0xcb')],'as':_0xb814('0xd7'),'attributes':['id',_0xb814('0xcc')]});return db['WhatsappInteraction'][_0xb814('0x6b')]({'where':{'id':_0x152260[_0xb814('0xa9')]['id']},'include':_0x371dd7})[_0xb814('0x2b')](handleEntityNotFound(_0x3bc03a,null))['then'](function(_0x10537d){if(_0x10537d){var _0xa651a=_0x10537d[_0xb814('0xd8')]({'plain':!![]});fs[_0xb814('0xd9')](_0x31b4f5);var _0x6ec0f5={'format':'A4','border':_0xb814('0xda'),'header':{'height':'40px','contents':{'first':_0xb814('0xdb')}},'footer':{'height':'30px','contents':{'default':util[_0xb814('0xb8')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xb814('0xb8')](_0xb814('0xdc'),_0xb814('0xdd'),_0xa651a['id']),moment()['format'](_0xb814('0xde'))[_0xb814('0x92')]())}}};var _0x164304={'channel':'Whatsapp','account':_0xa651a[_0xb814('0xd6')]['name'],'agent':_0xa651a[_0xb814('0xd7')]?_0xa651a[_0xb814('0xd7')][_0xb814('0xcc')]:'N.A.','createdAt':moment(_0xa651a[_0xb814('0x75')])[_0xb814('0xb8')](_0xb814('0xb9'))[_0xb814('0x92')](),'closedAt':_0xa651a['closed']?moment(_0xa651a[_0xb814('0xdf')])[_0xb814('0xb8')](_0xb814('0xb9'))[_0xb814('0x92')]():'','disposition':_0xa651a[_0xb814('0xe0')],'messages':_(_0xa651a[_0xb814('0xd1')])[_0xb814('0x7d')]({'secret':![]})[_0xb814('0x30')](function(_0x9a33d0){if(_0x9a33d0['Attachment']){var _0x2fe47b=path[_0xb814('0xc8')](_0x4017b6,_0x9a33d0[_0xb814('0xd0')]['basename']);if(fs[_0xb814('0xe1')](_0x2fe47b)){fs['createReadStream'](_0x2fe47b)['pipe'](fs['createWriteStream'](path[_0xb814('0xc8')](_0x31b4f5,_0x9a33d0['Attachment'][_0xb814('0xe2')])));}}return{'date':moment(_0x9a33d0[_0xb814('0x75')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xb814('0x92')](),'sender':_0x9a33d0['direction']===_0xb814('0xe3')?_0x9a33d0['User']?_0x9a33d0[_0xb814('0xcb')][_0xb814('0xcc')]:_0xb814('0xe4'):_0x9a33d0['Contact']['firstName']+(_0x9a33d0['Contact'][_0xb814('0xcf')]?'\x20'+_0x9a33d0['Contact']['lastName']:''),'body':_0x9a33d0[_0xb814('0xd0')]?_0x9a33d0['Attachment']['basename']:_0x9a33d0['body'],'direction':_0x9a33d0[_0xb814('0xd2')]===_0xb814('0xe3')?'A':'C','secret':_0x9a33d0[_0xb814('0xd3')],'read':_0x9a33d0['read'],'attachment':_0x9a33d0[_0xb814('0xd0')]};})[_0xb814('0x5c')]()};return ejs[_0xb814('0xe5')](path[_0xb814('0xc8')](config[_0xb814('0xc4')],_0xb814('0xc5'),'views',_0xb814('0xe6')),{'interaction':_0x164304})[_0xb814('0x2b')](function(_0x28b818){return new BPromise(function(_0x171845,_0x4f2db2){pdf[_0xb814('0xae')](_0x28b818,_0x6ec0f5)[_0xb814('0xe7')](path[_0xb814('0xc8')](_0x31b4f5,_0xb814('0xe8')+_0xa651a['id']+'-'+_0x368696+_0xb814('0xe9')),function(_0x2cb01d,_0x1f4540){if(_0x2cb01d)return _0x4f2db2(_0x2cb01d);_0x171845(_0x1f4540);});});})[_0xb814('0x2b')](function(){return new BPromise(function(_0x81ebc0,_0x2e7959){zipdir(_0x31b4f5,{'saveTo':_0x667ca1},function(_0x47f054,_0x1aa70b){if(_0x47f054)return _0x2e7959(_0x47f054);return _0x81ebc0(_0x1aa70b);});})[_0xb814('0x2b')](function(){return new BPromise(function(_0x5706ad,_0x3b8438){rimraf(_0x31b4f5,function(_0x56e231){if(_0x56e231)_0x3b8438(_0x56e231);return _0x5706ad();});});})[_0xb814('0x2b')](function(){return _0x3bc03a[_0xb814('0xc2')](_0x667ca1,_0x5b5a26,function(_0x5e2273){if(_0x5e2273){console[_0xb814('0xea')]('err',_0x5e2273);}else{fs[_0xb814('0xeb')](_0x667ca1);}});});});}else{return _0x3bc03a[_0xb814('0x20')](0xc8);}})[_0xb814('0x35')](handleError(_0x3bc03a,null));}; \ No newline at end of file +var _0xc4aa=['status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','push','catch','WhatsappInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','length','getFullTextValue','ContactId','buildExpression','type','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','i.phone\x20LIKE\x20?','group','QueryTypes','SELECT','clone','order','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','include','merge','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','omit','emit','whatsappInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','createdAt','secret','WhatsappAccount','Account','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','format','%s\x20#%d','Whatsapp','YYYY-MM-DD','Owner','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','downloadInteraction.html','transcript-','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus'];(function(_0x107e66,_0x4acaa0){var _0x188bb9=function(_0x577e2a){while(--_0x577e2a){_0x107e66['push'](_0x107e66['shift']());}};_0x188bb9(++_0x4acaa0);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc4aa[_0x5d6456];return _0x4d66c1;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];config[_0xac4a('0x16')]=_[_0xac4a('0x17')](config['redis'],{'host':_0xac4a('0x18'),'port':0x18eb});var socket=require(_0xac4a('0x19'))(new Redis(config[_0xac4a('0x16')]));require(_0xac4a('0x1a'))[_0xac4a('0x1b')](socket);function respondWithStatusCode(_0x3b71c0,_0x34bc01){_0x34bc01=_0x34bc01||0xcc;return function(_0x33c287){if(_0x33c287){return _0x3b71c0[_0xac4a('0x1c')](_0x34bc01);}return _0x3b71c0[_0xac4a('0x1d')](_0x34bc01)[_0xac4a('0x1e')]();};}function respondWithResult(_0x26dbb8,_0x4a2119){_0x4a2119=_0x4a2119||0xc8;return function(_0x402fff){if(_0x402fff){return _0x26dbb8[_0xac4a('0x1d')](_0x4a2119)[_0xac4a('0x1f')](_0x402fff);}};}function respondWithFilteredResult(_0x144553,_0x3e88e3){return function(_0x387a54){if(_0x387a54){var _0x28e304=_0x387a54[_0xac4a('0x20')],_0x44ec59=_0x3e88e3[_0xac4a('0x21')],_0x546c5d=_0x3e88e3[_0xac4a('0x21')]+_0x3e88e3['limit'],_0x5ac21e;if(_0x546c5d>=_0x28e304){_0x546c5d=_0x28e304;_0x5ac21e=0xc8;}else{_0x5ac21e=0xce;}_0x144553[_0xac4a('0x1d')](_0x5ac21e);return _0x144553[_0xac4a('0x22')](_0xac4a('0x23'),_0x44ec59+'-'+_0x546c5d+'/'+_0x28e304)[_0xac4a('0x1f')](_0x387a54);}return null;};}function patchUpdates(_0x123694){return function(_0x3e829c){try{jsonpatch[_0xac4a('0x24')](_0x3e829c,_0x123694,!![]);}catch(_0x3ca790){return BPromise['reject'](_0x3ca790);}return _0x3e829c[_0xac4a('0x25')]();};}function saveUpdates(_0x3204ad,_0x599787){return function(_0x3d7ce0){if(_0x3d7ce0){return _0x3d7ce0[_0xac4a('0x26')](_0x3204ad)[_0xac4a('0x27')](function(_0x947d8e){return _0x947d8e;});}return null;};}function removeEntity(_0x4d2d6c,_0x1b7998){return function(_0x2503d8){if(_0x2503d8){return _0x2503d8[_0xac4a('0x28')]()[_0xac4a('0x27')](function(){_0x4d2d6c[_0xac4a('0x1d')](0xcc)[_0xac4a('0x1e')]();});}};}function handleEntityNotFound(_0x222507,_0x36054a){return function(_0x3e2c69){if(!_0x3e2c69){_0x222507[_0xac4a('0x1c')](0x194);}return _0x3e2c69;};}function handleError(_0x1d0539,_0x215a31){_0x215a31=_0x215a31||0x1f4;return function(_0x14832b){logger[_0xac4a('0x29')](_0x14832b[_0xac4a('0x2a')]);if(_0x14832b[_0xac4a('0x2b')]){delete _0x14832b['name'];}_0x1d0539[_0xac4a('0x1d')](_0x215a31)[_0xac4a('0x2c')](_0x14832b);};}function getInteractionUsers(_0x42a33c,_0x2772fe){return new BPromise(function(_0x116700,_0x4a5a9e){try{if(_0x2772fe[_0x42a33c['id']]){_0x42a33c['Users']=_[_0xac4a('0x2d')](_0x2772fe[_0x42a33c['id']],function(_0x7a948b){return{'id':_0x7a948b['id'],'fullname':_0x7a948b[_0xac4a('0x2e')]};});}}catch(_0x546b65){_0x4a5a9e(_0x546b65);}_0x116700(_0x42a33c);});}function getInteractionTags(_0x4bda1f,_0x355755){return new BPromise(function(_0x2896bc,_0x228629){try{if(_0x4bda1f[_0xac4a('0x2f')]){_0x4bda1f[_0xac4a('0x30')]=[];_0x4bda1f['TagIds'][_0xac4a('0x31')](',')['forEach'](function(_0x30364b){_0x4bda1f['Tags'][_0xac4a('0x32')](_0x355755[_0x30364b]);});}delete _0x4bda1f[_0xac4a('0x2f')];}catch(_0x31501b){_0x228629(_0x31501b);}_0x2896bc(_0x4bda1f);});}function updateWhatsappInteraction(_0x228aa7,_0x34577f,_0x61e552){return new BPromise(function(_0xbd4591,_0x1f13f3){return getInteractionUsers(_0x228aa7,_0x61e552)[_0xac4a('0x27')](function(_0xfd7c16){return getInteractionTags(_0xfd7c16,_0x34577f);})[_0xac4a('0x27')](function(_0x1634df){_0xbd4591(_0x1634df);})[_0xac4a('0x33')](function(_0x1a9d4e){_0x1f13f3(_0x1a9d4e);});});}exports['index']=function(_0x30442d,_0x1c41fb){var _0x5a4e2b={},_0x2a5419={},_0x1af1c1={'count':0x0,'rows':[]};var _0x565164=_['map'](db[_0xac4a('0x34')][_0xac4a('0x35')],function(_0x1b42b6){return{'name':_0x1b42b6[_0xac4a('0x36')],'type':_0x1b42b6['type'][_0xac4a('0x37')]};});_0x2a5419[_0xac4a('0x38')]=_['map'](_0x565164,_0xac4a('0x2b'));_0x2a5419[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x30442d['query']);_0x2a5419[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x2a5419[_0xac4a('0x38')],_0x2a5419['query']);_0x5a4e2b[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x2a5419['model'],qs['fields'](_0x30442d[_0xac4a('0x39')]['fields']));_0x5a4e2b['attributes']=_0x5a4e2b['attributes']['length']?_0x5a4e2b[_0xac4a('0x3d')]:_0x2a5419[_0xac4a('0x38')];if(!_0x30442d[_0xac4a('0x39')][_0xac4a('0x3e')](_0xac4a('0x3f'))){_0x5a4e2b[_0xac4a('0x40')]=qs[_0xac4a('0x40')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x40')]);_0x5a4e2b[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x30442d[_0xac4a('0x39')]['offset']);}_0x5a4e2b['order']=qs['sort'](_0x30442d[_0xac4a('0x39')][_0xac4a('0x41')]);_0x5a4e2b[_0xac4a('0x42')]=qs[_0xac4a('0x3b')](_[_0xac4a('0x43')](_0x30442d[_0xac4a('0x39')],_0x2a5419[_0xac4a('0x3b')]),_0x565164);var _0x3441f2=[];var _0x3e9973=squel[_0xac4a('0x44')]()['field']('id')[_0xac4a('0x45')](_0xac4a('0x2b'))[_0xac4a('0x45')](_0xac4a('0x46'))[_0xac4a('0x47')]('tools_tags');var _0x8700b4=squel[_0xac4a('0x44')]()['field'](_0xac4a('0x48'))['field'](_0xac4a('0x49'))[_0xac4a('0x45')](_0xac4a('0x4a'))[_0xac4a('0x47')](_0xac4a('0x4b'),'ui')[_0xac4a('0x4c')](_0xac4a('0x4d'),'u',_0xac4a('0x4e'));var _0x98e0c4=squel[_0xac4a('0x44')]()[_0xac4a('0x47')](_0xac4a('0x4f'),'i')['left_join'](_0xac4a('0x50'),'c',_0xac4a('0x51'))[_0xac4a('0x4c')]('users','o',_0xac4a('0x52'))[_0xac4a('0x4c')]('whatsapp_accounts','a',_0xac4a('0x53'))['left_join'](_0xac4a('0x54'),'me',_0xac4a('0x55'))[_0xac4a('0x4c')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xac4a('0x4c')]('tools_tags','t',_0xac4a('0x56'));var _0x566258=squel[_0xac4a('0x57')]();var _0x530bbb=[];var _0x3be103=squel[_0xac4a('0x57')]();var _0x424f9b;if(_0x30442d[_0xac4a('0x39')]['search']){_0x424f9b=as[_0xac4a('0x58')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x59')]);var _0x1ee454=_0x424f9b[_0xac4a('0x5a')];for(var _0x138876=0x0;_0x138876<_0x424f9b[_0xac4a('0x5b')]['length'];_0x138876++){var _0x35dee5=_0x424f9b[_0xac4a('0x5b')][_0x138876];var _0x4828e3='i';var _0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0x35dee5[_0xac4a('0x45')]]);if(!_0x16afbe){switch(_0x35dee5['field']){case _0xac4a('0x5d'):if(_0x35dee5[_0xac4a('0x5e')]==0x1){_0x98e0c4[_0xac4a('0x5f')]('`'+_0x35dee5[_0xac4a('0x45')]+_0xac4a('0x60'));}else{_0x98e0c4['having']('`'+_0x35dee5[_0xac4a('0x45')]+'`\x20>\x200');}break;case _0xac4a('0x61'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){if(_0x35dee5['value'][_0xac4a('0x31')]('\x20')[_0xac4a('0x63')]>0x1){_0x566258[_0x1ee454]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x35dee5[_0xac4a('0x5e')]),null);}else{var _0x26b582='%'+_0x35dee5[_0xac4a('0x5e')]+'%';_0x566258[_0x1ee454]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x26b582,_0x26b582,_0x26b582);}}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0xac4a('0x65')]);_0x35dee5[_0xac4a('0x45')]=_0xac4a('0x65');_0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c['text'],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x69'):var _0x2ac1e9=_0x35dee5[_0xac4a('0x5e')][_0xac4a('0x31')](',')[_0xac4a('0x2d')](function(_0x786d9){return Number(_0x786d9);});_0x2ac1e9[_0xac4a('0x6a')](function(_0x38dd4f){_0x3be103['or'](_0xac4a('0x6b'),'%,'+_0x38dd4f+',%');});_0x530bbb=_[_0xac4a('0x6c')](_0x530bbb,_0x2ac1e9);break;case _0xac4a('0x6d'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){_0x566258[_0x1ee454](_0xac4a('0x6e'),'%'+_0x35dee5['value']+'%',null);}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,['name',_0xac4a('0x6f')]);_0x35dee5['field']=_0xac4a('0x6f');_0x19ce2c=as['buildExpression'](_0x4828e3,_0x16afbe['type'],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x71'):_0x19ce2c=as['buildExpression']('me',null,_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c['value'][_0xac4a('0x68')],_0x19ce2c['value'][_0xac4a('0x1e')]);break;}}else{var _0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}}}else{var _0x430dd0=_(_0x30442d[_0xac4a('0x39')])[_0xac4a('0x3a')]()[_0xac4a('0x2d')](function(_0x2cc410){return _[_0xac4a('0x72')](_0x565164,[_0xac4a('0x2b'),_0x2cc410])?_0x2cc410:undefined;})[_0xac4a('0x73')]()['value']();if(!_[_0xac4a('0x74')](_0x430dd0)){_0x430dd0[_0xac4a('0x6a')](function(_0x4fb812){if(_0x4fb812===_0xac4a('0x75')){_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),[][_0xac4a('0x77')](_0x30442d[_0xac4a('0x39')][_0x4fb812]));}else if(_0x4fb812==='createdAt'){var _0x47c6d8=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x79')];var _0x148288=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x7a')];_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x7b'),_0x47c6d8,_0x148288);}else{if(_0x30442d[_0xac4a('0x39')][_0x4fb812]===_0xac4a('0x7c')){_0x98e0c4['where']('i.'+_0x4fb812+'\x20IS\x20NULL');}else{_0x98e0c4[_0xac4a('0x42')]('i.'+_0x4fb812+_0xac4a('0x7d'),_0x30442d[_0xac4a('0x39')][_0x4fb812]);}}});}if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]==0x1){_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x7f'));}else{_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x80'));}}if(_0x30442d[_0xac4a('0x39')]['tag']){_0x530bbb=_[_0xac4a('0x81')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x82')])?_0x30442d[_0xac4a('0x39')]['tag']:new Array(_0x30442d[_0xac4a('0x39')]['tag']);_0x530bbb[_0xac4a('0x6a')](function(_0x3af39a){_0x3be103['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3af39a+',%');});}if(_0x30442d['query'][_0xac4a('0x83')]){var _0x3b8974=_0x30442d[_0xac4a('0x39')]['filter'][_0xac4a('0x84')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xac4a('0x85'));if(qs['isNumeric'](_0x3b8974)){_0x566258['or']('i.id\x20LIKE\x20?',_0x3b8974+'%')['or'](_0xac4a('0x86'),_0x3b8974+'%');}else{_0x566258['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x3b8974))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3b8974+'%');}}}_0x98e0c4[_0xac4a('0x42')](_0x566258);_0x98e0c4[_0xac4a('0x87')]('i.id');var _0x3980ae={'type':db['Sequelize'][_0xac4a('0x88')][_0xac4a('0x89')],'raw':!![]};var _0x522949=_0x98e0c4[_0xac4a('0x8a')]();_0x522949['field']('i.id');_0x522949[_0xac4a('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xac4a('0x5d'));if(_0x5a4e2b['order']){_0x5a4e2b['order'][_0xac4a('0x6a')](function(_0x4065c0){_0x98e0c4[_0xac4a('0x8b')]('i.'+_0x4065c0[0x0],_0x4065c0[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x530bbb)){_0x98e0c4[_0xac4a('0x5f')](_0x3be103);_0x522949[_0xac4a('0x42')]('t.id\x20IN\x20?',_0x530bbb);}BPromise['resolve']()[_0xac4a('0x27')](function(){if(!_0x424f9b){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x75')]||_0x30442d[_0xac4a('0x39')][_0xac4a('0x8c')])return;_0x522949[_0xac4a('0x42')](_0xac4a('0x8d'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8d'));return;}return _0x30442d['user'][_0xac4a('0x8e')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x27')](function(_0x3ba61e){if(_['isEmpty'](_0x3ba61e)){_0x522949[_0xac4a('0x42')](_0xac4a('0x8f'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8f'));}else{_0x522949[_0xac4a('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0xac4a('0x2d')](_0x3ba61e,'id'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),_[_0xac4a('0x2d')](_0x3ba61e,'id'));}});})[_0xac4a('0x27')](function(){db[_0xac4a('0x90')][_0xac4a('0x39')](_0x522949['toString'](),_0x3980ae)[_0xac4a('0x27')](function(_0x2be178){_0x1af1c1[_0xac4a('0x20')]=_0x2be178[_0xac4a('0x63')];if(_0x1af1c1[_0xac4a('0x20')]===0x0)return[];return db[_0xac4a('0x90')]['query'](_0x3e9973[_0xac4a('0x91')](),_0x3980ae)[_0xac4a('0x27')](function(_0x1b9a33){_0x3441f2=_[_0xac4a('0x92')](_0x1b9a33,'id');_0x3980ae=_['merge'](_0x3980ae,{'model':db[_0xac4a('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x30442d['query'][_0xac4a('0x93')]){_0x5a4e2b[_0xac4a('0x3d')]['forEach'](function(_0x5b95ab){_0x98e0c4[_0xac4a('0x45')]('i.'+_0x5b95ab);});}else{_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x94'),'unreadMessages');_0x98e0c4[_0xac4a('0x45')]('a.key',_0xac4a('0x95'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x96'),_0xac4a('0x97'));_0x98e0c4[_0xac4a('0x45')]('i.*');_0x98e0c4['field'](_0xac4a('0x98'),_0xac4a('0x99'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9a'),_0xac4a('0x9b'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9c'),_0xac4a('0x9d'));_0x98e0c4['field']('c.phone',_0xac4a('0x9e'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9f'),_0xac4a('0xa0'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa1'),_0xac4a('0xa2'));_0x98e0c4[_0xac4a('0x45')]('o.fullname','Owner.fullname');_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa3'),_0xac4a('0xa4'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa5'),_0xac4a('0x2f'));}if(_0x5a4e2b[_0xac4a('0x40')])_0x98e0c4['limit'](_0x5a4e2b[_0xac4a('0x40')]);if(_0x5a4e2b[_0xac4a('0x21')])_0x98e0c4[_0xac4a('0x21')](_0x5a4e2b['offset']);return db[_0xac4a('0x90')][_0xac4a('0x39')](_0x98e0c4[_0xac4a('0x91')](),_0x3980ae);})[_0xac4a('0x27')](function(_0x1a7448){_0x8700b4[_0xac4a('0x42')](_0xac4a('0xa6'),_[_0xac4a('0x2d')](_0x1a7448,'id'));return db[_0xac4a('0x90')]['query'](_0x8700b4[_0xac4a('0x91')](),_0x3980ae)['then'](function(_0x203321){var _0x1199f6=_[_0xac4a('0xa7')](_0x203321,_0xac4a('0xa8'));var _0x840fec=[];_0x1a7448[_0xac4a('0x6a')](function(_0x19766a){_0x840fec['push'](updateWhatsappInteraction(_0x19766a,_0x3441f2,_0x1199f6));});return BPromise[_0xac4a('0xa9')](_0x840fec);});});})[_0xac4a('0x27')](function(_0x279f9b){_0x1af1c1[_0xac4a('0xaa')]=_0x279f9b;return _0x1af1c1;})[_0xac4a('0x27')](respondWithFilteredResult(_0x1c41fb,_0x5a4e2b));})['catch'](handleError(_0x1c41fb,null));};exports[_0xac4a('0xab')]=function(_0x360d4f,_0x4f2b19){var _0x55af32={'raw':![],'where':{'id':_0x360d4f[_0xac4a('0xac')]['id']}},_0x386d6d={};_0x386d6d['model']=_[_0xac4a('0x3a')](db[_0xac4a('0x34')][_0xac4a('0x35')]);_0x386d6d[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x360d4f[_0xac4a('0x39')]);_0x386d6d['filters']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],_0x386d6d[_0xac4a('0x39')]);_0x55af32['attributes']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],qs[_0xac4a('0x93')](_0x360d4f[_0xac4a('0x39')][_0xac4a('0x93')]));_0x55af32[_0xac4a('0x3d')]=_0x55af32['attributes'][_0xac4a('0x63')]?_0x55af32[_0xac4a('0x3d')]:_0x386d6d['model'];if(_0x360d4f[_0xac4a('0x39')]['includeAll']){_0x55af32[_0xac4a('0xad')]=[{'all':!![]}];}_0x55af32=_[_0xac4a('0xae')]({},_0x55af32,_0x360d4f['options']);return db[_0xac4a('0x34')]['find'](_0x55af32)[_0xac4a('0x27')](handleEntityNotFound(_0x4f2b19,null))['then'](respondWithResult(_0x4f2b19,null))[_0xac4a('0x33')](handleError(_0x4f2b19,null));};exports[_0xac4a('0xaf')]=function(_0x24f464,_0xfe8977){return db[_0xac4a('0x34')][_0xac4a('0xaf')](_0x24f464[_0xac4a('0x71')],{})[_0xac4a('0x27')](respondWithResult(_0xfe8977,0xc9))[_0xac4a('0x33')](handleError(_0xfe8977,null));};exports[_0xac4a('0x26')]=function(_0x3a0163,_0x455eb7){if(_0x3a0163[_0xac4a('0x71')]['id']){delete _0x3a0163[_0xac4a('0x71')]['id'];}return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x3a0163[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x455eb7,null))[_0xac4a('0x27')](saveUpdates(_0x3a0163[_0xac4a('0x71')],null))[_0xac4a('0x27')](respondWithResult(_0x455eb7,null))[_0xac4a('0x33')](handleError(_0x455eb7,null));};exports[_0xac4a('0x28')]=function(_0x5d5bb3,_0x101137){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x5d5bb3[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x101137,null))[_0xac4a('0x27')](removeEntity(_0x101137,null))['catch'](handleError(_0x101137,null));};exports[_0xac4a('0xb0')]=function(_0x55866d,_0x277fd1){return db[_0xac4a('0x34')][_0xac4a('0xb0')]()['then'](respondWithResult(_0x277fd1,null))[_0xac4a('0x33')](handleError(_0x277fd1,null));};exports[_0xac4a('0xb1')]=function(_0x127ede,_0x52f3f2,_0x2da95f){return db[_0xac4a('0xb2')][_0xac4a('0x5c')]({'where':{'id':_0x127ede[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x52f3f2,null))[_0xac4a('0x27')](function(_0x3b4183){if(_0x3b4183){return _0x3b4183[_0xac4a('0xb1')](_0x127ede['body'][_0xac4a('0xb3')],_['omit'](_0x127ede['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x52f3f2,null))['catch'](handleError(_0x52f3f2,null));};exports[_0xac4a('0xb4')]=function(_0x58fcb0,_0xc014a6,_0x377444){var _0x2132b2={'raw':![],'where':{}};var _0x525d50={};var _0x9ea4d1={'count':0x0,'rows':[]};return db[_0xac4a('0x34')][_0xac4a('0xb5')]({'where':{'id':_0x58fcb0[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0xc014a6,null))[_0xac4a('0x27')](function(_0x7a1b25){if(_0x7a1b25){_0x525d50[_0xac4a('0x38')]=_['keys'](db[_0xac4a('0xb2')][_0xac4a('0x35')]);_0x525d50[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x58fcb0[_0xac4a('0x39')]);_0x525d50[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x525d50['model'],_0x525d50['query']);_0x2132b2[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x525d50['model'],qs[_0xac4a('0x93')](_0x58fcb0[_0xac4a('0x39')]['fields']));_0x2132b2['attributes']=_0x2132b2[_0xac4a('0x3d')][_0xac4a('0x63')]?_0x2132b2[_0xac4a('0x3d')]:_0x525d50[_0xac4a('0x38')];if(!_0x58fcb0[_0xac4a('0x39')]['hasOwnProperty'](_0xac4a('0x3f'))){_0x2132b2['limit']=qs['limit'](_0x58fcb0['query'][_0xac4a('0x40')]);_0x2132b2[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x21')]);}_0x2132b2[_0xac4a('0x8b')]=qs[_0xac4a('0x41')](_0x58fcb0[_0xac4a('0x39')]['sort']);_0x2132b2['where']=qs['filters'](_[_0xac4a('0x43')](_0x58fcb0[_0xac4a('0x39')],_0x525d50[_0xac4a('0x3b')]));_0x2132b2[_0xac4a('0x42')][_0xac4a('0xa8')]=_0x7a1b25['id'];if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]){_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],{'$or':_[_0xac4a('0x2d')](_0x2132b2[_0xac4a('0x3d')],function(_0xe0fd57){var _0x32b013={};_0x32b013[_0xe0fd57]={'$like':'%'+_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]+'%'};return _0x32b013;})});}if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')]){var _0x41cdb5=_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')][_0xac4a('0x31')](',');var _0x3e2575={};_0x3e2575[_0x41cdb5[0x0]]={'$gte':moment(_0x41cdb5[0x1])['format'](_0xac4a('0xb6'))};_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],_0x3e2575);}_0x2132b2=_[_0xac4a('0xae')]({},_0x2132b2,_0x58fcb0[_0xac4a('0xb7')]);return db[_0xac4a('0xb2')][_0xac4a('0x20')]({'where':_0x2132b2['where']})['then'](function(_0x113f80){_0x9ea4d1[_0xac4a('0x20')]=_0x113f80;if(_0x58fcb0[_0xac4a('0x39')]['includeAll']){_0x2132b2['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xac4a('0xb8')](_0x2132b2);})['then'](function(_0x59e82c){_0x9ea4d1[_0xac4a('0xaa')]=_0x59e82c;return _0x9ea4d1;});}})['then'](respondWithFilteredResult(_0xc014a6,_0x2132b2))[_0xac4a('0x33')](handleError(_0xc014a6,null));};exports['addTags']=function(_0x3f95a4,_0x2b4f28,_0x413f5f){return db[_0xac4a('0x34')][_0xac4a('0x5c')]({'where':{'id':_0x3f95a4[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x2b4f28,null))[_0xac4a('0x27')](function(_0x34b6d7){if(_0x34b6d7){return _0x34b6d7[_0xac4a('0xb9')](_0x3f95a4['body'][_0xac4a('0xb3')],_[_0xac4a('0xba')](_0x3f95a4[_0xac4a('0x71')],[_0xac4a('0xb3'),'id'])||{})['spread'](function(){return db[_0xac4a('0x69')][_0xac4a('0xb8')]({'attributes':['id',_0xac4a('0x2b'),_0xac4a('0x46')],'where':{'id':_0x3f95a4[_0xac4a('0x71')][_0xac4a('0xb3')]}});})['then'](function(_0x57d3cd){socket[_0xac4a('0xbb')](_0xac4a('0xbc'),{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]});return{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]};});}})[_0xac4a('0x27')](respondWithResult(_0x2b4f28,null))[_0xac4a('0x33')](handleError(_0x2b4f28,null));};exports['removeTags']=function(_0x21a6f6,_0x580c9b,_0xe4165d){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x21a6f6[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x580c9b,null))[_0xac4a('0x27')](function(_0x5650ce){if(_0x5650ce){return _0x5650ce[_0xac4a('0xbd')](_0x21a6f6[_0xac4a('0x39')][_0xac4a('0xb3')]);}})[_0xac4a('0x27')](respondWithStatusCode(_0x580c9b,null))[_0xac4a('0x33')](handleError(_0x580c9b,null));};exports['download']=function(_0x3dd60a,_0xbe1958){var _0x462964=moment()[_0xac4a('0xbe')]()[_0xac4a('0x91')]();var _0x5e5eb1=path[_0xac4a('0xbf')](config[_0xac4a('0xc0')],_0xac4a('0xc1'),_0xac4a('0xc2'),_0xac4a('0xc3'));var _0x55ccc3=path['join'](config['root'],'server',_0xac4a('0xc2'),_0xac4a('0xc4'));var _0x17f815=path[_0xac4a('0xbf')](_0x5e5eb1,_0x462964);var _0xa8b5bb=util['format'](_0xac4a('0xc5'),_0x3dd60a[_0xac4a('0xac')]['id'],_0x462964);var _0x5aad90=path[_0xac4a('0xbf')](_0x5e5eb1,_0xa8b5bb);var _0x14b425=[];_0x14b425[_0xac4a('0x32')]({'model':db['User'],'as':_0xac4a('0x6d'),'attributes':['id',_0xac4a('0x2e')],'raw':!![]});_0x14b425[_0xac4a('0x32')]({'model':db[_0xac4a('0xc6')],'as':_0xac4a('0x61'),'attributes':['id',_0xac4a('0xc7'),_0xac4a('0xc8')],'raw':!![]});if(_0x3dd60a[_0xac4a('0x39')][_0xac4a('0xc4')]){_0x14b425['push']({'model':db[_0xac4a('0xc9')],'as':_0xac4a('0xc9'),'raw':!![]});}var _0x579181=[{'model':db[_0xac4a('0xb2')],'as':'Messages','attributes':['id',_0xac4a('0x71'),_0xac4a('0xca'),'direction',_0xac4a('0xcb'),_0xac4a('0x7e')],'include':_0x14b425}];_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0xcc')],'as':_0xac4a('0xcd'),'attributes':['id',_0xac4a('0x2b')]});_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0x6d')],'as':'Owner','attributes':['id','fullname']});return db[_0xac4a('0x34')]['find']({'where':{'id':_0x3dd60a['params']['id']},'include':_0x579181})[_0xac4a('0x27')](handleEntityNotFound(_0xbe1958,null))[_0xac4a('0x27')](function(_0x3254c3){if(_0x3254c3){var _0x516225=_0x3254c3[_0xac4a('0xce')]({'plain':!![]});fs[_0xac4a('0xcf')](_0x17f815);var _0x5a2abf={'format':'A4','border':'10px','header':{'height':_0xac4a('0xd0'),'contents':{'first':_0xac4a('0xd1')}},'footer':{'height':_0xac4a('0xd2'),'contents':{'default':util[_0xac4a('0xd3')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\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[_0xac4a('0xd3')](_0xac4a('0xd4'),_0xac4a('0xd5'),_0x516225['id']),moment()['format'](_0xac4a('0xd6'))[_0xac4a('0x91')]())}}};var _0x15b97a={'channel':_0xac4a('0xd5'),'account':_0x516225[_0xac4a('0xcd')]['name'],'agent':_0x516225['Owner']?_0x516225[_0xac4a('0xd7')][_0xac4a('0x2e')]:_0xac4a('0xd8'),'createdAt':moment(_0x516225[_0xac4a('0xca')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')](),'closedAt':_0x516225[_0xac4a('0xd9')]?moment(_0x516225[_0xac4a('0xda')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')]():'','disposition':_0x516225[_0xac4a('0xdb')],'messages':_(_0x516225['Messages'])[_0xac4a('0x83')]({'secret':![]})['map'](function(_0x4ec2c3){if(_0x4ec2c3[_0xac4a('0xc9')]){var _0x27833a=path[_0xac4a('0xbf')](_0x55ccc3,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]);if(fs[_0xac4a('0xdd')](_0x27833a)){fs[_0xac4a('0xde')](_0x27833a)[_0xac4a('0xdf')](fs[_0xac4a('0xe0')](path['join'](_0x17f815,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')])));}}return{'date':moment(_0x4ec2c3[_0xac4a('0xca')])[_0xac4a('0xd3')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x4ec2c3[_0xac4a('0xe1')]===_0xac4a('0xe2')?_0x4ec2c3[_0xac4a('0x6d')]?_0x4ec2c3[_0xac4a('0x6d')][_0xac4a('0x2e')]:_0xac4a('0xe3'):_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc7')]+(_0x4ec2c3[_0xac4a('0x61')]['lastName']?'\x20'+_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc8')]:''),'body':_0x4ec2c3[_0xac4a('0xc9')]?_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]:_0x4ec2c3[_0xac4a('0x71')],'direction':_0x4ec2c3['direction']==='out'?'A':'C','secret':_0x4ec2c3['secret'],'read':_0x4ec2c3[_0xac4a('0x7e')],'attachment':_0x4ec2c3[_0xac4a('0xc9')]};})['value']()};return ejs['renderFile'](path[_0xac4a('0xbf')](config['root'],_0xac4a('0xc1'),'views',_0xac4a('0xe4')),{'interaction':_0x15b97a})[_0xac4a('0x27')](function(_0x1888c3){return new BPromise(function(_0x4a04c3,_0x14435d){pdf[_0xac4a('0xaf')](_0x1888c3,_0x5a2abf)['toFile'](path[_0xac4a('0xbf')](_0x17f815,_0xac4a('0xe5')+_0x516225['id']+'-'+_0x462964+'.pdf'),function(_0x48a75c,_0x4514a5){if(_0x48a75c)return _0x14435d(_0x48a75c);_0x4a04c3(_0x4514a5);});});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x43df37,_0x45e45b){zipdir(_0x17f815,{'saveTo':_0x5aad90},function(_0x367254,_0x22cc71){if(_0x367254)return _0x45e45b(_0x367254);return _0x43df37(_0x22cc71);});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x1ea4ef,_0x156b67){rimraf(_0x17f815,function(_0x330070){if(_0x330070)_0x156b67(_0x330070);return _0x1ea4ef();});});})[_0xac4a('0x27')](function(){return _0xbe1958[_0xac4a('0xe6')](_0x5aad90,_0xa8b5bb,function(_0x2d755c){if(_0x2d755c){console[_0xac4a('0xe7')](_0xac4a('0xe8'),_0x2d755c);}else{fs[_0xac4a('0xe9')](_0x5aad90);}});});});}else{return _0xbe1958[_0xac4a('0x1c')](0xc8);}})['catch'](handleError(_0xbe1958,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 1d9bf4a..8761b90 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 _0xc7aa=['unreadMessages','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','remove','getUsers','setDataValue','findAll','then'];(function(_0xf852,_0x4ddd76){var _0x5b2550=function(_0x4811b1){while(--_0x4811b1){_0xf852['push'](_0xf852['shift']());}};_0x5b2550(++_0x4ddd76);}(_0xc7aa,0x1a9));var _0xac7a=function(_0x4ba20a,_0x50575d){_0x4ba20a=_0x4ba20a-0x0;var _0x2ce02e=_0xc7aa[_0x4ba20a];return _0x2ce02e;};'use strict';var EventEmitter=require(_0xac7a('0x0'));var WhatsappInteraction=require(_0xac7a('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xac7a('0x1'))['db'][_0xac7a('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xac7a('0x3')](0x0);var events={'afterCreate':_0xac7a('0x4'),'afterUpdate':'update','afterDestroy':_0xac7a('0x5')};function emitEvent(_0x502d37){return function(_0x5e6974,_0x2a3b4a,_0x12c51b){_0x5e6974[_0xac7a('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4e4054){_0x5e6974[_0xac7a('0x7')]('Users',_0x4e4054['map'](function(_0x2b5967){return{'id':_0x2b5967['id']};}));return WhatsappMessage[_0xac7a('0x8')]({'where':{'WhatsappInteractionId':_0x5e6974['id'],'direction':'in','read':![]},'raw':!![]});})[_0xac7a('0x9')](function(_0x273097){_0x5e6974[_0xac7a('0x7')](_0xac7a('0xa'),_0x273097['length']);WhatsappInteractionEvents['emit'](_0x502d37+':'+_0x5e6974['id'],_0x5e6974);WhatsappInteractionEvents['emit'](_0x502d37,_0x5e6974);_0x12c51b(null);})[_0xac7a('0xb')](_0x12c51b(null));};}for(var e in events){if(events[_0xac7a('0xc')](e)){var event=events[e];WhatsappInteraction[_0xac7a('0xd')](e,emitEvent(event));}}module[_0xac7a('0xe')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xf9cf=['remove','setDataValue','findAll','then','emit','catch','hasOwnProperty','exports','events','../../mysqldb','WhatsappMessage','update'];(function(_0x3bc27a,_0x22f578){var _0x1ce99f=function(_0x350e8a){while(--_0x350e8a){_0x3bc27a['push'](_0x3bc27a['shift']());}};_0x1ce99f(++_0x22f578);}(_0xf9cf,0xec));var _0xff9c=function(_0x590c95,_0x201025){_0x590c95=_0x590c95-0x0;var _0xce7cae=_0xf9cf[_0x590c95];return _0xce7cae;};'use strict';var EventEmitter=require(_0xff9c('0x0'));var WhatsappInteraction=require(_0xff9c('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xff9c('0x1'))['db'][_0xff9c('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xff9c('0x3'),'afterDestroy':_0xff9c('0x4')};function emitEvent(_0x190bad){return function(_0x83d409,_0xc5016f,_0x2d4b09){_0x83d409['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x3f0ec9){_0x83d409[_0xff9c('0x5')]('Users',_0x3f0ec9['map'](function(_0x36329d){return{'id':_0x36329d['id']};}));return WhatsappMessage[_0xff9c('0x6')]({'where':{'WhatsappInteractionId':_0x83d409['id'],'direction':'in','read':![]},'raw':!![]});})[_0xff9c('0x7')](function(_0x585bba){_0x83d409[_0xff9c('0x5')]('unreadMessages',_0x585bba['length']);WhatsappInteractionEvents[_0xff9c('0x8')](_0x190bad+':'+_0x83d409['id'],_0x83d409);WhatsappInteractionEvents[_0xff9c('0x8')](_0x190bad,_0x83d409);_0x2d4b09(null);})[_0xff9c('0x9')](_0x2d4b09(null));};}for(var e in events){if(events[_0xff9c('0xa')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xff9c('0xb')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index bfb527c..ed3647b 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 _0x10cd=['whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','request-promise','path','../../config/environment','exports','define','WhatsappInteraction'];(function(_0x5211c1,_0x5e4fb0){var _0x17cc1b=function(_0x1d51a0){while(--_0x1d51a0){_0x5211c1['push'](_0x5211c1['shift']());}};_0x17cc1b(++_0x5e4fb0);}(_0x10cd,0x123));var _0xd10c=function(_0x1b820f,_0x425eb4){_0x1b820f=_0x1b820f-0x0;var _0x423354=_0x10cd[_0x1b820f];return _0x423354;};'use strict';var _=require(_0xd10c('0x0'));var util=require('util');var logger=require(_0xd10c('0x1'))(_0xd10c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd10c('0x3'));var fs=require('fs');var path=require(_0xd10c('0x4'));var rimraf=require('rimraf');var config=require(_0xd10c('0x5'));var attributes=require('./whatsappInteraction.attributes');module[_0xd10c('0x6')]=function(_0x3d5136,_0x38d9a8){return _0x3d5136[_0xd10c('0x7')](_0xd10c('0x8'),attributes,{'tableName':_0xd10c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x151cb9,_0x178c88,_0x2f23b1){if(_0x151cb9[_0xd10c('0xa')](_0xd10c('0xb'))){_0x151cb9[_0xd10c('0xc')]=moment()[_0xd10c('0xd')](_0xd10c('0xe'));}_0x2f23b1(null,_0x151cb9);}}});}; \ No newline at end of file +var _0x5d5b=['closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','bluebird','request-promise','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','whatsapp_interactions'];(function(_0x2ad008,_0x45c253){var _0x4538cf=function(_0xe143e4){while(--_0xe143e4){_0x2ad008['push'](_0x2ad008['shift']());}};_0x4538cf(++_0x45c253);}(_0x5d5b,0x1e3));var _0xb5d5=function(_0x499e26,_0xb719e9){_0x499e26=_0x499e26-0x0;var _0x77f91e=_0x5d5b[_0x499e26];return _0x77f91e;};'use strict';var _=require('lodash');var util=require(_0xb5d5('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb5d5('0x1'));var rp=require(_0xb5d5('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb5d5('0x3'));var config=require(_0xb5d5('0x4'));var attributes=require(_0xb5d5('0x5'));module[_0xb5d5('0x6')]=function(_0x5ed371,_0x34fb69){return _0x5ed371[_0xb5d5('0x7')]('WhatsappInteraction',attributes,{'tableName':_0xb5d5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57cc88,_0x5a88b7,_0x420248){if(_0x57cc88['changed'](_0xb5d5('0x9'))){_0x57cc88[_0xb5d5('0xa')]=moment()['format'](_0xb5d5('0xb'));}_0x420248(null,_0x57cc88);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index cecab42..0c8a6e9 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 _0xf6de=['attributes','limit','find','where','addTags','body','ids','omit','spread','AddTags','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf6de,0x130));var _0xef6d=function(_0x419550,_0x15cdf1){_0x419550=_0x419550-0x0;var _0x55f9ef=_0xf6de[_0x419550];return _0x55f9ef;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xef6d('0x0'));var fs=require('fs');var Redis=require(_0xef6d('0x1'));var db=require(_0xef6d('0x2'))['db'];var utils=require(_0xef6d('0x3'));var logger=require(_0xef6d('0x4'))('rpc');var config=require(_0xef6d('0x5'));var jayson=require(_0xef6d('0x6'));var client=jayson[_0xef6d('0x7')][_0xef6d('0x8')]({'port':0x232a});config[_0xef6d('0x9')]=_[_0xef6d('0xa')](config['redis'],{'host':_0xef6d('0xb'),'port':0x18eb});var socket=require(_0xef6d('0xc'))(new Redis(config[_0xef6d('0x9')]));require(_0xef6d('0xd'))[_0xef6d('0xe')](socket);function respondWithRpcPromise(_0x505024,_0x5b4221,_0x1d08eb){return new BPromise(function(_0x574cd4,_0x439a2a){return client['request'](_0x505024,_0x1d08eb)[_0xef6d('0xf')](function(_0x27589a){logger[_0xef6d('0x10')](_0xef6d('0x11'),_0x5b4221,_0xef6d('0x12'));logger[_0xef6d('0x13')](_0xef6d('0x14'),_0x5b4221,_0xef6d('0x12'),JSON[_0xef6d('0x15')](_0x27589a));if(_0x27589a[_0xef6d('0x16')]){if(_0x27589a[_0xef6d('0x16')][_0xef6d('0x17')]===0x1f4){logger['error'](_0xef6d('0x11'),_0x5b4221,_0x27589a[_0xef6d('0x16')]['message']);return _0x439a2a(_0x27589a[_0xef6d('0x16')][_0xef6d('0x18')]);}logger[_0xef6d('0x16')](_0xef6d('0x11'),_0x5b4221,_0x27589a[_0xef6d('0x16')]['message']);return _0x574cd4(_0x27589a['error'][_0xef6d('0x18')]);}else{logger[_0xef6d('0x10')](_0xef6d('0x11'),_0x5b4221,'request\x20sent');_0x574cd4(_0x27589a[_0xef6d('0x19')][_0xef6d('0x18')]);}})[_0xef6d('0x1a')](function(_0x4a233e){logger[_0xef6d('0x16')](_0xef6d('0x11'),_0x5b4221,_0x4a233e);_0x439a2a(_0x4a233e);});});}exports[_0xef6d('0x1b')]=function(_0x4136ee){var _0x10d471=this;return new Promise(function(_0x4e7538,_0x2a0c6e){return db[_0xef6d('0x1c')][_0xef6d('0x1d')](_0x4136ee['body'],{'raw':_0x4136ee['options']?_0x4136ee[_0xef6d('0x1e')][_0xef6d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4136ee[_0xef6d('0x1e')]?_0x4136ee[_0xef6d('0x1e')]['where']||null:null,'attributes':_0x4136ee['options']?_0x4136ee[_0xef6d('0x1e')][_0xef6d('0x20')]||null:null,'limit':_0x4136ee[_0xef6d('0x1e')]?_0x4136ee[_0xef6d('0x1e')][_0xef6d('0x21')]||null:null})[_0xef6d('0xf')](function(_0x40c336){logger[_0xef6d('0x10')]('UpdateWhatsappInteraction',_0x4136ee);logger[_0xef6d('0x13')]('UpdateWhatsappInteraction',_0x4136ee,JSON['stringify'](_0x40c336));_0x4e7538(_0x40c336);})[_0xef6d('0x1a')](function(_0x3cc574){logger[_0xef6d('0x16')]('UpdateWhatsappInteraction',_0x3cc574[_0xef6d('0x18')],_0x4136ee);_0x2a0c6e(_0x10d471[_0xef6d('0x16')](0x1f4,_0x3cc574[_0xef6d('0x18')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0xc9f9f6){return new Promise(function(_0xfdd5ad,_0x185721){return db[_0xef6d('0x1c')][_0xef6d('0x22')]({'where':_0xc9f9f6[_0xef6d('0x1e')]?_0xc9f9f6[_0xef6d('0x1e')][_0xef6d('0x23')]||null:null})[_0xef6d('0xf')](function(_0x874002){if(_0x874002){return _0x874002[_0xef6d('0x24')](_0xc9f9f6[_0xef6d('0x25')][_0xef6d('0x26')],_[_0xef6d('0x27')](_0xc9f9f6[_0xef6d('0x25')],['ids','id'])||{});}})[_0xef6d('0x28')](function(_0x506b0c){logger[_0xef6d('0x10')](_0xef6d('0x29'),_0xc9f9f6);logger[_0xef6d('0x13')](_0xef6d('0x29'),_0xc9f9f6,JSON[_0xef6d('0x15')](_0x506b0c));_0xfdd5ad(_0x506b0c);})[_0xef6d('0x1a')](function(_0x1cecb6){logger[_0xef6d('0x16')](_0xef6d('0x29'),_0x1cecb6[_0xef6d('0x18')],_0xc9f9f6);_0x185721(_this['error'](0x1f4,_0x1cecb6['message']));});});}; \ No newline at end of file +var _0x7ccd=['options','raw','where','attributes','limit','find','addTags','ids','omit','spread','AddTags','debug','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','socket.io-emitter','./whatsappInteraction.socket','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','body'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7ccd,0x150));var _0xd7cc=function(_0x2e4644,_0x5d1e57){_0x2e4644=_0x2e4644-0x0;var _0xac2e96=_0x7ccd[_0x2e4644];return _0xac2e96;};'use strict';var _=require(_0xd7cc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd7cc('0x1'));var rs=require(_0xd7cc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd7cc('0x3'))['db'];var utils=require(_0xd7cc('0x4'));var logger=require(_0xd7cc('0x5'))(_0xd7cc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd7cc('0x7')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd7cc('0x8'))(new Redis(config['redis']));require(_0xd7cc('0x9'))['register'](socket);function respondWithRpcPromise(_0x159b1a,_0x1dd1c9,_0x1fa894){return new BPromise(function(_0x52ae82,_0x2c45ff){return client[_0xd7cc('0xa')](_0x159b1a,_0x1fa894)[_0xd7cc('0xb')](function(_0x236277){logger[_0xd7cc('0xc')](_0xd7cc('0xd'),_0x1dd1c9,_0xd7cc('0xe'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x1dd1c9,_0xd7cc('0xe'),JSON[_0xd7cc('0xf')](_0x236277));if(_0x236277['error']){if(_0x236277[_0xd7cc('0x10')][_0xd7cc('0x11')]===0x1f4){logger[_0xd7cc('0x10')](_0xd7cc('0xd'),_0x1dd1c9,_0x236277['error']['message']);return _0x2c45ff(_0x236277['error'][_0xd7cc('0x12')]);}logger[_0xd7cc('0x10')](_0xd7cc('0xd'),_0x1dd1c9,_0x236277[_0xd7cc('0x10')]['message']);return _0x52ae82(_0x236277[_0xd7cc('0x10')][_0xd7cc('0x12')]);}else{logger[_0xd7cc('0xc')]('WhatsappInteraction,\x20%s,\x20%s',_0x1dd1c9,_0xd7cc('0xe'));_0x52ae82(_0x236277[_0xd7cc('0x13')][_0xd7cc('0x12')]);}})[_0xd7cc('0x14')](function(_0x40d4cc){logger[_0xd7cc('0x10')](_0xd7cc('0xd'),_0x1dd1c9,_0x40d4cc);_0x2c45ff(_0x40d4cc);});});}exports[_0xd7cc('0x15')]=function(_0x5084c2){var _0xf5c061=this;return new Promise(function(_0xc7917e,_0x19a2dc){return db[_0xd7cc('0x16')]['update'](_0x5084c2[_0xd7cc('0x17')],{'raw':_0x5084c2[_0xd7cc('0x18')]?_0x5084c2[_0xd7cc('0x18')][_0xd7cc('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5084c2[_0xd7cc('0x18')]?_0x5084c2[_0xd7cc('0x18')][_0xd7cc('0x1a')]||null:null,'attributes':_0x5084c2['options']?_0x5084c2['options'][_0xd7cc('0x1b')]||null:null,'limit':_0x5084c2[_0xd7cc('0x18')]?_0x5084c2[_0xd7cc('0x18')][_0xd7cc('0x1c')]||null:null})['then'](function(_0x26dcd8){logger['info']('UpdateWhatsappInteraction',_0x5084c2);logger['debug']('UpdateWhatsappInteraction',_0x5084c2,JSON['stringify'](_0x26dcd8));_0xc7917e(_0x26dcd8);})['catch'](function(_0x7e8892){logger['error'](_0xd7cc('0x15'),_0x7e8892[_0xd7cc('0x12')],_0x5084c2);_0x19a2dc(_0xf5c061[_0xd7cc('0x10')](0x1f4,_0x7e8892[_0xd7cc('0x12')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0xc97aef){return new Promise(function(_0x4b05b4,_0x36d9cf){return db[_0xd7cc('0x16')][_0xd7cc('0x1d')]({'where':_0xc97aef[_0xd7cc('0x18')]?_0xc97aef[_0xd7cc('0x18')]['where']||null:null})[_0xd7cc('0xb')](function(_0x535b69){if(_0x535b69){return _0x535b69[_0xd7cc('0x1e')](_0xc97aef[_0xd7cc('0x17')][_0xd7cc('0x1f')],_[_0xd7cc('0x20')](_0xc97aef[_0xd7cc('0x17')],[_0xd7cc('0x1f'),'id'])||{});}})[_0xd7cc('0x21')](function(_0x50983d){logger[_0xd7cc('0xc')](_0xd7cc('0x22'),_0xc97aef);logger[_0xd7cc('0x23')](_0xd7cc('0x22'),_0xc97aef,JSON['stringify'](_0x50983d));_0x4b05b4(_0x50983d);})[_0xd7cc('0x14')](function(_0x286902){logger[_0xd7cc('0x10')](_0xd7cc('0x22'),_0x286902[_0xd7cc('0x12')],_0xc97aef);_0x36d9cf(_this[_0xd7cc('0x10')](0x1f4,_0x286902[_0xd7cc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 0c8a7fc..7ef4ea1 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 _0xd0a8=['./whatsappInteraction.events','save','remove','emit','register','whatsappInteraction:'];(function(_0x42e4fc,_0x271255){var _0x2c66db=function(_0x4a617f){while(--_0x4a617f){_0x42e4fc['push'](_0x42e4fc['shift']());}};_0x2c66db(++_0x271255);}(_0xd0a8,0x1f2));var _0x8d0a=function(_0x19df85,_0x367db3){_0x19df85=_0x19df85-0x0;var _0x312e3e=_0xd0a8[_0x19df85];return _0x312e3e;};'use strict';var WhatsappInteractionEvents=require(_0x8d0a('0x0'));var events=[_0x8d0a('0x1'),_0x8d0a('0x2'),'update'];function createListener(_0xeb752,_0x40dc15){return function(_0x20fe80){_0x40dc15[_0x8d0a('0x3')](_0xeb752,_0x20fe80);};}function removeListener(_0x543268,_0x4a6f60){return function(){WhatsappInteractionEvents['removeListener'](_0x543268,_0x4a6f60);};}exports[_0x8d0a('0x4')]=function(_0x31f315){for(var _0x37c833=0x0,_0x426080=events['length'];_0x37c833<_0x426080;_0x37c833++){var _0x53bc14=events[_0x37c833];var _0x4b4a0e=createListener(_0x8d0a('0x5')+_0x53bc14,_0x31f315);WhatsappInteractionEvents['on'](_0x53bc14,_0x4b4a0e);}}; \ No newline at end of file +var _0xd0ec=['update','emit','removeListener','register','whatsappInteraction:','./whatsappInteraction.events','save','remove'];(function(_0x3de1f5,_0x9d37e4){var _0x5586e3=function(_0x231aac){while(--_0x231aac){_0x3de1f5['push'](_0x3de1f5['shift']());}};_0x5586e3(++_0x9d37e4);}(_0xd0ec,0xd5));var _0xcd0e=function(_0x3b6847,_0x37cb36){_0x3b6847=_0x3b6847-0x0;var _0x5bdaeb=_0xd0ec[_0x3b6847];return _0x5bdaeb;};'use strict';var WhatsappInteractionEvents=require(_0xcd0e('0x0'));var events=[_0xcd0e('0x1'),_0xcd0e('0x2'),_0xcd0e('0x3')];function createListener(_0x19f1f6,_0x443ad1){return function(_0x1e0774){_0x443ad1[_0xcd0e('0x4')](_0x19f1f6,_0x1e0774);};}function removeListener(_0x21587c,_0x39be65){return function(){WhatsappInteractionEvents[_0xcd0e('0x5')](_0x21587c,_0x39be65);};}exports[_0xcd0e('0x6')]=function(_0x572330){for(var _0x3b7bfe=0x0,_0x3321b3=events['length'];_0x3b7bfe<_0x3321b3;_0x3b7bfe++){var _0x16acc2=events[_0x3b7bfe];var _0x44ad57=createListener(_0xcd0e('0x7')+_0x16acc2,_0x572330);WhatsappInteractionEvents['on'](_0x16acc2,_0x44ad57);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 750a3a0..a069e1e 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 _0x447e=['get','isAuthenticated','index','/describe','describe','show','post','whatsapp','whatsappmessage:create','put','/:id','update','accept','reject','delete','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller'];(function(_0x4f9af0,_0x33af2f){var _0x325868=function(_0x5b81af){while(--_0x5b81af){_0x4f9af0['push'](_0x4f9af0['shift']());}};_0x325868(++_0x33af2f);}(_0x447e,0x118));var _0xe447=function(_0x180d3b,_0x1a4c39){_0x180d3b=_0x180d3b-0x0;var _0x8f7b41=_0x447e[_0x180d3b];return _0x8f7b41;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe447('0x0'));var timeout=require('connect-timeout');var express=require(_0xe447('0x1'));var router=express[_0xe447('0x2')]();var auth=require(_0xe447('0x3'));var interaction=require(_0xe447('0x4'));var config=require('../../config/environment');var controller=require(_0xe447('0x5'));router[_0xe447('0x6')]('/',auth[_0xe447('0x7')](),controller[_0xe447('0x8')]);router[_0xe447('0x6')](_0xe447('0x9'),auth[_0xe447('0x7')](),controller[_0xe447('0xa')]);router[_0xe447('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xe447('0xb')]);router[_0xe447('0xc')]('/',auth[_0xe447('0x7')](),interaction['tracked'](_0xe447('0xd'),_0xe447('0xe')),controller['create']);router[_0xe447('0xc')]('/:id/status',controller['status']);router[_0xe447('0xf')](_0xe447('0x10'),auth['isAuthenticated'](),controller[_0xe447('0x11')]);router[_0xe447('0xf')]('/:id/accept',auth[_0xe447('0x7')](),controller[_0xe447('0x12')]);router[_0xe447('0xf')]('/:id/reject',auth[_0xe447('0x7')](),controller[_0xe447('0x13')]);router[_0xe447('0x14')](_0xe447('0x10'),auth[_0xe447('0x7')](),controller['destroy']);module[_0xe447('0x15')]=router; \ No newline at end of file +var _0xfd6f=['./whatsappMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','whatsapp','whatsappmessage:create','create','post','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x1876b2,_0x5d0225){var _0x9fb1e0=function(_0x29b099){while(--_0x29b099){_0x1876b2['push'](_0x1876b2['shift']());}};_0x9fb1e0(++_0x5d0225);}(_0xfd6f,0xb7));var _0xffd6=function(_0x8dd8ed,_0x16a2ec){_0x8dd8ed=_0x8dd8ed-0x0;var _0x5acf65=_0xfd6f[_0x8dd8ed];return _0x5acf65;};'use strict';var multer=require(_0xffd6('0x0'));var util=require(_0xffd6('0x1'));var path=require(_0xffd6('0x2'));var timeout=require(_0xffd6('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xffd6('0x4'));var interaction=require(_0xffd6('0x5'));var config=require('../../config/environment');var controller=require(_0xffd6('0x6'));router['get']('/',auth[_0xffd6('0x7')](),controller[_0xffd6('0x8')]);router[_0xffd6('0x9')](_0xffd6('0xa'),auth[_0xffd6('0x7')](),controller[_0xffd6('0xb')]);router[_0xffd6('0x9')](_0xffd6('0xc'),auth[_0xffd6('0x7')](),controller['show']);router['post']('/',auth[_0xffd6('0x7')](),interaction['tracked'](_0xffd6('0xd'),_0xffd6('0xe')),controller[_0xffd6('0xf')]);router[_0xffd6('0x10')](_0xffd6('0x11'),controller[_0xffd6('0x12')]);router[_0xffd6('0x13')](_0xffd6('0xc'),auth[_0xffd6('0x7')](),controller[_0xffd6('0x14')]);router[_0xffd6('0x13')](_0xffd6('0x15'),auth[_0xffd6('0x7')](),controller[_0xffd6('0x16')]);router['put'](_0xffd6('0x17'),auth[_0xffd6('0x7')](),controller[_0xffd6('0x18')]);router[_0xffd6('0x19')](_0xffd6('0xc'),auth[_0xffd6('0x7')](),controller[_0xffd6('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 9e2c419..4526bf6 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 _0xd68a=['sequelize','exports','TEXT','medium','out','STRING'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xd68a,0xc6));var _0xad68=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xd68a[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require(_0xad68('0x0'));module[_0xad68('0x1')]={'body':{'type':Sequelize[_0xad68('0x2')](_0xad68('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xad68('0x4')),'defaultValue':_0xad68('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xad68('0x5')](0xbe)},'phone':{'type':Sequelize[_0xad68('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0b15=['TEXT','medium','ENUM','out','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x3815c2,_0x1f54e3){var _0x271f88=function(_0x53963c){while(--_0x53963c){_0x3815c2['push'](_0x3815c2['shift']());}};_0x271f88(++_0x1f54e3);}(_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')]={'body':{'type':Sequelize[_0x50b1('0x2')](_0x50b1('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x50b1('0x4')]('in',_0x50b1('0x5')),'defaultValue':_0x50b1('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x50b1('0x6')](0xbe)},'phone':{'type':Sequelize[_0x50b1('0x6')]},'readAt':{'type':Sequelize[_0x50b1('0x7')]},'secret':{'type':Sequelize[_0x50b1('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 0598d07..aa653e6 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 _0xd8ae=['catch','sendStatus','status','count','offset','limit','set','apply','reject','save','update','end','stack','name','send','index','WhatsappMessage','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','findAll','rows','show','params','length','includeAll','include','create','body','destroy','find','describe','accept','whatsapp','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','WhatsappInteractionId','isNil','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','EventManager','acceptmessage','whatsapp-interactions','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','event','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','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','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x559511,_0x14dd0a){var _0x11c8e7=function(_0x51d988){while(--_0x51d988){_0x559511['push'](_0x559511['shift']());}};_0x11c8e7(++_0x14dd0a);}(_0xd8ae,0x1d4));var _0xed8a=function(_0x3a4c74,_0xe84d0a){_0x3a4c74=_0x3a4c74-0x0;var _0x38316b=_0xd8ae[_0x3a4c74];return _0x38316b;};'use strict';var pdf=require(_0xed8a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xed8a('0x1'));var jsonpatch=require(_0xed8a('0x2'));var rp=require(_0xed8a('0x3'));var moment=require(_0xed8a('0x4'));var BPromise=require(_0xed8a('0x5'));var Mustache=require('mustache');var util=require(_0xed8a('0x6'));var path=require('path');var sox=require(_0xed8a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xed8a('0x8'));var crypto=require('crypto');var jsforce=require(_0xed8a('0x9'));var deskjs=require(_0xed8a('0xa'));var toCsv=require(_0xed8a('0xb'));var querystring=require('querystring');var Papa=require(_0xed8a('0xc'));var Redis=require('ioredis');var authService=require(_0xed8a('0xd'));var qs=require(_0xed8a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xed8a('0xf'));var logger=require(_0xed8a('0x10'))(_0xed8a('0x11'));var utils=require(_0xed8a('0x12'));var config=require(_0xed8a('0x13'));var db=require(_0xed8a('0x14'))['db'];config[_0xed8a('0x15')]=_[_0xed8a('0x16')](config['redis'],{'host':_0xed8a('0x17'),'port':0x18eb});var socket=require(_0xed8a('0x18'))(new Redis(config[_0xed8a('0x15')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xed8a('0x19')]['http']({'port':0x232c});var client9002=jayson[_0xed8a('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x3686a6,_0x520009,_0x2fe74e){if(_0x2fe74e){var _0x514eb6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x514eb6[_0xed8a('0x1a')](_0x520009)){return _0x3686a6;}else{throw new db['Sequelize'][(_0xed8a('0x1b'))](_0xed8a('0x1c'));}}else{return _0x3686a6;}}function respondWithRpcPromise(_0x152e9f,_0xcd0cb8,_0x365133,_0x64bac0){return new BPromise(function(_0x3c2d71,_0x88c24e){var _0x41ce99=_0x64bac0||client;return _0x41ce99[_0xed8a('0x1d')](_0x152e9f,_0x365133)[_0xed8a('0x1e')](function(_0x10dded){logger[_0xed8a('0x1f')](_0xed8a('0x20'),_0xcd0cb8,_0xed8a('0x21'));logger[_0xed8a('0x22')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xcd0cb8,_0xed8a('0x21'),JSON[_0xed8a('0x23')](_0x10dded));if(_0x10dded[_0xed8a('0x24')]){if(_0x10dded[_0xed8a('0x24')][_0xed8a('0x25')]===0x1f4){logger['error'](_0xed8a('0x20'),_0xcd0cb8,_0x10dded['error'][_0xed8a('0x26')]);return _0x88c24e(_0x10dded[_0xed8a('0x24')][_0xed8a('0x26')]);}logger[_0xed8a('0x24')](_0xed8a('0x20'),_0xcd0cb8,_0x10dded[_0xed8a('0x24')][_0xed8a('0x26')]);return _0x3c2d71(_0x10dded[_0xed8a('0x24')][_0xed8a('0x26')]);}else{logger['info'](_0xed8a('0x20'),_0xcd0cb8,_0xed8a('0x21'));_0x3c2d71(_0x10dded[_0xed8a('0x27')][_0xed8a('0x26')]);}})[_0xed8a('0x28')](function(_0x3e7152){logger[_0xed8a('0x24')](_0xed8a('0x20'),_0xcd0cb8,_0x3e7152);_0x88c24e(_0x3e7152);});});}function respondWithStatusCode(_0x1da42c,_0x2a699a){_0x2a699a=_0x2a699a||0xcc;return function(_0x3ab1b5){if(_0x3ab1b5){return _0x1da42c[_0xed8a('0x29')](_0x2a699a);}return _0x1da42c[_0xed8a('0x2a')](_0x2a699a)['end']();};}function respondWithResult(_0x359b87,_0x1326eb){_0x1326eb=_0x1326eb||0xc8;return function(_0x19f06f){if(_0x19f06f){return _0x359b87[_0xed8a('0x2a')](_0x1326eb)['json'](_0x19f06f);}};}function respondWithFilteredResult(_0x525760,_0x40b60b){return function(_0x1423d9){if(_0x1423d9){var _0x552f2e=_0x1423d9[_0xed8a('0x2b')],_0x5e33a2=_0x40b60b[_0xed8a('0x2c')],_0x9666ec=_0x40b60b['offset']+_0x40b60b[_0xed8a('0x2d')],_0x446263;if(_0x9666ec>=_0x552f2e){_0x9666ec=_0x552f2e;_0x446263=0xc8;}else{_0x446263=0xce;}_0x525760[_0xed8a('0x2a')](_0x446263);return _0x525760[_0xed8a('0x2e')]('Content-Range',_0x5e33a2+'-'+_0x9666ec+'/'+_0x552f2e)['json'](_0x1423d9);}return null;};}function patchUpdates(_0xc43625){return function(_0xe44e89){try{jsonpatch[_0xed8a('0x2f')](_0xe44e89,_0xc43625,!![]);}catch(_0x4160bf){return BPromise[_0xed8a('0x30')](_0x4160bf);}return _0xe44e89[_0xed8a('0x31')]();};}function saveUpdates(_0x3e0ff,_0x45d91d){return function(_0x80d085){if(_0x80d085){return _0x80d085[_0xed8a('0x32')](_0x3e0ff)[_0xed8a('0x1e')](function(_0x463a80){return _0x463a80;});}return null;};}function removeEntity(_0x2b3305,_0x17e538){return function(_0x4e171f){if(_0x4e171f){return _0x4e171f['destroy']()[_0xed8a('0x1e')](function(){_0x2b3305[_0xed8a('0x2a')](0xcc)[_0xed8a('0x33')]();});}};}function handleEntityNotFound(_0x404a98,_0x100971){return function(_0x203b8f){if(!_0x203b8f){_0x404a98[_0xed8a('0x29')](0x194);}return _0x203b8f;};}function handleError(_0x2fd498,_0x1ef276){_0x1ef276=_0x1ef276||0x1f4;return function(_0x595734){logger[_0xed8a('0x24')](_0x595734[_0xed8a('0x34')]);if(_0x595734[_0xed8a('0x35')]){delete _0x595734['name'];}_0x2fd498['status'](_0x1ef276)[_0xed8a('0x36')](_0x595734);};}exports[_0xed8a('0x37')]=function(_0x2f5909,_0x2e014c){var _0x5614e1={},_0xc15d8e={},_0x530c0e={'count':0x0,'rows':[]};var _0x34ba04=_['map'](db[_0xed8a('0x38')][_0xed8a('0x39')],function(_0x3dacee){return{'name':_0x3dacee['fieldName'],'type':_0x3dacee[_0xed8a('0x3a')][_0xed8a('0x3b')]};});_0xc15d8e[_0xed8a('0x3c')]=_['map'](_0x34ba04,_0xed8a('0x35'));_0xc15d8e['query']=_[_0xed8a('0x3d')](_0x2f5909[_0xed8a('0x3e')]);_0xc15d8e[_0xed8a('0x3f')]=_[_0xed8a('0x40')](_0xc15d8e[_0xed8a('0x3c')],_0xc15d8e[_0xed8a('0x3e')]);_0x5614e1['attributes']=_[_0xed8a('0x40')](_0xc15d8e['model'],qs[_0xed8a('0x41')](_0x2f5909[_0xed8a('0x3e')][_0xed8a('0x41')]));_0x5614e1['attributes']=_0x5614e1['attributes']['length']?_0x5614e1[_0xed8a('0x42')]:_0xc15d8e['model'];if(!_0x2f5909[_0xed8a('0x3e')][_0xed8a('0x43')](_0xed8a('0x44'))){_0x5614e1[_0xed8a('0x2d')]=qs['limit'](_0x2f5909[_0xed8a('0x3e')]['limit']);_0x5614e1['offset']=qs[_0xed8a('0x2c')](_0x2f5909[_0xed8a('0x3e')][_0xed8a('0x2c')]);}_0x5614e1[_0xed8a('0x45')]=qs[_0xed8a('0x46')](_0x2f5909[_0xed8a('0x3e')][_0xed8a('0x46')]);_0x5614e1[_0xed8a('0x47')]=qs['filters'](_[_0xed8a('0x48')](_0x2f5909[_0xed8a('0x3e')],_0xc15d8e['filters']),_0x34ba04);if(_0x2f5909[_0xed8a('0x3e')]['filter']){_0x5614e1[_0xed8a('0x47')]=_[_0xed8a('0x49')](_0x5614e1[_0xed8a('0x47')],{'$or':_[_0xed8a('0x4a')](_0x34ba04,function(_0x336ac7){if(_0x336ac7[_0xed8a('0x3a')]!=='VIRTUAL'){var _0x453583={};_0x453583[_0x336ac7[_0xed8a('0x35')]]={'$like':'%'+_0x2f5909[_0xed8a('0x3e')][_0xed8a('0x4b')]+'%'};return _0x453583;}})});}_0x5614e1=_[_0xed8a('0x49')]({},_0x5614e1,_0x2f5909[_0xed8a('0x4c')]);var _0x348184={'where':_0x5614e1['where']};return db['WhatsappMessage'][_0xed8a('0x2b')](_0x348184)[_0xed8a('0x1e')](function(_0x2965e1){_0x530c0e[_0xed8a('0x2b')]=_0x2965e1;if(_0x2f5909[_0xed8a('0x3e')]['includeAll']){_0x5614e1['include']=[{'all':!![]}];}return db[_0xed8a('0x38')][_0xed8a('0x4d')](_0x5614e1);})['then'](function(_0x504498){_0x530c0e[_0xed8a('0x4e')]=_0x504498;return _0x530c0e;})[_0xed8a('0x1e')](respondWithFilteredResult(_0x2e014c,_0x5614e1))[_0xed8a('0x28')](handleError(_0x2e014c,null));};exports[_0xed8a('0x4f')]=function(_0x5b0fea,_0x482444){var _0xfef823={'raw':!![],'where':{'id':_0x5b0fea[_0xed8a('0x50')]['id']}},_0x3b436e={};_0x3b436e[_0xed8a('0x3c')]=_[_0xed8a('0x3d')](db[_0xed8a('0x38')][_0xed8a('0x39')]);_0x3b436e[_0xed8a('0x3e')]=_['keys'](_0x5b0fea['query']);_0x3b436e[_0xed8a('0x3f')]=_[_0xed8a('0x40')](_0x3b436e['model'],_0x3b436e[_0xed8a('0x3e')]);_0xfef823[_0xed8a('0x42')]=_['intersection'](_0x3b436e[_0xed8a('0x3c')],qs['fields'](_0x5b0fea[_0xed8a('0x3e')][_0xed8a('0x41')]));_0xfef823['attributes']=_0xfef823[_0xed8a('0x42')][_0xed8a('0x51')]?_0xfef823[_0xed8a('0x42')]:_0x3b436e[_0xed8a('0x3c')];if(_0x5b0fea[_0xed8a('0x3e')][_0xed8a('0x52')]){_0xfef823[_0xed8a('0x53')]=[{'all':!![]}];}_0xfef823=_[_0xed8a('0x49')]({},_0xfef823,_0x5b0fea['options']);return db['WhatsappMessage']['find'](_0xfef823)['then'](handleEntityNotFound(_0x482444,null))[_0xed8a('0x1e')](respondWithResult(_0x482444,null))[_0xed8a('0x28')](handleError(_0x482444,null));};exports[_0xed8a('0x54')]=function(_0x4a96e6,_0x4f9013){return db[_0xed8a('0x38')][_0xed8a('0x54')](_0x4a96e6['body'],{})['then'](respondWithResult(_0x4f9013,0xc9))[_0xed8a('0x28')](handleError(_0x4f9013,null));};exports[_0xed8a('0x32')]=function(_0x3a5aaa,_0x2556b3){if(_0x3a5aaa[_0xed8a('0x55')]['id']){delete _0x3a5aaa[_0xed8a('0x55')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x3a5aaa[_0xed8a('0x50')]['id']}})[_0xed8a('0x1e')](handleEntityNotFound(_0x2556b3,null))[_0xed8a('0x1e')](saveUpdates(_0x3a5aaa[_0xed8a('0x55')],null))[_0xed8a('0x1e')](respondWithResult(_0x2556b3,null))['catch'](handleError(_0x2556b3,null));};exports[_0xed8a('0x56')]=function(_0x456cea,_0x107d6d){return db[_0xed8a('0x38')][_0xed8a('0x57')]({'where':{'id':_0x456cea[_0xed8a('0x50')]['id']}})['then'](handleEntityNotFound(_0x107d6d,null))['then'](removeEntity(_0x107d6d,null))['catch'](handleError(_0x107d6d,null));};exports['describe']=function(_0x6a1550,_0xc9c199){return db['WhatsappMessage'][_0xed8a('0x58')]()[_0xed8a('0x1e')](respondWithResult(_0xc9c199,null))[_0xed8a('0x28')](handleError(_0xc9c199,null));};var interaction_log=require(_0xed8a('0x10'))('whatsapp-interactions');exports[_0xed8a('0x59')]=function(_0x1b4875,_0x183cf9,_0x5ea74a){var _0x157e10={'channel':_0xed8a('0x5a')};if(_0x1b4875[_0xed8a('0x55')]['id']){delete _0x1b4875[_0xed8a('0x55')]['id'];}_0x1b4875[_0xed8a('0x55')][_0xed8a('0x5b')]=!![];_0x1b4875[_0xed8a('0x55')]['readAt']=moment()['format'](_0xed8a('0x5c'));_0x1b4875[_0xed8a('0x55')][_0xed8a('0x5d')]=_0x1b4875[_0xed8a('0x55')]['UserId']||_0x1b4875[_0xed8a('0x5e')]['id'];return db[_0xed8a('0x38')][_0xed8a('0x57')]({'where':{'id':_0x1b4875['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xed8a('0x5f')}]})[_0xed8a('0x1e')](handleEntityNotFound(_0x183cf9,null))[_0xed8a('0x1e')](saveUpdates(_0x1b4875[_0xed8a('0x55')],null))['then'](function(_0x46c254){if(_0x46c254){_0x157e10[_0xed8a('0x26')]=_0x46c254[_0xed8a('0x60')]({'plain':!![]});return db['WhatsappInteraction'][_0xed8a('0x57')]({'where':{'id':_0x46c254[_0xed8a('0x61')]}});}return null;})[_0xed8a('0x1e')](handleEntityNotFound(_0x183cf9,null))[_0xed8a('0x1e')](function(_0x5c7fff){if(_0x5c7fff){return _0x5c7fff[_0xed8a('0x32')]({'UserId':_0x1b4875[_0xed8a('0x55')][_0xed8a('0x5d')],'read1stAt':_[_0xed8a('0x62')](_0x5c7fff['read1stAt'])?moment()[_0xed8a('0x63')](_0xed8a('0x5c')):undefined});}return null;})[_0xed8a('0x1e')](function(_0x1b7d05){if(_0x1b7d05){_0x157e10[_0xed8a('0x64')]=_0x1b7d05[_0xed8a('0x60')]({'plain':!![]});interaction_log[_0xed8a('0x1f')](_0xed8a('0x65'),_0x1b4875[_0xed8a('0x5e')]['id'],_0x1b4875['user'][_0xed8a('0x35')],_0x1b4875[_0xed8a('0x5e')][_0xed8a('0x66')],_0x157e10['interaction']['id'],_0x1b4875[_0xed8a('0x55')]?JSON[_0xed8a('0x23')](_0x1b4875[_0xed8a('0x55')]):_0xed8a('0x67'));return respondWithRpcPromise(_0xed8a('0x68'),_0xed8a('0x69'),_0x157e10);}return null;})[_0xed8a('0x1e')](function(_0x1f1795){if(_0x1f1795){if(_0x1b4875['body'][_0xed8a('0x6a')]){_0x157e10[_0xed8a('0x26')]['interface']=util[_0xed8a('0x63')](_0xed8a('0x6b'),_0x1b4875['user'][_0xed8a('0x35')]);_0x157e10['message'][_0xed8a('0x6c')]=_0x157e10[_0xed8a('0x6c')];_0x157e10[_0xed8a('0x26')]['event']=_0xed8a('0x59');return respondWithRpcPromise('EventManager',_0xed8a('0x6d'),{'event':_0xed8a('0x6e'),'message':_0x157e10[_0xed8a('0x26')]},client9002)[_0xed8a('0x1e')](function(){return _0x157e10;});}return _0x157e10;}return null;})[_0xed8a('0x1e')](respondWithResult(_0x183cf9,null))['catch'](handleError(_0x183cf9,null));};var interaction_log=require(_0xed8a('0x10'))(_0xed8a('0x6f'));exports[_0xed8a('0x30')]=function(_0x121489,_0x41ffb5,_0x3d8f9a){var _0x313fdc={'agent':{},'channel':'whatsapp'};if(_0x121489[_0xed8a('0x55')]['id']){delete _0x121489[_0xed8a('0x55')]['id'];}_0x121489['body'][_0xed8a('0x5d')]=_0x121489[_0xed8a('0x55')]['UserId']||_0x121489[_0xed8a('0x5e')]['id'];_0x313fdc[_0xed8a('0x70')]['id']=_0x121489['body'][_0xed8a('0x5d')];return db[_0xed8a('0x38')][_0xed8a('0x57')]({'where':{'id':_0x121489[_0xed8a('0x50')]['id'],'UserId':null}})[_0xed8a('0x1e')](handleEntityNotFound(_0x41ffb5,null))[_0xed8a('0x1e')](function(_0x34e75f){if(_0x34e75f){_0x313fdc[_0xed8a('0x26')]=_0x34e75f['get']({'plain':!![]});return db['WhatsappInteraction'][_0xed8a('0x57')]({'where':{'id':_0x34e75f[_0xed8a('0x61')]}});}return null;})[_0xed8a('0x1e')](handleEntityNotFound(_0x41ffb5,null))[_0xed8a('0x1e')](function(_0x5605a3){if(_0x5605a3){_0x313fdc[_0xed8a('0x64')]=_0x5605a3[_0xed8a('0x60')]({'plain':!![]});interaction_log[_0xed8a('0x1f')](_0xed8a('0x71'),_0x121489[_0xed8a('0x5e')]['id'],_0x121489[_0xed8a('0x5e')][_0xed8a('0x35')],_0x121489[_0xed8a('0x5e')][_0xed8a('0x66')],_0x313fdc[_0xed8a('0x64')]['id'],_0x121489['body']?JSON[_0xed8a('0x23')](_0x121489['body']):_0xed8a('0x67'));return respondWithRpcPromise(_0xed8a('0x72'),_0xed8a('0x73'),_0x313fdc);}return null;})[_0xed8a('0x1e')](function(_0x4cba8b){if(_0x4cba8b){_0x4cba8b[_0xed8a('0x26')][_0xed8a('0x74')]=util[_0xed8a('0x63')](_0xed8a('0x6b'),_0x121489[_0xed8a('0x5e')]['name']);_0x4cba8b[_0xed8a('0x26')][_0xed8a('0x6c')]=_0x313fdc[_0xed8a('0x6c')];_0x4cba8b[_0xed8a('0x26')][_0xed8a('0x75')]=_0xed8a('0x30');respondWithRpcPromise(_0xed8a('0x6d'),_0xed8a('0x6d'),{'event':_0xed8a('0x76'),'message':_0x4cba8b[_0xed8a('0x26')]},client9002);return _0x313fdc;}return null;})[_0xed8a('0x1e')](respondWithResult(_0x41ffb5,null))['catch'](handleError(_0x41ffb5,null));};exports['status']=function(_0x3d9f18,_0x27b940,_0x553283){if(_0x3d9f18['body']['id']){delete _0x3d9f18[_0xed8a('0x55')]['id'];}var _0xdf7dff;return db[_0xed8a('0x38')][_0xed8a('0x57')]({'where':{'id':_0x3d9f18['params']['id']}})[_0xed8a('0x1e')](handleEntityNotFound(_0x27b940,null))[_0xed8a('0x1e')](function(_0x14dd3d){if(_0x14dd3d){_0xdf7dff=_0x14dd3d;return db['WhatsappAccount'][_0xed8a('0x57')]({'where':{'id':_0x14dd3d[_0xed8a('0x77')]}});}})[_0xed8a('0x1e')](handleEntityNotFound(_0x27b940,null))[_0xed8a('0x1e')](function(_0x3dbce7){if(_0x3dbce7){logger[_0xed8a('0x22')](_0xed8a('0x78'),_0xed8a('0x2a'),_0xed8a('0x79'),_0x3dbce7[_0xed8a('0x3a')],util[_0xed8a('0x7a')](_0x3d9f18[_0xed8a('0x55')],{'showHidden':![],'depth':null}));switch(_0x3dbce7[_0xed8a('0x3a')]){case _0xed8a('0x7b'):if(_0x3d9f18[_0xed8a('0x55')][_0xed8a('0x7c')]&&_0x3d9f18[_0xed8a('0x55')][_0xed8a('0x7c')]===_0xdf7dff[_0xed8a('0x7d')]&&_0x3d9f18[_0xed8a('0x55')][_0xed8a('0x7e')]&&_0x3d9f18[_0xed8a('0x55')][_0xed8a('0x7e')]==='read'){return _0xdf7dff[_0xed8a('0x32')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xed8a('0x2a'),'twilio',util[_0xed8a('0x7a')](_0x3d9f18[_0xed8a('0x55')],{'showHidden':![],'depth':null}));}break;}return _0xdf7dff;}})[_0xed8a('0x1e')](respondWithResult(_0x27b940,null))[_0xed8a('0x28')](handleError(_0x27b940,null));}; \ No newline at end of file +var _0x5de2=['null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','reject','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','interface','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','request-promise','moment','bluebird','mustache','path','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.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~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','Content-Range','apply','save','update','destroy','end','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','params','filters','include','find','create','body','describe','whatsapp-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role'];(function(_0x70ad1b,_0x1ed183){var _0x19bc54=function(_0x4a118c){while(--_0x4a118c){_0x70ad1b['push'](_0x70ad1b['shift']());}};_0x19bc54(++_0x1ed183);}(_0x5de2,0x19b));var _0x25de=function(_0x50bdb3,_0x287434){_0x50bdb3=_0x50bdb3-0x0;var _0x21f904=_0x5de2[_0x50bdb3];return _0x21f904;};'use strict';var pdf=require(_0x25de('0x0'));var emlformat=require(_0x25de('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x25de('0x2'));var moment=require(_0x25de('0x3'));var BPromise=require(_0x25de('0x4'));var Mustache=require(_0x25de('0x5'));var util=require('util');var path=require(_0x25de('0x6'));var sox=require('sox');var csv=require(_0x25de('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x25de('0x8'));var squel=require('squel');var crypto=require(_0x25de('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x25de('0xa'));var toCsv=require(_0x25de('0x7'));var querystring=require('querystring');var Papa=require(_0x25de('0xb'));var Redis=require(_0x25de('0xc'));var authService=require(_0x25de('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x25de('0xe'))(_0x25de('0xf'));var utils=require(_0x25de('0x10'));var config=require(_0x25de('0x11'));var db=require('../../mysqldb')['db'];config[_0x25de('0x12')]=_[_0x25de('0x13')](config[_0x25de('0x12')],{'host':_0x25de('0x14'),'port':0x18eb});var socket=require(_0x25de('0x15'))(new Redis(config[_0x25de('0x12')]));require(_0x25de('0x16'))['register'](socket);var jayson=require(_0x25de('0x17'));var client=jayson[_0x25de('0x18')]['http']({'port':0x232c});var client9002=jayson['client'][_0x25de('0x19')]({'port':0x232a});function checkPasswordPattern(_0x585de8,_0x3ef4ba,_0x2dd2da){if(_0x2dd2da){var _0x477c62=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x477c62[_0x25de('0x1a')](_0x3ef4ba)){return _0x585de8;}else{throw new db[(_0x25de('0x1b'))][(_0x25de('0x1c'))](_0x25de('0x1d'));}}else{return _0x585de8;}}function respondWithRpcPromise(_0x22fcd4,_0x58b7bb,_0x54711e,_0x3ee7ca){return new BPromise(function(_0xd1710d,_0x4221aa){var _0x563ce2=_0x3ee7ca||client;return _0x563ce2[_0x25de('0x1e')](_0x22fcd4,_0x54711e)[_0x25de('0x1f')](function(_0xef8a1e){logger[_0x25de('0x20')]('WhatsappMessage,\x20%s,\x20%s',_0x58b7bb,_0x25de('0x21'));logger[_0x25de('0x22')](_0x25de('0x23'),_0x58b7bb,'request\x20sent',JSON[_0x25de('0x24')](_0xef8a1e));if(_0xef8a1e[_0x25de('0x25')]){if(_0xef8a1e[_0x25de('0x25')][_0x25de('0x26')]===0x1f4){logger['error'](_0x25de('0x27'),_0x58b7bb,_0xef8a1e[_0x25de('0x25')][_0x25de('0x28')]);return _0x4221aa(_0xef8a1e[_0x25de('0x25')][_0x25de('0x28')]);}logger['error'](_0x25de('0x27'),_0x58b7bb,_0xef8a1e['error'][_0x25de('0x28')]);return _0xd1710d(_0xef8a1e[_0x25de('0x25')]['message']);}else{logger[_0x25de('0x20')](_0x25de('0x27'),_0x58b7bb,_0x25de('0x21'));_0xd1710d(_0xef8a1e['result'][_0x25de('0x28')]);}})[_0x25de('0x29')](function(_0x5586ae){logger['error'](_0x25de('0x27'),_0x58b7bb,_0x5586ae);_0x4221aa(_0x5586ae);});});}function respondWithStatusCode(_0x4a1a88,_0x286db3){_0x286db3=_0x286db3||0xcc;return function(_0x2f4f3c){if(_0x2f4f3c){return _0x4a1a88[_0x25de('0x2a')](_0x286db3);}return _0x4a1a88['status'](_0x286db3)['end']();};}function respondWithResult(_0x1e135e,_0x3e5d80){_0x3e5d80=_0x3e5d80||0xc8;return function(_0x499711){if(_0x499711){return _0x1e135e[_0x25de('0x2b')](_0x3e5d80)[_0x25de('0x2c')](_0x499711);}};}function respondWithFilteredResult(_0x3624bd,_0x292863){return function(_0x3ff843){if(_0x3ff843){var _0x339111=_0x3ff843['count'],_0xde1aee=_0x292863['offset'],_0x27f43e=_0x292863[_0x25de('0x2d')]+_0x292863['limit'],_0x840b7;if(_0x27f43e>=_0x339111){_0x27f43e=_0x339111;_0x840b7=0xc8;}else{_0x840b7=0xce;}_0x3624bd['status'](_0x840b7);return _0x3624bd['set'](_0x25de('0x2e'),_0xde1aee+'-'+_0x27f43e+'/'+_0x339111)[_0x25de('0x2c')](_0x3ff843);}return null;};}function patchUpdates(_0x1e1f9e){return function(_0x36a63b){try{jsonpatch[_0x25de('0x2f')](_0x36a63b,_0x1e1f9e,!![]);}catch(_0x435a70){return BPromise['reject'](_0x435a70);}return _0x36a63b[_0x25de('0x30')]();};}function saveUpdates(_0x40ae92,_0x4d3349){return function(_0x460a22){if(_0x460a22){return _0x460a22[_0x25de('0x31')](_0x40ae92)['then'](function(_0x4474b3){return _0x4474b3;});}return null;};}function removeEntity(_0x48a681,_0x3dc140){return function(_0x585559){if(_0x585559){return _0x585559[_0x25de('0x32')]()['then'](function(){_0x48a681[_0x25de('0x2b')](0xcc)[_0x25de('0x33')]();});}};}function handleEntityNotFound(_0x52526c,_0x418773){return function(_0x3a2cbe){if(!_0x3a2cbe){_0x52526c[_0x25de('0x2a')](0x194);}return _0x3a2cbe;};}function handleError(_0x3a14d3,_0x343f95){_0x343f95=_0x343f95||0x1f4;return function(_0x42a59d){logger[_0x25de('0x25')](_0x42a59d[_0x25de('0x34')]);if(_0x42a59d[_0x25de('0x35')]){delete _0x42a59d['name'];}_0x3a14d3[_0x25de('0x2b')](_0x343f95)[_0x25de('0x36')](_0x42a59d);};}exports[_0x25de('0x37')]=function(_0x18fbcb,_0x1e57a1){var _0x1f3b0a={},_0x5a4215={},_0xa30936={'count':0x0,'rows':[]};var _0x5226be=_[_0x25de('0x38')](db[_0x25de('0x39')][_0x25de('0x3a')],function(_0x1f094c){return{'name':_0x1f094c[_0x25de('0x3b')],'type':_0x1f094c[_0x25de('0x3c')][_0x25de('0x3d')]};});_0x5a4215[_0x25de('0x3e')]=_[_0x25de('0x38')](_0x5226be,_0x25de('0x35'));_0x5a4215['query']=_[_0x25de('0x3f')](_0x18fbcb['query']);_0x5a4215['filters']=_[_0x25de('0x40')](_0x5a4215['model'],_0x5a4215[_0x25de('0x41')]);_0x1f3b0a[_0x25de('0x42')]=_[_0x25de('0x40')](_0x5a4215['model'],qs['fields'](_0x18fbcb[_0x25de('0x41')][_0x25de('0x43')]));_0x1f3b0a['attributes']=_0x1f3b0a[_0x25de('0x42')][_0x25de('0x44')]?_0x1f3b0a[_0x25de('0x42')]:_0x5a4215['model'];if(!_0x18fbcb[_0x25de('0x41')][_0x25de('0x45')](_0x25de('0x46'))){_0x1f3b0a[_0x25de('0x47')]=qs[_0x25de('0x47')](_0x18fbcb[_0x25de('0x41')][_0x25de('0x47')]);_0x1f3b0a['offset']=qs[_0x25de('0x2d')](_0x18fbcb[_0x25de('0x41')][_0x25de('0x2d')]);}_0x1f3b0a[_0x25de('0x48')]=qs[_0x25de('0x49')](_0x18fbcb[_0x25de('0x41')]['sort']);_0x1f3b0a[_0x25de('0x4a')]=qs['filters'](_[_0x25de('0x4b')](_0x18fbcb['query'],_0x5a4215['filters']),_0x5226be);if(_0x18fbcb['query'][_0x25de('0x4c')]){_0x1f3b0a[_0x25de('0x4a')]=_[_0x25de('0x4d')](_0x1f3b0a[_0x25de('0x4a')],{'$or':_['map'](_0x5226be,function(_0x43d789){if(_0x43d789[_0x25de('0x3c')]!==_0x25de('0x4e')){var _0x309f6a={};_0x309f6a[_0x43d789['name']]={'$like':'%'+_0x18fbcb[_0x25de('0x41')][_0x25de('0x4c')]+'%'};return _0x309f6a;}})});}_0x1f3b0a=_['merge']({},_0x1f3b0a,_0x18fbcb[_0x25de('0x4f')]);var _0x1b5bfa={'where':_0x1f3b0a['where']};return db[_0x25de('0x39')][_0x25de('0x50')](_0x1b5bfa)['then'](function(_0x339980){_0xa30936['count']=_0x339980;if(_0x18fbcb[_0x25de('0x41')][_0x25de('0x51')]){_0x1f3b0a['include']=[{'all':!![]}];}return db[_0x25de('0x39')][_0x25de('0x52')](_0x1f3b0a);})[_0x25de('0x1f')](function(_0x4ac40d){_0xa30936[_0x25de('0x53')]=_0x4ac40d;return _0xa30936;})[_0x25de('0x1f')](respondWithFilteredResult(_0x1e57a1,_0x1f3b0a))[_0x25de('0x29')](handleError(_0x1e57a1,null));};exports[_0x25de('0x54')]=function(_0x5fc217,_0x281a41){var _0xb6ad41={'raw':!![],'where':{'id':_0x5fc217[_0x25de('0x55')]['id']}},_0x56a1ce={};_0x56a1ce[_0x25de('0x3e')]=_[_0x25de('0x3f')](db[_0x25de('0x39')]['rawAttributes']);_0x56a1ce['query']=_[_0x25de('0x3f')](_0x5fc217[_0x25de('0x41')]);_0x56a1ce[_0x25de('0x56')]=_[_0x25de('0x40')](_0x56a1ce[_0x25de('0x3e')],_0x56a1ce[_0x25de('0x41')]);_0xb6ad41[_0x25de('0x42')]=_[_0x25de('0x40')](_0x56a1ce[_0x25de('0x3e')],qs[_0x25de('0x43')](_0x5fc217[_0x25de('0x41')][_0x25de('0x43')]));_0xb6ad41[_0x25de('0x42')]=_0xb6ad41[_0x25de('0x42')][_0x25de('0x44')]?_0xb6ad41[_0x25de('0x42')]:_0x56a1ce[_0x25de('0x3e')];if(_0x5fc217[_0x25de('0x41')][_0x25de('0x51')]){_0xb6ad41[_0x25de('0x57')]=[{'all':!![]}];}_0xb6ad41=_[_0x25de('0x4d')]({},_0xb6ad41,_0x5fc217[_0x25de('0x4f')]);return db['WhatsappMessage'][_0x25de('0x58')](_0xb6ad41)['then'](handleEntityNotFound(_0x281a41,null))[_0x25de('0x1f')](respondWithResult(_0x281a41,null))['catch'](handleError(_0x281a41,null));};exports[_0x25de('0x59')]=function(_0x3d572e,_0x5f27c3){return db[_0x25de('0x39')]['create'](_0x3d572e[_0x25de('0x5a')],{})['then'](respondWithResult(_0x5f27c3,0xc9))[_0x25de('0x29')](handleError(_0x5f27c3,null));};exports[_0x25de('0x31')]=function(_0x157105,_0x4e68ed){if(_0x157105[_0x25de('0x5a')]['id']){delete _0x157105[_0x25de('0x5a')]['id'];}return db[_0x25de('0x39')][_0x25de('0x58')]({'where':{'id':_0x157105[_0x25de('0x55')]['id']}})[_0x25de('0x1f')](handleEntityNotFound(_0x4e68ed,null))[_0x25de('0x1f')](saveUpdates(_0x157105['body'],null))['then'](respondWithResult(_0x4e68ed,null))[_0x25de('0x29')](handleError(_0x4e68ed,null));};exports['destroy']=function(_0x143690,_0xa2a7fb){return db[_0x25de('0x39')][_0x25de('0x58')]({'where':{'id':_0x143690['params']['id']}})[_0x25de('0x1f')](handleEntityNotFound(_0xa2a7fb,null))[_0x25de('0x1f')](removeEntity(_0xa2a7fb,null))['catch'](handleError(_0xa2a7fb,null));};exports[_0x25de('0x5b')]=function(_0x49b936,_0x319ed0){return db[_0x25de('0x39')][_0x25de('0x5b')]()[_0x25de('0x1f')](respondWithResult(_0x319ed0,null))[_0x25de('0x29')](handleError(_0x319ed0,null));};var interaction_log=require(_0x25de('0xe'))(_0x25de('0x5c'));exports[_0x25de('0x5d')]=function(_0x429209,_0x5ae68d,_0x2a4c84){var _0x48c772={'channel':'whatsapp'};if(_0x429209[_0x25de('0x5a')]['id']){delete _0x429209[_0x25de('0x5a')]['id'];}_0x429209[_0x25de('0x5a')][_0x25de('0x5e')]=!![];_0x429209['body']['readAt']=moment()[_0x25de('0x5f')](_0x25de('0x60'));_0x429209[_0x25de('0x5a')][_0x25de('0x61')]=_0x429209[_0x25de('0x5a')][_0x25de('0x61')]||_0x429209[_0x25de('0x62')]['id'];return db[_0x25de('0x39')][_0x25de('0x58')]({'where':{'id':_0x429209[_0x25de('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x25de('0x63')],'as':_0x25de('0x64')}]})['then'](handleEntityNotFound(_0x5ae68d,null))[_0x25de('0x1f')](saveUpdates(_0x429209['body'],null))[_0x25de('0x1f')](function(_0x1ed443){if(_0x1ed443){_0x48c772[_0x25de('0x28')]=_0x1ed443[_0x25de('0x65')]({'plain':!![]});return db[_0x25de('0x66')][_0x25de('0x58')]({'where':{'id':_0x1ed443[_0x25de('0x67')]}});}return null;})[_0x25de('0x1f')](handleEntityNotFound(_0x5ae68d,null))[_0x25de('0x1f')](function(_0x6cf28f){if(_0x6cf28f){return _0x6cf28f['update']({'UserId':_0x429209[_0x25de('0x5a')][_0x25de('0x61')],'read1stAt':_[_0x25de('0x68')](_0x6cf28f[_0x25de('0x69')])?moment()[_0x25de('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x25de('0x1f')](function(_0x44d295){if(_0x44d295){_0x48c772[_0x25de('0x6a')]=_0x44d295['get']({'plain':!![]});interaction_log[_0x25de('0x20')](_0x25de('0x6b'),_0x429209[_0x25de('0x62')]['id'],_0x429209['user'][_0x25de('0x35')],_0x429209[_0x25de('0x62')][_0x25de('0x6c')],_0x48c772['interaction']['id'],_0x429209[_0x25de('0x5a')]?JSON[_0x25de('0x24')](_0x429209[_0x25de('0x5a')]):_0x25de('0x6d'));return respondWithRpcPromise(_0x25de('0x6e'),_0x25de('0x6f'),_0x48c772);}return null;})[_0x25de('0x1f')](function(_0xf42cd8){if(_0xf42cd8){if(_0x429209[_0x25de('0x5a')][_0x25de('0x70')]){_0x48c772['message']['interface']=util[_0x25de('0x5f')](_0x25de('0x71'),_0x429209['user']['name']);_0x48c772['message'][_0x25de('0x72')]=_0x48c772[_0x25de('0x72')];_0x48c772[_0x25de('0x28')][_0x25de('0x73')]=_0x25de('0x5d');return respondWithRpcPromise(_0x25de('0x74'),_0x25de('0x74'),{'event':'acceptmessage','message':_0x48c772['message']},client9002)['then'](function(){return _0x48c772;});}return _0x48c772;}return null;})[_0x25de('0x1f')](respondWithResult(_0x5ae68d,null))[_0x25de('0x29')](handleError(_0x5ae68d,null));};var interaction_log=require('../../config/logger')(_0x25de('0x5c'));exports[_0x25de('0x75')]=function(_0x1cfb36,_0x5edb6f,_0x27effb){var _0x3547aa={'agent':{},'channel':_0x25de('0x76')};if(_0x1cfb36['body']['id']){delete _0x1cfb36[_0x25de('0x5a')]['id'];}_0x1cfb36[_0x25de('0x5a')][_0x25de('0x61')]=_0x1cfb36['body']['UserId']||_0x1cfb36['user']['id'];_0x3547aa['agent']['id']=_0x1cfb36['body'][_0x25de('0x61')];return db[_0x25de('0x39')][_0x25de('0x58')]({'where':{'id':_0x1cfb36[_0x25de('0x55')]['id'],'UserId':null}})[_0x25de('0x1f')](handleEntityNotFound(_0x5edb6f,null))[_0x25de('0x1f')](function(_0xe48938){if(_0xe48938){_0x3547aa[_0x25de('0x28')]=_0xe48938[_0x25de('0x65')]({'plain':!![]});return db[_0x25de('0x66')][_0x25de('0x58')]({'where':{'id':_0xe48938[_0x25de('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x5edb6f,null))[_0x25de('0x1f')](function(_0x1421f9){if(_0x1421f9){_0x3547aa['interaction']=_0x1421f9[_0x25de('0x65')]({'plain':!![]});interaction_log[_0x25de('0x20')](_0x25de('0x77'),_0x1cfb36['user']['id'],_0x1cfb36[_0x25de('0x62')][_0x25de('0x35')],_0x1cfb36[_0x25de('0x62')][_0x25de('0x6c')],_0x3547aa[_0x25de('0x6a')]['id'],_0x1cfb36[_0x25de('0x5a')]?JSON[_0x25de('0x24')](_0x1cfb36[_0x25de('0x5a')]):_0x25de('0x6d'));return respondWithRpcPromise('RejectMessage',_0x25de('0x78'),_0x3547aa);}return null;})['then'](function(_0x2f9d93){if(_0x2f9d93){_0x2f9d93['message'][_0x25de('0x79')]=util['format'](_0x25de('0x71'),_0x1cfb36[_0x25de('0x62')]['name']);_0x2f9d93['message'][_0x25de('0x72')]=_0x3547aa[_0x25de('0x72')];_0x2f9d93[_0x25de('0x28')]['event']=_0x25de('0x75');respondWithRpcPromise(_0x25de('0x74'),_0x25de('0x74'),{'event':_0x25de('0x7a'),'message':_0x2f9d93[_0x25de('0x28')]},client9002);return _0x3547aa;}return null;})[_0x25de('0x1f')](respondWithResult(_0x5edb6f,null))[_0x25de('0x29')](handleError(_0x5edb6f,null));};exports[_0x25de('0x2b')]=function(_0x547f93,_0x3fc70f,_0x32e0c4){if(_0x547f93['body']['id']){delete _0x547f93[_0x25de('0x5a')]['id'];}var _0x3d333f;return db['WhatsappMessage'][_0x25de('0x58')]({'where':{'id':_0x547f93[_0x25de('0x55')]['id']}})[_0x25de('0x1f')](handleEntityNotFound(_0x3fc70f,null))[_0x25de('0x1f')](function(_0x170371){if(_0x170371){_0x3d333f=_0x170371;return db[_0x25de('0x7b')][_0x25de('0x58')]({'where':{'id':_0x170371['WhatsappAccountId']}});}})[_0x25de('0x1f')](handleEntityNotFound(_0x3fc70f,null))[_0x25de('0x1f')](function(_0x46b785){if(_0x46b785){logger[_0x25de('0x22')](_0x25de('0x7c'),_0x25de('0x2b'),'received\x20delivery\x20report\x20from',_0x46b785[_0x25de('0x3c')],util[_0x25de('0x7d')](_0x547f93['body'],{'showHidden':![],'depth':null}));switch(_0x46b785[_0x25de('0x3c')]){case _0x25de('0x7e'):if(_0x547f93[_0x25de('0x5a')][_0x25de('0x7f')]&&_0x547f93[_0x25de('0x5a')][_0x25de('0x7f')]===_0x3d333f['messageId']&&_0x547f93[_0x25de('0x5a')][_0x25de('0x80')]&&_0x547f93[_0x25de('0x5a')][_0x25de('0x80')]===_0x25de('0x5e')){return _0x3d333f[_0x25de('0x31')]({'read':!![]});}else{logger[_0x25de('0x25')](_0x25de('0x81'),_0x25de('0x2b'),_0x25de('0x7e'),util[_0x25de('0x7d')](_0x547f93[_0x25de('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x3d333f;}})[_0x25de('0x1f')](respondWithResult(_0x3fc70f,null))[_0x25de('0x29')](handleError(_0x3fc70f,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index bfd90c0..7e49555 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(_0x8de09c,_0x2fe0bb){var _0x3fed26=function(_0x24cb64){while(--_0x24cb64){_0x8de09c['push'](_0x8de09c['shift']());}};_0x3fed26(++_0x2fe0bb);}(_0x7a54,0x106));var _0x47a5=function(_0x165540,_0x3cfc6f){_0x165540=_0x165540-0x0;var _0x5cf1f1=_0x7a54[_0x165540];return _0x5cf1f1;};'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(_0x1154b3,_0x5e2f4f){var _0x4bbffe=function(_0x9e5fe4){while(--_0x9e5fe4){_0x1154b3['push'](_0x1154b3['shift']());}};_0x4bbffe(++_0x5e2f4f);}(_0xb10b,0x12a));var _0xbb10=function(_0x496738,_0x3f1a9f){_0x496738=_0x496738-0x0;var _0xee1381=_0xb10b[_0x496738];return _0xee1381;};'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 eac81a4..aa64ab5 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 _0x4a85=['authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','get','toLowerCase','secret','UserId','WhatsappInteraction','findOne','then','update','createdAt','direction','error','out','WhatsappAccount','twilio','accountSid'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x4a85,0x71));var _0x54a8=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x4a85[_0x122096];return _0x3d1966;};'use strict';var _=require(_0x54a8('0x0'));var util=require(_0x54a8('0x1'));var logger=require(_0x54a8('0x2'))(_0x54a8('0x3'));var moment=require(_0x54a8('0x4'));var BPromise=require('bluebird');var rp=require(_0x54a8('0x5'));var fs=require('fs');var path=require(_0x54a8('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x54a8('0x7'));module[_0x54a8('0x8')]=function(_0x56951a,_0x15f061){return _0x56951a[_0x54a8('0x9')](_0x54a8('0xa'),attributes,{'tableName':_0x54a8('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x54a8('0xc')]},{'name':_0x54a8('0xd'),'fields':[_0x54a8('0xe')],'type':_0x54a8('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b6913,_0x5397dd,_0x130ea8){var _0x5be358=_0x56951a['models'];var _0x211c4f=_0x3b6913[_0x54a8('0x10')]({'plain':!![]});if(_0x211c4f['direction'][_0x54a8('0x11')]()==='in'||_0x211c4f['direction'][_0x54a8('0x11')]()==='out'&&!_0x211c4f[_0x54a8('0x12')]&&!_['isNil'](_0x211c4f[_0x54a8('0x13')])){_0x5be358[_0x54a8('0x14')][_0x54a8('0x15')]({'where':{'id':_0x211c4f['WhatsappInteractionId']}})[_0x54a8('0x16')](function(_0x32caa9){if(_0x32caa9){_0x32caa9[_0x54a8('0x17')]({'lastMsgAt':_0x211c4f[_0x54a8('0x18')],'lastMsgDirection':_0x211c4f[_0x54a8('0x19')]['toLowerCase']()});}})['catch'](function(_0x227dba){console[_0x54a8('0x1a')](_0x227dba);});}if(_0x211c4f[_0x54a8('0x19')]===_0x54a8('0x1b')&&!_0x211c4f[_0x54a8('0x12')]){var _0x528e84;_0x5be358[_0x54a8('0x1c')]['find']({'where':{'id':_0x211c4f['WhatsappAccountId']},'raw':!![]})['then'](function(_0x28f1ad){_0x528e84=_0x28f1ad;if(_0x528e84&&_0x528e84['type']){switch(_0x528e84['type']){case _0x54a8('0x1d'):var _0x396223=require(_0x54a8('0x1d'));if(_0x528e84[_0x54a8('0x1e')]&&_0x528e84[_0x54a8('0x1f')]&&_0x528e84[_0x54a8('0x20')]){var _0x5f1a59=new _0x396223(_0x528e84['accountSid'],_0x528e84[_0x54a8('0x1f')]);_0x5f1a59[_0x54a8('0x21')][_0x54a8('0x22')]({'body':_0x211c4f[_0x54a8('0xe')],'to':'whatsapp:'+_0x211c4f['phone'],'from':_0x54a8('0x23')+_0x528e84[_0x54a8('0x20')],'statusCallback':_0x528e84[_0x54a8('0x24')]+_0x54a8('0x25')+_0x211c4f['id']+_0x54a8('0x26')+_0x528e84[_0x54a8('0x27')]})[_0x54a8('0x16')](function(_0x3a9ab7){if(_0x3a9ab7['sid']){return _0x3b6913[_0x54a8('0x17')]({'messageId':_0x3a9ab7[_0x54a8('0x28')]});}})[_0x54a8('0x29')](function(_0x21e4de){logger['error'](_0x54a8('0x2a'),_0x54a8('0x2b'),_0x54a8('0x1d'),util[_0x54a8('0x2c')](_0x21e4de,{'showHidden':![],'depth':null}));});}else{logger[_0x54a8('0x1a')](_0x54a8('0x2a'),_0x54a8('0x2b'),_0x54a8('0x1d'),_0x54a8('0x2d'));}break;}}})['finally'](function(){_0x130ea8();});}else{_0x130ea8();}}},'charset':_0x54a8('0x2e'),'collate':_0x54a8('0x2f')});}; \ No newline at end of file +var _0x6db6=['finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','rimraf','../../config/environment','define','WhatsappMessage','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','catch','error','out','WhatsappAccount','find','then','type','twilio','authToken','phone','messages','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6db6,0xb3));var _0x66db=function(_0x126687,_0x2c24e4){_0x126687=_0x126687-0x0;var _0x3d57d8=_0x6db6[_0x126687];return _0x3d57d8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x66db('0x0'))('api');var moment=require(_0x66db('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x66db('0x2'));var config=require(_0x66db('0x3'));var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0x5446bf,_0x177e6f){return _0x5446bf[_0x66db('0x4')](_0x66db('0x5'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x66db('0x6'),'fields':[_0x66db('0x6')]},{'name':_0x66db('0x7'),'fields':['body'],'type':_0x66db('0x8')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x848657,_0x108117,_0x56127c){var _0x1bbc96=_0x5446bf[_0x66db('0x9')];var _0x373fdd=_0x848657[_0x66db('0xa')]({'plain':!![]});if(_0x373fdd[_0x66db('0xb')][_0x66db('0xc')]()==='in'||_0x373fdd[_0x66db('0xb')][_0x66db('0xc')]()==='out'&&!_0x373fdd[_0x66db('0xd')]&&!_['isNil'](_0x373fdd[_0x66db('0xe')])){_0x1bbc96[_0x66db('0xf')][_0x66db('0x10')]({'where':{'id':_0x373fdd[_0x66db('0x11')]}})['then'](function(_0x37cc1f){if(_0x37cc1f){_0x37cc1f[_0x66db('0x12')]({'lastMsgAt':_0x373fdd[_0x66db('0x13')],'lastMsgDirection':_0x373fdd[_0x66db('0xb')]['toLowerCase']()});}})[_0x66db('0x14')](function(_0x18ca94){console[_0x66db('0x15')](_0x18ca94);});}if(_0x373fdd['direction']===_0x66db('0x16')&&!_0x373fdd[_0x66db('0xd')]){var _0x45d630;_0x1bbc96[_0x66db('0x17')][_0x66db('0x18')]({'where':{'id':_0x373fdd['WhatsappAccountId']},'raw':!![]})[_0x66db('0x19')](function(_0x493eff){_0x45d630=_0x493eff;if(_0x45d630&&_0x45d630[_0x66db('0x1a')]){switch(_0x45d630[_0x66db('0x1a')]){case _0x66db('0x1b'):var _0x38f5f2=require(_0x66db('0x1b'));if(_0x45d630['accountSid']&&_0x45d630[_0x66db('0x1c')]&&_0x45d630[_0x66db('0x1d')]){var _0x3cf4e9=new _0x38f5f2(_0x45d630['accountSid'],_0x45d630['authToken']);_0x3cf4e9[_0x66db('0x1e')]['create']({'body':_0x373fdd[_0x66db('0x1f')],'to':_0x66db('0x20')+_0x373fdd[_0x66db('0x1d')],'from':_0x66db('0x20')+_0x45d630['phone'],'statusCallback':_0x45d630[_0x66db('0x21')]+_0x66db('0x22')+_0x373fdd['id']+_0x66db('0x23')+_0x45d630['token']})[_0x66db('0x19')](function(_0x1d715c){if(_0x1d715c[_0x66db('0x24')]){return _0x848657[_0x66db('0x12')]({'messageId':_0x1d715c[_0x66db('0x24')]});}})[_0x66db('0x14')](function(_0x33dfee){logger['error'](_0x66db('0x25'),_0x66db('0x26'),_0x66db('0x1b'),util[_0x66db('0x27')](_0x33dfee,{'showHidden':![],'depth':null}));});}else{logger[_0x66db('0x15')](_0x66db('0x25'),_0x66db('0x26'),_0x66db('0x1b'),_0x66db('0x28'));}break;}}})[_0x66db('0x29')](function(){_0x56127c();});}else{_0x56127c();}}},'charset':_0x66db('0x2a'),'collate':_0x66db('0x2b')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index d7b428a..1f66dad 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 _0x36a8=['catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x53a45d,_0x3c03c3){var _0x4a6548=function(_0xbd7f7f){while(--_0xbd7f7f){_0x53a45d['push'](_0x53a45d['shift']());}};_0x4a6548(++_0x3c03c3);}(_0x36a8,0x1cf));var _0x836a=function(_0x2653ac,_0x338212){_0x2653ac=_0x2653ac-0x0;var _0x14a4ba=_0x36a8[_0x2653ac];return _0x14a4ba;};'use strict';var _=require(_0x836a('0x0'));var util=require(_0x836a('0x1'));var moment=require(_0x836a('0x2'));var BPromise=require(_0x836a('0x3'));var rs=require(_0x836a('0x4'));var fs=require('fs');var Redis=require(_0x836a('0x5'));var db=require(_0x836a('0x6'))['db'];var utils=require(_0x836a('0x7'));var logger=require(_0x836a('0x8'))('rpc');var config=require(_0x836a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x836a('0xa')][_0x836a('0xb')]({'port':0x232a});config[_0x836a('0xc')]=_[_0x836a('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x836a('0xe'))(new Redis(config[_0x836a('0xc')]));require(_0x836a('0xf'))[_0x836a('0x10')](socket);function respondWithRpcPromise(_0x4146f2,_0x2b20f9,_0x5310b0){return new BPromise(function(_0x2709a5,_0x489dc2){return client[_0x836a('0x11')](_0x4146f2,_0x5310b0)[_0x836a('0x12')](function(_0x750e3c){logger[_0x836a('0x13')](_0x836a('0x14'),_0x2b20f9,'request\x20sent');logger['debug'](_0x836a('0x15'),_0x2b20f9,_0x836a('0x16'),JSON[_0x836a('0x17')](_0x750e3c));if(_0x750e3c[_0x836a('0x18')]){if(_0x750e3c[_0x836a('0x18')]['code']===0x1f4){logger['error'](_0x836a('0x14'),_0x2b20f9,_0x750e3c['error'][_0x836a('0x19')]);return _0x489dc2(_0x750e3c[_0x836a('0x18')]['message']);}logger[_0x836a('0x18')](_0x836a('0x14'),_0x2b20f9,_0x750e3c[_0x836a('0x18')][_0x836a('0x19')]);return _0x2709a5(_0x750e3c[_0x836a('0x18')][_0x836a('0x19')]);}else{logger['info'](_0x836a('0x14'),_0x2b20f9,'request\x20sent');_0x2709a5(_0x750e3c[_0x836a('0x1a')][_0x836a('0x19')]);}})[_0x836a('0x1b')](function(_0x2f6ad8){logger[_0x836a('0x18')](_0x836a('0x14'),_0x2b20f9,_0x2f6ad8);_0x489dc2(_0x2f6ad8);});});}exports[_0x836a('0x1c')]=function(_0x47343e){var _0x4609a1=this;return new Promise(function(_0x476b9d,_0x1441b6){return db[_0x836a('0x1d')][_0x836a('0x1e')](_0x47343e[_0x836a('0x1f')],{'raw':_0x47343e[_0x836a('0x20')]?_0x47343e[_0x836a('0x20')][_0x836a('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x6a87ff){logger['info']('CreateWhatsappMessage',_0x47343e);logger[_0x836a('0x22')](_0x836a('0x1c'),_0x47343e,JSON[_0x836a('0x17')](_0x6a87ff));_0x476b9d(_0x6a87ff);})['catch'](function(_0x564afa){logger['error']('CreateWhatsappMessage',_0x564afa[_0x836a('0x19')],_0x47343e);_0x1441b6(_0x4609a1[_0x836a('0x18')](0x1f4,_0x564afa[_0x836a('0x19')]));});});}; \ No newline at end of file +var _0x4961=['ioredis','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','./whatsappMessage.socket','register','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','stringify','util','moment'];(function(_0x2e63e8,_0xed68f5){var _0x3fe904=function(_0x10e876){while(--_0x10e876){_0x2e63e8['push'](_0x2e63e8['shift']());}};_0x3fe904(++_0xed68f5);}(_0x4961,0x15a));var _0x1496=function(_0x408fb8,_0x1cb456){_0x408fb8=_0x408fb8-0x0;var _0x3cbd92=_0x4961[_0x408fb8];return _0x3cbd92;};'use strict';var _=require('lodash');var util=require(_0x1496('0x0'));var moment=require(_0x1496('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1496('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1496('0x3'));var logger=require(_0x1496('0x4'))(_0x1496('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1496('0x6')]['http']({'port':0x232a});config[_0x1496('0x7')]=_[_0x1496('0x8')](config[_0x1496('0x7')],{'host':_0x1496('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1496('0x7')]));require(_0x1496('0xa'))[_0x1496('0xb')](socket);function respondWithRpcPromise(_0x4f7027,_0x266f1c,_0x41abd2){return new BPromise(function(_0x59eb33,_0x138119){return client['request'](_0x4f7027,_0x41abd2)[_0x1496('0xc')](function(_0x27d748){logger[_0x1496('0xd')](_0x1496('0xe'),_0x266f1c,_0x1496('0xf'));logger[_0x1496('0x10')](_0x1496('0x11'),_0x266f1c,'request\x20sent',JSON['stringify'](_0x27d748));if(_0x27d748[_0x1496('0x12')]){if(_0x27d748[_0x1496('0x12')][_0x1496('0x13')]===0x1f4){logger[_0x1496('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x266f1c,_0x27d748['error'][_0x1496('0x14')]);return _0x138119(_0x27d748[_0x1496('0x12')]['message']);}logger['error'](_0x1496('0xe'),_0x266f1c,_0x27d748['error']['message']);return _0x59eb33(_0x27d748[_0x1496('0x12')][_0x1496('0x14')]);}else{logger['info'](_0x1496('0xe'),_0x266f1c,_0x1496('0xf'));_0x59eb33(_0x27d748['result'][_0x1496('0x14')]);}})[_0x1496('0x15')](function(_0x2caa94){logger[_0x1496('0x12')](_0x1496('0xe'),_0x266f1c,_0x2caa94);_0x138119(_0x2caa94);});});}exports[_0x1496('0x16')]=function(_0xe522db){var _0x5f1141=this;return new Promise(function(_0x49b8e4,_0xb12cef){return db[_0x1496('0x17')][_0x1496('0x18')](_0xe522db[_0x1496('0x19')],{'raw':_0xe522db[_0x1496('0x1a')]?_0xe522db[_0x1496('0x1a')][_0x1496('0x1b')]===undefined?!![]:![]:!![]})[_0x1496('0xc')](function(_0x4d3b91){logger[_0x1496('0xd')]('CreateWhatsappMessage',_0xe522db);logger['debug'](_0x1496('0x16'),_0xe522db,JSON[_0x1496('0x1c')](_0x4d3b91));_0x49b8e4(_0x4d3b91);})[_0x1496('0x15')](function(_0x7e8b15){logger['error']('CreateWhatsappMessage',_0x7e8b15[_0x1496('0x14')],_0xe522db);_0xb12cef(_0x5f1141[_0x1496('0x12')](0x1f4,_0x7e8b15[_0x1496('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index b0f5bb7..6f09579 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 _0xc6c0=['register','length','./whatsappMessage.events','save','remove','update','emit','removeListener'];(function(_0x441f7a,_0x576321){var _0x4821da=function(_0x5c5b52){while(--_0x5c5b52){_0x441f7a['push'](_0x441f7a['shift']());}};_0x4821da(++_0x576321);}(_0xc6c0,0x1c2));var _0x0c6c=function(_0x13b392,_0x3481f2){_0x13b392=_0x13b392-0x0;var _0x39db24=_0xc6c0[_0x13b392];return _0x39db24;};'use strict';var WhatsappMessageEvents=require(_0x0c6c('0x0'));var events=[_0x0c6c('0x1'),_0x0c6c('0x2'),_0x0c6c('0x3')];function createListener(_0x261a04,_0x3f3758){return function(_0x4817cf){_0x3f3758[_0x0c6c('0x4')](_0x261a04,_0x4817cf);};}function removeListener(_0x3d1139,_0xc5f780){return function(){WhatsappMessageEvents[_0x0c6c('0x5')](_0x3d1139,_0xc5f780);};}exports[_0x0c6c('0x6')]=function(_0x3b0e5b){for(var _0x324e84=0x0,_0x273ab2=events[_0x0c6c('0x7')];_0x324e84<_0x273ab2;_0x324e84++){var _0x2267d5=events[_0x324e84];var _0xb21e8a=createListener('whatsappMessage:'+_0x2267d5,_0x3b0e5b);WhatsappMessageEvents['on'](_0x2267d5,_0xb21e8a);}}; \ No newline at end of file +var _0x362f=['save','remove','emit','removeListener','register','length','whatsappMessage:'];(function(_0x13c1c6,_0x84c09){var _0x2e3351=function(_0x31db39){while(--_0x31db39){_0x13c1c6['push'](_0x13c1c6['shift']());}};_0x2e3351(++_0x84c09);}(_0x362f,0x1c0));var _0xf362=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x362f[_0x501510];return _0x1e6ee5;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xf362('0x0'),_0xf362('0x1'),'update'];function createListener(_0x4720f1,_0x412385){return function(_0x2bc78a){_0x412385[_0xf362('0x2')](_0x4720f1,_0x2bc78a);};}function removeListener(_0x2ecca3,_0xdcff56){return function(){WhatsappMessageEvents[_0xf362('0x3')](_0x2ecca3,_0xdcff56);};}exports[_0xf362('0x4')]=function(_0x4dae2d){for(var _0x2847e5=0x0,_0x1b5a40=events[_0xf362('0x5')];_0x2847e5<_0x1b5a40;_0x2847e5++){var _0x13cd39=events[_0x2847e5];var _0x280a1b=createListener(_0xf362('0x6')+_0x13cd39,_0x4dae2d);WhatsappMessageEvents['on'](_0x13cd39,_0x280a1b);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 41de1c5..d4c2f7a 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 _0x01e0=['isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','removeTeams','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get'];(function(_0x219935,_0x5b7d02){var _0x130409=function(_0x56409e){while(--_0x56409e){_0x219935['push'](_0x219935['shift']());}};_0x130409(++_0x5b7d02);}(_0x01e0,0x18c));var _0x001e=function(_0x43bc23,_0x5db262){_0x43bc23=_0x43bc23-0x0;var _0x5bd9e3=_0x01e0[_0x43bc23];return _0x5bd9e3;};'use strict';var multer=require(_0x001e('0x0'));var util=require(_0x001e('0x1'));var path=require(_0x001e('0x2'));var timeout=require(_0x001e('0x3'));var express=require('express');var router=express[_0x001e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x001e('0x5'));var config=require(_0x001e('0x6'));var controller=require(_0x001e('0x7'));router[_0x001e('0x8')]('/',auth[_0x001e('0x9')](),controller[_0x001e('0xa')]);router[_0x001e('0x8')](_0x001e('0xb'),auth['isAuthenticated'](),controller[_0x001e('0xc')]);router[_0x001e('0x8')](_0x001e('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x001e('0xe'),auth[_0x001e('0x9')](),controller[_0x001e('0xf')]);router[_0x001e('0x8')](_0x001e('0x10'),auth[_0x001e('0x9')](),controller['getTeams']);router['get'](_0x001e('0x11'),auth[_0x001e('0x9')](),controller[_0x001e('0x12')]);router[_0x001e('0x13')]('/',auth[_0x001e('0x9')](),controller[_0x001e('0x14')]);router['post'](_0x001e('0x10'),auth[_0x001e('0x9')](),controller[_0x001e('0x15')]);router[_0x001e('0x13')](_0x001e('0x11'),auth['isAuthenticated'](),controller[_0x001e('0x16')]);router['put'](_0x001e('0xd'),auth[_0x001e('0x9')](),controller[_0x001e('0x17')]);router[_0x001e('0x18')](_0x001e('0xd'),auth[_0x001e('0x9')](),controller['destroy']);router[_0x001e('0x18')]('/:id/teams',auth[_0x001e('0x9')](),controller[_0x001e('0x19')]);router[_0x001e('0x18')](_0x001e('0x11'),auth[_0x001e('0x9')](),controller['removeAgents']);module[_0x001e('0x1a')]=router; \ No newline at end of file +var _0x02b0=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','index','describe','/:id','isAuthenticated','show','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','removeTeams','removeAgents','multer','util','path','connect-timeout'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x02b0,0x88));var _0x002b=function(_0x28919f,_0x425587){_0x28919f=_0x28919f-0x0;var _0x5b2911=_0x02b0[_0x28919f];return _0x5b2911;};'use strict';var multer=require(_0x002b('0x0'));var util=require(_0x002b('0x1'));var path=require(_0x002b('0x2'));var timeout=require(_0x002b('0x3'));var express=require(_0x002b('0x4'));var router=express[_0x002b('0x5')]();var auth=require(_0x002b('0x6'));var interaction=require(_0x002b('0x7'));var config=require(_0x002b('0x8'));var controller=require(_0x002b('0x9'));router[_0x002b('0xa')]('/',auth['isAuthenticated'](),controller[_0x002b('0xb')]);router[_0x002b('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x002b('0xc')]);router[_0x002b('0xa')](_0x002b('0xd'),auth[_0x002b('0xe')](),controller[_0x002b('0xf')]);router[_0x002b('0xa')]('/:id/members',auth[_0x002b('0xe')](),controller[_0x002b('0x10')]);router[_0x002b('0xa')](_0x002b('0x11'),auth[_0x002b('0xe')](),controller['getTeams']);router['get'](_0x002b('0x12'),auth[_0x002b('0xe')](),controller[_0x002b('0x13')]);router[_0x002b('0x14')]('/',auth['isAuthenticated'](),controller[_0x002b('0x15')]);router['post'](_0x002b('0x11'),auth[_0x002b('0xe')](),controller[_0x002b('0x16')]);router['post']('/:id/users',auth[_0x002b('0xe')](),controller[_0x002b('0x17')]);router[_0x002b('0x18')](_0x002b('0xd'),auth[_0x002b('0xe')](),controller[_0x002b('0x19')]);router['delete'](_0x002b('0xd'),auth[_0x002b('0xe')](),controller['destroy']);router['delete'](_0x002b('0x11'),auth[_0x002b('0xe')](),controller[_0x002b('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x002b('0x1b')]);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 d378ec8..f1ddac7 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 _0xccb3=['beepall','exports','STRING','ENUM','rrmemory'];(function(_0x522d0b,_0x767a24){var _0x128e1e=function(_0x24e733){while(--_0x24e733){_0x522d0b['push'](_0x522d0b['shift']());}};_0x128e1e(++_0x767a24);}(_0xccb3,0x15a));var _0x3ccb=function(_0x380a3f,_0x202483){_0x380a3f=_0x380a3f-0x0;var _0x2b4eca=_0xccb3[_0x380a3f];return _0x2b4eca;};'use strict';var Sequelize=require('sequelize');module[_0x3ccb('0x0')]={'name':{'type':Sequelize[_0x3ccb('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3ccb('0x2')](_0x3ccb('0x3'),_0x3ccb('0x4'),'roundrobin')},'description':{'type':Sequelize[_0x3ccb('0x1')]}}; \ No newline at end of file +var _0x6067=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x4ef8a0,_0x4bbbcb){var _0x11c017=function(_0x2fe769){while(--_0x2fe769){_0x4ef8a0['push'](_0x4ef8a0['shift']());}};_0x11c017(++_0x4bbbcb);}(_0x6067,0x152));var _0x7606=function(_0x40cd8f,_0x35cbdc){_0x40cd8f=_0x40cd8f-0x0;var _0x63c722=_0x6067[_0x40cd8f];return _0x63c722;};'use strict';var Sequelize=require(_0x7606('0x0'));module[_0x7606('0x1')]={'name':{'type':Sequelize[_0x7606('0x2')],'unique':_0x7606('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x7606('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7606('0x5')](_0x7606('0x6'),_0x7606('0x7'),_0x7606('0x8'))},'description':{'type':Sequelize[_0x7606('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 65e13b2..6fd7b87 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 _0xd8cc=['squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','get','WhatsappQueues','stack','name','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','WhatsappQueue','includeAll','include','findAll','rows','show','params','find','catch','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','update','destroy','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','User','findAndCountAll','agent','whatsappPause','format','SIP','createdAt','updatedAt','getTeams','Team','pick','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','includes','union','compact','value','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','eml-format','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash'];(function(_0xee741b,_0x10cf16){var _0x9ce0a2=function(_0x196418){while(--_0x196418){_0xee741b['push'](_0xee741b['shift']());}};_0x9ce0a2(++_0x10cf16);}(_0xd8cc,0x111));var _0xcd8c=function(_0x31991b,_0xaf75d2){_0x31991b=_0x31991b-0x0;var _0x307304=_0xd8cc[_0x31991b];return _0x307304;};'use strict';var pdf=require(_0xcd8c('0x0'));var emlformat=require(_0xcd8c('0x1'));var rimraf=require(_0xcd8c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcd8c('0x3'));var moment=require(_0xcd8c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcd8c('0x5'));var util=require('util');var path=require(_0xcd8c('0x6'));var sox=require(_0xcd8c('0x7'));var csv=require(_0xcd8c('0x8'));var ejs=require(_0xcd8c('0x9'));var fs=require('fs');var _=require(_0xcd8c('0xa'));var squel=require(_0xcd8c('0xb'));var crypto=require(_0xcd8c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcd8c('0x8'));var querystring=require(_0xcd8c('0xd'));var Papa=require(_0xcd8c('0xe'));var Redis=require('ioredis');var authService=require(_0xcd8c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xcd8c('0x10'));var hardwareService=require(_0xcd8c('0x11'));var logger=require(_0xcd8c('0x12'))(_0xcd8c('0x13'));var utils=require(_0xcd8c('0x14'));var config=require(_0xcd8c('0x15'));var db=require(_0xcd8c('0x16'))['db'];config[_0xcd8c('0x17')]=_[_0xcd8c('0x18')](config[_0xcd8c('0x17')],{'host':_0xcd8c('0x19'),'port':0x18eb});var socket=require(_0xcd8c('0x1a'))(new Redis(config['redis']));require(_0xcd8c('0x1b'))[_0xcd8c('0x1c')](socket);function respondWithStatusCode(_0x3f4df0,_0x32f260){_0x32f260=_0x32f260||0xcc;return function(_0x4b4bfc){if(_0x4b4bfc){return _0x3f4df0[_0xcd8c('0x1d')](_0x32f260);}return _0x3f4df0[_0xcd8c('0x1e')](_0x32f260)[_0xcd8c('0x1f')]();};}function respondWithResult(_0x12a536,_0x2de3b8){_0x2de3b8=_0x2de3b8||0xc8;return function(_0x11e61c){if(_0x11e61c){return _0x12a536[_0xcd8c('0x1e')](_0x2de3b8)[_0xcd8c('0x20')](_0x11e61c);}};}function respondWithFilteredResult(_0x288a02,_0x4de5de){return function(_0x1f1111){if(_0x1f1111){var _0x2d02ef=_0x1f1111[_0xcd8c('0x21')],_0x3983e0=_0x4de5de[_0xcd8c('0x22')],_0x488014=_0x4de5de['offset']+_0x4de5de[_0xcd8c('0x23')],_0x250cd8;if(_0x488014>=_0x2d02ef){_0x488014=_0x2d02ef;_0x250cd8=0xc8;}else{_0x250cd8=0xce;}_0x288a02[_0xcd8c('0x1e')](_0x250cd8);return _0x288a02[_0xcd8c('0x24')](_0xcd8c('0x25'),_0x3983e0+'-'+_0x488014+'/'+_0x2d02ef)[_0xcd8c('0x20')](_0x1f1111);}return null;};}function patchUpdates(_0x16e313){return function(_0x36da2a){try{jsonpatch[_0xcd8c('0x26')](_0x36da2a,_0x16e313,!![]);}catch(_0x126c51){return BPromise[_0xcd8c('0x27')](_0x126c51);}return _0x36da2a['save']();};}function saveUpdates(_0x5d449b,_0x4c4ba0){return function(_0x35430c){if(_0x35430c){return _0x35430c['update'](_0x5d449b)[_0xcd8c('0x28')](function(_0x405fdc){return _0x405fdc;});}return null;};}function removeEntity(_0xe701ae,_0x109daa){return function(_0x108bef){if(_0x108bef){return _0x108bef['destroy']()[_0xcd8c('0x28')](function(){var _0x3a529a=_0x108bef[_0xcd8c('0x29')]({'plain':!![]});var _0x14ea3d=_0xcd8c('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x14ea3d,'resourceId':_0x3a529a['id']}})[_0xcd8c('0x28')](function(){return _0x108bef;});})[_0xcd8c('0x28')](function(){_0xe701ae[_0xcd8c('0x1e')](0xcc)[_0xcd8c('0x1f')]();});}};}function handleEntityNotFound(_0x5c8722,_0x317557){return function(_0x2629cf){if(!_0x2629cf){_0x5c8722[_0xcd8c('0x1d')](0x194);}return _0x2629cf;};}function handleError(_0x5cc14f,_0x6ff822){_0x6ff822=_0x6ff822||0x1f4;return function(_0x53843b){logger['error'](_0x53843b[_0xcd8c('0x2b')]);if(_0x53843b[_0xcd8c('0x2c')]){delete _0x53843b[_0xcd8c('0x2c')];}_0x5cc14f['status'](_0x6ff822)['send'](_0x53843b);};}exports['index']=function(_0x4db955,_0x48166b){var _0x4b49a8={},_0x12745f={},_0x5ba497={'count':0x0,'rows':[]};var _0x510336=_['map'](db['WhatsappQueue'][_0xcd8c('0x2d')],function(_0x4f95c4){return{'name':_0x4f95c4[_0xcd8c('0x2e')],'type':_0x4f95c4[_0xcd8c('0x2f')][_0xcd8c('0x30')]};});_0x12745f[_0xcd8c('0x31')]=_[_0xcd8c('0x32')](_0x510336,'name');_0x12745f[_0xcd8c('0x33')]=_[_0xcd8c('0x34')](_0x4db955[_0xcd8c('0x33')]);_0x12745f[_0xcd8c('0x35')]=_[_0xcd8c('0x36')](_0x12745f[_0xcd8c('0x31')],_0x12745f[_0xcd8c('0x33')]);_0x4b49a8[_0xcd8c('0x37')]=_[_0xcd8c('0x36')](_0x12745f['model'],qs['fields'](_0x4db955['query'][_0xcd8c('0x38')]));_0x4b49a8['attributes']=_0x4b49a8[_0xcd8c('0x37')][_0xcd8c('0x39')]?_0x4b49a8[_0xcd8c('0x37')]:_0x12745f[_0xcd8c('0x31')];if(!_0x4db955[_0xcd8c('0x33')]['hasOwnProperty'](_0xcd8c('0x3a'))){_0x4b49a8[_0xcd8c('0x23')]=qs[_0xcd8c('0x23')](_0x4db955[_0xcd8c('0x33')][_0xcd8c('0x23')]);_0x4b49a8[_0xcd8c('0x22')]=qs[_0xcd8c('0x22')](_0x4db955['query'][_0xcd8c('0x22')]);}_0x4b49a8[_0xcd8c('0x3b')]=qs[_0xcd8c('0x3c')](_0x4db955[_0xcd8c('0x33')][_0xcd8c('0x3c')]);_0x4b49a8[_0xcd8c('0x3d')]=qs[_0xcd8c('0x35')](_['pick'](_0x4db955[_0xcd8c('0x33')],_0x12745f[_0xcd8c('0x35')]),_0x510336);if(_0x4db955[_0xcd8c('0x33')][_0xcd8c('0x3e')]){_0x4b49a8[_0xcd8c('0x3d')]=_['merge'](_0x4b49a8[_0xcd8c('0x3d')],{'$or':_[_0xcd8c('0x32')](_0x510336,function(_0x385e06){if(_0x385e06[_0xcd8c('0x2f')]!==_0xcd8c('0x3f')){var _0x250eee={};_0x250eee[_0x385e06['name']]={'$like':'%'+_0x4db955[_0xcd8c('0x33')][_0xcd8c('0x3e')]+'%'};return _0x250eee;}})});}_0x4b49a8=_[_0xcd8c('0x40')]({},_0x4b49a8,_0x4db955[_0xcd8c('0x41')]);var _0x42fe86={'where':_0x4b49a8[_0xcd8c('0x3d')]};return db[_0xcd8c('0x42')][_0xcd8c('0x21')](_0x42fe86)[_0xcd8c('0x28')](function(_0x3f1cad){_0x5ba497[_0xcd8c('0x21')]=_0x3f1cad;if(_0x4db955[_0xcd8c('0x33')][_0xcd8c('0x43')]){_0x4b49a8[_0xcd8c('0x44')]=[{'all':!![]}];}return db[_0xcd8c('0x42')][_0xcd8c('0x45')](_0x4b49a8);})[_0xcd8c('0x28')](function(_0x7058d4){_0x5ba497[_0xcd8c('0x46')]=_0x7058d4;return _0x5ba497;})['then'](respondWithFilteredResult(_0x48166b,_0x4b49a8))['catch'](handleError(_0x48166b,null));};exports[_0xcd8c('0x47')]=function(_0x23e084,_0x321de7){var _0x6a6d24={'raw':!![],'where':{'id':_0x23e084[_0xcd8c('0x48')]['id']}},_0xf78b0d={};_0xf78b0d[_0xcd8c('0x31')]=_[_0xcd8c('0x34')](db[_0xcd8c('0x42')][_0xcd8c('0x2d')]);_0xf78b0d[_0xcd8c('0x33')]=_[_0xcd8c('0x34')](_0x23e084[_0xcd8c('0x33')]);_0xf78b0d[_0xcd8c('0x35')]=_['intersection'](_0xf78b0d[_0xcd8c('0x31')],_0xf78b0d[_0xcd8c('0x33')]);_0x6a6d24[_0xcd8c('0x37')]=_[_0xcd8c('0x36')](_0xf78b0d[_0xcd8c('0x31')],qs[_0xcd8c('0x38')](_0x23e084[_0xcd8c('0x33')][_0xcd8c('0x38')]));_0x6a6d24[_0xcd8c('0x37')]=_0x6a6d24[_0xcd8c('0x37')][_0xcd8c('0x39')]?_0x6a6d24[_0xcd8c('0x37')]:_0xf78b0d[_0xcd8c('0x31')];if(_0x23e084['query'][_0xcd8c('0x43')]){_0x6a6d24[_0xcd8c('0x44')]=[{'all':!![]}];}_0x6a6d24=_[_0xcd8c('0x40')]({},_0x6a6d24,_0x23e084['options']);return db[_0xcd8c('0x42')][_0xcd8c('0x49')](_0x6a6d24)[_0xcd8c('0x28')](handleEntityNotFound(_0x321de7,null))[_0xcd8c('0x28')](respondWithResult(_0x321de7,null))[_0xcd8c('0x4a')](handleError(_0x321de7,null));};exports[_0xcd8c('0x4b')]=function(_0x18a565,_0x1eea2a){return db[_0xcd8c('0x42')][_0xcd8c('0x4b')](_0x18a565[_0xcd8c('0x4c')],{})['then'](function(_0x2266c0){var _0x324564=_0x18a565[_0xcd8c('0x4d')][_0xcd8c('0x29')]({'plain':!![]});if(!_0x324564)throw new Error(_0xcd8c('0x4e'));if(_0x324564[_0xcd8c('0x4f')]===_0xcd8c('0x4d')){var _0x2d0c0a=_0x2266c0['get']({'plain':!![]});var _0x30ba20=_0xcd8c('0x2a');return db[_0xcd8c('0x50')]['find']({'where':{'name':_0x30ba20,'userProfileId':_0x324564[_0xcd8c('0x51')]},'raw':!![]})[_0xcd8c('0x28')](function(_0x2420fa){if(_0x2420fa&&_0x2420fa[_0xcd8c('0x52')]===0x0){return db['UserProfileResource'][_0xcd8c('0x4b')]({'name':_0x2d0c0a[_0xcd8c('0x2c')],'resourceId':_0x2d0c0a['id'],'type':_0x2420fa[_0xcd8c('0x2c')],'sectionId':_0x2420fa['id']},{})[_0xcd8c('0x28')](function(){return _0x2266c0;});}else{return _0x2266c0;}})[_0xcd8c('0x4a')](function(_0x51788c){logger[_0xcd8c('0x53')](_0xcd8c('0x54'),_0x51788c);throw _0x51788c;});}return _0x2266c0;})[_0xcd8c('0x28')](respondWithResult(_0x1eea2a,0xc9))['catch'](handleError(_0x1eea2a,null));};exports[_0xcd8c('0x55')]=function(_0x556253,_0x521968){if(_0x556253['body']['id']){delete _0x556253[_0xcd8c('0x4c')]['id'];}return db['WhatsappQueue'][_0xcd8c('0x49')]({'where':{'id':_0x556253[_0xcd8c('0x48')]['id']}})[_0xcd8c('0x28')](handleEntityNotFound(_0x521968,null))[_0xcd8c('0x28')](saveUpdates(_0x556253['body'],null))[_0xcd8c('0x28')](respondWithResult(_0x521968,null))['catch'](handleError(_0x521968,null));};exports[_0xcd8c('0x56')]=function(_0x16cd3e,_0x2e7c5a){return db[_0xcd8c('0x42')][_0xcd8c('0x49')]({'where':{'id':_0x16cd3e[_0xcd8c('0x48')]['id']}})[_0xcd8c('0x28')](handleEntityNotFound(_0x2e7c5a,null))[_0xcd8c('0x28')](removeEntity(_0x2e7c5a,null))[_0xcd8c('0x4a')](handleError(_0x2e7c5a,null));};exports[_0xcd8c('0x57')]=function(_0x45ada7,_0x3cb637){return db['WhatsappQueue']['describe']()[_0xcd8c('0x28')](respondWithResult(_0x3cb637,null))[_0xcd8c('0x4a')](handleError(_0x3cb637,null));};exports[_0xcd8c('0x58')]=function(_0x5cf462,_0x53d196,_0x340171){var _0x9e58c7={'raw':!![],'where':{}},_0x531f27={},_0x505532;return db[_0xcd8c('0x42')][_0xcd8c('0x59')]({'where':{'id':_0x5cf462['params']['id']}})[_0xcd8c('0x28')](handleEntityNotFound(_0x53d196,null))['then'](function(_0x5846c7){if(_0x5846c7){_0x505532=_0x5846c7[_0xcd8c('0x29')]({'plain':!![]});_0x531f27[_0xcd8c('0x31')]=_[_0xcd8c('0x34')](db[_0xcd8c('0x5a')][_0xcd8c('0x2d')]);_0x531f27[_0xcd8c('0x33')]=_['keys'](_0x5cf462[_0xcd8c('0x33')]);_0x531f27[_0xcd8c('0x35')]=_['intersection'](_0x531f27[_0xcd8c('0x31')],_0x531f27[_0xcd8c('0x33')]);_0x9e58c7[_0xcd8c('0x37')]=_[_0xcd8c('0x36')](_0x531f27[_0xcd8c('0x31')],qs[_0xcd8c('0x38')](_0x5cf462[_0xcd8c('0x33')][_0xcd8c('0x38')]));_0x9e58c7[_0xcd8c('0x37')]=_0x9e58c7[_0xcd8c('0x37')]['length']?_0x9e58c7[_0xcd8c('0x37')]:_0x531f27[_0xcd8c('0x31')];if(!_0x5cf462[_0xcd8c('0x33')][_0xcd8c('0x5b')]('nolimit')){_0x9e58c7[_0xcd8c('0x23')]=qs[_0xcd8c('0x23')](_0x5cf462[_0xcd8c('0x33')][_0xcd8c('0x23')]);_0x9e58c7['offset']=qs[_0xcd8c('0x22')](_0x5cf462['query'][_0xcd8c('0x22')]);}_0x9e58c7[_0xcd8c('0x3b')]=qs[_0xcd8c('0x3c')](_0x5cf462['query']['sort']);_0x9e58c7['where']=qs[_0xcd8c('0x35')](_['pick'](_0x5cf462['query'],_0x531f27[_0xcd8c('0x35')]));_0x9e58c7[_0xcd8c('0x3d')]['WhatsappQueueId']=_0x5846c7['id'];if(_0x5cf462[_0xcd8c('0x33')]['filter']){_0x9e58c7[_0xcd8c('0x3d')]=_[_0xcd8c('0x40')](_0x9e58c7[_0xcd8c('0x3d')],{'$or':_[_0xcd8c('0x32')](_0x9e58c7[_0xcd8c('0x37')],function(_0x4d9dfc){var _0xcba9a5={};_0xcba9a5[_0x4d9dfc]={'$like':'%'+_0x5cf462[_0xcd8c('0x33')][_0xcd8c('0x3e')]+'%'};return _0xcba9a5;})});}_0x9e58c7=_[_0xcd8c('0x40')]({},_0x9e58c7,_0x5cf462[_0xcd8c('0x41')]);return db[_0xcd8c('0x5a')][_0xcd8c('0x45')](_0x9e58c7);}})[_0xcd8c('0x28')](function(_0x44ff36){if(_0x44ff36){return db[_0xcd8c('0x5c')][_0xcd8c('0x5d')]({'where':{'id':_[_0xcd8c('0x32')](_0x44ff36,'UserId'),'role':_0xcd8c('0x5e')},'attributes':['id',_0xcd8c('0x2c'),_0xcd8c('0x5f'),'updatedAt','createdAt']});}})[_0xcd8c('0x28')](function(_0x1708fd){if(_0x1708fd){return{'count':_0x1708fd[_0xcd8c('0x21')],'rows':_['map'](_0x1708fd[_0xcd8c('0x46')],function(_0xa44cdb){return{'membername':_0xa44cdb[_0xcd8c('0x2c')],'UserId':_0xa44cdb['id'],'queue_name':_0x505532['name'],'WhatsappQueueId':_0x505532['id'],'interface':util[_0xcd8c('0x60')]('%s/%s',_0xcd8c('0x61'),_0xa44cdb[_0xcd8c('0x2c')]),'penalty':0x0,'paused':_0xa44cdb[_0xcd8c('0x5f')],'createdAt':_0xa44cdb[_0xcd8c('0x62')],'updatedAt':_0xa44cdb[_0xcd8c('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x53d196,_0x9e58c7))[_0xcd8c('0x4a')](handleError(_0x53d196,null));};exports[_0xcd8c('0x64')]=function(_0x28572f,_0x18c2f2,_0x164c4f){var _0x28cffe={};var _0x10e11a={};var _0x31671b;var _0x4d6074;return db['WhatsappQueue'][_0xcd8c('0x59')]({'where':{'id':_0x28572f[_0xcd8c('0x48')]['id']}})['then'](handleEntityNotFound(_0x18c2f2,null))[_0xcd8c('0x28')](function(_0x5a3567){if(_0x5a3567){_0x31671b=_0x5a3567;_0x10e11a[_0xcd8c('0x31')]=_['keys'](db[_0xcd8c('0x65')][_0xcd8c('0x2d')]);_0x10e11a[_0xcd8c('0x33')]=_['keys'](_0x28572f[_0xcd8c('0x33')]);_0x10e11a[_0xcd8c('0x35')]=_['intersection'](_0x10e11a[_0xcd8c('0x31')],_0x10e11a[_0xcd8c('0x33')]);_0x28cffe[_0xcd8c('0x37')]=_[_0xcd8c('0x36')](_0x10e11a[_0xcd8c('0x31')],qs[_0xcd8c('0x38')](_0x28572f['query'][_0xcd8c('0x38')]));_0x28cffe[_0xcd8c('0x37')]=_0x28cffe[_0xcd8c('0x37')][_0xcd8c('0x39')]?_0x28cffe[_0xcd8c('0x37')]:_0x10e11a[_0xcd8c('0x31')];_0x28cffe[_0xcd8c('0x3b')]=qs[_0xcd8c('0x3c')](_0x28572f[_0xcd8c('0x33')]['sort']);_0x28cffe['where']=qs[_0xcd8c('0x35')](_[_0xcd8c('0x66')](_0x28572f[_0xcd8c('0x33')],_0x10e11a['filters']));if(_0x28572f[_0xcd8c('0x33')][_0xcd8c('0x3e')]){_0x28cffe['where']=_['merge'](_0x28cffe[_0xcd8c('0x3d')],{'$or':_['map'](_0x28cffe[_0xcd8c('0x37')],function(_0x43676e){var _0x18aca9={};_0x18aca9[_0x43676e]={'$like':'%'+_0x28572f[_0xcd8c('0x33')]['filter']+'%'};return _0x18aca9;})});}_0x28cffe=_[_0xcd8c('0x40')]({},_0x28cffe,_0x28572f[_0xcd8c('0x41')]);return _0x31671b[_0xcd8c('0x64')](_0x28cffe);}})[_0xcd8c('0x28')](function(_0x311e0f){if(_0x311e0f){_0x4d6074=_0x311e0f[_0xcd8c('0x39')];if(!_0x28572f[_0xcd8c('0x33')]['hasOwnProperty'](_0xcd8c('0x3a'))){_0x28cffe[_0xcd8c('0x23')]=qs[_0xcd8c('0x23')](_0x28572f[_0xcd8c('0x33')][_0xcd8c('0x23')]);_0x28cffe[_0xcd8c('0x22')]=qs[_0xcd8c('0x22')](_0x28572f[_0xcd8c('0x33')]['offset']);}return _0x31671b['getTeams'](_0x28cffe);}})[_0xcd8c('0x28')](function(_0x404a4d){if(_0x404a4d){return _0x404a4d?{'count':_0x4d6074,'rows':_0x404a4d}:null;}})['then'](respondWithResult(_0x18c2f2,null))[_0xcd8c('0x4a')](handleError(_0x18c2f2,null));};exports[_0xcd8c('0x67')]=function(_0x2d9e92,_0x1cb999,_0x40678b){var _0x541ac5=_0x2d9e92[_0xcd8c('0x4c')][_0xcd8c('0x68')];return db[_0xcd8c('0x65')][_0xcd8c('0x45')]({'where':{'id':_0x541ac5},'attributes':['id'],'include':[{'model':db['User'],'as':_0xcd8c('0x69'),'attributes':['id','name',_0xcd8c('0x6a'),_0xcd8c('0x6b'),_0xcd8c('0x6c')],'raw':!![]}]})[_0xcd8c('0x28')](function(_0x4ad28e){if(_0x4ad28e){var _0x51d983=_[_0xcd8c('0x6d')](_0x4ad28e,function(_0x3c3818){var _0x443260=_0x3c3818[_0xcd8c('0x29')]({'plain':!![]});return _0x443260[_0xcd8c('0x69')];});return db[_0xcd8c('0x42')][_0xcd8c('0x49')]({'where':{'id':_0x2d9e92[_0xcd8c('0x48')]['id']}})[_0xcd8c('0x28')](function(_0x456e42){return db[_0xcd8c('0x6e')][_0xcd8c('0x6f')](function(_0x5b56e0){return _0x456e42['addTeams'](_0x541ac5,{'transaction':_0x5b56e0})[_0xcd8c('0x28')](function(){return BPromise[_0xcd8c('0x70')](_0x51d983,function(_0x389753){return db[_0xcd8c('0x5a')][_0xcd8c('0x71')]({'where':{'UserId':_0x389753['id'],'WhatsappQueueId':_0x2d9e92[_0xcd8c('0x48')]['id']},'transaction':_0x5b56e0});});})[_0xcd8c('0x28')](function(){_0x51d983[_0xcd8c('0x72')](function(_0x28e23b){socket['emit'](_0xcd8c('0x73'),{'UserId':_0x28e23b['id'],'WhatsappQueueId':_0x456e42['id']});});});});});}})[_0xcd8c('0x28')](respondWithStatusCode(_0x1cb999,null))[_0xcd8c('0x4a')](handleError(_0x1cb999,null));};exports[_0xcd8c('0x74')]=function(_0x5aa16d,_0x1a7f3b,_0x14ecd2){return db[_0xcd8c('0x65')][_0xcd8c('0x45')]({'where':{'id':_0x5aa16d['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xcd8c('0x5c')],'as':_0xcd8c('0x69'),'attributes':['id'],'raw':!![]}]})[_0xcd8c('0x28')](handleEntityNotFound(_0x1a7f3b,null))[_0xcd8c('0x28')](function(_0x53da3a){var _0x153815=_[_0xcd8c('0x32')](_0x53da3a,'id');var _0x559d8f=[];var _0x64fa08=[];var _0x141451=squel[_0xcd8c('0x75')]();_0x141451[_0xcd8c('0x76')](_0xcd8c('0x77'))[_0xcd8c('0x78')](_0xcd8c('0x79'),'tq')[_0xcd8c('0x7a')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xcd8c('0x3d')](_0xcd8c('0x7b'),_0x5aa16d[_0xcd8c('0x48')]['id']);for(var _0x33b739=0x0;_0x33b739<_0x53da3a['length'];_0x33b739+=0x1){let _0x1827e6=_0x53da3a[_0x33b739];for(var _0x3c5768=0x0;_0x3c5768<_0x1827e6[_0xcd8c('0x69')][_0xcd8c('0x39')];_0x3c5768+=0x1){let _0x3ecf33=_0x1827e6[_0xcd8c('0x69')][_0x3c5768];var _0xb75885=_0x141451[_0xcd8c('0x7c')]();_0xb75885[_0xcd8c('0x3d')](_0xcd8c('0x7d'),_0x3ecf33['id']);_0x64fa08[_0xcd8c('0x7e')](db['sequelize']['query'](_0xb75885[_0xcd8c('0x7f')](),{'type':db[_0xcd8c('0x6e')]['QueryTypes'][_0xcd8c('0x80')]})[_0xcd8c('0x28')](function(_0x2e04a6){if(_0x2e04a6[_0xcd8c('0x39')]===0x1){return _0x3ecf33['id'];}else{var _0x30f7d0=_['every'](_[_0xcd8c('0x32')](_0x2e04a6,_0xcd8c('0x81')),function(_0x1bf6e9){return _[_0xcd8c('0x82')](_0x153815,_0x1bf6e9);});if(_0x30f7d0){return _0x3ecf33['id'];}}}));}}return BPromise['all'](_0x64fa08)['then'](function(_0x3b7bf4){_0x559d8f=_(_0x559d8f)[_0xcd8c('0x83')](_0x3b7bf4)[_0xcd8c('0x84')]()[_0xcd8c('0x85')]();return db[_0xcd8c('0x42')][_0xcd8c('0x49')]({'where':{'id':_0x5aa16d[_0xcd8c('0x48')]['id']}})[_0xcd8c('0x28')](function(_0x5f3304){return db[_0xcd8c('0x6e')][_0xcd8c('0x6f')](function(_0x1c1ffd){return _0x5f3304[_0xcd8c('0x74')](_0x5aa16d[_0xcd8c('0x33')][_0xcd8c('0x68')],{'transaction':_0x1c1ffd})[_0xcd8c('0x28')](function(){if(!_[_0xcd8c('0x86')](_0x559d8f)){return _0x5f3304[_0xcd8c('0x87')](_0x559d8f,{'transaction':_0x1c1ffd});}})[_0xcd8c('0x28')](function(){_0x559d8f['forEach'](function(_0x39169d){socket[_0xcd8c('0x88')](_0xcd8c('0x89'),{'UserId':_0x39169d,'WhatsappQueueId':_0x5f3304['id']});});});});});});})[_0xcd8c('0x28')](respondWithStatusCode(_0x1a7f3b,null))[_0xcd8c('0x4a')](handleError(_0x1a7f3b,null));};exports['addAgents']=function(_0x49514b,_0xd65b68,_0x14fb09){return db['WhatsappQueue'][_0xcd8c('0x49')]({'where':{'id':_0x49514b[_0xcd8c('0x48')]['id']}})[_0xcd8c('0x28')](handleEntityNotFound(_0xd65b68,null))[_0xcd8c('0x28')](function(_0x43e2d4){if(_0x43e2d4){return _0x43e2d4[_0xcd8c('0x8a')](_0x49514b[_0xcd8c('0x4c')][_0xcd8c('0x68')],_[_0xcd8c('0x8b')](_0x49514b[_0xcd8c('0x4c')],[_0xcd8c('0x68'),'id'])||{})['spread'](function(_0xa6eba8){for(var _0x2f6dfa=0x0;_0x2f6dfa<_0x49514b[_0xcd8c('0x4c')][_0xcd8c('0x68')][_0xcd8c('0x39')];_0x2f6dfa+=0x1){socket[_0xcd8c('0x88')](_0xcd8c('0x73'),{'UserId':_0x49514b[_0xcd8c('0x4c')]['ids'][_0x2f6dfa],'WhatsappQueueId':_0x49514b[_0xcd8c('0x48')]['id']});}return _0xa6eba8;});}})[_0xcd8c('0x28')](respondWithResult(_0xd65b68,null))[_0xcd8c('0x4a')](handleError(_0xd65b68,null));};exports['removeAgents']=function(_0x18cee8,_0x539996,_0x294123){return db[_0xcd8c('0x42')]['find']({'where':{'id':_0x18cee8['params']['id']}})[_0xcd8c('0x28')](handleEntityNotFound(_0x539996,null))[_0xcd8c('0x28')](function(_0x2f29f3){if(_0x2f29f3){return _0x2f29f3[_0xcd8c('0x87')](_0x18cee8[_0xcd8c('0x33')][_0xcd8c('0x68')])[_0xcd8c('0x28')](function(){if(_[_0xcd8c('0x8c')](_0x18cee8[_0xcd8c('0x33')][_0xcd8c('0x68')])){for(var _0x2a4622=0x0;_0x2a4622<_0x18cee8[_0xcd8c('0x33')][_0xcd8c('0x68')][_0xcd8c('0x39')];_0x2a4622+=0x1){socket['emit'](_0xcd8c('0x89'),{'UserId':Number(_0x18cee8[_0xcd8c('0x33')]['ids'][_0x2a4622]),'WhatsappQueueId':Number(_0x18cee8[_0xcd8c('0x48')]['id'])});}}else{socket[_0xcd8c('0x88')](_0xcd8c('0x89'),{'UserId':Number(_0x18cee8[_0xcd8c('0x33')][_0xcd8c('0x68')]),'WhatsappQueueId':Number(_0x18cee8['params']['id'])});}});}})[_0xcd8c('0x28')](respondWithStatusCode(_0x539996,null))['catch'](handleError(_0x539996,null));};exports['getAgents']=function(_0x449c74,_0x539240,_0x31cd36){var _0x3df73a={};var _0x477273={};var _0x3d51e9;var _0x2a69b4;return db[_0xcd8c('0x42')][_0xcd8c('0x59')]({'where':{'id':_0x449c74['params']['id']}})[_0xcd8c('0x28')](handleEntityNotFound(_0x539240,null))[_0xcd8c('0x28')](function(_0x2e63da){if(_0x2e63da){_0x3d51e9=_0x2e63da;_0x477273[_0xcd8c('0x31')]=_[_0xcd8c('0x34')](db[_0xcd8c('0x5c')][_0xcd8c('0x2d')]);_0x477273[_0xcd8c('0x33')]=_['keys'](_0x449c74['query']);_0x477273['filters']=_[_0xcd8c('0x36')](_0x477273['model'],_0x477273[_0xcd8c('0x33')]);_0x3df73a['attributes']=_[_0xcd8c('0x36')](_0x477273[_0xcd8c('0x31')],qs['fields'](_0x449c74['query']['fields']));_0x3df73a[_0xcd8c('0x37')]=_0x3df73a[_0xcd8c('0x37')][_0xcd8c('0x39')]?_0x3df73a[_0xcd8c('0x37')]:_0x477273[_0xcd8c('0x31')];_0x3df73a[_0xcd8c('0x3b')]=qs[_0xcd8c('0x3c')](_0x449c74[_0xcd8c('0x33')][_0xcd8c('0x3c')]);_0x3df73a['where']=qs['filters'](_[_0xcd8c('0x66')](_0x449c74[_0xcd8c('0x33')],_0x477273[_0xcd8c('0x35')]));if(_0x449c74[_0xcd8c('0x33')]['filter']){_0x3df73a[_0xcd8c('0x3d')]=_['merge'](_0x3df73a[_0xcd8c('0x3d')],{'$or':_['map'](_0x3df73a[_0xcd8c('0x37')],function(_0x49673e){var _0x2707b0={};_0x2707b0[_0x49673e]={'$like':'%'+_0x449c74[_0xcd8c('0x33')][_0xcd8c('0x3e')]+'%'};return _0x2707b0;})});}_0x3df73a=_['merge']({},_0x3df73a,_0x449c74[_0xcd8c('0x41')]);return _0x3d51e9[_0xcd8c('0x8d')](_0x3df73a);}})[_0xcd8c('0x28')](function(_0xe4a559){if(_0xe4a559){_0x2a69b4=_0xe4a559[_0xcd8c('0x39')];if(!_0x449c74['query'][_0xcd8c('0x5b')](_0xcd8c('0x3a'))){_0x3df73a[_0xcd8c('0x23')]=qs[_0xcd8c('0x23')](_0x449c74[_0xcd8c('0x33')]['limit']);_0x3df73a[_0xcd8c('0x22')]=qs['offset'](_0x449c74[_0xcd8c('0x33')][_0xcd8c('0x22')]);}return _0x3d51e9[_0xcd8c('0x8d')](_0x3df73a);}})[_0xcd8c('0x28')](function(_0x5d7c3c){if(_0x5d7c3c){return _0x5d7c3c?{'count':_0x2a69b4,'rows':_0x5d7c3c}:null;}})['then'](respondWithResult(_0x539240,null))['catch'](handleError(_0x539240,null));}; \ No newline at end of file +var _0x5d21=['offset','set','json','apply','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','end','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','WhatsappQueue','includeAll','include','findAll','rows','options','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','params','describe','getMembers','findOne','UserWhatsappQueue','order','WhatsappQueueId','findAndCountAll','UserId','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','rawAttributes','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','userWhatsappQueue:save','User','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','removeTeams','forEach','emit','userWhatsappQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','redis','defaults','./whatsappQueue.socket','register','status','count'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x5d21,0x6a));var _0x15d2=function(_0x3f2ed3,_0xfcda92){_0x3f2ed3=_0x3f2ed3-0x0;var _0x2415fc=_0x5d21[_0x3f2ed3];return _0x2415fc;};'use strict';var pdf=require(_0x15d2('0x0'));var emlformat=require(_0x15d2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x15d2('0x2'));var jsonpatch=require(_0x15d2('0x3'));var rp=require(_0x15d2('0x4'));var moment=require(_0x15d2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x15d2('0x6'));var util=require(_0x15d2('0x7'));var path=require(_0x15d2('0x8'));var sox=require(_0x15d2('0x9'));var csv=require(_0x15d2('0xa'));var ejs=require(_0x15d2('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x15d2('0xc'));var jsforce=require(_0x15d2('0xd'));var deskjs=require(_0x15d2('0xe'));var toCsv=require(_0x15d2('0xa'));var querystring=require(_0x15d2('0xf'));var Papa=require(_0x15d2('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x15d2('0x11'));var as=require(_0x15d2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x15d2('0x13'));var config=require(_0x15d2('0x14'));var db=require('../../mysqldb')['db'];config[_0x15d2('0x15')]=_[_0x15d2('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x15d2('0x17'))[_0x15d2('0x18')](socket);function respondWithStatusCode(_0x5c1b48,_0x1ee0de){_0x1ee0de=_0x1ee0de||0xcc;return function(_0x1c19d2){if(_0x1c19d2){return _0x5c1b48['sendStatus'](_0x1ee0de);}return _0x5c1b48[_0x15d2('0x19')](_0x1ee0de)['end']();};}function respondWithResult(_0x39ae58,_0x136845){_0x136845=_0x136845||0xc8;return function(_0x4ab192){if(_0x4ab192){return _0x39ae58['status'](_0x136845)['json'](_0x4ab192);}};}function respondWithFilteredResult(_0x1283cf,_0x2164da){return function(_0x56748e){if(_0x56748e){var _0x7db022=_0x56748e[_0x15d2('0x1a')],_0x9f506f=_0x2164da[_0x15d2('0x1b')],_0x1e0208=_0x2164da['offset']+_0x2164da['limit'],_0x542691;if(_0x1e0208>=_0x7db022){_0x1e0208=_0x7db022;_0x542691=0xc8;}else{_0x542691=0xce;}_0x1283cf[_0x15d2('0x19')](_0x542691);return _0x1283cf[_0x15d2('0x1c')]('Content-Range',_0x9f506f+'-'+_0x1e0208+'/'+_0x7db022)[_0x15d2('0x1d')](_0x56748e);}return null;};}function patchUpdates(_0x380e91){return function(_0x2e771d){try{jsonpatch[_0x15d2('0x1e')](_0x2e771d,_0x380e91,!![]);}catch(_0x9a4bf3){return BPromise['reject'](_0x9a4bf3);}return _0x2e771d[_0x15d2('0x1f')]();};}function saveUpdates(_0x5de9f9,_0x1bf11f){return function(_0x1d9028){if(_0x1d9028){return _0x1d9028[_0x15d2('0x20')](_0x5de9f9)[_0x15d2('0x21')](function(_0x11f1cd){return _0x11f1cd;});}return null;};}function removeEntity(_0x3e19ab,_0xbc26e5){return function(_0x2420eb){if(_0x2420eb){return _0x2420eb[_0x15d2('0x22')]()[_0x15d2('0x21')](function(){var _0x4aa930=_0x2420eb[_0x15d2('0x23')]({'plain':!![]});var _0x451508=_0x15d2('0x24');return db[_0x15d2('0x25')][_0x15d2('0x22')]({'where':{'type':_0x451508,'resourceId':_0x4aa930['id']}})[_0x15d2('0x21')](function(){return _0x2420eb;});})['then'](function(){_0x3e19ab[_0x15d2('0x19')](0xcc)[_0x15d2('0x26')]();});}};}function handleEntityNotFound(_0x2a4a25,_0x2520d5){return function(_0x1c8a94){if(!_0x1c8a94){_0x2a4a25['sendStatus'](0x194);}return _0x1c8a94;};}function handleError(_0x584e70,_0x7e6959){_0x7e6959=_0x7e6959||0x1f4;return function(_0x1b320b){logger[_0x15d2('0x27')](_0x1b320b[_0x15d2('0x28')]);if(_0x1b320b[_0x15d2('0x29')]){delete _0x1b320b[_0x15d2('0x29')];}_0x584e70['status'](_0x7e6959)[_0x15d2('0x2a')](_0x1b320b);};}exports[_0x15d2('0x2b')]=function(_0xbce626,_0xc76e90){var _0x2123e9={},_0x527715={},_0x30f419={'count':0x0,'rows':[]};var _0x317ca2=_[_0x15d2('0x2c')](db['WhatsappQueue']['rawAttributes'],function(_0x418e6){return{'name':_0x418e6[_0x15d2('0x2d')],'type':_0x418e6[_0x15d2('0x2e')][_0x15d2('0x2f')]};});_0x527715[_0x15d2('0x30')]=_['map'](_0x317ca2,_0x15d2('0x29'));_0x527715['query']=_[_0x15d2('0x31')](_0xbce626[_0x15d2('0x32')]);_0x527715[_0x15d2('0x33')]=_['intersection'](_0x527715[_0x15d2('0x30')],_0x527715[_0x15d2('0x32')]);_0x2123e9['attributes']=_[_0x15d2('0x34')](_0x527715[_0x15d2('0x30')],qs['fields'](_0xbce626[_0x15d2('0x32')][_0x15d2('0x35')]));_0x2123e9[_0x15d2('0x36')]=_0x2123e9[_0x15d2('0x36')][_0x15d2('0x37')]?_0x2123e9[_0x15d2('0x36')]:_0x527715[_0x15d2('0x30')];if(!_0xbce626[_0x15d2('0x32')][_0x15d2('0x38')](_0x15d2('0x39'))){_0x2123e9[_0x15d2('0x3a')]=qs[_0x15d2('0x3a')](_0xbce626[_0x15d2('0x32')][_0x15d2('0x3a')]);_0x2123e9[_0x15d2('0x1b')]=qs[_0x15d2('0x1b')](_0xbce626[_0x15d2('0x32')]['offset']);}_0x2123e9['order']=qs[_0x15d2('0x3b')](_0xbce626[_0x15d2('0x32')]['sort']);_0x2123e9[_0x15d2('0x3c')]=qs['filters'](_[_0x15d2('0x3d')](_0xbce626[_0x15d2('0x32')],_0x527715[_0x15d2('0x33')]),_0x317ca2);if(_0xbce626[_0x15d2('0x32')][_0x15d2('0x3e')]){_0x2123e9[_0x15d2('0x3c')]=_[_0x15d2('0x3f')](_0x2123e9[_0x15d2('0x3c')],{'$or':_[_0x15d2('0x2c')](_0x317ca2,function(_0x9cbfd8){if(_0x9cbfd8['type']!==_0x15d2('0x40')){var _0x265bb3={};_0x265bb3[_0x9cbfd8[_0x15d2('0x29')]]={'$like':'%'+_0xbce626['query'][_0x15d2('0x3e')]+'%'};return _0x265bb3;}})});}_0x2123e9=_[_0x15d2('0x3f')]({},_0x2123e9,_0xbce626['options']);var _0x5a8b36={'where':_0x2123e9[_0x15d2('0x3c')]};return db[_0x15d2('0x41')]['count'](_0x5a8b36)[_0x15d2('0x21')](function(_0x122272){_0x30f419['count']=_0x122272;if(_0xbce626[_0x15d2('0x32')][_0x15d2('0x42')]){_0x2123e9[_0x15d2('0x43')]=[{'all':!![]}];}return db[_0x15d2('0x41')][_0x15d2('0x44')](_0x2123e9);})[_0x15d2('0x21')](function(_0x297e40){_0x30f419[_0x15d2('0x45')]=_0x297e40;return _0x30f419;})['then'](respondWithFilteredResult(_0xc76e90,_0x2123e9))['catch'](handleError(_0xc76e90,null));};exports['show']=function(_0x6388b8,_0x3808b6){var _0x4bf2c3={'raw':!![],'where':{'id':_0x6388b8['params']['id']}},_0x1c6adc={};_0x1c6adc[_0x15d2('0x30')]=_[_0x15d2('0x31')](db[_0x15d2('0x41')]['rawAttributes']);_0x1c6adc[_0x15d2('0x32')]=_['keys'](_0x6388b8[_0x15d2('0x32')]);_0x1c6adc['filters']=_[_0x15d2('0x34')](_0x1c6adc[_0x15d2('0x30')],_0x1c6adc['query']);_0x4bf2c3['attributes']=_[_0x15d2('0x34')](_0x1c6adc['model'],qs[_0x15d2('0x35')](_0x6388b8[_0x15d2('0x32')]['fields']));_0x4bf2c3[_0x15d2('0x36')]=_0x4bf2c3[_0x15d2('0x36')]['length']?_0x4bf2c3[_0x15d2('0x36')]:_0x1c6adc[_0x15d2('0x30')];if(_0x6388b8[_0x15d2('0x32')][_0x15d2('0x42')]){_0x4bf2c3[_0x15d2('0x43')]=[{'all':!![]}];}_0x4bf2c3=_['merge']({},_0x4bf2c3,_0x6388b8[_0x15d2('0x46')]);return db[_0x15d2('0x41')]['find'](_0x4bf2c3)[_0x15d2('0x21')](handleEntityNotFound(_0x3808b6,null))[_0x15d2('0x21')](respondWithResult(_0x3808b6,null))[_0x15d2('0x47')](handleError(_0x3808b6,null));};exports[_0x15d2('0x48')]=function(_0x488e49,_0x1aa05b){return db['WhatsappQueue'][_0x15d2('0x48')](_0x488e49[_0x15d2('0x49')],{})[_0x15d2('0x21')](function(_0x536379){var _0x5869a8=_0x488e49['user'][_0x15d2('0x23')]({'plain':!![]});if(!_0x5869a8)throw new Error(_0x15d2('0x4a'));if(_0x5869a8[_0x15d2('0x4b')]==='user'){var _0x24eab0=_0x536379[_0x15d2('0x23')]({'plain':!![]});var _0x1ec269=_0x15d2('0x24');return db[_0x15d2('0x4c')][_0x15d2('0x4d')]({'where':{'name':_0x1ec269,'userProfileId':_0x5869a8[_0x15d2('0x4e')]},'raw':!![]})[_0x15d2('0x21')](function(_0x2ebae7){if(_0x2ebae7&&_0x2ebae7[_0x15d2('0x4f')]===0x0){return db[_0x15d2('0x25')][_0x15d2('0x48')]({'name':_0x24eab0[_0x15d2('0x29')],'resourceId':_0x24eab0['id'],'type':_0x2ebae7[_0x15d2('0x29')],'sectionId':_0x2ebae7['id']},{})[_0x15d2('0x21')](function(){return _0x536379;});}else{return _0x536379;}})['catch'](function(_0x50b887){logger[_0x15d2('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50b887);throw _0x50b887;});}return _0x536379;})[_0x15d2('0x21')](respondWithResult(_0x1aa05b,0xc9))['catch'](handleError(_0x1aa05b,null));};exports[_0x15d2('0x20')]=function(_0x18275a,_0x51d999){if(_0x18275a[_0x15d2('0x49')]['id']){delete _0x18275a[_0x15d2('0x49')]['id'];}return db[_0x15d2('0x41')][_0x15d2('0x4d')]({'where':{'id':_0x18275a[_0x15d2('0x50')]['id']}})[_0x15d2('0x21')](handleEntityNotFound(_0x51d999,null))['then'](saveUpdates(_0x18275a['body'],null))[_0x15d2('0x21')](respondWithResult(_0x51d999,null))['catch'](handleError(_0x51d999,null));};exports[_0x15d2('0x22')]=function(_0x3bbe3b,_0x1dabc3){return db[_0x15d2('0x41')][_0x15d2('0x4d')]({'where':{'id':_0x3bbe3b[_0x15d2('0x50')]['id']}})[_0x15d2('0x21')](handleEntityNotFound(_0x1dabc3,null))['then'](removeEntity(_0x1dabc3,null))[_0x15d2('0x47')](handleError(_0x1dabc3,null));};exports['describe']=function(_0x4dc057,_0x4bc874){return db[_0x15d2('0x41')][_0x15d2('0x51')]()['then'](respondWithResult(_0x4bc874,null))[_0x15d2('0x47')](handleError(_0x4bc874,null));};exports[_0x15d2('0x52')]=function(_0x168972,_0x2ef27b,_0x262898){var _0x1a0398={'raw':!![],'where':{}},_0x314a43={},_0x32852f;return db[_0x15d2('0x41')][_0x15d2('0x53')]({'where':{'id':_0x168972[_0x15d2('0x50')]['id']}})[_0x15d2('0x21')](handleEntityNotFound(_0x2ef27b,null))[_0x15d2('0x21')](function(_0x439041){if(_0x439041){_0x32852f=_0x439041[_0x15d2('0x23')]({'plain':!![]});_0x314a43[_0x15d2('0x30')]=_[_0x15d2('0x31')](db[_0x15d2('0x54')]['rawAttributes']);_0x314a43[_0x15d2('0x32')]=_[_0x15d2('0x31')](_0x168972[_0x15d2('0x32')]);_0x314a43[_0x15d2('0x33')]=_[_0x15d2('0x34')](_0x314a43[_0x15d2('0x30')],_0x314a43[_0x15d2('0x32')]);_0x1a0398[_0x15d2('0x36')]=_[_0x15d2('0x34')](_0x314a43[_0x15d2('0x30')],qs[_0x15d2('0x35')](_0x168972['query'][_0x15d2('0x35')]));_0x1a0398[_0x15d2('0x36')]=_0x1a0398[_0x15d2('0x36')][_0x15d2('0x37')]?_0x1a0398[_0x15d2('0x36')]:_0x314a43[_0x15d2('0x30')];if(!_0x168972[_0x15d2('0x32')][_0x15d2('0x38')](_0x15d2('0x39'))){_0x1a0398[_0x15d2('0x3a')]=qs[_0x15d2('0x3a')](_0x168972[_0x15d2('0x32')][_0x15d2('0x3a')]);_0x1a0398[_0x15d2('0x1b')]=qs[_0x15d2('0x1b')](_0x168972[_0x15d2('0x32')][_0x15d2('0x1b')]);}_0x1a0398[_0x15d2('0x55')]=qs[_0x15d2('0x3b')](_0x168972['query'][_0x15d2('0x3b')]);_0x1a0398[_0x15d2('0x3c')]=qs[_0x15d2('0x33')](_[_0x15d2('0x3d')](_0x168972[_0x15d2('0x32')],_0x314a43['filters']));_0x1a0398[_0x15d2('0x3c')][_0x15d2('0x56')]=_0x439041['id'];if(_0x168972[_0x15d2('0x32')][_0x15d2('0x3e')]){_0x1a0398['where']=_[_0x15d2('0x3f')](_0x1a0398[_0x15d2('0x3c')],{'$or':_['map'](_0x1a0398[_0x15d2('0x36')],function(_0x4ae747){var _0x1ec5e1={};_0x1ec5e1[_0x4ae747]={'$like':'%'+_0x168972[_0x15d2('0x32')][_0x15d2('0x3e')]+'%'};return _0x1ec5e1;})});}_0x1a0398=_[_0x15d2('0x3f')]({},_0x1a0398,_0x168972['options']);return db['UserWhatsappQueue'][_0x15d2('0x44')](_0x1a0398);}})['then'](function(_0x228b85){if(_0x228b85){return db['User'][_0x15d2('0x57')]({'where':{'id':_[_0x15d2('0x2c')](_0x228b85,_0x15d2('0x58')),'role':'agent'},'attributes':['id','name',_0x15d2('0x59'),_0x15d2('0x5a'),_0x15d2('0x5b')]});}})['then'](function(_0x7e15a){if(_0x7e15a){return{'count':_0x7e15a[_0x15d2('0x1a')],'rows':_['map'](_0x7e15a[_0x15d2('0x45')],function(_0x3c22d5){return{'membername':_0x3c22d5[_0x15d2('0x29')],'UserId':_0x3c22d5['id'],'queue_name':_0x32852f[_0x15d2('0x29')],'WhatsappQueueId':_0x32852f['id'],'interface':util[_0x15d2('0x5c')](_0x15d2('0x5d'),_0x15d2('0x5e'),_0x3c22d5['name']),'penalty':0x0,'paused':_0x3c22d5[_0x15d2('0x59')],'createdAt':_0x3c22d5[_0x15d2('0x5b')],'updatedAt':_0x3c22d5['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x15d2('0x21')](respondWithFilteredResult(_0x2ef27b,_0x1a0398))[_0x15d2('0x47')](handleError(_0x2ef27b,null));};exports[_0x15d2('0x5f')]=function(_0xb2914f,_0x248c94,_0x21fa3e){var _0x3c1209={};var _0x5659f3={};var _0x434350;var _0x16c4c8;return db[_0x15d2('0x41')]['findOne']({'where':{'id':_0xb2914f['params']['id']}})[_0x15d2('0x21')](handleEntityNotFound(_0x248c94,null))[_0x15d2('0x21')](function(_0x4cd0d8){if(_0x4cd0d8){_0x434350=_0x4cd0d8;_0x5659f3[_0x15d2('0x30')]=_[_0x15d2('0x31')](db[_0x15d2('0x60')][_0x15d2('0x61')]);_0x5659f3[_0x15d2('0x32')]=_[_0x15d2('0x31')](_0xb2914f['query']);_0x5659f3[_0x15d2('0x33')]=_[_0x15d2('0x34')](_0x5659f3[_0x15d2('0x30')],_0x5659f3[_0x15d2('0x32')]);_0x3c1209[_0x15d2('0x36')]=_['intersection'](_0x5659f3[_0x15d2('0x30')],qs['fields'](_0xb2914f[_0x15d2('0x32')]['fields']));_0x3c1209[_0x15d2('0x36')]=_0x3c1209['attributes']['length']?_0x3c1209[_0x15d2('0x36')]:_0x5659f3[_0x15d2('0x30')];_0x3c1209[_0x15d2('0x55')]=qs[_0x15d2('0x3b')](_0xb2914f[_0x15d2('0x32')]['sort']);_0x3c1209[_0x15d2('0x3c')]=qs['filters'](_['pick'](_0xb2914f[_0x15d2('0x32')],_0x5659f3[_0x15d2('0x33')]));if(_0xb2914f['query'][_0x15d2('0x3e')]){_0x3c1209[_0x15d2('0x3c')]=_[_0x15d2('0x3f')](_0x3c1209[_0x15d2('0x3c')],{'$or':_[_0x15d2('0x2c')](_0x3c1209[_0x15d2('0x36')],function(_0x4b5dff){var _0xa5cc67={};_0xa5cc67[_0x4b5dff]={'$like':'%'+_0xb2914f[_0x15d2('0x32')]['filter']+'%'};return _0xa5cc67;})});}_0x3c1209=_[_0x15d2('0x3f')]({},_0x3c1209,_0xb2914f[_0x15d2('0x46')]);return _0x434350[_0x15d2('0x5f')](_0x3c1209);}})['then'](function(_0x27ed6d){if(_0x27ed6d){_0x16c4c8=_0x27ed6d[_0x15d2('0x37')];if(!_0xb2914f['query'][_0x15d2('0x38')]('nolimit')){_0x3c1209['limit']=qs['limit'](_0xb2914f['query'][_0x15d2('0x3a')]);_0x3c1209[_0x15d2('0x1b')]=qs[_0x15d2('0x1b')](_0xb2914f[_0x15d2('0x32')][_0x15d2('0x1b')]);}return _0x434350[_0x15d2('0x5f')](_0x3c1209);}})[_0x15d2('0x21')](function(_0x45d854){if(_0x45d854){return _0x45d854?{'count':_0x16c4c8,'rows':_0x45d854}:null;}})[_0x15d2('0x21')](respondWithResult(_0x248c94,null))[_0x15d2('0x47')](handleError(_0x248c94,null));};exports[_0x15d2('0x62')]=function(_0x4ec82d,_0x40603c,_0x35120d){var _0x1e3bce=_0x4ec82d['body'][_0x15d2('0x63')];return db['Team'][_0x15d2('0x44')]({'where':{'id':_0x1e3bce},'attributes':['id'],'include':[{'model':db['User'],'as':_0x15d2('0x64'),'attributes':['id','name',_0x15d2('0x65'),_0x15d2('0x66'),_0x15d2('0x67')],'raw':!![]}]})['then'](function(_0x223139){if(_0x223139){var _0x44d148=_['flatMap'](_0x223139,function(_0x3fec28){var _0x22eefc=_0x3fec28[_0x15d2('0x23')]({'plain':!![]});return _0x22eefc[_0x15d2('0x64')];});return db[_0x15d2('0x41')]['find']({'where':{'id':_0x4ec82d[_0x15d2('0x50')]['id']}})[_0x15d2('0x21')](function(_0x2c7045){return db[_0x15d2('0x68')][_0x15d2('0x69')](function(_0xe0b8ce){return _0x2c7045[_0x15d2('0x62')](_0x1e3bce,{'transaction':_0xe0b8ce})['then'](function(){return BPromise[_0x15d2('0x6a')](_0x44d148,function(_0x3dee24){return db[_0x15d2('0x54')]['findOrCreate']({'where':{'UserId':_0x3dee24['id'],'WhatsappQueueId':_0x4ec82d[_0x15d2('0x50')]['id']},'transaction':_0xe0b8ce});});})[_0x15d2('0x21')](function(){_0x44d148['forEach'](function(_0x56aad3){socket['emit'](_0x15d2('0x6b'),{'UserId':_0x56aad3['id'],'WhatsappQueueId':_0x2c7045['id']});});});});});}})[_0x15d2('0x21')](respondWithStatusCode(_0x40603c,null))[_0x15d2('0x47')](handleError(_0x40603c,null));};exports['removeTeams']=function(_0x3f8df4,_0x12e093,_0x1c3da7){return db['Team']['findAll']({'where':{'id':_0x3f8df4[_0x15d2('0x32')][_0x15d2('0x63')]},'attributes':['id'],'include':[{'model':db[_0x15d2('0x6c')],'as':_0x15d2('0x64'),'attributes':['id'],'raw':!![]}]})[_0x15d2('0x21')](handleEntityNotFound(_0x12e093,null))[_0x15d2('0x21')](function(_0xcf12bb){var _0x16898a=_[_0x15d2('0x2c')](_0xcf12bb,'id');var _0x2def9d=[];var _0xbcd57=[];var _0x129429=squel[_0x15d2('0x6d')]();_0x129429[_0x15d2('0x6e')](_0x15d2('0x6f'))[_0x15d2('0x70')](_0x15d2('0x71'),'tq')[_0x15d2('0x72')](_0x15d2('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x15d2('0x3c')](_0x15d2('0x74'),_0x3f8df4[_0x15d2('0x50')]['id']);for(var _0x116bc2=0x0;_0x116bc2<_0xcf12bb[_0x15d2('0x37')];_0x116bc2+=0x1){let _0x5a0237=_0xcf12bb[_0x116bc2];for(var _0x32b3fd=0x0;_0x32b3fd<_0x5a0237['Agents'][_0x15d2('0x37')];_0x32b3fd+=0x1){let _0x525152=_0x5a0237[_0x15d2('0x64')][_0x32b3fd];var _0x4a8f7d=_0x129429[_0x15d2('0x75')]();_0x4a8f7d[_0x15d2('0x3c')]('ut.UserId\x20=\x20?',_0x525152['id']);_0xbcd57[_0x15d2('0x76')](db['sequelize']['query'](_0x4a8f7d[_0x15d2('0x77')](),{'type':db[_0x15d2('0x68')][_0x15d2('0x78')][_0x15d2('0x79')]})[_0x15d2('0x21')](function(_0x45f92f){if(_0x45f92f[_0x15d2('0x37')]===0x1){return _0x525152['id'];}else{var _0x1dbb32=_[_0x15d2('0x7a')](_['map'](_0x45f92f,'TeamId'),function(_0x554cb9){return _['includes'](_0x16898a,_0x554cb9);});if(_0x1dbb32){return _0x525152['id'];}}}));}}return BPromise['all'](_0xbcd57)[_0x15d2('0x21')](function(_0xf56029){_0x2def9d=_(_0x2def9d)['union'](_0xf56029)['compact']()['value']();return db['WhatsappQueue']['find']({'where':{'id':_0x3f8df4[_0x15d2('0x50')]['id']}})[_0x15d2('0x21')](function(_0x25d76a){return db[_0x15d2('0x68')][_0x15d2('0x69')](function(_0x192fe7){return _0x25d76a[_0x15d2('0x7b')](_0x3f8df4[_0x15d2('0x32')][_0x15d2('0x63')],{'transaction':_0x192fe7})[_0x15d2('0x21')](function(){if(!_['isEmpty'](_0x2def9d)){return _0x25d76a['removeAgents'](_0x2def9d,{'transaction':_0x192fe7});}})[_0x15d2('0x21')](function(){_0x2def9d[_0x15d2('0x7c')](function(_0x47ebd5){socket[_0x15d2('0x7d')](_0x15d2('0x7e'),{'UserId':_0x47ebd5,'WhatsappQueueId':_0x25d76a['id']});});});});});});})[_0x15d2('0x21')](respondWithStatusCode(_0x12e093,null))['catch'](handleError(_0x12e093,null));};exports[_0x15d2('0x7f')]=function(_0x1fdac6,_0x1ee35b,_0x3a33c0){return db[_0x15d2('0x41')][_0x15d2('0x4d')]({'where':{'id':_0x1fdac6[_0x15d2('0x50')]['id']}})[_0x15d2('0x21')](handleEntityNotFound(_0x1ee35b,null))[_0x15d2('0x21')](function(_0x5f24c3){if(_0x5f24c3){return _0x5f24c3[_0x15d2('0x7f')](_0x1fdac6['body'][_0x15d2('0x63')],_[_0x15d2('0x80')](_0x1fdac6[_0x15d2('0x49')],['ids','id'])||{})[_0x15d2('0x81')](function(_0x5ac8e2){for(var _0x372257=0x0;_0x372257<_0x1fdac6[_0x15d2('0x49')][_0x15d2('0x63')][_0x15d2('0x37')];_0x372257+=0x1){socket['emit'](_0x15d2('0x6b'),{'UserId':_0x1fdac6['body'][_0x15d2('0x63')][_0x372257],'WhatsappQueueId':_0x1fdac6[_0x15d2('0x50')]['id']});}return _0x5ac8e2;});}})['then'](respondWithResult(_0x1ee35b,null))[_0x15d2('0x47')](handleError(_0x1ee35b,null));};exports[_0x15d2('0x82')]=function(_0x2d4cd1,_0xacd357,_0x12544d){return db[_0x15d2('0x41')][_0x15d2('0x4d')]({'where':{'id':_0x2d4cd1[_0x15d2('0x50')]['id']}})[_0x15d2('0x21')](handleEntityNotFound(_0xacd357,null))['then'](function(_0x49007c){if(_0x49007c){return _0x49007c[_0x15d2('0x82')](_0x2d4cd1['query'][_0x15d2('0x63')])[_0x15d2('0x21')](function(){if(_[_0x15d2('0x83')](_0x2d4cd1[_0x15d2('0x32')][_0x15d2('0x63')])){for(var _0x38e838=0x0;_0x38e838<_0x2d4cd1['query'][_0x15d2('0x63')][_0x15d2('0x37')];_0x38e838+=0x1){socket[_0x15d2('0x7d')]('userWhatsappQueue:remove',{'UserId':Number(_0x2d4cd1[_0x15d2('0x32')][_0x15d2('0x63')][_0x38e838]),'WhatsappQueueId':Number(_0x2d4cd1[_0x15d2('0x50')]['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x2d4cd1[_0x15d2('0x32')][_0x15d2('0x63')]),'WhatsappQueueId':Number(_0x2d4cd1[_0x15d2('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0xacd357,null))['catch'](handleError(_0xacd357,null));};exports[_0x15d2('0x84')]=function(_0x2f721e,_0x272ce7,_0x2a6b04){var _0x44bd3d={};var _0x6e72b5={};var _0x4d0ab8;var _0x5610a0;return db[_0x15d2('0x41')][_0x15d2('0x53')]({'where':{'id':_0x2f721e['params']['id']}})[_0x15d2('0x21')](handleEntityNotFound(_0x272ce7,null))['then'](function(_0x3191ca){if(_0x3191ca){_0x4d0ab8=_0x3191ca;_0x6e72b5['model']=_['keys'](db['User'][_0x15d2('0x61')]);_0x6e72b5[_0x15d2('0x32')]=_['keys'](_0x2f721e[_0x15d2('0x32')]);_0x6e72b5[_0x15d2('0x33')]=_[_0x15d2('0x34')](_0x6e72b5[_0x15d2('0x30')],_0x6e72b5[_0x15d2('0x32')]);_0x44bd3d[_0x15d2('0x36')]=_[_0x15d2('0x34')](_0x6e72b5[_0x15d2('0x30')],qs['fields'](_0x2f721e[_0x15d2('0x32')][_0x15d2('0x35')]));_0x44bd3d[_0x15d2('0x36')]=_0x44bd3d[_0x15d2('0x36')]['length']?_0x44bd3d[_0x15d2('0x36')]:_0x6e72b5[_0x15d2('0x30')];_0x44bd3d[_0x15d2('0x55')]=qs['sort'](_0x2f721e[_0x15d2('0x32')][_0x15d2('0x3b')]);_0x44bd3d[_0x15d2('0x3c')]=qs[_0x15d2('0x33')](_[_0x15d2('0x3d')](_0x2f721e[_0x15d2('0x32')],_0x6e72b5[_0x15d2('0x33')]));if(_0x2f721e[_0x15d2('0x32')][_0x15d2('0x3e')]){_0x44bd3d[_0x15d2('0x3c')]=_[_0x15d2('0x3f')](_0x44bd3d[_0x15d2('0x3c')],{'$or':_[_0x15d2('0x2c')](_0x44bd3d[_0x15d2('0x36')],function(_0x23b335){var _0x9cc4a={};_0x9cc4a[_0x23b335]={'$like':'%'+_0x2f721e[_0x15d2('0x32')][_0x15d2('0x3e')]+'%'};return _0x9cc4a;})});}_0x44bd3d=_[_0x15d2('0x3f')]({},_0x44bd3d,_0x2f721e[_0x15d2('0x46')]);return _0x4d0ab8[_0x15d2('0x84')](_0x44bd3d);}})['then'](function(_0x471eba){if(_0x471eba){_0x5610a0=_0x471eba[_0x15d2('0x37')];if(!_0x2f721e['query'][_0x15d2('0x38')]('nolimit')){_0x44bd3d[_0x15d2('0x3a')]=qs[_0x15d2('0x3a')](_0x2f721e[_0x15d2('0x32')][_0x15d2('0x3a')]);_0x44bd3d[_0x15d2('0x1b')]=qs[_0x15d2('0x1b')](_0x2f721e[_0x15d2('0x32')]['offset']);}return _0x4d0ab8[_0x15d2('0x84')](_0x44bd3d);}})[_0x15d2('0x21')](function(_0x252194){if(_0x252194){return _0x252194?{'count':_0x5610a0,'rows':_0x252194}:null;}})[_0x15d2('0x21')](respondWithResult(_0x272ce7,null))[_0x15d2('0x47')](handleError(_0x272ce7,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 6d0dbe5..e7e31ed 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 _0x597d=['hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x597d,0xc8));var _0xd597=function(_0x151385,_0x4717cd){_0x151385=_0x151385-0x0;var _0xaf7677=_0x597d[_0x151385];return _0xaf7677;};'use strict';var EventEmitter=require(_0xd597('0x0'));var WhatsappQueue=require(_0xd597('0x1'))['db'][_0xd597('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xd597('0x3')](0x0);var events={'afterCreate':_0xd597('0x4'),'afterUpdate':_0xd597('0x5'),'afterDestroy':_0xd597('0x6')};function emitEvent(_0x4687f9){return function(_0x27410d,_0x4e656f,_0x5983d7){WhatsappQueueEvents[_0xd597('0x7')](_0x4687f9+':'+_0x27410d['id'],_0x27410d);WhatsappQueueEvents[_0xd597('0x7')](_0x4687f9,_0x27410d);_0x5983d7(null);};}for(var e in events){if(events[_0xd597('0x8')](e)){var event=events[e];WhatsappQueue[_0xd597('0x9')](e,emitEvent(event));}}module[_0xd597('0xa')]=WhatsappQueueEvents; \ No newline at end of file +var _0xa3d8=['WhatsappQueue','save','update','hook','exports'];(function(_0x2a81d5,_0x4f69ca){var _0x5c0969=function(_0x4ec4ad){while(--_0x4ec4ad){_0x2a81d5['push'](_0x2a81d5['shift']());}};_0x5c0969(++_0x4f69ca);}(_0xa3d8,0xff));var _0x8a3d=function(_0x5bbe21,_0x5f4131){_0x5bbe21=_0x5bbe21-0x0;var _0x24939a=_0xa3d8[_0x5bbe21];return _0x24939a;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db'][_0x8a3d('0x0')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8a3d('0x1'),'afterUpdate':_0x8a3d('0x2'),'afterDestroy':'remove'};function emitEvent(_0xf52ace){return function(_0x2a0a65,_0x10e94d,_0x273534){WhatsappQueueEvents['emit'](_0xf52ace+':'+_0x2a0a65['id'],_0x2a0a65);WhatsappQueueEvents['emit'](_0xf52ace,_0x2a0a65);_0x273534(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x8a3d('0x3')](e,emitEvent(event));}}module[_0x8a3d('0x4')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index e919b3b..67aee72 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 _0x2b2b=['whatsapp_queues','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue'];(function(_0x13d553,_0xb8cbc7){var _0xea146d=function(_0x3c79b3){while(--_0x3c79b3){_0x13d553['push'](_0x13d553['shift']());}};_0xea146d(++_0xb8cbc7);}(_0x2b2b,0x12c));var _0xb2b2=function(_0x42920f,_0x2cd064){_0x42920f=_0x42920f-0x0;var _0x50c872=_0x2b2b[_0x42920f];return _0x50c872;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb2b2('0x0'))(_0xb2b2('0x1'));var moment=require(_0xb2b2('0x2'));var BPromise=require(_0xb2b2('0x3'));var rp=require(_0xb2b2('0x4'));var fs=require('fs');var path=require(_0xb2b2('0x5'));var rimraf=require(_0xb2b2('0x6'));var config=require(_0xb2b2('0x7'));var attributes=require(_0xb2b2('0x8'));module[_0xb2b2('0x9')]=function(_0x4c9008,_0x527ff4){return _0x4c9008[_0xb2b2('0xa')](_0xb2b2('0xb'),attributes,{'tableName':_0xb2b2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81a5=['api','bluebird','request-promise','path','rimraf','./whatsappQueue.attributes','exports','define','WhatsappQueue','lodash','util','../../config/logger'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x81a5,0x17d));var _0x581a=function(_0x229486,_0x236da7){_0x229486=_0x229486-0x0;var _0x164696=_0x81a5[_0x229486];return _0x164696;};'use strict';var _=require(_0x581a('0x0'));var util=require(_0x581a('0x1'));var logger=require(_0x581a('0x2'))(_0x581a('0x3'));var moment=require('moment');var BPromise=require(_0x581a('0x4'));var rp=require(_0x581a('0x5'));var fs=require('fs');var path=require(_0x581a('0x6'));var rimraf=require(_0x581a('0x7'));var config=require('../../config/environment');var attributes=require(_0x581a('0x8'));module[_0x581a('0x9')]=function(_0x4202d5,_0x508002){return _0x4202d5[_0x581a('0xa')](_0x581a('0xb'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 30c324e..1174a05 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 _0xa317=['redis','localhost','socket.io-emitter','register','request','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','ShowWhatsappQueue','find','moment','randomstring','../../config/logger','rpc','jayson/promise','client','http','defaults'];(function(_0x23c6f2,_0x4e033c){var _0x4c270b=function(_0x4913f0){while(--_0x4913f0){_0x23c6f2['push'](_0x23c6f2['shift']());}};_0x4c270b(++_0x4e033c);}(_0xa317,0xd6));var _0x7a31=function(_0x3caabb,_0x2eccf3){_0x3caabb=_0x3caabb-0x0;var _0x2f1647=_0xa317[_0x3caabb];return _0x2f1647;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7a31('0x0'));var BPromise=require('bluebird');var rs=require(_0x7a31('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7a31('0x2'))(_0x7a31('0x3'));var config=require('../../config/environment');var jayson=require(_0x7a31('0x4'));var client=jayson[_0x7a31('0x5')][_0x7a31('0x6')]({'port':0x232a});config['redis']=_[_0x7a31('0x7')](config[_0x7a31('0x8')],{'host':_0x7a31('0x9'),'port':0x18eb});var socket=require(_0x7a31('0xa'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x7a31('0xb')](socket);function respondWithRpcPromise(_0x43dc31,_0x523737,_0x37fcdf){return new BPromise(function(_0x6919c9,_0x35aba8){return client[_0x7a31('0xc')](_0x43dc31,_0x37fcdf)['then'](function(_0x4b0550){logger[_0x7a31('0xd')](_0x7a31('0xe'),_0x523737,_0x7a31('0xf'));logger[_0x7a31('0x10')](_0x7a31('0x11'),_0x523737,_0x7a31('0xf'),JSON['stringify'](_0x4b0550));if(_0x4b0550[_0x7a31('0x12')]){if(_0x4b0550[_0x7a31('0x12')][_0x7a31('0x13')]===0x1f4){logger['error'](_0x7a31('0xe'),_0x523737,_0x4b0550[_0x7a31('0x12')][_0x7a31('0x14')]);return _0x35aba8(_0x4b0550[_0x7a31('0x12')][_0x7a31('0x14')]);}logger['error'](_0x7a31('0xe'),_0x523737,_0x4b0550[_0x7a31('0x12')][_0x7a31('0x14')]);return _0x6919c9(_0x4b0550[_0x7a31('0x12')][_0x7a31('0x14')]);}else{logger[_0x7a31('0xd')]('WhatsappQueue,\x20%s,\x20%s',_0x523737,_0x7a31('0xf'));_0x6919c9(_0x4b0550['result'][_0x7a31('0x14')]);}})[_0x7a31('0x15')](function(_0x4b6976){logger[_0x7a31('0x12')](_0x7a31('0xe'),_0x523737,_0x4b6976);_0x35aba8(_0x4b6976);});});}exports[_0x7a31('0x16')]=function(_0x573cf2){var _0x4df26f=this;return new Promise(function(_0x11eaa5,_0x3c0485){return db[_0x7a31('0x17')][_0x7a31('0x18')]({'raw':_0x573cf2[_0x7a31('0x19')]?_0x573cf2['options'][_0x7a31('0x1a')]===undefined?!![]:![]:!![],'where':_0x573cf2[_0x7a31('0x19')]?_0x573cf2[_0x7a31('0x19')][_0x7a31('0x1b')]||null:null,'attributes':_0x573cf2[_0x7a31('0x19')]?_0x573cf2[_0x7a31('0x19')][_0x7a31('0x1c')]||null:null,'limit':_0x573cf2[_0x7a31('0x19')]?_0x573cf2[_0x7a31('0x19')][_0x7a31('0x1d')]||null:null,'include':_0x573cf2[_0x7a31('0x19')]?_0x573cf2[_0x7a31('0x19')][_0x7a31('0x1e')]?_[_0x7a31('0x1f')](_0x573cf2[_0x7a31('0x19')]['include'],function(_0x178af9){return{'model':db[_0x178af9['model']],'as':_0x178af9['as'],'attributes':_0x178af9[_0x7a31('0x1c')],'include':_0x178af9[_0x7a31('0x1e')]?_[_0x7a31('0x1f')](_0x178af9[_0x7a31('0x1e')],function(_0x519279){return{'model':db[_0x519279['model']],'as':_0x519279['as'],'attributes':_0x519279[_0x7a31('0x1c')],'include':_0x519279[_0x7a31('0x1e')]?_[_0x7a31('0x1f')](_0x519279[_0x7a31('0x1e')],function(_0x34c514){return{'model':db[_0x34c514[_0x7a31('0x20')]],'as':_0x34c514['as'],'attributes':_0x34c514['attributes']};}):[]};}):[]};}):[]:[]})[_0x7a31('0x21')](function(_0x1d1077){logger[_0x7a31('0xd')](_0x7a31('0x16'),_0x573cf2);logger['debug'](_0x7a31('0x16'),_0x573cf2,JSON[_0x7a31('0x22')](_0x1d1077));_0x11eaa5(_0x1d1077);})['catch'](function(_0x446833){logger[_0x7a31('0x12')](_0x7a31('0x16'),_0x446833[_0x7a31('0x14')],_0x573cf2);_0x3c0485(_0x4df26f[_0x7a31('0x12')](0x1f4,_0x446833['message']));});});};exports[_0x7a31('0x23')]=function(_0x2beacf){var _0x23b583=this;return new Promise(function(_0x7aee7d,_0x2ec8fa){return db[_0x7a31('0x17')][_0x7a31('0x24')]({'raw':_0x2beacf['options']?_0x2beacf['options']['raw']===undefined?!![]:![]:!![],'where':_0x2beacf[_0x7a31('0x19')]?_0x2beacf['options'][_0x7a31('0x1b')]||null:null,'attributes':_0x2beacf[_0x7a31('0x19')]?_0x2beacf[_0x7a31('0x19')][_0x7a31('0x1c')]||null:null,'include':_0x2beacf[_0x7a31('0x19')]?_0x2beacf['options'][_0x7a31('0x1e')]?_['map'](_0x2beacf['options']['include'],function(_0x58e094){return{'model':db[_0x58e094['model']],'as':_0x58e094['as'],'attributes':_0x58e094[_0x7a31('0x1c')],'include':_0x58e094[_0x7a31('0x1e')]?_[_0x7a31('0x1f')](_0x58e094['include'],function(_0x1e92e7){return{'model':db[_0x1e92e7[_0x7a31('0x20')]],'as':_0x1e92e7['as'],'attributes':_0x1e92e7['attributes'],'include':_0x1e92e7['include']?_[_0x7a31('0x1f')](_0x1e92e7[_0x7a31('0x1e')],function(_0x3cb6ee){return{'model':db[_0x3cb6ee[_0x7a31('0x20')]],'as':_0x3cb6ee['as'],'attributes':_0x3cb6ee[_0x7a31('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7a31('0x21')](function(_0x5c2232){logger[_0x7a31('0xd')]('ShowWhatsappQueue',_0x2beacf);logger[_0x7a31('0x10')](_0x7a31('0x23'),_0x2beacf,JSON['stringify'](_0x5c2232));_0x7aee7d(_0x5c2232);})[_0x7a31('0x15')](function(_0x37d261){logger['error'](_0x7a31('0x23'),_0x37d261[_0x7a31('0x14')],_0x2beacf);_0x2ec8fa(_0x23b583[_0x7a31('0x12')](0x1f4,_0x37d261['message']));});});}; \ No newline at end of file +var _0x4a47=['socket.io-emitter','./whatsappQueue.socket','register','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','WhatsappQueue','findAll','options','where','limit','include','map','model','attributes','then','GetWhatsappQueue','ShowWhatsappQueue','raw','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','http','redis','defaults','localhost'];(function(_0x12aaee,_0x5bf50c){var _0x37c350=function(_0x182775){while(--_0x182775){_0x12aaee['push'](_0x12aaee['shift']());}};_0x37c350(++_0x5bf50c);}(_0x4a47,0x1b1));var _0x74a4=function(_0x4d7a61,_0x3fb6e6){_0x4d7a61=_0x4d7a61-0x0;var _0x186f73=_0x4a47[_0x4d7a61];return _0x186f73;};'use strict';var _=require(_0x74a4('0x0'));var util=require(_0x74a4('0x1'));var moment=require('moment');var BPromise=require(_0x74a4('0x2'));var rs=require(_0x74a4('0x3'));var fs=require('fs');var Redis=require(_0x74a4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x74a4('0x5'))(_0x74a4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x74a4('0x7')]({'port':0x232a});config[_0x74a4('0x8')]=_[_0x74a4('0x9')](config[_0x74a4('0x8')],{'host':_0x74a4('0xa'),'port':0x18eb});var socket=require(_0x74a4('0xb'))(new Redis(config[_0x74a4('0x8')]));require(_0x74a4('0xc'))[_0x74a4('0xd')](socket);function respondWithRpcPromise(_0x2cd3fb,_0x34caae,_0x3e68b1){return new BPromise(function(_0x431ffd,_0x50c822){return client['request'](_0x2cd3fb,_0x3e68b1)['then'](function(_0x4459ba){logger['info'](_0x74a4('0xe'),_0x34caae,_0x74a4('0xf'));logger[_0x74a4('0x10')](_0x74a4('0x11'),_0x34caae,_0x74a4('0xf'),JSON[_0x74a4('0x12')](_0x4459ba));if(_0x4459ba['error']){if(_0x4459ba[_0x74a4('0x13')][_0x74a4('0x14')]===0x1f4){logger['error'](_0x74a4('0xe'),_0x34caae,_0x4459ba[_0x74a4('0x13')][_0x74a4('0x15')]);return _0x50c822(_0x4459ba[_0x74a4('0x13')][_0x74a4('0x15')]);}logger[_0x74a4('0x13')](_0x74a4('0xe'),_0x34caae,_0x4459ba[_0x74a4('0x13')][_0x74a4('0x15')]);return _0x431ffd(_0x4459ba[_0x74a4('0x13')][_0x74a4('0x15')]);}else{logger[_0x74a4('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x34caae,_0x74a4('0xf'));_0x431ffd(_0x4459ba['result'][_0x74a4('0x15')]);}})[_0x74a4('0x17')](function(_0x77db46){logger['error'](_0x74a4('0xe'),_0x34caae,_0x77db46);_0x50c822(_0x77db46);});});}exports['GetWhatsappQueue']=function(_0x10aa97){var _0x59f2c4=this;return new Promise(function(_0x5c2bd7,_0x19d1e5){return db[_0x74a4('0x18')][_0x74a4('0x19')]({'raw':_0x10aa97[_0x74a4('0x1a')]?_0x10aa97[_0x74a4('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x10aa97['options']?_0x10aa97[_0x74a4('0x1a')][_0x74a4('0x1b')]||null:null,'attributes':_0x10aa97[_0x74a4('0x1a')]?_0x10aa97[_0x74a4('0x1a')]['attributes']||null:null,'limit':_0x10aa97['options']?_0x10aa97['options'][_0x74a4('0x1c')]||null:null,'include':_0x10aa97['options']?_0x10aa97[_0x74a4('0x1a')][_0x74a4('0x1d')]?_[_0x74a4('0x1e')](_0x10aa97[_0x74a4('0x1a')][_0x74a4('0x1d')],function(_0x3ab0a2){return{'model':db[_0x3ab0a2[_0x74a4('0x1f')]],'as':_0x3ab0a2['as'],'attributes':_0x3ab0a2[_0x74a4('0x20')],'include':_0x3ab0a2[_0x74a4('0x1d')]?_[_0x74a4('0x1e')](_0x3ab0a2[_0x74a4('0x1d')],function(_0x1e4d18){return{'model':db[_0x1e4d18[_0x74a4('0x1f')]],'as':_0x1e4d18['as'],'attributes':_0x1e4d18[_0x74a4('0x20')],'include':_0x1e4d18[_0x74a4('0x1d')]?_['map'](_0x1e4d18[_0x74a4('0x1d')],function(_0x4f7cde){return{'model':db[_0x4f7cde[_0x74a4('0x1f')]],'as':_0x4f7cde['as'],'attributes':_0x4f7cde['attributes']};}):[]};}):[]};}):[]:[]})[_0x74a4('0x21')](function(_0x359bee){logger['info']('GetWhatsappQueue',_0x10aa97);logger[_0x74a4('0x10')](_0x74a4('0x22'),_0x10aa97,JSON[_0x74a4('0x12')](_0x359bee));_0x5c2bd7(_0x359bee);})['catch'](function(_0x54f770){logger[_0x74a4('0x13')](_0x74a4('0x22'),_0x54f770[_0x74a4('0x15')],_0x10aa97);_0x19d1e5(_0x59f2c4[_0x74a4('0x13')](0x1f4,_0x54f770[_0x74a4('0x15')]));});});};exports[_0x74a4('0x23')]=function(_0xefc09){var _0x2a9a52=this;return new Promise(function(_0x291c44,_0x3bca62){return db[_0x74a4('0x18')]['find']({'raw':_0xefc09[_0x74a4('0x1a')]?_0xefc09['options'][_0x74a4('0x24')]===undefined?!![]:![]:!![],'where':_0xefc09[_0x74a4('0x1a')]?_0xefc09[_0x74a4('0x1a')][_0x74a4('0x1b')]||null:null,'attributes':_0xefc09[_0x74a4('0x1a')]?_0xefc09['options']['attributes']||null:null,'include':_0xefc09[_0x74a4('0x1a')]?_0xefc09['options']['include']?_[_0x74a4('0x1e')](_0xefc09[_0x74a4('0x1a')][_0x74a4('0x1d')],function(_0x339e2c){return{'model':db[_0x339e2c[_0x74a4('0x1f')]],'as':_0x339e2c['as'],'attributes':_0x339e2c[_0x74a4('0x20')],'include':_0x339e2c[_0x74a4('0x1d')]?_[_0x74a4('0x1e')](_0x339e2c[_0x74a4('0x1d')],function(_0x3ee71a){return{'model':db[_0x3ee71a[_0x74a4('0x1f')]],'as':_0x3ee71a['as'],'attributes':_0x3ee71a[_0x74a4('0x20')],'include':_0x3ee71a[_0x74a4('0x1d')]?_['map'](_0x3ee71a[_0x74a4('0x1d')],function(_0xe5d5d6){return{'model':db[_0xe5d5d6[_0x74a4('0x1f')]],'as':_0xe5d5d6['as'],'attributes':_0xe5d5d6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d6f70){logger[_0x74a4('0x16')](_0x74a4('0x23'),_0xefc09);logger[_0x74a4('0x10')](_0x74a4('0x23'),_0xefc09,JSON[_0x74a4('0x12')](_0x3d6f70));_0x291c44(_0x3d6f70);})['catch'](function(_0x48aca9){logger[_0x74a4('0x13')](_0x74a4('0x23'),_0x48aca9[_0x74a4('0x15')],_0xefc09);_0x3bca62(_0x2a9a52[_0x74a4('0x13')](0x1f4,_0x48aca9[_0x74a4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index c7efa6c..c2cd366 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 _0xf7df=['emit','removeListener','length','whatsappQueue:','./whatsappQueue.events','remove','update'];(function(_0x3de4fa,_0x2c6bc8){var _0x5baae4=function(_0x4dfc5a){while(--_0x4dfc5a){_0x3de4fa['push'](_0x3de4fa['shift']());}};_0x5baae4(++_0x2c6bc8);}(_0xf7df,0x10e));var _0xff7d=function(_0x5d71dc,_0x3c6177){_0x5d71dc=_0x5d71dc-0x0;var _0x2d7196=_0xf7df[_0x5d71dc];return _0x2d7196;};'use strict';var WhatsappQueueEvents=require(_0xff7d('0x0'));var events=['save',_0xff7d('0x1'),_0xff7d('0x2')];function createListener(_0x25e0bd,_0x232814){return function(_0x598179){_0x232814[_0xff7d('0x3')](_0x25e0bd,_0x598179);};}function removeListener(_0x4ddbe0,_0x3d8604){return function(){WhatsappQueueEvents[_0xff7d('0x4')](_0x4ddbe0,_0x3d8604);};}exports['register']=function(_0x758bfb){for(var _0x54644b=0x0,_0x526150=events[_0xff7d('0x5')];_0x54644b<_0x526150;_0x54644b++){var _0x118c8f=events[_0x54644b];var _0x174f46=createListener(_0xff7d('0x6')+_0x118c8f,_0x758bfb);WhatsappQueueEvents['on'](_0x118c8f,_0x174f46);}}; \ No newline at end of file +var _0x85f8=['emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x462d64,_0x3f443b){var _0x11404b=function(_0x83a862){while(--_0x83a862){_0x462d64['push'](_0x462d64['shift']());}};_0x11404b(++_0x3f443b);}(_0x85f8,0x10f));var _0x885f=function(_0xf02ea7,_0x1c2b1b){_0xf02ea7=_0xf02ea7-0x0;var _0x484cee=_0x85f8[_0xf02ea7];return _0x484cee;};'use strict';var WhatsappQueueEvents=require(_0x885f('0x0'));var events=[_0x885f('0x1'),'remove','update'];function createListener(_0x5a4e4d,_0x32c587){return function(_0x5650f8){_0x32c587[_0x885f('0x2')](_0x5a4e4d,_0x5650f8);};}function removeListener(_0x871785,_0x2425f7){return function(){WhatsappQueueEvents[_0x885f('0x3')](_0x871785,_0x2425f7);};}exports[_0x885f('0x4')]=function(_0x2b132c){for(var _0x578126=0x0,_0x4f8f5c=events[_0x885f('0x5')];_0x578126<_0x4f8f5c;_0x578126++){var _0x4783ee=events[_0x578126];var _0x4a113c=createListener(_0x885f('0x6')+_0x4783ee,_0x2b132c);WhatsappQueueEvents['on'](_0x4783ee,_0x4a113c);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 11cf473..7ee48e1 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 _0x3504=['../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','connect-timeout','Router'];(function(_0x3e8705,_0x24c1a5){var _0x140f39=function(_0x297beb){while(--_0x297beb){_0x3e8705['push'](_0x3e8705['shift']());}};_0x140f39(++_0x24c1a5);}(_0x3504,0xce));var _0x4350=function(_0x2bd43c,_0x4d980d){_0x2bd43c=_0x2bd43c-0x0;var _0x57e69b=_0x3504[_0x2bd43c];return _0x57e69b;};'use strict';var multer=require(_0x4350('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4350('0x1'));var express=require('express');var router=express[_0x4350('0x2')]();var auth=require(_0x4350('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x4350('0x4'));var controller=require(_0x4350('0x5'));router['get']('/',auth[_0x4350('0x6')](),controller[_0x4350('0x7')]);router[_0x4350('0x8')](_0x4350('0x9'),auth[_0x4350('0x6')](),controller[_0x4350('0xa')]);router['get'](_0x4350('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4350('0xc')]('/',auth[_0x4350('0x6')](),controller[_0x4350('0xd')]);router[_0x4350('0xe')](_0x4350('0xb'),auth[_0x4350('0x6')](),controller[_0x4350('0xf')]);router[_0x4350('0x10')](_0x4350('0xb'),auth[_0x4350('0x6')](),controller[_0x4350('0x11')]);module[_0x4350('0x12')]=router; \ No newline at end of file +var _0xa59a=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','describe','get','show','post','create','put','/:id'];(function(_0x36204b,_0x5e70af){var _0x356c36=function(_0x497d2b){while(--_0x497d2b){_0x36204b['push'](_0x36204b['shift']());}};_0x356c36(++_0x5e70af);}(_0xa59a,0x1d2));var _0xaa59=function(_0x7d4fe9,_0x29dd8b){_0x7d4fe9=_0x7d4fe9-0x0;var _0x20d14a=_0xa59a[_0x7d4fe9];return _0x20d14a;};'use strict';var multer=require(_0xaa59('0x0'));var util=require(_0xaa59('0x1'));var path=require(_0xaa59('0x2'));var timeout=require(_0xaa59('0x3'));var express=require('express');var router=express[_0xaa59('0x4')]();var auth=require(_0xaa59('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaa59('0x6'));var controller=require(_0xaa59('0x7'));router['get']('/',auth[_0xaa59('0x8')](),controller[_0xaa59('0x9')]);router['get']('/describe',auth[_0xaa59('0x8')](),controller[_0xaa59('0xa')]);router[_0xaa59('0xb')]('/:id',auth[_0xaa59('0x8')](),controller[_0xaa59('0xc')]);router[_0xaa59('0xd')]('/',auth[_0xaa59('0x8')](),controller[_0xaa59('0xe')]);router[_0xaa59('0xf')](_0xaa59('0x10'),auth[_0xaa59('0x8')](),controller[_0xaa59('0x11')]);router[_0xaa59('0x12')](_0xaa59('0x10'),auth['isAuthenticated'](),controller[_0xaa59('0x13')]);module[_0xaa59('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 253ea76..3c6089b 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 _0x8ef6=['STRING','DATE','sequelize','exports'];(function(_0x1e7d4b,_0x1b9ac9){var _0x15d8af=function(_0x39ddc4){while(--_0x39ddc4){_0x1e7d4b['push'](_0x1e7d4b['shift']());}};_0x15d8af(++_0x1b9ac9);}(_0x8ef6,0xf2));var _0x68ef=function(_0x144ee7,_0x3d1f8a){_0x144ee7=_0x144ee7-0x0;var _0x2b5f9b=_0x8ef6[_0x144ee7];return _0x2b5f9b;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'uniqueid':{'type':Sequelize[_0x68ef('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x68ef('0x2')]},'joinAt':{'type':Sequelize[_0x68ef('0x3')]},'leaveAt':{'type':Sequelize[_0x68ef('0x3')]},'acceptAt':{'type':Sequelize[_0x68ef('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x68ef('0x2')]}}; \ No newline at end of file +var _0x1cb9=['DATE','sequelize','STRING'];(function(_0x1ee5be,_0x5f46e3){var _0x177140=function(_0x162779){while(--_0x162779){_0x1ee5be['push'](_0x1ee5be['shift']());}};_0x177140(++_0x5f46e3);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2be343,_0x25bd74){_0x2be343=_0x2be343-0x0;var _0x56c1a4=_0x1cb9[_0x2be343];return _0x56c1a4;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x91cb('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x91cb('0x1')]},'joinAt':{'type':Sequelize[_0x91cb('0x2')]},'leaveAt':{'type':Sequelize[_0x91cb('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x91cb('0x2')]},'reason':{'type':Sequelize[_0x91cb('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 89cefee..72c0fad 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 _0xce04=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','name','send','index','map','WhatsappQueueReport','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','rows','catch','show','params','length','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','path','sox','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x17cf56,_0x2ae467){var _0x51dd0d=function(_0x3c46ef){while(--_0x3c46ef){_0x17cf56['push'](_0x17cf56['shift']());}};_0x51dd0d(++_0x2ae467);}(_0xce04,0xc0));var _0x4ce0=function(_0x57759c,_0x46f1c2){_0x57759c=_0x57759c-0x0;var _0x4198ff=_0xce04[_0x57759c];return _0x4198ff;};'use strict';var pdf=require(_0x4ce0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4ce0('0x1'));var zipdir=require(_0x4ce0('0x2'));var jsonpatch=require(_0x4ce0('0x3'));var rp=require('request-promise');var moment=require(_0x4ce0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4ce0('0x5'));var sox=require(_0x4ce0('0x6'));var csv=require('to-csv');var ejs=require(_0x4ce0('0x7'));var fs=require('fs');var _=require(_0x4ce0('0x8'));var squel=require('squel');var crypto=require(_0x4ce0('0x9'));var jsforce=require(_0x4ce0('0xa'));var deskjs=require(_0x4ce0('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4ce0('0xc'));var Papa=require(_0x4ce0('0xd'));var Redis=require(_0x4ce0('0xe'));var authService=require(_0x4ce0('0xf'));var qs=require(_0x4ce0('0x10'));var as=require(_0x4ce0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4ce0('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x4ce0('0x13'))['db'];function respondWithStatusCode(_0x171ed5,_0x41ab36){_0x41ab36=_0x41ab36||0xcc;return function(_0x4dc703){if(_0x4dc703){return _0x171ed5[_0x4ce0('0x14')](_0x41ab36);}return _0x171ed5[_0x4ce0('0x15')](_0x41ab36)['end']();};}function respondWithResult(_0x34690d,_0x4d2b8e){_0x4d2b8e=_0x4d2b8e||0xc8;return function(_0x98e693){if(_0x98e693){return _0x34690d[_0x4ce0('0x15')](_0x4d2b8e)[_0x4ce0('0x16')](_0x98e693);}};}function respondWithFilteredResult(_0x491c71,_0x280068){return function(_0x2262b4){if(_0x2262b4){var _0x1df065=_0x2262b4['count'],_0x5e842b=_0x280068[_0x4ce0('0x17')],_0x8fe2c0=_0x280068[_0x4ce0('0x17')]+_0x280068[_0x4ce0('0x18')],_0x4e0de9;if(_0x8fe2c0>=_0x1df065){_0x8fe2c0=_0x1df065;_0x4e0de9=0xc8;}else{_0x4e0de9=0xce;}_0x491c71[_0x4ce0('0x15')](_0x4e0de9);return _0x491c71[_0x4ce0('0x19')](_0x4ce0('0x1a'),_0x5e842b+'-'+_0x8fe2c0+'/'+_0x1df065)[_0x4ce0('0x16')](_0x2262b4);}return null;};}function patchUpdates(_0x5eeb11){return function(_0x6c9cc4){try{jsonpatch[_0x4ce0('0x1b')](_0x6c9cc4,_0x5eeb11,!![]);}catch(_0x5a600d){return BPromise[_0x4ce0('0x1c')](_0x5a600d);}return _0x6c9cc4['save']();};}function saveUpdates(_0x24bfb5,_0x18bfbe){return function(_0x5c38c3){if(_0x5c38c3){return _0x5c38c3[_0x4ce0('0x1d')](_0x24bfb5)[_0x4ce0('0x1e')](function(_0x28d9e8){return _0x28d9e8;});}return null;};}function removeEntity(_0x2d8e99,_0x2cc2df){return function(_0x3eff2c){if(_0x3eff2c){return _0x3eff2c[_0x4ce0('0x1f')]()[_0x4ce0('0x1e')](function(){_0x2d8e99[_0x4ce0('0x15')](0xcc)[_0x4ce0('0x20')]();});}};}function handleEntityNotFound(_0x458bc5,_0x27024e){return function(_0x2b892d){if(!_0x2b892d){_0x458bc5[_0x4ce0('0x14')](0x194);}return _0x2b892d;};}function handleError(_0x11d521,_0x4dadad){_0x4dadad=_0x4dadad||0x1f4;return function(_0x14f48e){logger[_0x4ce0('0x21')](_0x14f48e['stack']);if(_0x14f48e[_0x4ce0('0x22')]){delete _0x14f48e[_0x4ce0('0x22')];}_0x11d521[_0x4ce0('0x15')](_0x4dadad)[_0x4ce0('0x23')](_0x14f48e);};}exports[_0x4ce0('0x24')]=function(_0x16ef60,_0x3b3fe2){var _0x1f66eb={},_0x2e0dae={},_0x1ec84a={'count':0x0,'rows':[]};var _0x48e21a=_[_0x4ce0('0x25')](db[_0x4ce0('0x26')][_0x4ce0('0x27')],function(_0x179b63){return{'name':_0x179b63['fieldName'],'type':_0x179b63['type'][_0x4ce0('0x28')]};});_0x2e0dae[_0x4ce0('0x29')]=_['map'](_0x48e21a,_0x4ce0('0x22'));_0x2e0dae['query']=_[_0x4ce0('0x2a')](_0x16ef60[_0x4ce0('0x2b')]);_0x2e0dae[_0x4ce0('0x2c')]=_[_0x4ce0('0x2d')](_0x2e0dae[_0x4ce0('0x29')],_0x2e0dae['query']);_0x1f66eb[_0x4ce0('0x2e')]=_[_0x4ce0('0x2d')](_0x2e0dae[_0x4ce0('0x29')],qs[_0x4ce0('0x2f')](_0x16ef60[_0x4ce0('0x2b')][_0x4ce0('0x2f')]));_0x1f66eb[_0x4ce0('0x2e')]=_0x1f66eb[_0x4ce0('0x2e')]['length']?_0x1f66eb[_0x4ce0('0x2e')]:_0x2e0dae[_0x4ce0('0x29')];if(!_0x16ef60[_0x4ce0('0x2b')][_0x4ce0('0x30')]('nolimit')){_0x1f66eb[_0x4ce0('0x18')]=qs[_0x4ce0('0x18')](_0x16ef60['query'][_0x4ce0('0x18')]);_0x1f66eb['offset']=qs[_0x4ce0('0x17')](_0x16ef60[_0x4ce0('0x2b')][_0x4ce0('0x17')]);}_0x1f66eb[_0x4ce0('0x31')]=qs[_0x4ce0('0x32')](_0x16ef60['query']['sort']);_0x1f66eb['where']=qs[_0x4ce0('0x2c')](_[_0x4ce0('0x33')](_0x16ef60[_0x4ce0('0x2b')],_0x2e0dae[_0x4ce0('0x2c')]),_0x48e21a);if(_0x16ef60['query'][_0x4ce0('0x34')]){_0x1f66eb[_0x4ce0('0x35')]=_[_0x4ce0('0x36')](_0x1f66eb[_0x4ce0('0x35')],{'$or':_['map'](_0x48e21a,function(_0xd412e1){if(_0xd412e1['type']!==_0x4ce0('0x37')){var _0x286225={};_0x286225[_0xd412e1['name']]={'$like':'%'+_0x16ef60['query'][_0x4ce0('0x34')]+'%'};return _0x286225;}})});}_0x1f66eb=_['merge']({},_0x1f66eb,_0x16ef60[_0x4ce0('0x38')]);var _0xe34e69={'where':_0x1f66eb[_0x4ce0('0x35')]};return db[_0x4ce0('0x26')][_0x4ce0('0x39')](_0xe34e69)[_0x4ce0('0x1e')](function(_0x34f80c){_0x1ec84a[_0x4ce0('0x39')]=_0x34f80c;if(_0x16ef60['query'][_0x4ce0('0x3a')]){_0x1f66eb['include']=[{'all':!![]}];}return db[_0x4ce0('0x26')]['findAll'](_0x1f66eb);})[_0x4ce0('0x1e')](function(_0x942764){_0x1ec84a[_0x4ce0('0x3b')]=_0x942764;return _0x1ec84a;})[_0x4ce0('0x1e')](respondWithFilteredResult(_0x3b3fe2,_0x1f66eb))[_0x4ce0('0x3c')](handleError(_0x3b3fe2,null));};exports[_0x4ce0('0x3d')]=function(_0x319ee8,_0x3f4213){var _0x2b208a={'raw':!![],'where':{'id':_0x319ee8[_0x4ce0('0x3e')]['id']}},_0x27c7f6={};_0x27c7f6[_0x4ce0('0x29')]=_[_0x4ce0('0x2a')](db[_0x4ce0('0x26')]['rawAttributes']);_0x27c7f6[_0x4ce0('0x2b')]=_[_0x4ce0('0x2a')](_0x319ee8[_0x4ce0('0x2b')]);_0x27c7f6['filters']=_[_0x4ce0('0x2d')](_0x27c7f6[_0x4ce0('0x29')],_0x27c7f6[_0x4ce0('0x2b')]);_0x2b208a[_0x4ce0('0x2e')]=_[_0x4ce0('0x2d')](_0x27c7f6[_0x4ce0('0x29')],qs[_0x4ce0('0x2f')](_0x319ee8[_0x4ce0('0x2b')][_0x4ce0('0x2f')]));_0x2b208a['attributes']=_0x2b208a['attributes'][_0x4ce0('0x3f')]?_0x2b208a[_0x4ce0('0x2e')]:_0x27c7f6['model'];if(_0x319ee8[_0x4ce0('0x2b')]['includeAll']){_0x2b208a['include']=[{'all':!![]}];}_0x2b208a=_[_0x4ce0('0x36')]({},_0x2b208a,_0x319ee8[_0x4ce0('0x38')]);return db[_0x4ce0('0x26')][_0x4ce0('0x40')](_0x2b208a)['then'](handleEntityNotFound(_0x3f4213,null))[_0x4ce0('0x1e')](respondWithResult(_0x3f4213,null))[_0x4ce0('0x3c')](handleError(_0x3f4213,null));};exports[_0x4ce0('0x41')]=function(_0x3173cf,_0x1c13e9){return db[_0x4ce0('0x26')][_0x4ce0('0x41')](_0x3173cf[_0x4ce0('0x42')],{})['then'](respondWithResult(_0x1c13e9,0xc9))[_0x4ce0('0x3c')](handleError(_0x1c13e9,null));};exports[_0x4ce0('0x1d')]=function(_0x52419d,_0x3dbec2){if(_0x52419d[_0x4ce0('0x42')]['id']){delete _0x52419d[_0x4ce0('0x42')]['id'];}return db[_0x4ce0('0x26')][_0x4ce0('0x40')]({'where':{'id':_0x52419d[_0x4ce0('0x3e')]['id']}})[_0x4ce0('0x1e')](handleEntityNotFound(_0x3dbec2,null))[_0x4ce0('0x1e')](saveUpdates(_0x52419d[_0x4ce0('0x42')],null))[_0x4ce0('0x1e')](respondWithResult(_0x3dbec2,null))['catch'](handleError(_0x3dbec2,null));};exports[_0x4ce0('0x1f')]=function(_0x54f2a3,_0x5d88a4){return db[_0x4ce0('0x26')][_0x4ce0('0x40')]({'where':{'id':_0x54f2a3[_0x4ce0('0x3e')]['id']}})[_0x4ce0('0x1e')](handleEntityNotFound(_0x5d88a4,null))[_0x4ce0('0x1e')](removeEntity(_0x5d88a4,null))[_0x4ce0('0x3c')](handleError(_0x5d88a4,null));};exports[_0x4ce0('0x43')]=function(_0x5427fe,_0x314170){return db[_0x4ce0('0x26')][_0x4ce0('0x43')]()[_0x4ce0('0x1e')](respondWithResult(_0x314170,null))[_0x4ce0('0x3c')](handleError(_0x314170,null));}; \ No newline at end of file +var _0xa899=['../../config/environment','sendStatus','json','offset','limit','status','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','WhatsappQueueReport','count','include','findAll','show','params','keys','find','catch','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa899,0x155));var _0x9a89=function(_0x1a3e23,_0xce45e){_0x1a3e23=_0x1a3e23-0x0;var _0x5ee0d8=_0xa899[_0x1a3e23];return _0x5ee0d8;};'use strict';var pdf=require(_0x9a89('0x0'));var emlformat=require(_0x9a89('0x1'));var rimraf=require(_0x9a89('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9a89('0x3'));var rp=require(_0x9a89('0x4'));var moment=require(_0x9a89('0x5'));var BPromise=require(_0x9a89('0x6'));var Mustache=require(_0x9a89('0x7'));var util=require(_0x9a89('0x8'));var path=require(_0x9a89('0x9'));var sox=require(_0x9a89('0xa'));var csv=require(_0x9a89('0xb'));var ejs=require(_0x9a89('0xc'));var fs=require('fs');var _=require(_0x9a89('0xd'));var squel=require(_0x9a89('0xe'));var crypto=require(_0x9a89('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9a89('0xb'));var querystring=require(_0x9a89('0x10'));var Papa=require('papaparse');var Redis=require(_0x9a89('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9a89('0x12'));var as=require(_0x9a89('0x13'));var hardwareService=require(_0x9a89('0x14'));var logger=require(_0x9a89('0x15'))(_0x9a89('0x16'));var utils=require(_0x9a89('0x17'));var config=require(_0x9a89('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51eb91,_0x4342c8){_0x4342c8=_0x4342c8||0xcc;return function(_0x8b7403){if(_0x8b7403){return _0x51eb91[_0x9a89('0x19')](_0x4342c8);}return _0x51eb91['status'](_0x4342c8)['end']();};}function respondWithResult(_0x53acb4,_0x1c66a3){_0x1c66a3=_0x1c66a3||0xc8;return function(_0xf08a5a){if(_0xf08a5a){return _0x53acb4['status'](_0x1c66a3)[_0x9a89('0x1a')](_0xf08a5a);}};}function respondWithFilteredResult(_0x427569,_0x33a08f){return function(_0x203ee9){if(_0x203ee9){var _0x597e58=_0x203ee9['count'],_0x11a933=_0x33a08f[_0x9a89('0x1b')],_0x3fe542=_0x33a08f['offset']+_0x33a08f[_0x9a89('0x1c')],_0x5adef3;if(_0x3fe542>=_0x597e58){_0x3fe542=_0x597e58;_0x5adef3=0xc8;}else{_0x5adef3=0xce;}_0x427569[_0x9a89('0x1d')](_0x5adef3);return _0x427569['set'](_0x9a89('0x1e'),_0x11a933+'-'+_0x3fe542+'/'+_0x597e58)['json'](_0x203ee9);}return null;};}function patchUpdates(_0x2d648f){return function(_0x3d54ed){try{jsonpatch['apply'](_0x3d54ed,_0x2d648f,!![]);}catch(_0x34da5e){return BPromise[_0x9a89('0x1f')](_0x34da5e);}return _0x3d54ed[_0x9a89('0x20')]();};}function saveUpdates(_0x1619e0,_0x66f8c7){return function(_0x146ec0){if(_0x146ec0){return _0x146ec0[_0x9a89('0x21')](_0x1619e0)[_0x9a89('0x22')](function(_0x583227){return _0x583227;});}return null;};}function removeEntity(_0x51618d,_0x1ef5ef){return function(_0x330121){if(_0x330121){return _0x330121[_0x9a89('0x23')]()[_0x9a89('0x22')](function(){_0x51618d[_0x9a89('0x1d')](0xcc)[_0x9a89('0x24')]();});}};}function handleEntityNotFound(_0x4ac234,_0x50adcf){return function(_0x42c5ee){if(!_0x42c5ee){_0x4ac234['sendStatus'](0x194);}return _0x42c5ee;};}function handleError(_0x3f5723,_0x2cca01){_0x2cca01=_0x2cca01||0x1f4;return function(_0xd8bad3){logger[_0x9a89('0x25')](_0xd8bad3[_0x9a89('0x26')]);if(_0xd8bad3[_0x9a89('0x27')]){delete _0xd8bad3[_0x9a89('0x27')];}_0x3f5723['status'](_0x2cca01)[_0x9a89('0x28')](_0xd8bad3);};}exports['index']=function(_0xd64312,_0x5a888b){var _0x5817e4={},_0x340999={},_0x2235e3={'count':0x0,'rows':[]};var _0x4aa0b1=_[_0x9a89('0x29')](db['WhatsappQueueReport'][_0x9a89('0x2a')],function(_0x365e34){return{'name':_0x365e34[_0x9a89('0x2b')],'type':_0x365e34[_0x9a89('0x2c')][_0x9a89('0x2d')]};});_0x340999[_0x9a89('0x2e')]=_[_0x9a89('0x29')](_0x4aa0b1,'name');_0x340999['query']=_['keys'](_0xd64312[_0x9a89('0x2f')]);_0x340999['filters']=_[_0x9a89('0x30')](_0x340999[_0x9a89('0x2e')],_0x340999[_0x9a89('0x2f')]);_0x5817e4['attributes']=_[_0x9a89('0x30')](_0x340999['model'],qs[_0x9a89('0x31')](_0xd64312[_0x9a89('0x2f')][_0x9a89('0x31')]));_0x5817e4[_0x9a89('0x32')]=_0x5817e4[_0x9a89('0x32')]['length']?_0x5817e4[_0x9a89('0x32')]:_0x340999[_0x9a89('0x2e')];if(!_0xd64312[_0x9a89('0x2f')][_0x9a89('0x33')](_0x9a89('0x34'))){_0x5817e4[_0x9a89('0x1c')]=qs[_0x9a89('0x1c')](_0xd64312[_0x9a89('0x2f')][_0x9a89('0x1c')]);_0x5817e4['offset']=qs[_0x9a89('0x1b')](_0xd64312[_0x9a89('0x2f')][_0x9a89('0x1b')]);}_0x5817e4[_0x9a89('0x35')]=qs[_0x9a89('0x36')](_0xd64312[_0x9a89('0x2f')][_0x9a89('0x36')]);_0x5817e4[_0x9a89('0x37')]=qs[_0x9a89('0x38')](_[_0x9a89('0x39')](_0xd64312['query'],_0x340999[_0x9a89('0x38')]),_0x4aa0b1);if(_0xd64312[_0x9a89('0x2f')][_0x9a89('0x3a')]){_0x5817e4[_0x9a89('0x37')]=_[_0x9a89('0x3b')](_0x5817e4[_0x9a89('0x37')],{'$or':_[_0x9a89('0x29')](_0x4aa0b1,function(_0x10ee90){if(_0x10ee90[_0x9a89('0x2c')]!==_0x9a89('0x3c')){var _0x404511={};_0x404511[_0x10ee90[_0x9a89('0x27')]]={'$like':'%'+_0xd64312['query'][_0x9a89('0x3a')]+'%'};return _0x404511;}})});}_0x5817e4=_['merge']({},_0x5817e4,_0xd64312[_0x9a89('0x3d')]);var _0x2c9cff={'where':_0x5817e4[_0x9a89('0x37')]};return db[_0x9a89('0x3e')][_0x9a89('0x3f')](_0x2c9cff)[_0x9a89('0x22')](function(_0x474fad){_0x2235e3[_0x9a89('0x3f')]=_0x474fad;if(_0xd64312[_0x9a89('0x2f')]['includeAll']){_0x5817e4[_0x9a89('0x40')]=[{'all':!![]}];}return db[_0x9a89('0x3e')][_0x9a89('0x41')](_0x5817e4);})[_0x9a89('0x22')](function(_0x50bcfe){_0x2235e3['rows']=_0x50bcfe;return _0x2235e3;})[_0x9a89('0x22')](respondWithFilteredResult(_0x5a888b,_0x5817e4))['catch'](handleError(_0x5a888b,null));};exports[_0x9a89('0x42')]=function(_0x2f5a78,_0x131ad6){var _0x34885f={'raw':!![],'where':{'id':_0x2f5a78[_0x9a89('0x43')]['id']}},_0x28feea={};_0x28feea[_0x9a89('0x2e')]=_[_0x9a89('0x44')](db['WhatsappQueueReport']['rawAttributes']);_0x28feea['query']=_[_0x9a89('0x44')](_0x2f5a78['query']);_0x28feea['filters']=_[_0x9a89('0x30')](_0x28feea[_0x9a89('0x2e')],_0x28feea[_0x9a89('0x2f')]);_0x34885f['attributes']=_[_0x9a89('0x30')](_0x28feea['model'],qs[_0x9a89('0x31')](_0x2f5a78['query'][_0x9a89('0x31')]));_0x34885f[_0x9a89('0x32')]=_0x34885f[_0x9a89('0x32')]['length']?_0x34885f[_0x9a89('0x32')]:_0x28feea[_0x9a89('0x2e')];if(_0x2f5a78[_0x9a89('0x2f')]['includeAll']){_0x34885f['include']=[{'all':!![]}];}_0x34885f=_[_0x9a89('0x3b')]({},_0x34885f,_0x2f5a78['options']);return db[_0x9a89('0x3e')][_0x9a89('0x45')](_0x34885f)['then'](handleEntityNotFound(_0x131ad6,null))[_0x9a89('0x22')](respondWithResult(_0x131ad6,null))[_0x9a89('0x46')](handleError(_0x131ad6,null));};exports['create']=function(_0x4b4636,_0x338559){return db[_0x9a89('0x3e')]['create'](_0x4b4636[_0x9a89('0x47')],{})['then'](respondWithResult(_0x338559,0xc9))[_0x9a89('0x46')](handleError(_0x338559,null));};exports[_0x9a89('0x21')]=function(_0x31f48,_0x38cddb){if(_0x31f48[_0x9a89('0x47')]['id']){delete _0x31f48['body']['id'];}return db[_0x9a89('0x3e')]['find']({'where':{'id':_0x31f48[_0x9a89('0x43')]['id']}})[_0x9a89('0x22')](handleEntityNotFound(_0x38cddb,null))['then'](saveUpdates(_0x31f48[_0x9a89('0x47')],null))[_0x9a89('0x22')](respondWithResult(_0x38cddb,null))[_0x9a89('0x46')](handleError(_0x38cddb,null));};exports[_0x9a89('0x23')]=function(_0x2c5da9,_0x14b44e){return db[_0x9a89('0x3e')][_0x9a89('0x45')]({'where':{'id':_0x2c5da9[_0x9a89('0x43')]['id']}})[_0x9a89('0x22')](handleEntityNotFound(_0x14b44e,null))[_0x9a89('0x22')](removeEntity(_0x14b44e,null))['catch'](handleError(_0x14b44e,null));};exports[_0x9a89('0x48')]=function(_0x2154af,_0x38bb6f){return db['WhatsappQueueReport'][_0x9a89('0x48')]()[_0x9a89('0x22')](respondWithResult(_0x38bb6f,null))['catch'](handleError(_0x38bb6f,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 8f542d8..624d603 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 _0x13e2=['moment','request-promise','path','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','util','../../config/logger','api'];(function(_0x171da3,_0x5d50c5){var _0x3e0fb7=function(_0x298121){while(--_0x298121){_0x171da3['push'](_0x171da3['shift']());}};_0x3e0fb7(++_0x5d50c5);}(_0x13e2,0xa5));var _0x213e=function(_0x3f51a9,_0x2c9517){_0x3f51a9=_0x3f51a9-0x0;var _0x451b34=_0x13e2[_0x3f51a9];return _0x451b34;};'use strict';var _=require('lodash');var util=require(_0x213e('0x0'));var logger=require(_0x213e('0x1'))(_0x213e('0x2'));var moment=require(_0x213e('0x3'));var BPromise=require('bluebird');var rp=require(_0x213e('0x4'));var fs=require('fs');var path=require(_0x213e('0x5'));var rimraf=require('rimraf');var config=require(_0x213e('0x6'));var attributes=require(_0x213e('0x7'));module[_0x213e('0x8')]=function(_0x1ab866,_0x4e0dba){return _0x1ab866[_0x213e('0x9')](_0x213e('0xa'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x213e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb5d6=['exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2f004a,_0x2fc2a4){var _0x42b7ac=function(_0x7d1b99){while(--_0x7d1b99){_0x2f004a['push'](_0x2f004a['shift']());}};_0x42b7ac(++_0x2fc2a4);}(_0xb5d6,0x109));var _0x6b5d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb5d6[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x6b5d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6b5d('0x1'));var moment=require(_0x6b5d('0x2'));var BPromise=require(_0x6b5d('0x3'));var rp=require(_0x6b5d('0x4'));var fs=require('fs');var path=require(_0x6b5d('0x5'));var rimraf=require(_0x6b5d('0x6'));var config=require(_0x6b5d('0x7'));var attributes=require('./whatsappQueueReport.attributes');module[_0x6b5d('0x8')]=function(_0x2c4ee6,_0x36ca0e){return _0x2c4ee6[_0x6b5d('0x9')](_0x6b5d('0xa'),attributes,{'tableName':_0x6b5d('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6b5d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 79082de..230d242 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 _0xa573=['result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','then','UpdateWhatsappQueueReport','update','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request\x20sent','stringify','error','code','message','info'];(function(_0x5b7157,_0x14a7fc){var _0xdad2ae=function(_0x1fe9c6){while(--_0x1fe9c6){_0x5b7157['push'](_0x5b7157['shift']());}};_0xdad2ae(++_0x14a7fc);}(_0xa573,0x12f));var _0x3a57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa573[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3a57('0x0'));var util=require(_0x3a57('0x1'));var moment=require(_0x3a57('0x2'));var BPromise=require('bluebird');var rs=require(_0x3a57('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a57('0x4'))['db'];var utils=require(_0x3a57('0x5'));var logger=require('../../config/logger')(_0x3a57('0x6'));var config=require(_0x3a57('0x7'));var jayson=require(_0x3a57('0x8'));var client=jayson['client'][_0x3a57('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c1027,_0x539cfe,_0x5b00f3){return new BPromise(function(_0x465588,_0x5f1143){return client['request'](_0x1c1027,_0x5b00f3)['then'](function(_0x4ffe9e){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x539cfe,_0x3a57('0xa'));logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x539cfe,_0x3a57('0xa'),JSON[_0x3a57('0xb')](_0x4ffe9e));if(_0x4ffe9e[_0x3a57('0xc')]){if(_0x4ffe9e[_0x3a57('0xc')][_0x3a57('0xd')]===0x1f4){logger[_0x3a57('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x539cfe,_0x4ffe9e['error']['message']);return _0x5f1143(_0x4ffe9e['error'][_0x3a57('0xe')]);}logger[_0x3a57('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x539cfe,_0x4ffe9e[_0x3a57('0xc')][_0x3a57('0xe')]);return _0x465588(_0x4ffe9e[_0x3a57('0xc')][_0x3a57('0xe')]);}else{logger[_0x3a57('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x539cfe,_0x3a57('0xa'));_0x465588(_0x4ffe9e[_0x3a57('0x10')][_0x3a57('0xe')]);}})[_0x3a57('0x11')](function(_0x10dc94){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x539cfe,_0x10dc94);_0x5f1143(_0x10dc94);});});}exports[_0x3a57('0x12')]=function(_0x54a2cd){var _0x262385=this;return new Promise(function(_0x26f608,_0x572ba2){return db[_0x3a57('0x13')][_0x3a57('0x14')](_0x54a2cd[_0x3a57('0x15')],{'raw':_0x54a2cd[_0x3a57('0x16')]?_0x54a2cd[_0x3a57('0x16')][_0x3a57('0x17')]===undefined?!![]:![]:!![]})[_0x3a57('0x18')](function(_0x287046){logger['info'](_0x3a57('0x12'),_0x54a2cd);logger['debug'](_0x3a57('0x12'),_0x54a2cd,JSON[_0x3a57('0xb')](_0x287046));_0x26f608(_0x287046);})[_0x3a57('0x11')](function(_0x30bed1){logger[_0x3a57('0xc')](_0x3a57('0x12'),_0x30bed1[_0x3a57('0xe')],_0x54a2cd);_0x572ba2(_0x262385['error'](0x1f4,_0x30bed1[_0x3a57('0xe')]));});});};exports[_0x3a57('0x19')]=function(_0x52b25e){var _0x35fe55=this;return new Promise(function(_0x417b7a,_0x2fb6d6){return db[_0x3a57('0x13')][_0x3a57('0x1a')](_0x52b25e[_0x3a57('0x15')],{'raw':_0x52b25e[_0x3a57('0x16')]?_0x52b25e[_0x3a57('0x16')][_0x3a57('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52b25e[_0x3a57('0x16')]?_0x52b25e[_0x3a57('0x16')]['where']||null:null,'attributes':_0x52b25e['options']?_0x52b25e[_0x3a57('0x16')][_0x3a57('0x1b')]||null:null,'limit':_0x52b25e[_0x3a57('0x16')]?_0x52b25e[_0x3a57('0x16')][_0x3a57('0x1c')]||null:null})[_0x3a57('0x18')](function(_0x23fab4){logger[_0x3a57('0xf')](_0x3a57('0x19'),_0x52b25e);logger['debug']('UpdateWhatsappQueueReport',_0x52b25e,JSON[_0x3a57('0xb')](_0x23fab4));_0x417b7a(_0x23fab4);})[_0x3a57('0x11')](function(_0x25a75c){logger[_0x3a57('0xc')](_0x3a57('0x19'),_0x25a75c[_0x3a57('0xe')],_0x52b25e);_0x2fb6d6(_0x35fe55[_0x3a57('0xc')](0x1f4,_0x25a75c[_0x3a57('0xe')]));});});}; \ No newline at end of file +var _0x41a2=['request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateWhatsappQueueReport','create','body','options','raw','stringify','UpdateWhatsappQueueReport','WhatsappQueueReport','update','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x115ec4,_0x434475){var _0x4d9494=function(_0x330fdc){while(--_0x330fdc){_0x115ec4['push'](_0x115ec4['shift']());}};_0x4d9494(++_0x434475);}(_0x41a2,0x160));var _0x241a=function(_0x4e0a03,_0x5eb6b0){_0x4e0a03=_0x4e0a03-0x0;var _0x2478fc=_0x41a2[_0x4e0a03];return _0x2478fc;};'use strict';var _=require(_0x241a('0x0'));var util=require(_0x241a('0x1'));var moment=require(_0x241a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x241a('0x3'));var db=require(_0x241a('0x4'))['db'];var utils=require(_0x241a('0x5'));var logger=require(_0x241a('0x6'))('rpc');var config=require(_0x241a('0x7'));var jayson=require(_0x241a('0x8'));var client=jayson[_0x241a('0x9')][_0x241a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58f06d,_0x56d46f,_0x30bb41){return new BPromise(function(_0x4c40b4,_0x543bd2){return client[_0x241a('0xb')](_0x58f06d,_0x30bb41)[_0x241a('0xc')](function(_0x47e360){logger[_0x241a('0xd')](_0x241a('0xe'),_0x56d46f,_0x241a('0xf'));logger[_0x241a('0x10')](_0x241a('0x11'),_0x56d46f,_0x241a('0xf'),JSON['stringify'](_0x47e360));if(_0x47e360[_0x241a('0x12')]){if(_0x47e360[_0x241a('0x12')][_0x241a('0x13')]===0x1f4){logger[_0x241a('0x12')](_0x241a('0xe'),_0x56d46f,_0x47e360['error'][_0x241a('0x14')]);return _0x543bd2(_0x47e360['error'][_0x241a('0x14')]);}logger['error'](_0x241a('0xe'),_0x56d46f,_0x47e360[_0x241a('0x12')][_0x241a('0x14')]);return _0x4c40b4(_0x47e360['error'][_0x241a('0x14')]);}else{logger[_0x241a('0xd')](_0x241a('0xe'),_0x56d46f,_0x241a('0xf'));_0x4c40b4(_0x47e360[_0x241a('0x15')][_0x241a('0x14')]);}})[_0x241a('0x16')](function(_0x6316fd){logger[_0x241a('0x12')](_0x241a('0xe'),_0x56d46f,_0x6316fd);_0x543bd2(_0x6316fd);});});}exports[_0x241a('0x17')]=function(_0x3d7359){var _0x593e8c=this;return new Promise(function(_0x25898b,_0x448ab1){return db['WhatsappQueueReport'][_0x241a('0x18')](_0x3d7359[_0x241a('0x19')],{'raw':_0x3d7359[_0x241a('0x1a')]?_0x3d7359[_0x241a('0x1a')][_0x241a('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4fbb1d){logger[_0x241a('0xd')](_0x241a('0x17'),_0x3d7359);logger[_0x241a('0x10')]('CreateWhatsappQueueReport',_0x3d7359,JSON[_0x241a('0x1c')](_0x4fbb1d));_0x25898b(_0x4fbb1d);})[_0x241a('0x16')](function(_0x52730d){logger['error']('CreateWhatsappQueueReport',_0x52730d[_0x241a('0x14')],_0x3d7359);_0x448ab1(_0x593e8c[_0x241a('0x12')](0x1f4,_0x52730d[_0x241a('0x14')]));});});};exports[_0x241a('0x1d')]=function(_0x45e92f){var _0x2c7ad5=this;return new Promise(function(_0x3751c2,_0x30c742){return db[_0x241a('0x1e')][_0x241a('0x1f')](_0x45e92f['body'],{'raw':_0x45e92f[_0x241a('0x1a')]?_0x45e92f['options'][_0x241a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45e92f[_0x241a('0x1a')]?_0x45e92f[_0x241a('0x1a')]['where']||null:null,'attributes':_0x45e92f[_0x241a('0x1a')]?_0x45e92f[_0x241a('0x1a')]['attributes']||null:null,'limit':_0x45e92f[_0x241a('0x1a')]?_0x45e92f[_0x241a('0x1a')][_0x241a('0x20')]||null:null})[_0x241a('0xc')](function(_0x216840){logger['info'](_0x241a('0x1d'),_0x45e92f);logger[_0x241a('0x10')]('UpdateWhatsappQueueReport',_0x45e92f,JSON[_0x241a('0x1c')](_0x216840));_0x3751c2(_0x216840);})[_0x241a('0x16')](function(_0x22df99){logger[_0x241a('0x12')](_0x241a('0x1d'),_0x22df99[_0x241a('0x14')],_0x45e92f);_0x30c742(_0x2c7ad5[_0x241a('0x12')](0x1f4,_0x22df99[_0x241a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 30bd426..ec38fe3 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 _0x1fee=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x4e46e1,_0x2d025a){var _0x566285=function(_0x185285){while(--_0x185285){_0x4e46e1['push'](_0x4e46e1['shift']());}};_0x566285(++_0x2d025a);}(_0x1fee,0x1de));var _0xe1fe=function(_0x18a1b0,_0x502942){_0x18a1b0=_0x18a1b0-0x0;var _0xc5f3d0=_0x1fee[_0x18a1b0];return _0xc5f3d0;};'use strict';var multer=require(_0xe1fe('0x0'));var util=require(_0xe1fe('0x1'));var path=require('path');var timeout=require(_0xe1fe('0x2'));var express=require(_0xe1fe('0x3'));var router=express[_0xe1fe('0x4')]();var auth=require(_0xe1fe('0x5'));var interaction=require(_0xe1fe('0x6'));var config=require(_0xe1fe('0x7'));var controller=require('./whatsappTransferReport.controller');router[_0xe1fe('0x8')]('/',auth[_0xe1fe('0x9')](),controller[_0xe1fe('0xa')]);router[_0xe1fe('0x8')](_0xe1fe('0xb'),auth[_0xe1fe('0x9')](),controller[_0xe1fe('0xc')]);router[_0xe1fe('0x8')](_0xe1fe('0xd'),auth[_0xe1fe('0x9')](),controller[_0xe1fe('0xe')]);router[_0xe1fe('0xf')]('/',auth[_0xe1fe('0x9')](),controller[_0xe1fe('0x10')]);router[_0xe1fe('0x11')](_0xe1fe('0xd'),auth['isAuthenticated'](),controller[_0xe1fe('0x12')]);router['delete'](_0xe1fe('0xd'),auth[_0xe1fe('0x9')](),controller[_0xe1fe('0x13')]);module[_0xe1fe('0x14')]=router; \ No newline at end of file +var _0xe1fc=['/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create'];(function(_0x5e06d2,_0x50133a){var _0x5cc08c=function(_0x5a64c5){while(--_0x5a64c5){_0x5e06d2['push'](_0x5e06d2['shift']());}};_0x5cc08c(++_0x50133a);}(_0xe1fc,0x155));var _0xce1f=function(_0x2265da,_0xfbbd2e){_0x2265da=_0x2265da-0x0;var _0x430c2b=_0xe1fc[_0x2265da];return _0x430c2b;};'use strict';var multer=require(_0xce1f('0x0'));var util=require('util');var path=require(_0xce1f('0x1'));var timeout=require(_0xce1f('0x2'));var express=require(_0xce1f('0x3'));var router=express[_0xce1f('0x4')]();var auth=require(_0xce1f('0x5'));var interaction=require(_0xce1f('0x6'));var config=require(_0xce1f('0x7'));var controller=require('./whatsappTransferReport.controller');router[_0xce1f('0x8')]('/',auth[_0xce1f('0x9')](),controller[_0xce1f('0xa')]);router[_0xce1f('0x8')](_0xce1f('0xb'),auth[_0xce1f('0x9')](),controller[_0xce1f('0xc')]);router['get']('/:id',auth[_0xce1f('0x9')](),controller[_0xce1f('0xd')]);router[_0xce1f('0xe')]('/',auth[_0xce1f('0x9')](),controller[_0xce1f('0xf')]);router['put'](_0xce1f('0x10'),auth[_0xce1f('0x9')](),controller[_0xce1f('0x11')]);router[_0xce1f('0x12')](_0xce1f('0x10'),auth[_0xce1f('0x9')](),controller[_0xce1f('0x13')]);module[_0xce1f('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index e7bebb6..9203339 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 _0x5f66=['queue','DATE','exports','ENUM','account','agent'];(function(_0x401676,_0x3f1436){var _0x4f13fe=function(_0xd2f197){while(--_0xd2f197){_0x401676['push'](_0x401676['shift']());}};_0x4f13fe(++_0x3f1436);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x65f6('0x1')](_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x65f6('0x5')]}}; \ No newline at end of file +var _0xbaf0=['ENUM','account','agent','queue','exports','STRING'];(function(_0x160252,_0x5e9300){var _0x19e8b1=function(_0x587305){while(--_0x587305){_0x160252['push'](_0x160252['shift']());}};_0x19e8b1(++_0x5e9300);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'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 diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index c1e4854..9a7e8de 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 _0x605d=['../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','WhatsappTransferReport','findAll','rows','catch','show','includeAll','include','options','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x31f686,_0x39d031){var _0x4d6932=function(_0xb25bf2){while(--_0xb25bf2){_0x31f686['push'](_0x31f686['shift']());}};_0x4d6932(++_0x39d031);}(_0x605d,0x80));var _0xd605=function(_0x30c2ae,_0x4c98a2){_0x30c2ae=_0x30c2ae-0x0;var _0x1ee1cc=_0x605d[_0x30c2ae];return _0x1ee1cc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd605('0x0'));var rimraf=require(_0xd605('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd605('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd605('0x3'));var sox=require('sox');var csv=require(_0xd605('0x4'));var ejs=require(_0xd605('0x5'));var fs=require('fs');var _=require(_0xd605('0x6'));var squel=require(_0xd605('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd605('0x8'));var toCsv=require(_0xd605('0x4'));var querystring=require(_0xd605('0x9'));var Papa=require(_0xd605('0xa'));var Redis=require(_0xd605('0xb'));var authService=require(_0xd605('0xc'));var qs=require(_0xd605('0xd'));var as=require(_0xd605('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd605('0xf'))(_0xd605('0x10'));var utils=require(_0xd605('0x11'));var config=require(_0xd605('0x12'));var db=require(_0xd605('0x13'))['db'];function respondWithStatusCode(_0x29bdaa,_0x3ace0b){_0x3ace0b=_0x3ace0b||0xcc;return function(_0x47aa36){if(_0x47aa36){return _0x29bdaa[_0xd605('0x14')](_0x3ace0b);}return _0x29bdaa[_0xd605('0x15')](_0x3ace0b)[_0xd605('0x16')]();};}function respondWithResult(_0x39c909,_0x5613b4){_0x5613b4=_0x5613b4||0xc8;return function(_0x5641df){if(_0x5641df){return _0x39c909[_0xd605('0x15')](_0x5613b4)[_0xd605('0x17')](_0x5641df);}};}function respondWithFilteredResult(_0x3b80ff,_0x12c18a){return function(_0x36d5b7){if(_0x36d5b7){var _0x1e6bf4=_0x36d5b7[_0xd605('0x18')],_0x1ae7b3=_0x12c18a[_0xd605('0x19')],_0x1dbc08=_0x12c18a[_0xd605('0x19')]+_0x12c18a[_0xd605('0x1a')],_0x3bbc5c;if(_0x1dbc08>=_0x1e6bf4){_0x1dbc08=_0x1e6bf4;_0x3bbc5c=0xc8;}else{_0x3bbc5c=0xce;}_0x3b80ff[_0xd605('0x15')](_0x3bbc5c);return _0x3b80ff['set']('Content-Range',_0x1ae7b3+'-'+_0x1dbc08+'/'+_0x1e6bf4)[_0xd605('0x17')](_0x36d5b7);}return null;};}function patchUpdates(_0x46bb93){return function(_0x2d9702){try{jsonpatch[_0xd605('0x1b')](_0x2d9702,_0x46bb93,!![]);}catch(_0x22b3bd){return BPromise[_0xd605('0x1c')](_0x22b3bd);}return _0x2d9702[_0xd605('0x1d')]();};}function saveUpdates(_0x54a713,_0x530c4a){return function(_0x4b7243){if(_0x4b7243){return _0x4b7243[_0xd605('0x1e')](_0x54a713)['then'](function(_0x5d870b){return _0x5d870b;});}return null;};}function removeEntity(_0x24eb04,_0x263c1e){return function(_0x1cbae0){if(_0x1cbae0){return _0x1cbae0[_0xd605('0x1f')]()[_0xd605('0x20')](function(){_0x24eb04[_0xd605('0x15')](0xcc)[_0xd605('0x16')]();});}};}function handleEntityNotFound(_0x2b4018,_0x3ac13e){return function(_0x4deedc){if(!_0x4deedc){_0x2b4018['sendStatus'](0x194);}return _0x4deedc;};}function handleError(_0x157337,_0x4d1bce){_0x4d1bce=_0x4d1bce||0x1f4;return function(_0x125a75){logger[_0xd605('0x21')](_0x125a75[_0xd605('0x22')]);if(_0x125a75[_0xd605('0x23')]){delete _0x125a75[_0xd605('0x23')];}_0x157337[_0xd605('0x15')](_0x4d1bce)[_0xd605('0x24')](_0x125a75);};}exports[_0xd605('0x25')]=function(_0x376da7,_0x1853dc){var _0x18dc35={},_0x214397={},_0x38ea27={'count':0x0,'rows':[]};var _0x40479f=_[_0xd605('0x26')](db['WhatsappTransferReport'][_0xd605('0x27')],function(_0x49cc3a){return{'name':_0x49cc3a[_0xd605('0x28')],'type':_0x49cc3a[_0xd605('0x29')][_0xd605('0x2a')]};});_0x214397[_0xd605('0x2b')]=_[_0xd605('0x26')](_0x40479f,_0xd605('0x23'));_0x214397[_0xd605('0x2c')]=_[_0xd605('0x2d')](_0x376da7[_0xd605('0x2c')]);_0x214397['filters']=_['intersection'](_0x214397[_0xd605('0x2b')],_0x214397[_0xd605('0x2c')]);_0x18dc35[_0xd605('0x2e')]=_[_0xd605('0x2f')](_0x214397[_0xd605('0x2b')],qs['fields'](_0x376da7['query'][_0xd605('0x30')]));_0x18dc35['attributes']=_0x18dc35[_0xd605('0x2e')][_0xd605('0x31')]?_0x18dc35[_0xd605('0x2e')]:_0x214397[_0xd605('0x2b')];if(!_0x376da7[_0xd605('0x2c')][_0xd605('0x32')](_0xd605('0x33'))){_0x18dc35[_0xd605('0x1a')]=qs['limit'](_0x376da7[_0xd605('0x2c')]['limit']);_0x18dc35[_0xd605('0x19')]=qs[_0xd605('0x19')](_0x376da7[_0xd605('0x2c')][_0xd605('0x19')]);}_0x18dc35[_0xd605('0x34')]=qs['sort'](_0x376da7[_0xd605('0x2c')][_0xd605('0x35')]);_0x18dc35[_0xd605('0x36')]=qs['filters'](_[_0xd605('0x37')](_0x376da7[_0xd605('0x2c')],_0x214397[_0xd605('0x38')]),_0x40479f);if(_0x376da7[_0xd605('0x2c')][_0xd605('0x39')]){_0x18dc35['where']=_[_0xd605('0x3a')](_0x18dc35[_0xd605('0x36')],{'$or':_[_0xd605('0x26')](_0x40479f,function(_0x360b4c){if(_0x360b4c['type']!==_0xd605('0x3b')){var _0x16f991={};_0x16f991[_0x360b4c['name']]={'$like':'%'+_0x376da7[_0xd605('0x2c')]['filter']+'%'};return _0x16f991;}})});}_0x18dc35=_[_0xd605('0x3a')]({},_0x18dc35,_0x376da7['options']);var _0x45109c={'where':_0x18dc35[_0xd605('0x36')]};return db[_0xd605('0x3c')]['count'](_0x45109c)[_0xd605('0x20')](function(_0x521f91){_0x38ea27[_0xd605('0x18')]=_0x521f91;if(_0x376da7[_0xd605('0x2c')]['includeAll']){_0x18dc35['include']=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xd605('0x3d')](_0x18dc35);})[_0xd605('0x20')](function(_0x142bf2){_0x38ea27[_0xd605('0x3e')]=_0x142bf2;return _0x38ea27;})[_0xd605('0x20')](respondWithFilteredResult(_0x1853dc,_0x18dc35))[_0xd605('0x3f')](handleError(_0x1853dc,null));};exports[_0xd605('0x40')]=function(_0x32dc25,_0x1f0f80){var _0x577329={'raw':!![],'where':{'id':_0x32dc25['params']['id']}},_0x170961={};_0x170961[_0xd605('0x2b')]=_[_0xd605('0x2d')](db[_0xd605('0x3c')][_0xd605('0x27')]);_0x170961['query']=_[_0xd605('0x2d')](_0x32dc25[_0xd605('0x2c')]);_0x170961[_0xd605('0x38')]=_[_0xd605('0x2f')](_0x170961[_0xd605('0x2b')],_0x170961[_0xd605('0x2c')]);_0x577329[_0xd605('0x2e')]=_[_0xd605('0x2f')](_0x170961[_0xd605('0x2b')],qs[_0xd605('0x30')](_0x32dc25[_0xd605('0x2c')][_0xd605('0x30')]));_0x577329['attributes']=_0x577329[_0xd605('0x2e')][_0xd605('0x31')]?_0x577329[_0xd605('0x2e')]:_0x170961[_0xd605('0x2b')];if(_0x32dc25[_0xd605('0x2c')][_0xd605('0x41')]){_0x577329[_0xd605('0x42')]=[{'all':!![]}];}_0x577329=_[_0xd605('0x3a')]({},_0x577329,_0x32dc25[_0xd605('0x43')]);return db[_0xd605('0x3c')][_0xd605('0x44')](_0x577329)['then'](handleEntityNotFound(_0x1f0f80,null))[_0xd605('0x20')](respondWithResult(_0x1f0f80,null))[_0xd605('0x3f')](handleError(_0x1f0f80,null));};exports[_0xd605('0x45')]=function(_0x4d2759,_0x2a8286){return db[_0xd605('0x3c')][_0xd605('0x45')](_0x4d2759[_0xd605('0x46')],{})[_0xd605('0x20')](respondWithResult(_0x2a8286,0xc9))[_0xd605('0x3f')](handleError(_0x2a8286,null));};exports[_0xd605('0x1e')]=function(_0x117545,_0x4f0b84){if(_0x117545[_0xd605('0x46')]['id']){delete _0x117545[_0xd605('0x46')]['id'];}return db['WhatsappTransferReport'][_0xd605('0x44')]({'where':{'id':_0x117545['params']['id']}})[_0xd605('0x20')](handleEntityNotFound(_0x4f0b84,null))[_0xd605('0x20')](saveUpdates(_0x117545[_0xd605('0x46')],null))[_0xd605('0x20')](respondWithResult(_0x4f0b84,null))[_0xd605('0x3f')](handleError(_0x4f0b84,null));};exports[_0xd605('0x1f')]=function(_0x3656aa,_0x51eeb0){return db[_0xd605('0x3c')][_0xd605('0x44')]({'where':{'id':_0x3656aa[_0xd605('0x47')]['id']}})['then'](handleEntityNotFound(_0x51eeb0,null))[_0xd605('0x20')](removeEntity(_0x51eeb0,null))['catch'](handleError(_0x51eeb0,null));};exports[_0xd605('0x48')]=function(_0x55700d,_0xc4efc9){return db[_0xd605('0x3c')][_0xd605('0x48')]()[_0xd605('0x20')](respondWithResult(_0xc4efc9,null))['catch'](handleError(_0xc4efc9,null));}; \ No newline at end of file +var _0x20af=['query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','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','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key'];(function(_0x4a0435,_0xb521d6){var _0x4ce1d7=function(_0x36158f){while(--_0x36158f){_0x4a0435['push'](_0x4a0435['shift']());}};_0x4ce1d7(++_0xb521d6);}(_0x20af,0x1d7));var _0xf20a=function(_0x3228da,_0x5494ee){_0x3228da=_0x3228da-0x0;var _0x420aaa=_0x20af[_0x3228da];return _0x420aaa;};'use strict';var pdf=require(_0xf20a('0x0'));var emlformat=require(_0xf20a('0x1'));var rimraf=require(_0xf20a('0x2'));var zipdir=require(_0xf20a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf20a('0x4'));var moment=require(_0xf20a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf20a('0x6'));var path=require(_0xf20a('0x7'));var sox=require(_0xf20a('0x8'));var csv=require('to-csv');var ejs=require(_0xf20a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf20a('0xa'));var crypto=require(_0xf20a('0xb'));var jsforce=require(_0xf20a('0xc'));var deskjs=require(_0xf20a('0xd'));var toCsv=require(_0xf20a('0xe'));var querystring=require(_0xf20a('0xf'));var Papa=require(_0xf20a('0x10'));var Redis=require(_0xf20a('0x11'));var authService=require(_0xf20a('0x12'));var qs=require(_0xf20a('0x13'));var as=require(_0xf20a('0x14'));var hardwareService=require(_0xf20a('0x15'));var logger=require(_0xf20a('0x16'))('api');var utils=require(_0xf20a('0x17'));var config=require(_0xf20a('0x18'));var db=require(_0xf20a('0x19'))['db'];function respondWithStatusCode(_0x3cb464,_0x20e03a){_0x20e03a=_0x20e03a||0xcc;return function(_0x4c163f){if(_0x4c163f){return _0x3cb464['sendStatus'](_0x20e03a);}return _0x3cb464[_0xf20a('0x1a')](_0x20e03a)[_0xf20a('0x1b')]();};}function respondWithResult(_0x24f2af,_0x5b3987){_0x5b3987=_0x5b3987||0xc8;return function(_0x3ac996){if(_0x3ac996){return _0x24f2af[_0xf20a('0x1a')](_0x5b3987)[_0xf20a('0x1c')](_0x3ac996);}};}function respondWithFilteredResult(_0x242817,_0x50a748){return function(_0x159e45){if(_0x159e45){var _0x3e4712=_0x159e45['count'],_0x4b4d4c=_0x50a748[_0xf20a('0x1d')],_0x27a62f=_0x50a748[_0xf20a('0x1d')]+_0x50a748[_0xf20a('0x1e')],_0x31b9ad;if(_0x27a62f>=_0x3e4712){_0x27a62f=_0x3e4712;_0x31b9ad=0xc8;}else{_0x31b9ad=0xce;}_0x242817[_0xf20a('0x1a')](_0x31b9ad);return _0x242817[_0xf20a('0x1f')](_0xf20a('0x20'),_0x4b4d4c+'-'+_0x27a62f+'/'+_0x3e4712)[_0xf20a('0x1c')](_0x159e45);}return null;};}function patchUpdates(_0x1a6bbe){return function(_0xba6435){try{jsonpatch['apply'](_0xba6435,_0x1a6bbe,!![]);}catch(_0x3a03ca){return BPromise['reject'](_0x3a03ca);}return _0xba6435['save']();};}function saveUpdates(_0x3f409a,_0x46ab75){return function(_0x2d996f){if(_0x2d996f){return _0x2d996f[_0xf20a('0x21')](_0x3f409a)[_0xf20a('0x22')](function(_0x33ff45){return _0x33ff45;});}return null;};}function removeEntity(_0x3d8c90,_0x219383){return function(_0x4d1faf){if(_0x4d1faf){return _0x4d1faf[_0xf20a('0x23')]()['then'](function(){_0x3d8c90[_0xf20a('0x1a')](0xcc)[_0xf20a('0x1b')]();});}};}function handleEntityNotFound(_0x3ebc32,_0x24062d){return function(_0x518a48){if(!_0x518a48){_0x3ebc32['sendStatus'](0x194);}return _0x518a48;};}function handleError(_0x10c2c0,_0x5742d5){_0x5742d5=_0x5742d5||0x1f4;return function(_0x55670a){logger[_0xf20a('0x24')](_0x55670a[_0xf20a('0x25')]);if(_0x55670a[_0xf20a('0x26')]){delete _0x55670a[_0xf20a('0x26')];}_0x10c2c0[_0xf20a('0x1a')](_0x5742d5)[_0xf20a('0x27')](_0x55670a);};}exports[_0xf20a('0x28')]=function(_0x5235b8,_0x15c14d){var _0x7cfd4c={},_0x19c484={},_0x404ba0={'count':0x0,'rows':[]};var _0x55c1d7=_[_0xf20a('0x29')](db[_0xf20a('0x2a')][_0xf20a('0x2b')],function(_0x232039){return{'name':_0x232039[_0xf20a('0x2c')],'type':_0x232039[_0xf20a('0x2d')][_0xf20a('0x2e')]};});_0x19c484['model']=_[_0xf20a('0x29')](_0x55c1d7,_0xf20a('0x26'));_0x19c484['query']=_['keys'](_0x5235b8[_0xf20a('0x2f')]);_0x19c484[_0xf20a('0x30')]=_[_0xf20a('0x31')](_0x19c484[_0xf20a('0x32')],_0x19c484[_0xf20a('0x2f')]);_0x7cfd4c[_0xf20a('0x33')]=_[_0xf20a('0x31')](_0x19c484[_0xf20a('0x32')],qs[_0xf20a('0x34')](_0x5235b8[_0xf20a('0x2f')][_0xf20a('0x34')]));_0x7cfd4c[_0xf20a('0x33')]=_0x7cfd4c[_0xf20a('0x33')]['length']?_0x7cfd4c['attributes']:_0x19c484[_0xf20a('0x32')];if(!_0x5235b8['query'][_0xf20a('0x35')](_0xf20a('0x36'))){_0x7cfd4c[_0xf20a('0x1e')]=qs['limit'](_0x5235b8[_0xf20a('0x2f')][_0xf20a('0x1e')]);_0x7cfd4c['offset']=qs['offset'](_0x5235b8[_0xf20a('0x2f')][_0xf20a('0x1d')]);}_0x7cfd4c[_0xf20a('0x37')]=qs[_0xf20a('0x38')](_0x5235b8[_0xf20a('0x2f')]['sort']);_0x7cfd4c[_0xf20a('0x39')]=qs['filters'](_['pick'](_0x5235b8[_0xf20a('0x2f')],_0x19c484[_0xf20a('0x30')]),_0x55c1d7);if(_0x5235b8[_0xf20a('0x2f')]['filter']){_0x7cfd4c[_0xf20a('0x39')]=_[_0xf20a('0x3a')](_0x7cfd4c['where'],{'$or':_[_0xf20a('0x29')](_0x55c1d7,function(_0x462ae0){if(_0x462ae0['type']!==_0xf20a('0x3b')){var _0x5abe9b={};_0x5abe9b[_0x462ae0[_0xf20a('0x26')]]={'$like':'%'+_0x5235b8[_0xf20a('0x2f')]['filter']+'%'};return _0x5abe9b;}})});}_0x7cfd4c=_[_0xf20a('0x3a')]({},_0x7cfd4c,_0x5235b8[_0xf20a('0x3c')]);var _0x583309={'where':_0x7cfd4c['where']};return db[_0xf20a('0x2a')][_0xf20a('0x3d')](_0x583309)[_0xf20a('0x22')](function(_0x27e129){_0x404ba0[_0xf20a('0x3d')]=_0x27e129;if(_0x5235b8[_0xf20a('0x2f')][_0xf20a('0x3e')]){_0x7cfd4c[_0xf20a('0x3f')]=[{'all':!![]}];}return db[_0xf20a('0x2a')][_0xf20a('0x40')](_0x7cfd4c);})[_0xf20a('0x22')](function(_0x53c45e){_0x404ba0[_0xf20a('0x41')]=_0x53c45e;return _0x404ba0;})['then'](respondWithFilteredResult(_0x15c14d,_0x7cfd4c))[_0xf20a('0x42')](handleError(_0x15c14d,null));};exports[_0xf20a('0x43')]=function(_0x2c2ee7,_0x2becc3){var _0x3ee0f6={'raw':!![],'where':{'id':_0x2c2ee7[_0xf20a('0x44')]['id']}},_0x49d167={};_0x49d167['model']=_['keys'](db[_0xf20a('0x2a')][_0xf20a('0x2b')]);_0x49d167[_0xf20a('0x2f')]=_[_0xf20a('0x45')](_0x2c2ee7[_0xf20a('0x2f')]);_0x49d167[_0xf20a('0x30')]=_[_0xf20a('0x31')](_0x49d167['model'],_0x49d167[_0xf20a('0x2f')]);_0x3ee0f6[_0xf20a('0x33')]=_[_0xf20a('0x31')](_0x49d167[_0xf20a('0x32')],qs[_0xf20a('0x34')](_0x2c2ee7['query'][_0xf20a('0x34')]));_0x3ee0f6[_0xf20a('0x33')]=_0x3ee0f6['attributes']['length']?_0x3ee0f6[_0xf20a('0x33')]:_0x49d167['model'];if(_0x2c2ee7['query'][_0xf20a('0x3e')]){_0x3ee0f6[_0xf20a('0x3f')]=[{'all':!![]}];}_0x3ee0f6=_[_0xf20a('0x3a')]({},_0x3ee0f6,_0x2c2ee7[_0xf20a('0x3c')]);return db[_0xf20a('0x2a')][_0xf20a('0x46')](_0x3ee0f6)[_0xf20a('0x22')](handleEntityNotFound(_0x2becc3,null))[_0xf20a('0x22')](respondWithResult(_0x2becc3,null))[_0xf20a('0x42')](handleError(_0x2becc3,null));};exports[_0xf20a('0x47')]=function(_0x1276e5,_0x304151){return db[_0xf20a('0x2a')][_0xf20a('0x47')](_0x1276e5['body'],{})[_0xf20a('0x22')](respondWithResult(_0x304151,0xc9))[_0xf20a('0x42')](handleError(_0x304151,null));};exports[_0xf20a('0x21')]=function(_0x311552,_0x36b9fc){if(_0x311552[_0xf20a('0x48')]['id']){delete _0x311552[_0xf20a('0x48')]['id'];}return db[_0xf20a('0x2a')]['find']({'where':{'id':_0x311552['params']['id']}})[_0xf20a('0x22')](handleEntityNotFound(_0x36b9fc,null))[_0xf20a('0x22')](saveUpdates(_0x311552[_0xf20a('0x48')],null))[_0xf20a('0x22')](respondWithResult(_0x36b9fc,null))[_0xf20a('0x42')](handleError(_0x36b9fc,null));};exports['destroy']=function(_0x10e6f2,_0x15f58b){return db[_0xf20a('0x2a')][_0xf20a('0x46')]({'where':{'id':_0x10e6f2['params']['id']}})[_0xf20a('0x22')](handleEntityNotFound(_0x15f58b,null))[_0xf20a('0x22')](removeEntity(_0x15f58b,null))[_0xf20a('0x42')](handleError(_0x15f58b,null));};exports[_0xf20a('0x49')]=function(_0x1af5a1,_0x3d1397){return db['WhatsappTransferReport'][_0xf20a('0x49')]()['then'](respondWithResult(_0x3d1397,null))[_0xf20a('0x42')](handleError(_0x3d1397,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 32059f4..020332d 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 _0xd5f8=['./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x353396,_0x1f991e){var _0x2a8356=function(_0x4c3ade){while(--_0x4c3ade){_0x353396['push'](_0x353396['shift']());}};_0x2a8356(++_0x1f991e);}(_0xd5f8,0xf4));var _0x8d5f=function(_0x3d8c45,_0x395555){_0x3d8c45=_0x3d8c45-0x0;var _0x239fe5=_0xd5f8[_0x3d8c45];return _0x239fe5;};'use strict';var _=require(_0x8d5f('0x0'));var util=require(_0x8d5f('0x1'));var logger=require(_0x8d5f('0x2'))(_0x8d5f('0x3'));var moment=require(_0x8d5f('0x4'));var BPromise=require(_0x8d5f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8d5f('0x6'));var rimraf=require('rimraf');var config=require(_0x8d5f('0x7'));var attributes=require(_0x8d5f('0x8'));module[_0x8d5f('0x9')]=function(_0x75ff77,_0x4ed565){return _0x75ff77[_0x8d5f('0xa')]('WhatsappTransferReport',attributes,{'tableName':_0x8d5f('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe14c=['moment','path','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger','api'];(function(_0x46fc6c,_0x297637){var _0x18694f=function(_0x34e1e0){while(--_0x34e1e0){_0x46fc6c['push'](_0x46fc6c['shift']());}};_0x18694f(++_0x297637);}(_0xe14c,0x1b5));var _0xce14=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe14c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xce14('0x0'));var logger=require(_0xce14('0x1'))(_0xce14('0x2'));var moment=require(_0xce14('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xce14('0x4'));var rimraf=require('rimraf');var config=require(_0xce14('0x5'));var attributes=require(_0xce14('0x6'));module['exports']=function(_0x5b7165,_0x5cfe76){return _0x5b7165[_0xce14('0x7')](_0xce14('0x8'),attributes,{'tableName':_0xce14('0x9'),'paranoid':![],'indexes':[{'name':_0xce14('0xa'),'fields':[_0xce14('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 f17e653..c68c9cb 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(_0x5cc7b8,_0x3060f1){var _0x57fed5=function(_0x16e259){while(--_0x16e259){_0x5cc7b8['push'](_0x5cc7b8['shift']());}};_0x57fed5(++_0x3060f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','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(_0x301531,_0x50ba2e){var _0x3b1e62=function(_0x123ed6){while(--_0x123ed6){_0x301531['push'](_0x301531['shift']());}};_0x3b1e62(++_0x50ba2e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 13668ac..e62f45a 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfec3=['./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','sequelize','sync','then','info','start','online','join','seedDB','./config/seedDB','default','./config/license','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb'];(function(_0x43a4c2,_0x4e400f){var _0x3cd4fb=function(_0x28ec58){while(--_0x28ec58){_0x43a4c2['push'](_0x43a4c2['shift']());}};_0x3cd4fb(++_0x4e400f);}(_0xfec3,0x1e2));var _0x3fec=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xfec3[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x3fec('0x0'));var mysqldb=require(_0x3fec('0x1'));var rpc=require('./rpc');var config=require(_0x3fec('0x2'));var logger=require(_0x3fec('0x3'))('app');var pm2=require(_0x3fec('0x4'));var pm2Config=require(_0x3fec('0x5'));var schedule=require(_0x3fec('0x6'));var chat=require(_0x3fec('0x7'));function main(){return mysqldb['db'][_0x3fec('0x8')][_0x3fec('0x9')]()[_0x3fec('0xa')](function(){return rpc['listen']();})[_0x3fec('0xa')](function(_0x360d1f){logger[_0x3fec('0xb')](_0x360d1f);return chat[_0x3fec('0xc')]();})[_0x3fec('0xa')](function(){return schedule[_0x3fec('0xc')]();})['then'](function(_0x350a50){logger[_0x3fec('0xb')](_0x350a50);return pm2['start'](pm2Config);})[_0x3fec('0xa')](function(_0x529f7a){logger[_0x3fec('0xb')]('Online\x20apps:',_['map'](_['filter'](_0x529f7a,{'status':_0x3fec('0xd')}),'name')[_0x3fec('0xe')]());logger[_0x3fec('0xb')]('Offline\x20apps:',_['map'](_['filter'](_0x529f7a,function(_0xa2a090){return _0xa2a090['status']!=='online';}),'name')[_0x3fec('0xe')]()||'None');config[_0x3fec('0xf')]&&require(_0x3fec('0x10'))[_0x3fec('0x11')]();require(_0x3fec('0x12'))['default']();})['catch'](function(_0x2e52bc){logger[_0x3fec('0x13')](_0x3fec('0x14'),_0x2e52bc);process[_0x3fec('0x15')](0x1);});}main(); \ No newline at end of file +var _0x0755=['default','./config/license','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','sequelize','sync','listen','then','info','start','Online\x20apps:','filter','name','join','Offline\x20apps:','map','status','online','./config/seedDB'];(function(_0x292bab,_0x18b725){var _0x3a1de1=function(_0x8d52cf){while(--_0x8d52cf){_0x292bab['push'](_0x292bab['shift']());}};_0x3a1de1(++_0x18b725);}(_0x0755,0x19a));var _0x5075=function(_0x7656b1,_0x1ecbdf){_0x7656b1=_0x7656b1-0x0;var _0x40be22=_0x0755[_0x7656b1];return _0x40be22;};'use strict';var _=require(_0x5075('0x0'));var mysqldb=require(_0x5075('0x1'));var rpc=require('./rpc');var config=require(_0x5075('0x2'));var logger=require(_0x5075('0x3'))(_0x5075('0x4'));var pm2=require(_0x5075('0x5'));var pm2Config=require(_0x5075('0x6'));var schedule=require('./config/schedule');var chat=require('./config/schedule/chat');function main(){return mysqldb['db'][_0x5075('0x7')][_0x5075('0x8')]()['then'](function(){return rpc[_0x5075('0x9')]();})[_0x5075('0xa')](function(_0x35acdb){logger[_0x5075('0xb')](_0x35acdb);return chat[_0x5075('0xc')]();})[_0x5075('0xa')](function(){return schedule['start']();})['then'](function(_0x54aa87){logger[_0x5075('0xb')](_0x54aa87);return pm2['start'](pm2Config);})[_0x5075('0xa')](function(_0x34a7d4){logger[_0x5075('0xb')](_0x5075('0xd'),_['map'](_[_0x5075('0xe')](_0x34a7d4,{'status':'online'}),_0x5075('0xf'))[_0x5075('0x10')]());logger[_0x5075('0xb')](_0x5075('0x11'),_[_0x5075('0x12')](_[_0x5075('0xe')](_0x34a7d4,function(_0x1b2b09){return _0x1b2b09[_0x5075('0x13')]!==_0x5075('0x14');}),'name')['join']()||'None');config['seedDB']&&require(_0x5075('0x15'))[_0x5075('0x16')]();require(_0x5075('0x17'))['default']();})[_0x5075('0x18')](function(_0x34d26e){logger['error'](_0x5075('0x19'),_0x34d26e);process[_0x5075('0x1a')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 6717003..faa16fe 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 _0xdb28=['use','user','ChatInteraction','findOne','params','closed','status','disposition','json','unmanaged','Unmanaged.','Forbidden.','isAuthenticated','authorization','User','find','name','then','pass','Wrong\x20credentials.','catch','startsWith','headers','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','sub','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','update','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','send','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secret','secrets','options','verify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','express-jwt','composable-middleware','basic-auth','crypto','bluebird','session','role','internal','email','userpic','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','isChatInteractionAuthorized'];(function(_0x1db967,_0x45d27d){var _0x459de6=function(_0x55c28b){while(--_0x55c28b){_0x1db967['push'](_0x1db967['shift']());}};_0x459de6(++_0x45d27d);}(_0xdb28,0x106));var _0x8db2=function(_0x11837c,_0x186352){_0x11837c=_0x11837c-0x0;var _0x136dd1=_0xdb28[_0x11837c];return _0x136dd1;};'use strict';var db=require(_0x8db2('0x0'))['db'];var config=require(_0x8db2('0x1'));var hardwareConf=require(_0x8db2('0x2'));var _=require(_0x8db2('0x3'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x8db2('0x4'));var compose=require(_0x8db2('0x5'));var basicAuth=require(_0x8db2('0x6'));var crypto=require(_0x8db2('0x7'));var BPromise=require(_0x8db2('0x8'));var validateJwt=expressJwt({'secret':config['secrets'][_0x8db2('0x9')]});var userAttributes=['id',_0x8db2('0xa'),'fullname','name',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'mailPause',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'pauseType',_0x8db2('0x15'),_0x8db2('0x16'),'lastPauseAt',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'phoneBarAutoAnswerDelay','phoneBarEnableRecording',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21'),_0x8db2('0x22'),_0x8db2('0x23'),_0x8db2('0x24')];exports[_0x8db2('0x25')]=function(){return this['isAuthenticated'](!![])[_0x8db2('0x26')](function(_0x24da1b,_0x48101e,_0x2b3f73){if(_0x24da1b[_0x8db2('0x27')]){_0x2b3f73();}else{return db[_0x8db2('0x28')][_0x8db2('0x29')]({'where':{'id':_0x24da1b[_0x8db2('0x2a')]['id']},'attributes':['id',_0x8db2('0x2b'),'disposition'],'raw':!![]})['then'](function(_0x77789){if(_0x77789&&_0x77789[_0x8db2('0x2b')]){return _0x48101e[_0x8db2('0x2c')](_0x77789[_0x8db2('0x2d')]==='unmanaged'?0x195:0x193)[_0x8db2('0x2e')]({'message':_0x77789[_0x8db2('0x2d')]===_0x8db2('0x2f')?_0x8db2('0x30'):_0x8db2('0x31')});}else{_0x2b3f73();}})['catch'](function(_0x124467){_0x2b3f73(_0x124467);});}});};exports[_0x8db2('0x32')]=function isAuthenticated(_0x18f69c){return compose()[_0x8db2('0x26')](function(_0x2260d8,_0x21704c,_0x796ec1){if(_0x2260d8['headers'][_0x8db2('0x33')]){if(_['startsWith'](_0x2260d8['headers']['authorization'],'Basic')){var _0xec8cd2=basicAuth(_0x2260d8);db[_0x8db2('0x34')][_0x8db2('0x35')]({'where':{'name':_0xec8cd2[_0x8db2('0x36')]}})[_0x8db2('0x37')](function(_0x8d4f54){if(!_0x8d4f54||!_0x8d4f54['authenticate'](_0xec8cd2[_0x8db2('0x38')])){return _0x21704c[_0x8db2('0x2c')](0x191)[_0x8db2('0x2e')]({'message':_0x8db2('0x39')});}_0x2260d8['user']={'id':_0x8d4f54['id']};_0x796ec1();})[_0x8db2('0x3a')](function(_0x11f398){_0x796ec1(_0x11f398);});}else if(_[_0x8db2('0x3b')](_0x2260d8[_0x8db2('0x3c')][_0x8db2('0x33')],_0x8db2('0x3d'))){validateJwt(_0x2260d8,_0x21704c,_0x796ec1);}else{if(_0x18f69c){_0x796ec1();}else{return _0x21704c[_0x8db2('0x2c')](0x193)[_0x8db2('0x2e')]({'message':_0x8db2('0x3e')});}}}else if(_0x2260d8['query'][_0x8db2('0x3f')]){try{var _0x50b28d={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x8db2('0x40')]()};verifyJwt(_0x2260d8[_0x8db2('0x41')][_0x8db2('0x3f')],_0x50b28d)['then'](function(_0x42b272){return db['User'][_0x8db2('0x35')]({'where':{'id':_0x42b272[_0x8db2('0x42')]}})[_0x8db2('0x37')](function(_0x4d9e26){if(!_0x4d9e26||!_['isEqual'](_0x4d9e26[_0x8db2('0x43')],_0x42b272[_0x8db2('0x44')])){return _0x21704c['status'](0x191)['json']({'message':_0x8db2('0x45')});}_0x2260d8[_0x8db2('0x27')]={'id':_0x4d9e26['id']};_0x796ec1();});})[_0x8db2('0x3a')](function(){return _0x21704c[_0x8db2('0x2c')](0x191)[_0x8db2('0x2e')]({'message':_0x8db2('0x46')});});}catch(_0x101711){_0x796ec1(_0x101711);}}else if(_0x18f69c){_0x796ec1();}else{return _0x21704c[_0x8db2('0x2c')](0x193)[_0x8db2('0x2e')]({'message':_0x8db2('0x3e')});}})['use'](function(_0x1ab5eb,_0x304a72,_0x5d2a5b){if(_0x1ab5eb[_0x8db2('0x27')]){db[_0x8db2('0x34')]['find']({'where':{'id':_0x1ab5eb['user']['id']},'attributes':userAttributes})[_0x8db2('0x37')](function(_0x4a45dd){if(!_0x4a45dd){return _0x304a72[_0x8db2('0x2c')](0x194)[_0x8db2('0x2e')]({'message':_0x8db2('0x47')});}_0x1ab5eb[_0x8db2('0x27')]=_0x4a45dd;_0x5d2a5b();})['catch'](function(_0x2d3e98){_0x5d2a5b(_0x2d3e98);});}else if(_0x18f69c){_0x5d2a5b();}else{return _0x304a72['status'](0x194)[_0x8db2('0x2e')]({'message':_0x8db2('0x48')});}});};exports[_0x8db2('0x49')]=function canUpdate(){return compose()[_0x8db2('0x26')](function(_0x50e88a,_0x50ee17,_0x2acd1f){return require(_0x8db2('0x4a'))['getLicense']()[_0x8db2('0x37')](function(_0x24bcfe){if(_0x24bcfe[_0x8db2('0x4b')]){_0x2acd1f();}else{return _0x50ee17['status'](0x193)[_0x8db2('0x2e')]({'message':_0x8db2('0x4c')});}})[_0x8db2('0x3a')](function(_0x279e74){_0x2acd1f(_0x279e74);});});};exports[_0x8db2('0x4d')]=function(_0x40d82a,_0x380046,_0x1575ea){_0x40d82a[_0x8db2('0x4d')]=!![];return _0x1575ea();};exports[_0x8db2('0x4e')]=function signToken(_0x21cf7c){return signJwt(_0x21cf7c);};exports[_0x8db2('0x4f')]=function(_0x1d9025,_0x4a1c60){if(!_0x1d9025[_0x8db2('0x27')]){return _0x4a1c60[_0x8db2('0x2c')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x249c73={'payload':{'id':_0x1d9025['user']['id'],'role':_0x1d9025[_0x8db2('0x27')][_0x8db2('0xa')]},'options':{'expiresIn':0x15180}};return signJwt(_0x249c73)[_0x8db2('0x37')](function(_0x307783){_0x4a1c60[_0x8db2('0x50')](_0x8db2('0x51'),_0x307783);_0x4a1c60[_0x8db2('0x52')]('/dashboards/general');})[_0x8db2('0x3a')](function(_0x3d44de){return _0x4a1c60[_0x8db2('0x2c')](0x1f4)[_0x8db2('0x53')](_0x3d44de);});};exports['retrieveApiKey']=function(_0x424c27){if(_[_0x8db2('0x54')](_0x424c27[_0x8db2('0x43')])||_[_0x8db2('0x54')](_0x424c27['apiKeyIat'])){return null;}else{return createJwt(_0x424c27);}};exports[_0x8db2('0x55')]=function(_0x4e0749){_0x4e0749[_0x8db2('0x43')]=generateNonce();_0x4e0749[_0x8db2('0x56')]=generateIssuedAt();return createJwt(_0x4e0749);};exports[_0x8db2('0x57')]=function(_0x4d2164,_0x4b0e72){var _0x1ec3d0=_0x4d2164['query'][_0x8db2('0x3f')];if(_0x1ec3d0){var _0x467866={'nonce':_0x4b0e72[_0x8db2('0x43')],'iat':_0x4b0e72[_0x8db2('0x56')],'audience':hardwareConf[_0x8db2('0x40')](),'issuer':hardwareConf[_0x8db2('0x40')]()};return verifyJwt(_0x1ec3d0,_0x467866)[_0x8db2('0x37')](function(){return generateApiKey(_0x4b0e72);});}else{throw{'message':_0x8db2('0x58')};}};function signJwt(_0x4291e3){var _0x12a1ef=BPromise[_0x8db2('0x59')](jwt[_0x8db2('0x5a')],{'context':jwt});var _0x532180=_0x4291e3[_0x8db2('0x5b')]||config[_0x8db2('0x5c')][_0x8db2('0x9')];return new BPromise(function(_0x3244db,_0x4f5018){_0x12a1ef(_0x4291e3['payload'],_0x532180,_0x4291e3[_0x8db2('0x5d')])[_0x8db2('0x37')](function(_0x164020){_0x3244db(_0x164020);})['catch'](function(_0x540d90){_0x4f5018(_0x540d90);});});}function verifyJwt(_0x494d6e,_0x44ac56,_0x368c37){var _0x55c7dd=BPromise[_0x8db2('0x59')](jwt[_0x8db2('0x5e')],{'context':jwt});var _0x4195ef=_0x368c37||config[_0x8db2('0x5c')]['session'];return new BPromise(function(_0x5329e6,_0x3d29bc){_0x55c7dd(_0x494d6e,_0x4195ef,_0x44ac56)[_0x8db2('0x37')](function(_0x2908e4){_0x5329e6(_0x2908e4);})[_0x8db2('0x3a')](function(_0x3daed6){_0x3d29bc(_0x3daed6);});});}function generateNonce(){return crypto[_0x8db2('0x5f')](0x10)[_0x8db2('0x60')](_0x8db2('0x61'));}function generateIssuedAt(){return Math[_0x8db2('0x62')](Date[_0x8db2('0x63')]()/0x3e8)[_0x8db2('0x60')]();}function createJwt(_0x319273){var _0x345c74={'payload':{'iat':_0x319273[_0x8db2('0x56')],'nonce':_0x319273[_0x8db2('0x43')]},'options':{'algorithm':'HS512','subject':_0x319273['id'][_0x8db2('0x60')](),'issuer':hardwareConf[_0x8db2('0x40')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x345c74)[_0x8db2('0x37')](function(_0xd78022){return{'iat':_0x319273[_0x8db2('0x56')],'nonce':_0x319273['apiKeyNonce'],'token':_0xd78022};});} \ No newline at end of file +var _0xdd4f=['fullname','name','internal','userpic','md5secret','voicePause','chatPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','hotdesk','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','use','headers','startsWith','authorization','User','find','authenticate','pass','Wrong\x20credentials.','catch','Bearer','query','apikey','getUuid','nonce','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secret','secrets','payload','options','randomBytes','toString','hex','floor','HS512','../../mysqldb','jsonwebtoken','express-jwt','basic-auth','crypto','bluebird','session','role'];(function(_0x172a24,_0x319bf){var _0x5ae1cf=function(_0x5c1288){while(--_0x5c1288){_0x172a24['push'](_0x172a24['shift']());}};_0x5ae1cf(++_0x319bf);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x537edf,_0x3ad48a){_0x537edf=_0x537edf-0x0;var _0x130950=_0xdd4f[_0x537edf];return _0x130950;};'use strict';var db=require(_0xfdd4('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require('../../config/license/hardware');var _=require('lodash');var jwt=require(_0xfdd4('0x1'));var expressJwt=require(_0xfdd4('0x2'));var compose=require('composable-middleware');var basicAuth=require(_0xfdd4('0x3'));var crypto=require(_0xfdd4('0x4'));var BPromise=require(_0xfdd4('0x5'));var validateJwt=expressJwt({'secret':config['secrets'][_0xfdd4('0x6')]});var userAttributes=['id',_0xfdd4('0x7'),_0xfdd4('0x8'),_0xfdd4('0x9'),_0xfdd4('0xa'),'email',_0xfdd4('0xb'),'permissions',_0xfdd4('0xc'),_0xfdd4('0xd'),_0xfdd4('0xe'),'mailPause',_0xfdd4('0xf'),'smsPause',_0xfdd4('0x10'),_0xfdd4('0x11'),_0xfdd4('0x12'),_0xfdd4('0x13'),_0xfdd4('0x14'),_0xfdd4('0x15'),_0xfdd4('0x16'),_0xfdd4('0x17'),_0xfdd4('0x18'),_0xfdd4('0x19'),_0xfdd4('0x1a'),'phoneBarEnableRecording',_0xfdd4('0x1b'),_0xfdd4('0x1c'),_0xfdd4('0x1d'),'phoneBarPrefixRequired',_0xfdd4('0x1e'),'phoneBarRemoteControlPort',_0xfdd4('0x1f'),_0xfdd4('0x20'),_0xfdd4('0x21')];exports[_0xfdd4('0x22')]=function(){return this[_0xfdd4('0x23')](!![])['use'](function(_0x47ed1d,_0x559c77,_0x3a966d){if(_0x47ed1d[_0xfdd4('0x24')]){_0x3a966d();}else{return db[_0xfdd4('0x25')][_0xfdd4('0x26')]({'where':{'id':_0x47ed1d[_0xfdd4('0x27')]['id']},'attributes':['id',_0xfdd4('0x28'),_0xfdd4('0x29')],'raw':!![]})[_0xfdd4('0x2a')](function(_0x32e00d){if(_0x32e00d&&_0x32e00d['closed']){return _0x559c77[_0xfdd4('0x2b')](_0x32e00d[_0xfdd4('0x29')]===_0xfdd4('0x2c')?0x195:0x193)[_0xfdd4('0x2d')]({'message':_0x32e00d[_0xfdd4('0x29')]===_0xfdd4('0x2c')?_0xfdd4('0x2e'):_0xfdd4('0x2f')});}else{_0x3a966d();}})['catch'](function(_0x2147e6){_0x3a966d(_0x2147e6);});}});};exports[_0xfdd4('0x23')]=function isAuthenticated(_0x2a24e8){return compose()[_0xfdd4('0x30')](function(_0xb7856d,_0x144acd,_0x451767){if(_0xb7856d[_0xfdd4('0x31')]['authorization']){if(_[_0xfdd4('0x32')](_0xb7856d[_0xfdd4('0x31')][_0xfdd4('0x33')],'Basic')){var _0x58fe0d=basicAuth(_0xb7856d);db[_0xfdd4('0x34')][_0xfdd4('0x35')]({'where':{'name':_0x58fe0d[_0xfdd4('0x9')]}})[_0xfdd4('0x2a')](function(_0x4a8790){if(!_0x4a8790||!_0x4a8790[_0xfdd4('0x36')](_0x58fe0d[_0xfdd4('0x37')])){return _0x144acd[_0xfdd4('0x2b')](0x191)[_0xfdd4('0x2d')]({'message':_0xfdd4('0x38')});}_0xb7856d[_0xfdd4('0x24')]={'id':_0x4a8790['id']};_0x451767();})[_0xfdd4('0x39')](function(_0x37b7a2){_0x451767(_0x37b7a2);});}else if(_['startsWith'](_0xb7856d[_0xfdd4('0x31')][_0xfdd4('0x33')],_0xfdd4('0x3a'))){validateJwt(_0xb7856d,_0x144acd,_0x451767);}else{if(_0x2a24e8){_0x451767();}else{return _0x144acd[_0xfdd4('0x2b')](0x193)[_0xfdd4('0x2d')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0xb7856d[_0xfdd4('0x3b')][_0xfdd4('0x3c')]){try{var _0xbf38b4={'audience':hardwareConf[_0xfdd4('0x3d')](),'issuer':hardwareConf[_0xfdd4('0x3d')]()};verifyJwt(_0xb7856d['query'][_0xfdd4('0x3c')],_0xbf38b4)[_0xfdd4('0x2a')](function(_0x2ab99e){return db['User'][_0xfdd4('0x35')]({'where':{'id':_0x2ab99e['sub']}})[_0xfdd4('0x2a')](function(_0x2b22f9){if(!_0x2b22f9||!_['isEqual'](_0x2b22f9['apiKeyNonce'],_0x2ab99e[_0xfdd4('0x3e')])){return _0x144acd[_0xfdd4('0x2b')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0xb7856d[_0xfdd4('0x24')]={'id':_0x2b22f9['id']};_0x451767();});})[_0xfdd4('0x39')](function(){return _0x144acd[_0xfdd4('0x2b')](0x191)[_0xfdd4('0x2d')]({'message':_0xfdd4('0x3f')});});}catch(_0x265cab){_0x451767(_0x265cab);}}else if(_0x2a24e8){_0x451767();}else{return _0x144acd[_0xfdd4('0x2b')](0x193)[_0xfdd4('0x2d')]({'message':_0xfdd4('0x40')});}})[_0xfdd4('0x30')](function(_0x6ffe30,_0x12b8b1,_0xa5c90e){if(_0x6ffe30[_0xfdd4('0x24')]){db[_0xfdd4('0x34')][_0xfdd4('0x35')]({'where':{'id':_0x6ffe30[_0xfdd4('0x24')]['id']},'attributes':userAttributes})[_0xfdd4('0x2a')](function(_0x2abe77){if(!_0x2abe77){return _0x12b8b1[_0xfdd4('0x2b')](0x194)[_0xfdd4('0x2d')]({'message':_0xfdd4('0x41')});}_0x6ffe30[_0xfdd4('0x24')]=_0x2abe77;_0xa5c90e();})[_0xfdd4('0x39')](function(_0x301824){_0xa5c90e(_0x301824);});}else if(_0x2a24e8){_0xa5c90e();}else{return _0x12b8b1[_0xfdd4('0x2b')](0x194)['json']({'message':_0xfdd4('0x42')});}});};exports[_0xfdd4('0x43')]=function canUpdate(){return compose()[_0xfdd4('0x30')](function(_0x439389,_0x2850f5,_0x5842f1){return require('../../config/license/util')[_0xfdd4('0x44')]()['then'](function(_0xeca9d){if(_0xeca9d[_0xfdd4('0x45')]){_0x5842f1();}else{return _0x2850f5[_0xfdd4('0x2b')](0x193)[_0xfdd4('0x2d')]({'message':'Forbidden'});}})[_0xfdd4('0x39')](function(_0x3feb36){_0x5842f1(_0x3feb36);});});};exports[_0xfdd4('0x46')]=function(_0x2ee857,_0x35b719,_0x7e171){_0x2ee857[_0xfdd4('0x46')]=!![];return _0x7e171();};exports[_0xfdd4('0x47')]=function signToken(_0xe65944){return signJwt(_0xe65944);};exports[_0xfdd4('0x48')]=function(_0x5bcbc8,_0xa7d254){if(!_0x5bcbc8[_0xfdd4('0x24')]){return _0xa7d254[_0xfdd4('0x2b')](0x194)[_0xfdd4('0x2d')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x3e2bda={'payload':{'id':_0x5bcbc8[_0xfdd4('0x24')]['id'],'role':_0x5bcbc8[_0xfdd4('0x24')][_0xfdd4('0x7')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3e2bda)[_0xfdd4('0x2a')](function(_0x496747){_0xa7d254[_0xfdd4('0x49')](_0xfdd4('0x4a'),_0x496747);_0xa7d254[_0xfdd4('0x4b')](_0xfdd4('0x4c'));})[_0xfdd4('0x39')](function(_0x1fc778){return _0xa7d254[_0xfdd4('0x2b')](0x1f4)['send'](_0x1fc778);});};exports[_0xfdd4('0x4d')]=function(_0x586713){if(_[_0xfdd4('0x4e')](_0x586713[_0xfdd4('0x4f')])||_[_0xfdd4('0x4e')](_0x586713[_0xfdd4('0x50')])){return null;}else{return createJwt(_0x586713);}};exports['generateApiKey']=function(_0x419578){_0x419578[_0xfdd4('0x4f')]=generateNonce();_0x419578['apiKeyIat']=generateIssuedAt();return createJwt(_0x419578);};exports[_0xfdd4('0x51')]=function(_0xbfaa53,_0x48d422){var _0x218ca5=_0xbfaa53['query']['apikey'];if(_0x218ca5){var _0x4c3dbf={'nonce':_0x48d422[_0xfdd4('0x4f')],'iat':_0x48d422[_0xfdd4('0x50')],'audience':hardwareConf[_0xfdd4('0x3d')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x218ca5,_0x4c3dbf)[_0xfdd4('0x2a')](function(){return generateApiKey(_0x48d422);});}else{throw{'message':_0xfdd4('0x52')};}};function signJwt(_0x4d11d1){var _0x25e3c9=BPromise[_0xfdd4('0x53')](jwt[_0xfdd4('0x54')],{'context':jwt});var _0x2bb94a=_0x4d11d1[_0xfdd4('0x55')]||config[_0xfdd4('0x56')][_0xfdd4('0x6')];return new BPromise(function(_0x2bec0c,_0x393c11){_0x25e3c9(_0x4d11d1[_0xfdd4('0x57')],_0x2bb94a,_0x4d11d1[_0xfdd4('0x58')])[_0xfdd4('0x2a')](function(_0x300965){_0x2bec0c(_0x300965);})[_0xfdd4('0x39')](function(_0x55065e){_0x393c11(_0x55065e);});});}function verifyJwt(_0x4dd1a2,_0x43e631,_0x222902){var _0x1296e6=BPromise[_0xfdd4('0x53')](jwt['verify'],{'context':jwt});var _0x3c6828=_0x222902||config[_0xfdd4('0x56')]['session'];return new BPromise(function(_0x58cdab,_0x53c66d){_0x1296e6(_0x4dd1a2,_0x3c6828,_0x43e631)['then'](function(_0x557cb3){_0x58cdab(_0x557cb3);})[_0xfdd4('0x39')](function(_0x88e9ef){_0x53c66d(_0x88e9ef);});});}function generateNonce(){return crypto[_0xfdd4('0x59')](0x10)[_0xfdd4('0x5a')](_0xfdd4('0x5b'));}function generateIssuedAt(){return Math[_0xfdd4('0x5c')](Date['now']()/0x3e8)[_0xfdd4('0x5a')]();}function createJwt(_0x1f521a){var _0x1dd417={'payload':{'iat':_0x1f521a[_0xfdd4('0x50')],'nonce':_0x1f521a['apiKeyNonce']},'options':{'algorithm':_0xfdd4('0x5d'),'subject':_0x1f521a['id'][_0xfdd4('0x5a')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xfdd4('0x3d')]()}};return signJwt(_0x1dd417)[_0xfdd4('0x2a')](function(_0x555e50){return{'iat':_0x1f521a['apiKeyIat'],'nonce':_0x1f521a[_0xfdd4('0x4f')],'token':_0x555e50};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index d257608..621a476 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 _0x70e0=['createDecipher','algorithm','data','close','unlink','crypto','bluebird','aes192','hasOwnProperty','createReadStream','createWriteStream','createCipher','update','binary','write','end','final'];(function(_0x39ebbc,_0x5a23f6){var _0x178e6c=function(_0x8c141f){while(--_0x8c141f){_0x39ebbc['push'](_0x39ebbc['shift']());}};_0x178e6c(++_0x5a23f6);}(_0x70e0,0x17b));var _0x070e=function(_0x218ef9,_0x5d7089){_0x218ef9=_0x218ef9-0x0;var _0x57b6a1=_0x70e0[_0x218ef9];return _0x57b6a1;};'use strict';var crypto=require(_0x070e('0x0'));var fs=require('fs');var BPromise=require(_0x070e('0x1'));var defaultOptions={'algorithm':_0x070e('0x2')};function combineOptions(_0x4d95bb){var _0x579b83={};for(var _0x16e651 in defaultOptions){if(defaultOptions[_0x070e('0x3')](_0x16e651)){_0x579b83[_0x16e651]=defaultOptions[_0x16e651];}}if(_0x4d95bb){for(var _0x277d32 in _0x4d95bb){if(_0x4d95bb[_0x070e('0x3')](_0x277d32)){_0x579b83[_0x277d32]=_0x4d95bb[_0x277d32];}}}return _0x579b83;}exports['encryptFile']=function(_0x7bce9b,_0x579a6b,_0x46fe68,_0x4b041d){return new BPromise(function(_0x56e420,_0x5032e5){_0x4b041d=combineOptions(_0x4b041d);var _0x35ab0c=new Buffer(_0x46fe68);var _0x1e11f0=fs[_0x070e('0x4')](_0x7bce9b);var _0x2611e6=fs[_0x070e('0x5')](_0x579a6b);var _0x68a09e=crypto[_0x070e('0x6')](_0x4b041d['algorithm'],_0x35ab0c);_0x1e11f0['on']('data',function(_0x50f4eb){var _0x2e3e5e=new Buffer(_0x68a09e[_0x070e('0x7')](_0x50f4eb),_0x070e('0x8'));_0x2611e6[_0x070e('0x9')](_0x2e3e5e);});_0x1e11f0['on'](_0x070e('0xa'),function(){try{var _0x25cfe1=new Buffer(_0x68a09e[_0x070e('0xb')](_0x070e('0x8')),_0x070e('0x8'));_0x2611e6[_0x070e('0x9')](_0x25cfe1);_0x2611e6['end']();_0x2611e6['on']('close',function(){return _0x56e420(_0x579a6b);});}catch(_0x24baba){fs['unlink'](_0x579a6b);return _0x5032e5(_0x24baba);}});});};exports['decryptFile']=function(_0x5bae0f,_0x11d2ce,_0x14c3fd,_0x51d14d){return new BPromise(function(_0x5d3a38,_0x373d86){_0x51d14d=combineOptions(_0x51d14d);var _0xeae1a5=new Buffer(_0x14c3fd);var _0x180897=fs[_0x070e('0x4')](_0x5bae0f);var _0x5bc71e=fs['createWriteStream'](_0x11d2ce);var _0x17e2e4=crypto[_0x070e('0xc')](_0x51d14d[_0x070e('0xd')],_0xeae1a5);_0x180897['on'](_0x070e('0xe'),function(_0x364b3f){var _0x5037eb=new Buffer(_0x17e2e4[_0x070e('0x7')](_0x364b3f),_0x070e('0x8'));_0x5bc71e[_0x070e('0x9')](_0x5037eb);});_0x180897['on'](_0x070e('0xa'),function(){try{var _0x259893=new Buffer(_0x17e2e4['final']('binary'),'binary');_0x5bc71e[_0x070e('0x9')](_0x259893);_0x5bc71e[_0x070e('0xa')]();_0x5bc71e['on'](_0x070e('0xf'),function(){return _0x5d3a38(_0x11d2ce);});}catch(_0x4be0d7){fs[_0x070e('0x10')](_0x11d2ce);return _0x373d86(_0x4be0d7);}});});}; \ No newline at end of file +var _0x0713=['aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','binary','write','end','final','close','decryptFile','createDecipher','update','unlink'];(function(_0x4ffec2,_0x39a42c){var _0x1dccc3=function(_0x3b619f){while(--_0x3b619f){_0x4ffec2['push'](_0x4ffec2['shift']());}};_0x1dccc3(++_0x39a42c);}(_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 diff --git a/server/components/export/csv.js b/server/components/export/csv.js index b89fa5d..e64e28f 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 _0x4ea3=['split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','basename','.csv','join','mkdirSync','each','%s%d.%s','csv','writeFileSync','%s.%s','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','catch','inspect','util','path','lodash','to-csv','zip-dir','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting'];(function(_0x504418,_0x134d04){var _0x88283e=function(_0x4335e8){while(--_0x4335e8){_0x504418['push'](_0x504418['shift']());}};_0x88283e(++_0x134d04);}(_0x4ea3,0x70));var _0x34ea=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4ea3[_0x397e5f];return _0x5302b8;};'use strict';var util=require(_0x34ea('0x0'));var path=require(_0x34ea('0x1'));var _=require(_0x34ea('0x2'));var csv=require(_0x34ea('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x34ea('0x4'));var rimraf=require('rimraf');var db=require(_0x34ea('0x5'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x34ea('0x6'))(_0x34ea('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x34ea('0x8')][0x2]);var QUERY=process[_0x34ea('0x8')][0x3];var PATH=process[_0x34ea('0x8')][0x4];function analyticExtractedReport(_0x18b461,_0x22b09e){var _0x5bec7c={'status':_0x18b461};var _0x341727={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x22b09e){_0x5bec7c[_0x34ea('0x9')]=_0x22b09e;}return db[_0x34ea('0xa')]['update'](_0x5bec7c,_0x341727);}function main(){var _0x301b98=0x1388;var _0xea1be2;logger['info'](util['format'](_0x34ea('0xb'),EXTRACTED_REPORT_ID,_0x34ea('0xc')));return db[_0x34ea('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x34ea('0xe'),_0x34ea('0xf')]})[_0x34ea('0x10')](function(_0x233b11){if(_0x233b11){_0xea1be2=_0x233b11;_0x301b98=_0xea1be2[_0x34ea('0xf')]||0x1388;}})[_0x34ea('0x10')](function(){return dbH[_0x34ea('0x11')][_0x34ea('0x12')](util[_0x34ea('0x13')](_0x34ea('0x14'),QUERY),{'type':dbH[_0x34ea('0x11')]['QueryTypes'][_0x34ea('0x15')]});})[_0x34ea('0x10')](function(_0x14ebb9){if(!_0x14ebb9[0x0][_0x34ea('0x16')]){return analyticExtractedReport(_0x34ea('0x17'));}var _0x56b2d7=[];var _0x6a84a7=0x0;var _0x18c013=!![];if(_0x14ebb9&&_0x14ebb9[_0x34ea('0x18')]){var _0x305576=_0x14ebb9[0x0]['num']%(_0x6a84a7+_0x301b98);if(_0xea1be2[_0x34ea('0xe')]){for(;_0x18c013;_0x6a84a7+=_0x301b98,_0x305576=_0x14ebb9[0x0][_0x34ea('0x16')]%(_0x6a84a7+_0x301b98)){if(_0x305576==0x0||_0x305576==_0x14ebb9[0x0][_0x34ea('0x16')]){_0x18c013=![];}_0x56b2d7['push'](dbH[_0x34ea('0x11')][_0x34ea('0x12')](util[_0x34ea('0x13')](_0x34ea('0x19'),QUERY,_0x301b98,_0x6a84a7),{'type':dbH['sequelize'][_0x34ea('0x1a')][_0x34ea('0x15')]}));}}else{_0x56b2d7[_0x34ea('0x1b')](dbH[_0x34ea('0x11')]['query'](QUERY,{'type':dbH['sequelize'][_0x34ea('0x1a')][_0x34ea('0x15')]}));}}var _0x151fae=path['dirname'](PATH);var _0x5197a2=path[_0x34ea('0x1c')](PATH,_0x34ea('0x1d'));var _0x2a0ec2=_0xea1be2[_0x34ea('0xe')]&&_0x56b2d7[_0x34ea('0x18')]>0x1;var _0x697475=[];if(!fs['existsSync'](path[_0x34ea('0x1e')](_0x151fae,_0x5197a2))&&_0x2a0ec2){fs[_0x34ea('0x1f')](path[_0x34ea('0x1e')](_0x151fae,_0x5197a2));}return BPromise[_0x34ea('0x20')](_0x56b2d7,function(_0x5b5885){_0x697475['push'](_0x5b5885);})['then'](function(){for(var _0x142709=0x0;_0x142709<_0x697475[_0x34ea('0x18')];_0x142709+=0x1){var _0x37c214;var _0x4204d7=_0x697475[_0x142709];if(_0x2a0ec2){_0x37c214=path['join'](_0x151fae,_0x5197a2,util[_0x34ea('0x13')](_0x34ea('0x21'),_0x5197a2,_0x142709,_0x34ea('0x22')));}else{_0x37c214=path['join'](_0x151fae,util['format']('%s.%s',_0x5197a2,'csv'));}fs[_0x34ea('0x23')](_0x37c214,csv(_0x4204d7));}})[_0x34ea('0x10')](function(){if(_0x2a0ec2){zipdir(path[_0x34ea('0x1e')](_0x151fae,_0x5197a2),{'saveTo':path[_0x34ea('0x1e')](_0x151fae,util['format'](_0x34ea('0x24'),_0x5197a2,'zip'))},function(_0x2c6de8,_0x4f2b77){});rimraf(path[_0x34ea('0x1e')](_0x151fae,_0x5197a2),function(){});}})[_0x34ea('0x10')](function(){logger[_0x34ea('0x25')](util['format'](_0x34ea('0x26'),EXTRACTED_REPORT_ID,_0x34ea('0xc')));return analyticExtractedReport('Completed',_0x2a0ec2?util[_0x34ea('0x13')]('%s.%s',_0x5197a2,_0x2a0ec2?_0x34ea('0x27'):_0x34ea('0x22')):null);});})[_0x34ea('0x28')](function(_0x5ead76){logger['info'](util[_0x34ea('0x13')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x34ea('0xc')),util[_0x34ea('0x29')](_0x5ead76,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0xb4e6=['splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','split','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','length','existsSync','mkdirSync','join','each','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','CSV','inspect','Failed','util','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find'];(function(_0x597fd6,_0x22ef0b){var _0x4c4420=function(_0x49297f){while(--_0x49297f){_0x597fd6['push'](_0x597fd6['shift']());}};_0x4c4420(++_0x22ef0b);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x1a21ff,_0x4a7550){_0x1a21ff=_0x1a21ff-0x0;var _0x25afc1=_0xb4e6[_0x1a21ff];return _0x25afc1;};'use strict';var util=require(_0x6b4e('0x0'));var path=require('path');var _=require(_0x6b4e('0x1'));var csv=require(_0x6b4e('0x2'));var fs=require('fs');var BPromise=require(_0x6b4e('0x3'));var zipdir=require(_0x6b4e('0x4'));var rimraf=require(_0x6b4e('0x5'));var db=require(_0x6b4e('0x6'))['db'];var dbH=require(_0x6b4e('0x6'))['dbH'];var logger=require(_0x6b4e('0x7'))(_0x6b4e('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x6b4e('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x6b4e('0x9')][0x4];function analyticExtractedReport(_0x570346,_0x4f00be){var _0x2311d9={'status':_0x570346};var _0x48c870={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4f00be){_0x2311d9['savename']=_0x4f00be;}return db[_0x6b4e('0xa')][_0x6b4e('0xb')](_0x2311d9,_0x48c870);}function main(){var _0x1e3bf6=0x1388;var _0x39ed74;logger[_0x6b4e('0xc')](util[_0x6b4e('0xd')](_0x6b4e('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x6b4e('0xf')][_0x6b4e('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x6b4e('0x11')]})[_0x6b4e('0x12')](function(_0x432399){if(_0x432399){_0x39ed74=_0x432399;_0x1e3bf6=_0x39ed74[_0x6b4e('0x11')]||0x1388;}})[_0x6b4e('0x12')](function(){return dbH[_0x6b4e('0x13')][_0x6b4e('0x14')](util['format'](_0x6b4e('0x15'),QUERY),{'type':dbH[_0x6b4e('0x13')]['QueryTypes'][_0x6b4e('0x16')]});})['then'](function(_0x355f10){if(!_0x355f10[0x0][_0x6b4e('0x17')]){return analyticExtractedReport(_0x6b4e('0x18'));}var _0x42e265=[];var _0x28c3ba=0x0;var _0x135568=!![];if(_0x355f10&&_0x355f10['length']){var _0x5775f4=_0x355f10[0x0][_0x6b4e('0x17')]%(_0x28c3ba+_0x1e3bf6);if(_0x39ed74[_0x6b4e('0x19')]){for(;_0x135568;_0x28c3ba+=_0x1e3bf6,_0x5775f4=_0x355f10[0x0][_0x6b4e('0x17')]%(_0x28c3ba+_0x1e3bf6)){if(_0x5775f4==0x0||_0x5775f4==_0x355f10[0x0][_0x6b4e('0x17')]){_0x135568=![];}_0x42e265[_0x6b4e('0x1a')](dbH[_0x6b4e('0x13')][_0x6b4e('0x14')](util[_0x6b4e('0xd')](_0x6b4e('0x1b'),QUERY,_0x1e3bf6,_0x28c3ba),{'type':dbH[_0x6b4e('0x13')][_0x6b4e('0x1c')]['SELECT']}));}}else{_0x42e265[_0x6b4e('0x1a')](dbH[_0x6b4e('0x13')][_0x6b4e('0x14')](QUERY,{'type':dbH[_0x6b4e('0x13')]['QueryTypes'][_0x6b4e('0x16')]}));}}var _0x507703=path[_0x6b4e('0x1d')](PATH);var _0x163dea=path[_0x6b4e('0x1e')](PATH,_0x6b4e('0x1f'));var _0xa06ccd=_0x39ed74[_0x6b4e('0x19')]&&_0x42e265[_0x6b4e('0x20')]>0x1;var _0x5c33be=[];if(!fs[_0x6b4e('0x21')](path['join'](_0x507703,_0x163dea))&&_0xa06ccd){fs[_0x6b4e('0x22')](path[_0x6b4e('0x23')](_0x507703,_0x163dea));}return BPromise[_0x6b4e('0x24')](_0x42e265,function(_0xdba4fe){_0x5c33be['push'](_0xdba4fe);})[_0x6b4e('0x12')](function(){for(var _0x3f72d7=0x0;_0x3f72d7<_0x5c33be['length'];_0x3f72d7+=0x1){var _0x32102f;var _0x381ff0=_0x5c33be[_0x3f72d7];if(_0xa06ccd){_0x32102f=path[_0x6b4e('0x23')](_0x507703,_0x163dea,util[_0x6b4e('0xd')]('%s%d.%s',_0x163dea,_0x3f72d7,_0x6b4e('0x25')));}else{_0x32102f=path[_0x6b4e('0x23')](_0x507703,util['format'](_0x6b4e('0x26'),_0x163dea,_0x6b4e('0x25')));}fs[_0x6b4e('0x27')](_0x32102f,csv(_0x381ff0));}})[_0x6b4e('0x12')](function(){if(_0xa06ccd){zipdir(path['join'](_0x507703,_0x163dea),{'saveTo':path[_0x6b4e('0x23')](_0x507703,util[_0x6b4e('0xd')]('%s.%s',_0x163dea,_0x6b4e('0x28')))},function(_0x3f9868,_0x37b636){});rimraf(path['join'](_0x507703,_0x163dea),function(){});}})['then'](function(){logger[_0x6b4e('0xc')](util[_0x6b4e('0xd')](_0x6b4e('0x29'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x6b4e('0x2a'),_0xa06ccd?util[_0x6b4e('0xd')](_0x6b4e('0x26'),_0x163dea,_0xa06ccd?'zip':'csv'):null);});})[_0x6b4e('0x2b')](function(_0x4952ef){logger[_0x6b4e('0xc')](util[_0x6b4e('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6b4e('0x2c')),util[_0x6b4e('0x2d')](_0x4952ef,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x6b4e('0x2e'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index b71938a..0b17aed 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x1aad7c,_0x30c512){var _0x8d1c20=function(_0x2b3d59){while(--_0x2b3d59){_0x1aad7c['push'](_0x1aad7c['shift']());}};_0x8d1c20(++_0x30c512);}(_0xb10b,0x12a));var _0xbb10=function(_0x1ae31c,_0x8dcd2d){_0x1ae31c=_0x1ae31c-0x0;var _0x19519d=_0xb10b[_0x1ae31c];return _0x19519d;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file +var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x475ba6,_0x2a3b90){var _0x530c18=function(_0x2f2e63){while(--_0x2f2e63){_0x475ba6['push'](_0x475ba6['shift']());}};_0x530c18(++_0x2a3b90);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b9f35,_0x287585){_0x4b9f35=_0x4b9f35-0x0;var _0x200ea1=_0xb10b[_0x4b9f35];return _0x200ea1;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 70208aa..d74ec52 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 _0x6233=['format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info'];(function(_0x19dc78,_0x250c0){var _0x5b8e04=function(_0x21afe2){while(--_0x21afe2){_0x19dc78['push'](_0x19dc78['shift']());}};_0x5b8e04(++_0x250c0);}(_0x6233,0xba));var _0x3623=function(_0x5221cb,_0x105f65){_0x5221cb=_0x5221cb-0x0;var _0x1d514c=_0x6233[_0x5221cb];return _0x1d514c;};'use strict';var util=require(_0x3623('0x0'));var path=require('path');var _=require(_0x3623('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x3623('0x2'));var zipdir=require(_0x3623('0x3'));var rimraf=require(_0x3623('0x4'));var db=require(_0x3623('0x5'))['db'];var dbH=require(_0x3623('0x5'))[_0x3623('0x6')];var logger=require(_0x3623('0x7'))(_0x3623('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x3623('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x452543,_0x51f71c){var _0x18bfb6={'status':_0x452543};var _0x2dd07e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x51f71c){_0x18bfb6[_0x3623('0xa')]=_0x51f71c;}return db[_0x3623('0xb')][_0x3623('0xc')](_0x18bfb6,_0x2dd07e);}function main(){var _0x320a9c=0x1388;var _0x21084b;logger[_0x3623('0xd')](util[_0x3623('0xe')](_0x3623('0xf'),EXTRACTED_REPORT_ID,_0x3623('0x10')));return db[_0x3623('0x11')][_0x3623('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3623('0x13'),_0x3623('0x14')]})[_0x3623('0x15')](function(_0xc5697b){if(_0xc5697b){_0x21084b=_0xc5697b;_0x320a9c=_0x21084b[_0x3623('0x14')]||0x1388;}})['then'](function(){return dbH[_0x3623('0x16')][_0x3623('0x17')](util['format'](_0x3623('0x18'),QUERY),{'type':dbH[_0x3623('0x16')]['QueryTypes'][_0x3623('0x19')]});})[_0x3623('0x15')](function(_0x8823a3){if(!_0x8823a3[0x0][_0x3623('0x1a')]){return analyticExtractedReport(_0x3623('0x1b'));}var _0x58a02a=[];var _0x2ea496=0x0;var _0x46ae14=!![];if(_0x21084b[_0x3623('0x13')]){if(_0x8823a3&&_0x8823a3[_0x3623('0x1c')]){var _0x5d4fea=_0x8823a3[0x0][_0x3623('0x1a')]%(_0x2ea496+_0x320a9c);for(;_0x46ae14;_0x2ea496+=_0x320a9c,_0x5d4fea=_0x8823a3[0x0][_0x3623('0x1a')]%(_0x2ea496+_0x320a9c)){if(_0x5d4fea==0x0||_0x5d4fea==_0x8823a3[0x0]['num']){_0x46ae14=![];}_0x58a02a[_0x3623('0x1d')](dbH[_0x3623('0x16')][_0x3623('0x17')](util['format'](_0x3623('0x1e'),QUERY,_0x320a9c,_0x2ea496),{'type':dbH[_0x3623('0x16')]['QueryTypes'][_0x3623('0x19')]}));}}}else{_0x58a02a[_0x3623('0x1d')](dbH[_0x3623('0x16')][_0x3623('0x17')](QUERY,{'type':dbH[_0x3623('0x16')][_0x3623('0x1f')][_0x3623('0x19')]}));}var _0x3fd2e3=path[_0x3623('0x20')](PATH);var _0x395e11=path[_0x3623('0x21')](PATH,_0x3623('0x22'));var _0x4f6417=_0x21084b['split']&&_0x58a02a[_0x3623('0x1c')]>0x1;var _0x18492f=[];if(!fs[_0x3623('0x23')](path[_0x3623('0x24')](_0x3fd2e3,_0x395e11))&&_0x4f6417){fs[_0x3623('0x25')](path[_0x3623('0x24')](_0x3fd2e3,_0x395e11));}return BPromise[_0x3623('0x26')](_0x58a02a,function(_0x49ef07){_0x18492f[_0x3623('0x1d')](_0x49ef07);})['then'](function(){for(var _0x3de7a2=0x0;_0x3de7a2<_0x18492f[_0x3623('0x1c')];_0x3de7a2+=0x1){var _0x41ef71;var _0x4aa85f=_0x18492f[_0x3de7a2];if(_0x4f6417){_0x41ef71=path['join'](_0x3fd2e3,_0x395e11,util[_0x3623('0xe')](_0x3623('0x27'),_0x395e11,_0x3de7a2,'xlsx'));}else{_0x41ef71=path['join'](_0x3fd2e3,util[_0x3623('0xe')]('%s.%s',_0x395e11,_0x3623('0x28')));}fs[_0x3623('0x29')](_0x41ef71,json2xls(_0x4aa85f),_0x3623('0x2a'));}})[_0x3623('0x15')](function(){if(_0x4f6417){zipdir(path[_0x3623('0x24')](_0x3fd2e3,_0x395e11),{'saveTo':path[_0x3623('0x24')](_0x3fd2e3,util[_0x3623('0xe')](_0x3623('0x2b'),_0x395e11,_0x3623('0x2c')))},function(_0x455dc7,_0x1beafd){});rimraf(path[_0x3623('0x24')](_0x3fd2e3,_0x395e11),function(){});}})[_0x3623('0x15')](function(){logger['info'](util[_0x3623('0xe')](_0x3623('0x2d'),EXTRACTED_REPORT_ID,_0x3623('0x10')));return analyticExtractedReport(_0x3623('0x2e'),_0x4f6417?util[_0x3623('0xe')](_0x3623('0x2b'),_0x395e11,_0x4f6417?_0x3623('0x2c'):'xlsx'):null);});})['catch'](function(_0x348e11){logger[_0x3623('0xd')](util[_0x3623('0xe')](_0x3623('0x2f'),EXTRACTED_REPORT_ID,_0x3623('0x10')),util[_0x3623('0x30')](_0x348e11,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x3623('0x31'));});}main(); \ No newline at end of file +var _0x9f53=['push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','existsSync','join','mkdirSync','each','xlsx','%s.%s','writeFileSync','binary','Completed','zip','catch','inspect','Failed','util','path','lodash','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','split','splitSizeXlsx','then','sequelize','query','format','QueryTypes','length','num'];(function(_0x54bb75,_0x124e89){var _0xd691f7=function(_0x3a06bd){while(--_0x3a06bd){_0x54bb75['push'](_0x54bb75['shift']());}};_0xd691f7(++_0x124e89);}(_0x9f53,0xfb));var _0x39f5=function(_0x58c00b,_0x47d668){_0x58c00b=_0x58c00b-0x0;var _0x367755=_0x9f53[_0x58c00b];return _0x367755;};'use strict';var util=require(_0x39f5('0x0'));var path=require(_0x39f5('0x1'));var _=require(_0x39f5('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x39f5('0x3'));var zipdir=require(_0x39f5('0x4'));var rimraf=require('rimraf');var db=require(_0x39f5('0x5'))['db'];var dbH=require(_0x39f5('0x5'))[_0x39f5('0x6')];var logger=require(_0x39f5('0x7'))(_0x39f5('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x39f5('0x9')][0x2]);var QUERY=process[_0x39f5('0x9')][0x3];var PATH=process[_0x39f5('0x9')][0x4];function analyticExtractedReport(_0x1d147f,_0x55bb68){var _0x8b0985={'status':_0x1d147f};var _0x416023={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x55bb68){_0x8b0985['savename']=_0x55bb68;}return db['AnalyticExtractedReport']['update'](_0x8b0985,_0x416023);}function main(){var _0x5a4ef3=0x1388;var _0x21e6f8;logger[_0x39f5('0xa')](util['format'](_0x39f5('0xb'),EXTRACTED_REPORT_ID,_0x39f5('0xc')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x39f5('0xd'),'splitSizeXlsx']})['then'](function(_0x26450e){if(_0x26450e){_0x21e6f8=_0x26450e;_0x5a4ef3=_0x21e6f8[_0x39f5('0xe')]||0x1388;}})[_0x39f5('0xf')](function(){return dbH[_0x39f5('0x10')][_0x39f5('0x11')](util[_0x39f5('0x12')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x39f5('0x13')]['SELECT']});})['then'](function(_0x387500){if(!_0x387500[0x0]['num']){return analyticExtractedReport('Empty');}var _0x55d708=[];var _0x3d90b7=0x0;var _0x568ef0=!![];if(_0x21e6f8['split']){if(_0x387500&&_0x387500[_0x39f5('0x14')]){var _0x224f61=_0x387500[0x0][_0x39f5('0x15')]%(_0x3d90b7+_0x5a4ef3);for(;_0x568ef0;_0x3d90b7+=_0x5a4ef3,_0x224f61=_0x387500[0x0][_0x39f5('0x15')]%(_0x3d90b7+_0x5a4ef3)){if(_0x224f61==0x0||_0x224f61==_0x387500[0x0][_0x39f5('0x15')]){_0x568ef0=![];}_0x55d708[_0x39f5('0x16')](dbH[_0x39f5('0x10')]['query'](util['format'](_0x39f5('0x17'),QUERY,_0x5a4ef3,_0x3d90b7),{'type':dbH['sequelize'][_0x39f5('0x13')][_0x39f5('0x18')]}));}}}else{_0x55d708[_0x39f5('0x16')](dbH['sequelize'][_0x39f5('0x11')](QUERY,{'type':dbH[_0x39f5('0x10')][_0x39f5('0x13')]['SELECT']}));}var _0x47d0ae=path[_0x39f5('0x19')](PATH);var _0x36849b=path['basename'](PATH,'.xlsx');var _0x35032c=_0x21e6f8[_0x39f5('0xd')]&&_0x55d708[_0x39f5('0x14')]>0x1;var _0x2e20ac=[];if(!fs[_0x39f5('0x1a')](path[_0x39f5('0x1b')](_0x47d0ae,_0x36849b))&&_0x35032c){fs[_0x39f5('0x1c')](path[_0x39f5('0x1b')](_0x47d0ae,_0x36849b));}return BPromise[_0x39f5('0x1d')](_0x55d708,function(_0x1f3933){_0x2e20ac[_0x39f5('0x16')](_0x1f3933);})['then'](function(){for(var _0x290697=0x0;_0x290697<_0x2e20ac['length'];_0x290697+=0x1){var _0x5e3a2f;var _0x46b90a=_0x2e20ac[_0x290697];if(_0x35032c){_0x5e3a2f=path[_0x39f5('0x1b')](_0x47d0ae,_0x36849b,util['format']('%s%d.%s',_0x36849b,_0x290697,_0x39f5('0x1e')));}else{_0x5e3a2f=path['join'](_0x47d0ae,util[_0x39f5('0x12')](_0x39f5('0x1f'),_0x36849b,'xlsx'));}fs[_0x39f5('0x20')](_0x5e3a2f,json2xls(_0x46b90a),_0x39f5('0x21'));}})['then'](function(){if(_0x35032c){zipdir(path[_0x39f5('0x1b')](_0x47d0ae,_0x36849b),{'saveTo':path['join'](_0x47d0ae,util[_0x39f5('0x12')](_0x39f5('0x1f'),_0x36849b,'zip'))},function(_0x17c1f8,_0xde6b30){});rimraf(path['join'](_0x47d0ae,_0x36849b),function(){});}})['then'](function(){logger[_0x39f5('0xa')](util[_0x39f5('0x12')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x39f5('0xc')));return analyticExtractedReport(_0x39f5('0x22'),_0x35032c?util[_0x39f5('0x12')](_0x39f5('0x1f'),_0x36849b,_0x35032c?_0x39f5('0x23'):_0x39f5('0x1e')):null);});})[_0x39f5('0x24')](function(_0x59fe6e){logger[_0x39f5('0xa')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x39f5('0xc')),util[_0x39f5('0x25')](_0x59fe6e,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x39f5('0x26'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 0e1e5cb..a2ec9c0 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 _0x2d93=['outbound','CDR(destination)=','cutdigits','push','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','*,*,*,*','IntervalId','tag','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','sortBy','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','type','Set','CDR(type)=%s','context','VoiceExtensionId'];(function(_0x1ff759,_0x271d74){var _0x36b76b=function(_0x101d13){while(--_0x101d13){_0x1ff759['push'](_0x1ff759['shift']());}};_0x36b76b(++_0x271d74);}(_0x2d93,0xf3));var _0x32d9=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x2d93[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x32d9('0x0'));var util=require(_0x32d9('0x1'));function rewrite(_0x37871f,_0x333c09){var _0x95bb12=this;return _0x37871f[_0x32d9('0x2')][_0x32d9('0x3')][_0x32d9('0x4')]({'raw':!![]})[_0x32d9('0x5')](function(_0x80afe8){_0x95bb12[_0x32d9('0x6')]=_0x80afe8;return _0x37871f[_0x32d9('0x2')][_0x32d9('0x7')][_0x32d9('0x4')]({'where':{'IntervalId':_0x333c09['IntervalId']},'raw':!![]});})[_0x32d9('0x5')](function(_0x12c49f){return _0x37871f[_0x32d9('0x2')][_0x32d9('0x7')][_0x32d9('0x4')]({'where':{'exten':{'$in':_['uniq'](_[_0x32d9('0x8')](_0x12c49f,_0x32d9('0x9')))}},'order':[{'raw':_0x32d9('0xa')}],'raw':!![]});})[_0x32d9('0x5')](function(_0x2babbf){var _0x312988=_[_0x32d9('0xb')](_0x2babbf,{'priority':'1'});var _0x3383a8=_[_0x32d9('0xb')](_0x2babbf,{'isApp':0x1});var _0x5efb8f=_[_0x32d9('0xc')](_0x3383a8,'exten');var _0x5afced=[_0x32d9('0xd'),_0x32d9('0xe')];var _0x1eb32f=[];var _0x2323f2=[];for(var _0x460eb9 in _0x5efb8f){if(_0x5efb8f[_0x32d9('0xf')](_0x460eb9)){_0x95bb12[_0x32d9('0x10')]=0x2;_0x95bb12[_0x32d9('0x11')]=[];_0x95bb12[_0x32d9('0x12')]=_[_0x32d9('0x13')](_0x312988,{'exten':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x9')]});_0x95bb12[_0x32d9('0x11')]['push']({'type':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x14')],'app':_0x32d9('0x15'),'appdata':util['format'](_0x32d9('0x16'),_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x14')]),'context':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x17')],'exten':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x9')],'priority':_0x95bb12[_0x32d9('0x10')]++,'VoiceExtensionId':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x18')]});if(_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x14')]===_0x32d9('0x19')){if(_0x95bb12[_0x32d9('0x12')]){_0x95bb12[_0x32d9('0x11')]['push']({'type':_0x5efb8f[_0x460eb9][0x0]['type'],'app':_0x32d9('0x15'),'appdata':_0x32d9('0x1a')+(_0x95bb12['extension'][_0x32d9('0x1b')]?'${EXTEN:'+_0x95bb12[_0x32d9('0x12')][_0x32d9('0x1b')]+'}':'${EXTEN}'),'context':_0x5efb8f[_0x460eb9][0x0]['context'],'exten':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x9')],'priority':_0x95bb12[_0x32d9('0x10')]++,'VoiceExtensionId':_0x5efb8f[_0x460eb9][0x0]['VoiceExtensionId']});}_0x95bb12['extensions'][_0x32d9('0x1c')]({'type':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x14')],'app':_0x32d9('0x15'),'appdata':_0x32d9('0x1d')+_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x18')],'context':_0x5efb8f[_0x460eb9][0x0]['context'],'exten':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x9')],'priority':_0x95bb12[_0x32d9('0x10')]++,'VoiceExtensionId':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x18')]});var _0x215440=_0x95bb12['priority']++;_0x95bb12[_0x32d9('0x11')][_0x32d9('0x1c')]({'type':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x14')],'app':'ExecIf','appdata':_0x32d9('0x1e')+(_0x215440+0x2)+_0x32d9('0x1f')+(_0x215440+0x1)+')','context':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x17')],'exten':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x9')],'priority':_0x215440,'VoiceExtensionId':_0x5efb8f[_0x460eb9][0x0]['VoiceExtensionId']});if(_0x95bb12[_0x32d9('0x12')]){_0x95bb12[_0x32d9('0x11')][_0x32d9('0x1c')]({'type':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x14')],'app':'Set','appdata':_0x95bb12['extension']['cutdigits']?_0x32d9('0x20')+_0x95bb12[_0x32d9('0x12')][_0x32d9('0x1b')]+'}':'CDR(prefix)=noprefix','context':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x17')],'exten':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x9')],'priority':_0x95bb12['priority']++,'VoiceExtensionId':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x18')]});}_0x95bb12[_0x32d9('0x11')][_0x32d9('0x1c')]({'type':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x14')],'app':_0x32d9('0x15'),'appdata':'outboundrouteid='+_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x18')],'context':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x17')],'exten':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x9')],'priority':_0x95bb12[_0x32d9('0x10')]++,'VoiceExtensionId':_0x5efb8f[_0x460eb9][0x0]['VoiceExtensionId']});if(_0x95bb12[_0x32d9('0x12')]&&_0x95bb12['extension'][_0x32d9('0xf')](_0x32d9('0x21'))&&_0x95bb12[_0x32d9('0x12')][_0x32d9('0x21')]!==_0x32d9('0x22')){_0x95bb12[_0x32d9('0x11')][_0x32d9('0x1c')]({'type':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x14')],'app':_0x32d9('0x15'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x17')],'exten':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x9')],'priority':_0x95bb12[_0x32d9('0x10')]++,'VoiceExtensionId':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x18')]});_0x95bb12[_0x32d9('0x11')][_0x32d9('0x1c')]({'type':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x14')],'app':_0x32d9('0x15'),'appdata':_0x32d9('0x23')+_0x95bb12[_0x32d9('0x12')]['recordingFormat']||'wav','context':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x17')],'exten':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x9')],'priority':_0x95bb12[_0x32d9('0x10')]++,'VoiceExtensionId':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x18')]});}}_0x95bb12[_0x32d9('0x11')][_0x32d9('0x1c')]({'type':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x14')],'app':_0x32d9('0x15'),'appdata':_0x32d9('0x24'),'context':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x17')],'exten':_0x5efb8f[_0x460eb9][0x0]['exten'],'priority':_0x95bb12[_0x32d9('0x10')]++,'VoiceExtensionId':_0x5efb8f[_0x460eb9][0x0]['VoiceExtensionId']});_0x95bb12['extensions'][_0x32d9('0x1c')]({'type':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x14')],'app':'Set','appdata':_0x32d9('0x25'),'context':_0x5efb8f[_0x460eb9][0x0]['context'],'exten':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x9')],'priority':_0x95bb12[_0x32d9('0x10')]++,'VoiceExtensionId':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x18')]});_0x95bb12['extensions'][_0x32d9('0x1c')]({'type':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x14')],'app':_0x32d9('0x15'),'appdata':_0x32d9('0x26'),'context':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x17')],'exten':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x9')],'priority':_0x95bb12[_0x32d9('0x10')]++,'VoiceExtensionId':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x18')]});for(var _0x5eabdb=0x0,_0x5348b7=0x0;_0x5eabdb<_0x5efb8f[_0x460eb9][_0x32d9('0x27')];_0x5eabdb+=0x1,_0x5348b7=0x0){var _0x2bcec0=_0x5efb8f[_0x460eb9][_0x5eabdb];if(_0x2bcec0['type']){_0x2bcec0[_0x32d9('0x14')]=_0x2bcec0[_0x32d9('0x14')][_0x32d9('0x28')]();}var _0x261c27=[];var _0x4beff9=[];delete _0x2bcec0['id'];delete _0x2bcec0['createdAt'];delete _0x2bcec0[_0x32d9('0x29')];var _0x1e504f=_0x2bcec0[_0x32d9('0x2a')]!==_0x32d9('0x2b')?[_0x2bcec0[_0x32d9('0x2a')]]:_0x2bcec0[_0x32d9('0x2c')]?_[_0x32d9('0x8')](_[_0x32d9('0xb')](_0x95bb12[_0x32d9('0x6')],{'IntervalId':_0x2bcec0[_0x32d9('0x2c')]}),'interval'):[];if(_0x2bcec0[_0x32d9('0xf')]('tag')){if(_0x2bcec0[_0x32d9('0x2d')]&&_0x2bcec0[_0x32d9('0x2d')]!=='--'){_0x261c27[_0x32d9('0x1c')]({'type':_0x2bcec0['type'],'app':'Set','appdata':'CDR(tag)='+_0x2bcec0[_0x32d9('0x2d')],'context':_0x2bcec0[_0x32d9('0x17')],'exten':_0x2bcec0['exten'],'priority':_0x1e504f[_0x32d9('0x27')]+_0x95bb12['priority']+_0x5348b7++,'VoiceExtensionId':_0x2bcec0[_0x32d9('0x18')]});}}if(_0x2bcec0['type']===_0x32d9('0x19')&&_0x2bcec0[_0x32d9('0xf')](_0x32d9('0x2e'))){if(_0x2bcec0[_0x32d9('0x2e')]){_0x261c27[_0x32d9('0x1c')]({'type':_0x2bcec0['type'],'app':_0x32d9('0x2f'),'appdata':_0x32d9('0x30')+_0x2bcec0[_0x32d9('0x2e')]+')','context':_0x2bcec0['context'],'exten':_0x2bcec0[_0x32d9('0x9')],'priority':_0x1e504f[_0x32d9('0x27')]+_0x95bb12[_0x32d9('0x10')]+_0x5348b7++,'VoiceExtensionId':_0x2bcec0[_0x32d9('0x18')]});}else{_0x261c27[_0x32d9('0x1c')]({'type':_0x2bcec0['type'],'app':_0x32d9('0x2f'),'appdata':_0x32d9('0x31'),'context':_0x2bcec0[_0x32d9('0x17')],'exten':_0x2bcec0[_0x32d9('0x9')],'priority':_0x1e504f['length']+_0x95bb12['priority']+_0x5348b7++,'VoiceExtensionId':_0x2bcec0[_0x32d9('0x18')]});}}if(_0x2bcec0[_0x32d9('0xf')](_0x32d9('0x32'))){if(_0x5afced[_0x32d9('0x33')](_0x2bcec0[_0x32d9('0x34')][_0x32d9('0x28')]())>=0x0&&_0x2bcec0[_0x32d9('0x35')]!==_0x32d9('0x36')){if(_0x2bcec0['answer']){_0x261c27[_0x32d9('0x1c')]({'type':_0x2bcec0[_0x32d9('0x14')],'app':_0x32d9('0x2f'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2bcec0['context'],'exten':_0x2bcec0[_0x32d9('0x9')],'priority':_0x1e504f[_0x32d9('0x27')]+_0x95bb12[_0x32d9('0x10')]+_0x5348b7++,'VoiceExtensionId':_0x2bcec0[_0x32d9('0x18')]});_0x261c27[_0x32d9('0x1c')]({'type':_0x2bcec0[_0x32d9('0x14')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x2bcec0[_0x32d9('0x17')],'exten':_0x2bcec0[_0x32d9('0x9')],'priority':_0x1e504f['length']+_0x95bb12[_0x32d9('0x10')]+_0x5348b7++,'VoiceExtensionId':_0x2bcec0[_0x32d9('0x18')]});}else{_0x261c27['push']({'type':_0x2bcec0[_0x32d9('0x14')],'app':_0x32d9('0x2f'),'appdata':_0x32d9('0x37'),'context':_0x2bcec0[_0x32d9('0x17')],'exten':_0x2bcec0[_0x32d9('0x9')],'priority':_0x1e504f[_0x32d9('0x27')]+_0x95bb12['priority']+_0x5348b7++,'VoiceExtensionId':_0x2bcec0[_0x32d9('0x18')]});_0x261c27[_0x32d9('0x1c')]({'type':_0x2bcec0[_0x32d9('0x14')],'app':_0x32d9('0x15'),'appdata':_0x32d9('0x38'),'context':_0x2bcec0['context'],'exten':_0x2bcec0[_0x32d9('0x9')],'priority':_0x1e504f[_0x32d9('0x27')]+_0x95bb12[_0x32d9('0x10')]+_0x5348b7++,'VoiceExtensionId':_0x2bcec0[_0x32d9('0x18')]});}}}for(var _0x3d00c3=0x0;_0x3d00c3<_0x1e504f[_0x32d9('0x27')];_0x3d00c3+=0x1){var _0x14ca48=_0x95bb12['priority']+_0x1e504f[_0x32d9('0x27')];var _0xb101d=_0x3d00c3===_0x1e504f[_0x32d9('0x27')]-0x1?_0x95bb12[_0x32d9('0x10')]+_0x261c27['length']+_0x4beff9['length']+0x2:_0x95bb12[_0x32d9('0x10')]+_0x3d00c3+0x1;_0x261c27[_0x32d9('0x39')](_0x3d00c3,0x0,{'type':_0x2bcec0[_0x32d9('0x14')],'app':_0x32d9('0x3a'),'appdata':_0x1e504f[_0x3d00c3]+'?'+_0x2bcec0['context']+_0x32d9('0x3b')+_0x14ca48+':'+_0x2bcec0[_0x32d9('0x17')]+',${EXTEN},'+_0xb101d,'exten':_0x2bcec0[_0x32d9('0x9')],'context':_0x2bcec0['context'],'priority':_0x95bb12['priority']+_0x3d00c3,'VoiceExtensionId':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x18')]});}_0x2bcec0[_0x32d9('0x10')]=_0x261c27[_0x32d9('0x27')]?_[_0x32d9('0x3c')](_0x261c27)['priority']+0x1:_0x95bb12[_0x32d9('0x10')];_0x95bb12[_0x32d9('0x10')]=(_0x4beff9['length']?_['last'](_0x4beff9)[_0x32d9('0x10')]:_0x2bcec0[_0x32d9('0x10')])+0x1;_0x95bb12[_0x32d9('0x11')]=_['concat'](_0x95bb12[_0x32d9('0x11')],_0x261c27,[_0x2bcec0],_0x4beff9);}_0x95bb12[_0x32d9('0x11')][_0x32d9('0x1c')]({'type':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x14')],'app':_0x32d9('0x3d'),'exten':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x9')],'context':_0x5efb8f[_0x460eb9][0x0]['context'],'priority':_0x95bb12[_0x32d9('0x10')],'VoiceExtensionId':_0x5efb8f[_0x460eb9][0x0][_0x32d9('0x18')]});_0x1eb32f['push'](_0x5efb8f[_0x460eb9][0x0]['VoiceExtensionId']);_0x2323f2=_[_0x32d9('0x3e')](_0x2323f2,_0x95bb12[_0x32d9('0x11')]);}}return _0x37871f[_0x32d9('0x3f')](function(_0x87165a){return _0x37871f[_0x32d9('0x2')][_0x32d9('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x1eb32f}},'transaction':_0x87165a})[_0x32d9('0x5')](function(_0x1baeff){return _0x37871f[_0x32d9('0x2')][_0x32d9('0x7')]['bulkCreate'](_[_0x32d9('0x40')](_0x2323f2,_0x32d9('0x10')),{'transaction':_0x87165a});});});})['catch'](function(_0x56a88d){console[_0x32d9('0x41')](_0x56a88d);});}exports[_0x32d9('0x42')]=rewrite; \ No newline at end of file +var _0xb077=['playback','hasOwnProperty','priority','extensions','find','push','type','context','VoiceExtensionId','outbound','extension','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','Set','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','intervals','tag','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','Hangup','destroy','bulkCreate','catch','error','rewrite','lodash','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue'];(function(_0x1d748a,_0xd760af){var _0x4fc40e=function(_0x261602){while(--_0x261602){_0x1d748a['push'](_0x1d748a['shift']());}};_0x4fc40e(++_0xd760af);}(_0xb077,0x7a));var _0x7b07=function(_0x5368b5,_0x1bf3b1){_0x5368b5=_0x5368b5-0x0;var _0x3b3d37=_0xb077[_0x5368b5];return _0x3b3d37;};'use strict';var _=require(_0x7b07('0x0'));var util=require('util');function rewrite(_0x4a69eb,_0x257822){var _0x5a1c3d=this;return _0x4a69eb[_0x7b07('0x1')][_0x7b07('0x2')][_0x7b07('0x3')]({'raw':!![]})[_0x7b07('0x4')](function(_0x423957){_0x5a1c3d['intervals']=_0x423957;return _0x4a69eb['models'][_0x7b07('0x5')][_0x7b07('0x3')]({'where':{'IntervalId':_0x257822[_0x7b07('0x6')]},'raw':!![]});})['then'](function(_0x561c99){return _0x4a69eb[_0x7b07('0x1')]['VoiceExtension'][_0x7b07('0x3')]({'where':{'exten':{'$in':_[_0x7b07('0x7')](_[_0x7b07('0x8')](_0x561c99,_0x7b07('0x9')))}},'order':[{'raw':_0x7b07('0xa')}],'raw':!![]});})[_0x7b07('0x4')](function(_0x2f7009){var _0x33a461=_[_0x7b07('0xb')](_0x2f7009,{'priority':'1'});var _0x527465=_[_0x7b07('0xb')](_0x2f7009,{'isApp':0x1});var _0x282fe2=_[_0x7b07('0xc')](_0x527465,'exten');var _0xe825c4=[_0x7b07('0xd'),_0x7b07('0xe')];var _0x7930f1=[];var _0x530d1d=[];for(var _0x26a0fe in _0x282fe2){if(_0x282fe2[_0x7b07('0xf')](_0x26a0fe)){_0x5a1c3d[_0x7b07('0x10')]=0x2;_0x5a1c3d[_0x7b07('0x11')]=[];_0x5a1c3d['extension']=_[_0x7b07('0x12')](_0x33a461,{'exten':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x9')]});_0x5a1c3d[_0x7b07('0x11')][_0x7b07('0x13')]({'type':_0x282fe2[_0x26a0fe][0x0]['type'],'app':'Set','appdata':util['format']('CDR(type)=%s',_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x14')]),'context':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x15')],'exten':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x9')],'priority':_0x5a1c3d[_0x7b07('0x10')]++,'VoiceExtensionId':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x16')]});if(_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x14')]===_0x7b07('0x17')){if(_0x5a1c3d[_0x7b07('0x18')]){_0x5a1c3d[_0x7b07('0x11')][_0x7b07('0x13')]({'type':_0x282fe2[_0x26a0fe][0x0]['type'],'app':'Set','appdata':'CDR(destination)='+(_0x5a1c3d[_0x7b07('0x18')][_0x7b07('0x19')]?_0x7b07('0x1a')+_0x5a1c3d[_0x7b07('0x18')][_0x7b07('0x19')]+'}':_0x7b07('0x1b')),'context':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x15')],'exten':_0x282fe2[_0x26a0fe][0x0]['exten'],'priority':_0x5a1c3d[_0x7b07('0x10')]++,'VoiceExtensionId':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x16')]});}_0x5a1c3d[_0x7b07('0x11')]['push']({'type':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x14')],'app':'Set','appdata':_0x7b07('0x1c')+_0x282fe2[_0x26a0fe][0x0]['VoiceExtensionId'],'context':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x15')],'exten':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x9')],'priority':_0x5a1c3d[_0x7b07('0x10')]++,'VoiceExtensionId':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x16')]});var _0x572e32=_0x5a1c3d[_0x7b07('0x10')]++;_0x5a1c3d['extensions'][_0x7b07('0x13')]({'type':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x14')],'app':'ExecIf','appdata':_0x7b07('0x1d')+(_0x572e32+0x2)+_0x7b07('0x1e')+(_0x572e32+0x1)+')','context':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x15')],'exten':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x9')],'priority':_0x572e32,'VoiceExtensionId':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x16')]});if(_0x5a1c3d[_0x7b07('0x18')]){_0x5a1c3d[_0x7b07('0x11')][_0x7b07('0x13')]({'type':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x14')],'app':_0x7b07('0x1f'),'appdata':_0x5a1c3d[_0x7b07('0x18')][_0x7b07('0x19')]?_0x7b07('0x20')+_0x5a1c3d[_0x7b07('0x18')][_0x7b07('0x19')]+'}':_0x7b07('0x21'),'context':_0x282fe2[_0x26a0fe][0x0]['context'],'exten':_0x282fe2[_0x26a0fe][0x0]['exten'],'priority':_0x5a1c3d[_0x7b07('0x10')]++,'VoiceExtensionId':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x16')]});}_0x5a1c3d[_0x7b07('0x11')]['push']({'type':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x14')],'app':_0x7b07('0x1f'),'appdata':_0x7b07('0x22')+_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x16')],'context':_0x282fe2[_0x26a0fe][0x0]['context'],'exten':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x9')],'priority':_0x5a1c3d['priority']++,'VoiceExtensionId':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x16')]});if(_0x5a1c3d['extension']&&_0x5a1c3d[_0x7b07('0x18')][_0x7b07('0xf')]('recordingFormat')&&_0x5a1c3d['extension'][_0x7b07('0x23')]!=='none'){_0x5a1c3d[_0x7b07('0x11')][_0x7b07('0x13')]({'type':_0x282fe2[_0x26a0fe][0x0]['type'],'app':_0x7b07('0x1f'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x15')],'exten':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x9')],'priority':_0x5a1c3d[_0x7b07('0x10')]++,'VoiceExtensionId':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x16')]});_0x5a1c3d[_0x7b07('0x11')][_0x7b07('0x13')]({'type':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x14')],'app':_0x7b07('0x1f'),'appdata':_0x7b07('0x24')+_0x5a1c3d[_0x7b07('0x18')][_0x7b07('0x23')]||_0x7b07('0x25'),'context':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x15')],'exten':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x9')],'priority':_0x5a1c3d[_0x7b07('0x10')]++,'VoiceExtensionId':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x16')]});}}_0x5a1c3d[_0x7b07('0x11')][_0x7b07('0x13')]({'type':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x14')],'app':_0x7b07('0x1f'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x15')],'exten':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x9')],'priority':_0x5a1c3d[_0x7b07('0x10')]++,'VoiceExtensionId':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x16')]});_0x5a1c3d[_0x7b07('0x11')][_0x7b07('0x13')]({'type':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x14')],'app':_0x7b07('0x1f'),'appdata':_0x7b07('0x26'),'context':_0x282fe2[_0x26a0fe][0x0]['context'],'exten':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x9')],'priority':_0x5a1c3d[_0x7b07('0x10')]++,'VoiceExtensionId':_0x282fe2[_0x26a0fe][0x0]['VoiceExtensionId']});_0x5a1c3d[_0x7b07('0x11')][_0x7b07('0x13')]({'type':_0x282fe2[_0x26a0fe][0x0]['type'],'app':_0x7b07('0x1f'),'appdata':_0x7b07('0x27'),'context':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x15')],'exten':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x9')],'priority':_0x5a1c3d[_0x7b07('0x10')]++,'VoiceExtensionId':_0x282fe2[_0x26a0fe][0x0]['VoiceExtensionId']});for(var _0x994e9d=0x0,_0x3d83c0=0x0;_0x994e9d<_0x282fe2[_0x26a0fe][_0x7b07('0x28')];_0x994e9d+=0x1,_0x3d83c0=0x0){var _0x206f35=_0x282fe2[_0x26a0fe][_0x994e9d];if(_0x206f35[_0x7b07('0x14')]){_0x206f35[_0x7b07('0x14')]=_0x206f35[_0x7b07('0x14')][_0x7b07('0x29')]();}var _0x523355=[];var _0x374de5=[];delete _0x206f35['id'];delete _0x206f35[_0x7b07('0x2a')];delete _0x206f35[_0x7b07('0x2b')];var _0x539214=_0x206f35[_0x7b07('0x2c')]!==_0x7b07('0x2d')?[_0x206f35[_0x7b07('0x2c')]]:_0x206f35['IntervalId']?_[_0x7b07('0x8')](_[_0x7b07('0xb')](_0x5a1c3d[_0x7b07('0x2e')],{'IntervalId':_0x206f35['IntervalId']}),_0x7b07('0x2c')):[];if(_0x206f35['hasOwnProperty'](_0x7b07('0x2f'))){if(_0x206f35[_0x7b07('0x2f')]&&_0x206f35[_0x7b07('0x2f')]!=='--'){_0x523355['push']({'type':_0x206f35[_0x7b07('0x14')],'app':_0x7b07('0x1f'),'appdata':'CDR(tag)='+_0x206f35['tag'],'context':_0x206f35[_0x7b07('0x15')],'exten':_0x206f35['exten'],'priority':_0x539214[_0x7b07('0x28')]+_0x5a1c3d[_0x7b07('0x10')]+_0x3d83c0++,'VoiceExtensionId':_0x206f35['VoiceExtensionId']});}}if(_0x206f35['type']===_0x7b07('0x17')&&_0x206f35[_0x7b07('0xf')]('callerID')){if(_0x206f35[_0x7b07('0x30')]){_0x523355[_0x7b07('0x13')]({'type':_0x206f35[_0x7b07('0x14')],'app':_0x7b07('0x31'),'appdata':_0x7b07('0x32')+_0x206f35[_0x7b07('0x30')]+')','context':_0x206f35[_0x7b07('0x15')],'exten':_0x206f35[_0x7b07('0x9')],'priority':_0x539214[_0x7b07('0x28')]+_0x5a1c3d[_0x7b07('0x10')]+_0x3d83c0++,'VoiceExtensionId':_0x206f35[_0x7b07('0x16')]});}else{_0x523355[_0x7b07('0x13')]({'type':_0x206f35['type'],'app':_0x7b07('0x31'),'appdata':_0x7b07('0x33'),'context':_0x206f35[_0x7b07('0x15')],'exten':_0x206f35['exten'],'priority':_0x539214['length']+_0x5a1c3d['priority']+_0x3d83c0++,'VoiceExtensionId':_0x206f35['VoiceExtensionId']});}}if(_0x206f35[_0x7b07('0xf')](_0x7b07('0x34'))){if(_0xe825c4[_0x7b07('0x35')](_0x206f35[_0x7b07('0x36')][_0x7b07('0x29')]())>=0x0&&_0x206f35[_0x7b07('0x37')]!==_0x7b07('0x38')){if(_0x206f35[_0x7b07('0x34')]){_0x523355['push']({'type':_0x206f35[_0x7b07('0x14')],'app':_0x7b07('0x31'),'appdata':_0x7b07('0x39'),'context':_0x206f35[_0x7b07('0x15')],'exten':_0x206f35[_0x7b07('0x9')],'priority':_0x539214['length']+_0x5a1c3d[_0x7b07('0x10')]+_0x3d83c0++,'VoiceExtensionId':_0x206f35[_0x7b07('0x16')]});_0x523355[_0x7b07('0x13')]({'type':_0x206f35[_0x7b07('0x14')],'app':_0x7b07('0x1f'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x206f35[_0x7b07('0x15')],'exten':_0x206f35[_0x7b07('0x9')],'priority':_0x539214[_0x7b07('0x28')]+_0x5a1c3d['priority']+_0x3d83c0++,'VoiceExtensionId':_0x206f35['VoiceExtensionId']});}else{_0x523355['push']({'type':_0x206f35[_0x7b07('0x14')],'app':_0x7b07('0x31'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x206f35[_0x7b07('0x15')],'exten':_0x206f35[_0x7b07('0x9')],'priority':_0x539214['length']+_0x5a1c3d[_0x7b07('0x10')]+_0x3d83c0++,'VoiceExtensionId':_0x206f35[_0x7b07('0x16')]});_0x523355[_0x7b07('0x13')]({'type':_0x206f35['type'],'app':_0x7b07('0x1f'),'appdata':_0x7b07('0x3a'),'context':_0x206f35[_0x7b07('0x15')],'exten':_0x206f35[_0x7b07('0x9')],'priority':_0x539214[_0x7b07('0x28')]+_0x5a1c3d['priority']+_0x3d83c0++,'VoiceExtensionId':_0x206f35[_0x7b07('0x16')]});}}}for(var _0x163c9e=0x0;_0x163c9e<_0x539214[_0x7b07('0x28')];_0x163c9e+=0x1){var _0x26f2e2=_0x5a1c3d['priority']+_0x539214['length'];var _0x4008b1=_0x163c9e===_0x539214[_0x7b07('0x28')]-0x1?_0x5a1c3d[_0x7b07('0x10')]+_0x523355[_0x7b07('0x28')]+_0x374de5[_0x7b07('0x28')]+0x2:_0x5a1c3d[_0x7b07('0x10')]+_0x163c9e+0x1;_0x523355[_0x7b07('0x3b')](_0x163c9e,0x0,{'type':_0x206f35['type'],'app':'GotoIfTime','appdata':_0x539214[_0x163c9e]+'?'+_0x206f35[_0x7b07('0x15')]+_0x7b07('0x3c')+_0x26f2e2+':'+_0x206f35[_0x7b07('0x15')]+_0x7b07('0x3c')+_0x4008b1,'exten':_0x206f35[_0x7b07('0x9')],'context':_0x206f35[_0x7b07('0x15')],'priority':_0x5a1c3d['priority']+_0x163c9e,'VoiceExtensionId':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x16')]});}_0x206f35[_0x7b07('0x10')]=_0x523355[_0x7b07('0x28')]?_[_0x7b07('0x3d')](_0x523355)['priority']+0x1:_0x5a1c3d['priority'];_0x5a1c3d[_0x7b07('0x10')]=(_0x374de5[_0x7b07('0x28')]?_[_0x7b07('0x3d')](_0x374de5)[_0x7b07('0x10')]:_0x206f35[_0x7b07('0x10')])+0x1;_0x5a1c3d[_0x7b07('0x11')]=_['concat'](_0x5a1c3d[_0x7b07('0x11')],_0x523355,[_0x206f35],_0x374de5);}_0x5a1c3d['extensions']['push']({'type':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x14')],'app':_0x7b07('0x3e'),'exten':_0x282fe2[_0x26a0fe][0x0]['exten'],'context':_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x15')],'priority':_0x5a1c3d['priority'],'VoiceExtensionId':_0x282fe2[_0x26a0fe][0x0]['VoiceExtensionId']});_0x7930f1[_0x7b07('0x13')](_0x282fe2[_0x26a0fe][0x0][_0x7b07('0x16')]);_0x530d1d=_['concat'](_0x530d1d,_0x5a1c3d[_0x7b07('0x11')]);}}return _0x4a69eb['transaction'](function(_0x3d87be){return _0x4a69eb[_0x7b07('0x1')]['VoiceExtension'][_0x7b07('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0x7930f1}},'transaction':_0x3d87be})[_0x7b07('0x4')](function(_0x5471d1){return _0x4a69eb[_0x7b07('0x1')][_0x7b07('0x5')][_0x7b07('0x40')](_['sortBy'](_0x530d1d,_0x7b07('0x10')),{'transaction':_0x3d87be});});});})[_0x7b07('0x41')](function(_0x497393){console[_0x7b07('0x42')](_0x497393);});}exports[_0x7b07('0x43')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 6434891..fbd39ec 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','fromQuery','phone','scheduledAt','updatedAt','field','NOW()','ContactId','toString','createdAt','from','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','\x20=\x20?','into','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','cm_contacts','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','push','all','CmList','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x3071('0x0'));var fs=require('fs');var squel=require(_0x3071('0x1'));var Papa=require(_0x3071('0x2'));var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));config[_0x3071('0x7')]=_[_0x3071('0x8')](config[_0x3071('0x7')],{'host':_0x3071('0x9'),'port':0x18eb});var socket=require(_0x3071('0xa'))(new Redis(config[_0x3071('0x7')]));require(_0x3071('0xb'))[_0x3071('0xc')](socket);try{if(!process[_0x3071('0xd')][0x2]||process[_0x3071('0xd')][0x2]===_0x3071('0xe')||process['argv'][0x2]===_0x3071('0xf')){throw new Error(_0x3071('0x10'));}var FILEPATH=process[_0x3071('0xd')][0x2];if(!process[_0x3071('0xd')][0x3]||process[_0x3071('0xd')][0x3]==='undefined'||process[_0x3071('0xd')][0x3]===_0x3071('0xf')||!process[_0x3071('0xd')][0x4]||process[_0x3071('0xd')][0x4]===_0x3071('0xe')||process['argv'][0x4]==='null'){throw new Error(_0x3071('0x11'));}var FIELDS=_['zipObject'](process[_0x3071('0xd')][0x3][_0x3071('0x12')](','),process['argv'][0x4][_0x3071('0x12')](','));if(!process['argv'][0x5]||process[_0x3071('0xd')][0x5]===_0x3071('0xe')||process[_0x3071('0xd')][0x5]===_0x3071('0xf')){throw new Error(_0x3071('0x13'));}var LISTID=process[_0x3071('0xd')][0x5];var COMPANYID=process[_0x3071('0xd')][0x6]&&process[_0x3071('0xd')][0x6]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x6]!=='null'?process[_0x3071('0xd')][0x6]:null;var DUPLICATES=process[_0x3071('0xd')][0x7]&&process[_0x3071('0xd')][0x7]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x7]!==_0x3071('0xf')?process[_0x3071('0xd')][0x7]:null;if(!process[_0x3071('0xd')][0x8]||process['argv'][0x8]===_0x3071('0xe')||process[_0x3071('0xd')][0x8]===_0x3071('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x3071('0xd')][0x8];}catch(_0x5cd80d){logger[_0x3071('0x14')](_0x5cd80d);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x43128c,_0x3762d8,_0x457b57,_0x33090c){var _0x34c50e={'message':_0x3762d8};_0x34c50e[_0x43128c]=!![];if(_0x457b57){_0x34c50e[_0x3071('0x15')]=_0x457b57;}if(_0x33090c){_0x34c50e[_0x3071('0x16')]=_0x33090c;}return _0x34c50e;}function isEmail(_0x542646){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x542646);}function checkRow(_0x2ce48a,_0xb05b1d,_0x412652){return new BPromise(function(_0x13df9f,_0x2793ef){if(_[_0x3071('0x17')](_0x2ce48a)){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x18'),null,_0x412652));}if(_0x2ce48a[_0x3071('0x19')]&&_0x2ce48a['errors'][_0x3071('0x1a')]){var _0x3f1e6e=_[_0x3071('0x1b')](_0x2ce48a['errors'],_0x3071('0x1c'))[_0x3071('0x1d')](';');return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3f1e6e,null,_0x412652));}var _0x950fde={};for(var _0x3fa3b8 in FIELDS){if(FIELDS[_0x3071('0x1e')](_0x3fa3b8)&&FIELDS[_0x3fa3b8]){_0x950fde[_0x3fa3b8]=_0x2ce48a[_0x3071('0x1f')][0x0][FIELDS[_0x3fa3b8]]||_0x2ce48a[_0x3071('0x1f')][0x0]['\ufeff'+FIELDS[_0x3fa3b8]];}}if(!_0x950fde[_0x3071('0x20')]){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x21'),null,_0x412652));}if(!_0x950fde['phone']){return _0x2793ef(handleCheckRowError('error',_0x3071('0x22'),null,_0x412652));}if(_0x950fde[_0x3071('0x23')]){var _0x6ddf96=moment(_0x950fde[_0x3071('0x23')],_0x3071('0x24'));if(!_0x6ddf96[_0x3071('0x25')]()){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x26'),null,_0x412652));}}if(_0x950fde['email']){if(!isEmail(_0x950fde['email'])){return _0x2793ef(handleCheckRowError('error',_0x3071('0x27'),null,_0x412652));}}_0x950fde[_0x3071('0x28')]=LISTID;_0x950fde['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){var _0x28747d={};for(var _0x25250e=0x0,_0x13ae2c=DUPLICATES['length'];_0x25250e<_0x13ae2c;_0x25250e+=0x1){_0x28747d[DUPLICATES[_0x25250e]]=_0x950fde[DUPLICATES[_0x25250e]];}var _0x218a82=_[_0x3071('0x29')](_0xb05b1d,_0x28747d);if(_0x218a82){return _0x2793ef(handleCheckRowError(_0x3071('0x2a'),_0x3071('0x2b'),_0x218a82,_0x412652));}}return db[_0x3071('0x2c')][_0x3071('0x2d')](_0x950fde,{'raw':!![],'hooks':![],'fields':_[_0x3071('0x2e')](_0x950fde)})[_0x3071('0x2f')](function(_0x596cc3){if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){_0xb05b1d['push'](_['pick'](_0x950fde,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x596cc3['id'];return _0x13df9f();})[_0x3071('0x30')](function(_0xa3a7ae){return _0x2793ef(handleCheckRowError('error',_0x3071('0x31')+(_0xa3a7ae[_0x3071('0x1c')]||JSON[_0x3071('0x32')](_0xa3a7ae)),null,_0x412652));});});}function checkHopper(){function _0x14ac42(){return function(_0xc60572){logger[_0x3071('0x14')]('cmContact',_0x3071('0x33'),util[_0x3071('0x34')](_0xc60572,{'showHidden':![],'depth':null}));};}var _0x4ce6d4=function(_0x44ad05,_0x5b1392){var _0x28f855=squel[_0x3071('0x35')]()['into']('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),'ContactId',_0x3071('0x28'),_0x5b1392,'createdAt',_0x3071('0x39')],squel['select']()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x44ad05['id'][_0x3071('0x3d')](),_0x5b1392)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),'updatedAt')[_0x3071('0x3f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x3071('0x40'),LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x5b1392+_0x3071('0x46'),_0x44ad05['id'][_0x3071('0x3d')]())))['toString']();return _0x28f855;};var _0x5c93c7=function(_0x1721d0,_0x3c2f5e){var _0x1fe5e0=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')](['phone',_0x3071('0x38'),'ContactId','ListId',_0x3c2f5e,_0x3071('0x3e'),'updatedAt'],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')[_0x3071('0x3a')]('id','ContactId')[_0x3071('0x3a')](LISTID['toString'](),_0x3071('0x28'))[_0x3071('0x3a')](_0x1721d0['id']['toString'](),_0x3c2f5e)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')](_0x3071('0x40'),LISTID['toString']())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x4b'))[_0x3071('0x3f')](_0x3071('0x4c'))[_0x3071('0x41')](_0x3c2f5e+_0x3071('0x46'),_0x1721d0['id'][_0x3071('0x3d')]()))[_0x3071('0x41')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x3c2f5e+'\x20=\x20?',_0x1721d0['id'][_0x3071('0x3d')]())))[_0x3071('0x3d')]();return _0x1fe5e0;};function _0x5bc69e(_0x4b8ec0,_0x1b89ea){var _0x15abc4=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),_0x3071('0x3c'),_0x3071('0x28'),_0x1b89ea,'createdAt',_0x3071('0x39')],squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))['field'](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x4b8ec0['id'][_0x3071('0x3d')](),_0x1b89ea)[_0x3071('0x3a')]('NOW()',_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')]('ListId\x20=\x20?',LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))[_0x3071('0x3d')]();return _0x15abc4;}function _0x2e39ff(_0x3b47e8,_0x5cb3b3){var _0x5d1316=squel[_0x3071('0x35')]()[_0x3071('0x47')](_0x3071('0x4d'))[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x3c'),_0x3071('0x28'),_0x5cb3b3,_0x3071('0x3e'),_0x3071('0x39')],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')]('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))[_0x3071('0x3a')](_0x3b47e8['id']['toString'](),_0x5cb3b3)[_0x3071('0x3a')](_0x3071('0x3b'),'createdAt')['field'](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')](_0x3071('0x4e'))['where']('deletedAt\x20IS\x20NULL')[_0x3071('0x41')]('ListId\x20=\x20?',LISTID['toString']())['where']('id\x20IN\x20?',squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))['toString']();return _0x5d1316;}return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id',_0x3071('0x52')],'include':[{'model':db['CmList'],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x588406){var _0x1b35d3=[];if(_0x588406){var _0x29ee70;for(var _0x388cd1=0x0,_0x40c258;_0x388cd1<_0x588406[_0x3071('0x1a')];_0x388cd1+=0x1){_0x40c258=_0x588406[_0x388cd1][_0x3071('0x54')]({'plain':!![]});switch(_0x40c258[_0x3071('0x52')]){case'always':_0x1b35d3['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x40c258,_0x3071('0x57')))['then'](function(){})['catch'](_0x14ac42()));break;case _0x3071('0x58'):_0x1b35d3[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x40c258,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x1b35d3[_0x3071('0x59')](db['sequelize'][_0x3071('0x56')](_0x5bc69e(_0x40c258,'VoiceQueueId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x1b35d3;})[_0x3071('0x5a')]()[_0x3071('0x2f')](function(){return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x138a94){var _0x1da477=[];if(_0x138a94){var _0x4f06c0;for(var _0x2a2e7a=0x0,_0x22ec7b;_0x2a2e7a<_0x138a94[_0x3071('0x1a')];_0x2a2e7a+=0x1){_0x22ec7b=_0x138a94[_0x2a2e7a]['get']({'plain':!![]});_0x1da477['push'](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x22ec7b,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}return _0x1da477;})[_0x3071('0x5a')]();})[_0x3071('0x2f')](function(){return db[_0x3071('0x5c')][_0x3071('0x50')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x3cc937){var _0x98d0fb=[];if(_0x3cc937){for(var _0x1fea60=0x0,_0x435dcb;_0x1fea60<_0x3cc937[_0x3071('0x1a')];_0x1fea60+=0x1){_0x435dcb=_0x3cc937[_0x1fea60]['get']({'plain':!![]});switch(_0x435dcb[_0x3071('0x52')]){case'always':_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;case _0x3071('0x58'):_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x435dcb,'CampaignId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x98d0fb['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5bc69e(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x98d0fb;})['all']();})['then'](function(){return db[_0x3071('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x5e'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x136278){var _0x22783b=[];if(_0x136278){for(var _0x2f31b7=0x0,_0x568386;_0x2f31b7<_0x136278[_0x3071('0x1a')];_0x2f31b7+=0x1){_0x568386=_0x136278[_0x2f31b7][_0x3071('0x54')]({'plain':!![]});_0x22783b[_0x3071('0x59')](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x568386,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})['catch'](_0x14ac42()));}}return _0x22783b;})[_0x3071('0x5a')]();})[_0x3071('0x30')](function(_0x391887){logger[_0x3071('0x14')](_0x3071('0x5f'),'generalCheckHopper',_0x391887[_0x3071('0x1c')]);});}var processPromises=function(_0x479fe7){return BPromise[_0x3071('0x5a')](promises)[_0x3071('0x2f')](function(_0x39060f){})[_0x3071('0x30')](function(_0x1120ec){logger[_0x3071('0x14')](_0x3071('0x60'),JSON[_0x3071('0x32')](_0x1120ec));})['finally'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x479fe7){return _0x479fe7[_0x3071('0x63')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x3071('0x2f')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3071('0x64')](FILEPATH);}catch(_0x5e0cbd){logger[_0x3071('0x14')](_0x3071('0x65'),JSON[_0x3071('0x32')](_0x5e0cbd));}finally{process[_0x3071('0x66')](0x0);}});};process['on'](_0x3071('0x67'),function(){logger[_0x3071('0x68')](_0x3071('0x69'));endCsv();});function main(){return BPromise[_0x3071('0x6a')]()[_0x3071('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x3071('0x2c')][_0x3071('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3071('0x2f')](function(_0x5b2830){var _0x561030=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x561030,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4eb9e2,_0x8c77b7){total+=0x1;var _0x44b4c9=total;promises['push'](checkRow(_0x4eb9e2,_0x5b2830,_0x44b4c9)[_0x3071('0x2f')](function(){success+=0x1;})[_0x3071('0x30')](function(_0x1f61df){if(_0x1f61df['error']){errors+=0x1;delete _0x1f61df['error'];}else if(_0x1f61df[_0x3071('0x2a')]){duplicates+=0x1;delete _0x1f61df[_0x3071('0x2a')];}rows[_0x3071('0x59')](_0x1f61df);}));if(total%0xc8===0x0){_0x8c77b7[_0x3071('0x6b')]();return processPromises(_0x8c77b7);}},'complete':function(){return processPromises()[_0x3071('0x2f')](function(){logger[_0x3071('0x68')](_0x3071('0x6c'));endCsv();});},'error':function(_0x5eb60d,_0x58b62c){logger[_0x3071('0x68')](_0x3071('0x6d'),JSON[_0x3071('0x32')](_0x5eb60d));endCsv();}});})[_0x3071('0x30')](function(_0x5a3b64){logger[_0x3071('0x14')](_0x3071('0x6e'),JSON[_0x3071('0x32')](_0x5a3b64));});}main(); \ No newline at end of file +var _0xa9e0=['CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','catch','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','emit','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate'];(function(_0x28eb38,_0x4000c8){var _0xdb677f=function(_0x20607c){while(--_0x20607c){_0x28eb38['push'](_0x28eb38['shift']());}};_0xdb677f(++_0x4000c8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0a9e('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var socket=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x0a9e('0xb')][0x2]||process['argv'][0x2]==='undefined'||process[_0x0a9e('0xb')][0x2]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xd'));}var FILEPATH=process[_0x0a9e('0xb')][0x2];if(!process[_0x0a9e('0xb')][0x3]||process[_0x0a9e('0xb')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xf'));}var FIELDS=_[_0x0a9e('0x10')](process['argv'][0x3][_0x0a9e('0x11')](','),process[_0x0a9e('0xb')][0x4][_0x0a9e('0x11')](','));if(!process[_0x0a9e('0xb')][0x5]||process[_0x0a9e('0xb')][0x5]===_0x0a9e('0xe')||process['argv'][0x5]===_0x0a9e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x0a9e('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x0a9e('0xb')][0x6]!==_0x0a9e('0xe')&&process['argv'][0x6]!==_0x0a9e('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x0a9e('0xb')][0x7]&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xe')&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xc')?process[_0x0a9e('0xb')][0x7]:null;if(!process[_0x0a9e('0xb')][0x8]||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2c3407){logger[_0x0a9e('0x13')](_0x2c3407);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x53682f,_0x20f109,_0x5a09ef,_0x588269){var _0x3a02e1={'message':_0x20f109};_0x3a02e1[_0x53682f]=!![];if(_0x5a09ef){_0x3a02e1[_0x0a9e('0x14')]=_0x5a09ef;}if(_0x588269){_0x3a02e1[_0x0a9e('0x15')]=_0x588269;}return _0x3a02e1;}function isEmail(_0x30bae6){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x30bae6);}function checkRow(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return new BPromise(function(_0x4d00e6,_0x370d86){if(_[_0x0a9e('0x16')](_0xfb6e48)){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b45bc));}if(_0xfb6e48['errors']&&_0xfb6e48[_0x0a9e('0x17')][_0x0a9e('0x18')]){var _0x40c424=_[_0x0a9e('0x19')](_0xfb6e48['errors'],_0x0a9e('0x1a'))['join'](';');return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x40c424,null,_0x3b45bc));}var _0x5bfb33={};for(var _0x1dc186 in FIELDS){if(FIELDS[_0x0a9e('0x1b')](_0x1dc186)&&FIELDS[_0x1dc186]){_0x5bfb33[_0x1dc186]=_0xfb6e48[_0x0a9e('0x1c')][0x0][FIELDS[_0x1dc186]]||_0xfb6e48[_0x0a9e('0x1c')][0x0]['\ufeff'+FIELDS[_0x1dc186]];}}if(!_0x5bfb33[_0x0a9e('0x1d')]){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x1e'),null,_0x3b45bc));}if(!_0x5bfb33[_0x0a9e('0x1f')]){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x20'),null,_0x3b45bc));}if(_0x5bfb33[_0x0a9e('0x21')]){var _0x2b1f27=moment(_0x5bfb33[_0x0a9e('0x21')],'YYYY-MM-DD');if(!_0x2b1f27[_0x0a9e('0x22')]()){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x23'),null,_0x3b45bc));}}if(_0x5bfb33[_0x0a9e('0x24')]){if(!isEmail(_0x5bfb33[_0x0a9e('0x24')])){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x25'),null,_0x3b45bc));}}_0x5bfb33[_0x0a9e('0x26')]=LISTID;_0x5bfb33[_0x0a9e('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2fb0e4){var _0x426950={};for(var _0x5d1e0e=0x0,_0x2407f9=DUPLICATES[_0x0a9e('0x18')];_0x5d1e0e<_0x2407f9;_0x5d1e0e+=0x1){_0x426950[DUPLICATES[_0x5d1e0e]]=_0x5bfb33[DUPLICATES[_0x5d1e0e]];}var _0x1122db=_[_0x0a9e('0x28')](_0x2fb0e4,_0x426950);if(_0x1122db){return _0x370d86(handleCheckRowError(_0x0a9e('0x29'),'Duplicate\x20Contact',_0x1122db,_0x3b45bc));}}return db[_0x0a9e('0x2a')][_0x0a9e('0x2b')](_0x5bfb33,{'raw':!![],'hooks':![],'fields':_[_0x0a9e('0x2c')](_0x5bfb33)})[_0x0a9e('0x2d')](function(_0x2b45ea){if(DUPLICATES&&DUPLICATES[_0x0a9e('0x18')]&&_0x2fb0e4){_0x2fb0e4[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x5bfb33,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2b45ea['id'];return _0x4d00e6();})['catch'](function(_0x44295a){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x30')+(_0x44295a[_0x0a9e('0x1a')]||JSON[_0x0a9e('0x31')](_0x44295a)),null,_0x3b45bc));});});}function checkHopper(){function _0x3f3d41(){return function(_0x567193){logger[_0x0a9e('0x13')](_0x0a9e('0x32'),_0x0a9e('0x33'),util[_0x0a9e('0x34')](_0x567193,{'showHidden':![],'depth':null}));};}var _0x4853b1=function(_0x54135e,_0x1e8694){var _0x5640eb=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')](['phone',_0x0a9e('0x39'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x1e8694,'createdAt',_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')]('phone','phone')[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),'ListId')['field'](_0x54135e['id'][_0x0a9e('0x3f')](),_0x1e8694)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')](_0x0a9e('0x46'))[_0x0a9e('0x43')](_0x0a9e('0x47'),squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')['where'](_0x1e8694+_0x0a9e('0x48'),_0x54135e['id'][_0x0a9e('0x3f')]())))[_0x0a9e('0x3f')]();return _0x5640eb;};var _0x315881=function(_0x1a69dd,_0xc9a702){var _0x10b040=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),'scheduledAt',_0x0a9e('0x3a'),_0x0a9e('0x26'),_0xc9a702,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x1a69dd['id'][_0x0a9e('0x3f')](),_0xc9a702)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x3b'))[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')]('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x4a'))[_0x0a9e('0x41')](_0x0a9e('0x4b'))[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id'][_0x0a9e('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id']['toString']())))['toString']();return _0x10b040;};function _0x2ef381(_0x59c6ff,_0x443e72){var _0x4c3845=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))['fromQuery']([_0x0a9e('0x1f'),_0x0a9e('0x39'),'ContactId','ListId',_0x443e72,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')]('phone',_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')['field']('id','ContactId')[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x59c6ff['id'][_0x0a9e('0x3f')](),_0x443e72)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID['toString']())[_0x0a9e('0x43')](_0x0a9e('0x4c'),squel['str'](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x3f')]();return _0x4c3845;}function _0x5ba1f9(_0x4b3c1a,_0x5674ee){var _0x273cb5=squel['insert']()[_0x0a9e('0x36')](_0x0a9e('0x4d'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x5674ee,'createdAt',_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field']('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),_0x0a9e('0x26'))['field'](_0x4b3c1a['id'][_0x0a9e('0x3f')](),_0x5674ee)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x3b'))[_0x0a9e('0x41')]('cm_contacts')[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')]('ListId\x20=\x20?',LISTID[_0x0a9e('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')](_0x0a9e('0x46')))[_0x0a9e('0x3f')]();return _0x273cb5;}return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')]({'where':{'type':_0x0a9e('0x50')},'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x53'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x19012b){var _0x2bbb86=[];if(_0x19012b){var _0x2b8192;for(var _0x320898=0x0,_0x412a72;_0x320898<_0x19012b[_0x0a9e('0x18')];_0x320898+=0x1){_0x412a72=_0x19012b[_0x320898][_0x0a9e('0x54')]({'plain':!![]});switch(_0x412a72['dialCheckDuplicateType']){case _0x0a9e('0x55'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x315881(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x4853b1(_0x412a72,_0x0a9e('0x57')))['then'](function(){})['catch'](_0x3f3d41()));break;default:_0x2bbb86['push'](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x2ef381(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}}return _0x2bbb86;})[_0x0a9e('0x5b')]()[_0x0a9e('0x2d')](function(){return db[_0x0a9e('0x4e')]['findAll']({'where':{'type':_0x0a9e('0x50')},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x2bdc44){var _0x583b2e=[];if(_0x2bdc44){var _0x4437ff;for(var _0x44351d=0x0,_0x4c46c1;_0x44351d<_0x2bdc44[_0x0a9e('0x18')];_0x44351d+=0x1){_0x4c46c1=_0x2bdc44[_0x44351d][_0x0a9e('0x54')]({'plain':!![]});_0x583b2e[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x5ba1f9(_0x4c46c1,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x583b2e;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x3511c9){var _0x30a4c7=[];if(_0x3511c9){for(var _0xf410e5=0x0,_0x332367;_0xf410e5<_0x3511c9[_0x0a9e('0x18')];_0xf410e5+=0x1){_0x332367=_0x3511c9[_0xf410e5][_0x0a9e('0x54')]({'plain':!![]});switch(_0x332367[_0x0a9e('0x51')]){case _0x0a9e('0x55'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x315881(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x4853b1(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));break;default:_0x30a4c7[_0x0a9e('0x2e')](db['sequelize']['query'](_0x2ef381(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));}}}return _0x30a4c7;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x2d2286){var _0x42b959=[];if(_0x2d2286){for(var _0x3755fe=0x0,_0x1f42a0;_0x3755fe<_0x2d2286[_0x0a9e('0x18')];_0x3755fe+=0x1){_0x1f42a0=_0x2d2286[_0x3755fe]['get']({'plain':!![]});_0x42b959[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x5ba1f9(_0x1f42a0,_0x0a9e('0x5e')))['then'](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x42b959;})[_0x0a9e('0x5b')]();})['catch'](function(_0x1d6834){logger['error'](_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x1d6834[_0x0a9e('0x1a')]);});}var processPromises=function(_0x385d52){return BPromise['all'](promises)['then'](function(_0x353384){})[_0x0a9e('0x5a')](function(_0x94dcf5){logger['error'](_0x0a9e('0x61'),JSON[_0x0a9e('0x31')](_0x94dcf5));})['finally'](function(){socket['emit'](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x385d52){return _0x385d52['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0a9e('0x2d')](function(){socket[_0x0a9e('0x63')](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0a9e('0x64')](FILEPATH);}catch(_0x3c6dd6){logger[_0x0a9e('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0a9e('0x31')](_0x3c6dd6));}finally{process['exit'](0x0);}});};process['on'](_0x0a9e('0x65'),function(){logger[_0x0a9e('0x66')](_0x0a9e('0x67'));endCsv();});function main(){return BPromise[_0x0a9e('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0a9e('0x11')](',');return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xb6e411){var _0x21e592=fs[_0x0a9e('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0a9e('0x6a')](_0x21e592,{'header':!![],'skipEmptyLines':!![],'step':function(_0x255e49,_0x1910bf){total+=0x1;var _0x32b9bd=total;promises[_0x0a9e('0x2e')](checkRow(_0x255e49,_0xb6e411,_0x32b9bd)['then'](function(){success+=0x1;})[_0x0a9e('0x5a')](function(_0x3325c5){if(_0x3325c5['error']){errors+=0x1;delete _0x3325c5[_0x0a9e('0x13')];}else if(_0x3325c5[_0x0a9e('0x29')]){duplicates+=0x1;delete _0x3325c5[_0x0a9e('0x29')];}rows['push'](_0x3325c5);}));if(total%0xc8===0x0){_0x1910bf[_0x0a9e('0x6b')]();return processPromises(_0x1910bf);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0a9e('0x66')](_0x0a9e('0x6c'));endCsv();});},'error':function(_0x558a87,_0x1f29bd){logger[_0x0a9e('0x66')](_0x0a9e('0x6d'),JSON[_0x0a9e('0x31')](_0x558a87));endCsv();}});})[_0x0a9e('0x5a')](function(_0x501050){logger[_0x0a9e('0x13')](_0x0a9e('0x6e'),JSON[_0x0a9e('0x31')](_0x501050));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index b2850b6..1ae6fdc 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 _0x45d5=['includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','length','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','campaigns','each','then','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','bluebird','squel','ioredis','../../../config/environment','../../../config/logger','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','field','phone','join','.id\x20=\x20','\x20=\x20','where','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','ContactId','createdAt','updatedAt','UserId','recallme','select','from','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.phone','into','cm_hopper_black','ListId','fields','cm_contacts.ListId\x20=\x20','.CmListId','ListId\x20=\x20?','\x20=\x20?','concat','keys','cm_contacts',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','error','message','exit','errors','push','query','spread','catch','main','stringify','send','start','socket_timestamp','root','header','writeFileSync','parse','data','hasOwnProperty','trim','replace','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN'];(function(_0x48d7b9,_0x47790b){var _0x226c2d=function(_0x26459b){while(--_0x26459b){_0x48d7b9['push'](_0x48d7b9['shift']());}};_0x226c2d(++_0x47790b);}(_0x45d5,0xbe));var _0x545d=function(_0x45d8ba,_0x203b8e){_0x45d8ba=_0x45d8ba-0x0;var _0x1b258b=_0x45d5[_0x45d8ba];return _0x1b258b;};'use strict';var fs=require('fs');var path=require(_0x545d('0x0'));var _=require(_0x545d('0x1'));var Papa=require(_0x545d('0x2'));var util=require(_0x545d('0x3'));var BPromise=require(_0x545d('0x4'));var moment=require('moment');var squel=require(_0x545d('0x5'));var Redis=require(_0x545d('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0x545d('0x7'));var logger=require(_0x545d('0x8'))('import');config['redis']=_[_0x545d('0x9')](config[_0x545d('0xa')],{'host':_0x545d('0xb'),'port':0x18eb});var socket=require(_0x545d('0xc'))(new Redis(config[_0x545d('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x545d('0xd')](_0x545d('0xe'));function isEmail(_0xb971cc){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0xb971cc);}function selectNotIn(_0x387b16,_0x104709,_0x296767,_0x4edf56,_0x151aa0){return squel['select']()[_0x545d('0xf')](_0x545d('0x10'))['from'](_0x4edf56)[_0x545d('0x11')](_0x104709,null,_0x104709+_0x545d('0x12')+_0x4edf56+'.'+_0x296767)['where'](_0x4edf56+'.'+_0x296767+_0x545d('0x13')+_0x387b16+'.'+_0x296767)[_0x545d('0x14')](_0x104709+'.dialCheckDuplicateType\x20IN\x20('+_0x151aa0['join']()+')');}function insertCmHopper(_0x213a5d,_0x90e8f2,_0x47c25f,_0xd01101,_0x36b23e){var _0x472bb6=['cm_contacts.phone',_0x545d('0x15'),_0x545d('0x16'),_0x545d('0x17'),_0x90e8f2+'.'+_0xd01101,_0x545d('0x18'),_0x545d('0x19'),_0x545d('0x1a'),_0x545d('0x1b'),'\x22'+_0x36b23e+'\x22'];return squel[_0x545d('0x1c')]()['into'](_0x545d('0x1d'))[_0x545d('0x1e')]([_0x545d('0x10'),'scheduledat',_0x545d('0x1f'),'ListId',_0xd01101,_0x545d('0x20'),_0x545d('0x21'),'priority',_0x545d('0x22'),_0x545d('0x23')],squel[_0x545d('0x24')]()['fields'](_0x472bb6)[_0x545d('0x25')](_0x90e8f2)[_0x545d('0x11')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x90e8f2+'.CmListId')[_0x545d('0x11')](_0x47c25f,null,_0x47c25f+_0x545d('0x12')+_0x90e8f2+'.'+_0xd01101)[_0x545d('0x14')](_0x90e8f2+_0x545d('0x26'),_0x213a5d)[_0x545d('0x14')](_0x545d('0x27'),NOW)[_0x545d('0x14')](_0x545d('0x28'),selectNotIn(_0x90e8f2,_0x47c25f,_0xd01101,'cm_hopper',[_0x545d('0x29'),_0x545d('0x2a')]))[_0x545d('0x14')](_0x545d('0x28'),selectNotIn(_0x90e8f2,_0x47c25f,_0xd01101,'cm_hopper',['\x22always\x22'])))[_0x545d('0x2b')]();}function insertCmHopperBlack(_0x57677b,_0xfd10c1,_0x360962,_0x497c94){var _0x39781e=[_0x545d('0x2c'),_0x545d('0x16'),'cm_contacts.ListId',_0xfd10c1+'.'+_0x497c94,_0x545d('0x18'),'cm_contacts.updatedAt'];return squel[_0x545d('0x1c')]()[_0x545d('0x2d')](_0x545d('0x2e'))[_0x545d('0x1e')]([_0x545d('0x10'),_0x545d('0x1f'),_0x545d('0x2f'),_0x497c94,_0x545d('0x20'),_0x545d('0x21')],squel[_0x545d('0x24')]()[_0x545d('0x30')](_0x39781e)[_0x545d('0x25')](_0xfd10c1)['join']('cm_contacts',null,_0x545d('0x31')+_0xfd10c1+_0x545d('0x32'))['join'](_0x360962,null,_0x360962+_0x545d('0x12')+_0xfd10c1+'.'+_0x497c94)[_0x545d('0x14')](_0xfd10c1+_0x545d('0x26'),_0x57677b)[_0x545d('0x14')](_0x545d('0x27'),NOW)['where'](_0x545d('0x28'),squel[_0x545d('0x24')]()[_0x545d('0xf')](_0x545d('0x10'))[_0x545d('0x25')]('cm_hopper_black')['where'](_0x545d('0x33'),_0x57677b)[_0x545d('0x14')](_0x497c94+_0x545d('0x34'),_0xfd10c1+'.'+_0x497c94)))['toString']();}function insertCmContact(_0x30163c,_0x46c778,_0x1079df,_0x448d8e){var _0x2e47d6=_[_0x545d('0x35')](_[_0x545d('0x36')](_0x448d8e),[_0x545d('0x2f'),'CompanyId',_0x545d('0x20'),_0x545d('0x21')]);return squel['insert']()[_0x545d('0x2d')](_0x545d('0x37'))[_0x545d('0x1e')](_0x2e47d6,squel[_0x545d('0x24')]()[_0x545d('0x30')](_0x2e47d6)[_0x545d('0x25')](_0x46c778)[_0x545d('0x14')]('('+_0x1079df[_0x545d('0x11')](',')+_0x545d('0x38'),squel[_0x545d('0x24')]()[_0x545d('0x30')](_0x1079df)[_0x545d('0x25')]('cm_contacts')[_0x545d('0x14')]('ListId\x20=\x20?',_0x30163c)[_0x545d('0x14')](_0x545d('0x39')))[_0x545d('0x14')](_0x545d('0x3a'),squel[_0x545d('0x24')]()['field'](_0x545d('0x3b'),_0x545d('0x3c'))['from'](_0x46c778)['group'](_0x1079df[_0x545d('0x11')](','))))[_0x545d('0x2b')]();}function handleStop(){logger[_0x545d('0x3d')](_0x545d('0x3e'));stopped=!![];}function handleUncaughtException(_0x41e884){logger[_0x545d('0x3f')](_0x41e884[_0x545d('0x40')]);process[_0x545d('0x41')](0x1);}function handleError(_0x45c105,_0x550f5b){stats[_0x545d('0x42')][_0x545d('0x43')]({'name':_0x550f5b['code'],'message':_0x550f5b[_0x545d('0x40')],'row':_0x45c105});}function handleQuery(_0x33e928){logger[_0x545d('0x3d')](_0x33e928);return db['sequelize'][_0x545d('0x44')](_0x33e928)[_0x545d('0x45')](function(_0x476aff){results[_0x545d('0x43')](_0x476aff);})[_0x545d('0x46')](function(_0x238c84){logger[_0x545d('0x3f')](_0x238c84[_0x545d('0x40')]);});}function main(_0x4c56e8,_0x162243,_0x56c4a3,_0x3e6810){logger[_0x545d('0x3d')](_0x545d('0x47'),_0x4c56e8,JSON[_0x545d('0x48')](_0x162243));process[_0x545d('0x49')](_0x545d('0x4a'));var _0x521e9e=_0x162243['binding'];var _0x24b104=_0x162243[_0x545d('0x4b')];var _0x3a4170=path[_0x545d('0x11')](config[_0x545d('0x4c')],'server/files/tmp',_0x24b104+'.csv');var _0x3572c6=_[_0x545d('0x36')](_0x521e9e)['join']();logger['info'](_0x545d('0x4d'),_0x3572c6);fs[_0x545d('0x4e')](_0x3a4170,_0x3572c6+'\x0a');Papa[_0x545d('0x4f')](fs['createReadStream'](_0x4c56e8),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5c3167,_0x7131b6){try{for(var _0x147e08=0x0,_0x2d434d=[];_0x147e08<_0x5c3167[_0x545d('0x50')]['length'];_0x147e08++){stats['rows']+=0x1;if(_0x5c3167['errors'][_0x147e08]){handleError(_0x5c3167[_0x545d('0x50')][_0x147e08],_0x5c3167['errors'][_0x147e08]);}else{var _0x33357f=[];for(var _0x65c160 in _0x521e9e){if(_0x521e9e[_0x545d('0x51')](_0x65c160)){if(_0x5c3167[_0x545d('0x50')][_0x147e08][_0x521e9e[_0x65c160]]){var _0x20f0c7=_[_0x545d('0x52')](_0x5c3167[_0x545d('0x50')][_0x147e08][_0x521e9e[_0x65c160]][_0x545d('0x53')](/"/g,'\x27'));switch(_0x65c160){case _0x545d('0x54'):var _0x1aa7e3=moment(_0x20f0c7,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x1aa7e3[_0x545d('0x55')]()){_0x2d434d[_0x545d('0x43')]('\x22'+_0x20f0c7+'\x22');}else{_0x33357f[_0x545d('0x43')](_0x545d('0x56'));}break;case'priority':var _0x2bdd50=parseInt(_0x20f0c7);_0x20f0c7=_[_0x545d('0x57')](_0x2bdd50)||_0x2bdd50<0x0||_0x2bdd50>0x4?_0x3e6810?0x3:0x2:_0x2bdd50;_0x2d434d['push']('\x22'+_0x20f0c7+'\x22');break;case _0x545d('0x22'):var _0x13899a=parseInt(_0x20f0c7);if(_['isNumber'](_0x13899a)&&_[_0x545d('0x58')](_0x56c4a3,_0x13899a)){_0x2d434d['push']('\x22'+_0x13899a+'\x22');}else{_0x33357f[_0x545d('0x43')](_0x545d('0x59'));}break;case'email':if(isEmail(_0x20f0c7)){_0x2d434d[_0x545d('0x43')]('\x22'+_0x20f0c7+'\x22');}else{_0x33357f[_0x545d('0x43')](_0x545d('0x5a'));}break;case _0x545d('0x5b'):var _0x2d7aea=moment(_0x20f0c7,_0x545d('0x5c'),!![]);if(_0x2d7aea['isValid']()){_0x2d434d[_0x545d('0x43')]('\x22'+_0x20f0c7+'\x22');}else{_0x33357f[_0x545d('0x43')](_0x545d('0x5d'));}break;default:_0x2d434d[_0x545d('0x43')]('\x22'+_0x20f0c7+'\x22');}}else{switch(_0x65c160){case'firstName':case _0x545d('0x10'):_0x33357f['push'](_0x65c160+_0x545d('0x5e'));break;default:_0x2d434d[_0x545d('0x43')]('\x22\x22');}}}}if(_0x33357f[_0x545d('0x5f')]){handleError(_0x5c3167[_0x545d('0x50')][_0x147e08],{'code':_0x545d('0x60'),'message':_0x33357f[_0x545d('0x11')]()});}else{fs[_0x545d('0x61')](_0x3a4170,_0x2d434d[_0x545d('0x11')]()+'\x0a');}_0x2d434d=[];}if(!(stats[_0x545d('0x62')]%0xc8)){socket[_0x545d('0x63')](_0x545d('0x64')+_0x24b104,stats);stats[_0x545d('0x42')]=[];}}if(stopped){logger[_0x545d('0x3d')](_0x545d('0x65'));_0x7131b6[_0x545d('0x66')]();}}catch(_0x455dc4){handleError(_0x5c3167[_0x545d('0x50')][_0x147e08],{'code':_0x545d('0x67'),'message':_0x455dc4[_0x545d('0x40')]});logger[_0x545d('0x3f')](_0x545d('0x68'),_0x455dc4[_0x545d('0x40')]);}},'complete':function(){try{var _0x494879=[];var _0x599440=_0x545d('0x37');if(_0x162243[_0x545d('0x69')]&&_0x162243[_0x545d('0x69')]['length']){_0x599440=_0x545d('0x6a')+_0x24b104;_0x494879[_0x545d('0x43')](_0x545d('0x6b')+_0x599440+'\x20LIKE\x20cm_contacts;');}var _0x5a2600=util['format'](_0x545d('0x6c'),_0x3a4170,_0x599440,_0x3572c6,_0x162243['ListId'],_0x162243[_0x545d('0x6d')]||null,NOW,NOW);if(_['isNil'](_0x521e9e[_0x545d('0x54')])){_0x5a2600+=_0x545d('0x6e');}_0x494879[_0x545d('0x43')](_0x5a2600);if(_0x162243[_0x545d('0x69')]&&_0x162243[_0x545d('0x69')][_0x545d('0x5f')]){_0x494879[_0x545d('0x43')](insertCmContact(_0x162243[_0x545d('0x2f')],_0x599440,_0x162243[_0x545d('0x69')],_0x521e9e));_0x494879[_0x545d('0x43')](_0x545d('0x6f')+_0x599440+';');}_0x494879[_0x545d('0x43')](insertCmHopper(_0x162243['ListId'],_0x545d('0x70'),'voice_queues','VoiceQueueId',_0x3e6810));_0x494879[_0x545d('0x43')](insertCmHopperBlack(_0x162243['ListId'],'voice_queues_has_cm_blacklists',_0x545d('0x71'),_0x545d('0x72')));_0x494879['push'](insertCmHopper(_0x162243[_0x545d('0x2f')],_0x545d('0x73'),'campaigns',_0x545d('0x74'),_0x3e6810));_0x494879[_0x545d('0x43')](insertCmHopperBlack(_0x162243['ListId'],_0x545d('0x75'),_0x545d('0x76'),_0x545d('0x74')));BPromise[_0x545d('0x77')](_0x494879,handleQuery)[_0x545d('0x78')](function(_0x492266){stats[_0x545d('0x79')]=!![];stats[_0x545d('0x7a')]=_0x162243['duplicates']&&_0x162243[_0x545d('0x69')][_0x545d('0x5f')]?results[0x2][_0x545d('0x7a')]:results[0x0]['affectedRows'];socket[_0x545d('0x63')](_0x545d('0x64')+_0x24b104,stats);fs[_0x545d('0x7b')](_0x4c56e8);fs['unlink'](_0x3a4170);process[_0x545d('0x41')](0x0);})[_0x545d('0x46')](function(_0x15ff4a){logger[_0x545d('0x3f')](_0x15ff4a[_0x545d('0x40')]);process[_0x545d('0x41')](0x1);});}catch(_0x60ae48){logger[_0x545d('0x3f')](_0x545d('0x7c'),_0x60ae48[_0x545d('0x40')]);process[_0x545d('0x41')](0x1);}},'error':function(_0x4bd339,_0x49363b,_0x5c38fb,_0x205695){throw new Error(_0x205695);}});}function validate(){if(process[_0x545d('0x7d')]&&process[_0x545d('0x7d')][_0x545d('0x5f')]<0x4){throw new Error(_0x545d('0x7e'));}var _0x1b5868=path[_0x545d('0x11')](config[_0x545d('0x4c')],'server/files/tmp',process[_0x545d('0x7d')][0x2]);if(!fs[_0x545d('0x7f')](_0x1b5868)){throw new Error(_0x545d('0x80'));}var _0x261215={};try{_0x261215=JSON[_0x545d('0x4f')](process['argv'][0x3]);if(!_0x261215['binding']){throw new Error(_0x545d('0x81'));}if(!_0x261215[_0x545d('0x82')][_0x545d('0x10')]){throw new Error(_0x545d('0x83'));}if(!_0x261215[_0x545d('0x82')][_0x545d('0x84')]){throw new Error(_0x545d('0x85'));}var _0x253a98=0x0;if(_0x261215[_0x545d('0x82')][_0x545d('0x22')]){_0x253a98=0x1;}if(!_0x261215[_0x545d('0x2f')]){throw new Error(_0x545d('0x86'));}}catch(_0x33b216){throw new Error(_0x545d('0x87'));}var _0xfbc791=[];try{_0xfbc791=_[_0x545d('0x88')](JSON['parse'](process[_0x545d('0x7d')][0x4]),'id');}catch(_0x32814c){logger[_0x545d('0x3d')](_0x545d('0x89'));}main(_0x1b5868,_0x261215,_0xfbc791,_0x253a98);}validate();process['on']('SIGINT',handleStop);process['on'](_0x545d('0x8a'),handleUncaughtException); \ No newline at end of file +var _0x37a9=['cm_contacts.createdAt','cm_hopper_black','ContactId','ListId','updatedAt','cm_contacts.ListId\x20=\x20','field','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId','id\x20IN\x20?','MIN(id)','Received\x20SIGINT','error','message','exit','push','sequelize','query','catch','info','stringify','send','binding','socket_timestamp','root','server/files/tmp','.csv','header','parse','data','length','rows','errors','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','SystemRow','emit','contact:import:','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','complete','argv','arguments\x20\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','util','bluebird','ioredis','../../../mysqldb','import','defaults','redis','format','YYYY-MM-DD\x20HH:mm:ss','select','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','createdAt','priority','UserId','recallme','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString'];(function(_0x4ca252,_0xc7984c){var _0x48639c=function(_0x26808a){while(--_0x26808a){_0x4ca252['push'](_0x4ca252['shift']());}};_0x48639c(++_0xc7984c);}(_0x37a9,0x144));var _0x937a=function(_0x2df11a,_0xfb1a4f){_0x2df11a=_0x2df11a-0x0;var _0x4fefbd=_0x37a9[_0x2df11a];return _0x4fefbd;};'use strict';var fs=require('fs');var path=require(_0x937a('0x0'));var _=require(_0x937a('0x1'));var Papa=require('papaparse');var util=require(_0x937a('0x2'));var BPromise=require(_0x937a('0x3'));var moment=require('moment');var squel=require('squel');var Redis=require(_0x937a('0x4'));var db=require(_0x937a('0x5'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x937a('0x6'));config['redis']=_[_0x937a('0x7')](config[_0x937a('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x937a('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x937a('0x9')](_0x937a('0xa'));function isEmail(_0x333085){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x333085);}function selectNotIn(_0x5129f5,_0x4f9f5b,_0x578dbb,_0x1ef308,_0x536d79){return squel[_0x937a('0xb')]()['field'](_0x937a('0xc'))[_0x937a('0xd')](_0x1ef308)[_0x937a('0xe')](_0x4f9f5b,null,_0x4f9f5b+_0x937a('0xf')+_0x1ef308+'.'+_0x578dbb)[_0x937a('0x10')](_0x1ef308+'.'+_0x578dbb+'\x20=\x20'+_0x5129f5+'.'+_0x578dbb)[_0x937a('0x10')](_0x4f9f5b+_0x937a('0x11')+_0x536d79['join']()+')');}function insertCmHopper(_0x188805,_0x54b516,_0x4b8e25,_0x2500fa,_0x2cadc2){var _0x505129=[_0x937a('0x12'),_0x937a('0x13'),_0x937a('0x14'),_0x937a('0x15'),_0x54b516+'.'+_0x2500fa,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x937a('0x16'),_0x937a('0x17'),'\x22'+_0x2cadc2+'\x22'];return squel[_0x937a('0x18')]()[_0x937a('0x19')](_0x937a('0x1a'))[_0x937a('0x1b')](['phone',_0x937a('0x1c'),'ContactId','ListId',_0x2500fa,_0x937a('0x1d'),'updatedAt',_0x937a('0x1e'),_0x937a('0x1f'),_0x937a('0x20')],squel[_0x937a('0xb')]()[_0x937a('0x21')](_0x505129)['from'](_0x54b516)[_0x937a('0xe')](_0x937a('0x22'),null,'cm_contacts.ListId\x20=\x20'+_0x54b516+_0x937a('0x23'))[_0x937a('0xe')](_0x4b8e25,null,_0x4b8e25+'.id\x20=\x20'+_0x54b516+'.'+_0x2500fa)[_0x937a('0x10')](_0x54b516+_0x937a('0x24'),_0x188805)[_0x937a('0x10')](_0x937a('0x25'),NOW)[_0x937a('0x10')](_0x937a('0x26'),selectNotIn(_0x54b516,_0x4b8e25,_0x2500fa,_0x937a('0x1a'),[_0x937a('0x27'),_0x937a('0x28')]))[_0x937a('0x10')](_0x937a('0x26'),selectNotIn(_0x54b516,_0x4b8e25,_0x2500fa,'cm_hopper',[_0x937a('0x27')])))[_0x937a('0x29')]();}function insertCmHopperBlack(_0x5bd1e5,_0x540b6b,_0x160185,_0x20a42){var _0x10673f=['cm_contacts.phone',_0x937a('0x14'),_0x937a('0x15'),_0x540b6b+'.'+_0x20a42,_0x937a('0x2a'),'cm_contacts.updatedAt'];return squel['insert']()[_0x937a('0x19')](_0x937a('0x2b'))['fromQuery']([_0x937a('0xc'),_0x937a('0x2c'),_0x937a('0x2d'),_0x20a42,_0x937a('0x1d'),_0x937a('0x2e')],squel[_0x937a('0xb')]()[_0x937a('0x21')](_0x10673f)[_0x937a('0xd')](_0x540b6b)[_0x937a('0xe')](_0x937a('0x22'),null,_0x937a('0x2f')+_0x540b6b+'.CmListId')[_0x937a('0xe')](_0x160185,null,_0x160185+_0x937a('0xf')+_0x540b6b+'.'+_0x20a42)['where'](_0x540b6b+_0x937a('0x24'),_0x5bd1e5)[_0x937a('0x10')](_0x937a('0x25'),NOW)[_0x937a('0x10')](_0x937a('0x26'),squel['select']()[_0x937a('0x30')]('phone')[_0x937a('0xd')](_0x937a('0x2b'))['where'](_0x937a('0x31'),_0x5bd1e5)[_0x937a('0x10')](_0x20a42+_0x937a('0x32'),_0x540b6b+'.'+_0x20a42)))['toString']();}function insertCmContact(_0x5ad73c,_0xd3cb81,_0x13cf00,_0x3ff606){var _0x5b2f54=_[_0x937a('0x33')](_[_0x937a('0x34')](_0x3ff606),[_0x937a('0x2d'),_0x937a('0x35'),_0x937a('0x1d'),_0x937a('0x2e')]);return squel[_0x937a('0x18')]()[_0x937a('0x19')](_0x937a('0x22'))[_0x937a('0x1b')](_0x5b2f54,squel[_0x937a('0xb')]()[_0x937a('0x21')](_0x5b2f54)['from'](_0xd3cb81)[_0x937a('0x10')]('('+_0x13cf00[_0x937a('0xe')](',')+')\x20NOT\x20IN\x20?',squel[_0x937a('0xb')]()[_0x937a('0x21')](_0x13cf00)[_0x937a('0xd')](_0x937a('0x22'))['where'](_0x937a('0x31'),_0x5ad73c)[_0x937a('0x10')]('deletedAt\x20IS\x20NULL'))[_0x937a('0x10')](_0x937a('0x36'),squel[_0x937a('0xb')]()[_0x937a('0x30')](_0x937a('0x37'),'min_id')[_0x937a('0xd')](_0xd3cb81)['group'](_0x13cf00[_0x937a('0xe')](','))))[_0x937a('0x29')]();}function handleStop(){logger['info'](_0x937a('0x38'));stopped=!![];}function handleUncaughtException(_0x293e30){logger[_0x937a('0x39')](_0x293e30[_0x937a('0x3a')]);process[_0x937a('0x3b')](0x1);}function handleError(_0x3b411e,_0x460516){stats['errors'][_0x937a('0x3c')]({'name':_0x460516['code'],'message':_0x460516[_0x937a('0x3a')],'row':_0x3b411e});}function handleQuery(_0xcfbab2){logger['info'](_0xcfbab2);return db[_0x937a('0x3d')][_0x937a('0x3e')](_0xcfbab2)['spread'](function(_0x1afd56){results[_0x937a('0x3c')](_0x1afd56);})[_0x937a('0x3f')](function(_0x35762b){logger[_0x937a('0x39')](_0x35762b[_0x937a('0x3a')]);});}function main(_0x277f0a,_0x582d80,_0x4dc43,_0x63f6ed){logger[_0x937a('0x40')]('main',_0x277f0a,JSON[_0x937a('0x41')](_0x582d80));process[_0x937a('0x42')]('start');var _0xf97a6c=_0x582d80[_0x937a('0x43')];var _0x39cd76=_0x582d80[_0x937a('0x44')];var _0x28bbd7=path[_0x937a('0xe')](config[_0x937a('0x45')],_0x937a('0x46'),_0x39cd76+_0x937a('0x47'));var _0x14e8c0=_[_0x937a('0x34')](_0xf97a6c)[_0x937a('0xe')]();logger['info'](_0x937a('0x48'),_0x14e8c0);fs['writeFileSync'](_0x28bbd7,_0x14e8c0+'\x0a');Papa[_0x937a('0x49')](fs['createReadStream'](_0x277f0a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x119e55,_0x58853b){try{for(var _0x3f5f66=0x0,_0x1c8ec2=[];_0x3f5f66<_0x119e55[_0x937a('0x4a')][_0x937a('0x4b')];_0x3f5f66++){stats[_0x937a('0x4c')]+=0x1;if(_0x119e55[_0x937a('0x4d')][_0x3f5f66]){handleError(_0x119e55[_0x937a('0x4a')][_0x3f5f66],_0x119e55[_0x937a('0x4d')][_0x3f5f66]);}else{var _0x3707b1=[];for(var _0x5c8f9d in _0xf97a6c){if(_0xf97a6c[_0x937a('0x4e')](_0x5c8f9d)){if(_0x119e55[_0x937a('0x4a')][_0x3f5f66][_0xf97a6c[_0x5c8f9d]]){var _0x4172c2=_[_0x937a('0x4f')](_0x119e55[_0x937a('0x4a')][_0x3f5f66][_0xf97a6c[_0x5c8f9d]][_0x937a('0x50')](/"/g,'\x27'));switch(_0x5c8f9d){case _0x937a('0x1c'):var _0x970256=moment(_0x4172c2,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x970256[_0x937a('0x51')]()){_0x1c8ec2[_0x937a('0x3c')]('\x22'+_0x4172c2+'\x22');}else{_0x3707b1[_0x937a('0x3c')](_0x937a('0x52'));}break;case _0x937a('0x1e'):var _0x160258=parseInt(_0x4172c2);_0x4172c2=_[_0x937a('0x53')](_0x160258)||_0x160258<0x0||_0x160258>0x4?_0x63f6ed?0x3:0x2:_0x160258;_0x1c8ec2[_0x937a('0x3c')]('\x22'+_0x4172c2+'\x22');break;case _0x937a('0x1f'):var _0x2ffc8e=parseInt(_0x4172c2);if(_[_0x937a('0x54')](_0x2ffc8e)&&_[_0x937a('0x55')](_0x4dc43,_0x2ffc8e)){_0x1c8ec2[_0x937a('0x3c')]('\x22'+_0x2ffc8e+'\x22');}else{_0x3707b1['push']('agent\x20not\x20exists');}break;case _0x937a('0x56'):if(isEmail(_0x4172c2)){_0x1c8ec2['push']('\x22'+_0x4172c2+'\x22');}else{_0x3707b1['push'](_0x937a('0x57'));}break;case'dateOfBirth':var _0x44fceb=moment(_0x4172c2,_0x937a('0x58'),!![]);if(_0x44fceb[_0x937a('0x51')]()){_0x1c8ec2[_0x937a('0x3c')]('\x22'+_0x4172c2+'\x22');}else{_0x3707b1['push'](_0x937a('0x59'));}break;default:_0x1c8ec2[_0x937a('0x3c')]('\x22'+_0x4172c2+'\x22');}}else{switch(_0x5c8f9d){case'firstName':case _0x937a('0xc'):_0x3707b1['push'](_0x5c8f9d+'\x20not\x20specified');break;default:_0x1c8ec2[_0x937a('0x3c')]('\x22\x22');}}}}if(_0x3707b1['length']){handleError(_0x119e55[_0x937a('0x4a')][_0x3f5f66],{'code':_0x937a('0x5a'),'message':_0x3707b1['join']()});}else{fs['appendFileSync'](_0x28bbd7,_0x1c8ec2[_0x937a('0xe')]()+'\x0a');}_0x1c8ec2=[];}if(!(stats[_0x937a('0x4c')]%0xc8)){socket[_0x937a('0x5b')](_0x937a('0x5c')+_0x39cd76,stats);stats[_0x937a('0x4d')]=[];}}if(stopped){logger['info'](_0x937a('0x5d'));_0x58853b['abort']();}}catch(_0x121e46){handleError(_0x119e55['data'][_0x3f5f66],{'code':_0x937a('0x5e'),'message':_0x121e46[_0x937a('0x3a')]});logger[_0x937a('0x39')](_0x937a('0x5f'),_0x121e46[_0x937a('0x3a')]);}},'complete':function(){try{var _0x671ac8=[];var _0x5cb517=_0x937a('0x22');if(_0x582d80[_0x937a('0x60')]&&_0x582d80[_0x937a('0x60')][_0x937a('0x4b')]){_0x5cb517=_0x937a('0x61')+_0x39cd76;_0x671ac8['push'](_0x937a('0x62')+_0x5cb517+_0x937a('0x63'));}var _0x55d846=util[_0x937a('0x9')]('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',_0x28bbd7,_0x5cb517,_0x14e8c0,_0x582d80['ListId'],_0x582d80['CompanyId']||null,NOW,NOW);if(_[_0x937a('0x64')](_0xf97a6c[_0x937a('0x1c')])){_0x55d846+=_0x937a('0x65');}_0x671ac8[_0x937a('0x3c')](_0x55d846);if(_0x582d80[_0x937a('0x60')]&&_0x582d80[_0x937a('0x60')][_0x937a('0x4b')]){_0x671ac8[_0x937a('0x3c')](insertCmContact(_0x582d80[_0x937a('0x2d')],_0x5cb517,_0x582d80[_0x937a('0x60')],_0xf97a6c));_0x671ac8['push'](_0x937a('0x66')+_0x5cb517+';');}_0x671ac8['push'](insertCmHopper(_0x582d80[_0x937a('0x2d')],_0x937a('0x67'),_0x937a('0x68'),'VoiceQueueId',_0x63f6ed));_0x671ac8[_0x937a('0x3c')](insertCmHopperBlack(_0x582d80[_0x937a('0x2d')],'voice_queues_has_cm_blacklists',_0x937a('0x68'),'VoiceQueueId'));_0x671ac8['push'](insertCmHopper(_0x582d80[_0x937a('0x2d')],'campaigns_has_cm_lists','campaigns',_0x937a('0x69'),_0x63f6ed));_0x671ac8[_0x937a('0x3c')](insertCmHopperBlack(_0x582d80[_0x937a('0x2d')],_0x937a('0x6a'),'campaigns','CampaignId'));BPromise[_0x937a('0x6b')](_0x671ac8,handleQuery)[_0x937a('0x6c')](function(_0x2c8ac4){stats[_0x937a('0x6d')]=!![];stats['affectedRows']=_0x582d80[_0x937a('0x60')]&&_0x582d80[_0x937a('0x60')][_0x937a('0x4b')]?results[0x2][_0x937a('0x6e')]:results[0x0]['affectedRows'];socket[_0x937a('0x5b')](_0x937a('0x5c')+_0x39cd76,stats);fs['unlink'](_0x277f0a);fs['unlink'](_0x28bbd7);process[_0x937a('0x3b')](0x0);})[_0x937a('0x3f')](function(_0x4df317){logger[_0x937a('0x39')](_0x4df317[_0x937a('0x3a')]);process[_0x937a('0x3b')](0x1);});}catch(_0x213d16){logger['error'](_0x937a('0x6f'),_0x213d16['message']);process[_0x937a('0x3b')](0x1);}},'error':function(_0x2f2838,_0x49607c,_0x34145d,_0x17305d){throw new Error(_0x17305d);}});}function validate(){if(process[_0x937a('0x70')]&&process[_0x937a('0x70')][_0x937a('0x4b')]<0x4){throw new Error(_0x937a('0x71'));}var _0x3eb148=path[_0x937a('0xe')](config[_0x937a('0x45')],_0x937a('0x46'),process['argv'][0x2]);if(!fs[_0x937a('0x72')](_0x3eb148)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x3526bc={};try{_0x3526bc=JSON[_0x937a('0x49')](process[_0x937a('0x70')][0x3]);if(!_0x3526bc[_0x937a('0x43')]){throw new Error(_0x937a('0x73'));}if(!_0x3526bc[_0x937a('0x43')][_0x937a('0xc')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x3526bc[_0x937a('0x43')]['firstName']){throw new Error(_0x937a('0x74'));}var _0x2c7a38=0x0;if(_0x3526bc[_0x937a('0x43')][_0x937a('0x1f')]){_0x2c7a38=0x1;}if(!_0x3526bc[_0x937a('0x2d')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x3103ca){throw new Error(_0x937a('0x75'));}var _0x1b441f=[];try{_0x1b441f=_[_0x937a('0x76')](JSON[_0x937a('0x49')](process[_0x937a('0x70')][0x4]),'id');}catch(_0x32ae9e){logger[_0x937a('0x40')](_0x937a('0x77'));}main(_0x3eb148,_0x3526bc,_0x1b441f,_0x2c7a38);}validate();process['on'](_0x937a('0x78'),handleStop);process['on'](_0x937a('0x79'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index de31018..6deac72 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc2da=['Agent\x20Name','destcalleridname','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','talktime','Called\x20Number','Member\x20Name','membername','starttime','Answer\x20Time','answertime','Complete\x20Time','duration','Billable\x20Time','billableseconds','getSubjects','string','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','Date'];(function(_0x4e3bda,_0x4f8394){var _0x4b59e1=function(_0x30d1b8){while(--_0x30d1b8){_0x4e3bda['push'](_0x4e3bda['shift']());}};_0x4b59e1(++_0x4f8394);}(_0xc2da,0x124));var _0xac2d=function(_0x5959e2,_0x3a8ac3){_0x5959e2=_0x5959e2-0x0;var _0x299a72=_0xc2da[_0x5959e2];return _0x299a72;};'use strict';exports[_0xac2d('0x0')]=function(_0x57f8ea,_0x7f62e1){var _0x529c17=[{'type':_0xac2d('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x57f8ea[_0xac2d('0x2')]()){case _0xac2d('0x3'):switch(_0x7f62e1[_0xac2d('0x2')]()){case _0xac2d('0x4'):_0x529c17[_0xac2d('0x5')]({'type':_0xac2d('0x6'),'content':'','variableName':_0xac2d('0x7')});_0x529c17[_0xac2d('0x5')]({'type':_0xac2d('0x6'),'content':'','variableName':_0xac2d('0x8')});break;case _0xac2d('0x9'):_0x529c17['push']({'type':'string','content':_0xac2d('0xa'),'variableName':null});_0x529c17['push']({'type':_0xac2d('0x6'),'content':'','variableName':_0xac2d('0xb')});break;}}return _0x529c17;};exports[_0xac2d('0xc')]=function(_0x11ac79,_0x9a01cd){var _0xe5d74a=[];switch(_0x11ac79['toLowerCase']()){case'voice':switch(_0x9a01cd[_0xac2d('0x2')]()){case _0xac2d('0x4'):_0xe5d74a=[{'type':_0xac2d('0x1'),'content':_0xac2d('0xd'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xac2d('0xe'),'keyType':_0xac2d('0x6'),'variableName':_0xac2d('0x8')},{'type':_0xac2d('0xf'),'content':'','key':_0xac2d('0x10'),'keyType':_0xac2d('0x6'),'variableName':_0xac2d('0x11')},{'type':_0xac2d('0xf'),'content':'','key':_0xac2d('0x12'),'keyType':_0xac2d('0x6'),'variableName':_0xac2d('0x13')},{'type':_0xac2d('0xf'),'content':'','key':_0xac2d('0x14'),'keyType':_0xac2d('0x6'),'variableName':_0xac2d('0x7')},{'type':'keyValue','content':'','key':_0xac2d('0x15'),'keyType':_0xac2d('0x6'),'variableName':'uniqueid'},{'type':_0xac2d('0xf'),'content':'','key':_0xac2d('0x16'),'keyType':_0xac2d('0x6'),'variableName':'agentcalledAt'},{'type':_0xac2d('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xac2d('0xf'),'content':'','key':_0xac2d('0x17'),'keyType':'variable','variableName':_0xac2d('0x18')},{'type':'keyValue','content':'','key':'Agent\x20Number','keyType':'variable','variableName':'destcalleridnum'},{'type':_0xac2d('0x1'),'content':_0xac2d('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0xac2d('0xf'),'content':'','key':_0xac2d('0x1a'),'keyType':_0xac2d('0x6'),'variableName':_0xac2d('0x1b')},{'type':_0xac2d('0xf'),'content':'','key':_0xac2d('0x1c'),'keyType':_0xac2d('0x6'),'variableName':_0xac2d('0x1d')},{'type':_0xac2d('0xf'),'content':'','key':_0xac2d('0x1e'),'keyType':_0xac2d('0x6'),'variableName':_0xac2d('0x1f')},{'type':_0xac2d('0xf'),'content':'','key':_0xac2d('0x20'),'keyType':_0xac2d('0x6'),'variableName':_0xac2d('0x21')},{'type':_0xac2d('0xf'),'content':'','key':'Talk\x20Time','keyType':_0xac2d('0x6'),'variableName':_0xac2d('0x22')}];break;case _0xac2d('0x9'):_0xe5d74a=[{'type':_0xac2d('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':'keyValue','content':'','key':_0xac2d('0x23'),'keyType':_0xac2d('0x6'),'keyContent':'','variableName':_0xac2d('0xb')},{'type':_0xac2d('0xf'),'content':'','key':_0xac2d('0x24'),'keyType':_0xac2d('0x6'),'keyContent':'','variableName':_0xac2d('0x25')},{'type':_0xac2d('0xf'),'content':'','key':_0xac2d('0x15'),'keyType':'variable','keyContent':'','variableName':'uniqueid'},{'type':_0xac2d('0xf'),'content':'','key':_0xac2d('0x16'),'keyType':_0xac2d('0x6'),'keyContent':'','variableName':_0xac2d('0x26')},{'type':_0xac2d('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xac2d('0xf'),'content':'','key':_0xac2d('0x27'),'keyType':'variable','keyContent':'','variableName':_0xac2d('0x28')},{'type':_0xac2d('0xf'),'content':'','key':_0xac2d('0x29'),'keyType':_0xac2d('0x6'),'keyContent':'','variableName':'endtime'},{'type':_0xac2d('0xf'),'content':'','key':'Duration','keyType':_0xac2d('0x6'),'keyContent':'','variableName':_0xac2d('0x2a')},{'type':'keyValue','content':'','key':_0xac2d('0x2b'),'keyType':_0xac2d('0x6'),'keyContent':'','variableName':_0xac2d('0x2c')}];break;}}return _0xe5d74a;}; \ No newline at end of file +var _0x94df=['calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','***\x20Call\x20Info\x20***','Called\x20Number','membername','UniqueId','uniqueid','Date','starttime','endtime','Duration','duration','getSubjects','string','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','push','variable','queue'];(function(_0x5de532,_0x2941c4){var _0x4e9192=function(_0x548a81){while(--_0x548a81){_0x5de532['push'](_0x5de532['shift']());}};_0x4e9192(++_0x2941c4);}(_0x94df,0xa3));var _0xf94d=function(_0x1b9ffa,_0x53a50e){_0x1b9ffa=_0x1b9ffa-0x0;var _0x5dc538=_0x94df[_0x1b9ffa];return _0x5dc538;};'use strict';exports[_0xf94d('0x0')]=function(_0x145115,_0x2f22c8){var _0x2242dd=[{'type':_0xf94d('0x1'),'content':_0xf94d('0x2'),'variableName':null}];switch(_0x145115['toLowerCase']()){case _0xf94d('0x3'):switch(_0x2f22c8[_0xf94d('0x4')]()){case _0xf94d('0x5'):_0x2242dd[_0xf94d('0x6')]({'type':_0xf94d('0x7'),'content':'','variableName':_0xf94d('0x8')});_0x2242dd[_0xf94d('0x6')]({'type':_0xf94d('0x7'),'content':'','variableName':_0xf94d('0x9')});break;case _0xf94d('0xa'):_0x2242dd[_0xf94d('0x6')]({'type':'string','content':_0xf94d('0xb'),'variableName':null});_0x2242dd[_0xf94d('0x6')]({'type':_0xf94d('0x7'),'content':'','variableName':_0xf94d('0xc')});break;}}return _0x2242dd;};exports[_0xf94d('0xd')]=function(_0x45739c,_0x47efc6){var _0x25c68e=[];switch(_0x45739c[_0xf94d('0x4')]()){case _0xf94d('0x3'):switch(_0x47efc6[_0xf94d('0x4')]()){case _0xf94d('0x5'):_0x25c68e=[{'type':'string','content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xf94d('0xe'),'content':'','key':_0xf94d('0xf'),'keyType':_0xf94d('0x7'),'variableName':_0xf94d('0x9')},{'type':_0xf94d('0xe'),'content':'','key':_0xf94d('0x10'),'keyType':'variable','variableName':_0xf94d('0x11')},{'type':_0xf94d('0xe'),'content':'','key':_0xf94d('0x12'),'keyType':_0xf94d('0x7'),'variableName':_0xf94d('0x13')},{'type':_0xf94d('0xe'),'content':'','key':_0xf94d('0x14'),'keyType':_0xf94d('0x7'),'variableName':'queue'},{'type':_0xf94d('0xe'),'content':'','key':'UniqueId','keyType':_0xf94d('0x7'),'variableName':'uniqueid'},{'type':_0xf94d('0xe'),'content':'','key':'Date','keyType':_0xf94d('0x7'),'variableName':_0xf94d('0x15')},{'type':_0xf94d('0x1'),'content':_0xf94d('0x16'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xf94d('0x17'),'keyType':'variable','variableName':_0xf94d('0x18')},{'type':_0xf94d('0xe'),'content':'','key':_0xf94d('0x19'),'keyType':_0xf94d('0x7'),'variableName':'destcalleridnum'},{'type':_0xf94d('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xf94d('0xe'),'content':'','key':_0xf94d('0x1a'),'keyType':_0xf94d('0x7'),'variableName':'agentcalledAt'},{'type':_0xf94d('0xe'),'content':'','key':_0xf94d('0x1b'),'keyType':_0xf94d('0x7'),'variableName':_0xf94d('0x1c')},{'type':_0xf94d('0xe'),'content':'','key':'Agent\x20Complete','keyType':_0xf94d('0x7'),'variableName':'agentcompleteAt'},{'type':_0xf94d('0xe'),'content':'','key':_0xf94d('0x1d'),'keyType':_0xf94d('0x7'),'variableName':_0xf94d('0x1e')},{'type':_0xf94d('0xe'),'content':'','key':_0xf94d('0x1f'),'keyType':_0xf94d('0x7'),'variableName':_0xf94d('0x20')}];break;case _0xf94d('0xa'):_0x25c68e=[{'type':_0xf94d('0x1'),'content':_0xf94d('0x21'),'variableName':null},{'type':_0xf94d('0xe'),'content':'','key':_0xf94d('0x22'),'keyType':'variable','keyContent':'','variableName':'destcalleridnum'},{'type':'keyValue','content':'','key':'Member\x20Name','keyType':_0xf94d('0x7'),'keyContent':'','variableName':_0xf94d('0x23')},{'type':'keyValue','content':'','key':_0xf94d('0x24'),'keyType':_0xf94d('0x7'),'keyContent':'','variableName':_0xf94d('0x25')},{'type':'keyValue','content':'','key':_0xf94d('0x26'),'keyType':'variable','keyContent':'','variableName':_0xf94d('0x27')},{'type':_0xf94d('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xf94d('0xe'),'content':'','key':'Answer\x20Time','keyType':_0xf94d('0x7'),'keyContent':'','variableName':'answertime'},{'type':'keyValue','content':'','key':'Complete\x20Time','keyType':_0xf94d('0x7'),'keyContent':'','variableName':_0xf94d('0x28')},{'type':'keyValue','content':'','key':_0xf94d('0x29'),'keyType':'variable','keyContent':'','variableName':_0xf94d('0x2a')},{'type':_0xf94d('0xe'),'content':'','key':'Billable\x20Time','keyType':_0xf94d('0x7'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x25c68e;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 9016b59..bdba990 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x871f=['html','phone','fax','mobile','../../config/logger','mail-interactions','sms-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','Interaction','then','update','info','tracked','user','clone','body'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x871f,0x101));var _0xf871=function(_0x23c394,_0x5d4369){_0x23c394=_0x23c394-0x0;var _0x3e2045=_0x871f[_0x23c394];return _0x3e2045;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0xf871('0x0'))('openchannel-interactions'),'mail':require(_0xf871('0x0'))(_0xf871('0x1')),'fax':require(_0xf871('0x0'))('fax-interactions'),'sms':require(_0xf871('0x0'))(_0xf871('0x2')),'chat':require(_0xf871('0x0'))('chat-interactions')};function getInteractionId(_0xdd9cba,_0x3cd8d1,_0x23e643){if(_0xdd9cba&&_0xdd9cba[_[_0xf871('0x3')](_0x23e643)+_0xf871('0x4')]){return _0xdd9cba[_[_0xf871('0x3')](_0x23e643)+_0xf871('0x4')];}else if(_0xdd9cba&&_0xdd9cba['id']){return _0xdd9cba['id'];}else if(_0x3cd8d1&&_0x3cd8d1['id']){return _0x3cd8d1['id'];}else{return'unknown';}}function log(_0x197959,_0x477582,_0x14ca98,_0x2ab7b6,_0x523c33,_0x36817c){loggers[_0x523c33[_0xf871('0x5')]()][_0x197959](_0xf871('0x6'),_0x36817c['toUpperCase'](),_0x477582?_0x477582['id']:null,_0x477582?_0x477582[_0xf871('0x7')]:null,_0x477582?_0x477582[_0xf871('0x8')]:null,getInteractionId(_0x14ca98,_0x2ab7b6,_0x523c33),_0x14ca98?JSON[_0xf871('0x9')](_0x14ca98):_0xf871('0xa'));}function updateUser(_0x36fc8a,_0x449c30,_0x445fad,_0x348149,_0x3a36c9){db[_[_0xf871('0x3')](_0x348149)+_0xf871('0xb')]['findOne']({'where':{'id':getInteractionId(_0x449c30,_0x445fad,_0x348149)}})[_0xf871('0xc')](function(_0x290a06){if(_0x290a06){return _0x290a06[_0xf871('0xd')]({'UserId':_0x36fc8a?_0x36fc8a['id']:null});}})[_0xf871('0xc')](function(_0x474226){if(_0x474226){log(_0xf871('0xe'),_0x36fc8a,_0x449c30,_0x445fad,_0x348149,_0x3a36c9);}})['catch'](function(){log('error',_0x36fc8a,_0x449c30,_0x445fad,_0x348149,_0x3a36c9);});}exports[_0xf871('0xf')]=function(_0x283333,_0x524956){return function(_0x36d8f9,_0xe7155f,_0x622ce4){var _0x2703ac=_0x36d8f9[_0xf871('0x10')];var _0x25fc54={};var _0xc09b5f=_0x36d8f9['query'];if(_0x25fc54){_0x25fc54=_[_0xf871('0x11')](_0x36d8f9[_0xf871('0x12')]);_0x25fc54=_['omit'](_0x25fc54,['body',_0xf871('0x13'),_0xf871('0x14'),_0xf871('0x15'),_0xf871('0x16')]);}updateUser(_0x2703ac,_0x25fc54,_0xc09b5f,_0x283333,_0x524956);_0x622ce4(null);};}; \ No newline at end of file +var _0x0342=['name','role','stringify','Interaction','findOne','then','update','info','catch','tracked','query','clone','body','omit','phone','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','upperFirst','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x63b2c5,_0x47f334){var _0x171f96=function(_0x5dbebe){while(--_0x5dbebe){_0x63b2c5['push'](_0x63b2c5['shift']());}};_0x171f96(++_0x47f334);}(_0x0342,0xac));var _0x2034=function(_0x50e7e0,_0x5affce){_0x50e7e0=_0x50e7e0-0x0;var _0x1a0307=_0x0342[_0x50e7e0];return _0x1a0307;};'use strict';var _=require(_0x2034('0x0'));var db=require(_0x2034('0x1'))['db'];var loggers={'openchannel':require(_0x2034('0x2'))(_0x2034('0x3')),'mail':require(_0x2034('0x2'))('mail-interactions'),'fax':require('../../config/logger')(_0x2034('0x4')),'sms':require(_0x2034('0x2'))(_0x2034('0x5')),'chat':require(_0x2034('0x2'))('chat-interactions')};function getInteractionId(_0x27020c,_0x1b0f33,_0x5e6d31){if(_0x27020c&&_0x27020c[_[_0x2034('0x6')](_0x5e6d31)+_0x2034('0x7')]){return _0x27020c[_[_0x2034('0x6')](_0x5e6d31)+_0x2034('0x7')];}else if(_0x27020c&&_0x27020c['id']){return _0x27020c['id'];}else if(_0x1b0f33&&_0x1b0f33['id']){return _0x1b0f33['id'];}else{return _0x2034('0x8');}}function log(_0x487d6c,_0x1b39ee,_0x13542b,_0x5a3e03,_0xb5e31,_0x293904){loggers[_0xb5e31['toLowerCase']()][_0x487d6c](_0x2034('0x9'),_0x293904['toUpperCase'](),_0x1b39ee?_0x1b39ee['id']:null,_0x1b39ee?_0x1b39ee[_0x2034('0xa')]:null,_0x1b39ee?_0x1b39ee[_0x2034('0xb')]:null,getInteractionId(_0x13542b,_0x5a3e03,_0xb5e31),_0x13542b?JSON[_0x2034('0xc')](_0x13542b):'null');}function updateUser(_0x47141c,_0x17632e,_0x50b5fe,_0x913929,_0x175374){db[_[_0x2034('0x6')](_0x913929)+_0x2034('0xd')][_0x2034('0xe')]({'where':{'id':getInteractionId(_0x17632e,_0x50b5fe,_0x913929)}})[_0x2034('0xf')](function(_0x3c2e1c){if(_0x3c2e1c){return _0x3c2e1c[_0x2034('0x10')]({'UserId':_0x47141c?_0x47141c['id']:null});}})[_0x2034('0xf')](function(_0x3a621f){if(_0x3a621f){log(_0x2034('0x11'),_0x47141c,_0x17632e,_0x50b5fe,_0x913929,_0x175374);}})[_0x2034('0x12')](function(){log('error',_0x47141c,_0x17632e,_0x50b5fe,_0x913929,_0x175374);});}exports[_0x2034('0x13')]=function(_0x38b66a,_0x4f5ecb){return function(_0x26bddf,_0xe271e8,_0x104838){var _0x20d053=_0x26bddf['user'];var _0x3ed31f={};var _0x4a147c=_0x26bddf[_0x2034('0x14')];if(_0x3ed31f){_0x3ed31f=_[_0x2034('0x15')](_0x26bddf[_0x2034('0x16')]);_0x3ed31f=_[_0x2034('0x17')](_0x3ed31f,[_0x2034('0x16'),'html',_0x2034('0x18'),'fax',_0x2034('0x19')]);}updateUser(_0x20d053,_0x3ed31f,_0x4a147c,_0x38b66a,_0x4f5ecb);_0x104838(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index fb156b0..cc42ddf 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdabd=['status','catch','users','User','admin','user','isUserLimit','util','composable-middleware','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','utf8','final','hasOwnProperty','use','findOne','then','count'];(function(_0x4ca682,_0x4f7657){var _0x1682db=function(_0x3eb8f5){while(--_0x3eb8f5){_0x4ca682['push'](_0x4ca682['shift']());}};_0x1682db(++_0x4f7657);}(_0xdabd,0xed));var _0xddab=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xdabd[_0x4d613c];return _0x301fe3;};'use strict';var crypto=require('crypto');var util=require(_0xddab('0x0'));var compose=require(_0xddab('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xddab('0x2'));function getValueFromLicense(_0x3a2bc5,_0xa2b2ad){if(_0x3a2bc5&&_0xa2b2ad){if(_0xa2b2ad[_0xddab('0x3')]&&_0xa2b2ad[_0xddab('0x4')]){var _0xac3f5a=_0xa2b2ad[_0xddab('0x3')];var _0x428600=_0xa2b2ad[_0xddab('0x4')];var _0x561198=_0xac3f5a[_0xddab('0x5')]('-')[0x4];var _0x4b2176=_0xac3f5a[_0xddab('0x5')]('-')[0x0];var _0x29437d=crypto[_0xddab('0x6')](_0xddab('0x7'),util[_0xddab('0x8')]('%s:%s:%s',_0x561198,_0xac3f5a,_0x4b2176));var _0x1e193e=_0x29437d['update'](_0x428600,'base64',_0xddab('0x9'));_0x1e193e+=_0x29437d[_0xddab('0xa')](_0xddab('0x9'));var _0x5a760a=JSON['parse'](_0x1e193e);return _0x5a760a[_0xddab('0xb')](_0x3a2bc5)?_0x5a760a[_0x3a2bc5]:null;}}return null;}function isLimit(_0x431b6f,_0x16bbf8,_0x225be0,_0x26d7eb){var _0x3a6e7f=_0x16bbf8;return compose()[_0xddab('0xc')](function(_0x58dfe8,_0x4e2c8e,_0x581ffd){return db['License'][_0xddab('0xd')]({'where':{'id':0x1},'raw':!![]})[_0xddab('0xe')](function(_0x441b65){var _0x1002f5=getValueFromLicense(_0x431b6f,_0x441b65);return _0x1002f5?_0x1002f5:_0x3a6e7f;})[_0xddab('0xe')](function(_0x243021){_0x3a6e7f=_0x243021;return _0x225be0[_0xddab('0xf')](_0x26d7eb);})[_0xddab('0xe')](function(_0x5ed6cd){if(_0x5ed6cd>=_0x3a6e7f){return _0x4e2c8e[_0xddab('0x10')](0x193)['json']({'message':util[_0xddab('0x8')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x431b6f)});}_0x581ffd();})[_0xddab('0x11')](function(_0x372f72){_0x581ffd(_0x372f72);});});}function isUserLimit(){return isLimit(_0xddab('0x12'),0x1,db[_0xddab('0x13')],{'where':{'$or':[{'role':_0xddab('0x14')},{'role':_0xddab('0x15')}]}});}exports[_0xddab('0x16')]=isUserLimit; \ No newline at end of file +var _0xff65=['format','%s:%s:%s','update','base64','utf8','parse','use','License','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0xff65,0xb4));var _0x5ff6=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0xff65[_0x2aea9e];return _0x430b92;};'use strict';var crypto=require(_0x5ff6('0x0'));var util=require(_0x5ff6('0x1'));var compose=require(_0x5ff6('0x2'));var db=require(_0x5ff6('0x3'))['db'];var config=require(_0x5ff6('0x4'));function getValueFromLicense(_0x234581,_0x2aac1b){if(_0x234581&&_0x2aac1b){if(_0x2aac1b[_0x5ff6('0x5')]&&_0x2aac1b[_0x5ff6('0x6')]){var _0x12ca78=_0x2aac1b[_0x5ff6('0x5')];var _0x32715f=_0x2aac1b[_0x5ff6('0x6')];var _0x448a0a=_0x12ca78[_0x5ff6('0x7')]('-')[0x4];var _0x654dc=_0x12ca78[_0x5ff6('0x7')]('-')[0x0];var _0x2760bf=crypto[_0x5ff6('0x8')]('aes-256-ctr',util[_0x5ff6('0x9')](_0x5ff6('0xa'),_0x448a0a,_0x12ca78,_0x654dc));var _0x291808=_0x2760bf[_0x5ff6('0xb')](_0x32715f,_0x5ff6('0xc'),_0x5ff6('0xd'));_0x291808+=_0x2760bf['final']('utf8');var _0x57ce33=JSON[_0x5ff6('0xe')](_0x291808);return _0x57ce33['hasOwnProperty'](_0x234581)?_0x57ce33[_0x234581]:null;}}return null;}function isLimit(_0x1ad223,_0x12a1cf,_0x417020,_0x4e2928){var _0x4cab11=_0x12a1cf;return compose()[_0x5ff6('0xf')](function(_0x599c55,_0x3b4772,_0x4654fc){return db[_0x5ff6('0x10')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x5ff6('0x11')](function(_0x47da4c){var _0x38222f=getValueFromLicense(_0x1ad223,_0x47da4c);return _0x38222f?_0x38222f:_0x4cab11;})[_0x5ff6('0x11')](function(_0x225bb5){_0x4cab11=_0x225bb5;return _0x417020[_0x5ff6('0x12')](_0x4e2928);})[_0x5ff6('0x11')](function(_0xf37f29){if(_0xf37f29>=_0x4cab11){return _0x3b4772[_0x5ff6('0x13')](0x193)[_0x5ff6('0x14')]({'message':util['format'](_0x5ff6('0x15'),_0x1ad223)});}_0x4654fc();})[_0x5ff6('0x16')](function(_0x82c188){_0x4654fc(_0x82c188);});});}function isUserLimit(){return isLimit(_0x5ff6('0x17'),0x1,db['User'],{'where':{'$or':[{'role':_0x5ff6('0x18')},{'role':_0x5ff6('0x19')}]}});}exports[_0x5ff6('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index a31be29..e154943 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 _0x342a=['$in','IN\x20?','$notIn','=\x20?','$ne','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','utcOffset','hours','minutes','seconds','moment','sqlOperator','startsWith','[$or]','replace','[$and]','split','length','slice','forEach','shift','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','\x20OR\x20','field','\x20IS\x20NULL)'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x342a,0x1a3));var _0xa342=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x342a[_0x5f0089];return _0x193892;};'use strict';var _=require('lodash');var moment=require(_0xa342('0x0'));exports['parseSearch']=function(_0x12df4c){var _0x4d862d={'conditions':[]};_0x4d862d[_0xa342('0x1')]=_[_0xa342('0x2')](_0x12df4c,_0xa342('0x3'))?'or':'and';var _0x3b6f5e=_0x12df4c[_0xa342('0x4')](_0xa342('0x5'),'')[_0xa342('0x4')](_0xa342('0x3'),'')[_0xa342('0x6')]('||');for(var _0x364ea1=0x0;_0x364ea1<_0x3b6f5e[_0xa342('0x7')];_0x364ea1++){var _0x4d38a0=_0x3b6f5e[_0x364ea1]['split'](':=');var _0x419d98=_0x4d38a0[0x0];var _0x472ad4=_0x4d38a0[_0xa342('0x8')](0x1);_0x472ad4[_0xa342('0x9')](function(_0x25ed3a){var _0x561673=_0x25ed3a['split']('[')[_0xa342('0xa')]();var _0x1a8ffa=_0x25ed3a[_0xa342('0xb')](/\[(.*?)\]/g);_0x1a8ffa['forEach'](function(_0x1d9877){var _0x5675be=_0x1d9877[_0xa342('0x6')]('[')[_0xa342('0xc')](function(_0x4062c7){return _0x4062c7[_0xa342('0xd')](']')>-0x1;})[_0xa342('0xe')](function(_0x5760a0){return _0x5760a0[_0xa342('0x6')](']')[0x0];})[0x0];_0x4d862d[_0xa342('0xf')][_0xa342('0x10')]({'field':_0x419d98,'operator':_0x561673,'value':_0x5675be});});});}return _0x4d862d;};exports[_0xa342('0x11')]=function(_0x37026a,_0x40e0c0,_0x40af07){var _0x2aedfb={};if(_0x40e0c0===_0xa342('0x12')){if(_0x40af07[_0xa342('0x13')]===_0xa342('0x14')){_0x40af07[_0xa342('0x13')]=_0xa342('0x15');_0x40af07[_0xa342('0x16')]+=','+_0x40af07['value'];}else if(_[_0xa342('0x17')]([_0xa342('0x18'),_0xa342('0x19')],_0x40af07['operator'])){_0x40af07[_0xa342('0x16')]=moment(_0x40af07[_0xa342('0x16')])[_0xa342('0x1a')](0x1,_0xa342('0x1b'))[_0xa342('0x1c')](_0xa342('0x1d'));}}if(_0x40af07[_0xa342('0x1e')]){_0x40e0c0=_0x40af07[_0xa342('0x1e')];_0x2aedfb[_0xa342('0x1f')]=_0xa342('0x20')+_0x37026a+'.'+_0x40af07['field']+_0xa342('0x21')+_0x40af07[_0xa342('0x1e')]+')\x20'+parseOperator(_0x40af07[_0xa342('0x13')]);}else{_0x2aedfb['text']=_0x37026a+'.'+_0x40af07['field']+'\x20'+parseOperator(_0x40af07['operator']);}if(_[_0xa342('0x17')](['$ne','$notIn'],_0x40af07['operator']))_0x2aedfb[_0xa342('0x1f')]='('+_0x2aedfb[_0xa342('0x1f')]+_0xa342('0x22')+_0x37026a+'.'+_0x40af07[_0xa342('0x23')]+_0xa342('0x24');_0x2aedfb[_0xa342('0x16')]=parseValue(_0x40e0c0,_0x40af07[_0xa342('0x13')],_0x40af07['value']);return _0x2aedfb;};function parseOperator(_0x3985e4){var _0x2890;switch(_0x3985e4){case _0xa342('0x25'):_0x2890=_0xa342('0x26');break;case _0xa342('0x27'):_0x2890='NOT\x20IN\x20?';break;case'$eq':_0x2890=_0xa342('0x28');break;case _0xa342('0x29'):_0x2890=_0xa342('0x2a');break;case _0xa342('0x2b'):case _0xa342('0x2c'):case'$endsWith':_0x2890=_0xa342('0x2d');break;case _0xa342('0x2e'):_0x2890='<\x20?';break;case _0xa342('0x18'):_0x2890=_0xa342('0x2f');break;case _0xa342('0x19'):_0x2890='<=\x20?';break;case _0xa342('0x30'):_0x2890=_0xa342('0x31');break;case _0xa342('0x15'):_0x2890=_0xa342('0x32');break;}return _0x2890;}function parseValue(_0x2d4c03,_0x22bdae,_0x311874){var _0x5ba1a8={'start':undefined,'end':undefined};switch(_0x22bdae){case _0xa342('0x25'):case _0xa342('0x27'):_0x5ba1a8[_0xa342('0x33')]=_0x311874[_0xa342('0x6')](',');break;case _0xa342('0x2b'):_0x5ba1a8[_0xa342('0x33')]='%'+_0x311874+'%';break;case'$startsWith':_0x5ba1a8[_0xa342('0x33')]=_0x311874+'%';break;case _0xa342('0x34'):_0x5ba1a8[_0xa342('0x33')]='%'+_0x311874;break;case _0xa342('0x15'):var _0xb7fc4d=_0x311874['split'](',');var _0x311874=_0xb7fc4d[_0xa342('0xa')]();var _0x320309=_0xb7fc4d['pop']();if(_0x2d4c03==='DATE'){_0x311874=moment(_0x311874)[_0xa342('0x35')](0x0,!![])[_0xa342('0x1c')]();_0x320309=moment(_0x320309)[_0xa342('0x35')](0x0,!![])[_0xa342('0x1a')](0x17,_0xa342('0x36'))[_0xa342('0x1a')](0x3b,_0xa342('0x37'))['add'](0x3b,_0xa342('0x38'))['format']();}_0x5ba1a8={'start':_0x311874,'end':_0x320309};break;default:_0x5ba1a8[_0xa342('0x33')]=_0x311874;break;}return _0x5ba1a8;} \ No newline at end of file +var _0xbb45=['$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','$lte','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$between','pop','utcOffset','format','hours','minutes','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','shift','match','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','includes','value','add','YYYY-MM-DD','castTo','text','CAST(','field','\x20OR\x20','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','$substring','$startsWith'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xbb45,0x1d2));var _0x5bb4=function(_0x296760,_0x53d38c){_0x296760=_0x296760-0x0;var _0x93d7f1=_0xbb45[_0x296760];return _0x93d7f1;};'use strict';var _=require(_0x5bb4('0x0'));var moment=require(_0x5bb4('0x1'));exports[_0x5bb4('0x2')]=function(_0x219c45){var _0x41f45f={'conditions':[]};_0x41f45f[_0x5bb4('0x3')]=_[_0x5bb4('0x4')](_0x219c45,_0x5bb4('0x5'))?'or':_0x5bb4('0x6');var _0x430023=_0x219c45[_0x5bb4('0x7')](_0x5bb4('0x8'),'')[_0x5bb4('0x7')]('[$or]','')[_0x5bb4('0x9')]('||');for(var _0x146f0a=0x0;_0x146f0a<_0x430023[_0x5bb4('0xa')];_0x146f0a++){var _0x586c33=_0x430023[_0x146f0a][_0x5bb4('0x9')](':=');var _0x5491ef=_0x586c33[0x0];var _0x1ab0a3=_0x586c33[_0x5bb4('0xb')](0x1);_0x1ab0a3['forEach'](function(_0x37498b){var _0x3e80fe=_0x37498b[_0x5bb4('0x9')]('[')[_0x5bb4('0xc')]();var _0x550b57=_0x37498b[_0x5bb4('0xd')](/\[(.*?)\]/g);_0x550b57['forEach'](function(_0x535376){var _0x5bc2df=_0x535376['split']('[')['filter'](function(_0x37fc07){return _0x37fc07[_0x5bb4('0xe')](']')>-0x1;})[_0x5bb4('0xf')](function(_0x541c90){return _0x541c90[_0x5bb4('0x9')](']')[0x0];})[0x0];_0x41f45f[_0x5bb4('0x10')][_0x5bb4('0x11')]({'field':_0x5491ef,'operator':_0x3e80fe,'value':_0x5bc2df});});});}return _0x41f45f;};exports[_0x5bb4('0x12')]=function(_0x36f5a4,_0x42cbdf,_0x4dd213){var _0x54d08b={};if(_0x42cbdf===_0x5bb4('0x13')){if(_0x4dd213[_0x5bb4('0x14')]===_0x5bb4('0x15')){_0x4dd213['operator']='$between';_0x4dd213['value']+=','+_0x4dd213['value'];}else if(_[_0x5bb4('0x16')](['$gt','$lte'],_0x4dd213[_0x5bb4('0x14')])){_0x4dd213[_0x5bb4('0x17')]=moment(_0x4dd213[_0x5bb4('0x17')])[_0x5bb4('0x18')](0x1,'days')['format'](_0x5bb4('0x19'));}}if(_0x4dd213[_0x5bb4('0x1a')]){_0x42cbdf=_0x4dd213[_0x5bb4('0x1a')];_0x54d08b[_0x5bb4('0x1b')]=_0x5bb4('0x1c')+_0x36f5a4+'.'+_0x4dd213[_0x5bb4('0x1d')]+'\x20AS\x20'+_0x4dd213[_0x5bb4('0x1a')]+')\x20'+parseOperator(_0x4dd213[_0x5bb4('0x14')]);}else{_0x54d08b[_0x5bb4('0x1b')]=_0x36f5a4+'.'+_0x4dd213[_0x5bb4('0x1d')]+'\x20'+parseOperator(_0x4dd213['operator']);}if(_[_0x5bb4('0x16')](['$ne','$notIn'],_0x4dd213[_0x5bb4('0x14')]))_0x54d08b['text']='('+_0x54d08b[_0x5bb4('0x1b')]+_0x5bb4('0x1e')+_0x36f5a4+'.'+_0x4dd213[_0x5bb4('0x1d')]+'\x20IS\x20NULL)';_0x54d08b[_0x5bb4('0x17')]=parseValue(_0x42cbdf,_0x4dd213[_0x5bb4('0x14')],_0x4dd213['value']);return _0x54d08b;};function parseOperator(_0x316fee){var _0x5b3c5b;switch(_0x316fee){case _0x5bb4('0x1f'):_0x5b3c5b=_0x5bb4('0x20');break;case _0x5bb4('0x21'):_0x5b3c5b=_0x5bb4('0x22');break;case _0x5bb4('0x15'):_0x5b3c5b=_0x5bb4('0x23');break;case'$ne':_0x5b3c5b='<>\x20?';break;case _0x5bb4('0x24'):case _0x5bb4('0x25'):case _0x5bb4('0x26'):_0x5b3c5b=_0x5bb4('0x27');break;case _0x5bb4('0x28'):_0x5b3c5b=_0x5bb4('0x29');break;case _0x5bb4('0x2a'):_0x5b3c5b=_0x5bb4('0x2b');break;case _0x5bb4('0x2c'):_0x5b3c5b=_0x5bb4('0x2d');break;case _0x5bb4('0x2e'):_0x5b3c5b=_0x5bb4('0x2f');break;case'$between':_0x5b3c5b=_0x5bb4('0x30');break;}return _0x5b3c5b;}function parseValue(_0x4e241a,_0x127cb2,_0x49f4de){var _0x2fc1ac={'start':undefined,'end':undefined};switch(_0x127cb2){case _0x5bb4('0x1f'):case _0x5bb4('0x21'):_0x2fc1ac[_0x5bb4('0x31')]=_0x49f4de[_0x5bb4('0x9')](',');break;case _0x5bb4('0x24'):_0x2fc1ac[_0x5bb4('0x31')]='%'+_0x49f4de+'%';break;case _0x5bb4('0x25'):_0x2fc1ac[_0x5bb4('0x31')]=_0x49f4de+'%';break;case _0x5bb4('0x26'):_0x2fc1ac[_0x5bb4('0x31')]='%'+_0x49f4de;break;case _0x5bb4('0x32'):var _0x5dbcbd=_0x49f4de['split'](',');var _0x49f4de=_0x5dbcbd[_0x5bb4('0xc')]();var _0x37b6ba=_0x5dbcbd[_0x5bb4('0x33')]();if(_0x4e241a===_0x5bb4('0x13')){_0x49f4de=moment(_0x49f4de)[_0x5bb4('0x34')](0x0,!![])[_0x5bb4('0x35')]();_0x37b6ba=moment(_0x37b6ba)[_0x5bb4('0x34')](0x0,!![])['add'](0x17,_0x5bb4('0x36'))[_0x5bb4('0x18')](0x3b,_0x5bb4('0x37'))[_0x5bb4('0x18')](0x3b,'seconds')[_0x5bb4('0x35')]();}_0x2fc1ac={'start':_0x49f4de,'end':_0x37b6ba};break;default:_0x2fc1ac[_0x5bb4('0x31')]=_0x49f4de;break;}return _0x2fc1ac;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index e4057a9..540c800 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 _0x6653=['isEmpty','isArray','limit','offset','sort','map','indexOf','cast','unsigned','DESC','priority','ASC','omit','length','isString','unset','hasOwnProperty','isNumeric','match','^[0-9]*$','getFullTextValue','forEach','push','toString','join','lodash','sequelize','fields','split','filters'];(function(_0x592b27,_0x3d509b){var _0x2f62a4=function(_0x3bfafa){while(--_0x3bfafa){_0x592b27['push'](_0x592b27['shift']());}};_0x2f62a4(++_0x3d509b);}(_0x6653,0x1bd));var _0x3665=function(_0x4e5b81,_0x3c79be){_0x4e5b81=_0x4e5b81-0x0;var _0x39c484=_0x6653[_0x4e5b81];return _0x39c484;};'use strict';var _=require(_0x3665('0x0'));var sequelize=require(_0x3665('0x1'));var LIMIT_VALUE=0xfa;exports[_0x3665('0x2')]=function(_0x87bf18){var _0x1a6e3f=null;if(_0x87bf18){_0x1a6e3f=_0x87bf18[_0x3665('0x3')](',');}return _0x1a6e3f;};exports[_0x3665('0x4')]=function(_0x3b7844){var _0xd823ca={};if(!_[_0x3665('0x5')](_0x3b7844)){_0xd823ca={};_['forOwn'](_0x3b7844,function(_0x31d247,_0x47f74e){try{_0xd823ca[_0x47f74e]=_[_0x3665('0x6')](_0x31d247)?_0x31d247:JSON['parse'](_0x31d247);}catch(_0x5c2ef0){_0xd823ca[_0x47f74e]=_0x31d247[_0x3665('0x3')](',');}});}return _0xd823ca;};exports[_0x3665('0x7')]=function(_0x28d061){_0x28d061=parseInt(_0x28d061,0xa);if(!_0x28d061||_0x28d061<0x0){_0x28d061=LIMIT_VALUE;}return _0x28d061;};exports[_0x3665('0x8')]=function(_0x5577fe){_0x5577fe=parseInt(_0x5577fe,0xa);if(!_0x5577fe||_0x5577fe<0x0){_0x5577fe=0x0;}return _0x5577fe;};exports[_0x3665('0x9')]=function(_0x161317){var _0x8ed8cb,_0x3c7da2=null;if(_0x161317){_0x8ed8cb=_0x161317['split'](',');_0x3c7da2=_[_0x3665('0xa')](_0x8ed8cb,function(_0x2acf10){if(_0x2acf10[_0x3665('0xb')]('-')===0x0){return[_0x2acf10==='priority'?sequelize[_0x3665('0xc')](sequelize['col']('priority'),_0x3665('0xd')):_0x2acf10['substr'](0x1),_0x3665('0xe')];}else{return[_0x2acf10===_0x3665('0xf')?sequelize[_0x3665('0xc')](sequelize['col']('priority'),_0x3665('0xd')):_0x2acf10,_0x3665('0x10')];}});}return _0x3c7da2;};exports[_0x3665('0x11')]=function(_0x36be35,_0x48c7df){if(_[_0x3665('0x5')](_0x36be35)){return _0x36be35;}if(_[_0x3665('0x6')](_0x36be35)){for(var _0x2fd9ac=0x0;_0x2fd9ac<_0x36be35[_0x3665('0x12')];_0x2fd9ac+=0x1){_0x36be35[_0x2fd9ac]=this[_0x3665('0x11')](_0x36be35[_0x2fd9ac],_0x48c7df);}return _0x36be35;}if(!_['isObject'](_0x36be35)){return _0x36be35;}if(_[_0x3665('0x13')](_0x48c7df)){_0x48c7df=[_0x48c7df];}if(!_[_0x3665('0x6')](_0x48c7df)){return _0x36be35;}for(var _0x9c7533=0x0;_0x9c7533<_0x48c7df[_0x3665('0x12')];_0x9c7533+=0x1){_[_0x3665('0x14')](_0x36be35,_0x48c7df[_0x9c7533]);}for(var _0x416b11 in _0x36be35){if(_0x36be35[_0x3665('0x15')](_0x416b11)){_0x36be35[_0x416b11]=this[_0x3665('0x11')](_0x36be35[_0x416b11],_0x48c7df);}}return _0x36be35;};exports[_0x3665('0x16')]=function(_0x484f9d){return _0x484f9d[_0x3665('0x17')](RegExp(_0x3665('0x18')))?!![]:![];};exports['isEmail']=function(_0x3eb942){return _0x3eb942['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x3665('0x19')]=function(_0x4892e4){var _0x578916=[];_0x4892e4[_0x3665('0x3')]('\x20')[_0x3665('0x1a')](function(_0x2f2866){_0x578916[_0x3665('0x1b')]('+'+_0x2f2866[_0x3665('0x1c')]()+'*');});return _0x578916[_0x3665('0x1d')]('\x20');}; \ No newline at end of file +var _0x1d4c=['map','priority','cast','unsigned','substr','col','ASC','omit','length','isString','unset','match','isEmail','getFullTextValue','forEach','push','toString','join','lodash','sequelize','fields','split','filters','isEmpty','forOwn','isArray','offset','sort'];(function(_0x19ebf2,_0x13d766){var _0xf15700=function(_0x1f03d9){while(--_0x1f03d9){_0x19ebf2['push'](_0x19ebf2['shift']());}};_0xf15700(++_0x13d766);}(_0x1d4c,0xf2));var _0xc1d4=function(_0x13da0f,_0x1efd19){_0x13da0f=_0x13da0f-0x0;var _0x1e945c=_0x1d4c[_0x13da0f];return _0x1e945c;};'use strict';var _=require(_0xc1d4('0x0'));var sequelize=require(_0xc1d4('0x1'));var LIMIT_VALUE=0xfa;exports[_0xc1d4('0x2')]=function(_0x3a3c46){var _0x28ad99=null;if(_0x3a3c46){_0x28ad99=_0x3a3c46[_0xc1d4('0x3')](',');}return _0x28ad99;};exports[_0xc1d4('0x4')]=function(_0x17ba4d){var _0x4370ab={};if(!_[_0xc1d4('0x5')](_0x17ba4d)){_0x4370ab={};_[_0xc1d4('0x6')](_0x17ba4d,function(_0xcc8bca,_0xad2e4d){try{_0x4370ab[_0xad2e4d]=_[_0xc1d4('0x7')](_0xcc8bca)?_0xcc8bca:JSON['parse'](_0xcc8bca);}catch(_0x5dfe81){_0x4370ab[_0xad2e4d]=_0xcc8bca['split'](',');}});}return _0x4370ab;};exports['limit']=function(_0x4ed4c7){_0x4ed4c7=parseInt(_0x4ed4c7,0xa);if(!_0x4ed4c7||_0x4ed4c7<0x0){_0x4ed4c7=LIMIT_VALUE;}return _0x4ed4c7;};exports[_0xc1d4('0x8')]=function(_0x43ae89){_0x43ae89=parseInt(_0x43ae89,0xa);if(!_0x43ae89||_0x43ae89<0x0){_0x43ae89=0x0;}return _0x43ae89;};exports[_0xc1d4('0x9')]=function(_0x47a6aa){var _0x4bde0a,_0x1b674f=null;if(_0x47a6aa){_0x4bde0a=_0x47a6aa[_0xc1d4('0x3')](',');_0x1b674f=_[_0xc1d4('0xa')](_0x4bde0a,function(_0x28f828){if(_0x28f828['indexOf']('-')===0x0){return[_0x28f828===_0xc1d4('0xb')?sequelize[_0xc1d4('0xc')](sequelize['col']('priority'),_0xc1d4('0xd')):_0x28f828[_0xc1d4('0xe')](0x1),'DESC'];}else{return[_0x28f828===_0xc1d4('0xb')?sequelize[_0xc1d4('0xc')](sequelize[_0xc1d4('0xf')](_0xc1d4('0xb')),_0xc1d4('0xd')):_0x28f828,_0xc1d4('0x10')];}});}return _0x1b674f;};exports[_0xc1d4('0x11')]=function(_0x4e760d,_0x32a41a){if(_[_0xc1d4('0x5')](_0x4e760d)){return _0x4e760d;}if(_['isArray'](_0x4e760d)){for(var _0x22a986=0x0;_0x22a986<_0x4e760d[_0xc1d4('0x12')];_0x22a986+=0x1){_0x4e760d[_0x22a986]=this[_0xc1d4('0x11')](_0x4e760d[_0x22a986],_0x32a41a);}return _0x4e760d;}if(!_['isObject'](_0x4e760d)){return _0x4e760d;}if(_[_0xc1d4('0x13')](_0x32a41a)){_0x32a41a=[_0x32a41a];}if(!_[_0xc1d4('0x7')](_0x32a41a)){return _0x4e760d;}for(var _0x3ba35a=0x0;_0x3ba35a<_0x32a41a[_0xc1d4('0x12')];_0x3ba35a+=0x1){_[_0xc1d4('0x14')](_0x4e760d,_0x32a41a[_0x3ba35a]);}for(var _0x5925f4 in _0x4e760d){if(_0x4e760d['hasOwnProperty'](_0x5925f4)){_0x4e760d[_0x5925f4]=this[_0xc1d4('0x11')](_0x4e760d[_0x5925f4],_0x32a41a);}}return _0x4e760d;};exports['isNumeric']=function(_0x1c24c3){return _0x1c24c3[_0xc1d4('0x15')](RegExp('^[0-9]*$'))?!![]:![];};exports[_0xc1d4('0x16')]=function(_0x361e9a){return _0x361e9a[_0xc1d4('0x15')](/^\S+@\S+$/)?!![]:![];};exports[_0xc1d4('0x17')]=function(_0x4a911e){var _0x56ce48=[];_0x4a911e[_0xc1d4('0x3')]('\x20')[_0xc1d4('0x18')](function(_0x2fe568){_0x56ce48[_0xc1d4('0x19')]('+'+_0x2fe568[_0xc1d4('0x1a')]()+'*');});return _0x56ce48[_0xc1d4('0x1b')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index fb33a42..1f64bfe 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b2a=['50mb','json','express','serve-favicon','body-parser','method-override','errorhandler','path','cors','moment','../mysqldb','get','env','production','set','appPath','join','development','root','json\x20replacer','toISOString','split','static','views','engine','html','ejs','use'];(function(_0x2831e4,_0x3a6f8c){var _0x27074e=function(_0xfcc107){while(--_0xfcc107){_0x2831e4['push'](_0x2831e4['shift']());}};_0x27074e(++_0x3a6f8c);}(_0x3b2a,0x11a));var _0xa3b2=function(_0x1121b1,_0x4e40f2){_0x1121b1=_0x1121b1-0x0;var _0x5bf648=_0x3b2a[_0x1121b1];return _0x5bf648;};'use strict';var express=require(_0xa3b2('0x0'));var favicon=require(_0xa3b2('0x1'));var bodyParser=require(_0xa3b2('0x2'));var methodOverride=require(_0xa3b2('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require(_0xa3b2('0x4'));var path=require(_0xa3b2('0x5'));var passport=require('passport');var cors=require(_0xa3b2('0x6'));var moment=require(_0xa3b2('0x7'));var config=require('./environment');var db=require(_0xa3b2('0x8'))['db'];exports['default']=function(_0x4858fd){var _0x64f5db=_0x4858fd[_0xa3b2('0x9')](_0xa3b2('0xa'));if(_0x64f5db===_0xa3b2('0xb')){_0x4858fd[_0xa3b2('0xc')](_0xa3b2('0xd'),path[_0xa3b2('0xe')](config['root'],'public'));}if(_0x64f5db===_0xa3b2('0xf')||_0x64f5db==='test'){_0x4858fd[_0xa3b2('0xc')]('appPath',path[_0xa3b2('0xe')](config[_0xa3b2('0x10')],'client'));_0x4858fd['use'](errorHandler());}_0x4858fd[_0xa3b2('0xc')](_0xa3b2('0x11'),function(_0x29b5f8,_0x2279ed){if(this[_0x29b5f8]instanceof Date){_0x2279ed=this[_0x29b5f8][_0xa3b2('0x12')]()[_0xa3b2('0x13')]('.')[0x0]+'Z';}return _0x2279ed;});_0x4858fd['use'](express[_0xa3b2('0x14')](_0x4858fd[_0xa3b2('0x9')](_0xa3b2('0xd'))));_0x4858fd[_0xa3b2('0xc')](_0xa3b2('0x15'),config[_0xa3b2('0x10')]+'/server/views');_0x4858fd[_0xa3b2('0x16')](_0xa3b2('0x17'),require(_0xa3b2('0x18'))['renderFile']);_0x4858fd['set']('view\x20engine',_0xa3b2('0x17'));_0x4858fd[_0xa3b2('0x19')](bodyParser['urlencoded']({'limit':_0xa3b2('0x1a'),'extended':!![]}));_0x4858fd[_0xa3b2('0x19')](bodyParser[_0xa3b2('0x1b')]({'limit':'50mb'}));_0x4858fd[_0xa3b2('0x19')](cors());_0x4858fd[_0xa3b2('0x19')](methodOverride());_0x4858fd[_0xa3b2('0x19')](cookieParser());_0x4858fd[_0xa3b2('0x19')](passport['initialize']());}; \ No newline at end of file +var _0xcd35=['passport','cors','moment','./environment','../mysqldb','default','get','env','production','set','join','public','test','root','client','use','json\x20replacer','toISOString','split','static','views','/server/views','html','view\x20engine','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','errorhandler'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd35,0x19c));var _0x5cd3=function(_0x5266b8,_0xfb3290){_0x5266b8=_0x5266b8-0x0;var _0x54a15c=_0xcd35[_0x5266b8];return _0x54a15c;};'use strict';var express=require(_0x5cd3('0x0'));var favicon=require('serve-favicon');var bodyParser=require('body-parser');var methodOverride=require(_0x5cd3('0x1'));var cookieParser=require(_0x5cd3('0x2'));var errorHandler=require(_0x5cd3('0x3'));var path=require('path');var passport=require(_0x5cd3('0x4'));var cors=require(_0x5cd3('0x5'));var moment=require(_0x5cd3('0x6'));var config=require(_0x5cd3('0x7'));var db=require(_0x5cd3('0x8'))['db'];exports[_0x5cd3('0x9')]=function(_0x10e902){var _0x7c473f=_0x10e902[_0x5cd3('0xa')](_0x5cd3('0xb'));if(_0x7c473f===_0x5cd3('0xc')){_0x10e902[_0x5cd3('0xd')]('appPath',path[_0x5cd3('0xe')](config['root'],_0x5cd3('0xf')));}if(_0x7c473f==='development'||_0x7c473f===_0x5cd3('0x10')){_0x10e902[_0x5cd3('0xd')]('appPath',path[_0x5cd3('0xe')](config[_0x5cd3('0x11')],_0x5cd3('0x12')));_0x10e902[_0x5cd3('0x13')](errorHandler());}_0x10e902['set'](_0x5cd3('0x14'),function(_0x4319ff,_0x5bbcfc){if(this[_0x4319ff]instanceof Date){_0x5bbcfc=this[_0x4319ff][_0x5cd3('0x15')]()[_0x5cd3('0x16')]('.')[0x0]+'Z';}return _0x5bbcfc;});_0x10e902[_0x5cd3('0x13')](express[_0x5cd3('0x17')](_0x10e902[_0x5cd3('0xa')]('appPath')));_0x10e902[_0x5cd3('0xd')](_0x5cd3('0x18'),config[_0x5cd3('0x11')]+_0x5cd3('0x19'));_0x10e902['engine'](_0x5cd3('0x1a'),require('ejs')['renderFile']);_0x10e902[_0x5cd3('0xd')](_0x5cd3('0x1b'),_0x5cd3('0x1a'));_0x10e902[_0x5cd3('0x13')](bodyParser[_0x5cd3('0x1c')]({'limit':_0x5cd3('0x1d'),'extended':!![]}));_0x10e902[_0x5cd3('0x13')](bodyParser[_0x5cd3('0x1e')]({'limit':_0x5cd3('0x1d')}));_0x10e902[_0x5cd3('0x13')](cors());_0x10e902['use'](methodOverride());_0x10e902[_0x5cd3('0x13')](cookieParser());_0x10e902[_0x5cd3('0x13')](passport[_0x5cd3('0x1f')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 11a60a5..7cf6df7 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 _0x0bde=['child_process','execSync','networkInterfaces','orderBy','keys','length','filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00','getFirstInterface','cpus','map','model','createHash','md5','update','digest','hex','getUuid','platform','win32','hostname','macAddress','substring','crypto'];(function(_0x399cc7,_0x1065de){var _0xb0a85d=function(_0x327c7e){while(--_0x327c7e){_0x399cc7['push'](_0x399cc7['shift']());}};_0xb0a85d(++_0x1065de);}(_0x0bde,0xe7));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xe0bd('0x0'));var machine=require('bimedia-machine-uuid');var exec=require(_0xe0bd('0x1'))[_0xe0bd('0x2')];function getInterfaces(){var _0x1d8922=[];var _0x1e198a=os[_0xe0bd('0x3')]();var _0x5541b9=_[_0xe0bd('0x4')](_[_0xe0bd('0x5')](_0x1e198a));for(var _0x2b9812=0x0;_0x2b9812<_0x5541b9[_0xe0bd('0x6')];_0x2b9812++){var _0x22bfd1=_0x1e198a[_0x5541b9[_0x2b9812]][_0xe0bd('0x7')](function(_0x217145){return _0x217145['family']===_0xe0bd('0x8')&&_0x217145[_0xe0bd('0x9')]===![];});_0x1d8922=_0x1d8922[_0xe0bd('0xa')](_0x22bfd1);}return _0x1d8922;}function getFirstInterface(){var _0x2d32c6=_[_0xe0bd('0xb')](getInterfaces());return{'macAddress':_0x2d32c6&&_0x2d32c6[_0xe0bd('0xc')]?_0x2d32c6[_0xe0bd('0xc')]:_0xe0bd('0xd'),'ipAddress':_0x2d32c6&&_0x2d32c6['address']?_0x2d32c6['address']:'127.0.0.1'};}exports[_0xe0bd('0xe')]=getFirstInterface;function getCPUhash(){var _0x5e2a24=_['orderBy'](os[_0xe0bd('0xf')]()[_0xe0bd('0x10')](function(_0x54d40e){return _0x54d40e[_0xe0bd('0x11')];}))['join'](':');return crypto[_0xe0bd('0x12')](_0xe0bd('0x13'))[_0xe0bd('0x14')](_0x5e2a24)[_0xe0bd('0x15')](_0xe0bd('0x16'));}exports[_0xe0bd('0x17')]=function(){switch(os[_0xe0bd('0x18')]()){case _0xe0bd('0x19'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})['replace']('\x0d\x0a','');default:var _0x2ff887=getFirstInterface();var _0x8179fb=getCPUhash();var _0x2cd832=_0x8179fb+'|'+os[_0xe0bd('0x1a')]()+'|'+_0x2ff887[_0xe0bd('0x1b')]+'|'+_0x2ff887['ipAddress'];var _0x4ebe7a=crypto[_0xe0bd('0x12')]('md5')[_0xe0bd('0x14')](_0x2cd832)[_0xe0bd('0x15')](_0xe0bd('0x16'));return _0x4ebe7a[_0xe0bd('0x1c')](0x0,0x8)+'-'+_0x4ebe7a['substring'](0x8,0xc)+'-'+_0x4ebe7a[_0xe0bd('0x1c')](0xc,0x10)+'-'+_0x4ebe7a[_0xe0bd('0x1c')](0x10,0x14)+'-'+_0x4ebe7a[_0xe0bd('0x1c')](0x14);}}; \ No newline at end of file +var _0xdd0c=['networkInterfaces','orderBy','keys','filter','family','IPv4','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','join','md5','update','hex','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','hostname','macAddress','ipAddress','createHash','substring','crypto','bimedia-machine-uuid','child_process'];(function(_0x584308,_0x1379b3){var _0x45865b=function(_0x145a82){while(--_0x145a82){_0x584308['push'](_0x584308['shift']());}};_0x45865b(++_0x1379b3);}(_0xdd0c,0x165));var _0xcdd0=function(_0x92ff4d,_0x1c92d8){_0x92ff4d=_0x92ff4d-0x0;var _0x10cf5d=_0xdd0c[_0x92ff4d];return _0x10cf5d;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xcdd0('0x0'));var machine=require(_0xcdd0('0x1'));var exec=require(_0xcdd0('0x2'))['execSync'];function getInterfaces(){var _0xe8ed9=[];var _0x5b86cb=os[_0xcdd0('0x3')]();var _0x159e38=_[_0xcdd0('0x4')](_[_0xcdd0('0x5')](_0x5b86cb));for(var _0x17ad7d=0x0;_0x17ad7d<_0x159e38['length'];_0x17ad7d++){var _0x2b33fc=_0x5b86cb[_0x159e38[_0x17ad7d]][_0xcdd0('0x6')](function(_0x1fd3f6){return _0x1fd3f6[_0xcdd0('0x7')]===_0xcdd0('0x8')&&_0x1fd3f6['internal']===![];});_0xe8ed9=_0xe8ed9[_0xcdd0('0x9')](_0x2b33fc);}return _0xe8ed9;}function getFirstInterface(){var _0x48db66=_['head'](getInterfaces());return{'macAddress':_0x48db66&&_0x48db66[_0xcdd0('0xa')]?_0x48db66[_0xcdd0('0xa')]:_0xcdd0('0xb'),'ipAddress':_0x48db66&&_0x48db66[_0xcdd0('0xc')]?_0x48db66[_0xcdd0('0xc')]:_0xcdd0('0xd')};}exports[_0xcdd0('0xe')]=getFirstInterface;function getCPUhash(){var _0x83845b=_[_0xcdd0('0x4')](os[_0xcdd0('0xf')]()['map'](function(_0x4a1ff6){return _0x4a1ff6[_0xcdd0('0x10')];}))[_0xcdd0('0x11')](':');return crypto['createHash'](_0xcdd0('0x12'))[_0xcdd0('0x13')](_0x83845b)['digest'](_0xcdd0('0x14'));}exports[_0xcdd0('0x15')]=function(){switch(os[_0xcdd0('0x16')]()){case _0xcdd0('0x17'):return exec(_0xcdd0('0x18'),{'encoding':'utf8'})['replace']('\x0d\x0a','');default:var _0x189f54=getFirstInterface();var _0x1cd478=getCPUhash();var _0xf2ca58=_0x1cd478+'|'+os[_0xcdd0('0x19')]()+'|'+_0x189f54[_0xcdd0('0x1a')]+'|'+_0x189f54[_0xcdd0('0x1b')];var _0xdab70c=crypto[_0xcdd0('0x1c')](_0xcdd0('0x12'))[_0xcdd0('0x13')](_0xf2ca58)['digest'](_0xcdd0('0x14'));return _0xdab70c[_0xcdd0('0x1d')](0x0,0x8)+'-'+_0xdab70c['substring'](0x8,0xc)+'-'+_0xdab70c['substring'](0xc,0x10)+'-'+_0xdab70c[_0xcdd0('0x1d')](0x10,0x14)+'-'+_0xdab70c[_0xcdd0('0x1d')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index d2ce491..625f4f7 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 _0x77d4=['final','createDecipher','session','utf8','||FIELD||VALUE||\x0a','findOne','fullname','email','|reason|','|uuid|','|machineUuid|','|name|','|email|','ipAddress','MOTLICENSE','Motion\x20License\x20Alert','Alert','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','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','catch','error','message','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','crypto','request-promise','pkginfo','version','./hardware','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','aes-256-ctr','secrets','update'];(function(_0x182b19,_0x509657){var _0x44ee38=function(_0x1a7962){while(--_0x1a7962){_0x182b19['push'](_0x182b19['shift']());}};_0x44ee38(++_0x509657);}(_0x77d4,0x108));var _0x477d=function(_0x57d5b7,_0x41f875){_0x57d5b7=_0x57d5b7-0x0;var _0x2ffda2=_0x77d4[_0x57d5b7];return _0x2ffda2;};'use strict';var util=require('util');var crypto=require(_0x477d('0x0'));var moment=require('moment');var rp=require(_0x477d('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0x477d('0x2'))(module,_0x477d('0x3'));var db=require('../../mysqldb')['db'];var config=require('../environment');var hardware=require(_0x477d('0x4'));var logger=require(_0x477d('0x5'))(_0x477d('0x6'));var jira=require(_0x477d('0x7'));var HOST=_0x477d('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x45ca2d){return new BPromise(function(_0x5153df,_0x4f4fb4){var _0x2dd5d2=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x45ca2d,module[_0x477d('0x9')][_0x477d('0x3')]);if(oldToken){_0x2dd5d2=util[_0x477d('0xa')](_0x477d('0xb'),HOST,_0x45ca2d,module[_0x477d('0x9')]['version'],oldToken);}var _0x932cc9={'uri':_0x2dd5d2,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x932cc9)[_0x477d('0xc')](function(_0x462ac1){_0x5153df(_0x462ac1);})['catch'](function(_0x472012){_0x4f4fb4(_0x472012);});});}function encryptDate(_0x3d362a){var _0x5a190c=crypto['createCipher'](_0x477d('0xd'),config[_0x477d('0xe')]['session']);var _0x290d46=_0x5a190c[_0x477d('0xf')](_0x3d362a,'utf8','base64');_0x290d46+=_0x5a190c[_0x477d('0x10')]('base64');return _0x290d46;}function decryptDate(_0x30481f){var _0x234b99=crypto[_0x477d('0x11')]('aes-256-ctr',config[_0x477d('0xe')][_0x477d('0x12')]);var _0x29c6f8=_0x234b99[_0x477d('0xf')](_0x30481f,'base64',_0x477d('0x13'));_0x29c6f8+=_0x234b99['final'](_0x477d('0x13'));return _0x29c6f8;}function sendJiraAlert(_0x1399d7,_0x159beb,_0x458489){var _0x37bcb3=_0x477d('0x14');return db['User'][_0x477d('0x15')]({'where':{'role':'admin'},'attributes':[_0x477d('0x16'),_0x477d('0x17')],'raw':!![]})[_0x477d('0xc')](function(_0x14cbd5){ADMIN=_0x14cbd5;_0x37bcb3+=_0x477d('0x18')+_0x458489+'|\x0a';_0x37bcb3+=_0x477d('0x19')+_0x1399d7+'|\x0a';_0x37bcb3+=_0x477d('0x1a')+_0x159beb+'|\x0a';_0x37bcb3+=_0x477d('0x1b')+ADMIN[_0x477d('0x16')]+'|\x0a';_0x37bcb3+=_0x477d('0x1c')+ADMIN[_0x477d('0x17')]+'|\x0a';return _0x37bcb3;})[_0x477d('0xc')](function(_0x43c845){var _0x1f3868=hardware['getFirstInterface']()[_0x477d('0x1d')];return jira['openIssue']({'key':_0x477d('0x1e'),'summary':_0x477d('0x1f'),'description':_0x43c845,'issuetype':_0x477d('0x20'),'oldToken':_0x1399d7,'newToken':_0x159beb,'email':ADMIN[_0x477d('0x17')],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x1f3868});});}function manageLicense(_0xd6dca5,_0x2dfa90){var _0x1ca4fe=_0x2dfa90['get']({'plain':!![]});httpRequest(_0xd6dca5)['then'](function(_0x198697){if(oldToken){oldToken=undefined;}if(_0x198697[_0x477d('0x21')]){if(!_0x1ca4fe[_0x477d('0x6')]&&_0x1ca4fe['license']!=_0x198697[_0x477d('0x6')]||_0x1ca4fe[_0x477d('0x6')]&&_0x1ca4fe[_0x477d('0x22')]){logger[_0x477d('0x23')](_0x477d('0x24'));}if(_0x1ca4fe['license']&&!_0x1ca4fe[_0x477d('0x22')]&&_0x1ca4fe[_0x477d('0x6')]!=_0x198697[_0x477d('0x6')]){logger[_0x477d('0x23')](_0x477d('0x25'));}if(_0x1ca4fe[_0x477d('0x6')]&&!_0x1ca4fe[_0x477d('0x22')]&&_0x1ca4fe[_0x477d('0x6')]==_0x198697[_0x477d('0x6')]){return _0x2dfa90;}return _0x2dfa90[_0x477d('0xf')]({'data1':_0xd6dca5,'data2':null,'license':_0x198697[_0x477d('0x6')]});}else{if(_0x198697[_0x477d('0x6')]||_0x1ca4fe[_0x477d('0x6')]){if(!_0x1ca4fe[_0x477d('0x22')]){if(_0x1ca4fe[_0x477d('0x26')]==_0xd6dca5){GRAY_PERIOD_REASON=_0x477d('0x27');logger[_0x477d('0x23')](_0x477d('0x28'));}else{GRAY_PERIOD_REASON=_0x477d('0x29');oldToken=_0x1ca4fe[_0x477d('0x26')];logger['info'](_0x477d('0x2a'),_0x1ca4fe['data1'],_0xd6dca5);}sendJiraAlert(_0x1ca4fe[_0x477d('0x26')],_0x198697[_0x477d('0x2b')],GRAY_PERIOD_REASON);logger[_0x477d('0x23')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x477d('0x2c')](),moment()[_0x477d('0xa')](_0x477d('0x2d')));return _0x2dfa90[_0x477d('0xf')]({'data2':encryptDate(moment()[_0x477d('0xa')](_0x477d('0x2d')))});}else{if(moment()[_0x477d('0x2e')](decryptDate(_0x1ca4fe[_0x477d('0x22')]),_0x477d('0x2f'))>DAYS){logger[_0x477d('0x23')]('DEMO\x20START\x20AT\x20%s',moment()[_0x477d('0xa')](_0x477d('0x2d')));return _0x2dfa90[_0x477d('0xf')]({'data1':_0xd6dca5,'data2':null,'license':null});}}}else{if(_0x1ca4fe['data1']!=_0xd6dca5){logger[_0x477d('0x23')](_0x477d('0x2a'),_0x1ca4fe[_0x477d('0x26')],_0xd6dca5);return _0x2dfa90['update']({'data1':_0xd6dca5,'data2':null,'license':null});}}}return _0x2dfa90;})['then'](function(_0x21de5c){_0x2dfa90=_0x21de5c;})[_0x477d('0x30')](function(_0x260e14){logger[_0x477d('0x31')](_0x260e14[_0x477d('0x32')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x477d('0x33')](),_0x2dfa90);},TIME);});}function defaultLicense(){var _0x59ad77=hardware[_0x477d('0x33')]();if(_0x59ad77){return db[_0x477d('0x34')][_0x477d('0x35')]({'where':{'id':0x1},'defaults':{'data1':_0x59ad77}})['spread'](function(_0x5170fe,_0x184d50){logger[_0x477d('0x23')](_0x477d('0x36'),_0x59ad77);manageLicense(_0x59ad77,_0x5170fe);})[_0x477d('0x30')](function(_0x4b263d){logger[_0x477d('0x31')](_0x4b263d[_0x477d('0x32')]);});}}exports[_0x477d('0x37')]=defaultLicense; \ No newline at end of file +var _0xa498=['%s/api/servers/%s/check?version=%s','exports','GET','then','catch','createCipher','aes-256-ctr','secrets','utf8','base64','createDecipher','session','update','final','User','findOne','admin','email','|reason|','|uuid|','|machineUuid|','|name|','|email|','getFirstInterface','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','fullname','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','data1','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','DEMO\x20START\x20AT\x20%s','error','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','crypto','moment','pkginfo','version','../../mysqldb','../environment','./hardware','license','https://www.xcallymotion.com','format'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0xa498,0x1d6));var _0x8a49=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0xa498[_0x2b5513];return _0x578fd2;};'use strict';var util=require('util');var crypto=require(_0x8a49('0x0'));var moment=require(_0x8a49('0x1'));var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require(_0x8a49('0x2'))(module,_0x8a49('0x3'));var db=require(_0x8a49('0x4'))['db'];var config=require(_0x8a49('0x5'));var hardware=require(_0x8a49('0x6'));var logger=require('../logger')(_0x8a49('0x7'));var jira=require('../../api/jira/jira.controller');var HOST=_0x8a49('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0xbabb47){return new BPromise(function(_0x354918,_0x5b1c4e){var _0x3048b7=util[_0x8a49('0x9')](_0x8a49('0xa'),HOST,_0xbabb47,module[_0x8a49('0xb')][_0x8a49('0x3')]);if(oldToken){_0x3048b7=util[_0x8a49('0x9')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0xbabb47,module[_0x8a49('0xb')][_0x8a49('0x3')],oldToken);}var _0x41674b={'uri':_0x3048b7,'method':_0x8a49('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x41674b)[_0x8a49('0xd')](function(_0x35f2b0){_0x354918(_0x35f2b0);})[_0x8a49('0xe')](function(_0x378ea4){_0x5b1c4e(_0x378ea4);});});}function encryptDate(_0x31d95a){var _0x5b8111=crypto[_0x8a49('0xf')](_0x8a49('0x10'),config[_0x8a49('0x11')]['session']);var _0xad2c87=_0x5b8111['update'](_0x31d95a,_0x8a49('0x12'),_0x8a49('0x13'));_0xad2c87+=_0x5b8111['final'](_0x8a49('0x13'));return _0xad2c87;}function decryptDate(_0x902ee2){var _0x329a7b=crypto[_0x8a49('0x14')]('aes-256-ctr',config['secrets'][_0x8a49('0x15')]);var _0x1caa4d=_0x329a7b[_0x8a49('0x16')](_0x902ee2,_0x8a49('0x13'),'utf8');_0x1caa4d+=_0x329a7b[_0x8a49('0x17')](_0x8a49('0x12'));return _0x1caa4d;}function sendJiraAlert(_0x47328a,_0x3a97d8,_0x441ab1){var _0x523879='||FIELD||VALUE||\x0a';return db[_0x8a49('0x18')][_0x8a49('0x19')]({'where':{'role':_0x8a49('0x1a')},'attributes':['fullname',_0x8a49('0x1b')],'raw':!![]})[_0x8a49('0xd')](function(_0x11d86b){ADMIN=_0x11d86b;_0x523879+=_0x8a49('0x1c')+_0x441ab1+'|\x0a';_0x523879+=_0x8a49('0x1d')+_0x47328a+'|\x0a';_0x523879+=_0x8a49('0x1e')+_0x3a97d8+'|\x0a';_0x523879+=_0x8a49('0x1f')+ADMIN['fullname']+'|\x0a';_0x523879+=_0x8a49('0x20')+ADMIN[_0x8a49('0x1b')]+'|\x0a';return _0x523879;})['then'](function(_0x3b6220){var _0x479bca=hardware[_0x8a49('0x21')]()['ipAddress'];return jira[_0x8a49('0x22')]({'key':_0x8a49('0x23'),'summary':_0x8a49('0x24'),'description':_0x3b6220,'issuetype':_0x8a49('0x25'),'oldToken':_0x47328a,'newToken':_0x3a97d8,'email':ADMIN[_0x8a49('0x1b')],'name':ADMIN[_0x8a49('0x26')],'reason':GRAY_PERIOD_REASON,'ip':_0x479bca});});}function manageLicense(_0x1b0a01,_0x5c20b6){var _0x2fc60e=_0x5c20b6['get']({'plain':!![]});httpRequest(_0x1b0a01)[_0x8a49('0xd')](function(_0x5c6dd8){if(oldToken){oldToken=undefined;}if(_0x5c6dd8[_0x8a49('0x27')]){if(!_0x2fc60e[_0x8a49('0x7')]&&_0x2fc60e['license']!=_0x5c6dd8['license']||_0x2fc60e[_0x8a49('0x7')]&&_0x2fc60e[_0x8a49('0x28')]){logger[_0x8a49('0x29')](_0x8a49('0x2a'));}if(_0x2fc60e['license']&&!_0x2fc60e[_0x8a49('0x28')]&&_0x2fc60e[_0x8a49('0x7')]!=_0x5c6dd8[_0x8a49('0x7')]){logger[_0x8a49('0x29')](_0x8a49('0x2b'));}if(_0x2fc60e['license']&&!_0x2fc60e[_0x8a49('0x28')]&&_0x2fc60e[_0x8a49('0x7')]==_0x5c6dd8[_0x8a49('0x7')]){return _0x5c20b6;}return _0x5c20b6[_0x8a49('0x16')]({'data1':_0x1b0a01,'data2':null,'license':_0x5c6dd8[_0x8a49('0x7')]});}else{if(_0x5c6dd8[_0x8a49('0x7')]||_0x2fc60e[_0x8a49('0x7')]){if(!_0x2fc60e['data2']){if(_0x2fc60e['data1']==_0x1b0a01){GRAY_PERIOD_REASON=_0x8a49('0x2c');logger[_0x8a49('0x29')](_0x8a49('0x2d'));}else{GRAY_PERIOD_REASON=_0x8a49('0x2e');oldToken=_0x2fc60e['data1'];logger[_0x8a49('0x29')](_0x8a49('0x2f'),_0x2fc60e['data1'],_0x1b0a01);}sendJiraAlert(_0x2fc60e[_0x8a49('0x30')],_0x5c6dd8['uuid'],GRAY_PERIOD_REASON);logger[_0x8a49('0x29')](_0x8a49('0x31'),GRAY_PERIOD_REASON[_0x8a49('0x32')](),moment()[_0x8a49('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x5c20b6[_0x8a49('0x16')]({'data2':encryptDate(moment()[_0x8a49('0x9')](_0x8a49('0x33')))});}else{if(moment()['diff'](decryptDate(_0x2fc60e[_0x8a49('0x28')]),'days')>DAYS){logger['info'](_0x8a49('0x34'),moment()[_0x8a49('0x9')](_0x8a49('0x33')));return _0x5c20b6[_0x8a49('0x16')]({'data1':_0x1b0a01,'data2':null,'license':null});}}}else{if(_0x2fc60e['data1']!=_0x1b0a01){logger['info'](_0x8a49('0x2f'),_0x2fc60e[_0x8a49('0x30')],_0x1b0a01);return _0x5c20b6[_0x8a49('0x16')]({'data1':_0x1b0a01,'data2':null,'license':null});}}}return _0x5c20b6;})[_0x8a49('0xd')](function(_0x4c6fa4){_0x5c20b6=_0x4c6fa4;})[_0x8a49('0xe')](function(_0x430d1d){logger[_0x8a49('0x35')](_0x430d1d['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x8a49('0x36')](),_0x5c20b6);},TIME);});}function defaultLicense(){var _0xb4067=hardware[_0x8a49('0x36')]();if(_0xb4067){return db['License'][_0x8a49('0x37')]({'where':{'id':0x1},'defaults':{'data1':_0xb4067}})[_0x8a49('0x38')](function(_0x1d53cf,_0x7b71bb){logger[_0x8a49('0x29')](_0x8a49('0x39'),_0xb4067);manageLicense(_0xb4067,_0x1d53cf);})['catch'](function(_0x1559aa){logger[_0x8a49('0x35')](_0x1559aa[_0x8a49('0x3a')]);});}}exports[_0x8a49('0x3b')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index f358073..3c17394 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 _0x6e37=['find','defaults','then','checkLicense','crypto','moment','../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','split','aes-256-ctr','%s:%s:%s','update','base64','utf8','final','parse','demo','uuid','getUuid','secrets','session','gray','deadline','format','grayReason','machineUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','message','Demo\x20license','getLicense','License'];(function(_0x48c9b3,_0x1fb678){var _0x4c782f=function(_0x4b3842){while(--_0x4b3842){_0x48c9b3['push'](_0x48c9b3['shift']());}};_0x4c782f(++_0x1fb678);}(_0x6e37,0x1a8));var _0x76e3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6e37[_0x20a584];return _0x4b41a8;};'use strict';var crypto=require(_0x76e3('0x0'));var util=require('util');var _=require('lodash');var moment=require(_0x76e3('0x1'));var hardware=require('./hardware');var config=require('../environment');var db=require(_0x76e3('0x2'))['db'];function checkLicense(_0x394234,_0x190158){if(_0x394234){try{var _0x4d919c=_0x190158||_0x394234[_0x76e3('0x3')];if(_[_0x76e3('0x4')](_0x4d919c)){throw new Error(_0x76e3('0x5'));}var _0x3d8d71=_0x394234[_0x76e3('0x6')];var _0x25bdfc=_0x394234['data2'];var _0x4e0042=_0x3d8d71[_0x76e3('0x7')]('-')[0x4];var _0x1de3af=_0x3d8d71[_0x76e3('0x7')]('-')[0x0];var _0x556aa3=crypto['createDecipher'](_0x76e3('0x8'),util['format'](_0x76e3('0x9'),_0x4e0042,_0x3d8d71,_0x1de3af));var _0xf34b0c=_0x556aa3[_0x76e3('0xa')](_0x4d919c,_0x76e3('0xb'),_0x76e3('0xc'));_0xf34b0c+=_0x556aa3[_0x76e3('0xd')](_0x76e3('0xc'));var _0x4baff3=JSON[_0x76e3('0xe')](_0xf34b0c);_0x4baff3[_0x76e3('0xf')]=![];_0x4baff3[_0x76e3('0x10')]=_0x3d8d71;_0x4baff3['machineUuid']=hardware[_0x76e3('0x11')]();if(_0x25bdfc){var _0x1e8336=crypto['createDecipher']('aes-256-ctr',config[_0x76e3('0x12')][_0x76e3('0x13')]);var _0x24960e=_0x1e8336[_0x76e3('0xa')](_0x25bdfc,_0x76e3('0xb'),_0x76e3('0xc'));_0x24960e+=_0x1e8336[_0x76e3('0xd')](_0x76e3('0xc'));_0x4baff3[_0x76e3('0x14')]=_0x24960e;_0x4baff3[_0x76e3('0x15')]=moment(_0x24960e)['add'](0x7,'days')[_0x76e3('0x16')]();_0x4baff3[_0x76e3('0x17')]=_0x4baff3['uuid']!=_0x4baff3[_0x76e3('0x18')]?'changed':'disabled';}return _0x4baff3;}catch(_0x1dc9aa){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x76e3('0x19'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x76e3('0x1a'),'uuid':_0x394234[_0x76e3('0x6')],'machineUuid':hardware[_0x76e3('0x11')](),'message':_0x1dc9aa[_0x76e3('0x1b')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x76e3('0x19'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x76e3('0x1c'),'uuid':_0x394234[_0x76e3('0x6')],'machineUuid':hardware[_0x76e3('0x11')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}exports[_0x76e3('0x1d')]=function(_0x1d3bed){return db[_0x76e3('0x1e')][_0x76e3('0x1f')](_[_0x76e3('0x20')](_0x1d3bed,{'raw':!![],'where':{'id':0x1}}))[_0x76e3('0x21')](function(_0x34c530){return checkLicense(_0x34c530,null);});};exports[_0x76e3('0x22')]=checkLicense; \ No newline at end of file +var _0xd4cd=['add','days','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','getUuid','message','getLicense','License','find','then','checkLicense','util','lodash','../environment','../../mysqldb','isEmpty','data1','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','parse','demo','uuid','machineUuid','createDecipher','secrets','session','gray'];(function(_0x4f2ca4,_0x51169f){var _0x5b31c7=function(_0x298da8){while(--_0x298da8){_0x4f2ca4['push'](_0x4f2ca4['shift']());}};_0x5b31c7(++_0x51169f);}(_0xd4cd,0x161));var _0xdd4c=function(_0x4c260a,_0x148241){_0x4c260a=_0x4c260a-0x0;var _0x17bbdd=_0xd4cd[_0x4c260a];return _0x17bbdd;};'use strict';var crypto=require('crypto');var util=require(_0xdd4c('0x0'));var _=require(_0xdd4c('0x1'));var moment=require('moment');var hardware=require('./hardware');var config=require(_0xdd4c('0x2'));var db=require(_0xdd4c('0x3'))['db'];function checkLicense(_0x2209b0,_0x3f29f4){if(_0x2209b0){try{var _0x4d7823=_0x3f29f4||_0x2209b0['license'];if(_[_0xdd4c('0x4')](_0x4d7823)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x2e87f3=_0x2209b0[_0xdd4c('0x5')];var _0x3ffef7=_0x2209b0['data2'];var _0x3ded10=_0x2e87f3['split']('-')[0x4];var _0x2a397b=_0x2e87f3[_0xdd4c('0x6')]('-')[0x0];var _0x356eb9=crypto['createDecipher'](_0xdd4c('0x7'),util[_0xdd4c('0x8')](_0xdd4c('0x9'),_0x3ded10,_0x2e87f3,_0x2a397b));var _0x5a4d85=_0x356eb9[_0xdd4c('0xa')](_0x4d7823,_0xdd4c('0xb'),_0xdd4c('0xc'));_0x5a4d85+=_0x356eb9['final'](_0xdd4c('0xc'));var _0x306a1f=JSON[_0xdd4c('0xd')](_0x5a4d85);_0x306a1f[_0xdd4c('0xe')]=![];_0x306a1f[_0xdd4c('0xf')]=_0x2e87f3;_0x306a1f[_0xdd4c('0x10')]=hardware['getUuid']();if(_0x3ffef7){var _0x5ec504=crypto[_0xdd4c('0x11')](_0xdd4c('0x7'),config[_0xdd4c('0x12')][_0xdd4c('0x13')]);var _0x36d33b=_0x5ec504['update'](_0x3ffef7,_0xdd4c('0xb'),_0xdd4c('0xc'));_0x36d33b+=_0x5ec504['final']('utf8');_0x306a1f[_0xdd4c('0x14')]=_0x36d33b;_0x306a1f['deadline']=moment(_0x36d33b)[_0xdd4c('0x15')](0x7,_0xdd4c('0x16'))['format']();_0x306a1f['grayReason']=_0x306a1f[_0xdd4c('0xf')]!=_0x306a1f['machineUuid']?_0xdd4c('0x17'):_0xdd4c('0x18');}return _0x306a1f;}catch(_0x4421b6){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xdd4c('0x19'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xdd4c('0x1a'),'uuid':_0x2209b0[_0xdd4c('0x5')],'machineUuid':hardware[_0xdd4c('0x1b')](),'message':_0x4421b6[_0xdd4c('0x1c')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xdd4c('0x19'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','uuid':_0x2209b0[_0xdd4c('0x5')],'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}exports[_0xdd4c('0x1d')]=function(_0x34bfae){return db[_0xdd4c('0x1e')][_0xdd4c('0x1f')](_['defaults'](_0x34bfae,{'raw':!![],'where':{'id':0x1}}))[_0xdd4c('0x20')](function(_0x3066f2){return checkLicense(_0x3066f2,null);});};exports[_0xdd4c('0x21')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 9adda20..53c272c 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 _0x0592=['myappanuglar-secret','app-id','secret','exports','http://localhost:9000'];(function(_0x2753f8,_0x5ae963){var _0x54d249=function(_0x3e126a){while(--_0x3e126a){_0x2753f8['push'](_0x2753f8['shift']());}};_0x54d249(++_0x5ae963);}(_0x0592,0xf3));var _0x2059=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0592[_0x321bb2];return _0x9c12ed;};'use strict';module[_0x2059('0x0')]={'DOMAIN':_0x2059('0x1'),'SESSION_SECRET':_0x2059('0x2'),'GOOGLE_ID':_0x2059('0x3'),'GOOGLE_SECRET':_0x2059('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x87ef=['myappanuglar-secret','app-id','secret','exports'];(function(_0x324418,_0x140a36){var _0x341893=function(_0x3848f0){while(--_0x3848f0){_0x324418['push'](_0x324418['shift']());}};_0x341893(++_0x140a36);}(_0x87ef,0x13f));var _0xf87e=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0x87ef[_0xdd2bfa];return _0x55397e;};'use strict';module[_0xf87e('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xf87e('0x1'),'GOOGLE_ID':_0xf87e('0x2'),'GOOGLE_SECRET':_0xf87e('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index e8e9031..59409e8 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe2c=['debugLevel','moment','util','INFO','/var','log','xcally','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','exports','Logger','transports','File','%s-%s','error','info'];(function(_0x3203a1,_0x46c498){var _0x24215e=function(_0x4ffab0){while(--_0x4ffab0){_0x3203a1['push'](_0x3203a1['shift']());}};_0x24215e(++_0x46c498);}(_0xfe2c,0x1ba));var _0xcfe2=function(_0x13273f,_0x3c15ff){_0x13273f=_0x13273f-0x0;var _0x22b2dc=_0xfe2c[_0x13273f];return _0x22b2dc;};'use strict';var moment=require(_0xcfe2('0x0'));var winston=require('winston');var util=require(_0xcfe2('0x1'));var path=require('path');var debugLevel=_0xcfe2('0x2');function filename(_0x2fd0f4,_0x52dba2){return path['join'](_0xcfe2('0x3'),_0xcfe2('0x4'),_0xcfe2('0x5'),util[_0xcfe2('0x6')](_0xcfe2('0x7'),_0x2fd0f4,_0x52dba2));}function formatter(_0x4fdeb7,_0x12df4d){return util[_0xcfe2('0x6')](_0xcfe2('0x8'),moment()[_0xcfe2('0x6')](_0xcfe2('0x9')),_0x12df4d[_0xcfe2('0xa')][_0xcfe2('0xb')](),_0x4fdeb7,_0x12df4d[_0xcfe2('0xc')]);}module[_0xcfe2('0xd')]=function(_0x4a126c){return new winston[(_0xcfe2('0xe'))]({'transports':[new winston[(_0xcfe2('0xf'))][(_0xcfe2('0x10'))]({'name':util['format'](_0xcfe2('0x11'),_0x4a126c,'error'),'filename':filename(_0x4a126c,_0xcfe2('0x12')),'level':_0xcfe2('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x522b18){return formatter(_0x4a126c,_0x522b18);}}),new winston['transports'][(_0xcfe2('0x10'))]({'name':util['format'](_0xcfe2('0x11'),_0x4a126c,_0xcfe2('0x13')),'filename':filename(_0x4a126c,_0xcfe2('0x13')),'level':_0xcfe2('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x9b6d83){return formatter(_0x4a126c,_0x9b6d83);}}),new winston[(_0xcfe2('0xf'))]['Console']({'level':process['env'][_0xcfe2('0x14')]||debugLevel,'json':![],'formatter':function(_0x537115){return formatter(_0x4a126c,_0x537115);}})]});}; \ No newline at end of file +var _0xfb7a=['moment','util','INFO','join','log','%s-%s.log','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','message','exports','Logger','File','error','transports','%s-%s','info','Console','debugLevel'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xfb7a,0xc8));var _0xafb7=function(_0x255cca,_0x121536){_0x255cca=_0x255cca-0x0;var _0x16d8de=_0xfb7a[_0x255cca];return _0x16d8de;};'use strict';var moment=require(_0xafb7('0x0'));var winston=require('winston');var util=require(_0xafb7('0x1'));var path=require('path');var debugLevel=_0xafb7('0x2');function filename(_0x23fa4f,_0x159b9c){return path[_0xafb7('0x3')]('/var',_0xafb7('0x4'),'xcally',util['format'](_0xafb7('0x5'),_0x23fa4f,_0x159b9c));}function formatter(_0x9eabc1,_0xed2fab){return util[_0xafb7('0x6')](_0xafb7('0x7'),moment()['format'](_0xafb7('0x8')),_0xed2fab['level'][_0xafb7('0x9')](),_0x9eabc1,_0xed2fab[_0xafb7('0xa')]);}module[_0xafb7('0xb')]=function(_0x1272c1){return new winston[(_0xafb7('0xc'))]({'transports':[new winston['transports'][(_0xafb7('0xd'))]({'name':util[_0xafb7('0x6')]('%s-%s',_0x1272c1,_0xafb7('0xe')),'filename':filename(_0x1272c1,_0xafb7('0xe')),'level':_0xafb7('0xe'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x189ed5){return formatter(_0x1272c1,_0x189ed5);}}),new winston[(_0xafb7('0xf'))][(_0xafb7('0xd'))]({'name':util[_0xafb7('0x6')](_0xafb7('0x10'),_0x1272c1,'info'),'filename':filename(_0x1272c1,_0xafb7('0x11')),'level':_0xafb7('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4b6eb4){return formatter(_0x1272c1,_0x4b6eb4);}}),new winston[(_0xafb7('0xf'))][(_0xafb7('0x12'))]({'level':process['env'][_0xafb7('0x13')]||debugLevel,'json':![],'formatter':function(_0x266504){return formatter(_0x1272c1,_0x266504);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index e067fdd..824cead 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 _0x8d48=['../../services/email/index.js','routing','../../services/routing/index.js','xdr','exports','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','join','../../services/agi/index.js','email'];(function(_0x4b3c82,_0x2d601d){var _0x4974a0=function(_0x24c846){while(--_0x24c846){_0x4b3c82['push'](_0x4b3c82['shift']());}};_0x4974a0(++_0x2d601d);}(_0x8d48,0x18b));var _0x88d4=function(_0x7275e9,_0x321fa5){_0x7275e9=_0x7275e9-0x0;var _0x17b99d=_0x8d48[_0x7275e9];return _0x17b99d;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x88d4('0x0'),'script':path['join'](__dirname,_0x88d4('0x1'))},{'name':_0x88d4('0x2'),'script':path['join'](__dirname,_0x88d4('0x3'))},{'name':_0x88d4('0x4'),'script':path[_0x88d4('0x5')](__dirname,_0x88d4('0x6'))},{'name':_0x88d4('0x7'),'script':path[_0x88d4('0x5')](__dirname,_0x88d4('0x8'))},{'name':_0x88d4('0x9'),'script':path['join'](__dirname,_0x88d4('0xa'))},{'name':_0x88d4('0xb'),'script':path[_0x88d4('0x5')](__dirname,'../../services/xdr/index.js')}]};module[_0x88d4('0xc')]=config; \ No newline at end of file +var _0xbf9a=['../../services/ami/index.js','agi','../../services/agi/index.js','email','routing','../../services/routing/index.js','path','join','../../services/express/index.js','ami'];(function(_0x2bf258,_0x5e0bb2){var _0x3b43af=function(_0x2c40af){while(--_0x2c40af){_0x2bf258['push'](_0x2bf258['shift']());}};_0x3b43af(++_0x5e0bb2);}(_0xbf9a,0x7e));var _0xabf9=function(_0x2f62aa,_0x108e95){_0x2f62aa=_0x2f62aa-0x0;var _0x1a341f=_0xbf9a[_0x2f62aa];return _0x1a341f;};'use strict';var path=require(_0xabf9('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0xabf9('0x1')](__dirname,_0xabf9('0x2'))},{'name':_0xabf9('0x3'),'script':path['join'](__dirname,_0xabf9('0x4'))},{'name':_0xabf9('0x5'),'script':path[_0xabf9('0x1')](__dirname,_0xabf9('0x6'))},{'name':_0xabf9('0x7'),'script':path[_0xabf9('0x1')](__dirname,'../../services/email/index.js')},{'name':_0xabf9('0x8'),'script':path[_0xabf9('0x1')](__dirname,_0xabf9('0x9'))},{'name':'xdr','script':path['join'](__dirname,'../../services/xdr/index.js')}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index e4242bb..fabba42 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 _0x8fa6=['then','restart','list','describe','dump','saved','pm2','bluebird','./config','connect','connected','disconnect','stop'];(function(_0x2f8488,_0x5c1eb2){var _0x522eee=function(_0x22356c){while(--_0x22356c){_0x2f8488['push'](_0x2f8488['shift']());}};_0x522eee(++_0x5c1eb2);}(_0x8fa6,0x1c0));var _0x68fa=function(_0x5487b5,_0x114579){_0x5487b5=_0x5487b5-0x0;var _0x48fa3e=_0x8fa6[_0x5487b5];return _0x48fa3e;};'use strict';var pm2=require(_0x68fa('0x0'));var BPromise=require(_0x68fa('0x1'));var config=require(_0x68fa('0x2'));function connect(){return new BPromise(function(_0x55876d,_0x2b4fd0){return pm2[_0x68fa('0x3')](function(_0x38e9d9){if(_0x38e9d9){return _0x2b4fd0(_0x38e9d9);}return _0x55876d(_0x68fa('0x4'));});});};exports['start']=function(_0x1fd915){return connect()['then'](function(){return new BPromise(function(_0x4e45c1,_0x304098){return pm2['start'](_0x1fd915,function(_0x312d35,_0x11dc76){if(_0x312d35){return _0x304098(_0x312d35);}pm2[_0x68fa('0x5')]();return _0x4e45c1(_0x11dc76);});});});};exports[_0x68fa('0x6')]=function(_0x473901){return connect()[_0x68fa('0x7')](function(){return new BPromise(function(_0x4e906d,_0x3db73c){return pm2[_0x68fa('0x6')](_0x473901,function(_0x5decd3,_0x136833){if(_0x5decd3){return _0x3db73c(_0x5decd3);}pm2[_0x68fa('0x5')]();return _0x4e906d(_0x136833);});});});};exports[_0x68fa('0x8')]=function(_0x3d221){return connect()['then'](function(){return new BPromise(function(_0x514d07,_0x2ea35e){return pm2['restart'](_0x3d221,function(_0x499beb,_0x5ef985){if(_0x499beb){return _0x2ea35e(_0x499beb);}pm2[_0x68fa('0x5')]();return _0x514d07(_0x5ef985);});});});};exports[_0x68fa('0x9')]=function(){return connect()[_0x68fa('0x7')](function(){return new BPromise(function(_0x33f055,_0xde978f){return pm2[_0x68fa('0x9')](function(_0x31c2d5,_0x527d8e){if(_0x31c2d5){return _0xde978f(_0x31c2d5);}pm2[_0x68fa('0x5')]();return _0x33f055(_0x527d8e);});});});};exports['describe']=function(_0x3218b){return connect()[_0x68fa('0x7')](function(){return new BPromise(function(_0xab69f2,_0x51bc2f){return pm2[_0x68fa('0xa')](_0x3218b,function(_0x35997a,_0x55b7f5){if(_0x35997a){return _0x51bc2f(_0x35997a);}pm2['disconnect']();return _0xab69f2(_0x55b7f5);});});});};exports['delete']=function(_0x58071b){return connect()[_0x68fa('0x7')](function(){return new BPromise(function(_0x1c3cb2,_0x382942){return pm2['delete'](_0x58071b,function(_0x264728,_0x146105){if(_0x264728){return _0x382942(_0x264728);}pm2[_0x68fa('0x5')]();return _0x1c3cb2(_0x146105);});});});};exports[_0x68fa('0xb')]=function(){return connect()[_0x68fa('0x7')](function(){return new BPromise(function(_0x41574a,_0x212033){return pm2[_0x68fa('0xb')](function(_0x246a2a){if(_0x246a2a){return _0x212033(_0x246a2a);}return _0x41574a(_0x68fa('0xc'));});});});}; \ No newline at end of file +var _0x4250=['connected','then','start','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect'];(function(_0x2c25d3,_0x230d8f){var _0x36df3a=function(_0x317914){while(--_0x317914){_0x2c25d3['push'](_0x2c25d3['shift']());}};_0x36df3a(++_0x230d8f);}(_0x4250,0x146));var _0x0425=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x4250[_0xbb091];return _0x467a04;};'use strict';var pm2=require(_0x0425('0x0'));var BPromise=require(_0x0425('0x1'));var config=require(_0x0425('0x2'));function connect(){return new BPromise(function(_0x330d15,_0x49047f){return pm2[_0x0425('0x3')](function(_0x24b21e){if(_0x24b21e){return _0x49047f(_0x24b21e);}return _0x330d15(_0x0425('0x4'));});});};exports['start']=function(_0x1dd2ed){return connect()[_0x0425('0x5')](function(){return new BPromise(function(_0x3f7355,_0x1e9547){return pm2[_0x0425('0x6')](_0x1dd2ed,function(_0xb08e11,_0x12f19a){if(_0xb08e11){return _0x1e9547(_0xb08e11);}pm2[_0x0425('0x7')]();return _0x3f7355(_0x12f19a);});});});};exports[_0x0425('0x8')]=function(_0x1a70f5){return connect()[_0x0425('0x5')](function(){return new BPromise(function(_0x765182,_0x5b9c2f){return pm2[_0x0425('0x8')](_0x1a70f5,function(_0x308c73,_0x3b9720){if(_0x308c73){return _0x5b9c2f(_0x308c73);}pm2[_0x0425('0x7')]();return _0x765182(_0x3b9720);});});});};exports['restart']=function(_0x56ed86){return connect()[_0x0425('0x5')](function(){return new BPromise(function(_0x5c85cc,_0x3e9a54){return pm2[_0x0425('0x9')](_0x56ed86,function(_0x4cce42,_0x107fe1){if(_0x4cce42){return _0x3e9a54(_0x4cce42);}pm2[_0x0425('0x7')]();return _0x5c85cc(_0x107fe1);});});});};exports[_0x0425('0xa')]=function(){return connect()[_0x0425('0x5')](function(){return new BPromise(function(_0x4c9666,_0x31c83b){return pm2[_0x0425('0xa')](function(_0x5be3af,_0x4c8c50){if(_0x5be3af){return _0x31c83b(_0x5be3af);}pm2['disconnect']();return _0x4c9666(_0x4c8c50);});});});};exports[_0x0425('0xb')]=function(_0x33afcb){return connect()[_0x0425('0x5')](function(){return new BPromise(function(_0x4a6389,_0x4e439a){return pm2[_0x0425('0xb')](_0x33afcb,function(_0x326425,_0x12095a){if(_0x326425){return _0x4e439a(_0x326425);}pm2[_0x0425('0x7')]();return _0x4a6389(_0x12095a);});});});};exports[_0x0425('0xc')]=function(_0x209f13){return connect()[_0x0425('0x5')](function(){return new BPromise(function(_0x32d76a,_0x10f5c7){return pm2[_0x0425('0xc')](_0x209f13,function(_0x494002,_0x33678a){if(_0x494002){return _0x10f5c7(_0x494002);}pm2[_0x0425('0x7')]();return _0x32d76a(_0x33678a);});});});};exports[_0x0425('0xd')]=function(){return connect()[_0x0425('0x5')](function(){return new BPromise(function(_0x3f2d7a,_0x17afee){return pm2[_0x0425('0xd')](function(_0x34765d){if(_0x34765d){return _0x17afee(_0x34765d);}return _0x3f2d7a(_0x0425('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index b573c08..ecf7838 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 _0xf78a=['subtract','minutes','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','map','length','emit','chatInteraction:update','start','lodash','moment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt'];(function(_0x3f09e1,_0x227975){var _0x3340fb=function(_0x4ba932){while(--_0x4ba932){_0x3f09e1['push'](_0x3f09e1['shift']());}};_0x3340fb(++_0x227975);}(_0xf78a,0xb3));var _0xaf78=function(_0x1e7345,_0x18bcce){_0x1e7345=_0x1e7345-0x0;var _0x33017c=_0xf78a[_0x1e7345];return _0x33017c;};'use strict';var _=require(_0xaf78('0x0'));var moment=require(_0xaf78('0x1'));var Redis=require('ioredis');var db=require(_0xaf78('0x2'))['db'];var config=require('../../config/environment');config[_0xaf78('0x3')]=_[_0xaf78('0x4')](config['redis'],{'host':_0xaf78('0x5'),'port':0x18eb});var io=require(_0xaf78('0x6'))(new Redis(config['redis']));function closeInteractions(){var _0x58bd6d=0x0;var _0x1947ed=[];return db['Setting'][_0xaf78('0x7')]({'raw':!![],'attributes':['id',_0xaf78('0x8')],'where':{'id':0x1}})[_0xaf78('0x9')](function(_0x3ce1be){_0x58bd6d=_0x3ce1be[_0xaf78('0x8')];if(_0x58bd6d){return db[_0xaf78('0xa')][_0xaf78('0xb')]({'raw':!![],'attributes':['id',_0xaf78('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xaf78('0xd')](_0x3ce1be[_0xaf78('0x8')],_0xaf78('0xe'))}}});}else{return[];}})['then'](function(_0x4c0c29){_0x1947ed=_0x4c0c29;if(_0x58bd6d){return db[_0xaf78('0xa')][_0xaf78('0xf')]({'closeReason':_0xaf78('0x10'),'disposition':_0xaf78('0x11'),'closed':!![],'closedAt':moment()['format'](_0xaf78('0x12'))},{'where':{'id':_[_0xaf78('0x13')](_0x1947ed||[],'id')}});}})[_0xaf78('0x9')](function(_0x2634fa){for(var _0x3b3764=0x0;_0x3b3764<_0x1947ed[_0xaf78('0x14')];_0x3b3764++){io[_0xaf78('0x15')](_0xaf78('0x16'),{'id':_0x1947ed[_0x3b3764]['id'],'closed':!![]});}})['catch'](function(_0x5bd464){console['error'](_0x5bd464);});}exports[_0xaf78('0x17')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xd486=['emit','error','start','lodash','moment','ioredis','../../mysqldb','../../config/environment','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','minutes','update','system','timeout','map','length'];(function(_0x20568d,_0x13e1dc){var _0x39a641=function(_0x11385f){while(--_0x11385f){_0x20568d['push'](_0x20568d['shift']());}};_0x39a641(++_0x13e1dc);}(_0xd486,0x99));var _0x6d48=function(_0x19dacd,_0x159319){_0x19dacd=_0x19dacd-0x0;var _0x4a4aba=_0xd486[_0x19dacd];return _0x4a4aba;};'use strict';var _=require(_0x6d48('0x0'));var moment=require(_0x6d48('0x1'));var Redis=require(_0x6d48('0x2'));var db=require(_0x6d48('0x3'))['db'];var config=require(_0x6d48('0x4'));config[_0x6d48('0x5')]=_[_0x6d48('0x6')](config['redis'],{'host':_0x6d48('0x7'),'port':0x18eb});var io=require(_0x6d48('0x8'))(new Redis(config[_0x6d48('0x5')]));function closeInteractions(){var _0x48d8fe=0x0;var _0x184474=[];return db[_0x6d48('0x9')][_0x6d48('0xa')]({'raw':!![],'attributes':['id',_0x6d48('0xb')],'where':{'id':0x1}})[_0x6d48('0xc')](function(_0x1cd18b){_0x48d8fe=_0x1cd18b[_0x6d48('0xb')];if(_0x48d8fe){return db[_0x6d48('0xd')][_0x6d48('0xe')]({'raw':!![],'attributes':['id',_0x6d48('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x1cd18b[_0x6d48('0xb')],_0x6d48('0x10'))}}});}else{return[];}})[_0x6d48('0xc')](function(_0x5680d6){_0x184474=_0x5680d6;if(_0x48d8fe){return db[_0x6d48('0xd')][_0x6d48('0x11')]({'closeReason':_0x6d48('0x12'),'disposition':_0x6d48('0x13'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_[_0x6d48('0x14')](_0x184474||[],'id')}});}})[_0x6d48('0xc')](function(_0x50efea){for(var _0x1e4a4c=0x0;_0x1e4a4c<_0x184474[_0x6d48('0x15')];_0x1e4a4c++){io[_0x6d48('0x16')]('chatInteraction:update',{'id':_0x184474[_0x1e4a4c]['id'],'closed':!![]});}})['catch'](function(_0x37bb69){console[_0x6d48('0x17')](_0x37bb69);});}exports[_0x6d48('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index ec8e205..3297120 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 _0x8542=['http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractUnit','savename','%s.%s','extname','zip','join','existsSync','Sent','attachments','message','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','status','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','stringify','email\x20sent','catch','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','findAll','MailServerOut','keys','jobs','map','keyBy','toString','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','resolve','run\x20job','cron','active','endAt','add','isBetween','startAt','update','update\x20cron','stop\x20cron','start','util','path','moment','cron-job-manager','jayson/promise','bluebird','schedule','client'];(function(_0x527a53,_0x3265d6){var _0x2332f5=function(_0x3b2d90){while(--_0x3b2d90){_0x527a53['push'](_0x527a53['shift']());}};_0x2332f5(++_0x3265d6);}(_0x8542,0xaa));var _0x2854=function(_0x9c6222,_0x5820d8){_0x9c6222=_0x9c6222-0x0;var _0x52da60=_0x8542[_0x9c6222];return _0x52da60;};'use strict';var fs=require('fs');var util=require(_0x2854('0x0'));var path=require(_0x2854('0x1'));var _=require('lodash');var moment=require(_0x2854('0x2'));var CronJobManager=require(_0x2854('0x3'));var jayson=require(_0x2854('0x4'));var BPromise=require(_0x2854('0x5'));var logger=require('../logger')(_0x2854('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x2854('0x7')][_0x2854('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x24d302,_0x127feb){return function(){logger['info'](_0x2854('0x9'),_0x24d302[_0x2854('0xa')]);var _0x59d6a5=!![];var _0x180cd1={'tls':{'rejectUnauthorized':![]}};if(_0x24d302[_0x2854('0xb')][_0x2854('0xc')]['service']){_0x180cd1[_0x2854('0xd')]=_0x24d302[_0x2854('0xb')][_0x2854('0xc')][_0x2854('0xd')];}else{_0x180cd1['host']=_0x24d302['MailAccount'][_0x2854('0xc')][_0x2854('0xe')];_0x180cd1[_0x2854('0xf')]=_0x24d302[_0x2854('0xb')][_0x2854('0xc')]['port'];_0x180cd1['secure']=_0x24d302[_0x2854('0xb')][_0x2854('0xc')][_0x2854('0x10')];}if(_0x24d302[_0x2854('0xb')]['Smtp'][_0x2854('0x11')]){_0x180cd1[_0x2854('0x12')]={'user':_0x24d302['MailAccount'][_0x2854('0xc')][_0x2854('0x13')],'pass':_0x24d302[_0x2854('0xb')]['Smtp'][_0x2854('0x14')]};}var _0x45be91={'account':_0x180cd1,'message':{'from':util[_0x2854('0x15')](_0x2854('0x16'),_0x24d302[_0x2854('0xb')]['name'],_0x24d302[_0x2854('0xb')][_0x2854('0xa')]||_0x24d302[_0x2854('0xb')][_0x2854('0xc')][_0x2854('0x13')]),'to':_0x24d302[_0x2854('0xa')],'cc':_0x24d302['cc'],'bcc':_0x24d302[_0x2854('0x17')],'subject':util[_0x2854('0x15')](_0x2854('0x18'),_0x127feb[_0x2854('0x19')],_0x24d302['subtractNumber'],_0x24d302[_0x2854('0x1a')])}};var _0x2e901b=path['join'](__dirname,'../../files/reports');var _0xf6a286=_0x127feb[_0x2854('0x1b')];var _0x39d0b5=util['format'](_0x2854('0x1c'),path['basename'](_0x127feb[_0x2854('0x1b')],path[_0x2854('0x1d')](_0x127feb[_0x2854('0x1b')])),_0x2854('0x1e'));var _0x4994e3=path[_0x2854('0x1f')](_0x2e901b,_0xf6a286);var _0x5abb54=path['join'](_0x2e901b,_0x39d0b5);if(fs[_0x2854('0x20')](_0x4994e3)){_0x127feb['status']=_0x2854('0x21');_0x45be91['message'][_0x2854('0x22')]=[{'filename':_0xf6a286,'path':_0x4994e3}];_0x45be91[_0x2854('0x23')]['text']=util['format'](_0x2854('0x24'),JSON['stringify'](_0x127feb,null,0x2));}else if(fs[_0x2854('0x20')](_0x5abb54)){_0x127feb[_0x2854('0x25')]=_0x2854('0x21');_0x45be91['message']['attachments']=[{'filename':_0x39d0b5,'path':_0x5abb54}];}else{_0x45be91[_0x2854('0x23')][_0x2854('0x26')]=_0x2854('0x27');if(!_0x24d302['sendIfEmpty']){_0x59d6a5=![];logger[_0x2854('0x28')](_0x2854('0x29'));}}if(_0x59d6a5){return client[_0x2854('0x2a')](_0x2854('0x2b'),_0x45be91)[_0x2854('0x2c')](function(_0xe53f7c){if(_0xe53f7c['error']){return logger[_0x2854('0x2d')](_0x2854('0x2e'),JSON[_0x2854('0x2f')](_0xe53f7c));}return logger[_0x2854('0x28')](_0x2854('0x30'));})[_0x2854('0x31')](function(_0x33bee3){return logger['error'](_0x2854('0x2e'),JSON[_0x2854('0x2f')](_0x33bee3));});}};}function handleError(){return function(_0x211f5e){return logger[_0x2854('0x2d')](JSON[_0x2854('0x2f')](_0x211f5e));};}function handleResult(_0x5bd75d){return function(_0xc26950){logger[_0x2854('0x28')]('data',JSON['stringify'](_0xc26950));if(_0x5bd75d[_0x2854('0xb')]&&_0x5bd75d[_0x2854('0xb')]['Smtp']&&!_[_0x2854('0x32')](_0x5bd75d[_0x2854('0xa')])){setTimeout(handleSendEmail(_0x5bd75d,_0xc26950),0x3c*0x3e8);}};}function handleJob(_0x1de35d){return function(){try{if(_[_0x2854('0x32')](_0x1de35d[_0x2854('0x33')])){return logger[_0x2854('0x28')](_0x2854('0x34'));}if(_[_0x2854('0x32')](_0x1de35d[_0x2854('0x1a')])){return logger[_0x2854('0x28')](_0x2854('0x35'));}var _0x3d8ed1={'startDate':moment()[_0x2854('0x36')](_0x1de35d[_0x2854('0x33')],_0x1de35d[_0x2854('0x1a')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x2854('0x15')](_0x2854('0x37')),'type':_0x2854('0x38'),'output':_0x1de35d[_0x2854('0x39')],'name':_0x1de35d[_0x2854('0x19')]};if(!_[_0x2854('0x32')](_0x1de35d['DefaultReportId'])){logger[_0x2854('0x28')]('exec\x20defaul\x20report\x20id:%s',_0x1de35d[_0x2854('0x3a')]);return analyticDefaultReportController[_0x2854('0x3b')]({'id':_0x1de35d['DefaultReportId']},_0x3d8ed1)[_0x2854('0x2c')](handleResult(_0x1de35d))[_0x2854('0x31')](handleError());}if(!_[_0x2854('0x32')](_0x1de35d[_0x2854('0x3c')])){logger['info'](_0x2854('0x3d'),_0x1de35d[_0x2854('0x3c')]);return analyticCustomReportController[_0x2854('0x3b')]({'id':_0x1de35d[_0x2854('0x3c')]},_0x3d8ed1)[_0x2854('0x2c')](handleResult(_0x1de35d))[_0x2854('0x31')](handleError());}}catch(_0x3fa5f7){logger[_0x2854('0x2d')](JSON[_0x2854('0x2f')](_0x3fa5f7));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x367af6){var _0x3a03b={};if(_0x367af6){_0x3a03b['id']=_0x367af6;}return db['Schedule'][_0x2854('0x3e')]({'where':_0x3a03b,'include':[{'model':db[_0x2854('0xb')],'attributes':['id',_0x2854('0x19'),_0x2854('0xa')],'include':[{'model':db[_0x2854('0x3f')],'as':_0x2854('0xc')}]}]})[_0x2854('0x2c')](function(_0xfd3133){var _0x47beb6=_[_0x2854('0x40')](manager[_0x2854('0x41')]);var _0x48b9b5=_[_0x2854('0x42')](_0xfd3133,function(_0x21eb77){return _0x21eb77['id']['toString']();});var _0x538805=_[_0x2854('0x43')](_0xfd3133,function(_0x86ae73){return _0x86ae73['id'][_0x2854('0x44')]();});var _0x2f7931=_0x367af6?_0x48b9b5:_[_0x2854('0x45')](_0x48b9b5,_0x47beb6);var _0x300425=_[_0x2854('0x46')](_0x48b9b5,_0x47beb6);var _0x446e66=_[_0x2854('0x45')](_0x47beb6,_0x48b9b5);var _0x56f7c7;var _0x3bdd9e;for(_0x56f7c7=0x0;_0x56f7c7<_0x446e66[_0x2854('0x47')]&&!_0x367af6;_0x56f7c7+=0x1){_0x3bdd9e=_0x446e66[_0x56f7c7][_0x2854('0x44')]();if(manager[_0x2854('0x48')](_0x3bdd9e)){manager[_0x2854('0x49')](_0x3bdd9e);manager[_0x2854('0x4a')](_0x3bdd9e);logger[_0x2854('0x28')](_0x2854('0x4b'),_0x3bdd9e);}}logger[_0x2854('0x28')](_0x2854('0x4c'),JSON[_0x2854('0x2f')](_0x2f7931));for(_0x56f7c7=0x0;_0x56f7c7<_0x2f7931[_0x2854('0x47')];_0x56f7c7+=0x1){_0x3bdd9e=_0x2f7931[_0x56f7c7][_0x2854('0x44')]();logger[_0x2854('0x28')]('index',_0x3bdd9e);if(_0x367af6){logger[_0x2854('0x28')]('my\x20id',_0x367af6);logger['info'](JSON[_0x2854('0x2f')](_0x538805[_0x3bdd9e]));BPromise[_0x2854('0x4d')]()[_0x2854('0x2c')](handleJob(_0x538805[_0x3bdd9e]));logger['info'](_0x2854('0x4e'),_0x538805[_0x3bdd9e]['name'],_0x538805[_0x3bdd9e]['cron']);}else if(_0x538805[_0x3bdd9e][_0x2854('0x4f')]&&_0x538805[_0x3bdd9e][_0x2854('0x50')]&&moment()['isBetween'](_0x538805[_0x3bdd9e]['startAt'],_0x538805[_0x3bdd9e][_0x2854('0x51')])){manager[_0x2854('0x52')](_0x3bdd9e,_0x538805[_0x3bdd9e][_0x2854('0x4f')],handleJob(_0x538805[_0x3bdd9e]));manager['start'](_0x3bdd9e);logger[_0x2854('0x28')]('add\x20cron',_0x538805[_0x3bdd9e][_0x2854('0x19')],_0x538805[_0x3bdd9e][_0x2854('0x4f')]);}else if(manager[_0x2854('0x48')](_0x3bdd9e)){manager[_0x2854('0x49')](_0x3bdd9e);manager['deleteJob'](_0x3bdd9e);logger[_0x2854('0x28')]('stop\x20cron',_0x538805[_0x3bdd9e][_0x2854('0x19')],_0x538805[_0x3bdd9e][_0x2854('0x4f')]);}}for(_0x56f7c7=0x0,_0x3bdd9e;_0x56f7c7<_0x300425[_0x2854('0x47')]&&!_0x367af6;_0x56f7c7+=0x1){_0x3bdd9e=_0x300425[_0x56f7c7][_0x2854('0x44')]();if(manager['exists'](_0x3bdd9e)){if(_0x538805[_0x3bdd9e][_0x2854('0x4f')]&&_0x538805[_0x3bdd9e][_0x2854('0x50')]&&moment()[_0x2854('0x53')](_0x538805[_0x3bdd9e][_0x2854('0x54')],_0x538805[_0x3bdd9e]['endAt'])){manager[_0x2854('0x55')](_0x3bdd9e,_0x538805[_0x3bdd9e][_0x2854('0x4f')],handleJob(_0x538805[_0x3bdd9e]));logger[_0x2854('0x28')](_0x2854('0x56'),_0x538805[_0x3bdd9e]['name'],_0x538805[_0x3bdd9e][_0x2854('0x4f')]);}else{manager['stop'](_0x3bdd9e);manager['deleteJob'](_0x3bdd9e);logger['info'](_0x2854('0x57'),_0x538805[_0x3bdd9e]['name'],_0x538805[_0x3bdd9e][_0x2854('0x4f')]);}}}})[_0x2854('0x31')](function(_0x1c6046){logger[_0x2854('0x2d')](JSON[_0x2854('0x2f')](_0x1c6046));});}exports['run']=function(_0x24ede5){return getJobs(_0x24ede5);};exports[_0x2854('0x58')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x2378=['index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','deleteJob','update','update\x20cron','util','path','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','user','bcc','name','subtractNumber','join','../../files/reports','savename','basename','extname','zip','existsSync','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','Sent','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','then','error','email\x20sent','catch','stringify','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','MailServerOut','keys','jobs','map','toString','keyBy','intersection','length','exists','stop','delete\x20cron','toRun'];(function(_0x3bb156,_0x333fc3){var _0x310d28=function(_0x538545){while(--_0x538545){_0x3bb156['push'](_0x3bb156['shift']());}};_0x310d28(++_0x333fc3);}(_0x2378,0x128));var _0x8237=function(_0x349f69,_0x2138e5){_0x349f69=_0x349f69-0x0;var _0x174511=_0x2378[_0x349f69];return _0x174511;};'use strict';var fs=require('fs');var util=require(_0x8237('0x0'));var path=require(_0x8237('0x1'));var _=require('lodash');var moment=require(_0x8237('0x2'));var CronJobManager=require(_0x8237('0x3'));var jayson=require(_0x8237('0x4'));var BPromise=require(_0x8237('0x5'));var logger=require(_0x8237('0x6'))(_0x8237('0x7'));var db=require(_0x8237('0x8'))['db'];var analyticCustomReportController=require(_0x8237('0x9'));var analyticDefaultReportController=require(_0x8237('0xa'));var client=jayson['client'][_0x8237('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x252129,_0x3288ad){return function(){logger[_0x8237('0xc')](_0x8237('0xd'),_0x252129[_0x8237('0xe')]);var _0x23b8b9=!![];var _0x23564b={'tls':{'rejectUnauthorized':![]}};if(_0x252129[_0x8237('0xf')][_0x8237('0x10')]['service']){_0x23564b[_0x8237('0x11')]=_0x252129[_0x8237('0xf')]['Smtp']['service'];}else{_0x23564b[_0x8237('0x12')]=_0x252129[_0x8237('0xf')][_0x8237('0x10')]['host'];_0x23564b[_0x8237('0x13')]=_0x252129[_0x8237('0xf')][_0x8237('0x10')][_0x8237('0x13')];_0x23564b['secure']=_0x252129[_0x8237('0xf')][_0x8237('0x10')][_0x8237('0x14')];}if(_0x252129[_0x8237('0xf')][_0x8237('0x10')][_0x8237('0x15')]){_0x23564b[_0x8237('0x16')]={'user':_0x252129['MailAccount'][_0x8237('0x10')]['user'],'pass':_0x252129[_0x8237('0xf')][_0x8237('0x10')][_0x8237('0x17')]};}var _0x274e6d={'account':_0x23564b,'message':{'from':util[_0x8237('0x18')](_0x8237('0x19'),_0x252129[_0x8237('0xf')]['name'],_0x252129[_0x8237('0xf')][_0x8237('0xe')]||_0x252129[_0x8237('0xf')][_0x8237('0x10')][_0x8237('0x1a')]),'to':_0x252129[_0x8237('0xe')],'cc':_0x252129['cc'],'bcc':_0x252129[_0x8237('0x1b')],'subject':util[_0x8237('0x18')]('Report\x20%s\x20last\x20%s\x20%s',_0x3288ad[_0x8237('0x1c')],_0x252129[_0x8237('0x1d')],_0x252129['subtractUnit'])}};var _0x30e08f=path[_0x8237('0x1e')](__dirname,_0x8237('0x1f'));var _0x10a76d=_0x3288ad[_0x8237('0x20')];var _0x32501b=util[_0x8237('0x18')]('%s.%s',path[_0x8237('0x21')](_0x3288ad[_0x8237('0x20')],path[_0x8237('0x22')](_0x3288ad['savename'])),_0x8237('0x23'));var _0x1c4887=path[_0x8237('0x1e')](_0x30e08f,_0x10a76d);var _0x4c27b5=path[_0x8237('0x1e')](_0x30e08f,_0x32501b);if(fs[_0x8237('0x24')](_0x1c4887)){_0x3288ad['status']='Sent';_0x274e6d[_0x8237('0x25')][_0x8237('0x26')]=[{'filename':_0x10a76d,'path':_0x1c4887}];_0x274e6d[_0x8237('0x25')]['text']=util[_0x8237('0x18')](_0x8237('0x27'),JSON['stringify'](_0x3288ad,null,0x2));}else if(fs[_0x8237('0x24')](_0x4c27b5)){_0x3288ad['status']=_0x8237('0x28');_0x274e6d[_0x8237('0x25')][_0x8237('0x26')]=[{'filename':_0x32501b,'path':_0x4c27b5}];}else{_0x274e6d['message'][_0x8237('0x29')]=_0x8237('0x2a');if(!_0x252129[_0x8237('0x2b')]){_0x23b8b9=![];logger[_0x8237('0xc')](_0x8237('0x2c'));}}if(_0x23b8b9){return client[_0x8237('0x2d')](_0x8237('0x2e'),_0x274e6d)[_0x8237('0x2f')](function(_0x14a183){if(_0x14a183[_0x8237('0x30')]){return logger['error']('error\x20mail',JSON['stringify'](_0x14a183));}return logger[_0x8237('0xc')](_0x8237('0x31'));})[_0x8237('0x32')](function(_0x40df5d){return logger[_0x8237('0x30')]('error\x20mail',JSON[_0x8237('0x33')](_0x40df5d));});}};}function handleError(){return function(_0x4c23b1){return logger[_0x8237('0x30')](JSON[_0x8237('0x33')](_0x4c23b1));};}function handleResult(_0x28df53){return function(_0x357438){logger[_0x8237('0xc')](_0x8237('0x34'),JSON['stringify'](_0x357438));if(_0x28df53['MailAccount']&&_0x28df53[_0x8237('0xf')]['Smtp']&&!_['isNil'](_0x28df53[_0x8237('0xe')])){setTimeout(handleSendEmail(_0x28df53,_0x357438),0x3c*0x3e8);}};}function handleJob(_0x22e0c6){return function(){try{if(_[_0x8237('0x35')](_0x22e0c6[_0x8237('0x1d')])){return logger['info'](_0x8237('0x36'));}if(_[_0x8237('0x35')](_0x22e0c6[_0x8237('0x37')])){return logger[_0x8237('0xc')](_0x8237('0x38'));}var _0x1c2d58={'startDate':moment()[_0x8237('0x39')](_0x22e0c6[_0x8237('0x1d')],_0x22e0c6[_0x8237('0x37')])[_0x8237('0x18')](_0x8237('0x3a')),'endDate':moment()['format'](_0x8237('0x3a')),'type':_0x8237('0x3b'),'output':_0x22e0c6[_0x8237('0x3c')],'name':_0x22e0c6[_0x8237('0x1c')]};if(!_[_0x8237('0x35')](_0x22e0c6[_0x8237('0x3d')])){logger[_0x8237('0xc')](_0x8237('0x3e'),_0x22e0c6[_0x8237('0x3d')]);return analyticDefaultReportController[_0x8237('0x3f')]({'id':_0x22e0c6['DefaultReportId']},_0x1c2d58)['then'](handleResult(_0x22e0c6))[_0x8237('0x32')](handleError());}if(!_['isNil'](_0x22e0c6[_0x8237('0x40')])){logger['info'](_0x8237('0x41'),_0x22e0c6[_0x8237('0x40')]);return analyticCustomReportController[_0x8237('0x3f')]({'id':_0x22e0c6['CustomReportId']},_0x1c2d58)[_0x8237('0x2f')](handleResult(_0x22e0c6))['catch'](handleError());}}catch(_0x3f8a02){logger[_0x8237('0x30')](JSON[_0x8237('0x33')](_0x3f8a02));}return logger['info'](_0x8237('0x42'));};}function getJobs(_0x14b02c){var _0x109765={};if(_0x14b02c){_0x109765['id']=_0x14b02c;}return db['Schedule'][_0x8237('0x43')]({'where':_0x109765,'include':[{'model':db[_0x8237('0xf')],'attributes':['id',_0x8237('0x1c'),'email'],'include':[{'model':db[_0x8237('0x44')],'as':'Smtp'}]}]})['then'](function(_0xbb4757){var _0x68dc53=_[_0x8237('0x45')](manager[_0x8237('0x46')]);var _0xf790d4=_[_0x8237('0x47')](_0xbb4757,function(_0x3074ca){return _0x3074ca['id'][_0x8237('0x48')]();});var _0x8102a2=_[_0x8237('0x49')](_0xbb4757,function(_0x4f455b){return _0x4f455b['id'][_0x8237('0x48')]();});var _0x1a826b=_0x14b02c?_0xf790d4:_['difference'](_0xf790d4,_0x68dc53);var _0x2d421e=_[_0x8237('0x4a')](_0xf790d4,_0x68dc53);var _0x2ff023=_['difference'](_0x68dc53,_0xf790d4);var _0x16126f;var _0x5c8130;for(_0x16126f=0x0;_0x16126f<_0x2ff023[_0x8237('0x4b')]&&!_0x14b02c;_0x16126f+=0x1){_0x5c8130=_0x2ff023[_0x16126f][_0x8237('0x48')]();if(manager[_0x8237('0x4c')](_0x5c8130)){manager[_0x8237('0x4d')](_0x5c8130);manager['deleteJob'](_0x5c8130);logger['info'](_0x8237('0x4e'),_0x5c8130);}}logger['info'](_0x8237('0x4f'),JSON[_0x8237('0x33')](_0x1a826b));for(_0x16126f=0x0;_0x16126f<_0x1a826b[_0x8237('0x4b')];_0x16126f+=0x1){_0x5c8130=_0x1a826b[_0x16126f][_0x8237('0x48')]();logger[_0x8237('0xc')](_0x8237('0x50'),_0x5c8130);if(_0x14b02c){logger['info'](_0x8237('0x51'),_0x14b02c);logger['info'](JSON['stringify'](_0x8102a2[_0x5c8130]));BPromise[_0x8237('0x52')]()[_0x8237('0x2f')](handleJob(_0x8102a2[_0x5c8130]));logger[_0x8237('0xc')](_0x8237('0x53'),_0x8102a2[_0x5c8130][_0x8237('0x1c')],_0x8102a2[_0x5c8130][_0x8237('0x54')]);}else if(_0x8102a2[_0x5c8130]['cron']&&_0x8102a2[_0x5c8130][_0x8237('0x55')]&&moment()[_0x8237('0x56')](_0x8102a2[_0x5c8130][_0x8237('0x57')],_0x8102a2[_0x5c8130][_0x8237('0x58')])){manager[_0x8237('0x59')](_0x5c8130,_0x8102a2[_0x5c8130][_0x8237('0x54')],handleJob(_0x8102a2[_0x5c8130]));manager[_0x8237('0x5a')](_0x5c8130);logger[_0x8237('0xc')]('add\x20cron',_0x8102a2[_0x5c8130][_0x8237('0x1c')],_0x8102a2[_0x5c8130][_0x8237('0x54')]);}else if(manager[_0x8237('0x4c')](_0x5c8130)){manager[_0x8237('0x4d')](_0x5c8130);manager[_0x8237('0x5b')](_0x5c8130);logger[_0x8237('0xc')]('stop\x20cron',_0x8102a2[_0x5c8130][_0x8237('0x1c')],_0x8102a2[_0x5c8130][_0x8237('0x54')]);}}for(_0x16126f=0x0,_0x5c8130;_0x16126f<_0x2d421e[_0x8237('0x4b')]&&!_0x14b02c;_0x16126f+=0x1){_0x5c8130=_0x2d421e[_0x16126f][_0x8237('0x48')]();if(manager[_0x8237('0x4c')](_0x5c8130)){if(_0x8102a2[_0x5c8130][_0x8237('0x54')]&&_0x8102a2[_0x5c8130][_0x8237('0x55')]&&moment()[_0x8237('0x56')](_0x8102a2[_0x5c8130][_0x8237('0x57')],_0x8102a2[_0x5c8130][_0x8237('0x58')])){manager[_0x8237('0x5c')](_0x5c8130,_0x8102a2[_0x5c8130][_0x8237('0x54')],handleJob(_0x8102a2[_0x5c8130]));logger[_0x8237('0xc')](_0x8237('0x5d'),_0x8102a2[_0x5c8130]['name'],_0x8102a2[_0x5c8130][_0x8237('0x54')]);}else{manager[_0x8237('0x4d')](_0x5c8130);manager['deleteJob'](_0x5c8130);logger[_0x8237('0xc')]('stop\x20cron',_0x8102a2[_0x5c8130]['name'],_0x8102a2[_0x5c8130][_0x8237('0x54')]);}}}})[_0x8237('0x32')](function(_0x1e38a1){logger[_0x8237('0x30')](JSON[_0x8237('0x33')](_0x1e38a1));});}exports['run']=function(_0x2fead0){return getJobs(_0x2fead0);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 94a161c..0f60d26 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 _0xfb37=['transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','all','lodash','util','bluebird','../../mysqldb','TranscribeService','Comprehend','detectSentiment','substring','info','format','transcribeName','data1','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','language','bucket','Sentiment\x20Analysis\x20not\x20configured','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Transcript\x20not\x20available','Negative','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available'];(function(_0xdf666a,_0x177888){var _0x426cc0=function(_0x48e012){while(--_0x48e012){_0xdf666a['push'](_0xdf666a['shift']());}};_0x426cc0(++_0x177888);}(_0xfb37,0xd9));var _0x7fb3=function(_0x22093a,_0xa7acf1){_0x22093a=_0x22093a-0x0;var _0x2f4989=_0xfb37[_0x22093a];return _0x2f4989;};var _=require(_0x7fb3('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require(_0x7fb3('0x1'));var BPromise=require(_0x7fb3('0x2'));var db=require(_0x7fb3('0x3'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x35a297,_0x1ebfa9,_0x26126e,_0x2fbafd){return new Promise(function(_0x89b90c,_0x5ab2cd){var _0x1241c9=new AWS[(_0x7fb3('0x4'))]({'accessKeyId':_0x1ebfa9,'secretAccessKey':_0x35a297,'region':_0x26126e});_0x1241c9['getTranscriptionJob']({'TranscriptionJobName':_0x2fbafd},function(_0x4d1758,_0x4cf6b5){if(_0x4d1758){return _0x5ab2cd(_0x4d1758);}else{return _0x89b90c(_0x4cf6b5);}});});}function sentiment(_0x458b07,_0xce0779,_0x5bd4df,_0x195692,_0x59bc02){return new Promise(function(_0x1d005d,_0x3c6c24){var _0x527d6f=new AWS[(_0x7fb3('0x5'))]({'accessKeyId':_0xce0779,'secretAccessKey':_0x458b07,'region':_0x5bd4df});_0x527d6f[_0x7fb3('0x6')]({'Text':_0x195692,'LanguageCode':_0x59bc02[_0x7fb3('0x7')](0x0,0x2)},function(_0x2899c2,_0x506e9a){if(_0x2899c2){return _0x3c6c24(_0x2899c2);}else{return _0x1d005d(_0x506e9a);}});});}function checkTranscribeJob(_0x790217,_0x4f4612,_0x1f946d){var _0x3ab550;return new BPromise(function(_0x411ee0,_0x144733){logger[_0x7fb3('0x8')](util[_0x7fb3('0x9')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x790217['id'],_0x790217[_0x7fb3('0xa')]));return getTranscriptionJob(_0x1f946d[_0x7fb3('0xb')],_0x1f946d['data2'],_0x4f4612['transcribeRegion'],_0x790217[_0x7fb3('0xa')])[_0x7fb3('0xc')](function(_0x1f46a0){logger[_0x7fb3('0x8')](util[_0x7fb3('0x9')](_0x7fb3('0xd'),_0x790217['id'],_0x790217[_0x7fb3('0xa')],_0x1f46a0[_0x7fb3('0xe')][_0x7fb3('0xf')]));if(!_0x790217['fileText']){switch(_0x1f46a0[_0x7fb3('0xe')][_0x7fb3('0xf')]){case _0x7fb3('0x10'):var _0x4bc0df={'transcribeStatus':_0x1f46a0[_0x7fb3('0xe')]['TranscriptionJobStatus'],'fileUri':_0x1f46a0[_0x7fb3('0xe')][_0x7fb3('0x11')][_0x7fb3('0x12')]};logger[_0x7fb3('0x8')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x790217['id']));return rp({'uri':_0x1f46a0[_0x7fb3('0xe')][_0x7fb3('0x11')]['TranscriptFileUri'],'json':!![]})[_0x7fb3('0xc')](function(_0x232da1){logger[_0x7fb3('0x8')](util[_0x7fb3('0x9')](_0x7fb3('0x13'),_0x790217['id']));if(_0x232da1&&_0x232da1['results']&&_0x232da1[_0x7fb3('0x14')]['transcripts']&&_0x232da1[_0x7fb3('0x14')][_0x7fb3('0x15')][_0x7fb3('0x16')]){_0x4bc0df['fileText']='';for(var _0x287757=0x0;_0x287757<_0x232da1[_0x7fb3('0x14')][_0x7fb3('0x15')]['length'];_0x287757++){_0x4bc0df[_0x7fb3('0x17')]+=_0x232da1[_0x7fb3('0x14')][_0x7fb3('0x15')][_0x287757][_0x7fb3('0x18')]+'';}}return _0x790217[_0x7fb3('0x19')](_0x4bc0df);})[_0x7fb3('0xc')](function(){logger[_0x7fb3('0x8')](util[_0x7fb3('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x790217['id']));if(!_0x790217[_0x7fb3('0x1a')]){throw new db[(_0x7fb3('0x1b'))][(_0x7fb3('0x1c'))](_0x7fb3('0x1d'));}if(!_0x4f4612[_0x7fb3('0x1e')]||!_0x4f4612['sentimentAccountId']||!_0x4f4612['sentimentRegion']||!_0x4f4612[_0x7fb3('0x1f')]||!_0x4f4612[_0x7fb3('0x20')]){throw new db['Sequelize'][(_0x7fb3('0x1c'))](_0x7fb3('0x21'));}if(!_0x4bc0df[_0x7fb3('0x17')]){throw new Error('Transcript\x20not\x20available');}if(_0x4f4612[_0x7fb3('0x22')]===_0x1f946d['id']){return _0x1f946d;}else{return db[_0x7fb3('0x23')][_0x7fb3('0x24')]({'where':{'id':_settings[_0x7fb3('0x22')]}});}})[_0x7fb3('0xc')](function(_0x2355f){if(!_0x2355f){throw new db[(_0x7fb3('0x1b'))][(_0x7fb3('0x1c'))](_0x7fb3('0x25'));}if(!_0x2355f[_0x7fb3('0xb')]||!_0x2355f[_0x7fb3('0x26')]){throw new db['Sequelize']['ValidationError'](_0x7fb3('0x27'));}_0x3ab550=_0x2355f;logger['info'](util[_0x7fb3('0x9')](_0x7fb3('0x28'),_0x790217['id']));return sentiment(_0x3ab550[_0x7fb3('0xb')],_0x3ab550[_0x7fb3('0x26')],_0x4f4612[_0x7fb3('0x29')],_0x4bc0df[_0x7fb3('0x17')],_0x4f4612[_0x7fb3('0x1f')]);})[_0x7fb3('0xc')](function(_0x4ef5d7){logger['info'](util['format'](_0x7fb3('0x2a'),_0x790217['id']));return _0x790217[_0x7fb3('0x19')]({'sentiment':_0x4ef5d7[_0x7fb3('0x2b')],'sPositive':_0x4ef5d7[_0x7fb3('0x2c')][_0x7fb3('0x2d')],'sNegative':_0x4ef5d7[_0x7fb3('0x2c')]['Negative'],'sMixed':_0x4ef5d7['SentimentScore'][_0x7fb3('0x2e')],'sNeutral':_0x4ef5d7[_0x7fb3('0x2c')][_0x7fb3('0x2f')]});})[_0x7fb3('0xc')](function(){logger[_0x7fb3('0x8')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x790217['id']));_0x411ee0();});case'FAILED':return _0x790217[_0x7fb3('0x19')]({'transcribeStatus':'FAILED','failureReason':_0x1f46a0[_0x7fb3('0xe')]['FailureReason']})[_0x7fb3('0xc')](function(){logger[_0x7fb3('0x8')](util[_0x7fb3('0x9')](_0x7fb3('0x30'),_0x790217['id']));_0x411ee0();});default:logger[_0x7fb3('0x8')](util[_0x7fb3('0x9')](_0x7fb3('0x31'),_0x790217['id']));break;}}else{return BPromise[_0x7fb3('0x32')]()[_0x7fb3('0xc')](function(){if(!_0x790217['tempSentiment']){throw new db[(_0x7fb3('0x1b'))][(_0x7fb3('0x1c'))](_0x7fb3('0x1d'));}if(!_0x4f4612[_0x7fb3('0x1e')]||!_0x4f4612[_0x7fb3('0x22')]||!_0x4f4612['sentimentRegion']||!_0x4f4612['language']||!_0x4f4612[_0x7fb3('0x20')]){throw new db[(_0x7fb3('0x1b'))][(_0x7fb3('0x1c'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x790217[_0x7fb3('0x17')]){throw new Error(_0x7fb3('0x33'));}if(_0x4f4612[_0x7fb3('0x22')]===_0x1f946d['id']){return _0x1f946d;}else{return db[_0x7fb3('0x23')][_0x7fb3('0x24')]({'where':{'id':_settings[_0x7fb3('0x22')]}});}})[_0x7fb3('0xc')](function(_0x12d477){if(!_0x12d477){throw new db[(_0x7fb3('0x1b'))]['ValidationError'](_0x7fb3('0x25'));}if(!_0x12d477[_0x7fb3('0xb')]||!_0x12d477[_0x7fb3('0x26')]){throw new db[(_0x7fb3('0x1b'))][(_0x7fb3('0x1c'))](_0x7fb3('0x27'));}_0x3ab550=_0x12d477;logger[_0x7fb3('0x8')](util['format'](_0x7fb3('0x28'),_0x790217['id']));return sentiment(_0x3ab550['data1'],_0x3ab550[_0x7fb3('0x26')],_0x4f4612[_0x7fb3('0x29')],_0x790217[_0x7fb3('0x17')],_0x4f4612[_0x7fb3('0x1f')]);})[_0x7fb3('0xc')](function(_0x22aa4e){logger[_0x7fb3('0x8')](util['format'](_0x7fb3('0x2a'),_0x790217['id']));return _0x790217[_0x7fb3('0x19')]({'sentiment':_0x22aa4e[_0x7fb3('0x2b')],'sPositive':_0x22aa4e[_0x7fb3('0x2c')]['Positive'],'sNegative':_0x22aa4e['SentimentScore'][_0x7fb3('0x34')],'sMixed':_0x22aa4e[_0x7fb3('0x2c')][_0x7fb3('0x2e')],'sNeutral':_0x22aa4e[_0x7fb3('0x2c')][_0x7fb3('0x2f')],'transcribeStatus':'COMPLETED'});})[_0x7fb3('0xc')](function(){logger[_0x7fb3('0x8')](util[_0x7fb3('0x9')](_0x7fb3('0x30'),_0x790217['id']));_0x411ee0();});}})[_0x7fb3('0x35')](function(_0x32bd8f){if(_0x32bd8f){if(!_0x32bd8f[_0x7fb3('0x36')]||_0x32bd8f[_0x7fb3('0x36')]!==_0x7fb3('0x37')){logger[_0x7fb3('0x38')](util[_0x7fb3('0x9')](_0x7fb3('0x39'),_0x790217['id']),util[_0x7fb3('0x3a')](_0x32bd8f,{'showHidden':![],'depth':null}));}}_0x411ee0();});});}function checkTranscribe(){var _0x3037bb;var _0x329ea3;var _0x4007fa;return db[_0x7fb3('0x3b')]['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x300c0a){if(!_0x300c0a||!_0x300c0a[_0x7fb3('0x16')]){throw new db['Sequelize'][(_0x7fb3('0x1c'))](_0x7fb3('0x3c'));}_0x3037bb=_0x300c0a;return db[_0x7fb3('0x3d')][_0x7fb3('0x24')]({'where':{'id':0x1}});})[_0x7fb3('0xc')](function(_0x5e0ccd){if(!_0x5e0ccd){throw new db[(_0x7fb3('0x1b'))]['ValidationError'](_0x7fb3('0x3e'));}_0x329ea3=_0x5e0ccd;if(!_0x329ea3[_0x7fb3('0x3f')]||!_0x329ea3[_0x7fb3('0x40')]||!_0x329ea3[_0x7fb3('0x41')]||!_0x329ea3[_0x7fb3('0x1f')]||!_0x329ea3['bucket']){throw new db[(_0x7fb3('0x1b'))]['ValidationError'](_0x7fb3('0x42'));}return db[_0x7fb3('0x23')][_0x7fb3('0x24')]({'where':{'id':_0x329ea3[_0x7fb3('0x40')]}});})[_0x7fb3('0xc')](function(_0x3129f6){if(!_0x3129f6){throw new db[(_0x7fb3('0x1b'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x3129f6[_0x7fb3('0xb')]||!_0x3129f6['data2']){throw new db[(_0x7fb3('0x1b'))][(_0x7fb3('0x1c'))](_0x7fb3('0x27'));}_0x4007fa=_0x3129f6;var _0x543153=[];_0x3037bb[_0x7fb3('0x43')](function(_0x334fe7){_0x543153[_0x7fb3('0x44')](checkTranscribeJob(_0x334fe7,_0x329ea3,_0x4007fa));});return BPromise[_0x7fb3('0x45')](_0x543153);})[_0x7fb3('0x35')](function(_0x2a7f09){if(_0x2a7f09){if(!_0x2a7f09[_0x7fb3('0x36')]||_0x2a7f09[_0x7fb3('0x36')]!==_0x7fb3('0x37')){logger[_0x7fb3('0x38')](util[_0x7fb3('0x3a')](_0x2a7f09,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x529c=['catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','transcribe','Transcribe\x20not\x20configured','transcribeAccountId','Cloud\x20Provider\x20not\x20available','forEach','push','all','inspect','start','aws-sdk','../../mysqldb','../../config/logger','TranscribeService','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','TranscriptionJob','COMPLETED','TranscriptFileUri','Transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','data1','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','language','bucket','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available'];(function(_0x44eea1,_0x2c0d61){var _0x27efc0=function(_0x19c410){while(--_0x19c410){_0x44eea1['push'](_0x44eea1['shift']());}};_0x27efc0(++_0x2c0d61);}(_0x529c,0x16f));var _0xc529=function(_0x55ed93,_0x21a2f4){_0x55ed93=_0x55ed93-0x0;var _0x471fb1=_0x529c[_0x55ed93];return _0x471fb1;};var _=require('lodash');var AWS=require(_0xc529('0x0'));var rp=require('request-promise');var util=require('util');var BPromise=require('bluebird');var db=require(_0xc529('0x1'))['db'];var logger=require(_0xc529('0x2'))('transcribe');function getTranscriptionJob(_0x3788c2,_0x289000,_0x49b4cb,_0x19980b){return new Promise(function(_0x9459b8,_0x29ea47){var _0x53d0bd=new AWS[(_0xc529('0x3'))]({'accessKeyId':_0x289000,'secretAccessKey':_0x3788c2,'region':_0x49b4cb});_0x53d0bd['getTranscriptionJob']({'TranscriptionJobName':_0x19980b},function(_0x349621,_0x31b9e0){if(_0x349621){return _0x29ea47(_0x349621);}else{return _0x9459b8(_0x31b9e0);}});});}function sentiment(_0x367d68,_0x557f9a,_0x3111c0,_0x423845,_0xad5d25){return new Promise(function(_0x20211e,_0x390344){var _0x50a757=new AWS[(_0xc529('0x4'))]({'accessKeyId':_0x557f9a,'secretAccessKey':_0x367d68,'region':_0x3111c0});_0x50a757[_0xc529('0x5')]({'Text':_0x423845,'LanguageCode':_0xad5d25[_0xc529('0x6')](0x0,0x2)},function(_0x58c635,_0x4d1232){if(_0x58c635){return _0x390344(_0x58c635);}else{return _0x20211e(_0x4d1232);}});});}function checkTranscribeJob(_0x46375d,_0x2f497e,_0x27cb5d){var _0x4bd758;return new BPromise(function(_0x25b8f6,_0x560bc4){logger[_0xc529('0x7')](util[_0xc529('0x8')](_0xc529('0x9'),_0x46375d['id'],_0x46375d[_0xc529('0xa')]));return getTranscriptionJob(_0x27cb5d['data1'],_0x27cb5d[_0xc529('0xb')],_0x2f497e[_0xc529('0xc')],_0x46375d['transcribeName'])['then'](function(_0x4c0012){logger['info'](util[_0xc529('0x8')](_0xc529('0xd'),_0x46375d['id'],_0x46375d['transcribeName'],_0x4c0012['TranscriptionJob'][_0xc529('0xe')]));if(!_0x46375d['fileText']){switch(_0x4c0012[_0xc529('0xf')][_0xc529('0xe')]){case _0xc529('0x10'):var _0x2805d3={'transcribeStatus':_0x4c0012[_0xc529('0xf')][_0xc529('0xe')],'fileUri':_0x4c0012[_0xc529('0xf')]['Transcript'][_0xc529('0x11')]};logger[_0xc529('0x7')](util[_0xc529('0x8')]('[RECORDING:%d]\x20Get\x20transcript',_0x46375d['id']));return rp({'uri':_0x4c0012[_0xc529('0xf')][_0xc529('0x12')]['TranscriptFileUri'],'json':!![]})[_0xc529('0x13')](function(_0x362068){logger[_0xc529('0x7')](util['format'](_0xc529('0x14'),_0x46375d['id']));if(_0x362068&&_0x362068[_0xc529('0x15')]&&_0x362068[_0xc529('0x15')]['transcripts']&&_0x362068[_0xc529('0x15')][_0xc529('0x16')][_0xc529('0x17')]){_0x2805d3['fileText']='';for(var _0x376c80=0x0;_0x376c80<_0x362068[_0xc529('0x15')][_0xc529('0x16')][_0xc529('0x17')];_0x376c80++){_0x2805d3[_0xc529('0x18')]+=_0x362068['results'][_0xc529('0x16')][_0x376c80]['transcript']+'';}}return _0x46375d[_0xc529('0x19')](_0x2805d3);})[_0xc529('0x13')](function(){logger[_0xc529('0x7')](util[_0xc529('0x8')](_0xc529('0x1a'),_0x46375d['id']));if(!_0x46375d['tempSentiment']){throw new db[(_0xc529('0x1b'))][(_0xc529('0x1c'))](_0xc529('0x1d'));}if(!_0x2f497e[_0xc529('0x1e')]||!_0x2f497e[_0xc529('0x1f')]||!_0x2f497e['sentimentRegion']||!_0x2f497e['language']||!_0x2f497e['bucket']){throw new db[(_0xc529('0x1b'))]['ValidationError'](_0xc529('0x20'));}if(!_0x2805d3[_0xc529('0x18')]){throw new Error(_0xc529('0x21'));}if(_0x2f497e[_0xc529('0x1f')]===_0x27cb5d['id']){return _0x27cb5d;}else{return db[_0xc529('0x22')][_0xc529('0x23')]({'where':{'id':_settings[_0xc529('0x1f')]}});}})[_0xc529('0x13')](function(_0x2165d5){if(!_0x2165d5){throw new db[(_0xc529('0x1b'))][(_0xc529('0x1c'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2165d5[_0xc529('0x24')]||!_0x2165d5[_0xc529('0xb')]){throw new db[(_0xc529('0x1b'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x4bd758=_0x2165d5;logger[_0xc529('0x7')](util[_0xc529('0x8')](_0xc529('0x25'),_0x46375d['id']));return sentiment(_0x4bd758[_0xc529('0x24')],_0x4bd758['data2'],_0x2f497e[_0xc529('0x26')],_0x2805d3[_0xc529('0x18')],_0x2f497e['language']);})[_0xc529('0x13')](function(_0x122ae7){logger[_0xc529('0x7')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x46375d['id']));return _0x46375d['update']({'sentiment':_0x122ae7[_0xc529('0x27')],'sPositive':_0x122ae7[_0xc529('0x28')][_0xc529('0x29')],'sNegative':_0x122ae7[_0xc529('0x28')][_0xc529('0x2a')],'sMixed':_0x122ae7[_0xc529('0x28')][_0xc529('0x2b')],'sNeutral':_0x122ae7[_0xc529('0x28')][_0xc529('0x2c')]});})[_0xc529('0x13')](function(){logger[_0xc529('0x7')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x46375d['id']));_0x25b8f6();});case'FAILED':return _0x46375d[_0xc529('0x19')]({'transcribeStatus':'FAILED','failureReason':_0x4c0012[_0xc529('0xf')][_0xc529('0x2d')]})[_0xc529('0x13')](function(){logger['info'](util['format'](_0xc529('0x1a'),_0x46375d['id']));_0x25b8f6();});default:logger['info'](util[_0xc529('0x8')](_0xc529('0x2e'),_0x46375d['id']));break;}}else{return BPromise[_0xc529('0x2f')]()[_0xc529('0x13')](function(){if(!_0x46375d[_0xc529('0x30')]){throw new db['Sequelize'][(_0xc529('0x1c'))](_0xc529('0x1d'));}if(!_0x2f497e['sentiment']||!_0x2f497e['sentimentAccountId']||!_0x2f497e[_0xc529('0x26')]||!_0x2f497e[_0xc529('0x31')]||!_0x2f497e[_0xc529('0x32')]){throw new db[(_0xc529('0x1b'))][(_0xc529('0x1c'))](_0xc529('0x20'));}if(!_0x46375d[_0xc529('0x18')]){throw new Error(_0xc529('0x21'));}if(_0x2f497e[_0xc529('0x1f')]===_0x27cb5d['id']){return _0x27cb5d;}else{return db[_0xc529('0x22')]['findOne']({'where':{'id':_settings[_0xc529('0x1f')]}});}})['then'](function(_0x393c47){if(!_0x393c47){throw new db[(_0xc529('0x1b'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x393c47[_0xc529('0x24')]||!_0x393c47[_0xc529('0xb')]){throw new db['Sequelize'][(_0xc529('0x1c'))](_0xc529('0x33'));}_0x4bd758=_0x393c47;logger[_0xc529('0x7')](util['format'](_0xc529('0x25'),_0x46375d['id']));return sentiment(_0x4bd758['data1'],_0x4bd758[_0xc529('0xb')],_0x2f497e[_0xc529('0x26')],_0x46375d['fileText'],_0x2f497e[_0xc529('0x31')]);})[_0xc529('0x13')](function(_0x554fb9){logger[_0xc529('0x7')](util['format'](_0xc529('0x34'),_0x46375d['id']));return _0x46375d[_0xc529('0x19')]({'sentiment':_0x554fb9[_0xc529('0x27')],'sPositive':_0x554fb9['SentimentScore'][_0xc529('0x29')],'sNegative':_0x554fb9['SentimentScore']['Negative'],'sMixed':_0x554fb9[_0xc529('0x28')]['Mixed'],'sNeutral':_0x554fb9[_0xc529('0x28')]['Neutral'],'transcribeStatus':_0xc529('0x10')});})[_0xc529('0x13')](function(){logger['info'](util['format'](_0xc529('0x1a'),_0x46375d['id']));_0x25b8f6();});}})[_0xc529('0x35')](function(_0x316f3b){if(_0x316f3b){if(!_0x316f3b[_0xc529('0x36')]||_0x316f3b['name']!==_0xc529('0x37')){logger[_0xc529('0x38')](util[_0xc529('0x8')](_0xc529('0x39'),_0x46375d['id']),util['inspect'](_0x316f3b,{'showHidden':![],'depth':null}));}}_0x25b8f6();});});}function checkTranscribe(){var _0x515202;var _0x422da3;var _0x1b3727;return db['VoiceRecording']['findAll']({'where':{'transcribeStatus':_0xc529('0x3a')}})['then'](function(_0x1d4be4){if(!_0x1d4be4||!_0x1d4be4[_0xc529('0x17')]){throw new db[(_0xc529('0x1b'))]['ValidationError'](_0xc529('0x3b'));}_0x515202=_0x1d4be4;return db[_0xc529('0x3c')][_0xc529('0x23')]({'where':{'id':0x1}});})[_0xc529('0x13')](function(_0x13c6c9){if(!_0x13c6c9){throw new db[(_0xc529('0x1b'))][(_0xc529('0x1c'))]('Settings\x20not\x20available');}_0x422da3=_0x13c6c9;if(!_0x422da3[_0xc529('0x3d')]||!_0x422da3['transcribeAccountId']||!_0x422da3['transcribeRegion']||!_0x422da3['language']||!_0x422da3[_0xc529('0x32')]){throw new db['Sequelize'][(_0xc529('0x1c'))](_0xc529('0x3e'));}return db['CloudProvider']['findOne']({'where':{'id':_0x422da3[_0xc529('0x3f')]}});})[_0xc529('0x13')](function(_0x34a804){if(!_0x34a804){throw new db[(_0xc529('0x1b'))]['ValidationError'](_0xc529('0x40'));}if(!_0x34a804['data1']||!_0x34a804['data2']){throw new db['Sequelize'][(_0xc529('0x1c'))](_0xc529('0x33'));}_0x1b3727=_0x34a804;var _0x4cd976=[];_0x515202[_0xc529('0x41')](function(_0x3de90d){_0x4cd976[_0xc529('0x42')](checkTranscribeJob(_0x3de90d,_0x422da3,_0x1b3727));});return BPromise[_0xc529('0x43')](_0x4cd976);})['catch'](function(_0x224d86){if(_0x224d86){if(!_0x224d86[_0xc529('0x36')]||_0x224d86[_0xc529('0x36')]!==_0xc529('0x37')){logger[_0xc529('0x38')](util[_0xc529('0x44')](_0x224d86,{'showHidden':![],'depth':null}));}}});}exports[_0xc529('0x45')]=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 0f794fb..1d564c5 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x69b6=['contacts1','CmHopper','bulkCreate','log','hopper1','CmContact','hopper2','catch','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','destroy','then','finished\x20populating'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x69b6,0xf2));var _0x669b=function(_0x2ea5d6,_0x2ef3e7){_0x2ea5d6=_0x2ea5d6-0x0;var _0x20dcb3=_0x69b6[_0x2ea5d6];return _0x20dcb3;};'use strict';var util=require('util');var db=require(_0x669b('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x669b('0x1')]({'id':i,'firstName':_0x669b('0x2')+i,'lastName':_0x669b('0x3')+i,'phone':0xf879fb460+i,'email':_0x669b('0x4')+i+_0x669b('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x669b('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x669b('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x669b('0x6')](),'updatedAt':Date[_0x669b('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x669b('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x669b('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x669b('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x669b('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x669b('0x6')](),'updatedAt':Date[_0x669b('0x6')]()});}db['CmContact'][_0x669b('0x7')]({'where':{}})[_0x669b('0x8')](function(){return db['CmContact']['bulkCreate'](contacts);})[_0x669b('0x8')](function(){console['log'](_0x669b('0x9'),_0x669b('0xa'));return db[_0x669b('0xb')][_0x669b('0x7')]({'where':{}});})['then'](function(){return db[_0x669b('0xb')][_0x669b('0xc')](hopper);})[_0x669b('0x8')](function(){console[_0x669b('0xd')](_0x669b('0x9'),_0x669b('0xe'));return db[_0x669b('0xf')][_0x669b('0xc')](contacts2);})[_0x669b('0x8')](function(){console[_0x669b('0xd')]('finished\x20populating','contacts2');return db[_0x669b('0xb')]['bulkCreate'](hopper2);})['then'](function(){console[_0x669b('0xd')](_0x669b('0x9'),_0x669b('0x10'));})[_0x669b('0x11')](function(_0x502d56){console['log'](_0x502d56);}); \ No newline at end of file +var _0xd43a=['destroy','then','CmContact','log','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','innocenzo.biondo','@xcally.com','now','Innocenzo'];(function(_0x351e8e,_0x2fe0af){var _0x641a43=function(_0x1f6529){while(--_0x1f6529){_0x351e8e['push'](_0x351e8e['shift']());}};_0x641a43(++_0x2fe0af);}(_0xd43a,0x19b));var _0xad43=function(_0x112893,_0x247913){_0x112893=_0x112893-0x0;var _0x5ea517=_0xd43a[_0x112893];return _0x5ea517;};'use strict';var util=require(_0xad43('0x0'));var db=require(_0xad43('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xad43('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xad43('0x3')+i+_0xad43('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xad43('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xad43('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xad43('0x5')](),'updatedAt':Date[_0xad43('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xad43('0x2')]({'id':i,'firstName':_0xad43('0x6')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xad43('0x3')+i+_0xad43('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xad43('0x5')](),'updatedAt':Date[_0xad43('0x5')]()});}db['CmContact'][_0xad43('0x7')]({'where':{}})[_0xad43('0x8')](function(){return db[_0xad43('0x9')]['bulkCreate'](contacts);})[_0xad43('0x8')](function(){console[_0xad43('0xa')](_0xad43('0xb'),_0xad43('0xc'));return db[_0xad43('0xd')][_0xad43('0x7')]({'where':{}});})[_0xad43('0x8')](function(){return db['CmHopper'][_0xad43('0xe')](hopper);})[_0xad43('0x8')](function(){console['log'](_0xad43('0xb'),_0xad43('0xf'));return db['CmContact'][_0xad43('0xe')](contacts2);})[_0xad43('0x8')](function(){console['log']('finished\x20populating',_0xad43('0x10'));return db[_0xad43('0xd')]['bulkCreate'](hopper2);})['then'](function(){console[_0xad43('0xa')]('finished\x20populating',_0xad43('0x11'));})[_0xad43('0x12')](function(_0xab97ee){console['log'](_0xab97ee);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index ac9647f..b4d69ca 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c28=['util','../mysqldb','push','format','%s%s','agent','udp','wss','all','ulaw','yes','actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch'];(function(_0x204710,_0x5365d){var _0x5e48fb=function(_0x39ece9){while(--_0x39ece9){_0x204710['push'](_0x204710['shift']());}};_0x5e48fb(++_0x5365d);}(_0x5c28,0x18c));var _0x85c2=function(_0xff11d1,_0x46481b){_0xff11d1=_0xff11d1-0x0;var _0x4b2202=_0x5c28[_0xff11d1];return _0x4b2202;};'use strict';var util=require(_0x85c2('0x0'));var db=require(_0x85c2('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x85c2('0x2')]({'name':util[_0x85c2('0x3')]('%s%s','agent',i),'fullname':util[_0x85c2('0x3')](_0x85c2('0x4'),'agent',i),'email':util[_0x85c2('0x3')]('%s%s@xcally.com',_0x85c2('0x5'),i),'role':_0x85c2('0x5'),'password':'password','internal':0xfa0+i,'type':'friend','transport':[_0x85c2('0x6'),'ws',_0x85c2('0x7')],'disallow':[_0x85c2('0x8')],'allow':[_0x85c2('0x9')],'defaultuser':util[_0x85c2('0x3')]('%s%s',_0x85c2('0x5'),i),'encryption':'yes','avpf':_0x85c2('0xa'),'force_avp':'yes','icesupport':_0x85c2('0xa'),'dtlsenable':_0x85c2('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x85c2('0xb'),'callerid':util['format'](_0x85c2('0xc'),util[_0x85c2('0x3')]('%s%s',_0x85c2('0x5'),i),0xfa0+i)});}db[_0x85c2('0xd')]['bulkCreate'](users)[_0x85c2('0xe')](function(){console[_0x85c2('0xf')](_0x85c2('0x10'));})[_0x85c2('0x11')](function(_0xbb5fa){console['log'](_0xbb5fa);}); \ No newline at end of file +var _0x89f3=['log','add\x20user','push','format','agent','%s%s','%s%s@xcally.com','friend','wss','yes','actpass','\x22%s\x22\x20<%s>','User','bulkCreate'];(function(_0xe5742c,_0x11503e){var _0x3db329=function(_0x2afb66){while(--_0x2afb66){_0xe5742c['push'](_0xe5742c['shift']());}};_0x3db329(++_0x11503e);}(_0x89f3,0x160));var _0x389f=function(_0x4442d3,_0x40651a){_0x4442d3=_0x4442d3-0x0;var _0x55ab00=_0x89f3[_0x4442d3];return _0x55ab00;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x389f('0x0')]({'name':util[_0x389f('0x1')]('%s%s',_0x389f('0x2'),i),'fullname':util[_0x389f('0x1')](_0x389f('0x3'),'agent',i),'email':util[_0x389f('0x1')](_0x389f('0x4'),_0x389f('0x2'),i),'role':'agent','password':'password','internal':0xfa0+i,'type':_0x389f('0x5'),'transport':['udp','ws',_0x389f('0x6')],'disallow':['all'],'allow':['ulaw'],'defaultuser':util[_0x389f('0x1')]('%s%s',_0x389f('0x2'),i),'encryption':_0x389f('0x7'),'avpf':_0x389f('0x7'),'force_avp':_0x389f('0x7'),'icesupport':'yes','dtlsenable':_0x389f('0x7'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x389f('0x8'),'callerid':util[_0x389f('0x1')](_0x389f('0x9'),util['format'](_0x389f('0x3'),_0x389f('0x2'),i),0xfa0+i)});}db[_0x389f('0xa')][_0x389f('0xb')](users)['then'](function(){console[_0x389f('0xc')](_0x389f('0xd'));})['catch'](function(_0x29785c){console[_0x389f('0xc')](_0x29785c);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 659962b..754ae2c 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb921=['mail','openchannel','telephone:%s','trunk:%s','leave','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','log','join','default','connection','setMaxListeners','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','type','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','telephone','where','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','voice:inbound','voice:outbound','include','push','Trunk','user','VoiceQueue','ChatQueue','FaxQueue','SmsQueues','SmsQueue','MailQueue','Campaign','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','all','chat','fax','sms'];(function(_0xcfd89f,_0x106e8f){var _0x59acd4=function(_0x2e187c){while(--_0x2e187c){_0xcfd89f['push'](_0xcfd89f['shift']());}};_0x59acd4(++_0x106e8f);}(_0xb921,0xd6));var _0x1b92=function(_0x6aaf7a,_0x2ddf35){_0x6aaf7a=_0x6aaf7a-0x0;var _0x522e20=_0xb921[_0x6aaf7a];return _0x522e20;};'use strict';var _=require(_0x1b92('0x0'));var util=require(_0x1b92('0x1'));var BPromise=require(_0x1b92('0x2'));var db=require(_0x1b92('0x3'))['db'];var config=require(_0x1b92('0x4'));var queryQueues={'attributes':['id',_0x1b92('0x5')],'include':[{'as':_0x1b92('0x6'),'model':db[_0x1b92('0x7')],'attributes':['id',_0x1b92('0x5'),_0x1b92('0x8')],'raw':!![],'where':{'role':_0x1b92('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x1b92('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x1b92('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x1b92('0x5')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x1b92('0xa')],'where':{'type':_0x1b92('0xb')}};function getAssociatedResources(_0x26e0ea,_0x4a3c2e,_0x16e030){return db[_0x1b92('0xc')]['findOne']({'where':{'name':_0x26e0ea,'userProfileId':_0x4a3c2e},'raw':!![]})[_0x1b92('0xd')](function(_0xb14de7){if(_0xb14de7){if(_0xb14de7[_0x1b92('0xe')]){switch(_0x26e0ea){case _0x1b92('0xf'):case _0x1b92('0x10'):case _0x1b92('0x11'):case'SmsQueues':case _0x1b92('0x12'):case'OpenchannelQueues':return db[_0x16e030][_0x1b92('0x13')](queryQueues);case'Telephones':return db[_0x16e030][_0x1b92('0x13')](queryTelephones);case _0x1b92('0x14'):return db[_0x16e030][_0x1b92('0x13')](queryTrunks);case _0x1b92('0x15'):return db[_0x16e030]['findAll'](queryCampaigns);}}else{return db[_0x1b92('0x16')][_0x1b92('0x13')]({'attributes':[_0x1b92('0x17')],'where':{'sectionId':_0xb14de7['id']},'raw':!![]})[_0x1b92('0xd')](function(_0x5b4b61){if(_0x5b4b61){var _0xb60543={'where':{'id':_[_0x1b92('0x18')](_0x5b4b61,_0x1b92('0x17'))},'raw':!![]};switch(_0x16e030){case _0x1b92('0x7'):_0xb60543['where'][_0x1b92('0x8')]=_0x1b92('0x19');break;case'Campaign':_0xb60543[_0x1b92('0x1a')][_0x1b92('0xa')]='ivr';break;}return db[_0x16e030][_0x1b92('0x13')](_0xb60543);}else{return[];}});}}else{return[];}})[_0x1b92('0xd')](function(_0x18fb70){return _0x18fb70;});}function joinOrLeaveQueues(_0x5c7e86,_0x2d146e,_0x422866,_0x504b2a){_0x5c7e86[_0x2d146e](util[_0x1b92('0x1b')](_0x1b92('0x1c'),_0x422866,_0x504b2a[_0x1b92('0x5')]));if(_0x504b2a[_0x1b92('0x6')]){for(var _0x487e16=0x0;_0x487e16<_0x504b2a['Agents'][_0x1b92('0x1d')];_0x487e16+=0x1){_0x5c7e86[_0x2d146e](util[_0x1b92('0x1b')](_0x1b92('0x1e'),_0x504b2a[_0x1b92('0x6')][_0x487e16][_0x1b92('0x5')]));}}}function joinOrLeave(_0x37009c,_0x41bb08,_0x13fc27){var _0x5169bb;if(_0x37009c[_0x1b92('0x1f')][_0x1b92('0x20')]['id']){db['User'][_0x1b92('0x21')]({'attributes':['id',_0x1b92('0x5'),_0x1b92('0x8'),_0x1b92('0x22')],'where':{'id':_0x37009c[_0x1b92('0x1f')]['query']['id']},'include':[{'model':db[_0x1b92('0x23')],'as':_0x1b92('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x1b92('0x25')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x1b92('0x26')],'as':_0x1b92('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x1b92('0x28')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x1b92('0x29')],'as':_0x1b92('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x1b92('0xd')](function(_0x3a9ec1){if(_0x3a9ec1){_0x5169bb=_0x3a9ec1;_0x37009c[_0x41bb08](util['format']('user:%s',_0x3a9ec1['name']));var _0x1cf9e9=[];switch(_0x3a9ec1[_0x1b92('0x8')]){case'admin':_0x37009c[_0x41bb08](_0x1b92('0x2b'));_0x37009c[_0x41bb08](_0x1b92('0x2c'));if(queryQueues['hasOwnProperty'](_0x1b92('0x2d'))){delete queryQueues[_0x1b92('0x2d')];}_0x1cf9e9[_0x1b92('0x2e')](db['VoiceQueue'][_0x1b92('0x13')](queryQueues));_0x1cf9e9['push'](db['ChatQueue'][_0x1b92('0x13')](queryQueues));_0x1cf9e9[_0x1b92('0x2e')](db['FaxQueue'][_0x1b92('0x13')](queryQueues));_0x1cf9e9['push'](db['SmsQueue']['findAll'](queryQueues));_0x1cf9e9[_0x1b92('0x2e')](db['MailQueue']['findAll'](queryQueues));_0x1cf9e9[_0x1b92('0x2e')](db['OpenchannelQueue'][_0x1b92('0x13')](queryQueues));_0x1cf9e9[_0x1b92('0x2e')](db[_0x1b92('0x7')]['findAll'](queryTelephones));_0x1cf9e9['push'](db[_0x1b92('0x2f')][_0x1b92('0x13')](queryTrunks));_0x1cf9e9[_0x1b92('0x2e')](db['Campaign'][_0x1b92('0x13')](queryCampaigns));_0x1cf9e9[_0x1b92('0x2e')](db[_0x1b92('0x7')][_0x1b92('0x13')](queryAgents));break;case _0x1b92('0x30'):_0x37009c[_0x41bb08](_0x1b92('0x2b'));_0x37009c[_0x41bb08](_0x1b92('0x2c'));_0x1cf9e9['push'](getAssociatedResources('VoiceQueues',_0x3a9ec1[_0x1b92('0x22')],_0x1b92('0x31')));_0x1cf9e9['push'](getAssociatedResources(_0x1b92('0x10'),_0x3a9ec1[_0x1b92('0x22')],_0x1b92('0x32')));_0x1cf9e9[_0x1b92('0x2e')](getAssociatedResources(_0x1b92('0x11'),_0x3a9ec1[_0x1b92('0x22')],_0x1b92('0x33')));_0x1cf9e9[_0x1b92('0x2e')](getAssociatedResources(_0x1b92('0x34'),_0x3a9ec1[_0x1b92('0x22')],_0x1b92('0x35')));_0x1cf9e9[_0x1b92('0x2e')](getAssociatedResources(_0x1b92('0x12'),_0x3a9ec1[_0x1b92('0x22')],_0x1b92('0x36')));_0x1cf9e9[_0x1b92('0x2e')](getAssociatedResources('OpenchannelQueues',_0x3a9ec1['userProfileId'],'OpenchannelQueue'));_0x1cf9e9[_0x1b92('0x2e')](getAssociatedResources('Telephones',_0x3a9ec1['userProfileId'],'User'));_0x1cf9e9[_0x1b92('0x2e')](getAssociatedResources(_0x1b92('0x14'),_0x3a9ec1['userProfileId'],_0x1b92('0x2f')));_0x1cf9e9['push'](getAssociatedResources('IvrCampaigns',_0x3a9ec1[_0x1b92('0x22')],_0x1b92('0x37')));_0x1cf9e9[_0x1b92('0x2e')](db['User']['findAll'](queryAgents));break;case'agent':_0x37009c[_0x41bb08]('voice:inbound');_0x37009c[_0x41bb08](_0x1b92('0x2c'));_0x1cf9e9[_0x1b92('0x2e')](_0x3a9ec1[_0x1b92('0x38')]({'attributes':['id',_0x1b92('0x5')]}));_0x1cf9e9[_0x1b92('0x2e')](_0x3a9ec1[_0x1b92('0x39')]({'attributes':['id',_0x1b92('0x5')]}));_0x1cf9e9[_0x1b92('0x2e')](_0x3a9ec1[_0x1b92('0x3a')]({'attributes':['id',_0x1b92('0x5')]}));_0x1cf9e9[_0x1b92('0x2e')](_0x3a9ec1[_0x1b92('0x3b')]({'attributes':['id',_0x1b92('0x5')]}));_0x1cf9e9[_0x1b92('0x2e')](_0x3a9ec1['getMailQueues']({'attributes':['id','name']}));_0x1cf9e9[_0x1b92('0x2e')](_0x3a9ec1[_0x1b92('0x3c')]({'attributes':['id','name']}));break;}return BPromise[_0x1b92('0x3d')](_0x1cf9e9);}})[_0x1b92('0xd')](function(_0x1fd439){if(_0x1fd439&&_0x1fd439[_0x1b92('0x1d')]){for(var _0x36473a=0x0;_0x36473a<_0x1fd439[_0x1b92('0x1d')];_0x36473a+=0x1){for(var _0x4bf7f1=0x0;_0x4bf7f1<_0x1fd439[_0x36473a][_0x1b92('0x1d')];_0x4bf7f1+=0x1){switch(_0x36473a){case 0x0:joinOrLeaveQueues(_0x37009c,_0x41bb08,'voice',_0x1fd439[_0x36473a][_0x4bf7f1]);break;case 0x1:joinOrLeaveQueues(_0x37009c,_0x41bb08,_0x1b92('0x3e'),_0x1fd439[_0x36473a][_0x4bf7f1]);break;case 0x2:joinOrLeaveQueues(_0x37009c,_0x41bb08,_0x1b92('0x3f'),_0x1fd439[_0x36473a][_0x4bf7f1]);break;case 0x3:joinOrLeaveQueues(_0x37009c,_0x41bb08,_0x1b92('0x40'),_0x1fd439[_0x36473a][_0x4bf7f1]);break;case 0x4:joinOrLeaveQueues(_0x37009c,_0x41bb08,_0x1b92('0x41'),_0x1fd439[_0x36473a][_0x4bf7f1]);break;case 0x5:joinOrLeaveQueues(_0x37009c,_0x41bb08,_0x1b92('0x42'),_0x1fd439[_0x36473a][_0x4bf7f1]);break;case 0x6:_0x37009c[_0x41bb08](util[_0x1b92('0x1b')](_0x1b92('0x43'),_0x1fd439[_0x36473a][_0x4bf7f1][_0x1b92('0x5')]));break;case 0x7:_0x37009c[_0x41bb08](util[_0x1b92('0x1b')](_0x1b92('0x44'),_0x1fd439[_0x36473a][_0x4bf7f1][_0x1b92('0x5')]));break;case 0x8:_0x37009c[_0x41bb08](util['format']('campaign:%s:%s',_0x1fd439[_0x36473a][_0x4bf7f1]['type'],_0x1fd439[_0x36473a][_0x4bf7f1]['name']));break;case 0x9:_0x37009c[_0x41bb08](util[_0x1b92('0x1b')](_0x1b92('0x1e'),_0x1fd439[_0x36473a][_0x4bf7f1][_0x1b92('0x5')]));break;}}}}})[_0x1b92('0xd')](function(){if(_0x41bb08===_0x1b92('0x45')){var _0x101a05=_['map'](_0x5169bb['ChatInteractions'],'id');return _0x5169bb['removeChatInteractions'](_0x101a05)[_0x1b92('0xd')](function(){for(var _0xaa637f=0x0;_0xaa637f<_0x101a05[_0x1b92('0x1d')];_0xaa637f+=0x1){_0x13fc27[_0x1b92('0x46')](_0x1b92('0x47'),{'ChatInteractionId':Number(_0x101a05[_0xaa637f]),'UserId':Number(_0x5169bb['id'])});}});}})[_0x1b92('0xd')](function(){if(_0x41bb08===_0x1b92('0x45')){var _0x5760a7=_['map'](_0x5169bb[_0x1b92('0x48')],'id');return _0x5169bb[_0x1b92('0x49')](_0x5760a7)[_0x1b92('0xd')](function(){for(var _0x48e6d7=0x0;_0x48e6d7<_0x5760a7['length'];_0x48e6d7+=0x1){_0x13fc27[_0x1b92('0x46')](_0x1b92('0x4a'),{'MailInteractionId':Number(_0x5760a7[_0x48e6d7]),'UserId':Number(_0x5169bb['id'])});}});}})['then'](function(){if(_0x41bb08==='leave'){var _0x419147=_[_0x1b92('0x18')](_0x5169bb['FaxInteractions'],'id');return _0x5169bb['removeFaxInteractions'](_0x419147)['then'](function(){for(var _0x38909f=0x0;_0x38909f<_0x419147[_0x1b92('0x1d')];_0x38909f+=0x1){_0x13fc27['emit'](_0x1b92('0x4b'),{'FaxInteractionId':Number(_0x419147[_0x38909f]),'UserId':Number(_0x5169bb['id'])});}});}})[_0x1b92('0xd')](function(){if(_0x41bb08===_0x1b92('0x45')){var _0x5998f0=_[_0x1b92('0x18')](_0x5169bb[_0x1b92('0x4c')],'id');return _0x5169bb[_0x1b92('0x4d')](_0x5998f0)['then'](function(){for(var _0x56b6cf=0x0;_0x56b6cf<_0x5998f0[_0x1b92('0x1d')];_0x56b6cf+=0x1){_0x13fc27[_0x1b92('0x46')](_0x1b92('0x4e'),{'SmsInteractionId':Number(_0x5998f0[_0x56b6cf]),'UserId':Number(_0x5169bb['id'])});}});}})[_0x1b92('0xd')](function(){if(_0x41bb08===_0x1b92('0x45')){var _0x3e8884=_[_0x1b92('0x18')](_0x5169bb['OpenchannelInteractions'],'id');return _0x5169bb[_0x1b92('0x4f')](_0x3e8884)[_0x1b92('0xd')](function(){for(var _0xe24666=0x0;_0xe24666<_0x3e8884[_0x1b92('0x1d')];_0xe24666+=0x1){_0x13fc27['emit'](_0x1b92('0x50'),{'OpenchannelInteractionId':Number(_0x3e8884[_0xe24666]),'UserId':Number(_0x5169bb['id'])});}});}})['catch'](function(_0x3974e1){_0x37009c[_0x1b92('0x51')](_0x3974e1);});}}function onDisconnect(_0x20fdc2,_0x43d402){joinOrLeave(_0x20fdc2,'leave',_0x43d402);}function onConnect(_0x19588c){joinOrLeave(_0x19588c,_0x1b92('0x52'));}exports[_0x1b92('0x53')]=function(_0x43394a){_0x43394a['on'](_0x1b92('0x54'),function(_0x588163){_0x588163[_0x1b92('0x55')](0x0);_0x588163['address']=_0x588163['request']['connection'][_0x1b92('0x56')]+':'+_0x588163['request'][_0x1b92('0x54')][_0x1b92('0x57')];_0x588163[_0x1b92('0x58')]=new Date();_0x588163['log']=function(_0x42279c){console[_0x1b92('0x51')](_0x1b92('0x59')+_0x588163[_0x1b92('0x5a')][_0x1b92('0x5')]+'['+_0x588163['address']+']',_0x42279c);};_0x588163['on'](_0x1b92('0x5b'),function(){onDisconnect(_0x588163,_0x43394a);_0x588163[_0x1b92('0x51')]('DISCONNECTED');});onConnect(_0x588163);_0x588163[_0x1b92('0x51')](_0x1b92('0x5c'));});}; \ No newline at end of file +var _0xc03b=['SmsQueues','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','all','voice','chat','fax','sms','openchannel','campaign:%s:%s','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','emit','user_has_mail_interactions:remove','leave','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','catch','log','join','setMaxListeners','request','connection','remoteAddress','connectedAt','nsp','address','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','User','name','agent','telephone','type','ivr','UserProfileSection','findOne','autoAssociation','ChatQueues','FaxQueues','OpenchannelQueues','Telephones','findAll','IvrCampaigns','UserProfileResource','resourceId','then','map','where','role','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','VoiceQueues','VoiceQueue','FaxQueue'];(function(_0x35245d,_0x193583){var _0x184a83=function(_0x2d46bd){while(--_0x2d46bd){_0x35245d['push'](_0x35245d['shift']());}};_0x184a83(++_0x193583);}(_0xc03b,0xdc));var _0xbc03=function(_0x3b2c8e,_0x53910b){_0x3b2c8e=_0x3b2c8e-0x0;var _0x3ebe3d=_0xc03b[_0x3b2c8e];return _0x3ebe3d;};'use strict';var _=require(_0xbc03('0x0'));var util=require(_0xbc03('0x1'));var BPromise=require(_0xbc03('0x2'));var db=require(_0xbc03('0x3'))['db'];var config=require(_0xbc03('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xbc03('0x5'),'model':db[_0xbc03('0x6')],'attributes':['id',_0xbc03('0x7'),'role'],'raw':!![],'where':{'role':_0xbc03('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xbc03('0x7')],'where':{'role':_0xbc03('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0xbc03('0x7')]};var queryAgents={'raw':!![],'attributes':['id',_0xbc03('0x7')],'where':{'role':_0xbc03('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0xbc03('0xa')],'where':{'type':_0xbc03('0xb')}};function getAssociatedResources(_0x38e7fa,_0x3ebe92,_0x1076c3){return db[_0xbc03('0xc')][_0xbc03('0xd')]({'where':{'name':_0x38e7fa,'userProfileId':_0x3ebe92},'raw':!![]})['then'](function(_0x2cbc54){if(_0x2cbc54){if(_0x2cbc54[_0xbc03('0xe')]){switch(_0x38e7fa){case'VoiceQueues':case _0xbc03('0xf'):case _0xbc03('0x10'):case'SmsQueues':case'MailQueues':case _0xbc03('0x11'):return db[_0x1076c3]['findAll'](queryQueues);case _0xbc03('0x12'):return db[_0x1076c3][_0xbc03('0x13')](queryTelephones);case'Trunks':return db[_0x1076c3][_0xbc03('0x13')](queryTrunks);case _0xbc03('0x14'):return db[_0x1076c3]['findAll'](queryCampaigns);}}else{return db[_0xbc03('0x15')]['findAll']({'attributes':[_0xbc03('0x16')],'where':{'sectionId':_0x2cbc54['id']},'raw':!![]})[_0xbc03('0x17')](function(_0x14ce96){if(_0x14ce96){var _0x4ea0b1={'where':{'id':_[_0xbc03('0x18')](_0x14ce96,_0xbc03('0x16'))},'raw':!![]};switch(_0x1076c3){case _0xbc03('0x6'):_0x4ea0b1[_0xbc03('0x19')][_0xbc03('0x1a')]=_0xbc03('0x9');break;case _0xbc03('0x1b'):_0x4ea0b1['where']['type']=_0xbc03('0xb');break;}return db[_0x1076c3][_0xbc03('0x13')](_0x4ea0b1);}else{return[];}});}}else{return[];}})[_0xbc03('0x17')](function(_0x5ceef3){return _0x5ceef3;});}function joinOrLeaveQueues(_0x40e0e8,_0x35f6a0,_0x385404,_0xc77590){_0x40e0e8[_0x35f6a0](util[_0xbc03('0x1c')](_0xbc03('0x1d'),_0x385404,_0xc77590[_0xbc03('0x7')]));if(_0xc77590['Agents']){for(var _0x260eb5=0x0;_0x260eb5<_0xc77590['Agents'][_0xbc03('0x1e')];_0x260eb5+=0x1){_0x40e0e8[_0x35f6a0](util[_0xbc03('0x1c')](_0xbc03('0x1f'),_0xc77590[_0xbc03('0x5')][_0x260eb5][_0xbc03('0x7')]));}}}function joinOrLeave(_0x3c21c1,_0x484e77,_0x1067d3){var _0x116942;if(_0x3c21c1[_0xbc03('0x20')][_0xbc03('0x21')]['id']){db['User'][_0xbc03('0x22')]({'attributes':['id',_0xbc03('0x7'),'role',_0xbc03('0x23')],'where':{'id':_0x3c21c1[_0xbc03('0x20')][_0xbc03('0x21')]['id']},'include':[{'model':db[_0xbc03('0x24')],'as':_0xbc03('0x25'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xbc03('0x26')],'as':_0xbc03('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xbc03('0x28')],'as':_0xbc03('0x29'),'attributes':['id'],'raw':!![]}]})[_0xbc03('0x17')](function(_0x25b80f){if(_0x25b80f){_0x116942=_0x25b80f;_0x3c21c1[_0x484e77](util[_0xbc03('0x1c')](_0xbc03('0x1f'),_0x25b80f['name']));var _0x222e84=[];switch(_0x25b80f['role']){case'admin':_0x3c21c1[_0x484e77](_0xbc03('0x2a'));_0x3c21c1[_0x484e77](_0xbc03('0x2b'));if(queryQueues[_0xbc03('0x2c')]('include')){delete queryQueues[_0xbc03('0x2d')];}_0x222e84[_0xbc03('0x2e')](db['VoiceQueue']['findAll'](queryQueues));_0x222e84[_0xbc03('0x2e')](db[_0xbc03('0x2f')][_0xbc03('0x13')](queryQueues));_0x222e84['push'](db['FaxQueue']['findAll'](queryQueues));_0x222e84[_0xbc03('0x2e')](db[_0xbc03('0x30')][_0xbc03('0x13')](queryQueues));_0x222e84[_0xbc03('0x2e')](db[_0xbc03('0x31')][_0xbc03('0x13')](queryQueues));_0x222e84[_0xbc03('0x2e')](db[_0xbc03('0x32')][_0xbc03('0x13')](queryQueues));_0x222e84[_0xbc03('0x2e')](db[_0xbc03('0x6')][_0xbc03('0x13')](queryTelephones));_0x222e84[_0xbc03('0x2e')](db[_0xbc03('0x33')][_0xbc03('0x13')](queryTrunks));_0x222e84[_0xbc03('0x2e')](db['Campaign']['findAll'](queryCampaigns));_0x222e84[_0xbc03('0x2e')](db[_0xbc03('0x6')][_0xbc03('0x13')](queryAgents));break;case _0xbc03('0x34'):_0x3c21c1[_0x484e77](_0xbc03('0x2a'));_0x3c21c1[_0x484e77](_0xbc03('0x2b'));_0x222e84[_0xbc03('0x2e')](getAssociatedResources(_0xbc03('0x35'),_0x25b80f['userProfileId'],_0xbc03('0x36')));_0x222e84['push'](getAssociatedResources(_0xbc03('0xf'),_0x25b80f[_0xbc03('0x23')],_0xbc03('0x2f')));_0x222e84['push'](getAssociatedResources(_0xbc03('0x10'),_0x25b80f[_0xbc03('0x23')],_0xbc03('0x37')));_0x222e84[_0xbc03('0x2e')](getAssociatedResources(_0xbc03('0x38'),_0x25b80f[_0xbc03('0x23')],_0xbc03('0x30')));_0x222e84[_0xbc03('0x2e')](getAssociatedResources('MailQueues',_0x25b80f['userProfileId'],_0xbc03('0x31')));_0x222e84['push'](getAssociatedResources('OpenchannelQueues',_0x25b80f[_0xbc03('0x23')],_0xbc03('0x32')));_0x222e84['push'](getAssociatedResources('Telephones',_0x25b80f['userProfileId'],_0xbc03('0x6')));_0x222e84['push'](getAssociatedResources(_0xbc03('0x39'),_0x25b80f[_0xbc03('0x23')],_0xbc03('0x33')));_0x222e84[_0xbc03('0x2e')](getAssociatedResources(_0xbc03('0x14'),_0x25b80f[_0xbc03('0x23')],_0xbc03('0x1b')));_0x222e84[_0xbc03('0x2e')](db[_0xbc03('0x6')][_0xbc03('0x13')](queryAgents));break;case _0xbc03('0x8'):_0x3c21c1[_0x484e77]('voice:inbound');_0x3c21c1[_0x484e77]('voice:outbound');_0x222e84['push'](_0x25b80f[_0xbc03('0x3a')]({'attributes':['id',_0xbc03('0x7')]}));_0x222e84['push'](_0x25b80f[_0xbc03('0x3b')]({'attributes':['id',_0xbc03('0x7')]}));_0x222e84[_0xbc03('0x2e')](_0x25b80f[_0xbc03('0x3c')]({'attributes':['id',_0xbc03('0x7')]}));_0x222e84['push'](_0x25b80f[_0xbc03('0x3d')]({'attributes':['id',_0xbc03('0x7')]}));_0x222e84['push'](_0x25b80f['getMailQueues']({'attributes':['id',_0xbc03('0x7')]}));_0x222e84[_0xbc03('0x2e')](_0x25b80f['getOpenchannelQueues']({'attributes':['id',_0xbc03('0x7')]}));break;}return BPromise[_0xbc03('0x3e')](_0x222e84);}})['then'](function(_0x1bedc1){if(_0x1bedc1&&_0x1bedc1[_0xbc03('0x1e')]){for(var _0x93c078=0x0;_0x93c078<_0x1bedc1['length'];_0x93c078+=0x1){for(var _0x431f14=0x0;_0x431f14<_0x1bedc1[_0x93c078][_0xbc03('0x1e')];_0x431f14+=0x1){switch(_0x93c078){case 0x0:joinOrLeaveQueues(_0x3c21c1,_0x484e77,_0xbc03('0x3f'),_0x1bedc1[_0x93c078][_0x431f14]);break;case 0x1:joinOrLeaveQueues(_0x3c21c1,_0x484e77,_0xbc03('0x40'),_0x1bedc1[_0x93c078][_0x431f14]);break;case 0x2:joinOrLeaveQueues(_0x3c21c1,_0x484e77,_0xbc03('0x41'),_0x1bedc1[_0x93c078][_0x431f14]);break;case 0x3:joinOrLeaveQueues(_0x3c21c1,_0x484e77,_0xbc03('0x42'),_0x1bedc1[_0x93c078][_0x431f14]);break;case 0x4:joinOrLeaveQueues(_0x3c21c1,_0x484e77,'mail',_0x1bedc1[_0x93c078][_0x431f14]);break;case 0x5:joinOrLeaveQueues(_0x3c21c1,_0x484e77,_0xbc03('0x43'),_0x1bedc1[_0x93c078][_0x431f14]);break;case 0x6:_0x3c21c1[_0x484e77](util[_0xbc03('0x1c')]('telephone:%s',_0x1bedc1[_0x93c078][_0x431f14]['name']));break;case 0x7:_0x3c21c1[_0x484e77](util[_0xbc03('0x1c')]('trunk:%s',_0x1bedc1[_0x93c078][_0x431f14][_0xbc03('0x7')]));break;case 0x8:_0x3c21c1[_0x484e77](util[_0xbc03('0x1c')](_0xbc03('0x44'),_0x1bedc1[_0x93c078][_0x431f14][_0xbc03('0xa')],_0x1bedc1[_0x93c078][_0x431f14][_0xbc03('0x7')]));break;case 0x9:_0x3c21c1[_0x484e77](util[_0xbc03('0x1c')](_0xbc03('0x1f'),_0x1bedc1[_0x93c078][_0x431f14][_0xbc03('0x7')]));break;}}}}})[_0xbc03('0x17')](function(){if(_0x484e77==='leave'){var _0x22af10=_['map'](_0x116942[_0xbc03('0x25')],'id');return _0x116942['removeChatInteractions'](_0x22af10)[_0xbc03('0x17')](function(){for(var _0x16dfb5=0x0;_0x16dfb5<_0x22af10[_0xbc03('0x1e')];_0x16dfb5+=0x1){_0x1067d3['emit'](_0xbc03('0x45'),{'ChatInteractionId':Number(_0x22af10[_0x16dfb5]),'UserId':Number(_0x116942['id'])});}});}})[_0xbc03('0x17')](function(){if(_0x484e77==='leave'){var _0x242f07=_[_0xbc03('0x18')](_0x116942[_0xbc03('0x46')],'id');return _0x116942[_0xbc03('0x47')](_0x242f07)[_0xbc03('0x17')](function(){for(var _0x4aafa9=0x0;_0x4aafa9<_0x242f07[_0xbc03('0x1e')];_0x4aafa9+=0x1){_0x1067d3[_0xbc03('0x48')](_0xbc03('0x49'),{'MailInteractionId':Number(_0x242f07[_0x4aafa9]),'UserId':Number(_0x116942['id'])});}});}})[_0xbc03('0x17')](function(){if(_0x484e77===_0xbc03('0x4a')){var _0x560901=_[_0xbc03('0x18')](_0x116942['FaxInteractions'],'id');return _0x116942[_0xbc03('0x4b')](_0x560901)[_0xbc03('0x17')](function(){for(var _0x15a043=0x0;_0x15a043<_0x560901[_0xbc03('0x1e')];_0x15a043+=0x1){_0x1067d3[_0xbc03('0x48')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x560901[_0x15a043]),'UserId':Number(_0x116942['id'])});}});}})[_0xbc03('0x17')](function(){if(_0x484e77==='leave'){var _0x281da1=_[_0xbc03('0x18')](_0x116942['SmsInteractions'],'id');return _0x116942[_0xbc03('0x4c')](_0x281da1)[_0xbc03('0x17')](function(){for(var _0xbdb8d2=0x0;_0xbdb8d2<_0x281da1[_0xbc03('0x1e')];_0xbdb8d2+=0x1){_0x1067d3[_0xbc03('0x48')](_0xbc03('0x4d'),{'SmsInteractionId':Number(_0x281da1[_0xbdb8d2]),'UserId':Number(_0x116942['id'])});}});}})[_0xbc03('0x17')](function(){if(_0x484e77==='leave'){var _0x2114f6=_[_0xbc03('0x18')](_0x116942['OpenchannelInteractions'],'id');return _0x116942[_0xbc03('0x4e')](_0x2114f6)[_0xbc03('0x17')](function(){for(var _0x132f5a=0x0;_0x132f5a<_0x2114f6['length'];_0x132f5a+=0x1){_0x1067d3[_0xbc03('0x48')](_0xbc03('0x4f'),{'OpenchannelInteractionId':Number(_0x2114f6[_0x132f5a]),'UserId':Number(_0x116942['id'])});}});}})[_0xbc03('0x50')](function(_0x23ee1d){_0x3c21c1[_0xbc03('0x51')](_0x23ee1d);});}}function onDisconnect(_0x32af90,_0x24183c){joinOrLeave(_0x32af90,'leave',_0x24183c);}function onConnect(_0x113e03){joinOrLeave(_0x113e03,_0xbc03('0x52'));}exports['default']=function(_0x43a11a){_0x43a11a['on']('connection',function(_0x40c91a){_0x40c91a[_0xbc03('0x53')](0x0);_0x40c91a['address']=_0x40c91a[_0xbc03('0x54')][_0xbc03('0x55')][_0xbc03('0x56')]+':'+_0x40c91a[_0xbc03('0x54')][_0xbc03('0x55')]['remotePort'];_0x40c91a[_0xbc03('0x57')]=new Date();_0x40c91a[_0xbc03('0x51')]=function(_0x3851f4){console['log']('SocketIO\x20'+_0x40c91a[_0xbc03('0x58')][_0xbc03('0x7')]+'['+_0x40c91a[_0xbc03('0x59')]+']',_0x3851f4);};_0x40c91a['on']('disconnect',function(){onDisconnect(_0x40c91a,_0x43a11a);_0x40c91a[_0xbc03('0x51')](_0xbc03('0x5a'));});onConnect(_0x40c91a);_0x40c91a[_0xbc03('0x51')](_0xbc03('0x5b'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 1c29b64..4949c3a 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 _0xb2ed=['OpenchannelInteraction','OpenchannelMessage','request','then','info','EventManager','error','code','Trigger,\x20%s','catch','get','channel','event','UserId','User','find','name','interface','format','SIP/%s','incomingmessage','outgoingmessage','opened','changed','closed','default','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','../logger','client','http','ChatInteraction','afterCreate','Chat','afterUpdate','closedinteraction','newmessage','SmsInteraction','newinteraction','Sms','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel'];(function(_0x2033e6,_0x2108b5){var _0x870937=function(_0x977b69){while(--_0x977b69){_0x2033e6['push'](_0x2033e6['shift']());}};_0x870937(++_0x2108b5);}(_0xb2ed,0x124));var _0xdb2e=function(_0x44c935,_0x3653f0){_0x44c935=_0x44c935-0x0;var _0x465bee=_0xb2ed[_0x44c935];return _0x465bee;};'use strict';var util=require(_0xdb2e('0x0'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var logger=require(_0xdb2e('0x1'))('triggers');var client=jayson[_0xdb2e('0x2')][_0xdb2e('0x3')]({'port':0x232a});var triggers=[{'channel':'Chat','model':_0xdb2e('0x4'),'event':_0xdb2e('0x5'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xdb2e('0x6'),'model':_0xdb2e('0x4'),'event':_0xdb2e('0x7'),'condition':_0xdb2e('0x8'),'callback':afterUpdate},{'channel':_0xdb2e('0x6'),'model':'ChatMessage','event':'afterCreate','condition':_0xdb2e('0x9'),'callback':afterCreateMessage},{'channel':'Sms','model':_0xdb2e('0xa'),'event':_0xdb2e('0x5'),'condition':_0xdb2e('0xb'),'callback':afterCreate},{'channel':_0xdb2e('0xc'),'model':_0xdb2e('0xa'),'event':_0xdb2e('0x7'),'condition':_0xdb2e('0x8'),'callback':afterUpdate},{'channel':_0xdb2e('0xc'),'model':'SmsMessage','event':_0xdb2e('0x5'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xdb2e('0xd'),'model':_0xdb2e('0xe'),'event':_0xdb2e('0x5'),'condition':_0xdb2e('0xb'),'callback':afterCreate},{'channel':'Fax','model':'FaxInteraction','event':_0xdb2e('0x7'),'condition':_0xdb2e('0x8'),'callback':afterUpdate},{'channel':_0xdb2e('0xd'),'model':_0xdb2e('0xf'),'event':_0xdb2e('0x5'),'condition':_0xdb2e('0x9'),'callback':afterCreateMessage},{'channel':'Mail','model':'MailInteraction','event':_0xdb2e('0x5'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xdb2e('0x10'),'model':_0xdb2e('0x11'),'event':_0xdb2e('0x7'),'condition':_0xdb2e('0x8'),'callback':afterUpdate},{'channel':_0xdb2e('0x10'),'model':_0xdb2e('0x12'),'event':'afterCreate','condition':_0xdb2e('0x9'),'callback':afterCreateMessage},{'channel':_0xdb2e('0x13'),'model':_0xdb2e('0x14'),'event':_0xdb2e('0x5'),'condition':_0xdb2e('0xb'),'callback':afterCreate},{'channel':'Openchannel','model':_0xdb2e('0x14'),'event':_0xdb2e('0x7'),'condition':_0xdb2e('0x8'),'callback':afterUpdate},{'channel':_0xdb2e('0x13'),'model':_0xdb2e('0x15'),'event':_0xdb2e('0x5'),'condition':_0xdb2e('0x9'),'callback':afterCreateMessage}];function request(_0xbd068f){return client[_0xdb2e('0x16')]('EventManager',_0xbd068f)[_0xdb2e('0x17')](function(_0x14405c){logger[_0xdb2e('0x18')]('Trigger,\x20%s',_0xdb2e('0x19'),_0x14405c);if(_0x14405c[_0xdb2e('0x1a')]){if(_0x14405c[_0xdb2e('0x1a')][_0xdb2e('0x1b')]===0x1f4){logger['error'](_0xdb2e('0x1c'),_0xdb2e('0x19'),_0x14405c[_0xdb2e('0x1a')]);}}})[_0xdb2e('0x1d')](function(_0x43ef60){logger[_0xdb2e('0x1a')](_0xdb2e('0x1c'),'EventManager',_0x43ef60);});}function afterCreateMessage(_0x27b934,_0x2477f7){return function(_0x532b79,_0x4aed1d){_0x532b79=_0x532b79[_0xdb2e('0x1e')]({'plain':!![]});_0x532b79[_0xdb2e('0x1f')]=_0x27b934;_0x532b79[_0xdb2e('0x20')]=_0x532b79['direction'];if(_0x532b79[_0xdb2e('0x21')]){return db[_0xdb2e('0x22')][_0xdb2e('0x23')]({'where':{'id':_0x532b79['UserId']},'attributes':['id',_0xdb2e('0x24')],'raw':!![]})[_0xdb2e('0x17')](function(_0x1f54fb){_0x532b79[_0xdb2e('0x25')]=util[_0xdb2e('0x26')](_0xdb2e('0x27'),_0x1f54fb[_0xdb2e('0x24')]);_0x532b79[_0xdb2e('0x1f')]=_0x27b934;return request({'event':_0xdb2e('0x28'),'message':_0x532b79});})[_0xdb2e('0x1d')](function(_0x265dbb){console[_0xdb2e('0x1a')](_0x265dbb);});}else{return request({'event':_0xdb2e('0x29'),'message':_0x532b79});}};}function afterCreate(_0x5c868d,_0x5ad0c7){return function(_0xfbb1bb,_0x135b94){_0xfbb1bb=_0xfbb1bb[_0xdb2e('0x1e')]({'plain':!![]});_0xfbb1bb[_0xdb2e('0x1f')]=_0x5c868d;_0xfbb1bb['event']=_0xdb2e('0x2a');return request({'event':_0x5ad0c7,'message':_0xfbb1bb});};}function afterUpdate(_0xc1fe32,_0x597da5){return function(_0x397166,_0x57a5df){if(_0x397166[_0xdb2e('0x2b')]('closed')&&_0x397166[_0xdb2e('0x2c')]){_0x397166=_0x397166[_0xdb2e('0x1e')]({'plain':!![]});_0x397166[_0xdb2e('0x1f')]=_0xc1fe32;_0x397166[_0xdb2e('0x20')]=_0xdb2e('0x2c');if(_0x397166[_0xdb2e('0x21')]){return db['User'][_0xdb2e('0x23')]({'where':{'id':_0x397166['UserId']},'attributes':['id','name'],'raw':!![]})[_0xdb2e('0x17')](function(_0x414653){_0x397166['interface']=util[_0xdb2e('0x26')](_0xdb2e('0x27'),_0x414653[_0xdb2e('0x24')]);return request({'event':_0x597da5,'message':_0x397166});})[_0xdb2e('0x1d')](function(_0xaba66d){console['error'](_0xaba66d);});}else{return request({'event':_0x597da5,'message':_0x397166});}}};}exports[_0xdb2e('0x2d')]=function(){for(var _0x1b460a=0x0;_0x1b460a=_0x5e9b5e[_0xc5f8('0x13')]){throw Error(_0xc5f8('0x14'));}_0x9ebd29(_0x4fb5c4);})[_0xc5f8('0x15')](function(_0x1a21d7){_0x198647(_0x1a21d7);});});}; \ No newline at end of file +var _0x20f2=['updateAttributes','getLicense','role','agent','User','count','then','agents','lodash','bluebird','../mysqldb','./license/util','voice','mail','chat','fax','sms','getChannels','isValidChannel','toLowerCase','includes','isUndefined','blockedAt'];(function(_0x23350a,_0x33a4a5){var _0x21f066=function(_0x4544e6){while(--_0x4544e6){_0x23350a['push'](_0x23350a['shift']());}};_0x21f066(++_0x33a4a5);}(_0x20f2,0x1d4));var _0x220f=function(_0x4bb272,_0x3dd93e){_0x4bb272=_0x4bb272-0x0;var _0xdaa03d=_0x20f2[_0x4bb272];return _0xdaa03d;};'use strict';var _=require(_0x220f('0x0'));var BPromise=require(_0x220f('0x1'));var db=require(_0x220f('0x2'))['db'];var util=require(_0x220f('0x3'));var channels=[_0x220f('0x4'),_0x220f('0x5'),_0x220f('0x6'),_0x220f('0x7'),_0x220f('0x8'),'openchannel'];exports[_0x220f('0x9')]=function(){return channels;};exports[_0x220f('0xa')]=function(_0x7c7b71){_0x7c7b71=_0x7c7b71[_0x220f('0xb')]();return _[_0x220f('0xc')](channels,_0x7c7b71);};exports['clearBlockUser']=function(_0x299559,_0x25e867,_0x143252,_0x2e1abf){var _0x5b3044={'loginAttempts':_0x25e867,'blocked':_0x143252};if(!_[_0x220f('0xd')](_0x2e1abf)){_0x5b3044[_0x220f('0xe')]=_0x2e1abf;}return _0x299559[_0x220f('0xf')](_0x5b3044);};exports[_0x220f('0x10')]=function(_0x38d001){return new BPromise(function(_0x3528ba,_0x6afdeb){var _0x2b6cca=0x0;if(_0x38d001[_0x220f('0x11')]!==_0x220f('0x12')){_0x3528ba(_0x38d001);}db[_0x220f('0x13')][_0x220f('0x14')]({'where':{'role':_0x220f('0x12'),'online':!![],'id':{'$ne':_0x38d001['id']}}})[_0x220f('0x15')](function(_0x337ff1){_0x2b6cca=_0x337ff1;return util[_0x220f('0x10')]();})[_0x220f('0x15')](function(_0x1bc3f1){if(_0x1bc3f1&&_0x1bc3f1[_0x220f('0x16')]&&_0x2b6cca>=_0x1bc3f1[_0x220f('0x16')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x3528ba(_0x38d001);})['catch'](function(_0x387811){_0x6afdeb(_0x387811);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 57bea39..d39cb4e 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6659=['status','send','exports'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x6659,0x122));var _0x9665=function(_0x5b49d5,_0x1e6758){_0x5b49d5=_0x5b49d5-0x0;var _0x193ab9=_0x6659[_0x5b49d5];return _0x193ab9;};'use strict';module[_0x9665('0x0')][0x194]=function pageNotFound(_0x3c167b,_0x3e3be8){var _0x8c3dda='404';var _0x2e5ff2=0x194;var _0x59d75f={'status':_0x2e5ff2};_0x3e3be8[_0x9665('0x1')](_0x59d75f[_0x9665('0x1')]);_0x3e3be8['render'](_0x8c3dda,{},function(_0x584846,_0x184c2e){if(_0x584846){return _0x3e3be8[_0x9665('0x1')](_0x59d75f[_0x9665('0x1')])['json'](_0x59d75f);}_0x3e3be8[_0x9665('0x2')](_0x184c2e);});}; \ No newline at end of file +var _0x046a=['json','exports','404','status'];(function(_0x232c2a,_0x1dca26){var _0x521ba3=function(_0x457966){while(--_0x457966){_0x232c2a['push'](_0x232c2a['shift']());}};_0x521ba3(++_0x1dca26);}(_0x046a,0x1b5));var _0xa046=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x046a[_0x513aa5];return _0x1a1a7c;};'use strict';module[_0xa046('0x0')][0x194]=function pageNotFound(_0x3eb10a,_0x3b9e6a){var _0x31464d=_0xa046('0x1');var _0x503625=0x194;var _0x4dce5d={'status':_0x503625};_0x3b9e6a[_0xa046('0x2')](_0x4dce5d[_0xa046('0x2')]);_0x3b9e6a['render'](_0x31464d,{},function(_0x176b6e,_0x1e1cc9){if(_0x176b6e){return _0x3b9e6a[_0xa046('0x2')](_0x4dce5d[_0xa046('0x2')])[_0xa046('0x3')](_0x4dce5d);}_0x3b9e6a['send'](_0x1e1cc9);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index ca2251a..52baaac 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9cd2=['team_has_mail_queues','MailInteractionId','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','Attachments','Interaction','Account','restrict','TagId','Items','FaxAccountId','Interactions','Exntensions','List','FaxInteractionId','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsApplication','user_has_sms_accounts','IntervalId','sms_interaction_has_tags','SmsInteractionId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueue','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','ChatWebsiteId','ChatProactiveAction','ProactiveActions','ChatMessage','Queue','ChatQueueId','Website','chat_interaction_has_tags','user_has_chat_interactions','ChatInteractionId','team_has_chat_queues','ChatInternalMessage','ChatGroupId','Members','chat_group_has_users','CompanyId','Company','cm_contact_has_tags','Agent','CampaignId','OwnerId','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','AnalyticCustomReport','CustomReportId','Trigger','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Description','Field','Variable','VariableId','Subject','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','FreshdeskConfiguration','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerAccount','Dynamics365Configuration','FreshsalesAccount','FreshsalesConfiguration','ChatQueueReport','FromId','SessionId','JscriptyProject','ProjectId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ChatTransferReport','FromChatWebsiteId','ToAgent','ToChatQueueId','ToChatWebsiteId','ToAccount','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','UserProfileResource','sectionId','exports','path','sequelize','lodash','jstz','determine','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8_general_ci','defaultsDeep','sequelizeHistory','utf8','database','username','password','options','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/mailServerIn/mailServerIn.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','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','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','OpenchannelAccount','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../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','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Sound','../api/sound/sound.model','../api/tag/tag.model','Template','../api/template/template.model','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../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/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','DeskField','ZohoAccount','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileResource/userProfileResource.model','User','hasOne','VoiceMail','cascade','UserId','hasMany','Recordings','UserVoiceQueueRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','SmsInteraction','FaxInteractions','belongsTo','userProfileId','belongsToMany','Groups','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','ChatInteractions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueues','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','VoicePrefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SquareProjects','user_has_square_projects','ChanSpyId','Sounds','moh_has_sounds','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','VoiceRecording','Messages','mailboxuser','mailbox','uniqueid','AgentReports','Contact','ContactId','MailServerOut','MailAccountId','MailServerIn','Imap','Smtp','Dispositions','Answers','Applications','ListId','TemplateId','UserMailQueue'];(function(_0x3b632f,_0x453380){var _0x10e788=function(_0x2228a4){while(--_0x2228a4){_0x3b632f['push'](_0x3b632f['shift']());}};_0x10e788(++_0x453380);}(_0x9cd2,0x85));var _0x29cd=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0x9cd2[_0xf79bae];return _0x5d2cb7;};'use strict';var path=require(_0x29cd('0x0'));var config=require('../config/environment');var Sequelize=require(_0x29cd('0x1'));var _=require(_0x29cd('0x2'));var jstz=require(_0x29cd('0x3'));var timezone=jstz[_0x29cd('0x4')]();config[_0x29cd('0x1')]=_['defaultsDeep'](config['sequelize'],{'database':_0x29cd('0x5'),'username':_0x29cd('0x6'),'password':_0x29cd('0x7'),'options':{'host':_0x29cd('0x8'),'port':0xcea,'dialect':_0x29cd('0x9'),'dialectOptions':{'charset':_0x29cd('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x29cd('0xb')}}});config['sequelizeHistory']=_[_0x29cd('0xc')](config[_0x29cd('0xd')],{'database':_0x29cd('0x5'),'username':_0x29cd('0x6'),'password':_0x29cd('0x7'),'options':{'host':_0x29cd('0x8'),'port':0xcea,'dialect':_0x29cd('0x9'),'dialectOptions':{'charset':_0x29cd('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x29cd('0xe'),'collate':_0x29cd('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x29cd('0x1')][_0x29cd('0xf')],config[_0x29cd('0x1')][_0x29cd('0x10')],config[_0x29cd('0x1')][_0x29cd('0x11')],config[_0x29cd('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x29cd('0xd')][_0x29cd('0xf')],config['sequelizeHistory'][_0x29cd('0x10')],config[_0x29cd('0xd')][_0x29cd('0x11')],config[_0x29cd('0xd')][_0x29cd('0x12')])};db['User']=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x14'));db[_0x29cd('0x15')]=db[_0x29cd('0x1')]['import'](_0x29cd('0x16'));db['VoiceContext']=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x17'));db[_0x29cd('0x18')]=db[_0x29cd('0x1')][_0x29cd('0x13')]('../api/voiceExtension/voiceExtension.model');db[_0x29cd('0x19')]=db['sequelize'][_0x29cd('0x13')](_0x29cd('0x1a'));db[_0x29cd('0x1b')]=db['sequelize']['import'](_0x29cd('0x1c'));db['VoiceRecording']=db['sequelize']['import'](_0x29cd('0x1d'));db[_0x29cd('0x1e')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x1f'));db['VoiceMail']=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x20'));db[_0x29cd('0x21')]=db[_0x29cd('0x1')][_0x29cd('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x29cd('0x22')]=db[_0x29cd('0x1')]['import']('../api/voiceCallReport/voiceCallReport.model');db[_0x29cd('0x23')]=db[_0x29cd('0x1')][_0x29cd('0x13')]('../api/voiceDialReport/voiceDialReport.model');db[_0x29cd('0x24')]=db[_0x29cd('0x1')]['import'](_0x29cd('0x25'));db['VoiceQueueReport']=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x26'));db['MemberReport']=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x27'));db[_0x29cd('0x28')]=db[_0x29cd('0x1')][_0x29cd('0x13')]('../api/trunk/trunk.model');db[_0x29cd('0x29')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x2a'));db['UserVoiceQueueRt']=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x2b'));db[_0x29cd('0x2c')]=db[_0x29cd('0x1')]['import'](_0x29cd('0x2d'));db[_0x29cd('0x2e')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x2f'));db['UserMailQueue']=db[_0x29cd('0x1')]['import']('../api/userMailQueue/userMailQueue.model');db[_0x29cd('0x30')]=db['sequelize'][_0x29cd('0x13')](_0x29cd('0x31'));db[_0x29cd('0x32')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x33'));db[_0x29cd('0x34')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x35'));db['MailServerIn']=db['sequelize'][_0x29cd('0x13')](_0x29cd('0x36'));db['MailServerOut']=db[_0x29cd('0x1')][_0x29cd('0x13')]('../api/mailServerOut/mailServerOut.model');db[_0x29cd('0x37')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x38'));db[_0x29cd('0x39')]=db[_0x29cd('0x1')]['import'](_0x29cd('0x3a'));db['MailSubstatus']=db[_0x29cd('0x1')]['import'](_0x29cd('0x3b'));db[_0x29cd('0x3c')]=db['sequelize']['import'](_0x29cd('0x3d'));db[_0x29cd('0x3e')]=db[_0x29cd('0x1')][_0x29cd('0x13')]('../api/mailMessage/mailMessage.model');db[_0x29cd('0x3f')]=db[_0x29cd('0x1')][_0x29cd('0x13')]('../api/mailApplication/mailApplication.model');db[_0x29cd('0x40')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x41'));db[_0x29cd('0x42')]=db[_0x29cd('0x1')]['import']('../api/dashboard/dashboard.model');db[_0x29cd('0x43')]=db[_0x29cd('0x1')][_0x29cd('0x13')]('../api/dashboardItem/dashboardItem.model');db[_0x29cd('0x44')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x45'));db[_0x29cd('0x46')]=db['sequelize']['import'](_0x29cd('0x47'));db[_0x29cd('0x48')]=db['sequelize'][_0x29cd('0x13')](_0x29cd('0x49'));db[_0x29cd('0x4a')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x4b'));db[_0x29cd('0x4c')]=db[_0x29cd('0x1')]['import'](_0x29cd('0x4d'));db['FaxQueueReport']=db[_0x29cd('0x1')]['import']('../api/faxQueueReport/faxQueueReport.model');db[_0x29cd('0x4e')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x4f'));db['SmsApplication']=db[_0x29cd('0x1')]['import'](_0x29cd('0x50'));db['SmsInteraction']=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x51'));db[_0x29cd('0x52')]=db[_0x29cd('0x1')][_0x29cd('0x13')]('../api/smsMessage/smsMessage.model');db[_0x29cd('0x53')]=db[_0x29cd('0x1')]['import']('../api/smsQueue/smsQueue.model');db[_0x29cd('0x54')]=db[_0x29cd('0x1')][_0x29cd('0x13')]('../api/openchannelAccount/openchannelAccount.model');db['OpenchannelApplication']=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x55'));db[_0x29cd('0x56')]=db[_0x29cd('0x1')][_0x29cd('0x13')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x29cd('0x57')]=db['sequelize'][_0x29cd('0x13')](_0x29cd('0x58'));db['OpenchannelQueue']=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x59'));db[_0x29cd('0x5a')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x5b'));db[_0x29cd('0x5c')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x5d'));db[_0x29cd('0x5e')]=db[_0x29cd('0x1')]['import'](_0x29cd('0x5f'));db[_0x29cd('0x60')]=db['sequelize']['import'](_0x29cd('0x61'));db['ChatMessage']=db[_0x29cd('0x1')]['import'](_0x29cd('0x62'));db[_0x29cd('0x63')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x64'));db[_0x29cd('0x65')]=db['sequelize']['import']('../api/chatQueue/chatQueue.model');db[_0x29cd('0x66')]=db[_0x29cd('0x1')]['import']('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db['sequelize'][_0x29cd('0x13')](_0x29cd('0x67'));db[_0x29cd('0x68')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x69'));db[_0x29cd('0x6a')]=db['sequelize'][_0x29cd('0x13')](_0x29cd('0x6b'));db[_0x29cd('0x6c')]=db[_0x29cd('0x1')]['import'](_0x29cd('0x6d'));db[_0x29cd('0x6e')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x6f'));db[_0x29cd('0x70')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x71'));db[_0x29cd('0x72')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x73'));db[_0x29cd('0x74')]=db['sequelize'][_0x29cd('0x13')](_0x29cd('0x75'));db[_0x29cd('0x76')]=db['sequelize'][_0x29cd('0x13')](_0x29cd('0x77'));db[_0x29cd('0x78')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x79'));db[_0x29cd('0x7a')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x7b'));db[_0x29cd('0x7c')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x7d'));db[_0x29cd('0x7e')]=db[_0x29cd('0x1')]['import']('../api/disposition/disposition.model');db[_0x29cd('0x7f')]=db['sequelize'][_0x29cd('0x13')](_0x29cd('0x80'));db['Interval']=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x81'));db[_0x29cd('0x82')]=db['sequelize'][_0x29cd('0x13')]('../api/pause/pause.model');db[_0x29cd('0x83')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x84'));db[_0x29cd('0x85')]=db['sequelize'][_0x29cd('0x13')](_0x29cd('0x86'));db['Schedule']=db[_0x29cd('0x1')][_0x29cd('0x13')]('../api/schedule/schedule.model');db[_0x29cd('0x87')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x88'));db['Tag']=db[_0x29cd('0x1')]['import'](_0x29cd('0x89'));db[_0x29cd('0x8a')]=db['sequelize'][_0x29cd('0x13')](_0x29cd('0x8b'));db['Trigger']=db['sequelize'][_0x29cd('0x13')](_0x29cd('0x8c'));db['Variable']=db[_0x29cd('0x1')]['import'](_0x29cd('0x8d'));db[_0x29cd('0x8e')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x8f'));db[_0x29cd('0x90')]=db['sequelize'][_0x29cd('0x13')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db['sequelize'][_0x29cd('0x13')](_0x29cd('0x91'));db[_0x29cd('0x92')]=db['sequelize'][_0x29cd('0x13')](_0x29cd('0x93'));db[_0x29cd('0x94')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x95'));db[_0x29cd('0x96')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x97'));db[_0x29cd('0x98')]=db['sequelize'][_0x29cd('0x13')](_0x29cd('0x99'));db[_0x29cd('0x9a')]=db['sequelize'][_0x29cd('0x13')](_0x29cd('0x9b'));db[_0x29cd('0x9c')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x9d'));db[_0x29cd('0x9e')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x9f'));db[_0x29cd('0xa0')]=db[_0x29cd('0x1')]['import'](_0x29cd('0xa1'));db[_0x29cd('0xa2')]=db[_0x29cd('0x1')]['import'](_0x29cd('0xa3'));db[_0x29cd('0xa4')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xa5'));db[_0x29cd('0xa6')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xa7'));db[_0x29cd('0xa8')]=db[_0x29cd('0x1')][_0x29cd('0x13')]('../api/intDeskAccount/intDeskAccount.model');db[_0x29cd('0xa9')]=db[_0x29cd('0x1')][_0x29cd('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x29cd('0xaa')]=db[_0x29cd('0x1')][_0x29cd('0x13')]('../api/intDeskField/intDeskField.model');db[_0x29cd('0xab')]=db[_0x29cd('0x1')][_0x29cd('0x13')]('../api/intZohoAccount/intZohoAccount.model');db[_0x29cd('0xac')]=db['sequelize']['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x29cd('0xad')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xae'));db[_0x29cd('0xaf')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xb0'));db[_0x29cd('0xb1')]=db[_0x29cd('0x1')][_0x29cd('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x29cd('0xb2')]=db['sequelize'][_0x29cd('0x13')](_0x29cd('0xb3'));db['FreshdeskAccount']=db[_0x29cd('0x1')][_0x29cd('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xb4'));db[_0x29cd('0xb5')]=db[_0x29cd('0x1')]['import'](_0x29cd('0xb6'));db['VtigerAccount']=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xb7'));db[_0x29cd('0xb8')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xb9'));db[_0x29cd('0xba')]=db[_0x29cd('0x1')]['import'](_0x29cd('0xbb'));db[_0x29cd('0xbc')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xbd'));db[_0x29cd('0xbe')]=db[_0x29cd('0x1')]['import'](_0x29cd('0xbf'));db[_0x29cd('0xc0')]=db[_0x29cd('0x1')]['import']('../api/intServicenowField/intServicenowField.model');db[_0x29cd('0xc1')]=db[_0x29cd('0x1')][_0x29cd('0x13')]('../api/intDynamics365Account/intDynamics365Account.model');db['Dynamics365Configuration']=db[_0x29cd('0x1')][_0x29cd('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x29cd('0xc2')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xc3'));db['FreshsalesAccount']=db['sequelize'][_0x29cd('0x13')](_0x29cd('0xc4'));db['FreshsalesConfiguration']=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xc5'));db[_0x29cd('0xc6')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xc7'));db['Integration']=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0x8f'));db['Network']=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xc8'));db['ChatQueueReport']=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xc9'));db['ChatInternalMessage']=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xca'));db[_0x29cd('0xcb')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xcc'));db[_0x29cd('0xcd')]=db[_0x29cd('0x1')]['import'](_0x29cd('0xce'));db[_0x29cd('0xcf')]=db[_0x29cd('0x1')]['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x29cd('0xd0')]=db['sequelize']['import'](_0x29cd('0xd1'));db[_0x29cd('0xd2')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xd3'));db[_0x29cd('0xd4')]=db[_0x29cd('0x1')]['import']('../api/squareReportDetail/squareReportDetail.model');db['JscriptyProject']=db[_0x29cd('0x1')][_0x29cd('0x13')]('../api/jscriptyProject/jscriptyProject.model');db[_0x29cd('0xd5')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xd6'));db[_0x29cd('0xd7')]=db[_0x29cd('0x1')][_0x29cd('0x13')]('../api/squareOdbc/squareOdbc.model');db[_0x29cd('0xd8')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xd9'));db[_0x29cd('0xda')]=db[_0x29cd('0x1')]['import'](_0x29cd('0xdb'));db[_0x29cd('0xdc')]=db[_0x29cd('0x1')]['import'](_0x29cd('0xdd'));db[_0x29cd('0xde')]=db[_0x29cd('0x1')]['import']('../api/team/team.model');db[_0x29cd('0xdf')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xe0'));db[_0x29cd('0xe1')]=db[_0x29cd('0x1')]['import'](_0x29cd('0xe2'));db['Migration']=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xe3'));db[_0x29cd('0xe4')]=db[_0x29cd('0x1')][_0x29cd('0x13')]('../api/attachment/attachment.model');db[_0x29cd('0xe5')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xe6'));db[_0x29cd('0xe7')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xe8'));db['ChatTransferReport']=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xe9'));db[_0x29cd('0xea')]=db[_0x29cd('0x1')]['import']('../api/faxTransferReport/faxTransferReport.model');db[_0x29cd('0xeb')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xec'));db['SmsTransferReport']=db[_0x29cd('0x1')]['import'](_0x29cd('0xed'));db[_0x29cd('0xee')]=db[_0x29cd('0x1')]['import']('../api/cmList/cmList.model');db[_0x29cd('0xef')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xf0'));db[_0x29cd('0xf1')]=db[_0x29cd('0x1')][_0x29cd('0x13')](_0x29cd('0xf2'));db[_0x29cd('0xf3')]=db[_0x29cd('0x1')][_0x29cd('0x13')]('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db['sequelize'][_0x29cd('0x13')](_0x29cd('0xf4'));db[_0x29cd('0xf5')][_0x29cd('0xf6')](db[_0x29cd('0xf7')],{'as':_0x29cd('0xf7'),'onDelete':_0x29cd('0xf8'),'foreignKey':_0x29cd('0xf9')});db[_0x29cd('0xf5')][_0x29cd('0xfa')](db['VoiceRecording'],{'as':_0x29cd('0xfb'),'foreignKey':_0x29cd('0xf9')});db['User'][_0x29cd('0xfa')](db[_0x29cd('0xfc')],{'as':'VoiceQueuesRt','foreignKey':_0x29cd('0xf9')});db['User'][_0x29cd('0xfa')](db[_0x29cd('0x18')],{'as':_0x29cd('0xfd'),'onDelete':_0x29cd('0xf8'),'hooks':!![]});db[_0x29cd('0xf5')][_0x29cd('0xfa')](db[_0x29cd('0x70')],{'as':_0x29cd('0xfe'),'foreignKey':_0x29cd('0xf9')});db[_0x29cd('0xf5')][_0x29cd('0xfa')](db[_0x29cd('0x72')],{'as':_0x29cd('0xff'),'foreignKey':'UserId'});db[_0x29cd('0xf5')][_0x29cd('0xfa')](db[_0x29cd('0x74')],{'as':_0x29cd('0x74'),'foreignKey':_0x29cd('0xf9')});db[_0x29cd('0xf5')][_0x29cd('0xfa')](db[_0x29cd('0x56')],{'as':_0x29cd('0x100'),'foreignKey':_0x29cd('0xf9')});db[_0x29cd('0xf5')][_0x29cd('0xfa')](db[_0x29cd('0x60')],{'as':'ChatInteractions','foreignKey':'UserId'});db[_0x29cd('0xf5')]['hasMany'](db[_0x29cd('0x101')],{'as':'SmsInteractions','foreignKey':_0x29cd('0xf9')});db[_0x29cd('0xf5')][_0x29cd('0xfa')](db['FaxInteraction'],{'as':_0x29cd('0x102'),'foreignKey':_0x29cd('0xf9')});db[_0x29cd('0xf5')][_0x29cd('0xfa')](db[_0x29cd('0x3c')],{'as':'MailInteractions','foreignKey':_0x29cd('0xf9')});db['User'][_0x29cd('0x103')](db[_0x29cd('0xf1')],{'as':_0x29cd('0xf1'),'foreignKey':_0x29cd('0x104')});db[_0x29cd('0xf5')][_0x29cd('0x105')](db['ChatGroup'],{'as':_0x29cd('0x106'),'through':'chat_group_has_users'});db[_0x29cd('0xf5')]['belongsToMany'](db['CmContact'],{'as':_0x29cd('0x107'),'through':_0x29cd('0x108')});db['User']['belongsToMany'](db['CmList'],{'as':_0x29cd('0x109'),'through':_0x29cd('0x10a')});db['User'][_0x29cd('0x105')](db[_0x29cd('0xde')],{'through':_0x29cd('0x10b')});db[_0x29cd('0xf5')][_0x29cd('0x105')](db['MailInteraction'],{'as':_0x29cd('0x10c'),'through':_0x29cd('0x10d')});db[_0x29cd('0xf5')][_0x29cd('0x105')](db['ChatInteraction'],{'as':_0x29cd('0x10e'),'through':'user_has_chat_interactions'});db[_0x29cd('0xf5')]['belongsToMany'](db[_0x29cd('0x48')],{'as':_0x29cd('0x102'),'through':_0x29cd('0x10f')});db[_0x29cd('0xf5')][_0x29cd('0x105')](db[_0x29cd('0x101')],{'as':_0x29cd('0x110'),'through':_0x29cd('0x111')});db['User']['belongsToMany'](db['OpenchannelInteraction'],{'as':_0x29cd('0x100'),'through':_0x29cd('0x112')});db[_0x29cd('0xf5')][_0x29cd('0x105')](db['VoiceQueue'],{'as':_0x29cd('0x113'),'through':_0x29cd('0x2c'),'required':![]});db['User'][_0x29cd('0x105')](db[_0x29cd('0x39')],{'as':_0x29cd('0x114'),'through':'UserMailQueue','required':![]});db['User'][_0x29cd('0x105')](db[_0x29cd('0x65')],{'as':_0x29cd('0x115'),'through':_0x29cd('0x2e'),'required':![],'hooks':!![]});db[_0x29cd('0xf5')][_0x29cd('0x105')](db[_0x29cd('0x4c')],{'as':_0x29cd('0x116'),'through':'UserFaxQueue','required':![]});db[_0x29cd('0xf5')][_0x29cd('0x105')](db[_0x29cd('0x53')],{'as':_0x29cd('0x117'),'through':_0x29cd('0x32'),'required':![]});db[_0x29cd('0xf5')][_0x29cd('0x105')](db['OpenchannelQueue'],{'as':_0x29cd('0x118'),'through':_0x29cd('0x34'),'required':![]});db[_0x29cd('0xf5')][_0x29cd('0x105')](db[_0x29cd('0xee')],{'through':_0x29cd('0x10a')});db[_0x29cd('0xf5')]['belongsToMany'](db[_0x29cd('0xef')],{'as':_0x29cd('0x119'),'through':'user_has_voice_prefixes','required':![]});db[_0x29cd('0xf5')]['belongsToMany'](db['ChatWebsite'],{'as':_0x29cd('0x11a'),'through':_0x29cd('0x11b')});db[_0x29cd('0xf5')][_0x29cd('0x105')](db[_0x29cd('0x44')],{'as':_0x29cd('0x11c'),'through':_0x29cd('0x11d')});db[_0x29cd('0xf5')][_0x29cd('0x105')](db[_0x29cd('0x37')],{'as':'MailAccounts','through':_0x29cd('0x11e')});db[_0x29cd('0xf5')][_0x29cd('0x105')](db[_0x29cd('0x54')],{'as':_0x29cd('0x11f'),'through':_0x29cd('0x120')});db[_0x29cd('0xf5')][_0x29cd('0x105')](db[_0x29cd('0x4e')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db[_0x29cd('0xf5')][_0x29cd('0x105')](db[_0x29cd('0xd8')],{'as':_0x29cd('0x121'),'through':_0x29cd('0x122')});db[_0x29cd('0x15')]['hasMany'](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':_0x29cd('0xf8'),'foreignKey':_0x29cd('0x123')});db['VoiceContext'][_0x29cd('0xfa')](db[_0x29cd('0x18')],{'onDelete':_0x29cd('0xf8')});db['VoiceExtension']['hasMany'](db[_0x29cd('0x18')],{'as':'Applications','onDelete':_0x29cd('0xf8')});db[_0x29cd('0x19')][_0x29cd('0x105')](db[_0x29cd('0x87')],{'as':_0x29cd('0x124'),'through':_0x29cd('0x125')});db[_0x29cd('0x1b')][_0x29cd('0xfa')](db[_0x29cd('0xfc')],{'as':'Members','foreignKey':_0x29cd('0x126')});db['VoiceQueue'][_0x29cd('0xfa')](db[_0x29cd('0x6c')],{'as':_0x29cd('0x127'),'foreignKey':_0x29cd('0x126')});db['VoiceQueue']['hasMany'](db['CmHopperFinal'],{'as':_0x29cd('0xfe'),'foreignKey':_0x29cd('0x126')});db[_0x29cd('0x1b')][_0x29cd('0xfa')](db[_0x29cd('0x72')],{'as':_0x29cd('0x128'),'foreignKey':_0x29cd('0x126')});db[_0x29cd('0x1b')][_0x29cd('0xfa')](db[_0x29cd('0x74')],{'as':_0x29cd('0x74'),'foreignKey':_0x29cd('0x126')});db['VoiceQueue'][_0x29cd('0xfa')](db['CmHopperBlack'],{'as':_0x29cd('0x129'),'foreignKey':_0x29cd('0x126')});db['VoiceQueue'][_0x29cd('0xfa')](db[_0x29cd('0xcf')],{'as':_0x29cd('0x12a'),'foreignKey':_0x29cd('0x126')});db[_0x29cd('0x1b')]['belongsTo'](db['Trunk'],{'as':_0x29cd('0x28'),'foreignKey':_0x29cd('0x12b')});db['VoiceQueue'][_0x29cd('0x103')](db[_0x29cd('0x28')],{'as':_0x29cd('0x12c'),'foreignKey':_0x29cd('0x12d')});db[_0x29cd('0x1b')]['belongsTo'](db['Interval'],{'as':_0x29cd('0x12e'),'foreignKey':'IntervalId'});db[_0x29cd('0x1b')][_0x29cd('0x103')](db[_0x29cd('0x82')],{'as':_0x29cd('0x12f'),'foreignKey':_0x29cd('0x130')});db[_0x29cd('0x1b')][_0x29cd('0x105')](db[_0x29cd('0xee')],{'as':_0x29cd('0x109'),'through':_0x29cd('0x131')});db[_0x29cd('0x1b')][_0x29cd('0x105')](db[_0x29cd('0xf5')],{'as':_0x29cd('0x132'),'through':'UserVoiceQueue'});db[_0x29cd('0x1b')]['belongsToMany'](db[_0x29cd('0xde')],{'as':_0x29cd('0x133'),'through':_0x29cd('0x134')});db[_0x29cd('0x1b')][_0x29cd('0x105')](db['CmList'],{'as':_0x29cd('0x135'),'through':_0x29cd('0x136')});db[_0x29cd('0x137')]['belongsTo'](db[_0x29cd('0xf5')],{'as':'User','foreignKey':'UserId'});db[_0x29cd('0x1e')][_0x29cd('0x103')](db[_0x29cd('0xf5')],{'as':_0x29cd('0xf5'),'foreignKey':'UserId'});db['VoiceMail']['hasMany'](db['VoiceMailMessage'],{'as':_0x29cd('0x138'),'onDelete':_0x29cd('0xf8'),'foreignKey':_0x29cd('0x139'),'sourceKey':_0x29cd('0x13a')});db['VoiceMailMessage'][_0x29cd('0x103')](db[_0x29cd('0xf7')],{'foreignKey':_0x29cd('0x139'),'targetKey':_0x29cd('0x13a')});db[_0x29cd('0x22')]['hasMany'](db['VoiceQueueReport'],{'as':'QueueCalls','foreignKey':_0x29cd('0x13b'),'constraints':![]});db['VoiceCallReport'][_0x29cd('0xfa')](db[_0x29cd('0x24')],{'as':_0x29cd('0x13c'),'foreignKey':_0x29cd('0x13b'),'constraints':![]});db['VoiceCallReport'][_0x29cd('0x103')](db['User'],{'as':_0x29cd('0xf5'),'foreignKey':_0x29cd('0xf9')});db[_0x29cd('0x22')][_0x29cd('0x103')](db[_0x29cd('0x6a')],{'as':_0x29cd('0x13d'),'foreignKey':_0x29cd('0x13e')});db['MailServerIn'][_0x29cd('0x103')](db['MailAccount'],{'as':_0x29cd('0x37'),'foreignKey':'MailAccountId'});db[_0x29cd('0x13f')]['belongsTo'](db[_0x29cd('0x37')],{'as':_0x29cd('0x37'),'foreignKey':_0x29cd('0x140')});db['MailAccount'][_0x29cd('0xf6')](db[_0x29cd('0x141')],{'as':_0x29cd('0x142'),'onDelete':_0x29cd('0xf8')});db[_0x29cd('0x37')][_0x29cd('0xf6')](db[_0x29cd('0x13f')],{'as':_0x29cd('0x143'),'onDelete':_0x29cd('0xf8')});db[_0x29cd('0x37')][_0x29cd('0xfa')](db[_0x29cd('0x7e')],{'as':_0x29cd('0x144'),'foreignKey':_0x29cd('0x140')});db['MailAccount'][_0x29cd('0xfa')](db[_0x29cd('0x7c')],{'as':_0x29cd('0x145'),'foreignKey':_0x29cd('0x140')});db[_0x29cd('0x37')][_0x29cd('0xfa')](db[_0x29cd('0x3e')],{'as':'Messages','foreignKey':_0x29cd('0x140')});db[_0x29cd('0x37')][_0x29cd('0xfa')](db[_0x29cd('0x3c')],{'as':'Interactions'});db['MailAccount'][_0x29cd('0xfa')](db[_0x29cd('0x3f')],{'as':_0x29cd('0x146')});db[_0x29cd('0x37')]['belongsTo'](db[_0x29cd('0xee')],{'as':'List','foreignKey':_0x29cd('0x147')});db[_0x29cd('0x37')][_0x29cd('0x103')](db[_0x29cd('0x8a')],{'as':_0x29cd('0x8a'),'foreignKey':_0x29cd('0x148')});db[_0x29cd('0x37')][_0x29cd('0x103')](db[_0x29cd('0x82')],{'as':_0x29cd('0x12f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x29cd('0x37')][_0x29cd('0x105')](db[_0x29cd('0xf5')],{'as':'Agents','through':'user_has_mail_accounts'});db[_0x29cd('0x39')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x29cd('0x149')});db['MailQueue'][_0x29cd('0x105')](db[_0x29cd('0xde')],{'through':_0x29cd('0x14a'),'as':'Teams'});db[_0x29cd('0x3c')]['hasMany'](db['MailMessage'],{'as':_0x29cd('0x138'),'onDelete':'cascade','foreignKey':_0x29cd('0x14b')});db['MailInteraction']['belongsTo'](db[_0x29cd('0x37')],{'as':'Account','foreignKey':_0x29cd('0x140')});db[_0x29cd('0x3c')][_0x29cd('0x103')](db[_0x29cd('0x6a')],{'as':_0x29cd('0x13d'),'foreignKey':_0x29cd('0x13e')});db[_0x29cd('0x3c')][_0x29cd('0x103')](db[_0x29cd('0xf5')],{'as':_0x29cd('0x14c'),'foreignKey':_0x29cd('0xf9')});db[_0x29cd('0x3c')][_0x29cd('0x105')](db[_0x29cd('0x14d')],{'through':_0x29cd('0x14e'),'as':_0x29cd('0x14f')});db[_0x29cd('0x3c')]['belongsToMany'](db[_0x29cd('0x14d')],{'through':_0x29cd('0x14e'),'as':_0x29cd('0x150')});db['MailInteraction'][_0x29cd('0x105')](db[_0x29cd('0xf5')],{'as':'Users','through':_0x29cd('0x10d'),'foreignKey':_0x29cd('0x14b')});db[_0x29cd('0x3e')][_0x29cd('0xfa')](db[_0x29cd('0xe4')],{'as':_0x29cd('0x151'),'onDelete':_0x29cd('0xf8')});db[_0x29cd('0x3e')][_0x29cd('0x103')](db['User'],{'as':_0x29cd('0xf5')});db[_0x29cd('0x3e')]['belongsTo'](db[_0x29cd('0x6a')],{'onDelete':_0x29cd('0xf8'),'as':_0x29cd('0x13d')});db[_0x29cd('0x3e')]['belongsTo'](db[_0x29cd('0x3c')],{'as':_0x29cd('0x152'),'foreignKey':_0x29cd('0x14b')});db[_0x29cd('0x3e')]['belongsTo'](db[_0x29cd('0x37')],{'as':_0x29cd('0x153'),'foreignKey':'MailAccountId'});db[_0x29cd('0x3f')][_0x29cd('0x103')](db[_0x29cd('0xf5')],{'onDelete':'restrict'});db['MailApplication'][_0x29cd('0x103')](db['MailQueue'],{'onDelete':'restrict'});db[_0x29cd('0x3f')][_0x29cd('0x103')](db[_0x29cd('0x37')],{'onDelete':'restrict'});db[_0x29cd('0x3f')][_0x29cd('0x103')](db[_0x29cd('0x12e')],{'onDelete':_0x29cd('0x154'),'foreignKey':'IntervalId'});db['MailApplication'][_0x29cd('0x103')](db[_0x29cd('0x14d')],{'onDelete':'restrict','foreignKey':_0x29cd('0x155')});db[_0x29cd('0x40')][_0x29cd('0x103')](db['MailAccount'],{});db[_0x29cd('0x40')][_0x29cd('0x103')](db[_0x29cd('0xee')],{'as':'List','foreignKey':_0x29cd('0x147')});db[_0x29cd('0x40')][_0x29cd('0x103')](db[_0x29cd('0x6a')],{'as':'Contact','foreignKey':_0x29cd('0x13e')});db[_0x29cd('0x40')][_0x29cd('0x103')](db[_0x29cd('0x3c')],{});db[_0x29cd('0x40')][_0x29cd('0x103')](db[_0x29cd('0x3e')],{});db[_0x29cd('0x40')][_0x29cd('0x103')](db[_0x29cd('0xf5')],{});db[_0x29cd('0x40')]['belongsTo'](db[_0x29cd('0x39')],{});db['Dashboard']['hasMany'](db[_0x29cd('0x43')],{'as':_0x29cd('0x156'),'onDelete':'cascade'});db[_0x29cd('0x44')][_0x29cd('0xfa')](db[_0x29cd('0x7e')],{'as':_0x29cd('0x144'),'foreignKey':_0x29cd('0x157')});db['FaxAccount'][_0x29cd('0xfa')](db['CannedAnswer'],{'as':_0x29cd('0x145'),'foreignKey':_0x29cd('0x157')});db[_0x29cd('0x44')][_0x29cd('0xfa')](db[_0x29cd('0x48')],{'as':_0x29cd('0x158')});db[_0x29cd('0x44')]['hasMany'](db[_0x29cd('0x46')],{'as':'Applications'});db[_0x29cd('0x44')][_0x29cd('0xfa')](db['VoiceExtension'],{'as':_0x29cd('0x159'),'onDelete':_0x29cd('0xf8')});db[_0x29cd('0x44')][_0x29cd('0xfa')](db[_0x29cd('0x4a')],{'as':_0x29cd('0x138')});db[_0x29cd('0x44')][_0x29cd('0x103')](db[_0x29cd('0x28')],{'as':'Trunk'});db['FaxAccount']['belongsTo'](db[_0x29cd('0xee')],{'as':_0x29cd('0x15a'),'foreignKey':_0x29cd('0x147')});db['FaxAccount'][_0x29cd('0x103')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x29cd('0x130')});db[_0x29cd('0x44')]['belongsToMany'](db[_0x29cd('0xf5')],{'as':'Agents','through':_0x29cd('0x11d')});db[_0x29cd('0x46')][_0x29cd('0x103')](db[_0x29cd('0xf5')],{'onDelete':'restrict'});db[_0x29cd('0x46')]['belongsTo'](db[_0x29cd('0x4c')],{'onDelete':_0x29cd('0x154')});db[_0x29cd('0x46')][_0x29cd('0x103')](db[_0x29cd('0x44')],{'onDelete':'restrict'});db[_0x29cd('0x46')]['belongsTo'](db[_0x29cd('0x14d')],{'onDelete':_0x29cd('0x154'),'foreignKey':_0x29cd('0x155')});db[_0x29cd('0x48')]['hasMany'](db[_0x29cd('0x4a')],{'as':_0x29cd('0x138'),'onDelete':_0x29cd('0xf8'),'foreignKey':_0x29cd('0x15b')});db[_0x29cd('0x48')]['belongsTo'](db[_0x29cd('0x44')],{'as':'Account','foreignKey':_0x29cd('0x157')});db[_0x29cd('0x48')]['belongsTo'](db[_0x29cd('0x6a')],{'as':_0x29cd('0x13d'),'foreignKey':'ContactId'});db['FaxInteraction'][_0x29cd('0x103')](db[_0x29cd('0xf5')],{'as':_0x29cd('0x14c'),'foreignKey':_0x29cd('0xf9')});db['FaxInteraction'][_0x29cd('0x105')](db[_0x29cd('0x14d')],{'through':'fax_interaction_has_tags','as':_0x29cd('0x14f')});db[_0x29cd('0x48')][_0x29cd('0x105')](db[_0x29cd('0x14d')],{'through':_0x29cd('0x15c'),'as':'ThroughTags'});db[_0x29cd('0x48')]['belongsToMany'](db[_0x29cd('0xf5')],{'as':_0x29cd('0x15d'),'through':_0x29cd('0x10f'),'foreignKey':_0x29cd('0x15b')});db['FaxMessage'][_0x29cd('0x103')](db[_0x29cd('0xf5')],{'onDelete':_0x29cd('0xf8'),'as':_0x29cd('0xf5')});db['FaxMessage']['belongsTo'](db['FaxInteraction'],{'as':_0x29cd('0x152'),'foreignKey':'FaxInteractionId'});db[_0x29cd('0x4a')][_0x29cd('0x103')](db['CmContact'],{'onDelete':_0x29cd('0xf8'),'as':_0x29cd('0x13d')});db['FaxMessage']['belongsTo'](db[_0x29cd('0xe4')],{'as':_0x29cd('0xe4'),'foreignKey':_0x29cd('0x15e')});db[_0x29cd('0x4a')]['belongsTo'](db[_0x29cd('0x44')],{'as':_0x29cd('0x153'),'foreignKey':_0x29cd('0x157')});db[_0x29cd('0x4c')][_0x29cd('0x105')](db[_0x29cd('0xf5')],{'as':_0x29cd('0x132'),'through':_0x29cd('0x30')});db[_0x29cd('0x4c')][_0x29cd('0x105')](db[_0x29cd('0xde')],{'through':_0x29cd('0x15f'),'as':_0x29cd('0x133')});db['FaxQueueReport'][_0x29cd('0x103')](db[_0x29cd('0x44')],{});db[_0x29cd('0x160')]['belongsTo'](db[_0x29cd('0xee')],{'as':_0x29cd('0x15a'),'foreignKey':_0x29cd('0x147')});db[_0x29cd('0x160')][_0x29cd('0x103')](db[_0x29cd('0x6a')],{'as':'Contact','foreignKey':_0x29cd('0x13e')});db[_0x29cd('0x160')]['belongsTo'](db[_0x29cd('0x48')],{});db['FaxQueueReport']['belongsTo'](db[_0x29cd('0x4a')],{});db[_0x29cd('0x160')][_0x29cd('0x103')](db['User'],{});db['FaxQueueReport']['belongsTo'](db[_0x29cd('0x4c')],{});db[_0x29cd('0x4e')][_0x29cd('0xfa')](db[_0x29cd('0x7e')],{'as':_0x29cd('0x144'),'foreignKey':_0x29cd('0x161')});db['SmsAccount']['hasMany'](db[_0x29cd('0x7c')],{'as':_0x29cd('0x145'),'foreignKey':'SmsAccountId'});db[_0x29cd('0x4e')][_0x29cd('0xfa')](db[_0x29cd('0x52')],{'as':'Messages','foreignKey':_0x29cd('0x161')});db['SmsAccount'][_0x29cd('0xfa')](db[_0x29cd('0x101')],{'as':_0x29cd('0x158')});db[_0x29cd('0x4e')][_0x29cd('0xfa')](db[_0x29cd('0x162')],{'as':_0x29cd('0x146')});db[_0x29cd('0x4e')][_0x29cd('0x103')](db[_0x29cd('0xee')],{'as':'List','foreignKey':_0x29cd('0x147')});db[_0x29cd('0x4e')]['belongsTo'](db[_0x29cd('0x82')],{'as':'mandatoryDispositionPause','foreignKey':_0x29cd('0x130')});db[_0x29cd('0x4e')][_0x29cd('0x105')](db[_0x29cd('0xf5')],{'as':_0x29cd('0x132'),'through':_0x29cd('0x163')});db[_0x29cd('0x162')][_0x29cd('0x103')](db[_0x29cd('0xf5')],{'onDelete':_0x29cd('0x154')});db[_0x29cd('0x162')][_0x29cd('0x103')](db[_0x29cd('0x53')],{'onDelete':_0x29cd('0x154')});db[_0x29cd('0x162')][_0x29cd('0x103')](db[_0x29cd('0x4e')],{'onDelete':_0x29cd('0x154')});db['SmsApplication'][_0x29cd('0x103')](db[_0x29cd('0x12e')],{'onDelete':_0x29cd('0x154'),'foreignKey':_0x29cd('0x164')});db['SmsApplication'][_0x29cd('0x103')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x29cd('0x155')});db[_0x29cd('0x101')][_0x29cd('0xfa')](db['SmsMessage'],{'as':_0x29cd('0x138'),'onDelete':_0x29cd('0xf8'),'foreignKey':'SmsInteractionId'});db[_0x29cd('0x101')][_0x29cd('0x103')](db[_0x29cd('0x4e')],{'as':_0x29cd('0x153'),'foreignKey':'SmsAccountId'});db[_0x29cd('0x101')][_0x29cd('0x103')](db[_0x29cd('0x6a')],{'as':_0x29cd('0x13d'),'foreignKey':_0x29cd('0x13e')});db[_0x29cd('0x101')][_0x29cd('0x103')](db[_0x29cd('0xf5')],{'as':'Owner','foreignKey':_0x29cd('0xf9')});db[_0x29cd('0x101')][_0x29cd('0x105')](db[_0x29cd('0x14d')],{'through':_0x29cd('0x165'),'as':_0x29cd('0x14f')});db[_0x29cd('0x101')][_0x29cd('0x105')](db[_0x29cd('0x14d')],{'through':'sms_interaction_has_tags','as':_0x29cd('0x150')});db[_0x29cd('0x101')][_0x29cd('0x105')](db[_0x29cd('0xf5')],{'as':_0x29cd('0x15d'),'through':_0x29cd('0x111'),'foreignKey':_0x29cd('0x166')});db['SmsMessage']['belongsTo'](db[_0x29cd('0xf5')],{'as':_0x29cd('0xf5')});db[_0x29cd('0x52')][_0x29cd('0x103')](db[_0x29cd('0x6a')],{'onDelete':_0x29cd('0xf8'),'as':_0x29cd('0x13d')});db[_0x29cd('0x52')][_0x29cd('0x103')](db[_0x29cd('0x101')],{'onDelete':_0x29cd('0xf8'),'as':_0x29cd('0x152'),'foreignKey':_0x29cd('0x166')});db[_0x29cd('0x52')][_0x29cd('0x103')](db[_0x29cd('0x4e')],{'as':_0x29cd('0x153'),'foreignKey':_0x29cd('0x161')});db['SmsQueue']['belongsToMany'](db[_0x29cd('0xf5')],{'as':_0x29cd('0x132'),'through':_0x29cd('0x32'),'foreignKey':'SmsQueueId'});db[_0x29cd('0x53')][_0x29cd('0x105')](db[_0x29cd('0xde')],{'through':_0x29cd('0x167'),'as':_0x29cd('0x133')});db[_0x29cd('0x54')]['hasMany'](db[_0x29cd('0x7e')],{'as':_0x29cd('0x144'),'foreignKey':_0x29cd('0x168')});db['OpenchannelAccount'][_0x29cd('0xfa')](db[_0x29cd('0x7c')],{'as':_0x29cd('0x145'),'foreignKey':_0x29cd('0x168')});db['OpenchannelAccount'][_0x29cd('0xfa')](db[_0x29cd('0x56')],{'as':_0x29cd('0x158'),'foreignKey':_0x29cd('0x168')});db['OpenchannelAccount'][_0x29cd('0xfa')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0x29cd('0x168')});db[_0x29cd('0x54')][_0x29cd('0xfa')](db[_0x29cd('0x169')],{'as':'Applications','foreignKey':_0x29cd('0x168')});db['OpenchannelAccount'][_0x29cd('0x103')](db[_0x29cd('0xee')],{'as':_0x29cd('0x15a'),'foreignKey':_0x29cd('0x147')});db[_0x29cd('0x54')]['belongsTo'](db['Pause'],{'as':_0x29cd('0x12f'),'foreignKey':_0x29cd('0x130')});db[_0x29cd('0x54')][_0x29cd('0x105')](db['User'],{'as':_0x29cd('0x132'),'through':_0x29cd('0x120')});db[_0x29cd('0x169')][_0x29cd('0x103')](db['User'],{'onDelete':'restrict'});db[_0x29cd('0x169')][_0x29cd('0x103')](db[_0x29cd('0x16a')],{'onDelete':_0x29cd('0x154'),'foreignKey':_0x29cd('0x16b')});db['OpenchannelApplication']['belongsTo'](db[_0x29cd('0x54')],{'onDelete':_0x29cd('0x154'),'foreignKey':_0x29cd('0x168')});db[_0x29cd('0x169')][_0x29cd('0x103')](db[_0x29cd('0x12e')],{'onDelete':_0x29cd('0x154'),'foreignKey':_0x29cd('0x164')});db[_0x29cd('0x169')][_0x29cd('0x103')](db[_0x29cd('0x14d')],{'onDelete':'restrict','foreignKey':_0x29cd('0x155')});db['OpenchannelInteraction'][_0x29cd('0xfa')](db[_0x29cd('0x57')],{'as':'Messages','onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0x29cd('0x56')][_0x29cd('0x103')](db[_0x29cd('0x54')],{'as':_0x29cd('0x153'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction'][_0x29cd('0x103')](db[_0x29cd('0x6a')],{'as':'Contact','foreignKey':'ContactId'});db[_0x29cd('0x56')][_0x29cd('0x103')](db[_0x29cd('0xf5')],{'as':_0x29cd('0x14c'),'foreignKey':'UserId'});db['OpenchannelInteraction']['belongsToMany'](db[_0x29cd('0x14d')],{'through':_0x29cd('0x16c'),'as':'Tags'});db['OpenchannelInteraction'][_0x29cd('0x105')](db[_0x29cd('0x14d')],{'through':_0x29cd('0x16c'),'as':_0x29cd('0x150')});db[_0x29cd('0x56')][_0x29cd('0x105')](db[_0x29cd('0xf5')],{'as':_0x29cd('0x15d'),'through':_0x29cd('0x112'),'foreignKey':_0x29cd('0x16d')});db[_0x29cd('0x57')]['belongsTo'](db[_0x29cd('0xf5')],{'onDelete':_0x29cd('0xf8'),'as':_0x29cd('0xf5')});db['OpenchannelMessage']['belongsTo'](db[_0x29cd('0x6a')],{'onDelete':'cascade','as':_0x29cd('0x13d')});db[_0x29cd('0x57')]['belongsTo'](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0x29cd('0x152'),'foreignKey':_0x29cd('0x16d')});db[_0x29cd('0x57')][_0x29cd('0x103')](db[_0x29cd('0xe4')],{'as':_0x29cd('0xe4'),'foreignKey':_0x29cd('0x15e')});db['OpenchannelMessage'][_0x29cd('0x103')](db['OpenchannelAccount'],{'as':_0x29cd('0x153'),'foreignKey':_0x29cd('0x168')});db[_0x29cd('0x16a')][_0x29cd('0x105')](db[_0x29cd('0xf5')],{'as':_0x29cd('0x132'),'through':_0x29cd('0x34'),'foreignKey':_0x29cd('0x16b')});db[_0x29cd('0x16a')]['belongsToMany'](db['Team'],{'through':'team_has_openchannel_queues','as':_0x29cd('0x133')});db[_0x29cd('0x5a')][_0x29cd('0xfa')](db['Disposition'],{'as':_0x29cd('0x144'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite']['hasMany'](db[_0x29cd('0x7c')],{'as':'Answers','foreignKey':_0x29cd('0x16e')});db[_0x29cd('0x5a')][_0x29cd('0xfa')](db[_0x29cd('0x16f')],{'as':_0x29cd('0x170')});db[_0x29cd('0x5a')][_0x29cd('0xfa')](db['ChatInteraction'],{'as':_0x29cd('0x158')});db[_0x29cd('0x5a')][_0x29cd('0xfa')](db[_0x29cd('0x5e')],{'as':_0x29cd('0x146')});db[_0x29cd('0x5a')][_0x29cd('0xfa')](db[_0x29cd('0x171')],{'as':_0x29cd('0x138')});db[_0x29cd('0x5a')][_0x29cd('0x103')](db[_0x29cd('0xee')],{'as':_0x29cd('0x15a'),'foreignKey':_0x29cd('0x147')});db[_0x29cd('0x5a')][_0x29cd('0x103')](db[_0x29cd('0x12e')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x29cd('0x5a')][_0x29cd('0x103')](db[_0x29cd('0x82')],{'as':'mandatoryDispositionPause','foreignKey':_0x29cd('0x130')});db[_0x29cd('0x5a')]['belongsToMany'](db[_0x29cd('0xf5')],{'as':_0x29cd('0x132'),'through':_0x29cd('0x11b')});db[_0x29cd('0x5c')][_0x29cd('0x103')](db[_0x29cd('0x54')],{});db['OpenchannelQueueReport'][_0x29cd('0x103')](db[_0x29cd('0xee')],{'as':_0x29cd('0x15a'),'foreignKey':_0x29cd('0x147')});db['OpenchannelQueueReport'][_0x29cd('0x103')](db[_0x29cd('0x6a')],{'as':_0x29cd('0x13d'),'foreignKey':_0x29cd('0x13e')});db[_0x29cd('0x5c')][_0x29cd('0x103')](db['OpenchannelInteraction'],{});db[_0x29cd('0x5c')]['belongsTo'](db['OpenchannelMessage'],{});db[_0x29cd('0x5c')][_0x29cd('0x103')](db[_0x29cd('0xf5')],{});db[_0x29cd('0x5c')][_0x29cd('0x103')](db[_0x29cd('0x16a')],{});db[_0x29cd('0x5e')][_0x29cd('0x103')](db[_0x29cd('0xf5')],{'as':'Agent','foreignKey':'UserId','onDelete':_0x29cd('0x154')});db[_0x29cd('0x5e')][_0x29cd('0x103')](db[_0x29cd('0x65')],{'as':_0x29cd('0x172'),'foreignKey':_0x29cd('0x173'),'onDelete':'restrict'});db[_0x29cd('0x5e')]['belongsTo'](db[_0x29cd('0x5a')],{'as':_0x29cd('0x174'),'foreignKey':_0x29cd('0x16e'),'onDelete':'restrict'});db[_0x29cd('0x5e')][_0x29cd('0x103')](db[_0x29cd('0x14d')],{'onDelete':_0x29cd('0x154'),'foreignKey':_0x29cd('0x155')});db['ChatInteraction']['hasMany'](db[_0x29cd('0x171')],{'as':'Messages','onDelete':_0x29cd('0xf8'),'foreignKey':'ChatInteractionId'});db[_0x29cd('0x60')][_0x29cd('0x103')](db['ChatWebsite'],{'as':_0x29cd('0x153'),'foreignKey':_0x29cd('0x16e')});db[_0x29cd('0x60')][_0x29cd('0x103')](db[_0x29cd('0x6a')],{'as':_0x29cd('0x13d'),'foreignKey':_0x29cd('0x13e')});db[_0x29cd('0x60')][_0x29cd('0x103')](db[_0x29cd('0xf5')],{'as':_0x29cd('0x14c'),'foreignKey':'UserId'});db[_0x29cd('0x60')][_0x29cd('0x105')](db[_0x29cd('0x14d')],{'through':_0x29cd('0x175'),'as':_0x29cd('0x14f')});db['ChatInteraction']['belongsToMany'](db[_0x29cd('0x14d')],{'through':_0x29cd('0x175'),'as':_0x29cd('0x150')});db[_0x29cd('0x60')][_0x29cd('0x105')](db[_0x29cd('0xf5')],{'as':_0x29cd('0x15d'),'through':_0x29cd('0x176'),'foreignKey':_0x29cd('0x177')});db[_0x29cd('0x171')]['belongsTo'](db[_0x29cd('0xf5')],{'onDelete':_0x29cd('0xf8'),'as':_0x29cd('0xf5')});db[_0x29cd('0x171')][_0x29cd('0x103')](db['CmContact'],{'onDelete':'cascade','as':'Contact','foreignKey':'ContactId'});db[_0x29cd('0x171')][_0x29cd('0x103')](db[_0x29cd('0x60')],{'onDelete':_0x29cd('0xf8'),'as':_0x29cd('0x152'),'foreignKey':_0x29cd('0x177')});db[_0x29cd('0x171')]['belongsTo'](db['Attachment'],{'as':_0x29cd('0xe4'),'foreignKey':_0x29cd('0x15e')});db[_0x29cd('0x171')]['belongsTo'](db[_0x29cd('0x5a')],{'as':_0x29cd('0x153'),'foreignKey':_0x29cd('0x16e')});db[_0x29cd('0x63')][_0x29cd('0x103')](db[_0x29cd('0x6a')],{'onDelete':'cascade','as':_0x29cd('0x13d'),'foreignKey':'ContactId'});db['ChatOfflineMessage']['belongsTo'](db['ChatWebsite'],{'as':_0x29cd('0x153'),'foreignKey':_0x29cd('0x16e')});db[_0x29cd('0x65')][_0x29cd('0x105')](db['User'],{'as':_0x29cd('0x132'),'through':_0x29cd('0x2e'),'hooks':!![]});db[_0x29cd('0x65')]['belongsToMany'](db[_0x29cd('0xde')],{'through':_0x29cd('0x178'),'as':'Teams'});db['ChatGroup'][_0x29cd('0xfa')](db[_0x29cd('0x179')],{'as':'Messages','foreignKey':_0x29cd('0x17a'),'onDelete':_0x29cd('0xf8')});db[_0x29cd('0x66')][_0x29cd('0x105')](db['User'],{'as':_0x29cd('0x17b'),'through':_0x29cd('0x17c')});db[_0x29cd('0x16f')][_0x29cd('0x103')](db[_0x29cd('0x5a')],{'as':'Website','foreignKey':'ChatWebsiteId'});db[_0x29cd('0x68')][_0x29cd('0xfa')](db[_0x29cd('0x6a')],{'as':_0x29cd('0x107'),'foreignKey':_0x29cd('0x17d')});db[_0x29cd('0x6a')][_0x29cd('0xfa')](db['CmHopper'],{'as':_0x29cd('0x127'),'foreignKey':_0x29cd('0x13e')});db['CmContact'][_0x29cd('0xfa')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x29cd('0x13e')});db[_0x29cd('0x6a')][_0x29cd('0xfa')](db[_0x29cd('0x72')],{'as':_0x29cd('0x128'),'foreignKey':'ContactId'});db[_0x29cd('0x6a')]['hasMany'](db[_0x29cd('0x74')],{'as':_0x29cd('0x74'),'foreignKey':_0x29cd('0x13e')});db['CmContact']['hasMany'](db[_0x29cd('0xcf')],{'as':'JscriptySessions','foreignKey':_0x29cd('0x13e')});db[_0x29cd('0x6a')]['hasMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x29cd('0x154')});db[_0x29cd('0x6a')]['hasMany'](db[_0x29cd('0x60')],{'as':_0x29cd('0x10e'),'foreignKey':_0x29cd('0x13e'),'onDelete':_0x29cd('0x154')});db[_0x29cd('0x6a')][_0x29cd('0xfa')](db[_0x29cd('0x101')],{'as':'SmsInteractions','foreignKey':_0x29cd('0x13e'),'onDelete':_0x29cd('0x154')});db['CmContact'][_0x29cd('0xfa')](db[_0x29cd('0x48')],{'as':'FaxInteractions','foreignKey':_0x29cd('0x13e'),'onDelete':'restrict'});db[_0x29cd('0x6a')][_0x29cd('0xfa')](db[_0x29cd('0x3c')],{'as':_0x29cd('0x10c'),'foreignKey':_0x29cd('0x13e'),'onDelete':_0x29cd('0x154')});db['CmContact'][_0x29cd('0x103')](db[_0x29cd('0x68')],{'as':_0x29cd('0x17e'),'foreignKey':_0x29cd('0x17d')});db['CmContact'][_0x29cd('0x103')](db[_0x29cd('0xee')],{'as':'List','foreignKey':'ListId','onDelete':_0x29cd('0xf8')});db[_0x29cd('0x6a')][_0x29cd('0x105')](db[_0x29cd('0xf5')],{'as':'Users','through':_0x29cd('0x108')});db['CmContact'][_0x29cd('0x105')](db[_0x29cd('0x14d')],{'as':_0x29cd('0x14f'),'through':_0x29cd('0x17f')});db['CmContact'][_0x29cd('0x105')](db[_0x29cd('0x14d')],{'through':_0x29cd('0x17f'),'as':'ThroughTags'});db[_0x29cd('0x6c')][_0x29cd('0x103')](db[_0x29cd('0x6a')],{'as':_0x29cd('0x13d'),'foreignKey':_0x29cd('0x13e'),'onDelete':_0x29cd('0xf8')});db['CmHopper'][_0x29cd('0x103')](db['CmList'],{'as':'List','foreignKey':'ListId','onDelete':_0x29cd('0xf8')});db[_0x29cd('0x6c')][_0x29cd('0x103')](db[_0x29cd('0xf5')],{'as':_0x29cd('0x180'),'foreignKey':_0x29cd('0xf9')});db[_0x29cd('0x6c')][_0x29cd('0x103')](db[_0x29cd('0x1b')],{'as':_0x29cd('0x172'),'foreignKey':_0x29cd('0x126'),'onDelete':_0x29cd('0xf8')});db['CmHopper'][_0x29cd('0x103')](db[_0x29cd('0xe1')],{'as':'Campaign','foreignKey':_0x29cd('0x181'),'onDelete':'cascade'});db[_0x29cd('0x6c')][_0x29cd('0x103')](db['User'],{'as':_0x29cd('0x14c'),'foreignKey':_0x29cd('0x182')});db[_0x29cd('0x6e')][_0x29cd('0x103')](db['CmContact'],{'as':_0x29cd('0x13d'),'foreignKey':_0x29cd('0x13e'),'onDelete':_0x29cd('0xf8')});db[_0x29cd('0x6e')][_0x29cd('0x103')](db[_0x29cd('0xee')],{'as':_0x29cd('0x15a'),'foreignKey':_0x29cd('0x147'),'onDelete':_0x29cd('0xf8')});db['CmHopperBlack'][_0x29cd('0x103')](db[_0x29cd('0x1b')],{'as':_0x29cd('0x172'),'foreignKey':_0x29cd('0x126'),'onDelete':_0x29cd('0xf8')});db[_0x29cd('0x6e')][_0x29cd('0x103')](db['Campaign'],{'as':_0x29cd('0xe1'),'foreignKey':_0x29cd('0x181'),'onDelete':_0x29cd('0xf8')});db[_0x29cd('0x7a')][_0x29cd('0xfa')](db[_0x29cd('0x7f')],{'as':{'plural':_0x29cd('0x183'),'singular':_0x29cd('0x184')},'foreignKey':_0x29cd('0x185'),'onDelete':_0x29cd('0xf8'),'hooks':!![]});db[_0x29cd('0x7a')][_0x29cd('0xfa')](db[_0x29cd('0x7f')],{'as':{'plural':'Any','singular':_0x29cd('0x186')},'foreignKey':_0x29cd('0x187'),'onDelete':_0x29cd('0xf8'),'hooks':!![]});db[_0x29cd('0x7a')]['hasMany'](db[_0x29cd('0x78')],{'as':_0x29cd('0x188'),'foreignKey':_0x29cd('0x189'),'onDelete':_0x29cd('0xf8'),'hooks':!![]});db['Interval']['hasMany'](db[_0x29cd('0x12e')],{'as':_0x29cd('0x18a'),'foreignKey':_0x29cd('0x164'),'onDelete':_0x29cd('0xf8'),'hooks':!![],'required':![]});db[_0x29cd('0x12e')][_0x29cd('0xfa')](db['VoiceExtension'],{'as':_0x29cd('0xfd'),'foreignKey':'IntervalId','onDelete':_0x29cd('0x154')});db['Interval'][_0x29cd('0xfa')](db[_0x29cd('0x3f')],{'as':_0x29cd('0x18b'),'foreignKey':'IntervalId'});db[_0x29cd('0x12e')][_0x29cd('0xfa')](db['ChatApplication'],{'as':_0x29cd('0x18c'),'foreignKey':'IntervalId'});db[_0x29cd('0x12e')][_0x29cd('0xfa')](db[_0x29cd('0x46')],{'as':_0x29cd('0x18d'),'foreignKey':_0x29cd('0x164')});db[_0x29cd('0x12e')][_0x29cd('0xfa')](db[_0x29cd('0x162')],{'as':_0x29cd('0x18e'),'foreignKey':_0x29cd('0x164')});db[_0x29cd('0x18f')][_0x29cd('0x103')](db[_0x29cd('0x37')],{});db['Schedule'][_0x29cd('0x103')](db[_0x29cd('0x92')],{'foreignKey':_0x29cd('0x190')});db['Schedule'][_0x29cd('0x103')](db[_0x29cd('0x191')],{'foreignKey':_0x29cd('0x192')});db[_0x29cd('0x87')][_0x29cd('0x105')](db[_0x29cd('0x19')],{'as':'Mohs','through':_0x29cd('0x125'),'onDelete':_0x29cd('0x154')});db[_0x29cd('0x14d')][_0x29cd('0x105')](db['CmContact'],{'through':_0x29cd('0x17f')});db[_0x29cd('0x14d')][_0x29cd('0x105')](db['ChatInteraction'],{'through':_0x29cd('0x175')});db[_0x29cd('0x14d')][_0x29cd('0x105')](db[_0x29cd('0x3c')],{'through':'mail_interaction_has_tags'});db[_0x29cd('0x14d')][_0x29cd('0x105')](db[_0x29cd('0x101')],{'through':_0x29cd('0x165')});db['Tag']['belongsToMany'](db[_0x29cd('0x48')],{'through':'fax_interaction_has_tags'});db[_0x29cd('0x14d')]['belongsToMany'](db['OpenchannelInteraction'],{'through':_0x29cd('0x16c')});db[_0x29cd('0x193')][_0x29cd('0xfa')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0x29cd('0x194')},'foreignKey':_0x29cd('0x195'),'onDelete':_0x29cd('0xf8'),'hooks':!![]});db[_0x29cd('0x193')][_0x29cd('0xfa')](db['Condition'],{'as':{'plural':_0x29cd('0x196'),'singular':'AnyCondition'},'foreignKey':_0x29cd('0x197'),'onDelete':_0x29cd('0xf8'),'hooks':!![]});db[_0x29cd('0x193')]['hasMany'](db[_0x29cd('0x78')],{'as':_0x29cd('0x188'),'foreignKey':_0x29cd('0x198'),'onDelete':_0x29cd('0xf8'),'hooks':!![]});db[_0x29cd('0x191')]['hasMany'](db[_0x29cd('0x98')],{'as':_0x29cd('0x199'),'onDelete':_0x29cd('0xf8'),'foreignKey':_0x29cd('0x192'),'hooks':!![]});db[_0x29cd('0x92')][_0x29cd('0xfa')](db[_0x29cd('0x98')],{'as':_0x29cd('0x199'),'onDelete':'cascade','foreignKey':_0x29cd('0x190')});db[_0x29cd('0x96')][_0x29cd('0xfa')](db['AnalyticFieldReport'],{'as':_0x29cd('0x199'),'onDelete':_0x29cd('0xf8'),'foreignKey':_0x29cd('0x19a')});db[_0x29cd('0x98')][_0x29cd('0x103')](db[_0x29cd('0x96')],{'foreignKey':_0x29cd('0x19a')});db[_0x29cd('0x9c')]['hasMany'](db['SalesforceConfiguration'],{'as':_0x29cd('0x19b'),'onDelete':_0x29cd('0xf8'),'foreignKey':_0x29cd('0x19c')});db[_0x29cd('0x9e')]['hasMany'](db['SalesforceField'],{'as':_0x29cd('0x19d'),'onDelete':_0x29cd('0xf8'),'foreignKey':_0x29cd('0x19e')});db[_0x29cd('0x9e')]['hasMany'](db[_0x29cd('0xa0')],{'as':_0x29cd('0x19f'),'onDelete':_0x29cd('0xf8'),'foreignKey':_0x29cd('0x1a0')});db[_0x29cd('0x9e')]['hasMany'](db[_0x29cd('0xa0')],{'as':'Fields','onDelete':_0x29cd('0xf8'),'foreignKey':_0x29cd('0x1a1')});db[_0x29cd('0x9e')][_0x29cd('0x103')](db[_0x29cd('0x9c')],{'as':_0x29cd('0x153'),'foreignKey':_0x29cd('0x19c')});db[_0x29cd('0xa0')][_0x29cd('0xfa')](db[_0x29cd('0xa0')],{'as':'Subject','foreignKey':_0x29cd('0x19e')});db[_0x29cd('0xa0')][_0x29cd('0xfa')](db[_0x29cd('0xa0')],{'as':_0x29cd('0x1a2'),'foreignKey':_0x29cd('0x1a0')});db[_0x29cd('0xa0')][_0x29cd('0xfa')](db[_0x29cd('0xa0')],{'as':_0x29cd('0x1a3'),'foreignKey':_0x29cd('0x1a1')});db[_0x29cd('0xa0')]['belongsTo'](db['Variable'],{'as':_0x29cd('0x1a4'),'foreignKey':_0x29cd('0x1a5')});db['SugarcrmAccount'][_0x29cd('0xfa')](db[_0x29cd('0xa4')],{'as':'Configurations','onDelete':_0x29cd('0xf8'),'foreignKey':'AccountId'});db['SugarcrmConfiguration'][_0x29cd('0xfa')](db[_0x29cd('0xa6')],{'as':'Subjects','onDelete':_0x29cd('0xf8'),'foreignKey':_0x29cd('0x19e')});db[_0x29cd('0xa4')][_0x29cd('0xfa')](db[_0x29cd('0xa6')],{'as':_0x29cd('0x19f'),'onDelete':_0x29cd('0xf8'),'foreignKey':_0x29cd('0x1a0')});db['SugarcrmConfiguration'][_0x29cd('0xfa')](db[_0x29cd('0xa6')],{'as':_0x29cd('0x199'),'onDelete':'cascade','foreignKey':_0x29cd('0x1a1')});db[_0x29cd('0xa4')][_0x29cd('0x103')](db[_0x29cd('0xa2')],{'as':_0x29cd('0x153'),'foreignKey':_0x29cd('0x19c')});db[_0x29cd('0xa6')][_0x29cd('0xfa')](db['SugarcrmField'],{'as':_0x29cd('0x1a6'),'foreignKey':_0x29cd('0x19e')});db['SugarcrmField'][_0x29cd('0xfa')](db[_0x29cd('0xa6')],{'as':_0x29cd('0x1a2'),'foreignKey':_0x29cd('0x1a0')});db['SugarcrmField'][_0x29cd('0xfa')](db[_0x29cd('0xa6')],{'as':_0x29cd('0x1a3'),'foreignKey':_0x29cd('0x1a1')});db[_0x29cd('0xa6')][_0x29cd('0x103')](db['Variable'],{'as':_0x29cd('0x1a4'),'foreignKey':_0x29cd('0x1a5')});db[_0x29cd('0xa8')][_0x29cd('0xfa')](db[_0x29cd('0xa9')],{'as':_0x29cd('0x19b'),'onDelete':_0x29cd('0xf8'),'foreignKey':_0x29cd('0x19c')});db[_0x29cd('0xa9')]['hasMany'](db[_0x29cd('0xaa')],{'as':'Subjects','onDelete':_0x29cd('0xf8'),'foreignKey':_0x29cd('0x19e')});db[_0x29cd('0xa9')][_0x29cd('0xfa')](db['DeskField'],{'as':_0x29cd('0x19f'),'onDelete':_0x29cd('0xf8'),'foreignKey':'DescriptionId'});db[_0x29cd('0xa9')][_0x29cd('0xfa')](db[_0x29cd('0xaa')],{'as':_0x29cd('0x199'),'onDelete':_0x29cd('0xf8'),'foreignKey':'FieldId'});db['DeskConfiguration']['belongsTo'](db[_0x29cd('0xa8')],{'as':_0x29cd('0x153'),'foreignKey':_0x29cd('0x19c')});db['DeskConfiguration']['belongsToMany'](db['Tag'],{'through':_0x29cd('0x1a7')});db[_0x29cd('0xaa')][_0x29cd('0xfa')](db[_0x29cd('0xaa')],{'as':_0x29cd('0x1a6'),'foreignKey':'SubjectId'});db[_0x29cd('0xaa')]['hasMany'](db[_0x29cd('0xaa')],{'as':_0x29cd('0x1a2'),'foreignKey':_0x29cd('0x1a0')});db[_0x29cd('0xaa')][_0x29cd('0xfa')](db[_0x29cd('0xaa')],{'as':_0x29cd('0x1a3'),'foreignKey':'FieldId'});db[_0x29cd('0xaa')]['belongsTo'](db['Variable'],{'as':_0x29cd('0x1a4'),'foreignKey':_0x29cd('0x1a5')});db[_0x29cd('0xab')][_0x29cd('0xfa')](db[_0x29cd('0xac')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x29cd('0x19c')});db['ZohoConfiguration'][_0x29cd('0xfa')](db[_0x29cd('0xad')],{'as':_0x29cd('0x19d'),'onDelete':_0x29cd('0xf8'),'foreignKey':_0x29cd('0x19e')});db[_0x29cd('0xac')][_0x29cd('0xfa')](db['ZohoField'],{'as':_0x29cd('0x19f'),'onDelete':_0x29cd('0xf8'),'foreignKey':_0x29cd('0x1a0')});db[_0x29cd('0xac')][_0x29cd('0xfa')](db[_0x29cd('0xad')],{'as':_0x29cd('0x199'),'onDelete':'cascade','foreignKey':_0x29cd('0x1a1')});db[_0x29cd('0xac')][_0x29cd('0x103')](db[_0x29cd('0xab')],{'as':_0x29cd('0x153'),'foreignKey':'AccountId'});db[_0x29cd('0xad')]['hasMany'](db[_0x29cd('0xad')],{'as':'Subject','foreignKey':_0x29cd('0x19e')});db[_0x29cd('0xad')][_0x29cd('0xfa')](db[_0x29cd('0xad')],{'as':_0x29cd('0x1a2'),'foreignKey':'DescriptionId'});db['ZohoField'][_0x29cd('0xfa')](db[_0x29cd('0xad')],{'as':_0x29cd('0x1a3'),'foreignKey':_0x29cd('0x1a1')});db[_0x29cd('0xad')]['belongsTo'](db[_0x29cd('0x1a4')],{'as':_0x29cd('0x1a4'),'foreignKey':_0x29cd('0x1a5')});db[_0x29cd('0xaf')]['hasMany'](db[_0x29cd('0xb1')],{'as':_0x29cd('0x19b'),'onDelete':'cascade','foreignKey':'AccountId'});db['ZendeskConfiguration']['hasMany'](db[_0x29cd('0xb2')],{'as':_0x29cd('0x19d'),'foreignKey':'SubjectId'});db[_0x29cd('0xb1')][_0x29cd('0xfa')](db[_0x29cd('0xb2')],{'as':_0x29cd('0x19f'),'foreignKey':_0x29cd('0x1a0')});db[_0x29cd('0xb1')][_0x29cd('0xfa')](db['ZendeskField'],{'as':_0x29cd('0x199'),'foreignKey':_0x29cd('0x1a1')});db['ZendeskConfiguration'][_0x29cd('0x103')](db[_0x29cd('0xaf')],{'as':_0x29cd('0x153'),'foreignKey':_0x29cd('0x19c')});db['ZendeskConfiguration']['belongsToMany'](db[_0x29cd('0x14d')],{'through':_0x29cd('0x1a8')});db[_0x29cd('0xb2')]['hasMany'](db[_0x29cd('0xb2')],{'as':_0x29cd('0x1a6'),'foreignKey':'SubjectId'});db['ZendeskField']['hasMany'](db[_0x29cd('0xb2')],{'as':_0x29cd('0x1a2'),'foreignKey':_0x29cd('0x1a0')});db[_0x29cd('0xb2')][_0x29cd('0xfa')](db[_0x29cd('0xb2')],{'as':_0x29cd('0x1a3'),'foreignKey':'FieldId'});db[_0x29cd('0xb2')][_0x29cd('0x103')](db['Variable'],{'as':'Variable','foreignKey':_0x29cd('0x1a5')});db['FreshdeskAccount'][_0x29cd('0xfa')](db[_0x29cd('0x1a9')],{'as':_0x29cd('0x19b'),'onDelete':_0x29cd('0xf8'),'foreignKey':_0x29cd('0x19c')});db['FreshdeskConfiguration'][_0x29cd('0xfa')](db['FreshdeskField'],{'as':_0x29cd('0x19d'),'onDelete':_0x29cd('0xf8'),'foreignKey':_0x29cd('0x19e')});db[_0x29cd('0x1a9')]['hasMany'](db[_0x29cd('0xb5')],{'as':_0x29cd('0x19f'),'onDelete':'cascade','foreignKey':_0x29cd('0x1a0')});db[_0x29cd('0x1a9')][_0x29cd('0xfa')](db[_0x29cd('0xb5')],{'as':_0x29cd('0x199'),'onDelete':_0x29cd('0xf8'),'foreignKey':_0x29cd('0x1a1')});db[_0x29cd('0x1a9')][_0x29cd('0x103')](db[_0x29cd('0x1aa')],{'as':_0x29cd('0x153'),'foreignKey':_0x29cd('0x19c')});db[_0x29cd('0x1a9')][_0x29cd('0x105')](db[_0x29cd('0x14d')],{'through':_0x29cd('0x1ab')});db['FreshdeskField']['hasMany'](db[_0x29cd('0xb5')],{'as':'Subject','foreignKey':_0x29cd('0x19e')});db[_0x29cd('0xb5')][_0x29cd('0xfa')](db[_0x29cd('0xb5')],{'as':_0x29cd('0x1a2'),'foreignKey':_0x29cd('0x1a0')});db[_0x29cd('0xb5')]['hasMany'](db[_0x29cd('0xb5')],{'as':_0x29cd('0x1a3'),'foreignKey':_0x29cd('0x1a1')});db[_0x29cd('0xb5')]['belongsTo'](db[_0x29cd('0x1a4')],{'as':_0x29cd('0x1a4'),'foreignKey':_0x29cd('0x1a5')});db[_0x29cd('0x1ac')][_0x29cd('0xfa')](db['VtigerConfiguration'],{'as':'Configurations','onDelete':_0x29cd('0xf8'),'foreignKey':_0x29cd('0x19c')});db['VtigerConfiguration'][_0x29cd('0xfa')](db[_0x29cd('0xba')],{'as':_0x29cd('0x19d'),'foreignKey':'SubjectId'});db[_0x29cd('0xb8')][_0x29cd('0xfa')](db[_0x29cd('0xba')],{'as':_0x29cd('0x19f'),'foreignKey':_0x29cd('0x1a0')});db[_0x29cd('0xb8')][_0x29cd('0xfa')](db['VtigerField'],{'as':'Fields','foreignKey':_0x29cd('0x1a1')});db['VtigerConfiguration']['belongsTo'](db[_0x29cd('0x1ac')],{'as':'Account','foreignKey':_0x29cd('0x19c')});db['VtigerField'][_0x29cd('0xfa')](db[_0x29cd('0xba')],{'as':_0x29cd('0x1a6'),'foreignKey':_0x29cd('0x19e')});db[_0x29cd('0xba')][_0x29cd('0xfa')](db[_0x29cd('0xba')],{'as':_0x29cd('0x1a2'),'foreignKey':'DescriptionId'});db[_0x29cd('0xba')]['hasMany'](db['VtigerField'],{'as':_0x29cd('0x1a3'),'foreignKey':_0x29cd('0x1a1')});db['VtigerField'][_0x29cd('0x103')](db[_0x29cd('0x1a4')],{'as':_0x29cd('0x1a4'),'foreignKey':'VariableId'});db[_0x29cd('0xbc')][_0x29cd('0xfa')](db['ServicenowConfiguration'],{'as':_0x29cd('0x19b'),'onDelete':'cascade','foreignKey':_0x29cd('0x19c')});db[_0x29cd('0xbe')][_0x29cd('0xfa')](db[_0x29cd('0xc0')],{'as':'Subjects','foreignKey':_0x29cd('0x19e')});db[_0x29cd('0xbe')][_0x29cd('0xfa')](db['ServicenowField'],{'as':'Descriptions','foreignKey':_0x29cd('0x1a0')});db[_0x29cd('0xbe')][_0x29cd('0xfa')](db[_0x29cd('0xc0')],{'as':_0x29cd('0x199'),'foreignKey':_0x29cd('0x1a1')});db[_0x29cd('0xbe')]['belongsTo'](db[_0x29cd('0xbc')],{'as':_0x29cd('0x153'),'foreignKey':_0x29cd('0x19c')});db[_0x29cd('0xc0')]['hasMany'](db[_0x29cd('0xc0')],{'as':_0x29cd('0x1a6'),'foreignKey':'SubjectId'});db[_0x29cd('0xc0')]['hasMany'](db[_0x29cd('0xc0')],{'as':_0x29cd('0x1a2'),'foreignKey':_0x29cd('0x1a0')});db[_0x29cd('0xc0')]['hasMany'](db[_0x29cd('0xc0')],{'as':_0x29cd('0x1a3'),'foreignKey':_0x29cd('0x1a1')});db['ServicenowField']['belongsTo'](db[_0x29cd('0x1a4')],{'as':_0x29cd('0x1a4'),'foreignKey':_0x29cd('0x1a5')});db[_0x29cd('0xc1')][_0x29cd('0xfa')](db[_0x29cd('0x1ad')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x29cd('0x1ad')][_0x29cd('0xfa')](db[_0x29cd('0xc2')],{'as':_0x29cd('0x19d'),'onDelete':_0x29cd('0xf8'),'foreignKey':_0x29cd('0x19e')});db[_0x29cd('0x1ad')][_0x29cd('0xfa')](db['Dynamics365Field'],{'as':'Descriptions','onDelete':_0x29cd('0xf8'),'foreignKey':'DescriptionId'});db[_0x29cd('0x1ad')]['hasMany'](db['Dynamics365Field'],{'as':_0x29cd('0x199'),'onDelete':'cascade','foreignKey':_0x29cd('0x1a1')});db[_0x29cd('0x1ad')]['belongsTo'](db[_0x29cd('0xc1')],{'as':_0x29cd('0x153'),'foreignKey':_0x29cd('0x19c')});db[_0x29cd('0xc2')][_0x29cd('0xfa')](db['Dynamics365Field'],{'as':_0x29cd('0x1a6'),'foreignKey':_0x29cd('0x19e')});db[_0x29cd('0xc2')][_0x29cd('0xfa')](db[_0x29cd('0xc2')],{'as':_0x29cd('0x1a2'),'foreignKey':_0x29cd('0x1a0')});db[_0x29cd('0xc2')][_0x29cd('0xfa')](db[_0x29cd('0xc2')],{'as':_0x29cd('0x1a3'),'foreignKey':_0x29cd('0x1a1')});db[_0x29cd('0xc2')][_0x29cd('0x103')](db['Variable'],{'as':_0x29cd('0x1a4'),'foreignKey':_0x29cd('0x1a5')});db[_0x29cd('0x1ae')][_0x29cd('0xfa')](db[_0x29cd('0x1af')],{'as':'Configurations','onDelete':_0x29cd('0xf8'),'foreignKey':_0x29cd('0x19c')});db[_0x29cd('0x1af')][_0x29cd('0xfa')](db[_0x29cd('0xc6')],{'as':_0x29cd('0x19d'),'foreignKey':_0x29cd('0x19e')});db[_0x29cd('0x1af')]['hasMany'](db['FreshsalesField'],{'as':_0x29cd('0x19f'),'foreignKey':_0x29cd('0x1a0')});db[_0x29cd('0x1af')][_0x29cd('0xfa')](db[_0x29cd('0xc6')],{'as':_0x29cd('0x199'),'foreignKey':_0x29cd('0x1a1')});db[_0x29cd('0x1af')][_0x29cd('0x103')](db['FreshsalesAccount'],{'as':'Account','foreignKey':_0x29cd('0x19c')});db[_0x29cd('0xc6')][_0x29cd('0xfa')](db['FreshsalesField'],{'as':_0x29cd('0x1a6'),'foreignKey':_0x29cd('0x19e')});db['FreshsalesField'][_0x29cd('0xfa')](db[_0x29cd('0xc6')],{'as':_0x29cd('0x1a2'),'foreignKey':_0x29cd('0x1a0')});db['FreshsalesField']['hasMany'](db[_0x29cd('0xc6')],{'as':_0x29cd('0x1a3'),'foreignKey':_0x29cd('0x1a1')});db[_0x29cd('0xc6')]['belongsTo'](db[_0x29cd('0x1a4')],{'as':'Variable','foreignKey':_0x29cd('0x1a5')});db['ChatQueueReport'][_0x29cd('0x103')](db[_0x29cd('0x5a')],{});db[_0x29cd('0x1b0')]['belongsTo'](db[_0x29cd('0xee')],{'as':_0x29cd('0x15a'),'foreignKey':_0x29cd('0x147')});db[_0x29cd('0x1b0')][_0x29cd('0x103')](db[_0x29cd('0x6a')],{'as':_0x29cd('0x13d'),'foreignKey':_0x29cd('0x13e')});db['ChatQueueReport'][_0x29cd('0x103')](db[_0x29cd('0x60')],{});db[_0x29cd('0x1b0')][_0x29cd('0x103')](db[_0x29cd('0x171')],{});db[_0x29cd('0x1b0')][_0x29cd('0x103')](db[_0x29cd('0xf5')],{});db[_0x29cd('0x1b0')][_0x29cd('0x103')](db[_0x29cd('0x65')],{});db[_0x29cd('0x179')][_0x29cd('0x103')](db[_0x29cd('0xf5')],{'onDelete':_0x29cd('0xf8'),'foreignKey':_0x29cd('0x1b1')});db[_0x29cd('0x179')][_0x29cd('0x103')](db[_0x29cd('0xf5')],{'onDelete':_0x29cd('0xf8'),'foreignKey':'ToId'});db[_0x29cd('0xcf')][_0x29cd('0xfa')](db[_0x29cd('0xcd')],{'foreignKey':_0x29cd('0x1b2'),'onDelete':'cascade'});db[_0x29cd('0xcf')][_0x29cd('0xfa')](db[_0x29cd('0xcb')],{'foreignKey':'SessionId','onDelete':'cascade'});db['SmsQueueReport'][_0x29cd('0x103')](db[_0x29cd('0x4e')],{});db[_0x29cd('0xd0')]['belongsTo'](db[_0x29cd('0xee')],{'as':'List','foreignKey':_0x29cd('0x147')});db[_0x29cd('0xd0')][_0x29cd('0x103')](db[_0x29cd('0x6a')],{'as':'Contact','foreignKey':_0x29cd('0x13e')});db[_0x29cd('0xd0')][_0x29cd('0x103')](db[_0x29cd('0x101')],{});db[_0x29cd('0xd0')][_0x29cd('0x103')](db['SmsMessage'],{});db[_0x29cd('0xd0')][_0x29cd('0x103')](db[_0x29cd('0xf5')],{});db['SmsQueueReport']['belongsTo'](db[_0x29cd('0x53')],{});db[_0x29cd('0x1b3')]['hasMany'](db[_0x29cd('0xcf')],{'foreignKey':_0x29cd('0x1b4')});db['JscriptyProject'][_0x29cd('0xfa')](db[_0x29cd('0xcd')],{'foreignKey':_0x29cd('0x1b4')});db[_0x29cd('0x1b3')]['hasMany'](db[_0x29cd('0xcb')],{'foreignKey':_0x29cd('0x1b4')});db[_0x29cd('0xd8')]['belongsToMany'](db[_0x29cd('0xf5')],{'as':_0x29cd('0x15d'),'through':_0x29cd('0x122')});db[_0x29cd('0xde')]['belongsToMany'](db['User'],{'as':_0x29cd('0x132'),'through':_0x29cd('0x10b')});db[_0x29cd('0xde')][_0x29cd('0x105')](db[_0x29cd('0x1b')],{'through':_0x29cd('0x134'),'as':_0x29cd('0x113')});db[_0x29cd('0xde')]['belongsToMany'](db['MailQueue'],{'through':_0x29cd('0x14a'),'as':_0x29cd('0x114')});db[_0x29cd('0xde')][_0x29cd('0x105')](db[_0x29cd('0x65')],{'through':_0x29cd('0x178'),'as':_0x29cd('0x115')});db[_0x29cd('0xde')]['belongsToMany'](db['FaxQueue'],{'through':_0x29cd('0x15f'),'as':_0x29cd('0x116')});db[_0x29cd('0xde')]['belongsToMany'](db[_0x29cd('0x53')],{'through':_0x29cd('0x167'),'as':_0x29cd('0x117')});db[_0x29cd('0xde')][_0x29cd('0x105')](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':_0x29cd('0x118')});db[_0x29cd('0xe1')][_0x29cd('0xfa')](db[_0x29cd('0x6c')],{'as':'Hoppers','foreignKey':_0x29cd('0x181')});db[_0x29cd('0xe1')][_0x29cd('0xfa')](db['CmHopperFinal'],{'as':_0x29cd('0xfe'),'foreignKey':_0x29cd('0x181')});db['Campaign'][_0x29cd('0xfa')](db[_0x29cd('0x72')],{'as':_0x29cd('0x128'),'foreignKey':_0x29cd('0x181')});db[_0x29cd('0xe1')][_0x29cd('0xfa')](db['CmHopperBlack'],{'as':_0x29cd('0x129'),'foreignKey':_0x29cd('0x181')});db['Campaign']['belongsTo'](db[_0x29cd('0x28')],{'as':_0x29cd('0x28'),'foreignKey':_0x29cd('0x12b')});db[_0x29cd('0xe1')][_0x29cd('0x103')](db['Trunk'],{'as':_0x29cd('0x12c'),'foreignKey':_0x29cd('0x12d')});db[_0x29cd('0xe1')][_0x29cd('0x103')](db[_0x29cd('0x12e')],{'as':_0x29cd('0x12e'),'foreignKey':_0x29cd('0x164')});db[_0x29cd('0xe1')][_0x29cd('0x103')](db['SquareProject'],{'as':_0x29cd('0xd8'),'foreignKey':_0x29cd('0x1b5')});db[_0x29cd('0xe1')]['belongsToMany'](db['CmList'],{'as':'Lists','through':_0x29cd('0x1b6')});db[_0x29cd('0xe1')][_0x29cd('0x105')](db[_0x29cd('0xee')],{'as':_0x29cd('0x135'),'through':_0x29cd('0x1b7')});db['MailTransferReport'][_0x29cd('0x103')](db[_0x29cd('0x3e')],{});db[_0x29cd('0xe7')]['belongsTo'](db[_0x29cd('0x3c')],{});db[_0x29cd('0xe7')]['belongsTo'](db[_0x29cd('0x37')],{'foreignKey':_0x29cd('0x1b8'),'as':_0x29cd('0x1b9')});db['MailTransferReport'][_0x29cd('0x103')](db[_0x29cd('0xf5')],{'foreignKey':_0x29cd('0x1ba'),'as':_0x29cd('0x1bb')});db[_0x29cd('0xe7')][_0x29cd('0x103')](db['User'],{'foreignKey':_0x29cd('0x1bc'),'as':'ToAgent'});db[_0x29cd('0xe7')]['belongsTo'](db[_0x29cd('0x39')],{'foreignKey':_0x29cd('0x1bd'),'as':_0x29cd('0x1be')});db[_0x29cd('0xe7')]['belongsTo'](db[_0x29cd('0x37')],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db[_0x29cd('0x1bf')][_0x29cd('0x103')](db[_0x29cd('0x171')],{});db[_0x29cd('0x1bf')][_0x29cd('0x103')](db['ChatInteraction'],{});db[_0x29cd('0x1bf')]['belongsTo'](db[_0x29cd('0x5a')],{'foreignKey':_0x29cd('0x1c0'),'as':_0x29cd('0x1b9')});db[_0x29cd('0x1bf')][_0x29cd('0x103')](db['User'],{'foreignKey':_0x29cd('0x1ba'),'as':_0x29cd('0x1bb')});db['ChatTransferReport'][_0x29cd('0x103')](db['User'],{'foreignKey':_0x29cd('0x1bc'),'as':_0x29cd('0x1c1')});db['ChatTransferReport'][_0x29cd('0x103')](db['ChatQueue'],{'foreignKey':_0x29cd('0x1c2'),'as':_0x29cd('0x1be')});db[_0x29cd('0x1bf')]['belongsTo'](db[_0x29cd('0x5a')],{'foreignKey':_0x29cd('0x1c3'),'as':_0x29cd('0x1c4')});db['FaxTransferReport'][_0x29cd('0x103')](db['FaxMessage'],{});db[_0x29cd('0xea')]['belongsTo'](db[_0x29cd('0x48')],{});db[_0x29cd('0xea')][_0x29cd('0x103')](db[_0x29cd('0x44')],{'foreignKey':'FromFaxAccountId','as':_0x29cd('0x1b9')});db[_0x29cd('0xea')][_0x29cd('0x103')](db[_0x29cd('0xf5')],{'foreignKey':_0x29cd('0x1ba'),'as':'FromAgent'});db[_0x29cd('0xea')][_0x29cd('0x103')](db[_0x29cd('0xf5')],{'foreignKey':'ToUserId','as':_0x29cd('0x1c1')});db[_0x29cd('0xea')][_0x29cd('0x103')](db[_0x29cd('0x4c')],{'foreignKey':'ToFaxQueueId','as':_0x29cd('0x1be')});db['FaxTransferReport'][_0x29cd('0x103')](db['FaxAccount'],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db['OpenchannelTransferReport'][_0x29cd('0x103')](db[_0x29cd('0x57')],{});db['OpenchannelTransferReport'][_0x29cd('0x103')](db[_0x29cd('0x56')],{});db[_0x29cd('0xeb')][_0x29cd('0x103')](db[_0x29cd('0x54')],{'foreignKey':_0x29cd('0x1c5'),'as':_0x29cd('0x1b9')});db['OpenchannelTransferReport'][_0x29cd('0x103')](db[_0x29cd('0xf5')],{'foreignKey':_0x29cd('0x1ba'),'as':'FromAgent'});db[_0x29cd('0xeb')][_0x29cd('0x103')](db[_0x29cd('0xf5')],{'foreignKey':'ToUserId','as':_0x29cd('0x1c1')});db[_0x29cd('0xeb')][_0x29cd('0x103')](db['OpenchannelQueue'],{'foreignKey':_0x29cd('0x1c6'),'as':_0x29cd('0x1be')});db[_0x29cd('0xeb')][_0x29cd('0x103')](db[_0x29cd('0x54')],{'foreignKey':_0x29cd('0x1c7'),'as':_0x29cd('0x1c4')});db[_0x29cd('0x1c8')][_0x29cd('0x103')](db['SmsMessage'],{});db[_0x29cd('0x1c8')]['belongsTo'](db[_0x29cd('0x101')],{});db['SmsTransferReport'][_0x29cd('0x103')](db[_0x29cd('0x4e')],{'foreignKey':_0x29cd('0x1c9'),'as':_0x29cd('0x1b9')});db[_0x29cd('0x1c8')][_0x29cd('0x103')](db[_0x29cd('0xf5')],{'foreignKey':_0x29cd('0x1ba'),'as':'FromAgent'});db[_0x29cd('0x1c8')][_0x29cd('0x103')](db['User'],{'foreignKey':_0x29cd('0x1bc'),'as':_0x29cd('0x1c1')});db[_0x29cd('0x1c8')][_0x29cd('0x103')](db['SmsQueue'],{'foreignKey':_0x29cd('0x1ca'),'as':_0x29cd('0x1be')});db[_0x29cd('0x1c8')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0x29cd('0x1cb'),'as':'ToAccount'});db[_0x29cd('0xee')][_0x29cd('0xfa')](db['Disposition'],{'as':_0x29cd('0x144'),'foreignKey':_0x29cd('0x147')});db[_0x29cd('0xee')][_0x29cd('0xfa')](db[_0x29cd('0x76')],{'as':'CustomFields','foreignKey':_0x29cd('0x147')});db[_0x29cd('0xee')][_0x29cd('0xfa')](db['CmContact'],{'as':_0x29cd('0x107'),'onDelete':_0x29cd('0xf8'),'foreignKey':_0x29cd('0x147')});db['CmList']['hasMany'](db[_0x29cd('0x70')],{'as':_0x29cd('0xfe'),'foreignKey':_0x29cd('0x147')});db[_0x29cd('0xee')][_0x29cd('0xfa')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x29cd('0x147')});db[_0x29cd('0xee')]['hasMany'](db[_0x29cd('0x74')],{'as':_0x29cd('0x74'),'foreignKey':_0x29cd('0x147')});db[_0x29cd('0xee')][_0x29cd('0x105')](db['VoiceQueue'],{'as':'Queues','through':'voice_queues_has_cm_lists'});db[_0x29cd('0xee')][_0x29cd('0x105')](db['User'],{'as':'Agents','through':'cm_user_has_lists'});db[_0x29cd('0xef')][_0x29cd('0xfa')](db[_0x29cd('0x18')],{'as':'Extensions','onDelete':_0x29cd('0x154')});db['VoicePrefix']['belongsToMany'](db['User'],{'as':_0x29cd('0x132'),'through':'user_has_voice_prefixes'});db[_0x29cd('0xf1')][_0x29cd('0xfa')](db['User'],{'as':_0x29cd('0x15d'),'foreignKey':_0x29cd('0x104')});db[_0x29cd('0xf1')][_0x29cd('0xfa')](db[_0x29cd('0xf3')],{'as':'UserProfileSections','foreignKey':_0x29cd('0x104'),'onDelete':_0x29cd('0xf8')});db[_0x29cd('0xf3')][_0x29cd('0xfa')](db[_0x29cd('0x1cc')],{'as':'Resources','foreignKey':_0x29cd('0x1cd'),'onDelete':_0x29cd('0xf8')});module[_0x29cd('0x1ce')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa8d8=['xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','VoiceExtension','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsMessage','../api/smsQueue/smsQueue.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','hasOne','cascade','UserId','VoiceRecording','Recordings','hasMany','Extensions','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteraction','belongsTo','belongsToMany','Groups','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_teams','MailInteractions','user_has_chat_interactions','user_has_fax_interactions','MailQueues','ChatQueue','ChatQueues','FaxQueues','OpenchannelQueue','OpenchannelQueues','UserOpenchannelQueue','user_has_voice_prefixes','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccount','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','moh_has_sounds','CmHopper','Hoppers','VoiceQueueId','HopperFinals','HopperBlacks','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','Agents','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailbox','QueueCalls','uniqueid','VoiceCallReport','AgentReports','ContactId','MailAccountId','Imap','MailServerOut','Answers','Interactions','Applications','List','ListId','TemplateId','team_has_mail_queues','Teams','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','MailInteractionId','Attachment','Attachments','Interaction','Account','MailApplication','restrict','TagId','Items','Dispositions','FaxAccountId','CannedAnswer','Exntensions','Pause','user_has_fax_accounts','FaxQueue','FaxInteractionId','fax_interaction_has_tags','AttachmentId','SmsAccountId','SmsQueue','sms_interaction_has_tags','user_has_sms_interactions','SmsInteractionId','team_has_sms_queues','OpenchannelAccount','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','ChatApplication','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','UserChatQueue','team_has_chat_queues','ChatGroupId','chat_group_has_users','HopperHistories','CompanyId','cm_contact_has_tags','Campaign','CampaignId','All','OneAll','OneAny','AutomationAnyId','Actions','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','Variable','VariableId','SugarcrmField','int_desk_configuration_has_tags','ZohoField','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','ServicenowAccount','Dynamics365Account','FreshsalesAccount','FreshsalesConfiguration','FromId','ToId','SessionId','ProjectId','team_has_fax_queues','SmsQueues','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','CustomFields','Queues','voice_queues_has_cm_lists','userProfileId','UserProfileResource','Resources','sectionId','path','sequelize','jstz','determine','motion2'];(function(_0x28eeff,_0x558969){var _0x34368a=function(_0x1bc37f){while(--_0x1bc37f){_0x28eeff['push'](_0x28eeff['shift']());}};_0x34368a(++_0x558969);}(_0xa8d8,0x1c6));var _0x8a8d=function(_0x1cbf12,_0x19e24f){_0x1cbf12=_0x1cbf12-0x0;var _0xd4143a=_0xa8d8[_0x1cbf12];return _0xd4143a;};'use strict';var path=require(_0x8a8d('0x0'));var config=require('../config/environment');var Sequelize=require(_0x8a8d('0x1'));var _=require('lodash');var jstz=require(_0x8a8d('0x2'));var timezone=jstz[_0x8a8d('0x3')]();config[_0x8a8d('0x1')]=_['defaultsDeep'](config[_0x8a8d('0x1')],{'database':_0x8a8d('0x4'),'username':_0x8a8d('0x5'),'password':_0x8a8d('0x6'),'options':{'host':_0x8a8d('0x7'),'port':0xcea,'dialect':_0x8a8d('0x8'),'dialectOptions':{'charset':_0x8a8d('0x9')},'logging':![],'timezone':timezone[_0x8a8d('0xa')](),'define':{'charset':_0x8a8d('0xb'),'collate':_0x8a8d('0xc')}}});config[_0x8a8d('0xd')]=_['defaultsDeep'](config[_0x8a8d('0xd')],{'database':_0x8a8d('0x4'),'username':_0x8a8d('0x5'),'password':_0x8a8d('0x6'),'options':{'host':_0x8a8d('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x8a8d('0x9')},'logging':![],'timezone':timezone[_0x8a8d('0xa')](),'define':{'charset':'utf8','collate':_0x8a8d('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8a8d('0x1')][_0x8a8d('0xe')],config['sequelize'][_0x8a8d('0xf')],config[_0x8a8d('0x1')][_0x8a8d('0x10')],config[_0x8a8d('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8a8d('0xd')]['database'],config[_0x8a8d('0xd')][_0x8a8d('0xf')],config['sequelizeHistory'][_0x8a8d('0x10')],config[_0x8a8d('0xd')][_0x8a8d('0x11')])};db[_0x8a8d('0x12')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x14'));db[_0x8a8d('0x15')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x8a8d('0x16')]=db['sequelize']['import']('../api/voiceContext/voiceContext.model');db[_0x8a8d('0x17')]=db['sequelize'][_0x8a8d('0x13')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x18'));db[_0x8a8d('0x19')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')]('../api/voiceQueue/voiceQueue.model');db['VoiceRecording']=db[_0x8a8d('0x1')][_0x8a8d('0x13')]('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db[_0x8a8d('0x1')]['import'](_0x8a8d('0x1a'));db[_0x8a8d('0x1b')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x1c'));db['VoiceMailMessage']=db['sequelize'][_0x8a8d('0x13')](_0x8a8d('0x1d'));db['VoiceCallReport']=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x1e'));db[_0x8a8d('0x1f')]=db['sequelize']['import'](_0x8a8d('0x20'));db['VoiceAgentReport']=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x21'));db[_0x8a8d('0x22')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x23'));db['MemberReport']=db['sequelize']['import'](_0x8a8d('0x24'));db[_0x8a8d('0x25')]=db['sequelize'][_0x8a8d('0x13')](_0x8a8d('0x26'));db[_0x8a8d('0x27')]=db['sequelize'][_0x8a8d('0x13')](_0x8a8d('0x28'));db[_0x8a8d('0x29')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x2a'));db[_0x8a8d('0x2b')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x2c'));db['UserChatQueue']=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x2d'));db[_0x8a8d('0x2e')]=db['sequelize'][_0x8a8d('0x13')](_0x8a8d('0x2f'));db[_0x8a8d('0x30')]=db['sequelize']['import'](_0x8a8d('0x31'));db[_0x8a8d('0x32')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x33'));db['UserOpenchannelQueue']=db[_0x8a8d('0x1')]['import'](_0x8a8d('0x34'));db[_0x8a8d('0x35')]=db['sequelize'][_0x8a8d('0x13')](_0x8a8d('0x36'));db['MailServerOut']=db[_0x8a8d('0x1')]['import'](_0x8a8d('0x37'));db['MailAccount']=db['sequelize'][_0x8a8d('0x13')](_0x8a8d('0x38'));db[_0x8a8d('0x39')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')]('../api/mailQueue/mailQueue.model');db[_0x8a8d('0x3a')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x3b'));db['MailInteraction']=db[_0x8a8d('0x1')]['import'](_0x8a8d('0x3c'));db[_0x8a8d('0x3d')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x3e'));db['MailApplication']=db[_0x8a8d('0x1')]['import']('../api/mailApplication/mailApplication.model');db[_0x8a8d('0x3f')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x40'));db[_0x8a8d('0x41')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x42'));db[_0x8a8d('0x43')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x44'));db[_0x8a8d('0x45')]=db['sequelize'][_0x8a8d('0x13')](_0x8a8d('0x46'));db[_0x8a8d('0x47')]=db[_0x8a8d('0x1')]['import'](_0x8a8d('0x48'));db[_0x8a8d('0x49')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x4a'));db[_0x8a8d('0x4b')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x4c'));db['FaxQueue']=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x4d'));db[_0x8a8d('0x4e')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x4f'));db[_0x8a8d('0x50')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x51'));db[_0x8a8d('0x52')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')]('../api/smsApplication/smsApplication.model');db['SmsInteraction']=db['sequelize']['import']('../api/smsInteraction/smsInteraction.model');db[_0x8a8d('0x53')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')]('../api/smsMessage/smsMessage.model');db['SmsQueue']=db[_0x8a8d('0x1')]['import'](_0x8a8d('0x54'));db['OpenchannelAccount']=db[_0x8a8d('0x1')]['import']('../api/openchannelAccount/openchannelAccount.model');db['OpenchannelApplication']=db['sequelize'][_0x8a8d('0x13')](_0x8a8d('0x55'));db[_0x8a8d('0x56')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x57'));db[_0x8a8d('0x58')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')]('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x59'));db['ChatWebsite']=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x5a'));db[_0x8a8d('0x5b')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x5c'));db['ChatApplication']=db['sequelize'][_0x8a8d('0x13')](_0x8a8d('0x5d'));db['ChatInteraction']=db['sequelize'][_0x8a8d('0x13')]('../api/chatInteraction/chatInteraction.model');db[_0x8a8d('0x5e')]=db['sequelize'][_0x8a8d('0x13')](_0x8a8d('0x5f'));db[_0x8a8d('0x60')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db[_0x8a8d('0x1')]['import'](_0x8a8d('0x61'));db[_0x8a8d('0x62')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')]('../api/chatGroup/chatGroup.model');db[_0x8a8d('0x63')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x8a8d('0x64')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x65'));db[_0x8a8d('0x66')]=db['sequelize']['import']('../api/cmContact/cmContact.model');db['CmHopper']=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x67'));db[_0x8a8d('0x68')]=db[_0x8a8d('0x1')]['import'](_0x8a8d('0x69'));db[_0x8a8d('0x6a')]=db['sequelize'][_0x8a8d('0x13')](_0x8a8d('0x6b'));db[_0x8a8d('0x6c')]=db[_0x8a8d('0x1')]['import'](_0x8a8d('0x6d'));db[_0x8a8d('0x6e')]=db[_0x8a8d('0x1')]['import'](_0x8a8d('0x6f'));db['CmCustomField']=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x70'));db[_0x8a8d('0x71')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x72'));db[_0x8a8d('0x73')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x74'));db['CannedAnswer']=db['sequelize']['import'](_0x8a8d('0x75'));db[_0x8a8d('0x76')]=db['sequelize'][_0x8a8d('0x13')]('../api/disposition/disposition.model');db[_0x8a8d('0x77')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x78'));db[_0x8a8d('0x79')]=db['sequelize']['import'](_0x8a8d('0x7a'));db['Pause']=db['sequelize'][_0x8a8d('0x13')](_0x8a8d('0x7b'));db[_0x8a8d('0x7c')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')]('../api/cdr/cdr.model');db[_0x8a8d('0x7d')]=db['sequelize'][_0x8a8d('0x13')](_0x8a8d('0x7e'));db[_0x8a8d('0x7f')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x80'));db[_0x8a8d('0x81')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x82'));db[_0x8a8d('0x83')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x84'));db[_0x8a8d('0x85')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x86'));db[_0x8a8d('0x87')]=db[_0x8a8d('0x1')]['import'](_0x8a8d('0x88'));db['Variable']=db[_0x8a8d('0x1')]['import'](_0x8a8d('0x89'));db['Integration']=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x8a'));db[_0x8a8d('0x8b')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')]('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db['sequelize'][_0x8a8d('0x13')](_0x8a8d('0x8c'));db[_0x8a8d('0x8d')]=db[_0x8a8d('0x1')]['import'](_0x8a8d('0x8e'));db[_0x8a8d('0x8f')]=db['sequelize'][_0x8a8d('0x13')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x8a8d('0x90')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x91'));db[_0x8a8d('0x92')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x93'));db[_0x8a8d('0x94')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x95'));db[_0x8a8d('0x96')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x8a8d('0x97')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x98'));db['SalesforceField']=db[_0x8a8d('0x1')]['import'](_0x8a8d('0x99'));db[_0x8a8d('0x9a')]=db['sequelize'][_0x8a8d('0x13')](_0x8a8d('0x9b'));db[_0x8a8d('0x9c')]=db['sequelize'][_0x8a8d('0x13')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db['SugarcrmField']=db[_0x8a8d('0x1')]['import'](_0x8a8d('0x9d'));db[_0x8a8d('0x9e')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0x9f'));db[_0x8a8d('0xa0')]=db[_0x8a8d('0x1')]['import'](_0x8a8d('0xa1'));db[_0x8a8d('0xa2')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0xa3'));db[_0x8a8d('0xa4')]=db[_0x8a8d('0x1')]['import'](_0x8a8d('0xa5'));db[_0x8a8d('0xa6')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0xa7'));db['ZohoField']=db[_0x8a8d('0x1')]['import'](_0x8a8d('0xa8'));db[_0x8a8d('0xa9')]=db['sequelize'][_0x8a8d('0x13')](_0x8a8d('0xaa'));db[_0x8a8d('0xab')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0xac'));db[_0x8a8d('0xad')]=db[_0x8a8d('0x1')]['import'](_0x8a8d('0xae'));db[_0x8a8d('0xaf')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0xb0'));db['FreshdeskConfiguration']=db[_0x8a8d('0x1')][_0x8a8d('0x13')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x8a8d('0xb1')]=db['sequelize'][_0x8a8d('0x13')](_0x8a8d('0xb2'));db[_0x8a8d('0xb3')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0xb4'));db[_0x8a8d('0xb5')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0xb6'));db[_0x8a8d('0xb7')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0xb8'));db['ServicenowAccount']=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0xb9'));db[_0x8a8d('0xba')]=db['sequelize']['import'](_0x8a8d('0xbb'));db[_0x8a8d('0xbc')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')]('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db['sequelize'][_0x8a8d('0x13')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x8a8d('0xbd')]=db[_0x8a8d('0x1')]['import']('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x8a8d('0xbe')]=db[_0x8a8d('0x1')]['import'](_0x8a8d('0xbf'));db['FreshsalesAccount']=db[_0x8a8d('0x1')]['import'](_0x8a8d('0xc0'));db['FreshsalesConfiguration']=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0xc1'));db[_0x8a8d('0xc2')]=db['sequelize']['import'](_0x8a8d('0xc3'));db['Integration']=db[_0x8a8d('0x1')]['import']('../api/integration/integration.model');db[_0x8a8d('0xc4')]=db[_0x8a8d('0x1')]['import'](_0x8a8d('0xc5'));db[_0x8a8d('0xc6')]=db['sequelize'][_0x8a8d('0x13')](_0x8a8d('0xc7'));db[_0x8a8d('0xc8')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0xc9'));db[_0x8a8d('0xca')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0xcb'));db[_0x8a8d('0xcc')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0xcd'));db['JscriptySessionReport']=db[_0x8a8d('0x1')][_0x8a8d('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x8a8d('0xce')]=db[_0x8a8d('0x1')]['import']('../api/smsQueueReport/smsQueueReport.model');db[_0x8a8d('0xcf')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0xd0'));db[_0x8a8d('0xd1')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0xd2'));db[_0x8a8d('0xd3')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0xd4'));db[_0x8a8d('0xd5')]=db[_0x8a8d('0x1')]['import']('../api/setting/setting.model');db[_0x8a8d('0xd6')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0xd7'));db[_0x8a8d('0xd8')]=db[_0x8a8d('0x1')]['import'](_0x8a8d('0xd9'));db[_0x8a8d('0xda')]=db[_0x8a8d('0x1')]['import']('../api/squareRecording/squareRecording.model');db['SquareMessage']=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0xdb'));db[_0x8a8d('0xdc')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0xdd'));db[_0x8a8d('0xde')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0xdf'));db['Campaign']=db['sequelize'][_0x8a8d('0x13')](_0x8a8d('0xe0'));db[_0x8a8d('0xe1')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0xe2'));db['Attachment']=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0xe3'));db[_0x8a8d('0xe4')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0xe5'));db[_0x8a8d('0xe6')]=db['sequelize'][_0x8a8d('0x13')]('../api/mailTransferReport/mailTransferReport.model');db[_0x8a8d('0xe7')]=db['sequelize'][_0x8a8d('0x13')]('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db[_0x8a8d('0x1')][_0x8a8d('0x13')]('../api/faxTransferReport/faxTransferReport.model');db[_0x8a8d('0xe8')]=db[_0x8a8d('0x1')]['import'](_0x8a8d('0xe9'));db[_0x8a8d('0xea')]=db['sequelize'][_0x8a8d('0x13')](_0x8a8d('0xeb'));db[_0x8a8d('0xec')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0xed'));db[_0x8a8d('0xee')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')](_0x8a8d('0xef'));db[_0x8a8d('0xf0')]=db[_0x8a8d('0x1')][_0x8a8d('0x13')]('../api/userProfile/userProfile.model');db[_0x8a8d('0xf1')]=db[_0x8a8d('0x1')]['import'](_0x8a8d('0xf2'));db['UserProfileResource']=db[_0x8a8d('0x1')]['import'](_0x8a8d('0xf3'));db['User'][_0x8a8d('0xf4')](db[_0x8a8d('0x1b')],{'as':_0x8a8d('0x1b'),'onDelete':_0x8a8d('0xf5'),'foreignKey':_0x8a8d('0xf6')});db[_0x8a8d('0x12')]['hasMany'](db[_0x8a8d('0xf7')],{'as':_0x8a8d('0xf8'),'foreignKey':'UserId'});db[_0x8a8d('0x12')][_0x8a8d('0xf9')](db[_0x8a8d('0x29')],{'as':'VoiceQueuesRt','foreignKey':_0x8a8d('0xf6')});db[_0x8a8d('0x12')][_0x8a8d('0xf9')](db[_0x8a8d('0x17')],{'as':_0x8a8d('0xfa'),'onDelete':_0x8a8d('0xf5'),'hooks':!![]});db['User'][_0x8a8d('0xf9')](db[_0x8a8d('0x6a')],{'as':'HopperFinals','foreignKey':_0x8a8d('0xf6')});db[_0x8a8d('0x12')][_0x8a8d('0xf9')](db[_0x8a8d('0x6c')],{'as':_0x8a8d('0xfb'),'foreignKey':_0x8a8d('0xf6')});db['User'][_0x8a8d('0xf9')](db['ReportAgentPreview'],{'as':_0x8a8d('0x6e'),'foreignKey':_0x8a8d('0xf6')});db[_0x8a8d('0x12')][_0x8a8d('0xf9')](db[_0x8a8d('0x56')],{'as':_0x8a8d('0xfc'),'foreignKey':_0x8a8d('0xf6')});db[_0x8a8d('0x12')][_0x8a8d('0xf9')](db[_0x8a8d('0xfd')],{'as':_0x8a8d('0xfe'),'foreignKey':_0x8a8d('0xf6')});db[_0x8a8d('0x12')][_0x8a8d('0xf9')](db[_0x8a8d('0xff')],{'as':_0x8a8d('0x100'),'foreignKey':_0x8a8d('0xf6')});db[_0x8a8d('0x12')][_0x8a8d('0xf9')](db[_0x8a8d('0x49')],{'as':_0x8a8d('0x101'),'foreignKey':_0x8a8d('0xf6')});db['User']['hasMany'](db[_0x8a8d('0x102')],{'as':'MailInteractions','foreignKey':_0x8a8d('0xf6')});db[_0x8a8d('0x12')][_0x8a8d('0x103')](db[_0x8a8d('0xf0')],{'as':_0x8a8d('0xf0'),'foreignKey':'userProfileId'});db['User'][_0x8a8d('0x104')](db['ChatGroup'],{'as':_0x8a8d('0x105'),'through':'chat_group_has_users'});db['User'][_0x8a8d('0x104')](db[_0x8a8d('0x66')],{'as':_0x8a8d('0x106'),'through':_0x8a8d('0x107')});db[_0x8a8d('0x12')][_0x8a8d('0x104')](db[_0x8a8d('0xec')],{'as':'Lists','through':_0x8a8d('0x108')});db[_0x8a8d('0x12')][_0x8a8d('0x104')](db['Team'],{'through':_0x8a8d('0x109')});db['User'][_0x8a8d('0x104')](db[_0x8a8d('0x102')],{'as':_0x8a8d('0x10a'),'through':'user_has_mail_interactions'});db[_0x8a8d('0x12')][_0x8a8d('0x104')](db[_0x8a8d('0xfd')],{'as':_0x8a8d('0xfe'),'through':_0x8a8d('0x10b')});db[_0x8a8d('0x12')][_0x8a8d('0x104')](db[_0x8a8d('0x49')],{'as':_0x8a8d('0x101'),'through':_0x8a8d('0x10c')});db[_0x8a8d('0x12')]['belongsToMany'](db['SmsInteraction'],{'as':_0x8a8d('0x100'),'through':'user_has_sms_interactions'});db['User'][_0x8a8d('0x104')](db[_0x8a8d('0x56')],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db[_0x8a8d('0x12')][_0x8a8d('0x104')](db[_0x8a8d('0x19')],{'as':'VoiceQueues','through':_0x8a8d('0x2b'),'required':![]});db[_0x8a8d('0x12')][_0x8a8d('0x104')](db[_0x8a8d('0x39')],{'as':_0x8a8d('0x10d'),'through':_0x8a8d('0x2e'),'required':![]});db[_0x8a8d('0x12')][_0x8a8d('0x104')](db[_0x8a8d('0x10e')],{'as':_0x8a8d('0x10f'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0x8a8d('0x12')][_0x8a8d('0x104')](db['FaxQueue'],{'as':_0x8a8d('0x110'),'through':_0x8a8d('0x30'),'required':![]});db[_0x8a8d('0x12')][_0x8a8d('0x104')](db['SmsQueue'],{'as':'SmsQueues','through':_0x8a8d('0x32'),'required':![]});db['User'][_0x8a8d('0x104')](db[_0x8a8d('0x111')],{'as':_0x8a8d('0x112'),'through':_0x8a8d('0x113'),'required':![]});db[_0x8a8d('0x12')][_0x8a8d('0x104')](db['CmList'],{'through':_0x8a8d('0x108')});db[_0x8a8d('0x12')][_0x8a8d('0x104')](db[_0x8a8d('0xee')],{'as':'VoicePrefixes','through':_0x8a8d('0x114'),'required':![]});db[_0x8a8d('0x12')][_0x8a8d('0x104')](db[_0x8a8d('0x115')],{'as':_0x8a8d('0x116'),'through':_0x8a8d('0x117')});db[_0x8a8d('0x12')]['belongsToMany'](db[_0x8a8d('0x45')],{'as':_0x8a8d('0x118'),'through':'user_has_fax_accounts'});db[_0x8a8d('0x12')][_0x8a8d('0x104')](db[_0x8a8d('0x119')],{'as':'MailAccounts','through':_0x8a8d('0x11a')});db[_0x8a8d('0x12')]['belongsToMany'](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0x8a8d('0x11b')});db[_0x8a8d('0x12')][_0x8a8d('0x104')](db[_0x8a8d('0x50')],{'as':_0x8a8d('0x11c'),'through':_0x8a8d('0x11d')});db[_0x8a8d('0x12')][_0x8a8d('0x104')](db[_0x8a8d('0xd8')],{'as':_0x8a8d('0x11e'),'through':_0x8a8d('0x11f')});db['VoiceChanSpy'][_0x8a8d('0xf9')](db[_0x8a8d('0x17')],{'as':_0x8a8d('0x120'),'onDelete':'cascade','foreignKey':_0x8a8d('0x121')});db['VoiceContext'][_0x8a8d('0xf9')](db[_0x8a8d('0x17')],{'onDelete':_0x8a8d('0xf5')});db[_0x8a8d('0x17')][_0x8a8d('0xf9')](db[_0x8a8d('0x17')],{'as':'Applications','onDelete':_0x8a8d('0xf5')});db['VoiceMusicOnHold'][_0x8a8d('0x104')](db['Sound'],{'as':'Sounds','through':_0x8a8d('0x122')});db[_0x8a8d('0x19')][_0x8a8d('0xf9')](db[_0x8a8d('0x29')],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0x8a8d('0x19')][_0x8a8d('0xf9')](db[_0x8a8d('0x123')],{'as':_0x8a8d('0x124'),'foreignKey':_0x8a8d('0x125')});db[_0x8a8d('0x19')][_0x8a8d('0xf9')](db['CmHopperFinal'],{'as':_0x8a8d('0x126'),'foreignKey':_0x8a8d('0x125')});db[_0x8a8d('0x19')][_0x8a8d('0xf9')](db[_0x8a8d('0x6c')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db[_0x8a8d('0x19')][_0x8a8d('0xf9')](db[_0x8a8d('0x6e')],{'as':_0x8a8d('0x6e'),'foreignKey':_0x8a8d('0x125')});db['VoiceQueue'][_0x8a8d('0xf9')](db[_0x8a8d('0x68')],{'as':_0x8a8d('0x127'),'foreignKey':_0x8a8d('0x125')});db['VoiceQueue'][_0x8a8d('0xf9')](db[_0x8a8d('0x128')],{'as':_0x8a8d('0x129'),'foreignKey':_0x8a8d('0x125')});db[_0x8a8d('0x19')][_0x8a8d('0x103')](db[_0x8a8d('0x25')],{'as':'Trunk','foreignKey':_0x8a8d('0x12a')});db[_0x8a8d('0x19')][_0x8a8d('0x103')](db[_0x8a8d('0x25')],{'as':'TrunkBackup','foreignKey':_0x8a8d('0x12b')});db[_0x8a8d('0x19')]['belongsTo'](db[_0x8a8d('0x79')],{'as':_0x8a8d('0x79'),'foreignKey':_0x8a8d('0x12c')});db['VoiceQueue']['belongsTo'](db['Pause'],{'as':_0x8a8d('0x12d'),'foreignKey':_0x8a8d('0x12e')});db[_0x8a8d('0x19')][_0x8a8d('0x104')](db[_0x8a8d('0xec')],{'as':_0x8a8d('0x12f'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue']['belongsToMany'](db[_0x8a8d('0x12')],{'as':_0x8a8d('0x130'),'through':_0x8a8d('0x2b')});db[_0x8a8d('0x19')][_0x8a8d('0x104')](db[_0x8a8d('0xdc')],{'as':'Teams','through':_0x8a8d('0x131')});db[_0x8a8d('0x19')][_0x8a8d('0x104')](db[_0x8a8d('0xec')],{'as':_0x8a8d('0x132'),'through':_0x8a8d('0x133')});db[_0x8a8d('0xf7')][_0x8a8d('0x103')](db['User'],{'as':_0x8a8d('0x12'),'foreignKey':_0x8a8d('0xf6')});db['ScreenRecording'][_0x8a8d('0x103')](db[_0x8a8d('0x12')],{'as':'User','foreignKey':_0x8a8d('0xf6')});db[_0x8a8d('0x1b')][_0x8a8d('0xf9')](db[_0x8a8d('0x134')],{'as':_0x8a8d('0x135'),'onDelete':_0x8a8d('0xf5'),'foreignKey':'mailboxuser','sourceKey':_0x8a8d('0x136')});db[_0x8a8d('0x134')][_0x8a8d('0x103')](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0x8a8d('0x136')});db['VoiceCallReport'][_0x8a8d('0xf9')](db[_0x8a8d('0x22')],{'as':_0x8a8d('0x137'),'foreignKey':_0x8a8d('0x138'),'constraints':![]});db[_0x8a8d('0x139')][_0x8a8d('0xf9')](db['VoiceAgentReport'],{'as':_0x8a8d('0x13a'),'foreignKey':_0x8a8d('0x138'),'constraints':![]});db[_0x8a8d('0x139')]['belongsTo'](db[_0x8a8d('0x12')],{'as':_0x8a8d('0x12'),'foreignKey':_0x8a8d('0xf6')});db['VoiceCallReport'][_0x8a8d('0x103')](db['CmContact'],{'as':'Contact','foreignKey':_0x8a8d('0x13b')});db[_0x8a8d('0x35')][_0x8a8d('0x103')](db[_0x8a8d('0x119')],{'as':_0x8a8d('0x119'),'foreignKey':_0x8a8d('0x13c')});db['MailServerOut']['belongsTo'](db[_0x8a8d('0x119')],{'as':_0x8a8d('0x119'),'foreignKey':_0x8a8d('0x13c')});db[_0x8a8d('0x119')][_0x8a8d('0xf4')](db[_0x8a8d('0x35')],{'as':_0x8a8d('0x13d'),'onDelete':_0x8a8d('0xf5')});db[_0x8a8d('0x119')][_0x8a8d('0xf4')](db[_0x8a8d('0x13e')],{'as':'Smtp','onDelete':_0x8a8d('0xf5')});db[_0x8a8d('0x119')]['hasMany'](db[_0x8a8d('0x76')],{'as':'Dispositions','foreignKey':_0x8a8d('0x13c')});db[_0x8a8d('0x119')]['hasMany'](db['CannedAnswer'],{'as':_0x8a8d('0x13f'),'foreignKey':'MailAccountId'});db[_0x8a8d('0x119')]['hasMany'](db[_0x8a8d('0x3d')],{'as':'Messages','foreignKey':'MailAccountId'});db['MailAccount']['hasMany'](db[_0x8a8d('0x102')],{'as':_0x8a8d('0x140')});db[_0x8a8d('0x119')][_0x8a8d('0xf9')](db['MailApplication'],{'as':_0x8a8d('0x141')});db['MailAccount']['belongsTo'](db[_0x8a8d('0xec')],{'as':_0x8a8d('0x142'),'foreignKey':_0x8a8d('0x143')});db[_0x8a8d('0x119')][_0x8a8d('0x103')](db['Template'],{'as':_0x8a8d('0x85'),'foreignKey':_0x8a8d('0x144')});db[_0x8a8d('0x119')][_0x8a8d('0x103')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x8a8d('0x12e')});db[_0x8a8d('0x119')]['belongsToMany'](db[_0x8a8d('0x12')],{'as':_0x8a8d('0x130'),'through':'user_has_mail_accounts'});db[_0x8a8d('0x39')][_0x8a8d('0x104')](db['User'],{'as':_0x8a8d('0x130'),'through':_0x8a8d('0x2e')});db['MailQueue']['belongsToMany'](db['Team'],{'through':_0x8a8d('0x145'),'as':_0x8a8d('0x146')});db[_0x8a8d('0x102')][_0x8a8d('0xf9')](db[_0x8a8d('0x3d')],{'as':_0x8a8d('0x135'),'onDelete':_0x8a8d('0xf5'),'foreignKey':'MailInteractionId'});db[_0x8a8d('0x102')][_0x8a8d('0x103')](db[_0x8a8d('0x119')],{'as':'Account','foreignKey':'MailAccountId'});db[_0x8a8d('0x102')][_0x8a8d('0x103')](db[_0x8a8d('0x66')],{'as':_0x8a8d('0x147'),'foreignKey':_0x8a8d('0x13b')});db[_0x8a8d('0x102')]['belongsTo'](db['User'],{'as':_0x8a8d('0x148'),'foreignKey':_0x8a8d('0xf6')});db[_0x8a8d('0x102')][_0x8a8d('0x104')](db['Tag'],{'through':_0x8a8d('0x149'),'as':_0x8a8d('0x14a')});db['MailInteraction']['belongsToMany'](db['Tag'],{'through':_0x8a8d('0x149'),'as':_0x8a8d('0x14b')});db[_0x8a8d('0x102')][_0x8a8d('0x104')](db[_0x8a8d('0x12')],{'as':_0x8a8d('0x14c'),'through':_0x8a8d('0x14d'),'foreignKey':_0x8a8d('0x14e')});db[_0x8a8d('0x3d')][_0x8a8d('0xf9')](db[_0x8a8d('0x14f')],{'as':_0x8a8d('0x150'),'onDelete':'cascade'});db[_0x8a8d('0x3d')][_0x8a8d('0x103')](db[_0x8a8d('0x12')],{'as':_0x8a8d('0x12')});db['MailMessage'][_0x8a8d('0x103')](db[_0x8a8d('0x66')],{'onDelete':_0x8a8d('0xf5'),'as':'Contact'});db['MailMessage'][_0x8a8d('0x103')](db[_0x8a8d('0x102')],{'as':_0x8a8d('0x151'),'foreignKey':_0x8a8d('0x14e')});db[_0x8a8d('0x3d')]['belongsTo'](db[_0x8a8d('0x119')],{'as':_0x8a8d('0x152'),'foreignKey':_0x8a8d('0x13c')});db[_0x8a8d('0x153')][_0x8a8d('0x103')](db[_0x8a8d('0x12')],{'onDelete':_0x8a8d('0x154')});db[_0x8a8d('0x153')][_0x8a8d('0x103')](db[_0x8a8d('0x39')],{'onDelete':_0x8a8d('0x154')});db['MailApplication']['belongsTo'](db[_0x8a8d('0x119')],{'onDelete':'restrict'});db[_0x8a8d('0x153')][_0x8a8d('0x103')](db[_0x8a8d('0x79')],{'onDelete':'restrict','foreignKey':_0x8a8d('0x12c')});db[_0x8a8d('0x153')][_0x8a8d('0x103')](db[_0x8a8d('0x83')],{'onDelete':_0x8a8d('0x154'),'foreignKey':_0x8a8d('0x155')});db['MailQueueReport'][_0x8a8d('0x103')](db[_0x8a8d('0x119')],{});db['MailQueueReport'][_0x8a8d('0x103')](db[_0x8a8d('0xec')],{'as':_0x8a8d('0x142'),'foreignKey':'ListId'});db['MailQueueReport'][_0x8a8d('0x103')](db[_0x8a8d('0x66')],{'as':_0x8a8d('0x147'),'foreignKey':'ContactId'});db['MailQueueReport'][_0x8a8d('0x103')](db['MailInteraction'],{});db['MailQueueReport']['belongsTo'](db[_0x8a8d('0x3d')],{});db[_0x8a8d('0x3f')][_0x8a8d('0x103')](db[_0x8a8d('0x12')],{});db[_0x8a8d('0x3f')][_0x8a8d('0x103')](db[_0x8a8d('0x39')],{});db[_0x8a8d('0x41')][_0x8a8d('0xf9')](db[_0x8a8d('0x43')],{'as':_0x8a8d('0x156'),'onDelete':_0x8a8d('0xf5')});db[_0x8a8d('0x45')]['hasMany'](db[_0x8a8d('0x76')],{'as':_0x8a8d('0x157'),'foreignKey':_0x8a8d('0x158')});db[_0x8a8d('0x45')][_0x8a8d('0xf9')](db[_0x8a8d('0x159')],{'as':_0x8a8d('0x13f'),'foreignKey':_0x8a8d('0x158')});db[_0x8a8d('0x45')][_0x8a8d('0xf9')](db['FaxInteraction'],{'as':_0x8a8d('0x140')});db[_0x8a8d('0x45')][_0x8a8d('0xf9')](db['FaxApplication'],{'as':_0x8a8d('0x141')});db[_0x8a8d('0x45')]['hasMany'](db[_0x8a8d('0x17')],{'as':_0x8a8d('0x15a'),'onDelete':'cascade'});db[_0x8a8d('0x45')][_0x8a8d('0xf9')](db[_0x8a8d('0x4b')],{'as':'Messages'});db['FaxAccount']['belongsTo'](db[_0x8a8d('0x25')],{'as':'Trunk'});db['FaxAccount'][_0x8a8d('0x103')](db[_0x8a8d('0xec')],{'as':_0x8a8d('0x142'),'foreignKey':'ListId'});db[_0x8a8d('0x45')][_0x8a8d('0x103')](db[_0x8a8d('0x15b')],{'as':_0x8a8d('0x12d'),'foreignKey':_0x8a8d('0x12e')});db[_0x8a8d('0x45')]['belongsToMany'](db[_0x8a8d('0x12')],{'as':_0x8a8d('0x130'),'through':_0x8a8d('0x15c')});db[_0x8a8d('0x47')][_0x8a8d('0x103')](db[_0x8a8d('0x12')],{'onDelete':'restrict'});db['FaxApplication'][_0x8a8d('0x103')](db[_0x8a8d('0x15d')],{'onDelete':'restrict'});db[_0x8a8d('0x47')][_0x8a8d('0x103')](db['FaxAccount'],{'onDelete':'restrict'});db[_0x8a8d('0x47')][_0x8a8d('0x103')](db[_0x8a8d('0x83')],{'onDelete':_0x8a8d('0x154'),'foreignKey':_0x8a8d('0x155')});db['FaxInteraction'][_0x8a8d('0xf9')](db[_0x8a8d('0x4b')],{'as':_0x8a8d('0x135'),'onDelete':'cascade','foreignKey':_0x8a8d('0x15e')});db[_0x8a8d('0x49')][_0x8a8d('0x103')](db['FaxAccount'],{'as':_0x8a8d('0x152'),'foreignKey':_0x8a8d('0x158')});db[_0x8a8d('0x49')][_0x8a8d('0x103')](db['CmContact'],{'as':_0x8a8d('0x147'),'foreignKey':_0x8a8d('0x13b')});db[_0x8a8d('0x49')]['belongsTo'](db[_0x8a8d('0x12')],{'as':_0x8a8d('0x148'),'foreignKey':_0x8a8d('0xf6')});db[_0x8a8d('0x49')][_0x8a8d('0x104')](db[_0x8a8d('0x83')],{'through':_0x8a8d('0x15f'),'as':_0x8a8d('0x14a')});db['FaxInteraction'][_0x8a8d('0x104')](db[_0x8a8d('0x83')],{'through':_0x8a8d('0x15f'),'as':_0x8a8d('0x14b')});db[_0x8a8d('0x49')][_0x8a8d('0x104')](db[_0x8a8d('0x12')],{'as':_0x8a8d('0x14c'),'through':_0x8a8d('0x10c'),'foreignKey':_0x8a8d('0x15e')});db[_0x8a8d('0x4b')][_0x8a8d('0x103')](db[_0x8a8d('0x12')],{'onDelete':'cascade','as':'User'});db[_0x8a8d('0x4b')][_0x8a8d('0x103')](db[_0x8a8d('0x49')],{'as':_0x8a8d('0x151'),'foreignKey':_0x8a8d('0x15e')});db['FaxMessage'][_0x8a8d('0x103')](db[_0x8a8d('0x66')],{'onDelete':_0x8a8d('0xf5'),'as':_0x8a8d('0x147')});db[_0x8a8d('0x4b')]['belongsTo'](db[_0x8a8d('0x14f')],{'as':'Attachment','foreignKey':_0x8a8d('0x160')});db['FaxMessage'][_0x8a8d('0x103')](db[_0x8a8d('0x45')],{'as':_0x8a8d('0x152'),'foreignKey':_0x8a8d('0x158')});db[_0x8a8d('0x15d')][_0x8a8d('0x104')](db[_0x8a8d('0x12')],{'as':'Agents','through':_0x8a8d('0x30')});db['FaxQueue'][_0x8a8d('0x104')](db[_0x8a8d('0xdc')],{'through':'team_has_fax_queues','as':_0x8a8d('0x146')});db[_0x8a8d('0x4e')][_0x8a8d('0x103')](db[_0x8a8d('0x45')],{});db[_0x8a8d('0x4e')][_0x8a8d('0x103')](db[_0x8a8d('0xec')],{'as':'List','foreignKey':_0x8a8d('0x143')});db[_0x8a8d('0x4e')][_0x8a8d('0x103')](db[_0x8a8d('0x66')],{'as':_0x8a8d('0x147'),'foreignKey':'ContactId'});db[_0x8a8d('0x4e')][_0x8a8d('0x103')](db[_0x8a8d('0x49')],{});db[_0x8a8d('0x4e')]['belongsTo'](db['FaxMessage'],{});db['FaxQueueReport'][_0x8a8d('0x103')](db[_0x8a8d('0x12')],{});db[_0x8a8d('0x4e')][_0x8a8d('0x103')](db[_0x8a8d('0x15d')],{});db[_0x8a8d('0x50')][_0x8a8d('0xf9')](db[_0x8a8d('0x76')],{'as':_0x8a8d('0x157'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x8a8d('0xf9')](db[_0x8a8d('0x159')],{'as':'Answers','foreignKey':'SmsAccountId'});db[_0x8a8d('0x50')][_0x8a8d('0xf9')](db[_0x8a8d('0x53')],{'as':_0x8a8d('0x135'),'foreignKey':_0x8a8d('0x161')});db[_0x8a8d('0x50')][_0x8a8d('0xf9')](db[_0x8a8d('0xff')],{'as':_0x8a8d('0x140')});db[_0x8a8d('0x50')][_0x8a8d('0xf9')](db[_0x8a8d('0x52')],{'as':_0x8a8d('0x141')});db[_0x8a8d('0x50')][_0x8a8d('0x103')](db[_0x8a8d('0xec')],{'as':_0x8a8d('0x142'),'foreignKey':_0x8a8d('0x143')});db['SmsAccount']['belongsTo'](db[_0x8a8d('0x15b')],{'as':_0x8a8d('0x12d'),'foreignKey':_0x8a8d('0x12e')});db['SmsAccount'][_0x8a8d('0x104')](db[_0x8a8d('0x12')],{'as':_0x8a8d('0x130'),'through':_0x8a8d('0x11d')});db[_0x8a8d('0x52')]['belongsTo'](db[_0x8a8d('0x12')],{'onDelete':_0x8a8d('0x154')});db[_0x8a8d('0x52')][_0x8a8d('0x103')](db[_0x8a8d('0x162')],{'onDelete':_0x8a8d('0x154')});db[_0x8a8d('0x52')][_0x8a8d('0x103')](db[_0x8a8d('0x50')],{'onDelete':_0x8a8d('0x154')});db[_0x8a8d('0x52')][_0x8a8d('0x103')](db[_0x8a8d('0x79')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['SmsApplication'][_0x8a8d('0x103')](db[_0x8a8d('0x83')],{'onDelete':_0x8a8d('0x154'),'foreignKey':_0x8a8d('0x155')});db['SmsInteraction'][_0x8a8d('0xf9')](db[_0x8a8d('0x53')],{'as':_0x8a8d('0x135'),'onDelete':_0x8a8d('0xf5'),'foreignKey':'SmsInteractionId'});db[_0x8a8d('0xff')]['belongsTo'](db['SmsAccount'],{'as':'Account','foreignKey':'SmsAccountId'});db[_0x8a8d('0xff')]['belongsTo'](db[_0x8a8d('0x66')],{'as':'Contact','foreignKey':_0x8a8d('0x13b')});db[_0x8a8d('0xff')][_0x8a8d('0x103')](db[_0x8a8d('0x12')],{'as':_0x8a8d('0x148'),'foreignKey':_0x8a8d('0xf6')});db['SmsInteraction'][_0x8a8d('0x104')](db[_0x8a8d('0x83')],{'through':_0x8a8d('0x163'),'as':_0x8a8d('0x14a')});db[_0x8a8d('0xff')][_0x8a8d('0x104')](db[_0x8a8d('0x83')],{'through':_0x8a8d('0x163'),'as':'ThroughTags'});db[_0x8a8d('0xff')][_0x8a8d('0x104')](db[_0x8a8d('0x12')],{'as':_0x8a8d('0x14c'),'through':_0x8a8d('0x164'),'foreignKey':_0x8a8d('0x165')});db[_0x8a8d('0x53')][_0x8a8d('0x103')](db[_0x8a8d('0x12')],{'as':'User'});db[_0x8a8d('0x53')][_0x8a8d('0x103')](db['CmContact'],{'onDelete':_0x8a8d('0xf5'),'as':_0x8a8d('0x147')});db[_0x8a8d('0x53')][_0x8a8d('0x103')](db[_0x8a8d('0xff')],{'onDelete':_0x8a8d('0xf5'),'as':_0x8a8d('0x151'),'foreignKey':'SmsInteractionId'});db[_0x8a8d('0x53')][_0x8a8d('0x103')](db[_0x8a8d('0x50')],{'as':_0x8a8d('0x152'),'foreignKey':_0x8a8d('0x161')});db[_0x8a8d('0x162')][_0x8a8d('0x104')](db[_0x8a8d('0x12')],{'as':_0x8a8d('0x130'),'through':_0x8a8d('0x32'),'foreignKey':'SmsQueueId'});db['SmsQueue']['belongsToMany'](db[_0x8a8d('0xdc')],{'through':_0x8a8d('0x166'),'as':_0x8a8d('0x146')});db[_0x8a8d('0x167')][_0x8a8d('0xf9')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x8a8d('0x168')});db[_0x8a8d('0x167')][_0x8a8d('0xf9')](db[_0x8a8d('0x159')],{'as':_0x8a8d('0x13f'),'foreignKey':'OpenchannelAccountId'});db[_0x8a8d('0x167')][_0x8a8d('0xf9')](db[_0x8a8d('0x56')],{'as':_0x8a8d('0x140'),'foreignKey':_0x8a8d('0x168')});db[_0x8a8d('0x167')][_0x8a8d('0xf9')](db[_0x8a8d('0x58')],{'as':_0x8a8d('0x135'),'foreignKey':_0x8a8d('0x168')});db['OpenchannelAccount'][_0x8a8d('0xf9')](db[_0x8a8d('0x169')],{'as':_0x8a8d('0x141'),'foreignKey':_0x8a8d('0x168')});db[_0x8a8d('0x167')][_0x8a8d('0x103')](db[_0x8a8d('0xec')],{'as':_0x8a8d('0x142'),'foreignKey':'ListId'});db['OpenchannelAccount'][_0x8a8d('0x103')](db[_0x8a8d('0x15b')],{'as':_0x8a8d('0x12d'),'foreignKey':_0x8a8d('0x12e')});db[_0x8a8d('0x167')]['belongsToMany'](db['User'],{'as':_0x8a8d('0x130'),'through':_0x8a8d('0x11b')});db['OpenchannelApplication']['belongsTo'](db[_0x8a8d('0x12')],{'onDelete':_0x8a8d('0x154')});db['OpenchannelApplication'][_0x8a8d('0x103')](db['OpenchannelQueue'],{'onDelete':_0x8a8d('0x154'),'foreignKey':_0x8a8d('0x16a')});db[_0x8a8d('0x169')][_0x8a8d('0x103')](db[_0x8a8d('0x167')],{'onDelete':'restrict','foreignKey':_0x8a8d('0x168')});db['OpenchannelApplication']['belongsTo'](db[_0x8a8d('0x79')],{'onDelete':_0x8a8d('0x154'),'foreignKey':_0x8a8d('0x12c')});db['OpenchannelApplication']['belongsTo'](db[_0x8a8d('0x83')],{'onDelete':_0x8a8d('0x154'),'foreignKey':_0x8a8d('0x155')});db[_0x8a8d('0x56')]['hasMany'](db['OpenchannelMessage'],{'as':_0x8a8d('0x135'),'onDelete':_0x8a8d('0xf5'),'foreignKey':_0x8a8d('0x16b')});db[_0x8a8d('0x56')][_0x8a8d('0x103')](db[_0x8a8d('0x167')],{'as':'Account','foreignKey':_0x8a8d('0x168')});db['OpenchannelInteraction'][_0x8a8d('0x103')](db[_0x8a8d('0x66')],{'as':_0x8a8d('0x147'),'foreignKey':_0x8a8d('0x13b')});db[_0x8a8d('0x56')][_0x8a8d('0x103')](db[_0x8a8d('0x12')],{'as':_0x8a8d('0x148'),'foreignKey':'UserId'});db['OpenchannelInteraction'][_0x8a8d('0x104')](db[_0x8a8d('0x83')],{'through':'openchannel_interaction_has_tags','as':_0x8a8d('0x14a')});db[_0x8a8d('0x56')][_0x8a8d('0x104')](db[_0x8a8d('0x83')],{'through':_0x8a8d('0x16c'),'as':_0x8a8d('0x14b')});db['OpenchannelInteraction']['belongsToMany'](db[_0x8a8d('0x12')],{'as':_0x8a8d('0x14c'),'through':_0x8a8d('0x16d'),'foreignKey':_0x8a8d('0x16b')});db['OpenchannelMessage'][_0x8a8d('0x103')](db['User'],{'onDelete':'cascade','as':_0x8a8d('0x12')});db[_0x8a8d('0x58')][_0x8a8d('0x103')](db['CmContact'],{'onDelete':_0x8a8d('0xf5'),'as':_0x8a8d('0x147')});db[_0x8a8d('0x58')][_0x8a8d('0x103')](db['OpenchannelInteraction'],{'onDelete':_0x8a8d('0xf5'),'as':_0x8a8d('0x151'),'foreignKey':_0x8a8d('0x16b')});db[_0x8a8d('0x58')][_0x8a8d('0x103')](db[_0x8a8d('0x14f')],{'as':_0x8a8d('0x14f'),'foreignKey':_0x8a8d('0x160')});db[_0x8a8d('0x58')][_0x8a8d('0x103')](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0x8a8d('0x168')});db[_0x8a8d('0x111')][_0x8a8d('0x104')](db[_0x8a8d('0x12')],{'as':_0x8a8d('0x130'),'through':_0x8a8d('0x113'),'foreignKey':_0x8a8d('0x16a')});db[_0x8a8d('0x111')][_0x8a8d('0x104')](db[_0x8a8d('0xdc')],{'through':_0x8a8d('0x16e'),'as':_0x8a8d('0x146')});db['ChatWebsite'][_0x8a8d('0xf9')](db[_0x8a8d('0x76')],{'as':_0x8a8d('0x157'),'foreignKey':_0x8a8d('0x16f')});db[_0x8a8d('0x115')][_0x8a8d('0xf9')](db['CannedAnswer'],{'as':_0x8a8d('0x13f'),'foreignKey':_0x8a8d('0x16f')});db['ChatWebsite'][_0x8a8d('0xf9')](db['ChatProactiveAction'],{'as':_0x8a8d('0x170')});db['ChatWebsite'][_0x8a8d('0xf9')](db[_0x8a8d('0xfd')],{'as':_0x8a8d('0x140')});db[_0x8a8d('0x115')][_0x8a8d('0xf9')](db[_0x8a8d('0x171')],{'as':_0x8a8d('0x141')});db[_0x8a8d('0x115')][_0x8a8d('0xf9')](db['ChatMessage'],{'as':'Messages'});db[_0x8a8d('0x115')][_0x8a8d('0x103')](db['CmList'],{'as':'List','foreignKey':_0x8a8d('0x143')});db[_0x8a8d('0x115')][_0x8a8d('0x103')](db['Interval'],{'as':_0x8a8d('0x79'),'foreignKey':_0x8a8d('0x12c')});db['ChatWebsite'][_0x8a8d('0x103')](db[_0x8a8d('0x15b')],{'as':_0x8a8d('0x12d'),'foreignKey':_0x8a8d('0x12e')});db[_0x8a8d('0x115')]['belongsToMany'](db['User'],{'as':_0x8a8d('0x130'),'through':_0x8a8d('0x117')});db['OpenchannelQueueReport'][_0x8a8d('0x103')](db[_0x8a8d('0x167')],{});db[_0x8a8d('0x5b')][_0x8a8d('0x103')](db[_0x8a8d('0xec')],{'as':_0x8a8d('0x142'),'foreignKey':_0x8a8d('0x143')});db[_0x8a8d('0x5b')][_0x8a8d('0x103')](db[_0x8a8d('0x66')],{'as':_0x8a8d('0x147'),'foreignKey':_0x8a8d('0x13b')});db[_0x8a8d('0x5b')][_0x8a8d('0x103')](db['OpenchannelInteraction'],{});db[_0x8a8d('0x5b')]['belongsTo'](db[_0x8a8d('0x58')],{});db[_0x8a8d('0x5b')][_0x8a8d('0x103')](db[_0x8a8d('0x12')],{});db[_0x8a8d('0x5b')][_0x8a8d('0x103')](db[_0x8a8d('0x111')],{});db[_0x8a8d('0x171')][_0x8a8d('0x103')](db[_0x8a8d('0x12')],{'as':'Agent','foreignKey':_0x8a8d('0xf6'),'onDelete':_0x8a8d('0x154')});db[_0x8a8d('0x171')][_0x8a8d('0x103')](db[_0x8a8d('0x10e')],{'as':_0x8a8d('0x172'),'foreignKey':_0x8a8d('0x173'),'onDelete':_0x8a8d('0x154')});db[_0x8a8d('0x171')][_0x8a8d('0x103')](db[_0x8a8d('0x115')],{'as':_0x8a8d('0x174'),'foreignKey':_0x8a8d('0x16f'),'onDelete':_0x8a8d('0x154')});db[_0x8a8d('0x171')][_0x8a8d('0x103')](db[_0x8a8d('0x83')],{'onDelete':_0x8a8d('0x154'),'foreignKey':'TagId'});db[_0x8a8d('0xfd')]['hasMany'](db[_0x8a8d('0x5e')],{'as':_0x8a8d('0x135'),'onDelete':_0x8a8d('0xf5'),'foreignKey':_0x8a8d('0x175')});db[_0x8a8d('0xfd')]['belongsTo'](db[_0x8a8d('0x115')],{'as':_0x8a8d('0x152'),'foreignKey':_0x8a8d('0x16f')});db[_0x8a8d('0xfd')][_0x8a8d('0x103')](db[_0x8a8d('0x66')],{'as':_0x8a8d('0x147'),'foreignKey':_0x8a8d('0x13b')});db[_0x8a8d('0xfd')]['belongsTo'](db['User'],{'as':_0x8a8d('0x148'),'foreignKey':'UserId'});db['ChatInteraction']['belongsToMany'](db[_0x8a8d('0x83')],{'through':_0x8a8d('0x176'),'as':_0x8a8d('0x14a')});db[_0x8a8d('0xfd')][_0x8a8d('0x104')](db[_0x8a8d('0x83')],{'through':_0x8a8d('0x176'),'as':'ThroughTags'});db[_0x8a8d('0xfd')][_0x8a8d('0x104')](db[_0x8a8d('0x12')],{'as':_0x8a8d('0x14c'),'through':_0x8a8d('0x10b'),'foreignKey':_0x8a8d('0x175')});db[_0x8a8d('0x5e')][_0x8a8d('0x103')](db['User'],{'onDelete':'cascade','as':_0x8a8d('0x12')});db[_0x8a8d('0x5e')][_0x8a8d('0x103')](db[_0x8a8d('0x66')],{'onDelete':_0x8a8d('0xf5'),'as':'Contact','foreignKey':_0x8a8d('0x13b')});db[_0x8a8d('0x5e')][_0x8a8d('0x103')](db['ChatInteraction'],{'onDelete':_0x8a8d('0xf5'),'as':_0x8a8d('0x151'),'foreignKey':_0x8a8d('0x175')});db[_0x8a8d('0x5e')][_0x8a8d('0x103')](db[_0x8a8d('0x14f')],{'as':_0x8a8d('0x14f'),'foreignKey':_0x8a8d('0x160')});db[_0x8a8d('0x5e')]['belongsTo'](db[_0x8a8d('0x115')],{'as':_0x8a8d('0x152'),'foreignKey':'ChatWebsiteId'});db[_0x8a8d('0x60')]['belongsTo'](db['CmContact'],{'onDelete':_0x8a8d('0xf5'),'as':_0x8a8d('0x147'),'foreignKey':_0x8a8d('0x13b')});db['ChatOfflineMessage']['belongsTo'](db['ChatWebsite'],{'as':_0x8a8d('0x152'),'foreignKey':_0x8a8d('0x16f')});db[_0x8a8d('0x10e')][_0x8a8d('0x104')](db[_0x8a8d('0x12')],{'as':_0x8a8d('0x130'),'through':_0x8a8d('0x177'),'hooks':!![]});db[_0x8a8d('0x10e')][_0x8a8d('0x104')](db[_0x8a8d('0xdc')],{'through':_0x8a8d('0x178'),'as':'Teams'});db[_0x8a8d('0x62')]['hasMany'](db['ChatInternalMessage'],{'as':_0x8a8d('0x135'),'foreignKey':_0x8a8d('0x179'),'onDelete':_0x8a8d('0xf5')});db[_0x8a8d('0x62')]['belongsToMany'](db[_0x8a8d('0x12')],{'as':'Members','through':_0x8a8d('0x17a')});db[_0x8a8d('0x63')][_0x8a8d('0x103')](db['ChatWebsite'],{'as':_0x8a8d('0x174'),'foreignKey':_0x8a8d('0x16f')});db[_0x8a8d('0x64')][_0x8a8d('0xf9')](db['CmContact'],{'as':_0x8a8d('0x106'),'foreignKey':'CompanyId'});db['CmContact'][_0x8a8d('0xf9')](db[_0x8a8d('0x123')],{'as':_0x8a8d('0x124'),'foreignKey':'ContactId'});db[_0x8a8d('0x66')][_0x8a8d('0xf9')](db[_0x8a8d('0x6a')],{'as':_0x8a8d('0x126'),'foreignKey':_0x8a8d('0x13b')});db[_0x8a8d('0x66')][_0x8a8d('0xf9')](db[_0x8a8d('0x6c')],{'as':_0x8a8d('0x17b'),'foreignKey':_0x8a8d('0x13b')});db[_0x8a8d('0x66')]['hasMany'](db['ReportAgentPreview'],{'as':_0x8a8d('0x6e'),'foreignKey':_0x8a8d('0x13b')});db[_0x8a8d('0x66')][_0x8a8d('0xf9')](db['JscriptySessionReport'],{'as':_0x8a8d('0x129'),'foreignKey':_0x8a8d('0x13b')});db[_0x8a8d('0x66')]['hasMany'](db[_0x8a8d('0x56')],{'as':_0x8a8d('0xfc'),'foreignKey':'ContactId','onDelete':_0x8a8d('0x154')});db[_0x8a8d('0x66')]['hasMany'](db[_0x8a8d('0xfd')],{'as':_0x8a8d('0xfe'),'foreignKey':_0x8a8d('0x13b'),'onDelete':_0x8a8d('0x154')});db[_0x8a8d('0x66')][_0x8a8d('0xf9')](db[_0x8a8d('0xff')],{'as':_0x8a8d('0x100'),'foreignKey':_0x8a8d('0x13b'),'onDelete':_0x8a8d('0x154')});db[_0x8a8d('0x66')][_0x8a8d('0xf9')](db['FaxInteraction'],{'as':_0x8a8d('0x101'),'foreignKey':_0x8a8d('0x13b'),'onDelete':_0x8a8d('0x154')});db[_0x8a8d('0x66')]['hasMany'](db[_0x8a8d('0x102')],{'as':_0x8a8d('0x10a'),'foreignKey':_0x8a8d('0x13b'),'onDelete':_0x8a8d('0x154')});db['CmContact'][_0x8a8d('0x103')](db['CmCompany'],{'as':'Company','foreignKey':_0x8a8d('0x17c')});db[_0x8a8d('0x66')][_0x8a8d('0x103')](db[_0x8a8d('0xec')],{'as':_0x8a8d('0x142'),'foreignKey':_0x8a8d('0x143'),'onDelete':'cascade'});db['CmContact'][_0x8a8d('0x104')](db[_0x8a8d('0x12')],{'as':_0x8a8d('0x14c'),'through':_0x8a8d('0x107')});db['CmContact'][_0x8a8d('0x104')](db['Tag'],{'as':_0x8a8d('0x14a'),'through':_0x8a8d('0x17d')});db['CmContact'][_0x8a8d('0x104')](db[_0x8a8d('0x83')],{'through':_0x8a8d('0x17d'),'as':_0x8a8d('0x14b')});db[_0x8a8d('0x123')]['belongsTo'](db[_0x8a8d('0x66')],{'as':_0x8a8d('0x147'),'foreignKey':_0x8a8d('0x13b'),'onDelete':_0x8a8d('0xf5')});db[_0x8a8d('0x123')][_0x8a8d('0x103')](db[_0x8a8d('0xec')],{'as':_0x8a8d('0x142'),'foreignKey':_0x8a8d('0x143'),'onDelete':_0x8a8d('0xf5')});db['CmHopper']['belongsTo'](db[_0x8a8d('0x12')],{'as':'Agent','foreignKey':_0x8a8d('0xf6')});db[_0x8a8d('0x123')][_0x8a8d('0x103')](db[_0x8a8d('0x19')],{'as':_0x8a8d('0x172'),'foreignKey':'VoiceQueueId','onDelete':_0x8a8d('0xf5')});db[_0x8a8d('0x123')][_0x8a8d('0x103')](db[_0x8a8d('0x17e')],{'as':_0x8a8d('0x17e'),'foreignKey':_0x8a8d('0x17f'),'onDelete':_0x8a8d('0xf5')});db['CmHopper'][_0x8a8d('0x103')](db['User'],{'as':'Owner','foreignKey':'OwnerId'});db['CmHopperBlack'][_0x8a8d('0x103')](db['CmContact'],{'as':_0x8a8d('0x147'),'foreignKey':_0x8a8d('0x13b'),'onDelete':_0x8a8d('0xf5')});db[_0x8a8d('0x68')]['belongsTo'](db['CmList'],{'as':_0x8a8d('0x142'),'foreignKey':_0x8a8d('0x143'),'onDelete':_0x8a8d('0xf5')});db['CmHopperBlack'][_0x8a8d('0x103')](db['VoiceQueue'],{'as':_0x8a8d('0x172'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x8a8d('0x68')][_0x8a8d('0x103')](db[_0x8a8d('0x17e')],{'as':_0x8a8d('0x17e'),'foreignKey':_0x8a8d('0x17f'),'onDelete':'cascade'});db[_0x8a8d('0x73')]['hasMany'](db[_0x8a8d('0x77')],{'as':{'plural':_0x8a8d('0x180'),'singular':_0x8a8d('0x181')},'foreignKey':'AutomationAllId','onDelete':_0x8a8d('0xf5'),'hooks':!![]});db[_0x8a8d('0x73')][_0x8a8d('0xf9')](db['Condition'],{'as':{'plural':'Any','singular':_0x8a8d('0x182')},'foreignKey':_0x8a8d('0x183'),'onDelete':'cascade','hooks':!![]});db[_0x8a8d('0x73')][_0x8a8d('0xf9')](db[_0x8a8d('0x71')],{'as':_0x8a8d('0x184'),'foreignKey':'AutomationId','onDelete':_0x8a8d('0xf5'),'hooks':!![]});db[_0x8a8d('0x79')][_0x8a8d('0xf9')](db[_0x8a8d('0x79')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':_0x8a8d('0xf5'),'hooks':!![],'required':![]});db[_0x8a8d('0x79')][_0x8a8d('0xf9')](db[_0x8a8d('0x17')],{'as':_0x8a8d('0xfa'),'foreignKey':_0x8a8d('0x12c'),'onDelete':_0x8a8d('0x154')});db[_0x8a8d('0x79')][_0x8a8d('0xf9')](db[_0x8a8d('0x153')],{'as':'MailApplications','foreignKey':'IntervalId'});db['Interval']['hasMany'](db['ChatApplication'],{'as':'ChatApplications','foreignKey':'IntervalId'});db['Interval']['hasMany'](db[_0x8a8d('0x47')],{'as':_0x8a8d('0x185'),'foreignKey':_0x8a8d('0x12c')});db[_0x8a8d('0x79')][_0x8a8d('0xf9')](db[_0x8a8d('0x52')],{'as':_0x8a8d('0x186'),'foreignKey':_0x8a8d('0x12c')});db[_0x8a8d('0x7f')]['belongsTo'](db[_0x8a8d('0x119')],{});db[_0x8a8d('0x7f')]['belongsTo'](db[_0x8a8d('0x8d')],{'foreignKey':_0x8a8d('0x187')});db[_0x8a8d('0x7f')][_0x8a8d('0x103')](db['AnalyticCustomReport'],{'foreignKey':_0x8a8d('0x188')});db['Sound']['belongsToMany'](db['VoiceMusicOnHold'],{'as':_0x8a8d('0x189'),'through':_0x8a8d('0x122'),'onDelete':_0x8a8d('0x154')});db[_0x8a8d('0x83')]['belongsToMany'](db[_0x8a8d('0x66')],{'through':_0x8a8d('0x17d')});db['Tag'][_0x8a8d('0x104')](db[_0x8a8d('0xfd')],{'through':_0x8a8d('0x176')});db[_0x8a8d('0x83')][_0x8a8d('0x104')](db[_0x8a8d('0x102')],{'through':_0x8a8d('0x149')});db[_0x8a8d('0x83')][_0x8a8d('0x104')](db[_0x8a8d('0xff')],{'through':_0x8a8d('0x163')});db[_0x8a8d('0x83')][_0x8a8d('0x104')](db[_0x8a8d('0x49')],{'through':'fax_interaction_has_tags'});db[_0x8a8d('0x83')][_0x8a8d('0x104')](db[_0x8a8d('0x56')],{'through':_0x8a8d('0x16c')});db['Trigger'][_0x8a8d('0xf9')](db['Condition'],{'as':{'plural':_0x8a8d('0x18a'),'singular':_0x8a8d('0x18b')},'foreignKey':_0x8a8d('0x18c'),'onDelete':'cascade','hooks':!![]});db[_0x8a8d('0x87')][_0x8a8d('0xf9')](db[_0x8a8d('0x77')],{'as':{'plural':_0x8a8d('0x18d'),'singular':_0x8a8d('0x18e')},'foreignKey':_0x8a8d('0x18f'),'onDelete':_0x8a8d('0xf5'),'hooks':!![]});db[_0x8a8d('0x87')][_0x8a8d('0xf9')](db['Action'],{'as':_0x8a8d('0x184'),'foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db[_0x8a8d('0x190')][_0x8a8d('0xf9')](db[_0x8a8d('0x92')],{'as':'Fields','onDelete':_0x8a8d('0xf5'),'foreignKey':_0x8a8d('0x188'),'hooks':!![]});db['AnalyticDefaultReport']['hasMany'](db[_0x8a8d('0x92')],{'as':_0x8a8d('0x191'),'onDelete':_0x8a8d('0xf5'),'foreignKey':_0x8a8d('0x187')});db['AnalyticMetric']['hasMany'](db['AnalyticFieldReport'],{'as':_0x8a8d('0x191'),'onDelete':_0x8a8d('0xf5'),'foreignKey':_0x8a8d('0x192')});db['AnalyticFieldReport'][_0x8a8d('0x103')](db[_0x8a8d('0x90')],{'foreignKey':_0x8a8d('0x192')});db[_0x8a8d('0x96')][_0x8a8d('0xf9')](db[_0x8a8d('0x97')],{'as':_0x8a8d('0x193'),'onDelete':_0x8a8d('0xf5'),'foreignKey':_0x8a8d('0x194')});db['SalesforceConfiguration'][_0x8a8d('0xf9')](db[_0x8a8d('0x195')],{'as':_0x8a8d('0x196'),'onDelete':_0x8a8d('0xf5'),'foreignKey':_0x8a8d('0x197')});db['SalesforceConfiguration'][_0x8a8d('0xf9')](db[_0x8a8d('0x195')],{'as':_0x8a8d('0x198'),'onDelete':'cascade','foreignKey':_0x8a8d('0x199')});db['SalesforceConfiguration'][_0x8a8d('0xf9')](db[_0x8a8d('0x195')],{'as':'Fields','onDelete':_0x8a8d('0xf5'),'foreignKey':_0x8a8d('0x19a')});db[_0x8a8d('0x97')][_0x8a8d('0x103')](db[_0x8a8d('0x96')],{'as':'Account','foreignKey':_0x8a8d('0x194')});db['SalesforceField'][_0x8a8d('0xf9')](db[_0x8a8d('0x195')],{'as':_0x8a8d('0x19b'),'foreignKey':_0x8a8d('0x197')});db[_0x8a8d('0x195')]['hasMany'](db[_0x8a8d('0x195')],{'as':_0x8a8d('0x19c'),'foreignKey':_0x8a8d('0x199')});db[_0x8a8d('0x195')]['hasMany'](db['SalesforceField'],{'as':_0x8a8d('0x19d'),'foreignKey':_0x8a8d('0x19a')});db[_0x8a8d('0x195')][_0x8a8d('0x103')](db[_0x8a8d('0x19e')],{'as':'Variable','foreignKey':_0x8a8d('0x19f')});db['SugarcrmAccount'][_0x8a8d('0xf9')](db[_0x8a8d('0x9c')],{'as':_0x8a8d('0x193'),'onDelete':'cascade','foreignKey':_0x8a8d('0x194')});db[_0x8a8d('0x9c')][_0x8a8d('0xf9')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0x8a8d('0xf5'),'foreignKey':'SubjectId'});db[_0x8a8d('0x9c')][_0x8a8d('0xf9')](db[_0x8a8d('0x1a0')],{'as':_0x8a8d('0x198'),'onDelete':_0x8a8d('0xf5'),'foreignKey':_0x8a8d('0x199')});db[_0x8a8d('0x9c')]['hasMany'](db[_0x8a8d('0x1a0')],{'as':_0x8a8d('0x191'),'onDelete':_0x8a8d('0xf5'),'foreignKey':_0x8a8d('0x19a')});db[_0x8a8d('0x9c')][_0x8a8d('0x103')](db[_0x8a8d('0x9a')],{'as':'Account','foreignKey':'AccountId'});db['SugarcrmField'][_0x8a8d('0xf9')](db[_0x8a8d('0x1a0')],{'as':_0x8a8d('0x19b'),'foreignKey':_0x8a8d('0x197')});db[_0x8a8d('0x1a0')][_0x8a8d('0xf9')](db[_0x8a8d('0x1a0')],{'as':_0x8a8d('0x19c'),'foreignKey':'DescriptionId'});db['SugarcrmField'][_0x8a8d('0xf9')](db[_0x8a8d('0x1a0')],{'as':_0x8a8d('0x19d'),'foreignKey':_0x8a8d('0x19a')});db[_0x8a8d('0x1a0')]['belongsTo'](db['Variable'],{'as':_0x8a8d('0x19e'),'foreignKey':'VariableId'});db[_0x8a8d('0x9e')][_0x8a8d('0xf9')](db[_0x8a8d('0xa0')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x8a8d('0x194')});db[_0x8a8d('0xa0')]['hasMany'](db['DeskField'],{'as':_0x8a8d('0x196'),'onDelete':_0x8a8d('0xf5'),'foreignKey':_0x8a8d('0x197')});db['DeskConfiguration'][_0x8a8d('0xf9')](db['DeskField'],{'as':_0x8a8d('0x198'),'onDelete':_0x8a8d('0xf5'),'foreignKey':_0x8a8d('0x199')});db['DeskConfiguration'][_0x8a8d('0xf9')](db[_0x8a8d('0xa2')],{'as':_0x8a8d('0x191'),'onDelete':_0x8a8d('0xf5'),'foreignKey':_0x8a8d('0x19a')});db[_0x8a8d('0xa0')]['belongsTo'](db['DeskAccount'],{'as':'Account','foreignKey':'AccountId'});db['DeskConfiguration'][_0x8a8d('0x104')](db['Tag'],{'through':_0x8a8d('0x1a1')});db[_0x8a8d('0xa2')]['hasMany'](db[_0x8a8d('0xa2')],{'as':_0x8a8d('0x19b'),'foreignKey':'SubjectId'});db[_0x8a8d('0xa2')][_0x8a8d('0xf9')](db[_0x8a8d('0xa2')],{'as':_0x8a8d('0x19c'),'foreignKey':_0x8a8d('0x199')});db[_0x8a8d('0xa2')][_0x8a8d('0xf9')](db['DeskField'],{'as':_0x8a8d('0x19d'),'foreignKey':_0x8a8d('0x19a')});db[_0x8a8d('0xa2')]['belongsTo'](db[_0x8a8d('0x19e')],{'as':_0x8a8d('0x19e'),'foreignKey':_0x8a8d('0x19f')});db[_0x8a8d('0xa4')]['hasMany'](db[_0x8a8d('0xa6')],{'as':_0x8a8d('0x193'),'onDelete':_0x8a8d('0xf5'),'foreignKey':'AccountId'});db[_0x8a8d('0xa6')]['hasMany'](db['ZohoField'],{'as':_0x8a8d('0x196'),'onDelete':_0x8a8d('0xf5'),'foreignKey':'SubjectId'});db['ZohoConfiguration'][_0x8a8d('0xf9')](db[_0x8a8d('0x1a2')],{'as':'Descriptions','onDelete':_0x8a8d('0xf5'),'foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0x8a8d('0xf9')](db[_0x8a8d('0x1a2')],{'as':_0x8a8d('0x191'),'onDelete':_0x8a8d('0xf5'),'foreignKey':_0x8a8d('0x19a')});db[_0x8a8d('0xa6')][_0x8a8d('0x103')](db[_0x8a8d('0xa4')],{'as':'Account','foreignKey':_0x8a8d('0x194')});db['ZohoField'][_0x8a8d('0xf9')](db[_0x8a8d('0x1a2')],{'as':_0x8a8d('0x19b'),'foreignKey':_0x8a8d('0x197')});db[_0x8a8d('0x1a2')][_0x8a8d('0xf9')](db[_0x8a8d('0x1a2')],{'as':_0x8a8d('0x19c'),'foreignKey':_0x8a8d('0x199')});db['ZohoField'][_0x8a8d('0xf9')](db[_0x8a8d('0x1a2')],{'as':_0x8a8d('0x19d'),'foreignKey':_0x8a8d('0x19a')});db[_0x8a8d('0x1a2')][_0x8a8d('0x103')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x8a8d('0xa9')]['hasMany'](db['ZendeskConfiguration'],{'as':_0x8a8d('0x193'),'onDelete':_0x8a8d('0xf5'),'foreignKey':_0x8a8d('0x194')});db[_0x8a8d('0xab')][_0x8a8d('0xf9')](db[_0x8a8d('0xad')],{'as':_0x8a8d('0x196'),'foreignKey':_0x8a8d('0x197')});db[_0x8a8d('0xab')][_0x8a8d('0xf9')](db[_0x8a8d('0xad')],{'as':_0x8a8d('0x198'),'foreignKey':_0x8a8d('0x199')});db[_0x8a8d('0xab')][_0x8a8d('0xf9')](db[_0x8a8d('0xad')],{'as':_0x8a8d('0x191'),'foreignKey':_0x8a8d('0x19a')});db[_0x8a8d('0xab')]['belongsTo'](db[_0x8a8d('0xa9')],{'as':_0x8a8d('0x152'),'foreignKey':_0x8a8d('0x194')});db[_0x8a8d('0xab')][_0x8a8d('0x104')](db[_0x8a8d('0x83')],{'through':_0x8a8d('0x1a3')});db[_0x8a8d('0xad')][_0x8a8d('0xf9')](db[_0x8a8d('0xad')],{'as':_0x8a8d('0x19b'),'foreignKey':_0x8a8d('0x197')});db[_0x8a8d('0xad')]['hasMany'](db[_0x8a8d('0xad')],{'as':_0x8a8d('0x19c'),'foreignKey':'DescriptionId'});db[_0x8a8d('0xad')][_0x8a8d('0xf9')](db[_0x8a8d('0xad')],{'as':'Field','foreignKey':'FieldId'});db['ZendeskField'][_0x8a8d('0x103')](db['Variable'],{'as':_0x8a8d('0x19e'),'foreignKey':_0x8a8d('0x19f')});db['FreshdeskAccount'][_0x8a8d('0xf9')](db[_0x8a8d('0x1a4')],{'as':_0x8a8d('0x193'),'onDelete':_0x8a8d('0xf5'),'foreignKey':_0x8a8d('0x194')});db[_0x8a8d('0x1a4')]['hasMany'](db[_0x8a8d('0xb1')],{'as':'Subjects','onDelete':_0x8a8d('0xf5'),'foreignKey':'SubjectId'});db['FreshdeskConfiguration']['hasMany'](db[_0x8a8d('0xb1')],{'as':_0x8a8d('0x198'),'onDelete':_0x8a8d('0xf5'),'foreignKey':'DescriptionId'});db[_0x8a8d('0x1a4')]['hasMany'](db[_0x8a8d('0xb1')],{'as':_0x8a8d('0x191'),'onDelete':_0x8a8d('0xf5'),'foreignKey':_0x8a8d('0x19a')});db[_0x8a8d('0x1a4')][_0x8a8d('0x103')](db[_0x8a8d('0xaf')],{'as':_0x8a8d('0x152'),'foreignKey':_0x8a8d('0x194')});db[_0x8a8d('0x1a4')][_0x8a8d('0x104')](db['Tag'],{'through':_0x8a8d('0x1a5')});db['FreshdeskField']['hasMany'](db[_0x8a8d('0xb1')],{'as':_0x8a8d('0x19b'),'foreignKey':_0x8a8d('0x197')});db[_0x8a8d('0xb1')][_0x8a8d('0xf9')](db[_0x8a8d('0xb1')],{'as':_0x8a8d('0x19c'),'foreignKey':'DescriptionId'});db[_0x8a8d('0xb1')][_0x8a8d('0xf9')](db['FreshdeskField'],{'as':_0x8a8d('0x19d'),'foreignKey':_0x8a8d('0x19a')});db[_0x8a8d('0xb1')][_0x8a8d('0x103')](db[_0x8a8d('0x19e')],{'as':_0x8a8d('0x19e'),'foreignKey':_0x8a8d('0x19f')});db[_0x8a8d('0xb3')][_0x8a8d('0xf9')](db[_0x8a8d('0xb5')],{'as':_0x8a8d('0x193'),'onDelete':'cascade','foreignKey':_0x8a8d('0x194')});db['VtigerConfiguration'][_0x8a8d('0xf9')](db['VtigerField'],{'as':'Subjects','foreignKey':_0x8a8d('0x197')});db['VtigerConfiguration'][_0x8a8d('0xf9')](db['VtigerField'],{'as':_0x8a8d('0x198'),'foreignKey':_0x8a8d('0x199')});db[_0x8a8d('0xb5')][_0x8a8d('0xf9')](db[_0x8a8d('0xb7')],{'as':_0x8a8d('0x191'),'foreignKey':_0x8a8d('0x19a')});db[_0x8a8d('0xb5')][_0x8a8d('0x103')](db[_0x8a8d('0xb3')],{'as':'Account','foreignKey':_0x8a8d('0x194')});db[_0x8a8d('0xb7')][_0x8a8d('0xf9')](db[_0x8a8d('0xb7')],{'as':_0x8a8d('0x19b'),'foreignKey':_0x8a8d('0x197')});db[_0x8a8d('0xb7')]['hasMany'](db[_0x8a8d('0xb7')],{'as':_0x8a8d('0x19c'),'foreignKey':_0x8a8d('0x199')});db[_0x8a8d('0xb7')][_0x8a8d('0xf9')](db[_0x8a8d('0xb7')],{'as':_0x8a8d('0x19d'),'foreignKey':_0x8a8d('0x19a')});db[_0x8a8d('0xb7')][_0x8a8d('0x103')](db[_0x8a8d('0x19e')],{'as':_0x8a8d('0x19e'),'foreignKey':_0x8a8d('0x19f')});db[_0x8a8d('0x1a6')][_0x8a8d('0xf9')](db[_0x8a8d('0xba')],{'as':_0x8a8d('0x193'),'onDelete':_0x8a8d('0xf5'),'foreignKey':_0x8a8d('0x194')});db['ServicenowConfiguration'][_0x8a8d('0xf9')](db[_0x8a8d('0xbc')],{'as':_0x8a8d('0x196'),'foreignKey':_0x8a8d('0x197')});db[_0x8a8d('0xba')]['hasMany'](db[_0x8a8d('0xbc')],{'as':_0x8a8d('0x198'),'foreignKey':'DescriptionId'});db[_0x8a8d('0xba')]['hasMany'](db[_0x8a8d('0xbc')],{'as':'Fields','foreignKey':_0x8a8d('0x19a')});db[_0x8a8d('0xba')][_0x8a8d('0x103')](db[_0x8a8d('0x1a6')],{'as':'Account','foreignKey':_0x8a8d('0x194')});db['ServicenowField'][_0x8a8d('0xf9')](db['ServicenowField'],{'as':'Subject','foreignKey':_0x8a8d('0x197')});db['ServicenowField'][_0x8a8d('0xf9')](db[_0x8a8d('0xbc')],{'as':_0x8a8d('0x19c'),'foreignKey':'DescriptionId'});db[_0x8a8d('0xbc')][_0x8a8d('0xf9')](db[_0x8a8d('0xbc')],{'as':'Field','foreignKey':_0x8a8d('0x19a')});db[_0x8a8d('0xbc')][_0x8a8d('0x103')](db[_0x8a8d('0x19e')],{'as':_0x8a8d('0x19e'),'foreignKey':_0x8a8d('0x19f')});db['Dynamics365Account'][_0x8a8d('0xf9')](db['Dynamics365Configuration'],{'as':_0x8a8d('0x193'),'onDelete':'cascade','foreignKey':_0x8a8d('0x194')});db[_0x8a8d('0xbd')][_0x8a8d('0xf9')](db[_0x8a8d('0xbe')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x8a8d('0x197')});db['Dynamics365Configuration']['hasMany'](db[_0x8a8d('0xbe')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x8a8d('0x199')});db['Dynamics365Configuration']['hasMany'](db[_0x8a8d('0xbe')],{'as':_0x8a8d('0x191'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x8a8d('0xbd')]['belongsTo'](db[_0x8a8d('0x1a7')],{'as':_0x8a8d('0x152'),'foreignKey':_0x8a8d('0x194')});db[_0x8a8d('0xbe')][_0x8a8d('0xf9')](db[_0x8a8d('0xbe')],{'as':_0x8a8d('0x19b'),'foreignKey':'SubjectId'});db['Dynamics365Field']['hasMany'](db['Dynamics365Field'],{'as':'Description','foreignKey':_0x8a8d('0x199')});db['Dynamics365Field']['hasMany'](db[_0x8a8d('0xbe')],{'as':'Field','foreignKey':_0x8a8d('0x19a')});db[_0x8a8d('0xbe')][_0x8a8d('0x103')](db['Variable'],{'as':'Variable','foreignKey':_0x8a8d('0x19f')});db[_0x8a8d('0x1a8')]['hasMany'](db['FreshsalesConfiguration'],{'as':_0x8a8d('0x193'),'onDelete':_0x8a8d('0xf5'),'foreignKey':_0x8a8d('0x194')});db[_0x8a8d('0x1a9')][_0x8a8d('0xf9')](db[_0x8a8d('0xc2')],{'as':_0x8a8d('0x196'),'foreignKey':_0x8a8d('0x197')});db[_0x8a8d('0x1a9')]['hasMany'](db[_0x8a8d('0xc2')],{'as':_0x8a8d('0x198'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration'][_0x8a8d('0xf9')](db['FreshsalesField'],{'as':_0x8a8d('0x191'),'foreignKey':'FieldId'});db[_0x8a8d('0x1a9')]['belongsTo'](db[_0x8a8d('0x1a8')],{'as':_0x8a8d('0x152'),'foreignKey':'AccountId'});db[_0x8a8d('0xc2')][_0x8a8d('0xf9')](db[_0x8a8d('0xc2')],{'as':_0x8a8d('0x19b'),'foreignKey':_0x8a8d('0x197')});db[_0x8a8d('0xc2')][_0x8a8d('0xf9')](db[_0x8a8d('0xc2')],{'as':_0x8a8d('0x19c'),'foreignKey':_0x8a8d('0x199')});db[_0x8a8d('0xc2')][_0x8a8d('0xf9')](db['FreshsalesField'],{'as':_0x8a8d('0x19d'),'foreignKey':'FieldId'});db[_0x8a8d('0xc2')]['belongsTo'](db['Variable'],{'as':_0x8a8d('0x19e'),'foreignKey':_0x8a8d('0x19f')});db[_0x8a8d('0xc6')][_0x8a8d('0x103')](db[_0x8a8d('0x115')],{});db[_0x8a8d('0xc6')][_0x8a8d('0x103')](db[_0x8a8d('0xec')],{'as':_0x8a8d('0x142'),'foreignKey':'ListId'});db[_0x8a8d('0xc6')][_0x8a8d('0x103')](db['CmContact'],{'as':_0x8a8d('0x147'),'foreignKey':'ContactId'});db[_0x8a8d('0xc6')]['belongsTo'](db[_0x8a8d('0xfd')],{});db[_0x8a8d('0xc6')][_0x8a8d('0x103')](db[_0x8a8d('0x5e')],{});db['ChatQueueReport'][_0x8a8d('0x103')](db[_0x8a8d('0x12')],{});db['ChatQueueReport']['belongsTo'](db[_0x8a8d('0x10e')],{});db[_0x8a8d('0xc8')][_0x8a8d('0x103')](db[_0x8a8d('0x12')],{'onDelete':_0x8a8d('0xf5'),'foreignKey':_0x8a8d('0x1aa')});db['ChatInternalMessage'][_0x8a8d('0x103')](db['User'],{'onDelete':'cascade','foreignKey':_0x8a8d('0x1ab')});db[_0x8a8d('0x128')][_0x8a8d('0xf9')](db[_0x8a8d('0xcc')],{'foreignKey':_0x8a8d('0x1ac'),'onDelete':'cascade'});db[_0x8a8d('0x128')][_0x8a8d('0xf9')](db[_0x8a8d('0xca')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x8a8d('0xce')][_0x8a8d('0x103')](db[_0x8a8d('0x50')],{});db['SmsQueueReport']['belongsTo'](db[_0x8a8d('0xec')],{'as':_0x8a8d('0x142'),'foreignKey':_0x8a8d('0x143')});db['SmsQueueReport'][_0x8a8d('0x103')](db['CmContact'],{'as':_0x8a8d('0x147'),'foreignKey':_0x8a8d('0x13b')});db[_0x8a8d('0xce')][_0x8a8d('0x103')](db[_0x8a8d('0xff')],{});db['SmsQueueReport'][_0x8a8d('0x103')](db['SmsMessage'],{});db[_0x8a8d('0xce')][_0x8a8d('0x103')](db[_0x8a8d('0x12')],{});db['SmsQueueReport'][_0x8a8d('0x103')](db['SmsQueue'],{});db[_0x8a8d('0xd3')][_0x8a8d('0xf9')](db[_0x8a8d('0x128')],{'foreignKey':_0x8a8d('0x1ad')});db[_0x8a8d('0xd3')][_0x8a8d('0xf9')](db[_0x8a8d('0xcc')],{'foreignKey':_0x8a8d('0x1ad')});db['JscriptyProject']['hasMany'](db[_0x8a8d('0xca')],{'foreignKey':_0x8a8d('0x1ad')});db[_0x8a8d('0xd8')][_0x8a8d('0x104')](db[_0x8a8d('0x12')],{'as':_0x8a8d('0x14c'),'through':_0x8a8d('0x11f')});db[_0x8a8d('0xdc')][_0x8a8d('0x104')](db[_0x8a8d('0x12')],{'as':_0x8a8d('0x130'),'through':'user_has_teams'});db[_0x8a8d('0xdc')]['belongsToMany'](db['VoiceQueue'],{'through':_0x8a8d('0x131'),'as':'VoiceQueues'});db[_0x8a8d('0xdc')][_0x8a8d('0x104')](db['MailQueue'],{'through':_0x8a8d('0x145'),'as':_0x8a8d('0x10d')});db[_0x8a8d('0xdc')]['belongsToMany'](db[_0x8a8d('0x10e')],{'through':_0x8a8d('0x178'),'as':_0x8a8d('0x10f')});db[_0x8a8d('0xdc')][_0x8a8d('0x104')](db['FaxQueue'],{'through':_0x8a8d('0x1ae'),'as':_0x8a8d('0x110')});db[_0x8a8d('0xdc')][_0x8a8d('0x104')](db[_0x8a8d('0x162')],{'through':'team_has_sms_queues','as':_0x8a8d('0x1af')});db[_0x8a8d('0xdc')][_0x8a8d('0x104')](db[_0x8a8d('0x111')],{'through':'team_has_openchannel_queues','as':_0x8a8d('0x112')});db[_0x8a8d('0x17e')]['hasMany'](db[_0x8a8d('0x123')],{'as':'Hoppers','foreignKey':_0x8a8d('0x17f')});db[_0x8a8d('0x17e')]['hasMany'](db['CmHopperFinal'],{'as':_0x8a8d('0x126'),'foreignKey':_0x8a8d('0x17f')});db[_0x8a8d('0x17e')]['hasMany'](db[_0x8a8d('0x6c')],{'as':_0x8a8d('0x17b'),'foreignKey':'CampaignId'});db[_0x8a8d('0x17e')][_0x8a8d('0xf9')](db[_0x8a8d('0x68')],{'as':'HopperBlacks','foreignKey':_0x8a8d('0x17f')});db['Campaign'][_0x8a8d('0x103')](db['Trunk'],{'as':'Trunk','foreignKey':_0x8a8d('0x12a')});db[_0x8a8d('0x17e')][_0x8a8d('0x103')](db[_0x8a8d('0x25')],{'as':'TrunkBackup','foreignKey':_0x8a8d('0x12b')});db['Campaign'][_0x8a8d('0x103')](db['Interval'],{'as':'Interval','foreignKey':_0x8a8d('0x12c')});db[_0x8a8d('0x17e')][_0x8a8d('0x103')](db['SquareProject'],{'as':_0x8a8d('0xd8'),'foreignKey':'SquareProjectId'});db[_0x8a8d('0x17e')][_0x8a8d('0x104')](db[_0x8a8d('0xec')],{'as':_0x8a8d('0x12f'),'through':'campaigns_has_cm_lists'});db[_0x8a8d('0x17e')]['belongsToMany'](db[_0x8a8d('0xec')],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db['MailTransferReport'][_0x8a8d('0x103')](db[_0x8a8d('0x3d')],{});db[_0x8a8d('0xe6')][_0x8a8d('0x103')](db[_0x8a8d('0x102')],{});db[_0x8a8d('0xe6')][_0x8a8d('0x103')](db[_0x8a8d('0x119')],{'foreignKey':_0x8a8d('0x1b0'),'as':_0x8a8d('0x1b1')});db[_0x8a8d('0xe6')][_0x8a8d('0x103')](db[_0x8a8d('0x12')],{'foreignKey':_0x8a8d('0x1b2'),'as':_0x8a8d('0x1b3')});db[_0x8a8d('0xe6')][_0x8a8d('0x103')](db[_0x8a8d('0x12')],{'foreignKey':_0x8a8d('0x1b4'),'as':_0x8a8d('0x1b5')});db[_0x8a8d('0xe6')]['belongsTo'](db[_0x8a8d('0x39')],{'foreignKey':_0x8a8d('0x1b6'),'as':_0x8a8d('0x1b7')});db[_0x8a8d('0xe6')]['belongsTo'](db[_0x8a8d('0x119')],{'foreignKey':_0x8a8d('0x1b8'),'as':_0x8a8d('0x1b9')});db[_0x8a8d('0xe7')][_0x8a8d('0x103')](db[_0x8a8d('0x5e')],{});db[_0x8a8d('0xe7')]['belongsTo'](db[_0x8a8d('0xfd')],{});db['ChatTransferReport'][_0x8a8d('0x103')](db['ChatWebsite'],{'foreignKey':_0x8a8d('0x1ba'),'as':_0x8a8d('0x1b1')});db[_0x8a8d('0xe7')][_0x8a8d('0x103')](db[_0x8a8d('0x12')],{'foreignKey':_0x8a8d('0x1b2'),'as':'FromAgent'});db[_0x8a8d('0xe7')][_0x8a8d('0x103')](db[_0x8a8d('0x12')],{'foreignKey':_0x8a8d('0x1b4'),'as':_0x8a8d('0x1b5')});db[_0x8a8d('0xe7')][_0x8a8d('0x103')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0x8a8d('0x1b7')});db['ChatTransferReport']['belongsTo'](db[_0x8a8d('0x115')],{'foreignKey':_0x8a8d('0x1bb'),'as':_0x8a8d('0x1b9')});db[_0x8a8d('0x1bc')][_0x8a8d('0x103')](db[_0x8a8d('0x4b')],{});db[_0x8a8d('0x1bc')][_0x8a8d('0x103')](db[_0x8a8d('0x49')],{});db[_0x8a8d('0x1bc')]['belongsTo'](db[_0x8a8d('0x45')],{'foreignKey':_0x8a8d('0x1bd'),'as':_0x8a8d('0x1b1')});db[_0x8a8d('0x1bc')][_0x8a8d('0x103')](db[_0x8a8d('0x12')],{'foreignKey':_0x8a8d('0x1b2'),'as':_0x8a8d('0x1b3')});db['FaxTransferReport']['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x8a8d('0x1bc')][_0x8a8d('0x103')](db['FaxQueue'],{'foreignKey':_0x8a8d('0x1be'),'as':'ToQueue'});db[_0x8a8d('0x1bc')]['belongsTo'](db[_0x8a8d('0x45')],{'foreignKey':_0x8a8d('0x1bf'),'as':_0x8a8d('0x1b9')});db[_0x8a8d('0xe8')][_0x8a8d('0x103')](db['OpenchannelMessage'],{});db[_0x8a8d('0xe8')][_0x8a8d('0x103')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0x8a8d('0x103')](db[_0x8a8d('0x167')],{'foreignKey':_0x8a8d('0x1c0'),'as':_0x8a8d('0x1b1')});db[_0x8a8d('0xe8')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x8a8d('0xe8')][_0x8a8d('0x103')](db[_0x8a8d('0x12')],{'foreignKey':_0x8a8d('0x1b4'),'as':'ToAgent'});db[_0x8a8d('0xe8')][_0x8a8d('0x103')](db[_0x8a8d('0x111')],{'foreignKey':_0x8a8d('0x1c1'),'as':_0x8a8d('0x1b7')});db[_0x8a8d('0xe8')][_0x8a8d('0x103')](db['OpenchannelAccount'],{'foreignKey':_0x8a8d('0x1c2'),'as':_0x8a8d('0x1b9')});db[_0x8a8d('0xea')][_0x8a8d('0x103')](db[_0x8a8d('0x53')],{});db[_0x8a8d('0xea')][_0x8a8d('0x103')](db[_0x8a8d('0xff')],{});db[_0x8a8d('0xea')][_0x8a8d('0x103')](db[_0x8a8d('0x50')],{'foreignKey':'FromSmsAccountId','as':_0x8a8d('0x1b1')});db['SmsTransferReport'][_0x8a8d('0x103')](db[_0x8a8d('0x12')],{'foreignKey':_0x8a8d('0x1b2'),'as':_0x8a8d('0x1b3')});db[_0x8a8d('0xea')]['belongsTo'](db[_0x8a8d('0x12')],{'foreignKey':_0x8a8d('0x1b4'),'as':_0x8a8d('0x1b5')});db[_0x8a8d('0xea')]['belongsTo'](db[_0x8a8d('0x162')],{'foreignKey':_0x8a8d('0x1c3'),'as':_0x8a8d('0x1b7')});db['SmsTransferReport']['belongsTo'](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':_0x8a8d('0x1b9')});db[_0x8a8d('0xec')]['hasMany'](db[_0x8a8d('0x76')],{'as':_0x8a8d('0x157'),'foreignKey':'ListId'});db[_0x8a8d('0xec')][_0x8a8d('0xf9')](db['CmCustomField'],{'as':_0x8a8d('0x1c4'),'foreignKey':_0x8a8d('0x143')});db['CmList']['hasMany'](db['CmContact'],{'as':_0x8a8d('0x106'),'onDelete':_0x8a8d('0xf5'),'foreignKey':_0x8a8d('0x143')});db[_0x8a8d('0xec')][_0x8a8d('0xf9')](db['CmHopperFinal'],{'as':_0x8a8d('0x126'),'foreignKey':_0x8a8d('0x143')});db[_0x8a8d('0xec')][_0x8a8d('0xf9')](db[_0x8a8d('0x6c')],{'as':_0x8a8d('0xfb'),'foreignKey':_0x8a8d('0x143')});db[_0x8a8d('0xec')][_0x8a8d('0xf9')](db[_0x8a8d('0x6e')],{'as':_0x8a8d('0x6e'),'foreignKey':'ListId'});db['CmList'][_0x8a8d('0x104')](db[_0x8a8d('0x19')],{'as':_0x8a8d('0x1c5'),'through':_0x8a8d('0x1c6')});db[_0x8a8d('0xec')]['belongsToMany'](db[_0x8a8d('0x12')],{'as':'Agents','through':_0x8a8d('0x108')});db['VoicePrefix'][_0x8a8d('0xf9')](db[_0x8a8d('0x17')],{'as':'Extensions','onDelete':_0x8a8d('0x154')});db[_0x8a8d('0xee')]['belongsToMany'](db[_0x8a8d('0x12')],{'as':'Agents','through':_0x8a8d('0x114')});db[_0x8a8d('0xf0')][_0x8a8d('0xf9')](db[_0x8a8d('0x12')],{'as':_0x8a8d('0x14c'),'foreignKey':_0x8a8d('0x1c7')});db[_0x8a8d('0xf0')][_0x8a8d('0xf9')](db[_0x8a8d('0xf1')],{'as':'UserProfileSections','foreignKey':_0x8a8d('0x1c7'),'onDelete':_0x8a8d('0xf5')});db['UserProfileSection'][_0x8a8d('0xf9')](db[_0x8a8d('0x1c8')],{'as':_0x8a8d('0x1c9'),'foreignKey':_0x8a8d('0x1ca'),'onDelete':_0x8a8d('0xf5')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 0a7dc0b..797b5a8 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e73=['./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/cannedAnswer','/api/dispositions','./api/disposition','./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/trigger','/api/variables','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./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/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./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/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','static','/apidoc','/www','join','/demo','root','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express-winston','util','./errors','./config/logger','api','auth','default','use','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','x-forwarded-for','headers','remoteAddress','url','statusCode','responseTime','user','name','role','logger','body','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','device','other','agent_id','agent_name','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e73,0x1b8));var _0x35e7=function(_0x5a9148,_0x221b2f){_0x5a9148=_0x5a9148-0x0;var _0x275ab1=_0x5e73[_0x5a9148];return _0x275ab1;};'use strict';var path=require(_0x35e7('0x0'));var express=require('express');var ewinston=require(_0x35e7('0x1'));var util=require(_0x35e7('0x2'));var errors=require(_0x35e7('0x3'));var config=require('./config/environment');var logger=require(_0x35e7('0x4'))(_0x35e7('0x5'));var authLogger=require('./config/logger')(_0x35e7('0x6'));exports[_0x35e7('0x7')]=function(_0x47cdb2){_0x47cdb2[_0x35e7('0x8')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x2ce5d7,_0x341478){return util[_0x35e7('0x9')](_0x35e7('0xa'),_0x2ce5d7[_0x35e7('0xb')],_0x2ce5d7['headers'][_0x35e7('0xc')]?_0x2ce5d7[_0x35e7('0xd')]['x-forwarded-for']:_0x2ce5d7['connection'][_0x35e7('0xe')]||_0x2ce5d7['ip'],_0x2ce5d7[_0x35e7('0xf')],_0x341478[_0x35e7('0x10')],_0x341478[_0x35e7('0x11')],_0x2ce5d7[_0x35e7('0x12')]?_0x2ce5d7['user']['id']:null,_0x2ce5d7['user']?_0x2ce5d7[_0x35e7('0x12')][_0x35e7('0x13')]:null,_0x2ce5d7[_0x35e7('0x12')]?_0x2ce5d7[_0x35e7('0x12')][_0x35e7('0x14')]:null);}}));_0x47cdb2['use'](ewinston[_0x35e7('0x15')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4f9876,_0x5e35b5){var _0x5649f3='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x4f9876['body']&&_0x4f9876['body']['device']&&_0x4f9876[_0x35e7('0x16')]['agent_id']){_0x5649f3=_0x35e7('0x17');}return util[_0x35e7('0x9')](_0x5649f3,_0x4f9876[_0x35e7('0xb')],_0x4f9876['headers'][_0x35e7('0xc')]?_0x4f9876[_0x35e7('0xd')]['x-forwarded-for']:_0x4f9876['connection'][_0x35e7('0xe')]||_0x4f9876['ip'],_0x4f9876[_0x35e7('0xf')],_0x5e35b5[_0x35e7('0x10')],_0x5e35b5['responseTime'],_0x4f9876[_0x35e7('0x12')]?_0x4f9876[_0x35e7('0x12')]['id']:null,_0x4f9876[_0x35e7('0x12')]?_0x4f9876[_0x35e7('0x12')][_0x35e7('0x13')]:null,_0x4f9876[_0x35e7('0x12')]?_0x4f9876[_0x35e7('0x12')][_0x35e7('0x14')]:null,_0x4f9876['body']&&_0x4f9876[_0x35e7('0x16')][_0x35e7('0x18')]?_0x4f9876[_0x35e7('0x16')][_0x35e7('0x18')]:_0x35e7('0x19'),_0x4f9876[_0x35e7('0x16')]&&_0x4f9876[_0x35e7('0x16')][_0x35e7('0x1a')]?_0x4f9876[_0x35e7('0x16')][_0x35e7('0x1a')]:'',_0x4f9876[_0x35e7('0x16')]&&_0x4f9876['body'][_0x35e7('0x1b')]?_0x4f9876[_0x35e7('0x16')][_0x35e7('0x1b')]:'');},'ignoreRoute':function(_0xb34ef7){var _0x52d4ba=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x52d4ba['test'](_0xb34ef7[_0x35e7('0xf')]);}}));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x1c'),require(_0x35e7('0x1d')));_0x47cdb2[_0x35e7('0x8')]('/api/voice/chanspy',require(_0x35e7('0x1e')));_0x47cdb2['use'](_0x35e7('0x1f'),require('./api/voiceContext'));_0x47cdb2['use'](_0x35e7('0x20'),require(_0x35e7('0x21')));_0x47cdb2[_0x35e7('0x8')]('/api/voice/mohs',require(_0x35e7('0x22')));_0x47cdb2['use']('/api/voice/queues',require(_0x35e7('0x23')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x24'),require(_0x35e7('0x25')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x26'),require(_0x35e7('0x27')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x28'),require(_0x35e7('0x29')));_0x47cdb2['use'](_0x35e7('0x2a'),require(_0x35e7('0x2b')));_0x47cdb2['use'](_0x35e7('0x2c'),require(_0x35e7('0x2d')));_0x47cdb2[_0x35e7('0x8')]('/api/voice/dials/reports',require(_0x35e7('0x2e')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x2f'),require(_0x35e7('0x30')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x31'),require('./api/voiceQueueReport'));_0x47cdb2[_0x35e7('0x8')]('/api/members/reports',require(_0x35e7('0x32')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x33'),require('./api/trunk'));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x34'),require(_0x35e7('0x35')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x36'),require(_0x35e7('0x37')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x38'),require(_0x35e7('0x39')));_0x47cdb2['use'](_0x35e7('0x3a'),require(_0x35e7('0x3b')));_0x47cdb2[_0x35e7('0x8')]('/api/mail/substatuses',require(_0x35e7('0x3c')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x3d'),require(_0x35e7('0x3e')));_0x47cdb2[_0x35e7('0x8')]('/api/mail/messages',require('./api/mailMessage'));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x3f'),require(_0x35e7('0x40')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x41'),require(_0x35e7('0x42')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x43'),require('./api/dashboard'));_0x47cdb2['use']('/api/dashboards/items',require(_0x35e7('0x44')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x45'),require(_0x35e7('0x46')));_0x47cdb2['use'](_0x35e7('0x47'),require(_0x35e7('0x48')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x49'),require('./api/faxInteraction'));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x4a'),require(_0x35e7('0x4b')));_0x47cdb2[_0x35e7('0x8')]('/api/fax/queues',require(_0x35e7('0x4c')));_0x47cdb2['use']('/api/fax/reports/queue',require(_0x35e7('0x4d')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x4e'),require(_0x35e7('0x4f')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x50'),require('./api/smsApplication'));_0x47cdb2['use']('/api/sms/interactions',require(_0x35e7('0x51')));_0x47cdb2['use'](_0x35e7('0x52'),require(_0x35e7('0x53')));_0x47cdb2[_0x35e7('0x8')]('/api/sms/queues',require('./api/smsQueue'));_0x47cdb2['use'](_0x35e7('0x54'),require(_0x35e7('0x55')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x56'),require(_0x35e7('0x57')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x58'),require(_0x35e7('0x59')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x5a'),require(_0x35e7('0x5b')));_0x47cdb2['use']('/api/openchannel/queues',require(_0x35e7('0x5c')));_0x47cdb2['use'](_0x35e7('0x5d'),require(_0x35e7('0x5e')));_0x47cdb2['use'](_0x35e7('0x5f'),require(_0x35e7('0x60')));_0x47cdb2[_0x35e7('0x8')]('/api/chat/applications',require(_0x35e7('0x61')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x62'),require('./api/chatInteraction'));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x63'),require(_0x35e7('0x64')));_0x47cdb2[_0x35e7('0x8')]('/api/chat/offline_messages',require(_0x35e7('0x65')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x66'),require(_0x35e7('0x67')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x68'),require('./api/chatGroup'));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x69'),require(_0x35e7('0x6a')));_0x47cdb2['use'](_0x35e7('0x6b'),require(_0x35e7('0x6c')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x6d'),require('./api/cmContact'));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x6e'),require('./api/cmHopper'));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x6f'),require(_0x35e7('0x70')));_0x47cdb2[_0x35e7('0x8')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x47cdb2[_0x35e7('0x8')]('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x47cdb2['use'](_0x35e7('0x71'),require(_0x35e7('0x72')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x73'),require(_0x35e7('0x74')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x75'),require('./api/automation'));_0x47cdb2[_0x35e7('0x8')]('/api/canned_answers',require(_0x35e7('0x76')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x77'),require(_0x35e7('0x78')));_0x47cdb2['use']('/api/conditions',require(_0x35e7('0x79')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x7a'),require(_0x35e7('0x7b')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x7c'),require(_0x35e7('0x7d')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x7e'),require(_0x35e7('0x7f')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x80'),require(_0x35e7('0x81')));_0x47cdb2[_0x35e7('0x8')]('/api/schedules',require('./api/schedule'));_0x47cdb2['use'](_0x35e7('0x82'),require(_0x35e7('0x83')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x84'),require(_0x35e7('0x85')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x86'),require(_0x35e7('0x87')));_0x47cdb2['use']('/api/triggers',require(_0x35e7('0x88')));_0x47cdb2['use'](_0x35e7('0x89'),require('./api/variable'));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x8a'),require(_0x35e7('0x8b')));_0x47cdb2[_0x35e7('0x8')]('/api/integrations/reports',require(_0x35e7('0x8c')));_0x47cdb2['use'](_0x35e7('0x8d'),require('./api/analyticCustomReport'));_0x47cdb2['use'](_0x35e7('0x8e'),require(_0x35e7('0x8f')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x90'),require(_0x35e7('0x91')));_0x47cdb2[_0x35e7('0x8')]('/api/analytics/metrics',require(_0x35e7('0x92')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x93'),require(_0x35e7('0x94')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x95'),require('./api/analyticTreeReport'));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x96'),require(_0x35e7('0x97')));_0x47cdb2['use'](_0x35e7('0x98'),require(_0x35e7('0x99')));_0x47cdb2['use'](_0x35e7('0x9a'),require(_0x35e7('0x9b')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x9c'),require('./api/intSugarcrmAccount'));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x9d'),require('./api/intSugarcrmConfiguration'));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x9e'),require('./api/intSugarcrmField'));_0x47cdb2[_0x35e7('0x8')]('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x9f'),require(_0x35e7('0xa0')));_0x47cdb2[_0x35e7('0x8')]('/api/integrations/desk/fields',require('./api/intDeskField'));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xa1'),require(_0x35e7('0xa2')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xa3'),require(_0x35e7('0xa4')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xa5'),require(_0x35e7('0xa6')));_0x47cdb2[_0x35e7('0x8')]('/api/integrations/zendesk/accounts',require(_0x35e7('0xa7')));_0x47cdb2['use']('/api/integrations/zendesk/configurations',require(_0x35e7('0xa8')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xa9'),require('./api/intZendeskField'));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xaa'),require('./api/intFreshdeskAccount'));_0x47cdb2['use'](_0x35e7('0xab'),require(_0x35e7('0xac')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xad'),require(_0x35e7('0xae')));_0x47cdb2[_0x35e7('0x8')]('/api/integrations/vtiger/accounts',require(_0x35e7('0xaf')));_0x47cdb2['use']('/api/integrations/vtiger/configurations',require(_0x35e7('0xb0')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xb1'),require(_0x35e7('0xb2')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xb3'),require(_0x35e7('0xb4')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xb5'),require('./api/intServicenowConfiguration'));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xb6'),require('./api/intServicenowField'));_0x47cdb2['use'](_0x35e7('0xb7'),require(_0x35e7('0xb8')));_0x47cdb2[_0x35e7('0x8')]('/api/integrations/dynamics365/configurations',require(_0x35e7('0xb9')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xba'),require(_0x35e7('0xbb')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xbc'),require(_0x35e7('0xbd')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xbe'),require(_0x35e7('0xbf')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xc0'),require(_0x35e7('0xc1')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xc2'),require('./api/network'));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xc3'),require(_0x35e7('0xc4')));_0x47cdb2['use'](_0x35e7('0xc5'),require('./api/chatInternalMessage'));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xc6'),require(_0x35e7('0xc7')));_0x47cdb2['use']('/api/jscripty/questions/reports',require(_0x35e7('0xc8')));_0x47cdb2['use'](_0x35e7('0xc9'),require('./api/jscriptySessionReport'));_0x47cdb2[_0x35e7('0x8')]('/api/sms/reports/queue',require(_0x35e7('0xca')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xcb'),require(_0x35e7('0xcc')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xcd'),require(_0x35e7('0xce')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xcf'),require(_0x35e7('0xd0')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xd1'),require(_0x35e7('0xd2')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xd3'),require(_0x35e7('0xd4')));_0x47cdb2['use']('/api/square/projects',require(_0x35e7('0xd5')));_0x47cdb2['use'](_0x35e7('0xd6'),require('./api/squareRecording'));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xd7'),require(_0x35e7('0xd8')));_0x47cdb2['use'](_0x35e7('0xd9'),require(_0x35e7('0xda')));_0x47cdb2['use'](_0x35e7('0xdb'),require('./api/license'));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xdc'),require(_0x35e7('0xdd')));_0x47cdb2['use'](_0x35e7('0xde'),require(_0x35e7('0xdf')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xe0'),require(_0x35e7('0xe1')));_0x47cdb2[_0x35e7('0x8')]('/api/plugins',require(_0x35e7('0xe2')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xe3'),require(_0x35e7('0xe4')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xe5'),require('./api/chatTransferReport'));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xe6'),require(_0x35e7('0xe7')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xe8'),require('./api/openchannelTransferReport'));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xe9'),require(_0x35e7('0xea')));_0x47cdb2['use'](_0x35e7('0xeb'),require('./api/cmList'));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xec'),require(_0x35e7('0xed')));_0x47cdb2['use'](_0x35e7('0xee'),require(_0x35e7('0xef')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xf0'),require('./api/userProfileSection'));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xf1'),require(_0x35e7('0xf2')));_0x47cdb2['use'](_0x35e7('0xf3'),require(_0x35e7('0xf4')));_0x47cdb2['use'](_0x35e7('0xf5'),require('./api/authGoogle'));_0x47cdb2['use'](_0x35e7('0xf6'),require(_0x35e7('0xf7')));_0x47cdb2['use'](_0x35e7('0xf8'),require(_0x35e7('0xf9')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xfa'),require(_0x35e7('0xfb')));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0xfc'),require(_0x35e7('0xfd')));_0x47cdb2[_0x35e7('0x8')]('/api/pm2',require(_0x35e7('0xfe')));_0x47cdb2[_0x35e7('0x8')]('/apidoc',express[_0x35e7('0xff')](path['join'](config['root'],_0x35e7('0x100'))));_0x47cdb2['use'](_0x35e7('0x101'),express['static'](path[_0x35e7('0x102')](config['root'],_0x35e7('0x101'))));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x103'),express[_0x35e7('0xff')](path[_0x35e7('0x102')](config[_0x35e7('0x104')],_0x35e7('0x103'))));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x105'),express['static'](path[_0x35e7('0x102')](config[_0x35e7('0x104')],_0x35e7('0x106'),_0x35e7('0x107'))));_0x47cdb2[_0x35e7('0x8')](_0x35e7('0x108'),express['static'](path[_0x35e7('0x102')](config['root'],_0x35e7('0x109'))));_0x47cdb2[_0x35e7('0x10a')](_0x35e7('0x10b'))[_0x35e7('0x10c')](errors[0x194]);_0x47cdb2[_0x35e7('0x10a')]('/*')[_0x35e7('0x10c')](function(_0x4b502f,_0x2cedf9){_0x2cedf9[_0x35e7('0x10d')](path[_0x35e7('0x10e')](_0x47cdb2['get'](_0x35e7('0x10f'))+_0x35e7('0x110')));});}; \ No newline at end of file +var _0xb574=['/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','resolve','/index.html','path','express','util','./errors','./config/logger','api','auth','default','logger','method','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','user','name','role','use','body','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','statusCode','other','agent_id','agent_name','test','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','./api/interval','/api/pauses','./api/pause','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','/api/analytics/field_reports','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/fields','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','./api/chatQueueReport','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/auth/local','/api/auth/google','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','static','root','/apidoc','join','/www','/demo','/snippet','snippet','/plugins'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xb574,0x106));var _0x4b57=function(_0x28f39d,_0x58bb3a){_0x28f39d=_0x28f39d-0x0;var _0x585174=_0xb574[_0x28f39d];return _0x585174;};'use strict';var path=require(_0x4b57('0x0'));var express=require(_0x4b57('0x1'));var ewinston=require('express-winston');var util=require(_0x4b57('0x2'));var errors=require(_0x4b57('0x3'));var config=require('./config/environment');var logger=require(_0x4b57('0x4'))(_0x4b57('0x5'));var authLogger=require(_0x4b57('0x4'))(_0x4b57('0x6'));exports[_0x4b57('0x7')]=function(_0x4a3efa){_0x4a3efa['use'](ewinston[_0x4b57('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x4a4a0f,_0x585d86){return util['format']('%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s',_0x4a4a0f[_0x4b57('0x9')],_0x4a4a0f[_0x4b57('0xa')][_0x4b57('0xb')]?_0x4a4a0f[_0x4b57('0xa')][_0x4b57('0xb')]:_0x4a4a0f[_0x4b57('0xc')][_0x4b57('0xd')]||_0x4a4a0f['ip'],_0x4a4a0f[_0x4b57('0xe')],_0x585d86['statusCode'],_0x585d86[_0x4b57('0xf')],_0x4a4a0f[_0x4b57('0x10')]?_0x4a4a0f[_0x4b57('0x10')]['id']:null,_0x4a4a0f['user']?_0x4a4a0f['user'][_0x4b57('0x11')]:null,_0x4a4a0f[_0x4b57('0x10')]?_0x4a4a0f[_0x4b57('0x10')][_0x4b57('0x12')]:null);}}));_0x4a3efa[_0x4b57('0x13')](ewinston[_0x4b57('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x30f685,_0xd5ee6d){var _0x31cced='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x30f685['body']&&_0x30f685[_0x4b57('0x14')][_0x4b57('0x15')]&&_0x30f685[_0x4b57('0x14')]['agent_id']){_0x31cced=_0x4b57('0x16');}return util['format'](_0x31cced,_0x30f685[_0x4b57('0x9')],_0x30f685[_0x4b57('0xa')][_0x4b57('0xb')]?_0x30f685[_0x4b57('0xa')][_0x4b57('0xb')]:_0x30f685[_0x4b57('0xc')]['remoteAddress']||_0x30f685['ip'],_0x30f685[_0x4b57('0xe')],_0xd5ee6d[_0x4b57('0x17')],_0xd5ee6d[_0x4b57('0xf')],_0x30f685[_0x4b57('0x10')]?_0x30f685['user']['id']:null,_0x30f685[_0x4b57('0x10')]?_0x30f685[_0x4b57('0x10')][_0x4b57('0x11')]:null,_0x30f685[_0x4b57('0x10')]?_0x30f685[_0x4b57('0x10')][_0x4b57('0x12')]:null,_0x30f685['body']&&_0x30f685[_0x4b57('0x14')][_0x4b57('0x15')]?_0x30f685[_0x4b57('0x14')]['device']:_0x4b57('0x18'),_0x30f685[_0x4b57('0x14')]&&_0x30f685[_0x4b57('0x14')][_0x4b57('0x19')]?_0x30f685['body'][_0x4b57('0x19')]:'',_0x30f685[_0x4b57('0x14')]&&_0x30f685['body'][_0x4b57('0x1a')]?_0x30f685[_0x4b57('0x14')][_0x4b57('0x1a')]:'');},'ignoreRoute':function(_0x36197e){var _0x540eff=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x540eff[_0x4b57('0x1b')](_0x36197e['url']);}}));_0x4a3efa[_0x4b57('0x13')]('/api/users',require(_0x4b57('0x1c')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x1d'),require(_0x4b57('0x1e')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x1f'),require('./api/voiceContext'));_0x4a3efa['use'](_0x4b57('0x20'),require('./api/voiceExtension'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x21'),require(_0x4b57('0x22')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x23'),require(_0x4b57('0x24')));_0x4a3efa['use'](_0x4b57('0x25'),require(_0x4b57('0x26')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x27'),require('./api/screenRecording'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x28'),require('./api/voiceMail'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x29'),require(_0x4b57('0x2a')));_0x4a3efa[_0x4b57('0x13')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0x4a3efa['use'](_0x4b57('0x2b'),require(_0x4b57('0x2c')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x2d'),require(_0x4b57('0x2e')));_0x4a3efa['use'](_0x4b57('0x2f'),require(_0x4b57('0x30')));_0x4a3efa[_0x4b57('0x13')]('/api/members/reports',require(_0x4b57('0x31')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x32'),require('./api/trunk'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x33'),require('./api/voiceTransferReport'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x34'),require(_0x4b57('0x35')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x36'),require(_0x4b57('0x37')));_0x4a3efa['use'](_0x4b57('0x38'),require(_0x4b57('0x39')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x3a'),require(_0x4b57('0x3b')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x3c'),require('./api/mailInteraction'));_0x4a3efa['use'](_0x4b57('0x3d'),require(_0x4b57('0x3e')));_0x4a3efa[_0x4b57('0x13')]('/api/mail/applications',require(_0x4b57('0x3f')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x40'),require(_0x4b57('0x41')));_0x4a3efa['use'](_0x4b57('0x42'),require(_0x4b57('0x43')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x44'),require('./api/dashboardItem'));_0x4a3efa['use']('/api/fax/accounts',require(_0x4b57('0x45')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x46'),require(_0x4b57('0x47')));_0x4a3efa['use'](_0x4b57('0x48'),require(_0x4b57('0x49')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x4a'),require(_0x4b57('0x4b')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x4c'),require(_0x4b57('0x4d')));_0x4a3efa[_0x4b57('0x13')]('/api/fax/reports/queue',require(_0x4b57('0x4e')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x4f'),require('./api/smsAccount'));_0x4a3efa[_0x4b57('0x13')]('/api/sms/applications',require(_0x4b57('0x50')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x51'),require(_0x4b57('0x52')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x53'),require(_0x4b57('0x54')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x55'),require(_0x4b57('0x56')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x57'),require(_0x4b57('0x58')));_0x4a3efa['use']('/api/openchannel/applications',require(_0x4b57('0x59')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x5a'),require(_0x4b57('0x5b')));_0x4a3efa['use'](_0x4b57('0x5c'),require(_0x4b57('0x5d')));_0x4a3efa['use'](_0x4b57('0x5e'),require('./api/openchannelQueue'));_0x4a3efa[_0x4b57('0x13')]('/api/chat/websites',require('./api/chatWebsite'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x5f'),require('./api/openchannelQueueReport'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x60'),require(_0x4b57('0x61')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x62'),require(_0x4b57('0x63')));_0x4a3efa['use'](_0x4b57('0x64'),require(_0x4b57('0x65')));_0x4a3efa['use'](_0x4b57('0x66'),require(_0x4b57('0x67')));_0x4a3efa[_0x4b57('0x13')]('/api/chat/queues',require(_0x4b57('0x68')));_0x4a3efa['use'](_0x4b57('0x69'),require(_0x4b57('0x6a')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x6b'),require(_0x4b57('0x6c')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x6d'),require(_0x4b57('0x6e')));_0x4a3efa['use'](_0x4b57('0x6f'),require(_0x4b57('0x70')));_0x4a3efa[_0x4b57('0x13')]('/api/cm/hopper',require(_0x4b57('0x71')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x72'),require('./api/cmHopperBlack'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x73'),require(_0x4b57('0x74')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x75'),require(_0x4b57('0x76')));_0x4a3efa[_0x4b57('0x13')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x77'),require(_0x4b57('0x78')));_0x4a3efa[_0x4b57('0x13')]('/api/automations',require(_0x4b57('0x79')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x7a'),require(_0x4b57('0x7b')));_0x4a3efa['use']('/api/dispositions',require(_0x4b57('0x7c')));_0x4a3efa[_0x4b57('0x13')]('/api/conditions',require('./api/condition'));_0x4a3efa[_0x4b57('0x13')]('/api/intervals',require(_0x4b57('0x7d')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x7e'),require(_0x4b57('0x7f')));_0x4a3efa[_0x4b57('0x13')]('/api/cdr',require('./api/cdr'));_0x4a3efa['use']('/api/voiceQueuesLog',require(_0x4b57('0x80')));_0x4a3efa[_0x4b57('0x13')]('/api/schedules',require(_0x4b57('0x81')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x82'),require(_0x4b57('0x83')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x84'),require(_0x4b57('0x85')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x86'),require('./api/template'));_0x4a3efa[_0x4b57('0x13')]('/api/triggers',require(_0x4b57('0x87')));_0x4a3efa[_0x4b57('0x13')]('/api/variables',require(_0x4b57('0x88')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x89'),require(_0x4b57('0x8a')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x8b'),require(_0x4b57('0x8c')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x8d'),require(_0x4b57('0x8e')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x8f'),require('./api/analyticDefaultReport'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x90'),require('./api/analyticExtractedReport'));_0x4a3efa[_0x4b57('0x13')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x4a3efa['use'](_0x4b57('0x91'),require('./api/analyticFieldReport'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x92'),require('./api/analyticTreeReport'));_0x4a3efa['use'](_0x4b57('0x93'),require(_0x4b57('0x94')));_0x4a3efa[_0x4b57('0x13')]('/api/integrations/salesforce/configurations',require(_0x4b57('0x95')));_0x4a3efa[_0x4b57('0x13')]('/api/integrations/salesforce/fields',require(_0x4b57('0x96')));_0x4a3efa[_0x4b57('0x13')]('/api/integrations/sugarcrm/accounts',require(_0x4b57('0x97')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x98'),require(_0x4b57('0x99')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x9a'),require(_0x4b57('0x9b')));_0x4a3efa['use']('/api/integrations/desk/accounts',require(_0x4b57('0x9c')));_0x4a3efa[_0x4b57('0x13')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x9d'),require('./api/intDeskField'));_0x4a3efa['use']('/api/integrations/zoho/accounts',require(_0x4b57('0x9e')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0x9f'),require('./api/intZohoConfiguration'));_0x4a3efa['use']('/api/integrations/zoho/fields',require(_0x4b57('0xa0')));_0x4a3efa['use'](_0x4b57('0xa1'),require('./api/intZendeskAccount'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xa2'),require(_0x4b57('0xa3')));_0x4a3efa[_0x4b57('0x13')]('/api/integrations/zendesk/fields',require(_0x4b57('0xa4')));_0x4a3efa['use']('/api/integrations/freshdesk/accounts',require(_0x4b57('0xa5')));_0x4a3efa[_0x4b57('0x13')]('/api/integrations/freshdesk/configurations',require(_0x4b57('0xa6')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xa7'),require(_0x4b57('0xa8')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xa9'),require('./api/intVtigerAccount'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xaa'),require(_0x4b57('0xab')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xac'),require('./api/intVtigerField'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xad'),require(_0x4b57('0xae')));_0x4a3efa[_0x4b57('0x13')]('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xaf'),require(_0x4b57('0xb0')));_0x4a3efa['use'](_0x4b57('0xb1'),require('./api/intDynamics365Account'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xb2'),require('./api/intDynamics365Configuration'));_0x4a3efa['use'](_0x4b57('0xb3'),require('./api/intDynamics365Field'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xb4'),require(_0x4b57('0xb5')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xb6'),require('./api/intFreshsalesConfiguration'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xb7'),require(_0x4b57('0xb8')));_0x4a3efa['use']('/api/networks',require(_0x4b57('0xb9')));_0x4a3efa[_0x4b57('0x13')]('/api/chat/reports/queue',require(_0x4b57('0xba')));_0x4a3efa[_0x4b57('0x13')]('/api/chat/internal/messages',require(_0x4b57('0xbb')));_0x4a3efa[_0x4b57('0x13')]('/api/jscripty/answers/reports',require(_0x4b57('0xbc')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xbd'),require('./api/jscriptyQuestionReport'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xbe'),require(_0x4b57('0xbf')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xc0'),require(_0x4b57('0xc1')));_0x4a3efa[_0x4b57('0x13')]('/api/square/reports',require(_0x4b57('0xc2')));_0x4a3efa[_0x4b57('0x13')]('/api/square/details/reports',require(_0x4b57('0xc3')));_0x4a3efa[_0x4b57('0x13')]('/api/jscripty/projects',require(_0x4b57('0xc4')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xc5'),require(_0x4b57('0xc6')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xc7'),require(_0x4b57('0xc8')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xc9'),require(_0x4b57('0xca')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xcb'),require(_0x4b57('0xcc')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xcd'),require(_0x4b57('0xce')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xcf'),require(_0x4b57('0xd0')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xd1'),require(_0x4b57('0xd2')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xd3'),require(_0x4b57('0xd4')));_0x4a3efa['use']('/api/migrations',require('./api/migration'));_0x4a3efa['use'](_0x4b57('0xd5'),require(_0x4b57('0xd6')));_0x4a3efa['use'](_0x4b57('0xd7'),require(_0x4b57('0xd8')));_0x4a3efa['use'](_0x4b57('0xd9'),require(_0x4b57('0xda')));_0x4a3efa['use']('/api/chat/reports/transfer',require(_0x4b57('0xdb')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xdc'),require(_0x4b57('0xdd')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xde'),require(_0x4b57('0xdf')));_0x4a3efa['use']('/api/sms/reports/transfer',require(_0x4b57('0xe0')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xe1'),require(_0x4b57('0xe2')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xe3'),require(_0x4b57('0xe4')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xe5'),require('./api/userProfile'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xe6'),require(_0x4b57('0xe7')));_0x4a3efa[_0x4b57('0x13')]('/api/userProfile/resources',require('./api/userProfileResource'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xe8'),require('./api/authLocal'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xe9'),require('./api/authGoogle'));_0x4a3efa[_0x4b57('0x13')]('/api/jira',require('./api/jira'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xea'),require(_0x4b57('0xeb')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xec'),require('./api/version'));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xed'),require(_0x4b57('0xee')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xef'),require(_0x4b57('0xf0')));_0x4a3efa[_0x4b57('0x13')]('/apidoc',express[_0x4b57('0xf1')](path['join'](config[_0x4b57('0xf2')],_0x4b57('0xf3'))));_0x4a3efa[_0x4b57('0x13')]('/www',express['static'](path[_0x4b57('0xf4')](config[_0x4b57('0xf2')],_0x4b57('0xf5'))));_0x4a3efa['use'](_0x4b57('0xf6'),express[_0x4b57('0xf1')](path['join'](config[_0x4b57('0xf2')],_0x4b57('0xf6'))));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xf7'),express[_0x4b57('0xf1')](path[_0x4b57('0xf4')](config[_0x4b57('0xf2')],_0x4b57('0xf8'),'1.0.16')));_0x4a3efa[_0x4b57('0x13')](_0x4b57('0xf9'),express[_0x4b57('0xf1')](path['join'](config[_0x4b57('0xf2')],'/server/files/plugins')));_0x4a3efa['route'](_0x4b57('0xfa'))[_0x4b57('0xfb')](errors[0x194]);_0x4a3efa[_0x4b57('0xfc')]('/*')[_0x4b57('0xfb')](function(_0x102bb9,_0x1e5a08){_0x1e5a08[_0x4b57('0xfd')](path[_0x4b57('0xfe')](_0x4a3efa[_0x4b57('0xfb')]('appPath')+_0x4b57('0xff')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index c588834..00eea38 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f55=['../api/squareProject/squareProject.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','server','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','bluebird','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc'];(function(_0x54c07c,_0x49bae0){var _0x3872dd=function(_0x9cc488){while(--_0x9cc488){_0x54c07c['push'](_0x54c07c['shift']());}};_0x3872dd(++_0x49bae0);}(_0x6f55,0x1bc));var _0x56f5=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x6f55[_0x4154a6];return _0x3b2786;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x56f5('0x0'));var _=require('lodash');var config=require('../config/environment');exports[_0x56f5('0x1')]=function(){return new BPromise(function(_0x1d2498,_0x19296f){var _0x539cce={};_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x3')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x4')));_0x539cce=_['merge'](_0x539cce,require(_0x56f5('0x5')));_0x539cce=_['merge'](_0x539cce,require(_0x56f5('0x6')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x7')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x8')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x9')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0xa')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require('../api/memberReport/memberReport.rpc'));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0xb')));_0x539cce=_['merge'](_0x539cce,require(_0x56f5('0xc')));_0x539cce=_['merge'](_0x539cce,require(_0x56f5('0xd')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0xe')));_0x539cce=_['merge'](_0x539cce,require('../api/mailAccount/mailAccount.rpc'));_0x539cce=_['merge'](_0x539cce,require(_0x56f5('0xf')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require('../api/mailInteraction/mailInteraction.rpc'));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require('../api/mailMessage/mailMessage.rpc'));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require('../api/mailApplication/mailApplication.rpc'));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x10')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x11')));_0x539cce=_['merge'](_0x539cce,require('../api/faxInteraction/faxInteraction.rpc'));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x12')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x13')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x14')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x15')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require('../api/smsInteraction/smsInteraction.rpc'));_0x539cce=_['merge'](_0x539cce,require(_0x56f5('0x16')));_0x539cce=_['merge'](_0x539cce,require(_0x56f5('0x17')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x18')));_0x539cce=_['merge'](_0x539cce,require(_0x56f5('0x19')));_0x539cce=_['merge'](_0x539cce,require(_0x56f5('0x1a')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x1b')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x1c')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require('../api/chatInteraction/chatInteraction.rpc'));_0x539cce=_['merge'](_0x539cce,require('../api/chatMessage/chatMessage.rpc'));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x1d')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x1e')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x1f')));_0x539cce=_['merge'](_0x539cce,require(_0x56f5('0x20')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x21')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x22')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x23')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x24')));_0x539cce=_['merge'](_0x539cce,require('../api/pause/pause.rpc'));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x25')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require('../api/template/template.rpc'));_0x539cce=_['merge'](_0x539cce,require(_0x56f5('0x26')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x27')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x28')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x29')));_0x539cce=_['merge'](_0x539cce,require(_0x56f5('0x2a')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x2b')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x2c')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x2d')));_0x539cce=_['merge'](_0x539cce,require(_0x56f5('0x2e')));_0x539cce=_['merge'](_0x539cce,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x539cce=_['merge'](_0x539cce,require(_0x56f5('0x2f')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x30')));_0x539cce=_['merge'](_0x539cce,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x31')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x32')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x33')));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require('../api/squareOdbc/squareOdbc.rpc'));_0x539cce=_['merge'](_0x539cce,require(_0x56f5('0x34')));_0x539cce=_['merge'](_0x539cce,require('../api/squareRecording/squareRecording.rpc'));_0x539cce=_['merge'](_0x539cce,require('../api/squareMessage/squareMessage.rpc'));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require('../api/campaign/campaign.rpc'));_0x539cce=_[_0x56f5('0x2')](_0x539cce,require(_0x56f5('0x35')));_0x539cce=_['merge'](_0x539cce,require(_0x56f5('0x36')));var _0x46b4a8=jayson[_0x56f5('0x37')](_0x539cce)['http']();var _0x5e957a=config['rpc'][_0x56f5('0x38')]||config['port']+0x1;var _0x39a1fe=config['rpc']['ip']||_0x56f5('0x39');_0x46b4a8['on'](_0x56f5('0x3a'),function(_0x5f553d){return _0x19296f(_0x5f553d);});_0x46b4a8[_0x56f5('0x1')](_0x5e957a,_0x39a1fe,function(){console['log'](_0x56f5('0x3b'),_0x39a1fe,_0x5e957a);require('../config/triggers')[_0x56f5('0x3c')]();return _0x1d2498(_0x56f5('0x3d')+_0x39a1fe+':'+_0x5e957a);});});}; \ No newline at end of file +var _0x7e73=['../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.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/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','server','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/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x7e73,0x7b));var _0x37e7=function(_0x36860a,_0x5b79cc){_0x36860a=_0x36860a-0x0;var _0x24e357=_0x7e73[_0x36860a];return _0x24e357;};'use strict';var jayson=require(_0x37e7('0x0'));var BPromise=require(_0x37e7('0x1'));var _=require(_0x37e7('0x2'));var config=require(_0x37e7('0x3'));exports[_0x37e7('0x4')]=function(){return new BPromise(function(_0xb75aa4,_0x2eb0c8){var _0x387429={};_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x6')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x7')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x8')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x9')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0xa')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0xb')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0xc')));_0x387429=_[_0x37e7('0x5')](_0x387429,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0xd')));_0x387429=_['merge'](_0x387429,require('../api/trunk/trunk.rpc'));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0xe')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0xf')));_0x387429=_[_0x37e7('0x5')](_0x387429,require('../api/mailServerIn/mailServerIn.rpc'));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x10')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x11')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x12')));_0x387429=_['merge'](_0x387429,require('../api/mailMessage/mailMessage.rpc'));_0x387429=_[_0x37e7('0x5')](_0x387429,require('../api/mailApplication/mailApplication.rpc'));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x13')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x14')));_0x387429=_['merge'](_0x387429,require(_0x37e7('0x15')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x16')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x17')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x18')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x19')));_0x387429=_['merge'](_0x387429,require('../api/smsAccount/smsAccount.rpc'));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x1a')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x1b')));_0x387429=_['merge'](_0x387429,require(_0x37e7('0x1c')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x1d')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x1e')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x1f')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x20')));_0x387429=_[_0x37e7('0x5')](_0x387429,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x387429=_['merge'](_0x387429,require('../api/chatInteraction/chatInteraction.rpc'));_0x387429=_['merge'](_0x387429,require(_0x37e7('0x21')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x22')));_0x387429=_[_0x37e7('0x5')](_0x387429,require('../api/cmContact/cmContact.rpc'));_0x387429=_[_0x37e7('0x5')](_0x387429,require('../api/cmHopper/cmHopper.rpc'));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x23')));_0x387429=_['merge'](_0x387429,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x387429=_['merge'](_0x387429,require(_0x37e7('0x24')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x25')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x26')));_0x387429=_['merge'](_0x387429,require(_0x37e7('0x27')));_0x387429=_[_0x37e7('0x5')](_0x387429,require('../api/sound/sound.rpc'));_0x387429=_['merge'](_0x387429,require(_0x37e7('0x28')));_0x387429=_['merge'](_0x387429,require('../api/trigger/trigger.rpc'));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x29')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x2a')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x2b')));_0x387429=_[_0x37e7('0x5')](_0x387429,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x387429=_[_0x37e7('0x5')](_0x387429,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x387429=_[_0x37e7('0x5')](_0x387429,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x387429=_[_0x37e7('0x5')](_0x387429,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x387429=_['merge'](_0x387429,require(_0x37e7('0x2c')));_0x387429=_[_0x37e7('0x5')](_0x387429,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x387429=_['merge'](_0x387429,require(_0x37e7('0x2d')));_0x387429=_['merge'](_0x387429,require(_0x37e7('0x2e')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x2f')));_0x387429=_['merge'](_0x387429,require(_0x37e7('0x30')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x31')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x32')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x33')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x34')));_0x387429=_[_0x37e7('0x5')](_0x387429,require('../api/squareRecording/squareRecording.rpc'));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x35')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x36')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x37')));_0x387429=_[_0x37e7('0x5')](_0x387429,require(_0x37e7('0x38')));var _0x2d2ff1=jayson[_0x37e7('0x39')](_0x387429)['http']();var _0x160f17=config[_0x37e7('0x3a')][_0x37e7('0x3b')]||config[_0x37e7('0x3b')]+0x1;var _0x332136=config[_0x37e7('0x3a')]['ip']||_0x37e7('0x3c');_0x2d2ff1['on'](_0x37e7('0x3d'),function(_0x5d7c9b){return _0x2eb0c8(_0x5d7c9b);});_0x2d2ff1[_0x37e7('0x4')](_0x160f17,_0x332136,function(){console[_0x37e7('0x3e')](_0x37e7('0x3f'),_0x332136,_0x160f17);require(_0x37e7('0x40'))['default']();return _0xb75aa4(_0x37e7('0x41')+_0x332136+':'+_0x160f17);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 4157eb6..6601745 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(_0x27beea,_0x3bc9f4){var _0x122645=function(_0x2c848){while(--_0x2c848){_0x27beea['push'](_0x27beea['shift']());}};_0x122645(++_0x3bc9f4);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'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 _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(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'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 diff --git a/server/services/agi/error.js b/server/services/agi/error.js index a9ed400..14e2455 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 _0x367c=['format','apply','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push'];(function(_0x245fa1,_0x15404b){var _0x402e20=function(_0x3a301a){while(--_0x3a301a){_0x245fa1['push'](_0x245fa1['shift']());}};_0x402e20(++_0x15404b);}(_0x367c,0x1b4));var _0xc367=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x367c[_0x13ea00];return _0x1f7347;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xc367('0x0'),'E_AGI_ARGUMENT_PORT':_0xc367('0x1'),'E_AGI_SERVER_ERROR':_0xc367('0x2'),'E_AGI_SERVER_CLOSE':_0xc367('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xc367('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xc367('0x5'),'E_AGI_SOCKET_ERROR':_0xc367('0x6'),'E_AGI_SOCKET_CLOSE':_0xc367('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xc367('0x8'),'E_AGI_COMMAND_EMPTY':_0xc367('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xc367('0xa'),'E_AGI_IVR_ENTRY':_0xc367('0xb')};function AGIError(_0x4f8967){var _0x4f8967=_0x4f8967||null,_0x422a99=_0x422a99||[],_0x42c2d2=0x1,_0x18abbd='';if(!error[_0x4f8967]){_0x4f8967=_0xc367('0xc');}_0x422a99[_0xc367('0xd')](error[_0x4f8967]);while(arguments[_0x42c2d2]){_0x422a99[_0xc367('0xd')](arguments[_0x42c2d2]);_0x42c2d2++;}_0x18abbd=util[_0xc367('0xe')][_0xc367('0xf')](util,_0x422a99);this['message']=_0x18abbd;this[_0xc367('0x10')]=_0x4f8967;}module[_0xc367('0x11')]=AGIError; \ No newline at end of file +var _0x1d25=['Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','format','apply','message','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x1d25,0xba));var _0x51d2=function(_0x2a5099,_0x329e92){_0x2a5099=_0x2a5099-0x0;var _0x2802f1=_0x1d25[_0x2a5099];return _0x2802f1;};'use strict';var util=require(_0x51d2('0x0'));var error={'E_AGI_UNDEFINED':_0x51d2('0x1'),'E_AGI_ARGUMENT_PORT':_0x51d2('0x2'),'E_AGI_SERVER_ERROR':_0x51d2('0x3'),'E_AGI_SERVER_CLOSE':_0x51d2('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x51d2('0x5'),'E_AGI_SOCKET_ERROR':_0x51d2('0x6'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x51d2('0x7'),'E_AGI_COMMAND_EMPTY':_0x51d2('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x51d2('0x9'),'E_AGI_IVR_ENTRY':_0x51d2('0xa')};function AGIError(_0x449fec){var _0x449fec=_0x449fec||null,_0x56edda=_0x56edda||[],_0x18e8a9=0x1,_0x5a6b5f='';if(!error[_0x449fec]){_0x449fec=_0x51d2('0xb');}_0x56edda['push'](error[_0x449fec]);while(arguments[_0x18e8a9]){_0x56edda['push'](arguments[_0x18e8a9]);_0x18e8a9++;}_0x5a6b5f=util[_0x51d2('0xc')][_0x51d2('0xd')](util,_0x56edda);this[_0x51d2('0xe')]=_0x5a6b5f;this[_0x51d2('0xf')]=_0x449fec;}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 3c96e08..c66a092 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 _0xeb74=['getdigits','getsecretdigits','vertices','numberOfEdges','prototype','addVertex','push','size','relations','getVertex','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','edges','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu'];(function(_0x2627e3,_0x5bb123){var _0x55621b=function(_0x230e5a){while(--_0x230e5a){_0x2627e3['push'](_0x2627e3['shift']());}};_0x55621b(++_0x5bb123);}(_0xeb74,0xe3));var _0x4eb7=function(_0x111c81,_0x24c35c){_0x111c81=_0x111c81-0x0;var _0x22ffd4=_0xeb74[_0x111c81];return _0x22ffd4;};'use strict';var _=require(_0x4eb7('0x0'));var logger=require(_0x4eb7('0x1'))(_0x4eb7('0x2'));var verticesWithRetry=[_0x4eb7('0x3'),_0x4eb7('0x4'),_0x4eb7('0x5')];var Graph=function(){this[_0x4eb7('0x6')]={};this['edges']={};this[_0x4eb7('0x7')]=0x0;};Graph[_0x4eb7('0x8')][_0x4eb7('0x9')]=function(_0x176f0b){this[_0x4eb7('0x6')][_0x176f0b['id']]=_0x176f0b;this['edges'][_0x176f0b['id']]=[];};Graph[_0x4eb7('0x8')]['addEdge']=function(_0xcac7c5,_0x2cffe7,_0x588a1c){this['edges'][_0xcac7c5][_0x4eb7('0xa')]({'target':_0x2cffe7,'condition':_0x588a1c});this[_0x4eb7('0x7')]+=0x1;};Graph['prototype'][_0x4eb7('0xb')]=function(){return _['size'](this[_0x4eb7('0x6')]);};Graph[_0x4eb7('0x8')][_0x4eb7('0xc')]=function(){return this['numberOfEdges'];};Graph[_0x4eb7('0x8')][_0x4eb7('0xd')]=function(_0x3c0e15){return this[_0x4eb7('0x6')][_0x3c0e15];};Graph[_0x4eb7('0x8')][_0x4eb7('0xe')]=function(_0x3c9f45,_0x4c27a4){if(!this['vertices'][_0x3c9f45]){return logger['info'](_0x4eb7('0xf'));}var _0x51f09d=_0x4c27a4(this[_0x4eb7('0x6')][_0x3c9f45]);if(!_0x51f09d){return logger[_0x4eb7('0x10')](_0x4eb7('0x11'));}if(this[_0x4eb7('0x12')][_0x3c9f45][_0x4eb7('0x13')]===0x0){return logger[_0x4eb7('0x10')](_0x4eb7('0x14'));}for(var _0x76988=0x0,_0x157710=[],_0x17377f=![];_0x76988\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','isArray','length','source','target','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','inspect','variables','stringify','close','hangup','sync','production','start','debug','joinAt','YYYY-MM-DD\x20HH:mm:ss','traverseBFS','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','finally','clear','agicommand\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','connection','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','./rpc','./graph','./vertices','defaults','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','arg_1','calleridname','callerid','dnid'];(function(_0x2d290b,_0x56e7d3){var _0x2257f9=function(_0x261d7d){while(--_0x261d7d){_0x2d290b['push'](_0x2d290b['shift']());}};_0x2257f9(++_0x56e7d3);}(_0xac9d,0x14d));var _0xdac9=function(_0x4452dc,_0x479149){_0x4452dc=_0x4452dc-0x0;var _0x52b892=_0xac9d[_0x4452dc];return _0x52b892;};'use strict';var parser=require(_0xdac9('0x0'));var _=require(_0xdac9('0x1'));var syncho=require(_0xdac9('0x2'));var util=require(_0xdac9('0x3'));var moment=require(_0xdac9('0x4'));var config=require(_0xdac9('0x5'));var logger=require(_0xdac9('0x6'))(_0xdac9('0x7'));var utilLicense=require('../../config/license/util');var rpc=require(_0xdac9('0x8'));var mailRpc=require('./mailRpc');var Graph=require(_0xdac9('0x9'));var Vertices=require(_0xdac9('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xdac9('0x7')]=_[_0xdac9('0xb')](config[_0xdac9('0x7')],{'ip':_0xdac9('0xc'),'port':0x11dd});function connectionHandler(_0x5531af){process[_0xdac9('0xd')](function(){syncho(function(){try{setChannelVariables(_0x5531af);agiHandler(_0x5531af);}catch(_0x47d9fd){logger[_0xdac9('0xe')](_0x47d9fd[_0xdac9('0xf')]);}});});}function listeningHandler(){console[_0xdac9('0x10')](_0xdac9('0x11'),config[_0xdac9('0x7')][_0xdac9('0x12')]);logger[_0xdac9('0x13')](util[_0xdac9('0x14')](_0xdac9('0x15'),config['agi']['ip'],config[_0xdac9('0x7')][_0xdac9('0x12')]));}function errorHandler(_0x5a9bde){if(_0x5a9bde&&_0x5a9bde[_0xdac9('0x16')]&&_0x5a9bde[_0xdac9('0x17')]){logger[_0xdac9('0xe')](util['format'](_0xdac9('0x18'),_0x5a9bde[_0xdac9('0x16')],_0x5a9bde[_0xdac9('0x17')]));}else{logger['error'](util['format'](_0xdac9('0x19'),_0x5a9bde[_0xdac9('0xf')]));}}function closeHandler(){logger['info'](util[_0xdac9('0x14')](_0xdac9('0x1a'),this[_0xdac9('0x1b')],this[_0xdac9('0x1c')],this[_0xdac9('0x1d')],this[_0xdac9('0x1e')],this[_0xdac9('0x1f')]));try{createSquareReport(this);}catch(_0xec1016){logger['error'](_0xec1016[_0xdac9('0xf')]);}}function timeoutHandler(){logger[_0xdac9('0x13')](util['format'](_0xdac9('0x20'),this[_0xdac9('0x1b')],this[_0xdac9('0x1c')],this[_0xdac9('0x1d')],this['dnid'],this['uniqueid']));}function hangupHandler(){logger[_0xdac9('0x13')](util[_0xdac9('0x14')](_0xdac9('0x21'),this[_0xdac9('0x1b')],this['calleridname'],this[_0xdac9('0x1d')],this[_0xdac9('0x1e')],this[_0xdac9('0x1f')]));this[_0xdac9('0x22')]=!![];}function getRoot(_0xe7bd10){return parser[_0xdac9('0x23')](_0xe7bd10,{'object':!![]})[_0xdac9('0x24')][_0xdac9('0x25')];}function addVertex(_0x419f0c,_0x33de5c,_0x5a0fa2){_0x33de5c[_0xdac9('0x26')]=_0x5a0fa2;if(_0x33de5c[_0xdac9('0x27')](_0xdac9('0x28'))){_0x33de5c[_0xdac9('0x29')]=parseInt(_0x33de5c['retry'],0xa);}_0x419f0c[_0xdac9('0x2a')](_['omit'](_0x33de5c,_0xdac9('0x2b')));}function initGraph(_0x2fce71,_0x566d8c){var _0x433be9=new Graph();for(var _0x5105f1 in _0x2fce71){if(_0x2fce71[_0xdac9('0x27')](_0x5105f1)){if(_[_0xdac9('0x2c')](_0x2fce71[_0x5105f1])){for(var _0xeff4b2=0x0;_0xeff4b2<_0x2fce71[_0x5105f1][_0xdac9('0x2d')];_0xeff4b2+=0x1){addVertex(_0x433be9,_0x2fce71[_0x5105f1][_0xeff4b2],_0x5105f1);}}else{addVertex(_0x433be9,_0x2fce71[_0x5105f1],_0x5105f1);}}}for(var _0x57d76a=0x0;_0x57d76a<_0x566d8c['length'];_0x57d76a+=0x1){if(_0x566d8c[_0x57d76a][_0xdac9('0x2e')]&&_0x566d8c[_0x57d76a][_0xdac9('0x2f')]){_0x433be9['addEdge'](_0x566d8c[_0x57d76a]['source'],_0x566d8c[_0x57d76a][_0xdac9('0x2f')],_0x566d8c[_0x57d76a][_0xdac9('0x30')]);}}return _0x433be9;}function getSquareProject(_0x13efba,_0x2dbb7a){rpc[_0xdac9('0x31')](_0x13efba)[_0xdac9('0x32')](function(_0xed99f9){_0x2dbb7a(null,_0xed99f9);})[_0xdac9('0x33')](function(_0x406ed0){_0x2dbb7a(null,_0x406ed0);});}function createSquareReport(_0x2f36f4,_0xb49c21){rpc[_0xdac9('0x34')](_0x2f36f4)[_0xdac9('0x32')](function(_0x336fd5){if(_0xb49c21){_0xb49c21(null,_0x336fd5);}})[_0xdac9('0x33')](function(_0x446080){if(_0xb49c21){_0xb49c21(null,_0x446080);}});}function setChannelVariables(_0x372f02){for(var _0x44eff2 in _0x372f02){if(_0x372f02[_0xdac9('0x27')](_0x44eff2)){if(_0x44eff2[_0xdac9('0x35')](_0xdac9('0x36'))===0x0){_0x372f02[_0x44eff2['substring'](0x4)]=_0x372f02[_0x44eff2];delete _0x372f02[_0x44eff2];}}}}function getLogFromObject(_0x5e7ebe){return util[_0xdac9('0x37')](_0x5e7ebe,{'showHidden':![],'depth':null});}function agiHandler(_0x416501){var _0x1cf2c7,_0x3ecff5,_0x15dc5f,_0x49d59f,_0x1d125a;logger['debug'](_0xdac9('0x38'),JSON[_0xdac9('0x39')](_0x416501,null,0x2));logger['info'](util[_0xdac9('0x14')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x416501['arg_1'],_0x416501[_0xdac9('0x1c')],_0x416501[_0xdac9('0x1d')],_0x416501[_0xdac9('0x1e')],_0x416501[_0xdac9('0x1f')]));_0x416501['on'](_0xdac9('0xe'),errorHandler);_0x416501['on'](_0xdac9('0x3a'),closeHandler);_0x416501['on']('timeout',timeoutHandler);_0x416501[_0xdac9('0x22')]=![];_0x416501['on'](_0xdac9('0x3b'),hangupHandler);var _0x5608c2=getSquareProject[_0xdac9('0x3c')](null,_0x416501[_0xdac9('0x1b')]);if(_0x5608c2){if(_0x5608c2[_0xdac9('0x3d')]){_0x1cf2c7=getRoot(_0x5608c2[_0xdac9('0x3d')]);if(_0x1cf2c7&&_0x1cf2c7[_0xdac9('0x3e')]){logger[_0xdac9('0x3f')](_0xdac9('0x25'),JSON['stringify'](_0x1cf2c7,null,0x2));_0x416501[_0xdac9('0x40')]=moment()[_0xdac9('0x14')](_0xdac9('0x41'));_0x3ecff5=initGraph(_['omit'](_0x1cf2c7,_0xdac9('0x2b')),_0x1cf2c7[_0xdac9('0x2b')]);_0x15dc5f=new Vertices(_0x416501,rpc,mailRpc);logger[_0xdac9('0x13')](util[_0xdac9('0x14')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x416501['arg_1'],_0x416501[_0xdac9('0x1c')],_0x416501[_0xdac9('0x1d')],_0x416501[_0xdac9('0x1e')],_0x416501[_0xdac9('0x1f')]));_0x3ecff5[_0xdac9('0x42')](_0x1cf2c7['start']['id'],function(_0x8435e8){try{_0x8435e8=_0x15dc5f['clear'](_0x8435e8);logger[_0xdac9('0x3f')](_0xdac9('0x43'),JSON[_0xdac9('0x39')](_0x8435e8,null,0x2));if(_0x8435e8[_0xdac9('0x26')]===_0xdac9('0x44')){logger[_0xdac9('0x13')](_0xdac9('0x45'));_0x416501[_0xdac9('0x46')]=_0x8435e8[_0xdac9('0x46')]||_0x416501[_0xdac9('0x46')];_0x416501[_0xdac9('0x47')]=_0x8435e8[_0xdac9('0x47')];_0x416501[_0xdac9('0x48')]=_0x8435e8[_0xdac9('0x48')]?_0x8435e8['priority']-0x1:0x1;return null;}else if(_0x8435e8&&_0x15dc5f[_0x8435e8[_0xdac9('0x26')]]){_0x1d125a=_0x15dc5f[_0x8435e8[_0xdac9('0x26')]](_0x8435e8);logger['info'](_0xdac9('0x49'),JSON[_0xdac9('0x39')](_0x1d125a,null,0x2));if(_0x1d125a&&_0x1d125a[_0xdac9('0x4a')]===AGI_CODE_SUCCESS&&_0x1d125a[_0xdac9('0x4b')]!==AGI_RESULT_ERROR&&!_0x416501[_0xdac9('0x22')]){logger[_0xdac9('0x3f')]('response',getLogFromObject(_0x1d125a));return _[_0xdac9('0x4c')](_0x1d125a['result'])?null:_0x1d125a[_0xdac9('0x4b')][_0xdac9('0x4d')]();}else{logger[_0xdac9('0xe')](_0xdac9('0x49'),getLogFromObject(_0x1d125a));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x585f08){logger[_0xdac9('0xe')](_0x585f08['stack']);return null;}});if(_0x1cf2c7['finally']){logger[_0xdac9('0x13')](util[_0xdac9('0x14')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x416501['arg_1'],_0x416501[_0xdac9('0x1c')],_0x416501[_0xdac9('0x1d')],_0x416501[_0xdac9('0x1e')],_0x416501[_0xdac9('0x1f')]));_0x3ecff5[_0xdac9('0x42')](_0x1cf2c7[_0xdac9('0x4e')]['id'],function(_0x18dd54){try{_0x18dd54=_0x15dc5f[_0xdac9('0x4f')](_0x18dd54);logger['debug'](_0xdac9('0x43'),JSON[_0xdac9('0x39')](_0x18dd54,null,0x2));if(_0x18dd54&&_0x15dc5f[_0x18dd54[_0xdac9('0x26')]]){_0x1d125a=_0x15dc5f[_0x18dd54[_0xdac9('0x26')]](_0x18dd54);if(_0x1d125a){logger[_0xdac9('0x3f')](_0xdac9('0x49'),getLogFromObject(_0x1d125a));return _[_0xdac9('0x4c')](_0x1d125a[_0xdac9('0x4b')])?null:_0x1d125a[_0xdac9('0x4b')][_0xdac9('0x4d')]();}else{logger[_0xdac9('0xe')](_0xdac9('0x49'),getLogFromObject(_0x1d125a));return null;}}else{logger[_0xdac9('0xe')](_0xdac9('0x50'));return null;}}catch(_0x53b349){logger['error'](_0x53b349['stack']);return null;}});}logger[_0xdac9('0x13')](util[_0xdac9('0x14')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x416501[_0xdac9('0x1b')],_0x416501[_0xdac9('0x1c')],_0x416501[_0xdac9('0x1d')],_0x416501['dnid'],_0x416501[_0xdac9('0x1f')]));logger[_0xdac9('0x13')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x416501[_0xdac9('0x46')],_0x416501[_0xdac9('0x47')],parseInt(_0x416501[_0xdac9('0x48')],0xa)+0x1));_0x416501[_0xdac9('0x51')](_0x416501[_0xdac9('0x46')],_0x416501[_0xdac9('0x47')],parseInt(_0x416501[_0xdac9('0x48')],0xa)+0x1);_0x416501[_0xdac9('0x3a')]();}}else{logger[_0xdac9('0xe')](util[_0xdac9('0x14')](_0xdac9('0x52'),_0x416501[_0xdac9('0x1b')]));_0x416501[_0xdac9('0x51')](_0x416501[_0xdac9('0x46')],_0x416501[_0xdac9('0x47')],parseInt(_0x416501['priority'],0xa)+0x1);_0x416501[_0xdac9('0x3a')]();}}else{logger[_0xdac9('0xe')](util[_0xdac9('0x14')](_0xdac9('0x53'),_0x416501[_0xdac9('0x1b')]));_0x416501[_0xdac9('0x51')](_0x416501['context'],_0x416501[_0xdac9('0x47')],parseInt(_0x416501[_0xdac9('0x48')],0xa)+0x1);_0x416501[_0xdac9('0x3a')]();}}function main(){var _0x2648c1;return utilLicense[_0xdac9('0x54')]()[_0xdac9('0x32')](function(_0x1eec39){if(_0x1eec39){if(_0x1eec39[_0xdac9('0x55')]){if(_0x1eec39[_0xdac9('0x56')]&&_0x1eec39['callysquare']>0x0){logger[_0xdac9('0x13')](util[_0xdac9('0x14')](_0xdac9('0x57'),_0x1eec39[_0xdac9('0x56')]));_0x2648c1=_0x1eec39[_0xdac9('0x56')];}else{logger[_0xdac9('0x13')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info'](_0xdac9('0x58'));_0x2648c1=-0x1;}}})[_0xdac9('0x33')](function(_0x41ea68){logger[_0xdac9('0xe')](_0xdac9('0x59'),_0x41ea68[_0xdac9('0xf')]);})['finally'](function(){var _0x58faf2=require('./server')(config[_0xdac9('0x7')][_0xdac9('0x12')],config[_0xdac9('0x7')]['ip'],_0x2648c1);_0x58faf2['on'](_0xdac9('0xe'),errorHandler);_0x58faf2['on']('listening',listeningHandler);_0x58faf2['on'](_0xdac9('0x5a'),connectionHandler);_0x58faf2['on'](_0xdac9('0x3a'),closeHandler);});}main(); \ No newline at end of file +var _0x8664=['substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','evtHangup','production','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','start','clear','vertex','agicommand','gotoc','context','extension','priority','response','result','isUndefined','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toString','agicommand\x20not\x20found','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','continueAt','getLicense','voice','callysquare','[LICENSE]','connection','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./mailRpc','./vertices','defaults','127.0.0.1','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','format','[%s]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','toJson','mxGraphModel','root','hasOwnProperty','retry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0x8664,0x11a));var _0x4866=function(_0x262862,_0x490cb4){_0x262862=_0x262862-0x0;var _0x44007f=_0x8664[_0x262862];return _0x44007f;};'use strict';var parser=require(_0x4866('0x0'));var _=require(_0x4866('0x1'));var syncho=require(_0x4866('0x2'));var util=require(_0x4866('0x3'));var moment=require(_0x4866('0x4'));var config=require(_0x4866('0x5'));var logger=require(_0x4866('0x6'))(_0x4866('0x7'));var utilLicense=require(_0x4866('0x8'));var rpc=require('./rpc');var mailRpc=require(_0x4866('0x9'));var Graph=require('./graph');var Vertices=require(_0x4866('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x4866('0x7')]=_[_0x4866('0xb')](config[_0x4866('0x7')],{'ip':_0x4866('0xc'),'port':0x11dd});function connectionHandler(_0x142f18){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x142f18);agiHandler(_0x142f18);}catch(_0x4185f2){logger[_0x4866('0xd')](_0x4185f2[_0x4866('0xe')]);}});});}function listeningHandler(){console[_0x4866('0xf')](_0x4866('0x10'),config['agi'][_0x4866('0x11')]);logger[_0x4866('0x12')](util['format'](_0x4866('0x13'),config[_0x4866('0x7')]['ip'],config['agi']['port']));}function errorHandler(_0x47a50e){if(_0x47a50e&&_0x47a50e[_0x4866('0x14')]&&_0x47a50e[_0x4866('0x15')]){logger[_0x4866('0xd')](util[_0x4866('0x16')](_0x4866('0x17'),_0x47a50e[_0x4866('0x14')],_0x47a50e['message']));}else{logger[_0x4866('0xd')](util[_0x4866('0x16')]('[ERROR]\x20%s',_0x47a50e[_0x4866('0xe')]));}}function closeHandler(){logger[_0x4866('0x12')](util[_0x4866('0x16')](_0x4866('0x18'),this[_0x4866('0x19')],this[_0x4866('0x1a')],this[_0x4866('0x1b')],this[_0x4866('0x1c')],this[_0x4866('0x1d')]));try{createSquareReport(this);}catch(_0x56ba1f){logger['error'](_0x56ba1f[_0x4866('0xe')]);}}function timeoutHandler(){logger[_0x4866('0x12')](util[_0x4866('0x16')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x4866('0x1a')],this[_0x4866('0x1b')],this['dnid'],this[_0x4866('0x1d')]));}function hangupHandler(){logger['info'](util[_0x4866('0x16')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x4866('0x19')],this[_0x4866('0x1a')],this[_0x4866('0x1b')],this[_0x4866('0x1c')],this[_0x4866('0x1d')]));this['evtHangup']=!![];}function getRoot(_0x5d1401){return parser[_0x4866('0x1e')](_0x5d1401,{'object':!![]})[_0x4866('0x1f')][_0x4866('0x20')];}function addVertex(_0x5c583a,_0x43f3a6,_0x4d3da4){_0x43f3a6['agicommand']=_0x4d3da4;if(_0x43f3a6[_0x4866('0x21')](_0x4866('0x22'))){_0x43f3a6['maxRetry']=parseInt(_0x43f3a6[_0x4866('0x22')],0xa);}_0x5c583a[_0x4866('0x23')](_[_0x4866('0x24')](_0x43f3a6,_0x4866('0x25')));}function initGraph(_0x3a5b93,_0x2b5557){var _0x1a1813=new Graph();for(var _0x136b1f in _0x3a5b93){if(_0x3a5b93[_0x4866('0x21')](_0x136b1f)){if(_[_0x4866('0x26')](_0x3a5b93[_0x136b1f])){for(var _0x278471=0x0;_0x278471<_0x3a5b93[_0x136b1f]['length'];_0x278471+=0x1){addVertex(_0x1a1813,_0x3a5b93[_0x136b1f][_0x278471],_0x136b1f);}}else{addVertex(_0x1a1813,_0x3a5b93[_0x136b1f],_0x136b1f);}}}for(var _0xaedc67=0x0;_0xaedc67<_0x2b5557[_0x4866('0x27')];_0xaedc67+=0x1){if(_0x2b5557[_0xaedc67][_0x4866('0x28')]&&_0x2b5557[_0xaedc67][_0x4866('0x29')]){_0x1a1813[_0x4866('0x2a')](_0x2b5557[_0xaedc67][_0x4866('0x28')],_0x2b5557[_0xaedc67][_0x4866('0x29')],_0x2b5557[_0xaedc67][_0x4866('0x2b')]);}}return _0x1a1813;}function getSquareProject(_0x21a7f9,_0x194b87){rpc[_0x4866('0x2c')](_0x21a7f9)[_0x4866('0x2d')](function(_0x2dc47f){_0x194b87(null,_0x2dc47f);})[_0x4866('0x2e')](function(_0x3d1167){_0x194b87(null,_0x3d1167);});}function createSquareReport(_0x156924,_0x2fe73d){rpc[_0x4866('0x2f')](_0x156924)[_0x4866('0x2d')](function(_0x28ad06){if(_0x2fe73d){_0x2fe73d(null,_0x28ad06);}})[_0x4866('0x2e')](function(_0x28d7d7){if(_0x2fe73d){_0x2fe73d(null,_0x28d7d7);}});}function setChannelVariables(_0x5f4236){for(var _0x4e3deb in _0x5f4236){if(_0x5f4236[_0x4866('0x21')](_0x4e3deb)){if(_0x4e3deb[_0x4866('0x30')](_0x4866('0x31'))===0x0){_0x5f4236[_0x4e3deb[_0x4866('0x32')](0x4)]=_0x5f4236[_0x4e3deb];delete _0x5f4236[_0x4e3deb];}}}}function getLogFromObject(_0x367399){return util['inspect'](_0x367399,{'showHidden':![],'depth':null});}function agiHandler(_0x26a5cd){var _0x21ad2b,_0x14962e,_0x46913c,_0x173d14,_0x47cd79;logger[_0x4866('0x33')](_0x4866('0x34'),JSON[_0x4866('0x35')](_0x26a5cd,null,0x2));logger[_0x4866('0x12')](util[_0x4866('0x16')](_0x4866('0x36'),_0x26a5cd[_0x4866('0x19')],_0x26a5cd[_0x4866('0x1a')],_0x26a5cd[_0x4866('0x1b')],_0x26a5cd['dnid'],_0x26a5cd[_0x4866('0x1d')]));_0x26a5cd['on'](_0x4866('0xd'),errorHandler);_0x26a5cd['on']('close',closeHandler);_0x26a5cd['on'](_0x4866('0x37'),timeoutHandler);_0x26a5cd[_0x4866('0x38')]=![];_0x26a5cd['on']('hangup',hangupHandler);var _0x58c49c=getSquareProject['sync'](null,_0x26a5cd['arg_1']);if(_0x58c49c){if(_0x58c49c[_0x4866('0x39')]){_0x21ad2b=getRoot(_0x58c49c[_0x4866('0x39')]);if(_0x21ad2b&&_0x21ad2b['start']){logger['debug']('root',JSON[_0x4866('0x35')](_0x21ad2b,null,0x2));_0x26a5cd['joinAt']=moment()[_0x4866('0x16')]('YYYY-MM-DD\x20HH:mm:ss');_0x14962e=initGraph(_[_0x4866('0x24')](_0x21ad2b,'mxCell'),_0x21ad2b[_0x4866('0x25')]);_0x46913c=new Vertices(_0x26a5cd,rpc,mailRpc);logger[_0x4866('0x12')](util[_0x4866('0x16')](_0x4866('0x3a'),_0x26a5cd[_0x4866('0x19')],_0x26a5cd[_0x4866('0x1a')],_0x26a5cd[_0x4866('0x1b')],_0x26a5cd['dnid'],_0x26a5cd['uniqueid']));_0x14962e[_0x4866('0x3b')](_0x21ad2b[_0x4866('0x3c')]['id'],function(_0x11cb37){try{_0x11cb37=_0x46913c[_0x4866('0x3d')](_0x11cb37);logger[_0x4866('0x33')](_0x4866('0x3e'),JSON['stringify'](_0x11cb37,null,0x2));if(_0x11cb37[_0x4866('0x3f')]===_0x4866('0x40')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x26a5cd['context']=_0x11cb37['context']||_0x26a5cd[_0x4866('0x41')];_0x26a5cd[_0x4866('0x42')]=_0x11cb37[_0x4866('0x42')];_0x26a5cd[_0x4866('0x43')]=_0x11cb37['priority']?_0x11cb37[_0x4866('0x43')]-0x1:0x1;return null;}else if(_0x11cb37&&_0x46913c[_0x11cb37[_0x4866('0x3f')]]){_0x47cd79=_0x46913c[_0x11cb37[_0x4866('0x3f')]](_0x11cb37);logger[_0x4866('0x12')](_0x4866('0x44'),JSON[_0x4866('0x35')](_0x47cd79,null,0x2));if(_0x47cd79&&_0x47cd79['code']===AGI_CODE_SUCCESS&&_0x47cd79[_0x4866('0x45')]!==AGI_RESULT_ERROR&&!_0x26a5cd[_0x4866('0x38')]){logger[_0x4866('0x33')](_0x4866('0x44'),getLogFromObject(_0x47cd79));return _[_0x4866('0x46')](_0x47cd79[_0x4866('0x45')])?null:_0x47cd79[_0x4866('0x45')]['toString']();}else{logger[_0x4866('0xd')]('response',getLogFromObject(_0x47cd79));return null;}}else{logger[_0x4866('0xd')]('agicommand\x20not\x20found');return null;}}catch(_0x157e5b){logger[_0x4866('0xd')](_0x157e5b[_0x4866('0xe')]);return null;}});if(_0x21ad2b[_0x4866('0x47')]){logger['info'](util[_0x4866('0x16')](_0x4866('0x48'),_0x26a5cd[_0x4866('0x19')],_0x26a5cd['calleridname'],_0x26a5cd[_0x4866('0x1b')],_0x26a5cd[_0x4866('0x1c')],_0x26a5cd[_0x4866('0x1d')]));_0x14962e['traverseBFS'](_0x21ad2b[_0x4866('0x47')]['id'],function(_0x28a8f5){try{_0x28a8f5=_0x46913c[_0x4866('0x3d')](_0x28a8f5);logger['debug'](_0x4866('0x3e'),JSON[_0x4866('0x35')](_0x28a8f5,null,0x2));if(_0x28a8f5&&_0x46913c[_0x28a8f5[_0x4866('0x3f')]]){_0x47cd79=_0x46913c[_0x28a8f5[_0x4866('0x3f')]](_0x28a8f5);if(_0x47cd79){logger[_0x4866('0x33')](_0x4866('0x44'),getLogFromObject(_0x47cd79));return _[_0x4866('0x46')](_0x47cd79[_0x4866('0x45')])?null:_0x47cd79['result'][_0x4866('0x49')]();}else{logger['error']('response',getLogFromObject(_0x47cd79));return null;}}else{logger[_0x4866('0xd')](_0x4866('0x4a'));return null;}}catch(_0x4608d8){logger['error'](_0x4608d8[_0x4866('0xe')]);return null;}});}logger[_0x4866('0x12')](util[_0x4866('0x16')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x26a5cd[_0x4866('0x19')],_0x26a5cd['calleridname'],_0x26a5cd[_0x4866('0x1b')],_0x26a5cd[_0x4866('0x1c')],_0x26a5cd[_0x4866('0x1d')]));logger['info'](util[_0x4866('0x16')](_0x4866('0x4b'),_0x26a5cd[_0x4866('0x41')],_0x26a5cd[_0x4866('0x42')],parseInt(_0x26a5cd[_0x4866('0x43')],0xa)+0x1));_0x26a5cd['continueAt'](_0x26a5cd[_0x4866('0x41')],_0x26a5cd[_0x4866('0x42')],parseInt(_0x26a5cd[_0x4866('0x43')],0xa)+0x1);_0x26a5cd[_0x4866('0x4c')]();}}else{logger[_0x4866('0xd')](util[_0x4866('0x16')]('Project\x20%s\x20not\x20published',_0x26a5cd[_0x4866('0x19')]));_0x26a5cd[_0x4866('0x4d')](_0x26a5cd['context'],_0x26a5cd['extension'],parseInt(_0x26a5cd[_0x4866('0x43')],0xa)+0x1);_0x26a5cd[_0x4866('0x4c')]();}}else{logger['error'](util[_0x4866('0x16')]('Project\x20%s\x20not\x20found',_0x26a5cd['arg_1']));_0x26a5cd[_0x4866('0x4d')](_0x26a5cd[_0x4866('0x41')],_0x26a5cd[_0x4866('0x42')],parseInt(_0x26a5cd[_0x4866('0x43')],0xa)+0x1);_0x26a5cd['close']();}}function main(){var _0x4ab731;return utilLicense[_0x4866('0x4e')]()[_0x4866('0x2d')](function(_0x12a771){if(_0x12a771){if(_0x12a771[_0x4866('0x4f')]){if(_0x12a771[_0x4866('0x50')]&&_0x12a771[_0x4866('0x50')]>0x0){logger[_0x4866('0x12')](util[_0x4866('0x16')]('[LICENSE]\x20CHANNELS:\x20%s',_0x12a771[_0x4866('0x50')]));_0x4ab731=_0x12a771[_0x4866('0x50')];}else{logger[_0x4866('0x12')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info']('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x4ab731=-0x1;}}})[_0x4866('0x2e')](function(_0x3b17f2){logger[_0x4866('0xd')](_0x4866('0x51'),_0x3b17f2['stack']);})[_0x4866('0x47')](function(){var _0x4c1964=require('./server')(config[_0x4866('0x7')][_0x4866('0x11')],config[_0x4866('0x7')]['ip'],_0x4ab731);_0x4c1964['on']('error',errorHandler);_0x4c1964['on']('listening',listeningHandler);_0x4c1964['on'](_0x4866('0x52'),connectionHandler);_0x4c1964['on'](_0x4866('0x4c'),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 90047c1..a3dd09a 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(_0x1d88c7,_0x466051){var _0x6c97b5=function(_0x74089e){while(--_0x74089e){_0x1d88c7['push'](_0x1d88c7['shift']());}};_0x6c97b5(++_0x466051);}(_0x814b,0x1a2));var _0xb814=function(_0x324012,_0x23f45f){_0x324012=_0x324012-0x0;var _0x435cf2=_0x814b[_0x324012];return _0x435cf2;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file +var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x159e34,_0x533f6a){var _0x2cae47=function(_0x47d232){while(--_0x47d232){_0x159e34['push'](_0x159e34['shift']());}};_0x2cae47(++_0x533f6a);}(_0x814b,0x1a2));var _0xb814=function(_0x59ee41,_0xaf7db8){_0x59ee41=_0x59ee41-0x0;var _0x3ecd3e=_0x814b[_0x59ee41];return _0x3ecd3e;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index fb786f7..f39333c 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(_0x5712a5,_0x23820b){var _0x224288=function(_0x86b731){while(--_0x86b731){_0x5712a5['push'](_0x5712a5['shift']());}};_0x224288(++_0x23820b);}(_0x7a54,0x106));var _0x47a5=function(_0x23984c,_0x20e6cb){_0x23984c=_0x23984c-0x0;var _0x4ba548=_0x7a54[_0x23984c];return _0x4ba548;};'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 _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x131a70,_0x5f53b2){var _0x212967=function(_0x2a43ac){while(--_0x2a43ac){_0x131a70['push'](_0x131a70['shift']());}};_0x212967(++_0x5f53b2);}(_0xb10b,0x12a));var _0xbb10=function(_0x7d6eca,_0x59d54a){_0x7d6eca=_0x7d6eca-0x0;var _0x128263=_0xb10b[_0x7d6eca];return _0x128263;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 33adf7c..d18a403 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 _0xc8f8=['CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','bluebird','moment','lodash','util','client','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','MailServerOut','email','getVoiceQueueById','ShowVoiceQueue','name','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage'];(function(_0xe3cdb5,_0x571705){var _0x24b9a8=function(_0x498fb2){while(--_0x498fb2){_0xe3cdb5['push'](_0xe3cdb5['shift']());}};_0x24b9a8(++_0x571705);}(_0xc8f8,0x1cc));var _0x8c8f=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xc8f8[_0xc4001c];return _0x49f7bc;};'use strict';var BPromise=require(_0x8c8f('0x0'));var moment=require(_0x8c8f('0x1'));var _=require(_0x8c8f('0x2'));var util=require(_0x8c8f('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x8c8f('0x4')][_0x8c8f('0x5')]({'port':0x2329});function request(_0x5824f4,_0x264aa4){return new BPromise(function(_0x40f46f,_0x28c2be){return client[_0x8c8f('0x6')](_0x5824f4,_0x264aa4)[_0x8c8f('0x7')](function(_0x224773){if(_0x224773[_0x8c8f('0x8')]){return _0x28c2be(_0x224773[_0x8c8f('0x8')][_0x8c8f('0x9')]);}else{return _0x40f46f(_0x224773[_0x8c8f('0xa')]);}})[_0x8c8f('0xb')](function(_0x1b4b82){return _0x28c2be(_0x1b4b82);});});}exports[_0x8c8f('0xc')]=function(_0x4e0baf){return request(_0x8c8f('0xd'),{'options':{'raw':![],'where':{'name':_0x4e0baf},'attributes':['production']}});};exports['getMailAccountById']=function(_0x2a8485){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x2a8485},'include':[{'model':_0x8c8f('0xe'),'as':'Smtp'}],'attributes':['id','name',_0x8c8f('0xf')]}});};exports['getSquareProjectById']=function(_0x56bd4c){return request(_0x8c8f('0xd'),{'options':{'where':{'id':_0x56bd4c},'attributes':['name']}});};exports[_0x8c8f('0x10')]=function(_0x3d2413){return request(_0x8c8f('0x11'),{'options':{'where':{'id':_0x3d2413},'attributes':[_0x8c8f('0x12')]}});};exports['getVariableById']=function(_0x49b30f){return request(_0x8c8f('0x13'),{'options':{'where':{'id':_0x49b30f},'attributes':[_0x8c8f('0x12')]}});};exports[_0x8c8f('0x14')]=function(_0x5b77f2){return request(_0x8c8f('0x15'),{'options':{'where':{'id':_0x5b77f2},'attributes':[_0x8c8f('0x16')]}});};exports['getUserById']=function(_0x255f97){return request(_0x8c8f('0x17'),{'options':{'where':{'id':_0x255f97},'attributes':[_0x8c8f('0x12')]}});};exports[_0x8c8f('0x18')]=function(_0x57c9b6){return request(_0x8c8f('0x19'),{'options':{'where':{'id':_0x57c9b6},'attributes':[_0x8c8f('0x12')]}});};exports['getSoundById']=function(_0xe96bb2){return request(_0x8c8f('0x1a'),{'options':{'where':{'id':_0xe96bb2},'attributes':[_0x8c8f('0x1b')]}});};exports[_0x8c8f('0x1c')]=function(_0x32d139){return request(_0x8c8f('0x1d'),{'options':{'raw':![],'where':{'id':_0x32d139},'include':[{'model':'Interval','as':_0x8c8f('0x1e')}]}});};exports['getSmsAccountById']=function(_0x5300c6){return request(_0x8c8f('0x1f'),{'options':{'where':{'id':_0x5300c6},'attributes':['id',_0x8c8f('0x12')]}});};exports[_0x8c8f('0x20')]=function(_0x242e02){return request(_0x8c8f('0x21'),{'body':_0x242e02});};exports[_0x8c8f('0x22')]=function(_0x3a8609){return request(_0x8c8f('0x23'),{'body':_0x3a8609});};exports[_0x8c8f('0x24')]=function(_0x1a66d7){return request(_0x8c8f('0x25'),{'body':_['merge'](_0x1a66d7,{'project_name':_0x1a66d7[_0x8c8f('0x26')],'prev_project_name':_0x1a66d7[_0x8c8f('0x27')]||'','is_subproject':_0x1a66d7[_0x8c8f('0x27')]?!![]:![],'leaveAt':moment()[_0x8c8f('0x28')](_0x8c8f('0x29'))})});};exports['createSquareRecording']=function(_0x7d258d){return request(_0x8c8f('0x2a'),{'body':_0x7d258d});};exports[_0x8c8f('0x2b')]=function(_0x4bf4d6){return request(_0x8c8f('0x2c'),{'body':_0x4bf4d6});};exports[_0x8c8f('0x2d')]=function(_0x6e4ad2){return request(_0x8c8f('0x2e'),{'options':{'raw':![],'where':{'phone':_0x6e4ad2[_0x8c8f('0x2f')],'ListId':_0x6e4ad2[_0x8c8f('0x30')]}}})[_0x8c8f('0x7')](function(_0x5b1fe9){if(_0x5b1fe9){return _0x5b1fe9;}return request(_0x8c8f('0x31'),{'body':_0x6e4ad2});});};exports[_0x8c8f('0x32')]=function(_0x30e8e7){return request('ShowPause',{'options':{'where':{'id':_0x30e8e7},'attributes':[_0x8c8f('0x12')]}});};exports['agentLogin']=function(_0x38ea38,_0x103462){return request(_0x8c8f('0x33'),{'body':{'interface':_0x103462},'options':{'where':_0x38ea38}});};exports[_0x8c8f('0x34')]=function(_0x292934,_0x38d6fe,_0x2f7791){return request(_0x8c8f('0x35'),{'body':{'type':_0x38d6fe,'uniqueid':_0x2f7791},'options':{'where':_0x292934}});};exports[_0x8c8f('0x36')]=function(_0x5a6bdb){return request('UnpauseUser',{'body':{},'options':{'where':_0x5a6bdb}});};exports[_0x8c8f('0x37')]=function(_0x4c96d5){return request('LogoutUser',{'body':{},'options':{'where':_0x4c96d5}});}; \ No newline at end of file +var _0x4a65=['lodash','util','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowSquareOdbc','dsn','ShowTrunk','ShowSound','save_name','ShowInterval','Interval','ShowSmsAccount','createSmsMessage','createSquareReport','merge','arg_1','YYYY-MM-DD\x20HH:mm:ss','CreateSquareMessage','phone','ListId','getPauseById','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment'];(function(_0x1a4e0f,_0x5a6381){var _0x1435d1=function(_0x2dd5f5){while(--_0x2dd5f5){_0x1a4e0f['push'](_0x1a4e0f['shift']());}};_0x1435d1(++_0x5a6381);}(_0x4a65,0x16f));var _0x54a6=function(_0xd051df,_0xbf70d1){_0xd051df=_0xd051df-0x0;var _0x4378d7=_0x4a65[_0xd051df];return _0x4378d7;};'use strict';var BPromise=require('bluebird');var moment=require(_0x54a6('0x0'));var _=require(_0x54a6('0x1'));var util=require(_0x54a6('0x2'));var jayson=require(_0x54a6('0x3'));var client=jayson[_0x54a6('0x4')][_0x54a6('0x5')]({'port':0x2329});function request(_0x4f147a,_0x10aeda){return new BPromise(function(_0x1b9f30,_0x255f7b){return client[_0x54a6('0x6')](_0x4f147a,_0x10aeda)[_0x54a6('0x7')](function(_0xc9e68a){if(_0xc9e68a[_0x54a6('0x8')]){return _0x255f7b(_0xc9e68a[_0x54a6('0x8')][_0x54a6('0x9')]);}else{return _0x1b9f30(_0xc9e68a[_0x54a6('0xa')]);}})[_0x54a6('0xb')](function(_0x560c17){return _0x255f7b(_0x560c17);});});}exports[_0x54a6('0xc')]=function(_0x40a069){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x40a069},'attributes':[_0x54a6('0xd')]}});};exports[_0x54a6('0xe')]=function(_0x24c1bf){return request(_0x54a6('0xf'),{'options':{'raw':![],'where':{'id':_0x24c1bf},'include':[{'model':_0x54a6('0x10'),'as':_0x54a6('0x11')}],'attributes':['id',_0x54a6('0x12'),_0x54a6('0x13')]}});};exports[_0x54a6('0x14')]=function(_0x4a4df7){return request('ShowSquareProject',{'options':{'where':{'id':_0x4a4df7},'attributes':['name']}});};exports[_0x54a6('0x15')]=function(_0x527de2){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x527de2},'attributes':[_0x54a6('0x12')]}});};exports['getVariableById']=function(_0x350538){return request('ShowVariable',{'options':{'where':{'id':_0x350538},'attributes':[_0x54a6('0x12')]}});};exports['getSquareOdbcById']=function(_0x1020ff){return request(_0x54a6('0x16'),{'options':{'where':{'id':_0x1020ff},'attributes':[_0x54a6('0x17')]}});};exports['getUserById']=function(_0x30c3ad){return request('ShowUser',{'options':{'where':{'id':_0x30c3ad},'attributes':[_0x54a6('0x12')]}});};exports['getTrunkById']=function(_0x27c0e){return request(_0x54a6('0x18'),{'options':{'where':{'id':_0x27c0e},'attributes':[_0x54a6('0x12')]}});};exports['getSoundById']=function(_0x34ef9c){return request(_0x54a6('0x19'),{'options':{'where':{'id':_0x34ef9c},'attributes':[_0x54a6('0x1a')]}});};exports['getIntervalById']=function(_0x4efbc2){return request(_0x54a6('0x1b'),{'options':{'raw':![],'where':{'id':_0x4efbc2},'include':[{'model':_0x54a6('0x1c'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x430292){return request(_0x54a6('0x1d'),{'options':{'where':{'id':_0x430292},'attributes':['id',_0x54a6('0x12')]}});};exports[_0x54a6('0x1e')]=function(_0x191416){return request('CreateSmsMessage',{'body':_0x191416});};exports['createSquareDetailsReport']=function(_0x4d1067){return request('CreateSquareDetailsReport',{'body':_0x4d1067});};exports[_0x54a6('0x1f')]=function(_0x2292e2){return request('CreateSquareReport',{'body':_[_0x54a6('0x20')](_0x2292e2,{'project_name':_0x2292e2[_0x54a6('0x21')],'prev_project_name':_0x2292e2['arg_2']||'','is_subproject':_0x2292e2['arg_2']?!![]:![],'leaveAt':moment()['format'](_0x54a6('0x22'))})});};exports['createSquareRecording']=function(_0x777a93){return request('CreateSquareRecording',{'body':_0x777a93});};exports['createSquareMessage']=function(_0x558b92){return request(_0x54a6('0x23'),{'body':_0x558b92});};exports['createCmContact']=function(_0x2974d7){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x2974d7[_0x54a6('0x24')],'ListId':_0x2974d7[_0x54a6('0x25')]}}})[_0x54a6('0x7')](function(_0x24e914){if(_0x24e914){return _0x24e914;}return request('CreateCmContact',{'body':_0x2974d7});});};exports[_0x54a6('0x26')]=function(_0x34808a){return request('ShowPause',{'options':{'where':{'id':_0x34808a},'attributes':[_0x54a6('0x12')]}});};exports[_0x54a6('0x27')]=function(_0x341793,_0x2a40e3){return request(_0x54a6('0x28'),{'body':{'interface':_0x2a40e3},'options':{'where':_0x341793}});};exports[_0x54a6('0x29')]=function(_0x4fe736,_0x3d40b9,_0x1fcb39){return request('PauseUser',{'body':{'type':_0x3d40b9,'uniqueid':_0x1fcb39},'options':{'where':_0x4fe736}});};exports[_0x54a6('0x2a')]=function(_0x248564){return request(_0x54a6('0x2b'),{'body':{},'options':{'where':_0x248564}});};exports[_0x54a6('0x2c')]=function(_0x39a27f){return request(_0x54a6('0x2d'),{'body':{},'options':{'where':_0x39a27f}});}; \ 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 54dce9e..28cfe96 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 _0xda55=['./lex','./polly'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xda55,0x6d));var _0x5da5=function(_0x17cb66,_0x11aba9){_0x17cb66=_0x17cb66-0x0;var _0x3c134c=_0xda55[_0x17cb66];return _0x3c134c;};var polly=require(_0x5da5('0x0'));var lex=require(_0x5da5('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var polly=require('./polly');var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 0f307ac..c7f6035 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 _0x2209=['exports','./lib/api'];(function(_0x3c7e74,_0x431a67){var _0x5e7924=function(_0x39e11f){while(--_0x39e11f){_0x3c7e74['push'](_0x3c7e74['shift']());}};_0x5e7924(++_0x431a67);}(_0x2209,0x95));var _0x9220=function(_0x4a1716,_0x1309cb){_0x4a1716=_0x4a1716-0x0;var _0x346281=_0x2209[_0x4a1716];return _0x346281;};'use strict';var lex=require(_0x9220('0x0'));module[_0x9220('0x1')]=function(_0x165787,_0x19bb93,_0x29dc9b,_0x5d3fe2,_0x2b23aa,_0x5cc72c){return lex(_0x165787,_0x19bb93,_0x29dc9b,_0x5d3fe2,_0x2b23aa,_0x5cc72c);}; \ No newline at end of file +var _0x1cc7=['./lib/api','exports'];(function(_0xdeac17,_0x19ad66){var _0x33aabd=function(_0x558a9e){while(--_0x558a9e){_0xdeac17['push'](_0xdeac17['shift']());}};_0x33aabd(++_0x19ad66);}(_0x1cc7,0x15a));var _0x71cc=function(_0x137023,_0x5e369b){_0x137023=_0x137023-0x0;var _0x8b8a3d=_0x1cc7[_0x137023];return _0x8b8a3d;};'use strict';var lex=require(_0x71cc('0x0'));module[_0x71cc('0x1')]=function(_0x7812aa,_0x53efaf,_0x4db9cd,_0x547fe6,_0xe5d54e,_0x1fac93){return lex(_0x7812aa,_0x53efaf,_0x4db9cd,_0x547fe6,_0xe5d54e,_0x1fac93);}; \ 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 2476691..f23b1d8 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 _0x7efd=['$LATEST','bluebird','aws-sdk','slots','hasOwnProperty','slot_'];(function(_0x981fea,_0x4665c6){var _0x236293=function(_0x2141c3){while(--_0x2141c3){_0x981fea['push'](_0x981fea['shift']());}};_0x236293(++_0x4665c6);}(_0x7efd,0x103));var _0xd7ef=function(_0x53df85,_0x1b796e){_0x53df85=_0x53df85-0x0;var _0xb89708=_0x7efd[_0x53df85];return _0xb89708;};'use strict';var BPromise=require(_0xd7ef('0x0'));var AWS=require(_0xd7ef('0x1'));function lexResult(_0x301bb6,_0x1248c2){return new BPromise(function(_0x205149,_0x2384aa){_0x301bb6['postText'](_0x1248c2,function(_0x243be5,_0x5f1e7c){if(_0x243be5){_0x2384aa(_0x243be5);}if(_0x5f1e7c[_0xd7ef('0x2')]){for(const _0x2068ae in _0x5f1e7c['slots']){if(_0x5f1e7c[_0xd7ef('0x2')][_0xd7ef('0x3')](_0x2068ae)){var _0x3596a9=_0x5f1e7c['slots'][_0x2068ae];_0x5f1e7c[_0xd7ef('0x4')+_0x2068ae]=_0x3596a9;}}}_0x205149(_0x5f1e7c);});});}module['exports']=function(_0x3dca56,_0x128b51,_0x2d61b6,_0x3693b1,_0x48fc83,_0x4b3c26){var _0x512cc2=new AWS['LexRuntime']({'accessKeyId':_0x128b51,'secretAccessKey':_0x2d61b6,'region':_0x3693b1});var _0x296bbc={'botAlias':_0xd7ef('0x5'),'botName':_0x4b3c26,'inputText':_0x48fc83,'userId':_0x3dca56};return lexResult(_0x512cc2,_0x296bbc);}; \ No newline at end of file +var _0xaef4=['hasOwnProperty','exports','LexRuntime','$LATEST','bluebird','aws-sdk','postText','slots'];(function(_0x107f10,_0x5529f2){var _0x811cab=function(_0xc160ea){while(--_0xc160ea){_0x107f10['push'](_0x107f10['shift']());}};_0x811cab(++_0x5529f2);}(_0xaef4,0x17c));var _0x4aef=function(_0xe430a8,_0x2de3a5){_0xe430a8=_0xe430a8-0x0;var _0x245dc3=_0xaef4[_0xe430a8];return _0x245dc3;};'use strict';var BPromise=require(_0x4aef('0x0'));var AWS=require(_0x4aef('0x1'));function lexResult(_0x3b3715,_0x532e41){return new BPromise(function(_0x2e4921,_0x17bc3d){_0x3b3715[_0x4aef('0x2')](_0x532e41,function(_0x3d7dbb,_0x37de32){if(_0x3d7dbb){_0x17bc3d(_0x3d7dbb);}if(_0x37de32[_0x4aef('0x3')]){for(const _0x592d8e in _0x37de32[_0x4aef('0x3')]){if(_0x37de32['slots'][_0x4aef('0x4')](_0x592d8e)){var _0x2b343c=_0x37de32[_0x4aef('0x3')][_0x592d8e];_0x37de32['slot_'+_0x592d8e]=_0x2b343c;}}}_0x2e4921(_0x37de32);});});}module[_0x4aef('0x5')]=function(_0x51819c,_0x5efc31,_0x104a6b,_0xd05153,_0x1a5766,_0x4fa598){var _0xad8397=new AWS[(_0x4aef('0x6'))]({'accessKeyId':_0x5efc31,'secretAccessKey':_0x104a6b,'region':_0xd05153});var _0x1bc500={'botAlias':_0x4aef('0x7'),'botName':_0x4fa598,'inputText':_0x1a5766,'userId':_0x51819c};return lexResult(_0xad8397,_0x1bc500);}; \ 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 b8a3c8f..dc58b92 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 _0x348d=['./lib/api','exports'];(function(_0x3048fa,_0x21f9ee){var _0x59fc63=function(_0x4ae1a2){while(--_0x4ae1a2){_0x3048fa['push'](_0x3048fa['shift']());}};_0x59fc63(++_0x21f9ee);}(_0x348d,0x152));var _0xd348=function(_0x30d87a,_0xf3a07f){_0x30d87a=_0x30d87a-0x0;var _0x48f64b=_0x348d[_0x30d87a];return _0x48f64b;};'use strict';var polly=require(_0xd348('0x0'));module[_0xd348('0x1')]=function(_0x2b4ab8,_0x2dc341,_0x322ee8,_0x3d8146,_0x3b535c,_0x183889,_0x1a18d4){return polly(_0x2b4ab8,_0x2dc341,_0x322ee8,_0x3d8146,_0x3b535c,_0x183889,_0x1a18d4);}; \ No newline at end of file +var _0x31a3=['./lib/api','exports'];(function(_0x38782c,_0x5c9fef){var _0x3708bf=function(_0x595e13){while(--_0x595e13){_0x38782c['push'](_0x38782c['shift']());}};_0x3708bf(++_0x5c9fef);}(_0x31a3,0x174));var _0x331a=function(_0x56de0b,_0x1c39c1){_0x56de0b=_0x56de0b-0x0;var _0x1c05f0=_0x31a3[_0x56de0b];return _0x1c05f0;};'use strict';var polly=require(_0x331a('0x0'));module[_0x331a('0x1')]=function(_0xbbf6e5,_0x428b3e,_0x2ec307,_0x2368af,_0x48d913,_0x544c47,_0x4ee47d){return polly(_0xbbf6e5,_0x428b3e,_0x2ec307,_0x2368af,_0x48d913,_0x544c47,_0x4ee47d);}; \ 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 e1cd4bc..f337e87 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 _0x4648=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x2dbbbf,_0xf863fa){var _0x2c50a2=function(_0xacd5fc){while(--_0xacd5fc){_0x2dbbbf['push'](_0x2dbbbf['shift']());}};_0x2c50a2(++_0xf863fa);}(_0x4648,0xec));var _0x8464=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4648[_0x3bf83f];return _0x22c4a9;};'use strict';var fs=require('fs');var path=require(_0x8464('0x0'));var BPromise=require(_0x8464('0x1'));var rs=require(_0x8464('0x2'));var AWS=require(_0x8464('0x3'));function pollyResult(_0x4e257e,_0xde0764,_0x484d6c){return new BPromise(function(_0x5c03d0,_0x184e16){_0x4e257e[_0x8464('0x4')](_0xde0764,function(_0x25b6a8,_0x5f153b){if(_0x25b6a8){_0x184e16(_0x25b6a8);}else if(_0x5f153b){if(_0x5f153b[_0x8464('0x5')]instanceof Buffer){fs[_0x8464('0x6')](_0x484d6c,_0x5f153b[_0x8464('0x5')],function(_0x3b0a40){if(_0x3b0a40){_0x184e16(_0x3b0a40);}else{_0x5c03d0();}});}else{_0x184e16(new Error(_0x8464('0x7')));}}else{_0x184e16(new Error(_0x8464('0x8')));}});});}module['exports']=function(_0x5d8080,_0x2f52db,_0x2f0c1f,_0x4d7173,_0x15d866,_0xc16df0,_0x35c06a){var _0x4000f4=new AWS[(_0x8464('0x9'))]({'accessKeyId':_0x5d8080,'secretAccessKey':_0x2f52db,'region':_0x2f0c1f});var _0x406ec9={'Text':_0x15d866,'TextType':_0xc16df0||_0x8464('0xa'),'OutputFormat':'mp3','VoiceId':_0x4d7173};return pollyResult(_0x4000f4,_0x406ec9,_0x35c06a);}; \ No newline at end of file +var _0x7731=['mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly'];(function(_0x181e90,_0x32bf58){var _0x216eab=function(_0x278981){while(--_0x278981){_0x181e90['push'](_0x181e90['shift']());}};_0x216eab(++_0x32bf58);}(_0x7731,0x1d5));var _0x1773=function(_0x5e4e73,_0x167264){_0x5e4e73=_0x5e4e73-0x0;var _0x3f95b1=_0x7731[_0x5e4e73];return _0x3f95b1;};'use strict';var fs=require('fs');var path=require(_0x1773('0x0'));var BPromise=require(_0x1773('0x1'));var rs=require(_0x1773('0x2'));var AWS=require(_0x1773('0x3'));function pollyResult(_0x3fc351,_0x2aa37a,_0x1eeecc){return new BPromise(function(_0x47d6fa,_0x13f4a3){_0x3fc351[_0x1773('0x4')](_0x2aa37a,function(_0x3a18d2,_0x3fb8a6){if(_0x3a18d2){_0x13f4a3(_0x3a18d2);}else if(_0x3fb8a6){if(_0x3fb8a6[_0x1773('0x5')]instanceof Buffer){fs[_0x1773('0x6')](_0x1eeecc,_0x3fb8a6[_0x1773('0x5')],function(_0x251f1e){if(_0x251f1e){_0x13f4a3(_0x251f1e);}else{_0x47d6fa();}});}else{_0x13f4a3(new Error(_0x1773('0x7')));}}else{_0x13f4a3(new Error(_0x1773('0x8')));}});});}module[_0x1773('0x9')]=function(_0x20c489,_0x24be72,_0x3d034d,_0x194791,_0x30a236,_0x25f5c4,_0x5bb403){var _0x12bda8=new AWS[(_0x1773('0xa'))]({'accessKeyId':_0x20c489,'secretAccessKey':_0x24be72,'region':_0x3d034d});var _0xc98180={'Text':_0x30a236,'TextType':_0x25f5c4||'text','OutputFormat':_0x1773('0xb'),'VoiceId':_0x194791};return pollyResult(_0x12bda8,_0xc98180,_0x5bb403);}; \ 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 3ac118f..f9564ec 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 _0xcadc=['exports','./lib/api'];(function(_0x3658c7,_0x23fec8){var _0x3a15ff=function(_0x42c5ce){while(--_0x42c5ce){_0x3658c7['push'](_0x3658c7['shift']());}};_0x3a15ff(++_0x23fec8);}(_0xcadc,0x143));var _0xccad=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xcadc[_0x4a9fb1];return _0x348672;};'use strict';var asr=require(_0xccad('0x0'));module[_0xccad('0x1')]=function(_0x522b09,_0x421552,_0x496b95,_0x108866){return asr(_0x522b09,_0x421552,_0x496b95);}; \ No newline at end of file +var _0x7400=['exports','./lib/api'];(function(_0x398481,_0x3de964){var _0x3a4d22=function(_0x359ad4){while(--_0x359ad4){_0x398481['push'](_0x398481['shift']());}};_0x3a4d22(++_0x3de964);}(_0x7400,0xdd));var _0x0740=function(_0x323021,_0x30f030){_0x323021=_0x323021-0x0;var _0x52cb3e=_0x7400[_0x323021];return _0x52cb3e;};'use strict';var asr=require(_0x0740('0x0'));module[_0x0740('0x1')]=function(_0x552a39,_0x25dcf5,_0x55a016,_0x46d33a){return asr(_0x552a39,_0x25dcf5,_0x55a016);}; \ 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 9c25bc7..14f983d 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 _0x1b49=['filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','8000','url','string','length'];(function(_0x3b434d,_0x8fb9a8){var _0x53648e=function(_0x37b2b9){while(--_0x37b2b9){_0x3b434d['push'](_0x3b434d['shift']());}};_0x53648e(++_0x8fb9a8);}(_0x1b49,0x16f));var _0x91b4=function(_0x20d9f0,_0x453415){_0x20d9f0=_0x20d9f0-0x0;var _0x195dda=_0x1b49[_0x20d9f0];return _0x195dda;};'use strict';var url=require(_0x91b4('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x523b52,_0x2faf21,_0x43e946){return new BPromise(function(_0x285275,_0x122a2b){var _0x916287;if(typeof _0x523b52!==_0x91b4('0x1')||_0x523b52[_0x91b4('0x2')]===0x0){return _0x122a2b(_0x91b4('0x3'));}if(typeof _0x2faf21!==_0x91b4('0x1')||_0x2faf21[_0x91b4('0x2')]===0x0){return _0x122a2b(_0x91b4('0x4'));}if(typeof _0x43e946!=='undefined'&&(typeof _0x43e946!=='string'||_0x43e946['length']===0x0)){return _0x122a2b('lang\x20should\x20be\x20a\x20string');}try{_0x916287=fs[_0x91b4('0x5')](_0x523b52)[_0x91b4('0x6')](_0x91b4('0x7'));}catch(_0x2ed4b3){return _0x122a2b(_0x2ed4b3);}return _0x285275({'method':_0x91b4('0x8'),'uri':host+'/v1/speech:recognize?key='+_0x2faf21,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x91b4('0x9'),'languageCode':_0x43e946},'audio':{'content':_0x916287}},'json':!![]});});}; \ No newline at end of file +var _0xd04c=['length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','string'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0xd04c,0xc4));var _0xcd04=function(_0x5a683d,_0x1eecea){_0x5a683d=_0x5a683d-0x0;var _0x4fd94a=_0xd04c[_0x5a683d];return _0x4fd94a;};'use strict';var url=require('url');var BPromise=require(_0xcd04('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x3e63dd,_0x21af30,_0x45919b){return new BPromise(function(_0xc93adf,_0x17524f){var _0x583bd1;if(typeof _0x3e63dd!==_0xcd04('0x1')||_0x3e63dd[_0xcd04('0x2')]===0x0){return _0x17524f(_0xcd04('0x3'));}if(typeof _0x21af30!==_0xcd04('0x1')||_0x21af30[_0xcd04('0x2')]===0x0){return _0x17524f(_0xcd04('0x4'));}if(typeof _0x45919b!=='undefined'&&(typeof _0x45919b!=='string'||_0x45919b[_0xcd04('0x2')]===0x0)){return _0x17524f('lang\x20should\x20be\x20a\x20string');}try{_0x583bd1=fs['readFileSync'](_0x3e63dd)[_0xcd04('0x5')](_0xcd04('0x6'));}catch(_0x353bd7){return _0x17524f(_0x353bd7);}return _0xc93adf({'method':_0xcd04('0x7'),'uri':host+_0xcd04('0x8')+_0x21af30,'body':{'config':{'encoding':_0xcd04('0x9'),'sampleRateHertz':_0xcd04('0xa'),'languageCode':_0x45919b},'audio':{'content':_0x583bd1}},'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..d5dd223 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 _0x1aab=['./asr','exports'];(function(_0x1575fb,_0x48554c){var _0x1e5f78=function(_0x2d4a0e){while(--_0x2d4a0e){_0x1575fb['push'](_0x1575fb['shift']());}};_0x1e5f78(++_0x48554c);}(_0x1aab,0x122));var _0xb1aa=function(_0x5949c4,_0x4b9c8c){_0x5949c4=_0x5949c4-0x0;var _0x496d0=_0x1aab[_0x5949c4];return _0x496d0;};var asr=require(_0xb1aa('0x0'));module[_0xb1aa('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 373e92d..a8d5831 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 _0x3b3f=['statusMessage','createWriteStream','info','close','unlink','pipe','end','WHAT_EVER','transcode','error\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','voice','MP3','.mp3','from','audioContent','777','then','googleCloudTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','[%s]\x20%s:%s','message','textRequest','stringify','result','resolvedQuery','actionIncomplete','speech','score','status','code','metadata','endConversation','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','format','model=%s','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','path','https','parse','bluebird','randomstring','request-promise','util','querystring','google-tts-api','md5','./aws','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','host','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20'];(function(_0x6ff21e,_0xfc38db){var _0x447ea3=function(_0x867632){while(--_0x867632){_0x6ff21e['push'](_0x6ff21e['shift']());}};_0x447ea3(++_0xfc38db);}(_0x3b3f,0x110));var _0xf3b3=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3b3f[_0x501510];return _0x1e6ee5;};'use strict';var fs=require('fs');var path=require(_0xf3b3('0x0'));var http=require('http');var https=require(_0xf3b3('0x1'));var urlParse=require('url')[_0xf3b3('0x2')];var BPromise=require(_0xf3b3('0x3'));var rs=require(_0xf3b3('0x4'));var sox=require('sox');var rp=require(_0xf3b3('0x5'));var util=require(_0xf3b3('0x6'));var querystring=require(_0xf3b3('0x7'));var tts=require(_0xf3b3('0x8'));var apiai=require('apiai-promise');var md5=require(_0xf3b3('0x9'));var google=require('./google');var aws=require(_0xf3b3('0xa'));var tilde=require(_0xf3b3('0xb'));var sestek=require('./sestek');var logger=require('../../../config/logger')(_0xf3b3('0xc'));var ISPEECH_API=_0xf3b3('0xd');function downloadFile(_0x341040,_0x2d4c4d){return new BPromise(function(_0x707b0d,_0x53d54b){var _0x365e63=urlParse(_0x341040);var _0x4b0e2c=_0x365e63[_0xf3b3('0xe')]===_0xf3b3('0xf')?https:http;var _0xf31887={'host':_0x365e63[_0xf3b3('0x10')],'path':_0x365e63[_0xf3b3('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x4b0e2c[_0xf3b3('0x11')](_0xf31887,function(_0x4ee6c){if(_0x4ee6c[_0xf3b3('0x12')]!==0xc8){logger[_0xf3b3('0x13')](_0xf3b3('0x14')+_0x341040+_0xf3b3('0x15')+_0x4ee6c[_0xf3b3('0x12')]+'\x20('+_0x4ee6c[_0xf3b3('0x16')]+')');_0x53d54b(new Error(_0xf3b3('0x14')+_0x341040+_0xf3b3('0x15')+_0x4ee6c[_0xf3b3('0x12')]+'\x20('+_0x4ee6c['statusMessage']+')'));return;}var _0x4e4856=fs[_0xf3b3('0x17')](_0x2d4c4d);_0x4e4856['on']('finish',function(){logger[_0xf3b3('0x18')]('finish\x20download\x20file');_0x4e4856[_0xf3b3('0x19')](_0x707b0d);});_0x4e4856['on'](_0xf3b3('0x13'),function(_0x5ce4f2){fs[_0xf3b3('0x1a')](_0x2d4c4d);logger[_0xf3b3('0x13')]('download\x20error',_0x5ce4f2);_0x53d54b(_0x5ce4f2);});_0x4ee6c[_0xf3b3('0x1b')](_0x4e4856);})['on'](_0xf3b3('0x13'),function(_0x121143){logger[_0xf3b3('0x13')](_0x121143);_0x53d54b(_0x121143);})[_0xf3b3('0x1c')]();});}function uploadFile(_0x21462e){return new BPromise(function(_0x8e6816,_0xfb4fcd){var _0x34732d=urlParse(_0x21462e);var _0x1f02ee=_0x34732d[_0xf3b3('0xe')]===_0xf3b3('0xf')?https:http;var _0x536625={'host':_0x34732d[_0xf3b3('0x10')],'path':_0x34732d[_0xf3b3('0x0')],'headers':{'user-agent':_0xf3b3('0x1d')}};_0x1f02ee[_0xf3b3('0x11')](_0x536625,function(_0x289160){if(_0x289160[_0xf3b3('0x12')]!==0xc8){_0xfb4fcd(new Error(_0xf3b3('0x14')+_0x21462e+_0xf3b3('0x15')+_0x289160[_0xf3b3('0x12')]+'\x20('+_0x289160[_0xf3b3('0x16')]+')'));return;}var _0x56227b='';_0x289160['on']('data',function(_0x5a1b7c){_0x56227b+=_0x5a1b7c;});_0x289160['on'](_0xf3b3('0x1c'),function(){_0x8e6816(_0x56227b);});})['on'](_0xf3b3('0x13'),function(_0x9e471c){_0xfb4fcd(_0x9e471c);})[_0xf3b3('0x1c')]();});}function convertFile(_0x1c1870,_0x42ce3b){return new BPromise(function(_0xf62e3f,_0x48acd2){var _0x3254be=sox[_0xf3b3('0x1e')](_0x1c1870,_0x42ce3b,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3254be['on']('error',function(_0x9d8a5b){logger['error'](_0xf3b3('0x1f'),_0x9d8a5b);_0x48acd2(_0x9d8a5b);});_0x3254be['on']('end',function(){logger[_0xf3b3('0x18')]('finish\x20to\x20convert');_0xf62e3f();});_0x3254be[_0xf3b3('0x20')]();});}function base64Decode(_0x46a1a7,_0x111a4a){var _0x2b44b4=path[_0xf3b3('0x21')](__dirname,_0xf3b3('0x22'),rs[_0xf3b3('0x23')](0x4)+_0xf3b3('0x24'));fs[_0xf3b3('0x25')](_0x2b44b4,_0x46a1a7,_0xf3b3('0x26'));return convertFile(_0x2b44b4,_0x111a4a)['then'](function(){try{fs[_0xf3b3('0x1a')](_0x2b44b4);fs[_0xf3b3('0x27')](_0x111a4a,'777');}catch(_0x432112){logger[_0xf3b3('0x13')](_0x432112);}return _0x111a4a[_0xf3b3('0x28')]('.')[0x0];});}function base64Encode(_0x1f1a57){var _0xd8697f=fs[_0xf3b3('0x29')](_0x1f1a57);return new Buffer(_0xd8697f)[_0xf3b3('0x2a')]('base64');}exports[_0xf3b3('0x2b')]=function(_0x3fdd25,_0x36754f,_0x574a70,_0x359f5c,_0x1c4a30,_0x480516){var _0x51e39f,_0x1bd3be;var _0x4fd37f=_0xf3b3('0x2c');var _0x4b800d='?key='+_0x3fdd25;var _0x31732b={};if(_0x36754f===_0xf3b3('0x2d')){_0x31732b['input']={'ssml':_0x574a70};}else{_0x31732b[_0xf3b3('0x2e')]={'text':_0x574a70};};_0x31732b[_0xf3b3('0x2f')]={'languageCode':_0x359f5c,'ssmlGender':_0x1c4a30};_0x31732b['audioConfig']={'audioEncoding':_0xf3b3('0x30'),'sampleRateHertz':0x1f40};var _0x15ef11={'url':_0x4fd37f+'text:synthesize'+_0x4b800d,'method':'POST','json':!![],'body':_0x31732b};return rp(_0x15ef11)['then'](function(_0xa5b359){return new BPromise(function(_0x456c85,_0x58096f){_0x51e39f=path[_0xf3b3('0x21')](__dirname,_0xf3b3('0x22'),rs['generate'](0x4)+_0xf3b3('0x31'));var _0x5716a8=Buffer[_0xf3b3('0x32')](_0xa5b359[_0xf3b3('0x33')],_0xf3b3('0x26'));return fs['writeFile'](_0x51e39f,_0x5716a8,function(_0x19755c){_0x58096f(_0x19755c);},function(_0x3361dd){fs[_0xf3b3('0x27')](_0x51e39f,_0xf3b3('0x34'));_0x456c85(_0x3361dd);});});})[_0xf3b3('0x35')](function(_0x6b1e03){_0x1bd3be=path[_0xf3b3('0x21')](__dirname,'tmp',rs['generate'](0x4)+_0xf3b3('0x24'));return convertFile(_0x51e39f,_0x1bd3be);})[_0xf3b3('0x35')](function(){try{fs['unlink'](_0x51e39f);fs[_0xf3b3('0x27')](_0x1bd3be,_0xf3b3('0x34'));}catch(_0x4abbae){logger[_0xf3b3('0x13')](_0x4abbae);}logger[_0xf3b3('0x18')](_0xf3b3('0x36'),_0x1bd3be['split']('.')[0x0]);return _0x1bd3be[_0xf3b3('0x28')]('.')[0x0];});};exports['googleTTS']=function(_0x459e9f,_0x1d1185){var _0x5bd7ed,_0x2c4216;return tts(_0x459e9f,_0x1d1185||'en',0x1)[_0xf3b3('0x35')](function(_0x33d950){logger[_0xf3b3('0x18')](_0x33d950);_0x5bd7ed=path['resolve'](__dirname,_0xf3b3('0x22'),rs['generate'](0x4)+_0xf3b3('0x31'));return downloadFile(_0x33d950,_0x5bd7ed);})[_0xf3b3('0x35')](function(){_0x2c4216=path[_0xf3b3('0x21')](__dirname,_0xf3b3('0x22'),rs[_0xf3b3('0x23')](0x4)+_0xf3b3('0x24'));return convertFile(_0x5bd7ed,_0x2c4216);})[_0xf3b3('0x35')](function(){try{fs[_0xf3b3('0x1a')](_0x5bd7ed);fs[_0xf3b3('0x27')](_0x2c4216,'777');}catch(_0x16df19){logger[_0xf3b3('0x13')](_0x16df19);}logger['info']('goggleTTS\x20path',_0x2c4216['split']('.')[0x0]);return _0x2c4216['split']('.')[0x0];});};exports[_0xf3b3('0x37')]=function(_0x1c8eb4,_0x4f179c,_0x20a389){return google[_0xf3b3('0x38')](_0x1c8eb4,_0x4f179c,_0x20a389)[_0xf3b3('0x35')](function(_0x2dee7c){logger['info'](_0x2dee7c[_0xf3b3('0x39')]);return rp(_0x2dee7c);})['then'](function(_0x4e0937){var _0x5b3e5b='';var _0x4dab84=0x0;try{fs[_0xf3b3('0x1a')](_0x1c8eb4);}catch(_0x2a01f3){logger['error'](_0x2a01f3);}if(_0x4e0937&&_0x4e0937[_0xf3b3('0x3a')]){_0x5b3e5b=_0x4e0937['results'][_0xf3b3('0x3b')](function(_0x353b3e){return _0x353b3e&&_0x353b3e[_0xf3b3('0x3c')][0x0]&&_0x353b3e[_0xf3b3('0x3c')][0x0][_0xf3b3('0x3d')]?_0x353b3e['alternatives'][0x0][_0xf3b3('0x3d')]:'';})[_0xf3b3('0x3e')]('\x0a');_0x4dab84=_0x4e0937[_0xf3b3('0x3a')][_0xf3b3('0x3b')](function(_0x16284d){return _0x16284d&&_0x16284d['alternatives'][0x0]&&_0x16284d['alternatives'][0x0]['confidence']?_0x16284d['alternatives'][0x0][_0xf3b3('0x3f')]:0x0;})[_0xf3b3('0x3e')]('\x0a');}logger[_0xf3b3('0x18')](_0xf3b3('0x40'),_0x5b3e5b);logger[_0xf3b3('0x18')]('googleASR\x20confidence',_0x4dab84);return{'transcript':_0x5b3e5b,'confidence':_0x4dab84};})['catch'](function(_0x4c1048){logger['error'](_0xf3b3('0x41'),_0x4c1048[_0xf3b3('0x12')],_0x4c1048['name'],_0x4c1048[_0xf3b3('0x42')]);});};exports['googleDialogflow']=function(_0x165e86,_0x3d3afb,_0x12e82a,_0x219a4f){var _0x623454=apiai(_0x3d3afb,{'language':_0x219a4f||'en'});return _0x623454[_0xf3b3('0x43')](_0x12e82a,{'sessionId':md5(_0x165e86)})['then'](function(_0x33b3c5){logger[_0xf3b3('0x18')](JSON[_0xf3b3('0x44')](_0x33b3c5));return{'source':_0x33b3c5[_0xf3b3('0x45')]['source'],'resolvedQuery':_0x33b3c5[_0xf3b3('0x45')][_0xf3b3('0x46')],'action':_0x33b3c5[_0xf3b3('0x45')]['action'],'actionIncomplete':_0x33b3c5['result'][_0xf3b3('0x47')],'speech':_0x33b3c5[_0xf3b3('0x45')]['fulfillment'][_0xf3b3('0x48')],'score':_0x33b3c5[_0xf3b3('0x45')][_0xf3b3('0x49')],'statusCode':_0x33b3c5[_0xf3b3('0x4a')][_0xf3b3('0x4b')],'endConversation':_0x33b3c5['result'][_0xf3b3('0x4c')][_0xf3b3('0x4d')]||![],'isFallbackIntent':_0x33b3c5[_0xf3b3('0x45')][_0xf3b3('0x4c')][_0xf3b3('0x4e')]};});};exports[_0xf3b3('0x4f')]=function(_0x263d7c,_0x5ef094,_0x471348,_0x34d486){return tilde[_0xf3b3('0x38')](_0x263d7c,_0x5ef094,_0x471348,_0x34d486)[_0xf3b3('0x35')](function(_0x5be727){try{fs[_0xf3b3('0x1a')](_0x263d7c);}catch(_0x5e1190){logger['error'](_0x5e1190);}logger['info'](_0xf3b3('0x50'),_0x5be727[_0xf3b3('0x3d')]);logger[_0xf3b3('0x18')](_0xf3b3('0x51'),_0x5be727['confidence']);return _0x5be727;});};exports[_0xf3b3('0x52')]=function(_0x3ff3be,_0x25d57e,_0x10bfb2,_0x1c6a35,_0x433c69,_0x1447dd){var _0x443050=path[_0xf3b3('0x21')](__dirname,_0xf3b3('0x22'),rs['generate'](0x4)+'.mp3');var _0x181670;return aws[_0xf3b3('0x53')](_0x3ff3be,_0x25d57e,_0x10bfb2,_0x1c6a35,_0x433c69,_0x1447dd,_0x443050)['then'](function(){_0x181670=path[_0xf3b3('0x21')](__dirname,_0xf3b3('0x22'),rs['generate'](0x4)+_0xf3b3('0x24'));return convertFile(_0x443050,_0x181670);})[_0xf3b3('0x35')](function(){try{fs[_0xf3b3('0x1a')](_0x443050);fs[_0xf3b3('0x27')](_0x181670,_0xf3b3('0x34'));}catch(_0x5cd8fb){logger[_0xf3b3('0x13')](_0x5cd8fb);}return _0x181670[_0xf3b3('0x28')]('.')[0x0];});};exports[_0xf3b3('0x54')]=function(_0x4a0c91,_0x59a82a,_0x183c4a,_0x531eaf,_0x576343,_0xc32956){return aws['lex'](_0x4a0c91,_0x59a82a,_0x183c4a,_0x531eaf,_0x576343,_0xc32956)[_0xf3b3('0x35')](function(_0x40e0cf){logger[_0xf3b3('0x18')](JSON[_0xf3b3('0x44')](_0x40e0cf));return _0x40e0cf;});};exports[_0xf3b3('0x55')]=function(_0x369c09,_0x1356cd,_0x1c182d,_0xbebb1b){var _0x438bd9=util['format'](_0xf3b3('0x56'),ISPEECH_API,_0x369c09,encodeURIComponent(_0x1356cd),_0x1c182d,_0xbebb1b);var _0x134436=path['resolve'](__dirname,'tmp',rs[_0xf3b3('0x23')](0x4)+_0xf3b3('0x31'));var _0x605000;return downloadFile(_0x438bd9,_0x134436)[_0xf3b3('0x35')](function(){_0x605000=path[_0xf3b3('0x21')](__dirname,_0xf3b3('0x22'),rs[_0xf3b3('0x23')](0x4)+_0xf3b3('0x24'));return convertFile(_0x134436,_0x605000);})['then'](function(){try{fs['unlink'](_0x134436);fs[_0xf3b3('0x27')](_0x605000,_0xf3b3('0x34'));}catch(_0x14c016){logger[_0xf3b3('0x13')](_0x14c016);}return _0x605000[_0xf3b3('0x28')]('.')[0x0];});};exports['ispeechASR']=function(_0x28a523,_0x5bf5b0,_0x31da42,_0x3997f1){var _0x431f8e=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x5bf5b0,_0x31da42,base64Encode(_0x28a523),_0x3997f1?util[_0xf3b3('0x57')](_0xf3b3('0x58'),encodeURIComponent(_0x3997f1)):'freeform=3');return uploadFile(_0x431f8e)[_0xf3b3('0x35')](function(_0x5a05b3){return querystring[_0xf3b3('0x2')](_0x5a05b3);});};exports['sestekNDA']=function(_0x370780,_0x51e0f5){return sestek[_0xf3b3('0x59')](_0x370780,_0x51e0f5)['then'](function(_0x19a8f0){logger[_0xf3b3('0x18')](JSON['stringify'](_0x19a8f0));var _0x29f507={'speech':_0x19a8f0[_0xf3b3('0x5a')],'action':_0x19a8f0[_0xf3b3('0x5b')]?_0x19a8f0[_0xf3b3('0x5b')][_0xf3b3('0x5c')]:undefined,'actiondata':_0x19a8f0['channelData']?_0x19a8f0[_0xf3b3('0x5b')][_0xf3b3('0x5d')]:undefined};if(_0x19a8f0[_0xf3b3('0x5b')]&&_0x19a8f0[_0xf3b3('0x5b')][_0xf3b3('0x5e')]){return base64Decode(_0x19a8f0[_0xf3b3('0x5b')]['AudioFromTts'][_0xf3b3('0x5f')],path[_0xf3b3('0x21')](__dirname,_0xf3b3('0x22'),rs[_0xf3b3('0x23')](0x4)+_0xf3b3('0x24')))['then'](function(_0x40af31){_0x29f507[_0xf3b3('0x60')]=_0x40af31;return _0x29f507;});}return _0x29f507;});};exports[_0xf3b3('0x61')]=function(){return __dirname;}; \ No newline at end of file +var _0x3c66=['bluebird','randomstring','sox','request-promise','util','google-tts-api','./google','./aws','./sestek','../../../config/logger','agi','protocol','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','close','unlink','download\x20error','pipe','end','https:','host','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','.wav','base64','then','chmodSync','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','input','MP3','text:synthesize','generate','.mp3','from','audioContent','writeFile','googleTTS','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','code','metadata','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','parse','sestekNDA','nda','text','channelData','AudioFromTts','Data','dirName','path','http','https','url'];(function(_0x263bea,_0x50f6b7){var _0x327978=function(_0x5768a3){while(--_0x5768a3){_0x263bea['push'](_0x263bea['shift']());}};_0x327978(++_0x50f6b7);}(_0x3c66,0x131));var _0x63c6=function(_0x33532e,_0x3b7af8){_0x33532e=_0x33532e-0x0;var _0x309d4b=_0x3c66[_0x33532e];return _0x309d4b;};'use strict';var fs=require('fs');var path=require(_0x63c6('0x0'));var http=require(_0x63c6('0x1'));var https=require(_0x63c6('0x2'));var urlParse=require(_0x63c6('0x3'))['parse'];var BPromise=require(_0x63c6('0x4'));var rs=require(_0x63c6('0x5'));var sox=require(_0x63c6('0x6'));var rp=require(_0x63c6('0x7'));var util=require(_0x63c6('0x8'));var querystring=require('querystring');var tts=require(_0x63c6('0x9'));var apiai=require('apiai-promise');var md5=require('md5');var google=require(_0x63c6('0xa'));var aws=require(_0x63c6('0xb'));var tilde=require('./tilde');var sestek=require(_0x63c6('0xc'));var logger=require(_0x63c6('0xd'))(_0x63c6('0xe'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x48dde5,_0x4bb094){return new BPromise(function(_0xfa7814,_0x5637fd){var _0x40ccb0=urlParse(_0x48dde5);var _0x2e2b82=_0x40ccb0[_0x63c6('0xf')]==='https:'?https:http;var _0x24bc0e={'host':_0x40ccb0['host'],'path':_0x40ccb0[_0x63c6('0x0')],'headers':{'user-agent':_0x63c6('0x10')}};_0x2e2b82[_0x63c6('0x11')](_0x24bc0e,function(_0x295e7d){if(_0x295e7d[_0x63c6('0x12')]!==0xc8){logger[_0x63c6('0x13')](_0x63c6('0x14')+_0x48dde5+_0x63c6('0x15')+_0x295e7d[_0x63c6('0x12')]+'\x20('+_0x295e7d[_0x63c6('0x16')]+')');_0x5637fd(new Error(_0x63c6('0x14')+_0x48dde5+_0x63c6('0x15')+_0x295e7d[_0x63c6('0x12')]+'\x20('+_0x295e7d['statusMessage']+')'));return;}var _0x45414a=fs[_0x63c6('0x17')](_0x4bb094);_0x45414a['on'](_0x63c6('0x18'),function(){logger[_0x63c6('0x19')]('finish\x20download\x20file');_0x45414a[_0x63c6('0x1a')](_0xfa7814);});_0x45414a['on'](_0x63c6('0x13'),function(_0x2e6279){fs[_0x63c6('0x1b')](_0x4bb094);logger[_0x63c6('0x13')](_0x63c6('0x1c'),_0x2e6279);_0x5637fd(_0x2e6279);});_0x295e7d[_0x63c6('0x1d')](_0x45414a);})['on'](_0x63c6('0x13'),function(_0x4eac4f){logger[_0x63c6('0x13')](_0x4eac4f);_0x5637fd(_0x4eac4f);})[_0x63c6('0x1e')]();});}function uploadFile(_0x39316c){return new BPromise(function(_0x1c8ae2,_0x2272fa){var _0x52f372=urlParse(_0x39316c);var _0x54ae67=_0x52f372[_0x63c6('0xf')]===_0x63c6('0x1f')?https:http;var _0x123e84={'host':_0x52f372[_0x63c6('0x20')],'path':_0x52f372[_0x63c6('0x0')],'headers':{'user-agent':_0x63c6('0x10')}};_0x54ae67['get'](_0x123e84,function(_0x308624){if(_0x308624[_0x63c6('0x12')]!==0xc8){_0x2272fa(new Error('request\x20to\x20'+_0x39316c+'\x20failed,\x20status\x20code\x20=\x20'+_0x308624[_0x63c6('0x12')]+'\x20('+_0x308624[_0x63c6('0x16')]+')'));return;}var _0x5e7699='';_0x308624['on']('data',function(_0x361c58){_0x5e7699+=_0x361c58;});_0x308624['on'](_0x63c6('0x1e'),function(){_0x1c8ae2(_0x5e7699);});})['on'](_0x63c6('0x13'),function(_0x4ced5b){_0x2272fa(_0x4ced5b);})[_0x63c6('0x1e')]();});}function convertFile(_0x1e8683,_0x1cea98){return new BPromise(function(_0x10d429,_0x121471){var _0x4b7759=sox['transcode'](_0x1e8683,_0x1cea98,{'sampleRate':0x1f40,'format':_0x63c6('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4b7759['on']('error',function(_0x5ed6f7){logger['error'](_0x63c6('0x22'),_0x5ed6f7);_0x121471(_0x5ed6f7);});_0x4b7759['on'](_0x63c6('0x1e'),function(){logger[_0x63c6('0x19')](_0x63c6('0x23'));_0x10d429();});_0x4b7759[_0x63c6('0x24')]();});}function base64Decode(_0x18e186,_0xd5ff78){var _0x1f791b=path[_0x63c6('0x25')](__dirname,_0x63c6('0x26'),rs['generate'](0x4)+_0x63c6('0x27'));fs['writeFileSync'](_0x1f791b,_0x18e186,_0x63c6('0x28'));return convertFile(_0x1f791b,_0xd5ff78)[_0x63c6('0x29')](function(){try{fs[_0x63c6('0x1b')](_0x1f791b);fs[_0x63c6('0x2a')](_0xd5ff78,_0x63c6('0x2b'));}catch(_0x150b29){logger[_0x63c6('0x13')](_0x150b29);}return _0xd5ff78[_0x63c6('0x2c')]('.')[0x0];});}function base64Encode(_0x41fa9d){var _0x28dda9=fs[_0x63c6('0x2d')](_0x41fa9d);return new Buffer(_0x28dda9)[_0x63c6('0x2e')](_0x63c6('0x28'));}exports['googleCloudTTS']=function(_0x23ab41,_0x122184,_0x21b150,_0x51733f,_0x5bdd05,_0x3f8be0){var _0x3890c1,_0x23bc23;var _0x1899e2=_0x63c6('0x2f');var _0xfc9094=_0x63c6('0x30')+_0x23ab41;var _0x68179f={};if(_0x122184==='ssml'){_0x68179f[_0x63c6('0x31')]={'ssml':_0x21b150};}else{_0x68179f[_0x63c6('0x31')]={'text':_0x21b150};};_0x68179f['voice']={'languageCode':_0x51733f,'ssmlGender':_0x5bdd05};_0x68179f['audioConfig']={'audioEncoding':_0x63c6('0x32'),'sampleRateHertz':0x1f40};var _0x5c50aa={'url':_0x1899e2+_0x63c6('0x33')+_0xfc9094,'method':'POST','json':!![],'body':_0x68179f};return rp(_0x5c50aa)[_0x63c6('0x29')](function(_0xdfcb6d){return new BPromise(function(_0x4ae671,_0x2f502e){_0x3890c1=path['resolve'](__dirname,_0x63c6('0x26'),rs[_0x63c6('0x34')](0x4)+_0x63c6('0x35'));var _0x3fc834=Buffer[_0x63c6('0x36')](_0xdfcb6d[_0x63c6('0x37')],_0x63c6('0x28'));return fs[_0x63c6('0x38')](_0x3890c1,_0x3fc834,function(_0xff386f){_0x2f502e(_0xff386f);},function(_0x5af8f3){fs[_0x63c6('0x2a')](_0x3890c1,_0x63c6('0x2b'));_0x4ae671(_0x5af8f3);});});})[_0x63c6('0x29')](function(_0x50fc29){_0x23bc23=path[_0x63c6('0x25')](__dirname,'tmp',rs[_0x63c6('0x34')](0x4)+_0x63c6('0x27'));return convertFile(_0x3890c1,_0x23bc23);})[_0x63c6('0x29')](function(){try{fs[_0x63c6('0x1b')](_0x3890c1);fs[_0x63c6('0x2a')](_0x23bc23,'777');}catch(_0x4c6ff3){logger['error'](_0x4c6ff3);}logger[_0x63c6('0x19')]('googleCloudTTS\x20path',_0x23bc23[_0x63c6('0x2c')]('.')[0x0]);return _0x23bc23['split']('.')[0x0];});};exports[_0x63c6('0x39')]=function(_0x36a0e1,_0x21a195){var _0x1c39b5,_0x30235d;return tts(_0x36a0e1,_0x21a195||'en',0x1)[_0x63c6('0x29')](function(_0xf01651){logger['info'](_0xf01651);_0x1c39b5=path[_0x63c6('0x25')](__dirname,'tmp',rs[_0x63c6('0x34')](0x4)+_0x63c6('0x35'));return downloadFile(_0xf01651,_0x1c39b5);})[_0x63c6('0x29')](function(){_0x30235d=path[_0x63c6('0x25')](__dirname,'tmp',rs[_0x63c6('0x34')](0x4)+_0x63c6('0x27'));return convertFile(_0x1c39b5,_0x30235d);})['then'](function(){try{fs[_0x63c6('0x1b')](_0x1c39b5);fs['chmodSync'](_0x30235d,_0x63c6('0x2b'));}catch(_0x239f7c){logger[_0x63c6('0x13')](_0x239f7c);}logger['info'](_0x63c6('0x3a'),_0x30235d[_0x63c6('0x2c')]('.')[0x0]);return _0x30235d[_0x63c6('0x2c')]('.')[0x0];});};exports[_0x63c6('0x3b')]=function(_0x44dada,_0x4c5b59,_0x535dc8){return google[_0x63c6('0x3c')](_0x44dada,_0x4c5b59,_0x535dc8)['then'](function(_0xeb9a4){logger[_0x63c6('0x19')](_0xeb9a4[_0x63c6('0x3d')]);return rp(_0xeb9a4);})['then'](function(_0x58a47c){var _0x2de8a5='';var _0xad0a0c=0x0;try{fs[_0x63c6('0x1b')](_0x44dada);}catch(_0x3b017b){logger[_0x63c6('0x13')](_0x3b017b);}if(_0x58a47c&&_0x58a47c[_0x63c6('0x3e')]){_0x2de8a5=_0x58a47c[_0x63c6('0x3e')][_0x63c6('0x3f')](function(_0x229de6){return _0x229de6&&_0x229de6['alternatives'][0x0]&&_0x229de6[_0x63c6('0x40')][0x0][_0x63c6('0x41')]?_0x229de6[_0x63c6('0x40')][0x0]['transcript']:'';})[_0x63c6('0x42')]('\x0a');_0xad0a0c=_0x58a47c[_0x63c6('0x3e')][_0x63c6('0x3f')](function(_0x107a37){return _0x107a37&&_0x107a37[_0x63c6('0x40')][0x0]&&_0x107a37[_0x63c6('0x40')][0x0][_0x63c6('0x43')]?_0x107a37['alternatives'][0x0]['confidence']:0x0;})['join']('\x0a');}logger['info']('googleASR\x20transcription',_0x2de8a5);logger[_0x63c6('0x19')]('googleASR\x20confidence',_0xad0a0c);return{'transcript':_0x2de8a5,'confidence':_0xad0a0c};})[_0x63c6('0x44')](function(_0x44bd2b){logger[_0x63c6('0x13')](_0x63c6('0x45'),_0x44bd2b[_0x63c6('0x12')],_0x44bd2b['name'],_0x44bd2b[_0x63c6('0x46')]);});};exports[_0x63c6('0x47')]=function(_0x4e2c96,_0x472eaf,_0x2f2df6,_0x42f02d){var _0x565b86=apiai(_0x472eaf,{'language':_0x42f02d||'en'});return _0x565b86[_0x63c6('0x48')](_0x2f2df6,{'sessionId':md5(_0x4e2c96)})[_0x63c6('0x29')](function(_0x52effa){logger[_0x63c6('0x19')](JSON[_0x63c6('0x49')](_0x52effa));return{'source':_0x52effa[_0x63c6('0x4a')][_0x63c6('0x4b')],'resolvedQuery':_0x52effa[_0x63c6('0x4a')][_0x63c6('0x4c')],'action':_0x52effa[_0x63c6('0x4a')]['action'],'actionIncomplete':_0x52effa[_0x63c6('0x4a')][_0x63c6('0x4d')],'speech':_0x52effa['result'][_0x63c6('0x4e')][_0x63c6('0x4f')],'score':_0x52effa[_0x63c6('0x4a')][_0x63c6('0x50')],'statusCode':_0x52effa[_0x63c6('0x51')][_0x63c6('0x52')],'endConversation':_0x52effa['result'][_0x63c6('0x53')]['endConversation']||![],'isFallbackIntent':_0x52effa[_0x63c6('0x4a')][_0x63c6('0x53')]['isFallbackIntent']};});};exports[_0x63c6('0x54')]=function(_0x48c5d2,_0x55b758,_0x277cd1,_0x1e1c22){return tilde[_0x63c6('0x3c')](_0x48c5d2,_0x55b758,_0x277cd1,_0x1e1c22)[_0x63c6('0x29')](function(_0x2be4e7){try{fs['unlink'](_0x48c5d2);}catch(_0xa6e77f){logger[_0x63c6('0x13')](_0xa6e77f);}logger[_0x63c6('0x19')](_0x63c6('0x55'),_0x2be4e7['transcript']);logger[_0x63c6('0x19')](_0x63c6('0x56'),_0x2be4e7[_0x63c6('0x43')]);return _0x2be4e7;});};exports[_0x63c6('0x57')]=function(_0x23738d,_0x41b511,_0x5b95d3,_0x1cb5f6,_0x223159,_0xa46e6){var _0x4ee55a=path[_0x63c6('0x25')](__dirname,_0x63c6('0x26'),rs[_0x63c6('0x34')](0x4)+_0x63c6('0x35'));var _0x33fcf8;return aws[_0x63c6('0x58')](_0x23738d,_0x41b511,_0x5b95d3,_0x1cb5f6,_0x223159,_0xa46e6,_0x4ee55a)[_0x63c6('0x29')](function(){_0x33fcf8=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x63c6('0x27'));return convertFile(_0x4ee55a,_0x33fcf8);})[_0x63c6('0x29')](function(){try{fs['unlink'](_0x4ee55a);fs[_0x63c6('0x2a')](_0x33fcf8,_0x63c6('0x2b'));}catch(_0x4f47ec){logger[_0x63c6('0x13')](_0x4f47ec);}return _0x33fcf8[_0x63c6('0x2c')]('.')[0x0];});};exports['awsLex']=function(_0x4e9bd2,_0x1001fb,_0xec6e8b,_0x3f60ec,_0x1ff321,_0xac4a){return aws['lex'](_0x4e9bd2,_0x1001fb,_0xec6e8b,_0x3f60ec,_0x1ff321,_0xac4a)['then'](function(_0x292697){logger[_0x63c6('0x19')](JSON['stringify'](_0x292697));return _0x292697;});};exports[_0x63c6('0x59')]=function(_0x1cb8e5,_0x89205d,_0x2246c4,_0x1646f0){var _0xf4d62e=util[_0x63c6('0x5a')](_0x63c6('0x5b'),ISPEECH_API,_0x1cb8e5,encodeURIComponent(_0x89205d),_0x2246c4,_0x1646f0);var _0x1fc299=path[_0x63c6('0x25')](__dirname,'tmp',rs[_0x63c6('0x34')](0x4)+'.mp3');var _0x404127;return downloadFile(_0xf4d62e,_0x1fc299)[_0x63c6('0x29')](function(){_0x404127=path[_0x63c6('0x25')](__dirname,'tmp',rs[_0x63c6('0x34')](0x4)+_0x63c6('0x27'));return convertFile(_0x1fc299,_0x404127);})['then'](function(){try{fs['unlink'](_0x1fc299);fs[_0x63c6('0x2a')](_0x404127,'777');}catch(_0xb2c886){logger[_0x63c6('0x13')](_0xb2c886);}return _0x404127[_0x63c6('0x2c')]('.')[0x0];});};exports[_0x63c6('0x5c')]=function(_0x3db84f,_0x1eb24d,_0x2fdf57,_0x2b67b9){var _0x209ba6=util[_0x63c6('0x5a')](_0x63c6('0x5d'),ISPEECH_API,_0x1eb24d,_0x2fdf57,base64Encode(_0x3db84f),_0x2b67b9?util['format'](_0x63c6('0x5e'),encodeURIComponent(_0x2b67b9)):'freeform=3');return uploadFile(_0x209ba6)[_0x63c6('0x29')](function(_0x157f6c){return querystring[_0x63c6('0x5f')](_0x157f6c);});};exports[_0x63c6('0x60')]=function(_0x453939,_0x21de50){return sestek[_0x63c6('0x61')](_0x453939,_0x21de50)[_0x63c6('0x29')](function(_0x242e5f){logger[_0x63c6('0x19')](JSON[_0x63c6('0x49')](_0x242e5f));var _0x326424={'speech':_0x242e5f[_0x63c6('0x62')],'action':_0x242e5f[_0x63c6('0x63')]?_0x242e5f['channelData']['CustomAction']:undefined,'actiondata':_0x242e5f[_0x63c6('0x63')]?_0x242e5f[_0x63c6('0x63')]['CustomActionData']:undefined};if(_0x242e5f[_0x63c6('0x63')]&&_0x242e5f[_0x63c6('0x63')]['AudioFromTts']){return base64Decode(_0x242e5f[_0x63c6('0x63')][_0x63c6('0x64')][_0x63c6('0x65')],path['resolve'](__dirname,_0x63c6('0x26'),rs[_0x63c6('0x34')](0x4)+'.wav'))[_0x63c6('0x29')](function(_0x27f017){_0x326424['audiofile']=_0x27f017;return _0x326424;});}return _0x326424;});};exports[_0x63c6('0x66')]=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 79041bf..c92e231 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 _0x2269=['./nda'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x2269,0xf5));var _0x9226=function(_0x3a629d,_0x437281){_0x3a629d=_0x3a629d-0x0;var _0x44dd7d=_0x2269[_0x3a629d];return _0x44dd7d;};var nda=require(_0x9226('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0xda44=['./nda','exports'];(function(_0x12f570,_0x2bdad1){var _0x820efc=function(_0xb209d7){while(--_0xb209d7){_0x12f570['push'](_0x12f570['shift']());}};_0x820efc(++_0x2bdad1);}(_0xda44,0x190));var _0x4da4=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xda44[_0xf50820];return _0x2a9b10;};var nda=require(_0x4da4('0x0'));module[_0x4da4('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 9a83b66..51f3844 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 _0x3a1b=['uniqueid','callerid','extension','text','Bearer\x20','project','body','channelData','ProjectName','ndagenerate_audio','custom_action','CustomAction','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','ndauth_url','/token','password','username','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message'];(function(_0x2453d0,_0x1b2017){var _0x521fc8=function(_0xfc824f){while(--_0xfc824f){_0x2453d0['push'](_0x2453d0['shift']());}};_0x521fc8(++_0x1b2017);}(_0x3a1b,0x8b));var _0xb3a1=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x3a1b[_0x4b055c];return _0x4b62bb;};'use strict';var rp=require(_0xb3a1('0x0'));var url=require(_0xb3a1('0x1'));var logger=require(_0xb3a1('0x2'))(_0xb3a1('0x3'));module[_0xb3a1('0x4')]=function(_0x5cfdbe,_0x5a994c){var _0x15fa50={'method':_0xb3a1('0x5'),'uri':url['resolve'](_0x5a994c[_0xb3a1('0x6')],_0xb3a1('0x7')),'form':{'grant_type':_0xb3a1('0x8'),'username':_0x5a994c[_0xb3a1('0x9')],'password':_0x5a994c[_0xb3a1('0x8')]},'json':!![]};return rp(_0x15fa50)[_0xb3a1('0xa')](function(_0x5f5d70){var _0x3f3173={'method':_0xb3a1('0x5'),'uri':url[_0xb3a1('0xb')](_0x5a994c[_0xb3a1('0xc')],_0xb3a1('0xd')),'body':{'type':_0x5a994c[_0xb3a1('0xe')]||_0xb3a1('0xf'),'channelId':'Nda','conversation':{'id':_0x5cfdbe[_0xb3a1('0x10')]},'from':{'id':_0x5cfdbe[_0xb3a1('0x11')],'name':_0x5cfdbe['calleridname']},'recipient':{'id':_0x5cfdbe['dnid'],'name':_0x5cfdbe[_0xb3a1('0x12')]},'text':_0x5a994c[_0xb3a1('0x13')],'channelData':{}},'headers':{'Authorization':_0xb3a1('0x14')+_0x5f5d70['access_token']},'json':!![]};if(_0x5a994c[_0xb3a1('0x15')]){_0x3f3173[_0xb3a1('0x16')][_0xb3a1('0x17')][_0xb3a1('0x18')]=_0x5a994c[_0xb3a1('0x15')];}if(_0x5a994c[_0xb3a1('0x19')]=='1'){_0x3f3173[_0xb3a1('0x16')]['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x5a994c[_0xb3a1('0x1a')]){_0x3f3173['body'][_0xb3a1('0x17')][_0xb3a1('0x1b')]=_0x5a994c[_0xb3a1('0x1a')];if(_0x5a994c['custom_action_data']){_0x3f3173[_0xb3a1('0x16')][_0xb3a1('0x17')][_0xb3a1('0x1c')]=_0x5a994c['custom_action_data'];}}logger[_0xb3a1('0x1d')](JSON[_0xb3a1('0x1e')](_0x3f3173));return rp(_0x3f3173);});}; \ No newline at end of file +var _0x236b=['extension','text','Bearer\x20','access_token','project','ProjectName','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','body','custom_action','CustomActionData','custom_action_data','stringify','request-promise','url','../../../../../config/logger','agi','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','ndaactivity_type','Nda','uniqueid','callerid','calleridname','dnid'];(function(_0x27bbf8,_0x137d54){var _0x49b87d=function(_0x4c4b81){while(--_0x4c4b81){_0x27bbf8['push'](_0x27bbf8['shift']());}};_0x49b87d(++_0x137d54);}(_0x236b,0x93));var _0xb236=function(_0x156492,_0x1a1901){_0x156492=_0x156492-0x0;var _0x3635cb=_0x236b[_0x156492];return _0x3635cb;};'use strict';var rp=require(_0xb236('0x0'));var url=require(_0xb236('0x1'));var logger=require(_0xb236('0x2'))(_0xb236('0x3'));module['exports']=function(_0x321aa9,_0x3ec8e0){var _0x425600={'method':_0xb236('0x4'),'uri':url[_0xb236('0x5')](_0x3ec8e0[_0xb236('0x6')],_0xb236('0x7')),'form':{'grant_type':_0xb236('0x8'),'username':_0x3ec8e0[_0xb236('0x9')],'password':_0x3ec8e0[_0xb236('0x8')]},'json':!![]};return rp(_0x425600)[_0xb236('0xa')](function(_0x257768){var _0x41bca1={'method':_0xb236('0x4'),'uri':url[_0xb236('0x5')](_0x3ec8e0[_0xb236('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x3ec8e0[_0xb236('0xc')]||'message','channelId':_0xb236('0xd'),'conversation':{'id':_0x321aa9[_0xb236('0xe')]},'from':{'id':_0x321aa9[_0xb236('0xf')],'name':_0x321aa9[_0xb236('0x10')]},'recipient':{'id':_0x321aa9[_0xb236('0x11')],'name':_0x321aa9[_0xb236('0x12')]},'text':_0x3ec8e0[_0xb236('0x13')],'channelData':{}},'headers':{'Authorization':_0xb236('0x14')+_0x257768[_0xb236('0x15')]},'json':!![]};if(_0x3ec8e0[_0xb236('0x16')]){_0x41bca1['body']['channelData'][_0xb236('0x17')]=_0x3ec8e0[_0xb236('0x16')];}if(_0x3ec8e0[_0xb236('0x18')]=='1'){_0x41bca1['body'][_0xb236('0x19')][_0xb236('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xb236('0x1b')};}if(_0x3ec8e0['custom_action']){_0x41bca1[_0xb236('0x1c')]['channelData']['CustomAction']=_0x3ec8e0[_0xb236('0x1d')];if(_0x3ec8e0['custom_action_data']){_0x41bca1[_0xb236('0x1c')][_0xb236('0x19')][_0xb236('0x1e')]=_0x3ec8e0[_0xb236('0x1f')];}}logger['info'](JSON[_0xb236('0x20')](_0x41bca1));return rp(_0x41bca1);});}; \ 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 7e9526f..3027dc2 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 _0xf04e=['exports'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xf04e,0x1ca));var _0xef04=function(_0x4b3eb7,_0x75a015){_0x4b3eb7=_0x4b3eb7-0x0;var _0x136d7b=_0xf04e[_0x4b3eb7];return _0x136d7b;};'use strict';var asr=require('./lib/api');module[_0xef04('0x0')]=function(_0x79b504,_0x5bd558,_0x479ffe,_0x28b416){return asr(_0x79b504,_0x5bd558,_0x479ffe,_0x28b416);}; \ No newline at end of file +var _0x78b3=['exports','./lib/api'];(function(_0x2a1ff7,_0x4b7709){var _0x4559d0=function(_0x304d6b){while(--_0x304d6b){_0x2a1ff7['push'](_0x2a1ff7['shift']());}};_0x4559d0(++_0x4b7709);}(_0x78b3,0x1b3));var _0x378b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x78b3[_0x321bb2];return _0x9c12ed;};'use strict';var asr=require(_0x378b('0x0'));module[_0x378b('0x1')]=function(_0xa91ae3,_0x541740,_0x101907,_0x216c6c){return asr(_0xa91ae3,_0x541740,_0x101907,_0x216c6c);}; \ 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 00a885e..8d086bc 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 _0x5764=['error','Tilde\x20ASR\x20send\x20error','status','result','final','hypotheses','transcript','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','digest','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x5764,0x132));var _0x4576=function(_0x287bfe,_0x2e9bdb){_0x287bfe=_0x287bfe-0x0;var _0x500a95=_0x5764[_0x287bfe];return _0x500a95;};'use strict';var BPromise=require(_0x4576('0x0'));var _=require(_0x4576('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x4576('0x2'));var crypto=require(_0x4576('0x3'));var logger=require(_0x4576('0x4'))(_0x4576('0x5'));module[_0x4576('0x6')]=function(_0x46c451,_0x5230e1,_0x29a706,_0x4fb569){return new BPromise(function(_0xb58937,_0xd12f73){logger['info'](_0x4576('0x7'),_0x4fb569||_0x4576('0x8'));var _0x36c700=new WebSocket(_0x4fb569||_0x4576('0x8'),{'perMessageDeflate':![]});var _0x45bbe2='';var _0x53a3de='0';var _0x325b25='1';var _0x444ffe=_0x4576('0x9');function _0x5d60f3(_0x57e834){var _0x466ef5=crypto['createHash'](_0x4576('0xa'));_0x466ef5['update'](_0x57e834);return _0x466ef5[_0x4576('0xb')](_0x4576('0xc'));}function _0x6d1170(){try{logger[_0x4576('0xd')](_0x4576('0xe'));var _0x1ca466=moment()[_0x4576('0xf')]();var _0x388ff9=_0x5d60f3(_0x1ca466+_0x5230e1+_0x29a706);_0x36c700[_0x4576('0x10')](JSON[_0x4576('0x11')]({'appID':_0x5230e1,'timestamp':_0x1ca466,'appKey':_0x388ff9}));var _0x20c4c5=fs[_0x4576('0x12')](_0x46c451);_0x20c4c5['on'](_0x4576('0x13'),function(_0x4743d9){_0x36c700[_0x4576('0x10')](_0x4743d9);});_0x20c4c5['on'](_0x4576('0x14'),function(){_0x36c700[_0x4576('0x10')](_0x4576('0x15'));});}catch(_0x1ffd58){logger[_0x4576('0x16')](_0x4576('0x17'),JSON['stringify'](_0x1ffd58));_0x36c700['terminate']();}}function _0x436735(_0x2b78bf){try{if(_0x2b78bf){var _0x32ebcb=JSON['parse'](_0x2b78bf);switch(_0x32ebcb[_0x4576('0x18')]){case 0x0:if(_0x32ebcb[_0x4576('0x19')]){if(_0x32ebcb['result'][_0x4576('0x1a')]){logger[_0x4576('0xd')]('Tilde\x20ASR\x20hypoteses',JSON[_0x4576('0x11')](_0x32ebcb[_0x4576('0x19')][_0x4576('0x1b')]));_0x45bbe2=_0x32ebcb['result']['hypotheses'][0x0][_0x4576('0x1c')];_0x53a3de=_0x32ebcb['result'][_0x4576('0x1b')][0x0][_0x4576('0x1d')];_0x325b25='0';_0x444ffe=_0x4576('0x1e');_0x36c700[_0x4576('0x1f')]();}}break;case 0x1:logger[_0x4576('0xd')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x325b25='1';_0x444ffe=_0x4576('0x9');break;case 0x2:logger[_0x4576('0xd')](_0x4576('0x20'));_0x325b25='2';_0x444ffe=_0x4576('0x20');break;case 0x9:logger[_0x4576('0xd')](_0x4576('0x21'));_0x325b25='9';_0x444ffe=_0x4576('0x21');break;case 0xa:logger[_0x4576('0xd')](_0x4576('0x22'));_0x325b25='10';_0x444ffe=_0x4576('0x22');break;case 0xb:logger[_0x4576('0xd')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x325b25='11';_0x444ffe=_0x4576('0x23');}}}catch(_0x2eebfb){logger[_0x4576('0x16')](_0x4576('0x24'),JSON[_0x4576('0x11')](_0x2eebfb));_0x36c700[_0x4576('0x1f')]();}}function _0x3c05f0(){logger[_0x4576('0xd')](_0x4576('0x25'));_0xb58937({'transcript':_0x45bbe2,'confidence':_0x53a3de,'status':_0x325b25,'status_message':_0x444ffe});}function _0x391fda(_0x1ada64){logger['error'](_0x4576('0x26'));if(!_['isNil'](_0x1ada64)){logger[_0x4576('0x16')](_[_0x4576('0x27')](_0x1ada64)?JSON[_0x4576('0x11')](_0x1ada64):_0x1ada64);}}_0x36c700['on']('open',_0x6d1170);_0x36c700['on'](_0x4576('0x28'),_0x436735);_0x36c700['on'](_0x4576('0x14'),_0x3c05f0);_0x36c700['on'](_0x4576('0x16'),_0x391fda);});}; \ No newline at end of file +var _0x4fc3=['bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','createHash','sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','message'];(function(_0x1ebd10,_0x4914b4){var _0x1004d3=function(_0x59e3ba){while(--_0x59e3ba){_0x1ebd10['push'](_0x1ebd10['shift']());}};_0x1004d3(++_0x4914b4);}(_0x4fc3,0xa0));var _0x34fc=function(_0x2808ed,_0x65e79e){_0x2808ed=_0x2808ed-0x0;var _0x292ca0=_0x4fc3[_0x2808ed];return _0x292ca0;};'use strict';var BPromise=require(_0x34fc('0x0'));var _=require(_0x34fc('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x34fc('0x2'));var crypto=require(_0x34fc('0x3'));var logger=require(_0x34fc('0x4'))(_0x34fc('0x5'));module[_0x34fc('0x6')]=function(_0x2930a5,_0x694afd,_0x3f0d88,_0x3274f4){return new BPromise(function(_0x24837d,_0x24e194){logger[_0x34fc('0x7')](_0x34fc('0x8'),_0x3274f4||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x31b7d7=new WebSocket(_0x3274f4||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x58370a='';var _0xfc4198='0';var _0x5af6cb='1';var _0x418226='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x282a4e(_0x20c03d){var _0x14de72=crypto[_0x34fc('0x9')](_0x34fc('0xa'));_0x14de72['update'](_0x20c03d);return _0x14de72[_0x34fc('0xb')](_0x34fc('0xc'));}function _0x18f219(){try{logger[_0x34fc('0x7')](_0x34fc('0xd'));var _0x1d7ea0=moment()[_0x34fc('0xe')]();var _0x29e0ce=_0x282a4e(_0x1d7ea0+_0x694afd+_0x3f0d88);_0x31b7d7[_0x34fc('0xf')](JSON[_0x34fc('0x10')]({'appID':_0x694afd,'timestamp':_0x1d7ea0,'appKey':_0x29e0ce}));var _0x9f4ceb=fs[_0x34fc('0x11')](_0x2930a5);_0x9f4ceb['on'](_0x34fc('0x12'),function(_0x4c3fb9){_0x31b7d7[_0x34fc('0xf')](_0x4c3fb9);});_0x9f4ceb['on'](_0x34fc('0x13'),function(){_0x31b7d7[_0x34fc('0xf')](_0x34fc('0x14'));});}catch(_0x238818){logger[_0x34fc('0x15')](_0x34fc('0x16'),JSON[_0x34fc('0x10')](_0x238818));_0x31b7d7[_0x34fc('0x17')]();}}function _0x40b38a(_0x4a82a9){try{if(_0x4a82a9){var _0xa44630=JSON[_0x34fc('0x18')](_0x4a82a9);switch(_0xa44630['status']){case 0x0:if(_0xa44630['result']){if(_0xa44630[_0x34fc('0x19')][_0x34fc('0x1a')]){logger[_0x34fc('0x7')](_0x34fc('0x1b'),JSON[_0x34fc('0x10')](_0xa44630[_0x34fc('0x19')][_0x34fc('0x1c')]));_0x58370a=_0xa44630['result'][_0x34fc('0x1c')][0x0][_0x34fc('0x1d')];_0xfc4198=_0xa44630['result'][_0x34fc('0x1c')][0x0][_0x34fc('0x1e')];_0x5af6cb='0';_0x418226=_0x34fc('0x1f');_0x31b7d7['terminate']();}}break;case 0x1:logger[_0x34fc('0x7')](_0x34fc('0x20'));_0x5af6cb='1';_0x418226=_0x34fc('0x20');break;case 0x2:logger[_0x34fc('0x7')](_0x34fc('0x21'));_0x5af6cb='2';_0x418226=_0x34fc('0x21');break;case 0x9:logger[_0x34fc('0x7')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x5af6cb='9';_0x418226=_0x34fc('0x22');break;case 0xa:logger[_0x34fc('0x7')](_0x34fc('0x23'));_0x5af6cb='10';_0x418226=_0x34fc('0x23');break;case 0xb:logger[_0x34fc('0x7')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x5af6cb='11';_0x418226='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x569fd4){logger['error'](_0x34fc('0x24'),JSON['stringify'](_0x569fd4));_0x31b7d7['terminate']();}}function _0x1955a7(){logger[_0x34fc('0x7')]('Close\x20Tilde\x20ASR\x20socket');_0x24837d({'transcript':_0x58370a,'confidence':_0xfc4198,'status':_0x5af6cb,'status_message':_0x418226});}function _0x50b055(_0x11a153){logger[_0x34fc('0x15')](_0x34fc('0x25'));if(!_[_0x34fc('0x26')](_0x11a153)){logger[_0x34fc('0x15')](_['isObject'](_0x11a153)?JSON['stringify'](_0x11a153):_0x11a153);}}_0x31b7d7['on']('open',_0x18f219);_0x31b7d7['on'](_0x34fc('0x27'),_0x40b38a);_0x31b7d7['on'](_0x34fc('0x13'),_0x1955a7);_0x31b7d7['on'](_0x34fc('0x15'),_0x50b055);});}; \ 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 3369504..a95a40b 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 _0xd6bc=['./asr','exports'];(function(_0x7b58ff,_0x287e66){var _0x5898a1=function(_0x2f85e4){while(--_0x2f85e4){_0x7b58ff['push'](_0x7b58ff['shift']());}};_0x5898a1(++_0x287e66);}(_0xd6bc,0x1a0));var _0xcd6b=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xd6bc[_0x5f0089];return _0x193892;};var asr=require(_0xcd6b('0x0'));module[_0xcd6b('0x1')]={'asr':asr}; \ No newline at end of file +var _0x8cc2=['./asr','exports'];(function(_0x2419b8,_0x22f7e6){var _0x388b04=function(_0x118741){while(--_0x118741){_0x2419b8['push'](_0x2419b8['shift']());}};_0x388b04(++_0x22f7e6);}(_0x8cc2,0x1d8));var _0x28cc=function(_0x52d77b,_0x2b2574){_0x52d77b=_0x52d77b-0x0;var _0x2200cb=_0x8cc2[_0x52d77b];return _0x2200cb;};var asr=require(_0x28cc('0x0'));module[_0x28cc('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 177f670..ddb1132 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 _0xdf0c=['getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','util','events','EventEmitter','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listening','connection'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xdf0c,0x1ab));var _0xcdf0=function(_0x3ed81d,_0x332882){_0x3ed81d=_0x3ed81d-0x0;var _0x3d4362=_0xdf0c[_0x3ed81d];return _0x3d4362;};'use strict';var util=require(_0xcdf0('0x0'));var net=require('net');var EventEmitter=require(_0xcdf0('0x1'))[_0xcdf0('0x2')];var AGIError=require(_0xcdf0('0x3'));var AGIChannel=require(_0xcdf0('0x4'));var AGIServer=function(_0x27f933,_0xcd76d6,_0x2917be){var _0x57a58c=this,_0x27f933=_0x27f933||0x11dd,_0xcd76d6=_0xcd76d6||_0xcdf0('0x5'),_0x5f4c9c=null,_0x3c97df=0x0;EventEmitter[_0xcdf0('0x6')](_0x57a58c);function _0x5b39b8(){if(!_0x27f933){_0x57a58c[_0xcdf0('0x7')](_0xcdf0('0x8'),new AGIError(_0xcdf0('0x9')));return![];}_0x5f4c9c=net[_0xcdf0('0xa')]();_0x5f4c9c['listen'](_0x27f933,_0xcd76d6);_0x5f4c9c['on'](_0xcdf0('0xb'),function(){_0x57a58c[_0xcdf0('0x7')](_0xcdf0('0xb'));});_0x5f4c9c['on'](_0xcdf0('0xc'),function(_0x5ef0af){_0x5f4c9c[_0xcdf0('0xd')](function(_0xc56fb0,_0x289a5b){if(_0xc56fb0){_0x57a58c[_0xcdf0('0x7')](_0xcdf0('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0xc56fb0));}else if(_0x2917be&&_0x2917be<0x0){_0x57a58c[_0xcdf0('0x7')](_0xcdf0('0x8'),new AGIError(_0xcdf0('0xe')));_0x5ef0af['destroy']();}else if(_0x2917be&&_0x2917be>0x0&&_0x2917be<_0x289a5b){_0x3c97df+=0x1;_0x57a58c[_0xcdf0('0x7')]('error',new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x3c97df));_0x5ef0af[_0xcdf0('0xf')]();}else{var _0x2c654c=new AGIChannel(_0x5ef0af);_0x2c654c['on']('ready',function(){_0x57a58c[_0xcdf0('0x7')](_0xcdf0('0xc'),_0x2c654c);});}});});_0x5f4c9c['on'](_0xcdf0('0x8'),function(_0x22acb4){_0x57a58c[_0xcdf0('0x7')](_0xcdf0('0x8'),new AGIError(_0xcdf0('0x10'),_0x22acb4[_0xcdf0('0x11')]));});_0x5f4c9c['on'](_0xcdf0('0x12'),function(){_0x57a58c[_0xcdf0('0x7')](_0xcdf0('0x12'),new AGIError(_0xcdf0('0x13')));});}process[_0xcdf0('0x14')](function(){_0x5b39b8();});};util[_0xcdf0('0x15')](AGIServer,EventEmitter);module['exports']=function(_0x38cd9d,_0x1cafa2,_0x5d74fb){return new AGIServer(_0x38cd9d,_0x1cafa2,_0x5d74fb);}; \ No newline at end of file +var _0xc125=['code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','net','EventEmitter','./error','./channel','127.0.0.1','emit','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','error','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','ready'];(function(_0x5226c9,_0x3193c8){var _0x491682=function(_0x34677b){while(--_0x34677b){_0x5226c9['push'](_0x5226c9['shift']());}};_0x491682(++_0x3193c8);}(_0xc125,0x150));var _0x5c12=function(_0x57119d,_0xe4d6e){_0x57119d=_0x57119d-0x0;var _0x4e1130=_0xc125[_0x57119d];return _0x4e1130;};'use strict';var util=require('util');var net=require(_0x5c12('0x0'));var EventEmitter=require('events')[_0x5c12('0x1')];var AGIError=require(_0x5c12('0x2'));var AGIChannel=require(_0x5c12('0x3'));var AGIServer=function(_0x2423dc,_0x1c16af,_0x46f293){var _0x31bd53=this,_0x2423dc=_0x2423dc||0x11dd,_0x1c16af=_0x1c16af||_0x5c12('0x4'),_0x3f1c8b=null,_0x1a1608=0x0;EventEmitter['call'](_0x31bd53);function _0x1d0635(){if(!_0x2423dc){_0x31bd53[_0x5c12('0x5')]('error',new AGIError(_0x5c12('0x6')));return![];}_0x3f1c8b=net[_0x5c12('0x7')]();_0x3f1c8b[_0x5c12('0x8')](_0x2423dc,_0x1c16af);_0x3f1c8b['on'](_0x5c12('0x9'),function(){_0x31bd53[_0x5c12('0x5')](_0x5c12('0x9'));});_0x3f1c8b['on'](_0x5c12('0xa'),function(_0x9e0245){_0x3f1c8b['getConnections'](function(_0x1ac250,_0x348029){if(_0x1ac250){_0x31bd53[_0x5c12('0x5')](_0x5c12('0xb'),new AGIError(_0x5c12('0xc'),_0x1ac250));}else if(_0x46f293&&_0x46f293<0x0){_0x31bd53['emit']('error',new AGIError(_0x5c12('0xd')));_0x9e0245['destroy']();}else if(_0x46f293&&_0x46f293>0x0&&_0x46f293<_0x348029){_0x1a1608+=0x1;_0x31bd53[_0x5c12('0x5')](_0x5c12('0xb'),new AGIError(_0x5c12('0xe'),_0x1a1608));_0x9e0245['destroy']();}else{var _0x5676a9=new AGIChannel(_0x9e0245);_0x5676a9['on'](_0x5c12('0xf'),function(){_0x31bd53[_0x5c12('0x5')]('connection',_0x5676a9);});}});});_0x3f1c8b['on'](_0x5c12('0xb'),function(_0xf18ba2){_0x31bd53[_0x5c12('0x5')]('error',new AGIError('E_AGI_SERVER_ERROR',_0xf18ba2[_0x5c12('0x10')]));});_0x3f1c8b['on'](_0x5c12('0x11'),function(){_0x31bd53[_0x5c12('0x5')](_0x5c12('0x11'),new AGIError(_0x5c12('0x12')));});}process[_0x5c12('0x13')](function(){_0x1d0635();});};util[_0x5c12('0x14')](AGIServer,EventEmitter);module[_0x5c12('0x15')]=function(_0x495e08,_0x5bf3c1,_0x2f7d71){return new AGIServer(_0x495e08,_0x5bf3c1,_0x2f7d71);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 7da86ea..5754f4e 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 _0xb944=['auth','pass','template_id','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','replaceAll','join','exports','lodash','odbc','randomstring','mustache','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','sendMailMessage','getIntervals','IntervalId','interval','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','includes','POST','PUT','toUpperCase','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','stringify','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','agicommand','clone','isString','replaceAllVariables','hasOwnProperty','isPlainObject','isArray','%s.%s','saveRestApiResult','setVariable','replaceObjectAllVariables','split','length','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','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','delay','scheduledAt','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','lumenvoxtts','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_TRANSCRIPT','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20query\x20configured','query:\x20%s','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','maxdigit','test','mindigit','generate','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','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','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','out','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','wav','ispeech\x20%s\x20file\x20created','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20found','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','toLowerCase','gosub','position','QUEUE','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','no\x20mail\x20account\x20found','email','Smtp','user','bcc','subject','service','host','port','secure','authentication'];(function(_0xb51111,_0x3272f3){var _0x2be03c=function(_0x2ddd42){while(--_0x2ddd42){_0xb51111['push'](_0xb51111['shift']());}};_0x2be03c(++_0x3272f3);}(_0xb944,0x1e5));var _0x4b94=function(_0x9db64d,_0x3e637c){_0x9db64d=_0x9db64d-0x0;var _0x43f6eb=_0xb944[_0x9db64d];return _0x43f6eb;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require(_0x4b94('0x0'));var sh=require('shelljs');var odbc=require(_0x4b94('0x1'))();var rs=require(_0x4b94('0x2'));var moment=require('moment');var Mustache=require(_0x4b94('0x3'));var rp=require('request-promise');var logger=require('../../config/logger')(_0x4b94('0x4'));var config=require(_0x4b94('0x5'));var scripts=require(_0x4b94('0x6'));var FILES_PATH=_0x4b94('0x7');var recursiveMapAttributes=['rawHeaders','rawBody'];var verticesWithRetry=[_0x4b94('0x8'),_0x4b94('0x9'),_0x4b94('0xa')];var AGIVertices=function(_0x4a9c27,_0x29dd90,_0xf66bf0){this[_0x4b94('0xb')]=_0x4a9c27;this[_0x4b94('0xc')]=_0x29dd90;this[_0x4b94('0xd')]=_0xf66bf0;};AGIVertices[_0x4b94('0xe')][_0x4b94('0xf')]=function(_0x4051c3,_0x44f7e4){this[_0x4b94('0xc')][_0x4b94('0x10')](_0x4051c3)[_0x4b94('0x11')](function(_0x2d8c81){_0x44f7e4(null,_0x2d8c81?_0x2d8c81['name']:![]);})[_0x4b94('0x12')](function(_0x2e312b){_0x44f7e4(_0x2e312b);});};AGIVertices[_0x4b94('0xe')][_0x4b94('0x13')]=function(_0x114140,_0x3c02eb){this[_0x4b94('0xc')][_0x4b94('0x14')](_0x114140)[_0x4b94('0x11')](function(_0x45553a){_0x3c02eb(null,_0x45553a?_0x45553a[_0x4b94('0x15')]:![]);})[_0x4b94('0x12')](function(_0x4a4cca){_0x3c02eb(_0x4a4cca);});};AGIVertices[_0x4b94('0xe')][_0x4b94('0x16')]=function(_0x50ceb8,_0x5f3b74){this['rpc'][_0x4b94('0x17')](_0x50ceb8)['then'](function(_0x2335a8){_0x5f3b74(null,_0x2335a8?_0x2335a8['name']:![]);})[_0x4b94('0x12')](function(_0x59da83){_0x5f3b74(_0x59da83);});};AGIVertices[_0x4b94('0xe')][_0x4b94('0x18')]=function(_0x557297,_0x486292){this[_0x4b94('0xc')][_0x4b94('0x19')](_0x557297)[_0x4b94('0x11')](function(_0x29201){_0x486292(null,_0x29201?_0x29201['dsn']:![]);})['catch'](function(_0x5bc2c6){_0x486292(_0x5bc2c6);});};AGIVertices[_0x4b94('0xe')][_0x4b94('0x1a')]=function(_0x5dec34,_0x8405fb){this[_0x4b94('0xc')][_0x4b94('0x1b')](_0x5dec34)['then'](function(_0x3571cf){_0x8405fb(null,_0x3571cf?_0x3571cf[_0x4b94('0x15')]:![]);})[_0x4b94('0x12')](function(_0x4e86f2){_0x8405fb(_0x4e86f2);});};AGIVertices[_0x4b94('0xe')][_0x4b94('0x1c')]=function(_0x48cf7f,_0x52cb00){this['rpc'][_0x4b94('0x1d')](_0x48cf7f)[_0x4b94('0x11')](function(_0x2282cd){_0x52cb00(null,_0x2282cd?_0x2282cd[_0x4b94('0x15')]:![]);})[_0x4b94('0x12')](function(_0x4ae38d){_0x52cb00(_0x4ae38d);});};AGIVertices[_0x4b94('0xe')][_0x4b94('0x1e')]=function(_0x3c8b84,_0x27def3){var _0x28fcff=this;this[_0x4b94('0xc')][_0x4b94('0x1f')](_0x3c8b84)[_0x4b94('0x11')](function(_0x1e5dbd){_0x27def3(null,_0x1e5dbd?_0x28fcff[_0x4b94('0x20')](_0x1e5dbd[_0x4b94('0x21')]):![]);})[_0x4b94('0x12')](function(_0x5994d9){_0x27def3(_0x5994d9);});};AGIVertices[_0x4b94('0xe')]['getMailAccount']=function(_0x53f1f8,_0x59b93b){this[_0x4b94('0xc')]['getMailAccountById'](_0x53f1f8)[_0x4b94('0x11')](function(_0xce010e){_0x59b93b(null,_0xce010e?_0xce010e:![]);})[_0x4b94('0x12')](function(_0x5450b9){_0x59b93b(_0x5450b9);});};AGIVertices[_0x4b94('0xe')][_0x4b94('0x22')]=function(_0x33a0e4,_0x2ac9fd,_0x39c1f5){this['mailRpc'][_0x4b94('0x22')](_0x33a0e4,_0x2ac9fd)[_0x4b94('0x11')](function(){_0x39c1f5(null);})[_0x4b94('0x12')](function(_0x18e249){_0x39c1f5(_0x18e249);});};AGIVertices[_0x4b94('0xe')][_0x4b94('0x23')]=function(_0x22eca6,_0x36615f){this['rpc']['getIntervalById'](_0x22eca6)['then'](function(_0x1e165f){if(_0x1e165f){if(_0x1e165f[_0x4b94('0x24')]){_0x36615f(null,[_0x1e165f[_0x4b94('0x25')]]);}else{_0x36615f(null,_['map'](_0x1e165f[_0x4b94('0x26')],_0x4b94('0x25')));}}else{_0x36615f(null,![]);}})[_0x4b94('0x12')](function(_0x1ddcd6){_0x36615f(_0x1ddcd6);});};AGIVertices['prototype'][_0x4b94('0x20')]=function(_0x24e5ba){return util[_0x4b94('0x27')](_0x4b94('0x28'),FILES_PATH,_0x24e5ba);};AGIVertices['prototype'][_0x4b94('0x29')]=function(_0x11e14e,_0x15a5d6,_0x5bd743){odbc[_0x4b94('0x2a')](_0x11e14e,function(_0x7a9a5a){if(_0x7a9a5a){logger[_0x4b94('0x2b')](_0x4b94('0x2c'),_0x7a9a5a);_0x5bd743(_0x7a9a5a);}else{logger[_0x4b94('0x2d')](_0x4b94('0x2e'));odbc[_0x4b94('0x2f')](_0x15a5d6,function(_0x277749,_0x1568d){if(_0x277749){logger[_0x4b94('0x2d')](_0x4b94('0x30'),_0x15a5d6);_0x5bd743(_0x277749);}else{logger[_0x4b94('0x2d')](_0x4b94('0x31'),_0x15a5d6);odbc[_0x4b94('0x32')](function(_0x3a4063){if(_0x3a4063){logger[_0x4b94('0x2b')](_0x4b94('0x33'),_0x3a4063);}_0x5bd743(null,_0x1568d);});}});}});};AGIVertices[_0x4b94('0xe')][_0x4b94('0x34')]=function(_0x280055,_0x48342d){this['rpc'][_0x4b94('0x35')](_0x280055)[_0x4b94('0x11')](function(_0x267ae5){_0x48342d(null,_0x267ae5?_0x267ae5:![]);})[_0x4b94('0x12')](function(_0x4fd519){_0x48342d(_0x4fd519);});};AGIVertices['prototype'][_0x4b94('0x36')]=function(_0x2565ce,_0xc0557){this[_0x4b94('0xc')][_0x4b94('0x36')](_0x2565ce)[_0x4b94('0x11')](function(_0x169547){_0xc0557(null,_0x169547);})[_0x4b94('0x12')](function(_0x34d46c){_0xc0557(_0x34d46c);});};AGIVertices[_0x4b94('0xe')][_0x4b94('0x37')]=function(_0x43de06,_0x1a91fb,_0x232c96){this[_0x4b94('0xc')][_0x4b94('0x37')]({'uniqueid':this[_0x4b94('0xb')][_0x4b94('0x38')],'node':_0x43de06[_0x4b94('0x39')],'application':_0x43de06['agicommand'],'data':_0x1a91fb||null,'project_name':this['channel'][_0x4b94('0x3a')],'callerid':this[_0x4b94('0xb')][_0x4b94('0x3b')]})['then'](function(_0x47666c){if(_0x232c96){_0x232c96(null,_0x47666c);}})[_0x4b94('0x12')](function(_0x2069d3){if(_0x232c96){_0x232c96(_0x2069d3);}});};AGIVertices[_0x4b94('0xe')]['createSquareRecording']=function(_0x1b2a7a,_0x355a91,_0x5390ba,_0x149731){this[_0x4b94('0xc')][_0x4b94('0x3c')]({'uniqueid':this[_0x4b94('0xb')]['uniqueid'],'callerid':this[_0x4b94('0xb')][_0x4b94('0x3b')],'calleridname':this['channel'][_0x4b94('0x3d')],'context':this[_0x4b94('0xb')][_0x4b94('0x3e')],'extension':this[_0x4b94('0xb')][_0x4b94('0x3f')],'priority':this[_0x4b94('0xb')][_0x4b94('0x40')],'accountcode':this[_0x4b94('0xb')][_0x4b94('0x41')],'dnid':this[_0x4b94('0xb')][_0x4b94('0x42')],'projectName':this[_0x4b94('0xb')][_0x4b94('0x3a')],'saveName':_0x355a91,'filename':_0x1b2a7a[_0x4b94('0x43')]||_0x355a91,'savePath':_0x5390ba})['then'](function(_0x55fd4c){_0x149731(null,_0x55fd4c);})[_0x4b94('0x12')](function(_0x55e02a){_0x149731(_0x55e02a);});};AGIVertices[_0x4b94('0xe')][_0x4b94('0x44')]=function(_0xd48d48,_0x5e7451,_0x1930a6){this[_0x4b94('0xc')][_0x4b94('0x44')]({'uniqueid':this[_0x4b94('0xb')][_0x4b94('0x38')],'body':_0xd48d48,'direction':_0x5e7451})[_0x4b94('0x11')](function(_0x57d064){if(_0x1930a6){_0x1930a6(null,_0x57d064);}})[_0x4b94('0x12')](function(_0x528180){if(_0x1930a6){_0x1930a6(_0x528180);}});};AGIVertices[_0x4b94('0xe')][_0x4b94('0x45')]=function(_0x4eb84b,_0x477727){this[_0x4b94('0xc')][_0x4b94('0x45')]({'firstName':_[_0x4b94('0x46')](_0x4eb84b[_0x4b94('0x15')])||_[_0x4b94('0x47')](_0x4eb84b[_0x4b94('0x15')])?'callback_'+Math[_0x4b94('0x48')]():_0x4eb84b[_0x4b94('0x15')],'lastName':_[_0x4b94('0x46')](_0x4eb84b['lastName'])||_[_0x4b94('0x47')](_0x4eb84b[_0x4b94('0x49')])?null:_0x4eb84b[_0x4b94('0x49')],'phone':_0x4eb84b[_0x4b94('0x4a')],'ListId':_0x4eb84b[_0x4b94('0x4b')],'scheduledat':_0x4eb84b['scheduledAt'],'callbackUniqueid':this[_0x4b94('0xb')][_0x4b94('0x38')],'tags':_0x4b94('0x4c'),'description':_0x4b94('0x4d')+_0x4eb84b['scheduledAt'][_0x4b94('0x4e')](),'priority':_0x4eb84b[_0x4b94('0x4f')]})[_0x4b94('0x11')](function(_0x4a0532){_0x477727(null,_0x4a0532);})[_0x4b94('0x12')](function(_0x579097){_0x477727(_0x579097);});};AGIVertices[_0x4b94('0xe')]['getPause']=function(_0x2e7ff0,_0x5b8bbb){this[_0x4b94('0xc')]['getPauseById'](_0x2e7ff0)[_0x4b94('0x11')](function(_0x549841){_0x5b8bbb(null,_0x549841?_0x549841[_0x4b94('0x15')]:![]);})[_0x4b94('0x12')](function(_0x4476ca){_0x5b8bbb(_0x4476ca);});};AGIVertices[_0x4b94('0xe')][_0x4b94('0x50')]=function(_0x302085,_0x2acd5c,_0x123124){var _0x2c6cc3={'role':_0x4b94('0x51')};_0x2c6cc3[_0x302085]=this[_0x4b94('0xb')]['callerid'];this[_0x4b94('0xc')][_0x4b94('0x50')](_0x2c6cc3,_0x2acd5c,this[_0x4b94('0xb')]['uniqueid'])[_0x4b94('0x11')](function(_0x243c5b){_0x123124(null,_[_0x4b94('0x47')](_0x243c5b)?![]:!![]);})[_0x4b94('0x12')](function(_0x517329){logger[_0x4b94('0x2b')](_0x517329);_0x123124(null,![]);});};AGIVertices[_0x4b94('0xe')]['agentUnpause']=function(_0x2cc4fa,_0x2d1c87){var _0x46eb6c={'role':_0x4b94('0x51')};_0x46eb6c[_0x2cc4fa]=this[_0x4b94('0xb')][_0x4b94('0x3b')];this[_0x4b94('0xc')][_0x4b94('0x52')](_0x46eb6c)[_0x4b94('0x11')](function(_0x453dd8){_0x2d1c87(null,_[_0x4b94('0x47')](_0x453dd8)?![]:!![]);})[_0x4b94('0x12')](function(_0x546f40){logger[_0x4b94('0x2b')](_0x546f40);_0x2d1c87(null,![]);});};AGIVertices[_0x4b94('0xe')]['agentLogout']=function(_0x36e0f8,_0x4586f8){var _0x1ed9e2={'role':_0x4b94('0x51')};_0x1ed9e2[_0x36e0f8]=this[_0x4b94('0xb')]['callerid'];this[_0x4b94('0xc')][_0x4b94('0x53')](_0x1ed9e2)['then'](function(_0x5e8149){_0x4586f8(null,_[_0x4b94('0x47')](_0x5e8149)?![]:!![]);})['catch'](function(_0x773901){logger[_0x4b94('0x2b')](_0x773901);_0x4586f8(null,![]);});};AGIVertices[_0x4b94('0xe')][_0x4b94('0x54')]=function(_0x3df45b,_0x328543){var _0x5a1121={'role':_0x4b94('0x51')};_0x5a1121[_0x3df45b]=this[_0x4b94('0xb')][_0x4b94('0x3b')];var _0xf0cb49=_0x3df45b!=_0x4b94('0x55')?util['format'](_0x4b94('0x56'),_0x4b94('0x57'),this[_0x4b94('0xb')][_0x4b94('0x3b')]):undefined;this[_0x4b94('0xc')][_0x4b94('0x54')](_0x5a1121,_0xf0cb49)[_0x4b94('0x11')](function(_0x2b5675){_0x328543(null,_[_0x4b94('0x47')](_0x2b5675)?![]:!![]);})[_0x4b94('0x12')](function(_0x1ffb69){logger[_0x4b94('0x2b')](_0x1ffb69);_0x328543(null,![]);});};AGIVertices[_0x4b94('0xe')][_0x4b94('0x58')]=function(_0x18d8a3,_0x4d23d5){sh[_0x4b94('0x59')](_[_0x4b94('0x5a')](_0x18d8a3),function(_0x5c5618,_0x51ca90){var _0x4c88aa=_0x51ca90[_0x4b94('0x5b')](/(\r\n|\n|\r)/gm,'');_0x4d23d5(null,_0x4c88aa);});};AGIVertices['prototype'][_0x4b94('0x5c')]=function(_0xd6cf62,_0x5987c8){scripts[_0x4b94('0x5c')](_0xd6cf62[_0x4b94('0x5d')],_0xd6cf62['google_cloud_tts_text_type']||'text',_0xd6cf62[_0x4b94('0x5e')],_0xd6cf62['languageCode']||_0x4b94('0x5f'),_0xd6cf62[_0x4b94('0x60')]||_0x4b94('0x61'),_0xd6cf62[_0x4b94('0x62')]||_0x4b94('0x63'))[_0x4b94('0x11')](function(_0x4c12b3){_0x5987c8(null,_0x4c12b3);})[_0x4b94('0x12')](function(_0x125fa6){_0x5987c8(_0x125fa6);});};AGIVertices['prototype'][_0x4b94('0x64')]=function(_0x357151,_0x850499){scripts[_0x4b94('0x64')](_0x357151['text'],_0x357151[_0x4b94('0x65')]||'en',0x1)[_0x4b94('0x11')](function(_0x2a4b63){_0x850499(null,_0x2a4b63);})[_0x4b94('0x12')](function(_0x4b51bb){_0x850499(_0x4b51bb);});};AGIVertices['prototype'][_0x4b94('0x66')]=function(_0x5089b6,_0x572b54){var _0x429d04={'uri':_0x5089b6[_0x4b94('0x67')],'method':_0x5089b6[_0x4b94('0x68')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5089b6['timeout'])===_0x4b94('0x69')&&parseInt(_0x5089b6[_0x4b94('0x6a')])>=0x1?parseInt(_0x5089b6[_0x4b94('0x6a')])*0x3e8:0x5*0x3e8};if(_[_0x4b94('0x6b')]([_0x4b94('0x6c'),_0x4b94('0x6d')],_0x429d04[_0x4b94('0x68')][_0x4b94('0x6e')]())){try{_0x429d04[_0x4b94('0x6f')]=_0x5089b6[_0x4b94('0x70')]?JSON[_0x4b94('0x71')](_0x5089b6['rawBody']):{};}catch(_0x12ec2d){logger[_0x4b94('0x2b')](_0x4b94('0x72'),_0x12ec2d);}}try{_0x429d04['headers']=_0x5089b6['rawHeaders']?JSON[_0x4b94('0x71')](_0x5089b6[_0x4b94('0x73')]):{};}catch(_0x5cf878){logger['error'](_0x4b94('0x74'),_0x5cf878);}if(_0x5089b6[_0x4b94('0x75')]){try{var _0x30af8c=require(_0x5089b6[_0x4b94('0x75')])[_0x4b94('0x76')](this,_0x429d04);_0x429d04[_0x4b94('0x77')]=Mustache[_0x4b94('0x78')](_0x5089b6['url'],_0x30af8c,{},['$$','$$']);if(_0x429d04[_0x4b94('0x79')]){_0x429d04[_0x4b94('0x79')]=JSON[_0x4b94('0x71')](Mustache['render'](JSON[_0x4b94('0x7a')](_0x429d04[_0x4b94('0x79')]),_0x30af8c,{},['$$','$$']));}if(_0x429d04['body']){_0x429d04[_0x4b94('0x6f')]=JSON[_0x4b94('0x71')](Mustache[_0x4b94('0x78')](JSON['stringify'](_0x429d04[_0x4b94('0x6f')]),_0x30af8c,{},['$$','$$']));}}catch(_0x3f6786){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3f6786);}}rp(_0x429d04)[_0x4b94('0x11')](function(_0x32d599){var _0x23e27b={'statusCode':_0x32d599[_0x4b94('0x7b')]||0xc8,'statusMessage':_0x32d599[_0x4b94('0x7c')]||'OK','headers':_0x32d599[_0x4b94('0x79')]||{},'body':_0x32d599[_0x4b94('0x6f')]||{}};_0x572b54(null,_0x23e27b);})['catch'](function(_0x394a52){var _0x5ed1a3={'statusCode':_0x394a52[_0x4b94('0x7b')]||0x1f4,'statusMessage':_0x394a52['message']||_0x4b94('0x7d'),'headers':_0x394a52[_0x4b94('0x7e')][_0x4b94('0x79')]||{},'body':_0x394a52['options']['body']||{}};_0x572b54(null,_0x5ed1a3);});};AGIVertices[_0x4b94('0xe')][_0x4b94('0x7f')]=function(_0x503094,_0x3b3c69){scripts[_0x4b94('0x7f')](this[_0x4b94('0xb')][_0x4b94('0x38')],_0x503094[_0x4b94('0x80')],_0x503094[_0x4b94('0x5e')],_0x503094[_0x4b94('0x81')]||'en')[_0x4b94('0x11')](function(_0x367ce6){_0x3b3c69(null,_0x367ce6);})[_0x4b94('0x12')](function(_0x34992e){_0x3b3c69(_0x34992e);});};AGIVertices[_0x4b94('0xe')]['sestekNDA']=function(_0xc1a3ab,_0x140fad){scripts[_0x4b94('0x82')](this[_0x4b94('0xb')],_0xc1a3ab)[_0x4b94('0x11')](function(_0x5eb66c){_0x140fad(null,_0x5eb66c);})['catch'](function(_0x2428f0){_0x140fad(_0x2428f0);});};AGIVertices[_0x4b94('0xe')]['ispeechTTS']=function(_0x25381b,_0x5e7e47){scripts[_0x4b94('0x83')](_0x25381b['key'],_0x25381b[_0x4b94('0x5e')],_0x25381b['ispeech_tts_language']||_0x4b94('0x5f'),_0x25381b[_0x4b94('0x84')])['then'](function(_0x4215e6){_0x5e7e47(null,_0x4215e6);})['catch'](function(_0x26fbce){_0x5e7e47(_0x26fbce);});};AGIVertices[_0x4b94('0xe')][_0x4b94('0x85')]=function(_0x591e7f,_0x526876,_0x414c1d){scripts[_0x4b94('0x85')](_0x526876,_0x591e7f['key'],_0x591e7f[_0x4b94('0x86')]||_0x4b94('0x5f'),this[_0x4b94('0x87')](_0x591e7f[_0x4b94('0x88')])?_0x591e7f[_0x4b94('0x88')]:undefined)[_0x4b94('0x11')](function(_0x2e75fd){_0x414c1d(null,_0x2e75fd);})[_0x4b94('0x12')](function(_0x1fa2eb){_0x414c1d(_0x1fa2eb);});};AGIVertices[_0x4b94('0xe')][_0x4b94('0x89')]=function(_0x270be1,_0x4975fa){scripts[_0x4b94('0x89')](_0x270be1[_0x4b94('0x8a')],_0x270be1['aws_secret_access_key'],_0x270be1['aws_polly_region'],_0x270be1['aws_polly_voice']||'Amy',_0x270be1[_0x4b94('0x5e')],_0x270be1[_0x4b94('0x8b')]||_0x4b94('0x5e'))[_0x4b94('0x11')](function(_0x2d0d58){_0x4975fa(null,_0x2d0d58);})['catch'](function(_0x200d9e){_0x4975fa(_0x200d9e);});};AGIVertices['prototype'][_0x4b94('0x8c')]=function(_0x4694b9,_0x16d462){scripts['awsLex'](this[_0x4b94('0xb')][_0x4b94('0x38')],_0x4694b9[_0x4b94('0x8a')],_0x4694b9[_0x4b94('0x8d')],_0x4694b9[_0x4b94('0x8e')],_0x4694b9[_0x4b94('0x5e')],_0x4694b9[_0x4b94('0x8f')])[_0x4b94('0x11')](function(_0x3ede0e){_0x16d462(null,_0x3ede0e);})[_0x4b94('0x12')](function(_0x3a4e46){_0x16d462(_0x3a4e46);});};AGIVertices[_0x4b94('0xe')][_0x4b94('0x90')]=function(_0x3056cf,_0x3544e5,_0x40e445){scripts[_0x4b94('0x90')](_0x3544e5,_0x3056cf['key'],_0x3056cf['google_asr_language']||_0x4b94('0x5f'))[_0x4b94('0x11')](function(_0x115d86){_0x40e445(null,_0x115d86);})[_0x4b94('0x12')](function(_0x78a256){_0x40e445(_0x78a256);});};AGIVertices[_0x4b94('0xe')]['tildeASR']=function(_0x22411a,_0x277634,_0x1eebe2){scripts[_0x4b94('0x91')](_0x277634,_0x22411a[_0x4b94('0x92')],_0x22411a[_0x4b94('0x93')],_0x22411a[_0x4b94('0x77')])[_0x4b94('0x11')](function(_0x34fbcc){_0x1eebe2(null,_0x34fbcc);})[_0x4b94('0x12')](function(_0x5b2573){_0x1eebe2(_0x5b2573);});};AGIVertices['prototype'][_0x4b94('0x94')]=function(_0x21db55){var _0x2ad809=_[_0x4b94('0x6b')](verticesWithRetry,_0x21db55[_0x4b94('0x95')])?_0x21db55:_[_0x4b94('0x96')](_0x21db55);for(var _0x45d182 in _0x2ad809){if(_0x2ad809['hasOwnProperty'](_0x45d182)){if(_0x2ad809[_0x45d182]&&_[_0x4b94('0x97')](_0x2ad809[_0x45d182])){if(_['includes'](recursiveMapAttributes,_0x45d182)){_0x2ad809[_0x45d182]=this['replaceObjectAllVariables'](_0x2ad809[_0x45d182]);}else{_0x2ad809[_0x45d182]=this[_0x4b94('0x98')](_0x2ad809[_0x45d182]);}}}}return _0x2ad809;};AGIVertices[_0x4b94('0xe')]['recursiveNodeIndex']=function(_0x5b7e47){for(var _0x5a2b21 in _0x5b7e47){if(_0x5b7e47[_0x4b94('0x99')](_0x5a2b21)){if(_[_0x4b94('0x9a')](_0x5b7e47[_0x5a2b21])){this['recursiveNodeIndex'](_0x5b7e47[_0x5a2b21]);}else if(_[_0x4b94('0x9b')](_0x5b7e47[_0x5a2b21])){for(var _0x3340e1=0x0;_0x3340e1<_0x5b7e47[_0x5a2b21]['length'];_0x3340e1++){this['recursiveNodeIndex'](_0x5b7e47[_0x5a2b21][_0x3340e1]);}}else if(_[_0x4b94('0x97')](_0x5b7e47[_0x5a2b21])){_0x5b7e47[_0x5a2b21]=this[_0x4b94('0x98')](_0x5b7e47[_0x5a2b21]);}}}};AGIVertices[_0x4b94('0xe')]['saveRestApiResult']=function(_0x4fb958,_0x52c26d){for(var _0x23efef in _0x4fb958){if(_0x4fb958[_0x4b94('0x99')](_0x23efef)){if(_[_0x4b94('0x9a')](_0x4fb958[_0x23efef])){if(!_[_0x4b94('0x46')](_0x4fb958[_0x23efef])){this['saveRestApiResult'](_0x4fb958[_0x23efef],util[_0x4b94('0x27')](_0x4b94('0x9c'),_0x52c26d,_0x23efef));}}else if(_[_0x4b94('0x9b')](_0x4fb958[_0x23efef])){for(var _0x4cb6bf=0x0;_0x4cb6bf<_0x4fb958[_0x23efef]['length'];_0x4cb6bf++){this[_0x4b94('0x9d')](_0x4fb958[_0x23efef][_0x4cb6bf],util[_0x4b94('0x27')](_0x4b94('0x9c'),_0x52c26d,_0x23efef+'['+_0x4cb6bf+']'));}}else{if(!_[_0x4b94('0x47')](_0x4fb958[_0x23efef])){this[_0x4b94('0xb')][_0x4b94('0x9e')](util[_0x4b94('0x27')](_0x4b94('0x9c'),_0x52c26d,_0x23efef),_0x4fb958[_0x23efef]);}}}}};AGIVertices['prototype'][_0x4b94('0x9f')]=function(_0x5d2b2c){try{var _0x50fe42=JSON[_0x4b94('0x71')](_0x5d2b2c);this['recursiveNodeIndex'](_0x50fe42);return JSON[_0x4b94('0x7a')](_0x50fe42);}catch(_0x41f5cf){return this['replaceAllVariables'](_0x5d2b2c);}};AGIVertices[_0x4b94('0xe')][_0x4b94('0x98')]=function(_0x3d5a14){var _0x14f3b1=_0x3d5a14[_0x4b94('0xa0')]('{');for(var _0x38d2af=0x1;_0x38d2af<_0x14f3b1[_0x4b94('0xa1')];_0x38d2af+=0x1){var _0x19bce2=_0x14f3b1[_0x38d2af][_0x4b94('0xa0')]('}');if(_0x19bce2[_0x4b94('0xa1')]>0x1){_0x3d5a14=_0x3d5a14['replaceAll']('{'+_0x19bce2[0x0]+'}',this['channel'][_0x4b94('0xf')](_0x19bce2[0x0])[_0x4b94('0xa2')]||_0x19bce2[0x0]);}}if(_0x14f3b1[_0x4b94('0xa1')]===0x1){return _0x3d5a14[_0x4b94('0x4e')]();}return this[_0x4b94('0x98')](_0x3d5a14);};AGIVertices[_0x4b94('0xe')][_0x4b94('0xa3')]=function(_0x49c7e9,_0x521998){var _0xd3b69b=this['channel'][_0x4b94('0xf')](_0x49c7e9);if(_0xd3b69b[_0x4b94('0xa4')]===-0x1){return _0xd3b69b;}logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0xa5'),_0x521998,_0xd3b69b['extra']));return this[_0x4b94('0xb')][_0x4b94('0x9e')](_0x521998,_0xd3b69b['extra']);};AGIVertices[_0x4b94('0xe')]['isConfigured']=function(_0x4f4665){return _0x4f4665&&_0x4f4665!=='0'&&_0x4f4665!=='-1'&&_0x4f4665!=='';};AGIVertices[_0x4b94('0xe')][_0x4b94('0xa6')]=function(_0x10aef5){this[_0x4b94('0x37')][_0x4b94('0x76')](this,_0x10aef5,'-');_0x10aef5[_0x4b94('0xa7')]=_0x10aef5[_0x4b94('0xa6')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x4b94('0xe')][_0x4b94('0x4')]=function(_0x4ce22d){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x4ce22d[_0x4b94('0x39')]));return this[_0x4b94('0xb')][_0x4b94('0x4')]([_0x4ce22d[_0x4b94('0xa8')],_0x4ce22d[_0x4b94('0xa9')]]);};AGIVertices[_0x4b94('0xe')][_0x4b94('0xaa')]=function(_0x2b62b4){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0xab'),_0x2b62b4['label']));if(this[_0x4b94('0x87')](_0x2b62b4['timeout'])){logger[_0x4b94('0x2d')](util['format'](_0x4b94('0xac'),_0x2b62b4[_0x4b94('0x6a')]));var _0x2491a8=this[_0x4b94('0xb')][_0x4b94('0xad')](_0x2b62b4['timeout']);if(_0x2491a8['result']===-0x1){return _0x2491a8;}}return this[_0x4b94('0xb')][_0x4b94('0xaa')]();};AGIVertices['prototype'][_0x4b94('0x4c')]=function(_0x497757){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0xae'),_0x497757[_0x4b94('0x39')]));if(!this[_0x4b94('0x87')](_0x497757['list_id'])){return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0x497757,_0x4b94('0xaf'));}_0x497757['scheduledAt']=moment();if(this[_0x4b94('0x87')](_0x497757[_0x4b94('0xb0')])){_0x497757[_0x4b94('0xb1')]=moment()['add'](_0x497757[_0x4b94('0xb0')],'minutes');}if(!this[_0x4b94('0x87')](_0x497757['callback_priority'])){_0x497757[_0x4b94('0x4f')]=0x2;}this[_0x4b94('0x45')]['sync'](this,_0x497757);return this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0xb3'),_0x497757[_0x4b94('0x4a')],_0x497757['list_id'],_0x497757[_0x4b94('0xb1')]));};AGIVertices['prototype'][_0x4b94('0xb4')]=function(_0x265e07){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x265e07[_0x4b94('0x39')]));var _0x4221c=this[_0x4b94('0xb')][_0x4b94('0x59')](_0x265e07['application'],_0x265e07[_0x4b94('0x7e')]);if(_0x4221c['result']===-0x1){return _0x4221c;}return this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')]('Executed\x20command\x20%s\x20%s',_0x265e07['application'],_0x265e07[_0x4b94('0x7e')]));};AGIVertices[_0x4b94('0xe')][_0x4b94('0xb5')]=function(_0x2cd368){logger['info'](util[_0x4b94('0x27')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x2cd368[_0x4b94('0x39')]));if(!this[_0x4b94('0x87')](_0x2cd368[_0x4b94('0x5e')])){return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0xb6'));}var _0x3b20e4='\x22'+_0x2cd368[_0x4b94('0x5e')]+'\x22';if(this[_0x4b94('0x87')](_0x2cd368[_0x4b94('0x7e')])){_0x3b20e4+=','+_0x2cd368[_0x4b94('0x7e')];}var _0x2842da=this[_0x4b94('0xb')][_0x4b94('0x59')](_0x4b94('0xb7'),_0x3b20e4);if(_0x2842da[_0x4b94('0xa4')]===-0x1){return _0x2842da;}return this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0xb8'),_0x3b20e4));};AGIVertices[_0x4b94('0xe')]['sestektts']=function(_0x3e7ace){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0xb9'),_0x3e7ace['label']));if(!this[_0x4b94('0x87')](_0x3e7ace['text'])){return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0xb6'));}var _0xbd6371='\x22'+_0x3e7ace[_0x4b94('0x5e')]+'\x22';if(this['isConfigured'](_0x3e7ace[_0x4b94('0x7e')])){_0xbd6371+=','+_0x3e7ace['options'];}var _0x244ae8=this[_0x4b94('0xb')][_0x4b94('0x59')](_0x4b94('0xb7'),_0xbd6371);if(_0x244ae8[_0x4b94('0xa4')]===-0x1){return _0x244ae8;}return this[_0x4b94('0xb')][_0x4b94('0xb2')](util['format'](_0x4b94('0xb8'),_0xbd6371));};AGIVertices[_0x4b94('0xe')][_0x4b94('0xba')]=function(_0x393657){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x393657['label']));if(!this[_0x4b94('0x87')](_0x393657[_0x4b94('0xbb')])){return this[_0x4b94('0xb')]['noop'](_0x4b94('0xbc'));}var _0x159c7d=_0x393657[_0x4b94('0xbb')];if(this[_0x4b94('0x87')](_0x393657[_0x4b94('0x7e')])){_0x159c7d+=','+_0x393657['options'];}var _0x58f18b=this[_0x4b94('0xb')][_0x4b94('0x59')](_0x4b94('0xbd'),_0x159c7d);if(_0x58f18b[_0x4b94('0xa4')]===-0x1){return _0x58f18b;}var _0x56cdca=this[_0x4b94('0xa3')](_0x4b94('0xbe'),_0x4b94('0xbf'));if(_0x56cdca[_0x4b94('0xa4')]===-0x1){return _0x56cdca;}var _0x2b950f=this['getAndSetVariable'](_0x4b94('0xc0'),_0x4b94('0xc1'));if(_0x2b950f[_0x4b94('0xa4')]===-0x1){return _0x2b950f;}var _0x224b9a=this[_0x4b94('0xa3')](_0x4b94('0xc2'),_0x4b94('0xc3'));if(_0x224b9a[_0x4b94('0xa4')]===-0x1){return _0x224b9a;}return this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0xc4'),_0x159c7d));};AGIVertices[_0x4b94('0xe')][_0x4b94('0xc5')]=function(_0xac848e){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0xac848e[_0x4b94('0x39')]));if(!this[_0x4b94('0x87')](_0xac848e[_0x4b94('0xbb')])){return this[_0x4b94('0xb')]['noop']('no\x20grammar\x20configured');}var _0x57fb06=_0xac848e[_0x4b94('0xbb')];if(this[_0x4b94('0x87')](_0xac848e[_0x4b94('0x7e')])){_0x57fb06+=','+_0xac848e['options'];}var _0x15e115=this[_0x4b94('0xb')][_0x4b94('0x59')]('MRCPRecog',_0x57fb06);if(_0x15e115[_0x4b94('0xa4')]===-0x1){return _0x15e115;}var _0x3d128b=this[_0x4b94('0xa3')](_0x4b94('0xbe'),'SESTEK_ASR_CONFIDENCE');if(_0x3d128b[_0x4b94('0xa4')]===-0x1){return _0x3d128b;}var _0x4db29a=this[_0x4b94('0xa3')](_0x4b94('0xc0'),_0x4b94('0xc6'));if(_0x4db29a[_0x4b94('0xa4')]===-0x1){return _0x4db29a;}var _0x2637da=this['getAndSetVariable']('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x2637da[_0x4b94('0xa4')]===-0x1){return _0x2637da;}return this[_0x4b94('0xb')][_0x4b94('0xb2')](util['format'](_0x4b94('0xc4'),_0x57fb06));};AGIVertices[_0x4b94('0xe')]['database']=function(_0x4bdf42){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0xc7'),_0x4bdf42[_0x4b94('0x39')]));if(!this[_0x4b94('0x87')](_0x4bdf42[_0x4b94('0xc8')])){return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0x4bdf42,'no\x20database\x20selected');}var _0x133236=this[_0x4b94('0x18')]['sync'](this,_0x4bdf42['odbc_id']);if(!_0x133236){return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0x4bdf42,'no\x20odbc\x20database\x20found');}if(!this[_0x4b94('0x87')](_0x4bdf42[_0x4b94('0x2f')])){return this[_0x4b94('0xb')]['error'](_0x4bdf42,_0x4b94('0xc9'));}var _0x4c4c7c=_0x4bdf42[_0x4b94('0x2f')][_0x4b94('0x5b')](/(\r\n|\n|\r)/gm,'\x20');this[_0x4b94('0xb')]['noop'](util[_0x4b94('0x27')](_0x4b94('0xca'),_0x4c4c7c));var _0x55b758=this[_0x4b94('0x29')][_0x4b94('0x76')](this,_0x133236,_0x4c4c7c);this[_0x4b94('0x37')][_0x4b94('0x76')](this,_0x4bdf42,_0x4c4c7c);if(!this[_0x4b94('0x87')](_0x4bdf42['variable_id'])){return this[_0x4b94('0xb')][_0x4b94('0xb2')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x12b71c=this['getVariable'][_0x4b94('0x76')](this,_0x4bdf42['variable_id']);if(!_0x12b71c){return this['channel'][_0x4b94('0x2b')](_0x4bdf42,_0x4b94('0xcb'));}var _0x4cfb1e=this;_0x55b758[_0x4b94('0xcc')](function(_0x153ad9,_0x437740){Object['keys'](_0x153ad9)['forEach'](function(_0x4a2c95){_0x4cfb1e[_0x4b94('0xb')]['setVariable'](util[_0x4b94('0x27')](_0x4b94('0xcd'),_0x12b71c,_0x437740,_0x4a2c95),_0x153ad9[_0x4a2c95]);});});this[_0x4b94('0xb')][_0x4b94('0x9e')](util[_0x4b94('0x27')](_0x4b94('0xce'),_0x12b71c),_0x55b758[_0x4b94('0xa1')]);return this['channel'][_0x4b94('0xb2')](util['format'](_0x4b94('0xcf'),_0x12b71c));};AGIVertices[_0x4b94('0xe')][_0x4b94('0xd0')]=function(_0x420c88){logger[_0x4b94('0xd1')](util[_0x4b94('0x27')](_0x4b94('0xd2'),_0x420c88['label']));if(!this['isConfigured'](_0x420c88[_0x4b94('0xd3')])){return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0x420c88,_0x4b94('0xd4'));}var _0x22dbbe=this[_0x4b94('0x1a')][_0x4b94('0x76')](this,_0x420c88[_0x4b94('0xd3')]);if(!_0x22dbbe){return this[_0x4b94('0xb')]['error'](_0x420c88,'no\x20user\x20found');}var _0x1a2fe8=this[_0x4b94('0xb')][_0x4b94('0x59')](_0x4b94('0xd5'),[util[_0x4b94('0x27')]('SIP/%s',_0x22dbbe),_0x420c88['timeout'],_0x420c88[_0x4b94('0xd6')],_0x420c88['url']]);if(_0x1a2fe8[_0x4b94('0xa4')]===-0x1){return _0x1a2fe8;}return this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0xd7'),_0x4b94('0xd5')));};AGIVertices[_0x4b94('0xe')][_0x4b94('0xd8')]=function(_0x4a637f){logger[_0x4b94('0x2d')](util['format'](_0x4b94('0xd9'),_0x4a637f[_0x4b94('0x39')]));if(!this[_0x4b94('0x87')](_0x4a637f[_0x4b94('0x80')])){return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0xda'));}if(!this[_0x4b94('0x87')](_0x4a637f['text'])){return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0xb6'));}this['channel'][_0x4b94('0xdb')]=!![];this['createSquareDetailsReport'](_0x4a637f);this[_0x4b94('0x44')](_0x4a637f['text'],'in');this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0xdc'),_0x4a637f['text']));var _0x4d63bc=this[_0x4b94('0x7f')][_0x4b94('0x76')](this,_0x4a637f);if(_0x4d63bc){for(var _0x51e76e in _0x4d63bc){if(_0x4d63bc[_0x4b94('0x99')](_0x51e76e)){this['channel'][_0x4b94('0x9e')](util[_0x4b94('0x27')]('DIALOGFLOW_%s',_0x51e76e['toUpperCase']()),_0x4d63bc[_0x51e76e]);}}this['createSquareMessage'](_0x4d63bc[_0x4b94('0xdd')],'out');return this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')]('Dialogflow\x20Result\x20%s',_0x4d63bc[_0x4b94('0xdd')]));}return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0x4a637f,_0x4b94('0xde'));};AGIVertices[_0x4b94('0xe')][_0x4b94('0xdf')]=function(_0x59c902){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0xe0'),_0x59c902[_0x4b94('0x39')]));if(!this[_0x4b94('0x87')](_0x59c902[_0x4b94('0xe1')])){return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0xe2'));}if(!this[_0x4b94('0x87')](_0x59c902[_0x4b94('0xe3')])){return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0xe4'));}if(!this[_0x4b94('0x87')](_0x59c902[_0x4b94('0xe5')])){return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0xe6'));}if(!this[_0x4b94('0x87')](_0x59c902['ndassistant_url'])){return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0xb6'));}this[_0x4b94('0xb')][_0x4b94('0xdb')]=!![];this[_0x4b94('0x37')](_0x59c902);this[_0x4b94('0x44')](_0x59c902['text'],'in');this[_0x4b94('0xb')]['noop'](util[_0x4b94('0x27')](_0x4b94('0xe7'),_0x59c902[_0x4b94('0x5e')]));var _0xa086ee=this[_0x4b94('0x82')][_0x4b94('0x76')](this,_0x59c902);if(_0xa086ee){for(var _0x1fc33b in _0xa086ee){if(_0xa086ee[_0x4b94('0x99')](_0x1fc33b)){this[_0x4b94('0xb')][_0x4b94('0x9e')](util[_0x4b94('0x27')]('SESTEK_NDA_%s',_0x1fc33b[_0x4b94('0x6e')]()),_0xa086ee[_0x1fc33b]);}}this['createSquareMessage'](_0xa086ee['speech'],'out');if(_0xa086ee[_0x4b94('0xe8')]){this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0xe9'),_0xa086ee[_0x4b94('0xe8')]));var _0x438a8f=this['channel'][_0x4b94('0xea')](_0xa086ee[_0x4b94('0xe8')]);try{fs[_0x4b94('0xeb')](_0xa086ee[_0x4b94('0xe8')]+_0x4b94('0xec'));}catch(_0x1f5ab9){logger['error'](_0x1f5ab9);}return _0x438a8f;}else{return this[_0x4b94('0xb')][_0x4b94('0xb2')](util['format']('SestekNDA\x20Result\x20%s',_0xa086ee[_0x4b94('0xdd')]));}}return this[_0x4b94('0xb')]['error'](_0x59c902,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype'][_0x4b94('0xed')]=function(_0x1cc8f8){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')]('Enter\x20in\x20END\x20(%s)\x20block',_0x1cc8f8[_0x4b94('0x39')]));return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0xed'));};AGIVertices['prototype'][_0x4b94('0xee')]=function(_0x137b20){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0xef'),_0x137b20[_0x4b94('0x39')]));var _0x1a64b1='';if(_0x137b20[_0x4b94('0xf0')]){if(!this[_0x4b94('0x87')](_0x137b20[_0x4b94('0xf0')])){return this['channel']['error'](_0x137b20,_0x4b94('0xf1'));}else{var _0x4e403e=parseInt(_0x137b20[_0x4b94('0xf0')],0xa);if(isNaN(_0x4e403e)){_0x1a64b1=_0x137b20[_0x4b94('0xf0')];}else{_0x1a64b1=this['getTrunk'][_0x4b94('0x76')](this,_0x137b20[_0x4b94('0xf0')]);if(!_0x1a64b1){return this['channel'][_0x4b94('0x2b')](_0x137b20,_0x4b94('0xf2'));}}}}else if(_0x137b20[_0x4b94('0xf3')]){_0x1a64b1=_0x137b20['trunk_name'];}else{return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0x137b20,'no\x20trunk\x20selected');}var _0x54e718=this['channel'][_0x4b94('0x59')](_0x4b94('0xd5'),[util[_0x4b94('0x27')]('SIP/%s/%s',_0x1a64b1,_0x137b20[_0x4b94('0x4a')]),_0x137b20[_0x4b94('0x6a')],_0x137b20[_0x4b94('0xd6')],_0x137b20[_0x4b94('0x67')]]);if(_0x54e718['result']===-0x1){return _0x54e718;}return this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0xd7'),_0x4b94('0xd5')));};AGIVertices[_0x4b94('0xe')][_0x4b94('0xf4')]=function(_0x5cf5a4){logger['info'](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x5cf5a4[_0x4b94('0x39')]));return this[_0x4b94('0xb')][_0x4b94('0xb2')]('finally');};AGIVertices[_0x4b94('0xe')][_0x4b94('0x9')]=function(_0x39405e){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0xf5'),_0x39405e[_0x4b94('0x39')]));if(_0x39405e[_0x4b94('0xa7')]===0x0){return this[_0x4b94('0xa6')](_0x39405e);}_0x39405e[_0x4b94('0xa7')]-=0x1;if(!this[_0x4b94('0x87')](_0x39405e['file_id'])){return this['channel'][_0x4b94('0x2b')](_0x39405e,_0x4b94('0xf6'));}var _0x228288=this[_0x4b94('0x1e')][_0x4b94('0x76')](this,_0x39405e[_0x4b94('0xf7')]);if(!_0x228288){return this['channel'][_0x4b94('0x2b')](_0x39405e,'no\x20file\x20audio\x20found');}if(!this[_0x4b94('0x87')](_0x39405e[_0x4b94('0xf8')])){return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0x4b94('0xf9'));}var _0x1d82a8=this[_0x4b94('0xb')][_0x4b94('0xfa')](_0x228288,_0x39405e[_0x4b94('0xfb')],_0x39405e[_0x4b94('0xfc')]);var _0x35851a=_0x1d82a8[_0x4b94('0xa4')]?_0x1d82a8[_0x4b94('0xa4')][_0x4b94('0x4e')]():'';logger[_0x4b94('0x2d')](_0x4b94('0xfd'),JSON[_0x4b94('0x7a')](_0x1d82a8));if(_0x1d82a8['result']===-0x1){this[_0x4b94('0x37')]['sync'](this,_0x39405e,_0x35851a);return _0x1d82a8;}else if(_0x1d82a8['extra']==='timeout'){_0x1d82a8['result']=_0x35851a[_0x4b94('0xa1')]>=parseInt(_0x39405e['mindigit'])?'x':'i';}else{_0x1d82a8[_0x4b94('0xa4')]=_0x35851a['length']>=parseInt(_0x39405e[_0x4b94('0xfe')])&&_0x35851a['length']<=parseInt(_0x39405e['maxdigit'])?'x':'i';}var _0x510326=this[_0x4b94('0xf')]['sync'](this,_0x39405e[_0x4b94('0xf8')]);if(!_0x510326){return this[_0x4b94('0xb')]['error'](_0x39405e,_0x4b94('0xcb'));}this[_0x4b94('0xb')][_0x4b94('0x9e')](_0x510326,_0x35851a);if(this[_0x4b94('0x87')](_0x39405e['hiddendigitsnum'])){var _0x4233a2=parseInt(_0x39405e['hiddendigitsnum'],0xa);var _0x3d76b1=rs[_0x4b94('0xff')]({'charset':'*','length':_0x4233a2});var _0x152c9c=_0x35851a[_0x4b94('0xa1')];if(_0x152c9c>0x0){if(_0x152c9c>_0x4233a2){this[_0x4b94('0x37')][_0x4b94('0x76')](this,_0x39405e,_0x39405e['hiddendigitspos']===_0x4b94('0x100')?_0x3d76b1+_0x35851a[_0x4b94('0x101')](_0x4233a2):_0x35851a[_0x4b94('0x101')](0x0,_0x152c9c-_0x4233a2)+_0x3d76b1);}else{this[_0x4b94('0x37')][_0x4b94('0x76')](this,_0x39405e,rs[_0x4b94('0xff')]({'charset':'*','length':_0x152c9c}));}}else{this[_0x4b94('0x37')]['sync'](this,_0x39405e,'');}}else{this['createSquareDetailsReport'][_0x4b94('0x76')](this,_0x39405e,_0x35851a);}return _0x1d82a8;};AGIVertices[_0x4b94('0xe')][_0x4b94('0xa')]=function(_0x2bf3c7){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0x102'),_0x2bf3c7[_0x4b94('0x39')]));return this[_0x4b94('0x9')](_0x2bf3c7);};AGIVertices[_0x4b94('0xe')][_0x4b94('0x103')]=function(_0x54ffeb){logger[_0x4b94('0x2d')](util['format'](_0x4b94('0x104'),_0x54ffeb['label']));this[_0x4b94('0x37')]['sync'](this,_0x54ffeb,_0x54ffeb[_0x4b94('0x105')]);return this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')]('GOAL\x20%s',_0x54ffeb['goalname']));};AGIVertices[_0x4b94('0xe')][_0x4b94('0x106')]=function(_0x38a882){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0x107'),_0x38a882[_0x4b94('0x39')]));if(!this[_0x4b94('0x87')](_0x38a882['aws_access_key_id'])||!this[_0x4b94('0x87')](_0x38a882[_0x4b94('0x8d')])){return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0x108'));}if(!this[_0x4b94('0x87')](_0x38a882[_0x4b94('0x5e')])){return this['channel'][_0x4b94('0xb2')](_0x4b94('0xb6'));}this['channel'][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0x109'),_0x38a882['text']));var _0x230a55=this[_0x4b94('0x89')][_0x4b94('0x76')](this,_0x38a882);if(_0x230a55){this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0x10a'),_0x230a55));var _0x530ca1=this[_0x4b94('0xb')][_0x4b94('0xea')](_0x230a55);try{fs[_0x4b94('0xeb')](_0x230a55+_0x4b94('0xec'));}catch(_0x52f90d){logger[_0x4b94('0x2b')](_0x52f90d);}return _0x530ca1;}return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0x38a882,_0x4b94('0x10b'));};AGIVertices['prototype'][_0x4b94('0x10c')]=function(_0x3a1b1c){logger[_0x4b94('0x2d')](util['format'](_0x4b94('0x10d'),_0x3a1b1c[_0x4b94('0x39')]));if(!this[_0x4b94('0x87')](_0x3a1b1c[_0x4b94('0x8a')])||!this[_0x4b94('0x87')](_0x3a1b1c[_0x4b94('0x8d')])){return this[_0x4b94('0xb')][_0x4b94('0xb2')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x4b94('0x87')](_0x3a1b1c['aws_bot_name'])){return this['channel'][_0x4b94('0xb2')](_0x4b94('0x10e'));}if(!this[_0x4b94('0x87')](_0x3a1b1c[_0x4b94('0x5e')])){return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0xb6'));}this[_0x4b94('0xb')][_0x4b94('0xdb')]=!![];this[_0x4b94('0x37')](_0x3a1b1c);this[_0x4b94('0x44')](_0x3a1b1c['text'],'in');this['channel'][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0x10f'),_0x3a1b1c[_0x4b94('0x5e')]));var _0x2ffaa3=this[_0x4b94('0x8c')][_0x4b94('0x76')](this,_0x3a1b1c);if(_0x2ffaa3){for(var _0x51fcfe in _0x2ffaa3){if(_0x2ffaa3[_0x4b94('0x99')](_0x51fcfe)&&_['isString'](_0x2ffaa3[_0x51fcfe])){this[_0x4b94('0xb')][_0x4b94('0x9e')](util[_0x4b94('0x27')]('AWS_LEX_%s',_0x51fcfe[_0x4b94('0x6e')]()),_0x2ffaa3[_0x51fcfe]);}}if(_[_0x4b94('0x47')](_0x2ffaa3[_0x4b94('0x110')])){return this[_0x4b94('0xb')]['noop'](_0x4b94('0x111'));}else{this[_0x4b94('0x44')](_0x2ffaa3['message'],_0x4b94('0x112'));return this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0x113'),_0x2ffaa3[_0x4b94('0x110')]));}}return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0x3a1b1c,_0x4b94('0x114'));};AGIVertices[_0x4b94('0xe')]['googleasr']=function(_0x169054){logger['info'](util[_0x4b94('0x27')](_0x4b94('0x115'),_0x169054[_0x4b94('0x39')],_0x169054['timeout']));if(!this['isConfigured'](_0x169054[_0x4b94('0x80')])){return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0xda'));}var _0x1ff2ad='wav';var _0x2e92d9=util[_0x4b94('0x27')](_0x4b94('0x116'),FILES_PATH,rs[_0x4b94('0xff')](0x4));var _0xaace16=util[_0x4b94('0x27')]('%s.%s',_0x2e92d9,_0x1ff2ad);var _0x456cf1=!![];if(_0x169054[_0x4b94('0x117')]===_0x4b94('0x118')){_0x456cf1=![];}var _0x164447=this[_0x4b94('0xb')][_0x4b94('0x119')](_0x2e92d9,_0x1ff2ad,_0x169054[_0x4b94('0x11a')],_0x169054['timeout'],undefined,_0x456cf1);if(_0x164447['result']!==-0x1){this['channel'][_0x4b94('0xb2')](util[_0x4b94('0x27')]('google\x20%s\x20file\x20created',_0xaace16));var _0x1254ec=this[_0x4b94('0x90')][_0x4b94('0x76')](this,_0x169054,_0xaace16);if(_0x1254ec){for(var _0x84c79c in _0x1254ec){if(_0x1254ec[_0x4b94('0x99')](_0x84c79c)){this[_0x4b94('0xb')][_0x4b94('0x9e')](util[_0x4b94('0x27')](_0x4b94('0x11b'),_0x84c79c[_0x4b94('0x6e')]()),_0x1254ec[_0x84c79c]);}}return this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0x11c'),JSON[_0x4b94('0x7a')](_0x1254ec)));}}return _0x164447;};AGIVertices['prototype'][_0x4b94('0x11d')]=function(_0x217298){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0x11e'),_0x217298[_0x4b94('0x39')]));if(!this[_0x4b94('0x87')](_0x217298[_0x4b94('0x92')])){return this[_0x4b94('0xb')]['noop'](_0x4b94('0x11f'));}if(!this[_0x4b94('0x87')](_0x217298['appsecret'])){return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0x120'));}var _0x3d504e='wav';var _0x10a7ff=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x5f2183=util[_0x4b94('0x27')]('%s.%s',_0x10a7ff,_0x3d504e);var _0x582ef0=!![];if(_0x217298[_0x4b94('0x117')]===_0x4b94('0x118')){_0x582ef0=![];}var _0x5096f2=this[_0x4b94('0xb')]['recordFile'](_0x10a7ff,_0x3d504e,_0x217298['intKey'],_0x217298[_0x4b94('0x6a')],undefined,_0x582ef0);if(_0x5096f2[_0x4b94('0xa4')]!==-0x1){this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')]('tilde\x20%s\x20file\x20created',_0x5f2183));var _0x54af79=this['tildeASR'][_0x4b94('0x76')](this,_0x217298,_0x5f2183);if(_0x54af79){for(var _0x53364c in _0x54af79){if(_0x54af79[_0x4b94('0x99')](_0x53364c)){this[_0x4b94('0xb')][_0x4b94('0x9e')](util['format'](_0x4b94('0x121'),_0x53364c[_0x4b94('0x6e')]()),_0x54af79[_0x53364c]);}}return this[_0x4b94('0xb')]['noop'](util[_0x4b94('0x27')](_0x4b94('0x122'),JSON[_0x4b94('0x7a')](_0x54af79)));}}return _0x5096f2;};AGIVertices[_0x4b94('0xe')]['gotoc']=function(_0x485616){logger[_0x4b94('0x2d')](util['format'](_0x4b94('0x123'),_0x485616[_0x4b94('0x39')]));return this[_0x4b94('0xb')][_0x4b94('0x124')](_0x485616[_0x4b94('0x3e')],_0x485616['extension'],_0x485616[_0x4b94('0x40')]);};AGIVertices[_0x4b94('0xe')][_0x4b94('0x125')]=function(_0x4361d6){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x4361d6['label']));if(!this[_0x4b94('0x87')](_0x4361d6[_0x4b94('0x126')])){return this['channel'][_0x4b94('0x2b')](_0x4361d6,'no\x20condition\x20configured');}try{var _0x3ab758=eval(_0x4361d6['condition'])?_0x4b94('0x127'):_0x4b94('0x128');this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0x129'),_0x4361d6[_0x4b94('0x126')],_0x3ab758));return{'code':0xc8,'result':_0x3ab758};}catch(_0x32a34e){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x4b94('0xe')]['gotoiftime']=function(_0x413c7b){logger[_0x4b94('0x2d')](util['format'](_0x4b94('0x12a'),_0x413c7b[_0x4b94('0x39')]));if(!this['isConfigured'](_0x413c7b[_0x4b94('0x12b')])){return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0x413c7b,'no\x20interval\x20configured');}var _0x31a388=this[_0x4b94('0x23')][_0x4b94('0x76')](this,_0x413c7b['interval_id']);if(!_0x31a388){return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0x413c7b,_0x4b94('0x12c'));}for(var _0xe6ae7d=0x0;_0xe6ae7d<_0x31a388[_0x4b94('0xa1')];_0xe6ae7d+=0x1){var _0x484ce=this[_0x4b94('0xb')]['getVariable'](util[_0x4b94('0x27')](_0x4b94('0x12d'),_0x31a388[_0xe6ae7d]));if(_0x484ce['result']===-0x1){return _0x484ce;}logger[_0x4b94('0x2d')](util[_0x4b94('0x27')]('IFTIME\x20%s\x20%s',_0x31a388[_0xe6ae7d],_0x484ce[_0x4b94('0xa2')]));if(_0x484ce[_0x4b94('0xa2')]===_0x4b94('0x127')){logger['info'](util[_0x4b94('0x27')](_0x4b94('0x12e'),_0x31a388[_0xe6ae7d],_0x4b94('0x127')));this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0x12e'),_0x31a388[_0xe6ae7d],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0x4b94('0x2d')](util['format'](_0x4b94('0x12e'),_0x31a388[_0xe6ae7d],_0x4b94('0x128')));this[_0x4b94('0xb')][_0x4b94('0xb2')](util['format'](_0x4b94('0x12e'),_0x31a388[_0xe6ae7d],_0x4b94('0x128')));}}return{'code':0xc8,'result':_0x4b94('0x128')};};AGIVertices['prototype'][_0x4b94('0x12f')]=function(_0x6cccab){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0x130'),_0x6cccab[_0x4b94('0x39')]));return this[_0x4b94('0xb')][_0x4b94('0x12f')]();};AGIVertices[_0x4b94('0xe')]['ispeechasr']=function(_0x19d468){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x19d468[_0x4b94('0x39')]));if(!this[_0x4b94('0x87')](_0x19d468[_0x4b94('0x80')])){return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0xda'));}var _0x1039c9=_0x4b94('0x131');var _0x3db5e7=util[_0x4b94('0x27')](_0x4b94('0x116'),FILES_PATH,rs[_0x4b94('0xff')](0x4));var _0x46e534=util['format'](_0x4b94('0x9c'),_0x3db5e7,_0x1039c9);var _0x279b2b=!![];if(_0x19d468[_0x4b94('0x117')]===_0x4b94('0x118')){_0x279b2b=![];}var _0x58e2f0=this['channel'][_0x4b94('0x119')](_0x3db5e7,_0x1039c9,_0x19d468[_0x4b94('0x11a')],_0x19d468[_0x4b94('0x6a')],undefined,_0x279b2b);if(_0x58e2f0['result']!==-0x1){this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0x132'),_0x46e534));var _0x4afa9c=this[_0x4b94('0x85')]['sync'](this,_0x19d468,_0x46e534);if(_0x4afa9c){for(var _0x17cd2a in _0x4afa9c){if(_0x4afa9c['hasOwnProperty'](_0x17cd2a)){this[_0x4b94('0xb')][_0x4b94('0x9e')](util[_0x4b94('0x27')]('ISPEECH_ASR_%s',_0x17cd2a[_0x4b94('0x6e')]()),_0x4afa9c[_0x17cd2a]);}}return this[_0x4b94('0xb')]['noop'](util[_0x4b94('0x27')]('IspeechASR\x20Result\x20%s',JSON[_0x4b94('0x7a')](_0x4afa9c)));}}return _0x58e2f0;};AGIVertices['prototype'][_0x4b94('0x133')]=function(_0xb29780){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0x134'),_0xb29780['label']));if(!this[_0x4b94('0x87')](_0xb29780[_0x4b94('0x80')])){return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0xda'));}if(!this[_0x4b94('0x87')](_0xb29780['text'])){return this['channel'][_0x4b94('0xb2')]('no\x20text\x20configured');}this[_0x4b94('0xb')][_0x4b94('0xb2')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0xb29780[_0x4b94('0x5e')]));var _0x9cd5c4=this['ispeechTTS'][_0x4b94('0x76')](this,_0xb29780);if(_0x9cd5c4){this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0x132'),_0x9cd5c4));var _0x2fe6b3=this[_0x4b94('0xb')][_0x4b94('0xea')](_0x9cd5c4,_0xb29780[_0x4b94('0x11a')]);try{fs['unlink'](_0x9cd5c4+_0x4b94('0xec'));}catch(_0x3dc652){logger[_0x4b94('0x2b')](_0x3dc652);}return _0x2fe6b3;}return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0xb29780,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x4b94('0xe')][_0x4b94('0x135')]=function(_0x180c10){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0x136'),_0x180c10[_0x4b94('0x39')]));if(!this[_0x4b94('0x87')](_0x180c10[_0x4b94('0x137')])){return this[_0x4b94('0xb')]['error'](_0x180c10,_0x4b94('0x138'));}logger[_0x4b94('0x2d')](util[_0x4b94('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x4b94('0xb')][_0x4b94('0x3b')],_0x180c10[_0x4b94('0x137')]));var _0x2546dc=this['agentLogin'][_0x4b94('0x76')](this,_0x180c10[_0x4b94('0x137')]);if(_0x2546dc){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0x139'),this[_0x4b94('0xb')]['callerid'],_0x180c10[_0x4b94('0x137')]));this['channel'][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0x139'),this[_0x4b94('0xb')][_0x4b94('0x3b')],_0x180c10[_0x4b94('0x137')]));return{'code':0xc8,'result':_0x4b94('0x13a')};}else{logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0x13b'),this['channel'][_0x4b94('0x3b')],_0x180c10[_0x4b94('0x137')]));this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0x13b'),this['channel']['callerid'],_0x180c10['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x4b94('0xe')]['logout']=function(_0xc7395f){logger['info'](util[_0x4b94('0x27')](_0x4b94('0x13c'),_0xc7395f[_0x4b94('0x39')]));if(!this['isConfigured'](_0xc7395f[_0x4b94('0x137')])){return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0xc7395f,_0x4b94('0x138'));}logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0x13d'),this[_0x4b94('0xb')][_0x4b94('0x3b')],_0xc7395f[_0x4b94('0x137')]));var _0xd423ff=this[_0x4b94('0x53')]['sync'](this,_0xc7395f['findBy']);if(_0xd423ff){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0x139'),this[_0x4b94('0xb')]['callerid'],_0xc7395f[_0x4b94('0x137')]));this['channel'][_0x4b94('0xb2')](util[_0x4b94('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4b94('0xb')]['callerid'],_0xc7395f[_0x4b94('0x137')]));return{'code':0xc8,'result':_0x4b94('0x13a')};}else{logger[_0x4b94('0x2d')](util['format'](_0x4b94('0x13b'),this[_0x4b94('0xb')][_0x4b94('0x3b')],_0xc7395f[_0x4b94('0x137')]));this[_0x4b94('0xb')][_0x4b94('0xb2')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x4b94('0x3b')],_0xc7395f[_0x4b94('0x137')]));return{'code':0xc8,'result':_0x4b94('0x13e')};}};AGIVertices[_0x4b94('0xe')][_0x4b94('0x13f')]=function(_0x13c79d){logger['info'](util['format'](_0x4b94('0x140'),_0x13c79d[_0x4b94('0x39')]));if(!this[_0x4b94('0x87')](_0x13c79d[_0x4b94('0x141')])){return this[_0x4b94('0xb')]['error'](_0x13c79d,_0x4b94('0x142'));}this[_0x4b94('0xb')]['noop'](util[_0x4b94('0x27')](_0x4b94('0x143'),_0x13c79d['operation']));var _0x529ef4=eval(_0x13c79d['operation']);if(!this[_0x4b94('0x87')](_0x13c79d['variable_id'])){return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0xf9'));}var _0x413f6b=this[_0x4b94('0xf')][_0x4b94('0x76')](this,_0x13c79d['variable_id']);if(!_0x413f6b){return this[_0x4b94('0xb')]['error'](_0x13c79d,_0x4b94('0xcb'));}if(_[_0x4b94('0x9b')](_0x529ef4)){var _0x43c756=this;_0x529ef4[_0x4b94('0xcc')](function(_0x429f52,_0x247ab0){_0x43c756[_0x4b94('0xb')]['setVariable'](util[_0x4b94('0x27')](_0x4b94('0x144'),_0x413f6b,_0x247ab0),_0x429f52);});return this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0x145'),_0x413f6b));}else{return this[_0x4b94('0xb')][_0x4b94('0x9e')](_0x413f6b,_0x529ef4);}};AGIVertices[_0x4b94('0xe')][_0x4b94('0x8')]=function(_0x5ee838){logger[_0x4b94('0x2d')](util['format'](_0x4b94('0x146'),_0x5ee838[_0x4b94('0x39')]));if(_0x5ee838[_0x4b94('0xa7')]===0x0){return this[_0x4b94('0xa6')](_0x5ee838);}_0x5ee838[_0x4b94('0xa7')]-=0x1;if(!this['isConfigured'](_0x5ee838['file_id'])){return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0x5ee838,'no\x20file\x20audio\x20selected');}var _0x425423=this[_0x4b94('0x1e')][_0x4b94('0x76')](this,_0x5ee838['file_id']);if(!_0x425423){return this['channel'][_0x4b94('0x2b')](_0x5ee838,'no\x20file\x20audio\x20found');}var _0x1ec710=this['channel'][_0x4b94('0xfa')](_0x425423,_0x5ee838[_0x4b94('0xfb')],_0x5ee838[_0x4b94('0x147')]);var _0x5116ab=_0x1ec710[_0x4b94('0xa4')];if(_0x1ec710[_0x4b94('0xa4')]===-0x1){this[_0x4b94('0x37')][_0x4b94('0x76')](this,_0x5ee838,'-1');return _0x1ec710;}else if(_0x1ec710[_0x4b94('0xa2')]==='timeout'){_0x1ec710['result']=_0x1ec710[_0x4b94('0xa4')][_0x4b94('0xa1')]>0x0?_0x1ec710[_0x4b94('0xa4')]:'t';}else if(_[_0x4b94('0x46')](_0x1ec710[_0x4b94('0xa4')])){_0x1ec710[_0x4b94('0xa4')]='#';_0x5116ab='#';}if(!this[_0x4b94('0x87')](_0x5ee838['variable_id'])){this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0xf9'));}else{var _0x4b6dcb=this[_0x4b94('0xf')][_0x4b94('0x76')](this,_0x5ee838[_0x4b94('0xf8')]);if(!_0x4b6dcb){return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0x5ee838,_0x4b94('0xcb'));}this[_0x4b94('0xb')][_0x4b94('0x9e')](_0x4b6dcb,_0x5116ab);}this[_0x4b94('0x37')][_0x4b94('0x76')](this,_0x5ee838,_0x5116ab);return _0x1ec710;};AGIVertices[_0x4b94('0xe')][_0x4b94('0xb2')]=function(_0x2dff92){logger[_0x4b94('0x2d')](util['format'](_0x4b94('0x148'),_0x2dff92['label']));return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x2dff92[_0x4b94('0x149')]||_0x2dff92[_0x4b94('0x39')]);};AGIVertices[_0x4b94('0xe')][_0x4b94('0x14a')]=function(_0x208a3c){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0x14b'),_0x208a3c['label']));if(!this[_0x4b94('0x87')](_0x208a3c[_0x4b94('0x137')])){return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0x208a3c,'no\x20find\x20by\x20configured');}logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0x13d'),this[_0x4b94('0xb')]['callerid'],_0x208a3c[_0x4b94('0x137')]));var _0x263e58=this[_0x4b94('0x14c')][_0x4b94('0x76')](this,_0x208a3c[_0x4b94('0x14d')]);var _0x35fd7f=this['agentPause']['sync'](this,_0x208a3c['findBy'],_0x263e58);if(_0x35fd7f){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0x139'),this[_0x4b94('0xb')]['callerid'],_0x208a3c[_0x4b94('0x137')]));this['channel'][_0x4b94('0xb2')](util['format'](_0x4b94('0x139'),this['channel'][_0x4b94('0x3b')],_0x208a3c[_0x4b94('0x137')]));return{'code':0xc8,'result':_0x4b94('0x13a')};}else{logger[_0x4b94('0x2d')](util['format'](_0x4b94('0x13b'),this['channel'][_0x4b94('0x3b')],_0x208a3c[_0x4b94('0x137')]));this[_0x4b94('0xb')]['noop'](util['format'](_0x4b94('0x139'),this[_0x4b94('0xb')][_0x4b94('0x3b')],_0x208a3c['findBy']));return{'code':0xc8,'result':_0x4b94('0x13e')};}};AGIVertices['prototype'][_0x4b94('0x14e')]=function(_0x59ec0d){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0x14f'),_0x59ec0d['label']));if(!this[_0x4b94('0x87')](_0x59ec0d['file_id'])){return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0x59ec0d,_0x4b94('0xf6'));}var _0x46d6c8=this[_0x4b94('0x1e')][_0x4b94('0x76')](this,_0x59ec0d[_0x4b94('0xf7')]);if(!_0x46d6c8){return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0x59ec0d,_0x4b94('0x150'));}var _0x25cf94=this['channel'][_0x4b94('0x59')](_0x4b94('0x151'),[_0x46d6c8,_0x59ec0d[_0x4b94('0xd6')]]);if(_0x25cf94['result']===-0x1){return _0x25cf94;}return this['channel']['noop'](util['format'](_0x4b94('0x152'),_0x4b94('0x151'),_0x46d6c8));};AGIVertices[_0x4b94('0xe')][_0x4b94('0x153')]=function(_0x45540c){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0x154'),_0x45540c[_0x4b94('0x39')]));if(!this[_0x4b94('0x87')](_0x45540c[_0x4b94('0x155')])){return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0x45540c,_0x4b94('0x156'));}var _0x5a29cf='';var _0x4c03f8=parseInt(_0x45540c[_0x4b94('0x155')],0xa);if(isNaN(_0x4c03f8)){_0x5a29cf=_0x45540c[_0x4b94('0x155')];}else{_0x5a29cf=this[_0x4b94('0x13')][_0x4b94('0x76')](this,_0x45540c[_0x4b94('0x155')]);if(!_0x5a29cf){return this['channel'][_0x4b94('0x2b')](_0x45540c,_0x4b94('0x157'));}}var _0x5acba2='';if(this[_0x4b94('0x87')](_0x45540c[_0x4b94('0xf7')])){var _0x5e9823=this[_0x4b94('0x1e')][_0x4b94('0x76')](this,_0x45540c['file_id']);if(_0x5e9823){_0x5acba2=_0x5e9823;}}this[_0x4b94('0x37')][_0x4b94('0x76')](this,_0x45540c,_0x5a29cf);if(_0x45540c[_0x4b94('0xd6')][_0x4b94('0x158')]('x')<0x0){_0x45540c[_0x4b94('0xd6')]+='x';}if(_0x45540c[_0x4b94('0xd6')][_0x4b94('0x158')]('X')<0x0){_0x45540c[_0x4b94('0xd6')]+='X';}this['channel'][_0x4b94('0x9e')]('XMCS-QUEUE',_0x5a29cf?_0x5a29cf[_0x4b94('0x159')]():'');var _0x46b298=this[_0x4b94('0xb')][_0x4b94('0x59')]('QUEUE',[_0x5a29cf,_0x45540c[_0x4b94('0xd6')],_0x45540c[_0x4b94('0x67')],_0x5acba2,_0x45540c[_0x4b94('0x6a')],_0x45540c[_0x4b94('0x4')],_0x45540c['macro'],_0x45540c[_0x4b94('0x15a')],'',_0x45540c[_0x4b94('0x15b')]]);if(_0x46b298[_0x4b94('0xa4')]===-0x1){return _0x46b298;}return this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0x152'),_0x4b94('0x15c'),_0x5a29cf));};AGIVertices[_0x4b94('0xe')]['record']=function(_0x1e79d9){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0x15d'),_0x1e79d9[_0x4b94('0x39')]));var _0x164112=_0x1e79d9[_0x4b94('0x15e')]||'wav';var _0x472340=util[_0x4b94('0x27')](_0x4b94('0x15f'),this[_0x4b94('0xb')][_0x4b94('0x38')],rs[_0x4b94('0xff')](0x5));var _0x1f89cf=util[_0x4b94('0x27')](_0x4b94('0x160'),FILES_PATH,_0x472340,_0x164112);var _0x511f99=util['format']('%s/recordings/%s',FILES_PATH,_0x472340);this['createSquareRecording'][_0x4b94('0x76')](this,_0x1e79d9,_0x472340,_0x1f89cf);this[_0x4b94('0xb')][_0x4b94('0x9e')](_0x4b94('0x161'),_0x472340);logger['info'](_0x4b94('0x162'),_0x511f99,_0x164112,_0x1e79d9[_0x4b94('0x163')],_0x1e79d9[_0x4b94('0x6a')]);return this[_0x4b94('0xb')]['recordFile'](_0x511f99,_0x164112,_0x1e79d9[_0x4b94('0x163')],_0x1e79d9[_0x4b94('0x6a')],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x2eaa60){logger['info'](util[_0x4b94('0x27')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x2eaa60[_0x4b94('0x39')]));if(!this[_0x4b94('0x87')](_0x2eaa60[_0x4b94('0x67')])){return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0x164'));}var _0x6c4c89=this['restAPI'][_0x4b94('0x76')](this,_0x2eaa60);logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0x165'),util['inspect'](_0x6c4c89,{'showHidden':![],'depth':null})));if(!this[_0x4b94('0x87')](_0x2eaa60[_0x4b94('0xf8')])){return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0x166'));}var _0x445014=this[_0x4b94('0xf')][_0x4b94('0x76')](this,_0x2eaa60[_0x4b94('0xf8')]);if(!_0x445014){return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0x2eaa60,_0x4b94('0xcb'));}this[_0x4b94('0xb')][_0x4b94('0x9e')](util[_0x4b94('0x27')](_0x4b94('0x167'),_0x445014),_0x6c4c89[_0x4b94('0x7b')]?_0x6c4c89[_0x4b94('0x7b')]:_0x4b94('0x168'));this[_0x4b94('0xb')][_0x4b94('0x9e')](util['format'](_0x4b94('0x169'),_0x445014),_0x6c4c89['statusMessage']?_0x6c4c89['statusMessage']:'OK');if(_0x6c4c89['body']){try{this[_0x4b94('0x9d')](_0x6c4c89[_0x4b94('0x6f')],_0x445014);}catch(_0x2f921a){logger['error'](util['format'](_0x4b94('0x16a'),_0x445014));}}return this['channel']['noop'](util['format'](_0x4b94('0xcf'),_0x445014));};AGIVertices[_0x4b94('0xe')]['saydigits']=function(_0x19416e){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0x16b'),_0x19416e[_0x4b94('0x39')]));return this[_0x4b94('0xb')][_0x4b94('0x16c')](_0x19416e[_0x4b94('0x16d')][_0x4b94('0x5b')](/\s+/g,''),_0x19416e[_0x4b94('0x163')]);};AGIVertices[_0x4b94('0xe')][_0x4b94('0x16e')]=function(_0x2713f3){logger['info'](util['format'](_0x4b94('0x16f'),_0x2713f3['label']));return this[_0x4b94('0xb')][_0x4b94('0x170')](_0x2713f3['number'][_0x4b94('0x5b')](/\s+/g,''),_0x2713f3['escape_digits']);};AGIVertices[_0x4b94('0xe')]['sayphonetic']=function(_0x590aa0){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x590aa0[_0x4b94('0x39')]));return this[_0x4b94('0xb')][_0x4b94('0x171')](_0x590aa0[_0x4b94('0x5e')],_0x590aa0[_0x4b94('0x163')]);};AGIVertices[_0x4b94('0xe')]['sendMail']=function(_0x247db4){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0x172'),_0x247db4[_0x4b94('0x39')]));if(!this[_0x4b94('0x87')](_0x247db4[_0x4b94('0x173')])){return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0x174'));}var _0x573a1f=this[_0x4b94('0x175')][_0x4b94('0x76')](this,_0x247db4[_0x4b94('0x173')]);if(!_0x573a1f||!_0x573a1f['Smtp']){return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0x247db4,_0x4b94('0x176'));}var _0x23ab98={'from':util[_0x4b94('0x27')]('\x22%s\x22\x20<%s>',_0x573a1f[_0x4b94('0x15')],_0x573a1f[_0x4b94('0x177')]||_0x573a1f[_0x4b94('0x178')][_0x4b94('0x179')]),'to':_0x247db4['to']||'','cc':_0x247db4['cc']||'','bcc':_0x247db4[_0x4b94('0x17a')]||'','subject':_0x247db4[_0x4b94('0x17b')],'html':_0x247db4[_0x4b94('0x5e')],'text':_0x247db4[_0x4b94('0x5e')]};var _0x1e0526={'tls':{'rejectUnauthorized':![]}};if(_0x573a1f['Smtp'][_0x4b94('0x17c')]){_0x1e0526[_0x4b94('0x17c')]=_0x573a1f[_0x4b94('0x178')][_0x4b94('0x17c')];}else{_0x1e0526[_0x4b94('0x17d')]=_0x573a1f['Smtp']['host'];_0x1e0526[_0x4b94('0x17e')]=_0x573a1f[_0x4b94('0x178')][_0x4b94('0x17e')];_0x1e0526[_0x4b94('0x17f')]=_0x573a1f[_0x4b94('0x178')][_0x4b94('0x17f')];}if(_0x573a1f[_0x4b94('0x178')][_0x4b94('0x180')]){_0x1e0526[_0x4b94('0x181')]={'user':_0x573a1f[_0x4b94('0x178')][_0x4b94('0x179')],'pass':_0x573a1f[_0x4b94('0x178')][_0x4b94('0x182')]};}if(this[_0x4b94('0x87')](_0x247db4[_0x4b94('0x183')])){}logger['debug']('sendMail\x20message',JSON[_0x4b94('0x7a')](_0x23ab98));this['createSquareDetailsReport'][_0x4b94('0x76')](this,_0x247db4,_0x247db4[_0x4b94('0x173')]);this[_0x4b94('0xb')]['noop'](util['format'](_0x4b94('0x184'),_0x573a1f['name']));this['sendMailMessage'][_0x4b94('0x76')](this,_0x1e0526,_0x23ab98);return this[_0x4b94('0xb')]['noop']('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x4b94('0xe')][_0x4b94('0x185')]=function(_0x3757c2){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0x186'),_0x3757c2[_0x4b94('0x39')]));return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0x187'));};AGIVertices[_0x4b94('0xe')][_0x4b94('0x188')]=function(_0xdd047){logger[_0x4b94('0x2d')](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0xdd047['label']));if(!this[_0x4b94('0x87')](_0xdd047[_0x4b94('0x189')])){return this['channel'][_0x4b94('0xb2')](_0x4b94('0x18a'));}var _0xd38efa=this[_0x4b94('0x34')]['sync'](this,_0xdd047[_0x4b94('0x189')]);if(!_0xd38efa){return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0xdd047,_0x4b94('0x18b'));}var _0x1add4f={'body':_0xdd047['sms_text'],'phone':_0xdd047['to']||'','SmsAccountId':_0xd38efa['id']};logger[_0x4b94('0xd1')](_0x4b94('0x18c'),JSON[_0x4b94('0x7a')](_0x1add4f));this[_0x4b94('0x37')][_0x4b94('0x76')](this,_0xdd047,_0xdd047[_0x4b94('0x189')]);this['channel'][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0x18d'),_0xd38efa['name']));this[_0x4b94('0x36')][_0x4b94('0x76')](this,_0x1add4f);return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0x18e'));};AGIVertices['prototype'][_0x4b94('0x18f')]=function(_0x1fa899){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x1fa899['label']));if(!this['isConfigured'](_0x1fa899[_0x4b94('0xf8')])){return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0x1fa899,_0x4b94('0x190'));}var _0x1daf2d=this[_0x4b94('0xf')]['sync'](this,_0x1fa899[_0x4b94('0xf8')]);if(!_0x1daf2d){return this[_0x4b94('0xb')]['error'](_0x1fa899,_0x4b94('0xcb'));}return this[_0x4b94('0xb')][_0x4b94('0x9e')](_0x1daf2d,_0x1fa899['variable_value']);};AGIVertices[_0x4b94('0xe')][_0x4b94('0x191')]=function(_0xedbdc9){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0x192'),_0xedbdc9[_0x4b94('0x39')]));this[_0x4b94('0xb')][_0x4b94('0xb2')]('START\x20CALLY\x20SQUARE');if(_0xedbdc9[_0x4b94('0xaa')]===_0x4b94('0x193')){this[_0x4b94('0xb')][_0x4b94('0xb2')]('Answer');return this[_0x4b94('0xb')]['answer']();}return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0x194'));};AGIVertices[_0x4b94('0xe')][_0x4b94('0x195')]=function(_0x16a593){logger[_0x4b94('0x2d')](util['format'](_0x4b94('0x196'),_0x16a593[_0x4b94('0x39')]));if(!this['isConfigured'](_0x16a593[_0x4b94('0x197')])){return this['channel'][_0x4b94('0x2b')](_0x16a593,_0x4b94('0x198'));}var _0x1261dd=this[_0x4b94('0x16')]['sync'](this,_0x16a593['project_id']);if(!this[_0x4b94('0x87')](_0x1261dd)){return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0x16a593,util['format'](_0x4b94('0x199'),_0x16a593[_0x4b94('0x197')]));}if(_0x1261dd===this['channel']['arg_1']){return this['channel'][_0x4b94('0x2b')](_0x16a593,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport'][_0x4b94('0x76')](this,_0x16a593,_0x1261dd);var _0x1eb8d7=this[_0x4b94('0xb')][_0x4b94('0x59')](_0x4b94('0x19a'),util[_0x4b94('0x27')](_0x4b94('0x19b'),config['agi'][_0x4b94('0x17d')]||_0x4b94('0x19c'),_0x1261dd,this['channel']['arg_1']));if(_0x1eb8d7[_0x4b94('0xa4')]===-0x1){return _0x1eb8d7;}return this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0x152'),_0x4b94('0x19a'),_0x1261dd));};AGIVertices['prototype'][_0x4b94('0x19d')]=function(_0x4fa8f9){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0x19e'),_0x4fa8f9[_0x4b94('0x39')]));var _0x2a5f58=this[_0x4b94('0x58')][_0x4b94('0x76')](this,_0x4fa8f9[_0x4b94('0xa8')]);this['createSquareDetailsReport'][_0x4b94('0x76')](this,_0x4fa8f9,_0x4fa8f9['command']);if(this[_0x4b94('0x87')](_0x4fa8f9[_0x4b94('0xf8')])){var _0xa3e3aa=this[_0x4b94('0xf')][_0x4b94('0x76')](this,_0x4fa8f9[_0x4b94('0xf8')]);if(_0xa3e3aa){this[_0x4b94('0xb')][_0x4b94('0x9e')](_0xa3e3aa,_0x2a5f58);return this['channel'][_0x4b94('0xb2')](util['format'](_0x4b94('0x19f'),_0x4fa8f9['command'],_0xa3e3aa));}}return this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0x1a0'),_0x4fa8f9[_0x4b94('0xa8')]));};AGIVertices[_0x4b94('0xe')][_0x4b94('0x1a1')]=function(_0x1a33ee){logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0x1a2'),_0x1a33ee[_0x4b94('0x39')]));if(!this[_0x4b94('0x87')](_0x1a33ee[_0x4b94('0x5d')])){return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0x1a3'));}if(!this[_0x4b94('0x87')](_0x1a33ee[_0x4b94('0x5e')])){return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0xb6'));}this[_0x4b94('0xb')][_0x4b94('0xb2')](util['format'](_0x4b94('0x1a4'),_0x1a33ee[_0x4b94('0x5e')]));var _0x36df27=this[_0x4b94('0x5c')][_0x4b94('0x76')](this,_0x1a33ee);if(_0x36df27){this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0x1a5'),_0x36df27));var _0x41d06c=this[_0x4b94('0xb')]['streamFile'](_0x36df27);try{fs[_0x4b94('0xeb')](_0x36df27+_0x4b94('0xec'));}catch(_0x2be6de){logger['error'](_0x2be6de);}return _0x41d06c;}return this['channel'][_0x4b94('0x2b')](_0x1a33ee,_0x4b94('0x1a6'));};AGIVertices[_0x4b94('0xe')]['tts']=function(_0x3a44d3){logger[_0x4b94('0x2d')](util['format'](_0x4b94('0x1a7'),_0x3a44d3['label']));if(!this[_0x4b94('0x87')](_0x3a44d3[_0x4b94('0x5e')])){return this[_0x4b94('0xb')][_0x4b94('0xb2')](_0x4b94('0xb6'));}this[_0x4b94('0xb')][_0x4b94('0xb2')](util['format'](_0x4b94('0x1a8'),_0x3a44d3[_0x4b94('0x5e')]));var _0x2bb505=this[_0x4b94('0x64')]['sync'](this,_0x3a44d3);if(_0x2bb505){this[_0x4b94('0xb')]['noop'](util['format'](_0x4b94('0x1a9'),_0x2bb505));var _0x20c007=this[_0x4b94('0xb')][_0x4b94('0xea')](_0x2bb505);try{fs[_0x4b94('0xeb')](_0x2bb505+_0x4b94('0xec'));}catch(_0x5344ed){logger[_0x4b94('0x2b')](_0x5344ed);}return _0x20c007;}return this['channel']['error'](_0x3a44d3,_0x4b94('0x1aa'));};AGIVertices[_0x4b94('0xe')]['unpause']=function(_0x12dfd9){logger['info'](util[_0x4b94('0x27')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x12dfd9[_0x4b94('0x39')]));if(!this['isConfigured'](_0x12dfd9['findBy'])){return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0x12dfd9,_0x4b94('0x138'));}logger[_0x4b94('0x2d')](util['format'](_0x4b94('0x13d'),this[_0x4b94('0xb')][_0x4b94('0x3b')],_0x12dfd9[_0x4b94('0x137')]));var _0x4a0056=this[_0x4b94('0x52')]['sync'](this,_0x12dfd9[_0x4b94('0x137')]);if(_0x4a0056){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x12dfd9['findBy']));this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4b94('0xb')][_0x4b94('0x3b')],_0x12dfd9[_0x4b94('0x137')]));return{'code':0xc8,'result':_0x4b94('0x13a')};}else{logger[_0x4b94('0x2d')](util[_0x4b94('0x27')](_0x4b94('0x13b'),this[_0x4b94('0xb')]['callerid'],_0x12dfd9[_0x4b94('0x137')]));this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4b94('0xb')][_0x4b94('0x3b')],_0x12dfd9['findBy']));return{'code':0xc8,'result':_0x4b94('0x13e')};}};AGIVertices[_0x4b94('0xe')][_0x4b94('0x1ab')]=function(_0x32fe93){logger['info'](util['format'](_0x4b94('0x1ac'),_0x32fe93[_0x4b94('0x39')]));var _0x1b95ca=this[_0x4b94('0xb')][_0x4b94('0x59')]('VOICEMAIL',[_0x32fe93[_0x4b94('0x1ad')],_0x32fe93['options']]);if(_0x1b95ca[_0x4b94('0xa4')]===-0x1){return _0x1b95ca;}return this[_0x4b94('0xb')][_0x4b94('0xb2')](util[_0x4b94('0x27')](_0x4b94('0x152'),_0x4b94('0x1ae'),_0x32fe93[_0x4b94('0x1ad')]));};AGIVertices[_0x4b94('0xe')][_0x4b94('0x1af')]=function(_0x3335f7){logger['info'](util[_0x4b94('0x27')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x3335f7[_0x4b94('0x39')]));if(!this[_0x4b94('0x87')](_0x3335f7[_0x4b94('0xf8')])){return this[_0x4b94('0xb')][_0x4b94('0x2b')](_0x3335f7,_0x4b94('0x190'));}var _0x4ed697=this[_0x4b94('0xf')][_0x4b94('0x76')](this,_0x3335f7['variable_id']);if(!_0x4ed697){return this['channel']['error'](_0x3335f7,_0x4b94('0xcb'));}var _0x913687=this['channel']['getVariable'](_0x4ed697);return{'code':0xc8,'result':_0x913687[_0x4b94('0xa2')]?_0x913687[_0x4b94('0xa2')]:'-'};};String[_0x4b94('0xe')][_0x4b94('0x1b0')]=function(_0x1ed67b,_0x303815){return this[_0x4b94('0xa0')](_0x1ed67b)[_0x4b94('0x1b1')](_0x303815);};module[_0x4b94('0x1b2')]=AGIVertices; \ No newline at end of file +var _0x4f89=['MP3','google_tts_language','restAPI','url','timeout','POST','PUT','method','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','parse','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','speed','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','format','%s.%s','split','replaceAll','extra','getAndSetVariable','result','maxRetry','retry','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','exec','application','noop','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20text\x20configured','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','grammar','LUMENVOX_ASR_CONFIDENCE','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','MRCPRecog','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','RECOG_INPUT()','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','setVariable','%s[%s][%s]','%s_ROWS_COUNT','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','getUser','DIAL','SIP/%s','opts','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','bot','SESTEK_NDA_%s','toUpperCase','out','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','wav','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','record','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Response:','inspect','%s_STATUS_CODE','variable\x20%s\x20set','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayNumber','sayphonetic','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','user','bcc','service','host','port','secure','authentication','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','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','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','googleTTS','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','shelljs','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','rpc','getVariable','getVariableById','then','name','catch','prototype','getVoiceQueue','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','interval','map','Intervals','getSoundPath','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','info','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','channel','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','arg_1','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MALE','audioEncoding'];(function(_0x1820b8,_0x252cc6){var _0x4531b4=function(_0x10b2f2){while(--_0x10b2f2){_0x1820b8['push'](_0x1820b8['shift']());}};_0x4531b4(++_0x252cc6);}(_0x4f89,0x15e));var _0x94f8=function(_0xb3f66a,_0x211103){_0xb3f66a=_0xb3f66a-0x0;var _0x1db82a=_0x4f89[_0xb3f66a];return _0x1db82a;};'use strict';var fs=require('fs');var path=require(_0x94f8('0x0'));var util=require(_0x94f8('0x1'));var _=require('lodash');var sh=require(_0x94f8('0x2'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0x94f8('0x3'));var Mustache=require(_0x94f8('0x4'));var rp=require(_0x94f8('0x5'));var logger=require(_0x94f8('0x6'))(_0x94f8('0x7'));var config=require(_0x94f8('0x8'));var scripts=require(_0x94f8('0x9'));var FILES_PATH=_0x94f8('0xa');var recursiveMapAttributes=[_0x94f8('0xb'),_0x94f8('0xc')];var verticesWithRetry=['menu',_0x94f8('0xd'),_0x94f8('0xe')];var AGIVertices=function(_0x2f5cb5,_0x56d529,_0xff629e){this['channel']=_0x2f5cb5;this[_0x94f8('0xf')]=_0x56d529;this['mailRpc']=_0xff629e;};AGIVertices['prototype'][_0x94f8('0x10')]=function(_0x2b353f,_0x58259b){this['rpc'][_0x94f8('0x11')](_0x2b353f)[_0x94f8('0x12')](function(_0x18c1b4){_0x58259b(null,_0x18c1b4?_0x18c1b4[_0x94f8('0x13')]:![]);})[_0x94f8('0x14')](function(_0x211100){_0x58259b(_0x211100);});};AGIVertices[_0x94f8('0x15')][_0x94f8('0x16')]=function(_0x390058,_0x2d719a){this[_0x94f8('0xf')]['getVoiceQueueById'](_0x390058)['then'](function(_0x27ae5b){_0x2d719a(null,_0x27ae5b?_0x27ae5b['name']:![]);})['catch'](function(_0x53132e){_0x2d719a(_0x53132e);});};AGIVertices[_0x94f8('0x15')][_0x94f8('0x17')]=function(_0x269f9a,_0x108934){this[_0x94f8('0xf')][_0x94f8('0x18')](_0x269f9a)[_0x94f8('0x12')](function(_0x15363e){_0x108934(null,_0x15363e?_0x15363e[_0x94f8('0x13')]:![]);})['catch'](function(_0x1284da){_0x108934(_0x1284da);});};AGIVertices[_0x94f8('0x15')][_0x94f8('0x19')]=function(_0x2e8e38,_0x2ac883){this[_0x94f8('0xf')][_0x94f8('0x1a')](_0x2e8e38)['then'](function(_0x1f0808){_0x2ac883(null,_0x1f0808?_0x1f0808[_0x94f8('0x1b')]:![]);})[_0x94f8('0x14')](function(_0x536398){_0x2ac883(_0x536398);});};AGIVertices['prototype']['getUser']=function(_0x3f153e,_0x4708cb){this[_0x94f8('0xf')]['getUserById'](_0x3f153e)[_0x94f8('0x12')](function(_0x56cf22){_0x4708cb(null,_0x56cf22?_0x56cf22[_0x94f8('0x13')]:![]);})[_0x94f8('0x14')](function(_0x3a6a9b){_0x4708cb(_0x3a6a9b);});};AGIVertices[_0x94f8('0x15')][_0x94f8('0x1c')]=function(_0x11a148,_0x5831fd){this[_0x94f8('0xf')][_0x94f8('0x1d')](_0x11a148)['then'](function(_0x3e0456){_0x5831fd(null,_0x3e0456?_0x3e0456[_0x94f8('0x13')]:![]);})[_0x94f8('0x14')](function(_0x371ce3){_0x5831fd(_0x371ce3);});};AGIVertices[_0x94f8('0x15')][_0x94f8('0x1e')]=function(_0x3aa4ed,_0x4f8eda){var _0x2d0e4a=this;this['rpc'][_0x94f8('0x1f')](_0x3aa4ed)[_0x94f8('0x12')](function(_0xed298d){_0x4f8eda(null,_0xed298d?_0x2d0e4a['getSoundPath'](_0xed298d[_0x94f8('0x20')]):![]);})[_0x94f8('0x14')](function(_0x28f147){_0x4f8eda(_0x28f147);});};AGIVertices[_0x94f8('0x15')][_0x94f8('0x21')]=function(_0x3873a5,_0x2958a2){this[_0x94f8('0xf')][_0x94f8('0x22')](_0x3873a5)[_0x94f8('0x12')](function(_0x4bd97d){_0x2958a2(null,_0x4bd97d?_0x4bd97d:![]);})[_0x94f8('0x14')](function(_0x225030){_0x2958a2(_0x225030);});};AGIVertices[_0x94f8('0x15')][_0x94f8('0x23')]=function(_0x52df6a,_0x33735b,_0x1212c2){this[_0x94f8('0x24')][_0x94f8('0x23')](_0x52df6a,_0x33735b)[_0x94f8('0x12')](function(){_0x1212c2(null);})['catch'](function(_0x38066e){_0x1212c2(_0x38066e);});};AGIVertices['prototype'][_0x94f8('0x25')]=function(_0x32698b,_0x5026b1){this[_0x94f8('0xf')][_0x94f8('0x26')](_0x32698b)[_0x94f8('0x12')](function(_0xf1bbae){if(_0xf1bbae){if(_0xf1bbae['IntervalId']){_0x5026b1(null,[_0xf1bbae[_0x94f8('0x27')]]);}else{_0x5026b1(null,_[_0x94f8('0x28')](_0xf1bbae[_0x94f8('0x29')],_0x94f8('0x27')));}}else{_0x5026b1(null,![]);}})[_0x94f8('0x14')](function(_0x2a02ba){_0x5026b1(_0x2a02ba);});};AGIVertices[_0x94f8('0x15')][_0x94f8('0x2a')]=function(_0x6366c5){return util['format'](_0x94f8('0x2b'),FILES_PATH,_0x6366c5);};AGIVertices[_0x94f8('0x15')][_0x94f8('0x2c')]=function(_0x1d07af,_0x57c010,_0x17bc6c){odbc[_0x94f8('0x2d')](_0x1d07af,function(_0x101302){if(_0x101302){logger[_0x94f8('0x2e')](_0x94f8('0x2f'),_0x101302);_0x17bc6c(_0x101302);}else{logger['info'](_0x94f8('0x30'));odbc[_0x94f8('0x31')](_0x57c010,function(_0x3a4b87,_0x46fd67){if(_0x3a4b87){logger['info'](_0x94f8('0x32'),_0x57c010);_0x17bc6c(_0x3a4b87);}else{logger[_0x94f8('0x33')](_0x94f8('0x34'),_0x57c010);odbc['close'](function(_0x485493){if(_0x485493){logger[_0x94f8('0x2e')](_0x94f8('0x35'),_0x485493);}_0x17bc6c(null,_0x46fd67);});}});}});};AGIVertices[_0x94f8('0x15')][_0x94f8('0x36')]=function(_0x20d2ea,_0x1a9e32){this[_0x94f8('0xf')][_0x94f8('0x37')](_0x20d2ea)['then'](function(_0x15a1ee){_0x1a9e32(null,_0x15a1ee?_0x15a1ee:![]);})[_0x94f8('0x14')](function(_0x2771b1){_0x1a9e32(_0x2771b1);});};AGIVertices['prototype'][_0x94f8('0x38')]=function(_0xed2b27,_0x133ce4){this[_0x94f8('0xf')][_0x94f8('0x38')](_0xed2b27)['then'](function(_0x36a2bb){_0x133ce4(null,_0x36a2bb);})[_0x94f8('0x14')](function(_0x3976ce){_0x133ce4(_0x3976ce);});};AGIVertices[_0x94f8('0x15')][_0x94f8('0x39')]=function(_0x1a5329,_0x357053,_0x4e7545){this[_0x94f8('0xf')][_0x94f8('0x39')]({'uniqueid':this['channel'][_0x94f8('0x3a')],'node':_0x1a5329[_0x94f8('0x3b')],'application':_0x1a5329[_0x94f8('0x3c')],'data':_0x357053||null,'project_name':this[_0x94f8('0x3d')]['arg_1'],'callerid':this[_0x94f8('0x3d')][_0x94f8('0x3e')]})[_0x94f8('0x12')](function(_0x6039a2){if(_0x4e7545){_0x4e7545(null,_0x6039a2);}})[_0x94f8('0x14')](function(_0x5e8240){if(_0x4e7545){_0x4e7545(_0x5e8240);}});};AGIVertices['prototype'][_0x94f8('0x3f')]=function(_0x5b8057,_0x2e60eb,_0x2e857b,_0x49f01c){this['rpc'][_0x94f8('0x3f')]({'uniqueid':this[_0x94f8('0x3d')][_0x94f8('0x3a')],'callerid':this[_0x94f8('0x3d')][_0x94f8('0x3e')],'calleridname':this['channel']['calleridname'],'context':this[_0x94f8('0x3d')][_0x94f8('0x40')],'extension':this[_0x94f8('0x3d')][_0x94f8('0x41')],'priority':this[_0x94f8('0x3d')][_0x94f8('0x42')],'accountcode':this[_0x94f8('0x3d')][_0x94f8('0x43')],'dnid':this[_0x94f8('0x3d')][_0x94f8('0x44')],'projectName':this['channel'][_0x94f8('0x45')],'saveName':_0x2e60eb,'filename':_0x5b8057['file']||_0x2e60eb,'savePath':_0x2e857b})['then'](function(_0x48b5de){_0x49f01c(null,_0x48b5de);})[_0x94f8('0x14')](function(_0x34cde7){_0x49f01c(_0x34cde7);});};AGIVertices[_0x94f8('0x15')][_0x94f8('0x46')]=function(_0x4b2a05,_0x4a3f65,_0x46bc36){this[_0x94f8('0xf')][_0x94f8('0x46')]({'uniqueid':this[_0x94f8('0x3d')][_0x94f8('0x3a')],'body':_0x4b2a05,'direction':_0x4a3f65})[_0x94f8('0x12')](function(_0x474187){if(_0x46bc36){_0x46bc36(null,_0x474187);}})['catch'](function(_0x901ce7){if(_0x46bc36){_0x46bc36(_0x901ce7);}});};AGIVertices[_0x94f8('0x15')][_0x94f8('0x47')]=function(_0x1b8cf9,_0x477f22){this[_0x94f8('0xf')]['createCmContact']({'firstName':_[_0x94f8('0x48')](_0x1b8cf9['name'])||_[_0x94f8('0x49')](_0x1b8cf9['name'])?'callback_'+Math[_0x94f8('0x4a')]():_0x1b8cf9[_0x94f8('0x13')],'lastName':_[_0x94f8('0x48')](_0x1b8cf9['lastName'])||_[_0x94f8('0x49')](_0x1b8cf9[_0x94f8('0x4b')])?null:_0x1b8cf9[_0x94f8('0x4b')],'phone':_0x1b8cf9[_0x94f8('0x4c')],'ListId':_0x1b8cf9[_0x94f8('0x4d')],'scheduledat':_0x1b8cf9[_0x94f8('0x4e')],'callbackUniqueid':this[_0x94f8('0x3d')]['uniqueid'],'tags':_0x94f8('0x4f'),'description':_0x94f8('0x50')+_0x1b8cf9['scheduledAt'][_0x94f8('0x51')](),'priority':_0x1b8cf9[_0x94f8('0x52')]})[_0x94f8('0x12')](function(_0x4df4d8){_0x477f22(null,_0x4df4d8);})['catch'](function(_0x7ff8d9){_0x477f22(_0x7ff8d9);});};AGIVertices[_0x94f8('0x15')][_0x94f8('0x53')]=function(_0x1667a9,_0x290b90){this[_0x94f8('0xf')][_0x94f8('0x54')](_0x1667a9)[_0x94f8('0x12')](function(_0x125c8d){_0x290b90(null,_0x125c8d?_0x125c8d[_0x94f8('0x13')]:![]);})['catch'](function(_0x508d93){_0x290b90(_0x508d93);});};AGIVertices[_0x94f8('0x15')][_0x94f8('0x55')]=function(_0x6bf002,_0x1d0fde,_0x1304f8){var _0x5d20aa={'role':_0x94f8('0x56')};_0x5d20aa[_0x6bf002]=this['channel'][_0x94f8('0x3e')];this[_0x94f8('0xf')]['agentPause'](_0x5d20aa,_0x1d0fde,this[_0x94f8('0x3d')]['uniqueid'])[_0x94f8('0x12')](function(_0x54d6e8){_0x1304f8(null,_[_0x94f8('0x49')](_0x54d6e8)?![]:!![]);})[_0x94f8('0x14')](function(_0x271674){logger[_0x94f8('0x2e')](_0x271674);_0x1304f8(null,![]);});};AGIVertices[_0x94f8('0x15')][_0x94f8('0x57')]=function(_0x5344ac,_0x52ac04){var _0x114df8={'role':_0x94f8('0x56')};_0x114df8[_0x5344ac]=this[_0x94f8('0x3d')][_0x94f8('0x3e')];this['rpc']['agentUnpause'](_0x114df8)[_0x94f8('0x12')](function(_0x50aab5){_0x52ac04(null,_[_0x94f8('0x49')](_0x50aab5)?![]:!![]);})[_0x94f8('0x14')](function(_0x2e6786){logger[_0x94f8('0x2e')](_0x2e6786);_0x52ac04(null,![]);});};AGIVertices[_0x94f8('0x15')][_0x94f8('0x58')]=function(_0x367bd8,_0x498eb2){var _0x2e94c0={'role':'agent'};_0x2e94c0[_0x367bd8]=this[_0x94f8('0x3d')]['callerid'];this[_0x94f8('0xf')]['agentLogout'](_0x2e94c0)['then'](function(_0x1794fd){_0x498eb2(null,_['isNil'](_0x1794fd)?![]:!![]);})[_0x94f8('0x14')](function(_0x12a2a3){logger[_0x94f8('0x2e')](_0x12a2a3);_0x498eb2(null,![]);});};AGIVertices['prototype'][_0x94f8('0x59')]=function(_0x2491ae,_0x2efb92){var _0x14736c={'role':_0x94f8('0x56')};_0x14736c[_0x2491ae]=this[_0x94f8('0x3d')][_0x94f8('0x3e')];var _0x5493de=_0x2491ae!=_0x94f8('0x5a')?util['format'](_0x94f8('0x5b'),'LOCAL',this['channel'][_0x94f8('0x3e')]):undefined;this[_0x94f8('0xf')]['agentLogin'](_0x14736c,_0x5493de)[_0x94f8('0x12')](function(_0x1deb03){_0x2efb92(null,_[_0x94f8('0x49')](_0x1deb03)?![]:!![]);})['catch'](function(_0xa8813e){logger['error'](_0xa8813e);_0x2efb92(null,![]);});};AGIVertices[_0x94f8('0x15')][_0x94f8('0x5c')]=function(_0x35c8d4,_0x5d9ef4){sh['exec'](_[_0x94f8('0x5d')](_0x35c8d4),function(_0x53187b,_0x25dbc9){var _0x4edb37=_0x25dbc9[_0x94f8('0x5e')](/(\r\n|\n|\r)/gm,'');_0x5d9ef4(null,_0x4edb37);});};AGIVertices[_0x94f8('0x15')][_0x94f8('0x5f')]=function(_0x16d6b3,_0x329eb5){scripts[_0x94f8('0x5f')](_0x16d6b3[_0x94f8('0x60')],_0x16d6b3[_0x94f8('0x61')]||_0x94f8('0x62'),_0x16d6b3[_0x94f8('0x62')],_0x16d6b3[_0x94f8('0x63')]||_0x94f8('0x64'),_0x16d6b3['ssmlGender']||_0x94f8('0x65'),_0x16d6b3[_0x94f8('0x66')]||_0x94f8('0x67'))[_0x94f8('0x12')](function(_0x24a6d7){_0x329eb5(null,_0x24a6d7);})[_0x94f8('0x14')](function(_0x107d76){_0x329eb5(_0x107d76);});};AGIVertices[_0x94f8('0x15')]['googleTTS']=function(_0x5cd83b,_0x3041fb){scripts['googleTTS'](_0x5cd83b[_0x94f8('0x62')],_0x5cd83b[_0x94f8('0x68')]||'en',0x1)[_0x94f8('0x12')](function(_0xf47579){_0x3041fb(null,_0xf47579);})[_0x94f8('0x14')](function(_0x5e0ee8){_0x3041fb(_0x5e0ee8);});};AGIVertices[_0x94f8('0x15')][_0x94f8('0x69')]=function(_0x5cefe1,_0x5ee3d4){var _0x267f8b={'uri':_0x5cefe1[_0x94f8('0x6a')],'method':_0x5cefe1['method'],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5cefe1[_0x94f8('0x6b')])==='number'&&parseInt(_0x5cefe1[_0x94f8('0x6b')])>=0x1?parseInt(_0x5cefe1[_0x94f8('0x6b')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x94f8('0x6c'),_0x94f8('0x6d')],_0x267f8b[_0x94f8('0x6e')]['toUpperCase']())){try{_0x267f8b[_0x94f8('0x6f')]=_0x5cefe1[_0x94f8('0xc')]?JSON['parse'](_0x5cefe1[_0x94f8('0xc')]):{};}catch(_0x4002f4){logger[_0x94f8('0x2e')](_0x94f8('0x70'),_0x4002f4);}}try{_0x267f8b[_0x94f8('0x71')]=_0x5cefe1[_0x94f8('0xb')]?JSON['parse'](_0x5cefe1[_0x94f8('0xb')]):{};}catch(_0x221cd0){logger[_0x94f8('0x2e')](_0x94f8('0x72'),_0x221cd0);}if(_0x5cefe1[_0x94f8('0x73')]){try{var _0x235059=require(_0x5cefe1[_0x94f8('0x73')])[_0x94f8('0x74')](this,_0x267f8b);_0x267f8b[_0x94f8('0x75')]=Mustache[_0x94f8('0x76')](_0x5cefe1[_0x94f8('0x6a')],_0x235059,{},['$$','$$']);if(_0x267f8b[_0x94f8('0x71')]){_0x267f8b[_0x94f8('0x71')]=JSON[_0x94f8('0x77')](Mustache['render'](JSON[_0x94f8('0x78')](_0x267f8b[_0x94f8('0x71')]),_0x235059,{},['$$','$$']));}if(_0x267f8b['body']){_0x267f8b[_0x94f8('0x6f')]=JSON[_0x94f8('0x77')](Mustache[_0x94f8('0x76')](JSON[_0x94f8('0x78')](_0x267f8b[_0x94f8('0x6f')]),_0x235059,{},['$$','$$']));}}catch(_0x5a2b78){logger[_0x94f8('0x2e')](_0x94f8('0x79'),_0x5a2b78);}}rp(_0x267f8b)[_0x94f8('0x12')](function(_0x2bfd3b){var _0x2d3160={'statusCode':_0x2bfd3b[_0x94f8('0x7a')]||0xc8,'statusMessage':_0x2bfd3b[_0x94f8('0x7b')]||'OK','headers':_0x2bfd3b['headers']||{},'body':_0x2bfd3b[_0x94f8('0x6f')]||{}};_0x5ee3d4(null,_0x2d3160);})[_0x94f8('0x14')](function(_0x1b95bc){var _0x248b6b={'statusCode':_0x1b95bc[_0x94f8('0x7a')]||0x1f4,'statusMessage':_0x1b95bc['message']||_0x94f8('0x7c'),'headers':_0x1b95bc[_0x94f8('0x7d')][_0x94f8('0x71')]||{},'body':_0x1b95bc[_0x94f8('0x7d')][_0x94f8('0x6f')]||{}};_0x5ee3d4(null,_0x248b6b);});};AGIVertices['prototype'][_0x94f8('0x7e')]=function(_0x2e1350,_0x2b2c97){scripts[_0x94f8('0x7e')](this[_0x94f8('0x3d')][_0x94f8('0x3a')],_0x2e1350[_0x94f8('0x7f')],_0x2e1350[_0x94f8('0x62')],_0x2e1350[_0x94f8('0x80')]||'en')[_0x94f8('0x12')](function(_0x5973b7){_0x2b2c97(null,_0x5973b7);})[_0x94f8('0x14')](function(_0x587083){_0x2b2c97(_0x587083);});};AGIVertices[_0x94f8('0x15')][_0x94f8('0x81')]=function(_0x28b80d,_0x701449){scripts[_0x94f8('0x81')](this['channel'],_0x28b80d)[_0x94f8('0x12')](function(_0x4694a4){_0x701449(null,_0x4694a4);})[_0x94f8('0x14')](function(_0x2a7989){_0x701449(_0x2a7989);});};AGIVertices[_0x94f8('0x15')][_0x94f8('0x82')]=function(_0x46fcb5,_0x323a89){scripts[_0x94f8('0x82')](_0x46fcb5[_0x94f8('0x7f')],_0x46fcb5['text'],_0x46fcb5['ispeech_tts_language']||_0x94f8('0x64'),_0x46fcb5[_0x94f8('0x83')])[_0x94f8('0x12')](function(_0x4eabf0){_0x323a89(null,_0x4eabf0);})[_0x94f8('0x14')](function(_0x19c56c){_0x323a89(_0x19c56c);});};AGIVertices[_0x94f8('0x15')]['ispeechASR']=function(_0x32f678,_0x5efc47,_0x7dc48c){scripts['ispeechASR'](_0x5efc47,_0x32f678[_0x94f8('0x7f')],_0x32f678['ispeech_asr_language']||_0x94f8('0x64'),this[_0x94f8('0x84')](_0x32f678[_0x94f8('0x85')])?_0x32f678[_0x94f8('0x85')]:undefined)[_0x94f8('0x12')](function(_0x26d67b){_0x7dc48c(null,_0x26d67b);})[_0x94f8('0x14')](function(_0x41ac15){_0x7dc48c(_0x41ac15);});};AGIVertices[_0x94f8('0x15')][_0x94f8('0x86')]=function(_0x4c8ffe,_0x407921){scripts[_0x94f8('0x86')](_0x4c8ffe[_0x94f8('0x87')],_0x4c8ffe[_0x94f8('0x88')],_0x4c8ffe[_0x94f8('0x89')],_0x4c8ffe[_0x94f8('0x8a')]||_0x94f8('0x8b'),_0x4c8ffe[_0x94f8('0x62')],_0x4c8ffe['aws_text_type']||_0x94f8('0x62'))[_0x94f8('0x12')](function(_0x4f242d){_0x407921(null,_0x4f242d);})['catch'](function(_0x396fe8){_0x407921(_0x396fe8);});};AGIVertices['prototype'][_0x94f8('0x8c')]=function(_0x146f76,_0x2be811){scripts['awsLex'](this[_0x94f8('0x3d')]['uniqueid'],_0x146f76['aws_access_key_id'],_0x146f76[_0x94f8('0x88')],_0x146f76[_0x94f8('0x8d')],_0x146f76['text'],_0x146f76['aws_bot_name'])[_0x94f8('0x12')](function(_0x44340c){_0x2be811(null,_0x44340c);})[_0x94f8('0x14')](function(_0x3002c5){_0x2be811(_0x3002c5);});};AGIVertices[_0x94f8('0x15')]['googleASR']=function(_0x10f6a7,_0x3b2eec,_0x5a052f){scripts[_0x94f8('0x8e')](_0x3b2eec,_0x10f6a7[_0x94f8('0x7f')],_0x10f6a7[_0x94f8('0x8f')]||'en-US')[_0x94f8('0x12')](function(_0x1bcfe8){_0x5a052f(null,_0x1bcfe8);})[_0x94f8('0x14')](function(_0x4ed798){_0x5a052f(_0x4ed798);});};AGIVertices[_0x94f8('0x15')][_0x94f8('0x90')]=function(_0x3c049b,_0xcca494,_0x5cad0e){scripts[_0x94f8('0x90')](_0xcca494,_0x3c049b[_0x94f8('0x91')],_0x3c049b[_0x94f8('0x92')],_0x3c049b[_0x94f8('0x75')])['then'](function(_0x444d29){_0x5cad0e(null,_0x444d29);})[_0x94f8('0x14')](function(_0x124359){_0x5cad0e(_0x124359);});};AGIVertices[_0x94f8('0x15')][_0x94f8('0x93')]=function(_0x2112f0){var _0x1d45b7=_[_0x94f8('0x94')](verticesWithRetry,_0x2112f0[_0x94f8('0x3c')])?_0x2112f0:_[_0x94f8('0x95')](_0x2112f0);for(var _0x24248e in _0x1d45b7){if(_0x1d45b7[_0x94f8('0x96')](_0x24248e)){if(_0x1d45b7[_0x24248e]&&_[_0x94f8('0x97')](_0x1d45b7[_0x24248e])){if(_[_0x94f8('0x94')](recursiveMapAttributes,_0x24248e)){_0x1d45b7[_0x24248e]=this[_0x94f8('0x98')](_0x1d45b7[_0x24248e]);}else{_0x1d45b7[_0x24248e]=this[_0x94f8('0x99')](_0x1d45b7[_0x24248e]);}}}}return _0x1d45b7;};AGIVertices[_0x94f8('0x15')][_0x94f8('0x9a')]=function(_0xc52d6f){for(var _0x3c86f6 in _0xc52d6f){if(_0xc52d6f[_0x94f8('0x96')](_0x3c86f6)){if(_[_0x94f8('0x9b')](_0xc52d6f[_0x3c86f6])){this[_0x94f8('0x9a')](_0xc52d6f[_0x3c86f6]);}else if(_[_0x94f8('0x9c')](_0xc52d6f[_0x3c86f6])){for(var _0x1f1e0a=0x0;_0x1f1e0a<_0xc52d6f[_0x3c86f6][_0x94f8('0x9d')];_0x1f1e0a++){this[_0x94f8('0x9a')](_0xc52d6f[_0x3c86f6][_0x1f1e0a]);}}else if(_['isString'](_0xc52d6f[_0x3c86f6])){_0xc52d6f[_0x3c86f6]=this['replaceAllVariables'](_0xc52d6f[_0x3c86f6]);}}}};AGIVertices[_0x94f8('0x15')]['saveRestApiResult']=function(_0x384349,_0x3c903a){for(var _0x509cc0 in _0x384349){if(_0x384349[_0x94f8('0x96')](_0x509cc0)){if(_[_0x94f8('0x9b')](_0x384349[_0x509cc0])){if(!_[_0x94f8('0x48')](_0x384349[_0x509cc0])){this[_0x94f8('0x9e')](_0x384349[_0x509cc0],util[_0x94f8('0x9f')](_0x94f8('0xa0'),_0x3c903a,_0x509cc0));}}else if(_[_0x94f8('0x9c')](_0x384349[_0x509cc0])){for(var _0x386c8b=0x0;_0x386c8b<_0x384349[_0x509cc0][_0x94f8('0x9d')];_0x386c8b++){this[_0x94f8('0x9e')](_0x384349[_0x509cc0][_0x386c8b],util[_0x94f8('0x9f')](_0x94f8('0xa0'),_0x3c903a,_0x509cc0+'['+_0x386c8b+']'));}}else{if(!_[_0x94f8('0x49')](_0x384349[_0x509cc0])){this[_0x94f8('0x3d')]['setVariable'](util[_0x94f8('0x9f')](_0x94f8('0xa0'),_0x3c903a,_0x509cc0),_0x384349[_0x509cc0]);}}}}};AGIVertices[_0x94f8('0x15')][_0x94f8('0x98')]=function(_0x4ecc90){try{var _0x2c61b5=JSON['parse'](_0x4ecc90);this[_0x94f8('0x9a')](_0x2c61b5);return JSON[_0x94f8('0x78')](_0x2c61b5);}catch(_0x12a1f5){return this[_0x94f8('0x99')](_0x4ecc90);}};AGIVertices['prototype'][_0x94f8('0x99')]=function(_0xc1077b){var _0x3562ac=_0xc1077b[_0x94f8('0xa1')]('{');for(var _0x5bdfc5=0x1;_0x5bdfc5<_0x3562ac[_0x94f8('0x9d')];_0x5bdfc5+=0x1){var _0x45471f=_0x3562ac[_0x5bdfc5][_0x94f8('0xa1')]('}');if(_0x45471f['length']>0x1){_0xc1077b=_0xc1077b[_0x94f8('0xa2')]('{'+_0x45471f[0x0]+'}',this[_0x94f8('0x3d')][_0x94f8('0x10')](_0x45471f[0x0])[_0x94f8('0xa3')]||_0x45471f[0x0]);}}if(_0x3562ac[_0x94f8('0x9d')]===0x1){return _0xc1077b['toString']();}return this[_0x94f8('0x99')](_0xc1077b);};AGIVertices[_0x94f8('0x15')][_0x94f8('0xa4')]=function(_0x4c619b,_0x592574){var _0x3d4c16=this[_0x94f8('0x3d')][_0x94f8('0x10')](_0x4c619b);if(_0x3d4c16[_0x94f8('0xa5')]===-0x1){return _0x3d4c16;}logger[_0x94f8('0x33')](util[_0x94f8('0x9f')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x592574,_0x3d4c16[_0x94f8('0xa3')]));return this[_0x94f8('0x3d')]['setVariable'](_0x592574,_0x3d4c16[_0x94f8('0xa3')]);};AGIVertices[_0x94f8('0x15')][_0x94f8('0x84')]=function(_0x314c8d){return _0x314c8d&&_0x314c8d!=='0'&&_0x314c8d!=='-1'&&_0x314c8d!=='';};AGIVertices['prototype'][_0x94f8('0xa6')]=function(_0x64977){this['createSquareDetailsReport'][_0x94f8('0x74')](this,_0x64977,'-');_0x64977[_0x94f8('0xa7')]=_0x64977[_0x94f8('0xa6')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x94f8('0x15')]['agi']=function(_0x442304){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0xa8'),_0x442304[_0x94f8('0x3b')]));return this[_0x94f8('0x3d')][_0x94f8('0x7')]([_0x442304[_0x94f8('0xa9')],_0x442304[_0x94f8('0xaa')]]);};AGIVertices[_0x94f8('0x15')][_0x94f8('0xab')]=function(_0x311570){logger[_0x94f8('0x33')](util['format'](_0x94f8('0xac'),_0x311570['label']));if(this[_0x94f8('0x84')](_0x311570[_0x94f8('0x6b')])){logger[_0x94f8('0x33')](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x311570[_0x94f8('0x6b')]));var _0x5acbc6=this[_0x94f8('0x3d')]['wait'](_0x311570['timeout']);if(_0x5acbc6[_0x94f8('0xa5')]===-0x1){return _0x5acbc6;}}return this[_0x94f8('0x3d')][_0x94f8('0xab')]();};AGIVertices[_0x94f8('0x15')][_0x94f8('0x4f')]=function(_0x25bab9){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x25bab9['label']));if(!this[_0x94f8('0x84')](_0x25bab9['list_id'])){return this[_0x94f8('0x3d')]['error'](_0x25bab9,'no\x20list\x20selected');}_0x25bab9[_0x94f8('0x4e')]=moment();if(this[_0x94f8('0x84')](_0x25bab9[_0x94f8('0xad')])){_0x25bab9['scheduledAt']=moment()[_0x94f8('0xae')](_0x25bab9[_0x94f8('0xad')],_0x94f8('0xaf'));}if(!this[_0x94f8('0x84')](_0x25bab9[_0x94f8('0x52')])){_0x25bab9[_0x94f8('0x52')]=0x2;}this['createCmContact'][_0x94f8('0x74')](this,_0x25bab9);return this[_0x94f8('0x3d')]['noop'](util[_0x94f8('0x9f')](_0x94f8('0xb0'),_0x25bab9[_0x94f8('0x4c')],_0x25bab9[_0x94f8('0x4d')],_0x25bab9[_0x94f8('0x4e')]));};AGIVertices[_0x94f8('0x15')][_0x94f8('0xb1')]=function(_0x4d25c8){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0xb2'),_0x4d25c8[_0x94f8('0x3b')]));var _0x848511=this['channel'][_0x94f8('0xb3')](_0x4d25c8[_0x94f8('0xb4')],_0x4d25c8['options']);if(_0x848511[_0x94f8('0xa5')]===-0x1){return _0x848511;}return this[_0x94f8('0x3d')][_0x94f8('0xb5')](util[_0x94f8('0x9f')](_0x94f8('0xb6'),_0x4d25c8[_0x94f8('0xb4')],_0x4d25c8[_0x94f8('0x7d')]));};AGIVertices[_0x94f8('0x15')]['lumenvoxtts']=function(_0x502620){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0xb7'),_0x502620[_0x94f8('0x3b')]));if(!this[_0x94f8('0x84')](_0x502620[_0x94f8('0x62')])){return this[_0x94f8('0x3d')][_0x94f8('0xb5')]('no\x20text\x20configured');}var _0x4fcaee='\x22'+_0x502620[_0x94f8('0x62')]+'\x22';if(this[_0x94f8('0x84')](_0x502620[_0x94f8('0x7d')])){_0x4fcaee+=','+_0x502620['options'];}var _0x3d4c00=this[_0x94f8('0x3d')][_0x94f8('0xb3')](_0x94f8('0xb8'),_0x4fcaee);if(_0x3d4c00[_0x94f8('0xa5')]===-0x1){return _0x3d4c00;}return this['channel'][_0x94f8('0xb5')](util[_0x94f8('0x9f')](_0x94f8('0xb9'),_0x4fcaee));};AGIVertices[_0x94f8('0x15')][_0x94f8('0xba')]=function(_0x2822d0){logger['info'](util[_0x94f8('0x9f')](_0x94f8('0xbb'),_0x2822d0['label']));if(!this[_0x94f8('0x84')](_0x2822d0[_0x94f8('0x62')])){return this[_0x94f8('0x3d')]['noop'](_0x94f8('0xbc'));}var _0x4a1a63='\x22'+_0x2822d0[_0x94f8('0x62')]+'\x22';if(this[_0x94f8('0x84')](_0x2822d0[_0x94f8('0x7d')])){_0x4a1a63+=','+_0x2822d0[_0x94f8('0x7d')];}var _0x34a597=this['channel'][_0x94f8('0xb3')](_0x94f8('0xb8'),_0x4a1a63);if(_0x34a597[_0x94f8('0xa5')]===-0x1){return _0x34a597;}return this['channel'][_0x94f8('0xb5')](util[_0x94f8('0x9f')](_0x94f8('0xb9'),_0x4a1a63));};AGIVertices[_0x94f8('0x15')][_0x94f8('0xbd')]=function(_0x47e11c){logger[_0x94f8('0x33')](util['format'](_0x94f8('0xbe'),_0x47e11c[_0x94f8('0x3b')]));if(!this[_0x94f8('0x84')](_0x47e11c['grammar'])){return this[_0x94f8('0x3d')][_0x94f8('0xb5')](_0x94f8('0xbf'));}var _0x353b48=_0x47e11c[_0x94f8('0xc0')];if(this[_0x94f8('0x84')](_0x47e11c[_0x94f8('0x7d')])){_0x353b48+=','+_0x47e11c[_0x94f8('0x7d')];}var _0x5c199f=this[_0x94f8('0x3d')][_0x94f8('0xb3')]('MRCPRecog',_0x353b48);if(_0x5c199f['result']===-0x1){return _0x5c199f;}var _0x22e19b=this[_0x94f8('0xa4')]('RECOG_CONFIDENCE()',_0x94f8('0xc1'));if(_0x22e19b['result']===-0x1){return _0x22e19b;}var _0x566f25=this[_0x94f8('0xa4')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x566f25[_0x94f8('0xa5')]===-0x1){return _0x566f25;}var _0x3d4eee=this['getAndSetVariable'](_0x94f8('0xc2'),_0x94f8('0xc3'));if(_0x3d4eee[_0x94f8('0xa5')]===-0x1){return _0x3d4eee;}return this[_0x94f8('0x3d')][_0x94f8('0xb5')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x353b48));};AGIVertices[_0x94f8('0x15')][_0x94f8('0xc4')]=function(_0x1261ad){logger[_0x94f8('0x33')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x1261ad[_0x94f8('0x3b')]));if(!this[_0x94f8('0x84')](_0x1261ad[_0x94f8('0xc0')])){return this[_0x94f8('0x3d')]['noop']('no\x20grammar\x20configured');}var _0x4e9e76=_0x1261ad[_0x94f8('0xc0')];if(this[_0x94f8('0x84')](_0x1261ad[_0x94f8('0x7d')])){_0x4e9e76+=','+_0x1261ad[_0x94f8('0x7d')];}var _0x300416=this[_0x94f8('0x3d')]['exec'](_0x94f8('0xc5'),_0x4e9e76);if(_0x300416['result']===-0x1){return _0x300416;}var _0x1e2110=this[_0x94f8('0xa4')](_0x94f8('0xc6'),_0x94f8('0xc7'));if(_0x1e2110[_0x94f8('0xa5')]===-0x1){return _0x1e2110;}var _0x2af1b0=this[_0x94f8('0xa4')](_0x94f8('0xc8'),'SESTEK_ASR_TRANSCRIPT');if(_0x2af1b0[_0x94f8('0xa5')]===-0x1){return _0x2af1b0;}var _0xdbbbc5=this[_0x94f8('0xa4')]('RECOG_INSTANCE()',_0x94f8('0xc9'));if(_0xdbbbc5[_0x94f8('0xa5')]===-0x1){return _0xdbbbc5;}return this[_0x94f8('0x3d')][_0x94f8('0xb5')](util['format'](_0x94f8('0xca'),_0x4e9e76));};AGIVertices[_0x94f8('0x15')][_0x94f8('0xcb')]=function(_0x1ec355){logger[_0x94f8('0x33')](util['format'](_0x94f8('0xcc'),_0x1ec355[_0x94f8('0x3b')]));if(!this[_0x94f8('0x84')](_0x1ec355['odbc_id'])){return this['channel'][_0x94f8('0x2e')](_0x1ec355,_0x94f8('0xcd'));}var _0x340d0e=this[_0x94f8('0x19')][_0x94f8('0x74')](this,_0x1ec355[_0x94f8('0xce')]);if(!_0x340d0e){return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x1ec355,_0x94f8('0xcf'));}if(!this[_0x94f8('0x84')](_0x1ec355[_0x94f8('0x31')])){return this[_0x94f8('0x3d')]['error'](_0x1ec355,'no\x20query\x20configured');}var _0x39a5fc=_0x1ec355[_0x94f8('0x31')][_0x94f8('0x5e')](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util['format'](_0x94f8('0xd0'),_0x39a5fc));var _0x3b9ad3=this[_0x94f8('0x2c')]['sync'](this,_0x340d0e,_0x39a5fc);this['createSquareDetailsReport'][_0x94f8('0x74')](this,_0x1ec355,_0x39a5fc);if(!this['isConfigured'](_0x1ec355[_0x94f8('0xd1')])){return this['channel'][_0x94f8('0xb5')](_0x94f8('0xd2'));}var _0xd6e5f6=this['getVariable'][_0x94f8('0x74')](this,_0x1ec355[_0x94f8('0xd1')]);if(!_0xd6e5f6){return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x1ec355,_0x94f8('0xd3'));}var _0x1f6908=this;_0x3b9ad3['forEach'](function(_0x4dc329,_0xd47690){Object['keys'](_0x4dc329)[_0x94f8('0xd4')](function(_0x51bc7f){_0x1f6908[_0x94f8('0x3d')][_0x94f8('0xd5')](util['format'](_0x94f8('0xd6'),_0xd6e5f6,_0xd47690,_0x51bc7f),_0x4dc329[_0x51bc7f]);});});this[_0x94f8('0x3d')]['setVariable'](util[_0x94f8('0x9f')](_0x94f8('0xd7'),_0xd6e5f6),_0x3b9ad3['length']);return this[_0x94f8('0x3d')][_0x94f8('0xb5')](util[_0x94f8('0x9f')]('variable\x20%s\x20set',_0xd6e5f6));};AGIVertices[_0x94f8('0x15')]['dial']=function(_0x864708){logger[_0x94f8('0xd8')](util[_0x94f8('0x9f')](_0x94f8('0xd9'),_0x864708[_0x94f8('0x3b')]));if(!this[_0x94f8('0x84')](_0x864708[_0x94f8('0xda')])){return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x864708,'no\x20user\x20selected');}var _0x1f91eb=this[_0x94f8('0xdb')][_0x94f8('0x74')](this,_0x864708[_0x94f8('0xda')]);if(!_0x1f91eb){return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x864708,'no\x20user\x20found');}var _0x108b28=this['channel'][_0x94f8('0xb3')](_0x94f8('0xdc'),[util[_0x94f8('0x9f')](_0x94f8('0xdd'),_0x1f91eb),_0x864708[_0x94f8('0x6b')],_0x864708[_0x94f8('0xde')],_0x864708[_0x94f8('0x6a')]]);if(_0x108b28[_0x94f8('0xa5')]===-0x1){return _0x108b28;}return this[_0x94f8('0x3d')][_0x94f8('0xb5')](util['format']('Executed\x20command\x20%s',_0x94f8('0xdc')));};AGIVertices[_0x94f8('0x15')]['dialogflow']=function(_0x4aee9f){logger[_0x94f8('0x33')](util['format'](_0x94f8('0xdf'),_0x4aee9f[_0x94f8('0x3b')]));if(!this[_0x94f8('0x84')](_0x4aee9f[_0x94f8('0x7f')])){return this[_0x94f8('0x3d')][_0x94f8('0xb5')](_0x94f8('0xe0'));}if(!this[_0x94f8('0x84')](_0x4aee9f[_0x94f8('0x62')])){return this[_0x94f8('0x3d')][_0x94f8('0xb5')]('no\x20text\x20configured');}this[_0x94f8('0x3d')]['bot']=!![];this[_0x94f8('0x39')](_0x4aee9f);this['createSquareMessage'](_0x4aee9f[_0x94f8('0x62')],'in');this[_0x94f8('0x3d')]['noop'](util[_0x94f8('0x9f')](_0x94f8('0xe1'),_0x4aee9f[_0x94f8('0x62')]));var _0x2a3f98=this[_0x94f8('0x7e')][_0x94f8('0x74')](this,_0x4aee9f);if(_0x2a3f98){for(var _0x18a95e in _0x2a3f98){if(_0x2a3f98[_0x94f8('0x96')](_0x18a95e)){this[_0x94f8('0x3d')][_0x94f8('0xd5')](util[_0x94f8('0x9f')](_0x94f8('0xe2'),_0x18a95e['toUpperCase']()),_0x2a3f98[_0x18a95e]);}}this[_0x94f8('0x46')](_0x2a3f98[_0x94f8('0xe3')],'out');return this['channel'][_0x94f8('0xb5')](util[_0x94f8('0x9f')](_0x94f8('0xe4'),_0x2a3f98['speech']));}return this[_0x94f8('0x3d')]['error'](_0x4aee9f,_0x94f8('0xe5'));};AGIVertices['prototype'][_0x94f8('0xe6')]=function(_0x4b311a){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0xe7'),_0x4b311a[_0x94f8('0x3b')]));if(!this[_0x94f8('0x84')](_0x4b311a[_0x94f8('0xe8')])){return this[_0x94f8('0x3d')][_0x94f8('0xb5')](_0x94f8('0xe9'));}if(!this[_0x94f8('0x84')](_0x4b311a[_0x94f8('0xea')])){return this[_0x94f8('0x3d')][_0x94f8('0xb5')](_0x94f8('0xeb'));}if(!this['isConfigured'](_0x4b311a[_0x94f8('0xec')])){return this[_0x94f8('0x3d')][_0x94f8('0xb5')](_0x94f8('0xed'));}if(!this['isConfigured'](_0x4b311a[_0x94f8('0xee')])){return this[_0x94f8('0x3d')]['noop'](_0x94f8('0xbc'));}this[_0x94f8('0x3d')][_0x94f8('0xef')]=!![];this[_0x94f8('0x39')](_0x4b311a);this[_0x94f8('0x46')](_0x4b311a[_0x94f8('0x62')],'in');this[_0x94f8('0x3d')][_0x94f8('0xb5')](util[_0x94f8('0x9f')]('Trying\x20SestekNDA:\x20%s',_0x4b311a[_0x94f8('0x62')]));var _0x26998c=this[_0x94f8('0x81')][_0x94f8('0x74')](this,_0x4b311a);if(_0x26998c){for(var _0x2e8671 in _0x26998c){if(_0x26998c[_0x94f8('0x96')](_0x2e8671)){this[_0x94f8('0x3d')][_0x94f8('0xd5')](util[_0x94f8('0x9f')](_0x94f8('0xf0'),_0x2e8671[_0x94f8('0xf1')]()),_0x26998c[_0x2e8671]);}}this[_0x94f8('0x46')](_0x26998c['speech'],_0x94f8('0xf2'));if(_0x26998c[_0x94f8('0xf3')]){this[_0x94f8('0x3d')]['noop'](util[_0x94f8('0x9f')](_0x94f8('0xf4'),_0x26998c['audiofile']));var _0x54e838=this[_0x94f8('0x3d')][_0x94f8('0xf5')](_0x26998c[_0x94f8('0xf3')]);try{fs[_0x94f8('0xf6')](_0x26998c[_0x94f8('0xf3')]+_0x94f8('0xf7'));}catch(_0x49b1b8){logger['error'](_0x49b1b8);}return _0x54e838;}else{return this[_0x94f8('0x3d')][_0x94f8('0xb5')](util[_0x94f8('0x9f')](_0x94f8('0xf8'),_0x26998c['speech']));}}return this[_0x94f8('0x3d')]['error'](_0x4b311a,_0x94f8('0xf9'));};AGIVertices[_0x94f8('0x15')][_0x94f8('0xfa')]=function(_0x1807eb){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0xfb'),_0x1807eb['label']));return this[_0x94f8('0x3d')][_0x94f8('0xb5')](_0x94f8('0xfa'));};AGIVertices[_0x94f8('0x15')]['ext_dial']=function(_0x18e129){logger[_0x94f8('0x33')](util['format'](_0x94f8('0xfc'),_0x18e129[_0x94f8('0x3b')]));var _0xddcd5='';if(_0x18e129[_0x94f8('0xfd')]){if(!this[_0x94f8('0x84')](_0x18e129['trunk_id'])){return this['channel']['error'](_0x18e129,_0x94f8('0xfe'));}else{var _0x3d1f38=parseInt(_0x18e129['trunk_id'],0xa);if(isNaN(_0x3d1f38)){_0xddcd5=_0x18e129[_0x94f8('0xfd')];}else{_0xddcd5=this['getTrunk'][_0x94f8('0x74')](this,_0x18e129[_0x94f8('0xfd')]);if(!_0xddcd5){return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x18e129,_0x94f8('0xff'));}}}}else if(_0x18e129['trunk_name']){_0xddcd5=_0x18e129[_0x94f8('0x100')];}else{return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x18e129,_0x94f8('0xfe'));}var _0x556b6d=this['channel'][_0x94f8('0xb3')](_0x94f8('0xdc'),[util[_0x94f8('0x9f')](_0x94f8('0x101'),_0xddcd5,_0x18e129['phone']),_0x18e129[_0x94f8('0x6b')],_0x18e129[_0x94f8('0xde')],_0x18e129['url']]);if(_0x556b6d[_0x94f8('0xa5')]===-0x1){return _0x556b6d;}return this[_0x94f8('0x3d')][_0x94f8('0xb5')](util[_0x94f8('0x9f')](_0x94f8('0x102'),_0x94f8('0xdc')));};AGIVertices[_0x94f8('0x15')][_0x94f8('0x103')]=function(_0x24abe2){logger['info'](util[_0x94f8('0x9f')](_0x94f8('0x104'),_0x24abe2['label']));return this[_0x94f8('0x3d')][_0x94f8('0xb5')]('finally');};AGIVertices[_0x94f8('0x15')]['getdigits']=function(_0x4fcd2b){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0x105'),_0x4fcd2b[_0x94f8('0x3b')]));if(_0x4fcd2b['retry']===0x0){return this[_0x94f8('0xa6')](_0x4fcd2b);}_0x4fcd2b[_0x94f8('0xa7')]-=0x1;if(!this[_0x94f8('0x84')](_0x4fcd2b[_0x94f8('0x106')])){return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x4fcd2b,_0x94f8('0x107'));}var _0x3328b1=this[_0x94f8('0x1e')][_0x94f8('0x74')](this,_0x4fcd2b[_0x94f8('0x106')]);if(!_0x3328b1){return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x4fcd2b,_0x94f8('0x108'));}if(!this[_0x94f8('0x84')](_0x4fcd2b['variable_id'])){return this[_0x94f8('0x3d')][_0x94f8('0x2e')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x27dbc3=this[_0x94f8('0x3d')][_0x94f8('0x109')](_0x3328b1,_0x4fcd2b[_0x94f8('0x10a')],_0x4fcd2b[_0x94f8('0x10b')]);var _0x175c7d=_0x27dbc3['result']?_0x27dbc3[_0x94f8('0xa5')]['toString']():'';logger['info'](_0x94f8('0x10c'),JSON[_0x94f8('0x78')](_0x27dbc3));if(_0x27dbc3['result']===-0x1){this[_0x94f8('0x39')][_0x94f8('0x74')](this,_0x4fcd2b,_0x175c7d);return _0x27dbc3;}else if(_0x27dbc3[_0x94f8('0xa3')]===_0x94f8('0x6b')){_0x27dbc3['result']=_0x175c7d[_0x94f8('0x9d')]>=parseInt(_0x4fcd2b[_0x94f8('0x10d')])?'x':'i';}else{_0x27dbc3[_0x94f8('0xa5')]=_0x175c7d[_0x94f8('0x9d')]>=parseInt(_0x4fcd2b[_0x94f8('0x10d')])&&_0x175c7d[_0x94f8('0x9d')]<=parseInt(_0x4fcd2b[_0x94f8('0x10b')])?'x':'i';}var _0x22ae9a=this[_0x94f8('0x10')]['sync'](this,_0x4fcd2b[_0x94f8('0xd1')]);if(!_0x22ae9a){return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x4fcd2b,_0x94f8('0xd3'));}this[_0x94f8('0x3d')]['setVariable'](_0x22ae9a,_0x175c7d);if(this[_0x94f8('0x84')](_0x4fcd2b[_0x94f8('0x10e')])){var _0x84134f=parseInt(_0x4fcd2b[_0x94f8('0x10e')],0xa);var _0x163a96=rs[_0x94f8('0x10f')]({'charset':'*','length':_0x84134f});var _0x22be34=_0x175c7d[_0x94f8('0x9d')];if(_0x22be34>0x0){if(_0x22be34>_0x84134f){this[_0x94f8('0x39')][_0x94f8('0x74')](this,_0x4fcd2b,_0x4fcd2b[_0x94f8('0x110')]===_0x94f8('0x111')?_0x163a96+_0x175c7d[_0x94f8('0x112')](_0x84134f):_0x175c7d[_0x94f8('0x112')](0x0,_0x22be34-_0x84134f)+_0x163a96);}else{this[_0x94f8('0x39')][_0x94f8('0x74')](this,_0x4fcd2b,rs[_0x94f8('0x10f')]({'charset':'*','length':_0x22be34}));}}else{this['createSquareDetailsReport']['sync'](this,_0x4fcd2b,'');}}else{this[_0x94f8('0x39')][_0x94f8('0x74')](this,_0x4fcd2b,_0x175c7d);}return _0x27dbc3;};AGIVertices[_0x94f8('0x15')][_0x94f8('0xe')]=function(_0x2d8425){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0x113'),_0x2d8425['label']));return this[_0x94f8('0xd')](_0x2d8425);};AGIVertices[_0x94f8('0x15')][_0x94f8('0x114')]=function(_0x3fb3e3){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0x115'),_0x3fb3e3[_0x94f8('0x3b')]));this[_0x94f8('0x39')]['sync'](this,_0x3fb3e3,_0x3fb3e3[_0x94f8('0x116')]);return this[_0x94f8('0x3d')][_0x94f8('0xb5')](util['format'](_0x94f8('0x117'),_0x3fb3e3[_0x94f8('0x116')]));};AGIVertices[_0x94f8('0x15')][_0x94f8('0x118')]=function(_0x188663){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0x119'),_0x188663[_0x94f8('0x3b')]));if(!this[_0x94f8('0x84')](_0x188663[_0x94f8('0x87')])||!this[_0x94f8('0x84')](_0x188663[_0x94f8('0x88')])){return this['channel']['noop'](_0x94f8('0x11a'));}if(!this[_0x94f8('0x84')](_0x188663[_0x94f8('0x62')])){return this[_0x94f8('0x3d')][_0x94f8('0xb5')](_0x94f8('0xbc'));}this['channel'][_0x94f8('0xb5')](util[_0x94f8('0x9f')](_0x94f8('0x11b'),_0x188663[_0x94f8('0x62')]));var _0x29cb0e=this['awsPolly'][_0x94f8('0x74')](this,_0x188663);if(_0x29cb0e){this['channel'][_0x94f8('0xb5')](util[_0x94f8('0x9f')]('aws\x20Polly\x20%s\x20file\x20created',_0x29cb0e));var _0x1d406f=this[_0x94f8('0x3d')]['streamFile'](_0x29cb0e);try{fs['unlink'](_0x29cb0e+_0x94f8('0xf7'));}catch(_0x538da0){logger[_0x94f8('0x2e')](_0x538da0);}return _0x1d406f;}return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x188663,_0x94f8('0x11c'));};AGIVertices[_0x94f8('0x15')][_0x94f8('0x11d')]=function(_0x32b5a8){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0x11e'),_0x32b5a8[_0x94f8('0x3b')]));if(!this[_0x94f8('0x84')](_0x32b5a8[_0x94f8('0x87')])||!this['isConfigured'](_0x32b5a8[_0x94f8('0x88')])){return this['channel']['noop'](_0x94f8('0x11a'));}if(!this[_0x94f8('0x84')](_0x32b5a8[_0x94f8('0x11f')])){return this[_0x94f8('0x3d')][_0x94f8('0xb5')](_0x94f8('0x120'));}if(!this[_0x94f8('0x84')](_0x32b5a8['text'])){return this[_0x94f8('0x3d')][_0x94f8('0xb5')](_0x94f8('0xbc'));}this[_0x94f8('0x3d')][_0x94f8('0xef')]=!![];this[_0x94f8('0x39')](_0x32b5a8);this[_0x94f8('0x46')](_0x32b5a8[_0x94f8('0x62')],'in');this[_0x94f8('0x3d')][_0x94f8('0xb5')](util[_0x94f8('0x9f')](_0x94f8('0x121'),_0x32b5a8[_0x94f8('0x62')]));var _0x5de58c=this[_0x94f8('0x8c')][_0x94f8('0x74')](this,_0x32b5a8);if(_0x5de58c){for(var _0x399579 in _0x5de58c){if(_0x5de58c['hasOwnProperty'](_0x399579)&&_[_0x94f8('0x97')](_0x5de58c[_0x399579])){this[_0x94f8('0x3d')][_0x94f8('0xd5')](util[_0x94f8('0x9f')](_0x94f8('0x122'),_0x399579[_0x94f8('0xf1')]()),_0x5de58c[_0x399579]);}}if(_[_0x94f8('0x49')](_0x5de58c[_0x94f8('0x123')])){return this['channel'][_0x94f8('0xb5')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x94f8('0x46')](_0x5de58c[_0x94f8('0x123')],_0x94f8('0xf2'));return this[_0x94f8('0x3d')]['noop'](util[_0x94f8('0x9f')](_0x94f8('0x124'),_0x5de58c[_0x94f8('0x123')]));}}return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x32b5a8,_0x94f8('0x125'));};AGIVertices[_0x94f8('0x15')]['googleasr']=function(_0x292d09){logger[_0x94f8('0x33')](util['format'](_0x94f8('0x126'),_0x292d09[_0x94f8('0x3b')],_0x292d09[_0x94f8('0x6b')]));if(!this[_0x94f8('0x84')](_0x292d09[_0x94f8('0x7f')])){return this['channel'][_0x94f8('0xb5')](_0x94f8('0xe0'));}var _0x59479b='wav';var _0x130412=util[_0x94f8('0x9f')](_0x94f8('0x127'),FILES_PATH,rs[_0x94f8('0x10f')](0x4));var _0x4636c7=util[_0x94f8('0x9f')](_0x94f8('0xa0'),_0x130412,_0x59479b);var _0x3133d3=!![];if(_0x292d09['beep']===_0x94f8('0x128')){_0x3133d3=![];}var _0x3bb089=this[_0x94f8('0x3d')][_0x94f8('0x129')](_0x130412,_0x59479b,_0x292d09[_0x94f8('0x12a')],_0x292d09[_0x94f8('0x6b')],undefined,_0x3133d3);if(_0x3bb089['result']!==-0x1){this[_0x94f8('0x3d')][_0x94f8('0xb5')](util[_0x94f8('0x9f')](_0x94f8('0x12b'),_0x4636c7));var _0x2f1157=this[_0x94f8('0x8e')][_0x94f8('0x74')](this,_0x292d09,_0x4636c7);if(_0x2f1157){for(var _0x3baa7f in _0x2f1157){if(_0x2f1157[_0x94f8('0x96')](_0x3baa7f)){this['channel'][_0x94f8('0xd5')](util[_0x94f8('0x9f')](_0x94f8('0x12c'),_0x3baa7f[_0x94f8('0xf1')]()),_0x2f1157[_0x3baa7f]);}}return this[_0x94f8('0x3d')]['noop'](util[_0x94f8('0x9f')](_0x94f8('0x12d'),JSON['stringify'](_0x2f1157)));}}return _0x3bb089;};AGIVertices[_0x94f8('0x15')]['tildeasr']=function(_0x21a680){logger[_0x94f8('0x33')](util['format'](_0x94f8('0x12e'),_0x21a680[_0x94f8('0x3b')]));if(!this[_0x94f8('0x84')](_0x21a680[_0x94f8('0x91')])){return this['channel']['noop'](_0x94f8('0x12f'));}if(!this[_0x94f8('0x84')](_0x21a680[_0x94f8('0x92')])){return this['channel'][_0x94f8('0xb5')]('no\x20appsecret\x20configured');}var _0x4bb510=_0x94f8('0x130');var _0x1c38f3=util[_0x94f8('0x9f')](_0x94f8('0x127'),FILES_PATH,rs[_0x94f8('0x10f')](0x4));var _0x4b5d89=util[_0x94f8('0x9f')](_0x94f8('0xa0'),_0x1c38f3,_0x4bb510);var _0x24b00d=!![];if(_0x21a680[_0x94f8('0x131')]===_0x94f8('0x128')){_0x24b00d=![];}var _0x7b8429=this[_0x94f8('0x3d')][_0x94f8('0x129')](_0x1c38f3,_0x4bb510,_0x21a680['intKey'],_0x21a680[_0x94f8('0x6b')],undefined,_0x24b00d);if(_0x7b8429[_0x94f8('0xa5')]!==-0x1){this[_0x94f8('0x3d')]['noop'](util[_0x94f8('0x9f')](_0x94f8('0x132'),_0x4b5d89));var _0x3a3a0e=this[_0x94f8('0x90')][_0x94f8('0x74')](this,_0x21a680,_0x4b5d89);if(_0x3a3a0e){for(var _0x56f2fd in _0x3a3a0e){if(_0x3a3a0e[_0x94f8('0x96')](_0x56f2fd)){this[_0x94f8('0x3d')]['setVariable'](util[_0x94f8('0x9f')](_0x94f8('0x133'),_0x56f2fd['toUpperCase']()),_0x3a3a0e[_0x56f2fd]);}}return this[_0x94f8('0x3d')][_0x94f8('0xb5')](util['format'](_0x94f8('0x134'),JSON[_0x94f8('0x78')](_0x3a3a0e)));}}return _0x7b8429;};AGIVertices['prototype'][_0x94f8('0x135')]=function(_0x509832){logger[_0x94f8('0x33')](util['format'](_0x94f8('0x136'),_0x509832[_0x94f8('0x3b')]));return this[_0x94f8('0x3d')][_0x94f8('0x137')](_0x509832['context'],_0x509832[_0x94f8('0x41')],_0x509832[_0x94f8('0x42')]);};AGIVertices[_0x94f8('0x15')][_0x94f8('0x138')]=function(_0x1cad54){logger['info'](util[_0x94f8('0x9f')](_0x94f8('0x139'),_0x1cad54[_0x94f8('0x3b')]));if(!this[_0x94f8('0x84')](_0x1cad54[_0x94f8('0x13a')])){return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x1cad54,_0x94f8('0x13b'));}try{var _0xc392a3=eval(_0x1cad54[_0x94f8('0x13a')])?_0x94f8('0x13c'):_0x94f8('0x13d');this[_0x94f8('0x3d')]['noop'](util[_0x94f8('0x9f')](_0x94f8('0x13e'),_0x1cad54[_0x94f8('0x13a')],_0xc392a3));return{'code':0xc8,'result':_0xc392a3};}catch(_0x3ae360){return{'code':0xc8,'result':_0x94f8('0x13d')};}};AGIVertices['prototype'][_0x94f8('0x13f')]=function(_0x37bad3){logger[_0x94f8('0x33')](util['format'](_0x94f8('0x140'),_0x37bad3[_0x94f8('0x3b')]));if(!this[_0x94f8('0x84')](_0x37bad3[_0x94f8('0x141')])){return this['channel'][_0x94f8('0x2e')](_0x37bad3,_0x94f8('0x142'));}var _0xee0b82=this[_0x94f8('0x25')][_0x94f8('0x74')](this,_0x37bad3[_0x94f8('0x141')]);if(!_0xee0b82){return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x37bad3,_0x94f8('0x143'));}for(var _0x452e8c=0x0;_0x452e8c<_0xee0b82[_0x94f8('0x9d')];_0x452e8c+=0x1){var _0x1b51fd=this['channel'][_0x94f8('0x10')](util[_0x94f8('0x9f')](_0x94f8('0x144'),_0xee0b82[_0x452e8c]));if(_0x1b51fd[_0x94f8('0xa5')]===-0x1){return _0x1b51fd;}logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0x145'),_0xee0b82[_0x452e8c],_0x1b51fd[_0x94f8('0xa3')]));if(_0x1b51fd[_0x94f8('0xa3')]===_0x94f8('0x13c')){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0x145'),_0xee0b82[_0x452e8c],_0x94f8('0x13c')));this[_0x94f8('0x3d')][_0x94f8('0xb5')](util['format'](_0x94f8('0x145'),_0xee0b82[_0x452e8c],_0x94f8('0x13c')));return{'code':0xc8,'result':_0x94f8('0x13c')};}else{logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0x145'),_0xee0b82[_0x452e8c],'false'));this[_0x94f8('0x3d')][_0x94f8('0xb5')](util[_0x94f8('0x9f')](_0x94f8('0x145'),_0xee0b82[_0x452e8c],'false'));}}return{'code':0xc8,'result':_0x94f8('0x13d')};};AGIVertices[_0x94f8('0x15')][_0x94f8('0x146')]=function(_0x15656d){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0x147'),_0x15656d[_0x94f8('0x3b')]));return this[_0x94f8('0x3d')]['hangup']();};AGIVertices[_0x94f8('0x15')][_0x94f8('0x148')]=function(_0xa33676){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0xa33676[_0x94f8('0x3b')]));if(!this['isConfigured'](_0xa33676['key'])){return this['channel']['noop'](_0x94f8('0xe0'));}var _0x3137a0='wav';var _0x940b9d=util[_0x94f8('0x9f')](_0x94f8('0x127'),FILES_PATH,rs['generate'](0x4));var _0x193562=util[_0x94f8('0x9f')](_0x94f8('0xa0'),_0x940b9d,_0x3137a0);var _0x3a84ca=!![];if(_0xa33676[_0x94f8('0x131')]==='NOBEEP'){_0x3a84ca=![];}var _0x138d47=this[_0x94f8('0x3d')][_0x94f8('0x129')](_0x940b9d,_0x3137a0,_0xa33676[_0x94f8('0x12a')],_0xa33676[_0x94f8('0x6b')],undefined,_0x3a84ca);if(_0x138d47[_0x94f8('0xa5')]!==-0x1){this[_0x94f8('0x3d')]['noop'](util[_0x94f8('0x9f')](_0x94f8('0x149'),_0x193562));var _0x2939bf=this['ispeechASR'][_0x94f8('0x74')](this,_0xa33676,_0x193562);if(_0x2939bf){for(var _0x34d91c in _0x2939bf){if(_0x2939bf[_0x94f8('0x96')](_0x34d91c)){this[_0x94f8('0x3d')][_0x94f8('0xd5')](util[_0x94f8('0x9f')](_0x94f8('0x14a'),_0x34d91c[_0x94f8('0xf1')]()),_0x2939bf[_0x34d91c]);}}return this['channel']['noop'](util[_0x94f8('0x9f')](_0x94f8('0x14b'),JSON[_0x94f8('0x78')](_0x2939bf)));}}return _0x138d47;};AGIVertices[_0x94f8('0x15')][_0x94f8('0x14c')]=function(_0x1ec537){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x1ec537[_0x94f8('0x3b')]));if(!this['isConfigured'](_0x1ec537['key'])){return this['channel'][_0x94f8('0xb5')](_0x94f8('0xe0'));}if(!this[_0x94f8('0x84')](_0x1ec537[_0x94f8('0x62')])){return this[_0x94f8('0x3d')]['noop'](_0x94f8('0xbc'));}this[_0x94f8('0x3d')][_0x94f8('0xb5')](util[_0x94f8('0x9f')](_0x94f8('0x14d'),_0x1ec537[_0x94f8('0x62')]));var _0x4d6296=this[_0x94f8('0x82')][_0x94f8('0x74')](this,_0x1ec537);if(_0x4d6296){this[_0x94f8('0x3d')]['noop'](util['format'](_0x94f8('0x149'),_0x4d6296));var _0x198d63=this[_0x94f8('0x3d')][_0x94f8('0xf5')](_0x4d6296,_0x1ec537[_0x94f8('0x12a')]);try{fs[_0x94f8('0xf6')](_0x4d6296+'.wav');}catch(_0x19f949){logger['error'](_0x19f949);}return _0x198d63;}return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x1ec537,_0x94f8('0x14e'));};AGIVertices['prototype'][_0x94f8('0x14f')]=function(_0x309a60){logger['info'](util['format'](_0x94f8('0x150'),_0x309a60[_0x94f8('0x3b')]));if(!this[_0x94f8('0x84')](_0x309a60[_0x94f8('0x151')])){return this[_0x94f8('0x3d')]['error'](_0x309a60,_0x94f8('0x152'));}logger['info'](util[_0x94f8('0x9f')](_0x94f8('0x153'),this[_0x94f8('0x3d')][_0x94f8('0x3e')],_0x309a60['findBy']));var _0x242696=this[_0x94f8('0x59')][_0x94f8('0x74')](this,_0x309a60[_0x94f8('0x151')]);if(_0x242696){logger['info'](util[_0x94f8('0x9f')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x94f8('0x3e')],_0x309a60[_0x94f8('0x151')]));this[_0x94f8('0x3d')][_0x94f8('0xb5')](util[_0x94f8('0x9f')](_0x94f8('0x154'),this[_0x94f8('0x3d')][_0x94f8('0x3e')],_0x309a60['findBy']));return{'code':0xc8,'result':_0x94f8('0x155')};}else{logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0x156'),this['channel'][_0x94f8('0x3e')],_0x309a60['findBy']));this[_0x94f8('0x3d')][_0x94f8('0xb5')](util['format'](_0x94f8('0x156'),this[_0x94f8('0x3d')][_0x94f8('0x3e')],_0x309a60[_0x94f8('0x151')]));return{'code':0xc8,'result':_0x94f8('0x157')};}};AGIVertices['prototype'][_0x94f8('0x158')]=function(_0x3a68f1){logger['info'](util[_0x94f8('0x9f')](_0x94f8('0x159'),_0x3a68f1[_0x94f8('0x3b')]));if(!this[_0x94f8('0x84')](_0x3a68f1[_0x94f8('0x151')])){return this['channel'][_0x94f8('0x2e')](_0x3a68f1,_0x94f8('0x152'));}logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0x153'),this[_0x94f8('0x3d')]['callerid'],_0x3a68f1[_0x94f8('0x151')]));var _0x1c0132=this[_0x94f8('0x58')][_0x94f8('0x74')](this,_0x3a68f1[_0x94f8('0x151')]);if(_0x1c0132){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x94f8('0x3d')][_0x94f8('0x3e')],_0x3a68f1['findBy']));this[_0x94f8('0x3d')][_0x94f8('0xb5')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x3a68f1[_0x94f8('0x151')]));return{'code':0xc8,'result':_0x94f8('0x155')};}else{logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0x156'),this['channel']['callerid'],_0x3a68f1[_0x94f8('0x151')]));this[_0x94f8('0x3d')][_0x94f8('0xb5')](util[_0x94f8('0x9f')](_0x94f8('0x156'),this[_0x94f8('0x3d')]['callerid'],_0x3a68f1[_0x94f8('0x151')]));return{'code':0xc8,'result':_0x94f8('0x157')};}};AGIVertices[_0x94f8('0x15')][_0x94f8('0x15a')]=function(_0x41dd72){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0x15b'),_0x41dd72['label']));if(!this['isConfigured'](_0x41dd72[_0x94f8('0x15c')])){return this['channel'][_0x94f8('0x2e')](_0x41dd72,_0x94f8('0x15d'));}this['channel'][_0x94f8('0xb5')](util[_0x94f8('0x9f')](_0x94f8('0x15e'),_0x41dd72['operation']));var _0x34db4e=eval(_0x41dd72[_0x94f8('0x15c')]);if(!this[_0x94f8('0x84')](_0x41dd72[_0x94f8('0xd1')])){return this['channel']['noop'](_0x94f8('0xd2'));}var _0x345058=this[_0x94f8('0x10')][_0x94f8('0x74')](this,_0x41dd72['variable_id']);if(!_0x345058){return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x41dd72,_0x94f8('0xd3'));}if(_[_0x94f8('0x9c')](_0x34db4e)){var _0x20eae3=this;_0x34db4e[_0x94f8('0xd4')](function(_0x15958e,_0x4ab849){_0x20eae3[_0x94f8('0x3d')][_0x94f8('0xd5')](util['format'](_0x94f8('0x15f'),_0x345058,_0x4ab849),_0x15958e);});return this[_0x94f8('0x3d')][_0x94f8('0xb5')](util['format'](_0x94f8('0x160'),_0x345058));}else{return this[_0x94f8('0x3d')]['setVariable'](_0x345058,_0x34db4e);}};AGIVertices[_0x94f8('0x15')]['menu']=function(_0x58990b){logger['info'](util['format'](_0x94f8('0x161'),_0x58990b[_0x94f8('0x3b')]));if(_0x58990b[_0x94f8('0xa7')]===0x0){return this[_0x94f8('0xa6')](_0x58990b);}_0x58990b[_0x94f8('0xa7')]-=0x1;if(!this[_0x94f8('0x84')](_0x58990b[_0x94f8('0x106')])){return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x58990b,_0x94f8('0x107'));}var _0xf77a13=this['getSound']['sync'](this,_0x58990b[_0x94f8('0x106')]);if(!_0xf77a13){return this[_0x94f8('0x3d')]['error'](_0x58990b,_0x94f8('0x108'));}var _0x9670cf=this[_0x94f8('0x3d')][_0x94f8('0x109')](_0xf77a13,_0x58990b[_0x94f8('0x10a')],_0x58990b[_0x94f8('0x162')]);var _0x52e85a=_0x9670cf[_0x94f8('0xa5')];if(_0x9670cf['result']===-0x1){this[_0x94f8('0x39')][_0x94f8('0x74')](this,_0x58990b,'-1');return _0x9670cf;}else if(_0x9670cf[_0x94f8('0xa3')]===_0x94f8('0x6b')){_0x9670cf[_0x94f8('0xa5')]=_0x9670cf[_0x94f8('0xa5')]['length']>0x0?_0x9670cf['result']:'t';}else if(_['isEmpty'](_0x9670cf[_0x94f8('0xa5')])){_0x9670cf[_0x94f8('0xa5')]='#';_0x52e85a='#';}if(!this[_0x94f8('0x84')](_0x58990b['variable_id'])){this['channel'][_0x94f8('0xb5')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0xceaaa4=this[_0x94f8('0x10')][_0x94f8('0x74')](this,_0x58990b[_0x94f8('0xd1')]);if(!_0xceaaa4){return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x58990b,_0x94f8('0xd3'));}this[_0x94f8('0x3d')][_0x94f8('0xd5')](_0xceaaa4,_0x52e85a);}this[_0x94f8('0x39')]['sync'](this,_0x58990b,_0x52e85a);return _0x9670cf;};AGIVertices[_0x94f8('0x15')]['noop']=function(_0x3c6af4){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0x163'),_0x3c6af4[_0x94f8('0x3b')]));return this[_0x94f8('0x3d')]['noop'](_0x3c6af4[_0x94f8('0x164')]||_0x3c6af4['label']);};AGIVertices[_0x94f8('0x15')][_0x94f8('0x165')]=function(_0x2a6da8){logger['info'](util['format'](_0x94f8('0x166'),_0x2a6da8[_0x94f8('0x3b')]));if(!this['isConfigured'](_0x2a6da8[_0x94f8('0x151')])){return this['channel'][_0x94f8('0x2e')](_0x2a6da8,_0x94f8('0x152'));}logger[_0x94f8('0x33')](util[_0x94f8('0x9f')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x94f8('0x3e')],_0x2a6da8[_0x94f8('0x151')]));var _0x42f1ff=this[_0x94f8('0x53')][_0x94f8('0x74')](this,_0x2a6da8[_0x94f8('0x167')]);var _0x45d027=this[_0x94f8('0x55')][_0x94f8('0x74')](this,_0x2a6da8['findBy'],_0x42f1ff);if(_0x45d027){logger[_0x94f8('0x33')](util['format'](_0x94f8('0x154'),this[_0x94f8('0x3d')]['callerid'],_0x2a6da8[_0x94f8('0x151')]));this[_0x94f8('0x3d')][_0x94f8('0xb5')](util[_0x94f8('0x9f')](_0x94f8('0x154'),this[_0x94f8('0x3d')][_0x94f8('0x3e')],_0x2a6da8[_0x94f8('0x151')]));return{'code':0xc8,'result':_0x94f8('0x155')};}else{logger['info'](util[_0x94f8('0x9f')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x94f8('0x3d')][_0x94f8('0x3e')],_0x2a6da8['findBy']));this[_0x94f8('0x3d')][_0x94f8('0xb5')](util[_0x94f8('0x9f')](_0x94f8('0x154'),this['channel'][_0x94f8('0x3e')],_0x2a6da8[_0x94f8('0x151')]));return{'code':0xc8,'result':_0x94f8('0x157')};}};AGIVertices[_0x94f8('0x15')]['playback']=function(_0x4d15d9){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x4d15d9['label']));if(!this[_0x94f8('0x84')](_0x4d15d9[_0x94f8('0x106')])){return this['channel'][_0x94f8('0x2e')](_0x4d15d9,_0x94f8('0x107'));}var _0x5cc0fa=this['getSound']['sync'](this,_0x4d15d9['file_id']);if(!_0x5cc0fa){return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x4d15d9,_0x94f8('0x108'));}var _0x513d3f=this[_0x94f8('0x3d')][_0x94f8('0xb3')](_0x94f8('0x168'),[_0x5cc0fa,_0x4d15d9[_0x94f8('0xde')]]);if(_0x513d3f[_0x94f8('0xa5')]===-0x1){return _0x513d3f;}return this[_0x94f8('0x3d')]['noop'](util[_0x94f8('0x9f')](_0x94f8('0xb6'),_0x94f8('0x168'),_0x5cc0fa));};AGIVertices[_0x94f8('0x15')][_0x94f8('0x169')]=function(_0x12bfe4){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0x16a'),_0x12bfe4[_0x94f8('0x3b')]));if(!this[_0x94f8('0x84')](_0x12bfe4['queue_id'])){return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x12bfe4,_0x94f8('0x16b'));}var _0x53b37e='';var _0xb75808=parseInt(_0x12bfe4[_0x94f8('0x16c')],0xa);if(isNaN(_0xb75808)){_0x53b37e=_0x12bfe4['queue_id'];}else{_0x53b37e=this[_0x94f8('0x16')][_0x94f8('0x74')](this,_0x12bfe4['queue_id']);if(!_0x53b37e){return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x12bfe4,_0x94f8('0x16d'));}}var _0x10ddaa='';if(this['isConfigured'](_0x12bfe4['file_id'])){var _0x1a58f2=this[_0x94f8('0x1e')][_0x94f8('0x74')](this,_0x12bfe4['file_id']);if(_0x1a58f2){_0x10ddaa=_0x1a58f2;}}this[_0x94f8('0x39')][_0x94f8('0x74')](this,_0x12bfe4,_0x53b37e);if(_0x12bfe4['opts']['indexOf']('x')<0x0){_0x12bfe4[_0x94f8('0xde')]+='x';}if(_0x12bfe4[_0x94f8('0xde')][_0x94f8('0x16e')]('X')<0x0){_0x12bfe4[_0x94f8('0xde')]+='X';}this['channel'][_0x94f8('0xd5')](_0x94f8('0x16f'),_0x53b37e?_0x53b37e['toLowerCase']():'');var _0x1b13b9=this[_0x94f8('0x3d')][_0x94f8('0xb3')](_0x94f8('0x170'),[_0x53b37e,_0x12bfe4[_0x94f8('0xde')],_0x12bfe4[_0x94f8('0x6a')],_0x10ddaa,_0x12bfe4[_0x94f8('0x6b')],_0x12bfe4[_0x94f8('0x7')],_0x12bfe4[_0x94f8('0x171')],_0x12bfe4[_0x94f8('0x172')],'',_0x12bfe4[_0x94f8('0x173')]]);if(_0x1b13b9[_0x94f8('0xa5')]===-0x1){return _0x1b13b9;}return this[_0x94f8('0x3d')][_0x94f8('0xb5')](util[_0x94f8('0x9f')](_0x94f8('0xb6'),'QUEUE',_0x53b37e));};AGIVertices[_0x94f8('0x15')][_0x94f8('0x174')]=function(_0x520006){logger['info'](util[_0x94f8('0x9f')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x520006[_0x94f8('0x3b')]));var _0x39b817=_0x520006[_0x94f8('0x175')]||'wav';var _0x4207da=util['format'](_0x94f8('0x176'),this[_0x94f8('0x3d')][_0x94f8('0x3a')],rs[_0x94f8('0x10f')](0x5));var _0x4ab7cc=util[_0x94f8('0x9f')](_0x94f8('0x177'),FILES_PATH,_0x4207da,_0x39b817);var _0x5f107e=util[_0x94f8('0x9f')](_0x94f8('0x127'),FILES_PATH,_0x4207da);this[_0x94f8('0x3f')][_0x94f8('0x74')](this,_0x520006,_0x4207da,_0x4ab7cc);this['channel'][_0x94f8('0xd5')](_0x94f8('0x178'),_0x4207da);logger[_0x94f8('0x33')](_0x94f8('0x179'),_0x5f107e,_0x39b817,_0x520006[_0x94f8('0x17a')],_0x520006['timeout']);return this[_0x94f8('0x3d')][_0x94f8('0x129')](_0x5f107e,_0x39b817,_0x520006[_0x94f8('0x17a')],_0x520006[_0x94f8('0x6b')],undefined,!![]);};AGIVertices[_0x94f8('0x15')]['restapi']=function(_0x45e970){logger['info'](util[_0x94f8('0x9f')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x45e970[_0x94f8('0x3b')]));if(!this[_0x94f8('0x84')](_0x45e970[_0x94f8('0x6a')])){return this['channel']['noop']('no\x20url\x20configured');}var _0x27e34c=this['restAPI'][_0x94f8('0x74')](this,_0x45e970);logger['info'](util[_0x94f8('0x9f')](_0x94f8('0x17b'),util[_0x94f8('0x17c')](_0x27e34c,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x45e970[_0x94f8('0xd1')])){return this[_0x94f8('0x3d')][_0x94f8('0xb5')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x47230b=this['getVariable']['sync'](this,_0x45e970['variable_id']);if(!_0x47230b){return this['channel'][_0x94f8('0x2e')](_0x45e970,_0x94f8('0xd3'));}this[_0x94f8('0x3d')][_0x94f8('0xd5')](util[_0x94f8('0x9f')](_0x94f8('0x17d'),_0x47230b),_0x27e34c[_0x94f8('0x7a')]?_0x27e34c[_0x94f8('0x7a')]:'200');this['channel'][_0x94f8('0xd5')](util['format']('%s_STATUS_MESSAGE',_0x47230b),_0x27e34c['statusMessage']?_0x27e34c[_0x94f8('0x7b')]:'OK');if(_0x27e34c[_0x94f8('0x6f')]){try{this[_0x94f8('0x9e')](_0x27e34c[_0x94f8('0x6f')],_0x47230b);}catch(_0xd686c5){logger['error'](util[_0x94f8('0x9f')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x47230b));}}return this[_0x94f8('0x3d')][_0x94f8('0xb5')](util[_0x94f8('0x9f')](_0x94f8('0x17e'),_0x47230b));};AGIVertices[_0x94f8('0x15')]['saydigits']=function(_0x475554){logger[_0x94f8('0x33')](util['format'](_0x94f8('0x17f'),_0x475554['label']));return this['channel'][_0x94f8('0x180')](_0x475554[_0x94f8('0x181')][_0x94f8('0x5e')](/\s+/g,''),_0x475554['escape_digits']);};AGIVertices[_0x94f8('0x15')][_0x94f8('0x182')]=function(_0xd23ff8){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0xd23ff8[_0x94f8('0x3b')]));return this[_0x94f8('0x3d')][_0x94f8('0x183')](_0xd23ff8['number'][_0x94f8('0x5e')](/\s+/g,''),_0xd23ff8[_0x94f8('0x17a')]);};AGIVertices[_0x94f8('0x15')][_0x94f8('0x184')]=function(_0x51c03d){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0x185'),_0x51c03d[_0x94f8('0x3b')]));return this[_0x94f8('0x3d')]['sayPhonetic'](_0x51c03d['text'],_0x51c03d['escape_digits']);};AGIVertices[_0x94f8('0x15')][_0x94f8('0x186')]=function(_0x2803b5){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0x187'),_0x2803b5[_0x94f8('0x3b')]));if(!this['isConfigured'](_0x2803b5[_0x94f8('0x188')])){return this[_0x94f8('0x3d')]['noop']('no\x20mail\x20account\x20configured');}var _0x132f71=this['getMailAccount'][_0x94f8('0x74')](this,_0x2803b5['account_id']);if(!_0x132f71||!_0x132f71[_0x94f8('0x189')]){return this['channel']['error'](_0x2803b5,_0x94f8('0x18a'));}var _0x54d690={'from':util['format'](_0x94f8('0x18b'),_0x132f71[_0x94f8('0x13')],_0x132f71[_0x94f8('0x18c')]||_0x132f71[_0x94f8('0x189')][_0x94f8('0x18d')]),'to':_0x2803b5['to']||'','cc':_0x2803b5['cc']||'','bcc':_0x2803b5[_0x94f8('0x18e')]||'','subject':_0x2803b5['subject'],'html':_0x2803b5[_0x94f8('0x62')],'text':_0x2803b5[_0x94f8('0x62')]};var _0x2727f0={'tls':{'rejectUnauthorized':![]}};if(_0x132f71[_0x94f8('0x189')][_0x94f8('0x18f')]){_0x2727f0[_0x94f8('0x18f')]=_0x132f71[_0x94f8('0x189')][_0x94f8('0x18f')];}else{_0x2727f0[_0x94f8('0x190')]=_0x132f71[_0x94f8('0x189')][_0x94f8('0x190')];_0x2727f0[_0x94f8('0x191')]=_0x132f71[_0x94f8('0x189')][_0x94f8('0x191')];_0x2727f0[_0x94f8('0x192')]=_0x132f71[_0x94f8('0x189')][_0x94f8('0x192')];}if(_0x132f71[_0x94f8('0x189')][_0x94f8('0x193')]){_0x2727f0['auth']={'user':_0x132f71['Smtp']['user'],'pass':_0x132f71[_0x94f8('0x189')][_0x94f8('0x194')]};}if(this[_0x94f8('0x84')](_0x2803b5[_0x94f8('0x195')])){}logger[_0x94f8('0xd8')](_0x94f8('0x196'),JSON[_0x94f8('0x78')](_0x54d690));this[_0x94f8('0x39')][_0x94f8('0x74')](this,_0x2803b5,_0x2803b5['account_id']);this['channel'][_0x94f8('0xb5')](util['format'](_0x94f8('0x197'),_0x132f71[_0x94f8('0x13')]));this['sendMailMessage'][_0x94f8('0x74')](this,_0x2727f0,_0x54d690);return this[_0x94f8('0x3d')][_0x94f8('0xb5')](_0x94f8('0x198'));};AGIVertices[_0x94f8('0x15')]['sendFax']=function(_0x9159af){logger['info'](util[_0x94f8('0x9f')](_0x94f8('0x199'),_0x9159af[_0x94f8('0x3b')]));return this[_0x94f8('0x3d')][_0x94f8('0xb5')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x94f8('0x15')][_0x94f8('0x19a')]=function(_0x536d68){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0x19b'),_0x536d68[_0x94f8('0x3b')]));if(!this['isConfigured'](_0x536d68[_0x94f8('0x19c')])){return this[_0x94f8('0x3d')][_0x94f8('0xb5')](_0x94f8('0x19d'));}var _0x1e7379=this[_0x94f8('0x36')]['sync'](this,_0x536d68[_0x94f8('0x19c')]);if(!_0x1e7379){return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x536d68,_0x94f8('0x19e'));}var _0x32bbac={'body':_0x536d68[_0x94f8('0x19f')],'phone':_0x536d68['to']||'','SmsAccountId':_0x1e7379['id']};logger[_0x94f8('0xd8')]('sendSMS\x20message',JSON[_0x94f8('0x78')](_0x32bbac));this[_0x94f8('0x39')][_0x94f8('0x74')](this,_0x536d68,_0x536d68[_0x94f8('0x19c')]);this['channel'][_0x94f8('0xb5')](util[_0x94f8('0x9f')](_0x94f8('0x1a0'),_0x1e7379[_0x94f8('0x13')]));this[_0x94f8('0x38')][_0x94f8('0x74')](this,_0x32bbac);return this[_0x94f8('0x3d')][_0x94f8('0xb5')](_0x94f8('0x1a1'));};AGIVertices[_0x94f8('0x15')][_0x94f8('0x1a2')]=function(_0x2c1f22){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0x1a3'),_0x2c1f22[_0x94f8('0x3b')]));if(!this['isConfigured'](_0x2c1f22[_0x94f8('0xd1')])){return this['channel'][_0x94f8('0x2e')](_0x2c1f22,_0x94f8('0x1a4'));}var _0x400f6e=this['getVariable'][_0x94f8('0x74')](this,_0x2c1f22['variable_id']);if(!_0x400f6e){return this[_0x94f8('0x3d')]['error'](_0x2c1f22,'no\x20variable\x20found');}return this[_0x94f8('0x3d')]['setVariable'](_0x400f6e,_0x2c1f22[_0x94f8('0x1a5')]);};AGIVertices[_0x94f8('0x15')][_0x94f8('0x1a6')]=function(_0x48ed08){logger['info'](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x48ed08[_0x94f8('0x3b')]));this[_0x94f8('0x3d')][_0x94f8('0xb5')]('START\x20CALLY\x20SQUARE');if(_0x48ed08[_0x94f8('0xab')]===_0x94f8('0x1a7')){this['channel'][_0x94f8('0xb5')](_0x94f8('0x1a8'));return this[_0x94f8('0x3d')]['answer']();}return this[_0x94f8('0x3d')][_0x94f8('0xb5')]('Skipped\x20Answer');};AGIVertices[_0x94f8('0x15')][_0x94f8('0x1a9')]=function(_0x15dc05){logger['info'](util[_0x94f8('0x9f')](_0x94f8('0x1aa'),_0x15dc05[_0x94f8('0x3b')]));if(!this[_0x94f8('0x84')](_0x15dc05['project_id'])){return this['channel']['error'](_0x15dc05,'no\x20subproject\x20selected');}var _0x374d71=this['getSquareProject'][_0x94f8('0x74')](this,_0x15dc05[_0x94f8('0x1ab')]);if(!this[_0x94f8('0x84')](_0x374d71)){return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x15dc05,util[_0x94f8('0x9f')](_0x94f8('0x1ac'),_0x15dc05['project_id']));}if(_0x374d71===this[_0x94f8('0x3d')][_0x94f8('0x45')]){return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x15dc05,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x94f8('0x39')][_0x94f8('0x74')](this,_0x15dc05,_0x374d71);var _0x5e7a36=this[_0x94f8('0x3d')][_0x94f8('0xb3')](_0x94f8('0x1ad'),util[_0x94f8('0x9f')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x94f8('0x7')][_0x94f8('0x190')]||_0x94f8('0x1ae'),_0x374d71,this[_0x94f8('0x3d')][_0x94f8('0x45')]));if(_0x5e7a36[_0x94f8('0xa5')]===-0x1){return _0x5e7a36;}return this[_0x94f8('0x3d')][_0x94f8('0xb5')](util[_0x94f8('0x9f')]('Executed\x20command\x20%s\x20%s',_0x94f8('0x1ad'),_0x374d71));};AGIVertices[_0x94f8('0x15')][_0x94f8('0x1af')]=function(_0x48bd1){logger[_0x94f8('0x33')](util['format'](_0x94f8('0x1b0'),_0x48bd1[_0x94f8('0x3b')]));var _0x44d61e=this[_0x94f8('0x5c')]['sync'](this,_0x48bd1[_0x94f8('0xa9')]);this[_0x94f8('0x39')]['sync'](this,_0x48bd1,_0x48bd1[_0x94f8('0xa9')]);if(this['isConfigured'](_0x48bd1[_0x94f8('0xd1')])){var _0x494d3b=this[_0x94f8('0x10')]['sync'](this,_0x48bd1[_0x94f8('0xd1')]);if(_0x494d3b){this[_0x94f8('0x3d')][_0x94f8('0xd5')](_0x494d3b,_0x44d61e);return this[_0x94f8('0x3d')][_0x94f8('0xb5')](util[_0x94f8('0x9f')](_0x94f8('0x1b1'),_0x48bd1[_0x94f8('0xa9')],_0x494d3b));}}return this['channel'][_0x94f8('0xb5')](util['format'](_0x94f8('0x1b2'),_0x48bd1['command']));};AGIVertices[_0x94f8('0x15')][_0x94f8('0x1b3')]=function(_0x2cef03){logger[_0x94f8('0x33')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x2cef03[_0x94f8('0x3b')]));if(!this[_0x94f8('0x84')](_0x2cef03[_0x94f8('0x60')])){return this['channel'][_0x94f8('0xb5')](_0x94f8('0x1b4'));}if(!this[_0x94f8('0x84')](_0x2cef03[_0x94f8('0x62')])){return this[_0x94f8('0x3d')]['noop'](_0x94f8('0xbc'));}this[_0x94f8('0x3d')][_0x94f8('0xb5')](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x2cef03[_0x94f8('0x62')]));var _0x31a461=this[_0x94f8('0x5f')][_0x94f8('0x74')](this,_0x2cef03);if(_0x31a461){this[_0x94f8('0x3d')][_0x94f8('0xb5')](util[_0x94f8('0x9f')](_0x94f8('0x1b5'),_0x31a461));var _0x2aea7f=this['channel'][_0x94f8('0xf5')](_0x31a461);try{fs[_0x94f8('0xf6')](_0x31a461+_0x94f8('0xf7'));}catch(_0x2163fd){logger[_0x94f8('0x2e')](_0x2163fd);}return _0x2aea7f;}return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x2cef03,_0x94f8('0x1b6'));};AGIVertices[_0x94f8('0x15')][_0x94f8('0x1b7')]=function(_0x1f8919){logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0x1b8'),_0x1f8919[_0x94f8('0x3b')]));if(!this[_0x94f8('0x84')](_0x1f8919[_0x94f8('0x62')])){return this[_0x94f8('0x3d')][_0x94f8('0xb5')](_0x94f8('0xbc'));}this[_0x94f8('0x3d')][_0x94f8('0xb5')](util[_0x94f8('0x9f')](_0x94f8('0x1b9'),_0x1f8919[_0x94f8('0x62')]));var _0x22e3f8=this[_0x94f8('0x1ba')][_0x94f8('0x74')](this,_0x1f8919);if(_0x22e3f8){this[_0x94f8('0x3d')][_0x94f8('0xb5')](util[_0x94f8('0x9f')](_0x94f8('0x1bb'),_0x22e3f8));var _0x25e1a0=this[_0x94f8('0x3d')][_0x94f8('0xf5')](_0x22e3f8);try{fs[_0x94f8('0xf6')](_0x22e3f8+'.wav');}catch(_0x549fd2){logger[_0x94f8('0x2e')](_0x549fd2);}return _0x25e1a0;}return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x1f8919,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x94f8('0x15')][_0x94f8('0x1bc')]=function(_0x48649a){logger['info'](util[_0x94f8('0x9f')](_0x94f8('0x1bd'),_0x48649a[_0x94f8('0x3b')]));if(!this['isConfigured'](_0x48649a[_0x94f8('0x151')])){return this[_0x94f8('0x3d')][_0x94f8('0x2e')](_0x48649a,'no\x20find\x20by\x20configured');}logger[_0x94f8('0x33')](util[_0x94f8('0x9f')](_0x94f8('0x153'),this[_0x94f8('0x3d')][_0x94f8('0x3e')],_0x48649a[_0x94f8('0x151')]));var _0x271758=this[_0x94f8('0x57')][_0x94f8('0x74')](this,_0x48649a[_0x94f8('0x151')]);if(_0x271758){logger['info'](util[_0x94f8('0x9f')](_0x94f8('0x154'),this[_0x94f8('0x3d')]['callerid'],_0x48649a[_0x94f8('0x151')]));this[_0x94f8('0x3d')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x94f8('0x3e')],_0x48649a[_0x94f8('0x151')]));return{'code':0xc8,'result':_0x94f8('0x155')};}else{logger['info'](util[_0x94f8('0x9f')](_0x94f8('0x156'),this['channel'][_0x94f8('0x3e')],_0x48649a['findBy']));this['channel'][_0x94f8('0xb5')](util[_0x94f8('0x9f')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x94f8('0x3d')]['callerid'],_0x48649a['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x94f8('0x15')]['voicemail']=function(_0x250fcc){logger[_0x94f8('0x33')](util['format'](_0x94f8('0x1be'),_0x250fcc[_0x94f8('0x3b')]));var _0x492290=this[_0x94f8('0x3d')][_0x94f8('0xb3')]('VOICEMAIL',[_0x250fcc['mailbox'],_0x250fcc['options']]);if(_0x492290[_0x94f8('0xa5')]===-0x1){return _0x492290;}return this[_0x94f8('0x3d')]['noop'](util['format'](_0x94f8('0xb6'),_0x94f8('0x1bf'),_0x250fcc[_0x94f8('0x1c0')]));};AGIVertices[_0x94f8('0x15')][_0x94f8('0x1c1')]=function(_0x45e49e){logger[_0x94f8('0x33')](util['format'](_0x94f8('0x1c2'),_0x45e49e[_0x94f8('0x3b')]));if(!this[_0x94f8('0x84')](_0x45e49e[_0x94f8('0xd1')])){return this['channel'][_0x94f8('0x2e')](_0x45e49e,_0x94f8('0x1a4'));}var _0x4257ae=this[_0x94f8('0x10')][_0x94f8('0x74')](this,_0x45e49e[_0x94f8('0xd1')]);if(!_0x4257ae){return this[_0x94f8('0x3d')]['error'](_0x45e49e,_0x94f8('0xd3'));}var _0x4d0668=this[_0x94f8('0x3d')]['getVariable'](_0x4257ae);return{'code':0xc8,'result':_0x4d0668[_0x94f8('0xa3')]?_0x4d0668[_0x94f8('0xa3')]:'-'};};String[_0x94f8('0x15')][_0x94f8('0xa2')]=function(_0x4cf31a,_0x37c0e3){return this[_0x94f8('0xa1')](_0x4cf31a)[_0x94f8('0x1c3')](_0x37c0e3);};module[_0x94f8('0x1c4')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 606b56f..6e4163b 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 _0xbec5=['syncAttendedTransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','stopAcw','YYYY-MM-DD\x20HH:mm:ss','uniqueid','lastPauseAt','timer','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','util','lodash','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer'];(function(_0x2f9130,_0x484fb0){var _0x7fc70e=function(_0x5214b6){while(--_0x5214b6){_0x2f9130['push'](_0x2f9130['shift']());}};_0x7fc70e(++_0x484fb0);}(_0xbec5,0xe5));var _0x5bec=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0xbec5[_0xef8146];return _0x5a6cb0;};'use strict';var util=require(_0x5bec('0x0'));var _=require(_0x5bec('0x1'));var moment=require('moment');var ami=require(_0x5bec('0x2'));var logger=require(_0x5bec('0x3'))(_0x5bec('0x4'));var RpcUser=require(_0x5bec('0x5'));var RpcVoiceAgentReport=require(_0x5bec('0x6'));function Acw(_0x4ee982){this[_0x5bec('0x7')]=_0x4ee982[_0x5bec('0x7')];this[_0x5bec('0x8')]=_0x4ee982['agents'];this[_0x5bec('0x9')]=_0x4ee982[_0x5bec('0x9')];this[_0x5bec('0xa')]={};ami['on'](_0x5bec('0xb'),this[_0x5bec('0xc')][_0x5bec('0xd')](this));ami['on'](_0x5bec('0xe'),this[_0x5bec('0xf')]['bind'](this));ami['on'](_0x5bec('0x10'),this['syncHangup'][_0x5bec('0xd')](this));ami['on'](_0x5bec('0x11'),this[_0x5bec('0x12')]['bind'](this));ami['on'](_0x5bec('0x13'),this[_0x5bec('0x14')][_0x5bec('0xd')](this));ami['on']('blindtransfer',this[_0x5bec('0x15')][_0x5bec('0xd')](this));ami['on']('custom:agentConnectPreview',this[_0x5bec('0x16')][_0x5bec('0xd')](this));}function getDiff(_0x35393a){var _0x6888a4=moment()[_0x5bec('0x17')](0x0);var _0xcd6d90=moment(_0x35393a)[_0x5bec('0x17')](0x0);return _0x6888a4[_0x5bec('0x18')](_0xcd6d90,_0x5bec('0x19'));}Acw[_0x5bec('0x1a')][_0x5bec('0x1b')]=function(_0x325daf){try{var _0x11fb8e=this;var _0x506639=this['channels'][_0x325daf][_0x5bec('0x1c')];var _0x773740=this[_0x5bec('0xa')][_0x325daf][_0x5bec('0x1d')];var _0x5cd7ae=this['voiceQueues'][_0x773740];var _0x3cd354=![];var _0x6c0d35='ACW';if(_0x5cd7ae[_0x5bec('0x1e')]){if(_0x5cd7ae[_0x5bec('0x1f')][_0x5bec('0x20')]){_0x3cd354=!![];_0x6c0d35=_0x5cd7ae[_0x5bec('0x1f')]['name'];}}ami[_0x5bec('0x21')]({'action':'QueuePause','interface':_0x506639,'paused':!![],'reason':_0x6c0d35})[_0x5bec('0x22')](function(_0x208d99){if(_0x11fb8e[_0x5bec('0x8')][_0x506639]){return RpcUser[_0x5bec('0x23')](_0x11fb8e[_0x5bec('0x8')][_0x506639]['id'])['then'](function(_0x232584){if(_0x232584&&!_0x232584['voicePause']){logger[_0x5bec('0x24')](_0x5bec('0x25'),_0x325daf,_0x506639,_0x773740);var _0x5b2636=_0x11fb8e[_0x5bec('0xa')][_0x325daf][_0x5bec('0x26')]&&_0x11fb8e['channels'][_0x325daf][_0x5bec('0x27')]?_0x11fb8e[_0x5bec('0xa')][_0x325daf][_0x5bec('0x27')]:_0x325daf;return RpcUser[_0x5bec('0x28')](_0x11fb8e[_0x5bec('0x8')][_0x506639],_0x6c0d35,_0x5b2636)[_0x5bec('0x22')](function(_0x2dc014){if(!_0x3cd354){_0x11fb8e['timers'][_0x506639]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x325daf,_0x11fb8e[_0x5bec('0x7')][_0x773740][_0x5bec('0x29')],_0x506639,_0x773740);_0x11fb8e[_0x5bec('0x9')][_0x506639]['timer']=setTimeout(_0x11fb8e[_0x5bec('0x2a')][_0x5bec('0xd')](_0x11fb8e,_0x506639),_0x11fb8e['voiceQueues'][_0x773740][_0x5bec('0x29')]*0x3e8);_0x11fb8e[_0x5bec('0x9')][_0x506639]['lastPauseAt']=moment()['format'](_0x5bec('0x2b'));_0x11fb8e[_0x5bec('0x9')][_0x506639][_0x5bec('0x2c')]=_0x325daf;_0x11fb8e[_0x5bec('0x9')][_0x506639][_0x5bec('0x1d')]=_0x773740;_0x11fb8e[_0x5bec('0x9')][_0x506639]['updateAcw']=function(){var _0x2987ca=getDiff(_0x11fb8e['timers'][_0x506639][_0x5bec('0x2d')]);clearTimeout(_0x11fb8e[_0x5bec('0x9')][_0x506639][_0x5bec('0x2e')]);_0x11fb8e[_0x5bec('0x9')][_0x506639]['timer']=![];RpcVoiceAgentReport[_0x5bec('0x2f')]({'acwtime':_0x2987ca},_0x11fb8e[_0x5bec('0x9')][_0x506639][_0x5bec('0x2c')],_0x506639)['then'](function(_0xf6ae6b){logger['info'](_0x5bec('0x30'),_0x325daf,_0x2987ca,_0xf6ae6b);})[_0x5bec('0x31')](function(_0x29df14){logger['error'](_0x5bec('0x32'),_0x325daf,_0x29df14);});delete _0x11fb8e[_0x5bec('0x9')][_0x506639];};}});}else{logger['info'](_0x5bec('0x33'),_0x325daf,_0x506639,_0x773740);}});}})[_0x5bec('0x31')](function(_0x24aa2f){logger[_0x5bec('0x34')](_0x5bec('0x35'),_0x325daf,_0x11fb8e['voiceQueues'][_0x773740][_0x5bec('0x29')],_0x506639,_0x773740);})['finally'](function(){delete _0x11fb8e[_0x5bec('0xa')][_0x325daf];});}catch(_0x384f04){logger[_0x5bec('0x34')](_0x5bec('0x36'),_0x384f04[_0x5bec('0x37')]);}};Acw[_0x5bec('0x1a')]['stopAcw']=function(_0x1c6cc3){try{var _0xb515bb=this;if(_0xb515bb[_0x5bec('0x9')][_0x1c6cc3]){_0xb515bb['timers'][_0x1c6cc3][_0x5bec('0x2e')]=![];var _0x355707=_0xb515bb['timers'][_0x1c6cc3][_0x5bec('0x2c')];var _0x58c34e=_0xb515bb[_0x5bec('0x9')][_0x1c6cc3][_0x5bec('0x1d')];var _0x402e5d=_0xb515bb['voiceQueues'][_0x58c34e][_0x5bec('0x29')];logger[_0x5bec('0x24')](_0x5bec('0x38'),_0x1c6cc3);RpcUser[_0x5bec('0x39')](this[_0x5bec('0x8')][_0x1c6cc3]);RpcVoiceAgentReport[_0x5bec('0x2f')]({'acwtime':_0x402e5d,'agentacw':!![]},_0x355707,_0x1c6cc3)[_0x5bec('0x22')](function(_0x4a8b0b){logger[_0x5bec('0x24')](_0x5bec('0x30'),_0x355707,_0x402e5d,_0x4a8b0b);})[_0x5bec('0x31')](function(_0x414d59){logger['error'](_0x5bec('0x32'),_0x355707,_0x414d59);});}else{logger[_0x5bec('0x34')](_0x5bec('0x3a'),_0x1c6cc3);if(_0xb515bb['timers']){logger['info'](_0x5bec('0x3b'),JSON[_0x5bec('0x3c')](_0xb515bb[_0x5bec('0x9')]));}}}catch(_0x11f667){logger[_0x5bec('0x34')]('[ACW][STOP]\x20%s',_0x11f667['message']);}};Acw[_0x5bec('0x1a')]['syncAgentConnect']=function(_0x39597c){try{if(this[_0x5bec('0x7')][_0x39597c[_0x5bec('0x1d')]]&&(this['voiceQueues'][_0x39597c[_0x5bec('0x1d')]][_0x5bec('0x4')]||this['voiceQueues'][_0x39597c[_0x5bec('0x1d')]][_0x5bec('0x1e')])){if(this[_0x5bec('0x8')][_0x39597c[_0x5bec('0x1c')]]){this[_0x5bec('0xa')][_0x39597c[_0x5bec('0x2c')]]={'queue':_0x39597c[_0x5bec('0x1d')],'interface':_0x39597c['interface'],'destlinkedid':_0x39597c['destlinkedid']};}}}catch(_0x776912){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x776912[_0x5bec('0x37')]);}};Acw['prototype']['syncAgentConnectPreview']=function(_0x48bff0){try{if(this[_0x5bec('0x7')][_0x48bff0[_0x5bec('0x1d')]]&&(this[_0x5bec('0x7')][_0x48bff0[_0x5bec('0x1d')]]['acw']||this[_0x5bec('0x7')][_0x48bff0[_0x5bec('0x1d')]][_0x5bec('0x1e')])){if(this[_0x5bec('0x8')][_0x48bff0['interface']]){this[_0x5bec('0xa')][_0x48bff0[_0x5bec('0x2c')]]={'queue':_0x48bff0[_0x5bec('0x1d')],'interface':_0x48bff0['interface']};}}}catch(_0x2752ba){logger['error'](_0x5bec('0x3d'),_0x2752ba[_0x5bec('0x37')]);}};Acw[_0x5bec('0x1a')][_0x5bec('0xf')]=function(_0x54b11a){try{if(this[_0x5bec('0xa')][_0x54b11a[_0x5bec('0x2c')]]&&_[_0x5bec('0x3e')](this[_0x5bec('0xa')][_0x54b11a[_0x5bec('0x2c')]][_0x5bec('0x26')])){logger[_0x5bec('0x24')]('[%s][HANGUP:UNIQUEID]',_0x54b11a[_0x5bec('0x2c')]);this[_0x5bec('0x1b')](_0x54b11a['uniqueid']);}else if(this[_0x5bec('0xa')][_0x54b11a[_0x5bec('0x3f')]]&&_[_0x5bec('0x3e')](this[_0x5bec('0xa')][_0x54b11a[_0x5bec('0x3f')]][_0x5bec('0x26')])){logger[_0x5bec('0x24')]('[%s][HANGUP:LINKEDID]',_0x54b11a[_0x5bec('0x3f')]);this['startAcw'](_0x54b11a[_0x5bec('0x3f')]);}}catch(_0x208c7b){logger[_0x5bec('0x34')](_0x5bec('0x40'),_0x208c7b[_0x5bec('0x37')]);}};Acw[_0x5bec('0x1a')][_0x5bec('0x41')]=function(_0x3bc0c9){try{if(this[_0x5bec('0xa')][_0x3bc0c9[_0x5bec('0x2c')]]&&this['channels'][_0x3bc0c9[_0x5bec('0x2c')]]['attended']){logger['info'](_0x5bec('0x42'),_0x3bc0c9['uniqueid']);this['startAcw'](_0x3bc0c9[_0x5bec('0x2c')]);}else if(this[_0x5bec('0xa')][_0x3bc0c9[_0x5bec('0x3f')]]&&this['channels'][_0x3bc0c9[_0x5bec('0x3f')]][_0x5bec('0x26')]){logger[_0x5bec('0x24')](_0x5bec('0x43'),_0x3bc0c9['linkedid']);this[_0x5bec('0x1b')](_0x3bc0c9[_0x5bec('0x3f')]);}}catch(_0x9cae50){logger[_0x5bec('0x34')](_0x5bec('0x44'),_0x9cae50[_0x5bec('0x37')]);}};Acw[_0x5bec('0x1a')]['syncAttendedTransfer']=function(_0x504dda){try{if(!_[_0x5bec('0x45')](this['channels'][_0x504dda[_0x5bec('0x46')]])){this[_0x5bec('0x1b')](_0x504dda['transfereeuniqueid']);if(this[_0x5bec('0xa')][_0x504dda['secondtransfereruniqueid']]){this[_0x5bec('0xa')][_0x504dda[_0x5bec('0x47')]][_0x5bec('0x26')]=!![];this[_0x5bec('0xa')][_0x504dda[_0x5bec('0x48')]]=this[_0x5bec('0xa')][_0x504dda[_0x5bec('0x47')]];delete this[_0x5bec('0xa')][_0x504dda[_0x5bec('0x47')]];}}else if(!_[_0x5bec('0x45')](this[_0x5bec('0xa')][_0x504dda[_0x5bec('0x48')]])){this[_0x5bec('0x1b')](_0x504dda[_0x5bec('0x48')]);if(this['channels'][_0x504dda[_0x5bec('0x49')]]){this[_0x5bec('0xa')][_0x504dda[_0x5bec('0x49')]]['attended']=!![];this[_0x5bec('0xa')][_0x504dda[_0x5bec('0x46')]]=this[_0x5bec('0xa')][_0x504dda[_0x5bec('0x49')]];delete this[_0x5bec('0xa')][_0x504dda['origtransfereruniqueid']];}}}catch(_0x3e3108){logger[_0x5bec('0x34')](_0x5bec('0x4a'),_0x3e3108[_0x5bec('0x37')]);}};Acw['prototype'][_0x5bec('0x15')]=function(_0x5dda24){try{if(this[_0x5bec('0xa')][_0x5dda24[_0x5bec('0x4b')]]){logger[_0x5bec('0x24')](_0x5bec('0x4c'),JSON['stringify'](_0x5dda24[_0x5bec('0x4b')]));this[_0x5bec('0x1b')](_0x5dda24[_0x5bec('0x4b')]);}else if(this[_0x5bec('0xa')][_0x5dda24[_0x5bec('0x4d')]]){logger[_0x5bec('0x24')](_0x5bec('0x4e'),JSON[_0x5bec('0x3c')](_0x5dda24[_0x5bec('0x4d')]));this[_0x5bec('0x1b')](_0x5dda24[_0x5bec('0x4d')]);}}catch(_0x42d4e4){logger[_0x5bec('0x34')](_0x5bec('0x4f'),_0x42d4e4[_0x5bec('0x37')]);}};Acw['prototype'][_0x5bec('0x12')]=function(_0x27c160){try{if(this['voiceQueues'][_0x27c160[_0x5bec('0x1d')]]&&this['voiceQueues'][_0x27c160[_0x5bec('0x1d')]][_0x5bec('0x50')]==='all'){if(this['agents'][_0x27c160[_0x5bec('0x1c')]]){logger[_0x5bec('0x24')](_0x5bec('0x51'),_0x27c160[_0x5bec('0x2c')],_0x27c160[_0x5bec('0x1c')],_0x27c160['queue']);return RpcUser[_0x5bec('0x28')](this[_0x5bec('0x8')][_0x27c160['interface']],_0x5bec('0x52'),_0x27c160[_0x5bec('0x2c')]);}}}catch(_0x44a945){logger[_0x5bec('0x34')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x44a945[_0x5bec('0x37')]);}};module['exports']=Acw; \ No newline at end of file +var _0x4b84=['catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','[%s][UPDATE][ACWTIME:%s]','[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','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','../../../config/logger','../rpc/voiceAgentReport','voiceQueues','timers','channels','syncAgentConnect','syncHangupRequest','bind','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','syncAgentConnectPreview','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','name','mandatoryDispositionPause','Action','QueuePause','then','agents','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','timer','stopAcw','format','updateAcw','lastPauseAt','update','uniqueid'];(function(_0x44532f,_0x2dac86){var _0x11e878=function(_0x1cb557){while(--_0x1cb557){_0x44532f['push'](_0x44532f['shift']());}};_0x11e878(++_0x2dac86);}(_0x4b84,0x1cc));var _0x44b8=function(_0x4bd67a,_0x4f9725){_0x4bd67a=_0x4bd67a-0x0;var _0x2be5fb=_0x4b84[_0x4bd67a];return _0x2be5fb;};'use strict';var util=require(_0x44b8('0x0'));var _=require(_0x44b8('0x1'));var moment=require('moment');var ami=require('../ami');var logger=require(_0x44b8('0x2'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x44b8('0x3'));function Acw(_0x31282a){this[_0x44b8('0x4')]=_0x31282a['voiceQueues'];this['agents']=_0x31282a['agents'];this[_0x44b8('0x5')]=_0x31282a['timers'];this[_0x44b8('0x6')]={};ami['on']('agentconnect',this[_0x44b8('0x7')]['bind'](this));ami['on']('hanguprequest',this[_0x44b8('0x8')][_0x44b8('0x9')](this));ami['on'](_0x44b8('0xa'),this['syncHangup'][_0x44b8('0x9')](this));ami['on'](_0x44b8('0xb'),this[_0x44b8('0xc')][_0x44b8('0x9')](this));ami['on'](_0x44b8('0xd'),this[_0x44b8('0xe')][_0x44b8('0x9')](this));ami['on']('blindtransfer',this[_0x44b8('0xf')][_0x44b8('0x9')](this));ami['on']('custom:agentConnectPreview',this[_0x44b8('0x10')]['bind'](this));}function getDiff(_0x833ea3){var _0x18d642=moment()['milliseconds'](0x0);var _0x63e8f6=moment(_0x833ea3)['milliseconds'](0x0);return _0x18d642['diff'](_0x63e8f6,_0x44b8('0x11'));}Acw[_0x44b8('0x12')][_0x44b8('0x13')]=function(_0x41ab46){try{var _0x5e52f2=this;var _0x495c74=this['channels'][_0x41ab46][_0x44b8('0x14')];var _0x5b7803=this[_0x44b8('0x6')][_0x41ab46][_0x44b8('0x15')];var _0x55e258=this[_0x44b8('0x4')][_0x5b7803];var _0xe3de8f=![];var _0x5103f5=_0x44b8('0x16');if(_0x55e258[_0x44b8('0x17')]){if(_0x55e258['mandatoryDispositionPause'][_0x44b8('0x18')]){_0xe3de8f=!![];_0x5103f5=_0x55e258[_0x44b8('0x19')][_0x44b8('0x18')];}}ami[_0x44b8('0x1a')]({'action':_0x44b8('0x1b'),'interface':_0x495c74,'paused':!![],'reason':_0x5103f5})[_0x44b8('0x1c')](function(_0x452f2f){if(_0x5e52f2[_0x44b8('0x1d')][_0x495c74]){return RpcUser[_0x44b8('0x1e')](_0x5e52f2[_0x44b8('0x1d')][_0x495c74]['id'])[_0x44b8('0x1c')](function(_0x14996c){if(_0x14996c&&!_0x14996c['voicePause']){logger[_0x44b8('0x1f')](_0x44b8('0x20'),_0x41ab46,_0x495c74,_0x5b7803);var _0x416b34=_0x5e52f2[_0x44b8('0x6')][_0x41ab46][_0x44b8('0x21')]&&_0x5e52f2['channels'][_0x41ab46][_0x44b8('0x22')]?_0x5e52f2['channels'][_0x41ab46][_0x44b8('0x22')]:_0x41ab46;return RpcUser[_0x44b8('0x23')](_0x5e52f2[_0x44b8('0x1d')][_0x495c74],_0x5103f5,_0x416b34)[_0x44b8('0x1c')](function(_0x230a3d){if(!_0xe3de8f){_0x5e52f2['timers'][_0x495c74]={};logger[_0x44b8('0x1f')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x41ab46,_0x5e52f2[_0x44b8('0x4')][_0x5b7803][_0x44b8('0x24')],_0x495c74,_0x5b7803);_0x5e52f2['timers'][_0x495c74][_0x44b8('0x25')]=setTimeout(_0x5e52f2[_0x44b8('0x26')][_0x44b8('0x9')](_0x5e52f2,_0x495c74),_0x5e52f2['voiceQueues'][_0x5b7803][_0x44b8('0x24')]*0x3e8);_0x5e52f2[_0x44b8('0x5')][_0x495c74]['lastPauseAt']=moment()[_0x44b8('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0x5e52f2[_0x44b8('0x5')][_0x495c74]['uniqueid']=_0x41ab46;_0x5e52f2['timers'][_0x495c74]['queue']=_0x5b7803;_0x5e52f2[_0x44b8('0x5')][_0x495c74][_0x44b8('0x28')]=function(){var _0x44ce5a=getDiff(_0x5e52f2[_0x44b8('0x5')][_0x495c74][_0x44b8('0x29')]);clearTimeout(_0x5e52f2[_0x44b8('0x5')][_0x495c74][_0x44b8('0x25')]);_0x5e52f2[_0x44b8('0x5')][_0x495c74][_0x44b8('0x25')]=![];RpcVoiceAgentReport[_0x44b8('0x2a')]({'acwtime':_0x44ce5a},_0x5e52f2[_0x44b8('0x5')][_0x495c74][_0x44b8('0x2b')],_0x495c74)[_0x44b8('0x1c')](function(_0x5189dd){logger[_0x44b8('0x1f')]('[%s][UPDATE][ACWTIME:%s]',_0x41ab46,_0x44ce5a,_0x5189dd);})[_0x44b8('0x2c')](function(_0x1652cb){logger[_0x44b8('0x2d')](_0x44b8('0x2e'),_0x41ab46,_0x1652cb);});delete _0x5e52f2[_0x44b8('0x5')][_0x495c74];};}});}else{logger['info'](_0x44b8('0x2f'),_0x41ab46,_0x495c74,_0x5b7803);}});}})[_0x44b8('0x2c')](function(_0x26265f){logger[_0x44b8('0x2d')](_0x44b8('0x30'),_0x41ab46,_0x5e52f2['voiceQueues'][_0x5b7803][_0x44b8('0x24')],_0x495c74,_0x5b7803);})[_0x44b8('0x31')](function(){delete _0x5e52f2[_0x44b8('0x6')][_0x41ab46];});}catch(_0x3e93af){logger[_0x44b8('0x2d')](_0x44b8('0x32'),_0x3e93af[_0x44b8('0x33')]);}};Acw[_0x44b8('0x12')][_0x44b8('0x26')]=function(_0x181761){try{var _0x13994c=this;if(_0x13994c[_0x44b8('0x5')][_0x181761]){_0x13994c[_0x44b8('0x5')][_0x181761][_0x44b8('0x25')]=![];var _0x1e1a8a=_0x13994c[_0x44b8('0x5')][_0x181761][_0x44b8('0x2b')];var _0xeff999=_0x13994c[_0x44b8('0x5')][_0x181761][_0x44b8('0x15')];var _0x2c02d6=_0x13994c[_0x44b8('0x4')][_0xeff999]['acwTimeout'];logger[_0x44b8('0x1f')](_0x44b8('0x34'),_0x181761);RpcUser['saveUnpause'](this[_0x44b8('0x1d')][_0x181761]);RpcVoiceAgentReport[_0x44b8('0x2a')]({'acwtime':_0x2c02d6,'agentacw':!![]},_0x1e1a8a,_0x181761)[_0x44b8('0x1c')](function(_0x332c2b){logger['info'](_0x44b8('0x35'),_0x1e1a8a,_0x2c02d6,_0x332c2b);})[_0x44b8('0x2c')](function(_0x3611b4){logger[_0x44b8('0x2d')](_0x44b8('0x2e'),_0x1e1a8a,_0x3611b4);});}else{logger[_0x44b8('0x2d')](_0x44b8('0x36'),_0x181761);if(_0x13994c[_0x44b8('0x5')]){logger[_0x44b8('0x1f')](_0x44b8('0x37'),JSON[_0x44b8('0x38')](_0x13994c[_0x44b8('0x5')]));}}}catch(_0xd69398){logger[_0x44b8('0x2d')](_0x44b8('0x39'),_0xd69398[_0x44b8('0x33')]);}};Acw['prototype'][_0x44b8('0x7')]=function(_0x43e43a){try{if(this[_0x44b8('0x4')][_0x43e43a['queue']]&&(this[_0x44b8('0x4')][_0x43e43a[_0x44b8('0x15')]][_0x44b8('0x3a')]||this['voiceQueues'][_0x43e43a[_0x44b8('0x15')]][_0x44b8('0x17')])){if(this[_0x44b8('0x1d')][_0x43e43a[_0x44b8('0x14')]]){this[_0x44b8('0x6')][_0x43e43a['uniqueid']]={'queue':_0x43e43a['queue'],'interface':_0x43e43a[_0x44b8('0x14')],'destlinkedid':_0x43e43a[_0x44b8('0x22')]};}}}catch(_0x430257){logger[_0x44b8('0x2d')](_0x44b8('0x3b'),_0x430257[_0x44b8('0x33')]);}};Acw[_0x44b8('0x12')][_0x44b8('0x10')]=function(_0x455fd6){try{if(this[_0x44b8('0x4')][_0x455fd6[_0x44b8('0x15')]]&&(this[_0x44b8('0x4')][_0x455fd6[_0x44b8('0x15')]][_0x44b8('0x3a')]||this[_0x44b8('0x4')][_0x455fd6[_0x44b8('0x15')]][_0x44b8('0x17')])){if(this[_0x44b8('0x1d')][_0x455fd6[_0x44b8('0x14')]]){this['channels'][_0x455fd6['uniqueid']]={'queue':_0x455fd6[_0x44b8('0x15')],'interface':_0x455fd6[_0x44b8('0x14')]};}}}catch(_0x15f183){logger[_0x44b8('0x2d')](_0x44b8('0x3c'),_0x15f183[_0x44b8('0x33')]);}};Acw[_0x44b8('0x12')]['syncHangupRequest']=function(_0x156070){try{if(this['channels'][_0x156070[_0x44b8('0x2b')]]&&_[_0x44b8('0x3d')](this[_0x44b8('0x6')][_0x156070[_0x44b8('0x2b')]][_0x44b8('0x21')])){logger[_0x44b8('0x1f')]('[%s][HANGUP:UNIQUEID]',_0x156070[_0x44b8('0x2b')]);this[_0x44b8('0x13')](_0x156070[_0x44b8('0x2b')]);}else if(this[_0x44b8('0x6')][_0x156070['linkedid']]&&_[_0x44b8('0x3d')](this[_0x44b8('0x6')][_0x156070[_0x44b8('0x3e')]][_0x44b8('0x21')])){logger[_0x44b8('0x1f')](_0x44b8('0x3f'),_0x156070['linkedid']);this[_0x44b8('0x13')](_0x156070[_0x44b8('0x3e')]);}}catch(_0x2c5c27){logger[_0x44b8('0x2d')](_0x44b8('0x40'),_0x2c5c27['message']);}};Acw['prototype'][_0x44b8('0x41')]=function(_0x4eb344){try{if(this[_0x44b8('0x6')][_0x4eb344['uniqueid']]&&this[_0x44b8('0x6')][_0x4eb344[_0x44b8('0x2b')]][_0x44b8('0x21')]){logger[_0x44b8('0x1f')](_0x44b8('0x42'),_0x4eb344[_0x44b8('0x2b')]);this[_0x44b8('0x13')](_0x4eb344['uniqueid']);}else if(this[_0x44b8('0x6')][_0x4eb344[_0x44b8('0x3e')]]&&this[_0x44b8('0x6')][_0x4eb344['linkedid']][_0x44b8('0x21')]){logger[_0x44b8('0x1f')](_0x44b8('0x43'),_0x4eb344[_0x44b8('0x3e')]);this['startAcw'](_0x4eb344[_0x44b8('0x3e')]);}}catch(_0x308f7b){logger['error'](_0x44b8('0x44'),_0x308f7b[_0x44b8('0x33')]);}};Acw[_0x44b8('0x12')][_0x44b8('0xe')]=function(_0xe86e34){try{if(!_['isNil'](this['channels'][_0xe86e34[_0x44b8('0x45')]])){this[_0x44b8('0x13')](_0xe86e34[_0x44b8('0x45')]);if(this[_0x44b8('0x6')][_0xe86e34[_0x44b8('0x46')]]){this[_0x44b8('0x6')][_0xe86e34[_0x44b8('0x46')]][_0x44b8('0x21')]=!![];this[_0x44b8('0x6')][_0xe86e34[_0x44b8('0x47')]]=this[_0x44b8('0x6')][_0xe86e34[_0x44b8('0x46')]];delete this['channels'][_0xe86e34[_0x44b8('0x46')]];}}else if(!_[_0x44b8('0x48')](this[_0x44b8('0x6')][_0xe86e34[_0x44b8('0x47')]])){this[_0x44b8('0x13')](_0xe86e34[_0x44b8('0x47')]);if(this[_0x44b8('0x6')][_0xe86e34[_0x44b8('0x49')]]){this[_0x44b8('0x6')][_0xe86e34[_0x44b8('0x49')]][_0x44b8('0x21')]=!![];this[_0x44b8('0x6')][_0xe86e34[_0x44b8('0x45')]]=this[_0x44b8('0x6')][_0xe86e34[_0x44b8('0x49')]];delete this[_0x44b8('0x6')][_0xe86e34[_0x44b8('0x49')]];}}}catch(_0x20e563){logger['error'](_0x44b8('0x4a'),_0x20e563[_0x44b8('0x33')]);}};Acw[_0x44b8('0x12')][_0x44b8('0xf')]=function(_0x51f763){try{if(this[_0x44b8('0x6')][_0x51f763[_0x44b8('0x4b')]]){logger['info'](_0x44b8('0x4c'),JSON[_0x44b8('0x38')](_0x51f763['transfereruniqueid']));this[_0x44b8('0x13')](_0x51f763[_0x44b8('0x4b')]);}else if(this['channels'][_0x51f763[_0x44b8('0x4d')]]){logger[_0x44b8('0x1f')](_0x44b8('0x4e'),JSON['stringify'](_0x51f763[_0x44b8('0x4d')]));this['startAcw'](_0x51f763[_0x44b8('0x4d')]);}}catch(_0x5161ea){logger[_0x44b8('0x2d')](_0x44b8('0x4f'),_0x5161ea[_0x44b8('0x33')]);}};Acw[_0x44b8('0x12')][_0x44b8('0xc')]=function(_0x230b6a){try{if(this['voiceQueues'][_0x230b6a[_0x44b8('0x15')]]&&this['voiceQueues'][_0x230b6a[_0x44b8('0x15')]][_0x44b8('0x50')]==='all'){if(this[_0x44b8('0x1d')][_0x230b6a[_0x44b8('0x14')]]){logger[_0x44b8('0x1f')](_0x44b8('0x51'),_0x230b6a[_0x44b8('0x2b')],_0x230b6a[_0x44b8('0x14')],_0x230b6a[_0x44b8('0x15')]);return RpcUser[_0x44b8('0x23')](this[_0x44b8('0x1d')][_0x230b6a[_0x44b8('0x14')]],_0x44b8('0x52'),_0x230b6a[_0x44b8('0x2b')]);}}}catch(_0x52381a){logger[_0x44b8('0x2d')](_0x44b8('0x53'),_0x52381a[_0x44b8('0x33')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index bef6d5c..7f893a9 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 _0x920b=['actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','log','close','exports','asterisk-manager','bluebird','moment','lodash','../../config/logger','ami','../../config/environment','asterisk','port','username','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry'];(function(_0x551663,_0x21f78c){var _0x321580=function(_0x502f0b){while(--_0x502f0b){_0x551663['push'](_0x551663['shift']());}};_0x321580(++_0x21f78c);}(_0x920b,0x1a3));var _0xb920=function(_0x1209a9,_0x598162){_0x1209a9=_0x1209a9-0x0;var _0x4d91fa=_0x920b[_0x1209a9];return _0x4d91fa;};'use strict';var Manager=require(_0xb920('0x0'));var BPromise=require(_0xb920('0x1'));var moment=require(_0xb920('0x2'));var util=require('util');var _=require(_0xb920('0x3'));var logger=require(_0xb920('0x4'))(_0xb920('0x5'));var config=require(_0xb920('0x6'));var ami=new Manager(config[_0xb920('0x7')][_0xb920('0x8')],config[_0xb920('0x7')]['ip'],config[_0xb920('0x7')][_0xb920('0x9')],config[_0xb920('0x7')]['password'],!![]);ami[_0xb920('0xa')]();ami[_0xb920('0xb')]=BPromise[_0xb920('0xc')](ami[_0xb920('0xd')]);function error(_0x42c09c){logger[_0xb920('0xe')](util[_0xb920('0xf')](_0xb920('0x10'),config['asterisk'][_0xb920('0x9')],config[_0xb920('0x7')]['ip'],config[_0xb920('0x7')][_0xb920('0x8')],util[_0xb920('0x11')](_0x42c09c,![],null)));}function close(){logger[_0xb920('0xe')](util['format'](_0xb920('0x12'),config[_0xb920('0x7')][_0xb920('0x9')],config[_0xb920('0x7')]['ip'],config[_0xb920('0x7')][_0xb920('0x8')]));}ami[_0xb920('0x13')]=function(){return function(){return ami['Action']({'action':_0xb920('0x14')});};};ami[_0xb920('0x15')]=function(){return function(){return ami[_0xb920('0xb')]({'action':_0xb920('0x16')});};};ami[_0xb920('0x17')]=function(){return function(){return ami[_0xb920('0xb')]({'action':'sippeerstatus'});};};ami[_0xb920('0x18')]=function(){return function(){return ami['Action']({'action':_0xb920('0x19')});};};ami[_0xb920('0x1a')]=function(){return function(){return ami[_0xb920('0xb')]({'action':_0xb920('0x1b')});};};function connect(_0x345a71){logger[_0xb920('0x1c')](util['format'](_0xb920('0x1d'),config['asterisk'][_0xb920('0x9')],config[_0xb920('0x7')]['ip'],config[_0xb920('0x7')][_0xb920('0x8')]));ami[_0xb920('0x1e')](_0xb920('0xe'),error);ami[_0xb920('0x1e')]('close',close);}ami['on'](_0xb920('0x1f'),connect);ami['on'](_0xb920('0x20'),function(_0x262fcf){logger[_0xb920('0x1c')](util[_0xb920('0xf')](_0xb920('0x21'),config[_0xb920('0x7')][_0xb920('0x9')],config[_0xb920('0x7')]['ip'],config[_0xb920('0x7')][_0xb920('0x8')],util[_0xb920('0x11')](_0x262fcf,![],null)));});ami['on'](_0xb920('0x22'),function(_0x2db638){logger[_0xb920('0x1c')](util[_0xb920('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xb920('0x7')][_0xb920('0x9')],config['asterisk']['ip'],config['asterisk'][_0xb920('0x8')]));return BPromise[_0xb920('0x23')]()['then'](ami['actionSipShowRegistry']())[_0xb920('0x24')](ami[_0xb920('0x15')]())[_0xb920('0x24')](ami[_0xb920('0x17')]())[_0xb920('0x24')](ami[_0xb920('0x18')]())[_0xb920('0x24')](ami[_0xb920('0x1a')]())['catch'](function(_0x202034){console[_0xb920('0x25')](_0x202034);});});ami[_0xb920('0x1e')]('error',error);ami[_0xb920('0x1e')](_0xb920('0x26'),close);module[_0xb920('0x27')]=ami; \ No newline at end of file +var _0xe7ef=['Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','actionSipShowRegistry','then','actionQueueSummary','catch','log','once','moment','util','lodash','ami','../../config/environment','asterisk','port','username','password'];(function(_0x55c181,_0x31e7d9){var _0x2e6964=function(_0x4c046f){while(--_0x4c046f){_0x55c181['push'](_0x55c181['shift']());}};_0x2e6964(++_0x31e7d9);}(_0xe7ef,0x69));var _0xfe7e=function(_0x5b4792,_0x21eb7f){_0x5b4792=_0x5b4792-0x0;var _0x4f4a3f=_0xe7ef[_0x5b4792];return _0x4f4a3f;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require(_0xfe7e('0x0'));var util=require(_0xfe7e('0x1'));var _=require(_0xfe7e('0x2'));var logger=require('../../config/logger')(_0xfe7e('0x3'));var config=require(_0xfe7e('0x4'));var ami=new Manager(config[_0xfe7e('0x5')][_0xfe7e('0x6')],config[_0xfe7e('0x5')]['ip'],config[_0xfe7e('0x5')][_0xfe7e('0x7')],config['asterisk'][_0xfe7e('0x8')],!![]);ami['keepConnected']();ami[_0xfe7e('0x9')]=BPromise[_0xfe7e('0xa')](ami[_0xfe7e('0xb')]);function error(_0x2e220f){logger[_0xfe7e('0xc')](util[_0xfe7e('0xd')](_0xfe7e('0xe'),config['asterisk']['username'],config[_0xfe7e('0x5')]['ip'],config['asterisk']['port'],util[_0xfe7e('0xf')](_0x2e220f,![],null)));}function close(){logger[_0xfe7e('0xc')](util[_0xfe7e('0xd')](_0xfe7e('0x10'),config['asterisk'][_0xfe7e('0x7')],config[_0xfe7e('0x5')]['ip'],config[_0xfe7e('0x5')][_0xfe7e('0x6')]));}ami['actionSipShowRegistry']=function(){return function(){return ami['Action']({'action':_0xfe7e('0x11')});};};ami[_0xfe7e('0x12')]=function(){return function(){return ami[_0xfe7e('0x9')]({'action':_0xfe7e('0x13')});};};ami[_0xfe7e('0x14')]=function(){return function(){return ami[_0xfe7e('0x9')]({'action':_0xfe7e('0x15')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0xfe7e('0x16')});};};ami[_0xfe7e('0x17')]=function(){return function(){return ami[_0xfe7e('0x9')]({'action':_0xfe7e('0x18')});};};function connect(_0x42c031){logger['info'](util[_0xfe7e('0xd')](_0xfe7e('0x19'),config['asterisk'][_0xfe7e('0x7')],config[_0xfe7e('0x5')]['ip'],config[_0xfe7e('0x5')][_0xfe7e('0x6')]));ami['once'](_0xfe7e('0xc'),error);ami['once'](_0xfe7e('0x1a'),close);}ami['on'](_0xfe7e('0x1b'),connect);ami['on']('shutdown',function(_0x14a494){logger['info'](util[_0xfe7e('0xd')](_0xfe7e('0x1c'),config['asterisk'][_0xfe7e('0x7')],config[_0xfe7e('0x5')]['ip'],config[_0xfe7e('0x5')][_0xfe7e('0x6')],util['inspect'](_0x14a494,![],null)));});ami['on'](_0xfe7e('0x1d'),function(_0x1b363d){logger['info'](util[_0xfe7e('0xd')](_0xfe7e('0x1e'),config[_0xfe7e('0x5')][_0xfe7e('0x7')],config['asterisk']['ip'],config[_0xfe7e('0x5')][_0xfe7e('0x6')]));return BPromise[_0xfe7e('0x1f')]()['then'](ami[_0xfe7e('0x20')]())['then'](ami[_0xfe7e('0x12')]())[_0xfe7e('0x21')](ami[_0xfe7e('0x14')]())[_0xfe7e('0x21')](ami[_0xfe7e('0x22')]())[_0xfe7e('0x21')](ami[_0xfe7e('0x17')]())[_0xfe7e('0x23')](function(_0x250950){console[_0xfe7e('0x24')](_0x250950);});});ami['once'](_0xfe7e('0xc'),error);ami[_0xfe7e('0x25')]('close',close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 9fec3f3..cc211b4 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 _0xec93=['client','http','Request','rpc','memberReport','error','message','result','exports','bluebird','../../config/logger','ami'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xec93,0x11d));var _0x3ec9=function(_0x259024,_0x5cef61){_0x259024=_0x259024-0x0;var _0x198db4=_0xec93[_0x259024];return _0x198db4;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x3ec9('0x0'));var logger=require(_0x3ec9('0x1'))(_0x3ec9('0x2'));var client=jayson[_0x3ec9('0x3')][_0x3ec9('0x4')]({'port':0x2329});client[_0x3ec9('0x5')]=function(_0x5d854a,_0x55e119){return new BPromise(function(_0x37e6a8,_0x554fa2){return client['request'](_0x5d854a,_0x55e119)['then'](function(_0x450d00){logger['debug'](_0x3ec9('0x6'),_0x3ec9('0x7'),_0x5d854a,_0x55e119,_0x450d00);if(_0x450d00[_0x3ec9('0x8')]){logger[_0x3ec9('0x8')](_0x3ec9('0x6'),_0x3ec9('0x7'),_0x5d854a,_0x450d00[_0x3ec9('0x8')][_0x3ec9('0x9')],_0x55e119);return _0x554fa2(_0x450d00[_0x3ec9('0x8')][_0x3ec9('0x9')]);}else{return _0x37e6a8(_0x450d00[_0x3ec9('0xa')]);}})['catch'](function(_0x4e7cae){logger[_0x3ec9('0x8')]('rpc',_0x3ec9('0x7'),_0x5d854a,_0x4e7cae,_0x55e119);return _0x554fa2(_0x4e7cae);});});};module[_0x3ec9('0xb')]=client; \ No newline at end of file +var _0x4040=['client','http','Request','request','then','debug','rpc','memberReport','message','error','result','catch','exports','jayson/promise','../../config/logger','ami'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x4040,0xfd));var _0x0404=function(_0x19492c,_0x192aef){_0x19492c=_0x19492c-0x0;var _0x4b9288=_0x4040[_0x19492c];return _0x4b9288;};'use strict';var jayson=require(_0x0404('0x0'));var BPromise=require('bluebird');var logger=require(_0x0404('0x1'))(_0x0404('0x2'));var client=jayson[_0x0404('0x3')][_0x0404('0x4')]({'port':0x2329});client[_0x0404('0x5')]=function(_0x2377bb,_0x3e6dd7){return new BPromise(function(_0x2c8127,_0x399041){return client[_0x0404('0x6')](_0x2377bb,_0x3e6dd7)[_0x0404('0x7')](function(_0x46e006){logger[_0x0404('0x8')](_0x0404('0x9'),'memberReport',_0x2377bb,_0x3e6dd7,_0x46e006);if(_0x46e006['error']){logger['error'](_0x0404('0x9'),_0x0404('0xa'),_0x2377bb,_0x46e006['error'][_0x0404('0xb')],_0x3e6dd7);return _0x399041(_0x46e006[_0x0404('0xc')][_0x0404('0xb')]);}else{return _0x2c8127(_0x46e006[_0x0404('0xd')]);}})[_0x0404('0xe')](function(_0x52fe2d){logger[_0x0404('0xc')](_0x0404('0x9'),_0x0404('0xa'),_0x2377bb,_0x52fe2d,_0x3e6dd7);return _0x399041(_0x52fe2d);});});};module[_0x0404('0xf')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 8195857..01b73c0 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 _0x24cf=['VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','moment','string','isNil','uniqueid','Contact','phone','firstName','lastName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x24cf,0x1d5));var _0xf24c=function(_0x55a771,_0xf6863a){_0x55a771=_0x55a771-0x0;var _0x21c067=_0x24cf[_0x55a771];return _0x21c067;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xf24c('0x0'));function checkNameSurname(_0x19ab73,_0x227c22,_0x40675a){var _0x45f945='';if(!_['isNil'](_0x227c22)&&_0xf24c('0x1')===typeof _0x227c22){_0x45f945+=_0x227c22;}if(!_[_0xf24c('0x2')](_0x40675a)&&_0xf24c('0x1')===typeof _0x40675a){_0x45f945+='\x20'+_0x40675a;}if(_0x45f945!==''){return _0x45f945;}return _0x19ab73;}function Action(_0x10c351,_0x5c4ebc,_0x4983e2){this['voiceQueue']=_0x10c351;this[_0xf24c('0x3')]=_0x4983e2||undefined;this['name']=checkNameSurname(_0x5c4ebc[_0xf24c('0x4')][_0xf24c('0x5')],_0x5c4ebc[_0xf24c('0x4')][_0xf24c('0x6')],_0x5c4ebc['Contact'][_0xf24c('0x7')]);this[_0xf24c('0x8')]=_0x5c4ebc[_0xf24c('0x4')][_0xf24c('0x5')];this[_0xf24c('0x9')]=_0x10c351[_0xf24c('0xa')];this['active']=_0x5c4ebc[_0xf24c('0xb')]||![];this[_0xf24c('0xc')]=_0x10c351[_0xf24c('0xc')];this['dialQueueTimeout']=_0x10c351[_0xf24c('0xd')]||0x3;this[_0xf24c('0xe')]=_0x5c4ebc['scheduledat'];this['countbusyretry']=_0x5c4ebc[_0xf24c('0xf')];this['countcongestionretry']=_0x5c4ebc[_0xf24c('0x10')];this[_0xf24c('0x11')]=_0x5c4ebc['countnoanswerretry'];this[_0xf24c('0x12')]=_0x5c4ebc[_0xf24c('0x12')];this[_0xf24c('0x13')]=_0x5c4ebc[_0xf24c('0x13')];this[_0xf24c('0x14')]=_0x5c4ebc['countabandonedretry'];this['countmachineretry']=_0x5c4ebc[_0xf24c('0x15')];this[_0xf24c('0x16')]=_0x5c4ebc['countagentrejectretry'];this[_0xf24c('0x17')]=_0x5c4ebc[_0xf24c('0x17')];this[_0xf24c('0x18')]=_0x5c4ebc[_0xf24c('0x18')];this[_0xf24c('0x19')]=_0x5c4ebc[_0xf24c('0x19')];this[_0xf24c('0x1a')]=_0x5c4ebc[_0xf24c('0x1a')];this[_0xf24c('0x1b')]=_0x5c4ebc[_0xf24c('0x1b')];this[_0xf24c('0x1c')]=_0x5c4ebc['id'];this[_0xf24c('0x1d')]=_0x5c4ebc['Contact'][_0xf24c('0x6')]||'';this[_0xf24c('0x1e')]=moment()['format'](_0xf24c('0x1f'));this[_0xf24c('0x20')]=_0x5c4ebc[_0xf24c('0x20')];this['callbackuniqueid']=_0x5c4ebc[_0xf24c('0x21')];this['callbackat']=_0x5c4ebc[_0xf24c('0x22')];this[_0xf24c('0x23')]=_0x5c4ebc['recallme'];this[_0xf24c('0x24')]='';this[_0xf24c('0x25')]='';}Action[_0xf24c('0x26')][_0xf24c('0x27')]=function(){return util[_0xf24c('0x28')](_0xf24c('0x29'),this[_0xf24c('0xa')],this[_0xf24c('0x2a')][_0xf24c('0x2b')]>0x0?this[_0xf24c('0x8')][_0xf24c('0x2c')](this['voiceQueue']['dialCutDigit']):this[_0xf24c('0x8')]);};Action['prototype']['getQueue']=function(){return this[_0xf24c('0x9')];};module['exports']=Action; \ No newline at end of file +var _0x0de3=['recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','prototype','getQueue','queue','exports','util','lodash','isNil','string','voiceQueue','phone','Contact','firstName','number','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x0de3,0x184));var _0x30de=function(_0x4e3f51,_0x271183){_0x4e3f51=_0x4e3f51-0x0;var _0xffbbb9=_0x0de3[_0x4e3f51];return _0xffbbb9;};'use strict';var util=require(_0x30de('0x0'));var _=require(_0x30de('0x1'));var moment=require('moment');function checkNameSurname(_0x243896,_0x8f875c,_0x2b15a6){var _0x1675fc='';if(!_[_0x30de('0x2')](_0x8f875c)&&_0x30de('0x3')===typeof _0x8f875c){_0x1675fc+=_0x8f875c;}if(!_[_0x30de('0x2')](_0x2b15a6)&&_0x30de('0x3')===typeof _0x2b15a6){_0x1675fc+='\x20'+_0x2b15a6;}if(_0x1675fc!==''){return _0x1675fc;}return _0x243896;}function Action(_0x1687c4,_0x512874,_0x55e5e9){this[_0x30de('0x4')]=_0x1687c4;this['uniqueid']=_0x55e5e9||undefined;this['name']=checkNameSurname(_0x512874['Contact'][_0x30de('0x5')],_0x512874[_0x30de('0x6')][_0x30de('0x7')],_0x512874[_0x30de('0x6')]['lastName']);this[_0x30de('0x8')]=_0x512874[_0x30de('0x6')][_0x30de('0x5')];this['queue']=_0x1687c4[_0x30de('0x9')];this[_0x30de('0xa')]=_0x512874[_0x30de('0xa')]||![];this[_0x30de('0xb')]=_0x1687c4[_0x30de('0xb')];this[_0x30de('0xc')]=_0x1687c4[_0x30de('0xc')]||0x3;this[_0x30de('0xd')]=_0x512874[_0x30de('0xd')];this[_0x30de('0xe')]=_0x512874[_0x30de('0xe')];this['countcongestionretry']=_0x512874[_0x30de('0xf')];this[_0x30de('0x10')]=_0x512874[_0x30de('0x10')];this[_0x30de('0x11')]=_0x512874['countnosuchnumberretry'];this['countdropretry']=_0x512874[_0x30de('0x12')];this[_0x30de('0x13')]=_0x512874[_0x30de('0x13')];this['countmachineretry']=_0x512874['countmachineretry'];this['countagentrejectretry']=_0x512874[_0x30de('0x14')];this[_0x30de('0x15')]=_0x512874['ContactId'];this[_0x30de('0x16')]=_0x512874[_0x30de('0x16')];this[_0x30de('0x17')]=_0x512874[_0x30de('0x17')];this['VoiceQueueId']=_0x512874[_0x30de('0x18')];this['CampaignId']=_0x512874['CampaignId'];this[_0x30de('0x19')]=_0x512874['id'];this[_0x30de('0x1a')]=_0x512874[_0x30de('0x6')][_0x30de('0x7')]||'';this[_0x30de('0x1b')]=moment()[_0x30de('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x30de('0x1d')]=_0x512874[_0x30de('0x1d')];this['callbackuniqueid']=_0x512874[_0x30de('0x1e')];this[_0x30de('0x1f')]=_0x512874[_0x30de('0x1f')];this[_0x30de('0x20')]=_0x512874[_0x30de('0x20')];this[_0x30de('0x21')]='';this[_0x30de('0x22')]='';}Action['prototype'][_0x30de('0x23')]=function(){return util[_0x30de('0x1c')](_0x30de('0x24'),this[_0x30de('0x9')],this[_0x30de('0x4')][_0x30de('0x25')]>0x0?this['number']['substring'](this[_0x30de('0x4')][_0x30de('0x25')]):this['number']);};Action[_0x30de('0x26')][_0x30de('0x27')]=function(){return this[_0x30de('0x28')];};module[_0x30de('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 13708da..0163130 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 _0x5dd9=['queue','countbusyretry','countnoanswerretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','Answer','scheduledat','type','campaigntype','outbound'];(function(_0x465c3f,_0x45b9d5){var _0x2098da=function(_0x3d1d5f){while(--_0x3d1d5f){_0x465c3f['push'](_0x465c3f['shift']());}};_0x2098da(++_0x45b9d5);}(_0x5dd9,0xaa));var _0x95dd=function(_0x1f6ba3,_0x5b7a1d){_0x1f6ba3=_0x1f6ba3-0x0;var _0x218b24=_0x5dd9[_0x1f6ba3];return _0x218b24;};'use strict';var util=require(_0x95dd('0x0'));var _=require('lodash');var moment=require(_0x95dd('0x1'));function getSeconds(_0x2a44dd,_0x5558f0){var _0x4f34f8=moment(_0x2a44dd)[_0x95dd('0x2')](0x0);var _0x4904ea=moment(_0x5558f0)[_0x95dd('0x2')](0x0);return _0x4f34f8[_0x95dd('0x3')](_0x4904ea,_0x95dd('0x4'));}function AgentComplete(_0x4db57b,_0x2b793d){this['state']=0x4;this['statedesc']=_0x95dd('0x5');this[_0x95dd('0x6')]=_0x4db57b[_0x95dd('0x6')];this['type']=_0x4db57b[_0x95dd('0x7')];this[_0x95dd('0x8')]=_0x4db57b[_0x95dd('0x7')]===_0x95dd('0x9')?_0x95dd('0xa'):_0x4db57b[_0x95dd('0x7')];this[_0x95dd('0xb')]=_0x4db57b[_0x95dd('0xb')];this['countcongestionretry']=_0x4db57b['countcongestionretry'];this['countnoanswerretry']=_0x4db57b[_0x95dd('0xc')];this['countglobal']=_0x4db57b['countbusyretry']+_0x4db57b[_0x95dd('0xd')]+_0x4db57b['countnoanswerretry']+_0x4db57b[_0x95dd('0xe')]+_0x4db57b[_0x95dd('0xf')]+_0x4db57b[_0x95dd('0x10')]+_0x4db57b['countmachineretry']+_0x4db57b[_0x95dd('0x11')];this[_0x95dd('0xe')]=_0x4db57b['countnosuchnumberretry'];this[_0x95dd('0xf')]=_0x4db57b['countdropretry'];this[_0x95dd('0x10')]=_0x4db57b[_0x95dd('0x10')];this[_0x95dd('0x12')]=_0x4db57b['countmachineretry'];this[_0x95dd('0x11')]=_0x4db57b[_0x95dd('0x11')];this[_0x95dd('0x13')]=_0x2b793d[_0x95dd('0x13')];this[_0x95dd('0x14')]=_0x4db57b[_0x95dd('0x15')];this[_0x95dd('0x16')]=_0x4db57b[_0x95dd('0x17')];this[_0x95dd('0x18')]=_0x4db57b[_0x95dd('0x18')];this[_0x95dd('0x19')]=_0x4db57b[_0x95dd('0x19')];this[_0x95dd('0x1a')]=_0x4db57b[_0x95dd('0x1a')];this[_0x95dd('0x1b')]=moment()[_0x95dd('0x1c')](_0x95dd('0x1d'));this[_0x95dd('0x1e')]=getSeconds(_0x4db57b['responsetime'],_0x4db57b[_0x95dd('0x18')]);this[_0x95dd('0x1f')]=getSeconds(_0x4db57b[_0x95dd('0x1a')],_0x4db57b['responsetime']);this['talktime']=getSeconds(this['endtime'],_0x4db57b[_0x95dd('0x1a')]);this[_0x95dd('0xa')]=_0x2b793d[_0x95dd('0xa')];this[_0x95dd('0x20')]=_0x2b793d[_0x95dd('0x20')];this['reason']=_0x2b793d[_0x95dd('0x21')];this[_0x95dd('0x22')]=_0x4db57b[_0x95dd('0x22')];this[_0x95dd('0x23')]=_0x4db57b[_0x95dd('0x23')];this[_0x95dd('0x24')]=_0x4db57b[_0x95dd('0x24')];this[_0x95dd('0x25')]=_0x4db57b['recallme'];this[_0x95dd('0x26')]=_0x4db57b[_0x95dd('0x26')];this['ListId']=_0x4db57b[_0x95dd('0x27')];this[_0x95dd('0x28')]=_0x4db57b['UserId'];this[_0x95dd('0x29')]=_0x4db57b[_0x95dd('0x29')];this['CampaignId']=_0x4db57b['CampaignId'];this['originatecalleridnum']=_0x4db57b[_0x95dd('0x2a')]||'';this[_0x95dd('0x2b')]=_0x4db57b[_0x95dd('0x2b')]||'';}module[_0x95dd('0x2c')]=AgentComplete; \ No newline at end of file +var _0xe59d=['countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','name','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xe59d,0xec));var _0xde59=function(_0x40b0b9,_0x59cd60){_0x40b0b9=_0x40b0b9-0x0;var _0x28e0e2=_0xe59d[_0x40b0b9];return _0x28e0e2;};'use strict';var util=require(_0xde59('0x0'));var _=require(_0xde59('0x1'));var moment=require(_0xde59('0x2'));function getSeconds(_0x217b17,_0x427fa6){var _0x48e14b=moment(_0x217b17)[_0xde59('0x3')](0x0);var _0x17a932=moment(_0x427fa6)[_0xde59('0x3')](0x0);return _0x48e14b['diff'](_0x17a932,_0xde59('0x4'));}function AgentComplete(_0x7b1544,_0x5e4042){this[_0xde59('0x5')]=0x4;this[_0xde59('0x6')]=_0xde59('0x7');this[_0xde59('0x8')]=_0x7b1544[_0xde59('0x8')];this['type']=_0x7b1544[_0xde59('0x9')];this['campaigntype']=_0x7b1544[_0xde59('0x9')]===_0xde59('0xa')?_0xde59('0xb'):_0x7b1544[_0xde59('0x9')];this[_0xde59('0xc')]=_0x7b1544[_0xde59('0xc')];this[_0xde59('0xd')]=_0x7b1544['countcongestionretry'];this['countnoanswerretry']=_0x7b1544[_0xde59('0xe')];this['countglobal']=_0x7b1544[_0xde59('0xc')]+_0x7b1544[_0xde59('0xd')]+_0x7b1544[_0xde59('0xe')]+_0x7b1544[_0xde59('0xf')]+_0x7b1544['countdropretry']+_0x7b1544[_0xde59('0x10')]+_0x7b1544[_0xde59('0x11')]+_0x7b1544['countagentrejectretry'];this[_0xde59('0xf')]=_0x7b1544[_0xde59('0xf')];this[_0xde59('0x12')]=_0x7b1544[_0xde59('0x12')];this[_0xde59('0x10')]=_0x7b1544[_0xde59('0x10')];this[_0xde59('0x11')]=_0x7b1544[_0xde59('0x11')];this['countagentrejectretry']=_0x7b1544[_0xde59('0x13')];this[_0xde59('0x14')]=_0x5e4042[_0xde59('0x14')];this['calleridname']=_0x7b1544[_0xde59('0x15')];this['calleridnum']=_0x7b1544[_0xde59('0x16')];this[_0xde59('0x17')]=_0x7b1544[_0xde59('0x17')];this[_0xde59('0x18')]=_0x7b1544[_0xde59('0x18')];this[_0xde59('0x19')]=_0x7b1544[_0xde59('0x19')];this[_0xde59('0x1a')]=moment()['format'](_0xde59('0x1b'));this[_0xde59('0x1c')]=getSeconds(_0x7b1544[_0xde59('0x18')],_0x7b1544['starttime']);this[_0xde59('0x1d')]=getSeconds(_0x7b1544['answertime'],_0x7b1544[_0xde59('0x18')]);this['talktime']=getSeconds(this[_0xde59('0x1a')],_0x7b1544[_0xde59('0x19')]);this[_0xde59('0xb')]=_0x5e4042[_0xde59('0xb')];this[_0xde59('0x1e')]=_0x5e4042['membername'];this['reason']=_0x5e4042[_0xde59('0x1f')];this[_0xde59('0x20')]=_0x7b1544[_0xde59('0x20')];this[_0xde59('0x21')]=_0x7b1544['callbackuniqueid'];this['callbackat']=_0x7b1544[_0xde59('0x22')];this['recallme']=_0x7b1544[_0xde59('0x23')];this['ContactId']=_0x7b1544[_0xde59('0x24')];this['ListId']=_0x7b1544['ListId'];this[_0xde59('0x25')]=_0x7b1544[_0xde59('0x25')];this[_0xde59('0x26')]=_0x7b1544[_0xde59('0x26')];this['CampaignId']=_0x7b1544['CampaignId'];this['originatecalleridnum']=_0x7b1544[_0xde59('0x27')]||'';this[_0xde59('0x28')]=_0x7b1544['originatecalleridname']||'';}module[_0xde59('0x29')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 6978de7..22d21fb 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 _0xa5da=['countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry'];(function(_0x17f025,_0x4bf10a){var _0x4440bc=function(_0xf1f4ef){while(--_0xf1f4ef){_0x17f025['push'](_0x17f025['shift']());}};_0x4440bc(++_0x4bf10a);}(_0xa5da,0x167));var _0xaa5d=function(_0x265428,_0x167a8e){_0x265428=_0x265428-0x0;var _0x24b249=_0xa5da[_0x265428];return _0x24b249;};'use strict';var util=require(_0xaa5d('0x0'));var _=require(_0xaa5d('0x1'));var moment=require(_0xaa5d('0x2'));function getSeconds(_0x5f144f,_0x40d55b){var _0x147ab3=moment(_0x5f144f)[_0xaa5d('0x3')](0x0);var _0x4a996c=moment(_0x40d55b)[_0xaa5d('0x3')](0x0);return _0x147ab3[_0xaa5d('0x4')](_0x4a996c,'seconds');}function Final(_0x58aca5){this['uniqueid']=_0x58aca5[_0xaa5d('0x5')];this[_0xaa5d('0x6')]=_0x58aca5[_0xaa5d('0x6')];this[_0xaa5d('0x7')]=_0x58aca5[_0xaa5d('0x7')];this[_0xaa5d('0x8')]=_0x58aca5[_0xaa5d('0x7')]==='outbound'?'queue':_0x58aca5['type'];this['countbusyretry']=_0x58aca5[_0xaa5d('0x9')];this[_0xaa5d('0xa')]=_0x58aca5[_0xaa5d('0xa')];this[_0xaa5d('0xb')]=_0x58aca5[_0xaa5d('0xb')];this[_0xaa5d('0xc')]=_0x58aca5['countbusyretry']+_0x58aca5[_0xaa5d('0xa')]+_0x58aca5[_0xaa5d('0xb')]+_0x58aca5[_0xaa5d('0xd')]+_0x58aca5['countdropretry']+_0x58aca5[_0xaa5d('0xe')]+_0x58aca5[_0xaa5d('0xf')]+_0x58aca5[_0xaa5d('0x10')];this[_0xaa5d('0xd')]=_0x58aca5[_0xaa5d('0xd')];this['countdropretry']=_0x58aca5[_0xaa5d('0x11')];this[_0xaa5d('0xe')]=_0x58aca5[_0xaa5d('0xe')];this[_0xaa5d('0xf')]=_0x58aca5[_0xaa5d('0xf')];this['countagentrejectretry']=_0x58aca5[_0xaa5d('0x10')];this[_0xaa5d('0x12')]=_0x58aca5['queue'];this[_0xaa5d('0x13')]=_0x58aca5[_0xaa5d('0x13')];this['calleridnum']=_0x58aca5[_0xaa5d('0x14')];this[_0xaa5d('0x15')]=_0x58aca5[_0xaa5d('0x15')];this['responsetime']=_0x58aca5[_0xaa5d('0x16')];this[_0xaa5d('0x17')]=_0x58aca5[_0xaa5d('0x16')];this[_0xaa5d('0x18')]=_0x58aca5[_0xaa5d('0x18')]||0x0;this['holdtime']=_0x58aca5[_0xaa5d('0x19')]||0x0;this[_0xaa5d('0x1a')]=_0x58aca5[_0xaa5d('0x1a')]||0x0;this[_0xaa5d('0x1b')]=_0x58aca5[_0xaa5d('0x1b')];this[_0xaa5d('0x1c')]=_0x58aca5[_0xaa5d('0x1c')];this[_0xaa5d('0x1d')]=_0x58aca5['callbackat'];this['recallme']=_0x58aca5['recallme'];this[_0xaa5d('0x1e')]=_0x58aca5[_0xaa5d('0x1e')];this[_0xaa5d('0x1f')]=_0x58aca5[_0xaa5d('0x1f')];this['UserId']=_0x58aca5[_0xaa5d('0x20')];this[_0xaa5d('0x21')]=_0x58aca5[_0xaa5d('0x21')];this['CampaignId']=_0x58aca5['CampaignId'];this[_0xaa5d('0x22')]=_0x58aca5[_0xaa5d('0x22')]||'';this[_0xaa5d('0x23')]=_0x58aca5[_0xaa5d('0x23')]||'';}module[_0xaa5d('0x24')]=Final; \ No newline at end of file +var _0xaa3a=['countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','starttime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x139fa9,_0x44f16b){var _0x4442e7=function(_0xf72ebf){while(--_0xf72ebf){_0x139fa9['push'](_0x139fa9['shift']());}};_0x4442e7(++_0x44f16b);}(_0xaa3a,0xd0));var _0xaaa3=function(_0x3d20a3,_0x416806){_0x3d20a3=_0x3d20a3-0x0;var _0x44feb5=_0xaa3a[_0x3d20a3];return _0x44feb5;};'use strict';var util=require('util');var _=require(_0xaaa3('0x0'));var moment=require(_0xaaa3('0x1'));function getSeconds(_0x56525d,_0x3f03e6){var _0x26b14c=moment(_0x56525d)[_0xaaa3('0x2')](0x0);var _0xc07e99=moment(_0x3f03e6)['milliseconds'](0x0);return _0x26b14c[_0xaaa3('0x3')](_0xc07e99,_0xaaa3('0x4'));}function Final(_0x4f4254){this[_0xaaa3('0x5')]=_0x4f4254['uniqueid'];this[_0xaaa3('0x6')]=_0x4f4254[_0xaaa3('0x6')];this[_0xaaa3('0x7')]=_0x4f4254[_0xaaa3('0x7')];this[_0xaaa3('0x8')]=_0x4f4254[_0xaaa3('0x7')]===_0xaaa3('0x9')?_0xaaa3('0xa'):_0x4f4254['type'];this[_0xaaa3('0xb')]=_0x4f4254[_0xaaa3('0xb')];this['countcongestionretry']=_0x4f4254[_0xaaa3('0xc')];this[_0xaaa3('0xd')]=_0x4f4254['countnoanswerretry'];this['countglobal']=_0x4f4254[_0xaaa3('0xb')]+_0x4f4254['countcongestionretry']+_0x4f4254[_0xaaa3('0xd')]+_0x4f4254[_0xaaa3('0xe')]+_0x4f4254['countdropretry']+_0x4f4254[_0xaaa3('0xf')]+_0x4f4254[_0xaaa3('0x10')]+_0x4f4254[_0xaaa3('0x11')];this[_0xaaa3('0xe')]=_0x4f4254[_0xaaa3('0xe')];this[_0xaaa3('0x12')]=_0x4f4254[_0xaaa3('0x12')];this['countabandonedretry']=_0x4f4254[_0xaaa3('0xf')];this[_0xaaa3('0x10')]=_0x4f4254[_0xaaa3('0x10')];this[_0xaaa3('0x11')]=_0x4f4254[_0xaaa3('0x11')];this[_0xaaa3('0xa')]=_0x4f4254[_0xaaa3('0xa')];this[_0xaaa3('0x13')]=_0x4f4254[_0xaaa3('0x13')];this[_0xaaa3('0x14')]=_0x4f4254[_0xaaa3('0x14')];this['starttime']=_0x4f4254[_0xaaa3('0x15')];this['responsetime']=_0x4f4254['responsetime'];this[_0xaaa3('0x16')]=_0x4f4254['responsetime'];this[_0xaaa3('0x17')]=_0x4f4254['ringtime']||0x0;this['holdtime']=_0x4f4254[_0xaaa3('0x18')]||0x0;this[_0xaaa3('0x19')]=_0x4f4254['talktime']||0x0;this[_0xaaa3('0x1a')]=_0x4f4254['callback'];this[_0xaaa3('0x1b')]=_0x4f4254['callbackuniqueid'];this[_0xaaa3('0x1c')]=_0x4f4254[_0xaaa3('0x1c')];this['recallme']=_0x4f4254[_0xaaa3('0x1d')];this[_0xaaa3('0x1e')]=_0x4f4254[_0xaaa3('0x1e')];this['ListId']=_0x4f4254[_0xaaa3('0x1f')];this[_0xaaa3('0x20')]=_0x4f4254[_0xaaa3('0x20')];this[_0xaaa3('0x21')]=_0x4f4254['VoiceQueueId'];this[_0xaaa3('0x22')]=_0x4f4254['CampaignId'];this['originatecalleridnum']=_0x4f4254['originatecalleridnum']||'';this[_0xaaa3('0x23')]=_0x4f4254[_0xaaa3('0x23')]||'';}module[_0xaaa3('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index cd7b27e..ada7396 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 _0xe3d7=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','state','statedesc','Answer','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','membername','cause-txt','callback','callbackuniqueid'];(function(_0x1712f0,_0x343837){var _0x5b4468=function(_0x3caab0){while(--_0x3caab0){_0x1712f0['push'](_0x1712f0['shift']());}};_0x5b4468(++_0x343837);}(_0xe3d7,0xda));var _0x7e3d=function(_0x1af2fd,_0x3de613){_0x1af2fd=_0x1af2fd-0x0;var _0x22ebed=_0xe3d7[_0x1af2fd];return _0x22ebed;};'use strict';var util=require(_0x7e3d('0x0'));var _=require(_0x7e3d('0x1'));var moment=require(_0x7e3d('0x2'));function getSeconds(_0x118671,_0x36527a){var _0x5d8514=moment(_0x118671)['milliseconds'](0x0);var _0xb7314b=moment(_0x36527a)[_0x7e3d('0x3')](0x0);return _0x5d8514['diff'](_0xb7314b,'seconds');}function Hangup(_0x43c7cb,_0x480d9e){this[_0x7e3d('0x4')]=0x4;this[_0x7e3d('0x5')]=_0x7e3d('0x6');this['scheduledat']=_0x43c7cb['scheduledat'];this[_0x7e3d('0x7')]=_0x43c7cb['type'];this[_0x7e3d('0x8')]=_0x43c7cb[_0x7e3d('0x7')]===_0x7e3d('0x9')?_0x7e3d('0xa'):_0x43c7cb[_0x7e3d('0x7')];this[_0x7e3d('0xb')]=_0x43c7cb[_0x7e3d('0xb')];this[_0x7e3d('0xc')]=_0x43c7cb[_0x7e3d('0xc')];this[_0x7e3d('0xd')]=_0x43c7cb[_0x7e3d('0xd')];this[_0x7e3d('0xe')]=_0x43c7cb['countbusyretry']+_0x43c7cb['countcongestionretry']+_0x43c7cb[_0x7e3d('0xd')]+_0x43c7cb[_0x7e3d('0xf')]+_0x43c7cb['countdropretry']+_0x43c7cb['countabandonedretry']+_0x43c7cb[_0x7e3d('0x10')]+_0x43c7cb[_0x7e3d('0x11')];this[_0x7e3d('0xf')]=_0x43c7cb[_0x7e3d('0xf')];this[_0x7e3d('0x12')]=_0x43c7cb[_0x7e3d('0x12')];this['countabandonedretry']=_0x43c7cb[_0x7e3d('0x13')];this[_0x7e3d('0x10')]=_0x43c7cb[_0x7e3d('0x10')];this[_0x7e3d('0x11')]=_0x43c7cb[_0x7e3d('0x11')];this[_0x7e3d('0x14')]=_0x480d9e['uniqueid'];this[_0x7e3d('0x15')]=_0x43c7cb[_0x7e3d('0x16')];this[_0x7e3d('0x17')]=_0x43c7cb['number'];this[_0x7e3d('0x18')]=_0x43c7cb[_0x7e3d('0x18')];this[_0x7e3d('0x19')]=_0x43c7cb[_0x7e3d('0x19')];this[_0x7e3d('0x1a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x7e3d('0x1b')]=getSeconds(_0x43c7cb['responsetime'],_0x43c7cb[_0x7e3d('0x18')]);this[_0x7e3d('0x1c')]=0x0;this[_0x7e3d('0x1d')]=getSeconds(this[_0x7e3d('0x1a')],_0x43c7cb[_0x7e3d('0x19')]);this[_0x7e3d('0xa')]=_0x43c7cb['queue'];this[_0x7e3d('0x1e')]='IVR';this['reason']=_0x480d9e[_0x7e3d('0x1f')];this['callback']=_0x43c7cb[_0x7e3d('0x20')];this[_0x7e3d('0x21')]=_0x43c7cb[_0x7e3d('0x21')];this['callbackat']=_0x43c7cb[_0x7e3d('0x22')];this['recallme']=_0x43c7cb[_0x7e3d('0x23')];this['ContactId']=_0x43c7cb[_0x7e3d('0x24')];this[_0x7e3d('0x25')]=_0x43c7cb[_0x7e3d('0x25')];this[_0x7e3d('0x26')]=_0x43c7cb['UserId'];this[_0x7e3d('0x27')]=_0x43c7cb[_0x7e3d('0x27')];this['CampaignId']=_0x43c7cb[_0x7e3d('0x28')];}module[_0x7e3d('0x29')]=Hangup; \ No newline at end of file +var _0xd532=['ringtime','holdtime','talktime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2850c0,_0x1363a7){var _0x21e830=function(_0x3ec70a){while(--_0x3ec70a){_0x2850c0['push'](_0x2850c0['shift']());}};_0x21e830(++_0x1363a7);}(_0xd532,0x180));var _0x2d53=function(_0x5d8c9a,_0x5858ea){_0x5d8c9a=_0x5d8c9a-0x0;var _0x45d9a5=_0xd532[_0x5d8c9a];return _0x45d9a5;};'use strict';var util=require(_0x2d53('0x0'));var _=require(_0x2d53('0x1'));var moment=require(_0x2d53('0x2'));function getSeconds(_0x5b3737,_0x30943d){var _0x17bb52=moment(_0x5b3737)[_0x2d53('0x3')](0x0);var _0x1422fd=moment(_0x30943d)[_0x2d53('0x3')](0x0);return _0x17bb52[_0x2d53('0x4')](_0x1422fd,_0x2d53('0x5'));}function Hangup(_0xa19f4e,_0x4a3bf3){this[_0x2d53('0x6')]=0x4;this[_0x2d53('0x7')]=_0x2d53('0x8');this[_0x2d53('0x9')]=_0xa19f4e[_0x2d53('0x9')];this[_0x2d53('0xa')]=_0xa19f4e[_0x2d53('0xa')];this[_0x2d53('0xb')]=_0xa19f4e[_0x2d53('0xa')]==='outbound'?_0x2d53('0xc'):_0xa19f4e[_0x2d53('0xa')];this[_0x2d53('0xd')]=_0xa19f4e['countbusyretry'];this[_0x2d53('0xe')]=_0xa19f4e[_0x2d53('0xe')];this[_0x2d53('0xf')]=_0xa19f4e[_0x2d53('0xf')];this['countglobal']=_0xa19f4e['countbusyretry']+_0xa19f4e[_0x2d53('0xe')]+_0xa19f4e[_0x2d53('0xf')]+_0xa19f4e[_0x2d53('0x10')]+_0xa19f4e[_0x2d53('0x11')]+_0xa19f4e[_0x2d53('0x12')]+_0xa19f4e[_0x2d53('0x13')]+_0xa19f4e[_0x2d53('0x14')];this[_0x2d53('0x10')]=_0xa19f4e[_0x2d53('0x10')];this[_0x2d53('0x11')]=_0xa19f4e['countdropretry'];this['countabandonedretry']=_0xa19f4e['countabandonedretry'];this[_0x2d53('0x13')]=_0xa19f4e[_0x2d53('0x13')];this[_0x2d53('0x14')]=_0xa19f4e[_0x2d53('0x14')];this['uniqueid']=_0x4a3bf3['uniqueid'];this[_0x2d53('0x15')]=_0xa19f4e[_0x2d53('0x16')];this[_0x2d53('0x17')]=_0xa19f4e[_0x2d53('0x18')];this[_0x2d53('0x19')]=_0xa19f4e[_0x2d53('0x19')];this[_0x2d53('0x1a')]=_0xa19f4e[_0x2d53('0x1a')];this[_0x2d53('0x1b')]=moment()[_0x2d53('0x1c')](_0x2d53('0x1d'));this[_0x2d53('0x1e')]=getSeconds(_0xa19f4e[_0x2d53('0x1a')],_0xa19f4e[_0x2d53('0x19')]);this[_0x2d53('0x1f')]=0x0;this[_0x2d53('0x20')]=getSeconds(this[_0x2d53('0x1b')],_0xa19f4e['responsetime']);this[_0x2d53('0xc')]=_0xa19f4e[_0x2d53('0xc')];this['membername']=_0x2d53('0x21');this[_0x2d53('0x22')]=_0x4a3bf3[_0x2d53('0x23')];this['callback']=_0xa19f4e[_0x2d53('0x24')];this['callbackuniqueid']=_0xa19f4e[_0x2d53('0x25')];this[_0x2d53('0x26')]=_0xa19f4e[_0x2d53('0x26')];this['recallme']=_0xa19f4e[_0x2d53('0x27')];this[_0x2d53('0x28')]=_0xa19f4e[_0x2d53('0x28')];this[_0x2d53('0x29')]=_0xa19f4e[_0x2d53('0x29')];this['UserId']=_0xa19f4e[_0x2d53('0x2a')];this[_0x2d53('0x2b')]=_0xa19f4e[_0x2d53('0x2b')];this[_0x2d53('0x2c')]=_0xa19f4e[_0x2d53('0x2c')];}module[_0x2d53('0x2d')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 8353c31..f5bd45c 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 _0x6dd6=['ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','name','calleridnum','starttime','responsetime','endtime'];(function(_0x2b0651,_0x465125){var _0x206448=function(_0x384077){while(--_0x384077){_0x2b0651['push'](_0x2b0651['shift']());}};_0x206448(++_0x465125);}(_0x6dd6,0xcc));var _0x66dd=function(_0x2bae67,_0x1077b2){_0x2bae67=_0x2bae67-0x0;var _0x5f29ed=_0x6dd6[_0x2bae67];return _0x5f29ed;};'use strict';var util=require('util');var _=require(_0x66dd('0x0'));var moment=require(_0x66dd('0x1'));function getSeconds(_0x91a264,_0x6586d5){var _0x1314eb=moment(_0x91a264)[_0x66dd('0x2')](0x0);var _0x16b48a=moment(_0x6586d5)[_0x66dd('0x2')](0x0);return _0x1314eb[_0x66dd('0x3')](_0x16b48a,'seconds');}function History(_0x13af85){this['uniqueid']=_0x13af85[_0x66dd('0x4')];this['scheduledat']=_0x13af85[_0x66dd('0x5')]||undefined;this[_0x66dd('0x6')]=_0x13af85[_0x66dd('0x6')];this[_0x66dd('0x7')]=_0x13af85[_0x66dd('0x6')]==='outbound'?'queue':_0x13af85[_0x66dd('0x6')];this[_0x66dd('0x8')]=_0x13af85[_0x66dd('0x8')];this[_0x66dd('0x9')]=_0x13af85[_0x66dd('0x9')];this[_0x66dd('0xa')]=_0x13af85[_0x66dd('0xa')];this[_0x66dd('0xb')]=_0x13af85[_0x66dd('0x8')]+_0x13af85[_0x66dd('0x9')]+_0x13af85[_0x66dd('0xa')]+_0x13af85[_0x66dd('0xc')]+_0x13af85[_0x66dd('0xd')]+_0x13af85[_0x66dd('0xe')]+_0x13af85[_0x66dd('0xf')]+_0x13af85[_0x66dd('0x10')];this[_0x66dd('0xc')]=_0x13af85['countnosuchnumberretry'];this[_0x66dd('0xd')]=_0x13af85[_0x66dd('0xd')];this['countabandonedretry']=_0x13af85[_0x66dd('0xe')];this['countmachineretry']=_0x13af85['countmachineretry'];this[_0x66dd('0x10')]=_0x13af85[_0x66dd('0x10')];this['queue']=_0x13af85[_0x66dd('0x11')];this[_0x66dd('0x12')]=_0x13af85[_0x66dd('0x13')];this[_0x66dd('0x14')]=_0x13af85['number'];this[_0x66dd('0x15')]=_0x13af85[_0x66dd('0x15')];this[_0x66dd('0x16')]=_0x13af85[_0x66dd('0x16')];this[_0x66dd('0x17')]=_0x13af85[_0x66dd('0x16')];this[_0x66dd('0x18')]=getSeconds(_0x13af85[_0x66dd('0x16')],_0x13af85[_0x66dd('0x15')]);this[_0x66dd('0x19')]=0x0;this['talktime']=0x0;this[_0x66dd('0x1a')]=_0x13af85[_0x66dd('0x1a')];this[_0x66dd('0x1b')]=_0x13af85[_0x66dd('0x1b')];this[_0x66dd('0x1c')]=_0x13af85['callbackat'];this[_0x66dd('0x1d')]=_0x13af85['recallme'];this[_0x66dd('0x1e')]=_0x13af85[_0x66dd('0x1e')];this[_0x66dd('0x1f')]=_0x13af85['ListId'];this[_0x66dd('0x20')]=_0x13af85[_0x66dd('0x20')];this[_0x66dd('0x21')]=_0x13af85[_0x66dd('0x21')];this[_0x66dd('0x22')]=_0x13af85['CampaignId'];this[_0x66dd('0x23')]=_0x13af85[_0x66dd('0x23')]||'';this[_0x66dd('0x24')]=_0x13af85[_0x66dd('0x24')]||'';}module[_0x66dd('0x25')]=History; \ No newline at end of file +var _0x3368=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','moment','milliseconds','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','name','calleridnum','responsetime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme'];(function(_0x18c4a8,_0x96c52e){var _0x189ff1=function(_0x4a3ea8){while(--_0x4a3ea8){_0x18c4a8['push'](_0x18c4a8['shift']());}};_0x189ff1(++_0x96c52e);}(_0x3368,0x19f));var _0x8336=function(_0x44a9fb,_0x5231f3){_0x44a9fb=_0x44a9fb-0x0;var _0x3b296e=_0x3368[_0x44a9fb];return _0x3b296e;};'use strict';var util=require(_0x8336('0x0'));var _=require('lodash');var moment=require(_0x8336('0x1'));function getSeconds(_0x4dba4d,_0x52e85b){var _0x5893e9=moment(_0x4dba4d)[_0x8336('0x2')](0x0);var _0x4a5fd3=moment(_0x52e85b)[_0x8336('0x2')](0x0);return _0x5893e9['diff'](_0x4a5fd3,_0x8336('0x3'));}function History(_0x1543df){this['uniqueid']=_0x1543df[_0x8336('0x4')];this[_0x8336('0x5')]=_0x1543df['scheduledat']||undefined;this['type']=_0x1543df[_0x8336('0x6')];this['campaigntype']=_0x1543df[_0x8336('0x6')]===_0x8336('0x7')?_0x8336('0x8'):_0x1543df[_0x8336('0x6')];this[_0x8336('0x9')]=_0x1543df[_0x8336('0x9')];this[_0x8336('0xa')]=_0x1543df['countcongestionretry'];this[_0x8336('0xb')]=_0x1543df['countnoanswerretry'];this['countglobal']=_0x1543df[_0x8336('0x9')]+_0x1543df[_0x8336('0xa')]+_0x1543df['countnoanswerretry']+_0x1543df[_0x8336('0xc')]+_0x1543df['countdropretry']+_0x1543df[_0x8336('0xd')]+_0x1543df[_0x8336('0xe')]+_0x1543df[_0x8336('0xf')];this[_0x8336('0xc')]=_0x1543df[_0x8336('0xc')];this[_0x8336('0x10')]=_0x1543df[_0x8336('0x10')];this[_0x8336('0xd')]=_0x1543df[_0x8336('0xd')];this[_0x8336('0xe')]=_0x1543df[_0x8336('0xe')];this[_0x8336('0xf')]=_0x1543df[_0x8336('0xf')];this[_0x8336('0x8')]=_0x1543df[_0x8336('0x8')];this[_0x8336('0x11')]=_0x1543df[_0x8336('0x12')];this[_0x8336('0x13')]=_0x1543df['number'];this['starttime']=_0x1543df['starttime'];this['responsetime']=_0x1543df['responsetime'];this['endtime']=_0x1543df[_0x8336('0x14')];this[_0x8336('0x15')]=getSeconds(_0x1543df['responsetime'],_0x1543df['starttime']);this[_0x8336('0x16')]=0x0;this['talktime']=0x0;this[_0x8336('0x17')]=_0x1543df[_0x8336('0x17')];this[_0x8336('0x18')]=_0x1543df[_0x8336('0x18')];this['callbackat']=_0x1543df[_0x8336('0x19')];this[_0x8336('0x1a')]=_0x1543df[_0x8336('0x1a')];this[_0x8336('0x1b')]=_0x1543df[_0x8336('0x1b')];this[_0x8336('0x1c')]=_0x1543df[_0x8336('0x1c')];this['UserId']=_0x1543df[_0x8336('0x1d')];this['VoiceQueueId']=_0x1543df[_0x8336('0x1e')];this['CampaignId']=_0x1543df[_0x8336('0x1f')];this[_0x8336('0x20')]=_0x1543df[_0x8336('0x20')]||'';this['originatecalleridname']=_0x1543df[_0x8336('0x21')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 260d13d..c467087 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 _0x657f=['dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Trunk','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','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\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','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','[getContactDialer2][Empty]','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','loopClearZombieChannels','clearZombieChannels','uniqueId','[uniqueid]','[actions]','enqueue','Action','status','channel','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','checkIsBlackList','then','catch','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','merge','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact]','Success','active','trunks','SIP/%s','reachable','unmonitored','saveInDb','uniqueid','isNil','variable','amdstatus','exten','dialAMDActive','value','HANGUP','statedesc','HangupInAMD','membername','AMD','[syncHangupInAMD]','outboundAnswerAgiCallsDay','[syncMachine]','campaigns','[syncHangupInAMDIvr][createHistory]','MACHINE','Machine','amd','[syncMachineIvr][createHistory]','[syncMachineIvr]','syncHangup','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','YYYY-MM-DD\x20HH:mm:ss','syncAgentConnect','answertime','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','responsetime','outboundDropCallsDayTimeout','Drop','TIMEOUT','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','add','dialDropRetryFrequency','minutes','[rescheduleContact][Drop]','log','CRIS\x20evt\x2010','CRIS\x20queueCallerAbandon\x2010','CRIS\x20createHistory\x2010','outboundDropCallsDayCallersExit','Abandoned','dropreason','CALLEREXIT','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','actionid','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','syncQueueStatusComplete','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','timezones','isArray','command','iftime\x20%s,%s','content','indexOf','all','some','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','predictive','Queue','method\x20not\x20recognized','launchHandleIvr','checkIfTime','dialGlobalInterval','dialTimezone','[syncQueueSummary]','syncCampaigns','\x5cw{0,','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','tags','updatedAt','%s%s','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialCutDigit','substring','trim','xcally-motion-dialer','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','getQueue','callProgressDetecting','[callProgressDetecting]\x20','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','dialGlobalMaxRetry','dialNoAnswerRetryFrequency','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','[rescheduleContact][Machine]','countagentrejectretry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','countglobal','[syncAgentComplete][createHistory][0]','reason\x200\x20no\x20such\x20number....','createStateFinal','NoAnswer','[syncAgentComplete][createHistory][3]','checkRetriveMax','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','stateGlobal','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','getDataPredictive','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','predictiveIntervalPauses','floor','one\x20call\x20every:','checkContactBlack','recallme','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','Agent','voicePause','Contact\x20updated','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','handleIvr','limitCalls','temp','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact.phone','[getContactCampaign2]','dialLimitQueue','not_inuse','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[countReScheduled]\x20','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','sequence','preview','voiceQueues','agents','maxNumberOriginate','actions','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','newexten','varset','syncVarSet','queuemember','syncQueueMember','loopCampaigns','isUndefined','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','name','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','isEmpty','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout'];(function(_0xffde3e,_0x48fe91){var _0x5e3752=function(_0x3e3c0e){while(--_0x3e3c0e){_0xffde3e['push'](_0xffde3e['shift']());}};_0x5e3752(++_0x48fe91);}(_0x657f,0x1b4));var _0xf657=function(_0x3825a8,_0x2ce1a2){_0x3825a8=_0x3825a8-0x0;var _0xabc9bc=_0x657f[_0x3825a8];return _0xabc9bc;};'use strict';var util=require(_0xf657('0x0'));var _=require(_0xf657('0x1'));var BPromise=require(_0xf657('0x2'));var uuid=require(_0xf657('0x3'));var moment=require(_0xf657('0x4'));var rr=require('rr');var md5=require(_0xf657('0x5'));var Redis=require(_0xf657('0x6'));var config=require(_0xf657('0x7'));var logger=require(_0xf657('0x8'))(_0xf657('0x9'));var loggerBooked=require(_0xf657('0x8'))(_0xf657('0xa'));var loggerPredictive=require(_0xf657('0x8'))('predictive');var loggerPredictiveCalls=require(_0xf657('0x8'))(_0xf657('0xb'));var loggerSyncQueueSummary=require(_0xf657('0x8'))(_0xf657('0xc'));var ami=require('../ami');config[_0xf657('0xd')]=_[_0xf657('0xe')](config[_0xf657('0xd')],{'host':_0xf657('0xf'),'port':0x18eb});var io=require(_0xf657('0x10'))(new Redis(config[_0xf657('0xd')]));var cmHopper=require(_0xf657('0x11'));var cmHopperFinal=require(_0xf657('0x12'));var cmHopperHistory=require(_0xf657('0x13'));var cmHopperBlack=require(_0xf657('0x14'));var voiceQueueRt=require(_0xf657('0x15'));var Action=require(_0xf657('0x16'));var History=require(_0xf657('0x17'));var Final=require(_0xf657('0x18'));var AgentComplete=require(_0xf657('0x19'));var QueueCallerAbandon=require(_0xf657('0x1a'));var Hangup=require(_0xf657('0x1b'));var ipAgi=process[_0xf657('0x1c')]['XCALLY_IP_AGI']||_0xf657('0x1d');var strategy={'rrmemory':_0xf657('0x1e'),'roundrobin':_0xf657('0x1f')};var Sequence=function(){};Sequence[_0xf657('0x20')]['enqueue']=function(_0x5d1119){this[_0xf657('0x21')]=this[_0xf657('0x21')]?this['tail'][_0xf657('0x22')](_0x5d1119):_0x5d1119();};function Dialer(_0x3e785b,_0x78598){this[_0xf657('0x23')]=new Sequence();this[_0xf657('0x24')]=_0x78598;this[_0xf657('0x25')]=_0x3e785b['voiceQueues'];this['campaigns']=_0x3e785b['campaigns'];this[_0xf657('0x26')]=_0x3e785b['agents'];this['trunks']=_0x3e785b['trunks'];this[_0xf657('0x27')]=config[_0xf657('0x27')]||0x2;this['channels']={};this[_0xf657('0x28')]={};this['contactsId']={};this['uniqueId']={};this[_0xf657('0x29')]={};this[_0xf657('0x2a')]={};this[_0xf657('0x2b')]={};this[_0xf657('0x2c')]={};this[_0xf657('0x2d')]={};this[_0xf657('0x2e')]={};ami['on'](_0xf657('0x2f'),this['syncAgentConnect'][_0xf657('0x30')](this));ami['on'](_0xf657('0x31'),this['syncQueueCallerAbandon'][_0xf657('0x30')](this));ami['on'](_0xf657('0x32'),this[_0xf657('0x33')]['bind'](this));ami['on'](_0xf657('0x34'),this[_0xf657('0x35')][_0xf657('0x30')](this));ami['on']('custom:queuesummary',this['syncQueueSummary']['bind'](this));ami['on']('hangup',this['syncHangup'][_0xf657('0x30')](this));ami['on'](_0xf657('0x36'),this['syncNewExten']['bind'](this));ami['on'](_0xf657('0x37'),this[_0xf657('0x38')][_0xf657('0x30')](this));ami['on'](_0xf657('0x39'),this[_0xf657('0x3a')][_0xf657('0x30')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete']['bind'](this));this[_0xf657('0x3b')]();this['loopClearZombieChannels']();}function isNotNull(_0x3efd12){return _0x3efd12!==null&&!_[_0xf657('0x3c')](_0x3efd12);}function checkIsLoggedIn(_0x3b938b,_0x25cd58){return function(){if(_0x25cd58<=0x0){_0x3b938b[_0xf657('0x3d')]=_0xf657('0x3e');throw _0x3b938b['name']+_0xf657('0x3f');}};}function isActive(_0x580ce1){return _0x580ce1;}function checkIsActive(_0x3bb563,_0x3a545c){return function(){if(!isActive(_0x3a545c)){_0x3bb563[_0xf657('0x3d')]='NOT_ACTIVE';throw _0x3bb563[_0xf657('0x40')]+_0xf657('0x41');}};}function checkInterval(_0x1e2687){return function(){if(!isNotNull(_0x1e2687['Interval'])){_0x1e2687[_0xf657('0x3d')]=_0xf657('0x42');throw _0x1e2687[_0xf657('0x40')]+_0xf657('0x43');}if(!isNotNull(_0x1e2687[_0xf657('0x44')][_0xf657('0x45')])){_0x1e2687[_0xf657('0x3d')]=_0xf657('0x42');throw _0x1e2687['name']+_0xf657('0x43');}if(!isNotNull(_[_0xf657('0x46')](_0x1e2687['Interval'][_0xf657('0x45')]))){_0x1e2687['message']='INTERVAL_IS_NULL';throw _0x1e2687[_0xf657('0x40')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x5e68b7,_0x4122ab,_0x45df52){return{'action':_0x5e68b7,'response':_0x4122ab,'message':_0x45df52,'stack':_0x45df52};}function myreject(_0x43673a){return function(_0x7d6665){return _0x43673a(msgResponse('[ifTime][Action]',_0xf657('0x47'),JSON[_0xf657('0x48')](_0x7d6665)));};}function getSeconds(_0x3122b1,_0x43ebcb){var _0x2a4bee=moment(_0x3122b1)['milliseconds'](0x0);var _0x114842=moment(_0x43ebcb)[_0xf657('0x49')](0x0);return _0x2a4bee[_0xf657('0x4a')](_0x114842,_0xf657('0x4b'));}function emit(_0x36db6f,_0x58788c,_0x5d6159){io['to'](_0x36db6f)[_0xf657('0x4c')](_0x58788c,_0x5d6159);}function emitVoiceQueueSummary(_0x3724ef){if(_0x3724ef[_0xf657('0x4d')]===_0xf657('0x4e')){var _0x454c86={'id':_0x3724ef['id'],'name':_0x3724ef[_0xf657('0x40')],'strategy':_0x3724ef[_0xf657('0x4f')],'answered':_0x3724ef[_0xf657('0x50')],'available':_0x3724ef[_0xf657('0x51')],'loggedIn':_0x3724ef[_0xf657('0x52')],'pTalking':_0x3724ef[_0xf657('0x53')],'sumBillable':_0x3724ef['sumBillable'],'sumDuration':_0x3724ef[_0xf657('0x54')],'sumHoldTime':_0x3724ef[_0xf657('0x55')]||0x0,'talking':_0x3724ef[_0xf657('0x56')],'total':_0x3724ef['total'],'type':_0x3724ef['type'],'unmanaged':_0x3724ef[_0xf657('0x57')],'abandoned':_0x3724ef[_0xf657('0x58')],'waiting':_0x3724ef[_0xf657('0x59')],'loggedInDb':_0x3724ef['loggedInDb'],'dialActive':_0x3724ef[_0xf657('0x5a')],'dialMethod':_0x3724ef[_0xf657('0x5b')],'dialOriginateCallerIdName':_0x3724ef[_0xf657('0x5c')],'dialOriginateCallerIdNumber':_0x3724ef['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x3724ef[_0xf657('0x5d')],'dialPrefix':_0x3724ef[_0xf657('0x5e')],'outboundAnswerAgiCallsDay':_0x3724ef['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x3724ef[_0xf657('0x5f')],'outboundBlacklistCallsDay':_0x3724ef[_0xf657('0x60')],'outboundBusyCallsDay':_0x3724ef[_0xf657('0x61')],'outboundCongestionCallsDay':_0x3724ef[_0xf657('0x62')],'outboundDropCallsDayACS':_0x3724ef[_0xf657('0x63')],'outboundDropCallsDayCallersExit':_0x3724ef['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x3724ef['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x3724ef[_0xf657('0x64')],'outboundNoSuchCallsDay':_0x3724ef[_0xf657('0x65')],'outboundOriginateFailureCallsDay':_0x3724ef[_0xf657('0x66')],'outboundReCallsDay':_0x3724ef[_0xf657('0x67')],'outboundRejectCallsDay':_0x3724ef['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x3724ef['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x3724ef[_0xf657('0x68')],'predictiveIntervalAvgHoldtime':_0x3724ef[_0xf657('0x69')],'predictiveIntervalAvgTalktime':_0x3724ef[_0xf657('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x3724ef[_0xf657('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x3724ef[_0xf657('0x6c')],'predictiveIntervalErlangCalls':_0x3724ef[_0xf657('0x6d')],'predictiveIntervalErlangCallsDroppedCalls':_0x3724ef[_0xf657('0x6e')],'predictiveIntervalHitRate':_0x3724ef[_0xf657('0x6f')],'predictiveIntervalMultiplicativeFactor':_0x3724ef[_0xf657('0x70')],'predictiveIntervalPauses':_0x3724ef['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x3724ef[_0xf657('0x71')],'predictiveIntervalTotalCalls':_0x3724ef[_0xf657('0x72')],'message':_0x3724ef['message'],'originated':_0x3724ef[_0xf657('0x73')],'erlangCalls':_0x3724ef[_0xf657('0x74')],'erlangCallToSecond':_0x3724ef[_0xf657('0x75')],'erlangAbandonmentRate':_0x3724ef[_0xf657('0x76')],'erlangBusyFactor':_0x3724ef['erlangBusyFactor'],'startPredictive':_0x3724ef['startPredictive'],'startProgressive':_0x3724ef['startProgressive']};if(_0x3724ef[_0xf657('0x77')]){_0x454c86[_0xf657('0x77')]={'id':_0x3724ef['Trunk']['id'],'name':_0x3724ef['Trunk'][_0xf657('0x40')],'active':_0x3724ef['Trunk']['active'],'callerid':_0x3724ef[_0xf657('0x77')]['callerid']};}if(_0x3724ef[_0xf657('0x44')]){_0x454c86[_0xf657('0x44')]={'id':_0x3724ef[_0xf657('0x44')]['id'],'name':_0x3724ef[_0xf657('0x44')]['name']};}var _0x6ebf3c=md5(JSON[_0xf657('0x48')](_0x454c86));if(_0x3724ef[_0xf657('0x5')]!==_0x6ebf3c){_0x3724ef[_0xf657('0x5')]=_0x6ebf3c;emit(util['format']('voice:queue:%s',_0x454c86[_0xf657('0x40')]),'voice_queue:save',_0x454c86);}}}function emitCampaignSummary(_0x458982){if(_0x458982[_0xf657('0x4d')]===_0xf657('0x78')){emit(util[_0xf657('0x79')](_0xf657('0x7a'),_0x458982[_0xf657('0x40')]),_0xf657('0x7b'),_0x458982);}}function checkGetDataPredictive(_0xfe469c){if(isNotNull(_0xfe469c)){if(!_['isEmpty'](_0xfe469c)){loggerPredictive[_0xf657('0x7c')](_0xf657('0x7d'));loggerPredictive[_0xf657('0x7c')](_0xf657('0x7e'),_0xfe469c[_0xf657('0x72')]);loggerPredictive['info'](_0xf657('0x7f'),_0xfe469c[_0xf657('0x68')]);loggerPredictive[_0xf657('0x7c')](_0xf657('0x80'),_0xfe469c[_0xf657('0x6c')]);loggerPredictive['info'](_0xf657('0x81'),_0xfe469c[_0xf657('0x6b')]);loggerPredictive[_0xf657('0x7c')](_0xf657('0x82'),_0xfe469c[_0xf657('0x69')]);loggerPredictive[_0xf657('0x7c')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xfe469c[_0xf657('0x6a')]);loggerPredictive['info']('---------------------------');if(_0xfe469c['predictiveIntervalTotalCalls']>0x0){if(!_[_0xf657('0x3c')](_0xfe469c[_0xf657('0x6a')])&&_0xfe469c[_0xf657('0x6a')]>0x0){return!![];}else{loggerPredictive[_0xf657('0x7c')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}if(!_['isUndefined'](_0xfe469c[_0xf657('0x69')])&&_0xfe469c[_0xf657('0x69')]>0x0){return!![];}else{loggerPredictive[_0xf657('0x7c')](_0xf657('0x83'));}}else{loggerPredictive[_0xf657('0x7c')](_0xf657('0x84'));}}else{loggerPredictive[_0xf657('0x7c')](_0xf657('0x85'));}}else{loggerPredictive[_0xf657('0x7c')](_0xf657('0x85'));}return![];}function mergeDataErlangB(_0x1833dd){return function(_0x2ae594){loggerPredictive[_0xf657('0x7c')](_0xf657('0x86'));loggerPredictive[_0xf657('0x7c')](_0xf657('0x87'),_0x2ae594[_0xf657('0x74')]);loggerPredictive[_0xf657('0x7c')](_0xf657('0x88'),_0x2ae594[_0xf657('0x75')]);loggerPredictive[_0xf657('0x7c')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2ae594[_0xf657('0x76')]);loggerPredictive['info'](_0xf657('0x89'),_0x2ae594[_0xf657('0x8a')]);loggerPredictive[_0xf657('0x7c')](_0xf657('0x8b'),_0x2ae594[_0xf657('0x76')]);loggerPredictive[_0xf657('0x7c')](_0xf657('0x8c'));_['merge'](_0x1833dd,_0x2ae594);};}function getDiff(_0x37d10e){var _0x5c3407=moment()['milliseconds'](0x0);var _0x33da5a=moment(_0x37d10e)[_0xf657('0x49')](0x0);return _0x5c3407[_0xf657('0x4a')](_0x33da5a,_0xf657('0x4b'));}function ifInterval(_0x3e48bc,_0x159bc8){if(_['isUndefined'](_0x159bc8)){return![];}if(getDiff(_0x159bc8)<_0x3e48bc*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x3638d5){if(isNotNull(_0x3638d5)){if(!_['isUndefined'](_0x3638d5[_0xf657('0x2b')])){_0x3638d5[_0xf657('0x2b')]=undefined;loggerPredictive[_0xf657('0x7c')](_0x3638d5[_0xf657('0x40')],_0xf657('0x8d'));}if(!_[_0xf657('0x3c')](_0x3638d5[_0xf657('0x2a')])){_0x3638d5[_0xf657('0x2a')]=undefined;loggerPredictive[_0xf657('0x7c')](_0x3638d5['name'],_0xf657('0x8e'));}if(!_[_0xf657('0x3c')](_0x3638d5[_0xf657('0x8f')])){clearInterval(_0x3638d5['handlePredictive']);_0x3638d5['handlePredictive']=undefined;loggerPredictive[_0xf657('0x7c')](_0x3638d5['name'],_0xf657('0x90'));}}}function erlangb(_0x5c2e69,_0x2d0c45){if(_0x2d0c45===0x0){return 0x0;}var _0x49e50b=0x1;for(var _0x59b961=0x1;_0x59b961<=_0x2d0c45;_0x59b961+=0x1){_0x49e50b=0x1+_0x49e50b*_0x59b961/_0x5c2e69;}return 0x1/_0x49e50b;}function isVoiceQueueOutbound(_0x565fe8){return _0x565fe8==='outbound';}function isNotPreview(_0xcef89){return _0xcef89!==_0xf657('0x24');}function isCampaignIvr(_0x5cc659){return _0x5cc659==='ivr';}function getCallerId(_0x512bf7,_0x1ae2fa,_0x41f049){if(!_[_0xf657('0x3c')](_0x41f049)&&'string'===typeof _0x41f049&&!_['isEmpty'](_0x41f049)){if(!_[_0xf657('0x3c')](_0x1ae2fa)&&_0xf657('0x91')===typeof _0x1ae2fa&&!_['isEmpty'](_0x1ae2fa)){return util[_0xf657('0x79')]('\x22%s\x22\x20<%s>',_0x1ae2fa,_0x41f049);}return util['format'](_0xf657('0x92'),_0x41f049,_0x41f049);}if(!_[_0xf657('0x3c')](_0x512bf7)&&'string'===typeof _0x512bf7&&!_[_0xf657('0x46')](_0x512bf7)){return _0x512bf7;}return _0xf657('0x93');}function loggerCatchQueueSummary(_0x34812d,_0x3d6e90){return function(_0x46103b){freeVariablesPredictive(_0x3d6e90);emitVoiceQueueSummary(_0x3d6e90);emitCampaignSummary(_0x3d6e90);loggerSyncQueueSummary[_0xf657('0x94')](_0x34812d,util[_0xf657('0x95')](_0x46103b,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x13fb85,_0x122dc9){return function(_0xc79b76){loggerPredictive['error'](_0x122dc9[_0xf657('0x40')],_0x13fb85);loggerPredictive[_0xf657('0x94')](_0xc79b76['stack']);freeVariablesPredictive(_0x122dc9);};}function loggerCatch(_0x330f39){return function(_0x5550e3){logger['error'](_0x330f39,util[_0xf657('0x95')](_0x5550e3,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x152b2b){return _0x152b2b&&!_['isUndefined'](_0x152b2b)&&_0x152b2b[_0xf657('0x96')]>0x0;}function decremetOriginate(_0x417b8c){if(!_[_0xf657('0x3c')](_0x417b8c)&&_0x417b8c!==null){if(_0x417b8c[_0xf657('0x97')]('originated')){if(_0x417b8c[_0xf657('0x73')]>0x0){_0x417b8c[_0xf657('0x73')]-=0x1;}else{logger[_0xf657('0x94')](_0xf657('0x98'));}}}else{logger[_0xf657('0x94')](_0xf657('0x99'));}}function checkContactLowerLimitOriginate(_0x101412,_0x15da86,_0x59b056){if(_0x15da86>_0x59b056){for(var _0x85144a=0x0;_0x85144a<_0x15da86-_0x59b056;_0x85144a+=0x1){decremetOriginate(_0x101412);}}}function loggerGetContactDialer(_0x356bbd,_0x5713ae,_0x2377e0){return function(_0x8579ae){checkContactLowerLimitOriginate(_0x5713ae,_0x2377e0,0x0);logger[_0xf657('0x94')](_0x356bbd,util['inspect'](_0x8579ae,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x18d0fa){return function(_0x2504b3){if(isNotNull(_0x2504b3)&&isNotNull(_0x2504b3[0x0])){if(_0x2504b3[0x0][_0xf657('0x9a')]>0x0){_0x18d0fa['message']=_0xf657('0x9b');logger[_0xf657('0x7c')](_0xf657('0x9c')+_0x18d0fa[_0xf657('0x40')],_0x2504b3[0x0][_0xf657('0x9a')],'contacts');}else{_0x18d0fa[_0xf657('0x3d')]='AVAILABLE_CONTACTS_FINISHED';logger['info'](_0xf657('0x9d')+_0x18d0fa[_0xf657('0x40')]);}}};}function notSendMessagesQueue(_0xeb8dde){if(_0xeb8dde['sendMessageOneNotActive']){freeVariablesPredictive(_0xeb8dde);if(_0xeb8dde[_0xf657('0x73')]===0x0&&_0xeb8dde[_0xf657('0x56')]===0x0&&_0xeb8dde['waiting']===0x0&&(_0xeb8dde[_0xf657('0x53')]||0x0)===0x0){_0xeb8dde[_0xf657('0x9e')]=![];_0xeb8dde[_0xf657('0x51')]=0x0;_0xeb8dde[_0xf657('0x3d')]=_0xf657('0x9f');loggerSyncQueueSummary[_0xf657('0x94')](_0xf657('0xa0'),_0xeb8dde[_0xf657('0x40')],'is\x20not\x20active');}else{_0xeb8dde[_0xf657('0x3d')]=_0xf657('0xa1');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0xeb8dde[_0xf657('0x40')],_0xf657('0xa2'));}emitVoiceQueueSummary(_0xeb8dde);}}function notSendMessagesCampaign(_0x2d02d1){if(_0x2d02d1[_0xf657('0x9e')]){if(_0x2d02d1[_0xf657('0x73')]===0x0){_0x2d02d1['sendMessageOneNotActive']=![];_0x2d02d1[_0xf657('0x3d')]='NOT_ACTIVE';loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x2d02d1[_0xf657('0x40')],_0xf657('0xa3'));}else{_0x2d02d1[_0xf657('0x3d')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xf657('0x94')](_0xf657('0xa4'),_0x2d02d1[_0xf657('0x40')],_0xf657('0xa2'));}emitCampaignSummary(_0x2d02d1);}}function createObjHistory(_0x21d533,_0x57b393,_0x1e7f16,_0x1cf9d0,_0x574ee3){_0x21d533[_0xf657('0x3d')]=_0x1e7f16;var _0x1b73d5=new Action(_0x21d533,_0x57b393);var _0x491651=new History(_0x1b73d5);_0x491651[_0xf657('0xa5')]=_0x1cf9d0;_0x491651['statedesc']=_0x574ee3;_0x491651[_0xf657('0xa6')]=_0x1b73d5[_0xf657('0xa7')];return _0x491651;}Dialer[_0xf657('0x20')][_0xf657('0xa8')]=function(){var _0x274c3b=this;setInterval(function(){_0x274c3b[_0xf657('0xa9')](_0x274c3b[_0xf657('0xaa')],_0xf657('0xab'));_0x274c3b[_0xf657('0xa9')](_0x274c3b[_0xf657('0x28')],_0xf657('0xac'));},0x32c8);};Dialer['prototype'][_0xf657('0xa9')]=function(_0x3a562b,_0x4fbfe7){var _0x5a03c9=this;for(var _0x5dbaf0 in _0x3a562b){if(_0x3a562b[_0xf657('0x97')](_0x5dbaf0)){this[_0xf657('0x23')][_0xf657('0xad')](function(){if(!_['isNil'](_0x3a562b[_0x5dbaf0])){return ami[_0xf657('0xae')]({'action':_0xf657('0xaf'),'channel':_0x3a562b[_0x5dbaf0][_0xf657('0xb0')]})['catch'](function(_0x315dec){if(_0x315dec[_0xf657('0x3d')]===_0xf657('0xb1')){setTimeout(function(){if(_0x3a562b[_0x5dbaf0]&&_0x3a562b[_0x5dbaf0]['type']!=='ivr'){_0x5a03c9[_0xf657('0xb2')](_0x5a03c9[_0xf657('0x25')][_0x3a562b[_0x5dbaf0]['queue']]);logger[_0xf657('0x94')](_0xf657('0xb3'),_0x4fbfe7,_0x5dbaf0,_0x3a562b[_0x5dbaf0][_0xf657('0xb4')]);delete _0x3a562b[_0x5dbaf0];}if(_0x3a562b[_0x5dbaf0]&&_0x3a562b[_0x5dbaf0]['type']==='ivr'){_0x5a03c9[_0xf657('0xb2')](_0x5a03c9['campaigns'][_0x3a562b[_0x5dbaf0][_0xf657('0xb4')]]);logger['error'](_0xf657('0xb5'),_0x4fbfe7,_0x5dbaf0,_0x3a562b[_0x5dbaf0][_0xf657('0xb4')]);delete _0x3a562b[_0x5dbaf0];}},0x2328);}});}});}}};Dialer[_0xf657('0x20')][_0xf657('0xb6')]=function(_0x1539de){return BPromise[_0xf657('0xb7')]()['then'](cmHopper[_0xf657('0xb6')](_0x1539de))['catch'](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xf657('0x20')][_0xf657('0xb8')]=function(_0x19ea36){return BPromise[_0xf657('0xb7')]()[_0xf657('0xb9')](cmHopperBlack[_0xf657('0xb8')](_0x19ea36))[_0xf657('0xba')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0xf657('0x20')]['checkIsBlackListIvr']=function(_0x23af40){return BPromise[_0xf657('0xb7')]()['then'](cmHopperBlack[_0xf657('0xbb')](_0x23af40))[_0xf657('0xba')](loggerCatch(_0xf657('0xbc')));};Dialer[_0xf657('0x20')][_0xf657('0xbd')]=function(_0x31c926){return BPromise[_0xf657('0xb7')]()[_0xf657('0xb9')](cmHopperHistory[_0xf657('0xbe')](_0x31c926))[_0xf657('0xba')](loggerCatch(_0xf657('0xbf')));};Dialer[_0xf657('0x20')][_0xf657('0xc0')]=function(_0x576cf){return BPromise[_0xf657('0xb7')]()[_0xf657('0xb9')](cmHopper['rescheduleContact'](_0x576cf))[_0xf657('0xba')](loggerCatch(_0xf657('0xc1')));};Dialer['prototype']['unlockContact']=function(_0x2544b1,_0x44b5ad,_0x623a45){return BPromise[_0xf657('0xb7')]()[_0xf657('0xb9')](cmHopper['unlockContact'](_0x2544b1,_0x44b5ad,_0x623a45))['catch'](loggerCatch(_0xf657('0xc2')));};Dialer[_0xf657('0x20')][_0xf657('0xc3')]=function(_0x1ca14e,_0x910804,_0x49aeb3,_0x21f609){return BPromise[_0xf657('0xb7')]()[_0xf657('0xb9')](cmHopper[_0xf657('0xc3')](_0x1ca14e,_0x910804,_0x49aeb3,_0x21f609))[_0xf657('0xba')](loggerCatch(_0xf657('0xc4')));};Dialer[_0xf657('0x20')][_0xf657('0xc5')]=function(_0x139d63,_0x3b2ab1,_0x3ce5c2){return BPromise[_0xf657('0xb7')]()[_0xf657('0xb9')](cmHopper['getContactDialerIvr'](_0x139d63,_0x3b2ab1,_0x3ce5c2))[_0xf657('0xba')](loggerCatch(_0xf657('0xc4')));};Dialer['prototype'][_0xf657('0xc6')]=function(_0x1d3ce0){return BPromise[_0xf657('0xb7')]()['then'](voiceQueueRt[_0xf657('0xc6')](_0x1d3ce0))[_0xf657('0xba')](loggerCatch(_0xf657('0xc7')));};Dialer[_0xf657('0x20')][_0xf657('0xc8')]=function(_0x1c7c02){return BPromise[_0xf657('0xb7')]()[_0xf657('0xb9')](cmHopper['moveContactManagedDialer'](_0x1c7c02))[_0xf657('0xba')](loggerCatch(_0xf657('0xc9')));};Dialer[_0xf657('0x20')][_0xf657('0xca')]=function(_0x24c020){return BPromise[_0xf657('0xb7')]()['then'](cmHopperHistory[_0xf657('0xca')](_0x24c020))[_0xf657('0xba')](loggerCatch(_0xf657('0xcb')));};Dialer[_0xf657('0x20')]['updateOriginated']=function(_0x3887a1){if(!_[_0xf657('0x3c')](_0x3887a1)&&_0x3887a1!==null){if(_0x3887a1[_0xf657('0x97')](_0xf657('0x73'))){if(_0x3887a1[_0xf657('0x73')]>0x0){_0x3887a1[_0xf657('0x73')]-=0x1;}else{logger[_0xf657('0x94')](_0xf657('0xcc'));}}}else{logger[_0xf657('0x94')](_0xf657('0xcd'));}};Dialer[_0xf657('0x20')][_0xf657('0xce')]=function(_0x1a7717,_0x26c014){var _0x59b75f=this;return function(_0x34cfa9){_0x59b75f[_0xf657('0xb2')](_0x26c014);logger['error'](_0x1a7717,util[_0xf657('0x95')](_0x34cfa9,{'showHidden':![],'depth':null}));};};Dialer[_0xf657('0x20')][_0xf657('0xcf')]=function(_0x2739ad,_0x30af86,_0x32b30f){var _0x3111ea={'state':0x19,'statedesc':_0xf657('0xd0')};this[_0xf657('0xb2')](_0x30af86);this['saveInDb'](_[_0xf657('0xd1')](_0x3111ea,_[_0xf657('0xd2')](_0x32b30f,[_0xf657('0xd3'),_0xf657('0xd4'),_0xf657('0xd5'),_0xf657('0xd6'),_0xf657('0xd7')])),'[emptyContact][createHistory]',_0xf657('0xd8'));logger['error'](_0x2739ad);};Dialer[_0xf657('0x20')]['isSuccess']=function(_0x157c89){return _0x157c89===_0xf657('0xd9');};Dialer['prototype']['isTrunkReachable']=function(_0x80e844){return!_[_0xf657('0x3c')](_0x80e844)&&_0x80e844&&!_['isUndefined'](_0x80e844[_0xf657('0x40')])&&!_['isUndefined'](_0x80e844[_0xf657('0xda')])&&_0x80e844[_0xf657('0xda')]&&(this[_0xf657('0xdb')][util[_0xf657('0x79')](_0xf657('0xdc'),_0x80e844[_0xf657('0x40')])][_0xf657('0xaf')]===_0xf657('0xdd')||this[_0xf657('0xdb')][util[_0xf657('0x79')](_0xf657('0xdc'),_0x80e844[_0xf657('0x40')])][_0xf657('0xaf')]===_0xf657('0xde'));};Dialer[_0xf657('0x20')][_0xf657('0xdf')]=function(_0x9e2934,_0x3ab923,_0x4b97b1){this[_0xf657('0xca')](_0x9e2934)[_0xf657('0xba')](loggerCatch(_0x3ab923));this[_0xf657('0xc8')](_0x9e2934)[_0xf657('0xba')](loggerCatch(_0x4b97b1));};Dialer[_0xf657('0x20')][_0xf657('0x38')]=function(_0x517bd4){var _0x5383a8=this[_0xf657('0xaa')][_0x517bd4[_0xf657('0xe0')]];var _0x1181e8;if(!_[_0xf657('0xe1')](_0x517bd4)&&!_[_0xf657('0xe1')](_0x517bd4[_0xf657('0xe2')])&&!_[_0xf657('0xe1')](_0x517bd4[_0xf657('0xe2')][_0xf657('0xe3')])&&_0x517bd4[_0xf657('0xe4')]==='xcally-motion-dialer'&&_0x5383a8){if(_0x5383a8[_0xf657('0x4d')]!==_0xf657('0x78')&&this['voiceQueues'][_0x5383a8[_0xf657('0xb4')]][_0xf657('0xe5')]&&_0x517bd4[_0xf657('0xe6')]===_0xf657('0xe7')){delete this['uniqueId'][_0x517bd4[_0xf657('0xe0')]];this[_0xf657('0xb2')](this[_0xf657('0x25')][_0x5383a8[_0xf657('0xb4')]]);this[_0xf657('0x25')][_0x5383a8['queue']]['outboundAnswerCallsDay']+=0x1;this[_0xf657('0x25')][_0x5383a8['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x1181e8=new Hangup(_0x5383a8,_0x517bd4);_0x1181e8[_0xf657('0xa5')]=0x12;_0x1181e8[_0xf657('0xe8')]=_0xf657('0xe9');_0x1181e8[_0xf657('0xea')]=_0xf657('0xeb');this['saveInDb'](_0x1181e8,'[syncHangupInAMD][createHistory]',_0xf657('0xec'));}if(_0x5383a8[_0xf657('0x4d')]!=='ivr'&&this[_0xf657('0x25')][_0x5383a8['queue']]['dialAMDActive']&&_0x517bd4[_0xf657('0xe6')]==='MACHINE'){delete this[_0xf657('0xaa')][_0x517bd4[_0xf657('0xe0')]];this['updateOriginated'](this[_0xf657('0x25')][_0x5383a8[_0xf657('0xb4')]]);this[_0xf657('0x25')][_0x5383a8[_0xf657('0xb4')]][_0xf657('0x5f')]+=0x1;this[_0xf657('0x25')][_0x5383a8['queue']][_0xf657('0xed')]+=0x1;_0x1181e8=new Hangup(_0x5383a8,_0x517bd4);_0x1181e8[_0xf657('0xa5')]=0x13;_0x1181e8[_0xf657('0xe8')]='Machine';_0x1181e8[_0xf657('0xea')]=_0xf657('0xeb');_0x1181e8['amd']=!![];this[_0xf657('0xdf')](_0x1181e8,'[syncMachine][createHistory]',_0xf657('0xee'));}if(_0x5383a8[_0xf657('0x4d')]==='ivr'&&this['campaigns'][_0x5383a8[_0xf657('0xb4')]]['dialAMDActive']&&_0x517bd4[_0xf657('0xe6')]===_0xf657('0xe7')){delete this['uniqueId'][_0x517bd4[_0xf657('0xe0')]];this['updateOriginated'](this[_0xf657('0xef')][_0x5383a8[_0xf657('0xb4')]]);_0x1181e8=new Hangup(_0x5383a8,_0x517bd4);_0x1181e8[_0xf657('0xa5')]=0x12;_0x1181e8[_0xf657('0xe8')]=_0xf657('0xe9');_0x1181e8['membername']=_0xf657('0xeb');this[_0xf657('0xdf')](_0x1181e8,_0xf657('0xf0'),'[syncHangupInAMDIvr]');}if(_0x5383a8[_0xf657('0x4d')]===_0xf657('0x78')&&this[_0xf657('0xef')][_0x5383a8[_0xf657('0xb4')]][_0xf657('0xe5')]&&_0x517bd4[_0xf657('0xe6')]===_0xf657('0xf1')){delete this[_0xf657('0xaa')][_0x517bd4[_0xf657('0xe0')]];this['updateOriginated'](this['campaigns'][_0x5383a8[_0xf657('0xb4')]]);_0x1181e8=new Hangup(_0x5383a8,_0x517bd4);_0x1181e8[_0xf657('0xa5')]=0x13;_0x1181e8[_0xf657('0xe8')]=_0xf657('0xf2');_0x1181e8['membername']=_0xf657('0xeb');_0x1181e8[_0xf657('0xf3')]=!![];this[_0xf657('0xdf')](_0x1181e8,_0xf657('0xf4'),_0xf657('0xf5'));}}};Dialer[_0xf657('0x20')][_0xf657('0xf6')]=function(_0x48e15f){var _0x233ab6=this[_0xf657('0xaa')][_0x48e15f[_0xf657('0xe0')]];var _0x226813=this;var _0xaa0987;if(_0x233ab6&&_0x233ab6['type']==='ivr'){delete this[_0xf657('0xaa')][_0x48e15f[_0xf657('0xe0')]];this[_0xf657('0xb2')](this[_0xf657('0xef')][_0x233ab6[_0xf657('0xb4')]]);this[_0xf657('0xef')][_0x233ab6['queue']]['ivrAnswerCallsDay']+=0x1;_0xaa0987=new Hangup(_0x233ab6,_0x48e15f);this[_0xf657('0xca')](_0xaa0987)[_0xf657('0xba')](loggerCatch(_0xf657('0xf7')));this['moveContactManagedDialer'](_0xaa0987)[_0xf657('0xba')](loggerCatch('[syncHangupIvr]'));}if(_0x233ab6&&_0x233ab6[_0xf657('0x4d')]!==_0xf657('0x78')&&isNotNull(this[_0xf657('0x25')][_0x233ab6[_0xf657('0xb4')]][_0xf657('0xf8')])){delete this[_0xf657('0xaa')][_0x48e15f[_0xf657('0xe0')]];this[_0xf657('0xb2')](this[_0xf657('0x25')][_0x233ab6[_0xf657('0xb4')]]);this[_0xf657('0x25')][_0x233ab6[_0xf657('0xb4')]][_0xf657('0x5f')]+=0x1;this['voiceQueues'][_0x233ab6[_0xf657('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;_0xaa0987=new Hangup(_0x233ab6,_0x48e15f);_0xaa0987[_0xf657('0xa5')]=0x10;_0xaa0987[_0xf657('0xe8')]=_0xf657('0xf9');_0xaa0987[_0xf657('0xea')]=_0xf657('0xfa');this[_0xf657('0xca')](_0xaa0987)[_0xf657('0xba')](loggerCatch(_0xf657('0xf7')));this[_0xf657('0xc8')](_0xaa0987)[_0xf657('0xba')](loggerCatch(_0xf657('0xfb')));}if(_0x233ab6&&_0x233ab6[_0xf657('0x4d')]!=='ivr'&&!isNotNull(this['voiceQueues'][_0x233ab6[_0xf657('0xb4')]][_0xf657('0xf8')])){delete this[_0xf657('0xaa')][_0x48e15f[_0xf657('0xe0')]];this['updateOriginated'](this[_0xf657('0x25')][_0x233ab6['queue']]);this['voiceQueues'][_0x233ab6[_0xf657('0xb4')]]['outboundUnknownCallsDay']+=0x1;_0xaa0987=new Hangup(_0x233ab6,_0x48e15f);_0xaa0987[_0xf657('0xa5')]=0xc;_0xaa0987[_0xf657('0xe8')]=_0x48e15f[_0xf657('0xfc')];_0xaa0987[_0xf657('0xea')]=_0xf657('0xfd');this[_0xf657('0xca')](_0xaa0987)['catch'](loggerCatch(_0xf657('0xf7')));this[_0xf657('0xc8')](_0xaa0987)['catch'](loggerCatch(_0xf657('0xfb')));}};Dialer[_0xf657('0x20')][_0xf657('0x35')]=function(_0x4efc29){var _0xae22c1=this['uniqueId'][_0x4efc29['uniqueid']];var _0x10daa0=this;if(this['voiceQueues'][_0x4efc29[_0xf657('0xb4')]]){if(_0xae22c1&&_0xae22c1[_0xf657('0x4d')]!==_0xf657('0x78')){delete this[_0xf657('0xaa')][_0x4efc29[_0xf657('0xe0')]];this[_0xf657('0x25')][_0x4efc29[_0xf657('0xb4')]][_0xf657('0x5f')]+=0x1;var _0x1ad164=new AgentComplete(_0xae22c1,_0x4efc29);if(_0x4efc29[_0xf657('0xfe')]===_0xf657('0xff')){_0x1ad164[_0xf657('0x100')]=this[_0xf657('0x25')][_0x4efc29[_0xf657('0xb4')]][_0xf657('0x101')]&&this[_0xf657('0x25')][_0x4efc29[_0xf657('0xb4')]]['dialAgiAfterHangupAgent']?moment()[_0xf657('0x79')](_0xf657('0x102')):undefined;}this[_0xf657('0xca')](_0x1ad164)[_0xf657('0xba')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xf657('0xc8')](_0x1ad164)[_0xf657('0xba')](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0xf657('0x103')]=function(_0x8b779b){if(this['voiceQueues'][_0x8b779b[_0xf657('0xb4')]]){if(this[_0xf657('0xaa')][_0x8b779b['uniqueid']]&&this[_0xf657('0xaa')][_0x8b779b[_0xf657('0xe0')]][_0xf657('0x4d')]!=='ivr'){this[_0xf657('0xb2')](this[_0xf657('0x25')][_0x8b779b[_0xf657('0xb4')]]);this[_0xf657('0xaa')][_0x8b779b[_0xf657('0xe0')]][_0xf657('0x104')]=moment()[_0xf657('0x79')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xf657('0x20')]['queueCallerAbandonCreateState']=function(_0x370822){this[_0xf657('0xca')](_0x370822)[_0xf657('0xba')](loggerCatch(_0xf657('0x105')));this[_0xf657('0xc8')](_0x370822)[_0xf657('0xba')](loggerCatch(_0xf657('0x106')));};Dialer[_0xf657('0x20')][_0xf657('0x107')]=function(_0x5a6581){var _0x117190=this['uniqueId'][_0x5a6581[_0xf657('0xe0')]];var _0x481d22=this;if(this[_0xf657('0x25')][_0x5a6581['queue']]){if(_0x117190&&_0x117190[_0xf657('0x4d')]!==_0xf657('0x78')){delete this[_0xf657('0xaa')][_0x5a6581[_0xf657('0xe0')]];this['updateOriginated'](this[_0xf657('0x25')][_0x5a6581[_0xf657('0xb4')]]);_0x117190['droptime']=moment()['format'](_0xf657('0x102'));var _0x33b679=new QueueCallerAbandon(_0x117190,_0x5a6581);if(getSeconds(_0x117190['droptime'],_0x117190[_0xf657('0x108')])>=_0x117190['dialQueueTimeout']){this['voiceQueues'][_0x5a6581[_0xf657('0xb4')]][_0xf657('0x6c')]+=0x1;this['voiceQueues'][_0x5a6581[_0xf657('0xb4')]][_0xf657('0x109')]+=0x1;this[_0xf657('0x25')][_0x5a6581[_0xf657('0xb4')]][_0xf657('0x6e')]+=0x1;_0x33b679[_0xf657('0xa5')]=0xa;_0x33b679[_0xf657('0xe8')]=_0xf657('0x10a');_0x33b679['dropreason']=_0xf657('0x10b');_0x33b679[_0xf657('0x100')]=this[_0xf657('0x25')][_0x5a6581['queue']][_0xf657('0x101')]?moment()[_0xf657('0x79')](_0xf657('0x102')):undefined;_0x33b679[_0xf657('0x10c')]+=0x1;if(_0x33b679[_0xf657('0x10c')]>=this['voiceQueues'][_0x5a6581['queue']][_0xf657('0x10d')]){this[_0xf657('0x10e')](_0x33b679);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x33b679[_0xf657('0x10c')],'scheduledat':moment()[_0xf657('0x10f')](this[_0xf657('0x25')][_0x5a6581[_0xf657('0xb4')]][_0xf657('0x110')],_0xf657('0x111'))[_0xf657('0x79')](_0xf657('0x102')),'ContactId':_0x117190[_0xf657('0xd3')],'ListId':_0x117190[_0xf657('0xd4')],'VoiceQueueId':_0x117190[_0xf657('0xd6')]||undefined,'CampaignId':_0x117190[_0xf657('0xd7')]||undefined})[_0xf657('0xba')](loggerCatch(_0xf657('0x112')));var _0x3f0428=new History(_0x33b679);_0x3f0428[_0xf657('0xa5')]=0xa;_0x3f0428[_0xf657('0xe8')]='Drop';_0x3f0428['starttime']=moment()[_0xf657('0x79')]('YYYY-MM-DD\x20HH:mm:ss');_0x3f0428[_0xf657('0xa6')]=_0x3f0428[_0xf657('0xa7')];console[_0xf657('0x113')](_0xf657('0x114'),_0x5a6581);console[_0xf657('0x113')](_0xf657('0x115'),_0x33b679);console['log'](_0xf657('0x116'),_0x3f0428);this[_0xf657('0xca')](_0x3f0428)[_0xf657('0xba')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xf657('0x25')][_0x5a6581[_0xf657('0xb4')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xf657('0x25')][_0x5a6581['queue']][_0xf657('0x117')]+=0x1;_0x33b679[_0xf657('0xa5')]=0xb;_0x33b679[_0xf657('0xe8')]=_0xf657('0x118');_0x33b679[_0xf657('0x119')]=_0xf657('0x11a');_0x33b679[_0xf657('0x11b')]+=0x1;if(_0x33b679[_0xf657('0x11b')]>=this['voiceQueues'][_0x5a6581[_0xf657('0xb4')]][_0xf657('0x11c')]){this[_0xf657('0x10e')](_0x33b679);}else{this[_0xf657('0xc0')]({'active':![],'countabandonedretry':_0x33b679['countabandonedretry'],'scheduledat':moment()['add'](this[_0xf657('0x25')][_0x5a6581[_0xf657('0xb4')]][_0xf657('0x11d')],_0xf657('0x111'))[_0xf657('0x79')](_0xf657('0x102')),'ContactId':_0x117190[_0xf657('0xd3')],'ListId':_0x117190['ListId'],'VoiceQueueId':_0x117190[_0xf657('0xd6')]||undefined,'CampaignId':_0x117190[_0xf657('0xd7')]||undefined})[_0xf657('0xba')](loggerCatch(_0xf657('0x11e')));var _0x3f0428=new History(_0x33b679);_0x3f0428[_0xf657('0xa5')]=0xb;_0x3f0428[_0xf657('0xe8')]='Abandoned';_0x3f0428['starttime']=moment()[_0xf657('0x79')]('YYYY-MM-DD\x20HH:mm:ss');_0x3f0428[_0xf657('0xa6')]=_0x3f0428[_0xf657('0xa7')];console[_0xf657('0x113')]('CRIS\x20createHistory\x2011',_0x3f0428);this[_0xf657('0xca')](_0x3f0428)['catch'](loggerCatch(_0xf657('0x11f')));}}}}};Dialer[_0xf657('0x20')][_0xf657('0x120')]=function(_0x4bba79){if(this['actions'][_0x4bba79[_0xf657('0xe0')]]){this[_0xf657('0x28')][_0x4bba79['uniqueid']][_0xf657('0xb0')]=_0x4bba79[_0xf657('0xb0')];}if(this[_0xf657('0xaa')][_0x4bba79[_0xf657('0xe0')]]){this[_0xf657('0xaa')][_0x4bba79[_0xf657('0xe0')]][_0xf657('0xb0')]=_0x4bba79['channel'];}};Dialer['prototype'][_0xf657('0x3a')]=function(_0x5c3055){if(strategy[this[_0xf657('0x25')][this[_0xf657('0x28')][_0x5c3055['actionid']]['queue']][_0xf657('0x4f')]]===_0xf657('0x1f')){if(this[_0xf657('0x28')][_0x5c3055[_0xf657('0x121')]]&&_[_0xf657('0xe1')](this['actions'][_0x5c3055[_0xf657('0x121')]][_0xf657('0x122')])&&_0x5c3055[_0xf657('0xaf')]==='1'&&_0x5c3055[_0xf657('0x123')]==='0'){if(this['agents'][_0x5c3055[_0xf657('0x124')]]){if(!this[_0xf657('0x26')][_0x5c3055[_0xf657('0x124')]][_0xf657('0x122')]){this[_0xf657('0x26')][_0x5c3055[_0xf657('0x124')]][_0xf657('0x122')]=!![];this[_0xf657('0x28')][_0x5c3055[_0xf657('0x121')]][_0xf657('0x122')]=!![];this['actions'][_0x5c3055[_0xf657('0x121')]][_0xf657('0x124')]=_0x5c3055[_0xf657('0x124')];}}}}else if((strategy[this[_0xf657('0x25')][this[_0xf657('0x28')][_0x5c3055['actionid']][_0xf657('0xb4')]][_0xf657('0x4f')]]||_0xf657('0x1e'))===_0xf657('0x1e')){if(this[_0xf657('0x28')][_0x5c3055['actionid']]){if(this[_0xf657('0x26')][_0x5c3055[_0xf657('0x124')]]){this[_0xf657('0x28')][_0x5c3055['actionid']][_0xf657('0x124')]=_0x5c3055[_0xf657('0x124')];if(_[_0xf657('0xe1')](this[_0xf657('0x2d')][this[_0xf657('0x28')][_0x5c3055[_0xf657('0x121')]][_0xf657('0xb4')]])){this[_0xf657('0x2d')][this[_0xf657('0x28')][_0x5c3055['actionid']][_0xf657('0xb4')]]=[];}this[_0xf657('0x2d')][this['actions'][_0x5c3055[_0xf657('0x121')]][_0xf657('0xb4')]][_0xf657('0x125')](_[_0xf657('0xd1')](_[_0xf657('0xd2')](this[_0xf657('0x28')][_0x5c3055['actionid']],[_0xf657('0x126'),'stateinterface']),{'status':_0x5c3055[_0xf657('0xaf')],'paused':_0x5c3055[_0xf657('0x123')]}));}}}};function unlockQueueStatus(_0x4c59cf,_0x57d787){setTimeout(function(){if(_[_0xf657('0x3c')](_0x4c59cf[_0xf657('0x127')])){loggerBooked[_0xf657('0x94')](_0xf657('0x128'),_0x57d787);}_0x4c59cf['queueStatusComplete']=!![];loggerBooked['info'](_0xf657('0x129'),_0x57d787,JSON[_0xf657('0x48')](_[_0xf657('0xd2')](_0x4c59cf,[_0xf657('0x40'),_0xf657('0x127')])));},0x1f3);}Dialer[_0xf657('0x20')][_0xf657('0x12a')]=function(_0x3602a5){var _0x5ad0f4=this;var _0x4c2cc0=_0x5ad0f4[_0xf657('0x25')][_0x5ad0f4[_0xf657('0x28')][_0x3602a5[_0xf657('0x121')]][_0xf657('0xb4')]];if(strategy[this[_0xf657('0x25')][this[_0xf657('0x28')][_0x3602a5[_0xf657('0x121')]]['queue']][_0xf657('0x4f')]]===_0xf657('0x1f')){if(this[_0xf657('0x28')][_0x3602a5[_0xf657('0x121')]]&&this[_0xf657('0x28')][_0x3602a5[_0xf657('0x121')]][_0xf657('0x124')]){this[_0xf657('0x24')]['run'](this[_0xf657('0x28')][_0x3602a5[_0xf657('0x121')]]['idHopper'],this[_0xf657('0x28')][_0x3602a5[_0xf657('0x121')]][_0xf657('0x124')])[_0xf657('0xba')](function(_0x28b450){logger['error'](_0xf657('0x12b'),util[_0xf657('0x95')](_0x28b450,{'showHidden':![],'depth':null}));})[_0xf657('0x22')](function(){_0x5ad0f4['updateOriginated'](_0x5ad0f4[_0xf657('0x25')][_0x5ad0f4[_0xf657('0x28')][_0x3602a5[_0xf657('0x121')]][_0xf657('0xb4')]]);_0x5ad0f4[_0xf657('0x26')][_0x5ad0f4[_0xf657('0x28')][_0x3602a5[_0xf657('0x121')]][_0xf657('0x124')]][_0xf657('0x122')]=![];delete _0x5ad0f4[_0xf657('0x28')][_0x3602a5['actionid']];unlockQueueStatus(_0x4c2cc0);});}else{this['updateOriginated'](this[_0xf657('0x25')][this[_0xf657('0x28')][_0x3602a5[_0xf657('0x121')]][_0xf657('0xb4')]]);this[_0xf657('0xc0')]({'active':![],'ContactId':this[_0xf657('0x28')][_0x3602a5[_0xf657('0x121')]]['ContactId'],'ListId':this['actions'][_0x3602a5[_0xf657('0x121')]][_0xf657('0xd4')],'VoiceQueueId':this['actions'][_0x3602a5['actionid']]['VoiceQueueId']||undefined,'CampaignId':this[_0xf657('0x28')][_0x3602a5['actionid']][_0xf657('0xd7')]||undefined})[_0xf657('0xba')](loggerCatch(_0xf657('0x12c')));delete this[_0xf657('0x28')][_0x3602a5[_0xf657('0x121')]];unlockQueueStatus(_0x4c2cc0);}}else if((strategy[this[_0xf657('0x25')][this[_0xf657('0x28')][_0x3602a5[_0xf657('0x121')]][_0xf657('0xb4')]][_0xf657('0x4f')]]||_0xf657('0x1e'))===_0xf657('0x1e')){var _0x29ceb9;if(this['actions'][_0x3602a5[_0xf657('0x121')]]&&!_[_0xf657('0x46')](this['queueBooked'][this['actions'][_0x3602a5[_0xf657('0x121')]][_0xf657('0xb4')]])){if(this[_0xf657('0x2e')][_0x5ad0f4['actions'][_0x3602a5[_0xf657('0x121')]][_0xf657('0xb4')]]){this['queueBookedRR'][_0x5ad0f4[_0xf657('0x28')][_0x3602a5['actionid']][_0xf657('0xb4')]]=this[_0xf657('0x2e')][this[_0xf657('0x28')][_0x3602a5['actionid']][_0xf657('0xb4')]]?this['queueBookedRR'][this['actions'][_0x3602a5['actionid']][_0xf657('0xb4')]]:this[_0xf657('0x2d')][this[_0xf657('0x28')][_0x3602a5['actionid']][_0xf657('0xb4')]]?this[_0xf657('0x2d')][this['actions'][_0x3602a5[_0xf657('0x121')]]['queue']][_0xf657('0x12d')]||0x0:0x0;}this[_0xf657('0x2d')][this[_0xf657('0x28')][_0x3602a5[_0xf657('0x121')]][_0xf657('0xb4')]][_0xf657('0x12d')]=this[_0xf657('0x2e')][this[_0xf657('0x28')][_0x3602a5['actionid']]['queue']];for(var _0x101b7e=0x0;_0x101b7e=0x0?!![]:![];})[_0xf657('0xba')](myreject(_0x530cd2)));}}else{_0x6115fa[_0xf657('0x125')](ami[_0xf657('0xae')]({'action':_0xf657('0x144'),'command':util[_0xf657('0x79')](_0xf657('0x145'),_0x7fe5d7,!_[_0xf657('0x3c')](config[_0xf657('0x142')][_0x4ec760])?_0x4ec760:'')})[_0xf657('0xb9')](function(_0x5c36f9){return _0x5c36f9['content'][_0xf657('0x147')]('true')>=0x0?!![]:![];})['catch'](myreject(_0x530cd2)));}BPromise[_0xf657('0x148')](_0x6115fa)[_0xf657('0xb9')](function(_0x315df5){var _0xfc128d=_[_0xf657('0x149')](_0x315df5);if(_0xfc128d){return _0x3ddb9b(_0xfc128d);}else{_0x651645[_0xf657('0x3d')]=_0x2833bc?'GLOBAL_INTERVAL_IS_OVERTIME':'INTERVAL_IS_OVERTIME';return _0x530cd2(msgResponse(_0xf657('0x14a'),'Failure','Global:\x20'+_0x2833bc+'\x20'+_0x23f965+_0xf657('0x14b')+util[_0xf657('0x95')](_0x7fe5d7,{'showHidden':![],'depth':null})+_0xf657('0x14c')+_0x4ec760));}})[_0xf657('0xba')](function(_0x35aa41){return _0x530cd2(msgResponse(_0xf657('0x13e'),_0xf657('0x140'),JSON[_0xf657('0x48')](_0x35aa41)));});});};Dialer['prototype'][_0xf657('0x14d')]=function(_0x2ee749){var _0x33517e=this;return function(){switch(_0x2ee749['dialMethod']){case'progressive':freeVariablesPredictive(_0x2ee749);_0x33517e[_0xf657('0x14e')](_0x2ee749,0x1);break;case'power':freeVariablesPredictive(_0x2ee749);_0x33517e[_0xf657('0x14e')](_0x2ee749,_0x2ee749['dialPowerLevel']);break;case _0xf657('0x14f'):_0x33517e[_0xf657('0x14f')](_0x2ee749);break;case _0xf657('0xa'):freeVariablesPredictive(_0x2ee749);_0x33517e[_0xf657('0x14e')](_0x2ee749,0x1);break;default:freeVariablesPredictive(_0x2ee749);logger[_0xf657('0x94')](_0xf657('0x150'),_0x2ee749['name'],_0xf657('0x151'));}};};Dialer[_0xf657('0x20')][_0xf657('0x152')]=function(_0x598a28){var _0x4f02bd=this;return function(){_0x4f02bd['handleIvr'](_0x598a28);};};Dialer[_0xf657('0x20')][_0xf657('0xc')]=function(_0x2df1ee){var _0x1c5578=this;if(isNotPreview(_0x2df1ee[_0xf657('0x5b')])){if(isVoiceQueueOutbound(_0x2df1ee[_0xf657('0x4d')])&&isActive(_0x2df1ee[_0xf657('0x5a')])){_0x2df1ee['sendMessageOneNotActive']=!![];BPromise[_0xf657('0xb7')]()['then'](checkIsLoggedIn(_0x2df1ee,_0x2df1ee[_0xf657('0x52')]))['then'](checkIsActive(_0x2df1ee,_0x2df1ee[_0xf657('0x5a')]))[_0xf657('0xb9')](checkInterval(_0x2df1ee))[_0xf657('0xb9')](_0x1c5578['checkIsTrunkReachable'](_0x2df1ee))[_0xf657('0xb9')](_0x1c5578[_0xf657('0x153')](_0x2df1ee[_0xf657('0x154')],_0x2df1ee[_0xf657('0x155')],_0x2df1ee[_0xf657('0x40')],_0x2df1ee))['then'](_0x1c5578['checkIfTimeIntervals'](_0x2df1ee[_0xf657('0x44')],_0x2df1ee[_0xf657('0x155')],_0x2df1ee[_0xf657('0x40')],_0x2df1ee))[_0xf657('0xb9')](_0x1c5578[_0xf657('0x14d')](_0x2df1ee))[_0xf657('0xba')](loggerCatchQueueSummary(_0xf657('0x156'),_0x2df1ee));}else{notSendMessagesQueue(_0x2df1ee);}}else{freeVariablesPredictive(_0x2df1ee);}};Dialer[_0xf657('0x20')][_0xf657('0x157')]=function(){var _0x1d546b=this;var _0x11ca45;for(var _0x22462d in this[_0xf657('0xef')]){if(this[_0xf657('0xef')]['hasOwnProperty'](_0x22462d)){_0x11ca45=this[_0xf657('0xef')][_0x22462d];if(isCampaignIvr(_0x11ca45[_0xf657('0x4d')])&&isActive(_0x11ca45[_0xf657('0xda')])){_0x11ca45[_0xf657('0x9e')]=!![];BPromise[_0xf657('0xb7')]()[_0xf657('0xb9')](checkIsActive(_0x11ca45,_0x11ca45[_0xf657('0xda')]))['then'](checkInterval(_0x11ca45))[_0xf657('0xb9')](_0x1d546b[_0xf657('0x139')](_0x11ca45))['then'](_0x1d546b[_0xf657('0x153')](_0x11ca45[_0xf657('0x154')],_0x11ca45[_0xf657('0x155')],_0x11ca45['name'],_0x11ca45))[_0xf657('0xb9')](_0x1d546b[_0xf657('0x13f')](_0x11ca45['Interval'],_0x11ca45[_0xf657('0x155')],_0x11ca45[_0xf657('0x40')],_0x11ca45))['then'](_0x1d546b[_0xf657('0x152')](_0x11ca45))[_0xf657('0xba')](loggerCatchQueueSummary('[syncCampaigns]',_0x11ca45));}else{notSendMessagesCampaign(_0x11ca45);}}}};function getCallerIdRandom(_0x4ecb63,_0x6cb68){var _0x397537,_0x5ca194,_0x5d4475;if(_0x6cb68<=0x0){_0x6cb68=0x1;}_0x397537=new RegExp(_0xf657('0x158')+_0x6cb68+'}$');_0x5ca194=Math['pow'](0xa,_0x6cb68-0x1);_0x5d4475=Math['pow'](0xa,_0x6cb68)-0x1;return util[_0xf657('0x79')]('%s',_['replace'](_0x4ecb63,_0x397537,_['random'](_0x5ca194,_0x5d4475)));}function extractCalleridName(_0x35802b){var _0x55d2e1=_0x35802b[_0xf657('0x159')](/"(.*?)"/);return _0x55d2e1?_0x55d2e1[0x1]:_0x35802b;}function extractCalleridNumber(_0x5d1842){var _0x549a84=_0x5d1842['match'](/<(.*?)>/);return _0x549a84?_0x549a84[0x1]:_0x5d1842;}Dialer['prototype'][_0xf657('0x15a')]=function(_0x357f42,_0x2e1124){var _0x475edb=this;var _0x50b3c7=uuid['v4']();this[_0xf657('0x28')][_0x50b3c7]=new Action(_0x357f42,_0x2e1124,_0x50b3c7);return new BPromise(function(_0xbb61d7,_0x1403b0){if(_[_0xf657('0x3c')](_0x357f42)&&_0xf657('0x15b')!==typeof _0x357f42){return _0x1403b0(msgResponse(_0xf657('0x15c'),_0xf657('0x140'),_0xf657('0x15d')));}if(_[_0xf657('0x3c')](_0x2e1124[_0xf657('0x15e')][_0xf657('0x15f')])||_0x2e1124['Contact'][_0xf657('0x15f')]===null){return _0x1403b0(msgResponse(_0xf657('0x15c'),'Failure','contact\x20is\x20undefine'));}var _0x889ff0={'XMD-CALLERID':_0x475edb[_0xf657('0x28')][_0x50b3c7][_0xf657('0x160')](),'XMD-AGI':_0x357f42[_0xf657('0xf8')]?util[_0xf657('0x79')](_0xf657('0x161'),ipAgi,_0x357f42['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x357f42[_0xf657('0x101')]?util[_0xf657('0x79')](_0xf657('0x161'),ipAgi,_0x357f42[_0xf657('0x101')]):_0xf657('0x162'),'XMD-QUEUE':_0x357f42[_0xf657('0x4d')]===_0xf657('0x4e')?util[_0xf657('0x79')]('\x22%s,%s%s,,,%s\x22',_0x357f42[_0xf657('0x40')],_0x357f42[_0xf657('0x163')]||'',_0x357f42['dialAgiAfterHangupAgent']?'c':'',_0x357f42['dialQueueTimeout']||0x3):_0xf657('0x162'),'XMD-CONTACTID':_0x2e1124[_0xf657('0xd3')],'XMD-CDRTYPE':_0xf657('0x9'),'CALLERID(all)':_0x475edb[_0xf657('0x28')][_0x50b3c7][_0xf657('0x160')](),'XMD-AMD':_0x357f42[_0xf657('0xe5')]?_0xf657('0x164'):_0xf657('0x162'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x357f42['dialAMDActive']){_0x889ff0['XMD-AMDINITIALSILENCE']=_0x357f42[_0xf657('0x165')]||0x9c4;_0x889ff0[_0xf657('0x166')]=_0x357f42[_0xf657('0x167')]||0x5dc;_0x889ff0[_0xf657('0x168')]=_0x357f42[_0xf657('0x169')]||0x320;_0x889ff0[_0xf657('0x16a')]=_0x357f42[_0xf657('0x16b')]||0x1388;_0x889ff0['XMD-AMDMINWORDLENGTH']=_0x357f42['dialAMDMinWordLength']||0x64;_0x889ff0[_0xf657('0x16c')]=_0x357f42['dialAMDBetweenWordsSilence']||0x32;_0x889ff0[_0xf657('0x16d')]=_0x357f42[_0xf657('0x16e')]||0x3;_0x889ff0[_0xf657('0x16f')]=_0x357f42[_0xf657('0x170')]||0x100;_0x889ff0[_0xf657('0x171')]=_0x357f42[_0xf657('0x172')]||0x1388;}if(_0x357f42[_0xf657('0x4d')]==='outbound'){_0x889ff0[_0xf657('0x173')]=_0x2e1124[_0xf657('0xd6')];}else{_0x889ff0['XMD-CAMPAIGNID']=_0x2e1124[_0xf657('0xd7')];}for(var _0xda19f9 in _0x2e1124[_0xf657('0x15e')]){if(_0x2e1124[_0xf657('0x15e')][_0xf657('0x97')](_0xda19f9)){if(isNotNull(_0x2e1124[_0xf657('0x15e')][_0xda19f9])&&_0xda19f9!=='id'&&_0xda19f9!==_0xf657('0x174')&&_0xda19f9!=='createdAt'&&_0xda19f9!==_0xf657('0x175')){_0x889ff0[util[_0xf657('0x79')](_0xf657('0x176'),_0xf657('0x177'),_[_0xf657('0x178')](_0xda19f9))]=_0x2e1124[_0xf657('0x15e')][_0xda19f9];}}}var _0x3f0f7d=_0x475edb['isTrunkReachable'](_0x357f42[_0xf657('0x77')])?getCallerId(_0x357f42[_0xf657('0x77')][_0xf657('0x179')],_0x357f42[_0xf657('0x5c')],_0x357f42['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x357f42['dialOriginateCallerIdNumber'],_0x357f42[_0xf657('0x17a')]):_0x357f42[_0xf657('0x17b')]):getCallerId(_['isNil'](_0x357f42[_0xf657('0x13b')])?_0x357f42[_0xf657('0x77')][_0xf657('0x179')]:_0x357f42[_0xf657('0x13b')][_0xf657('0x179')],_0x357f42[_0xf657('0x5c')],_0x357f42[_0xf657('0x17a')]>0x0?getCallerIdRandom(_0x357f42[_0xf657('0x17b')],_0x357f42[_0xf657('0x17a')]):_0x357f42['dialOriginateCallerIdNumber']);if(_0x3f0f7d){_0x889ff0[_0xf657('0x17c')]=_0x475edb['actions'][_0x50b3c7][_0xf657('0x17d')]=extractCalleridName(_0x3f0f7d);_0x889ff0[_0xf657('0x17e')]=_0x475edb[_0xf657('0x28')][_0x50b3c7]['originatecalleridnum']=extractCalleridNumber(_0x3f0f7d);}return ami[_0xf657('0xae')]({'actionid':_0x50b3c7,'action':_0xf657('0x15c'),'channel':_0x475edb['isTrunkReachable'](_0x357f42[_0xf657('0x77')])?util[_0xf657('0x79')](_0xf657('0x17f'),_0x357f42[_0xf657('0x77')][_0xf657('0x40')],isNotNull(_0x357f42[_0xf657('0x5e')])?_0x357f42[_0xf657('0x5e')]['trim']()||'':'',_0x357f42[_0xf657('0x180')]>0x0?_0x2e1124[_0xf657('0x15e')]['phone'][_0xf657('0x181')](_0x357f42['dialCutDigit']):_0x2e1124[_0xf657('0x15e')]['phone']):util[_0xf657('0x79')](_0xf657('0x17f'),_['isNil'](_0x357f42[_0xf657('0x13b')])?_0x357f42[_0xf657('0x77')][_0xf657('0x40')]:_0x357f42['TrunkBackup'][_0xf657('0x40')],isNotNull(_0x357f42[_0xf657('0x5e')])?_0x357f42[_0xf657('0x5e')][_0xf657('0x182')]()||'':'',_0x357f42[_0xf657('0x180')]>0x0?_0x2e1124[_0xf657('0x15e')]['phone'][_0xf657('0x181')](_0x357f42[_0xf657('0x180')]):_0x2e1124[_0xf657('0x15e')][_0xf657('0x15f')]),'callerid':_0x3f0f7d,'Exten':_0xf657('0x183'),'Context':_0xf657('0x184'),'Priority':'1','variable':_0x889ff0,'timeout':(_0x357f42['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x50b3c7})[_0xf657('0xb9')](function(_0x50ec55){return _0xbb61d7(_0x50ec55);})[_0xf657('0xba')](function(_0x500e32){_0x357f42['outboundOriginateFailureCallsDay']+=0x1;var _0x39c966=new History(_0x475edb[_0xf657('0x28')][_0x50b3c7]);logger[_0xf657('0x94')](util[_0xf657('0x79')](_0xf657('0x185'),JSON[_0xf657('0x48')](_0x500e32)));_0x39c966['state']=0xe;_0x39c966[_0xf657('0xe8')]=_0xf657('0x186');_0x39c966[_0xf657('0xa7')]=moment()[_0xf657('0x79')](_0xf657('0x102'));_0x39c966[_0xf657('0xa6')]=_0x39c966[_0xf657('0xa7')];_0x475edb[_0xf657('0xca')](_0x39c966)[_0xf657('0xba')](loggerCatch(_0xf657('0x187')));_0x475edb[_0xf657('0xc8')](_0x39c966)[_0xf657('0xba')](loggerCatch('[originate][error]'))[_0xf657('0x22')](function(){delete _0x475edb[_0xf657('0x28')][_0x50b3c7];return _0x1403b0(msgResponse(_0xf657('0x15c'),_0xf657('0x47'),'originate\x20action\x20Error'));});});});};Dialer[_0xf657('0x20')][_0xf657('0x33')]=function(_0x399548){var _0x4232ae=this[_0xf657('0x28')][_0x399548[_0xf657('0x121')]];var _0x3bd0f2=this;if(_0x4232ae){delete this[_0xf657('0x28')][_0x399548['actionid']];_0x4232ae[_0xf657('0x108')]=moment()['format'](_0xf657('0x102'));var _0x1d219b=_0x4232ae[_0xf657('0x4d')]===_0xf657('0x78')?this[_0xf657('0xef')][_0x4232ae['queue']]:this[_0xf657('0x25')][_0x4232ae[_0xf657('0x188')]()];if(!this['isSuccess'](_0x399548['response'])){this['updateOriginated'](_0x1d219b);return this[_0xf657('0x189')](_0x4232ae,_0x1d219b,_0x399548)[_0xf657('0xb9')](function(_0x252815){})[_0xf657('0xba')](loggerCatch(_0xf657('0x18a')));}else{this[_0xf657('0xaa')][_0x399548[_0xf657('0xe0')]]=_0x4232ae;}}};Dialer['prototype']['checkRetriveMax']=function(_0x149faf,_0x4ffff3,_0x555f1a){var _0x3f68c5=new History(_0x4ffff3);if(_0x3f68c5['countbusyretry']+_0x3f68c5[_0xf657('0x18b')]+_0x3f68c5[_0xf657('0x18c')]+_0x3f68c5[_0xf657('0x18d')]+_0x3f68c5[_0xf657('0x10c')]+_0x3f68c5[_0xf657('0x11b')]+_0x3f68c5[_0xf657('0x18e')]+_0x3f68c5['countagentrejectretry']>=_0x555f1a[_0xf657('0x18f')]-0x1){return!![];}switch(_0x149faf){case 0x3:if(_0x3f68c5[_0xf657('0x18c')]>=_0x555f1a['dialNoAnswerMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnoanswerretry':_0x3f68c5[_0xf657('0x18c')]+=0x1,'scheduledat':moment()[_0xf657('0x10f')](_0x555f1a[_0xf657('0x190')],_0xf657('0x111'))[_0xf657('0x79')](_0xf657('0x102')),'ContactId':_0x3f68c5[_0xf657('0xd3')],'ListId':_0x3f68c5[_0xf657('0xd4')],'VoiceQueueId':_0x3f68c5[_0xf657('0xd6')]||undefined,'CampaignId':_0x3f68c5[_0xf657('0xd7')]||undefined})[_0xf657('0xba')](loggerCatch('[rescheduleContact][NoAnswer]'));}break;case 0x5:if(_0x3f68c5[_0xf657('0x191')]>=_0x555f1a[_0xf657('0x192')]-0x1){return!![];}else{this[_0xf657('0xc0')]({'active':![],'countbusyretry':_0x3f68c5[_0xf657('0x191')]+=0x1,'scheduledat':moment()[_0xf657('0x10f')](_0x555f1a[_0xf657('0x193')],_0xf657('0x111'))[_0xf657('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3f68c5[_0xf657('0xd3')],'ListId':_0x3f68c5['ListId'],'VoiceQueueId':_0x3f68c5[_0xf657('0xd6')]||undefined,'CampaignId':_0x3f68c5[_0xf657('0xd7')]||undefined})[_0xf657('0xba')](loggerCatch(_0xf657('0x194')));}break;case 0x8:if(_0x3f68c5['countcongestionretry']>=_0x555f1a[_0xf657('0x195')]-0x1){return!![];}else{this[_0xf657('0xc0')]({'active':![],'countcongestionretry':_0x3f68c5[_0xf657('0x18b')]+=0x1,'scheduledat':moment()[_0xf657('0x10f')](_0x555f1a['dialCongestionRetryFrequency'],_0xf657('0x111'))[_0xf657('0x79')](_0xf657('0x102')),'ContactId':_0x3f68c5[_0xf657('0xd3')],'ListId':_0x3f68c5[_0xf657('0xd4')],'VoiceQueueId':_0x3f68c5[_0xf657('0xd6')]||undefined,'CampaignId':_0x3f68c5[_0xf657('0xd7')]||undefined})[_0xf657('0xba')](loggerCatch(_0xf657('0x196')));}break;case 0x0:if(_0x3f68c5[_0xf657('0x18d')]>=_0x555f1a[_0xf657('0x197')]-0x1){return!![];}else{this[_0xf657('0xc0')]({'active':![],'countnosuchnumberretry':_0x3f68c5[_0xf657('0x18d')]+=0x1,'scheduledat':moment()['add'](_0x555f1a[_0xf657('0x198')],_0xf657('0x111'))[_0xf657('0x79')](_0xf657('0x102')),'ContactId':_0x3f68c5[_0xf657('0xd3')],'ListId':_0x3f68c5['ListId'],'VoiceQueueId':_0x3f68c5[_0xf657('0xd6')]||undefined,'CampaignId':_0x3f68c5['CampaignId']||undefined})[_0xf657('0xba')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x3f68c5[_0xf657('0x10c')]>=_0x555f1a[_0xf657('0x10d')]-0x1){return!![];}else{this[_0xf657('0xc0')]({'active':![],'countdropretry':_0x3f68c5[_0xf657('0x10c')]+=0x1,'scheduledat':moment()[_0xf657('0x10f')](_0x555f1a[_0xf657('0x110')],_0xf657('0x111'))['format'](_0xf657('0x102')),'ContactId':_0x3f68c5[_0xf657('0xd3')],'ListId':_0x3f68c5[_0xf657('0xd4')],'VoiceQueueId':_0x3f68c5[_0xf657('0xd6')]||undefined,'CampaignId':_0x3f68c5[_0xf657('0xd7')]||undefined})[_0xf657('0xba')](loggerCatch('[rescheduleContact][Drop]'));}break;case 0xb:if(_0x3f68c5[_0xf657('0x11b')]>=_0x555f1a[_0xf657('0x11c')]-0x1){return!![];}else{this[_0xf657('0xc0')]({'active':![],'countabandonedretry':_0x3f68c5['countabandonedretry']+=0x1,'scheduledat':moment()[_0xf657('0x10f')](_0x555f1a[_0xf657('0x11d')],_0xf657('0x111'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3f68c5[_0xf657('0xd3')],'ListId':_0x3f68c5['ListId'],'VoiceQueueId':_0x3f68c5['VoiceQueueId']||undefined,'CampaignId':_0x3f68c5[_0xf657('0xd7')]||undefined})[_0xf657('0xba')](loggerCatch(_0xf657('0x11e')));}break;case 0x13:if(_0x3f68c5[_0xf657('0x18e')]>=_0x555f1a[_0xf657('0x199')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countmachineretry':_0x3f68c5['countmachineretry']+=0x1,'scheduledat':moment()[_0xf657('0x10f')](_0x555f1a[_0xf657('0x19a')],'minutes')[_0xf657('0x79')](_0xf657('0x102')),'ContactId':_0x3f68c5[_0xf657('0xd3')],'ListId':_0x3f68c5['ListId'],'VoiceQueueId':_0x3f68c5[_0xf657('0xd6')]||undefined,'CampaignId':_0x3f68c5[_0xf657('0xd7')]||undefined})[_0xf657('0xba')](loggerCatch(_0xf657('0x19b')));}break;case 0x14:if(_0x3f68c5[_0xf657('0x19c')]>=_0x555f1a['dialAgentRejectMaxRetry']-0x1){return!![];}else{this[_0xf657('0xc0')]({'active':![],'countagentrejectretry':_0x3f68c5[_0xf657('0x19c')]+=0x1,'scheduledat':moment()[_0xf657('0x10f')](_0x555f1a[_0xf657('0x19d')],_0xf657('0x111'))[_0xf657('0x79')](_0xf657('0x102')),'ContactId':_0x3f68c5['ContactId'],'ListId':_0x3f68c5[_0xf657('0xd4')],'VoiceQueueId':_0x3f68c5[_0xf657('0xd6')]||undefined,'CampaignId':_0x3f68c5[_0xf657('0xd7')]||undefined})[_0xf657('0xba')](loggerCatch(_0xf657('0x19e')));}break;default:return!![];}};Dialer[_0xf657('0x20')][_0xf657('0x189')]=function(_0x191543,_0x228f9e,_0x4cf4c5){var _0x3e9de1=this;var _0x582b38=new History(_0x191543);return new BPromise(function(_0x15dcbb,_0x51e632){if(_['isUndefined'](_0x228f9e)&&_0xf657('0x15b')!==typeof _0x228f9e){return _0x51e632(msgResponse(_0xf657('0x19f'),_0xf657('0x140'),_0xf657('0x1a0')));}if(_[_0xf657('0x3c')](_0x4cf4c5)&&_0xf657('0x15b')!==typeof _0x4cf4c5){return _0x51e632(msgResponse(_0xf657('0x19f'),_0xf657('0x140'),_0xf657('0x1a1')));}switch(_0x4cf4c5['reason']){case'0':_0x228f9e['outboundNoSuchCallsDay']+=0x1;_0x582b38[_0xf657('0xa5')]=0x0;_0x582b38['statedesc']=_0xf657('0x1a2');_0x582b38[_0xf657('0x18d')]+=0x1;_0x582b38[_0xf657('0x1a3')]+=0x1;_0x3e9de1[_0xf657('0xca')](_0x582b38)[_0xf657('0xba')](loggerCatch(_0xf657('0x1a4')));if(_0x3e9de1['checkRetriveMax'](0x0,_0x191543,_0x228f9e)){if(_0x582b38[_0xf657('0x191')]+_0x582b38['countcongestionretry']+_0x582b38[_0xf657('0x18c')]+_0x582b38[_0xf657('0x18d')]+_0x582b38[_0xf657('0x10c')]+_0x582b38[_0xf657('0x11b')]+_0x582b38[_0xf657('0x18e')]+_0x582b38['countagentrejectretry']>=_0x228f9e[_0xf657('0x18f')]){_0x3e9de1['stateGlobal'](_0x582b38,_0x15dcbb,_0x51e632,_0xf657('0x1a5'));}else{_0x3e9de1[_0xf657('0x1a6')](_0x582b38,_0x15dcbb,_0x51e632,_0xf657('0x1a5'));}}break;case'3':_0x228f9e['outboundNoAnswerCallsDay']+=0x1;_0x582b38[_0xf657('0xa5')]=0x3;_0x582b38['statedesc']=_0xf657('0x1a7');_0x582b38[_0xf657('0x18c')]+=0x1;_0x582b38[_0xf657('0x1a3')]+=0x1;_0x3e9de1[_0xf657('0xca')](_0x582b38)[_0xf657('0xba')](loggerCatch(_0xf657('0x1a8')));if(_0x3e9de1[_0xf657('0x1a9')](0x3,_0x191543,_0x228f9e)){if(_0x582b38[_0xf657('0x18c')]>=_0x228f9e[_0xf657('0x1aa')]){_0x3e9de1['createStateFinal'](_0x582b38,_0x15dcbb,_0x51e632,_0xf657('0x1ab'));}else{_0x3e9de1['stateGlobal'](_0x582b38,_0x15dcbb,_0x51e632,_0xf657('0x1ab'));}}break;case'5':_0x228f9e[_0xf657('0x61')]+=0x1;_0x582b38[_0xf657('0xa5')]=0x5;_0x582b38[_0xf657('0xe8')]=_0xf657('0x1ac');_0x582b38['countbusyretry']+=0x1;_0x582b38[_0xf657('0x1a3')]+=0x1;_0x3e9de1[_0xf657('0xca')](_0x582b38)['catch'](loggerCatch(_0xf657('0x1ad')));if(_0x3e9de1['checkRetriveMax'](0x5,_0x191543,_0x228f9e)){if(_0x582b38[_0xf657('0x191')]>=_0x228f9e[_0xf657('0x192')]){_0x3e9de1[_0xf657('0x1a6')](_0x582b38,_0x15dcbb,_0x51e632,_0xf657('0x1ae'));}else{_0x3e9de1[_0xf657('0x1af')](_0x582b38,_0x15dcbb,_0x51e632,_0xf657('0x1ae'));}}break;case'8':_0x228f9e[_0xf657('0x62')]+=0x1;_0x582b38[_0xf657('0xa5')]=0x8;_0x582b38[_0xf657('0xe8')]=_0xf657('0x1b0');_0x582b38[_0xf657('0x18b')]+=0x1;_0x582b38[_0xf657('0x1a3')]+=0x1;_0x3e9de1[_0xf657('0xca')](_0x582b38)[_0xf657('0xba')](loggerCatch(_0xf657('0x1b1')));if(_0x3e9de1[_0xf657('0x1a9')](0x8,_0x191543,_0x228f9e)){if(_0x582b38[_0xf657('0x18b')]>=_0x228f9e['dialCongestionMaxRetry']){_0x3e9de1[_0xf657('0x1a6')](_0x582b38,_0x15dcbb,_0x51e632,_0xf657('0x1b2'));}else{_0x3e9de1[_0xf657('0x1af')](_0x582b38,_0x15dcbb,_0x51e632,_0xf657('0x1b2'));}}break;case'11':_0x228f9e[_0xf657('0x1b3')]+=0x1;_0x582b38[_0xf657('0xa5')]=0xb;_0x582b38[_0xf657('0xe8')]='Abandoned';_0x582b38[_0xf657('0x11b')]+=0x1;_0x582b38['countglobal']+=0x1;_0x3e9de1[_0xf657('0xca')](_0x582b38)['catch'](loggerCatch(_0xf657('0x11f')));if(_0x3e9de1[_0xf657('0x1a9')](0xb,_0x191543,_0x228f9e)){if(_0x582b38[_0xf657('0x11b')]>=_0x228f9e[_0xf657('0x11c')]){_0x3e9de1[_0xf657('0x1a6')](_0x582b38,_0x15dcbb,_0x51e632,_0xf657('0x1b4'));}else{_0x3e9de1[_0xf657('0x1af')](_0x582b38,_0x15dcbb,_0x51e632,_0xf657('0x1b4'));}}break;case'20':_0x228f9e[_0xf657('0x1b5')]+=0x1;_0x582b38['state']=0x14;_0x582b38[_0xf657('0xe8')]='AgentReject';_0x582b38['countagentrejectretry']+=0x1;_0x582b38['countglobal']+=0x1;_0x3e9de1['createHistory'](_0x582b38)[_0xf657('0xba')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x3e9de1['checkRetriveMax'](0x14,_0x191543,_0x228f9e)){if(_0x582b38[_0xf657('0x19c')]>=_0x228f9e[_0xf657('0x1b6')]){_0x3e9de1[_0xf657('0x1a6')](_0x582b38,_0x15dcbb,_0x51e632,_0xf657('0x1b7'));}else{_0x3e9de1[_0xf657('0x1af')](_0x582b38,_0x15dcbb,_0x51e632,_0xf657('0x1b7'));}}break;default:_0x228f9e['outboundUnknownCallsDay']+=0x1;_0x582b38['state']=0xc;_0x582b38[_0xf657('0xe8')]=_0x4cf4c5[_0xf657('0xfe')];_0x3e9de1['createHistory'](_0x582b38)[_0xf657('0xba')](loggerCatch(_0xf657('0x1b8')));if(_0x3e9de1['checkRetriveMax'](_0x4cf4c5[_0xf657('0xfe')],_0x191543,_0x228f9e)){if(_0x582b38[_0xf657('0x191')]+_0x582b38['countcongestionretry']+_0x582b38['countnoanswerretry']+_0x582b38[_0xf657('0x18d')]+_0x582b38[_0xf657('0x10c')]+_0x582b38[_0xf657('0x11b')]+_0x582b38[_0xf657('0x18e')]+_0x582b38[_0xf657('0x19c')]>=_0x228f9e[_0xf657('0x18f')]){_0x3e9de1[_0xf657('0x1af')](_0x582b38,_0x15dcbb,_0x51e632,_0x4cf4c5[_0xf657('0xfe')]);}else{_0x3e9de1[_0xf657('0x1a6')](_0x582b38,_0x15dcbb,_0x51e632,_0x4cf4c5[_0xf657('0xfe')]);}}}});};Dialer[_0xf657('0x20')][_0xf657('0x1af')]=function(_0x369eaa,_0x67867f,_0x5b9145,_0x465d05){var _0x479493=new Final(_0x369eaa);_0x479493[_0xf657('0xa5')]=0xf;_0x479493[_0xf657('0xe8')]=_0xf657('0x1b9');this[_0xf657('0x1a6')](_0x479493,_0x67867f,_0x5b9145,_0x465d05);};Dialer[_0xf657('0x20')][_0xf657('0x1a6')]=function(_0x72cc36,_0x3bbfe7,_0x1d56d6,_0x3dfc10){this[_0xf657('0xc8')](_0x72cc36)['then'](function(_0x10c744){return _0x3bbfe7(msgResponse(_0xf657('0x19f'),_0xf657('0xd9'),_0x3dfc10));})[_0xf657('0xba')](function(_0x255d9d){return _0x1d56d6(msgResponse('[moveContactManagedDialer][0]',_0xf657('0x140'),'contact\x20not\x20moved'));});};Dialer[_0xf657('0x20')]['predictive']=function(_0x286d07){var _0x5e3667=this;var _0x15ffa1=_0x286d07[_0xf657('0x1ba')]/0x64;var _0x5e13e9=_0x286d07[_0xf657('0x109')]/(_0x286d07[_0xf657('0x109')]+_0x286d07[_0xf657('0x5f')]);var _0x46ce48=Math[_0xf657('0x1bb')](_0x286d07['predictiveIntervalAvailable']*(_0x286d07[_0xf657('0x1bc')]/0x64));var _0x10a152=Math[_0xf657('0x1bb')](_0x286d07['predictiveIntervalAvailable']*(_0x286d07[_0xf657('0x1bd')]/0x64));var _0x3566e7=_0x286d07[_0xf657('0x51')]+_0x286d07['talking'];var _0x2128e9=Math['floor'](_0x286d07[_0xf657('0x74')]*_0x286d07[_0xf657('0x76')]*_0x286d07['predictiveIntervalHitRate']*_0x286d07[_0xf657('0x70')]);if(_[_0xf657('0x3c')](_0x286d07[_0xf657('0x2b')])){if(!_[_0xf657('0x3c')](_0x286d07[_0xf657('0x2a')])){_0x286d07[_0xf657('0x2a')]=undefined;loggerPredictive[_0xf657('0x94')]('[startMethodPredictive][StartProgressive]',_0xf657('0x1be'));}if(!_['isUndefined'](_0x286d07[_0xf657('0x8f')])){loggerPredictive['error'](_0xf657('0x1bf'),_0xf657('0x1c0'));clearInterval(_0x286d07[_0xf657('0x8f')]);_0x286d07[_0xf657('0x8f')]=undefined;}_0x286d07[_0xf657('0x2b')]=moment()[_0xf657('0x79')](_0xf657('0x102'));loggerPredictive[_0xf657('0x7c')](_0x286d07[_0xf657('0x40')],'collection\x20data\x20in\x20progressive\x20at',_0x286d07[_0xf657('0x2b')]);this[_0xf657('0x14e')](_0x286d07,0x1);}else if(ifInterval(_0x286d07[_0xf657('0x1c1')],_0x286d07['startProgressive'])){this[_0xf657('0x14e')](_0x286d07,0x1);loggerPredictiveCalls[_0xf657('0x7c')](_0xf657('0x1c2'),_0x286d07[_0xf657('0x2b')],_0x286d07['name']);_0x286d07[_0xf657('0x74')]=0x0;_0x286d07[_0xf657('0x6e')]=0x0;}else if(_0x15ffa1<_0x5e13e9&&_0x286d07['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x286d07);loggerPredictive[_0xf657('0x7c')](_0xf657('0x1c3'),_0xf657('0x1c4'),_0x5e13e9,_0xf657('0x2b'),_0x286d07['name']);}else if(_0x2128e9<_0x286d07[_0xf657('0x6e')]&&_0x286d07[_0xf657('0x1c5')]===_0xf657('0x1c6')){freeVariablesPredictive(_0x286d07);loggerPredictive[_0xf657('0x7c')](_0xf657('0x1c7'),'Max\x20Drop\x20',_0x2128e9,_0xf657('0x1c8'),_0x286d07['predictiveIntervalErlangCallsDroppedCalls'],_0xf657('0x2b'),_0x286d07[_0xf657('0x40')]);}else if(!ifInterval(_0x286d07[_0xf657('0x1c1')],_0x286d07[_0xf657('0x2b')])&&_[_0xf657('0x3c')](_0x286d07['startPredictive'])&&!_[_0xf657('0x3c')](_0x286d07['startProgressive'])){_0x286d07['startPredictive']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x286d07[_0xf657('0x40')],'started\x20in\x20predictive\x20at',_0x286d07['startPredictive']);this[_0xf657('0xbd')](_0x286d07[_0xf657('0x1c1')])[_0xf657('0xb9')](this['getDataPredictive'](_0x286d07))[_0xf657('0xb9')](mergeDataErlangB(_0x286d07))[_0xf657('0xb9')](this[_0xf657('0x1c9')](_0x286d07))[_0xf657('0xba')](loggerCatchPredictive(_0xf657('0x1ca'),_0x286d07));}else if(!ifInterval(_0x286d07[_0xf657('0x1c1')],_0x286d07[_0xf657('0x2a')])){_0x286d07[_0xf657('0x6e')]=0x0;_0x286d07[_0xf657('0x2a')]=moment()[_0xf657('0x79')](_0xf657('0x102'));loggerPredictive[_0xf657('0x7c')](_0x286d07[_0xf657('0x40')],_0xf657('0x1cb'),_0x286d07[_0xf657('0x2a')]);clearInterval(_0x286d07[_0xf657('0x8f')]);_0x286d07['handlePredictive']=undefined;this[_0xf657('0xbd')](_0x286d07[_0xf657('0x1c1')])[_0xf657('0xb9')](this['getDataPredictive'](_0x286d07))[_0xf657('0xb9')](mergeDataErlangB(_0x286d07))[_0xf657('0xb9')](this['startMethodPredictive'](_0x286d07))['catch'](loggerCatchPredictive(_0xf657('0x1cc'),_0x286d07));}else if(_0x286d07['predictiveIntervalAvailable']&&_0x3566e7<_0x286d07[_0xf657('0x71')]-_0x10a152){freeVariablesPredictive(_0x286d07);loggerPredictive[_0xf657('0x7c')](_0x286d07['name'],_0xf657('0x1cd'),_0x3566e7,')\x20are\x20less\x20than\x20threshold\x20(',_0x286d07[_0xf657('0x71')],'-',_0x10a152,'=',_0x286d07['predictiveIntervalAvailable']-_0x10a152,')');}else if(_0x286d07[_0xf657('0x71')]&&_0x3566e7>_0x286d07['predictiveIntervalAvailable']+_0x46ce48){freeVariablesPredictive(_0x286d07);loggerPredictive[_0xf657('0x7c')](_0x286d07[_0xf657('0x40')],_0xf657('0x1cd'),_0x3566e7,')\x20are\x20more\x20than\x20threshold\x20(',_0x286d07[_0xf657('0x71')],'+',_0x46ce48,'=',_0x286d07['predictiveIntervalAvailable']+_0x46ce48,')');}};Dialer[_0xf657('0x20')][_0xf657('0x1ce')]=function(_0xc00f43){var _0x1abed0=this;return function(_0x2fea0b){return new BPromise(function(_0x27fc9b,_0x13d7ba){_[_0xf657('0xd1')](_0xc00f43,_0x2fea0b[0x0]);if(checkGetDataPredictive(_0x2fea0b[0x0])){var _0x1f721f=_0xc00f43[_0xf657('0x71')]=_0xc00f43['talking']+_0xc00f43[_0xf657('0x51')];var _0x342d35=_0xc00f43[_0xf657('0x1c1')]*0x3c;var _0x1bbef1=_0x2fea0b[0x0]['predictiveIntervalAvgTalktime']+_0x2fea0b[0x0][_0xf657('0x69')];var _0x1f7c8f=(_0x2fea0b[0x0][_0xf657('0x68')]+_0x2fea0b[0x0][_0xf657('0x6c')]+_0x2fea0b[0x0][_0xf657('0x6b')])/_0x2fea0b[0x0][_0xf657('0x72')];_0xc00f43[_0xf657('0x6f')]=_0x1f7c8f>0x0?_0x1f7c8f:0x1;switch(_0xc00f43['dialPredictiveOptimization']){case'dropRate':var _0x57c067=_0xc00f43[_0xf657('0x1ba')]/0x64;return _0x1abed0[_0xf657('0x1cf')](_0x1f721f,_0x342d35,_0x1bbef1,_0x1f7c8f,_0x57c067)[_0xf657('0xb9')](function(_0x627e55){return _0x27fc9b(_0x627e55);});case _0xf657('0x1d0'):var _0x2f5d24=_0xc00f43[_0xf657('0x1ba')]/0x64;return _0x1abed0[_0xf657('0x1d1')](_0x1f721f,_0x342d35,_0x1bbef1,_0x1f7c8f,_0x2f5d24)[_0xf657('0xb9')](function(_0x4695f6){return _0x27fc9b(_0x4695f6);});default:return _0x13d7ba(msgResponse(_0xf657('0x1d2'),_0xf657('0x140'),_0xf657('0x1d3')));}}else{return _0x13d7ba(msgResponse(_0xf657('0x1d2'),_0xf657('0x140'),_0xf657('0x1d4')));}});};};Dialer[_0xf657('0x20')][_0xf657('0x1d5')]=function(_0x236ce6){var _0x2abd85=this;return function(_0x19c868){return new BPromise(function(_0x3327b1,_0x24cb03){_['merge'](_0x236ce6,_0x19c868[0x0]);if(checkGetDataPredictive(_0x19c868[0x0])){loggerPredictive[_0xf657('0x7c')](JSON[_0xf657('0x48')](_0x19c868[0x0]));if(_0x236ce6[_0xf657('0x1c5')]===_0xf657('0x1c6')){return _0x2abd85[_0xf657('0xc6')](_0x236ce6['id'])[_0xf657('0xb9')](function(_0x141537){var _0x5214d6=_0x236ce6[_0xf657('0x52')]-_0x141537[0x0][_0xf657('0x1d6')];var _0x16e2c8=_0x236ce6[_0xf657('0x1c1')]*0x3c;var _0x536793=_0x19c868[0x0][_0xf657('0x6a')]+_0x19c868[0x0]['predictiveIntervalAvgHoldtime'];var _0x518d7b=(_0x19c868[0x0][_0xf657('0x68')]+_0x19c868[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x19c868[0x0][_0xf657('0x6b')])/_0x19c868[0x0][_0xf657('0x72')];var _0x9ff8e1=_0x236ce6[_0xf657('0x1ba')]/0x64;_0x236ce6['predictiveIntervalPauses']=_0x141537[0x0][_0xf657('0x1d6')]||0x0;_0x236ce6['predictiveIntervalHitRate']=_0x518d7b>0x0?_0x518d7b:0x1;return _0x2abd85[_0xf657('0x1cf')](_0x5214d6,_0x16e2c8,_0x536793,_0x518d7b,_0x9ff8e1);})[_0xf657('0xb9')](function(_0x4ae0eb){return _0x3327b1(_0x4ae0eb);})['catch'](function(_0x1081a1){return _0x24cb03(msgResponse(_0xf657('0x1d7'),_0xf657('0x140'),JSON[_0xf657('0x48')](_0x1081a1)));});}if(_0x236ce6[_0xf657('0x1c5')]==='agentBusyFactor'){return _0x2abd85[_0xf657('0xc6')](_0x236ce6['id'])[_0xf657('0xb9')](function(_0x3e9614){var _0x3bbeb2=_0x236ce6[_0xf657('0x52')]-_0x3e9614[0x0]['outboundQueuePauses'];var _0x1bd9ad=_0x236ce6['dialPredictiveInterval']*0x3c;var _0x18f5ce=_0x19c868[0x0][_0xf657('0x6a')]+_0x19c868[0x0][_0xf657('0x69')];var _0x24a281=(_0x19c868[0x0]['predictiveIntervalAnsweredCalls']+_0x19c868[0x0][_0xf657('0x6c')]+_0x19c868[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x19c868[0x0][_0xf657('0x72')];var _0x20c9aa=_0x236ce6['dialPredictiveOptimizationPercentage']/0x64;_0x236ce6[_0xf657('0x1d8')]=_0x3e9614[0x0][_0xf657('0x1d6')]||0x0;_0x236ce6[_0xf657('0x6f')]=_0x24a281>0x0?_0x24a281:0x1;return _0x2abd85[_0xf657('0x1d1')](_0x3bbeb2,_0x1bd9ad,_0x18f5ce,_0x24a281,_0x20c9aa);})[_0xf657('0xb9')](function(_0xca84c){return _0x3327b1(_0xca84c);})[_0xf657('0xba')](function(_0x7e2fbb){return _0x24cb03(msgResponse(_0xf657('0x1d7'),_0xf657('0x140'),JSON[_0xf657('0x48')](_0x7e2fbb)));});}}else{return _0x24cb03(msgResponse(_0xf657('0x1d2'),'Failure',_0xf657('0x1d4')));}});};};Dialer[_0xf657('0x20')][_0xf657('0x1c9')]=function(_0x34fc96){var _0x413840=this;return function(){var _0x26967f=0x0;var _0x19db87=Math[_0xf657('0x1d9')](_0x34fc96[_0xf657('0x75')]*0x3e8);if(_0x19db87>0x0){_0x19db87=_0x19db87<0x64?0x64:_0x19db87;loggerPredictive[_0xf657('0x7c')](_0x34fc96[_0xf657('0x40')],_0xf657('0x1da'),_0x19db87,_0xf657('0x49'));_0x34fc96[_0xf657('0x8f')]=setInterval(function(){_0x413840['handlePredictive'](_0x34fc96);loggerPredictiveCalls['info']('[handlePredictive]',_0x26967f+=0x1);},_0x19db87);}else{loggerPredictive[_0xf657('0x7c')](_0x34fc96['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xf657('0x20')][_0xf657('0x1db')]=function(_0x35b3e6,_0x37d206){var _0x353f57=this;return function(_0x4a0c2b){if(_[_0xf657('0x46')](_0x4a0c2b)){if(_[_0xf657('0xe1')](_0x37d206['UserId'])||!_0x37d206[_0xf657('0x1dc')]){if(_0x35b3e6[_0xf657('0x5b')]===_0xf657('0xa')){_0x35b3e6[_0xf657('0x127')]=_[_0xf657('0x3c')](_0x35b3e6[_0xf657('0x127')])?!![]:_0x35b3e6[_0xf657('0x127')];var _0x329476=uuid['v4']();_0x353f57['actions'][_0x329476]=new Action(_0x35b3e6,_0x37d206,_0x329476);loggerBooked['info']('[booked][checkContactBlack]',_0x329476,'queueStatusComplete:\x20',JSON[_0xf657('0x48')](_0x35b3e6['queueStatusComplete']),_0xf657('0x1dd'),_0x35b3e6[_0xf657('0x40')]);if(_0x35b3e6[_0xf657('0x127')]){_0x35b3e6[_0xf657('0x127')]=![];_0x353f57[_0xf657('0x2d')][_0x353f57[_0xf657('0x28')][_0x329476][_0xf657('0xb4')]]=[];ami[_0xf657('0xae')]({'actionid':_0x329476,'action':_0xf657('0x1de'),'queue':_0x35b3e6['name']})[_0xf657('0xba')](function(_0x427e42){_0x353f57[_0xf657('0xb2')](_0x35b3e6);_0x353f57[_0xf657('0xc0')]({'active':![],'ContactId':_0x353f57[_0xf657('0x28')][_0x329476][_0xf657('0xd3')],'ListId':_0x353f57[_0xf657('0x28')][_0x329476][_0xf657('0xd4')],'VoiceQueueId':_0x353f57[_0xf657('0x28')][_0x329476]['VoiceQueueId']||undefined,'CampaignId':_0x353f57[_0xf657('0x28')][_0x329476][_0xf657('0xd7')]||undefined})[_0xf657('0xba')](loggerCatch(_0xf657('0x1df')));delete _0x353f57[_0xf657('0x28')][_0x329476];});}else{loggerBooked[_0xf657('0x7c')](_0xf657('0x1e0'),JSON[_0xf657('0x48')](_0x35b3e6[_0xf657('0x127')]),_0xf657('0x1dd'),_0x35b3e6['name']);_0x353f57['updateOriginated'](_0x35b3e6);_0x353f57['rescheduleContact']({'active':![],'ContactId':_0x353f57[_0xf657('0x28')][_0x329476][_0xf657('0xd3')],'ListId':_0x353f57[_0xf657('0x28')][_0x329476][_0xf657('0xd4')],'VoiceQueueId':_0x353f57[_0xf657('0x28')][_0x329476][_0xf657('0xd6')]||undefined,'CampaignId':_0x353f57[_0xf657('0x28')][_0x329476]['CampaignId']||undefined})[_0xf657('0xba')](loggerCatch(_0xf657('0x1df')));delete _0x353f57[_0xf657('0x28')][_0x329476];}}else{return _0x353f57['actionOriginate'](_0x35b3e6,_0x37d206);}}else{if(getDiff(_0x37d206['scheduledat'])<_0x35b3e6[_0xf657('0x1e1')]*0x3c){if(_0x37d206[_0xf657('0x1e2')]&&!_0x37d206[_0xf657('0x1e2')][_0xf657('0x1e3')]){_0x353f57['preview'][_0xf657('0x132')](_0x37d206['id'])[_0xf657('0x22')](function(){_0x353f57['updateOriginated'](_0x35b3e6);});}else{_0x353f57['unlockContact']({'active':![]},_0x37d206['id'],0x1)['finally'](function(){console[_0xf657('0x113')](_0xf657('0x1e4'));_0x353f57['updateOriginated'](_0x35b3e6);});}}else{_0x35b3e6[_0xf657('0x67')]+=0x1;_0x353f57['updateOriginated'](_0x35b3e6);if(_0x35b3e6[_0xf657('0x1e5')]){_0x353f57[_0xf657('0xc0')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x37d206[_0xf657('0xd3')],'ListId':_0x37d206['ListId'],'VoiceQueueId':_0x37d206['VoiceQueueId']||undefined,'CampaignId':_0x37d206['CampaignId']||undefined})[_0xf657('0xba')](loggerCatch(_0xf657('0x1e6')));_0x353f57[_0xf657('0xca')](createObjHistory(_0x35b3e6,_0x37d206,_0xf657('0x1e7'),0x17,_0xf657('0x1e8')))[_0xf657('0xba')](loggerCatch(_0xf657('0x1e9')));}else{_0x353f57[_0xf657('0xdf')](createObjHistory(_0x35b3e6,_0x37d206,_0xf657('0x1ea'),0x16,'RecallFailedTimeout'),_0xf657('0x1eb'),_0xf657('0x1ec'));}}}}else{_0x35b3e6[_0xf657('0x60')]+=0x1;_0x353f57[_0xf657('0xdf')](createObjHistory(_0x35b3e6,_0x37d206,_0xf657('0x1ed'),0xd,'Blacklist'),_0xf657('0x1ee'),_0xf657('0x1ef'));throw'inBlackList';}};};Dialer[_0xf657('0x20')][_0xf657('0x1f0')]=function(_0x1d7292){var _0x13410d=this;var _0xf80882=[];var _0x247112=_0x1d7292[_0xf657('0x1f1')]-_0x1d7292[_0xf657('0x73')]-_0x1d7292[_0xf657('0x1f2')];emitCampaignSummary(_0x1d7292);if(_0x247112>0x0){if(_0x247112>this[_0xf657('0x27')]){_0x247112=this[_0xf657('0x27')];}_0x1d7292['temp']+=_0x247112;this[_0xf657('0xc5')](_0x1d7292['id'],_0x247112,_0x1d7292[_0xf657('0x1f3')])[_0xf657('0xb9')](function(_0x185058){_0x1d7292['temp']-=_0x247112;_0x1d7292[_0xf657('0x1f2')]=_0x1d7292['temp']>0x0?_0x1d7292[_0xf657('0x1f2')]:0x0;if(!checkContactEmpty(_0x185058)){_0x1d7292[_0xf657('0x3d')]=_0xf657('0x1f4');logger[_0xf657('0x7c')](_0xf657('0x1f5')+_0x1d7292[_0xf657('0x40')]);}else{_0x1d7292[_0xf657('0x73')]+=_0x185058[_0xf657('0x96')];_0x1d7292[_0xf657('0x3d')]=_0xf657('0x1f6');for(var _0x452fce=0x0;_0x452fce<_0x185058['length'];_0x452fce+=0x1){_0x1d7292[_0xf657('0x1f7')]+=0x1;if(_['isNil'](_0x185058[_0x452fce])||_['isNil'](_0x185058[_0x452fce]['Contact'])||_['isNil'](_0x185058[_0x452fce][_0xf657('0x15e')]['phone'])){_0x13410d[_0xf657('0xcf')]('[actionOriginate]\x20',_0x1d7292,_0x185058[_0x452fce]);}else{_0x13410d[_0xf657('0xbb')](_[_0xf657('0xd2')](_0x185058[_0x452fce],['CampaignId',_0xf657('0x1f8')]))[_0xf657('0xb9')](_0x13410d[_0xf657('0x1db')](_0x1d7292,_0x185058[_0x452fce]))[_0xf657('0xba')](_0x13410d[_0xf657('0xce')]('[actionOriginateIvr]\x20',_0x1d7292));}}}})[_0xf657('0xba')](loggerGetContactDialer(_0xf657('0x1f9'),_0x1d7292,_0x247112));}};Dialer[_0xf657('0x20')][_0xf657('0x14e')]=function(_0x130984,_0x548c34){var _0x20b58f=this;var _0x2a1bef=[];var _0x7fe1f6=_0x548c34>=0x1?_0x548c34:0x1;var _0x19fac4=[];if(_0x130984[_0xf657('0x5b')]===_0xf657('0xa')){_0x7fe1f6=0x1;}var _0x2caf25=Math[_0xf657('0x1d9')](_0x130984['available']*_0x7fe1f6)-_0x130984[_0xf657('0x73')]-_0x130984[_0xf657('0x1f2')];emitVoiceQueueSummary(_0x130984);if(_0x130984[_0xf657('0x1fa')]>0x0){var _0x275279=_0x130984[_0xf657('0x1fa')]-_0x130984[_0xf657('0x73')]-_0x130984[_0xf657('0x56')]-_0x130984[_0xf657('0x1f2')]-_0x130984['pTalking'];if(_0x2caf25>_0x275279){_0x2caf25=_0x275279;}}if(_0x2caf25>0x0){if(_0x130984[_0xf657('0x5b')]===_0xf657('0xa')){_0x2caf25=0x1;}if(_0x2caf25>this[_0xf657('0x27')]){_0x2caf25=this[_0xf657('0x27')];}_0x130984[_0xf657('0x1f2')]+=_0x2caf25;for(var _0x423582 in this[_0xf657('0x26')]){if(this[_0xf657('0x26')][_0xf657('0x97')](_0x423582)){if(this['agents'][_0x423582][_0xf657('0xa5')]===_0xf657('0x1fb')&&this[_0xf657('0x26')][_0x423582]['status']===_0xf657('0xdd')){_0x2a1bef[_0xf657('0x125')](this[_0xf657('0x26')][_0x423582]['id']);}}}this[_0xf657('0xc3')](_0x130984['id'],_0x2a1bef,_0x2caf25,_0x130984[_0xf657('0x1f3')])['then'](function(_0x209907){_0x130984[_0xf657('0x1f2')]-=_0x2caf25;_0x130984[_0xf657('0x1f2')]=_0x130984[_0xf657('0x1f2')]>0x0?_0x130984['temp']:0x0;if(!checkContactEmpty(_0x209907)){_0x20b58f['countReScheduled'](_0x130984)['then'](sendMessageReschedule(_0x130984))[_0xf657('0xba')](loggerCatch('[countReScheduled]\x20'));}else{_0x130984[_0xf657('0x73')]+=_0x209907[_0xf657('0x96')];_0x130984['message']=_0x130984[_0xf657('0x5b')]==='booked'?'ACTIVE':_0xf657('0x1f6');for(var _0x5c9f22=0x0;_0x5c9f22<_0x209907[_0xf657('0x96')];_0x5c9f22+=0x1){if(_[_0xf657('0xe1')](_0x209907[_0x5c9f22])||_['isNil'](_0x209907[_0x5c9f22]['Contact'])||_[_0xf657('0xe1')](_0x209907[_0x5c9f22]['Contact'][_0xf657('0x15f')])){_0x20b58f[_0xf657('0xcf')]('[actionOriginate]\x20',_0x130984,_0x209907[_0x5c9f22]);}else{_0x20b58f[_0xf657('0xb8')](_[_0xf657('0xd2')](_0x209907[_0x5c9f22],['VoiceQueueId',_0xf657('0x1f8')]))[_0xf657('0xb9')](_0x20b58f[_0xf657('0x1db')](_0x130984,_0x209907[_0x5c9f22]))[_0xf657('0xba')](_0x20b58f['loggerHandler']('[actionOriginate]\x20',_0x130984));}}}})[_0xf657('0xba')](loggerGetContactDialer(_0xf657('0x1fc'),_0x130984,_0x2caf25));}};Dialer['prototype'][_0xf657('0x8f')]=function(_0x16622c){var _0x497473=this;if(_0x16622c[_0xf657('0x1fa')]>0x0){var _0x2f40fc=_0x16622c[_0xf657('0x1fa')]-_0x16622c[_0xf657('0x73')]-_0x16622c[_0xf657('0x56')];if(_0x2f40fc>0x0){this[_0xf657('0x1fd')](_0x16622c);}else{loggerPredictiveCalls[_0xf657('0x7c')](_0xf657('0x1fe'));}}else{this[_0xf657('0x1fd')](_0x16622c);}};Dialer[_0xf657('0x20')][_0xf657('0x1fd')]=function(_0x3a0498){var _0x1255f4=this;var _0x562071=[];_0x3a0498['originated']+=0x1;for(var _0x352193 in this[_0xf657('0x26')]){if(this['agents']['hasOwnProperty'](_0x352193)){if(this[_0xf657('0x26')][_0x352193][_0xf657('0xa5')]===_0xf657('0x1fb')&&this[_0xf657('0x26')][_0x352193][_0xf657('0xaf')]==='reachable'){_0x562071['push'](this['agents'][_0x352193]['id']);}}}this[_0xf657('0xc3')](_0x3a0498['id'],_0x562071,0x1,_0x3a0498[_0xf657('0x1f3')])[_0xf657('0xb9')](function(_0x5ade1e){if(!checkContactEmpty(_0x5ade1e)){checkContactLowerLimitOriginate(_0x3a0498,0x1,0x0);_0x1255f4['countReScheduled'](_0x3a0498)[_0xf657('0xb9')](sendMessageReschedule(_0x3a0498))[_0xf657('0xba')](loggerCatch(_0xf657('0x1ff')));}else{_0x3a0498[_0xf657('0x3d')]=_0xf657('0x1f6');if(_[_0xf657('0xe1')](_0x5ade1e[0x0])||_[_0xf657('0xe1')](_0x5ade1e[0x0]['Contact'])||_[_0xf657('0xe1')](_0x5ade1e[0x0]['Contact'][_0xf657('0x15f')])){_0x1255f4[_0xf657('0xcf')]('[actionOriginate]\x20',_0x3a0498,_0x5ade1e[0x0]);}else{_0x1255f4[_0xf657('0xb8')](_[_0xf657('0xd2')](_0x5ade1e[0x0],[_0xf657('0xd6'),_0xf657('0x1f8')]))[_0xf657('0xb9')](_0x1255f4[_0xf657('0x1db')](_0x3a0498,_0x5ade1e[0x0]))['catch'](_0x1255f4[_0xf657('0xce')](_0xf657('0x200'),_0x3a0498));}}})[_0xf657('0xba')](loggerGetContactDialer(_0xf657('0x201'),_0x3a0498,0x1));emitVoiceQueueSummary(_0x3a0498);};Dialer[_0xf657('0x20')][_0xf657('0x1cf')]=function(_0x3bb120,_0x24a3b9,_0x361055,_0x21dbbb,_0x71caf3,_0x574c40){loggerPredictive[_0xf657('0x7c')](_0xf657('0x202'));loggerPredictive[_0xf657('0x7c')](_0xf657('0x203'),_0x3bb120);loggerPredictive['info'](_0xf657('0x204'),_0x24a3b9);loggerPredictive[_0xf657('0x7c')](_0xf657('0x205'),_0x361055);loggerPredictive[_0xf657('0x7c')](_0xf657('0x206'),_0x21dbbb);loggerPredictive['info'](_0xf657('0x207'),_0x71caf3);loggerPredictive[_0xf657('0x7c')](_0xf657('0x8c'));return new BPromise(function(_0x41537d,_0x18b23c){if(_0x3bb120<=0x0||isNaN(_0x3bb120)){return _0x18b23c(msgResponse(_0xf657('0x208'),_0xf657('0x47'),_0xf657('0x209')+_0x3bb120));}if(_0x361055<=0x0||isNaN(_0x361055)){return _0x18b23c(msgResponse(_0xf657('0x208'),_0xf657('0x47'),_0xf657('0x20a')+_0x361055));}if(_0x21dbbb<=0x0||isNaN(_0x21dbbb)){return _0x18b23c(msgResponse('[abandonmentRate]',_0xf657('0x47'),_0xf657('0x20b')+_0x21dbbb));}if(_0x24a3b9<=0x0||isNaN(_0x24a3b9)){return _0x18b23c(msgResponse(_0xf657('0x208'),'Error','interval\x20=\x20'+_0x24a3b9));}if(_0x71caf3<=0x0||isNaN(_0x71caf3)){return _0x18b23c(msgResponse(_0xf657('0x208'),_0xf657('0x47'),_0xf657('0x20c')+_0x71caf3));}_0x574c40=_0x574c40||0x0;var _0x960595=0x1/_0x361055;var _0x4f1e38=0x0;var _0x321586=0x0;var _0x26be8a=0x0;var _0x2c68dd=0x0;for(var _0x218c15=0x0;_0x26be8a<_0x71caf3;_0x218c15+=0x1){_0x321586=_0x218c15/_0x24a3b9;_0x4f1e38=(_0x21dbbb*_0x321586+_0x574c40)/_0x960595;_0x26be8a=erlangb(_0x4f1e38,_0x3bb120);_0x2c68dd=_0x4f1e38/_0x3bb120*(0x1-erlangb(_0x4f1e38,_0x3bb120));}return _0x41537d({'erlangCalls':_0x218c15,'erlangCallToSecond':_0x24a3b9/_0x218c15,'erlangAbandonmentRate':_0x26be8a,'erlangBusyFactor':_0x2c68dd});});};Dialer['prototype'][_0xf657('0x1d1')]=function(_0x5f4a1b,_0x22f5b1,_0x2ab80f,_0x3378c1,_0x460bb2,_0x26c614){loggerPredictive['info'](_0xf657('0x20d'));loggerPredictive[_0xf657('0x7c')](_0xf657('0x203'),_0x5f4a1b);loggerPredictive['info'](_0xf657('0x204'),_0x22f5b1);loggerPredictive[_0xf657('0x7c')](_0xf657('0x205'),_0x2ab80f);loggerPredictive[_0xf657('0x7c')]('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',_0x3378c1);loggerPredictive['info']('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x460bb2);loggerPredictive[_0xf657('0x7c')](_0xf657('0x8c'));return new BPromise(function(_0x57627b,_0x578ec2){if(_0x5f4a1b<=0x0||isNaN(_0x5f4a1b)){return _0x578ec2(msgResponse('[busyFactor]',_0xf657('0x47'),_0xf657('0x209')+_0x5f4a1b));}if(_0x2ab80f<=0x0||isNaN(_0x2ab80f)){return _0x578ec2(msgResponse(_0xf657('0x20e'),'Error',_0xf657('0x20a')+_0x2ab80f));}if(_0x3378c1<=0x0||isNaN(_0x3378c1)){return _0x578ec2(msgResponse(_0xf657('0x20e'),_0xf657('0x47'),_0xf657('0x20b')+_0x3378c1));}if(_0x22f5b1<=0x0||isNaN(_0x22f5b1)){return _0x578ec2(msgResponse(_0xf657('0x20e'),'Error',_0xf657('0x20f')+_0x22f5b1));}if(_0x460bb2<=0x0||isNaN(_0x460bb2)){return _0x578ec2(msgResponse('[busyFactor]','Error',_0xf657('0x210')+_0x460bb2));}_0x26c614=_0x26c614||0x0;var _0x1d4f46=0x1/_0x2ab80f;var _0x48f6a4=0x0;var _0x24a8df=0x0;var _0x131ef2=0x0;var _0x41bb9f=0x0;for(var _0x24dd7c=0x0;_0x41bb9f<_0x460bb2;_0x24dd7c+=0x1){_0x24a8df=_0x24dd7c/_0x22f5b1;_0x48f6a4=(_0x3378c1*_0x24a8df+_0x26c614)/_0x1d4f46;_0x131ef2=erlangb(_0x48f6a4,_0x5f4a1b);_0x41bb9f=_0x48f6a4/_0x5f4a1b*(0x1-erlangb(_0x48f6a4,_0x5f4a1b));}return _0x57627b({'erlangCalls':_0x24dd7c,'erlangCallToSecond':_0x22f5b1/_0x24dd7c,'erlangAbandonmentRate':_0x131ef2,'erlangBusyFactor':_0x41bb9f});});};module[_0xf657('0x211')]=Dialer; \ No newline at end of file +var _0xf61e=['Trunk','callerid','stringify','format','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','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---------','erlangCalls','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\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','endtime','starttime','[uniqueid]','clearZombieChannels','hasOwnProperty','sequence','isNil','Action','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','Success','active','SIP/%s','status','reachable','moveContactManagedDialer','uniqueid','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','statedesc','membername','[syncHangupInAMD]','MACHINE','state','Machine','AMD','amd','[syncMachine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncMachineIvr][createHistory]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','agent','agiafterat','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','Drop','dropreason','TIMEOUT','countdropretry','dialDropMaxRetry','add','dialDropRetryFrequency','minutes','[rescheduleContact][Drop]','calleridname','calleridnum','CRIS\x20evt\x2010','log','CRIS\x20queueCallerAbandon\x2010','Abandoned','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','CRIS\x20createHistory\x2011','[syncAgentComplete][createHistory][11]','channel','actionid','locked','paused','stateinterface','queueBooked','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','INTERVAL_IS_EMPTY','timezones','\x20Timezone\x20unknow\x20','isArray','indexOf','true','command','iftime\x20%s,%s','content','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Timezone:\x20','checkDialMethod','dialMethod','progressive','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialTimezone','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','Contact','phone','contact\x20is\x20undefine','getCaller','NONE','dialQueueProject2','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-CAMPAIGNID','createdAt','toUpper','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','responsetime','getQueue','response','callProgressDetecting','checkRetriveMax','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','countmachineretry','dialMachineMaxRetry','dialMachineRetryFrequency','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','[callProgressDetecting]','NoSuchNumber','countglobal','[syncAgentComplete][createHistory][0]','reason\x200\x20no\x20such\x20number....','createStateFinal','NoAnswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','stateGlobal','Busy','reason\x205\x20busy','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','reason\x2020\x20agentreject','reason','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','busyFactor','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','temp','[getContactCampaign2][Empty]','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','RUNNING','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','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','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','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment/','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','env','127.0.0.1','rrmemory','roundrobin','prototype','tail','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBookedRR','syncAgentConnect','syncQueueCallerAbandon','syncOriginateResponse','bind','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','name','\x20AGENTS\x20NOT\x20LOGGED','message','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','milliseconds','diff','seconds','emit','outbound','strategy','available','loggedIn','pTalking','sumBillable','talking','total','type','abandoned','waiting','loggedInDb','dialActive','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate'];(function(_0x2d34c2,_0x20843a){var _0x507ae8=function(_0x2d0b81){while(--_0x2d0b81){_0x2d34c2['push'](_0x2d34c2['shift']());}};_0x507ae8(++_0x20843a);}(_0xf61e,0x191));var _0xef61=function(_0x32fcb2,_0x28d778){_0x32fcb2=_0x32fcb2-0x0;var _0x5ca978=_0xf61e[_0x32fcb2];return _0x5ca978;};'use strict';var util=require(_0xef61('0x0'));var _=require(_0xef61('0x1'));var BPromise=require(_0xef61('0x2'));var uuid=require(_0xef61('0x3'));var moment=require(_0xef61('0x4'));var rr=require('rr');var md5=require(_0xef61('0x5'));var Redis=require(_0xef61('0x6'));var config=require(_0xef61('0x7'));var logger=require(_0xef61('0x8'))(_0xef61('0x9'));var loggerBooked=require(_0xef61('0x8'))(_0xef61('0xa'));var loggerPredictive=require('../../../config/logger')(_0xef61('0xb'));var loggerPredictiveCalls=require(_0xef61('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xef61('0x8'))(_0xef61('0xc'));var ami=require(_0xef61('0xd'));config['redis']=_['defaults'](config[_0xef61('0xe')],{'host':_0xef61('0xf'),'port':0x18eb});var io=require(_0xef61('0x10'))(new Redis(config[_0xef61('0xe')]));var cmHopper=require(_0xef61('0x11'));var cmHopperFinal=require(_0xef61('0x12'));var cmHopperHistory=require(_0xef61('0x13'));var cmHopperBlack=require(_0xef61('0x14'));var voiceQueueRt=require(_0xef61('0x15'));var Action=require(_0xef61('0x16'));var History=require(_0xef61('0x17'));var Final=require(_0xef61('0x18'));var AgentComplete=require(_0xef61('0x19'));var QueueCallerAbandon=require(_0xef61('0x1a'));var Hangup=require('./hangup');var ipAgi=process[_0xef61('0x1b')]['XCALLY_IP_AGI']||_0xef61('0x1c');var strategy={'rrmemory':_0xef61('0x1d'),'roundrobin':_0xef61('0x1e')};var Sequence=function(){};Sequence[_0xef61('0x1f')]['enqueue']=function(_0x2ac1b2){this[_0xef61('0x20')]=this[_0xef61('0x20')]?this[_0xef61('0x20')]['finally'](_0x2ac1b2):_0x2ac1b2();};function Dialer(_0x66fa62,_0xbe23a7){this['sequence']=new Sequence();this[_0xef61('0x21')]=_0xbe23a7;this[_0xef61('0x22')]=_0x66fa62[_0xef61('0x22')];this[_0xef61('0x23')]=_0x66fa62[_0xef61('0x23')];this[_0xef61('0x24')]=_0x66fa62[_0xef61('0x24')];this['trunks']=_0x66fa62[_0xef61('0x25')];this[_0xef61('0x26')]=config['maxNumberOriginate']||0x2;this[_0xef61('0x27')]={};this[_0xef61('0x28')]={};this[_0xef61('0x29')]={};this[_0xef61('0x2a')]={};this[_0xef61('0x2b')]={};this[_0xef61('0x2c')]={};this[_0xef61('0x2d')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0xef61('0x2e')]={};ami['on']('agentconnect',this[_0xef61('0x2f')]['bind'](this));ami['on']('queuecallerabandon',this[_0xef61('0x30')]['bind'](this));ami['on']('originateresponse',this[_0xef61('0x31')][_0xef61('0x32')](this));ami['on'](_0xef61('0x33'),this[_0xef61('0x34')]['bind'](this));ami['on'](_0xef61('0x35'),this['syncQueueSummary'][_0xef61('0x32')](this));ami['on'](_0xef61('0x36'),this[_0xef61('0x37')][_0xef61('0x32')](this));ami['on'](_0xef61('0x38'),this[_0xef61('0x39')][_0xef61('0x32')](this));ami['on'](_0xef61('0x3a'),this[_0xef61('0x3b')][_0xef61('0x32')](this));ami['on'](_0xef61('0x3c'),this[_0xef61('0x3d')][_0xef61('0x32')](this));ami['on'](_0xef61('0x3e'),this[_0xef61('0x3f')][_0xef61('0x32')](this));this[_0xef61('0x40')]();this[_0xef61('0x41')]();}function isNotNull(_0x587e26){return _0x587e26!==null&&!_[_0xef61('0x42')](_0x587e26);}function checkIsLoggedIn(_0x43bc47,_0x53fa3b){return function(){if(_0x53fa3b<=0x0){_0x43bc47['message']='AGENTS_NOT_LOGGED';throw _0x43bc47[_0xef61('0x43')]+_0xef61('0x44');}};}function isActive(_0x122176){return _0x122176;}function checkIsActive(_0x554ef4,_0x2bd5b3){return function(){if(!isActive(_0x2bd5b3)){_0x554ef4[_0xef61('0x45')]='NOT_ACTIVE';throw _0x554ef4[_0xef61('0x43')]+'\x20NOT\x20Active';}};}function checkInterval(_0x4c7fd3){return function(){if(!isNotNull(_0x4c7fd3[_0xef61('0x46')])){_0x4c7fd3['message']=_0xef61('0x47');throw _0x4c7fd3['name']+_0xef61('0x48');}if(!isNotNull(_0x4c7fd3[_0xef61('0x46')][_0xef61('0x49')])){_0x4c7fd3[_0xef61('0x45')]=_0xef61('0x47');throw _0x4c7fd3[_0xef61('0x43')]+_0xef61('0x48');}if(!isNotNull(_[_0xef61('0x4a')](_0x4c7fd3[_0xef61('0x46')][_0xef61('0x49')]))){_0x4c7fd3['message']=_0xef61('0x47');throw _0x4c7fd3[_0xef61('0x43')]+_0xef61('0x48');}};}function msgResponse(_0x1c1760,_0x310954,_0x534935){return{'action':_0x1c1760,'response':_0x310954,'message':_0x534935,'stack':_0x534935};}function myreject(_0x1c38dc){return function(_0x3b7373){return _0x1c38dc(msgResponse(_0xef61('0x4b'),'Error',JSON['stringify'](_0x3b7373)));};}function getSeconds(_0x509cbc,_0x1bd9af){var _0x595a5a=moment(_0x509cbc)['milliseconds'](0x0);var _0x58197a=moment(_0x1bd9af)[_0xef61('0x4c')](0x0);return _0x595a5a[_0xef61('0x4d')](_0x58197a,_0xef61('0x4e'));}function emit(_0x508dc7,_0x53c9ef,_0x4afb2c){io['to'](_0x508dc7)[_0xef61('0x4f')](_0x53c9ef,_0x4afb2c);}function emitVoiceQueueSummary(_0x32ad44){if(_0x32ad44['type']===_0xef61('0x50')){var _0x12f442={'id':_0x32ad44['id'],'name':_0x32ad44[_0xef61('0x43')],'strategy':_0x32ad44[_0xef61('0x51')],'answered':_0x32ad44['answered'],'available':_0x32ad44[_0xef61('0x52')],'loggedIn':_0x32ad44[_0xef61('0x53')],'pTalking':_0x32ad44[_0xef61('0x54')],'sumBillable':_0x32ad44[_0xef61('0x55')],'sumDuration':_0x32ad44['sumDuration'],'sumHoldTime':_0x32ad44['sumHoldTime']||0x0,'talking':_0x32ad44[_0xef61('0x56')],'total':_0x32ad44[_0xef61('0x57')],'type':_0x32ad44[_0xef61('0x58')],'unmanaged':_0x32ad44['unmanaged'],'abandoned':_0x32ad44[_0xef61('0x59')],'waiting':_0x32ad44[_0xef61('0x5a')],'loggedInDb':_0x32ad44[_0xef61('0x5b')],'dialActive':_0x32ad44[_0xef61('0x5c')],'dialMethod':_0x32ad44['dialMethod'],'dialOriginateCallerIdName':_0x32ad44['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x32ad44['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x32ad44[_0xef61('0x5d')],'dialPrefix':_0x32ad44[_0xef61('0x5e')],'outboundAnswerAgiCallsDay':_0x32ad44[_0xef61('0x5f')],'outboundAnswerCallsDay':_0x32ad44[_0xef61('0x60')],'outboundBlacklistCallsDay':_0x32ad44[_0xef61('0x61')],'outboundBusyCallsDay':_0x32ad44[_0xef61('0x62')],'outboundCongestionCallsDay':_0x32ad44[_0xef61('0x63')],'outboundDropCallsDayACS':_0x32ad44['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x32ad44[_0xef61('0x64')],'outboundDropCallsDayTimeout':_0x32ad44[_0xef61('0x65')],'outboundNoAnswerCallsDay':_0x32ad44[_0xef61('0x66')],'outboundNoSuchCallsDay':_0x32ad44[_0xef61('0x67')],'outboundOriginateFailureCallsDay':_0x32ad44['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x32ad44[_0xef61('0x68')],'outboundRejectCallsDay':_0x32ad44[_0xef61('0x69')],'outboundUnknownCallsDay':_0x32ad44[_0xef61('0x6a')],'predictiveIntervalAnsweredCalls':_0x32ad44[_0xef61('0x6b')],'predictiveIntervalAvgHoldtime':_0x32ad44[_0xef61('0x6c')],'predictiveIntervalAvgTalktime':_0x32ad44[_0xef61('0x6d')],'predictiveIntervalDroppedCallsCallersExit':_0x32ad44['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x32ad44[_0xef61('0x6e')],'predictiveIntervalErlangCalls':_0x32ad44[_0xef61('0x6f')],'predictiveIntervalErlangCallsDroppedCalls':_0x32ad44[_0xef61('0x70')],'predictiveIntervalHitRate':_0x32ad44['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x32ad44[_0xef61('0x71')],'predictiveIntervalPauses':_0x32ad44[_0xef61('0x72')],'predictiveIntervalAvailable':_0x32ad44[_0xef61('0x73')],'predictiveIntervalTotalCalls':_0x32ad44[_0xef61('0x74')],'message':_0x32ad44[_0xef61('0x45')],'originated':_0x32ad44[_0xef61('0x75')],'erlangCalls':_0x32ad44['erlangCalls'],'erlangCallToSecond':_0x32ad44[_0xef61('0x76')],'erlangAbandonmentRate':_0x32ad44[_0xef61('0x77')],'erlangBusyFactor':_0x32ad44['erlangBusyFactor'],'startPredictive':_0x32ad44[_0xef61('0x2c')],'startProgressive':_0x32ad44[_0xef61('0x2d')]};if(_0x32ad44[_0xef61('0x78')]){_0x12f442[_0xef61('0x78')]={'id':_0x32ad44['Trunk']['id'],'name':_0x32ad44[_0xef61('0x78')][_0xef61('0x43')],'active':_0x32ad44[_0xef61('0x78')]['active'],'callerid':_0x32ad44[_0xef61('0x78')][_0xef61('0x79')]};}if(_0x32ad44['Interval']){_0x12f442[_0xef61('0x46')]={'id':_0x32ad44[_0xef61('0x46')]['id'],'name':_0x32ad44[_0xef61('0x46')][_0xef61('0x43')]};}var _0x13bb20=md5(JSON[_0xef61('0x7a')](_0x12f442));if(_0x32ad44[_0xef61('0x5')]!==_0x13bb20){_0x32ad44['md5']=_0x13bb20;emit(util[_0xef61('0x7b')]('voice:queue:%s',_0x12f442[_0xef61('0x43')]),_0xef61('0x7c'),_0x12f442);}}}function emitCampaignSummary(_0x3b7004){if(_0x3b7004[_0xef61('0x58')]===_0xef61('0x7d')){emit(util[_0xef61('0x7b')](_0xef61('0x7e'),_0x3b7004[_0xef61('0x43')]),_0xef61('0x7f'),_0x3b7004);}}function checkGetDataPredictive(_0x4af2f3){if(isNotNull(_0x4af2f3)){if(!_[_0xef61('0x4a')](_0x4af2f3)){loggerPredictive[_0xef61('0x80')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive['info'](_0xef61('0x81'),_0x4af2f3[_0xef61('0x74')]);loggerPredictive['info'](_0xef61('0x82'),_0x4af2f3['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xef61('0x80')](_0xef61('0x83'),_0x4af2f3[_0xef61('0x6e')]);loggerPredictive[_0xef61('0x80')](_0xef61('0x84'),_0x4af2f3[_0xef61('0x85')]);loggerPredictive['info'](_0xef61('0x86'),_0x4af2f3[_0xef61('0x6c')]);loggerPredictive['info'](_0xef61('0x87'),_0x4af2f3[_0xef61('0x6d')]);loggerPredictive['info']('---------------------------');if(_0x4af2f3[_0xef61('0x74')]>0x0){if(!_['isUndefined'](_0x4af2f3['predictiveIntervalAvgTalktime'])&&_0x4af2f3['predictiveIntervalAvgTalktime']>0x0){return!![];}else{loggerPredictive[_0xef61('0x80')](_0xef61('0x88'));}if(!_['isUndefined'](_0x4af2f3[_0xef61('0x6c')])&&_0x4af2f3[_0xef61('0x6c')]>0x0){return!![];}else{loggerPredictive[_0xef61('0x80')](_0xef61('0x89'));}}else{loggerPredictive[_0xef61('0x80')](_0xef61('0x8a'));}}else{loggerPredictive[_0xef61('0x80')](_0xef61('0x8b'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x1cb2ef){return function(_0x1a2e7e){loggerPredictive[_0xef61('0x80')](_0xef61('0x8c'));loggerPredictive[_0xef61('0x80')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1a2e7e[_0xef61('0x8d')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1a2e7e[_0xef61('0x76')]);loggerPredictive[_0xef61('0x80')](_0xef61('0x8e'),_0x1a2e7e['erlangAbandonmentRate']);loggerPredictive[_0xef61('0x80')](_0xef61('0x8f'),_0x1a2e7e[_0xef61('0x90')]);loggerPredictive[_0xef61('0x80')](_0xef61('0x8e'),_0x1a2e7e[_0xef61('0x77')]);loggerPredictive[_0xef61('0x80')](_0xef61('0x91'));_[_0xef61('0x92')](_0x1cb2ef,_0x1a2e7e);};}function getDiff(_0x39691c){var _0x5507ee=moment()[_0xef61('0x4c')](0x0);var _0x4b26e6=moment(_0x39691c)['milliseconds'](0x0);return _0x5507ee[_0xef61('0x4d')](_0x4b26e6,_0xef61('0x4e'));}function ifInterval(_0x394ff2,_0x294dee){if(_[_0xef61('0x42')](_0x294dee)){return![];}if(getDiff(_0x294dee)<_0x394ff2*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x2a65a0){if(isNotNull(_0x2a65a0)){if(!_['isUndefined'](_0x2a65a0['startProgressive'])){_0x2a65a0[_0xef61('0x2d')]=undefined;loggerPredictive[_0xef61('0x80')](_0x2a65a0[_0xef61('0x43')],_0xef61('0x93'));}if(!_[_0xef61('0x42')](_0x2a65a0[_0xef61('0x2c')])){_0x2a65a0[_0xef61('0x2c')]=undefined;loggerPredictive[_0xef61('0x80')](_0x2a65a0[_0xef61('0x43')],_0xef61('0x94'));}if(!_[_0xef61('0x42')](_0x2a65a0['handlePredictive'])){clearInterval(_0x2a65a0[_0xef61('0x95')]);_0x2a65a0[_0xef61('0x95')]=undefined;loggerPredictive['info'](_0x2a65a0[_0xef61('0x43')],_0xef61('0x96'));}}}function erlangb(_0x29936c,_0xaeaee6){if(_0xaeaee6===0x0){return 0x0;}var _0x2cc99d=0x1;for(var _0x2deefe=0x1;_0x2deefe<=_0xaeaee6;_0x2deefe+=0x1){_0x2cc99d=0x1+_0x2cc99d*_0x2deefe/_0x29936c;}return 0x1/_0x2cc99d;}function isVoiceQueueOutbound(_0x3e4678){return _0x3e4678===_0xef61('0x50');}function isNotPreview(_0x5eccb3){return _0x5eccb3!==_0xef61('0x21');}function isCampaignIvr(_0x59b02b){return _0x59b02b==='ivr';}function getCallerId(_0x523d8d,_0x3dce33,_0x205f80){if(!_[_0xef61('0x42')](_0x205f80)&&'string'===typeof _0x205f80&&!_[_0xef61('0x4a')](_0x205f80)){if(!_[_0xef61('0x42')](_0x3dce33)&&_0xef61('0x97')===typeof _0x3dce33&&!_[_0xef61('0x4a')](_0x3dce33)){return util[_0xef61('0x7b')](_0xef61('0x98'),_0x3dce33,_0x205f80);}return util[_0xef61('0x7b')](_0xef61('0x98'),_0x205f80,_0x205f80);}if(!_[_0xef61('0x42')](_0x523d8d)&&_0xef61('0x97')===typeof _0x523d8d&&!_[_0xef61('0x4a')](_0x523d8d)){return _0x523d8d;}return _0xef61('0x99');}function loggerCatchQueueSummary(_0x3b3916,_0x2bb5f5){return function(_0x477e14){freeVariablesPredictive(_0x2bb5f5);emitVoiceQueueSummary(_0x2bb5f5);emitCampaignSummary(_0x2bb5f5);loggerSyncQueueSummary[_0xef61('0x9a')](_0x3b3916,util[_0xef61('0x9b')](_0x477e14,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x117d37,_0x529a78){return function(_0xb0ab6d){loggerPredictive[_0xef61('0x9a')](_0x529a78[_0xef61('0x43')],_0x117d37);loggerPredictive[_0xef61('0x9a')](_0xb0ab6d[_0xef61('0x9c')]);freeVariablesPredictive(_0x529a78);};}function loggerCatch(_0x346752){return function(_0x51e179){logger[_0xef61('0x9a')](_0x346752,util[_0xef61('0x9b')](_0x51e179,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x582492){return _0x582492&&!_[_0xef61('0x42')](_0x582492)&&_0x582492['length']>0x0;}function decremetOriginate(_0xe62ec2){if(!_[_0xef61('0x42')](_0xe62ec2)&&_0xe62ec2!==null){if(_0xe62ec2['hasOwnProperty'](_0xef61('0x75'))){if(_0xe62ec2['originated']>0x0){_0xe62ec2[_0xef61('0x75')]-=0x1;}else{logger[_0xef61('0x9a')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0xef61('0x9d'));}}function checkContactLowerLimitOriginate(_0x2870a6,_0x7083d8,_0x3b64e2){if(_0x7083d8>_0x3b64e2){for(var _0x46d614=0x0;_0x46d614<_0x7083d8-_0x3b64e2;_0x46d614+=0x1){decremetOriginate(_0x2870a6);}}}function loggerGetContactDialer(_0x51255b,_0x213a99,_0x2db1d1){return function(_0x189e9b){checkContactLowerLimitOriginate(_0x213a99,_0x2db1d1,0x0);logger[_0xef61('0x9a')](_0x51255b,util[_0xef61('0x9b')](_0x189e9b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1aa9c3){return function(_0x5e94f1){if(isNotNull(_0x5e94f1)&&isNotNull(_0x5e94f1[0x0])){if(_0x5e94f1[0x0][_0xef61('0x9e')]>0x0){_0x1aa9c3['message']=_0xef61('0x9f');logger[_0xef61('0x80')](_0xef61('0xa0')+_0x1aa9c3[_0xef61('0x43')],_0x5e94f1[0x0][_0xef61('0x9e')],_0xef61('0xa1'));}else{_0x1aa9c3[_0xef61('0x45')]=_0xef61('0xa2');logger[_0xef61('0x80')](_0xef61('0xa3')+_0x1aa9c3[_0xef61('0x43')]);}}};}function notSendMessagesQueue(_0x253b51){if(_0x253b51[_0xef61('0xa4')]){freeVariablesPredictive(_0x253b51);if(_0x253b51['originated']===0x0&&_0x253b51[_0xef61('0x56')]===0x0&&_0x253b51[_0xef61('0x5a')]===0x0&&(_0x253b51[_0xef61('0x54')]||0x0)===0x0){_0x253b51[_0xef61('0xa4')]=![];_0x253b51['available']=0x0;_0x253b51[_0xef61('0x45')]='NOT_ACTIVE';loggerSyncQueueSummary['error'](_0xef61('0xa5'),_0x253b51['name'],_0xef61('0xa6'));}else{_0x253b51['message']='IS_DISACTIVED';loggerSyncQueueSummary[_0xef61('0x9a')](_0xef61('0xa5'),_0x253b51['name'],_0xef61('0xa7'));}emitVoiceQueueSummary(_0x253b51);}}function notSendMessagesCampaign(_0x4a2e8c){if(_0x4a2e8c[_0xef61('0xa4')]){if(_0x4a2e8c[_0xef61('0x75')]===0x0){_0x4a2e8c[_0xef61('0xa4')]=![];_0x4a2e8c[_0xef61('0x45')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xef61('0x9a')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x4a2e8c[_0xef61('0x43')],_0xef61('0xa6'));}else{_0x4a2e8c[_0xef61('0x45')]=_0xef61('0xa8');loggerSyncQueueSummary[_0xef61('0x9a')](_0xef61('0xa9'),_0x4a2e8c[_0xef61('0x43')],_0xef61('0xa7'));}emitCampaignSummary(_0x4a2e8c);}}function createObjHistory(_0x3dc32e,_0x540b68,_0xaa6e48,_0x4871af,_0x222239){_0x3dc32e[_0xef61('0x45')]=_0xaa6e48;var _0x5db4a0=new Action(_0x3dc32e,_0x540b68);var _0x43eb12=new History(_0x5db4a0);_0x43eb12['state']=_0x4871af;_0x43eb12['statedesc']=_0x222239;_0x43eb12[_0xef61('0xaa')]=_0x5db4a0[_0xef61('0xab')];return _0x43eb12;}Dialer['prototype'][_0xef61('0x41')]=function(){var _0x34e4cb=this;setInterval(function(){_0x34e4cb['clearZombieChannels'](_0x34e4cb[_0xef61('0x2a')],_0xef61('0xac'));_0x34e4cb['clearZombieChannels'](_0x34e4cb[_0xef61('0x28')],'[actions]');},0x32c8);};Dialer[_0xef61('0x1f')][_0xef61('0xad')]=function(_0x1d0dd8,_0x4425d1){var _0x48085e=this;for(var _0x36318a in _0x1d0dd8){if(_0x1d0dd8[_0xef61('0xae')](_0x36318a)){this[_0xef61('0xaf')]['enqueue'](function(){if(!_[_0xef61('0xb0')](_0x1d0dd8[_0x36318a])){return ami[_0xef61('0xb1')]({'action':'status','channel':_0x1d0dd8[_0x36318a]['channel']})[_0xef61('0xb2')](function(_0x229f92){if(_0x229f92[_0xef61('0x45')]===_0xef61('0xb3')){setTimeout(function(){if(_0x1d0dd8[_0x36318a]&&_0x1d0dd8[_0x36318a][_0xef61('0x58')]!==_0xef61('0x7d')){_0x48085e[_0xef61('0xb4')](_0x48085e[_0xef61('0x22')][_0x1d0dd8[_0x36318a][_0xef61('0xb5')]]);logger[_0xef61('0x9a')](_0xef61('0xb6'),_0x4425d1,_0x36318a,_0x1d0dd8[_0x36318a][_0xef61('0xb5')]);delete _0x1d0dd8[_0x36318a];}if(_0x1d0dd8[_0x36318a]&&_0x1d0dd8[_0x36318a][_0xef61('0x58')]===_0xef61('0x7d')){_0x48085e[_0xef61('0xb4')](_0x48085e[_0xef61('0x23')][_0x1d0dd8[_0x36318a]['queue']]);logger[_0xef61('0x9a')](_0xef61('0xb7'),_0x4425d1,_0x36318a,_0x1d0dd8[_0x36318a][_0xef61('0xb5')]);delete _0x1d0dd8[_0x36318a];}},0x2328);}});}});}}};Dialer[_0xef61('0x1f')][_0xef61('0xb8')]=function(_0x2a13b0){return BPromise[_0xef61('0xb9')]()[_0xef61('0xba')](cmHopper[_0xef61('0xb8')](_0x2a13b0))[_0xef61('0xb2')](loggerCatch(_0xef61('0xbb')));};Dialer[_0xef61('0x1f')]['checkIsBlackList']=function(_0xcce036){return BPromise[_0xef61('0xb9')]()['then'](cmHopperBlack[_0xef61('0xbc')](_0xcce036))[_0xef61('0xb2')](loggerCatch(_0xef61('0xbd')));};Dialer[_0xef61('0x1f')][_0xef61('0xbe')]=function(_0x51a988){return BPromise[_0xef61('0xb9')]()['then'](cmHopperBlack[_0xef61('0xbe')](_0x51a988))[_0xef61('0xb2')](loggerCatch(_0xef61('0xbf')));};Dialer[_0xef61('0x1f')][_0xef61('0xc0')]=function(_0x35f379){return BPromise[_0xef61('0xb9')]()[_0xef61('0xba')](cmHopperHistory['avgHandleTime'](_0x35f379))[_0xef61('0xb2')](loggerCatch(_0xef61('0xc1')));};Dialer[_0xef61('0x1f')][_0xef61('0xc2')]=function(_0x3c3418){return BPromise[_0xef61('0xb9')]()[_0xef61('0xba')](cmHopper[_0xef61('0xc2')](_0x3c3418))[_0xef61('0xb2')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0xef61('0x1f')][_0xef61('0xc3')]=function(_0x22006a,_0x317c4a,_0x5d8ee9){return BPromise['resolve']()[_0xef61('0xba')](cmHopper[_0xef61('0xc3')](_0x22006a,_0x317c4a,_0x5d8ee9))[_0xef61('0xb2')](loggerCatch(_0xef61('0xc4')));};Dialer[_0xef61('0x1f')][_0xef61('0xc5')]=function(_0xb0f6f2,_0x4c2d94,_0x3f8355,_0x660c71){return BPromise[_0xef61('0xb9')]()[_0xef61('0xba')](cmHopper[_0xef61('0xc5')](_0xb0f6f2,_0x4c2d94,_0x3f8355,_0x660c71))['catch'](loggerCatch(_0xef61('0xc6')));};Dialer['prototype'][_0xef61('0xc7')]=function(_0x25b183,_0x2b48dd,_0xb5cee1){return BPromise[_0xef61('0xb9')]()[_0xef61('0xba')](cmHopper['getContactDialerIvr'](_0x25b183,_0x2b48dd,_0xb5cee1))[_0xef61('0xb2')](loggerCatch(_0xef61('0xc6')));};Dialer[_0xef61('0x1f')][_0xef61('0xc8')]=function(_0x3b4645){return BPromise[_0xef61('0xb9')]()[_0xef61('0xba')](voiceQueueRt['getVoiceQueueRtPauses'](_0x3b4645))[_0xef61('0xb2')](loggerCatch(_0xef61('0xc9')));};Dialer[_0xef61('0x1f')]['moveContactManagedDialer']=function(_0x501c16){return BPromise[_0xef61('0xb9')]()[_0xef61('0xba')](cmHopper['moveContactManagedDialer'](_0x501c16))[_0xef61('0xb2')](loggerCatch(_0xef61('0xca')));};Dialer[_0xef61('0x1f')][_0xef61('0xcb')]=function(_0x34a3a5){return BPromise[_0xef61('0xb9')]()[_0xef61('0xba')](cmHopperHistory[_0xef61('0xcb')](_0x34a3a5))['catch'](loggerCatch(_0xef61('0xcc')));};Dialer[_0xef61('0x1f')][_0xef61('0xb4')]=function(_0x7839c0){if(!_[_0xef61('0x42')](_0x7839c0)&&_0x7839c0!==null){if(_0x7839c0['hasOwnProperty'](_0xef61('0x75'))){if(_0x7839c0['originated']>0x0){_0x7839c0[_0xef61('0x75')]-=0x1;}else{logger[_0xef61('0x9a')](_0xef61('0xcd'));}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xef61('0x1f')][_0xef61('0xce')]=function(_0x584276,_0x52df3f){var _0x17d502=this;return function(_0x38cd72){_0x17d502[_0xef61('0xb4')](_0x52df3f);logger[_0xef61('0x9a')](_0x584276,util[_0xef61('0x9b')](_0x38cd72,{'showHidden':![],'depth':null}));};};Dialer[_0xef61('0x1f')][_0xef61('0xcf')]=function(_0x35c0bd,_0x102fe5,_0x2bd0dc){var _0x3c4bb1={'state':0x19,'statedesc':'notFound'};this[_0xef61('0xb4')](_0x102fe5);this[_0xef61('0xd0')](_['merge'](_0x3c4bb1,_[_0xef61('0xd1')](_0x2bd0dc,[_0xef61('0xd2'),_0xef61('0xd3'),_0xef61('0xd4'),_0xef61('0xd5'),_0xef61('0xd6')])),'[emptyContact][createHistory]',_0xef61('0xd7'));logger[_0xef61('0x9a')](_0x35c0bd);};Dialer[_0xef61('0x1f')][_0xef61('0xd8')]=function(_0x28e213){return _0x28e213===_0xef61('0xd9');};Dialer['prototype']['isTrunkReachable']=function(_0x2df73f){return!_[_0xef61('0x42')](_0x2df73f)&&_0x2df73f&&!_[_0xef61('0x42')](_0x2df73f[_0xef61('0x43')])&&!_[_0xef61('0x42')](_0x2df73f[_0xef61('0xda')])&&_0x2df73f[_0xef61('0xda')]&&(this['trunks'][util['format'](_0xef61('0xdb'),_0x2df73f[_0xef61('0x43')])][_0xef61('0xdc')]===_0xef61('0xdd')||this[_0xef61('0x25')][util['format'](_0xef61('0xdb'),_0x2df73f['name'])][_0xef61('0xdc')]==='unmonitored');};Dialer[_0xef61('0x1f')]['saveInDb']=function(_0x4f5bc4,_0x3b3c1a,_0x1f9210){this[_0xef61('0xcb')](_0x4f5bc4)[_0xef61('0xb2')](loggerCatch(_0x3b3c1a));this[_0xef61('0xde')](_0x4f5bc4)['catch'](loggerCatch(_0x1f9210));};Dialer['prototype']['syncVarSet']=function(_0x6910){var _0x4b5ad7=this[_0xef61('0x2a')][_0x6910[_0xef61('0xdf')]];var _0x2ba1e7;if(!_[_0xef61('0xb0')](_0x6910)&&!_[_0xef61('0xb0')](_0x6910[_0xef61('0xe0')])&&!_[_0xef61('0xb0')](_0x6910['variable'][_0xef61('0xe1')])&&_0x6910['exten']===_0xef61('0xe2')&&_0x4b5ad7){if(_0x4b5ad7[_0xef61('0x58')]!==_0xef61('0x7d')&&this[_0xef61('0x22')][_0x4b5ad7['queue']][_0xef61('0xe3')]&&_0x6910[_0xef61('0xe4')]===_0xef61('0xe5')){delete this['uniqueId'][_0x6910['uniqueid']];this[_0xef61('0xb4')](this[_0xef61('0x22')][_0x4b5ad7['queue']]);this[_0xef61('0x22')][_0x4b5ad7[_0xef61('0xb5')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x4b5ad7[_0xef61('0xb5')]][_0xef61('0x5f')]+=0x1;_0x2ba1e7=new Hangup(_0x4b5ad7,_0x6910);_0x2ba1e7['state']=0x12;_0x2ba1e7[_0xef61('0xe6')]='HangupInAMD';_0x2ba1e7[_0xef61('0xe7')]='AMD';this[_0xef61('0xd0')](_0x2ba1e7,'[syncHangupInAMD][createHistory]',_0xef61('0xe8'));}if(_0x4b5ad7['type']!==_0xef61('0x7d')&&this[_0xef61('0x22')][_0x4b5ad7['queue']][_0xef61('0xe3')]&&_0x6910[_0xef61('0xe4')]===_0xef61('0xe9')){delete this['uniqueId'][_0x6910['uniqueid']];this[_0xef61('0xb4')](this[_0xef61('0x22')][_0x4b5ad7['queue']]);this['voiceQueues'][_0x4b5ad7[_0xef61('0xb5')]][_0xef61('0x60')]+=0x1;this['voiceQueues'][_0x4b5ad7[_0xef61('0xb5')]]['outboundAnswerAgiCallsDay']+=0x1;_0x2ba1e7=new Hangup(_0x4b5ad7,_0x6910);_0x2ba1e7[_0xef61('0xea')]=0x13;_0x2ba1e7[_0xef61('0xe6')]=_0xef61('0xeb');_0x2ba1e7[_0xef61('0xe7')]=_0xef61('0xec');_0x2ba1e7[_0xef61('0xed')]=!![];this['saveInDb'](_0x2ba1e7,'[syncMachine][createHistory]',_0xef61('0xee'));}if(_0x4b5ad7[_0xef61('0x58')]===_0xef61('0x7d')&&this[_0xef61('0x23')][_0x4b5ad7[_0xef61('0xb5')]][_0xef61('0xe3')]&&_0x6910[_0xef61('0xe4')]===_0xef61('0xe5')){delete this['uniqueId'][_0x6910[_0xef61('0xdf')]];this[_0xef61('0xb4')](this[_0xef61('0x23')][_0x4b5ad7[_0xef61('0xb5')]]);_0x2ba1e7=new Hangup(_0x4b5ad7,_0x6910);_0x2ba1e7[_0xef61('0xea')]=0x12;_0x2ba1e7[_0xef61('0xe6')]=_0xef61('0xef');_0x2ba1e7['membername']=_0xef61('0xec');this[_0xef61('0xd0')](_0x2ba1e7,_0xef61('0xf0'),_0xef61('0xf1'));}if(_0x4b5ad7[_0xef61('0x58')]===_0xef61('0x7d')&&this[_0xef61('0x23')][_0x4b5ad7['queue']][_0xef61('0xe3')]&&_0x6910[_0xef61('0xe4')]===_0xef61('0xe9')){delete this[_0xef61('0x2a')][_0x6910[_0xef61('0xdf')]];this[_0xef61('0xb4')](this[_0xef61('0x23')][_0x4b5ad7['queue']]);_0x2ba1e7=new Hangup(_0x4b5ad7,_0x6910);_0x2ba1e7[_0xef61('0xea')]=0x13;_0x2ba1e7[_0xef61('0xe6')]='Machine';_0x2ba1e7['membername']='AMD';_0x2ba1e7[_0xef61('0xed')]=!![];this[_0xef61('0xd0')](_0x2ba1e7,_0xef61('0xf2'),'[syncMachineIvr]');}}};Dialer[_0xef61('0x1f')][_0xef61('0x37')]=function(_0x188cf0){var _0x42a7a9=this['uniqueId'][_0x188cf0[_0xef61('0xdf')]];var _0x64a91b=this;var _0x23a826;if(_0x42a7a9&&_0x42a7a9[_0xef61('0x58')]===_0xef61('0x7d')){delete this['uniqueId'][_0x188cf0[_0xef61('0xdf')]];this[_0xef61('0xb4')](this[_0xef61('0x23')][_0x42a7a9[_0xef61('0xb5')]]);this[_0xef61('0x23')][_0x42a7a9[_0xef61('0xb5')]][_0xef61('0xf3')]+=0x1;_0x23a826=new Hangup(_0x42a7a9,_0x188cf0);this[_0xef61('0xcb')](_0x23a826)[_0xef61('0xb2')](loggerCatch(_0xef61('0xf4')));this[_0xef61('0xde')](_0x23a826)['catch'](loggerCatch(_0xef61('0xf5')));}if(_0x42a7a9&&_0x42a7a9['type']!=='ivr'&&isNotNull(this['voiceQueues'][_0x42a7a9['queue']][_0xef61('0xf6')])){delete this[_0xef61('0x2a')][_0x188cf0[_0xef61('0xdf')]];this[_0xef61('0xb4')](this[_0xef61('0x22')][_0x42a7a9['queue']]);this['voiceQueues'][_0x42a7a9[_0xef61('0xb5')]]['outboundAnswerCallsDay']+=0x1;this[_0xef61('0x22')][_0x42a7a9[_0xef61('0xb5')]][_0xef61('0x5f')]+=0x1;_0x23a826=new Hangup(_0x42a7a9,_0x188cf0);_0x23a826['state']=0x10;_0x23a826[_0xef61('0xe6')]=_0xef61('0xf7');_0x23a826[_0xef61('0xe7')]=_0xef61('0xf8');this[_0xef61('0xcb')](_0x23a826)[_0xef61('0xb2')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xef61('0xde')](_0x23a826)[_0xef61('0xb2')](loggerCatch(_0xef61('0xf5')));}if(_0x42a7a9&&_0x42a7a9[_0xef61('0x58')]!=='ivr'&&!isNotNull(this['voiceQueues'][_0x42a7a9[_0xef61('0xb5')]][_0xef61('0xf6')])){delete this[_0xef61('0x2a')][_0x188cf0['uniqueid']];this[_0xef61('0xb4')](this[_0xef61('0x22')][_0x42a7a9['queue']]);this[_0xef61('0x22')][_0x42a7a9[_0xef61('0xb5')]]['outboundUnknownCallsDay']+=0x1;_0x23a826=new Hangup(_0x42a7a9,_0x188cf0);_0x23a826[_0xef61('0xea')]=0xc;_0x23a826[_0xef61('0xe6')]=_0x188cf0[_0xef61('0xf9')];_0x23a826[_0xef61('0xe7')]=_0xef61('0xfa');this[_0xef61('0xcb')](_0x23a826)[_0xef61('0xb2')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xef61('0xde')](_0x23a826)[_0xef61('0xb2')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xef61('0x1f')]['syncAgentComplete']=function(_0x38e790){var _0x2d4528=this[_0xef61('0x2a')][_0x38e790[_0xef61('0xdf')]];var _0x1b934d=this;if(this[_0xef61('0x22')][_0x38e790[_0xef61('0xb5')]]){if(_0x2d4528&&_0x2d4528[_0xef61('0x58')]!=='ivr'){delete this[_0xef61('0x2a')][_0x38e790[_0xef61('0xdf')]];this['voiceQueues'][_0x38e790[_0xef61('0xb5')]][_0xef61('0x60')]+=0x1;var _0x33bd17=new AgentComplete(_0x2d4528,_0x38e790);if(_0x38e790['reason']===_0xef61('0xfb')){_0x33bd17[_0xef61('0xfc')]=this['voiceQueues'][_0x38e790[_0xef61('0xb5')]]['dialQueueProject2']&&this['voiceQueues'][_0x38e790[_0xef61('0xb5')]]['dialAgiAfterHangupAgent']?moment()[_0xef61('0x7b')](_0xef61('0xfd')):undefined;}this[_0xef61('0xcb')](_0x33bd17)[_0xef61('0xb2')](loggerCatch(_0xef61('0xfe')));this[_0xef61('0xde')](_0x33bd17)[_0xef61('0xb2')](loggerCatch(_0xef61('0xff')));}}};Dialer[_0xef61('0x1f')][_0xef61('0x2f')]=function(_0x2998f1){if(this['voiceQueues'][_0x2998f1[_0xef61('0xb5')]]){if(this[_0xef61('0x2a')][_0x2998f1[_0xef61('0xdf')]]&&this[_0xef61('0x2a')][_0x2998f1[_0xef61('0xdf')]][_0xef61('0x58')]!==_0xef61('0x7d')){this[_0xef61('0xb4')](this[_0xef61('0x22')][_0x2998f1['queue']]);this[_0xef61('0x2a')][_0x2998f1[_0xef61('0xdf')]][_0xef61('0x100')]=moment()[_0xef61('0x7b')](_0xef61('0xfd'));}}};Dialer[_0xef61('0x1f')][_0xef61('0x101')]=function(_0x1e4347){this[_0xef61('0xcb')](_0x1e4347)[_0xef61('0xb2')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x1e4347)['catch'](loggerCatch(_0xef61('0x102')));};Dialer[_0xef61('0x1f')][_0xef61('0x30')]=function(_0x35b403){var _0x3f03ce=this['uniqueId'][_0x35b403['uniqueid']];var _0x4f391b=this;if(this[_0xef61('0x22')][_0x35b403[_0xef61('0xb5')]]){if(_0x3f03ce&&_0x3f03ce[_0xef61('0x58')]!==_0xef61('0x7d')){delete this[_0xef61('0x2a')][_0x35b403[_0xef61('0xdf')]];this[_0xef61('0xb4')](this[_0xef61('0x22')][_0x35b403[_0xef61('0xb5')]]);_0x3f03ce[_0xef61('0x103')]=moment()[_0xef61('0x7b')](_0xef61('0xfd'));var _0x740a41=new QueueCallerAbandon(_0x3f03ce,_0x35b403);if(getSeconds(_0x3f03ce[_0xef61('0x103')],_0x3f03ce['responsetime'])>=_0x3f03ce[_0xef61('0x104')]){this[_0xef61('0x22')][_0x35b403[_0xef61('0xb5')]][_0xef61('0x6e')]+=0x1;this[_0xef61('0x22')][_0x35b403['queue']][_0xef61('0x65')]+=0x1;this[_0xef61('0x22')][_0x35b403['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x740a41[_0xef61('0xea')]=0xa;_0x740a41[_0xef61('0xe6')]=_0xef61('0x105');_0x740a41[_0xef61('0x106')]=_0xef61('0x107');_0x740a41[_0xef61('0xfc')]=this[_0xef61('0x22')][_0x35b403[_0xef61('0xb5')]]['dialQueueProject2']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x740a41[_0xef61('0x108')]+=0x1;if(_0x740a41[_0xef61('0x108')]>=this[_0xef61('0x22')][_0x35b403[_0xef61('0xb5')]][_0xef61('0x109')]){this[_0xef61('0x101')](_0x740a41);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x740a41[_0xef61('0x108')],'scheduledat':moment()[_0xef61('0x10a')](this['voiceQueues'][_0x35b403['queue']][_0xef61('0x10b')],_0xef61('0x10c'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3f03ce[_0xef61('0xd2')],'ListId':_0x3f03ce[_0xef61('0xd3')],'VoiceQueueId':_0x3f03ce[_0xef61('0xd5')]||undefined,'CampaignId':_0x3f03ce[_0xef61('0xd6')]||undefined})[_0xef61('0xb2')](loggerCatch(_0xef61('0x10d')));var _0x4c90a2=new History(_0x740a41);_0x4c90a2[_0xef61('0xea')]=0xa;_0x4c90a2[_0xef61('0xe6')]='Drop';_0x4c90a2[_0xef61('0xab')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4c90a2['endtime']=_0x4c90a2[_0xef61('0xab')];_0x4c90a2['calleridname']=_0x740a41[_0xef61('0x10e')];_0x4c90a2[_0xef61('0x10f')]=_0x740a41[_0xef61('0x10f')];console['log'](_0xef61('0x110'),_0x35b403);console[_0xef61('0x111')](_0xef61('0x112'),_0x740a41);console[_0xef61('0x111')]('CRIS\x20createHistory\x2010',_0x4c90a2);this[_0xef61('0xcb')](_0x4c90a2)[_0xef61('0xb2')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xef61('0x22')][_0x35b403[_0xef61('0xb5')]][_0xef61('0x85')]+=0x1;this[_0xef61('0x22')][_0x35b403[_0xef61('0xb5')]]['outboundDropCallsDayCallersExit']+=0x1;_0x740a41['state']=0xb;_0x740a41[_0xef61('0xe6')]=_0xef61('0x113');_0x740a41[_0xef61('0x106')]='CALLEREXIT';_0x740a41['countabandonedretry']+=0x1;if(_0x740a41[_0xef61('0x114')]>=this['voiceQueues'][_0x35b403[_0xef61('0xb5')]][_0xef61('0x115')]){this['queueCallerAbandonCreateState'](_0x740a41);}else{this[_0xef61('0xc2')]({'active':![],'countabandonedretry':_0x740a41['countabandonedretry'],'scheduledat':moment()[_0xef61('0x10a')](this['voiceQueues'][_0x35b403['queue']][_0xef61('0x116')],_0xef61('0x10c'))[_0xef61('0x7b')](_0xef61('0xfd')),'ContactId':_0x3f03ce[_0xef61('0xd2')],'ListId':_0x3f03ce['ListId'],'VoiceQueueId':_0x3f03ce[_0xef61('0xd5')]||undefined,'CampaignId':_0x3f03ce[_0xef61('0xd6')]||undefined})[_0xef61('0xb2')](loggerCatch(_0xef61('0x117')));var _0x4c90a2=new History(_0x740a41);_0x4c90a2[_0xef61('0xea')]=0xb;_0x4c90a2[_0xef61('0xe6')]=_0xef61('0x113');_0x4c90a2[_0xef61('0xab')]=moment()['format'](_0xef61('0xfd'));_0x4c90a2['endtime']=_0x4c90a2[_0xef61('0xab')];console[_0xef61('0x111')](_0xef61('0x118'),_0x4c90a2);this['createHistory'](_0x4c90a2)[_0xef61('0xb2')](loggerCatch(_0xef61('0x119')));}}}}};Dialer['prototype']['syncNewExten']=function(_0x33ab5d){if(this[_0xef61('0x28')][_0x33ab5d[_0xef61('0xdf')]]){this[_0xef61('0x28')][_0x33ab5d[_0xef61('0xdf')]]['channel']=_0x33ab5d['channel'];}if(this[_0xef61('0x2a')][_0x33ab5d[_0xef61('0xdf')]]){this[_0xef61('0x2a')][_0x33ab5d[_0xef61('0xdf')]][_0xef61('0x11a')]=_0x33ab5d[_0xef61('0x11a')];}};Dialer['prototype']['syncQueueMember']=function(_0x45bef1){if(strategy[this[_0xef61('0x22')][this['actions'][_0x45bef1[_0xef61('0x11b')]][_0xef61('0xb5')]]['strategy']]===_0xef61('0x1e')){if(this[_0xef61('0x28')][_0x45bef1[_0xef61('0x11b')]]&&_[_0xef61('0xb0')](this[_0xef61('0x28')][_0x45bef1[_0xef61('0x11b')]][_0xef61('0x11c')])&&_0x45bef1[_0xef61('0xdc')]==='1'&&_0x45bef1[_0xef61('0x11d')]==='0'){if(this[_0xef61('0x24')][_0x45bef1[_0xef61('0x11e')]]){if(!this[_0xef61('0x24')][_0x45bef1[_0xef61('0x11e')]][_0xef61('0x11c')]){this['agents'][_0x45bef1[_0xef61('0x11e')]][_0xef61('0x11c')]=!![];this[_0xef61('0x28')][_0x45bef1['actionid']][_0xef61('0x11c')]=!![];this['actions'][_0x45bef1['actionid']][_0xef61('0x11e')]=_0x45bef1['stateinterface'];}}}}else if((strategy[this[_0xef61('0x22')][this['actions'][_0x45bef1[_0xef61('0x11b')]][_0xef61('0xb5')]][_0xef61('0x51')]]||'rrmemory')===_0xef61('0x1d')){if(this['actions'][_0x45bef1['actionid']]){if(this[_0xef61('0x24')][_0x45bef1[_0xef61('0x11e')]]){this[_0xef61('0x28')][_0x45bef1[_0xef61('0x11b')]][_0xef61('0x11e')]=_0x45bef1[_0xef61('0x11e')];if(_[_0xef61('0xb0')](this[_0xef61('0x11f')][this[_0xef61('0x28')][_0x45bef1[_0xef61('0x11b')]]['queue']])){this[_0xef61('0x11f')][this[_0xef61('0x28')][_0x45bef1[_0xef61('0x11b')]][_0xef61('0xb5')]]=[];}this['queueBooked'][this[_0xef61('0x28')][_0x45bef1[_0xef61('0x11b')]][_0xef61('0xb5')]][_0xef61('0x120')](_[_0xef61('0x92')](_['pick'](this[_0xef61('0x28')][_0x45bef1[_0xef61('0x11b')]],[_0xef61('0x121'),'stateinterface']),{'status':_0x45bef1['status'],'paused':_0x45bef1[_0xef61('0x11d')]}));}}}};function unlockQueueStatus(_0x36f5cf,_0x3a5bf7){setTimeout(function(){if(_[_0xef61('0x42')](_0x36f5cf[_0xef61('0x122')])){loggerBooked[_0xef61('0x9a')](_0xef61('0x123'),_0x3a5bf7);}_0x36f5cf[_0xef61('0x122')]=!![];loggerBooked['info'](_0xef61('0x124'),_0x3a5bf7,JSON[_0xef61('0x7a')](_['pick'](_0x36f5cf,[_0xef61('0x43'),_0xef61('0x122')])));},0x1f3);}Dialer[_0xef61('0x1f')][_0xef61('0x3f')]=function(_0x526a5b){var _0x3c2088=this;var _0x57a0fa=_0x3c2088['voiceQueues'][_0x3c2088['actions'][_0x526a5b[_0xef61('0x11b')]][_0xef61('0xb5')]];if(strategy[this[_0xef61('0x22')][this[_0xef61('0x28')][_0x526a5b[_0xef61('0x11b')]][_0xef61('0xb5')]][_0xef61('0x51')]]===_0xef61('0x1e')){if(this[_0xef61('0x28')][_0x526a5b['actionid']]&&this[_0xef61('0x28')][_0x526a5b[_0xef61('0x11b')]][_0xef61('0x11e')]){this[_0xef61('0x21')][_0xef61('0x125')](this[_0xef61('0x28')][_0x526a5b['actionid']][_0xef61('0x121')],this[_0xef61('0x28')][_0x526a5b[_0xef61('0x11b')]]['stateinterface'])['catch'](function(_0x4e1f04){logger[_0xef61('0x9a')](_0xef61('0x126'),util[_0xef61('0x9b')](_0x4e1f04,{'showHidden':![],'depth':null}));})[_0xef61('0x127')](function(){_0x3c2088[_0xef61('0xb4')](_0x3c2088['voiceQueues'][_0x3c2088[_0xef61('0x28')][_0x526a5b[_0xef61('0x11b')]]['queue']]);_0x3c2088[_0xef61('0x24')][_0x3c2088[_0xef61('0x28')][_0x526a5b['actionid']][_0xef61('0x11e')]][_0xef61('0x11c')]=![];delete _0x3c2088['actions'][_0x526a5b[_0xef61('0x11b')]];unlockQueueStatus(_0x57a0fa);});}else{this['updateOriginated'](this[_0xef61('0x22')][this[_0xef61('0x28')][_0x526a5b[_0xef61('0x11b')]][_0xef61('0xb5')]]);this[_0xef61('0xc2')]({'active':![],'ContactId':this[_0xef61('0x28')][_0x526a5b['actionid']][_0xef61('0xd2')],'ListId':this['actions'][_0x526a5b[_0xef61('0x11b')]]['ListId'],'VoiceQueueId':this[_0xef61('0x28')][_0x526a5b[_0xef61('0x11b')]][_0xef61('0xd5')]||undefined,'CampaignId':this['actions'][_0x526a5b[_0xef61('0x11b')]][_0xef61('0xd6')]||undefined})[_0xef61('0xb2')](loggerCatch(_0xef61('0x128')));delete this['actions'][_0x526a5b[_0xef61('0x11b')]];unlockQueueStatus(_0x57a0fa);}}else if((strategy[this['voiceQueues'][this[_0xef61('0x28')][_0x526a5b['actionid']][_0xef61('0xb5')]][_0xef61('0x51')]]||_0xef61('0x1d'))==='rrmemory'){var _0x249fb0;if(this[_0xef61('0x28')][_0x526a5b[_0xef61('0x11b')]]&&!_[_0xef61('0x4a')](this[_0xef61('0x11f')][this[_0xef61('0x28')][_0x526a5b[_0xef61('0x11b')]][_0xef61('0xb5')]])){if(this[_0xef61('0x2e')][_0x3c2088['actions'][_0x526a5b['actionid']][_0xef61('0xb5')]]){this[_0xef61('0x2e')][_0x3c2088['actions'][_0x526a5b[_0xef61('0x11b')]]['queue']]=this[_0xef61('0x2e')][this['actions'][_0x526a5b[_0xef61('0x11b')]][_0xef61('0xb5')]]?this['queueBookedRR'][this['actions'][_0x526a5b[_0xef61('0x11b')]][_0xef61('0xb5')]]:this['queueBooked'][this['actions'][_0x526a5b[_0xef61('0x11b')]]['queue']]?this[_0xef61('0x11f')][this[_0xef61('0x28')][_0x526a5b['actionid']]['queue']][_0xef61('0x129')]||0x0:0x0;}this[_0xef61('0x11f')][this[_0xef61('0x28')][_0x526a5b['actionid']][_0xef61('0xb5')]][_0xef61('0x129')]=this[_0xef61('0x2e')][this['actions'][_0x526a5b[_0xef61('0x11b')]][_0xef61('0xb5')]];for(var _0x8c654e=0x0;_0x8c654e=0x0?!![]:![];})[_0xef61('0xb2')](myreject(_0x2cf37e)));}}else{_0x579159[_0xef61('0x120')](ami[_0xef61('0xb1')]({'action':_0xef61('0x142'),'command':util['format'](_0xef61('0x143'),_0x108797,!_['isUndefined'](config[_0xef61('0x13d')][_0x1a050f])?_0x1a050f:'')})['then'](function(_0x4a58ca){return _0x4a58ca[_0xef61('0x144')][_0xef61('0x140')](_0xef61('0x141'))>=0x0?!![]:![];})[_0xef61('0xb2')](myreject(_0x2cf37e)));}BPromise[_0xef61('0x145')](_0x579159)[_0xef61('0xba')](function(_0x54c275){var _0x3e9206=_[_0xef61('0x146')](_0x54c275);if(_0x3e9206){return _0x7ceecd(_0x3e9206);}else{_0x2a6ceb['message']=_0x25a676?_0xef61('0x147'):_0xef61('0x148');return _0x2cf37e(msgResponse(_0xef61('0x149'),_0xef61('0x13b'),'Global:\x20'+_0x25a676+'\x20'+_0x276db2+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x108797,{'showHidden':![],'depth':null})+_0xef61('0x14a')+_0x1a050f));}})[_0xef61('0xb2')](function(_0x7de86b){return _0x2cf37e(msgResponse(_0xef61('0x13a'),_0xef61('0x13b'),JSON[_0xef61('0x7a')](_0x7de86b)));});});};Dialer['prototype'][_0xef61('0x14b')]=function(_0xe3719b){var _0x358578=this;return function(){switch(_0xe3719b[_0xef61('0x14c')]){case _0xef61('0x14d'):freeVariablesPredictive(_0xe3719b);_0x358578[_0xef61('0x14e')](_0xe3719b,0x1);break;case'power':freeVariablesPredictive(_0xe3719b);_0x358578[_0xef61('0x14e')](_0xe3719b,_0xe3719b[_0xef61('0x14f')]);break;case _0xef61('0xb'):_0x358578[_0xef61('0xb')](_0xe3719b);break;case'booked':freeVariablesPredictive(_0xe3719b);_0x358578['handlePower'](_0xe3719b,0x1);break;default:freeVariablesPredictive(_0xe3719b);logger[_0xef61('0x9a')](_0xef61('0x150'),_0xe3719b[_0xef61('0x43')],_0xef61('0x151'));}};};Dialer[_0xef61('0x1f')][_0xef61('0x152')]=function(_0x3d1bce){var _0x3be77b=this;return function(){_0x3be77b[_0xef61('0x153')](_0x3d1bce);};};Dialer[_0xef61('0x1f')][_0xef61('0xc')]=function(_0x3bf1ec){var _0x84295e=this;if(isNotPreview(_0x3bf1ec[_0xef61('0x14c')])){if(isVoiceQueueOutbound(_0x3bf1ec[_0xef61('0x58')])&&isActive(_0x3bf1ec['dialActive'])){_0x3bf1ec['sendMessageOneNotActive']=!![];BPromise[_0xef61('0xb9')]()['then'](checkIsLoggedIn(_0x3bf1ec,_0x3bf1ec[_0xef61('0x53')]))[_0xef61('0xba')](checkIsActive(_0x3bf1ec,_0x3bf1ec[_0xef61('0x5c')]))[_0xef61('0xba')](checkInterval(_0x3bf1ec))['then'](_0x84295e[_0xef61('0x133')](_0x3bf1ec))[_0xef61('0xba')](_0x84295e[_0xef61('0x138')](_0x3bf1ec['dialGlobalInterval'],_0x3bf1ec[_0xef61('0x154')],_0x3bf1ec[_0xef61('0x43')],_0x3bf1ec))['then'](_0x84295e[_0xef61('0x139')](_0x3bf1ec[_0xef61('0x46')],_0x3bf1ec['dialTimezone'],_0x3bf1ec['name'],_0x3bf1ec))[_0xef61('0xba')](_0x84295e[_0xef61('0x14b')](_0x3bf1ec))['catch'](loggerCatchQueueSummary('[syncQueueSummary]',_0x3bf1ec));}else{notSendMessagesQueue(_0x3bf1ec);}}else{freeVariablesPredictive(_0x3bf1ec);}};Dialer[_0xef61('0x1f')][_0xef61('0x132')]=function(){var _0x2c26fe=this;var _0x13a3ff;for(var _0x6d126b in this[_0xef61('0x23')]){if(this[_0xef61('0x23')][_0xef61('0xae')](_0x6d126b)){_0x13a3ff=this[_0xef61('0x23')][_0x6d126b];if(isCampaignIvr(_0x13a3ff[_0xef61('0x58')])&&isActive(_0x13a3ff['active'])){_0x13a3ff[_0xef61('0xa4')]=!![];BPromise[_0xef61('0xb9')]()[_0xef61('0xba')](checkIsActive(_0x13a3ff,_0x13a3ff[_0xef61('0xda')]))[_0xef61('0xba')](checkInterval(_0x13a3ff))[_0xef61('0xba')](_0x2c26fe[_0xef61('0x133')](_0x13a3ff))['then'](_0x2c26fe[_0xef61('0x138')](_0x13a3ff['dialGlobalInterval'],_0x13a3ff[_0xef61('0x154')],_0x13a3ff[_0xef61('0x43')],_0x13a3ff))[_0xef61('0xba')](_0x2c26fe['checkIfTimeIntervals'](_0x13a3ff[_0xef61('0x46')],_0x13a3ff[_0xef61('0x154')],_0x13a3ff[_0xef61('0x43')],_0x13a3ff))[_0xef61('0xba')](_0x2c26fe[_0xef61('0x152')](_0x13a3ff))[_0xef61('0xb2')](loggerCatchQueueSummary(_0xef61('0x155'),_0x13a3ff));}else{notSendMessagesCampaign(_0x13a3ff);}}}};function getCallerIdRandom(_0x13c060,_0x42fe82){var _0x151f65,_0x151bb9,_0x221b7f;if(_0x42fe82<=0x0){_0x42fe82=0x1;}_0x151f65=new RegExp(_0xef61('0x156')+_0x42fe82+'}$');_0x151bb9=Math[_0xef61('0x157')](0xa,_0x42fe82-0x1);_0x221b7f=Math[_0xef61('0x157')](0xa,_0x42fe82)-0x1;return util['format']('%s',_[_0xef61('0x158')](_0x13c060,_0x151f65,_[_0xef61('0x159')](_0x151bb9,_0x221b7f)));}function extractCalleridName(_0x112b00){var _0xdb54d1=_0x112b00[_0xef61('0x15a')](/"(.*?)"/);return _0xdb54d1?_0xdb54d1[0x1]:_0x112b00;}function extractCalleridNumber(_0x494735){var _0x44b908=_0x494735[_0xef61('0x15a')](/<(.*?)>/);return _0x44b908?_0x44b908[0x1]:_0x494735;}Dialer[_0xef61('0x1f')][_0xef61('0x15b')]=function(_0x1f64c2,_0x4d6edf){var _0x4ae5c6=this;var _0x5580be=uuid['v4']();this['actions'][_0x5580be]=new Action(_0x1f64c2,_0x4d6edf,_0x5580be);return new BPromise(function(_0x58a039,_0x3ac988){if(_[_0xef61('0x42')](_0x1f64c2)&&_0xef61('0x15c')!==typeof _0x1f64c2){return _0x3ac988(msgResponse(_0xef61('0x15d'),_0xef61('0x13b'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x4d6edf[_0xef61('0x15e')]['phone'])||_0x4d6edf[_0xef61('0x15e')][_0xef61('0x15f')]===null){return _0x3ac988(msgResponse(_0xef61('0x15d'),'Failure',_0xef61('0x160')));}var _0x5403fb={'XMD-CALLERID':_0x4ae5c6[_0xef61('0x28')][_0x5580be][_0xef61('0x161')](),'XMD-AGI':_0x1f64c2[_0xef61('0xf6')]?util[_0xef61('0x7b')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1f64c2[_0xef61('0xf6')]):_0xef61('0x162'),'XMD-AGIAFTER':_0x1f64c2[_0xef61('0x163')]?util[_0xef61('0x7b')](_0xef61('0x164'),ipAgi,_0x1f64c2[_0xef61('0x163')]):_0xef61('0x162'),'XMD-QUEUE':_0x1f64c2[_0xef61('0x58')]==='outbound'?util['format'](_0xef61('0x165'),_0x1f64c2['name'],_0x1f64c2[_0xef61('0x166')]||'',_0x1f64c2['dialAgiAfterHangupAgent']?'c':'',_0x1f64c2[_0xef61('0x104')]||0x3):_0xef61('0x162'),'XMD-CONTACTID':_0x4d6edf[_0xef61('0xd2')],'XMD-CDRTYPE':_0xef61('0x9'),'CALLERID(all)':_0x4ae5c6[_0xef61('0x28')][_0x5580be][_0xef61('0x161')](),'XMD-AMD':_0x1f64c2['dialAMDActive']?_0xef61('0x167'):_0xef61('0x162'),'XMD-DESTINATION':_0xef61('0xe2')};if(_0x1f64c2[_0xef61('0xe3')]){_0x5403fb[_0xef61('0x168')]=_0x1f64c2[_0xef61('0x169')]||0x9c4;_0x5403fb[_0xef61('0x16a')]=_0x1f64c2[_0xef61('0x16b')]||0x5dc;_0x5403fb[_0xef61('0x16c')]=_0x1f64c2[_0xef61('0x16d')]||0x320;_0x5403fb[_0xef61('0x16e')]=_0x1f64c2['dialAMDTotalAnalysisTime']||0x1388;_0x5403fb['XMD-AMDMINWORDLENGTH']=_0x1f64c2['dialAMDMinWordLength']||0x64;_0x5403fb[_0xef61('0x16f')]=_0x1f64c2['dialAMDBetweenWordsSilence']||0x32;_0x5403fb['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x1f64c2['dialAMDMaximumNumberOfWords']||0x3;_0x5403fb[_0xef61('0x170')]=_0x1f64c2[_0xef61('0x171')]||0x100;_0x5403fb['XMD-AMDMAXIMUMWORDLENGTH']=_0x1f64c2[_0xef61('0x172')]||0x1388;}if(_0x1f64c2['type']==='outbound'){_0x5403fb['XMD-VOICEQUEUEID']=_0x4d6edf['VoiceQueueId'];}else{_0x5403fb[_0xef61('0x173')]=_0x4d6edf[_0xef61('0xd6')];}for(var _0x59b84d in _0x4d6edf[_0xef61('0x15e')]){if(_0x4d6edf[_0xef61('0x15e')][_0xef61('0xae')](_0x59b84d)){if(isNotNull(_0x4d6edf[_0xef61('0x15e')][_0x59b84d])&&_0x59b84d!=='id'&&_0x59b84d!=='tags'&&_0x59b84d!==_0xef61('0x174')&&_0x59b84d!=='updatedAt'){_0x5403fb[util[_0xef61('0x7b')]('%s%s','XMD-',_[_0xef61('0x175')](_0x59b84d))]=_0x4d6edf[_0xef61('0x15e')][_0x59b84d];}}}var _0x3f94c5=_0x4ae5c6[_0xef61('0x134')](_0x1f64c2[_0xef61('0x78')])?getCallerId(_0x1f64c2[_0xef61('0x78')][_0xef61('0x79')],_0x1f64c2[_0xef61('0x176')],_0x1f64c2[_0xef61('0x177')]>0x0?getCallerIdRandom(_0x1f64c2[_0xef61('0x178')],_0x1f64c2[_0xef61('0x177')]):_0x1f64c2[_0xef61('0x178')]):getCallerId(_['isNil'](_0x1f64c2[_0xef61('0x135')])?_0x1f64c2['Trunk'][_0xef61('0x79')]:_0x1f64c2[_0xef61('0x135')][_0xef61('0x79')],_0x1f64c2[_0xef61('0x176')],_0x1f64c2[_0xef61('0x177')]>0x0?getCallerIdRandom(_0x1f64c2[_0xef61('0x178')],_0x1f64c2[_0xef61('0x177')]):_0x1f64c2['dialOriginateCallerIdNumber']);if(_0x3f94c5){_0x5403fb[_0xef61('0x179')]=_0x4ae5c6[_0xef61('0x28')][_0x5580be][_0xef61('0x17a')]=extractCalleridName(_0x3f94c5);_0x5403fb[_0xef61('0x17b')]=_0x4ae5c6[_0xef61('0x28')][_0x5580be]['originatecalleridnum']=extractCalleridNumber(_0x3f94c5);}return ami[_0xef61('0xb1')]({'actionid':_0x5580be,'action':'originate','channel':_0x4ae5c6['isTrunkReachable'](_0x1f64c2[_0xef61('0x78')])?util[_0xef61('0x7b')](_0xef61('0x17c'),_0x1f64c2['Trunk'][_0xef61('0x43')],isNotNull(_0x1f64c2['dialPrefix'])?_0x1f64c2[_0xef61('0x5e')][_0xef61('0x17d')]()||'':'',_0x1f64c2[_0xef61('0x17e')]>0x0?_0x4d6edf[_0xef61('0x15e')][_0xef61('0x15f')]['substring'](_0x1f64c2[_0xef61('0x17e')]):_0x4d6edf[_0xef61('0x15e')]['phone']):util['format'](_0xef61('0x17c'),_[_0xef61('0xb0')](_0x1f64c2[_0xef61('0x135')])?_0x1f64c2['Trunk']['name']:_0x1f64c2[_0xef61('0x135')][_0xef61('0x43')],isNotNull(_0x1f64c2['dialPrefix'])?_0x1f64c2[_0xef61('0x5e')][_0xef61('0x17d')]()||'':'',_0x1f64c2[_0xef61('0x17e')]>0x0?_0x4d6edf[_0xef61('0x15e')][_0xef61('0x15f')][_0xef61('0x17f')](_0x1f64c2[_0xef61('0x17e')]):_0x4d6edf['Contact'][_0xef61('0x15f')]),'callerid':_0x3f94c5,'Exten':_0xef61('0xe2'),'Context':_0xef61('0x180'),'Priority':'1','variable':_0x5403fb,'timeout':(_0x1f64c2['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5580be})[_0xef61('0xba')](function(_0x2e982b){return _0x58a039(_0x2e982b);})[_0xef61('0xb2')](function(_0x4d456f){_0x1f64c2[_0xef61('0x181')]+=0x1;var _0x3303f5=new History(_0x4ae5c6[_0xef61('0x28')][_0x5580be]);logger[_0xef61('0x9a')](util[_0xef61('0x7b')](_0xef61('0x182'),JSON['stringify'](_0x4d456f)));_0x3303f5[_0xef61('0xea')]=0xe;_0x3303f5[_0xef61('0xe6')]=_0xef61('0x183');_0x3303f5[_0xef61('0xab')]=moment()[_0xef61('0x7b')](_0xef61('0xfd'));_0x3303f5[_0xef61('0xaa')]=_0x3303f5[_0xef61('0xab')];_0x4ae5c6[_0xef61('0xcb')](_0x3303f5)['catch'](loggerCatch('[originate][error]'));_0x4ae5c6[_0xef61('0xde')](_0x3303f5)['catch'](loggerCatch(_0xef61('0x184')))[_0xef61('0x127')](function(){delete _0x4ae5c6[_0xef61('0x28')][_0x5580be];return _0x3ac988(msgResponse(_0xef61('0x15d'),_0xef61('0x185'),_0xef61('0x186')));});});});};Dialer[_0xef61('0x1f')][_0xef61('0x31')]=function(_0x4a7ac0){var _0x49b727=this[_0xef61('0x28')][_0x4a7ac0[_0xef61('0x11b')]];var _0x1941c3=this;if(_0x49b727){delete this[_0xef61('0x28')][_0x4a7ac0[_0xef61('0x11b')]];_0x49b727[_0xef61('0x187')]=moment()['format'](_0xef61('0xfd'));var _0x52c5fd=_0x49b727[_0xef61('0x58')]===_0xef61('0x7d')?this[_0xef61('0x23')][_0x49b727[_0xef61('0xb5')]]:this[_0xef61('0x22')][_0x49b727[_0xef61('0x188')]()];if(!this[_0xef61('0xd8')](_0x4a7ac0[_0xef61('0x189')])){this['updateOriginated'](_0x52c5fd);return this[_0xef61('0x18a')](_0x49b727,_0x52c5fd,_0x4a7ac0)[_0xef61('0xba')](function(_0x8b7658){})[_0xef61('0xb2')](loggerCatch('[callProgressDetecting]\x20'));}else{this[_0xef61('0x2a')][_0x4a7ac0[_0xef61('0xdf')]]=_0x49b727;}}};Dialer[_0xef61('0x1f')][_0xef61('0x18b')]=function(_0x512427,_0x55f986,_0x28af0f){var _0x197df1=new History(_0x55f986);if(_0x197df1[_0xef61('0x18c')]+_0x197df1[_0xef61('0x18d')]+_0x197df1[_0xef61('0x18e')]+_0x197df1[_0xef61('0x18f')]+_0x197df1[_0xef61('0x108')]+_0x197df1['countabandonedretry']+_0x197df1['countmachineretry']+_0x197df1[_0xef61('0x190')]>=_0x28af0f[_0xef61('0x191')]-0x1){return!![];}switch(_0x512427){case 0x3:if(_0x197df1['countnoanswerretry']>=_0x28af0f['dialNoAnswerMaxRetry']-0x1){return!![];}else{this[_0xef61('0xc2')]({'active':![],'countnoanswerretry':_0x197df1[_0xef61('0x18e')]+=0x1,'scheduledat':moment()[_0xef61('0x10a')](_0x28af0f[_0xef61('0x192')],_0xef61('0x10c'))[_0xef61('0x7b')](_0xef61('0xfd')),'ContactId':_0x197df1[_0xef61('0xd2')],'ListId':_0x197df1[_0xef61('0xd3')],'VoiceQueueId':_0x197df1[_0xef61('0xd5')]||undefined,'CampaignId':_0x197df1[_0xef61('0xd6')]||undefined})['catch'](loggerCatch(_0xef61('0x193')));}break;case 0x5:if(_0x197df1[_0xef61('0x18c')]>=_0x28af0f[_0xef61('0x194')]-0x1){return!![];}else{this[_0xef61('0xc2')]({'active':![],'countbusyretry':_0x197df1[_0xef61('0x18c')]+=0x1,'scheduledat':moment()[_0xef61('0x10a')](_0x28af0f['dialBusyRetryFrequency'],_0xef61('0x10c'))['format'](_0xef61('0xfd')),'ContactId':_0x197df1[_0xef61('0xd2')],'ListId':_0x197df1[_0xef61('0xd3')],'VoiceQueueId':_0x197df1[_0xef61('0xd5')]||undefined,'CampaignId':_0x197df1[_0xef61('0xd6')]||undefined})[_0xef61('0xb2')](loggerCatch(_0xef61('0x195')));}break;case 0x8:if(_0x197df1[_0xef61('0x18d')]>=_0x28af0f[_0xef61('0x196')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countcongestionretry':_0x197df1[_0xef61('0x18d')]+=0x1,'scheduledat':moment()['add'](_0x28af0f[_0xef61('0x197')],_0xef61('0x10c'))[_0xef61('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x197df1[_0xef61('0xd2')],'ListId':_0x197df1[_0xef61('0xd3')],'VoiceQueueId':_0x197df1[_0xef61('0xd5')]||undefined,'CampaignId':_0x197df1[_0xef61('0xd6')]||undefined})[_0xef61('0xb2')](loggerCatch('[rescheduleContact]\x20[Congestion]'));}break;case 0x0:if(_0x197df1[_0xef61('0x18f')]>=_0x28af0f['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xef61('0xc2')]({'active':![],'countnosuchnumberretry':_0x197df1[_0xef61('0x18f')]+=0x1,'scheduledat':moment()['add'](_0x28af0f[_0xef61('0x198')],'minutes')[_0xef61('0x7b')](_0xef61('0xfd')),'ContactId':_0x197df1['ContactId'],'ListId':_0x197df1[_0xef61('0xd3')],'VoiceQueueId':_0x197df1[_0xef61('0xd5')]||undefined,'CampaignId':_0x197df1[_0xef61('0xd6')]||undefined})['catch'](loggerCatch(_0xef61('0x199')));}break;case 0xa:if(_0x197df1[_0xef61('0x108')]>=_0x28af0f['dialDropMaxRetry']-0x1){return!![];}else{this[_0xef61('0xc2')]({'active':![],'countdropretry':_0x197df1['countdropretry']+=0x1,'scheduledat':moment()[_0xef61('0x10a')](_0x28af0f[_0xef61('0x10b')],_0xef61('0x10c'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x197df1[_0xef61('0xd2')],'ListId':_0x197df1[_0xef61('0xd3')],'VoiceQueueId':_0x197df1['VoiceQueueId']||undefined,'CampaignId':_0x197df1[_0xef61('0xd6')]||undefined})[_0xef61('0xb2')](loggerCatch(_0xef61('0x10d')));}break;case 0xb:if(_0x197df1[_0xef61('0x114')]>=_0x28af0f['dialAbandonedMaxRetry']-0x1){return!![];}else{this[_0xef61('0xc2')]({'active':![],'countabandonedretry':_0x197df1[_0xef61('0x114')]+=0x1,'scheduledat':moment()[_0xef61('0x10a')](_0x28af0f[_0xef61('0x116')],_0xef61('0x10c'))['format'](_0xef61('0xfd')),'ContactId':_0x197df1[_0xef61('0xd2')],'ListId':_0x197df1[_0xef61('0xd3')],'VoiceQueueId':_0x197df1[_0xef61('0xd5')]||undefined,'CampaignId':_0x197df1[_0xef61('0xd6')]||undefined})[_0xef61('0xb2')](loggerCatch(_0xef61('0x117')));}break;case 0x13:if(_0x197df1[_0xef61('0x19a')]>=_0x28af0f[_0xef61('0x19b')]-0x1){return!![];}else{this[_0xef61('0xc2')]({'active':![],'countmachineretry':_0x197df1[_0xef61('0x19a')]+=0x1,'scheduledat':moment()['add'](_0x28af0f[_0xef61('0x19c')],_0xef61('0x10c'))[_0xef61('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x197df1[_0xef61('0xd2')],'ListId':_0x197df1['ListId'],'VoiceQueueId':_0x197df1[_0xef61('0xd5')]||undefined,'CampaignId':_0x197df1[_0xef61('0xd6')]||undefined})['catch'](loggerCatch(_0xef61('0x19d')));}break;case 0x14:if(_0x197df1['countagentrejectretry']>=_0x28af0f[_0xef61('0x19e')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countagentrejectretry':_0x197df1[_0xef61('0x190')]+=0x1,'scheduledat':moment()[_0xef61('0x10a')](_0x28af0f['dialAgentRejectRetryFrequency'],_0xef61('0x10c'))['format'](_0xef61('0xfd')),'ContactId':_0x197df1[_0xef61('0xd2')],'ListId':_0x197df1['ListId'],'VoiceQueueId':_0x197df1[_0xef61('0xd5')]||undefined,'CampaignId':_0x197df1[_0xef61('0xd6')]||undefined})[_0xef61('0xb2')](loggerCatch('[rescheduleContact][AgentReject]'));}break;default:return!![];}};Dialer[_0xef61('0x1f')][_0xef61('0x18a')]=function(_0x5e9eaa,_0xf53d6b,_0x54a780){var _0x230aa2=this;var _0x5aebc6=new History(_0x5e9eaa);return new BPromise(function(_0x554281,_0xec11df){if(_[_0xef61('0x42')](_0xf53d6b)&&'object'!==typeof _0xf53d6b){return _0xec11df(msgResponse('[callProgressDetecting]',_0xef61('0x13b'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x54a780)&&_0xef61('0x15c')!==typeof _0x54a780){return _0xec11df(msgResponse(_0xef61('0x19f'),_0xef61('0x13b'),'evt\x20is\x20undefine'));}switch(_0x54a780['reason']){case'0':_0xf53d6b[_0xef61('0x67')]+=0x1;_0x5aebc6[_0xef61('0xea')]=0x0;_0x5aebc6[_0xef61('0xe6')]=_0xef61('0x1a0');_0x5aebc6[_0xef61('0x18f')]+=0x1;_0x5aebc6[_0xef61('0x1a1')]+=0x1;_0x230aa2['createHistory'](_0x5aebc6)['catch'](loggerCatch(_0xef61('0x1a2')));if(_0x230aa2[_0xef61('0x18b')](0x0,_0x5e9eaa,_0xf53d6b)){if(_0x5aebc6[_0xef61('0x18c')]+_0x5aebc6[_0xef61('0x18d')]+_0x5aebc6[_0xef61('0x18e')]+_0x5aebc6[_0xef61('0x18f')]+_0x5aebc6[_0xef61('0x108')]+_0x5aebc6['countabandonedretry']+_0x5aebc6['countmachineretry']+_0x5aebc6[_0xef61('0x190')]>=_0xf53d6b['dialGlobalMaxRetry']){_0x230aa2['stateGlobal'](_0x5aebc6,_0x554281,_0xec11df,_0xef61('0x1a3'));}else{_0x230aa2[_0xef61('0x1a4')](_0x5aebc6,_0x554281,_0xec11df,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0xf53d6b[_0xef61('0x66')]+=0x1;_0x5aebc6[_0xef61('0xea')]=0x3;_0x5aebc6[_0xef61('0xe6')]=_0xef61('0x1a5');_0x5aebc6[_0xef61('0x18e')]+=0x1;_0x5aebc6['countglobal']+=0x1;_0x230aa2[_0xef61('0xcb')](_0x5aebc6)[_0xef61('0xb2')](loggerCatch(_0xef61('0x1a6')));if(_0x230aa2[_0xef61('0x18b')](0x3,_0x5e9eaa,_0xf53d6b)){if(_0x5aebc6['countnoanswerretry']>=_0xf53d6b['dialNoAnswerMaxRetry']){_0x230aa2[_0xef61('0x1a4')](_0x5aebc6,_0x554281,_0xec11df,_0xef61('0x1a7'));}else{_0x230aa2[_0xef61('0x1a8')](_0x5aebc6,_0x554281,_0xec11df,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0xf53d6b[_0xef61('0x62')]+=0x1;_0x5aebc6[_0xef61('0xea')]=0x5;_0x5aebc6[_0xef61('0xe6')]=_0xef61('0x1a9');_0x5aebc6['countbusyretry']+=0x1;_0x5aebc6[_0xef61('0x1a1')]+=0x1;_0x230aa2[_0xef61('0xcb')](_0x5aebc6)[_0xef61('0xb2')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x230aa2[_0xef61('0x18b')](0x5,_0x5e9eaa,_0xf53d6b)){if(_0x5aebc6[_0xef61('0x18c')]>=_0xf53d6b['dialBusyMaxRetry']){_0x230aa2[_0xef61('0x1a4')](_0x5aebc6,_0x554281,_0xec11df,_0xef61('0x1aa'));}else{_0x230aa2[_0xef61('0x1a8')](_0x5aebc6,_0x554281,_0xec11df,_0xef61('0x1aa'));}}break;case'8':_0xf53d6b[_0xef61('0x63')]+=0x1;_0x5aebc6[_0xef61('0xea')]=0x8;_0x5aebc6['statedesc']='Congestion';_0x5aebc6[_0xef61('0x18d')]+=0x1;_0x5aebc6[_0xef61('0x1a1')]+=0x1;_0x230aa2[_0xef61('0xcb')](_0x5aebc6)['catch'](loggerCatch(_0xef61('0x1ab')));if(_0x230aa2[_0xef61('0x18b')](0x8,_0x5e9eaa,_0xf53d6b)){if(_0x5aebc6[_0xef61('0x18d')]>=_0xf53d6b[_0xef61('0x196')]){_0x230aa2[_0xef61('0x1a4')](_0x5aebc6,_0x554281,_0xec11df,_0xef61('0x1ac'));}else{_0x230aa2['stateGlobal'](_0x5aebc6,_0x554281,_0xec11df,_0xef61('0x1ac'));}}break;case'11':_0xf53d6b[_0xef61('0x1ad')]+=0x1;_0x5aebc6[_0xef61('0xea')]=0xb;_0x5aebc6[_0xef61('0xe6')]=_0xef61('0x113');_0x5aebc6[_0xef61('0x114')]+=0x1;_0x5aebc6[_0xef61('0x1a1')]+=0x1;_0x230aa2['createHistory'](_0x5aebc6)[_0xef61('0xb2')](loggerCatch(_0xef61('0x119')));if(_0x230aa2[_0xef61('0x18b')](0xb,_0x5e9eaa,_0xf53d6b)){if(_0x5aebc6[_0xef61('0x114')]>=_0xf53d6b[_0xef61('0x115')]){_0x230aa2[_0xef61('0x1a4')](_0x5aebc6,_0x554281,_0xec11df,_0xef61('0x1ae'));}else{_0x230aa2[_0xef61('0x1a8')](_0x5aebc6,_0x554281,_0xec11df,_0xef61('0x1ae'));}}break;case'20':_0xf53d6b['outboundRejectCallsDay']+=0x1;_0x5aebc6[_0xef61('0xea')]=0x14;_0x5aebc6[_0xef61('0xe6')]=_0xef61('0x1af');_0x5aebc6['countagentrejectretry']+=0x1;_0x5aebc6[_0xef61('0x1a1')]+=0x1;_0x230aa2[_0xef61('0xcb')](_0x5aebc6)[_0xef61('0xb2')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x230aa2['checkRetriveMax'](0x14,_0x5e9eaa,_0xf53d6b)){if(_0x5aebc6[_0xef61('0x190')]>=_0xf53d6b[_0xef61('0x19e')]){_0x230aa2['createStateFinal'](_0x5aebc6,_0x554281,_0xec11df,'reason\x2020\x20agentreject');}else{_0x230aa2[_0xef61('0x1a8')](_0x5aebc6,_0x554281,_0xec11df,_0xef61('0x1b0'));}}break;default:_0xf53d6b[_0xef61('0x6a')]+=0x1;_0x5aebc6[_0xef61('0xea')]=0xc;_0x5aebc6[_0xef61('0xe6')]=_0x54a780[_0xef61('0x1b1')];_0x230aa2['createHistory'](_0x5aebc6)[_0xef61('0xb2')](loggerCatch(_0xef61('0x1b2')));if(_0x230aa2[_0xef61('0x18b')](_0x54a780[_0xef61('0x1b1')],_0x5e9eaa,_0xf53d6b)){if(_0x5aebc6['countbusyretry']+_0x5aebc6[_0xef61('0x18d')]+_0x5aebc6['countnoanswerretry']+_0x5aebc6[_0xef61('0x18f')]+_0x5aebc6[_0xef61('0x108')]+_0x5aebc6['countabandonedretry']+_0x5aebc6[_0xef61('0x19a')]+_0x5aebc6['countagentrejectretry']>=_0xf53d6b[_0xef61('0x191')]){_0x230aa2[_0xef61('0x1a8')](_0x5aebc6,_0x554281,_0xec11df,_0x54a780['reason']);}else{_0x230aa2[_0xef61('0x1a4')](_0x5aebc6,_0x554281,_0xec11df,_0x54a780[_0xef61('0x1b1')]);}}}});};Dialer[_0xef61('0x1f')][_0xef61('0x1a8')]=function(_0x1d501a,_0x2712f2,_0x14ebe4,_0x2fdd9f){var _0xe50237=new Final(_0x1d501a);_0xe50237[_0xef61('0xea')]=0xf;_0xe50237[_0xef61('0xe6')]=_0xef61('0x1b3');this[_0xef61('0x1a4')](_0xe50237,_0x2712f2,_0x14ebe4,_0x2fdd9f);};Dialer[_0xef61('0x1f')]['createStateFinal']=function(_0x53fb9b,_0x4512e9,_0x105773,_0x2366c1){this[_0xef61('0xde')](_0x53fb9b)[_0xef61('0xba')](function(_0x1c5f2a){return _0x4512e9(msgResponse(_0xef61('0x19f'),_0xef61('0xd9'),_0x2366c1));})['catch'](function(_0x76b92e){return _0x105773(msgResponse(_0xef61('0x1b4'),_0xef61('0x13b'),_0xef61('0x1b5')));});};Dialer[_0xef61('0x1f')]['predictive']=function(_0x59bfb6){var _0x33110f=this;var _0x4a1356=_0x59bfb6[_0xef61('0x1b6')]/0x64;var _0x1e5e55=_0x59bfb6[_0xef61('0x65')]/(_0x59bfb6[_0xef61('0x65')]+_0x59bfb6['outboundAnswerCallsDay']);var _0x8dd2c8=Math[_0xef61('0x1b7')](_0x59bfb6[_0xef61('0x73')]*(_0x59bfb6[_0xef61('0x1b8')]/0x64));var _0x2ec689=Math[_0xef61('0x1b7')](_0x59bfb6[_0xef61('0x73')]*(_0x59bfb6[_0xef61('0x1b9')]/0x64));var _0x252723=_0x59bfb6[_0xef61('0x52')]+_0x59bfb6[_0xef61('0x56')];var _0x49ae97=Math[_0xef61('0x1ba')](_0x59bfb6[_0xef61('0x8d')]*_0x59bfb6[_0xef61('0x77')]*_0x59bfb6[_0xef61('0x1bb')]*_0x59bfb6[_0xef61('0x71')]);if(_['isUndefined'](_0x59bfb6['startProgressive'])){if(!_[_0xef61('0x42')](_0x59bfb6[_0xef61('0x2c')])){_0x59bfb6[_0xef61('0x2c')]=undefined;loggerPredictive[_0xef61('0x9a')](_0xef61('0x1bc'),_0xef61('0x1bd'));}if(!_[_0xef61('0x42')](_0x59bfb6['handlePredictive'])){loggerPredictive[_0xef61('0x9a')](_0xef61('0x1bc'),_0xef61('0x1be'));clearInterval(_0x59bfb6[_0xef61('0x95')]);_0x59bfb6['handlePredictive']=undefined;}_0x59bfb6[_0xef61('0x2d')]=moment()[_0xef61('0x7b')](_0xef61('0xfd'));loggerPredictive[_0xef61('0x80')](_0x59bfb6['name'],_0xef61('0x1bf'),_0x59bfb6[_0xef61('0x2d')]);this[_0xef61('0x14e')](_0x59bfb6,0x1);}else if(ifInterval(_0x59bfb6[_0xef61('0x1c0')],_0x59bfb6[_0xef61('0x2d')])){this[_0xef61('0x14e')](_0x59bfb6,0x1);loggerPredictiveCalls[_0xef61('0x80')](_0xef61('0x1c1'),_0x59bfb6['startProgressive'],_0x59bfb6[_0xef61('0x43')]);_0x59bfb6[_0xef61('0x8d')]=0x0;_0x59bfb6[_0xef61('0x70')]=0x0;}else if(_0x4a1356<_0x1e5e55&&_0x59bfb6[_0xef61('0x1c2')]===_0xef61('0x1c3')){freeVariablesPredictive(_0x59bfb6);loggerPredictive[_0xef61('0x80')](_0xef61('0x1c4'),_0xef61('0x1c5'),_0x1e5e55,_0xef61('0x2d'),_0x59bfb6['name']);}else if(_0x49ae97<_0x59bfb6[_0xef61('0x70')]&&_0x59bfb6[_0xef61('0x1c2')]==='dropRate'){freeVariablesPredictive(_0x59bfb6);loggerPredictive[_0xef61('0x80')](_0xef61('0x1c6'),'Max\x20Drop\x20',_0x49ae97,_0xef61('0x1c7'),_0x59bfb6['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x59bfb6[_0xef61('0x43')]);}else if(!ifInterval(_0x59bfb6['dialPredictiveInterval'],_0x59bfb6['startProgressive'])&&_[_0xef61('0x42')](_0x59bfb6['startPredictive'])&&!_[_0xef61('0x42')](_0x59bfb6[_0xef61('0x2d')])){_0x59bfb6[_0xef61('0x2c')]=moment()[_0xef61('0x7b')](_0xef61('0xfd'));loggerPredictive[_0xef61('0x80')](_0x59bfb6[_0xef61('0x43')],_0xef61('0x1c8'),_0x59bfb6[_0xef61('0x2c')]);this[_0xef61('0xc0')](_0x59bfb6[_0xef61('0x1c0')])[_0xef61('0xba')](this[_0xef61('0x1c9')](_0x59bfb6))[_0xef61('0xba')](mergeDataErlangB(_0x59bfb6))[_0xef61('0xba')](this[_0xef61('0x1ca')](_0x59bfb6))['catch'](loggerCatchPredictive(_0xef61('0x1cb'),_0x59bfb6));}else if(!ifInterval(_0x59bfb6['dialPredictiveInterval'],_0x59bfb6[_0xef61('0x2c')])){_0x59bfb6[_0xef61('0x70')]=0x0;_0x59bfb6[_0xef61('0x2c')]=moment()[_0xef61('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xef61('0x80')](_0x59bfb6[_0xef61('0x43')],_0xef61('0x1cc'),_0x59bfb6[_0xef61('0x2c')]);clearInterval(_0x59bfb6['handlePredictive']);_0x59bfb6['handlePredictive']=undefined;this[_0xef61('0xc0')](_0x59bfb6[_0xef61('0x1c0')])[_0xef61('0xba')](this['getDataPredictive'](_0x59bfb6))[_0xef61('0xba')](mergeDataErlangB(_0x59bfb6))[_0xef61('0xba')](this[_0xef61('0x1ca')](_0x59bfb6))[_0xef61('0xb2')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x59bfb6));}else if(_0x59bfb6['predictiveIntervalAvailable']&&_0x252723<_0x59bfb6[_0xef61('0x73')]-_0x2ec689){freeVariablesPredictive(_0x59bfb6);loggerPredictive[_0xef61('0x80')](_0x59bfb6[_0xef61('0x43')],_0xef61('0x1cd'),_0x252723,_0xef61('0x1ce'),_0x59bfb6[_0xef61('0x73')],'-',_0x2ec689,'=',_0x59bfb6['predictiveIntervalAvailable']-_0x2ec689,')');}else if(_0x59bfb6[_0xef61('0x73')]&&_0x252723>_0x59bfb6[_0xef61('0x73')]+_0x8dd2c8){freeVariablesPredictive(_0x59bfb6);loggerPredictive[_0xef61('0x80')](_0x59bfb6[_0xef61('0x43')],_0xef61('0x1cd'),_0x252723,')\x20are\x20more\x20than\x20threshold\x20(',_0x59bfb6[_0xef61('0x73')],'+',_0x8dd2c8,'=',_0x59bfb6[_0xef61('0x73')]+_0x8dd2c8,')');}};Dialer[_0xef61('0x1f')][_0xef61('0x1c9')]=function(_0x5d2c66){var _0x2096a2=this;return function(_0x3a8399){return new BPromise(function(_0x435b36,_0x5861a2){_['merge'](_0x5d2c66,_0x3a8399[0x0]);if(checkGetDataPredictive(_0x3a8399[0x0])){var _0x338592=_0x5d2c66[_0xef61('0x73')]=_0x5d2c66['talking']+_0x5d2c66['available'];var _0x400828=_0x5d2c66[_0xef61('0x1c0')]*0x3c;var _0x4171a4=_0x3a8399[0x0][_0xef61('0x6d')]+_0x3a8399[0x0][_0xef61('0x6c')];var _0x2b3f6d=(_0x3a8399[0x0][_0xef61('0x6b')]+_0x3a8399[0x0][_0xef61('0x6e')]+_0x3a8399[0x0][_0xef61('0x85')])/_0x3a8399[0x0][_0xef61('0x74')];_0x5d2c66[_0xef61('0x1bb')]=_0x2b3f6d>0x0?_0x2b3f6d:0x1;switch(_0x5d2c66['dialPredictiveOptimization']){case'dropRate':var _0x3ff8ac=_0x5d2c66[_0xef61('0x1b6')]/0x64;return _0x2096a2[_0xef61('0x1cf')](_0x338592,_0x400828,_0x4171a4,_0x2b3f6d,_0x3ff8ac)[_0xef61('0xba')](function(_0x3f823a){return _0x435b36(_0x3f823a);});case'agentBusyFactor':var _0xbb2461=_0x5d2c66[_0xef61('0x1b6')]/0x64;return _0x2096a2['busyFactor'](_0x338592,_0x400828,_0x4171a4,_0x2b3f6d,_0xbb2461)['then'](function(_0x56deb5){return _0x435b36(_0x56deb5);});default:return _0x5861a2(msgResponse(_0xef61('0x1d0'),_0xef61('0x13b'),'Unknown\x20Predictive'));}}else{return _0x5861a2(msgResponse(_0xef61('0x1d0'),_0xef61('0x13b'),_0xef61('0x1d1')));}});};};Dialer[_0xef61('0x1f')][_0xef61('0x1d2')]=function(_0x126d23){var _0xdc79c3=this;return function(_0x52b1be){return new BPromise(function(_0x28f7ff,_0x5cdcb7){_['merge'](_0x126d23,_0x52b1be[0x0]);if(checkGetDataPredictive(_0x52b1be[0x0])){loggerPredictive[_0xef61('0x80')](JSON[_0xef61('0x7a')](_0x52b1be[0x0]));if(_0x126d23[_0xef61('0x1c2')]===_0xef61('0x1c3')){return _0xdc79c3['getVoiceQueueRtPauses'](_0x126d23['id'])[_0xef61('0xba')](function(_0x443170){var _0x5d3172=_0x126d23['loggedIn']-_0x443170[0x0][_0xef61('0x1d3')];var _0x378e46=_0x126d23[_0xef61('0x1c0')]*0x3c;var _0x14332a=_0x52b1be[0x0][_0xef61('0x6d')]+_0x52b1be[0x0]['predictiveIntervalAvgHoldtime'];var _0x191b8d=(_0x52b1be[0x0]['predictiveIntervalAnsweredCalls']+_0x52b1be[0x0][_0xef61('0x6e')]+_0x52b1be[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x52b1be[0x0][_0xef61('0x74')];var _0x3ddf90=_0x126d23['dialPredictiveOptimizationPercentage']/0x64;_0x126d23[_0xef61('0x72')]=_0x443170[0x0]['outboundQueuePauses']||0x0;_0x126d23[_0xef61('0x1bb')]=_0x191b8d>0x0?_0x191b8d:0x1;return _0xdc79c3[_0xef61('0x1cf')](_0x5d3172,_0x378e46,_0x14332a,_0x191b8d,_0x3ddf90);})[_0xef61('0xba')](function(_0x4e8bc0){return _0x28f7ff(_0x4e8bc0);})[_0xef61('0xb2')](function(_0x49f692){return _0x5cdcb7(msgResponse(_0xef61('0x1d4'),_0xef61('0x13b'),JSON[_0xef61('0x7a')](_0x49f692)));});}if(_0x126d23[_0xef61('0x1c2')]==='agentBusyFactor'){return _0xdc79c3[_0xef61('0xc8')](_0x126d23['id'])['then'](function(_0x4c2265){var _0x5029f3=_0x126d23['loggedIn']-_0x4c2265[0x0]['outboundQueuePauses'];var _0x8d1637=_0x126d23[_0xef61('0x1c0')]*0x3c;var _0xced255=_0x52b1be[0x0][_0xef61('0x6d')]+_0x52b1be[0x0]['predictiveIntervalAvgHoldtime'];var _0x5c3828=(_0x52b1be[0x0][_0xef61('0x6b')]+_0x52b1be[0x0][_0xef61('0x6e')]+_0x52b1be[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x52b1be[0x0]['predictiveIntervalTotalCalls'];var _0x447fbe=_0x126d23[_0xef61('0x1b6')]/0x64;_0x126d23['predictiveIntervalPauses']=_0x4c2265[0x0][_0xef61('0x1d3')]||0x0;_0x126d23[_0xef61('0x1bb')]=_0x5c3828>0x0?_0x5c3828:0x1;return _0xdc79c3[_0xef61('0x1d5')](_0x5029f3,_0x8d1637,_0xced255,_0x5c3828,_0x447fbe);})['then'](function(_0x251934){return _0x28f7ff(_0x251934);})[_0xef61('0xb2')](function(_0x238535){return _0x5cdcb7(msgResponse(_0xef61('0x1d4'),_0xef61('0x13b'),JSON[_0xef61('0x7a')](_0x238535)));});}}else{return _0x5cdcb7(msgResponse(_0xef61('0x1d0'),_0xef61('0x13b'),_0xef61('0x1d1')));}});};};Dialer[_0xef61('0x1f')][_0xef61('0x1ca')]=function(_0x54b39d){var _0x5a1177=this;return function(){var _0x26e215=0x0;var _0x4af907=Math[_0xef61('0x1ba')](_0x54b39d['erlangCallToSecond']*0x3e8);if(_0x4af907>0x0){_0x4af907=_0x4af907<0x64?0x64:_0x4af907;loggerPredictive[_0xef61('0x80')](_0x54b39d['name'],_0xef61('0x1d6'),_0x4af907,_0xef61('0x4c'));_0x54b39d[_0xef61('0x95')]=setInterval(function(){_0x5a1177[_0xef61('0x95')](_0x54b39d);loggerPredictiveCalls[_0xef61('0x80')](_0xef61('0x1d7'),_0x26e215+=0x1);},_0x4af907);}else{loggerPredictive[_0xef61('0x80')](_0x54b39d['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xef61('0x1f')][_0xef61('0x1d8')]=function(_0x299b89,_0x107ad5){var _0x3f7fed=this;return function(_0x28a808){if(_[_0xef61('0x4a')](_0x28a808)){if(_[_0xef61('0xb0')](_0x107ad5[_0xef61('0xd4')])||!_0x107ad5[_0xef61('0x1d9')]){if(_0x299b89['dialMethod']===_0xef61('0xa')){_0x299b89[_0xef61('0x122')]=_['isUndefined'](_0x299b89['queueStatusComplete'])?!![]:_0x299b89[_0xef61('0x122')];var _0x56698f=uuid['v4']();_0x3f7fed['actions'][_0x56698f]=new Action(_0x299b89,_0x107ad5,_0x56698f);loggerBooked[_0xef61('0x80')](_0xef61('0x1da'),_0x56698f,'queueStatusComplete:\x20',JSON[_0xef61('0x7a')](_0x299b89[_0xef61('0x122')]),_0xef61('0x1db'),_0x299b89['name']);if(_0x299b89[_0xef61('0x122')]){_0x299b89[_0xef61('0x122')]=![];_0x3f7fed[_0xef61('0x11f')][_0x3f7fed[_0xef61('0x28')][_0x56698f][_0xef61('0xb5')]]=[];ami[_0xef61('0xb1')]({'actionid':_0x56698f,'action':_0xef61('0x1dc'),'queue':_0x299b89[_0xef61('0x43')]})[_0xef61('0xb2')](function(_0xb54b88){_0x3f7fed[_0xef61('0xb4')](_0x299b89);_0x3f7fed[_0xef61('0xc2')]({'active':![],'ContactId':_0x3f7fed[_0xef61('0x28')][_0x56698f]['ContactId'],'ListId':_0x3f7fed[_0xef61('0x28')][_0x56698f][_0xef61('0xd3')],'VoiceQueueId':_0x3f7fed[_0xef61('0x28')][_0x56698f]['VoiceQueueId']||undefined,'CampaignId':_0x3f7fed[_0xef61('0x28')][_0x56698f][_0xef61('0xd6')]||undefined})['catch'](loggerCatch(_0xef61('0x1dd')));delete _0x3f7fed['actions'][_0x56698f];});}else{loggerBooked[_0xef61('0x80')]('[booked][checkContactBlack][else]',JSON[_0xef61('0x7a')](_0x299b89[_0xef61('0x122')]),_0xef61('0x1db'),_0x299b89[_0xef61('0x43')]);_0x3f7fed['updateOriginated'](_0x299b89);_0x3f7fed[_0xef61('0xc2')]({'active':![],'ContactId':_0x3f7fed['actions'][_0x56698f][_0xef61('0xd2')],'ListId':_0x3f7fed[_0xef61('0x28')][_0x56698f]['ListId'],'VoiceQueueId':_0x3f7fed[_0xef61('0x28')][_0x56698f][_0xef61('0xd5')]||undefined,'CampaignId':_0x3f7fed[_0xef61('0x28')][_0x56698f]['CampaignId']||undefined})[_0xef61('0xb2')](loggerCatch(_0xef61('0x1dd')));delete _0x3f7fed[_0xef61('0x28')][_0x56698f];}}else{return _0x3f7fed[_0xef61('0x15b')](_0x299b89,_0x107ad5);}}else{if(getDiff(_0x107ad5[_0xef61('0x1de')])<_0x299b89[_0xef61('0x1df')]*0x3c){if(_0x107ad5[_0xef61('0x1e0')]&&!_0x107ad5[_0xef61('0x1e0')][_0xef61('0x1e1')]){_0x3f7fed[_0xef61('0x21')][_0xef61('0x125')](_0x107ad5['id'])[_0xef61('0x127')](function(){_0x3f7fed['updateOriginated'](_0x299b89);});}else{_0x3f7fed[_0xef61('0xc3')]({'active':![]},_0x107ad5['id'],0x1)[_0xef61('0x127')](function(){console['log']('Contact\x20updated');_0x3f7fed[_0xef61('0xb4')](_0x299b89);});}}else{_0x299b89[_0xef61('0x68')]+=0x1;_0x3f7fed[_0xef61('0xb4')](_0x299b89);if(_0x299b89[_0xef61('0x1e2')]){_0x3f7fed[_0xef61('0xc2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x107ad5[_0xef61('0xd2')],'ListId':_0x107ad5[_0xef61('0xd3')],'VoiceQueueId':_0x107ad5[_0xef61('0xd5')]||undefined,'CampaignId':_0x107ad5[_0xef61('0xd6')]||undefined})[_0xef61('0xb2')](loggerCatch(_0xef61('0x1e3')));_0x3f7fed[_0xef61('0xcb')](createObjHistory(_0x299b89,_0x107ad5,'RECALLINQUEUE',0x17,_0xef61('0x1e4')))[_0xef61('0xb2')](loggerCatch(_0xef61('0x1e5')));}else{_0x3f7fed[_0xef61('0xd0')](createObjHistory(_0x299b89,_0x107ad5,_0xef61('0x1e6'),0x16,_0xef61('0x1e7')),_0xef61('0x1e8'),'[Originate][HistoryRecallClose]');}}}}else{_0x299b89[_0xef61('0x61')]+=0x1;_0x3f7fed[_0xef61('0xd0')](createObjHistory(_0x299b89,_0x107ad5,'BLACKLIST',0xd,'Blacklist'),_0xef61('0x1e9'),_0xef61('0x1ea'));throw'inBlackList';}};};Dialer['prototype'][_0xef61('0x153')]=function(_0x544a5f){var _0x25e349=this;var _0x22def7=[];var _0x4f320f=_0x544a5f[_0xef61('0x1eb')]-_0x544a5f[_0xef61('0x75')]-_0x544a5f[_0xef61('0x1ec')];emitCampaignSummary(_0x544a5f);if(_0x4f320f>0x0){if(_0x4f320f>this['maxNumberOriginate']){_0x4f320f=this[_0xef61('0x26')];}_0x544a5f[_0xef61('0x1ec')]+=_0x4f320f;this[_0xef61('0xc7')](_0x544a5f['id'],_0x4f320f,_0x544a5f['dialOrderByScheduledAt'])[_0xef61('0xba')](function(_0x562cae){_0x544a5f[_0xef61('0x1ec')]-=_0x4f320f;_0x544a5f[_0xef61('0x1ec')]=_0x544a5f[_0xef61('0x1ec')]>0x0?_0x544a5f[_0xef61('0x1ec')]:0x0;if(!checkContactEmpty(_0x562cae)){_0x544a5f[_0xef61('0x45')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xef61('0x80')](_0xef61('0x1ed')+_0x544a5f[_0xef61('0x43')]);}else{_0x544a5f[_0xef61('0x75')]+=_0x562cae[_0xef61('0x12a')];_0x544a5f[_0xef61('0x45')]='RUNNING';for(var _0x5d5b9c=0x0;_0x5d5b9c<_0x562cae[_0xef61('0x12a')];_0x5d5b9c+=0x1){_0x544a5f['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x562cae[_0x5d5b9c])||_[_0xef61('0xb0')](_0x562cae[_0x5d5b9c]['Contact'])||_[_0xef61('0xb0')](_0x562cae[_0x5d5b9c][_0xef61('0x15e')]['phone'])){_0x25e349['emptyContact'](_0xef61('0x1ee'),_0x544a5f,_0x562cae[_0x5d5b9c]);}else{_0x25e349[_0xef61('0xbe')](_[_0xef61('0xd1')](_0x562cae[_0x5d5b9c],[_0xef61('0xd6'),_0xef61('0x1ef')]))[_0xef61('0xba')](_0x25e349['checkContactBlack'](_0x544a5f,_0x562cae[_0x5d5b9c]))[_0xef61('0xb2')](_0x25e349['loggerHandler'](_0xef61('0x1f0'),_0x544a5f));}}}})[_0xef61('0xb2')](loggerGetContactDialer(_0xef61('0x1f1'),_0x544a5f,_0x4f320f));}};Dialer[_0xef61('0x1f')][_0xef61('0x14e')]=function(_0x473c96,_0x4e12b4){var _0x463386=this;var _0xec9252=[];var _0x3b2bca=_0x4e12b4>=0x1?_0x4e12b4:0x1;var _0x17ff51=[];if(_0x473c96[_0xef61('0x14c')]==='booked'){_0x3b2bca=0x1;}var _0x1cc4b8=Math[_0xef61('0x1ba')](_0x473c96[_0xef61('0x52')]*_0x3b2bca)-_0x473c96['originated']-_0x473c96['temp'];emitVoiceQueueSummary(_0x473c96);if(_0x473c96[_0xef61('0x1f2')]>0x0){var _0x4632ae=_0x473c96[_0xef61('0x1f2')]-_0x473c96[_0xef61('0x75')]-_0x473c96[_0xef61('0x56')]-_0x473c96[_0xef61('0x1ec')]-_0x473c96['pTalking'];if(_0x1cc4b8>_0x4632ae){_0x1cc4b8=_0x4632ae;}}if(_0x1cc4b8>0x0){if(_0x473c96[_0xef61('0x14c')]==='booked'){_0x1cc4b8=0x1;}if(_0x1cc4b8>this['maxNumberOriginate']){_0x1cc4b8=this[_0xef61('0x26')];}_0x473c96['temp']+=_0x1cc4b8;for(var _0x542d72 in this[_0xef61('0x24')]){if(this['agents'][_0xef61('0xae')](_0x542d72)){if(this['agents'][_0x542d72][_0xef61('0xea')]===_0xef61('0x1f3')&&this['agents'][_0x542d72][_0xef61('0xdc')]===_0xef61('0xdd')){_0xec9252[_0xef61('0x120')](this['agents'][_0x542d72]['id']);}}}this[_0xef61('0xc5')](_0x473c96['id'],_0xec9252,_0x1cc4b8,_0x473c96[_0xef61('0x1f4')])[_0xef61('0xba')](function(_0x1904fe){_0x473c96[_0xef61('0x1ec')]-=_0x1cc4b8;_0x473c96[_0xef61('0x1ec')]=_0x473c96['temp']>0x0?_0x473c96[_0xef61('0x1ec')]:0x0;if(!checkContactEmpty(_0x1904fe)){_0x463386[_0xef61('0xb8')](_0x473c96)[_0xef61('0xba')](sendMessageReschedule(_0x473c96))['catch'](loggerCatch(_0xef61('0xbb')));}else{_0x473c96[_0xef61('0x75')]+=_0x1904fe[_0xef61('0x12a')];_0x473c96[_0xef61('0x45')]=_0x473c96[_0xef61('0x14c')]==='booked'?'ACTIVE':_0xef61('0x1f5');for(var _0x5cca23=0x0;_0x5cca23<_0x1904fe[_0xef61('0x12a')];_0x5cca23+=0x1){if(_[_0xef61('0xb0')](_0x1904fe[_0x5cca23])||_[_0xef61('0xb0')](_0x1904fe[_0x5cca23]['Contact'])||_['isNil'](_0x1904fe[_0x5cca23][_0xef61('0x15e')][_0xef61('0x15f')])){_0x463386[_0xef61('0xcf')](_0xef61('0x1ee'),_0x473c96,_0x1904fe[_0x5cca23]);}else{_0x463386[_0xef61('0xbc')](_[_0xef61('0xd1')](_0x1904fe[_0x5cca23],[_0xef61('0xd5'),_0xef61('0x1ef')]))[_0xef61('0xba')](_0x463386[_0xef61('0x1d8')](_0x473c96,_0x1904fe[_0x5cca23]))[_0xef61('0xb2')](_0x463386[_0xef61('0xce')](_0xef61('0x1ee'),_0x473c96));}}}})[_0xef61('0xb2')](loggerGetContactDialer(_0xef61('0x1f6'),_0x473c96,_0x1cc4b8));}};Dialer[_0xef61('0x1f')][_0xef61('0x95')]=function(_0x49fa6d){var _0x4c0813=this;if(_0x49fa6d['dialLimitQueue']>0x0){var _0x214458=_0x49fa6d[_0xef61('0x1f2')]-_0x49fa6d[_0xef61('0x75')]-_0x49fa6d['talking'];if(_0x214458>0x0){this[_0xef61('0x1f7')](_0x49fa6d);}else{loggerPredictiveCalls[_0xef61('0x80')](_0xef61('0x1f8'));}}else{this[_0xef61('0x1f7')](_0x49fa6d);}};Dialer[_0xef61('0x1f')]['tryOriginatePredictive']=function(_0x40d3a9){var _0xcf6446=this;var _0x3562f4=[];_0x40d3a9[_0xef61('0x75')]+=0x1;for(var _0x2aca35 in this[_0xef61('0x24')]){if(this[_0xef61('0x24')][_0xef61('0xae')](_0x2aca35)){if(this[_0xef61('0x24')][_0x2aca35]['state']==='not_inuse'&&this[_0xef61('0x24')][_0x2aca35][_0xef61('0xdc')]===_0xef61('0xdd')){_0x3562f4[_0xef61('0x120')](this[_0xef61('0x24')][_0x2aca35]['id']);}}}this[_0xef61('0xc5')](_0x40d3a9['id'],_0x3562f4,0x1,_0x40d3a9[_0xef61('0x1f4')])['then'](function(_0x226eb1){if(!checkContactEmpty(_0x226eb1)){checkContactLowerLimitOriginate(_0x40d3a9,0x1,0x0);_0xcf6446[_0xef61('0xb8')](_0x40d3a9)[_0xef61('0xba')](sendMessageReschedule(_0x40d3a9))['catch'](loggerCatch(_0xef61('0xbb')));}else{_0x40d3a9[_0xef61('0x45')]=_0xef61('0x1f5');if(_['isNil'](_0x226eb1[0x0])||_[_0xef61('0xb0')](_0x226eb1[0x0][_0xef61('0x15e')])||_[_0xef61('0xb0')](_0x226eb1[0x0][_0xef61('0x15e')][_0xef61('0x15f')])){_0xcf6446['emptyContact'](_0xef61('0x1ee'),_0x40d3a9,_0x226eb1[0x0]);}else{_0xcf6446[_0xef61('0xbc')](_[_0xef61('0xd1')](_0x226eb1[0x0],[_0xef61('0xd5'),_0xef61('0x1ef')]))[_0xef61('0xba')](_0xcf6446['checkContactBlack'](_0x40d3a9,_0x226eb1[0x0]))[_0xef61('0xb2')](_0xcf6446[_0xef61('0xce')](_0xef61('0x1f9'),_0x40d3a9));}}})[_0xef61('0xb2')](loggerGetContactDialer(_0xef61('0x1fa'),_0x40d3a9,0x1));emitVoiceQueueSummary(_0x40d3a9);};Dialer[_0xef61('0x1f')][_0xef61('0x1cf')]=function(_0x39bb98,_0xc9e2b7,_0x44bfeb,_0x49ea99,_0x200a51,_0x4a68cf){loggerPredictive[_0xef61('0x80')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xef61('0x80')](_0xef61('0x1fb'),_0x39bb98);loggerPredictive[_0xef61('0x80')](_0xef61('0x1fc'),_0xc9e2b7);loggerPredictive[_0xef61('0x80')](_0xef61('0x1fd'),_0x44bfeb);loggerPredictive[_0xef61('0x80')]('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',_0x49ea99);loggerPredictive[_0xef61('0x80')](_0xef61('0x1fe'),_0x200a51);loggerPredictive[_0xef61('0x80')](_0xef61('0x91'));return new BPromise(function(_0x4384ae,_0x2017c0){if(_0x39bb98<=0x0||isNaN(_0x39bb98)){return _0x2017c0(msgResponse(_0xef61('0x1ff'),_0xef61('0x185'),_0xef61('0x200')+_0x39bb98));}if(_0x44bfeb<=0x0||isNaN(_0x44bfeb)){return _0x2017c0(msgResponse(_0xef61('0x1ff'),'Error',_0xef61('0x201')+_0x44bfeb));}if(_0x49ea99<=0x0||isNaN(_0x49ea99)){return _0x2017c0(msgResponse('[abandonmentRate]',_0xef61('0x185'),_0xef61('0x202')+_0x49ea99));}if(_0xc9e2b7<=0x0||isNaN(_0xc9e2b7)){return _0x2017c0(msgResponse(_0xef61('0x1ff'),_0xef61('0x185'),_0xef61('0x203')+_0xc9e2b7));}if(_0x200a51<=0x0||isNaN(_0x200a51)){return _0x2017c0(msgResponse('[abandonmentRate]',_0xef61('0x185'),'Amax\x20=\x20'+_0x200a51));}_0x4a68cf=_0x4a68cf||0x0;var _0x22a324=0x1/_0x44bfeb;var _0x418309=0x0;var _0xdec963=0x0;var _0x4fb328=0x0;var _0x4218a9=0x0;for(var _0x428e9f=0x0;_0x4fb328<_0x200a51;_0x428e9f+=0x1){_0xdec963=_0x428e9f/_0xc9e2b7;_0x418309=(_0x49ea99*_0xdec963+_0x4a68cf)/_0x22a324;_0x4fb328=erlangb(_0x418309,_0x39bb98);_0x4218a9=_0x418309/_0x39bb98*(0x1-erlangb(_0x418309,_0x39bb98));}return _0x4384ae({'erlangCalls':_0x428e9f,'erlangCallToSecond':_0xc9e2b7/_0x428e9f,'erlangAbandonmentRate':_0x4fb328,'erlangBusyFactor':_0x4218a9});});};Dialer[_0xef61('0x1f')][_0xef61('0x1d5')]=function(_0x45ee8e,_0x5ba857,_0x4dfeec,_0x2bc7bd,_0x195e17,_0x3d2a99){loggerPredictive['info'](_0xef61('0x204'));loggerPredictive[_0xef61('0x80')](_0xef61('0x1fb'),_0x45ee8e);loggerPredictive[_0xef61('0x80')](_0xef61('0x1fc'),_0x5ba857);loggerPredictive[_0xef61('0x80')]('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',_0x4dfeec);loggerPredictive['info'](_0xef61('0x205'),_0x2bc7bd);loggerPredictive[_0xef61('0x80')](_0xef61('0x206'),_0x195e17);loggerPredictive[_0xef61('0x80')]('---------------------------');return new BPromise(function(_0x30104c,_0x3c51fd){if(_0x45ee8e<=0x0||isNaN(_0x45ee8e)){return _0x3c51fd(msgResponse('[busyFactor]',_0xef61('0x185'),'m\x20=\x20'+_0x45ee8e));}if(_0x4dfeec<=0x0||isNaN(_0x4dfeec)){return _0x3c51fd(msgResponse(_0xef61('0x207'),_0xef61('0x185'),'Ts\x20=\x20'+_0x4dfeec));}if(_0x2bc7bd<=0x0||isNaN(_0x2bc7bd)){return _0x3c51fd(msgResponse(_0xef61('0x207'),_0xef61('0x185'),_0xef61('0x202')+_0x2bc7bd));}if(_0x5ba857<=0x0||isNaN(_0x5ba857)){return _0x3c51fd(msgResponse(_0xef61('0x207'),_0xef61('0x185'),'interval\x20=\x20'+_0x5ba857));}if(_0x195e17<=0x0||isNaN(_0x195e17)){return _0x3c51fd(msgResponse('[busyFactor]',_0xef61('0x185'),_0xef61('0x208')+_0x195e17));}_0x3d2a99=_0x3d2a99||0x0;var _0x47c932=0x1/_0x4dfeec;var _0x46afc0=0x0;var _0x3a7696=0x0;var _0x390a24=0x0;var _0x42f0f8=0x0;for(var _0x2ac778=0x0;_0x42f0f8<_0x195e17;_0x2ac778+=0x1){_0x3a7696=_0x2ac778/_0x5ba857;_0x46afc0=(_0x2bc7bd*_0x3a7696+_0x3d2a99)/_0x47c932;_0x390a24=erlangb(_0x46afc0,_0x45ee8e);_0x42f0f8=_0x46afc0/_0x45ee8e*(0x1-erlangb(_0x46afc0,_0x45ee8e));}return _0x30104c({'erlangCalls':_0x2ac778,'erlangCallToSecond':_0x5ba857/_0x2ac778,'erlangAbandonmentRate':_0x390a24,'erlangBusyFactor':_0x42f0f8});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 029be69..5a0ab25 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 _0x8e3b=['UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x5ab56f,_0x5978f3){var _0x1d0a82=function(_0x43688d){while(--_0x43688d){_0x5ab56f['push'](_0x5ab56f['shift']());}};_0x1d0a82(++_0x5978f3);}(_0x8e3b,0xbd));var _0xb8e3=function(_0x29c2bb,_0x1bde54){_0x29c2bb=_0x29c2bb-0x0;var _0x5446f1=_0x8e3b[_0x29c2bb];return _0x5446f1;};'use strict';var util=require(_0xb8e3('0x0'));var _=require(_0xb8e3('0x1'));var moment=require(_0xb8e3('0x2'));function getSeconds(_0xf03bac,_0x1e96e1){var _0x506d56=moment(_0xf03bac)['milliseconds'](0x0);var _0x7de443=moment(_0x1e96e1)[_0xb8e3('0x3')](0x0);return _0x506d56[_0xb8e3('0x4')](_0x7de443,_0xb8e3('0x5'));}function QueueCallerAbandon(_0x4a2af2,_0x84396d){this[_0xb8e3('0x6')]=_0x4a2af2[_0xb8e3('0x6')];this['type']=_0x4a2af2[_0xb8e3('0x7')];this[_0xb8e3('0x8')]=_0x4a2af2[_0xb8e3('0x7')]===_0xb8e3('0x9')?'queue':_0x4a2af2[_0xb8e3('0x7')];this[_0xb8e3('0xa')]=_0x4a2af2[_0xb8e3('0xa')];this[_0xb8e3('0xb')]=_0x4a2af2['countcongestionretry'];this[_0xb8e3('0xc')]=_0x4a2af2[_0xb8e3('0xc')];this[_0xb8e3('0xd')]=_0x4a2af2[_0xb8e3('0xa')]+_0x4a2af2[_0xb8e3('0xb')]+_0x4a2af2[_0xb8e3('0xc')]+_0x4a2af2[_0xb8e3('0xe')]+_0x4a2af2[_0xb8e3('0xf')]+_0x4a2af2[_0xb8e3('0x10')]+_0x4a2af2[_0xb8e3('0x11')]+_0x4a2af2['countagentrejectretry'];this[_0xb8e3('0xe')]=_0x4a2af2[_0xb8e3('0xe')];this['countdropretry']=_0x4a2af2[_0xb8e3('0xf')];this[_0xb8e3('0x10')]=_0x4a2af2[_0xb8e3('0x10')];this['countmachineretry']=_0x4a2af2[_0xb8e3('0x11')];this[_0xb8e3('0x12')]=_0x4a2af2['countagentrejectretry'];this[_0xb8e3('0x13')]=_0x84396d[_0xb8e3('0x13')];this[_0xb8e3('0x14')]=_0x4a2af2[_0xb8e3('0x15')];this[_0xb8e3('0x16')]=_0x4a2af2[_0xb8e3('0x17')];this[_0xb8e3('0x18')]=_0x4a2af2[_0xb8e3('0x18')];this['responsetime']=_0x4a2af2[_0xb8e3('0x19')];this[_0xb8e3('0x1a')]=_0x4a2af2[_0xb8e3('0x1a')];this[_0xb8e3('0x1b')]=this[_0xb8e3('0x1a')];this[_0xb8e3('0x1c')]=getSeconds(_0x4a2af2['responsetime'],_0x4a2af2[_0xb8e3('0x18')]);this[_0xb8e3('0x1d')]=getSeconds(this[_0xb8e3('0x1a')],_0x4a2af2[_0xb8e3('0x19')]);this[_0xb8e3('0x1e')]=0x0;this['queue']=_0x84396d[_0xb8e3('0x1f')];this[_0xb8e3('0x20')]=_0x84396d[_0xb8e3('0x21')];this[_0xb8e3('0x22')]=_0x84396d[_0xb8e3('0x22')];this[_0xb8e3('0x23')]=_0x4a2af2[_0xb8e3('0x23')];this[_0xb8e3('0x24')]=_0x4a2af2[_0xb8e3('0x24')];this['callbackat']=_0x4a2af2[_0xb8e3('0x25')];this[_0xb8e3('0x26')]=_0x4a2af2[_0xb8e3('0x26')];this[_0xb8e3('0x27')]=_0x4a2af2[_0xb8e3('0x27')];this[_0xb8e3('0x28')]=_0x4a2af2[_0xb8e3('0x28')];this[_0xb8e3('0x29')]=_0x4a2af2[_0xb8e3('0x29')];this[_0xb8e3('0x2a')]=_0x4a2af2[_0xb8e3('0x2a')];this[_0xb8e3('0x2b')]=_0x4a2af2[_0xb8e3('0x2b')];this['originatecalleridnum']=_0x4a2af2['originatecalleridnum']||'';this['originatecalleridname']=_0x4a2af2[_0xb8e3('0x2c')]||'';}module[_0xb8e3('0x2d')]=QueueCallerAbandon; \ No newline at end of file +var _0x99ba=['number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum'];(function(_0xa1396e,_0x1c1ade){var _0x5e7f81=function(_0x366a4f){while(--_0x366a4f){_0xa1396e['push'](_0xa1396e['shift']());}};_0x5e7f81(++_0x1c1ade);}(_0x99ba,0x1cf));var _0xa99b=function(_0x1e5f80,_0xb7127c){_0x1e5f80=_0x1e5f80-0x0;var _0x1f38ba=_0x99ba[_0x1e5f80];return _0x1f38ba;};'use strict';var util=require(_0xa99b('0x0'));var _=require(_0xa99b('0x1'));var moment=require(_0xa99b('0x2'));function getSeconds(_0x3f474d,_0x5acb81){var _0x34a27d=moment(_0x3f474d)[_0xa99b('0x3')](0x0);var _0x360cd1=moment(_0x5acb81)[_0xa99b('0x3')](0x0);return _0x34a27d[_0xa99b('0x4')](_0x360cd1,'seconds');}function QueueCallerAbandon(_0x7ef915,_0x1c13d1){this['scheduledat']=_0x7ef915[_0xa99b('0x5')];this[_0xa99b('0x6')]=_0x7ef915[_0xa99b('0x6')];this['campaigntype']=_0x7ef915[_0xa99b('0x6')]===_0xa99b('0x7')?_0xa99b('0x8'):_0x7ef915[_0xa99b('0x6')];this[_0xa99b('0x9')]=_0x7ef915[_0xa99b('0x9')];this['countcongestionretry']=_0x7ef915[_0xa99b('0xa')];this[_0xa99b('0xb')]=_0x7ef915[_0xa99b('0xb')];this[_0xa99b('0xc')]=_0x7ef915[_0xa99b('0x9')]+_0x7ef915[_0xa99b('0xa')]+_0x7ef915[_0xa99b('0xb')]+_0x7ef915[_0xa99b('0xd')]+_0x7ef915[_0xa99b('0xe')]+_0x7ef915[_0xa99b('0xf')]+_0x7ef915[_0xa99b('0x10')]+_0x7ef915[_0xa99b('0x11')];this[_0xa99b('0xd')]=_0x7ef915[_0xa99b('0xd')];this[_0xa99b('0xe')]=_0x7ef915['countdropretry'];this[_0xa99b('0xf')]=_0x7ef915[_0xa99b('0xf')];this[_0xa99b('0x10')]=_0x7ef915[_0xa99b('0x10')];this['countagentrejectretry']=_0x7ef915['countagentrejectretry'];this[_0xa99b('0x12')]=_0x1c13d1[_0xa99b('0x12')];this[_0xa99b('0x13')]=_0x7ef915['name'];this[_0xa99b('0x14')]=_0x7ef915[_0xa99b('0x15')];this[_0xa99b('0x16')]=_0x7ef915[_0xa99b('0x16')];this['responsetime']=_0x7ef915[_0xa99b('0x17')];this[_0xa99b('0x18')]=_0x7ef915[_0xa99b('0x18')];this[_0xa99b('0x19')]=this['droptime'];this[_0xa99b('0x1a')]=getSeconds(_0x7ef915[_0xa99b('0x17')],_0x7ef915[_0xa99b('0x16')]);this[_0xa99b('0x1b')]=getSeconds(this[_0xa99b('0x18')],_0x7ef915[_0xa99b('0x17')]);this[_0xa99b('0x1c')]=0x0;this['queue']=_0x1c13d1[_0xa99b('0x8')];this[_0xa99b('0x1d')]=_0x1c13d1[_0xa99b('0x1e')];this[_0xa99b('0x1f')]=_0x1c13d1['reason'];this['callback']=_0x7ef915[_0xa99b('0x20')];this['callbackuniqueid']=_0x7ef915[_0xa99b('0x21')];this[_0xa99b('0x22')]=_0x7ef915[_0xa99b('0x22')];this[_0xa99b('0x23')]=_0x7ef915[_0xa99b('0x23')];this[_0xa99b('0x24')]=_0x7ef915[_0xa99b('0x24')];this['ListId']=_0x7ef915[_0xa99b('0x25')];this[_0xa99b('0x26')]=_0x7ef915[_0xa99b('0x26')];this[_0xa99b('0x27')]=_0x7ef915[_0xa99b('0x27')];this[_0xa99b('0x28')]=_0x7ef915[_0xa99b('0x28')];this[_0xa99b('0x29')]=_0x7ef915[_0xa99b('0x29')]||'';this['originatecalleridname']=_0x7ef915[_0xa99b('0x2a')]||'';}module[_0xa99b('0x2b')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 173f362..0389991 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 _0xa563=['Trunk','fax','localstationid','headerinfo','path','AttachmentId','exports','util','lodash','moment','uniqueid','channel','format','%s/%s/%s'];(function(_0x54aacc,_0x1ac678){var _0x4a0977=function(_0xbdc782){while(--_0xbdc782){_0x54aacc['push'](_0x54aacc['shift']());}};_0x4a0977(++_0x1ac678);}(_0xa563,0x165));var _0x3a56=function(_0x134b6e,_0x21b5ca){_0x134b6e=_0x134b6e-0x0;var _0x2229a9=_0xa563[_0x134b6e];return _0x2229a9;};'use strict';var util=require(_0x3a56('0x0'));var _=require(_0x3a56('0x1'));var moment=require(_0x3a56('0x2'));function Action(_0x33f5ff,_0x29896b,_0x2b126e){this[_0x3a56('0x3')]=_0x33f5ff||undefined;this[_0x3a56('0x4')]=util[_0x3a56('0x5')](_0x3a56('0x6'),_0x29896b['tech'],_0x29896b[_0x3a56('0x7')]['name'],_0x2b126e[_0x3a56('0x8')]);this[_0x3a56('0x9')]=_0x29896b[_0x3a56('0x9')];this[_0x3a56('0xa')]=_0x29896b[_0x3a56('0xa')];this[_0x3a56('0xb')]=_0x2b126e[_0x3a56('0xb')];this[_0x3a56('0xc')]=_0x2b126e['AttachmentId'];}module[_0x3a56('0xd')]=Action; \ No newline at end of file +var _0x4331=['tech','Trunk','name','fax','localstationid','headerinfo','path','AttachmentId','exports','util','lodash','moment','channel','%s/%s/%s'];(function(_0x5cdf4b,_0x1122f7){var _0x3a1171=function(_0x4cf5eb){while(--_0x4cf5eb){_0x5cdf4b['push'](_0x5cdf4b['shift']());}};_0x3a1171(++_0x1122f7);}(_0x4331,0x79));var _0x1433=function(_0x2d3489,_0x2737ec){_0x2d3489=_0x2d3489-0x0;var _0x5e2bc1=_0x4331[_0x2d3489];return _0x5e2bc1;};'use strict';var util=require(_0x1433('0x0'));var _=require(_0x1433('0x1'));var moment=require(_0x1433('0x2'));function Action(_0x3ea41a,_0x246d1b,_0x25b3dc){this['uniqueid']=_0x3ea41a||undefined;this[_0x1433('0x3')]=util['format'](_0x1433('0x4'),_0x246d1b[_0x1433('0x5')],_0x246d1b[_0x1433('0x6')][_0x1433('0x7')],_0x25b3dc[_0x1433('0x8')]);this[_0x1433('0x9')]=_0x246d1b[_0x1433('0x9')];this[_0x1433('0xa')]=_0x246d1b[_0x1433('0xa')];this[_0x1433('0xb')]=_0x25b3dc[_0x1433('0xb')];this[_0x1433('0xc')]=_0x25b3dc[_0x1433('0xc')];}module[_0x1433('0xd')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 37ab501..8a1bf49 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 _0xb616=['addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','moment','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','hasOwnProperty','exten','uniqueid','channels','channel','info','\x20syncNewchannel\x20','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','name','.pdf','application/pdf','then','catch','error','stringify','\x20receiveFax\x20','merge','pick','response','AttachmentId','update','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','syncHangup','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','path','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','variablesAction'];(function(_0x5ec453,_0x30b0ba){var _0x25548f=function(_0x387b62){while(--_0x387b62){_0x5ec453['push'](_0x5ec453['shift']());}};_0x25548f(++_0x30b0ba);}(_0xb616,0x84));var _0x6b61=function(_0x3c955f,_0x22e822){_0x3c955f=_0x3c955f-0x0;var _0x90485c=_0xb616[_0x3c955f];return _0x90485c;};'use strict';var util=require(_0x6b61('0x0'));var _=require(_0x6b61('0x1'));var BPromise=require(_0x6b61('0x2'));var uuid=require('uuid');var moment=require(_0x6b61('0x3'));var path=require('path');var tiff2pdf=require(_0x6b61('0x4'));var gs=require('./util/gs');var logger=require(_0x6b61('0x5'))(_0x6b61('0x6'));var ami=require(_0x6b61('0x7'));var rpcDb=require(_0x6b61('0x8'));var Channel=require(_0x6b61('0x9'));var ut=require(_0x6b61('0xa'));var Action=require(_0x6b61('0xb'));var faxAccount=require(_0x6b61('0xc'));var attachment=require(_0x6b61('0xd'));var faxMessage=require(_0x6b61('0xe'));function Fax(_0x49806d){this['channels']={};this['faxAccounts']=_0x49806d[_0x6b61('0xf')];this[_0x6b61('0x10')]=_0x49806d[_0x6b61('0x10')];this[_0x6b61('0x11')]={};ami['on'](_0x6b61('0x12'),this[_0x6b61('0x13')][_0x6b61('0x14')](this));ami['on']('varset',this[_0x6b61('0x15')][_0x6b61('0x14')](this));ami['on'](_0x6b61('0x16'),this['syncNewState'][_0x6b61('0x14')](this));ami['on']('newexten',this[_0x6b61('0x17')][_0x6b61('0x14')](this));ami['on'](_0x6b61('0x18'),this[_0x6b61('0x19')]['bind'](this));ami['on']('receivefax',this[_0x6b61('0x1a')]['bind'](this));ami['on'](_0x6b61('0x1b'),this['syncHangup'][_0x6b61('0x14')](this));ami['on'](_0x6b61('0x1c'),this[_0x6b61('0x1d')][_0x6b61('0x14')](this));}Fax[_0x6b61('0x1e')][_0x6b61('0x13')]=function(_0x103d0d){if(_0x103d0d['context']==='from-voip-provider'){for(var _0x4fc2b2 in this[_0x6b61('0xf')]){if(this['faxAccounts'][_0x6b61('0x1f')](_0x4fc2b2)){if(_0x103d0d[_0x6b61('0x20')]===this[_0x6b61('0xf')][_0x4fc2b2]['localstationid']){this['channels'][_0x103d0d[_0x6b61('0x21')]]={};this[_0x6b61('0x22')][_0x103d0d['uniqueid']][_0x6b61('0x23')]=_0x103d0d[_0x6b61('0x23')];this[_0x6b61('0x22')][_0x103d0d['uniqueid']]['id']=this[_0x6b61('0xf')][_0x4fc2b2]['id'];this[_0x6b61('0x22')][_0x103d0d[_0x6b61('0x21')]]['name']=this[_0x6b61('0xf')][_0x4fc2b2]['name'];logger[_0x6b61('0x24')](_0x103d0d[_0x6b61('0x21')],_0x6b61('0x25'));}}}}if(this['actions'][_0x103d0d[_0x6b61('0x21')]]){this[_0x6b61('0x22')][_0x103d0d[_0x6b61('0x21')]]={};this[_0x6b61('0x22')][_0x103d0d[_0x6b61('0x21')]]['channel']=_0x103d0d[_0x6b61('0x23')];logger[_0x6b61('0x24')](_0x103d0d[_0x6b61('0x21')],_0x6b61('0x25'));}};Fax[_0x6b61('0x1e')][_0x6b61('0x15')]=function(_0x251ec4){if(this[_0x6b61('0x22')][_0x251ec4[_0x6b61('0x21')]]){for(var _0x38bcea in _0x251ec4[_0x6b61('0x26')]){if(_0x251ec4[_0x6b61('0x26')]['hasOwnProperty'](_0x38bcea)){this[_0x6b61('0x22')][_0x251ec4[_0x6b61('0x21')]][_0x38bcea]=_0x251ec4[_0x6b61('0x27')];}}}};Fax['prototype'][_0x6b61('0x28')]=function(_0x45f4f2){if(this[_0x6b61('0x22')][_0x45f4f2[_0x6b61('0x21')]]){this[_0x6b61('0x22')][_0x45f4f2[_0x6b61('0x21')]][_0x6b61('0x29')]=_0x45f4f2[_0x6b61('0x29')];this[_0x6b61('0x22')][_0x45f4f2[_0x6b61('0x21')]][_0x6b61('0x2a')]=_0x45f4f2[_0x6b61('0x2a')];}};Fax[_0x6b61('0x1e')][_0x6b61('0x17')]=function(_0x4a42d1){if(this[_0x6b61('0x22')][_0x4a42d1[_0x6b61('0x21')]]){for(var _0x5bee5a in _0x4a42d1[_0x6b61('0x26')]){if(_0x4a42d1['variable'][_0x6b61('0x1f')](_0x5bee5a)){this[_0x6b61('0x22')][_0x4a42d1[_0x6b61('0x21')]][_0x5bee5a]=_0x4a42d1[_0x6b61('0x27')];}}}};Fax['prototype'][_0x6b61('0x19')]=function(_0x1e7383){if(this[_0x6b61('0x22')][_0x1e7383['uniqueid']]){this[_0x6b61('0x22')][_0x1e7383[_0x6b61('0x21')]][_0x6b61('0x2b')]=_0x1e7383[_0x6b61('0x2b')];this[_0x6b61('0x22')][_0x1e7383['uniqueid']][_0x6b61('0x2c')]=_0x1e7383['status'];this[_0x6b61('0x22')][_0x1e7383['uniqueid']]['localstationid']=_0x1e7383[_0x6b61('0x2d')];this['channels'][_0x1e7383['uniqueid']][_0x6b61('0x2e')]=_0x1e7383[_0x6b61('0x2e')];logger[_0x6b61('0x24')](_0x1e7383[_0x6b61('0x21')],_0x6b61('0x2f'));}};Fax['prototype'][_0x6b61('0x1a')]=function(_0x3cc135){var _0x38e893=this;if(this['channels'][_0x3cc135[_0x6b61('0x21')]]){var _0x9a4ba4=this[_0x6b61('0x22')][_0x3cc135[_0x6b61('0x21')]]['id'];this['channels'][_0x3cc135[_0x6b61('0x21')]][_0x6b61('0x30')]=_0x3cc135[_0x6b61('0x30')];this[_0x6b61('0x22')][_0x3cc135[_0x6b61('0x21')]][_0x6b61('0x31')]=_0x3cc135[_0x6b61('0x31')];this['channels'][_0x3cc135['uniqueid']]['localstationid']=_0x3cc135[_0x6b61('0x2d')];this[_0x6b61('0x22')][_0x3cc135[_0x6b61('0x21')]][_0x6b61('0x32')]=_0x3cc135['resolution'];this[_0x6b61('0x22')][_0x3cc135[_0x6b61('0x21')]][_0x6b61('0x33')]=_0x3cc135[_0x6b61('0x33')];this['channels'][_0x3cc135[_0x6b61('0x21')]][_0x6b61('0x2e')]=_0x3cc135[_0x6b61('0x2e')];this[_0x6b61('0x22')][_0x3cc135[_0x6b61('0x21')]][_0x6b61('0x34')]=_0x3cc135[_0x6b61('0x34')];if(this['channels'][_0x3cc135['uniqueid']][_0x6b61('0x31')]>0x0){tiff2pdf(_0x3cc135[_0x6b61('0x2e')],_0x6b61('0x35'),function(_0x269bae){logger['info'](_0x3cc135[_0x6b61('0x21')],_0x6b61('0x36'),_0x269bae[_0x6b61('0x37')]);attachment[_0x6b61('0x38')]({'name':path[_0x6b61('0x39')](_0x3cc135[_0x6b61('0x2e')])[_0x6b61('0x3a')],'basename':path[_0x6b61('0x39')](_0x3cc135[_0x6b61('0x2e')])['name']+_0x6b61('0x3b'),'type':_0x6b61('0x3c')})[_0x6b61('0x3d')](function(_0x2b91d4){faxAccount['notify'](_0x9a4ba4,{'from':_0x3cc135[_0x6b61('0x34')],'mapKey':_0x6b61('0x6'),'body':path['parse'](_0x3cc135[_0x6b61('0x2e')])['name']+_0x6b61('0x3b'),'AttachmentId':_0x2b91d4['id']})[_0x6b61('0x3e')](function(_0x148993){logger[_0x6b61('0x3f')](_0x3cc135[_0x6b61('0x21')],'\x20notify\x20',JSON[_0x6b61('0x40')](_0x148993));});})[_0x6b61('0x3e')](function(_0x3a1ddc){logger[_0x6b61('0x3f')](_0x3cc135[_0x6b61('0x21')],_0x6b61('0x41'),JSON[_0x6b61('0x40')](_0x3a1ddc));});});}logger['info'](_0x3cc135[_0x6b61('0x21')],_0x6b61('0x41'));}};Fax[_0x6b61('0x1e')][_0x6b61('0x1d')]=function(_0x2db879){if(this['actions'][_0x2db879[_0x6b61('0x21')]]){_[_0x6b61('0x42')](this[_0x6b61('0x22')][_0x2db879[_0x6b61('0x21')]],_[_0x6b61('0x43')](_0x2db879,[_0x6b61('0x44'),'reason']));}};function updateStatus(_0xa331af){if(_0xa331af[_0x6b61('0x45')]){faxMessage[_0x6b61('0x46')](_0xa331af[_0x6b61('0x45')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x6b61('0x3d')](function(_0x579f69){ut[_0x6b61('0x47')]('[Fax][Message][Error][Updated]',_0x579f69);})[_0x6b61('0x3e')](function(_0x23f89b){ut[_0x6b61('0x47')](_0x6b61('0x48'),_0x23f89b);});}else{ut[_0x6b61('0x47')](_0x6b61('0x49'));}}Fax[_0x6b61('0x1e')][_0x6b61('0x4a')]=function(_0x26ea3d,_0x5918d6,_0x547a2c){var _0xd0f5f=this;var _0x580f40={};if(_0x5918d6){_0x580f40={'read':_0x5918d6};}else{_0x580f40={'failMessage':_0x547a2c};}if(this[_0x6b61('0x11')][_0x26ea3d][_0x6b61('0x45')]){faxMessage[_0x6b61('0x46')](this['actions'][_0x26ea3d][_0x6b61('0x45')],_0x580f40)['then'](function(_0x2da395){ut[_0x6b61('0x47')](_0x6b61('0x4b'),_0x2da395);})['catch'](function(_0x493385){ut[_0x6b61('0x47')](_0x6b61('0x4c'),_0x493385);})[_0x6b61('0x4d')](function(){delete _0xd0f5f[_0x6b61('0x22')][_0x26ea3d];delete _0xd0f5f[_0x6b61('0x11')][_0x26ea3d];});}else{ut[_0x6b61('0x47')]('[Fax][Message][NoUpdate2]');delete this[_0x6b61('0x22')][_0x26ea3d];delete this['actions'][_0x26ea3d];}};Fax[_0x6b61('0x1e')][_0x6b61('0x4e')]=function(_0x17ad8b){var _0x253e13=this;if(this[_0x6b61('0x22')][_0x17ad8b[_0x6b61('0x21')]]){if(this[_0x6b61('0x11')][_0x17ad8b[_0x6b61('0x21')]]){this['channels'][_0x17ad8b[_0x6b61('0x21')]]['id']=this[_0x6b61('0x11')][_0x17ad8b[_0x6b61('0x21')]]['id'];this[_0x6b61('0x22')][_0x17ad8b[_0x6b61('0x21')]][_0x6b61('0x3a')]=this[_0x6b61('0x11')][_0x17ad8b[_0x6b61('0x21')]]['name'];}logger[_0x6b61('0x24')](_0x17ad8b[_0x6b61('0x21')],this[_0x6b61('0x11')][_0x17ad8b[_0x6b61('0x21')]]?_0x6b61('0x4f'):'\x20hangup\x20faxRiceive\x20',JSON[_0x6b61('0x40')](this[_0x6b61('0x22')][_0x17ad8b[_0x6b61('0x21')]]));if(this['actions'][_0x17ad8b[_0x6b61('0x21')]]){if(this[_0x6b61('0x22')][_0x17ad8b[_0x6b61('0x21')]][_0x6b61('0x50')]>0x0&&this[_0x6b61('0x22')][_0x17ad8b[_0x6b61('0x21')]][_0x6b61('0x18')]===_0x6b61('0x51')){this[_0x6b61('0x4a')](_0x17ad8b[_0x6b61('0x21')],!![]);}else{this[_0x6b61('0x4a')](_0x17ad8b[_0x6b61('0x21')],![],this[_0x6b61('0x22')][_0x17ad8b['uniqueid']][_0x6b61('0x52')]?'SENDING\x20FAILED:\x20'+this['channels'][_0x17ad8b[_0x6b61('0x21')]]['faxstatusstring']:_0x6b61('0x53'));}}}};Fax[_0x6b61('0x1e')][_0x6b61('0x54')]=function(_0x54d266){var _0x5b74bb=this;return new BPromise(function(_0x4e349d,_0x5c57ff){_0x5b74bb[_0x6b61('0x55')](_0x54d266,_0x5b74bb[_0x6b61('0xf')][_0x54d266[_0x6b61('0x56')]])[_0x6b61('0x3d')](function(_0x5c8887){ut[_0x6b61('0x47')](_0x6b61('0x57'),_0x5c8887);_0x4e349d(ut[_0x6b61('0x37')](_0x6b61('0x58')));})[_0x6b61('0x3e')](function(_0x53c1eb){ut[_0x6b61('0x47')](_0x6b61('0x59'),_0x53c1eb);updateStatus(_0x54d266);_0x5c57ff(ut[_0x6b61('0x37')]('Fax\x20failed'));});});};Fax[_0x6b61('0x1e')]['checkAfterSend']=function(_0x4a2a55){var _0x1bca09=this;return new BPromise(function(_0x16c97c,_0x3816d2){var _0x20e09c=_0x1bca09['checkTrunk'](_0x1bca09['faxAccounts'][_0x4a2a55[_0x6b61('0x56')]][_0x6b61('0x5a')],_0x4a2a55);if(_0x20e09c[_0x6b61('0x5b')]){_0x16c97c(ut['message']('Trunk\x20Reachable'));}else{_0x3816d2(ut[_0x6b61('0x37')](_0x20e09c[_0x6b61('0x37')]));}});};function originate(_0x3be362,_0x48ac3a,_0x2fabee){return new BPromise(function(_0x34a9ad,_0x36f5c7){if(_0x2fabee){var _0x124409=util[_0x6b61('0x5c')](_0x6b61('0x5d'),path[_0x6b61('0x39')](_0x3be362['path'])['name'],_0x3be362['path']);gs[_0x6b61('0x5e')](_0x124409)[_0x6b61('0x3d')](function(){_0x3be362[_0x6b61('0x5f')]=util[_0x6b61('0x5c')](_0x6b61('0x60'),path[_0x6b61('0x39')](_0x3be362[_0x6b61('0x5f')])[_0x6b61('0x61')],path['parse'](_0x3be362[_0x6b61('0x5f')])['name']);_0x48ac3a['XMF-PATH']=_0x3be362['path'];ut[_0x6b61('0x47')](_0x6b61('0x62'),'');ami['Action'](ut[_0x6b61('0x63')](_0x3be362,_0x48ac3a))['then'](function(_0x1bd305){_0x34a9ad(_0x1bd305);})[_0x6b61('0x3e')](function(_0x4c3218){_0x36f5c7(_0x4c3218);});})['catch'](function(_0x2df216){_0x36f5c7(_0x2df216);});}else{ami['Action'](ut[_0x6b61('0x63')](_0x3be362,_0x48ac3a))[_0x6b61('0x3d')](function(_0x4c6619){_0x34a9ad(_0x4c6619);})[_0x6b61('0x3e')](function(_0x5b8547){_0x36f5c7(_0x5b8547);});}});}Fax['prototype']['execOriginate']=function(_0xe68b33,_0x4ef16b){var _0x2e70e9=this;return new BPromise(function(_0x42c448,_0xe6e370){var _0x9ad96d=uuid['v4']();var _0x31018f=ut[_0x6b61('0x64')](_0xe68b33,_0x4ef16b);_0x2e70e9[_0x6b61('0x11')][_0x9ad96d]=new Action(_0x9ad96d,_0x4ef16b,_0xe68b33);var _0x5e8ec4=_0x2e70e9[_0x6b61('0x11')][_0x9ad96d];if(path[_0x6b61('0x39')](_0xe68b33[_0x6b61('0x5f')])[_0x6b61('0x65')]===_0x6b61('0x3b')){originate(_0x5e8ec4,_0x31018f,!![])[_0x6b61('0x3d')](function(_0xe7ecdc){_0x42c448(_0xe7ecdc);})[_0x6b61('0x3e')](function(_0x40eb81){_0xe6e370(_0x40eb81);});}else{originate(_0x5e8ec4,_0x31018f,![])[_0x6b61('0x3d')](function(_0x3d1cc4){_0x42c448(_0x3d1cc4);})[_0x6b61('0x3e')](function(_0x4a5c99){_0xe6e370(_0x4a5c99);});}});};Fax[_0x6b61('0x1e')]['isTrunkReachable']=function(_0x174d56){return!_['isNil'](_0x174d56)&&!_[_0x6b61('0x66')](_0x174d56['name'])&&!_[_0x6b61('0x66')](_0x174d56[_0x6b61('0x67')])&&_0x174d56[_0x6b61('0x67')]&&!_[_0x6b61('0x66')](this[_0x6b61('0x10')][util['format']('SIP/%s',_0x174d56[_0x6b61('0x3a')])])&&!_[_0x6b61('0x66')](this[_0x6b61('0x10')][util[_0x6b61('0x5c')](_0x6b61('0x68'),_0x174d56['name'])]['status'])&&(this['trunks'][util[_0x6b61('0x5c')]('SIP/%s',_0x174d56[_0x6b61('0x3a')])][_0x6b61('0x2c')]===_0x6b61('0x69')||this[_0x6b61('0x10')][util[_0x6b61('0x5c')](_0x6b61('0x68'),_0x174d56[_0x6b61('0x3a')])][_0x6b61('0x2c')]===_0x6b61('0x6a'));};Fax['prototype'][_0x6b61('0x6b')]=function(_0x5ee47e,_0x13cb57){if(!this[_0x6b61('0x6c')](_0x5ee47e)){ut[_0x6b61('0x47')](_0x6b61('0x6d'),_[_0x6b61('0x66')](_0x5ee47e)?'':_0x5ee47e['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x6b61('0x66')](_0x13cb57[_0x6b61('0x6')])){ut[_0x6b61('0x47')](_0x6b61('0x6e'),JSON[_0x6b61('0x40')](_0x13cb57));return{'isValid':![],'message':_0x6b61('0x6f')};}if(_['isNil'](_0x13cb57[_0x6b61('0x5f')])){ut['logger'](_0x6b61('0x70'),JSON[_0x6b61('0x40')](_0x13cb57));return{'isValid':![],'message':_0x6b61('0x71')};}return{'isValid':!![],'message':_0x6b61('0x72')};};module[_0x6b61('0x73')]=Fax; \ No newline at end of file +var _0x7312=['syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','moment','path','tiff2pdf','fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','newstate'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x7312,0xd2));var _0x2731=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x7312[_0x2e4e19];return _0x9ba20b;};'use strict';var util=require(_0x2731('0x0'));var _=require(_0x2731('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x2731('0x2'));var path=require(_0x2731('0x3'));var tiff2pdf=require(_0x2731('0x4'));var gs=require('./util/gs');var logger=require('../../../config/logger')(_0x2731('0x5'));var ami=require(_0x2731('0x6'));var rpcDb=require('./rpcDb');var Channel=require(_0x2731('0x7'));var ut=require(_0x2731('0x8'));var Action=require(_0x2731('0x9'));var faxAccount=require(_0x2731('0xa'));var attachment=require(_0x2731('0xb'));var faxMessage=require(_0x2731('0xc'));function Fax(_0x1f6ad0){this[_0x2731('0xd')]={};this['faxAccounts']=_0x1f6ad0[_0x2731('0xe')];this[_0x2731('0xf')]=_0x1f6ad0[_0x2731('0xf')];this[_0x2731('0x10')]={};ami['on'](_0x2731('0x11'),this[_0x2731('0x12')][_0x2731('0x13')](this));ami['on'](_0x2731('0x14'),this['syncVarSet'][_0x2731('0x13')](this));ami['on'](_0x2731('0x15'),this[_0x2731('0x16')]['bind'](this));ami['on'](_0x2731('0x17'),this[_0x2731('0x18')][_0x2731('0x13')](this));ami['on'](_0x2731('0x19'),this[_0x2731('0x1a')][_0x2731('0x13')](this));ami['on']('receivefax',this[_0x2731('0x1b')][_0x2731('0x13')](this));ami['on'](_0x2731('0x1c'),this[_0x2731('0x1d')][_0x2731('0x13')](this));ami['on']('originateresponse',this[_0x2731('0x1e')][_0x2731('0x13')](this));}Fax[_0x2731('0x1f')][_0x2731('0x12')]=function(_0x2f3fe7){if(_0x2f3fe7[_0x2731('0x20')]===_0x2731('0x21')){for(var _0x3c45e8 in this[_0x2731('0xe')]){if(this['faxAccounts'][_0x2731('0x22')](_0x3c45e8)){if(_0x2f3fe7['exten']===this[_0x2731('0xe')][_0x3c45e8][_0x2731('0x23')]){this[_0x2731('0xd')][_0x2f3fe7[_0x2731('0x24')]]={};this['channels'][_0x2f3fe7['uniqueid']][_0x2731('0x25')]=_0x2f3fe7['channel'];this[_0x2731('0xd')][_0x2f3fe7[_0x2731('0x24')]]['id']=this[_0x2731('0xe')][_0x3c45e8]['id'];this['channels'][_0x2f3fe7[_0x2731('0x24')]][_0x2731('0x26')]=this[_0x2731('0xe')][_0x3c45e8][_0x2731('0x26')];logger[_0x2731('0x27')](_0x2f3fe7['uniqueid'],_0x2731('0x28'));}}}}if(this['actions'][_0x2f3fe7['uniqueid']]){this[_0x2731('0xd')][_0x2f3fe7['uniqueid']]={};this[_0x2731('0xd')][_0x2f3fe7[_0x2731('0x24')]]['channel']=_0x2f3fe7['channel'];logger[_0x2731('0x27')](_0x2f3fe7['uniqueid'],_0x2731('0x28'));}};Fax[_0x2731('0x1f')][_0x2731('0x29')]=function(_0x2a1171){if(this[_0x2731('0xd')][_0x2a1171[_0x2731('0x24')]]){for(var _0x2c98e0 in _0x2a1171[_0x2731('0x2a')]){if(_0x2a1171['variable'][_0x2731('0x22')](_0x2c98e0)){this['channels'][_0x2a1171['uniqueid']][_0x2c98e0]=_0x2a1171[_0x2731('0x2b')];}}}};Fax[_0x2731('0x1f')]['syncNewState']=function(_0x3a8028){if(this['channels'][_0x3a8028['uniqueid']]){this[_0x2731('0xd')][_0x3a8028[_0x2731('0x24')]][_0x2731('0x2c')]=_0x3a8028['channelstate'];this['channels'][_0x3a8028[_0x2731('0x24')]][_0x2731('0x2d')]=_0x3a8028[_0x2731('0x2d')];}};Fax['prototype'][_0x2731('0x18')]=function(_0x3f4e98){if(this[_0x2731('0xd')][_0x3f4e98['uniqueid']]){for(var _0x1e5a3f in _0x3f4e98[_0x2731('0x2a')]){if(_0x3f4e98[_0x2731('0x2a')][_0x2731('0x22')](_0x1e5a3f)){this[_0x2731('0xd')][_0x3f4e98['uniqueid']][_0x1e5a3f]=_0x3f4e98['value'];}}}};Fax['prototype'][_0x2731('0x1a')]=function(_0x39f054){if(this[_0x2731('0xd')][_0x39f054[_0x2731('0x24')]]){this['channels'][_0x39f054[_0x2731('0x24')]][_0x2731('0x2e')]=_0x39f054[_0x2731('0x2e')];this[_0x2731('0xd')][_0x39f054[_0x2731('0x24')]][_0x2731('0x2f')]=_0x39f054['status'];this['channels'][_0x39f054[_0x2731('0x24')]]['localstationid']=_0x39f054['localstationid'];this[_0x2731('0xd')][_0x39f054[_0x2731('0x24')]][_0x2731('0x30')]=_0x39f054['filename'];logger[_0x2731('0x27')](_0x39f054[_0x2731('0x24')],_0x2731('0x31'));}};Fax[_0x2731('0x1f')][_0x2731('0x1b')]=function(_0x34e94d){var _0x14b554=this;if(this['channels'][_0x34e94d[_0x2731('0x24')]]){var _0x3393c7=this[_0x2731('0xd')][_0x34e94d[_0x2731('0x24')]]['id'];this[_0x2731('0xd')][_0x34e94d[_0x2731('0x24')]]['remotestationid']=_0x34e94d['remotestationid'];this[_0x2731('0xd')][_0x34e94d[_0x2731('0x24')]][_0x2731('0x32')]=_0x34e94d['pagestransferred'];this['channels'][_0x34e94d[_0x2731('0x24')]][_0x2731('0x23')]=_0x34e94d[_0x2731('0x23')];this['channels'][_0x34e94d[_0x2731('0x24')]]['resolution']=_0x34e94d[_0x2731('0x33')];this[_0x2731('0xd')][_0x34e94d[_0x2731('0x24')]]['transferrate']=_0x34e94d[_0x2731('0x34')];this['channels'][_0x34e94d[_0x2731('0x24')]][_0x2731('0x30')]=_0x34e94d[_0x2731('0x30')];this[_0x2731('0xd')][_0x34e94d[_0x2731('0x24')]][_0x2731('0x35')]=_0x34e94d['calleridnum'];if(this[_0x2731('0xd')][_0x34e94d['uniqueid']][_0x2731('0x32')]>0x0){tiff2pdf(_0x34e94d[_0x2731('0x30')],_0x2731('0x36'),function(_0x385659){logger[_0x2731('0x27')](_0x34e94d[_0x2731('0x24')],_0x2731('0x37'),_0x385659['message']);attachment[_0x2731('0x38')]({'name':path[_0x2731('0x39')](_0x34e94d[_0x2731('0x30')])[_0x2731('0x26')],'basename':path[_0x2731('0x39')](_0x34e94d[_0x2731('0x30')])['name']+_0x2731('0x3a'),'type':_0x2731('0x3b')})[_0x2731('0x3c')](function(_0x318cc8){faxAccount[_0x2731('0x3d')](_0x3393c7,{'from':_0x34e94d['calleridnum'],'mapKey':'fax','body':path[_0x2731('0x39')](_0x34e94d[_0x2731('0x30')])[_0x2731('0x26')]+_0x2731('0x3a'),'AttachmentId':_0x318cc8['id']})[_0x2731('0x3e')](function(_0x2d7b37){logger[_0x2731('0x3f')](_0x34e94d[_0x2731('0x24')],_0x2731('0x40'),JSON[_0x2731('0x41')](_0x2d7b37));});})[_0x2731('0x3e')](function(_0x4ed4a5){logger[_0x2731('0x3f')](_0x34e94d[_0x2731('0x24')],_0x2731('0x42'),JSON[_0x2731('0x41')](_0x4ed4a5));});});}logger[_0x2731('0x27')](_0x34e94d[_0x2731('0x24')],_0x2731('0x42'));}};Fax[_0x2731('0x1f')][_0x2731('0x1e')]=function(_0x2fd7aa){if(this[_0x2731('0x10')][_0x2fd7aa[_0x2731('0x24')]]){_['merge'](this[_0x2731('0xd')][_0x2fd7aa[_0x2731('0x24')]],_[_0x2731('0x43')](_0x2fd7aa,[_0x2731('0x44'),_0x2731('0x45')]));}};function updateStatus(_0x1b833b){if(_0x1b833b[_0x2731('0x46')]){faxMessage[_0x2731('0x47')](_0x1b833b[_0x2731('0x46')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x2731('0x3c')](function(_0x449f24){ut[_0x2731('0x48')]('[Fax][Message][Error][Updated]',_0x449f24);})[_0x2731('0x3e')](function(_0xff583e){ut[_0x2731('0x48')]('[Fax][Message][Error][NoUpdate1]',_0xff583e);});}else{ut[_0x2731('0x48')](_0x2731('0x49'));}}Fax[_0x2731('0x1f')][_0x2731('0x4a')]=function(_0x54a948,_0x4442d2,_0x1ac6d1){var _0x6ea982=this;var _0x4fcbdb={};if(_0x4442d2){_0x4fcbdb={'read':_0x4442d2};}else{_0x4fcbdb={'failMessage':_0x1ac6d1};}if(this[_0x2731('0x10')][_0x54a948][_0x2731('0x46')]){faxMessage[_0x2731('0x47')](this[_0x2731('0x10')][_0x54a948]['AttachmentId'],_0x4fcbdb)[_0x2731('0x3c')](function(_0x33295f){ut[_0x2731('0x48')](_0x2731('0x4b'),_0x33295f);})[_0x2731('0x3e')](function(_0x113027){ut[_0x2731('0x48')](_0x2731('0x4c'),_0x113027);})['finally'](function(){delete _0x6ea982[_0x2731('0xd')][_0x54a948];delete _0x6ea982[_0x2731('0x10')][_0x54a948];});}else{ut[_0x2731('0x48')](_0x2731('0x4d'));delete this['channels'][_0x54a948];delete this[_0x2731('0x10')][_0x54a948];}};Fax[_0x2731('0x1f')][_0x2731('0x1d')]=function(_0x2c8614){var _0x55ffa0=this;if(this[_0x2731('0xd')][_0x2c8614[_0x2731('0x24')]]){if(this[_0x2731('0x10')][_0x2c8614[_0x2731('0x24')]]){this[_0x2731('0xd')][_0x2c8614[_0x2731('0x24')]]['id']=this['actions'][_0x2c8614[_0x2731('0x24')]]['id'];this[_0x2731('0xd')][_0x2c8614[_0x2731('0x24')]][_0x2731('0x26')]=this[_0x2731('0x10')][_0x2c8614[_0x2731('0x24')]][_0x2731('0x26')];}logger['info'](_0x2c8614['uniqueid'],this[_0x2731('0x10')][_0x2c8614[_0x2731('0x24')]]?'\x20hangup\x20sendFile\x20':_0x2731('0x4e'),JSON[_0x2731('0x41')](this[_0x2731('0xd')][_0x2c8614[_0x2731('0x24')]]));if(this[_0x2731('0x10')][_0x2c8614['uniqueid']]){if(this[_0x2731('0xd')][_0x2c8614[_0x2731('0x24')]][_0x2731('0x4f')]>0x0&&this[_0x2731('0xd')][_0x2c8614['uniqueid']][_0x2731('0x19')]==='SUCCESS'){this[_0x2731('0x4a')](_0x2c8614[_0x2731('0x24')],!![]);}else{this[_0x2731('0x4a')](_0x2c8614[_0x2731('0x24')],![],this['channels'][_0x2c8614[_0x2731('0x24')]][_0x2731('0x50')]?_0x2731('0x51')+this[_0x2731('0xd')][_0x2c8614[_0x2731('0x24')]][_0x2731('0x50')]:_0x2731('0x52'));}}}};Fax['prototype']['send']=function(_0x9f02f8){var _0xbfa4d4=this;return new BPromise(function(_0x4be4b9,_0x391296){_0xbfa4d4[_0x2731('0x53')](_0x9f02f8,_0xbfa4d4[_0x2731('0xe')][_0x9f02f8['FaxAccountId']])[_0x2731('0x3c')](function(_0x9bfa86){ut['logger'](_0x2731('0x54'),_0x9bfa86);_0x4be4b9(ut[_0x2731('0x55')](_0x2731('0x56')));})['catch'](function(_0x522392){ut[_0x2731('0x48')](_0x2731('0x57'),_0x522392);updateStatus(_0x9f02f8);_0x391296(ut[_0x2731('0x55')](_0x2731('0x58')));});});};Fax['prototype'][_0x2731('0x59')]=function(_0x457a33){var _0x2021de=this;return new BPromise(function(_0x1f28e8,_0x441cf1){var _0x3354a5=_0x2021de[_0x2731('0x5a')](_0x2021de['faxAccounts'][_0x457a33['FaxAccountId']]['Trunk'],_0x457a33);if(_0x3354a5[_0x2731('0x5b')]){_0x1f28e8(ut[_0x2731('0x55')](_0x2731('0x5c')));}else{_0x441cf1(ut[_0x2731('0x55')](_0x3354a5[_0x2731('0x55')]));}});};function originate(_0x309b4e,_0x2aafef,_0x1733a5){return new BPromise(function(_0x128b82,_0x290305){if(_0x1733a5){var _0x30f602=util[_0x2731('0x5d')](_0x2731('0x5e'),path[_0x2731('0x39')](_0x309b4e[_0x2731('0x3')])['name'],_0x309b4e[_0x2731('0x3')]);gs[_0x2731('0x5f')](_0x30f602)[_0x2731('0x3c')](function(){_0x309b4e['path']=util['format'](_0x2731('0x60'),path[_0x2731('0x39')](_0x309b4e[_0x2731('0x3')])[_0x2731('0x61')],path[_0x2731('0x39')](_0x309b4e[_0x2731('0x3')])[_0x2731('0x26')]);_0x2aafef[_0x2731('0x62')]=_0x309b4e[_0x2731('0x3')];ut[_0x2731('0x48')](_0x2731('0x63'),'');ami[_0x2731('0x64')](ut[_0x2731('0x65')](_0x309b4e,_0x2aafef))[_0x2731('0x3c')](function(_0x3f3a30){_0x128b82(_0x3f3a30);})[_0x2731('0x3e')](function(_0xbc4052){_0x290305(_0xbc4052);});})['catch'](function(_0x3299f6){_0x290305(_0x3299f6);});}else{ami[_0x2731('0x64')](ut[_0x2731('0x65')](_0x309b4e,_0x2aafef))[_0x2731('0x3c')](function(_0x9b30d){_0x128b82(_0x9b30d);})['catch'](function(_0x40c3c5){_0x290305(_0x40c3c5);});}});}Fax['prototype'][_0x2731('0x53')]=function(_0x4c83b0,_0x879d25){var _0x14fb65=this;return new BPromise(function(_0x2a479e,_0x2d7681){var _0x1d23be=uuid['v4']();var _0x3e9b5e=ut[_0x2731('0x66')](_0x4c83b0,_0x879d25);_0x14fb65[_0x2731('0x10')][_0x1d23be]=new Action(_0x1d23be,_0x879d25,_0x4c83b0);var _0x21a61b=_0x14fb65[_0x2731('0x10')][_0x1d23be];if(path[_0x2731('0x39')](_0x4c83b0[_0x2731('0x3')])[_0x2731('0x67')]===_0x2731('0x3a')){originate(_0x21a61b,_0x3e9b5e,!![])[_0x2731('0x3c')](function(_0x52706){_0x2a479e(_0x52706);})['catch'](function(_0x50bd5a){_0x2d7681(_0x50bd5a);});}else{originate(_0x21a61b,_0x3e9b5e,![])[_0x2731('0x3c')](function(_0x3d9a06){_0x2a479e(_0x3d9a06);})[_0x2731('0x3e')](function(_0x587889){_0x2d7681(_0x587889);});}});};Fax[_0x2731('0x1f')][_0x2731('0x68')]=function(_0x28df92){return!_[_0x2731('0x69')](_0x28df92)&&!_[_0x2731('0x69')](_0x28df92[_0x2731('0x26')])&&!_[_0x2731('0x69')](_0x28df92['active'])&&_0x28df92['active']&&!_[_0x2731('0x69')](this[_0x2731('0xf')][util['format'](_0x2731('0x6a'),_0x28df92[_0x2731('0x26')])])&&!_[_0x2731('0x69')](this[_0x2731('0xf')][util[_0x2731('0x5d')](_0x2731('0x6a'),_0x28df92[_0x2731('0x26')])][_0x2731('0x2f')])&&(this[_0x2731('0xf')][util[_0x2731('0x5d')]('SIP/%s',_0x28df92[_0x2731('0x26')])][_0x2731('0x2f')]==='reachable'||this[_0x2731('0xf')][util[_0x2731('0x5d')](_0x2731('0x6a'),_0x28df92['name'])]['status']===_0x2731('0x6b'));};Fax[_0x2731('0x1f')][_0x2731('0x5a')]=function(_0x43e0cb,_0x410f0f){if(!this[_0x2731('0x68')](_0x43e0cb)){ut[_0x2731('0x48')](_0x2731('0x6c'),_[_0x2731('0x69')](_0x43e0cb)?'':_0x43e0cb[_0x2731('0x26')]+_0x2731('0x6d'));return{'isValid':![],'message':_0x2731('0x6e')};}if(_[_0x2731('0x69')](_0x410f0f[_0x2731('0x5')])){ut[_0x2731('0x48')](_0x2731('0x6f'),JSON[_0x2731('0x41')](_0x410f0f));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x2731('0x69')](_0x410f0f['path'])){ut[_0x2731('0x48')](_0x2731('0x70'),JSON[_0x2731('0x41')](_0x410f0f));return{'isValid':![],'message':_0x2731('0x71')};}return{'isValid':!![],'message':_0x2731('0x72')};};module[_0x2731('0x73')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 46d2487..c8e428b 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 _0x401d=['then','catch','util','bluebird','../../../config/logger','../rpc/faxAccount','error','inspect','notify','resolve'];(function(_0x36d78e,_0x5cd492){var _0x5c0a6f=function(_0x217b14){while(--_0x217b14){_0x36d78e['push'](_0x36d78e['shift']());}};_0x5c0a6f(++_0x5cd492);}(_0x401d,0x174));var _0xd401=function(_0xe5b8f,_0x368331){_0xe5b8f=_0xe5b8f-0x0;var _0x4b6c0b=_0x401d[_0xe5b8f];return _0x4b6c0b;};'use strict';var util=require(_0xd401('0x0'));var BPromise=require(_0xd401('0x1'));var logger=require(_0xd401('0x2'))('preview');var _=require('lodash');var faxAccount=require(_0xd401('0x3'));function loggerCatch(_0x2dbcc2){return function(_0x4fb5e5){logger[_0xd401('0x4')](_0x2dbcc2,util[_0xd401('0x5')](_0x4fb5e5,{'showHidden':![],'depth':null}));};}exports[_0xd401('0x6')]=function(_0x166def,_0x3c4248){return BPromise[_0xd401('0x7')]()[_0xd401('0x8')](faxAccount['notify'](_0x166def,_0x3c4248))[_0xd401('0x9')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xe080=['util','bluebird','../../../config/logger','preview','error','inspect','notify','resolve','catch'];(function(_0x13d32b,_0x44d7a3){var _0x53407f=function(_0x40eaa9){while(--_0x40eaa9){_0x13d32b['push'](_0x13d32b['shift']());}};_0x53407f(++_0x44d7a3);}(_0xe080,0x14d));var _0x0e08=function(_0xed882e,_0x3b06c8){_0xed882e=_0xed882e-0x0;var _0x15ea2e=_0xe080[_0xed882e];return _0x15ea2e;};'use strict';var util=require(_0x0e08('0x0'));var BPromise=require(_0x0e08('0x1'));var logger=require(_0x0e08('0x2'))(_0x0e08('0x3'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x5bffad){return function(_0x12f23c){logger[_0x0e08('0x4')](_0x5bffad,util[_0x0e08('0x5')](_0x12f23c,{'showHidden':![],'depth':null}));};}exports[_0x0e08('0x6')]=function(_0x17f2c6,_0x17fb1c){return BPromise[_0x0e08('0x7')]()['then'](faxAccount[_0x0e08('0x6')](_0x17f2c6,_0x17fb1c))[_0x0e08('0x8')](loggerCatch('[Notify]\x20'));}; \ 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 83a7e0a..23addc4 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 _0xb685=['fax','bluebird','child_process','exec','execute','info','Exec\x20gs'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0xb685,0x173));var _0x5b68=function(_0x113911,_0x53476f){_0x113911=_0x113911-0x0;var _0x16d2f9=_0xb685[_0x113911];return _0x16d2f9;};'use strict';var util=require('util');var logger=require('../../../../config/logger')(_0x5b68('0x0'));var BPromise=require(_0x5b68('0x1'));var exec=require(_0x5b68('0x2'))[_0x5b68('0x3')];exports[_0x5b68('0x4')]=function(_0x4ab2ad){return new BPromise(function(_0x1ff7d5,_0x43ad8c){exec(_0x4ab2ad,function(_0x47ff16,_0xcb6da7,_0x1f7167){logger['info']('Exec\x20gs',_0xcb6da7);if(_0x47ff16){logger[_0x5b68('0x5')](_0x5b68('0x6'),'\x20Error\x20:',util['inspect'](_0x47ff16,{'showHidden':![],'depth':null}),_0xcb6da7,_0x1f7167);_0x43ad8c(_0x47ff16);}_0x1ff7d5(_0xcb6da7);});});}; \ No newline at end of file +var _0x1f08=['execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec'];(function(_0x247f0d,_0x1e7322){var _0x3908e4=function(_0x46fa14){while(--_0x46fa14){_0x247f0d['push'](_0x247f0d['shift']());}};_0x3908e4(++_0x1e7322);}(_0x1f08,0x12e));var _0x81f0=function(_0x517c9f,_0x1269af){_0x517c9f=_0x517c9f-0x0;var _0x414a4c=_0x1f08[_0x517c9f];return _0x414a4c;};'use strict';var util=require(_0x81f0('0x0'));var logger=require(_0x81f0('0x1'))(_0x81f0('0x2'));var BPromise=require(_0x81f0('0x3'));var exec=require(_0x81f0('0x4'))[_0x81f0('0x5')];exports[_0x81f0('0x6')]=function(_0x1c9034){return new BPromise(function(_0x4644e0,_0x5414a4){exec(_0x1c9034,function(_0x14d2a6,_0x559925,_0x4d3b5c){logger['info']('Exec\x20gs',_0x559925);if(_0x14d2a6){logger[_0x81f0('0x7')](_0x81f0('0x8'),_0x81f0('0x9'),util[_0x81f0('0xa')](_0x14d2a6,{'showHidden':![],'depth':null}),_0x559925,_0x4d3b5c);_0x5414a4(_0x14d2a6);}_0x4644e0(_0x559925);});});}; \ 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 63aabd9..703fb49 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 _0x3c81=['uniqueid','originate','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','../../../../config/logger','fax','info','inspect','addVariables','headerinfo','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction'];(function(_0x311301,_0x5e01b4){var _0x291c3c=function(_0x567276){while(--_0x567276){_0x311301['push'](_0x311301['shift']());}};_0x291c3c(++_0x5e01b4);}(_0x3c81,0x102));var _0x13c8=function(_0x2cd39d,_0xa37811){_0x2cd39d=_0x2cd39d-0x0;var _0x55199f=_0x3c81[_0x2cd39d];return _0x55199f;};'use strict';var util=require(_0x13c8('0x0'));var _=require(_0x13c8('0x1'));var moment=require('moment');var logger=require(_0x13c8('0x2'))(_0x13c8('0x3'));exports['message']=function(_0x5913e9){return{'message':_0x5913e9};};exports['logger']=function(_0x548599,_0x101d4f){logger[_0x13c8('0x4')](_0x548599,util[_0x13c8('0x5')](_0x101d4f,{'showHidden':![],'depth':null}));};exports[_0x13c8('0x6')]=function(_0x2a4d66,_0x3f0bd2){var _0x445b69={'XMF-ECM':_0x3f0bd2['ecm'],'XMF-HEADERINFO':_0x3f0bd2[_0x13c8('0x7')],'XMF-MINRATE':_0x3f0bd2['minrate'],'XMF-MAXRATE':_0x3f0bd2[_0x13c8('0x8')],'XMF-MODEM':util[_0x13c8('0x9')](_0x13c8('0xa'),_0x3f0bd2[_0x13c8('0xb')]),'XMF-GATEWAY':_0x3f0bd2[_0x13c8('0xc')],'XMF-FAXDETECT':_0x3f0bd2[_0x13c8('0xd')],'XMF-T38TIMEOUT':_0x3f0bd2[_0x13c8('0xe')],'XMF-LOCALSTATIONID':_0x3f0bd2[_0x13c8('0xf')],'XMF-PATH':_0x2a4d66[_0x13c8('0x10')]};return _0x445b69;};exports[_0x13c8('0x11')]=function(_0x3ca0a6,_0x2468b3){return{'actionid':_0x3ca0a6[_0x13c8('0x12')],'action':_0x13c8('0x13'),'channel':_0x3ca0a6['channel'],'Exten':_0x13c8('0x14'),'Context':_0x13c8('0x15'),'Priority':'1','callerid':util[_0x13c8('0x9')](_0x13c8('0x16'),_0x3ca0a6['headerinfo']?_0x3ca0a6[_0x13c8('0x7')]:'',_0x3ca0a6['localstationid']),'variable':_0x2468b3,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3ca0a6['uniqueid']};}; \ No newline at end of file +var _0xe13a=['ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','localstationid','path','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','lodash','moment','../../../../config/logger','fax','logger','info','inspect','addVariables'];(function(_0x33068a,_0x353a85){var _0x539639=function(_0x6d222c){while(--_0x6d222c){_0x33068a['push'](_0x33068a['shift']());}};_0x539639(++_0x353a85);}(_0xe13a,0x178));var _0xae13=function(_0x1d610b,_0x44ad5d){_0x1d610b=_0x1d610b-0x0;var _0x4a06eb=_0xe13a[_0x1d610b];return _0x4a06eb;};'use strict';var util=require('util');var _=require(_0xae13('0x0'));var moment=require(_0xae13('0x1'));var logger=require(_0xae13('0x2'))(_0xae13('0x3'));exports['message']=function(_0x3aaf90){return{'message':_0x3aaf90};};exports[_0xae13('0x4')]=function(_0x3ebbfe,_0x10abd7){logger[_0xae13('0x5')](_0x3ebbfe,util[_0xae13('0x6')](_0x10abd7,{'showHidden':![],'depth':null}));};exports[_0xae13('0x7')]=function(_0x3379ed,_0x341ba4){var _0x4ae51f={'XMF-ECM':_0x341ba4[_0xae13('0x8')],'XMF-HEADERINFO':_0x341ba4[_0xae13('0x9')],'XMF-MINRATE':_0x341ba4[_0xae13('0xa')],'XMF-MAXRATE':_0x341ba4[_0xae13('0xb')],'XMF-MODEM':util[_0xae13('0xc')](_0xae13('0xd'),_0x341ba4[_0xae13('0xe')]),'XMF-GATEWAY':_0x341ba4[_0xae13('0xf')],'XMF-FAXDETECT':_0x341ba4[_0xae13('0x10')],'XMF-T38TIMEOUT':_0x341ba4['t38timeout'],'XMF-LOCALSTATIONID':_0x341ba4[_0xae13('0x11')],'XMF-PATH':_0x3379ed[_0xae13('0x12')]};return _0x4ae51f;};exports[_0xae13('0x13')]=function(_0x3a6d41,_0x14df2d){return{'actionid':_0x3a6d41[_0xae13('0x14')],'action':_0xae13('0x15'),'channel':_0x3a6d41['channel'],'Exten':_0xae13('0x16'),'Context':_0xae13('0x17'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x3a6d41['headerinfo']?_0x3a6d41['headerinfo']:'',_0x3a6d41['localstationid']),'variable':_0x14df2d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3a6d41[_0xae13('0x14')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index fa55fb5..ba29ce2 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 _0x4ff5=['getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','hour','get','resolve','then','initAgents','getTelephones','initTelephones','initVoiceQueues','getTriggers','initTriggers','getTemplates','initSalesforceAccounts','initSugarcrmAccounts'];(function(_0x4fbb15,_0x21be0c){var _0x436338=function(_0x3b5a05){while(--_0x3b5a05){_0x4fbb15['push'](_0x4fbb15['shift']());}};_0x436338(++_0x21be0c);}(_0x4ff5,0xce));var _0x54ff=function(_0x3420c6,_0x103551){_0x3420c6=_0x3420c6-0x0;var _0x1fa451=_0x4ff5[_0x3420c6];return _0x1fa451;};'use strict';var BPromise=require('bluebird');var util=require(_0x54ff('0x0'));var moment=require(_0x54ff('0x1'));var server=require(_0x54ff('0x2'));var Realtime=require(_0x54ff('0x3'));var Report=require(_0x54ff('0x4'));var Acw=require(_0x54ff('0x5'));var Trigger=require(_0x54ff('0x6'));var Dialer=require(_0x54ff('0x7'));var Preview=require(_0x54ff('0x8'));var Fax=require(_0x54ff('0x9'));var user=require(_0x54ff('0xa'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x54ff('0xb'));var voiceCallReport=require(_0x54ff('0xc'));var trunk=require(_0x54ff('0xd'));var trigger=require(_0x54ff('0xe'));var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x54ff('0xf'));var voiceExtension=require(_0x54ff('0x10'));var faxAccount=require(_0x54ff('0x11'));var zendesk=require(_0x54ff('0x12'));var salesforce=require(_0x54ff('0x13'));var sugarcrm=require(_0x54ff('0x14'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x54ff('0x15'));var zoho=require(_0x54ff('0x16'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x54ff('0x17'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x54ff('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x54ff('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x54ff('0x1a')](_0x54ff('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x54ff('0x1b')]()[_0x54ff('0x1c')](user['getAgents']())[_0x54ff('0x1c')](realtime[_0x54ff('0x1d')]())[_0x54ff('0x1c')](user[_0x54ff('0x1e')]())['then'](realtime[_0x54ff('0x1f')]())[_0x54ff('0x1c')](trunk['getTrunks']())[_0x54ff('0x1c')](realtime['initTrunks']())[_0x54ff('0x1c')](voiceQueue['getVoiceQueues']())['then'](realtime[_0x54ff('0x20')]())[_0x54ff('0x1c')](trigger[_0x54ff('0x21')]())[_0x54ff('0x1c')](realtime[_0x54ff('0x22')]())[_0x54ff('0x1c')](template[_0x54ff('0x23')]())['then'](realtime['initTemplates']())[_0x54ff('0x1c')](zendesk['getZendeskAccounts']())[_0x54ff('0x1c')](realtime['initZendeskAccounts']())[_0x54ff('0x1c')](salesforce['getSalesforceAccounts']())['then'](realtime[_0x54ff('0x24')]())['then'](sugarcrm['getSugarcrmAccounts']())[_0x54ff('0x1c')](realtime[_0x54ff('0x25')]())['then'](freshdesk[_0x54ff('0x26')]())[_0x54ff('0x1c')](realtime[_0x54ff('0x27')]())[_0x54ff('0x1c')](desk[_0x54ff('0x28')]())[_0x54ff('0x1c')](realtime[_0x54ff('0x29')]())['then'](zoho['getZohoAccounts']())[_0x54ff('0x1c')](realtime[_0x54ff('0x2a')]())['then'](vtiger[_0x54ff('0x2b')]())[_0x54ff('0x1c')](realtime[_0x54ff('0x2c')]())[_0x54ff('0x1c')](freshsales[_0x54ff('0x2d')]())[_0x54ff('0x1c')](realtime['initFreshsalesAccounts']())[_0x54ff('0x1c')](servicenow['getServicenowAccounts']())['then'](realtime[_0x54ff('0x2e')]())[_0x54ff('0x1c')](dynamics365[_0x54ff('0x2f')]())['then'](realtime['initDynamics365Accounts']())[_0x54ff('0x1c')](campaign[_0x54ff('0x30')]())[_0x54ff('0x1c')](realtime[_0x54ff('0x31')]())[_0x54ff('0x1c')](voiceExtension[_0x54ff('0x32')]())[_0x54ff('0x1c')](realtime[_0x54ff('0x33')]())[_0x54ff('0x1c')](faxAccount[_0x54ff('0x34')]())['then'](realtime[_0x54ff('0x35')]())[_0x54ff('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0x54ff('0x1b')]()[_0x54ff('0x1c')](voiceQueueReport[_0x54ff('0x36')]())[_0x54ff('0x1c')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0x54ff('0x37')]())[_0x54ff('0x1c')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x54ff('0x1c')](realtime[_0x54ff('0x38')]())[_0x54ff('0x1c')](voiceCallReport[_0x54ff('0x39')]())['then'](realtime[_0x54ff('0x3a')]())['then'](function(_0x256005){})[_0x54ff('0x3b')](function(_0x3087da){console[_0x54ff('0x3c')](_0x3087da);});}function main(){return server['listen'](realtime,preview,fax)[_0x54ff('0x1c')](function(_0x3f30f5){return initRealtime();})[_0x54ff('0x1c')](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x438944){console[_0x54ff('0x3c')](_0x438944);});}main(); \ No newline at end of file +var _0xb5d8=['./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTrunks','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','bluebird','util','./server','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/trunk','./rpc/template','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/freshdesk'];(function(_0x35d88d,_0x56826e){var _0x859dcb=function(_0x20d91c){while(--_0x20d91c){_0x35d88d['push'](_0x35d88d['shift']());}};_0x859dcb(++_0x56826e);}(_0xb5d8,0xd9));var _0x8b5d=function(_0x54335e,_0x2dd8d2){_0x54335e=_0x54335e-0x0;var _0x39e06a=_0xb5d8[_0x54335e];return _0x39e06a;};'use strict';var BPromise=require(_0x8b5d('0x0'));var util=require(_0x8b5d('0x1'));var moment=require('moment');var server=require(_0x8b5d('0x2'));var Realtime=require(_0x8b5d('0x3'));var Report=require(_0x8b5d('0x4'));var Acw=require('./acw');var Trigger=require(_0x8b5d('0x5'));var Dialer=require(_0x8b5d('0x6'));var Preview=require(_0x8b5d('0x7'));var Fax=require(_0x8b5d('0x8'));var user=require('./rpc/user');var voiceQueue=require(_0x8b5d('0x9'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x8b5d('0xa'));var trigger=require('./rpc/trigger');var template=require(_0x8b5d('0xb'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x8b5d('0xc'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x8b5d('0xd'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x8b5d('0xe'));var desk=require(_0x8b5d('0xf'));var zoho=require(_0x8b5d('0x10'));var vtiger=require(_0x8b5d('0x11'));var freshsales=require(_0x8b5d('0x12'));var servicenow=require(_0x8b5d('0x13'));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()[_0x8b5d('0x14')](_0x8b5d('0x15'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x8b5d('0x14')](_0x8b5d('0x15'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x8b5d('0x16')]()[_0x8b5d('0x17')](user[_0x8b5d('0x18')]())[_0x8b5d('0x17')](realtime[_0x8b5d('0x19')]())[_0x8b5d('0x17')](user[_0x8b5d('0x1a')]())[_0x8b5d('0x17')](realtime['initTelephones']())['then'](trunk['getTrunks']())[_0x8b5d('0x17')](realtime[_0x8b5d('0x1b')]())[_0x8b5d('0x17')](voiceQueue['getVoiceQueues']())[_0x8b5d('0x17')](realtime['initVoiceQueues']())[_0x8b5d('0x17')](trigger[_0x8b5d('0x1c')]())[_0x8b5d('0x17')](realtime[_0x8b5d('0x1d')]())[_0x8b5d('0x17')](template[_0x8b5d('0x1e')]())[_0x8b5d('0x17')](realtime[_0x8b5d('0x1f')]())['then'](zendesk['getZendeskAccounts']())[_0x8b5d('0x17')](realtime[_0x8b5d('0x20')]())['then'](salesforce['getSalesforceAccounts']())[_0x8b5d('0x17')](realtime['initSalesforceAccounts']())[_0x8b5d('0x17')](sugarcrm[_0x8b5d('0x21')]())[_0x8b5d('0x17')](realtime[_0x8b5d('0x22')]())['then'](freshdesk[_0x8b5d('0x23')]())[_0x8b5d('0x17')](realtime[_0x8b5d('0x24')]())['then'](desk[_0x8b5d('0x25')]())[_0x8b5d('0x17')](realtime['initDeskAccounts']())[_0x8b5d('0x17')](zoho[_0x8b5d('0x26')]())[_0x8b5d('0x17')](realtime[_0x8b5d('0x27')]())['then'](vtiger['getVtigerAccounts']())[_0x8b5d('0x17')](realtime[_0x8b5d('0x28')]())[_0x8b5d('0x17')](freshsales[_0x8b5d('0x29')]())[_0x8b5d('0x17')](realtime['initFreshsalesAccounts']())[_0x8b5d('0x17')](servicenow[_0x8b5d('0x2a')]())[_0x8b5d('0x17')](realtime[_0x8b5d('0x2b')]())['then'](dynamics365[_0x8b5d('0x2c')]())['then'](realtime[_0x8b5d('0x2d')]())[_0x8b5d('0x17')](campaign[_0x8b5d('0x2e')]())['then'](realtime[_0x8b5d('0x2f')]())[_0x8b5d('0x17')](voiceExtension[_0x8b5d('0x30')]())[_0x8b5d('0x17')](realtime[_0x8b5d('0x31')]())['then'](faxAccount['getFaxAccounts']())[_0x8b5d('0x17')](realtime[_0x8b5d('0x32')]())[_0x8b5d('0x17')](function(){return realtime;});}function initParams(){return BPromise['resolve']()['then'](voiceQueueReport['getVoiceQueueReports']())[_0x8b5d('0x17')](realtime[_0x8b5d('0x33')]())[_0x8b5d('0x17')](cmHopperHistory[_0x8b5d('0x34')]())[_0x8b5d('0x17')](realtime['initVoiceQueueHopperHistory']())[_0x8b5d('0x17')](cmHopperHistory[_0x8b5d('0x35')]())['then'](realtime[_0x8b5d('0x36')]())[_0x8b5d('0x17')](voiceCallReport[_0x8b5d('0x37')]())['then'](realtime[_0x8b5d('0x38')]())[_0x8b5d('0x17')](function(_0x405cd4){})['catch'](function(_0x496a6e){console['log'](_0x496a6e);});}function main(){return server['listen'](realtime,preview,fax)[_0x8b5d('0x17')](function(_0x7bf685){return initRealtime();})[_0x8b5d('0x17')](function(){return initParams();})[_0x8b5d('0x17')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x8b5d('0x39')](function(_0x1f12c6){console['log'](_0x1f12c6);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 4ce7f32..5fc67b0 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 _0xdd05=['mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','updateStatusRealtime','not_inuse','inuse','talking','voiceStatus','statePause','toNumber','format','status','address','voiceStatusQueue','stringify','user:%s','user:save','exports','lodash','moment','md5','../../../config/environment','redis','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime'];(function(_0x28debc,_0xcbbfc4){var _0x1ea08c=function(_0x533e03){while(--_0x533e03){_0x28debc['push'](_0x28debc['shift']());}};_0x1ea08c(++_0xcbbfc4);}(_0xdd05,0x7f));var _0x5dd0=function(_0x3d3817,_0x5d0b91){_0x3d3817=_0x3d3817-0x0;var _0x4f23ce=_0xdd05[_0x3d3817];return _0x4f23ce;};'use strict';var _=require(_0x5dd0('0x0'));var util=require('util');var moment=require(_0x5dd0('0x1'));var md5=require(_0x5dd0('0x2'));var Redis=require('ioredis');var config=require(_0x5dd0('0x3'));config[_0x5dd0('0x4')]=_['defaults'](config[_0x5dd0('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x5dd0('0x5'))(new Redis(config[_0x5dd0('0x4')]));function Agent(_0x22ce43){this['id']=_0x22ce43['id']||0x0;this[_0x5dd0('0x6')]=_0x22ce43[_0x5dd0('0x6')]||'';this[_0x5dd0('0x7')]=_0x22ce43[_0x5dd0('0x7')]||'';this[_0x5dd0('0x8')]=_0x22ce43['accountcode']||'';this[_0x5dd0('0x9')]=_0x22ce43['fullname']||'';this[_0x5dd0('0xa')]=_0x5dd0('0xb');this[_0x5dd0('0xc')]=0x0;this['status']=_0x5dd0('0xb');this['address']='';this['phone']='';this[_0x5dd0('0xd')]='';this[_0x5dd0('0xe')]='';this[_0x5dd0('0xf')]=_0x22ce43['online']||![];this['voiceStatus']=_0x5dd0('0xb');this[_0x5dd0('0x10')]=0x0;this[_0x5dd0('0x11')]='';this['voiceStatusQueue']='';this[_0x5dd0('0x12')]=![];this[_0x5dd0('0x13')]=![];this[_0x5dd0('0x2')]='';}Agent['prototype'][_0x5dd0('0x14')]=function(_0x55a18d){var _0x58dc68;if(_0x55a18d&&_0x55a18d['state']){_0x58dc68=_0x55a18d[_0x5dd0('0xa')]['toLowerCase']();switch(_0x58dc68){case _0x5dd0('0x15'):_0x58dc68='idle';break;case _0x5dd0('0x16'):_0x58dc68=_0x5dd0('0x17');break;}}if(_0x58dc68&&this[_0x5dd0('0x18')]!==_0x58dc68||_0x55a18d[_0x5dd0('0x19')]){this[_0x5dd0('0x10')]=_[_0x5dd0('0x1a')](moment()[_0x5dd0('0x1b')]('x'));}if(_0x58dc68){this['voiceStatus']=_0x58dc68;}var _0x5ee08f={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x5dd0('0xa')],'stateTime':this[_0x5dd0('0xc')],'status':this[_0x5dd0('0x1c')],'address':this[_0x5dd0('0x1d')],'online':this[_0x5dd0('0xf')],'voiceStatus':this[_0x5dd0('0x18')],'voiceStatusTime':this[_0x5dd0('0x10')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x5dd0('0x1e')],'interface':this['interface'],'onhold':this[_0x5dd0('0x12')]};var _0x5c3df3=md5(JSON[_0x5dd0('0x1f')](_0x5ee08f));if(this[_0x5dd0('0x2')]!==_0x5c3df3){this[_0x5dd0('0x2')]=_0x5c3df3;io['to'](util['format'](_0x5dd0('0x20'),_0x5ee08f[_0x5dd0('0x6')]))['emit'](_0x5dd0('0x21'),_0x5ee08f);}};module[_0x5dd0('0x22')]=Agent; \ No newline at end of file +var _0x477d=['statePause','toNumber','user:%s','emit','user:save','exports','lodash','util','moment','md5','ioredis','defaults','redis','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','not_inuse','idle','inuse','talking','voiceStatus'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x477d,0x1b6));var _0xd477=function(_0x3e0c47,_0x267b97){_0x3e0c47=_0x3e0c47-0x0;var _0x499bb3=_0x477d[_0x3e0c47];return _0x499bb3;};'use strict';var _=require(_0xd477('0x0'));var util=require(_0xd477('0x1'));var moment=require(_0xd477('0x2'));var md5=require(_0xd477('0x3'));var Redis=require(_0xd477('0x4'));var config=require('../../../config/environment');config['redis']=_[_0xd477('0x5')](config[_0xd477('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xd477('0x7'))(new Redis(config[_0xd477('0x6')]));function Agent(_0x30d7bd){this['id']=_0x30d7bd['id']||0x0;this[_0xd477('0x8')]=_0x30d7bd[_0xd477('0x8')]||'';this['email']=_0x30d7bd[_0xd477('0x9')]||'';this[_0xd477('0xa')]=_0x30d7bd[_0xd477('0xa')]||'';this[_0xd477('0xb')]=_0x30d7bd['fullname']||'';this[_0xd477('0xc')]=_0xd477('0xd');this[_0xd477('0xe')]=0x0;this[_0xd477('0xf')]='unknown';this[_0xd477('0x10')]='';this[_0xd477('0x11')]='';this[_0xd477('0x12')]='';this[_0xd477('0x13')]='';this[_0xd477('0x14')]=_0x30d7bd[_0xd477('0x14')]||![];this['voiceStatus']=_0xd477('0xd');this[_0xd477('0x15')]=0x0;this[_0xd477('0x16')]='';this[_0xd477('0x17')]='';this[_0xd477('0x18')]=![];this['local']=![];this[_0xd477('0x3')]='';}Agent['prototype']['updateStatusRealtime']=function(_0x10e933){var _0x37e4b9;if(_0x10e933&&_0x10e933[_0xd477('0xc')]){_0x37e4b9=_0x10e933[_0xd477('0xc')]['toLowerCase']();switch(_0x37e4b9){case _0xd477('0x19'):_0x37e4b9=_0xd477('0x1a');break;case _0xd477('0x1b'):_0x37e4b9=_0xd477('0x1c');break;}}if(_0x37e4b9&&this[_0xd477('0x1d')]!==_0x37e4b9||_0x10e933[_0xd477('0x1e')]){this[_0xd477('0x15')]=_[_0xd477('0x1f')](moment()['format']('x'));}if(_0x37e4b9){this[_0xd477('0x1d')]=_0x37e4b9;}var _0x16e261={'id':this['id'],'name':this[_0xd477('0x8')],'email':this[_0xd477('0x9')],'accountcode':this[_0xd477('0xa')],'fullname':this[_0xd477('0xb')],'state':this['state'],'stateTime':this['stateTime'],'status':this[_0xd477('0xf')],'address':this['address'],'online':this[_0xd477('0x14')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xd477('0x15')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0xd477('0x17')],'interface':this[_0xd477('0x13')],'onhold':this[_0xd477('0x18')]};var _0x57ab91=md5(JSON['stringify'](_0x16e261));if(this['md5']!==_0x57ab91){this[_0xd477('0x3')]=_0x57ab91;io['to'](util['format'](_0xd477('0x20'),_0x16e261[_0xd477('0x8')]))[_0xd477('0x21')](_0xd477('0x22'),_0x16e261);}};module[_0xd477('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 a290098..1d4be2a 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 _0x757a=['sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message'];(function(_0x4a2b3c,_0xc69f59){var _0x4b081b=function(_0x3dfcb1){while(--_0x3dfcb1){_0x4a2b3c['push'](_0x4a2b3c['shift']());}};_0x4b081b(++_0xc69f59);}(_0x757a,0xde));var _0xa757=function(_0x270935,_0x121e9c){_0x270935=_0x270935-0x0;var _0x5d3d56=_0x757a[_0x270935];return _0x5d3d56;};'use strict';function Campaign(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['type']=_0x1acf7d['type']||'campaign';this[_0xa757('0x1')]=0x0;this[_0xa757('0x2')]=0x0;this[_0xa757('0x3')]=0x0;this[_0xa757('0x4')]=0x0;this[_0xa757('0x5')]='';this[_0xa757('0x6')]=!![];this['active']=_0x1acf7d[_0xa757('0x7')];this[_0xa757('0x8')]=_0x1acf7d['limitCalls'];this[_0xa757('0x9')]=_0x1acf7d[_0xa757('0x9')]||null;this[_0xa757('0xa')]=_0x1acf7d[_0xa757('0xa')]?_0x1acf7d[_0xa757('0xa')]:null;this['dialOriginateCallerIdName']=_0x1acf7d[_0xa757('0xb')];this[_0xa757('0xc')]=_0x1acf7d[_0xa757('0xc')];this[_0xa757('0xd')]=_0x1acf7d[_0xa757('0xd')]||0x1e;this[_0xa757('0xe')]=_0x1acf7d[_0xa757('0xe')];this['dialCongestionRetryFrequency']=_0x1acf7d['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x1acf7d['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x1acf7d[_0xa757('0xf')];this['dialNoAnswerMaxRetry']=_0x1acf7d['dialNoAnswerMaxRetry'];this[_0xa757('0x10')]=_0x1acf7d['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x1acf7d[_0xa757('0x11')];this[_0xa757('0x12')]=_0x1acf7d[_0xa757('0x12')]||_0xa757('0x13');this[_0xa757('0x14')]=_0x1acf7d[_0xa757('0x14')]||undefined;this[_0xa757('0x15')]=_0x1acf7d[_0xa757('0x15')]||undefined;this[_0xa757('0x16')]=_0x1acf7d[_0xa757('0x16')]||undefined;this['TrunkBackup']=_0x1acf7d[_0xa757('0x17')]?_0x1acf7d[_0xa757('0x17')]:undefined;this[_0xa757('0x18')]=_0x1acf7d['Trunk']?_0x1acf7d['Trunk']:undefined;this[_0xa757('0x19')]=_0x1acf7d[_0xa757('0x19')]?_0x1acf7d[_0xa757('0x19')]:undefined;this[_0xa757('0x1a')]=_0x1acf7d[_0xa757('0x1a')]?_0x1acf7d[_0xa757('0x1a')]:undefined;this['dialQueueProject']=_0x1acf7d[_0xa757('0x1a')]?_0x1acf7d['SquareProject'][_0xa757('0x0')]:undefined;this[_0xa757('0x1b')]=_0x1acf7d[_0xa757('0x1b')]||![];this[_0xa757('0x1c')]=_0x1acf7d['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x1acf7d[_0xa757('0x1d')];this[_0xa757('0x1e')]=_0x1acf7d[_0xa757('0x1e')];this[_0xa757('0x1f')]=_0x1acf7d[_0xa757('0x1f')];this[_0xa757('0x20')]=_0x1acf7d[_0xa757('0x20')];this[_0xa757('0x21')]=_0x1acf7d[_0xa757('0x21')];this['dialAMDMaximumNumberOfWords']=_0x1acf7d[_0xa757('0x22')];this['dialAMDSilenceThreshold']=_0x1acf7d[_0xa757('0x23')];this['dialAMDMaximumWordLength']=_0x1acf7d[_0xa757('0x24')];}module[_0xa757('0x25')]=Campaign; \ No newline at end of file +var _0x0b0e=['SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk'];(function(_0x16066c,_0x44f6a9){var _0x4647d1=function(_0x5b1a1d){while(--_0x5b1a1d){_0x16066c['push'](_0x16066c['shift']());}};_0x4647d1(++_0x44f6a9);}(_0x0b0e,0x187));var _0xe0b0=function(_0x21bb2f,_0x4199b9){_0x21bb2f=_0x21bb2f-0x0;var _0x279b0e=_0x0b0e[_0x21bb2f];return _0x279b0e;};'use strict';function Campaign(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['type']=_0x29cd1e[_0xe0b0('0x1')]||_0xe0b0('0x2');this[_0xe0b0('0x3')]=0x0;this[_0xe0b0('0x4')]=0x0;this[_0xe0b0('0x5')]=0x0;this[_0xe0b0('0x6')]=0x0;this[_0xe0b0('0x7')]='';this[_0xe0b0('0x8')]=!![];this[_0xe0b0('0x9')]=_0x29cd1e[_0xe0b0('0x9')];this[_0xe0b0('0xa')]=_0x29cd1e['limitCalls'];this['dialTimezone']=_0x29cd1e[_0xe0b0('0xb')]||null;this[_0xe0b0('0xc')]=_0x29cd1e[_0xe0b0('0xc')]?_0x29cd1e[_0xe0b0('0xc')]:null;this['dialOriginateCallerIdName']=_0x29cd1e[_0xe0b0('0xd')];this[_0xe0b0('0xe')]=_0x29cd1e['dialOriginateCallerIdNumber'];this[_0xe0b0('0xf')]=_0x29cd1e[_0xe0b0('0xf')]||0x1e;this['dialCongestionMaxRetry']=_0x29cd1e[_0xe0b0('0x10')];this[_0xe0b0('0x11')]=_0x29cd1e[_0xe0b0('0x11')];this['dialBusyMaxRetry']=_0x29cd1e[_0xe0b0('0x12')];this[_0xe0b0('0x13')]=_0x29cd1e[_0xe0b0('0x13')];this[_0xe0b0('0x14')]=_0x29cd1e[_0xe0b0('0x14')];this['dialNoAnswerRetryFrequency']=_0x29cd1e[_0xe0b0('0x15')];this[_0xe0b0('0x16')]=_0x29cd1e[_0xe0b0('0x16')];this[_0xe0b0('0x17')]=_0x29cd1e[_0xe0b0('0x17')]||'DESC';this[_0xe0b0('0x18')]=_0x29cd1e['dialPrefix']||undefined;this[_0xe0b0('0x19')]=_0x29cd1e[_0xe0b0('0x19')]||undefined;this['dialCutDigit']=_0x29cd1e[_0xe0b0('0x1a')]||undefined;this['TrunkBackup']=_0x29cd1e[_0xe0b0('0x1b')]?_0x29cd1e[_0xe0b0('0x1b')]:undefined;this['Trunk']=_0x29cd1e['Trunk']?_0x29cd1e[_0xe0b0('0x1c')]:undefined;this['Interval']=_0x29cd1e['Interval']?_0x29cd1e['Interval']:undefined;this[_0xe0b0('0x1d')]=_0x29cd1e['SquareProject']?_0x29cd1e['SquareProject']:undefined;this[_0xe0b0('0x1e')]=_0x29cd1e['SquareProject']?_0x29cd1e[_0xe0b0('0x1d')]['name']:undefined;this[_0xe0b0('0x1f')]=_0x29cd1e[_0xe0b0('0x1f')]||![];this[_0xe0b0('0x20')]=_0x29cd1e[_0xe0b0('0x20')];this[_0xe0b0('0x21')]=_0x29cd1e['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x29cd1e[_0xe0b0('0x22')];this['dialAMDTotalAnalysisTime']=_0x29cd1e[_0xe0b0('0x23')];this[_0xe0b0('0x24')]=_0x29cd1e['dialAMDMinWordLength'];this[_0xe0b0('0x25')]=_0x29cd1e['dialAMDBetweenWordsSilence'];this[_0xe0b0('0x26')]=_0x29cd1e['dialAMDMaximumNumberOfWords'];this[_0xe0b0('0x27')]=_0x29cd1e['dialAMDSilenceThreshold'];this[_0xe0b0('0x28')]=_0x29cd1e['dialAMDMaximumWordLength'];}module[_0xe0b0('0x29')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 91ac5b8..e907a9c 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 _0xa5c1=['monitor','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','connectedlinenum','accountcode','context','uniqueid','linkedid','exten','answered','endtime','abandoned','lastapplication','lastdata','billableseconds','type','tag'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xa5c1,0x19f));var _0x1a5c=function(_0x97ff13,_0x4df8bb){_0x97ff13=_0x97ff13-0x0;var _0x548ba2=_0xa5c1[_0x97ff13];return _0x548ba2;};'use strict';function Channel(){this[_0x1a5c('0x0')]=null;this[_0x1a5c('0x1')]='';this[_0x1a5c('0x2')]='';this['calleridnum']=0x0;this['calleridname']='';this[_0x1a5c('0x3')]=undefined;this['connectedlinename']=undefined;this[_0x1a5c('0x4')]=0x0;this[_0x1a5c('0x5')]='';this[_0x1a5c('0x6')]=0x0;this[_0x1a5c('0x7')]=0x0;this[_0x1a5c('0x8')]=0x0;this[_0x1a5c('0x9')]=![];this['answertime']=null;this[_0x1a5c('0xa')]=null;this['unmanaged']=![];this[_0x1a5c('0xb')]=![];this[_0x1a5c('0xc')]='';this[_0x1a5c('0xd')]='';this['duration']=0x0;this[_0x1a5c('0xe')]=0x0;this['holdtime']=0x0;this[_0x1a5c('0xf')]=null;this[_0x1a5c('0x10')]=null;this['disposition']=null;this[_0x1a5c('0x11')]=![];this[_0x1a5c('0x12')]=null;this['queue']=null;this[_0x1a5c('0x13')]=[];this[_0x1a5c('0x14')]=undefined;this[_0x1a5c('0x15')]=undefined;this[_0x1a5c('0x16')]=0x0;}module[_0x1a5c('0x17')]=Channel; \ No newline at end of file +var _0xb2f2=['duration','billableseconds','holdtime','type','tag','disposition','monitor','queue','monitors','transferconnectedlinenum','exports','starttime','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','answered','answertime','endtime','abandoned','lastapplication','lastdata'];(function(_0x51d54b,_0x31011d){var _0x1b8c2c=function(_0x28b5e1){while(--_0x28b5e1){_0x51d54b['push'](_0x51d54b['shift']());}};_0x1b8c2c(++_0x31011d);}(_0xb2f2,0xc8));var _0x2b2f=function(_0x3ea7e9,_0x20980c){_0x3ea7e9=_0x3ea7e9-0x0;var _0x3c560b=_0xb2f2[_0x3ea7e9];return _0x3c560b;};'use strict';function Channel(){this[_0x2b2f('0x0')]=null;this[_0x2b2f('0x1')]='';this['destinationchannel']='';this[_0x2b2f('0x2')]=0x0;this[_0x2b2f('0x3')]='';this[_0x2b2f('0x4')]=undefined;this[_0x2b2f('0x5')]=undefined;this[_0x2b2f('0x6')]=0x0;this[_0x2b2f('0x7')]='';this[_0x2b2f('0x8')]=0x0;this['linkedid']=0x0;this[_0x2b2f('0x9')]=0x0;this[_0x2b2f('0xa')]=![];this[_0x2b2f('0xb')]=null;this[_0x2b2f('0xc')]=null;this['unmanaged']=![];this[_0x2b2f('0xd')]=![];this[_0x2b2f('0xe')]='';this[_0x2b2f('0xf')]='';this[_0x2b2f('0x10')]=0x0;this[_0x2b2f('0x11')]=0x0;this[_0x2b2f('0x12')]=0x0;this[_0x2b2f('0x13')]=null;this[_0x2b2f('0x14')]=null;this[_0x2b2f('0x15')]=null;this[_0x2b2f('0x16')]=![];this['monitorFilename']=null;this[_0x2b2f('0x17')]=null;this[_0x2b2f('0x18')]=[];this['transfercalleridnum']=undefined;this[_0x2b2f('0x19')]=undefined;this['mohtime']=0x0;}module[_0x2b2f('0x1a')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 2e535d1..2213744 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 _0x1a61=['consumerSecret','token','tokenSecret','type','serverUrl','exports','name','username','remoteUri','authType','password','consumerKey'];(function(_0x31d849,_0x3db9bc){var _0x1c55b3=function(_0x3b8040){while(--_0x3b8040){_0x31d849['push'](_0x31d849['shift']());}};_0x1c55b3(++_0x3db9bc);}(_0x1a61,0x1e6));var _0x11a6=function(_0x591b84,_0x38bd01){_0x591b84=_0x591b84-0x0;var _0x11cd1c=_0x1a61[_0x591b84];return _0x11cd1c;};'use strict';function DeskAccount(_0x1f8b26){this['id']=_0x1f8b26['id']||0x0;this['name']=_0x1f8b26[_0x11a6('0x0')]||'';this['username']=_0x1f8b26[_0x11a6('0x1')]||'';this[_0x11a6('0x2')]=_0x1f8b26[_0x11a6('0x2')]||'';this[_0x11a6('0x3')]=_0x1f8b26['authType']||'';this['password']=_0x1f8b26[_0x11a6('0x4')]||'';this[_0x11a6('0x5')]=_0x1f8b26['consumerKey']||'';this[_0x11a6('0x6')]=_0x1f8b26[_0x11a6('0x6')]||'';this[_0x11a6('0x7')]=_0x1f8b26[_0x11a6('0x7')]||'';this[_0x11a6('0x8')]=_0x1f8b26[_0x11a6('0x8')]||'';this[_0x11a6('0x9')]=_0x1f8b26[_0x11a6('0x9')]||'';this[_0x11a6('0xa')]=_0x1f8b26['serverUrl']||'';this['Configurations']=_0x1f8b26['Configurations']||{};}module[_0x11a6('0xb')]=DeskAccount; \ No newline at end of file +var _0x975f=['tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0x4716ad,_0x39a2c2){var _0x2c7944=function(_0x6f5d80){while(--_0x6f5d80){_0x4716ad['push'](_0x4716ad['shift']());}};_0x2c7944(++_0x39a2c2);}(_0x975f,0x109));var _0xf975=function(_0x1c8cc6,_0x411e5c){_0x1c8cc6=_0x1c8cc6-0x0;var _0x522936=_0x975f[_0x1c8cc6];return _0x522936;};'use strict';function DeskAccount(_0x15a84f){this['id']=_0x15a84f['id']||0x0;this[_0xf975('0x0')]=_0x15a84f['name']||'';this['username']=_0x15a84f[_0xf975('0x1')]||'';this[_0xf975('0x2')]=_0x15a84f['remoteUri']||'';this[_0xf975('0x3')]=_0x15a84f[_0xf975('0x3')]||'';this[_0xf975('0x4')]=_0x15a84f[_0xf975('0x4')]||'';this['consumerKey']=_0x15a84f[_0xf975('0x5')]||'';this[_0xf975('0x6')]=_0x15a84f[_0xf975('0x6')]||'';this[_0xf975('0x7')]=_0x15a84f['token']||'';this[_0xf975('0x8')]=_0x15a84f[_0xf975('0x8')]||'';this[_0xf975('0x9')]=_0x15a84f['type']||'';this[_0xf975('0xa')]=_0x15a84f[_0xf975('0xa')]||'';this['Configurations']=_0x15a84f[_0xf975('0xb')]||{};}module[_0xf975('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 8cdc489..68d123a 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 _0xc4ac=['clientSecret','serverUrl','Configurations','name','username','remoteUri','tenantId','clientId'];(function(_0xd4c5c2,_0x394e4f){var _0x404d27=function(_0x425e1e){while(--_0x425e1e){_0xd4c5c2['push'](_0xd4c5c2['shift']());}};_0x404d27(++_0x394e4f);}(_0xc4ac,0x123));var _0xcc4a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4ac[_0x3dd15e];return _0x231fd0;};'use strict';function Dynamics365Account(_0x5baf47){this['id']=_0x5baf47['id']||0x0;this[_0xcc4a('0x0')]=_0x5baf47[_0xcc4a('0x0')]||'';this[_0xcc4a('0x1')]=_0x5baf47[_0xcc4a('0x1')]||'';this['password']=_0x5baf47['password']||'';this[_0xcc4a('0x2')]=_0x5baf47[_0xcc4a('0x2')]||'';this[_0xcc4a('0x3')]=_0x5baf47[_0xcc4a('0x3')]||'';this['clientId']=_0x5baf47[_0xcc4a('0x4')]||'';this[_0xcc4a('0x5')]=_0x5baf47[_0xcc4a('0x5')]||{};this[_0xcc4a('0x6')]=_0x5baf47[_0xcc4a('0x6')]||'';this[_0xcc4a('0x7')]=_0x5baf47['Configurations']||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x5f4c=['serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x3c7c79,_0x19f8c4){var _0x2e920b=function(_0x4811b0){while(--_0x4811b0){_0x3c7c79['push'](_0x3c7c79['shift']());}};_0x2e920b(++_0x19f8c4);}(_0x5f4c,0xdf));var _0xc5f4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f4c[_0x432682];return _0x463d05;};'use strict';function Dynamics365Account(_0x285a21){this['id']=_0x285a21['id']||0x0;this['name']=_0x285a21[_0xc5f4('0x0')]||'';this[_0xc5f4('0x1')]=_0x285a21['username']||'';this[_0xc5f4('0x2')]=_0x285a21[_0xc5f4('0x2')]||'';this[_0xc5f4('0x3')]=_0x285a21[_0xc5f4('0x3')]||'';this[_0xc5f4('0x4')]=_0x285a21['tenantId']||'';this[_0xc5f4('0x5')]=_0x285a21[_0xc5f4('0x5')]||'';this[_0xc5f4('0x6')]=_0x285a21[_0xc5f4('0x6')]||{};this['serverUrl']=_0x285a21[_0xc5f4('0x7')]||'';this[_0xc5f4('0x8')]=_0x285a21[_0xc5f4('0x8')]||{};}module[_0xc5f4('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 3578a16..83ca47e 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 _0xd9bc=['Trunk','ListId','key','name','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP'];(function(_0x593f8c,_0x2c6788){var _0x1685b8=function(_0x25404e){while(--_0x25404e){_0x593f8c['push'](_0x593f8c['shift']());}};_0x1685b8(++_0x2c6788);}(_0xd9bc,0x1a3));var _0xcd9b=function(_0x4b4679,_0xcb3989){_0x4b4679=_0x4b4679-0x0;var _0x3f7cae=_0xd9bc[_0x4b4679];return _0x3f7cae;};'use strict';function FaxAccount(_0x22d916){this['id']=_0x22d916['id']||0x0;this['name']=_0x22d916[_0xcd9b('0x0')]||'';this['description']=_0x22d916['description'];this['ecm']=_0x22d916[_0xcd9b('0x1')];this[_0xcd9b('0x2')]=_0x22d916[_0xcd9b('0x2')];this['localstationid']=_0x22d916[_0xcd9b('0x3')];this[_0xcd9b('0x4')]=_0x22d916[_0xcd9b('0x4')]||0x960;this[_0xcd9b('0x5')]=_0x22d916['maxrate']||0x3840;this[_0xcd9b('0x6')]=_0x22d916[_0xcd9b('0x6')]||_0xcd9b('0x7');this['gateway']=_0x22d916[_0xcd9b('0x8')]||'no';this[_0xcd9b('0x9')]=_0x22d916[_0xcd9b('0x9')]||'no';this[_0xcd9b('0xa')]=_0x22d916[_0xcd9b('0xa')]||0x1388;this[_0xcd9b('0xb')]=_0x22d916['tech']||_0xcd9b('0xc');this[_0xcd9b('0xd')]=_0x22d916[_0xcd9b('0xd')]?_0x22d916[_0xcd9b('0xd')]:undefined;this[_0xcd9b('0xe')]=_0x22d916[_0xcd9b('0xe')];this[_0xcd9b('0xf')]=_0x22d916['key'];}module['exports']=FaxAccount; \ No newline at end of file +var _0xdbe8=['ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk'];(function(_0x2e9c9f,_0x13134a){var _0x2c3e1d=function(_0x169308){while(--_0x169308){_0x2e9c9f['push'](_0x2e9c9f['shift']());}};_0x2c3e1d(++_0x13134a);}(_0xdbe8,0x1b3));var _0x8dbe=function(_0x4c73cd,_0x2c19a7){_0x4c73cd=_0x4c73cd-0x0;var _0x404242=_0xdbe8[_0x4c73cd];return _0x404242;};'use strict';function FaxAccount(_0x1da236){this['id']=_0x1da236['id']||0x0;this[_0x8dbe('0x0')]=_0x1da236[_0x8dbe('0x0')]||'';this[_0x8dbe('0x1')]=_0x1da236[_0x8dbe('0x1')];this[_0x8dbe('0x2')]=_0x1da236[_0x8dbe('0x2')];this['headerinfo']=_0x1da236[_0x8dbe('0x3')];this[_0x8dbe('0x4')]=_0x1da236[_0x8dbe('0x4')];this[_0x8dbe('0x5')]=_0x1da236[_0x8dbe('0x5')]||0x960;this[_0x8dbe('0x6')]=_0x1da236['maxrate']||0x3840;this[_0x8dbe('0x7')]=_0x1da236[_0x8dbe('0x7')]||_0x8dbe('0x8');this[_0x8dbe('0x9')]=_0x1da236[_0x8dbe('0x9')]||'no';this[_0x8dbe('0xa')]=_0x1da236[_0x8dbe('0xa')]||'no';this[_0x8dbe('0xb')]=_0x1da236['t38timeout']||0x1388;this[_0x8dbe('0xc')]=_0x1da236[_0x8dbe('0xc')]||_0x8dbe('0xd');this['Trunk']=_0x1da236[_0x8dbe('0xe')]?_0x1da236['Trunk']:undefined;this[_0x8dbe('0xf')]=_0x1da236[_0x8dbe('0xf')];this['key']=_0x1da236[_0x8dbe('0x10')];}module[_0x8dbe('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 27d7dde..9ed98c7 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 _0xb196=['remoteUri','serverUrl','name','username','apiKey','token'];(function(_0x386b08,_0x5d49da){var _0x4b38ef=function(_0x197a15){while(--_0x197a15){_0x386b08['push'](_0x386b08['shift']());}};_0x4b38ef(++_0x5d49da);}(_0xb196,0x1f4));var _0x6b19=function(_0x14ea69,_0x7de250){_0x14ea69=_0x14ea69-0x0;var _0x2bfb7e=_0xb196[_0x14ea69];return _0x2bfb7e;};'use strict';function FreshdeskAccount(_0x991177){this['id']=_0x991177['id']||0x0;this[_0x6b19('0x0')]=_0x991177[_0x6b19('0x0')]||'';this[_0x6b19('0x1')]=_0x991177[_0x6b19('0x1')]||'';this[_0x6b19('0x2')]=_0x991177[_0x6b19('0x3')]||'';this[_0x6b19('0x4')]=_0x991177[_0x6b19('0x4')]||'';this[_0x6b19('0x5')]=_0x991177['serverUrl']||'';this['Configurations']=_0x991177['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xe4c6=['serverUrl','Configurations','exports','username','token','remoteUri'];(function(_0x5e14bb,_0x5eb305){var _0x51681d=function(_0xfce217){while(--_0xfce217){_0x5e14bb['push'](_0x5e14bb['shift']());}};_0x51681d(++_0x5eb305);}(_0xe4c6,0xe7));var _0x6e4c=function(_0x15525f,_0x142a1e){_0x15525f=_0x15525f-0x0;var _0x118eb6=_0xe4c6[_0x15525f];return _0x118eb6;};'use strict';function FreshdeskAccount(_0x8ca51){this['id']=_0x8ca51['id']||0x0;this['name']=_0x8ca51['name']||'';this['username']=_0x8ca51[_0x6e4c('0x0')]||'';this['apiKey']=_0x8ca51[_0x6e4c('0x1')]||'';this['remoteUri']=_0x8ca51[_0x6e4c('0x2')]||'';this[_0x6e4c('0x3')]=_0x8ca51[_0x6e4c('0x3')]||'';this[_0x6e4c('0x4')]=_0x8ca51[_0x6e4c('0x4')]||{};}module[_0x6e4c('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 09976cd..627b970 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 _0x2c8c=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x754ab4,_0x56daa7){var _0x34079a=function(_0x295ec1){while(--_0x295ec1){_0x754ab4['push'](_0x754ab4['shift']());}};_0x34079a(++_0x56daa7);}(_0x2c8c,0x1cb));var _0xc2c8=function(_0x6e89a3,_0x2bbe4a){_0x6e89a3=_0x6e89a3-0x0;var _0x6261ef=_0x2c8c[_0x6e89a3];return _0x6261ef;};'use strict';function FreshsalesAccount(_0x3b5c7d){this['id']=_0x3b5c7d['id']||0x0;this[_0xc2c8('0x0')]=_0x3b5c7d[_0xc2c8('0x0')]||'';this[_0xc2c8('0x1')]=_0x3b5c7d[_0xc2c8('0x1')]||'';this[_0xc2c8('0x2')]=_0x3b5c7d[_0xc2c8('0x3')]||'';this['remoteUri']=_0x3b5c7d[_0xc2c8('0x4')]||'';this[_0xc2c8('0x5')]=_0x3b5c7d[_0xc2c8('0x5')]||'';this[_0xc2c8('0x6')]=_0x3b5c7d['Configurations']||{};}module[_0xc2c8('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xee2f=['token','remoteUri','serverUrl','name'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0xee2f,0x12f));var _0xfee2=function(_0x11f9ff,_0x1810db){_0x11f9ff=_0x11f9ff-0x0;var _0x4f7288=_0xee2f[_0x11f9ff];return _0x4f7288;};'use strict';function FreshsalesAccount(_0x178d7a){this['id']=_0x178d7a['id']||0x0;this[_0xfee2('0x0')]=_0x178d7a[_0xfee2('0x0')]||'';this['username']=_0x178d7a['username']||'';this['apiKey']=_0x178d7a[_0xfee2('0x1')]||'';this[_0xfee2('0x2')]=_0x178d7a[_0xfee2('0x2')]||'';this[_0xfee2('0x3')]=_0x178d7a['serverUrl']||'';this['Configurations']=_0x178d7a['Configurations']||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index a7c6c2c..710da5b 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 _0x14fb=['queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinenum','exten','holdtime','assigned','variables','exports','type','uniqueid','calleridname','queue','queuecallerjoinAt','count','queuecallerabandon'];(function(_0x1d2acc,_0x5cb74d){var _0x4451e8=function(_0x2b37bb){while(--_0x2b37bb){_0x1d2acc['push'](_0x1d2acc['shift']());}};_0x4451e8(++_0x5cb74d);}(_0x14fb,0x77));var _0xb14f=function(_0x5dad8b,_0x6ebe38){_0x5dad8b=_0x5dad8b-0x0;var _0x3da959=_0x14fb[_0x5dad8b];return _0x3da959;};'use strict';function QueueReport(){this[_0xb14f('0x0')]='inbound';this[_0xb14f('0x1')]='';this['calleridnum']='';this[_0xb14f('0x2')]='';this[_0xb14f('0x3')]='';this[_0xb14f('0x4')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this[_0xb14f('0x5')]=0x1;this[_0xb14f('0x6')]=![];this['queuecallerabandonAt']=null;this[_0xb14f('0x7')]=![];this[_0xb14f('0x8')]=null;this['queuecallerexit']=![];this[_0xb14f('0x9')]=null;this[_0xb14f('0xa')]=0x1;this[_0xb14f('0xb')]='';this[_0xb14f('0xc')]='';this['connectedlinename']='';this['accountcode']='';this['context']='';this[_0xb14f('0xd')]='';this['priority']='';this[_0xb14f('0xe')]=0x0;this[_0xb14f('0xf')]=![];this['lastAssignedTo']='';this['mohtime']=0x0;this[_0xb14f('0x10')]={};}module[_0xb14f('0x11')]=QueueReport; \ No newline at end of file +var _0x418f=['inbound','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','position','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','exports','type'];(function(_0x3145e0,_0x3263d8){var _0x40692f=function(_0x8d437){while(--_0x8d437){_0x3145e0['push'](_0x3145e0['shift']());}};_0x40692f(++_0x3263d8);}(_0x418f,0xa0));var _0xf418=function(_0x1ddcf0,_0x4fad0c){_0x1ddcf0=_0x1ddcf0-0x0;var _0xfd3196=_0x418f[_0x1ddcf0];return _0xfd3196;};'use strict';function QueueReport(){this[_0xf418('0x0')]=_0xf418('0x1');this[_0xf418('0x2')]='';this[_0xf418('0x3')]='';this[_0xf418('0x4')]='';this[_0xf418('0x5')]='';this['queuecallerjoinAt']=null;this[_0xf418('0x6')]=null;this[_0xf418('0x7')]=0x1;this['count']=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0xf418('0x8')]=![];this[_0xf418('0x9')]=null;this['queuecallerexit']=![];this[_0xf418('0xa')]=null;this['originalposition']=0x1;this[_0xf418('0xb')]='';this[_0xf418('0xc')]='';this[_0xf418('0xd')]='';this[_0xf418('0xe')]='';this[_0xf418('0xf')]='';this[_0xf418('0x10')]='';this[_0xf418('0x11')]='';this[_0xf418('0x12')]=0x0;this[_0xf418('0x13')]=![];this[_0xf418('0x14')]='';this[_0xf418('0x15')]=0x0;this['variables']={};}module[_0xf418('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index ac37eac..d047f6c 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 _0x5ac3=['integrationTab','serverUrl','Configurations','exports','name','password','clientId','clientSecret','securityToken','type'];(function(_0x526a68,_0x5d5112){var _0x565821=function(_0x2cba74){while(--_0x2cba74){_0x526a68['push'](_0x526a68['shift']());}};_0x565821(++_0x5d5112);}(_0x5ac3,0x176));var _0x35ac=function(_0xdfab64,_0x356196){_0xdfab64=_0xdfab64-0x0;var _0x23fd4f=_0x5ac3[_0xdfab64];return _0x23fd4f;};'use strict';function SalesforceAccount(_0x23da1e){this['id']=_0x23da1e['id']||0x0;this[_0x35ac('0x0')]=_0x23da1e[_0x35ac('0x0')]||'';this['username']=_0x23da1e['username']||'';this['remoteUri']=_0x23da1e['remoteUri']||'';this[_0x35ac('0x1')]=_0x23da1e[_0x35ac('0x1')]||'';this[_0x35ac('0x2')]=_0x23da1e['clientId']||'';this[_0x35ac('0x3')]=_0x23da1e[_0x35ac('0x3')]||'';this[_0x35ac('0x4')]=_0x23da1e['securityToken']||'';this[_0x35ac('0x5')]=_0x23da1e[_0x35ac('0x5')]||_0x35ac('0x6');this[_0x35ac('0x7')]=_0x23da1e[_0x35ac('0x7')]||'';this[_0x35ac('0x8')]=_0x23da1e[_0x35ac('0x8')]||{};}module[_0x35ac('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x1b50=['type','serverUrl','Configurations','exports','name','username','remoteUri','password','clientSecret','securityToken'];(function(_0x220106,_0x20cae4){var _0x3cded5=function(_0x428f91){while(--_0x428f91){_0x220106['push'](_0x220106['shift']());}};_0x3cded5(++_0x20cae4);}(_0x1b50,0xcc));var _0x01b5=function(_0x2d2309,_0x360354){_0x2d2309=_0x2d2309-0x0;var _0x51e163=_0x1b50[_0x2d2309];return _0x51e163;};'use strict';function SalesforceAccount(_0x5b8415){this['id']=_0x5b8415['id']||0x0;this[_0x01b5('0x0')]=_0x5b8415[_0x01b5('0x0')]||'';this[_0x01b5('0x1')]=_0x5b8415[_0x01b5('0x1')]||'';this[_0x01b5('0x2')]=_0x5b8415[_0x01b5('0x2')]||'';this['password']=_0x5b8415[_0x01b5('0x3')]||'';this['clientId']=_0x5b8415['clientId']||'';this[_0x01b5('0x4')]=_0x5b8415['clientSecret']||'';this['securityToken']=_0x5b8415[_0x01b5('0x5')]||'';this[_0x01b5('0x6')]=_0x5b8415[_0x01b5('0x6')]||'integrationTab';this[_0x01b5('0x7')]=_0x5b8415['serverUrl']||'';this[_0x01b5('0x8')]=_0x5b8415['Configurations']||{};}module[_0x01b5('0x9')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index a97c28e..dde686c 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 _0x728f=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x555bbd,_0x196748){var _0x3184d7=function(_0x274943){while(--_0x274943){_0x555bbd['push'](_0x555bbd['shift']());}};_0x3184d7(++_0x196748);}(_0x728f,0x17d));var _0xf728=function(_0x5b5856,_0x5e353c){_0x5b5856=_0x5b5856-0x0;var _0x4325a3=_0x728f[_0x5b5856];return _0x4325a3;};'use strict';function ServicenowAccount(_0x1e18a5){this['id']=_0x1e18a5['id']||0x0;this[_0xf728('0x0')]=_0x1e18a5['name']||'';this['username']=_0x1e18a5[_0xf728('0x1')]||'';this['password']=_0x1e18a5[_0xf728('0x2')]||'';this[_0xf728('0x3')]=_0x1e18a5[_0xf728('0x3')]||'';this[_0xf728('0x4')]=_0x1e18a5[_0xf728('0x4')]||'';this['Configurations']=_0x1e18a5[_0xf728('0x5')]||{};}module[_0xf728('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xb26c=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x28caf4,_0x797e55){var _0x503f93=function(_0x1dca13){while(--_0x1dca13){_0x28caf4['push'](_0x28caf4['shift']());}};_0x503f93(++_0x797e55);}(_0xb26c,0x120));var _0xcb26=function(_0x91718e,_0x42d1f4){_0x91718e=_0x91718e-0x0;var _0x4226b6=_0xb26c[_0x91718e];return _0x4226b6;};'use strict';function ServicenowAccount(_0x366776){this['id']=_0x366776['id']||0x0;this[_0xcb26('0x0')]=_0x366776[_0xcb26('0x0')]||'';this[_0xcb26('0x1')]=_0x366776[_0xcb26('0x1')]||'';this['password']=_0x366776[_0xcb26('0x2')]||'';this[_0xcb26('0x3')]=_0x366776[_0xcb26('0x3')]||'';this[_0xcb26('0x4')]=_0x366776[_0xcb26('0x4')]||'';this[_0xcb26('0x5')]=_0x366776[_0xcb26('0x5')]||{};}module[_0xcb26('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index ccb2b17..458b650 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 _0xdbe9=['username','password','serverUrl','Configurations','exports','name'];(function(_0x419aa4,_0x5926a7){var _0x557d9b=function(_0x43c9ac){while(--_0x43c9ac){_0x419aa4['push'](_0x419aa4['shift']());}};_0x557d9b(++_0x5926a7);}(_0xdbe9,0x113));var _0x9dbe=function(_0x1cd604,_0x3daf91){_0x1cd604=_0x1cd604-0x0;var _0x56203b=_0xdbe9[_0x1cd604];return _0x56203b;};'use strict';function SugarcrmAccount(_0x5e4aee){this['id']=_0x5e4aee['id']||0x0;this[_0x9dbe('0x0')]=_0x5e4aee['name']||'';this[_0x9dbe('0x1')]=_0x5e4aee[_0x9dbe('0x1')]||'';this[_0x9dbe('0x2')]=_0x5e4aee['password']||'';this['remoteUri']=_0x5e4aee['remoteUri']||'';this[_0x9dbe('0x3')]=_0x5e4aee[_0x9dbe('0x3')]||'';this[_0x9dbe('0x4')]=_0x5e4aee[_0x9dbe('0x4')]||{};}module[_0x9dbe('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0xca1e=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x5ac42,_0x4ae1cb){var _0x5c4796=function(_0xb02454){while(--_0xb02454){_0x5ac42['push'](_0x5ac42['shift']());}};_0x5c4796(++_0x4ae1cb);}(_0xca1e,0x121));var _0xeca1=function(_0x1e28f0,_0x3b3a1b){_0x1e28f0=_0x1e28f0-0x0;var _0x5f55cf=_0xca1e[_0x1e28f0];return _0x5f55cf;};'use strict';function SugarcrmAccount(_0x12be11){this['id']=_0x12be11['id']||0x0;this['name']=_0x12be11[_0xeca1('0x0')]||'';this[_0xeca1('0x1')]=_0x12be11[_0xeca1('0x1')]||'';this[_0xeca1('0x2')]=_0x12be11[_0xeca1('0x2')]||'';this[_0xeca1('0x3')]=_0x12be11[_0xeca1('0x3')]||'';this[_0xeca1('0x4')]=_0x12be11[_0xeca1('0x4')]||'';this[_0xeca1('0x5')]=_0x12be11['Configurations']||{};}module[_0xeca1('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 57c184a..a217d4d 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 _0x26c2=['address','exports','name','accountcode','unknown','stateTime','status'];(function(_0x447341,_0x44dfab){var _0x33efe7=function(_0x1c04f6){while(--_0x1c04f6){_0x447341['push'](_0x447341['shift']());}};_0x33efe7(++_0x44dfab);}(_0x26c2,0x191));var _0x226c=function(_0x4a0d74,_0x21b293){_0x4a0d74=_0x4a0d74-0x0;var _0x2b2210=_0x26c2[_0x4a0d74];return _0x2b2210;};'use strict';function Telephone(_0x9476bc){this['id']=_0x9476bc['id']||0x0;this[_0x226c('0x0')]=_0x9476bc[_0x226c('0x0')]||'';this[_0x226c('0x1')]=_0x9476bc[_0x226c('0x1')]||'';this['state']=_0x226c('0x2');this[_0x226c('0x3')]=0x0;this[_0x226c('0x4')]=_0x226c('0x2');this[_0x226c('0x5')]='';}module[_0x226c('0x6')]=Telephone; \ No newline at end of file +var _0xa316=['exports','name','accountcode','state','unknown','stateTime','status','address'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa316,0x79));var _0x6a31=function(_0x68bada,_0x25ff36){_0x68bada=_0x68bada-0x0;var _0x1f9307=_0xa316[_0x68bada];return _0x1f9307;};'use strict';function Telephone(_0x42e72b){this['id']=_0x42e72b['id']||0x0;this['name']=_0x42e72b[_0x6a31('0x0')]||'';this['accountcode']=_0x42e72b[_0x6a31('0x1')]||'';this[_0x6a31('0x2')]=_0x6a31('0x3');this[_0x6a31('0x4')]=0x0;this[_0x6a31('0x5')]=_0x6a31('0x3');this[_0x6a31('0x6')]='';}module[_0x6a31('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 d8ed61e..b2db795 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 _0xd74b=['name','html','exports'];(function(_0x201211,_0x2e2788){var _0x3641da=function(_0xfb58b4){while(--_0xfb58b4){_0x201211['push'](_0x201211['shift']());}};_0x3641da(++_0x2e2788);}(_0xd74b,0x1e0));var _0xbd74=function(_0x5cb338,_0x709105){_0x5cb338=_0x5cb338-0x0;var _0x546a16=_0xd74b[_0x5cb338];return _0x546a16;};'use strict';function template(_0x2774b4){this['id']=_0x2774b4['id']||0x0;this[_0xbd74('0x0')]=_0x2774b4[_0xbd74('0x0')]||'';this[_0xbd74('0x1')]=_0x2774b4[_0xbd74('0x1')]||'';}module[_0xbd74('0x2')]=template; \ No newline at end of file +var _0xc651=['html','exports','name'];(function(_0xeca44e,_0x4f6fa6){var _0x18074f=function(_0x5a9f5c){while(--_0x5a9f5c){_0xeca44e['push'](_0xeca44e['shift']());}};_0x18074f(++_0x4f6fa6);}(_0xc651,0x16a));var _0x1c65=function(_0x3f3de8,_0x4007ca){_0x3f3de8=_0x3f3de8-0x0;var _0x9184fe=_0xc651[_0x3f3de8];return _0x9184fe;};'use strict';function template(_0x532c04){this['id']=_0x532c04['id']||0x0;this[_0x1c65('0x0')]=_0x532c04[_0x1c65('0x0')]||'';this[_0x1c65('0x1')]=_0x532c04[_0x1c65('0x1')]||'';}module[_0x1c65('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 278a8c3..dcb2f9e 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 _0x9957=['AnyConditions','Actions','exports','name','channel','voice','status','AllConditions'];(function(_0xa5a920,_0x2d8772){var _0x596618=function(_0x5eab42){while(--_0x5eab42){_0xa5a920['push'](_0xa5a920['shift']());}};_0x596618(++_0x2d8772);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';function Trigger(_0x202794){this['id']=_0x202794['id']||0x0;this[_0x7995('0x0')]=_0x202794[_0x7995('0x0')]||'';this[_0x7995('0x1')]=_0x202794['channel']||_0x7995('0x2');this[_0x7995('0x3')]=_0x202794[_0x7995('0x3')]||![];this[_0x7995('0x4')]=_0x202794['AllConditions']||[];this[_0x7995('0x5')]=_0x202794[_0x7995('0x5')]||[];this[_0x7995('0x6')]=_0x202794[_0x7995('0x6')]||[];}module[_0x7995('0x7')]=Trigger; \ No newline at end of file +var _0x008c=['name','channel','status','AllConditions','AnyConditions','Actions','exports'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0x008c,0x188));var _0xc008=function(_0x53f707,_0x51a2f7){_0x53f707=_0x53f707-0x0;var _0x10a9f5=_0x008c[_0x53f707];return _0x10a9f5;};'use strict';function Trigger(_0x2be4ba){this['id']=_0x2be4ba['id']||0x0;this[_0xc008('0x0')]=_0x2be4ba[_0xc008('0x0')]||'';this[_0xc008('0x1')]=_0x2be4ba[_0xc008('0x1')]||'voice';this[_0xc008('0x2')]=_0x2be4ba[_0xc008('0x2')]||![];this[_0xc008('0x3')]=_0x2be4ba[_0xc008('0x3')]||[];this[_0xc008('0x4')]=_0x2be4ba[_0xc008('0x4')]||[];this[_0xc008('0x5')]=_0x2be4ba[_0xc008('0x5')]||[];}module[_0xc008('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 1d62368..888a68f 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 _0xc5bb=['exports','active','name','state','unknown','status','registry','host','port','domain','domainport','stateRegistry','registrationtime','address'];(function(_0x59c7b9,_0x5341ee){var _0x200353=function(_0x58d858){while(--_0x58d858){_0x59c7b9['push'](_0x59c7b9['shift']());}};_0x200353(++_0x5341ee);}(_0xc5bb,0x7f));var _0xbc5b=function(_0x515e1e,_0x4fd226){_0x515e1e=_0x515e1e-0x0;var _0x5ed4b8=_0xc5bb[_0x515e1e];return _0x5ed4b8;};'use strict';function Trunk(_0x16db04){this['id']=_0x16db04['id']||0x0;this[_0xbc5b('0x0')]=_0x16db04[_0xbc5b('0x0')]||![];this[_0xbc5b('0x1')]=_0x16db04[_0xbc5b('0x1')]||'';this[_0xbc5b('0x2')]=_0xbc5b('0x3');this['stateTime']=0x0;this[_0xbc5b('0x4')]=_0xbc5b('0x3');this[_0xbc5b('0x5')]=_0x16db04[_0xbc5b('0x5')]&&_0x16db04[_0xbc5b('0x5')]['indexOf'](':')?_0x16db04[_0xbc5b('0x5')]['split'](':')[0x0]:'';this[_0xbc5b('0x6')]='';this[_0xbc5b('0x7')]='';this[_0xbc5b('0x8')]='';this[_0xbc5b('0x9')]='';this['refresh']='';this[_0xbc5b('0xa')]=_0xbc5b('0x3');this[_0xbc5b('0xb')]='';this[_0xbc5b('0xc')]='';}module[_0xbc5b('0xd')]=Trunk; \ No newline at end of file +var _0x2f9e=['unknown','stateTime','status','registry','split','host','port','domainport','refresh','stateRegistry','registrationtime','address','exports','active','name'];(function(_0x34cda7,_0xfd20d4){var _0x2ae028=function(_0x33c78e){while(--_0x33c78e){_0x34cda7['push'](_0x34cda7['shift']());}};_0x2ae028(++_0xfd20d4);}(_0x2f9e,0x166));var _0xe2f9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2f9e[_0xa464c9];return _0x3d73c4;};'use strict';function Trunk(_0x1da05e){this['id']=_0x1da05e['id']||0x0;this[_0xe2f9('0x0')]=_0x1da05e['active']||![];this[_0xe2f9('0x1')]=_0x1da05e[_0xe2f9('0x1')]||'';this['state']=_0xe2f9('0x2');this[_0xe2f9('0x3')]=0x0;this[_0xe2f9('0x4')]=_0xe2f9('0x2');this[_0xe2f9('0x5')]=_0x1da05e[_0xe2f9('0x5')]&&_0x1da05e[_0xe2f9('0x5')]['indexOf'](':')?_0x1da05e[_0xe2f9('0x5')][_0xe2f9('0x6')](':')[0x0]:'';this[_0xe2f9('0x7')]='';this[_0xe2f9('0x8')]='';this['domain']='';this[_0xe2f9('0x9')]='';this[_0xe2f9('0xa')]='';this[_0xe2f9('0xb')]='unknown';this[_0xe2f9('0xc')]='';this[_0xe2f9('0xd')]='';}module[_0xe2f9('0xe')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index e6744b5..22664e6 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 _0xfe49=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xfe49,0x174));var _0x9fe4=function(_0x1a9a81,_0x4e04c7){_0x1a9a81=_0x1a9a81-0x0;var _0x59bf1f=_0xfe49[_0x1a9a81];return _0x59bf1f;};'use strict';function voiceExtension(_0x3c81a4){this['id']=_0x3c81a4['id']||0x0;this['exten']=_0x3c81a4[_0x9fe4('0x0')]||'';this[_0x9fe4('0x1')]=_0x3c81a4[_0x9fe4('0x1')]||_0x9fe4('0x2');this[_0x9fe4('0x3')]=_0x3c81a4[_0x9fe4('0x3')]||![];}module[_0x9fe4('0x4')]=voiceExtension; \ No newline at end of file +var _0xe159=['recordingFormat','none','mandatoryDisposition','exten'];(function(_0x741fe2,_0x30fcae){var _0x98b71b=function(_0x553186){while(--_0x553186){_0x741fe2['push'](_0x741fe2['shift']());}};_0x98b71b(++_0x30fcae);}(_0xe159,0x16b));var _0x9e15=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe159[_0x42cae2];return _0x5f256f;};'use strict';function voiceExtension(_0x2b2394){this['id']=_0x2b2394['id']||0x0;this['exten']=_0x2b2394[_0x9e15('0x0')]||'';this[_0x9e15('0x1')]=_0x2b2394[_0x9e15('0x1')]||_0x9e15('0x2');this[_0x9e15('0x3')]=_0x2b2394[_0x9e15('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index bda440a..63b5b4e 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 _0x61ea=['sendMessageOneNotActive','temp','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','unavailable','ringing','ringinuse','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','sumDuration','sumHoldTime','loggedIn','available','acw','acwTimeout','autopause'];(function(_0x2da357,_0x1f9b2f){var _0x138fdd=function(_0xe3077d){while(--_0xe3077d){_0x2da357['push'](_0x2da357['shift']());}};_0x138fdd(++_0x1f9b2f);}(_0x61ea,0xd2));var _0xa61e=function(_0x29c4c5,_0x6d8b7b){_0x29c4c5=_0x29c4c5-0x0;var _0x18b040=_0x61ea[_0x29c4c5];return _0x18b040;};'use strict';var statusDesc=[_0xa61e('0x0'),_0xa61e('0x1'),_0xa61e('0x2'),_0xa61e('0x3'),'invalid',_0xa61e('0x4'),_0xa61e('0x5'),_0xa61e('0x6'),'onhold'];var monitorFormat={'wav':_0xa61e('0x7'),'wav49':_0xa61e('0x8'),'gsm':_0xa61e('0x9')};var strategy={'rrmemory':_0xa61e('0xa'),'roundrobin':_0xa61e('0xb')};function VoiceQueue(_0x5bee85){this['id']=_0x5bee85['id']||0x0;this[_0xa61e('0xc')]=_0x5bee85[_0xa61e('0xc')]||'';this[_0xa61e('0xd')]=_0x5bee85[_0xa61e('0xd')]||'';this['type']=_0x5bee85[_0xa61e('0xe')]||_0xa61e('0xf');this[_0xa61e('0x10')]=0x0;this[_0xa61e('0x11')]=0x0;this[_0xa61e('0x12')]=0x0;this['answered']=0x0;this[_0xa61e('0x13')]=0x0;this[_0xa61e('0x14')]=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0xa61e('0x15')]=0x0;this[_0xa61e('0x16')]=0x0;this[_0xa61e('0x17')]=_0x5bee85[_0xa61e('0x17')]||![];this[_0xa61e('0x18')]=_0x5bee85[_0xa61e('0x18')]||0xa;this[_0xa61e('0x19')]=_0x5bee85['autopause']||'no';this[_0xa61e('0x1a')]=!![];this['message']='';this['originated']=0x0;this[_0xa61e('0x1b')]=0x0;this['dialTimezone']=_0x5bee85['dialTimezone']||null;this['dialGlobalInterval']=_0x5bee85['dialGlobalInterval']?_0x5bee85[_0xa61e('0x1c')]:null;this[_0xa61e('0x1d')]=_0x5bee85['dialActive'];this[_0xa61e('0x1e')]=_0x5bee85['dialMethod']||'progressive';this['dialLimitChannel']=_0x5bee85[_0xa61e('0x1f')]||0x0;this['dialLimitQueue']=_0x5bee85[_0xa61e('0x20')]||0x0;this[_0xa61e('0x21')]=_0x5bee85[_0xa61e('0x21')]||0x1;this[_0xa61e('0x22')]=_0x5bee85[_0xa61e('0x22')]||_0xa61e('0x23');this[_0xa61e('0x24')]=_0x5bee85[_0xa61e('0x24')]||0.03;this[_0xa61e('0x25')]=_0x5bee85[_0xa61e('0x25')]||0x258;this[_0xa61e('0x26')]=_0x5bee85[_0xa61e('0x26')]||_0xa61e('0x27');this[_0xa61e('0x28')]=_0x5bee85[_0xa61e('0x28')]||'anonymous';this[_0xa61e('0x29')]=_0x5bee85[_0xa61e('0x29')]||0x1e;this[_0xa61e('0x2a')]=_0x5bee85['dialQueueOptions']||_0xa61e('0x2b');this[_0xa61e('0x2c')]=_0x5bee85['dialQueueTimeout']||0x3;this[_0xa61e('0x2d')]=_0x5bee85[_0xa61e('0x2d')]||undefined;this['dialCongestionMaxRetry']=_0x5bee85[_0xa61e('0x2e')]||0x3;this[_0xa61e('0x2f')]=_0x5bee85[_0xa61e('0x2f')]||0x96;this[_0xa61e('0x30')]=_0x5bee85[_0xa61e('0x30')]||0x3;this[_0xa61e('0x31')]=_0x5bee85[_0xa61e('0x31')]||0x96;this[_0xa61e('0x32')]=_0x5bee85[_0xa61e('0x32')]||0x3;this[_0xa61e('0x33')]=_0x5bee85[_0xa61e('0x33')]||0x96;this[_0xa61e('0x34')]=_0x5bee85['dialNoSuchNumberMaxRetry']||0x3;this[_0xa61e('0x35')]=_0x5bee85[_0xa61e('0x35')]||0x96;this['dialDropMaxRetry']=_0x5bee85[_0xa61e('0x36')]||0x3;this['dialDropRetryFrequency']=_0x5bee85[_0xa61e('0x37')]||0x96;this[_0xa61e('0x38')]=_0x5bee85[_0xa61e('0x38')]||0x3;this[_0xa61e('0x39')]=_0x5bee85[_0xa61e('0x39')]||0x96;this[_0xa61e('0x3a')]=_0x5bee85[_0xa61e('0x3a')]||0x3;this['dialMachineRetryFrequency']=_0x5bee85[_0xa61e('0x3b')]||0x96;this['dialAgentRejectMaxRetry']=_0x5bee85[_0xa61e('0x3c')]||0x3;this[_0xa61e('0x3d')]=_0x5bee85[_0xa61e('0x3d')]||0x96;this[_0xa61e('0x3e')]=_0x5bee85[_0xa61e('0x3e')]||0x4;this[_0xa61e('0x3f')]=_0x5bee85[_0xa61e('0x3f')]?_0x5bee85[_0xa61e('0x3f')]:undefined;this[_0xa61e('0x40')]=_0x5bee85[_0xa61e('0x40')]?_0x5bee85[_0xa61e('0x40')]:undefined;this[_0xa61e('0x41')]=_0x5bee85[_0xa61e('0x41')]||undefined;this[_0xa61e('0x42')]=_0x5bee85[_0xa61e('0x42')]?_0x5bee85[_0xa61e('0x42')]:undefined;this['dialOrderByScheduledAt']=_0x5bee85[_0xa61e('0x43')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x5bee85[_0xa61e('0x44')]||undefined;this[_0xa61e('0x45')]=_0x5bee85[_0xa61e('0x45')]||undefined;this[_0xa61e('0x46')]=strategy[_0x5bee85[_0xa61e('0x46')]]||_0xa61e('0xa');this[_0xa61e('0x47')]=!![];this[_0xa61e('0x48')]=_0x5bee85[_0xa61e('0x48')]||![];this['dialAMDInitialSilence']=_0x5bee85[_0xa61e('0x49')];this[_0xa61e('0x4a')]=_0x5bee85['dialAMDGreeting'];this[_0xa61e('0x4b')]=_0x5bee85[_0xa61e('0x4b')];this[_0xa61e('0x4c')]=_0x5bee85[_0xa61e('0x4c')];this[_0xa61e('0x4d')]=_0x5bee85[_0xa61e('0x4d')];this['dialAMDBetweenWordsSilence']=_0x5bee85[_0xa61e('0x4e')];this[_0xa61e('0x4f')]=_0x5bee85[_0xa61e('0x4f')];this[_0xa61e('0x50')]=_0x5bee85[_0xa61e('0x50')];this['dialAMDMaximumWordLength']=_0x5bee85[_0xa61e('0x51')];this[_0xa61e('0x52')]=0x0;this[_0xa61e('0x53')]=0x0;this['timeout']=_0x5bee85[_0xa61e('0x54')];this['outboundAnswerCallsDay']=0x0;this[_0xa61e('0x55')]=0x0;this[_0xa61e('0x56')]=0x0;this[_0xa61e('0x57')]=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xa61e('0x58')]=0x0;this[_0xa61e('0x59')]=0x0;this[_0xa61e('0x5a')]=0x0;this[_0xa61e('0x5b')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xa61e('0x5c')]=0x0;this[_0xa61e('0x5d')]=0x0;this[_0xa61e('0x5e')]=0x0;this[_0xa61e('0x5f')]=undefined;this[_0xa61e('0x60')]=undefined;this[_0xa61e('0x61')]=undefined;this[_0xa61e('0x62')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xa61e('0x63')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xa61e('0x64')]=0x0;this[_0xa61e('0x65')]=0x0;this[_0xa61e('0x66')]=0x0;this[_0xa61e('0x67')]=0x0;this[_0xa61e('0x68')]=0x0;this[_0xa61e('0x69')]=_0x5bee85[_0xa61e('0x6a')]||0x14;this['predictiveIntervalMinThreshold']=_0x5bee85['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xa61e('0x6b')]=0x0;this[_0xa61e('0x6c')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this['erlangCallToSecond']=0x0;this[_0xa61e('0x6d')]=0x0;this['erlangBusyFactor']=0x0;this[_0xa61e('0x6e')]=_0x5bee85['dialRecallMeTimeout']||0x1e;this[_0xa61e('0x6f')]=_0x5bee85[_0xa61e('0x6f')]||![];this[_0xa61e('0x70')]=_0x5bee85[_0xa61e('0x70')]||undefined;this[_0xa61e('0x71')]=_0x5bee85[_0xa61e('0x71')]||![];this[_0xa61e('0x72')]=_0x5bee85[_0xa61e('0x72')]||![];this['monitor_format']=monitorFormat[_0x5bee85[_0xa61e('0xd')]]?monitorFormat[_0x5bee85[_0xa61e('0xd')]]:undefined;this[_0xa61e('0x73')]=_0x5bee85[_0xa61e('0x73')]||![];this['mandatoryDispositionPause']=_0x5bee85[_0xa61e('0x74')]?_0x5bee85['mandatoryDispositionPause']:undefined;}module[_0xa61e('0x75')]=VoiceQueue; \ No newline at end of file +var _0x2ddb=['dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundAbandonedDay','startPredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','busy','invalid','unavailable','ringing','ringinuse','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','total','sumDuration','sumHoldTime','unmanaged','loggedIn','available','acw','acwTimeout','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2ddb,0xb8));var _0xb2dd=function(_0x4b0dca,_0x16390d){_0x4b0dca=_0x4b0dca-0x0;var _0x2f61df=_0x2ddb[_0x4b0dca];return _0x2f61df;};'use strict';var statusDesc=[_0xb2dd('0x0'),_0xb2dd('0x1'),'inuse',_0xb2dd('0x2'),_0xb2dd('0x3'),_0xb2dd('0x4'),_0xb2dd('0x5'),_0xb2dd('0x6'),'onhold'];var monitorFormat={'wav':_0xb2dd('0x7'),'wav49':_0xb2dd('0x8'),'gsm':_0xb2dd('0x9')};var strategy={'rrmemory':_0xb2dd('0xa'),'roundrobin':_0xb2dd('0xb')};function VoiceQueue(_0x3d94e2){this['id']=_0x3d94e2['id']||0x0;this[_0xb2dd('0xc')]=_0x3d94e2[_0xb2dd('0xc')]||'';this[_0xb2dd('0xd')]=_0x3d94e2[_0xb2dd('0xd')]||'';this[_0xb2dd('0xe')]=_0x3d94e2[_0xb2dd('0xe')]||_0xb2dd('0xf');this[_0xb2dd('0x10')]=0x0;this['talking']=0x0;this[_0xb2dd('0x11')]=0x0;this['answered']=0x0;this[_0xb2dd('0x12')]=0x0;this[_0xb2dd('0x13')]=0x0;this['sumBillable']=0x0;this[_0xb2dd('0x14')]=0x0;this['abandoned']=0x0;this[_0xb2dd('0x15')]=0x0;this[_0xb2dd('0x16')]=0x0;this[_0xb2dd('0x17')]=_0x3d94e2['acw']||![];this[_0xb2dd('0x18')]=_0x3d94e2[_0xb2dd('0x18')]||0xa;this['autopause']=_0x3d94e2['autopause']||'no';this[_0xb2dd('0x19')]=!![];this['message']='';this[_0xb2dd('0x1a')]=0x0;this[_0xb2dd('0x1b')]=0x0;this[_0xb2dd('0x1c')]=_0x3d94e2[_0xb2dd('0x1c')]||null;this['dialGlobalInterval']=_0x3d94e2[_0xb2dd('0x1d')]?_0x3d94e2[_0xb2dd('0x1d')]:null;this[_0xb2dd('0x1e')]=_0x3d94e2[_0xb2dd('0x1e')];this[_0xb2dd('0x1f')]=_0x3d94e2[_0xb2dd('0x1f')]||_0xb2dd('0x20');this[_0xb2dd('0x21')]=_0x3d94e2['dialLimitChannel']||0x0;this[_0xb2dd('0x22')]=_0x3d94e2[_0xb2dd('0x22')]||0x0;this[_0xb2dd('0x23')]=_0x3d94e2[_0xb2dd('0x23')]||0x1;this[_0xb2dd('0x24')]=_0x3d94e2[_0xb2dd('0x24')]||_0xb2dd('0x25');this[_0xb2dd('0x26')]=_0x3d94e2['dialPredictiveOptimizationPercentage']||0.03;this[_0xb2dd('0x27')]=_0x3d94e2['dialPredictiveInterval']||0x258;this[_0xb2dd('0x28')]=_0x3d94e2[_0xb2dd('0x28')]||'anonymous';this[_0xb2dd('0x29')]=_0x3d94e2[_0xb2dd('0x29')]||_0xb2dd('0x2a');this['dialOriginateTimeout']=_0x3d94e2[_0xb2dd('0x2b')]||0x1e;this[_0xb2dd('0x2c')]=_0x3d94e2[_0xb2dd('0x2c')]||_0xb2dd('0x2d');this['dialQueueTimeout']=_0x3d94e2['dialQueueTimeout']||0x3;this[_0xb2dd('0x2e')]=_0x3d94e2[_0xb2dd('0x2e')]||undefined;this[_0xb2dd('0x2f')]=_0x3d94e2[_0xb2dd('0x2f')]||0x3;this[_0xb2dd('0x30')]=_0x3d94e2[_0xb2dd('0x30')]||0x96;this['dialBusyMaxRetry']=_0x3d94e2[_0xb2dd('0x31')]||0x3;this[_0xb2dd('0x32')]=_0x3d94e2['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x3d94e2[_0xb2dd('0x33')]||0x3;this[_0xb2dd('0x34')]=_0x3d94e2['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x3d94e2['dialNoSuchNumberMaxRetry']||0x3;this[_0xb2dd('0x35')]=_0x3d94e2['dialNoSuchNumberRetryFrequency']||0x96;this[_0xb2dd('0x36')]=_0x3d94e2[_0xb2dd('0x36')]||0x3;this['dialDropRetryFrequency']=_0x3d94e2['dialDropRetryFrequency']||0x96;this[_0xb2dd('0x37')]=_0x3d94e2[_0xb2dd('0x37')]||0x3;this['dialAbandonedRetryFrequency']=_0x3d94e2[_0xb2dd('0x38')]||0x96;this[_0xb2dd('0x39')]=_0x3d94e2[_0xb2dd('0x39')]||0x3;this[_0xb2dd('0x3a')]=_0x3d94e2['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x3d94e2[_0xb2dd('0x3b')]||0x3;this[_0xb2dd('0x3c')]=_0x3d94e2[_0xb2dd('0x3c')]||0x96;this['dialGlobalMaxRetry']=_0x3d94e2[_0xb2dd('0x3d')]||0x4;this[_0xb2dd('0x3e')]=_0x3d94e2[_0xb2dd('0x3e')]?_0x3d94e2[_0xb2dd('0x3e')]:undefined;this[_0xb2dd('0x3f')]=_0x3d94e2['TrunkBackup']?_0x3d94e2[_0xb2dd('0x3f')]:undefined;this['dialPrefix']=_0x3d94e2['dialPrefix']||undefined;this[_0xb2dd('0x40')]=_0x3d94e2[_0xb2dd('0x40')]?_0x3d94e2[_0xb2dd('0x40')]:undefined;this['dialOrderByScheduledAt']=_0x3d94e2[_0xb2dd('0x41')]||_0xb2dd('0x42');this['dialRandomLastDigitCallerIdNumber']=_0x3d94e2[_0xb2dd('0x43')]||undefined;this['dialCutDigit']=_0x3d94e2[_0xb2dd('0x44')]||undefined;this[_0xb2dd('0x45')]=strategy[_0x3d94e2[_0xb2dd('0x45')]]||'rrmemory';this[_0xb2dd('0x46')]=!![];this[_0xb2dd('0x47')]=_0x3d94e2[_0xb2dd('0x47')]||![];this[_0xb2dd('0x48')]=_0x3d94e2['dialAMDInitialSilence'];this[_0xb2dd('0x49')]=_0x3d94e2[_0xb2dd('0x49')];this['dialAMDAfterGreetingSilence']=_0x3d94e2[_0xb2dd('0x4a')];this[_0xb2dd('0x4b')]=_0x3d94e2[_0xb2dd('0x4b')];this['dialAMDMinWordLength']=_0x3d94e2['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x3d94e2[_0xb2dd('0x4c')];this[_0xb2dd('0x4d')]=_0x3d94e2[_0xb2dd('0x4d')];this[_0xb2dd('0x4e')]=_0x3d94e2[_0xb2dd('0x4e')];this[_0xb2dd('0x4f')]=_0x3d94e2[_0xb2dd('0x4f')];this[_0xb2dd('0x50')]=0x0;this['pTalking']=0x0;this['timeout']=_0x3d94e2['timeout'];this[_0xb2dd('0x51')]=0x0;this[_0xb2dd('0x52')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this[_0xb2dd('0x53')]=0x0;this[_0xb2dd('0x54')]=0x0;this[_0xb2dd('0x55')]=0x0;this[_0xb2dd('0x56')]=0x0;this[_0xb2dd('0x57')]=0x0;this[_0xb2dd('0x58')]=0x0;this[_0xb2dd('0x59')]=0x0;this['outboundDropCallsDayACS']=0x0;this['outboundReCallsDay']=0x0;this[_0xb2dd('0x5a')]=0x0;this['startProgressive']=undefined;this[_0xb2dd('0x5b')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xb2dd('0x5c')]=0x0;this[_0xb2dd('0x5d')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xb2dd('0x5e')]=0x0;this[_0xb2dd('0x5f')]=0x0;this[_0xb2dd('0x60')]=_0x3d94e2[_0xb2dd('0x61')]||0x14;this[_0xb2dd('0x62')]=_0x3d94e2[_0xb2dd('0x61')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0xb2dd('0x63')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xb2dd('0x64')]=0x0;this['erlangCallToSecond']=0x0;this[_0xb2dd('0x65')]=0x0;this[_0xb2dd('0x66')]=0x0;this[_0xb2dd('0x67')]=_0x3d94e2[_0xb2dd('0x67')]||0x1e;this['dialRecallInQueue']=_0x3d94e2[_0xb2dd('0x68')]||![];this[_0xb2dd('0x69')]=_0x3d94e2['dialQueueProject2']||undefined;this[_0xb2dd('0x6a')]=_0x3d94e2['dialAgiAfterHangupClient']||![];this[_0xb2dd('0x6b')]=_0x3d94e2[_0xb2dd('0x6b')]||![];this[_0xb2dd('0xd')]=monitorFormat[_0x3d94e2['monitor_format']]?monitorFormat[_0x3d94e2[_0xb2dd('0xd')]]:undefined;this[_0xb2dd('0x6c')]=_0x3d94e2[_0xb2dd('0x6c')]||![];this[_0xb2dd('0x6d')]=_0x3d94e2['mandatoryDispositionPause']?_0x3d94e2['mandatoryDispositionPause']:undefined;}module[_0xb2dd('0x6e')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index bed3f75..15c58f4 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 _0x18ea=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0x18ea,0xbe));var _0xa18e=function(_0x24276b,_0x1710bf){_0x24276b=_0x24276b-0x0;var _0x5dc555=_0x18ea[_0x24276b];return _0x5dc555;};'use strict';function VtigerAccount(_0x1e55d0){this['id']=_0x1e55d0['id']||0x0;this[_0xa18e('0x0')]=_0x1e55d0['name']||'';this['username']=_0x1e55d0[_0xa18e('0x1')]||'';this[_0xa18e('0x2')]=_0x1e55d0['accessKey']||'';this[_0xa18e('0x3')]=_0x1e55d0['remoteUri']||'';this['serverUrl']=_0x1e55d0[_0xa18e('0x4')]||'';this['Configurations']=_0x1e55d0[_0xa18e('0x5')]||{};}module[_0xa18e('0x6')]=VtigerAccount; \ No newline at end of file +var _0xfdbe=['exports','name','username','accessKey','serverUrl','Configurations'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xfdbe,0x97));var _0xefdb=function(_0x4e55a9,_0x241b22){_0x4e55a9=_0x4e55a9-0x0;var _0x4a9b67=_0xfdbe[_0x4e55a9];return _0x4a9b67;};'use strict';function VtigerAccount(_0x2aee9a){this['id']=_0x2aee9a['id']||0x0;this[_0xefdb('0x0')]=_0x2aee9a[_0xefdb('0x0')]||'';this['username']=_0x2aee9a[_0xefdb('0x1')]||'';this[_0xefdb('0x2')]=_0x2aee9a[_0xefdb('0x2')]||'';this['remoteUri']=_0x2aee9a['remoteUri']||'';this['serverUrl']=_0x2aee9a[_0xefdb('0x3')]||'';this['Configurations']=_0x2aee9a[_0xefdb('0x4')]||{};}module[_0xefdb('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 6ea687b..5fed0a8 100644 --- a/server/services/ami/model/zendeskAccount.js +++ b/server/services/ami/model/zendeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x9ec53a,_0x318c7c){var _0x4df8e3=function(_0x404c5f){while(--_0x404c5f){_0x9ec53a['push'](_0x9ec53a['shift']());}};_0x4df8e3(++_0x318c7c);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';function ZendeskAccount(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||'';this[_0x65f6('0x2')]=_0x253044[_0x65f6('0x2')]||'';this[_0x65f6('0x3')]=_0x253044['token']||'';this[_0x65f6('0x4')]=_0x253044['remoteUri']||'';this[_0x65f6('0x5')]=_0x253044[_0x65f6('0x5')]||'';this['type']=_0x253044['type']||_0x65f6('0x6');this[_0x65f6('0x7')]=_0x253044[_0x65f6('0x7')]||'';this[_0x65f6('0x8')]=_0x253044[_0x65f6('0x8')]||{};}module[_0x65f6('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x5f2f=['authType','type','integrationTab','serverUrl','Configurations','name','username','password','token','remoteUri'];(function(_0x537e90,_0x295367){var _0x110a38=function(_0x1da127){while(--_0x1da127){_0x537e90['push'](_0x537e90['shift']());}};_0x110a38(++_0x295367);}(_0x5f2f,0x73));var _0xf5f2=function(_0x20a91b,_0x34c890){_0x20a91b=_0x20a91b-0x0;var _0x186935=_0x5f2f[_0x20a91b];return _0x186935;};'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 diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 0e97a9e..09ca0e7 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 _0xb240=['clientId','clientSecret','serverUrl','code','refreshToken','exports','name','description','host','zone'];(function(_0x420842,_0x5de19f){var _0x274f53=function(_0x31a0a2){while(--_0x31a0a2){_0x420842['push'](_0x420842['shift']());}};_0x274f53(++_0x5de19f);}(_0xb240,0x7e));var _0x0b24=function(_0xcc8599,_0x52dffb){_0xcc8599=_0xcc8599-0x0;var _0x17c6f2=_0xb240[_0xcc8599];return _0x17c6f2;};'use strict';function ZohoAccount(_0xec0b4f){this['id']=_0xec0b4f['id']||0x0;this[_0x0b24('0x0')]=_0xec0b4f[_0x0b24('0x0')]||'';this[_0x0b24('0x1')]=_0xec0b4f[_0x0b24('0x1')]||'';this[_0x0b24('0x2')]=_0xec0b4f[_0x0b24('0x2')]||'';this[_0x0b24('0x3')]=_0xec0b4f[_0x0b24('0x3')]||'';this['clientId']=_0xec0b4f[_0x0b24('0x4')]||'';this[_0x0b24('0x5')]=_0xec0b4f[_0x0b24('0x5')]||'';this[_0x0b24('0x6')]=_0xec0b4f[_0x0b24('0x6')]||'';this['code']=_0xec0b4f[_0x0b24('0x7')]||'';this[_0x0b24('0x8')]=_0xec0b4f[_0x0b24('0x8')]||'';this['Configurations']=_0xec0b4f['Configurations']||{};}module[_0x0b24('0x9')]=ZohoAccount; \ No newline at end of file +var _0xdc15=['code','refreshToken','Configurations','exports','name','description','host','clientId','serverUrl'];(function(_0x2d7635,_0x5355bd){var _0x4d7e56=function(_0x15b4b9){while(--_0x15b4b9){_0x2d7635['push'](_0x2d7635['shift']());}};_0x4d7e56(++_0x5355bd);}(_0xdc15,0x1f3));var _0x5dc1=function(_0x4aa838,_0x4aa14f){_0x4aa838=_0x4aa838-0x0;var _0x3abff0=_0xdc15[_0x4aa838];return _0x3abff0;};'use strict';function ZohoAccount(_0x40f19b){this['id']=_0x40f19b['id']||0x0;this['name']=_0x40f19b[_0x5dc1('0x0')]||'';this[_0x5dc1('0x1')]=_0x40f19b[_0x5dc1('0x1')]||'';this[_0x5dc1('0x2')]=_0x40f19b[_0x5dc1('0x2')]||'';this['zone']=_0x40f19b['zone']||'';this['clientId']=_0x40f19b[_0x5dc1('0x3')]||'';this['clientSecret']=_0x40f19b['clientSecret']||'';this[_0x5dc1('0x4')]=_0x40f19b[_0x5dc1('0x4')]||'';this[_0x5dc1('0x5')]=_0x40f19b[_0x5dc1('0x5')]||'';this[_0x5dc1('0x6')]=_0x40f19b[_0x5dc1('0x6')]||'';this[_0x5dc1('0x7')]=_0x40f19b[_0x5dc1('0x7')]||{};}module[_0x5dc1('0x8')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 58712f4..e3ee20a 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 _0x1686=['UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','queue','type','campaigntype','dialAnswer','membername','Agent','name','format','SIP/%s','calleridname','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x2f9a53,_0x317d3a){var _0x3849a7=function(_0x587b76){while(--_0x587b76){_0x2f9a53['push'](_0x2f9a53['shift']());}};_0x3849a7(++_0x317d3a);}(_0x1686,0x1c1));var _0x6168=function(_0x2c3e93,_0x5e4a68){_0x2c3e93=_0x2c3e93-0x0;var _0x56d022=_0x1686[_0x2c3e93];return _0x56d022;};'use strict';var util=require(_0x6168('0x0'));var _=require(_0x6168('0x1'));var moment=require(_0x6168('0x2'));function checkNameSurname(_0x5816fc,_0x289050,_0x3c4bdc){var _0x5adbfd='';if(!_[_0x6168('0x3')](_0x289050)&&'string'===typeof _0x289050){_0x5adbfd+=_0x289050;}if(!_[_0x6168('0x3')](_0x3c4bdc)&&_0x6168('0x4')===typeof _0x3c4bdc){_0x5adbfd+='\x20'+_0x3c4bdc;}if(_0x5adbfd!==''){return _0x5adbfd;}return _0x5816fc;}function Action(_0x221bed,_0x11194b,_0x2b7d31,_0x39510f,_0x112951){this['uniqueid']=_0x2b7d31||undefined;this['idContact']=_0x221bed['id'];this[_0x6168('0x5')]=_0x11194b['name'];this[_0x6168('0x6')]=_0x11194b['type'];this[_0x6168('0x7')]=_0x6168('0x5');this[_0x6168('0x8')]=![];this[_0x6168('0x9')]=_[_0x6168('0x3')](_0x221bed[_0x6168('0xa')])?undefined:_0x221bed[_0x6168('0xa')][_0x6168('0xb')];this['channelAgent']=this[_0x6168('0x9')]?util[_0x6168('0xc')](_0x6168('0xd'),this[_0x6168('0x9')]):_0x39510f||undefined;this[_0x6168('0xe')]=checkNameSurname(_0x221bed[_0x6168('0xf')]['phone'],_0x221bed[_0x6168('0xf')][_0x6168('0x10')],_0x221bed[_0x6168('0xf')][_0x6168('0x11')]);this[_0x6168('0x12')]=_0x221bed['active']||![];this[_0x6168('0x13')]=_0x221bed[_0x6168('0xf')]['phone'];this[_0x6168('0x14')]=_0x221bed[_0x6168('0x14')];this[_0x6168('0x15')]=_0x221bed[_0x6168('0x15')]||0x0;this[_0x6168('0x16')]=_0x221bed['countcongestionretry']||0x0;this[_0x6168('0x17')]=_0x221bed[_0x6168('0x17')]||0x0;this['countglobal']=(_0x221bed['countbusyretry']||0x0)+(_0x221bed[_0x6168('0x16')]||0x0)+(_0x221bed[_0x6168('0x17')]||0x0);this[_0x6168('0x18')]=_0x221bed['countnosuchnumberretry']||0x0;this[_0x6168('0x19')]=_0x221bed[_0x6168('0x19')]||0x0;this[_0x6168('0x1a')]=_0x221bed[_0x6168('0x1a')]||0x0;this[_0x6168('0x1b')]=_0x221bed[_0x6168('0x1b')]||0x0;this[_0x6168('0x1c')]=_0x221bed[_0x6168('0x1c')]||0x0;this[_0x6168('0x1d')]=_0x221bed[_0x6168('0x1d')];this[_0x6168('0x1e')]=_0x221bed['callbackuniqueid'];this[_0x6168('0x1f')]=_0x221bed[_0x6168('0x1f')];this[_0x6168('0x20')]=_0x221bed['recallme'];this[_0x6168('0x21')]=_0x221bed[_0x6168('0x21')];this[_0x6168('0x22')]=_0x221bed['ListId'];this[_0x6168('0x23')]=_[_0x6168('0x3')](_0x221bed[_0x6168('0xa')])?_0x221bed[_0x6168('0x23')]:_0x221bed[_0x6168('0xa')]['id'];this[_0x6168('0x24')]=_0x221bed[_0x6168('0x24')];this[_0x6168('0x25')]='';this[_0x6168('0x26')]='';}Action[_0x6168('0x27')][_0x6168('0x28')]=function(){return util[_0x6168('0xc')](_0x6168('0x29'),this[_0x6168('0xe')],this[_0x6168('0x2a')]);};module[_0x6168('0x2b')]=Action; \ No newline at end of file +var _0xb7ac=['calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','format','\x22%s\x22\x20<%s>','number','exports','util','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','SIP/%s','calleridname','Contact','firstName','lastName','active'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7ac,0x178));var _0xcb7a=function(_0x116d9f,_0x12c8fc){_0x116d9f=_0x116d9f-0x0;var _0x316ae4=_0xb7ac[_0x116d9f];return _0x316ae4;};'use strict';var util=require(_0xcb7a('0x0'));var _=require('lodash');var moment=require(_0xcb7a('0x1'));function checkNameSurname(_0x60ee19,_0x1d8a74,_0x4f85f3){var _0x1497e6='';if(!_[_0xcb7a('0x2')](_0x1d8a74)&&_0xcb7a('0x3')===typeof _0x1d8a74){_0x1497e6+=_0x1d8a74;}if(!_[_0xcb7a('0x2')](_0x4f85f3)&&'string'===typeof _0x4f85f3){_0x1497e6+='\x20'+_0x4f85f3;}if(_0x1497e6!==''){return _0x1497e6;}return _0x60ee19;}function Action(_0x142a88,_0x5ae685,_0x396cbd,_0x331251,_0x349093){this[_0xcb7a('0x4')]=_0x396cbd||undefined;this[_0xcb7a('0x5')]=_0x142a88['id'];this[_0xcb7a('0x6')]=_0x5ae685[_0xcb7a('0x7')];this['type']=_0x5ae685[_0xcb7a('0x8')];this[_0xcb7a('0x9')]=_0xcb7a('0x6');this[_0xcb7a('0xa')]=![];this[_0xcb7a('0xb')]=_[_0xcb7a('0x2')](_0x142a88[_0xcb7a('0xc')])?undefined:_0x142a88[_0xcb7a('0xc')][_0xcb7a('0x7')];this[_0xcb7a('0xd')]=this[_0xcb7a('0xb')]?util['format'](_0xcb7a('0xe'),this[_0xcb7a('0xb')]):_0x331251||undefined;this[_0xcb7a('0xf')]=checkNameSurname(_0x142a88[_0xcb7a('0x10')]['phone'],_0x142a88[_0xcb7a('0x10')][_0xcb7a('0x11')],_0x142a88[_0xcb7a('0x10')][_0xcb7a('0x12')]);this[_0xcb7a('0x13')]=_0x142a88['active']||![];this[_0xcb7a('0x14')]=_0x142a88[_0xcb7a('0x10')]['phone'];this[_0xcb7a('0x15')]=_0x142a88['scheduledat'];this[_0xcb7a('0x16')]=_0x142a88[_0xcb7a('0x16')]||0x0;this[_0xcb7a('0x17')]=_0x142a88[_0xcb7a('0x17')]||0x0;this[_0xcb7a('0x18')]=_0x142a88[_0xcb7a('0x18')]||0x0;this[_0xcb7a('0x19')]=(_0x142a88['countbusyretry']||0x0)+(_0x142a88[_0xcb7a('0x17')]||0x0)+(_0x142a88[_0xcb7a('0x18')]||0x0);this['countnosuchnumberretry']=_0x142a88['countnosuchnumberretry']||0x0;this[_0xcb7a('0x1a')]=_0x142a88['countdropretry']||0x0;this[_0xcb7a('0x1b')]=_0x142a88['countabandonedretry']||0x0;this[_0xcb7a('0x1c')]=_0x142a88[_0xcb7a('0x1c')]||0x0;this['countagentrejectretry']=_0x142a88[_0xcb7a('0x1d')]||0x0;this[_0xcb7a('0x1e')]=_0x142a88['callback'];this[_0xcb7a('0x1f')]=_0x142a88[_0xcb7a('0x1f')];this[_0xcb7a('0x20')]=_0x142a88[_0xcb7a('0x20')];this[_0xcb7a('0x21')]=_0x142a88[_0xcb7a('0x21')];this[_0xcb7a('0x22')]=_0x142a88[_0xcb7a('0x22')];this[_0xcb7a('0x23')]=_0x142a88[_0xcb7a('0x23')];this['UserId']=_[_0xcb7a('0x2')](_0x142a88[_0xcb7a('0xc')])?_0x142a88[_0xcb7a('0x24')]:_0x142a88[_0xcb7a('0xc')]['id'];this['VoiceQueueId']=_0x142a88[_0xcb7a('0x25')];this[_0xcb7a('0x26')]='';this['originatecalleridname']='';}Action[_0xcb7a('0x27')]['getCaller']=function(){return util[_0xcb7a('0x28')](_0xcb7a('0x29'),this[_0xcb7a('0xf')],this[_0xcb7a('0x2a')]);};module[_0xcb7a('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 065d29b..c5560c6 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 _0xde21=['loggerError','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','Agent','run','then','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','NoSuchNumber','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','emit','custom:agentconnect','connect','acw','custom:agentConnectPreview','custom:agentcomplete','buildObj','complete','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','rescheduleContact','dialBusyRetryFrequency','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','countglobal','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','AgentReject','[syncHangupRequest][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','reason','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','Contact','Queue','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','SIP/%s','status','reachable','unmonitored','execRun','pick','unlock','disableContact','recallme','isValid','checkIsBlackList','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','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','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialCutDigit','phone','substring','trim','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','addVariables','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','response','unlockContact','custom:agentringnoanswer','rejected','syncHangup','[syncHangup][talking]','cause','callProgressDetectingCustomer','statedesc','dialQueueProject','channelstate','destuniqueid','dialstatus','syncHangupRequest','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfer','transfererlinkedid','exports','util','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','agents','syncOriginateResponse','bind','hangup','hanguprequest','dialend','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialActive','dialOriginateCallerIdName','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','originated','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','voice_queue_channel:remove','sendMessageOneNotActive','[CampaignPreview]\x20Campaign\x20Queue:\x20','message','IS_DISACTIVED','logger','\x20is\x20disactive','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','outbound','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','info','[clearZombieChannels][talking]','actions','queue','originated:\x20','dialAnswer','contactId','UserId','VoiceQueueId','Action','channel','catch','decrementTalkink','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]'];(function(_0x2fb0e5,_0x45e57a){var _0x584d1f=function(_0x551080){while(--_0x551080){_0x2fb0e5['push'](_0x2fb0e5['shift']());}};_0x584d1f(++_0x45e57a);}(_0xde21,0xcd));var _0x1de2=function(_0x11cd45,_0x5a4b6c){_0x11cd45=_0x11cd45-0x0;var _0x33d139=_0xde21[_0x11cd45];return _0x33d139;};'use strict';var util=require(_0x1de2('0x0'));var _=require('lodash');var BPromise=require(_0x1de2('0x1'));var uuid=require(_0x1de2('0x2'));var moment=require(_0x1de2('0x3'));var md5=require(_0x1de2('0x4'));var Redis=require(_0x1de2('0x5'));var config=require(_0x1de2('0x6'));var logger=require(_0x1de2('0x7'))(_0x1de2('0x8'));var loggerAction=require(_0x1de2('0x7'))(_0x1de2('0x9'));var ami=require('../ami');var rpcDb=require(_0x1de2('0xa'));var Action=require(_0x1de2('0xb'));var ut=require(_0x1de2('0xc'));config[_0x1de2('0xd')]=_['defaults'](config['redis'],{'host':_0x1de2('0xe'),'port':0x18eb});var io=require(_0x1de2('0xf'))(new Redis(config[_0x1de2('0xd')]));var Sequence=function(){};Sequence[_0x1de2('0x10')][_0x1de2('0x11')]=function(_0x2aacdf){this['tail']=this[_0x1de2('0x12')]?this[_0x1de2('0x12')][_0x1de2('0x13')](_0x2aacdf):_0x2aacdf();};function Preview(_0x42c622){this[_0x1de2('0x14')]=new Sequence();this[_0x1de2('0x15')]=_0x42c622['voiceQueues'];this[_0x1de2('0x16')]=_0x42c622[_0x1de2('0x16')];this['actions']={};this[_0x1de2('0x17')]=_0x42c622['agents'];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this[_0x1de2('0x18')][_0x1de2('0x19')](this));ami['on'](_0x1de2('0x1a'),this['syncHangup'][_0x1de2('0x19')](this));ami['on'](_0x1de2('0x1b'),this['syncHangupRequest'][_0x1de2('0x19')](this));ami['on'](_0x1de2('0x1c'),this[_0x1de2('0x1d')][_0x1de2('0x19')](this));ami['on'](_0x1de2('0x1e'),this['syncNewExten'][_0x1de2('0x19')](this));ami['on'](_0x1de2('0x1f'),this[_0x1de2('0x20')][_0x1de2('0x19')](this));ami['on'](_0x1de2('0x21'),this[_0x1de2('0x22')][_0x1de2('0x19')](this));ami['on'](_0x1de2('0x23'),this[_0x1de2('0x24')]['bind'](this));this[_0x1de2('0x25')](this[_0x1de2('0x15')]);}function emit(_0x396188,_0x998bfd,_0x12b8f0){io['to'](_0x396188)['emit'](_0x998bfd,_0x12b8f0);}function emitCampaignPreview(_0x30322d){if(_0x30322d[_0x1de2('0x26')]==='outbound'){var _0x5e7dee={'id':_0x30322d['id'],'name':_0x30322d[_0x1de2('0x27')],'strategy':_0x30322d[_0x1de2('0x28')],'answered':_0x30322d[_0x1de2('0x29')],'available':_0x30322d['available'],'loggedIn':_0x30322d[_0x1de2('0x2a')],'pTalking':_0x30322d[_0x1de2('0x2b')],'sumBillable':_0x30322d[_0x1de2('0x2c')],'sumDuration':_0x30322d[_0x1de2('0x2d')],'sumHoldTime':_0x30322d[_0x1de2('0x2e')]||0x0,'talking':_0x30322d[_0x1de2('0x2f')],'total':_0x30322d[_0x1de2('0x30')],'type':_0x30322d[_0x1de2('0x26')],'unmanaged':_0x30322d[_0x1de2('0x31')],'abandoned':_0x30322d[_0x1de2('0x32')],'waiting':_0x30322d[_0x1de2('0x33')],'loggedInDb':_0x30322d['loggedInDb'],'dialActive':_0x30322d[_0x1de2('0x34')],'dialMethod':_0x30322d['dialMethod'],'dialOriginateCallerIdName':_0x30322d[_0x1de2('0x35')],'dialOriginateCallerIdNumber':_0x30322d['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x30322d['dialOriginateTimeout'],'dialPrefix':_0x30322d[_0x1de2('0x36')],'outboundAnswerAgiCallsDay':_0x30322d['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x30322d[_0x1de2('0x37')],'outboundBlacklistCallsDay':_0x30322d[_0x1de2('0x38')],'outboundBusyCallsDay':_0x30322d[_0x1de2('0x39')],'outboundCongestionCallsDay':_0x30322d[_0x1de2('0x3a')],'outboundDropCallsDayACS':_0x30322d[_0x1de2('0x3b')],'outboundDropCallsDayCallersExit':_0x30322d['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x30322d[_0x1de2('0x3c')],'outboundNoAnswerCallsDay':_0x30322d['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x30322d[_0x1de2('0x3d')],'outboundOriginateFailureCallsDay':_0x30322d['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x30322d[_0x1de2('0x3e')],'outboundRejectCallsDay':_0x30322d[_0x1de2('0x3f')],'outboundUnknownCallsDay':_0x30322d[_0x1de2('0x40')],'outboundAbandonedCallsDay':_0x30322d[_0x1de2('0x41')],'predictiveIntervalAnsweredCalls':_0x30322d[_0x1de2('0x42')],'predictiveIntervalAvgHoldtime':_0x30322d[_0x1de2('0x43')],'predictiveIntervalAvgTalktime':_0x30322d[_0x1de2('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x30322d[_0x1de2('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x30322d[_0x1de2('0x46')],'predictiveIntervalErlangCalls':_0x30322d[_0x1de2('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x30322d[_0x1de2('0x48')],'predictiveIntervalHitRate':_0x30322d[_0x1de2('0x49')],'predictiveIntervalMultiplicativeFactor':_0x30322d[_0x1de2('0x4a')],'predictiveIntervalPauses':_0x30322d['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x30322d[_0x1de2('0x4b')],'predictiveIntervalTotalCalls':_0x30322d['predictiveIntervalTotalCalls'],'message':_0x30322d['message'],'originated':_0x30322d[_0x1de2('0x4c')],'erlangCalls':_0x30322d['erlangCalls'],'erlangCallToSecond':_0x30322d['erlangCallToSecond'],'erlangAbandonmentRate':_0x30322d[_0x1de2('0x4d')],'erlangBusyFactor':_0x30322d[_0x1de2('0x4e')],'startPredictive':_0x30322d['startPredictive'],'startProgressive':_0x30322d['startProgressive']};if(_0x30322d['Trunk']){_0x5e7dee[_0x1de2('0x4f')]={'id':_0x30322d['Trunk']['id'],'name':_0x30322d[_0x1de2('0x4f')][_0x1de2('0x27')],'active':_0x30322d[_0x1de2('0x4f')][_0x1de2('0x50')],'callerid':_0x30322d[_0x1de2('0x4f')][_0x1de2('0x51')]};}if(_0x30322d[_0x1de2('0x52')]){_0x5e7dee['Interval']={'id':_0x30322d['Interval']['id'],'name':_0x30322d[_0x1de2('0x52')]['name']};}var _0x13f5ba=md5(JSON[_0x1de2('0x53')](_0x5e7dee));if(_0x30322d[_0x1de2('0x4')]!==_0x13f5ba){_0x30322d[_0x1de2('0x4')]=_0x13f5ba;emit(util[_0x1de2('0x54')](_0x1de2('0x55'),_0x5e7dee[_0x1de2('0x27')]),_0x1de2('0x56'),_0x5e7dee);}}}function emitVoiceQueueChannelRemove(_0x511b8c){logger['info']('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x1de2('0x53')](_0x511b8c));emit(util[_0x1de2('0x54')]('voice:queue:%s',_0x511b8c['name']),_0x1de2('0x57'),_0x511b8c);}function notSendMessagesQueue(_0x456033){if(_0x456033[_0x1de2('0x58')]){if(_0x456033[_0x1de2('0x4c')]===0x0&&_0x456033[_0x1de2('0x2b')]===0x0){_0x456033[_0x1de2('0x58')]=![];_0x456033['available']=0x0;_0x456033['paused']=0x0;_0x456033['message']='NOT_ACTIVE';ut['logger'](_0x1de2('0x59'),_0x456033[_0x1de2('0x27')]+'\x20is\x20not\x20active');}else{_0x456033[_0x1de2('0x5a')]=_0x1de2('0x5b');ut[_0x1de2('0x5c')](_0x1de2('0x59'),_0x456033[_0x1de2('0x27')]+_0x1de2('0x5d'));}emitCampaignPreview(_0x456033);}}Preview[_0x1de2('0x10')][_0x1de2('0x25')]=function(){var _0x2fca2c=this;setInterval(function(){_0x2fca2c[_0x1de2('0x5e')]();},0x7cf);};Preview[_0x1de2('0x10')][_0x1de2('0x5e')]=function(){var _0x389234=this[_0x1de2('0x15')];this[_0x1de2('0x5f')]+=0x1;for(var _0x11b696 in _0x389234){if(_0x389234[_0x1de2('0x60')](_0x11b696)&&(_0x389234[_0x11b696][_0x1de2('0x61')]===_0x1de2('0x8')||_0x389234[_0x11b696][_0x1de2('0x61')]==='booked')&&_0x389234[_0x11b696][_0x1de2('0x26')]===_0x1de2('0x62')){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this[_0x1de2('0x63')]();}}if(_0x389234[_0x1de2('0x60')](_0x11b696)&&_0x389234[_0x11b696]['dialMethod']===_0x1de2('0x8')&&_0x389234[_0x11b696]['type']===_0x1de2('0x62')){if(_0x389234[_0x11b696][_0x1de2('0x34')]){this[_0x1de2('0x64')](_0x389234[_0x11b696]);this[_0x1de2('0x65')](_0x389234[_0x11b696]);}else{notSendMessagesQueue(_0x389234[_0x11b696]);}}}};Preview[_0x1de2('0x10')][_0x1de2('0x66')]=function(_0x2d57a2){var _0x1cedd6=this;this[_0x1de2('0x14')][_0x1de2('0x11')](function(){if(!_[_0x1de2('0x67')](_0x1cedd6['actions'][_0x2d57a2])){loggerAction[_0x1de2('0x68')](_0x1de2('0x69'),_0x2d57a2,'Queue',_0x1cedd6[_0x1de2('0x6a')][_0x2d57a2][_0x1de2('0x6b')],_0x1de2('0x6c'),JSON['stringify'](_0x1cedd6[_0x1de2('0x15')][_0x1cedd6[_0x1de2('0x6a')][_0x2d57a2][_0x1de2('0x6b')]][_0x1de2('0x4c')]),'pTalking:\x20',JSON[_0x1de2('0x53')](_0x1cedd6['campaignsPreview'][_0x1cedd6[_0x1de2('0x6a')][_0x2d57a2]['queue']]['pTalking']),JSON[_0x1de2('0x53')](_0x1cedd6[_0x1de2('0x6a')][_0x2d57a2][_0x1de2('0x6d')]),JSON[_0x1de2('0x53')](_['pick'](_0x1cedd6['actions'][_0x2d57a2],[_0x1de2('0x6e'),_0x1de2('0x6f'),_0x1de2('0x70'),'ListId'])));return ami[_0x1de2('0x71')]({'action':'status','channel':_0x1cedd6[_0x1de2('0x6a')][_0x2d57a2][_0x1de2('0x72')]})[_0x1de2('0x73')](function(_0x5b32dc){if(_0x5b32dc[_0x1de2('0x5a')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x1cedd6['actions'][_0x2d57a2]){ut['updateOriginated'](_0x1cedd6[_0x1de2('0x15')][_0x1cedd6[_0x1de2('0x6a')][_0x2d57a2]['queue']],'[clearZombieChannel]');if(_0x1cedd6[_0x1de2('0x6a')][_0x2d57a2][_0x1de2('0x6d')]===!![]){ut[_0x1de2('0x74')](_0x1cedd6[_0x1de2('0x15')][_0x1cedd6[_0x1de2('0x6a')][_0x2d57a2][_0x1de2('0x6b')]],_0x1de2('0x75'));ut['loggerError'](_0x1de2('0x76')+_0x2d57a2,_0x1cedd6[_0x1de2('0x6a')][_0x2d57a2]['queue']);}ut[_0x1de2('0x77')](_0x1de2('0x78')+_0x2d57a2,_0x1cedd6[_0x1de2('0x6a')][_0x2d57a2][_0x1de2('0x6b')]);delete _0x1cedd6[_0x1de2('0x6a')][_0x2d57a2];}},0x2328);}});}});};Preview[_0x1de2('0x10')]['clearZombieChannels']=function(){var _0x5b0d69=this;loggerAction['info'](_0x1de2('0x79'),_['size'](this[_0x1de2('0x6a')]));for(var _0x474c40 in this[_0x1de2('0x6a')]){if(_0x5b0d69[_0x1de2('0x6a')][_0x1de2('0x60')](_0x474c40)){_0x5b0d69[_0x1de2('0x66')](_0x474c40);}}};Preview[_0x1de2('0x10')]['recallMe']=function(_0x4593e7){var _0x55b534=this;rpcDb[_0x1de2('0x7a')](_0x4593e7['id'],ut[_0x1de2('0x7b')](this[_0x1de2('0x17')]))['then'](function(_0x17ecc4){if(!_['isNil'](_0x17ecc4)){for(var _0x12c829=0x0;_0x12c829<_0x17ecc4[_0x1de2('0x7c')];_0x12c829+=0x1){if(ut[_0x1de2('0x7d')](_0x17ecc4[_0x12c829][_0x1de2('0x7e')])<_0x4593e7['dialRecallMeTimeout']*0x3c){if(_0x17ecc4[_0x12c829][_0x1de2('0x7f')]&&!_0x17ecc4[_0x12c829]['Agent']['voicePause']){_0x55b534[_0x1de2('0x80')](_0x17ecc4[_0x12c829]['id'])[_0x1de2('0x81')](ut[_0x1de2('0x82')](_0x1de2('0x83')))[_0x1de2('0x73')](ut[_0x1de2('0x82')](_0x1de2('0x83')));}else{rpcDb['disableContact'](_0x17ecc4[_0x12c829]['id']);}}else{var _0x38a2e3=new Action(_0x17ecc4[_0x12c829],_0x4593e7);_0x38a2e3[_0x1de2('0x84')]=moment()[_0x1de2('0x54')](_0x1de2('0x85'));_0x4593e7[_0x1de2('0x3e')]+=0x1;ut[_0x1de2('0x86')](_0x38a2e3,0x17,_0x1de2('0x87'));if(_0x4593e7['dialRecallInQueue']){rpcDb['rescheduleContactInQueue'](ut[_0x1de2('0x88')](_0x17ecc4[_0x12c829]));rpcDb[_0x1de2('0x89')](_0x38a2e3,_0x1de2('0x8a'));}else{ut[_0x1de2('0x86')](_0x38a2e3,0x16,_0x1de2('0x8b'));rpcDb[_0x1de2('0x89')](_0x38a2e3,_0x1de2('0x8c'));rpcDb['createCustomerFinal'](_0x38a2e3,'[HistoryRecallClose]');}}}}})[_0x1de2('0x73')](ut[_0x1de2('0x82')](_0x1de2('0x8d')));};Preview[_0x1de2('0x10')][_0x1de2('0x64')]=function(_0x936aaf){_0x936aaf[_0x1de2('0x58')]=!![];if(ut[_0x1de2('0x8e')](_0x936aaf[_0x1de2('0x2a')])){_0x936aaf[_0x1de2('0x5a')]='AGENTS_NOT_LOGGED';}else if(!ut['isActive'](_0x936aaf[_0x1de2('0x34')])){_0x936aaf[_0x1de2('0x5a')]=_0x1de2('0x8f');}else if(!this['isTrunkReachable'](_0x936aaf[_0x1de2('0x4f')])){if(!this[_0x1de2('0x90')](_0x936aaf[_0x1de2('0x91')])){_0x936aaf['message']=_0x1de2('0x92');}else{_0x936aaf['message']='ACTIVE';}}else{_0x936aaf['message']=_0x1de2('0x93');}emitCampaignPreview(_0x936aaf);};Preview[_0x1de2('0x10')]['callProgressDetectingCustomer']=function(_0x36e487,_0xfb9f02,_0x142b44){var _0x2b18eb=this;var _0x206e62=this[_0x1de2('0x6a')][_0xfb9f02];var _0x178156=this[_0x1de2('0x15')][_0x206e62[_0x1de2('0x6b')]];var _0x75acc4;if(_0x178156){switch(_0x142b44){case'1':_0x178156['outboundNoSuchCallsDay']+=0x1;_0x206e62[_0x1de2('0x94')]+=0x1;_0x206e62['countglobal']=ut['totalGlobal'](_0x206e62);ut[_0x1de2('0x86')](_0x206e62,0x0,_0x1de2('0x95'));rpcDb['createCustomerHistory'](_0x206e62,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0x1de2('0x96')](_0x206e62)>=_0x178156[_0x1de2('0x97')]){_0x75acc4=ut[_0x1de2('0x98')](_0x206e62,0xf,_0x1de2('0x99'));rpcDb[_0x1de2('0x9a')](_0x75acc4,_0x1de2('0x9b'));}else{if(_0x206e62[_0x1de2('0x94')]>=_0x178156[_0x1de2('0x9c')]){rpcDb[_0x1de2('0x9a')](_0x206e62,_0x1de2('0x9b'));}else{rpcDb['rescheduleContact'](ut[_0x1de2('0x9d')](_0x206e62,_0x1de2('0x94'),_0x178156[_0x1de2('0x9e')]),_0x206e62[_0x1de2('0x9f')],_0x206e62[_0x1de2('0xa0')]);}}delete this[_0x1de2('0x6a')][_0x36e487[_0x1de2('0xa1')]];break;case'ANSWER':var _0x41128d=moment()[_0x1de2('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x206e62[_0x1de2('0xa2')]=_0x41128d;_0x206e62[_0x1de2('0xa3')]=_0x41128d;_0x206e62['dialAnswer']=!![];_0x178156[_0x1de2('0x2b')]+=0x1;logger[_0x1de2('0x68')](_0x1de2('0xa4'),_0x206e62[_0x1de2('0xa5')],_0x1de2('0xa6'),_0x178156['name'],_0x1de2('0xa7'),_0x178156[_0x1de2('0x2b')]);ami[_0x1de2('0xa8')](_0x1de2('0xa9'),ut['buildObj'](_0x206e62,_0x1de2('0xaa')));if(_0x178156[_0x1de2('0xab')]){ami[_0x1de2('0xa8')](_0x1de2('0xac'),ut['buildAcw'](_0x206e62));}break;case'16':ami['emit'](_0x1de2('0xad'),ut[_0x1de2('0xae')](_0x206e62,_0x1de2('0xaf')));emitVoiceQueueChannelRemove(ut[_0x1de2('0xae')](_0x206e62,_0x1de2('0xaf')));_0x178156[_0x1de2('0x37')]+=0x1;_0x178156[_0x1de2('0x30')]+=0x1;_0x178156['answered']+=0x1;ut[_0x1de2('0x74')](_0x178156,'[16]');_0x206e62['countglobal']=ut[_0x1de2('0x96')](_0x206e62);ut['logCustomer'](_0x206e62,0x4,_0x1de2('0xb0'));rpcDb[_0x1de2('0x89')](_0x206e62,_0x1de2('0xb1'));rpcDb[_0x1de2('0x9a')](_0x206e62,_0x1de2('0xb2'));rpcDb['crateCustomerReportQueue'](_0x206e62);_0x178156[_0x1de2('0x2d')]+=_0x206e62[_0x1de2('0xb3')];_0x178156[_0x1de2('0x2c')]+=_0x206e62[_0x1de2('0xb3')];logger[_0x1de2('0x68')](_0x1de2('0xb4'),_0x206e62[_0x1de2('0xa5')],_0x1de2('0xa6'),_0x178156[_0x1de2('0x27')],_0x1de2('0xa7'),_0x178156[_0x1de2('0x2b')]);delete this['actions'][_0x36e487[_0x1de2('0xa1')]];break;case _0x1de2('0xb5'):_0x178156[_0x1de2('0x39')]+=0x1;_0x206e62[_0x1de2('0xb6')]+=0x1;_0x206e62['countglobal']=ut[_0x1de2('0x96')](_0x206e62);ut['logCustomer'](_0x206e62,0x5,'Busy');rpcDb[_0x1de2('0x89')](_0x206e62,'[callProgressDetectingCustomer][logBusy]');if(ut['totalGlobal'](_0x206e62)>=_0x178156['dialGlobalMaxRetry']){_0x75acc4=ut['cloneAction'](_0x206e62,0xf,_0x1de2('0x99'));rpcDb[_0x1de2('0x9a')](_0x75acc4,_0x1de2('0xb7'));}else{if(_0x206e62[_0x1de2('0xb6')]>=_0x178156[_0x1de2('0xb8')]){rpcDb[_0x1de2('0x9a')](_0x206e62,_0x1de2('0xb9'));}else{rpcDb[_0x1de2('0xba')](ut[_0x1de2('0x9d')](_0x206e62,'countbusyretry',_0x178156[_0x1de2('0xbb')]),_0x206e62[_0x1de2('0x9f')],_0x206e62[_0x1de2('0xa0')]);}}break;case _0x1de2('0xbc'):_0x178156[_0x1de2('0xbd')]+=0x1;_0x206e62[_0x1de2('0xbe')]+=0x1;_0x206e62[_0x1de2('0xbf')]=ut[_0x1de2('0x96')](_0x206e62);ut['logCustomer'](_0x206e62,0x3,'NoAnswer');rpcDb['createCustomerHistory'](_0x206e62,_0x1de2('0xc0'));if(ut[_0x1de2('0x96')](_0x206e62)>=_0x178156[_0x1de2('0x97')]){_0x75acc4=ut[_0x1de2('0x98')](_0x206e62,0xf,_0x1de2('0x99'));rpcDb[_0x1de2('0x9a')](_0x75acc4,_0x1de2('0xc1'));}else{if(_0x206e62[_0x1de2('0xbe')]>=_0x178156[_0x1de2('0xc2')]){rpcDb[_0x1de2('0x9a')](_0x206e62,_0x1de2('0xc0'));}else{rpcDb[_0x1de2('0xba')](ut['scheduledAt'](_0x206e62,'countnoanswerretry',_0x178156[_0x1de2('0xc3')]),_0x206e62[_0x1de2('0x9f')],_0x206e62['activeContact']);}}break;case _0x1de2('0xc4'):_0x178156['outboundCongestionCallsDay']+=0x1;_0x206e62[_0x1de2('0xc5')]+=0x1;_0x206e62[_0x1de2('0xbf')]=ut[_0x1de2('0x96')](_0x206e62);ut[_0x1de2('0x86')](_0x206e62,0x8,_0x1de2('0xc6'));rpcDb['createCustomerHistory'](_0x206e62,_0x1de2('0xc7'));if(ut[_0x1de2('0x96')](_0x206e62)>=_0x178156[_0x1de2('0x97')]){_0x75acc4=ut['cloneAction'](_0x206e62,0xf,_0x1de2('0x99'));rpcDb[_0x1de2('0x9a')](_0x75acc4,_0x1de2('0xc8'));}else{if(_0x206e62[_0x1de2('0xc5')]>=_0x178156[_0x1de2('0xc9')]){rpcDb[_0x1de2('0x9a')](_0x206e62,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x1de2('0xba')](ut['scheduledAt'](_0x206e62,_0x1de2('0xc5'),_0x178156[_0x1de2('0xbb')]),_0x206e62['unlockAgent'],_0x206e62[_0x1de2('0xa0')]);}}break;case _0x1de2('0xca'):_0x178156[_0x1de2('0x3f')]+=0x1;_0x206e62['countagentrejectretry']+=0x1;_0x206e62[_0x1de2('0xbf')]=ut[_0x1de2('0x96')](_0x206e62);ut[_0x1de2('0x86')](_0x206e62,0x14,_0x1de2('0xcb'));rpcDb[_0x1de2('0x89')](_0x206e62,_0x1de2('0xcc'));if(ut[_0x1de2('0x96')](_0x206e62)>=_0x178156[_0x1de2('0x97')]){_0x75acc4=ut[_0x1de2('0x98')](_0x206e62,0x14,_0x1de2('0xcb'));rpcDb[_0x1de2('0x9a')](_0x75acc4,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x206e62[_0x1de2('0xcd')]>=_0x178156[_0x1de2('0xce')]){rpcDb['createCustomerFinal'](_0x206e62,_0x1de2('0xcf'));}else{rpcDb[_0x1de2('0xba')](ut['scheduledAt'](_0x206e62,'countagentrejectretry',_0x178156[_0x1de2('0xd0')]),_0x206e62['unlockAgent'],_0x206e62[_0x1de2('0xa0')]);}}break;case _0x1de2('0xd1'):_0x178156['outboundAbandonedCallsDay']+=0x1;_0x206e62[_0x1de2('0xd2')]+=0x1;_0x206e62[_0x1de2('0xbf')]=ut['totalGlobal'](_0x206e62);ut[_0x1de2('0x86')](_0x206e62,0xb,'Abandoned');rpcDb[_0x1de2('0x89')](_0x206e62,_0x1de2('0xd3'));if(ut[_0x1de2('0x96')](_0x206e62)>=_0x178156[_0x1de2('0x97')]){_0x75acc4=ut['cloneAction'](_0x206e62,0xf,'Global');rpcDb['createCustomerFinal'](_0x75acc4,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x206e62[_0x1de2('0xd4')]>=_0x178156[_0x1de2('0xd5')]){rpcDb[_0x1de2('0x9a')](_0x206e62,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x1de2('0xba')](ut[_0x1de2('0x9d')](_0x206e62,_0x1de2('0xd2'),_0x178156[_0x1de2('0xd6')]),_0x206e62[_0x1de2('0x9f')],_0x206e62['activeContact']);}}break;default:if(_0x206e62[_0x1de2('0x6d')]){ut[_0x1de2('0x74')](_0x178156,_0x1de2('0xd7'));ut[_0x1de2('0x77')](_0x1de2('0xd8')+_0x178156['name'],_0x36e487);}_0x178156[_0x1de2('0x40')]+=0x1;_0x206e62[_0x1de2('0xbf')]=ut[_0x1de2('0x96')](_0x206e62);ut[_0x1de2('0x86')](_0x206e62,0xc,_0x36e487['cause-txt']||_0x36e487['dialstatus']);rpcDb['createCustomerHistory'](_0x206e62,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x1de2('0x96')](_0x206e62)>=_0x178156[_0x1de2('0x97')]){_0x75acc4=ut[_0x1de2('0x98')](_0x206e62,0xf,_0x1de2('0x99'));rpcDb['createCustomerFinal'](_0x75acc4,_0x1de2('0xd9'));}else{rpcDb[_0x1de2('0x9a')](_0x206e62,_0x1de2('0xd9'));}delete this['actions'][_0x36e487[_0x1de2('0xa1')]];}if(!(_0x206e62[_0x1de2('0x6d')]&&_0x142b44==='16')){ut[_0x1de2('0xda')](_0x178156,_0x1de2('0xdb'));logger[_0x1de2('0x68')](_0x1de2('0xdc'),_0x206e62['uniqueid'],'\x20Queue',_0x178156[_0x1de2('0x27')],_0x1de2('0x6c'),_0x178156[_0x1de2('0x4c')]);}if(_0x142b44!=='ANSWER'){delete this['actions'][_0x36e487[_0x1de2('0xa1')]];delete this[_0x1de2('0x6a')][_0x36e487[_0x1de2('0xdd')]];}}};Preview[_0x1de2('0x10')][_0x1de2('0xde')]=function(_0x312cec,_0x54a842,_0x321bc0){if(_[_0x1de2('0xdf')](_0x54a842)&&'object'!==typeof _0x54a842){return;}if(_[_0x1de2('0xdf')](_0x321bc0)&&_0x1de2('0xe0')!==typeof _0x321bc0){return;}switch(_0x321bc0['reason']){case'0':ut['logAgent'](_0x312cec,0x0,_0x1de2('0x95'));rpcDb[_0x1de2('0xe1')](_0x312cec,_0x1de2('0xe2'));break;case'3':ut[_0x1de2('0xe3')](_0x312cec,0x3,_0x1de2('0xe4'));rpcDb[_0x1de2('0xe1')](_0x312cec,_0x1de2('0xe5'));break;case'5':ut[_0x1de2('0xe3')](_0x312cec,0x5,_0x1de2('0xe6'));rpcDb[_0x1de2('0xe1')](_0x312cec,_0x1de2('0xe7'));break;case'8':ut['logAgent'](_0x312cec,0x8,_0x1de2('0xc6'));rpcDb[_0x1de2('0xe1')](_0x312cec,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x1de2('0xe3')](_0x312cec,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x312cec,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x312cec,0xc,_0x321bc0[_0x1de2('0xe8')]);rpcDb[_0x1de2('0xe1')](_0x312cec,_0x1de2('0xe9'));}ut[_0x1de2('0xda')](_0x54a842,_0x1de2('0xea'));logger[_0x1de2('0x68')]('[originated][decrement][callProgressDetectingAgent]',_0x312cec[_0x1de2('0xa5')],_0x1de2('0xa6'),_0x54a842[_0x1de2('0x27')],'originated:\x20',_0x54a842[_0x1de2('0x4c')]);delete this[_0x1de2('0x6a')][_0x312cec['uniqueid']];};Preview[_0x1de2('0x10')]['checkInBlack']=function(_0x2eb42c,_0x447f32,_0x5f46fa,_0x360508,_0x3ffb60){var _0x37d2ed=this;return new BPromise(function(_0x2edecd,_0x32bdd7){if(_[_0x1de2('0x67')](_0x447f32)||_[_0x1de2('0x67')](_0x447f32[_0x1de2('0xeb')])||_[_0x1de2('0x67')](_0x447f32['Contact']['phone'])||_['isNil'](_0x447f32[_0x1de2('0x70')])){_0x32bdd7(ut[_0x1de2('0x5a')]('Contact\x20is\x20undefined',_0x360508,_0x3ffb60));return;}var _0x4c2763=uuid['v4']();var _0x1c9919=_0x37d2ed[_0x1de2('0x15')][_0x447f32[_0x1de2('0xec')][_0x1de2('0x27')]];var _0x5001a5=_0x5f46fa?_0x37d2ed[_0x1de2('0x17')][_0x5f46fa]['id']:undefined;_0x37d2ed[_0x1de2('0x6a')][_0x4c2763]=new Action(_0x447f32,_0x1c9919,_0x4c2763,_0x5f46fa,_0x5001a5);var _0x23956f=_0x37d2ed['actions'][_0x4c2763];_0x23956f[_0x1de2('0x9f')]=_0x360508;_0x23956f['activeContact']=_0x3ffb60;_0x23956f[_0x1de2('0xed')]=_0x5f46fa;if(_['isEmpty'](_0x2eb42c)){_0x37d2ed[_0x1de2('0xee')](_0x23956f,_0x1c9919,_0x447f32,_0x5f46fa)['then'](function(_0x30d02c){logger['info'](_0x1de2('0xef'),_0x1de2('0xf0')+_0x23956f['queue']+_0x1de2('0xf1')+_0x23956f[_0x1de2('0xf2')],JSON[_0x1de2('0x53')](_0x30d02c));ami['emit'](_0x1de2('0xf3'),ut[_0x1de2('0xae')](_0x23956f,_0x1de2('0xf4')));_0x2edecd(ut[_0x1de2('0x5a')](_0x1de2('0xf5')));})[_0x1de2('0x73')](function(_0x3b805f){ut[_0x1de2('0x5c')](_0x1de2('0xf6'),_0x3b805f);_0x32bdd7(ut[_0x1de2('0x5a')](_0x1de2('0xf7'),_0x360508,_0x3ffb60));});}else{_0x1c9919['outboundBlacklistCallsDay']+=0x1;ut['logBlacklist'](_0x23956f);rpcDb[_0x1de2('0xf8')](_0x23956f,_0x1de2('0xf9'));delete _0x37d2ed[_0x1de2('0x6a')][_0x4c2763];_0x32bdd7(ut[_0x1de2('0x5a')]('Contact\x20in\x20black\x20List',_0x360508,_0x3ffb60));}});};Preview['prototype'][_0x1de2('0x90')]=function(_0x2d613b){return!_[_0x1de2('0x67')](_0x2d613b)&&!_[_0x1de2('0x67')](_0x2d613b[_0x1de2('0x27')])&&!_[_0x1de2('0x67')](_0x2d613b['active'])&&_0x2d613b[_0x1de2('0x50')]&&!_[_0x1de2('0x67')](this[_0x1de2('0x16')][util[_0x1de2('0x54')](_0x1de2('0xfa'),_0x2d613b[_0x1de2('0x27')])])&&!_[_0x1de2('0x67')](this['trunks'][util['format'](_0x1de2('0xfa'),_0x2d613b[_0x1de2('0x27')])]['status'])&&(this[_0x1de2('0x16')][util['format'](_0x1de2('0xfa'),_0x2d613b[_0x1de2('0x27')])][_0x1de2('0xfb')]===_0x1de2('0xfc')||this['trunks'][util['format']('SIP/%s',_0x2d613b[_0x1de2('0x27')])]['status']===_0x1de2('0xfd'));};Preview[_0x1de2('0x10')][_0x1de2('0x80')]=function(_0x3089fc,_0x2fbf2a){var _0x15cfba=this;return new BPromise(function(_0x15e6d5,_0x566842){_0x15cfba[_0x1de2('0xfe')](_0x3089fc,_0x2fbf2a)[_0x1de2('0x81')](function(_0x446ccc){_0x15e6d5(_[_0x1de2('0xff')](_0x446ccc,[_0x1de2('0x5a')]));})[_0x1de2('0x73')](function(_0x518b18){if(_0x518b18[_0x1de2('0x100')]){rpcDb['unlockContact'](_0x3089fc);}if(_0x518b18[_0x1de2('0x50')]){rpcDb[_0x1de2('0x101')](_0x3089fc);}_0x566842(_[_0x1de2('0xff')](_0x518b18,[_0x1de2('0x5a')]));});});};Preview[_0x1de2('0x10')]['execRun']=function(_0x378872,_0x46ebfc){var _0x442d6e=this;return new BPromise(function(_0x4ac171,_0x487fe8){var _0x3fbbf2,_0x6fbdb4;rpcDb['getContactPreview'](_0x378872)[_0x1de2('0x81')](function(_0x4aa355){if(!_[_0x1de2('0x67')](_0x4aa355[0x0])){_0x6fbdb4=_0x4aa355[0x0][_0x1de2('0x102')]?![]:!![];_0x3fbbf2=_0x4aa355[0x0]['recallme']?!![]:![];_0x3fbbf2=_0x46ebfc?!![]:_0x3fbbf2;}var _0x1aaa05=_0x442d6e['validateContact'](_0x4aa355);if(_0x1aaa05[_0x1de2('0x103')]){rpcDb[_0x1de2('0x104')](_[_0x1de2('0xff')](_0x4aa355[0x0],['VoiceQueueId','Contact.phone']))[_0x1de2('0x81')](function(_0x214c05){_0x442d6e[_0x1de2('0x105')](_0x214c05,_0x4aa355[0x0],_0x46ebfc,_0x6fbdb4,_0x3fbbf2)[_0x1de2('0x81')](function(_0x39d1a7){_0x4ac171(_0x39d1a7);})['catch'](function(_0x2a94ea){_0x487fe8(_0x2a94ea);});})['catch'](function(_0x4797ce){ut[_0x1de2('0x5c')](_0x1de2('0x106'),_0x4797ce);_0x487fe8(ut['message'](_0x1de2('0x107'),_0x6fbdb4,_0x3fbbf2));});}else{_0x487fe8(ut[_0x1de2('0x5a')](_0x1aaa05[_0x1de2('0x5a')],_0x6fbdb4,_0x3fbbf2));}})[_0x1de2('0x73')](function(_0x4417e2){ut[_0x1de2('0x5c')](_0x1de2('0x108'),_0x4417e2);_0x487fe8(ut['message'](_0x1de2('0x107'),![],!![]));});});};Preview[_0x1de2('0x10')]['validateContact']=function(_0x4990ad){if(_['isNil'](_0x4990ad)||_[_0x1de2('0x109')](_0x4990ad)||!_['isNil'](_0x4990ad[0x0]['Agent'])&&_[_0x1de2('0x67')](_0x4990ad[0x0][_0x1de2('0x7f')]['name'])){ut[_0x1de2('0x5c')]('[Preview][validateContact][Empty\x20Contact]',_0x4990ad);return{'isValid':![],'message':_0x1de2('0x10a')};}var _0x4ca65b=this[_0x1de2('0x15')][_0x4990ad[0x0]['Queue']['name']];_0x4ca65b[_0x1de2('0x5a')]='ACTIVE';if(_[_0x1de2('0x67')](_0x4ca65b)){ut[_0x1de2('0x5c')](_0x1de2('0x10b'),_0x4ca65b);return{'isValid':![],'message':_0x1de2('0x10c')};}if(!this[_0x1de2('0x90')](_0x4ca65b[_0x1de2('0x4f')])){ut['logger'](_0x1de2('0x10d'),_0x1de2('0x10e')+_0x4ca65b[_0x1de2('0x27')]+_0x1de2('0x10f'));if(!this['isTrunkReachable'](_0x4ca65b[_0x1de2('0x91')])){ut['logger'](_0x1de2('0x10d'),_0x4ca65b['name']+_0x1de2('0x110'));return{'isValid':![],'message':_0x1de2('0x111')};}}if(!ut[_0x1de2('0x112')](_0x4ca65b[_0x1de2('0x34')])){ut[_0x1de2('0x5c')](_0x1de2('0x113'),_0x4ca65b[_0x1de2('0x27')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4ca65b[_0x1de2('0x27')]+_0x1de2('0x114')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x1de2('0x10')][_0x1de2('0xee')]=function(_0x3a059b,_0x1785ae,_0x2860cc,_0x37cae0){var _0x2387f6=this;return new BPromise(function(_0x3606ef,_0x184b0c){var _0x4d7327=_0x3a059b[_0x1de2('0xa5')];var _0x3402ac=_0x2387f6[_0x1de2('0x90')](_0x1785ae[_0x1de2('0x4f')])?util[_0x1de2('0x54')](_0x1de2('0x115'),_0x1785ae['Trunk'][_0x1de2('0x27')],_[_0x1de2('0x67')](_0x1785ae[_0x1de2('0x36')])?'':_0x1785ae[_0x1de2('0x36')]['trim']()||'',_0x1785ae[_0x1de2('0x116')]>0x0?_0x2860cc[_0x1de2('0xeb')][_0x1de2('0x117')][_0x1de2('0x118')](_0x1785ae[_0x1de2('0x116')]):_0x2860cc[_0x1de2('0xeb')][_0x1de2('0x117')]):util[_0x1de2('0x54')](_0x1de2('0x115'),_[_0x1de2('0x67')](_0x1785ae[_0x1de2('0x91')])?_0x1785ae[_0x1de2('0x4f')]['name']:_0x1785ae[_0x1de2('0x91')]['name'],_[_0x1de2('0x67')](_0x1785ae['dialPrefix'])?'':_0x1785ae[_0x1de2('0x36')][_0x1de2('0x119')]()||'',_0x1785ae[_0x1de2('0x116')]>0x0?_0x2860cc[_0x1de2('0xeb')]['phone'][_0x1de2('0x118')](_0x1785ae['dialCutDigit']):_0x2860cc[_0x1de2('0xeb')][_0x1de2('0x117')]);var _0x25ebbb=_0x2387f6[_0x1de2('0x90')](_0x1785ae[_0x1de2('0x4f')])?ut[_0x1de2('0x11a')](_0x1785ae[_0x1de2('0x4f')][_0x1de2('0x51')],_0x1785ae[_0x1de2('0x35')],_0x1785ae[_0x1de2('0x11b')]>0x0?ut[_0x1de2('0x11c')](_0x1785ae[_0x1de2('0x11d')],_0x1785ae['dialRandomLastDigitCallerIdNumber']):_0x1785ae[_0x1de2('0x11d')]):ut[_0x1de2('0x11a')](_[_0x1de2('0x67')](_0x1785ae[_0x1de2('0x91')])?_0x1785ae[_0x1de2('0x4f')][_0x1de2('0x51')]:_0x1785ae[_0x1de2('0x91')][_0x1de2('0x51')],_0x1785ae[_0x1de2('0x35')],_0x1785ae['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x1785ae['dialOriginateCallerIdNumber'],_0x1785ae[_0x1de2('0x11b')]):_0x1785ae[_0x1de2('0x11d')]);if(_0x25ebbb){_0x3a059b[_0x1de2('0x11e')]=ut[_0x1de2('0x11f')](_0x25ebbb);_0x3a059b['originatecalleridnum']=ut['extractCalleridNumber'](_0x25ebbb);}var _0x29a23a=ut[_0x1de2('0x120')](_0x1785ae,_0x2860cc,_0x3402ac,_0x25ebbb,_0x4d7327,_0x3a059b);_['merge'](_0x3a059b,ut[_0x1de2('0x121')](_0x29a23a));_0x3a059b[_0x1de2('0x84')]=moment()[_0x1de2('0x54')](_0x1de2('0x85'));ami[_0x1de2('0x71')](ut[_0x1de2('0x122')](_0x3a059b,_0x1785ae,_0x29a23a,_0x3a059b[_0x1de2('0xa0')],_0x37cae0))[_0x1de2('0x81')](function(_0x565273){_0x1785ae[_0x1de2('0x4c')]+=0x1;logger[_0x1de2('0x68')](_0x1de2('0x123'),_0x4d7327,_0x1de2('0xa6'),_0x1785ae['name'],_0x1de2('0x6c'),_0x1785ae[_0x1de2('0x4c')]);_0x3606ef(_0x565273);})[_0x1de2('0x73')](function(_0x155a37){ut[_0x1de2('0xe3')](_0x3a059b,0xe,_0x1de2('0x124'));rpcDb[_0x1de2('0xe1')](_0x3a059b,_0x1de2('0x125'));_0x184b0c(_0x155a37);});});};Preview[_0x1de2('0x10')]['syncNewExten']=function(_0x2c3c71){if(this['actions'][_0x2c3c71[_0x1de2('0xa1')]]){this[_0x1de2('0x6a')][_0x2c3c71[_0x1de2('0xa1')]][_0x1de2('0x72')]=_0x2c3c71[_0x1de2('0x72')];}};Preview[_0x1de2('0x10')][_0x1de2('0x18')]=function(_0x521cb5){var _0xa61c8b=this;var _0x2ca0a2=this[_0x1de2('0x6a')][_0x521cb5[_0x1de2('0x126')]];if(_0x2ca0a2){if(_0x2ca0a2['lookAgent']&&this[_0x1de2('0x17')][_0x2ca0a2['lookAgent']]){ut[_0x1de2('0x127')](_0x2ca0a2,this[_0x1de2('0x17')][_0x2ca0a2['lookAgent']][_0x1de2('0x27')],this['agents'][_0x2ca0a2['lookAgent']]['id']);}var _0x232200=_[_0x1de2('0x128')](_0x2ca0a2);_0x232200[_0x1de2('0xa2')]=moment()[_0x1de2('0x54')]('YYYY-MM-DD\x20HH:mm:ss');var _0x38a540=_0xa61c8b['campaignsPreview'][_0x2ca0a2[_0x1de2('0x6b')]];if(ut['isFailure'](_0x521cb5[_0x1de2('0x129')])){if(_0x2ca0a2[_0x1de2('0x9f')]){rpcDb[_0x1de2('0x12a')](_0x2ca0a2[_0x1de2('0xf2')]);}if(_0x2ca0a2[_0x1de2('0xa0')]){rpcDb[_0x1de2('0x101')](_0x2ca0a2['idContact']);}ami[_0x1de2('0xa8')](_0x1de2('0x12b'),ut['buildObj'](_0x2ca0a2,_0x1de2('0x12c')));this['callProgressDetectingAgent'](_0x232200,_0x38a540,_0x521cb5);}else{_0x2ca0a2[_0x1de2('0x84')]=moment()[_0x1de2('0x54')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x1de2('0xe3')](_0x232200,0x4,_0x1de2('0xb0'));rpcDb[_0x1de2('0xe1')](_0x232200,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x1de2('0x10')][_0x1de2('0x12d')]=function(_0x56d5f0){var _0x5656fc=this;var _0x56586d=this[_0x1de2('0x6a')][_0x56d5f0[_0x1de2('0xa1')]];var _0x269497;if(_0x56586d){_0x269497=this[_0x1de2('0x15')][_0x56586d[_0x1de2('0x6b')]];logger['info'](_0x1de2('0x12e'),_0x56d5f0[_0x1de2('0xa1')],_0x1de2('0xa6'),_0x269497[_0x1de2('0x27')],_0x1de2('0xa7'),_0x269497[_0x1de2('0x2b')]);}if(this['actions'][_0x56d5f0[_0x1de2('0xa1')]]&&_0x56d5f0['linkedid']!==_0x56d5f0['uniqueid']){if(_0x56d5f0[_0x1de2('0x12f')]==='16'&&this[_0x1de2('0x6a')][_0x56d5f0['linkedid']]['dialAnswer']){this[_0x1de2('0x130')](_0x56d5f0,_0x56d5f0[_0x1de2('0xa1')],_0x56d5f0[_0x1de2('0x12f')]);}else if(this['actions'][_0x56d5f0['linkedid']][_0x1de2('0x6d')]){logger[_0x1de2('0x68')]('[syncHangup][talking][cause]',_0x56d5f0['linkedid'],_0x56d5f0['cause'],'\x20Queue',_0x269497['name'],_0x1de2('0xa7'),_0x269497[_0x1de2('0x2b')]);this[_0x1de2('0x130')](_0x56d5f0,_0x56d5f0[_0x1de2('0xa1')],_0x56d5f0['cause']);}}else if(_0x56586d&&_[_0x1de2('0x67')](_0x56586d[_0x1de2('0x131')])&&_0x269497[_0x1de2('0x132')]&&_0x56d5f0[_0x1de2('0xa1')]===_0x56d5f0[_0x1de2('0xa5')]&&_[_0x1de2('0x67')](_0x56d5f0[_0x1de2('0xe8')])&&_0x56d5f0[_0x1de2('0x12f')]==='16'&&_0x56d5f0[_0x1de2('0x133')]==='6'&&_[_0x1de2('0xdf')](_0x56586d['transfer'])){if(_0x56586d[_0x1de2('0x9f')]){rpcDb[_0x1de2('0x12a')](_0x56586d['idContact']);}if(_0x56586d[_0x1de2('0xa0')]){rpcDb[_0x1de2('0x101')](_0x56586d[_0x1de2('0xf2')]);}_0x56d5f0['reason']='22';this['callProgressDetectingAgent'](_0x56586d,_0x269497,_0x56d5f0);}else if(_0x56586d&&_0x56586d['transfer']){if(_0x56d5f0[_0x1de2('0x12f')]==='16'&&this[_0x1de2('0x6a')][_0x56d5f0['linkedid']]['dialAnswer']){logger[_0x1de2('0x68')]('[syncHangup][talking][transfer]',_0x56d5f0['linkedid'],_0x56d5f0[_0x1de2('0x12f')],_0x1de2('0xa6'),_0x269497[_0x1de2('0x27')],'pTalking:\x20',_0x269497[_0x1de2('0x2b')]);this[_0x1de2('0x130')](_0x56d5f0,_0x56d5f0[_0x1de2('0xa1')],_0x56d5f0[_0x1de2('0x12f')]);}else if(this['actions'][_0x56d5f0[_0x1de2('0xa1')]][_0x1de2('0x6d')]){logger[_0x1de2('0x68')]('[syncHangup][talking][cause]',_0x56d5f0[_0x1de2('0xa1')],_0x56d5f0[_0x1de2('0x12f')],_0x1de2('0xa6'),_0x269497[_0x1de2('0x27')],_0x1de2('0xa7'),_0x269497[_0x1de2('0x2b')]);this[_0x1de2('0x130')](_0x56d5f0,_0x56d5f0['linkedid'],_0x56d5f0[_0x1de2('0x12f')]);}}};Preview[_0x1de2('0x10')][_0x1de2('0x1d')]=function(_0xb0ea94){if(this[_0x1de2('0x6a')][_0xb0ea94[_0x1de2('0xdd')]]&&_0xb0ea94[_0x1de2('0xdd')]!==_0xb0ea94[_0x1de2('0x134')]){this[_0x1de2('0x130')](_0xb0ea94,_0xb0ea94['destlinkedid'],_0xb0ea94[_0x1de2('0x135')]);}};Preview[_0x1de2('0x10')][_0x1de2('0x136')]=function(_0x3c61af){if(this[_0x1de2('0x6a')][_0x3c61af[_0x1de2('0xa1')]]&&_0x3c61af[_0x1de2('0xa1')]!==_0x3c61af[_0x1de2('0xa5')]&&!this[_0x1de2('0x6a')][_0x3c61af[_0x1de2('0xa1')]]['dialAnswer']){if(_0x3c61af[_0x1de2('0x12f')]==='1'){this[_0x1de2('0x130')](_0x3c61af,_0x3c61af['linkedid'],_0x3c61af['cause']);}}};Preview['prototype'][_0x1de2('0x137')]=function(_0x22b580,_0x4d5da3,_0x302767){if(this['actions'][_0x22b580]){if(_['isNil'](this[_0x1de2('0x6a')][_0x22b580]['variables'])){this[_0x1de2('0x6a')][_0x22b580][_0x1de2('0x138')]={};}this[_0x1de2('0x6a')][_0x22b580][_0x1de2('0x138')][_0x4d5da3]=_0x302767;}};Preview[_0x1de2('0x10')][_0x1de2('0x20')]=function(_0x358552){try{if(!_[_0x1de2('0x67')](_0x358552)){if(ut[_0x1de2('0x139')](_[_0x1de2('0x13a')](_0x358552[_0x1de2('0x13b')])[0x0])){this['addVariable'](_0x358552['uniqueid'],_['keys'](_0x358552[_0x1de2('0x13b')])[0x0],_0x358552[_0x1de2('0x13c')]);}}}catch(_0xd7c3d){logger[_0x1de2('0x13d')](_0x1de2('0x13e'),util[_0x1de2('0x13f')](_0xd7c3d,{'showHidden':![],'depth':null}));}};Preview[_0x1de2('0x10')][_0x1de2('0x22')]=function(_0x345e84){if(_0x345e84){if(this['actions'][_0x345e84[_0x1de2('0x140')]]){this['actions'][_0x345e84[_0x1de2('0x140')]][_0x1de2('0x141')]=!![];}}};Preview[_0x1de2('0x10')][_0x1de2('0x24')]=function(_0x85b404){if(_0x85b404){if(this['actions'][_0x85b404[_0x1de2('0x142')]]){this[_0x1de2('0x6a')][_0x85b404['transfererlinkedid']]['transfer']=!![];}}};module[_0x1de2('0x143')]=Preview; \ No newline at end of file +var _0xe8d8=['outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','destlinkedid','callProgressDetectingAgent','object','isUndefined','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','AnswerAGI','reason','[callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','called','Calling','[Preview][execCall][failure]','Call\x20failed','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','run','unlock','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','Empty\x20Contact','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','extractCalleridNumber','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','isFailure','response','rejected','starttime','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','destuniqueid','dialstatus','addVariable','variables','filterKey','keys','variable','value','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./action','./util/util','defaults','redis','socket.io-emitter','prototype','enqueue','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','varset','syncAttendedTransfer','syncBlindTransfer','emit','type','outbound','name','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','IS_DISACTIVED','[CampaignPreview]\x20Campaign\x20Queue:\x20','syncCampaigns','campaignsPreview','booked','hasOwnProperty','clearZombieChannel','sequence','actions','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','recallMe','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','Agent','voicePause','logger2','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','answered','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','dialBusyRetryFrequency','CANCEL','AgentReject','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectRetryFrequency','ABANDONED'];(function(_0x1470ea,_0x4769f3){var _0x5910c4=function(_0x28a136){while(--_0x28a136){_0x1470ea['push'](_0x1470ea['shift']());}};_0x5910c4(++_0x4769f3);}(_0xe8d8,0x1a2));var _0x8e8d=function(_0x49644a,_0x3c5786){_0x49644a=_0x49644a-0x0;var _0x1d6f68=_0xe8d8[_0x49644a];return _0x1d6f68;};'use strict';var util=require(_0x8e8d('0x0'));var _=require('lodash');var BPromise=require(_0x8e8d('0x1'));var uuid=require(_0x8e8d('0x2'));var moment=require(_0x8e8d('0x3'));var md5=require(_0x8e8d('0x4'));var Redis=require(_0x8e8d('0x5'));var config=require(_0x8e8d('0x6'));var logger=require(_0x8e8d('0x7'))(_0x8e8d('0x8'));var loggerAction=require(_0x8e8d('0x7'))(_0x8e8d('0x9'));var ami=require(_0x8e8d('0xa'));var rpcDb=require('./rpcDb');var Action=require(_0x8e8d('0xb'));var ut=require(_0x8e8d('0xc'));config['redis']=_[_0x8e8d('0xd')](config[_0x8e8d('0xe')],{'host':'localhost','port':0x18eb});var io=require(_0x8e8d('0xf'))(new Redis(config[_0x8e8d('0xe')]));var Sequence=function(){};Sequence[_0x8e8d('0x10')][_0x8e8d('0x11')]=function(_0x22f964){this['tail']=this['tail']?this['tail']['finally'](_0x22f964):_0x22f964();};function Preview(_0x501c21){this['sequence']=new Sequence();this['campaignsPreview']=_0x501c21[_0x8e8d('0x12')];this['trunks']=_0x501c21[_0x8e8d('0x13')];this['actions']={};this[_0x8e8d('0x14')]=_0x501c21[_0x8e8d('0x14')];this[_0x8e8d('0x15')]=0x0;ami['on'](_0x8e8d('0x16'),this['syncOriginateResponse'][_0x8e8d('0x17')](this));ami['on'](_0x8e8d('0x18'),this[_0x8e8d('0x19')][_0x8e8d('0x17')](this));ami['on']('hanguprequest',this[_0x8e8d('0x1a')][_0x8e8d('0x17')](this));ami['on'](_0x8e8d('0x1b'),this[_0x8e8d('0x1c')]['bind'](this));ami['on']('newexten',this['syncNewExten'][_0x8e8d('0x17')](this));ami['on'](_0x8e8d('0x1d'),this['syncVarSet'][_0x8e8d('0x17')](this));ami['on']('attendedtransfer',this[_0x8e8d('0x1e')][_0x8e8d('0x17')](this));ami['on']('blindtransfer',this[_0x8e8d('0x1f')][_0x8e8d('0x17')](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x22e9f7,_0x583a00,_0x15e808){io['to'](_0x22e9f7)[_0x8e8d('0x20')](_0x583a00,_0x15e808);}function emitCampaignPreview(_0x4ed222){if(_0x4ed222[_0x8e8d('0x21')]===_0x8e8d('0x22')){var _0x60907f={'id':_0x4ed222['id'],'name':_0x4ed222[_0x8e8d('0x23')],'strategy':_0x4ed222[_0x8e8d('0x24')],'answered':_0x4ed222['answered'],'available':_0x4ed222[_0x8e8d('0x25')],'loggedIn':_0x4ed222[_0x8e8d('0x26')],'pTalking':_0x4ed222[_0x8e8d('0x27')],'sumBillable':_0x4ed222[_0x8e8d('0x28')],'sumDuration':_0x4ed222[_0x8e8d('0x29')],'sumHoldTime':_0x4ed222[_0x8e8d('0x2a')]||0x0,'talking':_0x4ed222[_0x8e8d('0x2b')],'total':_0x4ed222[_0x8e8d('0x2c')],'type':_0x4ed222[_0x8e8d('0x21')],'unmanaged':_0x4ed222[_0x8e8d('0x2d')],'abandoned':_0x4ed222['abandoned'],'waiting':_0x4ed222[_0x8e8d('0x2e')],'loggedInDb':_0x4ed222['loggedInDb'],'dialActive':_0x4ed222[_0x8e8d('0x2f')],'dialMethod':_0x4ed222[_0x8e8d('0x30')],'dialOriginateCallerIdName':_0x4ed222[_0x8e8d('0x31')],'dialOriginateCallerIdNumber':_0x4ed222[_0x8e8d('0x32')],'dialOriginateTimeout':_0x4ed222[_0x8e8d('0x33')],'dialPrefix':_0x4ed222['dialPrefix'],'outboundAnswerAgiCallsDay':_0x4ed222[_0x8e8d('0x34')],'outboundAnswerCallsDay':_0x4ed222[_0x8e8d('0x35')],'outboundBlacklistCallsDay':_0x4ed222[_0x8e8d('0x36')],'outboundBusyCallsDay':_0x4ed222[_0x8e8d('0x37')],'outboundCongestionCallsDay':_0x4ed222[_0x8e8d('0x38')],'outboundDropCallsDayACS':_0x4ed222[_0x8e8d('0x39')],'outboundDropCallsDayCallersExit':_0x4ed222['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x4ed222[_0x8e8d('0x3a')],'outboundNoAnswerCallsDay':_0x4ed222['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x4ed222[_0x8e8d('0x3b')],'outboundOriginateFailureCallsDay':_0x4ed222[_0x8e8d('0x3c')],'outboundReCallsDay':_0x4ed222['outboundReCallsDay'],'outboundRejectCallsDay':_0x4ed222[_0x8e8d('0x3d')],'outboundUnknownCallsDay':_0x4ed222[_0x8e8d('0x3e')],'outboundAbandonedCallsDay':_0x4ed222['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x4ed222[_0x8e8d('0x3f')],'predictiveIntervalAvgHoldtime':_0x4ed222[_0x8e8d('0x40')],'predictiveIntervalAvgTalktime':_0x4ed222[_0x8e8d('0x41')],'predictiveIntervalDroppedCallsCallersExit':_0x4ed222[_0x8e8d('0x42')],'predictiveIntervalDroppedCallsTimeout':_0x4ed222[_0x8e8d('0x43')],'predictiveIntervalErlangCalls':_0x4ed222['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x4ed222['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x4ed222[_0x8e8d('0x44')],'predictiveIntervalMultiplicativeFactor':_0x4ed222[_0x8e8d('0x45')],'predictiveIntervalPauses':_0x4ed222[_0x8e8d('0x46')],'predictiveIntervalAvailable':_0x4ed222[_0x8e8d('0x47')],'predictiveIntervalTotalCalls':_0x4ed222[_0x8e8d('0x48')],'message':_0x4ed222[_0x8e8d('0x49')],'originated':_0x4ed222[_0x8e8d('0x4a')],'erlangCalls':_0x4ed222['erlangCalls'],'erlangCallToSecond':_0x4ed222['erlangCallToSecond'],'erlangAbandonmentRate':_0x4ed222['erlangAbandonmentRate'],'erlangBusyFactor':_0x4ed222[_0x8e8d('0x4b')],'startPredictive':_0x4ed222[_0x8e8d('0x4c')],'startProgressive':_0x4ed222[_0x8e8d('0x4d')]};if(_0x4ed222['Trunk']){_0x60907f[_0x8e8d('0x4e')]={'id':_0x4ed222['Trunk']['id'],'name':_0x4ed222[_0x8e8d('0x4e')][_0x8e8d('0x23')],'active':_0x4ed222[_0x8e8d('0x4e')]['active'],'callerid':_0x4ed222[_0x8e8d('0x4e')][_0x8e8d('0x4f')]};}if(_0x4ed222[_0x8e8d('0x50')]){_0x60907f[_0x8e8d('0x50')]={'id':_0x4ed222['Interval']['id'],'name':_0x4ed222['Interval'][_0x8e8d('0x23')]};}var _0x76aaa2=md5(JSON[_0x8e8d('0x51')](_0x60907f));if(_0x4ed222[_0x8e8d('0x4')]!==_0x76aaa2){_0x4ed222[_0x8e8d('0x4')]=_0x76aaa2;emit(util[_0x8e8d('0x52')](_0x8e8d('0x53'),_0x60907f[_0x8e8d('0x23')]),_0x8e8d('0x54'),_0x60907f);}}}function emitVoiceQueueChannelRemove(_0x31b690){logger[_0x8e8d('0x55')](_0x8e8d('0x56'),JSON[_0x8e8d('0x51')](_0x31b690));emit(util['format'](_0x8e8d('0x53'),_0x31b690[_0x8e8d('0x23')]),'voice_queue_channel:remove',_0x31b690);}function notSendMessagesQueue(_0x160f5e){if(_0x160f5e['sendMessageOneNotActive']){if(_0x160f5e[_0x8e8d('0x4a')]===0x0&&_0x160f5e[_0x8e8d('0x27')]===0x0){_0x160f5e[_0x8e8d('0x57')]=![];_0x160f5e[_0x8e8d('0x25')]=0x0;_0x160f5e[_0x8e8d('0x58')]=0x0;_0x160f5e[_0x8e8d('0x49')]=_0x8e8d('0x59');ut[_0x8e8d('0x5a')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x160f5e['name']+'\x20is\x20not\x20active');}else{_0x160f5e[_0x8e8d('0x49')]=_0x8e8d('0x5b');ut['logger'](_0x8e8d('0x5c'),_0x160f5e['name']+'\x20is\x20disactive');}emitCampaignPreview(_0x160f5e);}}Preview[_0x8e8d('0x10')]['loopCampaigns']=function(){var _0x5251bf=this;setInterval(function(){_0x5251bf[_0x8e8d('0x5d')]();},0x7cf);};Preview['prototype'][_0x8e8d('0x5d')]=function(){var _0x984f05=this[_0x8e8d('0x5e')];this['clockClearZombieChannels']+=0x1;for(var _0x2e51a6 in _0x984f05){if(_0x984f05['hasOwnProperty'](_0x2e51a6)&&(_0x984f05[_0x2e51a6]['dialMethod']==='preview'||_0x984f05[_0x2e51a6][_0x8e8d('0x30')]===_0x8e8d('0x5f'))&&_0x984f05[_0x2e51a6][_0x8e8d('0x21')]===_0x8e8d('0x22')){if(this[_0x8e8d('0x15')]>0x7){this[_0x8e8d('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x984f05[_0x8e8d('0x60')](_0x2e51a6)&&_0x984f05[_0x2e51a6][_0x8e8d('0x30')]==='preview'&&_0x984f05[_0x2e51a6][_0x8e8d('0x21')]===_0x8e8d('0x22')){if(_0x984f05[_0x2e51a6][_0x8e8d('0x2f')]){this['setMessage'](_0x984f05[_0x2e51a6]);this['recallMe'](_0x984f05[_0x2e51a6]);}else{notSendMessagesQueue(_0x984f05[_0x2e51a6]);}}}};Preview[_0x8e8d('0x10')][_0x8e8d('0x61')]=function(_0xedf8ed){var _0x5bed3e=this;this[_0x8e8d('0x62')][_0x8e8d('0x11')](function(){if(!_['isNil'](_0x5bed3e[_0x8e8d('0x63')][_0xedf8ed])){loggerAction[_0x8e8d('0x55')](_0x8e8d('0x64'),_0xedf8ed,_0x8e8d('0x65'),_0x5bed3e[_0x8e8d('0x63')][_0xedf8ed][_0x8e8d('0x66')],_0x8e8d('0x67'),JSON[_0x8e8d('0x51')](_0x5bed3e[_0x8e8d('0x5e')][_0x5bed3e[_0x8e8d('0x63')][_0xedf8ed][_0x8e8d('0x66')]]['originated']),_0x8e8d('0x68'),JSON[_0x8e8d('0x51')](_0x5bed3e['campaignsPreview'][_0x5bed3e[_0x8e8d('0x63')][_0xedf8ed][_0x8e8d('0x66')]][_0x8e8d('0x27')]),JSON[_0x8e8d('0x51')](_0x5bed3e['actions'][_0xedf8ed][_0x8e8d('0x69')]),JSON[_0x8e8d('0x51')](_[_0x8e8d('0x6a')](_0x5bed3e[_0x8e8d('0x63')][_0xedf8ed],[_0x8e8d('0x6b'),'UserId',_0x8e8d('0x6c'),_0x8e8d('0x6d')])));return ami[_0x8e8d('0x6e')]({'action':_0x8e8d('0x6f'),'channel':_0x5bed3e[_0x8e8d('0x63')][_0xedf8ed][_0x8e8d('0x70')]})[_0x8e8d('0x71')](function(_0x362f86){if(_0x362f86['message']===_0x8e8d('0x72')){setTimeout(function(){if(_0x5bed3e[_0x8e8d('0x63')][_0xedf8ed]){ut[_0x8e8d('0x73')](_0x5bed3e[_0x8e8d('0x5e')][_0x5bed3e[_0x8e8d('0x63')][_0xedf8ed][_0x8e8d('0x66')]],_0x8e8d('0x74'));if(_0x5bed3e[_0x8e8d('0x63')][_0xedf8ed][_0x8e8d('0x69')]===!![]){ut[_0x8e8d('0x75')](_0x5bed3e['campaignsPreview'][_0x5bed3e['actions'][_0xedf8ed]['queue']],_0x8e8d('0x74'));ut[_0x8e8d('0x76')](_0x8e8d('0x77')+_0xedf8ed,_0x5bed3e[_0x8e8d('0x63')][_0xedf8ed]['queue']);}ut[_0x8e8d('0x76')](_0x8e8d('0x78')+_0xedf8ed,_0x5bed3e[_0x8e8d('0x63')][_0xedf8ed][_0x8e8d('0x66')]);delete _0x5bed3e[_0x8e8d('0x63')][_0xedf8ed];}},0x2328);}});}});};Preview[_0x8e8d('0x10')][_0x8e8d('0x79')]=function(){var _0x388b4f=this;loggerAction[_0x8e8d('0x55')]('[action]',_['size'](this[_0x8e8d('0x63')]));for(var _0x14f064 in this[_0x8e8d('0x63')]){if(_0x388b4f['actions']['hasOwnProperty'](_0x14f064)){_0x388b4f['clearZombieChannel'](_0x14f064);}}};Preview[_0x8e8d('0x10')][_0x8e8d('0x7a')]=function(_0x2d71bb){var _0x56b141=this;rpcDb[_0x8e8d('0x7b')](_0x2d71bb['id'],ut[_0x8e8d('0x7c')](this[_0x8e8d('0x14')]))[_0x8e8d('0x7d')](function(_0x444fc8){if(!_[_0x8e8d('0x7e')](_0x444fc8)){for(var _0x2a4bb9=0x0;_0x2a4bb9<_0x444fc8[_0x8e8d('0x7f')];_0x2a4bb9+=0x1){if(ut[_0x8e8d('0x80')](_0x444fc8[_0x2a4bb9]['scheduledat'])<_0x2d71bb['dialRecallMeTimeout']*0x3c){if(_0x444fc8[_0x2a4bb9][_0x8e8d('0x81')]&&!_0x444fc8[_0x2a4bb9][_0x8e8d('0x81')][_0x8e8d('0x82')]){_0x56b141['run'](_0x444fc8[_0x2a4bb9]['id'])[_0x8e8d('0x7d')](ut[_0x8e8d('0x83')](_0x8e8d('0x84')))[_0x8e8d('0x71')](ut[_0x8e8d('0x83')]('[RecallMe]'));}else{rpcDb[_0x8e8d('0x85')](_0x444fc8[_0x2a4bb9]['id']);}}else{var _0x5a3e3b=new Action(_0x444fc8[_0x2a4bb9],_0x2d71bb);_0x5a3e3b['starttime']=moment()[_0x8e8d('0x52')](_0x8e8d('0x86'));_0x2d71bb[_0x8e8d('0x87')]+=0x1;ut[_0x8e8d('0x88')](_0x5a3e3b,0x17,_0x8e8d('0x89'));if(_0x2d71bb[_0x8e8d('0x8a')]){rpcDb[_0x8e8d('0x8b')](ut[_0x8e8d('0x8c')](_0x444fc8[_0x2a4bb9]));rpcDb['createCustomerHistory'](_0x5a3e3b,_0x8e8d('0x8d'));}else{ut['logCustomer'](_0x5a3e3b,0x16,_0x8e8d('0x8e'));rpcDb[_0x8e8d('0x8f')](_0x5a3e3b,'[HistoryRecallClose]');rpcDb[_0x8e8d('0x90')](_0x5a3e3b,_0x8e8d('0x91'));}}}}})[_0x8e8d('0x71')](ut[_0x8e8d('0x83')](_0x8e8d('0x92')));};Preview['prototype'][_0x8e8d('0x93')]=function(_0x3eebc7){_0x3eebc7[_0x8e8d('0x57')]=!![];if(ut[_0x8e8d('0x94')](_0x3eebc7[_0x8e8d('0x26')])){_0x3eebc7[_0x8e8d('0x49')]=_0x8e8d('0x95');}else if(!ut[_0x8e8d('0x96')](_0x3eebc7['dialActive'])){_0x3eebc7[_0x8e8d('0x49')]=_0x8e8d('0x59');}else if(!this[_0x8e8d('0x97')](_0x3eebc7['Trunk'])){if(!this[_0x8e8d('0x97')](_0x3eebc7[_0x8e8d('0x98')])){_0x3eebc7[_0x8e8d('0x49')]=_0x8e8d('0x99');}else{_0x3eebc7[_0x8e8d('0x49')]='ACTIVE';}}else{_0x3eebc7[_0x8e8d('0x49')]='ACTIVE';}emitCampaignPreview(_0x3eebc7);};Preview['prototype'][_0x8e8d('0x9a')]=function(_0xc837a3,_0x2d32e0,_0xd69d3f){var _0x12e92c=this;var _0x16b0ca=this[_0x8e8d('0x63')][_0x2d32e0];var _0x32691d=this['campaignsPreview'][_0x16b0ca[_0x8e8d('0x66')]];var _0x1ad67e;if(_0x32691d){switch(_0xd69d3f){case'1':_0x32691d[_0x8e8d('0x3b')]+=0x1;_0x16b0ca[_0x8e8d('0x9b')]+=0x1;_0x16b0ca[_0x8e8d('0x9c')]=ut[_0x8e8d('0x9d')](_0x16b0ca);ut[_0x8e8d('0x88')](_0x16b0ca,0x0,_0x8e8d('0x9e'));rpcDb[_0x8e8d('0x8f')](_0x16b0ca,_0x8e8d('0x9f'));if(ut['totalGlobal'](_0x16b0ca)>=_0x32691d[_0x8e8d('0xa0')]){_0x1ad67e=ut[_0x8e8d('0xa1')](_0x16b0ca,0xf,_0x8e8d('0xa2'));rpcDb['createCustomerFinal'](_0x1ad67e,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x16b0ca[_0x8e8d('0x9b')]>=_0x32691d[_0x8e8d('0xa3')]){rpcDb[_0x8e8d('0x90')](_0x16b0ca,_0x8e8d('0xa4'));}else{rpcDb[_0x8e8d('0xa5')](ut[_0x8e8d('0xa6')](_0x16b0ca,_0x8e8d('0x9b'),_0x32691d[_0x8e8d('0xa7')]),_0x16b0ca[_0x8e8d('0xa8')],_0x16b0ca[_0x8e8d('0xa9')]);}}delete this['actions'][_0xc837a3[_0x8e8d('0xaa')]];break;case _0x8e8d('0xab'):var _0x2f5614=moment()[_0x8e8d('0x52')](_0x8e8d('0x86'));_0x16b0ca[_0x8e8d('0xac')]=_0x2f5614;_0x16b0ca[_0x8e8d('0xad')]=_0x2f5614;_0x16b0ca[_0x8e8d('0x69')]=!![];_0x32691d['pTalking']+=0x1;logger[_0x8e8d('0x55')](_0x8e8d('0xae'),_0x16b0ca[_0x8e8d('0xaf')],_0x8e8d('0xb0'),_0x32691d[_0x8e8d('0x23')],_0x8e8d('0x68'),_0x32691d[_0x8e8d('0x27')]);ami[_0x8e8d('0x20')](_0x8e8d('0xb1'),ut[_0x8e8d('0xb2')](_0x16b0ca,_0x8e8d('0xb3')));if(_0x32691d[_0x8e8d('0xb4')]){ami[_0x8e8d('0x20')](_0x8e8d('0xb5'),ut[_0x8e8d('0xb6')](_0x16b0ca));}break;case'16':ami[_0x8e8d('0x20')](_0x8e8d('0xb7'),ut[_0x8e8d('0xb2')](_0x16b0ca,_0x8e8d('0xb8')));emitVoiceQueueChannelRemove(ut[_0x8e8d('0xb2')](_0x16b0ca,_0x8e8d('0xb8')));_0x32691d['outboundAnswerCallsDay']+=0x1;_0x32691d['total']+=0x1;_0x32691d[_0x8e8d('0xb9')]+=0x1;ut['decrementTalkink'](_0x32691d,'[16]');_0x16b0ca[_0x8e8d('0x9c')]=ut[_0x8e8d('0x9d')](_0x16b0ca);ut[_0x8e8d('0x88')](_0x16b0ca,0x4,_0x8e8d('0xba'));rpcDb['createCustomerHistory'](_0x16b0ca,_0x8e8d('0xbb'));rpcDb[_0x8e8d('0x90')](_0x16b0ca,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x8e8d('0xbc')](_0x16b0ca);_0x32691d[_0x8e8d('0x29')]+=_0x16b0ca[_0x8e8d('0xbd')];_0x32691d[_0x8e8d('0x28')]+=_0x16b0ca['talktime'];logger[_0x8e8d('0x55')](_0x8e8d('0xbe'),_0x16b0ca[_0x8e8d('0xaf')],_0x8e8d('0xb0'),_0x32691d['name'],'pTalking:\x20',_0x32691d[_0x8e8d('0x27')]);delete this['actions'][_0xc837a3[_0x8e8d('0xaa')]];break;case _0x8e8d('0xbf'):_0x32691d[_0x8e8d('0x37')]+=0x1;_0x16b0ca[_0x8e8d('0xc0')]+=0x1;_0x16b0ca[_0x8e8d('0x9c')]=ut[_0x8e8d('0x9d')](_0x16b0ca);ut[_0x8e8d('0x88')](_0x16b0ca,0x5,_0x8e8d('0xc1'));rpcDb[_0x8e8d('0x8f')](_0x16b0ca,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x8e8d('0x9d')](_0x16b0ca)>=_0x32691d[_0x8e8d('0xa0')]){_0x1ad67e=ut['cloneAction'](_0x16b0ca,0xf,_0x8e8d('0xa2'));rpcDb[_0x8e8d('0x90')](_0x1ad67e,_0x8e8d('0xc2'));}else{if(_0x16b0ca[_0x8e8d('0xc0')]>=_0x32691d[_0x8e8d('0xc3')]){rpcDb['createCustomerFinal'](_0x16b0ca,_0x8e8d('0xc4'));}else{rpcDb[_0x8e8d('0xa5')](ut[_0x8e8d('0xa6')](_0x16b0ca,_0x8e8d('0xc0'),_0x32691d['dialBusyRetryFrequency']),_0x16b0ca['unlockAgent'],_0x16b0ca[_0x8e8d('0xa9')]);}}break;case _0x8e8d('0xc5'):_0x32691d[_0x8e8d('0xc6')]+=0x1;_0x16b0ca['countnoanswerretry']+=0x1;_0x16b0ca[_0x8e8d('0x9c')]=ut[_0x8e8d('0x9d')](_0x16b0ca);ut[_0x8e8d('0x88')](_0x16b0ca,0x3,_0x8e8d('0xc7'));rpcDb[_0x8e8d('0x8f')](_0x16b0ca,_0x8e8d('0xc8'));if(ut['totalGlobal'](_0x16b0ca)>=_0x32691d[_0x8e8d('0xa0')]){_0x1ad67e=ut[_0x8e8d('0xa1')](_0x16b0ca,0xf,_0x8e8d('0xa2'));rpcDb[_0x8e8d('0x90')](_0x1ad67e,_0x8e8d('0xc9'));}else{if(_0x16b0ca[_0x8e8d('0xca')]>=_0x32691d[_0x8e8d('0xcb')]){rpcDb[_0x8e8d('0x90')](_0x16b0ca,_0x8e8d('0xc8'));}else{rpcDb[_0x8e8d('0xa5')](ut[_0x8e8d('0xa6')](_0x16b0ca,_0x8e8d('0xca'),_0x32691d['dialNoAnswerRetryFrequency']),_0x16b0ca['unlockAgent'],_0x16b0ca[_0x8e8d('0xa9')]);}}break;case _0x8e8d('0xcc'):_0x32691d[_0x8e8d('0x38')]+=0x1;_0x16b0ca[_0x8e8d('0xcd')]+=0x1;_0x16b0ca[_0x8e8d('0x9c')]=ut[_0x8e8d('0x9d')](_0x16b0ca);ut[_0x8e8d('0x88')](_0x16b0ca,0x8,'Congestion');rpcDb[_0x8e8d('0x8f')](_0x16b0ca,_0x8e8d('0xce'));if(ut[_0x8e8d('0x9d')](_0x16b0ca)>=_0x32691d[_0x8e8d('0xa0')]){_0x1ad67e=ut['cloneAction'](_0x16b0ca,0xf,'Global');rpcDb[_0x8e8d('0x90')](_0x1ad67e,_0x8e8d('0xcf'));}else{if(_0x16b0ca['countcongestionretry']>=_0x32691d[_0x8e8d('0xd0')]){rpcDb[_0x8e8d('0x90')](_0x16b0ca,_0x8e8d('0xce'));}else{rpcDb[_0x8e8d('0xa5')](ut['scheduledAt'](_0x16b0ca,_0x8e8d('0xcd'),_0x32691d[_0x8e8d('0xd1')]),_0x16b0ca['unlockAgent'],_0x16b0ca['activeContact']);}}break;case _0x8e8d('0xd2'):_0x32691d['outboundRejectCallsDay']+=0x1;_0x16b0ca['countagentrejectretry']+=0x1;_0x16b0ca[_0x8e8d('0x9c')]=ut[_0x8e8d('0x9d')](_0x16b0ca);ut[_0x8e8d('0x88')](_0x16b0ca,0x14,_0x8e8d('0xd3'));rpcDb['createCustomerHistory'](_0x16b0ca,'[syncHangupRequest][logAgentReject]');if(ut[_0x8e8d('0x9d')](_0x16b0ca)>=_0x32691d[_0x8e8d('0xa0')]){_0x1ad67e=ut[_0x8e8d('0xa1')](_0x16b0ca,0x14,_0x8e8d('0xd3'));rpcDb['createCustomerFinal'](_0x1ad67e,_0x8e8d('0xd4'));}else{if(_0x16b0ca[_0x8e8d('0xd5')]>=_0x32691d['dialAgentRejectMaxRetry']){rpcDb[_0x8e8d('0x90')](_0x16b0ca,_0x8e8d('0xd4'));}else{rpcDb['rescheduleContact'](ut[_0x8e8d('0xa6')](_0x16b0ca,_0x8e8d('0xd5'),_0x32691d[_0x8e8d('0xd6')]),_0x16b0ca[_0x8e8d('0xa8')],_0x16b0ca[_0x8e8d('0xa9')]);}}break;case _0x8e8d('0xd7'):_0x32691d[_0x8e8d('0xd8')]+=0x1;_0x16b0ca[_0x8e8d('0xd9')]+=0x1;_0x16b0ca[_0x8e8d('0x9c')]=ut['totalGlobal'](_0x16b0ca);ut[_0x8e8d('0x88')](_0x16b0ca,0xb,_0x8e8d('0xda'));rpcDb[_0x8e8d('0x8f')](_0x16b0ca,_0x8e8d('0xdb'));if(ut[_0x8e8d('0x9d')](_0x16b0ca)>=_0x32691d['dialGlobalMaxRetry']){_0x1ad67e=ut[_0x8e8d('0xa1')](_0x16b0ca,0xf,_0x8e8d('0xa2'));rpcDb['createCustomerFinal'](_0x1ad67e,_0x8e8d('0xdb'));}else{if(_0x16b0ca[_0x8e8d('0xdc')]>=_0x32691d['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0x16b0ca,_0x8e8d('0xdb'));}else{rpcDb['rescheduleContact'](ut[_0x8e8d('0xa6')](_0x16b0ca,_0x8e8d('0xd9'),_0x32691d[_0x8e8d('0xdd')]),_0x16b0ca[_0x8e8d('0xa8')],_0x16b0ca[_0x8e8d('0xa9')]);}}break;default:if(_0x16b0ca[_0x8e8d('0x69')]){ut['decrementTalkink'](_0x32691d,_0x8e8d('0xde'));ut['loggerError'](_0x8e8d('0xdf')+_0x32691d[_0x8e8d('0x23')],_0xc837a3);}_0x32691d[_0x8e8d('0x3e')]+=0x1;_0x16b0ca['countglobal']=ut[_0x8e8d('0x9d')](_0x16b0ca);ut[_0x8e8d('0x88')](_0x16b0ca,0xc,_0xc837a3['cause-txt']||_0xc837a3['dialstatus']);rpcDb[_0x8e8d('0x8f')](_0x16b0ca,_0x8e8d('0xe0'));if(ut[_0x8e8d('0x9d')](_0x16b0ca)>=_0x32691d[_0x8e8d('0xa0')]){_0x1ad67e=ut[_0x8e8d('0xa1')](_0x16b0ca,0xf,_0x8e8d('0xa2'));rpcDb['createCustomerFinal'](_0x1ad67e,_0x8e8d('0xe1'));}else{rpcDb[_0x8e8d('0x90')](_0x16b0ca,_0x8e8d('0xe1'));}delete this[_0x8e8d('0x63')][_0xc837a3['linkedid']];}if(!(_0x16b0ca[_0x8e8d('0x69')]&&_0xd69d3f==='16')){ut[_0x8e8d('0x73')](_0x32691d,'[callProgressDetectingCustomer]');logger[_0x8e8d('0x55')]('[originated][decrement][callProgressDetectingCustomer]',_0x16b0ca['uniqueid'],'\x20Queue',_0x32691d[_0x8e8d('0x23')],_0x8e8d('0x67'),_0x32691d[_0x8e8d('0x4a')]);}if(_0xd69d3f!==_0x8e8d('0xab')){delete this[_0x8e8d('0x63')][_0xc837a3[_0x8e8d('0xaa')]];delete this[_0x8e8d('0x63')][_0xc837a3[_0x8e8d('0xe2')]];}}};Preview[_0x8e8d('0x10')][_0x8e8d('0xe3')]=function(_0xbfdb89,_0xd3b5ef,_0x9c17e3){if(_['isUndefined'](_0xd3b5ef)&&_0x8e8d('0xe4')!==typeof _0xd3b5ef){return;}if(_[_0x8e8d('0xe5')](_0x9c17e3)&&_0x8e8d('0xe4')!==typeof _0x9c17e3){return;}switch(_0x9c17e3['reason']){case'0':ut[_0x8e8d('0xe6')](_0xbfdb89,0x0,_0x8e8d('0x9e'));rpcDb['createAgentHistory'](_0xbfdb89,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x8e8d('0xe6')](_0xbfdb89,0x3,_0x8e8d('0xc7'));rpcDb[_0x8e8d('0xe7')](_0xbfdb89,_0x8e8d('0xe8'));break;case'5':ut[_0x8e8d('0xe6')](_0xbfdb89,0x5,_0x8e8d('0xc1'));rpcDb[_0x8e8d('0xe7')](_0xbfdb89,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x8e8d('0xe6')](_0xbfdb89,0x8,'Congestion');rpcDb['createAgentHistory'](_0xbfdb89,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut['logAgent'](_0xbfdb89,0x16,_0x8e8d('0xe9'));rpcDb[_0x8e8d('0xe7')](_0xbfdb89,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x8e8d('0xe6')](_0xbfdb89,0xc,_0x9c17e3[_0x8e8d('0xea')]);rpcDb['createAgentHistory'](_0xbfdb89,'[callProgressDetectingAgent][logCongestion]');}ut[_0x8e8d('0x73')](_0xd3b5ef,_0x8e8d('0xeb'));logger[_0x8e8d('0x55')]('[originated][decrement][callProgressDetectingAgent]',_0xbfdb89[_0x8e8d('0xaf')],'\x20Queue',_0xd3b5ef[_0x8e8d('0x23')],_0x8e8d('0x67'),_0xd3b5ef[_0x8e8d('0x4a')]);delete this[_0x8e8d('0x63')][_0xbfdb89[_0x8e8d('0xaf')]];};Preview[_0x8e8d('0x10')][_0x8e8d('0xec')]=function(_0xdeade2,_0x3210e8,_0x38380e,_0x202205,_0x5d4cdd){var _0x5ad16b=this;return new BPromise(function(_0x1a83d5,_0x416580){if(_[_0x8e8d('0x7e')](_0x3210e8)||_[_0x8e8d('0x7e')](_0x3210e8[_0x8e8d('0xed')])||_[_0x8e8d('0x7e')](_0x3210e8[_0x8e8d('0xed')][_0x8e8d('0xee')])||_[_0x8e8d('0x7e')](_0x3210e8[_0x8e8d('0x6c')])){_0x416580(ut[_0x8e8d('0x49')](_0x8e8d('0xef'),_0x202205,_0x5d4cdd));return;}var _0x5d92c0=uuid['v4']();var _0x354965=_0x5ad16b[_0x8e8d('0x5e')][_0x3210e8[_0x8e8d('0x65')][_0x8e8d('0x23')]];var _0x44fd2d=_0x38380e?_0x5ad16b[_0x8e8d('0x14')][_0x38380e]['id']:undefined;_0x5ad16b[_0x8e8d('0x63')][_0x5d92c0]=new Action(_0x3210e8,_0x354965,_0x5d92c0,_0x38380e,_0x44fd2d);var _0x42b826=_0x5ad16b[_0x8e8d('0x63')][_0x5d92c0];_0x42b826[_0x8e8d('0xa8')]=_0x202205;_0x42b826[_0x8e8d('0xa9')]=_0x5d4cdd;_0x42b826[_0x8e8d('0xf0')]=_0x38380e;if(_[_0x8e8d('0xf1')](_0xdeade2)){_0x5ad16b[_0x8e8d('0xf2')](_0x42b826,_0x354965,_0x3210e8,_0x38380e)[_0x8e8d('0x7d')](function(_0x3514d8){logger[_0x8e8d('0x55')](_0x8e8d('0xf3'),_0x8e8d('0xf4')+_0x42b826[_0x8e8d('0x66')]+_0x8e8d('0xf5')+_0x42b826[_0x8e8d('0xf6')],JSON['stringify'](_0x3514d8));ami[_0x8e8d('0x20')]('custom:agentcalled',ut[_0x8e8d('0xb2')](_0x42b826,_0x8e8d('0xf7')));_0x1a83d5(ut[_0x8e8d('0x49')](_0x8e8d('0xf8')));})['catch'](function(_0x472dde){ut[_0x8e8d('0x5a')](_0x8e8d('0xf9'),_0x472dde);_0x416580(ut[_0x8e8d('0x49')](_0x8e8d('0xfa'),_0x202205,_0x5d4cdd));});}else{_0x354965[_0x8e8d('0x36')]+=0x1;ut['logBlacklist'](_0x42b826);rpcDb['createHistory'](_0x42b826,_0x8e8d('0xfb'));delete _0x5ad16b['actions'][_0x5d92c0];_0x416580(ut['message'](_0x8e8d('0xfc'),_0x202205,_0x5d4cdd));}});};Preview[_0x8e8d('0x10')]['isTrunkReachable']=function(_0x34caa9){return!_['isNil'](_0x34caa9)&&!_[_0x8e8d('0x7e')](_0x34caa9[_0x8e8d('0x23')])&&!_[_0x8e8d('0x7e')](_0x34caa9[_0x8e8d('0xfd')])&&_0x34caa9[_0x8e8d('0xfd')]&&!_[_0x8e8d('0x7e')](this['trunks'][util[_0x8e8d('0x52')]('SIP/%s',_0x34caa9[_0x8e8d('0x23')])])&&!_[_0x8e8d('0x7e')](this['trunks'][util['format'](_0x8e8d('0xfe'),_0x34caa9['name'])][_0x8e8d('0x6f')])&&(this[_0x8e8d('0x13')][util[_0x8e8d('0x52')](_0x8e8d('0xfe'),_0x34caa9['name'])][_0x8e8d('0x6f')]===_0x8e8d('0xff')||this['trunks'][util[_0x8e8d('0x52')](_0x8e8d('0xfe'),_0x34caa9[_0x8e8d('0x23')])][_0x8e8d('0x6f')]===_0x8e8d('0x100'));};Preview['prototype'][_0x8e8d('0x101')]=function(_0xd5dd1b,_0x88a6b6){var _0x402d94=this;return new BPromise(function(_0x5d041f,_0x5a0c5f){_0x402d94['execRun'](_0xd5dd1b,_0x88a6b6)[_0x8e8d('0x7d')](function(_0x5d4a7b){_0x5d041f(_[_0x8e8d('0x6a')](_0x5d4a7b,[_0x8e8d('0x49')]));})[_0x8e8d('0x71')](function(_0x3c2d56){if(_0x3c2d56[_0x8e8d('0x102')]){rpcDb['unlockContact'](_0xd5dd1b);}if(_0x3c2d56[_0x8e8d('0xfd')]){rpcDb[_0x8e8d('0x85')](_0xd5dd1b);}_0x5a0c5f(_[_0x8e8d('0x6a')](_0x3c2d56,[_0x8e8d('0x49')]));});});};Preview['prototype']['execRun']=function(_0x42bd8e,_0x7eb5c){var _0x4dcf73=this;return new BPromise(function(_0x11128f,_0x5eea1b){var _0x3c754b,_0x151feb;rpcDb[_0x8e8d('0x103')](_0x42bd8e)['then'](function(_0x438701){if(!_['isNil'](_0x438701[0x0])){_0x151feb=_0x438701[0x0][_0x8e8d('0x104')]?![]:!![];_0x3c754b=_0x438701[0x0][_0x8e8d('0x104')]?!![]:![];_0x3c754b=_0x7eb5c?!![]:_0x3c754b;}var _0x3bcb97=_0x4dcf73[_0x8e8d('0x105')](_0x438701);if(_0x3bcb97[_0x8e8d('0x106')]){rpcDb[_0x8e8d('0x107')](_[_0x8e8d('0x6a')](_0x438701[0x0],[_0x8e8d('0x6c'),'Contact.phone']))[_0x8e8d('0x7d')](function(_0x339828){_0x4dcf73[_0x8e8d('0xec')](_0x339828,_0x438701[0x0],_0x7eb5c,_0x151feb,_0x3c754b)['then'](function(_0x3ec673){_0x11128f(_0x3ec673);})[_0x8e8d('0x71')](function(_0x3866b4){_0x5eea1b(_0x3866b4);});})[_0x8e8d('0x71')](function(_0x33eeab){ut['logger'](_0x8e8d('0x108'),_0x33eeab);_0x5eea1b(ut['message']('Call\x20unsuccessful',_0x151feb,_0x3c754b));});}else{_0x5eea1b(ut[_0x8e8d('0x49')](_0x3bcb97[_0x8e8d('0x49')],_0x151feb,_0x3c754b));}})[_0x8e8d('0x71')](function(_0x191cee){ut[_0x8e8d('0x5a')]('[Preview][getContactPreview]',_0x191cee);_0x5eea1b(ut[_0x8e8d('0x49')](_0x8e8d('0x109'),![],!![]));});});};Preview['prototype'][_0x8e8d('0x105')]=function(_0x205bd4){if(_[_0x8e8d('0x7e')](_0x205bd4)||_[_0x8e8d('0xf1')](_0x205bd4)||!_[_0x8e8d('0x7e')](_0x205bd4[0x0][_0x8e8d('0x81')])&&_['isNil'](_0x205bd4[0x0]['Agent'][_0x8e8d('0x23')])){ut[_0x8e8d('0x5a')]('[Preview][validateContact][Empty\x20Contact]',_0x205bd4);return{'isValid':![],'message':_0x8e8d('0x10a')};}var _0x425679=this[_0x8e8d('0x5e')][_0x205bd4[0x0][_0x8e8d('0x65')][_0x8e8d('0x23')]];_0x425679[_0x8e8d('0x49')]=_0x8e8d('0x10b');if(_[_0x8e8d('0x7e')](_0x425679)){ut[_0x8e8d('0x5a')](_0x8e8d('0x10c'),_0x425679);return{'isValid':![],'message':_0x8e8d('0x10d')};}if(!this[_0x8e8d('0x97')](_0x425679[_0x8e8d('0x4e')])){ut['logger'](_0x8e8d('0x10e'),_0x8e8d('0x10f')+_0x425679[_0x8e8d('0x23')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x8e8d('0x97')](_0x425679[_0x8e8d('0x98')])){ut[_0x8e8d('0x5a')](_0x8e8d('0x10e'),_0x425679['name']+_0x8e8d('0x110'));return{'isValid':![],'message':_0x8e8d('0x111')};}}if(!ut['isActive'](_0x425679[_0x8e8d('0x2f')])){ut['logger'](_0x8e8d('0x112'),_0x425679[_0x8e8d('0x23')]+_0x8e8d('0x113'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x425679[_0x8e8d('0x23')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x8e8d('0x114')};};Preview[_0x8e8d('0x10')]['execCall']=function(_0x4f59a3,_0x226ae0,_0x530467,_0x3ffc8e){var _0x314686=this;return new BPromise(function(_0x58dfb4,_0x3eab3f){var _0x10b54a=_0x4f59a3['uniqueid'];var _0x5b1e73=_0x314686['isTrunkReachable'](_0x226ae0['Trunk'])?util[_0x8e8d('0x52')](_0x8e8d('0x115'),_0x226ae0[_0x8e8d('0x4e')][_0x8e8d('0x23')],_[_0x8e8d('0x7e')](_0x226ae0[_0x8e8d('0x116')])?'':_0x226ae0[_0x8e8d('0x116')][_0x8e8d('0x117')]()||'',_0x226ae0['dialCutDigit']>0x0?_0x530467[_0x8e8d('0xed')][_0x8e8d('0xee')]['substring'](_0x226ae0[_0x8e8d('0x118')]):_0x530467[_0x8e8d('0xed')]['phone']):util[_0x8e8d('0x52')](_0x8e8d('0x115'),_[_0x8e8d('0x7e')](_0x226ae0[_0x8e8d('0x98')])?_0x226ae0[_0x8e8d('0x4e')][_0x8e8d('0x23')]:_0x226ae0['TrunkBackup'][_0x8e8d('0x23')],_['isNil'](_0x226ae0[_0x8e8d('0x116')])?'':_0x226ae0[_0x8e8d('0x116')][_0x8e8d('0x117')]()||'',_0x226ae0[_0x8e8d('0x118')]>0x0?_0x530467['Contact'][_0x8e8d('0xee')][_0x8e8d('0x119')](_0x226ae0[_0x8e8d('0x118')]):_0x530467['Contact'][_0x8e8d('0xee')]);var _0x5eba38=_0x314686[_0x8e8d('0x97')](_0x226ae0[_0x8e8d('0x4e')])?ut[_0x8e8d('0x11a')](_0x226ae0[_0x8e8d('0x4e')][_0x8e8d('0x4f')],_0x226ae0[_0x8e8d('0x31')],_0x226ae0[_0x8e8d('0x11b')]>0x0?ut[_0x8e8d('0x11c')](_0x226ae0[_0x8e8d('0x32')],_0x226ae0[_0x8e8d('0x11b')]):_0x226ae0[_0x8e8d('0x32')]):ut[_0x8e8d('0x11a')](_[_0x8e8d('0x7e')](_0x226ae0[_0x8e8d('0x98')])?_0x226ae0[_0x8e8d('0x4e')]['callerid']:_0x226ae0[_0x8e8d('0x98')]['callerid'],_0x226ae0[_0x8e8d('0x31')],_0x226ae0[_0x8e8d('0x11b')]>0x0?ut[_0x8e8d('0x11c')](_0x226ae0[_0x8e8d('0x32')],_0x226ae0[_0x8e8d('0x11b')]):_0x226ae0['dialOriginateCallerIdNumber']);if(_0x5eba38){_0x4f59a3['originatecalleridname']=ut['extractCalleridName'](_0x5eba38);_0x4f59a3['originatecalleridnum']=ut[_0x8e8d('0x11d')](_0x5eba38);}var _0x2f2104=ut['addVariables'](_0x226ae0,_0x530467,_0x5b1e73,_0x5eba38,_0x10b54a,_0x4f59a3);_[_0x8e8d('0x11e')](_0x4f59a3,ut[_0x8e8d('0x11f')](_0x2f2104));_0x4f59a3['starttime']=moment()['format'](_0x8e8d('0x86'));ami[_0x8e8d('0x6e')](ut[_0x8e8d('0x120')](_0x4f59a3,_0x226ae0,_0x2f2104,_0x4f59a3[_0x8e8d('0xa9')],_0x3ffc8e))[_0x8e8d('0x7d')](function(_0x252a0a){_0x226ae0['originated']+=0x1;logger['info'](_0x8e8d('0x121'),_0x10b54a,_0x8e8d('0xb0'),_0x226ae0[_0x8e8d('0x23')],_0x8e8d('0x67'),_0x226ae0[_0x8e8d('0x4a')]);_0x58dfb4(_0x252a0a);})['catch'](function(_0x254038){ut[_0x8e8d('0xe6')](_0x4f59a3,0xe,_0x8e8d('0x122'));rpcDb['createAgentHistory'](_0x4f59a3,_0x8e8d('0x123'));_0x3eab3f(_0x254038);});});};Preview[_0x8e8d('0x10')]['syncNewExten']=function(_0x32d5ce){if(this['actions'][_0x32d5ce['linkedid']]){this['actions'][_0x32d5ce[_0x8e8d('0xaa')]]['channel']=_0x32d5ce[_0x8e8d('0x70')];}};Preview[_0x8e8d('0x10')]['syncOriginateResponse']=function(_0x502aea){var _0x7b18f7=this;var _0x252d24=this[_0x8e8d('0x63')][_0x502aea[_0x8e8d('0x124')]];if(_0x252d24){if(_0x252d24[_0x8e8d('0xf0')]&&this[_0x8e8d('0x14')][_0x252d24[_0x8e8d('0xf0')]]){ut[_0x8e8d('0x125')](_0x252d24,this[_0x8e8d('0x14')][_0x252d24['lookAgent']]['name'],this[_0x8e8d('0x14')][_0x252d24['lookAgent']]['id']);}var _0x29c6a1=_['clone'](_0x252d24);_0x29c6a1[_0x8e8d('0xac')]=moment()['format'](_0x8e8d('0x86'));var _0xec9c4a=_0x7b18f7[_0x8e8d('0x5e')][_0x252d24[_0x8e8d('0x66')]];if(ut[_0x8e8d('0x126')](_0x502aea[_0x8e8d('0x127')])){if(_0x252d24[_0x8e8d('0xa8')]){rpcDb['unlockContact'](_0x252d24['idContact']);}if(_0x252d24['activeContact']){rpcDb[_0x8e8d('0x85')](_0x252d24[_0x8e8d('0xf6')]);}ami[_0x8e8d('0x20')]('custom:agentringnoanswer',ut[_0x8e8d('0xb2')](_0x252d24,_0x8e8d('0x128')));this[_0x8e8d('0xe3')](_0x29c6a1,_0xec9c4a,_0x502aea);}else{_0x252d24[_0x8e8d('0x129')]=moment()[_0x8e8d('0x52')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x29c6a1,0x4,_0x8e8d('0xba'));rpcDb[_0x8e8d('0xe7')](_0x29c6a1,_0x8e8d('0x12a'));}}};Preview[_0x8e8d('0x10')]['syncHangup']=function(_0x2496d3){var _0x30d464=this;var _0x25b127=this[_0x8e8d('0x63')][_0x2496d3[_0x8e8d('0xaa')]];var _0x5256b4;if(_0x25b127){_0x5256b4=this[_0x8e8d('0x5e')][_0x25b127[_0x8e8d('0x66')]];logger[_0x8e8d('0x55')](_0x8e8d('0x12b'),_0x2496d3[_0x8e8d('0xaa')],'\x20Queue',_0x5256b4[_0x8e8d('0x23')],_0x8e8d('0x68'),_0x5256b4[_0x8e8d('0x27')]);}if(this[_0x8e8d('0x63')][_0x2496d3[_0x8e8d('0xaa')]]&&_0x2496d3[_0x8e8d('0xaa')]!==_0x2496d3['uniqueid']){if(_0x2496d3[_0x8e8d('0x12c')]==='16'&&this[_0x8e8d('0x63')][_0x2496d3['linkedid']][_0x8e8d('0x69')]){this[_0x8e8d('0x9a')](_0x2496d3,_0x2496d3[_0x8e8d('0xaa')],_0x2496d3[_0x8e8d('0x12c')]);}else if(this[_0x8e8d('0x63')][_0x2496d3[_0x8e8d('0xaa')]]['dialAnswer']){logger['info'](_0x8e8d('0x12d'),_0x2496d3[_0x8e8d('0xaa')],_0x2496d3[_0x8e8d('0x12c')],_0x8e8d('0xb0'),_0x5256b4[_0x8e8d('0x23')],_0x8e8d('0x68'),_0x5256b4[_0x8e8d('0x27')]);this[_0x8e8d('0x9a')](_0x2496d3,_0x2496d3[_0x8e8d('0xaa')],_0x2496d3[_0x8e8d('0x12c')]);}}else if(_0x25b127&&_[_0x8e8d('0x7e')](_0x25b127[_0x8e8d('0x12e')])&&_0x5256b4[_0x8e8d('0x12f')]&&_0x2496d3[_0x8e8d('0xaa')]===_0x2496d3[_0x8e8d('0xaf')]&&_['isNil'](_0x2496d3['reason'])&&_0x2496d3[_0x8e8d('0x12c')]==='16'&&_0x2496d3['channelstate']==='6'&&_[_0x8e8d('0xe5')](_0x25b127['transfer'])){if(_0x25b127[_0x8e8d('0xa8')]){rpcDb['unlockContact'](_0x25b127[_0x8e8d('0xf6')]);}if(_0x25b127[_0x8e8d('0xa9')]){rpcDb[_0x8e8d('0x85')](_0x25b127[_0x8e8d('0xf6')]);}_0x2496d3[_0x8e8d('0xea')]='22';this[_0x8e8d('0xe3')](_0x25b127,_0x5256b4,_0x2496d3);}else if(_0x25b127&&_0x25b127[_0x8e8d('0x130')]){if(_0x2496d3['cause']==='16'&&this[_0x8e8d('0x63')][_0x2496d3[_0x8e8d('0xaa')]][_0x8e8d('0x69')]){logger[_0x8e8d('0x55')]('[syncHangup][talking][transfer]',_0x2496d3[_0x8e8d('0xaa')],_0x2496d3[_0x8e8d('0x12c')],'\x20Queue',_0x5256b4[_0x8e8d('0x23')],_0x8e8d('0x68'),_0x5256b4[_0x8e8d('0x27')]);this['callProgressDetectingCustomer'](_0x2496d3,_0x2496d3[_0x8e8d('0xaa')],_0x2496d3[_0x8e8d('0x12c')]);}else if(this[_0x8e8d('0x63')][_0x2496d3[_0x8e8d('0xaa')]]['dialAnswer']){logger[_0x8e8d('0x55')](_0x8e8d('0x12d'),_0x2496d3[_0x8e8d('0xaa')],_0x2496d3[_0x8e8d('0x12c')],_0x8e8d('0xb0'),_0x5256b4[_0x8e8d('0x23')],_0x8e8d('0x68'),_0x5256b4['pTalking']);this[_0x8e8d('0x9a')](_0x2496d3,_0x2496d3[_0x8e8d('0xaa')],_0x2496d3['cause']);}}};Preview['prototype'][_0x8e8d('0x1c')]=function(_0xfa2717){if(this[_0x8e8d('0x63')][_0xfa2717[_0x8e8d('0xe2')]]&&_0xfa2717[_0x8e8d('0xe2')]!==_0xfa2717[_0x8e8d('0x131')]){this[_0x8e8d('0x9a')](_0xfa2717,_0xfa2717[_0x8e8d('0xe2')],_0xfa2717[_0x8e8d('0x132')]);}};Preview[_0x8e8d('0x10')][_0x8e8d('0x1a')]=function(_0x300dbe){if(this[_0x8e8d('0x63')][_0x300dbe[_0x8e8d('0xaa')]]&&_0x300dbe[_0x8e8d('0xaa')]!==_0x300dbe[_0x8e8d('0xaf')]&&!this['actions'][_0x300dbe[_0x8e8d('0xaa')]][_0x8e8d('0x69')]){if(_0x300dbe['cause']==='1'){this[_0x8e8d('0x9a')](_0x300dbe,_0x300dbe['linkedid'],_0x300dbe[_0x8e8d('0x12c')]);}}};Preview[_0x8e8d('0x10')][_0x8e8d('0x133')]=function(_0x41a467,_0x3de8e1,_0x24d1cf){if(this[_0x8e8d('0x63')][_0x41a467]){if(_[_0x8e8d('0x7e')](this[_0x8e8d('0x63')][_0x41a467][_0x8e8d('0x134')])){this['actions'][_0x41a467]['variables']={};}this[_0x8e8d('0x63')][_0x41a467][_0x8e8d('0x134')][_0x3de8e1]=_0x24d1cf;}};Preview[_0x8e8d('0x10')]['syncVarSet']=function(_0x19b44e){try{if(!_['isNil'](_0x19b44e)){if(ut[_0x8e8d('0x135')](_[_0x8e8d('0x136')](_0x19b44e[_0x8e8d('0x137')])[0x0])){this[_0x8e8d('0x133')](_0x19b44e['uniqueid'],_['keys'](_0x19b44e[_0x8e8d('0x137')])[0x0],_0x19b44e[_0x8e8d('0x138')]);}}}catch(_0x282ccf){logger['error']('[syncVarSet][Preview]',util[_0x8e8d('0x139')](_0x282ccf,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x8e8d('0x1e')]=function(_0x4f8d71){if(_0x4f8d71){if(this[_0x8e8d('0x63')][_0x4f8d71[_0x8e8d('0x13a')]]){this['actions'][_0x4f8d71[_0x8e8d('0x13a')]][_0x8e8d('0x130')]=!![];}}};Preview[_0x8e8d('0x10')][_0x8e8d('0x1f')]=function(_0x5dbd1e){if(_0x5dbd1e){if(this[_0x8e8d('0x63')][_0x5dbd1e[_0x8e8d('0x13b')]]){this['actions'][_0x5dbd1e[_0x8e8d('0x13b')]][_0x8e8d('0x130')]=!![];}}};module[_0x8e8d('0x13c')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index e41a120..2b85a4e 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 _0x33c5=['../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory'];(function(_0x3f9dff,_0x5e4cae){var _0x78b8f3=function(_0x2d059e){while(--_0x2d059e){_0x3f9dff['push'](_0x3f9dff['shift']());}};_0x78b8f3(++_0x5e4cae);}(_0x33c5,0xe6));var _0x533c=function(_0xa76664,_0x5e32db){_0xa76664=_0xa76664-0x0;var _0x3f7743=_0x33c5[_0xa76664];return _0x3f7743;};'use strict';var util=require('util');var BPromise=require(_0x533c('0x0'));var logger=require(_0x533c('0x1'))('preview');var _=require(_0x533c('0x2'));var cmHopper=require(_0x533c('0x3'));var cmHopperFinal=require(_0x533c('0x4'));var cmHopperHistory=require(_0x533c('0x5'));var cmHopperBlack=require(_0x533c('0x6'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x533c('0x7'));var voiceQueueReport=require(_0x533c('0x8'));function loggerCatch(_0x31d912){return function(_0x151732){logger[_0x533c('0x9')](_0x31d912,util[_0x533c('0xa')](_0x151732,{'showHidden':![],'depth':null}));};}function create(_0x3a009b){return BPromise[_0x533c('0xb')]()[_0x533c('0xc')](cmHopperHistory[_0x533c('0xd')](_0x3a009b))[_0x533c('0xe')](loggerCatch(_0x533c('0xf')));}function createAgent(_0x2c0214){return BPromise[_0x533c('0xb')]()[_0x533c('0xc')](agentReportPreview[_0x533c('0xd')](_0x2c0214))['catch'](loggerCatch(_0x533c('0xf')));}function moveContact(_0x28ffd2){return BPromise[_0x533c('0xb')]()[_0x533c('0xc')](cmHopper[_0x533c('0x10')](_0x28ffd2,!![]))[_0x533c('0xe')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x533c('0x11')]=function(_0xf93007){return BPromise[_0x533c('0xb')]()[_0x533c('0xc')](cmHopperBlack[_0x533c('0x11')](_0xf93007))[_0x533c('0xe')](loggerCatch(_0x533c('0x12')));};exports[_0x533c('0x13')]=function(_0x59298d){return BPromise[_0x533c('0xb')]()[_0x533c('0xc')](cmHopper[_0x533c('0x13')](_0x59298d))[_0x533c('0xe')](loggerCatch('[getContactPreview]\x20'));};exports[_0x533c('0xd')]=function(_0x1ed6ba,_0x41e22c){create(_0x1ed6ba)[_0x533c('0xe')](loggerCatch(_0x41e22c));moveContact(_0x1ed6ba)[_0x533c('0xe')](loggerCatch(_0x41e22c));};exports[_0x533c('0x14')]=function(_0x1f0a72,_0x35bfd3){createAgent(_0x1f0a72)[_0x533c('0xe')](loggerCatch(_0x35bfd3));};exports[_0x533c('0x15')]=function(_0x287b9e,_0x2c41e9){create(_0x287b9e)[_0x533c('0xe')](loggerCatch(_0x2c41e9));};exports[_0x533c('0x16')]=function(_0x2f21db,_0x3de9fa){moveContact(_0x2f21db)[_0x533c('0xe')](loggerCatch(_0x3de9fa));};exports[_0x533c('0x17')]=function(_0x4ba0bd,_0xce8d9,_0x51785c){if(_0xce8d9){_0x4ba0bd['UserId']=null;}if(_0x51785c){_0x4ba0bd[_0x533c('0x18')]=![];}return BPromise[_0x533c('0xb')]()['then'](cmHopper[_0x533c('0x17')](_0x4ba0bd))[_0x533c('0xe')](loggerCatch(_0x533c('0x19')));};exports[_0x533c('0x1a')]=function(_0x5ebbe0){return BPromise[_0x533c('0xb')]()[_0x533c('0xc')](cmHopper[_0x533c('0x1a')](_0x5ebbe0))[_0x533c('0xe')](loggerCatch(_0x533c('0x1b')));};exports[_0x533c('0x1c')]=function(_0xb51a5){return BPromise[_0x533c('0xb')]()[_0x533c('0xc')](cmHopper[_0x533c('0x1c')]({'UserId':null},_0xb51a5,0x1))['catch'](loggerCatch(_0x533c('0x1d')));};exports[_0x533c('0x1e')]=function(_0x503c2e){return BPromise[_0x533c('0xb')]()['then'](cmHopper[_0x533c('0x1c')]({'active':![]},_0x503c2e,0x1))[_0x533c('0xe')](loggerCatch(_0x533c('0x1f')));};exports[_0x533c('0x20')]=function(_0x425f60){var _0x146a8e={};_0x146a8e[_0x533c('0x21')]=_0x425f60[_0x533c('0x21')];_0x146a8e[_0x533c('0x22')]=_0x425f60[_0x533c('0x22')];_0x146a8e[_0x533c('0x23')]=_0x425f60[_0x533c('0x23')];_0x146a8e['calleridname']=_0x425f60[_0x533c('0x24')];_0x146a8e['queue']=_0x425f60[_0x533c('0x25')];_0x146a8e[_0x533c('0x26')]=_0x425f60[_0x533c('0x27')];_0x146a8e[_0x533c('0x28')]=_0x425f60[_0x533c('0x27')];_0x146a8e[_0x533c('0x29')]=0x1;_0x146a8e[_0x533c('0x2a')]=_0x425f60[_0x533c('0x2b')];_0x146a8e[_0x533c('0x2c')]=_0x425f60[_0x533c('0x2d')];_0x146a8e[_0x533c('0x2e')]=_0x533c('0x2f');_0x146a8e[_0x533c('0x30')]=_0x533c('0x31');_0x146a8e[_0x533c('0x32')]=0x0;_0x146a8e['assigned']=0x1;_0x146a8e[_0x533c('0x33')]=_0x425f60[_0x533c('0x2d')];_0x146a8e[_0x533c('0x34')]=_0x533c('0x35');return BPromise['resolve']()[_0x533c('0xc')](voiceQueueReport[_0x533c('0x36')](_0x146a8e))[_0x533c('0xe')](loggerCatch(_0x533c('0x37')));};exports[_0x533c('0x38')]=function(_0x56e0f0,_0x5a006c){return BPromise['resolve']()['then'](cmHopper['getContactRecallMe'](_0x56e0f0,_0x5a006c))[_0x533c('0xe')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x533c('0x39')]=function(_0x55726a){return BPromise[_0x533c('0xb')]()[_0x533c('0xc')](cmHopper[_0x533c('0x17')](_0x55726a,!![],!![]))['catch'](loggerCatch(_0x533c('0x3a')));}; \ No newline at end of file +var _0x207c=['checkIsBlackList','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','error','inspect','resolve','then','createHistory','[createHistory]\x20','catch','[moveContactManagedDialer]\x20'];(function(_0x520095,_0x411ddb){var _0xb895f3=function(_0x1b83e8){while(--_0x1b83e8){_0x520095['push'](_0x520095['shift']());}};_0xb895f3(++_0x411ddb);}(_0x207c,0x1e8));var _0xc207=function(_0x5bf420,_0x2d068d){_0x5bf420=_0x5bf420-0x0;var _0x1c5255=_0x207c[_0x5bf420];return _0x1c5255;};'use strict';var util=require('util');var BPromise=require(_0xc207('0x0'));var logger=require(_0xc207('0x1'))(_0xc207('0x2'));var _=require(_0xc207('0x3'));var cmHopper=require(_0xc207('0x4'));var cmHopperFinal=require(_0xc207('0x5'));var cmHopperHistory=require(_0xc207('0x6'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xc207('0x7'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x55023e){return function(_0xc88789){logger[_0xc207('0x8')](_0x55023e,util[_0xc207('0x9')](_0xc88789,{'showHidden':![],'depth':null}));};}function create(_0x59ff6f){return BPromise[_0xc207('0xa')]()[_0xc207('0xb')](cmHopperHistory[_0xc207('0xc')](_0x59ff6f))['catch'](loggerCatch(_0xc207('0xd')));}function createAgent(_0x817576){return BPromise[_0xc207('0xa')]()[_0xc207('0xb')](agentReportPreview[_0xc207('0xc')](_0x817576))[_0xc207('0xe')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x574425){return BPromise['resolve']()[_0xc207('0xb')](cmHopper['moveContactManagedDialer'](_0x574425,!![]))[_0xc207('0xe')](loggerCatch(_0xc207('0xf')));}exports['checkIsBlackList']=function(_0x3e1108){return BPromise[_0xc207('0xa')]()[_0xc207('0xb')](cmHopperBlack[_0xc207('0x10')](_0x3e1108))[_0xc207('0xe')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xc207('0x11')]=function(_0x3c77b7){return BPromise[_0xc207('0xa')]()[_0xc207('0xb')](cmHopper['getContactPreview'](_0x3c77b7))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0xc207('0xc')]=function(_0x6e793d,_0x3d9c7b){create(_0x6e793d)[_0xc207('0xe')](loggerCatch(_0x3d9c7b));moveContact(_0x6e793d)['catch'](loggerCatch(_0x3d9c7b));};exports[_0xc207('0x12')]=function(_0x282595,_0x217d5e){createAgent(_0x282595)['catch'](loggerCatch(_0x217d5e));};exports[_0xc207('0x13')]=function(_0x488cc0,_0x42c8ba){create(_0x488cc0)[_0xc207('0xe')](loggerCatch(_0x42c8ba));};exports[_0xc207('0x14')]=function(_0x461f6a,_0xce0770){moveContact(_0x461f6a)[_0xc207('0xe')](loggerCatch(_0xce0770));};exports[_0xc207('0x15')]=function(_0x464dea,_0x212005,_0x2bd2eb){if(_0x212005){_0x464dea[_0xc207('0x16')]=null;}if(_0x2bd2eb){_0x464dea[_0xc207('0x17')]=![];}return BPromise[_0xc207('0xa')]()['then'](cmHopper[_0xc207('0x15')](_0x464dea))['catch'](loggerCatch(_0xc207('0x18')));};exports[_0xc207('0x19')]=function(_0x1eabe8){return BPromise[_0xc207('0xa')]()[_0xc207('0xb')](cmHopper[_0xc207('0x19')](_0x1eabe8))[_0xc207('0xe')](loggerCatch(_0xc207('0x1a')));};exports[_0xc207('0x1b')]=function(_0x2385f7){return BPromise[_0xc207('0xa')]()[_0xc207('0xb')](cmHopper[_0xc207('0x1b')]({'UserId':null},_0x2385f7,0x1))[_0xc207('0xe')](loggerCatch(_0xc207('0x1c')));};exports['disableContact']=function(_0x1e1440){return BPromise['resolve']()['then'](cmHopper[_0xc207('0x1b')]({'active':![]},_0x1e1440,0x1))[_0xc207('0xe')](loggerCatch(_0xc207('0x1d')));};exports[_0xc207('0x1e')]=function(_0x6a653d){var _0x478af7={};_0x478af7[_0xc207('0x1f')]=_0x6a653d[_0xc207('0x1f')];_0x478af7[_0xc207('0x20')]=_0x6a653d[_0xc207('0x20')];_0x478af7[_0xc207('0x21')]=_0x6a653d[_0xc207('0x21')];_0x478af7[_0xc207('0x22')]=_0x6a653d[_0xc207('0x22')];_0x478af7[_0xc207('0x23')]=_0x6a653d[_0xc207('0x23')];_0x478af7[_0xc207('0x24')]=_0x6a653d[_0xc207('0x25')];_0x478af7[_0xc207('0x26')]=_0x6a653d['answertime'];_0x478af7[_0xc207('0x27')]=0x1;_0x478af7[_0xc207('0x28')]=_0x6a653d[_0xc207('0x29')];_0x478af7[_0xc207('0x2a')]=_0x6a653d[_0xc207('0x2b')];_0x478af7[_0xc207('0x2c')]='from-sip';_0x478af7[_0xc207('0x2d')]=_0xc207('0x2e');_0x478af7[_0xc207('0x2f')]=0x0;_0x478af7[_0xc207('0x30')]=0x1;_0x478af7['lastAssignedTo']=_0x6a653d[_0xc207('0x2b')];_0x478af7[_0xc207('0x31')]=_0xc207('0x32');return BPromise[_0xc207('0xa')]()[_0xc207('0xb')](voiceQueueReport[_0xc207('0x33')](_0x478af7))[_0xc207('0xe')](loggerCatch(_0xc207('0x34')));};exports[_0xc207('0x35')]=function(_0x557d5d,_0x48d8a4){return BPromise[_0xc207('0xa')]()[_0xc207('0xb')](cmHopper[_0xc207('0x35')](_0x557d5d,_0x48d8a4))[_0xc207('0xe')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xc207('0x36')]=function(_0x433c0f){return BPromise[_0xc207('0xa')]()[_0xc207('0xb')](cmHopper[_0xc207('0x15')](_0x433c0f,!![],!![]))['catch'](loggerCatch(_0xc207('0x37')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index ff35508..c78313f 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 _0xf4ac=['talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','interface','buildAcw','not_inuse','push','createBody','CampaignId','idContact','queue','campaigntype','dialAnswer','calleridnum','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepeer','bridgepvtcallid','getCallerIdRandom','random','extractCalleridNumber','match','util','lodash','moment','XCALLY_IP_AGI','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','createdAt','XMD-','toUpper','toLowerVariables','hasOwnProperty','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','endtime','responsetime','ringtime','logLookAgent','membername','UserId','logCustomer'];(function(_0x57cbfb,_0x2de760){var _0x4cb933=function(_0x33cf6a){while(--_0x33cf6a){_0x57cbfb['push'](_0x57cbfb['shift']());}};_0x4cb933(++_0x2de760);}(_0xf4ac,0xd0));var _0xcf4a=function(_0x255efc,_0x555b71){_0x255efc=_0x255efc-0x0;var _0x401a08=_0xf4ac[_0x255efc];return _0x401a08;};'use strict';var util=require(_0xcf4a('0x0'));var _=require(_0xcf4a('0x1'));var moment=require(_0xcf4a('0x2'));var logger=require('../../../../config/logger')('preview');var ipAgi=process['env'][_0xcf4a('0x3')]||'127.0.0.1';function getSeconds(_0x2c2bf2,_0x337e92){var _0x325127=moment(_0x2c2bf2)[_0xcf4a('0x4')](0x0);var _0x104d9a=moment(_0x337e92)[_0xcf4a('0x4')](0x0);return _0x325127[_0xcf4a('0x5')](_0x104d9a,_0xcf4a('0x6'));}exports[_0xcf4a('0x7')]=function(_0x471704){return function(_0x4deea6){logger[_0xcf4a('0x8')](_0x471704,util[_0xcf4a('0x9')](_0x4deea6,{'showHidden':![],'depth':null}));};};exports[_0xcf4a('0xa')]=function(_0x490fb1,_0x370e17){logger[_0xcf4a('0xb')](_0x490fb1,util['inspect'](_0x370e17,{'showHidden':![],'depth':null}));};exports[_0xcf4a('0xc')]=function(_0x5dd60c,_0x213ba3){logger[_0xcf4a('0x8')](_0x5dd60c,util[_0xcf4a('0x9')](_0x213ba3,{'showHidden':![],'depth':null}));};exports[_0xcf4a('0xd')]=function(_0x4f8b79){return function(_0xd09c2){logger['info'](_0x4f8b79,util['inspect'](_0xd09c2,{'showHidden':![],'depth':null}));};};exports[_0xcf4a('0xe')]=function(_0x5d0dc9,_0x1179ab,_0x1c62d1){return{'message':_0x5d0dc9,'unlock':_0x1179ab,'active':_0x1c62d1};};exports[_0xcf4a('0xf')]=function(_0x2b8d8d,_0x47bd42,_0x40a8ae){if(!_[_0xcf4a('0x10')](_0x40a8ae)&&_0xcf4a('0x11')===typeof _0x40a8ae&&!_[_0xcf4a('0x12')](_0x40a8ae)){if(!_[_0xcf4a('0x10')](_0x47bd42)&&_0xcf4a('0x11')===typeof _0x47bd42&&!_[_0xcf4a('0x12')](_0x47bd42)){return util['format'](_0xcf4a('0x13'),_0x47bd42,_0x40a8ae);}return util[_0xcf4a('0x14')](_0xcf4a('0x13'),_0x40a8ae,_0x40a8ae);}if(!_[_0xcf4a('0x10')](_0x2b8d8d)&&_0xcf4a('0x11')===typeof _0x2b8d8d&&!_[_0xcf4a('0x12')](_0x2b8d8d)){return _0x2b8d8d;}return _0xcf4a('0x15');};exports[_0xcf4a('0x16')]=function(_0x226239){if(_[_0xcf4a('0x17')](_0x226239)){return![];}return _0x226239;};exports['addVariables']=function(_0x49e0ea,_0x71af90,_0x6ded51,_0x4e1a94,_0x30cddf,_0x223ac1){var _0x514654={'XMD-QUEUE':_0x71af90[_0xcf4a('0x18')]?_0x71af90['Queue'][_0xcf4a('0x19')]:'','XMD-CALLERID':_0x4e1a94,'XMD-CALLERID-PREVIEW':_0x223ac1?util[_0xcf4a('0x14')](_0xcf4a('0x13'),_0x223ac1[_0xcf4a('0x1a')],_0x223ac1['calleridnum']):_0x4e1a94,'XMD-DIALID':_0x30cddf,'XMD-CONTACTID':_0x71af90[_0xcf4a('0x1b')],'XMD-CDRTYPE':_0xcf4a('0x1c'),'CALLERID(all)':_0x4e1a94,'XMD-VOICEQUEUEID':_0x71af90[_0xcf4a('0x1d')],'XMD-DIALCHANNEL':_0x6ded51,'XMD-DIALTIMEOUT':_0x49e0ea[_0xcf4a('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0xcf4a('0x14')]('\x22rtTxX%s%s\x22',_0x49e0ea['dialQueueProject2']?'g':'',_['isEmpty'](_0x49e0ea['monitor_format'])?'':_0xcf4a('0x1f')),'XMD-DIALURL':_0x49e0ea['dialPreviewUrl']||'','XMD-AGI':_0x49e0ea[_0xcf4a('0x20')]?util[_0xcf4a('0x14')](_0xcf4a('0x21'),ipAgi,_0x49e0ea[_0xcf4a('0x20')]):_0xcf4a('0x22'),'XMD-AGIAFTER':_0x49e0ea[_0xcf4a('0x23')]?util[_0xcf4a('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x49e0ea[_0xcf4a('0x23')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x223ac1?_0x223ac1[_0xcf4a('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x223ac1?_0x223ac1[_0xcf4a('0x25')]:'','XMD-DESTINATION':_0xcf4a('0x26')};if(!_[_0xcf4a('0x12')](_0x49e0ea[_0xcf4a('0x27')])){_0x514654[util[_0xcf4a('0x14')]('%s',_0xcf4a('0x28'))]=_0x49e0ea[_0xcf4a('0x27')];_0x514654[util[_0xcf4a('0x14')]('%s',_0xcf4a('0x29'))]=_0x30cddf;}if(_0x71af90&&_0x71af90[_0xcf4a('0x2a')]){for(var _0x2bb592 in _0x71af90['Contact']){if(_0x71af90[_0xcf4a('0x2a')]['hasOwnProperty'](_0x2bb592)){if(!_['isNil'](_0x71af90[_0xcf4a('0x2a')][_0x2bb592])&&_0x2bb592!=='id'&&_0x2bb592!=='tags'&&_0x2bb592!==_0xcf4a('0x2b')&&_0x2bb592!=='updatedAt'){_0x514654[util[_0xcf4a('0x14')]('%s%s',_0xcf4a('0x2c'),_[_0xcf4a('0x2d')](_0x2bb592))]=_0x71af90[_0xcf4a('0x2a')][_0x2bb592];}}}}return _0x514654;};exports[_0xcf4a('0x2e')]=function(_0x3eaaca){var _0x1e2833={};for(var _0x466ada in _0x3eaaca){if(_0x3eaaca[_0xcf4a('0x2f')](_0x466ada)){_0x1e2833[util['format']('%s',_[_0xcf4a('0x30')](_0x466ada))]=_0x3eaaca[_0x466ada];}}return{'variables':_0x1e2833};};exports['updateOriginated']=function(_0x581fed,_0x50b3f1){if(!_['isNil'](_0x581fed)){if(_0x581fed[_0xcf4a('0x2f')](_0xcf4a('0x31'))){if(_0x581fed[_0xcf4a('0x31')]>0x0){_0x581fed[_0xcf4a('0x31')]-=0x1;}else{logger[_0xcf4a('0x8')](_0xcf4a('0x32'),_0x50b3f1);}}}else{logger['error'](_0xcf4a('0x33'),_0x50b3f1);}};exports[_0xcf4a('0x34')]=function(_0x2eb683){var _0x5da0b2=moment()[_0xcf4a('0x14')](_0xcf4a('0x35'));_0x2eb683[_0xcf4a('0x36')]=0xd;_0x2eb683[_0xcf4a('0x37')]='Blacklist';_0x2eb683[_0xcf4a('0x38')]=_0x5da0b2;_0x2eb683['responsetime']=_0x5da0b2;_0x2eb683[_0xcf4a('0x39')]=_0x5da0b2;};exports['logAgent']=function(_0x768740,_0x5d212b,_0x473a2e){var _0x3dd065=moment()[_0xcf4a('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x768740[_0xcf4a('0x36')]=_0x5d212b;_0x768740[_0xcf4a('0x37')]=_0x473a2e;_0x768740[_0xcf4a('0x3a')]=_0x3dd065;_0x768740[_0xcf4a('0x3b')]=getSeconds(_0x768740['responsetime'],_0x768740[_0xcf4a('0x38')]);};exports[_0xcf4a('0x3c')]=function(_0x3a08d3,_0x1ce211,_0x36e0ac){_0x3a08d3[_0xcf4a('0x3d')]=_0x1ce211;_0x3a08d3[_0xcf4a('0x3e')]=_0x36e0ac;};exports[_0xcf4a('0x3f')]=function(_0x4f1a0b,_0xfdd112,_0x3abc93){var _0x855d36=moment()[_0xcf4a('0x14')](_0xcf4a('0x35'));_0x4f1a0b[_0xcf4a('0x36')]=_0xfdd112;_0x4f1a0b[_0xcf4a('0x37')]=_0x3abc93;_0x4f1a0b['responsetime']=_0x4f1a0b[_0xcf4a('0x3a')]?_0x4f1a0b[_0xcf4a('0x3a')]:_0x855d36;_0x4f1a0b['endtime']=_0x4f1a0b[_0xcf4a('0x39')]?_0x4f1a0b[_0xcf4a('0x39')]:_0x855d36;_0x4f1a0b[_0xcf4a('0x3b')]=getSeconds(_0x4f1a0b[_0xcf4a('0x3a')]||0x0,_0x4f1a0b[_0xcf4a('0x38')]||0x0);_0x4f1a0b[_0xcf4a('0x40')]=_0x4f1a0b['answertime']?getSeconds(_0x4f1a0b[_0xcf4a('0x39')],_0x4f1a0b[_0xcf4a('0x41')]):0x0;};exports[_0xcf4a('0x42')]=function(_0x3aa6ad){return _0x3aa6ad===_0xcf4a('0x43');};exports['variablesAction']=function(_0x28568c,_0x47382a,_0x3b9efe,_0x50c98f,_0x3d169f){var _0x38eeaa=_0x50c98f?_0xcf4a('0x44'):_0x28568c[_0xcf4a('0x1a')];_0x38eeaa=_0x3d169f?_0xcf4a('0x45'):_0x38eeaa;return{'actionid':_0x28568c[_0xcf4a('0x46')],'action':_0xcf4a('0x47'),'channel':_0x28568c[_0xcf4a('0x48')],'callerid':util['format'](_0xcf4a('0x13'),_0x38eeaa,_0x28568c['calleridnum']),'Exten':'xcally-motion-preview','Context':_0xcf4a('0x49'),'Priority':'1','variable':_0x3b9efe,'timeout':(_0x47382a[_0xcf4a('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x28568c[_0xcf4a('0x46')]};};exports[_0xcf4a('0x4b')]=function(_0x138a05){return _0x138a05[_0xcf4a('0x4c')]+_0x138a05[_0xcf4a('0x4d')]+_0x138a05[_0xcf4a('0x4e')];};exports[_0xcf4a('0x4f')]=function(_0x37a1a1){var _0x3766a8=_[_0xcf4a('0x50')](_0x37a1a1);_0x3766a8[_0xcf4a('0x36')]=0xf;_0x3766a8[_0xcf4a('0x37')]=_0xcf4a('0x51');return _0x3766a8;};exports[_0xcf4a('0x52')]=function(_0x2d421a,_0x23f739,_0xc8ffc9){var _0x51e42a={};_0x51e42a[_0x23f739]=_0x2d421a[_0x23f739];_0x51e42a[_0xcf4a('0x53')]=![];_0x51e42a[_0xcf4a('0x54')]=moment()[_0xcf4a('0x55')](_0xc8ffc9,_0xcf4a('0x56'))[_0xcf4a('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x51e42a['ContactId']=_0x2d421a['ContactId'];_0x51e42a[_0xcf4a('0x57')]=_0x2d421a[_0xcf4a('0x57')];_0x51e42a[_0xcf4a('0x1d')]=_0x2d421a[_0xcf4a('0x1d')]||undefined;return _0x51e42a;};exports[_0xcf4a('0x58')]=function(_0x5ad98d,_0x1f796e){if(!_[_0xcf4a('0x17')](_0x5ad98d)){if(_0x5ad98d[_0xcf4a('0x59')]>0x0){_0x5ad98d[_0xcf4a('0x59')]-=0x1;}else{logger[_0xcf4a('0x8')](_0x1f796e,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x1f796e,_0xcf4a('0x5a'));}};exports[_0xcf4a('0x5b')]=function(_0x507742){if(_0x507742<=0x0){return!![];}return![];};exports[_0xcf4a('0x5c')]=function(_0x5727e5,_0x1e4d6d){_0x5727e5[_0xcf4a('0x5d')]=_0x1e4d6d;_0x5727e5[_0xcf4a('0x19')]=_0x5727e5['queue'];_0x5727e5[_0xcf4a('0x5e')]=_0x5727e5[_0xcf4a('0x48')];return _0x5727e5;};exports[_0xcf4a('0x5f')]=function(_0x27a37a){var _0x90f3bb={};_0x90f3bb['queue']=_0x27a37a['queue'];_0x90f3bb['interface']=_0x27a37a['channelAgent'];_0x90f3bb[_0xcf4a('0x46')]=_0x27a37a['uniqueid'];return _0x90f3bb;};exports['agentReadyId']=function(_0xa0fd72){var _0x2dbe8d=[];for(var _0xb7ec44 in _0xa0fd72){if(_0xa0fd72[_0xcf4a('0x2f')](_0xb7ec44)){if(!_[_0xcf4a('0x17')](_0xa0fd72[_0xb7ec44])&&_0xa0fd72[_0xb7ec44][_0xcf4a('0x36')]===_0xcf4a('0x60')&&_0xa0fd72[_0xb7ec44]['status']==='reachable'){_0x2dbe8d[_0xcf4a('0x61')](_0xa0fd72[_0xb7ec44]['id']);}}}return _0x2dbe8d;};exports['getDiff']=function(_0x211f3b){var _0x2c991c=moment()['milliseconds'](0x0);var _0x2900a0=moment(_0x211f3b)['milliseconds'](0x0);return _0x2c991c[_0xcf4a('0x5')](_0x2900a0,_0xcf4a('0x6'));};exports[_0xcf4a('0x62')]=function(_0xcdb406){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xcdb406[_0xcf4a('0x1b')],'ListId':_0xcdb406[_0xcf4a('0x57')],'VoiceQueueId':_0xcdb406[_0xcf4a('0x1d')]||undefined,'CampaignId':_0xcdb406[_0xcf4a('0x63')]||undefined};};exports['filterKey']=function(_0x3b7528){if(_0x3b7528===_0xcf4a('0x46')||_0x3b7528===_0xcf4a('0x64')||_0x3b7528===_0xcf4a('0x65')||_0x3b7528==='type'||_0x3b7528===_0xcf4a('0x66')||_0x3b7528===_0xcf4a('0x67')||_0x3b7528===_0xcf4a('0x3d')||_0x3b7528===_0xcf4a('0x48')||_0x3b7528===_0xcf4a('0x1a')||_0x3b7528===_0xcf4a('0x53')||_0x3b7528===_0xcf4a('0x68')||_0x3b7528===_0xcf4a('0x54')||_0x3b7528==='countbusyretry'||_0x3b7528==='countcongestionretry'||_0x3b7528===_0xcf4a('0x4e')||_0x3b7528===_0xcf4a('0x69')||_0x3b7528===_0xcf4a('0x6a')||_0x3b7528===_0xcf4a('0x6b')||_0x3b7528===_0xcf4a('0x6c')||_0x3b7528===_0xcf4a('0x6d')||_0x3b7528===_0xcf4a('0x1b')||_0x3b7528===_0xcf4a('0x57')||_0x3b7528==='UserId'||_0x3b7528===_0xcf4a('0x1d')||_0x3b7528==='sipcallid'||_0x3b7528===_0xcf4a('0x6e')||_0x3b7528===_0xcf4a('0x6f')||_0x3b7528===_0xcf4a('0x70')||_0x3b7528===_0xcf4a('0x71')||_0x3b7528==='xmd-dialurl'||_0x3b7528===_0xcf4a('0x72')||_0x3b7528===_0xcf4a('0x73')||_0x3b7528===_0xcf4a('0x74')||_0x3b7528==='xmd-dialchannel'||_0x3b7528===_0xcf4a('0x75')||_0x3b7528===_0xcf4a('0x76')||_0x3b7528===_0xcf4a('0x77')||_0x3b7528===_0xcf4a('0x78')||_0x3b7528===_0xcf4a('0x79')||_0x3b7528===_0xcf4a('0x7a')||_0x3b7528===_0xcf4a('0x7b')||_0x3b7528===_0xcf4a('0x7c')||_0x3b7528===_0xcf4a('0x7d')||_0x3b7528==='rtpaudioqosloss'||_0x3b7528===_0xcf4a('0x7e')||_0x3b7528===_0xcf4a('0x7f')||_0x3b7528===_0xcf4a('0x80')||_0x3b7528==='rtpaudioqos'||_0x3b7528==='rtpaudioqosbridged'||_0x3b7528==='rtpaudioqosjitter'||_0x3b7528===_0xcf4a('0x7d')||_0x3b7528===_0xcf4a('0x81')||_0x3b7528==='rtpaudioqoslossbridged'||_0x3b7528==='rtpaudioqosrtt'||_0x3b7528==='rtpaudioqosrttbridged'||_0x3b7528===_0xcf4a('0x82')||_0x3b7528===_0xcf4a('0x83')||_0x3b7528===_0xcf4a('0x36')||_0x3b7528==='statedesc'){return![];}return!![];};exports[_0xcf4a('0x84')]=function(_0x26e7c8,_0x2f01ee){var _0x1b2b76,_0x45c32f,_0x76b73f;if(_0x2f01ee<=0x0){_0x2f01ee=0x1;}_0x1b2b76=new RegExp('\x5cw{0,'+_0x2f01ee+'}$');_0x45c32f=Math['pow'](0xa,_0x2f01ee-0x1);_0x76b73f=Math['pow'](0xa,_0x2f01ee)-0x1;return util[_0xcf4a('0x14')]('%s',_['replace'](_0x26e7c8,_0x1b2b76,_[_0xcf4a('0x85')](_0x45c32f,_0x76b73f)));};exports['extractCalleridName']=function(_0x13ca82){var _0x480458=_0x13ca82['match'](/"(.*?)"/);return _0x480458?_0x480458[0x1]:_0x13ca82;};exports[_0xcf4a('0x86')]=function(_0x373e6f){var _0x395c65=_0x373e6f[_0xcf4a('0x87')](/<(.*?)>/);return _0x395c65?_0x395c65[0x1]:_0x373e6f;}; \ No newline at end of file +var _0x65eb=['rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','random','extractCalleridName','match','extractCalleridNumber','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','milliseconds','diff','seconds','error','inspect','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','\x22%s\x22\x20<%s>','calleridname','calleridnum','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','logAgent','responsetime','ringtime','logLookAgent','membername','UserId','endtime','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','timeout','totalGlobal','countbusyretry','countnoanswerretry','cloneAction','Global','scheduledAt','active','scheduledat','add','ContactId','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','buildAcw','queue','interface','not_inuse','reachable','getDiff','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','countcongestionretry','countglobal','callbackuniqueid','callbackat','sipcallid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt'];(function(_0x11cf92,_0x1852c2){var _0x2c7e73=function(_0x295c09){while(--_0x295c09){_0x11cf92['push'](_0x11cf92['shift']());}};_0x2c7e73(++_0x1852c2);}(_0x65eb,0x1a3));var _0xb65e=function(_0x1326f3,_0x4504d8){_0x1326f3=_0x1326f3-0x0;var _0x1e760c=_0x65eb[_0x1326f3];return _0x1e760c;};'use strict';var util=require(_0xb65e('0x0'));var _=require(_0xb65e('0x1'));var moment=require('moment');var logger=require(_0xb65e('0x2'))(_0xb65e('0x3'));var ipAgi=process[_0xb65e('0x4')][_0xb65e('0x5')]||'127.0.0.1';function getSeconds(_0x5aeb37,_0x5e511f){var _0x203283=moment(_0x5aeb37)[_0xb65e('0x6')](0x0);var _0x3acce1=moment(_0x5e511f)[_0xb65e('0x6')](0x0);return _0x203283[_0xb65e('0x7')](_0x3acce1,_0xb65e('0x8'));}exports['loggerCatch']=function(_0x16159d){return function(_0xedeba9){logger[_0xb65e('0x9')](_0x16159d,util[_0xb65e('0xa')](_0xedeba9,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x540419,_0x1c43ce){logger[_0xb65e('0xb')](_0x540419,util[_0xb65e('0xa')](_0x1c43ce,{'showHidden':![],'depth':null}));};exports[_0xb65e('0xc')]=function(_0x48c763,_0x4f3183){logger[_0xb65e('0x9')](_0x48c763,util[_0xb65e('0xa')](_0x4f3183,{'showHidden':![],'depth':null}));};exports[_0xb65e('0xd')]=function(_0x1f463c){return function(_0x2ae8cb){logger['info'](_0x1f463c,util['inspect'](_0x2ae8cb,{'showHidden':![],'depth':null}));};};exports[_0xb65e('0xe')]=function(_0x35903b,_0x3e9841,_0x244ad4){return{'message':_0x35903b,'unlock':_0x3e9841,'active':_0x244ad4};};exports[_0xb65e('0xf')]=function(_0x9b4839,_0x3dce10,_0x4d513c){if(!_[_0xb65e('0x10')](_0x4d513c)&&_0xb65e('0x11')===typeof _0x4d513c&&!_[_0xb65e('0x12')](_0x4d513c)){if(!_[_0xb65e('0x10')](_0x3dce10)&&_0xb65e('0x11')===typeof _0x3dce10&&!_[_0xb65e('0x12')](_0x3dce10)){return util[_0xb65e('0x13')]('\x22%s\x22\x20<%s>',_0x3dce10,_0x4d513c);}return util[_0xb65e('0x13')]('\x22%s\x22\x20<%s>',_0x4d513c,_0x4d513c);}if(!_[_0xb65e('0x10')](_0x9b4839)&&_0xb65e('0x11')===typeof _0x9b4839&&!_[_0xb65e('0x12')](_0x9b4839)){return _0x9b4839;}return _0xb65e('0x14');};exports[_0xb65e('0x15')]=function(_0xc36a29){if(_[_0xb65e('0x16')](_0xc36a29)){return![];}return _0xc36a29;};exports[_0xb65e('0x17')]=function(_0x2734df,_0x2d0d7f,_0x177644,_0x394b1b,_0xc2ccf4,_0x536e8c){var _0x6697a1={'XMD-QUEUE':_0x2d0d7f[_0xb65e('0x18')]?_0x2d0d7f[_0xb65e('0x18')][_0xb65e('0x19')]:'','XMD-CALLERID':_0x394b1b,'XMD-CALLERID-PREVIEW':_0x536e8c?util[_0xb65e('0x13')](_0xb65e('0x1a'),_0x536e8c[_0xb65e('0x1b')],_0x536e8c[_0xb65e('0x1c')]):_0x394b1b,'XMD-DIALID':_0xc2ccf4,'XMD-CONTACTID':_0x2d0d7f['ContactId'],'XMD-CDRTYPE':_0xb65e('0x1d'),'CALLERID(all)':_0x394b1b,'XMD-VOICEQUEUEID':_0x2d0d7f[_0xb65e('0x1e')],'XMD-DIALCHANNEL':_0x177644,'XMD-DIALTIMEOUT':_0x2734df['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xb65e('0x13')](_0xb65e('0x1f'),_0x2734df[_0xb65e('0x20')]?'g':'',_[_0xb65e('0x12')](_0x2734df[_0xb65e('0x21')])?'':_0xb65e('0x22')),'XMD-DIALURL':_0x2734df[_0xb65e('0x23')]||'','XMD-AGI':_0x2734df['dialQueueProject']?util[_0xb65e('0x13')](_0xb65e('0x24'),ipAgi,_0x2734df['dialQueueProject']):_0xb65e('0x25'),'XMD-AGIAFTER':_0x2734df[_0xb65e('0x20')]?util[_0xb65e('0x13')](_0xb65e('0x24'),ipAgi,_0x2734df[_0xb65e('0x20')]):_0xb65e('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x536e8c?_0x536e8c['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x536e8c?_0x536e8c[_0xb65e('0x26')]:'','XMD-DESTINATION':_0xb65e('0x27')};if(!_[_0xb65e('0x12')](_0x2734df[_0xb65e('0x21')])){_0x6697a1[util[_0xb65e('0x13')]('%s',_0xb65e('0x28'))]=_0x2734df['monitor_format'];_0x6697a1[util[_0xb65e('0x13')]('%s',_0xb65e('0x29'))]=_0xc2ccf4;}if(_0x2d0d7f&&_0x2d0d7f[_0xb65e('0x2a')]){for(var _0x1f0058 in _0x2d0d7f[_0xb65e('0x2a')]){if(_0x2d0d7f[_0xb65e('0x2a')][_0xb65e('0x2b')](_0x1f0058)){if(!_[_0xb65e('0x16')](_0x2d0d7f[_0xb65e('0x2a')][_0x1f0058])&&_0x1f0058!=='id'&&_0x1f0058!==_0xb65e('0x2c')&&_0x1f0058!==_0xb65e('0x2d')&&_0x1f0058!==_0xb65e('0x2e')){_0x6697a1[util['format'](_0xb65e('0x2f'),_0xb65e('0x30'),_[_0xb65e('0x31')](_0x1f0058))]=_0x2d0d7f['Contact'][_0x1f0058];}}}}return _0x6697a1;};exports[_0xb65e('0x32')]=function(_0x6a4887){var _0x12a31a={};for(var _0x4ff217 in _0x6a4887){if(_0x6a4887[_0xb65e('0x2b')](_0x4ff217)){_0x12a31a[util[_0xb65e('0x13')]('%s',_[_0xb65e('0x33')](_0x4ff217))]=_0x6a4887[_0x4ff217];}}return{'variables':_0x12a31a};};exports[_0xb65e('0x34')]=function(_0x36e695,_0x133c2d){if(!_[_0xb65e('0x16')](_0x36e695)){if(_0x36e695['hasOwnProperty'](_0xb65e('0x35'))){if(_0x36e695[_0xb65e('0x35')]>0x0){_0x36e695['originated']-=0x1;}else{logger[_0xb65e('0x9')](_0xb65e('0x36'),_0x133c2d);}}}else{logger['error'](_0xb65e('0x37'),_0x133c2d);}};exports[_0xb65e('0x38')]=function(_0x43fdd0){var _0x30295e=moment()[_0xb65e('0x13')](_0xb65e('0x39'));_0x43fdd0[_0xb65e('0x3a')]=0xd;_0x43fdd0[_0xb65e('0x3b')]=_0xb65e('0x3c');_0x43fdd0[_0xb65e('0x3d')]=_0x30295e;_0x43fdd0['responsetime']=_0x30295e;_0x43fdd0['endtime']=_0x30295e;};exports[_0xb65e('0x3e')]=function(_0x5b0412,_0xfb021b,_0x59961a){var _0x7122a6=moment()[_0xb65e('0x13')](_0xb65e('0x39'));_0x5b0412[_0xb65e('0x3a')]=_0xfb021b;_0x5b0412[_0xb65e('0x3b')]=_0x59961a;_0x5b0412[_0xb65e('0x3f')]=_0x7122a6;_0x5b0412[_0xb65e('0x40')]=getSeconds(_0x5b0412[_0xb65e('0x3f')],_0x5b0412[_0xb65e('0x3d')]);};exports[_0xb65e('0x41')]=function(_0x1093cd,_0x34969b,_0x2173e6){_0x1093cd[_0xb65e('0x42')]=_0x34969b;_0x1093cd[_0xb65e('0x43')]=_0x2173e6;};exports['logCustomer']=function(_0x163fc3,_0x3a1180,_0x42488a){var _0x2bd794=moment()['format'](_0xb65e('0x39'));_0x163fc3[_0xb65e('0x3a')]=_0x3a1180;_0x163fc3[_0xb65e('0x3b')]=_0x42488a;_0x163fc3[_0xb65e('0x3f')]=_0x163fc3[_0xb65e('0x3f')]?_0x163fc3[_0xb65e('0x3f')]:_0x2bd794;_0x163fc3[_0xb65e('0x44')]=_0x163fc3[_0xb65e('0x44')]?_0x163fc3[_0xb65e('0x44')]:_0x2bd794;_0x163fc3[_0xb65e('0x40')]=getSeconds(_0x163fc3[_0xb65e('0x3f')]||0x0,_0x163fc3['starttime']||0x0);_0x163fc3[_0xb65e('0x45')]=_0x163fc3[_0xb65e('0x46')]?getSeconds(_0x163fc3['endtime'],_0x163fc3[_0xb65e('0x46')]):0x0;};exports['isFailure']=function(_0x51cff2){return _0x51cff2===_0xb65e('0x47');};exports[_0xb65e('0x48')]=function(_0x5b241d,_0x2443f3,_0x11911c,_0x4203f8,_0x274c41){var _0x1cd045=_0x4203f8?_0xb65e('0x49'):_0x5b241d[_0xb65e('0x1b')];_0x1cd045=_0x274c41?_0xb65e('0x4a'):_0x1cd045;return{'actionid':_0x5b241d[_0xb65e('0x4b')],'action':_0xb65e('0x4c'),'channel':_0x5b241d[_0xb65e('0x4d')],'callerid':util[_0xb65e('0x13')](_0xb65e('0x1a'),_0x1cd045,_0x5b241d[_0xb65e('0x1c')]),'Exten':_0xb65e('0x27'),'Context':'from-sip','Priority':'1','variable':_0x11911c,'timeout':(_0x2443f3[_0xb65e('0x4e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5b241d['uniqueid']};};exports[_0xb65e('0x4f')]=function(_0xa60da4){return _0xa60da4[_0xb65e('0x50')]+_0xa60da4['countcongestionretry']+_0xa60da4[_0xb65e('0x51')];};exports[_0xb65e('0x52')]=function(_0x4c18ab){var _0x31cfb5=_['clone'](_0x4c18ab);_0x31cfb5['state']=0xf;_0x31cfb5[_0xb65e('0x3b')]=_0xb65e('0x53');return _0x31cfb5;};exports[_0xb65e('0x54')]=function(_0x2237f4,_0xe3d95e,_0xc1ee5e){var _0x2f92e6={};_0x2f92e6[_0xe3d95e]=_0x2237f4[_0xe3d95e];_0x2f92e6[_0xb65e('0x55')]=![];_0x2f92e6[_0xb65e('0x56')]=moment()[_0xb65e('0x57')](_0xc1ee5e,'minutes')[_0xb65e('0x13')](_0xb65e('0x39'));_0x2f92e6['ContactId']=_0x2237f4[_0xb65e('0x58')];_0x2f92e6[_0xb65e('0x59')]=_0x2237f4['ListId'];_0x2f92e6[_0xb65e('0x1e')]=_0x2237f4[_0xb65e('0x1e')]||undefined;return _0x2f92e6;};exports['decrementTalkink']=function(_0x3b41d6,_0x352dee){if(!_[_0xb65e('0x16')](_0x3b41d6)){if(_0x3b41d6[_0xb65e('0x5a')]>0x0){_0x3b41d6[_0xb65e('0x5a')]-=0x1;}else{logger['error'](_0x352dee,_0xb65e('0x5b'));}}else{logger[_0xb65e('0x9')](_0x352dee,_0xb65e('0x5c'));}};exports[_0xb65e('0x5d')]=function(_0x5ef350){if(_0x5ef350<=0x0){return!![];}return![];};exports[_0xb65e('0x5e')]=function(_0x411da7,_0x4a0e8c){_0x411da7[_0xb65e('0x5f')]=_0x4a0e8c;_0x411da7[_0xb65e('0x19')]=_0x411da7['queue'];_0x411da7['interface']=_0x411da7[_0xb65e('0x4d')];return _0x411da7;};exports[_0xb65e('0x60')]=function(_0x4bd72f){var _0x4309d4={};_0x4309d4[_0xb65e('0x61')]=_0x4bd72f['queue'];_0x4309d4[_0xb65e('0x62')]=_0x4bd72f['channelAgent'];_0x4309d4[_0xb65e('0x4b')]=_0x4bd72f['uniqueid'];return _0x4309d4;};exports['agentReadyId']=function(_0x59f7e4){var _0x14d32e=[];for(var _0x13ceef in _0x59f7e4){if(_0x59f7e4['hasOwnProperty'](_0x13ceef)){if(!_['isNil'](_0x59f7e4[_0x13ceef])&&_0x59f7e4[_0x13ceef][_0xb65e('0x3a')]===_0xb65e('0x63')&&_0x59f7e4[_0x13ceef]['status']===_0xb65e('0x64')){_0x14d32e['push'](_0x59f7e4[_0x13ceef]['id']);}}}return _0x14d32e;};exports[_0xb65e('0x65')]=function(_0x50547d){var _0x33fd82=moment()['milliseconds'](0x0);var _0x432e93=moment(_0x50547d)[_0xb65e('0x6')](0x0);return _0x33fd82[_0xb65e('0x7')](_0x432e93,_0xb65e('0x8'));};exports[_0xb65e('0x66')]=function(_0x497ee8){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x497ee8[_0xb65e('0x58')],'ListId':_0x497ee8['ListId'],'VoiceQueueId':_0x497ee8['VoiceQueueId']||undefined,'CampaignId':_0x497ee8[_0xb65e('0x67')]||undefined};};exports[_0xb65e('0x68')]=function(_0xfd35c3){if(_0xfd35c3===_0xb65e('0x4b')||_0xfd35c3===_0xb65e('0x69')||_0xfd35c3==='queue'||_0xfd35c3==='type'||_0xfd35c3===_0xb65e('0x6a')||_0xfd35c3===_0xb65e('0x6b')||_0xfd35c3===_0xb65e('0x42')||_0xfd35c3===_0xb65e('0x4d')||_0xfd35c3===_0xb65e('0x1b')||_0xfd35c3===_0xb65e('0x55')||_0xfd35c3===_0xb65e('0x1c')||_0xfd35c3===_0xb65e('0x56')||_0xfd35c3==='countbusyretry'||_0xfd35c3===_0xb65e('0x6c')||_0xfd35c3===_0xb65e('0x51')||_0xfd35c3===_0xb65e('0x6d')||_0xfd35c3==='callback'||_0xfd35c3===_0xb65e('0x6e')||_0xfd35c3===_0xb65e('0x6f')||_0xfd35c3==='recallme'||_0xfd35c3==='ContactId'||_0xfd35c3===_0xb65e('0x59')||_0xfd35c3===_0xb65e('0x43')||_0xfd35c3==='VoiceQueueId'||_0xfd35c3===_0xb65e('0x70')||_0xfd35c3==='xmd-voicequeueid'||_0xfd35c3===_0xb65e('0x71')||_0xfd35c3===_0xb65e('0x72')||_0xfd35c3===_0xb65e('0x73')||_0xfd35c3===_0xb65e('0x74')||_0xfd35c3==='xmd-dialtimeout'||_0xfd35c3===_0xb65e('0x75')||_0xfd35c3==='xmd-dialid'||_0xfd35c3===_0xb65e('0x76')||_0xfd35c3===_0xb65e('0x77')||_0xfd35c3===_0xb65e('0x78')||_0xfd35c3==='xmd-callerid'||_0xfd35c3==='xmd-agiafter'||_0xfd35c3===_0xb65e('0x79')||_0xfd35c3===_0xb65e('0x7a')||_0xfd35c3===_0xb65e('0x7b')||_0xfd35c3===_0xb65e('0x7c')||_0xfd35c3===_0xb65e('0x7d')||_0xfd35c3===_0xb65e('0x7e')||_0xfd35c3===_0xb65e('0x7f')||_0xfd35c3===_0xb65e('0x80')||_0xfd35c3===_0xb65e('0x81')||_0xfd35c3===_0xb65e('0x7a')||_0xfd35c3===_0xb65e('0x7b')||_0xfd35c3==='rtpaudioqosjitter'||_0xfd35c3===_0xb65e('0x7d')||_0xfd35c3===_0xb65e('0x7e')||_0xfd35c3===_0xb65e('0x7f')||_0xfd35c3===_0xb65e('0x80')||_0xfd35c3===_0xb65e('0x81')||_0xfd35c3===_0xb65e('0x82')||_0xfd35c3==='bridgepvtcallid'||_0xfd35c3===_0xb65e('0x3a')||_0xfd35c3===_0xb65e('0x3b')){return![];}return!![];};exports[_0xb65e('0x83')]=function(_0x2aca8b,_0x496f2d){var _0x107573,_0x3e31fa,_0x35ed9b;if(_0x496f2d<=0x0){_0x496f2d=0x1;}_0x107573=new RegExp(_0xb65e('0x84')+_0x496f2d+'}$');_0x3e31fa=Math['pow'](0xa,_0x496f2d-0x1);_0x35ed9b=Math['pow'](0xa,_0x496f2d)-0x1;return util['format']('%s',_['replace'](_0x2aca8b,_0x107573,_[_0xb65e('0x85')](_0x3e31fa,_0x35ed9b)));};exports[_0xb65e('0x86')]=function(_0x43755e){var _0x527387=_0x43755e[_0xb65e('0x87')](/"(.*?)"/);return _0x527387?_0x527387[0x1]:_0x43755e;};exports[_0xb65e('0x88')]=function(_0x98d17e){var _0x461db9=_0x98d17e[_0xb65e('0x87')](/<(.*?)>/);return _0x461db9?_0x461db9[0x1]:_0x98d17e;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 15c6e03..7481bee 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(_0x9dad6c,_0x1a5581){var _0x130279=function(_0x405b67){while(--_0x405b67){_0x9dad6c['push'](_0x9dad6c['shift']());}};_0x130279(++_0x1a5581);}(_0x5f2f,0x73));var _0xf5f2=function(_0x393909,_0x2e0350){_0x393909=_0x393909-0x0;var _0x27d291=_0x5f2f[_0x393909];return _0x27d291;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x580ee5,_0x48a8d8){var _0x25603e=function(_0x227ac0){while(--_0x227ac0){_0x580ee5['push'](_0x580ee5['shift']());}};_0x25603e(++_0x48a8d8);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f8bc6,_0x4dc869){_0x2f8bc6=_0x2f8bc6-0x0;var _0x2d008a=_0xb10b[_0x2f8bc6];return _0x2d008a;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index d50224c..7d54ea8 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 _0x3986=['../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','triggers','templates','outbound','voiceExtensions','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','isNil','name','interface','total','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','isEmpty','answered','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','length','agents','mergeFromDatabase','initTelephones','prototype','initTrunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','isUndefined','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','merge','groupBy','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','campaigns','initVoiceExtensions','initFaxAccounts','exports','bluebird','util','lodash','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue'];(function(_0x2f7725,_0x47a0bd){var _0x23f49c=function(_0xcfb8b4){while(--_0xcfb8b4){_0x2f7725['push'](_0x2f7725['shift']());}};_0x23f49c(++_0x47a0bd);}(_0x3986,0x19d));var _0x6398=function(_0x321b36,_0x16f58c){_0x321b36=_0x321b36-0x0;var _0x5d5a9=_0x3986[_0x321b36];return _0x5d5a9;};'use strict';var BPromise=require(_0x6398('0x0'));var util=require(_0x6398('0x1'));var _=require(_0x6398('0x2'));var moment=require('moment');var Agent=require(_0x6398('0x3'));var Telephone=require(_0x6398('0x4'));var Trunk=require(_0x6398('0x5'));var VoiceQueue=require(_0x6398('0x6'));var Trigger=require(_0x6398('0x7'));var Template=require(_0x6398('0x8'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x6398('0x9'));var ZendeskAccount=require(_0x6398('0xa'));var SalesforceAccount=require(_0x6398('0xb'));var FreshdeskAccount=require(_0x6398('0xc'));var SugarcrmAccount=require(_0x6398('0xd'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x6398('0xe'));var VtigerAccount=require(_0x6398('0xf'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x6398('0x10'));var FreshsalesAccount=require(_0x6398('0x11'));var FaxAccount=require(_0x6398('0x12'));var Realtime=function(){this['agents']={};this[_0x6398('0x13')]={};this[_0x6398('0x14')]={};this['voiceQueues']={};this[_0x6398('0x15')]={};this['campaigns']={};this[_0x6398('0x16')]={};this[_0x6398('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x6398('0x18')]={};this['channels']={};this['queueChannels']={};this['outboundChannels']={};this[_0x6398('0x19')]={};this[_0x6398('0x1a')]={};this[_0x6398('0x1b')]={};this[_0x6398('0x1c')]={};this['freshdeskAccounts']={};this[_0x6398('0x1d')]={};this[_0x6398('0x1e')]={};this['vtigerAccounts']={};this[_0x6398('0x1f')]={};this[_0x6398('0x20')]={};this[_0x6398('0x21')]={};this[_0x6398('0x22')]={};};function freeIsNotKey(_0x188164,_0xd6d3a4,_0x3c406e){var _0x5e1f5e=_[_0x6398('0x23')](_0x188164,function(_0x56118c,_0x1665b0){return _0x56118c[_0x3c406e];});for(var _0xb27a26 in _0xd6d3a4){if(_0xd6d3a4[_0x6398('0x24')](_0xb27a26)){if(!_0x5e1f5e[_0xb27a26]){delete _0xd6d3a4[_0xb27a26];}}}}function freeIsNotKeySip(_0x46c88c,_0x2c3737){var _0x103e41=_[_0x6398('0x23')](_0x46c88c,function(_0x8dbccd,_0x25a183){return util[_0x6398('0x25')](_0x6398('0x26'),_0x8dbccd['name']);});for(var _0x58115c in _0x2c3737){if(_0x2c3737['hasOwnProperty'](_0x58115c)){if(!_0x103e41[_0x58115c]){delete _0x2c3737[_0x58115c];}}}}function freeIsNotKeyAgent(_0x3680a7,_0x990c2a){var _0x51dbf2=_[_0x6398('0x23')](_0x3680a7,function(_0x5dcf4f,_0xee19c){var _0x4f1683=_[_0x6398('0x27')](_0x5dcf4f['interface'])?util[_0x6398('0x25')]('SIP/%s',_0x5dcf4f[_0x6398('0x28')]):_0x5dcf4f[_0x6398('0x29')];return _0x4f1683;});for(var _0x47f42c in _0x990c2a){if(_0x990c2a['hasOwnProperty'](_0x47f42c)){if(!_0x51dbf2[_0x47f42c]){delete _0x990c2a[_0x47f42c];}}}}function clearVoiceCallReports(_0x24bc4b){_0x24bc4b[_0x6398('0x2a')]=0x0;_0x24bc4b['answered']=0x0;_0x24bc4b[_0x6398('0x2b')]=0x0;_0x24bc4b[_0x6398('0x2c')]=0x0;_0x24bc4b[_0x6398('0x2d')]=0x0;}function clearCampaigns(_0x3062c5){if(!_['isEmpty'](_0x3062c5)){for(var _0x39069a in _0x3062c5){if(_0x3062c5[_0x6398('0x24')](_0x39069a)){_0x3062c5[_0x39069a][_0x6398('0x2e')]=0x0;_0x3062c5[_0x39069a]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0xf081f3){if(!_[_0x6398('0x2f')](_0xf081f3)){for(var _0x380193 in _0xf081f3){if(_0xf081f3['hasOwnProperty'](_0x380193)){_0xf081f3[_0x380193][_0x6398('0x2a')]=0x0;_0xf081f3[_0x380193][_0x6398('0x30')]=0x0;_0xf081f3[_0x380193]['unmanaged']=0x0;_0xf081f3[_0x380193][_0x6398('0x31')]=0x0;_0xf081f3[_0x380193][_0x6398('0x2b')]=0x0;_0xf081f3[_0x380193]['sumDuration']=0x0;_0xf081f3[_0x380193]['sumBillable']=0x0;_0xf081f3[_0x380193][_0x6398('0x32')]=0x0;_0xf081f3[_0x380193][_0x6398('0x33')]=0x0;_0xf081f3[_0x380193][_0x6398('0x34')]=0x0;_0xf081f3[_0x380193][_0x6398('0x35')]=0x0;_0xf081f3[_0x380193]['outboundNoSuchCallsDay']=0x0;_0xf081f3[_0x380193]['outboundUnknownCallsDay']=0x0;_0xf081f3[_0x380193][_0x6398('0x36')]=0x0;_0xf081f3[_0x380193][_0x6398('0x37')]=0x0;_0xf081f3[_0x380193][_0x6398('0x38')]=0x0;_0xf081f3[_0x380193]['outboundOriginateFailureCallsDay']=0x0;_0xf081f3[_0x380193][_0x6398('0x39')]=0x0;_0xf081f3[_0x380193][_0x6398('0x3a')]=0x0;_0xf081f3[_0x380193][_0x6398('0x32')]=0x0;_0xf081f3[_0x380193][_0x6398('0x3b')]=0x0;_0xf081f3[_0x380193][_0x6398('0x3c')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x4e08e8,_0x3fa0a2){for(var _0x2a109c in _0x3fa0a2){if(_0x4e08e8[_0x6398('0x24')](_0x2a109c)){_0x4e08e8[_0x2a109c]=_0x3fa0a2[_0x2a109c];}}};Realtime['prototype']['initAgents']=function(){var _0xade914=this;return function(_0x3a962d){if(_0x3a962d){freeIsNotKeyAgent(_0x3a962d,_0xade914['agents']);for(var _0x422a20=0x0,_0xfb6f2f={},_0x1bae6e={};_0x422a20<_0x3a962d[_0x6398('0x3d')];_0x422a20+=0x1){_0xfb6f2f=_0x3a962d[_0x422a20];var _0x2eaaf3=_[_0x6398('0x27')](_0xfb6f2f[_0x6398('0x29')])?util['format'](_0x6398('0x26'),_0xfb6f2f[_0x6398('0x28')]):_0xfb6f2f[_0x6398('0x29')];if(_['isUndefined'](_0xade914[_0x6398('0x3e')][_0x2eaaf3])){_0xade914[_0x6398('0x3e')][_0x2eaaf3]=new Agent(_0xfb6f2f);}else{_0xade914[_0x6398('0x3f')](_0xade914['agents'][_0x2eaaf3],_0xfb6f2f);}}}return _0xade914['agents'];};};Realtime['prototype'][_0x6398('0x40')]=function(){var _0x20001f=this;return function(_0x523f9f){if(_0x523f9f){freeIsNotKeySip(_0x523f9f,_0x20001f[_0x6398('0x13')]);for(var _0x1d8b92=0x0,_0x31521b={},_0x2a1ab7={};_0x1d8b92<_0x523f9f[_0x6398('0x3d')];_0x1d8b92+=0x1){_0x31521b=_0x523f9f[_0x1d8b92];if(_['isUndefined'](_0x20001f['telephones'][util['format']('SIP/%s',_0x31521b[_0x6398('0x28')])])){_0x20001f[_0x6398('0x13')][util[_0x6398('0x25')](_0x6398('0x26'),_0x31521b[_0x6398('0x28')])]=new Telephone(_0x31521b);}else{_0x20001f[_0x6398('0x3f')](_0x20001f[_0x6398('0x13')][util['format'](_0x6398('0x26'),_0x31521b[_0x6398('0x28')])],_0x31521b);}}}return _0x20001f[_0x6398('0x13')];};};Realtime[_0x6398('0x41')][_0x6398('0x42')]=function(){var _0x1c17f5=this;return function(_0x1d237d){if(_0x1d237d){freeIsNotKeySip(_0x1d237d,_0x1c17f5['trunks']);for(var _0x4c9559=0x0,_0x2cb0e7={},_0x2db00d={};_0x4c9559<_0x1d237d[_0x6398('0x3d')];_0x4c9559+=0x1){_0x2cb0e7=_0x1d237d[_0x4c9559];if(_['isUndefined'](_0x1c17f5[_0x6398('0x14')][util[_0x6398('0x25')](_0x6398('0x26'),_0x2cb0e7['name'])])){_0x1c17f5[_0x6398('0x14')][util[_0x6398('0x25')](_0x6398('0x26'),_0x2cb0e7['name'])]=new Trunk(_0x2cb0e7);}else{_0x1c17f5[_0x6398('0x3f')](_0x1c17f5['trunks'][util['format'](_0x6398('0x26'),_0x2cb0e7[_0x6398('0x28')])],_0x2cb0e7);}}}return _0x1c17f5[_0x6398('0x14')];};};Realtime[_0x6398('0x41')][_0x6398('0x43')]=function(){var _0x5554c4=this;return function(_0x497983){if(_0x497983){freeIsNotKey(_0x497983,_0x5554c4[_0x6398('0x44')],_0x6398('0x28'));for(var _0x48d525=0x0,_0x170cf6={},_0x5d08e0={};_0x48d525<_0x497983[_0x6398('0x3d')];_0x48d525+=0x1){_0x170cf6=_0x497983[_0x48d525];if(_['isUndefined'](_0x5554c4[_0x6398('0x44')][_0x170cf6['name']])){_0x5554c4[_0x6398('0x44')][_0x170cf6['name']]=new VoiceQueue(_0x170cf6);}else{_0x5554c4['mergeFromDatabase'](_0x5554c4['voiceQueues'][_0x170cf6['name']],_0x170cf6);}}}return _0x5554c4[_0x6398('0x44')];};};Realtime[_0x6398('0x41')][_0x6398('0x45')]=function(){var _0x220fdf=this;return function(_0x591bdc){if(_0x591bdc){freeIsNotKey(_0x591bdc,_0x220fdf['triggers'],'id');for(var _0x264756=0x0,_0x5e04ef={},_0x22f6fa={};_0x264756<_0x591bdc[_0x6398('0x3d')];_0x264756+=0x1){_0x5e04ef=_0x591bdc[_0x264756];if(_['isUndefined'](_0x220fdf[_0x6398('0x15')][_0x5e04ef['id']])){_0x220fdf[_0x6398('0x15')][_0x5e04ef['id']]=new Trigger(_0x5e04ef);}else{_0x220fdf[_0x6398('0x3f')](_0x220fdf['triggers'][_0x5e04ef['id']],_0x5e04ef);}}}return _0x220fdf[_0x6398('0x15')];};};Realtime[_0x6398('0x41')][_0x6398('0x46')]=function(){var _0x58a48f=this;return function(_0x17c694){if(_0x17c694){freeIsNotKey(_0x17c694,_0x58a48f[_0x6398('0x16')],'id');for(var _0x2d0421=0x0,_0x3d0d96={},_0x1694c1={};_0x2d0421<_0x17c694[_0x6398('0x3d')];_0x2d0421+=0x1){_0x3d0d96=_0x17c694[_0x2d0421];if(_[_0x6398('0x47')](_0x58a48f[_0x6398('0x16')][_0x3d0d96['id']])){_0x58a48f[_0x6398('0x16')][_0x3d0d96['id']]=new Template(_0x3d0d96);}else{_0x58a48f[_0x6398('0x3f')](_0x58a48f['templates'][_0x3d0d96['id']],_0x3d0d96);}}}return _0x58a48f[_0x6398('0x16')];};};Realtime[_0x6398('0x41')][_0x6398('0x48')]=function(){var _0x5b6170=this;return function(_0x802e91){if(_0x802e91){freeIsNotKey(_0x802e91,_0x5b6170[_0x6398('0x1a')],'id');for(var _0x357c7b=0x0,_0xf32d24={},_0x4d0f74={};_0x357c7b<_0x802e91['length'];_0x357c7b+=0x1){_0xf32d24=_0x802e91[_0x357c7b];if(_[_0x6398('0x47')](_0x5b6170[_0x6398('0x1a')][_0xf32d24['id']])){_0x5b6170[_0x6398('0x1a')][_0xf32d24['id']]=new ZendeskAccount(_0xf32d24);}else{_0x5b6170[_0x6398('0x3f')](_0x5b6170[_0x6398('0x1a')][_0xf32d24['id']],_0xf32d24);}}}return _0x5b6170[_0x6398('0x1a')];};};Realtime[_0x6398('0x41')][_0x6398('0x49')]=function(){var _0x8a91ee=this;return function(_0x10ac7d){if(_0x10ac7d){freeIsNotKey(_0x10ac7d,_0x8a91ee[_0x6398('0x1b')],'id');for(var _0x34691f=0x0,_0x47be32={},_0x4dfda7={};_0x34691f<_0x10ac7d[_0x6398('0x3d')];_0x34691f+=0x1){_0x47be32=_0x10ac7d[_0x34691f];if(_[_0x6398('0x47')](_0x8a91ee[_0x6398('0x1b')][_0x47be32['id']])){_0x8a91ee[_0x6398('0x1b')][_0x47be32['id']]=new SalesforceAccount(_0x47be32);}else{_0x8a91ee[_0x6398('0x3f')](_0x8a91ee[_0x6398('0x1b')][_0x47be32['id']],_0x47be32);}}}return _0x8a91ee[_0x6398('0x1b')];};};Realtime['prototype'][_0x6398('0x4a')]=function(){var _0x217971=this;return function(_0xbc9f7f){if(_0xbc9f7f){freeIsNotKey(_0xbc9f7f,_0x217971[_0x6398('0x4b')],'id');for(var _0x32384c=0x0,_0x3956c0={},_0x4ff7db={};_0x32384c<_0xbc9f7f[_0x6398('0x3d')];_0x32384c+=0x1){_0x3956c0=_0xbc9f7f[_0x32384c];if(_[_0x6398('0x47')](_0x217971[_0x6398('0x4b')][_0x3956c0['id']])){_0x217971[_0x6398('0x4b')][_0x3956c0['id']]=new FreshdeskAccount(_0x3956c0);}else{_0x217971[_0x6398('0x3f')](_0x217971['freshdeskAccounts'][_0x3956c0['id']],_0x3956c0);}}}return _0x217971[_0x6398('0x4b')];};};Realtime[_0x6398('0x41')][_0x6398('0x4c')]=function(){var _0x59a8bd=this;return function(_0x5c4b89){if(_0x5c4b89){freeIsNotKey(_0x5c4b89,_0x59a8bd[_0x6398('0x1d')],'id');for(var _0x5ef02e=0x0,_0x37fb30={},_0x4d4921={};_0x5ef02e<_0x5c4b89['length'];_0x5ef02e+=0x1){_0x37fb30=_0x5c4b89[_0x5ef02e];if(_[_0x6398('0x47')](_0x59a8bd[_0x6398('0x1d')][_0x37fb30['id']])){_0x59a8bd[_0x6398('0x1d')][_0x37fb30['id']]=new ZohoAccount(_0x37fb30);}else{_0x59a8bd[_0x6398('0x3f')](_0x59a8bd['zohoAccounts'][_0x37fb30['id']],_0x37fb30);}}}return _0x59a8bd[_0x6398('0x1d')];};};Realtime[_0x6398('0x41')][_0x6398('0x4d')]=function(){var _0x506146=this;return function(_0xf8f295){if(_0xf8f295){freeIsNotKey(_0xf8f295,_0x506146[_0x6398('0x1e')],'id');for(var _0x116f86=0x0,_0x58225e={},_0x36d56c={};_0x116f86<_0xf8f295[_0x6398('0x3d')];_0x116f86+=0x1){_0x58225e=_0xf8f295[_0x116f86];if(_[_0x6398('0x47')](_0x506146[_0x6398('0x1e')][_0x58225e['id']])){_0x506146[_0x6398('0x1e')][_0x58225e['id']]=new DeskAccount(_0x58225e);}else{_0x506146[_0x6398('0x3f')](_0x506146[_0x6398('0x1e')][_0x58225e['id']],_0x58225e);}}}return _0x506146[_0x6398('0x1e')];};};Realtime[_0x6398('0x41')]['initSugarcrmAccounts']=function(){var _0x2e8e82=this;return function(_0x347a81){if(_0x347a81){freeIsNotKey(_0x347a81,_0x2e8e82[_0x6398('0x1c')],'id');for(var _0x42d0cc=0x0,_0x3b2d12={},_0x123d59={};_0x42d0cc<_0x347a81['length'];_0x42d0cc+=0x1){_0x3b2d12=_0x347a81[_0x42d0cc];if(_[_0x6398('0x47')](_0x2e8e82['sugarcrmAccounts'][_0x3b2d12['id']])){_0x2e8e82[_0x6398('0x1c')][_0x3b2d12['id']]=new SugarcrmAccount(_0x3b2d12);}else{_0x2e8e82['mergeFromDatabase'](_0x2e8e82[_0x6398('0x1c')][_0x3b2d12['id']],_0x3b2d12);}}}return _0x2e8e82['sugarcrmAccounts'];};};Realtime[_0x6398('0x41')][_0x6398('0x4e')]=function(){var _0x47dd87=this;return function(_0x36ce58){if(_0x36ce58){freeIsNotKey(_0x36ce58,_0x47dd87[_0x6398('0x4f')],'id');for(var _0x4daac7=0x0,_0x33fe3d={},_0x5b403a={};_0x4daac7<_0x36ce58[_0x6398('0x3d')];_0x4daac7+=0x1){_0x33fe3d=_0x36ce58[_0x4daac7];if(_[_0x6398('0x47')](_0x47dd87[_0x6398('0x4f')][_0x33fe3d['id']])){_0x47dd87[_0x6398('0x4f')][_0x33fe3d['id']]=new VtigerAccount(_0x33fe3d);}else{_0x47dd87['mergeFromDatabase'](_0x47dd87[_0x6398('0x4f')][_0x33fe3d['id']],_0x33fe3d);}}}return _0x47dd87[_0x6398('0x4f')];};};Realtime[_0x6398('0x41')][_0x6398('0x50')]=function(){var _0x1212ee=this;return function(_0x362e49){if(_0x362e49){freeIsNotKey(_0x362e49,_0x1212ee[_0x6398('0x1f')],'id');for(var _0x463338=0x0,_0x3a55f3={},_0x29a5d8={};_0x463338<_0x362e49[_0x6398('0x3d')];_0x463338+=0x1){_0x3a55f3=_0x362e49[_0x463338];if(_[_0x6398('0x47')](_0x1212ee[_0x6398('0x1f')][_0x3a55f3['id']])){_0x1212ee[_0x6398('0x1f')][_0x3a55f3['id']]=new ServicenowAccount(_0x3a55f3);}else{_0x1212ee[_0x6398('0x3f')](_0x1212ee[_0x6398('0x1f')][_0x3a55f3['id']],_0x3a55f3);}}}return _0x1212ee['servicenowAccounts'];};};Realtime[_0x6398('0x41')][_0x6398('0x51')]=function(){var _0x517627=this;return function(_0x572cb0){if(_0x572cb0){freeIsNotKey(_0x572cb0,_0x517627[_0x6398('0x20')],'id');for(var _0x1db58c=0x0,_0x54b8fd={},_0x3ae8e6={};_0x1db58c<_0x572cb0[_0x6398('0x3d')];_0x1db58c+=0x1){_0x54b8fd=_0x572cb0[_0x1db58c];if(_[_0x6398('0x47')](_0x517627['dynamics365Accounts'][_0x54b8fd['id']])){_0x517627[_0x6398('0x20')][_0x54b8fd['id']]=new Dynamics365Account(_0x54b8fd);}else{_0x517627['mergeFromDatabase'](_0x517627[_0x6398('0x20')][_0x54b8fd['id']],_0x54b8fd);}}}return _0x517627[_0x6398('0x20')];};};Realtime[_0x6398('0x41')]['initFreshsalesAccounts']=function(){var _0x306c65=this;return function(_0xe79e67){if(_0xe79e67){freeIsNotKey(_0xe79e67,_0x306c65[_0x6398('0x21')],'id');for(var _0x59102f=0x0,_0x53befc={},_0x182c1d={};_0x59102f<_0xe79e67[_0x6398('0x3d')];_0x59102f+=0x1){_0x53befc=_0xe79e67[_0x59102f];if(_['isUndefined'](_0x306c65[_0x6398('0x21')][_0x53befc['id']])){_0x306c65['freshsalesAccounts'][_0x53befc['id']]=new FreshsalesAccount(_0x53befc);}else{_0x306c65[_0x6398('0x3f')](_0x306c65[_0x6398('0x21')][_0x53befc['id']],_0x53befc);}}}return _0x306c65['freshsalesAccounts'];};};Realtime[_0x6398('0x41')][_0x6398('0x52')]=function(){var _0x3dfdff=this;return function(_0x44e062){for(var _0x165d8e=0x0;_0x165d8e<_0x44e062[_0x6398('0x3d')];_0x165d8e+=0x1){_[_0x6398('0x53')](_0x3dfdff['voiceQueues'][_0x44e062[_0x165d8e][_0x6398('0x28')]],_0x44e062[_0x165d8e]);}return _0x3dfdff['voiceQueues'];};};Realtime[_0x6398('0x41')]['initVoiceQueueReports']=function(){var _0x532bfe=this;return function(_0x939a6f){clearVoiceQueues(_0x532bfe[_0x6398('0x44')]);if(_0x939a6f){_0x939a6f=_[_0x6398('0x54')](_0x939a6f,'uniqueid');for(var _0x42636d in _0x939a6f){if(_0x939a6f[_0x6398('0x24')](_0x42636d)){var _0x3d9dcb={};for(var _0x6b4ffb=0x0;_0x6b4ffb<_0x939a6f[_0x42636d][_0x6398('0x3d')];_0x6b4ffb+=0x1){var _0x5933ba=_0x939a6f[_0x42636d][_0x6b4ffb][_0x6398('0x55')];if(_0x532bfe[_0x6398('0x44')][_0x5933ba]){if(_0x939a6f[_0x42636d][_0x6b4ffb][_0x6398('0x56')]){_0x532bfe[_0x6398('0x44')][_0x5933ba][_0x6398('0x57')]+=0x1;}if(_0x939a6f[_0x42636d][_0x6b4ffb][_0x6398('0x58')]){_0x532bfe[_0x6398('0x44')][_0x5933ba]['abandoned']+=0x1;}_0x532bfe['voiceQueues'][_0x5933ba][_0x6398('0x2b')]+=moment(_0x939a6f[_0x42636d][_0x6b4ffb][_0x6398('0x59')])[_0x6398('0x5a')](moment(_0x939a6f[_0x42636d][_0x6b4ffb]['queuecallerjoinAt']),_0x6398('0x5b'))||0x0;if(_0x6b4ffb===_0x939a6f[_0x42636d]['length']-0x1){_0x532bfe[_0x6398('0x44')][_0x5933ba][_0x6398('0x2c')]+=moment(_0x939a6f[_0x42636d][_0x6b4ffb][_0x6398('0x5c')]||_0x939a6f[_0x42636d][_0x6b4ffb][_0x6398('0x5d')]||_0x939a6f[_0x42636d][_0x6b4ffb][_0x6398('0x5e')])[_0x6398('0x5a')](moment(_0x939a6f[_0x42636d][_0x6b4ffb]['queuecallerjoinAt']),_0x6398('0x5b'))||0x0;_0x532bfe[_0x6398('0x44')][_0x5933ba][_0x6398('0x2a')]+=0x1;if(_0x939a6f[_0x42636d][_0x6b4ffb][_0x6398('0x5f')]){_0x532bfe[_0x6398('0x44')][_0x5933ba][_0x6398('0x30')]+=0x1;_0x532bfe[_0x6398('0x44')][_0x5933ba][_0x6398('0x2d')]+=moment(_0x939a6f[_0x42636d][_0x6b4ffb][_0x6398('0x5c')])[_0x6398('0x5a')](moment(_0x939a6f[_0x42636d][_0x6b4ffb][_0x6398('0x59')]),_0x6398('0x5b'))||0x0;}}else{_0x532bfe[_0x6398('0x44')][_0x5933ba][_0x6398('0x2c')]+=_0x532bfe[_0x6398('0x44')][_0x5933ba][_0x6398('0x2b')]||0x0;}}}}}}return _0x532bfe[_0x6398('0x44')];};};Realtime[_0x6398('0x41')][_0x6398('0x60')]=function(){var _0x158f87=this;return function(_0x3b7aee){clearVoiceCallReports(_0x158f87[_0x6398('0x17')]);if(_0x3b7aee){for(var _0x5b6dda=0x0;_0x5b6dda<_0x3b7aee[_0x6398('0x3d')];_0x5b6dda+=0x1){_0x158f87[_0x6398('0x17')]['total']+=0x1;_0x158f87['outbound'][_0x6398('0x2c')]+=_0x3b7aee[_0x5b6dda][_0x6398('0x61')];if(_0x3b7aee[_0x5b6dda]['disposition']===_0x6398('0x62')){_0x158f87[_0x6398('0x17')][_0x6398('0x30')]+=0x1;_0x158f87[_0x6398('0x17')][_0x6398('0x2b')]+=_0x3b7aee[_0x5b6dda][_0x6398('0x61')]-_0x3b7aee[_0x5b6dda]['billableseconds']||0x0;_0x158f87[_0x6398('0x17')]['sumBillable']+=_0x3b7aee[_0x5b6dda][_0x6398('0x63')];}}}return _0x158f87[_0x6398('0x17')];};};Realtime[_0x6398('0x41')][_0x6398('0x64')]=function(){var _0x5f4ac4=this;return function(_0x1f4a69){if(_0x1f4a69){freeIsNotKey(_0x1f4a69,_0x5f4ac4[_0x6398('0x65')],_0x6398('0x28'));for(var _0x4ea374=0x0,_0x5cf67d={};_0x4ea374<_0x1f4a69['length'];_0x4ea374+=0x1){_0x5cf67d=_0x1f4a69[_0x4ea374];if(_['isUndefined'](_0x5f4ac4['campaigns'][_0x5cf67d[_0x6398('0x28')]])){_0x5f4ac4['campaigns'][_0x5cf67d[_0x6398('0x28')]]=new Campaign(_0x5cf67d);}else{_0x5f4ac4[_0x6398('0x3f')](_0x5f4ac4[_0x6398('0x65')][_0x5cf67d['name']],_0x5cf67d);}}}return _0x5f4ac4[_0x6398('0x65')];};};Realtime['prototype'][_0x6398('0x66')]=function(){var _0x4bec54=this;return function(_0x559408){if(_0x559408){freeIsNotKey(_0x559408,_0x4bec54[_0x6398('0x18')],'id');for(var _0x56d91f=0x0,_0x1900b6={};_0x56d91f<_0x559408[_0x6398('0x3d')];_0x56d91f+=0x1){_0x1900b6=_0x559408[_0x56d91f];if(_[_0x6398('0x47')](_0x4bec54[_0x6398('0x18')][_0x1900b6['id']])){_0x4bec54[_0x6398('0x18')][_0x1900b6['id']]=new VoiceExtension(_0x1900b6);}else{_0x4bec54[_0x6398('0x3f')](_0x4bec54[_0x6398('0x18')][_0x1900b6['id']],_0x1900b6);}}}return _0x4bec54['voiceExtensions'];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x2bf642=this;return function(_0x2d8b6c){clearCampaigns(_0x2bf642['campaigns']);for(var _0x295e5e=0x0;_0x295e5e<_0x2d8b6c['length'];_0x295e5e+=0x1){_['merge'](_0x2bf642[_0x6398('0x65')][_0x2d8b6c[_0x295e5e][_0x6398('0x28')]],_0x2d8b6c[_0x295e5e]);}return _0x2bf642['campaigns'];};};Realtime[_0x6398('0x41')][_0x6398('0x67')]=function(){var _0x39c29b=this;return function(_0x27eb6f){if(_0x27eb6f){freeIsNotKey(_0x27eb6f,_0x39c29b[_0x6398('0x22')],'id');for(var _0xd69aef=0x0,_0x41d099={},_0x117d84={};_0xd69aef<_0x27eb6f[_0x6398('0x3d')];_0xd69aef+=0x1){_0x41d099=_0x27eb6f[_0xd69aef];if(_['isUndefined'](_0x39c29b[_0x6398('0x22')][_0x41d099['id']])){_0x39c29b[_0x6398('0x22')][_0x41d099['id']]=new FaxAccount(_0x41d099);}else{_0x39c29b[_0x6398('0x3f')](_0x39c29b[_0x6398('0x22')][_0x41d099['id']],_0x41d099);}}}return _0x39c29b[_0x6398('0x22')];};};module[_0x6398('0x68')]=Realtime; \ No newline at end of file +var _0x2861=['../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','SIP/%s','name','isNil','interface','format','total','answered','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','isUndefined','initTelephones','initTrunks','initVoiceQueues','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','unmanaged','queuecallerabandon','sumHoldTime','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerexitAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone'];(function(_0x506efb,_0x18cedc){var _0x3d2f6d=function(_0xd5ab53){while(--_0xd5ab53){_0x506efb['push'](_0x506efb['shift']());}};_0x3d2f6d(++_0x18cedc);}(_0x2861,0x1aa));var _0x1286=function(_0x5a6de2,_0x5c8b10){_0x5a6de2=_0x5a6de2-0x0;var _0x2c0525=_0x2861[_0x5a6de2];return _0x2c0525;};'use strict';var BPromise=require(_0x1286('0x0'));var util=require(_0x1286('0x1'));var _=require(_0x1286('0x2'));var moment=require(_0x1286('0x3'));var Agent=require(_0x1286('0x4'));var Telephone=require(_0x1286('0x5'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x1286('0x6'));var Trigger=require(_0x1286('0x7'));var Template=require(_0x1286('0x8'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x1286('0x9'));var ZendeskAccount=require(_0x1286('0xa'));var SalesforceAccount=require(_0x1286('0xb'));var FreshdeskAccount=require(_0x1286('0xc'));var SugarcrmAccount=require(_0x1286('0xd'));var ZohoAccount=require(_0x1286('0xe'));var DeskAccount=require(_0x1286('0xf'));var VtigerAccount=require(_0x1286('0x10'));var ServicenowAccount=require(_0x1286('0x11'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x1286('0x12'));var FaxAccount=require(_0x1286('0x13'));var Realtime=function(){this['agents']={};this[_0x1286('0x14')]={};this[_0x1286('0x15')]={};this[_0x1286('0x16')]={};this['triggers']={};this[_0x1286('0x17')]={};this[_0x1286('0x18')]={};this[_0x1286('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x1286('0x1a')]={};this[_0x1286('0x1b')]={};this[_0x1286('0x1c')]={};this['outboundChannels']={};this['timers']={};this[_0x1286('0x1d')]={};this[_0x1286('0x1e')]={};this['sugarcrmAccounts']={};this[_0x1286('0x1f')]={};this[_0x1286('0x20')]={};this[_0x1286('0x21')]={};this[_0x1286('0x22')]={};this[_0x1286('0x23')]={};this[_0x1286('0x24')]={};this[_0x1286('0x25')]={};this[_0x1286('0x26')]={};};function freeIsNotKey(_0xd023f4,_0xbb6bae,_0x9a6664){var _0x3fd2f7=_['mapKeys'](_0xd023f4,function(_0x4e5be5,_0x3fae45){return _0x4e5be5[_0x9a6664];});for(var _0x423586 in _0xbb6bae){if(_0xbb6bae[_0x1286('0x27')](_0x423586)){if(!_0x3fd2f7[_0x423586]){delete _0xbb6bae[_0x423586];}}}}function freeIsNotKeySip(_0x55fe25,_0x511025){var _0x10f7f4=_['mapKeys'](_0x55fe25,function(_0x40cc24,_0x12b628){return util['format'](_0x1286('0x28'),_0x40cc24[_0x1286('0x29')]);});for(var _0x46214a in _0x511025){if(_0x511025[_0x1286('0x27')](_0x46214a)){if(!_0x10f7f4[_0x46214a]){delete _0x511025[_0x46214a];}}}}function freeIsNotKeyAgent(_0x108bda,_0x3fc638){var _0x51e3d2=_['mapKeys'](_0x108bda,function(_0x18cd88,_0x2f5553){var _0x1bde46=_[_0x1286('0x2a')](_0x18cd88[_0x1286('0x2b')])?util[_0x1286('0x2c')](_0x1286('0x28'),_0x18cd88['name']):_0x18cd88['interface'];return _0x1bde46;});for(var _0x3a9b88 in _0x3fc638){if(_0x3fc638[_0x1286('0x27')](_0x3a9b88)){if(!_0x51e3d2[_0x3a9b88]){delete _0x3fc638[_0x3a9b88];}}}}function clearVoiceCallReports(_0x2272ec){_0x2272ec[_0x1286('0x2d')]=0x0;_0x2272ec[_0x1286('0x2e')]=0x0;_0x2272ec['sumHoldTime']=0x0;_0x2272ec[_0x1286('0x2f')]=0x0;_0x2272ec['sumBillable']=0x0;}function clearCampaigns(_0x4c751a){if(!_[_0x1286('0x30')](_0x4c751a)){for(var _0xcc54da in _0x4c751a){if(_0x4c751a[_0x1286('0x27')](_0xcc54da)){_0x4c751a[_0xcc54da][_0x1286('0x31')]=0x0;_0x4c751a[_0xcc54da][_0x1286('0x32')]=0x0;}}}}function clearVoiceQueues(_0x15d4db){if(!_[_0x1286('0x30')](_0x15d4db)){for(var _0x337d7d in _0x15d4db){if(_0x15d4db[_0x1286('0x27')](_0x337d7d)){_0x15d4db[_0x337d7d][_0x1286('0x2d')]=0x0;_0x15d4db[_0x337d7d][_0x1286('0x2e')]=0x0;_0x15d4db[_0x337d7d]['unmanaged']=0x0;_0x15d4db[_0x337d7d][_0x1286('0x33')]=0x0;_0x15d4db[_0x337d7d]['sumHoldTime']=0x0;_0x15d4db[_0x337d7d][_0x1286('0x2f')]=0x0;_0x15d4db[_0x337d7d][_0x1286('0x34')]=0x0;_0x15d4db[_0x337d7d][_0x1286('0x35')]=0x0;_0x15d4db[_0x337d7d][_0x1286('0x36')]=0x0;_0x15d4db[_0x337d7d][_0x1286('0x37')]=0x0;_0x15d4db[_0x337d7d][_0x1286('0x38')]=0x0;_0x15d4db[_0x337d7d][_0x1286('0x39')]=0x0;_0x15d4db[_0x337d7d][_0x1286('0x3a')]=0x0;_0x15d4db[_0x337d7d][_0x1286('0x3b')]=0x0;_0x15d4db[_0x337d7d]['outboundDropCallsDayCallersExit']=0x0;_0x15d4db[_0x337d7d][_0x1286('0x3c')]=0x0;_0x15d4db[_0x337d7d][_0x1286('0x3d')]=0x0;_0x15d4db[_0x337d7d][_0x1286('0x3e')]=0x0;_0x15d4db[_0x337d7d][_0x1286('0x3f')]=0x0;_0x15d4db[_0x337d7d]['outboundAnswerAgiCallsDay']=0x0;_0x15d4db[_0x337d7d]['outboundAnswerCallsDay']=0x0;_0x15d4db[_0x337d7d][_0x1286('0x40')]=!![];}}}}Realtime[_0x1286('0x41')][_0x1286('0x42')]=function(_0x8bd4ce,_0x11cc7a){for(var _0x5b5914 in _0x11cc7a){if(_0x8bd4ce['hasOwnProperty'](_0x5b5914)){_0x8bd4ce[_0x5b5914]=_0x11cc7a[_0x5b5914];}}};Realtime['prototype'][_0x1286('0x43')]=function(){var _0x747803=this;return function(_0x34169b){if(_0x34169b){freeIsNotKeyAgent(_0x34169b,_0x747803[_0x1286('0x44')]);for(var _0x4bf462=0x0,_0x27b049={},_0xf83741={};_0x4bf462<_0x34169b[_0x1286('0x45')];_0x4bf462+=0x1){_0x27b049=_0x34169b[_0x4bf462];var _0x563daf=_[_0x1286('0x2a')](_0x27b049[_0x1286('0x2b')])?util[_0x1286('0x2c')](_0x1286('0x28'),_0x27b049[_0x1286('0x29')]):_0x27b049['interface'];if(_[_0x1286('0x46')](_0x747803[_0x1286('0x44')][_0x563daf])){_0x747803[_0x1286('0x44')][_0x563daf]=new Agent(_0x27b049);}else{_0x747803[_0x1286('0x42')](_0x747803['agents'][_0x563daf],_0x27b049);}}}return _0x747803[_0x1286('0x44')];};};Realtime[_0x1286('0x41')][_0x1286('0x47')]=function(){var _0x56511d=this;return function(_0x7e2bc1){if(_0x7e2bc1){freeIsNotKeySip(_0x7e2bc1,_0x56511d[_0x1286('0x14')]);for(var _0xd42ddb=0x0,_0xee8fe0={},_0x41c444={};_0xd42ddb<_0x7e2bc1[_0x1286('0x45')];_0xd42ddb+=0x1){_0xee8fe0=_0x7e2bc1[_0xd42ddb];if(_['isUndefined'](_0x56511d[_0x1286('0x14')][util['format'](_0x1286('0x28'),_0xee8fe0[_0x1286('0x29')])])){_0x56511d['telephones'][util[_0x1286('0x2c')](_0x1286('0x28'),_0xee8fe0[_0x1286('0x29')])]=new Telephone(_0xee8fe0);}else{_0x56511d[_0x1286('0x42')](_0x56511d[_0x1286('0x14')][util['format'](_0x1286('0x28'),_0xee8fe0[_0x1286('0x29')])],_0xee8fe0);}}}return _0x56511d[_0x1286('0x14')];};};Realtime[_0x1286('0x41')][_0x1286('0x48')]=function(){var _0x546bd7=this;return function(_0x2e1948){if(_0x2e1948){freeIsNotKeySip(_0x2e1948,_0x546bd7[_0x1286('0x15')]);for(var _0x74a65e=0x0,_0x4b3696={},_0x47c0be={};_0x74a65e<_0x2e1948['length'];_0x74a65e+=0x1){_0x4b3696=_0x2e1948[_0x74a65e];if(_[_0x1286('0x46')](_0x546bd7[_0x1286('0x15')][util[_0x1286('0x2c')](_0x1286('0x28'),_0x4b3696[_0x1286('0x29')])])){_0x546bd7[_0x1286('0x15')][util['format'](_0x1286('0x28'),_0x4b3696[_0x1286('0x29')])]=new Trunk(_0x4b3696);}else{_0x546bd7[_0x1286('0x42')](_0x546bd7['trunks'][util[_0x1286('0x2c')](_0x1286('0x28'),_0x4b3696[_0x1286('0x29')])],_0x4b3696);}}}return _0x546bd7['trunks'];};};Realtime['prototype'][_0x1286('0x49')]=function(){var _0xbf6e5f=this;return function(_0x46ace8){if(_0x46ace8){freeIsNotKey(_0x46ace8,_0xbf6e5f[_0x1286('0x16')],'name');for(var _0x4a84cb=0x0,_0x2675a4={},_0xdc05ab={};_0x4a84cb<_0x46ace8[_0x1286('0x45')];_0x4a84cb+=0x1){_0x2675a4=_0x46ace8[_0x4a84cb];if(_[_0x1286('0x46')](_0xbf6e5f[_0x1286('0x16')][_0x2675a4[_0x1286('0x29')]])){_0xbf6e5f[_0x1286('0x16')][_0x2675a4[_0x1286('0x29')]]=new VoiceQueue(_0x2675a4);}else{_0xbf6e5f[_0x1286('0x42')](_0xbf6e5f[_0x1286('0x16')][_0x2675a4['name']],_0x2675a4);}}}return _0xbf6e5f[_0x1286('0x16')];};};Realtime[_0x1286('0x41')]['initTriggers']=function(){var _0x857e81=this;return function(_0x4dc714){if(_0x4dc714){freeIsNotKey(_0x4dc714,_0x857e81[_0x1286('0x4a')],'id');for(var _0x5aa5ce=0x0,_0x4e5b2c={},_0x474122={};_0x5aa5ce<_0x4dc714[_0x1286('0x45')];_0x5aa5ce+=0x1){_0x4e5b2c=_0x4dc714[_0x5aa5ce];if(_[_0x1286('0x46')](_0x857e81[_0x1286('0x4a')][_0x4e5b2c['id']])){_0x857e81['triggers'][_0x4e5b2c['id']]=new Trigger(_0x4e5b2c);}else{_0x857e81[_0x1286('0x42')](_0x857e81[_0x1286('0x4a')][_0x4e5b2c['id']],_0x4e5b2c);}}}return _0x857e81['triggers'];};};Realtime[_0x1286('0x41')][_0x1286('0x4b')]=function(){var _0x13f6bb=this;return function(_0x3432e7){if(_0x3432e7){freeIsNotKey(_0x3432e7,_0x13f6bb[_0x1286('0x18')],'id');for(var _0x154346=0x0,_0x422be4={},_0x8e4083={};_0x154346<_0x3432e7[_0x1286('0x45')];_0x154346+=0x1){_0x422be4=_0x3432e7[_0x154346];if(_[_0x1286('0x46')](_0x13f6bb[_0x1286('0x18')][_0x422be4['id']])){_0x13f6bb[_0x1286('0x18')][_0x422be4['id']]=new Template(_0x422be4);}else{_0x13f6bb[_0x1286('0x42')](_0x13f6bb[_0x1286('0x18')][_0x422be4['id']],_0x422be4);}}}return _0x13f6bb[_0x1286('0x18')];};};Realtime[_0x1286('0x41')][_0x1286('0x4c')]=function(){var _0x4e0bca=this;return function(_0x7abef){if(_0x7abef){freeIsNotKey(_0x7abef,_0x4e0bca[_0x1286('0x1d')],'id');for(var _0x47c88d=0x0,_0xd4cb5e={},_0x596640={};_0x47c88d<_0x7abef[_0x1286('0x45')];_0x47c88d+=0x1){_0xd4cb5e=_0x7abef[_0x47c88d];if(_['isUndefined'](_0x4e0bca[_0x1286('0x1d')][_0xd4cb5e['id']])){_0x4e0bca[_0x1286('0x1d')][_0xd4cb5e['id']]=new ZendeskAccount(_0xd4cb5e);}else{_0x4e0bca[_0x1286('0x42')](_0x4e0bca[_0x1286('0x1d')][_0xd4cb5e['id']],_0xd4cb5e);}}}return _0x4e0bca['zendeskAccounts'];};};Realtime[_0x1286('0x41')][_0x1286('0x4d')]=function(){var _0x5ce98a=this;return function(_0x3fa61d){if(_0x3fa61d){freeIsNotKey(_0x3fa61d,_0x5ce98a['salesforceAccounts'],'id');for(var _0x215a6c=0x0,_0x21adee={},_0x161db8={};_0x215a6c<_0x3fa61d[_0x1286('0x45')];_0x215a6c+=0x1){_0x21adee=_0x3fa61d[_0x215a6c];if(_[_0x1286('0x46')](_0x5ce98a['salesforceAccounts'][_0x21adee['id']])){_0x5ce98a['salesforceAccounts'][_0x21adee['id']]=new SalesforceAccount(_0x21adee);}else{_0x5ce98a[_0x1286('0x42')](_0x5ce98a[_0x1286('0x1e')][_0x21adee['id']],_0x21adee);}}}return _0x5ce98a[_0x1286('0x1e')];};};Realtime[_0x1286('0x41')]['initFreshdeskAccounts']=function(){var _0x14d21b=this;return function(_0x39fb37){if(_0x39fb37){freeIsNotKey(_0x39fb37,_0x14d21b['freshdeskAccounts'],'id');for(var _0x21d13f=0x0,_0xfde511={},_0x4c9d5f={};_0x21d13f<_0x39fb37[_0x1286('0x45')];_0x21d13f+=0x1){_0xfde511=_0x39fb37[_0x21d13f];if(_['isUndefined'](_0x14d21b[_0x1286('0x1f')][_0xfde511['id']])){_0x14d21b['freshdeskAccounts'][_0xfde511['id']]=new FreshdeskAccount(_0xfde511);}else{_0x14d21b['mergeFromDatabase'](_0x14d21b[_0x1286('0x1f')][_0xfde511['id']],_0xfde511);}}}return _0x14d21b[_0x1286('0x1f')];};};Realtime['prototype'][_0x1286('0x4e')]=function(){var _0x19cfa1=this;return function(_0x12e8ae){if(_0x12e8ae){freeIsNotKey(_0x12e8ae,_0x19cfa1[_0x1286('0x20')],'id');for(var _0x5466ef=0x0,_0x1f2c2b={},_0x1ac32a={};_0x5466ef<_0x12e8ae[_0x1286('0x45')];_0x5466ef+=0x1){_0x1f2c2b=_0x12e8ae[_0x5466ef];if(_[_0x1286('0x46')](_0x19cfa1[_0x1286('0x20')][_0x1f2c2b['id']])){_0x19cfa1[_0x1286('0x20')][_0x1f2c2b['id']]=new ZohoAccount(_0x1f2c2b);}else{_0x19cfa1[_0x1286('0x42')](_0x19cfa1['zohoAccounts'][_0x1f2c2b['id']],_0x1f2c2b);}}}return _0x19cfa1[_0x1286('0x20')];};};Realtime[_0x1286('0x41')][_0x1286('0x4f')]=function(){var _0x4e8ade=this;return function(_0x5d15ef){if(_0x5d15ef){freeIsNotKey(_0x5d15ef,_0x4e8ade[_0x1286('0x21')],'id');for(var _0x284fd1=0x0,_0x35f114={},_0x454ae7={};_0x284fd1<_0x5d15ef['length'];_0x284fd1+=0x1){_0x35f114=_0x5d15ef[_0x284fd1];if(_[_0x1286('0x46')](_0x4e8ade[_0x1286('0x21')][_0x35f114['id']])){_0x4e8ade[_0x1286('0x21')][_0x35f114['id']]=new DeskAccount(_0x35f114);}else{_0x4e8ade[_0x1286('0x42')](_0x4e8ade[_0x1286('0x21')][_0x35f114['id']],_0x35f114);}}}return _0x4e8ade[_0x1286('0x21')];};};Realtime['prototype'][_0x1286('0x50')]=function(){var _0x5588b1=this;return function(_0x155a82){if(_0x155a82){freeIsNotKey(_0x155a82,_0x5588b1[_0x1286('0x51')],'id');for(var _0x22fd3a=0x0,_0x37e6eb={},_0x4ceda5={};_0x22fd3a<_0x155a82[_0x1286('0x45')];_0x22fd3a+=0x1){_0x37e6eb=_0x155a82[_0x22fd3a];if(_['isUndefined'](_0x5588b1[_0x1286('0x51')][_0x37e6eb['id']])){_0x5588b1[_0x1286('0x51')][_0x37e6eb['id']]=new SugarcrmAccount(_0x37e6eb);}else{_0x5588b1[_0x1286('0x42')](_0x5588b1['sugarcrmAccounts'][_0x37e6eb['id']],_0x37e6eb);}}}return _0x5588b1['sugarcrmAccounts'];};};Realtime['prototype'][_0x1286('0x52')]=function(){var _0x5516fa=this;return function(_0x390ab2){if(_0x390ab2){freeIsNotKey(_0x390ab2,_0x5516fa[_0x1286('0x22')],'id');for(var _0x4163e0=0x0,_0x141236={},_0x5039e0={};_0x4163e0<_0x390ab2['length'];_0x4163e0+=0x1){_0x141236=_0x390ab2[_0x4163e0];if(_[_0x1286('0x46')](_0x5516fa[_0x1286('0x22')][_0x141236['id']])){_0x5516fa[_0x1286('0x22')][_0x141236['id']]=new VtigerAccount(_0x141236);}else{_0x5516fa[_0x1286('0x42')](_0x5516fa[_0x1286('0x22')][_0x141236['id']],_0x141236);}}}return _0x5516fa[_0x1286('0x22')];};};Realtime[_0x1286('0x41')][_0x1286('0x53')]=function(){var _0x5e2c2e=this;return function(_0x3cc672){if(_0x3cc672){freeIsNotKey(_0x3cc672,_0x5e2c2e[_0x1286('0x23')],'id');for(var _0x5d1493=0x0,_0x4393ad={},_0x1f5d7e={};_0x5d1493<_0x3cc672[_0x1286('0x45')];_0x5d1493+=0x1){_0x4393ad=_0x3cc672[_0x5d1493];if(_[_0x1286('0x46')](_0x5e2c2e['servicenowAccounts'][_0x4393ad['id']])){_0x5e2c2e[_0x1286('0x23')][_0x4393ad['id']]=new ServicenowAccount(_0x4393ad);}else{_0x5e2c2e[_0x1286('0x42')](_0x5e2c2e['servicenowAccounts'][_0x4393ad['id']],_0x4393ad);}}}return _0x5e2c2e[_0x1286('0x23')];};};Realtime['prototype'][_0x1286('0x54')]=function(){var _0xc9b7e0=this;return function(_0x4f6ba1){if(_0x4f6ba1){freeIsNotKey(_0x4f6ba1,_0xc9b7e0['dynamics365Accounts'],'id');for(var _0x3137ba=0x0,_0x4cf6bd={},_0xcb5973={};_0x3137ba<_0x4f6ba1['length'];_0x3137ba+=0x1){_0x4cf6bd=_0x4f6ba1[_0x3137ba];if(_['isUndefined'](_0xc9b7e0['dynamics365Accounts'][_0x4cf6bd['id']])){_0xc9b7e0[_0x1286('0x24')][_0x4cf6bd['id']]=new Dynamics365Account(_0x4cf6bd);}else{_0xc9b7e0[_0x1286('0x42')](_0xc9b7e0[_0x1286('0x24')][_0x4cf6bd['id']],_0x4cf6bd);}}}return _0xc9b7e0['dynamics365Accounts'];};};Realtime['prototype'][_0x1286('0x55')]=function(){var _0x24a1d7=this;return function(_0x452118){if(_0x452118){freeIsNotKey(_0x452118,_0x24a1d7[_0x1286('0x25')],'id');for(var _0x236c49=0x0,_0x209c4d={},_0x3fee9f={};_0x236c49<_0x452118[_0x1286('0x45')];_0x236c49+=0x1){_0x209c4d=_0x452118[_0x236c49];if(_[_0x1286('0x46')](_0x24a1d7[_0x1286('0x25')][_0x209c4d['id']])){_0x24a1d7[_0x1286('0x25')][_0x209c4d['id']]=new FreshsalesAccount(_0x209c4d);}else{_0x24a1d7[_0x1286('0x42')](_0x24a1d7[_0x1286('0x25')][_0x209c4d['id']],_0x209c4d);}}}return _0x24a1d7['freshsalesAccounts'];};};Realtime[_0x1286('0x41')]['initVoiceQueueHopperHistory']=function(){var _0x3ef05a=this;return function(_0x3327fb){for(var _0x293451=0x0;_0x293451<_0x3327fb[_0x1286('0x45')];_0x293451+=0x1){_[_0x1286('0x56')](_0x3ef05a[_0x1286('0x16')][_0x3327fb[_0x293451][_0x1286('0x29')]],_0x3327fb[_0x293451]);}return _0x3ef05a[_0x1286('0x16')];};};Realtime[_0x1286('0x41')][_0x1286('0x57')]=function(){var _0x1ff4a3=this;return function(_0x14bf4c){clearVoiceQueues(_0x1ff4a3[_0x1286('0x16')]);if(_0x14bf4c){_0x14bf4c=_[_0x1286('0x58')](_0x14bf4c,_0x1286('0x59'));for(var _0x439284 in _0x14bf4c){if(_0x14bf4c[_0x1286('0x27')](_0x439284)){var _0xfb0ccc={};for(var _0x2f842c=0x0;_0x2f842c<_0x14bf4c[_0x439284]['length'];_0x2f842c+=0x1){var _0x4ce2ad=_0x14bf4c[_0x439284][_0x2f842c][_0x1286('0x5a')];if(_0x1ff4a3[_0x1286('0x16')][_0x4ce2ad]){if(_0x14bf4c[_0x439284][_0x2f842c][_0x1286('0x5b')]){_0x1ff4a3[_0x1286('0x16')][_0x4ce2ad][_0x1286('0x5c')]+=0x1;}if(_0x14bf4c[_0x439284][_0x2f842c][_0x1286('0x5d')]){_0x1ff4a3[_0x1286('0x16')][_0x4ce2ad]['abandoned']+=0x1;}_0x1ff4a3[_0x1286('0x16')][_0x4ce2ad][_0x1286('0x5e')]+=moment(_0x14bf4c[_0x439284][_0x2f842c][_0x1286('0x5f')])[_0x1286('0x60')](moment(_0x14bf4c[_0x439284][_0x2f842c][_0x1286('0x61')]),_0x1286('0x62'))||0x0;if(_0x2f842c===_0x14bf4c[_0x439284]['length']-0x1){_0x1ff4a3[_0x1286('0x16')][_0x4ce2ad]['sumDuration']+=moment(_0x14bf4c[_0x439284][_0x2f842c]['queuecallercompleteAt']||_0x14bf4c[_0x439284][_0x2f842c]['queuecallerabandonAt']||_0x14bf4c[_0x439284][_0x2f842c][_0x1286('0x63')])[_0x1286('0x60')](moment(_0x14bf4c[_0x439284][_0x2f842c]['queuecallerjoinAt']),'seconds')||0x0;_0x1ff4a3['voiceQueues'][_0x4ce2ad][_0x1286('0x2d')]+=0x1;if(_0x14bf4c[_0x439284][_0x2f842c]['queuecallercomplete']){_0x1ff4a3[_0x1286('0x16')][_0x4ce2ad][_0x1286('0x2e')]+=0x1;_0x1ff4a3[_0x1286('0x16')][_0x4ce2ad][_0x1286('0x34')]+=moment(_0x14bf4c[_0x439284][_0x2f842c]['queuecallercompleteAt'])[_0x1286('0x60')](moment(_0x14bf4c[_0x439284][_0x2f842c][_0x1286('0x5f')]),_0x1286('0x62'))||0x0;}}else{_0x1ff4a3[_0x1286('0x16')][_0x4ce2ad][_0x1286('0x2f')]+=_0x1ff4a3[_0x1286('0x16')][_0x4ce2ad][_0x1286('0x5e')]||0x0;}}}}}}return _0x1ff4a3[_0x1286('0x16')];};};Realtime[_0x1286('0x41')][_0x1286('0x64')]=function(){var _0x64dad4=this;return function(_0x1a0e6c){clearVoiceCallReports(_0x64dad4[_0x1286('0x19')]);if(_0x1a0e6c){for(var _0x4430b8=0x0;_0x4430b8<_0x1a0e6c[_0x1286('0x45')];_0x4430b8+=0x1){_0x64dad4[_0x1286('0x19')]['total']+=0x1;_0x64dad4[_0x1286('0x19')]['sumDuration']+=_0x1a0e6c[_0x4430b8][_0x1286('0x65')];if(_0x1a0e6c[_0x4430b8][_0x1286('0x66')]===_0x1286('0x67')){_0x64dad4[_0x1286('0x19')]['answered']+=0x1;_0x64dad4['outbound'][_0x1286('0x5e')]+=_0x1a0e6c[_0x4430b8]['duration']-_0x1a0e6c[_0x4430b8][_0x1286('0x68')]||0x0;_0x64dad4[_0x1286('0x19')][_0x1286('0x34')]+=_0x1a0e6c[_0x4430b8][_0x1286('0x68')];}}}return _0x64dad4['outbound'];};};Realtime[_0x1286('0x41')]['initCampaigns']=function(){var _0x2bedd1=this;return function(_0x4d580d){if(_0x4d580d){freeIsNotKey(_0x4d580d,_0x2bedd1[_0x1286('0x17')],'name');for(var _0x15063f=0x0,_0x59a402={};_0x15063f<_0x4d580d['length'];_0x15063f+=0x1){_0x59a402=_0x4d580d[_0x15063f];if(_[_0x1286('0x46')](_0x2bedd1[_0x1286('0x17')][_0x59a402[_0x1286('0x29')]])){_0x2bedd1[_0x1286('0x17')][_0x59a402['name']]=new Campaign(_0x59a402);}else{_0x2bedd1[_0x1286('0x42')](_0x2bedd1['campaigns'][_0x59a402[_0x1286('0x29')]],_0x59a402);}}}return _0x2bedd1['campaigns'];};};Realtime[_0x1286('0x41')]['initVoiceExtensions']=function(){var _0x60e683=this;return function(_0x16baa1){if(_0x16baa1){freeIsNotKey(_0x16baa1,_0x60e683[_0x1286('0x1a')],'id');for(var _0x1970f9=0x0,_0x1d6b25={};_0x1970f9<_0x16baa1[_0x1286('0x45')];_0x1970f9+=0x1){_0x1d6b25=_0x16baa1[_0x1970f9];if(_['isUndefined'](_0x60e683[_0x1286('0x1a')][_0x1d6b25['id']])){_0x60e683[_0x1286('0x1a')][_0x1d6b25['id']]=new VoiceExtension(_0x1d6b25);}else{_0x60e683[_0x1286('0x42')](_0x60e683[_0x1286('0x1a')][_0x1d6b25['id']],_0x1d6b25);}}}return _0x60e683[_0x1286('0x1a')];};};Realtime[_0x1286('0x41')][_0x1286('0x69')]=function(){var _0x45e791=this;return function(_0x24c56a){clearCampaigns(_0x45e791[_0x1286('0x17')]);for(var _0x499597=0x0;_0x499597<_0x24c56a[_0x1286('0x45')];_0x499597+=0x1){_[_0x1286('0x56')](_0x45e791['campaigns'][_0x24c56a[_0x499597][_0x1286('0x29')]],_0x24c56a[_0x499597]);}return _0x45e791[_0x1286('0x17')];};};Realtime[_0x1286('0x41')][_0x1286('0x6a')]=function(){var _0x5ddfde=this;return function(_0x43581e){if(_0x43581e){freeIsNotKey(_0x43581e,_0x5ddfde['faxAccounts'],'id');for(var _0x4e082a=0x0,_0x682c9b={},_0x4d4296={};_0x4e082a<_0x43581e[_0x1286('0x45')];_0x4e082a+=0x1){_0x682c9b=_0x43581e[_0x4e082a];if(_[_0x1286('0x46')](_0x5ddfde[_0x1286('0x26')][_0x682c9b['id']])){_0x5ddfde[_0x1286('0x26')][_0x682c9b['id']]=new FaxAccount(_0x682c9b);}else{_0x5ddfde[_0x1286('0x42')](_0x5ddfde['faxAccounts'][_0x682c9b['id']],_0x682c9b);}}}return _0x5ddfde['faxAccounts'];};};module[_0x1286('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 91bdf69..9cbce8a 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 _0x84ae=['exten','dialer','lastapplication','queue','context','from-voip-provider','callerid','xcally-motion-preview','calleridnum','originatecalleridnum','channel','destinationchannel','calleridpreview','ANSWERED','\x22%s\x22\x20<%s>','monitor','monitors','monitorFilename','createdAt','calleridname','membername','voiceAgentReport','forEach','startsWith','Local','substring','indexOf','phone','lastIndexOf','blindTransfer','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','../rpc/voiceAgentReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','interface','format','length','connectedlinenum','assigned','lastAssignedTo','isNil','SIP/%s','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','voiceCallReport','destination'];(function(_0x3868ff,_0x350373){var _0x444aee=function(_0x3df0d0){while(--_0x3df0d0){_0x3868ff['push'](_0x3868ff['shift']());}};_0x444aee(++_0x350373);}(_0x84ae,0x1be));var _0xe84a=function(_0x210b8c,_0xd76f59){_0x210b8c=_0x210b8c-0x0;var _0xf39efa=_0x84ae[_0x210b8c];return _0xf39efa;};'use strict';var BPromise=require('bluebird');var _=require(_0xe84a('0x0'));var moment=require(_0xe84a('0x1'));var util=require(_0xe84a('0x2'));var config=require(_0xe84a('0x3'));var logger=require(_0xe84a('0x4'))(_0xe84a('0x5'));var ami=require(_0xe84a('0x6'));var RpcVoiceAgentReport=require(_0xe84a('0x7'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xe84a('0x8'));var RpcVoiceQueueReport=require(_0xe84a('0x9'));var RpcVoiceRecording=require(_0xe84a('0xa'));var RpcVoiceTransferReport=require(_0xe84a('0xb'));var VoiceQueueReport=require(_0xe84a('0xc'));var VoiceCallReport=require(_0xe84a('0xd'));var VoiceAgentReport=require(_0xe84a('0xe'));var VoiceDialReport=require(_0xe84a('0xf'));var UserReport=require(_0xe84a('0x10'));function Report(_0x3a0389){this[_0xe84a('0x11')]=_0x3a0389;this['agents']=_0x3a0389[_0xe84a('0x12')];this['telephones']=_0x3a0389[_0xe84a('0x13')];}Report[_0xe84a('0x14')]['sync']=function(_0x2a88b9){var _0x522a87=new VoiceQueueReport(this[_0xe84a('0x11')]);var _0x233554=new VoiceAgentReport(this[_0xe84a('0x11')]);var _0x436c0f=new VoiceDialReport(this[_0xe84a('0x11')]);var _0x55dab7=new VoiceCallReport(this[_0xe84a('0x11')]);var _0x9af1c7=new UserReport(this[_0xe84a('0x11')]);if(config[_0xe84a('0x15')]&&config['xdr'][_0xe84a('0x16')]){ami['on'](_0xe84a('0x17'),this[_0xe84a('0x18')][_0xe84a('0x19')](this));ami['on'](_0xe84a('0x1a'),this['voiceCallReport']['bind'](this));ami['on'](_0xe84a('0x1b'),this['voiceAgentReport'][_0xe84a('0x19')](this));ami['on']('custom:voiceDialReport',this[_0xe84a('0x1c')][_0xe84a('0x19')](this));ami['on'](_0xe84a('0x1d'),this['blindTransfer'][_0xe84a('0x19')](this));ami['on'](_0xe84a('0x1e'),this[_0xe84a('0x1f')]['bind'](this));}};Report['prototype'][_0xe84a('0x20')]=function(_0x73dceb){var _0x1f9a6a=undefined;_0x1f9a6a=_[_0xe84a('0x21')](this[_0xe84a('0x12')],function(_0x23b6a6){return _0x23b6a6[_0xe84a('0x22')]==_0x73dceb||_0x23b6a6['name']==_0x73dceb;});if(_['isNil'](_0x1f9a6a)){var _0x1bf229=_[_0xe84a('0x21')](this[_0xe84a('0x13')],function(_0x35ffc8){return _0x35ffc8[_0xe84a('0x22')]==_0x73dceb||_0x35ffc8[_0xe84a('0x23')]==_0x73dceb;});if(_0x1bf229){_0x1f9a6a=_['find'](this[_0xe84a('0x12')],function(_0xf3662f){return _0xf3662f[_0xe84a('0x24')]==util[_0xe84a('0x25')]('SIP/%s',_0x1bf229[_0xe84a('0x23')]);});}}return _0x1f9a6a;};Report[_0xe84a('0x14')][_0xe84a('0x18')]=function(_0x2f68ac){for(var _0x5b54cf=0x0;_0x5b54cf<_0x2f68ac[_0xe84a('0x26')];_0x5b54cf+=0x1){var _0x1799ca=this['findAgent'](_0x2f68ac[_0x5b54cf][_0xe84a('0x27')]);if(_0x1799ca){_0x2f68ac[_0x5b54cf]['accountcode']=_0x1799ca[_0xe84a('0x22')];_0x2f68ac[_0x5b54cf][_0xe84a('0x28')]=!![];_0x2f68ac[_0x5b54cf][_0xe84a('0x29')]=_0x1799ca[_0xe84a('0x23')];_0x2f68ac[_0x5b54cf]['interface']=_[_0xe84a('0x2a')](_0x1799ca[_0xe84a('0x24')])?util[_0xe84a('0x25')](_0xe84a('0x2b'),_0x1799ca[_0xe84a('0x23')]):_0x1799ca['interface'];if(_0x2f68ac[_0x5b54cf][_0xe84a('0x2c')]){_0x2f68ac[_0x5b54cf]['queuecallercompleteAt']=moment()[_0xe84a('0x25')](_0xe84a('0x2d'));}if(_0x2f68ac[_0x5b54cf][_0xe84a('0x2e')]){_0x2f68ac[_0x5b54cf][_0xe84a('0x2f')]=moment()[_0xe84a('0x25')](_0xe84a('0x2d'));}RpcMemberReport[_0xe84a('0x18')](_0x2f68ac[_0x5b54cf]);}RpcVoiceQueueReport[_0xe84a('0x30')](_0x2f68ac[_0x5b54cf]);}};function extractCalleridNumber(_0x5f4553){var _0x498152=_0x5f4553[_0xe84a('0x31')](/<(.*?)>/);return _0x498152?_0x498152[0x1]:_0x5f4553;}Report[_0xe84a('0x14')][_0xe84a('0x32')]=function(_0x20cf78){_0x20cf78[_0xe84a('0x33')]=_0x20cf78[_0xe84a('0x33')]||_0x20cf78[_0xe84a('0x34')];if(_0x20cf78['type']==_0xe84a('0x35')){_0x20cf78[_0xe84a('0x36')]=_0xe84a('0x37');_0x20cf78['lastdata']=_0x20cf78['queue'];if(_0x20cf78[_0xe84a('0x38')]==_0xe84a('0x39')){_0x20cf78[_0xe84a('0x22')]='';_0x20cf78[_0xe84a('0x33')]=extractCalleridNumber(_0x20cf78[_0xe84a('0x3a')]);}else if(_0x20cf78[_0xe84a('0x38')]=='from-sip'){if(_0x20cf78['destination']==_0xe84a('0x3b')){_0x20cf78['destination']=extractCalleridNumber(_0x20cf78['calleridpreview']);_0x20cf78[_0xe84a('0x3c')]=_0x20cf78[_0xe84a('0x3d')];_0x20cf78['destinationchannel']=[_0x20cf78[_0xe84a('0x3e')],_0x20cf78['channel']=_0x20cf78[_0xe84a('0x3f')]][0x0];_0x20cf78[_0xe84a('0x3a')]=_0x20cf78[_0xe84a('0x40')];}else{_0x20cf78[_0xe84a('0x33')]=_0x20cf78[_0xe84a('0x3c')];_0x20cf78['calleridnum']=_0x20cf78[_0xe84a('0x3d')];if(_0x20cf78['disposition']==_0xe84a('0x41')){_0x20cf78['accountcode']=_0x20cf78[_0xe84a('0x27')];}else{_0x20cf78[_0xe84a('0x22')]='';}}}}else{_0x20cf78[_0xe84a('0x3a')]=util[_0xe84a('0x25')](_0xe84a('0x42'),_0x20cf78['calleridname'],_0x20cf78[_0xe84a('0x3c')]);}RpcVoiceCallReport[_0xe84a('0x30')](_0x20cf78);if(_0x20cf78[_0xe84a('0x43')]){for(var _0x3eb0cb=0x0;_0x3eb0cb<_0x20cf78[_0xe84a('0x44')][_0xe84a('0x26')];_0x3eb0cb+=0x1){_0x20cf78[_0xe84a('0x45')]=_0x20cf78[_0xe84a('0x44')][_0x3eb0cb]['filename'];_0x20cf78[_0xe84a('0x46')]=_0x20cf78[_0xe84a('0x44')][_0x3eb0cb][_0xe84a('0x46')];if(_0x20cf78[_0xe84a('0x34')]=='xcally-motion-preview'){_0x20cf78[_0xe84a('0x3c')]=_0x20cf78[_0xe84a('0x27')];_0x20cf78[_0xe84a('0x47')]=_0x20cf78['connectedlinename'];_0x20cf78[_0xe84a('0x27')]=_0x20cf78[_0xe84a('0x22')];_0x20cf78['connectedlinename']=_0x20cf78[_0xe84a('0x48')];_0x20cf78['exten']=_0x20cf78[_0xe84a('0x3d')];}else if(_0x20cf78[_0xe84a('0x34')]=='xcally-motion-dialer'){_0x20cf78[_0xe84a('0x3c')]=_0x20cf78[_0xe84a('0x33')];_0x20cf78[_0xe84a('0x34')]=_0x20cf78[_0xe84a('0x3d')];}RpcVoiceRecording[_0xe84a('0x30')](_0x20cf78);}}};Report[_0xe84a('0x14')][_0xe84a('0x49')]=function(_0x4901fb){if(_['isArray'](_0x4901fb)){_0x4901fb[_0xe84a('0x4a')](function(_0x268a9d){RpcVoiceAgentReport[_0xe84a('0x30')](_0x268a9d);});}else{RpcVoiceAgentReport[_0xe84a('0x30')](_0x4901fb);}};Report[_0xe84a('0x14')][_0xe84a('0x1c')]=function(_0x349984){RpcVoiceDialReport[_0xe84a('0x30')](_0x349984);var _0x4d055b=undefined;var _0x28168b=_0x349984[_0xe84a('0x3e')];if(_[_0xe84a('0x4b')](_0x28168b,_0xe84a('0x4c'))){var _0x5a1aed=_0x28168b[_0xe84a('0x4d')](_0x28168b[_0xe84a('0x4e')]('/')+0x1,_0x28168b[_0xe84a('0x4e')]('@'));_0x4d055b=_[_0xe84a('0x21')](this['agents'],function(_0x55586a){return _0x55586a['mobile']==_0x5a1aed||_0x55586a[_0xe84a('0x4f')]==_0x5a1aed||_0x55586a[_0xe84a('0x22')]==_0x5a1aed;});}else{var _0x5a1aed=_0x28168b['substring'](_0x28168b[_0xe84a('0x4e')]('/')+0x1,_0x28168b[_0xe84a('0x50')]('-'));_0x4d055b=this[_0xe84a('0x20')](_0x5a1aed);}if(_0x4d055b){_0x349984[_0xe84a('0x24')]=_[_0xe84a('0x2a')](_0x4d055b[_0xe84a('0x24')])?util[_0xe84a('0x25')]('SIP/%s',_0x4d055b['name']):_0x4d055b[_0xe84a('0x24')];_0x349984[_0xe84a('0x48')]=_0x4d055b[_0xe84a('0x23')];_0x349984[_0xe84a('0x22')]=_0x4d055b[_0xe84a('0x22')];RpcMemberReport[_0xe84a('0x1c')](_0x349984);}};Report[_0xe84a('0x14')][_0xe84a('0x51')]=function(_0x59ee48){RpcVoiceTransferReport['blindTransfer'](_0x59ee48);};Report[_0xe84a('0x14')][_0xe84a('0x1f')]=function(_0x25e193){RpcVoiceTransferReport[_0xe84a('0x1f')](_0x25e193);};module[_0xe84a('0x52')]=Report; \ No newline at end of file +var _0xd325=['disposition','callerid','\x22%s\x22\x20<%s>','calleridname','create','monitor','monitors','monitorFilename','filename','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','isArray','startsWith','Local','substring','indexOf','mobile','phone','blindTransfer','bluebird','lodash','util','../../../config/environment','../../../config/logger','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','attendedtransfer','attendedTransfer','findAgent','find','accountcode','isNil','name','format','SIP/%s','length','connectedlinenum','lastAssignedTo','interface','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','match','destination','dialer','lastapplication','lastdata','queue','from-voip-provider','from-sip','xcally-motion-preview','destinationchannel','channel','calleridpreview','calleridnum','originatecalleridnum'];(function(_0x4d6bcb,_0x3bc099){var _0x3bca33=function(_0xffeb7c){while(--_0xffeb7c){_0x4d6bcb['push'](_0x4d6bcb['shift']());}};_0x3bca33(++_0x3bc099);}(_0xd325,0x10a));var _0x5d32=function(_0x290694,_0x281935){_0x290694=_0x290694-0x0;var _0x5a0f2e=_0xd325[_0x290694];return _0x5a0f2e;};'use strict';var BPromise=require(_0x5d32('0x0'));var _=require(_0x5d32('0x1'));var moment=require('moment');var util=require(_0x5d32('0x2'));var config=require(_0x5d32('0x3'));var logger=require(_0x5d32('0x4'))('ami');var ami=require(_0x5d32('0x5'));var RpcVoiceAgentReport=require(_0x5d32('0x6'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x5d32('0x7'));var RpcMemberReport=require(_0x5d32('0x8'));var RpcVoiceQueueReport=require(_0x5d32('0x9'));var RpcVoiceRecording=require(_0x5d32('0xa'));var RpcVoiceTransferReport=require(_0x5d32('0xb'));var VoiceQueueReport=require(_0x5d32('0xc'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x5d32('0xd'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x5d32('0xe'));function Report(_0x27c39b){this[_0x5d32('0xf')]=_0x27c39b;this[_0x5d32('0x10')]=_0x27c39b[_0x5d32('0x10')];this[_0x5d32('0x11')]=_0x27c39b[_0x5d32('0x11')];}Report[_0x5d32('0x12')][_0x5d32('0x13')]=function(_0x2d0d2e){var _0x43d6f5=new VoiceQueueReport(this[_0x5d32('0xf')]);var _0x2ba120=new VoiceAgentReport(this[_0x5d32('0xf')]);var _0x30a734=new VoiceDialReport(this[_0x5d32('0xf')]);var _0x10822f=new VoiceCallReport(this['realtime']);var _0x1283fe=new UserReport(this[_0x5d32('0xf')]);if(config[_0x5d32('0x14')]&&config[_0x5d32('0x14')][_0x5d32('0x15')]){ami['on']('custom:voiceQueueReport',this[_0x5d32('0x16')][_0x5d32('0x17')](this));ami['on'](_0x5d32('0x18'),this['voiceCallReport']['bind'](this));ami['on'](_0x5d32('0x19'),this['voiceAgentReport'][_0x5d32('0x17')](this));ami['on'](_0x5d32('0x1a'),this[_0x5d32('0x1b')][_0x5d32('0x17')](this));ami['on']('blindtransfer',this['blindTransfer'][_0x5d32('0x17')](this));ami['on'](_0x5d32('0x1c'),this[_0x5d32('0x1d')][_0x5d32('0x17')](this));}};Report[_0x5d32('0x12')][_0x5d32('0x1e')]=function(_0x3677ce){var _0x5e16de=undefined;_0x5e16de=_[_0x5d32('0x1f')](this[_0x5d32('0x10')],function(_0x43b9e0){return _0x43b9e0[_0x5d32('0x20')]==_0x3677ce||_0x43b9e0['name']==_0x3677ce;});if(_[_0x5d32('0x21')](_0x5e16de)){var _0x1823ed=_['find'](this[_0x5d32('0x11')],function(_0x44aadc){return _0x44aadc[_0x5d32('0x20')]==_0x3677ce||_0x44aadc[_0x5d32('0x22')]==_0x3677ce;});if(_0x1823ed){_0x5e16de=_[_0x5d32('0x1f')](this['agents'],function(_0x1ab0fa){return _0x1ab0fa['interface']==util[_0x5d32('0x23')](_0x5d32('0x24'),_0x1823ed[_0x5d32('0x22')]);});}}return _0x5e16de;};Report[_0x5d32('0x12')]['voiceQueueReport']=function(_0x55ca50){for(var _0x11d25b=0x0;_0x11d25b<_0x55ca50[_0x5d32('0x25')];_0x11d25b+=0x1){var _0x3e47ac=this[_0x5d32('0x1e')](_0x55ca50[_0x11d25b][_0x5d32('0x26')]);if(_0x3e47ac){_0x55ca50[_0x11d25b][_0x5d32('0x20')]=_0x3e47ac['accountcode'];_0x55ca50[_0x11d25b]['assigned']=!![];_0x55ca50[_0x11d25b][_0x5d32('0x27')]=_0x3e47ac[_0x5d32('0x22')];_0x55ca50[_0x11d25b][_0x5d32('0x28')]=_[_0x5d32('0x21')](_0x3e47ac[_0x5d32('0x28')])?util[_0x5d32('0x23')](_0x5d32('0x24'),_0x3e47ac[_0x5d32('0x22')]):_0x3e47ac[_0x5d32('0x28')];if(_0x55ca50[_0x11d25b][_0x5d32('0x29')]){_0x55ca50[_0x11d25b]['queuecallercompleteAt']=moment()[_0x5d32('0x23')](_0x5d32('0x2a'));}if(_0x55ca50[_0x11d25b]['queuecallerexit']){_0x55ca50[_0x11d25b][_0x5d32('0x2b')]=moment()[_0x5d32('0x23')](_0x5d32('0x2a'));}RpcMemberReport[_0x5d32('0x16')](_0x55ca50[_0x11d25b]);}RpcVoiceQueueReport['create'](_0x55ca50[_0x11d25b]);}};function extractCalleridNumber(_0x22d514){var _0x4f884f=_0x22d514[_0x5d32('0x2c')](/<(.*?)>/);return _0x4f884f?_0x4f884f[0x1]:_0x22d514;}Report['prototype']['voiceCallReport']=function(_0x3ba319){_0x3ba319[_0x5d32('0x2d')]=_0x3ba319[_0x5d32('0x2d')]||_0x3ba319['exten'];if(_0x3ba319['type']==_0x5d32('0x2e')){_0x3ba319[_0x5d32('0x2f')]='queue';_0x3ba319[_0x5d32('0x30')]=_0x3ba319[_0x5d32('0x31')];if(_0x3ba319['context']==_0x5d32('0x32')){_0x3ba319['accountcode']='';_0x3ba319[_0x5d32('0x2d')]=extractCalleridNumber(_0x3ba319['callerid']);}else if(_0x3ba319['context']==_0x5d32('0x33')){if(_0x3ba319[_0x5d32('0x2d')]==_0x5d32('0x34')){_0x3ba319['destination']=extractCalleridNumber(_0x3ba319['calleridpreview']);_0x3ba319['calleridnum']=_0x3ba319['originatecalleridnum'];_0x3ba319[_0x5d32('0x35')]=[_0x3ba319[_0x5d32('0x36')],_0x3ba319[_0x5d32('0x36')]=_0x3ba319['destinationchannel']][0x0];_0x3ba319['callerid']=_0x3ba319[_0x5d32('0x37')];}else{_0x3ba319[_0x5d32('0x2d')]=_0x3ba319[_0x5d32('0x38')];_0x3ba319[_0x5d32('0x38')]=_0x3ba319[_0x5d32('0x39')];if(_0x3ba319[_0x5d32('0x3a')]=='ANSWERED'){_0x3ba319[_0x5d32('0x20')]=_0x3ba319[_0x5d32('0x26')];}else{_0x3ba319[_0x5d32('0x20')]='';}}}}else{_0x3ba319[_0x5d32('0x3b')]=util['format'](_0x5d32('0x3c'),_0x3ba319[_0x5d32('0x3d')],_0x3ba319[_0x5d32('0x38')]);}RpcVoiceCallReport[_0x5d32('0x3e')](_0x3ba319);if(_0x3ba319[_0x5d32('0x3f')]){for(var _0x46305b=0x0;_0x46305b<_0x3ba319[_0x5d32('0x40')][_0x5d32('0x25')];_0x46305b+=0x1){_0x3ba319[_0x5d32('0x41')]=_0x3ba319['monitors'][_0x46305b][_0x5d32('0x42')];_0x3ba319[_0x5d32('0x43')]=_0x3ba319[_0x5d32('0x40')][_0x46305b][_0x5d32('0x43')];if(_0x3ba319[_0x5d32('0x44')]==_0x5d32('0x34')){_0x3ba319[_0x5d32('0x38')]=_0x3ba319[_0x5d32('0x26')];_0x3ba319[_0x5d32('0x3d')]=_0x3ba319['connectedlinename'];_0x3ba319[_0x5d32('0x26')]=_0x3ba319[_0x5d32('0x20')];_0x3ba319[_0x5d32('0x45')]=_0x3ba319[_0x5d32('0x46')];_0x3ba319['exten']=_0x3ba319[_0x5d32('0x39')];}else if(_0x3ba319[_0x5d32('0x44')]==_0x5d32('0x47')){_0x3ba319[_0x5d32('0x38')]=_0x3ba319[_0x5d32('0x2d')];_0x3ba319[_0x5d32('0x44')]=_0x3ba319[_0x5d32('0x39')];}RpcVoiceRecording[_0x5d32('0x3e')](_0x3ba319);}}};Report[_0x5d32('0x12')][_0x5d32('0x48')]=function(_0x1f9eaa){if(_[_0x5d32('0x49')](_0x1f9eaa)){_0x1f9eaa['forEach'](function(_0xf0b12d){RpcVoiceAgentReport[_0x5d32('0x3e')](_0xf0b12d);});}else{RpcVoiceAgentReport[_0x5d32('0x3e')](_0x1f9eaa);}};Report[_0x5d32('0x12')][_0x5d32('0x1b')]=function(_0x2910a0){RpcVoiceDialReport[_0x5d32('0x3e')](_0x2910a0);var _0x2ab199=undefined;var _0x20965d=_0x2910a0[_0x5d32('0x36')];if(_[_0x5d32('0x4a')](_0x20965d,_0x5d32('0x4b'))){var _0x4dd07c=_0x20965d[_0x5d32('0x4c')](_0x20965d['indexOf']('/')+0x1,_0x20965d[_0x5d32('0x4d')]('@'));_0x2ab199=_[_0x5d32('0x1f')](this[_0x5d32('0x10')],function(_0x17c25c){return _0x17c25c[_0x5d32('0x4e')]==_0x4dd07c||_0x17c25c[_0x5d32('0x4f')]==_0x4dd07c||_0x17c25c['accountcode']==_0x4dd07c;});}else{var _0x4dd07c=_0x20965d[_0x5d32('0x4c')](_0x20965d[_0x5d32('0x4d')]('/')+0x1,_0x20965d['lastIndexOf']('-'));_0x2ab199=this[_0x5d32('0x1e')](_0x4dd07c);}if(_0x2ab199){_0x2910a0[_0x5d32('0x28')]=_['isNil'](_0x2ab199[_0x5d32('0x28')])?util[_0x5d32('0x23')]('SIP/%s',_0x2ab199['name']):_0x2ab199[_0x5d32('0x28')];_0x2910a0[_0x5d32('0x46')]=_0x2ab199[_0x5d32('0x22')];_0x2910a0['accountcode']=_0x2ab199[_0x5d32('0x20')];RpcMemberReport[_0x5d32('0x1b')](_0x2910a0);}};Report['prototype'][_0x5d32('0x50')]=function(_0x1a96df){RpcVoiceTransferReport[_0x5d32('0x50')](_0x1a96df);};Report['prototype'][_0x5d32('0x1d')]=function(_0x19c513){RpcVoiceTransferReport[_0x5d32('0x1d')](_0x19c513);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 7f9da64..f92851d 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 _0xd8d3=['isUndefined','emit','isNotNull','find','username','state','merge','actionid','format','trunk:%s','name','trunk:save','[syncRegistry][UserReport]','syncDeviceState','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:save','Queue','Local','indexOf','mobile','accountcode','peer','registered','status','address','telephone:%s','[syncPeerStatus][UserReport]','lodash','moment','bluebird','util','ioredis','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionDeviceStateList','actionSipPeerStatus','error','inspect','prototype','actionSipShowRegistry','catch','[loopSyncRealTimeShow]'];(function(_0xd723,_0x164010){var _0x5179d2=function(_0x43b1cb){while(--_0x43b1cb){_0xd723['push'](_0xd723['shift']());}};_0x5179d2(++_0x164010);}(_0xd8d3,0x1a7));var _0x3d8d=function(_0x5c6743,_0x379865){_0x5c6743=_0x5c6743-0x0;var _0x5e4d66=_0xd8d3[_0x5c6743];return _0x5e4d66;};'use strict';var _=require(_0x3d8d('0x0'));var moment=require(_0x3d8d('0x1'));var BPromise=require(_0x3d8d('0x2'));var util=require(_0x3d8d('0x3'));var Redis=require(_0x3d8d('0x4'));var config=require(_0x3d8d('0x5'));var logger=require('../../../config/logger')(_0x3d8d('0x6'));var ami=require(_0x3d8d('0x7'));config[_0x3d8d('0x8')]=_[_0x3d8d('0x9')](config[_0x3d8d('0x8')],{'host':_0x3d8d('0xa'),'port':0x18eb});var io=require(_0x3d8d('0xb'))(new Redis(config[_0x3d8d('0x8')]));function UserReport(_0x3d3e81){this[_0x3d8d('0xc')]=_0x3d3e81[_0x3d8d('0xc')];this['agents']=_0x3d3e81[_0x3d8d('0xd')];this[_0x3d8d('0xe')]=_0x3d3e81[_0x3d8d('0xe')];ami['on'](_0x3d8d('0xf'),this[_0x3d8d('0x10')][_0x3d8d('0x11')](this));ami['on'](_0x3d8d('0x12'),this[_0x3d8d('0x10')]['bind'](this));ami['on']('devicestatechange',this['syncDeviceState'][_0x3d8d('0x11')](this));ami['on'](_0x3d8d('0x13'),this[_0x3d8d('0x14')][_0x3d8d('0x11')](this));this[_0x3d8d('0x15')]();return BPromise[_0x3d8d('0x16')]()[_0x3d8d('0x17')](ami['actionSipShowRegistry']())[_0x3d8d('0x17')](ami[_0x3d8d('0x18')]())[_0x3d8d('0x17')](ami[_0x3d8d('0x19')]())['catch'](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x59c91e){return function(_0x4d4de7){logger[_0x3d8d('0x1a')](_0x59c91e,util[_0x3d8d('0x1b')](_0x4d4de7,{'showHidden':![],'depth':null}));};}UserReport[_0x3d8d('0x1c')][_0x3d8d('0x15')]=function(){setInterval(function(){BPromise[_0x3d8d('0x16')]()['then'](ami[_0x3d8d('0x1d')]())[_0x3d8d('0x17')](ami[_0x3d8d('0x18')]())[_0x3d8d('0x17')](ami[_0x3d8d('0x19')]())[_0x3d8d('0x1e')](loggerCatch(_0x3d8d('0x1f')));},0x32c8);};UserReport[_0x3d8d('0x1c')]['isNotNull']=function(_0x3a1a0b){return _0x3a1a0b!==null&&!_[_0x3d8d('0x20')](_0x3a1a0b);};UserReport[_0x3d8d('0x1c')][_0x3d8d('0x21')]=function(_0x1f0dec,_0x2e5e7d,_0x446449){io['to'](_0x1f0dec)[_0x3d8d('0x21')](_0x2e5e7d,_0x446449);};UserReport['prototype']['syncRegistry']=function(_0xb4fae2){try{if(this[_0x3d8d('0x22')](_0xb4fae2)){var _0x2aaa01=_[_0x3d8d('0x23')](this[_0x3d8d('0xc')],{'registry':_0xb4fae2[_0x3d8d('0x24')]});if(_0x2aaa01){_0xb4fae2['stateRegistry']=_0xb4fae2[_0x3d8d('0x25')];_[_0x3d8d('0x26')](_0x2aaa01,_['omit'](_0xb4fae2,['event',_0x3d8d('0x27'),'username',_0x3d8d('0x25')]));this[_0x3d8d('0x21')](util[_0x3d8d('0x28')](_0x3d8d('0x29'),_0x2aaa01[_0x3d8d('0x2a')]),_0x3d8d('0x2b'),_0x2aaa01);}}}catch(_0x4c03e5){logger[_0x3d8d('0x1a')](_0x3d8d('0x2c'),util[_0x3d8d('0x1b')](_0x4c03e5,{'showHidden':![],'depth':null}));}};UserReport[_0x3d8d('0x1c')][_0x3d8d('0x2d')]=function(_0x58b473){try{if(this[_0x3d8d('0x22')](_0x58b473)){if(this[_0x3d8d('0xd')][_0x58b473[_0x3d8d('0x2e')]]){if(!this['agents'][_0x58b473[_0x3d8d('0x2e')]][_0x3d8d('0x2f')]||_0x58b473[_0x3d8d('0x25')][_0x3d8d('0x30')]()==_0x3d8d('0x31')){this[_0x3d8d('0xd')][_0x58b473[_0x3d8d('0x2e')]][_0x3d8d('0x2f')]=![];if(this[_0x3d8d('0xd')][_0x58b473[_0x3d8d('0x2e')]][_0x3d8d('0x25')]!==_0x58b473['state'][_0x3d8d('0x30')]()){this[_0x3d8d('0xd')][_0x58b473[_0x3d8d('0x2e')]][_0x3d8d('0x32')]=_[_0x3d8d('0x33')](moment()[_0x3d8d('0x28')]('x'));}this[_0x3d8d('0xd')][_0x58b473['device']]['state']=_0x58b473['state'][_0x3d8d('0x30')]();this[_0x3d8d('0xd')][_0x58b473[_0x3d8d('0x2e')]][_0x3d8d('0x34')](_0x58b473);}}else if(this[_0x3d8d('0xe')][_0x58b473[_0x3d8d('0x2e')]]){if(this['telephones'][_0x58b473[_0x3d8d('0x2e')]][_0x3d8d('0x25')]!==_0x58b473[_0x3d8d('0x25')]['toLowerCase']()){this['telephones'][_0x58b473[_0x3d8d('0x2e')]][_0x3d8d('0x32')]=_['toNumber'](moment()[_0x3d8d('0x28')]('x'));}this[_0x3d8d('0xe')][_0x58b473[_0x3d8d('0x2e')]][_0x3d8d('0x25')]=_0x58b473['state'][_0x3d8d('0x30')]();this[_0x3d8d('0x21')](util[_0x3d8d('0x28')]('telephone:%s',this[_0x3d8d('0xe')][_0x58b473[_0x3d8d('0x2e')]][_0x3d8d('0x2a')]),_0x3d8d('0x35'),this[_0x3d8d('0xe')][_0x58b473[_0x3d8d('0x2e')]]);}else if(this[_0x3d8d('0xc')][_0x58b473['device']]){if(this[_0x3d8d('0xc')][_0x58b473[_0x3d8d('0x2e')]]['state']!==_0x58b473[_0x3d8d('0x25')][_0x3d8d('0x30')]()){this['trunks'][_0x58b473['device']][_0x3d8d('0x32')]=_['toNumber'](moment()[_0x3d8d('0x28')]('x'));}this['trunks'][_0x58b473['device']][_0x3d8d('0x25')]=_0x58b473[_0x3d8d('0x25')][_0x3d8d('0x30')]();this[_0x3d8d('0x21')](util[_0x3d8d('0x28')](_0x3d8d('0x29'),this[_0x3d8d('0xc')][_0x58b473[_0x3d8d('0x2e')]][_0x3d8d('0x2a')]),'trunk:save',this[_0x3d8d('0xc')][_0x58b473[_0x3d8d('0x2e')]]);}else if(_['startsWith'](_0x58b473[_0x3d8d('0x2e')],_0x3d8d('0x36'))){}else if(_['startsWith'](_0x58b473['device'],_0x3d8d('0x37'))){var _0x5aba43=_0x58b473[_0x3d8d('0x2e')];var _0x1bb6dd=_0x5aba43['substring'](_0x5aba43[_0x3d8d('0x38')]('/')+0x1,_0x5aba43[_0x3d8d('0x38')]('@'));var _0x29a34b=_[_0x3d8d('0x23')](this[_0x3d8d('0xd')],function(_0x317b34){return _0x317b34[_0x3d8d('0x39')]==_0x1bb6dd||_0x317b34['phone']==_0x1bb6dd||_0x317b34[_0x3d8d('0x3a')]==_0x1bb6dd;});if(_0x29a34b){if(_0x29a34b['state']!==_0x58b473['state'][_0x3d8d('0x30')]()){_0x29a34b['stateTime']=_[_0x3d8d('0x33')](moment()[_0x3d8d('0x28')]('x'));}_0x29a34b[_0x3d8d('0x25')]=_0x58b473['state'][_0x3d8d('0x30')]();_0x29a34b[_0x3d8d('0x2f')]=!![];_0x29a34b['updateStatusRealtime'](_0x58b473);}}else{}}}catch(_0x4d2478){logger[_0x3d8d('0x1a')]('[syncDeviceState][UserReport]',util['inspect'](_0x4d2478,{'showHidden':![],'depth':null}));}};UserReport[_0x3d8d('0x1c')][_0x3d8d('0x14')]=function(_0x102858){try{if(this[_0x3d8d('0x22')](_0x102858)&&this[_0x3d8d('0x22')](_0x102858[_0x3d8d('0x13')])){if(this[_0x3d8d('0xd')][_0x102858[_0x3d8d('0x3b')]]){if(!this[_0x3d8d('0xd')][_0x102858[_0x3d8d('0x3b')]][_0x3d8d('0x2f')]||_0x102858[_0x3d8d('0x13')]['toLowerCase']()==_0x3d8d('0x3c')){this['agents'][_0x102858['peer']][_0x3d8d('0x2f')]=![];this[_0x3d8d('0xd')][_0x102858['peer']][_0x3d8d('0x3d')]=_0x102858[_0x3d8d('0x13')][_0x3d8d('0x30')]();this[_0x3d8d('0xd')][_0x102858[_0x3d8d('0x3b')]][_0x3d8d('0x3e')]=_0x102858[_0x3d8d('0x3e')];this[_0x3d8d('0xd')][_0x102858[_0x3d8d('0x3b')]][_0x3d8d('0x34')](_0x102858);}}else if(this[_0x3d8d('0xe')][_0x102858[_0x3d8d('0x3b')]]){this[_0x3d8d('0xe')][_0x102858[_0x3d8d('0x3b')]][_0x3d8d('0x3d')]=_0x102858[_0x3d8d('0x13')][_0x3d8d('0x30')]();this[_0x3d8d('0xe')][_0x102858[_0x3d8d('0x3b')]]['address']=_0x102858[_0x3d8d('0x3e')];this[_0x3d8d('0x21')](util[_0x3d8d('0x28')](_0x3d8d('0x3f'),this[_0x3d8d('0xe')][_0x102858[_0x3d8d('0x3b')]][_0x3d8d('0x2a')]),_0x3d8d('0x35'),this[_0x3d8d('0xe')][_0x102858[_0x3d8d('0x3b')]]);}else if(this[_0x3d8d('0xc')][_0x102858[_0x3d8d('0x3b')]]){this['trunks'][_0x102858[_0x3d8d('0x3b')]]['status']=_0x102858[_0x3d8d('0x13')]['toLowerCase']();this['trunks'][_0x102858[_0x3d8d('0x3b')]]['address']=_0x102858[_0x3d8d('0x3e')];this[_0x3d8d('0x21')](util['format'](_0x3d8d('0x29'),this['trunks'][_0x102858[_0x3d8d('0x3b')]][_0x3d8d('0x2a')]),_0x3d8d('0x2b'),this[_0x3d8d('0xc')][_0x102858['peer']]);}else{}}}catch(_0x451acd){logger[_0x3d8d('0x1a')](_0x3d8d('0x40'),util['inspect'](_0x451acd,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0x721c=['agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','syncPeerStatus','resolve','then','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','[loopSyncRealTimeShow]','error','inspect','prototype','loopSyncRealTimeShow','catch','isNotNull','isUndefined','emit','find','username','stateRegistry','state','omit','actionid','format','trunk:%s','name','trunk:save','[syncRegistry][UserReport]','device','toLowerCase','toNumber','stateTime','telephone:%s','telephone:save','trunks','startsWith','Queue','Local','indexOf','mobile','accountcode','[syncDeviceState][UserReport]','peerstatus','peer','registered','local','address','updateStatusRealtime','status','[syncPeerStatus][UserReport]','exports','lodash','moment','bluebird','util','ioredis','../../../config/environment','ami','../ami','redis','defaults','localhost'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x721c,0x7d));var _0xc721=function(_0x4ba47c,_0x39d799){_0x4ba47c=_0x4ba47c-0x0;var _0x4fed5d=_0x721c[_0x4ba47c];return _0x4fed5d;};'use strict';var _=require(_0xc721('0x0'));var moment=require(_0xc721('0x1'));var BPromise=require(_0xc721('0x2'));var util=require(_0xc721('0x3'));var Redis=require(_0xc721('0x4'));var config=require(_0xc721('0x5'));var logger=require('../../../config/logger')(_0xc721('0x6'));var ami=require(_0xc721('0x7'));config[_0xc721('0x8')]=_[_0xc721('0x9')](config[_0xc721('0x8')],{'host':_0xc721('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function UserReport(_0x41b1b1){this['trunks']=_0x41b1b1['trunks'];this[_0xc721('0xb')]=_0x41b1b1['agents'];this[_0xc721('0xc')]=_0x41b1b1[_0xc721('0xc')];ami['on'](_0xc721('0xd'),this[_0xc721('0xe')][_0xc721('0xf')](this));ami['on'](_0xc721('0x10'),this[_0xc721('0xe')]['bind'](this));ami['on'](_0xc721('0x11'),this[_0xc721('0x12')][_0xc721('0xf')](this));ami['on']('peerstatus',this[_0xc721('0x13')][_0xc721('0xf')](this));this['loopSyncRealTimeShow']();return BPromise[_0xc721('0x14')]()[_0xc721('0x15')](ami[_0xc721('0x16')]())[_0xc721('0x15')](ami[_0xc721('0x17')]())[_0xc721('0x15')](ami[_0xc721('0x18')]())['catch'](loggerCatch(_0xc721('0x19')));}function loggerCatch(_0x99ef25){return function(_0x3f4355){logger[_0xc721('0x1a')](_0x99ef25,util[_0xc721('0x1b')](_0x3f4355,{'showHidden':![],'depth':null}));};}UserReport[_0xc721('0x1c')][_0xc721('0x1d')]=function(){setInterval(function(){BPromise['resolve']()[_0xc721('0x15')](ami[_0xc721('0x16')]())[_0xc721('0x15')](ami[_0xc721('0x17')]())[_0xc721('0x15')](ami[_0xc721('0x18')]())[_0xc721('0x1e')](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport['prototype'][_0xc721('0x1f')]=function(_0x5b838c){return _0x5b838c!==null&&!_[_0xc721('0x20')](_0x5b838c);};UserReport[_0xc721('0x1c')][_0xc721('0x21')]=function(_0x14d853,_0x3f71a1,_0x133334){io['to'](_0x14d853)[_0xc721('0x21')](_0x3f71a1,_0x133334);};UserReport['prototype']['syncRegistry']=function(_0x3551a3){try{if(this['isNotNull'](_0x3551a3)){var _0x2a7992=_[_0xc721('0x22')](this['trunks'],{'registry':_0x3551a3[_0xc721('0x23')]});if(_0x2a7992){_0x3551a3[_0xc721('0x24')]=_0x3551a3[_0xc721('0x25')];_['merge'](_0x2a7992,_[_0xc721('0x26')](_0x3551a3,['event',_0xc721('0x27'),'username',_0xc721('0x25')]));this[_0xc721('0x21')](util[_0xc721('0x28')](_0xc721('0x29'),_0x2a7992[_0xc721('0x2a')]),_0xc721('0x2b'),_0x2a7992);}}}catch(_0x2465de){logger[_0xc721('0x1a')](_0xc721('0x2c'),util[_0xc721('0x1b')](_0x2465de,{'showHidden':![],'depth':null}));}};UserReport[_0xc721('0x1c')][_0xc721('0x12')]=function(_0x4261ad){try{if(this[_0xc721('0x1f')](_0x4261ad)){if(this[_0xc721('0xb')][_0x4261ad['device']]){if(!this['agents'][_0x4261ad[_0xc721('0x2d')]]['local']||_0x4261ad[_0xc721('0x25')][_0xc721('0x2e')]()=='inuse'){this['agents'][_0x4261ad['device']]['local']=![];if(this[_0xc721('0xb')][_0x4261ad['device']][_0xc721('0x25')]!==_0x4261ad['state'][_0xc721('0x2e')]()){this[_0xc721('0xb')][_0x4261ad['device']]['stateTime']=_[_0xc721('0x2f')](moment()[_0xc721('0x28')]('x'));}this[_0xc721('0xb')][_0x4261ad[_0xc721('0x2d')]][_0xc721('0x25')]=_0x4261ad[_0xc721('0x25')][_0xc721('0x2e')]();this[_0xc721('0xb')][_0x4261ad['device']]['updateStatusRealtime'](_0x4261ad);}}else if(this[_0xc721('0xc')][_0x4261ad['device']]){if(this[_0xc721('0xc')][_0x4261ad[_0xc721('0x2d')]]['state']!==_0x4261ad[_0xc721('0x25')][_0xc721('0x2e')]()){this[_0xc721('0xc')][_0x4261ad[_0xc721('0x2d')]][_0xc721('0x30')]=_[_0xc721('0x2f')](moment()[_0xc721('0x28')]('x'));}this[_0xc721('0xc')][_0x4261ad[_0xc721('0x2d')]][_0xc721('0x25')]=_0x4261ad[_0xc721('0x25')][_0xc721('0x2e')]();this[_0xc721('0x21')](util[_0xc721('0x28')](_0xc721('0x31'),this[_0xc721('0xc')][_0x4261ad[_0xc721('0x2d')]][_0xc721('0x2a')]),_0xc721('0x32'),this['telephones'][_0x4261ad[_0xc721('0x2d')]]);}else if(this[_0xc721('0x33')][_0x4261ad[_0xc721('0x2d')]]){if(this[_0xc721('0x33')][_0x4261ad[_0xc721('0x2d')]][_0xc721('0x25')]!==_0x4261ad[_0xc721('0x25')][_0xc721('0x2e')]()){this[_0xc721('0x33')][_0x4261ad['device']][_0xc721('0x30')]=_[_0xc721('0x2f')](moment()['format']('x'));}this[_0xc721('0x33')][_0x4261ad[_0xc721('0x2d')]][_0xc721('0x25')]=_0x4261ad[_0xc721('0x25')]['toLowerCase']();this[_0xc721('0x21')](util[_0xc721('0x28')]('trunk:%s',this[_0xc721('0x33')][_0x4261ad[_0xc721('0x2d')]][_0xc721('0x2a')]),_0xc721('0x2b'),this[_0xc721('0x33')][_0x4261ad['device']]);}else if(_[_0xc721('0x34')](_0x4261ad[_0xc721('0x2d')],_0xc721('0x35'))){}else if(_[_0xc721('0x34')](_0x4261ad[_0xc721('0x2d')],_0xc721('0x36'))){var _0x457ee9=_0x4261ad[_0xc721('0x2d')];var _0x3adb99=_0x457ee9['substring'](_0x457ee9[_0xc721('0x37')]('/')+0x1,_0x457ee9[_0xc721('0x37')]('@'));var _0x3ba843=_[_0xc721('0x22')](this[_0xc721('0xb')],function(_0x3bcfa9){return _0x3bcfa9[_0xc721('0x38')]==_0x3adb99||_0x3bcfa9['phone']==_0x3adb99||_0x3bcfa9[_0xc721('0x39')]==_0x3adb99;});if(_0x3ba843){if(_0x3ba843[_0xc721('0x25')]!==_0x4261ad[_0xc721('0x25')][_0xc721('0x2e')]()){_0x3ba843['stateTime']=_['toNumber'](moment()['format']('x'));}_0x3ba843[_0xc721('0x25')]=_0x4261ad[_0xc721('0x25')]['toLowerCase']();_0x3ba843['local']=!![];_0x3ba843['updateStatusRealtime'](_0x4261ad);}}else{}}}catch(_0x3ba914){logger['error'](_0xc721('0x3a'),util[_0xc721('0x1b')](_0x3ba914,{'showHidden':![],'depth':null}));}};UserReport[_0xc721('0x1c')][_0xc721('0x13')]=function(_0x30daf3){try{if(this[_0xc721('0x1f')](_0x30daf3)&&this['isNotNull'](_0x30daf3[_0xc721('0x3b')])){if(this[_0xc721('0xb')][_0x30daf3[_0xc721('0x3c')]]){if(!this[_0xc721('0xb')][_0x30daf3[_0xc721('0x3c')]]['local']||_0x30daf3['peerstatus'][_0xc721('0x2e')]()==_0xc721('0x3d')){this[_0xc721('0xb')][_0x30daf3[_0xc721('0x3c')]][_0xc721('0x3e')]=![];this[_0xc721('0xb')][_0x30daf3[_0xc721('0x3c')]]['status']=_0x30daf3['peerstatus']['toLowerCase']();this[_0xc721('0xb')][_0x30daf3[_0xc721('0x3c')]][_0xc721('0x3f')]=_0x30daf3['address'];this['agents'][_0x30daf3[_0xc721('0x3c')]][_0xc721('0x40')](_0x30daf3);}}else if(this[_0xc721('0xc')][_0x30daf3[_0xc721('0x3c')]]){this[_0xc721('0xc')][_0x30daf3['peer']]['status']=_0x30daf3[_0xc721('0x3b')][_0xc721('0x2e')]();this[_0xc721('0xc')][_0x30daf3[_0xc721('0x3c')]][_0xc721('0x3f')]=_0x30daf3[_0xc721('0x3f')];this[_0xc721('0x21')](util[_0xc721('0x28')]('telephone:%s',this['telephones'][_0x30daf3[_0xc721('0x3c')]][_0xc721('0x2a')]),'telephone:save',this['telephones'][_0x30daf3[_0xc721('0x3c')]]);}else if(this[_0xc721('0x33')][_0x30daf3[_0xc721('0x3c')]]){this[_0xc721('0x33')][_0x30daf3['peer']][_0xc721('0x41')]=_0x30daf3['peerstatus'][_0xc721('0x2e')]();this[_0xc721('0x33')][_0x30daf3[_0xc721('0x3c')]][_0xc721('0x3f')]=_0x30daf3['address'];this[_0xc721('0x21')](util['format'](_0xc721('0x29'),this[_0xc721('0x33')][_0x30daf3[_0xc721('0x3c')]]['name']),_0xc721('0x2b'),this[_0xc721('0x33')][_0x30daf3['peer']]);}else{}}}catch(_0x40e7da){logger[_0xc721('0x1a')](_0xc721('0x42'),util['inspect'](_0x40e7da,{'showHidden':![],'depth':null}));}};module[_0xc721('0x43')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 20b23be..7ff60b5 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 _0xed43=['[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','seconds','secondtransfereruniqueid','transfereruniqueid','channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','util','ioredis','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncAgentComplete','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','uniqueid','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','event','privilege','custom:agentcalled','format','user:%s','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','inspect','hasOwnProperty','agentconnectAt','lastevent','holdtime','connectedlinename','destchannelstate','destchannelstatedesc','merge','pick','destconnectedlinenum','agentcomplete','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','custom:agentansweredelsewhere','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','syncQueueCallerAbandon','abandoned','[syncQueueCallerAbandon][VoiceAgentReport]','agentcompleteAt','complete','talktime','transfer','agent','acw','acwtime','acwTimeout','interface','omit','user:agentcomplete','custom:agentcomplete','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','custom:voiceAgentReport','values'];(function(_0x974a9b,_0x288864){var _0x3fc248=function(_0x2bf905){while(--_0x2bf905){_0x974a9b['push'](_0x974a9b['shift']());}};_0x3fc248(++_0x288864);}(_0xed43,0x17e));var _0x3ed4=function(_0x5179a5,_0x419746){_0x5179a5=_0x5179a5-0x0;var _0x15c8ce=_0xed43[_0x5179a5];return _0x15c8ce;};'use strict';var _=require(_0x3ed4('0x0'));var moment=require(_0x3ed4('0x1'));var util=require(_0x3ed4('0x2'));var Redis=require(_0x3ed4('0x3'));var config=require('../../../config/environment');var logger=require(_0x3ed4('0x4'))(_0x3ed4('0x5'));var ami=require('../ami');config[_0x3ed4('0x6')]=_[_0x3ed4('0x7')](config[_0x3ed4('0x6')],{'host':_0x3ed4('0x8'),'port':0x18eb});var io=require(_0x3ed4('0x9'))(new Redis(config['redis']));function VoiceAgentReport(_0x5888e8){this[_0x3ed4('0xa')]={};this[_0x3ed4('0xb')]=_0x5888e8['voiceQueues'];this[_0x3ed4('0xc')]=_0x5888e8[_0x3ed4('0xc')];this[_0x3ed4('0xd')]={};ami['on'](_0x3ed4('0xe'),this[_0x3ed4('0xf')][_0x3ed4('0x10')](this));ami['on'](_0x3ed4('0x11'),this[_0x3ed4('0x12')][_0x3ed4('0x10')](this));ami['on'](_0x3ed4('0x13'),this[_0x3ed4('0x14')][_0x3ed4('0x10')](this));ami['on'](_0x3ed4('0x15'),this['syncQueueCallerAbandon'][_0x3ed4('0x10')](this));ami['on']('agentcomplete',this[_0x3ed4('0x16')][_0x3ed4('0x10')](this));ami['on']('varset',this[_0x3ed4('0x17')][_0x3ed4('0x10')](this));ami['on'](_0x3ed4('0x18'),this[_0x3ed4('0x19')][_0x3ed4('0x10')](this));ami['on'](_0x3ed4('0x1a'),this[_0x3ed4('0x1b')][_0x3ed4('0x10')](this));ami['on']('musiconholdstop',this[_0x3ed4('0x1c')][_0x3ed4('0x10')](this));ami['on'](_0x3ed4('0x1d'),this[_0x3ed4('0x1e')][_0x3ed4('0x10')](this));ami['on']('blindtransfer',this[_0x3ed4('0x1f')][_0x3ed4('0x10')](this));}VoiceAgentReport[_0x3ed4('0x20')][_0x3ed4('0x21')]=function(_0x1068f5,_0xe2fac8,_0x36bde2){io['to'](_0x1068f5)[_0x3ed4('0x21')](_0xe2fac8,_0x36bde2);};VoiceAgentReport[_0x3ed4('0x20')][_0x3ed4('0x22')]=function(_0x12d9a8){return _0x12d9a8!==null&&!_[_0x3ed4('0x23')](_0x12d9a8);};VoiceAgentReport[_0x3ed4('0x20')][_0x3ed4('0xf')]=function(_0x73ce57){try{if(this[_0x3ed4('0x22')](_0x73ce57)){if(_['isUndefined'](this[_0x3ed4('0xa')][_0x73ce57[_0x3ed4('0x24')]])){this[_0x3ed4('0xa')][_0x73ce57[_0x3ed4('0x24')]]={};}if(_[_0x3ed4('0x23')](this[_0x3ed4('0xa')][_0x73ce57[_0x3ed4('0x24')]][_0x73ce57['destuniqueid']])){this[_0x3ed4('0xa')][_0x73ce57[_0x3ed4('0x24')]][_0x73ce57[_0x3ed4('0x25')]]={'agentcalledAt':moment()['format'](_0x3ed4('0x26')),'lastevent':_0x3ed4('0x27'),'variables':this[_0x3ed4('0xd')][_0x73ce57[_0x3ed4('0x24')]],'type':this[_0x3ed4('0xb')][_0x73ce57[_0x3ed4('0x28')]]?this[_0x3ed4('0xb')][_0x73ce57[_0x3ed4('0x28')]][_0x3ed4('0x29')]||_0x3ed4('0x2a'):_0x3ed4('0x2a')};}_['merge'](this[_0x3ed4('0xa')][_0x73ce57[_0x3ed4('0x24')]][_0x73ce57[_0x3ed4('0x25')]],_['omit'](_0x73ce57,[_0x3ed4('0x2b'),_0x3ed4('0x2c')]));ami[_0x3ed4('0x21')](_0x3ed4('0x2d'),this[_0x3ed4('0xa')][_0x73ce57[_0x3ed4('0x24')]][_0x73ce57[_0x3ed4('0x25')]]);this[_0x3ed4('0x21')](util[_0x3ed4('0x2e')](_0x3ed4('0x2f'),_0x73ce57[_0x3ed4('0x30')]),_0x3ed4('0x31'),this[_0x3ed4('0xa')][_0x73ce57[_0x3ed4('0x24')]][_0x73ce57[_0x3ed4('0x25')]]);}}catch(_0x592038){logger[_0x3ed4('0x32')](_0x3ed4('0x33'),util[_0x3ed4('0x34')](_0x592038,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3ed4('0x20')][_0x3ed4('0x12')]=function(_0x3d142f){try{if(this[_0x3ed4('0x22')](_0x3d142f)){if(this[_0x3ed4('0xa')][_0x3d142f[_0x3ed4('0x24')]]){for(var _0x140877 in this[_0x3ed4('0xa')][_0x3d142f[_0x3ed4('0x24')]]){if(this[_0x3ed4('0xa')][_0x3d142f['uniqueid']][_0x3ed4('0x35')](_0x140877)){if(_0x3d142f[_0x3ed4('0x25')]===_0x140877){this[_0x3ed4('0xa')][_0x3d142f['uniqueid']][_0x140877][_0x3ed4('0x36')]=moment()['format'](_0x3ed4('0x26'));this[_0x3ed4('0xa')][_0x3d142f[_0x3ed4('0x24')]][_0x140877][_0x3ed4('0x37')]='connect';this[_0x3ed4('0xa')][_0x3d142f[_0x3ed4('0x24')]][_0x140877][_0x3ed4('0x38')]=_0x3d142f[_0x3ed4('0x38')];this[_0x3ed4('0xa')][_0x3d142f[_0x3ed4('0x24')]][_0x140877]['connectedlinenum']=_0x3d142f['connectedlinenum'];this[_0x3ed4('0xa')][_0x3d142f[_0x3ed4('0x24')]][_0x140877][_0x3ed4('0x39')]=_0x3d142f[_0x3ed4('0x39')];this[_0x3ed4('0xa')][_0x3d142f['uniqueid']][_0x140877][_0x3ed4('0x3a')]=_0x3d142f['destchannelstate'];this[_0x3ed4('0xa')][_0x3d142f[_0x3ed4('0x24')]][_0x140877]['destchannelstatedesc']=_0x3d142f[_0x3ed4('0x3b')];_[_0x3ed4('0x3c')](this['agents'][_0x3d142f['interface']],_[_0x3ed4('0x3d')](_0x3d142f,[_0x3ed4('0x28'),_0x3ed4('0x3e')]));this['emit'](util[_0x3ed4('0x2e')](_0x3ed4('0x2f'),_0x3d142f[_0x3ed4('0x30')]),'user:agentconnect',this[_0x3ed4('0xa')][_0x3d142f[_0x3ed4('0x24')]][_0x3d142f[_0x3ed4('0x25')]]);ami[_0x3ed4('0x21')]('custom:agentconnect',this[_0x3ed4('0xa')][_0x3d142f[_0x3ed4('0x24')]][_0x140877]);}else if(!this['channels'][_0x3d142f[_0x3ed4('0x24')]][_0x140877][_0x3ed4('0x13')]&&!this[_0x3ed4('0xa')][_0x3d142f[_0x3ed4('0x24')]][_0x140877][_0x3ed4('0x3f')]){this['channels'][_0x3d142f[_0x3ed4('0x24')]][_0x140877][_0x3ed4('0x13')]=!![];this[_0x3ed4('0xa')][_0x3d142f[_0x3ed4('0x24')]][_0x140877][_0x3ed4('0x40')]=moment()[_0x3ed4('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x3d142f[_0x3ed4('0x24')]][_0x140877][_0x3ed4('0x41')]='answered_elsewhere';this[_0x3ed4('0xa')][_0x3d142f[_0x3ed4('0x24')]][_0x140877][_0x3ed4('0x37')]=_0x3ed4('0x42');this[_0x3ed4('0xa')][_0x3d142f[_0x3ed4('0x24')]][_0x140877][_0x3ed4('0x43')]=_0x3d142f[_0x3ed4('0x25')];this[_0x3ed4('0xa')][_0x3d142f[_0x3ed4('0x24')]][_0x140877]['answeredelsewheremembername']=_0x3d142f[_0x3ed4('0x30')];ami[_0x3ed4('0x21')](_0x3ed4('0x44'),this[_0x3ed4('0xa')][_0x3d142f['uniqueid']][_0x140877]);}}}}}}catch(_0x54b2e3){logger[_0x3ed4('0x32')]('[syncAgentConnect][VoiceAgentReport]',util[_0x3ed4('0x34')](_0x54b2e3,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x3ed4('0x14')]=function(_0x11e53f){try{if(this['isNotNull'](_0x11e53f)){if(this[_0x3ed4('0xa')][_0x11e53f['uniqueid']]&&this[_0x3ed4('0xa')][_0x11e53f[_0x3ed4('0x24')]][_0x11e53f[_0x3ed4('0x25')]]){this['channels'][_0x11e53f[_0x3ed4('0x24')]][_0x11e53f[_0x3ed4('0x25')]][_0x3ed4('0x13')]=!![];this[_0x3ed4('0xa')][_0x11e53f[_0x3ed4('0x24')]][_0x11e53f[_0x3ed4('0x25')]]['agentringnoanswerAt']=moment()[_0x3ed4('0x2e')](_0x3ed4('0x26'));this[_0x3ed4('0xa')][_0x11e53f[_0x3ed4('0x24')]][_0x11e53f['destuniqueid']][_0x3ed4('0x41')]='rejected';this[_0x3ed4('0xa')][_0x11e53f[_0x3ed4('0x24')]][_0x11e53f[_0x3ed4('0x25')]][_0x3ed4('0x37')]=_0x3ed4('0x45');ami[_0x3ed4('0x21')](_0x3ed4('0x46'),this[_0x3ed4('0xa')][_0x11e53f[_0x3ed4('0x24')]][_0x11e53f[_0x3ed4('0x25')]]);}}}catch(_0x1ed649){logger['error'](_0x3ed4('0x47'),util['inspect'](_0x1ed649,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x3ed4('0x48')]=function(_0x2f2a4b){try{if(this['isNotNull'](_0x2f2a4b)){if(this[_0x3ed4('0xa')][_0x2f2a4b[_0x3ed4('0x24')]]){for(var _0x25bdd2 in this[_0x3ed4('0xa')][_0x2f2a4b[_0x3ed4('0x24')]]){if(this['channels'][_0x2f2a4b[_0x3ed4('0x24')]][_0x3ed4('0x35')](_0x25bdd2)&&!this[_0x3ed4('0xa')][_0x2f2a4b['uniqueid']][_0x25bdd2][_0x3ed4('0x13')]&&!this[_0x3ed4('0xa')][_0x2f2a4b['uniqueid']][_0x25bdd2][_0x3ed4('0x3f')]){this[_0x3ed4('0xa')][_0x2f2a4b[_0x3ed4('0x24')]][_0x25bdd2][_0x3ed4('0x13')]=!![];this[_0x3ed4('0xa')][_0x2f2a4b['uniqueid']][_0x25bdd2][_0x3ed4('0x40')]=moment()[_0x3ed4('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x3ed4('0xa')][_0x2f2a4b[_0x3ed4('0x24')]][_0x25bdd2][_0x3ed4('0x41')]=_0x3ed4('0x49');this[_0x3ed4('0xa')][_0x2f2a4b[_0x3ed4('0x24')]][_0x25bdd2][_0x3ed4('0x37')]=_0x3ed4('0x49');ami[_0x3ed4('0x21')]('custom:agentqueuecallerabandon',this[_0x3ed4('0xa')][_0x2f2a4b[_0x3ed4('0x24')]][_0x25bdd2]);}}}}}catch(_0x3a82be){logger[_0x3ed4('0x32')](_0x3ed4('0x4a'),util[_0x3ed4('0x34')](_0x3a82be,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3ed4('0x20')][_0x3ed4('0x16')]=function(_0x5aa380){try{if(this['isNotNull'](_0x5aa380)){if(this['channels'][_0x5aa380[_0x3ed4('0x24')]]){for(var _0xe6268f in this['channels'][_0x5aa380['uniqueid']]){if(this[_0x3ed4('0xa')][_0x5aa380[_0x3ed4('0x24')]][_0x3ed4('0x35')](_0xe6268f)){if(this[_0x3ed4('0xa')][_0x5aa380[_0x3ed4('0x24')]][_0xe6268f][_0x3ed4('0x36')]&&!this[_0x3ed4('0xa')][_0x5aa380[_0x3ed4('0x24')]][_0xe6268f][_0x3ed4('0x3f')]){this['channels'][_0x5aa380[_0x3ed4('0x24')]][_0xe6268f][_0x3ed4('0x3f')]=!![];this[_0x3ed4('0xa')][_0x5aa380[_0x3ed4('0x24')]][_0xe6268f][_0x3ed4('0x4b')]=moment()[_0x3ed4('0x2e')](_0x3ed4('0x26'));this[_0x3ed4('0xa')][_0x5aa380[_0x3ed4('0x24')]][_0xe6268f][_0x3ed4('0x37')]=_0x3ed4('0x4c');this['channels'][_0x5aa380['uniqueid']][_0xe6268f][_0x3ed4('0x4d')]=_0x5aa380[_0x3ed4('0x4d')];this['channels'][_0x5aa380['uniqueid']][_0xe6268f][_0x3ed4('0x41')]=_0x5aa380[_0x3ed4('0x41')]==_0x3ed4('0x4e')?_0x3ed4('0x4f'):_0x5aa380[_0x3ed4('0x41')];if(this['voiceQueues'][_0x5aa380[_0x3ed4('0x28')]]&&this[_0x3ed4('0xb')][_0x5aa380[_0x3ed4('0x28')]][_0x3ed4('0x50')]){this[_0x3ed4('0xa')][_0x5aa380[_0x3ed4('0x24')]][_0xe6268f]['agentacw']=!![];this[_0x3ed4('0xa')][_0x5aa380[_0x3ed4('0x24')]][_0xe6268f][_0x3ed4('0x51')]=this[_0x3ed4('0xb')][_0x5aa380['queue']][_0x3ed4('0x52')];}this[_0x3ed4('0xc')][_0x5aa380[_0x3ed4('0x53')]]=_[_0x3ed4('0x54')](this[_0x3ed4('0xc')][_0x5aa380[_0x3ed4('0x53')]],[_0x3ed4('0x28'),'destconnectedlinenum']);this[_0x3ed4('0x21')](util[_0x3ed4('0x2e')]('user:%s',_0x5aa380[_0x3ed4('0x30')]),_0x3ed4('0x55'),this[_0x3ed4('0xa')][_0x5aa380[_0x3ed4('0x24')]][_0xe6268f]);ami[_0x3ed4('0x21')](_0x3ed4('0x56'),this[_0x3ed4('0xa')][_0x5aa380[_0x3ed4('0x24')]][_0xe6268f]);}}}}}}catch(_0x1951b0){logger[_0x3ed4('0x32')]('[syncAgentComplete][VoiceAgentReport]',util[_0x3ed4('0x34')](_0x1951b0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncVarSet']=function(_0x146587){try{if(this['isNotNull'](_0x146587)){this[_0x3ed4('0x57')](_0x146587[_0x3ed4('0x24')],_[_0x3ed4('0x58')](_0x146587[_0x3ed4('0x59')])[0x0],_0x146587[_0x3ed4('0x5a')]);if(this[_0x3ed4('0xa')][_0x146587[_0x3ed4('0x24')]]){for(var _0x5dbdbd in this[_0x3ed4('0xa')][_0x146587[_0x3ed4('0x24')]]){if(this[_0x3ed4('0xa')][_0x146587[_0x3ed4('0x24')]][_0x3ed4('0x35')](_0x5dbdbd)){if(_[_0x3ed4('0x23')](this[_0x3ed4('0xa')][_0x146587[_0x3ed4('0x24')]][_0x5dbdbd][_0x3ed4('0xd')])){this['channels'][_0x146587[_0x3ed4('0x24')]][_0x5dbdbd][_0x3ed4('0xd')]={};}this[_0x3ed4('0xa')][_0x146587[_0x3ed4('0x24')]][_0x5dbdbd][_0x3ed4('0xd')]=this[_0x3ed4('0xd')][_0x146587[_0x3ed4('0x24')]];}}}}}catch(_0x1a15f5){logger[_0x3ed4('0x32')](_0x3ed4('0x5b'),util[_0x3ed4('0x34')](_0x1a15f5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3ed4('0x20')][_0x3ed4('0x57')]=function(_0x884227,_0x1ed7da,_0x4498cd){var _0x244eaf=[_0x3ed4('0x5c'),_0x3ed4('0x5d'),_0x3ed4('0x5e'),_0x3ed4('0x5f'),_0x3ed4('0x60'),_0x3ed4('0x61'),_0x3ed4('0x62'),_0x3ed4('0x63'),_0x3ed4('0x64'),_0x3ed4('0x65'),'bridgepeer',_0x3ed4('0x66'),'membercalls',_0x3ed4('0x67'),_0x3ed4('0x68'),_0x3ed4('0x69'),_0x3ed4('0x30'),'memberpenalty',_0x3ed4('0x6a')];if(!_[_0x3ed4('0x6b')](_0x1ed7da)&&!_['includes'](_0x244eaf,_0x1ed7da)){if(_['isUndefined'](this[_0x3ed4('0xd')][_0x884227])){this[_0x3ed4('0xd')][_0x884227]={};}this[_0x3ed4('0xd')][_0x884227][_0x1ed7da]=_0x4498cd;}};VoiceAgentReport[_0x3ed4('0x20')][_0x3ed4('0x19')]=function(_0x44a80d){try{if(this[_0x3ed4('0x22')](_0x44a80d)){if(this[_0x3ed4('0xa')][_0x44a80d[_0x3ed4('0x24')]]){for(var _0x1a72a9 in this[_0x3ed4('0xa')][_0x44a80d['uniqueid']]){if(this[_0x3ed4('0xa')][_0x44a80d[_0x3ed4('0x24')]][_0x3ed4('0x35')](_0x1a72a9)){if(this['channels'][_0x44a80d[_0x3ed4('0x24')]][_0x1a72a9]['reason']==_0x3ed4('0x4e')&&this['channels'][_0x44a80d[_0x3ed4('0x24')]][_0x1a72a9][_0x3ed4('0x3f')]){this['channels'][_0x44a80d['uniqueid']][_0x1a72a9][_0x3ed4('0x4b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}}ami[_0x3ed4('0x21')](_0x3ed4('0x6c'),_[_0x3ed4('0x6d')](this[_0x3ed4('0xa')][_0x44a80d[_0x3ed4('0x24')]]));delete this[_0x3ed4('0xa')][_0x44a80d[_0x3ed4('0x24')]];}if(this['variables'][_0x44a80d[_0x3ed4('0x24')]]){delete this[_0x3ed4('0xd')][_0x44a80d[_0x3ed4('0x24')]];}}}catch(_0x225dc3){logger[_0x3ed4('0x32')](_0x3ed4('0x6e'),util['inspect'](_0x225dc3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3ed4('0x20')][_0x3ed4('0x1e')]=function(_0x57b4fa){try{if(this[_0x3ed4('0x22')](_0x57b4fa)){if(this[_0x3ed4('0xa')][_0x57b4fa[_0x3ed4('0x6f')]]){for(var _0x47270c in this[_0x3ed4('0xa')][_0x57b4fa['transfereeuniqueid']]){if(this[_0x3ed4('0xa')][_0x57b4fa[_0x3ed4('0x6f')]][_0x3ed4('0x35')](_0x47270c)){if(_0x57b4fa[_0x3ed4('0x70')]===_0x47270c){var _0x3da528=moment();this[_0x3ed4('0xa')][_0x57b4fa[_0x3ed4('0x6f')]][_0x47270c][_0x3ed4('0x3f')]=!![];this['channels'][_0x57b4fa['transfereeuniqueid']][_0x47270c][_0x3ed4('0x4b')]=moment()[_0x3ed4('0x2e')](_0x3ed4('0x26'));this['channels'][_0x57b4fa[_0x3ed4('0x6f')]][_0x47270c][_0x3ed4('0x41')]=_0x3ed4('0x4e');this[_0x3ed4('0xa')][_0x57b4fa[_0x3ed4('0x6f')]][_0x47270c][_0x3ed4('0x37')]=_0x3ed4('0x4c');this['channels'][_0x57b4fa['transfereeuniqueid']][_0x47270c][_0x3ed4('0x4d')]=_0x3da528['diff'](this[_0x3ed4('0xa')][_0x57b4fa[_0x3ed4('0x6f')]][_0x47270c]['agentconnectAt'],_0x3ed4('0x71'));}}}}if(this[_0x3ed4('0xa')][_0x57b4fa[_0x3ed4('0x72')]]){var _0x1e2c8f=this[_0x3ed4('0xa')][_0x57b4fa['secondtransfereruniqueid']];this[_0x3ed4('0xa')][_0x57b4fa[_0x3ed4('0x72')]]=this[_0x3ed4('0xa')][_0x57b4fa[_0x3ed4('0x6f')]];this[_0x3ed4('0xa')][_0x57b4fa[_0x3ed4('0x6f')]]=_0x1e2c8f;}}}catch(_0x598382){logger[_0x3ed4('0x32')]('[syncAttendedTransfer][VoiceAgentReport]',util[_0x3ed4('0x34')](_0x598382,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3ed4('0x20')][_0x3ed4('0x1f')]=function(_0xa8a1e0){try{if(this[_0x3ed4('0x22')](_0xa8a1e0)){if(this[_0x3ed4('0xa')][_0xa8a1e0[_0x3ed4('0x6f')]]){for(var _0x28140f in this[_0x3ed4('0xa')][_0xa8a1e0[_0x3ed4('0x6f')]]){if(this[_0x3ed4('0xa')][_0xa8a1e0[_0x3ed4('0x6f')]][_0x3ed4('0x35')](_0x28140f)){if(_0xa8a1e0[_0x3ed4('0x73')]===_0x28140f){var _0x36b699=moment();this[_0x3ed4('0xa')][_0xa8a1e0[_0x3ed4('0x6f')]][_0x28140f]['agentcomplete']=!![];this[_0x3ed4('0xa')][_0xa8a1e0[_0x3ed4('0x6f')]][_0x28140f][_0x3ed4('0x4b')]=_0x36b699;this[_0x3ed4('0xa')][_0xa8a1e0[_0x3ed4('0x6f')]][_0x28140f][_0x3ed4('0x41')]='transfer';this[_0x3ed4('0xa')][_0xa8a1e0['transfereeuniqueid']][_0x28140f][_0x3ed4('0x37')]=_0x3ed4('0x4c');this[_0x3ed4('0xa')][_0xa8a1e0[_0x3ed4('0x6f')]][_0x28140f]['talktime']=_0x36b699['diff'](this[_0x3ed4('0xa')][_0xa8a1e0[_0x3ed4('0x6f')]][_0x28140f][_0x3ed4('0x36')],'seconds');}}}}}}catch(_0x2d6e88){logger['error']('[syncBlindTransfer][VoiceAgentReport]',util[_0x3ed4('0x34')](_0x2d6e88,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3ed4('0x20')]['syncMusicOnHoldStart']=function(_0x20f1d0){var _0x220c0b='';try{if(this[_0x3ed4('0x22')](_0x20f1d0)){if(_0x20f1d0[_0x3ed4('0x74')]){_0x220c0b=_0x20f1d0['channel'][_0x3ed4('0x75')](0x0,_0x20f1d0['channel'][_0x3ed4('0x76')]('-'));if(this[_0x3ed4('0xc')][_0x220c0b]){this[_0x3ed4('0xc')][_0x220c0b][_0x3ed4('0x77')]=!![];}}}}catch(_0x10cac8){logger[_0x3ed4('0x32')](_0x3ed4('0x78'),util[_0x3ed4('0x34')](_0x10cac8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3ed4('0x20')][_0x3ed4('0x1c')]=function(_0x45d01a){var _0x4ed580='';try{if(this['isNotNull'](_0x45d01a)){if(_0x45d01a['channel']){_0x4ed580=_0x45d01a[_0x3ed4('0x74')][_0x3ed4('0x75')](0x0,_0x45d01a[_0x3ed4('0x74')][_0x3ed4('0x76')]('-'));if(this['agents'][_0x4ed580]){this[_0x3ed4('0xc')][_0x4ed580][_0x3ed4('0x77')]=![];}}}}catch(_0x26e007){logger[_0x3ed4('0x32')](_0x3ed4('0x79'),util[_0x3ed4('0x34')](_0x26e007,{'showHidden':![],'depth':null}));}};module[_0x3ed4('0x7a')]=VoiceAgentReport; \ No newline at end of file +var _0xbe7a=['channels','voiceQueues','agentcalled','syncAgentCalled','bind','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','prototype','emit','isUndefined','isNotNull','uniqueid','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','called','type','merge','privilege','custom:agentcalled','format','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','inspect','hasOwnProperty','agentconnectAt','lastevent','connect','holdtime','connectedlinename','destchannelstate','destchannelstatedesc','pick','queue','destconnectedlinenum','user:%s','user:agentconnect','agentringnoanswerAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','reason','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','custom:agentqueuecallerabandon','syncAgentComplete','complete','talktime','agent','acw','acwtime','acwTimeout','agents','interface','omit','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','variable','variables','[syncVarSet][VoiceAgentReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','includes','custom:voiceAgentReport','values','transfereeuniqueid','origtransfereruniqueid','agentcompleteAt','transfer','diff','seconds','secondtransfereruniqueid','transfereruniqueid','channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xbe7a,0x1e0));var _0xabe7=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xbe7a[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0xabe7('0x0'));var moment=require(_0xabe7('0x1'));var util=require(_0xabe7('0x2'));var Redis=require(_0xabe7('0x3'));var config=require(_0xabe7('0x4'));var logger=require(_0xabe7('0x5'))(_0xabe7('0x6'));var ami=require(_0xabe7('0x7'));config[_0xabe7('0x8')]=_[_0xabe7('0x9')](config[_0xabe7('0x8')],{'host':_0xabe7('0xa'),'port':0x18eb});var io=require(_0xabe7('0xb'))(new Redis(config['redis']));function VoiceAgentReport(_0x4db0e7){this[_0xabe7('0xc')]={};this[_0xabe7('0xd')]=_0x4db0e7[_0xabe7('0xd')];this['agents']=_0x4db0e7['agents'];this['variables']={};ami['on'](_0xabe7('0xe'),this[_0xabe7('0xf')][_0xabe7('0x10')](this));ami['on']('agentconnect',this[_0xabe7('0x11')][_0xabe7('0x10')](this));ami['on'](_0xabe7('0x12'),this[_0xabe7('0x13')][_0xabe7('0x10')](this));ami['on'](_0xabe7('0x14'),this[_0xabe7('0x15')][_0xabe7('0x10')](this));ami['on'](_0xabe7('0x16'),this['syncAgentComplete'][_0xabe7('0x10')](this));ami['on']('varset',this[_0xabe7('0x17')][_0xabe7('0x10')](this));ami['on'](_0xabe7('0x18'),this[_0xabe7('0x19')][_0xabe7('0x10')](this));ami['on'](_0xabe7('0x1a'),this[_0xabe7('0x1b')]['bind'](this));ami['on']('musiconholdstop',this[_0xabe7('0x1c')]['bind'](this));ami['on'](_0xabe7('0x1d'),this[_0xabe7('0x1e')][_0xabe7('0x10')](this));ami['on']('blindtransfer',this[_0xabe7('0x1f')][_0xabe7('0x10')](this));}VoiceAgentReport[_0xabe7('0x20')]['emit']=function(_0x44e15b,_0x3565b2,_0x5d927d){io['to'](_0x44e15b)[_0xabe7('0x21')](_0x3565b2,_0x5d927d);};VoiceAgentReport[_0xabe7('0x20')]['isNotNull']=function(_0x5df95b){return _0x5df95b!==null&&!_[_0xabe7('0x22')](_0x5df95b);};VoiceAgentReport[_0xabe7('0x20')][_0xabe7('0xf')]=function(_0x193c04){try{if(this[_0xabe7('0x23')](_0x193c04)){if(_[_0xabe7('0x22')](this['channels'][_0x193c04[_0xabe7('0x24')]])){this[_0xabe7('0xc')][_0x193c04['uniqueid']]={};}if(_['isUndefined'](this[_0xabe7('0xc')][_0x193c04[_0xabe7('0x24')]][_0x193c04['destuniqueid']])){this[_0xabe7('0xc')][_0x193c04[_0xabe7('0x24')]][_0x193c04[_0xabe7('0x25')]]={'agentcalledAt':moment()['format'](_0xabe7('0x26')),'lastevent':_0xabe7('0x27'),'variables':this['variables'][_0x193c04[_0xabe7('0x24')]],'type':this[_0xabe7('0xd')][_0x193c04['queue']]?this[_0xabe7('0xd')][_0x193c04['queue']][_0xabe7('0x28')]||'inbound':'inbound'};}_[_0xabe7('0x29')](this[_0xabe7('0xc')][_0x193c04[_0xabe7('0x24')]][_0x193c04[_0xabe7('0x25')]],_['omit'](_0x193c04,['event',_0xabe7('0x2a')]));ami['emit'](_0xabe7('0x2b'),this[_0xabe7('0xc')][_0x193c04['uniqueid']][_0x193c04[_0xabe7('0x25')]]);this[_0xabe7('0x21')](util[_0xabe7('0x2c')]('user:%s',_0x193c04[_0xabe7('0x2d')]),_0xabe7('0x2e'),this[_0xabe7('0xc')][_0x193c04[_0xabe7('0x24')]][_0x193c04[_0xabe7('0x25')]]);}}catch(_0x95f191){logger[_0xabe7('0x2f')](_0xabe7('0x30'),util[_0xabe7('0x31')](_0x95f191,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xabe7('0x11')]=function(_0x524e8e){try{if(this[_0xabe7('0x23')](_0x524e8e)){if(this['channels'][_0x524e8e[_0xabe7('0x24')]]){for(var _0x55c005 in this['channels'][_0x524e8e[_0xabe7('0x24')]]){if(this['channels'][_0x524e8e[_0xabe7('0x24')]][_0xabe7('0x32')](_0x55c005)){if(_0x524e8e[_0xabe7('0x25')]===_0x55c005){this[_0xabe7('0xc')][_0x524e8e[_0xabe7('0x24')]][_0x55c005][_0xabe7('0x33')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xabe7('0xc')][_0x524e8e['uniqueid']][_0x55c005][_0xabe7('0x34')]=_0xabe7('0x35');this['channels'][_0x524e8e[_0xabe7('0x24')]][_0x55c005][_0xabe7('0x36')]=_0x524e8e[_0xabe7('0x36')];this[_0xabe7('0xc')][_0x524e8e[_0xabe7('0x24')]][_0x55c005]['connectedlinenum']=_0x524e8e['connectedlinenum'];this[_0xabe7('0xc')][_0x524e8e[_0xabe7('0x24')]][_0x55c005][_0xabe7('0x37')]=_0x524e8e[_0xabe7('0x37')];this['channels'][_0x524e8e[_0xabe7('0x24')]][_0x55c005][_0xabe7('0x38')]=_0x524e8e['destchannelstate'];this[_0xabe7('0xc')][_0x524e8e['uniqueid']][_0x55c005][_0xabe7('0x39')]=_0x524e8e[_0xabe7('0x39')];_['merge'](this['agents'][_0x524e8e['interface']],_[_0xabe7('0x3a')](_0x524e8e,[_0xabe7('0x3b'),_0xabe7('0x3c')]));this[_0xabe7('0x21')](util[_0xabe7('0x2c')](_0xabe7('0x3d'),_0x524e8e['membername']),_0xabe7('0x3e'),this['channels'][_0x524e8e[_0xabe7('0x24')]][_0x524e8e[_0xabe7('0x25')]]);ami['emit']('custom:agentconnect',this[_0xabe7('0xc')][_0x524e8e[_0xabe7('0x24')]][_0x55c005]);}else if(!this[_0xabe7('0xc')][_0x524e8e['uniqueid']][_0x55c005][_0xabe7('0x12')]&&!this[_0xabe7('0xc')][_0x524e8e['uniqueid']][_0x55c005][_0xabe7('0x16')]){this[_0xabe7('0xc')][_0x524e8e[_0xabe7('0x24')]][_0x55c005][_0xabe7('0x12')]=!![];this['channels'][_0x524e8e[_0xabe7('0x24')]][_0x55c005][_0xabe7('0x3f')]=moment()[_0xabe7('0x2c')](_0xabe7('0x26'));this[_0xabe7('0xc')][_0x524e8e[_0xabe7('0x24')]][_0x55c005]['reason']=_0xabe7('0x40');this[_0xabe7('0xc')][_0x524e8e[_0xabe7('0x24')]][_0x55c005]['lastevent']=_0xabe7('0x40');this[_0xabe7('0xc')][_0x524e8e[_0xabe7('0x24')]][_0x55c005][_0xabe7('0x41')]=_0x524e8e[_0xabe7('0x25')];this[_0xabe7('0xc')][_0x524e8e['uniqueid']][_0x55c005][_0xabe7('0x42')]=_0x524e8e[_0xabe7('0x2d')];ami['emit'](_0xabe7('0x43'),this[_0xabe7('0xc')][_0x524e8e[_0xabe7('0x24')]][_0x55c005]);}}}}}}catch(_0x3260bc){logger[_0xabe7('0x2f')](_0xabe7('0x44'),util[_0xabe7('0x31')](_0x3260bc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xabe7('0x20')][_0xabe7('0x13')]=function(_0x13424e){try{if(this['isNotNull'](_0x13424e)){if(this['channels'][_0x13424e['uniqueid']]&&this[_0xabe7('0xc')][_0x13424e['uniqueid']][_0x13424e['destuniqueid']]){this['channels'][_0x13424e['uniqueid']][_0x13424e[_0xabe7('0x25')]]['agentringnoanswer']=!![];this['channels'][_0x13424e[_0xabe7('0x24')]][_0x13424e[_0xabe7('0x25')]][_0xabe7('0x3f')]=moment()[_0xabe7('0x2c')](_0xabe7('0x26'));this[_0xabe7('0xc')][_0x13424e['uniqueid']][_0x13424e['destuniqueid']][_0xabe7('0x45')]=_0xabe7('0x46');this[_0xabe7('0xc')][_0x13424e['uniqueid']][_0x13424e[_0xabe7('0x25')]]['lastevent']=_0xabe7('0x46');ami[_0xabe7('0x21')](_0xabe7('0x47'),this[_0xabe7('0xc')][_0x13424e[_0xabe7('0x24')]][_0x13424e['destuniqueid']]);}}}catch(_0x30bbb8){logger[_0xabe7('0x2f')](_0xabe7('0x48'),util[_0xabe7('0x31')](_0x30bbb8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xabe7('0x20')][_0xabe7('0x15')]=function(_0x3430c4){try{if(this['isNotNull'](_0x3430c4)){if(this[_0xabe7('0xc')][_0x3430c4[_0xabe7('0x24')]]){for(var _0x4a55e6 in this[_0xabe7('0xc')][_0x3430c4[_0xabe7('0x24')]]){if(this[_0xabe7('0xc')][_0x3430c4[_0xabe7('0x24')]]['hasOwnProperty'](_0x4a55e6)&&!this[_0xabe7('0xc')][_0x3430c4['uniqueid']][_0x4a55e6]['agentringnoanswer']&&!this[_0xabe7('0xc')][_0x3430c4[_0xabe7('0x24')]][_0x4a55e6][_0xabe7('0x16')]){this[_0xabe7('0xc')][_0x3430c4[_0xabe7('0x24')]][_0x4a55e6][_0xabe7('0x12')]=!![];this[_0xabe7('0xc')][_0x3430c4[_0xabe7('0x24')]][_0x4a55e6]['agentringnoanswerAt']=moment()['format'](_0xabe7('0x26'));this[_0xabe7('0xc')][_0x3430c4[_0xabe7('0x24')]][_0x4a55e6][_0xabe7('0x45')]=_0xabe7('0x49');this[_0xabe7('0xc')][_0x3430c4[_0xabe7('0x24')]][_0x4a55e6][_0xabe7('0x34')]=_0xabe7('0x49');ami[_0xabe7('0x21')](_0xabe7('0x4a'),this[_0xabe7('0xc')][_0x3430c4[_0xabe7('0x24')]][_0x4a55e6]);}}}}}catch(_0xb512df){logger[_0xabe7('0x2f')]('[syncQueueCallerAbandon][VoiceAgentReport]',util[_0xabe7('0x31')](_0xb512df,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xabe7('0x20')][_0xabe7('0x4b')]=function(_0x315576){try{if(this['isNotNull'](_0x315576)){if(this[_0xabe7('0xc')][_0x315576[_0xabe7('0x24')]]){for(var _0x51abf5 in this[_0xabe7('0xc')][_0x315576[_0xabe7('0x24')]]){if(this[_0xabe7('0xc')][_0x315576['uniqueid']][_0xabe7('0x32')](_0x51abf5)){if(this[_0xabe7('0xc')][_0x315576[_0xabe7('0x24')]][_0x51abf5]['agentconnectAt']&&!this[_0xabe7('0xc')][_0x315576['uniqueid']][_0x51abf5]['agentcomplete']){this['channels'][_0x315576[_0xabe7('0x24')]][_0x51abf5]['agentcomplete']=!![];this[_0xabe7('0xc')][_0x315576[_0xabe7('0x24')]][_0x51abf5]['agentcompleteAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xabe7('0xc')][_0x315576[_0xabe7('0x24')]][_0x51abf5][_0xabe7('0x34')]=_0xabe7('0x4c');this[_0xabe7('0xc')][_0x315576['uniqueid']][_0x51abf5][_0xabe7('0x4d')]=_0x315576[_0xabe7('0x4d')];this['channels'][_0x315576['uniqueid']][_0x51abf5]['reason']=_0x315576[_0xabe7('0x45')]=='transfer'?_0xabe7('0x4e'):_0x315576[_0xabe7('0x45')];if(this[_0xabe7('0xd')][_0x315576[_0xabe7('0x3b')]]&&this[_0xabe7('0xd')][_0x315576[_0xabe7('0x3b')]][_0xabe7('0x4f')]){this['channels'][_0x315576[_0xabe7('0x24')]][_0x51abf5]['agentacw']=!![];this[_0xabe7('0xc')][_0x315576[_0xabe7('0x24')]][_0x51abf5][_0xabe7('0x50')]=this[_0xabe7('0xd')][_0x315576[_0xabe7('0x3b')]][_0xabe7('0x51')];}this[_0xabe7('0x52')][_0x315576[_0xabe7('0x53')]]=_[_0xabe7('0x54')](this['agents'][_0x315576[_0xabe7('0x53')]],[_0xabe7('0x3b'),_0xabe7('0x3c')]);this[_0xabe7('0x21')](util[_0xabe7('0x2c')]('user:%s',_0x315576['membername']),'user:agentcomplete',this[_0xabe7('0xc')][_0x315576[_0xabe7('0x24')]][_0x51abf5]);ami[_0xabe7('0x21')](_0xabe7('0x55'),this[_0xabe7('0xc')][_0x315576[_0xabe7('0x24')]][_0x51abf5]);}}}}}}catch(_0x170f79){logger[_0xabe7('0x2f')](_0xabe7('0x56'),util[_0xabe7('0x31')](_0x170f79,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xabe7('0x20')]['syncVarSet']=function(_0x223bce){try{if(this[_0xabe7('0x23')](_0x223bce)){this[_0xabe7('0x57')](_0x223bce[_0xabe7('0x24')],_[_0xabe7('0x58')](_0x223bce[_0xabe7('0x59')])[0x0],_0x223bce['value']);if(this[_0xabe7('0xc')][_0x223bce[_0xabe7('0x24')]]){for(var _0x4f7307 in this[_0xabe7('0xc')][_0x223bce[_0xabe7('0x24')]]){if(this[_0xabe7('0xc')][_0x223bce[_0xabe7('0x24')]][_0xabe7('0x32')](_0x4f7307)){if(_[_0xabe7('0x22')](this[_0xabe7('0xc')][_0x223bce[_0xabe7('0x24')]][_0x4f7307][_0xabe7('0x5a')])){this[_0xabe7('0xc')][_0x223bce[_0xabe7('0x24')]][_0x4f7307][_0xabe7('0x5a')]={};}this[_0xabe7('0xc')][_0x223bce[_0xabe7('0x24')]][_0x4f7307][_0xabe7('0x5a')]=this['variables'][_0x223bce['uniqueid']];}}}}}catch(_0x3d0539){logger[_0xabe7('0x2f')](_0xabe7('0x5b'),util[_0xabe7('0x31')](_0x3d0539,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xabe7('0x20')][_0xabe7('0x57')]=function(_0x1c5467,_0x5b8c90,_0x3cc8ee){var _0x20f74e=['rtpaudioqos',_0xabe7('0x5c'),_0xabe7('0x5d'),_0xabe7('0x5e'),'rtpaudioqosloss',_0xabe7('0x5f'),_0xabe7('0x60'),_0xabe7('0x61'),_0xabe7('0x62'),_0xabe7('0x63'),'bridgepeer',_0xabe7('0x64'),_0xabe7('0x65'),_0xabe7('0x66'),_0xabe7('0x67'),_0xabe7('0x68'),_0xabe7('0x2d'),'memberpenalty',_0xabe7('0x69')];if(!_['isNil'](_0x5b8c90)&&!_[_0xabe7('0x6a')](_0x20f74e,_0x5b8c90)){if(_[_0xabe7('0x22')](this['variables'][_0x1c5467])){this[_0xabe7('0x5a')][_0x1c5467]={};}this['variables'][_0x1c5467][_0x5b8c90]=_0x3cc8ee;}};VoiceAgentReport[_0xabe7('0x20')]['syncHangup']=function(_0x1a8514){try{if(this[_0xabe7('0x23')](_0x1a8514)){if(this[_0xabe7('0xc')][_0x1a8514[_0xabe7('0x24')]]){for(var _0x4ef856 in this[_0xabe7('0xc')][_0x1a8514[_0xabe7('0x24')]]){if(this[_0xabe7('0xc')][_0x1a8514[_0xabe7('0x24')]][_0xabe7('0x32')](_0x4ef856)){if(this[_0xabe7('0xc')][_0x1a8514[_0xabe7('0x24')]][_0x4ef856][_0xabe7('0x45')]=='transfer'&&this[_0xabe7('0xc')][_0x1a8514['uniqueid']][_0x4ef856][_0xabe7('0x16')]){this[_0xabe7('0xc')][_0x1a8514[_0xabe7('0x24')]][_0x4ef856]['agentcompleteAt']=moment()[_0xabe7('0x2c')](_0xabe7('0x26'));}}}ami[_0xabe7('0x21')](_0xabe7('0x6b'),_[_0xabe7('0x6c')](this[_0xabe7('0xc')][_0x1a8514[_0xabe7('0x24')]]));delete this[_0xabe7('0xc')][_0x1a8514[_0xabe7('0x24')]];}if(this[_0xabe7('0x5a')][_0x1a8514[_0xabe7('0x24')]]){delete this[_0xabe7('0x5a')][_0x1a8514[_0xabe7('0x24')]];}}}catch(_0x3db204){logger['error']('[syncHangup][VoiceAgentReport]',util[_0xabe7('0x31')](_0x3db204,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xabe7('0x20')][_0xabe7('0x1e')]=function(_0x1258e5){try{if(this[_0xabe7('0x23')](_0x1258e5)){if(this[_0xabe7('0xc')][_0x1258e5[_0xabe7('0x6d')]]){for(var _0x247ffb in this[_0xabe7('0xc')][_0x1258e5[_0xabe7('0x6d')]]){if(this[_0xabe7('0xc')][_0x1258e5[_0xabe7('0x6d')]]['hasOwnProperty'](_0x247ffb)){if(_0x1258e5[_0xabe7('0x6e')]===_0x247ffb){var _0x5bf700=moment();this[_0xabe7('0xc')][_0x1258e5[_0xabe7('0x6d')]][_0x247ffb][_0xabe7('0x16')]=!![];this[_0xabe7('0xc')][_0x1258e5[_0xabe7('0x6d')]][_0x247ffb][_0xabe7('0x6f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xabe7('0xc')][_0x1258e5[_0xabe7('0x6d')]][_0x247ffb][_0xabe7('0x45')]=_0xabe7('0x70');this['channels'][_0x1258e5['transfereeuniqueid']][_0x247ffb]['lastevent']=_0xabe7('0x4c');this[_0xabe7('0xc')][_0x1258e5[_0xabe7('0x6d')]][_0x247ffb][_0xabe7('0x4d')]=_0x5bf700[_0xabe7('0x71')](this[_0xabe7('0xc')][_0x1258e5[_0xabe7('0x6d')]][_0x247ffb]['agentconnectAt'],_0xabe7('0x72'));}}}}if(this[_0xabe7('0xc')][_0x1258e5[_0xabe7('0x73')]]){var _0x4991bb=this[_0xabe7('0xc')][_0x1258e5['secondtransfereruniqueid']];this[_0xabe7('0xc')][_0x1258e5['secondtransfereruniqueid']]=this['channels'][_0x1258e5['transfereeuniqueid']];this[_0xabe7('0xc')][_0x1258e5[_0xabe7('0x6d')]]=_0x4991bb;}}}catch(_0x3fd718){logger['error']('[syncAttendedTransfer][VoiceAgentReport]',util[_0xabe7('0x31')](_0x3fd718,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xabe7('0x20')][_0xabe7('0x1f')]=function(_0x32cf53){try{if(this[_0xabe7('0x23')](_0x32cf53)){if(this[_0xabe7('0xc')][_0x32cf53['transfereeuniqueid']]){for(var _0x50b062 in this[_0xabe7('0xc')][_0x32cf53[_0xabe7('0x6d')]]){if(this[_0xabe7('0xc')][_0x32cf53[_0xabe7('0x6d')]][_0xabe7('0x32')](_0x50b062)){if(_0x32cf53[_0xabe7('0x74')]===_0x50b062){var _0x4d796e=moment();this[_0xabe7('0xc')][_0x32cf53[_0xabe7('0x6d')]][_0x50b062][_0xabe7('0x16')]=!![];this[_0xabe7('0xc')][_0x32cf53[_0xabe7('0x6d')]][_0x50b062][_0xabe7('0x6f')]=_0x4d796e;this[_0xabe7('0xc')][_0x32cf53['transfereeuniqueid']][_0x50b062][_0xabe7('0x45')]=_0xabe7('0x70');this['channels'][_0x32cf53[_0xabe7('0x6d')]][_0x50b062][_0xabe7('0x34')]=_0xabe7('0x4c');this[_0xabe7('0xc')][_0x32cf53[_0xabe7('0x6d')]][_0x50b062][_0xabe7('0x4d')]=_0x4d796e['diff'](this['channels'][_0x32cf53[_0xabe7('0x6d')]][_0x50b062]['agentconnectAt'],_0xabe7('0x72'));}}}}}}catch(_0x581d9f){logger[_0xabe7('0x2f')]('[syncBlindTransfer][VoiceAgentReport]',util[_0xabe7('0x31')](_0x581d9f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xabe7('0x20')][_0xabe7('0x1b')]=function(_0xd55d62){var _0x1d3910='';try{if(this[_0xabe7('0x23')](_0xd55d62)){if(_0xd55d62['channel']){_0x1d3910=_0xd55d62[_0xabe7('0x75')][_0xabe7('0x76')](0x0,_0xd55d62[_0xabe7('0x75')][_0xabe7('0x77')]('-'));if(this[_0xabe7('0x52')][_0x1d3910]){this[_0xabe7('0x52')][_0x1d3910]['onhold']=!![];}}}}catch(_0x691497){logger['error']('[syncMusicOnHoldStart][VoiceAgentReport]',util[_0xabe7('0x31')](_0x691497,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xabe7('0x20')]['syncMusicOnHoldStop']=function(_0x1eaaf6){var _0x32e355='';try{if(this[_0xabe7('0x23')](_0x1eaaf6)){if(_0x1eaaf6[_0xabe7('0x75')]){_0x32e355=_0x1eaaf6[_0xabe7('0x75')][_0xabe7('0x76')](0x0,_0x1eaaf6['channel'][_0xabe7('0x77')]('-'));if(this[_0xabe7('0x52')][_0x32e355]){this[_0xabe7('0x52')][_0x32e355][_0xabe7('0x78')]=![];}}}}catch(_0x4b6d83){logger[_0xabe7('0x2f')](_0xabe7('0x79'),util['inspect'](_0x4b6d83,{'showHidden':![],'depth':null}));}};module[_0xabe7('0x7a')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 6a4564b..83389f9 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 _0xcddb=['[syncVarSet][VoiceCallReport]','endtime','diff','omit','user:agentcomplete','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereecalleridnum','extension','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','syncMusicOnHoldStop','milliseconds','bluebird','lodash','moment','ioredis','../../../config/logger','ami','../ami','../model/channel','not_inuse','busy','invalid','ringing','ringinuse','queue','agi','dial','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','localhost','socket.io-emitter','channels','agents','syncNewExten','newexten','bind','newchannel','syncNewChannel','newstate','syncNewState','syncVarSet','hangup','syncHangup','newcallerid','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','resolve','then','actionCoreShowChannels','catch','log','prototype','isNotNull','isUndefined','emit','syncNewCallerId','uniqueid','pick','keys','error','[syncNewCallerId][VoiceCallReport]','linkedid','OutgoingSpoolFailed','format','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','context','from-sip','split','channel','destconnectedlinenum','exten','user:%s','user:agentconnect','accountcode','inspect','application','toLowerCase','applicationdata','starttime','subtract','duration','seconds','merge','includes','lastapplication','lastdata','set','startsWith','cdr(','match','[syncNewExten][VoiceCallReport]','answered','answertime','holdtime','connectedlinenum','calleridnum','destinationchannel','toNumber','UserId','membername','name','monitor','endsWith','.wav49','.WAV','monitors','isNil','push','rec','variable','syncMixMonitorFilename','value','xmd-phone','xmd-callerid','callerid','xmd-cdrtype','xmd-queue','xmd-originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','sipcalluniqueid','mixmonitor_filename','parse','sipcallid'];(function(_0x15fc7a,_0xd21741){var _0x3aa9f4=function(_0x313108){while(--_0x313108){_0x15fc7a['push'](_0x15fc7a['shift']());}};_0x3aa9f4(++_0xd21741);}(_0xcddb,0x1c4));var _0xbcdd=function(_0x461115,_0x45aad6){_0x461115=_0x461115-0x0;var _0x35d2aa=_0xcddb[_0x461115];return _0x35d2aa;};'use strict';var BPromise=require(_0xbcdd('0x0'));var _=require(_0xbcdd('0x1'));var moment=require(_0xbcdd('0x2'));var util=require('util');var path=require('path');var Redis=require(_0xbcdd('0x3'));var config=require('../../../config/environment');var logger=require(_0xbcdd('0x4'))(_0xbcdd('0x5'));var ami=require(_0xbcdd('0x6'));var Channel=require(_0xbcdd('0x7'));var statusDesc=['unknown',_0xbcdd('0x8'),'inuse',_0xbcdd('0x9'),_0xbcdd('0xa'),'unavailable',_0xbcdd('0xb'),_0xbcdd('0xc'),'onhold'];var applications=['set',_0xbcdd('0xd'),_0xbcdd('0xe'),_0xbcdd('0xf'),'playback',_0xbcdd('0x10')];var dispositions=[_0xbcdd('0x11'),_0xbcdd('0x12'),_0xbcdd('0x12'),'NO\x20ANSWER',_0xbcdd('0x11'),_0xbcdd('0x11'),'ANSWERED',_0xbcdd('0x13'),_0xbcdd('0x12'),'FAILED',_0xbcdd('0x12')];var actions={};config[_0xbcdd('0x14')]=_['defaults'](config['redis'],{'host':_0xbcdd('0x15'),'port':0x18eb});var io=require(_0xbcdd('0x16'))(new Redis(config[_0xbcdd('0x14')]));function VoiceCallReport(_0x12f57c){this[_0xbcdd('0x17')]=_0x12f57c['channels'];this[_0xbcdd('0x18')]=_0x12f57c[_0xbcdd('0x18')];ami['on']('coreshowchannel',this[_0xbcdd('0x19')]['bind'](this));ami['on'](_0xbcdd('0x1a'),this[_0xbcdd('0x19')][_0xbcdd('0x1b')](this));ami['on'](_0xbcdd('0x1c'),this[_0xbcdd('0x1d')][_0xbcdd('0x1b')](this));ami['on'](_0xbcdd('0x1e'),this[_0xbcdd('0x1f')][_0xbcdd('0x1b')](this));ami['on']('varset',this[_0xbcdd('0x20')][_0xbcdd('0x1b')](this));ami['on'](_0xbcdd('0x21'),this[_0xbcdd('0x22')][_0xbcdd('0x1b')](this));ami['on'](_0xbcdd('0x23'),this['syncNewCallerId'][_0xbcdd('0x1b')](this));ami['on']('attendedtransfer',this[_0xbcdd('0x24')][_0xbcdd('0x1b')](this));ami['on'](_0xbcdd('0x25'),this[_0xbcdd('0x26')]['bind'](this));ami['on'](_0xbcdd('0x27'),this[_0xbcdd('0x28')][_0xbcdd('0x1b')](this));ami['on'](_0xbcdd('0x29'),this['syncMusicOnHoldStop'][_0xbcdd('0x1b')](this));return BPromise[_0xbcdd('0x2a')]()[_0xbcdd('0x2b')](ami[_0xbcdd('0x2c')]())[_0xbcdd('0x2d')](function(_0x5441a9){console[_0xbcdd('0x2e')](_0x5441a9);});}VoiceCallReport[_0xbcdd('0x2f')][_0xbcdd('0x30')]=function(_0x3f57a5){return _0x3f57a5!==null&&!_[_0xbcdd('0x31')](_0x3f57a5);};VoiceCallReport['prototype'][_0xbcdd('0x32')]=function(_0x5f2c82,_0x58cc33,_0x20b230){io['to'](_0x5f2c82)[_0xbcdd('0x32')](_0x58cc33,_0x20b230);};VoiceCallReport[_0xbcdd('0x2f')][_0xbcdd('0x33')]=function(_0x3f6487){try{if(this['isNotNull'](_0x3f6487)){if(_0x3f6487[_0xbcdd('0x34')]===_0x3f6487['linkedid']){if(!_['isUndefined'](this[_0xbcdd('0x17')][_0x3f6487[_0xbcdd('0x34')]])){_['merge'](this[_0xbcdd('0x17')][_0x3f6487[_0xbcdd('0x34')]],_[_0xbcdd('0x35')](_0x3f6487,_[_0xbcdd('0x36')](this[_0xbcdd('0x17')][_0x3f6487[_0xbcdd('0x34')]])));}}}}catch(_0x263436){logger[_0xbcdd('0x37')](_0xbcdd('0x38'),util['inspect'](_0x263436,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xbcdd('0x2f')][_0xbcdd('0x1d')]=function(_0x500eba){try{if(this['isNotNull'](_0x500eba)){if(_0x500eba[_0xbcdd('0x34')]===_0x500eba[_0xbcdd('0x39')]&&_0x500eba['channel']!=_0xbcdd('0x3a')){if(_['isUndefined'](this[_0xbcdd('0x17')][_0x500eba['uniqueid']])){this[_0xbcdd('0x17')][_0x500eba['uniqueid']]=new Channel();this[_0xbcdd('0x17')][_0x500eba[_0xbcdd('0x34')]]['starttime']=moment()[_0xbcdd('0x3b')](_0xbcdd('0x3c'));this[_0xbcdd('0x17')][_0x500eba[_0xbcdd('0x34')]][_0xbcdd('0x3d')]=dispositions[_['toNumber'](_0x500eba[_0xbcdd('0x3e')])];_['merge'](this[_0xbcdd('0x17')][_0x500eba[_0xbcdd('0x34')]],_['pick'](_0x500eba,_['keys'](this[_0xbcdd('0x17')][_0x500eba['uniqueid']])));if(_0x500eba[_0xbcdd('0x3f')]===_0xbcdd('0x40')){if(this[_0xbcdd('0x18')][_0x500eba['channel'][_0xbcdd('0x41')]('-')[0x0]]){this[_0xbcdd('0x18')][_0x500eba[_0xbcdd('0x42')][_0xbcdd('0x41')]('-')[0x0]][_0xbcdd('0x43')]=_0x500eba[_0xbcdd('0x44')];this[_0xbcdd('0x32')](util[_0xbcdd('0x3b')](_0xbcdd('0x45'),this[_0xbcdd('0x18')][_0x500eba[_0xbcdd('0x42')][_0xbcdd('0x41')]('-')[0x0]]['name']),_0xbcdd('0x46'),{'destaccountcode':this[_0xbcdd('0x18')][_0x500eba[_0xbcdd('0x42')][_0xbcdd('0x41')]('-')[0x0]][_0xbcdd('0x47')],'destconnectedlinenum':_0x500eba[_0xbcdd('0x44')]});}}}}}}catch(_0x588471){logger[_0xbcdd('0x37')]('[syncNewChannel][VoiceCallReport]',util[_0xbcdd('0x48')](_0x588471,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xbcdd('0x19')]=function(_0x1f790b){try{if(this['isNotNull'](_0x1f790b)){if(_0x1f790b[_0xbcdd('0x34')]===_0x1f790b[_0xbcdd('0x39')]&&_0x1f790b[_0xbcdd('0x44')]!='h'&&_0x1f790b[_0xbcdd('0x42')]!='OutgoingSpoolFailed'){_0x1f790b['application']=_0x1f790b[_0xbcdd('0x49')][_0xbcdd('0x4a')]();_0x1f790b[_0xbcdd('0x4b')]=(_0x1f790b['appdata']||_0x1f790b[_0xbcdd('0x4b')])[_0xbcdd('0x4a')]();if(_['isUndefined'](this[_0xbcdd('0x17')][_0x1f790b[_0xbcdd('0x34')]])){this[_0xbcdd('0x17')][_0x1f790b['uniqueid']]=new Channel();this[_0xbcdd('0x17')][_0x1f790b[_0xbcdd('0x34')]][_0xbcdd('0x4c')]=_0x1f790b['duration']?moment()[_0xbcdd('0x4d')](moment[_0xbcdd('0x4e')](_0x1f790b[_0xbcdd('0x4e')])[_0xbcdd('0x4f')](),_0xbcdd('0x4f'))[_0xbcdd('0x3b')](_0xbcdd('0x3c')):moment()[_0xbcdd('0x3b')](_0xbcdd('0x3c'));this[_0xbcdd('0x17')][_0x1f790b[_0xbcdd('0x34')]][_0xbcdd('0x3d')]='NO\x20ANSWER';}_[_0xbcdd('0x50')](this['channels'][_0x1f790b[_0xbcdd('0x34')]],_[_0xbcdd('0x35')](_0x1f790b,_['keys'](this[_0xbcdd('0x17')][_0x1f790b[_0xbcdd('0x34')]])));if(_[_0xbcdd('0x51')](applications,_0x1f790b[_0xbcdd('0x49')])){this[_0xbcdd('0x17')][_0x1f790b['uniqueid']][_0xbcdd('0x52')]=_0x1f790b[_0xbcdd('0x49')];this['channels'][_0x1f790b['uniqueid']][_0xbcdd('0x53')]=_0x1f790b[_0xbcdd('0x4b')];if(_0x1f790b[_0xbcdd('0x49')]===_0xbcdd('0x54')&&_[_0xbcdd('0x55')](_0x1f790b[_0xbcdd('0x4b')],_0xbcdd('0x56'))){var _0x5d4d20=_0x1f790b[_0xbcdd('0x4b')][_0xbcdd('0x41')]('=');var _0x53e81a=_0x5d4d20[0x0][_0xbcdd('0x57')](/cdr\((.*)\)/);if(_0x53e81a){this['channels'][_0x1f790b[_0xbcdd('0x34')]][_0x53e81a[0x1]]=_0x5d4d20[0x1];}}else if(_0x1f790b[_0xbcdd('0x49')]===_0xbcdd('0xd')){this[_0xbcdd('0x17')][_0x1f790b[_0xbcdd('0x34')]][_0xbcdd('0xd')]=_0x1f790b[_0xbcdd('0x4b')][_0xbcdd('0x41')](',')[0x0];}}}}}catch(_0x480398){logger['error'](_0xbcdd('0x58'),util[_0xbcdd('0x48')](_0x480398,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xbcdd('0x1f')]=function(_0x312832){try{if(this[_0xbcdd('0x30')](_0x312832)){if(_0x312832[_0xbcdd('0x34')]!==_0x312832[_0xbcdd('0x39')]){if(this['channels'][_0x312832[_0xbcdd('0x39')]]){if(_0x312832[_0xbcdd('0x3e')]==='6'){if(!this[_0xbcdd('0x17')][_0x312832[_0xbcdd('0x39')]]['answered']){var _0x5bb669=moment();this['channels'][_0x312832[_0xbcdd('0x39')]][_0xbcdd('0x59')]=!![];this[_0xbcdd('0x17')][_0x312832['linkedid']][_0xbcdd('0x5a')]=_0x5bb669[_0xbcdd('0x3b')](_0xbcdd('0x3c'));if(this[_0xbcdd('0x17')][_0x312832[_0xbcdd('0x39')]][_0xbcdd('0x4c')]){this[_0xbcdd('0x17')][_0x312832[_0xbcdd('0x39')]][_0xbcdd('0x5b')]=_0x5bb669['diff'](this[_0xbcdd('0x17')][_0x312832[_0xbcdd('0x39')]][_0xbcdd('0x4c')],_0xbcdd('0x4f'));}}this[_0xbcdd('0x17')][_0x312832[_0xbcdd('0x39')]][_0xbcdd('0x39')]=_0x312832[_0xbcdd('0x34')];if(_0x312832['calleridnum']!=='xcally-motion-preview'){this[_0xbcdd('0x17')][_0x312832[_0xbcdd('0x39')]][_0xbcdd('0x5c')]=_0x312832[_0xbcdd('0x5d')];}this['channels'][_0x312832[_0xbcdd('0x39')]]['connectedlinename']=_0x312832['calleridname'];this[_0xbcdd('0x17')][_0x312832[_0xbcdd('0x39')]][_0xbcdd('0x5e')]=_0x312832[_0xbcdd('0x42')];this[_0xbcdd('0x17')][_0x312832[_0xbcdd('0x39')]]['disposition']=dispositions[_[_0xbcdd('0x5f')](_0x312832[_0xbcdd('0x3e')])];if(this['agents'][_0x312832[_0xbcdd('0x42')]['split']('-')[0x0]]){this[_0xbcdd('0x17')][_0x312832[_0xbcdd('0x39')]][_0xbcdd('0x60')]=this[_0xbcdd('0x18')][_0x312832[_0xbcdd('0x42')]['split']('-')[0x0]]['id'];this[_0xbcdd('0x17')][_0x312832[_0xbcdd('0x39')]][_0xbcdd('0x61')]=this[_0xbcdd('0x18')][_0x312832['channel'][_0xbcdd('0x41')]('-')[0x0]][_0xbcdd('0x62')];}}}}else{if(this[_0xbcdd('0x17')][_0x312832[_0xbcdd('0x34')]]){if(_0x312832[_0xbcdd('0x3e')]==='6'){if(this[_0xbcdd('0x18')][_0x312832['channel'][_0xbcdd('0x41')]('-')[0x0]]){this[_0xbcdd('0x17')][_0x312832[_0xbcdd('0x34')]][_0xbcdd('0x60')]=this[_0xbcdd('0x18')][_0x312832[_0xbcdd('0x42')][_0xbcdd('0x41')]('-')[0x0]]['id'];this[_0xbcdd('0x17')][_0x312832[_0xbcdd('0x34')]]['membername']=this['agents'][_0x312832[_0xbcdd('0x42')][_0xbcdd('0x41')]('-')[0x0]]['name'];}}}}}}catch(_0x5a93a1){logger[_0xbcdd('0x37')]('[syncNewState][VoiceCallReport]',util[_0xbcdd('0x48')](_0x5a93a1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xbcdd('0x2f')]['syncMixMonitorFilename']=function(_0x2923e6,_0x5c9421){if(this[_0xbcdd('0x17')][_0x2923e6]){this[_0xbcdd('0x17')][_0x2923e6][_0xbcdd('0x63')]=!![];if(_[_0xbcdd('0x64')](_0x5c9421,_0xbcdd('0x65'))){_0x5c9421=_0x5c9421['replace'](_0xbcdd('0x65'),_0xbcdd('0x66'));}this['channels'][_0x2923e6]['monitorFilename']=_0x5c9421;var _0x13a9e1=_['find'](this[_0xbcdd('0x17')][_0x2923e6][_0xbcdd('0x67')],{'filename':_0x5c9421});if(_[_0xbcdd('0x68')](_0x13a9e1)){this[_0xbcdd('0x17')][_0x2923e6][_0xbcdd('0x67')][_0xbcdd('0x69')]({'filename':_0x5c9421,'createdAt':moment()[_0xbcdd('0x3b')](_0xbcdd('0x3c')),'mixmonitorid':'','status':_0xbcdd('0x6a')});}}};VoiceCallReport[_0xbcdd('0x2f')][_0xbcdd('0x20')]=function(_0x444a65){try{if(this[_0xbcdd('0x30')](_0x444a65)){if(this[_0xbcdd('0x17')][_0x444a65['uniqueid']]&&_0x444a65['channel']!=_0xbcdd('0x3a')){if(this[_0xbcdd('0x30')](_0x444a65[_0xbcdd('0x6b')])){if(this['isNotNull'](_0x444a65[_0xbcdd('0x6b')]['mixmonitor_filename'])){this[_0xbcdd('0x6c')](_0x444a65[_0xbcdd('0x34')],_0x444a65[_0xbcdd('0x6d')]);}else if(this[_0xbcdd('0x30')](_0x444a65['variable'][_0xbcdd('0x6e')])){this[_0xbcdd('0x17')][_0x444a65[_0xbcdd('0x34')]][_0xbcdd('0x5d')]=_0x444a65[_0xbcdd('0x6d')];}else if(this[_0xbcdd('0x30')](_0x444a65['variable'][_0xbcdd('0x6f')])){this[_0xbcdd('0x17')][_0x444a65['uniqueid']][_0xbcdd('0x70')]=_0x444a65['value'];}else if(this[_0xbcdd('0x30')](_0x444a65['variable'][_0xbcdd('0x71')])){this['channels'][_0x444a65['uniqueid']]['type']=_0x444a65['value'];}else if(this[_0xbcdd('0x30')](_0x444a65['variable'][_0xbcdd('0x72')])){this[_0xbcdd('0x17')][_0x444a65[_0xbcdd('0x34')]]['queue']=_0x444a65[_0xbcdd('0x6d')]['split'](',')[0x0];}else if(this[_0xbcdd('0x30')](_0x444a65[_0xbcdd('0x6b')][_0xbcdd('0x73')])){this['channels'][_0x444a65[_0xbcdd('0x34')]]['originatecalleridnum']=_0x444a65[_0xbcdd('0x6d')];}else if(this[_0xbcdd('0x30')](_0x444a65['variable'][_0xbcdd('0x74')])){this[_0xbcdd('0x17')][_0x444a65[_0xbcdd('0x34')]][_0xbcdd('0x75')]=_0x444a65['value'];}else if(this[_0xbcdd('0x30')](_0x444a65[_0xbcdd('0x6b')][_0xbcdd('0x76')])){this['channels'][_0x444a65[_0xbcdd('0x34')]][_0xbcdd('0x77')]=_0x444a65['value'];}else if(this['isNotNull'](_0x444a65[_0xbcdd('0x6b')]['xmcs-queue'])){this[_0xbcdd('0x17')][_0x444a65['uniqueid']][_0xbcdd('0xd')]=_0x444a65[_0xbcdd('0x6d')];}else if(this[_0xbcdd('0x30')](_0x444a65['variable']['sipcallid'])){this['channels'][_0x444a65['uniqueid']][_0xbcdd('0x78')]=_0x444a65[_0xbcdd('0x6d')];}}}else if(this[_0xbcdd('0x30')](_0x444a65[_0xbcdd('0x6b')][_0xbcdd('0x79')])){if(_0x444a65[_0xbcdd('0x6d')]){var _0x1c1234=path[_0xbcdd('0x7a')](_0x444a65[_0xbcdd('0x6d')])[_0xbcdd('0x62')];this[_0xbcdd('0x6c')](_0x1c1234,_0x444a65[_0xbcdd('0x6d')]);}}else if(this[_0xbcdd('0x17')][_0x444a65['linkedid']]){if(this[_0xbcdd('0x30')](_0x444a65['variable'])){if(this['isNotNull'](_0x444a65['variable'][_0xbcdd('0x7b')])){this['channels'][_0x444a65['linkedid']]['sipcalllinkedid']=_0x444a65[_0xbcdd('0x6d')];}}}}}catch(_0x5a106e){logger[_0xbcdd('0x37')](_0xbcdd('0x7c'),util[_0xbcdd('0x48')](_0x5a106e,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xbcdd('0x22')]=function(_0x380ef4){try{if(this[_0xbcdd('0x30')](_0x380ef4)){if(this['channels'][_0x380ef4[_0xbcdd('0x34')]]){var _0x3f7d41=moment();this[_0xbcdd('0x17')][_0x380ef4[_0xbcdd('0x34')]][_0xbcdd('0x7d')]=_0x3f7d41['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xbcdd('0x17')][_0x380ef4['uniqueid']]['duration']=_0x3f7d41[_0xbcdd('0x7e')](this[_0xbcdd('0x17')][_0x380ef4[_0xbcdd('0x34')]]['starttime'],_0xbcdd('0x4f'));if(this[_0xbcdd('0x17')][_0x380ef4[_0xbcdd('0x34')]][_0xbcdd('0x59')]){this['channels'][_0x380ef4[_0xbcdd('0x34')]]['billableseconds']=_0x3f7d41[_0xbcdd('0x7e')](this[_0xbcdd('0x17')][_0x380ef4['uniqueid']][_0xbcdd('0x5a')],_0xbcdd('0x4f'));this[_0xbcdd('0x17')][_0x380ef4[_0xbcdd('0x34')]][_0xbcdd('0x5b')]=this[_0xbcdd('0x17')][_0x380ef4[_0xbcdd('0x34')]][_0xbcdd('0x4e')]-this['channels'][_0x380ef4[_0xbcdd('0x34')]]['billableseconds'];}if(_0x380ef4['context']===_0xbcdd('0x40')){if(this[_0xbcdd('0x18')][_0x380ef4[_0xbcdd('0x42')]['split']('-')[0x0]]){this[_0xbcdd('0x18')][_0x380ef4[_0xbcdd('0x42')][_0xbcdd('0x41')]('-')[0x0]]=_[_0xbcdd('0x7f')](this[_0xbcdd('0x18')][_0x380ef4[_0xbcdd('0x42')][_0xbcdd('0x41')]('-')[0x0]],['destconnectedlinenum']);this['emit'](util['format'](_0xbcdd('0x45'),this['agents'][_0x380ef4['channel'][_0xbcdd('0x41')]('-')[0x0]][_0xbcdd('0x62')]),_0xbcdd('0x80'),{'destaccountcode':this[_0xbcdd('0x18')][_0x380ef4[_0xbcdd('0x42')][_0xbcdd('0x41')]('-')[0x0]][_0xbcdd('0x47')]});}}ami[_0xbcdd('0x32')]('custom:voiceCallReport',this[_0xbcdd('0x17')][_0x380ef4[_0xbcdd('0x34')]]);delete this[_0xbcdd('0x17')][_0x380ef4[_0xbcdd('0x34')]];}}}catch(_0x5ecb1f){logger[_0xbcdd('0x37')]('[syncHangup][VoiceCallReport]',util['inspect'](_0x5ecb1f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xbcdd('0x2f')][_0xbcdd('0x24')]=function(_0x197ab9){try{if(this[_0xbcdd('0x30')](_0x197ab9)){if(this[_0xbcdd('0x17')][_0x197ab9[_0xbcdd('0x81')]]){this[_0xbcdd('0x17')][_0x197ab9['transfereeuniqueid']][_0xbcdd('0x82')]=_0x197ab9[_0xbcdd('0x83')];this[_0xbcdd('0x17')][_0x197ab9[_0xbcdd('0x81')]][_0xbcdd('0x84')]=_0x197ab9[_0xbcdd('0x85')];if(this['channels'][_0x197ab9['secondtransfereruniqueid']]){var _0x161d51=this[_0xbcdd('0x17')][_0x197ab9[_0xbcdd('0x86')]];this[_0xbcdd('0x17')][_0x197ab9[_0xbcdd('0x86')]]=this['channels'][_0x197ab9[_0xbcdd('0x81')]];this[_0xbcdd('0x17')][_0x197ab9[_0xbcdd('0x81')]]=_0x161d51;}}else if(this[_0xbcdd('0x17')][_0x197ab9[_0xbcdd('0x87')]]){this[_0xbcdd('0x17')][_0x197ab9[_0xbcdd('0x87')]][_0xbcdd('0x82')]=_0x197ab9[_0xbcdd('0x83')];this['channels'][_0x197ab9[_0xbcdd('0x87')]][_0xbcdd('0x84')]=_0x197ab9[_0xbcdd('0x85')];if(this[_0xbcdd('0x17')][_0x197ab9[_0xbcdd('0x88')]]){var _0x161d51=this[_0xbcdd('0x17')][_0x197ab9['origtransfereruniqueid']];this[_0xbcdd('0x17')][_0x197ab9['origtransfereruniqueid']]=this[_0xbcdd('0x17')][_0x197ab9['transfertargetuniqueid']];this[_0xbcdd('0x17')][_0x197ab9[_0xbcdd('0x87')]]=_0x161d51;}}}}catch(_0x2d13c5){logger[_0xbcdd('0x37')]('[syncAttendedTransfer][VoiceCallReport]',util['inspect'](_0x2d13c5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xbcdd('0x2f')][_0xbcdd('0x26')]=function(_0x45fc6a){try{if(this[_0xbcdd('0x30')](_0x45fc6a)){if(this['channels'][_0x45fc6a[_0xbcdd('0x81')]]){this['channels'][_0x45fc6a[_0xbcdd('0x81')]][_0xbcdd('0x82')]=_0x45fc6a[_0xbcdd('0x89')];this[_0xbcdd('0x17')][_0x45fc6a[_0xbcdd('0x81')]][_0xbcdd('0x84')]=_0x45fc6a[_0xbcdd('0x8a')];this[_0xbcdd('0x22')]({'event':'BlindTransfer','uniqueid':_0x45fc6a[_0xbcdd('0x81')],'context':_0x45fc6a[_0xbcdd('0x3f')],'channel':_0x45fc6a[_0xbcdd('0x8b')]});}}}catch(_0x2dde0e){logger[_0xbcdd('0x37')](_0xbcdd('0x8c'),util[_0xbcdd('0x48')](_0x2dde0e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xbcdd('0x2f')]['syncMusicOnHoldStart']=function(_0x2202f5){try{if(this[_0xbcdd('0x30')](_0x2202f5)){if(this['channels'][_0x2202f5[_0xbcdd('0x34')]]){if(!_[_0xbcdd('0x68')](this[_0xbcdd('0x17')][_0x2202f5[_0xbcdd('0x34')]]['answertime'])){this['channels'][_0x2202f5[_0xbcdd('0x34')]][_0xbcdd('0x8d')]=moment()[_0xbcdd('0x3b')](_0xbcdd('0x3c'));}}}}catch(_0x5ca193){logger[_0xbcdd('0x37')]('[syncMusicOnHoldStart][VoiceCallReport]',util['inspect'](_0x5ca193,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xbcdd('0x2f')][_0xbcdd('0x8e')]=function(_0x544412){try{if(this[_0xbcdd('0x30')](_0x544412)){if(this[_0xbcdd('0x17')][_0x544412[_0xbcdd('0x34')]]){if(!_[_0xbcdd('0x68')](this['channels'][_0x544412[_0xbcdd('0x34')]][_0xbcdd('0x8d')])){this[_0xbcdd('0x17')][_0x544412[_0xbcdd('0x34')]]['mohtime']+=moment()[_0xbcdd('0x8f')](0x0)['diff'](this[_0xbcdd('0x17')][_0x544412[_0xbcdd('0x34')]][_0xbcdd('0x8d')],'seconds');delete this[_0xbcdd('0x17')][_0x544412['uniqueid']][_0xbcdd('0x8d')];}}}}catch(_0x10ee73){logger['error']('[syncMusicOnHoldStop][VoiceCallReport]',util[_0xbcdd('0x48')](_0x10ee73,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file +var _0x61b5=['transfercalleridnum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','extension','BlindTransfer','[syncBlindTransfer][VoiceCallReport]','syncMusicOnHoldStart','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','milliseconds','bluebird','lodash','util','path','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','ringing','ringinuse','onhold','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStop','resolve','catch','log','prototype','isUndefined','emit','isNotNull','uniqueid','linkedid','merge','pick','keys','error','[syncNewCallerId][VoiceCallReport]','inspect','OutgoingSpoolFailed','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','context','from-sip','channel','split','destconnectedlinenum','format','user:%s','name','user:agentconnect','exten','[syncNewChannel][VoiceCallReport]','application','toLowerCase','applicationdata','duration','subtract','seconds','lastapplication','lastdata','cdr(','match','[syncNewExten][VoiceCallReport]','answered','holdtime','diff','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','calleridname','destinationchannel','membername','.wav49','replace','.WAV','find','monitors','isNil','push','rec','variable','mixmonitor_filename','syncMixMonitorFilename','xmd-phone','value','xmd-callerid','callerid','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','xmd-callerid-preview','sipcallid','sipcalllinkedid','billableseconds','answertime','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid'];(function(_0x2ef71e,_0x51bb46){var _0x113c9e=function(_0x12618f){while(--_0x12618f){_0x2ef71e['push'](_0x2ef71e['shift']());}};_0x113c9e(++_0x51bb46);}(_0x61b5,0x1ca));var _0x561b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x61b5[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x561b('0x0'));var _=require(_0x561b('0x1'));var moment=require('moment');var util=require(_0x561b('0x2'));var path=require(_0x561b('0x3'));var Redis=require('ioredis');var config=require(_0x561b('0x4'));var logger=require(_0x561b('0x5'))(_0x561b('0x6'));var ami=require(_0x561b('0x7'));var Channel=require(_0x561b('0x8'));var statusDesc=[_0x561b('0x9'),_0x561b('0xa'),_0x561b('0xb'),_0x561b('0xc'),_0x561b('0xd'),'unavailable',_0x561b('0xe'),_0x561b('0xf'),_0x561b('0x10')];var applications=[_0x561b('0x11'),_0x561b('0x12'),_0x561b('0x13'),_0x561b('0x14'),_0x561b('0x15'),_0x561b('0x16')];var dispositions=[_0x561b('0x17'),_0x561b('0x18'),'FAILED',_0x561b('0x17'),_0x561b('0x17'),_0x561b('0x17'),_0x561b('0x19'),_0x561b('0x1a'),_0x561b('0x18'),_0x561b('0x18'),_0x561b('0x18')];var actions={};config[_0x561b('0x1b')]=_[_0x561b('0x1c')](config[_0x561b('0x1b')],{'host':_0x561b('0x1d'),'port':0x18eb});var io=require(_0x561b('0x1e'))(new Redis(config[_0x561b('0x1b')]));function VoiceCallReport(_0x455d81){this[_0x561b('0x1f')]=_0x455d81[_0x561b('0x1f')];this[_0x561b('0x20')]=_0x455d81[_0x561b('0x20')];ami['on'](_0x561b('0x21'),this[_0x561b('0x22')][_0x561b('0x23')](this));ami['on']('newexten',this[_0x561b('0x22')][_0x561b('0x23')](this));ami['on'](_0x561b('0x24'),this[_0x561b('0x25')][_0x561b('0x23')](this));ami['on'](_0x561b('0x26'),this[_0x561b('0x27')][_0x561b('0x23')](this));ami['on'](_0x561b('0x28'),this[_0x561b('0x29')]['bind'](this));ami['on'](_0x561b('0x2a'),this[_0x561b('0x2b')]['bind'](this));ami['on'](_0x561b('0x2c'),this[_0x561b('0x2d')][_0x561b('0x23')](this));ami['on'](_0x561b('0x2e'),this[_0x561b('0x2f')][_0x561b('0x23')](this));ami['on'](_0x561b('0x30'),this[_0x561b('0x31')][_0x561b('0x23')](this));ami['on'](_0x561b('0x32'),this['syncMusicOnHoldStart'][_0x561b('0x23')](this));ami['on']('musiconholdstop',this[_0x561b('0x33')][_0x561b('0x23')](this));return BPromise[_0x561b('0x34')]()['then'](ami['actionCoreShowChannels']())[_0x561b('0x35')](function(_0x546afc){console[_0x561b('0x36')](_0x546afc);});}VoiceCallReport[_0x561b('0x37')]['isNotNull']=function(_0x3e6691){return _0x3e6691!==null&&!_[_0x561b('0x38')](_0x3e6691);};VoiceCallReport['prototype'][_0x561b('0x39')]=function(_0x197994,_0x47cc8b,_0x4d8ad7){io['to'](_0x197994)['emit'](_0x47cc8b,_0x4d8ad7);};VoiceCallReport[_0x561b('0x37')]['syncNewCallerId']=function(_0x5bf716){try{if(this[_0x561b('0x3a')](_0x5bf716)){if(_0x5bf716[_0x561b('0x3b')]===_0x5bf716[_0x561b('0x3c')]){if(!_['isUndefined'](this[_0x561b('0x1f')][_0x5bf716[_0x561b('0x3b')]])){_[_0x561b('0x3d')](this['channels'][_0x5bf716[_0x561b('0x3b')]],_[_0x561b('0x3e')](_0x5bf716,_[_0x561b('0x3f')](this['channels'][_0x5bf716[_0x561b('0x3b')]])));}}}}catch(_0x1b17b9){logger[_0x561b('0x40')](_0x561b('0x41'),util[_0x561b('0x42')](_0x1b17b9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x561b('0x37')]['syncNewChannel']=function(_0x109d8a){try{if(this[_0x561b('0x3a')](_0x109d8a)){if(_0x109d8a['uniqueid']===_0x109d8a[_0x561b('0x3c')]&&_0x109d8a['channel']!=_0x561b('0x43')){if(_[_0x561b('0x38')](this['channels'][_0x109d8a['uniqueid']])){this[_0x561b('0x1f')][_0x109d8a[_0x561b('0x3b')]]=new Channel();this['channels'][_0x109d8a['uniqueid']][_0x561b('0x44')]=moment()['format'](_0x561b('0x45'));this[_0x561b('0x1f')][_0x109d8a[_0x561b('0x3b')]][_0x561b('0x46')]=dispositions[_[_0x561b('0x47')](_0x109d8a[_0x561b('0x48')])];_[_0x561b('0x3d')](this[_0x561b('0x1f')][_0x109d8a[_0x561b('0x3b')]],_['pick'](_0x109d8a,_['keys'](this[_0x561b('0x1f')][_0x109d8a['uniqueid']])));if(_0x109d8a[_0x561b('0x49')]===_0x561b('0x4a')){if(this[_0x561b('0x20')][_0x109d8a[_0x561b('0x4b')][_0x561b('0x4c')]('-')[0x0]]){this[_0x561b('0x20')][_0x109d8a[_0x561b('0x4b')][_0x561b('0x4c')]('-')[0x0]][_0x561b('0x4d')]=_0x109d8a['exten'];this[_0x561b('0x39')](util[_0x561b('0x4e')](_0x561b('0x4f'),this[_0x561b('0x20')][_0x109d8a[_0x561b('0x4b')][_0x561b('0x4c')]('-')[0x0]][_0x561b('0x50')]),_0x561b('0x51'),{'destaccountcode':this[_0x561b('0x20')][_0x109d8a[_0x561b('0x4b')][_0x561b('0x4c')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x109d8a[_0x561b('0x52')]});}}}}}}catch(_0xcac2d1){logger['error'](_0x561b('0x53'),util[_0x561b('0x42')](_0xcac2d1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x561b('0x37')][_0x561b('0x22')]=function(_0x4eab06){try{if(this[_0x561b('0x3a')](_0x4eab06)){if(_0x4eab06[_0x561b('0x3b')]===_0x4eab06['linkedid']&&_0x4eab06['exten']!='h'&&_0x4eab06[_0x561b('0x4b')]!=_0x561b('0x43')){_0x4eab06['application']=_0x4eab06[_0x561b('0x54')][_0x561b('0x55')]();_0x4eab06[_0x561b('0x56')]=(_0x4eab06['appdata']||_0x4eab06['applicationdata'])[_0x561b('0x55')]();if(_[_0x561b('0x38')](this[_0x561b('0x1f')][_0x4eab06[_0x561b('0x3b')]])){this['channels'][_0x4eab06[_0x561b('0x3b')]]=new Channel();this[_0x561b('0x1f')][_0x4eab06[_0x561b('0x3b')]]['starttime']=_0x4eab06[_0x561b('0x57')]?moment()[_0x561b('0x58')](moment[_0x561b('0x57')](_0x4eab06['duration'])[_0x561b('0x59')](),_0x561b('0x59'))[_0x561b('0x4e')]('YYYY-MM-DD\x20HH:mm:ss'):moment()['format'](_0x561b('0x45'));this[_0x561b('0x1f')][_0x4eab06['uniqueid']][_0x561b('0x46')]=_0x561b('0x17');}_[_0x561b('0x3d')](this[_0x561b('0x1f')][_0x4eab06[_0x561b('0x3b')]],_[_0x561b('0x3e')](_0x4eab06,_[_0x561b('0x3f')](this[_0x561b('0x1f')][_0x4eab06[_0x561b('0x3b')]])));if(_['includes'](applications,_0x4eab06[_0x561b('0x54')])){this[_0x561b('0x1f')][_0x4eab06['uniqueid']][_0x561b('0x5a')]=_0x4eab06[_0x561b('0x54')];this['channels'][_0x4eab06[_0x561b('0x3b')]][_0x561b('0x5b')]=_0x4eab06['applicationdata'];if(_0x4eab06['application']===_0x561b('0x11')&&_['startsWith'](_0x4eab06[_0x561b('0x56')],_0x561b('0x5c'))){var _0x588de0=_0x4eab06[_0x561b('0x56')][_0x561b('0x4c')]('=');var _0x411980=_0x588de0[0x0][_0x561b('0x5d')](/cdr\((.*)\)/);if(_0x411980){this['channels'][_0x4eab06[_0x561b('0x3b')]][_0x411980[0x1]]=_0x588de0[0x1];}}else if(_0x4eab06[_0x561b('0x54')]==='queue'){this[_0x561b('0x1f')][_0x4eab06[_0x561b('0x3b')]][_0x561b('0x12')]=_0x4eab06['applicationdata'][_0x561b('0x4c')](',')[0x0];}}}}}catch(_0x150d49){logger[_0x561b('0x40')](_0x561b('0x5e'),util['inspect'](_0x150d49,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x561b('0x37')][_0x561b('0x27')]=function(_0x4fe4ef){try{if(this[_0x561b('0x3a')](_0x4fe4ef)){if(_0x4fe4ef['uniqueid']!==_0x4fe4ef[_0x561b('0x3c')]){if(this['channels'][_0x4fe4ef[_0x561b('0x3c')]]){if(_0x4fe4ef[_0x561b('0x48')]==='6'){if(!this[_0x561b('0x1f')][_0x4fe4ef['linkedid']][_0x561b('0x5f')]){var _0x847abb=moment();this[_0x561b('0x1f')][_0x4fe4ef[_0x561b('0x3c')]]['answered']=!![];this[_0x561b('0x1f')][_0x4fe4ef[_0x561b('0x3c')]]['answertime']=_0x847abb[_0x561b('0x4e')](_0x561b('0x45'));if(this['channels'][_0x4fe4ef['linkedid']][_0x561b('0x44')]){this['channels'][_0x4fe4ef['linkedid']][_0x561b('0x60')]=_0x847abb[_0x561b('0x61')](this[_0x561b('0x1f')][_0x4fe4ef[_0x561b('0x3c')]][_0x561b('0x44')],_0x561b('0x59'));}}this[_0x561b('0x1f')][_0x4fe4ef[_0x561b('0x3c')]][_0x561b('0x3c')]=_0x4fe4ef[_0x561b('0x3b')];if(_0x4fe4ef[_0x561b('0x62')]!==_0x561b('0x63')){this['channels'][_0x4fe4ef[_0x561b('0x3c')]][_0x561b('0x64')]=_0x4fe4ef[_0x561b('0x62')];}this[_0x561b('0x1f')][_0x4fe4ef[_0x561b('0x3c')]][_0x561b('0x65')]=_0x4fe4ef[_0x561b('0x66')];this['channels'][_0x4fe4ef[_0x561b('0x3c')]][_0x561b('0x67')]=_0x4fe4ef[_0x561b('0x4b')];this['channels'][_0x4fe4ef['linkedid']][_0x561b('0x46')]=dispositions[_['toNumber'](_0x4fe4ef['channelstate'])];if(this['agents'][_0x4fe4ef[_0x561b('0x4b')][_0x561b('0x4c')]('-')[0x0]]){this['channels'][_0x4fe4ef[_0x561b('0x3c')]]['UserId']=this[_0x561b('0x20')][_0x4fe4ef[_0x561b('0x4b')][_0x561b('0x4c')]('-')[0x0]]['id'];this[_0x561b('0x1f')][_0x4fe4ef[_0x561b('0x3c')]][_0x561b('0x68')]=this['agents'][_0x4fe4ef[_0x561b('0x4b')][_0x561b('0x4c')]('-')[0x0]][_0x561b('0x50')];}}}}else{if(this[_0x561b('0x1f')][_0x4fe4ef[_0x561b('0x3b')]]){if(_0x4fe4ef['channelstate']==='6'){if(this['agents'][_0x4fe4ef['channel'][_0x561b('0x4c')]('-')[0x0]]){this['channels'][_0x4fe4ef[_0x561b('0x3b')]]['UserId']=this['agents'][_0x4fe4ef[_0x561b('0x4b')][_0x561b('0x4c')]('-')[0x0]]['id'];this[_0x561b('0x1f')][_0x4fe4ef[_0x561b('0x3b')]][_0x561b('0x68')]=this[_0x561b('0x20')][_0x4fe4ef[_0x561b('0x4b')]['split']('-')[0x0]][_0x561b('0x50')];}}}}}}catch(_0x5127a8){logger['error']('[syncNewState][VoiceCallReport]',util[_0x561b('0x42')](_0x5127a8,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMixMonitorFilename']=function(_0x28a568,_0x3bbcd1){if(this[_0x561b('0x1f')][_0x28a568]){this[_0x561b('0x1f')][_0x28a568]['monitor']=!![];if(_['endsWith'](_0x3bbcd1,_0x561b('0x69'))){_0x3bbcd1=_0x3bbcd1[_0x561b('0x6a')](_0x561b('0x69'),_0x561b('0x6b'));}this[_0x561b('0x1f')][_0x28a568]['monitorFilename']=_0x3bbcd1;var _0x5842c8=_[_0x561b('0x6c')](this[_0x561b('0x1f')][_0x28a568][_0x561b('0x6d')],{'filename':_0x3bbcd1});if(_[_0x561b('0x6e')](_0x5842c8)){this[_0x561b('0x1f')][_0x28a568][_0x561b('0x6d')][_0x561b('0x6f')]({'filename':_0x3bbcd1,'createdAt':moment()[_0x561b('0x4e')](_0x561b('0x45')),'mixmonitorid':'','status':_0x561b('0x70')});}}};VoiceCallReport['prototype'][_0x561b('0x29')]=function(_0x1472c6){try{if(this[_0x561b('0x3a')](_0x1472c6)){if(this['channels'][_0x1472c6[_0x561b('0x3b')]]&&_0x1472c6['channel']!=_0x561b('0x43')){if(this[_0x561b('0x3a')](_0x1472c6[_0x561b('0x71')])){if(this[_0x561b('0x3a')](_0x1472c6[_0x561b('0x71')][_0x561b('0x72')])){this[_0x561b('0x73')](_0x1472c6[_0x561b('0x3b')],_0x1472c6['value']);}else if(this[_0x561b('0x3a')](_0x1472c6[_0x561b('0x71')][_0x561b('0x74')])){this[_0x561b('0x1f')][_0x1472c6[_0x561b('0x3b')]]['calleridnum']=_0x1472c6[_0x561b('0x75')];}else if(this[_0x561b('0x3a')](_0x1472c6[_0x561b('0x71')][_0x561b('0x76')])){this[_0x561b('0x1f')][_0x1472c6[_0x561b('0x3b')]][_0x561b('0x77')]=_0x1472c6[_0x561b('0x75')];}else if(this['isNotNull'](_0x1472c6['variable']['xmd-cdrtype'])){this['channels'][_0x1472c6['uniqueid']]['type']=_0x1472c6[_0x561b('0x75')];}else if(this['isNotNull'](_0x1472c6[_0x561b('0x71')][_0x561b('0x78')])){this['channels'][_0x1472c6[_0x561b('0x3b')]]['queue']=_0x1472c6[_0x561b('0x75')][_0x561b('0x4c')](',')[0x0];}else if(this[_0x561b('0x3a')](_0x1472c6[_0x561b('0x71')][_0x561b('0x79')])){this['channels'][_0x1472c6[_0x561b('0x3b')]][_0x561b('0x7a')]=_0x1472c6[_0x561b('0x75')];}else if(this['isNotNull'](_0x1472c6[_0x561b('0x71')][_0x561b('0x7b')])){this[_0x561b('0x1f')][_0x1472c6[_0x561b('0x3b')]]['destination']=_0x1472c6[_0x561b('0x75')];}else if(this[_0x561b('0x3a')](_0x1472c6[_0x561b('0x71')][_0x561b('0x7c')])){this['channels'][_0x1472c6[_0x561b('0x3b')]]['calleridpreview']=_0x1472c6['value'];}else if(this[_0x561b('0x3a')](_0x1472c6[_0x561b('0x71')]['xmcs-queue'])){this[_0x561b('0x1f')][_0x1472c6[_0x561b('0x3b')]]['queue']=_0x1472c6[_0x561b('0x75')];}else if(this[_0x561b('0x3a')](_0x1472c6['variable'][_0x561b('0x7d')])){this[_0x561b('0x1f')][_0x1472c6['uniqueid']]['sipcalluniqueid']=_0x1472c6[_0x561b('0x75')];}}}else if(this[_0x561b('0x3a')](_0x1472c6[_0x561b('0x71')][_0x561b('0x72')])){if(_0x1472c6['value']){var _0x4c7a9f=path['parse'](_0x1472c6[_0x561b('0x75')])[_0x561b('0x50')];this['syncMixMonitorFilename'](_0x4c7a9f,_0x1472c6['value']);}}else if(this['channels'][_0x1472c6[_0x561b('0x3c')]]){if(this['isNotNull'](_0x1472c6[_0x561b('0x71')])){if(this[_0x561b('0x3a')](_0x1472c6[_0x561b('0x71')][_0x561b('0x7d')])){this[_0x561b('0x1f')][_0x1472c6[_0x561b('0x3c')]][_0x561b('0x7e')]=_0x1472c6[_0x561b('0x75')];}}}}}catch(_0x40e872){logger['error']('[syncVarSet][VoiceCallReport]',util[_0x561b('0x42')](_0x40e872,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x561b('0x2b')]=function(_0x5b48e9){try{if(this[_0x561b('0x3a')](_0x5b48e9)){if(this['channels'][_0x5b48e9['uniqueid']]){var _0xec7370=moment();this[_0x561b('0x1f')][_0x5b48e9['uniqueid']]['endtime']=_0xec7370[_0x561b('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x561b('0x1f')][_0x5b48e9[_0x561b('0x3b')]]['duration']=_0xec7370[_0x561b('0x61')](this[_0x561b('0x1f')][_0x5b48e9[_0x561b('0x3b')]][_0x561b('0x44')],_0x561b('0x59'));if(this['channels'][_0x5b48e9[_0x561b('0x3b')]]['answered']){this['channels'][_0x5b48e9[_0x561b('0x3b')]][_0x561b('0x7f')]=_0xec7370[_0x561b('0x61')](this['channels'][_0x5b48e9['uniqueid']][_0x561b('0x80')],'seconds');this[_0x561b('0x1f')][_0x5b48e9[_0x561b('0x3b')]]['holdtime']=this[_0x561b('0x1f')][_0x5b48e9['uniqueid']]['duration']-this[_0x561b('0x1f')][_0x5b48e9['uniqueid']][_0x561b('0x7f')];}if(_0x5b48e9['context']===_0x561b('0x4a')){if(this[_0x561b('0x20')][_0x5b48e9[_0x561b('0x4b')][_0x561b('0x4c')]('-')[0x0]]){this[_0x561b('0x20')][_0x5b48e9[_0x561b('0x4b')][_0x561b('0x4c')]('-')[0x0]]=_['omit'](this['agents'][_0x5b48e9[_0x561b('0x4b')]['split']('-')[0x0]],[_0x561b('0x4d')]);this['emit'](util[_0x561b('0x4e')](_0x561b('0x4f'),this[_0x561b('0x20')][_0x5b48e9['channel']['split']('-')[0x0]]['name']),_0x561b('0x81'),{'destaccountcode':this[_0x561b('0x20')][_0x5b48e9[_0x561b('0x4b')][_0x561b('0x4c')]('-')[0x0]]['accountcode']});}}ami[_0x561b('0x39')](_0x561b('0x82'),this[_0x561b('0x1f')][_0x5b48e9[_0x561b('0x3b')]]);delete this['channels'][_0x5b48e9[_0x561b('0x3b')]];}}}catch(_0x1cc9f7){logger['error'](_0x561b('0x83'),util['inspect'](_0x1cc9f7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x561b('0x37')][_0x561b('0x2f')]=function(_0x51819e){try{if(this[_0x561b('0x3a')](_0x51819e)){if(this['channels'][_0x51819e['transfereeuniqueid']]){this[_0x561b('0x1f')][_0x51819e[_0x561b('0x84')]]['transfercalleridnum']=_0x51819e[_0x561b('0x85')];this[_0x561b('0x1f')][_0x51819e[_0x561b('0x84')]][_0x561b('0x86')]=_0x51819e[_0x561b('0x87')];if(this['channels'][_0x51819e[_0x561b('0x88')]]){var _0x13da78=this[_0x561b('0x1f')][_0x51819e['secondtransfereruniqueid']];this[_0x561b('0x1f')][_0x51819e[_0x561b('0x88')]]=this[_0x561b('0x1f')][_0x51819e[_0x561b('0x84')]];this[_0x561b('0x1f')][_0x51819e[_0x561b('0x84')]]=_0x13da78;}}else if(this['channels'][_0x51819e[_0x561b('0x89')]]){this[_0x561b('0x1f')][_0x51819e[_0x561b('0x89')]][_0x561b('0x8a')]=_0x51819e[_0x561b('0x85')];this[_0x561b('0x1f')][_0x51819e['transfertargetuniqueid']][_0x561b('0x86')]=_0x51819e[_0x561b('0x87')];if(this['channels'][_0x51819e[_0x561b('0x8b')]]){var _0x13da78=this['channels'][_0x51819e['origtransfereruniqueid']];this[_0x561b('0x1f')][_0x51819e[_0x561b('0x8b')]]=this[_0x561b('0x1f')][_0x51819e[_0x561b('0x89')]];this[_0x561b('0x1f')][_0x51819e[_0x561b('0x89')]]=_0x13da78;}}}}catch(_0x53ee5d){logger[_0x561b('0x40')](_0x561b('0x8c'),util[_0x561b('0x42')](_0x53ee5d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x561b('0x37')][_0x561b('0x31')]=function(_0x4281db){try{if(this[_0x561b('0x3a')](_0x4281db)){if(this[_0x561b('0x1f')][_0x4281db[_0x561b('0x84')]]){this['channels'][_0x4281db[_0x561b('0x84')]][_0x561b('0x8a')]=_0x4281db['transfereecalleridnum'];this[_0x561b('0x1f')][_0x4281db[_0x561b('0x84')]]['transferconnectedlinenum']=_0x4281db[_0x561b('0x8d')];this[_0x561b('0x2b')]({'event':_0x561b('0x8e'),'uniqueid':_0x4281db[_0x561b('0x84')],'context':_0x4281db[_0x561b('0x49')],'channel':_0x4281db['transfererchannel']});}}}catch(_0x37efd3){logger[_0x561b('0x40')](_0x561b('0x8f'),util[_0x561b('0x42')](_0x37efd3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x561b('0x37')][_0x561b('0x90')]=function(_0x34120b){try{if(this[_0x561b('0x3a')](_0x34120b)){if(this[_0x561b('0x1f')][_0x34120b[_0x561b('0x3b')]]){if(!_['isNil'](this['channels'][_0x34120b[_0x561b('0x3b')]][_0x561b('0x80')])){this[_0x561b('0x1f')][_0x34120b[_0x561b('0x3b')]][_0x561b('0x91')]=moment()[_0x561b('0x4e')](_0x561b('0x45'));}}}}catch(_0x321dc7){logger[_0x561b('0x40')](_0x561b('0x92'),util[_0x561b('0x42')](_0x321dc7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x561b('0x37')][_0x561b('0x33')]=function(_0x21e83b){try{if(this['isNotNull'](_0x21e83b)){if(this[_0x561b('0x1f')][_0x21e83b[_0x561b('0x3b')]]){if(!_[_0x561b('0x6e')](this[_0x561b('0x1f')][_0x21e83b[_0x561b('0x3b')]][_0x561b('0x91')])){this[_0x561b('0x1f')][_0x21e83b[_0x561b('0x3b')]][_0x561b('0x93')]+=moment()[_0x561b('0x94')](0x0)['diff'](this['channels'][_0x21e83b[_0x561b('0x3b')]][_0x561b('0x91')],_0x561b('0x59'));delete this[_0x561b('0x1f')][_0x21e83b[_0x561b('0x3b')]][_0x561b('0x91')];}}}}catch(_0x346d25){logger[_0x561b('0x40')]('[syncMusicOnHoldStop][VoiceCallReport]',util[_0x561b('0x42')](_0x346d25,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 40262c8..9d120f1 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 _0x5752=['hangup','syncHangup','prototype','isNotNull','emit','merge','uniqueid','format','called','channel','substring','lastIndexOf','omit','event','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','voice:outbound','addVariable','variable','value','isUndefined','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','includes','endtime','duration','diff','starttime','seconds','complete','total','holdtime','sumHoldTime','sumBillable','billableseconds','sumDuration','custom:voiceDialReport','custom:dialend','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','syncDialEnd','varset','syncVarSet'];(function(_0x6dbf11,_0x8d1b5a){var _0x31986b=function(_0x167fa6){while(--_0x167fa6){_0x6dbf11['push'](_0x6dbf11['shift']());}};_0x31986b(++_0x8d1b5a);}(_0x5752,0x99));var _0x2575=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x5752[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x2575('0x0'));var moment=require(_0x2575('0x1'));var util=require(_0x2575('0x2'));var Redis=require(_0x2575('0x3'));var config=require(_0x2575('0x4'));var logger=require(_0x2575('0x5'))(_0x2575('0x6'));var ami=require(_0x2575('0x7'));config[_0x2575('0x8')]=_['defaults'](config[_0x2575('0x8')],{'host':_0x2575('0x9'),'port':0x18eb});var io=require(_0x2575('0xa'))(new Redis(config[_0x2575('0x8')]));function VoiceDialReport(_0x21d6ff){this[_0x2575('0xb')]=_0x21d6ff[_0x2575('0xc')];this[_0x2575('0xd')]=_0x21d6ff[_0x2575('0xd')];this[_0x2575('0xe')]={};ami['on'](_0x2575('0xf'),this[_0x2575('0x10')][_0x2575('0x11')](this));ami['on']('dialend',this[_0x2575('0x12')][_0x2575('0x11')](this));ami['on'](_0x2575('0x13'),this[_0x2575('0x14')][_0x2575('0x11')](this));ami['on'](_0x2575('0x15'),this[_0x2575('0x16')][_0x2575('0x11')](this));}VoiceDialReport[_0x2575('0x17')][_0x2575('0x18')]=function(_0x51eef0){return _0x51eef0!==null&&!_['isUndefined'](_0x51eef0);};VoiceDialReport[_0x2575('0x17')][_0x2575('0x19')]=function(_0x500200,_0x44918d,_0x458d6a){io['to'](_0x500200)[_0x2575('0x19')](_0x44918d,_0x458d6a);};VoiceDialReport[_0x2575('0x17')][_0x2575('0x10')]=function(_0x1172f7){try{if(this[_0x2575('0x18')](_0x1172f7)){if(this[_0x2575('0xb')][_0x1172f7['uniqueid']]){_[_0x2575('0x1a')](this[_0x2575('0xb')][_0x1172f7[_0x2575('0x1b')]],{'starttime':moment()[_0x2575('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x2575('0x1d'),'interface':_0x1172f7[_0x2575('0x1e')][_0x2575('0x1f')](0x0,_0x1172f7[_0x2575('0x1e')][_0x2575('0x20')]('-')),'membername':_0x1172f7[_0x2575('0x1e')][_0x2575('0x1f')](_0x1172f7[_0x2575('0x1e')]['lastIndexOf']('/')+0x1,_0x1172f7[_0x2575('0x1e')][_0x2575('0x20')]('-'))},_[_0x2575('0x21')](_0x1172f7,[_0x2575('0x22'),'privilege']));this[_0x2575('0x19')]('voice:outbound',_0x2575('0x23'),this[_0x2575('0xb')][_0x1172f7[_0x2575('0x1b')]]);ami[_0x2575('0x19')](_0x2575('0x24'),this[_0x2575('0xb')][_0x1172f7[_0x2575('0x1b')]]);}}}catch(_0x388078){logger[_0x2575('0x25')](_0x2575('0x26'),util[_0x2575('0x27')](_0x388078,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2575('0x17')][_0x2575('0x12')]=function(_0x554936){try{if(this[_0x2575('0x18')](_0x554936)){if(this['channels'][_0x554936[_0x2575('0x1b')]]){this['channels'][_0x554936[_0x2575('0x1b')]][_0x2575('0x28')]=_0x554936['dialstatus'];if(_0x554936[_0x2575('0x28')]===_0x2575('0x29')){this[_0x2575('0xb')][_0x554936[_0x2575('0x1b')]][_0x2575('0x2a')]=_0x554936[_0x2575('0x2a')];this[_0x2575('0xb')][_0x554936[_0x2575('0x1b')]][_0x2575('0x2b')]=_0x554936[_0x2575('0x2b')];this['channels'][_0x554936[_0x2575('0x1b')]][_0x2575('0x2c')]=moment()[_0x2575('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2575('0xb')][_0x554936[_0x2575('0x1b')]][_0x2575('0x2d')]='connect';ami[_0x2575('0x19')]('custom:dialconnect',this['channels'][_0x554936[_0x2575('0x1b')]]);}this[_0x2575('0x19')](_0x2575('0x2e'),_0x2575('0x23'),this[_0x2575('0xb')][_0x554936[_0x2575('0x1b')]]);}}}catch(_0x1e0210){logger[_0x2575('0x25')]('[syncDialEnd][VoiceDialReport]',util[_0x2575('0x27')](_0x1e0210,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2575('0x17')]['syncVarSet']=function(_0x66cfd7){try{if(this[_0x2575('0x18')](_0x66cfd7)){this[_0x2575('0x2f')](_0x66cfd7[_0x2575('0x1b')],_['keys'](_0x66cfd7[_0x2575('0x30')])[0x0],_0x66cfd7[_0x2575('0x31')]);if(this['isNotNull'](_0x66cfd7['variable'])&&this['isNotNull'](_0x66cfd7[_0x2575('0x30')]['outboundrouteid'])){if(_[_0x2575('0x32')](this['channels'][_0x66cfd7[_0x2575('0x1b')]])){this[_0x2575('0xb')][_0x66cfd7['uniqueid']]={'routeId':_0x66cfd7['value'],'variables':this['variables'][_0x66cfd7[_0x2575('0x1b')]]};this[_0x2575('0x19')](_0x2575('0x2e'),'voice_outbound_channel:save',this[_0x2575('0xb')][_0x66cfd7[_0x2575('0x1b')]]);}}}}catch(_0x56e5be){logger[_0x2575('0x25')](_0x2575('0x33'),util[_0x2575('0x27')](_0x56e5be,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x2575('0x17')][_0x2575('0x2f')]=function(_0x2f1b50,_0x2c77bd,_0x27ff0d){var _0x3c2cdc=[_0x2575('0x34'),_0x2575('0x35'),_0x2575('0x36'),_0x2575('0x37'),_0x2575('0x38'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x2575('0x39'),_0x2575('0x3a'),_0x2575('0x3b'),'bridgepeer',_0x2575('0x3c'),'membercalls',_0x2575('0x3d'),_0x2575('0x3e'),_0x2575('0x3f'),_0x2575('0x40'),_0x2575('0x41'),_0x2575('0x42')];if(!_['isNil'](_0x2c77bd)&&!_[_0x2575('0x43')](_0x3c2cdc,_0x2c77bd)){if(_['isUndefined'](this[_0x2575('0xe')][_0x2f1b50])){this[_0x2575('0xe')][_0x2f1b50]={};}this[_0x2575('0xe')][_0x2f1b50][_0x2c77bd]=_0x27ff0d;}};VoiceDialReport[_0x2575('0x17')][_0x2575('0x16')]=function(_0x3df79b){try{if(this[_0x2575('0x18')](_0x3df79b)){if(this[_0x2575('0xb')][_0x3df79b['uniqueid']]){this['channels'][_0x3df79b[_0x2575('0x1b')]][_0x2575('0x44')]=moment()[_0x2575('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2575('0xb')][_0x3df79b[_0x2575('0x1b')]][_0x2575('0x45')]=moment(this[_0x2575('0xb')][_0x3df79b[_0x2575('0x1b')]][_0x2575('0x44')])[_0x2575('0x46')](this[_0x2575('0xb')][_0x3df79b['uniqueid']][_0x2575('0x47')],_0x2575('0x48'));this[_0x2575('0xb')][_0x3df79b['uniqueid']][_0x2575('0x2d')]=_0x2575('0x49');this[_0x2575('0xd')][_0x2575('0x4a')]+=0x1;if(this['channels'][_0x3df79b[_0x2575('0x1b')]][_0x2575('0x2c')]){this['outbound']['answered']+=0x1;this[_0x2575('0xb')][_0x3df79b[_0x2575('0x1b')]][_0x2575('0x4b')]=moment(this['channels'][_0x3df79b[_0x2575('0x1b')]]['answertime'])[_0x2575('0x46')](this[_0x2575('0xb')][_0x3df79b[_0x2575('0x1b')]][_0x2575('0x47')],'seconds');this[_0x2575('0xb')][_0x3df79b['uniqueid']]['billableseconds']=moment(this['channels'][_0x3df79b[_0x2575('0x1b')]][_0x2575('0x44')])[_0x2575('0x46')](this[_0x2575('0xb')][_0x3df79b['uniqueid']][_0x2575('0x2c')],'seconds');this[_0x2575('0xd')][_0x2575('0x4c')]+=this[_0x2575('0xb')][_0x3df79b[_0x2575('0x1b')]]['holdtime']||0x0;this[_0x2575('0xd')][_0x2575('0x4d')]+=this[_0x2575('0xb')][_0x3df79b[_0x2575('0x1b')]][_0x2575('0x4e')];}this[_0x2575('0xd')][_0x2575('0x4f')]+=this[_0x2575('0xb')][_0x3df79b[_0x2575('0x1b')]][_0x2575('0x45')];ami[_0x2575('0x19')](_0x2575('0x50'),this[_0x2575('0xb')][_0x3df79b[_0x2575('0x1b')]]);ami['emit'](_0x2575('0x51'),this['channels'][_0x3df79b[_0x2575('0x1b')]]);this[_0x2575('0x19')](_0x2575('0x2e'),_0x2575('0x52'),this[_0x2575('0xd')]);logger[_0x2575('0x53')](_0x2575('0x54'),JSON[_0x2575('0x55')](this[_0x2575('0xb')][_0x3df79b[_0x2575('0x1b')]]));this[_0x2575('0x19')](_0x2575('0x2e'),'voice_outbound_channel:remove',this['channels'][_0x3df79b[_0x2575('0x1b')]]);delete this[_0x2575('0xb')][_0x3df79b[_0x2575('0x1b')]];}if(this['variables'][_0x3df79b[_0x2575('0x1b')]]){delete this[_0x2575('0xe')][_0x3df79b[_0x2575('0x1b')]];}}}catch(_0x196473){logger[_0x2575('0x25')]('[syncHangup][VoiceDialReport]',util[_0x2575('0x27')](_0x196473,{'showHidden':![],'depth':null}));}};module[_0x2575('0x56')]=VoiceDialReport; \ No newline at end of file +var _0x9f7e=['bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','membername','isNil','syncHangup','endtime','duration','starttime','seconds','lastevent','complete','total','holdtime','diff','billableseconds','sumBillable','sumDuration','custom:voiceDialReport','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','[syncHangup][VoiceDialReport]','exports','moment','../../../config/environment','ami','../ami','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','isNotNull','isUndefined','prototype','emit','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','lastIndexOf','substring','omit','event','voice_outbound_channel:save','custom:dialbegin','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','connectedlinenum','answertime','connect','voice:outbound','error','addVariable','variable','value','outboundrouteid','[syncVarSet][VoiceDialReport]','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri'];(function(_0xdde3d9,_0x8857c1){var _0x2d435b=function(_0x19b29d){while(--_0x19b29d){_0xdde3d9['push'](_0xdde3d9['shift']());}};_0x2d435b(++_0x8857c1);}(_0x9f7e,0x19f));var _0xe9f7=function(_0x26267b,_0x4aafec){_0x26267b=_0x26267b-0x0;var _0x963716=_0x9f7e[_0x26267b];return _0x963716;};'use strict';var _=require('lodash');var moment=require(_0xe9f7('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0xe9f7('0x1'));var logger=require('../../../config/logger')(_0xe9f7('0x2'));var ami=require(_0xe9f7('0x3'));config['redis']=_['defaults'](config['redis'],{'host':_0xe9f7('0x4'),'port':0x18eb});var io=require(_0xe9f7('0x5'))(new Redis(config['redis']));function VoiceDialReport(_0x4a7bf9){this[_0xe9f7('0x6')]=_0x4a7bf9[_0xe9f7('0x7')];this['outbound']=_0x4a7bf9[_0xe9f7('0x8')];this[_0xe9f7('0x9')]={};ami['on'](_0xe9f7('0xa'),this[_0xe9f7('0xb')][_0xe9f7('0xc')](this));ami['on'](_0xe9f7('0xd'),this[_0xe9f7('0xe')][_0xe9f7('0xc')](this));ami['on'](_0xe9f7('0xf'),this[_0xe9f7('0x10')][_0xe9f7('0xc')](this));ami['on'](_0xe9f7('0x11'),this['syncHangup'][_0xe9f7('0xc')](this));}VoiceDialReport['prototype'][_0xe9f7('0x12')]=function(_0x3d7c08){return _0x3d7c08!==null&&!_[_0xe9f7('0x13')](_0x3d7c08);};VoiceDialReport[_0xe9f7('0x14')][_0xe9f7('0x15')]=function(_0x4331cb,_0x2e3791,_0x14729f){io['to'](_0x4331cb)['emit'](_0x2e3791,_0x14729f);};VoiceDialReport[_0xe9f7('0x14')]['syncDialBegin']=function(_0x328b7e){try{if(this[_0xe9f7('0x12')](_0x328b7e)){if(this[_0xe9f7('0x6')][_0x328b7e[_0xe9f7('0x16')]]){_[_0xe9f7('0x17')](this[_0xe9f7('0x6')][_0x328b7e[_0xe9f7('0x16')]],{'starttime':moment()[_0xe9f7('0x18')](_0xe9f7('0x19')),'lastevent':'called','interface':_0x328b7e['channel']['substring'](0x0,_0x328b7e[_0xe9f7('0x1a')][_0xe9f7('0x1b')]('-')),'membername':_0x328b7e[_0xe9f7('0x1a')][_0xe9f7('0x1c')](_0x328b7e[_0xe9f7('0x1a')][_0xe9f7('0x1b')]('/')+0x1,_0x328b7e[_0xe9f7('0x1a')]['lastIndexOf']('-'))},_[_0xe9f7('0x1d')](_0x328b7e,[_0xe9f7('0x1e'),'privilege']));this['emit']('voice:outbound',_0xe9f7('0x1f'),this[_0xe9f7('0x6')][_0x328b7e['uniqueid']]);ami[_0xe9f7('0x15')](_0xe9f7('0x20'),this[_0xe9f7('0x6')][_0x328b7e[_0xe9f7('0x16')]]);}}}catch(_0x210899){logger['error'](_0xe9f7('0x21'),util[_0xe9f7('0x22')](_0x210899,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe9f7('0x14')][_0xe9f7('0xe')]=function(_0x103e64){try{if(this[_0xe9f7('0x12')](_0x103e64)){if(this['channels'][_0x103e64[_0xe9f7('0x16')]]){this[_0xe9f7('0x6')][_0x103e64['uniqueid']][_0xe9f7('0x23')]=_0x103e64['dialstatus'];if(_0x103e64[_0xe9f7('0x23')]==='ANSWER'){this[_0xe9f7('0x6')][_0x103e64[_0xe9f7('0x16')]][_0xe9f7('0x24')]=_0x103e64['connectedlinenum'];this['channels'][_0x103e64[_0xe9f7('0x16')]]['connectedlinename']=_0x103e64['connectedlinename'];this[_0xe9f7('0x6')][_0x103e64['uniqueid']][_0xe9f7('0x25')]=moment()[_0xe9f7('0x18')](_0xe9f7('0x19'));this[_0xe9f7('0x6')][_0x103e64[_0xe9f7('0x16')]]['lastevent']=_0xe9f7('0x26');ami[_0xe9f7('0x15')]('custom:dialconnect',this[_0xe9f7('0x6')][_0x103e64[_0xe9f7('0x16')]]);}this[_0xe9f7('0x15')](_0xe9f7('0x27'),_0xe9f7('0x1f'),this[_0xe9f7('0x6')][_0x103e64[_0xe9f7('0x16')]]);}}}catch(_0xee26f9){logger[_0xe9f7('0x28')]('[syncDialEnd][VoiceDialReport]',util[_0xe9f7('0x22')](_0xee26f9,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe9f7('0x14')][_0xe9f7('0x10')]=function(_0x2fc385){try{if(this[_0xe9f7('0x12')](_0x2fc385)){this[_0xe9f7('0x29')](_0x2fc385['uniqueid'],_['keys'](_0x2fc385[_0xe9f7('0x2a')])[0x0],_0x2fc385[_0xe9f7('0x2b')]);if(this[_0xe9f7('0x12')](_0x2fc385[_0xe9f7('0x2a')])&&this[_0xe9f7('0x12')](_0x2fc385[_0xe9f7('0x2a')][_0xe9f7('0x2c')])){if(_[_0xe9f7('0x13')](this[_0xe9f7('0x6')][_0x2fc385[_0xe9f7('0x16')]])){this['channels'][_0x2fc385['uniqueid']]={'routeId':_0x2fc385[_0xe9f7('0x2b')],'variables':this[_0xe9f7('0x9')][_0x2fc385['uniqueid']]};this[_0xe9f7('0x15')](_0xe9f7('0x27'),'voice_outbound_channel:save',this['channels'][_0x2fc385[_0xe9f7('0x16')]]);}}}}catch(_0x498a34){logger[_0xe9f7('0x28')](_0xe9f7('0x2d'),util['inspect'](_0x498a34,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xe9f7('0x14')][_0xe9f7('0x29')]=function(_0x116cbb,_0x12336d,_0x5c9f18){var _0x9a05e4=['rtpaudioqos',_0xe9f7('0x2e'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0xe9f7('0x2f'),_0xe9f7('0x30'),_0xe9f7('0x31'),_0xe9f7('0x32'),_0xe9f7('0x33'),_0xe9f7('0x34'),_0xe9f7('0x35'),_0xe9f7('0x36'),_0xe9f7('0x37'),'memberdynamic',_0xe9f7('0x38'),_0xe9f7('0x39'),_0xe9f7('0x3a'),'memberpenalty','memberrealtime'];if(!_[_0xe9f7('0x3b')](_0x12336d)&&!_['includes'](_0x9a05e4,_0x12336d)){if(_[_0xe9f7('0x13')](this[_0xe9f7('0x9')][_0x116cbb])){this[_0xe9f7('0x9')][_0x116cbb]={};}this[_0xe9f7('0x9')][_0x116cbb][_0x12336d]=_0x5c9f18;}};VoiceDialReport[_0xe9f7('0x14')][_0xe9f7('0x3c')]=function(_0x4a95e0){try{if(this[_0xe9f7('0x12')](_0x4a95e0)){if(this[_0xe9f7('0x6')][_0x4a95e0[_0xe9f7('0x16')]]){this[_0xe9f7('0x6')][_0x4a95e0[_0xe9f7('0x16')]][_0xe9f7('0x3d')]=moment()['format'](_0xe9f7('0x19'));this[_0xe9f7('0x6')][_0x4a95e0[_0xe9f7('0x16')]][_0xe9f7('0x3e')]=moment(this[_0xe9f7('0x6')][_0x4a95e0[_0xe9f7('0x16')]][_0xe9f7('0x3d')])['diff'](this['channels'][_0x4a95e0[_0xe9f7('0x16')]][_0xe9f7('0x3f')],_0xe9f7('0x40'));this[_0xe9f7('0x6')][_0x4a95e0[_0xe9f7('0x16')]][_0xe9f7('0x41')]=_0xe9f7('0x42');this[_0xe9f7('0x8')][_0xe9f7('0x43')]+=0x1;if(this[_0xe9f7('0x6')][_0x4a95e0[_0xe9f7('0x16')]][_0xe9f7('0x25')]){this[_0xe9f7('0x8')]['answered']+=0x1;this[_0xe9f7('0x6')][_0x4a95e0[_0xe9f7('0x16')]][_0xe9f7('0x44')]=moment(this['channels'][_0x4a95e0[_0xe9f7('0x16')]][_0xe9f7('0x25')])[_0xe9f7('0x45')](this[_0xe9f7('0x6')][_0x4a95e0[_0xe9f7('0x16')]]['starttime'],'seconds');this[_0xe9f7('0x6')][_0x4a95e0[_0xe9f7('0x16')]][_0xe9f7('0x46')]=moment(this[_0xe9f7('0x6')][_0x4a95e0['uniqueid']][_0xe9f7('0x3d')])['diff'](this[_0xe9f7('0x6')][_0x4a95e0[_0xe9f7('0x16')]][_0xe9f7('0x25')],_0xe9f7('0x40'));this[_0xe9f7('0x8')]['sumHoldTime']+=this[_0xe9f7('0x6')][_0x4a95e0[_0xe9f7('0x16')]][_0xe9f7('0x44')]||0x0;this[_0xe9f7('0x8')][_0xe9f7('0x47')]+=this[_0xe9f7('0x6')][_0x4a95e0[_0xe9f7('0x16')]][_0xe9f7('0x46')];}this[_0xe9f7('0x8')][_0xe9f7('0x48')]+=this[_0xe9f7('0x6')][_0x4a95e0[_0xe9f7('0x16')]]['duration'];ami['emit'](_0xe9f7('0x49'),this[_0xe9f7('0x6')][_0x4a95e0[_0xe9f7('0x16')]]);ami[_0xe9f7('0x15')]('custom:dialend',this['channels'][_0x4a95e0['uniqueid']]);this['emit'](_0xe9f7('0x27'),'voice_outbound:save',this[_0xe9f7('0x8')]);logger[_0xe9f7('0x4a')](_0xe9f7('0x4b'),JSON['stringify'](this['channels'][_0x4a95e0[_0xe9f7('0x16')]]));this[_0xe9f7('0x15')]('voice:outbound','voice_outbound_channel:remove',this[_0xe9f7('0x6')][_0x4a95e0[_0xe9f7('0x16')]]);delete this[_0xe9f7('0x6')][_0x4a95e0[_0xe9f7('0x16')]];}if(this[_0xe9f7('0x9')][_0x4a95e0['uniqueid']]){delete this[_0xe9f7('0x9')][_0x4a95e0['uniqueid']];}}}catch(_0x377ed3){logger[_0xe9f7('0x28')](_0xe9f7('0x4c'),util[_0xe9f7('0x22')](_0x377ed3,{'showHidden':![],'depth':null}));}};module[_0xe9f7('0x4d')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 11e1401..7ba2fae 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 _0xe9ca=['connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','syncAgentConnect','COMPLETEDBYAGENT','[syncAgentConnect][VoiceQueueReport]','assigned','lastAssignedTo','membername','queuecallerexit','transfer','reason','COMPLETED','startsWith','toLowerCase','local/','linkedid','queuecallerexitAt','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','destexten','transferuniqueid','COMPLETEDBY','toUpperCase','[syncAgentComplete][VoiceQueueReport]','addVariable','variable','value','queuecallerleaveAt','queueposition','[syncVarSet][VoiceQueueReport]','rtpaudioqos','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','membercalls','memberinterface','memberpenalty','memberrealtime','includes','syncHangup','unmanaged','diff','milliseconds','total','lastevent','custom:queuecallerunmanaged','custom:queuecallerabandon','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','transfereeuniqueid','transferexten','secondtransfererexten','ATTENDED','secondtransfereruniqueid','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','BLINDTRANSFER','extension','BlindTransfer','context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','syncMusicOnHoldStart','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','mohtime','exports','lodash','moment','bluebird','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete','bind','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','varset','syncVarSet','hangup','syncFullyBooted','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','pTalking','queueStatusComplete','unlockRR','clearZombieChannels','switch','isNil','Action','channel','catch','message','No\x20such\x20channel','error','[voiceQueueReport][checkChannel]','[voiceQueueReport][checkQueueReport]','[voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','inspect','emit','emitVoiceQueueChannelSave','format','voice:queue:%s','name','voice_queue_channel:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','emitVoiceQueueSummary','type','inbound','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','abandoned','waiting','Trunk','callerid','Interval','md5','voice_queue:save','isNotNull','isUndefined','queues','[queues]','then','[queuesummary]','queue','countBy','callers','toNumber','loggedin','[syncQueueSummary][VoiceQueueReport]','syncNewExten','uniqueid','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','merge','pick','keys','[syncQueueCallerJoin][VoiceQueueReport]','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','[syncQueueCallerAbandon][VoiceQueueReport]','last'];(function(_0x2b0f81,_0x3917f0){var _0x5ce74c=function(_0x12dc0d){while(--_0x12dc0d){_0x2b0f81['push'](_0x2b0f81['shift']());}};_0x5ce74c(++_0x3917f0);}(_0xe9ca,0x116));var _0xae9c=function(_0x22c1e3,_0x1e8bef){_0x22c1e3=_0x22c1e3-0x0;var _0x4f6623=_0xe9ca[_0x22c1e3];return _0x4f6623;};'use strict';var _=require(_0xae9c('0x0'));var moment=require(_0xae9c('0x1'));var BPromise=require(_0xae9c('0x2'));var util=require(_0xae9c('0x3'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xae9c('0x4'));var logger=require(_0xae9c('0x5'))(_0xae9c('0x6'));var ami=require(_0xae9c('0x7'));var QueueReport=require('../model/queueReport');config[_0xae9c('0x8')]=_[_0xae9c('0x9')](config[_0xae9c('0x8')],{'host':_0xae9c('0xa'),'port':0x18eb});var io=require(_0xae9c('0xb'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xae9c('0xc')][_0xae9c('0xd')]=function(_0x41bb01){this['tail']=this[_0xae9c('0xe')]?this[_0xae9c('0xe')]['finally'](_0x41bb01):_0x41bb01();};function VoiceQueueReport(_0x2323a2){this[_0xae9c('0xf')]=new Sequence();this[_0xae9c('0x10')]={};this[_0xae9c('0x11')]=_0x2323a2['agents'];this[_0xae9c('0x12')]=_0x2323a2[_0xae9c('0x13')];this[_0xae9c('0x14')]=_0x2323a2[_0xae9c('0x14')];this[_0xae9c('0x15')]=!![];this['campaigns']=_0x2323a2[_0xae9c('0x16')];this[_0xae9c('0x17')]={};ami['on']('queuesummary',this[_0xae9c('0x18')]['bind'](this));ami['on'](_0xae9c('0x19'),this[_0xae9c('0x1a')][_0xae9c('0x1b')](this));ami['on']('queuecallerjoin',this[_0xae9c('0x1c')][_0xae9c('0x1b')](this));ami['on'](_0xae9c('0x1d'),this['syncQueueCallerAbandon'][_0xae9c('0x1b')](this));ami['on'](_0xae9c('0x1e'),this[_0xae9c('0x1f')][_0xae9c('0x1b')](this));ami['on'](_0xae9c('0x20'),this[_0xae9c('0x21')]['bind'](this));ami['on'](_0xae9c('0x22'),this['syncAgentConnect']['bind'](this));ami['on'](_0xae9c('0x23'),this[_0xae9c('0x24')][_0xae9c('0x1b')](this));ami['on'](_0xae9c('0x25'),this['syncHangup'][_0xae9c('0x1b')](this));ami['on']('fullybooted',this[_0xae9c('0x26')][_0xae9c('0x1b')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0xae9c('0x1b')](this));ami['on'](_0xae9c('0x27'),this[_0xae9c('0x28')][_0xae9c('0x1b')](this));ami['on']('attendedtransfer',this[_0xae9c('0x29')]['bind'](this));ami['on'](_0xae9c('0x2a'),this[_0xae9c('0x2b')]['bind'](this));this[_0xae9c('0x2c')]();this[_0xae9c('0x2d')]();}function isNotNull(_0x31bac2){return _0x31bac2!==null&&!_['isUndefined'](_0x31bac2);}function clearChannels(_0x4144ee){if(!_['isEmpty'](_0x4144ee)){for(var _0x1a7b9e in _0x4144ee){if(_0x4144ee['hasOwnProperty'](_0x1a7b9e)){delete _0x4144ee[_0x1a7b9e];}}}}function clearCampaigns(_0x263c44){if(!_[_0xae9c('0x2e')](_0x263c44)){for(var _0x5a41f7 in _0x263c44){if(_0x263c44[_0xae9c('0x2f')](_0x5a41f7)){_0x263c44[_0x5a41f7]['originated']=0x0;}}}}function clearVoiceQueues(_0x1c69f0){if(!_[_0xae9c('0x2e')](_0x1c69f0)){for(var _0x4cedbd in _0x1c69f0){if(_0x1c69f0[_0xae9c('0x2f')](_0x4cedbd)){_0x1c69f0[_0x4cedbd][_0xae9c('0x30')]=0x0;_0x1c69f0[_0x4cedbd]['talking']=0x0;_0x1c69f0[_0x4cedbd][_0xae9c('0x31')]=0x0;_0x1c69f0[_0x4cedbd]['waiting']=0x0;_0x1c69f0[_0x4cedbd][_0xae9c('0x32')]=!![];}}}}function clearAgentBooked(_0x5e2169){if(!_[_0xae9c('0x2e')](_0x5e2169)){for(var _0x86cff3 in _0x5e2169){if(_0x5e2169[_0xae9c('0x2f')](_0x86cff3)){_0x5e2169[_0x86cff3][_0xae9c('0x33')]=!![];}}}}VoiceQueueReport[_0xae9c('0xc')][_0xae9c('0x34')]=function(){var _0x38acea=this;for(var _0x4c992f in this['channels']){if(this['channels']['hasOwnProperty'](_0x4c992f)&&!this[_0xae9c('0x12')][_0x4c992f][_0xae9c('0x35')]){this[_0xae9c('0xf')]['enqueue'](function(){if(!_[_0xae9c('0x36')](_0x38acea[_0xae9c('0x12')][_0x4c992f])){return ami[_0xae9c('0x37')]({'action':'status','channel':_0x38acea[_0xae9c('0x12')][_0x4c992f][_0xae9c('0x38')]})[_0xae9c('0x39')](function(_0x4ef1d6){if(_0x4ef1d6[_0xae9c('0x3a')]===_0xae9c('0x3b')){setTimeout(function(){if(_0x38acea[_0xae9c('0x12')][_0x4c992f]){delete _0x38acea[_0xae9c('0x12')][_0x4c992f];logger[_0xae9c('0x3c')](_0xae9c('0x3d'),_0x4c992f);}if(_0x38acea['queueReports'][_0x4c992f]){delete _0x38acea[_0xae9c('0x10')][_0x4c992f];logger[_0xae9c('0x3c')](_0xae9c('0x3e'),_0x4c992f);}if(_0x38acea['variables'][_0x4c992f]){delete _0x38acea['variables'][_0x4c992f];logger[_0xae9c('0x3c')](_0xae9c('0x3f'),_0x4c992f);}},0x1f40);}});}});}}};VoiceQueueReport['prototype']['syncFullyBooted']=function(){logger[_0xae9c('0x3c')](_0xae9c('0x40'));clearChannels(this[_0xae9c('0x12')]);this[_0xae9c('0x41')](this[_0xae9c('0x10')]);clearAgentBooked(this[_0xae9c('0x11')]);clearVoiceQueues(this[_0xae9c('0x14')]);clearCampaigns(this['campaigns']);};VoiceQueueReport[_0xae9c('0xc')]['clearQueueReport']=function(_0x146146){var _0x143f95=this;if(!_[_0xae9c('0x2e')](_0x146146)){for(var _0x4d8faa in _0x146146){if(_0x146146[_0xae9c('0x2f')](_0x4d8faa)){_0x143f95[_0xae9c('0x42')](_0x146146[_0x4d8faa]);delete _0x146146[_0x4d8faa];}}}};function loggerCatch(_0xb0d2d3){return function(_0x722c5d){logger[_0xae9c('0x3c')](_0xb0d2d3,util[_0xae9c('0x43')](_0x722c5d,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0xae9c('0xc')][_0xae9c('0x44')]=function(_0x1da415,_0x38b2b3,_0xb657a5){io['to'](_0x1da415)[_0xae9c('0x44')](_0x38b2b3,_0xb657a5);};VoiceQueueReport[_0xae9c('0xc')][_0xae9c('0x45')]=function(_0x3272b8){this[_0xae9c('0x44')](util[_0xae9c('0x46')](_0xae9c('0x47'),_0x3272b8[_0xae9c('0x48')]),_0xae9c('0x49'),_0x3272b8);};VoiceQueueReport[_0xae9c('0xc')]['emitVoiceQueueChannelRemove']=function(_0x4c3c9e){logger[_0xae9c('0x4a')](_0xae9c('0x4b'),JSON[_0xae9c('0x4c')](_0x4c3c9e));this[_0xae9c('0x44')](util['format'](_0xae9c('0x47'),_0x4c3c9e[_0xae9c('0x48')]),_0xae9c('0x4d'),_0x4c3c9e);};VoiceQueueReport[_0xae9c('0xc')][_0xae9c('0x4e')]=function(_0x264519){if(_0x264519[_0xae9c('0x4f')]===_0xae9c('0x50')){var _0x429fc3={'id':_0x264519['id'],'name':_0x264519[_0xae9c('0x48')],'strategy':_0x264519['strategy'],'answered':_0x264519[_0xae9c('0x51')],'available':_0x264519[_0xae9c('0x52')],'loggedIn':_0x264519[_0xae9c('0x53')],'pTalking':_0x264519[_0xae9c('0x31')],'sumBillable':_0x264519[_0xae9c('0x54')],'sumDuration':_0x264519[_0xae9c('0x55')],'sumHoldTime':_0x264519[_0xae9c('0x56')]||0x0,'talking':_0x264519[_0xae9c('0x57')],'total':_0x264519['total'],'type':_0x264519[_0xae9c('0x4f')],'unmanaged':_0x264519['unmanaged'],'abandoned':_0x264519[_0xae9c('0x58')],'waiting':_0x264519[_0xae9c('0x59')]};if(_0x264519['Trunk']){_0x429fc3[_0xae9c('0x5a')]={'id':_0x264519['Trunk']['id'],'name':_0x264519[_0xae9c('0x5a')]['name'],'active':_0x264519[_0xae9c('0x5a')]['active'],'callerid':_0x264519['Trunk'][_0xae9c('0x5b')]};}if(_0x264519['Interval']){_0x429fc3[_0xae9c('0x5c')]={'id':_0x264519['Interval']['id'],'name':_0x264519['Interval'][_0xae9c('0x48')]};}var _0xf6375a=md5(JSON[_0xae9c('0x4c')](_0x429fc3));if(_0x264519[_0xae9c('0x5d')]!==_0xf6375a){_0x264519[_0xae9c('0x5d')]=_0xf6375a;this['emit'](util[_0xae9c('0x46')](_0xae9c('0x47'),_0x429fc3[_0xae9c('0x48')]),_0xae9c('0x5e'),_0x429fc3);}}};VoiceQueueReport[_0xae9c('0xc')][_0xae9c('0x5f')]=function(_0x4e2cab){return _0x4e2cab!==null&&!_[_0xae9c('0x60')](_0x4e2cab);};VoiceQueueReport[_0xae9c('0xc')][_0xae9c('0x2d')]=function(){var _0x51252e=this;setInterval(function(){_0x51252e[_0xae9c('0x34')]();ami[_0xae9c('0x37')]({'action':_0xae9c('0x61')})[_0xae9c('0x39')](loggerCatch(_0xae9c('0x62')));},0x2710);};VoiceQueueReport['prototype'][_0xae9c('0x2c')]=function(){var _0xfdf325=this;setInterval(function(){if(_0xfdf325[_0xae9c('0x15')]){return ami[_0xae9c('0x37')]({'action':'queuesummary'})[_0xae9c('0x63')](function(_0x5b23a0){_0xfdf325['flagQueueSummary']=![];})[_0xae9c('0x39')](loggerCatch(_0xae9c('0x64')));}},0x3e8);};VoiceQueueReport[_0xae9c('0xc')][_0xae9c('0x18')]=function(_0x28b54f){try{if(this[_0xae9c('0x5f')](_0x28b54f)&&this[_0xae9c('0x5f')](_0x28b54f[_0xae9c('0x65')])){if(this[_0xae9c('0x14')][_0x28b54f['queue']]){var _0x531966=_[_0xae9c('0x66')](this[_0xae9c('0x12')],_0xae9c('0x65'))[_0x28b54f[_0xae9c('0x65')]]||0x0;var _0x5ec8c9=_0x531966-_0x28b54f[_0xae9c('0x67')];if(this['voiceQueues'][_0x28b54f[_0xae9c('0x65')]][_0xae9c('0x59')]!==_[_0xae9c('0x68')](_0x28b54f['callers'])||this['voiceQueues'][_0x28b54f[_0xae9c('0x65')]][_0xae9c('0x53')]!==_[_0xae9c('0x68')](_0x28b54f[_0xae9c('0x69')])||this[_0xae9c('0x14')][_0x28b54f[_0xae9c('0x65')]]['available']!==_[_0xae9c('0x68')](_0x28b54f[_0xae9c('0x52')])||this[_0xae9c('0x14')][_0x28b54f[_0xae9c('0x65')]][_0xae9c('0x57')]!==_0x5ec8c9){this[_0xae9c('0x14')][_0x28b54f[_0xae9c('0x65')]][_0xae9c('0x59')]=_[_0xae9c('0x68')](_0x28b54f[_0xae9c('0x67')]);this[_0xae9c('0x14')][_0x28b54f['queue']][_0xae9c('0x53')]=_['toNumber'](_0x28b54f[_0xae9c('0x69')]);this['voiceQueues'][_0x28b54f['queue']][_0xae9c('0x52')]=_[_0xae9c('0x68')](_0x28b54f[_0xae9c('0x52')]);this[_0xae9c('0x14')][_0x28b54f['queue']]['talking']=_0x5ec8c9>0x0?_0x5ec8c9:0x0;this[_0xae9c('0x14')][_0x28b54f['queue']]['talking']=this[_0xae9c('0x14')][_0x28b54f[_0xae9c('0x65')]][_0xae9c('0x57')]>_['toNumber'](_0x28b54f[_0xae9c('0x69')])?_[_0xae9c('0x68')](_0x28b54f['loggedin']):this[_0xae9c('0x14')][_0x28b54f[_0xae9c('0x65')]][_0xae9c('0x57')];this[_0xae9c('0x4e')](this[_0xae9c('0x14')][_0x28b54f['queue']]);}ami[_0xae9c('0x44')]('custom:queuesummary',this['voiceQueues'][_0x28b54f[_0xae9c('0x65')]]);}}}catch(_0x1131fd){logger[_0xae9c('0x3c')](_0xae9c('0x6a'),util[_0xae9c('0x43')](_0x1131fd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xae9c('0xc')][_0xae9c('0x1a')]=function(_0x551f0c){this['flagQueueSummary']=!![];};VoiceQueueReport[_0xae9c('0xc')][_0xae9c('0x6b')]=function(_0x4c8453){};VoiceQueueReport[_0xae9c('0xc')][_0xae9c('0x1c')]=function(_0x55bff8){try{if(this[_0xae9c('0x5f')](_0x55bff8)){if(_[_0xae9c('0x60')](this['queueReports'][_0x55bff8[_0xae9c('0x6c')]])){this['queueReports'][_0x55bff8[_0xae9c('0x6c')]]=[];this['channels'][_0x55bff8[_0xae9c('0x6c')]]={};}var _0x5edf66=new QueueReport();_0x5edf66[_0xae9c('0x48')]=_0x55bff8[_0xae9c('0x65')];_0x5edf66['type']=this['voiceQueues'][_0x5edf66[_0xae9c('0x48')]]&&this['voiceQueues'][_0x5edf66[_0xae9c('0x48')]][_0xae9c('0x4f')]?this['voiceQueues'][_0x5edf66[_0xae9c('0x48')]][_0xae9c('0x4f')]||_0xae9c('0x50'):_0xae9c('0x50');_0x5edf66[_0xae9c('0x65')]=_0x55bff8[_0xae9c('0x65')];_0x5edf66[_0xae9c('0x6d')]=moment()[_0xae9c('0x46')](_0xae9c('0x6e'));_0x5edf66[_0xae9c('0x6f')]=_0x55bff8[_0xae9c('0x6f')];_0x5edf66[_0xae9c('0x70')]=_0x55bff8['count'];_[_0xae9c('0x71')](_0x5edf66,_[_0xae9c('0x72')](_0x55bff8,_[_0xae9c('0x73')](_0x5edf66)));this['queueReports'][_0x55bff8[_0xae9c('0x6c')]]['push'](_0x5edf66);this[_0xae9c('0x12')][_0x55bff8[_0xae9c('0x6c')]]=_0x5edf66;this[_0xae9c('0x45')](_0x5edf66);}}catch(_0x5bc2c6){logger['error'](_0xae9c('0x74'),util['inspect'](_0x5bc2c6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xae9c('0xc')]['syncQueueCallerAbandon']=function(_0x310d79){try{if(this[_0xae9c('0x5f')](_0x310d79)){if(this['queueReports'][_0x310d79[_0xae9c('0x6c')]]){var _0x536221=_['last'](this['queueReports'][_0x310d79['uniqueid']]);_0x536221[_0xae9c('0x75')]=![];_0x536221[_0xae9c('0x76')]=null;_0x536221['holdtime']=_0x310d79[_0xae9c('0x77')];_0x536221['originalposition']=_0x310d79[_0xae9c('0x78')];_0x536221[_0xae9c('0x1d')]=!![];_0x536221[_0xae9c('0x79')]=moment()[_0xae9c('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x536221[_0xae9c('0x7a')]=_0xae9c('0x7b');_0x536221['lastAssignedTo']=null;this[_0xae9c('0x12')][_0x310d79[_0xae9c('0x6c')]]=_0x536221;this[_0xae9c('0x42')](_0x536221);}}}catch(_0x10fb79){logger[_0xae9c('0x3c')](_0xae9c('0x7c'),util[_0xae9c('0x43')](_0x10fb79,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xae9c('0xc')]['syncQueueCallerLeave']=function(_0x4a8196){try{if(this[_0xae9c('0x5f')](_0x4a8196)){if(this['queueReports'][_0x4a8196[_0xae9c('0x6c')]]){var _0x1d36e5=_[_0xae9c('0x7d')](this[_0xae9c('0x10')][_0x4a8196[_0xae9c('0x6c')]]);_0x1d36e5['queuecallerleaveAt']=moment()[_0xae9c('0x46')](_0xae9c('0x6e'));_0x1d36e5['connectedlinenum']=_0x4a8196[_0xae9c('0x7e')];_0x1d36e5['connectedlinename']=_0x4a8196[_0xae9c('0x7f')];this['channels'][_0x4a8196[_0xae9c('0x6c')]]=_0x1d36e5;this[_0xae9c('0x45')](_0x1d36e5);}}}catch(_0x33aeba){logger[_0xae9c('0x3c')](_0xae9c('0x80'),util['inspect'](_0x33aeba,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xae9c('0x81')]=function(_0xf4b816){try{if(this[_0xae9c('0x5f')](_0xf4b816)){if(this[_0xae9c('0x10')][_0xf4b816[_0xae9c('0x6c')]]){var _0x54cb47=_['last'](this[_0xae9c('0x10')][_0xf4b816[_0xae9c('0x6c')]]);_0x54cb47[_0xae9c('0x75')]=!![];_0x54cb47['queuecallerexitreason']=_0xae9c('0x82');}}}catch(_0x5beec1){logger[_0xae9c('0x3c')](_0xae9c('0x83'),util[_0xae9c('0x43')](_0x5beec1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xae9c('0xc')]['syncAgentComplete']=function(_0x59e79d){try{if(this['isNotNull'](_0x59e79d)){if(this[_0xae9c('0x10')][_0x59e79d[_0xae9c('0x6c')]]){var _0x2bd716=_[_0xae9c('0x7d')](this[_0xae9c('0x10')][_0x59e79d['uniqueid']]);_0x2bd716[_0xae9c('0x1d')]=![];_0x2bd716[_0xae9c('0x79')]=null;_0x2bd716[_0xae9c('0x84')]=!![];_0x2bd716[_0xae9c('0x85')]=_0x59e79d[_0xae9c('0x86')];_0x2bd716[_0xae9c('0x77')]=_0x59e79d[_0xae9c('0x77')];_0x2bd716['queuecallercomplete']=!![];_0x2bd716[_0xae9c('0x87')]=![];_0x2bd716['queuecallerexitAt']=null;if(!_0x2bd716[_0xae9c('0x88')]){if(_0x59e79d[_0xae9c('0x89')]==_0xae9c('0x88')){_0x2bd716['queuecallerexitreason']=_0xae9c('0x8a');}else{if(_[_0xae9c('0x8b')](_0x59e79d[_0xae9c('0x38')][_0xae9c('0x8c')](),_0xae9c('0x8d'))){if(this[_0xae9c('0x10')][_0x59e79d['linkedid']]){var _0x42d9b6=_[_0xae9c('0x7d')](this[_0xae9c('0x10')][_0x59e79d[_0xae9c('0x8e')]]);_0x42d9b6['queuecallercomplete']=![];_0x42d9b6['queuecallerexit']=!![];_0x42d9b6[_0xae9c('0x8f')]=moment(_0x2bd716[_0xae9c('0x6d')])[_0xae9c('0x90')](_0x59e79d[_0xae9c('0x77')],_0xae9c('0x91'))['format'](_0xae9c('0x6e'));_0x42d9b6[_0xae9c('0x7a')]=_0xae9c('0x92');_0x42d9b6[_0xae9c('0x88')]=!![];_0x42d9b6[_0xae9c('0x93')]=_0xae9c('0x94');_0x42d9b6['transferexten']=_0x59e79d[_0xae9c('0x95')];_0x42d9b6[_0xae9c('0x96')]=_0x59e79d[_0xae9c('0x6c')];var _0x47ef10=this[_0xae9c('0x10')][_0x59e79d['linkedid']];this[_0xae9c('0x10')][_0x59e79d[_0xae9c('0x8e')]]=this[_0xae9c('0x10')][_0x59e79d[_0xae9c('0x6c')]];this[_0xae9c('0x10')][_0x59e79d[_0xae9c('0x6c')]]=_0x47ef10;}}else{_0x2bd716[_0xae9c('0x7a')]=_0xae9c('0x97')+_0x59e79d[_0xae9c('0x89')][_0xae9c('0x98')]();}}}this[_0xae9c('0x12')][_0x59e79d[_0xae9c('0x6c')]]=_0x2bd716;this['emitVoiceQueueChannelRemove'](_0x2bd716);}}}catch(_0x62dee4){logger[_0xae9c('0x3c')](_0xae9c('0x99'),util[_0xae9c('0x43')](_0x62dee4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xae9c('0xc')][_0xae9c('0x24')]=function(_0x39d282){try{if(this[_0xae9c('0x5f')](_0x39d282)){this[_0xae9c('0x9a')](_0x39d282[_0xae9c('0x6c')],_['keys'](_0x39d282[_0xae9c('0x9b')])[0x0],_0x39d282[_0xae9c('0x9c')]);if(this[_0xae9c('0x10')][_0x39d282[_0xae9c('0x6c')]]){var _0x40a87d=_[_0xae9c('0x7d')](this[_0xae9c('0x10')][_0x39d282[_0xae9c('0x6c')]]);if(_0x40a87d){if(this[_0xae9c('0x5f')](_0x39d282[_0xae9c('0x9b')])&&this[_0xae9c('0x5f')](_0x39d282[_0xae9c('0x9b')]['queuestatus'])){switch(_0x39d282['value']){case'CONTINUE':_0x40a87d[_0xae9c('0x87')]=![];_0x40a87d[_0xae9c('0x8f')]=null;break;default:_0x40a87d[_0xae9c('0x87')]=!![];_0x40a87d[_0xae9c('0x8f')]=moment()['format'](_0xae9c('0x6e'));_0x40a87d[_0xae9c('0x9d')]=moment()[_0xae9c('0x46')]('YYYY-MM-DD\x20HH:mm:ss');}_0x40a87d[_0xae9c('0x1d')]=![];_0x40a87d['queuecallerabandonAt']=null;_0x40a87d[_0xae9c('0x7a')]=_0x39d282['value'];this[_0xae9c('0x12')][_0x39d282[_0xae9c('0x6c')]]=_0x40a87d;this[_0xae9c('0x42')](_0x40a87d);}else if(this[_0xae9c('0x5f')](_0x39d282['variable'])&&this[_0xae9c('0x5f')](_0x39d282[_0xae9c('0x9b')][_0xae9c('0x9e')])){if(!_0x40a87d[_0xae9c('0x1d')]){_0x40a87d[_0xae9c('0x87')]=!![];_0x40a87d[_0xae9c('0x8f')]=moment()[_0xae9c('0x46')](_0xae9c('0x6e'));_0x40a87d[_0xae9c('0x7a')]='EXITWITHKEY';_0x40a87d[_0xae9c('0x9d')]=moment()[_0xae9c('0x46')](_0xae9c('0x6e'));this['channels'][_0x39d282[_0xae9c('0x6c')]]=_0x40a87d;}}_0x40a87d[_0xae9c('0x17')]=this[_0xae9c('0x17')][_0x39d282[_0xae9c('0x6c')]];}}}}catch(_0x53dd19){logger[_0xae9c('0x3c')](_0xae9c('0x9f'),util['inspect'](_0x53dd19,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xae9c('0xc')][_0xae9c('0x9a')]=function(_0x57dd80,_0x42f663,_0x37c026){var _0x340386=[_0xae9c('0xa0'),'rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged',_0xae9c('0xa1'),_0xae9c('0xa2'),_0xae9c('0xa3'),_0xae9c('0xa4'),_0xae9c('0xa5'),_0xae9c('0xa6'),'bridgepeer','bridgepvtcallid',_0xae9c('0xa7'),'memberdynamic',_0xae9c('0xa8'),'memberlastcall',_0xae9c('0x86'),_0xae9c('0xa9'),_0xae9c('0xaa')];if(!_[_0xae9c('0x36')](_0x42f663)&&!_[_0xae9c('0xab')](_0x340386,_0x42f663)){if(_['isUndefined'](this[_0xae9c('0x17')][_0x57dd80])){this[_0xae9c('0x17')][_0x57dd80]={};}this[_0xae9c('0x17')][_0x57dd80][_0x42f663]=_0x37c026;}};VoiceQueueReport['prototype'][_0xae9c('0xac')]=function(_0x4b773a){try{if(this[_0xae9c('0x5f')](_0x4b773a)){if(this['queueReports'][_0x4b773a[_0xae9c('0x6c')]]){for(var _0x4172f7=0x0,_0x185251={};_0x4172f70x0?_0x253d90:0x0;this[_0x92fc('0x11')][_0x31b867[_0x92fc('0x5c')]][_0x92fc('0x2e')]=this[_0x92fc('0x11')][_0x31b867['queue']][_0x92fc('0x2e')]>_[_0x92fc('0x60')](_0x31b867['loggedin'])?_[_0x92fc('0x60')](_0x31b867[_0x92fc('0x62')]):this[_0x92fc('0x11')][_0x31b867[_0x92fc('0x5c')]]['talking'];this[_0x92fc('0x46')](this[_0x92fc('0x11')][_0x31b867[_0x92fc('0x5c')]]);}ami[_0x92fc('0x3e')]('custom:queuesummary',this['voiceQueues'][_0x31b867[_0x92fc('0x5c')]]);}}}catch(_0x1de1b4){logger['error'](_0x92fc('0x63'),util[_0x92fc('0x64')](_0x1de1b4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x92fc('0x9')][_0x92fc('0x16')]=function(_0x587c43){this[_0x92fc('0x12')]=!![];};VoiceQueueReport[_0x92fc('0x9')]['syncNewExten']=function(_0x326c26){};VoiceQueueReport[_0x92fc('0x9')][_0x92fc('0x19')]=function(_0x392dad){try{if(this[_0x92fc('0x56')](_0x392dad)){if(_[_0x92fc('0x2a')](this[_0x92fc('0x39')][_0x392dad['uniqueid']])){this[_0x92fc('0x39')][_0x392dad[_0x92fc('0x65')]]=[];this[_0x92fc('0xf')][_0x392dad[_0x92fc('0x65')]]={};}var _0x54fc79=new QueueReport();_0x54fc79['name']=_0x392dad['queue'];_0x54fc79['type']=this[_0x92fc('0x11')][_0x54fc79[_0x92fc('0x41')]]&&this[_0x92fc('0x11')][_0x54fc79[_0x92fc('0x41')]][_0x92fc('0x47')]?this[_0x92fc('0x11')][_0x54fc79[_0x92fc('0x41')]][_0x92fc('0x47')]||'inbound':_0x92fc('0x48');_0x54fc79[_0x92fc('0x5c')]=_0x392dad[_0x92fc('0x5c')];_0x54fc79['queuecallerjoinAt']=moment()[_0x92fc('0x40')]('YYYY-MM-DD\x20HH:mm:ss');_0x54fc79[_0x92fc('0x66')]=_0x392dad[_0x92fc('0x66')];_0x54fc79[_0x92fc('0x67')]=_0x392dad[_0x92fc('0x67')];_[_0x92fc('0x68')](_0x54fc79,_['pick'](_0x392dad,_['keys'](_0x54fc79)));this[_0x92fc('0x39')][_0x392dad['uniqueid']][_0x92fc('0x69')](_0x54fc79);this[_0x92fc('0xf')][_0x392dad[_0x92fc('0x65')]]=_0x54fc79;this[_0x92fc('0x3f')](_0x54fc79);}}catch(_0x6b4ae0){logger[_0x92fc('0x37')](_0x92fc('0x6a'),util[_0x92fc('0x64')](_0x6b4ae0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x92fc('0x9')][_0x92fc('0x1b')]=function(_0x40ecd7){try{if(this[_0x92fc('0x56')](_0x40ecd7)){if(this[_0x92fc('0x39')][_0x40ecd7[_0x92fc('0x65')]]){var _0x32e94c=_[_0x92fc('0x6b')](this[_0x92fc('0x39')][_0x40ecd7[_0x92fc('0x65')]]);_0x32e94c[_0x92fc('0x6c')]=![];_0x32e94c[_0x92fc('0x6d')]=null;_0x32e94c[_0x92fc('0x6e')]=_0x40ecd7[_0x92fc('0x6e')];_0x32e94c[_0x92fc('0x6f')]=_0x40ecd7[_0x92fc('0x6f')];_0x32e94c[_0x92fc('0x1a')]=!![];_0x32e94c[_0x92fc('0x70')]=moment()[_0x92fc('0x40')](_0x92fc('0x71'));_0x32e94c[_0x92fc('0x72')]='ABANDONED';_0x32e94c[_0x92fc('0x73')]=null;this[_0x92fc('0xf')][_0x40ecd7['uniqueid']]=_0x32e94c;this[_0x92fc('0x42')](_0x32e94c);}}}catch(_0x18720d){logger[_0x92fc('0x37')]('[syncQueueCallerAbandon][VoiceQueueReport]',util[_0x92fc('0x64')](_0x18720d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x92fc('0x74')]=function(_0xa52c92){try{if(this[_0x92fc('0x56')](_0xa52c92)){if(this[_0x92fc('0x39')][_0xa52c92[_0x92fc('0x65')]]){var _0x3776cd=_[_0x92fc('0x6b')](this[_0x92fc('0x39')][_0xa52c92[_0x92fc('0x65')]]);_0x3776cd['queuecallerleaveAt']=moment()[_0x92fc('0x40')](_0x92fc('0x71'));_0x3776cd['connectedlinenum']=_0xa52c92[_0x92fc('0x75')];_0x3776cd[_0x92fc('0x76')]=_0xa52c92[_0x92fc('0x76')];this[_0x92fc('0xf')][_0xa52c92['uniqueid']]=_0x3776cd;this[_0x92fc('0x3f')](_0x3776cd);}}}catch(_0x226c60){logger[_0x92fc('0x37')](_0x92fc('0x77'),util[_0x92fc('0x64')](_0x226c60,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x92fc('0x9')][_0x92fc('0x78')]=function(_0x27d9ca){try{if(this[_0x92fc('0x56')](_0x27d9ca)){if(this[_0x92fc('0x39')][_0x27d9ca[_0x92fc('0x65')]]){var _0xab46f6=_['last'](this['queueReports'][_0x27d9ca['uniqueid']]);_0xab46f6['queuecallercomplete']=!![];_0xab46f6[_0x92fc('0x72')]='COMPLETEDBYAGENT';}}}catch(_0x30c59a){logger['error'](_0x92fc('0x79'),util[_0x92fc('0x64')](_0x30c59a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x92fc('0x9')][_0x92fc('0x1e')]=function(_0x41027b){try{if(this[_0x92fc('0x56')](_0x41027b)){if(this[_0x92fc('0x39')][_0x41027b[_0x92fc('0x65')]]){var _0x2577e7=_[_0x92fc('0x6b')](this[_0x92fc('0x39')][_0x41027b[_0x92fc('0x65')]]);_0x2577e7['queuecallerabandon']=![];_0x2577e7[_0x92fc('0x70')]=null;_0x2577e7[_0x92fc('0x7a')]=!![];_0x2577e7[_0x92fc('0x73')]=_0x41027b['membername'];_0x2577e7[_0x92fc('0x6e')]=_0x41027b[_0x92fc('0x6e')];_0x2577e7[_0x92fc('0x6c')]=!![];_0x2577e7[_0x92fc('0x7b')]=![];_0x2577e7['queuecallerexitAt']=null;if(!_0x2577e7[_0x92fc('0x7c')]){if(_0x41027b['reason']=='transfer'){_0x2577e7[_0x92fc('0x72')]=_0x92fc('0x7d');}else{if(_[_0x92fc('0x7e')](_0x41027b[_0x92fc('0x7f')][_0x92fc('0x80')](),_0x92fc('0x81'))){if(this[_0x92fc('0x39')][_0x41027b[_0x92fc('0x82')]]){var _0x44f5e9=_[_0x92fc('0x6b')](this['queueReports'][_0x41027b[_0x92fc('0x82')]]);_0x44f5e9['queuecallercomplete']=![];_0x44f5e9[_0x92fc('0x7b')]=!![];_0x44f5e9['queuecallerexitAt']=moment(_0x2577e7[_0x92fc('0x83')])[_0x92fc('0x84')](_0x41027b[_0x92fc('0x6e')],_0x92fc('0x85'))[_0x92fc('0x40')](_0x92fc('0x71'));_0x44f5e9[_0x92fc('0x72')]='FORWARDTRANSFER';_0x44f5e9[_0x92fc('0x7c')]=!![];_0x44f5e9[_0x92fc('0x86')]='FORWARD';_0x44f5e9[_0x92fc('0x87')]=_0x41027b[_0x92fc('0x88')];_0x44f5e9[_0x92fc('0x89')]=_0x41027b['uniqueid'];var _0xc38216=this[_0x92fc('0x39')][_0x41027b[_0x92fc('0x82')]];this[_0x92fc('0x39')][_0x41027b[_0x92fc('0x82')]]=this[_0x92fc('0x39')][_0x41027b[_0x92fc('0x65')]];this[_0x92fc('0x39')][_0x41027b[_0x92fc('0x65')]]=_0xc38216;}}else{_0x2577e7['queuecallerexitreason']=_0x92fc('0x8a')+_0x41027b[_0x92fc('0x8b')][_0x92fc('0x8c')]();}}}this[_0x92fc('0xf')][_0x41027b['uniqueid']]=_0x2577e7;this['emitVoiceQueueChannelRemove'](_0x2577e7);}}}catch(_0x551b78){logger['error']('[syncAgentComplete][VoiceQueueReport]',util[_0x92fc('0x64')](_0x551b78,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0xb80987){try{if(this[_0x92fc('0x56')](_0xb80987)){this[_0x92fc('0x8d')](_0xb80987[_0x92fc('0x65')],_['keys'](_0xb80987[_0x92fc('0x8e')])[0x0],_0xb80987['value']);if(this[_0x92fc('0x39')][_0xb80987[_0x92fc('0x65')]]){var _0xfeb514=_[_0x92fc('0x6b')](this[_0x92fc('0x39')][_0xb80987[_0x92fc('0x65')]]);if(_0xfeb514){if(this[_0x92fc('0x56')](_0xb80987['variable'])&&this[_0x92fc('0x56')](_0xb80987[_0x92fc('0x8e')][_0x92fc('0x8f')])){switch(_0xb80987[_0x92fc('0x90')]){case _0x92fc('0x91'):_0xfeb514['queuecallerexit']=![];_0xfeb514[_0x92fc('0x92')]=null;break;default:_0xfeb514[_0x92fc('0x7b')]=!![];_0xfeb514[_0x92fc('0x92')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xfeb514['queuecallerleaveAt']=moment()[_0x92fc('0x40')](_0x92fc('0x71'));}_0xfeb514[_0x92fc('0x1a')]=![];_0xfeb514[_0x92fc('0x70')]=null;_0xfeb514[_0x92fc('0x72')]=_0xb80987[_0x92fc('0x90')];this[_0x92fc('0xf')][_0xb80987['uniqueid']]=_0xfeb514;this[_0x92fc('0x42')](_0xfeb514);}else if(this['isNotNull'](_0xb80987[_0x92fc('0x8e')])&&this[_0x92fc('0x56')](_0xb80987['variable'][_0x92fc('0x93')])){if(!_0xfeb514[_0x92fc('0x1a')]){_0xfeb514[_0x92fc('0x7b')]=!![];_0xfeb514[_0x92fc('0x92')]=moment()[_0x92fc('0x40')](_0x92fc('0x71'));_0xfeb514[_0x92fc('0x72')]=_0x92fc('0x94');_0xfeb514[_0x92fc('0x95')]=moment()['format'](_0x92fc('0x71'));this[_0x92fc('0xf')][_0xb80987[_0x92fc('0x65')]]=_0xfeb514;}}_0xfeb514['variables']=this[_0x92fc('0x3a')][_0xb80987[_0x92fc('0x65')]];}}}}catch(_0xfe9bdc){logger[_0x92fc('0x37')]('[syncVarSet][VoiceQueueReport]',util[_0x92fc('0x64')](_0xfe9bdc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x92fc('0x9')]['addVariable']=function(_0x464c61,_0x30aae4,_0x1d7695){var _0x1fb8d8=[_0x92fc('0x96'),'rtpaudioqosbridged','rtpaudioqosjitter',_0x92fc('0x97'),_0x92fc('0x98'),_0x92fc('0x99'),_0x92fc('0x9a'),_0x92fc('0x9b'),_0x92fc('0x9c'),'sipuri',_0x92fc('0x9d'),_0x92fc('0x9e'),_0x92fc('0x9f'),_0x92fc('0xa0'),_0x92fc('0xa1'),_0x92fc('0xa2'),'membername',_0x92fc('0xa3'),_0x92fc('0xa4')];if(!_['isNil'](_0x30aae4)&&!_[_0x92fc('0xa5')](_0x1fb8d8,_0x30aae4)){if(_['isUndefined'](this[_0x92fc('0x3a')][_0x464c61])){this[_0x92fc('0x3a')][_0x464c61]={};}this[_0x92fc('0x3a')][_0x464c61][_0x30aae4]=_0x1d7695;}};VoiceQueueReport[_0x92fc('0x9')][_0x92fc('0x23')]=function(_0x1d0b54){try{if(this[_0x92fc('0x56')](_0x1d0b54)){if(this[_0x92fc('0x39')][_0x1d0b54[_0x92fc('0x65')]]){for(var _0x8b30a5=0x0,_0x32b20b={};_0x8b30a5=0x0?moment(_0xab4e8e[_0xcc56('0x1a')])[_0xcc56('0xe')](_0xab4e8e[_0xcc56('0x19')],'seconds'):null,'data1':_0xcc56('0x1b'),'data2':_0xab4e8e[_0xcc56('0x15')],'data3':_0xab4e8e[_0xcc56('0x12')],'data4':_0xab4e8e[_0xcc56('0x1c')]||null,'role':_0xcc56('0x13'),'internal':_0xab4e8e[_0xcc56('0x15')]?_[_0xcc56('0x14')](_0xab4e8e[_0xcc56('0x15')]):undefined,'uniqueid':_0xab4e8e[_0xcc56('0x16')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xd59c=['TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','agent','accountcode','toNumber','uniqueid','voiceDialReport','Request','membername','starttime','endtime','outbound','moment','lodash','../client','voiceQueueReport','queuecallerexitAt','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s'];(function(_0x43a0ac,_0x2bdce8){var _0x1be4d4=function(_0x46e933){while(--_0x46e933){_0x43a0ac['push'](_0x43a0ac['shift']());}};_0x1be4d4(++_0x2bdce8);}(_0xd59c,0xbf));var _0xcd59=function(_0x41f7b3,_0x3cca51){_0x41f7b3=_0x41f7b3-0x0;var _0x44482=_0xd59c[_0x41f7b3];return _0x44482;};'use strict';var moment=require(_0xcd59('0x0'));var _=require(_0xcd59('0x1'));var util=require('util');var client=require(_0xcd59('0x2'));exports[_0xcd59('0x3')]=function(_0x4d663b){var _0x10383=_0x4d663b['queuecallercompleteAt']||_0x4d663b[_0xcd59('0x4')];return client['Request'](_0xcd59('0x5'),{'body':{'channel':_0xcd59('0x6'),'membername':_0x4d663b[_0xcd59('0x7')],'interface':_[_0xcd59('0x8')](_0x4d663b[_0xcd59('0x9')])?util[_0xcd59('0xa')](_0xcd59('0xb'),_0x4d663b[_0xcd59('0x7')]):_0x4d663b[_0xcd59('0x9')],'type':_0xcd59('0xc'),'enterAt':_0x4d663b[_0xcd59('0xd')],'exitAt':_0x10383,'duration':moment(_0x10383)[_0xcd59('0xe')](_0x4d663b[_0xcd59('0xd')],_0xcd59('0xf')),'data1':_0xcd59('0x10'),'data2':_0x4d663b[_0xcd59('0x11')],'data3':_0x4d663b[_0xcd59('0x12')],'data4':null,'data5':_0x4d663b['queue'],'role':_0xcd59('0x13'),'internal':_0x4d663b[_0xcd59('0x14')]?_[_0xcd59('0x15')](_0x4d663b[_0xcd59('0x14')]):undefined,'uniqueid':_0x4d663b[_0xcd59('0x16')]},'log':_0xcd59('0x5')});};exports[_0xcd59('0x17')]=function(_0x32c020){return client[_0xcd59('0x18')](_0xcd59('0x5'),{'body':{'channel':_0xcd59('0x6'),'membername':_0x32c020[_0xcd59('0x19')],'interface':_0x32c020['interface'],'type':_0xcd59('0xc'),'enterAt':_0x32c020[_0xcd59('0x1a')],'exitAt':_0x32c020[_0xcd59('0x1b')],'duration':moment(_0x32c020['endtime'])['diff'](_0x32c020['starttime'],_0xcd59('0xf'))>=0x0?moment(_0x32c020[_0xcd59('0x1b')])[_0xcd59('0xe')](_0x32c020[_0xcd59('0x1a')],'seconds'):null,'data1':_0xcd59('0x1c'),'data2':_0x32c020[_0xcd59('0x14')],'data3':_0x32c020['exten'],'data4':_0x32c020['dialstring']||null,'role':_0xcd59('0x13'),'internal':_0x32c020[_0xcd59('0x14')]?_[_0xcd59('0x15')](_0x32c020[_0xcd59('0x14')]):undefined,'uniqueid':_0x32c020[_0xcd59('0x16')]},'log':_0xcd59('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 016594e..86b0213 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 _0xd52d=['Request','html','GetTemplate','getTemplates'];(function(_0x6182ff,_0x59d492){var _0x1cec22=function(_0x2e96f8){while(--_0x2e96f8){_0x6182ff['push'](_0x6182ff['shift']());}};_0x1cec22(++_0x59d492);}(_0xd52d,0x1c7));var _0xdd52=function(_0x5e2bcd,_0xd135ce){_0x5e2bcd=_0x5e2bcd-0x0;var _0x163f4e=_0xd52d[_0x5e2bcd];return _0x163f4e;};'use strict';var client=require('../client');exports[_0xdd52('0x0')]=function(_0x1dd2e9){return function(_0x4a8e8e){return client[_0xdd52('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id','name',_0xdd52('0x2')]},'log':_0xdd52('0x3')});};}; \ No newline at end of file +var _0x9ffd=['name','html','../client','getTemplates','Request','GetTemplate'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1bf661,_0x2f6c7c){_0x1bf661=_0x1bf661-0x0;var _0x42c6f6=_0x9ffd[_0x1bf661];return _0x42c6f6;};'use strict';var client=require(_0xd9ff('0x0'));exports[_0xd9ff('0x1')]=function(_0x47e5c0){return function(_0x5802a6){return client[_0xd9ff('0x2')](_0xd9ff('0x3'),{'options':{'raw':!![],'attributes':['id',_0xd9ff('0x4'),_0xd9ff('0x5')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 8ad8536..87507b9 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 _0x9bda=['status','Condition','AllConditions','operator','AnyConditions','value','Action','Actions','action','data2','data3','data4','data5','data6','data7','../client','getTriggers','GetTrigger','name','channel'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0x9bda,0x13b));var _0xa9bd=function(_0x2c9e61,_0x2d13f5){_0x2c9e61=_0x2c9e61-0x0;var _0x4d55d6=_0x9bda[_0x2c9e61];return _0x4d55d6;};'use strict';var client=require(_0xa9bd('0x0'));exports[_0xa9bd('0x1')]=function(_0x22b8aa){return function(_0x1dcfbd){return client['Request'](_0xa9bd('0x2'),{'options':{'raw':![],'attributes':['id',_0xa9bd('0x3'),_0xa9bd('0x4'),_0xa9bd('0x5')],'include':[{'model':_0xa9bd('0x6'),'as':_0xa9bd('0x7'),'attributes':['id','field',_0xa9bd('0x8'),'value']},{'model':_0xa9bd('0x6'),'as':_0xa9bd('0x9'),'attributes':['id','field',_0xa9bd('0x8'),_0xa9bd('0xa')]},{'model':_0xa9bd('0xb'),'as':_0xa9bd('0xc'),'attributes':['id',_0xa9bd('0xd'),'data1',_0xa9bd('0xe'),_0xa9bd('0xf'),_0xa9bd('0x10'),_0xa9bd('0x11'),_0xa9bd('0x12'),_0xa9bd('0x13')]}]},'log':_0xa9bd('0x2')});};}; \ No newline at end of file +var _0xf45e=['data7','getTriggers','Request','GetTrigger','name','channel','status','Condition','value','AnyConditions','field','operator','Action','Actions','action','data2','data4','data5'];(function(_0x1e679e,_0x4f3b81){var _0x44360d=function(_0x1882f1){while(--_0x1882f1){_0x1e679e['push'](_0x1e679e['shift']());}};_0x44360d(++_0x4f3b81);}(_0xf45e,0x17b));var _0xef45=function(_0x4cf3be,_0xd9dc01){_0x4cf3be=_0x4cf3be-0x0;var _0x252f26=_0xf45e[_0x4cf3be];return _0x252f26;};'use strict';var client=require('../client');exports[_0xef45('0x0')]=function(_0x17d8b6){return function(_0x260bcf){return client[_0xef45('0x1')](_0xef45('0x2'),{'options':{'raw':![],'attributes':['id',_0xef45('0x3'),_0xef45('0x4'),_0xef45('0x5')],'include':[{'model':_0xef45('0x6'),'as':'AllConditions','attributes':['id','field','operator',_0xef45('0x7')]},{'model':_0xef45('0x6'),'as':_0xef45('0x8'),'attributes':['id',_0xef45('0x9'),_0xef45('0xa'),_0xef45('0x7')]},{'model':_0xef45('0xb'),'as':_0xef45('0xc'),'attributes':['id',_0xef45('0xd'),'data1',_0xef45('0xe'),'data3',_0xef45('0xf'),_0xef45('0x10'),'data6',_0xef45('0x11')]}]},'log':_0xef45('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 87a84c6..e461dc1 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 _0xa645=['../client','getTrunks','name','registry','GetTrunk'];(function(_0x41cce2,_0x20868d){var _0x318b0d=function(_0x2a3d2a){while(--_0x2a3d2a){_0x41cce2['push'](_0x41cce2['shift']());}};_0x318b0d(++_0x20868d);}(_0xa645,0x140));var _0x5a64=function(_0x4bb77c,_0x4fa3bf){_0x4bb77c=_0x4bb77c-0x0;var _0x3201ca=_0xa645[_0x4bb77c];return _0x3201ca;};'use strict';var client=require(_0x5a64('0x0'));exports[_0x5a64('0x1')]=function(_0x3d0a63){return function(_0x58ddd8){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x5a64('0x2'),_0x5a64('0x3')]},'log':_0x5a64('0x4')});};}; \ No newline at end of file +var _0x9168=['../client','getTrunks','GetTrunk','name','registry'];(function(_0x31dd86,_0x54d5d6){var _0x2350fe=function(_0x59ce12){while(--_0x59ce12){_0x31dd86['push'](_0x31dd86['shift']());}};_0x2350fe(++_0x54d5d6);}(_0x9168,0x131));var _0x8916=function(_0x3509a0,_0x12669e){_0x3509a0=_0x3509a0-0x0;var _0x3691d7=_0x9168[_0x3509a0];return _0x3691d7;};'use strict';var client=require(_0x8916('0x0'));exports[_0x8916('0x1')]=function(_0x1033d1){return function(_0x450d96){return client['Request'](_0x8916('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x8916('0x3'),_0x8916('0x4')]},'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 23b2618..5ce6f6a 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 _0x8546=['email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','mobile','interface','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','agent','../client','getAgents','Request','GetUser','name'];(function(_0x4d6049,_0x6fa762){var _0x1d4f4c=function(_0x3280c3){while(--_0x3280c3){_0x4d6049['push'](_0x4d6049['shift']());}};_0x1d4f4c(++_0x6fa762);}(_0x8546,0x14b));var _0x6854=function(_0xa62f1b,_0x36ccc1){_0xa62f1b=_0xa62f1b-0x0;var _0x19aa46=_0x8546[_0xa62f1b];return _0x19aa46;};'use strict';var client=require(_0x6854('0x0'));exports[_0x6854('0x1')]=function(){return function(){return client[_0x6854('0x2')](_0x6854('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x6854('0x4'),_0x6854('0x5'),_0x6854('0x6'),_0x6854('0x7'),_0x6854('0x8'),_0x6854('0x9'),_0x6854('0xa'),_0x6854('0xb'),_0x6854('0xc'),'phone',_0x6854('0xd'),_0x6854('0xe')]},'log':'getAgents'});};};exports[_0x6854('0xf')]=function(){return function(){return client['Request'](_0x6854('0x3'),{'options':{'raw':!![],'where':{'role':_0x6854('0x10')},'attributes':['id',_0x6854('0x4'),_0x6854('0x6'),_0x6854('0x11')]},'log':_0x6854('0xf')});};};exports[_0x6854('0x12')]=function(_0x4b35a6,_0x530610,_0x491bc1){return client[_0x6854('0x2')](_0x6854('0x13'),{'body':{'type':_0x530610,'uniqueid':_0x491bc1},'options':{'where':{'id':_0x4b35a6['id']}},'log':_0x6854('0x12')});};exports[_0x6854('0x14')]=function(_0x1445db){return client[_0x6854('0x2')](_0x6854('0x15'),{'body':{},'options':{'where':{'id':_0x1445db['id']}},'log':_0x6854('0x12')});};exports[_0x6854('0x16')]=function(_0x4c68fd){return client[_0x6854('0x2')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x6854('0x17'),'id':_0x4c68fd},'attributes':['id',_0x6854('0x4'),_0x6854('0x5'),'accountcode','fullname',_0x6854('0x8'),_0x6854('0x9'),'pauseType',_0x6854('0xb'),_0x6854('0xc'),'interface']},'log':_0x6854('0x16')});}; \ No newline at end of file +var _0x3652=['name','internal','savePause','Request','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','pauseType','GetUser','agent','email','accountcode','fullname','online','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone'];(function(_0x59a0b2,_0x4e8f5b){var _0xec2369=function(_0x185132){while(--_0x185132){_0x59a0b2['push'](_0x59a0b2['shift']());}};_0xec2369(++_0x4e8f5b);}(_0x3652,0x6a));var _0x2365=function(_0x2b9e8a,_0x7b21d4){_0x2b9e8a=_0x2b9e8a-0x0;var _0x520e67=_0x3652[_0x2b9e8a];return _0x520e67;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client['Request'](_0x2365('0x0'),{'options':{'raw':![],'where':{'role':_0x2365('0x1')},'attributes':['id','name',_0x2365('0x2'),_0x2365('0x3'),_0x2365('0x4'),_0x2365('0x5'),_0x2365('0x6'),'pauseType',_0x2365('0x7'),_0x2365('0x8'),_0x2365('0x9'),_0x2365('0xa'),_0x2365('0xb')]},'log':'getAgents'});};};exports[_0x2365('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x2365('0xd')},'attributes':['id',_0x2365('0xe'),_0x2365('0x3'),_0x2365('0xf')]},'log':_0x2365('0xc')});};};exports[_0x2365('0x10')]=function(_0x5ea02e,_0x5d5777,_0xce9eb7){return client[_0x2365('0x11')](_0x2365('0x12'),{'body':{'type':_0x5d5777,'uniqueid':_0xce9eb7},'options':{'where':{'id':_0x5ea02e['id']}},'log':_0x2365('0x10')});};exports[_0x2365('0x13')]=function(_0x55cd9f){return client[_0x2365('0x11')](_0x2365('0x14'),{'body':{},'options':{'where':{'id':_0x55cd9f['id']}},'log':_0x2365('0x10')});};exports[_0x2365('0x15')]=function(_0xb80726){return client['Request'](_0x2365('0x16'),{'options':{'raw':![],'where':{'role':_0x2365('0x1'),'id':_0xb80726},'attributes':['id','name','email',_0x2365('0x3'),_0x2365('0x4'),'online',_0x2365('0x6'),_0x2365('0x17'),_0x2365('0x7'),_0x2365('0x8'),_0x2365('0xb')]},'log':_0x2365('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 1c3bc5f..9d91a2b 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 _0x10a7=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x2e5f3e,_0x1a5045){var _0x45b219=function(_0x36c069){while(--_0x36c069){_0x2e5f3e['push'](_0x2e5f3e['shift']());}};_0x45b219(++_0x1a5045);}(_0x10a7,0xd4));var _0x710a=function(_0x9c6f12,_0x4144ae){_0x9c6f12=_0x9c6f12-0x0;var _0x395240=_0x10a7[_0x9c6f12];return _0x395240;};'use strict';var client=require(_0x710a('0x0'));exports[_0x710a('0x1')]=function(_0x3af5e4){return client[_0x710a('0x2')](_0x710a('0x3'),{'body':_0x3af5e4,'log':'CreateVoiceAgentReport'});};exports[_0x710a('0x4')]=function(_0x455e03,_0x117b3d,_0x5d55de){return client['Request']('UpdateVoiceAgentReport',{'body':_0x455e03,'options':{'where':{'uniqueid':_0x117b3d,'interface':_0x5d55de,'agentcomplete':!![]}},'log':_0x710a('0x5')});}; \ No newline at end of file +var _0x9bad=['update','UpdateVoiceAgentReport','../client','Request','CreateVoiceAgentReport'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x9bad,0xa2));var _0xd9ba=function(_0x219708,_0x4f0a43){_0x219708=_0x219708-0x0;var _0x59a7f8=_0x9bad[_0x219708];return _0x59a7f8;};'use strict';var client=require(_0xd9ba('0x0'));exports['create']=function(_0x1b8652){return client[_0xd9ba('0x1')]('CreateVoiceAgentReport',{'body':_0x1b8652,'log':_0xd9ba('0x2')});};exports[_0xd9ba('0x3')]=function(_0x269e27,_0x405297,_0x496b76){return client[_0xd9ba('0x1')](_0xd9ba('0x4'),{'body':_0x269e27,'options':{'where':{'uniqueid':_0x405297,'interface':_0x496b76,'agentcomplete':!![]}},'log':_0xd9ba('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 8354a65..4168320 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 _0x19a7=['context','callerid','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','create','Request','CreateVoiceCallReport'];(function(_0x2f978a,_0xa949b4){var _0x7b8154=function(_0x2bb1d4){while(--_0x2bb1d4){_0x2f978a['push'](_0x2f978a['shift']());}};_0x7b8154(++_0xa949b4);}(_0x19a7,0xae));var _0x719a=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x19a7[_0x37bd26];return _0xe83dc4;};'use strict';var moment=require(_0x719a('0x0'));var util=require(_0x719a('0x1'));var _=require(_0x719a('0x2'));var client=require('../client');exports[_0x719a('0x3')]=function(_0x2e7cc5){return client[_0x719a('0x4')](_0x719a('0x5'),{'body':_['merge'](_0x2e7cc5,{'source':_0x2e7cc5['calleridnum'],'destinationcontext':_0x2e7cc5[_0x719a('0x6')],'callerid':_0x2e7cc5[_0x719a('0x7')],'amaflags':'DOCUMENTATION'}),'log':_0x719a('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0x719a('0x8')],'createdAt':{'$between':[moment()[_0x719a('0x9')](_0x719a('0xa'))[_0x719a('0xb')](_0x719a('0xc')),moment()['endOf'](_0x719a('0xa'))[_0x719a('0xb')](_0x719a('0xc'))]}},'attributes':[_0x719a('0xd'),_0x719a('0xe'),_0x719a('0xf'),_0x719a('0x10')]},'log':_0x719a('0x11')});};}; \ No newline at end of file +var _0x0937=['day','endOf','format','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','outbound'];(function(_0x151418,_0x2cbffa){var _0x40e29a=function(_0xec4d7){while(--_0xec4d7){_0x151418['push'](_0x151418['shift']());}};_0x40e29a(++_0x2cbffa);}(_0x0937,0x126));var _0x7093=function(_0x134daf,_0x32fd86){_0x134daf=_0x134daf-0x0;var _0x44b857=_0x0937[_0x134daf];return _0x44b857;};'use strict';var moment=require(_0x7093('0x0'));var util=require(_0x7093('0x1'));var _=require(_0x7093('0x2'));var client=require(_0x7093('0x3'));exports[_0x7093('0x4')]=function(_0x353318){return client[_0x7093('0x5')](_0x7093('0x6'),{'body':_[_0x7093('0x7')](_0x353318,{'source':_0x353318[_0x7093('0x8')],'destinationcontext':_0x353318[_0x7093('0x9')],'callerid':_0x353318[_0x7093('0xa')],'amaflags':_0x7093('0xb')}),'log':_0x7093('0x6')});};exports[_0x7093('0xc')]=function(){return function(){return client[_0x7093('0x5')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x7093('0xd')],'createdAt':{'$between':[moment()['startOf'](_0x7093('0xe'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x7093('0xf')](_0x7093('0xe'))[_0x7093('0x10')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x7093('0x11'),_0x7093('0x12'),_0x7093('0x13'),_0x7093('0x14')]},'log':_0x7093('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 4ab4783..d18b8b3 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 _0xa004=['Request','CreateVoiceDialReport','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa004,0xa2));var _0x4a00=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa004[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x4a00('0x0'));exports[_0x4a00('0x1')]=function(_0xe20d41){return client[_0x4a00('0x2')](_0x4a00('0x3'),{'body':_0xe20d41,'log':_0x4a00('0x3')});}; \ No newline at end of file +var _0x2536=['../client','Request','CreateVoiceDialReport'];(function(_0x442a10,_0x742347){var _0x23176e=function(_0x53db6b){while(--_0x53db6b){_0x442a10['push'](_0x442a10['shift']());}};_0x23176e(++_0x742347);}(_0x2536,0xf9));var _0x6253=function(_0x205a54,_0x508c39){_0x205a54=_0x205a54-0x0;var _0x359326=_0x2536[_0x205a54];return _0x359326;};'use strict';var client=require(_0x6253('0x0'));exports['create']=function(_0x374ffe){return client[_0x6253('0x1')]('CreateVoiceDialReport',{'body':_0x374ffe,'log':_0x6253('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 3209719..4c2b64e 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 _0x4fc2=['Request','GetVoiceExtension','recordingFormat','../client','getVoiceExtensions'];(function(_0x3805e9,_0x33a4ed){var _0x207e20=function(_0x293840){while(--_0x293840){_0x3805e9['push'](_0x3805e9['shift']());}};_0x207e20(++_0x33a4ed);}(_0x4fc2,0x111));var _0x24fc=function(_0x3b477d,_0x4495f9){_0x3b477d=_0x3b477d-0x0;var _0x45d4eb=_0x4fc2[_0x3b477d];return _0x45d4eb;};'use strict';var client=require(_0x24fc('0x0'));exports[_0x24fc('0x1')]=function(){return function(){return client[_0x24fc('0x2')](_0x24fc('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0x24fc('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x24fc('0x1')});};}; \ No newline at end of file +var _0xdd4f=['../client','exten','recordingFormat'];(function(_0x50fe63,_0x52f9d0){var _0x33f9bd=function(_0x153081){while(--_0x153081){_0x50fe63['push'](_0x50fe63['shift']());}};_0x33f9bd(++_0x52f9d0);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x107086,_0x4baaea){_0x107086=_0x107086-0x0;var _0x1a7469=_0xdd4f[_0x107086];return _0x1a7469;};'use strict';var client=require(_0xfdd4('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xfdd4('0x1'),_0xfdd4('0x2')],'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 431b7d2..c1ed3f5 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 _0x8f7c=['dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','name','callerid','active','Pause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberRetryFrequency'];(function(_0x44c768,_0x552a5e){var _0x55daf5=function(_0x4958e8){while(--_0x4958e8){_0x44c768['push'](_0x44c768['shift']());}};_0x55daf5(++_0x552a5e);}(_0x8f7c,0xfe));var _0xc8f7=function(_0x4e3246,_0x244bd3){_0x4e3246=_0x4e3246-0x0;var _0x3f680b=_0x8f7c[_0x4e3246];return _0x3f680b;};'use strict';var client=require(_0xc8f7('0x0'));exports[_0xc8f7('0x1')]=function(){return function(){return client[_0xc8f7('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name','acw',_0xc8f7('0x3'),_0xc8f7('0x4'),_0xc8f7('0x5'),_0xc8f7('0x6'),'dialActive',_0xc8f7('0x7'),_0xc8f7('0x8'),_0xc8f7('0x9'),_0xc8f7('0xa'),_0xc8f7('0xb'),_0xc8f7('0xc'),_0xc8f7('0xd'),'dialOriginateCallerIdName',_0xc8f7('0xe'),_0xc8f7('0xf'),'dialQueueOptions',_0xc8f7('0x10'),'dialQueueProject',_0xc8f7('0x11'),_0xc8f7('0x12'),_0xc8f7('0x13'),_0xc8f7('0x14'),_0xc8f7('0x15'),'dialNoAnswerRetryFrequency',_0xc8f7('0x16'),_0xc8f7('0x17'),'dialGlobalInterval','dialPrefix',_0xc8f7('0x18'),'dialAMDActive',_0xc8f7('0x19'),_0xc8f7('0x1a'),'dialAMDAfterGreetingSilence',_0xc8f7('0x1b'),_0xc8f7('0x1c'),_0xc8f7('0x1d'),_0xc8f7('0x1e'),_0xc8f7('0x1f'),_0xc8f7('0x20'),_0xc8f7('0x21'),_0xc8f7('0x22'),_0xc8f7('0x23'),'dialOrderByScheduledAt',_0xc8f7('0x24'),_0xc8f7('0x25'),_0xc8f7('0x26'),_0xc8f7('0x5'),'strategy',_0xc8f7('0x27'),'dialCutDigit','dialNoSuchNumberMaxRetry',_0xc8f7('0x28'),_0xc8f7('0x29'),'dialDropRetryFrequency',_0xc8f7('0x2a'),_0xc8f7('0x2b'),_0xc8f7('0x2c'),_0xc8f7('0x2d'),'dialAgentRejectMaxRetry',_0xc8f7('0x2e'),_0xc8f7('0x2f'),_0xc8f7('0x30'),_0xc8f7('0x31')],'include':[{'model':_0xc8f7('0x32'),'as':'Trunk','attributes':['id',_0xc8f7('0x33'),_0xc8f7('0x34'),_0xc8f7('0x35')]},{'model':_0xc8f7('0x36'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0xc8f7('0x32'),'as':_0xc8f7('0x37'),'attributes':['id',_0xc8f7('0x33'),'callerid',_0xc8f7('0x35')]},{'model':_0xc8f7('0x38'),'as':'Interval','attributes':['id',_0xc8f7('0x33')],'include':[{'model':'Interval','as':_0xc8f7('0x39'),'attributes':['id','name',_0xc8f7('0x3a')]}]}]},'log':_0xc8f7('0x1')});};}; \ No newline at end of file +var _0x11d1=['acwTimeout','autopause','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','timeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','mandatoryDispositionPause','TrunkBackup','active','Interval','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name'];(function(_0x2dcd85,_0x2c81a3){var _0x427414=function(_0x295265){while(--_0x295265){_0x2dcd85['push'](_0x2dcd85['shift']());}};_0x427414(++_0x2c81a3);}(_0x11d1,0x184));var _0x111d=function(_0x2c72f2,_0x2bf7fe){_0x2c72f2=_0x2c72f2-0x0;var _0x2ceb36=_0x11d1[_0x2c72f2];return _0x2ceb36;};'use strict';var client=require(_0x111d('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x111d('0x1')](_0x111d('0x2'),{'options':{'raw':![],'attributes':['id',_0x111d('0x3'),'acw',_0x111d('0x4'),_0x111d('0x5'),_0x111d('0x6'),'type',_0x111d('0x7'),_0x111d('0x8'),_0x111d('0x9'),_0x111d('0xa'),_0x111d('0xb'),'dialPredictiveOptimization','dialPredictiveOptimizationPercentage',_0x111d('0xc'),_0x111d('0xd'),'dialOriginateCallerIdNumber',_0x111d('0xe'),_0x111d('0xf'),'dialQueueTimeout',_0x111d('0x10'),_0x111d('0x11'),_0x111d('0x12'),_0x111d('0x13'),_0x111d('0x14'),_0x111d('0x15'),_0x111d('0x16'),_0x111d('0x17'),'dialTimezone',_0x111d('0x18'),_0x111d('0x19'),_0x111d('0x1a'),'dialAMDActive','dialAMDInitialSilence',_0x111d('0x1b'),_0x111d('0x1c'),'dialAMDTotalAnalysisTime','dialAMDMinWordLength',_0x111d('0x1d'),_0x111d('0x1e'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength',_0x111d('0x1f'),'dialRecallMeTimeout',_0x111d('0x20'),'dialOrderByScheduledAt',_0x111d('0x21'),_0x111d('0x22'),_0x111d('0x23'),'monitor_format',_0x111d('0x24'),_0x111d('0x25'),'dialCutDigit',_0x111d('0x26'),_0x111d('0x27'),'dialDropMaxRetry',_0x111d('0x28'),_0x111d('0x29'),_0x111d('0x2a'),_0x111d('0x2b'),_0x111d('0x2c'),'dialAgentRejectMaxRetry',_0x111d('0x2d'),_0x111d('0x2e'),_0x111d('0x2f'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':'Trunk','as':_0x111d('0x30'),'attributes':['id','name',_0x111d('0x31'),'active']},{'model':'Pause','as':_0x111d('0x32'),'attributes':['id',_0x111d('0x3')]},{'model':_0x111d('0x30'),'as':_0x111d('0x33'),'attributes':['id','name','callerid',_0x111d('0x34')]},{'model':_0x111d('0x35'),'as':_0x111d('0x35'),'attributes':['id',_0x111d('0x3')],'include':[{'model':_0x111d('0x35'),'as':'Intervals','attributes':['id',_0x111d('0x3'),_0x111d('0x36')]}]}]},'log':_0x111d('0x37')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index bfd525b..5e07143 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 _0x25b4=['getVoiceQueueReports','GetVoiceQueueReport','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','queuecallerabandon','GetVoiceQueueReports','moment','lodash','create','Request'];(function(_0x3dae40,_0x5ac8fb){var _0x4a3858=function(_0x346163){while(--_0x346163){_0x3dae40['push'](_0x3dae40['shift']());}};_0x4a3858(++_0x5ac8fb);}(_0x25b4,0xd4));var _0x425b=function(_0x4c73ac,_0x46b73c){_0x4c73ac=_0x4c73ac-0x0;var _0x9839ee=_0x25b4[_0x4c73ac];return _0x9839ee;};'use strict';var moment=require(_0x425b('0x0'));var _=require(_0x425b('0x1'));var client=require('../client');exports[_0x425b('0x2')]=function(_0x484fae){return client[_0x425b('0x3')]('CreateVoiceQueueReport',{'body':_0x484fae,'log':'CreateVoiceQueueReport'});};exports[_0x425b('0x4')]=function(){return function(){return client[_0x425b('0x3')](_0x425b('0x5'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x425b('0x6')](_0x425b('0x7'))['format'](_0x425b('0x8')),moment()[_0x425b('0x9')]('day')['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x425b('0xa'),_0x425b('0xb'),_0x425b('0xc'),'queuecallerleaveAt',_0x425b('0xd'),_0x425b('0xe'),'queuecallerexit',_0x425b('0xf'),_0x425b('0x10'),'queuecallerabandonAt']},'log':_0x425b('0x11')});};}; \ No newline at end of file +var _0x7d2b=['queue','queuecallerjoinAt','queuecallerleaveAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','create','CreateVoiceQueueReport','Request','GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x7d2b,0x1aa));var _0xb7d2=function(_0x1fd9f5,_0x55161a){_0x1fd9f5=_0x1fd9f5-0x0;var _0x5b59b1=_0x7d2b[_0x1fd9f5];return _0x5b59b1;};'use strict';var moment=require(_0xb7d2('0x0'));var _=require(_0xb7d2('0x1'));var client=require(_0xb7d2('0x2'));exports[_0xb7d2('0x3')]=function(_0x5ad491){return client['Request'](_0xb7d2('0x4'),{'body':_0x5ad491,'log':_0xb7d2('0x4')});};exports['getVoiceQueueReports']=function(){return function(){return client[_0xb7d2('0x5')](_0xb7d2('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xb7d2('0x7')](_0xb7d2('0x8'))[_0xb7d2('0x9')](_0xb7d2('0xa')),moment()['endOf'](_0xb7d2('0x8'))['format'](_0xb7d2('0xa'))]}},'attributes':['uniqueid',_0xb7d2('0xb'),_0xb7d2('0xc'),_0xb7d2('0xd'),'queuecallercomplete','queuecallercompleteAt',_0xb7d2('0xe'),_0xb7d2('0xf'),_0xb7d2('0x10'),_0xb7d2('0x11')]},'log':_0xb7d2('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index a79a009..8dd9e4c 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 _0xeb01=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xeb01,0x17b));var _0x1eb0=function(_0x4f4331,_0x1af168){_0x4f4331=_0x4f4331-0x0;var _0x35c2cf=_0xeb01[_0x4f4331];return _0x35c2cf;};'use strict';var client=require(_0x1eb0('0x0'));exports[_0x1eb0('0x1')]=function(_0x11acf5){return function(){return client[_0x1eb0('0x2')](_0x1eb0('0x3'),{'options':{'where':{'VoiceQueueId':_0x11acf5,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0xef49=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client'];(function(_0x513bc8,_0x19c530){var _0x3304a2=function(_0x114297){while(--_0x114297){_0x513bc8['push'](_0x513bc8['shift']());}};_0x3304a2(++_0x19c530);}(_0xef49,0xdb));var _0x9ef4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xef49[_0x3d42d8];return _0x27fc41;};'use strict';var client=require(_0x9ef4('0x0'));exports['getVoiceQueueRtPauses']=function(_0x2d281d){return function(){return client[_0x9ef4('0x1')](_0x9ef4('0x2'),{'options':{'where':{'VoiceQueueId':_0x2d281d,'paused':!![]},'raw':!![]},'log':_0x9ef4('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index bbfce6a..36101c4 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 _0x5fd0=['merge','lodash','../client','create','Request','CreateVoiceRecording'];(function(_0x24044f,_0x56ba95){var _0x5f9b31=function(_0x6c3006){while(--_0x6c3006){_0x24044f['push'](_0x24044f['shift']());}};_0x5f9b31(++_0x56ba95);}(_0x5fd0,0x1d5));var _0x05fd=function(_0x4fef8b,_0x4d1704){_0x4fef8b=_0x4fef8b-0x0;var _0x3a8d8b=_0x5fd0[_0x4fef8b];return _0x3a8d8b;};'use strict';var _=require(_0x05fd('0x0'));var client=require(_0x05fd('0x1'));exports[_0x05fd('0x2')]=function(_0x59b595){return client[_0x05fd('0x3')](_0x05fd('0x4'),{'body':_[_0x05fd('0x5')](_0x59b595,{'value':_0x59b595['monitorFilename']}),'log':_0x05fd('0x4')});}; \ No newline at end of file +var _0x6f22=['monitorFilename','CreateVoiceRecording','merge'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x6f22,0x163));var _0x26f2=function(_0x3ccd5c,_0x1ee1a7){_0x3ccd5c=_0x3ccd5c-0x0;var _0x1be3e3=_0x6f22[_0x3ccd5c];return _0x1be3e3;};'use strict';var _=require('lodash');var client=require('../client');exports['create']=function(_0x2efde0){return client['Request'](_0x26f2('0x0'),{'body':_[_0x26f2('0x1')](_0x2efde0,{'value':_0x2efde0[_0x26f2('0x2')]}),'log':_0x26f2('0x0')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index a5a5810..20a4dbf 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 _0x13c0=['transfertargetlinkedid','isexternal','origtransferercontext','../client','blindTransfer','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeaccountcode','transfereeexten','CreateVoiceTransferReport','attendedTransfer','Request','result','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten'];(function(_0x5d9cab,_0x3d00c0){var _0x3e30c3=function(_0x2c8030){while(--_0x2c8030){_0x5d9cab['push'](_0x5d9cab['shift']());}};_0x3e30c3(++_0x3d00c0);}(_0x13c0,0x196));var _0x013c=function(_0x280c4b,_0xfe785d){_0x280c4b=_0x280c4b-0x0;var _0x2a5e90=_0x13c0[_0x280c4b];return _0x2a5e90;};'use strict';var client=require(_0x013c('0x0'));exports[_0x013c('0x1')]=function(_0x3448e9){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x3448e9['result'],'transfererchannel':_0x3448e9['transfererchannel'],'transferercalleridnum':_0x3448e9[_0x013c('0x2')],'transferercalleridname':_0x3448e9[_0x013c('0x3')],'transfererconnectedlinenum':_0x3448e9[_0x013c('0x4')],'transfererconnectedlinename':_0x3448e9['transfererconnectedlinename'],'transfereraccountcode':_0x3448e9[_0x013c('0x5')],'transferercontext':_0x3448e9['transferercontext'],'transfererexten':_0x3448e9['transfererexten'],'transfererlinkedid':_0x3448e9[_0x013c('0x6')],'transfereechannel':_0x3448e9['transfereechannel'],'transfereecalleridnum':_0x3448e9[_0x013c('0x7')],'transfereecalleridname':_0x3448e9[_0x013c('0x8')],'transfereeconnectedlinenum':_0x3448e9['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x3448e9['transfereeconnectedlinename'],'transfereeaccountcode':_0x3448e9[_0x013c('0x9')],'transfereecontext':_0x3448e9['transfereecontext'],'transfereeexten':_0x3448e9[_0x013c('0xa')],'transfereelinkedid':_0x3448e9['transfereelinkedid'],'isexternal':_0x3448e9['isexternal'],'context':_0x3448e9['context'],'extension':_0x3448e9['extension'],'type':'blind'},'log':_0x013c('0xb')});};exports[_0x013c('0xc')]=function(_0x27206f){return client[_0x013c('0xd')](_0x013c('0xb'),{'body':{'result':_0x27206f[_0x013c('0xe')],'transfererchannel':_0x27206f[_0x013c('0xf')],'transferercalleridnum':_0x27206f[_0x013c('0x10')],'transferercalleridname':_0x27206f[_0x013c('0x11')],'transfererconnectedlinenum':_0x27206f['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x27206f['secondtransfererconnectedlinename'],'transfereraccountcode':_0x27206f[_0x013c('0x12')],'transferercontext':_0x27206f[_0x013c('0x13')],'transfererexten':_0x27206f[_0x013c('0x14')],'transfererlinkedid':_0x27206f[_0x013c('0x15')],'transfereechannel':_0x27206f[_0x013c('0x16')],'transfereecalleridnum':_0x27206f['transfertargetcalleridnum'],'transfereecalleridname':_0x27206f[_0x013c('0x17')],'transfereeconnectedlinenum':_0x27206f[_0x013c('0x18')],'transfereeconnectedlinename':_0x27206f[_0x013c('0x19')],'transfereeaccountcode':_0x27206f[_0x013c('0x1a')],'transfereecontext':_0x27206f['transfertargetcontext'],'transfereeexten':_0x27206f[_0x013c('0x1b')],'transfereelinkedid':_0x27206f[_0x013c('0x1c')],'isexternal':_0x27206f[_0x013c('0x1d')],'context':_0x27206f[_0x013c('0x1e')],'extension':_0x27206f['origtransfererexten'],'type':'attended'},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x5ab1=['attended','../client','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','result','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransfererexten'];(function(_0x4807cc,_0x12c009){var _0x7e1997=function(_0x5c035c){while(--_0x5c035c){_0x4807cc['push'](_0x4807cc['shift']());}};_0x7e1997(++_0x12c009);}(_0x5ab1,0x1d5));var _0x15ab=function(_0x369643,_0x3424c3){_0x369643=_0x369643-0x0;var _0x235eca=_0x5ab1[_0x369643];return _0x235eca;};'use strict';var client=require(_0x15ab('0x0'));exports[_0x15ab('0x1')]=function(_0x2dcb19){return client[_0x15ab('0x2')](_0x15ab('0x3'),{'body':{'result':_0x2dcb19['result'],'transfererchannel':_0x2dcb19[_0x15ab('0x4')],'transferercalleridnum':_0x2dcb19[_0x15ab('0x5')],'transferercalleridname':_0x2dcb19[_0x15ab('0x6')],'transfererconnectedlinenum':_0x2dcb19['transfererconnectedlinenum'],'transfererconnectedlinename':_0x2dcb19['transfererconnectedlinename'],'transfereraccountcode':_0x2dcb19['transfereraccountcode'],'transferercontext':_0x2dcb19[_0x15ab('0x7')],'transfererexten':_0x2dcb19[_0x15ab('0x8')],'transfererlinkedid':_0x2dcb19[_0x15ab('0x9')],'transfereechannel':_0x2dcb19['transfereechannel'],'transfereecalleridnum':_0x2dcb19[_0x15ab('0xa')],'transfereecalleridname':_0x2dcb19[_0x15ab('0xb')],'transfereeconnectedlinenum':_0x2dcb19['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x2dcb19[_0x15ab('0xc')],'transfereeaccountcode':_0x2dcb19[_0x15ab('0xd')],'transfereecontext':_0x2dcb19[_0x15ab('0xe')],'transfereeexten':_0x2dcb19['transfereeexten'],'transfereelinkedid':_0x2dcb19[_0x15ab('0xf')],'isexternal':_0x2dcb19[_0x15ab('0x10')],'context':_0x2dcb19[_0x15ab('0x11')],'extension':_0x2dcb19[_0x15ab('0x12')],'type':_0x15ab('0x13')},'log':_0x15ab('0x3')});};exports[_0x15ab('0x14')]=function(_0x471ce8){return client[_0x15ab('0x2')](_0x15ab('0x3'),{'body':{'result':_0x471ce8[_0x15ab('0x15')],'transfererchannel':_0x471ce8[_0x15ab('0x16')],'transferercalleridnum':_0x471ce8['origtransferercalleridnum'],'transferercalleridname':_0x471ce8[_0x15ab('0x17')],'transfererconnectedlinenum':_0x471ce8[_0x15ab('0x18')],'transfererconnectedlinename':_0x471ce8['secondtransfererconnectedlinename'],'transfereraccountcode':_0x471ce8['origtransfereraccountcode'],'transferercontext':_0x471ce8[_0x15ab('0x19')],'transfererexten':_0x471ce8[_0x15ab('0x1a')],'transfererlinkedid':_0x471ce8[_0x15ab('0x1b')],'transfereechannel':_0x471ce8[_0x15ab('0x1c')],'transfereecalleridnum':_0x471ce8[_0x15ab('0x1d')],'transfereecalleridname':_0x471ce8[_0x15ab('0x1e')],'transfereeconnectedlinenum':_0x471ce8[_0x15ab('0x1f')],'transfereeconnectedlinename':_0x471ce8[_0x15ab('0x20')],'transfereeaccountcode':_0x471ce8[_0x15ab('0x21')],'transfereecontext':_0x471ce8[_0x15ab('0x22')],'transfereeexten':_0x471ce8[_0x15ab('0x23')],'transfereelinkedid':_0x471ce8[_0x15ab('0x24')],'isexternal':_0x471ce8[_0x15ab('0x10')],'context':_0x471ce8['origtransferercontext'],'extension':_0x471ce8[_0x15ab('0x25')],'type':_0x15ab('0x26')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 13df692..3694020 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 _0x5cb8=['Channel\x20doesn\x27t\x20exist','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','exten','context','telephones','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','bluebird','moment','../ami','listen','%s/%s','name','timers','agents','updateStatusRealtime','pause','isConnected','asterisk','username','ami\x20disconnected','pick','keys','module','Reload','Action','then','message','catch','error','join','action','Command','voiceQueues','hasOwnProperty','strategy','answered','available','pTalking','sumBillable','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','Interval','push','length','values','channels','voicechannel','map','find','channel','format','%s.%s','filename','uniqueid','wav','ai(mixmonitorid)','toLowerCase','isNil','/var/spool/asterisk/monitor/','mixmonitorid','rec','status','MixMonitor\x20Success','validate','destinationchannel','StopMixMonitor','monitors','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0x5cb8,0x1a5));var _0x85cb=function(_0x5e6745,_0x54cc24){_0x5e6745=_0x5e6745-0x0;var _0x16bde7=_0x5cb8[_0x5e6745];return _0x16bde7;};'use strict';var _=require('lodash');var util=require(_0x85cb('0x0'));var jayson=require(_0x85cb('0x1'));var schema=require('validate');var BPromise=require(_0x85cb('0x2'));var moment=require(_0x85cb('0x3'));var config=require('../../../config/environment');var properties=require('../properties');var ami=require(_0x85cb('0x4'));exports[_0x85cb('0x5')]=function(_0x4c581a,_0x190c73,_0x3bdc83){return new BPromise(function(_0x1f8ee3,_0x24fcc3){var _0x3d7826={'QueuePause':function(_0x25e82a){return new Promise(function(_0x517331,_0x2ecefa){var _0x59fd9b=util['format'](_0x85cb('0x6'),'SIP',_0x25e82a[_0x85cb('0x7')]);if(_0x4c581a[_0x85cb('0x8')]&&_0x4c581a['timers'][_0x59fd9b]&&_0x4c581a[_0x85cb('0x8')][_0x59fd9b]['timer']){_0x4c581a['timers'][_0x59fd9b]['updateAcw']();}if(_0x4c581a[_0x85cb('0x9')][_0x59fd9b]){_0x4c581a[_0x85cb('0x9')][_0x59fd9b][_0x85cb('0xa')]({'statePause':_0x25e82a[_0x85cb('0xb')]?!![]:![]});}_0x517331({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x508eb3){var _0x1d5e84=this;return new Promise(function(_0x5c33da,_0x2def06){if(ami[_0x85cb('0xc')]()==![]){return _0x2def06(_0x1d5e84['error'](0x1f4,[config['asterisk']['ip'],config[_0x85cb('0xd')][_0x85cb('0xe')],_0x85cb('0xf')]['join']('\x20')));}_0x508eb3=_[_0x85cb('0x10')](_0x508eb3,_[_0x85cb('0x11')](properties[_0x85cb('0x12')]));_0x508eb3['action']=_0x85cb('0x13');return ami[_0x85cb('0x14')](_0x508eb3)[_0x85cb('0x15')](function(_0x35ff83){_0x5c33da({'code':0xc8,'message':_0x35ff83[_0x85cb('0x16')]});})[_0x85cb('0x17')](function(_0x5af5a4){_0x2def06(_0x1d5e84[_0x85cb('0x18')](0x1f5,_0x5af5a4[_0x85cb('0x16')]));});});},'Command':function(_0x4707bf){var _0x567bc1=this;return new Promise(function(_0x33eac5,_0x41b60d){if(ami[_0x85cb('0xc')]()==![]){return _0x41b60d(_0x567bc1[_0x85cb('0x18')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x85cb('0xe')],_0x85cb('0xf')][_0x85cb('0x19')]('\x20')));}_0x4707bf=_[_0x85cb('0x10')](_0x4707bf,'command');_0x4707bf[_0x85cb('0x1a')]=_0x85cb('0x1b');return ami[_0x85cb('0x14')](_0x4707bf)[_0x85cb('0x15')](function(_0x3e3f2e){_0x33eac5({'code':0xc8,'message':_0x3e3f2e['content']});})[_0x85cb('0x17')](function(_0x21ef45){_0x41b60d(_0x567bc1['error'](0x1f5,_0x21ef45[_0x85cb('0x16')]));});});},'VoiceQueues':function(_0x448807){return new Promise(function(_0x42a188,_0x371c57){var _0x16030f=[];for(var _0x446a6d in _0x4c581a[_0x85cb('0x1c')]){if(_0x4c581a[_0x85cb('0x1c')][_0x85cb('0x1d')](_0x446a6d)){var _0x153474=_0x4c581a[_0x85cb('0x1c')][_0x446a6d];var _0x1ae92c={'id':_0x153474['id'],'name':_0x153474[_0x85cb('0x7')],'strategy':_0x153474[_0x85cb('0x1e')],'answered':_0x153474[_0x85cb('0x1f')],'available':_0x153474[_0x85cb('0x20')],'loggedIn':_0x153474['loggedIn'],'pTalking':_0x153474[_0x85cb('0x21')],'sumBillable':_0x153474[_0x85cb('0x22')],'sumDuration':_0x153474['sumDuration'],'sumHoldTime':_0x153474[_0x85cb('0x23')]||0x0,'talking':_0x153474[_0x85cb('0x24')],'total':_0x153474[_0x85cb('0x25')],'type':_0x153474['type'],'unmanaged':_0x153474[_0x85cb('0x26')],'abandoned':_0x153474[_0x85cb('0x27')],'waiting':_0x153474['waiting'],'loggedInDb':_0x153474[_0x85cb('0x28')]};if(_0x153474[_0x85cb('0x29')]===_0x85cb('0x2a')){_0x1ae92c[_0x85cb('0x2b')]=_0x153474[_0x85cb('0x2b')];_0x1ae92c[_0x85cb('0x2c')]=_0x153474[_0x85cb('0x2c')];_0x1ae92c['dialOriginateCallerIdName']=_0x153474[_0x85cb('0x2d')];_0x1ae92c[_0x85cb('0x2e')]=_0x153474['dialOriginateCallerIdNumber'];_0x1ae92c[_0x85cb('0x2f')]=_0x153474['dialOriginateTimeout'];_0x1ae92c[_0x85cb('0x30')]=_0x153474[_0x85cb('0x30')];_0x1ae92c[_0x85cb('0x31')]=_0x153474[_0x85cb('0x31')];_0x1ae92c[_0x85cb('0x32')]=_0x153474[_0x85cb('0x32')];_0x1ae92c[_0x85cb('0x33')]=_0x153474[_0x85cb('0x33')];_0x1ae92c['outboundBusyCallsDay']=_0x153474[_0x85cb('0x34')];_0x1ae92c[_0x85cb('0x35')]=_0x153474[_0x85cb('0x35')];_0x1ae92c[_0x85cb('0x36')]=_0x153474[_0x85cb('0x36')];_0x1ae92c[_0x85cb('0x37')]=_0x153474[_0x85cb('0x37')];_0x1ae92c['outboundDropCallsDayTimeout']=_0x153474['outboundDropCallsDayTimeout'];_0x1ae92c[_0x85cb('0x38')]=_0x153474[_0x85cb('0x38')];_0x1ae92c[_0x85cb('0x39')]=_0x153474[_0x85cb('0x39')];_0x1ae92c[_0x85cb('0x3a')]=_0x153474[_0x85cb('0x3a')];_0x1ae92c['outboundReCallsDay']=_0x153474['outboundReCallsDay'];_0x1ae92c[_0x85cb('0x3b')]=_0x153474['outboundRejectCallsDay'];_0x1ae92c[_0x85cb('0x3c')]=_0x153474['outboundUnknownCallsDay'];_0x1ae92c[_0x85cb('0x3d')]=_0x153474[_0x85cb('0x3d')];_0x1ae92c[_0x85cb('0x3e')]=_0x153474[_0x85cb('0x3e')];_0x1ae92c[_0x85cb('0x3f')]=_0x153474[_0x85cb('0x3f')];_0x1ae92c[_0x85cb('0x40')]=_0x153474[_0x85cb('0x40')];_0x1ae92c[_0x85cb('0x41')]=_0x153474[_0x85cb('0x41')];_0x1ae92c[_0x85cb('0x42')]=_0x153474[_0x85cb('0x42')];_0x1ae92c[_0x85cb('0x43')]=_0x153474[_0x85cb('0x43')];_0x1ae92c[_0x85cb('0x44')]=_0x153474[_0x85cb('0x44')];_0x1ae92c[_0x85cb('0x45')]=_0x153474[_0x85cb('0x45')];_0x1ae92c[_0x85cb('0x46')]=_0x153474['predictiveIntervalPauses'];_0x1ae92c['predictiveIntervalAvailable']=_0x153474[_0x85cb('0x47')];_0x1ae92c['predictiveIntervalTotalCalls']=_0x153474[_0x85cb('0x48')];_0x1ae92c['message']=_0x153474[_0x85cb('0x16')];_0x1ae92c[_0x85cb('0x49')]=_0x153474[_0x85cb('0x49')];_0x1ae92c[_0x85cb('0x4a')]=_0x153474[_0x85cb('0x4a')];_0x1ae92c['erlangCallToSecond']=_0x153474[_0x85cb('0x4b')];_0x1ae92c[_0x85cb('0x4c')]=_0x153474['erlangAbandonmentRate'];_0x1ae92c[_0x85cb('0x4d')]=_0x153474[_0x85cb('0x4d')];_0x1ae92c[_0x85cb('0x4e')]=_0x153474[_0x85cb('0x4e')];_0x1ae92c[_0x85cb('0x4f')]=_0x153474['startProgressive'];}if(_0x153474[_0x85cb('0x50')]){_0x1ae92c[_0x85cb('0x50')]={'id':_0x153474[_0x85cb('0x50')]['id'],'name':_0x153474['Trunk'][_0x85cb('0x7')],'active':_0x153474[_0x85cb('0x50')]['active'],'callerid':_0x153474[_0x85cb('0x50')]['callerid']};}if(_0x153474[_0x85cb('0x51')]){_0x1ae92c[_0x85cb('0x51')]={'id':_0x153474['Interval']['id'],'name':_0x153474['Interval'][_0x85cb('0x7')]};}_0x16030f[_0x85cb('0x52')](_0x1ae92c);}}_0x42a188({'count':_0x16030f[_0x85cb('0x53')],'rows':_0x16030f});});},'VoiceChannels':function(_0x5e8a4f){return new Promise(function(_0x263c34,_0x1e3950){var _0x456566=_[_0x85cb('0x54')](_0x4c581a[_0x85cb('0x55')]);_0x263c34({'count':_0x456566[_0x85cb('0x53')],'rows':_0x456566});});},'VoiceChannelMixMonitor':function(_0x1f07fa){var _0x4b527d=this;return new Promise(function(_0x186034,_0x4d544d){if(ami['isConnected']()==![]){return _0x4d544d(_0x4b527d[_0x85cb('0x18')](0x1f4,[config[_0x85cb('0xd')]['ip'],config[_0x85cb('0xd')][_0x85cb('0xe')],_0x85cb('0xf')][_0x85cb('0x19')]('\x20')));}var _0x19175b=schema(properties[_0x85cb('0x56')])['validate'](_0x1f07fa);if(_0x19175b['length']>0x0){return _0x4d544d(_0x4b527d[_0x85cb('0x18')](0x1f4,_[_0x85cb('0x57')](_0x19175b,'message')[_0x85cb('0x19')](',\x20')));}var _0x405951=_[_0x85cb('0x58')](_0x4c581a[_0x85cb('0x55')],{'uniqueid':_0x1f07fa['uniqueid']});if(_0x405951&&_0x405951[_0x85cb('0x59')]){var _0x361369=util[_0x85cb('0x5a')](_0x85cb('0x5b'),_0x1f07fa[_0x85cb('0x5c')]||_0x1f07fa[_0x85cb('0x5d')],_0x1f07fa[_0x85cb('0x5a')]||_0x85cb('0x5e'));return ami['Action']({'action':'MixMonitor','channel':_0x405951[_0x85cb('0x59')],'file':_0x361369,'options':_0x85cb('0x5f')})['then'](function(_0x449ac2){var _0x53013b=_['find'](_0x405951['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x361369[_0x85cb('0x60')]()});if(_[_0x85cb('0x61')](_0x53013b)){_0x405951['monitors']['push']({'filename':_0x85cb('0x62')+_0x361369[_0x85cb('0x60')](),'createdAt':moment()[_0x85cb('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x449ac2[_0x85cb('0x63')],'status':_0x85cb('0x64')});}else{_0x53013b[_0x85cb('0x63')]=_0x449ac2[_0x85cb('0x63')];_0x53013b[_0x85cb('0x65')]=_0x85cb('0x64');}_0x186034({'code':0xc8,'message':[_0x1f07fa[_0x85cb('0x5d')],_0x85cb('0x66'),_0x449ac2[_0x85cb('0x63')]]['join']('\x20'),'mixmonitorid':_0x449ac2[_0x85cb('0x63')]});})[_0x85cb('0x17')](function(_0x118b68){_0x4d544d(_0x4b527d['error'](0x1f5,[_0x1f07fa['uniqueid'],_0x118b68[_0x85cb('0x16')][_0x85cb('0x60')]()][_0x85cb('0x19')]('\x20')));});}else{return _0x4d544d(_0x4b527d[_0x85cb('0x18')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x21de92){var _0x563df3=this;return new Promise(function(_0x348390,_0x1d7581){if(ami[_0x85cb('0xc')]()==![]){return _0x1d7581(_0x563df3[_0x85cb('0x18')](0x1f4,[config[_0x85cb('0xd')]['ip'],config[_0x85cb('0xd')]['username'],_0x85cb('0xf')][_0x85cb('0x19')]('\x20')));}var _0x58067b=schema(properties['voicechannel'])[_0x85cb('0x67')](_0x21de92);if(_0x58067b[_0x85cb('0x53')]>0x0){return _0x1d7581(_0x563df3[_0x85cb('0x18')](0x1f4,_['map'](_0x58067b,_0x85cb('0x16'))[_0x85cb('0x19')](',\x20')));}var _0x3ee8fd=_['find'](_0x4c581a[_0x85cb('0x55')],{'uniqueid':_0x21de92[_0x85cb('0x5d')]});if(_0x3ee8fd){return BPromise['resolve']()['then'](function(){if(_0x3ee8fd['channel']){return ami['Action']({'action':'StopMixMonitor','channel':_0x3ee8fd[_0x85cb('0x59')],'mixmonitorid':_0x21de92['mixmonitorid']})['catch'](function(_0x59f4c4){});}})[_0x85cb('0x15')](function(){if(_0x3ee8fd[_0x85cb('0x68')]){return ami['Action']({'action':_0x85cb('0x69'),'channel':_0x3ee8fd[_0x85cb('0x68')],'mixmonitorid':_0x21de92['mixmonitorid']})[_0x85cb('0x17')](function(_0x1e74d3){});}})[_0x85cb('0x15')](function(_0x130f34){var _0x3b92eb=_[_0x85cb('0x58')](_0x3ee8fd[_0x85cb('0x6a')],{'mixmonitorid':_0x21de92['mixmonitorid']});if(_0x3b92eb){_0x3b92eb[_0x85cb('0x65')]=_0x85cb('0x6b');}})[_0x85cb('0x15')](function(){var _0x213c1a=util[_0x85cb('0x5a')]('%s.%s',_0x21de92[_0x85cb('0x5c')]||_0x21de92[_0x85cb('0x5d')],_0x21de92[_0x85cb('0x5a')]||'wav');var _0x121cc2=_['find'](_0x3ee8fd['monitors'],{'filename':_0x85cb('0x62')+_0x213c1a[_0x85cb('0x60')]()});if(_0x121cc2){_0x121cc2[_0x85cb('0x65')]=_0x85cb('0x6b');}})[_0x85cb('0x15')](function(){_0x348390({'code':0xc8,'message':[_0x21de92[_0x85cb('0x5d')],_0x85cb('0x6c')][_0x85cb('0x19')]('\x20')});})[_0x85cb('0x17')](function(_0x1a5cfd){_0x1d7581(_0x563df3[_0x85cb('0x18')](0x1f5,[_0x21de92[_0x85cb('0x5d')],_0x1a5cfd[_0x85cb('0x16')][_0x85cb('0x60')]()][_0x85cb('0x19')]('\x20')));});}else{return _0x1d7581(_0x563df3[_0x85cb('0x18')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x5720da){return new Promise(function(_0x250208,_0x5eaf9a){var _0x3fa01a=_[_0x85cb('0x54')](_0x4c581a[_0x85cb('0x6d')]);_0x250208({'count':_0x3fa01a['length'],'rows':_0x3fa01a});});},'VoiceQueuesChannel':function(_0x1be30a){var _0x5cf04d=this;return new Promise(function(_0x95f0f3,_0x6946c2){var _0x409466=schema(properties[_0x85cb('0x6e')])[_0x85cb('0x67')](_0x1be30a);if(_0x409466[_0x85cb('0x53')]>0x0){return _0x6946c2(_0x5cf04d['error'](0x1f4,_[_0x85cb('0x57')](_0x409466,_0x85cb('0x16'))['join'](',\x20')));}var _0xc0c99e=_['find'](_0x4c581a[_0x85cb('0x6d')],{'uniqueid':_0x1be30a[_0x85cb('0x5d')]});if(_0xc0c99e){_0x95f0f3(_0xc0c99e);}else{return _0x6946c2(_0x5cf04d['error'](0x1f5,_0x85cb('0x6f')));}});},'VoiceQueuesChannelHangup':function(_0x9e0ed){var _0x355b9d=this;return new Promise(function(_0x278e42,_0x26dd5f){if(ami[_0x85cb('0xc')]()==![]){return _0x26dd5f(_0x355b9d['error'](0x1f4,[config[_0x85cb('0xd')]['ip'],config[_0x85cb('0xd')][_0x85cb('0xe')],_0x85cb('0xf')][_0x85cb('0x19')]('\x20')));}var _0x4399e8=schema(properties[_0x85cb('0x70')])[_0x85cb('0x67')](_0x9e0ed);if(_0x4399e8[_0x85cb('0x53')]>0x0){return _0x26dd5f(_0x355b9d[_0x85cb('0x18')](0x1f4,_[_0x85cb('0x57')](_0x4399e8,_0x85cb('0x16'))[_0x85cb('0x19')](',\x20')));}var _0x3e4fb6=_[_0x85cb('0x58')](_0x4c581a[_0x85cb('0x6d')],{'uniqueid':_0x9e0ed[_0x85cb('0x5d')]});if(_0x3e4fb6&&_0x3e4fb6[_0x85cb('0x59')]){return ami[_0x85cb('0x14')]({'action':_0x85cb('0x71'),'channel':_0x3e4fb6['channel']})[_0x85cb('0x15')](function(_0x55d2cc){_0x278e42({'code':0xc8,'message':[_0x9e0ed['uniqueid'],_0x55d2cc['message']['toLowerCase']()]['join']('\x20')});})[_0x85cb('0x17')](function(_0x463fa5){_0x26dd5f(_0x355b9d[_0x85cb('0x18')](0x1f5,[_0x9e0ed[_0x85cb('0x5d')],_0x463fa5[_0x85cb('0x16')][_0x85cb('0x60')]()]['join']('\x20')));});}else{return _0x26dd5f(_0x355b9d[_0x85cb('0x18')](0x1f5,_0x85cb('0x6f')));}});},'VoiceQueuesChannelRedirect':function(_0x1aa9c8){var _0x3e806a=this;return new Promise(function(_0x27cc77,_0x54ec33){if(ami[_0x85cb('0xc')]()==![]){return _0x54ec33(_0x3e806a[_0x85cb('0x18')](0x1f4,[config[_0x85cb('0xd')]['ip'],config[_0x85cb('0xd')]['username'],_0x85cb('0xf')][_0x85cb('0x19')]('\x20')));}var _0x5d0196=schema(properties[_0x85cb('0x72')])[_0x85cb('0x67')](_0x1aa9c8);if(_0x5d0196[_0x85cb('0x53')]>0x0){return _0x54ec33(_0x3e806a[_0x85cb('0x18')](0x1f4,_['map'](_0x5d0196,_0x85cb('0x16'))[_0x85cb('0x19')](',\x20')));}var _0x2c1b87=_[_0x85cb('0x58')](_0x4c581a[_0x85cb('0x6d')],{'uniqueid':_0x1aa9c8['uniqueid']});if(_0x2c1b87&&_0x2c1b87[_0x85cb('0x59')]){return ami[_0x85cb('0x14')]({'action':'Redirect','channel':_0x2c1b87[_0x85cb('0x59')],'exten':_0x1aa9c8[_0x85cb('0x73')],'context':_0x1aa9c8[_0x85cb('0x74')]||_0x2c1b87[_0x85cb('0x74')],'priority':0x1})['then'](function(_0x108355){_0x27cc77({'code':0xc8,'message':[_0x1aa9c8[_0x85cb('0x5d')],_0x108355[_0x85cb('0x16')][_0x85cb('0x60')]()]['join']('\x20')});})[_0x85cb('0x17')](function(_0x4cff79){_0x54ec33(_0x3e806a[_0x85cb('0x18')](0x1f5,[_0x1aa9c8['uniqueid'],_0x4cff79[_0x85cb('0x16')][_0x85cb('0x60')]()]['join']('\x20')));});}else{return _0x54ec33(_0x3e806a[_0x85cb('0x18')](0x1f5,_0x85cb('0x6f')));}});},'Agents':function(_0x58e085){return new Promise(function(_0x32a5be,_0x218abe){var _0xa00c3b=_['values'](_0x4c581a['agents']);_0x32a5be({'count':_0xa00c3b[_0x85cb('0x53')],'rows':_0xa00c3b});});},'Telephones':function(_0xc0bdbb){return new Promise(function(_0xdf7e93,_0x219847){var _0x37dbce=_[_0x85cb('0x54')](_0x4c581a[_0x85cb('0x75')]);_0xdf7e93({'count':_0x37dbce[_0x85cb('0x53')],'rows':_0x37dbce});});},'Trunks':function(_0x2fc38f){return new Promise(function(_0x4b85f4,_0x3669c8){var _0x35f388=_[_0x85cb('0x54')](_0x4c581a['trunks']);_0x4b85f4({'count':_0x35f388[_0x85cb('0x53')],'rows':_0x35f388});});},'OutboundChannels':function(_0x93eb98){return new Promise(function(_0x3d169d,_0x513810){var _0x2cd5f3=_[_0x85cb('0x54')](_0x4c581a[_0x85cb('0x76')]);_0x3d169d({'count':_0x2cd5f3[_0x85cb('0x53')],'rows':_0x2cd5f3});});},'Outbound':function(_0x454b52){return new Promise(function(_0xe35081,_0x29ccc3){_0xe35081(_0x4c581a[_0x85cb('0x2a')]);});},'Campaigns':function(_0x4d74ac){return new Promise(function(_0x544f25,_0x5ec018){var _0x26f278=_[_0x85cb('0x54')](_0x4c581a[_0x85cb('0x77')]);_0x544f25({'count':_0x26f278[_0x85cb('0x53')],'rows':_0x26f278});});},'VoiceQueuesPreview':function(_0x2041d4){var _0x36d8f6=this;return new Promise(function(_0x48512c,_0x4b5f3b){_0x190c73[_0x85cb('0x78')](_0x2041d4['id'])['then'](function(_0x44330c){_0x48512c({'code':0xc8,'message':_0x44330c[_0x85cb('0x16')]});})['catch'](function(_0x39839d){_0x4b5f3b(_0x36d8f6[_0x85cb('0x18')](0x1f4,_0x39839d['message']));});});},'EventManager':function(_0x1037a4){var _0x1cad5a=this;return new Promise(function(_0x38ef21,_0x8be696){if(!_0x1037a4[_0x85cb('0x79')]){return _0x8be696(_0x1cad5a[_0x85cb('0x18')](0x1f4,_0x85cb('0x7a')));}ami[_0x85cb('0x7b')](_0x85cb('0x7c')+_0x1037a4['event'],_0x1037a4[_0x85cb('0x16')]);_0x38ef21({'code':0xc8,'message':_0x1037a4});});},'FaxAccounts':function(_0x1ff3af){return new Promise(function(_0x38449b,_0x4699e9){var _0x427d85=_['values'](_0x4c581a['faxAccounts']);_0x38449b({'count':_0x427d85[_0x85cb('0x53')],'rows':_0x427d85});});},'SendFax':function(_0x5e3c53){var _0x35dca8=this;return new Promise(function(_0x322d1b,_0x36fec4){_0x3bdc83[_0x85cb('0x7d')](_0x5e3c53)['then'](function(_0x38fab3){_0x322d1b({'code':0xc8,'message':_0x38fab3[_0x85cb('0x16')]});})[_0x85cb('0x17')](function(_0x49bcf6){_0x36fec4(_0x35dca8[_0x85cb('0x18')](0x1f4,_0x49bcf6[_0x85cb('0x16')]));});});},'CheckAfterSend':function(_0x1526a3){var _0x44e33a=this;return new Promise(function(_0x414a02,_0x2de647){_0x3bdc83[_0x85cb('0x7e')](_0x1526a3)[_0x85cb('0x15')](function(_0x276eda){_0x414a02({'code':0xc8,'message':_0x276eda['message']});})['catch'](function(_0x3de654){_0x2de647(_0x44e33a[_0x85cb('0x18')](0x1f4,_0x3de654[_0x85cb('0x16')]));});});}};var _0x102369=jayson[_0x85cb('0x7f')](_0x3d7826)[_0x85cb('0x80')]();_0x102369['on'](_0x85cb('0x18'),function(_0x49a119){return _0x24fcc3(_0x49a119);});_0x102369['listen'](0x232a,_0x85cb('0x81'),function(){console[_0x85cb('0x82')](_0x85cb('0x83'),0x232a);return _0x1f8ee3(_0x85cb('0x84')+0x232a);});});}; \ No newline at end of file +var _0x284d=['startProgressive','Trunk','active','callerid','Interval','push','values','channels','length','voicechannel','map','find','uniqueid','channel','%s.%s','filename','wav','Action','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','format','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','StopMixMonitor','stop','StopMixMonitor\x20Success','voicequeuechannel','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','outbound','event','send','server','http','127.0.0.1','util','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','pick','module','Reload','then','message','catch','ami\x20disconnected','join','command','action','Command','content','voiceQueues','hasOwnProperty','strategy','answered','loggedIn','sumBillable','sumDuration','talking','type','unmanaged','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive'];(function(_0x1e394e,_0x52e8e8){var _0x5229a3=function(_0x69d328){while(--_0x69d328){_0x1e394e['push'](_0x1e394e['shift']());}};_0x5229a3(++_0x52e8e8);}(_0x284d,0x1c7));var _0xd284=function(_0x2a8674,_0x313563){_0x2a8674=_0x2a8674-0x0;var _0x35aaff=_0x284d[_0x2a8674];return _0x35aaff;};'use strict';var _=require('lodash');var util=require(_0xd284('0x0'));var jayson=require('jayson/promise');var schema=require(_0xd284('0x1'));var BPromise=require(_0xd284('0x2'));var moment=require(_0xd284('0x3'));var config=require(_0xd284('0x4'));var properties=require(_0xd284('0x5'));var ami=require(_0xd284('0x6'));exports[_0xd284('0x7')]=function(_0x4661b4,_0x40d26b,_0xb35ada){return new BPromise(function(_0x5419bd,_0x7af5a2){var _0x4db442={'QueuePause':function(_0x5eae3a){return new Promise(function(_0x18e3e3,_0x34e8d1){var _0xf46213=util['format']('%s/%s',_0xd284('0x8'),_0x5eae3a[_0xd284('0x9')]);if(_0x4661b4[_0xd284('0xa')]&&_0x4661b4['timers'][_0xf46213]&&_0x4661b4[_0xd284('0xa')][_0xf46213][_0xd284('0xb')]){_0x4661b4['timers'][_0xf46213][_0xd284('0xc')]();}if(_0x4661b4[_0xd284('0xd')][_0xf46213]){_0x4661b4['agents'][_0xf46213][_0xd284('0xe')]({'statePause':_0x5eae3a[_0xd284('0xf')]?!![]:![]});}_0x18e3e3({'code':0xc8,'message':_0xd284('0x10')});});},'Reload':function(_0x4844ae){var _0x54cbb5=this;return new Promise(function(_0x2a2acd,_0x2bdd44){if(ami[_0xd284('0x11')]()==![]){return _0x2bdd44(_0x54cbb5[_0xd284('0x12')](0x1f4,[config['asterisk']['ip'],config[_0xd284('0x13')][_0xd284('0x14')],'ami\x20disconnected']['join']('\x20')));}_0x4844ae=_[_0xd284('0x15')](_0x4844ae,_['keys'](properties[_0xd284('0x16')]));_0x4844ae['action']=_0xd284('0x17');return ami['Action'](_0x4844ae)[_0xd284('0x18')](function(_0x56a98c){_0x2a2acd({'code':0xc8,'message':_0x56a98c[_0xd284('0x19')]});})[_0xd284('0x1a')](function(_0x5c120b){_0x2bdd44(_0x54cbb5[_0xd284('0x12')](0x1f5,_0x5c120b[_0xd284('0x19')]));});});},'Command':function(_0x1114f0){var _0x5880e4=this;return new Promise(function(_0x5e7bcb,_0x139543){if(ami[_0xd284('0x11')]()==![]){return _0x139543(_0x5880e4[_0xd284('0x12')](0x1f4,[config[_0xd284('0x13')]['ip'],config[_0xd284('0x13')][_0xd284('0x14')],_0xd284('0x1b')][_0xd284('0x1c')]('\x20')));}_0x1114f0=_['pick'](_0x1114f0,_0xd284('0x1d'));_0x1114f0[_0xd284('0x1e')]=_0xd284('0x1f');return ami['Action'](_0x1114f0)[_0xd284('0x18')](function(_0x5255a6){_0x5e7bcb({'code':0xc8,'message':_0x5255a6[_0xd284('0x20')]});})[_0xd284('0x1a')](function(_0x9af358){_0x139543(_0x5880e4[_0xd284('0x12')](0x1f5,_0x9af358[_0xd284('0x19')]));});});},'VoiceQueues':function(_0x6ec391){return new Promise(function(_0xaeb08c,_0x58dcad){var _0x3a769c=[];for(var _0x55f05f in _0x4661b4['voiceQueues']){if(_0x4661b4[_0xd284('0x21')][_0xd284('0x22')](_0x55f05f)){var _0x1b92d6=_0x4661b4[_0xd284('0x21')][_0x55f05f];var _0x2f0b78={'id':_0x1b92d6['id'],'name':_0x1b92d6[_0xd284('0x9')],'strategy':_0x1b92d6[_0xd284('0x23')],'answered':_0x1b92d6[_0xd284('0x24')],'available':_0x1b92d6['available'],'loggedIn':_0x1b92d6[_0xd284('0x25')],'pTalking':_0x1b92d6['pTalking'],'sumBillable':_0x1b92d6[_0xd284('0x26')],'sumDuration':_0x1b92d6[_0xd284('0x27')],'sumHoldTime':_0x1b92d6['sumHoldTime']||0x0,'talking':_0x1b92d6[_0xd284('0x28')],'total':_0x1b92d6['total'],'type':_0x1b92d6[_0xd284('0x29')],'unmanaged':_0x1b92d6[_0xd284('0x2a')],'abandoned':_0x1b92d6['abandoned'],'waiting':_0x1b92d6['waiting'],'loggedInDb':_0x1b92d6[_0xd284('0x2b')]};if(_0x1b92d6['type']==='outbound'){_0x2f0b78[_0xd284('0x2c')]=_0x1b92d6[_0xd284('0x2c')];_0x2f0b78[_0xd284('0x2d')]=_0x1b92d6[_0xd284('0x2d')];_0x2f0b78[_0xd284('0x2e')]=_0x1b92d6[_0xd284('0x2e')];_0x2f0b78[_0xd284('0x2f')]=_0x1b92d6[_0xd284('0x2f')];_0x2f0b78[_0xd284('0x30')]=_0x1b92d6[_0xd284('0x30')];_0x2f0b78['dialPrefix']=_0x1b92d6[_0xd284('0x31')];_0x2f0b78[_0xd284('0x32')]=_0x1b92d6['outboundAnswerAgiCallsDay'];_0x2f0b78[_0xd284('0x33')]=_0x1b92d6[_0xd284('0x33')];_0x2f0b78[_0xd284('0x34')]=_0x1b92d6['outboundBlacklistCallsDay'];_0x2f0b78['outboundBusyCallsDay']=_0x1b92d6['outboundBusyCallsDay'];_0x2f0b78[_0xd284('0x35')]=_0x1b92d6['outboundCongestionCallsDay'];_0x2f0b78[_0xd284('0x36')]=_0x1b92d6['outboundDropCallsDayACS'];_0x2f0b78[_0xd284('0x37')]=_0x1b92d6['outboundDropCallsDayCallersExit'];_0x2f0b78[_0xd284('0x38')]=_0x1b92d6[_0xd284('0x38')];_0x2f0b78[_0xd284('0x39')]=_0x1b92d6[_0xd284('0x39')];_0x2f0b78['outboundNoSuchCallsDay']=_0x1b92d6[_0xd284('0x3a')];_0x2f0b78[_0xd284('0x3b')]=_0x1b92d6[_0xd284('0x3b')];_0x2f0b78[_0xd284('0x3c')]=_0x1b92d6[_0xd284('0x3c')];_0x2f0b78[_0xd284('0x3d')]=_0x1b92d6[_0xd284('0x3d')];_0x2f0b78[_0xd284('0x3e')]=_0x1b92d6[_0xd284('0x3e')];_0x2f0b78[_0xd284('0x3f')]=_0x1b92d6[_0xd284('0x3f')];_0x2f0b78['predictiveIntervalAvgHoldtime']=_0x1b92d6[_0xd284('0x40')];_0x2f0b78[_0xd284('0x41')]=_0x1b92d6['predictiveIntervalAvgTalktime'];_0x2f0b78[_0xd284('0x42')]=_0x1b92d6[_0xd284('0x42')];_0x2f0b78[_0xd284('0x43')]=_0x1b92d6[_0xd284('0x43')];_0x2f0b78[_0xd284('0x44')]=_0x1b92d6[_0xd284('0x44')];_0x2f0b78[_0xd284('0x45')]=_0x1b92d6[_0xd284('0x45')];_0x2f0b78['predictiveIntervalHitRate']=_0x1b92d6[_0xd284('0x46')];_0x2f0b78[_0xd284('0x47')]=_0x1b92d6[_0xd284('0x47')];_0x2f0b78['predictiveIntervalPauses']=_0x1b92d6[_0xd284('0x48')];_0x2f0b78[_0xd284('0x49')]=_0x1b92d6[_0xd284('0x49')];_0x2f0b78[_0xd284('0x4a')]=_0x1b92d6['predictiveIntervalTotalCalls'];_0x2f0b78[_0xd284('0x19')]=_0x1b92d6[_0xd284('0x19')];_0x2f0b78[_0xd284('0x4b')]=_0x1b92d6[_0xd284('0x4b')];_0x2f0b78['erlangCalls']=_0x1b92d6[_0xd284('0x4c')];_0x2f0b78[_0xd284('0x4d')]=_0x1b92d6[_0xd284('0x4d')];_0x2f0b78[_0xd284('0x4e')]=_0x1b92d6[_0xd284('0x4e')];_0x2f0b78[_0xd284('0x4f')]=_0x1b92d6[_0xd284('0x4f')];_0x2f0b78[_0xd284('0x50')]=_0x1b92d6['startPredictive'];_0x2f0b78[_0xd284('0x51')]=_0x1b92d6[_0xd284('0x51')];}if(_0x1b92d6[_0xd284('0x52')]){_0x2f0b78[_0xd284('0x52')]={'id':_0x1b92d6[_0xd284('0x52')]['id'],'name':_0x1b92d6[_0xd284('0x52')]['name'],'active':_0x1b92d6[_0xd284('0x52')][_0xd284('0x53')],'callerid':_0x1b92d6['Trunk'][_0xd284('0x54')]};}if(_0x1b92d6[_0xd284('0x55')]){_0x2f0b78[_0xd284('0x55')]={'id':_0x1b92d6[_0xd284('0x55')]['id'],'name':_0x1b92d6[_0xd284('0x55')][_0xd284('0x9')]};}_0x3a769c[_0xd284('0x56')](_0x2f0b78);}}_0xaeb08c({'count':_0x3a769c['length'],'rows':_0x3a769c});});},'VoiceChannels':function(_0x44a07e){return new Promise(function(_0x2e5e3a,_0x510dbf){var _0x18d484=_[_0xd284('0x57')](_0x4661b4[_0xd284('0x58')]);_0x2e5e3a({'count':_0x18d484[_0xd284('0x59')],'rows':_0x18d484});});},'VoiceChannelMixMonitor':function(_0x3c1141){var _0x2179a0=this;return new Promise(function(_0x4db789,_0x1d5d80){if(ami[_0xd284('0x11')]()==![]){return _0x1d5d80(_0x2179a0[_0xd284('0x12')](0x1f4,[config[_0xd284('0x13')]['ip'],config[_0xd284('0x13')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x3c242e=schema(properties[_0xd284('0x5a')])[_0xd284('0x1')](_0x3c1141);if(_0x3c242e[_0xd284('0x59')]>0x0){return _0x1d5d80(_0x2179a0[_0xd284('0x12')](0x1f4,_[_0xd284('0x5b')](_0x3c242e,_0xd284('0x19'))[_0xd284('0x1c')](',\x20')));}var _0x1ccd52=_[_0xd284('0x5c')](_0x4661b4[_0xd284('0x58')],{'uniqueid':_0x3c1141[_0xd284('0x5d')]});if(_0x1ccd52&&_0x1ccd52[_0xd284('0x5e')]){var _0x1526c8=util['format'](_0xd284('0x5f'),_0x3c1141[_0xd284('0x60')]||_0x3c1141[_0xd284('0x5d')],_0x3c1141['format']||_0xd284('0x61'));return ami[_0xd284('0x62')]({'action':_0xd284('0x63'),'channel':_0x1ccd52[_0xd284('0x5e')],'file':_0x1526c8,'options':_0xd284('0x64')})[_0xd284('0x18')](function(_0x23b650){var _0x97bd83=_[_0xd284('0x5c')](_0x1ccd52[_0xd284('0x65')],{'filename':_0xd284('0x66')+_0x1526c8[_0xd284('0x67')]()});if(_[_0xd284('0x68')](_0x97bd83)){_0x1ccd52['monitors'][_0xd284('0x56')]({'filename':'/var/spool/asterisk/monitor/'+_0x1526c8['toLowerCase'](),'createdAt':moment()[_0xd284('0x69')](_0xd284('0x6a')),'mixmonitorid':_0x23b650[_0xd284('0x6b')],'status':_0xd284('0x6c')});}else{_0x97bd83[_0xd284('0x6b')]=_0x23b650[_0xd284('0x6b')];_0x97bd83[_0xd284('0x6d')]=_0xd284('0x6c');}_0x4db789({'code':0xc8,'message':[_0x3c1141[_0xd284('0x5d')],_0xd284('0x6e'),_0x23b650['mixmonitorid']][_0xd284('0x1c')]('\x20'),'mixmonitorid':_0x23b650[_0xd284('0x6b')]});})[_0xd284('0x1a')](function(_0x2c1187){_0x1d5d80(_0x2179a0[_0xd284('0x12')](0x1f5,[_0x3c1141[_0xd284('0x5d')],_0x2c1187['message']['toLowerCase']()][_0xd284('0x1c')]('\x20')));});}else{return _0x1d5d80(_0x2179a0[_0xd284('0x12')](0x1f5,_0xd284('0x6f')));}});},'VoiceChannelStopMixMonitor':function(_0x4086d8){var _0x5d51fa=this;return new Promise(function(_0x1cb50c,_0x2b57a6){if(ami[_0xd284('0x11')]()==![]){return _0x2b57a6(_0x5d51fa[_0xd284('0x12')](0x1f4,[config[_0xd284('0x13')]['ip'],config[_0xd284('0x13')]['username'],_0xd284('0x1b')][_0xd284('0x1c')]('\x20')));}var _0x489c=schema(properties[_0xd284('0x5a')])[_0xd284('0x1')](_0x4086d8);if(_0x489c[_0xd284('0x59')]>0x0){return _0x2b57a6(_0x5d51fa['error'](0x1f4,_[_0xd284('0x5b')](_0x489c,_0xd284('0x19'))[_0xd284('0x1c')](',\x20')));}var _0x373a7f=_['find'](_0x4661b4[_0xd284('0x58')],{'uniqueid':_0x4086d8['uniqueid']});if(_0x373a7f){return BPromise[_0xd284('0x70')]()[_0xd284('0x18')](function(){if(_0x373a7f[_0xd284('0x5e')]){return ami['Action']({'action':'StopMixMonitor','channel':_0x373a7f[_0xd284('0x5e')],'mixmonitorid':_0x4086d8['mixmonitorid']})['catch'](function(_0x174214){});}})['then'](function(){if(_0x373a7f[_0xd284('0x71')]){return ami[_0xd284('0x62')]({'action':_0xd284('0x72'),'channel':_0x373a7f[_0xd284('0x71')],'mixmonitorid':_0x4086d8[_0xd284('0x6b')]})[_0xd284('0x1a')](function(_0x4108e5){});}})['then'](function(_0x4d675d){var _0xba93ee=_[_0xd284('0x5c')](_0x373a7f[_0xd284('0x65')],{'mixmonitorid':_0x4086d8[_0xd284('0x6b')]});if(_0xba93ee){_0xba93ee[_0xd284('0x6d')]=_0xd284('0x73');}})[_0xd284('0x18')](function(){var _0x15590a=util[_0xd284('0x69')](_0xd284('0x5f'),_0x4086d8[_0xd284('0x60')]||_0x4086d8[_0xd284('0x5d')],_0x4086d8['format']||_0xd284('0x61'));var _0x2cf856=_[_0xd284('0x5c')](_0x373a7f[_0xd284('0x65')],{'filename':_0xd284('0x66')+_0x15590a[_0xd284('0x67')]()});if(_0x2cf856){_0x2cf856[_0xd284('0x6d')]='stop';}})['then'](function(){_0x1cb50c({'code':0xc8,'message':[_0x4086d8[_0xd284('0x5d')],_0xd284('0x74')][_0xd284('0x1c')]('\x20')});})[_0xd284('0x1a')](function(_0x2d6367){_0x2b57a6(_0x5d51fa[_0xd284('0x12')](0x1f5,[_0x4086d8['uniqueid'],_0x2d6367['message'][_0xd284('0x67')]()]['join']('\x20')));});}else{return _0x2b57a6(_0x5d51fa[_0xd284('0x12')](0x1f5,_0xd284('0x6f')));}});},'VoiceQueuesChannels':function(_0xbf7b45){return new Promise(function(_0x5ad27c,_0x334250){var _0x29a889=_['values'](_0x4661b4['queueChannels']);_0x5ad27c({'count':_0x29a889['length'],'rows':_0x29a889});});},'VoiceQueuesChannel':function(_0x4e919a){var _0x4ac31c=this;return new Promise(function(_0x47b39c,_0xecf141){var _0x58b3f2=schema(properties[_0xd284('0x75')])[_0xd284('0x1')](_0x4e919a);if(_0x58b3f2[_0xd284('0x59')]>0x0){return _0xecf141(_0x4ac31c[_0xd284('0x12')](0x1f4,_[_0xd284('0x5b')](_0x58b3f2,_0xd284('0x19'))[_0xd284('0x1c')](',\x20')));}var _0x231322=_[_0xd284('0x5c')](_0x4661b4[_0xd284('0x76')],{'uniqueid':_0x4e919a['uniqueid']});if(_0x231322){_0x47b39c(_0x231322);}else{return _0xecf141(_0x4ac31c[_0xd284('0x12')](0x1f5,_0xd284('0x6f')));}});},'VoiceQueuesChannelHangup':function(_0x115d59){var _0x44dd69=this;return new Promise(function(_0xbda429,_0x2bdda7){if(ami[_0xd284('0x11')]()==![]){return _0x2bdda7(_0x44dd69[_0xd284('0x12')](0x1f4,[config[_0xd284('0x13')]['ip'],config[_0xd284('0x13')][_0xd284('0x14')],_0xd284('0x1b')][_0xd284('0x1c')]('\x20')));}var _0x21392d=schema(properties[_0xd284('0x77')])[_0xd284('0x1')](_0x115d59);if(_0x21392d[_0xd284('0x59')]>0x0){return _0x2bdda7(_0x44dd69[_0xd284('0x12')](0x1f4,_[_0xd284('0x5b')](_0x21392d,'message')[_0xd284('0x1c')](',\x20')));}var _0x26e5af=_['find'](_0x4661b4[_0xd284('0x76')],{'uniqueid':_0x115d59[_0xd284('0x5d')]});if(_0x26e5af&&_0x26e5af[_0xd284('0x5e')]){return ami[_0xd284('0x62')]({'action':_0xd284('0x78'),'channel':_0x26e5af[_0xd284('0x5e')]})[_0xd284('0x18')](function(_0x201ea2){_0xbda429({'code':0xc8,'message':[_0x115d59[_0xd284('0x5d')],_0x201ea2[_0xd284('0x19')][_0xd284('0x67')]()][_0xd284('0x1c')]('\x20')});})[_0xd284('0x1a')](function(_0x38924f){_0x2bdda7(_0x44dd69[_0xd284('0x12')](0x1f5,[_0x115d59[_0xd284('0x5d')],_0x38924f[_0xd284('0x19')][_0xd284('0x67')]()][_0xd284('0x1c')]('\x20')));});}else{return _0x2bdda7(_0x44dd69[_0xd284('0x12')](0x1f5,_0xd284('0x6f')));}});},'VoiceQueuesChannelRedirect':function(_0x865b33){var _0x407a40=this;return new Promise(function(_0x18d427,_0x450133){if(ami[_0xd284('0x11')]()==![]){return _0x450133(_0x407a40[_0xd284('0x12')](0x1f4,[config['asterisk']['ip'],config[_0xd284('0x13')]['username'],_0xd284('0x1b')][_0xd284('0x1c')]('\x20')));}var _0x27fa5f=schema(properties[_0xd284('0x79')])[_0xd284('0x1')](_0x865b33);if(_0x27fa5f[_0xd284('0x59')]>0x0){return _0x450133(_0x407a40[_0xd284('0x12')](0x1f4,_[_0xd284('0x5b')](_0x27fa5f,_0xd284('0x19'))[_0xd284('0x1c')](',\x20')));}var _0x714c3b=_[_0xd284('0x5c')](_0x4661b4[_0xd284('0x76')],{'uniqueid':_0x865b33[_0xd284('0x5d')]});if(_0x714c3b&&_0x714c3b[_0xd284('0x5e')]){return ami['Action']({'action':_0xd284('0x7a'),'channel':_0x714c3b['channel'],'exten':_0x865b33[_0xd284('0x7b')],'context':_0x865b33[_0xd284('0x7c')]||_0x714c3b[_0xd284('0x7c')],'priority':0x1})['then'](function(_0x4a3df4){_0x18d427({'code':0xc8,'message':[_0x865b33[_0xd284('0x5d')],_0x4a3df4[_0xd284('0x19')][_0xd284('0x67')]()][_0xd284('0x1c')]('\x20')});})['catch'](function(_0x1e4a0f){_0x450133(_0x407a40[_0xd284('0x12')](0x1f5,[_0x865b33['uniqueid'],_0x1e4a0f[_0xd284('0x19')]['toLowerCase']()][_0xd284('0x1c')]('\x20')));});}else{return _0x450133(_0x407a40[_0xd284('0x12')](0x1f5,_0xd284('0x6f')));}});},'Agents':function(_0x50805e){return new Promise(function(_0x33d973,_0x38d8b5){var _0x547d93=_['values'](_0x4661b4[_0xd284('0xd')]);_0x33d973({'count':_0x547d93[_0xd284('0x59')],'rows':_0x547d93});});},'Telephones':function(_0x4c7ed5){return new Promise(function(_0x58b2a1,_0x481179){var _0x26500a=_[_0xd284('0x57')](_0x4661b4[_0xd284('0x7d')]);_0x58b2a1({'count':_0x26500a[_0xd284('0x59')],'rows':_0x26500a});});},'Trunks':function(_0x283090){return new Promise(function(_0x9413f6,_0x477b91){var _0x2bf95a=_[_0xd284('0x57')](_0x4661b4[_0xd284('0x7e')]);_0x9413f6({'count':_0x2bf95a[_0xd284('0x59')],'rows':_0x2bf95a});});},'OutboundChannels':function(_0x54d68b){return new Promise(function(_0x53e8f0,_0x383c1b){var _0x40e6c6=_[_0xd284('0x57')](_0x4661b4[_0xd284('0x7f')]);_0x53e8f0({'count':_0x40e6c6[_0xd284('0x59')],'rows':_0x40e6c6});});},'Outbound':function(_0x2894d4){return new Promise(function(_0x408f22,_0x8037e0){_0x408f22(_0x4661b4[_0xd284('0x80')]);});},'Campaigns':function(_0x1a6172){return new Promise(function(_0x579390,_0x606430){var _0x23deb0=_['values'](_0x4661b4['campaigns']);_0x579390({'count':_0x23deb0[_0xd284('0x59')],'rows':_0x23deb0});});},'VoiceQueuesPreview':function(_0x3920dc){var _0x233553=this;return new Promise(function(_0x1f313e,_0x5ae36e){_0x40d26b['run'](_0x3920dc['id'])[_0xd284('0x18')](function(_0x56a4c8){_0x1f313e({'code':0xc8,'message':_0x56a4c8[_0xd284('0x19')]});})[_0xd284('0x1a')](function(_0x49cc75){_0x5ae36e(_0x233553[_0xd284('0x12')](0x1f4,_0x49cc75[_0xd284('0x19')]));});});},'EventManager':function(_0x2983c7){var _0x3327c8=this;return new Promise(function(_0x59945b,_0x32e865){if(!_0x2983c7['event']){return _0x32e865(_0x3327c8[_0xd284('0x12')](0x1f4,'Event\x20name\x20mandatory'));}ami['emit']('custom:'+_0x2983c7[_0xd284('0x81')],_0x2983c7['message']);_0x59945b({'code':0xc8,'message':_0x2983c7});});},'FaxAccounts':function(_0x43c4b3){return new Promise(function(_0x3fb67f,_0x134b79){var _0x447681=_[_0xd284('0x57')](_0x4661b4['faxAccounts']);_0x3fb67f({'count':_0x447681[_0xd284('0x59')],'rows':_0x447681});});},'SendFax':function(_0x2744b3){var _0x218b7e=this;return new Promise(function(_0x22e2af,_0x32f22a){_0xb35ada[_0xd284('0x82')](_0x2744b3)['then'](function(_0x1659ee){_0x22e2af({'code':0xc8,'message':_0x1659ee['message']});})[_0xd284('0x1a')](function(_0xf6583c){_0x32f22a(_0x218b7e['error'](0x1f4,_0xf6583c[_0xd284('0x19')]));});});},'CheckAfterSend':function(_0x3102f8){var _0x47bbf9=this;return new Promise(function(_0x2e3bff,_0x4df264){_0xb35ada['checkAfterSend'](_0x3102f8)[_0xd284('0x18')](function(_0x578106){_0x2e3bff({'code':0xc8,'message':_0x578106[_0xd284('0x19')]});})[_0xd284('0x1a')](function(_0x552a6d){_0x4df264(_0x47bbf9[_0xd284('0x12')](0x1f4,_0x552a6d[_0xd284('0x19')]));});});}};var _0x37815b=jayson[_0xd284('0x83')](_0x4db442)[_0xd284('0x84')]();_0x37815b['on'](_0xd284('0x12'),function(_0xe59e97){return _0x7af5a2(_0xe59e97);});_0x37815b['listen'](0x232a,_0xd284('0x85'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x5419bd('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index b9347cf..9bb2864 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 _0x4991=['catch','Error\x20creating\x20contact','bluebird','lodash','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info','stringify','emit','exec','data2','data1','calleridnum','calleridname','','destcalleridname','destcalleridnum','uniqueid','resolve','then','showContact','xmd-contactid2','user:%s','name','format','trigger:%s','action','toLowerCase','merge','createContact'];(function(_0x31ca4c,_0x38802c){var _0x423753=function(_0x55988e){while(--_0x55988e){_0x31ca4c['push'](_0x31ca4c['shift']());}};_0x423753(++_0x38802c);}(_0x4991,0xf7));var _0x1499=function(_0x402a24,_0x4f9866){_0x402a24=_0x402a24-0x0;var _0x285fcd=_0x4991[_0x402a24];return _0x285fcd;};'use strict';var BPromise=require(_0x1499('0x0'));var util=require('util');var _=require(_0x1499('0x1'));var Redis=require('ioredis');var config=require(_0x1499('0x2'));var logger=require(_0x1499('0x3'))(_0x1499('0x4'));var cmContactRpc=require(_0x1499('0x5'));config[_0x1499('0x6')]=_[_0x1499('0x7')](config[_0x1499('0x6')],{'host':_0x1499('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1499('0x6')]));function emit(_0x1c3bd7,_0x1c65c3,_0x33b261){logger[_0x1499('0x9')](_0x1c3bd7,_0x1c65c3,JSON[_0x1499('0xa')](_0x33b261));io['to'](_0x1c3bd7)[_0x1499('0xb')](_0x1c65c3,_0x33b261);}exports[_0x1499('0xc')]=function(_0x48d2ca,_0x16e8ad,_0x36a053){_0x36a053['autoCreate']=0x0;if(_0x16e8ad[_0x1499('0xd')]&&parseInt(_0x16e8ad[_0x1499('0xd')],0xa)){var _0x4c2bd2={'ListId':parseInt(_0x16e8ad[_0x1499('0xe')],0xa),'phone':_0x36a053[_0x1499('0xf')]};if(_['isNil'](_0x36a053['routeId'])){_0x4c2bd2['firstName']=_0x36a053[_0x1499('0x10')]&&_0x36a053[_0x1499('0x10')]!==_0x1499('0x11')?_0x36a053[_0x1499('0x10')]:_0x36a053[_0x1499('0xf')]||_0x36a053['uniqueid'];}else{_0x4c2bd2['firstName']=_0x36a053[_0x1499('0x12')]&&_0x36a053['destcalleridname']!==_0x1499('0x11')?_0x36a053[_0x1499('0x12')]:_0x36a053[_0x1499('0x13')]||_0x36a053[_0x1499('0x14')];_0x4c2bd2['phone']=_0x36a053[_0x1499('0x12')]&&_0x36a053[_0x1499('0x12')]!==''?_0x36a053[_0x1499('0x12')]:_0x36a053[_0x1499('0x13')]||_0x36a053[_0x1499('0x14')];}BPromise[_0x1499('0x15')]()[_0x1499('0x16')](cmContactRpc[_0x1499('0x17')]({'where':_['omit'](_0x4c2bd2,['firstName'])}))['then'](function(_0x2172b3){if(_0x2172b3){_0x36a053[_0x1499('0x18')]=_0x2172b3['id'];emit(util['format'](_0x1499('0x19'),_0x48d2ca[_0x1499('0x1a')]),util[_0x1499('0x1b')](_0x1499('0x1c'),_0x16e8ad[_0x1499('0x1d')][_0x1499('0x1e')]()),_[_0x1499('0x1f')](_0x36a053,{'ListId':parseInt(_0x16e8ad[_0x1499('0xe')],0xa)}));return;}else{return BPromise[_0x1499('0x15')]()[_0x1499('0x16')](cmContactRpc[_0x1499('0x20')](_0x4c2bd2));}})[_0x1499('0x16')](function(_0x223f4c){if(_0x223f4c){_0x36a053[_0x1499('0x18')]=_0x223f4c['id'];emit(util[_0x1499('0x1b')](_0x1499('0x19'),_0x48d2ca[_0x1499('0x1a')]),util['format'](_0x1499('0x1c'),_0x16e8ad[_0x1499('0x1d')][_0x1499('0x1e')]()),_[_0x1499('0x1f')](_0x36a053,{'ListId':parseInt(_0x16e8ad[_0x1499('0xe')],0xa)}));}})[_0x1499('0x21')](function(_0x54f3c2){logger['error'](_0x1499('0x22'),JSON[_0x1499('0xa')](_0x54f3c2));});}else{if(_0x48d2ca){emit(util[_0x1499('0x1b')](_0x1499('0x19'),_0x48d2ca[_0x1499('0x1a')]),util['format'](_0x1499('0x1c'),_0x16e8ad['action']['toLowerCase']()),_['merge']({'ListId':parseInt(_0x16e8ad[_0x1499('0xe')],0xa)},_0x36a053));}}}; \ No newline at end of file +var _0x078f=['calleridnum','isNil','routeId','calleridname','','uniqueid','firstName','destcalleridname','destcalleridnum','then','showContact','omit','format','name','trigger:%s','action','merge','data1','resolve','createContact','xmd-contactid2','user:%s','catch','error','Error\x20creating\x20contact','toLowerCase','util','lodash','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','stringify','exec','autoCreate','data2'];(function(_0x51a5fe,_0x4bd444){var _0x184132=function(_0x273942){while(--_0x273942){_0x51a5fe['push'](_0x51a5fe['shift']());}};_0x184132(++_0x4bd444);}(_0x078f,0x1b4));var _0xf078=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x078f[_0x476bf4];return _0x788ffe;};'use strict';var BPromise=require('bluebird');var util=require(_0xf078('0x0'));var _=require(_0xf078('0x1'));var Redis=require('ioredis');var config=require(_0xf078('0x2'));var logger=require(_0xf078('0x3'))(_0xf078('0x4'));var cmContactRpc=require(_0xf078('0x5'));config['redis']=_[_0xf078('0x6')](config[_0xf078('0x7')],{'host':_0xf078('0x8'),'port':0x18eb});var io=require(_0xf078('0x9'))(new Redis(config[_0xf078('0x7')]));function emit(_0x353874,_0xa80959,_0x6ae98a){logger[_0xf078('0xa')](_0x353874,_0xa80959,JSON[_0xf078('0xb')](_0x6ae98a));io['to'](_0x353874)['emit'](_0xa80959,_0x6ae98a);}exports[_0xf078('0xc')]=function(_0x52943d,_0x8090b3,_0x2c6f0e){_0x2c6f0e[_0xf078('0xd')]=0x0;if(_0x8090b3[_0xf078('0xe')]&&parseInt(_0x8090b3['data2'],0xa)){var _0x316c56={'ListId':parseInt(_0x8090b3['data1'],0xa),'phone':_0x2c6f0e[_0xf078('0xf')]};if(_[_0xf078('0x10')](_0x2c6f0e[_0xf078('0x11')])){_0x316c56['firstName']=_0x2c6f0e['calleridname']&&_0x2c6f0e[_0xf078('0x12')]!==_0xf078('0x13')?_0x2c6f0e[_0xf078('0x12')]:_0x2c6f0e['calleridnum']||_0x2c6f0e[_0xf078('0x14')];}else{_0x316c56[_0xf078('0x15')]=_0x2c6f0e['destcalleridname']&&_0x2c6f0e[_0xf078('0x16')]!==_0xf078('0x13')?_0x2c6f0e[_0xf078('0x16')]:_0x2c6f0e[_0xf078('0x17')]||_0x2c6f0e[_0xf078('0x14')];_0x316c56['phone']=_0x2c6f0e['destcalleridname']&&_0x2c6f0e['destcalleridname']!==_0xf078('0x13')?_0x2c6f0e[_0xf078('0x16')]:_0x2c6f0e['destcalleridnum']||_0x2c6f0e['uniqueid'];}BPromise['resolve']()[_0xf078('0x18')](cmContactRpc[_0xf078('0x19')]({'where':_[_0xf078('0x1a')](_0x316c56,[_0xf078('0x15')])}))[_0xf078('0x18')](function(_0x2d682f){if(_0x2d682f){_0x2c6f0e['xmd-contactid2']=_0x2d682f['id'];emit(util[_0xf078('0x1b')]('user:%s',_0x52943d[_0xf078('0x1c')]),util[_0xf078('0x1b')](_0xf078('0x1d'),_0x8090b3[_0xf078('0x1e')]['toLowerCase']()),_[_0xf078('0x1f')](_0x2c6f0e,{'ListId':parseInt(_0x8090b3[_0xf078('0x20')],0xa)}));return;}else{return BPromise[_0xf078('0x21')]()[_0xf078('0x18')](cmContactRpc[_0xf078('0x22')](_0x316c56));}})[_0xf078('0x18')](function(_0x53cf62){if(_0x53cf62){_0x2c6f0e[_0xf078('0x23')]=_0x53cf62['id'];emit(util[_0xf078('0x1b')](_0xf078('0x24'),_0x52943d[_0xf078('0x1c')]),util[_0xf078('0x1b')](_0xf078('0x1d'),_0x8090b3['action']['toLowerCase']()),_[_0xf078('0x1f')](_0x2c6f0e,{'ListId':parseInt(_0x8090b3[_0xf078('0x20')],0xa)}));}})[_0xf078('0x25')](function(_0x461c06){logger[_0xf078('0x26')](_0xf078('0x27'),JSON[_0xf078('0xb')](_0x461c06));});}else{if(_0x52943d){emit(util[_0xf078('0x1b')](_0xf078('0x24'),_0x52943d[_0xf078('0x1c')]),util['format'](_0xf078('0x1d'),_0x8090b3[_0xf078('0x1e')][_0xf078('0x28')]()),_[_0xf078('0x1f')]({'ListId':parseInt(_0x8090b3[_0xf078('0x20')],0xa)},_0x2c6f0e));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index d6af4f8..ab4882d 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 _0xaa96=['syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','emit','info','stringify','clone','checkTriggers','prototype','status','checkTrigger','merge','variables','Actions','length','interface','toLowerCase','contactmanager','browser','data1','TemplateId','data2','html','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winapp','winApplication','render','winArguments','format','user:%s','name','action','jscripty','trigger:%s','exec','integration','queue','urlforward','parse','query','search','replace','AllConditions','checkConditions','AnyConditions','some','channel','field','account','chat','ChatWebsiteId','operator','value','AccountId','upperFirst','interaction','message','event','agent','membername','lastevent','routeId','exports','util','url','mustache','./integration','./cmContact','../rpc/cmContact','../../../config/environment','defaults','localhost','socket.io-emitter','redis','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','accounts','deskAccounts','bind','syncCustomEvent','custom:agentcomplete','custom:dialbegin'];(function(_0x211fef,_0x4ab716){var _0x5447bf=function(_0x306ea3){while(--_0x306ea3){_0x211fef['push'](_0x211fef['shift']());}};_0x5447bf(++_0x4ab716);}(_0xaa96,0x1a1));var _0x6aa9=function(_0x307f25,_0x77eb4){_0x307f25=_0x307f25-0x0;var _0x5e3d7f=_0xaa96[_0x307f25];return _0x5e3d7f;};'use strict';var util=require(_0x6aa9('0x0'));var _=require('lodash');var url=require(_0x6aa9('0x1'));var Mustache=require(_0x6aa9('0x2'));var Redis=require('ioredis');var urlforward=require('./urlforward');var integration=require(_0x6aa9('0x3'));var cmContact=require(_0x6aa9('0x4'));var script=require('./script');var cmContactRpc=require(_0x6aa9('0x5'));var config=require(_0x6aa9('0x6'));var logger=require('../../../config/logger')('trigger');var ami=require('../ami');config['redis']=_[_0x6aa9('0x7')](config['redis'],{'host':_0x6aa9('0x8'),'port':0x18eb});var io=require(_0x6aa9('0x9'))(new Redis(config[_0x6aa9('0xa')]));var operators={'equals':function(_0x47f952,_0x4f1b7d){return _0x47f952==_0x4f1b7d;},'not_equals':function(_0x592150,_0xca42da){return _0x592150!=_0xca42da;}};var barAndWebActions=[_0x6aa9('0xb'),'url','winapp'];function Trigger(_0x5f166e){this[_0x6aa9('0xc')]=_0x5f166e[_0x6aa9('0xc')];this[_0x6aa9('0xd')]=_0x5f166e[_0x6aa9('0xd')];this[_0x6aa9('0xe')]=_0x5f166e[_0x6aa9('0xe')];this['templates']=_0x5f166e[_0x6aa9('0xf')];this[_0x6aa9('0x10')]=_0x5f166e[_0x6aa9('0x10')];this[_0x6aa9('0x11')]=_0x5f166e[_0x6aa9('0x11')];this['freshdeskAccounts']=_0x5f166e[_0x6aa9('0x12')];this['salesforceAccounts']=_0x5f166e[_0x6aa9('0x13')];this[_0x6aa9('0x14')]=_0x5f166e['sugarcrmAccounts'];this['zohoAccounts']=_0x5f166e[_0x6aa9('0x15')];this['deskAccounts']=_0x5f166e['deskAccounts'];this[_0x6aa9('0x16')]=_0x5f166e[_0x6aa9('0x16')];this['servicenowAccounts']=_0x5f166e['servicenowAccounts'];this[_0x6aa9('0x17')]=_0x5f166e['dynamics365Accounts'];this['freshsalesAccounts']=_0x5f166e[_0x6aa9('0x18')];this[_0x6aa9('0x19')]={'zendesk':this['zendeskAccounts'],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x6aa9('0x12')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x6aa9('0x15')],'desk':this[_0x6aa9('0x1a')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x6aa9('0x17')],'freshsales':this[_0x6aa9('0x18')],'servicenow':this['servicenowAccounts']};ami['on']('custom:agentcalled',this['syncCustomEvent'][_0x6aa9('0x1b')](this));ami['on']('custom:agentconnect',this[_0x6aa9('0x1c')]['bind'](this));ami['on']('custom:agentringnoanswer',this['syncCustomEvent']['bind'](this));ami['on'](_0x6aa9('0x1d'),this['syncCustomEvent'][_0x6aa9('0x1b')](this));ami['on']('custom:queuecallerabandon',this[_0x6aa9('0x1c')]['bind'](this));ami['on'](_0x6aa9('0x1e'),this[_0x6aa9('0x1f')][_0x6aa9('0x1b')](this));ami['on'](_0x6aa9('0x20'),this[_0x6aa9('0x1f')][_0x6aa9('0x1b')](this));ami['on'](_0x6aa9('0x21'),this[_0x6aa9('0x1f')][_0x6aa9('0x1b')](this));ami['on'](_0x6aa9('0x22'),this[_0x6aa9('0x1c')]['bind'](this));ami['on']('custom:closedinteraction',this[_0x6aa9('0x1c')][_0x6aa9('0x1b')](this));ami['on'](_0x6aa9('0x23'),this[_0x6aa9('0x1c')][_0x6aa9('0x1b')](this));ami['on'](_0x6aa9('0x24'),this[_0x6aa9('0x1c')][_0x6aa9('0x1b')](this));ami['on'](_0x6aa9('0x25'),this['syncCustomEvent'][_0x6aa9('0x1b')](this));ami['on'](_0x6aa9('0x26'),this['syncCustomEvent'][_0x6aa9('0x1b')](this));}Trigger['prototype'][_0x6aa9('0x27')]=function(_0x51c892,_0x2faf25,_0x256def){logger[_0x6aa9('0x28')](_0x51c892,_0x2faf25,JSON[_0x6aa9('0x29')](_0x256def));io['to'](_0x51c892)[_0x6aa9('0x27')](_0x2faf25,_0x256def);};Trigger['prototype'][_0x6aa9('0x1c')]=function(_0x1765c7){var _0x27ff87=_[_0x6aa9('0x2a')](_0x1765c7);this[_0x6aa9('0x2b')](_0x27ff87);};Trigger[_0x6aa9('0x2c')]['syncAgentDial']=function(_0x1c52ff){if(this[_0x6aa9('0xd')][_0x1c52ff['interface']]){this['syncCustomEvent'](_0x1c52ff);}};Trigger[_0x6aa9('0x2c')]['checkTriggers']=function(_0x5a9522){var _0x5aa2ad;for(var _0x22aae5 in this[_0x6aa9('0xc')]){if(this[_0x6aa9('0xc')]['hasOwnProperty'](_0x22aae5)){if(this[_0x6aa9('0xc')][_0x22aae5][_0x6aa9('0x2d')]){_0x5aa2ad=this[_0x6aa9('0x2e')](this['triggers'][_0x22aae5],_0x5a9522);if(_0x5aa2ad){_[_0x6aa9('0x2f')](_0x5a9522,_0x5a9522[_0x6aa9('0x30')]);for(var _0x3c769e=0x0,_0x10f9f5,_0xd0087b,_0x11726f;_0x3c769e0x0){_0x94b1f8=_[_0x74b1('0x29')](_0x1998cd,_0x351392);}return _0x94b1f8;}function getCustomFields(_0x273ff1,_0x436eda){var _0x3ce043=[];var _0x4fbe3d={'custom_fields':{}};if(_0x273ff1[_0x74b1('0x28')]>0x0){_[_0x74b1('0x2a')](_0x273ff1,function(_0x51ce6d){if(_0x51ce6d[_0x74b1('0x2b')]===_0x74b1('0x2c')&&_0x51ce6d[_0x74b1('0x2d')]&&!_0x51ce6d['customField']){_0x4fbe3d[_0x51ce6d[_0x74b1('0x2d')][_0x74b1('0x2e')]()]=_0x51ce6d['content'][_0x74b1('0x2f')]();}else if(_0x51ce6d[_0x74b1('0x2b')]===_0x74b1('0x2c')&&_0x51ce6d[_0x74b1('0x30')]&&_0x51ce6d[_0x74b1('0x31')]){_0x4fbe3d[_0x74b1('0x32')][_0x51ce6d[_0x74b1('0x30')]]=_0x51ce6d[_0x74b1('0x33')]['toString']();}else if(_0x51ce6d[_0x74b1('0x2b')]==='variable'&&_0x51ce6d['variableName']&&_0x51ce6d[_0x74b1('0x30')]&&_0x51ce6d['customField']){_0x436eda[_0x51ce6d['variableName']]&&(_0x4fbe3d[_0x74b1('0x32')][_0x51ce6d[_0x74b1('0x30')]]=_0x436eda[_0x51ce6d[_0x74b1('0x34')]][_0x74b1('0x2f')]());}else if(_0x51ce6d[_0x74b1('0x2b')]===_0x74b1('0x35')&&_0x51ce6d[_0x74b1('0x36')]&&_0x51ce6d[_0x74b1('0x36')]['name']&&_0x51ce6d['idField']&&_0x51ce6d['customField']){_0x436eda[_0x51ce6d[_0x74b1('0x36')]['name']['toLowerCase']()]&&(_0x4fbe3d[_0x74b1('0x32')][_0x51ce6d[_0x74b1('0x30')]]=_0x436eda[_0x51ce6d[_0x74b1('0x36')]['name'][_0x74b1('0x2e')]()]['toString']());}});}if(_0x4fbe3d[_0x74b1('0x37')]){_0x4fbe3d[_0x74b1('0x37')]=Number(_0x4fbe3d['priority']);}return _0x4fbe3d;}function getTicket(_0x514d0e,_0x1be766,_0x1f2790,_0x5d1481,_0x5e2007){logger[_0x74b1('0xb')]('Creating\x20new\x20ticket...');var _0x3ea552=_[_0x74b1('0x38')]({'subject':intUtil[_0x74b1('0x39')](_0x5d1481[_0x74b1('0x3a')],_0x5e2007,'\x20'),'type':_0x74b1('0x3b'),'status':'new','labels':[_0x74b1('0x3c'),'Motion',_0x74b1('0x3d')]['concat'](getTags(_0x5d1481[_0x74b1('0x3e')],'name')),'description':intUtil['getString'](_0x5d1481[_0x74b1('0x3f')],_0x5e2007,'\x0a'),'_links':{'assigned_user':{'href':util[_0x74b1('0x13')](_0x74b1('0x40'),_0x1be766['id']),'class':'user'}},'message':{'direction':'in','body':intUtil[_0x74b1('0x39')](_0x5d1481[_0x74b1('0x3f')],_0x5e2007,'\x0a')}},getCustomFields(_0x5d1481[_0x74b1('0x41')],_0x5e2007));return request({'uri':util['format'](_0x74b1('0x42'),_0x514d0e[_0x74b1('0xe')],_0x1f2790['id']),'method':'POST','body':_0x3ea552});}exports['queue']=function(_0x51b6fd,_0x2dcaf6,_0x416c8d,_0x444870,_0x1d9f5b,_0x1cded3){var _0x4732e7,_0x480212;_0x1cded3[_0x74b1('0xe')]=intUtil[_0x74b1('0x43')](_0x1cded3[_0x74b1('0xe')]);_0x1cded3[_0x74b1('0x44')]=intUtil[_0x74b1('0x43')](_0x1cded3['serverUrl']);if(_0x1d9f5b&&_0x1d9f5b[_0x74b1('0x45')]){logger[_0x74b1('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x2dcaf6[_0x74b1('0x46')]=util[_0x74b1('0x13')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1cded3[_0x74b1('0x44')],_0x2dcaf6[_0x74b1('0x47')],md5(_0x2dcaf6[_0x74b1('0x47')]));}else{_0x2dcaf6[_0x74b1('0x46')]='';}headers[_0x74b1('0x48')]=getAuth(_0x1cded3);return getUser(_0x1cded3,_0x444870[_0x74b1('0x49')])[_0x74b1('0xf')](function(_0x567df7){_0x4732e7=_0x567df7;logger['info']('The\x20User\x20ID\x20is:',_0x4732e7['id']);return getEndUser(_0x1cded3,_0x2dcaf6[_0x74b1('0x4a')],_0x2dcaf6[_0x74b1('0x4b')]);})[_0x74b1('0xf')](function(_0x2dc4a1){_0x480212=_0x2dc4a1;logger[_0x74b1('0xb')]('The\x20Enduser\x20ID\x20is:',_0x480212['id']);return getTicket(_0x1cded3,_0x4732e7,_0x480212,_0x416c8d,_0x2dcaf6);})[_0x74b1('0xf')](function(_0x2f4e45){if(_0x2f4e45){logger[_0x74b1('0xb')](_0x74b1('0x4c'));logger[_0x74b1('0xb')](_0x74b1('0x4d'),_0x2f4e45['id']);switch(_0x1cded3[_0x74b1('0x2b')]){case _0x74b1('0x4e'):logger[_0x74b1('0xb')](_0x74b1('0x4f'),_0x74b1('0x50'));emit(util[_0x74b1('0x13')]('user:%s',_0x444870[_0x74b1('0x51')]),_0x74b1('0x52'),{'recordId':_0x2f4e45['id']});break;case'newTab':logger[_0x74b1('0xb')]('[QUEUE]',_0x74b1('0x53'));emit(util[_0x74b1('0x13')]('user:%s',_0x444870[_0x74b1('0x51')]),_0x74b1('0x54'),{'uri':util[_0x74b1('0x13')]('https://xcally.desk.com/web/agent/case/%d',_0x2f4e45['id'])});break;default:logger[_0x74b1('0x55')](_0x74b1('0x4f'),_0x74b1('0x56'));}}})[_0x74b1('0x57')](function(_0x1b444d){console['error'](_0x1b444d);logger[_0x74b1('0x55')]('[QUEUE]',JSON[_0x74b1('0x17')](_0x1b444d));});};exports[_0x74b1('0x58')]=function(_0x5e458c,_0x1be639,_0x12ec28,_0x180fff,_0x54a221,_0x3b6838,_0x37b907){var _0x55a7a6,_0x16b21a;_0x3b6838['remoteUri']=intUtil['stripTrailingSlash'](_0x3b6838[_0x74b1('0xe')]);_0x3b6838[_0x74b1('0x44')]=intUtil[_0x74b1('0x43')](_0x3b6838[_0x74b1('0x44')]);if(_0x37b907&&_0x37b907[_0x74b1('0x59')]&&_0x37b907['recordingFormat']!==_0x74b1('0x5a')){logger[_0x74b1('0xb')]('[OUTBOUND]',_0x74b1('0x5b'));_0x1be639[_0x74b1('0x46')]=util[_0x74b1('0x13')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3b6838[_0x74b1('0x44')],_0x1be639[_0x74b1('0x47')],md5(_0x1be639[_0x74b1('0x47')]));}headers['Authorization']=getAuth(_0x3b6838);return getUser(_0x3b6838,_0x180fff[_0x74b1('0x49')])[_0x74b1('0xf')](function(_0x473a01){_0x55a7a6=_0x473a01;logger[_0x74b1('0xb')](_0x74b1('0x5c'),_0x55a7a6['id']);return getEndUser(_0x3b6838,_0x1be639[_0x74b1('0x5d')],_0x1be639['destcalleridnum']);})[_0x74b1('0xf')](function(_0x5004e9){_0x16b21a=_0x5004e9;logger['info'](_0x74b1('0x5e'),_0x16b21a['id']);return getTicket(_0x3b6838,_0x55a7a6,_0x16b21a,_0x12ec28,_0x1be639);})['then'](function(_0x498792){if(_0x498792){logger[_0x74b1('0xb')](_0x74b1('0x4c'));logger[_0x74b1('0xb')]('The\x20Ticket\x20ID\x20is:',_0x498792['id']);switch(_0x3b6838[_0x74b1('0x2b')]){case _0x74b1('0x4e'):logger[_0x74b1('0xb')](_0x74b1('0x4f'),_0x74b1('0x50'));emit(util[_0x74b1('0x13')](_0x74b1('0x5f'),_0x180fff[_0x74b1('0x51')]),_0x74b1('0x52'),{'recordId':_0x498792['id']});break;case _0x74b1('0x60'):logger[_0x74b1('0xb')](_0x74b1('0x4f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x74b1('0x5f'),_0x180fff['name']),_0x74b1('0x54'),{'uri':util[_0x74b1('0x13')]('%s/agent/tickets/%s',_0x3b6838['remoteUri'],_0x498792['id'])});break;default:logger[_0x74b1('0x55')](_0x74b1('0x61'),_0x74b1('0x56'));}}})[_0x74b1('0x57')](function(_0x3dd0c3){logger[_0x74b1('0x55')](_0x74b1('0x61'),JSON[_0x74b1('0x17')](_0x3dd0c3));});};exports[_0x74b1('0x62')]=function(_0x128a7e,_0x44ce8f,_0x2c3752,_0x4d14b1,_0x3549b5,_0x1de918){var _0x378f63,_0xbf23e;_0x1de918['remoteUri']=intUtil[_0x74b1('0x43')](_0x1de918[_0x74b1('0xe')]);_0x1de918['serverUrl']=intUtil[_0x74b1('0x43')](_0x1de918['serverUrl']);if(_0x3549b5&&_0x3549b5[_0x74b1('0x45')]){logger[_0x74b1('0xb')]('[ABANDONED]',_0x74b1('0x5b'));_0x44ce8f[_0x74b1('0x46')]=util[_0x74b1('0x13')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1de918[_0x74b1('0x44')],_0x44ce8f['uniqueid'],md5(_0x44ce8f[_0x74b1('0x47')]));}else{_0x44ce8f[_0x74b1('0x46')]='';}headers[_0x74b1('0x48')]=getAuth(_0x1de918);return getUser(_0x1de918)[_0x74b1('0xf')](function(_0x264698){_0x378f63=_0x264698;logger[_0x74b1('0xb')](_0x74b1('0x5c'),_0x378f63['id']);return getEndUser(_0x1de918,_0x44ce8f[_0x74b1('0x4a')],_0x44ce8f[_0x74b1('0x4b')]);})[_0x74b1('0xf')](function(_0x8b4902){_0xbf23e=_0x8b4902;logger[_0x74b1('0xb')](_0x74b1('0x5e'),_0xbf23e['id']);return getTicket(_0x1de918,_0x378f63,_0xbf23e,_0x2c3752,_0x44ce8f);})['then'](function(_0xebb1dc){if(_0xebb1dc){logger[_0x74b1('0xb')](_0x74b1('0x4c'));logger[_0x74b1('0xb')](_0x74b1('0x4d'),_0xebb1dc['id']);}})[_0x74b1('0x57')](function(_0x2e94d6){logger[_0x74b1('0x55')](_0x74b1('0x63'),JSON['stringify'](_0x2e94d6));});}; \ No newline at end of file +var _0xb03e=['xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','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','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','[OUTBOUND]','abandoned','monitor_format','calleridnum','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','desk','redis','defaults','localhost','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email','%s/users','remoteUri','then','total_entries','find','_embedded','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','format','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','%s/customers','POST','length','map','type','string','content','idField','custom_fields','variable','variableName','customField','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','Subjects','phone'];(function(_0x577c6f,_0x17dfbf){var _0x143418=function(_0x35f593){while(--_0x35f593){_0x577c6f['push'](_0x577c6f['shift']());}};_0x143418(++_0x17dfbf);}(_0xb03e,0x1eb));var _0xeb03=function(_0x184111,_0x14245c){_0x184111=_0x184111-0x0;var _0xdcddd4=_0xb03e[_0x184111];return _0xdcddd4;};'use strict';var _=require('lodash');var rp=require(_0xeb03('0x0'));var md5=require(_0xeb03('0x1'));var util=require(_0xeb03('0x2'));var Redis=require(_0xeb03('0x3'));var intUtil=require(_0xeb03('0x4'));var config=require(_0xeb03('0x5'));var logger=require(_0xeb03('0x6'))(_0xeb03('0x7'));config[_0xeb03('0x8')]=_[_0xeb03('0x9')](config[_0xeb03('0x8')],{'host':_0xeb03('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xeb03('0x8')]));function emit(_0x3d3322,_0x3a6e31,_0x246c6e){io['to'](_0x3d3322)[_0xeb03('0xb')](_0x3a6e31,_0x246c6e);}var headers={'Content-Type':_0xeb03('0xc'),'Accept':'application/json'};function getUser(_0x403b77,_0x99f4e2){if(intUtil[_0xeb03('0xd')](_0x99f4e2)===!![]){logger['info'](_0xeb03('0xe'),_0x99f4e2);return request({'uri':util['format'](_0xeb03('0xf'),_0x403b77[_0xeb03('0x10')])})[_0xeb03('0x11')](function(_0x5e50ea){if(_0x5e50ea[_0xeb03('0x12')]){return _[_0xeb03('0x13')](_0x5e50ea[_0xeb03('0x14')][_0xeb03('0x15')],{'email':_0x99f4e2});}})[_0xeb03('0x11')](function(_0x2422fd){if(_0x2422fd){logger[_0xeb03('0x16')](_0xeb03('0x17'));return _0x2422fd;}else{logger['info'](_0xeb03('0x18'));return request({'uri':util[_0xeb03('0x19')](_0xeb03('0x1a'),_0x403b77[_0xeb03('0x10')])});}});}else{logger['info'](_0xeb03('0x1b'));return request({'uri':util[_0xeb03('0x19')](_0xeb03('0x1a'),_0x403b77['remoteUri'])});}}function request(_0x7ce874){logger[_0xeb03('0x1c')](_0xeb03('0x1d'),JSON[_0xeb03('0x1e')](_0x7ce874));return rp(_[_0xeb03('0x9')](_0x7ce874,{'method':_0xeb03('0x1f'),'headers':headers,'json':!![]}));}function getAuth(_0x167a33){var _0x8d6725;if(_0x167a33[_0xeb03('0x20')]===_0xeb03('0x21')){_0x8d6725=util[_0xeb03('0x19')](_0xeb03('0x22'),_0x167a33[_0xeb03('0x23')],_0x167a33[_0xeb03('0x24')]);}else if(_0x167a33['authType']===_0xeb03('0x25')){_0x8d6725=util[_0xeb03('0x19')](_0xeb03('0x26'),_0x167a33[_0xeb03('0x23')],_0x167a33[_0xeb03('0x25')]);}return util[_0xeb03('0x19')](_0xeb03('0x27'),new Buffer(_0x8d6725)[_0xeb03('0x28')](_0xeb03('0x29')));}function getEndUser(_0x5a704b,_0x712ac2,_0x1707ec){logger[_0xeb03('0x16')](_0xeb03('0x2a'),_0x1707ec);return request({'uri':util[_0xeb03('0x19')]('%s/customers/search',_0x5a704b[_0xeb03('0x10')]),'qs':{'phone':_0x1707ec}})[_0xeb03('0x11')](function(_0x16cd4){if(_0x16cd4[_0xeb03('0x12')]){logger[_0xeb03('0x16')](_0xeb03('0x2b'));return _0x16cd4[_0xeb03('0x14')][_0xeb03('0x15')][0x0];}else{logger[_0xeb03('0x16')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xeb03('0x19')](_0xeb03('0x2c'),_0x5a704b[_0xeb03('0x10')]),'method':_0xeb03('0x2d'),'body':{'first_name':_0x712ac2,'title':_0x712ac2,'phone_numbers':[{'type':'work','value':_0x1707ec}]}});}});}function getTags(_0x581685,_0x1064a5){var _0x49e449=[];if(_0x581685&&_0x581685[_0xeb03('0x2e')]>0x0){_0x49e449=_[_0xeb03('0x2f')](_0x581685,_0x1064a5);}return _0x49e449;}function getCustomFields(_0x160a37,_0x5db8bb){var _0xd4c8ec=[];var _0x5de53a={'custom_fields':{}};if(_0x160a37['length']>0x0){_['forEach'](_0x160a37,function(_0x538d19){if(_0x538d19[_0xeb03('0x30')]===_0xeb03('0x31')&&_0x538d19['nameField']&&!_0x538d19['customField']){_0x5de53a[_0x538d19['nameField']['toLowerCase']()]=_0x538d19[_0xeb03('0x32')][_0xeb03('0x28')]();}else if(_0x538d19[_0xeb03('0x30')]===_0xeb03('0x31')&&_0x538d19[_0xeb03('0x33')]&&_0x538d19['customField']){_0x5de53a[_0xeb03('0x34')][_0x538d19['idField']]=_0x538d19[_0xeb03('0x32')][_0xeb03('0x28')]();}else if(_0x538d19[_0xeb03('0x30')]===_0xeb03('0x35')&&_0x538d19[_0xeb03('0x36')]&&_0x538d19[_0xeb03('0x33')]&&_0x538d19[_0xeb03('0x37')]){_0x5db8bb[_0x538d19[_0xeb03('0x36')]]&&(_0x5de53a['custom_fields'][_0x538d19[_0xeb03('0x33')]]=_0x5db8bb[_0x538d19['variableName']][_0xeb03('0x28')]());}else if(_0x538d19[_0xeb03('0x30')]===_0xeb03('0x38')&&_0x538d19[_0xeb03('0x39')]&&_0x538d19[_0xeb03('0x39')][_0xeb03('0x3a')]&&_0x538d19['idField']&&_0x538d19[_0xeb03('0x37')]){_0x5db8bb[_0x538d19['Variable']['name']['toLowerCase']()]&&(_0x5de53a[_0xeb03('0x34')][_0x538d19[_0xeb03('0x33')]]=_0x5db8bb[_0x538d19[_0xeb03('0x39')][_0xeb03('0x3a')][_0xeb03('0x3b')]()]['toString']());}});}if(_0x5de53a[_0xeb03('0x3c')]){_0x5de53a[_0xeb03('0x3c')]=Number(_0x5de53a[_0xeb03('0x3c')]);}return _0x5de53a;}function getTicket(_0x51a4ba,_0x4efbb7,_0xac05c4,_0x27e61f,_0x47118d){logger['info'](_0xeb03('0x3d'));var _0x392729=_['merge']({'subject':intUtil['getString'](_0x27e61f[_0xeb03('0x3e')],_0x47118d,'\x20'),'type':_0xeb03('0x3f'),'status':'new','labels':[_0xeb03('0x40'),_0xeb03('0x41'),_0xeb03('0x42')][_0xeb03('0x43')](getTags(_0x27e61f[_0xeb03('0x44')],_0xeb03('0x3a'))),'description':intUtil[_0xeb03('0x45')](_0x27e61f[_0xeb03('0x46')],_0x47118d,'\x0a'),'_links':{'assigned_user':{'href':util[_0xeb03('0x19')](_0xeb03('0x47'),_0x4efbb7['id']),'class':_0xeb03('0x48')}},'message':{'direction':'in','body':intUtil[_0xeb03('0x45')](_0x27e61f[_0xeb03('0x46')],_0x47118d,'\x0a')}},getCustomFields(_0x27e61f[_0xeb03('0x49')],_0x47118d));return request({'uri':util[_0xeb03('0x19')](_0xeb03('0x4a'),_0x51a4ba[_0xeb03('0x10')],_0xac05c4['id']),'method':_0xeb03('0x2d'),'body':_0x392729});}exports[_0xeb03('0x4b')]=function(_0x138d13,_0x43e530,_0x2f83c3,_0x2879b0,_0x5bb7d9,_0x53c406){var _0x44aa30,_0x2262b7;_0x53c406[_0xeb03('0x10')]=intUtil[_0xeb03('0x4c')](_0x53c406[_0xeb03('0x10')]);_0x53c406[_0xeb03('0x4d')]=intUtil[_0xeb03('0x4c')](_0x53c406[_0xeb03('0x4d')]);if(_0x5bb7d9&&_0x5bb7d9['monitor_format']){logger[_0xeb03('0x16')](_0xeb03('0x4e'),_0xeb03('0x4f'));_0x43e530[_0xeb03('0x50')]=util[_0xeb03('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x53c406['serverUrl'],_0x43e530[_0xeb03('0x51')],md5(_0x43e530['uniqueid']));}else{_0x43e530['recordingURL']='';}headers['Authorization']=getAuth(_0x53c406);return getUser(_0x53c406,_0x2879b0[_0xeb03('0x52')])[_0xeb03('0x11')](function(_0x38423f){_0x44aa30=_0x38423f;logger[_0xeb03('0x16')](_0xeb03('0x53'),_0x44aa30['id']);return getEndUser(_0x53c406,_0x43e530[_0xeb03('0x54')],_0x43e530['calleridnum']);})[_0xeb03('0x11')](function(_0x4bf739){_0x2262b7=_0x4bf739;logger['info'](_0xeb03('0x55'),_0x2262b7['id']);return getTicket(_0x53c406,_0x44aa30,_0x2262b7,_0x2f83c3,_0x43e530);})[_0xeb03('0x11')](function(_0x205fa3){if(_0x205fa3){logger['info'](_0xeb03('0x56'));logger[_0xeb03('0x16')](_0xeb03('0x57'),_0x205fa3['id']);switch(_0x53c406[_0xeb03('0x30')]){case _0xeb03('0x58'):logger['info'](_0xeb03('0x4e'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xeb03('0x19')](_0xeb03('0x59'),_0x2879b0[_0xeb03('0x3a')]),_0xeb03('0x5a'),{'recordId':_0x205fa3['id']});break;case _0xeb03('0x5b'):logger[_0xeb03('0x16')](_0xeb03('0x4e'),_0xeb03('0x5c'));emit(util[_0xeb03('0x19')](_0xeb03('0x59'),_0x2879b0[_0xeb03('0x3a')]),_0xeb03('0x5d'),{'uri':util[_0xeb03('0x19')](_0xeb03('0x5e'),_0x205fa3['id'])});break;default:logger[_0xeb03('0x5f')](_0xeb03('0x4e'),_0xeb03('0x60'));}}})[_0xeb03('0x61')](function(_0x30668f){console[_0xeb03('0x5f')](_0x30668f);logger[_0xeb03('0x5f')](_0xeb03('0x4e'),JSON[_0xeb03('0x1e')](_0x30668f));});};exports[_0xeb03('0x62')]=function(_0x509d79,_0x17112e,_0x17bf76,_0x415c18,_0x5405b4,_0xbbb4dd,_0x3604e8){var _0x3a6532,_0xf7e2b;_0xbbb4dd[_0xeb03('0x10')]=intUtil[_0xeb03('0x4c')](_0xbbb4dd[_0xeb03('0x10')]);_0xbbb4dd[_0xeb03('0x4d')]=intUtil[_0xeb03('0x4c')](_0xbbb4dd[_0xeb03('0x4d')]);if(_0x3604e8&&_0x3604e8[_0xeb03('0x63')]&&_0x3604e8[_0xeb03('0x63')]!==_0xeb03('0x64')){logger[_0xeb03('0x16')]('[OUTBOUND]',_0xeb03('0x4f'));_0x17112e[_0xeb03('0x50')]=util[_0xeb03('0x19')](_0xeb03('0x65'),_0xbbb4dd[_0xeb03('0x4d')],_0x17112e[_0xeb03('0x51')],md5(_0x17112e[_0xeb03('0x51')]));}headers[_0xeb03('0x66')]=getAuth(_0xbbb4dd);return getUser(_0xbbb4dd,_0x415c18[_0xeb03('0x52')])[_0xeb03('0x11')](function(_0x5baf6f){_0x3a6532=_0x5baf6f;logger[_0xeb03('0x16')](_0xeb03('0x53'),_0x3a6532['id']);return getEndUser(_0xbbb4dd,_0x17112e[_0xeb03('0x67')],_0x17112e[_0xeb03('0x68')]);})['then'](function(_0x24a0c5){_0xf7e2b=_0x24a0c5;logger[_0xeb03('0x16')](_0xeb03('0x55'),_0xf7e2b['id']);return getTicket(_0xbbb4dd,_0x3a6532,_0xf7e2b,_0x17bf76,_0x17112e);})[_0xeb03('0x11')](function(_0x17a00f){if(_0x17a00f){logger['info'](_0xeb03('0x56'));logger[_0xeb03('0x16')](_0xeb03('0x57'),_0x17a00f['id']);switch(_0xbbb4dd['type']){case _0xeb03('0x58'):logger[_0xeb03('0x16')]('[QUEUE]',_0xeb03('0x69'));emit(util[_0xeb03('0x19')](_0xeb03('0x59'),_0x415c18['name']),_0xeb03('0x5a'),{'recordId':_0x17a00f['id']});break;case _0xeb03('0x5b'):logger['info'](_0xeb03('0x4e'),_0xeb03('0x5c'));emit(util[_0xeb03('0x19')](_0xeb03('0x59'),_0x415c18[_0xeb03('0x3a')]),_0xeb03('0x5d'),{'uri':util[_0xeb03('0x19')](_0xeb03('0x6a'),_0xbbb4dd['remoteUri'],_0x17a00f['id'])});break;default:logger[_0xeb03('0x5f')]('[OUTBOUND]',_0xeb03('0x60'));}}})[_0xeb03('0x61')](function(_0x3a9518){logger['error'](_0xeb03('0x6b'),JSON[_0xeb03('0x1e')](_0x3a9518));});};exports[_0xeb03('0x6c')]=function(_0x467a9d,_0x47c389,_0x3fe855,_0x1cdf8e,_0x5db5c5,_0x588f31){var _0x583518,_0x24ece0;_0x588f31[_0xeb03('0x10')]=intUtil[_0xeb03('0x4c')](_0x588f31[_0xeb03('0x10')]);_0x588f31[_0xeb03('0x4d')]=intUtil[_0xeb03('0x4c')](_0x588f31[_0xeb03('0x4d')]);if(_0x5db5c5&&_0x5db5c5[_0xeb03('0x6d')]){logger[_0xeb03('0x16')]('[ABANDONED]','Recording\x20is\x20enabled!');_0x47c389[_0xeb03('0x50')]=util[_0xeb03('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x588f31[_0xeb03('0x4d')],_0x47c389[_0xeb03('0x51')],md5(_0x47c389[_0xeb03('0x51')]));}else{_0x47c389[_0xeb03('0x50')]='';}headers['Authorization']=getAuth(_0x588f31);return getUser(_0x588f31)['then'](function(_0x21a182){_0x583518=_0x21a182;logger[_0xeb03('0x16')](_0xeb03('0x53'),_0x583518['id']);return getEndUser(_0x588f31,_0x47c389[_0xeb03('0x54')],_0x47c389[_0xeb03('0x6e')]);})[_0xeb03('0x11')](function(_0x1a8057){_0x24ece0=_0x1a8057;logger[_0xeb03('0x16')](_0xeb03('0x55'),_0x24ece0['id']);return getTicket(_0x588f31,_0x583518,_0x24ece0,_0x3fe855,_0x47c389);})[_0xeb03('0x11')](function(_0x46fba8){if(_0x46fba8){logger['info']('Ticket\x20created!');logger[_0xeb03('0x16')]('The\x20Ticket\x20ID\x20is:',_0x46fba8['id']);}})[_0xeb03('0x61')](function(_0x4cf4f1){logger[_0xeb03('0x5f')]('[ABANDONED]',JSON[_0xeb03('0x1e')](_0x4cf4f1));});}; \ 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 fb8121b..349fb05 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 _0xd291=['validateEmail','email','userEmail','length','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','message','toLowerCase','outbound','calleridnum','POST','contacts','/systemusers(','4.0','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','string','customField','indexOf','content','ticketType','incident','incidents','assign','getString','Descriptions','/contacts(','Fields','phonecall','phonecalls','Subjects','queue','callDirection','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','serverUrl','stripTrailingSlash','abandoned','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','inspect','lodash','bluebird','request-promise','util','md5','../../../../config/environment','redis','localhost','socket.io-emitter','remoteUri','username','password','then','access_token','catch','error',']\x20Wrong\x20credentials!','GET','Bearer\x20','value','isNil'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xd291,0xa9));var _0x1d29=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd291[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1d29('0x0'));var BPromise=require(_0x1d29('0x1'));var rp=require(_0x1d29('0x2'));var util=require(_0x1d29('0x3'));var intUtil=require('./util');var md5=require(_0x1d29('0x4'));var Redis=require('ioredis');var logger=require('../../../../config/logger')('dynamics365');var config=require(_0x1d29('0x5'));config[_0x1d29('0x6')]=_['defaults'](config[_0x1d29('0x6')],{'host':_0x1d29('0x7'),'port':0x18eb});var io=require(_0x1d29('0x8'))(new Redis(config['redis']));function getAuthToken(_0x28d089,_0x3cf303,_0x5d1063){var _0x563569={'method':'POST','uri':_0x3cf303,'form':{'client_id':_0x28d089['clientId'],'resource':_0x28d089[_0x1d29('0x9')],'username':_0x28d089[_0x1d29('0xa')],'password':_0x28d089[_0x1d29('0xb')],'grant_type':_0x1d29('0xb'),'client_secret':_0x28d089['clientSecret']},'json':!![]};return rp(_0x563569)[_0x1d29('0xc')](function(_0x15fb8c){return _0x15fb8c[_0x1d29('0xd')];})[_0x1d29('0xe')](function(_0x246b75){logger[_0x1d29('0xf')]('['+[_0x5d1063['toUpperCase']()]+_0x1d29('0x10'));return _0x246b75['message'];});}function getUser(_0x47f479,_0x59b2b7,_0x1ee44f,_0x2758b1,_0x5cd761,_0x38ef3c){return new BPromise(function(_0x41a663,_0x46b35c){return getAuthToken(_0x59b2b7,_0x2758b1,_0x38ef3c)[_0x1d29('0xc')](function(_0x55f07c){var _0x916618={'method':_0x1d29('0x11'),'uri':_0x5cd761+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x1d29('0x12')+_0x55f07c,'OData-Version':'4.0'},'json':!![]};return rp(_0x916618);})[_0x1d29('0xc')](function(_0x495de3){var _0x5250cd=_0x495de3[_0x1d29('0x13')];var _0x2a30dd=![];var _0x27ffe1=null;if(!_[_0x1d29('0x14')](_0x1ee44f)){if(intUtil[_0x1d29('0x15')](_0x1ee44f[_0x1d29('0x16')])){_0x47f479[_0x1d29('0x17')]=_0x1ee44f[_0x1d29('0x16')];for(_0x27ffe1=0x0;_0x27ffe1<_0x5250cd[_0x1d29('0x18')];_0x27ffe1++){if(_0x5250cd[_0x27ffe1]['internalemailaddress']===_0x1ee44f['email']&&!_0x5250cd[_0x27ffe1][_0x1d29('0x19')]){_0x2a30dd=!![];logger[_0x1d29('0x1a')]('['+[_0x38ef3c[_0x1d29('0x1b')]()]+_0x1d29('0x1c')+_0x5250cd[_0x27ffe1][_0x1d29('0x1d')]+'!');_0x47f479[_0x1d29('0x1e')]=_0x5250cd[_0x27ffe1][_0x1d29('0x1d')];}}}}if(!_0x2a30dd){logger[_0x1d29('0x1a')]('['+[_0x38ef3c[_0x1d29('0x1b')]()]+_0x1d29('0x1f'));_0x47f479['userEmail']=_0x59b2b7[_0x1d29('0xa')];for(_0x27ffe1=0x0;_0x27ffe1<_0x5250cd[_0x1d29('0x18')];_0x27ffe1++){if(_0x5250cd[_0x27ffe1][_0x1d29('0x20')]===_0x59b2b7['username']){_0x47f479['userId']=_0x5250cd[_0x27ffe1][_0x1d29('0x1d')];}}}_0x41a663(_0x47f479);})[_0x1d29('0xe')](function(_0xde8591){_0x46b35c(_0xde8591[_0x1d29('0x21')]);});});}function createEndUser(_0x4fab69,_0x84e22b,_0xb943a,_0xc9933f,_0x3b0a5d,_0x18a726){return new BPromise(function(_0x4561e6,_0x5d7747){return getAuthToken(_0x84e22b,_0xb943a,_0x18a726)[_0x1d29('0xc')](function(_0x13fdf0){var _0x4e7c9a=_0x18a726[_0x1d29('0x22')]()===_0x1d29('0x23')?_0x3b0a5d['destcalleridnum']:_0x3b0a5d[_0x1d29('0x24')];var _0xf2372={'method':_0x1d29('0x25'),'uri':_0xc9933f+_0x1d29('0x26'),'body':{'telephone1':_0x4e7c9a,'fullname':_0x4e7c9a,'firstname':_0x4e7c9a,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x1d29('0x27')+_0x4fab69[_0x1d29('0x1e')]+')'},'headers':{'Authorization':_0x1d29('0x12')+_0x13fdf0,'OData-Version':_0x1d29('0x28')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0xf2372);})[_0x1d29('0xc')](function(_0x3d5847){var _0x39081f=_0x3d5847[_0x1d29('0x29')][_0x1d29('0x2a')];var _0x1d803f=_0x39081f[_0x1d29('0x2b')](_0x39081f[_0x1d29('0x2c')]('(')+0x1,_0x39081f[_0x1d29('0x2c')](')'));_0x4fab69[_0x1d29('0x2d')]=_0x1d803f;_0x4561e6(_0x4fab69);})['catch'](function(_0x48bd02){_0x5d7747(_0x48bd02[_0x1d29('0x21')]);});});}function getEndUser(_0x2f79b7,_0x2b7b0c,_0x3831b0,_0x2f9cfd,_0x54e4a9,_0x932155){return new BPromise(function(_0x1a3b18,_0x52bb13){return getAuthToken(_0x2b7b0c,_0x3831b0,_0x932155)[_0x1d29('0xc')](function(_0x33e89b){var _0x417461={'method':_0x1d29('0x11'),'uri':_0x2f9cfd+_0x1d29('0x2e'),'headers':{'Authorization':'Bearer\x20'+_0x33e89b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x417461);})[_0x1d29('0xc')](function(_0x2f0bad){var _0x317688=null;if(_0x2f0bad){var _0x502d2a=_0x2f0bad['value'];var _0x542fc8=![];for(_0x317688=0x0;_0x317688<_0x502d2a[_0x1d29('0x18')];_0x317688++){var _0xb3af7b=_0x932155['toLowerCase']()===_0x1d29('0x23')?_0x54e4a9['destcalleridnum']:_0x54e4a9[_0x1d29('0x24')];if(_0x502d2a[_0x317688][_0x1d29('0x2f')]===_0xb3af7b){_0x542fc8=!![];_0x2f79b7['enduserId']=_0x502d2a[_0x317688][_0x1d29('0x30')];}}if(_0x542fc8){_0x1a3b18(_0x2f79b7);}else{return createEndUser(_0x2f79b7,_0x2b7b0c,_0x3831b0,_0x2f9cfd,_0x54e4a9,_0x932155)[_0x1d29('0xc')](function(_0x1d3d62){logger[_0x1d29('0x1a')]('['+[_0x932155[_0x1d29('0x1b')]()]+_0x1d29('0x31'),_0x1d3d62[_0x1d29('0x2d')]);_0x1a3b18(_0x1d3d62);});}}else{return createEndUser(_0x2f79b7,_0x2b7b0c,_0x3831b0,_0x2f9cfd,_0x54e4a9,_0x932155)[_0x1d29('0xc')](function(_0x189188){logger['info']('['+[_0x932155[_0x1d29('0x1b')]()]+_0x1d29('0x32'),_0x189188[_0x1d29('0x2d')]);_0x1a3b18(_0x189188);});}});});}function getCustomFields(_0x40975f,_0x41a017,_0x175089){var _0x7f59cc={};if(_0x40975f['length']>0x0){_[_0x1d29('0x33')](_0x40975f,function(_0x263b98){if(_0x263b98[_0x1d29('0x34')]===_0x1d29('0x35')&&_0x263b98['nameField']&&!_0x263b98[_0x1d29('0x36')]){var _0x376714=_0x263b98['idField'][_0x1d29('0x22')]();var _0x2ca3e2=_0x376714[_0x1d29('0x2b')](0x0,_0x376714['indexOf']('_'));var _0x33dbf6=_0x376714['substring'](_0x376714[_0x1d29('0x37')]('_')+0x1);if(_0x2ca3e2===_0x175089){_0x7f59cc[_0x33dbf6]=_0x263b98[_0x1d29('0x38')];}}});}return _0x7f59cc;}function getTicket(_0x448c3d,_0x4c19bd,_0x19141e,_0x5799e7,_0x56415c,_0x3cb94a,_0x16557b){return new BPromise(function(_0x4a9579,_0x5ee9e2){var _0x60b8ad;return getAuthToken(_0x4c19bd,_0x19141e,_0x16557b)[_0x1d29('0xc')](function(_0x33c792){if(_0x3cb94a[_0x1d29('0x39')]===_0x1d29('0x3a')){_0x60b8ad={'method':_0x1d29('0x25'),'uri':_0x5799e7+_0x1d29('0x3b'),'body':Object[_0x1d29('0x3c')]({},{'title':intUtil['getString'](_0x3cb94a['Subjects'],_0x56415c,'\x20'),'description':intUtil[_0x1d29('0x3d')](_0x3cb94a[_0x1d29('0x3e')],_0x56415c,'\x0a'),'customerid_contact@odata.bind':_0x1d29('0x3f')+_0x448c3d[_0x1d29('0x2d')]+')','ownerid@odata.bind':_0x1d29('0x27')+_0x448c3d[_0x1d29('0x1e')]+')','caseorigincode':'1'},getCustomFields(_0x3cb94a[_0x1d29('0x40')],_0x56415c,_0x3cb94a[_0x1d29('0x39')])),'headers':{'Authorization':_0x1d29('0x12')+_0x33c792,'OData-Version':_0x1d29('0x28')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3cb94a['ticketType']===_0x1d29('0x41')){_0x60b8ad={'method':_0x1d29('0x25'),'uri':_0x5799e7+_0x1d29('0x42'),'body':Object[_0x1d29('0x3c')]({},{'subject':intUtil[_0x1d29('0x3d')](_0x3cb94a[_0x1d29('0x43')],_0x56415c,'\x20'),'phonenumber':String(_0x56415c['calleridnum']),'description':intUtil['getString'](_0x3cb94a[_0x1d29('0x3e')],_0x56415c,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1d29('0x3f')+_0x448c3d[_0x1d29('0x2d')]+')','ownerid@odata.bind':_0x1d29('0x27')+_0x448c3d[_0x1d29('0x1e')]+')','directioncode':_0x448c3d['callDirection']===_0x1d29('0x44')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x1d29('0x27')+_0x448c3d['userId']+')','participationtypemask':_0x448c3d[_0x1d29('0x45')]===_0x1d29('0x44')?0x2:0x1},{'partyid_contact@odata.bind':_0x1d29('0x3f')+_0x448c3d[_0x1d29('0x2d')]+')','participationtypemask':_0x448c3d[_0x1d29('0x45')]===_0x1d29('0x44')?0x1:0x2}]},getCustomFields(_0x3cb94a[_0x1d29('0x40')],_0x56415c,_0x3cb94a[_0x1d29('0x39')])),'headers':{'Authorization':_0x1d29('0x12')+_0x33c792,'OData-Version':_0x1d29('0x28')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x60b8ad);})[_0x1d29('0xc')](function(_0x5ea744){var _0x5ec609=_0x5ea744[_0x1d29('0x29')][_0x1d29('0x2a')];var _0xc46d51=_0x5ec609[_0x1d29('0x2b')](_0x5ec609[_0x1d29('0x2c')]('(')+0x1,_0x5ec609[_0x1d29('0x2c')](')'));_0x448c3d[_0x1d29('0x46')]=_0xc46d51;_0x4a9579(_0x448c3d);})['catch'](function(_0x1e3e3f){_0x5ee9e2(_0x1e3e3f[_0x1d29('0x21')]);});});}function emit(_0x2c2442,_0x19f303,_0x951616,_0x2b3599){var _0x95cb85={'uri':util['format'](_0x1d29('0x47'),_0x2c2442,_0x951616,_0x2b3599)};io['to'](util[_0x1d29('0x48')](_0x1d29('0x49'),_0x19f303))[_0x1d29('0x4a')](_0x1d29('0x4b'),_0x95cb85);}exports['cs']=function(_0x5940a6,_0x599659,_0x3c6546,_0x4185e9,_0x265f8f,_0x4904c8,_0x294660,_0xf03198){var _0x15ae1b={};_0x4904c8[_0x1d29('0x9')]=intUtil['stripTrailingSlash'](_0x4904c8[_0x1d29('0x9')]);_0x4904c8[_0x1d29('0x4c')]=intUtil[_0x1d29('0x4d')](_0x4904c8[_0x1d29('0x4c')]);_0x15ae1b[_0x1d29('0x45')]=_0xf03198===_0x1d29('0x44')||_0xf03198===_0x1d29('0x4e')?_0x1d29('0x44'):_0x1d29('0x23');var _0x4e637d=util[_0x1d29('0x48')](_0x1d29('0x4f'),_0x4904c8[_0x1d29('0x9')]);var _0x36d6d5=util['format'](_0x1d29('0x50'),_0x4904c8['tenantId']);var _0x2df511=util[_0x1d29('0x48')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4904c8[_0x1d29('0x4c')],_0x599659[_0x1d29('0x51')],md5(_0x599659[_0x1d29('0x51')]));if(_0x265f8f&&_0x265f8f['monitor_format']){logger[_0x1d29('0x1a')]('[QUEUE]',_0x1d29('0x52'));_0x599659[_0x1d29('0x53')]=_0x2df511;}else if(_0x294660&&_0x294660[_0x1d29('0x54')]&&_0x294660[_0x1d29('0x54')]!==_0x1d29('0x55')){logger[_0x1d29('0x1a')](_0x1d29('0x56'),_0x1d29('0x52'));_0x599659[_0x1d29('0x53')]=_0x2df511;}else{_0x599659[_0x1d29('0x53')]='';}return getUser(_0x15ae1b,_0x4904c8,_0x4185e9,_0x36d6d5,_0x4e637d,_0xf03198)[_0x1d29('0xc')](function(_0x4630f6){logger[_0x1d29('0x1a')]('['+_0xf03198[_0x1d29('0x1b')]()+_0x1d29('0x57'),_0x4630f6['userId']);logger['info']('['+_0xf03198[_0x1d29('0x1b')]()+_0x1d29('0x58'),_0x4630f6[_0x1d29('0x17')]);return getEndUser(_0x4630f6,_0x4904c8,_0x36d6d5,_0x4e637d,_0x599659,_0xf03198);})[_0x1d29('0xc')](function(_0x36ad51){logger['info']('['+_0xf03198[_0x1d29('0x1b')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x36ad51[_0x1d29('0x2d')]);logger[_0x1d29('0x1a')]('['+_0xf03198[_0x1d29('0x1b')]()+_0x1d29('0x59'),_0x599659['calleridnum']);return getTicket(_0x36ad51,_0x4904c8,_0x36d6d5,_0x4e637d,_0x599659,_0x3c6546,_0xf03198);})[_0x1d29('0xc')](function(_0x598cd3){logger['info'](util['format']('['+_0xf03198['toUpperCase']()+_0x1d29('0x5a'),_0x3c6546['ticketType'],_0x598cd3['ticketId']));logger[_0x1d29('0x1a')](util[_0x1d29('0x48')]('['+_0xf03198[_0x1d29('0x1b')]()+_0x1d29('0x5b'),_0xf03198));if(_0xf03198!=='abandoned'){logger[_0x1d29('0x1a')]('['+_0xf03198[_0x1d29('0x1b')]()+']',_0x1d29('0x5c'));emit(_0x4904c8[_0x1d29('0x9')],_0x4185e9[_0x1d29('0x5d')],_0x3c6546[_0x1d29('0x39')],_0x598cd3[_0x1d29('0x46')]);}})[_0x1d29('0xe')](function(_0x16bc2b){logger[_0x1d29('0xf')]('['+_0xf03198[_0x1d29('0x1b')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x1d29('0x5e')](_0x16bc2b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x2785=['localhost','POST','clientId','password','clientSecret','then','access_token','catch','error','toUpperCase','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','userEmail','internalemailaddress','isdisabled','info','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','length','userId','message','toLowerCase','outbound','calleridnum','/systemusers(','headers','substring','lastIndexOf','enduserId','contacts?$select=telephone1','destcalleridnum','contactid',']\x20Enduser\x20created!','forEach','type','string','nameField','idField','indexOf','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','phonecalls','callDirection','queue','odata-entityid','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','abandoned','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','./util','../../../../config/logger','dynamics365','redis','defaults'];(function(_0x1c06ad,_0x145040){var _0x45e3ac=function(_0x27f88f){while(--_0x27f88f){_0x1c06ad['push'](_0x1c06ad['shift']());}};_0x45e3ac(++_0x145040);}(_0x2785,0x1d0));var _0x5278=function(_0xa132f9,_0x32f20d){_0xa132f9=_0xa132f9-0x0;var _0x342190=_0x2785[_0xa132f9];return _0x342190;};'use strict';var _=require(_0x5278('0x0'));var BPromise=require('bluebird');var rp=require('request-promise');var util=require('util');var intUtil=require(_0x5278('0x1'));var md5=require('md5');var Redis=require('ioredis');var logger=require(_0x5278('0x2'))(_0x5278('0x3'));var config=require('../../../../config/environment');config[_0x5278('0x4')]=_[_0x5278('0x5')](config['redis'],{'host':_0x5278('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5278('0x4')]));function getAuthToken(_0x18916e,_0x2db2a2,_0x1d3566){var _0x1b96f9={'method':_0x5278('0x7'),'uri':_0x2db2a2,'form':{'client_id':_0x18916e[_0x5278('0x8')],'resource':_0x18916e['remoteUri'],'username':_0x18916e['username'],'password':_0x18916e[_0x5278('0x9')],'grant_type':_0x5278('0x9'),'client_secret':_0x18916e[_0x5278('0xa')]},'json':!![]};return rp(_0x1b96f9)[_0x5278('0xb')](function(_0x557b9e){return _0x557b9e[_0x5278('0xc')];})[_0x5278('0xd')](function(_0x46b67b){logger[_0x5278('0xe')]('['+[_0x1d3566[_0x5278('0xf')]()]+']\x20Wrong\x20credentials!');return _0x46b67b['message'];});}function getUser(_0x3ed8cf,_0x1bf1b0,_0x5a7136,_0x355b00,_0x3e3d9a,_0x121612){return new BPromise(function(_0x2804e7,_0x2b525d){return getAuthToken(_0x1bf1b0,_0x355b00,_0x121612)['then'](function(_0x3c79fb){var _0x5d3694={'method':_0x5278('0x10'),'uri':_0x3e3d9a+_0x5278('0x11'),'headers':{'Authorization':_0x5278('0x12')+_0x3c79fb,'OData-Version':_0x5278('0x13')},'json':!![]};return rp(_0x5d3694);})[_0x5278('0xb')](function(_0x260251){var _0x5569e2=_0x260251[_0x5278('0x14')];var _0x5a4b03=![];var _0x288cb3=null;if(!_['isNil'](_0x5a7136)){if(intUtil[_0x5278('0x15')](_0x5a7136[_0x5278('0x16')])){_0x3ed8cf[_0x5278('0x17')]=_0x5a7136[_0x5278('0x16')];for(_0x288cb3=0x0;_0x288cb3<_0x5569e2['length'];_0x288cb3++){if(_0x5569e2[_0x288cb3][_0x5278('0x18')]===_0x5a7136[_0x5278('0x16')]&&!_0x5569e2[_0x288cb3][_0x5278('0x19')]){_0x5a4b03=!![];logger[_0x5278('0x1a')]('['+[_0x121612[_0x5278('0xf')]()]+']\x20Agent\x20found\x20'+_0x5569e2[_0x288cb3][_0x5278('0x1b')]+'!');_0x3ed8cf['userId']=_0x5569e2[_0x288cb3]['systemuserid'];}}}}if(!_0x5a4b03){logger[_0x5278('0x1a')]('['+[_0x121612[_0x5278('0xf')]()]+_0x5278('0x1c'));_0x3ed8cf['userEmail']=_0x1bf1b0[_0x5278('0x1d')];for(_0x288cb3=0x0;_0x288cb3<_0x5569e2[_0x5278('0x1e')];_0x288cb3++){if(_0x5569e2[_0x288cb3][_0x5278('0x18')]===_0x1bf1b0[_0x5278('0x1d')]){_0x3ed8cf[_0x5278('0x1f')]=_0x5569e2[_0x288cb3]['systemuserid'];}}}_0x2804e7(_0x3ed8cf);})[_0x5278('0xd')](function(_0x4a8cfb){_0x2b525d(_0x4a8cfb[_0x5278('0x20')]);});});}function createEndUser(_0x4c74eb,_0x21f0cd,_0x3520bd,_0x37e7b9,_0x174742,_0x581468){return new BPromise(function(_0x4c1f24,_0x278405){return getAuthToken(_0x21f0cd,_0x3520bd,_0x581468)['then'](function(_0x105c73){var _0x94a974=_0x581468[_0x5278('0x21')]()===_0x5278('0x22')?_0x174742['destcalleridnum']:_0x174742[_0x5278('0x23')];var _0xbd5980={'method':'POST','uri':_0x37e7b9+'contacts','body':{'telephone1':_0x94a974,'fullname':_0x94a974,'firstname':_0x94a974,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x5278('0x24')+_0x4c74eb[_0x5278('0x1f')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x105c73,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0xbd5980);})[_0x5278('0xb')](function(_0x2c4241){var _0x3b29fb=_0x2c4241[_0x5278('0x25')]['odata-entityid'];var _0x13e223=_0x3b29fb[_0x5278('0x26')](_0x3b29fb[_0x5278('0x27')]('(')+0x1,_0x3b29fb[_0x5278('0x27')](')'));_0x4c74eb[_0x5278('0x28')]=_0x13e223;_0x4c1f24(_0x4c74eb);})[_0x5278('0xd')](function(_0x2d085b){_0x278405(_0x2d085b[_0x5278('0x20')]);});});}function getEndUser(_0x456351,_0x57e5b8,_0x1bc512,_0x21cdaf,_0x354a9e,_0x3b86b1){return new BPromise(function(_0x11d138,_0x4b0f5c){return getAuthToken(_0x57e5b8,_0x1bc512,_0x3b86b1)[_0x5278('0xb')](function(_0x46b3d1){var _0xf6d5bd={'method':_0x5278('0x10'),'uri':_0x21cdaf+_0x5278('0x29'),'headers':{'Authorization':'Bearer\x20'+_0x46b3d1,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xf6d5bd);})[_0x5278('0xb')](function(_0x3a8933){var _0x49ccb7=null;if(_0x3a8933){var _0x8108ff=_0x3a8933[_0x5278('0x14')];var _0x468a94=![];for(_0x49ccb7=0x0;_0x49ccb7<_0x8108ff['length'];_0x49ccb7++){var _0x43e543=_0x3b86b1[_0x5278('0x21')]()==='outbound'?_0x354a9e[_0x5278('0x2a')]:_0x354a9e[_0x5278('0x23')];if(_0x8108ff[_0x49ccb7]['telephone1']===_0x43e543){_0x468a94=!![];_0x456351[_0x5278('0x28')]=_0x8108ff[_0x49ccb7][_0x5278('0x2b')];}}if(_0x468a94){_0x11d138(_0x456351);}else{return createEndUser(_0x456351,_0x57e5b8,_0x1bc512,_0x21cdaf,_0x354a9e,_0x3b86b1)[_0x5278('0xb')](function(_0x5b06da){logger['info']('['+[_0x3b86b1[_0x5278('0xf')]()]+_0x5278('0x2c'),_0x5b06da['enduserId']);_0x11d138(_0x5b06da);});}}else{return createEndUser(_0x456351,_0x57e5b8,_0x1bc512,_0x21cdaf,_0x354a9e,_0x3b86b1)[_0x5278('0xb')](function(_0xbdd12c){logger[_0x5278('0x1a')]('['+[_0x3b86b1[_0x5278('0xf')]()]+']\x20Enduser\x20Created!',_0xbdd12c[_0x5278('0x28')]);_0x11d138(_0xbdd12c);});}});});}function getCustomFields(_0x19da7e,_0x4fdaf7,_0x10dfa6){var _0x3959db={};if(_0x19da7e[_0x5278('0x1e')]>0x0){_[_0x5278('0x2d')](_0x19da7e,function(_0x161461){if(_0x161461[_0x5278('0x2e')]===_0x5278('0x2f')&&_0x161461[_0x5278('0x30')]&&!_0x161461['customField']){var _0x3e50d1=_0x161461[_0x5278('0x31')][_0x5278('0x21')]();var _0x4f8c45=_0x3e50d1['substring'](0x0,_0x3e50d1[_0x5278('0x32')]('_'));var _0x4dfcef=_0x3e50d1['substring'](_0x3e50d1[_0x5278('0x32')]('_')+0x1);if(_0x4f8c45===_0x10dfa6){_0x3959db[_0x4dfcef]=_0x161461['content'];}}});}return _0x3959db;}function getTicket(_0xf08d1f,_0xb5af89,_0x15d967,_0x52d2e2,_0x48440e,_0x285377,_0x3f0d65){return new BPromise(function(_0x1a0227,_0x169315){var _0x48f2a7;return getAuthToken(_0xb5af89,_0x15d967,_0x3f0d65)[_0x5278('0xb')](function(_0x2327a8){if(_0x285377[_0x5278('0x33')]===_0x5278('0x34')){_0x48f2a7={'method':_0x5278('0x7'),'uri':_0x52d2e2+_0x5278('0x35'),'body':Object[_0x5278('0x36')]({},{'title':intUtil[_0x5278('0x37')](_0x285377[_0x5278('0x38')],_0x48440e,'\x20'),'description':intUtil['getString'](_0x285377[_0x5278('0x39')],_0x48440e,'\x0a'),'customerid_contact@odata.bind':_0x5278('0x3a')+_0xf08d1f[_0x5278('0x28')]+')','ownerid@odata.bind':_0x5278('0x24')+_0xf08d1f['userId']+')','caseorigincode':'1'},getCustomFields(_0x285377[_0x5278('0x3b')],_0x48440e,_0x285377['ticketType'])),'headers':{'Authorization':_0x5278('0x12')+_0x2327a8,'OData-Version':_0x5278('0x13')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x285377[_0x5278('0x33')]===_0x5278('0x3c')){_0x48f2a7={'method':_0x5278('0x7'),'uri':_0x52d2e2+_0x5278('0x3d'),'body':Object['assign']({},{'subject':intUtil['getString'](_0x285377[_0x5278('0x38')],_0x48440e,'\x20'),'phonenumber':String(_0x48440e[_0x5278('0x23')]),'description':intUtil[_0x5278('0x37')](_0x285377[_0x5278('0x39')],_0x48440e,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0xf08d1f['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0xf08d1f[_0x5278('0x1f')]+')','directioncode':_0xf08d1f[_0x5278('0x3e')]===_0x5278('0x3f')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x5278('0x24')+_0xf08d1f[_0x5278('0x1f')]+')','participationtypemask':_0xf08d1f['callDirection']===_0x5278('0x3f')?0x2:0x1},{'partyid_contact@odata.bind':_0x5278('0x3a')+_0xf08d1f[_0x5278('0x28')]+')','participationtypemask':_0xf08d1f['callDirection']===_0x5278('0x3f')?0x1:0x2}]},getCustomFields(_0x285377[_0x5278('0x3b')],_0x48440e,_0x285377[_0x5278('0x33')])),'headers':{'Authorization':_0x5278('0x12')+_0x2327a8,'OData-Version':_0x5278('0x13')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x48f2a7);})['then'](function(_0x294323){var _0x4bc900=_0x294323[_0x5278('0x25')][_0x5278('0x40')];var _0x3281ed=_0x4bc900[_0x5278('0x26')](_0x4bc900[_0x5278('0x27')]('(')+0x1,_0x4bc900[_0x5278('0x27')](')'));_0xf08d1f['ticketId']=_0x3281ed;_0x1a0227(_0xf08d1f);})[_0x5278('0xd')](function(_0x553401){_0x169315(_0x553401['message']);});});}function emit(_0x34f849,_0x5895d8,_0x2ec43e,_0x165df2){var _0xc2b730={'uri':util[_0x5278('0x41')](_0x5278('0x42'),_0x34f849,_0x2ec43e,_0x165df2)};io['to'](util[_0x5278('0x41')]('user:%s',_0x5895d8))[_0x5278('0x43')](_0x5278('0x44'),_0xc2b730);}exports['cs']=function(_0x448de3,_0xe9edd9,_0x4de29d,_0x2dc8e0,_0x343b1a,_0x4fd907,_0x4a396c,_0x4fd6cb){var _0x51bf6d={};_0x4fd907[_0x5278('0x45')]=intUtil[_0x5278('0x46')](_0x4fd907[_0x5278('0x45')]);_0x4fd907[_0x5278('0x47')]=intUtil[_0x5278('0x46')](_0x4fd907[_0x5278('0x47')]);_0x51bf6d[_0x5278('0x3e')]=_0x4fd6cb===_0x5278('0x3f')||_0x4fd6cb===_0x5278('0x48')?_0x5278('0x3f'):_0x5278('0x22');var _0x181e27=util[_0x5278('0x41')](_0x5278('0x49'),_0x4fd907['remoteUri']);var _0x113572=util[_0x5278('0x41')](_0x5278('0x4a'),_0x4fd907[_0x5278('0x4b')]);var _0x25a243=util[_0x5278('0x41')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4fd907[_0x5278('0x47')],_0xe9edd9[_0x5278('0x4c')],md5(_0xe9edd9['uniqueid']));if(_0x343b1a&&_0x343b1a[_0x5278('0x4d')]){logger[_0x5278('0x1a')]('[QUEUE]',_0x5278('0x4e'));_0xe9edd9[_0x5278('0x4f')]=_0x25a243;}else if(_0x4a396c&&_0x4a396c[_0x5278('0x50')]&&_0x4a396c[_0x5278('0x50')]!==_0x5278('0x51')){logger['info'](_0x5278('0x52'),'Recording\x20is\x20enabled!');_0xe9edd9[_0x5278('0x4f')]=_0x25a243;}else{_0xe9edd9[_0x5278('0x4f')]='';}return getUser(_0x51bf6d,_0x4fd907,_0x2dc8e0,_0x113572,_0x181e27,_0x4fd6cb)[_0x5278('0xb')](function(_0x4b5e31){logger['info']('['+_0x4fd6cb[_0x5278('0xf')]()+_0x5278('0x53'),_0x4b5e31[_0x5278('0x1f')]);logger['info']('['+_0x4fd6cb[_0x5278('0xf')]()+_0x5278('0x54'),_0x4b5e31[_0x5278('0x17')]);return getEndUser(_0x4b5e31,_0x4fd907,_0x113572,_0x181e27,_0xe9edd9,_0x4fd6cb);})[_0x5278('0xb')](function(_0x134f5d){logger[_0x5278('0x1a')]('['+_0x4fd6cb['toUpperCase']()+_0x5278('0x55'),_0x134f5d[_0x5278('0x28')]);logger['info']('['+_0x4fd6cb[_0x5278('0xf')]()+_0x5278('0x56'),_0xe9edd9[_0x5278('0x23')]);return getTicket(_0x134f5d,_0x4fd907,_0x113572,_0x181e27,_0xe9edd9,_0x4de29d,_0x4fd6cb);})[_0x5278('0xb')](function(_0x591ee9){logger[_0x5278('0x1a')](util[_0x5278('0x41')]('['+_0x4fd6cb[_0x5278('0xf')]()+_0x5278('0x57'),_0x4de29d[_0x5278('0x33')],_0x591ee9[_0x5278('0x58')]));logger[_0x5278('0x1a')](util[_0x5278('0x41')]('['+_0x4fd6cb[_0x5278('0xf')]()+_0x5278('0x59'),_0x4fd6cb));if(_0x4fd6cb!==_0x5278('0x48')){logger[_0x5278('0x1a')]('['+_0x4fd6cb['toUpperCase']()+']',_0x5278('0x5a'));emit(_0x4fd907['remoteUri'],_0x2dc8e0[_0x5278('0x5b')],_0x4de29d[_0x5278('0x33')],_0x591ee9[_0x5278('0x58')]);}})[_0x5278('0xd')](function(_0x30d15d){logger[_0x5278('0xe')]('['+_0x4fd6cb[_0x5278('0xf')]()+_0x5278('0x5c'),util[_0x5278('0x5d')](_0x30d15d,{'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 8088725..b8a89c0 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 _0x54bb=['%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','destcalleridnum','[OUTBOUND]','catch','[ABANDONED]','The\x20Enduser\x20ID\x20is:','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','length','info','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','stringify','map','forEach','type','string','nameField','customField','toLowerCase','idField','push','variable','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url'];(function(_0x4cdaf7,_0x4d03ef){var _0x46f112=function(_0x456eac){while(--_0x456eac){_0x4cdaf7['push'](_0x4cdaf7['shift']());}};_0x46f112(++_0x4d03ef);}(_0x54bb,0x121));var _0xb54b=function(_0x1a151a,_0x44325f){_0x1a151a=_0x1a151a-0x0;var _0x3ce862=_0x54bb[_0x1a151a];return _0x3ce862;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xb54b('0x0'));var util=require(_0xb54b('0x1'));var Redis=require(_0xb54b('0x2'));var intUtil=require(_0xb54b('0x3'));var config=require(_0xb54b('0x4'));var logger=require(_0xb54b('0x5'))(_0xb54b('0x6'));config[_0xb54b('0x7')]=_[_0xb54b('0x8')](config[_0xb54b('0x7')],{'host':_0xb54b('0x9'),'port':0x18eb});var io=require(_0xb54b('0xa'))(new Redis(config['redis']));var headers={'Content-Type':_0xb54b('0xb'),'Accept':_0xb54b('0xb')};function emit(_0x106dcb,_0x18e2fe,_0x314f9b){io['to'](_0x106dcb)[_0xb54b('0xc')](_0x18e2fe,_0x314f9b);}function getTicket(_0x17c6af,_0x2e3a62,_0x2c42b0,_0x3fa604,_0x2901b4){logger['info'](_0xb54b('0xd'));var _0x38ce1a=_[_0xb54b('0xe')]({'responder_id':_0x2e3a62['id'],'requester_id':_0x2c42b0['id'],'name':util['format']('Caller\x20-\x20%s',_0x2901b4[_0xb54b('0xf')]),'phone':_0x2901b4[_0xb54b('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xb54b('0x11')](_0x3fa604[_0xb54b('0x12')],_0x2901b4,'\x20'),'description':intUtil[_0xb54b('0x11')](_0x3fa604[_0xb54b('0x13')],_0x2901b4,_0xb54b('0x14')),'tags':getTags(_0x3fa604[_0xb54b('0x15')],_0xb54b('0x16'))},getCustomFields(_0x3fa604[_0xb54b('0x17')],_0x2901b4));_0x38ce1a[_0xb54b('0x18')]=_[_0xb54b('0x19')](_[_0xb54b('0x1a')](_0x38ce1a[_0xb54b('0x18')],'id'),_0xb54b('0x1b'));return request({'uri':util[_0xb54b('0x1c')](_0xb54b('0x1d'),_0x17c6af['remoteUri']),'method':_0xb54b('0x1e'),'body':_0x38ce1a})[_0xb54b('0x1f')](function(_0x537261){logger['info'](_0xb54b('0x20'));return _0x537261;});}function getUser(_0x2ea19d,_0x199ea3){if(intUtil[_0xb54b('0x21')](_0x199ea3)){return request({'uri':util[_0xb54b('0x1c')](_0xb54b('0x22'),_0x2ea19d[_0xb54b('0x23')]),'qs':{'email':_0x199ea3}})[_0xb54b('0x1f')](function(_0x468d28){if(_0x468d28[_0xb54b('0x24')]){logger[_0xb54b('0x25')](_0xb54b('0x26'));return _[_0xb54b('0x27')](_0x468d28,function(_0x1a67e7){return _0x1a67e7['contact'][_0xb54b('0x28')]===_0x199ea3;});}else{logger[_0xb54b('0x25')](_0xb54b('0x29'));return request({'uri':util[_0xb54b('0x1c')](_0xb54b('0x2a'),_0x2ea19d[_0xb54b('0x23')])})[_0xb54b('0x1f')](function(_0x4f0cdb){logger['info'](_0xb54b('0x2b'));return _0x4f0cdb;});}});}else{logger['info'](_0xb54b('0x2c'));return request({'uri':util['format'](_0xb54b('0x2a'),_0x2ea19d[_0xb54b('0x23')])})[_0xb54b('0x1f')](function(_0x55273e){logger[_0xb54b('0x25')](_0xb54b('0x2b'));return _0x55273e;});}}function getEndUser(_0x408cbe,_0x32ec63,_0xa99172){logger[_0xb54b('0x25')](_0xb54b('0x2d'),_0xa99172);return request({'uri':util[_0xb54b('0x1c')](_0xb54b('0x2e'),_0x408cbe[_0xb54b('0x23')]),'qs':{'phone':_0xa99172}})[_0xb54b('0x1f')](function(_0xb60b7a){if(_0xb60b7a[_0xb54b('0x24')]){logger[_0xb54b('0x25')]('Enduser\x20found!');return _[_0xb54b('0x27')](_0xb60b7a,{'phone':_0xa99172});}else{logger[_0xb54b('0x25')](_0xb54b('0x2f'));return request({'uri':util[_0xb54b('0x1c')]('%s/api/v2/contacts',_0x408cbe[_0xb54b('0x23')]),'method':_0xb54b('0x1e'),'body':{'name':_0x32ec63,'phone':_0xa99172}})[_0xb54b('0x1f')](function(_0x52ef66){logger[_0xb54b('0x25')](_0xb54b('0x30'));return _0x52ef66;});}});}function getAuth(_0x2de176){return util[_0xb54b('0x1c')](_0xb54b('0x31'),new Buffer(_0x2de176[_0xb54b('0x32')]+':X')[_0xb54b('0x33')](_0xb54b('0x34')));}function request(_0x4676aa){logger[_0xb54b('0x35')]('[HTTP]',JSON[_0xb54b('0x36')](_0x4676aa));return rp(_[_0xb54b('0x8')](_0x4676aa,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x16dafb,_0x328b4d){var _0x15e49d=[];if(_0x16dafb&&_0x16dafb['length']>0x0){_0x15e49d=_[_0xb54b('0x37')](_0x16dafb,_0x328b4d);}return _0x15e49d;}function getCustomFields(_0x1c9a54,_0x2161da){var _0x2c3ae4=[];var _0x1b21d7={'custom_fields':[]};if(_0x1c9a54[_0xb54b('0x24')]>0x0){_[_0xb54b('0x38')](_0x1c9a54,function(_0x1712d7){if(_0x1712d7[_0xb54b('0x39')]===_0xb54b('0x3a')&&_0x1712d7[_0xb54b('0x3b')]&&!_0x1712d7[_0xb54b('0x3c')]){_0x1b21d7[_0x1712d7['nameField'][_0xb54b('0x3d')]()]=_0x1712d7['content'][_0xb54b('0x33')]();}else if(_0x1712d7[_0xb54b('0x39')]===_0xb54b('0x3a')&&_0x1712d7[_0xb54b('0x3e')]&&_0x1712d7[_0xb54b('0x3c')]){_0x1b21d7[_0xb54b('0x18')][_0xb54b('0x3f')]({'id':_0x1712d7[_0xb54b('0x3e')],'value':_0x1712d7['content']['toString']()});}else if(_0x1712d7[_0xb54b('0x39')]===_0xb54b('0x40')&&_0x1712d7[_0xb54b('0x41')]&&_0x1712d7[_0xb54b('0x3e')]&&_0x1712d7['customField']){_0x2161da[_0x1712d7[_0xb54b('0x41')]]&&_0x1b21d7[_0xb54b('0x18')][_0xb54b('0x3f')]({'id':_0x1712d7['idField'],'value':_0x2161da[_0x1712d7[_0xb54b('0x41')]][_0xb54b('0x33')]()});}else if(_0x1712d7[_0xb54b('0x39')]===_0xb54b('0x42')&&_0x1712d7['Variable']&&_0x1712d7['Variable']['name']&&_0x1712d7['idField']&&_0x1712d7[_0xb54b('0x3c')]){_0x2161da[_0x1712d7[_0xb54b('0x43')][_0xb54b('0x16')][_0xb54b('0x3d')]()]&&_0x1b21d7['custom_fields'][_0xb54b('0x3f')]({'id':_0x1712d7[_0xb54b('0x3e')],'value':_0x2161da[_0x1712d7[_0xb54b('0x43')][_0xb54b('0x16')][_0xb54b('0x3d')]()][_0xb54b('0x33')]()});}});}return _0x1b21d7;}exports[_0xb54b('0x44')]=function(_0x2a2319,_0x490f97,_0x5e4ae0,_0xc19813,_0x59b63e,_0xcbe720){var _0x281413,_0x234ae6;_0xcbe720[_0xb54b('0x23')]=intUtil['stripTrailingSlash'](_0xcbe720[_0xb54b('0x23')]);_0xcbe720[_0xb54b('0x45')]=intUtil[_0xb54b('0x46')](_0xcbe720[_0xb54b('0x45')]);if(_0x59b63e&&_0x59b63e[_0xb54b('0x47')]){logger['info'](_0xb54b('0x48'),_0xb54b('0x49'));_0x490f97[_0xb54b('0x4a')]=util[_0xb54b('0x1c')](_0xb54b('0x4b'),_0xcbe720[_0xb54b('0x45')],_0x490f97['uniqueid'],md5(_0x490f97[_0xb54b('0x4c')]));}else{_0x490f97['recordingURL']='';}headers[_0xb54b('0x4d')]=getAuth(_0xcbe720);return getUser(_0xcbe720,_0xc19813[_0xb54b('0x28')])[_0xb54b('0x1f')](function(_0x34d082){_0x281413=_0x34d082;logger[_0xb54b('0x25')](_0xb54b('0x4e'),_0x281413['id']);return getEndUser(_0xcbe720,_0x490f97[_0xb54b('0xf')],_0x490f97[_0xb54b('0x10')]);})['then'](function(_0x4d9ee3){_0x234ae6=_0x4d9ee3;logger[_0xb54b('0x25')]('The\x20Enduser\x20ID\x20is:',_0x234ae6['id']);return getTicket(_0xcbe720,_0x281413,_0x234ae6,_0x5e4ae0,_0x490f97);})[_0xb54b('0x1f')](function(_0xc140ca){if(_0xc140ca&&_0xc140ca['id']){logger[_0xb54b('0x25')]('Ticket\x20created!');logger[_0xb54b('0x25')](_0xb54b('0x4f'),_0xc140ca['id']);logger[_0xb54b('0x25')](_0xb54b('0x48'),_0xb54b('0x50'));emit(util[_0xb54b('0x1c')](_0xb54b('0x51'),_0xc19813['name']),_0xb54b('0x52'),{'uri':util['format'](_0xb54b('0x53'),_0xcbe720[_0xb54b('0x23')],_0xc140ca['id'])});}})['catch'](function(_0x30e18a){logger[_0xb54b('0x54')](_0xb54b('0x48'),JSON[_0xb54b('0x36')](_0x30e18a));});};exports[_0xb54b('0x55')]=function(_0x9f6922,_0x221631,_0x2cfaaf,_0x2e6e87,_0x54629c,_0x93918b,_0x1fda49){var _0x42a6b1,_0x4583ce;_0x93918b[_0xb54b('0x23')]=intUtil[_0xb54b('0x46')](_0x93918b['remoteUri']);_0x93918b[_0xb54b('0x45')]=intUtil[_0xb54b('0x46')](_0x93918b[_0xb54b('0x45')]);if(_0x1fda49&&_0x1fda49['recordingFormat']&&_0x1fda49[_0xb54b('0x56')]!==_0xb54b('0x57')){logger[_0xb54b('0x25')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x221631[_0xb54b('0x4a')]=util[_0xb54b('0x1c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x93918b['serverUrl'],_0x221631['uniqueid'],md5(_0x221631[_0xb54b('0x4c')]));}headers[_0xb54b('0x4d')]=getAuth(_0x93918b);return getUser(_0x93918b,_0x2e6e87[_0xb54b('0x28')])[_0xb54b('0x1f')](function(_0x4ff909){_0x42a6b1=_0x4ff909;logger[_0xb54b('0x25')](_0xb54b('0x4e'),_0x42a6b1['id']);return getEndUser(_0x93918b,_0x221631['destcalleridname'],_0x221631[_0xb54b('0x58')]);})[_0xb54b('0x1f')](function(_0x2ee0a1){_0x4583ce=_0x2ee0a1;logger[_0xb54b('0x25')]('The\x20Enduser\x20ID\x20is:',_0x4583ce['id']);return getTicket(_0x93918b,_0x42a6b1,_0x4583ce,_0x2cfaaf,_0x221631);})[_0xb54b('0x1f')](function(_0x26eb36){if(_0x26eb36&&_0x26eb36['id']){logger[_0xb54b('0x25')](_0xb54b('0x20'));logger[_0xb54b('0x25')](_0xb54b('0x4f'),_0x26eb36['id']);logger[_0xb54b('0x25')](_0xb54b('0x59'),_0xb54b('0x50'));emit(util[_0xb54b('0x1c')](_0xb54b('0x51'),_0x2e6e87[_0xb54b('0x16')]),_0xb54b('0x52'),{'uri':util['format'](_0xb54b('0x53'),_0x93918b['remoteUri'],_0x26eb36['id'])});}})[_0xb54b('0x5a')](function(_0x196c66){logger[_0xb54b('0x54')]('[OUTBOUND]',JSON[_0xb54b('0x36')](_0x196c66));});};exports['abandoned']=function(_0x4dfe83,_0x548cc0,_0x6cd73c,_0x534104,_0x2237d3,_0x37fa82){var _0x479044,_0x32498a;_0x37fa82[_0xb54b('0x23')]=intUtil[_0xb54b('0x46')](_0x37fa82[_0xb54b('0x23')]);_0x37fa82[_0xb54b('0x45')]=intUtil[_0xb54b('0x46')](_0x37fa82['serverUrl']);if(_0x2237d3&&_0x2237d3['monitor_format']){logger[_0xb54b('0x25')](_0xb54b('0x5b'),_0xb54b('0x49'));_0x548cc0[_0xb54b('0x4a')]=util[_0xb54b('0x1c')](_0xb54b('0x4b'),_0x37fa82[_0xb54b('0x45')],_0x548cc0[_0xb54b('0x4c')],md5(_0x548cc0[_0xb54b('0x4c')]));}else{_0x548cc0[_0xb54b('0x4a')]='';}headers['Authorization']=getAuth(_0x37fa82);return getUser(_0x37fa82,'')[_0xb54b('0x1f')](function(_0x5ddd01){_0x479044=_0x5ddd01;logger[_0xb54b('0x25')](_0xb54b('0x4e'),_0x479044['id']);return getEndUser(_0x37fa82,_0x548cc0[_0xb54b('0xf')],_0x548cc0['calleridnum']);})[_0xb54b('0x1f')](function(_0x12551d){_0x32498a=_0x12551d;logger['info'](_0xb54b('0x5c'),_0x32498a['id']);return getTicket(_0x37fa82,_0x479044,_0x32498a,_0x6cd73c,_0x548cc0);})[_0xb54b('0x1f')](function(_0x385b86){if(_0x385b86){logger[_0xb54b('0x25')](_0xb54b('0x20'));logger[_0xb54b('0x25')](_0xb54b('0x4f'),_0x385b86['id']);}})[_0xb54b('0x5a')](function(_0x4b47ce){logger[_0xb54b('0x54')](_0xb54b('0x5b'),JSON[_0xb54b('0x36')](_0x4b47ce));});}; \ No newline at end of file +var _0xf4b4=['type','idField','customField','push','toString','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','recordingFormat','none','[OUTBOUND]','email','The\x20User\x20ID\x20is:','destcalleridnum','The\x20Enduser\x20ID\x20is:','user:%s','%s/helpdesk/tickets/%d','error','[ABANDONED]','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','validateEmail','then','length','Agent\x20found!','find','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','base64','debug','stringify','GET','map','forEach','string','nameField','toLowerCase','content'];(function(_0x1ccab5,_0x585d5b){var _0x14643a=function(_0x4a327e){while(--_0x4a327e){_0x1ccab5['push'](_0x1ccab5['shift']());}};_0x14643a(++_0x585d5b);}(_0xf4b4,0x7d));var _0x4f4b=function(_0x53b398,_0x39bfd8){_0x53b398=_0x53b398-0x0;var _0x32c9ed=_0xf4b4[_0x53b398];return _0x32c9ed;};'use strict';var _=require(_0x4f4b('0x0'));var rp=require(_0x4f4b('0x1'));var md5=require('md5');var util=require(_0x4f4b('0x2'));var Redis=require(_0x4f4b('0x3'));var intUtil=require(_0x4f4b('0x4'));var config=require(_0x4f4b('0x5'));var logger=require(_0x4f4b('0x6'))(_0x4f4b('0x7'));config[_0x4f4b('0x8')]=_[_0x4f4b('0x9')](config['redis'],{'host':_0x4f4b('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4f4b('0x8')]));var headers={'Content-Type':_0x4f4b('0xb'),'Accept':'application/json'};function emit(_0x530efc,_0x543c1e,_0x3802a8){io['to'](_0x530efc)[_0x4f4b('0xc')](_0x543c1e,_0x3802a8);}function getTicket(_0x3c13fa,_0x24e7cb,_0x25485e,_0x229b26,_0x31fac3){logger[_0x4f4b('0xd')](_0x4f4b('0xe'));var _0x116a64=_[_0x4f4b('0xf')]({'responder_id':_0x24e7cb['id'],'requester_id':_0x25485e['id'],'name':util[_0x4f4b('0x10')](_0x4f4b('0x11'),_0x31fac3[_0x4f4b('0x12')]),'phone':_0x31fac3[_0x4f4b('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x4f4b('0x14')](_0x229b26[_0x4f4b('0x15')],_0x31fac3,'\x20'),'description':intUtil[_0x4f4b('0x14')](_0x229b26[_0x4f4b('0x16')],_0x31fac3,_0x4f4b('0x17')),'tags':getTags(_0x229b26['Tags'],'name')},getCustomFields(_0x229b26[_0x4f4b('0x18')],_0x31fac3));_0x116a64[_0x4f4b('0x19')]=_[_0x4f4b('0x1a')](_['keyBy'](_0x116a64[_0x4f4b('0x19')],'id'),_0x4f4b('0x1b'));return request({'uri':util[_0x4f4b('0x10')](_0x4f4b('0x1c'),_0x3c13fa[_0x4f4b('0x1d')]),'method':_0x4f4b('0x1e'),'body':_0x116a64})['then'](function(_0x3d6029){logger[_0x4f4b('0xd')](_0x4f4b('0x1f'));return _0x3d6029;});}function getUser(_0x1ba745,_0x50b92f){if(intUtil[_0x4f4b('0x20')](_0x50b92f)){return request({'uri':util[_0x4f4b('0x10')]('%s/api/v2/agents',_0x1ba745['remoteUri']),'qs':{'email':_0x50b92f}})[_0x4f4b('0x21')](function(_0x3b55d9){if(_0x3b55d9[_0x4f4b('0x22')]){logger['info'](_0x4f4b('0x23'));return _[_0x4f4b('0x24')](_0x3b55d9,function(_0x5a8453){return _0x5a8453['contact']['email']===_0x50b92f;});}else{logger[_0x4f4b('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x4f4b('0x25'),_0x1ba745['remoteUri'])})['then'](function(_0x2ce33c){logger[_0x4f4b('0xd')](_0x4f4b('0x26'));return _0x2ce33c;});}});}else{logger[_0x4f4b('0xd')](_0x4f4b('0x27'));return request({'uri':util[_0x4f4b('0x10')](_0x4f4b('0x25'),_0x1ba745[_0x4f4b('0x1d')])})[_0x4f4b('0x21')](function(_0x513dea){logger[_0x4f4b('0xd')](_0x4f4b('0x26'));return _0x513dea;});}}function getEndUser(_0xdaa3a,_0xd7ae0a,_0x4328ce){logger[_0x4f4b('0xd')]('Searching\x20enduser\x20with\x20phone',_0x4328ce);return request({'uri':util[_0x4f4b('0x10')](_0x4f4b('0x28'),_0xdaa3a[_0x4f4b('0x1d')]),'qs':{'phone':_0x4328ce}})['then'](function(_0xc2e6c1){if(_0xc2e6c1[_0x4f4b('0x22')]){logger[_0x4f4b('0xd')]('Enduser\x20found!');return _[_0x4f4b('0x24')](_0xc2e6c1,{'phone':_0x4328ce});}else{logger[_0x4f4b('0xd')](_0x4f4b('0x29'));return request({'uri':util[_0x4f4b('0x10')](_0x4f4b('0x28'),_0xdaa3a[_0x4f4b('0x1d')]),'method':'POST','body':{'name':_0xd7ae0a,'phone':_0x4328ce}})['then'](function(_0x3b4a1d){logger[_0x4f4b('0xd')](_0x4f4b('0x2a'));return _0x3b4a1d;});}});}function getAuth(_0x1dc99e){return util[_0x4f4b('0x10')](_0x4f4b('0x2b'),new Buffer(_0x1dc99e[_0x4f4b('0x2c')]+':X')['toString'](_0x4f4b('0x2d')));}function request(_0x217360){logger[_0x4f4b('0x2e')]('[HTTP]',JSON[_0x4f4b('0x2f')](_0x217360));return rp(_[_0x4f4b('0x9')](_0x217360,{'method':_0x4f4b('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x282e34,_0xa7f343){var _0x1db97c=[];if(_0x282e34&&_0x282e34[_0x4f4b('0x22')]>0x0){_0x1db97c=_[_0x4f4b('0x31')](_0x282e34,_0xa7f343);}return _0x1db97c;}function getCustomFields(_0x37bf12,_0x572eac){var _0x34145c=[];var _0x2ca4ad={'custom_fields':[]};if(_0x37bf12[_0x4f4b('0x22')]>0x0){_[_0x4f4b('0x32')](_0x37bf12,function(_0x4fd6ce){if(_0x4fd6ce['type']===_0x4f4b('0x33')&&_0x4fd6ce[_0x4f4b('0x34')]&&!_0x4fd6ce['customField']){_0x2ca4ad[_0x4fd6ce['nameField'][_0x4f4b('0x35')]()]=_0x4fd6ce[_0x4f4b('0x36')]['toString']();}else if(_0x4fd6ce[_0x4f4b('0x37')]==='string'&&_0x4fd6ce[_0x4f4b('0x38')]&&_0x4fd6ce[_0x4f4b('0x39')]){_0x2ca4ad[_0x4f4b('0x19')][_0x4f4b('0x3a')]({'id':_0x4fd6ce[_0x4f4b('0x38')],'value':_0x4fd6ce['content'][_0x4f4b('0x3b')]()});}else if(_0x4fd6ce['type']===_0x4f4b('0x3c')&&_0x4fd6ce['variableName']&&_0x4fd6ce[_0x4f4b('0x38')]&&_0x4fd6ce[_0x4f4b('0x39')]){_0x572eac[_0x4fd6ce[_0x4f4b('0x3d')]]&&_0x2ca4ad[_0x4f4b('0x19')][_0x4f4b('0x3a')]({'id':_0x4fd6ce[_0x4f4b('0x38')],'value':_0x572eac[_0x4fd6ce[_0x4f4b('0x3d')]][_0x4f4b('0x3b')]()});}else if(_0x4fd6ce[_0x4f4b('0x37')]===_0x4f4b('0x3e')&&_0x4fd6ce[_0x4f4b('0x3f')]&&_0x4fd6ce[_0x4f4b('0x3f')][_0x4f4b('0x40')]&&_0x4fd6ce[_0x4f4b('0x38')]&&_0x4fd6ce[_0x4f4b('0x39')]){_0x572eac[_0x4fd6ce['Variable']['name'][_0x4f4b('0x35')]()]&&_0x2ca4ad[_0x4f4b('0x19')][_0x4f4b('0x3a')]({'id':_0x4fd6ce[_0x4f4b('0x38')],'value':_0x572eac[_0x4fd6ce[_0x4f4b('0x3f')][_0x4f4b('0x40')][_0x4f4b('0x35')]()][_0x4f4b('0x3b')]()});}});}return _0x2ca4ad;}exports[_0x4f4b('0x41')]=function(_0x2436a,_0x64b729,_0x4ebee1,_0x4993a2,_0x348370,_0x4f853b){var _0x54d60c,_0x218477;_0x4f853b[_0x4f4b('0x1d')]=intUtil[_0x4f4b('0x42')](_0x4f853b['remoteUri']);_0x4f853b[_0x4f4b('0x43')]=intUtil[_0x4f4b('0x42')](_0x4f853b['serverUrl']);if(_0x348370&&_0x348370[_0x4f4b('0x44')]){logger[_0x4f4b('0xd')](_0x4f4b('0x45'),_0x4f4b('0x46'));_0x64b729['recordingURL']=util[_0x4f4b('0x10')](_0x4f4b('0x47'),_0x4f853b[_0x4f4b('0x43')],_0x64b729[_0x4f4b('0x48')],md5(_0x64b729[_0x4f4b('0x48')]));}else{_0x64b729[_0x4f4b('0x49')]='';}headers[_0x4f4b('0x4a')]=getAuth(_0x4f853b);return getUser(_0x4f853b,_0x4993a2['email'])[_0x4f4b('0x21')](function(_0x30c94d){_0x54d60c=_0x30c94d;logger[_0x4f4b('0xd')]('The\x20User\x20ID\x20is:',_0x54d60c['id']);return getEndUser(_0x4f853b,_0x64b729['calleridname'],_0x64b729[_0x4f4b('0x13')]);})['then'](function(_0x14cc8c){_0x218477=_0x14cc8c;logger['info']('The\x20Enduser\x20ID\x20is:',_0x218477['id']);return getTicket(_0x4f853b,_0x54d60c,_0x218477,_0x4ebee1,_0x64b729);})[_0x4f4b('0x21')](function(_0x19495d){if(_0x19495d&&_0x19495d['id']){logger['info'](_0x4f4b('0x1f'));logger[_0x4f4b('0xd')](_0x4f4b('0x4b'),_0x19495d['id']);logger[_0x4f4b('0xd')](_0x4f4b('0x45'),_0x4f4b('0x4c'));emit(util[_0x4f4b('0x10')]('user:%s',_0x4993a2[_0x4f4b('0x40')]),_0x4f4b('0x4d'),{'uri':util[_0x4f4b('0x10')]('%s/helpdesk/tickets/%d',_0x4f853b[_0x4f4b('0x1d')],_0x19495d['id'])});}})[_0x4f4b('0x4e')](function(_0x221f0f){logger['error'](_0x4f4b('0x45'),JSON[_0x4f4b('0x2f')](_0x221f0f));});};exports['outbound']=function(_0x43be41,_0x18ede6,_0x4e5a75,_0x1c88e8,_0x217c14,_0x5574b4,_0x46f6f5){var _0x18d77c,_0x4855c0;_0x5574b4[_0x4f4b('0x1d')]=intUtil['stripTrailingSlash'](_0x5574b4[_0x4f4b('0x1d')]);_0x5574b4['serverUrl']=intUtil[_0x4f4b('0x42')](_0x5574b4[_0x4f4b('0x43')]);if(_0x46f6f5&&_0x46f6f5[_0x4f4b('0x4f')]&&_0x46f6f5[_0x4f4b('0x4f')]!==_0x4f4b('0x50')){logger[_0x4f4b('0xd')](_0x4f4b('0x51'),_0x4f4b('0x46'));_0x18ede6['recordingURL']=util['format'](_0x4f4b('0x47'),_0x5574b4['serverUrl'],_0x18ede6[_0x4f4b('0x48')],md5(_0x18ede6[_0x4f4b('0x48')]));}headers[_0x4f4b('0x4a')]=getAuth(_0x5574b4);return getUser(_0x5574b4,_0x1c88e8[_0x4f4b('0x52')])['then'](function(_0x3a2522){_0x18d77c=_0x3a2522;logger[_0x4f4b('0xd')](_0x4f4b('0x53'),_0x18d77c['id']);return getEndUser(_0x5574b4,_0x18ede6['destcalleridname'],_0x18ede6[_0x4f4b('0x54')]);})[_0x4f4b('0x21')](function(_0x331fa4){_0x4855c0=_0x331fa4;logger[_0x4f4b('0xd')](_0x4f4b('0x55'),_0x4855c0['id']);return getTicket(_0x5574b4,_0x18d77c,_0x4855c0,_0x4e5a75,_0x18ede6);})[_0x4f4b('0x21')](function(_0x19f52c){if(_0x19f52c&&_0x19f52c['id']){logger[_0x4f4b('0xd')](_0x4f4b('0x1f'));logger[_0x4f4b('0xd')](_0x4f4b('0x4b'),_0x19f52c['id']);logger[_0x4f4b('0xd')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4f4b('0x10')](_0x4f4b('0x56'),_0x1c88e8[_0x4f4b('0x40')]),_0x4f4b('0x4d'),{'uri':util[_0x4f4b('0x10')](_0x4f4b('0x57'),_0x5574b4[_0x4f4b('0x1d')],_0x19f52c['id'])});}})[_0x4f4b('0x4e')](function(_0x480293){logger[_0x4f4b('0x58')](_0x4f4b('0x51'),JSON[_0x4f4b('0x2f')](_0x480293));});};exports['abandoned']=function(_0x347a5d,_0xf12975,_0x1f81e4,_0x27c70d,_0x3adf31,_0x5a2ab5){var _0x10475f,_0x22eeaa;_0x5a2ab5['remoteUri']=intUtil['stripTrailingSlash'](_0x5a2ab5[_0x4f4b('0x1d')]);_0x5a2ab5[_0x4f4b('0x43')]=intUtil['stripTrailingSlash'](_0x5a2ab5[_0x4f4b('0x43')]);if(_0x3adf31&&_0x3adf31[_0x4f4b('0x44')]){logger[_0x4f4b('0xd')](_0x4f4b('0x59'),_0x4f4b('0x46'));_0xf12975[_0x4f4b('0x49')]=util['format'](_0x4f4b('0x47'),_0x5a2ab5[_0x4f4b('0x43')],_0xf12975[_0x4f4b('0x48')],md5(_0xf12975[_0x4f4b('0x48')]));}else{_0xf12975[_0x4f4b('0x49')]='';}headers[_0x4f4b('0x4a')]=getAuth(_0x5a2ab5);return getUser(_0x5a2ab5,'')[_0x4f4b('0x21')](function(_0x31dad5){_0x10475f=_0x31dad5;logger[_0x4f4b('0xd')](_0x4f4b('0x53'),_0x10475f['id']);return getEndUser(_0x5a2ab5,_0xf12975[_0x4f4b('0x12')],_0xf12975[_0x4f4b('0x13')]);})[_0x4f4b('0x21')](function(_0x508f06){_0x22eeaa=_0x508f06;logger['info'](_0x4f4b('0x55'),_0x22eeaa['id']);return getTicket(_0x5a2ab5,_0x10475f,_0x22eeaa,_0x1f81e4,_0xf12975);})[_0x4f4b('0x21')](function(_0x571fbf){if(_0x571fbf){logger['info']('Ticket\x20created!');logger[_0x4f4b('0xd')]('The\x20Ticket\x20ID\x20is:',_0x571fbf['id']);}})['catch'](function(_0x81d4bb){logger[_0x4f4b('0x58')](_0x4f4b('0x59'),JSON[_0x4f4b('0x2f')](_0x81d4bb));});}; \ 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 13a34bb..bf74e32 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 _0x5c17=['All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','contacts','find','work_number','endUserId','Contact\x20found:','Contact\x20created:','message','POST','Creating\x20new\x20task','getString','format','YYYY-MM-DDTHH:mm:ss','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','remoteUri','serverUrl','stripTrailingSlash','toLowerCase','outbound','destcalleridnum','callDirection','queue','abandoned','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','moment','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','then','users','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','Getting\x20user\x20list','Getting\x20user\x20with\x20email','userEmail','agentEmail','userId','User\x20found:','Admin\x20selected','adminEmail','catch','/api/contacts/filters','Getting\x20contacts\x20filter','filters','forEach'];(function(_0x350fe1,_0x53971c){var _0x8b53d6=function(_0x5c05df){while(--_0x5c05df){_0x350fe1['push'](_0x350fe1['shift']());}};_0x8b53d6(++_0x53971c);}(_0x5c17,0x1ba));var _0x75c1=function(_0x15af87,_0x1a4bda){_0x15af87=_0x15af87-0x0;var _0x2593cc=_0x5c17[_0x15af87];return _0x2593cc;};'use strict';var _=require(_0x75c1('0x0'));var rp=require(_0x75c1('0x1'));var md5=require('md5');var util=require(_0x75c1('0x2'));var moment=require(_0x75c1('0x3'));var Promise=require('bluebird');var Redis=require(_0x75c1('0x4'));var intUtil=require('./util');var config=require(_0x75c1('0x5'));var logger=require(_0x75c1('0x6'))(_0x75c1('0x7'));config[_0x75c1('0x8')]=_[_0x75c1('0x9')](config[_0x75c1('0x8')],{'host':_0x75c1('0xa'),'port':0x18eb});var io=require(_0x75c1('0xb'))(new Redis(config[_0x75c1('0x8')]));function getAdminId(_0x4a729f,_0x904874,_0x4bd923,_0x56b5cb){return new Promise(function(_0x110d36,_0x4253e2){var _0x3f267e=![];var _0x566dab={'method':_0x75c1('0xc'),'uri':_0x56b5cb+_0x75c1('0xd'),'json':!![]};_0x566dab[_0x75c1('0xe')]=_0x4bd923;logger[_0x75c1('0xf')]('Getting\x20admin\x20information');return rp(_0x566dab)[_0x75c1('0x10')](function(_0x4c3340){if(_0x4c3340){var _0x5112a5=_0x4c3340[_0x75c1('0x11')];var _0x1ee135=null;for(_0x1ee135=0x0;_0x1ee135<_0x5112a5[_0x75c1('0x12')];_0x1ee135++){if(_0x5112a5[_0x1ee135][_0x75c1('0x13')]===_0x4a729f['adminEmail']){_0x4a729f[_0x75c1('0x14')]=_0x5112a5[_0x1ee135]['id'];_0x3f267e=!![];}}if(_0x3f267e){logger['info'](_0x75c1('0x15'),_0x4a729f['adminId']);_0x110d36(_0x4a729f);}else{_0x4253e2({'statusCode':0x194,'message':_0x75c1('0x16')});}}else{_0x4253e2({'statusCode':0x194,'message':_0x75c1('0x16')});}})['catch'](function(_0x59af1a){logger[_0x75c1('0x17')]('['+[_0x904874[_0x75c1('0x18')]()]+']',_0x59af1a['message']);_0x4253e2(_0x59af1a);});});}function getUser(_0xfc9727,_0x3f14f8,_0x46bdfc){return function(_0x3e3f92){return new Promise(function(_0x4c6c25,_0x2181b7){var _0xc102ba={'method':_0x75c1('0xc'),'uri':_0x46bdfc+_0x75c1('0xd'),'json':!![]};_0xc102ba[_0x75c1('0xe')]=_0x3f14f8;logger[_0x75c1('0xf')](_0x75c1('0x19'));return rp(_0xc102ba)[_0x75c1('0x10')](function(_0x506a3a){if(_0x506a3a){var _0x341d61=_0x506a3a[_0x75c1('0x11')];var _0x156571=![];var _0x3a132a=null;if(_0x3e3f92['agentEmail']!==null){logger['info'](_0x75c1('0x1a'),_0x3e3f92['agentEmail']);_0x3e3f92[_0x75c1('0x1b')]=_0x3e3f92['agentEmail'];for(_0x3a132a=0x0;_0x3a132a<_0x341d61[_0x75c1('0x12')];_0x3a132a++){if(_0x341d61[_0x3a132a][_0x75c1('0x13')]===_0x3e3f92[_0x75c1('0x1c')]){_0x156571=!![];_0x3e3f92[_0x75c1('0x1d')]=_0x341d61[_0x3a132a]['id'];logger['info'](_0x75c1('0x1e'),_0x3e3f92[_0x75c1('0x1d')]);}}}if(!_0x156571){logger[_0x75c1('0xf')](_0x75c1('0x1f'));_0x3e3f92[_0x75c1('0x1b')]=_0x3e3f92[_0x75c1('0x20')];_0x3e3f92[_0x75c1('0x1d')]=_0x3e3f92[_0x75c1('0x14')];_0x156571=!![];}if(_0x156571){_0x4c6c25(_0x3e3f92);}else{_0x2181b7({'statusCode':0x194,'message':_0x75c1('0x16')});}}else{_0x2181b7({'statusCode':0x194,'message':_0x75c1('0x16')});}})[_0x75c1('0x21')](function(_0x82f14a){logger[_0x75c1('0x17')]('['+[_0xfc9727[_0x75c1('0x18')]()]+']',_0x82f14a['message']);_0x2181b7(_0x82f14a);});});};}function getEndUser(_0x274e04,_0x4ea5ce,_0x4b614e){return function(_0x3ba800){return new Promise(function(_0x4898b9,_0x1774b5){var _0x586b09=0x0;var _0x4453a0={'method':_0x75c1('0xc'),'uri':_0x4b614e+_0x75c1('0x22'),'json':!![]};_0x4453a0[_0x75c1('0xe')]=_0x4ea5ce;logger[_0x75c1('0xf')](_0x75c1('0x23'));return rp(_0x4453a0)[_0x75c1('0x10')](function(_0x5fe6b7){_0x5fe6b7[_0x75c1('0x24')][_0x75c1('0x25')](function(_0xc0bcc0){if(_0xc0bcc0['name']===_0x75c1('0x26')){_0x586b09=_0xc0bcc0['id'];}});})[_0x75c1('0x10')](function(){logger[_0x75c1('0xf')](_0x75c1('0x27'));var _0x276b7a={'method':_0x75c1('0xc'),'uri':_0x4b614e+_0x75c1('0x28')+_0x586b09,'json':!![]};_0x276b7a['headers']=_0x4ea5ce;return rp(_0x276b7a);})[_0x75c1('0x10')](function(_0x3248e8){logger[_0x75c1('0xf')](_0x75c1('0x29'),_0x3ba800[_0x75c1('0x2a')]);if(_0x3248e8[_0x75c1('0x2b')]['length']>0x0){var _0x33cb8f=_[_0x75c1('0x2c')](_0x3248e8['contacts'],function(_0x58b6db){if(_0x58b6db[_0x75c1('0x2d')]===_0x3ba800['contactNumber']||_0x58b6db['mobile_number']===_0x3ba800['contactNumber']){return _0x58b6db;}});if(_0x33cb8f){_0x3ba800[_0x75c1('0x2e')]=_0x33cb8f['id'];logger[_0x75c1('0xf')](_0x75c1('0x2f'),_0x3ba800['endUserId']);_0x4898b9(_0x3ba800);}else{return createEndUser(_0x3ba800,_0x274e04,_0x4ea5ce,_0x4b614e)['then'](function(_0x319e45){logger[_0x75c1('0xf')](_0x75c1('0x30'),_0x3ba800[_0x75c1('0x2e')]);_0x4898b9(_0x319e45);});}}else{return createEndUser(_0x3ba800,_0x274e04,_0x4ea5ce,_0x4b614e)['then'](function(_0x1d43b2){logger['info']('Contact\x20created:',_0x3ba800[_0x75c1('0x2e')]);_0x4898b9(_0x1d43b2);});}})[_0x75c1('0x21')](function(_0x17e826){throw new Error(_0x17e826[_0x75c1('0x31')]);});});};}function createEndUser(_0x480443,_0x21bf7e,_0x1fee8d,_0x1e5615){return new Promise(function(_0x1f7f5f,_0xf5332b){var _0x2731d0=moment();var _0x539dfa={'method':_0x75c1('0x32'),'uri':_0x1e5615+'/api/contacts','body':{'contact':{'last_name':_0x480443['contactNumber'],'work_number':_0x480443[_0x75c1('0x2a')],'mobile_number':_0x480443[_0x75c1('0x2a')],'owner_id':_0x480443[_0x75c1('0x1d')],'created_at':_0x2731d0['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x539dfa[_0x75c1('0xe')]=_0x1fee8d;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x539dfa)[_0x75c1('0x10')](function(_0x49bff4){_0x480443['endUserId']=_0x49bff4['contact']['id'];_0x1f7f5f(_0x480443);})[_0x75c1('0x21')](function(_0x15e9fb){logger[_0x75c1('0x17')]('['+[_0x21bf7e[_0x75c1('0x18')]()]+']',_0x15e9fb[_0x75c1('0x31')]);_0xf5332b(_0x15e9fb[_0x75c1('0x31')]);});});}function getTicket(_0x53cada,_0x185aeb,_0x214ae8,_0x2686a8,_0x2f76b8){return function(_0x16a79e){logger['info'](_0x75c1('0x33'));return new Promise(function(_0x525458,_0x2d87d0){var _0x5bc130=moment();var _0x2ea657={'method':_0x75c1('0x32'),'uri':_0x214ae8+'/api/tasks','body':{'title':intUtil['getString'](_0x2686a8['Subjects'],_0x2f76b8,'\x20'),'description':intUtil[_0x75c1('0x34')](_0x2686a8['Descriptions'],_0x2f76b8,'\x0a'),'owner_id':_0x16a79e[_0x75c1('0x1d')],'creater_id':_0x16a79e['adminId'],'targetable_id':_0x16a79e[_0x75c1('0x2e')],'targetable_type':'Contact','created_at':_0x5bc130[_0x75c1('0x35')](_0x75c1('0x36')),'due_date':_0x5bc130['add'](0x1e,'m')[_0x75c1('0x35')](_0x75c1('0x36'))},'json':!![]};_0x2ea657[_0x75c1('0xe')]=_0x185aeb;return rp(_0x2ea657)[_0x75c1('0x10')](function(_0x130ac0){_0x16a79e[_0x75c1('0x37')]=_0x130ac0[_0x75c1('0x38')]['id'];logger[_0x75c1('0xf')](_0x75c1('0x39'),_0x16a79e['ticketId']);_0x525458(_0x16a79e);})[_0x75c1('0x21')](function(_0x163596){logger['error']('['+[_0x53cada[_0x75c1('0x18')]()]+']',_0x163596[_0x75c1('0x31')]);_0x2d87d0(_0x163596['message']);});});};}function emit(_0x4739a2,_0x3507da,_0x5f34b3){var _0x3960a4={'uri':_0x4739a2+'/contacts/'+_0x5f34b3};io['to'](util['format'](_0x75c1('0x3a'),_0x3507da))[_0x75c1('0x3b')](_0x75c1('0x3c'),_0x3960a4);}exports['cs']=function(_0x50fb2d,_0x213217,_0x28978f,_0x51fc51,_0x13a7ca,_0x2f60d8,_0x50f72b,_0x2b98f9){var _0x4af797={};var _0x5bae6a={'Authorization':'Token\x20token='+_0x2f60d8['apiKey']};_0x2f60d8[_0x75c1('0x3d')]=intUtil['stripTrailingSlash'](_0x2f60d8['remoteUri']);_0x2f60d8[_0x75c1('0x3e')]=intUtil[_0x75c1('0x3f')](_0x2f60d8[_0x75c1('0x3e')]);var _0xecffcc=_0x2f60d8['remoteUri'];_0x4af797[_0x75c1('0x20')]=_0x2f60d8['username'];_0x4af797['contactNumber']=_0x2b98f9[_0x75c1('0x40')]()===_0x75c1('0x41')?_0x213217[_0x75c1('0x42')]:_0x213217['calleridnum'];_0x4af797[_0x75c1('0x43')]=_0x2b98f9===_0x75c1('0x44')||_0x2b98f9===_0x75c1('0x45')?'queue':_0x75c1('0x41');if(_0x51fc51){_0x4af797[_0x75c1('0x1c')]=_0x51fc51[_0x75c1('0x13')];}var _0x11fe52=util[_0x75c1('0x35')](_0x75c1('0x46'),_0x2f60d8[_0x75c1('0x3e')],_0x213217[_0x75c1('0x47')],md5(_0x213217[_0x75c1('0x47')]));if(_0x13a7ca&&_0x13a7ca['monitor_format']){logger['info']('[QUEUE]',_0x75c1('0x48'));_0x213217[_0x75c1('0x49')]=_0x11fe52;}else if(_0x50f72b&&_0x50f72b[_0x75c1('0x4a')]&&_0x50f72b['recordingFormat']!==_0x75c1('0x4b')){logger[_0x75c1('0xf')](_0x75c1('0x4c'),'Recording\x20is\x20enabled!');_0x213217['recordingURL']=_0x11fe52;}else{_0x213217['recordingURL']='';}return getAdminId(_0x4af797,_0x2b98f9,_0x5bae6a,_0xecffcc)[_0x75c1('0x10')](getUser(_0x2b98f9,_0x5bae6a,_0xecffcc))[_0x75c1('0x10')](getEndUser(_0x2b98f9,_0x5bae6a,_0xecffcc))[_0x75c1('0x10')](getTicket(_0x2b98f9,_0x5bae6a,_0xecffcc,_0x28978f,_0x213217))['then'](function(_0x37e1ed){logger[_0x75c1('0xf')](util[_0x75c1('0x35')]('The\x20ticket\x20ID\x20is:\x20%s',_0x37e1ed[_0x75c1('0x37')]));if(_0x2b98f9!==_0x75c1('0x45')){logger['info']('['+[_0x2b98f9[_0x75c1('0x18')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0xecffcc,_0x51fc51[_0x75c1('0x4d')],_0x37e1ed[_0x75c1('0x2e')]);}})[_0x75c1('0x21')](function(_0x276907){logger['error']('['+[_0x2b98f9[_0x75c1('0x18')]()]+_0x75c1('0x4e'),util[_0x75c1('0x4f')](_0x276907,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0645=['/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','POST','getString','Subjects','Contact','format','add','ticketId','task','Task\x20created:','user:%s','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','outbound','destcalleridnum','calleridnum','callDirection','queue','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','inspect','md5','util','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis','defaults','localhost','GET','headers','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','message','/api/selector/owners','Getting\x20user\x20list','agentEmail','length','userId','Admin\x20selected','userEmail','catch','/api/contacts/filters','Getting\x20contacts\x20filter','forEach','name','All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','contacts','find','work_number','mobile_number','endUserId','Contact\x20found:','Contact\x20created:'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x0645,0x1bd));var _0x5064=function(_0x39d395,_0x3deab0){_0x39d395=_0x39d395-0x0;var _0x529bf4=_0x0645[_0x39d395];return _0x529bf4;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x5064('0x0'));var util=require(_0x5064('0x1'));var moment=require('moment');var Promise=require(_0x5064('0x2'));var Redis=require(_0x5064('0x3'));var intUtil=require(_0x5064('0x4'));var config=require('../../../../config/environment');var logger=require(_0x5064('0x5'))(_0x5064('0x6'));config[_0x5064('0x7')]=_[_0x5064('0x8')](config['redis'],{'host':_0x5064('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5064('0x7')]));function getAdminId(_0x158bb1,_0x27c178,_0x5b587b,_0xca1815){return new Promise(function(_0x1baa4e,_0x23bb83){var _0xb549be=![];var _0x8d4434={'method':_0x5064('0xa'),'uri':_0xca1815+'/api/selector/owners','json':!![]};_0x8d4434[_0x5064('0xb')]=_0x5b587b;logger['info'](_0x5064('0xc'));return rp(_0x8d4434)[_0x5064('0xd')](function(_0x1f6c98){if(_0x1f6c98){var _0x5b087d=_0x1f6c98[_0x5064('0xe')];var _0x2554d8=null;for(_0x2554d8=0x0;_0x2554d8<_0x5b087d['length'];_0x2554d8++){if(_0x5b087d[_0x2554d8][_0x5064('0xf')]===_0x158bb1[_0x5064('0x10')]){_0x158bb1[_0x5064('0x11')]=_0x5b087d[_0x2554d8]['id'];_0xb549be=!![];}}if(_0xb549be){logger[_0x5064('0x12')](_0x5064('0x13'),_0x158bb1[_0x5064('0x11')]);_0x1baa4e(_0x158bb1);}else{_0x23bb83({'statusCode':0x194,'message':_0x5064('0x14')});}}else{_0x23bb83({'statusCode':0x194,'message':_0x5064('0x14')});}})['catch'](function(_0x28139c){logger[_0x5064('0x15')]('['+[_0x27c178['toUpperCase']()]+']',_0x28139c[_0x5064('0x16')]);_0x23bb83(_0x28139c);});});}function getUser(_0x456514,_0x49b3a1,_0x31e470){return function(_0x565c2f){return new Promise(function(_0x597e7a,_0xcfdfb5){var _0x5519d1={'method':_0x5064('0xa'),'uri':_0x31e470+_0x5064('0x17'),'json':!![]};_0x5519d1[_0x5064('0xb')]=_0x49b3a1;logger[_0x5064('0x12')](_0x5064('0x18'));return rp(_0x5519d1)[_0x5064('0xd')](function(_0x15426c){if(_0x15426c){var _0x531a6c=_0x15426c[_0x5064('0xe')];var _0x4d273f=![];var _0x43aeea=null;if(_0x565c2f['agentEmail']!==null){logger[_0x5064('0x12')]('Getting\x20user\x20with\x20email',_0x565c2f['agentEmail']);_0x565c2f['userEmail']=_0x565c2f[_0x5064('0x19')];for(_0x43aeea=0x0;_0x43aeea<_0x531a6c[_0x5064('0x1a')];_0x43aeea++){if(_0x531a6c[_0x43aeea]['email']===_0x565c2f[_0x5064('0x19')]){_0x4d273f=!![];_0x565c2f[_0x5064('0x1b')]=_0x531a6c[_0x43aeea]['id'];logger[_0x5064('0x12')]('User\x20found:',_0x565c2f[_0x5064('0x1b')]);}}}if(!_0x4d273f){logger[_0x5064('0x12')](_0x5064('0x1c'));_0x565c2f[_0x5064('0x1d')]=_0x565c2f['adminEmail'];_0x565c2f[_0x5064('0x1b')]=_0x565c2f[_0x5064('0x11')];_0x4d273f=!![];}if(_0x4d273f){_0x597e7a(_0x565c2f);}else{_0xcfdfb5({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0xcfdfb5({'statusCode':0x194,'message':_0x5064('0x14')});}})[_0x5064('0x1e')](function(_0x149fb5){logger[_0x5064('0x15')]('['+[_0x456514['toUpperCase']()]+']',_0x149fb5[_0x5064('0x16')]);_0xcfdfb5(_0x149fb5);});});};}function getEndUser(_0x2501da,_0x706902,_0x538091){return function(_0x299920){return new Promise(function(_0x5a3001,_0x3eb8bf){var _0x41609c=0x0;var _0x20557d={'method':_0x5064('0xa'),'uri':_0x538091+_0x5064('0x1f'),'json':!![]};_0x20557d['headers']=_0x706902;logger[_0x5064('0x12')](_0x5064('0x20'));return rp(_0x20557d)['then'](function(_0x199139){_0x199139['filters'][_0x5064('0x21')](function(_0x2cb0f9){if(_0x2cb0f9[_0x5064('0x22')]===_0x5064('0x23')){_0x41609c=_0x2cb0f9['id'];}});})[_0x5064('0xd')](function(){logger[_0x5064('0x12')](_0x5064('0x24'));var _0x2ffdbd={'method':'GET','uri':_0x538091+_0x5064('0x25')+_0x41609c,'json':!![]};_0x2ffdbd[_0x5064('0xb')]=_0x706902;return rp(_0x2ffdbd);})[_0x5064('0xd')](function(_0x5d108f){logger[_0x5064('0x12')](_0x5064('0x26'),_0x299920[_0x5064('0x27')]);if(_0x5d108f[_0x5064('0x28')][_0x5064('0x1a')]>0x0){var _0x3b8e59=_[_0x5064('0x29')](_0x5d108f[_0x5064('0x28')],function(_0x2cd386){if(_0x2cd386[_0x5064('0x2a')]===_0x299920[_0x5064('0x27')]||_0x2cd386[_0x5064('0x2b')]===_0x299920[_0x5064('0x27')]){return _0x2cd386;}});if(_0x3b8e59){_0x299920[_0x5064('0x2c')]=_0x3b8e59['id'];logger[_0x5064('0x12')](_0x5064('0x2d'),_0x299920['endUserId']);_0x5a3001(_0x299920);}else{return createEndUser(_0x299920,_0x2501da,_0x706902,_0x538091)[_0x5064('0xd')](function(_0x14fff3){logger[_0x5064('0x12')]('Contact\x20created:',_0x299920['endUserId']);_0x5a3001(_0x14fff3);});}}else{return createEndUser(_0x299920,_0x2501da,_0x706902,_0x538091)['then'](function(_0x5617df){logger[_0x5064('0x12')](_0x5064('0x2e'),_0x299920[_0x5064('0x2c')]);_0x5a3001(_0x5617df);});}})[_0x5064('0x1e')](function(_0x567c48){throw new Error(_0x567c48[_0x5064('0x16')]);});});};}function createEndUser(_0x364f0d,_0x2620ac,_0x17abd8,_0x17e8b4){return new Promise(function(_0x16ffa9,_0x3712ed){var _0x425773=moment();var _0x4fe54d={'method':'POST','uri':_0x17e8b4+_0x5064('0x2f'),'body':{'contact':{'last_name':_0x364f0d[_0x5064('0x27')],'work_number':_0x364f0d[_0x5064('0x27')],'mobile_number':_0x364f0d[_0x5064('0x27')],'owner_id':_0x364f0d[_0x5064('0x1b')],'created_at':_0x425773['format'](_0x5064('0x30'))}},'json':!![]};_0x4fe54d[_0x5064('0xb')]=_0x17abd8;logger['info'](_0x5064('0x31'));return rp(_0x4fe54d)[_0x5064('0xd')](function(_0x877f57){_0x364f0d['endUserId']=_0x877f57['contact']['id'];_0x16ffa9(_0x364f0d);})[_0x5064('0x1e')](function(_0x520ced){logger[_0x5064('0x15')]('['+[_0x2620ac['toUpperCase']()]+']',_0x520ced[_0x5064('0x16')]);_0x3712ed(_0x520ced[_0x5064('0x16')]);});});}function getTicket(_0x273efb,_0x41dc49,_0x3fe2f1,_0x17b66a,_0x4ad30f){return function(_0x219ed1){logger[_0x5064('0x12')](_0x5064('0x32'));return new Promise(function(_0x27184e,_0xb19a3c){var _0x1fe606=moment();var _0x3af522={'method':_0x5064('0x33'),'uri':_0x3fe2f1+'/api/tasks','body':{'title':intUtil[_0x5064('0x34')](_0x17b66a[_0x5064('0x35')],_0x4ad30f,'\x20'),'description':intUtil[_0x5064('0x34')](_0x17b66a['Descriptions'],_0x4ad30f,'\x0a'),'owner_id':_0x219ed1[_0x5064('0x1b')],'creater_id':_0x219ed1[_0x5064('0x11')],'targetable_id':_0x219ed1[_0x5064('0x2c')],'targetable_type':_0x5064('0x36'),'created_at':_0x1fe606[_0x5064('0x37')](_0x5064('0x30')),'due_date':_0x1fe606[_0x5064('0x38')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x3af522['headers']=_0x41dc49;return rp(_0x3af522)[_0x5064('0xd')](function(_0x2ff412){_0x219ed1[_0x5064('0x39')]=_0x2ff412[_0x5064('0x3a')]['id'];logger['info'](_0x5064('0x3b'),_0x219ed1[_0x5064('0x39')]);_0x27184e(_0x219ed1);})['catch'](function(_0x22cf08){logger['error']('['+[_0x273efb['toUpperCase']()]+']',_0x22cf08[_0x5064('0x16')]);_0xb19a3c(_0x22cf08[_0x5064('0x16')]);});});};}function emit(_0x861f9e,_0x510d56,_0x595d12){var _0x30d092={'uri':_0x861f9e+'/contacts/'+_0x595d12};io['to'](util[_0x5064('0x37')](_0x5064('0x3c'),_0x510d56))['emit']('trigger:browser:url',_0x30d092);}exports['cs']=function(_0x21d7e1,_0x35a2fe,_0x4ab5d2,_0x1cd863,_0x2e958c,_0xd36de0,_0x4ced0c,_0x5604e4){var _0x57d1b9={};var _0x4c01c5={'Authorization':_0x5064('0x3d')+_0xd36de0[_0x5064('0x3e')]};_0xd36de0[_0x5064('0x3f')]=intUtil['stripTrailingSlash'](_0xd36de0[_0x5064('0x3f')]);_0xd36de0[_0x5064('0x40')]=intUtil[_0x5064('0x41')](_0xd36de0[_0x5064('0x40')]);var _0x1fd376=_0xd36de0[_0x5064('0x3f')];_0x57d1b9['adminEmail']=_0xd36de0[_0x5064('0x42')];_0x57d1b9[_0x5064('0x27')]=_0x5604e4['toLowerCase']()===_0x5064('0x43')?_0x35a2fe[_0x5064('0x44')]:_0x35a2fe[_0x5064('0x45')];_0x57d1b9[_0x5064('0x46')]=_0x5604e4===_0x5064('0x47')||_0x5604e4==='abandoned'?'queue':_0x5064('0x43');if(_0x1cd863){_0x57d1b9['agentEmail']=_0x1cd863[_0x5064('0xf')];}var _0x23df48=util[_0x5064('0x37')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xd36de0[_0x5064('0x40')],_0x35a2fe['uniqueid'],md5(_0x35a2fe[_0x5064('0x48')]));if(_0x2e958c&&_0x2e958c[_0x5064('0x49')]){logger[_0x5064('0x12')](_0x5064('0x4a'),_0x5064('0x4b'));_0x35a2fe['recordingURL']=_0x23df48;}else if(_0x4ced0c&&_0x4ced0c[_0x5064('0x4c')]&&_0x4ced0c[_0x5064('0x4c')]!==_0x5064('0x4d')){logger[_0x5064('0x12')](_0x5064('0x4e'),_0x5064('0x4b'));_0x35a2fe[_0x5064('0x4f')]=_0x23df48;}else{_0x35a2fe['recordingURL']='';}return getAdminId(_0x57d1b9,_0x5604e4,_0x4c01c5,_0x1fd376)['then'](getUser(_0x5604e4,_0x4c01c5,_0x1fd376))[_0x5064('0xd')](getEndUser(_0x5604e4,_0x4c01c5,_0x1fd376))[_0x5064('0xd')](getTicket(_0x5604e4,_0x4c01c5,_0x1fd376,_0x4ab5d2,_0x35a2fe))[_0x5064('0xd')](function(_0x549149){logger[_0x5064('0x12')](util[_0x5064('0x37')](_0x5064('0x50'),_0x549149['ticketId']));if(_0x5604e4!=='abandoned'){logger[_0x5064('0x12')]('['+[_0x5604e4['toUpperCase']()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x1fd376,_0x1cd863['name'],_0x549149['endUserId']);}})[_0x5064('0x1e')](function(_0x35d220){logger[_0x5064('0x15')]('['+[_0x5604e4['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x5064('0x51')](_0x35d220,{'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 24016f2..c7acf5a 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 _0xa9e0=['./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','vtiger','servicenow','exec','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','log','abandoned','zendesk','zoho','desk','freshsales','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./freshdesk','./desk'];(function(_0x311236,_0x166e1c){var _0x5dde0c=function(_0x9f6abc){while(--_0x9f6abc){_0x311236['push'](_0x311236['shift']());}};_0x5dde0c(++_0x166e1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var zendesk=require(_0x0a9e('0x2'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x0a9e('0x3'));var zoho=require('./zoho');var desk=require(_0x0a9e('0x4'));var vtiger=require(_0x0a9e('0x5'));var servicenow=require(_0x0a9e('0x6'));var dynamics365=require(_0x0a9e('0x7'));var freshsales=require(_0x0a9e('0x8'));var integrations=['zendesk',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'zoho','desk',_0x0a9e('0xc'),'dynamics365','freshsales',_0x0a9e('0xd')];exports[_0x0a9e('0xe')]=function(_0x307b3e,_0x3ab53f,_0xfeb75b,_0xbd1168,_0x4a4c56,_0x50dfb2){if(_0xfeb75b){if(_['includes'](integrations,_0x307b3e['data1'][_0x0a9e('0xf')]())){try{var _0x36471c=null;var _0xd5b662='';var _0x26d672=_0xfeb75b[_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')]()];if(_0x26d672){var _0x5db4b0=_0x26d672[_0x307b3e[_0x0a9e('0x11')]];if(_0x5db4b0){var _0x239b12=_[_0x0a9e('0x12')](_0x5db4b0[_0x0a9e('0x13')],{'id':parseInt(_0x307b3e[_0x0a9e('0x14')],0xa)});if(_0x239b12){if(_0xbd1168){if(_0x4a4c56&&_0x3ab53f[_0x0a9e('0x15')]){_0xd5b662='queue';}else if(_0x3ab53f[_0x0a9e('0x16')]){_0xd5b662='outbound';}else{console[_0x0a9e('0x17')]('EVENT\x20UNKNOWN',_0x3ab53f);}}else{_0xd5b662=_0x0a9e('0x18');}switch(_0x307b3e[_0x0a9e('0x10')]['toLowerCase']()){case _0x0a9e('0x19'):zendesk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case'salesforce':salesforce[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xa'):sugarcrm[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xb'):freshdesk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1a'):zoho[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1b'):desk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xc'):vtiger[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1c'):freshsales['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);case _0x0a9e('0xd'):servicenow['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);break;case _0x0a9e('0x1d'):dynamics365['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);break;default:console[_0x0a9e('0x17')](_0x0a9e('0x1e'));}}else{_0x36471c=require(_0x0a9e('0x1f'))(_0x307b3e[_0x0a9e('0x10')]['toLowerCase']());_0x36471c[_0x0a9e('0x20')](_0x0a9e('0x21'),util['format'](_0x0a9e('0x22'),_0x307b3e['data1']['toLowerCase'](),_0x307b3e[_0x0a9e('0x14')]));}}else{_0x36471c=require(_0x0a9e('0x1f'))(_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')]());_0x36471c['error'](_0x0a9e('0x21'),util[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')](),_0x307b3e[_0x0a9e('0x11')]));}}else{}}catch(_0x16b1ca){console['error'](_0x16b1ca);}}}}; \ No newline at end of file +var _0xa9e0=['./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','vtiger','servicenow','exec','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','log','abandoned','zendesk','zoho','desk','freshsales','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./freshdesk','./desk'];(function(_0x4fd687,_0x325240){var _0x4fdd44=function(_0x2b7f39){while(--_0x2b7f39){_0x4fd687['push'](_0x4fd687['shift']());}};_0x4fdd44(++_0x325240);}(_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 zendesk=require(_0x0a9e('0x2'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x0a9e('0x3'));var zoho=require('./zoho');var desk=require(_0x0a9e('0x4'));var vtiger=require(_0x0a9e('0x5'));var servicenow=require(_0x0a9e('0x6'));var dynamics365=require(_0x0a9e('0x7'));var freshsales=require(_0x0a9e('0x8'));var integrations=['zendesk',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'zoho','desk',_0x0a9e('0xc'),'dynamics365','freshsales',_0x0a9e('0xd')];exports[_0x0a9e('0xe')]=function(_0x307b3e,_0x3ab53f,_0xfeb75b,_0xbd1168,_0x4a4c56,_0x50dfb2){if(_0xfeb75b){if(_['includes'](integrations,_0x307b3e['data1'][_0x0a9e('0xf')]())){try{var _0x36471c=null;var _0xd5b662='';var _0x26d672=_0xfeb75b[_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')]()];if(_0x26d672){var _0x5db4b0=_0x26d672[_0x307b3e[_0x0a9e('0x11')]];if(_0x5db4b0){var _0x239b12=_[_0x0a9e('0x12')](_0x5db4b0[_0x0a9e('0x13')],{'id':parseInt(_0x307b3e[_0x0a9e('0x14')],0xa)});if(_0x239b12){if(_0xbd1168){if(_0x4a4c56&&_0x3ab53f[_0x0a9e('0x15')]){_0xd5b662='queue';}else if(_0x3ab53f[_0x0a9e('0x16')]){_0xd5b662='outbound';}else{console[_0x0a9e('0x17')]('EVENT\x20UNKNOWN',_0x3ab53f);}}else{_0xd5b662=_0x0a9e('0x18');}switch(_0x307b3e[_0x0a9e('0x10')]['toLowerCase']()){case _0x0a9e('0x19'):zendesk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case'salesforce':salesforce[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xa'):sugarcrm[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xb'):freshdesk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1a'):zoho[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1b'):desk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xc'):vtiger[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1c'):freshsales['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);case _0x0a9e('0xd'):servicenow['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);break;case _0x0a9e('0x1d'):dynamics365['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);break;default:console[_0x0a9e('0x17')](_0x0a9e('0x1e'));}}else{_0x36471c=require(_0x0a9e('0x1f'))(_0x307b3e[_0x0a9e('0x10')]['toLowerCase']());_0x36471c[_0x0a9e('0x20')](_0x0a9e('0x21'),util['format'](_0x0a9e('0x22'),_0x307b3e['data1']['toLowerCase'](),_0x307b3e[_0x0a9e('0x14')]));}}else{_0x36471c=require(_0x0a9e('0x1f'))(_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')]());_0x36471c['error'](_0x0a9e('0x21'),util[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')](),_0x307b3e[_0x0a9e('0x11')]));}}else{}}catch(_0x16b1ca){console['error'](_0x16b1ca);}}}}; \ 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 5a724d5..04c2f23 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 _0x355c=['[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','Salesforce\x20account\x20type\x20not\x20recognized','stringify','abandoned','[ABANDONED]','[ABANDONED]\x20Ticket\x20%s\x20created.','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','ticketType','utc','getString','Subjects','Descriptions','Case','assign','ContactId','sobject','isNil','validateEmail','find','execute','length','Email','info','resolve','Name','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','Task','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','Contact','lead','Lead','Phone','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','contact','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','create','forEach','type','string','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','concat','remoteUri','login','username','queue','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch'];(function(_0x22898f,_0x111540){var _0x45beea=function(_0x55a5d7){while(--_0x55a5d7){_0x22898f['push'](_0x22898f['shift']());}};_0x45beea(++_0x111540);}(_0x355c,0x1bb));var _0xc355=function(_0x5a9fb9,_0xb126c4){_0x5a9fb9=_0x5a9fb9-0x0;var _0x110430=_0x355c[_0x5a9fb9];return _0x110430;};'use strict';var _=require(_0xc355('0x0'));var rp=require(_0xc355('0x1'));var moment=require(_0xc355('0x2'));var BPromise=require(_0xc355('0x3'));var md5=require(_0xc355('0x4'));var jsforce=require(_0xc355('0x5'));var util=require('util');var Redis=require(_0xc355('0x6'));var intUtil=require(_0xc355('0x7'));var config=require(_0xc355('0x8'));var logger=require(_0xc355('0x9'))(_0xc355('0xa'));config[_0xc355('0xb')]=_[_0xc355('0xc')](config[_0xc355('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xc355('0xd'))(new Redis(config[_0xc355('0xb')]));function emit(_0x4e0121,_0x34d09f,_0x286689){io['to'](_0x4e0121)[_0xc355('0xe')](_0x34d09f,_0x286689);}function getTicket(_0x48bfa0,_0x450bfd,_0x1a00e2,_0x24ff4e,_0xc05caa,_0x2e4949,_0x2454fc,_0x41cf93){var _0x34129e={};if(_0x24ff4e[_0xc355('0xf')]==='Task'){_0x34129e=Object['assign']({},{'OwnerId':_0x450bfd['id'],'ActivityDate':moment[_0xc355('0x10')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xc355('0x11')](_0x24ff4e[_0xc355('0x12')],_0xc05caa,'\x20'),'Description':intUtil[_0xc355('0x11')](_0x24ff4e[_0xc355('0x13')],_0xc05caa,'\x0a')},getCustomFields(_0x2e4949,_0xc05caa));if(_0x1a00e2){_0x34129e['WhoId']=_0x1a00e2['id'];}}else if(_0x24ff4e['ticketType']===_0xc355('0x14')){_0x34129e=Object[_0xc355('0x15')]({},{'OwnerId':_0x450bfd['id'],'Subject':intUtil[_0xc355('0x11')](_0x24ff4e[_0xc355('0x12')],_0xc05caa,'\x20'),'Description':intUtil[_0xc355('0x11')](_0x24ff4e[_0xc355('0x13')],_0xc05caa,'\x0a')},getCustomFields(_0x2e4949,_0xc05caa));if(_0x1a00e2){_0x34129e[_0xc355('0x16')]=_0x1a00e2['id'];}}return _0x2454fc[_0xc355('0x17')](_0x24ff4e[_0xc355('0xf')])['create'](_0x34129e);}function getUser(_0x503b6b,_0x218bad,_0x17d07b){if(!_[_0xc355('0x18')](_0x218bad)&&intUtil[_0xc355('0x19')](_0x218bad)){var _0x179227={'Email':_0x218bad};var _0x2c8f03={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x17d07b[_0xc355('0x17')]('User')[_0xc355('0x1a')](_0x179227,_0x2c8f03)[_0xc355('0x1b')]()['then'](function(_0x434c8c){if(_0x434c8c[_0xc355('0x1c')]){var _0x51dd00=_[_0xc355('0x1a')](_0x434c8c,function(_0x2c5247){return _0x2c5247[_0xc355('0x1d')]===_0x218bad;});if(_0x51dd00){logger[_0xc355('0x1e')]('Agent\x20%s\x20found.',_0x218bad);return BPromise[_0xc355('0x1f')]({'id':_0x51dd00['Id'],'name':_0x51dd00[_0xc355('0x20')]});}}else{logger[_0xc355('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x218bad);return _0x17d07b[_0xc355('0x21')]()['then'](function(_0x4b0620){return BPromise[_0xc355('0x1f')]({'id':_0x4b0620[_0xc355('0x22')],'name':_0x4b0620[_0xc355('0x23')]});});}});}else{logger['info'](_0xc355('0x24'),_0x218bad);return _0x17d07b[_0xc355('0x21')]()[_0xc355('0x25')](function(_0x53f61b){return BPromise[_0xc355('0x1f')]({'id':_0x53f61b['user_id'],'name':_0x53f61b['display_name']});});}}function getEndUser(_0x179346,_0x3f0d18,_0x20af66,_0x2a5960,_0x5140c2){var _0x157493={'Phone':_0x2a5960};var _0x5e7536={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xc355('0x1f')]()[_0xc355('0x25')](function(){if(_0x3f0d18[_0xc355('0xf')]===_0xc355('0x26')){logger[_0xc355('0x1e')](_0xc355('0x27'),_0x2a5960,_0x3f0d18[_0xc355('0x28')]);switch(_0x3f0d18['moduleSearch']){case'contact_lead':return _0x5140c2[_0xc355('0x17')](_0xc355('0x29'))[_0xc355('0x1a')](_0x157493,_0x5e7536)[_0xc355('0x1b')]()[_0xc355('0x25')](function(_0x20a7f7){if(_0x20a7f7&&_0x20a7f7[_0xc355('0x1c')]){return _0x20a7f7;}else{return _0x5140c2[_0xc355('0x17')]('Lead')[_0xc355('0x1a')](_0x157493,_0x5e7536);}});case'contact':return _0x5140c2['sobject'](_0xc355('0x29'))[_0xc355('0x1a')](_0x157493,_0x5e7536)['execute']();case _0xc355('0x2a'):return _0x5140c2[_0xc355('0x17')](_0xc355('0x2b'))[_0xc355('0x1a')](_0x157493,_0x5e7536);default:return null;}}else if(_0x3f0d18[_0xc355('0xf')]===_0xc355('0x14')){logger['info'](_0xc355('0x27'),_0x2a5960,'contact');return _0x5140c2['sobject'](_0xc355('0x29'))[_0xc355('0x1a')](_0x157493,_0x5e7536)[_0xc355('0x1b')]();}})['then'](function(_0x374b64){if(_0x374b64&&_0x374b64[_0xc355('0x1c')]){var _0x2014d9=_[_0xc355('0x1a')](_0x374b64,function(_0xf6fd28){return _0xf6fd28[_0xc355('0x2c')]===_0x2a5960;});if(_0x2014d9){return BPromise[_0xc355('0x1f')]({'id':_0x2014d9['Id'],'name':_0x2014d9['Name'],'phone':_0x2014d9[_0xc355('0x2c')]});}}})[_0xc355('0x25')](function(_0xabbf96){if(_0xabbf96){logger[_0xc355('0x1e')]('Enduser\x20with\x20phone\x20%s\x20found.',_0x2a5960);return BPromise[_0xc355('0x1f')](_0xabbf96);}else{logger[_0xc355('0x1e')](_0xc355('0x2d'),_0x2a5960);var _0x1a893a={'LastName':_0x20af66!==_0xc355('0x2e')?_0x20af66:util[_0xc355('0x2f')](_0xc355('0x30'),_0x2a5960),'Phone':_0x2a5960};if(_0x3f0d18['moduleCreate']){if(_0x3f0d18[_0xc355('0x31')]===_0xc355('0x32')){logger['info'](_0xc355('0x33'),_0x2a5960,_0x3f0d18[_0xc355('0x31')]);}else if(_0x3f0d18['moduleCreate']===_0xc355('0x2a')&&_0x3f0d18[_0xc355('0xf')]==='Task'){logger[_0xc355('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x2a5960,_0x3f0d18[_0xc355('0x31')]);_0x1a893a[_0xc355('0x34')]=_0xc355('0x35');}else{return null;}}return _0x5140c2[_0xc355('0x17')](_['upperFirst'](_0x3f0d18[_0xc355('0x31')]))[_0xc355('0x36')](_0x1a893a);}});}function getCustomFields(_0xbdbd26,_0xe15158){var _0x45efb8={};if(_0xbdbd26[_0xc355('0x1c')]>0x0){_[_0xc355('0x37')](_0xbdbd26,function(_0x2a4b87){if(_0x2a4b87[_0xc355('0x38')]===_0xc355('0x39')&&_0x2a4b87[_0xc355('0x3a')]){_0x45efb8[_0x2a4b87[_0xc355('0x3a')]]=_0x2a4b87[_0xc355('0x3b')]['toString']();}else if(_0x2a4b87[_0xc355('0x38')]===_0xc355('0x3c')&&_0x2a4b87[_0xc355('0x3d')]&&_0x2a4b87['idField']){_0xe15158[_0x2a4b87['variableName']]&&(_0x45efb8[_0x2a4b87[_0xc355('0x3a')]]=_0xe15158[_0x2a4b87['variableName']][_0xc355('0x3e')]());}else if(_0x2a4b87[_0xc355('0x38')]===_0xc355('0x3f')&&_0x2a4b87[_0xc355('0x40')]&&_0x2a4b87[_0xc355('0x40')][_0xc355('0x41')]&&_0x2a4b87['idField']){_0xe15158[_0x2a4b87['Variable'][_0xc355('0x41')][_0xc355('0x42')]()]&&(_0x45efb8[_0x2a4b87['idField']]=_0xe15158[_0x2a4b87[_0xc355('0x40')][_0xc355('0x41')]['toLowerCase']()][_0xc355('0x3e')]());}});}return _0x45efb8;}function getConnection(_0x114593){var _0x2e4491=_0x114593[_0xc355('0x43')][_0xc355('0x44')](_0x114593['securityToken']);var _0x1f0133=new jsforce['Connection']({'oauth2':{'loginUrl':_0x114593[_0xc355('0x45')]||'https://login.salesforce.com','clientId':_0x114593['clientId'],'clientSecret':_0x114593['clientSecret']}});return _0x1f0133[_0xc355('0x46')](_0x114593[_0xc355('0x47')],_0x2e4491)[_0xc355('0x25')](function(){logger[_0xc355('0x1e')]('Connection\x20established.');return _0x1f0133;});}exports[_0xc355('0x48')]=function(_0xcc3644,_0x278720,_0x164b8f,_0x3ed2b5,_0x4e2efe,_0xa55131){var _0x11d81c,_0x50184c,_0x5bd9ea,_0xd10e89;_0xa55131[_0xc355('0x49')]=intUtil[_0xc355('0x4a')](_0xa55131[_0xc355('0x49')]);_0xa55131[_0xc355('0x45')]=intUtil[_0xc355('0x4a')](_0xa55131[_0xc355('0x45')]);if(_0x4e2efe&&_0x4e2efe['monitor_format']){logger[_0xc355('0x1e')]('[QUEUE]',_0xc355('0x4b'));_0x278720['recordingURL']=util['format'](_0xc355('0x4c'),_0xa55131[_0xc355('0x49')],_0x278720['uniqueid'],md5(_0x278720[_0xc355('0x4d')]));}else{_0x278720['recordingURL']='';}return getConnection(_0xa55131)[_0xc355('0x25')](function(_0x3510b0){_0xd10e89=_0x3510b0;return getUser(_0xa55131,_0x3ed2b5[_0xc355('0x4e')],_0xd10e89);})['then'](function(_0x216476){_0x11d81c=_0x216476;return getEndUser(_0xa55131,_0x164b8f,_0x278720[_0xc355('0x4f')],_0x278720[_0xc355('0x50')],_0xd10e89);})[_0xc355('0x25')](function(_0x6422ec){_0x50184c=_0x6422ec;return getTicket(_0xa55131,_0x11d81c,_0x50184c,_0x164b8f,_0x278720,_0x164b8f[_0xc355('0x51')],_0xd10e89,_0xc355('0x48'));})[_0xc355('0x25')](function(_0x212104){_0x5bd9ea=_0x212104;logger[_0xc355('0x1e')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x5bd9ea['id']);logger['info'](_0xc355('0x52'),_0x5bd9ea['id'],_0x3ed2b5[_0xc355('0x41')],_0xa55131[_0xc355('0x38')]);switch(_0xa55131[_0xc355('0x38')]){case _0xc355('0x53'):emit(util['format'](_0xc355('0x54'),_0x3ed2b5['name']),_0xc355('0x55'),{'recordId':_0x5bd9ea['id']});break;case _0xc355('0x56'):emit(util[_0xc355('0x2f')](_0xc355('0x54'),_0x3ed2b5[_0xc355('0x41')]),'trigger:browser:url',{'uri':util[_0xc355('0x2f')](_0xc355('0x57'),_0xd10e89[_0xc355('0x58')],_0x5bd9ea['id'])});break;default:logger[_0xc355('0x59')](_0xc355('0x5a'));}})[_0xc355('0x5b')](function(_0x1b7c1f){logger[_0xc355('0x59')](_0xc355('0x5c'),JSON['stringify'](_0x1b7c1f));});};exports[_0xc355('0x5d')]=function(_0x122570,_0x401700,_0x2eaca9,_0x2ca658,_0x240391,_0x53f541,_0xdf33e9){var _0x5621c9,_0x777e4e,_0x2c0a6b,_0x2170c2;_0x53f541['serverUrl']=intUtil['stripTrailingSlash'](_0x53f541[_0xc355('0x49')]);_0x53f541[_0xc355('0x45')]=intUtil['stripTrailingSlash'](_0x53f541[_0xc355('0x45')]);if(_0xdf33e9&&_0xdf33e9[_0xc355('0x5e')]&&_0xdf33e9[_0xc355('0x5e')]!==_0xc355('0x5f')){logger[_0xc355('0x1e')](_0xc355('0x60'),_0xc355('0x4b'));_0x401700[_0xc355('0x61')]=util[_0xc355('0x2f')](_0xc355('0x4c'),_0x53f541['serverUrl'],_0x401700['uniqueid'],md5(_0x401700[_0xc355('0x4d')]));}return getConnection(_0x53f541)['then'](function(_0x285bc7){_0x2170c2=_0x285bc7;return getUser(_0x53f541,_0x2ca658[_0xc355('0x4e')],_0x2170c2);})['then'](function(_0x11dc9f){_0x5621c9=_0x11dc9f;return getEndUser(_0x53f541,_0x2eaca9,_0x401700[_0xc355('0x62')],_0x401700[_0xc355('0x63')],_0x2170c2);})[_0xc355('0x25')](function(_0x39ba7d){_0x777e4e=_0x39ba7d;return getTicket(_0x53f541,_0x5621c9,_0x777e4e,_0x2eaca9,_0x401700,_0x2eaca9[_0xc355('0x51')],_0x2170c2,'outbound');})[_0xc355('0x25')](function(_0xe3bafd){_0x2c0a6b=_0xe3bafd;logger[_0xc355('0x1e')](_0xc355('0x64'),_0x2c0a6b['id']);logger[_0xc355('0x1e')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2c0a6b['id'],_0x2ca658[_0xc355('0x41')],_0x53f541['type']);switch(_0x53f541[_0xc355('0x38')]){case _0xc355('0x53'):emit(util[_0xc355('0x2f')](_0xc355('0x54'),_0x2ca658['name']),'trigger:salesforce:display',{'recordId':_0x2c0a6b['id']});break;case _0xc355('0x56'):emit(util[_0xc355('0x2f')](_0xc355('0x54'),_0x2ca658[_0xc355('0x41')]),'trigger:browser:url',{'uri':util[_0xc355('0x2f')]('%s/%s/e',_0x2170c2[_0xc355('0x58')],_0x2c0a6b['id'])});break;default:logger[_0xc355('0x59')](_0xc355('0x60'),_0xc355('0x65'));}})['catch'](function(_0x1bd050){logger['error'](_0xc355('0x60'),JSON[_0xc355('0x66')](_0x1bd050));});};exports[_0xc355('0x67')]=function(_0x17b289,_0x4e082d,_0x4cbd8a,_0x2e5c02,_0x5df1b1,_0x2e9cf3){var _0x2e8ab2,_0x2c2a6d,_0x2cb13f,_0x9c287c;_0x2e9cf3['serverUrl']=intUtil[_0xc355('0x4a')](_0x2e9cf3[_0xc355('0x49')]);_0x2e9cf3[_0xc355('0x45')]=intUtil[_0xc355('0x4a')](_0x2e9cf3[_0xc355('0x45')]);if(_0x5df1b1&&_0x5df1b1['monitor_format']){logger[_0xc355('0x1e')](_0xc355('0x68'),'Recording\x20is\x20enabled!');_0x4e082d[_0xc355('0x61')]=util[_0xc355('0x2f')](_0xc355('0x4c'),_0x2e9cf3['serverUrl'],_0x4e082d[_0xc355('0x4d')],md5(_0x4e082d['uniqueid']));}else{_0x4e082d[_0xc355('0x61')]='';}return getConnection(_0x2e9cf3)[_0xc355('0x25')](function(_0x50af82){_0x9c287c=_0x50af82;if(!_[_0xc355('0x18')](_0x2e5c02)){return getUser(_0x2e9cf3,_0x2e5c02[_0xc355('0x41')],_0x9c287c);}else{return getUser(_0x2e9cf3,null,_0x9c287c);}})[_0xc355('0x25')](function(_0x7130de){_0x2e8ab2=_0x7130de;return getEndUser(_0x2e9cf3,_0x4cbd8a,_0x4e082d[_0xc355('0x4f')],_0x4e082d['calleridnum'],_0x9c287c);})[_0xc355('0x25')](function(_0x30c17c){_0x2c2a6d=_0x30c17c;return getTicket(_0x2e9cf3,_0x2e8ab2,_0x2c2a6d,_0x4cbd8a,_0x4e082d,_0x4cbd8a[_0xc355('0x51')],_0x9c287c);})['then'](function(_0x129b0f){_0x2cb13f=_0x129b0f;logger['info'](_0xc355('0x69'),_0x2cb13f['id']);logger['info'](_0xc355('0x6a'),_0x2e9cf3['type']);})[_0xc355('0x5b')](function(_0x7cbecf){logger[_0xc355('0x59')](_0xc355('0x68'),JSON['stringify'](_0x7cbecf));});}; \ No newline at end of file +var _0xb5a9=['ticketType','Task','assign','utc','getString','Descriptions','WhoId','Subjects','ContactId','create','isNil','validateEmail','User','find','execute','then','Email','info','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','sobject','Contact','Lead','contact','lead','Case','length','Phone','Name','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','content','type','variable','variableName','idField','toString','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','Fields','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','newTab','Salesforce\x20account\x20type\x20not\x20recognized','[ABANDONED]','[ABANDONED]\x20Ticket\x20%s\x20created.','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','socket.io-emitter','emit'];(function(_0x55cf9d,_0x2795b3){var _0x2fd425=function(_0x18e233){while(--_0x18e233){_0x55cf9d['push'](_0x55cf9d['shift']());}};_0x2fd425(++_0x2795b3);}(_0xb5a9,0x1af));var _0x9b5a=function(_0x1063ae,_0x30ad0a){_0x1063ae=_0x1063ae-0x0;var _0x77842f=_0xb5a9[_0x1063ae];return _0x77842f;};'use strict';var _=require('lodash');var rp=require(_0x9b5a('0x0'));var moment=require(_0x9b5a('0x1'));var BPromise=require(_0x9b5a('0x2'));var md5=require(_0x9b5a('0x3'));var jsforce=require(_0x9b5a('0x4'));var util=require(_0x9b5a('0x5'));var Redis=require(_0x9b5a('0x6'));var intUtil=require(_0x9b5a('0x7'));var config=require(_0x9b5a('0x8'));var logger=require(_0x9b5a('0x9'))('salesforce');config['redis']=_['defaults'](config[_0x9b5a('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x9b5a('0xb'))(new Redis(config[_0x9b5a('0xa')]));function emit(_0x4a0a61,_0x321922,_0x478fed){io['to'](_0x4a0a61)[_0x9b5a('0xc')](_0x321922,_0x478fed);}function getTicket(_0x2e072f,_0x5b6615,_0x40bb49,_0x109d8a,_0x165b81,_0x5cfbb5,_0x4dcca8,_0x3237b6){var _0x4dcb4d={};if(_0x109d8a[_0x9b5a('0xd')]===_0x9b5a('0xe')){_0x4dcb4d=Object[_0x9b5a('0xf')]({},{'OwnerId':_0x5b6615['id'],'ActivityDate':moment[_0x9b5a('0x10')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x9b5a('0x11')](_0x109d8a['Subjects'],_0x165b81,'\x20'),'Description':intUtil[_0x9b5a('0x11')](_0x109d8a[_0x9b5a('0x12')],_0x165b81,'\x0a')},getCustomFields(_0x5cfbb5,_0x165b81));if(_0x40bb49){_0x4dcb4d[_0x9b5a('0x13')]=_0x40bb49['id'];}}else if(_0x109d8a['ticketType']==='Case'){_0x4dcb4d=Object[_0x9b5a('0xf')]({},{'OwnerId':_0x5b6615['id'],'Subject':intUtil[_0x9b5a('0x11')](_0x109d8a[_0x9b5a('0x14')],_0x165b81,'\x20'),'Description':intUtil[_0x9b5a('0x11')](_0x109d8a['Descriptions'],_0x165b81,'\x0a')},getCustomFields(_0x5cfbb5,_0x165b81));if(_0x40bb49){_0x4dcb4d[_0x9b5a('0x15')]=_0x40bb49['id'];}}return _0x4dcca8['sobject'](_0x109d8a['ticketType'])[_0x9b5a('0x16')](_0x4dcb4d);}function getUser(_0x1653bb,_0x73442b,_0x355dd4){if(!_[_0x9b5a('0x17')](_0x73442b)&&intUtil[_0x9b5a('0x18')](_0x73442b)){var _0x43469d={'Email':_0x73442b};var _0x2f911b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x355dd4['sobject'](_0x9b5a('0x19'))[_0x9b5a('0x1a')](_0x43469d,_0x2f911b)[_0x9b5a('0x1b')]()[_0x9b5a('0x1c')](function(_0x235453){if(_0x235453['length']){var _0x2db88e=_[_0x9b5a('0x1a')](_0x235453,function(_0x2ced73){return _0x2ced73[_0x9b5a('0x1d')]===_0x73442b;});if(_0x2db88e){logger[_0x9b5a('0x1e')]('Agent\x20%s\x20found.',_0x73442b);return BPromise[_0x9b5a('0x1f')]({'id':_0x2db88e['Id'],'name':_0x2db88e['Name']});}}else{logger[_0x9b5a('0x1e')](_0x9b5a('0x20'),_0x73442b);return _0x355dd4[_0x9b5a('0x21')]()[_0x9b5a('0x1c')](function(_0x4d644a){return BPromise['resolve']({'id':_0x4d644a[_0x9b5a('0x22')],'name':_0x4d644a[_0x9b5a('0x23')]});});}});}else{logger[_0x9b5a('0x1e')](_0x9b5a('0x20'),_0x73442b);return _0x355dd4['identity']()[_0x9b5a('0x1c')](function(_0x4f270f){return BPromise['resolve']({'id':_0x4f270f[_0x9b5a('0x22')],'name':_0x4f270f[_0x9b5a('0x23')]});});}}function getEndUser(_0x1eb7bb,_0x1d1e7b,_0xb5c655,_0x454c1a,_0xbb31e4){var _0x46d066={'Phone':_0x454c1a};var _0x569f56={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){if(_0x1d1e7b['ticketType']===_0x9b5a('0xe')){logger[_0x9b5a('0x1e')](_0x9b5a('0x24'),_0x454c1a,_0x1d1e7b[_0x9b5a('0x25')]);switch(_0x1d1e7b[_0x9b5a('0x25')]){case _0x9b5a('0x26'):return _0xbb31e4[_0x9b5a('0x27')](_0x9b5a('0x28'))[_0x9b5a('0x1a')](_0x46d066,_0x569f56)['execute']()['then'](function(_0xc0c118){if(_0xc0c118&&_0xc0c118['length']){return _0xc0c118;}else{return _0xbb31e4['sobject'](_0x9b5a('0x29'))['find'](_0x46d066,_0x569f56);}});case _0x9b5a('0x2a'):return _0xbb31e4[_0x9b5a('0x27')](_0x9b5a('0x28'))[_0x9b5a('0x1a')](_0x46d066,_0x569f56)[_0x9b5a('0x1b')]();case _0x9b5a('0x2b'):return _0xbb31e4[_0x9b5a('0x27')](_0x9b5a('0x29'))[_0x9b5a('0x1a')](_0x46d066,_0x569f56);default:return null;}}else if(_0x1d1e7b[_0x9b5a('0xd')]===_0x9b5a('0x2c')){logger[_0x9b5a('0x1e')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x454c1a,_0x9b5a('0x2a'));return _0xbb31e4[_0x9b5a('0x27')](_0x9b5a('0x28'))[_0x9b5a('0x1a')](_0x46d066,_0x569f56)[_0x9b5a('0x1b')]();}})['then'](function(_0x1c94f5){if(_0x1c94f5&&_0x1c94f5[_0x9b5a('0x2d')]){var _0x44d33b=_[_0x9b5a('0x1a')](_0x1c94f5,function(_0x28e6c2){return _0x28e6c2[_0x9b5a('0x2e')]===_0x454c1a;});if(_0x44d33b){return BPromise['resolve']({'id':_0x44d33b['Id'],'name':_0x44d33b[_0x9b5a('0x2f')],'phone':_0x44d33b[_0x9b5a('0x2e')]});}}})[_0x9b5a('0x1c')](function(_0x3d5b2a){if(_0x3d5b2a){logger['info']('Enduser\x20with\x20phone\x20%s\x20found.',_0x454c1a);return BPromise[_0x9b5a('0x1f')](_0x3d5b2a);}else{logger[_0x9b5a('0x1e')](_0x9b5a('0x30'),_0x454c1a);var _0x5964f3={'LastName':_0xb5c655!==_0x9b5a('0x31')?_0xb5c655:util[_0x9b5a('0x32')](_0x9b5a('0x33'),_0x454c1a),'Phone':_0x454c1a};if(_0x1d1e7b[_0x9b5a('0x34')]){if(_0x1d1e7b[_0x9b5a('0x34')]===_0x9b5a('0x2a')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x454c1a,_0x1d1e7b[_0x9b5a('0x34')]);}else if(_0x1d1e7b[_0x9b5a('0x34')]==='lead'&&_0x1d1e7b[_0x9b5a('0xd')]===_0x9b5a('0xe')){logger['info'](_0x9b5a('0x35'),_0x454c1a,_0x1d1e7b[_0x9b5a('0x34')]);_0x5964f3[_0x9b5a('0x36')]=_0x9b5a('0x37');}else{return null;}}return _0xbb31e4[_0x9b5a('0x27')](_[_0x9b5a('0x38')](_0x1d1e7b['moduleCreate']))[_0x9b5a('0x16')](_0x5964f3);}});}function getCustomFields(_0x2a3e9b,_0x702801){var _0xf01e7a={};if(_0x2a3e9b['length']>0x0){_['forEach'](_0x2a3e9b,function(_0x2add38){if(_0x2add38['type']==='string'&&_0x2add38['idField']){_0xf01e7a[_0x2add38['idField']]=_0x2add38[_0x9b5a('0x39')]['toString']();}else if(_0x2add38[_0x9b5a('0x3a')]===_0x9b5a('0x3b')&&_0x2add38[_0x9b5a('0x3c')]&&_0x2add38[_0x9b5a('0x3d')]){_0x702801[_0x2add38[_0x9b5a('0x3c')]]&&(_0xf01e7a[_0x2add38['idField']]=_0x702801[_0x2add38[_0x9b5a('0x3c')]][_0x9b5a('0x3e')]());}else if(_0x2add38[_0x9b5a('0x3a')]==='customVariable'&&_0x2add38[_0x9b5a('0x3f')]&&_0x2add38[_0x9b5a('0x3f')][_0x9b5a('0x40')]&&_0x2add38[_0x9b5a('0x3d')]){_0x702801[_0x2add38[_0x9b5a('0x3f')][_0x9b5a('0x40')][_0x9b5a('0x41')]()]&&(_0xf01e7a[_0x2add38['idField']]=_0x702801[_0x2add38[_0x9b5a('0x3f')]['name']['toLowerCase']()][_0x9b5a('0x3e')]());}});}return _0xf01e7a;}function getConnection(_0x5aaaf5){var _0x45ecaa=_0x5aaaf5[_0x9b5a('0x42')][_0x9b5a('0x43')](_0x5aaaf5[_0x9b5a('0x44')]);var _0x1978f0=new jsforce[(_0x9b5a('0x45'))]({'oauth2':{'loginUrl':_0x5aaaf5[_0x9b5a('0x46')]||_0x9b5a('0x47'),'clientId':_0x5aaaf5[_0x9b5a('0x48')],'clientSecret':_0x5aaaf5[_0x9b5a('0x49')]}});return _0x1978f0[_0x9b5a('0x4a')](_0x5aaaf5[_0x9b5a('0x4b')],_0x45ecaa)[_0x9b5a('0x1c')](function(){logger[_0x9b5a('0x1e')]('Connection\x20established.');return _0x1978f0;});}exports[_0x9b5a('0x4c')]=function(_0x470606,_0x390672,_0x5e48eb,_0x2110ce,_0x16c326,_0x332d43){var _0x47a4f0,_0x4b1602,_0x1ab3b2,_0x269cf5;_0x332d43[_0x9b5a('0x4d')]=intUtil[_0x9b5a('0x4e')](_0x332d43['serverUrl']);_0x332d43[_0x9b5a('0x46')]=intUtil['stripTrailingSlash'](_0x332d43[_0x9b5a('0x46')]);if(_0x16c326&&_0x16c326[_0x9b5a('0x4f')]){logger[_0x9b5a('0x1e')](_0x9b5a('0x50'),_0x9b5a('0x51'));_0x390672['recordingURL']=util[_0x9b5a('0x32')](_0x9b5a('0x52'),_0x332d43[_0x9b5a('0x4d')],_0x390672[_0x9b5a('0x53')],md5(_0x390672[_0x9b5a('0x53')]));}else{_0x390672[_0x9b5a('0x54')]='';}return getConnection(_0x332d43)['then'](function(_0x57c19f){_0x269cf5=_0x57c19f;return getUser(_0x332d43,_0x2110ce[_0x9b5a('0x55')],_0x269cf5);})[_0x9b5a('0x1c')](function(_0x34925a){_0x47a4f0=_0x34925a;return getEndUser(_0x332d43,_0x5e48eb,_0x390672[_0x9b5a('0x56')],_0x390672[_0x9b5a('0x57')],_0x269cf5);})[_0x9b5a('0x1c')](function(_0x54e95e){_0x4b1602=_0x54e95e;return getTicket(_0x332d43,_0x47a4f0,_0x4b1602,_0x5e48eb,_0x390672,_0x5e48eb[_0x9b5a('0x58')],_0x269cf5,_0x9b5a('0x4c'));})[_0x9b5a('0x1c')](function(_0x5269da){_0x1ab3b2=_0x5269da;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x1ab3b2['id']);logger['info']('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x1ab3b2['id'],_0x2110ce[_0x9b5a('0x40')],_0x332d43['type']);switch(_0x332d43[_0x9b5a('0x3a')]){case _0x9b5a('0x59'):emit(util[_0x9b5a('0x32')](_0x9b5a('0x5a'),_0x2110ce[_0x9b5a('0x40')]),_0x9b5a('0x5b'),{'recordId':_0x1ab3b2['id']});break;case'newTab':emit(util[_0x9b5a('0x32')]('user:%s',_0x2110ce[_0x9b5a('0x40')]),_0x9b5a('0x5c'),{'uri':util['format'](_0x9b5a('0x5d'),_0x269cf5[_0x9b5a('0x5e')],_0x1ab3b2['id'])});break;default:logger['error'](_0x9b5a('0x5f'));}})[_0x9b5a('0x60')](function(_0x450812){logger[_0x9b5a('0x61')](_0x9b5a('0x50'),JSON[_0x9b5a('0x62')](_0x450812));});};exports['outbound']=function(_0x55f357,_0x438d15,_0x336cd8,_0xf299fb,_0x15d389,_0x2f59f1,_0x218b86){var _0x5b37ce,_0x51188b,_0x5ee72c,_0x2f45f9;_0x2f59f1[_0x9b5a('0x4d')]=intUtil['stripTrailingSlash'](_0x2f59f1[_0x9b5a('0x4d')]);_0x2f59f1[_0x9b5a('0x46')]=intUtil[_0x9b5a('0x4e')](_0x2f59f1[_0x9b5a('0x46')]);if(_0x218b86&&_0x218b86[_0x9b5a('0x63')]&&_0x218b86[_0x9b5a('0x63')]!==_0x9b5a('0x64')){logger[_0x9b5a('0x1e')](_0x9b5a('0x65'),_0x9b5a('0x51'));_0x438d15[_0x9b5a('0x54')]=util['format'](_0x9b5a('0x52'),_0x2f59f1[_0x9b5a('0x4d')],_0x438d15['uniqueid'],md5(_0x438d15[_0x9b5a('0x53')]));}return getConnection(_0x2f59f1)[_0x9b5a('0x1c')](function(_0x52b420){_0x2f45f9=_0x52b420;return getUser(_0x2f59f1,_0xf299fb[_0x9b5a('0x55')],_0x2f45f9);})[_0x9b5a('0x1c')](function(_0x55095d){_0x5b37ce=_0x55095d;return getEndUser(_0x2f59f1,_0x336cd8,_0x438d15[_0x9b5a('0x66')],_0x438d15[_0x9b5a('0x67')],_0x2f45f9);})[_0x9b5a('0x1c')](function(_0x258b23){_0x51188b=_0x258b23;return getTicket(_0x2f59f1,_0x5b37ce,_0x51188b,_0x336cd8,_0x438d15,_0x336cd8[_0x9b5a('0x58')],_0x2f45f9,_0x9b5a('0x68'));})[_0x9b5a('0x1c')](function(_0x588b42){_0x5ee72c=_0x588b42;logger['info'](_0x9b5a('0x69'),_0x5ee72c['id']);logger[_0x9b5a('0x1e')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x5ee72c['id'],_0xf299fb['name'],_0x2f59f1[_0x9b5a('0x3a')]);switch(_0x2f59f1[_0x9b5a('0x3a')]){case'integrationTab':emit(util[_0x9b5a('0x32')](_0x9b5a('0x5a'),_0xf299fb[_0x9b5a('0x40')]),_0x9b5a('0x5b'),{'recordId':_0x5ee72c['id']});break;case _0x9b5a('0x6a'):emit(util[_0x9b5a('0x32')](_0x9b5a('0x5a'),_0xf299fb[_0x9b5a('0x40')]),'trigger:browser:url',{'uri':util['format']('%s/%s/e',_0x2f45f9[_0x9b5a('0x5e')],_0x5ee72c['id'])});break;default:logger[_0x9b5a('0x61')]('[OUTBOUND]',_0x9b5a('0x6b'));}})[_0x9b5a('0x60')](function(_0x17fa23){logger[_0x9b5a('0x61')](_0x9b5a('0x65'),JSON[_0x9b5a('0x62')](_0x17fa23));});};exports['abandoned']=function(_0x1c39b1,_0x54e43e,_0x4c23ce,_0x4a5696,_0xc42c1a,_0x24d7a5){var _0x4ca4c7,_0x5f0ee5,_0x14f735,_0x5aa47a;_0x24d7a5[_0x9b5a('0x4d')]=intUtil['stripTrailingSlash'](_0x24d7a5[_0x9b5a('0x4d')]);_0x24d7a5[_0x9b5a('0x46')]=intUtil[_0x9b5a('0x4e')](_0x24d7a5[_0x9b5a('0x46')]);if(_0xc42c1a&&_0xc42c1a[_0x9b5a('0x4f')]){logger[_0x9b5a('0x1e')](_0x9b5a('0x6c'),_0x9b5a('0x51'));_0x54e43e[_0x9b5a('0x54')]=util[_0x9b5a('0x32')](_0x9b5a('0x52'),_0x24d7a5[_0x9b5a('0x4d')],_0x54e43e[_0x9b5a('0x53')],md5(_0x54e43e[_0x9b5a('0x53')]));}else{_0x54e43e[_0x9b5a('0x54')]='';}return getConnection(_0x24d7a5)['then'](function(_0x5c9965){_0x5aa47a=_0x5c9965;if(!_[_0x9b5a('0x17')](_0x4a5696)){return getUser(_0x24d7a5,_0x4a5696[_0x9b5a('0x40')],_0x5aa47a);}else{return getUser(_0x24d7a5,null,_0x5aa47a);}})[_0x9b5a('0x1c')](function(_0x4f56c9){_0x4ca4c7=_0x4f56c9;return getEndUser(_0x24d7a5,_0x4c23ce,_0x54e43e['calleridname'],_0x54e43e['calleridnum'],_0x5aa47a);})[_0x9b5a('0x1c')](function(_0x108e43){_0x5f0ee5=_0x108e43;return getTicket(_0x24d7a5,_0x4ca4c7,_0x5f0ee5,_0x4c23ce,_0x54e43e,_0x4c23ce[_0x9b5a('0x58')],_0x5aa47a);})[_0x9b5a('0x1c')](function(_0x3e418a){_0x14f735=_0x3e418a;logger['info'](_0x9b5a('0x6d'),_0x14f735['id']);logger[_0x9b5a('0x1e')](_0x9b5a('0x6e'),_0x24d7a5['type']);})[_0x9b5a('0x60')](function(_0x1d0b25){logger[_0x9b5a('0x61')](_0x9b5a('0x6c'),JSON[_0x9b5a('0x62')](_0x1d0b25));});}; \ 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 e319384..7d3df5b 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 _0xa9e0=['validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','userId','adminEmail','],\x20getUser\x20crm','catch','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','System','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','length','forEach','type','customField','idField','content','toString','toLowerCase','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema',']\x20getTicket\x20crm','label','Incident','ticketId','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','serverUrl','stripTrailingSlash','%s/api/now/table/','remoteUri','email','destcalleridnum','calleridnum','queue','abandoned','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x0a9e('0x0'));var Promise=require(_0x0a9e('0x1'));var rp=require(_0x0a9e('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function getAdminUser(_0x5f41ea,_0x503809,_0xe42b77,_0x56465b,_0x52cace,_0x39753a){return new Promise(function(_0xf81284,_0x307b3e){var _0x3ab53f={'method':_0x0a9e('0xb'),'uri':_0x56465b+_0x0a9e('0xc')+'&'+_0x52cace+'&'+_0x39753a,'auth':_0x503809,'json':!![]};return rp(_0x3ab53f)['then'](function(_0x50dfb2){if(_0x50dfb2['result']['length']>0x0){_0xe42b77[_0x0a9e('0xd')]=_0x50dfb2[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}logger[_0x0a9e('0x10')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+_0x0a9e('0x12'),_0xe42b77);_0xf81284(_0xe42b77);})['catch'](function(_0x4283ce){logger[_0x0a9e('0x13')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+']',_0x4283ce[_0x0a9e('0x14')]);_0x307b3e(_0x4283ce[_0x0a9e('0x14')]);});});}function getUser(_0x4d5611,_0x52a03d,_0x22dccb,_0x5d0880,_0x1985b6){return function(_0x519dfd){logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x519dfd);return new Promise(function(_0x225616,_0x5a0a06){if(intUtil[_0x0a9e('0x15')](_0x519dfd[_0x0a9e('0x16')])){var _0x106033={'method':_0x0a9e('0xb'),'uri':_0x22dccb+_0x0a9e('0x17')+_0x519dfd[_0x0a9e('0x16')]+'&'+_0x5d0880+'&'+_0x1985b6,'auth':_0x52a03d,'json':!![]};logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x18'),_0x106033);return rp(_0x106033)[_0x0a9e('0x19')](function(_0x1c696a){logger[_0x0a9e('0x10')]('['+[_0x4d5611['toUpperCase']()]+_0x0a9e('0x1a'),_0x1c696a);if(_0x1c696a[_0x0a9e('0xe')]['length']>0x0&&String(_0x1c696a[_0x0a9e('0xe')][0x0]['active'])==='true'){_0x519dfd[_0x0a9e('0x1b')]=_0x1c696a[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}else{_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd[_0x0a9e('0x1c')];}logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x1d'),_0x519dfd);_0x225616(_0x519dfd);})[_0x0a9e('0x1e')](function(_0x16b1ca){logger['error']('['+[_0x4d5611['toUpperCase']()]+']',_0x16b1ca[_0x0a9e('0x14')]);_0x5a0a06(_0x16b1ca[_0x0a9e('0x14')]);});}else{logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+']\x20using\x20admin\x20profile');_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd['adminEmail'];_0x225616(_0x519dfd);}});};}function createEndUser(_0x1dc186,_0x34dc65,_0x25fba9,_0x14433c,_0x140511){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+_0x0a9e('0x1f'),_0x25fba9);return new Promise(function(_0x5a101a,_0x3652a7){var _0x468813={'method':_0x0a9e('0x20'),'uri':_0x14433c+_0x0a9e('0x21')+_0x140511,'body':{'user_name':_0x25fba9['endUserNumber'],'roles':_0x0a9e('0x22'),'first_name':_0x25fba9[_0x0a9e('0x23')],'active':_0x0a9e('0x24'),'date_format':_0x0a9e('0x25'),'phone':_0x25fba9[_0x0a9e('0x23')]},'auth':_0x34dc65,'json':!![]};return rp(_0x468813)[_0x0a9e('0x19')](function(_0x296f41){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+'],\x20EndUser\x20schema',_0x296f41[_0x0a9e('0xe')]);_0x25fba9['endUserId']=_0x296f41[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x5a101a(_0x25fba9);})[_0x0a9e('0x1e')](function(_0x33bdb7){logger[_0x0a9e('0x13')]('['+[_0x1dc186['toUpperCase']()]+']',_0x33bdb7[_0x0a9e('0x14')]);_0x3652a7(_0x33bdb7[_0x0a9e('0x14')]);});});}function getEndUser(_0x40cb85,_0x2da5c0,_0x2b45ea,_0x409319,_0x332d35){return function(_0x39e565){logger['info']('['+[_0x40cb85[_0x0a9e('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x39e565);return new Promise(function(_0x2cc7a0,_0x14b13f){var _0x2b7e7f={'method':_0x0a9e('0xb'),'uri':_0x2b45ea+'sys_user?sysparm_query=phone%3D'+_0x39e565[_0x0a9e('0x23')]+'&'+_0x409319+'&'+_0x332d35,'auth':_0x2da5c0,'json':!![]};return rp(_0x2b7e7f)[_0x0a9e('0x19')](function(_0x1fa90d){if(_0x1fa90d[_0x0a9e('0xe')]['length']>0x0){_0x39e565['endUserId']=_0x1fa90d[_0x0a9e('0xe')][0x0]['sys_id'];logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x26'),_0x39e565);_0x2cc7a0(_0x39e565);}else{return createEndUser(_0x40cb85,_0x2da5c0,_0x39e565,_0x2b45ea,_0x409319)[_0x0a9e('0x19')](function(_0x4f41ae){logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x27'),_0x4f41ae);_0x2cc7a0(_0x4f41ae);});}})['catch'](function(_0x1dbf74){logger[_0x0a9e('0x13')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+']',_0x1dbf74['message']);_0x14b13f(_0x1dbf74['message']);});});};}function getCustomFields(_0x11b61d,_0x40d766){var _0x5adda1={};if(_0x11b61d[_0x0a9e('0x28')]>0x0){_[_0x0a9e('0x29')](_0x11b61d,function(_0x2e1b3a){if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a['nameField']&&!_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')]['toLowerCase']()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]===_0x0a9e('0x30')&&_0x2e1b3a[_0x0a9e('0x31')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x31')]][_0x0a9e('0x2e')]();}else if(_0x2e1b3a['type']==='customVariable'&&_0x2e1b3a[_0x0a9e('0x32')]&&_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')][_0x0a9e('0x2f')]()][_0x0a9e('0x2e')]();}});}return _0x5adda1;}function getTicket(_0x35ed4a,_0x5026aa,_0x117c99,_0x138b8b,_0xdd268f,_0xfbd5ad){return function(_0x2e8caf){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x34'),_0x2e8caf);return new Promise(function(_0x59afe8,_0x2e9d90){var _0x48fd45=_0x35ed4a[_0x0a9e('0x2f')]()===_0x0a9e('0x35')?_0x2e8caf[_0x0a9e('0x1b')]:_0x2e8caf['endUserId'];var _0x14bec2={'method':_0x0a9e('0x20'),'uri':_0x117c99+_0x0a9e('0x36')+'?'+_0xfbd5ad,'body':Object[_0x0a9e('0x37')]({},{'active':_0x0a9e('0x24'),'caller_id':_0x48fd45,'assigned_to':_0x2e8caf[_0x0a9e('0x1b')],'short_description':intUtil[_0x0a9e('0x38')](_0x138b8b['Subjects'],_0xdd268f,'\x20'),'description':intUtil[_0x0a9e('0x38')](_0x138b8b[_0x0a9e('0x39')],_0xdd268f,'\x0a')},getCustomFields(_0x138b8b[_0x0a9e('0x3a')],_0xdd268f)),'auth':_0x5026aa,'json':!![]};return rp(_0x14bec2)[_0x0a9e('0x19')](function(_0x409789){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3b'),_0x409789[_0x0a9e('0xe')]);_0x2e8caf['ticketId']=_0x409789[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x2e8caf['ticketNumber']=_0x409789['result']['number'];logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3c'),_0x2e8caf);_0x59afe8(_0x2e8caf);})[_0x0a9e('0x1e')](function(_0x61bb17){logger[_0x0a9e('0x13')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+']',_0x61bb17[_0x0a9e('0x14')]);_0x2e9d90(_0x61bb17['message']);});});};}function createRemoteTag(_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){return new Promise(function(_0x14d602,_0x5bb3ed){var _0x2b69d9={'method':_0x0a9e('0x20'),'uri':_0x39d77d+'label'+'?'+_0x204173,'body':{'short_description':_0x4b1b9f,'global':!![],'active':!![],'name':_0x4b1b9f},'auth':_0x53975a,'json':!![]};return rp(_0x2b69d9)['then'](function(_0x2ef381){var _0x59c6ff=_0x2ef381[_0x0a9e('0xe')]['sys_id'];_0x14d602(_0x59c6ff);});});}function getRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da){return new Promise(function(_0x1bf38a,_0x508b47){var _0x50f687={'method':_0x0a9e('0xb'),'uri':_0x439340+_0x0a9e('0x3d')+'?sysparm_query=name%3D'+_0x2e5e62+'&'+_0x53613a,'auth':_0x3c20b2,'json':!![]};return rp(_0x50f687)[_0x0a9e('0x19')](function(_0x5ce9ac){if(_0x5ce9ac[_0x0a9e('0xe')]['length']>0x0){var _0xe22ccc=_0x5ce9ac['result'][0x0]['sys_id'];_0x1bf38a(_0xe22ccc);}else{return createRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a)['then'](function(_0x2da03c){_0x1bf38a(_0x2da03c);});}});});}function assignTagToIncident(_0x47de4c,_0x2f7092,_0x65432,_0x3cfd00,_0x19b4df){return new Promise(function(_0x232830,_0x272738){var _0xd10662={'method':_0x0a9e('0x20'),'uri':_0x65432+'label_entry'+'?'+_0x19b4df,'body':{'label':_0x47de4c,'table':_0x0a9e('0x36'),'id_type':_0x0a9e('0x3e'),'table_key':_0x3cfd00[_0x0a9e('0x3f')],'title':_0x0a9e('0x40')+_0x3cfd00[_0x0a9e('0x41')],'id_display':_0x3cfd00[_0x0a9e('0x41')]},'auth':_0x2f7092,'json':!![]};return rp(_0xd10662)['then'](function(_0x956fbe){_0x232830();})[_0x0a9e('0x1e')](function(){_0x232830();});});}function manageTags(_0x5239ef,_0x3649cc,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a,_0x5674ee){return new Promise(function(_0x273cb5,_0x49d231){var _0x2244d6=[];_0x3649cc[_0x0a9e('0x29')](function(_0x261adb){_0x2244d6[_0x0a9e('0x42')](getRemoteTag(_0x261adb,_0x5cc8fb,_0x20c668,_0x4b3c1a,_0x5674ee));});return Promise[_0x0a9e('0x43')](_0x2244d6)[_0x0a9e('0x19')](function(_0x49eed0){if(_0x49eed0[_0x0a9e('0x28')]){logger['info']('['+[_0x5239ef[_0x0a9e('0x11')]()]+_0x0a9e('0x44'),_0x49eed0);var _0x51aaf7=[];_0x49eed0['forEach'](function(_0x453360){_0x51aaf7[_0x0a9e('0x42')](assignTagToIncident(_0x453360,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a));});return Promise[_0x0a9e('0x43')](_0x51aaf7)[_0x0a9e('0x19')](function(){_0x273cb5();})['catch'](function(){_0x273cb5();});}else{_0x273cb5();}});});}function getTags(_0x1d0dc8,_0xe05a5a,_0x54327c,_0x797b45,_0x17e88c,_0x88dcbf){return function(_0x409b29){return new Promise(function(_0x401837,_0x4d4a35){var _0x176840=[];var _0x2937e0=_0x797b45[_0x0a9e('0x45')];if(_0x2937e0&&_0x2937e0['length']>0x0){_0x176840=_[_0x0a9e('0x46')](_0x2937e0,'name');}if(_0x176840['length']>0x0){return manageTags(_0x1d0dc8,_0x176840,_0xe05a5a,_0x54327c,_0x409b29,_0x17e88c,_0x88dcbf)[_0x0a9e('0x19')](function(){_0x401837(_0x409b29);});}else{_0x401837(_0x409b29);}});};}function emit(_0x4556c5,_0x9375fb,_0x19c995){var _0x186f39=_0x0a9e('0x47')+_0x0a9e('0x48')+_0x0a9e('0x49')+_0x0a9e('0x4a');var _0x1cc4f3={'uri':_0x4556c5+_0x0a9e('0x4b')+_0x19c995+_0x186f39};io['to'](util[_0x0a9e('0x4c')](_0x0a9e('0x4d'),_0x9375fb))[_0x0a9e('0x4e')](_0x0a9e('0x4f'),_0x1cc4f3);}exports['cs']=function(_0x412a72,_0x2a28c0,_0x4257c9,_0x5150a4,_0x1b0b98,_0x295763,_0x243d12,_0x4edbb0){var _0x1148a1={};var _0x30944e={'user':_0x295763['username'],'pass':_0x295763[_0x0a9e('0x50')]};var _0x56e31e=_0x0a9e('0x51');var _0x427946=_0x0a9e('0x52');_0x295763['remoteUri']=intUtil['stripTrailingSlash'](_0x295763['remoteUri']);_0x295763[_0x0a9e('0x53')]=intUtil[_0x0a9e('0x54')](_0x295763[_0x0a9e('0x53')]);var _0x23a7d3=util[_0x0a9e('0x4c')](_0x0a9e('0x55'),_0x295763[_0x0a9e('0x56')]);_0x1148a1[_0x0a9e('0x16')]=!_['isNil'](_0x5150a4)?_0x5150a4[_0x0a9e('0x57')]:null;_0x1148a1[_0x0a9e('0x1c')]=_0x295763[_0x0a9e('0x57')];_0x1148a1['endUserNumber']=_0x4edbb0[_0x0a9e('0x2f')]()==='outbound'?_0x2a28c0[_0x0a9e('0x58')]:_0x2a28c0[_0x0a9e('0x59')];_0x1148a1['callDirection']=_0x4edbb0===_0x0a9e('0x5a')||_0x4edbb0===_0x0a9e('0x5b')?_0x0a9e('0x5a'):_0x0a9e('0x35');var _0x542ece=util[_0x0a9e('0x4c')](_0x0a9e('0x5c'),_0x295763[_0x0a9e('0x53')],_0x2a28c0[_0x0a9e('0x5d')],md5(_0x2a28c0['uniqueid']));if(_0x1b0b98&&_0x1b0b98[_0x0a9e('0x5e')]){logger[_0x0a9e('0x10')](_0x0a9e('0x5f'),_0x0a9e('0x60'));_0x2a28c0['recordingURL']=_0x542ece;}else if(_0x243d12&&_0x243d12[_0x0a9e('0x61')]&&_0x243d12[_0x0a9e('0x61')]!==_0x0a9e('0x62')){logger[_0x0a9e('0x10')](_0x0a9e('0x63'),_0x0a9e('0x60'));_0x2a28c0[_0x0a9e('0x64')]=_0x542ece;}else{_0x2a28c0[_0x0a9e('0x64')]='';}return getAdminUser(_0x4edbb0,_0x30944e,_0x1148a1,_0x23a7d3,_0x427946,_0x56e31e)[_0x0a9e('0x19')](getUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getEndUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getTicket(_0x4edbb0,_0x30944e,_0x23a7d3,_0x4257c9,_0x2a28c0,_0x427946))[_0x0a9e('0x19')](function(_0x25744a){logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x65'),_0x25744a[_0x0a9e('0x3f')]));logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x66'),_0x4edbb0));if(_0x4edbb0!==_0x0a9e('0x5b')){logger[_0x0a9e('0x10')]('['+[_0x4edbb0[_0x0a9e('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x295763['remoteUri'],_0x5150a4[_0x0a9e('0x33')],_0x25744a[_0x0a9e('0x3f')]);}})['catch'](function(_0x45108c){logger['error']('['+[_0x4edbb0[_0x0a9e('0x11')]()]+_0x0a9e('0x67'),util['inspect'](_0x45108c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa9e0=['validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','userId','adminEmail','],\x20getUser\x20crm','catch','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','System','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','length','forEach','type','customField','idField','content','toString','toLowerCase','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema',']\x20getTicket\x20crm','label','Incident','ticketId','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','serverUrl','stripTrailingSlash','%s/api/now/table/','remoteUri','email','destcalleridnum','calleridnum','queue','abandoned','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x0a9e('0x0'));var Promise=require(_0x0a9e('0x1'));var rp=require(_0x0a9e('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function getAdminUser(_0x5f41ea,_0x503809,_0xe42b77,_0x56465b,_0x52cace,_0x39753a){return new Promise(function(_0xf81284,_0x307b3e){var _0x3ab53f={'method':_0x0a9e('0xb'),'uri':_0x56465b+_0x0a9e('0xc')+'&'+_0x52cace+'&'+_0x39753a,'auth':_0x503809,'json':!![]};return rp(_0x3ab53f)['then'](function(_0x50dfb2){if(_0x50dfb2['result']['length']>0x0){_0xe42b77[_0x0a9e('0xd')]=_0x50dfb2[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}logger[_0x0a9e('0x10')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+_0x0a9e('0x12'),_0xe42b77);_0xf81284(_0xe42b77);})['catch'](function(_0x4283ce){logger[_0x0a9e('0x13')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+']',_0x4283ce[_0x0a9e('0x14')]);_0x307b3e(_0x4283ce[_0x0a9e('0x14')]);});});}function getUser(_0x4d5611,_0x52a03d,_0x22dccb,_0x5d0880,_0x1985b6){return function(_0x519dfd){logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x519dfd);return new Promise(function(_0x225616,_0x5a0a06){if(intUtil[_0x0a9e('0x15')](_0x519dfd[_0x0a9e('0x16')])){var _0x106033={'method':_0x0a9e('0xb'),'uri':_0x22dccb+_0x0a9e('0x17')+_0x519dfd[_0x0a9e('0x16')]+'&'+_0x5d0880+'&'+_0x1985b6,'auth':_0x52a03d,'json':!![]};logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x18'),_0x106033);return rp(_0x106033)[_0x0a9e('0x19')](function(_0x1c696a){logger[_0x0a9e('0x10')]('['+[_0x4d5611['toUpperCase']()]+_0x0a9e('0x1a'),_0x1c696a);if(_0x1c696a[_0x0a9e('0xe')]['length']>0x0&&String(_0x1c696a[_0x0a9e('0xe')][0x0]['active'])==='true'){_0x519dfd[_0x0a9e('0x1b')]=_0x1c696a[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}else{_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd[_0x0a9e('0x1c')];}logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x1d'),_0x519dfd);_0x225616(_0x519dfd);})[_0x0a9e('0x1e')](function(_0x16b1ca){logger['error']('['+[_0x4d5611['toUpperCase']()]+']',_0x16b1ca[_0x0a9e('0x14')]);_0x5a0a06(_0x16b1ca[_0x0a9e('0x14')]);});}else{logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+']\x20using\x20admin\x20profile');_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd['adminEmail'];_0x225616(_0x519dfd);}});};}function createEndUser(_0x1dc186,_0x34dc65,_0x25fba9,_0x14433c,_0x140511){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+_0x0a9e('0x1f'),_0x25fba9);return new Promise(function(_0x5a101a,_0x3652a7){var _0x468813={'method':_0x0a9e('0x20'),'uri':_0x14433c+_0x0a9e('0x21')+_0x140511,'body':{'user_name':_0x25fba9['endUserNumber'],'roles':_0x0a9e('0x22'),'first_name':_0x25fba9[_0x0a9e('0x23')],'active':_0x0a9e('0x24'),'date_format':_0x0a9e('0x25'),'phone':_0x25fba9[_0x0a9e('0x23')]},'auth':_0x34dc65,'json':!![]};return rp(_0x468813)[_0x0a9e('0x19')](function(_0x296f41){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+'],\x20EndUser\x20schema',_0x296f41[_0x0a9e('0xe')]);_0x25fba9['endUserId']=_0x296f41[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x5a101a(_0x25fba9);})[_0x0a9e('0x1e')](function(_0x33bdb7){logger[_0x0a9e('0x13')]('['+[_0x1dc186['toUpperCase']()]+']',_0x33bdb7[_0x0a9e('0x14')]);_0x3652a7(_0x33bdb7[_0x0a9e('0x14')]);});});}function getEndUser(_0x40cb85,_0x2da5c0,_0x2b45ea,_0x409319,_0x332d35){return function(_0x39e565){logger['info']('['+[_0x40cb85[_0x0a9e('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x39e565);return new Promise(function(_0x2cc7a0,_0x14b13f){var _0x2b7e7f={'method':_0x0a9e('0xb'),'uri':_0x2b45ea+'sys_user?sysparm_query=phone%3D'+_0x39e565[_0x0a9e('0x23')]+'&'+_0x409319+'&'+_0x332d35,'auth':_0x2da5c0,'json':!![]};return rp(_0x2b7e7f)[_0x0a9e('0x19')](function(_0x1fa90d){if(_0x1fa90d[_0x0a9e('0xe')]['length']>0x0){_0x39e565['endUserId']=_0x1fa90d[_0x0a9e('0xe')][0x0]['sys_id'];logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x26'),_0x39e565);_0x2cc7a0(_0x39e565);}else{return createEndUser(_0x40cb85,_0x2da5c0,_0x39e565,_0x2b45ea,_0x409319)[_0x0a9e('0x19')](function(_0x4f41ae){logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x27'),_0x4f41ae);_0x2cc7a0(_0x4f41ae);});}})['catch'](function(_0x1dbf74){logger[_0x0a9e('0x13')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+']',_0x1dbf74['message']);_0x14b13f(_0x1dbf74['message']);});});};}function getCustomFields(_0x11b61d,_0x40d766){var _0x5adda1={};if(_0x11b61d[_0x0a9e('0x28')]>0x0){_[_0x0a9e('0x29')](_0x11b61d,function(_0x2e1b3a){if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a['nameField']&&!_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')]['toLowerCase']()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]===_0x0a9e('0x30')&&_0x2e1b3a[_0x0a9e('0x31')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x31')]][_0x0a9e('0x2e')]();}else if(_0x2e1b3a['type']==='customVariable'&&_0x2e1b3a[_0x0a9e('0x32')]&&_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')][_0x0a9e('0x2f')]()][_0x0a9e('0x2e')]();}});}return _0x5adda1;}function getTicket(_0x35ed4a,_0x5026aa,_0x117c99,_0x138b8b,_0xdd268f,_0xfbd5ad){return function(_0x2e8caf){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x34'),_0x2e8caf);return new Promise(function(_0x59afe8,_0x2e9d90){var _0x48fd45=_0x35ed4a[_0x0a9e('0x2f')]()===_0x0a9e('0x35')?_0x2e8caf[_0x0a9e('0x1b')]:_0x2e8caf['endUserId'];var _0x14bec2={'method':_0x0a9e('0x20'),'uri':_0x117c99+_0x0a9e('0x36')+'?'+_0xfbd5ad,'body':Object[_0x0a9e('0x37')]({},{'active':_0x0a9e('0x24'),'caller_id':_0x48fd45,'assigned_to':_0x2e8caf[_0x0a9e('0x1b')],'short_description':intUtil[_0x0a9e('0x38')](_0x138b8b['Subjects'],_0xdd268f,'\x20'),'description':intUtil[_0x0a9e('0x38')](_0x138b8b[_0x0a9e('0x39')],_0xdd268f,'\x0a')},getCustomFields(_0x138b8b[_0x0a9e('0x3a')],_0xdd268f)),'auth':_0x5026aa,'json':!![]};return rp(_0x14bec2)[_0x0a9e('0x19')](function(_0x409789){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3b'),_0x409789[_0x0a9e('0xe')]);_0x2e8caf['ticketId']=_0x409789[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x2e8caf['ticketNumber']=_0x409789['result']['number'];logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3c'),_0x2e8caf);_0x59afe8(_0x2e8caf);})[_0x0a9e('0x1e')](function(_0x61bb17){logger[_0x0a9e('0x13')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+']',_0x61bb17[_0x0a9e('0x14')]);_0x2e9d90(_0x61bb17['message']);});});};}function createRemoteTag(_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){return new Promise(function(_0x14d602,_0x5bb3ed){var _0x2b69d9={'method':_0x0a9e('0x20'),'uri':_0x39d77d+'label'+'?'+_0x204173,'body':{'short_description':_0x4b1b9f,'global':!![],'active':!![],'name':_0x4b1b9f},'auth':_0x53975a,'json':!![]};return rp(_0x2b69d9)['then'](function(_0x2ef381){var _0x59c6ff=_0x2ef381[_0x0a9e('0xe')]['sys_id'];_0x14d602(_0x59c6ff);});});}function getRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da){return new Promise(function(_0x1bf38a,_0x508b47){var _0x50f687={'method':_0x0a9e('0xb'),'uri':_0x439340+_0x0a9e('0x3d')+'?sysparm_query=name%3D'+_0x2e5e62+'&'+_0x53613a,'auth':_0x3c20b2,'json':!![]};return rp(_0x50f687)[_0x0a9e('0x19')](function(_0x5ce9ac){if(_0x5ce9ac[_0x0a9e('0xe')]['length']>0x0){var _0xe22ccc=_0x5ce9ac['result'][0x0]['sys_id'];_0x1bf38a(_0xe22ccc);}else{return createRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a)['then'](function(_0x2da03c){_0x1bf38a(_0x2da03c);});}});});}function assignTagToIncident(_0x47de4c,_0x2f7092,_0x65432,_0x3cfd00,_0x19b4df){return new Promise(function(_0x232830,_0x272738){var _0xd10662={'method':_0x0a9e('0x20'),'uri':_0x65432+'label_entry'+'?'+_0x19b4df,'body':{'label':_0x47de4c,'table':_0x0a9e('0x36'),'id_type':_0x0a9e('0x3e'),'table_key':_0x3cfd00[_0x0a9e('0x3f')],'title':_0x0a9e('0x40')+_0x3cfd00[_0x0a9e('0x41')],'id_display':_0x3cfd00[_0x0a9e('0x41')]},'auth':_0x2f7092,'json':!![]};return rp(_0xd10662)['then'](function(_0x956fbe){_0x232830();})[_0x0a9e('0x1e')](function(){_0x232830();});});}function manageTags(_0x5239ef,_0x3649cc,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a,_0x5674ee){return new Promise(function(_0x273cb5,_0x49d231){var _0x2244d6=[];_0x3649cc[_0x0a9e('0x29')](function(_0x261adb){_0x2244d6[_0x0a9e('0x42')](getRemoteTag(_0x261adb,_0x5cc8fb,_0x20c668,_0x4b3c1a,_0x5674ee));});return Promise[_0x0a9e('0x43')](_0x2244d6)[_0x0a9e('0x19')](function(_0x49eed0){if(_0x49eed0[_0x0a9e('0x28')]){logger['info']('['+[_0x5239ef[_0x0a9e('0x11')]()]+_0x0a9e('0x44'),_0x49eed0);var _0x51aaf7=[];_0x49eed0['forEach'](function(_0x453360){_0x51aaf7[_0x0a9e('0x42')](assignTagToIncident(_0x453360,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a));});return Promise[_0x0a9e('0x43')](_0x51aaf7)[_0x0a9e('0x19')](function(){_0x273cb5();})['catch'](function(){_0x273cb5();});}else{_0x273cb5();}});});}function getTags(_0x1d0dc8,_0xe05a5a,_0x54327c,_0x797b45,_0x17e88c,_0x88dcbf){return function(_0x409b29){return new Promise(function(_0x401837,_0x4d4a35){var _0x176840=[];var _0x2937e0=_0x797b45[_0x0a9e('0x45')];if(_0x2937e0&&_0x2937e0['length']>0x0){_0x176840=_[_0x0a9e('0x46')](_0x2937e0,'name');}if(_0x176840['length']>0x0){return manageTags(_0x1d0dc8,_0x176840,_0xe05a5a,_0x54327c,_0x409b29,_0x17e88c,_0x88dcbf)[_0x0a9e('0x19')](function(){_0x401837(_0x409b29);});}else{_0x401837(_0x409b29);}});};}function emit(_0x4556c5,_0x9375fb,_0x19c995){var _0x186f39=_0x0a9e('0x47')+_0x0a9e('0x48')+_0x0a9e('0x49')+_0x0a9e('0x4a');var _0x1cc4f3={'uri':_0x4556c5+_0x0a9e('0x4b')+_0x19c995+_0x186f39};io['to'](util[_0x0a9e('0x4c')](_0x0a9e('0x4d'),_0x9375fb))[_0x0a9e('0x4e')](_0x0a9e('0x4f'),_0x1cc4f3);}exports['cs']=function(_0x412a72,_0x2a28c0,_0x4257c9,_0x5150a4,_0x1b0b98,_0x295763,_0x243d12,_0x4edbb0){var _0x1148a1={};var _0x30944e={'user':_0x295763['username'],'pass':_0x295763[_0x0a9e('0x50')]};var _0x56e31e=_0x0a9e('0x51');var _0x427946=_0x0a9e('0x52');_0x295763['remoteUri']=intUtil['stripTrailingSlash'](_0x295763['remoteUri']);_0x295763[_0x0a9e('0x53')]=intUtil[_0x0a9e('0x54')](_0x295763[_0x0a9e('0x53')]);var _0x23a7d3=util[_0x0a9e('0x4c')](_0x0a9e('0x55'),_0x295763[_0x0a9e('0x56')]);_0x1148a1[_0x0a9e('0x16')]=!_['isNil'](_0x5150a4)?_0x5150a4[_0x0a9e('0x57')]:null;_0x1148a1[_0x0a9e('0x1c')]=_0x295763[_0x0a9e('0x57')];_0x1148a1['endUserNumber']=_0x4edbb0[_0x0a9e('0x2f')]()==='outbound'?_0x2a28c0[_0x0a9e('0x58')]:_0x2a28c0[_0x0a9e('0x59')];_0x1148a1['callDirection']=_0x4edbb0===_0x0a9e('0x5a')||_0x4edbb0===_0x0a9e('0x5b')?_0x0a9e('0x5a'):_0x0a9e('0x35');var _0x542ece=util[_0x0a9e('0x4c')](_0x0a9e('0x5c'),_0x295763[_0x0a9e('0x53')],_0x2a28c0[_0x0a9e('0x5d')],md5(_0x2a28c0['uniqueid']));if(_0x1b0b98&&_0x1b0b98[_0x0a9e('0x5e')]){logger[_0x0a9e('0x10')](_0x0a9e('0x5f'),_0x0a9e('0x60'));_0x2a28c0['recordingURL']=_0x542ece;}else if(_0x243d12&&_0x243d12[_0x0a9e('0x61')]&&_0x243d12[_0x0a9e('0x61')]!==_0x0a9e('0x62')){logger[_0x0a9e('0x10')](_0x0a9e('0x63'),_0x0a9e('0x60'));_0x2a28c0[_0x0a9e('0x64')]=_0x542ece;}else{_0x2a28c0[_0x0a9e('0x64')]='';}return getAdminUser(_0x4edbb0,_0x30944e,_0x1148a1,_0x23a7d3,_0x427946,_0x56e31e)[_0x0a9e('0x19')](getUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getEndUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getTicket(_0x4edbb0,_0x30944e,_0x23a7d3,_0x4257c9,_0x2a28c0,_0x427946))[_0x0a9e('0x19')](function(_0x25744a){logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x65'),_0x25744a[_0x0a9e('0x3f')]));logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x66'),_0x4edbb0));if(_0x4edbb0!==_0x0a9e('0x5b')){logger[_0x0a9e('0x10')]('['+[_0x4edbb0[_0x0a9e('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x295763['remoteUri'],_0x5150a4[_0x0a9e('0x33')],_0x25744a[_0x0a9e('0x3f')]);}})['catch'](function(_0x45108c){logger['error']('['+[_0x4edbb0[_0x0a9e('0x11')]()]+_0x0a9e('0x67'),util['inspect'](_0x45108c,{'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 68effff..800baba 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 _0x898d=['./util','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','info','name','getString','Subjects','description','Descriptions','replace','duration_hours','duration_minutes','parent_id','parent_type','length','forEach','variableName','push','idField','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','stringify','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','entry_list','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','toLowerCase','content','customField','variable','custom_fields','Variable','POST','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Fields','Outbound','abandoned','[ABANDONED]','Inbound','request-promise','md5','util','ioredis'];(function(_0x19485d,_0x542121){var _0x17e883=function(_0x40890d){while(--_0x40890d){_0x19485d['push'](_0x19485d['shift']());}};_0x17e883(++_0x542121);}(_0x898d,0x73));var _0xd898=function(_0x458363,_0x1675db){_0x458363=_0x458363-0x0;var _0x4d0290=_0x898d[_0x458363];return _0x4d0290;};'use strict';var _=require('lodash');var rp=require(_0xd898('0x0'));var BPromise=require('bluebird');var md5=require(_0xd898('0x1'));var util=require(_0xd898('0x2'));var Redis=require(_0xd898('0x3'));var intUtil=require(_0xd898('0x4'));var config=require('../../../../config/environment');var logger=require(_0xd898('0x5'))(_0xd898('0x6'));config[_0xd898('0x7')]=_[_0xd898('0x8')](config[_0xd898('0x7')],{'host':_0xd898('0x9'),'port':0x18eb});var io=require(_0xd898('0xa'))(new Redis(config[_0xd898('0x7')]));var def={'method':'POST','json':!![]};function emit(_0x5d7756,_0x1cb720,_0x43375e){io['to'](_0x5d7756)[_0xd898('0xb')](_0x1cb720,_0x43375e);}function getTicket(_0x1baa01,_0x4a17b9,_0xdb0e18,_0x43029e,_0x55de2a,_0x5040ce,_0x31f541,_0x2e0d6a){logger[_0xd898('0xc')]('Creating\x20new\x20ticket...');var _0x450ab3=new Date();var _0x262636=[{'name':_0xd898('0xd'),'value':intUtil[_0xd898('0xe')](_0x43029e[_0xd898('0xf')],_0x55de2a,'\x20')},{'name':'assigned_user_id','value':_0x4a17b9['id']},{'name':'created_by','value':_0x4a17b9['id']},{'name':_0xd898('0x10'),'value':intUtil[_0xd898('0xe')](_0x43029e[_0xd898('0x11')],_0x55de2a,'\x0a')},{'name':'date_start','value':_0x450ab3['toISOString']()['slice'](0x0,0x13)[_0xd898('0x12')]('T','\x20')},{'name':_0xd898('0x13'),'value':'0'},{'name':_0xd898('0x14'),'value':'15'},{'name':_0xd898('0x15'),'value':_0xdb0e18['id']},{'name':_0xd898('0x16'),'value':'Contacts'},{'name':'parent_name','value':_0xdb0e18['name']},{'name':'direction','value':_0x2e0d6a}];if(_0x5040ce[_0xd898('0x17')]){_[_0xd898('0x18')](_0x5040ce,function(_0x5c95c4){if(_0x55de2a[_0x5c95c4[_0xd898('0x19')]]){_0x262636[_0xd898('0x1a')]({'name':_0x5c95c4[_0xd898('0x1b')],'value':_0x55de2a[_0x5c95c4[_0xd898('0x19')]]});}});}return request({'form':{'method':_0xd898('0x1c'),'input_type':_0xd898('0x1d'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x31f541['id'],'module_name':_0xd898('0x1e'),'name_value_list':_0x262636})}});}function getAuth(_0x42e0bd){return util[_0xd898('0x1f')](_0xd898('0x20'),new Buffer(_0x42e0bd[_0xd898('0x21')]+':X')[_0xd898('0x22')](_0xd898('0x23')));}function getServerInfo(_0x4a19f8){return request({'form':{'method':_0xd898('0x24'),'input_type':_0xd898('0x1d'),'response_type':_0xd898('0x1d'),'rest_data':JSON[_0xd898('0x25')]({'session':_0x4a19f8['id']})}});}function getUser(_0x3318f6,_0x10552c,_0x15fce5){if(!_[_0xd898('0x26')](_0x10552c)){logger[_0xd898('0xc')]('Getting\x20agent\x20with\x20name',_0x10552c);return request({'form':{'method':_0xd898('0x27'),'input_type':_0xd898('0x1d'),'response_type':_0xd898('0x1d'),'rest_data':JSON['stringify']({'session':_0x15fce5['id'],'module_name':_0xd898('0x28'),'query':util['format'](_0xd898('0x29'),_0x10552c),'order_by':'','offset':'0','select_fields':['id',_0xd898('0xd'),_0xd898('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd898('0x2b')](function(_0x5d6d69){if(_0x5d6d69['entry_list']['length']){var _0x55c3ff=_[_0xd898('0x2c')](_0x5d6d69[_0xd898('0x2d')],function(_0x164f0e){return _0x164f0e[_0xd898('0x2e')][_0xd898('0x2a')][_0xd898('0x2f')]===_0x10552c;});if(_0x55c3ff){logger[_0xd898('0xc')]('Agent\x20found!');return BPromise[_0xd898('0x30')]({'id':_0x55c3ff['name_value_list']['id'][_0xd898('0x2f')],'name':_0x55c3ff[_0xd898('0x2e')][_0xd898('0xd')]['value']});}}logger[_0xd898('0xc')](_0xd898('0x31'));return BPromise['resolve']({'id':_0x15fce5[_0xd898('0x2e')][_0xd898('0x32')]['value'],'name':_0x15fce5['name_value_list'][_0xd898('0x2a')]['value']});});}else{logger[_0xd898('0xc')](_0xd898('0x33'));return BPromise[_0xd898('0x30')]({'id':_0x15fce5[_0xd898('0x2e')][_0xd898('0x32')][_0xd898('0x2f')],'name':_0x15fce5[_0xd898('0x2e')][_0xd898('0x2a')][_0xd898('0x2f')]});}}function getEndUser(_0x6c765a,_0x2e3f18,_0x1b6e01,_0x559683){logger[_0xd898('0xc')](_0xd898('0x34'),_0x1b6e01);return request({'form':{'method':'get_entry_list','input_type':_0xd898('0x1d'),'response_type':_0xd898('0x1d'),'rest_data':JSON[_0xd898('0x25')]({'session':_0x559683['id'],'module_name':_0xd898('0x35'),'query':util[_0xd898('0x1f')](_0xd898('0x36'),_0x1b6e01),'order_by':'','offset':'0','select_fields':['id',_0xd898('0xd'),_0xd898('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd898('0x2b')](function(_0x4d3be0){if(_0x4d3be0[_0xd898('0x2d')][_0xd898('0x17')]){var _0x5534e0=_[_0xd898('0x2c')](_0x4d3be0[_0xd898('0x2d')],function(_0xff247e){return _0xff247e['name_value_list']['phone_home']['value']===_0x1b6e01;});if(_0x5534e0){logger[_0xd898('0xc')](_0xd898('0x38'));return BPromise[_0xd898('0x30')]({'id':_0x5534e0['name_value_list']['id'][_0xd898('0x2f')],'name':_0x5534e0[_0xd898('0x2e')][_0xd898('0xd')][_0xd898('0x2f')],'phone':_0x5534e0[_0xd898('0x2e')][_0xd898('0x37')][_0xd898('0x2f')]});}}else{logger[_0xd898('0xc')](_0xd898('0x39'));return request({'form':{'method':_0xd898('0x1c'),'input_type':_0xd898('0x1d'),'response_type':_0xd898('0x1d'),'rest_data':JSON[_0xd898('0x25')]({'session':_0x559683['id'],'module_name':'Contacts','name_value_list':[{'name':_0xd898('0x3a'),'value':_0x2e3f18!==''?_0x2e3f18:util[_0xd898('0x1f')]('Caller\x20-\x20%s',_0x1b6e01)},{'name':_0xd898('0x37'),'value':_0x1b6e01}]})}})[_0xd898('0x2b')](function(_0x3b1957){logger[_0xd898('0xc')](_0xd898('0x3b'));return BPromise['resolve']({'id':_0x3b1957['id'],'name':_0x3b1957[_0xd898('0x2d')][_0xd898('0x3a')][_0xd898('0x2f')],'phone':_0x3b1957[_0xd898('0x2d')][_0xd898('0x37')][_0xd898('0x2f')]});});}});}function request(_0x2e80f2){logger[_0xd898('0x3c')](_0xd898('0x3d'),JSON[_0xd898('0x25')](_0x2e80f2));return rp(_[_0xd898('0x3e')](def,_0x2e80f2));}function getTags(_0x4b58c1,_0x401269){var _0x1c1d4b=[];if(_0x4b58c1&&_0x4b58c1[_0xd898('0x17')]>0x0){_0x1c1d4b=_[_0xd898('0x3f')](_0x4b58c1,_0x401269);}return _0x1c1d4b;}function getCustomFields(_0x74274e,_0x2fa549){var _0x1695c5=[];var _0x3bbbfe={'custom_fields':[]};if(_0x74274e[_0xd898('0x17')]>0x0){_[_0xd898('0x18')](_0x74274e,function(_0x4ec4b2){if(_0x4ec4b2[_0xd898('0x40')]===_0xd898('0x41')&&_0x4ec4b2[_0xd898('0x42')]&&!_0x4ec4b2['customField']){_0x3bbbfe[_0x4ec4b2[_0xd898('0x42')][_0xd898('0x43')]()]=_0x4ec4b2[_0xd898('0x44')][_0xd898('0x22')]();}else if(_0x4ec4b2['type']==='string'&&_0x4ec4b2[_0xd898('0x1b')]&&_0x4ec4b2[_0xd898('0x45')]){_0x3bbbfe['custom_fields'][_0xd898('0x1a')]({'id':_0x4ec4b2[_0xd898('0x1b')],'value':_0x4ec4b2[_0xd898('0x44')][_0xd898('0x22')]()});}else if(_0x4ec4b2[_0xd898('0x40')]===_0xd898('0x46')&&_0x4ec4b2[_0xd898('0x19')]&&_0x4ec4b2['idField']&&_0x4ec4b2[_0xd898('0x45')]){_0x2fa549[_0x4ec4b2[_0xd898('0x19')]]&&_0x3bbbfe[_0xd898('0x47')][_0xd898('0x1a')]({'id':_0x4ec4b2[_0xd898('0x1b')],'value':_0x2fa549[_0x4ec4b2[_0xd898('0x19')]][_0xd898('0x22')]()});}else if(_0x4ec4b2['type']==='customVariable'&&_0x4ec4b2[_0xd898('0x48')]&&_0x4ec4b2[_0xd898('0x48')]['name']&&_0x4ec4b2[_0xd898('0x1b')]&&_0x4ec4b2[_0xd898('0x45')]){_0x2fa549[_0x4ec4b2[_0xd898('0x48')][_0xd898('0xd')][_0xd898('0x43')]()]&&_0x3bbbfe[_0xd898('0x47')]['push']({'id':_0x4ec4b2[_0xd898('0x1b')],'value':_0x2fa549[_0x4ec4b2[_0xd898('0x48')][_0xd898('0xd')][_0xd898('0x43')]()][_0xd898('0x22')]()});}});}return _0x3bbbfe;}function getConnection(_0xb00a01){return request({'method':_0xd898('0x49'),'form':{'method':_0xd898('0x4a'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xd898('0x25')]({'user_auth':{'user_name':_0xb00a01['username'],'password':_0xb00a01[_0xd898('0x4b')],'encryption':_0xd898('0x4c')},'application':_0xd898('0x4d')})}})[_0xd898('0x2b')](function(_0x25b4f8){var _0x7ebe29=_0x25b4f8;if(_0x7ebe29['id']){def[_0xd898('0x4e')]=_0x7ebe29['id'];return BPromise[_0xd898('0x30')](_0x7ebe29);}else{throw new Error(util[_0xd898('0x1f')](_0xd898('0x4f'),_0xb00a01['id']));}});}function setRelationship(_0x337f45,_0x2deb64,_0x53b834,_0x5c74d8){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':_0xd898('0x1d'),'rest_data':JSON[_0xd898('0x25')]({'session':_0x337f45['id'],'module_name':_0xd898('0x1e'),'module_id':_0x53b834['id'],'link_field_name':_0x5c74d8,'related_ids':[_0x2deb64['id']]})}});}exports[_0xd898('0x50')]=function(_0x56d187,_0x902aef,_0x40f1b4,_0x1562e6,_0x2f176a,_0x1ab8f2){var _0x325a01,_0xaddbaa,_0x5514a6,_0x3400da;_0x1ab8f2[_0xd898('0x51')]=intUtil['stripTrailingSlash'](_0x1ab8f2['remoteUri']);_0x1ab8f2[_0xd898('0x52')]=intUtil[_0xd898('0x53')](_0x1ab8f2[_0xd898('0x52')]);def[_0xd898('0x54')]=util[_0xd898('0x1f')](_0xd898('0x55'),_0x1ab8f2['remoteUri']);if(_0x2f176a&&_0x2f176a[_0xd898('0x56')]){logger['info'](_0xd898('0x57'),'Recording\x20is\x20enabled!');_0x902aef[_0xd898('0x58')]=util[_0xd898('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1ab8f2[_0xd898('0x52')],_0x902aef[_0xd898('0x59')],md5(_0x902aef[_0xd898('0x59')]));}else{_0x902aef[_0xd898('0x58')]='';}return getConnection(_0x1ab8f2)[_0xd898('0x2b')](function(_0x3bf2b5){_0x3400da=_0x3bf2b5;return getUser(_0x1ab8f2,_0x1562e6[_0xd898('0xd')],_0x3400da);})[_0xd898('0x2b')](function(_0x2d05d1){_0x325a01=_0x2d05d1;logger[_0xd898('0xc')](_0xd898('0x5a'),_0x325a01['id']);return getEndUser(_0x1ab8f2,_0x902aef[_0xd898('0x5b')],_0x902aef[_0xd898('0x5c')],_0x3400da);})['then'](function(_0x3db9ed){_0xaddbaa=_0x3db9ed;logger[_0xd898('0xc')]('The\x20Enduser\x20ID\x20is:',_0xaddbaa['id']);return getTicket(_0x1ab8f2,_0x325a01,_0xaddbaa,_0x40f1b4,_0x902aef,_0x40f1b4['Fields'],_0x3400da,'Inbound');})[_0xd898('0x2b')](function(_0x5aa22a){_0x5514a6=_0x5aa22a;logger[_0xd898('0xc')](_0xd898('0x5d'));logger[_0xd898('0xc')](_0xd898('0x5e'),_0x5514a6['id']);return setRelationship(_0x3400da,_0x325a01,_0x5514a6,_0xd898('0x5f'));})[_0xd898('0x2b')](function(){return setRelationship(_0x3400da,_0xaddbaa,_0x5514a6,_0xd898('0x60'));})[_0xd898('0x2b')](function(){return getServerInfo(_0x3400da);})[_0xd898('0x2b')](function(_0x2e07be){var _0x296b49=parseInt(_0x2e07be['version'][_0xd898('0x61')](0x0));var _0x32a6b4=util[_0xd898('0x1f')](_0xd898('0x62'),_0x1ab8f2[_0xd898('0x51')],_0x5514a6['id']);if(_0x296b49>0x6){_0x32a6b4=util[_0xd898('0x1f')](_0xd898('0x63'),_0x1ab8f2[_0xd898('0x51')],_0x5514a6['id']);}logger['info'](_0xd898('0x57'),_0xd898('0x64'));emit(util['format'](_0xd898('0x65'),_0x1562e6[_0xd898('0xd')]),_0xd898('0x66'),{'uri':_0x32a6b4});})[_0xd898('0x67')](function(_0x11c767){logger[_0xd898('0x68')]('[QUEUE]',JSON['stringify'](_0x11c767));});};exports[_0xd898('0x69')]=function(_0x2e2a28,_0x43304c,_0x55461b,_0x3daa76,_0x40bcf8,_0x52e2c5,_0x26681f){var _0xb0c28a,_0x3d02dc,_0x2fb193,_0x4e898d;_0x52e2c5[_0xd898('0x51')]=intUtil[_0xd898('0x53')](_0x52e2c5[_0xd898('0x51')]);_0x52e2c5[_0xd898('0x52')]=intUtil[_0xd898('0x53')](_0x52e2c5[_0xd898('0x52')]);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x52e2c5[_0xd898('0x51')]);if(_0x26681f&&_0x26681f[_0xd898('0x6a')]&&_0x26681f['recordingFormat']!==_0xd898('0x6b')){logger[_0xd898('0xc')](_0xd898('0x6c'),_0xd898('0x6d'));_0x43304c['recordingURL']=util['format'](_0xd898('0x6e'),_0x52e2c5['serverUrl'],_0x43304c[_0xd898('0x59')],md5(_0x43304c[_0xd898('0x59')]));}return getConnection(_0x52e2c5)[_0xd898('0x2b')](function(_0x1a19f3){_0x4e898d=_0x1a19f3;return getUser(_0x52e2c5,_0x3daa76['name'],_0x4e898d);})['then'](function(_0x46a8d4){_0xb0c28a=_0x46a8d4;logger[_0xd898('0xc')](_0xd898('0x5a'),_0xb0c28a['id']);return getEndUser(_0x52e2c5,_0x43304c[_0xd898('0x6f')],_0x43304c[_0xd898('0x70')],_0x4e898d);})[_0xd898('0x2b')](function(_0x54b41f){_0x3d02dc=_0x54b41f;logger['info'](_0xd898('0x71'),_0x3d02dc['id']);return getTicket(_0x52e2c5,_0xb0c28a,_0x3d02dc,_0x55461b,_0x43304c,_0x55461b[_0xd898('0x72')],_0x4e898d,_0xd898('0x73'));})['then'](function(_0x4c581d){_0x2fb193=_0x4c581d;logger[_0xd898('0xc')](_0xd898('0x5d'));logger[_0xd898('0xc')](_0xd898('0x5e'),_0x2fb193['id']);return setRelationship(_0x4e898d,_0xb0c28a,_0x2fb193,_0xd898('0x5f'));})[_0xd898('0x2b')](function(){return setRelationship(_0x4e898d,_0x3d02dc,_0x2fb193,'contacts');})[_0xd898('0x2b')](function(){return getServerInfo(_0x4e898d);})[_0xd898('0x2b')](function(_0x24ad13){var _0x5df46e=parseInt(_0x24ad13['version'][_0xd898('0x61')](0x0));var _0x156dd4=util['format'](_0xd898('0x62'),_0x52e2c5['remoteUri'],_0x2fb193['id']);if(_0x5df46e>0x6){_0x156dd4=util[_0xd898('0x1f')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x52e2c5['remoteUri'],_0x2fb193['id']);}logger['info'](_0xd898('0x6c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd898('0x1f')](_0xd898('0x65'),_0x3daa76[_0xd898('0xd')]),_0xd898('0x66'),{'uri':_0x156dd4});})[_0xd898('0x67')](function(_0x363116){logger[_0xd898('0x68')]('[OUTBOUND]',JSON[_0xd898('0x25')](_0x363116));});};exports[_0xd898('0x74')]=function(_0x1f08dd,_0x3ef459,_0x3b5f0e,_0x251735,_0x1325a7,_0x5e784a){var _0x496cdd,_0x1018b7,_0x41e994,_0x18f822;_0x5e784a[_0xd898('0x51')]=intUtil[_0xd898('0x53')](_0x5e784a[_0xd898('0x51')]);_0x5e784a[_0xd898('0x52')]=intUtil[_0xd898('0x53')](_0x5e784a[_0xd898('0x52')]);def[_0xd898('0x54')]=util[_0xd898('0x1f')](_0xd898('0x55'),_0x5e784a[_0xd898('0x51')]);if(_0x1325a7&&_0x1325a7[_0xd898('0x56')]){logger['info'](_0xd898('0x75'),_0xd898('0x6d'));_0x3ef459[_0xd898('0x58')]=util[_0xd898('0x1f')](_0xd898('0x6e'),_0x5e784a[_0xd898('0x52')],_0x3ef459[_0xd898('0x59')],md5(_0x3ef459[_0xd898('0x59')]));}else{_0x3ef459['recordingURL']='';}return getConnection(_0x5e784a)[_0xd898('0x2b')](function(_0x57de5f){_0x18f822=_0x57de5f;if(!_[_0xd898('0x26')](_0x251735)){return getUser(_0x5e784a,_0x251735[_0xd898('0xd')],_0x18f822);}else{return getUser(_0x5e784a,null,_0x18f822);}})[_0xd898('0x2b')](function(_0x51d5b6){_0x496cdd=_0x51d5b6;logger['info'](_0xd898('0x5a'),_0x496cdd['id']);return getEndUser(_0x5e784a,_0x3ef459['calleridname'],_0x3ef459[_0xd898('0x5c')],_0x18f822);})[_0xd898('0x2b')](function(_0x1cb2d4){_0x1018b7=_0x1cb2d4;logger[_0xd898('0xc')](_0xd898('0x71'),_0x1018b7['id']);return getTicket(_0x5e784a,_0x496cdd,_0x1018b7,_0x3b5f0e,_0x3ef459,_0x3b5f0e[_0xd898('0x72')],_0x18f822,_0xd898('0x76'));})[_0xd898('0x2b')](function(_0x5485cf){_0x41e994=_0x5485cf;logger[_0xd898('0xc')](_0xd898('0x5d'));logger[_0xd898('0xc')](_0xd898('0x5e'),_0x41e994['id']);return setRelationship(_0x18f822,_0x496cdd,_0x41e994,'users');})[_0xd898('0x2b')](function(){return setRelationship(_0x18f822,_0x1018b7,_0x41e994,_0xd898('0x60'));})[_0xd898('0x2b')](function(){return getServerInfo(_0x18f822);})[_0xd898('0x67')](function(_0x422b65){logger[_0xd898('0x68')](_0xd898('0x75'),JSON['stringify'](_0x422b65));});}; \ No newline at end of file +var _0x12d7=['variable','customVariable','Variable','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','Outbound','charAt','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','abandoned','isNil','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','assigned_user_id','created_by','description','getString','toISOString','slice','replace','duration_minutes','parent_id','Contacts','parent_name','direction','forEach','idField','variableName','set_entry','JSON','Calls','format','Basic\x20%s','toString','base64','get_server_info','stringify','info','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','length','find','entry_list','name_value_list','value','resolve','user_id','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','map','string','nameField','customField','content','type','custom_fields'];(function(_0x234e01,_0x37402f){var _0x95549d=function(_0x32fdb1){while(--_0x32fdb1){_0x234e01['push'](_0x234e01['shift']());}};_0x95549d(++_0x37402f);}(_0x12d7,0x181));var _0x712d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12d7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x712d('0x0'));var rp=require('request-promise');var BPromise=require(_0x712d('0x1'));var md5=require(_0x712d('0x2'));var util=require(_0x712d('0x3'));var Redis=require(_0x712d('0x4'));var intUtil=require(_0x712d('0x5'));var config=require(_0x712d('0x6'));var logger=require('../../../../config/logger')(_0x712d('0x7'));config[_0x712d('0x8')]=_[_0x712d('0x9')](config[_0x712d('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x712d('0xa'))(new Redis(config[_0x712d('0x8')]));var def={'method':_0x712d('0xb'),'json':!![]};function emit(_0x1dde71,_0x2e32c1,_0x40c2a0){io['to'](_0x1dde71)[_0x712d('0xc')](_0x2e32c1,_0x40c2a0);}function getTicket(_0x3ccad4,_0x43b738,_0x42f1cd,_0x7e6a6a,_0x3cd307,_0x18ad55,_0x3e63ec,_0x49979e){logger['info'](_0x712d('0xd'));var _0x5694a5=new Date();var _0x9e49d2=[{'name':_0x712d('0xe'),'value':intUtil['getString'](_0x7e6a6a['Subjects'],_0x3cd307,'\x20')},{'name':_0x712d('0xf'),'value':_0x43b738['id']},{'name':_0x712d('0x10'),'value':_0x43b738['id']},{'name':_0x712d('0x11'),'value':intUtil[_0x712d('0x12')](_0x7e6a6a['Descriptions'],_0x3cd307,'\x0a')},{'name':'date_start','value':_0x5694a5[_0x712d('0x13')]()[_0x712d('0x14')](0x0,0x13)[_0x712d('0x15')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x712d('0x16'),'value':'15'},{'name':_0x712d('0x17'),'value':_0x42f1cd['id']},{'name':'parent_type','value':_0x712d('0x18')},{'name':_0x712d('0x19'),'value':_0x42f1cd[_0x712d('0xe')]},{'name':_0x712d('0x1a'),'value':_0x49979e}];if(_0x18ad55['length']){_[_0x712d('0x1b')](_0x18ad55,function(_0x55cdac){if(_0x3cd307[_0x55cdac['variableName']]){_0x9e49d2['push']({'name':_0x55cdac[_0x712d('0x1c')],'value':_0x3cd307[_0x55cdac[_0x712d('0x1d')]]});}});}return request({'form':{'method':_0x712d('0x1e'),'input_type':'JSON','response_type':_0x712d('0x1f'),'rest_data':JSON['stringify']({'session':_0x3e63ec['id'],'module_name':_0x712d('0x20'),'name_value_list':_0x9e49d2})}});}function getAuth(_0x3171ba){return util[_0x712d('0x21')](_0x712d('0x22'),new Buffer(_0x3171ba['apiKey']+':X')[_0x712d('0x23')](_0x712d('0x24')));}function getServerInfo(_0x401512){return request({'form':{'method':_0x712d('0x25'),'input_type':_0x712d('0x1f'),'response_type':_0x712d('0x1f'),'rest_data':JSON[_0x712d('0x26')]({'session':_0x401512['id']})}});}function getUser(_0x1684a5,_0x417b07,_0x1af00b){if(!_['isNil'](_0x417b07)){logger[_0x712d('0x27')]('Getting\x20agent\x20with\x20name',_0x417b07);return request({'form':{'method':_0x712d('0x28'),'input_type':_0x712d('0x1f'),'response_type':'JSON','rest_data':JSON[_0x712d('0x26')]({'session':_0x1af00b['id'],'module_name':_0x712d('0x29'),'query':util[_0x712d('0x21')](_0x712d('0x2a'),_0x417b07),'order_by':'','offset':'0','select_fields':['id',_0x712d('0xe'),_0x712d('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x712d('0x2c')](function(_0x23c755){if(_0x23c755['entry_list'][_0x712d('0x2d')]){var _0x13eb36=_[_0x712d('0x2e')](_0x23c755[_0x712d('0x2f')],function(_0x49a62b){return _0x49a62b[_0x712d('0x30')]['user_name'][_0x712d('0x31')]===_0x417b07;});if(_0x13eb36){logger[_0x712d('0x27')]('Agent\x20found!');return BPromise[_0x712d('0x32')]({'id':_0x13eb36['name_value_list']['id'][_0x712d('0x31')],'name':_0x13eb36[_0x712d('0x30')][_0x712d('0xe')][_0x712d('0x31')]});}}logger[_0x712d('0x27')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x712d('0x32')]({'id':_0x1af00b[_0x712d('0x30')][_0x712d('0x33')]['value'],'name':_0x1af00b['name_value_list']['user_name']['value']});});}else{logger[_0x712d('0x27')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x712d('0x32')]({'id':_0x1af00b[_0x712d('0x30')][_0x712d('0x33')][_0x712d('0x31')],'name':_0x1af00b[_0x712d('0x30')][_0x712d('0x2b')][_0x712d('0x31')]});}}function getEndUser(_0x4c0b5e,_0xb94495,_0x11e8e9,_0x4cf470){logger[_0x712d('0x27')]('Searching\x20enduser\x20with\x20phone',_0x11e8e9);return request({'form':{'method':_0x712d('0x28'),'input_type':_0x712d('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4cf470['id'],'module_name':_0x712d('0x18'),'query':util[_0x712d('0x21')](_0x712d('0x34'),_0x11e8e9),'order_by':'','offset':'0','select_fields':['id',_0x712d('0xe'),_0x712d('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x712d('0x2c')](function(_0x23b727){if(_0x23b727['entry_list'][_0x712d('0x2d')]){var _0x1839b4=_[_0x712d('0x2e')](_0x23b727[_0x712d('0x2f')],function(_0x7cb9f4){return _0x7cb9f4[_0x712d('0x30')]['phone_home'][_0x712d('0x31')]===_0x11e8e9;});if(_0x1839b4){logger[_0x712d('0x27')]('Enduser\x20found!');return BPromise[_0x712d('0x32')]({'id':_0x1839b4[_0x712d('0x30')]['id']['value'],'name':_0x1839b4[_0x712d('0x30')][_0x712d('0xe')]['value'],'phone':_0x1839b4[_0x712d('0x30')][_0x712d('0x35')][_0x712d('0x31')]});}}else{logger[_0x712d('0x27')](_0x712d('0x36'));return request({'form':{'method':'set_entry','input_type':_0x712d('0x1f'),'response_type':_0x712d('0x1f'),'rest_data':JSON[_0x712d('0x26')]({'session':_0x4cf470['id'],'module_name':_0x712d('0x18'),'name_value_list':[{'name':_0x712d('0x37'),'value':_0xb94495!==_0x712d('0x38')?_0xb94495:util[_0x712d('0x21')](_0x712d('0x39'),_0x11e8e9)},{'name':_0x712d('0x35'),'value':_0x11e8e9}]})}})[_0x712d('0x2c')](function(_0x443099){logger[_0x712d('0x27')](_0x712d('0x3a'));return BPromise[_0x712d('0x32')]({'id':_0x443099['id'],'name':_0x443099[_0x712d('0x2f')][_0x712d('0x37')][_0x712d('0x31')],'phone':_0x443099[_0x712d('0x2f')][_0x712d('0x35')][_0x712d('0x31')]});});}});}function request(_0x42c1c9){logger[_0x712d('0x3b')]('[HTTP]',JSON[_0x712d('0x26')](_0x42c1c9));return rp(_['merge'](def,_0x42c1c9));}function getTags(_0x2368f0,_0x434c56){var _0x5b7d8e=[];if(_0x2368f0&&_0x2368f0['length']>0x0){_0x5b7d8e=_[_0x712d('0x3c')](_0x2368f0,_0x434c56);}return _0x5b7d8e;}function getCustomFields(_0x2d2fe8,_0x4d255e){var _0x340978=[];var _0x5bca7d={'custom_fields':[]};if(_0x2d2fe8[_0x712d('0x2d')]>0x0){_[_0x712d('0x1b')](_0x2d2fe8,function(_0x584a01){if(_0x584a01['type']===_0x712d('0x3d')&&_0x584a01[_0x712d('0x3e')]&&!_0x584a01[_0x712d('0x3f')]){_0x5bca7d[_0x584a01[_0x712d('0x3e')]['toLowerCase']()]=_0x584a01[_0x712d('0x40')]['toString']();}else if(_0x584a01[_0x712d('0x41')]===_0x712d('0x3d')&&_0x584a01[_0x712d('0x1c')]&&_0x584a01['customField']){_0x5bca7d[_0x712d('0x42')]['push']({'id':_0x584a01[_0x712d('0x1c')],'value':_0x584a01['content'][_0x712d('0x23')]()});}else if(_0x584a01['type']===_0x712d('0x43')&&_0x584a01[_0x712d('0x1d')]&&_0x584a01[_0x712d('0x1c')]&&_0x584a01[_0x712d('0x3f')]){_0x4d255e[_0x584a01[_0x712d('0x1d')]]&&_0x5bca7d[_0x712d('0x42')]['push']({'id':_0x584a01['idField'],'value':_0x4d255e[_0x584a01[_0x712d('0x1d')]][_0x712d('0x23')]()});}else if(_0x584a01[_0x712d('0x41')]===_0x712d('0x44')&&_0x584a01[_0x712d('0x45')]&&_0x584a01[_0x712d('0x45')][_0x712d('0xe')]&&_0x584a01[_0x712d('0x1c')]&&_0x584a01[_0x712d('0x3f')]){_0x4d255e[_0x584a01[_0x712d('0x45')][_0x712d('0xe')]['toLowerCase']()]&&_0x5bca7d[_0x712d('0x42')]['push']({'id':_0x584a01[_0x712d('0x1c')],'value':_0x4d255e[_0x584a01['Variable'][_0x712d('0xe')]['toLowerCase']()][_0x712d('0x23')]()});}});}return _0x5bca7d;}function getConnection(_0x3b648e){return request({'method':_0x712d('0xb'),'form':{'method':'login','input_type':_0x712d('0x1f'),'response_type':_0x712d('0x1f'),'rest_data':JSON[_0x712d('0x26')]({'user_auth':{'user_name':_0x3b648e[_0x712d('0x46')],'password':_0x3b648e[_0x712d('0x47')],'encryption':_0x712d('0x48')},'application':_0x712d('0x49')})}})['then'](function(_0x206926){var _0x3157f5=_0x206926;if(_0x3157f5['id']){def[_0x712d('0x4a')]=_0x3157f5['id'];return BPromise[_0x712d('0x32')](_0x3157f5);}else{throw new Error(util[_0x712d('0x21')](_0x712d('0x4b'),_0x3b648e['id']));}});}function setRelationship(_0x247410,_0x16b72d,_0x2b818a,_0x1fa82b){return request({'form':{'method':'set_relationship','input_type':_0x712d('0x1f'),'response_type':_0x712d('0x1f'),'rest_data':JSON[_0x712d('0x26')]({'session':_0x247410['id'],'module_name':_0x712d('0x20'),'module_id':_0x2b818a['id'],'link_field_name':_0x1fa82b,'related_ids':[_0x16b72d['id']]})}});}exports['queue']=function(_0x3668a8,_0x27da0a,_0x245e9c,_0x4be6f6,_0x3f7690,_0x4e7720){var _0x48df7e,_0x32506f,_0x584baa,_0x1721a8;_0x4e7720['remoteUri']=intUtil[_0x712d('0x4c')](_0x4e7720[_0x712d('0x4d')]);_0x4e7720[_0x712d('0x4e')]=intUtil[_0x712d('0x4c')](_0x4e7720[_0x712d('0x4e')]);def[_0x712d('0x4f')]=util[_0x712d('0x21')](_0x712d('0x50'),_0x4e7720['remoteUri']);if(_0x3f7690&&_0x3f7690[_0x712d('0x51')]){logger[_0x712d('0x27')](_0x712d('0x52'),'Recording\x20is\x20enabled!');_0x27da0a[_0x712d('0x53')]=util['format'](_0x712d('0x54'),_0x4e7720[_0x712d('0x4e')],_0x27da0a[_0x712d('0x55')],md5(_0x27da0a[_0x712d('0x55')]));}else{_0x27da0a[_0x712d('0x53')]='';}return getConnection(_0x4e7720)[_0x712d('0x2c')](function(_0x148a38){_0x1721a8=_0x148a38;return getUser(_0x4e7720,_0x4be6f6[_0x712d('0xe')],_0x1721a8);})[_0x712d('0x2c')](function(_0x3b66c2){_0x48df7e=_0x3b66c2;logger['info'](_0x712d('0x56'),_0x48df7e['id']);return getEndUser(_0x4e7720,_0x27da0a[_0x712d('0x57')],_0x27da0a[_0x712d('0x58')],_0x1721a8);})[_0x712d('0x2c')](function(_0x1f81ca){_0x32506f=_0x1f81ca;logger[_0x712d('0x27')](_0x712d('0x59'),_0x32506f['id']);return getTicket(_0x4e7720,_0x48df7e,_0x32506f,_0x245e9c,_0x27da0a,_0x245e9c[_0x712d('0x5a')],_0x1721a8,_0x712d('0x5b'));})[_0x712d('0x2c')](function(_0x352b83){_0x584baa=_0x352b83;logger['info'](_0x712d('0x5c'));logger['info'](_0x712d('0x5d'),_0x584baa['id']);return setRelationship(_0x1721a8,_0x48df7e,_0x584baa,_0x712d('0x5e'));})['then'](function(){return setRelationship(_0x1721a8,_0x32506f,_0x584baa,_0x712d('0x5f'));})[_0x712d('0x2c')](function(){return getServerInfo(_0x1721a8);})[_0x712d('0x2c')](function(_0xd41d71){var _0x34b5df=parseInt(_0xd41d71[_0x712d('0x60')]['charAt'](0x0));var _0x4e70ce=util[_0x712d('0x21')](_0x712d('0x61'),_0x4e7720[_0x712d('0x4d')],_0x584baa['id']);if(_0x34b5df>0x6){_0x4e70ce=util[_0x712d('0x21')](_0x712d('0x62'),_0x4e7720['remoteUri'],_0x584baa['id']);}logger['info'](_0x712d('0x52'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x712d('0x21')](_0x712d('0x63'),_0x4be6f6[_0x712d('0xe')]),'trigger:browser:url',{'uri':_0x4e70ce});})[_0x712d('0x64')](function(_0x684025){logger[_0x712d('0x65')](_0x712d('0x52'),JSON[_0x712d('0x26')](_0x684025));});};exports[_0x712d('0x66')]=function(_0x4b49a4,_0x3bfbcc,_0x155d91,_0x3ff1bb,_0x166f92,_0x50824c,_0x872de1){var _0x29341f,_0x260e7a,_0xbdf02f,_0x302602;_0x50824c[_0x712d('0x4d')]=intUtil[_0x712d('0x4c')](_0x50824c['remoteUri']);_0x50824c[_0x712d('0x4e')]=intUtil[_0x712d('0x4c')](_0x50824c[_0x712d('0x4e')]);def[_0x712d('0x4f')]=util[_0x712d('0x21')](_0x712d('0x50'),_0x50824c[_0x712d('0x4d')]);if(_0x872de1&&_0x872de1[_0x712d('0x67')]&&_0x872de1[_0x712d('0x67')]!==_0x712d('0x68')){logger['info'](_0x712d('0x69'),_0x712d('0x6a'));_0x3bfbcc[_0x712d('0x53')]=util['format'](_0x712d('0x54'),_0x50824c[_0x712d('0x4e')],_0x3bfbcc['uniqueid'],md5(_0x3bfbcc[_0x712d('0x55')]));}return getConnection(_0x50824c)['then'](function(_0x1bec75){_0x302602=_0x1bec75;return getUser(_0x50824c,_0x3ff1bb[_0x712d('0xe')],_0x302602);})['then'](function(_0x49e967){_0x29341f=_0x49e967;logger[_0x712d('0x27')](_0x712d('0x56'),_0x29341f['id']);return getEndUser(_0x50824c,_0x3bfbcc['destcalleridname'],_0x3bfbcc[_0x712d('0x6b')],_0x302602);})[_0x712d('0x2c')](function(_0x49c707){_0x260e7a=_0x49c707;logger[_0x712d('0x27')](_0x712d('0x59'),_0x260e7a['id']);return getTicket(_0x50824c,_0x29341f,_0x260e7a,_0x155d91,_0x3bfbcc,_0x155d91[_0x712d('0x5a')],_0x302602,_0x712d('0x6c'));})['then'](function(_0x24e5f8){_0xbdf02f=_0x24e5f8;logger[_0x712d('0x27')](_0x712d('0x5c'));logger[_0x712d('0x27')]('The\x20Ticket\x20ID\x20is:',_0xbdf02f['id']);return setRelationship(_0x302602,_0x29341f,_0xbdf02f,'users');})[_0x712d('0x2c')](function(){return setRelationship(_0x302602,_0x260e7a,_0xbdf02f,_0x712d('0x5f'));})[_0x712d('0x2c')](function(){return getServerInfo(_0x302602);})[_0x712d('0x2c')](function(_0x5e8f5d){var _0x29701b=parseInt(_0x5e8f5d[_0x712d('0x60')][_0x712d('0x6d')](0x0));var _0x41f6a2=util[_0x712d('0x21')](_0x712d('0x61'),_0x50824c[_0x712d('0x4d')],_0xbdf02f['id']);if(_0x29701b>0x6){_0x41f6a2=util[_0x712d('0x21')](_0x712d('0x62'),_0x50824c[_0x712d('0x4d')],_0xbdf02f['id']);}logger['info'](_0x712d('0x69'),_0x712d('0x6e'));emit(util[_0x712d('0x21')]('user:%s',_0x3ff1bb[_0x712d('0xe')]),'trigger:browser:url',{'uri':_0x41f6a2});})[_0x712d('0x64')](function(_0x262931){logger[_0x712d('0x65')](_0x712d('0x69'),JSON[_0x712d('0x26')](_0x262931));});};exports[_0x712d('0x6f')]=function(_0x3fa847,_0x4c5789,_0x186591,_0x5f184d,_0x470a7f,_0x3bd780){var _0x2b3f51,_0x332c89,_0x463d8e,_0x45b2a7;_0x3bd780[_0x712d('0x4d')]=intUtil[_0x712d('0x4c')](_0x3bd780['remoteUri']);_0x3bd780[_0x712d('0x4e')]=intUtil[_0x712d('0x4c')](_0x3bd780[_0x712d('0x4e')]);def[_0x712d('0x4f')]=util[_0x712d('0x21')](_0x712d('0x50'),_0x3bd780[_0x712d('0x4d')]);if(_0x470a7f&&_0x470a7f[_0x712d('0x51')]){logger['info']('[ABANDONED]',_0x712d('0x6a'));_0x4c5789['recordingURL']=util[_0x712d('0x21')](_0x712d('0x54'),_0x3bd780['serverUrl'],_0x4c5789[_0x712d('0x55')],md5(_0x4c5789[_0x712d('0x55')]));}else{_0x4c5789[_0x712d('0x53')]='';}return getConnection(_0x3bd780)['then'](function(_0x28b060){_0x45b2a7=_0x28b060;if(!_[_0x712d('0x70')](_0x5f184d)){return getUser(_0x3bd780,_0x5f184d[_0x712d('0xe')],_0x45b2a7);}else{return getUser(_0x3bd780,null,_0x45b2a7);}})[_0x712d('0x2c')](function(_0x3a6438){_0x2b3f51=_0x3a6438;logger[_0x712d('0x27')]('The\x20User\x20ID\x20is:',_0x2b3f51['id']);return getEndUser(_0x3bd780,_0x4c5789['calleridname'],_0x4c5789[_0x712d('0x58')],_0x45b2a7);})['then'](function(_0x33d5ff){_0x332c89=_0x33d5ff;logger[_0x712d('0x27')](_0x712d('0x59'),_0x332c89['id']);return getTicket(_0x3bd780,_0x2b3f51,_0x332c89,_0x186591,_0x4c5789,_0x186591[_0x712d('0x5a')],_0x45b2a7,_0x712d('0x5b'));})[_0x712d('0x2c')](function(_0xcac266){_0x463d8e=_0xcac266;logger[_0x712d('0x27')](_0x712d('0x5c'));logger[_0x712d('0x27')](_0x712d('0x5d'),_0x463d8e['id']);return setRelationship(_0x45b2a7,_0x2b3f51,_0x463d8e,'users');})[_0x712d('0x2c')](function(){return setRelationship(_0x45b2a7,_0x332c89,_0x463d8e,'contacts');})[_0x712d('0x2c')](function(){return getServerInfo(_0x45b2a7);})[_0x712d('0x64')](function(_0x499619){logger[_0x712d('0x65')]('[ABANDONED]',JSON[_0x712d('0x26')](_0x499619));});}; \ 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 7f24c3d..3a2e7ea 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 _0xbfa7=['toString','customVariable','Variable','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','variable','name','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','lodash','util','getString','length','sortBy','string','push','content','type','variableName'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbfa7,0x66));var _0x7bfa=function(_0x29776d,_0x5201b1){_0x29776d=_0x29776d-0x0;var _0x997fb=_0xbfa7[_0x29776d];return _0x997fb;};'use strict';var _=require(_0x7bfa('0x0'));var util=require(_0x7bfa('0x1'));exports[_0x7bfa('0x2')]=function(_0x91b19a,_0x2a2de3,_0x34dbe3){var _0x4497d9=[];if(_0x91b19a[_0x7bfa('0x3')]>0x0){var _0x2ffa5b=_[_0x7bfa('0x4')](_0x91b19a,['id']);for(var _0xc21d13=0x0;_0xc21d13<_0x2ffa5b[_0x7bfa('0x3')];_0xc21d13++){var _0x3edd31=_0x2ffa5b[_0xc21d13];if(_0x3edd31['type']===_0x7bfa('0x5')){_0x4497d9[_0x7bfa('0x6')](_0x3edd31[_0x7bfa('0x7')]);}else if(_0x3edd31[_0x7bfa('0x8')]==='variable'&&_0x3edd31[_0x7bfa('0x9')]){_0x2a2de3[_0x3edd31['variableName']]&&_0x4497d9['push'](_0x2a2de3[_0x3edd31[_0x7bfa('0x9')]][_0x7bfa('0xa')]());}else if(_0x3edd31[_0x7bfa('0x8')]===_0x7bfa('0xb')&&_0x3edd31[_0x7bfa('0xc')]&&_0x3edd31[_0x7bfa('0xc')]['name']){_0x2a2de3[_0x3edd31[_0x7bfa('0xc')]['name'][_0x7bfa('0xd')]()]&&_0x4497d9[_0x7bfa('0x6')](_0x2a2de3[_0x3edd31[_0x7bfa('0xc')]['name'][_0x7bfa('0xd')]()][_0x7bfa('0xa')]());}else if(_0x3edd31[_0x7bfa('0x8')]===_0x7bfa('0xe')){if(_0x3edd31[_0x7bfa('0xf')]===_0x7bfa('0x5')&&_0x3edd31[_0x7bfa('0x10')]){_0x4497d9[_0x7bfa('0x6')](util[_0x7bfa('0x11')](_0x7bfa('0x12'),_0x3edd31[_0x7bfa('0x10')],_0x3edd31[_0x7bfa('0x13')]));}else if(_0x3edd31[_0x7bfa('0xf')]===_0x7bfa('0x14')&&_0x3edd31[_0x7bfa('0x9')]&&_0x3edd31[_0x7bfa('0x10')]){_0x2a2de3[_0x3edd31[_0x7bfa('0x9')]]&&_0x4497d9['push'](util[_0x7bfa('0x11')](_0x7bfa('0x12'),_0x3edd31[_0x7bfa('0x10')],_0x2a2de3[_0x3edd31[_0x7bfa('0x9')]]));}else if(_0x3edd31[_0x7bfa('0xf')]===_0x7bfa('0xb')&&_0x3edd31['Variable']&&_0x3edd31[_0x7bfa('0xc')][_0x7bfa('0x15')]&&_0x3edd31[_0x7bfa('0x10')]){_0x2a2de3[_0x3edd31[_0x7bfa('0xc')][_0x7bfa('0x15')][_0x7bfa('0xd')]()]&&_0x4497d9['push'](util[_0x7bfa('0x11')]('%s:\x20%s',_0x3edd31[_0x7bfa('0x10')],_0x2a2de3[_0x3edd31[_0x7bfa('0xc')]['name'][_0x7bfa('0xd')]()]));}}}}return _0x4497d9[_0x7bfa('0x16')](_0x34dbe3);};exports[_0x7bfa('0x17')]=function(_0xb00829){var _0x593343=_0xb00829[_0x7bfa('0x18')](-0x1);if(_0x593343==='/'){_0xb00829=_0xb00829[_0x7bfa('0x19')](0x0,_0xb00829[_0x7bfa('0x1a')](_0x593343));}return _0xb00829;};exports[_0x7bfa('0x1b')]=function(_0x27949e){if(!_['isNil'](_0x27949e)&&_0x27949e!==''){var _0x30c1ff=/^(([^<>()\[\]\\.,;:\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 _0x30c1ff['test'](String(_0x27949e)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0xac40=['%s:\x20%s','key','keyContent','variable','join','stripTrailingSlash','substring','lastIndexOf','isNil','test','getString','sortBy','length','type','string','content','variableName','push','toString','Variable','name','toLowerCase','keyValue','keyType','format'];(function(_0x2ba028,_0xf6a9cd){var _0x1a7a47=function(_0x2f49e9){while(--_0x2f49e9){_0x2ba028['push'](_0x2ba028['shift']());}};_0x1a7a47(++_0xf6a9cd);}(_0xac40,0xb9));var _0x0ac4=function(_0x129ba0,_0x1cdfca){_0x129ba0=_0x129ba0-0x0;var _0x459cd2=_0xac40[_0x129ba0];return _0x459cd2;};'use strict';var _=require('lodash');var util=require('util');exports[_0x0ac4('0x0')]=function(_0x247cc6,_0x24fde3,_0x19ea53){var _0x24f0a9=[];if(_0x247cc6['length']>0x0){var _0xee99ff=_[_0x0ac4('0x1')](_0x247cc6,['id']);for(var _0x29abaf=0x0;_0x29abaf<_0xee99ff[_0x0ac4('0x2')];_0x29abaf++){var _0x764f12=_0xee99ff[_0x29abaf];if(_0x764f12[_0x0ac4('0x3')]===_0x0ac4('0x4')){_0x24f0a9['push'](_0x764f12[_0x0ac4('0x5')]);}else if(_0x764f12[_0x0ac4('0x3')]==='variable'&&_0x764f12[_0x0ac4('0x6')]){_0x24fde3[_0x764f12[_0x0ac4('0x6')]]&&_0x24f0a9[_0x0ac4('0x7')](_0x24fde3[_0x764f12[_0x0ac4('0x6')]][_0x0ac4('0x8')]());}else if(_0x764f12[_0x0ac4('0x3')]==='customVariable'&&_0x764f12['Variable']&&_0x764f12[_0x0ac4('0x9')][_0x0ac4('0xa')]){_0x24fde3[_0x764f12[_0x0ac4('0x9')][_0x0ac4('0xa')]['toLowerCase']()]&&_0x24f0a9[_0x0ac4('0x7')](_0x24fde3[_0x764f12[_0x0ac4('0x9')][_0x0ac4('0xa')][_0x0ac4('0xb')]()]['toString']());}else if(_0x764f12[_0x0ac4('0x3')]===_0x0ac4('0xc')){if(_0x764f12[_0x0ac4('0xd')]==='string'&&_0x764f12['key']){_0x24f0a9['push'](util[_0x0ac4('0xe')](_0x0ac4('0xf'),_0x764f12[_0x0ac4('0x10')],_0x764f12[_0x0ac4('0x11')]));}else if(_0x764f12[_0x0ac4('0xd')]===_0x0ac4('0x12')&&_0x764f12[_0x0ac4('0x6')]&&_0x764f12[_0x0ac4('0x10')]){_0x24fde3[_0x764f12[_0x0ac4('0x6')]]&&_0x24f0a9[_0x0ac4('0x7')](util[_0x0ac4('0xe')](_0x0ac4('0xf'),_0x764f12[_0x0ac4('0x10')],_0x24fde3[_0x764f12[_0x0ac4('0x6')]]));}else if(_0x764f12[_0x0ac4('0xd')]==='customVariable'&&_0x764f12[_0x0ac4('0x9')]&&_0x764f12['Variable'][_0x0ac4('0xa')]&&_0x764f12[_0x0ac4('0x10')]){_0x24fde3[_0x764f12[_0x0ac4('0x9')]['name'][_0x0ac4('0xb')]()]&&_0x24f0a9[_0x0ac4('0x7')](util[_0x0ac4('0xe')](_0x0ac4('0xf'),_0x764f12[_0x0ac4('0x10')],_0x24fde3[_0x764f12[_0x0ac4('0x9')][_0x0ac4('0xa')][_0x0ac4('0xb')]()]));}}}}return _0x24f0a9[_0x0ac4('0x13')](_0x19ea53);};exports[_0x0ac4('0x14')]=function(_0x2cb569){var _0x7af5f1=_0x2cb569['slice'](-0x1);if(_0x7af5f1==='/'){_0x2cb569=_0x2cb569[_0x0ac4('0x15')](0x0,_0x2cb569[_0x0ac4('0x16')](_0x7af5f1));}return _0x2cb569;};exports['validateEmail']=function(_0x9084c){if(!_[_0x0ac4('0x17')](_0x9084c)&&_0x9084c!==''){var _0xc345f5=/^(([^<>()\[\]\\.,;:\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 _0xc345f5[_0x0ac4('0x18')](String(_0x9084c)[_0x0ac4('0xb')]());}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 27d1771..c18b85e 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 _0x55ca=['email','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','abandoned','[ABANDONED]','lodash','request-promise','ioredis','./util','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','type','string','idField','content','toString','customVariable','Variable','name','toLowerCase','info','merge','Normal','Open','Subjects','getString','POST','format','%s/webservice.php','remoteUri','username','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','stringify','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','last_name','userId','admin','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','getUser','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','lastname','phone','getEndUser','accessKey','getConnection','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','[QUEUE]','outbound','serverUrl','recordingFormat','none','[OUTBOUND]'];(function(_0x557c37,_0x259789){var _0x2eae9e=function(_0x916729){while(--_0x916729){_0x557c37['push'](_0x557c37['shift']());}};_0x2eae9e(++_0x259789);}(_0x55ca,0x126));var _0xa55c=function(_0x53fe97,_0x544271){_0x53fe97=_0x53fe97-0x0;var _0x5c49a2=_0x55ca[_0x53fe97];return _0x5c49a2;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0xa55c('0x2'));var intUtil=require(_0xa55c('0x3'));var config=require('../../../../config/environment');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));config[_0xa55c('0x6')]=_[_0xa55c('0x7')](config[_0xa55c('0x6')],{'host':_0xa55c('0x8'),'port':0x18eb});var io=require(_0xa55c('0x9'))(new Redis(config['redis']));function emit(_0x2121fd,_0x2537f0,_0x57e069){io['to'](_0x2121fd)[_0xa55c('0xa')](_0x2537f0,_0x57e069);}function getCustomFields(_0x290d28,_0x52a3bc){var _0x5849ad={};if(_0x290d28[_0xa55c('0xb')]>0x0){_[_0xa55c('0xc')](_0x290d28,function(_0x381d07){if(_0x381d07[_0xa55c('0xd')]===_0xa55c('0xe')&&_0x381d07[_0xa55c('0xf')]){_0x5849ad[_0x381d07[_0xa55c('0xf')]]=_0x381d07[_0xa55c('0x10')][_0xa55c('0x11')]();}else if(_0x381d07[_0xa55c('0xd')]==='variable'&&_0x381d07['variableName']&&_0x381d07[_0xa55c('0xf')]&&_0x52a3bc[_0x381d07['variableName']]){_0x5849ad[_0x381d07['idField']]=_0x52a3bc[_0x381d07['variableName']][_0xa55c('0x11')]();}else if(_0x381d07[_0xa55c('0xd')]===_0xa55c('0x12')&&_0x381d07[_0xa55c('0x13')]&&_0x381d07[_0xa55c('0x13')][_0xa55c('0x14')]&&_0x381d07['idField']&&_0x52a3bc[_0x381d07[_0xa55c('0x13')][_0xa55c('0x14')][_0xa55c('0x15')]()]){_0x5849ad[_0x381d07[_0xa55c('0xf')]]=_0x52a3bc[_0x381d07[_0xa55c('0x13')][_0xa55c('0x14')][_0xa55c('0x15')]()][_0xa55c('0x11')]();}});}return _0x5849ad;}function createTicket(_0x24783b,_0x4cee3c,_0x3d4c9e,_0x104a99,_0x461284,_0x358b61,_0x23a1ae){logger[_0xa55c('0x16')]('Creating\x20new\x20ticket...');var _0x5f5158=_[_0xa55c('0x17')]({'parent_id':'','assigned_user_id':_0x4cee3c['id'],'ticketpriorities':_0xa55c('0x18'),'ticketstatus':_0xa55c('0x19'),'ticket_title':intUtil['getString'](_0x104a99[_0xa55c('0x1a')],_0x461284,'\x20'),'description':intUtil[_0xa55c('0x1b')](_0x104a99['Descriptions'],_0x461284,'\x0a'),'contact_id':_0x3d4c9e['id']},getCustomFields(_0x358b61,_0x461284));var _0x187a87={'method':_0xa55c('0x1c'),'uri':util[_0xa55c('0x1d')](_0xa55c('0x1e'),_0x24783b[_0xa55c('0x1f')]),'form':{'operation':'create','username':_0x24783b[_0xa55c('0x20')],'sessionName':_0x23a1ae['sessionName'],'elementType':'HelpDesk','element':JSON['stringify'](_0x5f5158)},'json':!![]};return request(_0x187a87)[_0xa55c('0x21')](function(_0x54b038){if(_0x54b038[_0xa55c('0x22')]){return BPromise[_0xa55c('0x23')]({'id':_0x54b038[_0xa55c('0x24')]['id']});}else{throw new Error(util[_0xa55c('0x1d')](_0xa55c('0x25'),JSON[_0xa55c('0x26')](_0x54b038[_0xa55c('0x27')])));}})[_0xa55c('0x28')](function(_0x192df2){var _0x3cd152=_0x192df2[_0xa55c('0x29')]||0x1f4;logger['error'](_0xa55c('0x2a'),_0xa55c('0x2b'),_0x3cd152,JSON[_0xa55c('0x26')](_0x192df2));});}function getUser(_0x906caa,_0x5d940d,_0x1377b0){if(intUtil[_0xa55c('0x2c')](_0x5d940d)){logger[_0xa55c('0x16')](_0xa55c('0x2d'),_0x5d940d);return request({'method':_0xa55c('0x2e'),'uri':util[_0xa55c('0x1d')]('%s/webservice.php',_0x906caa[_0xa55c('0x1f')]),'qs':{'operation':'query','username':_0x906caa[_0xa55c('0x20')],'sessionName':_0x1377b0[_0xa55c('0x2f')],'query':util[_0xa55c('0x1d')](_0xa55c('0x30'),_0x5d940d)},'json':!![]})['then'](function(_0x3d28fb){if(_0x3d28fb[_0xa55c('0x22')]&&_0x3d28fb[_0xa55c('0x24')][_0xa55c('0xb')]){logger[_0xa55c('0x16')](_0xa55c('0x31'));return BPromise[_0xa55c('0x23')]({'id':_0x3d28fb[_0xa55c('0x24')][0x0]['id'],'email':_0x3d28fb[_0xa55c('0x24')][0x0][_0xa55c('0x32')],'name':_0x3d28fb[_0xa55c('0x24')][0x0]['first_name']+'\x20'+_0x3d28fb['result'][_0xa55c('0x33')]});}else{logger[_0xa55c('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xa55c('0x23')]({'id':_0x1377b0[_0xa55c('0x34')],'email':_0x906caa[_0xa55c('0x20')],'name':_0xa55c('0x35')});}})[_0xa55c('0x28')](function(_0x38ff96){var _0x3ce1b3=_0x38ff96[_0xa55c('0x29')]||0x1f4;logger[_0xa55c('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x3ce1b3,JSON['stringify'](_0x38ff96));});}else{logger[_0xa55c('0x16')](_0xa55c('0x36'));return BPromise[_0xa55c('0x23')]({'id':_0x1377b0['userId'],'email':_0x906caa[_0xa55c('0x20')],'name':'admin'})[_0xa55c('0x28')](function(_0x4ad813){var _0x18c6f1=_0x4ad813[_0xa55c('0x29')]||0x1f4;logger[_0xa55c('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xa55c('0x37'),_0x18c6f1,JSON[_0xa55c('0x26')](_0x4ad813));});}}function getEndUser(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083){logger['info'](_0xa55c('0x38'),_0x194e78);return request({'method':'GET','uri':util[_0xa55c('0x1d')](_0xa55c('0x1e'),_0x47e93c['remoteUri']),'qs':{'operation':'query','username':_0x47e93c['username'],'sessionName':_0x4d9083['sessionName'],'query':util[_0xa55c('0x1d')](_0xa55c('0x39'),_0x194e78,_0x194e78,_0x194e78,_0x194e78,_0x194e78)},'json':!![]})[_0xa55c('0x21')](function(_0x99c4f8){if(_0x99c4f8[_0xa55c('0x22')]&&_0x99c4f8['result'][_0xa55c('0xb')]){logger[_0xa55c('0x16')](_0xa55c('0x3a'));return BPromise[_0xa55c('0x23')]({'id':_0x99c4f8[_0xa55c('0x24')][0x0]['id'],'name':_0x99c4f8[_0xa55c('0x24')][0x0]['firstname']+'\x20'+_0x99c4f8[_0xa55c('0x24')][0x0]['lastname'],'phone':_0x194e78});}else{logger['info'](_0xa55c('0x3b'));return request({'method':_0xa55c('0x1c'),'uri':util['format'](_0xa55c('0x1e'),_0x47e93c['remoteUri']),'form':{'operation':'create','sessionName':_0x4d9083[_0xa55c('0x2f')],'elementType':_0xa55c('0x3c'),'element':JSON[_0xa55c('0x26')]({'lastname':_0x6f9c4c,'phone':_0x194e78,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x1b2708){logger[_0xa55c('0x16')]('Enduser\x20created.');return BPromise[_0xa55c('0x23')]({'id':_0x1b2708['result']['id'],'name':_0x1b2708[_0xa55c('0x24')][_0xa55c('0x3d')],'phone':_0x1b2708['result'][_0xa55c('0x3e')]});})[_0xa55c('0x28')](function(_0x5d834d){var _0x40c352=_0x5d834d[_0xa55c('0x29')]||0x1f4;logger[_0xa55c('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xa55c('0x3f'),_0x40c352,JSON['stringify'](_0x5d834d));});}});}function getConnection(_0x2f9717){var _0x3a8af4=_0x2f9717[_0xa55c('0x20')];var _0x51d663=_0x2f9717[_0xa55c('0x40')];return request({'method':_0xa55c('0x2e'),'uri':util['format'](_0xa55c('0x1e'),_0x2f9717[_0xa55c('0x1f')]),'qs':{'operation':'getchallenge','username':_0x3a8af4},'json':!![]})[_0xa55c('0x21')](function(_0xd3fe78){if(_0xd3fe78['success']){return request({'method':_0xa55c('0x1c'),'uri':util[_0xa55c('0x1d')](_0xa55c('0x1e'),_0x2f9717[_0xa55c('0x1f')]),'form':{'operation':'login','username':_0x3a8af4,'accessKey':md5(_0xd3fe78[_0xa55c('0x24')]['token']+_0x51d663)},'json':!![]});}})[_0xa55c('0x21')](function(_0x213100){if(_0x213100[_0xa55c('0x22')]){return BPromise['resolve'](_0x213100[_0xa55c('0x24')]);}else{throw new Error(util[_0xa55c('0x1d')]('Account\x20%d\x20is\x20not\x20valid',_0x2f9717['id']));}})[_0xa55c('0x28')](function(_0x34de95){var _0x3822b7=_0x34de95[_0xa55c('0x29')]||0x1f4;logger[_0xa55c('0x27')](_0xa55c('0x2a'),_0xa55c('0x41'),_0x3822b7,JSON[_0xa55c('0x26')](_0x34de95));});}function request(_0x3c147b){logger[_0xa55c('0x16')]('[HTTP]',JSON[_0xa55c('0x26')](_0x3c147b));return rp(_0x3c147b);}exports[_0xa55c('0x42')]=function(_0x216de8,_0x4f73b6,_0x4c3095,_0x35bf0a,_0x4f5ecd,_0x21b760){var _0x4fa412,_0x2b6a0e,_0x228df4,_0x181802;_0x21b760[_0xa55c('0x1f')]=intUtil[_0xa55c('0x43')](_0x21b760['remoteUri']);if(_0x4f5ecd&&_0x4f5ecd[_0xa55c('0x44')]){logger[_0xa55c('0x16')]('[QUEUE]',_0xa55c('0x45'));_0x4f73b6[_0xa55c('0x46')]=util[_0xa55c('0x1d')](_0xa55c('0x47'),_0x21b760['serverUrl'],_0x4f73b6['uniqueid'],md5(_0x4f73b6[_0xa55c('0x48')]));}else{_0x4f73b6[_0xa55c('0x46')]='';}return getConnection(_0x21b760)[_0xa55c('0x21')](function(_0x44ac57){_0x181802=_0x44ac57;return getUser(_0x21b760,_0x35bf0a['email'],_0x181802);})[_0xa55c('0x21')](function(_0x5ce463){_0x4fa412=_0x5ce463;logger[_0xa55c('0x16')](_0xa55c('0x49'),_0x4fa412['id']);return getEndUser(_0x21b760,_0x4f73b6[_0xa55c('0x4a')],_0x4f73b6[_0xa55c('0x4b')],_0x181802);})[_0xa55c('0x21')](function(_0x53b2f7){_0x2b6a0e=_0x53b2f7;logger[_0xa55c('0x16')]('The\x20Enduser\x20ID\x20is:',_0x2b6a0e['id']);return createTicket(_0x21b760,_0x4fa412,_0x2b6a0e,_0x4c3095,_0x4f73b6,_0x4c3095[_0xa55c('0x4c')],_0x181802);})[_0xa55c('0x21')](function(_0x2cfe08){_0x228df4=_0x2cfe08;logger[_0xa55c('0x16')](_0xa55c('0x4d'));logger[_0xa55c('0x16')](_0xa55c('0x4e'),_0x228df4['id']);var _0x53e2be=util[_0xa55c('0x1d')](_0xa55c('0x4f'),_0x21b760[_0xa55c('0x1f')],_[_0xa55c('0x50')](_0x228df4['id'],'x')[0x1]);logger[_0xa55c('0x16')]('[QUEUE]',_0xa55c('0x51'));emit(util[_0xa55c('0x1d')](_0xa55c('0x52'),_0x35bf0a[_0xa55c('0x14')]),_0xa55c('0x53'),{'uri':_0x53e2be});})['catch'](function(_0xdd92c1){logger[_0xa55c('0x27')](_0xa55c('0x54'),JSON[_0xa55c('0x26')](_0xdd92c1));});};exports[_0xa55c('0x55')]=function(_0x480dfc,_0x419fc3,_0x4d94fc,_0x2e482a,_0x5e3a28,_0x3495a7,_0x5a8897){var _0x34edc5,_0x1333da,_0x21d6b4,_0x2f811e;_0x3495a7[_0xa55c('0x1f')]=intUtil[_0xa55c('0x43')](_0x3495a7[_0xa55c('0x1f')]);_0x3495a7[_0xa55c('0x56')]=intUtil[_0xa55c('0x43')](_0x3495a7[_0xa55c('0x56')]);if(_0x5a8897&&_0x5a8897['recordingFormat']&&_0x5a8897[_0xa55c('0x57')]!==_0xa55c('0x58')){logger['info'](_0xa55c('0x59'),_0xa55c('0x45'));_0x419fc3[_0xa55c('0x46')]=util[_0xa55c('0x1d')](_0xa55c('0x47'),_0x3495a7[_0xa55c('0x56')],_0x419fc3[_0xa55c('0x48')],md5(_0x419fc3[_0xa55c('0x48')]));}return getConnection(_0x3495a7)['then'](function(_0x1dfaf7){_0x2f811e=_0x1dfaf7;return getUser(_0x3495a7,_0x2e482a[_0xa55c('0x5a')],_0x2f811e);})[_0xa55c('0x21')](function(_0xd309a9){_0x34edc5=_0xd309a9;logger[_0xa55c('0x16')](_0xa55c('0x49'),_0x34edc5['id']);return getEndUser(_0x3495a7,_0x419fc3[_0xa55c('0x5b')],_0x419fc3[_0xa55c('0x5c')],_0x2f811e);})[_0xa55c('0x21')](function(_0x4a08ca){_0x1333da=_0x4a08ca;logger[_0xa55c('0x16')](_0xa55c('0x5d'),_0x1333da['id']);return createTicket(_0x3495a7,_0x34edc5,_0x1333da,_0x4d94fc,_0x419fc3,_0x4d94fc[_0xa55c('0x4c')],_0x2f811e);})[_0xa55c('0x21')](function(_0x3a269d){_0x21d6b4=_0x3a269d;logger[_0xa55c('0x16')](_0xa55c('0x4d'));logger[_0xa55c('0x16')](_0xa55c('0x4e'),_0x21d6b4['id']);var _0x3178a6=util[_0xa55c('0x1d')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3495a7[_0xa55c('0x1f')],_['split'](_0x21d6b4['id'],'x')[0x1]);logger[_0xa55c('0x16')](_0xa55c('0x59'),_0xa55c('0x51'));emit(util['format']('user:%s',_0x2e482a[_0xa55c('0x14')]),_0xa55c('0x53'),{'uri':_0x3178a6});})[_0xa55c('0x28')](function(_0x42529f){logger['error'](_0xa55c('0x59'),JSON[_0xa55c('0x26')](_0x42529f));});};exports[_0xa55c('0x5e')]=function(_0x3a9910,_0x21fc9b,_0x500968,_0x4b090c,_0x3f7fca,_0x38689e){var _0x3f9d0a,_0x36ee32,_0x1af9d5,_0x4b2032;_0x38689e[_0xa55c('0x1f')]=intUtil[_0xa55c('0x43')](_0x38689e['remoteUri']);_0x38689e[_0xa55c('0x56')]=intUtil[_0xa55c('0x43')](_0x38689e[_0xa55c('0x56')]);if(_0x3f7fca&&_0x3f7fca['monitor_format']){logger[_0xa55c('0x16')](_0xa55c('0x5f'),_0xa55c('0x45'));_0x21fc9b[_0xa55c('0x46')]=util[_0xa55c('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x38689e[_0xa55c('0x56')],_0x21fc9b[_0xa55c('0x48')],md5(_0x21fc9b['uniqueid']));}else{_0x21fc9b['recordingURL']='';}return getConnection(_0x38689e)[_0xa55c('0x21')](function(_0x4e1cbd){_0x4b2032=_0x4e1cbd;return getUser(_0x38689e,'',_0x4b2032);})[_0xa55c('0x21')](function(_0x5ca0bc){_0x3f9d0a=_0x5ca0bc;logger[_0xa55c('0x16')](_0xa55c('0x49'),_0x3f9d0a['id']);return getEndUser(_0x38689e,_0x21fc9b[_0xa55c('0x4a')],_0x21fc9b[_0xa55c('0x4b')],_0x4b2032);})[_0xa55c('0x21')](function(_0xff7b1c){_0x36ee32=_0xff7b1c;logger[_0xa55c('0x16')]('The\x20Enduser\x20ID\x20is:',_0x36ee32['id']);return createTicket(_0x38689e,_0x3f9d0a,_0x36ee32,_0x500968,_0x21fc9b,_0x500968[_0xa55c('0x4c')],_0x4b2032);})[_0xa55c('0x21')](function(_0x21de68){_0x1af9d5=_0x21de68;logger[_0xa55c('0x16')]('Ticket\x20created!');logger[_0xa55c('0x16')](_0xa55c('0x4e'),_0x1af9d5['id']);})[_0xa55c('0x28')](function(_0x2298ac){logger['error']('[ABANDONED]',JSON[_0xa55c('0x26')](_0x2298ac));});}; \ No newline at end of file +var _0x55ca=['email','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','abandoned','[ABANDONED]','lodash','request-promise','ioredis','./util','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','type','string','idField','content','toString','customVariable','Variable','name','toLowerCase','info','merge','Normal','Open','Subjects','getString','POST','format','%s/webservice.php','remoteUri','username','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','stringify','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','last_name','userId','admin','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','getUser','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','lastname','phone','getEndUser','accessKey','getConnection','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','[QUEUE]','outbound','serverUrl','recordingFormat','none','[OUTBOUND]'];(function(_0x43ee7d,_0x3153c1){var _0x38da95=function(_0x3da282){while(--_0x3da282){_0x43ee7d['push'](_0x43ee7d['shift']());}};_0x38da95(++_0x3153c1);}(_0x55ca,0x126));var _0xa55c=function(_0x37c006,_0x1f647a){_0x37c006=_0x37c006-0x0;var _0x3f306e=_0x55ca[_0x37c006];return _0x3f306e;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0xa55c('0x2'));var intUtil=require(_0xa55c('0x3'));var config=require('../../../../config/environment');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));config[_0xa55c('0x6')]=_[_0xa55c('0x7')](config[_0xa55c('0x6')],{'host':_0xa55c('0x8'),'port':0x18eb});var io=require(_0xa55c('0x9'))(new Redis(config['redis']));function emit(_0x2121fd,_0x2537f0,_0x57e069){io['to'](_0x2121fd)[_0xa55c('0xa')](_0x2537f0,_0x57e069);}function getCustomFields(_0x290d28,_0x52a3bc){var _0x5849ad={};if(_0x290d28[_0xa55c('0xb')]>0x0){_[_0xa55c('0xc')](_0x290d28,function(_0x381d07){if(_0x381d07[_0xa55c('0xd')]===_0xa55c('0xe')&&_0x381d07[_0xa55c('0xf')]){_0x5849ad[_0x381d07[_0xa55c('0xf')]]=_0x381d07[_0xa55c('0x10')][_0xa55c('0x11')]();}else if(_0x381d07[_0xa55c('0xd')]==='variable'&&_0x381d07['variableName']&&_0x381d07[_0xa55c('0xf')]&&_0x52a3bc[_0x381d07['variableName']]){_0x5849ad[_0x381d07['idField']]=_0x52a3bc[_0x381d07['variableName']][_0xa55c('0x11')]();}else if(_0x381d07[_0xa55c('0xd')]===_0xa55c('0x12')&&_0x381d07[_0xa55c('0x13')]&&_0x381d07[_0xa55c('0x13')][_0xa55c('0x14')]&&_0x381d07['idField']&&_0x52a3bc[_0x381d07[_0xa55c('0x13')][_0xa55c('0x14')][_0xa55c('0x15')]()]){_0x5849ad[_0x381d07[_0xa55c('0xf')]]=_0x52a3bc[_0x381d07[_0xa55c('0x13')][_0xa55c('0x14')][_0xa55c('0x15')]()][_0xa55c('0x11')]();}});}return _0x5849ad;}function createTicket(_0x24783b,_0x4cee3c,_0x3d4c9e,_0x104a99,_0x461284,_0x358b61,_0x23a1ae){logger[_0xa55c('0x16')]('Creating\x20new\x20ticket...');var _0x5f5158=_[_0xa55c('0x17')]({'parent_id':'','assigned_user_id':_0x4cee3c['id'],'ticketpriorities':_0xa55c('0x18'),'ticketstatus':_0xa55c('0x19'),'ticket_title':intUtil['getString'](_0x104a99[_0xa55c('0x1a')],_0x461284,'\x20'),'description':intUtil[_0xa55c('0x1b')](_0x104a99['Descriptions'],_0x461284,'\x0a'),'contact_id':_0x3d4c9e['id']},getCustomFields(_0x358b61,_0x461284));var _0x187a87={'method':_0xa55c('0x1c'),'uri':util[_0xa55c('0x1d')](_0xa55c('0x1e'),_0x24783b[_0xa55c('0x1f')]),'form':{'operation':'create','username':_0x24783b[_0xa55c('0x20')],'sessionName':_0x23a1ae['sessionName'],'elementType':'HelpDesk','element':JSON['stringify'](_0x5f5158)},'json':!![]};return request(_0x187a87)[_0xa55c('0x21')](function(_0x54b038){if(_0x54b038[_0xa55c('0x22')]){return BPromise[_0xa55c('0x23')]({'id':_0x54b038[_0xa55c('0x24')]['id']});}else{throw new Error(util[_0xa55c('0x1d')](_0xa55c('0x25'),JSON[_0xa55c('0x26')](_0x54b038[_0xa55c('0x27')])));}})[_0xa55c('0x28')](function(_0x192df2){var _0x3cd152=_0x192df2[_0xa55c('0x29')]||0x1f4;logger['error'](_0xa55c('0x2a'),_0xa55c('0x2b'),_0x3cd152,JSON[_0xa55c('0x26')](_0x192df2));});}function getUser(_0x906caa,_0x5d940d,_0x1377b0){if(intUtil[_0xa55c('0x2c')](_0x5d940d)){logger[_0xa55c('0x16')](_0xa55c('0x2d'),_0x5d940d);return request({'method':_0xa55c('0x2e'),'uri':util[_0xa55c('0x1d')]('%s/webservice.php',_0x906caa[_0xa55c('0x1f')]),'qs':{'operation':'query','username':_0x906caa[_0xa55c('0x20')],'sessionName':_0x1377b0[_0xa55c('0x2f')],'query':util[_0xa55c('0x1d')](_0xa55c('0x30'),_0x5d940d)},'json':!![]})['then'](function(_0x3d28fb){if(_0x3d28fb[_0xa55c('0x22')]&&_0x3d28fb[_0xa55c('0x24')][_0xa55c('0xb')]){logger[_0xa55c('0x16')](_0xa55c('0x31'));return BPromise[_0xa55c('0x23')]({'id':_0x3d28fb[_0xa55c('0x24')][0x0]['id'],'email':_0x3d28fb[_0xa55c('0x24')][0x0][_0xa55c('0x32')],'name':_0x3d28fb[_0xa55c('0x24')][0x0]['first_name']+'\x20'+_0x3d28fb['result'][_0xa55c('0x33')]});}else{logger[_0xa55c('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xa55c('0x23')]({'id':_0x1377b0[_0xa55c('0x34')],'email':_0x906caa[_0xa55c('0x20')],'name':_0xa55c('0x35')});}})[_0xa55c('0x28')](function(_0x38ff96){var _0x3ce1b3=_0x38ff96[_0xa55c('0x29')]||0x1f4;logger[_0xa55c('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x3ce1b3,JSON['stringify'](_0x38ff96));});}else{logger[_0xa55c('0x16')](_0xa55c('0x36'));return BPromise[_0xa55c('0x23')]({'id':_0x1377b0['userId'],'email':_0x906caa[_0xa55c('0x20')],'name':'admin'})[_0xa55c('0x28')](function(_0x4ad813){var _0x18c6f1=_0x4ad813[_0xa55c('0x29')]||0x1f4;logger[_0xa55c('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xa55c('0x37'),_0x18c6f1,JSON[_0xa55c('0x26')](_0x4ad813));});}}function getEndUser(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083){logger['info'](_0xa55c('0x38'),_0x194e78);return request({'method':'GET','uri':util[_0xa55c('0x1d')](_0xa55c('0x1e'),_0x47e93c['remoteUri']),'qs':{'operation':'query','username':_0x47e93c['username'],'sessionName':_0x4d9083['sessionName'],'query':util[_0xa55c('0x1d')](_0xa55c('0x39'),_0x194e78,_0x194e78,_0x194e78,_0x194e78,_0x194e78)},'json':!![]})[_0xa55c('0x21')](function(_0x99c4f8){if(_0x99c4f8[_0xa55c('0x22')]&&_0x99c4f8['result'][_0xa55c('0xb')]){logger[_0xa55c('0x16')](_0xa55c('0x3a'));return BPromise[_0xa55c('0x23')]({'id':_0x99c4f8[_0xa55c('0x24')][0x0]['id'],'name':_0x99c4f8[_0xa55c('0x24')][0x0]['firstname']+'\x20'+_0x99c4f8[_0xa55c('0x24')][0x0]['lastname'],'phone':_0x194e78});}else{logger['info'](_0xa55c('0x3b'));return request({'method':_0xa55c('0x1c'),'uri':util['format'](_0xa55c('0x1e'),_0x47e93c['remoteUri']),'form':{'operation':'create','sessionName':_0x4d9083[_0xa55c('0x2f')],'elementType':_0xa55c('0x3c'),'element':JSON[_0xa55c('0x26')]({'lastname':_0x6f9c4c,'phone':_0x194e78,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x1b2708){logger[_0xa55c('0x16')]('Enduser\x20created.');return BPromise[_0xa55c('0x23')]({'id':_0x1b2708['result']['id'],'name':_0x1b2708[_0xa55c('0x24')][_0xa55c('0x3d')],'phone':_0x1b2708['result'][_0xa55c('0x3e')]});})[_0xa55c('0x28')](function(_0x5d834d){var _0x40c352=_0x5d834d[_0xa55c('0x29')]||0x1f4;logger[_0xa55c('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xa55c('0x3f'),_0x40c352,JSON['stringify'](_0x5d834d));});}});}function getConnection(_0x2f9717){var _0x3a8af4=_0x2f9717[_0xa55c('0x20')];var _0x51d663=_0x2f9717[_0xa55c('0x40')];return request({'method':_0xa55c('0x2e'),'uri':util['format'](_0xa55c('0x1e'),_0x2f9717[_0xa55c('0x1f')]),'qs':{'operation':'getchallenge','username':_0x3a8af4},'json':!![]})[_0xa55c('0x21')](function(_0xd3fe78){if(_0xd3fe78['success']){return request({'method':_0xa55c('0x1c'),'uri':util[_0xa55c('0x1d')](_0xa55c('0x1e'),_0x2f9717[_0xa55c('0x1f')]),'form':{'operation':'login','username':_0x3a8af4,'accessKey':md5(_0xd3fe78[_0xa55c('0x24')]['token']+_0x51d663)},'json':!![]});}})[_0xa55c('0x21')](function(_0x213100){if(_0x213100[_0xa55c('0x22')]){return BPromise['resolve'](_0x213100[_0xa55c('0x24')]);}else{throw new Error(util[_0xa55c('0x1d')]('Account\x20%d\x20is\x20not\x20valid',_0x2f9717['id']));}})[_0xa55c('0x28')](function(_0x34de95){var _0x3822b7=_0x34de95[_0xa55c('0x29')]||0x1f4;logger[_0xa55c('0x27')](_0xa55c('0x2a'),_0xa55c('0x41'),_0x3822b7,JSON[_0xa55c('0x26')](_0x34de95));});}function request(_0x3c147b){logger[_0xa55c('0x16')]('[HTTP]',JSON[_0xa55c('0x26')](_0x3c147b));return rp(_0x3c147b);}exports[_0xa55c('0x42')]=function(_0x216de8,_0x4f73b6,_0x4c3095,_0x35bf0a,_0x4f5ecd,_0x21b760){var _0x4fa412,_0x2b6a0e,_0x228df4,_0x181802;_0x21b760[_0xa55c('0x1f')]=intUtil[_0xa55c('0x43')](_0x21b760['remoteUri']);if(_0x4f5ecd&&_0x4f5ecd[_0xa55c('0x44')]){logger[_0xa55c('0x16')]('[QUEUE]',_0xa55c('0x45'));_0x4f73b6[_0xa55c('0x46')]=util[_0xa55c('0x1d')](_0xa55c('0x47'),_0x21b760['serverUrl'],_0x4f73b6['uniqueid'],md5(_0x4f73b6[_0xa55c('0x48')]));}else{_0x4f73b6[_0xa55c('0x46')]='';}return getConnection(_0x21b760)[_0xa55c('0x21')](function(_0x44ac57){_0x181802=_0x44ac57;return getUser(_0x21b760,_0x35bf0a['email'],_0x181802);})[_0xa55c('0x21')](function(_0x5ce463){_0x4fa412=_0x5ce463;logger[_0xa55c('0x16')](_0xa55c('0x49'),_0x4fa412['id']);return getEndUser(_0x21b760,_0x4f73b6[_0xa55c('0x4a')],_0x4f73b6[_0xa55c('0x4b')],_0x181802);})[_0xa55c('0x21')](function(_0x53b2f7){_0x2b6a0e=_0x53b2f7;logger[_0xa55c('0x16')]('The\x20Enduser\x20ID\x20is:',_0x2b6a0e['id']);return createTicket(_0x21b760,_0x4fa412,_0x2b6a0e,_0x4c3095,_0x4f73b6,_0x4c3095[_0xa55c('0x4c')],_0x181802);})[_0xa55c('0x21')](function(_0x2cfe08){_0x228df4=_0x2cfe08;logger[_0xa55c('0x16')](_0xa55c('0x4d'));logger[_0xa55c('0x16')](_0xa55c('0x4e'),_0x228df4['id']);var _0x53e2be=util[_0xa55c('0x1d')](_0xa55c('0x4f'),_0x21b760[_0xa55c('0x1f')],_[_0xa55c('0x50')](_0x228df4['id'],'x')[0x1]);logger[_0xa55c('0x16')]('[QUEUE]',_0xa55c('0x51'));emit(util[_0xa55c('0x1d')](_0xa55c('0x52'),_0x35bf0a[_0xa55c('0x14')]),_0xa55c('0x53'),{'uri':_0x53e2be});})['catch'](function(_0xdd92c1){logger[_0xa55c('0x27')](_0xa55c('0x54'),JSON[_0xa55c('0x26')](_0xdd92c1));});};exports[_0xa55c('0x55')]=function(_0x480dfc,_0x419fc3,_0x4d94fc,_0x2e482a,_0x5e3a28,_0x3495a7,_0x5a8897){var _0x34edc5,_0x1333da,_0x21d6b4,_0x2f811e;_0x3495a7[_0xa55c('0x1f')]=intUtil[_0xa55c('0x43')](_0x3495a7[_0xa55c('0x1f')]);_0x3495a7[_0xa55c('0x56')]=intUtil[_0xa55c('0x43')](_0x3495a7[_0xa55c('0x56')]);if(_0x5a8897&&_0x5a8897['recordingFormat']&&_0x5a8897[_0xa55c('0x57')]!==_0xa55c('0x58')){logger['info'](_0xa55c('0x59'),_0xa55c('0x45'));_0x419fc3[_0xa55c('0x46')]=util[_0xa55c('0x1d')](_0xa55c('0x47'),_0x3495a7[_0xa55c('0x56')],_0x419fc3[_0xa55c('0x48')],md5(_0x419fc3[_0xa55c('0x48')]));}return getConnection(_0x3495a7)['then'](function(_0x1dfaf7){_0x2f811e=_0x1dfaf7;return getUser(_0x3495a7,_0x2e482a[_0xa55c('0x5a')],_0x2f811e);})[_0xa55c('0x21')](function(_0xd309a9){_0x34edc5=_0xd309a9;logger[_0xa55c('0x16')](_0xa55c('0x49'),_0x34edc5['id']);return getEndUser(_0x3495a7,_0x419fc3[_0xa55c('0x5b')],_0x419fc3[_0xa55c('0x5c')],_0x2f811e);})[_0xa55c('0x21')](function(_0x4a08ca){_0x1333da=_0x4a08ca;logger[_0xa55c('0x16')](_0xa55c('0x5d'),_0x1333da['id']);return createTicket(_0x3495a7,_0x34edc5,_0x1333da,_0x4d94fc,_0x419fc3,_0x4d94fc[_0xa55c('0x4c')],_0x2f811e);})[_0xa55c('0x21')](function(_0x3a269d){_0x21d6b4=_0x3a269d;logger[_0xa55c('0x16')](_0xa55c('0x4d'));logger[_0xa55c('0x16')](_0xa55c('0x4e'),_0x21d6b4['id']);var _0x3178a6=util[_0xa55c('0x1d')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3495a7[_0xa55c('0x1f')],_['split'](_0x21d6b4['id'],'x')[0x1]);logger[_0xa55c('0x16')](_0xa55c('0x59'),_0xa55c('0x51'));emit(util['format']('user:%s',_0x2e482a[_0xa55c('0x14')]),_0xa55c('0x53'),{'uri':_0x3178a6});})[_0xa55c('0x28')](function(_0x42529f){logger['error'](_0xa55c('0x59'),JSON[_0xa55c('0x26')](_0x42529f));});};exports[_0xa55c('0x5e')]=function(_0x3a9910,_0x21fc9b,_0x500968,_0x4b090c,_0x3f7fca,_0x38689e){var _0x3f9d0a,_0x36ee32,_0x1af9d5,_0x4b2032;_0x38689e[_0xa55c('0x1f')]=intUtil[_0xa55c('0x43')](_0x38689e['remoteUri']);_0x38689e[_0xa55c('0x56')]=intUtil[_0xa55c('0x43')](_0x38689e[_0xa55c('0x56')]);if(_0x3f7fca&&_0x3f7fca['monitor_format']){logger[_0xa55c('0x16')](_0xa55c('0x5f'),_0xa55c('0x45'));_0x21fc9b[_0xa55c('0x46')]=util[_0xa55c('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x38689e[_0xa55c('0x56')],_0x21fc9b[_0xa55c('0x48')],md5(_0x21fc9b['uniqueid']));}else{_0x21fc9b['recordingURL']='';}return getConnection(_0x38689e)[_0xa55c('0x21')](function(_0x4e1cbd){_0x4b2032=_0x4e1cbd;return getUser(_0x38689e,'',_0x4b2032);})[_0xa55c('0x21')](function(_0x5ca0bc){_0x3f9d0a=_0x5ca0bc;logger[_0xa55c('0x16')](_0xa55c('0x49'),_0x3f9d0a['id']);return getEndUser(_0x38689e,_0x21fc9b[_0xa55c('0x4a')],_0x21fc9b[_0xa55c('0x4b')],_0x4b2032);})[_0xa55c('0x21')](function(_0xff7b1c){_0x36ee32=_0xff7b1c;logger[_0xa55c('0x16')]('The\x20Enduser\x20ID\x20is:',_0x36ee32['id']);return createTicket(_0x38689e,_0x3f9d0a,_0x36ee32,_0x500968,_0x21fc9b,_0x500968[_0xa55c('0x4c')],_0x4b2032);})[_0xa55c('0x21')](function(_0x21de68){_0x1af9d5=_0x21de68;logger[_0xa55c('0x16')]('Ticket\x20created!');logger[_0xa55c('0x16')](_0xa55c('0x4e'),_0x1af9d5['id']);})[_0xa55c('0x28')](function(_0x2298ac){logger['error']('[ABANDONED]',JSON[_0xa55c('0x26')](_0x2298ac));});}; \ 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 ad68196..3daee09 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 _0x1ee2=['%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','GET','length','map','forEach','type','string','nameField','customField','toLowerCase','content','push','idField','variableName','custom_fields','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','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...','trigger:browser:url','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','The\x20Enduser\x20ID\x20is:','user:%s','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','abandoned','monitor_format','[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','emit','application/json','%s/tickets.json','remoteUri','POST','merge','name','getString','Subjects','Descriptions','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','results','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x1ee2,0x11c));var _0x21ee=function(_0x31aa43,_0x295c18){_0x31aa43=_0x31aa43-0x0;var _0x2f297c=_0x1ee2[_0x31aa43];return _0x2f297c;};'use strict';var _=require(_0x21ee('0x0'));var rp=require(_0x21ee('0x1'));var md5=require(_0x21ee('0x2'));var util=require(_0x21ee('0x3'));var Redis=require(_0x21ee('0x4'));var intUtil=require('./util');var config=require(_0x21ee('0x5'));var logger=require(_0x21ee('0x6'))('zendesk');config['redis']=_[_0x21ee('0x7')](config[_0x21ee('0x8')],{'host':_0x21ee('0x9'),'port':0x18eb});var io=require(_0x21ee('0xa'))(new Redis(config['redis']));function emit(_0x361e58,_0x207f5b,_0x38588c){io['to'](_0x361e58)[_0x21ee('0xb')](_0x207f5b,_0x38588c);}var headers={'Content-Type':_0x21ee('0xc'),'Accept':_0x21ee('0xc')};function getTicket(_0x2ad5af,_0x2e33ad,_0x26df7a,_0x2dbb98,_0x3cb4a8){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0x21ee('0xd'),_0x2ad5af[_0x21ee('0xe')]),'method':_0x21ee('0xf'),'body':{'ticket':_[_0x21ee('0x10')]({'requester_id':_0x26df7a['id'],'submitter_id':_0x2e33ad?_0x2e33ad['id']:undefined,'assignee_id':_0x2e33ad?_0x2e33ad['id']:undefined,'tags':getTags(_0x2dbb98['Tags'],_0x21ee('0x11')),'subject':intUtil[_0x21ee('0x12')](_0x2dbb98[_0x21ee('0x13')],_0x3cb4a8,'\x20'),'description':intUtil[_0x21ee('0x12')](_0x2dbb98[_0x21ee('0x14')],_0x3cb4a8,'\x0a'),'comment':{'public':![],'body':intUtil[_0x21ee('0x12')](_0x2dbb98[_0x21ee('0x14')],_0x3cb4a8,'\x0a')}},getCustomFields(_0x2dbb98['Fields'],_0x3cb4a8))}})[_0x21ee('0x15')](function(_0x15d49e){logger[_0x21ee('0x16')](_0x21ee('0x17'));return _0x15d49e[_0x21ee('0x18')];});}function getUser(_0x2b2889,_0x5830ab){if(intUtil[_0x21ee('0x19')](_0x5830ab)){logger[_0x21ee('0x16')](_0x21ee('0x1a'),_0x5830ab);return request({'uri':util[_0x21ee('0x1b')](_0x21ee('0x1c'),_0x2b2889[_0x21ee('0xe')]),'qs':{'query':util[_0x21ee('0x1b')](_0x21ee('0x1d'),_0x5830ab)}})[_0x21ee('0x15')](function(_0x425eea){if(_0x425eea[_0x21ee('0x1e')]){logger[_0x21ee('0x16')]('Agent\x20found!');return _[_0x21ee('0x1f')](_0x425eea[_0x21ee('0x20')],{'email':_0x5830ab,'role':'agent'});}else{logger[_0x21ee('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x21ee('0x1b')](_0x21ee('0x21'),_0x2b2889[_0x21ee('0xe')])})[_0x21ee('0x15')](function(_0x29e042){logger[_0x21ee('0x16')](_0x21ee('0x22'));return _0x29e042[_0x21ee('0x23')];});}});}else{logger['info'](_0x21ee('0x24'));return request({'uri':util[_0x21ee('0x1b')]('%s/users/me.json',_0x2b2889[_0x21ee('0xe')])})['then'](function(_0x26de0e){logger[_0x21ee('0x16')](_0x21ee('0x22'));return _0x26de0e['user'];});}}function getEndUser(_0x3de275,_0x5d8826,_0x24671b){logger[_0x21ee('0x16')](_0x21ee('0x25'),_0x24671b);return request({'uri':util['format'](_0x21ee('0x1c'),_0x3de275['remoteUri']),'qs':{'query':util[_0x21ee('0x1b')](_0x21ee('0x26'),_0x24671b)}})['then'](function(_0x40b1a2){var _0x32d969;if(_0x40b1a2[_0x21ee('0x20')]['length']){_0x40b1a2[_0x21ee('0x20')]=_[_0x21ee('0x27')](_0x40b1a2[_0x21ee('0x20')],{'suspended':![],'role':'end-user'});if(_0x40b1a2[_0x21ee('0x20')]['length']){_0x32d969=_[_0x21ee('0x28')](_0x40b1a2[_0x21ee('0x20')]);}}if(_0x32d969){logger[_0x21ee('0x16')](_0x21ee('0x29'));return _0x32d969;}else{logger[_0x21ee('0x16')](_0x21ee('0x2a'));return request({'uri':util[_0x21ee('0x1b')](_0x21ee('0x2b'),_0x3de275['remoteUri']),'method':_0x21ee('0xf'),'body':{'user':{'role':_0x21ee('0x2c'),'name':util[_0x21ee('0x1b')](_0x21ee('0x2d'),_0x5d8826||_0x24671b),'phone':_0x24671b}}})[_0x21ee('0x15')](function(_0x128e1e){logger[_0x21ee('0x16')](_0x21ee('0x2e'));return _0x128e1e['user'];});}});}function getAuth(_0x4d13bf){var _0xbc6325;if(_0x4d13bf[_0x21ee('0x2f')]===_0x21ee('0x30')){_0xbc6325=util['format'](_0x21ee('0x31'),_0x4d13bf[_0x21ee('0x32')],_0x4d13bf[_0x21ee('0x30')]);}else if(_0x4d13bf[_0x21ee('0x2f')]===_0x21ee('0x33')){_0xbc6325=util[_0x21ee('0x1b')](_0x21ee('0x34'),_0x4d13bf[_0x21ee('0x32')],_0x4d13bf[_0x21ee('0x33')]);}return util[_0x21ee('0x1b')](_0x21ee('0x35'),new Buffer(_0xbc6325)[_0x21ee('0x36')](_0x21ee('0x37')));}function request(_0x12c787){logger[_0x21ee('0x38')]('[HTTP]',JSON['stringify'](_0x12c787));return rp(_[_0x21ee('0x7')](_0x12c787,{'method':_0x21ee('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x5cdd43,_0x1319fb){var _0x37e31d=[];if(_0x5cdd43&&_0x5cdd43[_0x21ee('0x3a')]>0x0){_0x37e31d=_[_0x21ee('0x3b')](_0x5cdd43,_0x1319fb);}return _0x37e31d;}function getCustomFields(_0x5ab2ee,_0x272696){var _0x3349b3=[];var _0xb23e9a={'custom_fields':[]};if(_0x5ab2ee['length']>0x0){_[_0x21ee('0x3c')](_0x5ab2ee,function(_0x1e484c){if(_0x1e484c[_0x21ee('0x3d')]===_0x21ee('0x3e')&&_0x1e484c[_0x21ee('0x3f')]&&!_0x1e484c[_0x21ee('0x40')]){_0xb23e9a[_0x1e484c[_0x21ee('0x3f')][_0x21ee('0x41')]()]=_0x1e484c[_0x21ee('0x42')][_0x21ee('0x36')]();}else if(_0x1e484c[_0x21ee('0x3d')]===_0x21ee('0x3e')&&_0x1e484c['idField']&&_0x1e484c[_0x21ee('0x40')]){_0xb23e9a['custom_fields'][_0x21ee('0x43')]({'id':_0x1e484c['idField'],'value':_0x1e484c[_0x21ee('0x42')][_0x21ee('0x36')]()});}else if(_0x1e484c['type']==='variable'&&_0x1e484c['variableName']&&_0x1e484c[_0x21ee('0x44')]&&_0x1e484c[_0x21ee('0x40')]){_0x272696[_0x1e484c[_0x21ee('0x45')]]&&_0xb23e9a[_0x21ee('0x46')][_0x21ee('0x43')]({'id':_0x1e484c[_0x21ee('0x44')],'value':_0x272696[_0x1e484c[_0x21ee('0x45')]][_0x21ee('0x36')]()});}else if(_0x1e484c[_0x21ee('0x3d')]===_0x21ee('0x47')&&_0x1e484c[_0x21ee('0x48')]&&_0x1e484c[_0x21ee('0x48')][_0x21ee('0x11')]&&_0x1e484c['idField']&&_0x1e484c['customField']){_0x272696[_0x1e484c['Variable'][_0x21ee('0x11')][_0x21ee('0x41')]()]&&_0xb23e9a[_0x21ee('0x46')][_0x21ee('0x43')]({'id':_0x1e484c[_0x21ee('0x44')],'value':_0x272696[_0x1e484c[_0x21ee('0x48')][_0x21ee('0x11')][_0x21ee('0x41')]()][_0x21ee('0x36')]()});}});}return _0xb23e9a;}exports[_0x21ee('0x49')]=function(_0x18abf3,_0x273f5b,_0x222254,_0x790a8e,_0x2ce061,_0x2151e4){var _0x19a115,_0x2658ca;_0x2151e4[_0x21ee('0xe')]=intUtil[_0x21ee('0x4a')](_0x2151e4[_0x21ee('0xe')]);_0x2151e4[_0x21ee('0x4b')]=intUtil[_0x21ee('0x4a')](_0x2151e4[_0x21ee('0x4b')]);if(_0x2ce061&&_0x2ce061['monitor_format']){logger['info'](_0x21ee('0x4c'),_0x21ee('0x4d'));_0x273f5b[_0x21ee('0x4e')]=util[_0x21ee('0x1b')](_0x21ee('0x4f'),_0x2151e4['serverUrl'],_0x273f5b[_0x21ee('0x50')],md5(_0x273f5b[_0x21ee('0x50')]));}else{_0x273f5b['recordingURL']='';}headers[_0x21ee('0x51')]=getAuth(_0x2151e4);return getUser(_0x2151e4,_0x790a8e[_0x21ee('0x52')])[_0x21ee('0x15')](function(_0x15c02b){_0x19a115=_0x15c02b;logger[_0x21ee('0x16')]('The\x20User\x20ID\x20is:',_0x19a115['id']);return getEndUser(_0x2151e4,_0x273f5b[_0x21ee('0x53')],_0x273f5b[_0x21ee('0x54')]);})['then'](function(_0x89335a){_0x2658ca=_0x89335a;logger[_0x21ee('0x16')]('The\x20Enduser\x20ID\x20is:',_0x2658ca['id']);return getTicket(_0x2151e4,_0x19a115,_0x2658ca,_0x222254,_0x273f5b);})['then'](function(_0xf8643d){if(_0xf8643d){logger[_0x21ee('0x16')](_0x21ee('0x55'),_0xf8643d['id']);switch(_0x2151e4[_0x21ee('0x3d')]){case _0x21ee('0x56'):logger[_0x21ee('0x16')](_0x21ee('0x4c'),_0x21ee('0x57'));return request({'uri':util[_0x21ee('0x1b')](_0x21ee('0x58'),_0x2151e4[_0x21ee('0xe')],_0x19a115['id'],_0xf8643d['id']),'method':'POST'});case _0x21ee('0x59'):logger[_0x21ee('0x16')](_0x21ee('0x4c'),_0x21ee('0x5a'));emit(util[_0x21ee('0x1b')]('user:%s',_0x790a8e[_0x21ee('0x11')]),_0x21ee('0x5b'),{'uri':util[_0x21ee('0x1b')]('%s/agent/tickets/%s',_0x2151e4[_0x21ee('0xe')],_0xf8643d['id'])});break;default:logger[_0x21ee('0x5c')]('[QUEUE]',_0x21ee('0x5d'));}}})[_0x21ee('0x5e')](function(_0x3d6525){logger[_0x21ee('0x5c')](_0x21ee('0x5f'),util[_0x21ee('0x60')](_0x3d6525,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x21e9f6,_0x11668c,_0x136070,_0x444e21,_0x5ea31a,_0x433cf5,_0x2025e0){var _0xc2c8fc,_0x4cf55c;_0x433cf5['remoteUri']=intUtil['stripTrailingSlash'](_0x433cf5[_0x21ee('0xe')]);_0x433cf5[_0x21ee('0x4b')]=intUtil[_0x21ee('0x4a')](_0x433cf5[_0x21ee('0x4b')]);if(_0x2025e0&&_0x2025e0[_0x21ee('0x61')]&&_0x2025e0[_0x21ee('0x61')]!==_0x21ee('0x62')){logger[_0x21ee('0x16')](_0x21ee('0x63'),_0x21ee('0x4d'));_0x11668c[_0x21ee('0x4e')]=util[_0x21ee('0x1b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x433cf5['serverUrl'],_0x11668c[_0x21ee('0x50')],md5(_0x11668c['uniqueid']));}headers[_0x21ee('0x51')]=getAuth(_0x433cf5);return getUser(_0x433cf5,_0x444e21[_0x21ee('0x52')])[_0x21ee('0x15')](function(_0x52444e){_0xc2c8fc=_0x52444e;logger[_0x21ee('0x16')](_0x21ee('0x64'),_0xc2c8fc['id']);return getEndUser(_0x433cf5,_0x11668c[_0x21ee('0x65')],_0x11668c['destcalleridnum']);})['then'](function(_0x1a0efd){_0x4cf55c=_0x1a0efd;logger[_0x21ee('0x16')](_0x21ee('0x66'),_0x4cf55c['id']);return getTicket(_0x433cf5,_0xc2c8fc,_0x4cf55c,_0x136070,_0x11668c);})[_0x21ee('0x15')](function(_0x48e81c){if(_0x48e81c){logger[_0x21ee('0x16')](_0x21ee('0x55'),_0x48e81c['id']);switch(_0x433cf5[_0x21ee('0x3d')]){case _0x21ee('0x56'):logger[_0x21ee('0x16')](_0x21ee('0x63'),_0x21ee('0x57'));return request({'uri':util['format'](_0x21ee('0x58'),_0x433cf5[_0x21ee('0xe')],_0xc2c8fc['id'],_0x48e81c['id']),'method':'POST'});case _0x21ee('0x59'):logger[_0x21ee('0x16')]('[OUTBOUND]',_0x21ee('0x5a'));emit(util[_0x21ee('0x1b')](_0x21ee('0x67'),_0x444e21[_0x21ee('0x11')]),_0x21ee('0x5b'),{'uri':util['format'](_0x21ee('0x68'),_0x433cf5[_0x21ee('0xe')],_0x48e81c['id'])});break;default:logger[_0x21ee('0x5c')](_0x21ee('0x63'),_0x21ee('0x5d'));}}})['catch'](function(_0x78a141){logger['error'](_0x21ee('0x69'),util[_0x21ee('0x60')](_0x78a141,{'showHidden':!![],'depth':null}));});};exports[_0x21ee('0x6a')]=function(_0x341e26,_0x4d89d8,_0x31eb1d,_0x480c21,_0x241af1,_0x18212c){var _0xa2309,_0x1ac1f8;_0x18212c['remoteUri']=intUtil[_0x21ee('0x4a')](_0x18212c[_0x21ee('0xe')]);_0x18212c[_0x21ee('0x4b')]=intUtil[_0x21ee('0x4a')](_0x18212c[_0x21ee('0x4b')]);if(_0x241af1&&_0x241af1[_0x21ee('0x6b')]){logger['info']('[ABANDONED]',_0x21ee('0x4d'));_0x4d89d8[_0x21ee('0x4e')]=util[_0x21ee('0x1b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x18212c[_0x21ee('0x4b')],_0x4d89d8['uniqueid'],md5(_0x4d89d8[_0x21ee('0x50')]));}else{_0x4d89d8[_0x21ee('0x4e')]='';}headers[_0x21ee('0x51')]=getAuth(_0x18212c);return getUser(_0x18212c)[_0x21ee('0x15')](function(_0x177f56){_0xa2309=_0x177f56;logger[_0x21ee('0x16')](_0x21ee('0x64'),_0xa2309['id']);return getEndUser(_0x18212c,_0x4d89d8['calleridname'],_0x4d89d8[_0x21ee('0x54')]);})[_0x21ee('0x15')](function(_0x3dfa13){_0x1ac1f8=_0x3dfa13;logger[_0x21ee('0x16')]('The\x20Enduser\x20ID\x20is:',_0x1ac1f8['id']);return getTicket(_0x18212c,_0xa2309,_0x1ac1f8,_0x31eb1d,_0x4d89d8);})[_0x21ee('0x15')](function(_0x439d25){if(_0x439d25){logger[_0x21ee('0x16')](_0x21ee('0x55'),_0x439d25['id']);}})[_0x21ee('0x5e')](function(_0x5cadaa){logger[_0x21ee('0x5c')](_0x21ee('0x6c'),util[_0x21ee('0x60')](_0x5cadaa,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc831=['push','variable','variableName','customField','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','integrationTab','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','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','abandoned','[ABANDONED]','The\x20Ticket\x20ID\x20is:','[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','remoteUri','format','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','%s/users/me.json','Admin\x20account\x20selected.','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user','Searching\x20enduser\x20with\x20phone','%s/search.json','results','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','password','%s:%s','username','authType','token','%s/token:%s','Basic\x20%s','toString','base64','stringify','GET','forEach','type','string','nameField','toLowerCase','content','idField','custom_fields'];(function(_0x1e9d19,_0x52af22){var _0x30c3de=function(_0x1efcc1){while(--_0x1efcc1){_0x1e9d19['push'](_0x1e9d19['shift']());}};_0x30c3de(++_0x52af22);}(_0xc831,0x103));var _0x1c83=function(_0x53eeab,_0x3c2d9c){_0x53eeab=_0x53eeab-0x0;var _0x64763b=_0xc831[_0x53eeab];return _0x64763b;};'use strict';var _=require('lodash');var rp=require(_0x1c83('0x0'));var md5=require(_0x1c83('0x1'));var util=require(_0x1c83('0x2'));var Redis=require(_0x1c83('0x3'));var intUtil=require(_0x1c83('0x4'));var config=require(_0x1c83('0x5'));var logger=require(_0x1c83('0x6'))(_0x1c83('0x7'));config[_0x1c83('0x8')]=_[_0x1c83('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1c83('0xa'))(new Redis(config['redis']));function emit(_0x1ce77e,_0x1953e5,_0x29ceee){io['to'](_0x1ce77e)[_0x1c83('0xb')](_0x1953e5,_0x29ceee);}var headers={'Content-Type':_0x1c83('0xc'),'Accept':'application/json'};function getTicket(_0x9cb1e2,_0x405dfe,_0x534a07,_0x5cd9ee,_0x40f50b){logger[_0x1c83('0xd')](_0x1c83('0xe'));return request({'uri':util['format'](_0x1c83('0xf'),_0x9cb1e2['remoteUri']),'method':'POST','body':{'ticket':_[_0x1c83('0x10')]({'requester_id':_0x534a07['id'],'submitter_id':_0x405dfe?_0x405dfe['id']:undefined,'assignee_id':_0x405dfe?_0x405dfe['id']:undefined,'tags':getTags(_0x5cd9ee[_0x1c83('0x11')],_0x1c83('0x12')),'subject':intUtil[_0x1c83('0x13')](_0x5cd9ee[_0x1c83('0x14')],_0x40f50b,'\x20'),'description':intUtil[_0x1c83('0x13')](_0x5cd9ee[_0x1c83('0x15')],_0x40f50b,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x5cd9ee[_0x1c83('0x15')],_0x40f50b,'\x0a')}},getCustomFields(_0x5cd9ee[_0x1c83('0x16')],_0x40f50b))}})[_0x1c83('0x17')](function(_0x13daa0){logger[_0x1c83('0xd')]('Ticket\x20created!');return _0x13daa0[_0x1c83('0x18')];});}function getUser(_0x18a06d,_0x179906){if(intUtil[_0x1c83('0x19')](_0x179906)){logger['info'](_0x1c83('0x1a'),_0x179906);return request({'uri':util['format']('%s/search.json',_0x18a06d[_0x1c83('0x1b')]),'qs':{'query':util[_0x1c83('0x1c')](_0x1c83('0x1d'),_0x179906)}})[_0x1c83('0x17')](function(_0x54b9b8){if(_0x54b9b8[_0x1c83('0x1e')]){logger['info'](_0x1c83('0x1f'));return _[_0x1c83('0x20')](_0x54b9b8['results'],{'email':_0x179906,'role':_0x1c83('0x21')});}else{logger[_0x1c83('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x1c83('0x22'),_0x18a06d['remoteUri'])})['then'](function(_0x19abb8){logger[_0x1c83('0xd')](_0x1c83('0x23'));return _0x19abb8['user'];});}});}else{logger[_0x1c83('0xd')](_0x1c83('0x24'));return request({'uri':util[_0x1c83('0x1c')]('%s/users/me.json',_0x18a06d[_0x1c83('0x1b')])})['then'](function(_0x4166b5){logger[_0x1c83('0xd')](_0x1c83('0x23'));return _0x4166b5[_0x1c83('0x25')];});}}function getEndUser(_0x2e452b,_0x2982d3,_0x11baa6){logger[_0x1c83('0xd')](_0x1c83('0x26'),_0x11baa6);return request({'uri':util['format'](_0x1c83('0x27'),_0x2e452b['remoteUri']),'qs':{'query':util[_0x1c83('0x1c')]('type:user\x20role:end-user\x20phone:%s',_0x11baa6)}})[_0x1c83('0x17')](function(_0x3a00e0){var _0x46ff26;if(_0x3a00e0[_0x1c83('0x28')][_0x1c83('0x29')]){_0x3a00e0[_0x1c83('0x28')]=_[_0x1c83('0x2a')](_0x3a00e0[_0x1c83('0x28')],{'suspended':![],'role':_0x1c83('0x2b')});if(_0x3a00e0['results'][_0x1c83('0x29')]){_0x46ff26=_['first'](_0x3a00e0['results']);}}if(_0x46ff26){logger[_0x1c83('0xd')](_0x1c83('0x2c'));return _0x46ff26;}else{logger[_0x1c83('0xd')](_0x1c83('0x2d'));return request({'uri':util[_0x1c83('0x1c')](_0x1c83('0x2e'),_0x2e452b[_0x1c83('0x1b')]),'method':_0x1c83('0x2f'),'body':{'user':{'role':'end-user','name':util[_0x1c83('0x1c')](_0x1c83('0x30'),_0x2982d3||_0x11baa6),'phone':_0x11baa6}}})[_0x1c83('0x17')](function(_0x152b17){logger[_0x1c83('0xd')]('Enduser\x20created.');return _0x152b17[_0x1c83('0x25')];});}});}function getAuth(_0x46fb67){var _0x31b14d;if(_0x46fb67['authType']===_0x1c83('0x31')){_0x31b14d=util[_0x1c83('0x1c')](_0x1c83('0x32'),_0x46fb67[_0x1c83('0x33')],_0x46fb67[_0x1c83('0x31')]);}else if(_0x46fb67[_0x1c83('0x34')]===_0x1c83('0x35')){_0x31b14d=util[_0x1c83('0x1c')](_0x1c83('0x36'),_0x46fb67['username'],_0x46fb67[_0x1c83('0x35')]);}return util[_0x1c83('0x1c')](_0x1c83('0x37'),new Buffer(_0x31b14d)[_0x1c83('0x38')](_0x1c83('0x39')));}function request(_0x4fd33d){logger['debug']('[HTTP]',JSON[_0x1c83('0x3a')](_0x4fd33d));return rp(_['defaults'](_0x4fd33d,{'method':_0x1c83('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x3a52c6,_0x10de6a){var _0x1b372f=[];if(_0x3a52c6&&_0x3a52c6[_0x1c83('0x29')]>0x0){_0x1b372f=_['map'](_0x3a52c6,_0x10de6a);}return _0x1b372f;}function getCustomFields(_0x498229,_0x5c7146){var _0x3be129=[];var _0x36a057={'custom_fields':[]};if(_0x498229[_0x1c83('0x29')]>0x0){_[_0x1c83('0x3c')](_0x498229,function(_0x3d3910){if(_0x3d3910[_0x1c83('0x3d')]===_0x1c83('0x3e')&&_0x3d3910['nameField']&&!_0x3d3910['customField']){_0x36a057[_0x3d3910[_0x1c83('0x3f')][_0x1c83('0x40')]()]=_0x3d3910[_0x1c83('0x41')][_0x1c83('0x38')]();}else if(_0x3d3910[_0x1c83('0x3d')]===_0x1c83('0x3e')&&_0x3d3910[_0x1c83('0x42')]&&_0x3d3910['customField']){_0x36a057[_0x1c83('0x43')][_0x1c83('0x44')]({'id':_0x3d3910[_0x1c83('0x42')],'value':_0x3d3910[_0x1c83('0x41')][_0x1c83('0x38')]()});}else if(_0x3d3910[_0x1c83('0x3d')]===_0x1c83('0x45')&&_0x3d3910[_0x1c83('0x46')]&&_0x3d3910[_0x1c83('0x42')]&&_0x3d3910[_0x1c83('0x47')]){_0x5c7146[_0x3d3910[_0x1c83('0x46')]]&&_0x36a057[_0x1c83('0x43')][_0x1c83('0x44')]({'id':_0x3d3910[_0x1c83('0x42')],'value':_0x5c7146[_0x3d3910['variableName']][_0x1c83('0x38')]()});}else if(_0x3d3910[_0x1c83('0x3d')]==='customVariable'&&_0x3d3910[_0x1c83('0x48')]&&_0x3d3910[_0x1c83('0x48')][_0x1c83('0x12')]&&_0x3d3910[_0x1c83('0x42')]&&_0x3d3910[_0x1c83('0x47')]){_0x5c7146[_0x3d3910[_0x1c83('0x48')][_0x1c83('0x12')][_0x1c83('0x40')]()]&&_0x36a057['custom_fields'][_0x1c83('0x44')]({'id':_0x3d3910[_0x1c83('0x42')],'value':_0x5c7146[_0x3d3910[_0x1c83('0x48')][_0x1c83('0x12')][_0x1c83('0x40')]()][_0x1c83('0x38')]()});}});}return _0x36a057;}exports[_0x1c83('0x49')]=function(_0x2092e7,_0x500ce8,_0x5bdcb2,_0x3683e2,_0x19adeb,_0x40ca6e){var _0x23c975,_0x14ed10;_0x40ca6e['remoteUri']=intUtil[_0x1c83('0x4a')](_0x40ca6e['remoteUri']);_0x40ca6e['serverUrl']=intUtil['stripTrailingSlash'](_0x40ca6e[_0x1c83('0x4b')]);if(_0x19adeb&&_0x19adeb['monitor_format']){logger[_0x1c83('0xd')](_0x1c83('0x4c'),_0x1c83('0x4d'));_0x500ce8[_0x1c83('0x4e')]=util[_0x1c83('0x1c')](_0x1c83('0x4f'),_0x40ca6e[_0x1c83('0x4b')],_0x500ce8[_0x1c83('0x50')],md5(_0x500ce8['uniqueid']));}else{_0x500ce8[_0x1c83('0x4e')]='';}headers[_0x1c83('0x51')]=getAuth(_0x40ca6e);return getUser(_0x40ca6e,_0x3683e2[_0x1c83('0x52')])[_0x1c83('0x17')](function(_0xcb0961){_0x23c975=_0xcb0961;logger['info']('The\x20User\x20ID\x20is:',_0x23c975['id']);return getEndUser(_0x40ca6e,_0x500ce8[_0x1c83('0x53')],_0x500ce8[_0x1c83('0x54')]);})[_0x1c83('0x17')](function(_0x1f1a1e){_0x14ed10=_0x1f1a1e;logger[_0x1c83('0xd')]('The\x20Enduser\x20ID\x20is:',_0x14ed10['id']);return getTicket(_0x40ca6e,_0x23c975,_0x14ed10,_0x5bdcb2,_0x500ce8);})[_0x1c83('0x17')](function(_0x901dc5){if(_0x901dc5){logger[_0x1c83('0xd')]('The\x20Ticket\x20ID\x20is:',_0x901dc5['id']);switch(_0x40ca6e[_0x1c83('0x3d')]){case _0x1c83('0x55'):logger[_0x1c83('0xd')](_0x1c83('0x4c'),_0x1c83('0x56'));return request({'uri':util[_0x1c83('0x1c')](_0x1c83('0x57'),_0x40ca6e[_0x1c83('0x1b')],_0x23c975['id'],_0x901dc5['id']),'method':'POST'});case _0x1c83('0x58'):logger[_0x1c83('0xd')](_0x1c83('0x4c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x3683e2[_0x1c83('0x12')]),_0x1c83('0x59'),{'uri':util['format'](_0x1c83('0x5a'),_0x40ca6e[_0x1c83('0x1b')],_0x901dc5['id'])});break;default:logger[_0x1c83('0x5b')](_0x1c83('0x4c'),_0x1c83('0x5c'));}}})[_0x1c83('0x5d')](function(_0xb23074){logger[_0x1c83('0x5b')](_0x1c83('0x5e'),util[_0x1c83('0x5f')](_0xb23074,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x4eb057,_0x176049,_0x48186f,_0x516326,_0x2364ad,_0x7c4252,_0x5993f9){var _0x37e9a4,_0x5173c4;_0x7c4252[_0x1c83('0x1b')]=intUtil['stripTrailingSlash'](_0x7c4252[_0x1c83('0x1b')]);_0x7c4252[_0x1c83('0x4b')]=intUtil[_0x1c83('0x4a')](_0x7c4252[_0x1c83('0x4b')]);if(_0x5993f9&&_0x5993f9['recordingFormat']&&_0x5993f9['recordingFormat']!==_0x1c83('0x60')){logger[_0x1c83('0xd')](_0x1c83('0x61'),_0x1c83('0x4d'));_0x176049['recordingURL']=util['format'](_0x1c83('0x4f'),_0x7c4252['serverUrl'],_0x176049[_0x1c83('0x50')],md5(_0x176049['uniqueid']));}headers[_0x1c83('0x51')]=getAuth(_0x7c4252);return getUser(_0x7c4252,_0x516326[_0x1c83('0x52')])['then'](function(_0x55d3f3){_0x37e9a4=_0x55d3f3;logger[_0x1c83('0xd')](_0x1c83('0x62'),_0x37e9a4['id']);return getEndUser(_0x7c4252,_0x176049[_0x1c83('0x63')],_0x176049[_0x1c83('0x64')]);})[_0x1c83('0x17')](function(_0x5eb52d){_0x5173c4=_0x5eb52d;logger[_0x1c83('0xd')](_0x1c83('0x65'),_0x5173c4['id']);return getTicket(_0x7c4252,_0x37e9a4,_0x5173c4,_0x48186f,_0x176049);})[_0x1c83('0x17')](function(_0x302fe4){if(_0x302fe4){logger[_0x1c83('0xd')]('The\x20Ticket\x20ID\x20is:',_0x302fe4['id']);switch(_0x7c4252[_0x1c83('0x3d')]){case _0x1c83('0x55'):logger[_0x1c83('0xd')](_0x1c83('0x61'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x1c83('0x1c')](_0x1c83('0x57'),_0x7c4252[_0x1c83('0x1b')],_0x37e9a4['id'],_0x302fe4['id']),'method':_0x1c83('0x2f')});case _0x1c83('0x58'):logger['info'](_0x1c83('0x61'),_0x1c83('0x66'));emit(util[_0x1c83('0x1c')](_0x1c83('0x67'),_0x516326[_0x1c83('0x12')]),_0x1c83('0x59'),{'uri':util[_0x1c83('0x1c')]('%s/agent/tickets/%s',_0x7c4252[_0x1c83('0x1b')],_0x302fe4['id'])});break;default:logger['error'](_0x1c83('0x61'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x3297ff){logger['error'](_0x1c83('0x68'),util[_0x1c83('0x5f')](_0x3297ff,{'showHidden':!![],'depth':null}));});};exports[_0x1c83('0x69')]=function(_0x26b11e,_0x511043,_0x434595,_0xef93f5,_0x3a61c9,_0x219e18){var _0x5d80b4,_0x5f91b1;_0x219e18[_0x1c83('0x1b')]=intUtil[_0x1c83('0x4a')](_0x219e18[_0x1c83('0x1b')]);_0x219e18[_0x1c83('0x4b')]=intUtil[_0x1c83('0x4a')](_0x219e18[_0x1c83('0x4b')]);if(_0x3a61c9&&_0x3a61c9['monitor_format']){logger[_0x1c83('0xd')](_0x1c83('0x6a'),_0x1c83('0x4d'));_0x511043[_0x1c83('0x4e')]=util[_0x1c83('0x1c')](_0x1c83('0x4f'),_0x219e18[_0x1c83('0x4b')],_0x511043[_0x1c83('0x50')],md5(_0x511043[_0x1c83('0x50')]));}else{_0x511043['recordingURL']='';}headers[_0x1c83('0x51')]=getAuth(_0x219e18);return getUser(_0x219e18)[_0x1c83('0x17')](function(_0x165f30){_0x5d80b4=_0x165f30;logger['info']('The\x20User\x20ID\x20is:',_0x5d80b4['id']);return getEndUser(_0x219e18,_0x511043[_0x1c83('0x53')],_0x511043[_0x1c83('0x54')]);})[_0x1c83('0x17')](function(_0x7c8fa0){_0x5f91b1=_0x7c8fa0;logger['info']('The\x20Enduser\x20ID\x20is:',_0x5f91b1['id']);return getTicket(_0x219e18,_0x5d80b4,_0x5f91b1,_0x434595,_0x511043);})['then'](function(_0x8ddae2){if(_0x8ddae2){logger[_0x1c83('0xd')](_0x1c83('0x6b'),_0x8ddae2['id']);}})[_0x1c83('0x5d')](function(_0x4dbcb6){logger[_0x1c83('0x5b')](_0x1c83('0x6c'),util[_0x1c83('0x5f')](_0x4dbcb6,{'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 7b00f07..62a9a5f 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 _0x1b8e=['clientSecret','refresh_token','seconds','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','then','users','findIndex','email','Agent\x20found!','profile','Administrator','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','catch','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','data','details','Error:\x20','log','CREATE\x20ERROR','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','format','mm:ss','answertime','endtime','starttime','lastevent','called','Call_Result','complete','Answered','rejected','Rejected','abandoned','Abandoned','Call_Start_Time','outbound','YYYY-MM-DDTHH:mm:ss','Fields','/crm/v2/Calls','stack','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','com','The\x20User\x20ID\x20is:','calleridname','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','/downloads?type=uniqueid&token=','zoho.eu','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','user:%s','[ABANDONED]','calleridnum','Inbound','lodash','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug','forEach','string','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token'];(function(_0x7853c1,_0x4a311a){var _0x59228f=function(_0x648710){while(--_0x648710){_0x7853c1['push'](_0x7853c1['shift']());}};_0x59228f(++_0x4a311a);}(_0x1b8e,0x19a));var _0xe1b8=function(_0x3427d0,_0x3756fe){_0x3427d0=_0x3427d0-0x0;var _0x10f020=_0x1b8e[_0x3427d0];return _0x10f020;};'use strict';var _=require(_0xe1b8('0x0'));var rp=require('request-promise');var md5=require(_0xe1b8('0x1'));var util=require(_0xe1b8('0x2'));var intUtil=require(_0xe1b8('0x3'));var moment=require(_0xe1b8('0x4'));var Redis=require(_0xe1b8('0x5'));var BPromise=require(_0xe1b8('0x6'));var config=require(_0xe1b8('0x7'));var logger=require(_0xe1b8('0x8'))(_0xe1b8('0x9'));config[_0xe1b8('0xa')]=_[_0xe1b8('0xb')](config[_0xe1b8('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xe1b8('0xc'))(new Redis(config[_0xe1b8('0xa')]));function emit(_0x5d954f,_0x4ed559,_0x16038d){io['to'](_0x5d954f)[_0xe1b8('0xd')](_0x4ed559,_0x16038d);}function request(_0x5de63d){logger[_0xe1b8('0xe')]('[HTTP]',JSON['stringify'](_0x5de63d));return rp(_0x5de63d);}function getCustomFields(_0xbd34e8,_0x56f13d){var _0x41d48f={};if(_0xbd34e8['length']>0x0){_[_0xe1b8('0xf')](_0xbd34e8,function(_0x330f84){if(_0x330f84['type']===_0xe1b8('0x10')&&_0x330f84[_0xe1b8('0x11')]){_0x41d48f[_0x330f84['idField']]=_0x330f84[_0xe1b8('0x12')][_0xe1b8('0x13')]();}else if(_0x330f84[_0xe1b8('0x14')]===_0xe1b8('0x15')&&_0x330f84[_0xe1b8('0x16')]&&_0x330f84[_0xe1b8('0x11')]&&_0x56f13d[_0x330f84['variableName']]){_0x41d48f[_0x330f84[_0xe1b8('0x11')]]=_0x56f13d[_0x330f84['variableName']][_0xe1b8('0x13')]();}else if(_0x330f84['type']===_0xe1b8('0x17')&&_0x330f84[_0xe1b8('0x18')]&&_0x330f84['Variable'][_0xe1b8('0x19')]&&_0x330f84[_0xe1b8('0x11')]&&_0x56f13d[_0x330f84[_0xe1b8('0x18')][_0xe1b8('0x19')][_0xe1b8('0x1a')]()]){_0x41d48f[_0x330f84[_0xe1b8('0x11')]]=_0x56f13d[_0x330f84[_0xe1b8('0x18')][_0xe1b8('0x19')]['toLowerCase']()]['toString']();}});}return _0x41d48f;}function getName(_0x3217cc){if(_0x3217cc['indexOf']('\x20')>0x0){var _0x5caeb4=_0x3217cc[_0xe1b8('0x1b')](/ (.+)/);if(_0x5caeb4[0x1]){return _0x5caeb4;}}return[_0x3217cc,_0x3217cc];}var accountsTokens={};function getAccessToken(_0x1028fc){return new Promise(function(_0x270907,_0x105375){if(!_[_0xe1b8('0x1c')](accountsTokens[_0x1028fc['id']])&&!_[_0xe1b8('0x1c')](accountsTokens[_0x1028fc['id']][_0xe1b8('0x1d')])){if(moment()[_0xe1b8('0x1e')](accountsTokens[_0x1028fc['id']][_0xe1b8('0x1f')])){_0x270907(accountsTokens[_0x1028fc['id']][_0xe1b8('0x1d')]);}}var _0xf630ba;switch(_0x1028fc[_0xe1b8('0x20')]){case'US':_0xf630ba=_0xe1b8('0x21');break;case'AU':_0xf630ba=_0xe1b8('0x22');break;case'EU':_0xf630ba=_0xe1b8('0x23');break;case'IN':_0xf630ba=_0xe1b8('0x24');break;case'CN':_0xf630ba=_0xe1b8('0x25');break;default:_0xf630ba=_0xe1b8('0x23');break;}var _0x4a6312={'method':_0xe1b8('0x26'),'uri':_0xf630ba+_0xe1b8('0x27'),'qs':{'refresh_token':_0x1028fc['refreshToken'],'client_id':_0x1028fc['clientId'],'client_secret':_0x1028fc[_0xe1b8('0x28')],'grant_type':_0xe1b8('0x29')},'json':!![]};return rp(_0x4a6312)['then'](function(_0x2e6348){accountsTokens[_0x1028fc['id']]={'access_token':_0x2e6348['access_token'],'expires_in':moment()['add'](_0x2e6348[_0xe1b8('0x1f')],_0xe1b8('0x2a'))};_0x270907(_0x2e6348[_0xe1b8('0x1d')]);})['catch'](function(_0xb15705){logger[_0xe1b8('0x2b')](_0xe1b8('0x2c'),_0xb15705['stack']);_0x105375(_0xb15705);});});}function getUser(_0x53ba07,_0x12055b,_0x412774,_0x2cf4f8){logger[_0xe1b8('0x2d')](_0xe1b8('0x2e'));return request({'method':_0xe1b8('0x2f'),'uri':util['format'](_0xe1b8('0x30'),_0x12055b),'qs':{'type':_0xe1b8('0x31')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x53ba07},'json':!![]})[_0xe1b8('0x32')](function(_0x3e8869){if(_0x3e8869[_0xe1b8('0x33')]){var _0x637556=-0x1;if(_['isArrayLikeObject'](_0x3e8869[_0xe1b8('0x33')])){if(!_[_0xe1b8('0x1c')](_0x2cf4f8)){_0x637556=_[_0xe1b8('0x34')](_0x3e8869[_0xe1b8('0x33')],function(_0x49795b){return _0x49795b[_0xe1b8('0x35')]===_0x2cf4f8;});}if(_0x637556>=0x0){logger[_0xe1b8('0x2d')](_0xe1b8('0x36'));}else{logger[_0xe1b8('0x2d')]('Using\x20the\x20admin\x20account!');_0x637556=_['findIndex'](_0x3e8869[_0xe1b8('0x33')],function(_0x1c40a5){return _0x1c40a5[_0xe1b8('0x37')]['name']===_0xe1b8('0x38');});}return _0x3e8869[_0xe1b8('0x33')][_0x637556];}else{if(_0x3e8869['user'][_0xe1b8('0x37')][_0xe1b8('0x19')]===_0xe1b8('0x38')){logger[_0xe1b8('0x2d')](_0xe1b8('0x39'));user=_0x3e8869['user'];return user;}else{logger[_0xe1b8('0x2b')](_0xe1b8('0x3a'),JSON[_0xe1b8('0x3b')](_0x3e8869));throw new Error(_0xe1b8('0x3c')+JSON[_0xe1b8('0x3b')](_0x3e8869));}}}else{logger[_0xe1b8('0x2b')]('The\x20failing\x20result\x20is',JSON[_0xe1b8('0x3b')](_0x3e8869));throw new Error(_0xe1b8('0x3c')+JSON[_0xe1b8('0x3b')](_0x3e8869));}})['catch'](function(_0x4f25b5){console[_0xe1b8('0x2b')](_0x4f25b5);});}function getZohoUser(_0x496ae8,_0x12c09f){return new BPromise(function(_0xeeaf29,_0x275b4f){request(_0x496ae8)[_0xe1b8('0x32')](function(_0x20cd5d){var _0x10d1cf=null;if(_0x20cd5d){_0x10d1cf=_0x20cd5d['data'][0x0];_0x10d1cf[_0xe1b8('0x3d')]=_0x12c09f;}_0xeeaf29(_0x10d1cf);})[_0xe1b8('0x3e')](function(_0x345701){_0x275b4f(_0x345701);});});}function createEndUser(_0xbc923,_0x321f83,_0x196747,_0x14ea15,_0x4fbbae,_0x463f5b){var _0x196747=getName(_0x196747);return request({'method':'POST','uri':_0xe1b8('0x3f')+_0x321f83+_0xe1b8('0x40')+_[_0xe1b8('0x41')](_0x463f5b[_0xe1b8('0x42')])+'s','body':{'data':[{'Last_Name':_0x196747[0x1],'First_Name':_0x196747[0x0],'Phone':_0x14ea15,'Owner':{'name':!_[_0xe1b8('0x1c')](_0x4fbbae[_0xe1b8('0x43')]['name'])?_0x4fbbae['role'][_0xe1b8('0x19')]:!_['isNil'](_0x4fbbae[_0xe1b8('0x44')])?_0x4fbbae[_0xe1b8('0x44')]+'\x20'+_0x4fbbae[_0xe1b8('0x45')]:_0x4fbbae['last_name'],'id':_0x4fbbae['id']}}]},'headers':{'Authorization':_0xe1b8('0x46')+_0xbc923},'json':!![]})[_0xe1b8('0x32')](function(_0x58cd41){if(_0x58cd41&&_0x58cd41['data'][0x0][_0xe1b8('0x47')]===_0xe1b8('0x48')){var _0x5a86be=_0x58cd41[_0xe1b8('0x49')][0x0][_0xe1b8('0x4a')];_0x5a86be['enduserType']=_['startCase'](_0x463f5b['moduleCreate'])+'s';return _0x5a86be;}logger[_0xe1b8('0x2b')]('The\x20failing\x20result\x20is',JSON[_0xe1b8('0x3b')](data));throw new Error(_0xe1b8('0x4b')+JSON['stringify'](data));})['catch'](function(_0x26404f){console[_0xe1b8('0x4c')](_0xe1b8('0x4d'),_0x26404f);});}function getEndUser(_0x1cc8b8,_0x28a120,_0x576ad2,_0x27b215,_0x10c80a,_0x299fe6,_0x3f870d){var _0x59e814={'method':_0xe1b8('0x2f'),'uri':'','headers':{'Authorization':_0xe1b8('0x46')+_0x1cc8b8},'json':!![]};switch(_0x3f870d['moduleSearch']){case _0xe1b8('0x4e'):_0x59e814[_0xe1b8('0x4f')]='https://www.zohoapis.'+_0x28a120+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x10c80a+'))';return getZohoUser(_0x59e814,_0xe1b8('0x50'))['then'](function(_0x16111b){if(_0x16111b)return _0x16111b;_0x59e814['uri']=_0xe1b8('0x3f')+_0x28a120+_0xe1b8('0x51')+_0x10c80a+'))';return getZohoUser(_0x59e814,_0xe1b8('0x52'))[_0xe1b8('0x32')](function(_0x2e8ec1){if(_0x2e8ec1)return _0x2e8ec1;if(_0x3f870d['moduleCreate']!=_0xe1b8('0x53')){return createEndUser(_0x1cc8b8,_0x28a120,_0x27b215,_0x10c80a,_0x299fe6,_0x3f870d);}else{return{};}});});break;case _0xe1b8('0x54'):_0x59e814['uri']='https://www.zohoapis.'+_0x28a120+_0xe1b8('0x55')+_0x10c80a+'))';return getZohoUser(_0x59e814,_0xe1b8('0x50'))[_0xe1b8('0x32')](function(_0x4881b6){if(_0x4881b6)return _0x4881b6;if(_0x3f870d['moduleCreate']!=_0xe1b8('0x53')){return createEndUser(_0x1cc8b8,_0x28a120,_0x27b215,_0x10c80a,_0x299fe6,_0x3f870d);}else{return{};}});break;case _0xe1b8('0x56'):_0x59e814[_0xe1b8('0x4f')]=_0xe1b8('0x3f')+_0x28a120+_0xe1b8('0x51')+_0x10c80a+'))';return getZohoUser(_0x59e814,_0xe1b8('0x52'))[_0xe1b8('0x32')](function(_0x3082da){if(_0x3082da)return _0x3082da;if(_0x3f870d[_0xe1b8('0x42')]!=_0xe1b8('0x53')){return createEndUser(_0x1cc8b8,_0x28a120,_0x27b215,_0x10c80a,_0x299fe6,_0x3f870d);}else{return{};}});break;}}function getCall(_0x55a7d0,_0x20239,_0x296f31,_0x8c50c5,_0x4021cd,_0x59348f,_0x24d0e2,_0x1fd8d3){logger[_0xe1b8('0x2d')]('Creating\x20new\x20call...');var _0xd66f9d={};_0xd66f9d['Owner']={'name':!_[_0xe1b8('0x1c')](_0x8c50c5[_0xe1b8('0x43')][_0xe1b8('0x19')])&&!_['isNil'](_0x8c50c5[_0xe1b8('0x37')][_0xe1b8('0x19')])&&_0x8c50c5[_0xe1b8('0x37')][_0xe1b8('0x19')]==='administrator'?_0x8c50c5['role'][_0xe1b8('0x19')]:!_[_0xe1b8('0x1c')](_0x8c50c5[_0xe1b8('0x44')])?_0x8c50c5[_0xe1b8('0x44')]+'\x20'+_0x8c50c5[_0xe1b8('0x45')]:_0x8c50c5[_0xe1b8('0x45')],'id':_0x8c50c5['id']};_0xd66f9d[_0xe1b8('0x57')]=intUtil[_0xe1b8('0x58')](_0x59348f[_0xe1b8('0x59')],_0x24d0e2,'\x20');_0xd66f9d[_0xe1b8('0x5a')]=intUtil['getString'](_0x59348f[_0xe1b8('0x5b')],_0x24d0e2,'\x0a');if(_0x4021cd[_0xe1b8('0x3d')]===_0xe1b8('0x50')){_0xd66f9d[_0xe1b8('0x5c')]={'name':!_['isNil'](_0x4021cd[_0xe1b8('0x5d')])?_0x4021cd['Full_Name']:!_[_0xe1b8('0x1c')](_0x4021cd[_0xe1b8('0x5e')])?_0x4021cd[_0xe1b8('0x5e')]+'\x20'+_0x4021cd[_0xe1b8('0x5f')]:_0x4021cd[_0xe1b8('0x5f')],'id':_0x4021cd['id']};}if(_0x4021cd[_0xe1b8('0x3d')]===_0xe1b8('0x52')){_0xd66f9d[_0xe1b8('0x60')]={'name':!_['isNil'](_0x4021cd['Full_Name'])?_0x4021cd[_0xe1b8('0x5d')]:!_[_0xe1b8('0x1c')](_0x4021cd[_0xe1b8('0x5e')])?_0x4021cd[_0xe1b8('0x5e')]+'\x20'+_0x4021cd['Last_Name']:_0x4021cd[_0xe1b8('0x5f')],'id':_0x4021cd['id']};_0xd66f9d[_0xe1b8('0x61')]=_[_0xe1b8('0x41')](_0x4021cd['enduserType']);}if(_0x24d0e2['talktime']){_0xd66f9d[_0xe1b8('0x62')]=moment[_0xe1b8('0x63')](parseInt(_0x24d0e2[_0xe1b8('0x64')])*0x3e8)[_0xe1b8('0x65')](_0xe1b8('0x66'));}else if(_0x24d0e2[_0xe1b8('0x67')]&&_0x24d0e2[_0xe1b8('0x68')]){_0xd66f9d['Call_Duration']=moment['utc'](moment(_0x24d0e2[_0xe1b8('0x68')],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0x24d0e2[_0xe1b8('0x69')],'YYYY-MM-DDTHH:mm:ss')))[_0xe1b8('0x65')]('mm:ss');}switch(_0x24d0e2[_0xe1b8('0x6a')]){case _0xe1b8('0x6b'):_0xd66f9d[_0xe1b8('0x6c')]='Called';break;case _0xe1b8('0x6d'):case'connect':_0xd66f9d[_0xe1b8('0x6c')]=_0xe1b8('0x6e');break;case _0xe1b8('0x6f'):_0xd66f9d[_0xe1b8('0x6c')]=_0xe1b8('0x70');break;case _0xe1b8('0x71'):_0xd66f9d[_0xe1b8('0x6c')]=_0xe1b8('0x72');break;default:}_0xd66f9d[_0xe1b8('0x73')]=(_0x1fd8d3===_0xe1b8('0x74')?moment(_0x24d0e2[_0xe1b8('0x69')])[_0xe1b8('0x65')](_0xe1b8('0x75')):moment(_0x24d0e2['agentcalledAt'])[_0xe1b8('0x65')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0xe1b8('0x65')]('YYYY-MM-DDTHH:mm:ss');_0xd66f9d['Call_Type']=_0x1fd8d3||'Inbound';_0xd66f9d=_['merge'](_0xd66f9d,getCustomFields(_0x59348f[_0xe1b8('0x76')],_0x24d0e2));return request({'method':'POST','uri':_0xe1b8('0x3f')+_0x20239+_0xe1b8('0x77'),'headers':{'Authorization':_0xe1b8('0x46')+_0x55a7d0},'body':{'data':[_0xd66f9d]},'json':!![]})[_0xe1b8('0x32')](function(_0x3eebc0){if(_0x3eebc0&&_0x3eebc0['data'][0x0][_0xe1b8('0x47')]==='SUCCESS'){logger[_0xe1b8('0x2d')]('Call\x20created!');return{'id':_0x3eebc0[_0xe1b8('0x49')][0x0][_0xe1b8('0x4a')]['id']};}})[_0xe1b8('0x3e')](function(_0x5b1a28){logger['info']('err',_0x5b1a28[_0xe1b8('0x78')]);console[_0xe1b8('0x4c')](_0xe1b8('0x79'),_0x5b1a28);});}exports['queue']=function(_0x191396,_0xf75268,_0x3c3561,_0x344819,_0x38d2ec,_0x54a657){var _0x329b1e,_0x57726f,_0x4bc1c6;_0x54a657[_0xe1b8('0x7a')]=intUtil[_0xe1b8('0x7b')](_0x54a657[_0xe1b8('0x7a')]);_0x54a657[_0xe1b8('0x7c')]=intUtil['stripTrailingSlash'](_0x54a657[_0xe1b8('0x7c')]);if(_0x38d2ec&&_0x38d2ec[_0xe1b8('0x7d')]){logger[_0xe1b8('0x2d')](_0xe1b8('0x7e'),'Recording\x20is\x20enabled!');_0xf75268[_0xe1b8('0x7f')]=_0x54a657['serverUrl']+_0xe1b8('0x80')+_0xf75268[_0xe1b8('0x81')]+'/downloads?type=uniqueid&token='+md5(_0xf75268[_0xe1b8('0x81')]);}else{_0xf75268['recordingURL']='';}var _0x29d633=_0x54a657[_0xe1b8('0x7a')]==='zoho.eu'?'eu':_0xe1b8('0x82');return getAccessToken(_0x54a657)['then'](function(_0x4c1d01){_0x4bc1c6=_0x4c1d01;return getUser(_0x4bc1c6,_0x29d633,_0x54a657,_0x344819[_0xe1b8('0x35')]);})['then'](function(_0x50be46){_0x329b1e=_0x50be46;logger['info'](_0xe1b8('0x83'),_0x329b1e['id']);return getEndUser(_0x4bc1c6,_0x29d633,_0x54a657,_0xf75268[_0xe1b8('0x84')],_0xf75268['calleridnum'],_0x329b1e,_0x3c3561);})[_0xe1b8('0x32')](function(_0x104edf){_0x57726f=_0x104edf;return getCall(_0x4bc1c6,_0x29d633,_0x54a657,_0x329b1e,_0x57726f,_0x3c3561,_0xf75268,'Inbound');})['then'](function(_0x2915e4){if(_0x2915e4){logger[_0xe1b8('0x2d')]('The\x20Call\x20ID\x20is:',_0x2915e4['id']);logger[_0xe1b8('0x2d')](_0xe1b8('0x7e'),_0xe1b8('0x85'));emit(util[_0xe1b8('0x65')]('user:%s',_0x344819[_0xe1b8('0x19')]),_0xe1b8('0x86'),{'uri':_0xe1b8('0x87')+_0x54a657[_0xe1b8('0x7a')]+_0xe1b8('0x88')+_0x2915e4['id']});}})[_0xe1b8('0x3e')](function(_0x2566df){logger[_0xe1b8('0x2b')](_0xe1b8('0x7e'),JSON['stringify'](_0x2566df));});};exports[_0xe1b8('0x74')]=function(_0x17d5eb,_0x7eb20e,_0x3619e0,_0x4aae90,_0x43d7b4,_0x37dd50,_0x5a3c87){var _0x50c961,_0x2d9ba1,_0x4548d1;_0x37dd50[_0xe1b8('0x7a')]=intUtil[_0xe1b8('0x7b')](_0x37dd50[_0xe1b8('0x7a')]);_0x37dd50[_0xe1b8('0x7c')]=intUtil[_0xe1b8('0x7b')](_0x37dd50[_0xe1b8('0x7c')]);if(_0x5a3c87&&_0x5a3c87['recordingFormat']&&_0x5a3c87[_0xe1b8('0x89')]!=='none'){logger[_0xe1b8('0x2d')](_0xe1b8('0x8a'),_0xe1b8('0x8b'));_0x7eb20e[_0xe1b8('0x7f')]=_0x37dd50[_0xe1b8('0x7c')]+_0xe1b8('0x80')+_0x7eb20e[_0xe1b8('0x81')]+_0xe1b8('0x8c')+md5(_0x7eb20e[_0xe1b8('0x81')]);}var _0x5adff5=_0x37dd50[_0xe1b8('0x7a')]===_0xe1b8('0x8d')?'eu':_0xe1b8('0x82');return getAccessToken(_0x37dd50)['then'](function(_0x1328a7){_0x4548d1=_0x1328a7;return getUser(_0x4548d1,_0x5adff5,_0x37dd50,_0x4aae90[_0xe1b8('0x35')]);})[_0xe1b8('0x32')](function(_0x3b0334){_0x50c961=_0x3b0334;logger['info'](_0xe1b8('0x83'),_0x50c961['id']);return getEndUser(_0x4548d1,_0x5adff5,_0x37dd50,_0x7eb20e[_0xe1b8('0x8e')],_0x7eb20e[_0xe1b8('0x8f')],_0x50c961,_0x3619e0);})['then'](function(_0x59bf63){_0x2d9ba1=_0x59bf63;return getCall(_0x4548d1,_0x5adff5,_0x37dd50,_0x50c961,_0x2d9ba1,_0x3619e0,_0x7eb20e,_0xe1b8('0x90'));})[_0xe1b8('0x32')](function(_0x1a3797){if(_0x1a3797){logger['info'](_0xe1b8('0x91'),_0x1a3797['id']);logger[_0xe1b8('0x2d')](_0xe1b8('0x8a'),_0xe1b8('0x85'));emit(util['format'](_0xe1b8('0x92'),_0x4aae90[_0xe1b8('0x19')]),_0xe1b8('0x86'),{'uri':_0xe1b8('0x87')+_0x37dd50[_0xe1b8('0x7a')]+_0xe1b8('0x88')+_0x1a3797['id']});}})[_0xe1b8('0x3e')](function(_0x2ce179){logger[_0xe1b8('0x2b')](_0xe1b8('0x8a'),JSON[_0xe1b8('0x3b')](_0x2ce179));});};exports[_0xe1b8('0x71')]=function(_0x495453,_0x201ee9,_0x2a9e2a,_0x10d209,_0x46e589,_0x1bd07c){var _0x2e4032,_0x2f1ada,_0x6bd6b4;_0x1bd07c['host']=intUtil['stripTrailingSlash'](_0x1bd07c[_0xe1b8('0x7a')]);_0x1bd07c[_0xe1b8('0x7c')]=intUtil[_0xe1b8('0x7b')](_0x1bd07c['serverUrl']);if(_0x46e589&&_0x46e589['monitor_format']){logger[_0xe1b8('0x2d')](_0xe1b8('0x93'),'Recording\x20is\x20enabled!');_0x201ee9[_0xe1b8('0x7f')]=_0x1bd07c['serverUrl']+_0xe1b8('0x80')+_0x201ee9[_0xe1b8('0x81')]+_0xe1b8('0x8c')+md5(_0x201ee9[_0xe1b8('0x81')]);}else{_0x201ee9[_0xe1b8('0x7f')]='';}var _0x222240=_0x1bd07c['host']==='zoho.eu'?'eu':_0xe1b8('0x82');return getAccessToken(_0x1bd07c)[_0xe1b8('0x32')](function(_0x1c88dd){_0x6bd6b4=_0x1c88dd;return getUser(_0x6bd6b4,_0x222240,_0x1bd07c);})[_0xe1b8('0x32')](function(_0x14cc3b){_0x2e4032=_0x14cc3b;logger[_0xe1b8('0x2d')](_0xe1b8('0x83'),_0x2e4032['id']);return getEndUser(_0x6bd6b4,_0x222240,_0x1bd07c,_0x201ee9[_0xe1b8('0x84')],_0x201ee9[_0xe1b8('0x94')],_0x2e4032,_0x2a9e2a);})['then'](function(_0x1d50d9){_0x2f1ada=_0x1d50d9;return getCall(_0x6bd6b4,_0x222240,_0x1bd07c,_0x2e4032,_0x2f1ada,_0x2a9e2a,_0x201ee9,_0xe1b8('0x95'));})[_0xe1b8('0x32')](function(_0x218371){if(_0x218371){logger[_0xe1b8('0x2d')]('The\x20Call\x20ID\x20is:',_0x218371['id']);}})[_0xe1b8('0x3e')](function(_0x4d3ff4){logger[_0xe1b8('0x2b')](_0xe1b8('0x93'),JSON[_0xe1b8('0x3b')](_0x4d3ff4));});}; \ No newline at end of file +var _0x602c=['host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','email','The\x20User\x20ID\x20is:','calleridnum','Inbound','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','user:%s','trigger:browser:url','[ABANDONED]','zoho.eu','calleridname','md5','./util','moment','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','[HTTP]','length','forEach','string','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','zone','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','expires_in','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','enduserType','/crm/v2/','startCase','role','first_name','last_name','data','code','details','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','format','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','called','Called','complete','connect','Call_Result','Answered','rejected','abandoned','Abandoned','Call_Start_Time','outbound','agentcalledAt','merge','Fields','/crm/v2/Calls','SUCCESS','Call\x20created!','err','queue'];(function(_0x316b13,_0x21c7b3){var _0x29ab59=function(_0x4e5145){while(--_0x4e5145){_0x316b13['push'](_0x316b13['shift']());}};_0x29ab59(++_0x21c7b3);}(_0x602c,0xba));var _0xc602=function(_0x127ed7,_0x18c2c5){_0x127ed7=_0x127ed7-0x0;var _0x17c7bb=_0x602c[_0x127ed7];return _0x17c7bb;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xc602('0x0'));var util=require('util');var intUtil=require(_0xc602('0x1'));var moment=require(_0xc602('0x2'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0xc602('0x3'));var logger=require(_0xc602('0x4'))(_0xc602('0x5'));config[_0xc602('0x6')]=_[_0xc602('0x7')](config[_0xc602('0x6')],{'host':_0xc602('0x8'),'port':0x18eb});var io=require(_0xc602('0x9'))(new Redis(config[_0xc602('0x6')]));function emit(_0x193667,_0x3869eb,_0x333369){io['to'](_0x193667)[_0xc602('0xa')](_0x3869eb,_0x333369);}function request(_0x276245){logger['debug'](_0xc602('0xb'),JSON['stringify'](_0x276245));return rp(_0x276245);}function getCustomFields(_0x45b8e6,_0x5d718c){var _0x58483e={};if(_0x45b8e6[_0xc602('0xc')]>0x0){_[_0xc602('0xd')](_0x45b8e6,function(_0x57290b){if(_0x57290b['type']===_0xc602('0xe')&&_0x57290b['idField']){_0x58483e[_0x57290b[_0xc602('0xf')]]=_0x57290b[_0xc602('0x10')][_0xc602('0x11')]();}else if(_0x57290b[_0xc602('0x12')]===_0xc602('0x13')&&_0x57290b['variableName']&&_0x57290b[_0xc602('0xf')]&&_0x5d718c[_0x57290b[_0xc602('0x14')]]){_0x58483e[_0x57290b[_0xc602('0xf')]]=_0x5d718c[_0x57290b[_0xc602('0x14')]]['toString']();}else if(_0x57290b['type']===_0xc602('0x15')&&_0x57290b[_0xc602('0x16')]&&_0x57290b['Variable'][_0xc602('0x17')]&&_0x57290b[_0xc602('0xf')]&&_0x5d718c[_0x57290b[_0xc602('0x16')][_0xc602('0x17')][_0xc602('0x18')]()]){_0x58483e[_0x57290b[_0xc602('0xf')]]=_0x5d718c[_0x57290b['Variable'][_0xc602('0x17')][_0xc602('0x18')]()][_0xc602('0x11')]();}});}return _0x58483e;}function getName(_0x5e3ed5){if(_0x5e3ed5[_0xc602('0x19')]('\x20')>0x0){var _0xb99d05=_0x5e3ed5[_0xc602('0x1a')](/ (.+)/);if(_0xb99d05[0x1]){return _0xb99d05;}}return[_0x5e3ed5,_0x5e3ed5];}var accountsTokens={};function getAccessToken(_0x56c3ad){return new Promise(function(_0x260f72,_0xed32cb){if(!_[_0xc602('0x1b')](accountsTokens[_0x56c3ad['id']])&&!_['isNil'](accountsTokens[_0x56c3ad['id']][_0xc602('0x1c')])){if(moment()[_0xc602('0x1d')](accountsTokens[_0x56c3ad['id']]['expires_in'])){_0x260f72(accountsTokens[_0x56c3ad['id']][_0xc602('0x1c')]);}}var _0x209cb4;switch(_0x56c3ad[_0xc602('0x1e')]){case'US':_0x209cb4='https://accounts.zoho.com';break;case'AU':_0x209cb4='https://accounts.zoho.com.au';break;case'EU':_0x209cb4=_0xc602('0x1f');break;case'IN':_0x209cb4=_0xc602('0x20');break;case'CN':_0x209cb4=_0xc602('0x21');break;default:_0x209cb4='https://accounts.zoho.eu';break;}var _0x3663b2={'method':_0xc602('0x22'),'uri':_0x209cb4+_0xc602('0x23'),'qs':{'refresh_token':_0x56c3ad[_0xc602('0x24')],'client_id':_0x56c3ad[_0xc602('0x25')],'client_secret':_0x56c3ad['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x3663b2)['then'](function(_0x37e662){accountsTokens[_0x56c3ad['id']]={'access_token':_0x37e662[_0xc602('0x1c')],'expires_in':moment()['add'](_0x37e662[_0xc602('0x26')],_0xc602('0x27'))};_0x260f72(_0x37e662['access_token']);})[_0xc602('0x28')](function(_0x5a6efe){logger['error'](_0xc602('0x29'),_0x5a6efe[_0xc602('0x2a')]);_0xed32cb(_0x5a6efe);});});}function getUser(_0x456f98,_0x383d90,_0x48f646,_0x1fe7f4){logger[_0xc602('0x2b')](_0xc602('0x2c'));return request({'method':_0xc602('0x2d'),'uri':util['format'](_0xc602('0x2e'),_0x383d90),'qs':{'type':_0xc602('0x2f')},'headers':{'Authorization':_0xc602('0x30')+_0x456f98},'json':!![]})[_0xc602('0x31')](function(_0x46a7e4){if(_0x46a7e4[_0xc602('0x32')]){var _0x222855=-0x1;if(_[_0xc602('0x33')](_0x46a7e4[_0xc602('0x32')])){if(!_[_0xc602('0x1b')](_0x1fe7f4)){_0x222855=_[_0xc602('0x34')](_0x46a7e4['users'],function(_0x5d008e){return _0x5d008e['email']===_0x1fe7f4;});}if(_0x222855>=0x0){logger[_0xc602('0x2b')](_0xc602('0x35'));}else{logger[_0xc602('0x2b')](_0xc602('0x36'));_0x222855=_['findIndex'](_0x46a7e4['users'],function(_0x5e6951){return _0x5e6951[_0xc602('0x37')]['name']===_0xc602('0x38');});}return _0x46a7e4[_0xc602('0x32')][_0x222855];}else{if(_0x46a7e4[_0xc602('0x39')][_0xc602('0x37')]['name']===_0xc602('0x38')){logger[_0xc602('0x2b')]('Using\x20the\x20admin\x20account!');user=_0x46a7e4['user'];return user;}else{logger[_0xc602('0x3a')]('The\x20failing\x20result\x20is',JSON[_0xc602('0x3b')](_0x46a7e4));throw new Error(_0xc602('0x3c')+JSON[_0xc602('0x3b')](_0x46a7e4));}}}else{logger['error'](_0xc602('0x3d'),JSON[_0xc602('0x3b')](_0x46a7e4));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xc602('0x3b')](_0x46a7e4));}})['catch'](function(_0x13d881){console['error'](_0x13d881);});}function getZohoUser(_0x181eab,_0x401934){return new BPromise(function(_0x6f6f5b,_0x23b483){request(_0x181eab)[_0xc602('0x31')](function(_0x2107c9){var _0x358d1a=null;if(_0x2107c9){_0x358d1a=_0x2107c9['data'][0x0];_0x358d1a[_0xc602('0x3e')]=_0x401934;}_0x6f6f5b(_0x358d1a);})[_0xc602('0x28')](function(_0x4b1609){_0x23b483(_0x4b1609);});});}function createEndUser(_0x52c0a7,_0x46a94a,_0xd7982a,_0x637d87,_0x584146,_0x4a842a){var _0xd7982a=getName(_0xd7982a);return request({'method':_0xc602('0x22'),'uri':'https://www.zohoapis.'+_0x46a94a+_0xc602('0x3f')+_[_0xc602('0x40')](_0x4a842a['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0xd7982a[0x1],'First_Name':_0xd7982a[0x0],'Phone':_0x637d87,'Owner':{'name':!_[_0xc602('0x1b')](_0x584146['role'][_0xc602('0x17')])?_0x584146[_0xc602('0x41')][_0xc602('0x17')]:!_[_0xc602('0x1b')](_0x584146[_0xc602('0x42')])?_0x584146['first_name']+'\x20'+_0x584146['last_name']:_0x584146[_0xc602('0x43')],'id':_0x584146['id']}}]},'headers':{'Authorization':_0xc602('0x30')+_0x52c0a7},'json':!![]})[_0xc602('0x31')](function(_0x2e9a3b){if(_0x2e9a3b&&_0x2e9a3b[_0xc602('0x44')][0x0][_0xc602('0x45')]==='SUCCESS'){var _0x8d5db6=_0x2e9a3b[_0xc602('0x44')][0x0][_0xc602('0x46')];_0x8d5db6['enduserType']=_[_0xc602('0x40')](_0x4a842a[_0xc602('0x47')])+'s';return _0x8d5db6;}logger[_0xc602('0x3a')]('The\x20failing\x20result\x20is',JSON[_0xc602('0x3b')](data));throw new Error(_0xc602('0x48')+JSON[_0xc602('0x3b')](data));})[_0xc602('0x28')](function(_0xb5e4f1){console[_0xc602('0x49')](_0xc602('0x4a'),_0xb5e4f1);});}function getEndUser(_0x1b9cfe,_0xd0bfd5,_0x27fb79,_0x57ddc9,_0x212004,_0x2ef023,_0x1b8867){var _0x353349={'method':_0xc602('0x2d'),'uri':'','headers':{'Authorization':_0xc602('0x30')+_0x1b9cfe},'json':!![]};switch(_0x1b8867[_0xc602('0x4b')]){case _0xc602('0x4c'):_0x353349[_0xc602('0x4d')]=_0xc602('0x4e')+_0xd0bfd5+_0xc602('0x4f')+_0x212004+'))';return getZohoUser(_0x353349,_0xc602('0x50'))[_0xc602('0x31')](function(_0x54a866){if(_0x54a866)return _0x54a866;_0x353349[_0xc602('0x4d')]=_0xc602('0x4e')+_0xd0bfd5+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x212004+'))';return getZohoUser(_0x353349,_0xc602('0x51'))['then'](function(_0x1a8194){if(_0x1a8194)return _0x1a8194;if(_0x1b8867[_0xc602('0x47')]!=_0xc602('0x52')){return createEndUser(_0x1b9cfe,_0xd0bfd5,_0x57ddc9,_0x212004,_0x2ef023,_0x1b8867);}else{return{};}});});break;case'contact':_0x353349[_0xc602('0x4d')]=_0xc602('0x4e')+_0xd0bfd5+_0xc602('0x4f')+_0x212004+'))';return getZohoUser(_0x353349,_0xc602('0x50'))[_0xc602('0x31')](function(_0x1e8fdc){if(_0x1e8fdc)return _0x1e8fdc;if(_0x1b8867[_0xc602('0x47')]!=_0xc602('0x52')){return createEndUser(_0x1b9cfe,_0xd0bfd5,_0x57ddc9,_0x212004,_0x2ef023,_0x1b8867);}else{return{};}});break;case _0xc602('0x53'):_0x353349[_0xc602('0x4d')]='https://www.zohoapis.'+_0xd0bfd5+_0xc602('0x54')+_0x212004+'))';return getZohoUser(_0x353349,_0xc602('0x51'))[_0xc602('0x31')](function(_0x586ecf){if(_0x586ecf)return _0x586ecf;if(_0x1b8867['moduleCreate']!='nothing'){return createEndUser(_0x1b9cfe,_0xd0bfd5,_0x57ddc9,_0x212004,_0x2ef023,_0x1b8867);}else{return{};}});break;}}function getCall(_0x3caaf9,_0x14b959,_0x375647,_0x1f3e39,_0x322474,_0x19eb0c,_0x6cd26f,_0x10b759){logger[_0xc602('0x2b')](_0xc602('0x55'));var _0x33ad18={};_0x33ad18['Owner']={'name':!_[_0xc602('0x1b')](_0x1f3e39[_0xc602('0x41')][_0xc602('0x17')])&&!_[_0xc602('0x1b')](_0x1f3e39[_0xc602('0x37')][_0xc602('0x17')])&&_0x1f3e39[_0xc602('0x37')][_0xc602('0x17')]==='administrator'?_0x1f3e39[_0xc602('0x41')][_0xc602('0x17')]:!_['isNil'](_0x1f3e39[_0xc602('0x42')])?_0x1f3e39[_0xc602('0x42')]+'\x20'+_0x1f3e39[_0xc602('0x43')]:_0x1f3e39[_0xc602('0x43')],'id':_0x1f3e39['id']};_0x33ad18[_0xc602('0x56')]=intUtil[_0xc602('0x57')](_0x19eb0c[_0xc602('0x58')],_0x6cd26f,'\x20');_0x33ad18[_0xc602('0x59')]=intUtil[_0xc602('0x57')](_0x19eb0c[_0xc602('0x5a')],_0x6cd26f,'\x0a');if(_0x322474[_0xc602('0x3e')]===_0xc602('0x50')){_0x33ad18[_0xc602('0x5b')]={'name':!_['isNil'](_0x322474[_0xc602('0x5c')])?_0x322474['Full_Name']:!_['isNil'](_0x322474[_0xc602('0x5d')])?_0x322474[_0xc602('0x5d')]+'\x20'+_0x322474[_0xc602('0x5e')]:_0x322474[_0xc602('0x5e')],'id':_0x322474['id']};}if(_0x322474[_0xc602('0x3e')]===_0xc602('0x51')){_0x33ad18[_0xc602('0x5f')]={'name':!_['isNil'](_0x322474['Full_Name'])?_0x322474['Full_Name']:!_[_0xc602('0x1b')](_0x322474[_0xc602('0x5d')])?_0x322474['First_Name']+'\x20'+_0x322474[_0xc602('0x5e')]:_0x322474[_0xc602('0x5e')],'id':_0x322474['id']};_0x33ad18[_0xc602('0x60')]=_['startCase'](_0x322474[_0xc602('0x3e')]);}if(_0x6cd26f[_0xc602('0x61')]){_0x33ad18['Call_Duration']=moment[_0xc602('0x62')](parseInt(_0x6cd26f[_0xc602('0x61')])*0x3e8)[_0xc602('0x63')]('mm:ss');}else if(_0x6cd26f[_0xc602('0x64')]&&_0x6cd26f[_0xc602('0x65')]){_0x33ad18[_0xc602('0x66')]=moment[_0xc602('0x62')](moment(_0x6cd26f['endtime'],_0xc602('0x67'))[_0xc602('0x68')](moment(_0x6cd26f[_0xc602('0x69')],_0xc602('0x67'))))[_0xc602('0x63')](_0xc602('0x6a'));}switch(_0x6cd26f['lastevent']){case _0xc602('0x6b'):_0x33ad18['Call_Result']=_0xc602('0x6c');break;case _0xc602('0x6d'):case _0xc602('0x6e'):_0x33ad18[_0xc602('0x6f')]=_0xc602('0x70');break;case _0xc602('0x71'):_0x33ad18[_0xc602('0x6f')]='Rejected';break;case _0xc602('0x72'):_0x33ad18['Call_Result']=_0xc602('0x73');break;default:}_0x33ad18[_0xc602('0x74')]=(_0x10b759===_0xc602('0x75')?moment(_0x6cd26f[_0xc602('0x69')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x6cd26f[_0xc602('0x76')])[_0xc602('0x63')]('YYYY-MM-DDTHH:mm:ss'))||moment()['format'](_0xc602('0x67'));_0x33ad18['Call_Type']=_0x10b759||'Inbound';_0x33ad18=_[_0xc602('0x77')](_0x33ad18,getCustomFields(_0x19eb0c[_0xc602('0x78')],_0x6cd26f));return request({'method':_0xc602('0x22'),'uri':_0xc602('0x4e')+_0x14b959+_0xc602('0x79'),'headers':{'Authorization':_0xc602('0x30')+_0x3caaf9},'body':{'data':[_0x33ad18]},'json':!![]})[_0xc602('0x31')](function(_0x5c4d89){if(_0x5c4d89&&_0x5c4d89['data'][0x0]['code']===_0xc602('0x7a')){logger[_0xc602('0x2b')](_0xc602('0x7b'));return{'id':_0x5c4d89[_0xc602('0x44')][0x0][_0xc602('0x46')]['id']};}})[_0xc602('0x28')](function(_0x306c06){logger[_0xc602('0x2b')](_0xc602('0x7c'),_0x306c06[_0xc602('0x2a')]);console[_0xc602('0x49')]('err',_0x306c06);});}exports[_0xc602('0x7d')]=function(_0x3dec99,_0x16cbf6,_0x510a0a,_0x394efc,_0x2069a3,_0x3e01f4){var _0x4a35fd,_0x16349f,_0x5ddf1b;_0x3e01f4[_0xc602('0x7e')]=intUtil[_0xc602('0x7f')](_0x3e01f4[_0xc602('0x7e')]);_0x3e01f4[_0xc602('0x80')]=intUtil['stripTrailingSlash'](_0x3e01f4[_0xc602('0x80')]);if(_0x2069a3&&_0x2069a3[_0xc602('0x81')]){logger[_0xc602('0x2b')]('[QUEUE]',_0xc602('0x82'));_0x16cbf6[_0xc602('0x83')]=_0x3e01f4['serverUrl']+_0xc602('0x84')+_0x16cbf6[_0xc602('0x85')]+_0xc602('0x86')+md5(_0x16cbf6[_0xc602('0x85')]);}else{_0x16cbf6['recordingURL']='';}var _0x30b6c5=_0x3e01f4[_0xc602('0x7e')]==='zoho.eu'?'eu':_0xc602('0x87');return getAccessToken(_0x3e01f4)['then'](function(_0x1182d1){_0x5ddf1b=_0x1182d1;return getUser(_0x5ddf1b,_0x30b6c5,_0x3e01f4,_0x394efc[_0xc602('0x88')]);})[_0xc602('0x31')](function(_0x47cd9d){_0x4a35fd=_0x47cd9d;logger[_0xc602('0x2b')](_0xc602('0x89'),_0x4a35fd['id']);return getEndUser(_0x5ddf1b,_0x30b6c5,_0x3e01f4,_0x16cbf6['calleridname'],_0x16cbf6[_0xc602('0x8a')],_0x4a35fd,_0x510a0a);})[_0xc602('0x31')](function(_0x28b218){_0x16349f=_0x28b218;return getCall(_0x5ddf1b,_0x30b6c5,_0x3e01f4,_0x4a35fd,_0x16349f,_0x510a0a,_0x16cbf6,_0xc602('0x8b'));})['then'](function(_0x53406e){if(_0x53406e){logger[_0xc602('0x2b')](_0xc602('0x8c'),_0x53406e['id']);logger['info'](_0xc602('0x8d'),_0xc602('0x8e'));emit(util['format']('user:%s',_0x394efc['name']),'trigger:browser:url',{'uri':_0xc602('0x8f')+_0x3e01f4[_0xc602('0x7e')]+_0xc602('0x90')+_0x53406e['id']});}})['catch'](function(_0x1e9d8a){logger[_0xc602('0x3a')]('[QUEUE]',JSON['stringify'](_0x1e9d8a));});};exports[_0xc602('0x75')]=function(_0x2f6117,_0x3f99ab,_0x2f2e47,_0x11f1f8,_0x2f05fb,_0x561c5e,_0x3b45a5){var _0x426adf,_0x12527b,_0x373916;_0x561c5e[_0xc602('0x7e')]=intUtil[_0xc602('0x7f')](_0x561c5e[_0xc602('0x7e')]);_0x561c5e['serverUrl']=intUtil['stripTrailingSlash'](_0x561c5e[_0xc602('0x80')]);if(_0x3b45a5&&_0x3b45a5[_0xc602('0x91')]&&_0x3b45a5[_0xc602('0x91')]!==_0xc602('0x92')){logger[_0xc602('0x2b')]('[OUTBOUND]',_0xc602('0x82'));_0x3f99ab['recordingURL']=_0x561c5e[_0xc602('0x80')]+_0xc602('0x84')+_0x3f99ab[_0xc602('0x85')]+_0xc602('0x86')+md5(_0x3f99ab[_0xc602('0x85')]);}var _0x5ef866=_0x561c5e[_0xc602('0x7e')]==='zoho.eu'?'eu':_0xc602('0x87');return getAccessToken(_0x561c5e)[_0xc602('0x31')](function(_0x1f6cb5){_0x373916=_0x1f6cb5;return getUser(_0x373916,_0x5ef866,_0x561c5e,_0x11f1f8[_0xc602('0x88')]);})[_0xc602('0x31')](function(_0x3705ea){_0x426adf=_0x3705ea;logger[_0xc602('0x2b')](_0xc602('0x89'),_0x426adf['id']);return getEndUser(_0x373916,_0x5ef866,_0x561c5e,_0x3f99ab[_0xc602('0x93')],_0x3f99ab[_0xc602('0x94')],_0x426adf,_0x2f2e47);})[_0xc602('0x31')](function(_0x428244){_0x12527b=_0x428244;return getCall(_0x373916,_0x5ef866,_0x561c5e,_0x426adf,_0x12527b,_0x2f2e47,_0x3f99ab,_0xc602('0x95'));})[_0xc602('0x31')](function(_0x3ee224){if(_0x3ee224){logger['info'](_0xc602('0x8c'),_0x3ee224['id']);logger['info'](_0xc602('0x96'),_0xc602('0x8e'));emit(util['format'](_0xc602('0x97'),_0x11f1f8[_0xc602('0x17')]),_0xc602('0x98'),{'uri':_0xc602('0x8f')+_0x561c5e[_0xc602('0x7e')]+'/crm/EntityInfo.do?module=Calls&id='+_0x3ee224['id']});}})[_0xc602('0x28')](function(_0x57ef8a){logger[_0xc602('0x3a')]('[OUTBOUND]',JSON[_0xc602('0x3b')](_0x57ef8a));});};exports[_0xc602('0x72')]=function(_0x5396d1,_0x4e027a,_0x496f5c,_0x16825b,_0x512ab0,_0x40ce27){var _0x2fd854,_0xa6c714,_0x34d310;_0x40ce27['host']=intUtil[_0xc602('0x7f')](_0x40ce27['host']);_0x40ce27[_0xc602('0x80')]=intUtil[_0xc602('0x7f')](_0x40ce27[_0xc602('0x80')]);if(_0x512ab0&&_0x512ab0[_0xc602('0x81')]){logger[_0xc602('0x2b')](_0xc602('0x99'),'Recording\x20is\x20enabled!');_0x4e027a['recordingURL']=_0x40ce27[_0xc602('0x80')]+_0xc602('0x84')+_0x4e027a[_0xc602('0x85')]+_0xc602('0x86')+md5(_0x4e027a[_0xc602('0x85')]);}else{_0x4e027a[_0xc602('0x83')]='';}var _0x112f64=_0x40ce27[_0xc602('0x7e')]===_0xc602('0x9a')?'eu':_0xc602('0x87');return getAccessToken(_0x40ce27)[_0xc602('0x31')](function(_0x529f7a){_0x34d310=_0x529f7a;return getUser(_0x34d310,_0x112f64,_0x40ce27);})[_0xc602('0x31')](function(_0x3a03a8){_0x2fd854=_0x3a03a8;logger[_0xc602('0x2b')](_0xc602('0x89'),_0x2fd854['id']);return getEndUser(_0x34d310,_0x112f64,_0x40ce27,_0x4e027a[_0xc602('0x9b')],_0x4e027a['calleridnum'],_0x2fd854,_0x496f5c);})[_0xc602('0x31')](function(_0x521aaa){_0xa6c714=_0x521aaa;return getCall(_0x34d310,_0x112f64,_0x40ce27,_0x2fd854,_0xa6c714,_0x496f5c,_0x4e027a,_0xc602('0x8b'));})[_0xc602('0x31')](function(_0x5ee21f){if(_0x5ee21f){logger[_0xc602('0x2b')](_0xc602('0x8c'),_0x5ee21f['id']);}})[_0xc602('0x28')](function(_0x1343ca){logger[_0xc602('0x3a')](_0xc602('0x99'),JSON[_0xc602('0x3b')](_0x1343ca));});}; \ 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 c221bb7..f61fe95 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(_0xd464d9,_0x46b9cf){var _0x227159=function(_0x4c4b41){while(--_0x4c4b41){_0xd464d9['push'](_0xd464d9['shift']());}};_0x227159(++_0x46b9cf);}(_0x7a54,0x106));var _0x47a5=function(_0x51b4a8,_0x4567d3){_0x51b4a8=_0x51b4a8-0x0;var _0x42e736=_0x7a54[_0x51b4a8];return _0x42e736;};'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(_0x33f0a8,_0x4fd51c){var _0x5e7333=function(_0x13137b){while(--_0x13137b){_0x33f0a8['push'](_0x33f0a8['shift']());}};_0x5e7333(++_0x4fd51c);}(_0x7a54,0x106));var _0x47a5=function(_0x5aba63,_0x5d5944){_0x5aba63=_0x5aba63-0x0;var _0x39000a=_0x7a54[_0x5aba63];return _0x39000a;};'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 8993dfe..0a2bda9 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(_0x1f5df1,_0x4afab0){var _0x478afd=function(_0x4547f6){while(--_0x4547f6){_0x1f5df1['push'](_0x1f5df1['shift']());}};_0x478afd(++_0x4afab0);}(_0x5f2f,0x73));var _0xf5f2=function(_0xf075f1,_0x5da3d8){_0xf075f1=_0xf075f1-0x0;var _0x2b1de1=_0x5f2f[_0xf075f1];return _0x2b1de1;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file +var _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x30d4b8,_0x3317b0){var _0x542de5=function(_0x5a1d3c){while(--_0x5a1d3c){_0x30d4b8['push'](_0x30d4b8['shift']());}};_0x542de5(++_0x3317b0);}(_0x7a54,0x106));var _0x47a5=function(_0x1b1ba2,_0x5596f3){_0x1b1ba2=_0x1b1ba2-0x0;var _0x2c3729=_0x7a54[_0x1b1ba2];return _0x2c3729;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 7a1c8d5..cb5d898 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 _0xb26e=['request','then','debug','rpc','routing','error','message','result','exports','jayson/promise','client','http'];(function(_0x2c7e3a,_0x2bc717){var _0x5e542f=function(_0x27cf7c){while(--_0x27cf7c){_0x2c7e3a['push'](_0x2c7e3a['shift']());}};_0x5e542f(++_0x2bc717);}(_0xb26e,0x11d));var _0xeb26=function(_0x55dbd0,_0x341a80){_0x55dbd0=_0x55dbd0-0x0;var _0xda1a93=_0xb26e[_0x55dbd0];return _0xda1a93;};'use strict';var jayson=require(_0xeb26('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('routing');var client=jayson[_0xeb26('0x1')][_0xeb26('0x2')]({'port':0x2329});client['Request']=function(_0x3bdbef,_0x3b8a6f){return new BPromise(function(_0x2817de,_0x3ec03a){return client[_0xeb26('0x3')](_0x3bdbef,_0x3b8a6f)[_0xeb26('0x4')](function(_0x2351f9){logger[_0xeb26('0x5')](_0xeb26('0x6'),_0xeb26('0x7'),_0x3bdbef,_0x3b8a6f,_0x2351f9);if(_0x2351f9[_0xeb26('0x8')]){logger[_0xeb26('0x8')](_0xeb26('0x6'),'routing',_0x3bdbef,_0x2351f9[_0xeb26('0x8')]['message'],_0x3b8a6f);return _0x3ec03a(_0x2351f9['error'][_0xeb26('0x9')]);}else{return _0x2817de(_0x2351f9[_0xeb26('0xa')]);}})['catch'](function(_0x3bcb40){logger['error'](_0xeb26('0x6'),_0xeb26('0x7'),_0x3bdbef,_0x3bcb40,_0x3b8a6f);return _0x3ec03a(_0x3bcb40);});});};module[_0xeb26('0xb')]=client; \ No newline at end of file +var _0x4f5a=['message','catch','jayson/promise','bluebird','routing','request','rpc','error'];(function(_0x3d1bce,_0x1e6c34){var _0x2b89ee=function(_0x3ccc13){while(--_0x3ccc13){_0x3d1bce['push'](_0x3d1bce['shift']());}};_0x2b89ee(++_0x1e6c34);}(_0x4f5a,0xaa));var _0xa4f5=function(_0xe31f88,_0x104adb){_0xe31f88=_0xe31f88-0x0;var _0x4dd4f6=_0x4f5a[_0xe31f88];return _0x4dd4f6;};'use strict';var jayson=require(_0xa4f5('0x0'));var BPromise=require(_0xa4f5('0x1'));var logger=require('../../config/logger')(_0xa4f5('0x2'));var client=jayson['client']['http']({'port':0x2329});client['Request']=function(_0x59a630,_0x230b40){return new BPromise(function(_0x200782,_0x5a9dd3){return client[_0xa4f5('0x3')](_0x59a630,_0x230b40)['then'](function(_0x4effa5){logger['debug'](_0xa4f5('0x4'),_0xa4f5('0x2'),_0x59a630,_0x230b40,_0x4effa5);if(_0x4effa5[_0xa4f5('0x5')]){logger[_0xa4f5('0x5')](_0xa4f5('0x4'),'routing',_0x59a630,_0x4effa5[_0xa4f5('0x5')]['message'],_0x230b40);return _0x5a9dd3(_0x4effa5['error'][_0xa4f5('0x6')]);}else{return _0x200782(_0x4effa5['result']);}})[_0xa4f5('0x7')](function(_0x2266c0){logger[_0xa4f5('0x5')](_0xa4f5('0x4'),_0xa4f5('0x2'),_0x59a630,_0x2266c0,_0x230b40);return _0x5a9dd3(_0x2266c0);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 148fcfa..ac5a9a3 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 _0x29d4=['log','bluebird','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','getMailAccounts','then','initMailAccounts','refresh','mailAccounts','listen','Setting','findOne','loginMailFrequency'];(function(_0x19962f,_0xd2d429){var _0x113ed5=function(_0x55c61a){while(--_0x55c61a){_0x19962f['push'](_0x19962f['shift']());}};_0x113ed5(++_0xd2d429);}(_0x29d4,0x1a1));var _0x429d=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x29d4[_0x5317b5];return _0x3b7ce2;};'use strict';var BPromise=require(_0x429d('0x0'));var server=require('./server');var Realtime=require(_0x429d('0x1'));var EmailChannel=require(_0x429d('0x2'));var mailAccount=require(_0x429d('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x429d('0x4'))['db'];function initRealtime(){return BPromise[_0x429d('0x5')]()['then'](mailAccount[_0x429d('0x6')]())[_0x429d('0x7')](realtime[_0x429d('0x8')]())[_0x429d('0x7')](function(){email[_0x429d('0x9')](realtime[_0x429d('0xa')]);return realtime;});}function main(){return server[_0x429d('0xb')](realtime,email)[_0x429d('0x7')](function(_0x4befb9){return initRealtime();})[_0x429d('0x7')](function(_0x47cb29){return db[_0x429d('0xc')][_0x429d('0xd')]({'attributes':['id',_0x429d('0xe')],'raw':!![]});})['then'](function(_0x1f9b3e){return setInterval(initRealtime,_0x1f9b3e[_0x429d('0xe')]*0x3e8);})['catch'](function(_0x31ff87){console[_0x429d('0xf')](_0x31ff87);});}main(); \ No newline at end of file +var _0x7d9f=['loginMailFrequency','catch','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','resolve','then','getMailAccounts','initMailAccounts','mailAccounts','listen','Setting'];(function(_0x1face7,_0x370945){var _0x1b9771=function(_0x4c7407){while(--_0x4c7407){_0x1face7['push'](_0x1face7['shift']());}};_0x1b9771(++_0x370945);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x1aa0e7,_0x498fbd){_0x1aa0e7=_0x1aa0e7-0x0;var _0x55f771=_0x7d9f[_0x1aa0e7];return _0x55f771;};'use strict';var BPromise=require(_0xf7d9('0x0'));var server=require(_0xf7d9('0x1'));var Realtime=require(_0xf7d9('0x2'));var EmailChannel=require(_0xf7d9('0x3'));var mailAccount=require(_0xf7d9('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise[_0xf7d9('0x5')]()[_0xf7d9('0x6')](mailAccount[_0xf7d9('0x7')]())[_0xf7d9('0x6')](realtime[_0xf7d9('0x8')]())['then'](function(){email['refresh'](realtime[_0xf7d9('0x9')]);return realtime;});}function main(){return server[_0xf7d9('0xa')](realtime,email)['then'](function(_0x21c654){return initRealtime();})[_0xf7d9('0x6')](function(_0x5e4087){return db[_0xf7d9('0xb')]['findOne']({'attributes':['id',_0xf7d9('0xc')],'raw':!![]});})[_0xf7d9('0x6')](function(_0x5d2735){return setInterval(initRealtime,_0x5d2735['loginMailFrequency']*0x3e8);})[_0xf7d9('0xd')](function(_0x90a7f9){console[_0xf7d9('0xe')](_0x90a7f9);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index ca49af0..a789b83 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 _0x99e1=['socket.io-emitter','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','total','stringify','mailAccount:update','refresh','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','handleImapEnd','error','handleImapError','isNil','disabled','connected','messageStatus','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','catch','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','localhost'];(function(_0x28e78f,_0x5ed78d){var _0x145c9a=function(_0x1c8de3){while(--_0x1c8de3){_0x28e78f['push'](_0x28e78f['shift']());}};_0x145c9a(++_0x5ed78d);}(_0x99e1,0x178));var _0x199e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x99e1[_0x5b78e8];return _0xf2c321;};'use strict';var _=require('lodash');var moment=require(_0x199e('0x0'));var BPromise=require(_0x199e('0x1'));var md5=require(_0x199e('0x2'));var Redis=require(_0x199e('0x3'));var config=require(_0x199e('0x4'));var logger=require(_0x199e('0x5'))(_0x199e('0x6'));config[_0x199e('0x7')]=_['defaults'](config[_0x199e('0x7')],{'host':_0x199e('0x8'),'port':0x18eb});var io=require(_0x199e('0x9'))(new Redis(config[_0x199e('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x199e('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x585e7d){logger[_0x199e('0xb')](_0x199e('0xc'));this[_0x199e('0xd')]=_0x585e7d[_0x199e('0xd')];this[_0x199e('0xe')]={};this[_0x199e('0xf')]=new EmailSmtp();}EmailChannel[_0x199e('0x10')][_0x199e('0x11')]=function(_0x4713b6){var _0x1972c7=this[_0x199e('0xd')][_0x4713b6];var _0x1c6aee={'id':_0x1972c7['id'],'name':_0x1972c7[_0x199e('0x12')],'key':_0x1972c7[_0x199e('0x13')],'active':_0x1972c7[_0x199e('0x14')],'Imap':{'status':_0x1972c7[_0x199e('0x15')][_0x199e('0x16')],'messageStatus':_0x1972c7[_0x199e('0x15')]['messageStatus'],'total':_0x1972c7[_0x199e('0x15')][_0x199e('0x17')]}};if(_['isNil'](md5Accounts[_0x4713b6])){md5Accounts[_0x4713b6]={};}var _0x21a309=md5(JSON[_0x199e('0x18')](_0x1c6aee));if(md5Accounts[_0x4713b6][_0x199e('0x2')]!==_0x21a309){md5Accounts[_0x4713b6][_0x199e('0x2')]=_0x21a309;io[_0x199e('0x11')](_0x199e('0x19'),_0x1c6aee);}};EmailChannel[_0x199e('0x10')][_0x199e('0x1a')]=function(_0x2fc8c3){for(var _0xe8a898 in _0x2fc8c3){if(_0x2fc8c3[_0x199e('0x1b')](_0xe8a898)){if(_0x2fc8c3[_0xe8a898][_0x199e('0x15')]&&_0x2fc8c3[_0xe8a898][_0x199e('0x14')]){var _0x3c61ef=_0x2fc8c3[_0xe8a898][_0x199e('0x15')];if(!this[_0x199e('0xe')]['hasOwnProperty'](_0x3c61ef['id'])){this[_0x199e('0xe')][_0x3c61ef['id']]=new EmailImap(_0x3c61ef,_0x2fc8c3[_0xe8a898][_0x199e('0x6')]);this[_0x199e('0xe')][_0x3c61ef['id']]['on'](_0x199e('0x1c'),this[_0x199e('0x1d')][_0x199e('0x1e')](this,_0xe8a898));this[_0x199e('0xe')][_0x3c61ef['id']]['on'](_0x199e('0x6'),this[_0x199e('0x1f')][_0x199e('0x1e')](this,_0xe8a898));this[_0x199e('0xe')][_0x3c61ef['id']]['on']('end',this[_0x199e('0x20')][_0x199e('0x1e')](this,_0xe8a898));this['imapAccounts'][_0x3c61ef['id']]['on'](_0x199e('0x21'),this[_0x199e('0x22')][_0x199e('0x1e')](this,_0xe8a898));}}else{if(_[_0x199e('0x23')](this['mailAccounts'][_0xe8a898][_0x199e('0x15')])){this[_0x199e('0xd')][_0xe8a898][_0x199e('0x15')]={};}this['mailAccounts'][_0xe8a898][_0x199e('0x15')][_0x199e('0x16')]=_0x199e('0x24');this[_0x199e('0xd')][_0xe8a898]['Imap']['messageStatus']='';this[_0x199e('0x11')](_0xe8a898);}}}};EmailChannel[_0x199e('0x10')][_0x199e('0x1d')]=function(_0x5d043c,_0x2e0d28){if(this['mailAccounts'][_0x5d043c]){this[_0x199e('0xd')][_0x5d043c][_0x199e('0x15')][_0x199e('0x16')]=_0x199e('0x25');this['mailAccounts'][_0x5d043c]['Imap'][_0x199e('0x26')]=_0x2e0d28[_0x199e('0x12')];if(_0x2e0d28[_0x199e('0x27')]){this[_0x199e('0xd')][_0x5d043c][_0x199e('0x15')][_0x199e('0x17')]=_0x2e0d28[_0x199e('0x27')][_0x199e('0x17')];}return this[_0x199e('0x11')](_0x5d043c);}};EmailChannel[_0x199e('0x10')]['handleImapEmail']=function(_0x135a0e,_0x47f358){logger['info'](_0x199e('0x28'),_0x47f358[_0x199e('0x29')],_0x47f358['lastName'],_0x47f358[_0x199e('0x2a')],_0x135a0e);if(this[_0x199e('0xd')][_0x135a0e]){return mailAccount[_0x199e('0x2b')](_0x135a0e,_0x47f358)[_0x199e('0x2c')](function(_0x59d371){if(_0x59d371){logger[_0x199e('0xb')](_0x199e('0x2d'));}})['catch'](function(_0x313ff5){logger[_0x199e('0x21')](_0x199e('0x2e'),JSON[_0x199e('0x18')](_0x313ff5));});}};EmailChannel[_0x199e('0x10')]['handleImapEnd']=function(_0x222f04){if(this[_0x199e('0xd')][_0x222f04]&&this[_0x199e('0xd')][_0x222f04][_0x199e('0x15')]){if(this['imapAccounts'][this[_0x199e('0xd')][_0x222f04][_0x199e('0x15')]['id']]){delete this['imapAccounts'][this[_0x199e('0xd')][_0x222f04][_0x199e('0x15')]['id']];}this[_0x199e('0xd')][_0x222f04][_0x199e('0x15')][_0x199e('0x2f')]=moment();this[_0x199e('0x11')](_0x222f04);}};EmailChannel[_0x199e('0x10')]['handleImapError']=function(_0x1d0cc2,_0x9c0009){if(this[_0x199e('0xd')][_0x1d0cc2]){this['mailAccounts'][_0x1d0cc2]['Imap'][_0x199e('0x16')]=_0x199e('0x21');this[_0x199e('0xd')][_0x1d0cc2][_0x199e('0x15')][_0x199e('0x26')]=_0x9c0009;return this[_0x199e('0x11')](_0x1d0cc2);}};EmailChannel[_0x199e('0x10')][_0x199e('0x30')]=function(_0x16390b,_0x49a1d9){return this[_0x199e('0xf')][_0x199e('0x31')](_0x16390b,_0x49a1d9);};EmailChannel[_0x199e('0x10')][_0x199e('0x32')]=function(_0x26f974){var _0x1b38e8=this;if(this[_0x199e('0xd')][_0x26f974['id']]){if(_[_0x199e('0x23')](this['mailAccounts'][_0x26f974['id']][_0x199e('0x33')])){this['mailAccounts'][_0x26f974['id']][_0x199e('0x33')]={};}this[_0x199e('0xd')][_0x26f974['id']][_0x199e('0x33')]['lastSync']=moment();return new BPromise(function(_0x43cc51,_0x177e4a){return _0x1b38e8[_0x199e('0xf')][_0x199e('0x34')](_0x26f974)['then'](function(_0x132e70){_0x1b38e8[_0x199e('0xd')][_0x26f974['id']][_0x199e('0x33')][_0x199e('0x16')]=_0x199e('0x35');_0x1b38e8[_0x199e('0xd')][_0x26f974['id']][_0x199e('0x33')][_0x199e('0x26')]='';_0x1b38e8[_0x199e('0x11')](_0x26f974['id']);_0x43cc51(_0x132e70);})[_0x199e('0x36')](function(_0x386fe9){_0x1b38e8[_0x199e('0xd')][_0x26f974['id']][_0x199e('0x33')][_0x199e('0x16')]='error';_0x1b38e8[_0x199e('0xd')][_0x26f974['id']][_0x199e('0x33')]['messageStatus']=_0x386fe9;_0x1b38e8['emit'](_0x26f974['id']);_0x177e4a(_0x386fe9);});});}return this[_0x199e('0xf')]['verify'](_0x26f974);};module['exports']=EmailChannel; \ No newline at end of file +var _0xf8de=['Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','send','verifySmtp','isNil','Smtp','lastSync','verify','then','verified','catch','exports','lodash','moment','bluebird','md5','../../../config/environment','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','key','active','status','messageStatus','Imap','total','stringify','refresh','hasOwnProperty','imapAccounts','handleImapBox','bind','email','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify'];(function(_0x3fd1df,_0x3f536b){var _0x279121=function(_0x547bed){while(--_0x547bed){_0x3fd1df['push'](_0x3fd1df['shift']());}};_0x279121(++_0x3f536b);}(_0xf8de,0xb5));var _0xef8d=function(_0x16600d,_0x51c08c){_0x16600d=_0x16600d-0x0;var _0x2d9f72=_0xf8de[_0x16600d];return _0x2d9f72;};'use strict';var _=require(_0xef8d('0x0'));var moment=require(_0xef8d('0x1'));var BPromise=require(_0xef8d('0x2'));var md5=require(_0xef8d('0x3'));var Redis=require('ioredis');var config=require(_0xef8d('0x4'));var logger=require('../../../config/logger')('email');config[_0xef8d('0x5')]=_[_0xef8d('0x6')](config[_0xef8d('0x5')],{'host':_0xef8d('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xef8d('0x5')]));var EmailImap=require(_0xef8d('0x8'));var EmailSmtp=require(_0xef8d('0x9'));var mailAccount=require(_0xef8d('0xa'));var md5Accounts={};function EmailChannel(_0x45d8a1){logger[_0xef8d('0xb')](_0xef8d('0xc'));this[_0xef8d('0xd')]=_0x45d8a1[_0xef8d('0xd')];this['imapAccounts']={};this[_0xef8d('0xe')]=new EmailSmtp();}EmailChannel[_0xef8d('0xf')][_0xef8d('0x10')]=function(_0x54c96b){var _0x47621d=this[_0xef8d('0xd')][_0x54c96b];var _0x493908={'id':_0x47621d['id'],'name':_0x47621d[_0xef8d('0x11')],'key':_0x47621d[_0xef8d('0x12')],'active':_0x47621d[_0xef8d('0x13')],'Imap':{'status':_0x47621d['Imap'][_0xef8d('0x14')],'messageStatus':_0x47621d['Imap'][_0xef8d('0x15')],'total':_0x47621d[_0xef8d('0x16')][_0xef8d('0x17')]}};if(_['isNil'](md5Accounts[_0x54c96b])){md5Accounts[_0x54c96b]={};}var _0x27431a=md5(JSON[_0xef8d('0x18')](_0x493908));if(md5Accounts[_0x54c96b][_0xef8d('0x3')]!==_0x27431a){md5Accounts[_0x54c96b][_0xef8d('0x3')]=_0x27431a;io[_0xef8d('0x10')]('mailAccount:update',_0x493908);}};EmailChannel[_0xef8d('0xf')][_0xef8d('0x19')]=function(_0x2f9ffd){for(var _0x5ff92f in _0x2f9ffd){if(_0x2f9ffd[_0xef8d('0x1a')](_0x5ff92f)){if(_0x2f9ffd[_0x5ff92f]['Imap']&&_0x2f9ffd[_0x5ff92f][_0xef8d('0x13')]){var _0x385838=_0x2f9ffd[_0x5ff92f][_0xef8d('0x16')];if(!this[_0xef8d('0x1b')][_0xef8d('0x1a')](_0x385838['id'])){this[_0xef8d('0x1b')][_0x385838['id']]=new EmailImap(_0x385838,_0x2f9ffd[_0x5ff92f]['email']);this[_0xef8d('0x1b')][_0x385838['id']]['on']('box',this[_0xef8d('0x1c')][_0xef8d('0x1d')](this,_0x5ff92f));this[_0xef8d('0x1b')][_0x385838['id']]['on'](_0xef8d('0x1e'),this[_0xef8d('0x1f')][_0xef8d('0x1d')](this,_0x5ff92f));this['imapAccounts'][_0x385838['id']]['on'](_0xef8d('0x20'),this[_0xef8d('0x21')][_0xef8d('0x1d')](this,_0x5ff92f));this[_0xef8d('0x1b')][_0x385838['id']]['on'](_0xef8d('0x22'),this[_0xef8d('0x23')][_0xef8d('0x1d')](this,_0x5ff92f));}}else{if(_['isNil'](this[_0xef8d('0xd')][_0x5ff92f]['Imap'])){this[_0xef8d('0xd')][_0x5ff92f][_0xef8d('0x16')]={};}this['mailAccounts'][_0x5ff92f][_0xef8d('0x16')][_0xef8d('0x14')]=_0xef8d('0x24');this['mailAccounts'][_0x5ff92f][_0xef8d('0x16')][_0xef8d('0x15')]='';this['emit'](_0x5ff92f);}}}};EmailChannel[_0xef8d('0xf')]['handleImapBox']=function(_0x29a82d,_0x41e931){if(this[_0xef8d('0xd')][_0x29a82d]){this[_0xef8d('0xd')][_0x29a82d]['Imap'][_0xef8d('0x14')]=_0xef8d('0x25');this[_0xef8d('0xd')][_0x29a82d]['Imap'][_0xef8d('0x15')]=_0x41e931[_0xef8d('0x11')];if(_0x41e931[_0xef8d('0x26')]){this[_0xef8d('0xd')][_0x29a82d]['Imap']['total']=_0x41e931[_0xef8d('0x26')]['total'];}return this['emit'](_0x29a82d);}};EmailChannel[_0xef8d('0xf')]['handleImapEmail']=function(_0x1b6a4a,_0x16d0ba){logger['info'](_0xef8d('0x27'),_0x16d0ba[_0xef8d('0x28')],_0x16d0ba['lastName'],_0x16d0ba[_0xef8d('0x29')],_0x1b6a4a);if(this[_0xef8d('0xd')][_0x1b6a4a]){return mailAccount[_0xef8d('0x2a')](_0x1b6a4a,_0x16d0ba)['then'](function(_0x9ce178){if(_0x9ce178){logger['info'](_0xef8d('0x2b'));}})['catch'](function(_0x2300b1){logger[_0xef8d('0x22')](_0xef8d('0x2c'),JSON[_0xef8d('0x18')](_0x2300b1));});}};EmailChannel[_0xef8d('0xf')]['handleImapEnd']=function(_0x24874a){if(this[_0xef8d('0xd')][_0x24874a]&&this[_0xef8d('0xd')][_0x24874a][_0xef8d('0x16')]){if(this[_0xef8d('0x1b')][this['mailAccounts'][_0x24874a][_0xef8d('0x16')]['id']]){delete this[_0xef8d('0x1b')][this[_0xef8d('0xd')][_0x24874a][_0xef8d('0x16')]['id']];}this[_0xef8d('0xd')][_0x24874a][_0xef8d('0x16')]['lastSync']=moment();this[_0xef8d('0x10')](_0x24874a);}};EmailChannel['prototype'][_0xef8d('0x23')]=function(_0x1bec97,_0x3ccec7){if(this['mailAccounts'][_0x1bec97]){this[_0xef8d('0xd')][_0x1bec97]['Imap']['status']=_0xef8d('0x22');this[_0xef8d('0xd')][_0x1bec97][_0xef8d('0x16')][_0xef8d('0x15')]=_0x3ccec7;return this[_0xef8d('0x10')](_0x1bec97);}};EmailChannel[_0xef8d('0xf')][_0xef8d('0x2d')]=function(_0x3185b0,_0x1c70f9){return this[_0xef8d('0xe')][_0xef8d('0x2e')](_0x3185b0,_0x1c70f9);};EmailChannel['prototype'][_0xef8d('0x2f')]=function(_0x99a84){var _0x161e2e=this;if(this['mailAccounts'][_0x99a84['id']]){if(_[_0xef8d('0x30')](this[_0xef8d('0xd')][_0x99a84['id']][_0xef8d('0x31')])){this[_0xef8d('0xd')][_0x99a84['id']][_0xef8d('0x31')]={};}this[_0xef8d('0xd')][_0x99a84['id']][_0xef8d('0x31')][_0xef8d('0x32')]=moment();return new BPromise(function(_0x1ac8e5,_0x52bf69){return _0x161e2e[_0xef8d('0xe')][_0xef8d('0x33')](_0x99a84)[_0xef8d('0x34')](function(_0x1c3910){_0x161e2e[_0xef8d('0xd')][_0x99a84['id']]['Smtp']['status']=_0xef8d('0x35');_0x161e2e[_0xef8d('0xd')][_0x99a84['id']]['Smtp'][_0xef8d('0x15')]='';_0x161e2e[_0xef8d('0x10')](_0x99a84['id']);_0x1ac8e5(_0x1c3910);})[_0xef8d('0x36')](function(_0x4ce3f3){_0x161e2e[_0xef8d('0xd')][_0x99a84['id']][_0xef8d('0x31')][_0xef8d('0x14')]='error';_0x161e2e[_0xef8d('0xd')][_0x99a84['id']][_0xef8d('0x31')][_0xef8d('0x15')]=_0x4ce3f3;_0x161e2e[_0xef8d('0x10')](_0x99a84['id']);_0x52bf69(_0x4ce3f3);});});}return this[_0xef8d('0xe')][_0xef8d('0x33')](_0x99a84);};module[_0xef8d('0x37')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index e160426..7845952 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 _0x22a8=['handleError','bind','connect','connTimeout','authTimeout','authentication','user','password','host','port','tls','autotls','required','getHost','service','anonymous@xcally.com','prototype','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','end','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','path','util','imap','lodash','randomstring','mailparser','simpleParser','Iconv','events','EventEmitter','email','mailbox','INBOX','account','getAccount','once','ready','handleReady','handleEnd','error'];(function(_0x36fbef,_0x4ffc84){var _0x45e270=function(_0x32dd95){while(--_0x32dd95){_0x36fbef['push'](_0x36fbef['shift']());}};_0x45e270(++_0x4ffc84);}(_0x22a8,0x6e));var _0x822a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x22a8[_0x40a045];return _0x1a687c;};'use strict';var fs=require('fs');var path=require(_0x822a('0x0'));var util=require(_0x822a('0x1'));var Imap=require(_0x822a('0x2'));var _=require(_0x822a('0x3'));var rs=require(_0x822a('0x4'));var simpleParser=require(_0x822a('0x5'))[_0x822a('0x6')];var Iconv=require('iconv')[_0x822a('0x7')];var EventEmitter=require(_0x822a('0x8'))[_0x822a('0x9')];var utils=require('./utils');var logger=require('../../../config/logger')(_0x822a('0xa'));function EmailImap(_0x1effe4,_0x11edc8){this[_0x822a('0xb')]=_0x822a('0xc');this[_0x822a('0xd')]=this[_0x822a('0xe')](_0x1effe4,_0x11edc8);this[_0x822a('0x2')]=new Imap(this[_0x822a('0xd')]);this[_0x822a('0x2')][_0x822a('0xf')](_0x822a('0x10'),this[_0x822a('0x11')]['bind'](this));this['imap'][_0x822a('0xf')]('end',this[_0x822a('0x12')]['bind'](this));this[_0x822a('0x2')]['on'](_0x822a('0x13'),this[_0x822a('0x14')][_0x822a('0x15')](this));this[_0x822a('0x2')][_0x822a('0x16')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x400665,_0x69b9a8){var _0x450abd={'connTimeout':_0x400665['connTimeout']?_0x400665[_0x822a('0x17')]*0x3e8:0x2710,'authTimeout':_0x400665[_0x822a('0x18')]?_0x400665['authTimeout']*0x3e8:0x1388};if(_['isNil'](_0x400665['service'])){if(_0x400665[_0x822a('0x19')]){_0x450abd[_0x822a('0x1a')]=_0x400665['user'];_0x450abd[_0x822a('0x1b')]=_0x400665[_0x822a('0x1b')];}_0x450abd[_0x822a('0x1c')]=_0x400665[_0x822a('0x1c')];_0x450abd[_0x822a('0x1d')]=_0x400665[_0x822a('0x1d')]||0x3e1;if(_0x400665['tls']){_0x450abd[_0x822a('0x1e')]=!![];}else{_0x450abd[_0x822a('0x1e')]=![];_0x450abd[_0x822a('0x1f')]=_0x822a('0x20');}}else{_0x450abd[_0x822a('0x1a')]=_0x400665[_0x822a('0x1a')];_0x450abd['password']=_0x400665['password'];_0x450abd[_0x822a('0x1c')]=utils[_0x822a('0x21')](_0x400665[_0x822a('0x22')]);_0x450abd[_0x822a('0x1d')]=0x3e1;_0x450abd['tls']=!![];}_0x450abd['email']=_0x69b9a8||_0x400665['user']||_0x822a('0x23');return _0x450abd;};EmailImap[_0x822a('0x24')][_0x822a('0x11')]=function(){this[_0x822a('0x2')][_0x822a('0x25')](this['mailbox'],![],this[_0x822a('0x26')][_0x822a('0x15')](this));};EmailImap[_0x822a('0x24')][_0x822a('0x26')]=function(_0x20fa8a,_0x5ed923){if(_0x20fa8a){this[_0x822a('0x14')](_0x20fa8a,!![]);}else{this[_0x822a('0x27')](_0x822a('0x28'),_0x5ed923);this[_0x822a('0x29')]();}};EmailImap[_0x822a('0x24')][_0x822a('0x2a')]=function(_0x3a7881){if(_0x3a7881){this[_0x822a('0x14')](_0x3a7881,!![]);}else{this[_0x822a('0x2')]['end']();}};EmailImap[_0x822a('0x24')][_0x822a('0x29')]=function(){this['imap'][_0x822a('0x2b')]([_0x822a('0x2c')],this[_0x822a('0x2d')][_0x822a('0x15')](this));};EmailImap[_0x822a('0x24')][_0x822a('0x2d')]=function(_0x501062,_0x572606){if(_0x501062){this[_0x822a('0x14')](_0x501062,!![]);}else{if(_0x572606[_0x822a('0x2e')]){try{var _0x136240=this[_0x822a('0x2')][_0x822a('0x2f')](_0x572606,{'bodies':'','markSeen':!![]});_0x136240['on'](_0x822a('0x30'),this[_0x822a('0x31')][_0x822a('0x15')](this));_0x136240[_0x822a('0xf')]('error',this[_0x822a('0x32')][_0x822a('0x15')](this));_0x136240[_0x822a('0xf')](_0x822a('0x33'),this[_0x822a('0x34')][_0x822a('0x15')](this));}catch(_0xc697a5){logger['error'](_0xc697a5);}}else{this['imap'][_0x822a('0x35')](!![],this[_0x822a('0x2a')][_0x822a('0x15')](this));}}};EmailImap[_0x822a('0x24')][_0x822a('0x31')]=function(_0x1d8889,_0x595735){_0x1d8889['on'](_0x822a('0x36'),this[_0x822a('0x37')][_0x822a('0x15')](this));_0x1d8889[_0x822a('0xf')](_0x822a('0x38'),this[_0x822a('0x39')][_0x822a('0x15')](this));_0x1d8889[_0x822a('0xf')](_0x822a('0x33'),this[_0x822a('0x3a')]['bind'](this));};EmailImap[_0x822a('0x24')][_0x822a('0x37')]=function(_0x24d66f,_0xb8fba8){simpleParser(_0x24d66f,{'Iconv':Iconv},this[_0x822a('0x3b')][_0x822a('0x15')](this));};EmailImap[_0x822a('0x24')][_0x822a('0x39')]=function(_0x4274c2){};EmailImap[_0x822a('0x24')][_0x822a('0x3a')]=function(){};EmailImap[_0x822a('0x24')][_0x822a('0x3b')]=function(_0x1cc9e3,_0x5e9c7c){if(_0x1cc9e3){logger[_0x822a('0x13')](_0x1cc9e3);}else{var _0xae52e1=this;utils[_0x822a('0x3c')](this[_0x822a('0xd')],_0x5e9c7c,function(_0x3e083a){_0xae52e1[_0x822a('0x27')](_0x822a('0xa'),_0x3e083a);});}};EmailImap[_0x822a('0x24')]['handleFetchEnd']=function(){this[_0x822a('0x2')][_0x822a('0x35')](!![],this['handleCloseBox'][_0x822a('0x15')](this));};EmailImap[_0x822a('0x24')][_0x822a('0x32')]=function(_0x379b6c){this[_0x822a('0x14')](_0x379b6c);this['imap'][_0x822a('0x35')](!![],this[_0x822a('0x2a')][_0x822a('0x15')](this));};EmailImap[_0x822a('0x24')][_0x822a('0x12')]=function(){this[_0x822a('0x27')]('end');};EmailImap[_0x822a('0x24')][_0x822a('0x14')]=function(_0x3c3285,_0x40f0a9){logger[_0x822a('0x13')](_0x822a('0x14'),this[_0x822a('0xd')][_0x822a('0xa')],JSON[_0x822a('0x3d')](_0x3c3285));var _0x294567='';if(_0x3c3285){if(_0x3c3285[_0x822a('0x3e')]){_0x294567=_0x3c3285[_0x822a('0x3e')];}else{for(var _0x1f8a99 in _0x3c3285){if(_0x3c3285[_0x822a('0x3f')](_0x1f8a99)){_0x294567+=_[_0x822a('0x40')](_0x1f8a99)+':\x20'+_0x3c3285[_0x1f8a99]+'\x0a';}}}}if(_0x40f0a9){this[_0x822a('0x2')][_0x822a('0x33')]();}else{this[_0x822a('0x27')](_0x822a('0x13'),_0x294567);this[_0x822a('0x27')](_0x822a('0x33'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x9826=['authTimeout','isNil','service','user','password','host','port','tls','autotls','getHost','openBox','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','stringify','textCode','hasOwnProperty','exports','path','util','imap','lodash','randomstring','mailparser','simpleParser','Iconv','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','once','end','handleEnd','bind','error','handleError','inherits','prototype','connTimeout'];(function(_0x5a26f5,_0x196300){var _0x2e9ef7=function(_0x593736){while(--_0x593736){_0x5a26f5['push'](_0x5a26f5['shift']());}};_0x2e9ef7(++_0x196300);}(_0x9826,0x9b));var _0x6982=function(_0x505598,_0x479db5){_0x505598=_0x505598-0x0;var _0x140049=_0x9826[_0x505598];return _0x140049;};'use strict';var fs=require('fs');var path=require(_0x6982('0x0'));var util=require(_0x6982('0x1'));var Imap=require(_0x6982('0x2'));var _=require(_0x6982('0x3'));var rs=require(_0x6982('0x4'));var simpleParser=require(_0x6982('0x5'))[_0x6982('0x6')];var Iconv=require('iconv')[_0x6982('0x7')];var EventEmitter=require('events')[_0x6982('0x8')];var utils=require(_0x6982('0x9'));var logger=require(_0x6982('0xa'))(_0x6982('0xb'));function EmailImap(_0x4d7eae,_0x40b766){this[_0x6982('0xc')]=_0x6982('0xd');this[_0x6982('0xe')]=this[_0x6982('0xf')](_0x4d7eae,_0x40b766);this[_0x6982('0x2')]=new Imap(this[_0x6982('0xe')]);this[_0x6982('0x2')][_0x6982('0x10')]('ready',this['handleReady']['bind'](this));this['imap']['once'](_0x6982('0x11'),this[_0x6982('0x12')][_0x6982('0x13')](this));this[_0x6982('0x2')]['on'](_0x6982('0x14'),this[_0x6982('0x15')][_0x6982('0x13')](this));this[_0x6982('0x2')]['connect']();}util[_0x6982('0x16')](EmailImap,EventEmitter);EmailImap[_0x6982('0x17')]['getAccount']=function(_0x34d837,_0x59a781){var _0x117cbf={'connTimeout':_0x34d837[_0x6982('0x18')]?_0x34d837['connTimeout']*0x3e8:0x2710,'authTimeout':_0x34d837['authTimeout']?_0x34d837[_0x6982('0x19')]*0x3e8:0x1388};if(_[_0x6982('0x1a')](_0x34d837[_0x6982('0x1b')])){if(_0x34d837['authentication']){_0x117cbf[_0x6982('0x1c')]=_0x34d837['user'];_0x117cbf[_0x6982('0x1d')]=_0x34d837[_0x6982('0x1d')];}_0x117cbf['host']=_0x34d837[_0x6982('0x1e')];_0x117cbf['port']=_0x34d837[_0x6982('0x1f')]||0x3e1;if(_0x34d837[_0x6982('0x20')]){_0x117cbf['tls']=!![];}else{_0x117cbf[_0x6982('0x20')]=![];_0x117cbf[_0x6982('0x21')]='required';}}else{_0x117cbf[_0x6982('0x1c')]=_0x34d837['user'];_0x117cbf[_0x6982('0x1d')]=_0x34d837[_0x6982('0x1d')];_0x117cbf[_0x6982('0x1e')]=utils[_0x6982('0x22')](_0x34d837['service']);_0x117cbf[_0x6982('0x1f')]=0x3e1;_0x117cbf['tls']=!![];}_0x117cbf[_0x6982('0xb')]=_0x59a781||_0x34d837['user']||'anonymous@xcally.com';return _0x117cbf;};EmailImap['prototype']['handleReady']=function(){this['imap'][_0x6982('0x23')](this[_0x6982('0xc')],![],this[_0x6982('0x24')][_0x6982('0x13')](this));};EmailImap[_0x6982('0x17')][_0x6982('0x24')]=function(_0x2b97ef,_0x5e884f){if(_0x2b97ef){this['handleError'](_0x2b97ef,!![]);}else{this[_0x6982('0x25')](_0x6982('0x26'),_0x5e884f);this[_0x6982('0x27')]();}};EmailImap['prototype']['handleCloseBox']=function(_0x34432c){if(_0x34432c){this[_0x6982('0x15')](_0x34432c,!![]);}else{this[_0x6982('0x2')]['end']();}};EmailImap[_0x6982('0x17')][_0x6982('0x27')]=function(){this[_0x6982('0x2')][_0x6982('0x28')]([_0x6982('0x29')],this[_0x6982('0x2a')][_0x6982('0x13')](this));};EmailImap[_0x6982('0x17')][_0x6982('0x2a')]=function(_0x2df28a,_0x7c3c3d){if(_0x2df28a){this[_0x6982('0x15')](_0x2df28a,!![]);}else{if(_0x7c3c3d[_0x6982('0x2b')]){try{var _0xdefa29=this[_0x6982('0x2')][_0x6982('0x2c')](_0x7c3c3d,{'bodies':'','markSeen':!![]});_0xdefa29['on'](_0x6982('0x2d'),this[_0x6982('0x2e')][_0x6982('0x13')](this));_0xdefa29[_0x6982('0x10')](_0x6982('0x14'),this[_0x6982('0x2f')][_0x6982('0x13')](this));_0xdefa29[_0x6982('0x10')](_0x6982('0x11'),this[_0x6982('0x30')][_0x6982('0x13')](this));}catch(_0x4f485d){logger[_0x6982('0x14')](_0x4f485d);}}else{this[_0x6982('0x2')][_0x6982('0x31')](!![],this[_0x6982('0x32')][_0x6982('0x13')](this));}}};EmailImap[_0x6982('0x17')][_0x6982('0x2e')]=function(_0x143c2f,_0x163eb2){_0x143c2f['on'](_0x6982('0x33'),this['handleMessageBody']['bind'](this));_0x143c2f[_0x6982('0x10')]('attributes',this[_0x6982('0x34')]['bind'](this));_0x143c2f[_0x6982('0x10')](_0x6982('0x11'),this[_0x6982('0x35')]['bind'](this));};EmailImap[_0x6982('0x17')][_0x6982('0x36')]=function(_0x980ca4,_0x21d0d6){simpleParser(_0x980ca4,{'Iconv':Iconv},this[_0x6982('0x37')][_0x6982('0x13')](this));};EmailImap[_0x6982('0x17')][_0x6982('0x34')]=function(_0x1b8917){};EmailImap['prototype'][_0x6982('0x35')]=function(){};EmailImap[_0x6982('0x17')][_0x6982('0x37')]=function(_0x3a182c,_0x1f6e8e){if(_0x3a182c){logger['error'](_0x3a182c);}else{var _0x31f746=this;utils['parser'](this['account'],_0x1f6e8e,function(_0x1e4d67){_0x31f746[_0x6982('0x25')](_0x6982('0xb'),_0x1e4d67);});}};EmailImap[_0x6982('0x17')][_0x6982('0x30')]=function(){this[_0x6982('0x2')][_0x6982('0x31')](!![],this['handleCloseBox'][_0x6982('0x13')](this));};EmailImap[_0x6982('0x17')]['handleFetchError']=function(_0x32be77){this[_0x6982('0x15')](_0x32be77);this['imap'][_0x6982('0x31')](!![],this[_0x6982('0x32')][_0x6982('0x13')](this));};EmailImap[_0x6982('0x17')][_0x6982('0x12')]=function(){this[_0x6982('0x25')](_0x6982('0x11'));};EmailImap[_0x6982('0x17')][_0x6982('0x15')]=function(_0x12060f,_0x278817){logger[_0x6982('0x14')]('handleError',this[_0x6982('0xe')][_0x6982('0xb')],JSON[_0x6982('0x38')](_0x12060f));var _0x2dec3c='';if(_0x12060f){if(_0x12060f[_0x6982('0x39')]){_0x2dec3c=_0x12060f[_0x6982('0x39')];}else{for(var _0x4b6a1a in _0x12060f){if(_0x12060f[_0x6982('0x3a')](_0x4b6a1a)){_0x2dec3c+=_['upperFirst'](_0x4b6a1a)+':\x20'+_0x12060f[_0x4b6a1a]+'\x0a';}}}}if(_0x278817){this[_0x6982('0x2')][_0x6982('0x11')]();}else{this['emit']('error',_0x2dec3c);this[_0x6982('0x25')](_0x6982('0x11'));}};module[_0x6982('0x3b')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 2368fc9..f23b5cd 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 _0x5073=['prototype','send','createTransport','use','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','bluebird'];(function(_0x2b270f,_0x1e99a7){var _0x4dce25=function(_0x23726d){while(--_0x23726d){_0x2b270f['push'](_0x2b270f['shift']());}};_0x4dce25(++_0x1e99a7);}(_0x5073,0x142));var _0x3507=function(_0x5eb1a8,_0x30e664){_0x5eb1a8=_0x5eb1a8-0x0;var _0x14c11c=_0x5073[_0x5eb1a8];return _0x14c11c;};'use strict';var nodemailer=require(_0x3507('0x0'));var BPromise=require(_0x3507('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x3507('0x2')][_0x3507('0x3')]=function(_0x516258,_0x45245f){return new BPromise(function(_0x35d50b,_0x835693){var _0x3e6dc1=nodemailer[_0x3507('0x4')](_0x516258);_0x3e6dc1[_0x3507('0x5')](_0x3507('0x6'),inlineBase64());_0x3e6dc1[_0x3507('0x7')](_0x45245f,function(_0x3e4b38,_0x4c964e){if(_0x3e4b38){_0x835693(_0x3e4b38[_0x3507('0x8')]());}else{_0x35d50b(_0x4c964e);}});});};EmailSmtp[_0x3507('0x2')][_0x3507('0x9')]=function(_0x5c0938){return new BPromise(function(_0x3f89b9,_0x53214f){var _0x5b2b4e=nodemailer['createTransport'](_0x5c0938);_0x5b2b4e[_0x3507('0x9')](function(_0x1696e8,_0x5c4454){if(_0x1696e8){_0x53214f(_0x1696e8[_0x3507('0x8')]());}else{if(_0x5c4454){_0x3f89b9(_0x5c4454);}else{_0x53214f(_0x3507('0xa'));}}});});};module[_0x3507('0xb')]=EmailSmtp; \ No newline at end of file +var _0x2e9d=['Not\x20verifired','bluebird','nodemailer-plugin-inline-base64','prototype','compile','toString','verify','createTransport'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x2e9d,0x79));var _0xd2e9=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x2e9d[_0x465a0c];return _0x1e202e;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0xd2e9('0x0'));var inlineBase64=require(_0xd2e9('0x1'));function EmailSmtp(){}EmailSmtp[_0xd2e9('0x2')]['send']=function(_0x560a50,_0x1cb245){return new BPromise(function(_0x3642a8,_0x1cbebe){var _0x1b7333=nodemailer['createTransport'](_0x560a50);_0x1b7333['use'](_0xd2e9('0x3'),inlineBase64());_0x1b7333['sendMail'](_0x1cb245,function(_0x467f60,_0x38978c){if(_0x467f60){_0x1cbebe(_0x467f60[_0xd2e9('0x4')]());}else{_0x3642a8(_0x38978c);}});});};EmailSmtp['prototype'][_0xd2e9('0x5')]=function(_0x3c9846){return new BPromise(function(_0x2a7876,_0x3538b1){var _0x1c2355=nodemailer[_0xd2e9('0x6')](_0x3c9846);_0x1c2355[_0xd2e9('0x5')](function(_0x216ff6,_0xae4f71){if(_0x216ff6){_0x3538b1(_0x216ff6[_0xd2e9('0x4')]());}else{if(_0xae4f71){_0x2a7876(_0xae4f71);}else{_0x3538b1(_0xd2e9('0x7'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index e91e996..2dfeb09 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 _0xb7c2=['html','test','replace','body','message','originTo','originCc','includes','bcc','attachments','attach','attachment','filename','attachment-','%s-%s','now','join','server/files/attachments/','writeFileSync','content','push','from','subject','messageId','inReplyTo','date','format','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','gmail','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','email','../../../config/environment','head','value','address','generate','@xcally.com','name','split','length','slice','Anonymous','isEmpty','anonymous'];(function(_0x528c75,_0x13c96a){var _0x15a2fe=function(_0x1ae75f){while(--_0x1ae75f){_0x528c75['push'](_0x528c75['shift']());}};_0x15a2fe(++_0x13c96a);}(_0xb7c2,0x1f4));var _0x2b7c=function(_0x4ae5d9,_0x1a9564){_0x4ae5d9=_0x4ae5d9-0x0;var _0x19ee47=_0xb7c2[_0x4ae5d9];return _0x19ee47;};'use strict';var _=require(_0x2b7c('0x0'));var moment=require(_0x2b7c('0x1'));var random=require(_0x2b7c('0x2'));var fs=require('fs');var path=require(_0x2b7c('0x3'));var util=require(_0x2b7c('0x4'));var tnef=require(_0x2b7c('0x5'));var logger=require('../../../config/logger')(_0x2b7c('0x6'));var config=require(_0x2b7c('0x7'));function getAddress(_0xb4fec6){var _0x4648c3=_[_0x2b7c('0x8')](_0xb4fec6[_0x2b7c('0x9')]);return _0x4648c3&&_0x4648c3[_0x2b7c('0xa')]?_0x4648c3[_0x2b7c('0xa')]:'anonymous'+random[_0x2b7c('0xb')](0x6)+_0x2b7c('0xc');}function getFirstName(_0x151c49){var _0x557d3a=_[_0x2b7c('0x8')](_0x151c49[_0x2b7c('0x9')]);if(_0x557d3a&&_0x557d3a[_0x2b7c('0xd')]){var _0x247740=_0x557d3a['name'][_0x2b7c('0xe')](/\s+/);return _0x247740[_0x2b7c('0xf')]?_0x247740[_0x2b7c('0x10')](0x0,-0x1)['join']('\x20'):_0x557d3a[_0x2b7c('0xd')];}return _0x2b7c('0x11');}function getLastName(_0x5aa4e7){var _0x43e03b=_[_0x2b7c('0x8')](_0x5aa4e7[_0x2b7c('0x9')]);if(_0x43e03b&&_0x43e03b['name']){var _0x2cd284=_0x43e03b[_0x2b7c('0xd')][_0x2b7c('0xe')](/\s+/);return _0x2cd284['length']>0x1?_0x2cd284['pop']():'';}return'';}function getMails(_0x2022c7,_0x486412){var _0xe301e8='';for(var _0x52bcd1=0x0;_0x52bcd1<_0x486412[_0x2b7c('0x9')]['length'];_0x52bcd1+=0x1){if(_0x486412['value'][_0x52bcd1]['address']!==_0x2022c7){if(!_[_0x2b7c('0x12')](_0xe301e8)){_0xe301e8+=',';}_0xe301e8+=_0x486412['value'][_0x52bcd1][_0x2b7c('0xd')]||_0x486412[_0x2b7c('0x9')][_0x52bcd1][_0x2b7c('0xa')]||'';_0xe301e8+='\x20<';_0xe301e8+=_0x486412['value'][_0x52bcd1][_0x2b7c('0xa')]?_0x486412['value'][_0x52bcd1][_0x2b7c('0xa')]:_0x2b7c('0x13')+random[_0x2b7c('0xb')](0x6)+_0x2b7c('0xc');_0xe301e8+='>';}}return _0xe301e8;}function parseEmail(_0x1db499,_0x155717,_0x1c63af){if(_0x155717[_0x2b7c('0x14')]){var _0x1d3691=/)<[^<]*)*<\/script>/gi;while(_0x1d3691[_0x2b7c('0x15')](_0x155717[_0x2b7c('0x14')])){_0x155717[_0x2b7c('0x14')]=_0x155717[_0x2b7c('0x14')][_0x2b7c('0x16')](_0x1d3691,'');}_0x1c63af[_0x2b7c('0x17')]=_0x155717[_0x2b7c('0x14')];}else{_0x1c63af[_0x2b7c('0x17')]=_0x155717['textAsHtml'];}if(_0x1c63af['body']){_0x1c63af[_0x2b7c('0x17')]=_0x1c63af[_0x2b7c('0x17')][_0x2b7c('0x16')](/Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','127.0.0.1','lodash','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','split','length'];(function(_0x2e2a34,_0xfd945d){var _0x446dc8=function(_0xf08813){while(--_0xf08813){_0x2e2a34['push'](_0x2e2a34['shift']());}};_0x446dc8(++_0xfd945d);}(_0x1ac9,0x16c));var _0x91ac=function(_0x190f22,_0x21e175){_0x190f22=_0x190f22-0x0;var _0xe3143c=_0x1ac9[_0x190f22];return _0xe3143c;};'use strict';var _=require(_0x91ac('0x0'));var moment=require('moment');var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require(_0x91ac('0x1'));var tnef=require(_0x91ac('0x2'));var logger=require(_0x91ac('0x3'))(_0x91ac('0x4'));var config=require(_0x91ac('0x5'));function getAddress(_0x125193){var _0x2f852f=_[_0x91ac('0x6')](_0x125193[_0x91ac('0x7')]);return _0x2f852f&&_0x2f852f[_0x91ac('0x8')]?_0x2f852f[_0x91ac('0x8')]:_0x91ac('0x9')+random[_0x91ac('0xa')](0x6)+_0x91ac('0xb');}function getFirstName(_0xa050d){var _0x5bc260=_[_0x91ac('0x6')](_0xa050d[_0x91ac('0x7')]);if(_0x5bc260&&_0x5bc260['name']){var _0x2323dd=_0x5bc260['name'][_0x91ac('0xc')](/\s+/);return _0x2323dd[_0x91ac('0xd')]?_0x2323dd[_0x91ac('0xe')](0x0,-0x1)[_0x91ac('0xf')]('\x20'):_0x5bc260[_0x91ac('0x10')];}return _0x91ac('0x11');}function getLastName(_0x1abd39){var _0x586675=_[_0x91ac('0x6')](_0x1abd39[_0x91ac('0x7')]);if(_0x586675&&_0x586675['name']){var _0x274089=_0x586675[_0x91ac('0x10')][_0x91ac('0xc')](/\s+/);return _0x274089[_0x91ac('0xd')]>0x1?_0x274089[_0x91ac('0x12')]():'';}return'';}function getMails(_0x173633,_0x4df509){var _0x1ac4c6='';for(var _0x4fc9f9=0x0;_0x4fc9f9<_0x4df509[_0x91ac('0x7')][_0x91ac('0xd')];_0x4fc9f9+=0x1){if(_0x4df509[_0x91ac('0x7')][_0x4fc9f9][_0x91ac('0x8')]!==_0x173633){if(!_['isEmpty'](_0x1ac4c6)){_0x1ac4c6+=',';}_0x1ac4c6+=_0x4df509[_0x91ac('0x7')][_0x4fc9f9][_0x91ac('0x10')]||_0x4df509[_0x91ac('0x7')][_0x4fc9f9][_0x91ac('0x8')]||'';_0x1ac4c6+='\x20<';_0x1ac4c6+=_0x4df509[_0x91ac('0x7')][_0x4fc9f9][_0x91ac('0x8')]?_0x4df509[_0x91ac('0x7')][_0x4fc9f9][_0x91ac('0x8')]:_0x91ac('0x9')+random[_0x91ac('0xa')](0x6)+'@xcally.com';_0x1ac4c6+='>';}}return _0x1ac4c6;}function parseEmail(_0x6da016,_0x1997bc,_0x3dd504){if(_0x1997bc['html']){var _0x4794c4=/)<[^<]*)*<\/script>/gi;while(_0x4794c4['test'](_0x1997bc[_0x91ac('0x13')])){_0x1997bc[_0x91ac('0x13')]=_0x1997bc['html'][_0x91ac('0x14')](_0x4794c4,'');}_0x3dd504[_0x91ac('0x15')]=_0x1997bc['html'];}else{_0x3dd504[_0x91ac('0x15')]=_0x1997bc[_0x91ac('0x16')];}if(_0x3dd504[_0x91ac('0x15')]){_0x3dd504[_0x91ac('0x15')]=_0x3dd504[_0x91ac('0x15')][_0x91ac('0x14')](/0x0){if(this[_0x5937f3+'Capacity']>0x0&&this[_0x5937f3+_0xd702('0x27')]>=this[_0x5937f3+_0xd702('0x28')]){return'maxcapacity';}else{return _0xd702('0x29');}}else{return'idle';}};Agent[_0xd702('0x25')]['updateRealtime']=function(){var _0x5e8d61=['mail',_0xd702('0x2a'),_0xd702('0x2b'),_0xd702('0x2c'),'sms'];for(var _0x1f0c44=0x0;_0x1f0c44<_0x5e8d61[_0xd702('0x2d')];_0x1f0c44+=0x1){var _0x10599a=this[_0xd702('0x26')](_0x5e8d61[_0x1f0c44]);if(this[_0x5e8d61[_0x1f0c44]+_0xd702('0x2e')]!==_0x10599a){this[_0x5e8d61[_0x1f0c44]+_0xd702('0x2f')]=_[_0xd702('0x30')](moment()[_0xd702('0x31')]('x'));}this[_0x5e8d61[_0x1f0c44]+_0xd702('0x2e')]=_0x10599a;}var _0x50d7ad={'id':this['id'],'name':this[_0xd702('0x9')],'online':this[_0xd702('0xa')],'voicePause':this[_0xd702('0xb')],'chatPause':this[_0xd702('0xc')],'mailPause':this[_0xd702('0xd')],'smsPause':this[_0xd702('0xf')],'faxPause':this[_0xd702('0xe')],'openchannelPause':this[_0xd702('0x10')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xd702('0x12')],'chatCurrentCapacity':this[_0xd702('0x13')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xd702('0x15')],'mailCapacity':this[_0xd702('0x16')],'mailCurrentCapacity':this[_0xd702('0x17')],'faxStatus':this[_0xd702('0x18')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xd702('0x1a')],'faxCurrentCapacity':this[_0xd702('0x1b')],'smsStatus':this[_0xd702('0x32')],'smsStatusTime':this[_0xd702('0x1c')],'smsCapacity':this[_0xd702('0x1d')],'smsCurrentCapacity':this['smsCurrentCapacity'],'openchannelStatus':this[_0xd702('0x1f')],'openchannelStatusTime':this[_0xd702('0x33')],'openchannelCapacity':this[_0xd702('0x20')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xd702('0x22')],'busyQueue':this['busyQueue']};var _0x50867f=md5(JSON[_0xd702('0x34')](_0x50d7ad));if(this[_0xd702('0x2')]!==_0x50867f){this[_0xd702('0x2')]=_0x50867f;io['emit'](_0xd702('0x35'),_0x50d7ad);}};module[_0xd702('0x36')]=Agent; \ No newline at end of file +var _0x34e5=['CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','fax','sms','length','getChannelStatus','StatusTime','toNumber','format','Status','faxCurrentCapacity','smsStatusTime','openchannelCurrentCapacity','emit','user:save','exports','moment','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','unknown','faxStatusTime','faxCapacity','smsStatus','smsCapacity','smsCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','md5','updateRealtime','prototype'];(function(_0x9e725d,_0x5cb9e2){var _0x1f3ce2=function(_0x41f523){while(--_0x41f523){_0x9e725d['push'](_0x9e725d['shift']());}};_0x1f3ce2(++_0x5cb9e2);}(_0x34e5,0x172));var _0x534e=function(_0x204ee,_0x5b0438){_0x204ee=_0x204ee-0x0;var _0x589a95=_0x34e5[_0x204ee];return _0x589a95;};'use strict';var _=require('lodash');var moment=require(_0x534e('0x0'));var md5=require('md5');var Redis=require(_0x534e('0x1'));var config=require(_0x534e('0x2'));config[_0x534e('0x3')]=_[_0x534e('0x4')](config[_0x534e('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x534e('0x5'))(new Redis(config[_0x534e('0x3')]));function Agent(_0x3c772f){this['id']=_0x3c772f['id']||0x0;this[_0x534e('0x6')]=_0x3c772f[_0x534e('0x6')]||'';this[_0x534e('0x7')]=_0x3c772f[_0x534e('0x7')]||!![];this['voicePause']=_0x3c772f[_0x534e('0x8')]||![];this[_0x534e('0x9')]=_0x3c772f[_0x534e('0x9')]||![];this['mailPause']=_0x3c772f['mailPause']||![];this[_0x534e('0xa')]=_0x3c772f['faxPause']||![];this[_0x534e('0xb')]=_0x3c772f['smsPause']||![];this[_0x534e('0xc')]=_0x3c772f[_0x534e('0xc')]||![];this[_0x534e('0xd')]='unknown';this[_0x534e('0xe')]=0x0;this[_0x534e('0xf')]=_0x3c772f[_0x534e('0xf')]||0x0;this[_0x534e('0x10')]=0x0;this[_0x534e('0x11')]='unknown';this[_0x534e('0x12')]=0x0;this[_0x534e('0x13')]=_0x3c772f[_0x534e('0x13')]||0x0;this[_0x534e('0x14')]=0x0;this[_0x534e('0x15')]=_0x534e('0x16');this[_0x534e('0x17')]=0x0;this[_0x534e('0x18')]=_0x3c772f[_0x534e('0x18')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x534e('0x19')]=_0x534e('0x16');this['smsStatusTime']=0x0;this['smsCapacity']=_0x3c772f[_0x534e('0x1a')]||0x0;this[_0x534e('0x1b')]=0x0;this[_0x534e('0x1c')]=_0x534e('0x16');this[_0x534e('0x1d')]=0x0;this[_0x534e('0x1e')]=_0x3c772f[_0x534e('0x1e')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x534e('0x1f')]=![];this[_0x534e('0x20')]=undefined;this[_0x534e('0x21')]='';this[_0x534e('0x22')]();}Agent[_0x534e('0x23')]['getChannelStatus']=function(_0x3f1697){if(this[_0x3f1697+_0x534e('0x24')]>0x0){if(this[_0x3f1697+_0x534e('0x25')]>0x0&&this[_0x3f1697+_0x534e('0x24')]>=this[_0x3f1697+_0x534e('0x25')]){return _0x534e('0x26');}else{return _0x534e('0x27');}}else{return _0x534e('0x28');}};Agent[_0x534e('0x23')]['updateRealtime']=function(){var _0x188020=[_0x534e('0x29'),_0x534e('0x2a'),_0x534e('0x2b'),_0x534e('0x2c'),_0x534e('0x2d')];for(var _0xf60d40=0x0;_0xf60d40<_0x188020[_0x534e('0x2e')];_0xf60d40+=0x1){var _0x53a6ef=this[_0x534e('0x2f')](_0x188020[_0xf60d40]);if(this[_0x188020[_0xf60d40]+'Status']!==_0x53a6ef){this[_0x188020[_0xf60d40]+_0x534e('0x30')]=_[_0x534e('0x31')](moment()[_0x534e('0x32')]('x'));}this[_0x188020[_0xf60d40]+_0x534e('0x33')]=_0x53a6ef;}var _0x174577={'id':this['id'],'name':this['name'],'online':this[_0x534e('0x7')],'voicePause':this[_0x534e('0x8')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0x534e('0xb')],'faxPause':this['faxPause'],'openchannelPause':this[_0x534e('0xc')],'chatStatus':this[_0x534e('0xd')],'chatStatusTime':this[_0x534e('0xe')],'chatCapacity':this[_0x534e('0xf')],'chatCurrentCapacity':this[_0x534e('0x10')],'mailStatus':this[_0x534e('0x11')],'mailStatusTime':this[_0x534e('0x12')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x534e('0x15')],'faxStatusTime':this[_0x534e('0x17')],'faxCapacity':this[_0x534e('0x18')],'faxCurrentCapacity':this[_0x534e('0x34')],'smsStatus':this[_0x534e('0x19')],'smsStatusTime':this[_0x534e('0x35')],'smsCapacity':this[_0x534e('0x1a')],'smsCurrentCapacity':this[_0x534e('0x1b')],'openchannelStatus':this[_0x534e('0x1c')],'openchannelStatusTime':this[_0x534e('0x1d')],'openchannelCapacity':this[_0x534e('0x1e')],'openchannelCurrentCapacity':this[_0x534e('0x36')],'busy':this['busy'],'busyQueue':this[_0x534e('0x20')]};var _0x3ad091=md5(JSON['stringify'](_0x174577));if(this[_0x534e('0x21')]!==_0x3ad091){this['md5']=_0x3ad091;io[_0x534e('0x37')](_0x534e('0x38'),_0x174577);}};module[_0x534e('0x39')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 127d1c0..3feb8f0 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 _0x5055=['localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','_rr','map','loggedIn','paused','length','online','chatPause','available','stringify','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults'];(function(_0x12cc7d,_0x449fca){var _0x2d55c3=function(_0x3ea7b1){while(--_0x3ea7b1){_0x12cc7d['push'](_0x12cc7d['shift']());}};_0x2d55c3(++_0x449fca);}(_0x5055,0x1ca));var _0x5505=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5055[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5505('0x0'));var md5=require(_0x5505('0x1'));var util=require('util');var Redis=require(_0x5505('0x2'));var config=require(_0x5505('0x3'));config[_0x5505('0x4')]=_[_0x5505('0x5')](config['redis'],{'host':_0x5505('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5505('0x4')]));function ChatQueue(_0x584a3f){this['id']=_0x584a3f['id']||0x0;this[_0x5505('0x7')]=_0x584a3f[_0x5505('0x7')]||'';this[_0x5505('0x8')]=_0x584a3f[_0x5505('0x8')]||0xa;this[_0x5505('0x9')]=_0x584a3f[_0x5505('0x9')]||_0x5505('0xa');this[_0x5505('0xb')]=_0x584a3f[_0x5505('0xb')];this[_0x5505('0xc')]={};this[_0x5505('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0x5505('0xe')]();}ChatQueue['prototype'][_0x5505('0xf')]=function(){var _0x1cc040=this['mapAgentsId'][_0x5505('0x10')];this[_0x5505('0xc')]=_[_0x5505('0x11')](this['Agents'],'id');this[_0x5505('0xc')][_0x5505('0x10')]=_0x1cc040;};ChatQueue['prototype'][_0x5505('0xe')]=function(){this[_0x5505('0x12')]=0x0;this[_0x5505('0x13')]=0x0;for(var _0x197992=0x0;_0x197992=0x0?this['available']:0x0;var _0x10fbc3={'id':this['id'],'available':this[_0x5505('0x17')],'loggedIn':this[_0x5505('0x12')],'name':this[_0x5505('0x7')],'paused':this[_0x5505('0x13')],'waiting':this['waiting']};var _0x3f7635=md5(JSON[_0x5505('0x18')](_0x10fbc3));if(this[_0x5505('0x1')]!==_0x3f7635){this[_0x5505('0x1')]=_0x3f7635;io['to'](util['format'](_0x5505('0x19'),_0x10fbc3[_0x5505('0x7')]))[_0x5505('0x1a')](_0x5505('0x1b'),_0x10fbc3);}};module[_0x5505('0x1c')]=ChatQueue; \ No newline at end of file +var _0x76eb=['prototype','loggedIn','paused','length','chatPause','available','stringify','format','emit','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr'];(function(_0x788de7,_0x4ae559){var _0x103178=function(_0x140c6b){while(--_0x140c6b){_0x788de7['push'](_0x788de7['shift']());}};_0x103178(++_0x4ae559);}(_0x76eb,0x14e));var _0xb76e=function(_0x951de0,_0x410d50){_0x951de0=_0x951de0-0x0;var _0xd338ee=_0x76eb[_0x951de0];return _0xd338ee;};'use strict';var _=require('lodash');var md5=require(_0xb76e('0x0'));var util=require(_0xb76e('0x1'));var Redis=require(_0xb76e('0x2'));var config=require('../../../config/environment');config[_0xb76e('0x3')]=_[_0xb76e('0x4')](config[_0xb76e('0x3')],{'host':_0xb76e('0x5'),'port':0x18eb});var io=require(_0xb76e('0x6'))(new Redis(config[_0xb76e('0x3')]));function ChatQueue(_0x1ae874){this['id']=_0x1ae874['id']||0x0;this[_0xb76e('0x7')]=_0x1ae874[_0xb76e('0x7')]||'';this[_0xb76e('0x8')]=_0x1ae874['timeout']||0xa;this['strategy']=_0x1ae874['strategy']||_0xb76e('0x9');this['Agents']=_0x1ae874[_0xb76e('0xa')];this[_0xb76e('0xb')]={};this[_0xb76e('0xc')]=0x0;this[_0xb76e('0x0')]='';this[_0xb76e('0xd')]();this[_0xb76e('0xe')]();}ChatQueue['prototype'][_0xb76e('0xd')]=function(){var _0x541a4b=this[_0xb76e('0xb')][_0xb76e('0xf')];this[_0xb76e('0xb')]=_['map'](this[_0xb76e('0xa')],'id');this[_0xb76e('0xb')][_0xb76e('0xf')]=_0x541a4b;};ChatQueue[_0xb76e('0x10')][_0xb76e('0xe')]=function(){this[_0xb76e('0x11')]=0x0;this[_0xb76e('0x12')]=0x0;for(var _0x55ca78=0x0;_0x55ca78=0x0?this['available']:0x0;var _0xf8abe6={'id':this['id'],'available':this[_0xb76e('0x15')],'loggedIn':this['loggedIn'],'name':this[_0xb76e('0x7')],'paused':this[_0xb76e('0x12')],'waiting':this[_0xb76e('0xc')]};var _0x1e370f=md5(JSON[_0xb76e('0x16')](_0xf8abe6));if(this['md5']!==_0x1e370f){this['md5']=_0x1e370f;io['to'](util[_0xb76e('0x17')]('chat:queue:%s',_0xf8abe6['name']))[_0xb76e('0x18')]('chat_queue:save',_0xf8abe6);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 290836b..64a77fd 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(_0x48dd35,_0x237a52){var _0x143542=function(_0x567ce4){while(--_0x567ce4){_0x48dd35['push'](_0x48dd35['shift']());}};_0x143542(++_0x237a52);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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(_0x34928a,_0x5f4c77){var _0x21c1bb=function(_0x18b387){while(--_0x18b387){_0x34928a['push'](_0x34928a['shift']());}};_0x21c1bb(++_0x5f4c77);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 5d50bcd..14509c7 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 _0x5f46=['Intervals','exports','name'];(function(_0x209de7,_0x521fa7){var _0x4bf410=function(_0x597053){while(--_0x597053){_0x209de7['push'](_0x209de7['shift']());}};_0x4bf410(++_0x521fa7);}(_0x5f46,0x8f));var _0x65f4=function(_0x3063b1,_0x2b7e09){_0x3063b1=_0x3063b1-0x0;var _0x4a166e=_0x5f46[_0x3063b1];return _0x4a166e;};'use strict';function Interval(_0x8309fe){this['id']=_0x8309fe['id']||0x0;this[_0x65f4('0x0')]=_0x8309fe['name']||'';this[_0x65f4('0x1')]=_0x8309fe[_0x65f4('0x1')]||{};}module[_0x65f4('0x2')]=Interval; \ No newline at end of file +var _0xe07f=['name','Intervals','exports'];(function(_0x2ae8ce,_0x2a5a1f){var _0x4bf686=function(_0x41cabf){while(--_0x41cabf){_0x2ae8ce['push'](_0x2ae8ce['shift']());}};_0x4bf686(++_0x2a5a1f);}(_0xe07f,0x9c));var _0xfe07=function(_0x423cfd,_0x23e564){_0x423cfd=_0x423cfd-0x0;var _0x32d786=_0xe07f[_0x423cfd];return _0x32d786;};'use strict';function Interval(_0x3b336c){this['id']=_0x3b336c['id']||0x0;this['name']=_0x3b336c[_0xfe07('0x0')]||'';this[_0xfe07('0x1')]=_0x3b336c[_0xfe07('0x1')]||{};}module[_0xfe07('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 1fc5504..7f6f827 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 _0x0de8=['md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','online','available','waiting','stringify','format','mail:queue:%s','emit','exports','lodash'];(function(_0x81f000,_0x15df85){var _0x337aa2=function(_0x37f6a4){while(--_0x37f6a4){_0x81f000['push'](_0x81f000['shift']());}};_0x337aa2(++_0x15df85);}(_0x0de8,0x1db));var _0x80de=function(_0x928b87,_0x53480a){_0x928b87=_0x928b87-0x0;var _0x1e7638=_0x0de8[_0x928b87];return _0x1e7638;};'use strict';var _=require(_0x80de('0x0'));var md5=require(_0x80de('0x1'));var util=require(_0x80de('0x2'));var Redis=require(_0x80de('0x3'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x80de('0x4')],{'host':_0x80de('0x5'),'port':0x18eb});var io=require(_0x80de('0x6'))(new Redis(config['redis']));function MailQueue(_0x424a14){this['id']=_0x424a14['id']||0x0;this[_0x80de('0x7')]=_0x424a14['name']||'';this[_0x80de('0x8')]=_0x424a14['timeout']||0xa;this[_0x80de('0x9')]=_0x424a14[_0x80de('0x9')]||_0x80de('0xa');this[_0x80de('0xb')]=_0x424a14[_0x80de('0xb')];this[_0x80de('0xc')]={};this['waiting']=0x0;this[_0x80de('0x1')]='';this[_0x80de('0xd')]();this[_0x80de('0xe')]();}MailQueue[_0x80de('0xf')][_0x80de('0xd')]=function(){var _0x2dd0b2=this[_0x80de('0xc')]['_rr'];this[_0x80de('0xc')]=_[_0x80de('0x10')](this['Agents'],'id');this[_0x80de('0xc')][_0x80de('0x11')]=_0x2dd0b2;};MailQueue['prototype'][_0x80de('0xe')]=function(){this[_0x80de('0x12')]=0x0;this[_0x80de('0x13')]=0x0;for(var _0x13cbd0=0x0;_0x13cbd0=0x0?this[_0x80de('0x15')]:0x0;var _0x51ad4f={'id':this['id'],'available':this[_0x80de('0x15')],'loggedIn':this[_0x80de('0x12')],'name':this[_0x80de('0x7')],'paused':this[_0x80de('0x13')],'waiting':this[_0x80de('0x16')]};var _0x445ecb=md5(JSON[_0x80de('0x17')](_0x51ad4f));if(this[_0x80de('0x1')]!==_0x445ecb){this[_0x80de('0x1')]=_0x445ecb;io['to'](util[_0x80de('0x18')](_0x80de('0x19'),_0x51ad4f['name']))[_0x80de('0x1a')]('mail_queue:save',_0x51ad4f);}};module[_0x80de('0x1b')]=MailQueue; \ No newline at end of file +var _0x07ef=['name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','map','prototype','loggedIn','paused','length','online','mailPause','available','stringify','format','emit','mail_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter'];(function(_0x2af860,_0x90628){var _0x5a79a4=function(_0x25ab3a){while(--_0x25ab3a){_0x2af860['push'](_0x2af860['shift']());}};_0x5a79a4(++_0x90628);}(_0x07ef,0x70));var _0xf07e=function(_0x2c7f80,_0x2b0052){_0x2c7f80=_0x2c7f80-0x0;var _0x11fe38=_0x07ef[_0x2c7f80];return _0x11fe38;};'use strict';var _=require(_0xf07e('0x0'));var md5=require(_0xf07e('0x1'));var util=require(_0xf07e('0x2'));var Redis=require(_0xf07e('0x3'));var config=require('../../../config/environment');config[_0xf07e('0x4')]=_[_0xf07e('0x5')](config[_0xf07e('0x4')],{'host':_0xf07e('0x6'),'port':0x18eb});var io=require(_0xf07e('0x7'))(new Redis(config[_0xf07e('0x4')]));function MailQueue(_0x11b043){this['id']=_0x11b043['id']||0x0;this[_0xf07e('0x8')]=_0x11b043[_0xf07e('0x8')]||'';this[_0xf07e('0x9')]=_0x11b043[_0xf07e('0x9')]||0xa;this[_0xf07e('0xa')]=_0x11b043[_0xf07e('0xa')]||_0xf07e('0xb');this[_0xf07e('0xc')]=_0x11b043[_0xf07e('0xc')];this[_0xf07e('0xd')]={};this[_0xf07e('0xe')]=0x0;this['md5']='';this[_0xf07e('0xf')]();this[_0xf07e('0x10')]();}MailQueue['prototype']['updateRouting']=function(){var _0xcaf677=this[_0xf07e('0xd')]['_rr'];this[_0xf07e('0xd')]=_[_0xf07e('0x11')](this[_0xf07e('0xc')],'id');this[_0xf07e('0xd')]['_rr']=_0xcaf677;};MailQueue[_0xf07e('0x12')][_0xf07e('0x10')]=function(){this[_0xf07e('0x13')]=0x0;this[_0xf07e('0x14')]=0x0;for(var _0x877067=0x0;_0x877067=0x0?this[_0xf07e('0x18')]:0x0;var _0x2daa45={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xf07e('0x8')],'paused':this[_0xf07e('0x14')],'waiting':this[_0xf07e('0xe')]};var _0x17f17e=md5(JSON[_0xf07e('0x19')](_0x2daa45));if(this[_0xf07e('0x1')]!==_0x17f17e){this[_0xf07e('0x1')]=_0x17f17e;io['to'](util[_0xf07e('0x1a')]('mail:queue:%s',_0x2daa45['name']))[_0xf07e('0x1b')](_0xf07e('0x1c'),_0x2daa45);}};module[_0xf07e('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index d79395b..690d5b1 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 _0x5785=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','md5','updateRealtime','prototype','updateRouting','_rr','loggedIn','paused','online','openchannelPause','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','util'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x5785,0x1ca));var _0x5578=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x5785[_0x38537f];return _0x141e23;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x5578('0x0'));var Redis=require('ioredis');var config=require(_0x5578('0x1'));config[_0x5578('0x2')]=_['defaults'](config[_0x5578('0x2')],{'host':_0x5578('0x3'),'port':0x18eb});var io=require(_0x5578('0x4'))(new Redis(config[_0x5578('0x2')]));function OpenchannelQueue(_0x58647d){this['id']=_0x58647d['id']||0x0;this[_0x5578('0x5')]=_0x58647d['name']||'';this[_0x5578('0x6')]=_0x58647d[_0x5578('0x6')]||0xa;this[_0x5578('0x7')]=_0x58647d[_0x5578('0x7')]||'beepall';this[_0x5578('0x8')]=_0x58647d[_0x5578('0x8')];this[_0x5578('0x9')]={};this['waiting']=0x0;this[_0x5578('0xa')]='';this['updateRouting']();this[_0x5578('0xb')]();}OpenchannelQueue[_0x5578('0xc')][_0x5578('0xd')]=function(){var _0x25da0f=this['mapAgentsId'][_0x5578('0xe')];this[_0x5578('0x9')]=_['map'](this['Agents'],'id');this[_0x5578('0x9')][_0x5578('0xe')]=_0x25da0f;};OpenchannelQueue[_0x5578('0xc')][_0x5578('0xb')]=function(){this[_0x5578('0xf')]=0x0;this[_0x5578('0x10')]=0x0;for(var _0xbfd92c=0x0;_0xbfd92c=0x0?this[_0x5578('0x13')]:0x0;var _0x444f4b={'id':this['id'],'available':this[_0x5578('0x13')],'loggedIn':this[_0x5578('0xf')],'name':this[_0x5578('0x5')],'paused':this[_0x5578('0x10')],'waiting':this[_0x5578('0x14')]};var _0x2a69b9=md5(JSON[_0x5578('0x15')](_0x444f4b));if(this[_0x5578('0xa')]!==_0x2a69b9){this[_0x5578('0xa')]=_0x2a69b9;io['to'](util[_0x5578('0x16')](_0x5578('0x17'),_0x444f4b[_0x5578('0x5')]))[_0x5578('0x18')](_0x5578('0x19'),_0x444f4b);}};module[_0x5578('0x1a')]=OpenchannelQueue; \ No newline at end of file +var _0xc1b3=['lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','paused','length','online','loggedIn','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save'];(function(_0x450678,_0x278085){var _0x2be754=function(_0x466a1b){while(--_0x466a1b){_0x450678['push'](_0x450678['shift']());}};_0x2be754(++_0x278085);}(_0xc1b3,0x168));var _0x3c1b=function(_0x47a36f,_0x5a56b7){_0x47a36f=_0x47a36f-0x0;var _0x8379db=_0xc1b3[_0x47a36f];return _0x8379db;};'use strict';var _=require(_0x3c1b('0x0'));var md5=require(_0x3c1b('0x1'));var util=require(_0x3c1b('0x2'));var Redis=require(_0x3c1b('0x3'));var config=require(_0x3c1b('0x4'));config[_0x3c1b('0x5')]=_[_0x3c1b('0x6')](config[_0x3c1b('0x5')],{'host':_0x3c1b('0x7'),'port':0x18eb});var io=require(_0x3c1b('0x8'))(new Redis(config[_0x3c1b('0x5')]));function OpenchannelQueue(_0x3599ce){this['id']=_0x3599ce['id']||0x0;this[_0x3c1b('0x9')]=_0x3599ce[_0x3c1b('0x9')]||'';this['timeout']=_0x3599ce[_0x3c1b('0xa')]||0xa;this['strategy']=_0x3599ce['strategy']||_0x3c1b('0xb');this['Agents']=_0x3599ce[_0x3c1b('0xc')];this['mapAgentsId']={};this[_0x3c1b('0xd')]=0x0;this['md5']='';this[_0x3c1b('0xe')]();this[_0x3c1b('0xf')]();}OpenchannelQueue[_0x3c1b('0x10')]['updateRouting']=function(){var _0x4ddbee=this[_0x3c1b('0x11')][_0x3c1b('0x12')];this[_0x3c1b('0x11')]=_['map'](this[_0x3c1b('0xc')],'id');this[_0x3c1b('0x11')][_0x3c1b('0x12')]=_0x4ddbee;};OpenchannelQueue['prototype'][_0x3c1b('0xf')]=function(){this['loggedIn']=0x0;this[_0x3c1b('0x13')]=0x0;for(var _0x46dc69=0x0;_0x46dc69=0x0?this[_0x3c1b('0x18')]:0x0;var _0xe274e3={'id':this['id'],'available':this[_0x3c1b('0x18')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x3c1b('0x13')],'waiting':this[_0x3c1b('0xd')]};var _0x16e949=md5(JSON[_0x3c1b('0x19')](_0xe274e3));if(this['md5']!==_0x16e949){this[_0x3c1b('0x1')]=_0x16e949;io['to'](util[_0x3c1b('0x1a')](_0x3c1b('0x1b'),_0xe274e3[_0x3c1b('0x9')]))[_0x3c1b('0x1c')](_0x3c1b('0x1d'),_0xe274e3);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 8726371..b4a0c98 100644 --- a/server/services/routing/model/smsQueue.js +++ b/server/services/routing/model/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['length','online','loggedIn','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','updateRouting','_rr','map','updateRealtime','paused'];(function(_0x588011,_0x5e9d11){var _0x3b3773=function(_0x4cca54){while(--_0x4cca54){_0x588011['push'](_0x588011['shift']());}};_0x3b3773(++_0x5e9d11);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e3819,_0x562054){_0x3e3819=_0x3e3819-0x0;var _0x148457=_0xb10b[_0x3e3819];return _0x148457;};'use strict';var _=require(_0xbb10('0x0'));var md5=require('md5');var util=require(_0xbb10('0x1'));var Redis=require(_0xbb10('0x2'));var config=require(_0xbb10('0x3'));config['redis']=_[_0xbb10('0x4')](config[_0xbb10('0x5')],{'host':_0xbb10('0x6'),'port':0x18eb});var io=require(_0xbb10('0x7'))(new Redis(config[_0xbb10('0x5')]));function SmsQueue(_0x312b72){this['id']=_0x312b72['id']||0x0;this['name']=_0x312b72[_0xbb10('0x8')]||'';this[_0xbb10('0x9')]=_0x312b72['timeout']||0xa;this[_0xbb10('0xa')]=_0x312b72[_0xbb10('0xa')]||_0xbb10('0xb');this[_0xbb10('0xc')]=_0x312b72[_0xbb10('0xc')];this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]=0x0;this[_0xbb10('0xf')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xbb10('0x10')][_0xbb10('0x11')]=function(){var _0xce64f3=this['mapAgentsId'][_0xbb10('0x12')];this['mapAgentsId']=_[_0xbb10('0x13')](this[_0xbb10('0xc')],'id');this[_0xbb10('0xd')][_0xbb10('0x12')]=_0xce64f3;};SmsQueue[_0xbb10('0x10')][_0xbb10('0x14')]=function(){this['loggedIn']=0x0;this[_0xbb10('0x15')]=0x0;for(var _0x42d7e4=0x0;_0x42d7e4=0x0?this[_0xbb10('0x1a')]:0x0;var _0x1682a4={'id':this['id'],'available':this[_0xbb10('0x1a')],'loggedIn':this[_0xbb10('0x18')],'name':this[_0xbb10('0x8')],'paused':this[_0xbb10('0x15')],'waiting':this['waiting']};var _0x5ff0cf=md5(JSON[_0xbb10('0x1b')](_0x1682a4));if(this[_0xbb10('0xf')]!==_0x5ff0cf){this[_0xbb10('0xf')]=_0x5ff0cf;io['to'](util[_0xbb10('0x1c')](_0xbb10('0x1d'),_0x1682a4['name']))[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x1682a4);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x1ae54c,_0x2cc8cd){var _0x1f07b4=function(_0x2e0cd0){while(--_0x2e0cd0){_0x1ae54c['push'](_0x1ae54c['shift']());}};_0x1f07b4(++_0x2cc8cd);}(_0xb7e7,0x121));var _0x7b7e=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xb7e7[_0xac151d];return _0x111dba;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 9b2e46f..cba567c 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 _0x74b1=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','loggedIn','paused','length','online','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis'];(function(_0x371076,_0x3a3d76){var _0x324591=function(_0x9ad032){while(--_0x9ad032){_0x371076['push'](_0x371076['shift']());}};_0x324591(++_0x3a3d76);}(_0x74b1,0x6e));var _0x174b=function(_0x2134b7,_0x1eb5e2){_0x2134b7=_0x2134b7-0x0;var _0x6c5914=_0x74b1[_0x2134b7];return _0x6c5914;};'use strict';var _=require(_0x174b('0x0'));var md5=require(_0x174b('0x1'));var util=require(_0x174b('0x2'));var Redis=require(_0x174b('0x3'));var config=require(_0x174b('0x4'));config[_0x174b('0x5')]=_['defaults'](config['redis'],{'host':_0x174b('0x6'),'port':0x18eb});var io=require(_0x174b('0x7'))(new Redis(config[_0x174b('0x5')]));function WhatsappQueue(_0x65fbc){this['id']=_0x65fbc['id']||0x0;this['name']=_0x65fbc[_0x174b('0x8')]||'';this['timeout']=_0x65fbc[_0x174b('0x9')]||0xa;this[_0x174b('0xa')]=_0x65fbc[_0x174b('0xa')]||_0x174b('0xb');this[_0x174b('0xc')]=_0x65fbc[_0x174b('0xc')];this[_0x174b('0xd')]={};this[_0x174b('0xe')]=0x0;this[_0x174b('0x1')]='';this['updateRouting']();this[_0x174b('0xf')]();}WhatsappQueue[_0x174b('0x10')][_0x174b('0x11')]=function(){var _0x61a5f5=this[_0x174b('0xd')][_0x174b('0x12')];this[_0x174b('0xd')]=_['map'](this['Agents'],'id');this[_0x174b('0xd')][_0x174b('0x12')]=_0x61a5f5;};WhatsappQueue[_0x174b('0x10')][_0x174b('0xf')]=function(){this[_0x174b('0x13')]=0x0;this[_0x174b('0x14')]=0x0;for(var _0x5ce51b=0x0;_0x5ce51b=0x0?this[_0x174b('0x17')]:0x0;var _0x5d5751={'id':this['id'],'available':this[_0x174b('0x17')],'loggedIn':this[_0x174b('0x13')],'name':this[_0x174b('0x8')],'paused':this[_0x174b('0x14')],'waiting':this[_0x174b('0xe')]};var _0xf8bb17=md5(JSON[_0x174b('0x18')](_0x5d5751));if(this[_0x174b('0x1')]!==_0xf8bb17){this[_0x174b('0x1')]=_0xf8bb17;io['to'](util[_0x174b('0x19')](_0x174b('0x1a'),_0x5d5751[_0x174b('0x8')]))[_0x174b('0x1b')](_0x174b('0x1c'),_0x5d5751);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xbeb4=['timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','updateRealtime','loggedIn','paused','length','online','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','../../../config/environment','redis','localhost','socket.io-emitter','name'];(function(_0x7ec0ec,_0x529dd4){var _0x4c0883=function(_0x121114){while(--_0x121114){_0x7ec0ec['push'](_0x7ec0ec['shift']());}};_0x4c0883(++_0x529dd4);}(_0xbeb4,0x89));var _0x4beb=function(_0x53c918,_0x14886f){_0x53c918=_0x53c918-0x0;var _0x46a505=_0xbeb4[_0x53c918];return _0x46a505;};'use strict';var _=require(_0x4beb('0x0'));var md5=require(_0x4beb('0x1'));var util=require(_0x4beb('0x2'));var Redis=require('ioredis');var config=require(_0x4beb('0x3'));config['redis']=_['defaults'](config[_0x4beb('0x4')],{'host':_0x4beb('0x5'),'port':0x18eb});var io=require(_0x4beb('0x6'))(new Redis(config[_0x4beb('0x4')]));function WhatsappQueue(_0x21b7f8){this['id']=_0x21b7f8['id']||0x0;this[_0x4beb('0x7')]=_0x21b7f8[_0x4beb('0x7')]||'';this[_0x4beb('0x8')]=_0x21b7f8['timeout']||0xa;this[_0x4beb('0x9')]=_0x21b7f8[_0x4beb('0x9')]||_0x4beb('0xa');this[_0x4beb('0xb')]=_0x21b7f8[_0x4beb('0xb')];this['mapAgentsId']={};this[_0x4beb('0xc')]=0x0;this[_0x4beb('0x1')]='';this[_0x4beb('0xd')]();this['updateRealtime']();}WhatsappQueue[_0x4beb('0xe')][_0x4beb('0xd')]=function(){var _0x4fb810=this[_0x4beb('0xf')][_0x4beb('0x10')];this[_0x4beb('0xf')]=_['map'](this[_0x4beb('0xb')],'id');this[_0x4beb('0xf')]['_rr']=_0x4fb810;};WhatsappQueue[_0x4beb('0xe')][_0x4beb('0x11')]=function(){this[_0x4beb('0x12')]=0x0;this[_0x4beb('0x13')]=0x0;for(var _0x2dd6f9=0x0;_0x2dd6f9=0x0?this[_0x4beb('0x16')]:0x0;var _0x5aa438={'id':this['id'],'available':this[_0x4beb('0x16')],'loggedIn':this[_0x4beb('0x12')],'name':this[_0x4beb('0x7')],'paused':this[_0x4beb('0x13')],'waiting':this[_0x4beb('0xc')]};var _0x237339=md5(JSON[_0x4beb('0x17')](_0x5aa438));if(this[_0x4beb('0x1')]!==_0x237339){this[_0x4beb('0x1')]=_0x237339;io['to'](util[_0x4beb('0x18')](_0x4beb('0x19'),_0x5aa438[_0x4beb('0x7')]))[_0x4beb('0x1a')](_0x4beb('0x1b'),_0x5aa438);}};module[_0x4beb('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 738ea3e..68810db 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 _0x0db9=['../model/faxQueue','agents','intervals','chatQueues','smsQueues','mailQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined','initIntervals','initOpenchannelQueues','openchannelQueues','initChatQueues','updateRouting','updateRealtime','initMailQueues','bluebird','util','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue'];(function(_0x253476,_0x16b31a){var _0x134271=function(_0x20623c){while(--_0x20623c){_0x253476['push'](_0x253476['shift']());}};_0x134271(++_0x16b31a);}(_0x0db9,0x16c));var _0x90db=function(_0x53b133,_0x176261){_0x53b133=_0x53b133-0x0;var _0x5647e0=_0x0db9[_0x53b133];return _0x5647e0;};'use strict';var BPromise=require(_0x90db('0x0'));var util=require(_0x90db('0x1'));var _=require(_0x90db('0x2'));var moment=require(_0x90db('0x3'));var Agent=require(_0x90db('0x4'));var Interval=require(_0x90db('0x5'));var OpenchannelQueue=require(_0x90db('0x6'));var ChatQueue=require(_0x90db('0x7'));var SmsQueue=require(_0x90db('0x8'));var MailQueue=require(_0x90db('0x9'));var FaxQueue=require(_0x90db('0xa'));var Realtime=function(){this[_0x90db('0xb')]={};this[_0x90db('0xc')]={};this['openchannelQueues']={};this[_0x90db('0xd')]={};this[_0x90db('0xe')]={};this[_0x90db('0xf')]={};this[_0x90db('0x10')]={};this['chatQueuesWaitingInteractions']={};this[_0x90db('0x11')]={};this[_0x90db('0x12')]={};this[_0x90db('0x13')]={};this[_0x90db('0x14')]={};};function freeIsNotKey(_0x579eca,_0x1a6357,_0x415483){var _0xc7d98e=_[_0x90db('0x15')](_0x579eca,function(_0x4ea1c1,_0x3b6ce4){return _0x4ea1c1[_0x415483];});for(var _0x48ce40 in _0x1a6357){if(_0x1a6357[_0x90db('0x16')](_0x48ce40)){if(!_0xc7d98e[_0x48ce40]){delete _0x1a6357[_0x48ce40];}}}}Realtime[_0x90db('0x17')][_0x90db('0x18')]=function(_0x3a3231,_0x1218b9){for(var _0x11fd6f in _0x1218b9){if(_0x3a3231[_0x90db('0x16')](_0x11fd6f)){_0x3a3231[_0x11fd6f]=_0x1218b9[_0x11fd6f];}}};Realtime[_0x90db('0x17')]['initAgents']=function(){var _0x39907f=this;return function(_0x5d85dc){if(_0x5d85dc){freeIsNotKey(_0x5d85dc,_0x39907f['agents'],'id');for(var _0x3dc617=0x0,_0x4ab671={},_0x3c4c0c={};_0x3dc617<_0x5d85dc[_0x90db('0x19')];_0x3dc617+=0x1){_0x4ab671=_0x5d85dc[_0x3dc617];if(_[_0x90db('0x1a')](_0x39907f[_0x90db('0xb')][_0x4ab671['id']])){_0x39907f[_0x90db('0xb')][_0x4ab671['id']]=new Agent(_0x4ab671);}else{_0x39907f[_0x90db('0x18')](_0x39907f['agents'][_0x4ab671['id']],_0x4ab671);}}}return _0x39907f['agents'];};};Realtime['prototype'][_0x90db('0x1b')]=function(){var _0x1c02e0=this;return function(_0x2c8ac0){if(_0x2c8ac0){freeIsNotKey(_0x2c8ac0,_0x1c02e0['intervals'],'id');for(var _0x4d1fd1=0x0,_0x3b403f={},_0x4e76da={};_0x4d1fd1<_0x2c8ac0['length'];_0x4d1fd1+=0x1){_0x3b403f=_0x2c8ac0[_0x4d1fd1];if(_[_0x90db('0x1a')](_0x1c02e0[_0x90db('0xc')][_0x3b403f['id']])){_0x1c02e0[_0x90db('0xc')][_0x3b403f['id']]=new Interval(_0x3b403f);}else{_0x1c02e0[_0x90db('0x18')](_0x1c02e0['intervals'][_0x3b403f['id']],_0x3b403f);}}}return _0x1c02e0[_0x90db('0xc')];};};Realtime[_0x90db('0x17')][_0x90db('0x1c')]=function(){var _0x190ec8=this;return function(_0x50c29b){if(_0x50c29b){freeIsNotKey(_0x50c29b,_0x190ec8[_0x90db('0x1d')],'id');for(var _0x22e310=0x0,_0x2b4d6f={},_0x8489f3={};_0x22e310<_0x50c29b[_0x90db('0x19')];_0x22e310+=0x1){_0x2b4d6f=_0x50c29b[_0x22e310];if(_[_0x90db('0x1a')](_0x190ec8['openchannelQueues'][_0x2b4d6f['id']])){_0x190ec8[_0x90db('0x1d')][_0x2b4d6f['id']]=new OpenchannelQueue(_0x2b4d6f);}else{_0x190ec8[_0x90db('0x18')](_0x190ec8[_0x90db('0x1d')][_0x2b4d6f['id']],_0x2b4d6f);}_0x190ec8[_0x90db('0x1d')][_0x2b4d6f['id']]['updateRouting']();_0x190ec8['openchannelQueues'][_0x2b4d6f['id']]['updateRealtime']();}}return _0x190ec8['openchannelQueues'];};};Realtime[_0x90db('0x17')][_0x90db('0x1e')]=function(){var _0x1df5c8=this;return function(_0x143a86){if(_0x143a86){freeIsNotKey(_0x143a86,_0x1df5c8[_0x90db('0xd')],'id');for(var _0x130777=0x0,_0x5872fd={},_0x537ad6={};_0x130777<_0x143a86[_0x90db('0x19')];_0x130777+=0x1){_0x5872fd=_0x143a86[_0x130777];if(_[_0x90db('0x1a')](_0x1df5c8[_0x90db('0xd')][_0x5872fd['id']])){_0x1df5c8['chatQueues'][_0x5872fd['id']]=new ChatQueue(_0x5872fd);}else{_0x1df5c8['mergeFromDatabase'](_0x1df5c8['chatQueues'][_0x5872fd['id']],_0x5872fd);}_0x1df5c8[_0x90db('0xd')][_0x5872fd['id']][_0x90db('0x1f')]();_0x1df5c8['chatQueues'][_0x5872fd['id']][_0x90db('0x20')]();}}return _0x1df5c8[_0x90db('0xd')];};};Realtime[_0x90db('0x17')]['initSmsQueues']=function(){var _0x40a14c=this;return function(_0x1b0d19){if(_0x1b0d19){freeIsNotKey(_0x1b0d19,_0x40a14c[_0x90db('0xe')],'id');for(var _0x4cbb2b=0x0,_0x225c28={},_0x218107={};_0x4cbb2b<_0x1b0d19[_0x90db('0x19')];_0x4cbb2b+=0x1){_0x225c28=_0x1b0d19[_0x4cbb2b];if(_['isUndefined'](_0x40a14c['smsQueues'][_0x225c28['id']])){_0x40a14c[_0x90db('0xe')][_0x225c28['id']]=new SmsQueue(_0x225c28);}else{_0x40a14c['mergeFromDatabase'](_0x40a14c[_0x90db('0xe')][_0x225c28['id']],_0x225c28);}_0x40a14c[_0x90db('0xe')][_0x225c28['id']][_0x90db('0x1f')]();_0x40a14c[_0x90db('0xe')][_0x225c28['id']][_0x90db('0x20')]();}}return _0x40a14c[_0x90db('0xe')];};};Realtime['prototype'][_0x90db('0x21')]=function(){var _0x7ddbc1=this;return function(_0x2894e9){if(_0x2894e9){freeIsNotKey(_0x2894e9,_0x7ddbc1[_0x90db('0xf')],'id');for(var _0x433478=0x0,_0x819066={},_0x47b0d9={};_0x433478<_0x2894e9['length'];_0x433478+=0x1){_0x819066=_0x2894e9[_0x433478];if(_['isUndefined'](_0x7ddbc1[_0x90db('0xf')][_0x819066['id']])){_0x7ddbc1[_0x90db('0xf')][_0x819066['id']]=new MailQueue(_0x819066);}else{_0x7ddbc1[_0x90db('0x18')](_0x7ddbc1['mailQueues'][_0x819066['id']],_0x819066);}_0x7ddbc1[_0x90db('0xf')][_0x819066['id']]['updateRouting']();_0x7ddbc1[_0x90db('0xf')][_0x819066['id']]['updateRealtime']();}}return _0x7ddbc1[_0x90db('0xf')];};};Realtime['prototype']['initFaxQueues']=function(){var _0x2813a1=this;return function(_0x3eb130){if(_0x3eb130){freeIsNotKey(_0x3eb130,_0x2813a1['faxQueues'],'id');for(var _0x337402=0x0,_0x3c7287={},_0xa61792={};_0x337402<_0x3eb130['length'];_0x337402+=0x1){_0x3c7287=_0x3eb130[_0x337402];if(_[_0x90db('0x1a')](_0x2813a1[_0x90db('0x10')][_0x3c7287['id']])){_0x2813a1[_0x90db('0x10')][_0x3c7287['id']]=new FaxQueue(_0x3c7287);}else{_0x2813a1['mergeFromDatabase'](_0x2813a1['faxQueues'][_0x3c7287['id']],_0x3c7287);}_0x2813a1[_0x90db('0x10')][_0x3c7287['id']]['updateRouting']();_0x2813a1[_0x90db('0x10')][_0x3c7287['id']][_0x90db('0x20')]();}}return _0x2813a1[_0x90db('0x10')];};};module['exports']=Realtime; \ No newline at end of file +var _0xb1b3=['hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initFaxQueues','exports','bluebird','moment','../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','faxQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','mapKeys'];(function(_0x2160f6,_0x5783ea){var _0x1e38de=function(_0x4bdcc9){while(--_0x4bdcc9){_0x2160f6['push'](_0x2160f6['shift']());}};_0x1e38de(++_0x5783ea);}(_0xb1b3,0x11e));var _0x3b1b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb1b3[_0x397e5f];return _0x5302b8;};'use strict';var BPromise=require(_0x3b1b('0x0'));var util=require('util');var _=require('lodash');var moment=require(_0x3b1b('0x1'));var Agent=require(_0x3b1b('0x2'));var Interval=require(_0x3b1b('0x3'));var OpenchannelQueue=require(_0x3b1b('0x4'));var ChatQueue=require(_0x3b1b('0x5'));var SmsQueue=require(_0x3b1b('0x6'));var MailQueue=require(_0x3b1b('0x7'));var FaxQueue=require(_0x3b1b('0x8'));var Realtime=function(){this[_0x3b1b('0x9')]={};this[_0x3b1b('0xa')]={};this[_0x3b1b('0xb')]={};this[_0x3b1b('0xc')]={};this['smsQueues']={};this[_0x3b1b('0xd')]={};this[_0x3b1b('0xe')]={};this[_0x3b1b('0xf')]={};this['mailQueuesWaitingInteractions']={};this[_0x3b1b('0x10')]={};this[_0x3b1b('0x11')]={};this[_0x3b1b('0x12')]={};};function freeIsNotKey(_0x588182,_0x56a166,_0x3e5542){var _0x397839=_[_0x3b1b('0x13')](_0x588182,function(_0x3c0fc3,_0x5181dc){return _0x3c0fc3[_0x3e5542];});for(var _0xf98f0c in _0x56a166){if(_0x56a166[_0x3b1b('0x14')](_0xf98f0c)){if(!_0x397839[_0xf98f0c]){delete _0x56a166[_0xf98f0c];}}}}Realtime[_0x3b1b('0x15')][_0x3b1b('0x16')]=function(_0x2fa2a7,_0x590290){for(var _0x5c1fac in _0x590290){if(_0x2fa2a7[_0x3b1b('0x14')](_0x5c1fac)){_0x2fa2a7[_0x5c1fac]=_0x590290[_0x5c1fac];}}};Realtime[_0x3b1b('0x15')]['initAgents']=function(){var _0x4b3882=this;return function(_0x197ab5){if(_0x197ab5){freeIsNotKey(_0x197ab5,_0x4b3882['agents'],'id');for(var _0x33723a=0x0,_0x2863e6={},_0x3f8bcb={};_0x33723a<_0x197ab5[_0x3b1b('0x17')];_0x33723a+=0x1){_0x2863e6=_0x197ab5[_0x33723a];if(_[_0x3b1b('0x18')](_0x4b3882[_0x3b1b('0x9')][_0x2863e6['id']])){_0x4b3882[_0x3b1b('0x9')][_0x2863e6['id']]=new Agent(_0x2863e6);}else{_0x4b3882[_0x3b1b('0x16')](_0x4b3882[_0x3b1b('0x9')][_0x2863e6['id']],_0x2863e6);}}}return _0x4b3882[_0x3b1b('0x9')];};};Realtime[_0x3b1b('0x15')][_0x3b1b('0x19')]=function(){var _0x4e7424=this;return function(_0x161a78){if(_0x161a78){freeIsNotKey(_0x161a78,_0x4e7424[_0x3b1b('0xa')],'id');for(var _0x118d48=0x0,_0x3529ac={},_0x4228d3={};_0x118d48<_0x161a78[_0x3b1b('0x17')];_0x118d48+=0x1){_0x3529ac=_0x161a78[_0x118d48];if(_[_0x3b1b('0x18')](_0x4e7424[_0x3b1b('0xa')][_0x3529ac['id']])){_0x4e7424[_0x3b1b('0xa')][_0x3529ac['id']]=new Interval(_0x3529ac);}else{_0x4e7424[_0x3b1b('0x16')](_0x4e7424['intervals'][_0x3529ac['id']],_0x3529ac);}}}return _0x4e7424[_0x3b1b('0xa')];};};Realtime[_0x3b1b('0x15')][_0x3b1b('0x1a')]=function(){var _0x113bba=this;return function(_0x10e600){if(_0x10e600){freeIsNotKey(_0x10e600,_0x113bba['openchannelQueues'],'id');for(var _0x48d190=0x0,_0x14005a={},_0x4fe274={};_0x48d190<_0x10e600[_0x3b1b('0x17')];_0x48d190+=0x1){_0x14005a=_0x10e600[_0x48d190];if(_[_0x3b1b('0x18')](_0x113bba[_0x3b1b('0xb')][_0x14005a['id']])){_0x113bba['openchannelQueues'][_0x14005a['id']]=new OpenchannelQueue(_0x14005a);}else{_0x113bba[_0x3b1b('0x16')](_0x113bba[_0x3b1b('0xb')][_0x14005a['id']],_0x14005a);}_0x113bba['openchannelQueues'][_0x14005a['id']][_0x3b1b('0x1b')]();_0x113bba[_0x3b1b('0xb')][_0x14005a['id']][_0x3b1b('0x1c')]();}}return _0x113bba[_0x3b1b('0xb')];};};Realtime[_0x3b1b('0x15')][_0x3b1b('0x1d')]=function(){var _0x2a59b6=this;return function(_0x129c26){if(_0x129c26){freeIsNotKey(_0x129c26,_0x2a59b6[_0x3b1b('0xc')],'id');for(var _0x18e476=0x0,_0x19a643={},_0x105eaf={};_0x18e476<_0x129c26[_0x3b1b('0x17')];_0x18e476+=0x1){_0x19a643=_0x129c26[_0x18e476];if(_[_0x3b1b('0x18')](_0x2a59b6[_0x3b1b('0xc')][_0x19a643['id']])){_0x2a59b6[_0x3b1b('0xc')][_0x19a643['id']]=new ChatQueue(_0x19a643);}else{_0x2a59b6[_0x3b1b('0x16')](_0x2a59b6[_0x3b1b('0xc')][_0x19a643['id']],_0x19a643);}_0x2a59b6[_0x3b1b('0xc')][_0x19a643['id']][_0x3b1b('0x1b')]();_0x2a59b6[_0x3b1b('0xc')][_0x19a643['id']][_0x3b1b('0x1c')]();}}return _0x2a59b6[_0x3b1b('0xc')];};};Realtime[_0x3b1b('0x15')][_0x3b1b('0x1e')]=function(){var _0x30ad78=this;return function(_0x107d12){if(_0x107d12){freeIsNotKey(_0x107d12,_0x30ad78[_0x3b1b('0x1f')],'id');for(var _0x174350=0x0,_0x4e144e={},_0x49c020={};_0x174350<_0x107d12[_0x3b1b('0x17')];_0x174350+=0x1){_0x4e144e=_0x107d12[_0x174350];if(_['isUndefined'](_0x30ad78[_0x3b1b('0x1f')][_0x4e144e['id']])){_0x30ad78['smsQueues'][_0x4e144e['id']]=new SmsQueue(_0x4e144e);}else{_0x30ad78[_0x3b1b('0x16')](_0x30ad78['smsQueues'][_0x4e144e['id']],_0x4e144e);}_0x30ad78[_0x3b1b('0x1f')][_0x4e144e['id']]['updateRouting']();_0x30ad78[_0x3b1b('0x1f')][_0x4e144e['id']][_0x3b1b('0x1c')]();}}return _0x30ad78[_0x3b1b('0x1f')];};};Realtime[_0x3b1b('0x15')]['initMailQueues']=function(){var _0x35c402=this;return function(_0x5999e7){if(_0x5999e7){freeIsNotKey(_0x5999e7,_0x35c402[_0x3b1b('0xd')],'id');for(var _0x4f84a7=0x0,_0xfed382={},_0x3bac33={};_0x4f84a7<_0x5999e7[_0x3b1b('0x17')];_0x4f84a7+=0x1){_0xfed382=_0x5999e7[_0x4f84a7];if(_[_0x3b1b('0x18')](_0x35c402[_0x3b1b('0xd')][_0xfed382['id']])){_0x35c402[_0x3b1b('0xd')][_0xfed382['id']]=new MailQueue(_0xfed382);}else{_0x35c402[_0x3b1b('0x16')](_0x35c402['mailQueues'][_0xfed382['id']],_0xfed382);}_0x35c402['mailQueues'][_0xfed382['id']]['updateRouting']();_0x35c402[_0x3b1b('0xd')][_0xfed382['id']]['updateRealtime']();}}return _0x35c402[_0x3b1b('0xd')];};};Realtime[_0x3b1b('0x15')][_0x3b1b('0x20')]=function(){var _0x10e4f8=this;return function(_0x5c47ec){if(_0x5c47ec){freeIsNotKey(_0x5c47ec,_0x10e4f8[_0x3b1b('0xe')],'id');for(var _0x1a1b4c=0x0,_0x5d9e3b={},_0x1bfdf2={};_0x1a1b4c<_0x5c47ec[_0x3b1b('0x17')];_0x1a1b4c+=0x1){_0x5d9e3b=_0x5c47ec[_0x1a1b4c];if(_[_0x3b1b('0x18')](_0x10e4f8['faxQueues'][_0x5d9e3b['id']])){_0x10e4f8[_0x3b1b('0xe')][_0x5d9e3b['id']]=new FaxQueue(_0x5d9e3b);}else{_0x10e4f8[_0x3b1b('0x16')](_0x10e4f8[_0x3b1b('0xe')][_0x5d9e3b['id']],_0x5d9e3b);}_0x10e4f8[_0x3b1b('0xe')][_0x5d9e3b['id']]['updateRouting']();_0x10e4f8['faxQueues'][_0x5d9e3b['id']]['updateRealtime']();}}return _0x10e4f8['faxQueues'];};};module[_0x3b1b('0x21')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 0be75dd..bcafdf4 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 _0x0fab=['Request','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x3661b2,_0x5e68d9){var _0x373531=function(_0x3b6c15){while(--_0x3b6c15){_0x3661b2['push'](_0x3661b2['shift']());}};_0x373531(++_0x5e68d9);}(_0x0fab,0x1bb));var _0xb0fa=function(_0x46e267,_0x55ba65){_0x46e267=_0x46e267-0x0;var _0x49ff3e=_0x0fab[_0x46e267];return _0x49ff3e;};'use strict';var client=require(_0xb0fa('0x0'));exports['update']=function(_0x20059b,_0x1b5099){return client[_0xb0fa('0x1')]('UpdateChatInteraction',{'body':_0x1b5099,'options':{'where':{'id':_0x20059b}},'log':_0xb0fa('0x2')});};exports[_0xb0fa('0x3')]=function(_0x436266,_0x3d0f4d){return client[_0xb0fa('0x1')](_0xb0fa('0x4'),{'body':_0x3d0f4d,'options':{'where':{'id':_0x436266}},'log':_0xb0fa('0x5')});}; \ No newline at end of file +var _0x5a86=['Request','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x1fd3e2,_0x1a6772){var _0x5a9210=function(_0x37e9c3){while(--_0x37e9c3){_0x1fd3e2['push'](_0x1fd3e2['shift']());}};_0x5a9210(++_0x1a6772);}(_0x5a86,0x1c5));var _0x65a8=function(_0x449e2a,_0x48d91a){_0x449e2a=_0x449e2a-0x0;var _0x356422=_0x5a86[_0x449e2a];return _0x356422;};'use strict';var client=require(_0x65a8('0x0'));exports[_0x65a8('0x1')]=function(_0x162c40,_0x141007){return client[_0x65a8('0x2')]('UpdateChatInteraction',{'body':_0x141007,'options':{'where':{'id':_0x162c40}},'log':_0x65a8('0x3')});};exports[_0x65a8('0x4')]=function(_0x53af7b,_0x3b9c22){return client[_0x65a8('0x2')](_0x65a8('0x5'),{'body':_0x3b9c22,'options':{'where':{'id':_0x53af7b}},'log':_0x65a8('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 562b7f9..2e5cb30 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 _0xaaaa=['../client','create','Request','CreateChatMessage'];(function(_0x5ac5f9,_0x1132b0){var _0x3d8afe=function(_0x545bf1){while(--_0x545bf1){_0x5ac5f9['push'](_0x5ac5f9['shift']());}};_0x3d8afe(++_0x1132b0);}(_0xaaaa,0x164));var _0xaaaa=function(_0x40bcdd,_0x5cbc7b){_0x40bcdd=_0x40bcdd-0x0;var _0x39426f=_0xaaaa[_0x40bcdd];return _0x39426f;};'use strict';var client=require(_0xaaaa('0x0'));exports[_0xaaaa('0x1')]=function(_0x4a0d32){return client[_0xaaaa('0x2')](_0xaaaa('0x3'),{'body':_0x4a0d32,'log':'createChatMessage'});}; \ No newline at end of file +var _0xed07=['create','createChatMessage','../client'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xed07,0xd4));var _0x7ed0=function(_0x13fd3e,_0x3217a9){_0x13fd3e=_0x13fd3e-0x0;var _0x32a0c0=_0xed07[_0x13fd3e];return _0x32a0c0;};'use strict';var client=require(_0x7ed0('0x0'));exports[_0x7ed0('0x1')]=function(_0x37fa63){return client['Request']('CreateChatMessage',{'body':_0x37fa63,'log':_0x7ed0('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 81f93fa..5edb67c 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 _0xf4e7=['name','timeout','strategy','User','online','chatPause','../client','getChatQueues','Request','GetChatQueue'];(function(_0x4ae960,_0x23e58a){var _0x53bbce=function(_0x25a22b){while(--_0x25a22b){_0x4ae960['push'](_0x4ae960['shift']());}};_0x53bbce(++_0x23e58a);}(_0xf4e7,0x196));var _0x7f4e=function(_0x55e77d,_0x59df1c){_0x55e77d=_0x55e77d-0x0;var _0x3f271e=_0xf4e7[_0x55e77d];return _0x3f271e;};'use strict';var client=require(_0x7f4e('0x0'));exports[_0x7f4e('0x1')]=function(){return function(){return client[_0x7f4e('0x2')](_0x7f4e('0x3'),{'options':{'raw':![],'attributes':['id',_0x7f4e('0x4'),_0x7f4e('0x5'),_0x7f4e('0x6')],'include':[{'model':_0x7f4e('0x7'),'as':'Agents','attributes':['id',_0x7f4e('0x4'),_0x7f4e('0x8'),_0x7f4e('0x9')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x3264=['GetChatQueue','name','timeout','strategy','User','Agents','online','chatPause','../client','Request'];(function(_0x37da6b,_0x26e1e9){var _0x2ecb3e=function(_0x2a13ea){while(--_0x2a13ea){_0x37da6b['push'](_0x37da6b['shift']());}};_0x2ecb3e(++_0x26e1e9);}(_0x3264,0x1ac));var _0x4326=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x3264[_0x17b6e3];return _0x3906f3;};'use strict';var client=require(_0x4326('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x4326('0x1')](_0x4326('0x2'),{'options':{'raw':![],'attributes':['id',_0x4326('0x3'),_0x4326('0x4'),_0x4326('0x5')],'include':[{'model':_0x4326('0x6'),'as':_0x4326('0x7'),'attributes':['id','name',_0x4326('0x8'),_0x4326('0x9')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 651a731..bedd30f 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 _0x6183=['update','UpdateChatQueueReport','DESC','create','Request','CreateChatQueueReport'];(function(_0x342700,_0x885ed8){var _0x5c3cdb=function(_0x57e077){while(--_0x57e077){_0x342700['push'](_0x342700['shift']());}};_0x5c3cdb(++_0x885ed8);}(_0x6183,0x19b));var _0x3618=function(_0x1af05b,_0x5134b5){_0x1af05b=_0x1af05b-0x0;var _0x5be7cc=_0x6183[_0x1af05b];return _0x5be7cc;};'use strict';var client=require('../client');exports[_0x3618('0x0')]=function(_0x3a9324){return client[_0x3618('0x1')]('CreateChatQueueReport',{'body':_0x3a9324,'log':_0x3618('0x2')});};exports[_0x3618('0x3')]=function(_0x176f61,_0x2d62a7){return client[_0x3618('0x1')](_0x3618('0x4'),{'body':_0x2d62a7,'options':{'where':{'uniqueid':_0x176f61},'order':[['id',_0x3618('0x5')]],'limit':0x1},'log':_0x3618('0x4')});}; \ No newline at end of file +var _0x4f88=['CreateChatQueueReport','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0x3f3224,_0x18a170){var _0x4abc3f=function(_0x5e5050){while(--_0x5e5050){_0x3f3224['push'](_0x3f3224['shift']());}};_0x4abc3f(++_0x18a170);}(_0x4f88,0xf3));var _0x84f8=function(_0x2179f1,_0x21c653){_0x2179f1=_0x2179f1-0x0;var _0x176ec9=_0x4f88[_0x2179f1];return _0x176ec9;};'use strict';var client=require(_0x84f8('0x0'));exports[_0x84f8('0x1')]=function(_0x5b8988){return client[_0x84f8('0x2')](_0x84f8('0x3'),{'body':_0x5b8988,'log':_0x84f8('0x3')});};exports['update']=function(_0x5c24f1,_0xef8394){return client[_0x84f8('0x2')](_0x84f8('0x4'),{'body':_0xef8394,'options':{'where':{'uniqueid':_0x5c24f1},'order':[['id',_0x84f8('0x5')]],'limit':0x1},'log':_0x84f8('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index f3a4f2a..a7a02b1 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 _0x1a83=['update','Request','UpdateFaxInteraction','updateFaxInteraction','addTags','addTagsToFaxInteraction','../client'];(function(_0x8c1fcf,_0x4c5f1d){var _0x552198=function(_0x28acc1){while(--_0x28acc1){_0x8c1fcf['push'](_0x8c1fcf['shift']());}};_0x552198(++_0x4c5f1d);}(_0x1a83,0x180));var _0x31a8=function(_0xc6ccd9,_0x46288b){_0xc6ccd9=_0xc6ccd9-0x0;var _0x24635a=_0x1a83[_0xc6ccd9];return _0x24635a;};'use strict';var client=require(_0x31a8('0x0'));exports[_0x31a8('0x1')]=function(_0x1c4aa2,_0x36f81){return client[_0x31a8('0x2')](_0x31a8('0x3'),{'body':_0x36f81,'options':{'where':{'id':_0x1c4aa2}},'log':_0x31a8('0x4')});};exports[_0x31a8('0x5')]=function(_0xb949fa,_0x59e0bb){return client[_0x31a8('0x2')]('AddTagsToFaxInteraction',{'body':_0x59e0bb,'options':{'where':{'id':_0xb949fa}},'log':_0x31a8('0x6')});}; \ No newline at end of file +var _0x9d33=['addTagsToFaxInteraction','update','UpdateFaxInteraction','addTags','Request','AddTagsToFaxInteraction'];(function(_0x56ffcf,_0x38eb1f){var _0x3cc524=function(_0x2e650c){while(--_0x2e650c){_0x56ffcf['push'](_0x56ffcf['shift']());}};_0x3cc524(++_0x38eb1f);}(_0x9d33,0x193));var _0x39d3=function(_0xe61fc9,_0x3e02d2){_0xe61fc9=_0xe61fc9-0x0;var _0x1ac183=_0x9d33[_0xe61fc9];return _0x1ac183;};'use strict';var client=require('../client');exports[_0x39d3('0x0')]=function(_0xbb3d9e,_0x4ec8aa){return client['Request'](_0x39d3('0x1'),{'body':_0x4ec8aa,'options':{'where':{'id':_0xbb3d9e}},'log':'updateFaxInteraction'});};exports[_0x39d3('0x2')]=function(_0x626d42,_0x234aa3){return client[_0x39d3('0x3')](_0x39d3('0x4'),{'body':_0x234aa3,'options':{'where':{'id':_0x626d42}},'log':_0x39d3('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 28b7d78..169e0ea 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 _0x91b2=['create','Request','createFaxMessage','../client'];(function(_0xe1ef9a,_0x25a7bb){var _0x447bdd=function(_0x29ea04){while(--_0x29ea04){_0xe1ef9a['push'](_0xe1ef9a['shift']());}};_0x447bdd(++_0x25a7bb);}(_0x91b2,0x167));var _0x291b=function(_0x93942f,_0xb48547){_0x93942f=_0x93942f-0x0;var _0x23fcd8=_0x91b2[_0x93942f];return _0x23fcd8;};'use strict';var client=require(_0x291b('0x0'));exports[_0x291b('0x1')]=function(_0x40b38a){return client[_0x291b('0x2')]('CreateFaxMessage',{'body':_0x40b38a,'log':_0x291b('0x3')});}; \ No newline at end of file +var _0xa26a=['Request','CreateFaxMessage','createFaxMessage','../client'];(function(_0xba1c3f,_0x36514b){var _0x16fcb3=function(_0x5b978b){while(--_0x5b978b){_0xba1c3f['push'](_0xba1c3f['shift']());}};_0x16fcb3(++_0x36514b);}(_0xa26a,0x8b));var _0xaa26=function(_0x5bdb4a,_0x1a1cb0){_0x5bdb4a=_0x5bdb4a-0x0;var _0x51b077=_0xa26a[_0x5bdb4a];return _0x51b077;};'use strict';var client=require(_0xaa26('0x0'));exports['create']=function(_0x731340){return client[_0xaa26('0x1')](_0xaa26('0x2'),{'body':_0x731340,'log':_0xaa26('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 415f055..98fdf55 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 _0x4cb7=['Request','GetFaxQueue','name','strategy','User','Agents','online','faxPause','getFaxQueues'];(function(_0x35cca2,_0x23cd72){var _0x31d6cc=function(_0x9ec593){while(--_0x9ec593){_0x35cca2['push'](_0x35cca2['shift']());}};_0x31d6cc(++_0x23cd72);}(_0x4cb7,0x120));var _0x74cb=function(_0x207c74,_0x5dd38d){_0x207c74=_0x207c74-0x0;var _0x2bd96e=_0x4cb7[_0x207c74];return _0x2bd96e;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x74cb('0x0')](_0x74cb('0x1'),{'options':{'raw':![],'attributes':['id',_0x74cb('0x2'),'timeout',_0x74cb('0x3')],'include':[{'model':_0x74cb('0x4'),'as':_0x74cb('0x5'),'attributes':['id',_0x74cb('0x2'),_0x74cb('0x6'),_0x74cb('0x7')]}]},'log':_0x74cb('0x8')});};}; \ No newline at end of file +var _0x274b=['GetFaxQueue','name','timeout','User','online','../client','getFaxQueues'];(function(_0x5b5cde,_0x1f7c5f){var _0x364ad2=function(_0x4a1172){while(--_0x4a1172){_0x5b5cde['push'](_0x5b5cde['shift']());}};_0x364ad2(++_0x1f7c5f);}(_0x274b,0x9f));var _0xb274=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x274b[_0x3b0731];return _0x4204d7;};'use strict';var client=require(_0xb274('0x0'));exports[_0xb274('0x1')]=function(){return function(){return client['Request'](_0xb274('0x2'),{'options':{'raw':![],'attributes':['id',_0xb274('0x3'),_0xb274('0x4'),'strategy'],'include':[{'model':_0xb274('0x5'),'as':'Agents','attributes':['id',_0xb274('0x3'),_0xb274('0x6'),'faxPause']}]},'log':_0xb274('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 4038f1c..f03266a 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 _0xe10b=['../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x58675f,_0x390355){var _0x1cc7f0=function(_0x31d6d6){while(--_0x31d6d6){_0x58675f['push'](_0x58675f['shift']());}};_0x1cc7f0(++_0x390355);}(_0xe10b,0x1b0));var _0xbe10=function(_0x6b77ed,_0x154679){_0x6b77ed=_0x6b77ed-0x0;var _0x573009=_0xe10b[_0x6b77ed];return _0x573009;};'use strict';var client=require(_0xbe10('0x0'));exports[_0xbe10('0x1')]=function(_0x4170f4){return client[_0xbe10('0x2')](_0xbe10('0x3'),{'body':_0x4170f4,'log':_0xbe10('0x3')});};exports[_0xbe10('0x4')]=function(_0x3cf5f6,_0x242bd8){return client[_0xbe10('0x2')](_0xbe10('0x5'),{'body':_0x242bd8,'options':{'where':{'uniqueid':_0x3cf5f6},'order':[['id','DESC']],'limit':0x1},'log':_0xbe10('0x5')});}; \ No newline at end of file +var _0xd5d2=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','create','Request'];(function(_0x19997d,_0x2c92a4){var _0x49be7f=function(_0x2e5d31){while(--_0x2e5d31){_0x19997d['push'](_0x19997d['shift']());}};_0x49be7f(++_0x2c92a4);}(_0xd5d2,0x154));var _0x2d5d=function(_0x2c8308,_0x16c911){_0x2c8308=_0x2c8308-0x0;var _0x657855=_0xd5d2[_0x2c8308];return _0x657855;};'use strict';var client=require('../client');exports[_0x2d5d('0x0')]=function(_0x361d4a){return client[_0x2d5d('0x1')](_0x2d5d('0x2'),{'body':_0x361d4a,'log':_0x2d5d('0x2')});};exports[_0x2d5d('0x3')]=function(_0x590f02,_0x461c74){return client[_0x2d5d('0x1')](_0x2d5d('0x4'),{'body':_0x461c74,'options':{'where':{'uniqueid':_0x590f02},'order':[['id',_0x2d5d('0x5')]],'limit':0x1},'log':_0x2d5d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index f4b021a..f49106d 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 _0x3266=['Intervals','interval','../client','getIntervals','Request','GetInterval','name','Interval'];(function(_0x37d6fb,_0x11362d){var _0x8cebbd=function(_0x1beeee){while(--_0x1beeee){_0x37d6fb['push'](_0x37d6fb['shift']());}};_0x8cebbd(++_0x11362d);}(_0x3266,0x6a));var _0x6326=function(_0x2afbb0,_0x44f16d){_0x2afbb0=_0x2afbb0-0x0;var _0x411ff2=_0x3266[_0x2afbb0];return _0x411ff2;};'use strict';var client=require(_0x6326('0x0'));exports[_0x6326('0x1')]=function(){return function(){return client[_0x6326('0x2')](_0x6326('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x6326('0x4')],'include':[{'model':_0x6326('0x5'),'as':_0x6326('0x6'),'attributes':['id',_0x6326('0x4'),_0x6326('0x7')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x57f8=['Intervals','interval','getIntervals','Request','GetInterval','name','Interval'];(function(_0x263fec,_0x5dd56d){var _0x5a6cf1=function(_0x5024af){while(--_0x5024af){_0x263fec['push'](_0x263fec['shift']());}};_0x5a6cf1(++_0x5dd56d);}(_0x57f8,0x198));var _0x857f=function(_0x3d7a9f,_0x24e0f1){_0x3d7a9f=_0x3d7a9f-0x0;var _0x13f5f1=_0x57f8[_0x3d7a9f];return _0x13f5f1;};'use strict';var client=require('../client');exports[_0x857f('0x0')]=function(){return function(){return client[_0x857f('0x1')](_0x857f('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x857f('0x3')],'include':[{'model':_0x857f('0x4'),'as':_0x857f('0x5'),'attributes':['id',_0x857f('0x3'),_0x857f('0x6')]}]},'log':_0x857f('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 0fb3aef..653e137 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 _0x1878=['UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x44f91e,_0x47e2eb){var _0x33a0bd=function(_0x6e7327){while(--_0x6e7327){_0x44f91e['push'](_0x44f91e['shift']());}};_0x33a0bd(++_0x47e2eb);}(_0x1878,0x65));var _0x8187=function(_0x125374,_0x102a02){_0x125374=_0x125374-0x0;var _0x200f4d=_0x1878[_0x125374];return _0x200f4d;};'use strict';var client=require(_0x8187('0x0'));exports[_0x8187('0x1')]=function(_0x5b9579,_0x36342c){return client[_0x8187('0x2')](_0x8187('0x3'),{'body':_0x36342c,'options':{'where':{'id':_0x5b9579}},'log':_0x8187('0x4')});};exports[_0x8187('0x5')]=function(_0x23daf7,_0x289f95){return client[_0x8187('0x2')](_0x8187('0x6'),{'body':_0x289f95,'options':{'where':{'id':_0x23daf7}},'log':_0x8187('0x7')});}; \ No newline at end of file +var _0x1e8b=['updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','Request','UpdateMailInteraction'];(function(_0x5e6cc3,_0x1ab921){var _0x3f53a2=function(_0xacd32f){while(--_0xacd32f){_0x5e6cc3['push'](_0x5e6cc3['shift']());}};_0x3f53a2(++_0x1ab921);}(_0x1e8b,0x1e0));var _0xb1e8=function(_0x1b3e21,_0x18ef44){_0x1b3e21=_0x1b3e21-0x0;var _0x5da9fb=_0x1e8b[_0x1b3e21];return _0x5da9fb;};'use strict';var client=require(_0xb1e8('0x0'));exports['update']=function(_0xaed682,_0x5d7a70){return client[_0xb1e8('0x1')](_0xb1e8('0x2'),{'body':_0x5d7a70,'options':{'where':{'id':_0xaed682}},'log':_0xb1e8('0x3')});};exports[_0xb1e8('0x4')]=function(_0x47de99,_0x2913cf){return client[_0xb1e8('0x1')](_0xb1e8('0x5'),{'body':_0x2913cf,'options':{'where':{'id':_0x47de99}},'log':_0xb1e8('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 00a0c2f..809de7a 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 _0xcd56=['create','Request','createMailMessage','../client'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xcd56,0x1df));var _0x6cd5=function(_0x3d9587,_0x589b0c){_0x3d9587=_0x3d9587-0x0;var _0x423787=_0xcd56[_0x3d9587];return _0x423787;};'use strict';var client=require(_0x6cd5('0x0'));exports[_0x6cd5('0x1')]=function(_0x56fcb1){return client[_0x6cd5('0x2')]('CreateMailMessage',{'body':_0x56fcb1,'log':_0x6cd5('0x3')});}; \ No newline at end of file +var _0x421d=['CreateMailMessage','createMailMessage','create','Request'];(function(_0x5a2d95,_0xb362e5){var _0x2c3986=function(_0x5cce7c){while(--_0x5cce7c){_0x5a2d95['push'](_0x5a2d95['shift']());}};_0x2c3986(++_0xb362e5);}(_0x421d,0x19e));var _0xd421=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x421d[_0x3a6efd];return _0x487b9a;};'use strict';var client=require('../client');exports[_0xd421('0x0')]=function(_0x18f55c){return client[_0xd421('0x1')](_0xd421('0x2'),{'body':_0x18f55c,'log':_0xd421('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 3cc6936..2d7c0e0 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 _0x070a=['Agents','online','../client','getMailQueues','GetMailQueue','name','strategy','User'];(function(_0x1eb69f,_0x42ef39){var _0x1d8433=function(_0x4a806d){while(--_0x4a806d){_0x1eb69f['push'](_0x1eb69f['shift']());}};_0x1d8433(++_0x42ef39);}(_0x070a,0x162));var _0xa070=function(_0x1d4f09,_0x1114f0){_0x1d4f09=_0x1d4f09-0x0;var _0x1426fe=_0x070a[_0x1d4f09];return _0x1426fe;};'use strict';var client=require(_0xa070('0x0'));exports[_0xa070('0x1')]=function(){return function(){return client['Request'](_0xa070('0x2'),{'options':{'raw':![],'attributes':['id',_0xa070('0x3'),'timeout',_0xa070('0x4')],'include':[{'model':_0xa070('0x5'),'as':_0xa070('0x6'),'attributes':['id',_0xa070('0x3'),_0xa070('0x7'),'mailPause']}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0xbab8=['timeout','strategy','User','Agents','online','mailPause','getMailQueues','Request','name'];(function(_0x4d12b8,_0x5a3863){var _0x4ba176=function(_0x19a984){while(--_0x19a984){_0x4d12b8['push'](_0x4d12b8['shift']());}};_0x4ba176(++_0x5a3863);}(_0xbab8,0x11d));var _0x8bab=function(_0x3e8b89,_0x167445){_0x3e8b89=_0x3e8b89-0x0;var _0xdb5cac=_0xbab8[_0x3e8b89];return _0xdb5cac;};'use strict';var client=require('../client');exports[_0x8bab('0x0')]=function(){return function(){return client[_0x8bab('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x8bab('0x2'),_0x8bab('0x3'),_0x8bab('0x4')],'include':[{'model':_0x8bab('0x5'),'as':_0x8bab('0x6'),'attributes':['id',_0x8bab('0x2'),_0x8bab('0x7'),_0x8bab('0x8')]}]},'log':_0x8bab('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 41c5889..efa3465 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 _0xc8c3=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client'];(function(_0x732d54,_0x5708f4){var _0x55e766=function(_0x1e9b2f){while(--_0x1e9b2f){_0x732d54['push'](_0x732d54['shift']());}};_0x55e766(++_0x5708f4);}(_0xc8c3,0xc5));var _0x3c8c=function(_0x1b3564,_0x16c919){_0x1b3564=_0x1b3564-0x0;var _0x504069=_0xc8c3[_0x1b3564];return _0x504069;};'use strict';var client=require(_0x3c8c('0x0'));exports['create']=function(_0x395899){return client[_0x3c8c('0x1')](_0x3c8c('0x2'),{'body':_0x395899,'log':_0x3c8c('0x2')});};exports[_0x3c8c('0x3')]=function(_0x5361f9,_0x5ed9e4){return client['Request'](_0x3c8c('0x4'),{'body':_0x5ed9e4,'options':{'where':{'uniqueid':_0x5361f9},'order':[['id',_0x3c8c('0x5')]],'limit':0x1},'log':_0x3c8c('0x4')});}; \ No newline at end of file +var _0x8fef=['update','DESC','UpdateMailQueueReport','../client','create','Request'];(function(_0xcdd54c,_0x457f75){var _0x516226=function(_0x36a27f){while(--_0x36a27f){_0xcdd54c['push'](_0xcdd54c['shift']());}};_0x516226(++_0x457f75);}(_0x8fef,0xc3));var _0xf8fe=function(_0x4831ca,_0x13bbc9){_0x4831ca=_0x4831ca-0x0;var _0x5717a1=_0x8fef[_0x4831ca];return _0x5717a1;};'use strict';var client=require(_0xf8fe('0x0'));exports[_0xf8fe('0x1')]=function(_0x48b3c6){return client[_0xf8fe('0x2')]('CreateMailQueueReport',{'body':_0x48b3c6,'log':'CreateMailQueueReport'});};exports[_0xf8fe('0x3')]=function(_0x2335c3,_0x205ed8){return client['Request']('UpdateMailQueueReport',{'body':_0x205ed8,'options':{'where':{'uniqueid':_0x2335c3},'order':[['id',_0xf8fe('0x4')]],'limit':0x1},'log':_0xf8fe('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index e6123d5..ec95009 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 _0xd1f5=['updateOpenchannelInteraction','addTags','../client','UpdateOpenchannelInteraction'];(function(_0x2cf67d,_0xcd8677){var _0x5132ae=function(_0x378ae5){while(--_0x378ae5){_0x2cf67d['push'](_0x2cf67d['shift']());}};_0x5132ae(++_0xcd8677);}(_0xd1f5,0x1de));var _0x5d1f=function(_0x55f6ac,_0x289e1f){_0x55f6ac=_0x55f6ac-0x0;var _0x2c8148=_0xd1f5[_0x55f6ac];return _0x2c8148;};'use strict';var client=require(_0x5d1f('0x0'));exports['update']=function(_0x28b84c,_0x3caa89){return client['Request'](_0x5d1f('0x1'),{'body':_0x3caa89,'options':{'where':{'id':_0x28b84c}},'log':_0x5d1f('0x2')});};exports[_0x5d1f('0x3')]=function(_0x4bab34,_0x425e1b){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x425e1b,'options':{'where':{'id':_0x4bab34}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xb253=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x1bd742,_0x5e0bde){var _0x552080=function(_0x33d776){while(--_0x33d776){_0x1bd742['push'](_0x1bd742['shift']());}};_0x552080(++_0x5e0bde);}(_0xb253,0x15b));var _0x3b25=function(_0x54b719,_0x39ade5){_0x54b719=_0x54b719-0x0;var _0x31edd9=_0xb253[_0x54b719];return _0x31edd9;};'use strict';var client=require(_0x3b25('0x0'));exports[_0x3b25('0x1')]=function(_0x223d17,_0x18a2ea){return client[_0x3b25('0x2')](_0x3b25('0x3'),{'body':_0x18a2ea,'options':{'where':{'id':_0x223d17}},'log':_0x3b25('0x4')});};exports[_0x3b25('0x5')]=function(_0x340330,_0x1a44b7){return client[_0x3b25('0x2')](_0x3b25('0x6'),{'body':_0x1a44b7,'options':{'where':{'id':_0x340330}},'log':_0x3b25('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 2a7a430..4831e59 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 _0xe14d=['Request','createOpenchannelMessage','../client','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe14d,0x1ee));var _0xde14=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xe14d[_0x56482c];return _0x5aae7a;};'use strict';var client=require(_0xde14('0x0'));exports[_0xde14('0x1')]=function(_0x1b5d3b){return client[_0xde14('0x2')]('CreateOpenchannelMessage',{'body':_0x1b5d3b,'log':_0xde14('0x3')});}; \ No newline at end of file +var _0xf3cd=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x217a1b,_0x6e5981){var _0x4f049a=function(_0x34ad54){while(--_0x34ad54){_0x217a1b['push'](_0x217a1b['shift']());}};_0x4f049a(++_0x6e5981);}(_0xf3cd,0xfe));var _0xdf3c=function(_0xa6df52,_0x1b8584){_0xa6df52=_0xa6df52-0x0;var _0x5edd57=_0xf3cd[_0xa6df52];return _0x5edd57;};'use strict';var client=require(_0xdf3c('0x0'));exports[_0xdf3c('0x1')]=function(_0x31e5a5){return client[_0xdf3c('0x2')](_0xdf3c('0x3'),{'body':_0x31e5a5,'log':_0xdf3c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index e6a7a1b..aa27864 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 _0xebee=['getOpenchannelQueues','Request','name','timeout','Agents','online','openchannelPause'];(function(_0xc13991,_0x765e2){var _0xef622e=function(_0x38f9d9){while(--_0x38f9d9){_0xc13991['push'](_0xc13991['shift']());}};_0xef622e(++_0x765e2);}(_0xebee,0xb6));var _0xeebe=function(_0x1f856f,_0x4c17bd){_0x1f856f=_0x1f856f-0x0;var _0x3cb89b=_0xebee[_0x1f856f];return _0x3cb89b;};'use strict';var client=require('../client');exports[_0xeebe('0x0')]=function(){return function(){return client[_0xeebe('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xeebe('0x2'),_0xeebe('0x3'),'strategy'],'include':[{'model':'User','as':_0xeebe('0x4'),'attributes':['id',_0xeebe('0x2'),_0xeebe('0x5'),_0xeebe('0x6')]}]},'log':_0xeebe('0x0')});};}; \ No newline at end of file +var _0xf542=['User','name','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','strategy'];(function(_0x28b83a,_0x401d6f){var _0x5985d9=function(_0x37d489){while(--_0x37d489){_0x28b83a['push'](_0x28b83a['shift']());}};_0x5985d9(++_0x401d6f);}(_0xf542,0x79));var _0x2f54=function(_0x2d3ebe,_0x13dde7){_0x2d3ebe=_0x2d3ebe-0x0;var _0x39e90c=_0xf542[_0x2d3ebe];return _0x39e90c;};'use strict';var client=require(_0x2f54('0x0'));exports[_0x2f54('0x1')]=function(){return function(){return client[_0x2f54('0x2')](_0x2f54('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x2f54('0x4')],'include':[{'model':_0x2f54('0x5'),'as':'Agents','attributes':['id',_0x2f54('0x6'),_0x2f54('0x7'),_0x2f54('0x8')]}]},'log':_0x2f54('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 82d86c4..4a9c9d4 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 _0x806d=['CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport','DESC','create'];(function(_0x84b1da,_0x3ae92d){var _0x4295d8=function(_0x54f403){while(--_0x54f403){_0x84b1da['push'](_0x84b1da['shift']());}};_0x4295d8(++_0x3ae92d);}(_0x806d,0x1df));var _0xd806=function(_0x3f62ea,_0x4c074b){_0x3f62ea=_0x3f62ea-0x0;var _0x28e191=_0x806d[_0x3f62ea];return _0x28e191;};'use strict';var client=require('../client');exports[_0xd806('0x0')]=function(_0x18a935){return client['Request'](_0xd806('0x1'),{'body':_0x18a935,'log':_0xd806('0x1')});};exports[_0xd806('0x2')]=function(_0x305adc,_0x40cad4){return client[_0xd806('0x3')](_0xd806('0x4'),{'body':_0x40cad4,'options':{'where':{'uniqueid':_0x305adc},'order':[['id',_0xd806('0x5')]],'limit':0x1},'log':_0xd806('0x4')});}; \ No newline at end of file +var _0xfbe4=['CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client','create','Request'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xfbe4,0xf3));var _0x4fbe=function(_0x1f702f,_0x13394f){_0x1f702f=_0x1f702f-0x0;var _0x593636=_0xfbe4[_0x1f702f];return _0x593636;};'use strict';var client=require(_0x4fbe('0x0'));exports[_0x4fbe('0x1')]=function(_0x4213b4){return client[_0x4fbe('0x2')](_0x4fbe('0x3'),{'body':_0x4213b4,'log':_0x4fbe('0x3')});};exports[_0x4fbe('0x4')]=function(_0x52e32d,_0x4f9af9){return client[_0x4fbe('0x2')](_0x4fbe('0x5'),{'body':_0x4f9af9,'options':{'where':{'uniqueid':_0x52e32d},'order':[['id','DESC']],'limit':0x1},'log':_0x4fbe('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index f353059..3c3d6c6 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 _0x7c24=['addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x227051,_0x3dae06){var _0xd9987a=function(_0x41a65d){while(--_0x41a65d){_0x227051['push'](_0x227051['shift']());}};_0xd9987a(++_0x3dae06);}(_0x7c24,0xf9));var _0x47c2=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x7c24[_0x4ae6ef];return _0x3cbb4e;};'use strict';var client=require(_0x47c2('0x0'));exports[_0x47c2('0x1')]=function(_0x293cb0,_0x3110c4){return client[_0x47c2('0x2')](_0x47c2('0x3'),{'body':_0x3110c4,'options':{'where':{'id':_0x293cb0}},'log':_0x47c2('0x4')});};exports[_0x47c2('0x5')]=function(_0x84955,_0x272bab){return client[_0x47c2('0x2')](_0x47c2('0x6'),{'body':_0x272bab,'options':{'where':{'id':_0x84955}},'log':_0x47c2('0x7')});}; \ No newline at end of file +var _0x2313=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','updateSmsInteraction'];(function(_0x2990ed,_0x2ad36a){var _0x1e930a=function(_0x100091){while(--_0x100091){_0x2990ed['push'](_0x2990ed['shift']());}};_0x1e930a(++_0x2ad36a);}(_0x2313,0x145));var _0x3231=function(_0x4d11d5,_0xb50536){_0x4d11d5=_0x4d11d5-0x0;var _0x111b31=_0x2313[_0x4d11d5];return _0x111b31;};'use strict';var client=require(_0x3231('0x0'));exports[_0x3231('0x1')]=function(_0x48002a,_0x4c5ffa){return client[_0x3231('0x2')]('UpdateSmsInteraction',{'body':_0x4c5ffa,'options':{'where':{'id':_0x48002a}},'log':_0x3231('0x3')});};exports[_0x3231('0x4')]=function(_0x1b6fcb,_0x1a49f5){return client[_0x3231('0x2')](_0x3231('0x5'),{'body':_0x1a49f5,'options':{'where':{'id':_0x1b6fcb}},'log':_0x3231('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 4652910..0e259d2 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 _0x338e=['CreateSmsMessage','createSmsMessage','../client','Request'];(function(_0x196c19,_0x4c8d71){var _0x22bf71=function(_0x34e4c1){while(--_0x34e4c1){_0x196c19['push'](_0x196c19['shift']());}};_0x22bf71(++_0x4c8d71);}(_0x338e,0x9a));var _0xe338=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x338e[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xe338('0x0'));exports['create']=function(_0x2df202){return client[_0xe338('0x1')](_0xe338('0x2'),{'body':_0x2df202,'log':_0xe338('0x3')});}; \ No newline at end of file +var _0xc02a=['create','CreateSmsMessage','../client'];(function(_0x1eb786,_0x1b5f72){var _0x460cad=function(_0x3ec7a6){while(--_0x3ec7a6){_0x1eb786['push'](_0x1eb786['shift']());}};_0x460cad(++_0x1b5f72);}(_0xc02a,0x1f1));var _0xac02=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0xc02a[_0x58547b];return _0x1d3fd2;};'use strict';var client=require(_0xac02('0x0'));exports[_0xac02('0x1')]=function(_0x4bdeda){return client['Request'](_0xac02('0x2'),{'body':_0x4bdeda,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 75909cd..03145af 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 _0x1f11=['GetSmsQueue','name','timeout','strategy','User','online','smsPause','getSmsQueues'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1f11,0x137));var _0x11f1=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x1f11[_0x17406a];return _0x1501ff;};'use strict';var client=require('../client');exports[_0x11f1('0x0')]=function(){return function(){return client['Request'](_0x11f1('0x1'),{'options':{'raw':![],'attributes':['id',_0x11f1('0x2'),_0x11f1('0x3'),_0x11f1('0x4')],'include':[{'model':_0x11f1('0x5'),'as':'Agents','attributes':['id',_0x11f1('0x2'),_0x11f1('0x6'),_0x11f1('0x7')]}]},'log':_0x11f1('0x0')});};}; \ No newline at end of file +var _0x6de6=['Request','GetSmsQueue','name','timeout','strategy','online','smsPause','getSmsQueues','../client'];(function(_0x55f9ec,_0x34cbfd){var _0x3a4615=function(_0x3e6262){while(--_0x3e6262){_0x55f9ec['push'](_0x55f9ec['shift']());}};_0x3a4615(++_0x34cbfd);}(_0x6de6,0x19d));var _0x66de=function(_0x57fea6,_0x1aa480){_0x57fea6=_0x57fea6-0x0;var _0x500568=_0x6de6[_0x57fea6];return _0x500568;};'use strict';var client=require(_0x66de('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x66de('0x1')](_0x66de('0x2'),{'options':{'raw':![],'attributes':['id',_0x66de('0x3'),_0x66de('0x4'),_0x66de('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x66de('0x6'),_0x66de('0x7')]}]},'log':_0x66de('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index b813cbb..6528866 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 _0xc465=['CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client','create','Request'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xc465,0x100));var _0x5c46=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc465[_0x5d6456];return _0x4d66c1;};'use strict';var client=require(_0x5c46('0x0'));exports[_0x5c46('0x1')]=function(_0x1104f3){return client[_0x5c46('0x2')](_0x5c46('0x3'),{'body':_0x1104f3,'log':_0x5c46('0x3')});};exports[_0x5c46('0x4')]=function(_0x2e454d,_0x2f16dc){return client['Request'](_0x5c46('0x5'),{'body':_0x2f16dc,'options':{'where':{'uniqueid':_0x2e454d},'order':[['id',_0x5c46('0x6')]],'limit':0x1},'log':_0x5c46('0x5')});}; \ No newline at end of file +var _0x6df9=['update','UpdateSmsQueueReport','../client','create','Request'];(function(_0xeeb60e,_0x229d0c){var _0x1c83a0=function(_0x1ec96a){while(--_0x1ec96a){_0xeeb60e['push'](_0xeeb60e['shift']());}};_0x1c83a0(++_0x229d0c);}(_0x6df9,0x84));var _0x96df=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6df9[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0x96df('0x0'));exports[_0x96df('0x1')]=function(_0x5e6620){return client[_0x96df('0x2')]('CreateSmsQueueReport',{'body':_0x5e6620,'log':'CreateSmsQueueReport'});};exports[_0x96df('0x3')]=function(_0x567151,_0x2a8e72){return client['Request'](_0x96df('0x4'),{'body':_0x2a8e72,'options':{'where':{'uniqueid':_0x567151},'order':[['id','DESC']],'limit':0x1},'log':_0x96df('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 11050e2..d0c73f6 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 _0x37f6=['getAgents','Request','GetUser','pauseType','lastPauseAt','chatPause','faxPause','openchannelPause','mailCapacity','faxCapacity','smsCapacity','../client'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x37f6,0x14f));var _0x637f=function(_0x4a423e,_0x59ba7b){_0x4a423e=_0x4a423e-0x0;var _0x4ad91f=_0x37f6[_0x4a423e];return _0x4ad91f;};'use strict';var client=require(_0x637f('0x0'));exports[_0x637f('0x1')]=function(){return function(){return client[_0x637f('0x2')](_0x637f('0x3'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id','name','online',_0x637f('0x4'),_0x637f('0x5'),'voicePause',_0x637f('0x6'),'mailPause',_0x637f('0x7'),'smsPause',_0x637f('0x8'),'chatCapacity',_0x637f('0x9'),_0x637f('0xa'),_0x637f('0xb'),'openchannelCapacity']},'log':_0x637f('0x1')});};}; \ No newline at end of file +var _0x52a0=['smsCapacity','openchannelCapacity','getAgents','GetUser','agent','name','online','pauseType','voicePause','chatPause','mailPause','faxPause','smsPause','chatCapacity','mailCapacity','faxCapacity'];(function(_0x460013,_0x2ebc73){var _0x55924f=function(_0x496483){while(--_0x496483){_0x460013['push'](_0x460013['shift']());}};_0x55924f(++_0x2ebc73);}(_0x52a0,0xc2));var _0x052a=function(_0x188cc8,_0xd39746){_0x188cc8=_0x188cc8-0x0;var _0x4cb155=_0x52a0[_0x188cc8];return _0x4cb155;};'use strict';var client=require('../client');exports[_0x052a('0x0')]=function(){return function(){return client['Request'](_0x052a('0x1'),{'options':{'raw':!![],'where':{'role':_0x052a('0x2')},'attributes':['id',_0x052a('0x3'),_0x052a('0x4'),_0x052a('0x5'),'lastPauseAt',_0x052a('0x6'),_0x052a('0x7'),_0x052a('0x8'),_0x052a('0x9'),_0x052a('0xa'),'openchannelPause',_0x052a('0xb'),_0x052a('0xc'),_0x052a('0xd'),_0x052a('0xe'),_0x052a('0xf')]},'log':'getAgents'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index d105842..44c9bdc 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 _0x20ce=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request'];(function(_0x21a6fd,_0x2e9f6f){var _0x145e48=function(_0x5ccbc9){while(--_0x5ccbc9){_0x21a6fd['push'](_0x21a6fd['shift']());}};_0x145e48(++_0x2e9f6f);}(_0x20ce,0x10d));var _0xe20c=function(_0x13ef16,_0x3d32c8){_0x13ef16=_0x13ef16-0x0;var _0x559645=_0x20ce[_0x13ef16];return _0x559645;};'use strict';var client=require(_0xe20c('0x0'));exports[_0xe20c('0x1')]=function(_0x29e017,_0x597c57){return client[_0xe20c('0x2')](_0xe20c('0x3'),{'body':_0x597c57,'options':{'where':{'id':_0x29e017}},'log':_0xe20c('0x4')});};exports[_0xe20c('0x5')]=function(_0x7e5160,_0x23f743){return client[_0xe20c('0x2')](_0xe20c('0x6'),{'body':_0x23f743,'options':{'where':{'id':_0x7e5160}},'log':_0xe20c('0x7')});}; \ No newline at end of file +var _0xa3e6=['UpdateWhatsappInteraction','updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','Request'];(function(_0x1de91a,_0x2802b6){var _0x120be2=function(_0x1d0fb1){while(--_0x1d0fb1){_0x1de91a['push'](_0x1de91a['shift']());}};_0x120be2(++_0x2802b6);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x595d09,_0x3ce6e2){_0x595d09=_0x595d09-0x0;var _0x4a2ca9=_0xa3e6[_0x595d09];return _0x4a2ca9;};'use strict';var client=require(_0x6a3e('0x0'));exports['update']=function(_0x20fedf,_0x479726){return client[_0x6a3e('0x1')](_0x6a3e('0x2'),{'body':_0x479726,'options':{'where':{'id':_0x20fedf}},'log':_0x6a3e('0x3')});};exports['addTags']=function(_0xe03261,_0x5e9a85){return client[_0x6a3e('0x1')](_0x6a3e('0x4'),{'body':_0x5e9a85,'options':{'where':{'id':_0xe03261}},'log':_0x6a3e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index ab7083a..71d7a5c 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 _0x783f=['../client'];(function(_0x21cb79,_0x47056c){var _0x231681=function(_0xa08434){while(--_0xa08434){_0x21cb79['push'](_0x21cb79['shift']());}};_0x231681(++_0x47056c);}(_0x783f,0x19c));var _0xf783=function(_0x7b2e5c,_0x10694c){_0x7b2e5c=_0x7b2e5c-0x0;var _0x1621d4=_0x783f[_0x7b2e5c];return _0x1621d4;};'use strict';var client=require(_0xf783('0x0'));exports['create']=function(_0xba53e1){return client['Request']('CreateWhatsappMessage',{'body':_0xba53e1,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xd899=['create','Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x43bbcc,_0x5c870d){var _0x3bd688=function(_0x1cdeb6){while(--_0x1cdeb6){_0x43bbcc['push'](_0x43bbcc['shift']());}};_0x3bd688(++_0x5c870d);}(_0xd899,0x158));var _0x9d89=function(_0x450b1e,_0x254647){_0x450b1e=_0x450b1e-0x0;var _0x7e9b48=_0xd899[_0x450b1e];return _0x7e9b48;};'use strict';var client=require(_0x9d89('0x0'));exports[_0x9d89('0x1')]=function(_0x2c4dba){return client[_0x9d89('0x2')](_0x9d89('0x3'),{'body':_0x2c4dba,'log':_0x9d89('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 8716fd2..19d1ad3 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 _0xe605=['timeout','strategy','User','Agents','online','whatsappPause','../client','getWhatsappQueues','GetWhatsappQueue','name'];(function(_0x4a44e8,_0x5990d3){var _0x1f48e5=function(_0x4233aa){while(--_0x4233aa){_0x4a44e8['push'](_0x4a44e8['shift']());}};_0x1f48e5(++_0x5990d3);}(_0xe605,0x92));var _0x5e60=function(_0x3d0857,_0x556b67){_0x3d0857=_0x3d0857-0x0;var _0x28eadd=_0xe605[_0x3d0857];return _0x28eadd;};'use strict';var client=require(_0x5e60('0x0'));exports[_0x5e60('0x1')]=function(){return function(){return client['Request'](_0x5e60('0x2'),{'options':{'raw':![],'attributes':['id',_0x5e60('0x3'),_0x5e60('0x4'),_0x5e60('0x5')],'include':[{'model':_0x5e60('0x6'),'as':_0x5e60('0x7'),'attributes':['id',_0x5e60('0x3'),_0x5e60('0x8'),_0x5e60('0x9')]}]},'log':_0x5e60('0x1')});};}; \ No newline at end of file +var _0x8580=['GetWhatsappQueue','strategy','User','name','online','getWhatsappQueues'];(function(_0x5d8fc8,_0x46fb34){var _0x1427a8=function(_0x427b71){while(--_0x427b71){_0x5d8fc8['push'](_0x5d8fc8['shift']());}};_0x1427a8(++_0x46fb34);}(_0x8580,0x1c7));var _0x0858=function(_0x2eec0d,_0x43565a){_0x2eec0d=_0x2eec0d-0x0;var _0x2c8259=_0x8580[_0x2eec0d];return _0x2c8259;};'use strict';var client=require('../client');exports[_0x0858('0x0')]=function(){return function(){return client['Request'](_0x0858('0x1'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x0858('0x2')],'include':[{'model':_0x0858('0x3'),'as':'Agents','attributes':['id',_0x0858('0x4'),_0x0858('0x5'),'whatsappPause']}]},'log':_0x0858('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 2e9f86b..e45e96a 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 _0xc424=['DESC','../client','create','CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport'];(function(_0x32fe3c,_0x45d88f){var _0x52694b=function(_0x138cd9){while(--_0x138cd9){_0x32fe3c['push'](_0x32fe3c['shift']());}};_0x52694b(++_0x45d88f);}(_0xc424,0xe1));var _0x4c42=function(_0x406406,_0x42b7e3){_0x406406=_0x406406-0x0;var _0x2d7d9b=_0xc424[_0x406406];return _0x2d7d9b;};'use strict';var client=require(_0x4c42('0x0'));exports[_0x4c42('0x1')]=function(_0x271aa3){return client['Request'](_0x4c42('0x2'),{'body':_0x271aa3,'log':_0x4c42('0x2')});};exports[_0x4c42('0x3')]=function(_0x2988e5,_0x13772f){return client[_0x4c42('0x4')](_0x4c42('0x5'),{'body':_0x13772f,'options':{'where':{'uniqueid':_0x2988e5},'order':[['id',_0x4c42('0x6')]],'limit':0x1},'log':_0x4c42('0x5')});}; \ No newline at end of file +var _0x2b27=['DESC','UpdateWhatsappQueueReport','../client','create','CreateWhatsappQueueReport','update'];(function(_0x21cb7f,_0x48cd16){var _0x5a079a=function(_0x569a4f){while(--_0x569a4f){_0x21cb7f['push'](_0x21cb7f['shift']());}};_0x5a079a(++_0x48cd16);}(_0x2b27,0x176));var _0x72b2=function(_0x448bab,_0x25517b){_0x448bab=_0x448bab-0x0;var _0x5dc534=_0x2b27[_0x448bab];return _0x5dc534;};'use strict';var client=require(_0x72b2('0x0'));exports[_0x72b2('0x1')]=function(_0x29b307){return client['Request'](_0x72b2('0x2'),{'body':_0x29b307,'log':_0x72b2('0x2')});};exports[_0x72b2('0x3')]=function(_0x3e6715,_0x4cda36){return client['Request']('UpdateWhatsappQueueReport',{'body':_0x4cda36,'options':{'where':{'uniqueid':_0x3e6715},'order':[['id',_0x72b2('0x4')]],'limit':0x1},'log':_0x72b2('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index f2784f3..eb9c66f 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 _0xcbc1=['log','[%s][QUEUE]\x20%s','stack','validate','util','../../../../config/logger','routing','./strategy','string','number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','message','join','find','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stop'];(function(_0x56a469,_0x26a28d){var _0x288cb5=function(_0x57593c){while(--_0x57593c){_0x56a469['push'](_0x56a469['shift']());}};_0x288cb5(++_0x26a28d);}(_0xcbc1,0x1d7));var _0x1cbc=function(_0x45e725,_0x452382){_0x45e725=_0x45e725-0x0;var _0x1346a1=_0xcbc1[_0x45e725];return _0x1346a1;};'use strict';var schema=require(_0x1cbc('0x0'));var _=require('lodash');var util=require(_0x1cbc('0x1'));var seqqueue=require('seq-queue');var logger=require(_0x1cbc('0x2'))(_0x1cbc('0x3'));var strategy=require(_0x1cbc('0x4'));var queue=schema({'name':{'type':_0x1cbc('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x1cbc('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x36c1a6,_0x3303b2,_0x2face2){return logger[_0x1cbc('0x7')](util['format'](_0x1cbc('0x8'),_0x36c1a6,_0x3303b2['name'],_0x2face2));}function handleFindAgent(_0x2f5a5e){return function(_0x594bec){return _0x594bec[_0x1cbc('0x9')][_0x1cbc('0xa')]()===_0x2f5a5e[_0x1cbc('0xa')]();};}exports['consequence']=function(_0x390f27,_0x47c6e2,_0x30efd7,_0x2c7bd2){return function(_0x5593e7){try{var _0x2c9044={'name':_0x47c6e2[0x0],'timeout':_0x47c6e2[0x1]};var _0x35704c=queue[_0x1cbc('0x0')](_0x2c9044,{'typecast':!![]});if(_0x35704c[_0x1cbc('0xb')]){logger[_0x1cbc('0xc')](_0x1cbc('0xd'),_0x390f27,_[_0x1cbc('0xe')](_0x35704c,_0x1cbc('0xf'))[_0x1cbc('0x10')](',\x20'));_0x5593e7['stop']();}else{var _0x5d0054=_[_0x1cbc('0x11')](_0x30efd7['agents'],handleFindAgent(_0x2c9044['name']));if(_0x5d0054){var _0x410e01=(_0x2c9044[_0x1cbc('0x12')]||0xa)*0x3e8;var _0xdc5b8b,_0x47be79;var _0x2c1312=seqqueue[_0x1cbc('0x13')](_0x410e01);_0x2c1312['id']=_0x390f27;_0x2c1312[_0x1cbc('0x14')]=_0x410e01;_0x2c1312['channel']=_0x2c7bd2[_0x1cbc('0x15')];writeLog(_0x390f27,_0x5d0054,util['format'](_0x1cbc('0x16'),_0x410e01));_0x30efd7[_0x1cbc('0x17')][_0x390f27]['on'](_0x1cbc('0x18'),function(){logger[_0x1cbc('0x7')](_0x1cbc('0x19'),_0x390f27);clearTimeout(_0x47be79);_0x47be79=undefined;_0x2c1312[_0x1cbc('0x1a')]();if(_0x30efd7[_0x1cbc('0x17')][_0x390f27]){delete _0x30efd7[_0x1cbc('0x17')][_0x390f27];}_0x5593e7['stop']();});_0x30efd7[_0x1cbc('0x17')][_0x390f27]['on'](_0x1cbc('0x1b'),function(){if(_0x30efd7['rules'][_0x390f27]){delete _0x30efd7[_0x1cbc('0x17')][_0x390f27];}});_0x47be79=setTimeout(function(){logger['info'](_0x1cbc('0x1c'),_0x390f27);clearTimeout(_0x47be79);_0x2c1312[_0x1cbc('0x1a')]();_0x5593e7[_0x1cbc('0x1d')]();},_0x410e01);strategy[_0x1cbc('0x1e')](_0x2c1312,_0x5d0054,_0x30efd7,_0x2c7bd2);}else{logger[_0x1cbc('0xc')](_0x1cbc('0x1f'),_0x390f27,_0x2c9044[_0x1cbc('0x9')]);_0x5593e7[_0x1cbc('0x20')]();}}}catch(_0x42d662){console[_0x1cbc('0x21')](_0x42d662);logger[_0x1cbc('0xc')](_0x1cbc('0x22'),_0x390f27,_0x42d662[_0x1cbc('0x23')]);_0x5593e7[_0x1cbc('0x20')]();}};}; \ No newline at end of file +var _0x980f=['util','seq-queue','../../../../config/logger','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','close','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','validate','lodash'];(function(_0x4c5fcc,_0x338b2d){var _0x1a93ee=function(_0x1dcef3){while(--_0x1dcef3){_0x4c5fcc['push'](_0x4c5fcc['shift']());}};_0x1a93ee(++_0x338b2d);}(_0x980f,0x8a));var _0xf980=function(_0x1fc18b,_0x13d27d){_0x1fc18b=_0x1fc18b-0x0;var _0x16a351=_0x980f[_0x1fc18b];return _0x16a351;};'use strict';var schema=require(_0xf980('0x0'));var _=require(_0xf980('0x1'));var util=require(_0xf980('0x2'));var seqqueue=require(_0xf980('0x3'));var logger=require(_0xf980('0x4'))('routing');var strategy=require(_0xf980('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':_0xf980('0x6')},'timeout':{'type':_0xf980('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x403c3c,_0x3ad08e,_0x9cd6f1){return logger[_0xf980('0x8')](util[_0xf980('0x9')](_0xf980('0xa'),_0x403c3c,_0x3ad08e['name'],_0x9cd6f1));}function handleFindAgent(_0x2a64ba){return function(_0x2b541b){return _0x2b541b[_0xf980('0xb')]['toLowerCase']()===_0x2a64ba[_0xf980('0xc')]();};}exports['consequence']=function(_0x5e72e4,_0x387998,_0x3988fa,_0x4735b0){return function(_0x1d2786){try{var _0x32b98b={'name':_0x387998[0x0],'timeout':_0x387998[0x1]};var _0x2db7f4=queue[_0xf980('0x0')](_0x32b98b,{'typecast':!![]});if(_0x2db7f4[_0xf980('0xd')]){logger[_0xf980('0xe')](_0xf980('0xf'),_0x5e72e4,_[_0xf980('0x10')](_0x2db7f4,_0xf980('0x11'))[_0xf980('0x12')](',\x20'));_0x1d2786[_0xf980('0x13')]();}else{var _0x3c03de=_[_0xf980('0x14')](_0x3988fa[_0xf980('0x15')],handleFindAgent(_0x32b98b[_0xf980('0xb')]));if(_0x3c03de){var _0x29674d=(_0x32b98b[_0xf980('0x16')]||0xa)*0x3e8;var _0x539ff0,_0x543bce;var _0x311fe5=seqqueue[_0xf980('0x17')](_0x29674d);_0x311fe5['id']=_0x5e72e4;_0x311fe5[_0xf980('0x18')]=_0x29674d;_0x311fe5[_0xf980('0x19')]=_0x4735b0[_0xf980('0x19')];writeLog(_0x5e72e4,_0x3c03de,util[_0xf980('0x9')](_0xf980('0x1a'),_0x29674d));_0x3988fa[_0xf980('0x1b')][_0x5e72e4]['on'](_0xf980('0x1c'),function(){logger[_0xf980('0x8')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x5e72e4);clearTimeout(_0x543bce);_0x543bce=undefined;_0x311fe5[_0xf980('0x1d')]();if(_0x3988fa[_0xf980('0x1b')][_0x5e72e4]){delete _0x3988fa[_0xf980('0x1b')][_0x5e72e4];}_0x1d2786['stop']();});_0x3988fa['rules'][_0x5e72e4]['on']('complete',function(){if(_0x3988fa[_0xf980('0x1b')][_0x5e72e4]){delete _0x3988fa['rules'][_0x5e72e4];}});_0x543bce=setTimeout(function(){logger[_0xf980('0x8')](_0xf980('0x1e'),_0x5e72e4);clearTimeout(_0x543bce);_0x311fe5[_0xf980('0x1d')]();_0x1d2786[_0xf980('0x1f')]();},_0x29674d);strategy[_0xf980('0x20')](_0x311fe5,_0x3c03de,_0x3988fa,_0x4735b0);}else{logger[_0xf980('0xe')](_0xf980('0x21'),_0x5e72e4,_0x32b98b[_0xf980('0xb')]);_0x1d2786[_0xf980('0x13')]();}}}catch(_0x54047d){console['log'](_0x54047d);logger[_0xf980('0xe')](_0xf980('0x22'),_0x5e72e4,_0x54047d['stack']);_0x1d2786[_0xf980('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 9eda1b1..f7f10bb 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 _0xd0b1=['out','channel','account','AccountId','upperFirst','InteractionId','created','isEmpty','Message','create','then','body','catch','error','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','toString','postText','amazonlex','dialogState','stringify','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x956b4,_0x487111){var _0xd04e72=function(_0x3b0314){while(--_0x3b0314){_0x956b4['push'](_0x956b4['shift']());}};_0xd04e72(++_0x487111);}(_0xd0b1,0x13e));var _0x1d0b=function(_0x517218,_0x109ea6){_0x517218=_0x517218-0x0;var _0x2b56fe=_0xd0b1[_0x517218];return _0x2b56fe;};'use strict';var _=require('lodash');var moment=require(_0x1d0b('0x0'));var AWS=require(_0x1d0b('0x1'));var utils=require('./utils');var logger=require(_0x1d0b('0x2'))(_0x1d0b('0x3'));var rpc={'chatMessage':require(_0x1d0b('0x4')),'openchannelMessage':require(_0x1d0b('0x5')),'mailMessage':require(_0x1d0b('0x6')),'smsMessage':require(_0x1d0b('0x7')),'faxMessage':require(_0x1d0b('0x8'))};exports[_0x1d0b('0x9')]=function(_0x4eae09,_0x2f9a08){return function(_0x21f09f){try{if(!_[_0x1d0b('0xa')](this[_0x1d0b('0xb')][_0x1d0b('0xc')])){logger[_0x1d0b('0xd')](_0x1d0b('0xe'),_0x4eae09,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x21f09f[_0x1d0b('0xf')]();}var _0x36b244={'ContactId':this['contact']['id'],'sentAt':moment()[_0x1d0b('0x10')](_0x1d0b('0x11')),'direction':_0x1d0b('0x12')};var _0x550ecf=this[_0x1d0b('0x13')];if(_0x550ecf==='chat'){_0x36b244['ChatWebsiteId']=this[_0x1d0b('0x14')]['id'];}else{_0x36b244[_['upperFirst'](_0x550ecf)+_0x1d0b('0x15')]=this[_0x1d0b('0x14')]['id'];}_0x36b244[_[_0x1d0b('0x16')](_0x550ecf)+_0x1d0b('0x17')]=this['interaction']['id'];if(this[_0x1d0b('0xb')][_0x1d0b('0x18')]){var _0x5a0823=_0x2f9a08[0x4];if(!_[_0x1d0b('0x19')](_0x5a0823)){_0x36b244['body']=utils['getMustacheRender'](_0x5a0823,this);return rpc[_0x550ecf+_0x1d0b('0x1a')][_0x1d0b('0x1b')](_0x36b244)[_0x1d0b('0x1c')](function(_0x35fcb3){logger[_0x1d0b('0xd')](_0x1d0b('0xe'),_0x4eae09,_0x36b244[_0x1d0b('0x1d')]);})[_0x1d0b('0x1e')](function(_0x2bce38){logger[_0x1d0b('0x1f')](_0x1d0b('0xe'),_0x4eae09,JSON['stringify'](_0x2bce38));})['finally'](function(){logger[_0x1d0b('0xd')](_0x1d0b('0x20'),_0x4eae09);_0x21f09f['stop']();});}else{logger[_0x1d0b('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x4eae09);_0x21f09f[_0x1d0b('0x21')]();}}else{var _0x27be3=this;var _0x57be78=new AWS[(_0x1d0b('0x22'))]({'accessKeyId':_0x2f9a08[0x0],'secretAccessKey':_0x2f9a08[0x1],'region':_0x2f9a08[0x2]});var _0x54a038={'botAlias':_0x1d0b('0x23'),'botName':_0x2f9a08[0x3],'inputText':this[_0x1d0b('0x24')][_0x1d0b('0x1d')],'userId':this[_0x1d0b('0xb')]['id'][_0x1d0b('0x25')]()};_0x57be78[_0x1d0b('0x26')](_0x54a038,function(_0x48dbb8,_0x4ec3d6){if(_0x48dbb8){logger[_0x1d0b('0x1f')](_0x1d0b('0xe'),_0x4eae09,_0x48dbb8[_0x1d0b('0x24')]);_0x21f09f[_0x1d0b('0xf')]();}else if(_0x4ec3d6&&_0x4ec3d6[_0x1d0b('0x24')]){_0x27be3[_0x1d0b('0x1d')][_0x1d0b('0x27')]=_0x4ec3d6;_0x36b244[_0x1d0b('0x1d')]=_0x4ec3d6[_0x1d0b('0x24')];return rpc[_0x550ecf+'Message'][_0x1d0b('0x1b')](_0x36b244)['then'](function(_0x23712b){logger['info']('[%s][AMAZONLEX]\x20%s',_0x4eae09,_0x36b244['body']);if(_0x4ec3d6[_0x1d0b('0x28')]=='Failed'){_0x21f09f[_0x1d0b('0xf')]();}else{_0x21f09f[_0x1d0b('0x21')]();}})[_0x1d0b('0x1e')](function(_0x5806ef){logger[_0x1d0b('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x4eae09,JSON['stringify'](_0x5806ef));_0x21f09f[_0x1d0b('0xf')]();});}else{_0x21f09f[_0x1d0b('0xf')]();}});}}catch(_0x25ddcb){logger['error'](_0x1d0b('0xe'),_0x4eae09,JSON[_0x1d0b('0x29')](_0x25ddcb));_0x21f09f['stop']();}};}; \ No newline at end of file +var _0xaf41=['lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/faxMessage','consequence','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','ChatWebsiteId','upperFirst','AccountId','account','created','isEmpty','getMustacheRender','Message','create','body','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','postText','amazonlex','then','dialogState','catch','error'];(function(_0x3c5e54,_0x2b991b){var _0x3ae1f3=function(_0x43f80f){while(--_0x43f80f){_0x3c5e54['push'](_0x3c5e54['shift']());}};_0x3ae1f3(++_0x2b991b);}(_0xaf41,0x1ec));var _0x1af4=function(_0x42e4f9,_0x45f8d8){_0x42e4f9=_0x42e4f9-0x0;var _0x3f7afb=_0xaf41[_0x42e4f9];return _0x3f7afb;};'use strict';var _=require(_0x1af4('0x0'));var moment=require(_0x1af4('0x1'));var AWS=require(_0x1af4('0x2'));var utils=require(_0x1af4('0x3'));var logger=require(_0x1af4('0x4'))(_0x1af4('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x1af4('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x1af4('0x7'))};exports[_0x1af4('0x8')]=function(_0x366e34,_0x5f13cf){return function(_0x59596d){try{if(!_['isNil'](this[_0x1af4('0x9')]['UserId'])){logger[_0x1af4('0xa')](_0x1af4('0xb'),_0x366e34,_0x1af4('0xc'));return _0x59596d[_0x1af4('0xd')]();}var _0x587d8b={'ContactId':this[_0x1af4('0xe')]['id'],'sentAt':moment()[_0x1af4('0xf')](_0x1af4('0x10')),'direction':'out'};var _0x483041=this['channel'];if(_0x483041==='chat'){_0x587d8b[_0x1af4('0x11')]=this['account']['id'];}else{_0x587d8b[_[_0x1af4('0x12')](_0x483041)+_0x1af4('0x13')]=this[_0x1af4('0x14')]['id'];}_0x587d8b[_['upperFirst'](_0x483041)+'InteractionId']=this[_0x1af4('0x9')]['id'];if(this[_0x1af4('0x9')][_0x1af4('0x15')]){var _0x3c4af2=_0x5f13cf[0x4];if(!_[_0x1af4('0x16')](_0x3c4af2)){_0x587d8b['body']=utils[_0x1af4('0x17')](_0x3c4af2,this);return rpc[_0x483041+_0x1af4('0x18')][_0x1af4('0x19')](_0x587d8b)['then'](function(_0x156ba9){logger['info'](_0x1af4('0xb'),_0x366e34,_0x587d8b[_0x1af4('0x1a')]);})['catch'](function(_0x3afe01){logger['error']('[%s][AMAZONLEX]\x20%s',_0x366e34,JSON[_0x1af4('0x1b')](_0x3afe01));})[_0x1af4('0x1c')](function(){logger[_0x1af4('0xa')](_0x1af4('0x1d'),_0x366e34);_0x59596d['stop']();});}else{logger[_0x1af4('0xa')](_0x1af4('0x1e'),_0x366e34);_0x59596d[_0x1af4('0x1f')]();}}else{var _0x1174ae=this;var _0x31fedf=new AWS[(_0x1af4('0x20'))]({'accessKeyId':_0x5f13cf[0x0],'secretAccessKey':_0x5f13cf[0x1],'region':_0x5f13cf[0x2]});var _0x4cdcfc={'botAlias':_0x1af4('0x21'),'botName':_0x5f13cf[0x3],'inputText':this[_0x1af4('0x22')][_0x1af4('0x1a')],'userId':this['interaction']['id']['toString']()};_0x31fedf[_0x1af4('0x23')](_0x4cdcfc,function(_0x110b2e,_0x1f7b54){if(_0x110b2e){logger['error']('[%s][AMAZONLEX]\x20%s',_0x366e34,_0x110b2e[_0x1af4('0x22')]);_0x59596d[_0x1af4('0xd')]();}else if(_0x1f7b54&&_0x1f7b54['message']){_0x1174ae[_0x1af4('0x1a')][_0x1af4('0x24')]=_0x1f7b54;_0x587d8b[_0x1af4('0x1a')]=_0x1f7b54[_0x1af4('0x22')];return rpc[_0x483041+'Message'][_0x1af4('0x19')](_0x587d8b)[_0x1af4('0x25')](function(_0x4320a8){logger[_0x1af4('0xa')](_0x1af4('0xb'),_0x366e34,_0x587d8b['body']);if(_0x1f7b54[_0x1af4('0x26')]=='Failed'){_0x59596d[_0x1af4('0xd')]();}else{_0x59596d[_0x1af4('0x1f')]();}})[_0x1af4('0x27')](function(_0x545ed5){logger[_0x1af4('0x28')](_0x1af4('0xb'),_0x366e34,JSON[_0x1af4('0x1b')](_0x545ed5));_0x59596d[_0x1af4('0xd')]();});}else{_0x59596d['next']();}});}}catch(_0x170382){logger[_0x1af4('0x28')](_0x1af4('0xb'),_0x366e34,JSON[_0x1af4('0x1b')](_0x170382));_0x59596d[_0x1af4('0x1f')]();}};}; \ 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 6170e6a..c5890f9 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 _0xe706=['next','channel','getMustacheRender','YYYY-MM-DD\x20HH:mm:ss','out','message','from','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','Message','Smtp','service','host','port','secure','auth','user','pass','inReplyTo','messageId','html','','replace','body','';return mailRpc[_0x6e70('0x33')](_0x228350,_0x37b3e0)['then'](function(_0x259486){logger['info'](_0x6e70('0x34'),_0x1b0389);_0x37b3e0[_0x6e70('0x2c')]=_0x259486[_0x6e70('0x16')]['messageId'];return rpc[_0x743eb5+_0x6e70('0x22')][_0x6e70('0x35')](_0x37b3e0);})['then'](function(_0x13d673){logger[_0x6e70('0xe')]('[%s][AUTOREPLY]\x20%s',_0x1b0389,JSON[_0x6e70('0x36')](_0x13d673));})[_0x6e70('0x37')](function(_0x2d52bd){logger[_0x6e70('0x38')](_0x6e70('0x39'),_0x1b0389,JSON[_0x6e70('0x36')](_0x2d52bd));})[_0x6e70('0x3a')](function(){_0x36357b[_0x6e70('0x11')]();});}else{return rpc[this[_0x6e70('0x12')]+_0x6e70('0x22')]['create'](_0x37b3e0)[_0x6e70('0x3b')](function(_0x4795a0){logger[_0x6e70('0xe')](_0x6e70('0xf'),_0x1b0389,_0x37b3e0[_0x6e70('0x30')]);})[_0x6e70('0x37')](function(_0x233a83){logger[_0x6e70('0x38')](_0x6e70('0xf'),_0x1b0389,JSON[_0x6e70('0x36')](_0x233a83));})[_0x6e70('0x3a')](function(){_0x36357b[_0x6e70('0x11')]();});}}}catch(_0x2a5444){logger[_0x6e70('0x38')](_0x6e70('0xf'),_0x1b0389,JSON['stringify'](_0x2a5444));_0x36357b['stop']();}};}; \ No newline at end of file +var _0xd8b0=['upperFirst','AccountId','InteractionId','Message','service','Smtp','host','port','secure','pass','html','replace','','messageId','create','then','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','lodash','moment','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','contact','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','startsWith','Re:','chat','ChatWebsiteId','account'];(function(_0x119ded,_0x497e72){var _0x22108b=function(_0x3da0cf){while(--_0x3da0cf){_0x119ded['push'](_0x119ded['shift']());}};_0x22108b(++_0x497e72);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x0d8b('0x2')),'openchannelMessage':require(_0x0d8b('0x3')),'mailMessage':require(_0x0d8b('0x4')),'smsMessage':require(_0x0d8b('0x5')),'faxMessage':require(_0x0d8b('0x6'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x3f8b6f,_0x227c63){return function(_0x39f43a){try{if(_0x227c63[0x0]==='1'&&(_['isNil'](this[_0x0d8b('0x7')][_0x0d8b('0x8')])||!this['interaction'][_0x0d8b('0x8')])){logger[_0x0d8b('0x9')](_0x0d8b('0xa'),_0x3f8b6f,_0x0d8b('0xb'));return _0x39f43a[_0x0d8b('0xc')]();}var _0x1cac62=this[_0x0d8b('0xd')];var _0x28f87c={'body':utils['getMustacheRender'](_0x227c63[0x1],this),'ContactId':this[_0x0d8b('0xe')]['id'],'sentAt':moment()['format'](_0x0d8b('0xf')),'direction':_0x0d8b('0x10')};if(this[_0x0d8b('0x11')]){_0x28f87c['to']=this[_0x0d8b('0x11')][_0x0d8b('0x12')]||'';_0x28f87c['cc']=this[_0x0d8b('0x11')]['cc']||'';_0x28f87c[_0x0d8b('0x12')]=this[_0x0d8b('0x11')]['to']||'';_0x28f87c[_0x0d8b('0x13')]=this[_0x0d8b('0x11')][_0x0d8b('0x13')]||'';_0x28f87c[_0x0d8b('0x14')]=!![];if(this[_0x0d8b('0x11')][_0x0d8b('0x15')]){_0x28f87c['subject']='';_0x28f87c[_0x0d8b('0x15')]+=_[_0x0d8b('0x16')](this[_0x0d8b('0x11')][_0x0d8b('0x15')],_0x0d8b('0x17'))?'':'Re:\x20';_0x28f87c[_0x0d8b('0x15')]+=this[_0x0d8b('0x11')][_0x0d8b('0x15')];}}if(this[_0x0d8b('0xd')]===_0x0d8b('0x18')){_0x28f87c[_0x0d8b('0x19')]=this[_0x0d8b('0x1a')]['id'];}else{_0x28f87c[_[_0x0d8b('0x1b')](this['channel'])+_0x0d8b('0x1c')]=this[_0x0d8b('0x1a')]['id'];}_0x28f87c[_[_0x0d8b('0x1b')](this[_0x0d8b('0xd')])+_0x0d8b('0x1d')]=this[_0x0d8b('0x7')]['id'];if(rpc[this[_0x0d8b('0xd')]+_0x0d8b('0x1e')]){if(this['channel']==='mail'){var _0x33fb87={'tls':{'rejectUnauthorized':![]}};if(this['account']['Smtp']['service']){_0x33fb87[_0x0d8b('0x1f')]=this[_0x0d8b('0x1a')][_0x0d8b('0x20')][_0x0d8b('0x1f')];}else{_0x33fb87[_0x0d8b('0x21')]=this[_0x0d8b('0x1a')][_0x0d8b('0x20')][_0x0d8b('0x21')];_0x33fb87[_0x0d8b('0x22')]=this['account'][_0x0d8b('0x20')][_0x0d8b('0x22')];_0x33fb87['secure']=this[_0x0d8b('0x1a')]['Smtp'][_0x0d8b('0x23')];}if(this[_0x0d8b('0x1a')][_0x0d8b('0x20')]['authentication']){_0x33fb87['auth']={'user':this[_0x0d8b('0x1a')][_0x0d8b('0x20')]['user'],'pass':this[_0x0d8b('0x1a')]['Smtp'][_0x0d8b('0x24')]};}_0x28f87c['inReplyTo']=this[_0x0d8b('0x11')]['messageId'];_0x28f87c[_0x0d8b('0x25')]=''+_[_0x0d8b('0x26')](_0x28f87c['body'],_0x0d8b('0x27'),_0x0d8b('0x28'))+_0x0d8b('0x29');return mailRpc['sendMailMessage'](_0x33fb87,_0x28f87c)['then'](function(_0x51cf32){logger[_0x0d8b('0x9')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x3f8b6f);_0x28f87c[_0x0d8b('0x2a')]=_0x51cf32['message']['messageId'];return rpc[_0x1cac62+_0x0d8b('0x1e')][_0x0d8b('0x2b')](_0x28f87c);})[_0x0d8b('0x2c')](function(_0xdeee5d){logger[_0x0d8b('0x9')](_0x0d8b('0xa'),_0x3f8b6f,JSON[_0x0d8b('0x2d')](_0xdeee5d));})[_0x0d8b('0x2e')](function(_0x553e03){logger[_0x0d8b('0x2f')](_0x0d8b('0x30'),_0x3f8b6f,JSON['stringify'](_0x553e03));})[_0x0d8b('0x31')](function(){_0x39f43a[_0x0d8b('0xc')]();});}else{return rpc[this[_0x0d8b('0xd')]+'Message'][_0x0d8b('0x2b')](_0x28f87c)[_0x0d8b('0x2c')](function(_0x206157){logger[_0x0d8b('0x9')](_0x0d8b('0xa'),_0x3f8b6f,_0x28f87c['body']);})[_0x0d8b('0x2e')](function(_0x1649fc){logger['error'](_0x0d8b('0xa'),_0x3f8b6f,JSON[_0x0d8b('0x2d')](_0x1649fc));})[_0x0d8b('0x31')](function(){_0x39f43a[_0x0d8b('0xc')]();});}}}catch(_0x373544){logger['error']('[%s][AUTOREPLY]\x20%s',_0x3f8b6f,JSON[_0x0d8b('0x2d')](_0x373544));_0x39f43a['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 039a04e..803fa4c 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 _0x1f81=['../../rpc/faxInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','finally','error','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction'];(function(_0x13a6d8,_0x6189c){var _0x176743=function(_0x9a7fff){while(--_0x9a7fff){_0x13a6d8['push'](_0x13a6d8['shift']());}};_0x176743(++_0x6189c);}(_0x1f81,0xab));var _0x11f8=function(_0x95942,_0x85da80){_0x95942=_0x95942-0x0;var _0x6d7f81=_0x1f81[_0x95942];return _0x6d7f81;};'use strict';var moment=require(_0x11f8('0x0'));var logger=require(_0x11f8('0x1'))('routing');var rpc={'chatInteraction':require(_0x11f8('0x2')),'openchannelInteraction':require(_0x11f8('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x11f8('0x4')),'faxInteraction':require(_0x11f8('0x5'))};exports[_0x11f8('0x6')]=function(_0x454d02,_0x1c6cc7,_0x43f715,_0x1a16e9){return function(_0xe63071){try{logger['info'](_0x11f8('0x7'),_0x454d02,_0x1c6cc7[0x0]);var _0x8009d7={'closed':0x1,'closedAt':moment()[_0x11f8('0x8')](_0x11f8('0x9')),'closeReason':_0x11f8('0xa'),'disposition':_0x1c6cc7[0x0]};if(rpc[_0x1a16e9[_0x11f8('0xb')]+_0x11f8('0xc')]){rpc[_0x1a16e9[_0x11f8('0xb')]+_0x11f8('0xc')][_0x11f8('0xd')](_0x1a16e9[_0x11f8('0xe')]['id'],_0x8009d7)['then'](function(_0x3fa534){logger[_0x11f8('0xf')](_0x11f8('0x10'),_0x454d02,_0x1a16e9[_0x11f8('0xe')]['id']);})[_0x11f8('0x11')](function(_0x2ed8fc){logger['error'](_0x11f8('0x12'),_0x454d02,JSON[_0x11f8('0x13')](_0x2ed8fc));})[_0x11f8('0x14')](function(){_0xe63071['stop']();});}}catch(_0x3f2f3f){logger[_0x11f8('0x15')](_0x11f8('0x12'),_0x454d02,JSON[_0x11f8('0x13')](_0x3f2f3f));_0xe63071['stop']();}};}; \ No newline at end of file +var _0xd668=['format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s'];(function(_0x1caf30,_0x32d11c){var _0x358254=function(_0x30cb19){while(--_0x30cb19){_0x1caf30['push'](_0x1caf30['shift']());}};_0x358254(++_0x32d11c);}(_0xd668,0x108));var _0x8d66=function(_0x428662,_0x208c14){_0x428662=_0x428662-0x0;var _0x41f1a8=_0xd668[_0x428662];return _0x41f1a8;};'use strict';var moment=require(_0x8d66('0x0'));var logger=require(_0x8d66('0x1'))(_0x8d66('0x2'));var rpc={'chatInteraction':require(_0x8d66('0x3')),'openchannelInteraction':require(_0x8d66('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x8d66('0x5'))};exports[_0x8d66('0x6')]=function(_0x41b1e2,_0x28df74,_0x486c9b,_0x5dc979){return function(_0x1432e3){try{logger[_0x8d66('0x7')](_0x8d66('0x8'),_0x41b1e2,_0x28df74[0x0]);var _0x513cde={'closed':0x1,'closedAt':moment()[_0x8d66('0x9')](_0x8d66('0xa')),'closeReason':_0x8d66('0xb'),'disposition':_0x28df74[0x0]};if(rpc[_0x5dc979[_0x8d66('0xc')]+'Interaction']){rpc[_0x5dc979[_0x8d66('0xc')]+_0x8d66('0xd')][_0x8d66('0xe')](_0x5dc979[_0x8d66('0xf')]['id'],_0x513cde)['then'](function(_0x3b9168){logger[_0x8d66('0x7')](_0x8d66('0x10'),_0x41b1e2,_0x5dc979[_0x8d66('0xf')]['id']);})['catch'](function(_0x2bedf8){logger[_0x8d66('0x11')](_0x8d66('0x12'),_0x41b1e2,JSON['stringify'](_0x2bedf8));})[_0x8d66('0x13')](function(){_0x1432e3[_0x8d66('0x14')]();});}}catch(_0x34a2eb){logger[_0x8d66('0x11')]('[%s][CLOSE]\x20%s',_0x41b1e2,JSON['stringify'](_0x34a2eb));_0x1432e3['stop']();}};}; \ 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 62e4cf3..f214bf3 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 _0xca33=['metadata','endConversation','next','lodash','moment','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','isNil','interaction','info','contact','format','out','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','getMustacheRender','Message','create','[%s][DIALOGFLOW]\x20%s','body','catch','error','stringify','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','then','dialogflow','result','fulfillment','speech'];(function(_0x22522d,_0x435281){var _0x1653a9=function(_0x3ced02){while(--_0x3ced02){_0x22522d['push'](_0x22522d['shift']());}};_0x1653a9(++_0x435281);}(_0xca33,0x14b));var _0x3ca3=function(_0x95e59c,_0xcc70c5){_0x95e59c=_0x95e59c-0x0;var _0x21820d=_0xca33[_0x95e59c];return _0x21820d;};'use strict';var _=require(_0x3ca3('0x0'));var moment=require(_0x3ca3('0x1'));var apiai=require('apiai-promise');var md5=require(_0x3ca3('0x2'));var utils=require(_0x3ca3('0x3'));var logger=require(_0x3ca3('0x4'))('routing');var rpc={'chatMessage':require(_0x3ca3('0x5')),'openchannelMessage':require(_0x3ca3('0x6')),'mailMessage':require(_0x3ca3('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x3ca3('0x8'))};exports[_0x3ca3('0x9')]=function(_0x3f90ad,_0x24248f){return function(_0xbd0df1){try{if(!_[_0x3ca3('0xa')](this[_0x3ca3('0xb')]['UserId'])){logger[_0x3ca3('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x3f90ad,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0xbd0df1['next']();}var _0x84b2b3={'ContactId':this[_0x3ca3('0xd')]['id'],'sentAt':moment()[_0x3ca3('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x3ca3('0xf')};var _0x304c41=this['channel'];if(_0x304c41==='chat'){_0x84b2b3[_0x3ca3('0x10')]=this[_0x3ca3('0x11')]['id'];}else{_0x84b2b3[_[_0x3ca3('0x12')](_0x304c41)+_0x3ca3('0x13')]=this[_0x3ca3('0x11')]['id'];}_0x84b2b3[_['upperFirst'](_0x304c41)+'InteractionId']=this[_0x3ca3('0xb')]['id'];if(this[_0x3ca3('0xb')][_0x3ca3('0x14')]){var _0xe810ac=_0x24248f[0x2];if(!_[_0x3ca3('0x15')](_0xe810ac)){_0x84b2b3['body']=utils[_0x3ca3('0x16')](_0xe810ac,this);return rpc[_0x304c41+_0x3ca3('0x17')][_0x3ca3('0x18')](_0x84b2b3)['then'](function(_0x48866e){logger[_0x3ca3('0xc')](_0x3ca3('0x19'),_0x3f90ad,_0x84b2b3[_0x3ca3('0x1a')]);})[_0x3ca3('0x1b')](function(_0x1414b1){logger[_0x3ca3('0x1c')]('[%s][DIALOGFLOW]\x20%s',_0x3f90ad,JSON[_0x3ca3('0x1d')](_0x1414b1));})['finally'](function(){logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x3f90ad);_0xbd0df1[_0x3ca3('0x1e')]();});}else{logger['info'](_0x3ca3('0x1f'),_0x3f90ad);_0xbd0df1[_0x3ca3('0x1e')]();}}else{var _0x136b44=this;var _0x533291=apiai(_0x24248f[0x0],{'language':_0x24248f[0x1]||'en'});return _0x533291[_0x3ca3('0x20')](this['message'][_0x3ca3('0x1a')],{'sessionId':md5(this[_0x3ca3('0xb')]['id'])})[_0x3ca3('0x21')](function(_0x228591){_0x136b44[_0x3ca3('0x1a')][_0x3ca3('0x22')]=_0x228591;_0x84b2b3['body']=_0x228591[_0x3ca3('0x23')][_0x3ca3('0x24')][_0x3ca3('0x25')];return rpc[_0x304c41+_0x3ca3('0x17')][_0x3ca3('0x18')](_0x84b2b3)[_0x3ca3('0x21')](function(_0x1d3345){logger['info'](_0x3ca3('0x19'),_0x3f90ad,_0x84b2b3['body']);if(_0x228591['result'][_0x3ca3('0x26')][_0x3ca3('0x27')]){_0xbd0df1[_0x3ca3('0x28')]();}else{_0xbd0df1[_0x3ca3('0x1e')]();}})[_0x3ca3('0x1b')](function(_0x4b0705){logger['error'](_0x3ca3('0x19'),_0x3f90ad,JSON[_0x3ca3('0x1d')](_0x4b0705));_0xbd0df1['next']();});})['catch'](function(_0x434d26){logger[_0x3ca3('0x1c')]('[%s][DIALOGFLOW]\x20%s',_0x3f90ad,_0x434d26['message']);_0xbd0df1[_0x3ca3('0x28')]();});}}catch(_0x576aa6){logger['error'](_0x3ca3('0x19'),_0x3f90ad,JSON[_0x3ca3('0x1d')](_0x576aa6));_0xbd0df1[_0x3ca3('0x1e')]();}};}; \ No newline at end of file +var _0x2c55=['apiai-promise','md5','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','Message','create','then','[%s][DIALOGFLOW]\x20%s','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','dialogflow','fulfillment','speech','result','metadata','endConversation','catch','lodash','moment'];(function(_0x1708d3,_0x484d98){var _0x1479a5=function(_0x291b7d){while(--_0x291b7d){_0x1708d3['push'](_0x1708d3['shift']());}};_0x1479a5(++_0x484d98);}(_0x2c55,0x1e2));var _0x52c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c55[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x52c5('0x0'));var moment=require(_0x52c5('0x1'));var apiai=require(_0x52c5('0x2'));var md5=require(_0x52c5('0x3'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x52c5('0x4'));var rpc={'chatMessage':require(_0x52c5('0x5')),'openchannelMessage':require(_0x52c5('0x6')),'mailMessage':require(_0x52c5('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x52c5('0x8'))};exports[_0x52c5('0x9')]=function(_0x14c7f1,_0x55ca3f){return function(_0x293df8){try{if(!_['isNil'](this[_0x52c5('0xa')][_0x52c5('0xb')])){logger[_0x52c5('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x14c7f1,_0x52c5('0xd'));return _0x293df8[_0x52c5('0xe')]();}var _0xa0429d={'ContactId':this['contact']['id'],'sentAt':moment()[_0x52c5('0xf')](_0x52c5('0x10')),'direction':_0x52c5('0x11')};var _0x586411=this['channel'];if(_0x586411==='chat'){_0xa0429d[_0x52c5('0x12')]=this[_0x52c5('0x13')]['id'];}else{_0xa0429d[_[_0x52c5('0x14')](_0x586411)+_0x52c5('0x15')]=this['account']['id'];}_0xa0429d[_[_0x52c5('0x14')](_0x586411)+_0x52c5('0x16')]=this[_0x52c5('0xa')]['id'];if(this[_0x52c5('0xa')][_0x52c5('0x17')]){var _0x31b666=_0x55ca3f[0x2];if(!_[_0x52c5('0x18')](_0x31b666)){_0xa0429d[_0x52c5('0x19')]=utils['getMustacheRender'](_0x31b666,this);return rpc[_0x586411+_0x52c5('0x1a')][_0x52c5('0x1b')](_0xa0429d)[_0x52c5('0x1c')](function(_0x28f03e){logger[_0x52c5('0xc')](_0x52c5('0x1d'),_0x14c7f1,_0xa0429d[_0x52c5('0x19')]);})['catch'](function(_0x1bc4f5){logger[_0x52c5('0x1e')](_0x52c5('0x1d'),_0x14c7f1,JSON[_0x52c5('0x1f')](_0x1bc4f5));})[_0x52c5('0x20')](function(){logger[_0x52c5('0xc')](_0x52c5('0x21'),_0x14c7f1);_0x293df8[_0x52c5('0x22')]();});}else{logger[_0x52c5('0xc')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x14c7f1);_0x293df8[_0x52c5('0x22')]();}}else{var _0x9bddfa=this;var _0x34a88c=apiai(_0x55ca3f[0x0],{'language':_0x55ca3f[0x1]||'en'});return _0x34a88c[_0x52c5('0x23')](this[_0x52c5('0x24')][_0x52c5('0x19')],{'sessionId':md5(this[_0x52c5('0xa')]['id'])})[_0x52c5('0x1c')](function(_0x21ee48){_0x9bddfa[_0x52c5('0x19')][_0x52c5('0x25')]=_0x21ee48;_0xa0429d['body']=_0x21ee48['result'][_0x52c5('0x26')][_0x52c5('0x27')];return rpc[_0x586411+_0x52c5('0x1a')][_0x52c5('0x1b')](_0xa0429d)[_0x52c5('0x1c')](function(_0x541723){logger[_0x52c5('0xc')](_0x52c5('0x1d'),_0x14c7f1,_0xa0429d[_0x52c5('0x19')]);if(_0x21ee48[_0x52c5('0x28')][_0x52c5('0x29')][_0x52c5('0x2a')]){_0x293df8['next']();}else{_0x293df8[_0x52c5('0x22')]();}})['catch'](function(_0x1943a1){logger[_0x52c5('0x1e')](_0x52c5('0x1d'),_0x14c7f1,JSON[_0x52c5('0x1f')](_0x1943a1));_0x293df8['next']();});})[_0x52c5('0x2b')](function(_0x4b729e){logger[_0x52c5('0x1e')](_0x52c5('0x1d'),_0x14c7f1,_0x4b729e['message']);_0x293df8['next']();});}}catch(_0x3b4835){logger[_0x52c5('0x1e')](_0x52c5('0x1d'),_0x14c7f1,JSON[_0x52c5('0x1f')](_0x3b4835));_0x293df8[_0x52c5('0x22')]();}};}; \ 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 cdb69d1..d6a4273 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 _0x2825=['../../../../config/logger','routing','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','stop','validate','./utils'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x2825,0xbe));var _0x5282=function(_0x460be6,_0x3e8671){_0x460be6=_0x460be6-0x0;var _0x153610=_0x2825[_0x460be6];return _0x153610;};'use strict';var schema=require(_0x5282('0x0'));var _=require('lodash');var htmlToText=require('html-to-text');var utils=require(_0x5282('0x1'));var logger=require(_0x5282('0x2'))(_0x5282('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x5282('0x4'),'message':_0x5282('0x5')},'priorityFalse':{'type':_0x5282('0x4'),'message':_0x5282('0x6')}});exports[_0x5282('0x7')]=function(_0x48a19c,_0x4b8ff7){return function(_0x372632){try{var _0x1a4f85={'condition':htmlToText[_0x5282('0x8')](utils['getMustacheRender'](_0x4b8ff7[0x0],this),{'wordwrap':![]})[_0x5282('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4b8ff7[0x1],'priorityFalse':_0x4b8ff7[0x2]};var _0x3f02ec=gotoif[_0x5282('0x0')](_0x1a4f85,{'typecast':!![]});if(_0x3f02ec[_0x5282('0xa')]){logger[_0x5282('0xb')](_0x5282('0xc'),_0x48a19c,_[_0x5282('0xd')](_0x3f02ec,_0x5282('0xe'))[_0x5282('0xf')](',\x20'));_0x372632['stop']();}else{try{var _0x51b010=eval('('+_0x1a4f85[_0x5282('0x10')]+')');var _0x520a3c=_0x51b010?_0x1a4f85[_0x5282('0x11')]:_0x1a4f85[_0x5282('0x12')];logger['info'](_0x5282('0x13'),_0x48a19c,_0x1a4f85['condition'],_0x51b010,_0x520a3c||_0x5282('0x14'));if(_0x520a3c){var _0x2036cd=_['findIndex'](_0x372632['rules'](),{'p':_0x520a3c});if(_0x2036cd>=0x0){logger[_0x5282('0x15')](_0x5282('0x16'),_0x48a19c,_0x520a3c||_0x5282('0x14'),_0x2036cd);_0x372632[_0x5282('0x14')](_0x2036cd);}else{logger[_0x5282('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x48a19c,_0x520a3c||'next');_0x372632[_0x5282('0x17')]();}}else{_0x372632[_0x5282('0x14')]();}}catch(_0x5f5c0d){logger[_0x5282('0xb')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x48a19c,_0x5f5c0d[_0x5282('0xe')]);_0x372632[_0x5282('0x17')]();}}}catch(_0x469ff4){logger[_0x5282('0xb')](_0x5282('0xc'),_0x48a19c,JSON['stringify'](_0x469ff4));_0x372632[_0x5282('0x17')]();}};}; \ No newline at end of file +var _0x3301=['priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','error','map','message','join','stop','condition','priorityTrue','priorityFalse','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number'];(function(_0x49dd7e,_0x48b1e5){var _0x4c4f6e=function(_0x5189f3){while(--_0x5189f3){_0x49dd7e['push'](_0x49dd7e['shift']());}};_0x4c4f6e(++_0x48b1e5);}(_0x3301,0xf2));var _0x1330=function(_0x41d902,_0x29d0b){_0x41d902=_0x41d902-0x0;var _0x360fb1=_0x3301[_0x41d902];return _0x360fb1;};'use strict';var schema=require(_0x1330('0x0'));var _=require(_0x1330('0x1'));var htmlToText=require(_0x1330('0x2'));var utils=require(_0x1330('0x3'));var logger=require(_0x1330('0x4'))(_0x1330('0x5'));var gotoif=schema({'condition':{'type':_0x1330('0x6'),'required':!![],'message':_0x1330('0x7')},'priorityTrue':{'type':_0x1330('0x8'),'message':_0x1330('0x9')},'priorityFalse':{'type':_0x1330('0x8'),'message':_0x1330('0xa')}});exports['consequence']=function(_0x4bebcd,_0x26e2bf){return function(_0x44beac){try{var _0x169d27={'condition':htmlToText[_0x1330('0xb')](utils[_0x1330('0xc')](_0x26e2bf[0x0],this),{'wordwrap':![]})[_0x1330('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x26e2bf[0x1],'priorityFalse':_0x26e2bf[0x2]};var _0x20e7a1=gotoif[_0x1330('0x0')](_0x169d27,{'typecast':!![]});if(_0x20e7a1['length']){logger[_0x1330('0xe')]('[%s][GOTOIF]\x20%s',_0x4bebcd,_[_0x1330('0xf')](_0x20e7a1,_0x1330('0x10'))[_0x1330('0x11')](',\x20'));_0x44beac[_0x1330('0x12')]();}else{try{var _0x498cfc=eval('('+_0x169d27[_0x1330('0x13')]+')');var _0x40fe2b=_0x498cfc?_0x169d27[_0x1330('0x14')]:_0x169d27[_0x1330('0x15')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x4bebcd,_0x169d27[_0x1330('0x13')],_0x498cfc,_0x40fe2b||'next');if(_0x40fe2b){var _0x319d3f=_['findIndex'](_0x44beac[_0x1330('0x16')](),{'p':_0x40fe2b});if(_0x319d3f>=0x0){logger[_0x1330('0x17')](_0x1330('0x18'),_0x4bebcd,_0x40fe2b||_0x1330('0x19'),_0x319d3f);_0x44beac['next'](_0x319d3f);}else{logger[_0x1330('0x17')](_0x1330('0x1a'),_0x4bebcd,_0x40fe2b||_0x1330('0x19'));_0x44beac['stop']();}}else{_0x44beac[_0x1330('0x19')]();}}catch(_0x2c7277){logger[_0x1330('0xe')](_0x1330('0x1b'),_0x4bebcd,_0x2c7277[_0x1330('0x10')]);_0x44beac[_0x1330('0x12')]();}}}catch(_0x402538){logger[_0x1330('0xe')]('[%s][GOTOIF]\x20%s',_0x4bebcd,JSON['stringify'](_0x402538));_0x44beac[_0x1330('0x12')]();}};}; \ 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 e789d3b..d6bbc77 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 _0x1d7a=['../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOP]\x20%s','validate','lodash'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x1d7a,0x11b));var _0xa1d7=function(_0x3a4c07,_0x18440c){_0x3a4c07=_0x3a4c07-0x0;var _0x5a4943=_0x1d7a[_0x3a4c07];return _0x5a4943;};'use strict';var schema=require(_0xa1d7('0x0'));var _=require(_0xa1d7('0x1'));var logger=require(_0xa1d7('0x2'))(_0xa1d7('0x3'));var gotop=schema({'priority':{'type':_0xa1d7('0x4'),'required':!![],'message':_0xa1d7('0x5')}});exports[_0xa1d7('0x6')]=function(_0x324b5d,_0x414de0){return function(_0x4df458){try{var _0x148e6c={'priority':_0x414de0[0x0]};var _0x4183d1=gotop[_0xa1d7('0x0')](_0x148e6c,{'typecast':!![]});if(_0x4183d1['length']){logger['error']('[%s][GOTOP]\x20%s',_0x324b5d,_['map'](_0x4183d1,_0xa1d7('0x7'))[_0xa1d7('0x8')](',\x20'));_0x4df458[_0xa1d7('0x9')]();}else{logger[_0xa1d7('0xa')](_0xa1d7('0xb'),_0x324b5d,_0x148e6c[_0xa1d7('0xc')]);if(_0x148e6c[_0xa1d7('0xc')]){var _0x395489=_[_0xa1d7('0xd')](_0x4df458['rules'](),{'p':_0x148e6c[_0xa1d7('0xc')]});if(_0x395489>=0x0){logger[_0xa1d7('0xa')](_0xa1d7('0xe'),_0x324b5d,_0x148e6c[_0xa1d7('0xc')]||_0xa1d7('0xf'),_0x395489);_0x4df458[_0xa1d7('0xf')](_0x395489);}else{logger['info'](_0xa1d7('0x10'),_0x324b5d,_0x148e6c[_0xa1d7('0xc')]||_0xa1d7('0xf'));_0x4df458[_0xa1d7('0x9')]();}}else{_0x4df458[_0xa1d7('0xf')]();}}}catch(_0x102fb5){logger[_0xa1d7('0x11')](_0xa1d7('0x12'),_0x324b5d,JSON['stringify'](_0x102fb5));_0x4df458['stop']();}};}; \ No newline at end of file +var _0xe1bd=['[%s][GOTOP]\x20%s','map','message','stop','info','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','routing','consequence','length','error'];(function(_0x28d598,_0x1396aa){var _0x324fa6=function(_0x32b7be){while(--_0x32b7be){_0x28d598['push'](_0x28d598['shift']());}};_0x324fa6(++_0x1396aa);}(_0xe1bd,0xaa));var _0xde1b=function(_0x202c72,_0x19f1c0){_0x202c72=_0x202c72-0x0;var _0x5bd3ef=_0xe1bd[_0x202c72];return _0x5bd3ef;};'use strict';var schema=require(_0xde1b('0x0'));var _=require(_0xde1b('0x1'));var logger=require('../../../../config/logger')(_0xde1b('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xde1b('0x3')]=function(_0x3964fb,_0x2911fd){return function(_0x1936f8){try{var _0x54891d={'priority':_0x2911fd[0x0]};var _0xbf4f0e=gotop[_0xde1b('0x0')](_0x54891d,{'typecast':!![]});if(_0xbf4f0e[_0xde1b('0x4')]){logger[_0xde1b('0x5')](_0xde1b('0x6'),_0x3964fb,_[_0xde1b('0x7')](_0xbf4f0e,_0xde1b('0x8'))['join'](',\x20'));_0x1936f8[_0xde1b('0x9')]();}else{logger[_0xde1b('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x3964fb,_0x54891d[_0xde1b('0xb')]);if(_0x54891d[_0xde1b('0xb')]){var _0x18662a=_['findIndex'](_0x1936f8['rules'](),{'p':_0x54891d[_0xde1b('0xb')]});if(_0x18662a>=0x0){logger[_0xde1b('0xa')](_0xde1b('0xc'),_0x3964fb,_0x54891d['priority']||_0xde1b('0xd'),_0x18662a);_0x1936f8[_0xde1b('0xd')](_0x18662a);}else{logger[_0xde1b('0xa')](_0xde1b('0xe'),_0x3964fb,_0x54891d[_0xde1b('0xb')]||'next');_0x1936f8['stop']();}}else{_0x1936f8[_0xde1b('0xd')]();}}}catch(_0x20b777){logger[_0xde1b('0x5')](_0xde1b('0x6'),_0x3964fb,JSON[_0xde1b('0xf')](_0x20b777));_0x1936f8['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 0e10e1e..aefc1dd 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 _0x4f5e=['stringify','stop','error','lodash','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','Message','create','info','body','next','catch','[%s][MESSAGE]\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4f5e,0x1d7));var _0xe4f5=function(_0x54e0bc,_0x257cec){_0x54e0bc=_0x54e0bc-0x0;var _0x5e8367=_0x4f5e[_0x54e0bc];return _0x5e8367;};'use strict';var _=require(_0xe4f5('0x0'));var utils=require('./utils');var logger=require(_0xe4f5('0x1'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xe4f5('0x2')),'mailMessage':require(_0xe4f5('0x3')),'smsMessage':require(_0xe4f5('0x4')),'faxMessage':require(_0xe4f5('0x5'))};exports[_0xe4f5('0x6')]=function(_0x271dd2,_0x567b11){return function(_0x5e212d){try{var _0x282add={'body':utils[_0xe4f5('0x7')](_0x567b11[0x0],this),'ContactId':this[_0xe4f5('0x8')]['id']};if(this[_0xe4f5('0x9')]===_0xe4f5('0xa')){_0x282add[_0xe4f5('0xb')]=this[_0xe4f5('0xc')]['id'];}else{_0x282add[_[_0xe4f5('0xd')](this[_0xe4f5('0x9')])+_0xe4f5('0xe')]=this[_0xe4f5('0xc')]['id'];}_0x282add[_[_0xe4f5('0xd')](this[_0xe4f5('0x9')])+'InteractionId']=this[_0xe4f5('0xf')]['id'];if(rpc[this['channel']+_0xe4f5('0x10')]){return rpc[this[_0xe4f5('0x9')]+_0xe4f5('0x10')][_0xe4f5('0x11')](_0x282add)['then'](function(_0x1f3400){logger[_0xe4f5('0x12')]('[%s][MESSAGE]\x20%s',_0x271dd2,_0x282add[_0xe4f5('0x13')]);_0x5e212d[_0xe4f5('0x14')]();})[_0xe4f5('0x15')](function(_0x441bec){logger['error'](_0xe4f5('0x16'),_0x271dd2,JSON[_0xe4f5('0x17')](_0x441bec));_0x5e212d[_0xe4f5('0x18')]();});}}catch(_0x60c6dc){logger[_0xe4f5('0x19')](_0xe4f5('0x16'),_0x271dd2,JSON['stringify'](_0x60c6dc));_0x5e212d['stop']();}};}; \ No newline at end of file +var _0x6887=['create','then','info','body','next','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','channel','chat','ChatWebsiteId','upperFirst','InteractionId','interaction','Message'];(function(_0x4d2157,_0x201cf1){var _0x172f80=function(_0x587167){while(--_0x587167){_0x4d2157['push'](_0x4d2157['shift']());}};_0x172f80(++_0x201cf1);}(_0x6887,0x15c));var _0x7688=function(_0x1da8f5,_0xc052c4){_0x1da8f5=_0x1da8f5-0x0;var _0x2973a4=_0x6887[_0x1da8f5];return _0x2973a4;};'use strict';var _=require(_0x7688('0x0'));var utils=require(_0x7688('0x1'));var logger=require(_0x7688('0x2'))(_0x7688('0x3'));var rpc={'chatMessage':require(_0x7688('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7688('0x5')),'faxMessage':require(_0x7688('0x6'))};exports[_0x7688('0x7')]=function(_0x14a22b,_0x4a6e59){return function(_0x516f0e){try{var _0x1aee85={'body':utils[_0x7688('0x8')](_0x4a6e59[0x0],this),'ContactId':this['contact']['id']};if(this[_0x7688('0x9')]===_0x7688('0xa')){_0x1aee85[_0x7688('0xb')]=this['account']['id'];}else{_0x1aee85[_[_0x7688('0xc')](this[_0x7688('0x9')])+'AccountId']=this['account']['id'];}_0x1aee85[_['upperFirst'](this[_0x7688('0x9')])+_0x7688('0xd')]=this[_0x7688('0xe')]['id'];if(rpc[this[_0x7688('0x9')]+'Message']){return rpc[this[_0x7688('0x9')]+_0x7688('0xf')][_0x7688('0x10')](_0x1aee85)[_0x7688('0x11')](function(_0x341868){logger[_0x7688('0x12')]('[%s][MESSAGE]\x20%s',_0x14a22b,_0x1aee85[_0x7688('0x13')]);_0x516f0e[_0x7688('0x14')]();})[_0x7688('0x15')](function(_0x7c93ab){logger[_0x7688('0x16')](_0x7688('0x17'),_0x14a22b,JSON[_0x7688('0x18')](_0x7c93ab));_0x516f0e[_0x7688('0x19')]();});}}catch(_0x144bf4){logger[_0x7688('0x16')](_0x7688('0x17'),_0x14a22b,JSON[_0x7688('0x18')](_0x144bf4));_0x516f0e['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 8d08a42..cd72a69 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 _0x14e1=['getMustacheRender','error','stop','./utils','routing','[%s][NOOP]\x20%s'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x14e1,0xc3));var _0x114e=function(_0x81184,_0x87056b){_0x81184=_0x81184-0x0;var _0x165749=_0x14e1[_0x81184];return _0x165749;};'use strict';var utils=require(_0x114e('0x0'));var logger=require('../../../../config/logger')(_0x114e('0x1'));exports['consequence']=function(_0x4bf26a,_0x365f9f){return function(_0x957b2e){try{logger['info'](_0x114e('0x2'),_0x4bf26a,utils[_0x114e('0x3')](_0x365f9f[0x0],this));_0x957b2e['next']();}catch(_0x2a4f6a){logger[_0x114e('0x4')](_0x114e('0x2'),_0x4bf26a,JSON['stringify'](_0x2a4f6a));_0x957b2e[_0x114e('0x5')]();}};}; \ No newline at end of file +var _0x0c7f=['next','stringify','stop','./utils','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x515e9e,_0x178f40){var _0x198eba=function(_0x567584){while(--_0x567584){_0x515e9e['push'](_0x515e9e['shift']());}};_0x198eba(++_0x178f40);}(_0x0c7f,0x9c));var _0xf0c7=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0c7f[_0x1facfa];return _0x9ec701;};'use strict';var utils=require(_0xf0c7('0x0'));var logger=require(_0xf0c7('0x1'))('routing');exports[_0xf0c7('0x2')]=function(_0x1bc683,_0x18acac){return function(_0x4852d4){try{logger[_0xf0c7('0x3')](_0xf0c7('0x4'),_0x1bc683,utils[_0xf0c7('0x5')](_0x18acac[0x0],this));_0x4852d4[_0xf0c7('0x6')]();}catch(_0x49379b){logger['error'](_0xf0c7('0x4'),_0x1bc683,JSON[_0xf0c7('0x7')](_0x49379b));_0x4852d4[_0xf0c7('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index d7e405c..207c1f2 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 _0xe605=['socket.io-emitter','queue_id','joinAt','emit','clone','queue','account','format','pick','%sQueuesWaitingInteractions','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','from','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','YYYY-MM-DD\x20HH:mm:ss','accepted','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','timeout','qtimeout','rules','end','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost'];(function(_0x5880db,_0xae7822){var _0x3b6b5c=function(_0x4a968b){while(--_0x4a968b){_0x5880db['push'](_0x5880db['shift']());}};_0x3b6b5c(++_0xae7822);}(_0xe605,0x92));var _0x5e60=function(_0x25750c,_0x3ac9f6){_0x25750c=_0x25750c-0x0;var _0x218ae4=_0xe605[_0x25750c];return _0x218ae4;};'use strict';var schema=require(_0x5e60('0x0'));var _=require(_0x5e60('0x1'));var util=require('util');var seqqueue=require(_0x5e60('0x2'));var moment=require(_0x5e60('0x3'));var Redis=require(_0x5e60('0x4'));var config=require(_0x5e60('0x5'));var logger=require(_0x5e60('0x6'))(_0x5e60('0x7'));var strategy=require(_0x5e60('0x8'));config[_0x5e60('0x9')]=_[_0x5e60('0xa')](config[_0x5e60('0x9')],{'host':_0x5e60('0xb'),'port':0x18eb});var io=require(_0x5e60('0xc'))(new Redis(config['redis']));var attributes=['id',_0x5e60('0xd'),'account','queue','from',_0x5e60('0xe')];function emit(_0xe93f9c,_0x150a51,_0x2c5425){io['to'](_0xe93f9c)[_0x5e60('0xf')](_0x150a51,_0x2c5425);}function emitChannelQueueInteraction(_0x2cbe4e,_0x56f05a,_0x6ab0ce,_0x527f7b,_0x1d2558,_0x15035f,_0xcf1188,_0x51e7f6){var _0x371df7=_[_0x5e60('0x10')](_0x6ab0ce);_0x371df7[_0x5e60('0xd')]=_0x51e7f6;_0x371df7[_0x5e60('0x11')]=_0x56f05a;_0x371df7[_0x5e60('0x12')]=_0x527f7b;_0x371df7['id']=_0x1d2558;if(_0x15035f){_0xcf1188[util[_0x5e60('0x13')]('%sQueuesWaitingInteractions',_0x2cbe4e)][_0x1d2558]=_[_0x5e60('0x14')](_0x371df7,attributes);}else{delete _0xcf1188[util[_0x5e60('0x13')](_0x5e60('0x15'),_0x2cbe4e)][_0x1d2558];}emit(util[_0x5e60('0x13')]('%s:queue:%s',_0x2cbe4e,_0x56f05a),util[_0x5e60('0x13')]('%s_queue_waiting_interaction:%s',_0x2cbe4e,_0x15035f?_0x5e60('0x16'):_0x5e60('0x17')),_['pick'](_0x371df7,attributes));}var rpc={'openchannelQueueReport':require(_0x5e60('0x18')),'mailQueueReport':require(_0x5e60('0x19')),'chatQueueReport':require(_0x5e60('0x1a')),'smsQueueReport':require(_0x5e60('0x1b')),'faxQueueReport':require('../../rpc/faxQueueReport')};var queue=schema({'name':{'type':_0x5e60('0x1c'),'required':!![],'message':_0x5e60('0x1d')},'timeout':{'type':'number','message':_0x5e60('0x1e')}});function startRouting(_0x3a9e6b,_0x17c630,_0x311fef,_0x20db03){if(_0x3a9e6b&&_0x17c630&&_0x311fef){_0x17c630[_0x5e60('0x1f')]+=0x1;var _0x41294f={'uniqueid':_0x3a9e6b,'from':_0x311fef[_0x5e60('0x20')]?_0x311fef[_0x5e60('0x20')][_0x5e60('0x21')]:'','joinAt':moment()[_0x5e60('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x311fef[_0x5e60('0x22')]?_0x311fef['contact']['id']:null,'ListId':_0x311fef[_0x5e60('0x23')]?_0x311fef[_0x5e60('0x23')]['id']:null};_0x41294f[_[_0x5e60('0x24')](_0x311fef[_0x5e60('0x25')])+_0x5e60('0x26')]=_0x17c630['id']||null;_0x41294f[_[_0x5e60('0x24')](_0x311fef[_0x5e60('0x25')])+'InteractionId']=_0x311fef[_0x5e60('0x27')]?_0x311fef[_0x5e60('0x27')]['id']:null;_0x41294f[_[_0x5e60('0x24')](_0x311fef['channel'])+_0x5e60('0x28')]=_0x311fef[_0x5e60('0x29')]?_0x311fef[_0x5e60('0x29')]['id']:null;_0x41294f[_[_0x5e60('0x24')](_0x311fef['channel'])+(_0x311fef[_0x5e60('0x25')]!=='chat'?_0x5e60('0x2a'):_0x5e60('0x2b'))]=_0x311fef['account']?_0x311fef[_0x5e60('0x12')]['id']:null;logger[_0x5e60('0x2c')](util['format'](_0x5e60('0x2d'),_0x3a9e6b,_0x17c630[_0x5e60('0x2e')]));emitChannelQueueInteraction(_0x311fef['channel'],_0x17c630['name'],_0x41294f,_0x311fef['account'][_0x5e60('0x2e')],_0x311fef[_0x5e60('0x29')]['id'],!![],_0x20db03,_0x17c630['id']);if(rpc[_0x311fef[_0x5e60('0x25')]+_0x5e60('0x2f')]){return rpc[_0x311fef[_0x5e60('0x25')]+'QueueReport'][_0x5e60('0x30')](_0x41294f)[_0x5e60('0x31')](function(_0x4d4b55){logger[_0x5e60('0x32')]('create\x20queue\x20report');});}}}function stopRouting(_0x50f024,_0x1035b0,_0x3c4340,_0x1f474b){if(_0x50f024&&_0x1035b0){_0x1035b0[_0x5e60('0x1f')]-=0x1;var _0xaf3a35={'leaveAt':moment()[_0x5e60('0x13')](_0x5e60('0x33')),'acceptAt':moment()[_0x5e60('0x13')](_0x5e60('0x33')),'reason':_0x5e60('0x34')};logger['info'](util[_0x5e60('0x13')]('[%s][STOP:QUEUE][NAME:%s]',_0x50f024,_0x1035b0['name']));emitChannelQueueInteraction(_0x3c4340[_0x5e60('0x25')],_0x1035b0[_0x5e60('0x2e')],_0x3c4340['body'],_0x3c4340[_0x5e60('0x12')]['name'],_0x3c4340[_0x5e60('0x29')]['id'],![],_0x1f474b,_0x1035b0['id']);if(rpc[_0x3c4340[_0x5e60('0x25')]+_0x5e60('0x2f')]){return rpc[_0x3c4340[_0x5e60('0x25')]+_0x5e60('0x2f')][_0x5e60('0x35')](_0x50f024,_0xaf3a35)[_0x5e60('0x31')](function(_0x3c5200){logger['error'](_0x5e60('0x36'));});}}}function endRouting(_0x3f744d,_0x22d4ad,_0x1a3782,_0x200744){if(_0x3f744d&&_0x22d4ad){_0x22d4ad[_0x5e60('0x1f')]-=0x1;var _0x261245={'leaveAt':moment()['format'](_0x5e60('0x33')),'exitAt':moment()[_0x5e60('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger[_0x5e60('0x2c')](util[_0x5e60('0x13')](_0x5e60('0x37'),_0x3f744d,_0x22d4ad[_0x5e60('0x2e')]));emitChannelQueueInteraction(_0x1a3782[_0x5e60('0x25')],_0x22d4ad['name'],_0x1a3782[_0x5e60('0x20')],_0x1a3782[_0x5e60('0x12')][_0x5e60('0x2e')],_0x1a3782[_0x5e60('0x29')]['id'],![],_0x200744);if(rpc[_0x1a3782[_0x5e60('0x25')]+_0x5e60('0x2f')]){return rpc[_0x1a3782[_0x5e60('0x25')]+'QueueReport'][_0x5e60('0x35')](_0x3f744d,_0x261245)[_0x5e60('0x31')](function(_0x486185){logger['error']('update\x20queue\x20report');});}}}function handleFindQueue(_0x15a97b){return function(_0x1b80ad){return _0x1b80ad[_0x5e60('0x2e')][_0x5e60('0x38')]()===_0x15a97b['toLowerCase']();};}exports[_0x5e60('0x39')]=function(_0x24e893,_0x4b6192,_0x5bda22,_0x1bf6e4){return function(_0x42b9b0){try{var _0x40cb06={'name':_0x4b6192[0x0],'timeout':_0x4b6192[0x1]};var _0x38ff1d=queue[_0x5e60('0x0')](_0x40cb06,{'typecast':!![]});if(_0x38ff1d[_0x5e60('0x3a')]){logger[_0x5e60('0x32')](_0x5e60('0x3b'),_0x24e893,_[_0x5e60('0x3c')](_0x38ff1d,'message')[_0x5e60('0x3d')](',\x20'));_0x42b9b0[_0x5e60('0x3e')]();}else{var _0x59a2eb=_[_0x5e60('0x3f')](_0x5bda22[_0x1bf6e4[_0x5e60('0x25')]+_0x5e60('0x40')],handleFindQueue(_0x40cb06[_0x5e60('0x2e')]));if(_0x59a2eb){startRouting(_0x24e893,_0x59a2eb,_0x1bf6e4,_0x5bda22);var _0x76f97f=(_0x59a2eb['timeout']||0xa)*0x3e8;var _0x3f1a53=(_0x40cb06[_0x5e60('0x41')]||0x14)*0x3e8;var _0x172aff,_0x46ced1;if(_0x76f97f>_0x3f1a53){_0x3f1a53=_0x76f97f;}var _0x4b6e30=seqqueue['createQueue'](_0x76f97f);_0x4b6e30['id']=_0x24e893;_0x4b6e30['atimeout']=_0x76f97f;_0x4b6e30[_0x5e60('0x42')]=_0x3f1a53;_0x4b6e30[_0x5e60('0x25')]=_0x1bf6e4[_0x5e60('0x25')];_0x5bda22[_0x5e60('0x43')][_0x24e893]['on'](_0x5e60('0x44'),function(){logger[_0x5e60('0x2c')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x24e893);stopRouting(_0x24e893,_0x59a2eb,_0x1bf6e4,_0x5bda22);clearTimeout(_0x172aff);_0x172aff=undefined;_0x4b6e30[_0x5e60('0x45')](!![]);if(_0x5bda22[_0x5e60('0x43')][_0x24e893]){delete _0x5bda22[_0x5e60('0x43')][_0x24e893];}_0x42b9b0[_0x5e60('0x3e')]();});_0x5bda22[_0x5e60('0x43')][_0x24e893]['on'](_0x5e60('0x46'),function(){if(_0x5bda22[_0x5e60('0x43')][_0x24e893]){delete _0x5bda22['rules'][_0x24e893];}});_0x172aff=setTimeout(function(){logger[_0x5e60('0x2c')](_0x5e60('0x47'),_0x24e893);endRouting(_0x24e893,_0x59a2eb,_0x1bf6e4,_0x5bda22);clearTimeout(_0x172aff);_0x4b6e30[_0x5e60('0x45')](!![]);_0x42b9b0[_0x5e60('0x48')]();},_0x3f1a53);switch(_0x59a2eb[_0x5e60('0x49')]){case _0x5e60('0x4a'):strategy[_0x5e60('0x4a')](_0x4b6e30,_0x59a2eb,_0x5bda22,_0x1bf6e4);break;default:strategy[_0x5e60('0x4b')](_0x4b6e30,_0x59a2eb,_0x5bda22,_0x1bf6e4);}}else{logger[_0x5e60('0x32')](_0x5e60('0x4c'),_0x24e893,_0x40cb06[_0x5e60('0x2e')]);_0x42b9b0[_0x5e60('0x3e')]();}}}catch(_0x3e84be){console[_0x5e60('0x4d')](_0x3e84be);logger[_0x5e60('0x32')](_0x5e60('0x3b'),_0x24e893,_0x3e84be[_0x5e60('0x4e')]);_0x42b9b0[_0x5e60('0x3e')]();}};}; \ No newline at end of file +var _0x6e6c=['timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','stop','find','timeout','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','seq-queue','moment','../../../../config/logger','./strategy','defaults','redis','socket.io-emitter','account','queue','joinAt','emit','clone','queue_id','%sQueuesWaitingInteractions','pick','format','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/faxQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number'];(function(_0x3c2bce,_0x2ae59f){var _0x19f3f5=function(_0x4d5c62){while(--_0x4d5c62){_0x3c2bce['push'](_0x3c2bce['shift']());}};_0x19f3f5(++_0x2ae59f);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6e6c[_0x397e5f];return _0x5302b8;};'use strict';var schema=require(_0xc6e6('0x0'));var _=require(_0xc6e6('0x1'));var util=require('util');var seqqueue=require(_0xc6e6('0x2'));var moment=require(_0xc6e6('0x3'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require(_0xc6e6('0x4'))('routing');var strategy=require(_0xc6e6('0x5'));config['redis']=_[_0xc6e6('0x6')](config[_0xc6e6('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xc6e6('0x8'))(new Redis(config[_0xc6e6('0x7')]));var attributes=['id','queue_id',_0xc6e6('0x9'),_0xc6e6('0xa'),'from',_0xc6e6('0xb')];function emit(_0x481799,_0x172aa9,_0x3b2f50){io['to'](_0x481799)[_0xc6e6('0xc')](_0x172aa9,_0x3b2f50);}function emitChannelQueueInteraction(_0x3ddf6f,_0x12596b,_0xbf9ffc,_0x1f9ed3,_0x10aae5,_0x2c205d,_0x58540d,_0x3ac3a5){var _0x525d60=_[_0xc6e6('0xd')](_0xbf9ffc);_0x525d60[_0xc6e6('0xe')]=_0x3ac3a5;_0x525d60[_0xc6e6('0xa')]=_0x12596b;_0x525d60[_0xc6e6('0x9')]=_0x1f9ed3;_0x525d60['id']=_0x10aae5;if(_0x2c205d){_0x58540d[util['format'](_0xc6e6('0xf'),_0x3ddf6f)][_0x10aae5]=_[_0xc6e6('0x10')](_0x525d60,attributes);}else{delete _0x58540d[util[_0xc6e6('0x11')](_0xc6e6('0xf'),_0x3ddf6f)][_0x10aae5];}emit(util[_0xc6e6('0x11')]('%s:queue:%s',_0x3ddf6f,_0x12596b),util[_0xc6e6('0x11')](_0xc6e6('0x12'),_0x3ddf6f,_0x2c205d?'save':_0xc6e6('0x13')),_[_0xc6e6('0x10')](_0x525d60,attributes));}var rpc={'openchannelQueueReport':require(_0xc6e6('0x14')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xc6e6('0x15'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xc6e6('0x16')},'timeout':{'type':_0xc6e6('0x17'),'message':_0xc6e6('0x18')}});function startRouting(_0x41afe6,_0x19e1e4,_0x3a0d83,_0x34b879){if(_0x41afe6&&_0x19e1e4&&_0x3a0d83){_0x19e1e4[_0xc6e6('0x19')]+=0x1;var _0x28cbc3={'uniqueid':_0x41afe6,'from':_0x3a0d83[_0xc6e6('0x1a')]?_0x3a0d83['body'][_0xc6e6('0x1b')]:'','joinAt':moment()['format'](_0xc6e6('0x1c')),'ContactId':_0x3a0d83[_0xc6e6('0x1d')]?_0x3a0d83[_0xc6e6('0x1d')]['id']:null,'ListId':_0x3a0d83[_0xc6e6('0x1e')]?_0x3a0d83['list']['id']:null};_0x28cbc3[_[_0xc6e6('0x1f')](_0x3a0d83[_0xc6e6('0x20')])+_0xc6e6('0x21')]=_0x19e1e4['id']||null;_0x28cbc3[_[_0xc6e6('0x1f')](_0x3a0d83[_0xc6e6('0x20')])+'InteractionId']=_0x3a0d83[_0xc6e6('0x22')]?_0x3a0d83['interaction']['id']:null;_0x28cbc3[_[_0xc6e6('0x1f')](_0x3a0d83[_0xc6e6('0x20')])+_0xc6e6('0x23')]=_0x3a0d83[_0xc6e6('0x24')]?_0x3a0d83['message']['id']:null;_0x28cbc3[_[_0xc6e6('0x1f')](_0x3a0d83['channel'])+(_0x3a0d83[_0xc6e6('0x20')]!=='chat'?_0xc6e6('0x25'):_0xc6e6('0x26'))]=_0x3a0d83[_0xc6e6('0x9')]?_0x3a0d83[_0xc6e6('0x9')]['id']:null;logger[_0xc6e6('0x27')](util['format'](_0xc6e6('0x28'),_0x41afe6,_0x19e1e4[_0xc6e6('0x29')]));emitChannelQueueInteraction(_0x3a0d83[_0xc6e6('0x20')],_0x19e1e4[_0xc6e6('0x29')],_0x28cbc3,_0x3a0d83['account'][_0xc6e6('0x29')],_0x3a0d83['message']['id'],!![],_0x34b879,_0x19e1e4['id']);if(rpc[_0x3a0d83[_0xc6e6('0x20')]+_0xc6e6('0x2a')]){return rpc[_0x3a0d83[_0xc6e6('0x20')]+_0xc6e6('0x2a')][_0xc6e6('0x2b')](_0x28cbc3)[_0xc6e6('0x2c')](function(_0x43ff9c){logger[_0xc6e6('0x2d')](_0xc6e6('0x2e'));});}}}function stopRouting(_0x1eb477,_0x92af28,_0x214d6a,_0x101ee9){if(_0x1eb477&&_0x92af28){_0x92af28[_0xc6e6('0x19')]-=0x1;var _0x3db0ae={'leaveAt':moment()[_0xc6e6('0x11')](_0xc6e6('0x1c')),'acceptAt':moment()['format'](_0xc6e6('0x1c')),'reason':_0xc6e6('0x2f')};logger['info'](util['format'](_0xc6e6('0x30'),_0x1eb477,_0x92af28[_0xc6e6('0x29')]));emitChannelQueueInteraction(_0x214d6a[_0xc6e6('0x20')],_0x92af28[_0xc6e6('0x29')],_0x214d6a[_0xc6e6('0x1a')],_0x214d6a[_0xc6e6('0x9')]['name'],_0x214d6a[_0xc6e6('0x24')]['id'],![],_0x101ee9,_0x92af28['id']);if(rpc[_0x214d6a[_0xc6e6('0x20')]+_0xc6e6('0x2a')]){return rpc[_0x214d6a['channel']+'QueueReport'][_0xc6e6('0x31')](_0x1eb477,_0x3db0ae)[_0xc6e6('0x2c')](function(_0x32797e){logger[_0xc6e6('0x2d')]('update\x20queue\x20report');});}}}function endRouting(_0x59ac83,_0x24a690,_0x4e94ea,_0x268c8f){if(_0x59ac83&&_0x24a690){_0x24a690['waiting']-=0x1;var _0x357eae={'leaveAt':moment()[_0xc6e6('0x11')](_0xc6e6('0x1c')),'exitAt':moment()[_0xc6e6('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger[_0xc6e6('0x27')](util[_0xc6e6('0x11')](_0xc6e6('0x32'),_0x59ac83,_0x24a690[_0xc6e6('0x29')]));emitChannelQueueInteraction(_0x4e94ea['channel'],_0x24a690['name'],_0x4e94ea[_0xc6e6('0x1a')],_0x4e94ea[_0xc6e6('0x9')][_0xc6e6('0x29')],_0x4e94ea[_0xc6e6('0x24')]['id'],![],_0x268c8f);if(rpc[_0x4e94ea['channel']+_0xc6e6('0x2a')]){return rpc[_0x4e94ea[_0xc6e6('0x20')]+'QueueReport']['update'](_0x59ac83,_0x357eae)[_0xc6e6('0x2c')](function(_0x550971){logger[_0xc6e6('0x2d')](_0xc6e6('0x33'));});}}}function handleFindQueue(_0x53d313){return function(_0x1117c1){return _0x1117c1['name'][_0xc6e6('0x34')]()===_0x53d313['toLowerCase']();};}exports[_0xc6e6('0x35')]=function(_0x63d8f3,_0x247076,_0x2f7af9,_0x101aa8){return function(_0xcf70c8){try{var _0x2db1c7={'name':_0x247076[0x0],'timeout':_0x247076[0x1]};var _0x69766=queue[_0xc6e6('0x0')](_0x2db1c7,{'typecast':!![]});if(_0x69766['length']){logger[_0xc6e6('0x2d')](_0xc6e6('0x36'),_0x63d8f3,_[_0xc6e6('0x37')](_0x69766,_0xc6e6('0x24'))['join'](',\x20'));_0xcf70c8[_0xc6e6('0x38')]();}else{var _0x825640=_[_0xc6e6('0x39')](_0x2f7af9[_0x101aa8[_0xc6e6('0x20')]+'Queues'],handleFindQueue(_0x2db1c7[_0xc6e6('0x29')]));if(_0x825640){startRouting(_0x63d8f3,_0x825640,_0x101aa8,_0x2f7af9);var _0xae093b=(_0x825640[_0xc6e6('0x3a')]||0xa)*0x3e8;var _0x45d153=(_0x2db1c7[_0xc6e6('0x3a')]||0x14)*0x3e8;var _0x581de6,_0x2aef4f;if(_0xae093b>_0x45d153){_0x45d153=_0xae093b;}var _0x518fa2=seqqueue[_0xc6e6('0x3b')](_0xae093b);_0x518fa2['id']=_0x63d8f3;_0x518fa2['atimeout']=_0xae093b;_0x518fa2[_0xc6e6('0x3c')]=_0x45d153;_0x518fa2[_0xc6e6('0x20')]=_0x101aa8[_0xc6e6('0x20')];_0x2f7af9[_0xc6e6('0x3d')][_0x63d8f3]['on'](_0xc6e6('0x3e'),function(){logger[_0xc6e6('0x27')](_0xc6e6('0x3f'),_0x63d8f3);stopRouting(_0x63d8f3,_0x825640,_0x101aa8,_0x2f7af9);clearTimeout(_0x581de6);_0x581de6=undefined;_0x518fa2[_0xc6e6('0x40')](!![]);if(_0x2f7af9['rules'][_0x63d8f3]){delete _0x2f7af9[_0xc6e6('0x3d')][_0x63d8f3];}_0xcf70c8[_0xc6e6('0x38')]();});_0x2f7af9[_0xc6e6('0x3d')][_0x63d8f3]['on']('complete',function(){if(_0x2f7af9[_0xc6e6('0x3d')][_0x63d8f3]){delete _0x2f7af9[_0xc6e6('0x3d')][_0x63d8f3];}});_0x581de6=setTimeout(function(){logger[_0xc6e6('0x27')](_0xc6e6('0x41'),_0x63d8f3);endRouting(_0x63d8f3,_0x825640,_0x101aa8,_0x2f7af9);clearTimeout(_0x581de6);_0x518fa2[_0xc6e6('0x40')](!![]);_0xcf70c8[_0xc6e6('0x42')]();},_0x45d153);switch(_0x825640[_0xc6e6('0x43')]){case _0xc6e6('0x44'):strategy[_0xc6e6('0x44')](_0x518fa2,_0x825640,_0x2f7af9,_0x101aa8);break;default:strategy[_0xc6e6('0x45')](_0x518fa2,_0x825640,_0x2f7af9,_0x101aa8);}}else{logger[_0xc6e6('0x2d')](_0xc6e6('0x46'),_0x63d8f3,_0x2db1c7[_0xc6e6('0x29')]);_0xcf70c8[_0xc6e6('0x38')]();}}}catch(_0x4f361c){console[_0xc6e6('0x47')](_0x4f361c);logger['error'](_0xc6e6('0x36'),_0x63d8f3,_0x4f361c[_0xc6e6('0x48')]);_0xcf70c8['stop']();}};}; \ 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 a6a40b8..a2c389f 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 _0xe23d=['notificationId','squeue','agent','realtime','bind','handleTimeout','timeout','drained','prototype','push','handleRun','handleDrained','info','isNil','agents','isAgentAvailable','channel','busyQueue','writeLog','forcedOwnership','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','STOP','TIMEOUT','lodash','./util','routing'];(function(_0x21e483,_0x4b223a){var _0x3d1eef=function(_0x58eb6e){while(--_0x58eb6e){_0x21e483['push'](_0x21e483['shift']());}};_0x3d1eef(++_0x4b223a);}(_0xe23d,0x93));var _0xde23=function(_0x593c09,_0x4a0b18){_0x593c09=_0x593c09-0x0;var _0x9ab7ae=_0xe23d[_0x593c09];return _0x9ab7ae;};'use strict';var _=require(_0xde23('0x0'));var uuid=require('uuid');var util=require(_0xde23('0x1'));var logger=require('../../../../../config/logger')(_0xde23('0x2'));var Agent=function(_0x12387b,_0x461a82,_0xdb05e0,_0xcde8e3){this[_0xde23('0x3')]=uuid['v4']();this[_0xde23('0x4')]=_0x12387b;this[_0xde23('0x5')]=_0x461a82;this[_0xde23('0x6')]=_0xdb05e0;this['routing']=_0xcde8e3;this['squeue']['push'](this['handleRun'][_0xde23('0x7')](this),this[_0xde23('0x8')][_0xde23('0x7')](this));this[_0xde23('0x4')]['on'](_0xde23('0x9'),this[_0xde23('0x8')][_0xde23('0x7')](this));this[_0xde23('0x4')]['on'](_0xde23('0xa'),this['handleDrained'][_0xde23('0x7')](this));};Agent[_0xde23('0xb')][_0xde23('0xc')]=function(){this['squeue'][_0xde23('0xc')](this[_0xde23('0xd')][_0xde23('0x7')](this),this['handleTimeout'][_0xde23('0x7')](this));};Agent[_0xde23('0xb')][_0xde23('0xe')]=function(){this[_0xde23('0x8')](!![]);};Agent['prototype'][_0xde23('0xd')]=function(_0xb3558){logger[_0xde23('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xde23('0x4')]['id'],this[_0xde23('0x5')]['id']);if(_[_0xde23('0x10')](this[_0xde23('0x6')][_0xde23('0x11')][this[_0xde23('0x5')]['id']])){logger[_0xde23('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xde23('0x4')]['id'],this[_0xde23('0x5')]['id']);setTimeout(this[_0xde23('0xc')]['bind'](this),0x3e8);}else{if(this[_0xde23('0x2')]['forcedOwnership']||util[_0xde23('0x12')](this[_0xde23('0x4')]['id'],this[_0xde23('0x6')][_0xde23('0x11')][this[_0xde23('0x5')]['id']],this['squeue'][_0xde23('0x13')],![])){this['realtime']['agents'][this[_0xde23('0x5')]['id']]['busy']=!![];this['realtime'][_0xde23('0x11')][this[_0xde23('0x5')]['id']][_0xde23('0x14')]=undefined;util['showNotification'](this['notificationId'],this['squeue']['id'],this[_0xde23('0x6')][_0xde23('0x11')][this[_0xde23('0x5')]['id']],null,this[_0xde23('0x2')]);util[_0xde23('0x15')](this[_0xde23('0x4')]['id'],this['realtime'][_0xde23('0x11')][this[_0xde23('0x5')]['id']],'RINGING'+(this['routing'][_0xde23('0x16')]?':FORCED':''));}else{logger[_0xde23('0xf')](_0xde23('0x17'),this['squeue']['id'],this[_0xde23('0x5')]['id']);setTimeout(this[_0xde23('0xc')][_0xde23('0x7')](this),0x3e8);}}};Agent[_0xde23('0xb')][_0xde23('0x8')]=function(_0x2b88ad){if(_[_0xde23('0x10')](this[_0xde23('0x6')][_0xde23('0x11')][this[_0xde23('0x5')]['id']])){return logger[_0xde23('0xf')](_0xde23('0x18'),this[_0xde23('0x4')]['id'],this[_0xde23('0x5')]['id']);}else{logger[_0xde23('0xf')](_0xde23('0x19'),this[_0xde23('0x4')]['id'],this[_0xde23('0x5')]['id']);util[_0xde23('0x1a')](this[_0xde23('0x3')],this[_0xde23('0x4')]['id'],this[_0xde23('0x6')][_0xde23('0x11')][this['agent']['id']],null,this['routing']);this[_0xde23('0x6')]['agents'][this[_0xde23('0x5')]['id']][_0xde23('0x1b')]=![];this[_0xde23('0x6')]['agents'][this[_0xde23('0x5')]['id']][_0xde23('0x14')]=undefined;util['writeLog'](this[_0xde23('0x4')]['id'],this[_0xde23('0x6')][_0xde23('0x11')][this[_0xde23('0x5')]['id']],_0x2b88ad?_0xde23('0x1c'):_0xde23('0x1d'));}if(!_0x2b88ad){setTimeout(this[_0xde23('0xc')][_0xde23('0x7')](this),0x3e8);}};function agent(_0x37a337,_0x711426,_0x3e86b2,_0xef82c3){return new Agent(_0x37a337,_0x711426,_0x3e86b2,_0xef82c3);}module['exports']=agent; \ No newline at end of file +var _0xea12=['bind','handleDrained','prototype','info','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busy','busyQueue','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','notificationId','STOP','exports','lodash','uuid','./util','../../../../../config/logger','routing','squeue','agent','realtime','push','handleRun','handleTimeout','timeout'];(function(_0x4130f6,_0x10a2a3){var _0x28a921=function(_0xcf2ec7){while(--_0xcf2ec7){_0x4130f6['push'](_0x4130f6['shift']());}};_0x28a921(++_0x10a2a3);}(_0xea12,0x149));var _0x2ea1=function(_0x38a862,_0x3efd4d){_0x38a862=_0x38a862-0x0;var _0x1f6d43=_0xea12[_0x38a862];return _0x1f6d43;};'use strict';var _=require(_0x2ea1('0x0'));var uuid=require(_0x2ea1('0x1'));var util=require(_0x2ea1('0x2'));var logger=require(_0x2ea1('0x3'))(_0x2ea1('0x4'));var Agent=function(_0x1606a4,_0x4b8b1c,_0x424732,_0x2853db){this['notificationId']=uuid['v4']();this[_0x2ea1('0x5')]=_0x1606a4;this[_0x2ea1('0x6')]=_0x4b8b1c;this[_0x2ea1('0x7')]=_0x424732;this[_0x2ea1('0x4')]=_0x2853db;this['squeue'][_0x2ea1('0x8')](this[_0x2ea1('0x9')]['bind'](this),this[_0x2ea1('0xa')]['bind'](this));this[_0x2ea1('0x5')]['on'](_0x2ea1('0xb'),this[_0x2ea1('0xa')][_0x2ea1('0xc')](this));this[_0x2ea1('0x5')]['on']('drained',this[_0x2ea1('0xd')][_0x2ea1('0xc')](this));};Agent['prototype']['push']=function(){this[_0x2ea1('0x5')][_0x2ea1('0x8')](this['handleRun']['bind'](this),this[_0x2ea1('0xa')][_0x2ea1('0xc')](this));};Agent['prototype'][_0x2ea1('0xd')]=function(){this[_0x2ea1('0xa')](!![]);};Agent[_0x2ea1('0xe')][_0x2ea1('0x9')]=function(_0x228acb){logger[_0x2ea1('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x2ea1('0x5')]['id'],this['agent']['id']);if(_['isNil'](this[_0x2ea1('0x7')][_0x2ea1('0x10')][this[_0x2ea1('0x6')]['id']])){logger[_0x2ea1('0xf')](_0x2ea1('0x11'),this['squeue']['id'],this[_0x2ea1('0x6')]['id']);setTimeout(this[_0x2ea1('0x8')][_0x2ea1('0xc')](this),0x3e8);}else{if(this[_0x2ea1('0x4')][_0x2ea1('0x12')]||util['isAgentAvailable'](this[_0x2ea1('0x5')]['id'],this[_0x2ea1('0x7')]['agents'][this[_0x2ea1('0x6')]['id']],this['squeue'][_0x2ea1('0x13')],![])){this[_0x2ea1('0x7')][_0x2ea1('0x10')][this[_0x2ea1('0x6')]['id']][_0x2ea1('0x14')]=!![];this[_0x2ea1('0x7')]['agents'][this[_0x2ea1('0x6')]['id']][_0x2ea1('0x15')]=undefined;util[_0x2ea1('0x16')](this['notificationId'],this[_0x2ea1('0x5')]['id'],this[_0x2ea1('0x7')][_0x2ea1('0x10')][this[_0x2ea1('0x6')]['id']],null,this[_0x2ea1('0x4')]);util[_0x2ea1('0x17')](this[_0x2ea1('0x5')]['id'],this[_0x2ea1('0x7')][_0x2ea1('0x10')][this[_0x2ea1('0x6')]['id']],'RINGING'+(this[_0x2ea1('0x4')][_0x2ea1('0x12')]?_0x2ea1('0x18'):''));}else{logger[_0x2ea1('0xf')](_0x2ea1('0x19'),this[_0x2ea1('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x2ea1('0x8')]['bind'](this),0x3e8);}}};Agent[_0x2ea1('0xe')][_0x2ea1('0xa')]=function(_0x2b0fff){if(_['isNil'](this[_0x2ea1('0x7')][_0x2ea1('0x10')][this[_0x2ea1('0x6')]['id']])){return logger[_0x2ea1('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x2ea1('0x5')]['id'],this[_0x2ea1('0x6')]['id']);}else{logger[_0x2ea1('0xf')](_0x2ea1('0x1a'),this[_0x2ea1('0x5')]['id'],this[_0x2ea1('0x6')]['id']);util[_0x2ea1('0x1b')](this[_0x2ea1('0x1c')],this[_0x2ea1('0x5')]['id'],this[_0x2ea1('0x7')][_0x2ea1('0x10')][this[_0x2ea1('0x6')]['id']],null,this['routing']);this[_0x2ea1('0x7')]['agents'][this['agent']['id']]['busy']=![];this['realtime'][_0x2ea1('0x10')][this[_0x2ea1('0x6')]['id']]['busyQueue']=undefined;util[_0x2ea1('0x17')](this[_0x2ea1('0x5')]['id'],this[_0x2ea1('0x7')][_0x2ea1('0x10')][this['agent']['id']],_0x2b0fff?_0x2ea1('0x1d'):'TIMEOUT');}if(!_0x2b0fff){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x1c0ba7,_0x3002bd,_0x4cc369,_0x50f678){return new Agent(_0x1c0ba7,_0x3002bd,_0x4cc369,_0x50f678);}module[_0x2ea1('0x1e')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 62f31c1..4a486e1 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 _0x88b3=['queue','realtime','push','handleRun','bind','handleTimeout','timeout','prototype','handleDrained','isNil','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','busy','busyQueue','name','showNotification','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','STOP','exports','lodash','uuid','./util','routing','notificationId','squeue'];(function(_0x22a6c2,_0x4b44c2){var _0x31794f=function(_0x59b408){while(--_0x59b408){_0x22a6c2['push'](_0x22a6c2['shift']());}};_0x31794f(++_0x4b44c2);}(_0x88b3,0x180));var _0x388b=function(_0x6fc473,_0x20b7e2){_0x6fc473=_0x6fc473-0x0;var _0x4894ce=_0x88b3[_0x6fc473];return _0x4894ce;};'use strict';var _=require(_0x388b('0x0'));var uuid=require(_0x388b('0x1'));var util=require(_0x388b('0x2'));var logger=require('../../../../../config/logger')(_0x388b('0x3'));var Beepall=function(_0x4113fa,_0x3d54d1,_0x12933e,_0x3850bc){this[_0x388b('0x4')]=uuid['v4']();this[_0x388b('0x5')]=_0x4113fa;this[_0x388b('0x6')]=_0x3d54d1;this[_0x388b('0x7')]=_0x12933e;this[_0x388b('0x3')]=_0x3850bc;this[_0x388b('0x5')][_0x388b('0x8')](this[_0x388b('0x9')][_0x388b('0xa')](this),this[_0x388b('0xb')]['bind'](this));this[_0x388b('0x5')]['on'](_0x388b('0xc'),this['handleTimeout'][_0x388b('0xa')](this));this[_0x388b('0x5')]['on']('drained',this['handleDrained'][_0x388b('0xa')](this));};Beepall[_0x388b('0xd')][_0x388b('0x8')]=function(){this[_0x388b('0x5')][_0x388b('0x8')](this[_0x388b('0x9')][_0x388b('0xa')](this),this[_0x388b('0xb')][_0x388b('0xa')](this));};Beepall['prototype'][_0x388b('0xe')]=function(_0x2ca07e){this[_0x388b('0xb')](!![]);};Beepall[_0x388b('0xd')][_0x388b('0x9')]=function(_0x3c24be){var _0x5b6f97=!![];if(!_[_0x388b('0xf')](this[_0x388b('0x6')])&&!_[_0x388b('0xf')](this[_0x388b('0x6')][_0x388b('0x10')])&&this[_0x388b('0x6')][_0x388b('0x10')][_0x388b('0x11')]>0x0){for(var _0x45e007=0x0,_0x45d7af;_0x45e0070x0){for(var _0xb5375b=0x0,_0x2cc3ae;_0xb5375b0x0&&_0x15cbf2[_0x2a6c09+'CurrentCapacity']>=_0x15cbf2[_0x2a6c09+_0x1d1f('0x27')]){writeLog(_0x450f32,_0x15cbf2,_0x2a6c09[_0x1d1f('0x28')]()+_0x1d1f('0x29'));return![];}}return!![];};exports[_0x1d1f('0x2a')]=function(_0x48f73b,_0x57e405,_0x398108,_0x3a6e0b,_0x2b99e3){return sendNotification(!![],_0x48f73b,_0x57e405,_0x398108,_0x3a6e0b,_0x2b99e3);};exports[_0x1d1f('0x2b')]=function(_0x285c98,_0x44e3c1,_0x5efc5c,_0x559f20,_0x4a2c75){return sendNotification(![],_0x285c98,_0x44e3c1,_0x5efc5c,_0x559f20,_0x4a2c75);};exports[_0x1d1f('0x2c')]=writeLog; \ No newline at end of file +var _0x959e=['writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','format','name','emit','user:save','split','\x20interaction','notificationSound','notificationShake','body','queue','msg','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','notification:%s','save','remove','isAgentAvailable','Pause','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification'];(function(_0xb5b817,_0x36f156){var _0x3bcedf=function(_0x575d2c){while(--_0x575d2c){_0xb5b817['push'](_0xb5b817['shift']());}};_0x3bcedf(++_0x36f156);}(_0x959e,0x1e2));var _0xe959=function(_0x2a0738,_0x3c0bc5){_0x2a0738=_0x2a0738-0x0;var _0x159679=_0x959e[_0x2a0738];return _0x159679;};'use strict';var _=require(_0xe959('0x0'));var util=require(_0xe959('0x1'));var utils=require(_0xe959('0x2'));var Mustache=require('mustache');var Redis=require(_0xe959('0x3'));var config=require(_0xe959('0x4'));var logger=require(_0xe959('0x5'))(_0xe959('0x6'));config[_0xe959('0x7')]=_[_0xe959('0x8')](config['redis'],{'host':_0xe959('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe959('0x7')]));function emit(_0xd2bb6e,_0x2df805,_0x36fe93){io['to'](_0xd2bb6e)['emit'](_0x2df805,_0x36fe93);}function sendNotification(_0x4ecd72,_0x257fc7,_0x5f39e2,_0x4de475,_0x200c5d,_0x264816){io['to'](util[_0xe959('0xa')]('user:%s',_0x4de475[_0xe959('0xb')]))[_0xe959('0xc')](_0xe959('0xd'),_0x4de475);var _0x58ca1c=_0x264816||{};var _0x20798c=_0x5f39e2[_0xe959('0xe')]('.');var _0x44ec4f={'uniqueid':_0x257fc7,'channel':_0x20798c[0x0],'id':_0x20798c[0x1],'title':_0x20798c[0x0]+_0xe959('0xf'),'interactionId':_0x20798c[0x2],'queue':_0x200c5d?_0x200c5d[_0xe959('0xb')]:null,'sound':_0x58ca1c['account'][_0xe959('0x10')],'shake':_0x58ca1c['account'][_0xe959('0x11')]};try{if(!_0x58ca1c['body']){_0x58ca1c[_0xe959('0x12')]={};}if(_0x200c5d){_0x58ca1c[_0xe959('0x12')][_0xe959('0x13')]=_0x200c5d;}else if(_0x58ca1c[_0xe959('0x12')][_0xe959('0x13')]){delete _0x58ca1c[_0xe959('0x12')][_0xe959('0x13')];}_0x44ec4f[_0xe959('0x14')]=utils['getMustacheRender'](_0x58ca1c['account'][_0xe959('0x15')],_0x58ca1c);}catch(_0x59c975){_0x44ec4f[_0xe959('0x14')]=_0xe959('0x16');logger[_0xe959('0x17')](util['format'](_0xe959('0x18'),_0x257fc7,_0x59c975[_0xe959('0x19')]));}io['to'](util[_0xe959('0xa')]('user:%s',_0x4de475[_0xe959('0xb')]))['emit'](util[_0xe959('0xa')](_0xe959('0x1a'),_0x4ecd72?_0xe959('0x1b'):_0xe959('0x1c')),_0x44ec4f);}function writeLog(_0x4ad6ac,_0x463f24,_0x53cfcb){return logger['info'](util[_0xe959('0xa')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x4ad6ac,_0x463f24['name'],_0x53cfcb));}exports[_0xe959('0x1d')]=function(_0x35bf27,_0x5c02d8,_0x34af4a,_0x37f638){if(_0x5c02d8['busy']){writeLog(_0x35bf27,_0x5c02d8,'BUSY');return![];}if(!_0x5c02d8['online']){writeLog(_0x35bf27,_0x5c02d8,'OFFLINE');return![];}if(_0x5c02d8[_0x34af4a+_0xe959('0x1e')]){writeLog(_0x35bf27,_0x5c02d8,'PAUSE');return![];}if(_0x37f638&&_0x5c02d8[_0xe959('0x1f')](_0x34af4a+_0xe959('0x20'))&&_0x5c02d8[_0xe959('0x1f')](_0x34af4a+'CurrentCapacity')){if(_0x5c02d8[_0x34af4a+_0xe959('0x20')]>0x0&&_0x5c02d8[_0x34af4a+_0xe959('0x21')]>=_0x5c02d8[_0x34af4a+_0xe959('0x20')]){writeLog(_0x35bf27,_0x5c02d8,_0x34af4a['toUpperCase']()+_0xe959('0x22'));return![];}}return!![];};exports[_0xe959('0x23')]=function(_0x2a39ad,_0x46dceb,_0xbd3635,_0x14a521,_0x562d76){return sendNotification(!![],_0x2a39ad,_0x46dceb,_0xbd3635,_0x14a521,_0x562d76);};exports['hideNotification']=function(_0x4320a3,_0x137158,_0x41f41b,_0x590730,_0x4125b9){return sendNotification(![],_0x4320a3,_0x137158,_0x41f41b,_0x590730,_0x4125b9);};exports[_0xe959('0x24')]=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 49299c6..2a34f15 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 _0xe484=['body','[%s][SYSTEM]\x20%s','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','join','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable'];(function(_0x587085,_0x1c656a){var _0x1b95d1=function(_0x5773d1){while(--_0x5773d1){_0x587085['push'](_0x587085['shift']());}};_0x1b95d1(++_0x1c656a);}(_0xe484,0x127));var _0x4e48=function(_0x410883,_0x53afe1){_0x410883=_0x410883-0x0;var _0x5d7231=_0xe484[_0x410883];return _0x5d7231;};'use strict';var schema=require(_0x4e48('0x0'));var sh=require(_0x4e48('0x1'));var _=require(_0x4e48('0x2'));var utils=require(_0x4e48('0x3'));var logger=require(_0x4e48('0x4'))(_0x4e48('0x5'));var system=schema({'command':{'type':_0x4e48('0x6'),'required':!![],'message':_0x4e48('0x7')}});exports[_0x4e48('0x8')]=function(_0x1f9f4d,_0x3c7323){return function(_0x16de98){try{var _0x547a33={'command':_0x3c7323[0x0]};var _0x4bf901=system[_0x4e48('0x0')](_0x547a33,{'typecast':!![]});if(_0x4bf901[_0x4e48('0x9')]){logger[_0x4e48('0xa')]('[%s][SYSTEM]\x20%s',_0x1f9f4d,_[_0x4e48('0xb')](_0x4bf901,_0x4e48('0xc'))[_0x4e48('0xd')](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x1f9f4d);_0x16de98[_0x4e48('0xe')]();}else{var _0x36ef1d=this;var _0x586008=utils[_0x4e48('0xf')](_0x3c7323[0x0],this);logger[_0x4e48('0x10')](_0x4e48('0x11'),_0x1f9f4d,_0x586008);sh[_0x4e48('0x12')](_[_0x4e48('0x13')](_0x586008),function(_0x25b2ca,_0x8b3fcb){logger[_0x4e48('0x10')](_0x4e48('0x14'),_0x1f9f4d,_0x25b2ca);if(_0x25b2ca==0x0){var _0x3cf798=_0x8b3fcb['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x4e48('0x15')](_0x3c7323[0x1])||_[_0x4e48('0x16')](_0x3c7323[0x1])){logger['info'](_0x4e48('0x17'),_0x1f9f4d);_0x36ef1d[_0x4e48('0x18')][_0x3c7323[0x1]]=_0x3cf798;}else{logger[_0x4e48('0x10')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x1f9f4d,_0x3c7323[0x1],_0x3cf798);_0x36ef1d[_0x4e48('0x18')][_0x3c7323[0x1]]=_0x3cf798;}}_0x16de98['next']();});}}catch(_0x46a839){logger[_0x4e48('0xa')](_0x4e48('0x19'),_0x1f9f4d,_[_0x4e48('0x1a')](_0x46a839)?JSON[_0x4e48('0x1b')](_0x46a839):_0x46a839);logger['info'](_0x4e48('0x1c'),_0x1f9f4d);_0x16de98['next']();}};}; \ No newline at end of file +var _0x8e4a=['[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','consequence','length'];(function(_0x15c6ed,_0x36e3ab){var _0x152ac0=function(_0x268729){while(--_0x268729){_0x15c6ed['push'](_0x15c6ed['shift']());}};_0x152ac0(++_0x36e3ab);}(_0x8e4a,0x1e5));var _0xa8e4=function(_0x142d8c,_0x58b692){_0x142d8c=_0x142d8c-0x0;var _0x3a557e=_0x8e4a[_0x142d8c];return _0x3a557e;};'use strict';var schema=require(_0xa8e4('0x0'));var sh=require(_0xa8e4('0x1'));var _=require(_0xa8e4('0x2'));var utils=require(_0xa8e4('0x3'));var logger=require(_0xa8e4('0x4'))(_0xa8e4('0x5'));var system=schema({'command':{'type':_0xa8e4('0x6'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xa8e4('0x7')]=function(_0x56ab33,_0x52fa9f){return function(_0x320898){try{var _0x5ae0d2={'command':_0x52fa9f[0x0]};var _0x5bc0d8=system[_0xa8e4('0x0')](_0x5ae0d2,{'typecast':!![]});if(_0x5bc0d8[_0xa8e4('0x8')]){logger['error'](_0xa8e4('0x9'),_0x56ab33,_[_0xa8e4('0xa')](_0x5bc0d8,'message')[_0xa8e4('0xb')](',\x20'));logger[_0xa8e4('0xc')](_0xa8e4('0xd'),_0x56ab33);_0x320898[_0xa8e4('0xe')]();}else{var _0x461e64=this;var _0x52b442=utils[_0xa8e4('0xf')](_0x52fa9f[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x56ab33,_0x52b442);sh[_0xa8e4('0x10')](_[_0xa8e4('0x11')](_0x52b442),function(_0x3616ba,_0x2a220a){logger['info'](_0xa8e4('0x12'),_0x56ab33,_0x3616ba);if(_0x3616ba==0x0){var _0x40cf81=_0x2a220a[_0xa8e4('0x13')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x52fa9f[0x1])||_[_0xa8e4('0x14')](_0x52fa9f[0x1])){logger[_0xa8e4('0xc')](_0xa8e4('0x15'),_0x56ab33);_0x461e64[_0xa8e4('0x16')][_0x52fa9f[0x1]]=_0x40cf81;}else{logger[_0xa8e4('0xc')](_0xa8e4('0x17'),_0x56ab33,_0x52fa9f[0x1],_0x40cf81);_0x461e64['body'][_0x52fa9f[0x1]]=_0x40cf81;}}_0x320898[_0xa8e4('0xe')]();});}}catch(_0x12a3c2){logger['error'](_0xa8e4('0x9'),_0x56ab33,_[_0xa8e4('0x18')](_0x12a3c2)?JSON[_0xa8e4('0x19')](_0x12a3c2):_0x12a3c2);logger['info'](_0xa8e4('0xd'),_0x56ab33);_0x320898['next']();}};}; \ 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 cbf294a..4adc690 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 _0x7a54=['finally','error','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s','map','join','next','channel','Interaction','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x228e12,_0x1dcd90){var _0x1a9a54=function(_0x233d05){while(--_0x233d05){_0x228e12['push'](_0x228e12['shift']());}};_0x1a9a54(++_0x1dcd90);}(_0x7a54,0x106));var _0x47a5=function(_0x15480d,_0x544b7b){_0x15480d=_0x15480d-0x0;var _0x3191c5=_0x7a54[_0x15480d];return _0x3191c5;};'use strict';var schema=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var rpc={'chatInteraction':require(_0x47a5('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x47a5('0x3')),'mailInteraction':require(_0x47a5('0x4')),'faxInteraction':require('../../rpc/faxInteraction')};var logger=require(_0x47a5('0x5'))(_0x47a5('0x6'));var tag=schema({'tag':{'type':_0x47a5('0x7'),'required':!![],'message':_0x47a5('0x8')}});exports[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629,_0x59199c,_0x343372){return function(_0x30e405){try{var _0x506eda={'tag':_0x3d5629[0x0]};var _0x194fb0=tag['validate'](_0x506eda,{'typecast':!![]});if(_0x194fb0['length']){logger['error'](_0x47a5('0xa'),_0x545a97,_[_0x47a5('0xb')](_0x194fb0,'message')[_0x47a5('0xc')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x545a97);_0x30e405[_0x47a5('0xd')]();}else{var _0x69e4d4={'ids':[_0x3d5629[0x0]]};if(rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')]){rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')][_0x47a5('0x10')](_0x343372['interaction']['id'],_0x69e4d4)[_0x47a5('0x11')](function(_0x221b54){logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x545a97,_0x3d5629[0x1],_0x343372[_0x47a5('0xe')],_0x343372[_0x47a5('0x14')]['id']);})[_0x47a5('0x15')](function(_0x190faa){logger['error'](_0x47a5('0xa'),_0x545a97,JSON[_0x47a5('0x16')](_0x190faa));logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);})[_0x47a5('0x18')](function(){_0x30e405['next']();});}}}catch(_0x549de3){logger[_0x47a5('0x19')]('[%s][TAG]\x20%s',_0x545a97,_['isObject'](_0x549de3)?JSON[_0x47a5('0x16')](_0x549de3):_0x549de3);logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);_0x30e405[_0x47a5('0xd')]();}};}; \ No newline at end of file +var _0x9957=['join','info','next','Interaction','channel','addTags','interaction','then','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message'];(function(_0x12314f,_0x2ac7ae){var _0x3b6e61=function(_0x2b41b5){while(--_0x2b41b5){_0x12314f['push'](_0x12314f['shift']());}};_0x3b6e61(++_0x2ac7ae);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var rpc={'chatInteraction':require(_0x7995('0x2')),'openchannelInteraction':require(_0x7995('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x7995('0x4')),'faxInteraction':require(_0x7995('0x5'))};var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x7995('0x8')}});exports[_0x7995('0x9')]=function(_0x137b6b,_0x219534,_0xbda126,_0x326741){return function(_0x4996ca){try{var _0x465276={'tag':_0x219534[0x0]};var _0x1cad37=tag['validate'](_0x465276,{'typecast':!![]});if(_0x1cad37[_0x7995('0xa')]){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,_[_0x7995('0xd')](_0x1cad37,_0x7995('0xe'))[_0x7995('0xf')](',\x20'));logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);_0x4996ca[_0x7995('0x11')]();}else{var _0x41c652={'ids':[_0x219534[0x0]]};if(rpc[_0x326741['channel']+_0x7995('0x12')]){rpc[_0x326741[_0x7995('0x13')]+_0x7995('0x12')][_0x7995('0x14')](_0x326741[_0x7995('0x15')]['id'],_0x41c652)[_0x7995('0x16')](function(_0x2bbe7a){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x137b6b,_0x219534[0x1],_0x326741[_0x7995('0x13')],_0x326741[_0x7995('0x15')]['id']);})[_0x7995('0x17')](function(_0x321ae8){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,JSON[_0x7995('0x18')](_0x321ae8));logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);})[_0x7995('0x19')](function(){_0x4996ca['next']();});}}}catch(_0x2f832e){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,_[_0x7995('0x1a')](_0x2f832e)?JSON[_0x7995('0x18')](_0x2f832e):_0x2f832e);logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);_0x4996ca['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 1c453af..886b2cd 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 _0x8ccb=['merge','message','account','interaction','mustache','lodash','render'];(function(_0xb367cc,_0x217cfc){var _0x52392a=function(_0x5f2218){while(--_0x5f2218){_0xb367cc['push'](_0xb367cc['shift']());}};_0x52392a(++_0x217cfc);}(_0x8ccb,0x1c4));var _0xb8cc=function(_0x585ee5,_0x1c9dba){_0x585ee5=_0x585ee5-0x0;var _0x470808=_0x8ccb[_0x585ee5];return _0x470808;};'use strict';var Mustache=require(_0xb8cc('0x0'));var _=require(_0xb8cc('0x1'));module['exports']={'getMustacheRender':function(_0x1fe9e0,_0x101ec1){return Mustache[_0xb8cc('0x2')](_0x1fe9e0,_[_0xb8cc('0x3')](_0x101ec1['body'],{'contact':_0x101ec1['contact'],'message':_0x101ec1[_0xb8cc('0x4')],'account':_0x101ec1[_0xb8cc('0x5')],'interaction':_0x101ec1[_0xb8cc('0x6')],'list':_0x101ec1['list']}))||'';}}; \ No newline at end of file +var _0x14ee=['body','contact','message','account','mustache','render','merge'];(function(_0x238af7,_0x1516e8){var _0x2db5fd=function(_0x4fe0d6){while(--_0x4fe0d6){_0x238af7['push'](_0x238af7['shift']());}};_0x2db5fd(++_0x1516e8);}(_0x14ee,0x115));var _0xe14e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x14ee[_0x14add3];return _0x4a174f;};'use strict';var Mustache=require(_0xe14e('0x0'));var _=require('lodash');module['exports']={'getMustacheRender':function(_0xfe268d,_0x43dba9){return Mustache[_0xe14e('0x1')](_0xfe268d,_[_0xe14e('0x2')](_0x43dba9[_0xe14e('0x3')],{'contact':_0x43dba9[_0xe14e('0x4')],'message':_0x43dba9[_0xe14e('0x5')],'account':_0x43dba9[_0xe14e('0x6')],'interaction':_0x43dba9['interaction'],'list':_0x43dba9['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index ca7bcd0..7a905ae 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 _0x1049=['mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','app','.js','toLowerCase','autoreply','split','push','slice','dialogflow','appdata','join','amazonlex','tag','TagId','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','stringify','matchPath','stack','routing\x20is\x20empty','emit','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','chatQueues','name','waiting','mailQueues','available','loggedIn','paused','openchannelQueues','smsQueues','faxQueues','values','chatQueuesWaitingInteractions'];(function(_0x45e4d5,_0x296afb){var _0x3491b3=function(_0x4de0ac){while(--_0x4de0ac){_0x45e4d5['push'](_0x45e4d5['shift']());}};_0x3491b3(++_0x296afb);}(_0x1049,0x65));var _0x9104=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1049[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x9104('0x0'));var path=require(_0x9104('0x1'));var fs=require('fs');var jayson=require(_0x9104('0x2'));var BPromise=require('bluebird');var uuid=require('uuid');var config=require('../../../config/environment');var logger=require(_0x9104('0x3'))(_0x9104('0x4'));var rpc={'openchannelQueueReport':require(_0x9104('0x5'))};var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x9104('0x6')),'chatQueueReport':require(_0x9104('0x7')),'smsQueueReport':require(_0x9104('0x8')),'faxQueueReport':require(_0x9104('0x9'))};var RuleEngine=require(_0x9104('0xa'));function getId(_0x119504,_0x2129a0,_0x3fb1b5){return util[_0x9104('0xb')](_0x9104('0xc'),_0x119504,_0x2129a0||0x0,_0x3fb1b5||0x0);}function getIntervals(_0x4e201c,_0x58e45b){var _0x1c1bc4=[];if(!_[_0x9104('0xd')](_0x58e45b[_0x9104('0xe')])&&!_['isNil'](_0x4e201c[_0x58e45b['IntervalId']])&&!_['isNil'](_0x4e201c[_0x58e45b['IntervalId']][_0x9104('0xf')])){_0x1c1bc4=_[_0x9104('0x10')](_0x4e201c[_0x58e45b['IntervalId']]['Intervals'],_0x9104('0x11'));}else if(!_[_0x9104('0xd')](_0x58e45b['interval'])){_0x1c1bc4=[_0x58e45b[_0x9104('0x11')]];}return _0x1c1bc4;}exports[_0x9104('0x12')]=function(_0x40fb80){_0x40fb80[_0x9104('0x13')]={};return new BPromise(function(_0x54b909,_0x172c85){var _0x253050={'Start':function(_0x28c925){var _0x65e2b2=this;return new Promise(function(_0x542d89,_0x31cc84){if(_0x28c925){try{var _0x2c52e8=[];var _0xe9f9c=getId(_0x28c925[_0x9104('0x14')],_0x28c925[_0x9104('0x15')]?_0x28c925[_0x9104('0x15')]['id']:0x0,_0x28c925[_0x9104('0x16')]?_0x28c925[_0x9104('0x16')]['id']:0x0);if(_0x28c925[_0x9104('0x17')]&&_[_0x9104('0x18')](_0x28c925[_0x9104('0x17')])&&_0x28c925[_0x9104('0x17')][_0x9104('0x19')]){for(var _0x3630c5=0x0;_0x3630c5<_0x28c925[_0x9104('0x17')][_0x9104('0x19')];_0x3630c5+=0x1){var _0x325f85=_0x28c925[_0x9104('0x17')][_0x3630c5];if(fs['existsSync'](path['join'](__dirname,_0x9104('0x17'),_0x325f85[_0x9104('0x1a')]+_0x9104('0x1b')))){var _0x23a876=[];switch(_0x325f85[_0x9104('0x1a')][_0x9104('0x1c')]()){case _0x9104('0x1d'):var _0x5d11fd=_0x325f85['appdata'][_0x9104('0x1e')](',');_0x23a876[_0x9104('0x1f')](_0x5d11fd[0x0]);_0x23a876[_0x9104('0x1f')](_0x5d11fd[_0x9104('0x20')](0x1,_0x5d11fd[_0x9104('0x19')])['join'](','));break;case _0x9104('0x21'):var _0x6ea674=_0x325f85[_0x9104('0x22')][_0x9104('0x1e')](',');_0x23a876[_0x9104('0x1f')](_0x6ea674[0x0]);_0x23a876[_0x9104('0x1f')](_0x6ea674[0x1]);_0x23a876[_0x9104('0x1f')](_0x6ea674[_0x9104('0x20')](0x2,_0x6ea674[_0x9104('0x19')])[_0x9104('0x23')](','));break;case _0x9104('0x24'):var _0x5c598e=_0x325f85['appdata']['split'](',');_0x23a876['push'](_0x5c598e[0x0]);_0x23a876[_0x9104('0x1f')](_0x5c598e[0x1]);_0x23a876[_0x9104('0x1f')](_0x5c598e[0x2]);_0x23a876[_0x9104('0x1f')](_0x5c598e[0x3]);_0x23a876[_0x9104('0x1f')](_0x5c598e[_0x9104('0x20')](0x4,_0x5c598e['length'])[_0x9104('0x23')](','));break;case _0x9104('0x15'):_0x23a876['push'](_0x325f85['appdata']);break;case _0x9104('0x25'):_0x23a876[_0x9104('0x1f')](_0x325f85[_0x9104('0x26')]);_0x23a876[_0x9104('0x1f')](_0x325f85[_0x9104('0x22')]);break;default:_0x23a876=_[_0x9104('0xd')](_0x325f85[_0x9104('0x22')])?[]:_0x325f85[_0x9104('0x22')][_0x9104('0x1e')](',');}var _0x39ba09={'id':util[_0x9104('0xb')]('%s:%s:%s',_0xe9f9c,_0x325f85['id'],_0x325f85['app']),'condition':require(_0x9104('0x27'))[_0x9104('0x28')](_0xe9f9c,getIntervals(_0x40fb80[_0x9104('0x29')],_0x325f85),_0x40fb80),'consequence':require(_0x9104('0x2a')+_0x325f85[_0x9104('0x1a')])[_0x9104('0x2b')](_0xe9f9c,_0x23a876,_0x40fb80,_0x28c925),'p':_0x325f85[_0x9104('0x2c')]||0x0};logger[_0x9104('0x2d')](_0x9104('0x2e'),_0x39ba09['id'],_0x9104('0x2f'),getIntervals(_0x40fb80[_0x9104('0x29')],_0x325f85)[_0x9104('0x23')](_0x9104('0x30')));_0x2c52e8[_0x9104('0x1f')](_0x39ba09);}else{logger[_0x9104('0x31')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x9104('0x23')](__dirname,_0x9104('0x17'),_0x325f85[_0x9104('0x1a')]+_0x9104('0x1b')));}}_0x40fb80[_0x9104('0x13')][_0xe9f9c]=new RuleEngine(_0x2c52e8);_0x40fb80[_0x9104('0x13')][_0xe9f9c][_0x9104('0x32')](_0x28c925,function(_0x260226){logger[_0x9104('0x2d')]('Applications\x20executed',JSON[_0x9104('0x33')](_0x260226[_0x9104('0x34')]));if(_0x40fb80[_0x9104('0x13')][_0xe9f9c]){_0x40fb80[_0x9104('0x13')][_0xe9f9c]['emit']('complete');}});return _0x542d89({'code':0xc8,'message':_0x28c925});}else{logger[_0x9104('0x2d')]('No\x20applications\x20to\x20execute');return _0x542d89({'code':0xc8,'message':_0x28c925});}}catch(_0x2d75f7){logger[_0x9104('0x31')](_0x2d75f7[_0x9104('0x35')]);return _0x31cc84(_0x65e2b2['error'](0x1f4,_0x2d75f7));}}return _0x31cc84(_0x9104('0x36'));});},'AcceptMessage':function(_0x416268){var _0x3bcb14=this;return new Promise(function(_0x27554a,_0x418088){if(_0x416268[_0x9104('0x15')]&&_0x416268['message']['id']){try{var _0x30d1ae=getId(_0x416268[_0x9104('0x14')],_0x416268['message']?_0x416268[_0x9104('0x15')]['id']:0x0,_0x416268[_0x9104('0x16')]?_0x416268[_0x9104('0x16')]['id']:0x0);if(_0x40fb80[_0x9104('0x13')][_0x30d1ae]){_0x40fb80[_0x9104('0x13')][_0x30d1ae][_0x9104('0x37')]('end');if(rpc[_0x416268[_0x9104('0x14')]+_0x9104('0x38')]){rpc[_0x416268[_0x9104('0x14')]+_0x9104('0x38')][_0x9104('0x39')](_0x30d1ae,{'UserId':_0x416268[_0x9104('0x15')][_0x9104('0x3a')]})[_0x9104('0x3b')](function(_0x31447f){logger[_0x9104('0x31')](_0x9104('0x3c'));});}}return _0x27554a({'code':0xc8,'message':_0x416268});}catch(_0x5465ce){logger[_0x9104('0x31')](_0x5465ce[_0x9104('0x35')]);return _0x418088(_0x3bcb14[_0x9104('0x31')](0x1f4,_0x5465ce));}}logger[_0x9104('0x31')](_0x9104('0x3d'));return _0x418088(_0x3bcb14[_0x9104('0x31')](0x1f4,_0x9104('0x3d')));});},'RejectMessage':function(_0x4a6cd8){var _0x475c4c=this;return new Promise(function(_0x4b6c4d,_0x136574){if(_0x4a6cd8[_0x9104('0x3e')]&&_0x4a6cd8[_0x9104('0x3e')]['id']){try{if(_0x40fb80[_0x9104('0x3f')][_0x4a6cd8[_0x9104('0x3e')]['id']]){_0x40fb80['agents'][_0x4a6cd8[_0x9104('0x3e')]['id']][_0x9104('0x40')]=![];_0x40fb80[_0x9104('0x3f')][_0x4a6cd8[_0x9104('0x3e')]['id']][_0x9104('0x41')]=undefined;}return _0x4b6c4d({'code':0xc8,'message':_0x4a6cd8});}catch(_0x1b188d){logger[_0x9104('0x31')](_0x1b188d['stack']);return _0x136574(_0x475c4c[_0x9104('0x31')](0x1f4,_0x1b188d));}}logger[_0x9104('0x31')]('message\x20is\x20empty');return _0x136574(_0x475c4c[_0x9104('0x31')](0x1f4,_0x9104('0x3d')));});},'AbandonInteraction':function(_0x45cdc4){var _0x48313c=this;return new Promise(function(_0x3c24f5,_0x109baa){if(_0x45cdc4[_0x9104('0x14')]&&_0x45cdc4[_0x9104('0x16')]&&_0x45cdc4[_0x9104('0x16')]['id']){try{var _0x15dce3=getId(_0x45cdc4[_0x9104('0x14')],_0x45cdc4[_0x9104('0x15')]?_0x45cdc4[_0x9104('0x15')]['id']:0x0,_0x45cdc4[_0x9104('0x16')]?_0x45cdc4[_0x9104('0x16')]['id']:0x0);if(_0x40fb80[_0x9104('0x13')][_0x15dce3]){_0x40fb80[_0x9104('0x13')][_0x15dce3][_0x9104('0x37')](_0x9104('0x42'));}return _0x3c24f5({'code':0xc8,'message':_0x45cdc4});}catch(_0x17aa1c){logger[_0x9104('0x31')](_0x17aa1c[_0x9104('0x35')]);return _0x109baa(_0x48313c[_0x9104('0x31')](0x1f4,_0x17aa1c));}}logger[_0x9104('0x31')](_0x9104('0x3d'));return _0x109baa(_0x48313c['error'](0x1f4,_0x9104('0x3d')));});},'AgentCapacity':function(_0x3a2eed){var _0x6b565a=this;return new Promise(function(_0x3b25cb,_0x414c7d){if(_0x40fb80[_0x9104('0x3f')][_0x9104('0x43')](_0x3a2eed['id'])){for(var _0x3e9339 in _0x3a2eed[_0x9104('0x44')]){if(_0x3a2eed[_0x9104('0x44')][_0x9104('0x43')](_0x3e9339)){if(_0x40fb80['agents'][_0x3a2eed['id']]['hasOwnProperty'](_0x3e9339+'CurrentCapacity')){_0x40fb80['agents'][_0x3a2eed['id']][_0x3e9339+_0x9104('0x45')]=parseInt(_0x3a2eed['capacity'][_0x3e9339],0xa);}}}_0x40fb80[_0x9104('0x3f')][_0x3a2eed['id']][_0x9104('0x46')]();return _0x3b25cb({'code':0xc8,'message':_0x40fb80[_0x9104('0x3f')][_0x3a2eed['id']]});}else{return _0x414c7d(_0x6b565a[_0x9104('0x31')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x163563){return new Promise(function(_0x2cdb0a,_0x2fb745){var _0x31dc38=_['values'](_0x40fb80['agents']);_0x2cdb0a({'count':_0x31dc38[_0x9104('0x19')],'rows':_0x31dc38});});},'ChatQueues':function(_0xa67db1){return new Promise(function(_0x4e066e,_0x364c6c){var _0x542cfe=[];for(var _0x227d9e in _0x40fb80[_0x9104('0x47')]){if(_0x40fb80[_0x9104('0x47')][_0x9104('0x43')](_0x227d9e)){var _0x561a7f=_0x40fb80[_0x9104('0x47')][_0x227d9e];var _0x358e54={'id':_0x561a7f['id'],'available':_0x561a7f['available'],'loggedIn':_0x561a7f['loggedIn'],'name':_0x561a7f[_0x9104('0x48')],'paused':_0x561a7f['paused'],'waiting':_0x561a7f[_0x9104('0x49')]};_0x542cfe[_0x9104('0x1f')](_0x358e54);}}_0x4e066e({'count':_0x542cfe[_0x9104('0x19')],'rows':_0x542cfe});});},'MailQueues':function(_0x36eb05){return new Promise(function(_0x3fd4a6,_0x50c18b){var _0x234320=[];for(var _0x3f3bbf in _0x40fb80[_0x9104('0x4a')]){if(_0x40fb80[_0x9104('0x4a')][_0x9104('0x43')](_0x3f3bbf)){var _0x32cab1=_0x40fb80['mailQueues'][_0x3f3bbf];var _0x5209e0={'id':_0x32cab1['id'],'available':_0x32cab1[_0x9104('0x4b')],'loggedIn':_0x32cab1[_0x9104('0x4c')],'name':_0x32cab1[_0x9104('0x48')],'paused':_0x32cab1[_0x9104('0x4d')],'waiting':_0x32cab1[_0x9104('0x49')]};_0x234320[_0x9104('0x1f')](_0x5209e0);}}_0x3fd4a6({'count':_0x234320[_0x9104('0x19')],'rows':_0x234320});});},'OpenchannelQueues':function(_0x535f91){return new Promise(function(_0x3188da,_0x223ce4){var _0x258ee3=[];for(var _0x2fbe52 in _0x40fb80[_0x9104('0x4e')]){if(_0x40fb80[_0x9104('0x4e')][_0x9104('0x43')](_0x2fbe52)){var _0xe5c2a2=_0x40fb80[_0x9104('0x4e')][_0x2fbe52];var _0x55dad1={'id':_0xe5c2a2['id'],'available':_0xe5c2a2[_0x9104('0x4b')],'loggedIn':_0xe5c2a2[_0x9104('0x4c')],'name':_0xe5c2a2['name'],'paused':_0xe5c2a2['paused'],'waiting':_0xe5c2a2['waiting']};_0x258ee3[_0x9104('0x1f')](_0x55dad1);}}_0x3188da({'count':_0x258ee3[_0x9104('0x19')],'rows':_0x258ee3});});},'SmsQueues':function(_0x2be2c4){return new Promise(function(_0x5b1490,_0x5f2651){var _0x356737=[];for(var _0x34dc63 in _0x40fb80[_0x9104('0x4f')]){if(_0x40fb80[_0x9104('0x4f')][_0x9104('0x43')](_0x34dc63)){var _0x285147=_0x40fb80['smsQueues'][_0x34dc63];var _0x2eaa2e={'id':_0x285147['id'],'available':_0x285147[_0x9104('0x4b')],'loggedIn':_0x285147[_0x9104('0x4c')],'name':_0x285147[_0x9104('0x48')],'paused':_0x285147[_0x9104('0x4d')],'waiting':_0x285147['waiting']};_0x356737['push'](_0x2eaa2e);}}_0x5b1490({'count':_0x356737['length'],'rows':_0x356737});});},'FaxQueues':function(_0x24d7d5){return new Promise(function(_0x11e249,_0x3911d1){var _0x22aea9=[];for(var _0x4c8b26 in _0x40fb80[_0x9104('0x50')]){if(_0x40fb80[_0x9104('0x50')][_0x9104('0x43')](_0x4c8b26)){var _0x59335c=_0x40fb80[_0x9104('0x50')][_0x4c8b26];var _0x17e979={'id':_0x59335c['id'],'available':_0x59335c[_0x9104('0x4b')],'loggedIn':_0x59335c[_0x9104('0x4c')],'name':_0x59335c[_0x9104('0x48')],'paused':_0x59335c[_0x9104('0x4d')],'waiting':_0x59335c[_0x9104('0x49')]};_0x22aea9[_0x9104('0x1f')](_0x17e979);}}_0x11e249({'count':_0x22aea9[_0x9104('0x19')],'rows':_0x22aea9});});},'ChatQueuesWaitingInteractions':function(_0x5bcbfa){return new Promise(function(_0x3358d5,_0x4b0cc4){var _0x46ec68=_[_0x9104('0x51')](_0x40fb80[_0x9104('0x52')]);_0x3358d5({'count':_0x46ec68[_0x9104('0x19')],'rows':_0x46ec68});});},'MailQueuesWaitingInteractions':function(_0x41e5a0){return new Promise(function(_0x23f0d9,_0x1f4841){var _0x4b5397=_[_0x9104('0x51')](_0x40fb80[_0x9104('0x53')]);_0x23f0d9({'count':_0x4b5397[_0x9104('0x19')],'rows':_0x4b5397});});},'OpenchannelQueuesWaitingInteractions':function(_0x1a9828){return new Promise(function(_0x474302,_0x5d2665){var _0x392bc8=_[_0x9104('0x51')](_0x40fb80[_0x9104('0x54')]);_0x474302({'count':_0x392bc8[_0x9104('0x19')],'rows':_0x392bc8});});},'SmsQueuesWaitingInteractions':function(_0x519881){return new Promise(function(_0x3701c0,_0x2682cd){var _0x2f939f=_['values'](_0x40fb80[_0x9104('0x55')]);_0x3701c0({'count':_0x2f939f[_0x9104('0x19')],'rows':_0x2f939f});});},'FaxQueuesWaitingInteractions':function(_0x2db38f){return new Promise(function(_0x34ff89,_0x1c353d){var _0x20a753=_['values'](_0x40fb80[_0x9104('0x56')]);_0x34ff89({'count':_0x20a753['length'],'rows':_0x20a753});});}};var _0x267838=jayson[_0x9104('0x57')](_0x253050)['http']();_0x267838['on'](_0x9104('0x31'),function(_0x5d1396){logger[_0x9104('0x31')](JSON[_0x9104('0x33')](_0x5d1396));return _0x172c85(_0x5d1396);});_0x267838[_0x9104('0x12')](0x232c,_0x9104('0x58'),function(){console[_0x9104('0x59')](_0x9104('0x5a'),0x232c);return _0x54b909(_0x9104('0x5b')+0x232c);});});}; \ No newline at end of file +var _0xb522=['agents','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','mailQueues','waiting','openchannelQueues','smsQueues','name','faxQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','app','.js','toLowerCase','autoreply','appdata','slice','join','dialogflow','split','push','amazonlex','tag','TagId','format','%s:%s:%s','condition','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','stack','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb522,0x73));var _0x2b52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb522[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2b52('0x0'));var path=require(_0x2b52('0x1'));var fs=require('fs');var jayson=require(_0x2b52('0x2'));var BPromise=require('bluebird');var uuid=require(_0x2b52('0x3'));var config=require(_0x2b52('0x4'));var logger=require(_0x2b52('0x5'))('routing');var rpc={'openchannelQueueReport':require(_0x2b52('0x6'))};var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x2b52('0x7')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x2b52('0x8')),'faxQueueReport':require('../rpc/faxQueueReport')};var RuleEngine=require(_0x2b52('0x9'));function getId(_0x5ad0b7,_0x4e0db2,_0x3f476f){return util['format'](_0x2b52('0xa'),_0x5ad0b7,_0x4e0db2||0x0,_0x3f476f||0x0);}function getIntervals(_0x3d42e7,_0x54e68e){var _0x118c40=[];if(!_[_0x2b52('0xb')](_0x54e68e[_0x2b52('0xc')])&&!_['isNil'](_0x3d42e7[_0x54e68e[_0x2b52('0xc')]])&&!_[_0x2b52('0xb')](_0x3d42e7[_0x54e68e['IntervalId']][_0x2b52('0xd')])){_0x118c40=_['map'](_0x3d42e7[_0x54e68e[_0x2b52('0xc')]][_0x2b52('0xd')],_0x2b52('0xe'));}else if(!_[_0x2b52('0xb')](_0x54e68e[_0x2b52('0xe')])){_0x118c40=[_0x54e68e[_0x2b52('0xe')]];}return _0x118c40;}exports[_0x2b52('0xf')]=function(_0x2f4efa){_0x2f4efa[_0x2b52('0x10')]={};return new BPromise(function(_0x2cddde,_0x3143bb){var _0x3a984a={'Start':function(_0x54119a){var _0x3f14c9=this;return new Promise(function(_0x2dc4f7,_0x2b5bdc){if(_0x54119a){try{var _0x5f485b=[];var _0x21314e=getId(_0x54119a[_0x2b52('0x11')],_0x54119a[_0x2b52('0x12')]?_0x54119a[_0x2b52('0x12')]['id']:0x0,_0x54119a['interaction']?_0x54119a[_0x2b52('0x13')]['id']:0x0);if(_0x54119a[_0x2b52('0x14')]&&_[_0x2b52('0x15')](_0x54119a['applications'])&&_0x54119a[_0x2b52('0x14')]['length']){for(var _0x57f990=0x0;_0x57f990<_0x54119a[_0x2b52('0x14')][_0x2b52('0x16')];_0x57f990+=0x1){var _0x44babd=_0x54119a[_0x2b52('0x14')][_0x57f990];if(fs[_0x2b52('0x17')](path['join'](__dirname,_0x2b52('0x14'),_0x44babd[_0x2b52('0x18')]+_0x2b52('0x19')))){var _0x43fd2f=[];switch(_0x44babd[_0x2b52('0x18')][_0x2b52('0x1a')]()){case _0x2b52('0x1b'):var _0xb6a17e=_0x44babd[_0x2b52('0x1c')]['split'](',');_0x43fd2f['push'](_0xb6a17e[0x0]);_0x43fd2f['push'](_0xb6a17e[_0x2b52('0x1d')](0x1,_0xb6a17e['length'])[_0x2b52('0x1e')](','));break;case _0x2b52('0x1f'):var _0x562615=_0x44babd[_0x2b52('0x1c')][_0x2b52('0x20')](',');_0x43fd2f[_0x2b52('0x21')](_0x562615[0x0]);_0x43fd2f[_0x2b52('0x21')](_0x562615[0x1]);_0x43fd2f[_0x2b52('0x21')](_0x562615['slice'](0x2,_0x562615[_0x2b52('0x16')])[_0x2b52('0x1e')](','));break;case _0x2b52('0x22'):var _0x556bcb=_0x44babd['appdata']['split'](',');_0x43fd2f[_0x2b52('0x21')](_0x556bcb[0x0]);_0x43fd2f[_0x2b52('0x21')](_0x556bcb[0x1]);_0x43fd2f[_0x2b52('0x21')](_0x556bcb[0x2]);_0x43fd2f[_0x2b52('0x21')](_0x556bcb[0x3]);_0x43fd2f[_0x2b52('0x21')](_0x556bcb[_0x2b52('0x1d')](0x4,_0x556bcb[_0x2b52('0x16')])[_0x2b52('0x1e')](','));break;case _0x2b52('0x12'):_0x43fd2f[_0x2b52('0x21')](_0x44babd[_0x2b52('0x1c')]);break;case _0x2b52('0x23'):_0x43fd2f[_0x2b52('0x21')](_0x44babd[_0x2b52('0x24')]);_0x43fd2f[_0x2b52('0x21')](_0x44babd[_0x2b52('0x1c')]);break;default:_0x43fd2f=_[_0x2b52('0xb')](_0x44babd['appdata'])?[]:_0x44babd['appdata']['split'](',');}var _0x46040a={'id':util[_0x2b52('0x25')](_0x2b52('0x26'),_0x21314e,_0x44babd['id'],_0x44babd[_0x2b52('0x18')]),'condition':require('./interval')[_0x2b52('0x27')](_0x21314e,getIntervals(_0x2f4efa[_0x2b52('0x28')],_0x44babd),_0x2f4efa),'consequence':require(_0x2b52('0x29')+_0x44babd['app'])['consequence'](_0x21314e,_0x43fd2f,_0x2f4efa,_0x54119a),'p':_0x44babd[_0x2b52('0x2a')]||0x0};logger[_0x2b52('0x2b')](_0x2b52('0x2c'),_0x46040a['id'],_0x2b52('0x2d'),getIntervals(_0x2f4efa[_0x2b52('0x28')],_0x44babd)[_0x2b52('0x1e')]('\x20|\x20'));_0x5f485b[_0x2b52('0x21')](_0x46040a);}else{logger['error'](_0x2b52('0x2e'),path[_0x2b52('0x1e')](__dirname,_0x2b52('0x14'),_0x44babd[_0x2b52('0x18')]+'.js'));}}_0x2f4efa[_0x2b52('0x10')][_0x21314e]=new RuleEngine(_0x5f485b);_0x2f4efa[_0x2b52('0x10')][_0x21314e][_0x2b52('0x2f')](_0x54119a,function(_0x4712ad){logger[_0x2b52('0x2b')](_0x2b52('0x30'),JSON[_0x2b52('0x31')](_0x4712ad[_0x2b52('0x32')]));if(_0x2f4efa[_0x2b52('0x10')][_0x21314e]){_0x2f4efa['rules'][_0x21314e][_0x2b52('0x33')](_0x2b52('0x34'));}});return _0x2dc4f7({'code':0xc8,'message':_0x54119a});}else{logger[_0x2b52('0x2b')](_0x2b52('0x35'));return _0x2dc4f7({'code':0xc8,'message':_0x54119a});}}catch(_0x560f9f){logger[_0x2b52('0x36')](_0x560f9f[_0x2b52('0x37')]);return _0x2b5bdc(_0x3f14c9[_0x2b52('0x36')](0x1f4,_0x560f9f));}}return _0x2b5bdc('routing\x20is\x20empty');});},'AcceptMessage':function(_0x5f3fbb){var _0x51c861=this;return new Promise(function(_0x3cce45,_0x3aeb5a){if(_0x5f3fbb[_0x2b52('0x12')]&&_0x5f3fbb[_0x2b52('0x12')]['id']){try{var _0x12b689=getId(_0x5f3fbb['channel'],_0x5f3fbb[_0x2b52('0x12')]?_0x5f3fbb[_0x2b52('0x12')]['id']:0x0,_0x5f3fbb[_0x2b52('0x13')]?_0x5f3fbb[_0x2b52('0x13')]['id']:0x0);if(_0x2f4efa[_0x2b52('0x10')][_0x12b689]){_0x2f4efa[_0x2b52('0x10')][_0x12b689]['emit'](_0x2b52('0x38'));if(rpc[_0x5f3fbb['channel']+'QueueReport']){rpc[_0x5f3fbb[_0x2b52('0x11')]+_0x2b52('0x39')][_0x2b52('0x3a')](_0x12b689,{'UserId':_0x5f3fbb[_0x2b52('0x12')]['UserId']})[_0x2b52('0x3b')](function(_0xd39d6b){logger[_0x2b52('0x36')](_0x2b52('0x3c'));});}}return _0x3cce45({'code':0xc8,'message':_0x5f3fbb});}catch(_0xba495e){logger['error'](_0xba495e[_0x2b52('0x37')]);return _0x3aeb5a(_0x51c861[_0x2b52('0x36')](0x1f4,_0xba495e));}}logger[_0x2b52('0x36')](_0x2b52('0x3d'));return _0x3aeb5a(_0x51c861['error'](0x1f4,_0x2b52('0x3d')));});},'RejectMessage':function(_0x37651a){var _0x18a908=this;return new Promise(function(_0x89a76d,_0xcdc4e){if(_0x37651a['agent']&&_0x37651a[_0x2b52('0x3e')]['id']){try{if(_0x2f4efa[_0x2b52('0x3f')][_0x37651a['agent']['id']]){_0x2f4efa[_0x2b52('0x3f')][_0x37651a[_0x2b52('0x3e')]['id']]['busy']=![];_0x2f4efa[_0x2b52('0x3f')][_0x37651a[_0x2b52('0x3e')]['id']][_0x2b52('0x40')]=undefined;}return _0x89a76d({'code':0xc8,'message':_0x37651a});}catch(_0x36ec73){logger[_0x2b52('0x36')](_0x36ec73['stack']);return _0xcdc4e(_0x18a908[_0x2b52('0x36')](0x1f4,_0x36ec73));}}logger['error'](_0x2b52('0x3d'));return _0xcdc4e(_0x18a908[_0x2b52('0x36')](0x1f4,_0x2b52('0x3d')));});},'AbandonInteraction':function(_0x4bacd6){var _0x552087=this;return new Promise(function(_0x2994eb,_0x204f89){if(_0x4bacd6['channel']&&_0x4bacd6['interaction']&&_0x4bacd6['interaction']['id']){try{var _0x3ad73a=getId(_0x4bacd6[_0x2b52('0x11')],_0x4bacd6[_0x2b52('0x12')]?_0x4bacd6['message']['id']:0x0,_0x4bacd6[_0x2b52('0x13')]?_0x4bacd6[_0x2b52('0x13')]['id']:0x0);if(_0x2f4efa['rules'][_0x3ad73a]){_0x2f4efa[_0x2b52('0x10')][_0x3ad73a][_0x2b52('0x33')](_0x2b52('0x38'));}return _0x2994eb({'code':0xc8,'message':_0x4bacd6});}catch(_0xda21fe){logger[_0x2b52('0x36')](_0xda21fe[_0x2b52('0x37')]);return _0x204f89(_0x552087['error'](0x1f4,_0xda21fe));}}logger[_0x2b52('0x36')](_0x2b52('0x3d'));return _0x204f89(_0x552087[_0x2b52('0x36')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x15a2e1){var _0x14b63e=this;return new Promise(function(_0x1dc5ad,_0x55fb6b){if(_0x2f4efa['agents'][_0x2b52('0x41')](_0x15a2e1['id'])){for(var _0x40032b in _0x15a2e1['capacity']){if(_0x15a2e1[_0x2b52('0x42')]['hasOwnProperty'](_0x40032b)){if(_0x2f4efa['agents'][_0x15a2e1['id']][_0x2b52('0x41')](_0x40032b+_0x2b52('0x43'))){_0x2f4efa[_0x2b52('0x3f')][_0x15a2e1['id']][_0x40032b+_0x2b52('0x43')]=parseInt(_0x15a2e1[_0x2b52('0x42')][_0x40032b],0xa);}}}_0x2f4efa['agents'][_0x15a2e1['id']][_0x2b52('0x44')]();return _0x1dc5ad({'code':0xc8,'message':_0x2f4efa[_0x2b52('0x3f')][_0x15a2e1['id']]});}else{return _0x55fb6b(_0x14b63e[_0x2b52('0x36')](0x1f4,_0x2b52('0x45')));}});},'Agents':function(_0x30e40b){return new Promise(function(_0x49a8a4,_0x6459f1){var _0x321096=_[_0x2b52('0x46')](_0x2f4efa[_0x2b52('0x3f')]);_0x49a8a4({'count':_0x321096['length'],'rows':_0x321096});});},'ChatQueues':function(_0x3e9c13){return new Promise(function(_0xb8b0e1,_0x214c9b){var _0x1465f3=[];for(var _0x3ab164 in _0x2f4efa[_0x2b52('0x47')]){if(_0x2f4efa[_0x2b52('0x47')]['hasOwnProperty'](_0x3ab164)){var _0x15b2d8=_0x2f4efa[_0x2b52('0x47')][_0x3ab164];var _0x3bc639={'id':_0x15b2d8['id'],'available':_0x15b2d8[_0x2b52('0x48')],'loggedIn':_0x15b2d8[_0x2b52('0x49')],'name':_0x15b2d8['name'],'paused':_0x15b2d8[_0x2b52('0x4a')],'waiting':_0x15b2d8['waiting']};_0x1465f3['push'](_0x3bc639);}}_0xb8b0e1({'count':_0x1465f3['length'],'rows':_0x1465f3});});},'MailQueues':function(_0x11f794){return new Promise(function(_0x2e1d50,_0x106f82){var _0x5c2f51=[];for(var _0x39b006 in _0x2f4efa[_0x2b52('0x4b')]){if(_0x2f4efa[_0x2b52('0x4b')][_0x2b52('0x41')](_0x39b006)){var _0x1b3934=_0x2f4efa[_0x2b52('0x4b')][_0x39b006];var _0x1d09dc={'id':_0x1b3934['id'],'available':_0x1b3934[_0x2b52('0x48')],'loggedIn':_0x1b3934[_0x2b52('0x49')],'name':_0x1b3934['name'],'paused':_0x1b3934[_0x2b52('0x4a')],'waiting':_0x1b3934[_0x2b52('0x4c')]};_0x5c2f51[_0x2b52('0x21')](_0x1d09dc);}}_0x2e1d50({'count':_0x5c2f51['length'],'rows':_0x5c2f51});});},'OpenchannelQueues':function(_0xd34a86){return new Promise(function(_0x36e830,_0x472605){var _0x38f8f3=[];for(var _0x2ddeb0 in _0x2f4efa['openchannelQueues']){if(_0x2f4efa[_0x2b52('0x4d')][_0x2b52('0x41')](_0x2ddeb0)){var _0x49dfb5=_0x2f4efa[_0x2b52('0x4d')][_0x2ddeb0];var _0x63a371={'id':_0x49dfb5['id'],'available':_0x49dfb5[_0x2b52('0x48')],'loggedIn':_0x49dfb5[_0x2b52('0x49')],'name':_0x49dfb5['name'],'paused':_0x49dfb5[_0x2b52('0x4a')],'waiting':_0x49dfb5['waiting']};_0x38f8f3[_0x2b52('0x21')](_0x63a371);}}_0x36e830({'count':_0x38f8f3[_0x2b52('0x16')],'rows':_0x38f8f3});});},'SmsQueues':function(_0x12b4c1){return new Promise(function(_0x436785,_0x22bc26){var _0x304c36=[];for(var _0x538561 in _0x2f4efa[_0x2b52('0x4e')]){if(_0x2f4efa[_0x2b52('0x4e')][_0x2b52('0x41')](_0x538561)){var _0x44b0c6=_0x2f4efa[_0x2b52('0x4e')][_0x538561];var _0x495a31={'id':_0x44b0c6['id'],'available':_0x44b0c6[_0x2b52('0x48')],'loggedIn':_0x44b0c6[_0x2b52('0x49')],'name':_0x44b0c6[_0x2b52('0x4f')],'paused':_0x44b0c6[_0x2b52('0x4a')],'waiting':_0x44b0c6['waiting']};_0x304c36[_0x2b52('0x21')](_0x495a31);}}_0x436785({'count':_0x304c36[_0x2b52('0x16')],'rows':_0x304c36});});},'FaxQueues':function(_0x5a6f80){return new Promise(function(_0x4238a7,_0x5777ee){var _0x2efdcc=[];for(var _0x3e720e in _0x2f4efa[_0x2b52('0x50')]){if(_0x2f4efa[_0x2b52('0x50')][_0x2b52('0x41')](_0x3e720e)){var _0x839321=_0x2f4efa['faxQueues'][_0x3e720e];var _0x2864a8={'id':_0x839321['id'],'available':_0x839321[_0x2b52('0x48')],'loggedIn':_0x839321[_0x2b52('0x49')],'name':_0x839321[_0x2b52('0x4f')],'paused':_0x839321[_0x2b52('0x4a')],'waiting':_0x839321[_0x2b52('0x4c')]};_0x2efdcc['push'](_0x2864a8);}}_0x4238a7({'count':_0x2efdcc[_0x2b52('0x16')],'rows':_0x2efdcc});});},'ChatQueuesWaitingInteractions':function(_0x19f125){return new Promise(function(_0x438eb5,_0x6a769){var _0x3bdaf5=_[_0x2b52('0x46')](_0x2f4efa[_0x2b52('0x51')]);_0x438eb5({'count':_0x3bdaf5[_0x2b52('0x16')],'rows':_0x3bdaf5});});},'MailQueuesWaitingInteractions':function(_0x749ad6){return new Promise(function(_0x747eb4,_0x41b933){var _0x79f5ec=_[_0x2b52('0x46')](_0x2f4efa['mailQueuesWaitingInteractions']);_0x747eb4({'count':_0x79f5ec['length'],'rows':_0x79f5ec});});},'OpenchannelQueuesWaitingInteractions':function(_0x402ecf){return new Promise(function(_0x416f15,_0x1fd496){var _0x1df12c=_['values'](_0x2f4efa['openchannelQueuesWaitingInteractions']);_0x416f15({'count':_0x1df12c['length'],'rows':_0x1df12c});});},'SmsQueuesWaitingInteractions':function(_0x283dff){return new Promise(function(_0x3a3491,_0x53d036){var _0x2677dd=_[_0x2b52('0x46')](_0x2f4efa[_0x2b52('0x52')]);_0x3a3491({'count':_0x2677dd['length'],'rows':_0x2677dd});});},'FaxQueuesWaitingInteractions':function(_0x213d5a){return new Promise(function(_0xf29ca4,_0xbb7fec){var _0x42850e=_['values'](_0x2f4efa[_0x2b52('0x53')]);_0xf29ca4({'count':_0x42850e[_0x2b52('0x16')],'rows':_0x42850e});});}};var _0xae39a4=jayson[_0x2b52('0x54')](_0x3a984a)[_0x2b52('0x55')]();_0xae39a4['on'](_0x2b52('0x36'),function(_0x892acd){logger[_0x2b52('0x36')](JSON[_0x2b52('0x31')](_0x892acd));return _0x3143bb(_0x892acd);});_0xae39a4[_0x2b52('0xf')](0x232c,_0x2b52('0x56'),function(){console['log'](_0x2b52('0x57'),0x232c);return _0x2cddde(_0x2b52('0x58')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index c666bcb..8fe961d 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 _0xbd1e=['true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','bluebird','lodash','../../../config/logger','routing','client','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s','indexOf'];(function(_0x51bb38,_0x4e57a0){var _0x51c09b=function(_0x3321e2){while(--_0x3321e2){_0x51bb38['push'](_0x51bb38['shift']());}};_0x51c09b(++_0x4e57a0);}(_0xbd1e,0x1bc));var _0xebd1=function(_0x4864ea,_0x7764ed){_0x4864ea=_0x4864ea-0x0;var _0x12e74f=_0xbd1e[_0x4864ea];return _0x12e74f;};'use strict';var util=require('util');var BPromise=require(_0xebd1('0x0'));var jayson=require('jayson/promise');var _=require(_0xebd1('0x1'));var logger=require(_0xebd1('0x2'))(_0xebd1('0x3'));var client=jayson[_0xebd1('0x4')]['http']({'port':0x232a});function request(_0x34eda1,_0x45d289){return new BPromise(function(_0x2e1eba,_0x25a979){return client[_0xebd1('0x5')](_0x34eda1,_0x45d289)[_0xebd1('0x6')](function(_0x474ab7){if(_0x474ab7[_0xebd1('0x7')]){return _0x25a979(_0x474ab7[_0xebd1('0x7')][_0xebd1('0x8')]);}else{return _0x2e1eba(_0x474ab7[_0xebd1('0x9')]);}})[_0xebd1('0xa')](function(_0x253021){return _0x25a979(_0x253021);});});}exports[_0xebd1('0xb')]=function(_0x4f7677,_0x114e30,_0xcd9a5c){return function(_0x415b3d){if(_0xcd9a5c[_0xebd1('0xc')]&&!_0xcd9a5c['rules'][_0x4f7677]){logger[_0xebd1('0xd')](_0xebd1('0xe'),_0x4f7677);return _0x415b3d[_0xebd1('0xf')]();}var _0x5b0dbe=[];for(var _0xa6804c=0x0;_0xa6804c<_0x114e30['length'];_0xa6804c+=0x1){_0x5b0dbe[_0xebd1('0x10')](request(_0xebd1('0x11'),{'command':util[_0xebd1('0x12')](_0xebd1('0x13'),_0x114e30[_0xa6804c])})[_0xebd1('0x6')](function(_0x2f7f1c){return _0x2f7f1c&&_0x2f7f1c['message']&&_0x2f7f1c[_0xebd1('0x8')][_0xebd1('0x14')](_0xebd1('0x15'))>=0x0?!![]:![];})[_0xebd1('0xa')](function(_0x14b85d){logger[_0xebd1('0x7')](_0xebd1('0x16'),_0x4f7677,_0x114e30[_0xa6804c]);}));}BPromise[_0xebd1('0x17')](_0x5b0dbe)[_0xebd1('0x6')](function(_0x502422){var _0x59a185=_[_0xebd1('0x18')](_0x502422);logger[_0xebd1('0xd')](_0xebd1('0x19'),_0x4f7677,_0x114e30[_0xebd1('0x1a')](_0xebd1('0x1b')),_0x59a185);_0x415b3d[_0xebd1('0x1c')](_0x59a185);})[_0xebd1('0xa')](function(_0x3d3fde){console[_0xebd1('0x1d')](_0x3d3fde);logger[_0xebd1('0x7')](_0xebd1('0x19'),_0x4f7677,_0x114e30[_0xebd1('0x1a')](_0xebd1('0x1b')),_0x3d3fde[_0xebd1('0x1e')]);_0x415b3d['stop']();});};}; \ No newline at end of file +var _0xe87c=['util','jayson/promise','../../../config/logger','client','http','request','then','error','message','result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','indexOf','[%s][INTERVAL]\x20%s','all','some','join','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','stack'];(function(_0x35e2d7,_0x686b9b){var _0x3f9734=function(_0x4be0dd){while(--_0x4be0dd){_0x35e2d7['push'](_0x35e2d7['shift']());}};_0x3f9734(++_0x686b9b);}(_0xe87c,0x1f4));var _0xce87=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0xe87c[_0x1b4b23];return _0x2a325b;};'use strict';var util=require(_0xce87('0x0'));var BPromise=require('bluebird');var jayson=require(_0xce87('0x1'));var _=require('lodash');var logger=require(_0xce87('0x2'))('routing');var client=jayson[_0xce87('0x3')][_0xce87('0x4')]({'port':0x232a});function request(_0x4d6563,_0x3f64a8){return new BPromise(function(_0x59969c,_0xecd59b){return client[_0xce87('0x5')](_0x4d6563,_0x3f64a8)[_0xce87('0x6')](function(_0x5d0f0c){if(_0x5d0f0c[_0xce87('0x7')]){return _0xecd59b(_0x5d0f0c[_0xce87('0x7')][_0xce87('0x8')]);}else{return _0x59969c(_0x5d0f0c[_0xce87('0x9')]);}})['catch'](function(_0x4c975f){return _0xecd59b(_0x4c975f);});});}exports[_0xce87('0xa')]=function(_0x54f374,_0x476c4e,_0x168c5e){return function(_0x567770){if(_0x168c5e[_0xce87('0xb')]&&!_0x168c5e[_0xce87('0xb')][_0x54f374]){logger[_0xce87('0xc')](_0xce87('0xd'),_0x54f374);return _0x567770[_0xce87('0xe')]();}var _0x5602ae=[];for(var _0x4ff2d0=0x0;_0x4ff2d0<_0x476c4e[_0xce87('0xf')];_0x4ff2d0+=0x1){_0x5602ae['push'](request(_0xce87('0x10'),{'command':util['format']('iftime\x20%s',_0x476c4e[_0x4ff2d0])})[_0xce87('0x6')](function(_0x2b97d0){return _0x2b97d0&&_0x2b97d0[_0xce87('0x8')]&&_0x2b97d0[_0xce87('0x8')][_0xce87('0x11')]('true')>=0x0?!![]:![];})['catch'](function(_0x55dd59){logger[_0xce87('0x7')](_0xce87('0x12'),_0x54f374,_0x476c4e[_0x4ff2d0]);}));}BPromise[_0xce87('0x13')](_0x5602ae)['then'](function(_0x552a70){var _0x5f3a5f=_[_0xce87('0x14')](_0x552a70);logger[_0xce87('0xc')]('[%s][INTERVAL]\x20%s\x20%s',_0x54f374,_0x476c4e[_0xce87('0x15')]('\x20|\x20'),_0x5f3a5f);_0x567770['when'](_0x5f3a5f);})['catch'](function(_0x3e420e){console['log'](_0x3e420e);logger[_0xce87('0x7')](_0xce87('0x16'),_0x54f374,_0x476c4e[_0xce87('0x15')](_0xce87('0x17')),_0x3e420e[_0xce87('0x18')]);_0x567770[_0xce87('0xe')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 132b6e6..229f3a4 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 _0x66ee=['format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentcomplete','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','agentcalled','destuniqueid','agentcalledAt','now','connectedlinename','error','stack','agentringnoanswer','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','queuecallerabandon','abandoned','reason','agentconnect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','isNil','agentcompleteAt','diffTime','complete','transfereruniqueid','transfertype','blind','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','origtransfererexten','transfereeuniqueid','clone','calleridname','ATTENDED','transferexten','secondtransfererexten','transfertargetuniqueid','agententerreason','hangup','agent','transfer','lodash','util','./utils'];(function(_0x1e01ca,_0x14dc80){var _0x318e7f=function(_0x1fe292){while(--_0x1fe292){_0x1e01ca['push'](_0x1e01ca['shift']());}};_0x318e7f(++_0x14dc80);}(_0x66ee,0x85));var _0xe66e=function(_0x4d0527,_0x216351){_0x4d0527=_0x4d0527-0x0;var _0x4ad853=_0x66ee[_0x4d0527];return _0x4ad853;};'use strict';var _=require(_0xe66e('0x0'));var util=require(_0xe66e('0x1'));var utils=require(_0xe66e('0x2'));var agents={};var transfers={};function writeDB(_0x263d3b,_0x1df57a){utils['info'](util[_0xe66e('0x3')](_0xe66e('0x4'),_0x263d3b[_0xe66e('0x5')],_0x263d3b[_0xe66e('0x6')],_0x263d3b['queue'],_0x263d3b[_0xe66e('0x7')],_0x263d3b[_0xe66e('0x8')],_0x263d3b[_0xe66e('0x9')],_0x263d3b[_0xe66e('0xa')],_0x263d3b[_0xe66e('0xb')]));if(_0x263d3b['queue']){utils[_0xe66e('0xc')](_0x263d3b['queue'])['then'](function(_0x2c56fb){if(_0x2c56fb){_0x263d3b['type']=_0x2c56fb[_0xe66e('0xd')];_0x263d3b['agentacw']=_0x263d3b[_0xe66e('0xe')]?_0x2c56fb[_0xe66e('0xf')]:![];_0x263d3b[_0xe66e('0x10')]=_0x263d3b[_0xe66e('0x11')]?_0x2c56fb[_0xe66e('0x12')]:0x0;}utils[_0xe66e('0x13')](_0xe66e('0x14'),_0x263d3b);});}else{utils['request'](_0xe66e('0x14'),_0x263d3b);}if(_0x1df57a){delete transfers[_0x263d3b[_0xe66e('0x5')]];}else{delete agents[_0x263d3b['destuniqueid']];}}exports[_0xe66e('0x15')]=function(_0x46b979){try{agents[_0x46b979[_0xe66e('0x16')]]=_0x46b979;agents[_0x46b979[_0xe66e('0x16')]][_0xe66e('0x17')]=utils[_0xe66e('0x18')]();agents[_0x46b979[_0xe66e('0x16')]][_0xe66e('0xb')]='called';agents[_0x46b979[_0xe66e('0x16')]]['connectedlinenum']=null;agents[_0x46b979[_0xe66e('0x16')]][_0xe66e('0x19')]=null;}catch(_0x3b9f1f){utils[_0xe66e('0x1a')](_0x3b9f1f[_0xe66e('0x1b')]);}};exports[_0xe66e('0x1c')]=function(_0x1c0e1b){try{if(!_['isNil'](agents[_0x1c0e1b[_0xe66e('0x16')]])){agents[_0x1c0e1b['destuniqueid']]['agentringnoanswer']=!![];agents[_0x1c0e1b['destuniqueid']][_0xe66e('0x1d')]=utils[_0xe66e('0x18')]();agents[_0x1c0e1b['destuniqueid']][_0xe66e('0xb')]=_0xe66e('0x1e');agents[_0x1c0e1b[_0xe66e('0x16')]]['reason']=_0xe66e('0x1e');agents[_0x1c0e1b[_0xe66e('0x16')]][_0xe66e('0x1f')]=_0x1c0e1b[_0xe66e('0x20')]?parseInt(_0x1c0e1b['ringtime'])/0x3e8:0x0;agents[_0x1c0e1b[_0xe66e('0x16')]][_0xe66e('0x21')]=0x0;writeDB(agents[_0x1c0e1b['destuniqueid']]);}}catch(_0x55ba00){utils[_0xe66e('0x1a')](_0x55ba00['stack']);}};exports[_0xe66e('0x22')]=function(_0x487318){try{_['forIn'](agents,function(_0x203961,_0x2683d4){if(_0x203961['uniqueid']==_0x487318[_0xe66e('0x5')]){_0x203961[_0xe66e('0x1c')]=!![];_0x203961['agentringnoanswerAt']=utils['now']();_0x203961[_0xe66e('0xb')]=_0xe66e('0x23');_0x203961[_0xe66e('0x24')]=_0xe66e('0x23');_0x203961[_0xe66e('0x1f')]=_0x487318[_0xe66e('0x1f')];_0x203961['talktime']=0x0;writeDB(_0x203961);}});}catch(_0x21d771){utils[_0xe66e('0x1a')](_0x21d771[_0xe66e('0x1b')]);}};exports[_0xe66e('0x25')]=function(_0x3108f9){try{if(agents[_0x3108f9['destuniqueid']]){agents[_0x3108f9[_0xe66e('0x16')]][_0xe66e('0x26')]=utils[_0xe66e('0x18')]();agents[_0x3108f9[_0xe66e('0x16')]][_0xe66e('0xa')]=_0x3108f9[_0xe66e('0xa')];agents[_0x3108f9[_0xe66e('0x16')]][_0xe66e('0x19')]=_0x3108f9[_0xe66e('0x19')];agents[_0x3108f9[_0xe66e('0x16')]][_0xe66e('0x1f')]=_0x3108f9[_0xe66e('0x20')];agents[_0x3108f9['destuniqueid']][_0xe66e('0xb')]=_0xe66e('0x27');_['forIn'](agents,function(_0x7bb80b,_0x2ee5cd){if(_0x7bb80b[_0xe66e('0x16')]!=_0x3108f9['destuniqueid']&&_0x7bb80b[_0xe66e('0x5')]==_0x3108f9[_0xe66e('0x5')]){_0x7bb80b[_0xe66e('0x21')]=0x0;_0x7bb80b[_0xe66e('0x1f')]=_0x3108f9[_0xe66e('0x20')];_0x7bb80b[_0xe66e('0x1c')]=!![];_0x7bb80b['agentringnoanswerAt']=utils[_0xe66e('0x18')]();_0x7bb80b[_0xe66e('0xb')]=_0xe66e('0x28');_0x7bb80b[_0xe66e('0x24')]=_0xe66e('0x28');_0x7bb80b[_0xe66e('0x29')]=_0x3108f9['destuniqueid'];_0x7bb80b[_0xe66e('0x2a')]=_0x3108f9[_0xe66e('0x7')];writeDB(_0x7bb80b);}});}}catch(_0x4b642a){utils[_0xe66e('0x1a')](_0x4b642a[_0xe66e('0x1b')]);}};exports['agentcomplete']=function(_0x22015e){try{if(!_[_0xe66e('0x2b')](agents[_0x22015e[_0xe66e('0x16')]])){agents[_0x22015e[_0xe66e('0x16')]]['agentcomplete']=!![];agents[_0x22015e[_0xe66e('0x16')]][_0xe66e('0x2c')]=utils[_0xe66e('0x18')]();agents[_0x22015e['destuniqueid']][_0xe66e('0x21')]=utils[_0xe66e('0x2d')](agents[_0x22015e[_0xe66e('0x16')]][_0xe66e('0x2c')],agents[_0x22015e[_0xe66e('0x16')]][_0xe66e('0x26')]);agents[_0x22015e[_0xe66e('0x16')]]['reason']=_0x22015e[_0xe66e('0x24')];agents[_0x22015e[_0xe66e('0x16')]][_0xe66e('0xb')]=_0xe66e('0x2e');writeDB(agents[_0x22015e[_0xe66e('0x16')]]);}}catch(_0x3f961b){utils['error'](_0x3f961b[_0xe66e('0x1b')]);}};exports['blindtransfer']=function(_0x595e6f){try{if(!_[_0xe66e('0x2b')](agents[_0x595e6f[_0xe66e('0x2f')]])){agents[_0x595e6f[_0xe66e('0x2f')]]['transfer']=!![];agents[_0x595e6f[_0xe66e('0x2f')]][_0xe66e('0x30')]=_0xe66e('0x31');agents[_0x595e6f['transfereruniqueid']]['transferexten']=_0x595e6f[_0xe66e('0x32')];agents[_0x595e6f[_0xe66e('0x2f')]][_0xe66e('0x33')]=agents[_0x595e6f['transfereruniqueid']][_0xe66e('0x5')];}}catch(_0x2010a3){utils[_0xe66e('0x1a')](_0x2010a3[_0xe66e('0x1b')]);}};exports[_0xe66e('0x34')]=function(_0x5db62a){try{if(_0x5db62a[_0xe66e('0x35')]==_0x5db62a[_0xe66e('0x36')]){if(!_[_0xe66e('0x2b')](agents[_0x5db62a[_0xe66e('0x37')]])){agents[_0x5db62a['secondtransfereruniqueid']]['transfer']=!![];agents[_0x5db62a[_0xe66e('0x37')]][_0xe66e('0x30')]='ATTENDED';agents[_0x5db62a[_0xe66e('0x37')]]['transferexten']=_0x5db62a[_0xe66e('0x38')];agents[_0x5db62a[_0xe66e('0x37')]][_0xe66e('0x33')]=_0x5db62a[_0xe66e('0x35')];}if(_0x5db62a[_0xe66e('0x39')]&&agents[_0x5db62a[_0xe66e('0x39')]]){agents[_0x5db62a[_0xe66e('0x39')]]['agententerreason']=0x1;transfers[_0x5db62a[_0xe66e('0x39')]]=_[_0xe66e('0x3a')](agents[_0x5db62a[_0xe66e('0x39')]]);transfers[_0x5db62a[_0xe66e('0x39')]][_0xe66e('0x9')]=agents[_0x5db62a[_0xe66e('0x37')]]['calleridnum'];transfers[_0x5db62a[_0xe66e('0x39')]]['calleridname']=agents[_0x5db62a[_0xe66e('0x37')]][_0xe66e('0x3b')];transfers[_0x5db62a['transfereeuniqueid']]['agentcalledAt']=utils['now']();transfers[_0x5db62a[_0xe66e('0x39')]]['agentconnectAt']=utils[_0xe66e('0x18')]();transfers[_0x5db62a[_0xe66e('0x39')]][_0xe66e('0x1f')]=0x0;transfers[_0x5db62a[_0xe66e('0x39')]]['agententerreason']=0x2;}}else if(_0x5db62a[_0xe66e('0x37')]==_0x5db62a['secondtransfererlinkedid']){if(!_[_0xe66e('0x2b')](agents[_0x5db62a[_0xe66e('0x35')]])){agents[_0x5db62a['origtransfereruniqueid']]['transfer']=!![];agents[_0x5db62a[_0xe66e('0x35')]]['transfertype']=_0xe66e('0x3c');agents[_0x5db62a[_0xe66e('0x35')]][_0xe66e('0x3d')]=_0x5db62a[_0xe66e('0x3e')];agents[_0x5db62a[_0xe66e('0x35')]]['transferuniqueid']=_0x5db62a['secondtransfereruniqueid'];}if(_0x5db62a[_0xe66e('0x3f')]&&agents[_0x5db62a[_0xe66e('0x3f')]]){agents[_0x5db62a['transfertargetuniqueid']][_0xe66e('0x40')]=0x1;transfers[_0x5db62a[_0xe66e('0x3f')]]=_[_0xe66e('0x3a')](agents[_0x5db62a['transfertargetuniqueid']]);transfers[_0x5db62a[_0xe66e('0x3f')]]['calleridnum']=agents[_0x5db62a['origtransfereruniqueid']][_0xe66e('0x9')];transfers[_0x5db62a['transfertargetuniqueid']]['calleridname']=agents[_0x5db62a[_0xe66e('0x35')]]['calleridname'];transfers[_0x5db62a['transfertargetuniqueid']][_0xe66e('0x17')]=utils[_0xe66e('0x18')]();transfers[_0x5db62a['transfertargetuniqueid']][_0xe66e('0x26')]=utils[_0xe66e('0x18')]();transfers[_0x5db62a[_0xe66e('0x3f')]][_0xe66e('0x1f')]=0x0;transfers[_0x5db62a[_0xe66e('0x3f')]]['agententerreason']=0x2;}}}catch(_0x502c14){utils[_0xe66e('0x1a')](_0x502c14['stack']);}};exports[_0xe66e('0x41')]=function(_0x2b867b){try{if(transfers[_0x2b867b[_0xe66e('0x5')]]){transfers[_0x2b867b[_0xe66e('0x5')]][_0xe66e('0xe')]=!![];transfers[_0x2b867b[_0xe66e('0x5')]][_0xe66e('0x2c')]=utils[_0xe66e('0x18')]();transfers[_0x2b867b[_0xe66e('0x5')]][_0xe66e('0x21')]=utils[_0xe66e('0x2d')](transfers[_0x2b867b[_0xe66e('0x5')]][_0xe66e('0x2c')],transfers[_0x2b867b[_0xe66e('0x5')]][_0xe66e('0x26')]);transfers[_0x2b867b[_0xe66e('0x5')]]['reason']=_0xe66e('0x42');transfers[_0x2b867b[_0xe66e('0x5')]]['lastevent']='complete';writeDB(transfers[_0x2b867b['uniqueid']],!![]);}if(agents[_0x2b867b[_0xe66e('0x5')]]&&agents[_0x2b867b[_0xe66e('0x5')]]['agentconnectAt']){agents[_0x2b867b[_0xe66e('0x5')]][_0xe66e('0xe')]=!![];agents[_0x2b867b['uniqueid']][_0xe66e('0x2c')]=utils[_0xe66e('0x18')]();agents[_0x2b867b['uniqueid']][_0xe66e('0x21')]=utils[_0xe66e('0x2d')](agents[_0x2b867b['uniqueid']][_0xe66e('0x2c')],agents[_0x2b867b[_0xe66e('0x5')]]['agentconnectAt']);agents[_0x2b867b[_0xe66e('0x5')]][_0xe66e('0x24')]=agents[_0x2b867b['uniqueid']][_0xe66e('0x43')]?'transfer':_0xe66e('0x42');agents[_0x2b867b['uniqueid']]['lastevent']=_0xe66e('0x2e');writeDB(agents[_0x2b867b[_0xe66e('0x5')]]);}}catch(_0x1f3761){utils[_0xe66e('0x1a')](_0x1f3761[_0xe66e('0x1b')]);}}; \ No newline at end of file +var _0x7d33=['secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','agentcalledAt','secondtransfererexten','transfertargetuniqueid','agent','lodash','util','./utils','info','format','uniqueid','queue','membername','lastevent','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','now','connectedlinenum','connectedlinename','error','stack','agentringnoanswer','isNil','timeout','reason','holdtime','ringtime','queuecallerabandon','forIn','agentringnoanswerAt','abandoned','talktime','agentconnect','agentconnectAt','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','transfer','transfertype','blind','transferexten','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid'];(function(_0x4daa9e,_0x2c6428){var _0x3e8ac5=function(_0x68576b){while(--_0x68576b){_0x4daa9e['push'](_0x4daa9e['shift']());}};_0x3e8ac5(++_0x2c6428);}(_0x7d33,0x1cc));var _0x37d3=function(_0x2ab9b5,_0x5607b8){_0x2ab9b5=_0x2ab9b5-0x0;var _0x9f6232=_0x7d33[_0x2ab9b5];return _0x9f6232;};'use strict';var _=require(_0x37d3('0x0'));var util=require(_0x37d3('0x1'));var utils=require(_0x37d3('0x2'));var agents={};var transfers={};function writeDB(_0xed9294,_0x364086){utils[_0x37d3('0x3')](util[_0x37d3('0x4')]('AGENT|%s|%s|%s|%s|%s|%s|%s|%s',_0xed9294[_0x37d3('0x5')],_0xed9294['channel'],_0xed9294[_0x37d3('0x6')],_0xed9294[_0x37d3('0x7')],_0xed9294['interface'],_0xed9294['calleridnum'],_0xed9294['connectedlinenum'],_0xed9294[_0x37d3('0x8')]));if(_0xed9294[_0x37d3('0x6')]){utils['getVoiceQueueByName'](_0xed9294[_0x37d3('0x6')])['then'](function(_0x2031c1){if(_0x2031c1){_0xed9294['type']=_0x2031c1[_0x37d3('0x9')];_0xed9294[_0x37d3('0xa')]=_0xed9294['agentcomplete']?_0x2031c1[_0x37d3('0xb')]:![];_0xed9294[_0x37d3('0xc')]=_0xed9294[_0x37d3('0xa')]?_0x2031c1[_0x37d3('0xd')]:0x0;}utils[_0x37d3('0xe')]('CreateVoiceAgentReport',_0xed9294);});}else{utils[_0x37d3('0xe')](_0x37d3('0xf'),_0xed9294);}if(_0x364086){delete transfers[_0xed9294[_0x37d3('0x5')]];}else{delete agents[_0xed9294[_0x37d3('0x10')]];}}exports['agentcalled']=function(_0x17167c){try{agents[_0x17167c[_0x37d3('0x10')]]=_0x17167c;agents[_0x17167c[_0x37d3('0x10')]]['agentcalledAt']=utils[_0x37d3('0x11')]();agents[_0x17167c['destuniqueid']][_0x37d3('0x8')]='called';agents[_0x17167c[_0x37d3('0x10')]][_0x37d3('0x12')]=null;agents[_0x17167c[_0x37d3('0x10')]][_0x37d3('0x13')]=null;}catch(_0x4a09b0){utils[_0x37d3('0x14')](_0x4a09b0[_0x37d3('0x15')]);}};exports[_0x37d3('0x16')]=function(_0x3dd0a4){try{if(!_[_0x37d3('0x17')](agents[_0x3dd0a4[_0x37d3('0x10')]])){agents[_0x3dd0a4[_0x37d3('0x10')]][_0x37d3('0x16')]=!![];agents[_0x3dd0a4[_0x37d3('0x10')]]['agentringnoanswerAt']=utils['now']();agents[_0x3dd0a4[_0x37d3('0x10')]][_0x37d3('0x8')]=_0x37d3('0x18');agents[_0x3dd0a4[_0x37d3('0x10')]][_0x37d3('0x19')]=_0x37d3('0x18');agents[_0x3dd0a4[_0x37d3('0x10')]][_0x37d3('0x1a')]=_0x3dd0a4[_0x37d3('0x1b')]?parseInt(_0x3dd0a4[_0x37d3('0x1b')])/0x3e8:0x0;agents[_0x3dd0a4['destuniqueid']]['talktime']=0x0;writeDB(agents[_0x3dd0a4[_0x37d3('0x10')]]);}}catch(_0x4a3421){utils[_0x37d3('0x14')](_0x4a3421['stack']);}};exports[_0x37d3('0x1c')]=function(_0x57cc35){try{_[_0x37d3('0x1d')](agents,function(_0x8bfad3,_0x454dfa){if(_0x8bfad3['uniqueid']==_0x57cc35[_0x37d3('0x5')]){_0x8bfad3[_0x37d3('0x16')]=!![];_0x8bfad3[_0x37d3('0x1e')]=utils[_0x37d3('0x11')]();_0x8bfad3[_0x37d3('0x8')]=_0x37d3('0x1f');_0x8bfad3[_0x37d3('0x19')]=_0x37d3('0x1f');_0x8bfad3[_0x37d3('0x1a')]=_0x57cc35['holdtime'];_0x8bfad3[_0x37d3('0x20')]=0x0;writeDB(_0x8bfad3);}});}catch(_0x58307e){utils[_0x37d3('0x14')](_0x58307e['stack']);}};exports[_0x37d3('0x21')]=function(_0xc02d46){try{if(agents[_0xc02d46[_0x37d3('0x10')]]){agents[_0xc02d46[_0x37d3('0x10')]][_0x37d3('0x22')]=utils['now']();agents[_0xc02d46[_0x37d3('0x10')]][_0x37d3('0x12')]=_0xc02d46[_0x37d3('0x12')];agents[_0xc02d46[_0x37d3('0x10')]][_0x37d3('0x13')]=_0xc02d46[_0x37d3('0x13')];agents[_0xc02d46[_0x37d3('0x10')]][_0x37d3('0x1a')]=_0xc02d46[_0x37d3('0x1b')];agents[_0xc02d46['destuniqueid']][_0x37d3('0x8')]='connect';_[_0x37d3('0x1d')](agents,function(_0x204b89,_0x27d122){if(_0x204b89[_0x37d3('0x10')]!=_0xc02d46[_0x37d3('0x10')]&&_0x204b89['uniqueid']==_0xc02d46[_0x37d3('0x5')]){_0x204b89[_0x37d3('0x20')]=0x0;_0x204b89['holdtime']=_0xc02d46['ringtime'];_0x204b89[_0x37d3('0x16')]=!![];_0x204b89['agentringnoanswerAt']=utils[_0x37d3('0x11')]();_0x204b89[_0x37d3('0x8')]='answered_elsewhere';_0x204b89['reason']=_0x37d3('0x23');_0x204b89[_0x37d3('0x24')]=_0xc02d46[_0x37d3('0x10')];_0x204b89[_0x37d3('0x25')]=_0xc02d46[_0x37d3('0x7')];writeDB(_0x204b89);}});}}catch(_0x28f747){utils[_0x37d3('0x14')](_0x28f747[_0x37d3('0x15')]);}};exports[_0x37d3('0x26')]=function(_0x2638d4){try{if(!_[_0x37d3('0x17')](agents[_0x2638d4[_0x37d3('0x10')]])){agents[_0x2638d4[_0x37d3('0x10')]][_0x37d3('0x26')]=!![];agents[_0x2638d4['destuniqueid']][_0x37d3('0x27')]=utils['now']();agents[_0x2638d4['destuniqueid']][_0x37d3('0x20')]=utils[_0x37d3('0x28')](agents[_0x2638d4[_0x37d3('0x10')]]['agentcompleteAt'],agents[_0x2638d4[_0x37d3('0x10')]][_0x37d3('0x22')]);agents[_0x2638d4[_0x37d3('0x10')]][_0x37d3('0x19')]=_0x2638d4['reason'];agents[_0x2638d4[_0x37d3('0x10')]]['lastevent']=_0x37d3('0x29');writeDB(agents[_0x2638d4['destuniqueid']]);}}catch(_0x11cd02){utils[_0x37d3('0x14')](_0x11cd02[_0x37d3('0x15')]);}};exports[_0x37d3('0x2a')]=function(_0x51a9b9){try{if(!_['isNil'](agents[_0x51a9b9[_0x37d3('0x2b')]])){agents[_0x51a9b9[_0x37d3('0x2b')]][_0x37d3('0x2c')]=!![];agents[_0x51a9b9[_0x37d3('0x2b')]][_0x37d3('0x2d')]=_0x37d3('0x2e');agents[_0x51a9b9['transfereruniqueid']][_0x37d3('0x2f')]=_0x51a9b9['extension'];agents[_0x51a9b9[_0x37d3('0x2b')]][_0x37d3('0x30')]=agents[_0x51a9b9[_0x37d3('0x2b')]][_0x37d3('0x5')];}}catch(_0xcc196a){utils[_0x37d3('0x14')](_0xcc196a['stack']);}};exports[_0x37d3('0x31')]=function(_0x289c48){try{if(_0x289c48[_0x37d3('0x32')]==_0x289c48[_0x37d3('0x33')]){if(!_[_0x37d3('0x17')](agents[_0x289c48[_0x37d3('0x34')]])){agents[_0x289c48[_0x37d3('0x34')]][_0x37d3('0x2c')]=!![];agents[_0x289c48[_0x37d3('0x34')]][_0x37d3('0x2d')]=_0x37d3('0x35');agents[_0x289c48[_0x37d3('0x34')]][_0x37d3('0x2f')]=_0x289c48[_0x37d3('0x36')];agents[_0x289c48[_0x37d3('0x34')]]['transferuniqueid']=_0x289c48['origtransfereruniqueid'];}if(_0x289c48[_0x37d3('0x37')]&&agents[_0x289c48[_0x37d3('0x37')]]){agents[_0x289c48[_0x37d3('0x37')]][_0x37d3('0x38')]=0x1;transfers[_0x289c48['transfereeuniqueid']]=_[_0x37d3('0x39')](agents[_0x289c48[_0x37d3('0x37')]]);transfers[_0x289c48[_0x37d3('0x37')]][_0x37d3('0x3a')]=agents[_0x289c48['secondtransfereruniqueid']][_0x37d3('0x3a')];transfers[_0x289c48['transfereeuniqueid']][_0x37d3('0x3b')]=agents[_0x289c48[_0x37d3('0x34')]][_0x37d3('0x3b')];transfers[_0x289c48['transfereeuniqueid']][_0x37d3('0x3c')]=utils['now']();transfers[_0x289c48[_0x37d3('0x37')]][_0x37d3('0x22')]=utils[_0x37d3('0x11')]();transfers[_0x289c48[_0x37d3('0x37')]]['holdtime']=0x0;transfers[_0x289c48[_0x37d3('0x37')]][_0x37d3('0x38')]=0x2;}}else if(_0x289c48[_0x37d3('0x34')]==_0x289c48['secondtransfererlinkedid']){if(!_['isNil'](agents[_0x289c48[_0x37d3('0x32')]])){agents[_0x289c48[_0x37d3('0x32')]][_0x37d3('0x2c')]=!![];agents[_0x289c48[_0x37d3('0x32')]][_0x37d3('0x2d')]='ATTENDED';agents[_0x289c48[_0x37d3('0x32')]][_0x37d3('0x2f')]=_0x289c48[_0x37d3('0x3d')];agents[_0x289c48[_0x37d3('0x32')]]['transferuniqueid']=_0x289c48[_0x37d3('0x34')];}if(_0x289c48[_0x37d3('0x3e')]&&agents[_0x289c48[_0x37d3('0x3e')]]){agents[_0x289c48[_0x37d3('0x3e')]][_0x37d3('0x38')]=0x1;transfers[_0x289c48[_0x37d3('0x3e')]]=_['clone'](agents[_0x289c48['transfertargetuniqueid']]);transfers[_0x289c48[_0x37d3('0x3e')]][_0x37d3('0x3a')]=agents[_0x289c48[_0x37d3('0x32')]][_0x37d3('0x3a')];transfers[_0x289c48['transfertargetuniqueid']]['calleridname']=agents[_0x289c48[_0x37d3('0x32')]]['calleridname'];transfers[_0x289c48[_0x37d3('0x3e')]]['agentcalledAt']=utils[_0x37d3('0x11')]();transfers[_0x289c48[_0x37d3('0x3e')]][_0x37d3('0x22')]=utils[_0x37d3('0x11')]();transfers[_0x289c48[_0x37d3('0x3e')]][_0x37d3('0x1a')]=0x0;transfers[_0x289c48[_0x37d3('0x3e')]][_0x37d3('0x38')]=0x2;}}}catch(_0x5e4107){utils['error'](_0x5e4107[_0x37d3('0x15')]);}};exports['hangup']=function(_0x4b3dde){try{if(transfers[_0x4b3dde['uniqueid']]){transfers[_0x4b3dde[_0x37d3('0x5')]][_0x37d3('0x26')]=!![];transfers[_0x4b3dde[_0x37d3('0x5')]][_0x37d3('0x27')]=utils[_0x37d3('0x11')]();transfers[_0x4b3dde[_0x37d3('0x5')]]['talktime']=utils[_0x37d3('0x28')](transfers[_0x4b3dde[_0x37d3('0x5')]][_0x37d3('0x27')],transfers[_0x4b3dde[_0x37d3('0x5')]][_0x37d3('0x22')]);transfers[_0x4b3dde[_0x37d3('0x5')]][_0x37d3('0x19')]='agent';transfers[_0x4b3dde[_0x37d3('0x5')]]['lastevent']=_0x37d3('0x29');writeDB(transfers[_0x4b3dde[_0x37d3('0x5')]],!![]);}if(agents[_0x4b3dde['uniqueid']]&&agents[_0x4b3dde[_0x37d3('0x5')]][_0x37d3('0x22')]){agents[_0x4b3dde[_0x37d3('0x5')]]['agentcomplete']=!![];agents[_0x4b3dde[_0x37d3('0x5')]][_0x37d3('0x27')]=utils[_0x37d3('0x11')]();agents[_0x4b3dde[_0x37d3('0x5')]]['talktime']=utils[_0x37d3('0x28')](agents[_0x4b3dde['uniqueid']][_0x37d3('0x27')],agents[_0x4b3dde[_0x37d3('0x5')]]['agentconnectAt']);agents[_0x4b3dde[_0x37d3('0x5')]][_0x37d3('0x19')]=agents[_0x4b3dde[_0x37d3('0x5')]][_0x37d3('0x2c')]?_0x37d3('0x2c'):_0x37d3('0x3f');agents[_0x4b3dde[_0x37d3('0x5')]][_0x37d3('0x8')]=_0x37d3('0x29');writeDB(agents[_0x4b3dde[_0x37d3('0x5')]]);}}catch(_0x5a635d){utils['error'](_0x5a635d[_0x37d3('0x15')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index e65b1b8..7b95dac 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 _0x2eb0=['variable','value','xmd-phone','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','lastapplication','Queue','lastdata','xmd-contactid','xmd-cdrtype','outboundrouteid','routeid','sipcallid','application','toLowerCase','set','startsWith','appdata','split','lastIndexOf','includes','noop','gotoif','util','./utils','NO\x20ANSWER','FAILED','BUSY','info','CALL|%s|%s|%s|%s|%s|%s|%s|%s','channel','accountcode','source','disposition','getUserByInternal','request','CreateVoiceCallReport','uniqueid','newchannel','now','DOCUMENTATION','error','stack','newstate','isNil','channelstate','systemanswertime','linkedid','context','transfer','destinationchannel','answertime','toNumber','ANSWERED','callerid','calleridname','calleridnum','endtime','duration','diffTime','starttime','billableseconds','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','musiconholdstop','mohtime','varset'];(function(_0x5eaf0c,_0x56a8e5){var _0x2fb772=function(_0x88a49){while(--_0x88a49){_0x5eaf0c['push'](_0x5eaf0c['shift']());}};_0x2fb772(++_0x56a8e5);}(_0x2eb0,0x149));var _0x02eb=function(_0x6c3c9b,_0x208063){_0x6c3c9b=_0x6c3c9b-0x0;var _0x28fdb1=_0x2eb0[_0x6c3c9b];return _0x28fdb1;};'use strict';var _=require('lodash');var util=require(_0x02eb('0x0'));var utils=require(_0x02eb('0x1'));var dispositions=[_0x02eb('0x2'),_0x02eb('0x3'),_0x02eb('0x3'),_0x02eb('0x2'),_0x02eb('0x2'),_0x02eb('0x2'),'ANSWERED',_0x02eb('0x4'),_0x02eb('0x3'),_0x02eb('0x3'),_0x02eb('0x3')];var channels={};function writeDB(_0x5be256){utils[_0x02eb('0x5')](util['format'](_0x02eb('0x6'),_0x5be256['uniqueid'],_0x5be256[_0x02eb('0x7')],_0x5be256['type'],_0x5be256[_0x02eb('0x8')],_0x5be256[_0x02eb('0x9')],_0x5be256['destination'],_0x5be256['callerid'],_0x5be256[_0x02eb('0xa')]));if(_0x5be256[_0x02eb('0x8')]){utils[_0x02eb('0xb')](_0x5be256[_0x02eb('0x8')])['then'](function(_0x1488ac){if(_0x1488ac){_0x5be256['UserId']=_0x1488ac['id'];}utils[_0x02eb('0xc')](_0x02eb('0xd'),_0x5be256);});}else{utils[_0x02eb('0xc')]('CreateVoiceCallReport',_0x5be256);}if(channels[_0x5be256[_0x02eb('0xe')]]){delete channels[_0x5be256[_0x02eb('0xe')]];}}exports[_0x02eb('0xf')]=function(_0x1cd849){try{if(_0x1cd849[_0x02eb('0xe')]==_0x1cd849['linkedid']&&_0x1cd849[_0x02eb('0x7')]!='OutgoingSpoolFailed'){channels[_0x1cd849[_0x02eb('0xe')]]={'uniqueid':_0x1cd849[_0x02eb('0xe')],'accountcode':_0x1cd849[_0x02eb('0x8')],'source':_0x1cd849['calleridnum'],'destination':_0x1cd849['exten'],'destinationcontext':_0x1cd849['context'],'channel':_0x1cd849['channel'],'starttime':utils[_0x02eb('0x10')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x02eb('0x2'),'amaflags':_0x02eb('0x11')};}}catch(_0x5c4ec){utils[_0x02eb('0x12')](_0x5c4ec[_0x02eb('0x13')]);}};exports[_0x02eb('0x14')]=function(_0x1bc06d){try{if(!_[_0x02eb('0x15')](channels[_0x1bc06d[_0x02eb('0xe')]])&&_0x1bc06d[_0x02eb('0x16')]==0x6){if(_['isNil'](channels[_0x1bc06d[_0x02eb('0xe')]][_0x02eb('0x17')])){channels[_0x1bc06d[_0x02eb('0xe')]]['systemanswertime']=utils[_0x02eb('0x10')]();}}else if(!_[_0x02eb('0x15')](channels[_0x1bc06d[_0x02eb('0x18')]])&&_0x1bc06d[_0x02eb('0x16')]==0x6&&_0x1bc06d[_0x02eb('0x19')]!=_0x02eb('0x1a')){channels[_0x1bc06d[_0x02eb('0x18')]]['accountcode']=_0x1bc06d[_0x02eb('0x8')];channels[_0x1bc06d[_0x02eb('0x18')]][_0x02eb('0x1b')]=_0x1bc06d[_0x02eb('0x7')];if(_[_0x02eb('0x15')](channels[_0x1bc06d['linkedid']][_0x02eb('0x1c')])){channels[_0x1bc06d['linkedid']][_0x02eb('0x1c')]=utils[_0x02eb('0x10')]();}channels[_0x1bc06d[_0x02eb('0x18')]][_0x02eb('0xa')]=dispositions[_[_0x02eb('0x1d')](_0x1bc06d[_0x02eb('0x16')])]||_0x02eb('0x1e');}}catch(_0x2cbf7b){utils['error'](_0x2cbf7b['stack']);}};exports['hangup']=function(_0x3847d8){try{if(!_[_0x02eb('0x15')](channels[_0x3847d8[_0x02eb('0xe')]])){if(_['isNil'](channels[_0x3847d8['uniqueid']][_0x02eb('0x1f')])){channels[_0x3847d8[_0x02eb('0xe')]][_0x02eb('0x1f')]=_0x3847d8[_0x02eb('0x20')]+'\x20<'+_0x3847d8[_0x02eb('0x21')]+'>';}channels[_0x3847d8[_0x02eb('0xe')]][_0x02eb('0x22')]=utils['now']();channels[_0x3847d8[_0x02eb('0xe')]][_0x02eb('0x23')]=utils[_0x02eb('0x24')](channels[_0x3847d8[_0x02eb('0xe')]]['endtime'],channels[_0x3847d8['uniqueid']][_0x02eb('0x25')]);channels[_0x3847d8[_0x02eb('0xe')]][_0x02eb('0x26')]=channels[_0x3847d8[_0x02eb('0xe')]][_0x02eb('0x1c')]?utils[_0x02eb('0x24')](channels[_0x3847d8[_0x02eb('0xe')]][_0x02eb('0x22')],channels[_0x3847d8[_0x02eb('0xe')]][_0x02eb('0x1c')]):0x0;writeDB(channels[_0x3847d8[_0x02eb('0xe')]]);}}catch(_0x191ed3){utils[_0x02eb('0x12')](_0x191ed3[_0x02eb('0x13')]);}};exports['attendedtransfer']=function(_0x1875df){try{if(!_[_0x02eb('0x15')](channels[_0x1875df['localtwolinkedid']])){if(channels[_0x1875df[_0x02eb('0x27')]]['channel']==_0x1875df[_0x02eb('0x28')]){channels[_0x1875df['localtwolinkedid']][_0x02eb('0x1b')]=_0x1875df[_0x02eb('0x29')];channels[_0x1875df[_0x02eb('0x27')]][_0x02eb('0x2a')]=_0x02eb('0x2b');}else if(channels[_0x1875df['localtwolinkedid']]['channel']=_0x1875df[_0x02eb('0x2c')]){channels[_0x1875df['localtwolinkedid']][_0x02eb('0x1b')]=_0x1875df[_0x02eb('0x2d')];channels[_0x1875df[_0x02eb('0x27')]][_0x02eb('0x2a')]=_0x02eb('0x2b');}}}catch(_0x47fdc4){utils[_0x02eb('0x12')](_0x47fdc4['stack']);}};exports[_0x02eb('0x2e')]=function(_0x1cb5c8){try{if(!_['isNil'](channels[_0x1cb5c8[_0x02eb('0xe')]])){channels[_0x1cb5c8['uniqueid']][_0x02eb('0x2f')]=utils[_0x02eb('0x10')]();}}catch(_0x53058c){utils['error'](_0x53058c[_0x02eb('0x13')]);}};exports[_0x02eb('0x30')]=function(_0x5f5a3f){try{if(!_['isNil'](channels[_0x5f5a3f[_0x02eb('0xe')]])){if(!_[_0x02eb('0x15')](channels[_0x5f5a3f['uniqueid']][_0x02eb('0x2f')])){channels[_0x5f5a3f[_0x02eb('0xe')]][_0x02eb('0x31')]+=utils[_0x02eb('0x24')](utils['now'](),channels[_0x5f5a3f[_0x02eb('0xe')]][_0x02eb('0x2f')]);delete channels[_0x5f5a3f[_0x02eb('0xe')]][_0x02eb('0x2f')];}}}catch(_0x595ab7){utils['error'](_0x595ab7[_0x02eb('0x13')]);}};exports[_0x02eb('0x32')]=function(_0x20790d){try{if(!_[_0x02eb('0x15')](channels[_0x20790d[_0x02eb('0xe')]])){if(!_[_0x02eb('0x15')](_0x20790d[_0x02eb('0x33')]['xmd-originatecalleridnum'])){channels[_0x20790d[_0x02eb('0xe')]]['source']=_0x20790d[_0x02eb('0x34')];}if(!_['isNil'](_0x20790d['variable'][_0x02eb('0x35')])){channels[_0x20790d[_0x02eb('0xe')]]['destination']=_0x20790d[_0x02eb('0x34')];channels[_0x20790d['uniqueid']][_0x02eb('0x1f')]='\x22'+_0x20790d[_0x02eb('0x34')]+_0x02eb('0x36')+_0x20790d[_0x02eb('0x34')]+'>';}if(!_[_0x02eb('0x15')](_0x20790d[_0x02eb('0x33')][_0x02eb('0x37')])||!_[_0x02eb('0x15')](_0x20790d['variable'][_0x02eb('0x38')])){channels[_0x20790d[_0x02eb('0xe')]]['callerid']=_0x20790d['value'];}if(!_[_0x02eb('0x15')](_0x20790d[_0x02eb('0x33')][_0x02eb('0x39')])||!_[_0x02eb('0x15')](_0x20790d[_0x02eb('0x33')]['xmcs-queue'])){channels[_0x20790d[_0x02eb('0xe')]][_0x02eb('0x3a')]=_0x02eb('0x3b');channels[_0x20790d[_0x02eb('0xe')]][_0x02eb('0x3c')]=_0x20790d['value'];channels[_0x20790d[_0x02eb('0xe')]]['queue']=!![];}if(!_['isNil'](_0x20790d[_0x02eb('0x33')][_0x02eb('0x3d')])){channels[_0x20790d[_0x02eb('0xe')]]['ContactId']=_0x20790d[_0x02eb('0x34')];}if(!_[_0x02eb('0x15')](_0x20790d['variable'][_0x02eb('0x3e')])){channels[_0x20790d['uniqueid']]['type']=_0x20790d[_0x02eb('0x34')];}if(!_[_0x02eb('0x15')](_0x20790d[_0x02eb('0x33')][_0x02eb('0x3f')])){channels[_0x20790d[_0x02eb('0xe')]][_0x02eb('0x40')]=_0x20790d[_0x02eb('0x34')];}if(!_[_0x02eb('0x15')](_0x20790d[_0x02eb('0x33')][_0x02eb('0x41')])){channels[_0x20790d[_0x02eb('0xe')]][_0x02eb('0x41')]=_0x20790d[_0x02eb('0x34')];}}}catch(_0x32c0a6){utils[_0x02eb('0x12')](_0x32c0a6[_0x02eb('0x13')]);}};exports['newexten']=function(_0x560b5c){try{if(!_[_0x02eb('0x15')](channels[_0x560b5c[_0x02eb('0xe')]])){if(_0x560b5c[_0x02eb('0x42')][_0x02eb('0x43')]()==_0x02eb('0x44')&&_[_0x02eb('0x45')](_0x560b5c[_0x02eb('0x46')][_0x02eb('0x43')](),'cdr')){var _0x3d6b9d=_0x560b5c[_0x02eb('0x46')][_0x02eb('0x47')]('=');var _0x40310e=_0x3d6b9d[0x0]['substring'](_0x3d6b9d[0x0]['lastIndexOf']('(')+0x1,_0x3d6b9d[0x0][_0x02eb('0x48')](')'));var _0x47a344=_0x3d6b9d[0x1];channels[_0x560b5c[_0x02eb('0xe')]][_0x40310e]=_0x47a344;}if(!_[_0x02eb('0x49')](['hangup',_0x02eb('0x4a'),'execif',_0x02eb('0x44'),_0x02eb('0x4b')],_0x560b5c['application'][_0x02eb('0x43')]())){channels[_0x560b5c[_0x02eb('0xe')]]['lastapplication']=_0x560b5c[_0x02eb('0x42')];channels[_0x560b5c[_0x02eb('0xe')]][_0x02eb('0x3c')]=_0x560b5c['appdata'];}}}catch(_0x33cc4f){utils['error'](_0x33cc4f['stack']);}}; \ No newline at end of file +var _0x6580=['FAILED','ANSWERED','info','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','accountcode','callerid','disposition','getUserByInternal','UserId','request','CreateVoiceCallReport','newchannel','linkedid','OutgoingSpoolFailed','calleridnum','exten','context','now','error','stack','newstate','systemanswertime','isNil','transfer','destinationchannel','answertime','toNumber','channelstate','hangup','diffTime','endtime','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstop','musiconholdstartAt','varset','variable','value','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','Queue','lastdata','xmd-contactid','xmd-cdrtype','type','outboundrouteid','routeid','sipcallid','newexten','application','toLowerCase','cdr','appdata','split','substring','lastIndexOf','includes','set','gotoif','util','NO\x20ANSWER'];(function(_0x85e260,_0x5511ab){var _0x11e0e5=function(_0x3fc108){while(--_0x3fc108){_0x85e260['push'](_0x85e260['shift']());}};_0x11e0e5(++_0x5511ab);}(_0x6580,0x1b4));var _0x0658=function(_0x14c560,_0x25a872){_0x14c560=_0x14c560-0x0;var _0x31a2ba=_0x6580[_0x14c560];return _0x31a2ba;};'use strict';var _=require('lodash');var util=require(_0x0658('0x0'));var utils=require('./utils');var dispositions=[_0x0658('0x1'),'FAILED',_0x0658('0x2'),_0x0658('0x1'),_0x0658('0x1'),_0x0658('0x1'),_0x0658('0x3'),'BUSY',_0x0658('0x2'),_0x0658('0x2'),_0x0658('0x2')];var channels={};function writeDB(_0x2915e7){utils[_0x0658('0x4')](util['format'](_0x0658('0x5'),_0x2915e7[_0x0658('0x6')],_0x2915e7[_0x0658('0x7')],_0x2915e7['type'],_0x2915e7[_0x0658('0x8')],_0x2915e7['source'],_0x2915e7['destination'],_0x2915e7[_0x0658('0x9')],_0x2915e7[_0x0658('0xa')]));if(_0x2915e7[_0x0658('0x8')]){utils[_0x0658('0xb')](_0x2915e7['accountcode'])['then'](function(_0x39b906){if(_0x39b906){_0x2915e7[_0x0658('0xc')]=_0x39b906['id'];}utils[_0x0658('0xd')](_0x0658('0xe'),_0x2915e7);});}else{utils[_0x0658('0xd')](_0x0658('0xe'),_0x2915e7);}if(channels[_0x2915e7[_0x0658('0x6')]]){delete channels[_0x2915e7[_0x0658('0x6')]];}}exports[_0x0658('0xf')]=function(_0x52abf3){try{if(_0x52abf3['uniqueid']==_0x52abf3[_0x0658('0x10')]&&_0x52abf3[_0x0658('0x7')]!=_0x0658('0x11')){channels[_0x52abf3[_0x0658('0x6')]]={'uniqueid':_0x52abf3['uniqueid'],'accountcode':_0x52abf3['accountcode'],'source':_0x52abf3[_0x0658('0x12')],'destination':_0x52abf3[_0x0658('0x13')],'destinationcontext':_0x52abf3[_0x0658('0x14')],'channel':_0x52abf3['channel'],'starttime':utils[_0x0658('0x15')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x53e335){utils[_0x0658('0x16')](_0x53e335[_0x0658('0x17')]);}};exports[_0x0658('0x18')]=function(_0x3e8c60){try{if(!_['isNil'](channels[_0x3e8c60[_0x0658('0x6')]])&&_0x3e8c60['channelstate']==0x6){if(_['isNil'](channels[_0x3e8c60[_0x0658('0x6')]][_0x0658('0x19')])){channels[_0x3e8c60[_0x0658('0x6')]][_0x0658('0x19')]=utils[_0x0658('0x15')]();}}else if(!_[_0x0658('0x1a')](channels[_0x3e8c60['linkedid']])&&_0x3e8c60['channelstate']==0x6&&_0x3e8c60[_0x0658('0x14')]!=_0x0658('0x1b')){channels[_0x3e8c60[_0x0658('0x10')]][_0x0658('0x8')]=_0x3e8c60['accountcode'];channels[_0x3e8c60[_0x0658('0x10')]][_0x0658('0x1c')]=_0x3e8c60[_0x0658('0x7')];if(_['isNil'](channels[_0x3e8c60[_0x0658('0x10')]]['answertime'])){channels[_0x3e8c60['linkedid']][_0x0658('0x1d')]=utils[_0x0658('0x15')]();}channels[_0x3e8c60['linkedid']][_0x0658('0xa')]=dispositions[_[_0x0658('0x1e')](_0x3e8c60[_0x0658('0x1f')])]||_0x0658('0x3');}}catch(_0x20fd23){utils[_0x0658('0x16')](_0x20fd23[_0x0658('0x17')]);}};exports[_0x0658('0x20')]=function(_0x2486d8){try{if(!_['isNil'](channels[_0x2486d8[_0x0658('0x6')]])){if(_[_0x0658('0x1a')](channels[_0x2486d8[_0x0658('0x6')]][_0x0658('0x9')])){channels[_0x2486d8[_0x0658('0x6')]][_0x0658('0x9')]=_0x2486d8['calleridname']+'\x20<'+_0x2486d8[_0x0658('0x12')]+'>';}channels[_0x2486d8[_0x0658('0x6')]]['endtime']=utils[_0x0658('0x15')]();channels[_0x2486d8[_0x0658('0x6')]]['duration']=utils[_0x0658('0x21')](channels[_0x2486d8['uniqueid']]['endtime'],channels[_0x2486d8[_0x0658('0x6')]]['starttime']);channels[_0x2486d8[_0x0658('0x6')]]['billableseconds']=channels[_0x2486d8['uniqueid']][_0x0658('0x1d')]?utils['diffTime'](channels[_0x2486d8['uniqueid']][_0x0658('0x22')],channels[_0x2486d8['uniqueid']]['answertime']):0x0;writeDB(channels[_0x2486d8[_0x0658('0x6')]]);}}catch(_0xcdac3b){utils[_0x0658('0x16')](_0xcdac3b[_0x0658('0x17')]);}};exports[_0x0658('0x23')]=function(_0x4e9e6e){try{if(!_[_0x0658('0x1a')](channels[_0x4e9e6e[_0x0658('0x24')]])){if(channels[_0x4e9e6e['localtwolinkedid']][_0x0658('0x7')]==_0x4e9e6e[_0x0658('0x25')]){channels[_0x4e9e6e[_0x0658('0x24')]]['destinationchannel']=_0x4e9e6e[_0x0658('0x26')];channels[_0x4e9e6e[_0x0658('0x24')]][_0x0658('0x27')]=_0x0658('0x28');}else if(channels[_0x4e9e6e[_0x0658('0x24')]][_0x0658('0x7')]=_0x4e9e6e[_0x0658('0x29')]){channels[_0x4e9e6e['localtwolinkedid']][_0x0658('0x1c')]=_0x4e9e6e[_0x0658('0x2a')];channels[_0x4e9e6e[_0x0658('0x24')]]['userfield']='_attended';}}}catch(_0x4655ee){utils[_0x0658('0x16')](_0x4655ee['stack']);}};exports[_0x0658('0x2b')]=function(_0x37cd96){try{if(!_['isNil'](channels[_0x37cd96[_0x0658('0x6')]])){channels[_0x37cd96[_0x0658('0x6')]]['musiconholdstartAt']=utils[_0x0658('0x15')]();}}catch(_0x496eff){utils[_0x0658('0x16')](_0x496eff[_0x0658('0x17')]);}};exports[_0x0658('0x2c')]=function(_0x246c5c){try{if(!_[_0x0658('0x1a')](channels[_0x246c5c[_0x0658('0x6')]])){if(!_[_0x0658('0x1a')](channels[_0x246c5c[_0x0658('0x6')]][_0x0658('0x2d')])){channels[_0x246c5c[_0x0658('0x6')]]['mohtime']+=utils[_0x0658('0x21')](utils[_0x0658('0x15')](),channels[_0x246c5c[_0x0658('0x6')]][_0x0658('0x2d')]);delete channels[_0x246c5c['uniqueid']][_0x0658('0x2d')];}}}catch(_0x382898){utils[_0x0658('0x16')](_0x382898[_0x0658('0x17')]);}};exports[_0x0658('0x2e')]=function(_0x59c315){try{if(!_[_0x0658('0x1a')](channels[_0x59c315[_0x0658('0x6')]])){if(!_['isNil'](_0x59c315[_0x0658('0x2f')]['xmd-originatecalleridnum'])){channels[_0x59c315['uniqueid']]['source']=_0x59c315[_0x0658('0x30')];}if(!_[_0x0658('0x1a')](_0x59c315[_0x0658('0x2f')][_0x0658('0x31')])){channels[_0x59c315[_0x0658('0x6')]][_0x0658('0x32')]=_0x59c315[_0x0658('0x30')];channels[_0x59c315[_0x0658('0x6')]][_0x0658('0x9')]='\x22'+_0x59c315[_0x0658('0x30')]+_0x0658('0x33')+_0x59c315[_0x0658('0x30')]+'>';}if(!_[_0x0658('0x1a')](_0x59c315[_0x0658('0x2f')][_0x0658('0x34')])||!_[_0x0658('0x1a')](_0x59c315[_0x0658('0x2f')][_0x0658('0x35')])){channels[_0x59c315[_0x0658('0x6')]][_0x0658('0x9')]=_0x59c315[_0x0658('0x30')];}if(!_[_0x0658('0x1a')](_0x59c315['variable']['xmd-queue'])||!_[_0x0658('0x1a')](_0x59c315[_0x0658('0x2f')]['xmcs-queue'])){channels[_0x59c315[_0x0658('0x6')]]['lastapplication']=_0x0658('0x36');channels[_0x59c315[_0x0658('0x6')]][_0x0658('0x37')]=_0x59c315[_0x0658('0x30')];channels[_0x59c315[_0x0658('0x6')]]['queue']=!![];}if(!_[_0x0658('0x1a')](_0x59c315['variable'][_0x0658('0x38')])){channels[_0x59c315[_0x0658('0x6')]]['ContactId']=_0x59c315[_0x0658('0x30')];}if(!_[_0x0658('0x1a')](_0x59c315[_0x0658('0x2f')][_0x0658('0x39')])){channels[_0x59c315[_0x0658('0x6')]][_0x0658('0x3a')]=_0x59c315[_0x0658('0x30')];}if(!_['isNil'](_0x59c315[_0x0658('0x2f')][_0x0658('0x3b')])){channels[_0x59c315[_0x0658('0x6')]][_0x0658('0x3c')]=_0x59c315[_0x0658('0x30')];}if(!_[_0x0658('0x1a')](_0x59c315[_0x0658('0x2f')][_0x0658('0x3d')])){channels[_0x59c315['uniqueid']][_0x0658('0x3d')]=_0x59c315[_0x0658('0x30')];}}}catch(_0x4a8cac){utils['error'](_0x4a8cac[_0x0658('0x17')]);}};exports[_0x0658('0x3e')]=function(_0x3ae2f8){try{if(!_[_0x0658('0x1a')](channels[_0x3ae2f8[_0x0658('0x6')]])){if(_0x3ae2f8[_0x0658('0x3f')][_0x0658('0x40')]()=='set'&&_['startsWith'](_0x3ae2f8['appdata'][_0x0658('0x40')](),_0x0658('0x41'))){var _0x1b1c0c=_0x3ae2f8[_0x0658('0x42')][_0x0658('0x43')]('=');var _0x51dfcf=_0x1b1c0c[0x0][_0x0658('0x44')](_0x1b1c0c[0x0][_0x0658('0x45')]('(')+0x1,_0x1b1c0c[0x0][_0x0658('0x45')](')'));var _0x4af159=_0x1b1c0c[0x1];channels[_0x3ae2f8[_0x0658('0x6')]][_0x51dfcf]=_0x4af159;}if(!_[_0x0658('0x46')]([_0x0658('0x20'),'noop','execif',_0x0658('0x47'),_0x0658('0x48')],_0x3ae2f8['application'][_0x0658('0x40')]())){channels[_0x3ae2f8['uniqueid']]['lastapplication']=_0x3ae2f8[_0x0658('0x3f')];channels[_0x3ae2f8['uniqueid']][_0x0658('0x37')]=_0x3ae2f8['appdata'];}}}catch(_0x1a6a80){utils[_0x0658('0x16')](_0x1a6a80['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 440d76d..8f4d4f7 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 _0x1cb9=['FULLYBOOTED','error','close','managerevent','./utils','connect','info','CONNECTED','shutdown','SHUTDOWN','fullybooted'];(function(_0x26d6d9,_0x431cb8){var _0x1b4875=function(_0x41111f){while(--_0x41111f){_0x26d6d9['push'](_0x26d6d9['shift']());}};_0x1b4875(++_0x431cb8);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4613ef,_0x5d0c6a){_0x4613ef=_0x4613ef-0x0;var _0x3e13fe=_0x1cb9[_0x4613ef];return _0x3e13fe;};'use strict';var utils=require(_0x91cb('0x0'));var _=require('lodash');exports[_0x91cb('0x1')]=function(){utils[_0x91cb('0x2')](_0x91cb('0x3'));};exports[_0x91cb('0x4')]=function(){utils['info'](_0x91cb('0x5'));};exports[_0x91cb('0x6')]=function(){utils['info'](_0x91cb('0x7'));};exports[_0x91cb('0x8')]=function(_0x186dc3){utils[_0x91cb('0x8')](_0x186dc3);};exports[_0x91cb('0x9')]=function(){utils[_0x91cb('0x2')]('CLOSE');};exports[_0x91cb('0xa')]=function(_0x5bda2f){}; \ No newline at end of file +var _0xeda8=['shutdown','SHUTDOWN','fullybooted','FULLYBOOTED','error','close','CLOSE','managerevent','./utils','lodash','info','CONNECTED'];(function(_0x36f82a,_0x4ec395){var _0x495067=function(_0x2ede56){while(--_0x2ede56){_0x36f82a['push'](_0x36f82a['shift']());}};_0x495067(++_0x4ec395);}(_0xeda8,0x104));var _0x8eda=function(_0x474ac8,_0x1f203d){_0x474ac8=_0x474ac8-0x0;var _0x58762c=_0xeda8[_0x474ac8];return _0x58762c;};'use strict';var utils=require(_0x8eda('0x0'));var _=require(_0x8eda('0x1'));exports['connect']=function(){utils[_0x8eda('0x2')](_0x8eda('0x3'));};exports[_0x8eda('0x4')]=function(){utils[_0x8eda('0x2')](_0x8eda('0x5'));};exports[_0x8eda('0x6')]=function(){utils[_0x8eda('0x2')](_0x8eda('0x7'));};exports[_0x8eda('0x8')]=function(_0x1f3556){utils[_0x8eda('0x8')](_0x1f3556);};exports[_0x8eda('0x9')]=function(){utils['info'](_0x8eda('0xa'));};exports[_0x8eda('0xb')]=function(_0x5aa93d){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index eddebb7..c9e874d 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 _0x953d=['hangup','complete','duration','diffTime','endtime','starttime','holdtime','util','./utils','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','calleridnum','dialstatus','CreateVoiceDialReport','toLowerCase','startsWith','appdata','cdr(routeid)','error','stack','varset','isNil','variable','outboundrouteid','dialbegin','assign','now','lastevent','called','dialend','answertime','connect'];(function(_0x1a219d,_0x405933){var _0x5f133b=function(_0x3ccf2a){while(--_0x3ccf2a){_0x1a219d['push'](_0x1a219d['shift']());}};_0x5f133b(++_0x405933);}(_0x953d,0x93));var _0xd953=function(_0x586184,_0x57c05e){_0x586184=_0x586184-0x0;var _0xaafcdb=_0x953d[_0x586184];return _0xaafcdb;};'use strict';var _=require('lodash');var util=require(_0xd953('0x0'));var utils=require(_0xd953('0x1'));var dials={};function writeDB(_0x92b0c5){utils['info'](util[_0xd953('0x2')](_0xd953('0x3'),_0x92b0c5[_0xd953('0x4')],_0x92b0c5[_0xd953('0x5')],_0x92b0c5[_0xd953('0x6')],_0x92b0c5[_0xd953('0x7')],_0x92b0c5['connectedlinenum'],_0x92b0c5[_0xd953('0x8')]));utils['request'](_0xd953('0x9'),_0x92b0c5);delete dials[_0x92b0c5['uniqueid']];}exports['newexten']=function(_0x4a77b6){try{if(_0x4a77b6['application'][_0xd953('0xa')]()=='set'&&_[_0xd953('0xb')](_0x4a77b6[_0xd953('0xc')][_0xd953('0xa')](),_0xd953('0xd'))){var _0x251cd7=_0x4a77b6[_0xd953('0xc')]['split']('=');dials[_0x4a77b6[_0xd953('0x4')]]={'routeId':_0x251cd7[0x1]};}}catch(_0x2aaebf){utils[_0xd953('0xe')](_0x2aaebf[_0xd953('0xf')]);}};exports[_0xd953('0x10')]=function(_0xec346d){try{if(!_[_0xd953('0x11')](_0xec346d[_0xd953('0x12')][_0xd953('0x13')])){dials[_0xec346d[_0xd953('0x4')]]={'routeId':_0xec346d['value']};}}catch(_0x82a8ae){utils['error'](_0x82a8ae[_0xd953('0xf')]);}};exports[_0xd953('0x14')]=function(_0x5c1fd1){try{if(!_[_0xd953('0x11')](dials[_0x5c1fd1[_0xd953('0x4')]])){dials[_0x5c1fd1[_0xd953('0x4')]]=_[_0xd953('0x15')](dials[_0x5c1fd1[_0xd953('0x4')]],_0x5c1fd1);dials[_0x5c1fd1['uniqueid']]['starttime']=utils[_0xd953('0x16')]();dials[_0x5c1fd1[_0xd953('0x4')]][_0xd953('0x17')]=_0xd953('0x18');}}catch(_0x13749b){utils['error'](_0x13749b['stack']);}};exports[_0xd953('0x19')]=function(_0x3beeea){try{if(!_['isNil'](dials[_0x3beeea[_0xd953('0x4')]])){dials[_0x3beeea[_0xd953('0x4')]][_0xd953('0x8')]=_0x3beeea['dialstatus'];if(_0x3beeea[_0xd953('0x8')]=='ANSWER'){dials[_0x3beeea[_0xd953('0x4')]]=_[_0xd953('0x15')](dials[_0x3beeea[_0xd953('0x4')]],_0x3beeea);dials[_0x3beeea['uniqueid']][_0xd953('0x1a')]=utils['now']();dials[_0x3beeea[_0xd953('0x4')]]['lastevent']=_0xd953('0x1b');}}}catch(_0x2dee7c){utils['error'](_0x2dee7c[_0xd953('0xf')]);}};exports[_0xd953('0x1c')]=function(_0x4cf97c){try{if(!_[_0xd953('0x11')](dials[_0x4cf97c['uniqueid']])){dials[_0x4cf97c['uniqueid']]=_[_0xd953('0x15')](dials[_0x4cf97c[_0xd953('0x4')]],{'endtime':utils[_0xd953('0x16')](),'lastevent':_0xd953('0x1d')});dials[_0x4cf97c[_0xd953('0x4')]][_0xd953('0x1e')]=utils[_0xd953('0x1f')](dials[_0x4cf97c[_0xd953('0x4')]][_0xd953('0x20')],dials[_0x4cf97c[_0xd953('0x4')]][_0xd953('0x21')]);dials[_0x4cf97c['uniqueid']][_0xd953('0x22')]=utils[_0xd953('0x1f')](dials[_0x4cf97c[_0xd953('0x4')]][_0xd953('0x1a')]||dials[_0x4cf97c[_0xd953('0x4')]][_0xd953('0x20')],dials[_0x4cf97c[_0xd953('0x4')]][_0xd953('0x21')]);dials[_0x4cf97c[_0xd953('0x4')]]['billableseconds']=dials[_0x4cf97c[_0xd953('0x4')]]['answertime']?utils[_0xd953('0x1f')](dials[_0x4cf97c['uniqueid']][_0xd953('0x20')],dials[_0x4cf97c['uniqueid']]['answertime']):0x0;writeDB(dials[_0x4cf97c[_0xd953('0x4')]]);}}catch(_0x5eeed3){utils[_0xd953('0xe')](_0x5eeed3[_0xd953('0xf')]);}}; \ No newline at end of file +var _0x4189=['request','newexten','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','error','varset','isNil','variable','outboundrouteid','value','dialbegin','assign','starttime','now','lastevent','stack','dialend','answertime','complete','duration','diffTime','holdtime','endtime','billableseconds','lodash','./utils','info','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','dialstring','calleridnum','dialstatus'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4189,0x160));var _0x9418=function(_0x2c899f,_0x5e5e18){_0x2c899f=_0x2c899f-0x0;var _0x4b781b=_0x4189[_0x2c899f];return _0x4b781b;};'use strict';var _=require(_0x9418('0x0'));var util=require('util');var utils=require(_0x9418('0x1'));var dials={};function writeDB(_0xd5e89e){utils[_0x9418('0x2')](util['format'](_0x9418('0x3'),_0xd5e89e[_0x9418('0x4')],_0xd5e89e['channel'],_0xd5e89e[_0x9418('0x5')],_0xd5e89e[_0x9418('0x6')],_0xd5e89e['connectedlinenum'],_0xd5e89e[_0x9418('0x7')]));utils[_0x9418('0x8')]('CreateVoiceDialReport',_0xd5e89e);delete dials[_0xd5e89e[_0x9418('0x4')]];}exports[_0x9418('0x9')]=function(_0x2ac01b){try{if(_0x2ac01b[_0x9418('0xa')][_0x9418('0xb')]()==_0x9418('0xc')&&_[_0x9418('0xd')](_0x2ac01b[_0x9418('0xe')][_0x9418('0xb')](),_0x9418('0xf'))){var _0x4b4acc=_0x2ac01b[_0x9418('0xe')]['split']('=');dials[_0x2ac01b[_0x9418('0x4')]]={'routeId':_0x4b4acc[0x1]};}}catch(_0x2386f1){utils[_0x9418('0x10')](_0x2386f1['stack']);}};exports[_0x9418('0x11')]=function(_0x721059){try{if(!_[_0x9418('0x12')](_0x721059[_0x9418('0x13')][_0x9418('0x14')])){dials[_0x721059[_0x9418('0x4')]]={'routeId':_0x721059[_0x9418('0x15')]};}}catch(_0x2f3282){utils[_0x9418('0x10')](_0x2f3282['stack']);}};exports[_0x9418('0x16')]=function(_0x4ef6d1){try{if(!_[_0x9418('0x12')](dials[_0x4ef6d1['uniqueid']])){dials[_0x4ef6d1['uniqueid']]=_[_0x9418('0x17')](dials[_0x4ef6d1[_0x9418('0x4')]],_0x4ef6d1);dials[_0x4ef6d1[_0x9418('0x4')]][_0x9418('0x18')]=utils[_0x9418('0x19')]();dials[_0x4ef6d1[_0x9418('0x4')]][_0x9418('0x1a')]='called';}}catch(_0x1708c9){utils[_0x9418('0x10')](_0x1708c9[_0x9418('0x1b')]);}};exports[_0x9418('0x1c')]=function(_0xa6bb3){try{if(!_[_0x9418('0x12')](dials[_0xa6bb3[_0x9418('0x4')]])){dials[_0xa6bb3['uniqueid']][_0x9418('0x7')]=_0xa6bb3['dialstatus'];if(_0xa6bb3['dialstatus']=='ANSWER'){dials[_0xa6bb3[_0x9418('0x4')]]=_[_0x9418('0x17')](dials[_0xa6bb3[_0x9418('0x4')]],_0xa6bb3);dials[_0xa6bb3[_0x9418('0x4')]][_0x9418('0x1d')]=utils[_0x9418('0x19')]();dials[_0xa6bb3[_0x9418('0x4')]][_0x9418('0x1a')]='connect';}}}catch(_0x40b6b8){utils[_0x9418('0x10')](_0x40b6b8[_0x9418('0x1b')]);}};exports['hangup']=function(_0x9e4592){try{if(!_[_0x9418('0x12')](dials[_0x9e4592[_0x9418('0x4')]])){dials[_0x9e4592[_0x9418('0x4')]]=_[_0x9418('0x17')](dials[_0x9e4592['uniqueid']],{'endtime':utils[_0x9418('0x19')](),'lastevent':_0x9418('0x1e')});dials[_0x9e4592[_0x9418('0x4')]][_0x9418('0x1f')]=utils[_0x9418('0x20')](dials[_0x9e4592[_0x9418('0x4')]]['endtime'],dials[_0x9e4592[_0x9418('0x4')]][_0x9418('0x18')]);dials[_0x9e4592[_0x9418('0x4')]][_0x9418('0x21')]=utils[_0x9418('0x20')](dials[_0x9e4592['uniqueid']]['answertime']||dials[_0x9e4592[_0x9418('0x4')]][_0x9418('0x22')],dials[_0x9e4592[_0x9418('0x4')]][_0x9418('0x18')]);dials[_0x9e4592[_0x9418('0x4')]][_0x9418('0x23')]=dials[_0x9e4592[_0x9418('0x4')]][_0x9418('0x1d')]?utils[_0x9418('0x20')](dials[_0x9e4592[_0x9418('0x4')]]['endtime'],dials[_0x9e4592[_0x9418('0x4')]]['answertime']):0x0;writeDB(dials[_0x9e4592[_0x9418('0x4')]]);}}catch(_0x185230){utils[_0x9418('0x10')](_0x185230[_0x9418('0x1b')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 5dd69c1..aeedf44 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 _0xab5d=['musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','./utils','asterisk','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave'];(function(_0x3702d1,_0x33b049){var _0x53dde0=function(_0x4761e5){while(--_0x4761e5){_0x3702d1['push'](_0x3702d1['shift']());}};_0x53dde0(++_0x33b049);}(_0xab5d,0xde));var _0xdab5=function(_0x14f3a5,_0x19379c){_0x14f3a5=_0x14f3a5-0x0;var _0x55e8d3=_0xab5d[_0x14f3a5];return _0x55e8d3;};var AsteriskManager=require(_0xdab5('0x0'));var config=require('../../config/environment');var utils=require(_0xdab5('0x1'));var ami=new AsteriskManager(config[_0xdab5('0x2')]['port'],config['asterisk']['ip'],config[_0xdab5('0x2')][_0xdab5('0x3')],config['asterisk'][_0xdab5('0x4')],!![]);ami[_0xdab5('0x5')]();if(config[_0xdab5('0x6')]&&config[_0xdab5('0x6')][_0xdab5('0x7')]){utils[_0xdab5('0x8')](_0xdab5('0x9'));}else{var agents=require(_0xdab5('0xa'));var calls=require(_0xdab5('0xb'));var queues=require(_0xdab5('0xc'));var recordings=require('./recordings.controller');var members=require(_0xdab5('0xd'));var dials=require(_0xdab5('0xe'));var transfers=require('./transfers.controller');var core=require(_0xdab5('0xf'));ami['on'](_0xdab5('0x10'),core[_0xdab5('0x10')]);ami['on'](_0xdab5('0x11'),core[_0xdab5('0x11')]);ami['on'](_0xdab5('0x12'),core[_0xdab5('0x12')]);ami['on']('error',core[_0xdab5('0x13')]);ami['on'](_0xdab5('0x14'),core[_0xdab5('0x14')]);ami['on'](_0xdab5('0x15'),core[_0xdab5('0x15')]);ami['on']('devicestatechange',function(_0x509963){try{members[_0xdab5('0x16')](_0x509963);}catch(_0x5cd0eb){utils[_0xdab5('0x13')](_0x5cd0eb);}});ami['on'](_0xdab5('0x17'),function(_0x47c2f4){try{agents['agentcalled'](_0x47c2f4);}catch(_0x5af20b){utils[_0xdab5('0x13')](_0x5af20b);}});ami['on'](_0xdab5('0x18'),function(_0x456c48){try{agents[_0xdab5('0x18')](_0x456c48);}catch(_0x4ef4ef){utils[_0xdab5('0x13')](_0x4ef4ef);}});ami['on'](_0xdab5('0x19'),function(_0x1e5662){try{agents[_0xdab5('0x19')](_0x1e5662);queues['agentconnect'](_0x1e5662);}catch(_0x3d483e){utils['error'](_0x3d483e);}});ami['on'](_0xdab5('0x1a'),function(_0x474860){try{agents[_0xdab5('0x1a')](_0x474860);queues['agentcomplete'](_0x474860);members['agentcomplete'](_0x474860);}catch(_0x54e923){utils[_0xdab5('0x13')](_0x54e923);}});ami['on'](_0xdab5('0x1b'),function(_0x5ae79e){try{agents['queuecallerabandon'](_0x5ae79e);queues['queuecallerabandon'](_0x5ae79e);}catch(_0x2d46a4){utils[_0xdab5('0x13')](_0x2d46a4);}});ami['on']('queuecallerjoin',function(_0x4eecff){try{queues[_0xdab5('0x1c')](_0x4eecff);recordings[_0xdab5('0x1c')](_0x4eecff);}catch(_0x58bd0b){utils[_0xdab5('0x13')](_0x58bd0b);}});ami['on']('queuecallerleave',function(_0x281648){try{queues[_0xdab5('0x1d')](_0x281648);}catch(_0x261443){utils[_0xdab5('0x13')](_0x261443);}});ami['on'](_0xdab5('0x1e'),function(_0x28abd5){try{queues[_0xdab5('0x1e')](_0x28abd5);calls['musiconholdstart'](_0x28abd5);}catch(_0x2cd666){utils[_0xdab5('0x13')](_0x2cd666);}});ami['on'](_0xdab5('0x1f'),function(_0x3e6d1d){try{queues[_0xdab5('0x1f')](_0x3e6d1d);calls[_0xdab5('0x1f')](_0x3e6d1d);}catch(_0x111305){utils['error'](_0x111305);}});ami['on'](_0xdab5('0x20'),function(_0x1fe105){try{calls['newstate'](_0x1fe105);recordings[_0xdab5('0x20')](_0x1fe105);}catch(_0x45d742){utils[_0xdab5('0x13')](_0x45d742);}});ami['on']('hangup',function(_0x3f2362){try{calls['hangup'](_0x3f2362);recordings[_0xdab5('0x21')](_0x3f2362);dials[_0xdab5('0x21')](_0x3f2362);agents[_0xdab5('0x21')](_0x3f2362);queues[_0xdab5('0x21')](_0x3f2362);}catch(_0x14516d){utils[_0xdab5('0x13')](_0x14516d);}});ami['on'](_0xdab5('0x22'),function(_0x392712){try{members['cdr'](_0x392712);}catch(_0x3809bb){utils['error'](_0x3809bb);}});ami['on'](_0xdab5('0x23'),function(_0x4c41d1){try{queues[_0xdab5('0x23')](_0x4c41d1);agents['blindtransfer'](_0x4c41d1);transfers[_0xdab5('0x23')](_0x4c41d1);}catch(_0x56b998){utils[_0xdab5('0x13')](_0x56b998);}});ami['on'](_0xdab5('0x24'),function(_0x27fa75){try{queues[_0xdab5('0x24')](_0x27fa75);transfers[_0xdab5('0x24')](_0x27fa75);agents[_0xdab5('0x24')](_0x27fa75);calls['attendedtransfer'](_0x27fa75);}catch(_0x2f92c7){utils[_0xdab5('0x13')](_0x2f92c7);}});ami['on'](_0xdab5('0x25'),function(_0x1144eb){try{queues['varset'](_0x1144eb);recordings[_0xdab5('0x25')](_0x1144eb);calls[_0xdab5('0x25')](_0x1144eb);dials[_0xdab5('0x25')](_0x1144eb);}catch(_0x1d0880){utils['error'](_0x1d0880);}});ami['on'](_0xdab5('0x26'),function(_0x27020e){try{calls[_0xdab5('0x26')](_0x27020e);recordings[_0xdab5('0x26')](_0x27020e);dials[_0xdab5('0x26')](_0x27020e);}catch(_0xac3037){utils[_0xdab5('0x13')](_0xac3037);}});ami['on'](_0xdab5('0x27'),function(_0x3ad076){try{calls['newchannel'](_0x3ad076);recordings[_0xdab5('0x27')](_0x3ad076);}catch(_0x2b86b3){utils[_0xdab5('0x13')](_0x2b86b3);}});ami['on'](_0xdab5('0x28'),function(_0xdf1aac){try{dials['dialbegin'](_0xdf1aac);}catch(_0xd24263){utils[_0xdab5('0x13')](_0xd24263);}});ami['on'](_0xdab5('0x29'),function(_0xe38232){try{dials['dialend'](_0xe38232);}catch(_0x5ce1eb){utils[_0xdab5('0x13')](_0x5ce1eb);}});} \ No newline at end of file +var _0x431c=['dialend','asterisk-manager','../../config/environment','./utils','port','asterisk','username','password','xdr','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.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','dialbegin'];(function(_0x2f7237,_0x2ee4c6){var _0x5005b9=function(_0xa29f5b){while(--_0xa29f5b){_0x2f7237['push'](_0x2f7237['shift']());}};_0x5005b9(++_0x2ee4c6);}(_0x431c,0x120));var _0xc431=function(_0x57fcd3,_0x20cf25){_0x57fcd3=_0x57fcd3-0x0;var _0x134dfc=_0x431c[_0x57fcd3];return _0x134dfc;};var AsteriskManager=require(_0xc431('0x0'));var config=require(_0xc431('0x1'));var utils=require(_0xc431('0x2'));var ami=new AsteriskManager(config['asterisk'][_0xc431('0x3')],config[_0xc431('0x4')]['ip'],config['asterisk'][_0xc431('0x5')],config[_0xc431('0x4')][_0xc431('0x6')],!![]);ami['keepConnected']();if(config[_0xc431('0x7')]&&config[_0xc431('0x7')]['disabled']){utils['info']('XDR\x20DISABLED');}else{var agents=require(_0xc431('0x8'));var calls=require(_0xc431('0x9'));var queues=require(_0xc431('0xa'));var recordings=require(_0xc431('0xb'));var members=require(_0xc431('0xc'));var dials=require(_0xc431('0xd'));var transfers=require(_0xc431('0xe'));var core=require('./core.controller');ami['on'](_0xc431('0xf'),core[_0xc431('0xf')]);ami['on'](_0xc431('0x10'),core['shutdown']);ami['on'](_0xc431('0x11'),core[_0xc431('0x11')]);ami['on'](_0xc431('0x12'),core[_0xc431('0x12')]);ami['on'](_0xc431('0x13'),core[_0xc431('0x13')]);ami['on'](_0xc431('0x14'),core[_0xc431('0x14')]);ami['on'](_0xc431('0x15'),function(_0x425f96){try{members[_0xc431('0x15')](_0x425f96);}catch(_0x1bab32){utils['error'](_0x1bab32);}});ami['on'](_0xc431('0x16'),function(_0x2f70ff){try{agents[_0xc431('0x16')](_0x2f70ff);}catch(_0x497683){utils[_0xc431('0x12')](_0x497683);}});ami['on'](_0xc431('0x17'),function(_0x1fc903){try{agents['agentringnoanswer'](_0x1fc903);}catch(_0x33b3b3){utils[_0xc431('0x12')](_0x33b3b3);}});ami['on']('agentconnect',function(_0x2e049e){try{agents['agentconnect'](_0x2e049e);queues[_0xc431('0x18')](_0x2e049e);}catch(_0x51f3b6){utils[_0xc431('0x12')](_0x51f3b6);}});ami['on']('agentcomplete',function(_0x4efa53){try{agents[_0xc431('0x19')](_0x4efa53);queues[_0xc431('0x19')](_0x4efa53);members['agentcomplete'](_0x4efa53);}catch(_0x17d2d6){utils[_0xc431('0x12')](_0x17d2d6);}});ami['on'](_0xc431('0x1a'),function(_0x5aa754){try{agents[_0xc431('0x1a')](_0x5aa754);queues[_0xc431('0x1a')](_0x5aa754);}catch(_0x1acd2b){utils[_0xc431('0x12')](_0x1acd2b);}});ami['on']('queuecallerjoin',function(_0xb2cbfa){try{queues['queuecallerjoin'](_0xb2cbfa);recordings[_0xc431('0x1b')](_0xb2cbfa);}catch(_0x2f2f40){utils[_0xc431('0x12')](_0x2f2f40);}});ami['on'](_0xc431('0x1c'),function(_0x3532fd){try{queues[_0xc431('0x1c')](_0x3532fd);}catch(_0x3a3ea6){utils[_0xc431('0x12')](_0x3a3ea6);}});ami['on'](_0xc431('0x1d'),function(_0x3c137e){try{queues[_0xc431('0x1d')](_0x3c137e);calls['musiconholdstart'](_0x3c137e);}catch(_0xbdc75d){utils[_0xc431('0x12')](_0xbdc75d);}});ami['on'](_0xc431('0x1e'),function(_0x15c056){try{queues[_0xc431('0x1e')](_0x15c056);calls[_0xc431('0x1e')](_0x15c056);}catch(_0x17f3b7){utils[_0xc431('0x12')](_0x17f3b7);}});ami['on'](_0xc431('0x1f'),function(_0x11b69f){try{calls[_0xc431('0x1f')](_0x11b69f);recordings[_0xc431('0x1f')](_0x11b69f);}catch(_0x1a8558){utils[_0xc431('0x12')](_0x1a8558);}});ami['on']('hangup',function(_0x430277){try{calls[_0xc431('0x20')](_0x430277);recordings['hangup'](_0x430277);dials[_0xc431('0x20')](_0x430277);agents[_0xc431('0x20')](_0x430277);queues[_0xc431('0x20')](_0x430277);}catch(_0x21de4a){utils[_0xc431('0x12')](_0x21de4a);}});ami['on'](_0xc431('0x21'),function(_0x1ef07e){try{members[_0xc431('0x21')](_0x1ef07e);}catch(_0x24cec2){utils['error'](_0x24cec2);}});ami['on'](_0xc431('0x22'),function(_0x4bd916){try{queues[_0xc431('0x22')](_0x4bd916);agents[_0xc431('0x22')](_0x4bd916);transfers['blindtransfer'](_0x4bd916);}catch(_0x1ecece){utils[_0xc431('0x12')](_0x1ecece);}});ami['on'](_0xc431('0x23'),function(_0x437c3a){try{queues[_0xc431('0x23')](_0x437c3a);transfers[_0xc431('0x23')](_0x437c3a);agents[_0xc431('0x23')](_0x437c3a);calls['attendedtransfer'](_0x437c3a);}catch(_0x2c03f5){utils['error'](_0x2c03f5);}});ami['on'](_0xc431('0x24'),function(_0x362c61){try{queues[_0xc431('0x24')](_0x362c61);recordings[_0xc431('0x24')](_0x362c61);calls['varset'](_0x362c61);dials[_0xc431('0x24')](_0x362c61);}catch(_0x69e905){utils[_0xc431('0x12')](_0x69e905);}});ami['on'](_0xc431('0x25'),function(_0x2fc2c6){try{calls[_0xc431('0x25')](_0x2fc2c6);recordings[_0xc431('0x25')](_0x2fc2c6);dials[_0xc431('0x25')](_0x2fc2c6);}catch(_0x3e00b8){utils[_0xc431('0x12')](_0x3e00b8);}});ami['on'](_0xc431('0x26'),function(_0x43b0b8){try{calls['newchannel'](_0x43b0b8);recordings[_0xc431('0x26')](_0x43b0b8);}catch(_0x1de039){utils['error'](_0x1de039);}});ami['on'](_0xc431('0x27'),function(_0x27f80b){try{dials['dialbegin'](_0x27f80b);}catch(_0x20afff){utils[_0xc431('0x12')](_0x20afff);}});ami['on']('dialend',function(_0x1cfc25){try{dials[_0xc431('0x28')](_0x1cfc25);}catch(_0x73abef){utils['error'](_0x73abef);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 1fed612..fbeeb8c 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 _0xc7a5=['interface','channel','membername','getUserByInterface','name','internal','request','CreateMemberReport','split','then','catch','error','some','startsWith','state','INUSE','device','voice','now','agent','NOT_INUSE','exitAt','diffTime','agentcomplete','isNil','assign','cdr','data1','data2','source','destination','destinationchannel','type','data3','lodash','./utils','Local/_attended@transfer','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid'];(function(_0xa65f93,_0x13879f){var _0x4e31c8=function(_0x2e087a){while(--_0x2e087a){_0xa65f93['push'](_0xa65f93['shift']());}};_0x4e31c8(++_0x13879f);}(_0xc7a5,0x148));var _0x5c7a=function(_0x989005,_0x320d2c){_0x989005=_0x989005-0x0;var _0x13aa50=_0xc7a5[_0x989005];return _0x13aa50;};'use strict';var _=require(_0x5c7a('0x0'));var util=require('util');var utils=require(_0x5c7a('0x1'));var members={};var exclude=[_0x5c7a('0x2'),_0x5c7a('0x3')];function writeDB(_0x5affe2){utils[_0x5c7a('0x4')](util[_0x5c7a('0x5')](_0x5c7a('0x6'),_0x5affe2[_0x5c7a('0x7')],_0x5affe2[_0x5c7a('0x8')],_0x5affe2[_0x5c7a('0x9')],_0x5affe2['data2'],_0x5affe2[_0x5c7a('0xa')],_0x5affe2['type']));if(_0x5affe2['interface']){utils[_0x5c7a('0xb')](_0x5affe2[_0x5c7a('0x8')])['then'](function(_0x37bbd1){if(_0x37bbd1){_0x5affe2[_0x5c7a('0xa')]=_0x37bbd1[_0x5c7a('0xc')];_0x5affe2['internal']=_0x37bbd1[_0x5c7a('0xd')];utils[_0x5c7a('0xe')](_0x5c7a('0xf'),_0x5affe2);}else{utils['getUserByName'](_0x5affe2[_0x5c7a('0x8')][_0x5c7a('0x10')]('/')[0x1])[_0x5c7a('0x11')](function(_0x6ef99c){if(_0x6ef99c){_0x5affe2[_0x5c7a('0xa')]=_0x6ef99c[_0x5c7a('0xc')];_0x5affe2[_0x5c7a('0xd')]=_0x6ef99c[_0x5c7a('0xd')];utils[_0x5c7a('0xe')](_0x5c7a('0xf'),_0x5affe2);}});}})[_0x5c7a('0x12')](function(_0x343f9d){utils[_0x5c7a('0x13')](_0x343f9d);});}delete members[_0x5affe2[_0x5c7a('0x8')]];}function startsWith(_0x41cdcc,_0x5968b5){return _[_0x5c7a('0x14')](_0x41cdcc,function(_0x321f39){return _[_0x5c7a('0x15')](_0x5968b5,_0x321f39);});}exports['devicestatechange']=function(_0x2f11da){switch(_0x2f11da[_0x5c7a('0x16')]){case _0x5c7a('0x17'):case'BUSY':if(!startsWith(exclude,_0x2f11da[_0x5c7a('0x18')])){members[_0x2f11da[_0x5c7a('0x18')]]={'channel':_0x5c7a('0x19'),'interface':_0x2f11da[_0x5c7a('0x18')],'type':'TALKING','enterAt':utils[_0x5c7a('0x1a')](),'role':_0x5c7a('0x1b')};}break;case _0x5c7a('0x1c'):if(!_['isNil'](members[_0x2f11da['device']])){members[_0x2f11da[_0x5c7a('0x18')]][_0x5c7a('0x1d')]=utils[_0x5c7a('0x1a')]();members[_0x2f11da[_0x5c7a('0x18')]]['duration']=utils[_0x5c7a('0x1e')](members[_0x2f11da[_0x5c7a('0x18')]][_0x5c7a('0x1d')],members[_0x2f11da[_0x5c7a('0x18')]]['enterAt']);if(members[_0x2f11da[_0x5c7a('0x18')]][_0x5c7a('0x7')]){writeDB(members[_0x2f11da[_0x5c7a('0x18')]]);}}default:break;}};exports[_0x5c7a('0x1f')]=function(_0x23d20e){if(!_[_0x5c7a('0x20')](members[_0x23d20e['interface']])){members[_0x23d20e['interface']]=_[_0x5c7a('0x21')](members[_0x23d20e[_0x5c7a('0x8')]],{'data4':_0x23d20e['queue'],'uniqueid':_0x23d20e[_0x5c7a('0x7')]});}};exports[_0x5c7a('0x22')]=function(_0x1de165){if(_0x1de165[_0x5c7a('0x9')]){var _0x4029d6=_0x1de165[_0x5c7a('0x9')]['split']('-')[0x0];if(!_['isNil'](members[_0x4029d6])){members[_0x4029d6]=_[_0x5c7a('0x21')](members[_0x4029d6],{'data1':members[_0x4029d6][_0x5c7a('0x23')]||_0x1de165['type'],'data2':members[_0x4029d6][_0x5c7a('0x24')]||_0x1de165[_0x5c7a('0x25')],'data3':members[_0x4029d6]['data3']||_0x1de165[_0x5c7a('0x26')],'uniqueid':members[_0x4029d6][_0x5c7a('0x7')]||_0x1de165[_0x5c7a('0x7')]});if(members[_0x4029d6][_0x5c7a('0x1d')]){writeDB(members[_0x4029d6]);}}}if(_0x1de165['destinationchannel']){var _0x429be5=_0x1de165[_0x5c7a('0x27')]['split']('-')[0x0];if(!_[_0x5c7a('0x20')](members[_0x429be5])){members[_0x429be5]=_[_0x5c7a('0x21')](members[_0x429be5],{'data1':members[_0x429be5]['data1']||_0x1de165[_0x5c7a('0x28')],'data2':members[_0x429be5][_0x5c7a('0x24')]||_0x1de165[_0x5c7a('0x25')],'data3':members[_0x429be5][_0x5c7a('0x29')]||_0x1de165[_0x5c7a('0x26')],'uniqueid':members[_0x429be5][_0x5c7a('0x7')]||_0x1de165[_0x5c7a('0x7')]});if(members[_0x429be5][_0x5c7a('0x1d')]){writeDB(members[_0x429be5]);}}}}; \ No newline at end of file +var _0x9b97=['now','agent','isNil','exitAt','diffTime','enterAt','queue','cdr','channel','assign','data1','source','data3','destinationchannel','destination','lodash','util','./utils','Local/_attended@transfer','info','format','uniqueid','interface','data2','membername','type','name','internal','request','getUserByName','split','catch','some','startsWith','devicestatechange','state','INUSE','BUSY','device','voice','TALKING'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x9b97,0x180));var _0x79b9=function(_0x552fa0,_0x5294ae){_0x552fa0=_0x552fa0-0x0;var _0x244071=_0x9b97[_0x552fa0];return _0x244071;};'use strict';var _=require(_0x79b9('0x0'));var util=require(_0x79b9('0x1'));var utils=require(_0x79b9('0x2'));var members={};var exclude=[_0x79b9('0x3'),'Queue:'];function writeDB(_0x1cd924){utils[_0x79b9('0x4')](util[_0x79b9('0x5')]('MEMBER|%s|%s|%s|%s|%s|%s',_0x1cd924[_0x79b9('0x6')],_0x1cd924[_0x79b9('0x7')],_0x1cd924['channel'],_0x1cd924[_0x79b9('0x8')],_0x1cd924[_0x79b9('0x9')],_0x1cd924[_0x79b9('0xa')]));if(_0x1cd924[_0x79b9('0x7')]){utils['getUserByInterface'](_0x1cd924[_0x79b9('0x7')])['then'](function(_0x9e8035){if(_0x9e8035){_0x1cd924['membername']=_0x9e8035[_0x79b9('0xb')];_0x1cd924[_0x79b9('0xc')]=_0x9e8035['internal'];utils[_0x79b9('0xd')]('CreateMemberReport',_0x1cd924);}else{utils[_0x79b9('0xe')](_0x1cd924[_0x79b9('0x7')][_0x79b9('0xf')]('/')[0x1])['then'](function(_0xc9445a){if(_0xc9445a){_0x1cd924[_0x79b9('0x9')]=_0xc9445a['name'];_0x1cd924[_0x79b9('0xc')]=_0xc9445a[_0x79b9('0xc')];utils[_0x79b9('0xd')]('CreateMemberReport',_0x1cd924);}});}})[_0x79b9('0x10')](function(_0x4ba932){utils['error'](_0x4ba932);});}delete members[_0x1cd924[_0x79b9('0x7')]];}function startsWith(_0x4ebd56,_0x2b28ed){return _[_0x79b9('0x11')](_0x4ebd56,function(_0x2c694e){return _[_0x79b9('0x12')](_0x2b28ed,_0x2c694e);});}exports[_0x79b9('0x13')]=function(_0xf9d0eb){switch(_0xf9d0eb[_0x79b9('0x14')]){case _0x79b9('0x15'):case _0x79b9('0x16'):if(!startsWith(exclude,_0xf9d0eb[_0x79b9('0x17')])){members[_0xf9d0eb[_0x79b9('0x17')]]={'channel':_0x79b9('0x18'),'interface':_0xf9d0eb[_0x79b9('0x17')],'type':_0x79b9('0x19'),'enterAt':utils[_0x79b9('0x1a')](),'role':_0x79b9('0x1b')};}break;case'NOT_INUSE':if(!_[_0x79b9('0x1c')](members[_0xf9d0eb['device']])){members[_0xf9d0eb[_0x79b9('0x17')]][_0x79b9('0x1d')]=utils[_0x79b9('0x1a')]();members[_0xf9d0eb[_0x79b9('0x17')]]['duration']=utils[_0x79b9('0x1e')](members[_0xf9d0eb[_0x79b9('0x17')]][_0x79b9('0x1d')],members[_0xf9d0eb[_0x79b9('0x17')]][_0x79b9('0x1f')]);if(members[_0xf9d0eb[_0x79b9('0x17')]][_0x79b9('0x6')]){writeDB(members[_0xf9d0eb[_0x79b9('0x17')]]);}}default:break;}};exports['agentcomplete']=function(_0x38d338){if(!_[_0x79b9('0x1c')](members[_0x38d338[_0x79b9('0x7')]])){members[_0x38d338[_0x79b9('0x7')]]=_['assign'](members[_0x38d338['interface']],{'data4':_0x38d338[_0x79b9('0x20')],'uniqueid':_0x38d338[_0x79b9('0x6')]});}};exports[_0x79b9('0x21')]=function(_0xdab6f1){if(_0xdab6f1[_0x79b9('0x22')]){var _0x2299c7=_0xdab6f1['channel'][_0x79b9('0xf')]('-')[0x0];if(!_[_0x79b9('0x1c')](members[_0x2299c7])){members[_0x2299c7]=_[_0x79b9('0x23')](members[_0x2299c7],{'data1':members[_0x2299c7][_0x79b9('0x24')]||_0xdab6f1[_0x79b9('0xa')],'data2':members[_0x2299c7][_0x79b9('0x8')]||_0xdab6f1[_0x79b9('0x25')],'data3':members[_0x2299c7][_0x79b9('0x26')]||_0xdab6f1['destination'],'uniqueid':members[_0x2299c7]['uniqueid']||_0xdab6f1['uniqueid']});if(members[_0x2299c7][_0x79b9('0x1d')]){writeDB(members[_0x2299c7]);}}}if(_0xdab6f1[_0x79b9('0x27')]){var _0x362ec6=_0xdab6f1[_0x79b9('0x27')]['split']('-')[0x0];if(!_[_0x79b9('0x1c')](members[_0x362ec6])){members[_0x362ec6]=_[_0x79b9('0x23')](members[_0x362ec6],{'data1':members[_0x362ec6][_0x79b9('0x24')]||_0xdab6f1[_0x79b9('0xa')],'data2':members[_0x362ec6][_0x79b9('0x8')]||_0xdab6f1[_0x79b9('0x25')],'data3':members[_0x362ec6][_0x79b9('0x26')]||_0xdab6f1[_0x79b9('0x28')],'uniqueid':members[_0x362ec6][_0x79b9('0x6')]||_0xdab6f1[_0x79b9('0x6')]});if(members[_0x362ec6][_0x79b9('0x1d')]){writeDB(members[_0x362ec6]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 888db49..6d34e48 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 _0xdd88=['accountcode','destaccountcode','agentcomplete','assigned','membername','transfer','TRANSFER','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','transferuniqueid','transfereelinkedid','clone','transfertargetuniqueid','mohtime','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','calleridname','error','stack','musiconholdstartAt','musiconholdstop','lodash','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','position','now','hangup','isNil','queuecallerleaveAt','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','queuecallerenterreason','varset','variable','queuestatus','value','CONTINUE','queuecallerabandon','queuecallerexitAt','toUpperCase','queueposition','queuecallerabandonAt','EXITWITHKEY','ABANDONED','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect'];(function(_0x4ca8d8,_0x3fd860){var _0x1d76e3=function(_0x34da9a){while(--_0x34da9a){_0x4ca8d8['push'](_0x4ca8d8['shift']());}};_0x1d76e3(++_0x3fd860);}(_0xdd88,0x114));var _0x8dd8=function(_0xe6caa3,_0x5df3aa){_0xe6caa3=_0xe6caa3-0x0;var _0x3bf8b5=_0xdd88[_0xe6caa3];return _0x3bf8b5;};'use strict';var _=require(_0x8dd8('0x0'));var util=require('util');var utils=require(_0x8dd8('0x1'));var queues={};function writeDB(_0x257f57){utils[_0x8dd8('0x2')](util[_0x8dd8('0x3')](_0x8dd8('0x4'),_0x257f57[_0x8dd8('0x5')],_0x257f57[_0x8dd8('0x6')],_0x257f57[_0x8dd8('0x7')],_0x257f57[_0x8dd8('0x8')],_0x257f57[_0x8dd8('0x9')],_0x257f57['accountcode'],_0x257f57[_0x8dd8('0xa')]));if(_0x257f57[_0x8dd8('0x7')]){utils[_0x8dd8('0xb')](_0x257f57[_0x8dd8('0x7')])[_0x8dd8('0xc')](function(_0x23ada0){if(_0x23ada0){_0x257f57['type']=_0x23ada0[_0x8dd8('0xd')];}utils[_0x8dd8('0xe')](_0x8dd8('0xf'),_0x257f57);});}else{utils[_0x8dd8('0xe')]('CreateVoiceQueueReport',_0x257f57);}if(_0x257f57[_0x8dd8('0x10')]){delete queues[_0x257f57['transfereduniqueid']];}else{delete queues[_0x257f57[_0x8dd8('0x5')]];}}exports[_0x8dd8('0x11')]=function(_0x220deb){queues[_0x220deb[_0x8dd8('0x5')]]=_[_0x8dd8('0x12')](_0x220deb,{'originalposition':_0x220deb[_0x8dd8('0x13')],'queuecallerjoinAt':utils[_0x8dd8('0x14')](),'mohtime':0x0});};exports[_0x8dd8('0x15')]=function(_0x210d43){if(!_[_0x8dd8('0x16')](queues[_0x210d43[_0x8dd8('0x5')]])){if(queues[_0x210d43[_0x8dd8('0x5')]][_0x8dd8('0x17')]){if(!queues[_0x210d43[_0x8dd8('0x5')]]['queuecallerabandon']&&!queues[_0x210d43[_0x8dd8('0x5')]][_0x8dd8('0x18')]){queues[_0x210d43['uniqueid']][_0x8dd8('0x19')]=!![];queues[_0x210d43[_0x8dd8('0x5')]]['queuecallercompleteAt']=utils[_0x8dd8('0x14')]();queues[_0x210d43[_0x8dd8('0x5')]][_0x8dd8('0xa')]=_0x8dd8('0x1a');}writeDB(queues[_0x210d43[_0x8dd8('0x5')]]);}else{if(queues[_0x210d43[_0x8dd8('0x5')]][_0x8dd8('0x10')]){queues[queues[_0x210d43[_0x8dd8('0x5')]]['transfereduniqueid']]=queues[_0x210d43[_0x8dd8('0x5')]];queues[queues[_0x210d43[_0x8dd8('0x5')]][_0x8dd8('0x10')]][_0x8dd8('0x1b')]=0x2;delete queues[_0x210d43['uniqueid']];}}}};exports[_0x8dd8('0x1c')]=function(_0x46750d){if(!_[_0x8dd8('0x16')](_0x46750d[_0x8dd8('0x1d')][_0x8dd8('0x1e')])&&_0x46750d[_0x8dd8('0x1f')]['toUpperCase']()!==_0x8dd8('0x20')){if(!_[_0x8dd8('0x16')](queues[_0x46750d['uniqueid']])){queues[_0x46750d['uniqueid']][_0x8dd8('0x21')]=![];queues[_0x46750d[_0x8dd8('0x5')]]['queuecallerabandonAt']=null;queues[_0x46750d[_0x8dd8('0x5')]][_0x8dd8('0x18')]=!![];queues[_0x46750d[_0x8dd8('0x5')]][_0x8dd8('0x22')]=utils['now']();queues[_0x46750d[_0x8dd8('0x5')]][_0x8dd8('0xa')]=_0x46750d[_0x8dd8('0x1f')][_0x8dd8('0x23')]();writeDB(queues[_0x46750d[_0x8dd8('0x5')]]);}}else if(!_['isNil'](_0x46750d[_0x8dd8('0x1d')][_0x8dd8('0x24')])){if(!_[_0x8dd8('0x16')](queues[_0x46750d[_0x8dd8('0x5')]])&&!queues[_0x46750d['uniqueid']][_0x8dd8('0x21')]){queues[_0x46750d[_0x8dd8('0x5')]][_0x8dd8('0x21')]=![];queues[_0x46750d[_0x8dd8('0x5')]][_0x8dd8('0x25')]=null;queues[_0x46750d[_0x8dd8('0x5')]]['queuecallerexit']=!![];queues[_0x46750d[_0x8dd8('0x5')]]['queuecallerexitAt']=utils[_0x8dd8('0x14')]();queues[_0x46750d[_0x8dd8('0x5')]][_0x8dd8('0xa')]=_0x8dd8('0x26');}}};exports[_0x8dd8('0x21')]=function(_0x115715){if(!_['isNil'](queues[_0x115715[_0x8dd8('0x5')]])){queues[_0x115715[_0x8dd8('0x5')]][_0x8dd8('0x18')]=![];queues[_0x115715[_0x8dd8('0x5')]][_0x8dd8('0x22')]=null;queues[_0x115715[_0x8dd8('0x5')]][_0x8dd8('0x21')]=!![];queues[_0x115715[_0x8dd8('0x5')]][_0x8dd8('0x25')]=utils[_0x8dd8('0x14')]();queues[_0x115715[_0x8dd8('0x5')]][_0x8dd8('0xa')]=_0x8dd8('0x27');}};exports[_0x8dd8('0x28')]=function(_0xa7106f){if(!_[_0x8dd8('0x16')](queues[_0xa7106f[_0x8dd8('0x5')]])){queues[_0xa7106f[_0x8dd8('0x5')]]['queuecallerleave']=!![];queues[_0xa7106f[_0x8dd8('0x5')]][_0x8dd8('0x17')]=utils[_0x8dd8('0x14')]();queues[_0xa7106f[_0x8dd8('0x5')]][_0x8dd8('0x29')]=utils[_0x8dd8('0x2a')](queues[_0xa7106f[_0x8dd8('0x5')]]['queuecallerleaveAt'],queues[_0xa7106f[_0x8dd8('0x5')]][_0x8dd8('0x2b')]);queues[_0xa7106f[_0x8dd8('0x5')]]['position']=_0xa7106f[_0x8dd8('0x13')];queues[_0xa7106f['uniqueid']][_0x8dd8('0x2c')]=_0xa7106f['count'];queues[_0xa7106f[_0x8dd8('0x5')]][_0x8dd8('0x2d')]=_0xa7106f[_0x8dd8('0x2d')];queues[_0xa7106f[_0x8dd8('0x5')]][_0x8dd8('0x2e')]=_0xa7106f[_0x8dd8('0x2e')];}};exports[_0x8dd8('0x2f')]=function(_0x544a15){if(!_[_0x8dd8('0x16')](queues[_0x544a15[_0x8dd8('0x5')]])){queues[_0x544a15[_0x8dd8('0x5')]][_0x8dd8('0x21')]=![];queues[_0x544a15[_0x8dd8('0x5')]][_0x8dd8('0x21')]=![];queues[_0x544a15['uniqueid']][_0x8dd8('0x25')]=null;queues[_0x544a15['uniqueid']]['queuecallerexit']=![];queues[_0x544a15['uniqueid']][_0x8dd8('0xa')]=null;queues[_0x544a15[_0x8dd8('0x5')]][_0x8dd8('0x22')]=null;queues[_0x544a15[_0x8dd8('0x5')]]['assigned']=!![];queues[_0x544a15[_0x8dd8('0x5')]][_0x8dd8('0x30')]=_0x544a15[_0x8dd8('0x31')];queues[_0x544a15[_0x8dd8('0x5')]][_0x8dd8('0x8')]=_0x544a15['membername'];}};exports[_0x8dd8('0x32')]=function(_0x2f31ac){if(!_['isNil'](queues[_0x2f31ac[_0x8dd8('0x5')]])){if(queues[_0x2f31ac[_0x8dd8('0x5')]]['queuecallerleaveAt']){queues[_0x2f31ac['uniqueid']][_0x8dd8('0x21')]=![];queues[_0x2f31ac['uniqueid']][_0x8dd8('0x21')]=![];queues[_0x2f31ac[_0x8dd8('0x5')]][_0x8dd8('0x25')]=null;queues[_0x2f31ac[_0x8dd8('0x5')]][_0x8dd8('0x18')]=![];queues[_0x2f31ac['uniqueid']]['queuecallerexitAt']=null;queues[_0x2f31ac[_0x8dd8('0x5')]][_0x8dd8('0x33')]=!![];queues[_0x2f31ac[_0x8dd8('0x5')]]['lastAssignedTo']=_0x2f31ac[_0x8dd8('0x34')];queues[_0x2f31ac[_0x8dd8('0x5')]]['queuecallercomplete']=!![];queues[_0x2f31ac[_0x8dd8('0x5')]]['queuecallercompleteAt']=utils[_0x8dd8('0x14')]();if(_0x2f31ac['reason']==_0x8dd8('0x35')){if(!queues[_0x2f31ac[_0x8dd8('0x5')]][_0x8dd8('0x35')]){queues[_0x2f31ac[_0x8dd8('0x5')]][_0x8dd8('0xa')]=_0x8dd8('0x36');}}else{queues[_0x2f31ac[_0x8dd8('0x5')]][_0x8dd8('0xa')]='COMPLETEDBY'+_0x2f31ac['reason'][_0x8dd8('0x23')]();}writeDB(queues[_0x2f31ac[_0x8dd8('0x5')]]);}}};exports[_0x8dd8('0x37')]=function(_0x12b6f9){if(!_['isNil'](queues[_0x12b6f9[_0x8dd8('0x38')]])){queues[_0x12b6f9[_0x8dd8('0x38')]]['transfer']=!![];queues[_0x12b6f9[_0x8dd8('0x38')]][_0x8dd8('0x39')]=_0x8dd8('0x3a');queues[_0x12b6f9[_0x8dd8('0x38')]][_0x8dd8('0x3b')]=_0x12b6f9[_0x8dd8('0x3c')];queues[_0x12b6f9[_0x8dd8('0x38')]]['transferuniqueid']=_0x12b6f9[_0x8dd8('0x38')];queues[_0x12b6f9['transfereeuniqueid']][_0x8dd8('0xa')]=_0x8dd8('0x3d');}};exports['attendedtransfer']=function(_0x544b7c){try{if(_0x544b7c[_0x8dd8('0x3e')]==_0x544b7c[_0x8dd8('0x3f')]){if(!_[_0x8dd8('0x16')](queues[_0x544b7c[_0x8dd8('0x40')]])){queues[_0x544b7c[_0x8dd8('0x40')]][_0x8dd8('0x35')]=!![];queues[_0x544b7c[_0x8dd8('0x40')]][_0x8dd8('0x39')]=_0x8dd8('0x41');queues[_0x544b7c[_0x8dd8('0x40')]][_0x8dd8('0x3b')]=_0x544b7c[_0x8dd8('0x42')];queues[_0x544b7c[_0x8dd8('0x40')]][_0x8dd8('0x43')]=_0x544b7c[_0x8dd8('0x3e')];queues[_0x544b7c[_0x8dd8('0x40')]][_0x8dd8('0xa')]='ATTENDEDTRANSFER';}if(!_[_0x8dd8('0x16')](queues[_0x544b7c[_0x8dd8('0x3f')]])){if(_0x544b7c[_0x8dd8('0x44')]&&queues[_0x544b7c[_0x8dd8('0x44')]]){queues[_0x544b7c[_0x8dd8('0x44')]]['queuecallerenterreason']=0x1;queues[_0x544b7c[_0x8dd8('0x38')]]=_[_0x8dd8('0x45')](queues[_0x544b7c[_0x8dd8('0x44')]]);queues[_0x544b7c[_0x8dd8('0x38')]][_0x8dd8('0x10')]=_0x544b7c[_0x8dd8('0x46')];queues[_0x544b7c[_0x8dd8('0x38')]]['queuecallerenterreason']=0x2;queues[_0x544b7c['transfereeuniqueid']][_0x8dd8('0x9')]=queues[_0x544b7c['secondtransfererlinkedid']][_0x8dd8('0x9')];queues[_0x544b7c[_0x8dd8('0x38')]]['calleridname']=queues[_0x544b7c[_0x8dd8('0x40')]]['calleridname'];queues[_0x544b7c[_0x8dd8('0x38')]][_0x8dd8('0x2b')]=utils['now']();queues[_0x544b7c[_0x8dd8('0x38')]]['queuecallerleaveAt']=utils[_0x8dd8('0x14')]();queues[_0x544b7c[_0x8dd8('0x38')]][_0x8dd8('0x29')]=0x0;queues[_0x544b7c[_0x8dd8('0x38')]][_0x8dd8('0x47')]=0x0;}else{queues[_0x544b7c[_0x8dd8('0x3f')]][_0x8dd8('0x10')]=_0x544b7c[_0x8dd8('0x40')];}}}else if(_0x544b7c[_0x8dd8('0x48')]==_0x544b7c['secondtransfererlinkedid']){if(!_[_0x8dd8('0x16')](queues[_0x544b7c[_0x8dd8('0x3f')]])){queues[_0x544b7c['origtransfererlinkedid']]['transfer']=!![];queues[_0x544b7c['origtransfererlinkedid']][_0x8dd8('0x39')]=_0x8dd8('0x41');queues[_0x544b7c[_0x8dd8('0x3f')]]['transferexten']=_0x544b7c[_0x8dd8('0x49')];queues[_0x544b7c[_0x8dd8('0x3f')]][_0x8dd8('0x43')]=_0x544b7c[_0x8dd8('0x48')];queues[_0x544b7c[_0x8dd8('0x3f')]][_0x8dd8('0xa')]=_0x8dd8('0x4a');}if(!_[_0x8dd8('0x16')](queues[_0x544b7c[_0x8dd8('0x40')]])){if(_0x544b7c[_0x8dd8('0x4b')]&&queues[_0x544b7c['transfertargetlinkedid']]){queues[_0x544b7c['transfertargetlinkedid']][_0x8dd8('0x1b')]=0x1;queues[_0x544b7c[_0x8dd8('0x46')]]=_[_0x8dd8('0x45')](queues[_0x544b7c['transfertargetlinkedid']]);queues[_0x544b7c[_0x8dd8('0x46')]][_0x8dd8('0x10')]=_0x544b7c[_0x8dd8('0x46')];queues[_0x544b7c[_0x8dd8('0x46')]][_0x8dd8('0x1b')]=0x2;queues[_0x544b7c['transfertargetuniqueid']][_0x8dd8('0x9')]=queues[_0x544b7c[_0x8dd8('0x3f')]][_0x8dd8('0x9')];queues[_0x544b7c['transfertargetuniqueid']]['calleridname']=queues[_0x544b7c['origtransfererlinkedid']][_0x8dd8('0x4c')];queues[_0x544b7c[_0x8dd8('0x46')]][_0x8dd8('0x2b')]=utils['now']();queues[_0x544b7c[_0x8dd8('0x46')]]['queuecallerleaveAt']=utils['now']();queues[_0x544b7c[_0x8dd8('0x46')]][_0x8dd8('0x29')]=0x0;queues[_0x544b7c[_0x8dd8('0x46')]][_0x8dd8('0x47')]=0x0;}else{queues[_0x544b7c[_0x8dd8('0x40')]][_0x8dd8('0x10')]=_0x544b7c[_0x8dd8('0x3f')];}}}}catch(_0x2758f3){utils[_0x8dd8('0x4d')](_0x2758f3[_0x8dd8('0x4e')]);}};exports['musiconholdstart']=function(_0x1366e8){if(!_[_0x8dd8('0x16')](queues[_0x1366e8[_0x8dd8('0x5')]])){queues[_0x1366e8['uniqueid']][_0x8dd8('0x4f')]=utils[_0x8dd8('0x14')]();}};exports[_0x8dd8('0x50')]=function(_0x321c7f){if(!_[_0x8dd8('0x16')](queues[_0x321c7f[_0x8dd8('0x5')]])){if(!_[_0x8dd8('0x16')](queues[_0x321c7f['uniqueid']][_0x8dd8('0x4f')])){queues[_0x321c7f['uniqueid']][_0x8dd8('0x47')]+=utils[_0x8dd8('0x2a')](utils['now'](),queues[_0x321c7f[_0x8dd8('0x5')]][_0x8dd8('0x4f')]);delete queues[_0x321c7f[_0x8dd8('0x5')]][_0x8dd8('0x4f')];}}}; \ No newline at end of file +var _0x5887=['secondtransfererexten','transfertargetlinkedid','mohtime','error','musiconholdstart','musiconholdstop','musiconholdstartAt','util','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','queuecallerjoin','assign','position','now','hangup','isNil','queuecallerabandon','queuecallercompleteAt','COMPLETEDBYAGENT','transfereduniqueid','queuecallerenterreason','varset','queuestatus','value','CONTINUE','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','toUpperCase','queueposition','ABANDONED','queuecallerleave','diffTime','queuecallerleaveAt','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','assigned','destaccountcode','lastAssignedTo','membername','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','origtransfereruniqueid','secondtransfererlinkedid','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','holdtime','origtransfererlinkedid','secondtransfereruniqueid'];(function(_0x5079f0,_0x2e0ae4){var _0x182bce=function(_0xa6f581){while(--_0xa6f581){_0x5079f0['push'](_0x5079f0['shift']());}};_0x182bce(++_0x2e0ae4);}(_0x5887,0xf4));var _0x7588=function(_0x1d7b23,_0x75416d){_0x1d7b23=_0x1d7b23-0x0;var _0x50fd26=_0x5887[_0x1d7b23];return _0x50fd26;};'use strict';var _=require('lodash');var util=require(_0x7588('0x0'));var utils=require('./utils');var queues={};function writeDB(_0x55952a){utils[_0x7588('0x1')](util[_0x7588('0x2')](_0x7588('0x3'),_0x55952a[_0x7588('0x4')],_0x55952a[_0x7588('0x5')],_0x55952a[_0x7588('0x6')],_0x55952a['lastAssignedTo'],_0x55952a[_0x7588('0x7')],_0x55952a[_0x7588('0x8')],_0x55952a[_0x7588('0x9')]));if(_0x55952a[_0x7588('0x6')]){utils[_0x7588('0xa')](_0x55952a[_0x7588('0x6')])[_0x7588('0xb')](function(_0x2aa8ae){if(_0x2aa8ae){_0x55952a['type']=_0x2aa8ae[_0x7588('0xc')];}utils[_0x7588('0xd')](_0x7588('0xe'),_0x55952a);});}else{utils[_0x7588('0xd')](_0x7588('0xe'),_0x55952a);}if(_0x55952a['transfereduniqueid']){delete queues[_0x55952a['transfereduniqueid']];}else{delete queues[_0x55952a['uniqueid']];}}exports[_0x7588('0xf')]=function(_0x337cd4){queues[_0x337cd4[_0x7588('0x4')]]=_[_0x7588('0x10')](_0x337cd4,{'originalposition':_0x337cd4[_0x7588('0x11')],'queuecallerjoinAt':utils[_0x7588('0x12')](),'mohtime':0x0});};exports[_0x7588('0x13')]=function(_0x327a2d){if(!_[_0x7588('0x14')](queues[_0x327a2d[_0x7588('0x4')]])){if(queues[_0x327a2d['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x327a2d['uniqueid']][_0x7588('0x15')]&&!queues[_0x327a2d[_0x7588('0x4')]]['queuecallerexit']){queues[_0x327a2d['uniqueid']]['queuecallercomplete']=!![];queues[_0x327a2d[_0x7588('0x4')]][_0x7588('0x16')]=utils['now']();queues[_0x327a2d[_0x7588('0x4')]][_0x7588('0x9')]=_0x7588('0x17');}writeDB(queues[_0x327a2d[_0x7588('0x4')]]);}else{if(queues[_0x327a2d[_0x7588('0x4')]][_0x7588('0x18')]){queues[queues[_0x327a2d[_0x7588('0x4')]][_0x7588('0x18')]]=queues[_0x327a2d['uniqueid']];queues[queues[_0x327a2d[_0x7588('0x4')]][_0x7588('0x18')]][_0x7588('0x19')]=0x2;delete queues[_0x327a2d['uniqueid']];}}}};exports[_0x7588('0x1a')]=function(_0x42f96a){if(!_[_0x7588('0x14')](_0x42f96a['variable'][_0x7588('0x1b')])&&_0x42f96a[_0x7588('0x1c')]['toUpperCase']()!==_0x7588('0x1d')){if(!_['isNil'](queues[_0x42f96a[_0x7588('0x4')]])){queues[_0x42f96a[_0x7588('0x4')]][_0x7588('0x15')]=![];queues[_0x42f96a[_0x7588('0x4')]][_0x7588('0x1e')]=null;queues[_0x42f96a[_0x7588('0x4')]][_0x7588('0x1f')]=!![];queues[_0x42f96a['uniqueid']][_0x7588('0x20')]=utils['now']();queues[_0x42f96a[_0x7588('0x4')]]['queuecallerexitreason']=_0x42f96a['value'][_0x7588('0x21')]();writeDB(queues[_0x42f96a[_0x7588('0x4')]]);}}else if(!_[_0x7588('0x14')](_0x42f96a['variable'][_0x7588('0x22')])){if(!_[_0x7588('0x14')](queues[_0x42f96a['uniqueid']])&&!queues[_0x42f96a[_0x7588('0x4')]][_0x7588('0x15')]){queues[_0x42f96a['uniqueid']][_0x7588('0x15')]=![];queues[_0x42f96a[_0x7588('0x4')]]['queuecallerabandonAt']=null;queues[_0x42f96a['uniqueid']]['queuecallerexit']=!![];queues[_0x42f96a[_0x7588('0x4')]][_0x7588('0x20')]=utils['now']();queues[_0x42f96a[_0x7588('0x4')]][_0x7588('0x9')]='EXITWITHKEY';}}};exports[_0x7588('0x15')]=function(_0x4e3b86){if(!_[_0x7588('0x14')](queues[_0x4e3b86['uniqueid']])){queues[_0x4e3b86[_0x7588('0x4')]][_0x7588('0x1f')]=![];queues[_0x4e3b86[_0x7588('0x4')]][_0x7588('0x20')]=null;queues[_0x4e3b86[_0x7588('0x4')]][_0x7588('0x15')]=!![];queues[_0x4e3b86[_0x7588('0x4')]][_0x7588('0x1e')]=utils['now']();queues[_0x4e3b86['uniqueid']][_0x7588('0x9')]=_0x7588('0x23');}};exports['queuecallerleave']=function(_0x2feebe){if(!_[_0x7588('0x14')](queues[_0x2feebe[_0x7588('0x4')]])){queues[_0x2feebe[_0x7588('0x4')]][_0x7588('0x24')]=!![];queues[_0x2feebe[_0x7588('0x4')]]['queuecallerleaveAt']=utils[_0x7588('0x12')]();queues[_0x2feebe[_0x7588('0x4')]]['holdtime']=utils[_0x7588('0x25')](queues[_0x2feebe['uniqueid']][_0x7588('0x26')],queues[_0x2feebe[_0x7588('0x4')]][_0x7588('0x27')]);queues[_0x2feebe['uniqueid']][_0x7588('0x11')]=_0x2feebe[_0x7588('0x11')];queues[_0x2feebe['uniqueid']][_0x7588('0x28')]=_0x2feebe[_0x7588('0x28')];queues[_0x2feebe['uniqueid']][_0x7588('0x29')]=_0x2feebe[_0x7588('0x29')];queues[_0x2feebe[_0x7588('0x4')]][_0x7588('0x2a')]=_0x2feebe[_0x7588('0x2a')];}};exports[_0x7588('0x2b')]=function(_0x46b7be){if(!_[_0x7588('0x14')](queues[_0x46b7be[_0x7588('0x4')]])){queues[_0x46b7be['uniqueid']][_0x7588('0x15')]=![];queues[_0x46b7be[_0x7588('0x4')]]['queuecallerabandon']=![];queues[_0x46b7be[_0x7588('0x4')]][_0x7588('0x1e')]=null;queues[_0x46b7be[_0x7588('0x4')]][_0x7588('0x1f')]=![];queues[_0x46b7be['uniqueid']][_0x7588('0x9')]=null;queues[_0x46b7be[_0x7588('0x4')]]['queuecallerexitAt']=null;queues[_0x46b7be['uniqueid']][_0x7588('0x2c')]=!![];queues[_0x46b7be['uniqueid']][_0x7588('0x8')]=_0x46b7be[_0x7588('0x2d')];queues[_0x46b7be[_0x7588('0x4')]][_0x7588('0x2e')]=_0x46b7be[_0x7588('0x2f')];}};exports[_0x7588('0x30')]=function(_0x4c4ef4){if(!_[_0x7588('0x14')](queues[_0x4c4ef4['uniqueid']])){if(queues[_0x4c4ef4[_0x7588('0x4')]][_0x7588('0x26')]){queues[_0x4c4ef4[_0x7588('0x4')]]['queuecallerabandon']=![];queues[_0x4c4ef4[_0x7588('0x4')]][_0x7588('0x15')]=![];queues[_0x4c4ef4['uniqueid']][_0x7588('0x1e')]=null;queues[_0x4c4ef4[_0x7588('0x4')]]['queuecallerexit']=![];queues[_0x4c4ef4[_0x7588('0x4')]]['queuecallerexitAt']=null;queues[_0x4c4ef4[_0x7588('0x4')]][_0x7588('0x2c')]=!![];queues[_0x4c4ef4[_0x7588('0x4')]]['lastAssignedTo']=_0x4c4ef4['membername'];queues[_0x4c4ef4['uniqueid']]['queuecallercomplete']=!![];queues[_0x4c4ef4[_0x7588('0x4')]][_0x7588('0x16')]=utils[_0x7588('0x12')]();if(_0x4c4ef4[_0x7588('0x31')]==_0x7588('0x32')){if(!queues[_0x4c4ef4[_0x7588('0x4')]][_0x7588('0x32')]){queues[_0x4c4ef4[_0x7588('0x4')]][_0x7588('0x9')]=_0x7588('0x33');}}else{queues[_0x4c4ef4[_0x7588('0x4')]][_0x7588('0x9')]=_0x7588('0x34')+_0x4c4ef4[_0x7588('0x31')][_0x7588('0x21')]();}writeDB(queues[_0x4c4ef4['uniqueid']]);}}};exports[_0x7588('0x35')]=function(_0x32df1c){if(!_[_0x7588('0x14')](queues[_0x32df1c[_0x7588('0x36')]])){queues[_0x32df1c[_0x7588('0x36')]]['transfer']=!![];queues[_0x32df1c[_0x7588('0x36')]][_0x7588('0x37')]=_0x7588('0x38');queues[_0x32df1c[_0x7588('0x36')]][_0x7588('0x39')]=_0x32df1c[_0x7588('0x3a')];queues[_0x32df1c[_0x7588('0x36')]][_0x7588('0x3b')]=_0x32df1c[_0x7588('0x36')];queues[_0x32df1c[_0x7588('0x36')]]['queuecallerexitreason']=_0x7588('0x3c');}};exports['attendedtransfer']=function(_0x513790){try{if(_0x513790[_0x7588('0x3d')]==_0x513790['origtransfererlinkedid']){if(!_[_0x7588('0x14')](queues[_0x513790[_0x7588('0x3e')]])){queues[_0x513790[_0x7588('0x3e')]][_0x7588('0x32')]=!![];queues[_0x513790[_0x7588('0x3e')]][_0x7588('0x37')]=_0x7588('0x3f');queues[_0x513790[_0x7588('0x3e')]]['transferexten']=_0x513790['origtransfererexten'];queues[_0x513790[_0x7588('0x3e')]][_0x7588('0x3b')]=_0x513790['origtransfereruniqueid'];queues[_0x513790['secondtransfererlinkedid']][_0x7588('0x9')]=_0x7588('0x40');}if(!_[_0x7588('0x14')](queues[_0x513790['origtransfererlinkedid']])){if(_0x513790[_0x7588('0x41')]&&queues[_0x513790[_0x7588('0x41')]]){queues[_0x513790['transfereelinkedid']][_0x7588('0x19')]=0x1;queues[_0x513790[_0x7588('0x36')]]=_[_0x7588('0x42')](queues[_0x513790[_0x7588('0x41')]]);queues[_0x513790[_0x7588('0x36')]]['transfereduniqueid']=_0x513790[_0x7588('0x43')];queues[_0x513790[_0x7588('0x36')]][_0x7588('0x19')]=0x2;queues[_0x513790[_0x7588('0x36')]][_0x7588('0x7')]=queues[_0x513790[_0x7588('0x3e')]][_0x7588('0x7')];queues[_0x513790[_0x7588('0x36')]]['calleridname']=queues[_0x513790[_0x7588('0x3e')]][_0x7588('0x44')];queues[_0x513790[_0x7588('0x36')]][_0x7588('0x27')]=utils[_0x7588('0x12')]();queues[_0x513790['transfereeuniqueid']][_0x7588('0x26')]=utils[_0x7588('0x12')]();queues[_0x513790[_0x7588('0x36')]][_0x7588('0x45')]=0x0;queues[_0x513790[_0x7588('0x36')]]['mohtime']=0x0;}else{queues[_0x513790[_0x7588('0x46')]][_0x7588('0x18')]=_0x513790[_0x7588('0x3e')];}}}else if(_0x513790[_0x7588('0x47')]==_0x513790['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x513790[_0x7588('0x46')]])){queues[_0x513790[_0x7588('0x46')]][_0x7588('0x32')]=!![];queues[_0x513790[_0x7588('0x46')]]['transfertype']='ATTENDED';queues[_0x513790[_0x7588('0x46')]][_0x7588('0x39')]=_0x513790[_0x7588('0x48')];queues[_0x513790[_0x7588('0x46')]][_0x7588('0x3b')]=_0x513790[_0x7588('0x47')];queues[_0x513790[_0x7588('0x46')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x7588('0x14')](queues[_0x513790[_0x7588('0x3e')]])){if(_0x513790[_0x7588('0x49')]&&queues[_0x513790[_0x7588('0x49')]]){queues[_0x513790[_0x7588('0x49')]]['queuecallerenterreason']=0x1;queues[_0x513790['transfertargetuniqueid']]=_['clone'](queues[_0x513790[_0x7588('0x49')]]);queues[_0x513790[_0x7588('0x43')]][_0x7588('0x18')]=_0x513790['transfertargetuniqueid'];queues[_0x513790[_0x7588('0x43')]][_0x7588('0x19')]=0x2;queues[_0x513790[_0x7588('0x43')]][_0x7588('0x7')]=queues[_0x513790[_0x7588('0x46')]][_0x7588('0x7')];queues[_0x513790['transfertargetuniqueid']][_0x7588('0x44')]=queues[_0x513790[_0x7588('0x46')]][_0x7588('0x44')];queues[_0x513790[_0x7588('0x43')]][_0x7588('0x27')]=utils[_0x7588('0x12')]();queues[_0x513790[_0x7588('0x43')]]['queuecallerleaveAt']=utils[_0x7588('0x12')]();queues[_0x513790[_0x7588('0x43')]]['holdtime']=0x0;queues[_0x513790[_0x7588('0x43')]][_0x7588('0x4a')]=0x0;}else{queues[_0x513790[_0x7588('0x3e')]][_0x7588('0x18')]=_0x513790[_0x7588('0x46')];}}}}catch(_0x10efd2){utils[_0x7588('0x4b')](_0x10efd2['stack']);}};exports[_0x7588('0x4c')]=function(_0x7716bc){if(!_[_0x7588('0x14')](queues[_0x7716bc[_0x7588('0x4')]])){queues[_0x7716bc[_0x7588('0x4')]]['musiconholdstartAt']=utils[_0x7588('0x12')]();}};exports[_0x7588('0x4d')]=function(_0x20622b){if(!_[_0x7588('0x14')](queues[_0x20622b[_0x7588('0x4')]])){if(!_[_0x7588('0x14')](queues[_0x20622b[_0x7588('0x4')]]['musiconholdstartAt'])){queues[_0x20622b[_0x7588('0x4')]][_0x7588('0x4a')]+=utils['diffTime'](utils[_0x7588('0x12')](),queues[_0x20622b[_0x7588('0x4')]][_0x7588('0x4e')]);delete queues[_0x20622b[_0x7588('0x4')]][_0x7588('0x4e')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index c9e9f71..6153107 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 _0x9c44=['getUserByInternal','then','name','request','CreateVoiceRecording','newchannel','uniqueid','linkedid','context','channel','error','stack','isNil','transfer','variable','endsWith','value','replace','.wav49','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','queuecallerjoin','queue','debug','accountcode'];(function(_0x25ecf7,_0xba75cf){var _0x411346=function(_0x5eb67a){while(--_0x5eb67a){_0x25ecf7['push'](_0x25ecf7['shift']());}};_0x411346(++_0xba75cf);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var utils=require('./utils');var recordings={};function writeDB(_0x1ffbbf){utils[_0x49c4('0x0')](_0x1ffbbf);if(_0x1ffbbf[_0x49c4('0x1')]){utils[_0x49c4('0x2')](_0x1ffbbf[_0x49c4('0x1')])[_0x49c4('0x3')](function(_0x4e0313){if(_0x4e0313){_0x1ffbbf['membername']=_0x4e0313[_0x49c4('0x4')];_0x1ffbbf['UserId']=_0x4e0313['id'];}utils[_0x49c4('0x5')](_0x49c4('0x6'),_0x1ffbbf);});}else{utils[_0x49c4('0x5')](_0x49c4('0x6'),_0x1ffbbf);}}exports[_0x49c4('0x7')]=function(_0x511d53){try{if(_0x511d53[_0x49c4('0x8')]==_0x511d53[_0x49c4('0x9')]){recordings[_0x511d53[_0x49c4('0x8')]]={'uniqueid':_0x511d53[_0x49c4('0x8')],'accountcode':_0x511d53['accountcode'],'exten':_0x511d53['exten'],'context':_0x511d53[_0x49c4('0xa')],'channel':_0x511d53[_0x49c4('0xb')],'monitors':[]};}}catch(_0x58cad7){utils[_0x49c4('0xc')](_0x58cad7[_0x49c4('0xd')]);}};exports['newstate']=function(_0x536d42){try{if(!_[_0x49c4('0xe')](recordings[_0x536d42[_0x49c4('0x8')]])&&_0x536d42['channelstate']==0x6){}else if(!_[_0x49c4('0xe')](recordings[_0x536d42[_0x49c4('0x9')]])&&_0x536d42['channelstate']==0x6&&_0x536d42[_0x49c4('0xa')]!=_0x49c4('0xf')){recordings[_0x536d42[_0x49c4('0x9')]][_0x49c4('0x1')]=_0x536d42[_0x49c4('0x1')];}}catch(_0x18211c){utils[_0x49c4('0xc')](_0x18211c[_0x49c4('0xd')]);}};exports['varset']=function(_0x3acd06){try{if(!_[_0x49c4('0xe')](_0x3acd06[_0x49c4('0x10')])&&!_[_0x49c4('0xe')](_0x3acd06[_0x49c4('0x10')]['mixmonitor_filename'])){if(_[_0x49c4('0x11')](_0x3acd06[_0x49c4('0x12')],'.wav49')){_0x3acd06['value']=_0x3acd06[_0x49c4('0x12')][_0x49c4('0x13')](_0x49c4('0x14'),'.WAV');}if(recordings[_0x3acd06[_0x49c4('0x9')]]){var _0x50b151=_[_0x49c4('0x15')](recordings[_0x3acd06[_0x49c4('0x9')]][_0x49c4('0x16')],{'value':_0x3acd06[_0x49c4('0x12')]});if(_[_0x49c4('0xe')](_0x50b151)){recordings[_0x3acd06[_0x49c4('0x9')]][_0x49c4('0x16')][_0x49c4('0x17')]({'value':_0x3acd06[_0x49c4('0x12')]});}}}}catch(_0x578447){utils['error'](_0x578447['stack']);}};exports[_0x49c4('0x18')]=function(_0x4f0b62){try{if(!_['isNil'](recordings[_0x4f0b62[_0x49c4('0x8')]])){recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x19')]=_0x4f0b62[_0x49c4('0x19')];recordings[_0x4f0b62['uniqueid']]['calleridname']=_0x4f0b62[_0x49c4('0x1a')];recordings[_0x4f0b62[_0x49c4('0x8')]]['connectedlinenum']=_0x4f0b62[_0x49c4('0x1b')];recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x1c')]=_0x4f0b62[_0x49c4('0x1c')];if(recordings[_0x4f0b62['uniqueid']]['type']==_0x49c4('0x1d')&&recordings[_0x4f0b62['uniqueid']][_0x49c4('0x1')]){recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x1b')]=recordings[_0x4f0b62[_0x49c4('0x8')]]['accountcode'];recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x1c')]='';}recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x16')][_0x49c4('0x1e')](_0x29f835=>{var _0x26ba17=_[_0x49c4('0x1f')](recordings[_0x4f0b62[_0x49c4('0x8')]]);_0x26ba17[_0x49c4('0x12')]=_0x29f835[_0x49c4('0x12')];writeDB(_0x26ba17);});delete recordings[_0x4f0b62['uniqueid']];}}catch(_0x4f4495){utils['error'](_0x4f4495[_0x49c4('0xd')]);}};exports[_0x49c4('0x20')]=function(_0x1eb035){try{if(!_[_0x49c4('0xe')](recordings[_0x1eb035[_0x49c4('0x8')]])){if(_0x1eb035['application'][_0x49c4('0x21')]()==_0x49c4('0x22')&&_[_0x49c4('0x23')](_0x1eb035[_0x49c4('0x24')]['toLowerCase'](),'cdr')){var _0xce57ef=_0x1eb035[_0x49c4('0x24')][_0x49c4('0x25')]('=');var _0x13b3b4=_0xce57ef[0x0][_0x49c4('0x26')](_0xce57ef[0x0]['lastIndexOf']('(')+0x1,_0xce57ef[0x0][_0x49c4('0x27')](')'));var _0x84c621=_0xce57ef[0x1];recordings[_0x1eb035[_0x49c4('0x8')]][_0x13b3b4]=_0x84c621;}}}catch(_0x512d02){utils['error'](_0x512d02[_0x49c4('0xd')]);}};exports[_0x49c4('0x28')]=function(_0x3bec0a){try{if(!_[_0x49c4('0xe')](recordings[_0x3bec0a[_0x49c4('0x8')]])){recordings[_0x3bec0a[_0x49c4('0x8')]][_0x49c4('0x29')]=_0x3bec0a[_0x49c4('0x29')];}}catch(_0x3209cd){utils['error'](_0x3209cd[_0x49c4('0xd')]);}}; \ No newline at end of file +var _0x34e8=['membername','name','UserId','CreateVoiceRecording','newchannel','uniqueid','linkedid','exten','context','channel','error','stack','newstate','isNil','channelstate','transfer','variable','mixmonitor_filename','value','.wav49','replace','.WAV','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','debug','getUserByInternal','accountcode','then'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x34e8,0x12c));var _0x834e=function(_0x42a00b,_0x4c1295){_0x42a00b=_0x42a00b-0x0;var _0x58a5e1=_0x34e8[_0x42a00b];return _0x58a5e1;};'use strict';var _=require(_0x834e('0x0'));var utils=require(_0x834e('0x1'));var recordings={};function writeDB(_0x8b339){utils[_0x834e('0x2')](_0x8b339);if(_0x8b339['accountcode']){utils[_0x834e('0x3')](_0x8b339[_0x834e('0x4')])[_0x834e('0x5')](function(_0x31bf20){if(_0x31bf20){_0x8b339[_0x834e('0x6')]=_0x31bf20[_0x834e('0x7')];_0x8b339[_0x834e('0x8')]=_0x31bf20['id'];}utils['request'](_0x834e('0x9'),_0x8b339);});}else{utils['request'](_0x834e('0x9'),_0x8b339);}}exports[_0x834e('0xa')]=function(_0x3a3ef6){try{if(_0x3a3ef6[_0x834e('0xb')]==_0x3a3ef6[_0x834e('0xc')]){recordings[_0x3a3ef6[_0x834e('0xb')]]={'uniqueid':_0x3a3ef6[_0x834e('0xb')],'accountcode':_0x3a3ef6[_0x834e('0x4')],'exten':_0x3a3ef6[_0x834e('0xd')],'context':_0x3a3ef6[_0x834e('0xe')],'channel':_0x3a3ef6[_0x834e('0xf')],'monitors':[]};}}catch(_0x36e124){utils[_0x834e('0x10')](_0x36e124[_0x834e('0x11')]);}};exports[_0x834e('0x12')]=function(_0x1e00de){try{if(!_[_0x834e('0x13')](recordings[_0x1e00de['uniqueid']])&&_0x1e00de[_0x834e('0x14')]==0x6){}else if(!_[_0x834e('0x13')](recordings[_0x1e00de['linkedid']])&&_0x1e00de[_0x834e('0x14')]==0x6&&_0x1e00de[_0x834e('0xe')]!=_0x834e('0x15')){recordings[_0x1e00de[_0x834e('0xc')]]['accountcode']=_0x1e00de[_0x834e('0x4')];}}catch(_0x302cbd){utils['error'](_0x302cbd[_0x834e('0x11')]);}};exports['varset']=function(_0x38a8cd){try{if(!_[_0x834e('0x13')](_0x38a8cd['variable'])&&!_[_0x834e('0x13')](_0x38a8cd[_0x834e('0x16')][_0x834e('0x17')])){if(_['endsWith'](_0x38a8cd[_0x834e('0x18')],_0x834e('0x19'))){_0x38a8cd[_0x834e('0x18')]=_0x38a8cd[_0x834e('0x18')][_0x834e('0x1a')](_0x834e('0x19'),_0x834e('0x1b'));}if(recordings[_0x38a8cd['linkedid']]){var _0x2545b4=_[_0x834e('0x1c')](recordings[_0x38a8cd[_0x834e('0xc')]][_0x834e('0x1d')],{'value':_0x38a8cd['value']});if(_[_0x834e('0x13')](_0x2545b4)){recordings[_0x38a8cd[_0x834e('0xc')]]['monitors'][_0x834e('0x1e')]({'value':_0x38a8cd[_0x834e('0x18')]});}}}}catch(_0x8d406e){utils['error'](_0x8d406e['stack']);}};exports[_0x834e('0x1f')]=function(_0x34563b){try{if(!_['isNil'](recordings[_0x34563b[_0x834e('0xb')]])){recordings[_0x34563b[_0x834e('0xb')]]['calleridnum']=_0x34563b[_0x834e('0x20')];recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x21')]=_0x34563b['calleridname'];recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x22')]=_0x34563b['connectedlinenum'];recordings[_0x34563b['uniqueid']][_0x834e('0x23')]=_0x34563b['connectedlinename'];if(recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x24')]==_0x834e('0x25')&&recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x4')]){recordings[_0x34563b[_0x834e('0xb')]]['connectedlinenum']=recordings[_0x34563b['uniqueid']]['accountcode'];recordings[_0x34563b['uniqueid']][_0x834e('0x23')]='';}recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x1d')]['forEach'](_0xb5bc06=>{var _0x11f1ce=_[_0x834e('0x26')](recordings[_0x34563b[_0x834e('0xb')]]);_0x11f1ce[_0x834e('0x18')]=_0xb5bc06[_0x834e('0x18')];writeDB(_0x11f1ce);});delete recordings[_0x34563b[_0x834e('0xb')]];}}catch(_0xfaf716){utils[_0x834e('0x10')](_0xfaf716['stack']);}};exports[_0x834e('0x27')]=function(_0x5cad11){try{if(!_[_0x834e('0x13')](recordings[_0x5cad11[_0x834e('0xb')]])){if(_0x5cad11[_0x834e('0x28')][_0x834e('0x29')]()==_0x834e('0x2a')&&_[_0x834e('0x2b')](_0x5cad11[_0x834e('0x2c')][_0x834e('0x29')](),_0x834e('0x2d'))){var _0x12b2bc=_0x5cad11['appdata'][_0x834e('0x2e')]('=');var _0x2f408a=_0x12b2bc[0x0][_0x834e('0x2f')](_0x12b2bc[0x0][_0x834e('0x30')]('(')+0x1,_0x12b2bc[0x0]['lastIndexOf'](')'));var _0x3f88ad=_0x12b2bc[0x1];recordings[_0x5cad11[_0x834e('0xb')]][_0x2f408a]=_0x3f88ad;}}}catch(_0x4b12f5){utils['error'](_0x4b12f5['stack']);}};exports[_0x834e('0x31')]=function(_0x41bf4d){try{if(!_[_0x834e('0x13')](recordings[_0x41bf4d[_0x834e('0xb')]])){recordings[_0x41bf4d[_0x834e('0xb')]][_0x834e('0x32')]=_0x41bf4d['queue'];}}catch(_0x2c2d94){utils['error'](_0x2c2d94[_0x834e('0x11')]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 6181876..743adcc 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 _0x6108=['transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','lodash','./utils','info','type','request','blind','stack','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','attended','transfereechannel','transfertargetchannel'];(function(_0x577069,_0xa1a378){var _0x5c22f2=function(_0xbb41f1){while(--_0xbb41f1){_0x577069['push'](_0x577069['shift']());}};_0x5c22f2(++_0xa1a378);}(_0x6108,0xbc));var _0x8610=function(_0xd374b6,_0x1176e1){_0xd374b6=_0xd374b6-0x0;var _0x5a7273=_0x6108[_0xd374b6];return _0x5a7273;};'use strict';var _=require(_0x8610('0x0'));var util=require('util');var utils=require(_0x8610('0x1'));function writeDB(_0x3ba837){utils[_0x8610('0x2')](util['format']('TRANSFER|%s',_0x3ba837[_0x8610('0x3')]));utils[_0x8610('0x4')]('CreateVoiceTransferReport',_0x3ba837);}exports['blindtransfer']=function(_0xad3a5f){try{_0xad3a5f[_0x8610('0x3')]=_0x8610('0x5');writeDB(_0xad3a5f);}catch(_0x26dab3){utils['error'](_0x26dab3[_0x8610('0x6')]);}};exports['attendedtransfer']=function(_0x6ee380){try{_0x6ee380=_[_0x8610('0x7')](_0x6ee380,{'transfererchannel':_0x6ee380[_0x8610('0x8')],'transferercalleridnum':_0x6ee380['origtransferercalleridnum'],'transferercalleridname':_0x6ee380[_0x8610('0x9')],'transfererconnectedlinenum':_0x6ee380[_0x8610('0xa')],'transfererconnectedlinename':_0x6ee380[_0x8610('0xb')],'transfereraccountcode':_0x6ee380[_0x8610('0xc')],'transferercontext':_0x6ee380[_0x8610('0xd')],'transfererexten':_0x6ee380[_0x8610('0xe')],'transfererlinkedid':_0x6ee380['origtransfererlinkedid'],'context':_0x6ee380[_0x8610('0xf')],'extension':_0x6ee380[_0x8610('0x10')],'type':_0x8610('0x11')});if(_['isNil'](_0x6ee380[_0x8610('0x12')])){_0x6ee380=_['assign'](_0x6ee380,{'transfereechannel':_0x6ee380[_0x8610('0x13')],'transfereecalleridnum':_0x6ee380[_0x8610('0x14')],'transfereecalleridname':_0x6ee380[_0x8610('0x15')],'transfereeconnectedlinenum':_0x6ee380[_0x8610('0x16')],'transfereeconnectedlinename':_0x6ee380[_0x8610('0x17')],'transfereeaccountcode':_0x6ee380['transfertargetaccountcode'],'transfereecontext':_0x6ee380['transfertargetcontext'],'transfereeexten':_0x6ee380[_0x8610('0x18')],'transfereelinkedid':_0x6ee380[_0x8610('0x19')]});}writeDB(_0x6ee380);}catch(_0x214015){utils['error'](_0x214015['stack']);}}; \ No newline at end of file +var _0xe3ee=['origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','./utils','TRANSFER|%s','CreateVoiceTransferReport','type','blind','error','stack','attendedtransfer'];(function(_0x25d3cb,_0x201a7d){var _0x53a675=function(_0x10c83b){while(--_0x10c83b){_0x25d3cb['push'](_0x25d3cb['shift']());}};_0x53a675(++_0x201a7d);}(_0xe3ee,0x116));var _0xee3e=function(_0x242266,_0x4a6bb1){_0x242266=_0x242266-0x0;var _0x2f9008=_0xe3ee[_0x242266];return _0x2f9008;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xee3e('0x0'));function writeDB(_0x34a8cd){utils['info'](util['format'](_0xee3e('0x1'),_0x34a8cd['type']));utils['request'](_0xee3e('0x2'),_0x34a8cd);}exports['blindtransfer']=function(_0x114b33){try{_0x114b33[_0xee3e('0x3')]=_0xee3e('0x4');writeDB(_0x114b33);}catch(_0xd893ca){utils[_0xee3e('0x5')](_0xd893ca[_0xee3e('0x6')]);}};exports[_0xee3e('0x7')]=function(_0x17fba1){try{_0x17fba1=_['assign'](_0x17fba1,{'transfererchannel':_0x17fba1[_0xee3e('0x8')],'transferercalleridnum':_0x17fba1[_0xee3e('0x9')],'transferercalleridname':_0x17fba1['origtransferercalleridname'],'transfererconnectedlinenum':_0x17fba1[_0xee3e('0xa')],'transfererconnectedlinename':_0x17fba1[_0xee3e('0xb')],'transfereraccountcode':_0x17fba1['origtransfereraccountcode'],'transferercontext':_0x17fba1[_0xee3e('0xc')],'transfererexten':_0x17fba1[_0xee3e('0xd')],'transfererlinkedid':_0x17fba1[_0xee3e('0xe')],'context':_0x17fba1[_0xee3e('0xf')],'extension':_0x17fba1[_0xee3e('0x10')],'type':_0xee3e('0x11')});if(_[_0xee3e('0x12')](_0x17fba1[_0xee3e('0x13')])){_0x17fba1=_['assign'](_0x17fba1,{'transfereechannel':_0x17fba1['transfertargetchannel'],'transfereecalleridnum':_0x17fba1[_0xee3e('0x14')],'transfereecalleridname':_0x17fba1[_0xee3e('0x15')],'transfereeconnectedlinenum':_0x17fba1['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x17fba1[_0xee3e('0x16')],'transfereeaccountcode':_0x17fba1[_0xee3e('0x17')],'transfereecontext':_0x17fba1[_0xee3e('0x18')],'transfereeexten':_0x17fba1['transfertargetexten'],'transfereelinkedid':_0x17fba1[_0xee3e('0x19')]});}writeDB(_0x17fba1);}catch(_0x4743d3){utils['error'](_0x4743d3['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index ac6c53d..62aa1ca 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 _0x28cb=['subtractTime','subtract','diffTime','sumTime','isAfter','isBefore','moment','bluebird','client','../../config/logger','info','debug','stringify','error','request','then','catch','stack','name','interface','GETUSER|','result','length','NOTFOUND','getUserByInternal','getUserByInterface','getUserByName','GetVoiceQueue','type','acw','acwTimeout','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xe779,_0x1a1b29){var _0x5201de=function(_0x26044f){while(--_0x26044f){_0xe779['push'](_0xe779['shift']());}};_0x5201de(++_0x1a1b29);}(_0x28cb,0x96));var _0xb28c=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x28cb[_0x279d37];return _0x530173;};'use strict';var jayson=require('jayson/promise');var moment=require(_0xb28c('0x0'));var BPromise=require(_0xb28c('0x1'));var client=jayson[_0xb28c('0x2')]['http']({'port':0x2329});var logger=require(_0xb28c('0x3'))('xdr');exports[_0xb28c('0x4')]=function(_0x2db56c){logger[_0xb28c('0x4')](_0x2db56c);};exports[_0xb28c('0x5')]=function(_0x46805d){logger[_0xb28c('0x5')](JSON[_0xb28c('0x6')](_0x46805d));};exports['error']=function(_0x21f810){logger[_0xb28c('0x7')](_0x21f810['stack']);};exports[_0xb28c('0x8')]=function(_0x15c8fd,_0x3ee117){return client[_0xb28c('0x8')](_0x15c8fd,{'body':_0x3ee117})[_0xb28c('0x9')](function(_0x58f8b2){logger[_0xb28c('0x5')](JSON['stringify'](_0x58f8b2));})[_0xb28c('0xa')](function(_0x36d68f){logger['error'](_0x36d68f[_0xb28c('0xb')]);});};function getUser(_0x166e5a){return client[_0xb28c('0x8')]('GetUser',{'options':{'raw':!![],'attributes':['id','internal',_0xb28c('0xc'),_0xb28c('0xd')],'where':_0x166e5a,'limit':0x1}})[_0xb28c('0x9')](function(_0xcb2592){logger[_0xb28c('0x4')](_0xb28c('0xe')+JSON['stringify'](_0x166e5a)+'|'+(_0xcb2592[_0xb28c('0xf')][_0xb28c('0x10')]?'FOUND':_0xb28c('0x11')));return _0xcb2592['result']['length']?_0xcb2592['result'][0x0]:null;});}exports[_0xb28c('0x12')]=function(_0x4fa647){return new BPromise(function(_0x86e7fc,_0xf765a3){if(_0x4fa647){return getUser({'internal':_0x4fa647})[_0xb28c('0x9')](function(_0x4a7baa){return _0x86e7fc(_0x4a7baa);})[_0xb28c('0xa')](function(_0x3eca57){logger[_0xb28c('0x7')](_0x3eca57[_0xb28c('0xb')]);return _0x86e7fc(null);});}else{return _0x86e7fc(null);}});};exports[_0xb28c('0x13')]=function(_0xf7426e){return new BPromise(function(_0x10affd,_0x506f17){if(_0xf7426e){return getUser({'interface':_0xf7426e})[_0xb28c('0x9')](function(_0x34f12c){return _0x10affd(_0x34f12c);})['catch'](function(_0x5f088a){logger[_0xb28c('0x7')](_0x5f088a[_0xb28c('0xb')]);return _0x10affd(null);});}else{return _0x10affd(null);}});};exports[_0xb28c('0x14')]=function(_0x4c39bf){return new BPromise(function(_0x3dad21,_0x488311){if(_0x4c39bf){return getUser({'name':_0x4c39bf})[_0xb28c('0x9')](function(_0x553c54){return _0x3dad21(_0x553c54);})['catch'](function(_0x35b090){logger['error'](_0x35b090[_0xb28c('0xb')]);return _0x3dad21(null);});}else{return _0x3dad21(null);}});};exports['getVoiceQueueByName']=function(_0x42adea){return new BPromise(function(_0x5910ec,_0x315c39){if(_0x42adea){return client[_0xb28c('0x8')](_0xb28c('0x15'),{'options':{'raw':!![],'attributes':['id',_0xb28c('0xc'),_0xb28c('0x16'),_0xb28c('0x17'),_0xb28c('0x18')],'where':{'name':_0x42adea},'limit':0x1}})[_0xb28c('0x9')](function(_0x1e60d5){logger[_0xb28c('0x4')]('GETVOICEQUEUEBYNAME|'+_0x42adea+'|'+(_0x1e60d5[_0xb28c('0xf')][_0xb28c('0x10')]?'FOUND':_0xb28c('0x11')));return _0x5910ec(_0x1e60d5[_0xb28c('0xf')][_0xb28c('0x10')]?_0x1e60d5['result'][0x0]:null);})[_0xb28c('0xa')](function(_0x1b9f49){logger[_0xb28c('0x7')](_0x1b9f49[_0xb28c('0xb')]);return _0x5910ec(null);});}else{return _0x5910ec(null);}});};exports[_0xb28c('0x19')]=function(_0x3cf7e3,_0x5280a7){return moment(_0x3cf7e3)[_0xb28c('0x1a')](_0x5280a7,_0xb28c('0x1b'))[_0xb28c('0x1c')](_0xb28c('0x1d'));};exports[_0xb28c('0x1e')]=function(_0x5ca156,_0x5c61d2){return moment(_0x5ca156)[_0xb28c('0x1f')](_0x5c61d2,'seconds')[_0xb28c('0x1c')](_0xb28c('0x1d'));};exports[_0xb28c('0x20')]=function(_0x37aa88,_0x1c51a8){return moment(_0x37aa88)['diff'](moment(_0x1c51a8),'seconds');};exports[_0xb28c('0x21')]=function(_0x23955a,_0x1f5a83){return parseInt(_0x23955a,0xa)+parseInt(_0x1f5a83,0xa);};exports['now']=function(){return moment()[_0xb28c('0x1c')](_0xb28c('0x1d'));};exports[_0xb28c('0x22')]=function(_0x2db079,_0x4fe0a4){if(_0x4fe0a4){return moment(_0x2db079)['isAfter'](_0x4fe0a4);}else{return!![];}};exports[_0xb28c('0x23')]=function(_0x36e199,_0x559159){if(_0x559159){return moment(_0x36e199)[_0xb28c('0x23')](_0x559159);}else if(_0x36e199){return!![];}else{return![];}}; \ No newline at end of file +var _0xe4ab=['moment','bluebird','http','xdr','info','debug','stringify','error','stack','request','then','catch','GetUser','internal','name','result','FOUND','NOTFOUND','length','getUserByInternal','getUserByInterface','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','GETVOICEQUEUEBYNAME|','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diffTime','now','isAfter','isBefore','jayson/promise'];(function(_0x54d197,_0x5c5884){var _0x5aa343=function(_0x3a63ed){while(--_0x3a63ed){_0x54d197['push'](_0x54d197['shift']());}};_0x5aa343(++_0x5c5884);}(_0xe4ab,0x12f));var _0xbe4a=function(_0xb25dcd,_0x15efc5){_0xb25dcd=_0xb25dcd-0x0;var _0x109418=_0xe4ab[_0xb25dcd];return _0x109418;};'use strict';var jayson=require(_0xbe4a('0x0'));var moment=require(_0xbe4a('0x1'));var BPromise=require(_0xbe4a('0x2'));var client=jayson['client'][_0xbe4a('0x3')]({'port':0x2329});var logger=require('../../config/logger')(_0xbe4a('0x4'));exports['info']=function(_0x48d4d7){logger[_0xbe4a('0x5')](_0x48d4d7);};exports[_0xbe4a('0x6')]=function(_0x47ab49){logger['debug'](JSON[_0xbe4a('0x7')](_0x47ab49));};exports[_0xbe4a('0x8')]=function(_0x3d0a03){logger[_0xbe4a('0x8')](_0x3d0a03[_0xbe4a('0x9')]);};exports[_0xbe4a('0xa')]=function(_0x4eb286,_0xcef27f){return client[_0xbe4a('0xa')](_0x4eb286,{'body':_0xcef27f})[_0xbe4a('0xb')](function(_0x593b79){logger[_0xbe4a('0x6')](JSON[_0xbe4a('0x7')](_0x593b79));})[_0xbe4a('0xc')](function(_0x1cf0c9){logger[_0xbe4a('0x8')](_0x1cf0c9[_0xbe4a('0x9')]);});};function getUser(_0x358ce4){return client[_0xbe4a('0xa')](_0xbe4a('0xd'),{'options':{'raw':!![],'attributes':['id',_0xbe4a('0xe'),_0xbe4a('0xf'),'interface'],'where':_0x358ce4,'limit':0x1}})[_0xbe4a('0xb')](function(_0x47b0ce){logger[_0xbe4a('0x5')]('GETUSER|'+JSON[_0xbe4a('0x7')](_0x358ce4)+'|'+(_0x47b0ce[_0xbe4a('0x10')]['length']?_0xbe4a('0x11'):_0xbe4a('0x12')));return _0x47b0ce[_0xbe4a('0x10')][_0xbe4a('0x13')]?_0x47b0ce[_0xbe4a('0x10')][0x0]:null;});}exports[_0xbe4a('0x14')]=function(_0x120fe6){return new BPromise(function(_0x5d956b,_0x202e93){if(_0x120fe6){return getUser({'internal':_0x120fe6})[_0xbe4a('0xb')](function(_0x53e0b4){return _0x5d956b(_0x53e0b4);})[_0xbe4a('0xc')](function(_0x48284a){logger[_0xbe4a('0x8')](_0x48284a[_0xbe4a('0x9')]);return _0x5d956b(null);});}else{return _0x5d956b(null);}});};exports[_0xbe4a('0x15')]=function(_0x433255){return new BPromise(function(_0x2fd388,_0xea77ff){if(_0x433255){return getUser({'interface':_0x433255})[_0xbe4a('0xb')](function(_0x34e98a){return _0x2fd388(_0x34e98a);})[_0xbe4a('0xc')](function(_0x2a185f){logger[_0xbe4a('0x8')](_0x2a185f[_0xbe4a('0x9')]);return _0x2fd388(null);});}else{return _0x2fd388(null);}});};exports['getUserByName']=function(_0x2ab28){return new BPromise(function(_0x5371d2,_0x10e51c){if(_0x2ab28){return getUser({'name':_0x2ab28})['then'](function(_0x556ff0){return _0x5371d2(_0x556ff0);})[_0xbe4a('0xc')](function(_0x495aad){logger['error'](_0x495aad[_0xbe4a('0x9')]);return _0x5371d2(null);});}else{return _0x5371d2(null);}});};exports[_0xbe4a('0x16')]=function(_0x4b5fb5){return new BPromise(function(_0x624bbf,_0x2af209){if(_0x4b5fb5){return client[_0xbe4a('0xa')](_0xbe4a('0x17'),{'options':{'raw':!![],'attributes':['id',_0xbe4a('0xf'),_0xbe4a('0x18'),_0xbe4a('0x19'),_0xbe4a('0x1a')],'where':{'name':_0x4b5fb5},'limit':0x1}})[_0xbe4a('0xb')](function(_0xff4c8b){logger[_0xbe4a('0x5')](_0xbe4a('0x1b')+_0x4b5fb5+'|'+(_0xff4c8b[_0xbe4a('0x10')][_0xbe4a('0x13')]?_0xbe4a('0x11'):_0xbe4a('0x12')));return _0x624bbf(_0xff4c8b[_0xbe4a('0x10')]['length']?_0xff4c8b[_0xbe4a('0x10')][0x0]:null);})[_0xbe4a('0xc')](function(_0x3e2971){logger['error'](_0x3e2971[_0xbe4a('0x9')]);return _0x624bbf(null);});}else{return _0x624bbf(null);}});};exports['addTime']=function(_0x352adb,_0x169c44){return moment(_0x352adb)[_0xbe4a('0x1c')](_0x169c44,'seconds')[_0xbe4a('0x1d')](_0xbe4a('0x1e'));};exports[_0xbe4a('0x1f')]=function(_0x23d18e,_0x10a8b5){return moment(_0x23d18e)[_0xbe4a('0x20')](_0x10a8b5,_0xbe4a('0x21'))[_0xbe4a('0x1d')](_0xbe4a('0x1e'));};exports[_0xbe4a('0x22')]=function(_0x210387,_0x5deba5){return moment(_0x210387)['diff'](moment(_0x5deba5),'seconds');};exports['sumTime']=function(_0x328b8a,_0xf3772e){return parseInt(_0x328b8a,0xa)+parseInt(_0xf3772e,0xa);};exports[_0xbe4a('0x23')]=function(){return moment()[_0xbe4a('0x1d')](_0xbe4a('0x1e'));};exports[_0xbe4a('0x24')]=function(_0x563eb9,_0x90ec59){if(_0x90ec59){return moment(_0x563eb9)[_0xbe4a('0x24')](_0x90ec59);}else{return!![];}};exports[_0xbe4a('0x25')]=function(_0x22be18,_0x407b61){if(_0x407b61){return moment(_0x22be18)[_0xbe4a('0x25')](_0x407b61);}else if(_0x22be18){return!![];}else{return![];}}; \ No newline at end of file